aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/InstrTypes.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/InstrTypes.h')
-rw-r--r--include/llvm/InstrTypes.h27
1 files changed, 24 insertions, 3 deletions
diff --git a/include/llvm/InstrTypes.h b/include/llvm/InstrTypes.h
index 0a489f3..07d13da 100644
--- a/include/llvm/InstrTypes.h
+++ b/include/llvm/InstrTypes.h
@@ -303,7 +303,9 @@ public:
/// rules.
static Instruction::CastOps getCastOpcode(
const Value *Val, ///< The value to cast
- const Type *Ty ///< The Type to which the value should be casted
+ bool SrcIsSigned, ///< Whether to treat the source as signed
+ const Type *Ty, ///< The Type to which the value should be casted
+ bool DstIsSigned ///< Whether to treate the dest. as signed
);
/// Joins the create method (with insert-before-instruction semantics) above
@@ -316,12 +318,21 @@ public:
/// @brief Inline helper method to join create with getCastOpcode.
inline static CastInst *createInferredCast(
Value *S, ///< The value to be casted (operand 0)
+ bool SrcIsSigned, ///< Whether to treat the source as signed
const Type *Ty, ///< Type to which operand should be casted
+ bool DstIsSigned, ///< Whether to treate the dest. as signed
const std::string &Name = "", ///< Name for the instruction
Instruction *InsertBefore = 0 ///< Place to insert the CastInst
) {
- return create(getCastOpcode(S, Ty), S, Ty, Name, InsertBefore);
+ return create(getCastOpcode(S, SrcIsSigned, Ty, DstIsSigned),
+ S, Ty, Name, InsertBefore);
}
+ static CastInst *createInferredCast(
+ Value *S, ///< The value to be casted (operand 0)
+ const Type *Ty, ///< Type to which operand should be casted
+ const std::string &Name = "", ///< Name for the instruction
+ Instruction *InsertBefore = 0 ///< Place to insert the CastInst
+ );
/// Joins the get method (with insert-at-end-of-block semantics) method
/// above with the getCastOpcode method. getOpcode(S,Ty) is called first to
@@ -334,13 +345,23 @@ public:
/// @brief Inline helper method to join create with getCastOpcode.
inline static CastInst *createInferredCast(
Value *S, ///< The value to be casted (operand 0)
+ bool SrcIsSigned, ///< Whether to treat the source as signed
const Type *Ty, ///< Type to which operand should be casted
+ bool DstIsSigned, ///< Whether to treate the dest. as signed
const std::string &Name, ///< Name for the instruction
BasicBlock *InsertAtEnd ///< The block to insert the instruction into
) {
- return create(getCastOpcode(S, Ty), S, Ty, Name, InsertAtEnd);
+ return create(getCastOpcode(S, SrcIsSigned, Ty, DstIsSigned),
+ S, Ty, Name, InsertAtEnd);
}
+ static CastInst *createInferredCast(
+ Value *S, ///< The value to be casted (operand 0)
+ const Type *Ty, ///< Type to which operand should be casted
+ const std::string &Name, ///< Name for the instruction
+ BasicBlock *InsertAtEnd ///< The block to insert the instruction into
+ );
+
/// There are several places where we need to know if a cast instruction
/// only deals with integer source and destination types. To simplify that
/// logic, this method is provided.