-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathMap2CheckLibrary.hpp
More file actions
executable file
·63 lines (52 loc) · 1.69 KB
/
Copy pathMap2CheckLibrary.hpp
File metadata and controls
executable file
·63 lines (52 loc) · 1.69 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* Copyright (C) 2014 - 2020 Map2Check tool
* This file is part of the Map2Check tool, and is made available under
* the terms of the GNU General Public License version 2.
*
* LLVM -> NCSA
*
* SPDX-License-Identifier: (GPL-2.0 AND NCSA)
**/
#ifndef MODULES_BACKEND_PASS_MAP2CHECKLIBRARY_HPP_
#define MODULES_BACKEND_PASS_MAP2CHECKLIBRARY_HPP_
#include <llvm/IR/Constants.h>
#include <llvm/IR/Function.h>
#include <llvm/IR/IRBuilder.h>
#include <llvm/IR/Instructions.h>
#include <llvm/IR/Metadata.h>
#include <llvm/IR/Module.h>
#include <llvm/IR/PassManager.h>
#include <llvm/Support/raw_ostream.h>
#include <iostream>
#include <sstream>
#include <stdexcept>
#include <string>
#include <vector>
#include <memory>
#include "DebugInfo.hpp"
#include "LibraryFunctions.hpp"
using llvm::BasicBlock;
using llvm::CallInst;
using llvm::dyn_cast;
using llvm::Function;
using llvm::IRBuilder;
using llvm::LLVMContext;
using llvm::PreservedAnalyses;
using std::make_unique;
using llvm::Value;
struct Map2CheckLibrary : public llvm::PassInfoMixin<Map2CheckLibrary> {
explicit Map2CheckLibrary(bool svcomp = false) : SVCOMP(svcomp) {}
PreservedAnalyses run(Function& F, llvm::FunctionAnalysisManager& AM);
static bool isRequired() { return true; }
protected:
void instrumentStartInstruction(LLVMContext* Ctx);
void instrumentReleaseInstruction(LLVMContext* Ctx);
void runOnCallInstruction(CallInst* callInst, LLVMContext* Ctx);
Value* getFunctionNameValue() { return this->functionName; }
private:
std::unique_ptr<LibraryFunctions> libraryFunctions;
bool SVCOMP = false;
Value* functionName = NULL;
BasicBlock::iterator currentInstruction;
};
#endif // MODULES_BACKEND_PASS_MAP2CHECKLIBRARY_HPP_