spirv-opt: Add spvOpcodeIsAccessChain (#3682)

This commit is contained in:
André Perez 2020-08-11 12:21:36 -03:00 committed by GitHub
parent b7056e7e03
commit f505538677
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -719,3 +719,15 @@ std::vector<uint32_t> spvOpcodeMemorySemanticsOperandIndices(SpvOp opcode) {
return {}; return {};
} }
} }
bool spvOpcodeIsAccessChain(SpvOp opcode) {
switch (opcode) {
case SpvOpAccessChain:
case SpvOpInBoundsAccessChain:
case SpvOpPtrAccessChain:
case SpvOpInBoundsPtrAccessChain:
return true;
default:
return false;
}
}

View File

@ -144,4 +144,7 @@ bool spvOpcodeIsImageSample(SpvOp opcode);
// operands for |opcode|. // operands for |opcode|.
std::vector<uint32_t> spvOpcodeMemorySemanticsOperandIndices(SpvOp opcode); std::vector<uint32_t> spvOpcodeMemorySemanticsOperandIndices(SpvOp opcode);
// Returns true for opcodes that represents access chain instructions.
bool spvOpcodeIsAccessChain(SpvOp opcode);
#endif // SOURCE_OPCODE_H_ #endif // SOURCE_OPCODE_H_