[PATCH] D23506: [RFC] Generate long nop instructions depending on function-specific subtarget info (version 2)

Andrey Turetskiy via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 15 05:59:45 PDT 2016


aturetsk created this revision.
aturetsk added reviewers: echristo, bruno, RKSimon.
aturetsk added subscribers: rafael, jyknight, llvm-commits.
Herald added a reviewer: tstellarAMD.
Herald added subscribers: nemanjai, mehdi_amini, dsanders, arsenm, jfb.

1) Use SubtargetInfo (not CPU name) to control nop emission. For now we still use CPU name, but get it from SubtargetInfo. In the future new nop-related FeatureBits are supposed to be used instead.
2) Support function multi-versioning, so that every function could have different nop padding depending on the target for which the function is compiled (e.g. through attribute "target").
3) Compile path .ll -> .s -> .o must lead to the same result as .ll -> .o. That's why a new assembly directive '.arch' is introduced. The issue appears because of multi-versioning support: nop padding is done during object file creation, so compiler need to preserve target information till that moment (even in .s file). Because it hurts compatibility with other assemblies, it's done only if -asm-preserve-alignment option is specified.

https://reviews.llvm.org/D23506

Files:
  include/llvm/MC/MCAsmBackend.h
  include/llvm/MC/MCFragment.h
  include/llvm/MC/MCObjectStreamer.h
  include/llvm/MC/MCStreamer.h
  include/llvm/MC/MCSubtargetInfo.h
  include/llvm/Support/TargetRegistry.h
  lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  lib/CodeGen/LLVMTargetMachine.cpp
  lib/MC/MCAsmStreamer.cpp
  lib/MC/MCAssembler.cpp
  lib/MC/MCELFStreamer.cpp
  lib/MC/MCMachOStreamer.cpp
  lib/MC/MCObjectStreamer.cpp
  lib/MC/MCStreamer.cpp
  lib/MC/WinCOFFStreamer.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/WebAssembly/MCTargetDesc/WebAssemblyAsmBackend.cpp
  lib/Target/X86/AsmParser/X86AsmParser.cpp
  lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
  test/CodeGen/X86/multiversioning-long-nops.ll
  test/MC/COFF/align-nops.s
  test/MC/ELF/align-nops.s
  test/MC/MachO/x86_32-optimal_nop.s
  test/MC/X86/AlignedBundling/different-sections.s
  test/MC/X86/AlignedBundling/long-nop-pad.s
  test/MC/X86/AlignedBundling/misaligned-bundle-group.s
  test/MC/X86/AlignedBundling/misaligned-bundle.s
  test/MC/X86/AlignedBundling/pad-align-to-bundle-end.s
  test/MC/X86/AlignedBundling/pad-bundle-groups.s
  test/MC/X86/AlignedBundling/relax-in-bundle-group.s
  test/MC/X86/AlignedBundling/single-inst-bundling.s
  test/MC/X86/arch-directive.s
  test/MC/X86/x86_long_nop.s
  test/MC/X86/x86_long_nop_arch.s
  tools/llvm-mc/llvm-mc.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23506.68027.patch
Type: text/x-patch
Size: 60685 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160815/dc0289ef/attachment.bin>


More information about the llvm-commits mailing list