OSDN Git Service

[MC] Pass MCSubtargetInfo to fixupNeedsRelaxation and applyFixup
authorPeter Smith <peter.smith@linaro.org>
Wed, 6 Jun 2018 09:40:06 +0000 (09:40 +0000)
committerPeter Smith <peter.smith@linaro.org>
Wed, 6 Jun 2018 09:40:06 +0000 (09:40 +0000)
commite2b2a91087aa1f741f105a022c9a64ede6aff4b8
treefcb275ebb4674dfa3562f707b967d50fadddb2b1
parented92eef9768174ec3021d03e022d2df49a49dbd6
[MC] Pass MCSubtargetInfo to fixupNeedsRelaxation and applyFixup

On targets like Arm some relaxations may only be performed when certain
architectural features are available. As functions can be compiled with
differing levels of architectural support we must make a judgement on
whether we can relax based on the MCSubtargetInfo for the function. This
change passes through the MCSubtargetInfo for the function to
fixupNeedsRelaxation so that the decision on whether to relax can be made
per function. In this patch, only the ARM backend makes use of this
information. We must also pass the MCSubtargetInfo to applyFixup because
some fixups skip error checking on the assumption that relaxation has
occurred, to prevent code-generation errors applyFixup must see the same
MCSubtargetInfo as fixupNeedsRelaxation.

Differential Revision: https://reviews.llvm.org/D44928

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334078 91177308-0d34-0410-b5e6-96231b3b80d8
30 files changed:
include/llvm/MC/MCAsmBackend.h
include/llvm/MC/MCFragment.h
include/llvm/MC/MCObjectStreamer.h
include/llvm/MC/MCStreamer.h
lib/MC/MCAsmStreamer.cpp
lib/MC/MCAssembler.cpp
lib/MC/MCELFStreamer.cpp
lib/MC/MCMachOStreamer.cpp
lib/MC/MCObjectStreamer.cpp
lib/MC/MCParser/AsmParser.cpp
lib/MC/MCWasmStreamer.cpp
lib/MC/MCWinCOFFStreamer.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/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/relax-per-target-feature.ll [new file with mode: 0644]
test/MC/ARM/AlignedBundling/illegal-subtarget-change.s [new file with mode: 0644]
test/MC/ARM/AlignedBundling/subtarget-change.s [new file with mode: 0644]
test/MC/ARM/fixup-per-fragment.s [new file with mode: 0644]
test/MC/X86/AlignedBundling/bundle-subtarget-change-error.s [new file with mode: 0644]