• Home
Name Date Size #Lines LOC

..--

0001-capstone-generate-GenRegisterInfo.inc.patchD03-May-202410.2 KiB339291

0002-capstone-generate-GenSubtargetInfo.inc.patchD03-May-20242.3 KiB8772

0003-capstone-generate-GenInstrInfo.inc.patchD03-May-20243.7 KiB131112

0004-capstone-generate-GenDisassemblerTables.inc.patchD03-May-202417.3 KiB473455

0005-capstone-generate-GenAsmWriter.inc.patchD03-May-20247.3 KiB226205

0006-capstone-generate-MappingInsn.inc.patchD03-May-20246.2 KiB175170

0007-capstone-generate-GenInsnNameMaps.inc.patchD03-May-20244.1 KiB111106

README.mdD03-May-20242.1 KiB5957

README.md

1# How to update SystemZ tables.
2
3* Checkout LLVM. Patches are tested on commit `c13d5969^`, because
4  `c13d5969` changed the decode table format.
5* Apply patches from the current directory.
6* Run tablegen.
7  ```
8      cd $LLVM
9      mkdir build
10      cd build
11      cmake -DCMAKE_CXX_FLAGS=-DCAPSTONE ..
12      make SystemZCommonTableGen -j$(getconf _NPROCESSORS_ONLN)
13   ```
14* Copy `.inc` files.
15  ```
16      cp arch/SystemZ/SystemZGenInsnNameMaps.inc \
17         arch/SystemZ/SystemZGenInsnNameMaps.inc.old
18      for inc in $(cd arch/SystemZ && ls *.inc); do
19        cp $LLVM/build/lib/Target/SystemZ/$inc arch/SystemZ/
20      done
21  ```
22* Fixup `SystemZGenInsnNameMaps.inc`.
23  ```
24      comm -1 -3 \
25          <(grep SYSZ_INS_ <arch/SystemZ/SystemZGenInsnNameMaps.inc.old \
26            | sort -u) \
27          <(grep SYSZ_INS_ <arch/SystemZ/SystemZGenInsnNameMaps.inc \
28            | sort -u) \
29          >arch/SystemZ/SystemZGenInsnNameMaps.inc.new
30      cat arch/SystemZ/SystemZGenInsnNameMaps.inc.old \
31          arch/SystemZ/SystemZGenInsnNameMaps.inc.new \
32          >arch/SystemZ/SystemZGenInsnNameMaps.inc
33  ```
34* Add new groups, insns, registers and formats.
35  * `include/capstone/systemz.h`
36    * `enum sysz_insn`:
37      ```
38          comm -1 -3 \
39              <(perl -ne 'if (/(SYSZ_INS_.+),/) { print "\t$1,\n" }' \
40                <include/capstone/systemz.h | sort -u) \
41              <(perl -ne 'if (/(SYSZ_INS_.+),/) { print "\t$1,\n" }' \
42                <arch/SystemZ/SystemZMappingInsn.inc | sort -u)
43      ```
44    * `enum sysz_insn_group`:
45      ```
46          perl -ne 'if (/(SYSZ_GRP_.*?),/) { print "\t$1,\n"; }' < \
47              arch/SystemZ/SystemZMappingInsn.inc | sort -u
48      ```
49  * `arch/SystemZ/SystemZDisassembler.c`
50  * `arch/SystemZ/SystemZInstPrinter.c`
51  * `arch/SystemZ/SystemZMCTargetDesc.c`
52  * `arch/SystemZ/SystemZMCTargetDesc.h`
53  * `arch/SystemZ/SystemZMapping.c`
54    * `enum group_name_maps`:
55      ```
56          perl -ne 'if (/(SYSZ_GRP_(.*?)),/) { print "\t{ $1, \"" . lc($2) . "\" },\n"; }' \
57              arch/SystemZ/SystemZMappingInsn.inc | sort -u
58      ```
59