Skip to content

Commit 1e960cd

Browse files
author
Reid Spencer
committedJan 29, 2007
Implement use of new IntrinsicLowering interface.
llvm-svn: 33619
1 parent d7035b6 commit 1e960cd

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed
 

‎llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Interpreter::Interpreter(Module *M) : ExecutionEngine(M), TD(M) {
6666
initializeExternalFunctions();
6767
emitGlobals();
6868

69-
IL = new IntrinsicLowering();
69+
IL = new IntrinsicLowering(TD);
7070
}
7171

7272
Interpreter::~Interpreter() {

‎llvm/lib/Target/CBackend/CBackend.cpp

+9-4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "llvm/Transforms/Scalar.h"
3333
#include "llvm/Target/TargetMachineRegistry.h"
3434
#include "llvm/Target/TargetAsmInfo.h"
35+
#include "llvm/Target/TargetData.h"
3536
#include "llvm/Support/CallSite.h"
3637
#include "llvm/Support/CFG.h"
3738
#include "llvm/Support/GetElementPtrTypeIterator.h"
@@ -70,16 +71,18 @@ namespace {
7071
/// module to a C translation unit.
7172
class CWriter : public FunctionPass, public InstVisitor<CWriter> {
7273
std::ostream &Out;
73-
IntrinsicLowering IL;
74+
IntrinsicLowering *IL;
7475
Mangler *Mang;
7576
LoopInfo *LI;
7677
const Module *TheModule;
7778
const TargetAsmInfo* TAsm;
79+
const TargetData* TD;
7880
std::map<const Type *, std::string> TypeNames;
7981

8082
std::map<const ConstantFP *, unsigned> FPConstantMap;
8183
public:
82-
CWriter(std::ostream &o) : Out(o), TAsm(0) {}
84+
CWriter(std::ostream &o) : Out(o), IL(0), Mang(0), LI(0), TheModule(0),
85+
TAsm(0), TD(0) {}
8386

8487
virtual const char *getPassName() const { return "C backend"; }
8588

@@ -1416,7 +1419,9 @@ bool CWriter::doInitialization(Module &M) {
14161419
// Initialize
14171420
TheModule = &M;
14181421

1419-
IL.AddPrototypes(M);
1422+
TD = new TargetData(&M);
1423+
IL = new IntrinsicLowering(*TD);
1424+
IL->AddPrototypes(M);
14201425

14211426
// Ensure that all structure types have names...
14221427
Mang = new Mangler(M);
@@ -2348,7 +2353,7 @@ void CWriter::lowerIntrinsics(Function &F) {
23482353
if (CI != &BB->front())
23492354
Before = prior(BasicBlock::iterator(CI));
23502355

2351-
IL.LowerIntrinsicCall(CI);
2356+
IL->LowerIntrinsicCall(CI);
23522357
if (Before) { // Move iterator to instruction after call
23532358
I = Before; ++I;
23542359
} else {

0 commit comments

Comments
 (0)
Please sign in to comment.