diff options
author | Bob Wilson <bob.wilson@apple.com> | 2010-11-17 21:25:39 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2010-11-17 21:25:39 +0000 |
commit | 881b45ccdf866e982b1dadc93b19dc11cf245bf7 (patch) | |
tree | a79fb57e25f291f7696105a98865e571d999cc84 /llvm/lib/Target/ARM/ARMGlobalMerge.cpp | |
parent | 4c8ab19c225ea95587bf06dc5d2107c59e1678a4 (diff) | |
download | bcm5719-llvm-881b45ccdf866e982b1dadc93b19dc11cf245bf7.tar.gz bcm5719-llvm-881b45ccdf866e982b1dadc93b19dc11cf245bf7.zip |
Change ARMGlobalMerge to keep BSS globals in separate pools.
This completes the fixes for Radar 8673120.
llvm-svn: 119566
Diffstat (limited to 'llvm/lib/Target/ARM/ARMGlobalMerge.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/ARMGlobalMerge.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/Target/ARM/ARMGlobalMerge.cpp b/llvm/lib/Target/ARM/ARMGlobalMerge.cpp index 72cab6462c4..3f0238387a2 100644 --- a/llvm/lib/Target/ARM/ARMGlobalMerge.cpp +++ b/llvm/lib/Target/ARM/ARMGlobalMerge.cpp @@ -65,6 +65,7 @@ #include "llvm/Pass.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetLowering.h" +#include "llvm/Target/TargetLoweringObjectFile.h" using namespace llvm; namespace { @@ -74,7 +75,7 @@ namespace { const TargetLowering *TLI; bool doMerge(SmallVectorImpl<GlobalVariable*> &Globals, - Module &M, bool) const; + Module &M, bool isConst) const; public: static char ID; // Pass identification, replacement for typeid. @@ -161,7 +162,7 @@ bool ARMGlobalMerge::doMerge(SmallVectorImpl<GlobalVariable*> &Globals, bool ARMGlobalMerge::doInitialization(Module &M) { - SmallVector<GlobalVariable*, 16> Globals, ConstGlobals; + SmallVector<GlobalVariable*, 16> Globals, ConstGlobals, BSSGlobals; const TargetData *TD = TLI->getTargetData(); unsigned MaxOffset = TLI->getMaximalGlobalOffset(); bool Changed = false; @@ -183,7 +184,10 @@ bool ARMGlobalMerge::doInitialization(Module &M) { continue; if (TD->getTypeAllocSize(I->getType()->getElementType()) < MaxOffset) { - if (I->isConstant()) + const TargetLoweringObjectFile &TLOF = TLI->getObjFileLowering(); + if (TLOF.getKindForGlobal(I, TLI->getTargetMachine()).isBSSLocal()) + BSSGlobals.push_back(I); + else if (I->isConstant()) ConstGlobals.push_back(I); else Globals.push_back(I); @@ -192,10 +196,12 @@ bool ARMGlobalMerge::doInitialization(Module &M) { if (Globals.size() > 1) Changed |= doMerge(Globals, M, false); + if (BSSGlobals.size() > 1) + Changed |= doMerge(BSSGlobals, M, false); + // FIXME: This currently breaks the EH processing due to way how the // typeinfo detection works. We might want to detect the TIs and ignore // them in the future. - // if (ConstGlobals.size() > 1) // Changed |= doMerge(ConstGlobals, M, true); |