summaryrefslogtreecommitdiff
path: root/src/compiler/codegen
diff options
context:
space:
mode:
author buzbee <buzbee@google.com> 2012-10-11 14:46:06 -0700
committer buzbee <buzbee@google.com> 2012-10-11 15:33:23 -0700
commit4df2bbdfe6602ce5f141b7b44028b95faa0bd8ef (patch)
tree9c23dad1023ccd1bf710825e6115892291232dae /src/compiler/codegen
parent1aae273f8827bcbfff6b00c5babd77a111852272 (diff)
Enable multi-threaded Quick compilation
Reuse thread-local copies of llvm context data for Quick compiler (while continuing to regenerate fresh ones per method for Portable). This is a transitional CL - the upcoming compiler driver change is expected to pass pass a thread context structure to each compiler worker thread rather than use the pthread_key mechanism. Change-Id: I277920a5c2705748c3a9f37ceace53c903747ec2
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) {