1fd4e5da5Sopenharmony_ci// Copyright (C) 2019 Google Inc. 2fd4e5da5Sopenharmony_ci// 3fd4e5da5Sopenharmony_ci// Licensed under the Apache License, Version 2.0 (the "License"); 4fd4e5da5Sopenharmony_ci// you may not use this file except in compliance with the License. 5fd4e5da5Sopenharmony_ci// You may obtain a copy of the License at 6fd4e5da5Sopenharmony_ci// 7fd4e5da5Sopenharmony_ci// http://www.apache.org/licenses/LICENSE-2.0 8fd4e5da5Sopenharmony_ci// 9fd4e5da5Sopenharmony_ci// Unless required by applicable law or agreed to in writing, software 10fd4e5da5Sopenharmony_ci// distributed under the License is distributed on an "AS IS" BASIS, 11fd4e5da5Sopenharmony_ci// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12fd4e5da5Sopenharmony_ci// See the License for the specific language governing permissions and 13fd4e5da5Sopenharmony_ci// limitations under the License. 14fd4e5da5Sopenharmony_ci 15fd4e5da5Sopenharmony_ci// Package grammar holds the JSON type definitions for the SPIR-V grammar schema. 16fd4e5da5Sopenharmony_ci// 17fd4e5da5Sopenharmony_ci// See https://www.khronos.org/registry/spir-v/specs/unified1/MachineReadableGrammar.html 18fd4e5da5Sopenharmony_ci// for more information. 19fd4e5da5Sopenharmony_cipackage grammar 20fd4e5da5Sopenharmony_ci 21fd4e5da5Sopenharmony_ci// Root is the top-level structure of the JSON grammar. 22fd4e5da5Sopenharmony_citype Root struct { 23fd4e5da5Sopenharmony_ci MagicNumber string `json:"magic_number"` 24fd4e5da5Sopenharmony_ci MajorVersion int `json:"major_version"` 25fd4e5da5Sopenharmony_ci MinorVersion int `json:"minor_version"` 26fd4e5da5Sopenharmony_ci Revision int `json:"revision"` 27fd4e5da5Sopenharmony_ci Instructions []Instruction `json:"instructions"` 28fd4e5da5Sopenharmony_ci OperandKinds []OperandKind `json:"operand_kinds"` 29fd4e5da5Sopenharmony_ci} 30fd4e5da5Sopenharmony_ci 31fd4e5da5Sopenharmony_ci// Instruction holds information about a specific SPIR-V instruction. 32fd4e5da5Sopenharmony_citype Instruction struct { 33fd4e5da5Sopenharmony_ci Opname string `json:"opname"` 34fd4e5da5Sopenharmony_ci Class string `json:"class"` 35fd4e5da5Sopenharmony_ci Opcode int `json:"opcode"` 36fd4e5da5Sopenharmony_ci Operands []Operand `json:"operands"` 37fd4e5da5Sopenharmony_ci} 38fd4e5da5Sopenharmony_ci 39fd4e5da5Sopenharmony_ci// Operand contains information about a logical operand for an instruction. 40fd4e5da5Sopenharmony_citype Operand struct { 41fd4e5da5Sopenharmony_ci Kind string `json:"kind"` 42fd4e5da5Sopenharmony_ci Name string `json:"name"` 43fd4e5da5Sopenharmony_ci Quantifier Quantifier `json:"quantifier"` 44fd4e5da5Sopenharmony_ci} 45fd4e5da5Sopenharmony_ci 46fd4e5da5Sopenharmony_ci// OperandKind contains information about a specific operand kind. 47fd4e5da5Sopenharmony_citype OperandKind struct { 48fd4e5da5Sopenharmony_ci Category string `json:"category"` 49fd4e5da5Sopenharmony_ci Kind string `json:"kind"` 50fd4e5da5Sopenharmony_ci Enumerants []Enumerant `json:"enumerants"` 51fd4e5da5Sopenharmony_ci Bases []string `json:"bases"` 52fd4e5da5Sopenharmony_ci} 53fd4e5da5Sopenharmony_ci 54fd4e5da5Sopenharmony_ci// Enumerant contains information about an enumerant in an enum. 55fd4e5da5Sopenharmony_citype Enumerant struct { 56fd4e5da5Sopenharmony_ci Enumerant string `json:"enumerant"` 57fd4e5da5Sopenharmony_ci Value interface{} `json:"value"` 58fd4e5da5Sopenharmony_ci Capabilities []string `json:"capabilities"` 59fd4e5da5Sopenharmony_ci Parameters []Parameter `json:"parameters"` 60fd4e5da5Sopenharmony_ci Version string `json:"version"` 61fd4e5da5Sopenharmony_ci} 62fd4e5da5Sopenharmony_ci 63fd4e5da5Sopenharmony_ci// Parameter contains information about a logical parameter for an enumerant. 64fd4e5da5Sopenharmony_citype Parameter struct { 65fd4e5da5Sopenharmony_ci Kind string `json:"kind"` 66fd4e5da5Sopenharmony_ci Name string `json:"name"` 67fd4e5da5Sopenharmony_ci} 68fd4e5da5Sopenharmony_ci 69fd4e5da5Sopenharmony_ci// Quantifier indicates the number of times the quantified term may appear. 70fd4e5da5Sopenharmony_citype Quantifier string 71fd4e5da5Sopenharmony_ci 72fd4e5da5Sopenharmony_ciconst ( 73fd4e5da5Sopenharmony_ci // Once indicates the quantified term may appear exactly once. 74fd4e5da5Sopenharmony_ci Once Quantifier = "" 75fd4e5da5Sopenharmony_ci // ZeroOrOnce indicates the quantified term may appear zero or one 76fd4e5da5Sopenharmony_ci // time; an optional term. 77fd4e5da5Sopenharmony_ci ZeroOrOnce Quantifier = "?" 78fd4e5da5Sopenharmony_ci // ZeroOrMany indicates the quantified term may appear any number of 79fd4e5da5Sopenharmony_ci // times. 80fd4e5da5Sopenharmony_ci ZeroOrMany Quantifier = "*" 81fd4e5da5Sopenharmony_ci) 82