| 753 | } |
| 754 | |
| 755 | bool Instruction::IsOpaqueType() const { |
| 756 | if (opcode() == spv::Op::OpTypeStruct) { |
| 757 | bool is_opaque = false; |
| 758 | ForEachInOperand([&is_opaque, this](const uint32_t* op_id) { |
| 759 | Instruction* type_inst = context()->get_def_use_mgr()->GetDef(*op_id); |
| 760 | is_opaque |= type_inst->IsOpaqueType(); |
| 761 | }); |
| 762 | return is_opaque; |
| 763 | } else if (opcode() == spv::Op::OpTypeArray) { |
| 764 | uint32_t sub_type_id = GetSingleWordInOperand(0); |
| 765 | Instruction* sub_type_inst = |
| 766 | context()->get_def_use_mgr()->GetDef(sub_type_id); |
| 767 | return sub_type_inst->IsOpaqueType(); |
| 768 | } else { |
| 769 | return opcode() == spv::Op::OpTypeRuntimeArray || |
| 770 | spvOpcodeIsBaseOpaqueType(opcode()); |
| 771 | } |
| 772 | } |
| 773 | |
| 774 | bool Instruction::IsFoldable() const { |
| 775 | return IsFoldableByFoldScalar() || IsFoldableByFoldVector() || |