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

Method popScopes

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

Source from the content-addressed store, hash-verified

331 }
332
333 void GcnTokenListBuilder::popScopes(GcnCfgVertex vtx)
334 {
335 // Check if we need to close some scopes
336 while (!m_scopeStack.empty())
337 {
338 auto& scope = m_scopeStack.back();
339 switch (scope.m_kind)
340 {
341 case Scope::If:
342 case Scope::Direct:
343 {
344 if (scope.m_nested && m_domTree.dominates(scope.m_vertex, vtx))
345 {
346 return;
347 }
348
349 // If the scope is not nested, add the branch token
350 if (!scope.m_nested)
351 {
352 auto iter = m_loopHeaders.find(scope.m_vertex);
353 GcnToken* branch = iter == m_loopHeaders.end()
354 ? m_factory.createBranch(nullptr)
355 : m_factory.createBranch(iter->second);
356
357 m_blockScopes[scope.m_vertex].push_back(branch);
358 m_insertPtr = m_tokens->insertAfter(m_insertPtr, branch);
359 }
360 }
361 break;
362 case Scope::Loop:
363 {
364 const auto loop = m_loopInfo.getLoop(scope.m_vertex);
365 auto iter = m_loopCounts.find(loop);
366 LOG_ASSERT(iter != m_loopCounts.end(), "can't find loop.");
367 uint32_t countLeft = iter->second;
368 if (countLeft > 0)
369 {
370 return;
371 }
372 }
373 break;
374 }
375
376 if (scope.m_endPtr != m_tokens->end())
377 {
378 m_insertPtr = scope.m_endPtr;
379 }
380
381 m_scopeStack.pop_back();
382 }
383 }
384
385 GcnToken* GcnTokenListBuilder::makeCode(GcnCfgVertex vtx)
386 {

Callers

nothing calls this directly

Calls 10

backMethod · 0.80
dominatesMethod · 0.80
createBranchMethod · 0.80
insertAfterMethod · 0.80
getLoopMethod · 0.80
emptyMethod · 0.45
findMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45
pop_backMethod · 0.45

Tested by

no test coverage detected