Add Module as a member of IRBuilder.
Change-Id: I62704b0a33b166f577fd8675bedac8f998d51294
diff --git a/src/compiler_llvm/ir_builder.cc b/src/compiler_llvm/ir_builder.cc
index 4c43271..582af65 100644
--- a/src/compiler_llvm/ir_builder.cc
+++ b/src/compiler_llvm/ir_builder.cc
@@ -28,7 +28,7 @@
//----------------------------------------------------------------------------
IRBuilder::IRBuilder(llvm::LLVMContext& context, llvm::Module& module)
-: LLVMIRBuilder(context) {
+: LLVMIRBuilder(context), module_(&module) {
// Get java object type from module
llvm::Type* jobject_struct_type = module.getTypeByName("JavaObject");
@@ -40,7 +40,7 @@
jenv_type_ = jenv_struct_type->getPointerTo();
// Load the runtime support function declaration from module
- InitRuntimeSupportFuncDecl(module);
+ InitRuntimeSupportFuncDecl();
}
@@ -48,12 +48,12 @@
// Runtime Helper Function
//----------------------------------------------------------------------------
-void IRBuilder::InitRuntimeSupportFuncDecl(llvm::Module& module) {
+void IRBuilder::InitRuntimeSupportFuncDecl() {
using namespace runtime_support;
#define GET_RUNTIME_SUPPORT_FUNC_DECL(ID, NAME) \
do { \
- llvm::Function* fn = module.getFunction(NAME); \
+ llvm::Function* fn = module_->getFunction(NAME); \
DCHECK_NE(fn, (void*)NULL) << "Function not found: " << NAME; \
runtime_support_func_decls_[ID] = fn; \
} while (0);