clang  15.0.0git
TargetInfo.cpp
Go to the documentation of this file.
1 //===--- TargetInfo.cpp - Information about Target machine ----------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the TargetInfo and TargetInfoImpl interfaces.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "clang/Basic/TargetInfo.h"
15 #include "clang/Basic/CharInfo.h"
16 #include "clang/Basic/Diagnostic.h"
18 #include "llvm/ADT/APFloat.h"
19 #include "llvm/ADT/STLExtras.h"
20 #include "llvm/Support/ErrorHandling.h"
21 #include "llvm/Support/TargetParser.h"
22 #include <cstdlib>
23 using namespace clang;
24 
25 static const LangASMap DefaultAddrSpaceMap = {0};
26 
27 // TargetInfo Constructor.
28 TargetInfo::TargetInfo(const llvm::Triple &T) : Triple(T) {
29  // Set defaults. Defaults are set for a 32-bit RISC platform, like PPC or
30  // SPARC. These should be overridden by concrete targets as needed.
31  BigEndian = !T.isLittleEndian();
32  TLSSupported = true;
33  VLASupported = true;
34  NoAsmVariants = false;
35  HasLegalHalfType = false;
36  HasFloat128 = false;
37  HasIbm128 = false;
38  HasFloat16 = false;
39  HasBFloat16 = false;
40  HasLongDouble = true;
41  HasFPReturn = true;
42  HasStrictFP = false;
44  BoolWidth = BoolAlign = 8;
45  IntWidth = IntAlign = 32;
46  LongWidth = LongAlign = 32;
48 
49  // Fixed point default bit widths
51  AccumWidth = AccumAlign = 32;
54  FractWidth = FractAlign = 16;
56 
57  // Fixed point default integral and fractional bit sizes
58  // We give the _Accum 1 fewer fractional bits than their corresponding _Fract
59  // types by default to have the same number of fractional bits between _Accum
60  // and _Fract types.
62  ShortAccumScale = 7;
63  AccumScale = 15;
64  LongAccumScale = 31;
65 
66  SuitableAlign = 64;
68  MinGlobalAlign = 0;
69  // From the glibc documentation, on GNU systems, malloc guarantees 16-byte
70  // alignment on 64-bit systems and 8-byte alignment on 32-bit systems. See
71  // https://www.gnu.org/software/libc/manual/html_node/Malloc-Examples.html.
72  // This alignment guarantee also applies to Windows and Android. On Darwin
73  // and OpenBSD, the alignment is 16 bytes on both 64-bit and 32-bit systems.
74  if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment() || T.isAndroid())
75  NewAlign = Triple.isArch64Bit() ? 128 : Triple.isArch32Bit() ? 64 : 0;
76  else if (T.isOSDarwin() || T.isOSOpenBSD())
77  NewAlign = 128;
78  else
79  NewAlign = 0; // Infer from basic type alignment.
80  HalfWidth = 16;
81  HalfAlign = 16;
82  FloatWidth = 32;
83  FloatAlign = 32;
84  DoubleWidth = 64;
85  DoubleAlign = 64;
86  LongDoubleWidth = 64;
87  LongDoubleAlign = 64;
88  Float128Align = 128;
89  Ibm128Align = 128;
91  LargeArrayAlign = 0;
93  MaxVectorAlign = 0;
94  MaxTLSAlign = 0;
95  SimdDefaultAlign = 0;
115  HalfFormat = &llvm::APFloat::IEEEhalf();
116  FloatFormat = &llvm::APFloat::IEEEsingle();
117  DoubleFormat = &llvm::APFloat::IEEEdouble();
118  LongDoubleFormat = &llvm::APFloat::IEEEdouble();
119  Float128Format = &llvm::APFloat::IEEEquad();
120  Ibm128Format = &llvm::APFloat::PPCDoubleDouble();
121  MCountName = "mcount";
122  UserLabelPrefix = "_";
123  RegParmMax = 0;
124  SSERegParmMax = 0;
125  HasAlignMac68kSupport = false;
126  HasBuiltinMSVaList = false;
127  IsRenderScriptTarget = false;
128  HasAArch64SVETypes = false;
129  HasRISCVVTypes = false;
131  ARMCDECoprocMask = 0;
132 
133  // Default to no types using fpret.
135 
136  // Default to not using fp2ret for __Complex long double
138 
139  // Set the C++ ABI based on the triple.
140  TheCXXABI.set(Triple.isKnownWindowsMSVCEnvironment()
141  ? TargetCXXABI::Microsoft
142  : TargetCXXABI::GenericItanium);
143 
144  // Default to an empty address space map.
146  UseAddrSpaceMapMangling = false;
147 
148  // Default to an unknown platform name.
149  PlatformName = "unknown";
150  PlatformMinVersion = VersionTuple();
151 
152  MaxOpenCLWorkGroupSize = 1024;
153  ProgramAddrSpace = 0;
154 }
155 
156 // Out of line virtual dtor for TargetInfo.
158 
159 void TargetInfo::resetDataLayout(StringRef DL, const char *ULP) {
160  DataLayoutString = DL.str();
161  UserLabelPrefix = ULP;
162 }
163 
164 bool
166  Diags.Report(diag::err_opt_not_valid_on_target) << "cf-protection=branch";
167  return false;
168 }
169 
170 bool
172  Diags.Report(diag::err_opt_not_valid_on_target) << "cf-protection=return";
173  return false;
174 }
175 
176 /// getTypeName - Return the user string for the specified integer type enum.
177 /// For example, SignedShort -> "short".
179  switch (T) {
180  default: llvm_unreachable("not an integer!");
181  case SignedChar: return "signed char";
182  case UnsignedChar: return "unsigned char";
183  case SignedShort: return "short";
184  case UnsignedShort: return "unsigned short";
185  case SignedInt: return "int";
186  case UnsignedInt: return "unsigned int";
187  case SignedLong: return "long int";
188  case UnsignedLong: return "long unsigned int";
189  case SignedLongLong: return "long long int";
190  case UnsignedLongLong: return "long long unsigned int";
191  }
192 }
193 
194 /// getTypeConstantSuffix - Return the constant suffix for the specified
195 /// integer type enum. For example, SignedLong -> "L".
197  switch (T) {
198  default: llvm_unreachable("not an integer!");
199  case SignedChar:
200  case SignedShort:
201  case SignedInt: return "";
202  case SignedLong: return "L";
203  case SignedLongLong: return "LL";
204  case UnsignedChar:
205  if (getCharWidth() < getIntWidth())
206  return "";
207  LLVM_FALLTHROUGH;
208  case UnsignedShort:
209  if (getShortWidth() < getIntWidth())
210  return "";
211  LLVM_FALLTHROUGH;
212  case UnsignedInt: return "U";
213  case UnsignedLong: return "UL";
214  case UnsignedLongLong: return "ULL";
215  }
216 }
217 
218 /// getTypeFormatModifier - Return the printf format modifier for the
219 /// specified integer type enum. For example, SignedLong -> "l".
220 
222  switch (T) {
223  default: llvm_unreachable("not an integer!");
224  case SignedChar:
225  case UnsignedChar: return "hh";
226  case SignedShort:
227  case UnsignedShort: return "h";
228  case SignedInt:
229  case UnsignedInt: return "";
230  case SignedLong:
231  case UnsignedLong: return "l";
232  case SignedLongLong:
233  case UnsignedLongLong: return "ll";
234  }
235 }
236 
237 /// getTypeWidth - Return the width (in bits) of the specified integer type
238 /// enum. For example, SignedInt -> getIntWidth().
240  switch (T) {
241  default: llvm_unreachable("not an integer!");
242  case SignedChar:
243  case UnsignedChar: return getCharWidth();
244  case SignedShort:
245  case UnsignedShort: return getShortWidth();
246  case SignedInt:
247  case UnsignedInt: return getIntWidth();
248  case SignedLong:
249  case UnsignedLong: return getLongWidth();
250  case SignedLongLong:
251  case UnsignedLongLong: return getLongLongWidth();
252  };
253 }
254 
256  unsigned BitWidth, bool IsSigned) const {
257  if (getCharWidth() == BitWidth)
258  return IsSigned ? SignedChar : UnsignedChar;
259  if (getShortWidth() == BitWidth)
260  return IsSigned ? SignedShort : UnsignedShort;
261  if (getIntWidth() == BitWidth)
262  return IsSigned ? SignedInt : UnsignedInt;
263  if (getLongWidth() == BitWidth)
264  return IsSigned ? SignedLong : UnsignedLong;
265  if (getLongLongWidth() == BitWidth)
266  return IsSigned ? SignedLongLong : UnsignedLongLong;
267  return NoInt;
268 }
269 
271  bool IsSigned) const {
272  if (getCharWidth() >= BitWidth)
273  return IsSigned ? SignedChar : UnsignedChar;
274  if (getShortWidth() >= BitWidth)
275  return IsSigned ? SignedShort : UnsignedShort;
276  if (getIntWidth() >= BitWidth)
277  return IsSigned ? SignedInt : UnsignedInt;
278  if (getLongWidth() >= BitWidth)
279  return IsSigned ? SignedLong : UnsignedLong;
280  if (getLongLongWidth() >= BitWidth)
281  return IsSigned ? SignedLongLong : UnsignedLongLong;
282  return NoInt;
283 }
284 
286  FloatModeKind ExplicitType) const {
287  if (getFloatWidth() == BitWidth)
288  return FloatModeKind::Float;
289  if (getDoubleWidth() == BitWidth)
290  return FloatModeKind::Double;
291 
292  switch (BitWidth) {
293  case 96:
294  if (&getLongDoubleFormat() == &llvm::APFloat::x87DoubleExtended())
296  break;
297  case 128:
298  // The caller explicitly asked for an IEEE compliant type but we still
299  // have to check if the target supports it.
300  if (ExplicitType == FloatModeKind::Float128)
303  if (ExplicitType == FloatModeKind::Ibm128)
306  if (&getLongDoubleFormat() == &llvm::APFloat::PPCDoubleDouble() ||
307  &getLongDoubleFormat() == &llvm::APFloat::IEEEquad())
309  if (hasFloat128Type())
311  break;
312  }
313 
314  return FloatModeKind::NoFloat;
315 }
316 
317 /// getTypeAlign - Return the alignment (in bits) of the specified integer type
318 /// enum. For example, SignedInt -> getIntAlign().
320  switch (T) {
321  default: llvm_unreachable("not an integer!");
322  case SignedChar:
323  case UnsignedChar: return getCharAlign();
324  case SignedShort:
325  case UnsignedShort: return getShortAlign();
326  case SignedInt:
327  case UnsignedInt: return getIntAlign();
328  case SignedLong:
329  case UnsignedLong: return getLongAlign();
330  case SignedLongLong:
331  case UnsignedLongLong: return getLongLongAlign();
332  };
333 }
334 
335 /// isTypeSigned - Return whether an integer types is signed. Returns true if
336 /// the type is signed; false otherwise.
338  switch (T) {
339  default: llvm_unreachable("not an integer!");
340  case SignedChar:
341  case SignedShort:
342  case SignedInt:
343  case SignedLong:
344  case SignedLongLong:
345  return true;
346  case UnsignedChar:
347  case UnsignedShort:
348  case UnsignedInt:
349  case UnsignedLong:
350  case UnsignedLongLong:
351  return false;
352  };
353 }
354 
355 /// adjust - Set forced language options.
356 /// Apply changes to the target information with respect to certain
357 /// language options which change the target configuration and adjust
358 /// the language based on the target options where applicable.
360  if (Opts.NoBitFieldTypeAlign)
361  UseBitFieldTypeAlignment = false;
362 
363  switch (Opts.WCharSize) {
364  default: llvm_unreachable("invalid wchar_t width");
365  case 0: break;
366  case 1: WCharType = Opts.WCharIsSigned ? SignedChar : UnsignedChar; break;
367  case 2: WCharType = Opts.WCharIsSigned ? SignedShort : UnsignedShort; break;
368  case 4: WCharType = Opts.WCharIsSigned ? SignedInt : UnsignedInt; break;
369  }
370 
371  if (Opts.AlignDouble) {
372  DoubleAlign = LongLongAlign = 64;
373  LongDoubleAlign = 64;
374  }
375 
376  if (Opts.OpenCL) {
377  // OpenCL C requires specific widths for types, irrespective of
378  // what these normally are for the target.
379  // We also define long long and long double here, although the
380  // OpenCL standard only mentions these as "reserved".
381  IntWidth = IntAlign = 32;
382  LongWidth = LongAlign = 64;
384  HalfWidth = HalfAlign = 16;
385  FloatWidth = FloatAlign = 32;
386 
387  // Embedded 32-bit targets (OpenCL EP) might have double C type
388  // defined as float. Let's not override this as it might lead
389  // to generating illegal code that uses 64bit doubles.
390  if (DoubleWidth != FloatWidth) {
391  DoubleWidth = DoubleAlign = 64;
392  DoubleFormat = &llvm::APFloat::IEEEdouble();
393  }
395 
396  unsigned MaxPointerWidth = getMaxPointerWidth();
397  assert(MaxPointerWidth == 32 || MaxPointerWidth == 64);
398  bool Is32BitArch = MaxPointerWidth == 32;
399  SizeType = Is32BitArch ? UnsignedInt : UnsignedLong;
400  PtrDiffType = Is32BitArch ? SignedInt : SignedLong;
401  IntPtrType = Is32BitArch ? SignedInt : SignedLong;
402 
405 
406  HalfFormat = &llvm::APFloat::IEEEhalf();
407  FloatFormat = &llvm::APFloat::IEEEsingle();
408  LongDoubleFormat = &llvm::APFloat::IEEEquad();
409 
410  // OpenCL C v3.0 s6.7.5 - The generic address space requires support for
411  // OpenCL C 2.0 or OpenCL C 3.0 with the __opencl_c_generic_address_space
412  // feature
413  // OpenCL C v3.0 s6.2.1 - OpenCL pipes require support of OpenCL C 2.0
414  // or later and __opencl_c_pipes feature
415  // FIXME: These language options are also defined in setLangDefaults()
416  // for OpenCL C 2.0 but with no access to target capabilities. Target
417  // should be immutable once created and thus these language options need
418  // to be defined only once.
419  if (Opts.getOpenCLCompatibleVersion() == 300) {
420  const auto &OpenCLFeaturesMap = getSupportedOpenCLOpts();
421  Opts.OpenCLGenericAddressSpace = hasFeatureEnabled(
422  OpenCLFeaturesMap, "__opencl_c_generic_address_space");
423  Opts.OpenCLPipes =
424  hasFeatureEnabled(OpenCLFeaturesMap, "__opencl_c_pipes");
425  Opts.Blocks =
426  hasFeatureEnabled(OpenCLFeaturesMap, "__opencl_c_device_enqueue");
427  }
428  }
429 
430  if (Opts.DoubleSize) {
431  if (Opts.DoubleSize == 32) {
432  DoubleWidth = 32;
433  LongDoubleWidth = 32;
434  DoubleFormat = &llvm::APFloat::IEEEsingle();
435  LongDoubleFormat = &llvm::APFloat::IEEEsingle();
436  } else if (Opts.DoubleSize == 64) {
437  DoubleWidth = 64;
438  LongDoubleWidth = 64;
439  DoubleFormat = &llvm::APFloat::IEEEdouble();
440  LongDoubleFormat = &llvm::APFloat::IEEEdouble();
441  }
442  }
443 
444  if (Opts.LongDoubleSize) {
445  if (Opts.LongDoubleSize == DoubleWidth) {
449  } else if (Opts.LongDoubleSize == 128) {
451  LongDoubleFormat = &llvm::APFloat::IEEEquad();
452  } else if (Opts.LongDoubleSize == 80) {
453  LongDoubleFormat = &llvm::APFloat::x87DoubleExtended();
454  if (getTriple().isWindowsMSVCEnvironment()) {
455  LongDoubleWidth = 128;
456  LongDoubleAlign = 128;
457  } else { // Linux
458  if (getTriple().getArch() == llvm::Triple::x86) {
459  LongDoubleWidth = 96;
460  LongDoubleAlign = 32;
461  } else {
462  LongDoubleWidth = 128;
463  LongDoubleAlign = 128;
464  }
465  }
466  }
467  }
468 
469  if (Opts.NewAlignOverride)
470  NewAlign = Opts.NewAlignOverride * getCharWidth();
471 
472  // Each unsigned fixed point type has the same number of fractional bits as
473  // its corresponding signed type.
474  PaddingOnUnsignedFixedPoint |= Opts.PaddingOnUnsignedFixedPoint;
475  CheckFixedPointBits();
476 
477  if (Opts.ProtectParens && !checkArithmeticFenceSupported()) {
478  Diags.Report(diag::err_opt_not_valid_on_target) << "-fprotect-parens";
479  Opts.ProtectParens = false;
480  }
481 }
482 
484  llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags, StringRef CPU,
485  const std::vector<std::string> &FeatureVec) const {
486  for (const auto &F : FeatureVec) {
487  StringRef Name = F;
488  // Apply the feature via the target.
489  bool Enabled = Name[0] == '+';
490  setFeatureEnabled(Features, Name.substr(1), Enabled);
491  }
492  return true;
493 }
494 
496 TargetInfo::getCallingConvKind(bool ClangABICompat4) const {
497  if (getCXXABI() != TargetCXXABI::Microsoft &&
498  (ClangABICompat4 || getTriple().getOS() == llvm::Triple::PS4))
499  return CCK_ClangABI4OrPS4;
500  return CCK_Default;
501 }
502 
504  switch (TK) {
505  case OCLTK_Image:
506  case OCLTK_Pipe:
507  return LangAS::opencl_global;
508 
509  case OCLTK_Sampler:
511 
512  default:
513  return LangAS::Default;
514  }
515 }
516 
517 //===----------------------------------------------------------------------===//
518 
519 
520 static StringRef removeGCCRegisterPrefix(StringRef Name) {
521  if (Name[0] == '%' || Name[0] == '#')
522  Name = Name.substr(1);
523 
524  return Name;
525 }
526 
527 /// isValidClobber - Returns whether the passed in string is
528 /// a valid clobber in an inline asm statement. This is used by
529 /// Sema.
530 bool TargetInfo::isValidClobber(StringRef Name) const {
531  return (isValidGCCRegisterName(Name) || Name == "memory" || Name == "cc" ||
532  Name == "unwind");
533 }
534 
535 /// isValidGCCRegisterName - Returns whether the passed in string
536 /// is a valid register name according to GCC. This is used by Sema for
537 /// inline asm statements.
538 bool TargetInfo::isValidGCCRegisterName(StringRef Name) const {
539  if (Name.empty())
540  return false;
541 
542  // Get rid of any register prefix.
543  Name = removeGCCRegisterPrefix(Name);
544  if (Name.empty())
545  return false;
546 
548 
549  // If we have a number it maps to an entry in the register name array.
550  if (isDigit(Name[0])) {
551  unsigned n;
552  if (!Name.getAsInteger(0, n))
553  return n < Names.size();
554  }
555 
556  // Check register names.
557  if (llvm::is_contained(Names, Name))
558  return true;
559 
560  // Check any additional names that we have.
561  for (const AddlRegName &ARN : getGCCAddlRegNames())
562  for (const char *AN : ARN.Names) {
563  if (!AN)
564  break;
565  // Make sure the register that the additional name is for is within
566  // the bounds of the register names from above.
567  if (AN == Name && ARN.RegNum < Names.size())
568  return true;
569  }
570 
571  // Now check aliases.
572  for (const GCCRegAlias &GRA : getGCCRegAliases())
573  for (const char *A : GRA.Aliases) {
574  if (!A)
575  break;
576  if (A == Name)
577  return true;
578  }
579 
580  return false;
581 }
582 
584  bool ReturnCanonical) const {
585  assert(isValidGCCRegisterName(Name) && "Invalid register passed in");
586 
587  // Get rid of any register prefix.
588  Name = removeGCCRegisterPrefix(Name);
589 
591 
592  // First, check if we have a number.
593  if (isDigit(Name[0])) {
594  unsigned n;
595  if (!Name.getAsInteger(0, n)) {
596  assert(n < Names.size() && "Out of bounds register number!");
597  return Names[n];
598  }
599  }
600 
601  // Check any additional names that we have.
602  for (const AddlRegName &ARN : getGCCAddlRegNames())
603  for (const char *AN : ARN.Names) {
604  if (!AN)
605  break;
606  // Make sure the register that the additional name is for is within
607  // the bounds of the register names from above.
608  if (AN == Name && ARN.RegNum < Names.size())
609  return ReturnCanonical ? Names[ARN.RegNum] : Name;
610  }
611 
612  // Now check aliases.
613  for (const GCCRegAlias &RA : getGCCRegAliases())
614  for (const char *A : RA.Aliases) {
615  if (!A)
616  break;
617  if (A == Name)
618  return RA.Register;
619  }
620 
621  return Name;
622 }
623 
625  const char *Name = Info.getConstraintStr().c_str();
626  // An output constraint must start with '=' or '+'
627  if (*Name != '=' && *Name != '+')
628  return false;
629 
630  if (*Name == '+')
631  Info.setIsReadWrite();
632 
633  Name++;
634  while (*Name) {
635  switch (*Name) {
636  default:
637  if (!validateAsmConstraint(Name, Info)) {
638  // FIXME: We temporarily return false
639  // so we can add more constraints as we hit it.
640  // Eventually, an unknown constraint should just be treated as 'g'.
641  return false;
642  }
643  break;
644  case '&': // early clobber.
645  Info.setEarlyClobber();
646  break;
647  case '%': // commutative.
648  // FIXME: Check that there is a another register after this one.
649  break;
650  case 'r': // general register.
651  Info.setAllowsRegister();
652  break;
653  case 'm': // memory operand.
654  case 'o': // offsetable memory operand.
655  case 'V': // non-offsetable memory operand.
656  case '<': // autodecrement memory operand.
657  case '>': // autoincrement memory operand.
658  Info.setAllowsMemory();
659  break;
660  case 'g': // general register, memory operand or immediate integer.
661  case 'X': // any operand.
662  Info.setAllowsRegister();
663  Info.setAllowsMemory();
664  break;
665  case ',': // multiple alternative constraint. Pass it.
666  // Handle additional optional '=' or '+' modifiers.
667  if (Name[1] == '=' || Name[1] == '+')
668  Name++;
669  break;
670  case '#': // Ignore as constraint.
671  while (Name[1] && Name[1] != ',')
672  Name++;
673  break;
674  case '?': // Disparage slightly code.
675  case '!': // Disparage severely.
676  case '*': // Ignore for choosing register preferences.
677  case 'i': // Ignore i,n,E,F as output constraints (match from the other
678  // chars)
679  case 'n':
680  case 'E':
681  case 'F':
682  break; // Pass them.
683  }
684 
685  Name++;
686  }
687 
688  // Early clobber with a read-write constraint which doesn't permit registers
689  // is invalid.
690  if (Info.earlyClobber() && Info.isReadWrite() && !Info.allowsRegister())
691  return false;
692 
693  // If a constraint allows neither memory nor register operands it contains
694  // only modifiers. Reject it.
695  return Info.allowsMemory() || Info.allowsRegister();
696 }
697 
698 bool TargetInfo::resolveSymbolicName(const char *&Name,
699  ArrayRef<ConstraintInfo> OutputConstraints,
700  unsigned &Index) const {
701  assert(*Name == '[' && "Symbolic name did not start with '['");
702  Name++;
703  const char *Start = Name;
704  while (*Name && *Name != ']')
705  Name++;
706 
707  if (!*Name) {
708  // Missing ']'
709  return false;
710  }
711 
712  std::string SymbolicName(Start, Name - Start);
713 
714  for (Index = 0; Index != OutputConstraints.size(); ++Index)
715  if (SymbolicName == OutputConstraints[Index].getName())
716  return true;
717 
718  return false;
719 }
720 
722  MutableArrayRef<ConstraintInfo> OutputConstraints,
723  ConstraintInfo &Info) const {
724  const char *Name = Info.ConstraintStr.c_str();
725 
726  if (!*Name)
727  return false;
728 
729  while (*Name) {
730  switch (*Name) {
731  default:
732  // Check if we have a matching constraint
733  if (*Name >= '0' && *Name <= '9') {
734  const char *DigitStart = Name;
735  while (Name[1] >= '0' && Name[1] <= '9')
736  Name++;
737  const char *DigitEnd = Name;
738  unsigned i;
739  if (StringRef(DigitStart, DigitEnd - DigitStart + 1)
740  .getAsInteger(10, i))
741  return false;
742 
743  // Check if matching constraint is out of bounds.
744  if (i >= OutputConstraints.size()) return false;
745 
746  // A number must refer to an output only operand.
747  if (OutputConstraints[i].isReadWrite())
748  return false;
749 
750  // If the constraint is already tied, it must be tied to the
751  // same operand referenced to by the number.
752  if (Info.hasTiedOperand() && Info.getTiedOperand() != i)
753  return false;
754 
755  // The constraint should have the same info as the respective
756  // output constraint.
757  Info.setTiedOperand(i, OutputConstraints[i]);
758  } else if (!validateAsmConstraint(Name, Info)) {
759  // FIXME: This error return is in place temporarily so we can
760  // add more constraints as we hit it. Eventually, an unknown
761  // constraint should just be treated as 'g'.
762  return false;
763  }
764  break;
765  case '[': {
766  unsigned Index = 0;
767  if (!resolveSymbolicName(Name, OutputConstraints, Index))
768  return false;
769 
770  // If the constraint is already tied, it must be tied to the
771  // same operand referenced to by the number.
772  if (Info.hasTiedOperand() && Info.getTiedOperand() != Index)
773  return false;
774 
775  // A number must refer to an output only operand.
776  if (OutputConstraints[Index].isReadWrite())
777  return false;
778 
779  Info.setTiedOperand(Index, OutputConstraints[Index]);
780  break;
781  }
782  case '%': // commutative
783  // FIXME: Fail if % is used with the last operand.
784  break;
785  case 'i': // immediate integer.
786  break;
787  case 'n': // immediate integer with a known value.
788  Info.setRequiresImmediate();
789  break;
790  case 'I': // Various constant constraints with target-specific meanings.
791  case 'J':
792  case 'K':
793  case 'L':
794  case 'M':
795  case 'N':
796  case 'O':
797  case 'P':
798  if (!validateAsmConstraint(Name, Info))
799  return false;
800  break;
801  case 'r': // general register.
802  Info.setAllowsRegister();
803  break;
804  case 'm': // memory operand.
805  case 'o': // offsettable memory operand.
806  case 'V': // non-offsettable memory operand.
807  case '<': // autodecrement memory operand.
808  case '>': // autoincrement memory operand.
809  Info.setAllowsMemory();
810  break;
811  case 'g': // general register, memory operand or immediate integer.
812  case 'X': // any operand.
813  Info.setAllowsRegister();
814  Info.setAllowsMemory();
815  break;
816  case 'E': // immediate floating point.
817  case 'F': // immediate floating point.
818  case 'p': // address operand.
819  break;
820  case ',': // multiple alternative constraint. Ignore comma.
821  break;
822  case '#': // Ignore as constraint.
823  while (Name[1] && Name[1] != ',')
824  Name++;
825  break;
826  case '?': // Disparage slightly code.
827  case '!': // Disparage severely.
828  case '*': // Ignore for choosing register preferences.
829  break; // Pass them.
830  }
831 
832  Name++;
833  }
834 
835  return true;
836 }
837 
838 void TargetInfo::CheckFixedPointBits() const {
839  // Check that the number of fractional and integral bits (and maybe sign) can
840  // fit into the bits given for a fixed point type.
842  assert(AccumScale + getAccumIBits() + 1 <= AccumWidth);
849 
850  assert(getShortFractScale() + 1 <= ShortFractWidth);
851  assert(getFractScale() + 1 <= FractWidth);
852  assert(getLongFractScale() + 1 <= LongFractWidth);
854  assert(getUnsignedFractScale() <= FractWidth);
856 
857  // Each unsigned fract type has either the same number of fractional bits
858  // as, or one more fractional bit than, its corresponding signed fract type.
861  assert(getFractScale() == getUnsignedFractScale() ||
865 
866  // When arranged in order of increasing rank (see 6.3.1.3a), the number of
867  // fractional bits is nondecreasing for each of the following sets of
868  // fixed-point types:
869  // - signed fract types
870  // - unsigned fract types
871  // - signed accum types
872  // - unsigned accum types.
873  assert(getLongFractScale() >= getFractScale() &&
880 
881  // When arranged in order of increasing rank (see 6.3.1.3a), the number of
882  // integral bits is nondecreasing for each of the following sets of
883  // fixed-point types:
884  // - signed accum types
885  // - unsigned accum types
886  assert(getLongAccumIBits() >= getAccumIBits() &&
890 
891  // Each signed accum type has at least as many integral bits as its
892  // corresponding unsigned accum type.
894  assert(getAccumIBits() >= getUnsignedAccumIBits());
896 }
897 
899  auto *Target = static_cast<TransferrableTargetInfo*>(this);
900  auto *Src = static_cast<const TransferrableTargetInfo*>(Aux);
901  *Target = *Src;
902 }
clang::TransferrableTargetInfo::PointerAlign
unsigned char PointerAlign
Definition: TargetInfo.h:66
clang::TargetInfo::DataLayoutString
std::string DataLayoutString
Definition: TargetInfo.h:209
clang::TransferrableTargetInfo::LongWidth
unsigned char LongWidth
Definition: TargetInfo.h:75
clang::TargetInfo::ConstraintInfo::allowsMemory
bool allowsMemory() const
Definition: TargetInfo.h:1025
clang::TransferrableTargetInfo::LargeArrayAlign
unsigned char LargeArrayAlign
Definition: TargetInfo.h:74
clang::TargetInfo::getLongDoubleFormat
const llvm::fltSemantics & getLongDoubleFormat() const
Definition: TargetInfo.h:694
clang::TargetInfo::CCK_Default
@ CCK_Default
Definition: TargetInfo.h:1523
clang::TargetInfo::PlatformMinVersion
VersionTuple PlatformMinVersion
Definition: TargetInfo.h:218
clang::TargetInfo::RegParmMax
unsigned char RegParmMax
Definition: TargetInfo.h:212
clang::TransferrableTargetInfo::IntPtrType
IntType IntPtrType
Definition: TargetInfo.h:131
clang::TransferrableTargetInfo::ShortFractAlign
unsigned char ShortFractAlign
Definition: TargetInfo.h:82
clang::TransferrableTargetInfo::AccumWidth
unsigned char AccumWidth
Definition: TargetInfo.h:80
clang::TransferrableTargetInfo::UnsignedChar
@ UnsignedChar
Definition: TargetInfo.h:119
clang::TargetInfo::isValidGCCRegisterName
virtual bool isValidGCCRegisterName(StringRef Name) const
Returns whether the passed in string is a valid register name according to GCC.
Definition: TargetInfo.cpp:538
clang::TransferrableTargetInfo::IntMaxType
IntType IntMaxType
Definition: TargetInfo.h:131
clang::FloatModeKind::LongDouble
@ LongDouble
clang::LangOptions::getOpenCLCompatibleVersion
unsigned getOpenCLCompatibleVersion() const
Return the OpenCL version that kernel language is compatible with.
Definition: LangOptions.cpp:55
clang::TargetInfo::getAccumIBits
unsigned getAccumIBits() const
Definition: TargetInfo.h:507
clang::TargetInfo::getLongAccumIBits
unsigned getLongAccumIBits() const
Definition: TargetInfo.h:512
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::TransferrableTargetInfo::SignedChar
@ SignedChar
Definition: TargetInfo.h:118
clang::TargetInfo::CCK_ClangABI4OrPS4
@ CCK_ClangABI4OrPS4
Definition: TargetInfo.h:1524
clang::TargetInfo::getTypeConstantSuffix
const char * getTypeConstantSuffix(IntType T) const
Return the constant suffix for the specified integer type enum.
Definition: TargetInfo.cpp:196
clang::TransferrableTargetInfo::UseExplicitBitFieldAlignment
unsigned UseExplicitBitFieldAlignment
Whether explicit bit field alignment attributes are honored.
Definition: TargetInfo.h:161
clang::TargetInfo::getLongWidth
unsigned getLongWidth() const
getLongWidth/Align - Return the size of 'signed long' and 'unsigned long' for this target,...
Definition: TargetInfo.h:459
clang::TransferrableTargetInfo::LongLongAlign
unsigned char LongLongAlign
Definition: TargetInfo.h:76
clang::TargetInfo::getUnsignedLongAccumScale
unsigned getUnsignedLongAccumScale() const
getUnsignedLongAccumScale/IBits - Return the number of fractional/integral bits in a 'unsigned long _...
Definition: TargetInfo.h:539
clang::TransferrableTargetInfo::DoubleAlign
unsigned char DoubleAlign
Definition: TargetInfo.h:72
clang::TransferrableTargetInfo::SigAtomicType
IntType SigAtomicType
Definition: TargetInfo.h:132
clang::TransferrableTargetInfo::LongAccumScale
unsigned char LongAccumScale
Definition: TargetInfo.h:102
clang::TargetInfo::HasAlignMac68kSupport
unsigned HasAlignMac68kSupport
Definition: TargetInfo.h:220
clang::TargetInfo::TheCXXABI
TargetCXXABI TheCXXABI
Definition: TargetInfo.h:213
TargetInfo.h
clang::MultiVersionKind::Target
@ Target
clang::TargetInfo::getUnsignedShortAccumIBits
unsigned getUnsignedShortAccumIBits() const
Definition: TargetInfo.h:521
clang::TransferrableTargetInfo::MaxAlignedAttribute
unsigned MaxAlignedAttribute
If non-zero, specifies a maximum alignment to truncate alignment specified in the aligned attribute o...
Definition: TargetInfo.h:169
clang::TargetInfo::checkCFProtectionReturnSupported
virtual bool checkCFProtectionReturnSupported(DiagnosticsEngine &Diags) const
Check if the target supports CFProtection branch.
Definition: TargetInfo.cpp:171
clang::TargetInfo::ConstraintInfo::setEarlyClobber
void setEarlyClobber()
Definition: TargetInfo.h:1053
clang::TargetInfo::isTypeSigned
static bool isTypeSigned(IntType T)
Returns true if the type is signed; false otherwise.
Definition: TargetInfo.cpp:337
clang::TransferrableTargetInfo::UseZeroLengthBitfieldAlignment
unsigned UseZeroLengthBitfieldAlignment
Whether zero length bitfields (e.g., int : 0;) force alignment of the next bitfield.
Definition: TargetInfo.h:154
clang::TargetInfo::RealTypeUsesObjCFPRet
unsigned RealTypeUsesObjCFPRet
Definition: TargetInfo.h:221
clang::TransferrableTargetInfo::UnsignedShort
@ UnsignedShort
Definition: TargetInfo.h:121
clang::DiagnosticsEngine
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:192
clang::TargetInfo::getCXXABI
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
Definition: TargetInfo.h:1233
clang::TargetInfo
Exposes information about the current target.
Definition: TargetInfo.h:186
clang::TransferrableTargetInfo::MaxTLSAlign
unsigned MaxTLSAlign
Definition: TargetInfo.h:110
clang::TransferrableTargetInfo::DefaultAlignForAttributeAligned
unsigned char DefaultAlignForAttributeAligned
Definition: TargetInfo.h:104
clang::TargetInfo::getCallingConvKind
virtual CallingConvKind getCallingConvKind(bool ClangABICompat4) const
Definition: TargetInfo.cpp:496
clang::OCLTK_Image
@ OCLTK_Image
Definition: TargetInfo.h:177
clang::TargetInfo::adjust
virtual void adjust(DiagnosticsEngine &Diags, LangOptions &Opts)
Set forced language options.
Definition: TargetInfo.cpp:359
clang::TransferrableTargetInfo::WIntType
IntType WIntType
Definition: TargetInfo.h:131
clang::TargetInfo::getFractScale
unsigned getFractScale() const
getFractScale - Return the number of fractional bits in a 'signed _Fract' type.
Definition: TargetInfo.h:554
clang::TargetInfo::getCharWidth
unsigned getCharWidth() const
Definition: TargetInfo.h:441
clang::TargetInfo::validateAsmConstraint
virtual bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &info) const =0
clang::TargetInfo::IsRenderScriptTarget
unsigned IsRenderScriptTarget
Definition: TargetInfo.h:226
clang::TargetInfo::getUnsignedShortAccumScale
unsigned getUnsignedShortAccumScale() const
getUnsignedShortAccumScale/IBits - Return the number of fractional/integral bits in a 'unsigned short...
Definition: TargetInfo.h:518
clang::TargetInfo::getLongLongWidth
unsigned getLongLongWidth() const
getLongLongWidth/Align - Return the size of 'signed long long' and 'unsigned long long' for this targ...
Definition: TargetInfo.h:464
clang::TransferrableTargetInfo::BoolAlign
unsigned char BoolAlign
Definition: TargetInfo.h:67
clang::TransferrableTargetInfo::Float128Align
unsigned char Float128Align
Definition: TargetInfo.h:73
clang::TargetInfo::getLongAlign
unsigned getLongAlign() const
Definition: TargetInfo.h:460
clang::TargetInfo::HasBFloat16
bool HasBFloat16
Definition: TargetInfo.h:201
clang::TargetInfo::UseAddrSpaceMapMangling
bool UseAddrSpaceMapMangling
Specify if mangling based on address space map should be used or not for language specific address sp...
Definition: TargetInfo.h:316
clang::TransferrableTargetInfo::LongAlign
unsigned char LongAlign
Definition: TargetInfo.h:75
clang::TransferrableTargetInfo::ShortFractWidth
unsigned char ShortFractWidth
Definition: TargetInfo.h:82
clang::TransferrableTargetInfo::UnsignedLongLong
@ UnsignedLongLong
Definition: TargetInfo.h:127
clang::TargetInfo::AllowAMDGPUUnsafeFPAtomics
unsigned AllowAMDGPUUnsafeFPAtomics
Definition: TargetInfo.h:232
clang::TransferrableTargetInfo::LongAccumAlign
unsigned char LongAccumAlign
Definition: TargetInfo.h:81
clang::TargetInfo::MaxAtomicPromoteWidth
unsigned char MaxAtomicPromoteWidth
Definition: TargetInfo.h:207
clang::TargetInfo::HasFPReturn
bool HasFPReturn
Definition: TargetInfo.h:204
clang::TargetInfo::ConstraintInfo::setAllowsRegister
void setAllowsRegister()
Definition: TargetInfo.h:1055
clang::TransferrableTargetInfo::FloatFormat
const llvm::fltSemantics * FloatFormat
Definition: TargetInfo.h:112
clang::TransferrableTargetInfo::FractAlign
unsigned char FractAlign
Definition: TargetInfo.h:83
clang::TargetInfo::ARMCDECoprocMask
unsigned ARMCDECoprocMask
Definition: TargetInfo.h:234
clang::TargetInfo::checkCFProtectionBranchSupported
virtual bool checkCFProtectionBranchSupported(DiagnosticsEngine &Diags) const
Check if the target supports CFProtection branch.
Definition: TargetInfo.cpp:165
clang::TargetInfo::ConstraintInfo::setAllowsMemory
void setAllowsMemory()
Definition: TargetInfo.h:1054
AddressSpaces.h
clang::TargetInfo::HasLegalHalfType
bool HasLegalHalfType
Definition: TargetInfo.h:197
clang::FloatModeKind
FloatModeKind
Definition: TargetInfo.h:53
clang::TargetInfo::getShortAlign
unsigned getShortAlign() const
Return the alignment of 'signed short' and 'unsigned short' for this target.
Definition: TargetInfo.h:450
clang::TargetInfo::ConstraintInfo::setIsReadWrite
void setIsReadWrite()
Definition: TargetInfo.h:1052
clang::TargetInfo::HasAArch64SVETypes
unsigned HasAArch64SVETypes
Definition: TargetInfo.h:228
clang::TargetInfo::getSupportedOpenCLOpts
llvm::StringMap< bool > & getSupportedOpenCLOpts()
Get supported OpenCL extensions and optional core features.
Definition: TargetInfo.h:1576
clang::TransferrableTargetInfo::HalfAlign
unsigned char HalfAlign
Definition: TargetInfo.h:69
llvm::MutableArrayRef
Definition: LLVM.h:35
DefaultAddrSpaceMap
static const LangASMap DefaultAddrSpaceMap
Definition: TargetInfo.cpp:25
clang::TargetInfo::getTypeAlign
unsigned getTypeAlign(IntType T) const
Return the alignment (in bits) of the specified integer type enum.
Definition: TargetInfo.cpp:319
clang::TargetInfo::getLongLongAlign
unsigned getLongLongAlign() const
Definition: TargetInfo.h:465
clang::TargetInfo::getFloatWidth
unsigned getFloatWidth() const
getFloatWidth/Align/Format - Return the size/align/format of 'float'.
Definition: TargetInfo.h:676
clang::TransferrableTargetInfo::ShortAccumAlign
unsigned char ShortAccumAlign
Definition: TargetInfo.h:79
clang::TransferrableTargetInfo::LongFractWidth
unsigned char LongFractWidth
Definition: TargetInfo.h:84
clang::TransferrableTargetInfo::Float128Format
const llvm::fltSemantics * Float128Format
Definition: TargetInfo.h:113
clang::LangASMap
unsigned[(unsigned) LangAS::FirstTargetAddressSpace] LangASMap
The type of a lookup table which maps from language-specific address spaces to target-specific ones.
Definition: AddressSpaces.h:67
clang::TargetInfo::getLongFractScale
unsigned getLongFractScale() const
getLongFractScale - Return the number of fractional bits in a 'signed long _Fract' type.
Definition: TargetInfo.h:558
clang::TransferrableTargetInfo::FloatAlign
unsigned char FloatAlign
Definition: TargetInfo.h:71
clang::TargetInfo::getRealTypeByWidth
FloatModeKind getRealTypeByWidth(unsigned BitWidth, FloatModeKind ExplicitType) const
Return floating point type with specified width.
Definition: TargetInfo.cpp:285
clang::TargetInfo::ConstraintInfo::setRequiresImmediate
void setRequiresImmediate(int Min, int Max)
Definition: TargetInfo.h:1057
clang::TransferrableTargetInfo::LongFractAlign
unsigned char LongFractAlign
Definition: TargetInfo.h:84
clang::TargetInfo::getNormalizedGCCRegisterName
StringRef getNormalizedGCCRegisterName(StringRef Name, bool ReturnCanonical=false) const
Returns the "normalized" GCC register name.
Definition: TargetInfo.cpp:583
clang::TargetInfo::TargetInfo
TargetInfo(const llvm::Triple &T)
Definition: TargetInfo.cpp:28
removeGCCRegisterPrefix
static StringRef removeGCCRegisterPrefix(StringRef Name)
Definition: TargetInfo.cpp:520
clang::TargetInfo::getUnsignedAccumIBits
unsigned getUnsignedAccumIBits() const
Definition: TargetInfo.h:532
clang::TransferrableTargetInfo::LongLongWidth
unsigned char LongLongWidth
Definition: TargetInfo.h:76
clang::TargetInfo::SimdDefaultAlign
unsigned short SimdDefaultAlign
Definition: TargetInfo.h:208
clang::TargetInfo::getUnsignedAccumScale
unsigned getUnsignedAccumScale() const
getUnsignedAccumScale/IBits - Return the number of fractional/integral bits in a 'unsigned _Accum' ty...
Definition: TargetInfo.h:529
LangOptions.h
Diagnostic.h
clang::TargetInfo::initFeatureMap
virtual bool initFeatureMap(llvm::StringMap< bool > &Features, DiagnosticsEngine &Diags, StringRef CPU, const std::vector< std::string > &FeatureVec) const
Initialize the map with the default set of target features for the CPU this should include all legal ...
Definition: TargetInfo.cpp:483
clang::TransferrableTargetInfo::UseLeadingZeroLengthBitfield
unsigned UseLeadingZeroLengthBitfield
Whether zero length bitfield alignment is respected if they are the leading members.
Definition: TargetInfo.h:158
clang::TargetInfo::hasFloat128Type
virtual bool hasFloat128Type() const
Determine whether the __float128 type is supported on this target.
Definition: TargetInfo.h:610
clang::TransferrableTargetInfo::Ibm128Align
unsigned char Ibm128Align
Definition: TargetInfo.h:73
clang::TargetInfo::getMaxPointerWidth
virtual uint64_t getMaxPointerWidth() const
Return the maximum width of pointers on this target.
Definition: TargetInfo.h:427
clang::TargetInfo::getGCCRegAliases
virtual ArrayRef< GCCRegAlias > getGCCRegAliases() const =0
clang::TargetInfo::NoAsmVariants
bool NoAsmVariants
Definition: TargetInfo.h:196
clang::TransferrableTargetInfo::HalfWidth
unsigned char HalfWidth
Definition: TargetInfo.h:69
clang::LangAS::opencl_constant
@ opencl_constant
clang::TargetInfo::resetDataLayout
void resetDataLayout(StringRef DL, const char *UserLabelPrefix="")
Definition: TargetInfo.cpp:159
clang::TargetInfo::GCCRegAlias
Definition: TargetInfo.h:1172
clang::TargetInfo::getLeastIntTypeByWidth
virtual IntType getLeastIntTypeByWidth(unsigned BitWidth, bool IsSigned) const
Return the smallest integer type with at least the specified width.
Definition: TargetInfo.cpp:270
clang::TargetInfo::getDoubleWidth
unsigned getDoubleWidth() const
getDoubleWidth/Align/Format - Return the size/align/format of 'double'.
Definition: TargetInfo.h:686
clang::TargetInfo::ConstraintInfo::getConstraintStr
const std::string & getConstraintStr() const
Definition: TargetInfo.h:1020
clang::TransferrableTargetInfo::ShortAccumWidth
unsigned char ShortAccumWidth
Definition: TargetInfo.h:79
clang::TargetInfo::VLASupported
bool VLASupported
Definition: TargetInfo.h:195
getName
static std::string getName(const CallEvent &Call)
Definition: ReturnValueChecker.cpp:61
clang::TransferrableTargetInfo::Char16Type
IntType Char16Type
Definition: TargetInfo.h:132
clang::TargetInfo::HasStrictFP
bool HasStrictFP
Definition: TargetInfo.h:205
clang::TargetInfo::HasRISCVVTypes
unsigned HasRISCVVTypes
Definition: TargetInfo.h:230
clang::TargetInfo::getOpenCLTypeAddrSpace
virtual LangAS getOpenCLTypeAddrSpace(OpenCLTypeKind TK) const
Get address space for OpenCL type.
Definition: TargetInfo.cpp:503
clang::TransferrableTargetInfo::AccumAlign
unsigned char AccumAlign
Definition: TargetInfo.h:80
clang::TargetInfo::ConstraintInfo::earlyClobber
bool earlyClobber()
Definition: TargetInfo.h:1023
clang::FloatModeKind::Double
@ Double
clang::TargetInfo::HasFloat128
bool HasFloat128
Definition: TargetInfo.h:199
clang::TransferrableTargetInfo::Ibm128Format
const llvm::fltSemantics * Ibm128Format
Definition: TargetInfo.h:113
clang::FloatModeKind::NoFloat
@ NoFloat
clang::TargetInfo::ConstraintInfo::ConstraintStr
std::string ConstraintStr
Definition: TargetInfo.h:1010
clang::LangAS
LangAS
Defines the address space values used by the address space qualifier of QualType.
Definition: AddressSpaces.h:25
clang::TargetInfo::hasIbm128Type
virtual bool hasIbm128Type() const
Determine whether the __ibm128 type is supported on this target.
Definition: TargetInfo.h:619
clang::TargetCXXABI::set
void set(Kind kind)
Definition: TargetCXXABI.h:78
clang::TargetInfo::getTriple
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
Definition: TargetInfo.h:1160
clang::TargetInfo::AddlRegName
Definition: TargetInfo.h:1177
clang::TargetInfo::ConstraintInfo::allowsRegister
bool allowsRegister() const
Definition: TargetInfo.h:1024
clang::TargetInfo::UserLabelPrefix
const char * UserLabelPrefix
Definition: TargetInfo.h:210
clang::TransferrableTargetInfo::PtrDiffType
IntType PtrDiffType
Definition: TargetInfo.h:131
clang::TargetInfo::setFeatureEnabled
virtual void setFeatureEnabled(llvm::StringMap< bool > &Features, StringRef Name, bool Enabled) const
Enable or disable a specific target feature; the feature name must be valid.
Definition: TargetInfo.h:1290
clang::TargetInfo::HasLongDouble
bool HasLongDouble
Definition: TargetInfo.h:203
clang::TargetInfo::getTypeName
static const char * getTypeName(IntType T)
Return the user string for the specified integer type enum.
Definition: TargetInfo.cpp:178
CharInfo.h
clang::TargetInfo::validateInputConstraint
bool validateInputConstraint(MutableArrayRef< ConstraintInfo > OutputConstraints, ConstraintInfo &info) const
Definition: TargetInfo.cpp:721
clang::TargetInfo::TLSSupported
bool TLSSupported
Definition: TargetInfo.h:194
clang::TargetInfo::~TargetInfo
virtual ~TargetInfo()
Definition: TargetInfo.cpp:157
clang::TargetInfo::HasIbm128
bool HasIbm128
Definition: TargetInfo.h:202
clang::TargetInfo::getUnsignedFractScale
unsigned getUnsignedFractScale() const
getUnsignedFractScale - Return the number of fractional bits in a 'unsigned _Fract' type.
Definition: TargetInfo.h:569
clang::TargetInfo::PlatformName
StringRef PlatformName
Definition: TargetInfo.h:217
clang::TransferrableTargetInfo::ProcessIDType
IntType ProcessIDType
Definition: TargetInfo.h:133
clang::TargetInfo::isValidClobber
bool isValidClobber(StringRef Name) const
Returns whether the passed in string is a valid clobber in an inline asm statement.
Definition: TargetInfo.cpp:530
clang::TargetInfo::BigEndian
bool BigEndian
Definition: TargetInfo.h:193
clang::TransferrableTargetInfo::DoubleWidth
unsigned char DoubleWidth
Definition: TargetInfo.h:72
clang::TargetInfo::MCountName
const char * MCountName
Definition: TargetInfo.h:211
clang::TransferrableTargetInfo::NoInt
@ NoInt
Definition: TargetInfo.h:117
clang::TargetInfo::AddrSpaceMap
const LangASMap * AddrSpaceMap
Definition: TargetInfo.h:214
clang::TargetInfo::ConstraintInfo::hasTiedOperand
bool hasTiedOperand() const
Return true if this input operand is a matching constraint that ties it to an output operand.
Definition: TargetInfo.h:1036
llvm::ArrayRef< const char * >
clang::LangAS::opencl_global
@ opencl_global
clang::TransferrableTargetInfo::LongDoubleFormat
const llvm::fltSemantics * LongDoubleFormat
Definition: TargetInfo.h:113
clang::TransferrableTargetInfo::ShortAccumScale
unsigned char ShortAccumScale
Definition: TargetInfo.h:100
clang::TargetInfo::checkArithmeticFenceSupported
virtual bool checkArithmeticFenceSupported() const
Controls if __arithmetic_fence is supported in the targeted backend.
Definition: TargetInfo.h:1491
clang::TargetInfo::getUnsignedLongAccumIBits
unsigned getUnsignedLongAccumIBits() const
Definition: TargetInfo.h:542
clang::OCLTK_Sampler
@ OCLTK_Sampler
Definition: TargetInfo.h:181
clang::TargetInfo::ConstraintInfo::getTiedOperand
unsigned getTiedOperand() const
Definition: TargetInfo.h:1037
clang::TargetInfo::MaxOpenCLWorkGroupSize
unsigned MaxOpenCLWorkGroupSize
Definition: TargetInfo.h:236
clang::TransferrableTargetInfo::DoubleFormat
const llvm::fltSemantics * DoubleFormat
Definition: TargetInfo.h:113
clang::TargetInfo::MaxAtomicInlineWidth
unsigned char MaxAtomicInlineWidth
Definition: TargetInfo.h:207
clang::TargetInfo::ConstraintInfo::isReadWrite
bool isReadWrite() const
Definition: TargetInfo.h:1022
clang::TransferrableTargetInfo::MaxVectorAlign
unsigned MaxVectorAlign
Definition: TargetInfo.h:109
clang::TargetInfo::getIntAlign
unsigned getIntAlign() const
Definition: TargetInfo.h:455
clang::TransferrableTargetInfo::IntAlign
unsigned char IntAlign
Definition: TargetInfo.h:68
clang::TargetInfo::ConstraintInfo
Definition: TargetInfo.h:991
clang::TransferrableTargetInfo::UseBitFieldTypeAlignment
unsigned UseBitFieldTypeAlignment
Control whether the alignment of bit-field types is respected when laying out structures.
Definition: TargetInfo.h:146
clang::LangOptions
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:78
clang::TransferrableTargetInfo
Fields controlling how types are laid out in memory; these may need to be copied for targets like AMD...
Definition: TargetInfo.h:65
clang::TransferrableTargetInfo::BoolWidth
unsigned char BoolWidth
Definition: TargetInfo.h:67
clang::TargetInfo::getIntTypeByWidth
virtual IntType getIntTypeByWidth(unsigned BitWidth, bool IsSigned) const
Return integer type with specified width.
Definition: TargetInfo.cpp:255
clang::TransferrableTargetInfo::IntType
IntType
===-— Target Data Type Query Methods ----------------------------—===//
Definition: TargetInfo.h:116
clang::TargetInfo::getShortAccumIBits
unsigned getShortAccumIBits() const
Definition: TargetInfo.h:500
clang::FloatModeKind::Ibm128
@ Ibm128
clang::TargetInfo::getShortWidth
unsigned getShortWidth() const
Return the size of 'signed short' and 'unsigned short' for this target, in bits.
Definition: TargetInfo.h:446
clang::LangAS::Default
@ Default
clang::TransferrableTargetInfo::FloatWidth
unsigned char FloatWidth
Definition: TargetInfo.h:71
clang::TransferrableTargetInfo::HalfFormat
const llvm::fltSemantics * HalfFormat
Definition: TargetInfo.h:112
clang::OpenCLTypeKind
OpenCLTypeKind
OpenCL type kinds.
Definition: TargetInfo.h:173
clang::TargetInfo::ProgramAddrSpace
unsigned ProgramAddrSpace
Definition: TargetInfo.h:215
clang::TargetInfo::ComplexLongDoubleUsesFP2Ret
unsigned ComplexLongDoubleUsesFP2Ret
Definition: TargetInfo.h:222
clang::TargetInfo::getTypeWidth
unsigned getTypeWidth(IntType T) const
Return the width (in bits) of the specified integer type enum.
Definition: TargetInfo.cpp:239
clang::TargetInfo::HasFloat16
bool HasFloat16
Definition: TargetInfo.h:200
clang
Definition: CalledOnceCheck.h:17
clang::TargetInfo::getTypeFormatModifier
static const char * getTypeFormatModifier(IntType T)
Return the printf format modifier for the specified integer type enum.
Definition: TargetInfo.cpp:221
clang::TransferrableTargetInfo::Int16Type
IntType Int16Type
Definition: TargetInfo.h:132
clang::FloatModeKind::Float
@ Float
clang::FloatModeKind::Float128
@ Float128
clang::TargetInfo::hasFeatureEnabled
virtual bool hasFeatureEnabled(const llvm::StringMap< bool > &Features, StringRef Name) const
Check if target has a given feature enabled.
Definition: TargetInfo.h:1283
clang::TransferrableTargetInfo::SignedInt
@ SignedInt
Definition: TargetInfo.h:122
clang::TransferrableTargetInfo::MinGlobalAlign
unsigned char MinGlobalAlign
Definition: TargetInfo.h:105
clang::TransferrableTargetInfo::UnsignedLong
@ UnsignedLong
Definition: TargetInfo.h:125
clang::TransferrableTargetInfo::LongAccumWidth
unsigned char LongAccumWidth
Definition: TargetInfo.h:81
clang::TransferrableTargetInfo::SignedLongLong
@ SignedLongLong
Definition: TargetInfo.h:126
clang::isDigit
LLVM_READONLY bool isDigit(unsigned char c)
Return true if this character is an ASCII digit: [0-9].
Definition: CharInfo.h:99
clang::TransferrableTargetInfo::AccumScale
unsigned char AccumScale
Definition: TargetInfo.h:101
clang::TransferrableTargetInfo::PaddingOnUnsignedFixedPoint
bool PaddingOnUnsignedFixedPoint
Definition: TargetInfo.h:91
clang::TargetInfo::getUnsignedShortFractScale
unsigned getUnsignedShortFractScale() const
getUnsignedShortFractScale - Return the number of fractional bits in a 'unsigned short _Fract' type.
Definition: TargetInfo.h:562
clang::TargetInfo::getGCCRegNames
virtual ArrayRef< const char * > getGCCRegNames() const =0
clang::TargetInfo::getCharAlign
unsigned getCharAlign() const
Definition: TargetInfo.h:442
clang::TransferrableTargetInfo::SuitableAlign
unsigned short SuitableAlign
Definition: TargetInfo.h:107
clang::TargetInfo::getShortFractScale
unsigned getShortFractScale() const
getShortFractScale - Return the number of fractional bits in a 'signed short _Fract' type.
Definition: TargetInfo.h:550
clang::TargetInfo::SSERegParmMax
unsigned char SSERegParmMax
Definition: TargetInfo.h:212
clang::OCLTK_Pipe
@ OCLTK_Pipe
Definition: TargetInfo.h:178
clang::TargetInfo::getGCCAddlRegNames
virtual ArrayRef< AddlRegName > getGCCAddlRegNames() const
Definition: TargetInfo.h:1653
clang::TargetInfo::ConstraintInfo::setTiedOperand
void setTiedOperand(unsigned N, ConstraintInfo &Output)
Indicate that this is an input operand that is tied to the specified output operand.
Definition: TargetInfo.h:1080
clang::TransferrableTargetInfo::SignedShort
@ SignedShort
Definition: TargetInfo.h:120
clang::TransferrableTargetInfo::NewAlign
unsigned short NewAlign
Definition: TargetInfo.h:108
clang::TransferrableTargetInfo::IntWidth
unsigned char IntWidth
Definition: TargetInfo.h:68
clang::TransferrableTargetInfo::WCharType
IntType WCharType
Definition: TargetInfo.h:131
clang::TransferrableTargetInfo::PointerWidth
unsigned char PointerWidth
Definition: TargetInfo.h:66
clang::TargetInfo::CallingConvKind
CallingConvKind
Definition: TargetInfo.h:1522
clang::TargetInfo::resolveSymbolicName
bool resolveSymbolicName(const char *&Name, ArrayRef< ConstraintInfo > OutputConstraints, unsigned &Index) const
Definition: TargetInfo.cpp:698
clang::TargetInfo::HasBuiltinMSVaList
unsigned HasBuiltinMSVaList
Definition: TargetInfo.h:224
clang::TransferrableTargetInfo::ZeroLengthBitfieldBoundary
unsigned ZeroLengthBitfieldBoundary
If non-zero, specifies a fixed alignment value for bitfields that follow zero length bitfield,...
Definition: TargetInfo.h:165
clang::TransferrableTargetInfo::Int64Type
IntType Int64Type
Definition: TargetInfo.h:132
clang::TransferrableTargetInfo::LargeArrayMinWidth
unsigned char LargeArrayMinWidth
Definition: TargetInfo.h:74
clang::TransferrableTargetInfo::LongDoubleWidth
unsigned char LongDoubleWidth
Definition: TargetInfo.h:73
clang::TransferrableTargetInfo::UnsignedInt
@ UnsignedInt
Definition: TargetInfo.h:123
clang::TargetInfo::getIntWidth
unsigned getIntWidth() const
getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for this target,...
Definition: TargetInfo.h:454
clang::TargetInfo::validateOutputConstraint
bool validateOutputConstraint(ConstraintInfo &Info) const
Definition: TargetInfo.cpp:624
clang::TransferrableTargetInfo::UseSignedCharForObjCBool
unsigned UseSignedCharForObjCBool
Whether Objective-C's built-in boolean type should be signed char.
Definition: TargetInfo.h:139
clang::TargetInfo::copyAuxTarget
void copyAuxTarget(const TargetInfo *Aux)
Copy type and layout related info.
Definition: TargetInfo.cpp:898
clang::TransferrableTargetInfo::LongDoubleAlign
unsigned char LongDoubleAlign
Definition: TargetInfo.h:73
clang::TransferrableTargetInfo::SizeType
IntType SizeType
Definition: TargetInfo.h:131
clang::TargetInfo::getUnsignedLongFractScale
unsigned getUnsignedLongFractScale() const
getUnsignedLongFractScale - Return the number of fractional bits in a 'unsigned long _Fract' type.
Definition: TargetInfo.h:575
clang::DiagnosticsEngine::Report
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
Definition: Diagnostic.h:1536
clang::TransferrableTargetInfo::SignedLong
@ SignedLong
Definition: TargetInfo.h:124
clang::TransferrableTargetInfo::Char32Type
IntType Char32Type
Definition: TargetInfo.h:132
clang::TransferrableTargetInfo::FractWidth
unsigned char FractWidth
Definition: TargetInfo.h:83