mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 05:29:24 +00:00
Eliminate IntrinsicLowering from TargetMachine.
Make the CBE and V9 backends create their own, since they're the only ones that use it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26974 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
475c010366
commit
bc641b9d8b
@ -53,9 +53,8 @@ unsigned AlphaTargetMachine::getJITMatchQuality() {
|
||||
#endif
|
||||
}
|
||||
|
||||
AlphaTargetMachine::AlphaTargetMachine(const Module &M, IntrinsicLowering *IL,
|
||||
const std::string &FS)
|
||||
: TargetMachine("alpha", IL, true),
|
||||
AlphaTargetMachine::AlphaTargetMachine(const Module &M, const std::string &FS)
|
||||
: TargetMachine("alpha", true),
|
||||
FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0),
|
||||
JITInfo(*this),
|
||||
Subtarget(M, FS)
|
||||
|
@ -24,7 +24,6 @@
|
||||
namespace llvm {
|
||||
|
||||
class GlobalValue;
|
||||
class IntrinsicLowering;
|
||||
|
||||
class AlphaTargetMachine : public TargetMachine {
|
||||
AlphaInstrInfo InstrInfo;
|
||||
@ -33,8 +32,7 @@ class AlphaTargetMachine : public TargetMachine {
|
||||
AlphaSubtarget Subtarget;
|
||||
|
||||
public:
|
||||
AlphaTargetMachine(const Module &M, IntrinsicLowering *IL,
|
||||
const std::string &FS);
|
||||
AlphaTargetMachine(const Module &M, const std::string &FS);
|
||||
|
||||
virtual const AlphaInstrInfo *getInstrInfo() const { return &InstrInfo; }
|
||||
virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
|
||||
|
@ -67,7 +67,7 @@ namespace {
|
||||
/// module to a C translation unit.
|
||||
class CWriter : public FunctionPass, public InstVisitor<CWriter> {
|
||||
std::ostream &Out;
|
||||
IntrinsicLowering &IL;
|
||||
DefaultIntrinsicLowering IL;
|
||||
Mangler *Mang;
|
||||
LoopInfo *LI;
|
||||
const Module *TheModule;
|
||||
@ -75,7 +75,7 @@ namespace {
|
||||
|
||||
std::map<const ConstantFP *, unsigned> FPConstantMap;
|
||||
public:
|
||||
CWriter(std::ostream &o, IntrinsicLowering &il) : Out(o), IL(il) {}
|
||||
CWriter(std::ostream &o) : Out(o) {}
|
||||
|
||||
virtual const char *getPassName() const { return "C backend"; }
|
||||
|
||||
@ -1931,6 +1931,6 @@ bool CTargetMachine::addPassesToEmitFile(PassManager &PM, std::ostream &o,
|
||||
PM.add(createLowerInvokePass());
|
||||
PM.add(createCFGSimplificationPass()); // clean up after lower invoke.
|
||||
PM.add(new CBackendNameAllUsedStructsAndMergeFunctions());
|
||||
PM.add(new CWriter(o, getIntrinsicLowering()));
|
||||
PM.add(new CWriter(o));
|
||||
return false;
|
||||
}
|
||||
|
@ -17,12 +17,10 @@
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
|
||||
namespace llvm {
|
||||
class IntrinsicLowering;
|
||||
|
||||
struct CTargetMachine : public TargetMachine {
|
||||
CTargetMachine(const Module &M, IntrinsicLowering *IL,
|
||||
const std::string &FS) :
|
||||
TargetMachine("CBackend", IL, M) {}
|
||||
CTargetMachine(const Module &M, const std::string &FS)
|
||||
: TargetMachine("CBackend", M) {}
|
||||
|
||||
// This is the only thing that actually does anything here.
|
||||
virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out,
|
||||
|
@ -67,7 +67,7 @@ namespace {
|
||||
/// module to a C translation unit.
|
||||
class CWriter : public FunctionPass, public InstVisitor<CWriter> {
|
||||
std::ostream &Out;
|
||||
IntrinsicLowering &IL;
|
||||
DefaultIntrinsicLowering IL;
|
||||
Mangler *Mang;
|
||||
LoopInfo *LI;
|
||||
const Module *TheModule;
|
||||
@ -75,7 +75,7 @@ namespace {
|
||||
|
||||
std::map<const ConstantFP *, unsigned> FPConstantMap;
|
||||
public:
|
||||
CWriter(std::ostream &o, IntrinsicLowering &il) : Out(o), IL(il) {}
|
||||
CWriter(std::ostream &o) : Out(o) {}
|
||||
|
||||
virtual const char *getPassName() const { return "C backend"; }
|
||||
|
||||
@ -1931,6 +1931,6 @@ bool CTargetMachine::addPassesToEmitFile(PassManager &PM, std::ostream &o,
|
||||
PM.add(createLowerInvokePass());
|
||||
PM.add(createCFGSimplificationPass()); // clean up after lower invoke.
|
||||
PM.add(new CBackendNameAllUsedStructsAndMergeFunctions());
|
||||
PM.add(new CWriter(o, getIntrinsicLowering()));
|
||||
PM.add(new CWriter(o));
|
||||
return false;
|
||||
}
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "IA64.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/CodeGen/IntrinsicLowering.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
#include "llvm/Target/TargetOptions.h"
|
||||
@ -76,9 +75,8 @@ unsigned IA64TargetMachine::getModuleMatchQuality(const Module &M) {
|
||||
|
||||
/// IA64TargetMachine ctor - Create an LP64 architecture model
|
||||
///
|
||||
IA64TargetMachine::IA64TargetMachine(const Module &M, IntrinsicLowering *IL,
|
||||
const std::string &FS)
|
||||
: TargetMachine("IA64", IL, true),
|
||||
IA64TargetMachine::IA64TargetMachine(const Module &M, const std::string &FS)
|
||||
: TargetMachine("IA64", true),
|
||||
FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0),
|
||||
TLInfo(*this) { // FIXME? check this stuff
|
||||
}
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "IA64ISelLowering.h"
|
||||
|
||||
namespace llvm {
|
||||
class IntrinsicLowering;
|
||||
|
||||
class IA64TargetMachine : public TargetMachine {
|
||||
IA64InstrInfo InstrInfo;
|
||||
@ -29,8 +28,7 @@ class IA64TargetMachine : public TargetMachine {
|
||||
//IA64JITInfo JITInfo;
|
||||
IA64TargetLowering TLInfo;
|
||||
public:
|
||||
IA64TargetMachine(const Module &M, IntrinsicLowering *IL,
|
||||
const std::string &FS);
|
||||
IA64TargetMachine(const Module &M, const std::string &FS);
|
||||
|
||||
virtual const IA64InstrInfo *getInstrInfo() const { return &InstrInfo; }
|
||||
virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/Analysis/Verifier.h"
|
||||
#include "llvm/CodeGen/IntrinsicLowering.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
#include "llvm/Target/TargetOptions.h"
|
||||
@ -58,9 +57,8 @@ unsigned PPCTargetMachine::getModuleMatchQuality(const Module &M) {
|
||||
return getJITMatchQuality()/2;
|
||||
}
|
||||
|
||||
PPCTargetMachine::PPCTargetMachine(const Module &M, IntrinsicLowering *IL,
|
||||
const std::string &FS)
|
||||
: TargetMachine("PowerPC", IL, false, 4, 4, 4, 4, 4, 4, 2, 1, 1),
|
||||
PPCTargetMachine::PPCTargetMachine(const Module &M, const std::string &FS)
|
||||
: TargetMachine("PowerPC", false, 4, 4, 4, 4, 4, 4, 2, 1, 1),
|
||||
Subtarget(M, FS), FrameInfo(*this, false), JITInfo(*this),
|
||||
TLInfo(*this), InstrItins(Subtarget.getInstrItineraryData()) {
|
||||
if (TargetDefault == PPCTarget) {
|
||||
|
@ -23,9 +23,7 @@
|
||||
|
||||
namespace llvm {
|
||||
class PassManager;
|
||||
class IntrinsicLowering;
|
||||
class GlobalValue;
|
||||
class IntrinsicLowering;
|
||||
|
||||
class PPCTargetMachine : public TargetMachine {
|
||||
PPCInstrInfo InstrInfo;
|
||||
@ -35,8 +33,7 @@ class PPCTargetMachine : public TargetMachine {
|
||||
PPCTargetLowering TLInfo;
|
||||
InstrItineraryData InstrItins;
|
||||
public:
|
||||
PPCTargetMachine(const Module &M, IntrinsicLowering *IL,
|
||||
const std::string &FS);
|
||||
PPCTargetMachine(const Module &M, const std::string &FS);
|
||||
|
||||
virtual const PPCInstrInfo *getInstrInfo() const { return &InstrInfo; }
|
||||
virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
|
||||
|
@ -30,9 +30,8 @@ namespace {
|
||||
|
||||
/// SparcTargetMachine ctor - Create an ILP32 architecture model
|
||||
///
|
||||
SparcTargetMachine::SparcTargetMachine(const Module &M, IntrinsicLowering *IL,
|
||||
const std::string &FS)
|
||||
: TargetMachine("Sparc", IL, false, 4, 4),
|
||||
SparcTargetMachine::SparcTargetMachine(const Module &M, const std::string &FS)
|
||||
: TargetMachine("Sparc", false, 4, 4),
|
||||
Subtarget(M, FS), InstrInfo(Subtarget),
|
||||
FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 0) {
|
||||
}
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class IntrinsicLowering;
|
||||
class Module;
|
||||
|
||||
class SparcTargetMachine : public TargetMachine {
|
||||
@ -30,8 +29,7 @@ class SparcTargetMachine : public TargetMachine {
|
||||
SparcInstrInfo InstrInfo;
|
||||
TargetFrameInfo FrameInfo;
|
||||
public:
|
||||
SparcTargetMachine(const Module &M, IntrinsicLowering *IL,
|
||||
const std::string &FS);
|
||||
SparcTargetMachine(const Module &M, const std::string &FS);
|
||||
|
||||
virtual const SparcInstrInfo *getInstrInfo() const { return &InstrInfo; }
|
||||
virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
|
||||
|
@ -4356,6 +4356,7 @@ void GetInstructionsByRule(InstructionNode* subtreeRoot, int ruleForNode,
|
||||
//==------------------------------------------------------------------------==//
|
||||
|
||||
bool V9ISel::runOnFunction(Function &F) {
|
||||
DefaultIntrinsicLowering IL;
|
||||
// First pass - Walk the function, lowering any calls to intrinsic functions
|
||||
// which the instruction selector cannot handle.
|
||||
for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
|
||||
@ -4376,7 +4377,7 @@ bool V9ISel::runOnFunction(Function &F) {
|
||||
default:
|
||||
// All other intrinsic calls we must lower.
|
||||
Instruction *Before = CI->getPrev();
|
||||
Target.getIntrinsicLowering().LowerIntrinsicCall(CI);
|
||||
IL.LowerIntrinsicCall(CI);
|
||||
if (Before) { // Move iterator to instruction after call
|
||||
I = Before; ++I;
|
||||
} else {
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/Assembly/PrintModulePass.h"
|
||||
#include "llvm/CodeGen/InstrScheduling.h"
|
||||
#include "llvm/CodeGen/IntrinsicLowering.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
#include "llvm/Target/TargetOptions.h"
|
||||
@ -147,10 +146,9 @@ FunctionPass *llvm::createSparcV9MachineCodeDestructionPass() {
|
||||
}
|
||||
|
||||
|
||||
SparcV9TargetMachine::SparcV9TargetMachine(const Module &M,
|
||||
IntrinsicLowering *il,
|
||||
SparcV9TargetMachine::SparcV9TargetMachine(const Module &M,
|
||||
const std::string &FS)
|
||||
: TargetMachine("UltraSparcV9-Native", il, false),
|
||||
: TargetMachine("UltraSparcV9-Native", false),
|
||||
schedInfo(*this),
|
||||
regInfo(*this),
|
||||
frameInfo(*this),
|
||||
|
@ -32,8 +32,7 @@ class SparcV9TargetMachine : public TargetMachine {
|
||||
SparcV9FrameInfo frameInfo;
|
||||
SparcV9JITInfo jitInfo;
|
||||
public:
|
||||
SparcV9TargetMachine(const Module &M, IntrinsicLowering *IL,
|
||||
const std::string &FS);
|
||||
SparcV9TargetMachine(const Module &M, const std::string &FS);
|
||||
|
||||
virtual const TargetInstrInfo *getInstrInfo() const { return &instrInfo; }
|
||||
virtual const TargetSchedInfo *getSchedInfo() const { return &schedInfo; }
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/TargetOptions.h"
|
||||
#include "llvm/Type.h"
|
||||
#include "llvm/CodeGen/IntrinsicLowering.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
using namespace llvm;
|
||||
|
||||
@ -70,8 +69,7 @@ namespace {
|
||||
//---------------------------------------------------------------------------
|
||||
// TargetMachine Class
|
||||
//
|
||||
TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
|
||||
bool LittleEndian,
|
||||
TargetMachine::TargetMachine(const std::string &name, bool LittleEndian,
|
||||
unsigned char PtrSize, unsigned char PtrAl,
|
||||
unsigned char DoubleAl, unsigned char FloatAl,
|
||||
unsigned char LongAl, unsigned char IntAl,
|
||||
@ -80,23 +78,17 @@ TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
|
||||
: Name(name), DataLayout(name, LittleEndian,
|
||||
PtrSize, PtrAl, DoubleAl, FloatAl, LongAl,
|
||||
IntAl, ShortAl, ByteAl, BoolAl) {
|
||||
IL = il ? il : new DefaultIntrinsicLowering();
|
||||
}
|
||||
|
||||
TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
|
||||
const TargetData &TD)
|
||||
TargetMachine::TargetMachine(const std::string &name, const TargetData &TD)
|
||||
: Name(name), DataLayout(TD) {
|
||||
IL = il ? il : new DefaultIntrinsicLowering();
|
||||
}
|
||||
|
||||
TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
|
||||
const Module &M)
|
||||
TargetMachine::TargetMachine(const std::string &name, const Module &M)
|
||||
: Name(name), DataLayout(name, &M) {
|
||||
IL = il ? il : new DefaultIntrinsicLowering();
|
||||
}
|
||||
|
||||
TargetMachine::~TargetMachine() {
|
||||
delete IL;
|
||||
}
|
||||
|
||||
/// getRelocationModel - Returns the code generation relocation model. The
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "X86.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/CodeGen/IntrinsicLowering.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
#include "llvm/Target/TargetOptions.h"
|
||||
@ -69,10 +68,8 @@ unsigned X86TargetMachine::getModuleMatchQuality(const Module &M) {
|
||||
|
||||
/// X86TargetMachine ctor - Create an ILP32 architecture model
|
||||
///
|
||||
X86TargetMachine::X86TargetMachine(const Module &M,
|
||||
IntrinsicLowering *IL,
|
||||
const std::string &FS)
|
||||
: TargetMachine("X86", IL, true, 4, 4, 4, 4, 4),
|
||||
X86TargetMachine::X86TargetMachine(const Module &M, const std::string &FS)
|
||||
: TargetMachine("X86", true, 4, 4, 4, 4, 4),
|
||||
Subtarget(M, FS),
|
||||
FrameInfo(TargetFrameInfo::StackGrowsDown,
|
||||
Subtarget.getStackAlignment(), -4),
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "X86ISelLowering.h"
|
||||
|
||||
namespace llvm {
|
||||
class IntrinsicLowering;
|
||||
|
||||
class X86TargetMachine : public TargetMachine {
|
||||
X86InstrInfo InstrInfo;
|
||||
@ -33,8 +32,7 @@ class X86TargetMachine : public TargetMachine {
|
||||
X86JITInfo JITInfo;
|
||||
X86TargetLowering TLInfo;
|
||||
public:
|
||||
X86TargetMachine(const Module &M, IntrinsicLowering *IL,
|
||||
const std::string &FS);
|
||||
X86TargetMachine(const Module &M, const std::string &FS);
|
||||
|
||||
virtual const X86InstrInfo *getInstrInfo() const { return &InstrInfo; }
|
||||
virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
|
||||
|
Loading…
Reference in New Issue
Block a user