Refactor TargetMachine, pushing handling of TargetData into the target-specific subclasses. This has one caller-visible change: getTargetData() now returns a pointer instead of a reference.
This fixes PR 759.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28074 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp
index 4d3b5a3..91c8caf 100644
--- a/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/lib/ExecutionEngine/JIT/JIT.cpp
@@ -302,8 +302,8 @@
// actually initialize the global after current function has finished
// compilation.
const Type *GlobalType = GV->getType()->getElementType();
- size_t S = getTargetData().getTypeSize(GlobalType);
- size_t A = getTargetData().getTypeAlignment(GlobalType);
+ size_t S = getTargetData()->getTypeSize(GlobalType);
+ size_t A = getTargetData()->getTypeAlignment(GlobalType);
if (A <= 8) {
Ptr = malloc(S);
} else {
diff --git a/lib/ExecutionEngine/JIT/JITEmitter.cpp b/lib/ExecutionEngine/JIT/JITEmitter.cpp
index bdc5f79..a8d9170 100644
--- a/lib/ExecutionEngine/JIT/JITEmitter.cpp
+++ b/lib/ExecutionEngine/JIT/JITEmitter.cpp
@@ -518,7 +518,7 @@
if (Constants.empty()) return;
unsigned Size = Constants.back().Offset;
- Size += TheJIT->getTargetData().getTypeSize(Constants.back().Val->getType());
+ Size += TheJIT->getTargetData()->getTypeSize(Constants.back().Val->getType());
ConstantPoolBase = allocateSpace(Size, 1 << MCP->getConstantPoolAlignment());
ConstantPool = MCP;