mirror of
https://github.com/SimoneN64/Kaizen.git
synced 2025-04-02 10:41:53 -04:00
.. | ||
0001-capstone-riscv-patchs.patch | ||
0002-update-TableGen-for-generate-RISCV-port-inc-for-CAPS.patch | ||
0003-clear-old-patchs.patch | ||
0004-fix-riscv-registerclass-array-of-genregisterinfo.patch | ||
0005-fix-riscv-registerclass-array-of-genregisterinfo.patch | ||
0006-fix-output-TAB-for-riscv-capstone.patch | ||
0007-fix-riscv-alias-inst-output-useless-newline.patch | ||
0008-fix-riscv-inst-output-more-formal.patch | ||
0009-fix-riscv-asmwriter-variable-declaration-place.patch | ||
0010-fix-riscvgenasmwiter.inc-memory-leak.patch | ||
0011-using-static-array-contain-temp-string-for-riscv-asm.patch | ||
README.md |
How to update RISCV tables.
- Checkout LLVM. Patches are tested on commit
b81d715c
.git clone https://github.com/llvm/llvm-project.git git checkout b81d715c
- Apply patches from the current directory.
- Run tablegen.
cd $LLVM mkdir build cd build cmake -DCMAKE_CXX_FLAGS=-DCAPSTONE -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="RISCV" .. make RISCVCommonTableGen
- Copy
.inc
files.cp arch/RISCV/RISCVGenInsnNameMaps.inc \ arch/RISCV/RISCVGenInsnNameMaps.inc.old for inc in $(cd arch/RISCV && ls *.inc); do cp $LLVM/build/lib/Target/RISCV/$inc arch/RISCV/ done
- Fixup
RISCVGenInsnNameMaps.inc
.comm -1 -3 \ <(grep RISCV_INS_ <arch/RISCV/RISCVGenInsnNameMaps.inc.old \ | sort -u) \ <(grep RISCV_INS_ <arch/RISCV/RISCVGenInsnNameMaps.inc \ | sort -u) \ >arch/RISCV/RISCVGenInsnNameMaps.inc.new cat arch/RISCV/RISCVGenInsnNameMaps.inc.old \ arch/RISCV/RISCVGenInsnNameMaps.inc.new \ >arch/RISCV/RISCVGenInsnNameMaps.inc
- Add new groups, insns, registers and formats.
include/capstone/RISCV.h
enum RISCV_insn
:comm -1 -3 \ <(perl -ne 'if (/(RISCV_INS_.+),/) { print "\t$1,\n" }' \ <include/capstone/RISCV.h | sort -u) \ <(perl -ne 'if (/(RISCV_INS_.+),/) { print "\t$1,\n" }' \ <arch/RISCV/RISCVMappingInsn.inc | sort -u)
enum RISCV_insn_group
:perl -ne 'if (/(\{.RISCV_GRP_.*?\}),/) { print "\t$1,\n"; }' < \ arch/RISCV/RISCVMappingInsn.inc | sort -u
arch/RISCV/RISCVDisassembler.c
arch/RISCV/RISCVInstPrinter.c
arch/RISCV/RISCVMCTargetDesc.c
arch/RISCV/RISCVMCTargetDesc.h
arch/RISCV/RISCVMapping.c
enum group_name_maps
:perl -ne 'if (/(RISCV_GRP_(.*?)),/) { print "\t{ $1, \"" . lc($2) . "\" },\n"; }' \ arch/RISCV/RISCVMappingInsn.inc | sort -u