diff options
author | James Y Knight <jyknight@google.com> | 2016-03-04 19:00:41 +0000 |
---|---|---|
committer | James Y Knight <jyknight@google.com> | 2016-03-04 19:00:41 +0000 |
commit | e85ad572986c6fbbc45f361b706ea831c5ecf004 (patch) | |
tree | 54db30acb8783265d490c97c10c0b21056ea194f /include/clang/Basic/TargetInfo.h | |
parent | 0c35e452895ad039178f3a19e90a1c36b4554749 (diff) |
Make TargetInfo store an actual DataLayout instead of a string.
Use it to calculate UserLabelPrefix, instead of specifying it (often
incorrectly).
Note that the *actual* user label prefix has always come from the
DataLayout, and is handled within LLVM. The main thing clang's
TargetInfo::UserLabelPrefix did was to set the #define value. Having
these be different from each-other is just silly.
Differential Revision: http://reviews.llvm.org/D17183
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262737 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/TargetInfo.h')
-rw-r--r-- | include/clang/Basic/TargetInfo.h | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h index 0d832f5f7f..633f54f797 100644 --- a/include/clang/Basic/TargetInfo.h +++ b/include/clang/Basic/TargetInfo.h @@ -21,13 +21,14 @@ #include "clang/Basic/TargetCXXABI.h" #include "clang/Basic/TargetOptions.h" #include "clang/Basic/VersionTuple.h" -#include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/APInt.h" +#include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Triple.h" +#include "llvm/IR/DataLayout.h" #include "llvm/Support/DataTypes.h" #include <cassert> #include <string> @@ -74,8 +75,7 @@ protected: unsigned short MaxVectorAlign; unsigned short MaxTLSAlign; unsigned short SimdDefaultAlign; - const char *DataLayoutString; - const char *UserLabelPrefix; + std::unique_ptr<llvm::DataLayout> DataLayout; const char *MCountName; const llvm::fltSemantics *HalfFormat, *FloatFormat, *DoubleFormat, *LongDoubleFormat; @@ -95,6 +95,10 @@ protected: // TargetInfo Constructor. Default initializes all fields. TargetInfo(const llvm::Triple &T); + void resetDataLayout(StringRef DL) { + DataLayout.reset(new llvm::DataLayout(DL)); + } + public: /// \brief Construct a target for the given options. /// @@ -426,14 +430,6 @@ public: return PointerWidth; } - /// \brief Returns the default value of the __USER_LABEL_PREFIX__ macro, - /// which is the prefix given to user symbols by default. - /// - /// On most platforms this is "_", but it is "" on some, and "." on others. - const char *getUserLabelPrefix() const { - return UserLabelPrefix; - } - /// \brief Returns the name of the mcount instrumentation function. const char *getMCountName() const { return MCountName; @@ -721,9 +717,9 @@ public: return Triple; } - const char *getDataLayoutString() const { - assert(DataLayoutString && "Uninitialized DataLayoutString!"); - return DataLayoutString; + const llvm::DataLayout &getDataLayout() const { + assert(DataLayout && "Uninitialized DataLayout!"); + return *DataLayout; } struct GCCRegAlias { |