2019-11-02 17:53:15 -07:00
|
|
|
#pragma once
|
|
|
|
#include <llvm/IR/DerivedTypes.h>
|
|
|
|
#include <llvm/IR/Function.h>
|
|
|
|
#include <llvm/IR/LLVMContext.h>
|
|
|
|
#include <llvm/IR/IRBuilder.h>
|
|
|
|
#include <llvm/IR/Module.h>
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
struct llvm_state {
|
|
|
|
llvm::LLVMContext ctx;
|
|
|
|
llvm::IRBuilder<> builder;
|
|
|
|
llvm::Module module;
|
|
|
|
|
|
|
|
std::map<std::string, llvm::Function*> functions;
|
|
|
|
std::map<std::string, llvm::StructType*> struct_types;
|
|
|
|
|
|
|
|
llvm::StructType* stack_type;
|
2019-11-04 18:25:54 -08:00
|
|
|
llvm::PointerType* stack_ptr_type;
|
2019-11-02 17:53:15 -07:00
|
|
|
llvm::PointerType* node_ptr_type;
|
|
|
|
llvm::IntegerType* tag_type;
|
|
|
|
|
|
|
|
llvm_state()
|
|
|
|
: builder(ctx), module("bloglang", ctx) {
|
|
|
|
create_types();
|
|
|
|
create_functions();
|
|
|
|
}
|
|
|
|
|
|
|
|
void create_types();
|
|
|
|
void create_functions();
|
|
|
|
};
|