LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2014 The Go Authors. All rights reserved. | 1 // Copyright 2014 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // Armmap constructs the ARM opcode map from the instruction set CSV file. | 5 // Armmap constructs the ARM opcode map from the instruction set CSV file. |
6 // | 6 // |
7 // Usage: | 7 // Usage: |
8 // armmap [-fmt=format] arm.csv | 8 // armmap [-fmt=format] arm.csv |
9 // | 9 // |
10 // The known output formats are: | 10 // The known output formats are: |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } | 129 } |
130 | 130 |
131 // add adds the entry from the CSV described by maskstr, valuestr, text, encodin
g, tags | 131 // add adds the entry from the CSV described by maskstr, valuestr, text, encodin
g, tags |
132 // to the program p. | 132 // to the program p. |
133 func add(p *Prog, maskstr, valuestr, text, encoding, tags string) { | 133 func add(p *Prog, maskstr, valuestr, text, encoding, tags string) { |
134 if strings.Contains(tags, "pseudo") { | 134 if strings.Contains(tags, "pseudo") { |
135 return | 135 return |
136 } | 136 } |
137 | 137 |
138 // For now, ignore the VFP floating point instructions. | 138 // For now, ignore the VFP floating point instructions. |
139 » if strings.HasPrefix(text, "V") { | 139 » if strings.HasPrefix(text, "V") && !strings.Contains(tags, "vfp") { |
140 // TODO | 140 // TODO |
141 return | 141 return |
142 } | 142 } |
143 | 143 |
144 mask, err := strconv.ParseUint(maskstr, 0, 32) | 144 mask, err := strconv.ParseUint(maskstr, 0, 32) |
145 if err != nil { | 145 if err != nil { |
146 log.Printf("invalid mask %q", maskstr) | 146 log.Printf("invalid mask %q", maskstr) |
147 return | 147 return |
148 } | 148 } |
149 value, err := strconv.ParseUint(valuestr, 0, 32) | 149 value, err := strconv.ParseUint(valuestr, 0, 32) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // Parse opcode suffixes. | 192 // Parse opcode suffixes. |
193 i := strings.Index(op, "<") | 193 i := strings.Index(op, "<") |
194 if i < 0 { | 194 if i < 0 { |
195 i = len(op) | 195 i = len(op) |
196 } | 196 } |
197 if j := strings.Index(op, "{"); j >= 0 && j < i { | 197 if j := strings.Index(op, "{"); j >= 0 && j < i { |
198 i = j | 198 i = j |
199 } | 199 } |
200 op, suffix := op[:i], op[i:] | 200 op, suffix := op[:i], op[i:] |
201 if suffix != "" && opSuffix[suffix] == "" { | 201 if suffix != "" && opSuffix[suffix] == "" { |
202 » » fmt.Fprintf(os.Stderr, "%s: invalid op suffix %q in %s\n", text,
op[i:], op) | 202 » » fmt.Fprintf(os.Stderr, "%s: invalid op suffix %q in %s\n", text,
suffix, op+suffix) |
203 } | 203 } |
204 | 204 |
205 // Make sure fields needed by opcode suffix are available. | 205 // Make sure fields needed by opcode suffix are available. |
206 for _, f := range strings.Split(opSuffix[suffix], ",") { | 206 for _, f := range strings.Split(opSuffix[suffix], ",") { |
207 if f != "" && fieldWidth[f] == 0 { | 207 if f != "" && fieldWidth[f] == 0 { |
208 fmt.Fprintf(os.Stderr, "%s: opsuffix %s missing %s in en
coding %s\n", text, suffix, f, encoding) | 208 fmt.Fprintf(os.Stderr, "%s: opsuffix %s missing %s in en
coding %s\n", text, suffix, f, encoding) |
209 } | 209 } |
210 fieldUsed[f] = true | 210 fieldUsed[f] = true |
211 } | 211 } |
212 | 212 |
(...skipping 26 matching lines...) Expand all Loading... |
239 // opBits is a sequence of 16-bit chunks describing contiguous b
it sections. | 239 // opBits is a sequence of 16-bit chunks describing contiguous b
it sections. |
240 // Each chunk is 8-bit offset followed by 8-bit size. | 240 // Each chunk is 8-bit offset followed by 8-bit size. |
241 opBits = opBits<<16 | uint64(fieldOffset[f])<<8 | 1 | 241 opBits = opBits<<16 | uint64(fieldOffset[f])<<8 | 1 |
242 } | 242 } |
243 // Then the true field substitutions. | 243 // Then the true field substitutions. |
244 haveCond := false | 244 haveCond := false |
245 for strings.Contains(suffix, "<") { | 245 for strings.Contains(suffix, "<") { |
246 var f, literal, x string | 246 var f, literal, x string |
247 if len(opFields) == 0 { | 247 if len(opFields) == 0 { |
248 fmt.Fprintf(os.Stderr, "%s: ran out of suffix fields for
<%s>\n", text, x) | 248 fmt.Fprintf(os.Stderr, "%s: ran out of suffix fields for
<%s>\n", text, x) |
249 » » » continue | 249 » » » break |
250 } | 250 } |
251 f, opFields = opFields[0], opFields[1:] | 251 f, opFields = opFields[0], opFields[1:] |
252 i := strings.Index(suffix, "<") | 252 i := strings.Index(suffix, "<") |
253 j := strings.Index(suffix, ">") | 253 j := strings.Index(suffix, ">") |
254 literal, x, suffix = suffix[:i], suffix[i+1:j], suffix[j+1:] | 254 literal, x, suffix = suffix[:i], suffix[i+1:j], suffix[j+1:] |
255 | 255 |
256 // Add leading literal text to all opcodes. | 256 // Add leading literal text to all opcodes. |
257 ops = cross(ops, literal) | 257 ops = cross(ops, literal) |
258 | 258 |
259 // The <c> condition can happen anywhere in the opcode text | 259 // The <c> condition can happen anywhere in the opcode text |
260 // but we want to generate the actual variation in the low bits | 260 // but we want to generate the actual variation in the low bits |
261 // of the list index. Remember when and where we've seen <c> and
apply | 261 // of the list index. Remember when and where we've seen <c> and
apply |
262 // it after the loop has finished. | 262 // it after the loop has finished. |
263 if x == "c" && f == "cond:4" { | 263 if x == "c" && f == "cond:4" { |
264 haveCond = true | 264 haveCond = true |
265 ops = cross(ops, "_COND_") | 265 ops = cross(ops, "_COND_") |
266 continue | 266 continue |
267 } | 267 } |
268 | 268 |
269 // Otherwise, choices[x] lists the possible expansions of <x>. | 269 // Otherwise, choices[x] lists the possible expansions of <x>. |
270 // If <x> is of the form <A,B,C> the choices are A, B, and C. | 270 // If <x> is of the form <A,B,C> the choices are A, B, and C. |
271 expand := choices[x] | 271 expand := choices[x] |
272 if expand == nil && strings.Contains(x, ",") { | 272 if expand == nil && strings.Contains(x, ",") { |
273 expand = strings.Split(x, ",") | 273 expand = strings.Split(x, ",") |
274 } | 274 } |
275 if expand == nil { | 275 if expand == nil { |
276 fmt.Fprintf(os.Stderr, "%s: unknown choices for <%s>\n",
text, x) | 276 fmt.Fprintf(os.Stderr, "%s: unknown choices for <%s>\n",
text, x) |
277 expand = []string{x} | 277 expand = []string{x} |
278 } else if len(expand) != 1<<uint(fieldWidth[f]) { | 278 } else if len(expand) != 1<<uint(fieldWidth[f]) { |
279 » » » fmt.Fprintf(os.Stderr, "%s: have %d choices for <%s> but
%d bits\n", text, len(expand), fieldWidth[f]) | 279 » » » fmt.Fprintf(os.Stderr, "%s: have %d choices for <%s> but
%d bits\n", text, len(expand), x, fieldWidth[f]) |
280 } | 280 } |
281 opBits = opBits<<16 | uint64(fieldOffset[f])<<8 | uint64(fieldWi
dth[f]) | 281 opBits = opBits<<16 | uint64(fieldOffset[f])<<8 | uint64(fieldWi
dth[f]) |
282 ops = cross(ops, expand...) | 282 ops = cross(ops, expand...) |
283 } | 283 } |
284 if haveCond { | 284 if haveCond { |
285 // Apply condtional suffix last. | 285 // Apply condtional suffix last. |
286 opBits = opBits<<16 | 28<<8 | 4 | 286 opBits = opBits<<16 | 28<<8 | 4 |
287 ops = crossCond(ops) | 287 ops = crossCond(ops) |
288 } | 288 } |
289 ops = cross(ops, suffix) | 289 ops = cross(ops, suffix) |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 p.Inst = append(p.Inst, inst) | 401 p.Inst = append(p.Inst, inst) |
402 | 402 |
403 if fuzzy != 0 { | 403 if fuzzy != 0 { |
404 inst.Mask &^= fuzzy | 404 inst.Mask &^= fuzzy |
405 inst.Priority-- | 405 inst.Priority-- |
406 p.Inst = append(p.Inst, inst) | 406 p.Inst = append(p.Inst, inst) |
407 } | 407 } |
408 } | 408 } |
409 | 409 |
410 // opSuffix describes the encoding fields used to resolve a given opcode suffix. | 410 // opSuffix describes the encoding fields used to resolve a given opcode suffix. |
411 // The entries marked xxx can happen in instructions that we're not supporting | |
412 // yet (usually the VFP instructions). | |
413 var opSuffix = map[string]string{ | 411 var opSuffix = map[string]string{ |
414 » "<ADD,SUB>": "op", | 412 » "<ADD,SUB>": "op", |
415 » "<BIF,BIT,BSL>": "op:2", | 413 » "<BIF,BIT,BSL>": "op:2", |
416 » "<GE,GT>.F32": "op", | 414 » "<MLA,MLS><c>.F<32,64>": "op,cond:4,sz", |
417 » "<MAX,MIN>.<dt>": "op,size:2", | 415 » "<MLS,MLA><c>.F<32,64>": "op,cond:4,sz", |
418 » "<MAX,MIN>.F32": "op", | 416 » "<BT,TB><c>": "tb,cond:4", |
419 » "<MIN,MAX>.<dt>": "xxx", | 417 » "<TBL,TBX>.8": "op", |
420 » "<MIN,MAX>.F32": "xxx", | 418 » "<c>": "cond:4", |
421 » "<MLA,MLS>.<dt>": "op,size:2", | 419 » "<c>.32": "cond:4", |
422 » "<MLA,MLS>.F32": "op", | 420 » "<c>.F<32,64>": "cond:4,sz", |
423 » "<MLA,MLS><c>.F64": "op,cond:4", | 421 » "<x><y><c>": "N,M,cond:4", |
424 » "<MLA,MLS>L.<dt>": "op,size:2", | 422 » "<y><c>": "M,cond:4", |
425 » "<MLAL,MLSL>.<dt>": "xxx", | 423 » "{B}<c>": "B,cond:4", |
426 » "<BT,TB><c>": "tb,cond:4", | 424 » "{E}<c>.F<32,64>": "E,cond:4,sz", |
427 » "<TBL,TBX>.8": "op", | 425 » "{R}<c>": "R,cond:4", |
428 » "<Td>.<Tm_1>": "op:2,size:2", | 426 » "<c>.F<32,64>.<U,S>32": "cond:4,sz,op", |
429 » "<Td>.<Tm_2>": "op,U", | 427 » "<R,><c>.<U,S>32.F<32,64>": "op,cond:4,signed,sz", |
430 » "{R}<c>.<Td>.<Tm_3>": "opc2:3,sz", | 428 » "{S}<c>": "S,cond:4", |
431 » "<c>": "cond:4", | 429 » "{W}": "R", |
432 » "<c>.8": "cond:4", | 430 » "{X}<c>": "M,cond:4", |
433 » "<c>.<Td_Tf>": "cond:4,op,sf", | 431 » "<B,T><c>.<F32.F16,F16.F32>": "T,cond:4,op", |
434 » "<c>.<dt>": "cond:4,size:2", | 432 » "<c>.<F64.F32,F32.F64>": "cond:4,sz", |
435 » "<c>.<size_be>": "cond:4,b,e", | 433 » "<c>.FX<S,U><16,32>.F<32,64>": "cond:4,U,sx,sz", |
436 » "<c>.F32": "cond:4", | 434 » "<c>.F<32,64>.FX<S,U><16,32>": "cond:4,sz,U,sx", |
437 » "<c>.F32.F16": "cond:4", | |
438 » "<c>.F64": "cond:4", | |
439 » "<c>.F64.F32": "cond:4", | |
440 » "<c>.I<size>": "xxx", | |
441 » "<dt>": "xxx", | |
442 » "<dt_Usize>": "U,size:2", | |
443 » "<dt_Fsize>": "F,size:2", | |
444 » "<dt_Isize>": "size:2", | |
445 » "<n>.<size>": "op:2,size:2", | |
446 » "<size>": "xxx", | |
447 » "<size_x>": "imm4:4", | |
448 » "<type><size>": "xxx", | |
449 » "<x><y><c>": "N,M,cond:4", | |
450 » "<y><c>": "M,cond:4", | |
451 » "<y><c>.F32.F16": "T,cond:4", | |
452 » "{B}<c>": "B,cond:4", | |
453 » "{E}<c>.F64": "E,cond:4", | |
454 » "{R}<c>": "R,cond:4", | |
455 » "{R}<c>.S32.F64": "R,cond:4", | |
456 » "{S}<c>": "S,cond:4", | |
457 » "{U}.<type><size>": "xxx", | |
458 » "{U}N.<type><size>": "xxx", | |
459 » "{W}": "R", | |
460 » "{X}<c>": "M,cond:4", | |
461 » "<dt_simd>": "cmode:4", | |
462 » "<size_n>": "size:2", | |
463 » "<size_vs>": "L,imm6:6", | |
464 » "<size_vsn>": "imm6:6", | |
465 » "<type_U><size_vs>": "U,L,imm6:6", | |
466 } | 435 } |
467 | 436 |
468 // choices[x] describes the choices for filling in "<"+x+">" in an opcode suffix
. | 437 // choices[x] describes the choices for filling in "<"+x+">" in an opcode suffix
. |
469 // Opcodes that end up containing ZZ take up a numeric sequence value but are | 438 // Opcodes that end up containing ZZ take up a numeric sequence value but are |
470 // not exported in the package API. | 439 // not exported in the package API. |
471 var choices = map[string][]string{ | 440 var choices = map[string][]string{ |
472 "c": {".EQ", ".NE", ".CS", ".CC", ".MI", ".PL", ".VS", ".VC", ".HI", ".L
S", ".GE", ".LT", ".GT", ".LE", "", ".ZZ"}, | 441 "c": {".EQ", ".NE", ".CS", ".CC", ".MI", ".PL", ".VS", ".VC", ".HI", ".L
S", ".GE", ".LT", ".GT", ".LE", "", ".ZZ"}, |
473 "x": {"B", "T"}, | 442 "x": {"B", "T"}, |
474 "y": {"B", "T"}, | 443 "y": {"B", "T"}, |
475 } | 444 } |
476 | 445 |
477 // argOps maps from argument descriptions to internal decoder name. | 446 // argOps maps from argument descriptions to internal decoder name. |
478 var argOps = map[string]string{ | 447 var argOps = map[string]string{ |
479 // 4-bit register encodings | 448 // 4-bit register encodings |
480 » "<Rm>|Rm:4@0": "arg_R_0", | 449 » "<Rm>|Rm:4@0": "arg_R_0", |
481 » "<Rn>|Rn:4@0": "arg_R_0", | 450 » "<Rn>|Rn:4@0": "arg_R_0", |
482 » "<Rt>|Rt:4@0": "arg_R_0", | 451 » "<Rt>|Rt:4@0": "arg_R_0", |
483 » "<Rm>|Rm:4@8": "arg_R_8", | 452 » "<Rm>|Rm:4@8": "arg_R_8", |
484 » "<Ra>|Ra:4@12": "arg_R_12", | 453 » "<Ra>|Ra:4@12": "arg_R_12", |
485 » "<Rd>|Rd:4@12": "arg_R_12", | 454 » "<Rd>|Rd:4@12": "arg_R_12", |
486 » "<RdLo>|RdLo:4@12": "arg_R_12", | 455 » "<RdLo>|RdLo:4@12": "arg_R_12", |
487 » "<Rt>|Rt:4@12": "arg_R_12", | 456 » "<Rt>|Rt:4@12": "arg_R_12", |
488 » "<Rd>|Rd:4@16": "arg_R_16", | 457 » "<Rt_nzcv>|Rt:4@12": "arg_R_12_nzcv", |
489 » "<RdHi>|RdHi:4@16": "arg_R_16", | 458 » "<Rd>|Rd:4@16": "arg_R_16", |
490 » "<Rn>|Rn:4@16": "arg_R_16", | 459 » "<RdHi>|RdHi:4@16": "arg_R_16", |
| 460 » "<Rn>|Rn:4@16": "arg_R_16", |
491 | 461 |
492 // first and second of consecutive register pair | 462 // first and second of consecutive register pair |
493 "<Rt1>|Rt:4@0": "arg_R1_0", | 463 "<Rt1>|Rt:4@0": "arg_R1_0", |
494 "<Rt1>|Rt:4@12": "arg_R1_12", | 464 "<Rt1>|Rt:4@12": "arg_R1_12", |
495 "<Rt2>|Rt:4@0": "arg_R2_0", | 465 "<Rt2>|Rt:4@0": "arg_R2_0", |
496 "<Rt2>|Rt:4@12": "arg_R2_12", | 466 "<Rt2>|Rt:4@12": "arg_R2_12", |
497 | 467 |
498 // register arithmetic | 468 // register arithmetic |
499 "<Rm>,<type> <Rs>|Rm:4@0|Rs:4@8|type:2@5": "arg_R_shift_R", | 469 "<Rm>,<type> <Rs>|Rm:4@0|Rs:4@8|type:2@5": "arg_R_shift_R", |
500 "<Rm>{,<shift>}|Rm:4@0|imm5:5@7|type:2@5": "arg_R_shift_imm", | 470 "<Rm>{,<shift>}|Rm:4@0|imm5:5@7|type:2@5": "arg_R_shift_imm", |
501 "<Rn>{,<shift>}|Rn:4@0|imm5:5@7|sh@6": "arg_R_shift_imm", | 471 "<Rn>{,<shift>}|Rn:4@0|imm5:5@7|sh@6": "arg_R_shift_imm", |
502 "<Rm>{,LSL #<imm5>}|Rm:4@0|imm5:5@7": "arg_R_shift_imm", | 472 "<Rm>{,LSL #<imm5>}|Rm:4@0|imm5:5@7": "arg_R_shift_imm", |
503 "<Rm>{,<rotation>}|Rm:4@0|rotate:2@10": "arg_R_rotate", | 473 "<Rm>{,<rotation>}|Rm:4@0|rotate:2@10": "arg_R_rotate", |
504 | 474 |
505 // memory references | 475 // memory references |
506 "<Rn>{!}|Rn:4@16|W@21": "arg_R_16_WB", | 476 "<Rn>{!}|Rn:4@16|W@21": "arg_R_16_WB", |
507 "[<Rn>]|Rn:4@16": "arg_mem_R", | 477 "[<Rn>]|Rn:4@16": "arg_mem_R", |
508 "[<Rn>,+/-<Rm>{, <shift>}]{!}|Rn:4@16|U@23|Rm:4@0|type:2@5|imm5:5@7|P@24
|W@21": "arg_mem_R_pm_R_shift_imm_W", | 478 "[<Rn>,+/-<Rm>{, <shift>}]{!}|Rn:4@16|U@23|Rm:4@0|type:2@5|imm5:5@7|P@24
|W@21": "arg_mem_R_pm_R_shift_imm_W", |
509 "[<Rn>{,#+/-<imm8>}]{!}|Rn:4@16|P@24|U@23|W@21|imm4H:4@8|imm4L:4@0":
"arg_mem_R_pm_imm8_W", | 479 "[<Rn>{,#+/-<imm8>}]{!}|Rn:4@16|P@24|U@23|W@21|imm4H:4@8|imm4L:4@0":
"arg_mem_R_pm_imm8_W", |
510 "[<Rn>] {,#+/-<imm8>}|Rn:4@16|U@23|imm4H:4@8|imm4L:4@0":
"arg_mem_R_pm_imm8_postindex", | 480 "[<Rn>] {,#+/-<imm8>}|Rn:4@16|U@23|imm4H:4@8|imm4L:4@0":
"arg_mem_R_pm_imm8_postindex", |
511 "[<Rn>{,#+/-<imm12>}]{!}|Rn:4@16|P@24|U@23|W@21|imm12:12@0":
"arg_mem_R_pm_imm12_W", | 481 "[<Rn>{,#+/-<imm12>}]{!}|Rn:4@16|P@24|U@23|W@21|imm12:12@0":
"arg_mem_R_pm_imm12_W", |
512 "[<Rn>],#+/-<imm12>|Rn:4@16|imm12:12@0|U@23":
"arg_mem_R_pm_imm12_postindex", | 482 "[<Rn>],#+/-<imm12>|Rn:4@16|imm12:12@0|U@23":
"arg_mem_R_pm_imm12_postindex", |
513 "[<Rn>,#+/-<imm12>]|Rn:4@16|U@23|imm12:12@0":
"arg_mem_R_pm_imm12_offset", | 483 "[<Rn>,#+/-<imm12>]|Rn:4@16|U@23|imm12:12@0":
"arg_mem_R_pm_imm12_offset", |
514 "[<Rn>] {,#+/-<imm12>}|Rn:4@16|U@23|imm12:12@0":
"arg_mem_R_pm_imm12_postindex", | 484 "[<Rn>] {,#+/-<imm12>}|Rn:4@16|U@23|imm12:12@0":
"arg_mem_R_pm_imm12_postindex", |
515 "[<Rn>], +/-<Rm>|Rn:4@16|U@23|Rm:4@0":
"arg_mem_R_pm_R_postindex", | 485 "[<Rn>], +/-<Rm>|Rn:4@16|U@23|Rm:4@0":
"arg_mem_R_pm_R_postindex", |
516 "[<Rn>,+/-<Rm>]{!}|Rn:4@16|U@23|Rm:4@0|P@24|W@21":
"arg_mem_R_pm_R_W", | 486 "[<Rn>,+/-<Rm>]{!}|Rn:4@16|U@23|Rm:4@0|P@24|W@21":
"arg_mem_R_pm_R_W", |
517 "[<Rn>],+/-<Rm>{, <shift>}|Rn:4@16|Rm:4@0|imm5:5@7|type:2@5|U@23":
"arg_mem_R_pm_R_shift_imm_postindex", | 487 "[<Rn>],+/-<Rm>{, <shift>}|Rn:4@16|Rm:4@0|imm5:5@7|type:2@5|U@23":
"arg_mem_R_pm_R_shift_imm_postindex", |
518 "[<Rn>,+/-<Rm>{, <shift>}]|Rn:4@16|U@23|Rm:4@0|type:2@5|imm5:5@7":
"arg_mem_R_pm_R_shift_imm_offset", | 488 "[<Rn>,+/-<Rm>{, <shift>}]|Rn:4@16|U@23|Rm:4@0|type:2@5|imm5:5@7":
"arg_mem_R_pm_R_shift_imm_offset", |
| 489 "[<Rn>{,#+/-<imm8>}]|Rn:4@16|U@23|imm8:8@0":
"arg_mem_R_pm_imm8at0_offset", |
519 | 490 |
520 // pc-relative constants | 491 // pc-relative constants |
521 "<label+12>|imm12:12@0": "arg_label_p_12", | 492 "<label+12>|imm12:12@0": "arg_label_p_12", |
522 "<label-12>|imm12:12@0": "arg_label_m_12", | 493 "<label-12>|imm12:12@0": "arg_label_m_12", |
523 "<label+/-12>|imm12:12@0|U@23": "arg_label_pm_12", | 494 "<label+/-12>|imm12:12@0|U@23": "arg_label_pm_12", |
524 "<label+/-4+4>|imm4H:4@8|imm4L:4@0|U@23": "arg_label_pm_4_4", | 495 "<label+/-4+4>|imm4H:4@8|imm4L:4@0|U@23": "arg_label_pm_4_4", |
525 | 496 |
526 // constants | 497 // constants |
527 "#<const>|imm12:12@0": "arg_const", | 498 "#<const>|imm12:12@0": "arg_const", |
528 "#<imm5>|imm5:5@7": "arg_imm5", | 499 "#<imm5>|imm5:5@7": "arg_imm5", |
(...skipping 12 matching lines...) Expand all Loading... |
541 "#<sat_imm4m1>|sat_imm:4@16": "arg_satimm4m1", | 512 "#<sat_imm4m1>|sat_imm:4@16": "arg_satimm4m1", |
542 "#<sat_imm5m1>|sat_imm:5@16": "arg_satimm5m1", | 513 "#<sat_imm5m1>|sat_imm:5@16": "arg_satimm5m1", |
543 "#<imm24>|imm24:24@0": "arg_imm24", | 514 "#<imm24>|imm24:24@0": "arg_imm24", |
544 | 515 |
545 // special | 516 // special |
546 "<registers>|register_list:16@0": "arg_registers", | 517 "<registers>|register_list:16@0": "arg_registers", |
547 "<registers2>|register_list:16@0": "arg_registers2", | 518 "<registers2>|register_list:16@0": "arg_registers2", |
548 "<registers1>|Rt:4@12": "arg_registers1", | 519 "<registers1>|Rt:4@12": "arg_registers1", |
549 "<endian_specifier>|E@9": "arg_endian", | 520 "<endian_specifier>|E@9": "arg_endian", |
550 | 521 |
551 » "SP": "arg_SP", | 522 » "SP": "arg_SP", |
552 » "APSR": "arg_APSR", | 523 » "APSR": "arg_APSR", |
| 524 » "FPSCR": "arg_FPSCR", |
| 525 |
| 526 » // VFP floating point registers |
| 527 » "<Sd>|Vd:4@12|D@22": "arg_Sd", |
| 528 » "<Sd,Dd>|Vd:4@12|D@22|sz@8": "arg_Sd_Dd", |
| 529 » "<Dd,Sd>|Vd:4@12|D@22|sz@8": "arg_Dd_Sd", |
| 530 » "<Sn>|Vn:4@16|N@7": "arg_Sn", |
| 531 » "<Sn,Dn>|Vn:4@16|N@7|sz@8": "arg_Sn_Dn", |
| 532 » "<Sm>|Vm:4@0|M@5": "arg_Sm", |
| 533 » "<Sm,Dm>|Vm:4@0|M@5|sz@8": "arg_Sm_Dm", |
| 534 » "#0.0": "arg_fp_0", |
| 535 » "#<imm_vfp>|imm4H:4@16|imm4L:4@0|sz@8": "arg_imm_vfp", |
| 536 » "#<fbits>|sx@7|imm4:4@0|i@5": "arg_fbits", |
| 537 » "<Dn[x]>|N@7|Vn:4@16|opc1@21": "arg_Dn_half", |
| 538 » "<Dd[x]>|D@7|Vd:4@16|opc1@21": "arg_Dn_half", |
553 } | 539 } |
554 | 540 |
555 // argSuffixes describes the encoding fields needed for a particular suffix. | 541 // argSuffixes describes the encoding fields needed for a particular suffix. |
556 // The set of keys in argSuffixes also drives the identification of suffix piece
s. | 542 // The set of keys in argSuffixes also drives the identification of suffix piece
s. |
557 // For example, <Rm> and <Rm>{, <type> <Rs>} are both keys in the map | 543 // For example, <Rm> and <Rm>{, <type> <Rs>} are both keys in the map |
558 // and matching is done 'longest first', so "<Rm>, <Rm>{, <type> <Rs>}" is | 544 // and matching is done 'longest first', so "<Rm>, <Rm>{, <type> <Rs>}" is |
559 // parsed as just two arguments despite the extra ", ". | 545 // parsed as just two arguments despite the extra ", ". |
560 // The field order in the map values must match the order expected in | 546 // The field order in the map values must match the order expected in |
561 // the argument descriptions in argOps. | 547 // the argument descriptions in argOps. |
562 var argSuffixes = map[string]string{ | 548 var argSuffixes = map[string]string{ |
563 "#0": "", | 549 "#0": "", |
564 "#0.0": "", | 550 "#0.0": "", |
565 "#<const>": "imm12:12", | 551 "#<const>": "imm12:12", |
566 » "#<fbits>": "", // XXX | 552 » "#<fbits>": "sx,imm4:4,i", |
567 "#<imm12+4>": "imm12:12,imm4:4", | 553 "#<imm12+4>": "imm12:12,imm4:4", |
568 "#<imm24>": "imm24:24", | 554 "#<imm24>": "imm24:24", |
569 "#<imm3>": "imm3:3", | 555 "#<imm3>": "imm3:3", |
570 "#<imm4>": "imm4:4", | 556 "#<imm4>": "imm4:4", |
571 "#<imm4+4>": "imm4H:4,imm4L:4", | |
572 "#<imm5>": "imm5:5", | 557 "#<imm5>": "imm5:5", |
573 "#<imm5_nz>": "imm5:5", | 558 "#<imm5_nz>": "imm5:5", |
574 "#<imm5_32>": "imm5:5", | 559 "#<imm5_32>": "imm5:5", |
575 "#<imm6>": "imm6:6", | 560 "#<imm6>": "imm6:6", |
576 "#<immsize>": "size:2", | 561 "#<immsize>": "size:2", |
| 562 "#<imm_vfp>": "imm4H:4,imm4L:4,sz", |
577 "#<sat_imm4>": "sat_imm:4", | 563 "#<sat_imm4>": "sat_imm:4", |
578 "#<sat_imm5>": "sat_imm:5", | 564 "#<sat_imm5>": "sat_imm:5", |
579 "#<sat_imm4m1>": "sat_imm:4", | 565 "#<sat_imm4m1>": "sat_imm:4", |
580 "#<sat_imm5m1>": "sat_imm:5", | 566 "#<sat_imm5m1>": "sat_imm:5", |
581 "#<lsb>": "lsb:5", | 567 "#<lsb>": "lsb:5", |
582 "#<option>": "option:4", | 568 "#<option>": "option:4", |
583 "#<width>": "lsb:5,msb:5", | 569 "#<width>": "lsb:5,msb:5", |
584 "#<widthm1>": "widthm1:5", | 570 "#<widthm1>": "widthm1:5", |
585 "+/-<Rm>": "Rm:4,U", | 571 "+/-<Rm>": "Rm:4,U", |
586 "<Dd>": "D,Vd:4", | 572 "<Dd>": "D,Vd:4", |
587 » "<Dd[x]>": "D,Vd:4,opc1:2,opc2:2", | 573 » "<Dd[x]>": "D,Vd:4,opc1", |
588 "<Dm>": "M,Vm:4", | 574 "<Dm>": "M,Vm:4", |
589 "<Dm[x]>": "M,Vm:4,size:2", | 575 "<Dm[x]>": "M,Vm:4,size:2", |
590 "<Dn>": "N,Vn:4", | 576 "<Dn>": "N,Vn:4", |
591 » "<Dn[x]>": "N,Vn:4,opc1:2,opc2:2", | 577 » "<Dn[x]>": "N,Vn:4,opc1", |
592 "<Dm[size_x]>": "imm4:4", | 578 "<Dm[size_x]>": "imm4:4", |
593 "<Qd>": "D,Vd:4", | 579 "<Qd>": "D,Vd:4", |
594 "<Qm>": "M,Vm:4", | 580 "<Qm>": "M,Vm:4", |
595 "<Qn>": "N,Vn:4", | 581 "<Qn>": "N,Vn:4", |
596 "<Ra>": "Ra:4", | 582 "<Ra>": "Ra:4", |
597 "<Rd>": "Rd:4", | 583 "<Rd>": "Rd:4", |
598 "<RdHi>": "RdHi:4", | 584 "<RdHi>": "RdHi:4", |
599 "<RdLo>": "RdLo:4", | 585 "<RdLo>": "RdLo:4", |
600 "<Rm>": "Rm:4", | 586 "<Rm>": "Rm:4", |
601 "<Rm>{,<rotation>}": "Rm:4,rotate:2", | 587 "<Rm>{,<rotation>}": "Rm:4,rotate:2", |
602 "<Rm>{,<shift>}": "Rm:4,imm5:5,type:2", | 588 "<Rm>{,<shift>}": "Rm:4,imm5:5,type:2", |
603 "<Rm>{,LSL #<imm5>}": "Rm:4,imm5:5", | 589 "<Rm>{,LSL #<imm5>}": "Rm:4,imm5:5", |
604 "<Rn>": "Rn:4", | 590 "<Rn>": "Rn:4", |
605 "<Rn>{!}": "Rn:4,W", | 591 "<Rn>{!}": "Rn:4,W", |
606 "<Rn>{,<shift>}": "Rn:4,imm5:5,sh", | 592 "<Rn>{,<shift>}": "Rn:4,imm5:5,sh", |
607 "<Rs>": "Rs:4", | 593 "<Rs>": "Rs:4", |
608 "<Rt1>": "Rt:4", | 594 "<Rt1>": "Rt:4", |
609 "<Rt2>": "Rt:4", | 595 "<Rt2>": "Rt:4", |
610 "<Rt>": "Rt:4", | 596 "<Rt>": "Rt:4", |
611 » "<Sd>": "D,Vd:4", | 597 » "<Rt_nzcv>": "Rt:4", |
| 598 » "<Sd>": "Vd:4,D", |
612 "<Sm1>": "Vm:4,M", | 599 "<Sm1>": "Vm:4,M", |
613 "<Sm>": "Vm:4,M", | 600 "<Sm>": "Vm:4,M", |
614 » "<Sn>": "N,Vn:4", | 601 » "<Sn>": "Vn:4,N", |
| 602 » "<Sd,Dd>": "Vd:4,D,sz", |
| 603 » "<Dd,Sd>": "Vd:4,D,sz", |
| 604 » "<Sn,Dn>": "Vn:4,N,sz", |
| 605 » "<Sm,Dm>": "Vm:4,M,sz", |
615 "<endian_specifier>": "E", | 606 "<endian_specifier>": "E", |
616 "<label+/-12>": "imm12:12,U", | 607 "<label+/-12>": "imm12:12,U", |
617 "<label+12>": "imm12:12", | 608 "<label+12>": "imm12:12", |
618 "<label-12>": "imm12:12", | 609 "<label-12>": "imm12:12", |
619 "<label24>": "imm24:24", | 610 "<label24>": "imm24:24", |
620 "<label24H>": "imm24:24,H", | 611 "<label24H>": "imm24:24,H", |
621 "<label+/-4+4>": "imm4H:4,imm4L:4,U", | 612 "<label+/-4+4>": "imm4H:4,imm4L:4,U", |
622 "<list4>": "D,Vd:4,type:4", | 613 "<list4>": "D,Vd:4,type:4", |
623 "<list3>": "D,Vd:4,index_align:4", | 614 "<list3>": "D,Vd:4,index_align:4", |
624 "<list3t>": "D,Vd:4,T", | 615 "<list3t>": "D,Vd:4,T", |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 if str == "" && !unknown[a] { | 747 if str == "" && !unknown[a] { |
757 fmt.Fprintf(os.Stderr, "%s: unknown arg %s\n", i
nst.Text, a) | 748 fmt.Fprintf(os.Stderr, "%s: unknown arg %s\n", i
nst.Text, a) |
758 unknown[a] = true | 749 unknown[a] = true |
759 } | 750 } |
760 fmt.Printf("%s", str) | 751 fmt.Printf("%s", str) |
761 } | 752 } |
762 fmt.Printf("}}, // %s %s\n", inst.Text, inst.Encoding) | 753 fmt.Printf("}}, // %s %s\n", inst.Text, inst.Encoding) |
763 } | 754 } |
764 fmt.Printf("}\n") | 755 fmt.Printf("}\n") |
765 } | 756 } |
LEFT | RIGHT |