Lines Matching refs:call_inst
27 static bool isRSAPICall(llvm::CallInst *call_inst) { in isRSAPICall() argument
30 const auto func_name = call_inst->getCalledFunction()->getName(); in isRSAPICall()
34 if (call_inst->getCalledFunction()->isIntrinsic()) in isRSAPICall()
40 static bool isRSLargeReturnCall(llvm::CallInst *call_inst) { in isRSLargeReturnCall() argument
51 if (!call_inst || !call_inst->getCalledFunction()) in isRSLargeReturnCall()
54 return call_inst->getCalledFunction() in isRSLargeReturnCall()
64 static bool isRSAllocationTyCallSite(llvm::CallInst *call_inst) { in isRSAllocationTyCallSite() argument
65 if (!call_inst->hasByValArgument()) in isRSAllocationTyCallSite()
67 for (unsigned i = 0; i < call_inst->arg_size(); ++i) { in isRSAllocationTyCallSite()
68 if (llvm::Type *ByValTy = call_inst->getParamByValType(i)) in isRSAllocationTyCallSite()
75 static llvm::FunctionType *cloneToStructRetFnTy(llvm::CallInst *call_inst) { in cloneToStructRetFnTy() argument
84 assert(call_inst && "no CallInst"); in cloneToStructRetFnTy()
85 llvm::Function *orig = call_inst->getCalledFunction(); in cloneToStructRetFnTy()
127 llvm::CallInst *call_inst = in findRSCallSites() local
129 if (!call_inst || !call_inst->getCalledFunction()) in findRSCallSites()
132 if (isRSAPICall(call_inst) && predicate(call_inst)) { in findRSCallSites()
133 rs_callsites.insert(call_inst); in findRSCallSites()
149 for (auto call_inst : rs_callsites) { in fixupX86StructRetCalls() local
150 llvm::FunctionType *new_func_type = cloneToStructRetFnTy(call_inst); in fixupX86StructRetCalls()
154 llvm::Function *func = call_inst->getCalledFunction(); in fixupX86StructRetCalls()
157 std::vector<llvm::Value *> new_call_args(call_inst->arg_begin(), in fixupX86StructRetCalls()
158 call_inst->arg_end()); in fixupX86StructRetCalls()
166 call_inst); in fixupX86StructRetCalls()
178 "new_func_ptr", call_inst); in fixupX86StructRetCalls()
180 (new llvm::StoreInst(new_func_cast, new_func_ptr, call_inst)) in fixupX86StructRetCalls()
184 new_func_ptr_type, new_func_ptr, "load_func_pointer", call_inst); in fixupX86StructRetCalls()
188 "new_func_call", call_inst); in fixupX86StructRetCalls()
189 new_call_inst->setCallingConv(call_inst->getCallingConv()); in fixupX86StructRetCalls()
190 new_call_inst->setTailCall(call_inst->isTailCall()); in fixupX86StructRetCalls()
193 "save_return_val", call_inst); in fixupX86StructRetCalls()
196 call_inst->replaceAllUsesWith(lldb_save_result_address); in fixupX86StructRetCalls()
197 call_inst->eraseFromParent(); in fixupX86StructRetCalls()
224 for (auto call_inst : rs_callsites) { in fixupRSAllocationStructByValCalls() local
227 rs_functions.insert(call_inst->getCalledFunction()); in fixupRSAllocationStructByValCalls()
230 llvm::AttributeList call_attribs = call_inst->getAttributes(); in fixupRSAllocationStructByValCalls()
237 call_inst->removeAttributeAtIndex(I, llvm::Attribute::ByVal); in fixupRSAllocationStructByValCalls()