Revert "Revert "Add Constant Hoisting Pass" (r200034)"
[oota-llvm.git] / include / llvm / Analysis / TargetTransformInfo.h
index a8975b7a4f931b9dd7d4f4c160bd06b4ff06da44..f2613e35c5e35af72cf4082b2bf81efc95304c23 100644 (file)
@@ -92,6 +92,7 @@ public:
   enum TargetCostConstants {
     TCC_Free = 0,       ///< Expected to fold away in lowering.
     TCC_Basic = 1,      ///< The cost of a typical 'add' instruction.
+    TCC_Load = 3,
     TCC_Expensive = 4   ///< The cost of a 'div' instruction on x86.
   };
 
@@ -299,6 +300,13 @@ public:
   /// immediate of the specified type.
   virtual unsigned getIntImmCost(const APInt &Imm, Type *Ty) const;
 
+  /// \brief Return the expected cost of materialization for the given integer
+  /// immediate of the specified type for a given instruction. The cost can be
+  /// zero if the immediate can be folded into the specified instruction.
+  virtual unsigned getIntImmCost(unsigned Opcode, const APInt &Imm,
+                                 Type *Ty) const;
+  virtual unsigned getIntImmCost(Intrinsic::ID IID, const APInt &Imm,
+                                 Type *Ty) const;
   /// @}
 
   /// \name Vector Target Information