From e75c0c0eac2373f35965d3aed80585b23c59c052 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 12 Mar 2004 05:50:39 +0000 Subject: [PATCH] Add support for select constant exprs llvm-svn: 12309 --- llvm/include/llvm/Constants.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/llvm/include/llvm/Constants.h b/llvm/include/llvm/Constants.h index 6a02c5df215b..1d4892f118e9 100644 --- a/llvm/include/llvm/Constants.h +++ b/llvm/include/llvm/Constants.h @@ -518,6 +518,8 @@ protected: ConstantExpr(unsigned Opcode, Constant *C, const Type *Ty); // Binary/Shift instruction creation ctor ConstantExpr(unsigned Opcode, Constant *C1, Constant *C2); + // Select instruction creation ctor + ConstantExpr(Constant *C, Constant *V1, Constant *V2); // GEP instruction creation ctor ConstantExpr(Constant *C, const std::vector &IdxList, const Type *DestTy); @@ -528,6 +530,8 @@ protected: Constant *C1, Constant *C2); static Constant *getShiftTy(const Type *Ty, unsigned Opcode, Constant *C1, Constant *C2); + static Constant *getSelectTy(const Type *Ty, + Constant *C1, Constant *C2, Constant *C3); static Constant *getGetElementPtrTy(const Type *Ty, Constant *C, const std::vector &IdxList); @@ -541,6 +545,13 @@ public: /// static Constant *getCast(Constant *C, const Type *Ty); + /// Select constant expr + /// + static Constant *getSelect(Constant *C, Constant *V1, Constant *V2) { + return getSelectTy(V1->getType(), C, V1, V2); + } + + /// ConstantExpr::get - Return a binary or shift operator constant expression, /// folding if possible. ///