mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-28 14:36:34 +00:00
Implement use of new IntrinsicLowering interface.
llvm-svn: 33619
This commit is contained in:
parent
6609da2af4
commit
c0ebe17b6a
@ -66,7 +66,7 @@ Interpreter::Interpreter(Module *M) : ExecutionEngine(M), TD(M) {
|
|||||||
initializeExternalFunctions();
|
initializeExternalFunctions();
|
||||||
emitGlobals();
|
emitGlobals();
|
||||||
|
|
||||||
IL = new IntrinsicLowering();
|
IL = new IntrinsicLowering(TD);
|
||||||
}
|
}
|
||||||
|
|
||||||
Interpreter::~Interpreter() {
|
Interpreter::~Interpreter() {
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "llvm/Transforms/Scalar.h"
|
#include "llvm/Transforms/Scalar.h"
|
||||||
#include "llvm/Target/TargetMachineRegistry.h"
|
#include "llvm/Target/TargetMachineRegistry.h"
|
||||||
#include "llvm/Target/TargetAsmInfo.h"
|
#include "llvm/Target/TargetAsmInfo.h"
|
||||||
|
#include "llvm/Target/TargetData.h"
|
||||||
#include "llvm/Support/CallSite.h"
|
#include "llvm/Support/CallSite.h"
|
||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
#include "llvm/Support/GetElementPtrTypeIterator.h"
|
#include "llvm/Support/GetElementPtrTypeIterator.h"
|
||||||
@ -70,16 +71,18 @@ namespace {
|
|||||||
/// module to a C translation unit.
|
/// module to a C translation unit.
|
||||||
class CWriter : public FunctionPass, public InstVisitor<CWriter> {
|
class CWriter : public FunctionPass, public InstVisitor<CWriter> {
|
||||||
std::ostream &Out;
|
std::ostream &Out;
|
||||||
IntrinsicLowering IL;
|
IntrinsicLowering *IL;
|
||||||
Mangler *Mang;
|
Mangler *Mang;
|
||||||
LoopInfo *LI;
|
LoopInfo *LI;
|
||||||
const Module *TheModule;
|
const Module *TheModule;
|
||||||
const TargetAsmInfo* TAsm;
|
const TargetAsmInfo* TAsm;
|
||||||
|
const TargetData* TD;
|
||||||
std::map<const Type *, std::string> TypeNames;
|
std::map<const Type *, std::string> TypeNames;
|
||||||
|
|
||||||
std::map<const ConstantFP *, unsigned> FPConstantMap;
|
std::map<const ConstantFP *, unsigned> FPConstantMap;
|
||||||
public:
|
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"; }
|
virtual const char *getPassName() const { return "C backend"; }
|
||||||
|
|
||||||
@ -1416,7 +1419,9 @@ bool CWriter::doInitialization(Module &M) {
|
|||||||
// Initialize
|
// Initialize
|
||||||
TheModule = &M;
|
TheModule = &M;
|
||||||
|
|
||||||
IL.AddPrototypes(M);
|
TD = new TargetData(&M);
|
||||||
|
IL = new IntrinsicLowering(*TD);
|
||||||
|
IL->AddPrototypes(M);
|
||||||
|
|
||||||
// Ensure that all structure types have names...
|
// Ensure that all structure types have names...
|
||||||
Mang = new Mangler(M);
|
Mang = new Mangler(M);
|
||||||
@ -2348,7 +2353,7 @@ void CWriter::lowerIntrinsics(Function &F) {
|
|||||||
if (CI != &BB->front())
|
if (CI != &BB->front())
|
||||||
Before = prior(BasicBlock::iterator(CI));
|
Before = prior(BasicBlock::iterator(CI));
|
||||||
|
|
||||||
IL.LowerIntrinsicCall(CI);
|
IL->LowerIntrinsicCall(CI);
|
||||||
if (Before) { // Move iterator to instruction after call
|
if (Before) { // Move iterator to instruction after call
|
||||||
I = Before; ++I;
|
I = Before; ++I;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user