Initial support for carrying MachineInstrs in SUnits.
[oota-llvm.git] / include / llvm / CodeGen / MachineInstr.h
index bcbcf316d058d1f1a5e68902017e60a47fd1cd56..8efea6244258e3207e47cd326892155196caa852 100644 (file)
@@ -21,6 +21,7 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/CodeGen/MachineOperand.h"
 #include "llvm/CodeGen/MachineMemOperand.h"
+#include "llvm/Target/TargetInstrDesc.h"
 #include <list>
 #include <vector>
 
@@ -89,7 +90,7 @@ public:
 
   /// getOpcode - Returns the opcode of this MachineInstr.
   ///
-  int getOpcode() const;
+  int getOpcode() const { return TID->Opcode; }
 
   /// Access to explicit operands of the instruction.
   ///
@@ -249,6 +250,16 @@ public:
   /// the instruction's location and its intended destination.
   bool isSafeToMove(const TargetInstrInfo *TII, bool &SawStore);
 
+  /// isSafeToReMat - Return true if it's safe to rematerialize the specified
+  /// instruction which defined the specified register instead of copying it.
+  bool isSafeToReMat(const TargetInstrInfo *TII, unsigned DstReg);
+
+  /// hasVolatileMemoryRef - Return true if this instruction may have a
+  /// volatile memory reference, or if the information describing the
+  /// memory reference is not available. Return false if it is known to
+  /// have no volatile memory references.
+  bool hasVolatileMemoryRef() const;
+
   //
   // Debugging support
   //
@@ -257,6 +268,11 @@ public:
   }
   void print(std::ostream &OS, const TargetMachine *TM = 0) const;
   void print(std::ostream *OS) const { if (OS) print(*OS); }
+  void print(raw_ostream *OS, const TargetMachine *TM) const {
+    if (OS) print(*OS, TM);
+  }
+  void print(raw_ostream &OS, const TargetMachine *TM = 0) const;
+  void print(raw_ostream *OS) const { if (OS) print(*OS); }
   void dump() const;
 
   //===--------------------------------------------------------------------===//
@@ -315,6 +331,11 @@ inline std::ostream& operator<<(std::ostream &OS, const MachineInstr &MI) {
   return OS;
 }
 
+inline raw_ostream& operator<<(raw_ostream &OS, const MachineInstr &MI) {
+  MI.print(OS);
+  return OS;
+}
+
 } // End llvm namespace
 
 #endif