clang  6.0.0svn
TargetInfo.cpp
Go to the documentation of this file.
1 //===--- TargetInfo.cpp - Information about Target machine ----------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements the TargetInfo and TargetInfoImpl interfaces.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "clang/Basic/TargetInfo.h"
15 #include "clang/AST/Type.h"
17 #include "clang/Basic/CharInfo.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) : TargetOpts(), 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  NoAsmVariants = false;
35  HasFloat128 = false;
37  BoolWidth = BoolAlign = 8;
38  IntWidth = IntAlign = 32;
39  LongWidth = LongAlign = 32;
41  SuitableAlign = 64;
43  MinGlobalAlign = 0;
44  // From the glibc documentation, on GNU systems, malloc guarantees 16-byte
45  // alignment on 64-bit systems and 8-byte alignment on 32-bit systems. See
46  // https://www.gnu.org/software/libc/manual/html_node/Malloc-Examples.html
47  if (T.isGNUEnvironment())
48  NewAlign = Triple.isArch64Bit() ? 128 : Triple.isArch32Bit() ? 64 : 0;
49  else
50  NewAlign = 0; // Infer from basic type alignment.
51  HalfWidth = 16;
52  HalfAlign = 16;
53  FloatWidth = 32;
54  FloatAlign = 32;
55  DoubleWidth = 64;
56  DoubleAlign = 64;
57  LongDoubleWidth = 64;
58  LongDoubleAlign = 64;
59  Float128Align = 128;
61  LargeArrayAlign = 0;
63  MaxVectorAlign = 0;
64  MaxTLSAlign = 0;
65  SimdDefaultAlign = 0;
82  HalfFormat = &llvm::APFloat::IEEEhalf();
83  FloatFormat = &llvm::APFloat::IEEEsingle();
84  DoubleFormat = &llvm::APFloat::IEEEdouble();
85  LongDoubleFormat = &llvm::APFloat::IEEEdouble();
86  Float128Format = &llvm::APFloat::IEEEquad();
87  MCountName = "mcount";
88  RegParmMax = 0;
89  SSERegParmMax = 0;
90  HasAlignMac68kSupport = false;
91  HasBuiltinMSVaList = false;
92  IsRenderScriptTarget = false;
93 
94  // Default to no types using fpret.
96 
97  // Default to not using fp2ret for __Complex long double
99 
100  // Set the C++ ABI based on the triple.
101  TheCXXABI.set(Triple.isKnownWindowsMSVCEnvironment()
104 
105  // Default to an empty address space map.
107  UseAddrSpaceMapMangling = false;
108 
109  // Default to an unknown platform name.
110  PlatformName = "unknown";
112 }
113 
114 // Out of line virtual dtor for TargetInfo.
116 
117 /// getTypeName - Return the user string for the specified integer type enum.
118 /// For example, SignedShort -> "short".
120  switch (T) {
121  default: llvm_unreachable("not an integer!");
122  case SignedChar: return "signed char";
123  case UnsignedChar: return "unsigned char";
124  case SignedShort: return "short";
125  case UnsignedShort: return "unsigned short";
126  case SignedInt: return "int";
127  case UnsignedInt: return "unsigned int";
128  case SignedLong: return "long int";
129  case UnsignedLong: return "long unsigned int";
130  case SignedLongLong: return "long long int";
131  case UnsignedLongLong: return "long long unsigned int";
132  }
133 }
134 
135 /// getTypeConstantSuffix - Return the constant suffix for the specified
136 /// integer type enum. For example, SignedLong -> "L".
138  switch (T) {
139  default: llvm_unreachable("not an integer!");
140  case SignedChar:
141  case SignedShort:
142  case SignedInt: return "";
143  case SignedLong: return "L";
144  case SignedLongLong: return "LL";
145  case UnsignedChar:
146  if (getCharWidth() < getIntWidth())
147  return "";
148  LLVM_FALLTHROUGH;
149  case UnsignedShort:
150  if (getShortWidth() < getIntWidth())
151  return "";
152  LLVM_FALLTHROUGH;
153  case UnsignedInt: return "U";
154  case UnsignedLong: return "UL";
155  case UnsignedLongLong: return "ULL";
156  }
157 }
158 
159 /// getTypeFormatModifier - Return the printf format modifier for the
160 /// specified integer type enum. For example, SignedLong -> "l".
161 
163  switch (T) {
164  default: llvm_unreachable("not an integer!");
165  case SignedChar:
166  case UnsignedChar: return "hh";
167  case SignedShort:
168  case UnsignedShort: return "h";
169  case SignedInt:
170  case UnsignedInt: return "";
171  case SignedLong:
172  case UnsignedLong: return "l";
173  case SignedLongLong:
174  case UnsignedLongLong: return "ll";
175  }
176 }
177 
178 /// getTypeWidth - Return the width (in bits) of the specified integer type
179 /// enum. For example, SignedInt -> getIntWidth().
181  switch (T) {
182  default: llvm_unreachable("not an integer!");
183  case SignedChar:
184  case UnsignedChar: return getCharWidth();
185  case SignedShort:
186  case UnsignedShort: return getShortWidth();
187  case SignedInt:
188  case UnsignedInt: return getIntWidth();
189  case SignedLong:
190  case UnsignedLong: return getLongWidth();
191  case SignedLongLong:
192  case UnsignedLongLong: return getLongLongWidth();
193  };
194 }
195 
197  unsigned BitWidth, bool IsSigned) const {
198  if (getCharWidth() == BitWidth)
199  return IsSigned ? SignedChar : UnsignedChar;
200  if (getShortWidth() == BitWidth)
201  return IsSigned ? SignedShort : UnsignedShort;
202  if (getIntWidth() == BitWidth)
203  return IsSigned ? SignedInt : UnsignedInt;
204  if (getLongWidth() == BitWidth)
205  return IsSigned ? SignedLong : UnsignedLong;
206  if (getLongLongWidth() == BitWidth)
207  return IsSigned ? SignedLongLong : UnsignedLongLong;
208  return NoInt;
209 }
210 
212  bool IsSigned) const {
213  if (getCharWidth() >= BitWidth)
214  return IsSigned ? SignedChar : UnsignedChar;
215  if (getShortWidth() >= BitWidth)
216  return IsSigned ? SignedShort : UnsignedShort;
217  if (getIntWidth() >= BitWidth)
218  return IsSigned ? SignedInt : UnsignedInt;
219  if (getLongWidth() >= BitWidth)
220  return IsSigned ? SignedLong : UnsignedLong;
221  if (getLongLongWidth() >= BitWidth)
222  return IsSigned ? SignedLongLong : UnsignedLongLong;
223  return NoInt;
224 }
225 
227  if (getFloatWidth() == BitWidth)
228  return Float;
229  if (getDoubleWidth() == BitWidth)
230  return Double;
231 
232  switch (BitWidth) {
233  case 96:
234  if (&getLongDoubleFormat() == &llvm::APFloat::x87DoubleExtended())
235  return LongDouble;
236  break;
237  case 128:
238  if (&getLongDoubleFormat() == &llvm::APFloat::PPCDoubleDouble() ||
239  &getLongDoubleFormat() == &llvm::APFloat::IEEEquad())
240  return LongDouble;
241  if (hasFloat128Type())
242  return Float128;
243  break;
244  }
245 
246  return NoFloat;
247 }
248 
249 /// getTypeAlign - Return the alignment (in bits) of the specified integer type
250 /// enum. For example, SignedInt -> getIntAlign().
252  switch (T) {
253  default: llvm_unreachable("not an integer!");
254  case SignedChar:
255  case UnsignedChar: return getCharAlign();
256  case SignedShort:
257  case UnsignedShort: return getShortAlign();
258  case SignedInt:
259  case UnsignedInt: return getIntAlign();
260  case SignedLong:
261  case UnsignedLong: return getLongAlign();
262  case SignedLongLong:
263  case UnsignedLongLong: return getLongLongAlign();
264  };
265 }
266 
267 /// isTypeSigned - Return whether an integer types is signed. Returns true if
268 /// the type is signed; false otherwise.
270  switch (T) {
271  default: llvm_unreachable("not an integer!");
272  case SignedChar:
273  case SignedShort:
274  case SignedInt:
275  case SignedLong:
276  case SignedLongLong:
277  return true;
278  case UnsignedChar:
279  case UnsignedShort:
280  case UnsignedInt:
281  case UnsignedLong:
282  case UnsignedLongLong:
283  return false;
284  };
285 }
286 
287 /// adjust - Set forced language options.
288 /// Apply changes to the target information with respect to certain
289 /// language options which change the target configuration and adjust
290 /// the language based on the target options where applicable.
292  if (Opts.NoBitFieldTypeAlign)
293  UseBitFieldTypeAlignment = false;
294 
295  switch (Opts.WCharSize) {
296  default: llvm_unreachable("invalid wchar_t width");
297  case 0: break;
298  case 1: WCharType = Opts.WCharIsSigned ? SignedChar : UnsignedChar; break;
299  case 2: WCharType = Opts.WCharIsSigned ? SignedShort : UnsignedShort; break;
300  case 4: WCharType = Opts.WCharIsSigned ? SignedInt : UnsignedInt; break;
301  }
302 
303  if (Opts.AlignDouble) {
304  DoubleAlign = LongLongAlign = 64;
305  LongDoubleAlign = 64;
306  }
307 
308  if (Opts.OpenCL) {
309  // OpenCL C requires specific widths for types, irrespective of
310  // what these normally are for the target.
311  // We also define long long and long double here, although the
312  // OpenCL standard only mentions these as "reserved".
313  IntWidth = IntAlign = 32;
314  LongWidth = LongAlign = 64;
316  HalfWidth = HalfAlign = 16;
317  FloatWidth = FloatAlign = 32;
318 
319  // Embedded 32-bit targets (OpenCL EP) might have double C type
320  // defined as float. Let's not override this as it might lead
321  // to generating illegal code that uses 64bit doubles.
322  if (DoubleWidth != FloatWidth) {
323  DoubleWidth = DoubleAlign = 64;
324  DoubleFormat = &llvm::APFloat::IEEEdouble();
325  }
327 
328  unsigned MaxPointerWidth = getMaxPointerWidth();
329  assert(MaxPointerWidth == 32 || MaxPointerWidth == 64);
330  bool Is32BitArch = MaxPointerWidth == 32;
331  SizeType = Is32BitArch ? UnsignedInt : UnsignedLong;
332  PtrDiffType = Is32BitArch ? SignedInt : SignedLong;
333  IntPtrType = Is32BitArch ? SignedInt : SignedLong;
334 
337 
338  HalfFormat = &llvm::APFloat::IEEEhalf();
339  FloatFormat = &llvm::APFloat::IEEEsingle();
340  LongDoubleFormat = &llvm::APFloat::IEEEquad();
341  }
342 
343  if (Opts.NewAlignOverride)
344  NewAlign = Opts.NewAlignOverride * getCharWidth();
345 }
346 
348  llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags, StringRef CPU,
349  const std::vector<std::string> &FeatureVec) const {
350  for (const auto &F : FeatureVec) {
351  StringRef Name = F;
352  // Apply the feature via the target.
353  bool Enabled = Name[0] == '+';
354  setFeatureEnabled(Features, Name.substr(1), Enabled);
355  }
356  return true;
357 }
358 
360  auto BT = dyn_cast<BuiltinType>(T);
361 
362  if (!BT) {
363  if (isa<PipeType>(T))
364  return LangAS::opencl_global;
365 
366  return LangAS::Default;
367  }
368 
369  switch (BT->getKind()) {
370 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
371  case BuiltinType::Id: \
372  return LangAS::opencl_global;
373 #include "clang/Basic/OpenCLImageTypes.def"
374 
375  case BuiltinType::OCLSampler:
377 
378  default:
379  return LangAS::Default;
380  }
381 }
382 
383 //===----------------------------------------------------------------------===//
384 
385 
386 static StringRef removeGCCRegisterPrefix(StringRef Name) {
387  if (Name[0] == '%' || Name[0] == '#')
388  Name = Name.substr(1);
389 
390  return Name;
391 }
392 
393 /// isValidClobber - Returns whether the passed in string is
394 /// a valid clobber in an inline asm statement. This is used by
395 /// Sema.
396 bool TargetInfo::isValidClobber(StringRef Name) const {
397  return (isValidGCCRegisterName(Name) ||
398  Name == "memory" || Name == "cc");
399 }
400 
401 /// isValidGCCRegisterName - Returns whether the passed in string
402 /// is a valid register name according to GCC. This is used by Sema for
403 /// inline asm statements.
404 bool TargetInfo::isValidGCCRegisterName(StringRef Name) const {
405  if (Name.empty())
406  return false;
407 
408  // Get rid of any register prefix.
409  Name = removeGCCRegisterPrefix(Name);
410  if (Name.empty())
411  return false;
412 
414 
415  // If we have a number it maps to an entry in the register name array.
416  if (isDigit(Name[0])) {
417  unsigned n;
418  if (!Name.getAsInteger(0, n))
419  return n < Names.size();
420  }
421 
422  // Check register names.
423  if (std::find(Names.begin(), Names.end(), Name) != Names.end())
424  return true;
425 
426  // Check any additional names that we have.
427  for (const AddlRegName &ARN : getGCCAddlRegNames())
428  for (const char *AN : ARN.Names) {
429  if (!AN)
430  break;
431  // Make sure the register that the additional name is for is within
432  // the bounds of the register names from above.
433  if (AN == Name && ARN.RegNum < Names.size())
434  return true;
435  }
436 
437  // Now check aliases.
438  for (const GCCRegAlias &GRA : getGCCRegAliases())
439  for (const char *A : GRA.Aliases) {
440  if (!A)
441  break;
442  if (A == Name)
443  return true;
444  }
445 
446  return false;
447 }
448 
450  bool ReturnCanonical) const {
451  assert(isValidGCCRegisterName(Name) && "Invalid register passed in");
452 
453  // Get rid of any register prefix.
454  Name = removeGCCRegisterPrefix(Name);
455 
457 
458  // First, check if we have a number.
459  if (isDigit(Name[0])) {
460  unsigned n;
461  if (!Name.getAsInteger(0, n)) {
462  assert(n < Names.size() && "Out of bounds register number!");
463  return Names[n];
464  }
465  }
466 
467  // Check any additional names that we have.
468  for (const AddlRegName &ARN : getGCCAddlRegNames())
469  for (const char *AN : ARN.Names) {
470  if (!AN)
471  break;
472  // Make sure the register that the additional name is for is within
473  // the bounds of the register names from above.
474  if (AN == Name && ARN.RegNum < Names.size())
475  return ReturnCanonical ? Names[ARN.RegNum] : Name;
476  }
477 
478  // Now check aliases.
479  for (const GCCRegAlias &RA : getGCCRegAliases())
480  for (const char *A : RA.Aliases) {
481  if (!A)
482  break;
483  if (A == Name)
484  return RA.Register;
485  }
486 
487  return Name;
488 }
489 
491  const char *Name = Info.getConstraintStr().c_str();
492  // An output constraint must start with '=' or '+'
493  if (*Name != '=' && *Name != '+')
494  return false;
495 
496  if (*Name == '+')
497  Info.setIsReadWrite();
498 
499  Name++;
500  while (*Name) {
501  switch (*Name) {
502  default:
503  if (!validateAsmConstraint(Name, Info)) {
504  // FIXME: We temporarily return false
505  // so we can add more constraints as we hit it.
506  // Eventually, an unknown constraint should just be treated as 'g'.
507  return false;
508  }
509  break;
510  case '&': // early clobber.
511  Info.setEarlyClobber();
512  break;
513  case '%': // commutative.
514  // FIXME: Check that there is a another register after this one.
515  break;
516  case 'r': // general register.
517  Info.setAllowsRegister();
518  break;
519  case 'm': // memory operand.
520  case 'o': // offsetable memory operand.
521  case 'V': // non-offsetable memory operand.
522  case '<': // autodecrement memory operand.
523  case '>': // autoincrement memory operand.
524  Info.setAllowsMemory();
525  break;
526  case 'g': // general register, memory operand or immediate integer.
527  case 'X': // any operand.
528  Info.setAllowsRegister();
529  Info.setAllowsMemory();
530  break;
531  case ',': // multiple alternative constraint. Pass it.
532  // Handle additional optional '=' or '+' modifiers.
533  if (Name[1] == '=' || Name[1] == '+')
534  Name++;
535  break;
536  case '#': // Ignore as constraint.
537  while (Name[1] && Name[1] != ',')
538  Name++;
539  break;
540  case '?': // Disparage slightly code.
541  case '!': // Disparage severely.
542  case '*': // Ignore for choosing register preferences.
543  case 'i': // Ignore i,n,E,F as output constraints (match from the other
544  // chars)
545  case 'n':
546  case 'E':
547  case 'F':
548  break; // Pass them.
549  }
550 
551  Name++;
552  }
553 
554  // Early clobber with a read-write constraint which doesn't permit registers
555  // is invalid.
556  if (Info.earlyClobber() && Info.isReadWrite() && !Info.allowsRegister())
557  return false;
558 
559  // If a constraint allows neither memory nor register operands it contains
560  // only modifiers. Reject it.
561  return Info.allowsMemory() || Info.allowsRegister();
562 }
563 
564 bool TargetInfo::resolveSymbolicName(const char *&Name,
565  ArrayRef<ConstraintInfo> OutputConstraints,
566  unsigned &Index) const {
567  assert(*Name == '[' && "Symbolic name did not start with '['");
568  Name++;
569  const char *Start = Name;
570  while (*Name && *Name != ']')
571  Name++;
572 
573  if (!*Name) {
574  // Missing ']'
575  return false;
576  }
577 
578  std::string SymbolicName(Start, Name - Start);
579 
580  for (Index = 0; Index != OutputConstraints.size(); ++Index)
581  if (SymbolicName == OutputConstraints[Index].getName())
582  return true;
583 
584  return false;
585 }
586 
588  MutableArrayRef<ConstraintInfo> OutputConstraints,
589  ConstraintInfo &Info) const {
590  const char *Name = Info.ConstraintStr.c_str();
591 
592  if (!*Name)
593  return false;
594 
595  while (*Name) {
596  switch (*Name) {
597  default:
598  // Check if we have a matching constraint
599  if (*Name >= '0' && *Name <= '9') {
600  const char *DigitStart = Name;
601  while (Name[1] >= '0' && Name[1] <= '9')
602  Name++;
603  const char *DigitEnd = Name;
604  unsigned i;
605  if (StringRef(DigitStart, DigitEnd - DigitStart + 1)
606  .getAsInteger(10, i))
607  return false;
608 
609  // Check if matching constraint is out of bounds.
610  if (i >= OutputConstraints.size()) return false;
611 
612  // A number must refer to an output only operand.
613  if (OutputConstraints[i].isReadWrite())
614  return false;
615 
616  // If the constraint is already tied, it must be tied to the
617  // same operand referenced to by the number.
618  if (Info.hasTiedOperand() && Info.getTiedOperand() != i)
619  return false;
620 
621  // The constraint should have the same info as the respective
622  // output constraint.
623  Info.setTiedOperand(i, OutputConstraints[i]);
624  } else if (!validateAsmConstraint(Name, Info)) {
625  // FIXME: This error return is in place temporarily so we can
626  // add more constraints as we hit it. Eventually, an unknown
627  // constraint should just be treated as 'g'.
628  return false;
629  }
630  break;
631  case '[': {
632  unsigned Index = 0;
633  if (!resolveSymbolicName(Name, OutputConstraints, Index))
634  return false;
635 
636  // If the constraint is already tied, it must be tied to the
637  // same operand referenced to by the number.
638  if (Info.hasTiedOperand() && Info.getTiedOperand() != Index)
639  return false;
640 
641  // A number must refer to an output only operand.
642  if (OutputConstraints[Index].isReadWrite())
643  return false;
644 
645  Info.setTiedOperand(Index, OutputConstraints[Index]);
646  break;
647  }
648  case '%': // commutative
649  // FIXME: Fail if % is used with the last operand.
650  break;
651  case 'i': // immediate integer.
652  case 'n': // immediate integer with a known value.
653  break;
654  case 'I': // Various constant constraints with target-specific meanings.
655  case 'J':
656  case 'K':
657  case 'L':
658  case 'M':
659  case 'N':
660  case 'O':
661  case 'P':
662  if (!validateAsmConstraint(Name, Info))
663  return false;
664  break;
665  case 'r': // general register.
666  Info.setAllowsRegister();
667  break;
668  case 'm': // memory operand.
669  case 'o': // offsettable memory operand.
670  case 'V': // non-offsettable memory operand.
671  case '<': // autodecrement memory operand.
672  case '>': // autoincrement memory operand.
673  Info.setAllowsMemory();
674  break;
675  case 'g': // general register, memory operand or immediate integer.
676  case 'X': // any operand.
677  Info.setAllowsRegister();
678  Info.setAllowsMemory();
679  break;
680  case 'E': // immediate floating point.
681  case 'F': // immediate floating point.
682  case 'p': // address operand.
683  break;
684  case ',': // multiple alternative constraint. Ignore comma.
685  break;
686  case '#': // Ignore as constraint.
687  while (Name[1] && Name[1] != ',')
688  Name++;
689  break;
690  case '?': // Disparage slightly code.
691  case '!': // Disparage severely.
692  case '*': // Ignore for choosing register preferences.
693  break; // Pass them.
694  }
695 
696  Name++;
697  }
698 
699  return true;
700 }
unsigned getTypeWidth(IntType T) const
Return the width (in bits) of the specified integer type enum.
Definition: TargetInfo.cpp:180
unsigned getFloatWidth() const
getFloatWidth/Align/Format - Return the size/align/format of &#39;float&#39;.
Definition: TargetInfo.h:409
static LLVM_READONLY bool isDigit(unsigned char c)
Return true if this character is an ASCII digit: [0-9].
Definition: CharInfo.h:94
Represents a version number in the form major[.minor[.subminor[.build]]].
Definition: VersionTuple.h:26
virtual void adjust(LangOptions &Opts)
Set forced language options.
Definition: TargetInfo.cpp:291
unsigned getLongWidth() const
getLongWidth/Align - Return the size of &#39;signed long&#39; and &#39;unsigned long&#39; for this target...
Definition: TargetInfo.h:351
IntType IntPtrType
Definition: TargetInfo.h:192
virtual bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &info) const =0
const llvm::fltSemantics * DoubleFormat
Definition: TargetInfo.h:85
unsigned short MaxVectorAlign
Definition: TargetInfo.h:79
C Language Family Type Representation.
unsigned getLongAlign() const
Definition: TargetInfo.h:352
virtual IntType getLeastIntTypeByWidth(unsigned BitWidth, bool IsSigned) const
Return the smallest integer type with at least the specified width.
Definition: TargetInfo.cpp:211
unsigned char IntWidth
Definition: TargetInfo.h:67
unsigned char LongLongWidth
Definition: TargetInfo.h:74
The base class of the type hierarchy.
Definition: Type.h:1300
bool validateInputConstraint(MutableArrayRef< ConstraintInfo > OutputConstraints, ConstraintInfo &info) const
Definition: TargetInfo.cpp:587
IntType SigAtomicType
Definition: TargetInfo.h:192
TargetInfo(const llvm::Triple &T)
Definition: TargetInfo.cpp:29
unsigned char FloatAlign
Definition: TargetInfo.h:69
unsigned getCharWidth() const
Definition: TargetInfo.h:333
unsigned char LongDoubleAlign
Definition: TargetInfo.h:71
unsigned short SimdDefaultAlign
Definition: TargetInfo.h:81
static const LangASMap DefaultAddrSpaceMap
Definition: TargetInfo.cpp:26
unsigned getCharAlign() const
Definition: TargetInfo.h:334
LangAS
Defines the address space values used by the address space qualifier of QualType. ...
Definition: AddressSpaces.h:26
unsigned char LongDoubleWidth
Definition: TargetInfo.h:71
unsigned char LargeArrayMinWidth
Definition: TargetInfo.h:72
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:883
unsigned ZeroLengthBitfieldBoundary
If non-zero, specifies a fixed alignment value for bitfields that follow zero length bitfield...
Definition: TargetInfo.h:222
unsigned char MinGlobalAlign
Definition: TargetInfo.h:77
unsigned getIntAlign() const
Definition: TargetInfo.h:347
const char * getTypeConstantSuffix(IntType T) const
Return the constant suffix for the specified integer type enum.
Definition: TargetInfo.cpp:137
virtual LangAS getOpenCLTypeAddrSpace(const Type *T) const
Get address space for OpenCL type.
Definition: TargetInfo.cpp:359
StringRef getNormalizedGCCRegisterName(StringRef Name, bool ReturnCanonical=false) const
Returns the "normalized" GCC register name.
Definition: TargetInfo.cpp:449
const llvm::fltSemantics * Float128Format
Definition: TargetInfo.h:85
const char * MCountName
Definition: TargetInfo.h:84
unsigned char LargeArrayAlign
Definition: TargetInfo.h:72
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:48
static bool isTypeSigned(IntType T)
Returns true if the type is signed; false otherwise.
Definition: TargetInfo.cpp:269
unsigned char MaxAtomicPromoteWidth
Definition: TargetInfo.h:78
unsigned char DefaultAlignForAttributeAligned
Definition: TargetInfo.h:76
unsigned char PointerWidth
Definition: TargetInfo.h:65
unsigned char SSERegParmMax
Definition: TargetInfo.h:87
unsigned char FloatWidth
Definition: TargetInfo.h:69
The Microsoft ABI is the ABI used by Microsoft Visual Studio (and compatible compilers).
Definition: TargetCXXABI.h:113
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:147
unsigned getShortWidth() const
Return the size of &#39;signed short&#39; and &#39;unsigned short&#39; for this target, in bits.
Definition: TargetInfo.h:338
unsigned LangASMap[(unsigned) LangAS::FirstTargetAddressSpace]
The type of a lookup table which maps from language-specific address spaces to target-specific ones...
Definition: AddressSpaces.h:54
unsigned char DoubleWidth
Definition: TargetInfo.h:70
VersionTuple PlatformMinVersion
Definition: TargetInfo.h:92
unsigned char LongWidth
Definition: TargetInfo.h:73
unsigned ComplexLongDoubleUsesFP2Ret
Definition: TargetInfo.h:96
unsigned getLongLongAlign() const
Definition: TargetInfo.h:357
bool isValidGCCRegisterName(StringRef Name) const
Returns whether the passed in string is a valid register name according to GCC.
Definition: TargetInfo.cpp:404
unsigned RealTypeUsesObjCFPRet
Definition: TargetInfo.h:95
Provides definitions for the various language-specific address spaces.
StringRef PlatformName
Definition: TargetInfo.h:91
bool isValidClobber(StringRef Name) const
Returns whether the passed in string is a valid clobber in an inline asm statement.
Definition: TargetInfo.cpp:396
const llvm::fltSemantics & getLongDoubleFormat() const
Definition: TargetInfo.h:422
unsigned HasBuiltinMSVaList
Definition: TargetInfo.h:98
unsigned HasAlignMac68kSupport
Definition: TargetInfo.h:94
unsigned char RegParmMax
Definition: TargetInfo.h:87
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:347
Defines the clang::LangOptions interface.
const FunctionProtoType * T
unsigned getIntWidth() const
getIntWidth/Align - Return the size of &#39;signed int&#39; and &#39;unsigned int&#39; for this target, in bits.
Definition: TargetInfo.h:346
IntType Char32Type
Definition: TargetInfo.h:192
unsigned short NewAlign
Definition: TargetInfo.h:82
static StringRef removeGCCRegisterPrefix(StringRef Name)
Definition: TargetInfo.cpp:386
unsigned getShortAlign() const
Return the alignment of &#39;signed short&#39; and &#39;unsigned short&#39; for this target.
Definition: TargetInfo.h:342
unsigned getDoubleWidth() const
getDoubleWidth/Align/Format - Return the size/align/format of &#39;double&#39;.
Definition: TargetInfo.h:414
unsigned getTypeAlign(IntType T) const
Return the alignment (in bits) of the specified integer type enum.
Definition: TargetInfo.cpp:251
static const char * getTypeName(IntType T)
Return the user string for the specified integer type enum.
Definition: TargetInfo.cpp:119
unsigned UseExplicitBitFieldAlignment
Whether explicit bit field alignment attributes are honored.
Definition: TargetInfo.h:218
IntType PtrDiffType
Definition: TargetInfo.h:192
const LangASMap * AddrSpaceMap
Definition: TargetInfo.h:89
unsigned IsRenderScriptTarget
Definition: TargetInfo.h:100
unsigned getLongLongWidth() const
getLongLongWidth/Align - Return the size of &#39;signed long long&#39; and &#39;unsigned long long&#39; for this targ...
Definition: TargetInfo.h:356
unsigned char DoubleAlign
Definition: TargetInfo.h:70
bool validateOutputConstraint(ConstraintInfo &Info) const
Definition: TargetInfo.cpp:490
virtual ArrayRef< AddlRegName > getGCCAddlRegNames() const
Definition: TargetInfo.h:1091
virtual ~TargetInfo()
Definition: TargetInfo.cpp:115
The generic Itanium ABI is the standard ABI of most open-source and Unix-like platforms.
Definition: TargetCXXABI.h:34
virtual ArrayRef< GCCRegAlias > getGCCRegAliases() const =0
unsigned UseZeroLengthBitfieldAlignment
Whether zero length bitfields (e.g., int : 0;) force alignment of the next bitfield.
Definition: TargetInfo.h:215
unsigned char PointerAlign
Definition: TargetInfo.h:65
void set(Kind kind)
Definition: TargetCXXABI.h:128
unsigned char SuitableAlign
Definition: TargetInfo.h:75
IntType
===-— Target Data Type Query Methods ----------------------------—===//
Definition: TargetInfo.h:128
RealType getRealTypeByWidth(unsigned BitWidth) const
Return floating point type with specified width.
Definition: TargetInfo.cpp:226
Dataflow Directional Tag Classes.
static const char * getTypeFormatModifier(IntType T)
Return the printf format modifier for the specified integer type enum.
Definition: TargetInfo.cpp:162
unsigned char BoolWidth
Definition: TargetInfo.h:66
unsigned char LongAlign
Definition: TargetInfo.h:73
unsigned UseSignedCharForObjCBool
Whether Objective-C&#39;s built-in boolean type should be signed char.
Definition: TargetInfo.h:200
bool hasTiedOperand() const
Return true if this input operand is a matching constraint that ties it to an output operand...
Definition: TargetInfo.h:667
unsigned char IntAlign
Definition: TargetInfo.h:67
IntType ProcessIDType
Definition: TargetInfo.h:192
const std::string & getConstraintStr() const
Definition: TargetInfo.h:651
virtual IntType getIntTypeByWidth(unsigned BitWidth, bool IsSigned) const
Return integer type with specified width.
Definition: TargetInfo.cpp:196
bool resolveSymbolicName(const char *&Name, ArrayRef< ConstraintInfo > OutputConstraints, unsigned &Index) const
Definition: TargetInfo.cpp:564
const llvm::fltSemantics * FloatFormat
Definition: TargetInfo.h:85
unsigned char LongLongAlign
Definition: TargetInfo.h:74
const llvm::fltSemantics * HalfFormat
Definition: TargetInfo.h:85
virtual uint64_t getMaxPointerWidth() const
Return the maximum width of pointers on this target.
Definition: TargetInfo.h:319
virtual bool hasFloat128Type() const
Determine whether the __float128 type is supported on this target.
Definition: TargetInfo.h:365
IntType Char16Type
Definition: TargetInfo.h:192
unsigned char HalfAlign
Definition: TargetInfo.h:68
This class is used for builtin types like &#39;int&#39;.
Definition: Type.h:2082
TargetCXXABI TheCXXABI
Definition: TargetInfo.h:88
Defines the clang::TargetInfo interface.
const llvm::fltSemantics * LongDoubleFormat
Definition: TargetInfo.h:85
unsigned char Float128Align
Definition: TargetInfo.h:71
unsigned char MaxAtomicInlineWidth
Definition: TargetInfo.h:78
void setTiedOperand(unsigned N, ConstraintInfo &Output)
Indicate that this is an input operand that is tied to the specified output operand.
Definition: TargetInfo.h:710
unsigned short MaxTLSAlign
Definition: TargetInfo.h:80
IntType IntMaxType
Definition: TargetInfo.h:192
unsigned UseBitFieldTypeAlignment
Control whether the alignment of bit-field types is respected when laying out structures.
Definition: TargetInfo.h:207
virtual ArrayRef< const char * > getGCCRegNames() const =0
unsigned char BoolAlign
Definition: TargetInfo.h:66
unsigned char HalfWidth
Definition: TargetInfo.h:68
bool UseAddrSpaceMapMangling
Specify if mangling based on address space map should be used or not for language specific address sp...
Definition: TargetInfo.h:226