| 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 | { |
no test coverage detected