[PATCH] [MCInstPrinter] Enable MCInstPrinter to change its behavior based on the per-function subtarget

Akira Hatanaka ahatanak at gmail.com
Fri Mar 27 11:54:15 PDT 2015


Hi echristo,

Currently, code-gen passes the default or generic subtarget to the constructors of MCInstPrinter subclasses (see  LLVMTargetMachine::addPassesToEmitFile), which enables some targets (AArch64, ARM, and X86) to change their instprinter's behavior based on the subtarget feature bits. Since the backend can now use different subtargets for each function, instprinter has to be changed to use the per-function subtarget rather than the default subtarget.

This patch takes the first step towards enabling instprinter to change its behavior based on the per-function subtarget. It adds a bit "PassSubtarget" to AsmWriter which tells table-gen to pass a reference to MCSubtargetInfo to the various print methods table-gen auto-generates. In this patch, I've turned on this bit only for AArch64, but I plan to make the same changes for ARM and X86 and remove AvailableFeatures from MCInstPrinter.

http://reviews.llvm.org/D8668

Files:
  include/llvm/MC/MCInstPrinter.h
  include/llvm/Target/Target.td
  lib/MC/MCAsmStreamer.cpp
  lib/MC/MCDisassembler/Disassembler.cpp
  lib/Target/AArch64/AArch64.td
  lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp
  lib/Target/AArch64/InstPrinter/AArch64InstPrinter.h
  lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp
  lib/Target/ARM/InstPrinter/ARMInstPrinter.h
  lib/Target/BPF/InstPrinter/BPFInstPrinter.cpp
  lib/Target/BPF/InstPrinter/BPFInstPrinter.h
  lib/Target/Hexagon/MCTargetDesc/HexagonInstPrinter.cpp
  lib/Target/Hexagon/MCTargetDesc/HexagonInstPrinter.h
  lib/Target/MSP430/InstPrinter/MSP430InstPrinter.cpp
  lib/Target/MSP430/InstPrinter/MSP430InstPrinter.h
  lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp
  lib/Target/Mips/InstPrinter/MipsInstPrinter.h
  lib/Target/NVPTX/InstPrinter/NVPTXInstPrinter.cpp
  lib/Target/NVPTX/InstPrinter/NVPTXInstPrinter.h
  lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp
  lib/Target/PowerPC/InstPrinter/PPCInstPrinter.h
  lib/Target/R600/AMDGPUMCInstLower.cpp
  lib/Target/R600/InstPrinter/AMDGPUInstPrinter.cpp
  lib/Target/R600/InstPrinter/AMDGPUInstPrinter.h
  lib/Target/Sparc/InstPrinter/SparcInstPrinter.cpp
  lib/Target/Sparc/InstPrinter/SparcInstPrinter.h
  lib/Target/SystemZ/InstPrinter/SystemZInstPrinter.cpp
  lib/Target/SystemZ/InstPrinter/SystemZInstPrinter.h
  lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp
  lib/Target/X86/InstPrinter/X86ATTInstPrinter.h
  lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp
  lib/Target/X86/InstPrinter/X86IntelInstPrinter.h
  lib/Target/XCore/InstPrinter/XCoreInstPrinter.cpp
  lib/Target/XCore/InstPrinter/XCoreInstPrinter.h
  test/CodeGen/AArch64/print-mrs-system-register.ll
  tools/llvm-objdump/MachODump.cpp
  tools/llvm-objdump/llvm-objdump.cpp
  utils/TableGen/AsmWriterEmitter.cpp
  utils/TableGen/AsmWriterInst.cpp
  utils/TableGen/AsmWriterInst.h

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8668.22809.patch
Type: text/x-patch
Size: 52545 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150327/3d7130a8/attachment.bin>


More information about the llvm-commits mailing list