aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/TargetLoweringObjectFile.cpp
diff options
context:
space:
mode:
authorMingming Liu <mingmingl@google.com>2025-03-29 22:07:56 -0700
committerGitHub <noreply@github.com>2025-03-29 22:07:56 -0700
commit9747bb182f430bb1bd3525b7f42e88df626e28e5 (patch)
tree3c5470ddd0de6979c2fab8092b2a4747d25bf476 /llvm/lib/Target/TargetLoweringObjectFile.cpp
parent976a384ba67adf059ab9fe5550e7e67b6fc53396 (diff)
downloadllvm-9747bb182f430bb1bd3525b7f42e88df626e28e5.zip
llvm-9747bb182f430bb1bd3525b7f42e88df626e28e5.tar.gz
llvm-9747bb182f430bb1bd3525b7f42e88df626e28e5.tar.bz2
[CodeGen][StaticDataSplitter]Support constant pool partitioning (#129781)
This is a follow-up patch of https://github.com/llvm/llvm-project/pull/125756 In this PR, static-data-splitter pass produces the aggregated profile counts of constants for constant pools in a global state (`StateDataProfileInfo`), and asm printer consumes the profile counts to produce `.hot` or `.unlikely` prefixes. This implementation covers both x86 and aarch64 asm printer.
Diffstat (limited to 'llvm/lib/Target/TargetLoweringObjectFile.cpp')
-rw-r--r--llvm/lib/Target/TargetLoweringObjectFile.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Target/TargetLoweringObjectFile.cpp b/llvm/lib/Target/TargetLoweringObjectFile.cpp
index cab9bc8..0920c33 100644
--- a/llvm/lib/Target/TargetLoweringObjectFile.cpp
+++ b/llvm/lib/Target/TargetLoweringObjectFile.cpp
@@ -385,6 +385,18 @@ MCSection *TargetLoweringObjectFile::getSectionForConstant(
return DataSection;
}
+MCSection *TargetLoweringObjectFile::getSectionForConstant(
+ const DataLayout &DL, SectionKind Kind, const Constant *C, Align &Alignment,
+ StringRef SectionPrefix) const {
+ // Fallback to `getSectionForConstant` without `SectionPrefix` parameter if it
+ // is empty.
+ if (SectionPrefix.empty())
+ return getSectionForConstant(DL, Kind, C, Alignment);
+ report_fatal_error(
+ "TargetLoweringObjectFile::getSectionForConstant that "
+ "accepts SectionPrefix is not implemented for the object file format");
+}
+
MCSection *TargetLoweringObjectFile::getSectionForMachineBasicBlock(
const Function &F, const MachineBasicBlock &MBB,
const TargetMachine &TM) const {