Lines Matching refs:llvm
42 class RSX86_64CallConvPass: public llvm::ModulePass {
44 bool IsRSFunctionOfInterest(llvm::Function &F) { in IsRSFunctionOfInterest()
50 llvm::StringRef FName = F.getName(); in IsRSFunctionOfInterest()
60 bool IsDerefNeeded(llvm::Function *F, llvm::Argument &Arg) { in IsDerefNeeded()
62 llvm::Type *ArgTy = Arg.getType(); in IsDerefNeeded()
74 llvm::Type *StructTy = ArgTy->getPointerElementType(); in IsDerefNeeded()
79 llvm::StringRef FName = F->getName(); in IsDerefNeeded()
94 bool FillArgsToDeref(llvm::Function *F, std::vector<unsigned> &ArgNums) { in FillArgsToDeref()
110 llvm::Function *RedefineFn(llvm::Function *OrigFn, in RedefineFn()
113 llvm::FunctionType *FTy = OrigFn->getFunctionType(); in RedefineFn()
114 std::vector<llvm::Type *> Params(FTy->param_begin(), FTy->param_end()); in RedefineFn()
116 llvm::FunctionType *NewTy = llvm::FunctionType::get(FTy->getReturnType(), in RedefineFn()
119 llvm::Function *NewFn = llvm::Function::Create(NewTy, in RedefineFn()
128 NewFn->addAttribute(i+1, llvm::Attribute::ByVal); in RedefineFn()
143 void ReplaceCallInsn(llvm::CallSite &CS, in ReplaceCallInsn()
144 llvm::Function *NewFn, in ReplaceCallInsn()
147 llvm::CallInst *CI = llvm::cast<llvm::CallInst>(CS.getInstruction()); in ReplaceCallInsn()
148 std::vector<llvm::Value *> Args(CS.arg_begin(), CS.arg_end()); in ReplaceCallInsn()
149 auto NewCI = llvm::CallInst::Create(NewFn, Args, "", CI); in ReplaceCallInsn()
155 NewCI->addAttribute(i+1, llvm::Attribute::ByVal); in ReplaceCallInsn()
173 virtual void getAnalysisUsage(llvm::AnalysisUsage &AU) const override { in getAnalysisUsage()
178 bool runOnModule(llvm::Module &M) override { in runOnModule()
181 std::vector<llvm::Function *> FunctionsToHandle; in runOnModule()
196 llvm::Function *NewFn = RedefineFn(OrigFn, ArgsToDeref); in runOnModule()
198 llvm::CallSite CS(OrigFn->user_back()); in runOnModule()
213 static llvm::RegisterPass<RSX86_64CallConvPass> X("X86-64-calling-conv",
218 llvm::ModulePass *