about summary refs log tree commit diff homepage
path: root/lib/Expr/AssignmentGenerator.h
blob: 173b863efa625a0361d5ccf9fbf683070e5b4a8d (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
47
48
49
50
51
52
53
54
55
56
57
58
59
//===-- AssignmentGenerator.h ---------------------------------------------===//
//
//                     The KLEE Symbolic Virtual Machine
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef KLEE_ASSIGNMENTGENERATOR_H
#define KLEE_ASSIGNMENTGENERATOR_H

#include "klee/Expr/Expr.h"
#include "klee/util/Ref.h"

#include <vector>

namespace klee {
class Assignment;
} /* namespace klee */

namespace klee {

class Expr;
template <class T> class ref;

class AssignmentGenerator {
public:
  static bool generatePartialAssignment(const ref<Expr> &e, ref<Expr> &val,
                                        Assignment *&a);

private:
  static bool helperGenerateAssignment(const ref<Expr> &e, ref<Expr> &val,
                                       Assignment *&a, Expr::Width width,
                                       bool sign);

  static bool isReadExprAtOffset(ref<Expr> e, const ReadExpr *base,
                                 ref<Expr> offset);
  static ReadExpr *hasOrderedReads(ref<Expr> e);

  static ref<Expr> createSubExpr(const ref<Expr> &l, ref<Expr> &r);
  static ref<Expr> createAddExpr(const ref<Expr> &l, ref<Expr> &r);
  static ref<Expr> createMulExpr(const ref<Expr> &l, ref<Expr> &r);
  static ref<Expr> createDivExpr(const ref<Expr> &l, ref<Expr> &r, bool sign);
  static ref<Expr> createDivRem(const ref<Expr> &l, ref<Expr> &r, bool sign);
  static ref<Expr> createShlExpr(const ref<Expr> &l, ref<Expr> &r);
  static ref<Expr> createLShrExpr(const ref<Expr> &l, ref<Expr> &r);
  static ref<Expr> createAndExpr(const ref<Expr> &l, ref<Expr> &r);
  static ref<Expr> createExtractExpr(const ref<Expr> &l, ref<Expr> &r);
  static ref<Expr> createExtendExpr(const ref<Expr> &l, ref<Expr> &r);

  static std::vector<unsigned char> getByteValue(ref<Expr> &val);
  static std::vector<unsigned char>
  getIndexedValue(const std::vector<unsigned char> &c_val, ConstantExpr &index,
                  const unsigned int size);
};
} // namespace klee

#endif /* KLEE_ASSIGNMENTGENERATOR_H */