From 43615c60e7d493d7a9656268dab552eb2246f99f Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Mon, 7 Jul 2014 15:17:16 -0700 Subject: [PATCH] Use precompiled headers to speed up compilation --- .gitignore | 1 + Makefile.in | 8 ++++++-- hwacha/decode_hwacha.h | 1 + hwacha/hwacha.mk.in | 6 ++++++ hwacha/insn_template_hwacha.cc | 10 +--------- hwacha/insn_template_hwacha.h | 5 +++++ hwacha/insn_template_hwacha_ut.cc | 11 +---------- hwacha/insn_template_hwacha_ut.h | 6 ++++++ riscv/insn_template.cc | 8 +------- riscv/insn_template.h | 5 +++++ riscv/riscv.mk.in | 4 ++++ 11 files changed, 37 insertions(+), 28 deletions(-) create mode 100644 hwacha/insn_template_hwacha.h create mode 100644 hwacha/insn_template_hwacha_ut.h create mode 100644 riscv/insn_template.h diff --git a/.gitignore b/.gitignore index 031e691..7503c9a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ build/ +*.gch autom4te.cache/ .*.swp diff --git a/Makefile.in b/Makefile.in index 1f3074d..45d22a4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -184,16 +184,20 @@ _$(1).cc : # Build the object files for this subproject +$(2)_pch := $$(patsubst %.h, %.h.gch, $$($(2)_precompiled_hdrs)) $(2)_objs := $$(patsubst %.cc, %.o, $$($(2)_srcs)) $(2)_c_objs := $$(patsubst %.c, %.o, $$($(2)_c_srcs)) $(2)_deps := $$(patsubst %.o, %.d, $$($(2)_objs)) $(2)_c_deps := $$(patsubst %.o, %.d, $$($(2)_c_objs)) -$$($(2)_objs) : %.o : %.cc $$($(2)_gen_hdrs) +$$($(2)_pch) : %.h.gch : %.h + $(COMPILE) $$< +$$($(2)_objs) : %.o : %.cc $$($(2)_gen_hdrs) $$($(2)_pch) $(COMPILE) -c $$< $$($(2)_c_objs) : %.o : %.c $$($(2)_gen_hdrs) $(COMPILE_C) -c $$< -$(2)_junk += $$($(2)_objs) $$($(2)_c_objs) $$($(2)_deps) $$($(2)_c_deps) $$($(2)_gen_hdrs) +$(2)_junk += $$(addprefix $(src_dir)/$(1)/, $$($(2)_pch)) \ + $$($(2)_objs) $$($(2)_c_objs) $$($(2)_deps) $$($(2)_c_deps) $$($(2)_gen_hdrs) # Reverse the dependency list so that a given subproject only depends on # subprojects listed to its right. This is the correct order for linking diff --git a/hwacha/decode_hwacha.h b/hwacha/decode_hwacha.h index 74e1326..7a6c8ee 100644 --- a/hwacha/decode_hwacha.h +++ b/hwacha/decode_hwacha.h @@ -3,6 +3,7 @@ #include "hwacha.h" #include "hwacha_xcpt.h" +#include "mmu.h" #define XS1 (xs1) #define XS2 (xs2) diff --git a/hwacha/hwacha.mk.in b/hwacha/hwacha.mk.in index 1be2774..b4f375e 100644 --- a/hwacha/hwacha.mk.in +++ b/hwacha/hwacha.mk.in @@ -11,6 +11,12 @@ hwacha_hdrs = \ decode_hwacha_ut.h \ opcodes_hwacha.h \ opcodes_hwacha_ut.h \ + insn_template_hwacha.h \ + insn_template_hwacha_ut.h \ + +hwacha_precompiled_hdrs = \ + insn_template_hwacha.h \ + insn_template_hwacha_ut.h \ hwacha_srcs = \ hwacha.cc \ diff --git a/hwacha/insn_template_hwacha.cc b/hwacha/insn_template_hwacha.cc index e6f94d4..cb44cac 100644 --- a/hwacha/insn_template_hwacha.cc +++ b/hwacha/insn_template_hwacha.cc @@ -1,13 +1,5 @@ // See LICENSE for license details. - -#include "config.h" -#include "processor.h" -#include "mmu.h" -#include "hwacha.h" -#include "decode_hwacha.h" -#include "encodings_hwacha.h" -#include "rocc.h" -#include +#include "insn_template_hwacha.h" reg_t hwacha_NAME(processor_t* p, insn_t insn, reg_t pc) { diff --git a/hwacha/insn_template_hwacha.h b/hwacha/insn_template_hwacha.h new file mode 100644 index 0000000..b4704da --- /dev/null +++ b/hwacha/insn_template_hwacha.h @@ -0,0 +1,5 @@ +#include "hwacha.h" +#include "decode_hwacha.h" +#include "encodings_hwacha.h" +#include "rocc.h" +#include diff --git a/hwacha/insn_template_hwacha_ut.cc b/hwacha/insn_template_hwacha_ut.cc index 79e7c2f..d312e93 100644 --- a/hwacha/insn_template_hwacha_ut.cc +++ b/hwacha/insn_template_hwacha_ut.cc @@ -1,14 +1,5 @@ // See LICENSE for license details. - -#include "config.h" -#include "processor.h" -#include "mmu.h" -#include "softfloat.h" -#include "platform.h" // softfloat isNaNF32UI, etc. -#include "internals.h" // ditto -#include "hwacha.h" -#include "decode_hwacha_ut.h" -#include +#include "insn_template_hwacha_ut.h" reg_t hwacha_NAME(processor_t* p, insn_t insn, reg_t pc) { diff --git a/hwacha/insn_template_hwacha_ut.h b/hwacha/insn_template_hwacha_ut.h new file mode 100644 index 0000000..a26e528 --- /dev/null +++ b/hwacha/insn_template_hwacha_ut.h @@ -0,0 +1,6 @@ +#include "hwacha.h" +#include "decode_hwacha_ut.h" +#include "softfloat.h" +#include "platform.h" // softfloat isNaNF32UI, etc. +#include "internals.h" // ditto +#include diff --git a/riscv/insn_template.cc b/riscv/insn_template.cc index a901077..d2c0fce 100644 --- a/riscv/insn_template.cc +++ b/riscv/insn_template.cc @@ -1,12 +1,6 @@ // See LICENSE for license details. -#include "processor.h" -#include "config.h" -#include "mmu.h" -#include "softfloat.h" -#include "platform.h" // softfloat isNaNF32UI, etc. -#include "internals.h" // ditto -#include +#include "insn_template.h" reg_t rv32_NAME(processor_t* p, insn_t insn, reg_t pc) { diff --git a/riscv/insn_template.h b/riscv/insn_template.h new file mode 100644 index 0000000..109b4c4 --- /dev/null +++ b/riscv/insn_template.h @@ -0,0 +1,5 @@ +#include "mmu.h" +#include "softfloat.h" +#include "platform.h" // softfloat isNaNF32UI, etc. +#include "internals.h" // ditto +#include diff --git a/riscv/riscv.mk.in b/riscv/riscv.mk.in index 84723bd..0fd5eaf 100644 --- a/riscv/riscv.mk.in +++ b/riscv/riscv.mk.in @@ -20,6 +20,10 @@ riscv_hdrs = \ extension.h \ rocc.h \ dummy-rocc.h \ + insn_template.h \ + +riscv_precompiled_hdrs = \ + insn_template.h \ riscv_srcs = \ htif.cc \ -- 2.30.2