1 //===--- TargetInfo.h - Expose information about the target -----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// \brief Defines the clang::TargetInfo interface.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CLANG_BASIC_TARGETINFO_H
16 #define LLVM_CLANG_BASIC_TARGETINFO_H
18 #include "clang/Basic/AddressSpaces.h"
19 #include "clang/Basic/TargetCXXABI.h"
20 #include "clang/Basic/LLVM.h"
21 #include "clang/Basic/Specifiers.h"
22 #include "clang/Basic/TargetOptions.h"
23 #include "clang/Basic/VersionTuple.h"
24 #include "llvm/ADT/IntrusiveRefCntPtr.h"
25 #include "llvm/ADT/StringMap.h"
26 #include "llvm/ADT/StringRef.h"
27 #include "llvm/ADT/StringSwitch.h"
28 #include "llvm/ADT/Triple.h"
29 #include "llvm/Support/DataTypes.h"
39 class DiagnosticsEngine;
45 namespace Builtin { struct Info; }
47 /// \brief Exposes information about the current target.
49 class TargetInfo : public RefCountedBase<TargetInfo> {
50 IntrusiveRefCntPtr<TargetOptions> TargetOpts;
53 // Target values set by the ctor of the actual target implementation. Default
54 // values are specified by the TargetInfo constructor.
57 bool NoAsmVariants; // True if {|} are normal characters.
58 unsigned char PointerWidth, PointerAlign;
59 unsigned char BoolWidth, BoolAlign;
60 unsigned char IntWidth, IntAlign;
61 unsigned char HalfWidth, HalfAlign;
62 unsigned char FloatWidth, FloatAlign;
63 unsigned char DoubleWidth, DoubleAlign;
64 unsigned char LongDoubleWidth, LongDoubleAlign;
65 unsigned char LargeArrayMinWidth, LargeArrayAlign;
66 unsigned char LongWidth, LongAlign;
67 unsigned char LongLongWidth, LongLongAlign;
68 unsigned char SuitableAlign;
69 unsigned char MinGlobalAlign;
70 unsigned char MaxAtomicPromoteWidth, MaxAtomicInlineWidth;
71 unsigned short MaxVectorAlign;
72 const char *DescriptionString;
73 const char *UserLabelPrefix;
74 const char *MCountName;
75 const llvm::fltSemantics *HalfFormat, *FloatFormat, *DoubleFormat,
77 unsigned char RegParmMax, SSERegParmMax;
78 TargetCXXABI TheCXXABI;
79 const LangAS::Map *AddrSpaceMap;
81 mutable StringRef PlatformName;
82 mutable VersionTuple PlatformMinVersion;
84 unsigned HasAlignMac68kSupport : 1;
85 unsigned RealTypeUsesObjCFPRet : 3;
86 unsigned ComplexLongDoubleUsesFP2Ret : 1;
88 // TargetInfo Constructor. Default initializes all fields.
89 TargetInfo(const std::string &T);
92 /// \brief Construct a target for the given options.
94 /// \param Opts - The options to use to initialize the target. The target may
95 /// modify the options to canonicalize the target feature information to match
96 /// what the backend expects.
97 static TargetInfo* CreateTargetInfo(DiagnosticsEngine &Diags,
100 virtual ~TargetInfo();
102 /// \brief Retrieve the target options.
103 TargetOptions &getTargetOpts() const {
104 assert(TargetOpts && "Missing target options");
108 void setTargetOpts(TargetOptions *TargetOpts) {
109 this->TargetOpts = TargetOpts;
112 ///===---- Target Data Type Query Methods -------------------------------===//
131 /// \brief The different kinds of __builtin_va_list types defined by
132 /// the target implementation.
133 enum BuiltinVaListKind {
134 /// typedef char* __builtin_va_list;
135 CharPtrBuiltinVaList = 0,
137 /// typedef void* __builtin_va_list;
138 VoidPtrBuiltinVaList,
140 /// __builtin_va_list as defind by the AArch64 ABI
141 /// http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055a/IHI0055A_aapcs64.pdf
142 AArch64ABIBuiltinVaList,
144 /// __builtin_va_list as defined by the PNaCl ABI:
145 /// http://www.chromium.org/nativeclient/pnacl/bitcode-abi#TOC-Machine-Types
146 PNaClABIBuiltinVaList,
148 /// __builtin_va_list as defined by the Power ABI:
149 /// https://www.power.org
150 /// /resources/downloads/Power-Arch-32-bit-ABI-supp-1.0-Embedded.pdf
151 PowerABIBuiltinVaList,
153 /// __builtin_va_list as defined by the x86-64 ABI:
154 /// http://www.x86-64.org/documentation/abi.pdf
155 X86_64ABIBuiltinVaList,
157 /// __builtin_va_list as defined by ARM AAPCS ABI
158 /// http://infocenter.arm.com
159 // /help/topic/com.arm.doc.ihi0042d/IHI0042D_aapcs.pdf
160 AAPCSABIBuiltinVaList,
162 // typedef struct __va_list_tag
166 // void *__overflow_arg_area;
167 // void *__reg_save_area;
173 IntType SizeType, IntMaxType, UIntMaxType, PtrDiffType, IntPtrType, WCharType,
174 WIntType, Char16Type, Char32Type, Int64Type, SigAtomicType,
177 /// \brief Whether Objective-C's built-in boolean type should be signed char.
179 /// Otherwise, when this flag is not set, the normal built-in boolean type is
181 unsigned UseSignedCharForObjCBool : 1;
183 /// Control whether the alignment of bit-field types is respected when laying
184 /// out structures. If true, then the alignment of the bit-field type will be
185 /// used to (a) impact the alignment of the containing structure, and (b)
186 /// ensure that the individual bit-field will not straddle an alignment
188 unsigned UseBitFieldTypeAlignment : 1;
190 /// \brief Whether zero length bitfields (e.g., int : 0;) force alignment of
191 /// the next bitfield.
193 /// If the alignment of the zero length bitfield is greater than the member
194 /// that follows it, `bar', `bar' will be aligned as the type of the
195 /// zero-length bitfield.
196 unsigned UseZeroLengthBitfieldAlignment : 1;
198 /// If non-zero, specifies a fixed alignment value for bitfields that follow
199 /// zero length bitfield, regardless of the zero length bitfield type.
200 unsigned ZeroLengthBitfieldBoundary;
203 IntType getSizeType() const { return SizeType; }
204 IntType getIntMaxType() const { return IntMaxType; }
205 IntType getUIntMaxType() const { return UIntMaxType; }
206 IntType getPtrDiffType(unsigned AddrSpace) const {
207 return AddrSpace == 0 ? PtrDiffType : getPtrDiffTypeV(AddrSpace);
209 IntType getIntPtrType() const { return IntPtrType; }
210 IntType getWCharType() const { return WCharType; }
211 IntType getWIntType() const { return WIntType; }
212 IntType getChar16Type() const { return Char16Type; }
213 IntType getChar32Type() const { return Char32Type; }
214 IntType getInt64Type() const { return Int64Type; }
215 IntType getSigAtomicType() const { return SigAtomicType; }
216 IntType getProcessIDType() const { return ProcessIDType; }
218 /// \brief Return the width (in bits) of the specified integer type enum.
220 /// For example, SignedInt -> getIntWidth().
221 unsigned getTypeWidth(IntType T) const;
223 /// \brief Return the alignment (in bits) of the specified integer type enum.
225 /// For example, SignedInt -> getIntAlign().
226 unsigned getTypeAlign(IntType T) const;
228 /// \brief Returns true if the type is signed; false otherwise.
229 static bool isTypeSigned(IntType T);
231 /// \brief Return the width of pointers on this target, for the
232 /// specified address space.
233 uint64_t getPointerWidth(unsigned AddrSpace) const {
234 return AddrSpace == 0 ? PointerWidth : getPointerWidthV(AddrSpace);
236 uint64_t getPointerAlign(unsigned AddrSpace) const {
237 return AddrSpace == 0 ? PointerAlign : getPointerAlignV(AddrSpace);
240 /// \brief Return the size of '_Bool' and C++ 'bool' for this target, in bits.
241 unsigned getBoolWidth() const { return BoolWidth; }
243 /// \brief Return the alignment of '_Bool' and C++ 'bool' for this target.
244 unsigned getBoolAlign() const { return BoolAlign; }
246 unsigned getCharWidth() const { return 8; } // FIXME
247 unsigned getCharAlign() const { return 8; } // FIXME
249 /// \brief Return the size of 'signed short' and 'unsigned short' for this
251 unsigned getShortWidth() const { return 16; } // FIXME
253 /// \brief Return the alignment of 'signed short' and 'unsigned short' for
255 unsigned getShortAlign() const { return 16; } // FIXME
257 /// getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for
258 /// this target, in bits.
259 unsigned getIntWidth() const { return IntWidth; }
260 unsigned getIntAlign() const { return IntAlign; }
262 /// getLongWidth/Align - Return the size of 'signed long' and 'unsigned long'
263 /// for this target, in bits.
264 unsigned getLongWidth() const { return LongWidth; }
265 unsigned getLongAlign() const { return LongAlign; }
267 /// getLongLongWidth/Align - Return the size of 'signed long long' and
268 /// 'unsigned long long' for this target, in bits.
269 unsigned getLongLongWidth() const { return LongLongWidth; }
270 unsigned getLongLongAlign() const { return LongLongAlign; }
272 /// \brief Determine whether the __int128 type is supported on this target.
273 bool hasInt128Type() const { return getPointerWidth(0) >= 64; } // FIXME
275 /// \brief Return the alignment that is suitable for storing any
276 /// object with a fundamental alignment requirement.
277 unsigned getSuitableAlign() const { return SuitableAlign; }
279 /// getMinGlobalAlign - Return the minimum alignment of a global variable,
280 /// unless its alignment is explicitly reduced via attributes.
281 unsigned getMinGlobalAlign() const { return MinGlobalAlign; }
283 /// getWCharWidth/Align - Return the size of 'wchar_t' for this target, in
285 unsigned getWCharWidth() const { return getTypeWidth(WCharType); }
286 unsigned getWCharAlign() const { return getTypeAlign(WCharType); }
288 /// getChar16Width/Align - Return the size of 'char16_t' for this target, in
290 unsigned getChar16Width() const { return getTypeWidth(Char16Type); }
291 unsigned getChar16Align() const { return getTypeAlign(Char16Type); }
293 /// getChar32Width/Align - Return the size of 'char32_t' for this target, in
295 unsigned getChar32Width() const { return getTypeWidth(Char32Type); }
296 unsigned getChar32Align() const { return getTypeAlign(Char32Type); }
298 /// getHalfWidth/Align/Format - Return the size/align/format of 'half'.
299 unsigned getHalfWidth() const { return HalfWidth; }
300 unsigned getHalfAlign() const { return HalfAlign; }
301 const llvm::fltSemantics &getHalfFormat() const { return *HalfFormat; }
303 /// getFloatWidth/Align/Format - Return the size/align/format of 'float'.
304 unsigned getFloatWidth() const { return FloatWidth; }
305 unsigned getFloatAlign() const { return FloatAlign; }
306 const llvm::fltSemantics &getFloatFormat() const { return *FloatFormat; }
308 /// getDoubleWidth/Align/Format - Return the size/align/format of 'double'.
309 unsigned getDoubleWidth() const { return DoubleWidth; }
310 unsigned getDoubleAlign() const { return DoubleAlign; }
311 const llvm::fltSemantics &getDoubleFormat() const { return *DoubleFormat; }
313 /// getLongDoubleWidth/Align/Format - Return the size/align/format of 'long
315 unsigned getLongDoubleWidth() const { return LongDoubleWidth; }
316 unsigned getLongDoubleAlign() const { return LongDoubleAlign; }
317 const llvm::fltSemantics &getLongDoubleFormat() const {
318 return *LongDoubleFormat;
321 /// \brief Return the value for the C99 FLT_EVAL_METHOD macro.
322 virtual unsigned getFloatEvalMethod() const { return 0; }
324 // getLargeArrayMinWidth/Align - Return the minimum array size that is
325 // 'large' and its alignment.
326 unsigned getLargeArrayMinWidth() const { return LargeArrayMinWidth; }
327 unsigned getLargeArrayAlign() const { return LargeArrayAlign; }
329 /// \brief Return the maximum width lock-free atomic operation which will
330 /// ever be supported for the given target
331 unsigned getMaxAtomicPromoteWidth() const { return MaxAtomicPromoteWidth; }
332 /// \brief Return the maximum width lock-free atomic operation which can be
333 /// inlined given the supported features of the given target.
334 unsigned getMaxAtomicInlineWidth() const { return MaxAtomicInlineWidth; }
336 /// \brief Return the maximum vector alignment supported for the given target.
337 unsigned getMaxVectorAlign() const { return MaxVectorAlign; }
339 /// \brief Return the size of intmax_t and uintmax_t for this target, in bits.
340 unsigned getIntMaxTWidth() const {
341 return getTypeWidth(IntMaxType);
344 // Return the size of unwind_word for this target.
345 unsigned getUnwindWordWidth() const { return getPointerWidth(0); }
347 /// \brief Return the "preferred" register width on this target.
348 uint64_t getRegisterWidth() const {
349 // Currently we assume the register width on the target matches the pointer
350 // width, we can introduce a new variable for this if/when some target wants
355 /// \brief Returns the default value of the __USER_LABEL_PREFIX__ macro,
356 /// which is the prefix given to user symbols by default.
358 /// On most platforms this is "_", but it is "" on some, and "." on others.
359 const char *getUserLabelPrefix() const {
360 return UserLabelPrefix;
363 /// \brief Returns the name of the mcount instrumentation function.
364 const char *getMCountName() const {
368 /// \brief Check if the Objective-C built-in boolean type should be signed
371 /// Otherwise, if this returns false, the normal built-in boolean type
372 /// should also be used for Objective-C.
373 bool useSignedCharForObjCBool() const {
374 return UseSignedCharForObjCBool;
376 void noSignedCharForObjCBool() {
377 UseSignedCharForObjCBool = false;
380 /// \brief Check whether the alignment of bit-field types is respected
381 /// when laying out structures.
382 bool useBitFieldTypeAlignment() const {
383 return UseBitFieldTypeAlignment;
386 /// \brief Check whether zero length bitfields should force alignment of
388 bool useZeroLengthBitfieldAlignment() const {
389 return UseZeroLengthBitfieldAlignment;
392 /// \brief Get the fixed alignment value in bits for a member that follows
393 /// a zero length bitfield.
394 unsigned getZeroLengthBitfieldBoundary() const {
395 return ZeroLengthBitfieldBoundary;
398 /// \brief Check whether this target support '\#pragma options align=mac68k'.
399 bool hasAlignMac68kSupport() const {
400 return HasAlignMac68kSupport;
403 /// \brief Return the user string for the specified integer type enum.
405 /// For example, SignedShort -> "short".
406 static const char *getTypeName(IntType T);
408 /// \brief Return the constant suffix for the specified integer type enum.
410 /// For example, SignedLong -> "L".
411 static const char *getTypeConstantSuffix(IntType T);
413 /// \brief Check whether the given real type should use the "fpret" flavor of
414 /// Objective-C message passing on this target.
415 bool useObjCFPRetForRealType(RealType T) const {
416 return RealTypeUsesObjCFPRet & (1 << T);
419 /// \brief Check whether _Complex long double should use the "fp2ret" flavor
420 /// of Objective-C message passing on this target.
421 bool useObjCFP2RetForComplexLongDouble() const {
422 return ComplexLongDoubleUsesFP2Ret;
425 ///===---- Other target property query methods --------------------------===//
427 /// \brief Appends the target-specific \#define values for this
428 /// target set to the specified buffer.
429 virtual void getTargetDefines(const LangOptions &Opts,
430 MacroBuilder &Builder) const = 0;
433 /// Return information about target-specific builtins for
434 /// the current primary target, and info about which builtins are non-portable
435 /// across the current set of primary and secondary targets.
436 virtual void getTargetBuiltins(const Builtin::Info *&Records,
437 unsigned &NumRecords) const = 0;
439 /// The __builtin_clz* and __builtin_ctz* built-in
440 /// functions are specified to have undefined results for zero inputs, but
441 /// on targets that support these operations in a way that provides
442 /// well-defined results for zero without loss of performance, it is a good
443 /// idea to avoid optimizing based on that undef behavior.
444 virtual bool isCLZForZeroUndef() const { return true; }
446 /// \brief Returns the kind of __builtin_va_list type that should be used
447 /// with this target.
448 virtual BuiltinVaListKind getBuiltinVaListKind() const = 0;
450 /// \brief Returns whether the passed in string is a valid clobber in an
451 /// inline asm statement.
453 /// This is used by Sema.
454 bool isValidClobber(StringRef Name) const;
456 /// \brief Returns whether the passed in string is a valid register name
457 /// according to GCC.
459 /// This is used by Sema for inline asm statements.
460 bool isValidGCCRegisterName(StringRef Name) const;
462 /// \brief Returns the "normalized" GCC register name.
464 /// For example, on x86 it will return "ax" when "eax" is passed in.
465 StringRef getNormalizedGCCRegisterName(StringRef Name) const;
467 struct ConstraintInfo {
470 CI_AllowsMemory = 0x01,
471 CI_AllowsRegister = 0x02,
472 CI_ReadWrite = 0x04, // "+r" output constraint (read and write).
473 CI_HasMatchingInput = 0x08 // This output operand has a matching input.
478 std::string ConstraintStr; // constraint: "=rm"
479 std::string Name; // Operand name: [foo] with no []'s.
481 ConstraintInfo(StringRef ConstraintStr, StringRef Name)
482 : Flags(0), TiedOperand(-1), ConstraintStr(ConstraintStr.str()),
485 const std::string &getConstraintStr() const { return ConstraintStr; }
486 const std::string &getName() const { return Name; }
487 bool isReadWrite() const { return (Flags & CI_ReadWrite) != 0; }
488 bool allowsRegister() const { return (Flags & CI_AllowsRegister) != 0; }
489 bool allowsMemory() const { return (Flags & CI_AllowsMemory) != 0; }
491 /// \brief Return true if this output operand has a matching
492 /// (tied) input operand.
493 bool hasMatchingInput() const { return (Flags & CI_HasMatchingInput) != 0; }
495 /// \brief Return true if this input operand is a matching
496 /// constraint that ties it to an output operand.
498 /// If this returns true then getTiedOperand will indicate which output
499 /// operand this is tied to.
500 bool hasTiedOperand() const { return TiedOperand != -1; }
501 unsigned getTiedOperand() const {
502 assert(hasTiedOperand() && "Has no tied operand!");
503 return (unsigned)TiedOperand;
506 void setIsReadWrite() { Flags |= CI_ReadWrite; }
507 void setAllowsMemory() { Flags |= CI_AllowsMemory; }
508 void setAllowsRegister() { Flags |= CI_AllowsRegister; }
509 void setHasMatchingInput() { Flags |= CI_HasMatchingInput; }
511 /// \brief Indicate that this is an input operand that is tied to
512 /// the specified output operand.
514 /// Copy over the various constraint information from the output.
515 void setTiedOperand(unsigned N, ConstraintInfo &Output) {
516 Output.setHasMatchingInput();
517 Flags = Output.Flags;
519 // Don't copy Name or constraint string.
523 // validateOutputConstraint, validateInputConstraint - Checks that
524 // a constraint is valid and provides information about it.
525 // FIXME: These should return a real error instead of just true/false.
526 bool validateOutputConstraint(ConstraintInfo &Info) const;
527 bool validateInputConstraint(ConstraintInfo *OutputConstraints,
529 ConstraintInfo &info) const;
530 virtual bool validateInputSize(StringRef /*Constraint*/,
531 unsigned /*Size*/) const {
534 virtual bool validateConstraintModifier(StringRef /*Constraint*/,
535 const char /*Modifier*/,
536 unsigned /*Size*/) const {
539 bool resolveSymbolicName(const char *&Name,
540 ConstraintInfo *OutputConstraints,
541 unsigned NumOutputs, unsigned &Index) const;
543 // Constraint parm will be left pointing at the last character of
544 // the constraint. In practice, it won't be changed unless the
545 // constraint is longer than one character.
546 virtual std::string convertConstraint(const char *&Constraint) const {
547 // 'p' defaults to 'r', but can be overridden by targets.
548 if (*Constraint == 'p')
549 return std::string("r");
550 return std::string(1, *Constraint);
553 /// \brief Returns a string of target-specific clobbers, in LLVM format.
554 virtual const char *getClobbers() const = 0;
557 /// \brief Returns the target triple of the primary target.
558 const llvm::Triple &getTriple() const {
562 const char *getTargetDescription() const {
563 return DescriptionString;
567 const char * const Aliases[5];
568 const char * const Register;
572 const char * const Names[5];
573 const unsigned RegNum;
576 /// \brief Does this target support "protected" visibility?
578 /// Any target which dynamic libraries will naturally support
579 /// something like "default" (meaning that the symbol is visible
580 /// outside this shared object) and "hidden" (meaning that it isn't)
581 /// visibilities, but "protected" is really an ELF-specific concept
582 /// with weird semantics designed around the convenience of dynamic
583 /// linker implementations. Which is not to suggest that there's
584 /// consistent target-independent semantics for "default" visibility
585 /// either; the entire thing is pretty badly mangled.
586 virtual bool hasProtectedVisibility() const { return true; }
588 /// \brief Return the section to use for CFString literals, or 0 if no
589 /// special section is used.
590 virtual const char *getCFStringSection() const {
591 return "__DATA,__cfstring";
594 /// \brief Return the section to use for NSString literals, or 0 if no
595 /// special section is used.
596 virtual const char *getNSStringSection() const {
597 return "__OBJC,__cstring_object,regular,no_dead_strip";
600 /// \brief Return the section to use for NSString literals, or 0 if no
601 /// special section is used (NonFragile ABI).
602 virtual const char *getNSStringNonFragileABISection() const {
603 return "__DATA, __objc_stringobj, regular, no_dead_strip";
606 /// \brief An optional hook that targets can implement to perform semantic
607 /// checking on attribute((section("foo"))) specifiers.
609 /// In this case, "foo" is passed in to be checked. If the section
610 /// specifier is invalid, the backend should return a non-empty string
611 /// that indicates the problem.
613 /// This hook is a simple quality of implementation feature to catch errors
614 /// and give good diagnostics in cases when the assembler or code generator
615 /// would otherwise reject the section specifier.
617 virtual std::string isValidSectionSpecifier(StringRef SR) const {
621 /// \brief Set forced language options.
623 /// Apply changes to the target information with respect to certain
624 /// language options which change the target configuration.
625 virtual void setForcedLangOptions(LangOptions &Opts);
627 /// \brief Get the default set of target features for the CPU;
628 /// this should include all legal feature strings on the target.
629 virtual void getDefaultFeatures(llvm::StringMap<bool> &Features) const {
632 /// \brief Get the ABI currently in use.
633 virtual const char *getABI() const {
637 /// \brief Get the C++ ABI currently in use.
638 TargetCXXABI getCXXABI() const {
642 /// \brief Target the specified CPU.
644 /// \return False on error (invalid CPU name).
645 virtual bool setCPU(const std::string &Name) {
649 /// \brief Use the specified ABI.
651 /// \return False on error (invalid ABI name).
652 virtual bool setABI(const std::string &Name) {
656 /// \brief Use this specified C++ ABI.
658 /// \return False on error (invalid C++ ABI name).
659 bool setCXXABI(llvm::StringRef name) {
661 if (!ABI.tryParse(name)) return false;
662 return setCXXABI(ABI);
665 /// \brief Set the C++ ABI to be used by this implementation.
667 /// \return False on error (ABI not valid on this target)
668 virtual bool setCXXABI(TargetCXXABI ABI) {
673 /// \brief Enable or disable a specific target feature;
674 /// the feature name must be valid.
676 /// \return False on error (invalid feature name).
677 virtual bool setFeatureEnabled(llvm::StringMap<bool> &Features,
679 bool Enabled) const {
683 /// \brief Perform initialization based on the user configured
684 /// set of features (e.g., +sse4).
686 /// The list is guaranteed to have at most one entry per feature.
688 /// The target may modify the features list, to change which options are
689 /// passed onwards to the backend.
690 virtual void HandleTargetFeatures(std::vector<std::string> &Features) {
693 /// \brief Determine whether the given target has the given feature.
694 virtual bool hasFeature(StringRef Feature) const {
698 // \brief Returns maximal number of args passed in registers.
699 unsigned getRegParmMax() const {
700 assert(RegParmMax < 7 && "RegParmMax value is larger than AST can handle");
704 /// \brief Whether the target supports thread-local storage.
705 bool isTLSSupported() const {
709 /// \brief Return true if {|} are normal characters in the asm string.
711 /// If this returns false (the default), then {abc|xyz} is syntax
712 /// that says that when compiling for asm variant #0, "abc" should be
713 /// generated, but when compiling for asm variant #1, "xyz" should be
715 bool hasNoAsmVariants() const {
716 return NoAsmVariants;
719 /// \brief Return the register number that __builtin_eh_return_regno would
720 /// return with the specified argument.
721 virtual int getEHDataRegisterNumber(unsigned RegNo) const {
725 /// \brief Return the section to use for C++ static initialization functions.
726 virtual const char *getStaticInitSectionSpecifier() const {
730 const LangAS::Map &getAddressSpaceMap() const {
731 return *AddrSpaceMap;
734 /// \brief Retrieve the name of the platform as it is used in the
735 /// availability attribute.
736 StringRef getPlatformName() const { return PlatformName; }
738 /// \brief Retrieve the minimum desired version of the platform, to
739 /// which the program should be compiled.
740 VersionTuple getPlatformMinVersion() const { return PlatformMinVersion; }
742 bool isBigEndian() const { return BigEndian; }
744 enum CallingConvMethodType {
750 /// \brief Gets the default calling convention for the given target and
751 /// declaration context.
752 virtual CallingConv getDefaultCallingConv(CallingConvMethodType MT) const {
753 // Not all targets will specify an explicit calling convention that we can
754 // express. This will always do the right thing, even though it's not
755 // an explicit calling convention.
759 enum CallingConvCheckResult {
764 /// \brief Determines whether a given calling convention is valid for the
765 /// target. A calling convention can either be accepted, produce a warning
766 /// and be substituted with the default calling convention, or (someday)
767 /// produce an error (such as using thiscall on a non-instance function).
768 virtual CallingConvCheckResult checkCallingConvention(CallingConv CC) const {
779 virtual uint64_t getPointerWidthV(unsigned AddrSpace) const {
782 virtual uint64_t getPointerAlignV(unsigned AddrSpace) const {
785 virtual enum IntType getPtrDiffTypeV(unsigned AddrSpace) const {
788 virtual void getGCCRegNames(const char * const *&Names,
789 unsigned &NumNames) const = 0;
790 virtual void getGCCRegAliases(const GCCRegAlias *&Aliases,
791 unsigned &NumAliases) const = 0;
792 virtual void getGCCAddlRegNames(const AddlRegName *&Addl,
793 unsigned &NumAddl) const {
797 virtual bool validateAsmConstraint(const char *&Name,
798 TargetInfo::ConstraintInfo &info) const= 0;
801 } // end namespace clang