Create a new class, MemOperand, for describing memory references
[oota-llvm.git] / include / llvm / Instruction.h
index 3875cbe3b1e3ecaf2578b5445c9dc773b52c4564..51da49f09f753fa0ab8935fd7cb179cfa82e1310 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
@@ -42,10 +42,10 @@ protected:
               Instruction *InsertBefore = 0);
   Instruction(const Type *Ty, unsigned iType, Use *Ops, unsigned NumOps,
               BasicBlock *InsertAtEnd);
-
-  static void destroyThis(Instruction*v);
-  friend class Value;
 public:
+  // Out of line virtual method, so the vtable, etc has a home.
+  ~Instruction();
+  
   /// mayWriteToMemory - Return true if this instruction may modify memory.
   ///
   bool mayWriteToMemory() const;
@@ -102,21 +102,22 @@ public:
   /// one of the enums that is coming soon (down below)...
   ///
   unsigned getOpcode() const { return getValueID() - InstructionVal; }
-  const char *getOpcodeName() const {
-    return getOpcodeName(getOpcode());
-  }
+  const char *getOpcodeName() const { return getOpcodeName(getOpcode()); }
+  bool isTerminator() const { return isTerminator(getOpcode()); }
+  bool isBinaryOp() const { return isBinaryOp(getOpcode()); }
+  bool isShift() { return isShift(getOpcode()); }
+  bool isCast() const { return isCast(getOpcode()); }
+  
+  
+  
   static const char* getOpcodeName(unsigned OpCode);
 
   static inline bool isTerminator(unsigned OpCode) {
     return OpCode >= TermOpsBegin && OpCode < TermOpsEnd;
   }
 
-  inline bool isTerminator() const {   // Instance of TerminatorInst?
-    return isTerminator(getOpcode());
-  }
-
-  inline bool isBinaryOp() const {
-    return getOpcode() >= BinaryOpsBegin && getOpcode() < BinaryOpsEnd;
+  static inline bool isBinaryOp(unsigned Opcode) {
+    return Opcode >= BinaryOpsBegin && Opcode < BinaryOpsEnd;
   }
 
   /// @brief Determine if the Opcode is one of the shift instructions.
@@ -124,10 +125,6 @@ public:
     return Opcode >= Shl && Opcode <= AShr;
   }
 
-  /// @brief Determine if the instruction's opcode is one of the shift 
-  /// instructions.
-  inline bool isShift() { return isShift(getOpcode()); }
-
   /// isLogicalShift - Return true if this is a logical shift left or a logical
   /// shift right.
   inline bool isLogicalShift() {
@@ -145,11 +142,6 @@ public:
     return OpCode >= CastOpsBegin && OpCode < CastOpsEnd;
   }
 
-  /// @brief Determine if this is one of the CastInst instructions.
-  inline bool isCast() const {
-    return isCast(getOpcode());
-  }
-
   /// isAssociative - Return true if the instruction is associative:
   ///
   ///   Associative operators satisfy:  x op (y op z) === (x op y) op z