arm64/instgen: add arm64 ISA XML processing

This CL proceeds with processing the unmarshalled XML file and process them
into data that can be used for code generation to the assembler.

The processing is to understand the <asmtemplate> field in the XML data and
populate the Inst structure with more comprehensive unexported fields marked
under comment:

```
// The fields below are the parsed results of the XML files.
```

You can find those fields in inst.go, they are all unexported.

And example parsed data looks like this:
(for instruction ADD predicated
https://developer.arm.com/documentation/111108/2025-12/SVE-Instructions/ADD--vectors--predicated---Add--predicated--?lang=en)
- parsed data in RegDiagram
--- Parsed Data ---
  fixedBin: 0x4000000
  mask: 0xff3fe000
  varBin:
    size: [22, 24]
    Pg: [10, 13]
    Zm: [5, 10]
    Zdn: [0, 5]
  parsed: true
--- Parsed Data ---

- parsed data in Encoding
--- Parsed Data ---
  binary: 0x4000000
  mask: 0xff3fe000
  asm: ADD  <Zdn>.<T>, <Pg>/M, <Zdn>.<T>, <Zm>.<T>
  goOp: AZADD
  arm64Op: A64ADD
  class: C_SVE
  invalid: false
  alias: false
  prefix: AZ
  operands:
    operand{
      name: ADD
      typ:
      elems:
    }
    operand{
      name: <Zm>.<T>
      typ: AC_ARNG
      elems:
        element{
          encodedIn: Zm
          textExp: Is the name of the second source scalable vector register, encoded in the "Zm" field.
          symbol: <Zm>
        }
        element{
          encodedIn: size
          textExp: size   <T>
          00      B
          01      H
          10      S
          11      D
          symbol: <T>
        }
    }
    operand{
      name: <Zdn>.<T>
      typ: AC_ARNG
      elems:
        element{
          encodedIn: Zdn
          textExp: Is the name of the first source and destination scalable vector register, encoded in the "Zdn" field.
          symbol: <Zdn>
        }
        element{
          encodedIn: size
          textExp: size   <T>
          00      B
          01      H
          10      S
          11      D
          symbol: <T>
        }
    }
    operand{
      name: <Pg>/M
      typ: AC_PREGM
      elems:
        element{
          encodedIn: Pg
          textExp: Is the name of the governing scalable predicate register P0-P7, encoded in the "Pg" field.
          symbol: <Pg>
        }
    }
    operand{
      name: <Zdn>.<T>
      typ: AC_ARNG
      elems:
        element{
          encodedIn: Zdn
          textExp: Is the name of the first source and destination scalable vector register, encoded in the "Zdn" field.
          symbol: <Zdn>
        }
        element{
          encodedIn: size
          textExp: size   <T>
          00      B
          01      H
          10      S
          11      D
          symbol: <T>
        }
    }
  parsed: true
--- Parsed Data ---

There are currently 38 unresolved instructions in
2290 instructions, they are all operands with optional <pattern>.
For example
https://developer.arm.com/documentation/111108/2025-12/SVE-Instructions/UQDECB--Unsigned-saturating-decrement-scalar-by-multiple-of-8-bit-predicate-constraint-element-count-?lang=en.
Should we split them into multiple different instructions?

This CL also adds a nice printer to print out the processed data.

Change-Id: Idb71499388a820108995c30ed43cc1a3f635d1e1
Reviewed-on: https://go-review.googlesource.com/c/arch/+/742461
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
5 files changed
tree: 6c7a31f16b00e45189d95183256e3d4a6a464b37
  1. arm/
  2. arm64/
  3. loong64/
  4. ppc64/
  5. riscv64/
  6. s390x/
  7. x86/
  8. codereview.cfg
  9. CONTRIBUTING.md
  10. go.mod
  11. go.sum
  12. LICENSE
  13. PATENTS
  14. README.md
README.md

arch

Go Reference

This repository holds machine architecture information used by the Go toolchain. The parts needed in the main Go repository are copied in.

Report Issues / Send Patches

This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://go.dev/doc/contribute.

The git repository is https://go.googlesource.com/arch.

The main issue tracker for the arch repository is located at https://go.dev/issues. Prefix your issue with “x/arch:” in the subject line, so it is easy to find.