forked from OSchip/llvm-project
parent
86a12015ee
commit
3d38609fdd
|
@ -62,59 +62,57 @@ class MipsCodeEmitter : public MachineFunctionPass {
|
||||||
|
|
||||||
static char ID;
|
static char ID;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MipsCodeEmitter(TargetMachine &tm, JITCodeEmitter &mce) :
|
MipsCodeEmitter(TargetMachine &tm, JITCodeEmitter &mce)
|
||||||
MachineFunctionPass(ID), JTI(0),
|
: MachineFunctionPass(ID), JTI(0),
|
||||||
II((const MipsInstrInfo *) tm.getInstrInfo()),
|
II((const MipsInstrInfo *) tm.getInstrInfo()), TD(tm.getDataLayout()),
|
||||||
TD(tm.getDataLayout()), TM(tm), MCE(mce), MCPEs(0), MJTEs(0),
|
TM(tm), MCE(mce), MCPEs(0), MJTEs(0),
|
||||||
IsPIC(TM.getRelocationModel() == Reloc::PIC_) {
|
IsPIC(TM.getRelocationModel() == Reloc::PIC_) {}
|
||||||
}
|
|
||||||
|
|
||||||
bool runOnMachineFunction(MachineFunction &MF);
|
bool runOnMachineFunction(MachineFunction &MF);
|
||||||
|
|
||||||
virtual const char *getPassName() const {
|
virtual const char *getPassName() const {
|
||||||
return "Mips Machine Code Emitter";
|
return "Mips Machine Code Emitter";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 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
|
||||||
/// machine instructions.
|
/// machine instructions.
|
||||||
uint64_t getBinaryCodeForInstr(const MachineInstr &MI) const;
|
uint64_t getBinaryCodeForInstr(const MachineInstr &MI) const;
|
||||||
|
|
||||||
void emitInstruction(const MachineInstr &MI);
|
void emitInstruction(const MachineInstr &MI);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void emitWord(unsigned Word);
|
void emitWord(unsigned Word);
|
||||||
|
|
||||||
/// Routines that handle operands which add machine relocations which are
|
/// Routines that handle operands which add machine relocations which are
|
||||||
/// fixed up by the relocation stage.
|
/// fixed up by the relocation stage.
|
||||||
void emitGlobalAddress(const GlobalValue *GV, unsigned Reloc,
|
void emitGlobalAddress(const GlobalValue *GV, unsigned Reloc,
|
||||||
bool MayNeedFarStub) const;
|
bool MayNeedFarStub) const;
|
||||||
void emitExternalSymbolAddress(const char *ES, unsigned Reloc) const;
|
void emitExternalSymbolAddress(const char *ES, unsigned Reloc) const;
|
||||||
void emitConstPoolAddress(unsigned CPI, unsigned Reloc) const;
|
void emitConstPoolAddress(unsigned CPI, unsigned Reloc) const;
|
||||||
void emitJumpTableAddress(unsigned JTIndex, unsigned Reloc) const;
|
void emitJumpTableAddress(unsigned JTIndex, unsigned Reloc) const;
|
||||||
void emitMachineBasicBlock(MachineBasicBlock *BB, unsigned Reloc) const;
|
void emitMachineBasicBlock(MachineBasicBlock *BB, unsigned Reloc) const;
|
||||||
|
|
||||||
/// getMachineOpValue - Return binary encoding of operand. If the machine
|
/// getMachineOpValue - Return binary encoding of operand. If the machine
|
||||||
/// operand requires relocation, record the relocation and return zero.
|
/// operand requires relocation, record the relocation and return zero.
|
||||||
unsigned getMachineOpValue(const MachineInstr &MI,
|
unsigned getMachineOpValue(const MachineInstr &MI,
|
||||||
const MachineOperand &MO) const;
|
const MachineOperand &MO) const;
|
||||||
|
|
||||||
unsigned getRelocation(const MachineInstr &MI,
|
unsigned getRelocation(const MachineInstr &MI,
|
||||||
const MachineOperand &MO) const;
|
const MachineOperand &MO) const;
|
||||||
|
|
||||||
unsigned getJumpTargetOpValue(const MachineInstr &MI, unsigned OpNo) const;
|
unsigned getJumpTargetOpValue(const MachineInstr &MI, unsigned OpNo) const;
|
||||||
|
|
||||||
unsigned getBranchTargetOpValue(const MachineInstr &MI,
|
unsigned getBranchTargetOpValue(const MachineInstr &MI, unsigned OpNo) const;
|
||||||
unsigned OpNo) const;
|
unsigned getMemEncoding(const MachineInstr &MI, unsigned OpNo) const;
|
||||||
unsigned getMemEncoding(const MachineInstr &MI, unsigned OpNo) const;
|
unsigned getSizeExtEncoding(const MachineInstr &MI, unsigned OpNo) const;
|
||||||
unsigned getSizeExtEncoding(const MachineInstr &MI, unsigned OpNo) const;
|
unsigned getSizeInsEncoding(const MachineInstr &MI, unsigned OpNo) const;
|
||||||
unsigned getSizeInsEncoding(const MachineInstr &MI, unsigned OpNo) const;
|
|
||||||
|
|
||||||
void emitGlobalAddressUnaligned(const GlobalValue *GV, unsigned Reloc,
|
void emitGlobalAddressUnaligned(const GlobalValue *GV, unsigned Reloc,
|
||||||
int Offset) const;
|
int Offset) const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
char MipsCodeEmitter::ID = 0;
|
char MipsCodeEmitter::ID = 0;
|
||||||
|
|
Loading…
Reference in New Issue