about summary refs log tree commit diff homepage
path: root/lib/Core/Memory.h
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-07-28 07:59:09 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-07-28 07:59:09 +0000
commitf5e6b462646f5a20dd0e5f6c4befaa7b72d1e1ff (patch)
tree8c3a622ce7955e304134b2175813721b30a99005 /lib/Core/Memory.h
parent4fcf6a3c9b87b02d73b6a2f55c17573ca7fc5bbc (diff)
downloadklee-f5e6b462646f5a20dd0e5f6c4befaa7b72d1e1ff.tar.gz
Move Machine constants into Context object, initialized based on the target
data.
 - This is the first step towards having KLEE be fully target independent, its not
   particularly beautiful but its expedient.


git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@77306 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Core/Memory.h')
-rw-r--r--lib/Core/Memory.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/Core/Memory.h b/lib/Core/Memory.h
index 3179c267..7f7b86a8 100644
--- a/lib/Core/Memory.h
+++ b/lib/Core/Memory.h
@@ -10,6 +10,7 @@
 #ifndef KLEE_MEMORY_H
 #define KLEE_MEMORY_H
 
+#include "Context.h"
 #include "klee/Expr.h"
 
 #include "llvm/ADT/StringExtras.h"
@@ -100,10 +101,10 @@ public:
   }
 
   ref<ConstantExpr> getBaseExpr() const { 
-    return ConstantExpr::create(address, kMachinePointerType);
+    return ConstantExpr::create(address, Context::get().getPointerWidth());
   }
   ref<ConstantExpr> getSizeExpr() const { 
-    return ConstantExpr::create(size, kMachinePointerType);
+    return ConstantExpr::create(size, Context::get().getPointerWidth());
   }
   ref<Expr> getOffsetExpr(ref<Expr> pointer) const {
     return SubExpr::create(pointer, getBaseExpr());
@@ -117,7 +118,8 @@ public:
 
   ref<Expr> getBoundsCheckOffset(ref<Expr> offset) const {
     if (size==0) {
-      return EqExpr::create(offset, ConstantExpr::alloc(0, kMachinePointerType));
+      return EqExpr::create(offset, 
+                            ConstantExpr::alloc(0, Context::get().getPointerWidth()));
     } else {
       return UltExpr::create(offset, getSizeExpr());
     }
@@ -125,7 +127,8 @@ public:
   ref<Expr> getBoundsCheckOffset(ref<Expr> offset, unsigned bytes) const {
     if (bytes<=size) {
       return UltExpr::create(offset, 
-                             ConstantExpr::alloc(size - bytes + 1, kMachinePointerType));
+                             ConstantExpr::alloc(size - bytes + 1, 
+                                                 Context::get().getPointerWidth()));
     } else {
       return ConstantExpr::alloc(0, Expr::Bool);
     }