Lines Matching refs:llvm
27 bool isRSAPICall(llvm::Module &module, llvm::CallInst *call_inst) { in isRSAPICall()
41 bool isRSLargeReturnCall(llvm::Module &module, llvm::CallInst *call_inst) { in isRSLargeReturnCall()
61 bool isRSAllocationPtrTy(const llvm::Type *type) { in isRSAllocationPtrTy()
70 bool isRSAllocationTyCallSite(llvm::Module &module, llvm::CallInst *call_inst) { in isRSAllocationTyCallSite()
80 llvm::FunctionType *cloneToStructRetFnTy(llvm::CallInst *call_inst) { in cloneToStructRetFnTy()
91 llvm::Function *orig = call_inst->getCalledFunction(); in cloneToStructRetFnTy()
93 llvm::FunctionType *orig_type = orig->getFunctionType(); in cloneToStructRetFnTy()
99 std::vector<llvm::Type *> new_params{num_params + 1, nullptr}; in cloneToStructRetFnTy()
100 std::vector<llvm::Type *> params{orig_type->param_begin(), in cloneToStructRetFnTy()
107 llvm::PointerType *return_type_ptr_type = in cloneToStructRetFnTy()
108 llvm::PointerType::getUnqual(orig->getReturnType()); in cloneToStructRetFnTy()
121 return llvm::FunctionType::get(return_type_ptr_type, params, in cloneToStructRetFnTy()
125 bool findRSCallSites(llvm::Module &module, in findRSCallSites()
126 std::set<llvm::CallInst *> &rs_callsites, in findRSCallSites()
127 bool (*predicate)(llvm::Module &, llvm::CallInst *)) { in findRSCallSites()
133 llvm::CallInst *call_inst = in findRSCallSites()
134 llvm::dyn_cast_or_null<llvm::CallInst>(&inst); in findRSCallSites()
146 bool fixupX86StructRetCalls(llvm::Module &module) { in fixupX86StructRetCalls()
151 std::set<llvm::CallInst *> rs_callsites; in fixupX86StructRetCalls()
156 llvm::FunctionType *new_func_type = cloneToStructRetFnTy(call_inst); in fixupX86StructRetCalls()
160 llvm::Function *func = call_inst->getCalledFunction(); in fixupX86StructRetCalls()
163 std::vector<llvm::Value *> new_call_args(call_inst->arg_begin(), in fixupX86StructRetCalls()
169 const llvm::DataLayout &DL = module.getDataLayout(); in fixupX86StructRetCalls()
170 llvm::AllocaInst *return_value_alloc = new llvm::AllocaInst( in fixupX86StructRetCalls()
175 llvm::cast<llvm::Value>(return_value_alloc)); in fixupX86StructRetCalls()
176 llvm::PointerType *new_func_ptr_type = in fixupX86StructRetCalls()
177 llvm::PointerType::get(new_func_type, 0); in fixupX86StructRetCalls()
179 llvm::Constant *new_func_cast = llvm::ConstantExpr::getCast( in fixupX86StructRetCalls()
180 llvm::Instruction::BitCast, func, new_func_ptr_type); in fixupX86StructRetCalls()
182 llvm::AllocaInst *new_func_ptr = in fixupX86StructRetCalls()
183 new llvm::AllocaInst(new_func_ptr_type, DL.getAllocaAddrSpace(), in fixupX86StructRetCalls()
186 (new llvm::StoreInst(new_func_cast, new_func_ptr, call_inst)) in fixupX86StructRetCalls()
189 llvm::LoadInst *new_func_addr_load = in fixupX86StructRetCalls()
190 new llvm::LoadInst(new_func_ptr->getType()->getPointerElementType(), in fixupX86StructRetCalls()
193 llvm::CallInst *new_call_inst = in fixupX86StructRetCalls()
194 llvm::CallInst::Create(new_func_type, new_func_addr_load, new_call_args, in fixupX86StructRetCalls()
198 llvm::LoadInst *lldb_save_result_address = new llvm::LoadInst( in fixupX86StructRetCalls()
210 bool fixupRSAllocationStructByValCalls(llvm::Module &module) { in fixupRSAllocationStructByValCalls()
224 std::set<llvm::CallInst *> rs_callsites; in fixupRSAllocationStructByValCalls()
228 std::set<llvm::Function *> rs_functions; in fixupRSAllocationStructByValCalls()
237 llvm::AttributeList call_attribs = call_inst->getAttributes(); in fixupRSAllocationStructByValCalls()
243 if (call_attribs.hasAttribute(I, llvm::Attribute::ByVal)) { in fixupRSAllocationStructByValCalls()
245 call_inst->removeAttribute(I, llvm::Attribute::ByVal); in fixupRSAllocationStructByValCalls()
256 arg.removeAttr(llvm::Attribute::ByVal); in fixupRSAllocationStructByValCalls()
268 bool fixupX86FunctionCalls(llvm::Module &module) { in fixupX86FunctionCalls()
272 bool fixupX86_64FunctionCalls(llvm::Module &module) { in fixupX86_64FunctionCalls()