-
Notifications
You must be signed in to change notification settings - Fork 11
/
ShuttingYard.h
41 lines (32 loc) · 1.2 KB
/
ShuttingYard.h
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
#ifndef SHUTTINGYARD_H
#include <map>
#include <string>
#include <vector>
#include <llvm/ADT/SmallVector.h>
#include <z3++.h>
namespace llvm {
class APInt;
class Function;
class Instruction;
class Module;
class Type;
class Value;
}; // namespace llvm
/*
Get the count of operators
*/
int countOperators(std::string &expr);
llvm::APInt eval(std::string expr, llvm::SmallVectorImpl<llvm::APInt> &par,
int BitWidth, int *OperationCount = nullptr);
llvm::Function *createLLVMFunction(
llvm::Module *M, llvm::SmallVectorImpl<llvm::Value *> &Variables,
std::string &expr, std::vector<std::string> &VNames, llvm::Type *RetType);
void createLLVMReplacement(llvm::Instruction *InsertionPoint,
llvm::Type *IntType, std::string &expr,
std::vector<std::string> &VNames,
llvm::SmallVectorImpl<llvm::Value *> &Variables);
z3::expr getZ3ExprFromString(z3::context &Z3Ctx, std::string &expr,
int BitWidth, std::vector<std::string> &Variables,
std::map<std::string, llvm::Type *> &VarTypes,
std::map<std::string, z3::expr *> &VarMap);
#endif