summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2014-12-24 00:20:48 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2014-12-24 00:20:48 (GMT)
commit9cab778bfaaca2589a383445e8569d99d73374d5 (patch)
tree29371502a4a816a2c0a42a55dfdcd8b7fde4ffa2 /src/arch
parent04dfbc68e7cd5036017f097a67ba5f0288ddace0 (diff)
Improved the generation of source code: there are now templates and one file per instruction.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@443 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/arm/v7/opcodes/Makefile.am119
-rw-r--r--src/arch/arm/v7/opdefs/Makefile.am43
2 files changed, 17 insertions, 145 deletions
diff --git a/src/arch/arm/v7/opcodes/Makefile.am b/src/arch/arm/v7/opcodes/Makefile.am
index 0bff196..fd67ff3 100644
--- a/src/arch/arm/v7/opcodes/Makefile.am
+++ b/src/arch/arm/v7/opcodes/Makefile.am
@@ -1,122 +1,9 @@
+include gencode.mk
+
noinst_LTLIBRARIES = libarcharmv7opcodes.la
-# ls *c | grep -v thumb | sort | sed 's/^/\t/' | sed 's/$/\t\t\\/'
-libarcharmv7opcodes_la_SOURCES = \
- arm_adc.c \
- arm_add.c \
- arm_and.c \
- arm_b.c \
- arm_bic.c \
- arm_bl.c \
- arm_bx.c \
- arm_cbnz.c \
- arm_cmn.c \
- arm_cmp.c \
- arm_eor.c \
- arm_ldr.c \
- arm_ldrb.c \
- arm_lsl.c \
- arm_mla.c \
- arm_mls.c \
- arm_mov.c \
- arm_mul.c \
- arm_mvn.c \
- arm_nop.c \
- arm_orr.c \
- arm_pop.c \
- arm_push.c \
- arm_rsb.c \
- arm_rsc.c \
- arm_sbc.c \
- arm_smlal.c \
- arm_smull.c \
- arm_str.c \
- arm_strb.c \
- arm_sub.c \
- arm_subs.c \
- arm_teq.c \
- arm_tst.c \
- arm_umaal.c \
- arm_umlal.c \
- arm_umull.c \
- arm_yield.c \
- thumb_16_adc.c \
- thumb_16_add.c \
- thumb_16_and.c \
- thumb_16_b.c \
- thumb_16_bic.c \
- thumb_16_bl.c \
- thumb_16_bx.c \
- thumb_16_cbnz.c \
- thumb_16_cmn.c \
- thumb_16_cmp.c \
- thumb_16_eor.c \
- thumb_16_ldr.c \
- thumb_16_ldrb.c \
- thumb_16_lsl.c \
- thumb_16_mla.c \
- thumb_16_mls.c \
- thumb_16_mov.c \
- thumb_16_mul.c \
- thumb_16_mvn.c \
- thumb_16_nop.c \
- thumb_16_orr.c \
- thumb_16_pop.c \
- thumb_16_push.c \
- thumb_16_rsb.c \
- thumb_16_rsc.c \
- thumb_16_sbc.c \
- thumb_16_smlal.c \
- thumb_16_smull.c \
- thumb_16_str.c \
- thumb_16_strb.c \
- thumb_16_sub.c \
- thumb_16_subs.c \
- thumb_16_teq.c \
- thumb_16_tst.c \
- thumb_16_umaal.c \
- thumb_16_umlal.c \
- thumb_16_umull.c \
- thumb_16_yield.c \
- thumb_32_adc.c \
- thumb_32_add.c \
- thumb_32_and.c \
- thumb_32_b.c \
- thumb_32_bic.c \
- thumb_32_bl.c \
- thumb_32_bx.c \
- thumb_32_cbnz.c \
- thumb_32_cmn.c \
- thumb_32_cmp.c \
- thumb_32_eor.c \
- thumb_32_ldr.c \
- thumb_32_ldrb.c \
- thumb_32_lsl.c \
- thumb_32_mla.c \
- thumb_32_mls.c \
- thumb_32_mov.c \
- thumb_32_mul.c \
- thumb_32_mvn.c \
- thumb_32_nop.c \
- thumb_32_orr.c \
- thumb_32_pop.c \
- thumb_32_push.c \
- thumb_32_rsb.c \
- thumb_32_rsc.c \
- thumb_32_sbc.c \
- thumb_32_smlal.c \
- thumb_32_smull.c \
- thumb_32_str.c \
- thumb_32_strb.c \
- thumb_32_sub.c \
- thumb_32_subs.c \
- thumb_32_teq.c \
- thumb_32_tst.c \
- thumb_32_umaal.c \
- thumb_32_umlal.c \
- thumb_32_umull.c \
- thumb_32_yield.c
+libarcharmv7opcodes_la_SOURCES = $(GENERATED_FILES)
libarcharmv7opcodes_la_LIBADD =
diff --git a/src/arch/arm/v7/opdefs/Makefile.am b/src/arch/arm/v7/opdefs/Makefile.am
index 4330d36..2687a92 100644
--- a/src/arch/arm/v7/opdefs/Makefile.am
+++ b/src/arch/arm/v7/opdefs/Makefile.am
@@ -3,6 +3,7 @@ include ../../../../../tools/d2c/d2c.mk
D2C_BIN = ../../../../../tools/d2c/d2c
+GEN_BIN = ../../../../../tools/d2c/d2c_genmakefile.sh
D2C_OUTDIR = $(PWD)/..
@@ -83,40 +84,24 @@ ARMV7_DEFS = \
subs_B9320.d
-all: $(ARMV7_DEFS:.d=.g) untabify_disass fix_includes_in_c finish_disass
+all: $(ARMV7_DEFS:.d=.g) generate_final_makefile fix_includes_in_c_templates fix_includes_in_h_templates untabify_disass
-fix_includes_in_c:
- @for f in `find ../opcodes -name '*c'`; do \
+generate_final_makefile:
+ $(GEN_BIN) ../opcodes/ ../opdefs/.gen ../../../../../tools/d2c/globalgen.mk arm thumb_32 thumb_16
+
+fix_includes_in_c_templates:
+ @for f in `find .gen/ -name '*tmpl.c'`; do \
if grep -q '##INCLUDES##' $$f; then \
$(fix_verbose)sed -i 's/##INCLUDES##/\n#include "..\/instruction.h"\n#include "..\/..\/instruction.h"\n#include "..\/helpers.h"\n#include "..\/..\/..\/..\/common\/bconst.h"\n\n/' $$f; \
fi; \
done
-finish_disass: finish_disass_t16 finish_disass_t32 finish_disass_arm
-
-finish_disass_t16: $(D2C_OUTDIR)/opcodes/thumb_16_opcodes.h
- @if grep -q '##INCLUDES##' $<; then \
- $(fix2_verbose)sed -i 's/##INCLUDES##/#include\ <stdint.h>\n\n#include "..\/..\/..\/instruction.h"/' $< ; \
- fi
- @if ! grep -q 'endif' $<; then \
- $(fix2_verbose)echo -en "\n\n#endif /* _ARCH_ARM_V7_OPCODES_OPCODES_H */\n" >> $< ; \
- fi
-
-finish_disass_t32: $(D2C_OUTDIR)/opcodes/thumb_32_opcodes.h
- @if grep -q '##INCLUDES##' $<; then \
- $(fix2_verbose)sed -i 's/##INCLUDES##/#include\ <stdint.h>\n\n#include "..\/..\/..\/instruction.h"/' $< ; \
- fi
- @if ! grep -q 'endif' $<; then \
- $(fix2_verbose)echo -en "\n\n#endif /* _ARCH_ARM_V7_OPCODES_OPCODES_H */\n" >> $< ; \
- fi
-
-finish_disass_arm: $(D2C_OUTDIR)/opcodes/arm_opcodes.h
- @if grep -q '##INCLUDES##' $<; then \
- $(fix2_verbose)sed -i 's/##INCLUDES##/#include\ <stdint.h>\n\n#include "..\/..\/..\/instruction.h"/' $< ; \
- fi
- @if ! grep -q 'endif' $<; then \
- $(fix2_verbose)echo -en "\n\n#endif /* _ARCH_ARM_V7_OPCODES_OPCODES_H */\n" >> $< ; \
- fi
+fix_includes_in_h_templates:
+ @for f in `find .gen/ -name '*tmpl.h'`; do \
+ if grep -q '##INCLUDES##' $$f; then \
+ $(fix_verbose)sed -i 's/##INCLUDES##/#include\ <stdint.h>\n\n#include "..\/..\/..\/instruction.h"/' $$f ; \
+ fi; \
+ done
clean:
- rm -f $(ARMV7_DEFS:.d=.g) $(D2C_OUTDIR)/opcodes/*c $(D2C_OUTDIR)/opcodes/{thumb_16_,thumb_32_,}opcodes.h
+ rm -rf $(ARMV7_DEFS:.d=.g) .gen