[CodeGen] Add text section prefix for COFF object file
authorPan, Tao <tao.pan@intel.com>
Tue, 8 Dec 2020 09:57:03 +0000 (17:57 +0800)
committerWang, Pengfei <pengfei.wang@intel.com>
Tue, 8 Dec 2020 10:56:21 +0000 (18:56 +0800)
commit7af802994eb0521e1b00eda95303f21e874d9f22
treec59a2854e0b96e1ea999220e9184f21b756d1df4
parent2cfbdaf601049faafb2f1b40f63a3b2bef74a464
[CodeGen] Add text section prefix for COFF object file

Text section prefix is created in CodeGenPrepare, it's file format independent implementation,  text section name is written into object file in TargetLoweringObjectFile, it's file format dependent implementation, port code of adding text section prefix to text section name from ELF to COFF.
Different with ELF that use '.' as concatenation character, COFF use '$' as concatenation character. That is, concatenation character is variable, so split concatenation character from text section prefix.
Text section prefix is existing feature of ELF, it can help to reduce icache and itlb misses, it's also make possible aggregate other compilers e.g. v8 created same prefix sections. Furthermore, the recent feature Machine Function Splitter (basic block level text prefix section) is based on text section prefix.

Reviewed By: pengfei, rnk

Differential Revision: https://reviews.llvm.org/D92073
llvm/include/llvm/ProfileData/ProfileCommon.h
llvm/lib/CodeGen/CodeGenPrepare.cpp
llvm/lib/CodeGen/MachineFunctionSplitter.cpp
llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
llvm/test/CodeGen/X86/machine-function-splitter.ll
llvm/test/CodeGen/X86/mingw-comdats.ll
llvm/test/CodeGen/X86/text-section-prefix.ll [new file with mode: 0644]
llvm/test/Transforms/CodeGenPrepare/X86/section-samplepgo.ll
llvm/test/Transforms/CodeGenPrepare/X86/section.ll
llvm/test/Transforms/HotColdSplit/coldentrycount.ll
llvm/test/Transforms/SampleProfile/section-accurate-samplepgo.ll