| 1 | #!/bin/sh |
| 2 | # Generate raw X86*.inc files for Capstone, by Nguyen Anh Quynh |
| 3 | |
| 4 | # Syntax: gen-tablegen-full.sh <path-to-llvm-tblgen> <path-to-X86-td-files> |
| 5 | |
| 6 | # Example: ./gen-tablegen-full.sh ~/projects/llvm/7.0.1/build/bin X86 |
| 7 | |
| 8 | #TBLGEN_PATH=~/projects/llvm/7.0.1/build/bin |
| 9 | TBLGEN_PATH=$1 |
| 10 | #DIR_TD="X86" |
| 11 | DIR_TD=$2 |
| 12 | |
| 13 | echo "Using llvm-tblgen from ${TBLGEN_PATH}" |
| 14 | |
| 15 | echo "Generating X86GenInstrInfo.inc" |
| 16 | $TBLGEN_PATH/llvm-tblgen -gen-instr-info -I include -I ${DIR_TD} ${DIR_TD}/X86.td -o X86GenInstrInfo.inc |
| 17 | |
| 18 | echo "Generating X86GenRegisterInfo.inc" |
| 19 | $TBLGEN_PATH/llvm-tblgen -gen-register-info -I include -I ${DIR_TD} ${DIR_TD}/X86.td -o X86GenRegisterInfo.inc |
| 20 | |
| 21 | echo "Generating X86GenAsmMatcher.inc" |
| 22 | $TBLGEN_PATH/llvm-tblgen -gen-asm-matcher -I include -I ${DIR_TD} ${DIR_TD}/X86.td -o X86GenAsmMatcher.inc |
| 23 | |
| 24 | echo "Generating X86GenDisassemblerTables.inc" |
| 25 | $TBLGEN_PATH/llvm-tblgen -gen-disassembler -I include -I ${DIR_TD} ${DIR_TD}/X86.td -o X86GenDisassemblerTables.inc |
| 26 | |
| 27 | echo "Generating X86GenAsmWriter1.inc" |
| 28 | $TBLGEN_PATH/llvm-tblgen -gen-asm-writer -asmwriternum=1 -I include -I ${DIR_TD} ${DIR_TD}/X86.td -o X86GenAsmWriter1.inc |
| 29 | |
| 30 | echo "Generating X86GenAsmWriter.inc" |
| 31 | $TBLGEN_PATH/llvm-tblgen -gen-asm-writer -I include -I ${DIR_TD} ${DIR_TD}/X86.td -o X86GenAsmWriter.inc |
| 32 |