aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRupert Swarbrick <rswarbrick@gmail.com>2022-03-03 20:06:57 +0000
committerGitHub <noreply@github.com>2022-03-03 12:06:57 -0800
commit56054a2d97cae1f251d00d1468ba82e3b07955f1 (patch)
tree435772e862ad79d5c6a82ad19111cd3995dfcf53
parent5dd71bce9c7b200e21f92ba95f4b889b21ae5d46 (diff)
downloadspike-56054a2d97cae1f251d00d1468ba82e3b07955f1.zip
spike-56054a2d97cae1f251d00d1468ba82e3b07955f1.tar.gz
spike-56054a2d97cae1f251d00d1468ba82e3b07955f1.tar.bz2
Change some methods to take a const isa_parser_t (#939)
No functional change, but this is needed for a following refactor where we're passing it around const.
-rw-r--r--disasm/disasm.cc4
-rw-r--r--riscv/disasm.h4
-rw-r--r--riscv/processor.h4
3 files changed, 6 insertions, 6 deletions
diff --git a/disasm/disasm.cc b/disasm/disasm.cc
index 58c169b..beb18c2 100644
--- a/disasm/disasm.cc
+++ b/disasm/disasm.cc
@@ -622,7 +622,7 @@ static void NOINLINE add_unknown_insns(disassembler_t* d)
#undef DECLARE_INSN
}
-void disassembler_t::add_instructions(isa_parser_t* isa)
+void disassembler_t::add_instructions(const isa_parser_t* isa)
{
const uint32_t mask_rd = 0x1fUL << 7;
const uint32_t match_rd_ra = 1UL << 7;
@@ -2024,7 +2024,7 @@ void disassembler_t::add_instructions(isa_parser_t* isa)
}
}
-disassembler_t::disassembler_t(isa_parser_t* isa)
+disassembler_t::disassembler_t(const isa_parser_t *isa)
{
// highest priority: instructions explicitly enabled
add_instructions(isa);
diff --git a/riscv/disasm.h b/riscv/disasm.h
index 9957ce0..ce844d6 100644
--- a/riscv/disasm.h
+++ b/riscv/disasm.h
@@ -81,7 +81,7 @@ class disasm_insn_t
class disassembler_t
{
public:
- disassembler_t(isa_parser_t* isa);
+ disassembler_t(const isa_parser_t *isa);
~disassembler_t();
std::string disassemble(insn_t insn) const;
@@ -93,7 +93,7 @@ class disassembler_t
static const int HASH_SIZE = 255;
std::vector<const disasm_insn_t*> chain[HASH_SIZE+1];
- void add_instructions(isa_parser_t* isa);
+ void add_instructions(const isa_parser_t* isa);
const disasm_insn_t* probe_once(insn_t insn, size_t idx) const;
diff --git a/riscv/processor.h b/riscv/processor.h
index 9833cfa..05c55ce 100644
--- a/riscv/processor.h
+++ b/riscv/processor.h
@@ -313,8 +313,8 @@ class isa_parser_t {
public:
isa_parser_t(const char* str);
~isa_parser_t(){};
- unsigned get_max_xlen() { return max_xlen; }
- std::string get_isa_string() { return isa_string; }
+ unsigned get_max_xlen() const { return max_xlen; }
+ std::string get_isa_string() const { return isa_string; }
bool extension_enabled(unsigned char ext) const {
if (ext >= 'A' && ext <= 'Z')
return (max_isa >> (ext - 'A')) & 1;