about summary refs log tree commit diff homepage
path: root/lib/Expr
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-04-05 06:48:10 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-04-05 06:48:10 +0000
commit54d4d6353076800e0b640a380ce41e64f1041fbe (patch)
treeee8017b21860ce0fc9ee11520c16b3067e88496c /lib/Expr
parentcae0864b2437111b6cbbb7a3030e82bcef1a6024 (diff)
downloadklee-54d4d6353076800e0b640a380ce41e64f1041fbe.tar.gz
Add long double support, patch by David Ramos.
git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@100421 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Expr')
-rw-r--r--lib/Expr/Expr.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Expr/Expr.cpp b/lib/Expr/Expr.cpp
index 386d29de..703c689f 100644
--- a/lib/Expr/Expr.cpp
+++ b/lib/Expr/Expr.cpp
@@ -274,6 +274,7 @@ void Expr::printWidth(std::ostream &os, Width width) {
   case Expr::Int16: os << "Expr::Int16"; break;
   case Expr::Int32: os << "Expr::Int32"; break;
   case Expr::Int64: os << "Expr::Int64"; break;
+  case Expr::Fl80: os << "Expr::Fl80"; break;
   default: os << "<invalid type: " << (unsigned) width << ">";
   }
 }
@@ -305,7 +306,11 @@ 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.
+  // FIXME: what about machines without x87 support?
+  case Expr::Fl80:
+    return ConstantExpr::alloc(llvm::APInt(width,
+      (width+llvm::integerPartWidth-1)/llvm::integerPartWidth,
+      (const uint64_t*)address));
   }
 }
 
@@ -317,7 +322,10 @@ 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.
+  // FIXME: what about machines without x87 support?
+  case Expr::Fl80:
+    *((long double*) address) = *(long double*) value.getRawData();
+    break;
   }
 }