summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-01-29 17:51:02 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-01-29 17:51:02 +0000
commit519e239b1f8e12a6566d5140bfd08733ff227706 (patch)
tree71d3bf9fdb604702723d84be5cf0c2bd20e0fb25
parent6addf2ceeb7b231e32308b7b15c77bc8992868a7 (diff)
downloadllvm-519e239b1f8e12a6566d5140bfd08733ff227706.tar.gz
llvm-519e239b1f8e12a6566d5140bfd08733ff227706.tar.bz2
llvm-519e239b1f8e12a6566d5140bfd08733ff227706.tar.xz
Implement use of new IntrinsicLowering interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33619 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/ExecutionEngine/Interpreter/Interpreter.cpp2
-rw-r--r--lib/Target/CBackend/CBackend.cpp13
2 files changed, 10 insertions, 5 deletions
diff --git a/lib/ExecutionEngine/Interpreter/Interpreter.cpp b/lib/ExecutionEngine/Interpreter/Interpreter.cpp
index d39b5e1cf6..2b805ada4c 100644
--- a/lib/ExecutionEngine/Interpreter/Interpreter.cpp
+++ b/lib/ExecutionEngine/Interpreter/Interpreter.cpp
@@ -66,7 +66,7 @@ Interpreter::Interpreter(Module *M) : ExecutionEngine(M), TD(M) {
initializeExternalFunctions();
emitGlobals();
- IL = new IntrinsicLowering();
+ IL = new IntrinsicLowering(TD);
}
Interpreter::~Interpreter() {
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index 0c808131b6..a6d3fb5227 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -32,6 +32,7 @@
#include "llvm/Transforms/Scalar.h"
#include "llvm/Target/TargetMachineRegistry.h"
#include "llvm/Target/TargetAsmInfo.h"
+#include "llvm/Target/TargetData.h"
#include "llvm/Support/CallSite.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/GetElementPtrTypeIterator.h"
@@ -70,16 +71,18 @@ namespace {
/// module to a C translation unit.
class CWriter : public FunctionPass, public InstVisitor<CWriter> {
std::ostream &Out;
- IntrinsicLowering IL;
+ IntrinsicLowering *IL;
Mangler *Mang;
LoopInfo *LI;
const Module *TheModule;
const TargetAsmInfo* TAsm;
+ const TargetData* TD;
std::map<const Type *, std::string> TypeNames;
std::map<const ConstantFP *, unsigned> FPConstantMap;
public:
- CWriter(std::ostream &o) : Out(o), TAsm(0) {}
+ CWriter(std::ostream &o) : Out(o), IL(0), Mang(0), LI(0), TheModule(0),
+ TAsm(0), TD(0) {}
virtual const char *getPassName() const { return "C backend"; }
@@ -1416,7 +1419,9 @@ bool CWriter::doInitialization(Module &M) {
// Initialize
TheModule = &M;
- IL.AddPrototypes(M);
+ TD = new TargetData(&M);
+ IL = new IntrinsicLowering(*TD);
+ IL->AddPrototypes(M);
// Ensure that all structure types have names...
Mang = new Mangler(M);
@@ -2348,7 +2353,7 @@ void CWriter::lowerIntrinsics(Function &F) {
if (CI != &BB->front())
Before = prior(BasicBlock::iterator(CI));
- IL.LowerIntrinsicCall(CI);
+ IL->LowerIntrinsicCall(CI);
if (Before) { // Move iterator to instruction after call
I = Before; ++I;
} else {