Reduce the size of MCRelaxableFragment.
authorAkira Hatanaka <ahatanaka@apple.com>
Sat, 14 Nov 2015 06:35:56 +0000 (06:35 +0000)
committerAkira Hatanaka <ahatanaka@apple.com>
Sat, 14 Nov 2015 06:35:56 +0000 (06:35 +0000)
commit55c02687140ffb7bb37a381cf40db4ee4aea4b10
tree4e9c2014b715d5bf99da7ab3394411e71d5186bc
parent09dcb16d132ccbb3aaaf4cba5839c990e3101641
Reduce the size of MCRelaxableFragment.

MCRelaxableFragment previously kept a copy of MCSubtargetInfo and
MCInst to enable re-encoding the MCInst later during relaxation. A copy
of MCSubtargetInfo (instead of a reference or pointer) was needed
because the feature bits could be modified by the parser.

This commit replaces the MCSubtargetInfo copy in MCRelaxableFragment
with a constant reference to MCSubtargetInfo. The copies of
MCSubtargetInfo are kept in MCContext, and the target parsers are now
responsible for asking MCContext to provide a copy whenever the feature
bits of MCSubtargetInfo have to be toggled.

With this patch, I saw a 4% reduction in peak memory usage when I
compiled verify-uselistorder.lto.bc using llc.

rdar://problem/21736951

Differential Revision: http://reviews.llvm.org/D14346

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253127 91177308-0d34-0410-b5e6-96231b3b80d8
19 files changed:
include/llvm/MC/MCAssembler.h
include/llvm/MC/MCContext.h
include/llvm/MC/MCTargetAsmParser.h
include/llvm/Support/TargetRegistry.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
lib/MC/MCContext.cpp
lib/MC/MCParser/MCTargetAsmParser.cpp
lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
lib/Target/ARM/AsmParser/ARMAsmParser.cpp
lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp
lib/Target/Mips/AsmParser/MipsAsmParser.cpp
lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp
lib/Target/Sparc/AsmParser/SparcAsmParser.cpp
lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp
lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp
lib/Target/X86/AsmParser/X86AsmInstrumentation.h
lib/Target/X86/AsmParser/X86AsmParser.cpp