about summary refs log tree commit diff homepage
path: root/lib/Core/Context.h
blob: ecef646eb5544fa5aa92f74af73490297437beb7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//===-- 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/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; }

    /// Returns width of the pointer in bits
    Expr::Width getPointerWidth() const { return PointerWidth; }
  };
  
} // End klee namespace

#endif /* KLEE_CONTEXT_H */