-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCheckGetElementPtrVisitor.hh
More file actions
38 lines (31 loc) · 1.3 KB
/
CheckGetElementPtrVisitor.hh
File metadata and controls
38 lines (31 loc) · 1.3 KB
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
#ifndef INCLUDE_CHECK_GET_ELEMENT_PTR_VISITOR_HH
#define INCLUDE_CHECK_GET_ELEMENT_PTR_VISITOR_HH
#include "AnnotatorHelper.hh"
#include "CallInstSet.hh"
#include "LengthValueSetMap.hh"
#include "ValueSetSet.hh"
#include "ValueSetToMaxIndexMap.hh"
#include <llvm/IR/InstVisitor.h>
#include <memory>
#include <unordered_map>
class SymbolicRangeAnalysis;
struct CheckGetElementPtrVisitor : public llvm::InstVisitor<CheckGetElementPtrVisitor> {
public:
ValueSetToMaxIndexMap &maxIndexes;
LengthValueSetMap &lengths;
CheckGetElementPtrVisitor(ValueSetToMaxIndexMap &, const SymbolicRangeAnalysis &ra,
const llvm::Module &m, LengthValueSetMap &, const ValueSetSet &v);
~CheckGetElementPtrVisitor();
void visitGetElementPtrInst(llvm::GetElementPtrInst& gepi);
ValueSetSet notConstantBounded;
ValueSetSet notParameterBounded;
private:
const std::shared_ptr<const ValueSet> getValueLength(llvm::Value *first, llvm::Value *second, const llvm::Value *basePointer);
bool matchAddPattern(llvm::Value *value, llvm::Value *basePointer);
const SymbolicRangeAnalysis &rangeAnalysis;
const ValueSetSet &valueSets;
const llvm::Module &module;
std::unique_ptr<llvm::BasicBlock> placeHolder;
std::unordered_map<const llvm::Function *, CallInstSet> functionsToCallsites;
};
#endif // !INCLUDE_CHECK_GET_ELEMENT_PTR_VISITOR_HH