Lines Matching defs:Globals
1 //===-- GlobalMerge.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.
78 STATISTIC(NumMerged , "Number of globals merged");
83 bool doMerge(SmallVectorImpl<GlobalVariable*> &Globals,
115 return "Merge internal globals";
143 bool GlobalMerge::doMerge(SmallVectorImpl<GlobalVariable*> &Globals,
154 std::stable_sort(Globals.begin(), Globals.end(), GlobalCmp(TD));
158 for (size_t i = 0, e = Globals.size(); i != e; ) {
164 Type *Ty = Globals[j]->getType()->getElementType();
170 Inits.push_back(Globals[j]->getInitializer());
186 Globals[k]->replaceAllUsesWith(GEP);
187 Globals[k]->eraseFromParent();
222 // Look for globals in the clauses of the landing pad instruction
234 DenseMap<unsigned, SmallVector<GlobalVariable*, 16> > Globals, ConstGlobals,
242 // Grab all non-const globals.
245 // Merge is safe for "normal" internal globals only
254 // Ignore fancy-aligned globals for now.
260 // Ignore all 'special' globals.
265 // Ignore all "required" globals:
276 Globals[AddressSpace].push_back(I);
281 I = Globals.begin(), E = Globals.end(); I != E; ++I)