mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-19 19:29:31 +00:00
Add emitInstruction() API so that we can get the bytes of a simple instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12252 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f6e8156008
commit
39c2005b70
@ -168,7 +168,6 @@ unsigned JITResolver::emitStubForFunction(Function *F) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
namespace {
|
||||
class Emitter : public MachineFunctionPass {
|
||||
const X86InstrInfo *II;
|
||||
@ -176,7 +175,9 @@ namespace {
|
||||
std::map<const BasicBlock*, unsigned> BasicBlockAddrs;
|
||||
std::vector<std::pair<const BasicBlock*, unsigned> > BBRefs;
|
||||
public:
|
||||
Emitter(MachineCodeEmitter &mce) : II(0), MCE(mce) {}
|
||||
explicit Emitter(MachineCodeEmitter &mce) : II(0), MCE(mce) {}
|
||||
Emitter(MachineCodeEmitter &mce, const X86InstrInfo& ii)
|
||||
: II(&ii), MCE(mce) {}
|
||||
|
||||
bool runOnMachineFunction(MachineFunction &MF);
|
||||
|
||||
@ -184,9 +185,10 @@ namespace {
|
||||
return "X86 Machine Code Emitter";
|
||||
}
|
||||
|
||||
void emitInstruction(const MachineInstr &MI);
|
||||
|
||||
private:
|
||||
void emitBasicBlock(const MachineBasicBlock &MBB);
|
||||
void emitInstruction(const MachineInstr &MI);
|
||||
|
||||
void emitPCRelativeBlockAddress(const BasicBlock *BB);
|
||||
void emitMaybePCRelativeValue(unsigned Address, bool isPCRelative);
|
||||
@ -203,6 +205,14 @@ namespace {
|
||||
};
|
||||
}
|
||||
|
||||
// This function is required by Printer.cpp to workaround gas bugs
|
||||
void llvm::X86::emitInstruction(MachineCodeEmitter& mce,
|
||||
const X86InstrInfo& ii,
|
||||
const MachineInstr& mi)
|
||||
{
|
||||
Emitter(mce, ii).emitInstruction(mi);
|
||||
}
|
||||
|
||||
/// addPassesToEmitMachineCode - Add passes to the specified pass manager to get
|
||||
/// machine code emitted. This uses a MachineCodeEmitter object to handle
|
||||
/// actually outputting the machine code and resolving things like the address
|
||||
|
@ -53,6 +53,13 @@ public:
|
||||
virtual bool addPassesToEmitAssembly(PassManager &PM, std::ostream &Out);
|
||||
};
|
||||
|
||||
// this is implemented in X86CodeEmitter.cpp
|
||||
namespace X86 {
|
||||
void emitInstruction(MachineCodeEmitter& mce,
|
||||
const X86InstrInfo& ii,
|
||||
const MachineInstr& MI);
|
||||
}
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user