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

Method GeneratePrototype

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

Source from the content-addressed store, hash-verified

835}
836
837llvm::Function* LlvmCodeGen::FnPrototype::GeneratePrototype(
838 LlvmBuilder* builder, llvm::Value** params) {
839 vector<llvm::Type*> arguments;
840 arguments.reserve(args_.size());
841 for (int i = 0; i < args_.size(); ++i) {
842 arguments.push_back(args_[i].type);
843 }
844 llvm::FunctionType* prototype = llvm::FunctionType::get(ret_type_, arguments, false);
845
846 llvm::Function* fn = llvm::Function::Create(
847 prototype, llvm::GlobalValue::ExternalLinkage, name_, codegen_->module_);
848 DCHECK(fn != NULL);
849
850 // Name the arguments
851 int idx = 0;
852 for (llvm::Function::arg_iterator iter = fn->arg_begin(); iter != fn->arg_end();
853 ++iter, ++idx) {
854 iter->setName(args_[idx].name);
855 if (params != NULL) params[idx] = &*iter;
856 }
857
858 if (builder != NULL) {
859 llvm::BasicBlock* entry_block =
860 llvm::BasicBlock::Create(codegen_->context(), "entry", fn);
861 // Add it to the llvm module via the builder and to the list of handcrafted functions
862 // that are a part of the module.
863 builder->SetInsertPoint(entry_block);
864 codegen_->handcrafted_functions_.push_back(fn);
865 }
866 return fn;
867}
868
869Status LlvmCodeGen::LoadFunction(const TFunction& fn, const string& symbol,
870 const ColumnType* return_type, const vector<ColumnType>& arg_types,

Callers 15

CodegenEvalRowMethod · 0.80
CodegenHashRowMethod · 0.80
CodegenEqualsMethod · 0.80
CodegenUpdateSlotMethod · 0.80
CodegenUpdateTupleMethod · 0.80
CodegenEvalConjunctsMethod · 0.80
CodegenWriteSlotMethod · 0.80
CodegenEvalMethod · 0.80

Calls 5

CreateClass · 0.85
reserveMethod · 0.80
push_backMethod · 0.80
contextMethod · 0.80
sizeMethod · 0.45

Tested by 6

AddLlvmCodegenEchoMethod · 0.64
GetLlvmEmptyFunctionMethod · 0.64
AddLlvmCodegenDoubleMethod · 0.64
CodegenInnerLoopFunction · 0.64
CodegenStringTestFunction · 0.64
TEST_FFunction · 0.64