[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineInstr.h

Evan Cheng evan.cheng at apple.com
Wed Nov 29 23:07:40 PST 2006



Changes in directory llvm/include/llvm/CodeGen:

MachineInstr.h updated: 1.202 -> 1.203
---
Log message:

- MachineInstr now keeps a ptr to TargetInstrDescriptor instead of Opcode.
- Remove the ugly TargetInstrDescriptors hack.

---
Diffs of the changes:  (+11 -6)

 MachineInstr.h |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)


Index: llvm/include/llvm/CodeGen/MachineInstr.h
diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.202 llvm/include/llvm/CodeGen/MachineInstr.h:1.203
--- llvm/include/llvm/CodeGen/MachineInstr.h:1.202	Tue Nov 28 16:21:29 2006
+++ llvm/include/llvm/CodeGen/MachineInstr.h	Thu Nov 30 01:07:25 2006
@@ -299,7 +299,7 @@
 /// MachineInstr - Representation of each machine instruction.
 ///
 class MachineInstr {
-  short Opcode;                         // the opcode
+  const TargetInstrDescriptor *TID;     // Instruction descriptor.
   unsigned short NumImplicitOps;        // Number of implicit operands (which
                                         // are determined at construction time).
 
@@ -319,7 +319,7 @@
 
 public:
   /// MachineInstr ctor - This constructor creates a dummy MachineInstr with
-  /// opcode 0 and no operands.
+  /// TID NULL and no operands.
   MachineInstr();
 
   /// MachineInstr ctor - This constructor create a MachineInstr and add the
@@ -337,10 +337,14 @@
 
   const MachineBasicBlock* getParent() const { return parent; }
   MachineBasicBlock* getParent() { return parent; }
+  
+  /// getInstrDescriptor - Returns the target instruction descriptor of this
+  /// MachineInstr.
+  const TargetInstrDescriptor *getInstrDescriptor() const { return TID; }
 
   /// getOpcode - Returns the opcode of this MachineInstr.
   ///
-  const int getOpcode() const { return Opcode; }
+  const int getOpcode() const;
 
   /// Access to explicit operands of the instruction.
   ///
@@ -500,9 +504,10 @@
   // Accessors used to modify instructions in place.
   //
 
-  /// setOpcode - Replace the opcode of the current instruction with a new one.
+  /// setInstrDescriptor - Replace the instruction descriptor (thus opcode) of
+  /// the current instruction with a new one.
   ///
-  void setOpcode(unsigned Op) { Opcode = Op; }
+  void setInstrDescriptor(const TargetInstrDescriptor &tid) { TID = &tid; }
 
   /// RemoveOperand - Erase an operand  from an instruction, leaving it with one
   /// fewer operand than it started with.
@@ -525,7 +530,7 @@
 
   /// addImplicitDefUseOperands - Add all implicit def and use operands to
   /// this instruction.
-  void addImplicitDefUseOperands(const TargetInstrDescriptor &TID);
+  void addImplicitDefUseOperands();
 };
 
 //===----------------------------------------------------------------------===//






More information about the llvm-commits mailing list