18 llvm::LLVMContext &context;
19 std::map<std::string, llvm::StructType *> named_struct_types;
20 std::map<std::string, llvm::StructType *> named_enum_types;
23 llvm::Type *get_type(
Type t);
24 llvm::Type *get_return_type(
Type t);
25 llvm::FunctionType *get_closure_function_type(
const FunctionType &ft);
26 llvm::CmpInst::Predicate get_cmp_func(
Type a,
Type b, TokenType tok);
28 void register_struct_type(
const std::string &name,
29 llvm::StructType *llvm_type) {
30 named_struct_types[name] = llvm_type;
32 llvm::StructType *get_struct_type(
const std::string &name)
const {
33 auto it = named_struct_types.find(name);
34 if (it != named_struct_types.end())
39 void register_enum_type(
const std::string &name,
40 llvm::StructType *llvm_type) {
41 named_enum_types[name] = llvm_type;
43 llvm::StructType *get_enum_type(
const std::string &name)
const {
44 auto it = named_enum_types.find(name);
45 if (it != named_enum_types.end())
50 TypeConverter(
LLVMRes &resPtr) : context(*resPtr.Context.get()) {}
Defined LLVMRes, which encapsulates the state of LLVM (Context, Modules, IRBuilder,...