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 MaxAtomicPromoteWidth, MaxAtomicInlineWidth;
70 unsigned short MaxVectorAlign;
71 const char *DescriptionString;
72 const char *UserLabelPrefix;
73 const char *MCountName;
74 const llvm::fltSemantics *HalfFormat, *FloatFormat, *DoubleFormat,
76 unsigned char RegParmMax, SSERegParmMax;
77 TargetCXXABI TheCXXABI;
78 const LangAS::Map *AddrSpaceMap;
80 mutable StringRef PlatformName;
81 mutable VersionTuple PlatformMinVersion;
83 unsigned HasAlignMac68kSupport : 1;
84 unsigned RealTypeUsesObjCFPRet : 3;
85 unsigned ComplexLongDoubleUsesFP2Ret : 1;
87 // TargetInfo Constructor. Default initializes all fields.
88 TargetInfo(const std::string &T);
91 /// \brief Construct a target for the given options.
93 /// \param Opts - The options to use to initialize the target. The target may
94 /// modify the options to canonicalize the target feature information to match
95 /// what the backend expects.
96 static TargetInfo* CreateTargetInfo(DiagnosticsEngine &Diags,
99 virtual ~TargetInfo();
101 /// \brief Retrieve the target options.
102 TargetOptions &getTargetOpts() const {
103 assert(TargetOpts && "Missing target options");
107 void setTargetOpts(TargetOptions *TargetOpts) {
108 this->TargetOpts = TargetOpts;
111 ///===---- Target Data Type Query Methods -------------------------------===//
130 /// \brief The different kinds of __builtin_va_list types defined by
131 /// the target implementation.
132 enum BuiltinVaListKind {
133 /// typedef char* __builtin_va_list;
134 CharPtrBuiltinVaList = 0,
136 /// typedef void* __builtin_va_list;
137 VoidPtrBuiltinVaList,
139 /// __builtin_va_list as defind by the AArch64 ABI
140 /// http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055a/IHI0055A_aapcs64.pdf
141 AArch64ABIBuiltinVaList,
143 /// __builtin_va_list as defined by the PNaCl ABI:
144 /// http://www.chromium.org/nativeclient/pnacl/bitcode-abi#TOC-Machine-Types
145 PNaClABIBuiltinVaList,
147 /// __builtin_va_list as defined by the Power ABI:
148 /// https://www.power.org
149 /// /resources/downloads/Power-Arch-32-bit-ABI-supp-1.0-Embedded.pdf
150 PowerABIBuiltinVaList,
152 /// __builtin_va_list as defined by the x86-64 ABI:
153 /// http://www.x86-64.org/documentation/abi.pdf
154 X86_64ABIBuiltinVaList,
156 /// __builtin_va_list as defined by ARM AAPCS ABI
157 /// http://infocenter.arm.com
158 // /help/topic/com.arm.doc.ihi0042d/IHI0042D_aapcs.pdf
159 AAPCSABIBuiltinVaList
163 IntType SizeType, IntMaxType, UIntMaxType, PtrDiffType, IntPtrType, WCharType,
164 WIntType, Char16Type, Char32Type, Int64Type, SigAtomicType,
167 /// \brief Whether Objective-C's built-in boolean type should be signed char.
169 /// Otherwise, when this flag is not set, the normal built-in boolean type is
171 unsigned UseSignedCharForObjCBool : 1;
173 /// Control whether the alignment of bit-field types is respected when laying
174 /// out structures. If true, then the alignment of the bit-field type will be
175 /// used to (a) impact the alignment of the containing structure, and (b)
176 /// ensure that the individual bit-field will not straddle an alignment
178 unsigned UseBitFieldTypeAlignment : 1;
180 /// \brief Whether zero length bitfields (e.g., int : 0;) force alignment of
181 /// the next bitfield.
183 /// If the alignment of the zero length bitfield is greater than the member
184 /// that follows it, `bar', `bar' will be aligned as the type of the
185 /// zero-length bitfield.
186 unsigned UseZeroLengthBitfieldAlignment : 1;
188 /// If non-zero, specifies a fixed alignment value for bitfields that follow
189 /// zero length bitfield, regardless of the zero length bitfield type.
190 unsigned ZeroLengthBitfieldBoundary;
193 IntType getSizeType() const { return SizeType; }
194 IntType getIntMaxType() const { return IntMaxType; }
195 IntType getUIntMaxType() const { return UIntMaxType; }
196 IntType getPtrDiffType(unsigned AddrSpace) const {
197 return AddrSpace == 0 ? PtrDiffType : getPtrDiffTypeV(AddrSpace);
199 IntType getIntPtrType() const { return IntPtrType; }
200 IntType getWCharType() const { return WCharType; }
201 IntType getWIntType() const { return WIntType; }
202 IntType getChar16Type() const { return Char16Type; }
203 IntType getChar32Type() const { return Char32Type; }
204 IntType getInt64Type() const { return Int64Type; }
205 IntType getSigAtomicType() const { return SigAtomicType; }
206 IntType getProcessIDType() const { return ProcessIDType; }
208 /// \brief Return the width (in bits) of the specified integer type enum.
210 /// For example, SignedInt -> getIntWidth().
211 unsigned getTypeWidth(IntType T) const;
213 /// \brief Return the alignment (in bits) of the specified integer type enum.
215 /// For example, SignedInt -> getIntAlign().
216 unsigned getTypeAlign(IntType T) const;
218 /// \brief Returns true if the type is signed; false otherwise.
219 static bool isTypeSigned(IntType T);
221 /// \brief Return the width of pointers on this target, for the
222 /// specified address space.
223 uint64_t getPointerWidth(unsigned AddrSpace) const {
224 return AddrSpace == 0 ? PointerWidth : getPointerWidthV(AddrSpace);
226 uint64_t getPointerAlign(unsigned AddrSpace) const {
227 return AddrSpace == 0 ? PointerAlign : getPointerAlignV(AddrSpace);
230 /// \brief Return the size of '_Bool' and C++ 'bool' for this target, in bits.
231 unsigned getBoolWidth() const { return BoolWidth; }
233 /// \brief Return the alignment of '_Bool' and C++ 'bool' for this target.
234 unsigned getBoolAlign() const { return BoolAlign; }
236 unsigned getCharWidth() const { return 8; } // FIXME
237 unsigned getCharAlign() const { return 8; } // FIXME
239 /// \brief Return the size of 'signed short' and 'unsigned short' for this
241 unsigned getShortWidth() const { return 16; } // FIXME
243 /// \brief Return the alignment of 'signed short' and 'unsigned short' for
245 unsigned getShortAlign() const { return 16; } // FIXME
247 /// getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for
248 /// this target, in bits.
249 unsigned getIntWidth() const { return IntWidth; }
250 unsigned getIntAlign() const { return IntAlign; }
252 /// getLongWidth/Align - Return the size of 'signed long' and 'unsigned long'
253 /// for this target, in bits.
254 unsigned getLongWidth() const { return LongWidth; }
255 unsigned getLongAlign() const { return LongAlign; }
257 /// getLongLongWidth/Align - Return the size of 'signed long long' and
258 /// 'unsigned long long' for this target, in bits.
259 unsigned getLongLongWidth() const { return LongLongWidth; }
260 unsigned getLongLongAlign() const { return LongLongAlign; }
262 /// \brief Determine whether the __int128 type is supported on this target.
263 bool hasInt128Type() const { return getPointerWidth(0) >= 64; } // FIXME
265 /// \brief Return the alignment that is suitable for storing any
266 /// object with a fundamental alignment requirement.
267 unsigned getSuitableAlign() const { return SuitableAlign; }
269 /// getWCharWidth/Align - Return the size of 'wchar_t' for this target, in
271 unsigned getWCharWidth() const { return getTypeWidth(WCharType); }
272 unsigned getWCharAlign() const { return getTypeAlign(WCharType); }
274 /// getChar16Width/Align - Return the size of 'char16_t' for this target, in
276 unsigned getChar16Width() const { return getTypeWidth(Char16Type); }
277 unsigned getChar16Align() const { return getTypeAlign(Char16Type); }
279 /// getChar32Width/Align - Return the size of 'char32_t' for this target, in
281 unsigned getChar32Width() const { return getTypeWidth(Char32Type); }
282 unsigned getChar32Align() const { return getTypeAlign(Char32Type); }
284 /// getHalfWidth/Align/Format - Return the size/align/format of 'half'.
285 unsigned getHalfWidth() const { return HalfWidth; }
286 unsigned getHalfAlign() const { return HalfAlign; }
287 const llvm::fltSemantics &getHalfFormat() const { return *HalfFormat; }
289 /// getFloatWidth/Align/Format - Return the size/align/format of 'float'.
290 unsigned getFloatWidth() const { return FloatWidth; }
291 unsigned getFloatAlign() const { return FloatAlign; }
292 const llvm::fltSemantics &getFloatFormat() const { return *FloatFormat; }
294 /// getDoubleWidth/Align/Format - Return the size/align/format of 'double'.
295 unsigned getDoubleWidth() const { return DoubleWidth; }
296 unsigned getDoubleAlign() const { return DoubleAlign; }
297 const llvm::fltSemantics &getDoubleFormat() const { return *DoubleFormat; }
299 /// getLongDoubleWidth/Align/Format - Return the size/align/format of 'long
301 unsigned getLongDoubleWidth() const { return LongDoubleWidth; }
302 unsigned getLongDoubleAlign() const { return LongDoubleAlign; }
303 const llvm::fltSemantics &getLongDoubleFormat() const {
304 return *LongDoubleFormat;
307 /// \brief Return the value for the C99 FLT_EVAL_METHOD macro.
308 virtual unsigned getFloatEvalMethod() const { return 0; }
310 // getLargeArrayMinWidth/Align - Return the minimum array size that is
311 // 'large' and its alignment.
312 unsigned getLargeArrayMinWidth() const { return LargeArrayMinWidth; }
313 unsigned getLargeArrayAlign() const { return LargeArrayAlign; }
315 /// \brief Return the maximum width lock-free atomic operation which will
316 /// ever be supported for the given target
317 unsigned getMaxAtomicPromoteWidth() const { return MaxAtomicPromoteWidth; }
318 /// \brief Return the maximum width lock-free atomic operation which can be
319 /// inlined given the supported features of the given target.
320 unsigned getMaxAtomicInlineWidth() const { return MaxAtomicInlineWidth; }
322 /// \brief Return the maximum vector alignment supported for the given target.
323 unsigned getMaxVectorAlign() const { return MaxVectorAlign; }
325 /// \brief Return the size of intmax_t and uintmax_t for this target, in bits.
326 unsigned getIntMaxTWidth() const {
327 return getTypeWidth(IntMaxType);
330 // Return the size of unwind_word for this target.
331 unsigned getUnwindWordWidth() const { return getPointerWidth(0); }
333 /// \brief Return the "preferred" register width on this target.
334 uint64_t getRegisterWidth() const {
335 // Currently we assume the register width on the target matches the pointer
336 // width, we can introduce a new variable for this if/when some target wants
341 /// \brief Returns the default value of the __USER_LABEL_PREFIX__ macro,
342 /// which is the prefix given to user symbols by default.
344 /// On most platforms this is "_", but it is "" on some, and "." on others.
345 const char *getUserLabelPrefix() const {
346 return UserLabelPrefix;
349 /// \brief Returns the name of the mcount instrumentation function.
350 const char *getMCountName() const {
354 /// \brief Check if the Objective-C built-in boolean type should be signed
357 /// Otherwise, if this returns false, the normal built-in boolean type
358 /// should also be used for Objective-C.
359 bool useSignedCharForObjCBool() const {
360 return UseSignedCharForObjCBool;
362 void noSignedCharForObjCBool() {
363 UseSignedCharForObjCBool = false;
366 /// \brief Check whether the alignment of bit-field types is respected
367 /// when laying out structures.
368 bool useBitFieldTypeAlignment() const {
369 return UseBitFieldTypeAlignment;
372 /// \brief Check whether zero length bitfields should force alignment of
374 bool useZeroLengthBitfieldAlignment() const {
375 return UseZeroLengthBitfieldAlignment;
378 /// \brief Get the fixed alignment value in bits for a member that follows
379 /// a zero length bitfield.
380 unsigned getZeroLengthBitfieldBoundary() const {
381 return ZeroLengthBitfieldBoundary;
384 /// \brief Check whether this target support '\#pragma options align=mac68k'.
385 bool hasAlignMac68kSupport() const {
386 return HasAlignMac68kSupport;
389 /// \brief Return the user string for the specified integer type enum.
391 /// For example, SignedShort -> "short".
392 static const char *getTypeName(IntType T);
394 /// \brief Return the constant suffix for the specified integer type enum.
396 /// For example, SignedLong -> "L".
397 static const char *getTypeConstantSuffix(IntType T);
399 /// \brief Check whether the given real type should use the "fpret" flavor of
400 /// Objective-C message passing on this target.
401 bool useObjCFPRetForRealType(RealType T) const {
402 return RealTypeUsesObjCFPRet & (1 << T);
405 /// \brief Check whether _Complex long double should use the "fp2ret" flavor
406 /// of Objective-C message passing on this target.
407 bool useObjCFP2RetForComplexLongDouble() const {
408 return ComplexLongDoubleUsesFP2Ret;
411 ///===---- Other target property query methods --------------------------===//
413 /// \brief Appends the target-specific \#define values for this
414 /// target set to the specified buffer.
415 virtual void getTargetDefines(const LangOptions &Opts,
416 MacroBuilder &Builder) const = 0;
419 /// Return information about target-specific builtins for
420 /// the current primary target, and info about which builtins are non-portable
421 /// across the current set of primary and secondary targets.
422 virtual void getTargetBuiltins(const Builtin::Info *&Records,
423 unsigned &NumRecords) const = 0;
425 /// The __builtin_clz* and __builtin_ctz* built-in
426 /// functions are specified to have undefined results for zero inputs, but
427 /// on targets that support these operations in a way that provides
428 /// well-defined results for zero without loss of performance, it is a good
429 /// idea to avoid optimizing based on that undef behavior.
430 virtual bool isCLZForZeroUndef() const { return true; }
432 /// \brief Returns the kind of __builtin_va_list type that should be used
433 /// with this target.
434 virtual BuiltinVaListKind getBuiltinVaListKind() const = 0;
436 /// \brief Returns whether the passed in string is a valid clobber in an
437 /// inline asm statement.
439 /// This is used by Sema.
440 bool isValidClobber(StringRef Name) const;
442 /// \brief Returns whether the passed in string is a valid register name
443 /// according to GCC.
445 /// This is used by Sema for inline asm statements.
446 bool isValidGCCRegisterName(StringRef Name) const;
448 /// \brief Returns the "normalized" GCC register name.
450 /// For example, on x86 it will return "ax" when "eax" is passed in.
451 StringRef getNormalizedGCCRegisterName(StringRef Name) const;
453 struct ConstraintInfo {
456 CI_AllowsMemory = 0x01,
457 CI_AllowsRegister = 0x02,
458 CI_ReadWrite = 0x04, // "+r" output constraint (read and write).
459 CI_HasMatchingInput = 0x08 // This output operand has a matching input.
464 std::string ConstraintStr; // constraint: "=rm"
465 std::string Name; // Operand name: [foo] with no []'s.
467 ConstraintInfo(StringRef ConstraintStr, StringRef Name)
468 : Flags(0), TiedOperand(-1), ConstraintStr(ConstraintStr.str()),
471 const std::string &getConstraintStr() const { return ConstraintStr; }
472 const std::string &getName() const { return Name; }
473 bool isReadWrite() const { return (Flags & CI_ReadWrite) != 0; }
474 bool allowsRegister() const { return (Flags & CI_AllowsRegister) != 0; }
475 bool allowsMemory() const { return (Flags & CI_AllowsMemory) != 0; }
477 /// \brief Return true if this output operand has a matching
478 /// (tied) input operand.
479 bool hasMatchingInput() const { return (Flags & CI_HasMatchingInput) != 0; }
481 /// \brief Return true if this input operand is a matching
482 /// constraint that ties it to an output operand.
484 /// If this returns true then getTiedOperand will indicate which output
485 /// operand this is tied to.
486 bool hasTiedOperand() const { return TiedOperand != -1; }
487 unsigned getTiedOperand() const {
488 assert(hasTiedOperand() && "Has no tied operand!");
489 return (unsigned)TiedOperand;
492 void setIsReadWrite() { Flags |= CI_ReadWrite; }
493 void setAllowsMemory() { Flags |= CI_AllowsMemory; }
494 void setAllowsRegister() { Flags |= CI_AllowsRegister; }
495 void setHasMatchingInput() { Flags |= CI_HasMatchingInput; }
497 /// \brief Indicate that this is an input operand that is tied to
498 /// the specified output operand.
500 /// Copy over the various constraint information from the output.
501 void setTiedOperand(unsigned N, ConstraintInfo &Output) {
502 Output.setHasMatchingInput();
503 Flags = Output.Flags;
505 // Don't copy Name or constraint string.
509 // validateOutputConstraint, validateInputConstraint - Checks that
510 // a constraint is valid and provides information about it.
511 // FIXME: These should return a real error instead of just true/false.
512 bool validateOutputConstraint(ConstraintInfo &Info) const;
513 bool validateInputConstraint(ConstraintInfo *OutputConstraints,
515 ConstraintInfo &info) const;
516 virtual bool validateInputSize(StringRef /*Constraint*/,
517 unsigned /*Size*/) const {
520 virtual bool validateConstraintModifier(StringRef /*Constraint*/,
521 const char /*Modifier*/,
522 unsigned /*Size*/) const {
525 bool resolveSymbolicName(const char *&Name,
526 ConstraintInfo *OutputConstraints,
527 unsigned NumOutputs, unsigned &Index) const;
529 // Constraint parm will be left pointing at the last character of
530 // the constraint. In practice, it won't be changed unless the
531 // constraint is longer than one character.
532 virtual std::string convertConstraint(const char *&Constraint) const {
533 // 'p' defaults to 'r', but can be overridden by targets.
534 if (*Constraint == 'p')
535 return std::string("r");
536 return std::string(1, *Constraint);
539 /// \brief Returns a string of target-specific clobbers, in LLVM format.
540 virtual const char *getClobbers() const = 0;
543 /// \brief Returns the target triple of the primary target.
544 const llvm::Triple &getTriple() const {
548 const char *getTargetDescription() const {
549 return DescriptionString;
553 const char * const Aliases[5];
554 const char * const Register;
558 const char * const Names[5];
559 const unsigned RegNum;
562 /// \brief Does this target support "protected" visibility?
564 /// Any target which dynamic libraries will naturally support
565 /// something like "default" (meaning that the symbol is visible
566 /// outside this shared object) and "hidden" (meaning that it isn't)
567 /// visibilities, but "protected" is really an ELF-specific concept
568 /// with weird semantics designed around the convenience of dynamic
569 /// linker implementations. Which is not to suggest that there's
570 /// consistent target-independent semantics for "default" visibility
571 /// either; the entire thing is pretty badly mangled.
572 virtual bool hasProtectedVisibility() const { return true; }
574 /// \brief Return the section to use for CFString literals, or 0 if no
575 /// special section is used.
576 virtual const char *getCFStringSection() const {
577 return "__DATA,__cfstring";
580 /// \brief Return the section to use for NSString literals, or 0 if no
581 /// special section is used.
582 virtual const char *getNSStringSection() const {
583 return "__OBJC,__cstring_object,regular,no_dead_strip";
586 /// \brief Return the section to use for NSString literals, or 0 if no
587 /// special section is used (NonFragile ABI).
588 virtual const char *getNSStringNonFragileABISection() const {
589 return "__DATA, __objc_stringobj, regular, no_dead_strip";
592 /// \brief An optional hook that targets can implement to perform semantic
593 /// checking on attribute((section("foo"))) specifiers.
595 /// In this case, "foo" is passed in to be checked. If the section
596 /// specifier is invalid, the backend should return a non-empty string
597 /// that indicates the problem.
599 /// This hook is a simple quality of implementation feature to catch errors
600 /// and give good diagnostics in cases when the assembler or code generator
601 /// would otherwise reject the section specifier.
603 virtual std::string isValidSectionSpecifier(StringRef SR) const {
607 /// \brief Set forced language options.
609 /// Apply changes to the target information with respect to certain
610 /// language options which change the target configuration.
611 virtual void setForcedLangOptions(LangOptions &Opts);
613 /// \brief Get the default set of target features for the CPU;
614 /// this should include all legal feature strings on the target.
615 virtual void getDefaultFeatures(llvm::StringMap<bool> &Features) const {
618 /// \brief Get the ABI currently in use.
619 virtual const char *getABI() const {
623 /// \brief Get the C++ ABI currently in use.
624 TargetCXXABI getCXXABI() const {
628 /// \brief Target the specified CPU.
630 /// \return False on error (invalid CPU name).
631 virtual bool setCPU(const std::string &Name) {
635 /// \brief Use the specified ABI.
637 /// \return False on error (invalid ABI name).
638 virtual bool setABI(const std::string &Name) {
642 /// \brief Use this specified C++ ABI.
644 /// \return False on error (invalid C++ ABI name).
645 bool setCXXABI(llvm::StringRef name) {
647 if (!ABI.tryParse(name)) return false;
648 return setCXXABI(ABI);
651 /// \brief Set the C++ ABI to be used by this implementation.
653 /// \return False on error (ABI not valid on this target)
654 virtual bool setCXXABI(TargetCXXABI ABI) {
659 /// \brief Enable or disable a specific target feature;
660 /// the feature name must be valid.
662 /// \return False on error (invalid feature name).
663 virtual bool setFeatureEnabled(llvm::StringMap<bool> &Features,
665 bool Enabled) const {
669 /// \brief Perform initialization based on the user configured
670 /// set of features (e.g., +sse4).
672 /// The list is guaranteed to have at most one entry per feature.
674 /// The target may modify the features list, to change which options are
675 /// passed onwards to the backend.
676 virtual void HandleTargetFeatures(std::vector<std::string> &Features) {
679 /// \brief Determine whether the given target has the given feature.
680 virtual bool hasFeature(StringRef Feature) const {
684 // \brief Returns maximal number of args passed in registers.
685 unsigned getRegParmMax() const {
686 assert(RegParmMax < 7 && "RegParmMax value is larger than AST can handle");
690 /// \brief Whether the target supports thread-local storage.
691 bool isTLSSupported() const {
695 /// \brief Return true if {|} are normal characters in the asm string.
697 /// If this returns false (the default), then {abc|xyz} is syntax
698 /// that says that when compiling for asm variant #0, "abc" should be
699 /// generated, but when compiling for asm variant #1, "xyz" should be
701 bool hasNoAsmVariants() const {
702 return NoAsmVariants;
705 /// \brief Return the register number that __builtin_eh_return_regno would
706 /// return with the specified argument.
707 virtual int getEHDataRegisterNumber(unsigned RegNo) const {
711 /// \brief Return the section to use for C++ static initialization functions.
712 virtual const char *getStaticInitSectionSpecifier() const {
716 const LangAS::Map &getAddressSpaceMap() const {
717 return *AddrSpaceMap;
720 /// \brief Retrieve the name of the platform as it is used in the
721 /// availability attribute.
722 StringRef getPlatformName() const { return PlatformName; }
724 /// \brief Retrieve the minimum desired version of the platform, to
725 /// which the program should be compiled.
726 VersionTuple getPlatformMinVersion() const { return PlatformMinVersion; }
728 bool isBigEndian() const { return BigEndian; }
730 enum CallingConvMethodType {
736 /// \brief Gets the default calling convention for the given target and
737 /// declaration context.
738 virtual CallingConv getDefaultCallingConv(CallingConvMethodType MT) const {
739 // Not all targets will specify an explicit calling convention that we can
740 // express. This will always do the right thing, even though it's not
741 // an explicit calling convention.
745 enum CallingConvCheckResult {
750 /// \brief Determines whether a given calling convention is valid for the
751 /// target. A calling convention can either be accepted, produce a warning
752 /// and be substituted with the default calling convention, or (someday)
753 /// produce an error (such as using thiscall on a non-instance function).
754 virtual CallingConvCheckResult checkCallingConvention(CallingConv CC) const {
765 virtual uint64_t getPointerWidthV(unsigned AddrSpace) const {
768 virtual uint64_t getPointerAlignV(unsigned AddrSpace) const {
771 virtual enum IntType getPtrDiffTypeV(unsigned AddrSpace) const {
774 virtual void getGCCRegNames(const char * const *&Names,
775 unsigned &NumNames) const = 0;
776 virtual void getGCCRegAliases(const GCCRegAlias *&Aliases,
777 unsigned &NumAliases) const = 0;
778 virtual void getGCCAddlRegNames(const AddlRegName *&Addl,
779 unsigned &NumAddl) const {
783 virtual bool validateAsmConstraint(const char *&Name,
784 TargetInfo::ConstraintInfo &info) const= 0;
787 } // end namespace clang