From: Ahmed Bougacha Date: Wed, 16 Nov 2016 22:25:03 +0000 (+0000) Subject: [CodeGen] Pass references, not pointers, to MMI helpers. NFC. X-Git-Tag: llvmorg-4.0.0-rc1~4359 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bd6ce9a2471756c29ae7a8e6c9d2377bdfd8c778;p=platform%2Fupstream%2Fllvm.git [CodeGen] Pass references, not pointers, to MMI helpers. NFC. While there, rename them to follow the coding style. llvm-svn: 287169 --- diff --git a/llvm/include/llvm/CodeGen/MachineModuleInfo.h b/llvm/include/llvm/CodeGen/MachineModuleInfo.h index f61d1cf..0897e6f 100644 --- a/llvm/include/llvm/CodeGen/MachineModuleInfo.h +++ b/llvm/include/llvm/CodeGen/MachineModuleInfo.h @@ -429,12 +429,12 @@ public: /// function, and set the MachineModuleInfo's usesVAFloatArgument flag if so. /// This flag is used to emit an undefined reference to _fltused on Windows, /// which will link in MSVCRT's floating-point support. -void ComputeUsesVAFloatArgument(const CallInst &I, MachineModuleInfo *MMI); +void computeUsesVAFloatArgument(const CallInst &I, MachineModuleInfo &MMI); /// Extract the exception handling information from the landingpad instruction /// and add them to the specified machine module info. -void AddLandingPadInfo(const LandingPadInst &I, MachineModuleInfo &MMI, - MachineBasicBlock *MBB); +void addLandingPadInfo(const LandingPadInst &I, MachineModuleInfo &MMI, + MachineBasicBlock &MBB); } // End llvm namespace diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp index 053583a..3d686d1 100644 --- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp +++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp @@ -597,7 +597,7 @@ bool IRTranslator::translateLandingPad(const User &U) { MachineBasicBlock &MBB = MIRBuilder.getMBB(); MachineFunction &MF = MIRBuilder.getMF(); MachineModuleInfo &MMI = MF.getMMI(); - AddLandingPadInfo(LP, MMI, &MBB); + addLandingPadInfo(LP, MMI, MBB); MBB.setIsEHPad(); diff --git a/llvm/lib/CodeGen/MachineModuleInfo.cpp b/llvm/lib/CodeGen/MachineModuleInfo.cpp index 8efa07a..131ef44 100644 --- a/llvm/lib/CodeGen/MachineModuleInfo.cpp +++ b/llvm/lib/CodeGen/MachineModuleInfo.cpp @@ -490,16 +490,16 @@ FunctionPass *createFreeMachineFunctionPass() { //===- MMI building helpers -----------------------------------------------===// -void llvm::ComputeUsesVAFloatArgument(const CallInst &I, - MachineModuleInfo *MMI) { +void llvm::computeUsesVAFloatArgument(const CallInst &I, + MachineModuleInfo &MMI) { FunctionType *FT = cast(I.getCalledValue()->getType()->getContainedType(0)); - if (FT->isVarArg() && !MMI->usesVAFloatArgument()) { + if (FT->isVarArg() && !MMI.usesVAFloatArgument()) { for (unsigned i = 0, e = I.getNumArgOperands(); i != e; ++i) { Type *T = I.getArgOperand(i)->getType(); for (auto i : post_order(T)) { if (i->isFloatingPointTy()) { - MMI->setUsesVAFloatArgument(true); + MMI.setUsesVAFloatArgument(true); return; } } @@ -507,14 +507,14 @@ void llvm::ComputeUsesVAFloatArgument(const CallInst &I, } } -void llvm::AddLandingPadInfo(const LandingPadInst &I, MachineModuleInfo &MMI, - MachineBasicBlock *MBB) { +void llvm::addLandingPadInfo(const LandingPadInst &I, MachineModuleInfo &MMI, + MachineBasicBlock &MBB) { if (const auto *PF = dyn_cast( I.getParent()->getParent()->getPersonalityFn()->stripPointerCasts())) MMI.addPersonality(PF); if (I.isCleanup()) - MMI.addCleanup(MBB); + MMI.addCleanup(&MBB); // FIXME: New EH - Add the clauses in reverse order. This isn't 100% correct, // but we need to do it this way because of how the DWARF EH emitter @@ -522,7 +522,7 @@ void llvm::AddLandingPadInfo(const LandingPadInst &I, MachineModuleInfo &MMI, for (unsigned i = I.getNumClauses(); i != 0; --i) { Value *Val = I.getClause(i - 1); if (I.isCatch(i - 1)) { - MMI.addCatchTypeInfo(MBB, + MMI.addCatchTypeInfo(&MBB, dyn_cast(Val->stripPointerCasts())); } else { // Add filters in a list. @@ -532,7 +532,7 @@ void llvm::AddLandingPadInfo(const LandingPadInst &I, MachineModuleInfo &MMI, II != IE; ++II) FilterList.push_back(cast((*II)->stripPointerCasts())); - MMI.addFilterTypeInfo(MBB, FilterList); + MMI.addFilterTypeInfo(&MBB, FilterList); } } } diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp index 452bb05..cf5803b 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -1066,7 +1066,7 @@ bool FastISel::selectCall(const User *I) { } MachineModuleInfo &MMI = FuncInfo.MF->getMMI(); - ComputeUsesVAFloatArgument(*Call, &MMI); + computeUsesVAFloatArgument(*Call, MMI); // Handle intrinsic function calls. if (const auto *II = dyn_cast(Call)) diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index b588d9b..4bb3cd2 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -2294,7 +2294,7 @@ void SelectionDAGBuilder::visitLandingPad(const LandingPadInst &LP) { MachineBasicBlock *MBB = FuncInfo.MBB; MachineModuleInfo &MMI = DAG.getMachineFunction().getMMI(); - AddLandingPadInfo(LP, MMI, MBB); + addLandingPadInfo(LP, MMI, *MBB); // If there aren't registers to copy the values into (e.g., during SjLj // exceptions), then don't bother to create these DAG nodes. @@ -6289,7 +6289,7 @@ void SelectionDAGBuilder::visitCall(const CallInst &I) { } MachineModuleInfo &MMI = DAG.getMachineFunction().getMMI(); - ComputeUsesVAFloatArgument(I, &MMI); + computeUsesVAFloatArgument(I, MMI); const char *RenameFn = nullptr; if (Function *F = I.getCalledFunction()) {