[llvm-commits] CVS: llvm/lib/Target/X86/Printer.cpp X86InstrInfo.def

Chris Lattner lattner at cs.uiuc.edu
Sun Dec 1 17:27:00 PST 2002


Changes in directory llvm/lib/Target/X86:

Printer.cpp updated: 1.17 -> 1.18
X86InstrInfo.def updated: 1.28 -> 1.29

---
Log message:

Add rawfrm flags


---
Diffs of the changes:

Index: llvm/lib/Target/X86/Printer.cpp
diff -u llvm/lib/Target/X86/Printer.cpp:1.17 llvm/lib/Target/X86/Printer.cpp:1.18
--- llvm/lib/Target/X86/Printer.cpp:1.17	Thu Nov 21 17:30:00 2002
+++ llvm/lib/Target/X86/Printer.cpp	Sun Dec  1 17:25:59 2002
@@ -78,6 +78,10 @@
          MO.getType() == MachineOperand::MO_UnextendedImmed;
 }
 
+static bool isPCRelativeDisp(const MachineOperand &MO) {
+  return MO.getType() == MachineOperand::MO_PCRelativeDisp;
+}
+
 static bool isScale(const MachineOperand &MO) {
   return isImmediate(MO) &&
            (MO.getImmedValue() == 1 || MO.getImmedValue() == 2 ||
@@ -105,6 +109,9 @@
   case MachineOperand::MO_UnextendedImmed:
     O << (int)MO.getImmedValue();
     return;
+  case MachineOperand::MO_PCRelativeDisp:
+    O << "< " << MO.getVRegValue()->getName() << ">";
+    return;
   default:
     O << "<unknown op ty>"; return;    
   }
@@ -305,13 +312,25 @@
     break;
 
   case X86II::RawFrm:
-    toHex(O, getBaseOpcodeFor(Opcode));
+    // The accepted forms of Raw instructions are:
+    //   1. nop     - No operand required
+    //   2. jmp foo - PC relative displacement operand
+    //
+    assert(MI->getNumOperands() == 0 ||
+           (MI->getNumOperands() == 1 && isPCRelativeDisp(MI->getOperand(0))) &&
+           "Illegal raw instruction!");
+    toHex(O, getBaseOpcodeFor(Opcode)) << " ";
+
+    if (MI->getNumOperands() == 1) {
+      Value *V = MI->getOperand(0).getVRegValue();
+      emitConstant(O, 0, 4);
+    }
+
     O << "\n\t\t\t\t";
     O << getName(MI->getOpCode()) << " ";
 
-    for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
-      if (i) O << ", ";
-      printOp(O, MI->getOperand(i), RI);
+    if (MI->getNumOperands() == 1) {
+      printOp(O, MI->getOperand(0), RI);
     }
     O << "\n";
     return;


Index: llvm/lib/Target/X86/X86InstrInfo.def
diff -u llvm/lib/Target/X86/X86InstrInfo.def:1.28 llvm/lib/Target/X86/X86InstrInfo.def:1.29
--- llvm/lib/Target/X86/X86InstrInfo.def:1.28	Fri Nov 29 06:01:58 2002
+++ llvm/lib/Target/X86/X86InstrInfo.def	Sun Dec  1 17:25:59 2002
@@ -36,9 +36,9 @@
 
 // Flow control instructions
 I(RET         , "ret",   0xCB,    M_RET_FLAG, X86II::RawFrm | X86II::Void)       // ret
-I(JMP         , "jmp",   0xE9, M_BRANCH_FLAG, X86II::Void)                       // jmp foo
-I(JNE         , "jne",   0x85, M_BRANCH_FLAG, X86II::TB | X86II::Void)
-I(JE          , "je",    0x84, M_BRANCH_FLAG, X86II::TB | X86II::Void)
+I(JMP         , "jmp",   0xE9, M_BRANCH_FLAG, X86II::RawFrm | X86II::Void)       // jmp foo
+I(JNE         , "jne",   0x85, M_BRANCH_FLAG, X86II::RawFrm | X86II::TB | X86II::Void)
+I(JE          , "je",    0x84, M_BRANCH_FLAG, X86II::RawFrm | X86II::TB | X86II::Void)
 I(CALLpcrel32 , "call",  0xE8, M_BRANCH_FLAG, X86II::Void)
 
 // Misc instructions





More information about the llvm-commits mailing list