[PATCH] D102289: [MC] Add .rodata.cold section

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 11 18:09:25 PDT 2021


Amir created this revision.
Amir added reviewers: lhames, grosbach.
Herald added a subscriber: hiraditya.
Amir published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Introduce .rodata.cold section that is used for infrequently accessed data
to improve cache utilization.

Background: BOLT performs an optimization of
moving unused jump tables to .rodata.cold section.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102289

Files:
  llvm/include/llvm/MC/MCObjectFileInfo.h
  llvm/lib/MC/MCObjectFileInfo.cpp


Index: llvm/lib/MC/MCObjectFileInfo.cpp
===================================================================
--- llvm/lib/MC/MCObjectFileInfo.cpp
+++ llvm/lib/MC/MCObjectFileInfo.cpp
@@ -359,6 +359,9 @@
   ReadOnlySection =
       Ctx->getELFSection(".rodata", ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
 
+  ReadOnlyColdSection =
+      Ctx->getELFSection(".rodata.cold", ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
+
   TLSDataSection =
       Ctx->getELFSection(".tdata", ELF::SHT_PROGBITS,
                          ELF::SHF_ALLOC | ELF::SHF_TLS | ELF::SHF_WRITE);
Index: llvm/include/llvm/MC/MCObjectFileInfo.h
===================================================================
--- llvm/include/llvm/MC/MCObjectFileInfo.h
+++ llvm/include/llvm/MC/MCObjectFileInfo.h
@@ -66,6 +66,9 @@
   /// constants.
   MCSection *ReadOnlySection = nullptr;
 
+  /// Same as the above but for infrequently used data.
+  MCSection *ReadOnlyColdSection = nullptr;
+
   /// If exception handling is supported by the target, this is the section the
   /// Language Specific Data Area information is emitted to.
   MCSection *LSDASection = nullptr;
@@ -255,6 +258,7 @@
   MCSection *getDataSection() const { return DataSection; }
   MCSection *getBSSSection() const { return BSSSection; }
   MCSection *getReadOnlySection() const { return ReadOnlySection; }
+  MCSection *getReadOnlyColdSection() const { return ReadOnlyColdSection; }
   MCSection *getCompactUnwindSection() const { return CompactUnwindSection; }
   MCSection *getDwarfAbbrevSection() const { return DwarfAbbrevSection; }
   MCSection *getDwarfInfoSection() const { return DwarfInfoSection; }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102289.344600.patch
Type: text/x-patch
Size: 1630 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210512/335456ca/attachment.bin>


More information about the llvm-commits mailing list