MCPcopy Create free account
hub / github.com/apache/impala / CreateImpalaCodegen

Method CreateImpalaCodegen

be/src/codegen/llvm-codegen.cc:418–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

416}
417
418Status LlvmCodeGen::CreateImpalaCodegen(FragmentState* state,
419 MemTracker* parent_mem_tracker, const string& id,
420 scoped_ptr<LlvmCodeGen>* codegen_ret) {
421 DCHECK(state != nullptr);
422 RETURN_IF_ERROR(CreateFromMemory(
423 state, state->obj_pool(), parent_mem_tracker, id, codegen_ret));
424 LlvmCodeGen* codegen = codegen_ret->get();
425
426 // Parse module for cross compiled functions and types
427 SCOPED_TIMER(codegen->profile_->total_time_counter());
428 SCOPED_TIMER(codegen->prepare_module_timer_);
429 SCOPED_THREAD_COUNTER_MEASUREMENT(codegen->llvm_thread_counters_);
430
431 // Get type for StringValue
432 codegen->string_value_type_ = codegen->GetStructType<StringValue>();
433
434 // Get type for TimestampValue
435 codegen->timestamp_value_type_ = codegen->GetStructType<TimestampValue>();
436
437 // Get type for CollectionValue
438 codegen->collection_value_type_ = codegen->GetStructType<CollectionValue>();
439
440 // Verify size is correct
441 const llvm::DataLayout& data_layout = codegen->execution_engine()->getDataLayout();
442 const llvm::StructLayout* layout = data_layout.getStructLayout(
443 static_cast<llvm::StructType*>(codegen->string_value_type_));
444 if (layout->getSizeInBytes() != sizeof(StringValue)) {
445 DCHECK_EQ(layout->getSizeInBytes(), sizeof(StringValue));
446 return Status("Could not create llvm struct type for StringVal");
447 }
448
449 // Materialize functions referenced by the global variables.
450 for (const string& fn_name : shared_call_graph_.fns_referenced_by_gv()) {
451 llvm::Function* fn = codegen->module_->getFunction(fn_name);
452 DCHECK(fn != nullptr);
453 RETURN_IF_ERROR(codegen->MaterializeFunction(fn));
454 }
455 return Status::OK();
456}
457
458Status LlvmCodeGen::Init(unique_ptr<llvm::Module> module) {
459 DCHECK(module != nullptr);

Callers

nothing calls this directly

Calls 8

OKFunction · 0.85
total_time_counterMethod · 0.80
execution_engineMethod · 0.80
MaterializeFunctionMethod · 0.80
getMethod · 0.65
getFunctionMethod · 0.65
StatusClass · 0.50
obj_poolMethod · 0.45

Tested by

no test coverage detected