about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorCristian Cadar <cristic@cs.stanford.edu>2009-06-13 02:56:57 +0000
committerCristian Cadar <cristic@cs.stanford.edu>2009-06-13 02:56:57 +0000
commite3f1ff6980e920d64134a92971f342fabe89f5bf (patch)
tree4319ee69e19da342d3f23bbdd809a4e794456a35
parent723545c647d93082444f5b49e132c6c9b406babf (diff)
downloadklee-e3f1ff6980e920d64134a92971f342fabe89f5bf.tar.gz
Added a helper function to construct IFF expressions.
git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@73283 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/klee/Expr.h1
-rw-r--r--lib/Expr/Expr.cpp5
2 files changed, 6 insertions, 0 deletions
diff --git a/include/klee/Expr.h b/include/klee/Expr.h
index 878a70ba..6d4df12e 100644
--- a/include/klee/Expr.h
+++ b/include/klee/Expr.h
@@ -222,6 +222,7 @@ public:
   static ref<Expr> createCoerceToPointerType(ref<Expr> e);
   static ref<Expr> createNot(ref<Expr> e);
   static ref<Expr> createImplies(ref<Expr> hyp, ref<Expr> conc);
+  static ref<Expr> createIff(ref<Expr> e1, ref<Expr> e2);
   static ref<Expr> createIsZero(ref<Expr> e);
 
   /// Create a little endian read of the given type at offset 0 of the
diff --git a/lib/Expr/Expr.cpp b/lib/Expr/Expr.cpp
index 7b680567..695312ef 100644
--- a/lib/Expr/Expr.cpp
+++ b/lib/Expr/Expr.cpp
@@ -301,6 +301,11 @@ ref<Expr> Expr::createImplies(ref<Expr> hyp, ref<Expr> conc) {
   return OrExpr::create(Expr::createNot(hyp), conc);
 }
 
+ref<Expr> Expr::createIff(ref<Expr> e1, ref<Expr> e2) {
+  return AndExpr::create(Expr::createImplies(e1, e2), 
+			 Expr::createImplies(e2, e1));
+}
+
 ref<Expr> Expr::createIsZero(ref<Expr> e) {
   return EqExpr::create(e, ConstantExpr::create(0, e->getWidth()));
 }