aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-12-29 00:12:50 +0000
committerChris Lattner <sabre@nondot.org>2008-12-29 00:12:50 +0000
commitb76ec320dc2d612990139122c01a1945f9d0e654 (patch)
tree4a874bf0419e1042b7b4d8fdfa849c879701e06a /include
parentd4f6fe55ebe9d053cab73f5e67cac95e32df887b (diff)
downloadexternal_llvm-b76ec320dc2d612990139122c01a1945f9d0e654.zip
external_llvm-b76ec320dc2d612990139122c01a1945f9d0e654.tar.gz
external_llvm-b76ec320dc2d612990139122c01a1945f9d0e654.tar.bz2
move select validation logic into a shared place where the select ctor,
verifier, asm parser, etc can share it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61461 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Instructions.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index bc4abc9..b833c67 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -1208,6 +1208,7 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CallInst, Value)
///
class SelectInst : public Instruction {
void init(Value *C, Value *S1, Value *S2) {
+ assert(!areInvalidOperands(C, S1, S2) && "Invalid operands for select");
Op<0>() = C;
Op<1>() = S1;
Op<2>() = S2;
@@ -1246,6 +1247,10 @@ public:
Value *getCondition() const { return Op<0>(); }
Value *getTrueValue() const { return Op<1>(); }
Value *getFalseValue() const { return Op<2>(); }
+
+ /// areInvalidOperands - Return a string if the specified operands are invalid
+ /// for a select operation, otherwise return null.
+ static const char *areInvalidOperands(Value *Cond, Value *True, Value *False);
/// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);