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

Method emitControlFlowIf

GPCS4/Graphics/Gcn/GcnCompilerFlowControl.cpp:339–365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

337 }
338
339 void GcnCompiler::emitControlFlowIf(const GcnToken& token)
340 {
341 const auto& condition = token.getCondition();
342 uint32_t conditionId = emitControlFlowCondition(condition);
343
344 if (token.kind() == GcnTokenKind::IfNot)
345 {
346 conditionId = m_module.opLogicalNot(m_module.defBoolType(), conditionId);
347 }
348
349 // Declare the 'if' block. We do not know if there
350 // will be an 'else' block or not, so we'll assume
351 // that there is one and leave it empty otherwise.
352 GcnCfgBlock block;
353 block.type = GcnCfgBlockType::If;
354 block.b_if.conditionId = conditionId;
355 block.b_if.labelIf = m_module.allocateId();
356 block.b_if.labelElse = 0;
357 block.b_if.labelEnd = m_module.allocateId();
358 block.b_if.headerPtr = m_module.getInsertionPtr();
359 m_controlFlowStack.push_back(block);
360
361 // We'll insert the branch instruction when closing
362 // the block, since we don't know whether or not an
363 // else block is needed right now.
364 m_module.opLabel(block.b_if.labelIf);
365 }
366
367 void GcnCompiler::emitControlFlowElse(const GcnToken& token)
368 {

Callers 2

compileTokenIfMethod · 0.95
compileTokenIfNotMethod · 0.95

Calls 7

kindMethod · 0.80
opLogicalNotMethod · 0.80
defBoolTypeMethod · 0.80
allocateIdMethod · 0.80
opLabelMethod · 0.80
getInsertionPtrMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected