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