summaryrefslogtreecommitdiff
path: root/source/operand.cpp
diff options
context:
space:
mode:
authorDejan Mircevski <deki@google.com>2016-01-15 11:25:11 -0500
committerDavid Neto <dneto@google.com>2016-01-20 17:00:58 -0500
commit961f5dc54408b1516b9e4d85ee1fb4891b903f61 (patch)
treefc7417697b032295a346e7dcbd6c92ac9ca1b941 /source/operand.cpp
parent383c83729e608c3ce815d7d19f44fc5b729092c5 (diff)
downloadSPIRV-Tools-961f5dc54408b1516b9e4d85ee1fb4891b903f61.tar.gz
SPIRV-Tools-961f5dc54408b1516b9e4d85ee1fb4891b903f61.tar.bz2
SPIRV-Tools-961f5dc54408b1516b9e4d85ee1fb4891b903f61.zip
Track uses and defs during parsing.
Replace two other, imperfect mechanisms for use-def tracking. Use ValidationState_t::entry_points to track entry points. Concentrate undefined-ID diagnostics in a single place. Move validate_types.h content into validate.h due to increased inter-dependency. Track uses of all IDs: TYPE_ID, SCOPE_ID, ... Also update some blurbs. Fix entry-point accumulation and move it outside ProcessIds(). Remove validate_types.h from CMakeLists.txt. Blurb for spvIsIdType. Remove redundant diagnostics for undefined IDs. Join "can not" and reformat.
Diffstat (limited to 'source/operand.cpp')
-rw-r--r--source/operand.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/operand.cpp b/source/operand.cpp
index 864a1d65..7eae14e8 100644
--- a/source/operand.cpp
+++ b/source/operand.cpp
@@ -1367,3 +1367,17 @@ spv_operand_pattern_t spvAlternatePatternFollowingImmediate(
// No result-id found, so just expect CIVs.
return {SPV_OPERAND_TYPE_OPTIONAL_CIV};
}
+
+bool spvIsIdType(spv_operand_type_t type) {
+ switch (type) {
+ case SPV_OPERAND_TYPE_ID:
+ case SPV_OPERAND_TYPE_TYPE_ID:
+ case SPV_OPERAND_TYPE_RESULT_ID:
+ case SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID:
+ case SPV_OPERAND_TYPE_SCOPE_ID:
+ return true;
+ default:
+ return false;
+ }
+ return false;
+}