@@ -252,59 +252,6 @@ static InstrSignature instrToSignature(const MachineInstr &MI,
252252 return Signature;
253253}
254254
255- void SPIRVModuleAnalysis::collectGlobalEntities (
256- const std::vector<SPIRV::DTSortableEntry *> &DepsGraph,
257- SPIRV::ModuleSectionType MSType,
258- std::function<bool (const SPIRV::DTSortableEntry *)> Pred,
259- bool UsePreOrder = false) {
260- DenseSet<const SPIRV::DTSortableEntry *> Visited;
261- for (const auto *E : DepsGraph) {
262- std::function<void (const SPIRV::DTSortableEntry *)> RecHoistUtil;
263- // NOTE: here we prefer recursive approach over iterative because
264- // we don't expect depchains long enough to cause SO.
265- RecHoistUtil = [MSType, UsePreOrder, &Visited, &Pred,
266- &RecHoistUtil](const SPIRV::DTSortableEntry *E) {
267- if (Visited.count (E) || !Pred (E))
268- return ;
269- Visited.insert (E);
270-
271- // Traversing deps graph in post-order allows us to get rid of
272- // register aliases preprocessing.
273- // But pre-order is required for correct processing of function
274- // declaration and arguments processing.
275- if (!UsePreOrder)
276- for (auto *S : E->getDeps ())
277- RecHoistUtil (S);
278-
279- Register GlobalReg = Register::index2VirtReg (MAI.getNextID ());
280- bool IsFirst = true ;
281- for (auto &U : *E) {
282- const MachineFunction *MF = U.first ;
283- const MachineRegisterInfo &MRI = MF->getRegInfo ();
284- Register Reg = U.second ;
285- MAI.setRegisterAlias (MF, Reg, GlobalReg);
286- MachineInstr *DefMI = MRI.getUniqueVRegDef (Reg);
287- // dbgs() << "----- ";
288- // DefMI->print(dbgs());
289- // dbgs() << " -----\n";
290- if (!DefMI)
291- continue ;
292- MAI.setSkipEmission (DefMI);
293- if (IsFirst)
294- MAI.MS [MSType].push_back (DefMI);
295- IsFirst = false ;
296- if (E->getIsGV ())
297- MAI.GlobalVarList .push_back (DefMI);
298- }
299-
300- if (UsePreOrder)
301- for (auto *S : E->getDeps ())
302- RecHoistUtil (S);
303- };
304- RecHoistUtil (E);
305- }
306- }
307-
308255bool SPIRVModuleAnalysis::isDeclSection (const MachineRegisterInfo &MRI,
309256 const MachineInstr &MI) {
310257 unsigned Opcode = MI.getOpcode ();
@@ -626,7 +573,7 @@ void SPIRVModuleAnalysis::processOtherInstrs(const Module &M) {
626573
627574// Number registers in all functions globally from 0 onwards and store
628575// the result in global register alias table. Some registers are already
629- // numbered in collectGlobalEntities .
576+ // numbered.
630577void SPIRVModuleAnalysis::numberRegistersGlobally (const Module &M) {
631578 for (auto F = M.begin (), E = M.end (); F != E; ++F) {
632579 if ((*F).isDeclaration ())
@@ -1996,7 +1943,6 @@ bool SPIRVModuleAnalysis::runOnModule(Module &M) {
19961943
19971944 // Process type/const/global var/func decl instructions, number their
19981945 // destination registers from 0 to N, collect Extensions and Capabilities.
1999- // processDefInstrs(M);
20001946 collectDeclarations (M);
20011947
20021948 // Number rest of registers from N+1 onwards.
0 commit comments