8 #ifndef INCLUDE_IR_SEG_SEGTRACE_H_
9 #define INCLUDE_IR_SEG_SEGTRACE_H_
11 #include "rapidjson/document.h"
13 #include "IR/LLVMValueTrace.h"
14 #include "IR/SEG/SymbolicExprGraphBuilder.h"
21 class SEGTrace :
public Trace<const SEGObject *> {
29 virtual TraceKind getKind()
const {
return TK_ValueFlow; }
32 typedef uint64_t StepType;
33 const static StepType STY_VALUE = 0x1;
34 const static StepType STY_USE_SITE = 0x2;
36 const StepType DEFAULT_STEP_TYPE = STY_VALUE | STY_USE_SITE;
43 kvec<SEGRegionNode *> AdditionalConds;
55 int guessLEVFSrcIdx(
bool IsConsiderLoad)
const;
62 SEGTrace(
const kvec<const SEGObject *> &Trace);
75 virtual void resetWithLLVMValueTrace(
const LLVMValueTrace *ValueTrace,
84 virtual int getValidStartIdx()
const;
89 virtual int getKeyIdx()
const;
113 virtual int getLEVFSrcIdx(
bool isConsiderLoad =
false)
const;
116 StepType getStepType(
int StepIdx)
const;
119 void setStepType(
int StepIdx, StepType STy);
122 int getNumAdditionalConds()
const;
132 void clearAdditionalCond();
137 template <
typename Predicate>
138 std::pair<const SEGObject *, int>
find(
int StartIndex, Predicate P)
const {
139 for (
int I = StartIndex, E = get_length(); I < E; ++I) {
142 return std::move(std::make_pair(O, I));
146 return std::move(std::make_pair(
nullptr, get_length()));
149 template <
typename Predicate>
150 std::pair<const SEGObject *, size_t> rfind(
size_t StartIndex,
152 size_t Size = get_length();
153 if (StartIndex >= Size)
154 return std::move(std::make_pair(
nullptr, Size));
156 for (
size_t I = StartIndex;; --I) {
159 return std::move(std::make_pair(O, I));
166 return std::move(std::make_pair(
nullptr, Size));
169 virtual void print(raw_ostream &O);