diff options
Diffstat (limited to 'include/clang/Basic/TargetInfo.h')
-rw-r--r-- | include/clang/Basic/TargetInfo.h | 80 |
1 files changed, 39 insertions, 41 deletions
diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h index 2d26783..c05f062 100644 --- a/include/clang/Basic/TargetInfo.h +++ b/include/clang/Basic/TargetInfo.h @@ -15,20 +15,21 @@ #ifndef LLVM_CLANG_BASIC_TARGETINFO_H #define LLVM_CLANG_BASIC_TARGETINFO_H +#include "clang/Basic/AddressSpaces.h" +#include "clang/Basic/TargetCXXABI.h" #include "clang/Basic/LLVM.h" +#include "clang/Basic/Specifiers.h" +#include "clang/Basic/TargetOptions.h" +#include "clang/Basic/VersionTuple.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Triple.h" #include "llvm/Support/DataTypes.h" -#include "clang/Basic/AddressSpaces.h" -#include "clang/Basic/TargetOptions.h" -#include "clang/Basic/VersionTuple.h" -#include "clang/Basic/Specifiers.h" #include <cassert> -#include <vector> #include <string> +#include <vector> namespace llvm { struct fltSemantics; @@ -43,26 +44,10 @@ class SourceManager; namespace Builtin { struct Info; } -/// \brief The types of C++ ABIs for which we can generate code. -enum TargetCXXABI { - /// The generic ("Itanium") C++ ABI, documented at: - /// http://www.codesourcery.com/public/cxx-abi/ - CXXABI_Itanium, - - /// The ARM C++ ABI, based largely on the Itanium ABI but with - /// significant differences. - /// http://infocenter.arm.com - /// /help/topic/com.arm.doc.ihi0041c/IHI0041C_cppabi.pdf - CXXABI_ARM, - - /// The Visual Studio ABI. Only scattered official documentation exists. - CXXABI_Microsoft -}; - /// \brief Exposes information about the current target. /// class TargetInfo : public RefCountedBase<TargetInfo> { - llvm::IntrusiveRefCntPtr<TargetOptions> TargetOpts; + IntrusiveRefCntPtr<TargetOptions> TargetOpts; llvm::Triple Triple; protected: // Target values set by the ctor of the actual target implementation. Default @@ -89,7 +74,7 @@ protected: const llvm::fltSemantics *HalfFormat, *FloatFormat, *DoubleFormat, *LongDoubleFormat; unsigned char RegParmMax, SSERegParmMax; - TargetCXXABI CXXABI; + TargetCXXABI TheCXXABI; const LangAS::Map *AddrSpaceMap; mutable StringRef PlatformName; @@ -109,7 +94,7 @@ public: /// modify the options to canonicalize the target feature information to match /// what the backend expects. static TargetInfo* CreateTargetInfo(DiagnosticsEngine &Diags, - TargetOptions &Opts); + TargetOptions *Opts); virtual ~TargetInfo(); @@ -119,8 +104,8 @@ public: return *TargetOpts; } - void setTargetOpts(TargetOptions &TargetOpts) { - this->TargetOpts = &TargetOpts; + void setTargetOpts(TargetOptions *TargetOpts) { + this->TargetOpts = TargetOpts; } ///===---- Target Data Type Query Methods -------------------------------===// @@ -151,6 +136,10 @@ public: /// typedef void* __builtin_va_list; VoidPtrBuiltinVaList, + /// __builtin_va_list as defind by the AArch64 ABI + /// http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055a/IHI0055A_aapcs64.pdf + AArch64ABIBuiltinVaList, + /// __builtin_va_list as defined by the PNaCl ABI: /// http://www.chromium.org/nativeclient/pnacl/bitcode-abi#TOC-Machine-Types PNaClABIBuiltinVaList, @@ -270,6 +259,9 @@ public: unsigned getLongLongWidth() const { return LongLongWidth; } unsigned getLongLongAlign() const { return LongLongAlign; } + /// \brief Determine whether the __int128 type is supported on this target. + bool hasInt128Type() const { return getPointerWidth(0) >= 64; } // FIXME + /// \brief Return the alignment that is suitable for storing any /// object with a fundamental alignment requirement. unsigned getSuitableAlign() const { return SuitableAlign; } @@ -335,6 +327,9 @@ public: return getTypeWidth(IntMaxType); } + // Return the size of unwind_word for this target. + unsigned getUnwindWordWidth() const { return getPointerWidth(0); } + /// \brief Return the "preferred" register width on this target. uint64_t getRegisterWidth() const { // Currently we assume the register width on the target matches the pointer @@ -518,6 +513,10 @@ public: bool validateInputConstraint(ConstraintInfo *OutputConstraints, unsigned NumOutputs, ConstraintInfo &info) const; + virtual bool validateInputSize(StringRef /*Constraint*/, + unsigned /*Size*/) const { + return true; + } virtual bool validateConstraintModifier(StringRef /*Constraint*/, const char /*Modifier*/, unsigned /*Size*/) const { @@ -572,8 +571,6 @@ public: /// either; the entire thing is pretty badly mangled. virtual bool hasProtectedVisibility() const { return true; } - virtual bool useGlobalsForAutomaticVariables() const { return false; } - /// \brief Return the section to use for CFString literals, or 0 if no /// special section is used. virtual const char *getCFStringSection() const { @@ -624,8 +621,8 @@ public: } /// \brief Get the C++ ABI currently in use. - virtual TargetCXXABI getCXXABI() const { - return CXXABI; + TargetCXXABI getCXXABI() const { + return TheCXXABI; } /// \brief Target the specified CPU. @@ -645,14 +642,9 @@ public: /// \brief Use this specified C++ ABI. /// /// \return False on error (invalid C++ ABI name). - bool setCXXABI(const std::string &Name) { - static const TargetCXXABI Unknown = static_cast<TargetCXXABI>(-1); - TargetCXXABI ABI = llvm::StringSwitch<TargetCXXABI>(Name) - .Case("arm", CXXABI_ARM) - .Case("itanium", CXXABI_Itanium) - .Case("microsoft", CXXABI_Microsoft) - .Default(Unknown); - if (ABI == Unknown) return false; + bool setCXXABI(llvm::StringRef name) { + TargetCXXABI ABI; + if (!ABI.tryParse(name)) return false; return setCXXABI(ABI); } @@ -660,7 +652,7 @@ public: /// /// \return False on error (ABI not valid on this target) virtual bool setCXXABI(TargetCXXABI ABI) { - CXXABI = ABI; + TheCXXABI = ABI; return true; } @@ -735,13 +727,19 @@ public: bool isBigEndian() const { return BigEndian; } + enum CallingConvMethodType { + CCMT_Unknown, + CCMT_Member, + CCMT_NonMember + }; + /// \brief Gets the default calling convention for the given target and /// declaration context. - virtual CallingConv getDefaultCallingConv() const { + virtual CallingConv getDefaultCallingConv(CallingConvMethodType MT) const { // Not all targets will specify an explicit calling convention that we can // express. This will always do the right thing, even though it's not // an explicit calling convention. - return CC_Default; + return CC_C; } enum CallingConvCheckResult { |