diff options
author | Nico Weber <thakis@chromium.org> | 2021-04-19 13:39:20 -0400 |
---|---|---|
committer | Nico Weber <thakis@chromium.org> | 2021-04-27 22:26:10 -0400 |
commit | 0f1137ba79c0b3f1ca638e01082443ba5ccde03c (patch) | |
tree | 23708767073c3cc358e9c147411927cae2184235 /clang/lib/Basic/TargetInfo.cpp | |
parent | c35fadceab382a30f4f2f0023fb688d31af58feb (diff) | |
download | llvm-0f1137ba79c0b3f1ca638e01082443ba5ccde03c.zip llvm-0f1137ba79c0b3f1ca638e01082443ba5ccde03c.tar.gz llvm-0f1137ba79c0b3f1ca638e01082443ba5ccde03c.tar.bz2 |
[clang/Basic] Make TargetInfo.h not use DataLayout again
Reverts parts of https://reviews.llvm.org/D17183, but keeps the
resetDataLayout() API and adds an assert that checks that datalayout string and
user label prefix are in sync.
Approach 1 in https://reviews.llvm.org/D17183#2653279
Reduces number of TUs build for 'clang-format' from 689 to 575.
I also implemented approach 2 in D100764. If someone feels motivated
to make us use DataLayout more, it's easy to revert this change here
and go with D100764 instead. I don't plan on doing more work in this
area though, so I prefer going with the smaller, more self-consistent change.
Differential Revision: https://reviews.llvm.org/D100776
Diffstat (limited to 'clang/lib/Basic/TargetInfo.cpp')
-rw-r--r-- | clang/lib/Basic/TargetInfo.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp index 1783da8..a431ec1 100644 --- a/clang/lib/Basic/TargetInfo.cpp +++ b/clang/lib/Basic/TargetInfo.cpp @@ -17,7 +17,6 @@ #include "clang/Basic/LangOptions.h" #include "llvm/ADT/APFloat.h" #include "llvm/ADT/STLExtras.h" -#include "llvm/IR/DataLayout.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/TargetParser.h" #include <cstdlib> @@ -114,6 +113,7 @@ TargetInfo::TargetInfo(const llvm::Triple &T) : TargetOpts(), Triple(T) { LongDoubleFormat = &llvm::APFloat::IEEEdouble(); Float128Format = &llvm::APFloat::IEEEquad(); MCountName = "mcount"; + UserLabelPrefix = "_"; RegParmMax = 0; SSERegParmMax = 0; HasAlignMac68kSupport = false; @@ -149,8 +149,9 @@ TargetInfo::TargetInfo(const llvm::Triple &T) : TargetOpts(), Triple(T) { // Out of line virtual dtor for TargetInfo. TargetInfo::~TargetInfo() {} -void TargetInfo::resetDataLayout(StringRef DL) { - DataLayout.reset(new llvm::DataLayout(DL)); +void TargetInfo::resetDataLayout(StringRef DL, const char *ULP) { + DataLayoutString = DL.str(); + UserLabelPrefix = ULP; } bool |