[PATCH] D45961: [MC] Add MCSubtargetInfo to MCAlignFragment [NFC]

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 23 07:24:07 PDT 2018


peter.smith created this revision.
peter.smith added reviewers: eli.friedman, asb, phosek, echristo.
Herald added subscribers: kbarton, kristof.beyls, nemanjai, sdardis.
Herald added a reviewer: javed.absar.

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 when emitting an object it is always possible to walk up the fragments in a section to find a fragment with an STI as we only generate constant pool entries if there is an instruction with an STI. When emitting assembly the fragment information is not there so we always get back nullptr for the STI. As the assembler writeNops doesn't use the STI I think that this is preferable to creating an arbitrary STI.

This is part 3 of 4 of a patch series to pass MCSubtargetInfo to writeNops so that the ARM and X86 AsmBackends can remove the per-module STI that is used to decide which nop encodings can be used.
1 [MC] Move bundling and MCSubtargetInfo to MCEncodedFragment [NFC]
2 [MC] Add MCSubtargetInfo to MCPaddingFragment [NFC]
3 [MC] Add MCSubtargetInfo to MCAlignFragment [NFC]
4 [MC] Use local MCSubtargetInfo in writeNops

This patch depends on https://reviews.llvm.org/D44928.


https://reviews.llvm.org/D45961

Files:
  include/llvm/MC/ConstantPools.h
  include/llvm/MC/MCELFStreamer.h
  include/llvm/MC/MCFragment.h
  include/llvm/MC/MCObjectStreamer.h
  include/llvm/MC/MCSection.h
  include/llvm/MC/MCStreamer.h
  include/llvm/MC/MCWinCOFFStreamer.h
  lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  lib/MC/ConstantPools.cpp
  lib/MC/MCAsmStreamer.cpp
  lib/MC/MCELFStreamer.cpp
  lib/MC/MCObjectStreamer.cpp
  lib/MC/MCParser/AsmParser.cpp
  lib/MC/MCSection.cpp
  lib/MC/MCStreamer.cpp
  lib/MC/MCWinCOFFStreamer.cpp
  lib/Target/AArch64/AArch64AsmPrinter.cpp
  lib/Target/ARM/ARMAsmPrinter.cpp
  lib/Target/ARM/ARMMCInstLower.cpp
  lib/Target/ARM/AsmParser/ARMAsmParser.cpp
  lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
  lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp
  lib/Target/Hexagon/HexagonAsmPrinter.cpp
  lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
  lib/Target/Mips/MipsAsmPrinter.cpp
  lib/Target/PowerPC/PPCAsmPrinter.cpp
  lib/Target/X86/AsmParser/X86AsmParser.cpp
  lib/Target/X86/X86MCInstLower.cpp
  tools/llvm-mc/Disassembler.cpp
  tools/llvm-mc/llvm-mc.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45961.143552.patch
Type: text/x-patch
Size: 26848 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180423/ffb11844/attachment.bin>


More information about the llvm-commits mailing list