[llvm-commits] CVS: llvm/lib/Target/X86/X86CodeEmitter.cpp X86TargetMachine.h
Alkis Evlogimenos
alkis at niobe.cs.uiuc.edu
Mon Mar 8 21:36:01 PST 2004
Changes in directory llvm/lib/Target/X86:
X86CodeEmitter.cpp updated: 1.56 -> 1.57
X86TargetMachine.h updated: 1.22 -> 1.23
---
Log message:
Add emitInstruction() API so that we can get the bytes of a simple instruction
---
Diffs of the changes: (+20 -3)
Index: llvm/lib/Target/X86/X86CodeEmitter.cpp
diff -u llvm/lib/Target/X86/X86CodeEmitter.cpp:1.56 llvm/lib/Target/X86/X86CodeEmitter.cpp:1.57
--- llvm/lib/Target/X86/X86CodeEmitter.cpp:1.56 Mon Mar 8 21:30:12 2004
+++ llvm/lib/Target/X86/X86CodeEmitter.cpp Mon Mar 8 21:34:53 2004
@@ -168,7 +168,6 @@
}
-
namespace {
class Emitter : public MachineFunctionPass {
const X86InstrInfo *II;
@@ -176,7 +175,9 @@
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 @@
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);
@@ -201,6 +203,14 @@
unsigned Op, unsigned RegOpcodeField);
};
+}
+
+// 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
Index: llvm/lib/Target/X86/X86TargetMachine.h
diff -u llvm/lib/Target/X86/X86TargetMachine.h:1.22 llvm/lib/Target/X86/X86TargetMachine.h:1.23
--- llvm/lib/Target/X86/X86TargetMachine.h:1.22 Mon Mar 1 00:43:29 2004
+++ llvm/lib/Target/X86/X86TargetMachine.h Mon Mar 8 21:34:53 2004
@@ -53,6 +53,13 @@
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
More information about the llvm-commits
mailing list