In preparation for passing the MCSubtargetInfo (STI) through to writeNops so that it can use the STI in operation at the time, we need to record the STI in operation when a MCAlignFragment may write nops as padding. The STI is currently unused, a further patch will pass it through to writeNops.
There are many places that can create an MCAlignFragment, in most cases we can find out the STI in operation at the time. In a few places this isn't possible as we are in initialisation or finalisation, or are emitting constant pools. When possible I've tried to find the most appropriate existing fragment to obtain the STI from, when none is available use the per module STI.
For constant pools we don't actually need to use EmitCodeAlign as the constant pools are data anyway so falling through into it via an executable NOP is no better than falling through into data padding.
This is part 2 of 3 of a patch series to pass MCSubtargetInfo to writeNops so that the ARM Backend can remove the per-module STI that is used to decide which nop encodings can be used.
This requires an interface change to InitSections to included a MCSubtargetInfo.
1 [MC] Move bundling and MCSubtargetInfo to MCEncodedFragment [NFC] D44928 (committed)
2 [MC] Add MCSubtargetInfo to MCAlignFragment D45961
3 [MC] Use local MCSubtargetInfo in writeNops D45962
This patch depends on D44928.