clang 10.0.0git

TargetInfo.cpp
Go to the documentation of this file.
1 //===--- TargetInfo.cpp - Information about Target machine ----------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the TargetInfo and TargetInfoImpl interfaces.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #include "clang/Basic/TargetInfo.h"
14 #include "clang/Basic/AddressSpaces.h"
15 #include "clang/Basic/CharInfo.h"
16 #include "clang/Basic/Diagnostic.h"
17 #include "clang/Basic/LangOptions.h"
18 #include "llvm/ADT/APFloat.h"
19 #include "llvm/ADT/STLExtras.h"
20 #include "llvm/IR/DataLayout.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;
38 HasFloat16 = false;
39 PointerWidth = PointerAlign = 32;
40 BoolWidth = BoolAlign = 8;
41 IntWidth = IntAlign = 32;
42 LongWidth = LongAlign = 32;
43 LongLongWidth = LongLongAlign = 64;
44
45 // Fixed point default bit widths
46 ShortAccumWidth = ShortAccumAlign = 16;
47 AccumWidth = AccumAlign = 32;
48 LongAccumWidth = LongAccumAlign = 64;
49 ShortFractWidth = ShortFractAlign = 8;
50 FractWidth = FractAlign = 16;
51 LongFractWidth = LongFractAlign = 32;
52
53 // Fixed point default integral and fractional bit sizes
54 // We give the _Accum 1 fewer fractional bits than their corresponding _Fract
55 // types by default to have the same number of fractional bits between _Accum
56 // and _Fract types.
57 PaddingOnUnsignedFixedPoint = false;
58 ShortAccumScale = 7;
59 AccumScale = 15;
60 LongAccumScale = 31;
61
62 SuitableAlign = 64;
63 DefaultAlignForAttributeAligned = 128;
64 MinGlobalAlign = 0;
65 // From the glibc documentation, on GNU systems, malloc guarantees 16-byte
66 // alignment on 64-bit systems and 8-byte alignment on 32-bit systems. See
67 // https://www.gnu.org/software/libc/manual/html_node/Malloc-Examples.html.
68 // This alignment guarantee also applies to Windows and Android.
69 if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment() || T.isAndroid())
70 NewAlign = Triple.isArch64Bit() ? 128 : Triple.isArch32Bit() ? 64 : 0;
71 else
72 NewAlign = 0; // Infer from basic type alignment.
73 HalfWidth = 16;
74 HalfAlign = 16;
75 FloatWidth = 32;
76 FloatAlign = 32;
77 DoubleWidth = 64;
78 DoubleAlign = 64;
79 LongDoubleWidth = 64;
80 LongDoubleAlign = 64;
81 Float128Align = 128;
82 LargeArrayMinWidth = 0;
83 LargeArrayAlign = 0;
84 MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 0;
85 MaxVectorAlign = 0;
86 MaxTLSAlign = 0;
87 SimdDefaultAlign = 0;
88 SizeType = UnsignedLong;
89 PtrDiffType = SignedLong;
90 IntMaxType = SignedLongLong;
91 IntPtrType = SignedLong;
92 WCharType = SignedInt;
93 WIntType = SignedInt;
94 Char16Type = UnsignedShort;
95 Char32Type = UnsignedInt;
96 Int64Type = SignedLongLong;
97 SigAtomicType = SignedInt;
98 ProcessIDType = SignedInt;
99 UseSignedCharForObjCBool = true;
100 UseBitFieldTypeAlignment = true;
101 UseZeroLengthBitfieldAlignment = false;
102 UseExplicitBitFieldAlignment = true;
103 ZeroLengthBitfieldBoundary = 0;
104 HalfFormat = &llvm::APFloat::IEEEhalf();
105 FloatFormat = &llvm::APFloat::IEEEsingle();
106 DoubleFormat = &llvm::APFloat::IEEEdouble();
107 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
108 Float128Format = &llvm::APFloat::IEEEquad();
109 MCountName = "mcount";
110 RegParmMax = 0;
111 SSERegParmMax = 0;
112 HasAlignMac68kSupport = false;
113 HasBuiltinMSVaList = false;
114 IsRenderScriptTarget = false;
115 HasAArch64SVETypes = false;
116
117 // Default to no types using fpret.
118 RealTypeUsesObjCFPRet = 0;
119
120 // Default to not using fp2ret for __Complex long double
121 ComplexLongDoubleUsesFP2Ret = false;
122
123 // Set the C++ ABI based on the triple.
124 TheCXXABI.set(Triple.isKnownWindowsMSVCEnvironment()
125 ? TargetCXXABI::Microsoft
126 : TargetCXXABI::GenericItanium);
127
128 // Default to an empty address space map.
129 AddrSpaceMap = &DefaultAddrSpaceMap;
130 UseAddrSpaceMapMangling = false;
131
132 // Default to an unknown platform name.
133 PlatformName = "unknown";
134 PlatformMinVersion = VersionTuple();
135 }
136
137 // Out of line virtual dtor for TargetInfo.
138 TargetInfo::~TargetInfo() {}
139
140 void TargetInfo::resetDataLayout(StringRef DL) {
141 DataLayout.reset(new llvm::DataLayout(DL));
142 }
143
144 bool
145 TargetInfo::checkCFProtectionBranchSupported(DiagnosticsEngine &Diags) const {
146 Diags.Report(diag::err_opt_not_valid_on_target) << "cf-protection=branch";
147 return false;
148 }
149
150 bool
151 TargetInfo::checkCFProtectionReturnSupported(DiagnosticsEngine &Diags) const {
152 Diags.Report(diag::err_opt_not_valid_on_target) << "cf-protection=return";
153 return false;
154 }
155
156 /// getTypeName - Return the user string for the specified integer type enum.
157 /// For example, SignedShort -> "short".
158 const char *TargetInfo::getTypeName(IntType T) {
159 switch (T) {
160 default: llvm_unreachable("not an integer!");
161 case SignedChar: return "signed char";
162 case UnsignedChar: return "unsigned char";
163 case SignedShort: return "short";
164 case UnsignedShort: return "unsigned short";
165 case SignedInt: return "int";
166 case UnsignedInt: return "unsigned int";
167 case SignedLong: return "long int";
168 case UnsignedLong: return "long unsigned int";
169 case SignedLongLong: return "long long int";
170 case UnsignedLongLong: return "long long unsigned int";
171 }
172 }
173
174 /// getTypeConstantSuffix - Return the constant suffix for the specified
175 /// integer type enum. For example, SignedLong -> "L".
176 const char *TargetInfo::getTypeConstantSuffix(IntType T) const {
177 switch (T) {
178 default: llvm_unreachable("not an integer!");
179 case SignedChar:
180 case SignedShort:
181 case SignedInt: return "";
182 case SignedLong: return "L";
183 case SignedLongLong: return "LL";
184 case UnsignedChar:
185 if (getCharWidth() < getIntWidth())
186 return "";
187 LLVM_FALLTHROUGH;
188 case UnsignedShort:
189 if (getShortWidth() < getIntWidth())
190 return "";
191 LLVM_FALLTHROUGH;
192 case UnsignedInt: return "U";
193 case UnsignedLong: return "UL";
194 case UnsignedLongLong: return "ULL";
195 }
196 }
197
198 /// getTypeFormatModifier - Return the printf format modifier for the
199 /// specified integer type enum. For example, SignedLong -> "l".
200
201 const char *TargetInfo::getTypeFormatModifier(IntType T) {
202 switch (T) {
203 default: llvm_unreachable("not an integer!");
204 case SignedChar:
205 case UnsignedChar: return "hh";
206 case SignedShort:
207 case UnsignedShort: return "h";
208 case SignedInt:
209 case UnsignedInt: return "";
210 case SignedLong:
211 case UnsignedLong: return "l";
212 case SignedLongLong:
213 case UnsignedLongLong: return "ll";
214 }
215 }
216
217 /// getTypeWidth - Return the width (in bits) of the specified integer type
218 /// enum. For example, SignedInt -> getIntWidth().
219 unsigned TargetInfo::getTypeWidth(IntType T) const {
220 switch (T) {
221 default: llvm_unreachable("not an integer!");
222 case SignedChar:
223 case UnsignedChar: return getCharWidth();
224 case SignedShort:
225 case UnsignedShort: return getShortWidth();
226 case SignedInt:
227 case UnsignedInt: return getIntWidth();
228 case SignedLong:
229 case UnsignedLong: return getLongWidth();
230 case SignedLongLong:
231 case UnsignedLongLong: return getLongLongWidth();
232 };
233 }
234
235 TargetInfo::IntType TargetInfo::getIntTypeByWidth(
236 unsigned BitWidth, bool IsSigned) const {
237 if (getCharWidth() == BitWidth)
238 return IsSigned ? SignedChar : UnsignedChar;
239 if (getShortWidth() == BitWidth)
240 return IsSigned ? SignedShort : UnsignedShort;
241 if (getIntWidth() == BitWidth)
242 return IsSigned ? SignedInt : UnsignedInt;
243 if (getLongWidth() == BitWidth)
244 return IsSigned ? SignedLong : UnsignedLong;
245 if (getLongLongWidth() == BitWidth)
246 return IsSigned ? SignedLongLong : UnsignedLongLong;
247 return NoInt;
248 }
249
250 TargetInfo::IntType TargetInfo::getLeastIntTypeByWidth(unsigned BitWidth,
251 bool IsSigned) const {
252 if (getCharWidth() >= BitWidth)
253 return IsSigned ? SignedChar : UnsignedChar;
254 if (getShortWidth() >= BitWidth)
255 return IsSigned ? SignedShort : UnsignedShort;
256 if (getIntWidth() >= BitWidth)
257 return IsSigned ? SignedInt : UnsignedInt;
258 if (getLongWidth() >= BitWidth)
259 return IsSigned ? SignedLong : UnsignedLong;
260 if (getLongLongWidth() >= BitWidth)
261 return IsSigned ? SignedLongLong : UnsignedLongLong;
262 return NoInt;
263 }
264
265 TargetInfo::RealType TargetInfo::getRealTypeByWidth(unsigned BitWidth) const {
266 if (getFloatWidth() == BitWidth)
267 return Float;
268 if (getDoubleWidth() == BitWidth)
269 return Double;
270
271 switch (BitWidth) {
272 case 96:
273 if (&getLongDoubleFormat() == &llvm::APFloat::x87DoubleExtended())
274 return LongDouble;
275 break;
276 case 128:
277 if (&getLongDoubleFormat() == &llvm::APFloat::PPCDoubleDouble() ||
278 &getLongDoubleFormat() == &llvm::APFloat::IEEEquad())
279 return LongDouble;
280 if (hasFloat128Type())
281 return Float128;
282 break;
283 }
284
285 return NoFloat;
286 }
287
288 /// getTypeAlign - Return the alignment (in bits) of the specified integer type
289 /// enum. For example, SignedInt -> getIntAlign().
290 unsigned TargetInfo::getTypeAlign(IntType T) const {
291 switch (T) {
292 default: llvm_unreachable("not an integer!");
293 case SignedChar:
294 case UnsignedChar: return getCharAlign();
295 case SignedShort:
296 case UnsignedShort: return getShortAlign();
297 case SignedInt:
298 case UnsignedInt: return getIntAlign();
299 case SignedLong:
300 case UnsignedLong: return getLongAlign();
301 case SignedLongLong:
302 case UnsignedLongLong: return getLongLongAlign();
303 };
304 }
305
306 /// isTypeSigned - Return whether an integer types is signed. Returns true if
307 /// the type is signed; false otherwise.
308 bool TargetInfo::isTypeSigned(IntType T) {
309 switch (T) {
310 default: llvm_unreachable("not an integer!");
311 case SignedChar:
312 case SignedShort:
313 case SignedInt:
314 case SignedLong:
315 case SignedLongLong:
316 return true;
317 case UnsignedChar:
318 case UnsignedShort:
319 case UnsignedInt:
320 case UnsignedLong:
321 case UnsignedLongLong:
322 return false;
323 };
324 }
325
326 /// adjust - Set forced language options.
327 /// Apply changes to the target information with respect to certain
328 /// language options which change the target configuration and adjust
329 /// the language based on the target options where applicable.
330 void TargetInfo::adjust(LangOptions &Opts) {
331 if (Opts.NoBitFieldTypeAlign)
332 UseBitFieldTypeAlignment = false;
333
334 switch (Opts.WCharSize) {
335 default: llvm_unreachable("invalid wchar_t width");
336 case 0: break;
337 case 1: WCharType = Opts.WCharIsSigned ? SignedChar : UnsignedChar; break;
338 case 2: WCharType = Opts.WCharIsSigned ? SignedShort : UnsignedShort; break;
339 case 4: WCharType = Opts.WCharIsSigned ? SignedInt : UnsignedInt; break;
340 }
341
342 if (Opts.AlignDouble) {
343 DoubleAlign = LongLongAlign = 64;
344 LongDoubleAlign = 64;
345 }
346
347 if (Opts.OpenCL) {
348 // OpenCL C requires specific widths for types, irrespective of
349 // what these normally are for the target.
350 // We also define long long and long double here, although the
351 // OpenCL standard only mentions these as "reserved".
352 IntWidth = IntAlign = 32;
353 LongWidth = LongAlign = 64;
354 LongLongWidth = LongLongAlign = 128;
355 HalfWidth = HalfAlign = 16;
356 FloatWidth = FloatAlign = 32;
357
358 // Embedded 32-bit targets (OpenCL EP) might have double C type
359 // defined as float. Let's not override this as it might lead
360 // to generating illegal code that uses 64bit doubles.
361 if (DoubleWidth != FloatWidth) {
362 DoubleWidth = DoubleAlign = 64;
363 DoubleFormat = &llvm::APFloat::IEEEdouble();
364 }
365 LongDoubleWidth = LongDoubleAlign = 128;
366
367 unsigned MaxPointerWidth = getMaxPointerWidth();
368 assert(MaxPointerWidth == 32 || MaxPointerWidth == 64);
369 bool Is32BitArch = MaxPointerWidth == 32;
370 SizeType = Is32BitArch ? UnsignedInt : UnsignedLong;
371 PtrDiffType = Is32BitArch ? SignedInt : SignedLong;
372 IntPtrType = Is32BitArch ? SignedInt : SignedLong;
373
374 IntMaxType = SignedLongLong;
375 Int64Type = SignedLong;
376
377 HalfFormat = &llvm::APFloat::IEEEhalf();
378 FloatFormat = &llvm::APFloat::IEEEsingle();
379 LongDoubleFormat = &llvm::APFloat::IEEEquad();
380 }
381
382 if (Opts.LongDoubleSize) {
383 if (Opts.LongDoubleSize == DoubleWidth) {
384 LongDoubleWidth = DoubleWidth;
385 LongDoubleAlign = DoubleAlign;
386 LongDoubleFormat = DoubleFormat;
387 } else if (Opts.LongDoubleSize == 128) {
388 LongDoubleWidth = LongDoubleAlign = 128;
389 LongDoubleFormat = &llvm::APFloat::IEEEquad();
390 }
391 }
392
393 if (Opts.NewAlignOverride)
394 NewAlign = Opts.NewAlignOverride * getCharWidth();
395
396 // Each unsigned fixed point type has the same number of fractional bits as
397 // its corresponding signed type.
398 PaddingOnUnsignedFixedPoint |= Opts.PaddingOnUnsignedFixedPoint;
399 CheckFixedPointBits();
400 }
401
402 bool TargetInfo::initFeatureMap(
403 llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags, StringRef CPU,
404 const std::vector<std::string> &FeatureVec) const {
405 for (const auto &F : FeatureVec) {
406 StringRef Name = F;
407 // Apply the feature via the target.
408 bool Enabled = Name[0] == '+';
409 setFeatureEnabled(Features, Name.substr(1), Enabled);
410 }
411 return true;
412 }
413
414 TargetInfo::CallingConvKind
415 TargetInfo::getCallingConvKind(bool ClangABICompat4) const {
416 if (getCXXABI() != TargetCXXABI::Microsoft &&
417 (ClangABICompat4 || getTriple().getOS() == llvm::Triple::PS4))
418 return CCK_ClangABI4OrPS4;
419 return CCK_Default;
420 }
421
422 LangAS TargetInfo::getOpenCLTypeAddrSpace(OpenCLTypeKind TK) const {
423 switch (TK) {
424 case OCLTK_Image:
425 case OCLTK_Pipe:
426 return LangAS::opencl_global;
427
428 case OCLTK_Sampler:
429 return LangAS::opencl_constant;
430
431 default:
432 return LangAS::Default;
433 }
434 }
435
436 //===----------------------------------------------------------------------===//
437
438
439 static StringRef removeGCCRegisterPrefix(StringRef Name) {
440 if (Name[0] == '%' || Name[0] == '#')
441 Name = Name.substr(1);
442
443 return Name;
444 }
445
446 /// isValidClobber - Returns whether the passed in string is
447 /// a valid clobber in an inline asm statement. This is used by
448 /// Sema.
449 bool TargetInfo::isValidClobber(StringRef Name) const {
450 return (isValidGCCRegisterName(Name) ||
451 Name == "memory" || Name == "cc");
452 }
453
454 /// isValidGCCRegisterName - Returns whether the passed in string
455 /// is a valid register name according to GCC. This is used by Sema for
456 /// inline asm statements.
457 bool TargetInfo::isValidGCCRegisterName(StringRef Name) const {
458 if (Name.empty())
459 return false;
460
461 // Get rid of any register prefix.
462 Name = removeGCCRegisterPrefix(Name);
463 if (Name.empty())
464 return false;
465
466 ArrayRef<const char *> Names = getGCCRegNames();
467
468 // If we have a number it maps to an entry in the register name array.
469 if (isDigit(Name[0])) {
470 unsigned n;
471 if (!Name.getAsInteger(0, n))
472 return n < Names.size();
473 }
474
475 // Check register names.
476 if (llvm::is_contained(Names, Name))
477 return true;
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 true;
488 }
489
490 // Now check aliases.
491 for (const GCCRegAlias &GRA : getGCCRegAliases())
492 for (const char *A : GRA.Aliases) {
493 if (!A)
494 break;
495 if (A == Name)
496 return true;
497 }
498
499 return false;
500 }
501
502 StringRef TargetInfo::getNormalizedGCCRegisterName(StringRef Name,
503 bool ReturnCanonical) const {
504 assert(isValidGCCRegisterName(Name) && "Invalid register passed in");
505
506 // Get rid of any register prefix.
507 Name = removeGCCRegisterPrefix(Name);
508
509 ArrayRef<const char *> Names = getGCCRegNames();
510
511 // First, check if we have a number.
512 if (isDigit(Name[0])) {
513 unsigned n;
514 if (!Name.getAsInteger(0, n)) {
515 assert(n < Names.size() && "Out of bounds register number!");
516 return Names[n];
517 }
518 }
519
520 // Check any additional names that we have.
521 for (const AddlRegName &ARN : getGCCAddlRegNames())
522 for (const char *AN : ARN.Names) {
523 if (!AN)
524 break;
525 // Make sure the register that the additional name is for is within
526 // the bounds of the register names from above.
527 if (AN == Name && ARN.RegNum < Names.size())
528 return ReturnCanonical ? Names[ARN.RegNum] : Name;
529 }
530
531 // Now check aliases.
532 for (const GCCRegAlias &RA : getGCCRegAliases())
533 for (const char *A : RA.Aliases) {
534 if (!A)
535 break;
536 if (A == Name)
537 return RA.Register;
538 }
539
540 return Name;
541 }
542
543 bool TargetInfo::validateOutputConstraint(ConstraintInfo &Info) const {
544 const char *Name = Info.getConstraintStr().c_str();
545 // An output constraint must start with '=' or '+'
546 if (*Name != '=' && *Name != '+')
547 return false;
548
549 if (*Name == '+')
550 Info.setIsReadWrite();
551
552 Name++;
553 while (*Name) {
554 switch (*Name) {
555 default:
556 if (!validateAsmConstraint(Name, Info)) {
557 // FIXME: We temporarily return false
558 // so we can add more constraints as we hit it.
559 // Eventually, an unknown constraint should just be treated as 'g'.
560 return false;
561 }
562 break;
563 case '&': // early clobber.
564 Info.setEarlyClobber();
565 break;
566 case '%': // commutative.
567 // FIXME: Check that there is a another register after this one.
568 break;
569 case 'r': // general register.
570 Info.setAllowsRegister();
571 break;
572 case 'm': // memory operand.
573 case 'o': // offsetable memory operand.
574 case 'V': // non-offsetable memory operand.
575 case '<': // autodecrement memory operand.
576 case '>': // autoincrement memory operand.
577 Info.setAllowsMemory();
578 break;
579 case 'g': // general register, memory operand or immediate integer.
580 case 'X': // any operand.
581 Info.setAllowsRegister();
582 Info.setAllowsMemory();
583 break;
584 case ',': // multiple alternative constraint. Pass it.
585 // Handle additional optional '=' or '+' modifiers.
586 if (Name[1] == '=' || Name[1] == '+')
587 Name++;
588 break;
589 case '#': // Ignore as constraint.
590 while (Name[1] && Name[1] != ',')
591 Name++;
592 break;
593 case '?': // Disparage slightly code.
594 case '!': // Disparage severely.
595 case '*': // Ignore for choosing register preferences.
596 case 'i': // Ignore i,n,E,F as output constraints (match from the other
597 // chars)
598 case 'n':
599 case 'E':
600 case 'F':
601 break; // Pass them.
602 }
603
604 Name++;
605 }
606
607 // Early clobber with a read-write constraint which doesn't permit registers
608 // is invalid.
609 if (Info.earlyClobber() && Info.isReadWrite() && !Info.allowsRegister())
610 return false;
611
612 // If a constraint allows neither memory nor register operands it contains
613 // only modifiers. Reject it.
614 return Info.allowsMemory() || Info.allowsRegister();
615 }
616
617 bool TargetInfo::resolveSymbolicName(const char *&Name,
618 ArrayRef<ConstraintInfo> OutputConstraints,
619 unsigned &Index) const {
620 assert(*Name == '[' && "Symbolic name did not start with '['");
621 Name++;
622 const char *Start = Name;
623 while (*Name && *Name != ']')
624 Name++;
625
626 if (!*Name) {
627 // Missing ']'
628 return false;
629 }
630
631 std::string SymbolicName(Start, Name - Start);
632
633 for (Index = 0; Index != OutputConstraints.size(); ++Index)
634 if (SymbolicName == OutputConstraints[Index].getName())
635 return true;
636
637 return false;
638 }
639
640 bool TargetInfo::validateInputConstraint(
641 MutableArrayRef<ConstraintInfo> OutputConstraints,
642 ConstraintInfo &Info) const {
643 const char *Name = Info.ConstraintStr.c_str();
644
645 if (!*Name)
646 return false;
647
648 while (*Name) {
649 switch (*Name) {
650 default:
651 // Check if we have a matching constraint
652 if (*Name >= '0' && *Name <= '9') {
653 const char *DigitStart = Name;
654 while (Name[1] >= '0' && Name[1] <= '9')
655 Name++;
656 const char *DigitEnd = Name;
657 unsigned i;
658 if (StringRef(DigitStart, DigitEnd - DigitStart + 1)
659 .getAsInteger(10, i))
660 return false;
661
662 // Check if matching constraint is out of bounds.
663 if (i >= OutputConstraints.size()) return false;
664
665 // A number must refer to an output only operand.
666 if (OutputConstraints[i].isReadWrite())
667 return false;
668
669 // If the constraint is already tied, it must be tied to the
670 // same operand referenced to by the number.
671 if (Info.hasTiedOperand() && Info.getTiedOperand() != i)
672 return false;
673
674 // The constraint should have the same info as the respective
675 // output constraint.
676 Info.setTiedOperand(i, OutputConstraints[i]);
677 } else if (!validateAsmConstraint(Name, Info)) {
678 // FIXME: This error return is in place temporarily so we can
679 // add more constraints as we hit it. Eventually, an unknown
680 // constraint should just be treated as 'g'.
681 return false;
682 }
683 break;
684 case '[': {
685 unsigned Index = 0;
686 if (!resolveSymbolicName(Name, OutputConstraints, Index))
687 return false;
688
689 // If the constraint is already tied, it must be tied to the
690 // same operand referenced to by the number.
691 if (Info.hasTiedOperand() && Info.getTiedOperand() != Index)
692 return false;
693
694 // A number must refer to an output only operand.
695 if (OutputConstraints[Index].isReadWrite())
696 return false;
697
698 Info.setTiedOperand(Index, OutputConstraints[Index]);
699 break;
700 }
701 case '%': // commutative
702 // FIXME: Fail if % is used with the last operand.
703 break;
704 case 'i': // immediate integer.
705 break;
706 case 'n': // immediate integer with a known value.
707 Info.setRequiresImmediate();
708 break;
709 case 'I': // Various constant constraints with target-specific meanings.
710 case 'J':
711 case 'K':
712 case 'L':
713 case 'M':
714 case 'N':
715 case 'O':
716 case 'P':
717 if (!validateAsmConstraint(Name, Info))
718 return false;
719 break;
720 case 'r': // general register.
721 Info.setAllowsRegister();
722 break;
723 case 'm': // memory operand.
724 case 'o': // offsettable memory operand.
725 case 'V': // non-offsettable memory operand.
726 case '<': // autodecrement memory operand.
727 case '>': // autoincrement memory operand.
728 Info.setAllowsMemory();
729 break;
730 case 'g': // general register, memory operand or immediate integer.
731 case 'X': // any operand.
732 Info.setAllowsRegister();
733 Info.setAllowsMemory();
734 break;
735 case 'E': // immediate floating point.
736 case 'F': // immediate floating point.
737 case 'p': // address operand.
738 break;
739 case ',': // multiple alternative constraint. Ignore comma.
740 break;
741 case '#': // Ignore as constraint.
742 while (Name[1] && Name[1] != ',')
743 Name++;
744 break;
745 case '?': // Disparage slightly code.
746 case '!': // Disparage severely.
747 case '*': // Ignore for choosing register preferences.
748 break; // Pass them.
749 }
750
751 Name++;
752 }
753
754 return true;
755 }
756
757 void TargetInfo::CheckFixedPointBits() const {
758 // Check that the number of fractional and integral bits (and maybe sign) can
759 // fit into the bits given for a fixed point type.
760 assert(ShortAccumScale + getShortAccumIBits() + 1 <= ShortAccumWidth);
761 assert(AccumScale + getAccumIBits() + 1 <= AccumWidth);
762 assert(LongAccumScale + getLongAccumIBits() + 1 <= LongAccumWidth);
763 assert(getUnsignedShortAccumScale() + getUnsignedShortAccumIBits() <=
764 ShortAccumWidth);
765 assert(getUnsignedAccumScale() + getUnsignedAccumIBits() <= AccumWidth);
766 assert(getUnsignedLongAccumScale() + getUnsignedLongAccumIBits() <=
767 LongAccumWidth);
768
769 assert(getShortFractScale() + 1 <= ShortFractWidth);
770 assert(getFractScale() + 1 <= FractWidth);
771 assert(getLongFractScale() + 1 <= LongFractWidth);
772 assert(getUnsignedShortFractScale() <= ShortFractWidth);
773 assert(getUnsignedFractScale() <= FractWidth);
774 assert(getUnsignedLongFractScale() <= LongFractWidth);
775
776 // Each unsigned fract type has either the same number of fractional bits
777 // as, or one more fractional bit than, its corresponding signed fract type.
778 assert(getShortFractScale() == getUnsignedShortFractScale() ||
779 getShortFractScale() == getUnsignedShortFractScale() - 1);
780 assert(getFractScale() == getUnsignedFractScale() ||
781 getFractScale() == getUnsignedFractScale() - 1);
782 assert(getLongFractScale() == getUnsignedLongFractScale() ||
783 getLongFractScale() == getUnsignedLongFractScale() - 1);
784
785 // When arranged in order of increasing rank (see 6.3.1.3a), the number of
786 // fractional bits is nondecreasing for each of the following sets of
787 // fixed-point types:
788 // - signed fract types
789 // - unsigned fract types
790 // - signed accum types
791 // - unsigned accum types.
792 assert(getLongFractScale() >= getFractScale() &&
793 getFractScale() >= getShortFractScale());
794 assert(getUnsignedLongFractScale() >= getUnsignedFractScale() &&
795 getUnsignedFractScale() >= getUnsignedShortFractScale());
796 assert(LongAccumScale >= AccumScale && AccumScale >= ShortAccumScale);
797 assert(getUnsignedLongAccumScale() >= getUnsignedAccumScale() &&
798 getUnsignedAccumScale() >= getUnsignedShortAccumScale());
799
800 // When arranged in order of increasing rank (see 6.3.1.3a), the number of
801 // integral bits is nondecreasing for each of the following sets of
802 // fixed-point types:
803 // - signed accum types
804 // - unsigned accum types
805 assert(getLongAccumIBits() >= getAccumIBits() &&
806 getAccumIBits() >= getShortAccumIBits());
807 assert(getUnsignedLongAccumIBits() >= getUnsignedAccumIBits() &&
808 getUnsignedAccumIBits() >= getUnsignedShortAccumIBits());
809
810 // Each signed accum type has at least as many integral bits as its
811 // corresponding unsigned accum type.
812 assert(getShortAccumIBits() >= getUnsignedShortAccumIBits());
813 assert(getAccumIBits() >= getUnsignedAccumIBits());
814 assert(getLongAccumIBits() >= getUnsignedLongAccumIBits());
815 }
816
817 void TargetInfo::copyAuxTarget(const TargetInfo *Aux) {
818 auto *Target = static_cast<TransferrableTargetInfo*>(this);
819 auto *Src = static_cast<const TransferrableTargetInfo*>(Aux);
820 *Target = *Src;
821 }
clang::TargetInfo::checkCFProtectionReturnSupported
virtual bool checkCFProtectionReturnSupported(DiagnosticsEngine &Diags) const
Check if the target supports CFProtection branch.
Definition: TargetInfo.cpp:151
clang::TargetInfo::getTypeWidth
unsigned getTypeWidth(IntType T) const
Return the width (in bits) of the specified integer type enum.
Definition: TargetInfo.cpp:219
clang::TransferrableTargetInfo::LongLongAlign
unsigned char LongLongAlign
Definition: TargetInfo.h:67
clang::TransferrableTargetInfo::WCharType
IntType WCharType
Definition: TargetInfo.h:129
clang::TargetInfo::CCK_ClangABI4OrPS4
Definition: TargetInfo.h:1305
clang::TargetInfo::getFloatWidth
unsigned getFloatWidth() const
getFloatWidth/Align/Format - Return the size/align/format of &#39;float&#39;.
Definition: TargetInfo.h:580
clang::TransferrableTargetInfo::PaddingOnUnsignedFixedPoint
bool PaddingOnUnsignedFixedPoint
Definition: TargetInfo.h:82
clang::TargetInfo::TLSSupported
bool TLSSupported
Definition: TargetInfo.h:172
clang::TargetInfo::getLongAccumIBits
unsigned getLongAccumIBits() const
Definition: TargetInfo.h:454
clang::TargetInfo::NoAsmVariants
bool NoAsmVariants
Definition: TargetInfo.h:174
clang::TransferrableTargetInfo::LargeArrayMinWidth
unsigned char LargeArrayMinWidth
Definition: TargetInfo.h:65
clang::TargetInfo::adjust
virtual void adjust(LangOptions &Opts)
Set forced language options.
Definition: TargetInfo.cpp:330
clang::TargetInfo::getLongWidth
unsigned getLongWidth() const
getLongWidth/Align - Return the size of &#39;signed long&#39; and &#39;unsigned long&#39; for this target...
Definition: TargetInfo.h:401
clang::TransferrableTargetInfo::FloatFormat
const llvm::fltSemantics * FloatFormat
Definition: TargetInfo.h:103
clang::TransferrableTargetInfo::DoubleAlign
unsigned char DoubleAlign
Definition: TargetInfo.h:63
clang::TargetInfo::validateAsmConstraint
virtual bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &info) const =0
clang::TransferrableTargetInfo::HalfAlign
unsigned char HalfAlign
Definition: TargetInfo.h:61
clang::TargetInfo::CCK_Default
Definition: TargetInfo.h:1304
clang::TargetInfo::getTriple
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
Definition: TargetInfo.h:994
clang::TargetInfo::getLongAlign
unsigned getLongAlign() const
Definition: TargetInfo.h:402
clang::TargetInfo::getLeastIntTypeByWidth
virtual IntType getLeastIntTypeByWidth(unsigned BitWidth, bool IsSigned) const
Return the smallest integer type with at least the specified width.
Definition: TargetInfo.cpp:250
clang::TransferrableTargetInfo::FloatWidth
unsigned char FloatWidth
Definition: TargetInfo.h:62
clang::TransferrableTargetInfo::Float
Definition: TargetInfo.h:123
clang::TransferrableTargetInfo::WIntType
IntType WIntType
Definition: TargetInfo.h:129
clang::TransferrableTargetInfo::NoFloat
Definition: TargetInfo.h:122
clang::TargetInfo::getOpenCLTypeAddrSpace
virtual LangAS getOpenCLTypeAddrSpace(OpenCLTypeKind TK) const
Get address space for OpenCL type.
Definition: TargetInfo.cpp:422
clang::TargetInfo::validateInputConstraint
bool validateInputConstraint(MutableArrayRef< ConstraintInfo > OutputConstraints, ConstraintInfo &info) const
Definition: TargetInfo.cpp:640
clang::DiagnosticsEngine::Report
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
Definition: Diagnostic.h:1300
clang::TransferrableTargetInfo::LongFractAlign
unsigned char LongFractAlign
Definition: TargetInfo.h:75
clang::TargetInfo::getAccumIBits
unsigned getAccumIBits() const
Definition: TargetInfo.h:449
clang::TargetInfo::TargetInfo
TargetInfo(const llvm::Triple &T)
Definition: TargetInfo.cpp:29
clang::TargetInfo::HasFloat128
bool HasFloat128
Definition: TargetInfo.h:177
clang::TargetInfo::getCharWidth
unsigned getCharWidth() const
Definition: TargetInfo.h:383
clang::TransferrableTargetInfo::ShortFractWidth
unsigned char ShortFractWidth
Definition: TargetInfo.h:73
clang::TransferrableTargetInfo::Char16Type
IntType Char16Type
Definition: TargetInfo.h:129
clang::TargetInfo::SimdDefaultAlign
unsigned short SimdDefaultAlign
Definition: TargetInfo.h:181
clang::TargetInfo::OCLTK_Image
Definition: TargetInfo.h:1352
clang::TargetInfo::getShortAccumIBits
unsigned getShortAccumIBits() const
Definition: TargetInfo.h:442
clang::TargetInfo::ConstraintInfo::setRequiresImmediate
void setRequiresImmediate(int Min, int Max)
Definition: TargetInfo.h:897
DefaultAddrSpaceMap
static const LangASMap DefaultAddrSpaceMap
Definition: TargetInfo.cpp:26
clang::TargetInfo::getCharAlign
unsigned getCharAlign() const
Definition: TargetInfo.h:384
clang::TransferrableTargetInfo::UseSignedCharForObjCBool
unsigned UseSignedCharForObjCBool
Whether Objective-C&#39;s built-in boolean type should be signed char.
Definition: TargetInfo.h:137
clang::LangAS
LangAS
Defines the address space values used by the address space qualifier of QualType. ...
Definition: AddressSpaces.h:25
clang::TransferrableTargetInfo::AccumScale
unsigned char AccumScale
Definition: TargetInfo.h:92
clang::TransferrableTargetInfo::FractAlign
unsigned char FractAlign
Definition: TargetInfo.h:74
clang::MultiVersionKind::Target
clang::TargetInfo::setFeatureEnabled
virtual void setFeatureEnabled(llvm::StringMap< bool > &Features, StringRef Name, bool Enabled) const
Enable or disable a specific target feature; the feature name must be valid.
Definition: TargetInfo.h:1098
clang::TransferrableTargetInfo::SignedInt
Definition: TargetInfo.h:113
clang::TransferrableTargetInfo::LargeArrayAlign
unsigned char LargeArrayAlign
Definition: TargetInfo.h:65
clang::TransferrableTargetInfo::SigAtomicType
IntType SigAtomicType
Definition: TargetInfo.h:129
clang::TransferrableTargetInfo::LongDoubleAlign
unsigned char LongDoubleAlign
Definition: TargetInfo.h:64
clang::TargetInfo::getCXXABI
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
Definition: TargetInfo.h:1063
clang::TargetInfo::getIntAlign
unsigned getIntAlign() const
Definition: TargetInfo.h:397
clang::TargetInfo::getTypeConstantSuffix
const char * getTypeConstantSuffix(IntType T) const
Return the constant suffix for the specified integer type enum.
Definition: TargetInfo.cpp:176
clang::TargetInfo::getNormalizedGCCRegisterName
StringRef getNormalizedGCCRegisterName(StringRef Name, bool ReturnCanonical=false) const
Returns the "normalized" GCC register name.
Definition: TargetInfo.cpp:502
clang::TargetInfo::HasLegalHalfType
bool HasLegalHalfType
Definition: TargetInfo.h:175
clang::TargetInfo::MCountName
const char * MCountName
Definition: TargetInfo.h:183
clang::TransferrableTargetInfo::PtrDiffType
IntType PtrDiffType
Definition: TargetInfo.h:129
clang::TargetInfo::getUnsignedLongAccumIBits
unsigned getUnsignedLongAccumIBits() const
Definition: TargetInfo.h:484
clang::LangOptions
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:53
clang::TransferrableTargetInfo::RealType
RealType
Definition: TargetInfo.h:121
clang::TransferrableTargetInfo::LongAlign
unsigned char LongAlign
Definition: TargetInfo.h:66
clang::TransferrableTargetInfo::NoInt
Definition: TargetInfo.h:108
clang::TargetInfo::isTypeSigned
static bool isTypeSigned(IntType T)
Returns true if the type is signed; false otherwise.
Definition: TargetInfo.cpp:308
clang::TargetInfo::MaxAtomicPromoteWidth
unsigned char MaxAtomicPromoteWidth
Definition: TargetInfo.h:180
clang::TransferrableTargetInfo::HalfFormat
const llvm::fltSemantics * HalfFormat
Definition: TargetInfo.h:103
clang::TargetInfo::SSERegParmMax
unsigned char SSERegParmMax
Definition: TargetInfo.h:184
clang::TransferrableTargetInfo::Float128Format
const llvm::fltSemantics * Float128Format
Definition: TargetInfo.h:103
clang::TargetCXXABI::Microsoft
The Microsoft ABI is the ABI used by Microsoft Visual Studio (and compatible compilers).
Definition: TargetCXXABI.h:118
clang::TransferrableTargetInfo::SuitableAlign
unsigned char SuitableAlign
Definition: TargetInfo.h:95
clang::DiagnosticsEngine
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:149
clang::TargetInfo::getShortWidth
unsigned getShortWidth() const
Return the size of &#39;signed short&#39; and &#39;unsigned short&#39; for this target, in bits.
Definition: TargetInfo.h:388
clang::TargetInfo::CallingConvKind
CallingConvKind
Definition: TargetInfo.h:1303
Diagnostic.h
Defines the Diagnostic-related interfaces.
clang::TransferrableTargetInfo::Int64Type
IntType Int64Type
Definition: TargetInfo.h:129
clang::TargetInfo::HasAArch64SVETypes
unsigned HasAArch64SVETypes
Definition: TargetInfo.h:199
clang::TargetInfo::PlatformMinVersion
VersionTuple PlatformMinVersion
Definition: TargetInfo.h:189
clang::TransferrableTargetInfo::UnsignedChar
Definition: TargetInfo.h:110
clang::TransferrableTargetInfo::LongDouble
Definition: TargetInfo.h:125
clang::TargetInfo::ComplexLongDoubleUsesFP2Ret
unsigned ComplexLongDoubleUsesFP2Ret
Definition: TargetInfo.h:193
clang::TargetInfo::getLongLongAlign
unsigned getLongLongAlign() const
Definition: TargetInfo.h:407
llvm::ArrayRef
Definition: LLVM.h:31
clang::TransferrableTargetInfo::UseZeroLengthBitfieldAlignment
unsigned UseZeroLengthBitfieldAlignment
Whether zero length bitfields (e.g., int : 0;) force alignment of the next bitfield.
Definition: TargetInfo.h:152
clang::TargetInfo::isValidGCCRegisterName
virtual bool isValidGCCRegisterName(StringRef Name) const
Returns whether the passed in string is a valid register name according to GCC.
Definition: TargetInfo.cpp:457
clang::TransferrableTargetInfo::AccumWidth
unsigned char AccumWidth
Definition: TargetInfo.h:71
clang::TargetInfo::RealTypeUsesObjCFPRet
unsigned RealTypeUsesObjCFPRet
Definition: TargetInfo.h:192
clang::TransferrableTargetInfo::HalfWidth
unsigned char HalfWidth
Definition: TargetInfo.h:61
AddressSpaces.h
Provides definitions for the various language-specific address spaces.
clang::TargetInfo::ConstraintInfo::setEarlyClobber
void setEarlyClobber()
Definition: TargetInfo.h:893
clang::TargetInfo::checkCFProtectionBranchSupported
virtual bool checkCFProtectionBranchSupported(DiagnosticsEngine &Diags) const
Check if the target supports CFProtection branch.
Definition: TargetInfo.cpp:145
clang::TargetInfo::PlatformName
StringRef PlatformName
Definition: TargetInfo.h:188
CharInfo.h
clang::TargetInfo::getCallingConvKind
virtual CallingConvKind getCallingConvKind(bool ClangABICompat4) const
Definition: TargetInfo.cpp:415
clang::TargetInfo::isValidClobber
bool isValidClobber(StringRef Name) const
Returns whether the passed in string is a valid clobber in an inline asm statement.
Definition: TargetInfo.cpp:449
clang::TransferrableTargetInfo::DefaultAlignForAttributeAligned
unsigned char DefaultAlignForAttributeAligned
Definition: TargetInfo.h:96
clang::TransferrableTargetInfo::AccumAlign
unsigned char AccumAlign
Definition: TargetInfo.h:71
clang::TargetInfo::getLongDoubleFormat
const llvm::fltSemantics & getLongDoubleFormat() const
Definition: TargetInfo.h:593
clang::TargetInfo::HasBuiltinMSVaList
unsigned HasBuiltinMSVaList
Definition: TargetInfo.h:195
clang::TargetInfo
Exposes information about the current target.
Definition: TargetInfo.h:164
clang::TransferrableTargetInfo::ShortFractAlign
unsigned char ShortFractAlign
Definition: TargetInfo.h:73
clang::TransferrableTargetInfo::LongFractWidth
unsigned char LongFractWidth
Definition: TargetInfo.h:75
clang::TargetInfo::HasAlignMac68kSupport
unsigned HasAlignMac68kSupport
Definition: TargetInfo.h:191
clang::TargetInfo::RegParmMax
unsigned char RegParmMax
Definition: TargetInfo.h:184
clang::TargetInfo::initFeatureMap
virtual bool initFeatureMap(llvm::StringMap< bool > &Features, DiagnosticsEngine &Diags, StringRef CPU, const std::vector< std::string > &FeatureVec) const
Initialize the map with the default set of target features for the CPU this should include all legal ...
Definition: TargetInfo.cpp:402
LangOptions.h
Defines the clang::LangOptions interface.
clang::TargetInfo::ConstraintInfo::setAllowsMemory
void setAllowsMemory()
Definition: TargetInfo.h:894
llvm::MutableArrayRef
Definition: LLVM.h:32
clang::TargetInfo::VLASupported
bool VLASupported
Definition: TargetInfo.h:173
clang::TargetInfo::HasFloat16
bool HasFloat16
Definition: TargetInfo.h:178
clang::TargetInfo::getIntWidth
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:396
clang::TransferrableTargetInfo::BoolAlign
unsigned char BoolAlign
Definition: TargetInfo.h:59
clang::TransferrableTargetInfo::SignedLong
Definition: TargetInfo.h:115
clang::TransferrableTargetInfo::Float128
Definition: TargetInfo.h:126
clang::TransferrableTargetInfo::UseBitFieldTypeAlignment
unsigned UseBitFieldTypeAlignment
Control whether the alignment of bit-field types is respected when laying out structures.
Definition: TargetInfo.h:144
clang::TargetInfo::ConstraintInfo::ConstraintStr
std::string ConstraintStr
Definition: TargetInfo.h:849
clang::TransferrableTargetInfo::ShortAccumScale
unsigned char ShortAccumScale
Definition: TargetInfo.h:91
clang::TransferrableTargetInfo::SignedLongLong
Definition: TargetInfo.h:117
clang::TransferrableTargetInfo::LongAccumAlign
unsigned char LongAccumAlign
Definition: TargetInfo.h:72
removeGCCRegisterPrefix
static StringRef removeGCCRegisterPrefix(StringRef Name)
Definition: TargetInfo.cpp:439
clang::TargetInfo::getShortAlign
unsigned getShortAlign() const
Return the alignment of &#39;signed short&#39; and &#39;unsigned short&#39; for this target.
Definition: TargetInfo.h:392
clang::TargetInfo::getDoubleWidth
unsigned getDoubleWidth() const
getDoubleWidth/Align/Format - Return the size/align/format of &#39;double&#39;.
Definition: TargetInfo.h:585
clang::TargetInfo::getTypeAlign
unsigned getTypeAlign(IntType T) const
Return the alignment (in bits) of the specified integer type enum.
Definition: TargetInfo.cpp:290
clang::TargetInfo::getTypeName
static const char * getTypeName(IntType T)
Return the user string for the specified integer type enum.
Definition: TargetInfo.cpp:158
clang::TargetInfo::ConstraintInfo
Definition: TargetInfo.h:830
clang::TransferrableTargetInfo::LongDoubleFormat
const llvm::fltSemantics * LongDoubleFormat
Definition: TargetInfo.h:103
clang::TargetInfo::ConstraintInfo::setAllowsRegister
void setAllowsRegister()
Definition: TargetInfo.h:895
clang::TransferrableTargetInfo::UnsignedLong
Definition: TargetInfo.h:116
clang::TransferrableTargetInfo::SizeType
IntType SizeType
Definition: TargetInfo.h:129
clang::TargetInfo::AddrSpaceMap
const LangASMap * AddrSpaceMap
Definition: TargetInfo.h:186
clang::LangAS::Default
clang::TransferrableTargetInfo::FractWidth
unsigned char FractWidth
Definition: TargetInfo.h:74
clang::TargetInfo::IsRenderScriptTarget
unsigned IsRenderScriptTarget
Definition: TargetInfo.h:197
clang::TransferrableTargetInfo::LongDoubleWidth
unsigned char LongDoubleWidth
Definition: TargetInfo.h:64
clang::TransferrableTargetInfo::UseExplicitBitFieldAlignment
unsigned UseExplicitBitFieldAlignment
Whether explicit bit field alignment attributes are honored.
Definition: TargetInfo.h:155
clang::TargetInfo::getLongLongWidth
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:406
clang::TransferrableTargetInfo::MaxTLSAlign
unsigned short MaxTLSAlign
Definition: TargetInfo.h:101
clang::TargetInfo::getUnsignedAccumScale
unsigned getUnsignedAccumScale() const
getUnsignedAccumScale/IBits - Return the number of fractional/integral bits in a &#39;unsigned _Accum&#39; ty...
Definition: TargetInfo.h:471
clang::TransferrableTargetInfo::BoolWidth
unsigned char BoolWidth
Definition: TargetInfo.h:59
clang::TransferrableTargetInfo::LongAccumScale
unsigned char LongAccumScale
Definition: TargetInfo.h:93
clang::TransferrableTargetInfo::IntAlign
unsigned char IntAlign
Definition: TargetInfo.h:60
clang::TransferrableTargetInfo::Double
Definition: TargetInfo.h:124
clang::TargetInfo::validateOutputConstraint
bool validateOutputConstraint(ConstraintInfo &Info) const
Definition: TargetInfo.cpp:543
clang::TransferrableTargetInfo::LongWidth
unsigned char LongWidth
Definition: TargetInfo.h:66
clang::TargetInfo::getGCCAddlRegNames
virtual ArrayRef< AddlRegName > getGCCAddlRegNames() const
Definition: TargetInfo.h:1407
clang::TargetInfo::~TargetInfo
virtual ~TargetInfo()
Definition: TargetInfo.cpp:138
clang::TargetCXXABI::GenericItanium
The generic Itanium ABI is the standard ABI of most open-source and Unix-like platforms.
Definition: TargetCXXABI.h:33
clang::TargetInfo::getGCCRegAliases
virtual ArrayRef< GCCRegAlias > getGCCRegAliases() const =0
clang::TargetInfo::getUnsignedAccumIBits
unsigned getUnsignedAccumIBits() const
Definition: TargetInfo.h:474
clang::TargetCXXABI::set
void set(Kind kind)
Definition: TargetCXXABI.h:133
clang::TransferrableTargetInfo::UnsignedInt
Definition: TargetInfo.h:114
clang::TargetInfo::getUnsignedLongAccumScale
unsigned getUnsignedLongAccumScale() const
getUnsignedLongAccumScale/IBits - Return the number of fractional/integral bits in a &#39;unsigned long _...
Definition: TargetInfo.h:481
clang::TransferrableTargetInfo::UnsignedLongLong
Definition: TargetInfo.h:118
clang::TransferrableTargetInfo::PointerWidth
unsigned char PointerWidth
Definition: TargetInfo.h:58
clang::TransferrableTargetInfo::IntType
IntType
===-— Target Data Type Query Methods ----------------------------—===//
Definition: TargetInfo.h:107
clang::TransferrableTargetInfo::LongLongWidth
unsigned char LongLongWidth
Definition: TargetInfo.h:67
clang::TransferrableTargetInfo::ShortAccumAlign
unsigned char ShortAccumAlign
Definition: TargetInfo.h:70
clang::TransferrableTargetInfo::NewAlign
unsigned short NewAlign
Definition: TargetInfo.h:99
clang::TargetInfo::getRealTypeByWidth
RealType getRealTypeByWidth(unsigned BitWidth) const
Return floating point type with specified width.
Definition: TargetInfo.cpp:265
clang::TargetInfo::getUnsignedShortAccumIBits
unsigned getUnsignedShortAccumIBits() const
Definition: TargetInfo.h:463
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:21
clang::TransferrableTargetInfo::SignedShort
Definition: TargetInfo.h:111
clang::TransferrableTargetInfo::ZeroLengthBitfieldBoundary
unsigned ZeroLengthBitfieldBoundary
If non-zero, specifies a fixed alignment value for bitfields that follow zero length bitfield...
Definition: TargetInfo.h:159
clang::TargetInfo::getTypeFormatModifier
static const char * getTypeFormatModifier(IntType T)
Return the printf format modifier for the specified integer type enum.
Definition: TargetInfo.cpp:201
getName
static std::string getName(const CallEvent &Call)
Definition: ReturnValueChecker.cpp:60
clang::TargetInfo::ConstraintInfo::allowsMemory
bool allowsMemory() const
Definition: TargetInfo.h:864
clang::TransferrableTargetInfo::ProcessIDType
IntType ProcessIDType
Definition: TargetInfo.h:129
clang::LangASMap
unsigned[(unsigned) LangAS::FirstTargetAddressSpace] LangASMap
The type of a lookup table which maps from language-specific address spaces to target-specific ones...
Definition: AddressSpaces.h:58
clang::TargetInfo::getLongFractScale
unsigned getLongFractScale() const
getLongFractScale - Return the number of fractional bits in a &#39;signed long _Fract&#39; type...
Definition: TargetInfo.h:500
clang::TargetInfo::getUnsignedFractScale
unsigned getUnsignedFractScale() const
getUnsignedFractScale - Return the number of fractional bits in a &#39;unsigned _Fract&#39; type...
Definition: TargetInfo.h:511
clang::TargetInfo::ConstraintInfo::hasTiedOperand
bool hasTiedOperand() const
Return true if this input operand is a matching constraint that ties it to an output operand...
Definition: TargetInfo.h:875
clang::TransferrableTargetInfo::MinGlobalAlign
unsigned char MinGlobalAlign
Definition: TargetInfo.h:97
clang::LangAS::opencl_global
clang::TargetInfo::BigEndian
bool BigEndian
Definition: TargetInfo.h:171
clang::TransferrableTargetInfo
Fields controlling how types are laid out in memory; these may need to be copied for targets like AMD...
Definition: TargetInfo.h:57
clang::TargetInfo::ConstraintInfo::allowsRegister
bool allowsRegister() const
Definition: TargetInfo.h:863
clang::TargetInfo::ConstraintInfo::getConstraintStr
const std::string & getConstraintStr() const
Definition: TargetInfo.h:859
clang::TargetInfo::getUnsignedShortAccumScale
unsigned getUnsignedShortAccumScale() const
getUnsignedShortAccumScale/IBits - Return the number of fractional/integral bits in a &#39;unsigned short...
Definition: TargetInfo.h:460
clang::TargetInfo::getIntTypeByWidth
virtual IntType getIntTypeByWidth(unsigned BitWidth, bool IsSigned) const
Return integer type with specified width.
Definition: TargetInfo.cpp:235
clang::isDigit
LLVM_READONLY bool isDigit(unsigned char c)
Return true if this character is an ASCII digit: [0-9].
Definition: CharInfo.h:93
clang::TargetInfo::resolveSymbolicName
bool resolveSymbolicName(const char *&Name, ArrayRef< ConstraintInfo > OutputConstraints, unsigned &Index) const
Definition: TargetInfo.cpp:617
clang::TransferrableTargetInfo::IntMaxType
IntType IntMaxType
Definition: TargetInfo.h:129
clang::TargetInfo::ConstraintInfo::getTiedOperand
unsigned getTiedOperand() const
Definition: TargetInfo.h:876
clang::TargetInfo::getMaxPointerWidth
virtual uint64_t getMaxPointerWidth() const
Return the maximum width of pointers on this target.
Definition: TargetInfo.h:369
clang::TargetInfo::getShortFractScale
unsigned getShortFractScale() const
getShortFractScale - Return the number of fractional bits in a &#39;signed short _Fract&#39; type...
Definition: TargetInfo.h:492
clang::TargetInfo::hasFloat128Type
virtual bool hasFloat128Type() const
Determine whether the __float128 type is supported on this target.
Definition: TargetInfo.h:531
clang::TargetInfo::copyAuxTarget
void copyAuxTarget(const TargetInfo *Aux)
Copy type and layout related info.
Definition: TargetInfo.cpp:817
clang::TargetInfo::getUnsignedLongFractScale
unsigned getUnsignedLongFractScale() const
getUnsignedLongFractScale - Return the number of fractional bits in a &#39;unsigned long _Fract&#39; type...
Definition: TargetInfo.h:517
clang::TransferrableTargetInfo::LongAccumWidth
unsigned char LongAccumWidth
Definition: TargetInfo.h:72
clang::TransferrableTargetInfo::UnsignedShort
Definition: TargetInfo.h:112
clang::TargetInfo::OCLTK_Pipe
Definition: TargetInfo.h:1353
clang::TargetInfo::getFractScale
unsigned getFractScale() const
getFractScale - Return the number of fractional bits in a &#39;signed _Fract&#39; type.
Definition: TargetInfo.h:496
clang::TransferrableTargetInfo::SignedChar
Definition: TargetInfo.h:109
clang::TargetInfo::GCCRegAlias
Definition: TargetInfo.h:1003
clang::TransferrableTargetInfo::IntWidth
unsigned char IntWidth
Definition: TargetInfo.h:60
clang::TargetInfo::getUnsignedShortFractScale
unsigned getUnsignedShortFractScale() const
getUnsignedShortFractScale - Return the number of fractional bits in a &#39;unsigned short _Fract&#39; type...
Definition: TargetInfo.h:504
clang::TransferrableTargetInfo::Float128Align
unsigned char Float128Align
Definition: TargetInfo.h:64
clang::TransferrableTargetInfo::DoubleFormat
const llvm::fltSemantics * DoubleFormat
Definition: TargetInfo.h:103
clang::TransferrableTargetInfo::ShortAccumWidth
unsigned char ShortAccumWidth
Definition: TargetInfo.h:70
clang::TransferrableTargetInfo::Char32Type
IntType Char32Type
Definition: TargetInfo.h:129
clang::TargetInfo::OpenCLTypeKind
OpenCLTypeKind
Definition: TargetInfo.h:1348
clang::TargetInfo::TheCXXABI
TargetCXXABI TheCXXABI
Definition: TargetInfo.h:185
clang::TransferrableTargetInfo::DoubleWidth
unsigned char DoubleWidth
Definition: TargetInfo.h:63
TargetInfo.h
Defines the clang::TargetInfo interface.
clang::TargetInfo::ConstraintInfo::setIsReadWrite
void setIsReadWrite()
Definition: TargetInfo.h:892
clang::TargetInfo::ConstraintInfo::earlyClobber
bool earlyClobber()
Definition: TargetInfo.h:862
clang::LangAS::opencl_constant
clang::TargetInfo::MaxAtomicInlineWidth
unsigned char MaxAtomicInlineWidth
Definition: TargetInfo.h:180
clang::TargetInfo::ConstraintInfo::setTiedOperand
void setTiedOperand(unsigned N, ConstraintInfo &Output)
Indicate that this is an input operand that is tied to the specified output operand.
Definition: TargetInfo.h:920
clang::TargetInfo::ConstraintInfo::isReadWrite
bool isReadWrite() const
Definition: TargetInfo.h:861
clang::TransferrableTargetInfo::PointerAlign
unsigned char PointerAlign
Definition: TargetInfo.h:58
clang::TransferrableTargetInfo::FloatAlign
unsigned char FloatAlign
Definition: TargetInfo.h:62
clang::TargetInfo::OCLTK_Sampler
Definition: TargetInfo.h:1356
clang::TargetInfo::DataLayout
std::unique_ptr< llvm::DataLayout > DataLayout
Definition: TargetInfo.h:182
clang::TargetInfo::AddlRegName
Definition: TargetInfo.h:1008
clang::TargetInfo::resetDataLayout
void resetDataLayout(StringRef DL)
Definition: TargetInfo.cpp:140
clang::TargetInfo::getGCCRegNames
virtual ArrayRef< const char * > getGCCRegNames() const =0
clang::TargetInfo::UseAddrSpaceMapMangling
bool UseAddrSpaceMapMangling
Specify if mangling based on address space map should be used or not for language specific address sp...
Definition: TargetInfo.h:268
clang::TransferrableTargetInfo::IntPtrType
IntType IntPtrType
Definition: TargetInfo.h:129
clang::TransferrableTargetInfo::MaxVectorAlign
unsigned short MaxVectorAlign
Definition: TargetInfo.h:100