klee
MergeHandler.h
Go to the documentation of this file.
1//===-- MergeHandler.h --------------------------------------------*- C++ -*-===//
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
69#ifndef KLEE_MERGEHANDLER_H
70#define KLEE_MERGEHANDLER_H
71
72#include "klee/ADT/Ref.h"
73
74#include "llvm/Support/CommandLine.h"
75
76#include <map>
77#include <stdint.h>
78#include <vector>
79
80namespace llvm {
81class Instruction;
82}
83
84namespace klee {
85extern llvm::cl::opt<bool> UseMerge;
86
87extern llvm::cl::opt<bool> DebugLogMerge;
88
89extern llvm::cl::opt<bool> DebugLogIncompleteMerge;
90
91class Executor;
92class ExecutionState;
93
97private:
99
102
106
110
113
116 std::vector<ExecutionState *> openStates;
117
120 std::map<llvm::Instruction *, std::vector<ExecutionState *> >
122
123public:
124
126 void addClosedState(ExecutionState *es, llvm::Instruction *mp);
127
130
133
136
139 bool hasMergedStates();
140
143 void releaseStates();
144
145 // Return the mean time it takes for a state to get from klee_open_merge to
146 // klee_close_merge
147 double getMean();
148
151
152 MergeHandler(Executor *_executor, ExecutionState *es);
154};
155}
156
157#endif /* KLEE_MERGEHANDLER_H */
Implements smart-pointer ref<> used by KLEE.
ExecutionState representing a path under exploration.
Represents one klee_open_merge() call. Handles merging of states that branched from it.
Definition: MergeHandler.h:96
void releaseStates()
Immediately release the merged states that have run into a 'klee_merge_close()'.
void addClosedState(ExecutionState *es, llvm::Instruction *mp)
Called when a state runs into a 'klee_close_merge()' call.
bool hasMergedStates()
True, if any states have run into 'klee_close_merge()' and have not been released yet.
class ReferenceCounter _refCount
Required by klee::ref-managed objects.
Definition: MergeHandler.h:150
double closedMean
The average number of instructions between the open and close merge of each state that has finished s...
Definition: MergeHandler.h:105
std::map< llvm::Instruction *, std::vector< ExecutionState * > > reachedCloseMerge
Mapping the different 'klee_close_merge' calls to the states that ran into them.
Definition: MergeHandler.h:121
unsigned closedStateCount
Number of states that are tracked by this MergeHandler, that ran into a relevant klee_close_merge.
Definition: MergeHandler.h:109
void addOpenState(ExecutionState *es)
Add state to the 'openStates' vector.
unsigned getInstructionDistance(ExecutionState *es)
Get distance of state from the openInstruction.
uint64_t openInstruction
The instruction count when the state ran into the klee_open_merge.
Definition: MergeHandler.h:101
Executor * executor
Definition: MergeHandler.h:98
ExecutionState * getPrioritizeState()
Return state that should be prioritized to complete this merge.
std::vector< ExecutionState * > openStates
States that ran through the klee_open_merge, but not yet into a corresponding klee_close_merge.
Definition: MergeHandler.h:116
MergeHandler(Executor *_executor, ExecutionState *es)
void removeOpenState(ExecutionState *es)
Remove state from the 'openStates' vector.
Reference counter to be used as part of a ref-managed struct or class.
Definition: Ref.h:46
Definition: main.cpp:291
llvm::cl::opt< bool > DebugLogIncompleteMerge
llvm::cl::opt< bool > UseMerge
llvm::cl::opt< bool > DebugLogMerge