[llvm-commits] CVS: llvm/lib/Target/X86/MachineCodeEmitter.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Dec 2 15:57:01 PST 2002
Changes in directory llvm/lib/Target/X86:
MachineCodeEmitter.cpp updated: 1.2 -> 1.3
---
Log message:
More support for machine code emission: raw instructions
---
Diffs of the changes:
Index: llvm/lib/Target/X86/MachineCodeEmitter.cpp
diff -u llvm/lib/Target/X86/MachineCodeEmitter.cpp:1.2 llvm/lib/Target/X86/MachineCodeEmitter.cpp:1.3
--- llvm/lib/Target/X86/MachineCodeEmitter.cpp:1.2 Mon Dec 2 15:44:34 2002
+++ llvm/lib/Target/X86/MachineCodeEmitter.cpp Mon Dec 2 15:56:18 2002
@@ -13,10 +13,12 @@
namespace {
struct Emitter : public FunctionPass {
- TargetMachine &TM;
- MachineCodeEmitter &MCE;
+ X86TargetMachine &TM;
+ const X86InstrInfo ⅈ
+ MachineCodeEmitter &MCE;
- Emitter(TargetMachine &tm, MachineCodeEmitter &mce) : TM(tm), MCE(mce) {}
+ Emitter(X86TargetMachine &tm, MachineCodeEmitter &mce)
+ : TM(tm), II(TM.getInstrInfo()), MCE(mce) {}
bool runOnFunction(Function &F);
@@ -56,14 +58,21 @@
void Emitter::emitInstruction(MachineInstr &MI) {
unsigned Opcode = MI.getOpcode();
- const MachineInstrDescriptor &Desc = TM.getInstrInfo().get(Opcode);
+ const MachineInstrDescriptor &Desc = II.get(Opcode);
// Emit instruction prefixes if neccesary
if (Desc.TSFlags & X86II::OpSize) MCE.emitByte(0x66);// Operand size...
- if (Desc.TSFlags & X86II::TB) MCE.emitByte(0x0F); // Two-byte opcode prefix
+ if (Desc.TSFlags & X86II::TB) MCE.emitByte(0x0F);// Two-byte opcode prefix
switch (Desc.TSFlags & X86II::FormMask) {
case X86II::RawFrm:
- ;
+ MCE.emitByte(II.getBaseOpcodeFor(Opcode));
+
+ if (MI.getNumOperands() == 1) {
+ assert(MI.getOperand(0).getType() == MachineOperand::MO_PCRelativeDisp);
+ MCE.emitPCRelativeDisp(MI.getOperand(0).getVRegValue());
+ }
+
+ break;
}
}
More information about the llvm-commits
mailing list