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

Method ReplaceCallSites

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

Source from the content-addressed store, hash-verified

989}
990
991int LlvmCodeGen::ReplaceCallSites(
992 llvm::Function* caller, llvm::Function* new_fn, const string& target_name) {
993 DCHECK(!is_compiled_);
994 DCHECK(caller != NULL);
995 DCHECK(caller->getParent() == module_);
996 DCHECK(new_fn != NULL);
997 DCHECK(find(handcrafted_functions_.begin(), handcrafted_functions_.end(), new_fn)
998 == handcrafted_functions_.end()
999 || finalized_functions_.find(new_fn) != finalized_functions_.end());
1000
1001 vector<llvm::CallInst*> call_sites;
1002 FindCallSites(caller, target_name, &call_sites);
1003 int replaced = 0;
1004 for (llvm::CallInst* call_instr : call_sites) {
1005 // Replace the called function
1006 call_instr->setCalledFunction(new_fn);
1007 ++replaced;
1008 }
1009 return replaced;
1010}
1011
1012int LlvmCodeGen::ReplaceCallSitesWithValue(
1013 llvm::Function* caller, llvm::Value* replacement, const string& target_name) {

Callers 15

CodegenMethod · 0.80
CodegenInsertBatchMethod · 0.80
CodegenAddBatchImplMethod · 0.80
CodegenCopyRowsMethod · 0.80
CodegenMethod · 0.80
CodegenAddBatchImplMethod · 0.80
CodegenMethod · 0.80

Calls 5

getParentMethod · 0.80
findFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
findMethod · 0.45

Tested by 1

TEST_FFunction · 0.64