Debian Codegraph @

arm64/instgen/xmlspec/xml.go

raw symbols SCIP
1 // Copyright 2026 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package xmlspec
6
7 import "encoding/xml"
8
9 // This file contains the data types for the XML specification of the ARM64 ISA.
10
11 // DocVar represents a <docvar> element, storing document metadata like "isa" or "mnemonic".
12 type DocVar struct {
13 Key string `xml:"key,attr"`
14 Value string `xml:"value,attr"`
15 }
16
17 // C represents a <c> element within a register diagram box, specifying bit content or a named field.
18 type C struct {
19 Value string `xml:",chardata"`
20 ColSpan string `xml:"colspan,attr"`
21 }
22
23 // Box represents a <box> element in a register diagram, describing a specific bitfield.
24 type Box struct {
25 HiBit string `xml:"hibit,attr"`
26 Name string `xml:"name,attr"`
27 Cs []C `xml:"c"`
28 }
29
30 // TextA represents a <text> or <a> element within an assembly template.
31 type TextA struct {
32 Value string `xml:",chardata"`
33 Link string `xml:"link,attr"`
34 }
35
36 // AsmTemplate represents an <asmtemplate> element, defining the syntax of the instruction.
37 type AsmTemplate struct {
38 // <Asmtemplate> contains two kinds of sub-elements, <text> and <a>.
39 // <text> contains string literals, <a> contains a symbol and
40 // two attributes: link and hover. The order of <text> and <a> matters,
41 // so we save both into the following structure to preserve their order.
42 TextA []TextA `xml:",any"`
43 }
44
45 // RegDiagram represents a <regdiagram> element, detailing the bit layout of an encoding.
46 type RegDiagram struct {
47 Boxes []Box `xml:"box"`
48 PsName string `xml:"psname,attr"`
49 }
50
51 // Encoding represents an <encoding> element for a specific instruction variant.
52 type Encoding struct {
53 Name string `xml:"name,attr"`
54 DocVars []DocVar `xml:"docvars>docvar"`
55 Boxes []Box `xml:"box"`
56 AsmTemplate AsmTemplate `xml:"asmtemplate"`
57 }
58
59 type ArchVariant struct {
60 Feature string `xml:"feature,attr"`
61 }
62
63 // Iclass represents an <iclass> element, grouping instruction encodings that share a register diagram.
64 type Iclass struct {
65 Name string `xml:"name,attr"`
66 DocVars []DocVar `xml:"docvars>docvar"`
67 ArchVariants []ArchVariant `xml:"arch_variant"`
68 RegDiagram RegDiagramParsed `xml:"regdiagram"`
69 Encodings []EncodingParsed `xml:"encoding"`
70 PsSection []PsSection `xml:"ps_section"`
71 }
72
73 // Classes represents a <classes> element, grouping instruction classes.
74 type Classes struct {
75 Iclass []Iclass `xml:"iclass"`
76 }
77
78 // Symbol represents a <symbol> element, linking an explanation to an assembly sequence symbol.
79 type Symbol struct {
80 Value string `xml:",chardata"`
81 Link string `xml:"link,attr"`
82 }
83
84 // Account represents an <account> element, providing a textual explanation for a symbol.
85 type Account struct {
86 Encodedin string `xml:"encodedin,attr"`
87 DocVars []DocVar `xml:"docvars>docvar"`
88 Intro string `xml:"intro>para"`
89 }
90
91 // Entry represents an <entry> element, defining a single cell in a definition table.
92 type Entry struct {
93 Value string `xml:",chardata"`
94 Class string `xml:"class,attr"`
95 }
96
97 // Row represents a <row> element within a table header or body.
98 type Row struct {
99 Entries []Entry `xml:"entry"`
100 }
101
102 // THead represents a <thead> element, containing the table header.
103 type THead struct {
104 Row Row `xml:"row"`
105 }
106
107 // TBody represents a <tbody> element, containing the table body.
108 type TBody struct {
109 Row []Row `xml:"row"`
110 }
111
112 // TGroup represents a <tgroup> element, defining the column and row groups of a table.
113 type TGroup struct {
114 THead THead `xml:"thead"`
115 TBody TBody `xml:"tbody"`
116 }
117
118 // Table represents a <table> element used to explain symbol encodings.
119 type Table struct {
120 Class string `xml:"class,attr"`
121 TGroup TGroup `xml:"tgroup"`
122 }
123
124 // Definition represents a <definition> element, usually containing a table to define symbol values.
125 type Definition struct {
126 Encodedin string `xml:"encodedin,attr"`
127 Intro string `xml:"intro"`
128 Table Table `xml:"table"`
129 }
130
131 // Explanation represents an <explanation> element for a symbol used in the assembly template.
132 type Explanation struct {
133 Symbol Symbol `xml:"symbol"`
134 Account Account `xml:"account"`
135 Definition Definition `xml:"definition"`
136 }
137
138 // Explanations represents an <explanations> element, grouping symbol explanations.
139 type Explanations struct {
140 Scope string `xml:"scope,attr"`
141 Explanations []Explanation `xml:"explanation"`
142 }
143
144 // Desc represents a <desc> element, containing the description of an instruction.
145 type Desc struct {
146 Brief Brief `xml:"brief"`
147 Authored Authored `xml:"authored"`
148 }
149
150 // Brief represents a <brief> element, containing a brief description.
151 type Brief struct {
152 Para []Para `xml:"para"`
153 }
154
155 // Authored represents an <authored> element, containing authored paragraphs.
156 type Authored struct {
157 Paragraphs []Para `xml:"para"`
158 }
159
160 // Para represents a <para> element, containing paragraph text.
161 type Para struct {
162 Text string `xml:",innerxml"`
163 }
164
165 // PsSection represents a <ps_section> element, containing pseudocode sections.
166 type PsSection struct {
167 Ps []Ps `xml:"ps"`
168 }
169
170 // Ps represents a <ps> element, containing pseudocode text.
171 type Ps struct {
172 PSText []string `xml:"pstext"` // pseudocode text
173 }
174
175 // Instruction represents the root <instructionsection> element of an instruction XML specification.
176 type Instruction struct {
177 XMLName xml.Name `xml:"instructionsection"`
178 Title string `xml:"title,attr"`
179 Desc Desc `xml:"desc"`
180 Type string `xml:"type,attr"`
181 DocVars []DocVar `xml:"docvars>docvar"`
182 Classes Classes `xml:"classes"`
183 Explanations Explanations `xml:"explanations"`
184 PsSections []PsSection `xml:"ps_section"`
185 }