aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
diff options
context:
space:
mode:
authorjasonliu <jasonliu.development@gmail.com>2020-08-10 19:35:50 +0000
committerjasonliu <jasonliu.development@gmail.com>2020-08-10 19:52:10 +0000
commit20abff0481d598c850d2690083f90700fc8c9603 (patch)
tree659bf2efeb2d79d904a1683a79c4e16642537b98 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
parent7bc03f55539f7f081daea5363f2e4845b2e75f57 (diff)
downloadllvm-20abff0481d598c850d2690083f90700fc8c9603.zip
llvm-20abff0481d598c850d2690083f90700fc8c9603.tar.gz
llvm-20abff0481d598c850d2690083f90700fc8c9603.tar.bz2
[XCOFF][AIX] Use TE storage mapping class when large code model is enabled
Summary: Use TE SMC instead of TC SMC in large code model mode, so that large code model TOC entries could get placed after all the small code model TOC entries, which reduces the chance of TOC overflow. Reviewed By: Xiangling_L Differential Revision: https://reviews.llvm.org/D85455
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r--llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 3171660..8a0aacc 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -2202,8 +2202,11 @@ MCSection *TargetLoweringObjectFileXCOFF::getSectionForFunctionDescriptor(
}
MCSection *TargetLoweringObjectFileXCOFF::getSectionForTOCEntry(
- const MCSymbol *Sym) const {
+ const MCSymbol *Sym, const TargetMachine &TM) const {
+ // Use TE storage-mapping class when large code model is enabled so that
+ // the chance of needing -bbigtoc is decreased.
return getContext().getXCOFFSection(
- cast<MCSymbolXCOFF>(Sym)->getSymbolTableName(), XCOFF::XMC_TC,
+ cast<MCSymbolXCOFF>(Sym)->getSymbolTableName(),
+ TM.getCodeModel() == CodeModel::Large ? XCOFF::XMC_TE : XCOFF::XMC_TC,
XCOFF::XTY_SD, XCOFF::C_HIDEXT, SectionKind::getData());
}