[llvm] r287169 - [CodeGen] Pass references, not pointers, to MMI helpers. NFC.

Ahmed Bougacha via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 16 14:25:03 PST 2016


Author: ab
Date: Wed Nov 16 16:25:03 2016
New Revision: 287169

URL: http://llvm.org/viewvc/llvm-project?rev=287169&view=rev
Log:
[CodeGen] Pass references, not pointers, to MMI helpers. NFC.

While there, rename them to follow the coding style.

Modified:
    llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h
    llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp
    llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
    llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h?rev=287169&r1=287168&r2=287169&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Wed Nov 16 16:25:03 2016
@@ -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

Modified: llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp?rev=287169&r1=287168&r2=287169&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp Wed Nov 16 16:25:03 2016
@@ -597,7 +597,7 @@ bool IRTranslator::translateLandingPad(c
   MachineBasicBlock &MBB = MIRBuilder.getMBB();
   MachineFunction &MF = MIRBuilder.getMF();
   MachineModuleInfo &MMI = MF.getMMI();
-  AddLandingPadInfo(LP, MMI, &MBB);
+  addLandingPadInfo(LP, MMI, MBB);
 
   MBB.setIsEHPad();
 

Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=287169&r1=287168&r2=287169&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Wed Nov 16 16:25:03 2016
@@ -490,16 +490,16 @@ FunctionPass *createFreeMachineFunctionP
 
 //===- MMI building helpers -----------------------------------------------===//
 
-void llvm::ComputeUsesVAFloatArgument(const CallInst &I,
-                                      MachineModuleInfo *MMI) {
+void llvm::computeUsesVAFloatArgument(const CallInst &I,
+                                      MachineModuleInfo &MMI) {
   FunctionType *FT =
       cast<FunctionType>(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(co
   }
 }
 
-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<Function>(
           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 Landi
   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<GlobalValue>(Val->stripPointerCasts()));
     } else {
       // Add filters in a list.
@@ -532,7 +532,7 @@ void llvm::AddLandingPadInfo(const Landi
            II != IE; ++II)
         FilterList.push_back(cast<GlobalValue>((*II)->stripPointerCasts()));
 
-      MMI.addFilterTypeInfo(MBB, FilterList);
+      MMI.addFilterTypeInfo(&MBB, FilterList);
     }
   }
 }

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=287169&r1=287168&r2=287169&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Wed Nov 16 16:25:03 2016
@@ -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<IntrinsicInst>(Call))

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=287169&r1=287168&r2=287169&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Wed Nov 16 16:25:03 2016
@@ -2294,7 +2294,7 @@ void SelectionDAGBuilder::visitLandingPa
 
   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(cons
   }
 
   MachineModuleInfo &MMI = DAG.getMachineFunction().getMMI();
-  ComputeUsesVAFloatArgument(I, &MMI);
+  computeUsesVAFloatArgument(I, MMI);
 
   const char *RenameFn = nullptr;
   if (Function *F = I.getCalledFunction()) {




More information about the llvm-commits mailing list