diff options
author | 2023-10-10 14:33:42 +0000 | |
---|---|---|
committer | 2023-10-10 14:33:42 +0000 | |
commit | af1a266670d040d2f4083ff309d732d648afba2a (patch) | |
tree | 2fc46203448ddcc6f81546d379abfaeb323575e9 /capstone/contrib/sysz_update | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'capstone/contrib/sysz_update')
-rw-r--r-- | capstone/contrib/sysz_update/README.md | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/capstone/contrib/sysz_update/README.md b/capstone/contrib/sysz_update/README.md new file mode 100644 index 000000000..c50c7d18b --- /dev/null +++ b/capstone/contrib/sysz_update/README.md @@ -0,0 +1,58 @@ +# How to update SystemZ tables. + +* Checkout LLVM. Patches are tested on commit `c13d5969^`, because + `c13d5969` changed the decode table format. +* Apply patches from the current directory. +* Run tablegen. + ``` + cd $LLVM + mkdir build + cd build + cmake -DCMAKE_CXX_FLAGS=-DCAPSTONE .. + make SystemZCommonTableGen -j$(getconf _NPROCESSORS_ONLN) + ``` +* Copy `.inc` files. + ``` + cp arch/SystemZ/SystemZGenInsnNameMaps.inc \ + arch/SystemZ/SystemZGenInsnNameMaps.inc.old + for inc in $(cd arch/SystemZ && ls *.inc); do + cp $LLVM/build/lib/Target/SystemZ/$inc arch/SystemZ/ + done + ``` +* Fixup `SystemZGenInsnNameMaps.inc`. + ``` + comm -1 -3 \ + <(grep SYSZ_INS_ <arch/SystemZ/SystemZGenInsnNameMaps.inc.old \ + | sort -u) \ + <(grep SYSZ_INS_ <arch/SystemZ/SystemZGenInsnNameMaps.inc \ + | sort -u) \ + >arch/SystemZ/SystemZGenInsnNameMaps.inc.new + cat arch/SystemZ/SystemZGenInsnNameMaps.inc.old \ + arch/SystemZ/SystemZGenInsnNameMaps.inc.new \ + >arch/SystemZ/SystemZGenInsnNameMaps.inc + ``` +* Add new groups, insns, registers and formats. + * `include/capstone/systemz.h` + * `enum sysz_insn`: + ``` + comm -1 -3 \ + <(perl -ne 'if (/(SYSZ_INS_.+),/) { print "\t$1,\n" }' \ + <include/capstone/systemz.h | sort -u) \ + <(perl -ne 'if (/(SYSZ_INS_.+),/) { print "\t$1,\n" }' \ + <arch/SystemZ/SystemZMappingInsn.inc | sort -u) + ``` + * `enum sysz_insn_group`: + ``` + perl -ne 'if (/(SYSZ_GRP_.*?),/) { print "\t$1,\n"; }' < \ + arch/SystemZ/SystemZMappingInsn.inc | sort -u + ``` + * `arch/SystemZ/SystemZDisassembler.c` + * `arch/SystemZ/SystemZInstPrinter.c` + * `arch/SystemZ/SystemZMCTargetDesc.c` + * `arch/SystemZ/SystemZMCTargetDesc.h` + * `arch/SystemZ/SystemZMapping.c` + * `enum group_name_maps`: + ``` + perl -ne 'if (/(SYSZ_GRP_(.*?)),/) { print "\t{ $1, \"" . lc($2) . "\" },\n"; }' \ + arch/SystemZ/SystemZMappingInsn.inc | sort -u + ``` |