| 1010 | } |
| 1011 | |
| 1012 | int LlvmCodeGen::ReplaceCallSitesWithValue( |
| 1013 | llvm::Function* caller, llvm::Value* replacement, const string& target_name) { |
| 1014 | DCHECK(!is_compiled_); |
| 1015 | DCHECK(caller != NULL); |
| 1016 | DCHECK(caller->getParent() == module_); |
| 1017 | DCHECK(replacement != NULL); |
| 1018 | |
| 1019 | vector<llvm::CallInst*> call_sites; |
| 1020 | FindCallSites(caller, target_name, &call_sites); |
| 1021 | int replaced = 0; |
| 1022 | for (llvm::CallInst* call_instr : call_sites) { |
| 1023 | call_instr->replaceAllUsesWith(replacement); |
| 1024 | ++replaced; |
| 1025 | } |
| 1026 | return replaced; |
| 1027 | } |
| 1028 | |
| 1029 | int LlvmCodeGen::ReplaceCallSitesWithBoolConst(llvm::Function* caller, bool constant, |
| 1030 | const string& target_name) { |
no test coverage detected