mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-19 10:13:13 +00:00
detemplatize alpha code emission, it is now JIT specific.
llvm-svn: 95133
This commit is contained in:
parent
21bcba21e7
commit
aad5bcaecb
@ -28,11 +28,14 @@
|
|||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
class AlphaCodeEmitter : public MachineFunctionPass {
|
||||||
class AlphaCodeEmitter {
|
JITCodeEmitter &MCE;
|
||||||
MachineCodeEmitter &MCE;
|
const AlphaInstrInfo *II;
|
||||||
public:
|
public:
|
||||||
AlphaCodeEmitter(MachineCodeEmitter &mce) : MCE(mce) {}
|
static char ID;
|
||||||
|
|
||||||
|
AlphaCodeEmitter(JITCodeEmitter &mce) : MachineFunctionPass(&ID),
|
||||||
|
MCE(mce) {}
|
||||||
|
|
||||||
/// getBinaryCodeForInstr - This function, generated by the
|
/// getBinaryCodeForInstr - This function, generated by the
|
||||||
/// CodeEmitterGenerator using TableGen, produces the binary encoding for
|
/// CodeEmitterGenerator using TableGen, produces the binary encoding for
|
||||||
@ -44,23 +47,6 @@ namespace {
|
|||||||
|
|
||||||
unsigned getMachineOpValue(const MachineInstr &MI,
|
unsigned getMachineOpValue(const MachineInstr &MI,
|
||||||
const MachineOperand &MO);
|
const MachineOperand &MO);
|
||||||
};
|
|
||||||
|
|
||||||
template <class CodeEmitter>
|
|
||||||
class Emitter : public MachineFunctionPass, public AlphaCodeEmitter
|
|
||||||
{
|
|
||||||
const AlphaInstrInfo *II;
|
|
||||||
TargetMachine &TM;
|
|
||||||
CodeEmitter &MCE;
|
|
||||||
|
|
||||||
public:
|
|
||||||
static char ID;
|
|
||||||
explicit Emitter(TargetMachine &tm, CodeEmitter &mce)
|
|
||||||
: MachineFunctionPass(&ID), AlphaCodeEmitter(mce),
|
|
||||||
II(0), TM(tm), MCE(mce) {}
|
|
||||||
Emitter(TargetMachine &tm, CodeEmitter &mce, const AlphaInstrInfo& ii)
|
|
||||||
: MachineFunctionPass(&ID), AlphaCodeEmitter(mce),
|
|
||||||
II(&ii), TM(tm), MCE(mce) {}
|
|
||||||
|
|
||||||
bool runOnMachineFunction(MachineFunction &MF);
|
bool runOnMachineFunction(MachineFunction &MF);
|
||||||
|
|
||||||
@ -71,9 +57,6 @@ namespace {
|
|||||||
private:
|
private:
|
||||||
void emitBasicBlock(MachineBasicBlock &MBB);
|
void emitBasicBlock(MachineBasicBlock &MBB);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class CodeEmitter>
|
|
||||||
char Emitter<CodeEmitter>::ID = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// createAlphaCodeEmitterPass - Return a pass that emits the collected Alpha
|
/// createAlphaCodeEmitterPass - Return a pass that emits the collected Alpha
|
||||||
@ -81,11 +64,10 @@ namespace {
|
|||||||
|
|
||||||
FunctionPass *llvm::createAlphaJITCodeEmitterPass(AlphaTargetMachine &TM,
|
FunctionPass *llvm::createAlphaJITCodeEmitterPass(AlphaTargetMachine &TM,
|
||||||
JITCodeEmitter &JCE) {
|
JITCodeEmitter &JCE) {
|
||||||
return new Emitter<JITCodeEmitter>(TM, JCE);
|
return new AlphaCodeEmitter(JCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class CodeEmitter>
|
bool AlphaCodeEmitter::runOnMachineFunction(MachineFunction &MF) {
|
||||||
bool Emitter<CodeEmitter>::runOnMachineFunction(MachineFunction &MF) {
|
|
||||||
II = ((AlphaTargetMachine&)MF.getTarget()).getInstrInfo();
|
II = ((AlphaTargetMachine&)MF.getTarget()).getInstrInfo();
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@ -97,8 +79,7 @@ bool Emitter<CodeEmitter>::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class CodeEmitter>
|
void AlphaCodeEmitter::emitBasicBlock(MachineBasicBlock &MBB) {
|
||||||
void Emitter<CodeEmitter>::emitBasicBlock(MachineBasicBlock &MBB) {
|
|
||||||
MCE.StartMachineBasicBlock(&MBB);
|
MCE.StartMachineBasicBlock(&MBB);
|
||||||
for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end();
|
for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user