Improve performance for branchy code
[riscv-isa-sim.git] / riscv / riscv.mk.in
index 3c4480a250821aba8f80a7e7679b52fc18545cd8..45c5ee7acc73c5ae8732890a2caae9ce9bee200e 100644 (file)
@@ -1,5 +1,5 @@
-get_insn_list = $(shell cat $(1) | sed 's/DECLARE_INSN(\(.*\),.*,.*)/\1/')
-get_opcode = $(shell grep \\\<$(2)\\\> $(1) | sed 's/DECLARE_INSN(.*,\(.*\),.*)/\1/')
+get_insn_list = $(shell grep ^DECLARE_INSN $(1) | sed 's/DECLARE_INSN(\(.*\),.*,.*)/\1/')
+get_opcode = $(shell grep ^DECLARE_INSN.*\\\<$(2)\\\> $(1) | sed 's/DECLARE_INSN(.*,\(.*\),.*)/\1/')
 
 riscv_subproject_deps = \
        softfloat_riscv \
@@ -20,7 +20,7 @@ riscv_hdrs = \
        processor.h \
        sim.h \
        trap.h \
-       opcodes.h \
+       encoding.h \
        cachesim.h \
        memtracer.h \
        extension.h \
@@ -43,12 +43,16 @@ riscv_srcs = \
 riscv_test_srcs =
 
 riscv_gen_hdrs = \
+  icache.h \
 
 riscv_gen_srcs = \
-       $(addsuffix .cc, $(call get_insn_list,$(src_dir)/riscv/opcodes.h))
+       $(addsuffix .cc, $(call get_insn_list,$(src_dir)/riscv/encoding.h))
+
+icache.h:
+       $(src_dir)/riscv/gen_icache 1024 > $@
 
 $(riscv_gen_srcs): %.cc: insns/%.h insn_template.cc
-       sed 's/NAME/$(subst .cc,,$@)/' $(src_dir)/riscv/insn_template.cc | sed 's/OPCODE/$(call get_opcode,$(src_dir)/riscv/opcodes.h,$(subst .cc,,$@))/' > $@
+       sed 's/NAME/$(subst .cc,,$@)/' $(src_dir)/riscv/insn_template.cc | sed 's/OPCODE/$(call get_opcode,$(src_dir)/riscv/encoding.h,$(subst .cc,,$@))/' > $@
 
 riscv_junk = \
        $(riscv_gen_srcs) \