-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathast-internal.h
More file actions
25 lines (20 loc) · 946 Bytes
/
ast-internal.h
File metadata and controls
25 lines (20 loc) · 946 Bytes
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
class ScopeContext {
std::map<std::string, llvm::Value *> variables;
std::map<std::string, nanjit::TypeInfo> types;
nanjit::TypeInfo return_type;
ScopeContext *parent;
public:
llvm::IRBuilder<> *Builder;
llvm::Module *Module;
ScopeContext() : return_type("void"), parent(NULL) {};
void setVariable(std::string name, llvm::Value *value);
void setVariable(nanjit::TypeInfo, std::string name, llvm::Value *value);
llvm::Value *getVariable(std::string name);
nanjit::TypeInfo getTypeInfo(std::string name);
void setReturnType(nanjit::TypeInfo rt) { return_type = rt; };
nanjit::TypeInfo getReturnType() { return return_type; };
ScopeContext *createChild();
};
llvm::Type *typeinfo_get_llvm_type(nanjit::TypeInfo type);
void cast_value(ScopeContext *scope, nanjit::TypeInfo to_type, nanjit::TypeInfo from_type, Value **value);
Function *define_llvm_intrinisic(ScopeContext *scope, string name, nanjit::TypeInfo type);