Lines Matching refs:Globals
1 //===-- ARMGlobalMerge.cpp - Internal globals merging --------------------===//
9 // This pass merges globals with internal linkage into one. This way all the
10 // globals which were merged into a biggest one can be addressed using offsets
13 // when many globals are involved.
77 bool doMerge(SmallVectorImpl<GlobalVariable*> &Globals,
89 return "Merge internal globals";
114 bool ARMGlobalMerge::doMerge(SmallVectorImpl<GlobalVariable*> &Globals,
124 std::stable_sort(Globals.begin(), Globals.end(), GlobalCmp(TD));
128 for (size_t i = 0, e = Globals.size(); i != e; ) {
134 Type *Ty = Globals[j]->getType()->getElementType();
140 Inits.push_back(Globals[j]->getInitializer());
154 Globals[k]->replaceAllUsesWith(GEP);
155 Globals[k]->eraseFromParent();
165 SmallVector<GlobalVariable*, 16> Globals, ConstGlobals, BSSGlobals;
170 // Grab all non-const globals.
173 // Merge is safe for "normal" internal globals only
177 // Ignore fancy-aligned globals for now.
183 // Ignore all 'special' globals.
195 Globals.push_back(I);
199 if (Globals.size() > 1)
200 Changed |= doMerge(Globals, M, false);