Use MachineBasicBlock::transferSuccessors.
[oota-llvm.git] / include / llvm / Target / TargetInstrInfo.h
index d19ca1242062ab23494a2070dc01390cd6c84abb..a2dc86f4a3ad08c028c80e1ee4ce8f7985a64c32 100644 (file)
@@ -49,16 +49,9 @@ public:
     LABEL = 2,
     DECLARE = 3,
     EXTRACT_SUBREG = 4,
-    INSERT_SUBREG = 5
-  };
-  
-  // Target independent implict values for use with subreg insert. All targets
-  // that support insert_subreg support IMPL_VAL_UNDEF. Support for the other 
-  // values is target dependent.
-  enum ImplictVal {
-    IMPL_VAL_UNDEF = 0,
-    IMPL_VAL_ZERO  = 1,
-    LAST_IMPL_VAL  = 3
+    INSERT_SUBREG = 5,
+    IMPLICIT_DEF = 6,
+    SUBREG_TO_REG = 7
   };
 
   unsigned getNumOpcodes() const { return NumOpcodes; }
@@ -74,7 +67,7 @@ public:
   /// isTriviallyReMaterializable - Return true if the instruction is trivially
   /// rematerializable, meaning it has no side effects and requires no operands
   /// that aren't always available.
-  bool isTriviallyReMaterializable(MachineInstr *MI) const {
+  bool isTriviallyReMaterializable(const MachineInstr *MI) const {
     return MI->getDesc().isRematerializable() &&
            isReallyTriviallyReMaterializable(MI);
   }
@@ -88,7 +81,7 @@ protected:
   /// return false if the instruction has any side effects other than
   /// producing a value, or if it requres any address registers that are not
   /// always available.
-  virtual bool isReallyTriviallyReMaterializable(MachineInstr *MI) const {
+  virtual bool isReallyTriviallyReMaterializable(const MachineInstr *MI) const {
     return true;
   }
 
@@ -119,6 +112,13 @@ public:
     return 0;
   }
 
+  /// reMaterialize - Re-issue the specified 'original' instruction at the
+  /// specific location targeting a new destination register.
+  virtual void reMaterialize(MachineBasicBlock &MBB,
+                             MachineBasicBlock::iterator MI,
+                             unsigned DestReg,
+                             const MachineInstr *Orig) const = 0;
+
   /// isInvariantLoad - Return true if the specified instruction (which is
   /// marked mayLoad) is loading from a location whose value is invariant across
   /// the function.  For example, loading a value from the constant pool or from
@@ -155,7 +155,10 @@ public:
   /// return a new machine instruction.  If an instruction cannot commute, it
   /// can also return null.
   ///
-  virtual MachineInstr *commuteInstruction(MachineInstr *MI) const = 0;
+  /// If NewMI is true, then a new machine instruction must be created.
+  ///
+  virtual MachineInstr *commuteInstruction(MachineInstr *MI,
+                                           bool NewMI = false) const = 0;
 
   /// CommuteChangesDestination - Return true if commuting the specified
   /// instruction will also changes the destination operand. Also return the
@@ -388,6 +391,18 @@ public:
     abort();
     return 0; // Must return a value in order to compile with VS 2005
   }
+
+  /// GetInstSize - Returns the size of the specified Instruction.
+  /// 
+  virtual unsigned GetInstSizeInBytes(const MachineInstr *MI) const {
+    assert(0 && "Target didn't implement TargetInstrInfo::GetInstSize!");
+    return 0;
+  }
+
+  /// GetFunctionSizeInBytes - Returns the size of the specified MachineFunction.
+  /// 
+  virtual unsigned GetFunctionSizeInBytes(const MachineFunction &MF) const = 0;
+
 };
 
 /// TargetInstrInfoImpl - This is the default implementation of
@@ -399,12 +414,17 @@ protected:
   TargetInstrInfoImpl(const TargetInstrDesc *desc, unsigned NumOpcodes)
   : TargetInstrInfo(desc, NumOpcodes) {}
 public:
-  virtual MachineInstr *commuteInstruction(MachineInstr *MI) const;
+  virtual MachineInstr *commuteInstruction(MachineInstr *MI,
+                                           bool NewMI = false) const;
   virtual bool CommuteChangesDestination(MachineInstr *MI,
                                          unsigned &OpIdx) const;
   virtual bool PredicateInstruction(MachineInstr *MI,
                               const std::vector<MachineOperand> &Pred) const;
-  
+  virtual void reMaterialize(MachineBasicBlock &MBB,
+                             MachineBasicBlock::iterator MI,
+                             unsigned DestReg,
+                             const MachineInstr *Orig) const;
+  virtual unsigned GetFunctionSizeInBytes(const MachineFunction &MF) const;
 };
 
 } // End llvm namespace