<div>While implementing a MachineFunctionPass that runs as part of the ARMTargetMachine::addPreEmitPass(), I've run into a problem.</div><div>This particular MFP can drastically increase the size (in MachineInstr count) of the MachineFunction that it processes, so much so that</div>



<div>there is a real danger of pcrel calls and branches that use immediate offsets to not be sufficient.</div><div><br></div><div>A naive test confirmed that under extreme duress, LLVM does not produce correct BL/B sequences, as it defaults to using pcrel immediates which do not have enough bits to encode the offset.</div>



<div><br></div><div>How do I convince LLVM to revert to materializing an offset in a register and use register indirect BL/B sequences?  Is there some magic sequence of getAnalysisUsage() which will tell the outer loop to replace the immediate form of branches in lieu of a register indirect BL/B ?</div>



<div><br></div><div>Or is the answer to use some other framework (ModulePass?)  Or is this a case where I need to carry out 'manual' (un)relaxation?</div><div><br></div><div>In either case, pointers and advice would be greatly appreciated.</div>



<div><br></div><div>Thanks!</div><div>-Jason</div><div></div>