summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/TargetMachine.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2015-11-03 23:40:03 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2015-11-03 23:40:03 +0000
commit94d778697a0654870aa5808b425ffa8ed88ada93 (patch)
tree4ee879d556450ca8d5fc31f131b96c1f30921a92 /llvm/lib/Target/TargetMachine.cpp
parent26014690aab5fcae955bc27cfda990eae7d34385 (diff)
downloadbcm5719-llvm-94d778697a0654870aa5808b425ffa8ed88ada93.tar.gz
bcm5719-llvm-94d778697a0654870aa5808b425ffa8ed88ada93.zip
CodeGen, Target: Move Mach-O-specific symbol name logic to Mach-O lowering.
A profile of an LTO link of Chrome revealed that we were spending some ~30-50% of execution time in the function Constant::getRelocationInfo(), which is called from TargetLoweringObjectFile::getKindForGlobal() and in turn from TargetMachine::getNameWithPrefix(). It turns out that we only need the result of getKindForGlobal() when targeting Mach-O, so this change moves the relevant part of the logic to TargetLoweringObjectFileMachO. NFCI. Differential Revision: http://reviews.llvm.org/D14168 llvm-svn: 252014
Diffstat (limited to 'llvm/lib/Target/TargetMachine.cpp')
-rw-r--r--llvm/lib/Target/TargetMachine.cpp18
1 files changed, 1 insertions, 17 deletions
diff --git a/llvm/lib/Target/TargetMachine.cpp b/llvm/lib/Target/TargetMachine.cpp
index 6dc3b97fc98..850c93cb21b 100644
--- a/llvm/lib/Target/TargetMachine.cpp
+++ b/llvm/lib/Target/TargetMachine.cpp
@@ -155,19 +155,6 @@ TargetIRAnalysis TargetMachine::getTargetIRAnalysis() {
});
}
-static bool canUsePrivateLabel(const MCAsmInfo &AsmInfo,
- const MCSection &Section) {
- if (!AsmInfo.isSectionAtomizableBySymbols(Section))
- return true;
-
- // If it is not dead stripped, it is safe to use private labels.
- const MCSectionMachO &SMO = cast<MCSectionMachO>(Section);
- if (SMO.hasAttribute(MachO::S_ATTR_NO_DEAD_STRIP))
- return true;
-
- return false;
-}
-
void TargetMachine::getNameWithPrefix(SmallVectorImpl<char> &Name,
const GlobalValue *GV, Mangler &Mang,
bool MayAlwaysUsePrivate) const {
@@ -177,11 +164,8 @@ void TargetMachine::getNameWithPrefix(SmallVectorImpl<char> &Name,
Mang.getNameWithPrefix(Name, GV, false);
return;
}
- SectionKind GVKind = TargetLoweringObjectFile::getKindForGlobal(GV, *this);
const TargetLoweringObjectFile *TLOF = getObjFileLowering();
- const MCSection *TheSection = TLOF->SectionForGlobal(GV, GVKind, Mang, *this);
- bool CannotUsePrivateLabel = !canUsePrivateLabel(*AsmInfo, *TheSection);
- TLOF->getNameWithPrefix(Name, GV, CannotUsePrivateLabel, Mang, *this);
+ TLOF->getNameWithPrefix(Name, GV, Mang, *this);
}
MCSymbol *TargetMachine::getSymbol(const GlobalValue *GV, Mangler &Mang) const {
OpenPOWER on IntegriCloud