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