From 69a7598ab92a5fcd3573487677d7681552c1ba4c Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Thu, 25 Jun 2009 00:42:11 +0000 Subject: Remove some more uses of getConstantValue. git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@74149 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Expr/Expr.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'lib/Expr') diff --git a/lib/Expr/Expr.cpp b/lib/Expr/Expr.cpp index ae7bc819..e4bde44b 100644 --- a/lib/Expr/Expr.cpp +++ b/lib/Expr/Expr.cpp @@ -164,7 +164,7 @@ unsigned Expr::computeHash() { } unsigned ConstantExpr::computeHash() { - hashValue = getConstantValue() ^ (getWidth() * MAGIC_HASH_CONSTANT); + hashValue = value.getHashValue() ^ (getWidth() * MAGIC_HASH_CONSTANT); return hashValue; } @@ -1001,12 +1001,11 @@ static ref TryConstArrayOpt(const ref &cl, } static ref EqExpr_createPartialR(const ref &cl, Expr *r) { - uint64_t value = cl->getConstantValue(); Expr::Width width = cl->getWidth(); Expr::Kind rk = r->getKind(); if (width == Expr::Bool) { - if (value) { + if (cl->isTrue()) { return r; } else { // 0 == ... @@ -1033,12 +1032,12 @@ static ref EqExpr_createPartialR(const ref &cl, Expr *r) { // (sext(a,T)==c) == (a==c) const SExtExpr *see = cast(r); Expr::Width fromBits = see->src->getWidth(); - uint64_t trunc = bits64::truncateToNBits(value, fromBits); + ref trunc = cl->ZExt(fromBits); // pathological check, make sure it is possible to // sext to this value *from any value* - if (value == ints::sext(trunc, width, fromBits)) { - return EqExpr::create(see->src, ConstantExpr::create(trunc, fromBits)); + if (cl == trunc->SExt(width)) { + return EqExpr::create(see->src, trunc); } else { return ConstantExpr::create(0, Expr::Bool); } @@ -1046,12 +1045,12 @@ static ref EqExpr_createPartialR(const ref &cl, Expr *r) { // (zext(a,T)==c) == (a==c) const ZExtExpr *zee = cast(r); Expr::Width fromBits = zee->src->getWidth(); - uint64_t trunc = bits64::truncateToNBits(value, fromBits); + ref trunc = cl->ZExt(fromBits); // pathological check, make sure it is possible to // zext to this value *from any value* - if (value == ints::zext(trunc, width, fromBits)) { - return EqExpr::create(zee->src, ConstantExpr::create(trunc, fromBits)); + if (cl == trunc->ZExt(width)) { + return EqExpr::create(zee->src, trunc); } else { return ConstantExpr::create(0, Expr::Bool); } -- cgit 1.4.1