[PATCH] D44928: [MC] Pass MCSubtargetInfo through to fixupNeedsRelaxation

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 5 09:24:39 PDT 2018


peter.smith added a comment.



>> I think that an EmitAssemblerFlag that is used in the same way as the flag to switch from Thumb to Arm can toggle the support for the Architectural NOP without having to do large amounts of source code changes, most of them outside the ARM backend.
> 
> This is really hacky... the fragments in question should really have an STI instead.  Plus there are actually separate features; whether NOP is supported in ARM mode (which is what hasNOP queries), and whether NOP is supported in Thumb mode (i.e. whether Thumb2 is supported).  Plus other architectures have similar problems (e.g. x86 changes the generated NOPs based on the target).  If you're not going to fix it properly, please just leave it as-is for now, with a FIXME.

Ok; I'd like to fix the problem as it would allow us to get rid of the STI in the ARM/X86 AsmBackend class. I think it would be better off as a separate patch as I don't have a good answer for how to achieve this right now. The main difficulty is that Nops can be written as padding for some fragments such as MCAlignFragment created by EmitCodeAlignment(). There are places where EmitCodeAlignment() is called where some calculation is needed to work out what the STI should be, for example the Constant Island emission, or the STI is not easily available such as parseDirectiveAlign(). These calculations might also need other MCFragments to record the STI so we can walk backwards to find the last STI. I think that these are soluble problems but I'm still thinking that I'm missing something simpler. I'd be very grateful if you have any ideas or suggestions?


https://reviews.llvm.org/D44928





More information about the llvm-commits mailing list