From e685cdb96e478470912f03c85e5c1ba7aa8bae45 Mon Sep 17 00:00:00 2001 From: midipix Date: Tue, 1 Nov 2016 22:35:43 -0400 Subject: build system: code generation: added the gen-opcodes build target. --- project/codegen.mk | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- project/common.mk | 7 ++++++ project/headers.mk | 7 ++++++ 3 files changed, 74 insertions(+), 2 deletions(-) (limited to 'project') diff --git a/project/codegen.mk b/project/codegen.mk index a7430af..ee8dfa8 100644 --- a/project/codegen.mk +++ b/project/codegen.mk @@ -6,16 +6,25 @@ clean-gen: rm -f $(GEN_IR_HEADERS) rm -f $(GEN_EMITTER_SRCS) rm -f $(GEN_EMITTER_HEADERS) + rm -f $(GEN_OPCODES_SRCS) + rm -f $(GEN_OPCODES_HEADERS) rm -f $(GEN_BE_DIR_ARM)/emitter.tag rm -f $(GEN_BE_DIR_AMD64)/emitter.tag rm -f $(GEN_BE_DIR_IA32)/emitter.tag rm -f $(GEN_BE_DIR_SPARC)/emitter.tag rm -f $(GEN_BE_DIR_TEMPLATE)/emitter.tag + rm -f $(GEN_BE_DIR_ARM)/opcodes.tag + rm -f $(GEN_BE_DIR_AMD64)/opcodes.tag + rm -f $(GEN_BE_DIR_IA32)/opcodes.tag + rm -f $(GEN_BE_DIR_SPARC)/opcodes.tag + rm -f $(GEN_BE_DIR_TEMPLATE)/opcodes.tag GEN_ALL = $(GEN_IR_SRCS) \ $(GEN_IR_HEADERS) \ $(GEN_EMITTER_SRCS) \ $(GEN_EMITTER_HEADERS) \ + $(GEN_OPCODES_SRCS) \ + $(GEN_OPCODES_HEADERS) \ # build/gen/ir/be @@ -100,12 +109,61 @@ $(GEN_BE_DIR_TEMPLATE)/gen_TEMPLATE_emitter.h: $(GEN_BE_DIR_TEMPLATE)/emitter.ta +# gen-opcodes +GEN_OPCODES_TOOL = $(SOURCE_DIR)/ir/be/scripts/generate_new_opcodes.pl + + +$(GEN_BE_DIR_ARM)/opcodes.tag: $(GEN_OPCODES_TOOL) $(GEN_SPEC_ARM) + $(GEN_OPCODES_TOOL) $(GEN_SPEC_ARM) $(GEN_BE_DIR_ARM) + touch $@ + + +$(GEN_BE_DIR_AMD64)/opcodes.tag: $(GEN_OPCODES_TOOL) $(GEN_SPEC_AMD64) + $(GEN_OPCODES_TOOL) $(GEN_SPEC_AMD64) $(GEN_BE_DIR_AMD64) + touch $@ + + +$(GEN_BE_DIR_IA32)/opcodes.tag: $(GEN_OPCODES_TOOL) $(GEN_SPEC_IA32) + $(GEN_OPCODES_TOOL) $(GEN_SPEC_IA32) $(GEN_BE_DIR_IA32) + touch $@ + + +$(GEN_BE_DIR_SPARC)/opcodes.tag: $(GEN_OPCODES_TOOL) $(GEN_SPEC_SPARC) + $(GEN_OPCODES_TOOL) $(GEN_SPEC_SPARC) $(GEN_BE_DIR_SPARC) + touch $@ + + +$(GEN_BE_DIR_TEMPLATE)/opcodes.tag: $(GEN_OPCODES_TOOL) $(GEN_SPEC_TEMPLATE) + $(GEN_OPCODES_TOOL) $(GEN_SPEC_TEMPLATE) $(GEN_BE_DIR_TEMPLATE) + touch $@ + + + +$(GEN_BE_DIR_ARM)/gen_arm_new_nodes.c: $(GEN_BE_DIR_ARM)/opcodes.tag +$(GEN_BE_DIR_ARM)/gen_arm_new_nodes.h: $(GEN_BE_DIR_ARM)/opcodes.tag + +$(GEN_BE_DIR_AMD64)/gen_amd64_new_nodes.c: $(GEN_BE_DIR_AMD64)/opcodes.tag +$(GEN_BE_DIR_AMD64)/gen_amd64_new_nodes.h: $(GEN_BE_DIR_AMD64)/opcodes.tag + +$(GEN_BE_DIR_IA32)/gen_ia32_new_nodes.c: $(GEN_BE_DIR_IA32)/opcodes.tag +$(GEN_BE_DIR_IA32)/gen_ia32_new_nodes.h: $(GEN_BE_DIR_IA32)/opcodes.tag + +$(GEN_BE_DIR_SPARC)/gen_sparc_new_nodes.c: $(GEN_BE_DIR_SPARC)/opcodes.tag +$(GEN_BE_DIR_SPARC)/gen_sparc_new_nodes.h: $(GEN_BE_DIR_SPARC)/opcodes.tag + +$(GEN_BE_DIR_TEMPLATE)/gen_TEMPLATE_new_nodes.c: $(GEN_BE_DIR_TEMPLATE)/opcodes.tag +$(GEN_BE_DIR_TEMPLATE)/gen_TEMPLATE_new_nodes.h: $(GEN_BE_DIR_TEMPLATE)/opcodes.tag + + + # gen-all gen-ir: $(GEN_IR_SRCS) $(GEN_IR_HEADERS) gen-emitter: $(GEN_EMITTER_SRCS) $(GEN_EMITTER_HEADERS) -gen-all: gen-ir gen-emitter +gen-opcodes: $(GEN_OPCODES_SRCS) $(GEN_OPCODES_HEADERS) + +gen-all: gen-ir gen-emitter gen-opcodes gen.tag: $(GEN_ALL) touch gen.tag @@ -115,4 +173,4 @@ gen: gen.tag .PHONY: clean-gen \ gen gen-all \ - gen-ir gen-emitter + gen-ir gen-emitter gen-opcodes diff --git a/project/common.mk b/project/common.mk index e360781..a964d23 100644 --- a/project/common.mk +++ b/project/common.mk @@ -8,3 +8,10 @@ GEN_EMITTER_SRCS = \ build/gen/ir/be/ia32/gen_ia32_emitter.c \ build/gen/ir/be/sparc/gen_sparc_emitter.c \ build/gen/ir/be/TEMPLATE/gen_TEMPLATE_emitter.c \ + +GEN_OPCODES_SRCS = \ + build/gen/ir/be/arm/gen_arm_new_nodes.c \ + build/gen/ir/be/amd64/gen_amd64_new_nodes.c \ + build/gen/ir/be/ia32/gen_ia32_new_nodes.c \ + build/gen/ir/be/sparc/gen_sparc_new_nodes.c \ + build/gen/ir/be/TEMPLATE/gen_TEMPLATE_new_nodes.c \ diff --git a/project/headers.mk b/project/headers.mk index 2921a68..8d770cb 100644 --- a/project/headers.mk +++ b/project/headers.mk @@ -9,3 +9,10 @@ GEN_EMITTER_HEADERS = \ build/gen/ir/be/ia32/gen_ia32_emitter.h \ build/gen/ir/be/sparc/gen_sparc_emitter.h \ build/gen/ir/be/TEMPLATE/gen_TEMPLATE_emitter.h \ + +GEN_OPCODES_HEADERS = \ + build/gen/ir/be/arm/gen_arm_new_nodes.h \ + build/gen/ir/be/amd64/gen_amd64_new_nodes.h \ + build/gen/ir/be/ia32/gen_ia32_new_nodes.h \ + build/gen/ir/be/sparc/gen_sparc_new_nodes.h \ + build/gen/ir/be/TEMPLATE/gen_TEMPLATE_new_nodes.h \ -- cgit v1.2.3