[llvm] r304602 - [RABasic] Properly initialize the pass
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 2 15:57:55 PDT 2017
> On Jun 2, 2017, at 3:46 PM, Quentin Colombet via llvm-commits <llvm-commits at lists.llvm.org> wrote:
>
> Author: qcolombet
> Date: Fri Jun 2 17:46:26 2017
> New Revision: 304602
>
> URL: http://llvm.org/viewvc/llvm-project?rev=304602&view=rev
> Log:
> [RABasic] Properly initialize the pass
>
> Use the initializeXXX method to initialize the RABasic pass in the
> pipeline. This enables us to take advantage of the .mir infrastructure.
>
> Modified:
> llvm/trunk/include/llvm/CodeGen/Passes.h
> llvm/trunk/include/llvm/InitializePasses.h
> llvm/trunk/lib/CodeGen/CodeGen.cpp
> llvm/trunk/lib/CodeGen/RegAllocBasic.cpp
> llvm/trunk/test/CodeGen/MIR/Generic/runPass.mir
>
> Modified: llvm/trunk/include/llvm/CodeGen/Passes.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/Passes.h?rev=304602&r1=304601&r2=304602&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/CodeGen/Passes.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/Passes.h Fri Jun 2 17:46:26 2017
> @@ -140,6 +140,9 @@ namespace llvm {
> /// Greedy register allocator.
> extern char &RAGreedyID;
>
> + /// Basic register allocator.
> + extern char &RABasicID;
> +
> /// VirtRegRewriter pass. Rewrite virtual registers to physical registers as
> /// assigned in VirtRegMap.
> extern char &VirtRegRewriterID;
>
> Modified: llvm/trunk/include/llvm/InitializePasses.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InitializePasses.h?rev=304602&r1=304601&r2=304602&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/InitializePasses.h (original)
> +++ llvm/trunk/include/llvm/InitializePasses.h Fri Jun 2 17:46:26 2017
> @@ -304,6 +304,7 @@ void initializeProcessImplicitDefsPass(P
> void initializeProfileSummaryInfoWrapperPassPass(PassRegistry&);
> void initializePromoteLegacyPassPass(PassRegistry&);
> void initializePruneEHPass(PassRegistry&);
> +void initializeRABasicPass(PassRegistry &);
There's 100 declarations around this that do not have a space after PassRegistry :)
> void initializeRAGreedyPass(PassRegistry&);
> void initializeReassociateLegacyPassPass(PassRegistry&);
> void initializeRegBankSelectPass(PassRegistry&);
>
> Modified: llvm/trunk/lib/CodeGen/CodeGen.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodeGen.cpp?rev=304602&r1=304601&r2=304602&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/CodeGen.cpp (original)
> +++ llvm/trunk/lib/CodeGen/CodeGen.cpp Fri Jun 2 17:46:26 2017
> @@ -77,6 +77,7 @@ void llvm::initializeCodeGen(PassRegistr
> initializePostRASchedulerPass(Registry);
> initializePreISelIntrinsicLoweringLegacyPassPass(Registry);
> initializeProcessImplicitDefsPass(Registry);
> + initializeRABasicPass(Registry);
> initializeRAGreedyPass(Registry);
> initializeRegisterCoalescerPass(Registry);
> initializeRenameIndependentSubregsPass(Registry);
>
> Modified: llvm/trunk/lib/CodeGen/RegAllocBasic.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocBasic.cpp?rev=304602&r1=304601&r2=304602&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/RegAllocBasic.cpp (original)
> +++ llvm/trunk/lib/CodeGen/RegAllocBasic.cpp Fri Jun 2 17:46:26 2017
> @@ -121,17 +121,24 @@ char RABasic::ID = 0;
>
> } // end anonymous namespace
>
> +char &llvm::RABasicID = RABasic::ID;
> +
> +INITIALIZE_PASS_BEGIN(RABasic, "regallocbasic", "Basic Register Allocator",
> + false, false)
> +INITIALIZE_PASS_DEPENDENCY(LiveDebugVariables)
> +INITIALIZE_PASS_DEPENDENCY(SlotIndexes)
> +INITIALIZE_PASS_DEPENDENCY(LiveIntervals)
> +INITIALIZE_PASS_DEPENDENCY(RegisterCoalescer)
> +INITIALIZE_PASS_DEPENDENCY(MachineScheduler)
> +INITIALIZE_PASS_DEPENDENCY(LiveStacks)
> +INITIALIZE_PASS_DEPENDENCY(MachineDominatorTree)
> +INITIALIZE_PASS_DEPENDENCY(MachineLoopInfo)
> +INITIALIZE_PASS_DEPENDENCY(VirtRegMap)
> +INITIALIZE_PASS_DEPENDENCY(LiveRegMatrix)
getAnalysisUsage() also mentions:
- AAResultsWrapperPass
- MachineBlockFrequencyInfo
though I always wonder what that specification is good for because I never saw an error when I got it wrong...
> +INITIALIZE_PASS_END(RABasic, "regallocbasic", "Basic Register Allocator", false,
> + false)
> +
> RABasic::RABasic(): MachineFunctionPass(ID) {
> - initializeLiveDebugVariablesPass(*PassRegistry::getPassRegistry());
> - initializeLiveIntervalsPass(*PassRegistry::getPassRegistry());
> - initializeSlotIndexesPass(*PassRegistry::getPassRegistry());
> - initializeRegisterCoalescerPass(*PassRegistry::getPassRegistry());
> - initializeMachineSchedulerPass(*PassRegistry::getPassRegistry());
> - initializeLiveStacksPass(*PassRegistry::getPassRegistry());
> - initializeMachineDominatorTreePass(*PassRegistry::getPassRegistry());
> - initializeMachineLoopInfoPass(*PassRegistry::getPassRegistry());
> - initializeVirtRegMapPass(*PassRegistry::getPassRegistry());
> - initializeLiveRegMatrixPass(*PassRegistry::getPassRegistry());
> }
>
> void RABasic::getAnalysisUsage(AnalysisUsage &AU) const {
>
> Modified: llvm/trunk/test/CodeGen/MIR/Generic/runPass.mir
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/MIR/Generic/runPass.mir?rev=304602&r1=304601&r2=304602&view=diff
> ==============================================================================
> --- llvm/trunk/test/CodeGen/MIR/Generic/runPass.mir (original)
> +++ llvm/trunk/test/CodeGen/MIR/Generic/runPass.mir Fri Jun 2 17:46:26 2017
> @@ -1,4 +1,5 @@
> # RUN: llc -run-pass=greedy -debug-pass=Arguments -o - %s | FileCheck %s
> +# RUN: llc -run-pass=regallocbasic -debug-pass=Arguments -o - %s | FileCheck %s
>
> # Check that passes are initialized correctly, so that it's possible to
> # use -run-pass.
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list