1#ifndef POINTS_TO_BENCHMARK_H_
2#define POINTS_TO_BENCHMARK_H_
4#include "llvm/IR/DebugInfoMetadata.h"
5#include "llvm/IR/Metadata.h"
11 std::map<llvm::Instruction *, std::vector<std::string>> TCResult;
12 std::map<llvm::BasicBlock *, std::vector<int>> PrecisionResult;
16 std::vector<llvm::Value *>
extract(llvm::Instruction *Inst);
17 friend std::ostream &
operator<<(std::ostream &OS,
20 void evaluate(llvm::Instruction *Inst, std::set<Ty *>, Ty *);
38 llvm::CallInst *Inst = llvm::cast<llvm::CallInst>(I);
39 std::string Status, Expected;
40 llvm::StringRef FunctionName = Inst->getCalledFunction()->getName();
42 llvm::MDNode *MD = I->getMetadata(
"dbg");
43 int LineNo = llvm::cast<llvm::DILocation>(MD)->getLine();
45 if (FunctionName.contains(
"May"))
46 Expected =
"MayPointsTo";
47 else if (FunctionName.contains(
"Must"))
48 Expected =
"MustPointsTo";
49 else if (FunctionName.contains(
"DoesNot"))
50 Expected =
"DoesNotPointsTo";
52 if (Expected ==
"MayPointsTo") {
54 for (
auto it = A.begin(); it != A.end(); it++) {
60 }
else if (Expected ==
"MustPointsTo") {
61 if (A.size() > 1 || A.size() == 0) {
65 for (
auto it = A.begin(); it != A.end(); it++) {
74 for (
auto it = A.begin(); it != A.end(); it++) {
81 TCResult[Inst].push_back(Status);
82 TCResult[Inst].push_back(Expected);
83 TCResult[Inst].push_back(std::to_string(LineNo));
Definition: Benchmark.h:14
Definition: PointsToBenchmark.h:9
bool CheckSoundness()
Definition: PointsToBenchmark.cpp:37
friend std::ostream & operator<<(std::ostream &OS, const PointsToBenchmarkRunner &B)
Definition: PointsToBenchmark.cpp:49
void evaluatePrecision(llvm::Function &)
Definition: PointsToBenchmark.cpp:127
void evaluate(llvm::Instruction *Inst, std::set< Ty * >, Ty *)
This Function evaluates the predicates defined in testcases for pointer analysis.
Definition: PointsToBenchmark.h:36
PointsToBenchmarkRunner()
Definition: PointsToBenchmark.h:15
std::vector< llvm::Value * > extract(llvm::Instruction *Inst)
Definition: PointsToBenchmark.cpp:111
Definition: PointsToBenchmark.cpp:19