Prepping flow for basic block building.

This commit is contained in:
Ben Vanik
2013-01-20 09:48:39 -08:00
parent ca2908db32
commit d4b0bf73c1
8 changed files with 249 additions and 73 deletions

View File

@@ -19,6 +19,7 @@
namespace llvm {
class LLVMContext;
class Module;
class FunctionType;
class Function;
class DIBuilder;
class MDNode;
@@ -30,6 +31,14 @@ namespace cpu {
namespace codegen {
class CodegenFunction {
public:
sdb::FunctionSymbol* symbol;
llvm::FunctionType* function_type;
llvm::Function* function;
};
class CodegenContext {
public:
CodegenContext(
@@ -48,7 +57,8 @@ private:
void AddPresentImport(
const xe_xex2_import_library_t *library,
const xe_xex2_import_info_t* info, kernel::KernelExport* kernel_export);
void AddFunction(sdb::FunctionSymbol* fn);
void PrepareFunction(sdb::FunctionSymbol* fn);
void BuildFunction(CodegenFunction* cgf);
void OptimizeFunction(llvm::Module* m, llvm::Function* fn);
xe_memory_ref memory_;
@@ -60,6 +70,8 @@ private:
llvm::Module* gen_module_;
llvm::DIBuilder* di_builder_;
llvm::MDNode* cu_;
std::map<sdb::FunctionSymbol*, CodegenFunction*> functions_;
};

View File

@@ -24,6 +24,14 @@ namespace llvm {
class ExecutionEngine;
}
namespace xe {
namespace cpu {
namespace codegen {
class CodegenContext;
}
}
}
namespace xe {
namespace cpu {
@@ -52,6 +60,7 @@ private:
shared_ptr<sdb::SymbolDatabase> sdb_;
shared_ptr<llvm::LLVMContext> context_;
shared_ptr<llvm::Module> gen_module_;
auto_ptr<codegen::CodegenContext> codegen_;
};