| 507 | } |
| 508 | |
| 509 | std::function<bool(unsigned)> spvOperandCanBeForwardDeclaredFunction( |
| 510 | spv::Op opcode) { |
| 511 | std::function<bool(unsigned index)> out; |
| 512 | if (spvOpcodeGeneratesType(opcode)) { |
| 513 | // All types can use forward pointers. |
| 514 | out = [](unsigned) { return true; }; |
| 515 | return out; |
| 516 | } |
| 517 | switch (opcode) { |
| 518 | case spv::Op::OpExecutionMode: |
| 519 | case spv::Op::OpExecutionModeId: |
| 520 | case spv::Op::OpEntryPoint: |
| 521 | case spv::Op::OpName: |
| 522 | case spv::Op::OpMemberName: |
| 523 | case spv::Op::OpSelectionMerge: |
| 524 | case spv::Op::OpDecorate: |
| 525 | case spv::Op::OpMemberDecorate: |
| 526 | case spv::Op::OpMemberDecorateIdEXT: |
| 527 | case spv::Op::OpDecorateId: |
| 528 | case spv::Op::OpDecorateStringGOOGLE: |
| 529 | case spv::Op::OpMemberDecorateStringGOOGLE: |
| 530 | case spv::Op::OpBranch: |
| 531 | case spv::Op::OpLoopMerge: |
| 532 | case spv::Op::OpConditionalEntryPointINTEL: |
| 533 | case spv::Op::OpConditionalCapabilityINTEL: |
| 534 | case spv::Op::OpConditionalExtensionINTEL: |
| 535 | out = [](unsigned) { return true; }; |
| 536 | break; |
| 537 | case spv::Op::OpGroupDecorate: |
| 538 | case spv::Op::OpGroupMemberDecorate: |
| 539 | case spv::Op::OpBranchConditional: |
| 540 | case spv::Op::OpSwitch: |
| 541 | out = [](unsigned index) { return index != 0; }; |
| 542 | break; |
| 543 | |
| 544 | case spv::Op::OpFunctionCall: |
| 545 | // The Function parameter. |
| 546 | out = [](unsigned index) { return index == 2; }; |
| 547 | break; |
| 548 | |
| 549 | case spv::Op::OpConstantFunctionPointerINTEL: |
| 550 | // The Function parameter. |
| 551 | out = [](unsigned index) { return index == 2; }; |
| 552 | break; |
| 553 | |
| 554 | case spv::Op::OpPhi: |
| 555 | out = [](unsigned index) { return index > 1; }; |
| 556 | break; |
| 557 | |
| 558 | case spv::Op::OpEnqueueKernel: |
| 559 | // The Invoke parameter. |
| 560 | out = [](unsigned index) { return index == 8; }; |
| 561 | break; |
| 562 | |
| 563 | case spv::Op::OpGetKernelNDrangeSubGroupCount: |
| 564 | case spv::Op::OpGetKernelNDrangeMaxSubGroupSize: |
| 565 | // The Invoke parameter. |
| 566 | out = [](unsigned index) { return index == 3; }; |
no test coverage detected