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

Chris Lattner lattner at cs.uiuc.edu
Mon Nov 18 00:58:02 PST 2002


Changes in directory llvm/lib/Target/X86:

X86InstrInfo.h updated: 1.10 -> 1.11
X86InstrInfo.cpp updated: 1.7 -> 1.8

---
Log message:

Expose base opcode


---
Diffs of the changes:

Index: llvm/lib/Target/X86/X86InstrInfo.h
diff -u llvm/lib/Target/X86/X86InstrInfo.h:1.10 llvm/lib/Target/X86/X86InstrInfo.h:1.11
--- llvm/lib/Target/X86/X86InstrInfo.h:1.10	Sun Nov 17 23:37:11 2002
+++ llvm/lib/Target/X86/X86InstrInfo.h	Mon Nov 18 00:56:24 2002
@@ -54,6 +54,7 @@
   
     /// TODO: Mod/RM that uses a fixed opcode extension, like /0
 
+    FormMask       = 7,
 
     //===------------------------------------------------------------------===//
     // Actual flags...
@@ -82,6 +83,12 @@
   ///
   virtual void print(const MachineInstr *MI, std::ostream &O,
                      const TargetMachine &TM) const;
+
+  // getBaseOpcodeFor - This function returns the "base" X86 opcode for the
+  // specified opcode number.
+  //
+  unsigned char getBaseOpcodeFor(unsigned Opcode) const;
+
 
 
   //===--------------------------------------------------------------------===//


Index: llvm/lib/Target/X86/X86InstrInfo.cpp
diff -u llvm/lib/Target/X86/X86InstrInfo.cpp:1.7 llvm/lib/Target/X86/X86InstrInfo.cpp:1.8
--- llvm/lib/Target/X86/X86InstrInfo.cpp:1.7	Sun Nov 17 23:37:11 2002
+++ llvm/lib/Target/X86/X86InstrInfo.cpp	Mon Nov 18 00:56:24 2002
@@ -25,3 +25,16 @@
 }
 
 
+static unsigned char BaseOpcodes[] = {
+#define I(ENUM, NAME, BASEOPCODE, FLAGS, TSFLAGS) BASEOPCODE,
+#include "X86InstrInfo.def"
+};
+
+// getBaseOpcodeFor - This function returns the "base" X86 opcode for the
+// specified opcode number.
+//
+unsigned char X86InstrInfo::getBaseOpcodeFor(unsigned Opcode) const {
+  assert(Opcode < sizeof(BaseOpcodes)/sizeof(BaseOpcodes[0]) &&
+         "Opcode out of range!");
+  return BaseOpcodes[Opcode];
+}





More information about the llvm-commits mailing list