-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathLibraryFunctions.hpp
More file actions
executable file
·60 lines (49 loc) · 1.77 KB
/
Copy pathLibraryFunctions.hpp
File metadata and controls
executable file
·60 lines (49 loc) · 1.77 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
/**
* 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_LIBRARYFUNCTIONS_HPP_
#define MODULES_BACKEND_PASS_LIBRARYFUNCTIONS_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/Pass.h>
#include <llvm/Support/raw_ostream.h>
#include <iostream>
#include <sstream>
#include <stdexcept>
#include <string>
#include <vector>
using llvm::Constant;
using llvm::FunctionCallee;
using llvm::PointerType;
using llvm::Function;
class LibraryFunctions {
FunctionCallee map2check_init;
FunctionCallee map2check_exit;
FunctionCallee map2check_track_bb;
public:
FunctionCallee getInitFunction() { return this->map2check_init; }
FunctionCallee getTrackBBFunction() { return this->map2check_track_bb; }
FunctionCallee getExitFunction() { return this->map2check_exit; }
LibraryFunctions(Function* F, LLVMContext* Ctx) {
this->map2check_init = F->getParent()->getOrInsertFunction(
"map2check_init", Type::getVoidTy(*Ctx), Type::getInt32Ty(*Ctx));
this->map2check_exit = F->getParent()->getOrInsertFunction(
"map2check_success", Type::getVoidTy(*Ctx));
this->map2check_exit = F->getParent()->getOrInsertFunction(
"map2check_success", Type::getVoidTy(*Ctx));
this->map2check_track_bb = F->getParent()->getOrInsertFunction(
"map2check_track_bb", Type::getVoidTy(*Ctx), Type::getInt32Ty(*Ctx),
PointerType::get(*Ctx, 0));
}
};
#endif // MODULES_BACKEND_PASS_LIBRARYFUNCTIONS_HPP_