klee
ArrayExprOptimizer.h
Go to the documentation of this file.
1//===-- ArrayExprOptimizer.h ----------------------------------------------===//
2//
3// The KLEE Symbolic Virtual Machine
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef KLEE_ARRAYEXPROPTIMIZER_H
11#define KLEE_ARRAYEXPROPTIMIZER_H
12
13#include <cstdint>
14#include <map>
15#include <unordered_map>
16#include <unordered_set>
17#include <utility>
18#include <vector>
19
20#include "klee/ADT/Ref.h"
21#include "klee/Expr/Expr.h"
23
24namespace klee {
25
27
28using array2idx_ty = std::map<const Array *, std::vector<ref<Expr>>>;
29using mapIndexOptimizedExpr_ty = std::map<ref<Expr>, std::vector<ref<Expr>>>;
30
32private:
36
37public:
42 ref<Expr> optimizeExpr(const ref<Expr> &e, bool valueOnly);
43
44private:
45 bool computeIndexes(array2idx_ty &arrays, const ref<Expr> &e,
46 mapIndexOptimizedExpr_ty &idx_valIdx) const;
47
49 const ref<Expr> &e, std::vector<const ReadExpr *> &reads,
50 std::map<const ReadExpr *, std::pair<ref<Expr>, Expr::Width>> &readInfo,
51 bool isSymbolic);
52
54 std::vector<uint64_t> &arrayValues,
55 Expr::Width width,
56 unsigned elementsInArray) const;
57
60 std::vector<std::pair<uint64_t, bool>> &arrayValues,
61 Expr::Width width, unsigned elementsInArray) const;
62};
63} // namespace klee
64
65#endif /* KLEE_ARRAYEXPROPTIMIZER_H */
Implements smart-pointer ref<> used by KLEE.
ref< Expr > getSelectOptExpr(const ref< Expr > &e, std::vector< const ReadExpr * > &reads, std::map< const ReadExpr *, std::pair< ref< Expr >, Expr::Width > > &readInfo, bool isSymbolic)
ExprHashSet cacheExprUnapplicable
ExprHashMap< ref< Expr > > cacheExprOptimized
ref< Expr > optimizeExpr(const ref< Expr > &e, bool valueOnly)
ref< Expr > buildMixedSelectExpr(const ReadExpr *re, std::vector< std::pair< uint64_t, bool > > &arrayValues, Expr::Width width, unsigned elementsInArray) const
bool computeIndexes(array2idx_ty &arrays, const ref< Expr > &e, mapIndexOptimizedExpr_ty &idx_valIdx) const
ref< Expr > buildConstantSelectExpr(const ref< Expr > &index, std::vector< uint64_t > &arrayValues, Expr::Width width, unsigned elementsInArray) const
ExprHashMap< ref< Expr > > cacheReadExprOptimized
unsigned Width
The type of an expression is simply its width, in bits.
Definition: Expr.h:97
Class representing a one byte read from an array.
Definition: Expr.h:565
Definition: main.cpp:291
std::unordered_set< ref< Expr >, klee::util::ExprHash, klee::util::ExprCmp > ExprHashSet
Definition: ExprHashMap.h:39
std::map< ref< Expr >, std::vector< ref< Expr > > > mapIndexOptimizedExpr_ty
std::map< const Array *, std::vector< ref< Expr > > > array2idx_ty