diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-06-02 17:01:00 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-06-02 17:01:00 +0000 |
commit | 4aea9d3d47e7e47630704fdf6628221fa45f6151 (patch) | |
tree | 5e74319cdcc91f362f6d27bd4befcb5c42131d66 /lib/Expr/Expr.cpp | |
parent | 1016ee0df2a459881d6f9930f7b72929e8bdc8b8 (diff) | |
download | klee-4aea9d3d47e7e47630704fdf6628221fa45f6151.tar.gz |
Use ConstantExpr::alloc instead of ref<Expr> directly
- The "constant optimization" embedded inside ref<Expr> is going away. - No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@72730 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Expr/Expr.cpp')
-rw-r--r-- | lib/Expr/Expr.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/lib/Expr/Expr.cpp b/lib/Expr/Expr.cpp index 55b9a0a4..7f20e3fc 100644 --- a/lib/Expr/Expr.cpp +++ b/lib/Expr/Expr.cpp @@ -43,42 +43,42 @@ ref<Expr> Expr::createTempRead(const Array *array, Expr::Width w) { switch (w) { case Expr::Bool: return ZExtExpr::create(ReadExpr::create(ul, - ref<Expr>(0,kMachinePointerType)), + ConstantExpr::alloc(0,kMachinePointerType)), Expr::Bool); case Expr::Int8: return ReadExpr::create(ul, - ref<Expr>(0,kMachinePointerType)); + ConstantExpr::alloc(0,kMachinePointerType)); case Expr::Int16: return ConcatExpr::create(ReadExpr::create(ul, - ref<Expr>(1,kMachinePointerType)), + ConstantExpr::alloc(1,kMachinePointerType)), ReadExpr::create(ul, - ref<Expr>(0,kMachinePointerType))); + ConstantExpr::alloc(0,kMachinePointerType))); case Expr::Int32: return ConcatExpr::create4(ReadExpr::create(ul, - ref<Expr>(3,kMachinePointerType)), + ConstantExpr::alloc(3,kMachinePointerType)), ReadExpr::create(ul, - ref<Expr>(2,kMachinePointerType)), + ConstantExpr::alloc(2,kMachinePointerType)), ReadExpr::create(ul, - ref<Expr>(1,kMachinePointerType)), + ConstantExpr::alloc(1,kMachinePointerType)), ReadExpr::create(ul, - ref<Expr>(0,kMachinePointerType))); + ConstantExpr::alloc(0,kMachinePointerType))); case Expr::Int64: return ConcatExpr::create8(ReadExpr::create(ul, - ref<Expr>(7,kMachinePointerType)), + ConstantExpr::alloc(7,kMachinePointerType)), ReadExpr::create(ul, - ref<Expr>(6,kMachinePointerType)), + ConstantExpr::alloc(6,kMachinePointerType)), ReadExpr::create(ul, - ref<Expr>(5,kMachinePointerType)), + ConstantExpr::alloc(5,kMachinePointerType)), ReadExpr::create(ul, - ref<Expr>(4,kMachinePointerType)), + ConstantExpr::alloc(4,kMachinePointerType)), ReadExpr::create(ul, - ref<Expr>(3,kMachinePointerType)), + ConstantExpr::alloc(3,kMachinePointerType)), ReadExpr::create(ul, - ref<Expr>(2,kMachinePointerType)), + ConstantExpr::alloc(2,kMachinePointerType)), ReadExpr::create(ul, - ref<Expr>(1,kMachinePointerType)), + ConstantExpr::alloc(1,kMachinePointerType)), ReadExpr::create(ul, - ref<Expr>(0,kMachinePointerType))); + ConstantExpr::alloc(0,kMachinePointerType))); default: assert(0 && "invalid width"); } } @@ -639,7 +639,7 @@ static ref<Expr> SubExpr_create(Expr *l, Expr *r) { if (type == Expr::Bool) { return XorExpr_create(l, r); } else if (*l==*r) { - return ref<Expr>(0, type); + return ConstantExpr::alloc(0, type); } else { Expr::Kind lk = l->getKind(), rk = r->getKind(); if (lk==Expr::Add && l->getKid(0).isConstant()) { // (k+a)-b = k+(a-b) @@ -891,7 +891,7 @@ ref<Expr> _e_op ::create(const ref<Expr> &l, const ref<Expr> &r) { \ static ref<Expr> EqExpr_create(const ref<Expr> &l, const ref<Expr> &r) { if (l == r) { - return ref<Expr>(1, Expr::Bool); + return ConstantExpr::alloc(1, Expr::Bool); } else { return EqExpr::alloc(l, r); } @@ -952,7 +952,7 @@ static ref<Expr> TryConstArrayOpt(const ref<Expr> &cl, //llvm::cerr << "\n\n=== Applying const array optimization ===\n\n"; if (matches == 0) - return ref<Expr>(0, Expr::Bool); + return ConstantExpr::alloc(0, Expr::Bool); ref<Expr> res = EqExpr::create(first_idx_match, rd->index); if (matches == 1) @@ -1079,11 +1079,11 @@ static ref<Expr> UltExpr_create(const ref<Expr> &l, const ref<Expr> &r) { if (r.isConstant()) { uint64_t value = r.getConstantValue(); if (value <= 8) { - ref<Expr> res(0,Expr::Bool); + ref<Expr> res = ConstantExpr::alloc(0, Expr::Bool); for (unsigned i=0; i<value; i++) { - res = OrExpr::create(EqExpr::create(l, ref<Expr>(i,t)), res); + res = OrExpr::create(EqExpr::create(l, + ConstantExpr::alloc(i, t)), res); } - // llvm::cerr << l << "<" << r << " <=> " << res << "\n"; return res; } } |