-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfunc.h
44 lines (36 loc) · 950 Bytes
/
func.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
42
43
44
#ifndef _FUNC_LIT_
#define _FUNC_LIT_
#include "var.h"
#include "exprtype.h"
#include "common.h"
struct func_t {
ExprType type;
size_t params;
std::string name;
std::vector<ExprType *> args_type;
std::vector<std::string> args_name;
std::vector<std::string> mod_name;
llvm::Function *func_addr;
bool is_template;
};
class Function {
public:
func_t info;
Variable var; // local varaibles
llvm::BasicBlock *bb_return;
std::stack<llvm::BasicBlock *> break_br_list;
std::stack<bool> has_br;
};
class Program {
public:
std::vector<Function> func, undef_func;
std::vector<std::string> cur_mod_name;
Variable var_global;
Struct structs;
Program() { func.reserve(1280); }
Function *lookup(std::string, std::vector<ExprType *>);
Function *lookup(std::string, std::vector<std::string>, std::vector<ExprType*>);
Function *add(Function);
var_t *append_global_var(std::string, int);
};
#endif // _FUNC_LIT_