summaryrefslogtreecommitdiff
path: root/include/llvm/Constants.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-02-09 16:43:07 +0000
committerChris Lattner <sabre@nondot.org>2011-02-09 16:43:07 +0000
commit74f5c5abeafeaabefab470390ce0e7a36754c592 (patch)
treef3e4151df855637c26532fc377aaf16b604c05a2 /include/llvm/Constants.h
parentf18ed3853a9def03566ca44af1650c149af19711 (diff)
downloadllvm-74f5c5abeafeaabefab470390ce0e7a36754c592.tar.gz
llvm-74f5c5abeafeaabefab470390ce0e7a36754c592.tar.bz2
llvm-74f5c5abeafeaabefab470390ce0e7a36754c592.tar.xz
refactor ConstantExpr interfaces a bit around "exactness".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125190 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Constants.h')
-rw-r--r--include/llvm/Constants.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h
index 56f39b9b09..5648d992b9 100644
--- a/include/llvm/Constants.h
+++ b/include/llvm/Constants.h
@@ -691,8 +691,8 @@ public:
static Constant *getFSub(Constant *C1, Constant *C2);
static Constant *getMul(Constant *C1, Constant *C2);
static Constant *getFMul(Constant *C1, Constant *C2);
- static Constant *getUDiv(Constant *C1, Constant *C2);
- static Constant *getSDiv(Constant *C1, Constant *C2);
+ static Constant *getUDiv(Constant *C1, Constant *C2, bool isExact = false);
+ static Constant *getSDiv(Constant *C1, Constant *C2, bool isExact = false);
static Constant *getFDiv(Constant *C1, Constant *C2);
static Constant *getURem(Constant *C1, Constant *C2);
static Constant *getSRem(Constant *C1, Constant *C2);
@@ -701,8 +701,8 @@ public:
static Constant *getOr(Constant *C1, Constant *C2);
static Constant *getXor(Constant *C1, Constant *C2);
static Constant *getShl(Constant *C1, Constant *C2);
- static Constant *getLShr(Constant *C1, Constant *C2);
- static Constant *getAShr(Constant *C1, Constant *C2);
+ static Constant *getLShr(Constant *C1, Constant *C2, bool isExact = false);
+ static Constant *getAShr(Constant *C1, Constant *C2, bool isExact = false);
static Constant *getTrunc (Constant *C, const Type *Ty);
static Constant *getSExt (Constant *C, const Type *Ty);
static Constant *getZExt (Constant *C, const Type *Ty);
@@ -726,10 +726,18 @@ public:
static Constant *getNUWMul(Constant *C1, Constant *C2);
static Constant *getNSWShl(Constant *C1, Constant *C2);
static Constant *getNUWShl(Constant *C1, Constant *C2);
- static Constant *getExactSDiv(Constant *C1, Constant *C2);
- static Constant *getExactUDiv(Constant *C1, Constant *C2);
- static Constant *getExactAShr(Constant *C1, Constant *C2);
- static Constant *getExactLShr(Constant *C1, Constant *C2);
+ static Constant *getExactSDiv(Constant *C1, Constant *C2) {
+ return getSDiv(C1, C2, true);
+ }
+ static Constant *getExactUDiv(Constant *C1, Constant *C2) {
+ return getUDiv(C1, C2, true);
+ }
+ static Constant *getExactAShr(Constant *C1, Constant *C2) {
+ return getAShr(C1, C2, true);
+ }
+ static Constant *getExactLShr(Constant *C1, Constant *C2) {
+ return getLShr(C1, C2, true);
+ }
/// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant);