<div class="socmaildefaultfont" dir="ltr" style="font-family:Arial, Helvetica, sans-serif;font-size:10.5pt" ><div dir="ltr" >Hi all,</div> <div dir="ltr" > </div> <div dir="ltr" >As part of the out-of-tree backend which I am developing, I'd like to implement an analysis pass that runs prior to RA and is then consumed post-RA. It needs to run before RA because it makes use of virtual registers and SSA, but the transformation pass using it operates on physical registers, so it must run post-RA. I can schedule the pass to run preRA and it works just fine, but the problem is that the PassManager assumes it to be invalidated between this initial run and it's consumption, and so schedules it to run again immediately before its consumption. This second run of the pass fails because the required virtual register information is no longer available.</div> <div dir="ltr" > </div> <div dir="ltr" >The particular analysis my pass does is known not to be invalidated by any of the passes between it's initial scheduled run and its consumption. Is there any way to convey this information to the PassManager, without modifying all intervening passes? Or is there a known solution to the general problem of using pre-RA analysis in a postRA pass? Can anyone point me to an example in one of the existing targets?</div> <div dir="ltr" > </div> <div dir="ltr" >I can make it work using static variables and early exit if its scheduled post-RA, e.g.:</div> <div dir="ltr" > </div> <div dir="ltr" >struct MyAnalysis : public MachineFunctionPass {</div> <div dir="ltr" > </div> <div dir="ltr" > static MyStruct MyAnalysisData;</div> <div dir="ltr" > static char ID;</div> <div dir="ltr" > </div> <div dir="ltr" > ....</div> <div dir="ltr" > </div> <div dir="ltr" > bool runOnMachineFunction(MachineFunction &MF) override {</div> <div dir="ltr" > </div> <div dir="ltr" > if (isPostRa())</div> <div dir="ltr" > return false;</div> <div dir="ltr" > </div> <div dir="ltr" > MyAnalysisData = doAnalysis(MF);</div> <div dir="ltr" > return false;</div> <div dir="ltr" >};</div> <div dir="ltr" > </div> <div dir="ltr" > </div> <div dir="ltr" >... but I don't think this is recommended. Any feedback would be greatly appreciated.</div> <div dir="ltr" > </div> <div dir="ltr" >Thanks,</div> <div dir="ltr" >Tyler</div></div><BR>