mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-13 14:47:00 +00:00
Broke out class definition from SparcV9CodeEmitter, and added ability to take a
MachineCodeEmitter to make a pass-through debugger -- output to memory and to std::cerr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6363 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3c4f63ac55
commit
0cc640e6c8
@ -3,37 +3,14 @@
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "SparcInternals.h"
|
||||
|
||||
namespace {
|
||||
class SparcV9CodeEmitter : public MachineFunctionPass {
|
||||
MachineCodeEmitter &MCE;
|
||||
|
||||
public:
|
||||
SparcV9CodeEmitter(MachineCodeEmitter &M) : MCE(M) {}
|
||||
|
||||
bool runOnMachineFunction(MachineFunction &F);
|
||||
|
||||
private:
|
||||
int64_t getMachineOpValue(MachineOperand &MO);
|
||||
unsigned getValueBit(int64_t Val, unsigned bit);
|
||||
|
||||
void emitConstant(unsigned Val, unsigned Size);
|
||||
|
||||
void emitBasicBlock(MachineBasicBlock &MBB);
|
||||
void emitInstruction(MachineInstr &MI);
|
||||
|
||||
/// Function generated by the CodeEmitterGenerator using TableGen
|
||||
///
|
||||
unsigned getBinaryCodeForInstr(MachineInstr &MI);
|
||||
};
|
||||
}
|
||||
#include "SparcV9CodeEmitter.h"
|
||||
|
||||
bool UltraSparc::addPassesToEmitMachineCode(PassManager &PM,
|
||||
MachineCodeEmitter &MCE) {
|
||||
//PM.add(new SparcV9CodeEmitter(MCE));
|
||||
//MachineCodeEmitter *M = MachineCodeEmitter::createDebugMachineCodeEmitter();
|
||||
MachineCodeEmitter *M =
|
||||
MachineCodeEmitter::createFilePrinterMachineCodeEmitter();
|
||||
MachineCodeEmitter::createFilePrinterMachineCodeEmitter(MCE);
|
||||
PM.add(new SparcV9CodeEmitter(*M));
|
||||
return false;
|
||||
}
|
||||
|
33
lib/Target/SparcV9/SparcV9CodeEmitter.h
Normal file
33
lib/Target/SparcV9/SparcV9CodeEmitter.h
Normal file
@ -0,0 +1,33 @@
|
||||
|
||||
|
||||
#ifndef SPARCV9CODEEMITTER_H
|
||||
#define SPARCV9CODEEMITTER_H
|
||||
|
||||
#include "llvm/CodeGen/MachineCodeEmitter.h"
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
|
||||
class SparcV9CodeEmitter : public MachineFunctionPass {
|
||||
MachineCodeEmitter &MCE;
|
||||
|
||||
public:
|
||||
SparcV9CodeEmitter(MachineCodeEmitter &M) : MCE(M) {}
|
||||
|
||||
bool runOnMachineFunction(MachineFunction &F);
|
||||
|
||||
/// Function generated by the CodeEmitterGenerator using TableGen
|
||||
///
|
||||
static unsigned getBinaryCodeForInstr(MachineInstr &MI);
|
||||
|
||||
private:
|
||||
static int64_t getMachineOpValue(MachineOperand &MO);
|
||||
static unsigned getValueBit(int64_t Val, unsigned bit);
|
||||
|
||||
void emitConstant(unsigned Val, unsigned Size);
|
||||
|
||||
void emitBasicBlock(MachineBasicBlock &MBB);
|
||||
void emitInstruction(MachineInstr &MI);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user