summaryrefslogtreecommitdiff
path: root/src/compiler/codegen
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/codegen')
-rw-r--r--src/compiler/codegen/MethodBitcode.cc19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/compiler/codegen/MethodBitcode.cc b/src/compiler/codegen/MethodBitcode.cc
index 58678a0acb..cf07ea45c3 100644
--- a/src/compiler/codegen/MethodBitcode.cc
+++ b/src/compiler/codegen/MethodBitcode.cc
@@ -170,11 +170,20 @@ void createLocFromValue(CompilationUnit* cUnit, llvm::Value* val)
}
void initIR(CompilationUnit* cUnit)
{
- QuickCompiler* quick = cUnit->quick_compiler;
- cUnit->context = quick->GetLLVMContext();
- cUnit->module = quick->GetLLVMModule();
- cUnit->intrinsic_helper = quick->GetIntrinsicHelper();
- cUnit->irb = quick->GetIRBuilder();
+ LLVMInfo* llvmInfo = cUnit->llvm_info;
+ if (llvmInfo == NULL) {
+ CompilerTls* tls = cUnit->compiler->GetTls();
+ CHECK(tls != NULL);
+ llvmInfo = static_cast<LLVMInfo*>(tls->GetLLVMInfo());
+ if (llvmInfo == NULL) {
+ llvmInfo = new LLVMInfo();
+ tls->SetLLVMInfo(llvmInfo);
+ }
+ }
+ cUnit->context = llvmInfo->GetLLVMContext();
+ cUnit->module = llvmInfo->GetLLVMModule();
+ cUnit->intrinsic_helper = llvmInfo->GetIntrinsicHelper();
+ cUnit->irb = llvmInfo->GetIRBuilder();
}
const char* llvmSSAName(CompilationUnit* cUnit, int ssaReg) {