aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/TargetMachine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target/TargetMachine.cpp')
-rw-r--r--llvm/lib/Target/TargetMachine.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Target/TargetMachine.cpp b/llvm/lib/Target/TargetMachine.cpp
index 0b4a251..2119167 100644
--- a/llvm/lib/Target/TargetMachine.cpp
+++ b/llvm/lib/Target/TargetMachine.cpp
@@ -39,14 +39,16 @@ TargetMachine::TargetMachine(const Target &T, StringRef DataLayoutString,
TargetMachine::~TargetMachine() = default;
-bool TargetMachine::isLargeData() const {
+bool TargetMachine::isLargeData(const GlobalVariable *GV) const {
if (getTargetTriple().getArch() != Triple::x86_64)
return false;
// Large data under the large code model still needs to be thought about, so
// restrict this to medium.
if (getCodeModel() != CodeModel::Medium)
return false;
- return true;
+ const DataLayout &DL = GV->getParent()->getDataLayout();
+ uint64_t Size = DL.getTypeSizeInBits(GV->getValueType()) / 8;
+ return Size == 0 || Size > LargeDataThreshold;
}
bool TargetMachine::isPositionIndependent() const {