diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-07-28 07:59:09 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-07-28 07:59:09 +0000 |
commit | f5e6b462646f5a20dd0e5f6c4befaa7b72d1e1ff (patch) | |
tree | 8c3a622ce7955e304134b2175813721b30a99005 /lib/Core/Context.h | |
parent | 4fcf6a3c9b87b02d73b6a2f55c17573ca7fc5bbc (diff) | |
download | klee-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/Context.h')
-rw-r--r-- | lib/Core/Context.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/Core/Context.h b/lib/Core/Context.h new file mode 100644 index 00000000..af1ce8e7 --- /dev/null +++ b/lib/Core/Context.h @@ -0,0 +1,45 @@ +//===-- Context.h -----------------------------------------------*- C++ -*-===// +// +// The KLEE Symbolic Virtual Machine +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef KLEE_CONTEXT_H +#define KLEE_CONTEXT_H + +#include "klee/Expr.h" + +namespace klee { + + /// Context - Helper class for storing global information about a KLEE run. + class Context { + /// Whether the target architecture is little endian or not. + bool IsLittleEndian; + + /// The pointer width of the target architecture. + Expr::Width PointerWidth; + + protected: + Context(bool _IsLittleEndian, Expr::Width _PointerWidth) + : IsLittleEndian(_IsLittleEndian), PointerWidth(_PointerWidth) {} + + public: + Context() {} + + /// initialize - Construct the global Context instance. + static void initialize(bool IsLittleEndian, Expr::Width PointerWidth); + + /// get - Return the global singleton instance of the Context. + static const Context &get(); + + bool isLittleEndian() const { return IsLittleEndian; } + + Expr::Width getPointerWidth() const { return PointerWidth; } + }; + +} // End klee namespace + +#endif |