[PATCH] D45962: [MC] Use local MCSubtargetInfo in writeNops

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


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

On some architectures such as Arm and X86 the encoding for a nop may change depending on the subtarget in operation at the time of encoding. This change replaces the per module MCSubtargetInfo retained by the targets AsmBackend in favour of passing through the local MCSubtargetInfo in operation at the time.

      

The cases in which using the right nop encoding is significant are limited, however by removing the per module MCSubtargetInfo we make it harder for it to be misused in a more important context.

There is still some use of a per module STI in the MipsTargetStreamer for the implementation of some Mips specific directives. I think it would be better if someone more familiar with Mips decided what to do with those.

This is part 4 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/D45959, https://reviews.llvm.org/D45960, https://reviews.llvm.org/D45961


https://reviews.llvm.org/D45962

Files:
  include/llvm/MC/MCAsmBackend.h
  lib/MC/MCAssembler.cpp
  lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
  lib/Target/AMDGPU/MCTargetDesc/AMDGPUAsmBackend.cpp
  lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
  lib/Target/ARM/MCTargetDesc/ARMAsmBackend.h
  lib/Target/ARM/MCTargetDesc/ARMAsmBackendDarwin.h
  lib/Target/ARM/MCTargetDesc/ARMAsmBackendELF.h
  lib/Target/ARM/MCTargetDesc/ARMAsmBackendWinCOFF.h
  lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp
  lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp
  lib/Target/Lanai/MCTargetDesc/LanaiAsmBackend.cpp
  lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp
  lib/Target/Mips/MCTargetDesc/MipsAsmBackend.h
  lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp
  lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp
  lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmBackend.cpp
  lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
  test/CodeGen/ARM/subtarget-align.ll
  test/MC/ARM/subtarget-nop.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45962.143553.patch
Type: text/x-patch
Size: 29433 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180423/899cf4b7/attachment.bin>


More information about the llvm-commits mailing list