MCPcopy Create free account
hub / github.com/Inori/GPCS4 / processLoopScopes

Method processLoopScopes

GPCS4/Graphics/Gcn/ControlFlowGraph/GcnStackifier.cpp:261–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259 }
260
261 void GcnTokenListBuilder::processLoopScopes(GcnCfgVertex vtx)
262 {
263 do
264 {
265 const auto loop = m_loopInfo.getLoop(vtx);
266 if (!loop)
267 {
268 break;
269 }
270
271 if (loop->getHeader() == vtx)
272 {
273 auto loopToken = m_factory.createLoop();
274 auto loopEndToken = m_factory.createLoopEnd(loopToken);
275
276 auto loopPtr = m_tokens->insertAfter(m_insertPtr, loopToken);
277 auto endPtr = m_tokens->insertAfter(loopPtr, loopEndToken);
278 m_insertPtr = loopPtr;
279
280 Scope loopScope = { Scope::Loop, vtx, endPtr, true };
281 m_scopeStack.push_back(loopScope);
282
283 m_loopCounts.insert(std::make_pair(loop, loop->getNumVertices()));
284 m_loopHeaders.insert(std::make_pair(vtx, loopToken));
285 }
286
287 // Decrement the loop count
288 auto iter = m_loopCounts.find(loop);
289 LOG_ASSERT(iter != m_loopCounts.end(), "loop not recorded.");
290 --iter->second;
291
292 // If the loop has parent,
293 // then loop header is one of the vertices of parent loop,
294 // decrement parent by one when count is 0.
295 while (iter->second == 0)
296 {
297 auto parent = iter->first->getParentLoop();
298 iter = m_loopCounts.find(parent);
299 if (iter == m_loopCounts.end())
300 {
301 break;
302 }
303 --iter->second;
304 }
305
306 } while (false);
307 }
308
309 void GcnTokenListBuilder::processBlockScopes(const std::vector<GcnToken*>& branches)
310 {

Callers

nothing calls this directly

Calls 11

getLoopMethod · 0.80
getHeaderMethod · 0.80
createLoopMethod · 0.80
createLoopEndMethod · 0.80
insertAfterMethod · 0.80
getNumVerticesMethod · 0.80
getParentLoopMethod · 0.80
push_backMethod · 0.45
insertMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected