From 64fa7696d2437766d8e2f4de2cf78e2a228d856e Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Mon, 7 Oct 2019 15:03:08 +0200 Subject: Speed up compilation of disasm.cc, especially in clang --- riscv/common.h | 2 ++ riscv/disasm.h | 4 ++-- spike_main/disasm.cc | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/riscv/common.h b/riscv/common.h index 8ddd984..3c523d0 100644 --- a/riscv/common.h +++ b/riscv/common.h @@ -6,4 +6,6 @@ #define likely(x) __builtin_expect(x, 1) #define unlikely(x) __builtin_expect(x, 0) +#define NOINLINE __attribute__ ((noinline)) + #endif diff --git a/riscv/disasm.h b/riscv/disasm.h index e465fca..88d0e9b 100644 --- a/riscv/disasm.h +++ b/riscv/disasm.h @@ -30,8 +30,8 @@ struct : public arg_t { class disasm_insn_t { public: - disasm_insn_t(const char* name, uint32_t match, uint32_t mask, - const std::vector& args) + NOINLINE disasm_insn_t(const char* name, uint32_t match, uint32_t mask, + const std::vector& args) : match(match), mask(mask), args(args), name(strdup(name)) {} ~disasm_insn_t() { free(const_cast(name)); } diff --git a/spike_main/disasm.cc b/spike_main/disasm.cc index 6c16ecb..0e36a4b 100644 --- a/spike_main/disasm.cc +++ b/spike_main/disasm.cc @@ -1149,7 +1149,7 @@ const disasm_insn_t* disassembler_t::lookup(insn_t insn) const return NULL; } -void disassembler_t::add_insn(disasm_insn_t* insn) +void NOINLINE disassembler_t::add_insn(disasm_insn_t* insn) { size_t idx = HASH_SIZE; if (insn->get_mask() % HASH_SIZE == HASH_SIZE - 1) -- cgit v1.1