Home | History | Annotate | Download | only in Basic
      1 //===--- TargetInfo.h - Expose information about the target -----*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 //
     10 //  This file defines the TargetInfo interface.
     11 //
     12 //===----------------------------------------------------------------------===//
     13 
     14 #ifndef LLVM_CLANG_BASIC_TARGETINFO_H
     15 #define LLVM_CLANG_BASIC_TARGETINFO_H
     16 
     17 #include "clang/Basic/LLVM.h"
     18 #include "llvm/ADT/IntrusiveRefCntPtr.h"
     19 #include "llvm/ADT/StringMap.h"
     20 #include "llvm/ADT/StringRef.h"
     21 #include "llvm/ADT/StringSwitch.h"
     22 #include "llvm/ADT/Triple.h"
     23 #include "llvm/Support/DataTypes.h"
     24 #include "clang/Basic/AddressSpaces.h"
     25 #include "clang/Basic/VersionTuple.h"
     26 #include <cassert>
     27 #include <vector>
     28 #include <string>
     29 
     30 namespace llvm {
     31 struct fltSemantics;
     32 }
     33 
     34 namespace clang {
     35 class DiagnosticsEngine;
     36 class LangOptions;
     37 class MacroBuilder;
     38 class SourceLocation;
     39 class SourceManager;
     40 class TargetOptions;
     41 
     42 namespace Builtin { struct Info; }
     43 
     44 /// TargetCXXABI - The types of C++ ABIs for which we can generate code.
     45 enum TargetCXXABI {
     46   /// The generic ("Itanium") C++ ABI, documented at:
     47   ///   http://www.codesourcery.com/public/cxx-abi/
     48   CXXABI_Itanium,
     49 
     50   /// The ARM C++ ABI, based largely on the Itanium ABI but with
     51   /// significant differences.
     52   ///    http://infocenter.arm.com
     53   ///                    /help/topic/com.arm.doc.ihi0041c/IHI0041C_cppabi.pdf
     54   CXXABI_ARM,
     55 
     56   /// The Visual Studio ABI.  Only scattered official documentation exists.
     57   CXXABI_Microsoft
     58 };
     59 
     60 /// TargetInfo - This class exposes information about the current target.
     61 ///
     62 class TargetInfo : public llvm::RefCountedBase<TargetInfo> {
     63   llvm::Triple Triple;
     64 protected:
     65   // Target values set by the ctor of the actual target implementation.  Default
     66   // values are specified by the TargetInfo constructor.
     67   bool TLSSupported;
     68   bool NoAsmVariants;  // True if {|} are normal characters.
     69   unsigned char PointerWidth, PointerAlign;
     70   unsigned char BoolWidth, BoolAlign;
     71   unsigned char IntWidth, IntAlign;
     72   unsigned char HalfWidth, HalfAlign;
     73   unsigned char FloatWidth, FloatAlign;
     74   unsigned char DoubleWidth, DoubleAlign;
     75   unsigned char LongDoubleWidth, LongDoubleAlign;
     76   unsigned char LargeArrayMinWidth, LargeArrayAlign;
     77   unsigned char LongWidth, LongAlign;
     78   unsigned char LongLongWidth, LongLongAlign;
     79   unsigned char MaxAtomicPromoteWidth, MaxAtomicInlineWidth;
     80   const char *DescriptionString;
     81   const char *UserLabelPrefix;
     82   const char *MCountName;
     83   const llvm::fltSemantics *HalfFormat, *FloatFormat, *DoubleFormat,
     84     *LongDoubleFormat;
     85   unsigned char RegParmMax, SSERegParmMax;
     86   TargetCXXABI CXXABI;
     87   const LangAS::Map *AddrSpaceMap;
     88 
     89   mutable StringRef PlatformName;
     90   mutable VersionTuple PlatformMinVersion;
     91 
     92   unsigned HasAlignMac68kSupport : 1;
     93   unsigned RealTypeUsesObjCFPRet : 3;
     94 
     95   // TargetInfo Constructor.  Default initializes all fields.
     96   TargetInfo(const std::string &T);
     97 
     98 public:
     99   /// CreateTargetInfo - Construct a target for the given options.
    100   ///
    101   /// \param Opts - The options to use to initialize the target. The target may
    102   /// modify the options to canonicalize the target feature information to match
    103   /// what the backend expects.
    104   static TargetInfo* CreateTargetInfo(DiagnosticsEngine &Diags,
    105                                       TargetOptions &Opts);
    106 
    107   virtual ~TargetInfo();
    108 
    109   ///===---- Target Data Type Query Methods -------------------------------===//
    110   enum IntType {
    111     NoInt = 0,
    112     SignedShort,
    113     UnsignedShort,
    114     SignedInt,
    115     UnsignedInt,
    116     SignedLong,
    117     UnsignedLong,
    118     SignedLongLong,
    119     UnsignedLongLong
    120   };
    121 
    122   enum RealType {
    123     Float = 0,
    124     Double,
    125     LongDouble
    126   };
    127 
    128 protected:
    129   IntType SizeType, IntMaxType, UIntMaxType, PtrDiffType, IntPtrType, WCharType,
    130           WIntType, Char16Type, Char32Type, Int64Type, SigAtomicType;
    131 
    132   /// Control whether the alignment of bit-field types is respected when laying
    133   /// out structures. If true, then the alignment of the bit-field type will be
    134   /// used to (a) impact the alignment of the containing structure, and (b)
    135   /// ensure that the individual bit-field will not straddle an alignment
    136   /// boundary.
    137   unsigned UseBitFieldTypeAlignment : 1;
    138 
    139   /// Control whether zero length bitfields (e.g., int : 0;) force alignment of
    140   /// the next bitfield.  If the alignment of the zero length bitfield is
    141   /// greater than the member that follows it, `bar', `bar' will be aligned as
    142   /// the type of the zero-length bitfield.
    143   unsigned UseZeroLengthBitfieldAlignment : 1;
    144 
    145   /// If non-zero, specifies a fixed alignment value for bitfields that follow
    146   /// zero length bitfield, regardless of the zero length bitfield type.
    147   unsigned ZeroLengthBitfieldBoundary;
    148 
    149 public:
    150   IntType getSizeType() const { return SizeType; }
    151   IntType getIntMaxType() const { return IntMaxType; }
    152   IntType getUIntMaxType() const { return UIntMaxType; }
    153   IntType getPtrDiffType(unsigned AddrSpace) const {
    154     return AddrSpace == 0 ? PtrDiffType : getPtrDiffTypeV(AddrSpace);
    155   }
    156   IntType getIntPtrType() const { return IntPtrType; }
    157   IntType getWCharType() const { return WCharType; }
    158   IntType getWIntType() const { return WIntType; }
    159   IntType getChar16Type() const { return Char16Type; }
    160   IntType getChar32Type() const { return Char32Type; }
    161   IntType getInt64Type() const { return Int64Type; }
    162   IntType getSigAtomicType() const { return SigAtomicType; }
    163 
    164 
    165   /// getTypeWidth - Return the width (in bits) of the specified integer type
    166   /// enum. For example, SignedInt -> getIntWidth().
    167   unsigned getTypeWidth(IntType T) const;
    168 
    169   /// getTypeAlign - Return the alignment (in bits) of the specified integer
    170   /// type enum. For example, SignedInt -> getIntAlign().
    171   unsigned getTypeAlign(IntType T) const;
    172 
    173   /// isTypeSigned - Return whether an integer types is signed. Returns true if
    174   /// the type is signed; false otherwise.
    175   static bool isTypeSigned(IntType T);
    176 
    177   /// getPointerWidth - Return the width of pointers on this target, for the
    178   /// specified address space.
    179   uint64_t getPointerWidth(unsigned AddrSpace) const {
    180     return AddrSpace == 0 ? PointerWidth : getPointerWidthV(AddrSpace);
    181   }
    182   uint64_t getPointerAlign(unsigned AddrSpace) const {
    183     return AddrSpace == 0 ? PointerAlign : getPointerAlignV(AddrSpace);
    184   }
    185 
    186   /// getBoolWidth/Align - Return the size of '_Bool' and C++ 'bool' for this
    187   /// target, in bits.
    188   unsigned getBoolWidth() const { return BoolWidth; }
    189   unsigned getBoolAlign() const { return BoolAlign; }
    190 
    191   unsigned getCharWidth() const { return 8; } // FIXME
    192   unsigned getCharAlign() const { return 8; } // FIXME
    193 
    194   /// getShortWidth/Align - Return the size of 'signed short' and
    195   /// 'unsigned short' for this target, in bits.
    196   unsigned getShortWidth() const { return 16; } // FIXME
    197   unsigned getShortAlign() const { return 16; } // FIXME
    198 
    199   /// getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for
    200   /// this target, in bits.
    201   unsigned getIntWidth() const { return IntWidth; }
    202   unsigned getIntAlign() const { return IntAlign; }
    203 
    204   /// getLongWidth/Align - Return the size of 'signed long' and 'unsigned long'
    205   /// for this target, in bits.
    206   unsigned getLongWidth() const { return LongWidth; }
    207   unsigned getLongAlign() const { return LongAlign; }
    208 
    209   /// getLongLongWidth/Align - Return the size of 'signed long long' and
    210   /// 'unsigned long long' for this target, in bits.
    211   unsigned getLongLongWidth() const { return LongLongWidth; }
    212   unsigned getLongLongAlign() const { return LongLongAlign; }
    213 
    214   /// getWCharWidth/Align - Return the size of 'wchar_t' for this target, in
    215   /// bits.
    216   unsigned getWCharWidth() const { return getTypeWidth(WCharType); }
    217   unsigned getWCharAlign() const { return getTypeAlign(WCharType); }
    218 
    219   /// getChar16Width/Align - Return the size of 'char16_t' for this target, in
    220   /// bits.
    221   unsigned getChar16Width() const { return getTypeWidth(Char16Type); }
    222   unsigned getChar16Align() const { return getTypeAlign(Char16Type); }
    223 
    224   /// getChar32Width/Align - Return the size of 'char32_t' for this target, in
    225   /// bits.
    226   unsigned getChar32Width() const { return getTypeWidth(Char32Type); }
    227   unsigned getChar32Align() const { return getTypeAlign(Char32Type); }
    228 
    229   /// getHalfWidth/Align/Format - Return the size/align/format of 'half'.
    230   unsigned getHalfWidth() const { return HalfWidth; }
    231   unsigned getHalfAlign() const { return HalfAlign; }
    232   const llvm::fltSemantics &getHalfFormat() const { return *HalfFormat; }
    233 
    234   /// getFloatWidth/Align/Format - Return the size/align/format of 'float'.
    235   unsigned getFloatWidth() const { return FloatWidth; }
    236   unsigned getFloatAlign() const { return FloatAlign; }
    237   const llvm::fltSemantics &getFloatFormat() const { return *FloatFormat; }
    238 
    239   /// getDoubleWidth/Align/Format - Return the size/align/format of 'double'.
    240   unsigned getDoubleWidth() const { return DoubleWidth; }
    241   unsigned getDoubleAlign() const { return DoubleAlign; }
    242   const llvm::fltSemantics &getDoubleFormat() const { return *DoubleFormat; }
    243 
    244   /// getLongDoubleWidth/Align/Format - Return the size/align/format of 'long
    245   /// double'.
    246   unsigned getLongDoubleWidth() const { return LongDoubleWidth; }
    247   unsigned getLongDoubleAlign() const { return LongDoubleAlign; }
    248   const llvm::fltSemantics &getLongDoubleFormat() const {
    249     return *LongDoubleFormat;
    250   }
    251 
    252   // getLargeArrayMinWidth/Align - Return the minimum array size that is
    253   // 'large' and its alignment.
    254   unsigned getLargeArrayMinWidth() const { return LargeArrayMinWidth; }
    255   unsigned getLargeArrayAlign() const { return LargeArrayAlign; }
    256 
    257   /// getMaxAtomicPromoteWidth - Return the maximum width lock-free atomic
    258   /// operation which will ever be supported for the given target
    259   unsigned getMaxAtomicPromoteWidth() const { return MaxAtomicPromoteWidth; }
    260   /// getMaxAtomicInlineWidth - Return the maximum width lock-free atomic
    261   /// operation which can be inlined given the supported features of the
    262   /// given target.
    263   unsigned getMaxAtomicInlineWidth() const { return MaxAtomicInlineWidth; }
    264 
    265   /// getIntMaxTWidth - Return the size of intmax_t and uintmax_t for this
    266   /// target, in bits.
    267   unsigned getIntMaxTWidth() const {
    268     return getTypeWidth(IntMaxType);
    269   }
    270 
    271   /// getRegisterWidth - Return the "preferred" register width on this target.
    272   uint64_t getRegisterWidth() const {
    273     // Currently we assume the register width on the target matches the pointer
    274     // width, we can introduce a new variable for this if/when some target wants
    275     // it.
    276     return LongWidth;
    277   }
    278 
    279   /// getUserLabelPrefix - This returns the default value of the
    280   /// __USER_LABEL_PREFIX__ macro, which is the prefix given to user symbols by
    281   /// default.  On most platforms this is "_", but it is "" on some, and "." on
    282   /// others.
    283   const char *getUserLabelPrefix() const {
    284     return UserLabelPrefix;
    285   }
    286 
    287   /// MCountName - This returns name of the mcount instrumentation function.
    288   const char *getMCountName() const {
    289     return MCountName;
    290   }
    291 
    292   /// useBitFieldTypeAlignment() - Check whether the alignment of bit-field
    293   /// types is respected when laying out structures.
    294   bool useBitFieldTypeAlignment() const {
    295     return UseBitFieldTypeAlignment;
    296   }
    297 
    298   /// useZeroLengthBitfieldAlignment() - Check whether zero length bitfields
    299   /// should force alignment of the next member.
    300   bool useZeroLengthBitfieldAlignment() const {
    301     return UseZeroLengthBitfieldAlignment;
    302   }
    303 
    304   /// getZeroLengthBitfieldBoundary() - Get the fixed alignment value in bits
    305   /// for a member that follows a zero length bitfield.
    306   unsigned getZeroLengthBitfieldBoundary() const {
    307     return ZeroLengthBitfieldBoundary;
    308   }
    309 
    310   /// hasAlignMac68kSupport - Check whether this target support '#pragma options
    311   /// align=mac68k'.
    312   bool hasAlignMac68kSupport() const {
    313     return HasAlignMac68kSupport;
    314   }
    315 
    316   /// getTypeName - Return the user string for the specified integer type enum.
    317   /// For example, SignedShort -> "short".
    318   static const char *getTypeName(IntType T);
    319 
    320   /// getTypeConstantSuffix - Return the constant suffix for the specified
    321   /// integer type enum. For example, SignedLong -> "L".
    322   static const char *getTypeConstantSuffix(IntType T);
    323 
    324   /// \brief Check whether the given real type should use the "fpret" flavor of
    325   /// Obj-C message passing on this target.
    326   bool useObjCFPRetForRealType(RealType T) const {
    327     return RealTypeUsesObjCFPRet & (1 << T);
    328   }
    329 
    330   ///===---- Other target property query methods --------------------------===//
    331 
    332   /// getTargetDefines - Appends the target-specific #define values for this
    333   /// target set to the specified buffer.
    334   virtual void getTargetDefines(const LangOptions &Opts,
    335                                 MacroBuilder &Builder) const = 0;
    336 
    337 
    338   /// getTargetBuiltins - Return information about target-specific builtins for
    339   /// the current primary target, and info about which builtins are non-portable
    340   /// across the current set of primary and secondary targets.
    341   virtual void getTargetBuiltins(const Builtin::Info *&Records,
    342                                  unsigned &NumRecords) const = 0;
    343 
    344   /// getVAListDeclaration - Return the declaration to use for
    345   /// __builtin_va_list, which is target-specific.
    346   virtual const char *getVAListDeclaration() const = 0;
    347 
    348   /// isValidClobber - Returns whether the passed in string is
    349   /// a valid clobber in an inline asm statement. This is used by
    350   /// Sema.
    351   bool isValidClobber(StringRef Name) const;
    352 
    353   /// isValidGCCRegisterName - Returns whether the passed in string
    354   /// is a valid register name according to GCC. This is used by Sema for
    355   /// inline asm statements.
    356   bool isValidGCCRegisterName(StringRef Name) const;
    357 
    358   // getNormalizedGCCRegisterName - Returns the "normalized" GCC register name.
    359   // For example, on x86 it will return "ax" when "eax" is passed in.
    360   StringRef getNormalizedGCCRegisterName(StringRef Name) const;
    361 
    362   struct ConstraintInfo {
    363     enum {
    364       CI_None = 0x00,
    365       CI_AllowsMemory = 0x01,
    366       CI_AllowsRegister = 0x02,
    367       CI_ReadWrite = 0x04,       // "+r" output constraint (read and write).
    368       CI_HasMatchingInput = 0x08 // This output operand has a matching input.
    369     };
    370     unsigned Flags;
    371     int TiedOperand;
    372 
    373     std::string ConstraintStr;  // constraint: "=rm"
    374     std::string Name;           // Operand name: [foo] with no []'s.
    375   public:
    376     ConstraintInfo(StringRef ConstraintStr, StringRef Name)
    377       : Flags(0), TiedOperand(-1), ConstraintStr(ConstraintStr.str()),
    378       Name(Name.str()) {}
    379 
    380     const std::string &getConstraintStr() const { return ConstraintStr; }
    381     const std::string &getName() const { return Name; }
    382     bool isReadWrite() const { return (Flags & CI_ReadWrite) != 0; }
    383     bool allowsRegister() const { return (Flags & CI_AllowsRegister) != 0; }
    384     bool allowsMemory() const { return (Flags & CI_AllowsMemory) != 0; }
    385 
    386     /// hasMatchingInput - Return true if this output operand has a matching
    387     /// (tied) input operand.
    388     bool hasMatchingInput() const { return (Flags & CI_HasMatchingInput) != 0; }
    389 
    390     /// hasTiedOperand() - Return true if this input operand is a matching
    391     /// constraint that ties it to an output operand.  If this returns true,
    392     /// then getTiedOperand will indicate which output operand this is tied to.
    393     bool hasTiedOperand() const { return TiedOperand != -1; }
    394     unsigned getTiedOperand() const {
    395       assert(hasTiedOperand() && "Has no tied operand!");
    396       return (unsigned)TiedOperand;
    397     }
    398 
    399     void setIsReadWrite() { Flags |= CI_ReadWrite; }
    400     void setAllowsMemory() { Flags |= CI_AllowsMemory; }
    401     void setAllowsRegister() { Flags |= CI_AllowsRegister; }
    402     void setHasMatchingInput() { Flags |= CI_HasMatchingInput; }
    403 
    404     /// setTiedOperand - Indicate that this is an input operand that is tied to
    405     /// the specified output operand.  Copy over the various constraint
    406     /// information from the output.
    407     void setTiedOperand(unsigned N, ConstraintInfo &Output) {
    408       Output.setHasMatchingInput();
    409       Flags = Output.Flags;
    410       TiedOperand = N;
    411       // Don't copy Name or constraint string.
    412     }
    413   };
    414 
    415   // validateOutputConstraint, validateInputConstraint - Checks that
    416   // a constraint is valid and provides information about it.
    417   // FIXME: These should return a real error instead of just true/false.
    418   bool validateOutputConstraint(ConstraintInfo &Info) const;
    419   bool validateInputConstraint(ConstraintInfo *OutputConstraints,
    420                                unsigned NumOutputs,
    421                                ConstraintInfo &info) const;
    422   bool resolveSymbolicName(const char *&Name,
    423                            ConstraintInfo *OutputConstraints,
    424                            unsigned NumOutputs, unsigned &Index) const;
    425 
    426   // Constraint parm will be left pointing at the last character of
    427   // the constraint.  In practice, it won't be changed unless the
    428   // constraint is longer than one character.
    429   virtual std::string convertConstraint(const char *&Constraint) const {
    430     // 'p' defaults to 'r', but can be overridden by targets.
    431     if (*Constraint == 'p')
    432       return std::string("r");
    433     return std::string(1, *Constraint);
    434   }
    435 
    436   // Returns a string of target-specific clobbers, in LLVM format.
    437   virtual const char *getClobbers() const = 0;
    438 
    439 
    440   /// getTriple - Return the target triple of the primary target.
    441   const llvm::Triple &getTriple() const {
    442     return Triple;
    443   }
    444 
    445   const char *getTargetDescription() const {
    446     return DescriptionString;
    447   }
    448 
    449   struct GCCRegAlias {
    450     const char * const Aliases[5];
    451     const char * const Register;
    452   };
    453 
    454   struct AddlRegName {
    455     const char * const Names[5];
    456     const unsigned RegNum;
    457   };
    458 
    459   virtual bool useGlobalsForAutomaticVariables() const { return false; }
    460 
    461   /// getCFStringSection - Return the section to use for CFString
    462   /// literals, or 0 if no special section is used.
    463   virtual const char *getCFStringSection() const {
    464     return "__DATA,__cfstring";
    465   }
    466 
    467   /// getNSStringSection - Return the section to use for NSString
    468   /// literals, or 0 if no special section is used.
    469   virtual const char *getNSStringSection() const {
    470     return "__OBJC,__cstring_object,regular,no_dead_strip";
    471   }
    472 
    473   /// getNSStringNonFragileABISection - Return the section to use for
    474   /// NSString literals, or 0 if no special section is used (NonFragile ABI).
    475   virtual const char *getNSStringNonFragileABISection() const {
    476     return "__DATA, __objc_stringobj, regular, no_dead_strip";
    477   }
    478 
    479   /// isValidSectionSpecifier - This is an optional hook that targets can
    480   /// implement to perform semantic checking on attribute((section("foo")))
    481   /// specifiers.  In this case, "foo" is passed in to be checked.  If the
    482   /// section specifier is invalid, the backend should return a non-empty string
    483   /// that indicates the problem.
    484   ///
    485   /// This hook is a simple quality of implementation feature to catch errors
    486   /// and give good diagnostics in cases when the assembler or code generator
    487   /// would otherwise reject the section specifier.
    488   ///
    489   virtual std::string isValidSectionSpecifier(StringRef SR) const {
    490     return "";
    491   }
    492 
    493   /// setForcedLangOptions - Set forced language options.
    494   /// Apply changes to the target information with respect to certain
    495   /// language options which change the target configuration.
    496   virtual void setForcedLangOptions(LangOptions &Opts);
    497 
    498   /// getDefaultFeatures - Get the default set of target features for the CPU;
    499   /// this should include all legal feature strings on the target.
    500   virtual void getDefaultFeatures(llvm::StringMap<bool> &Features) const {
    501   }
    502 
    503   /// getABI - Get the ABI in use.
    504   virtual const char *getABI() const {
    505     return "";
    506   }
    507 
    508   /// getCXXABI - Get the C++ ABI in use.
    509   virtual TargetCXXABI getCXXABI() const {
    510     return CXXABI;
    511   }
    512 
    513   /// setCPU - Target the specific CPU.
    514   ///
    515   /// \return - False on error (invalid CPU name).
    516   virtual bool setCPU(const std::string &Name) {
    517     return false;
    518   }
    519 
    520   /// setABI - Use the specific ABI.
    521   ///
    522   /// \return - False on error (invalid ABI name).
    523   virtual bool setABI(const std::string &Name) {
    524     return false;
    525   }
    526 
    527   /// setCXXABI - Use this specific C++ ABI.
    528   ///
    529   /// \return - False on error (invalid C++ ABI name).
    530   bool setCXXABI(const std::string &Name) {
    531     static const TargetCXXABI Unknown = static_cast<TargetCXXABI>(-1);
    532     TargetCXXABI ABI = llvm::StringSwitch<TargetCXXABI>(Name)
    533       .Case("arm", CXXABI_ARM)
    534       .Case("itanium", CXXABI_Itanium)
    535       .Case("microsoft", CXXABI_Microsoft)
    536       .Default(Unknown);
    537     if (ABI == Unknown) return false;
    538     return setCXXABI(ABI);
    539   }
    540 
    541   /// setCXXABI - Set the C++ ABI to be used by this implementation.
    542   ///
    543   /// \return - False on error (ABI not valid on this target)
    544   virtual bool setCXXABI(TargetCXXABI ABI) {
    545     CXXABI = ABI;
    546     return true;
    547   }
    548 
    549   /// setFeatureEnabled - Enable or disable a specific target feature,
    550   /// the feature name must be valid.
    551   ///
    552   /// \return - False on error (invalid feature name).
    553   virtual bool setFeatureEnabled(llvm::StringMap<bool> &Features,
    554                                  const std::string &Name,
    555                                  bool Enabled) const {
    556     return false;
    557   }
    558 
    559   /// HandleTargetOptions - Perform initialization based on the user configured
    560   /// set of features (e.g., +sse4). The list is guaranteed to have at most one
    561   /// entry per feature.
    562   ///
    563   /// The target may modify the features list, to change which options are
    564   /// passed onwards to the backend.
    565   virtual void HandleTargetFeatures(std::vector<std::string> &Features) {
    566   }
    567 
    568   // getRegParmMax - Returns maximal number of args passed in registers.
    569   unsigned getRegParmMax() const {
    570     assert(RegParmMax < 7 && "RegParmMax value is larger than AST can handle");
    571     return RegParmMax;
    572   }
    573 
    574   /// isTLSSupported - Whether the target supports thread-local storage.
    575   bool isTLSSupported() const {
    576     return TLSSupported;
    577   }
    578 
    579   /// hasNoAsmVariants - Return true if {|} are normal characters in the
    580   /// asm string.  If this returns false (the default), then {abc|xyz} is syntax
    581   /// that says that when compiling for asm variant #0, "abc" should be
    582   /// generated, but when compiling for asm variant #1, "xyz" should be
    583   /// generated.
    584   bool hasNoAsmVariants() const {
    585     return NoAsmVariants;
    586   }
    587 
    588   /// getEHDataRegisterNumber - Return the register number that
    589   /// __builtin_eh_return_regno would return with the specified argument.
    590   virtual int getEHDataRegisterNumber(unsigned RegNo) const {
    591     return -1;
    592   }
    593 
    594   /// getStaticInitSectionSpecifier - Return the section to use for C++ static
    595   /// initialization functions.
    596   virtual const char *getStaticInitSectionSpecifier() const {
    597     return 0;
    598   }
    599 
    600   const LangAS::Map &getAddressSpaceMap() const {
    601     return *AddrSpaceMap;
    602   }
    603 
    604   /// \brief Retrieve the name of the platform as it is used in the
    605   /// availability attribute.
    606   StringRef getPlatformName() const { return PlatformName; }
    607 
    608   /// \brief Retrieve the minimum desired version of the platform, to
    609   /// which the program should be compiled.
    610   VersionTuple getPlatformMinVersion() const { return PlatformMinVersion; }
    611 
    612 protected:
    613   virtual uint64_t getPointerWidthV(unsigned AddrSpace) const {
    614     return PointerWidth;
    615   }
    616   virtual uint64_t getPointerAlignV(unsigned AddrSpace) const {
    617     return PointerAlign;
    618   }
    619   virtual enum IntType getPtrDiffTypeV(unsigned AddrSpace) const {
    620     return PtrDiffType;
    621   }
    622   virtual void getGCCRegNames(const char * const *&Names,
    623                               unsigned &NumNames) const = 0;
    624   virtual void getGCCRegAliases(const GCCRegAlias *&Aliases,
    625                                 unsigned &NumAliases) const = 0;
    626   virtual void getGCCAddlRegNames(const AddlRegName *&Addl,
    627 				  unsigned &NumAddl) const {
    628     Addl = 0;
    629     NumAddl = 0;
    630   }
    631   virtual bool validateAsmConstraint(const char *&Name,
    632                                      TargetInfo::ConstraintInfo &info) const= 0;
    633 };
    634 
    635 }  // end namespace clang
    636 
    637 #endif
    638