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