#pragma once #include "Function.hpp" #include "GlobalVariable.hpp" #include "Instruction.hpp" #include "Type.hpp" #include "Value.hpp" #include #include #include #include #include #include class GlobalVariable; class Function; class Module { public: Module(); ~Module() = default; Type *get_void_type(); Type *get_label_type(); IntegerType *get_int1_type(); IntegerType *get_int32_type(); PointerType *get_int32_ptr_type(); FloatType *get_float_type(); PointerType *get_float_ptr_type(); PointerType *get_pointer_type(Type *contained); ArrayType *get_array_type(Type *contained, unsigned num_elements); FunctionType *get_function_type(Type *retty, std::vector &args); void add_function(Function *f); llvm::ilist &get_functions(); void add_global_variable(GlobalVariable *g); llvm::ilist &get_global_variable(); void set_print_name(); std::string print(); private: // The global variables in the module llvm::ilist global_list_; // The functions in the module llvm::ilist function_list_; std::unique_ptr int1_ty_; std::unique_ptr int32_ty_; std::unique_ptr label_ty_; std::unique_ptr void_ty_; std::unique_ptr float32_ty_; std::map> pointer_map_; std::map, std::unique_ptr> array_map_; std::map>, std::unique_ptr> function_map_; };