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