Allow pointers to pointers in logical addressing mode.
A few optimizations are updates to handle code that is suppose to be
using the logical addressing mode, but still has variables that contain
pointers as long as the pointer are to opaque objects. This is called
"relaxed logical addressing".
|Instruction::GetBaseAddress| will check that pointers that are use meet
the relaxed logical addressing rules. Optimization that now handle
relaxed logical addressing instead of logical addressing are:
- aggressive dead-code elimination
- local access chain convert
- local store elimination passes.
diff --git a/source/opcode.cpp b/source/opcode.cpp
index 7a84046..c76f1b4 100644
--- a/source/opcode.cpp
+++ b/source/opcode.cpp
@@ -417,3 +417,23 @@
return spvOpcodeIsBranch(opcode) || spvOpcodeIsReturn(opcode) ||
opcode == SpvOpKill || opcode == SpvOpUnreachable;
}
+
+bool spvOpcodeIsBaseOpaqueType(SpvOp opcode) {
+ switch (opcode) {
+ case SpvOpTypeImage:
+ case SpvOpTypeSampler:
+ case SpvOpTypeSampledImage:
+ case SpvOpTypeOpaque:
+ case SpvOpTypeEvent:
+ case SpvOpTypeDeviceEvent:
+ case SpvOpTypeReserveId:
+ case SpvOpTypeQueue:
+ case SpvOpTypePipe:
+ case SpvOpTypeForwardPointer:
+ case SpvOpTypePipeStorage:
+ case SpvOpTypeNamedBarrier:
+ return true;
+ default:
+ return false;
+ }
+}