diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-06-26 06:17:51 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-06-26 06:17:51 +0000 |
commit | 8e62069f6298f517f97a333bdc3a7b1c50adad64 (patch) | |
tree | 01d56b6c853307ed749c5a25a2c811abefd6d568 /include | |
parent | 553e2871ba937a91da303190631daf627f83eabb (diff) | |
download | klee-8e62069f6298f517f97a333bdc3a7b1c50adad64.tar.gz |
More large integer support.
- Allow constructing a ConstantExpr from an APInt, too painful otherwise. - Parser support for large integers. git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@74278 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/klee/Expr.h | 15 | ||||
-rw-r--r-- | include/klee/ExprBuilder.h | 6 |
2 files changed, 11 insertions, 10 deletions
diff --git a/include/klee/Expr.h b/include/klee/Expr.h index e880719e..e3a57123 100644 --- a/include/klee/Expr.h +++ b/include/klee/Expr.h @@ -301,12 +301,6 @@ private: ConstantExpr(const llvm::APInt &v) : value(v) {} - static ref<ConstantExpr> alloc(const llvm::APInt &v) { - ref<ConstantExpr> r(new ConstantExpr(v)); - r->computeHash(); - return r; - } - public: ~ConstantExpr() {}; @@ -353,12 +347,15 @@ public: static ref<Expr> fromMemory(void *address, Width w); void toMemory(void *address); - static ref<ConstantExpr> alloc(uint64_t v, Width w) { - // constructs an "optimized" ConstantExpr - ref<ConstantExpr> r(new ConstantExpr(llvm::APInt(w, v))); + static ref<ConstantExpr> alloc(const llvm::APInt &v) { + ref<ConstantExpr> r(new ConstantExpr(v)); r->computeHash(); return r; } + + static ref<ConstantExpr> alloc(uint64_t v, Width w) { + return alloc(llvm::APInt(w, v)); + } static ref<ConstantExpr> create(uint64_t v, Width w) { assert(v == bits64::truncateToNBits(v, w) && diff --git a/include/klee/ExprBuilder.h b/include/klee/ExprBuilder.h index 18941876..2bbcf545 100644 --- a/include/klee/ExprBuilder.h +++ b/include/klee/ExprBuilder.h @@ -23,7 +23,7 @@ namespace klee { // Expressions - virtual ref<Expr> Constant(uint64_t Value, Expr::Width W) = 0; + virtual ref<Expr> Constant(const llvm::APInt &Value) = 0; virtual ref<Expr> NotOptimized(const ref<Expr> &Index) = 0; virtual ref<Expr> Read(const UpdateList &Updates, const ref<Expr> &Index) = 0; @@ -67,6 +67,10 @@ namespace klee { ref<Expr> Not(const ref<Expr> &LHS) { return Eq(False(), LHS); } + + ref<Expr> Constant(uint64_t Value, Expr::Width W) { + return Constant(llvm::APInt(W, Value)); + } }; /// createDefaultExprBuilder - Create an expression builder which does no |