[llvm-commits] CVS: llvm/include/llvm/Constants.h InstrTypes.h

Reid Spencer reid at x10sys.com
Mon Dec 4 15:14:41 PST 2006



Changes in directory llvm/include/llvm:

Constants.h updated: 1.101 -> 1.102
InstrTypes.h updated: 1.51 -> 1.52
---
Log message:

Add cast creation functions for Pointer Casts, either BitCast or PtrToInt


---
Diffs of the changes:  (+23 -1)

 Constants.h  |    8 +++++++-
 InstrTypes.h |   16 ++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)


Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.101 llvm/include/llvm/Constants.h:1.102
--- llvm/include/llvm/Constants.h:1.101	Mon Dec  4 15:34:17 2006
+++ llvm/include/llvm/Constants.h	Mon Dec  4 17:14:27 2006
@@ -561,6 +561,12 @@
     const Type *Ty ///< The type to trunc or bitcast C to
   );
 
+  /// @brief Create a BitCast or a PtrToInt cast constant expression
+  static Constant *getPointerCast(
+    Constant *C,   ///< The pointer value to be casted (operand 0)
+    const Type *Ty ///< The type to which cast should be made
+  );
+
   // This method uses the CastInst::getCastOpcode method to infer the
   // cast opcode to use. 
   // @brief Get a ConstantExpr Conversion operator that casts C to Ty
@@ -597,7 +603,7 @@
   ///
   static Constant *get(unsigned Opcode, Constant *C1, Constant *C2);
 
-  /// @brief Return an ICmp or FCmp comparison operator constante expression.
+  /// @brief Return an ICmp or FCmp comparison operator constant expression.
   static Constant *getCompare(unsigned Opcode, unsigned short pred, 
                               Constant *C1, Constant *C2);
 


Index: llvm/include/llvm/InstrTypes.h
diff -u llvm/include/llvm/InstrTypes.h:1.51 llvm/include/llvm/InstrTypes.h:1.52
--- llvm/include/llvm/InstrTypes.h:1.51	Mon Dec  4 14:17:56 2006
+++ llvm/include/llvm/InstrTypes.h	Mon Dec  4 17:14:27 2006
@@ -323,6 +323,22 @@
     Instruction *InsertBefore = 0 ///< Place to insert the instruction
   );
 
+  /// @brief Create a BitCast or a PtrToInt cast instruction
+  static CastInst *createPointerCast(
+    Value *S,                ///< The pointer value to be casted (operand 0)
+    const Type *Ty,          ///< The type to which operand is casted
+    const std::string &Name, ///< The name for the instruction
+    BasicBlock *InsertAtEnd  ///< The block to insert the instruction into
+  );
+
+  /// @brief Create a BitCast or a PtrToInt cast instruction
+  static CastInst *createPointerCast(
+    Value *S,                ///< The pointer value to be casted (operand 0)
+    const Type *Ty,          ///< The type to which cast should be made
+    const std::string &Name = "", ///< Name for the instruction
+    Instruction *InsertBefore = 0 ///< Place to insert the instruction
+  );
+
   /// @brief Create a SExt or BitCast cast instruction
   static CastInst *createSExtOrBitCast(
     Value *S,                ///< The value to be casted (operand 0)






More information about the llvm-commits mailing list