about summary refs log tree commit diff homepage
path: root/lib/Expr
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-06-27 00:55:57 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-06-27 00:55:57 +0000
commit7ea8afa20439c579c4a1ccb251a78770ef873787 (patch)
tree59d4455f6e3f078aa093d3b95c394050b96d43dd /lib/Expr
parent648aa4261c5d2ac2c69dd08bf7a727bf6929c185 (diff)
downloadklee-7ea8afa20439c579c4a1ccb251a78770ef873787.tar.gz
Start move to using APFloat (support long double).
 - Incomplete, still have to move some conversion operations.

 - Also, there isn't support yet for copying long double values to native
   memory.

 - Still, should be a monotonic improvement and we are no longer faking long
   double support.


git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@74363 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Expr')
-rw-r--r--lib/Expr/Expr.cpp16
1 files changed, 4 insertions, 12 deletions
diff --git a/lib/Expr/Expr.cpp b/lib/Expr/Expr.cpp
index d4042e3f..fc450d76 100644
--- a/lib/Expr/Expr.cpp
+++ b/lib/Expr/Expr.cpp
@@ -277,20 +277,10 @@ void Expr::printWidth(std::ostream &os, Width width) {
 
 Expr::Width Expr::getWidthForLLVMType(const llvm::Type *t) {
   switch (t->getTypeID()) {
-  case llvm::Type::IntegerTyID: {
-    Width w = cast<IntegerType>(t)->getBitWidth();
-
-    // should remove this limitation soon
-    if (w == 1 || w == 8 || w == 16 || w == 32 || w == 64)
-      return w;
-    else {
-      assert(0 && "XXX arbitrary bit widths unsupported");
-      abort();
-    }
-  }
+  case llvm::Type::IntegerTyID: return cast<IntegerType>(t)->getBitWidth();
   case llvm::Type::FloatTyID: return Expr::Int32;
   case llvm::Type::DoubleTyID: return Expr::Int64;
-  case llvm::Type::X86_FP80TyID: return Expr::Int64; // XXX: needs to be fixed
+  case llvm::Type::X86_FP80TyID: return 80;
   case llvm::Type::PointerTyID: return kMachinePointerType;
   default:
     cerr << "non-primitive type argument to Expr::getTypeForLLVMType()\n";
@@ -332,6 +322,7 @@ ref<Expr> ConstantExpr::fromMemory(void *address, Width width) {
   case Expr::Int16: return ConstantExpr::create(*((uint16_t*) address), width);
   case Expr::Int32: return ConstantExpr::create(*((uint32_t*) address), width);
   case Expr::Int64: return ConstantExpr::create(*((uint64_t*) address), width);
+    // FIXME: Should support long double, at least.
   }
 }
 
@@ -343,6 +334,7 @@ void ConstantExpr::toMemory(void *address) {
   case Expr::Int16: *((uint16_t*) address) = getZExtValue(16); break;
   case Expr::Int32: *((uint32_t*) address) = getZExtValue(32); break;
   case Expr::Int64: *((uint64_t*) address) = getZExtValue(64); break;
+    // FIXME: Should support long double, at least.
   }
 }