about summary refs log tree commit diff homepage
path: root/lib/Expr/Expr.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-06-15 00:52:24 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-06-15 00:52:24 +0000
commit1e3d28e825f936060833c09883f93990586a992a (patch)
treea3207fd90a2cd0271bfd2c20b63333dc7396d1bf /lib/Expr/Expr.cpp
parent427f2cb75e769fd6552ff7054369ca5959ddcaf0 (diff)
downloadklee-1e3d28e825f936060833c09883f93990586a992a.tar.gz
Support partial folding for Add in new constant folding builder.
git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@73363 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Expr/Expr.cpp')
-rw-r--r--lib/Expr/Expr.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Expr/Expr.cpp b/lib/Expr/Expr.cpp
index 5ef71d8c..b6833f24 100644
--- a/lib/Expr/Expr.cpp
+++ b/lib/Expr/Expr.cpp
@@ -373,6 +373,12 @@ ref<ConstantExpr> ConstantExpr::Add(const ref<ConstantExpr> &RHS) {
                               getWidth());
 }
 
+ref<ConstantExpr> ConstantExpr::Neg() {
+  return ConstantExpr::create(ints::sub(0, 
+                                        getConstantValue(), getWidth()),
+                              getWidth());
+}
+
 ref<ConstantExpr> ConstantExpr::Sub(const ref<ConstantExpr> &RHS) {
   return ConstantExpr::create(ints::sub(getConstantValue(), 
                                         RHS->getConstantValue(), getWidth()),