Browse Source

Suppress most unused variable warnings

pull/1089/head
Andrew Waterman 4 years ago
parent
commit
ce69fb5db9
  1. 2
      customext/dummy_rocc.cc
  2. 6
      disasm/disasm.cc
  3. 5
      riscv/cachesim.h
  4. 6
      riscv/csrs.cc
  5. 2
      riscv/csrs.h
  6. 3
      riscv/entropy_source.h
  7. 2
      riscv/execute.cc
  8. 2
      riscv/extension.h
  9. 2
      riscv/insns/amoswap_d.h
  10. 2
      riscv/insns/amoswap_w.h
  11. 2
      riscv/mmu.cc
  12. 4
      riscv/mmu.h
  13. 2
      riscv/processor.cc
  14. 2
      riscv/processor.h
  15. 2
      riscv/rocc.cc
  16. 2
      riscv/rom.cc
  17. 2
      riscv/tracer.h
  18. 2
      riscv/triggers.cc
  19. 4
      riscv/v_ext_macros.h

2
customext/dummy_rocc.cc

@ -7,7 +7,7 @@ class dummy_rocc_t : public rocc_t
public: public:
const char* name() { return "dummy_rocc"; } const char* name() { return "dummy_rocc"; }
reg_t custom0(rocc_insn_t insn, reg_t xs1, reg_t xs2) reg_t custom0(rocc_insn_t insn, reg_t xs1, reg_t UNUSED xs2)
{ {
reg_t prev_acc = acc[insn.rs2]; reg_t prev_acc = acc[insn.rs2];

6
disasm/disasm.cc

@ -180,7 +180,7 @@ struct : public arg_t {
} rvc_fp_rs2s; } rvc_fp_rs2s;
struct : public arg_t { struct : public arg_t {
std::string to_string(insn_t insn) const { std::string to_string(insn_t UNUSED insn) const {
return xpr_name[X_SP]; return xpr_name[X_SP];
} }
} rvc_sp; } rvc_sp;
@ -314,7 +314,7 @@ struct : public arg_t {
} vm; } vm;
struct : public arg_t { struct : public arg_t {
std::string to_string(insn_t insn) const { std::string to_string(insn_t UNUSED insn) const {
return "v0"; return "v0";
} }
} v0; } v0;
@ -358,7 +358,7 @@ struct : public arg_t {
} v_vtype; } v_vtype;
struct : public arg_t { struct : public arg_t {
std::string to_string(insn_t insn) const { std::string to_string(insn_t UNUSED insn) const {
return "x0"; return "x0";
} }
} x0; } x0;

5
riscv/cachesim.h

@ -4,6 +4,7 @@
#define _RISCV_CACHE_SIM_H #define _RISCV_CACHE_SIM_H
#include "memtracer.h" #include "memtracer.h"
#include "common.h"
#include <cstring> #include <cstring>
#include <string> #include <string>
#include <map> #include <map>
@ -108,7 +109,7 @@ class icache_sim_t : public cache_memtracer_t
{ {
public: public:
icache_sim_t(const char* config) : cache_memtracer_t(config, "I$") {} icache_sim_t(const char* config) : cache_memtracer_t(config, "I$") {}
bool interested_in_range(uint64_t begin, uint64_t end, access_type type) bool interested_in_range(uint64_t UNUSED begin, uint64_t UNUSED end, access_type type)
{ {
return type == FETCH; return type == FETCH;
} }
@ -122,7 +123,7 @@ class dcache_sim_t : public cache_memtracer_t
{ {
public: public:
dcache_sim_t(const char* config) : cache_memtracer_t(config, "D$") {} dcache_sim_t(const char* config) : cache_memtracer_t(config, "D$") {}
bool interested_in_range(uint64_t begin, uint64_t end, access_type type) bool interested_in_range(uint64_t UNUSED begin, uint64_t UNUSED end, access_type type)
{ {
return type == LOAD || type == STORE; return type == LOAD || type == STORE;
} }

6
riscv/csrs.cc

@ -60,7 +60,7 @@ void csr_t::log_write() const noexcept {
log_special_write(address, written_value()); log_special_write(address, written_value());
} }
void csr_t::log_special_write(const reg_t address, const reg_t val) const noexcept { void csr_t::log_special_write(const reg_t UNUSED address, const reg_t UNUSED val) const noexcept {
#if defined(RISCV_ENABLE_COMMITLOG) #if defined(RISCV_ENABLE_COMMITLOG)
proc->get_state()->log_reg_write[((address) << 4) | 4] = {val, 0}; proc->get_state()->log_reg_write[((address) << 4) | 4] = {val, 0};
#endif #endif
@ -1023,7 +1023,7 @@ reg_t const_csr_t::read() const noexcept {
return val; return val;
} }
bool const_csr_t::unlogged_write(const reg_t val) noexcept { bool const_csr_t::unlogged_write(const reg_t UNUSED val) noexcept {
return false; return false;
} }
@ -1466,7 +1466,7 @@ reg_t scountovf_csr_t::read() const noexcept {
return val; return val;
} }
bool scountovf_csr_t::unlogged_write(const reg_t val) noexcept { bool scountovf_csr_t::unlogged_write(const reg_t UNUSED val) noexcept {
/* this function is unused */ /* this function is unused */
return false; return false;
} }

2
riscv/csrs.h

@ -521,7 +521,7 @@ class time_counter_csr_t: public csr_t {
void sync(const reg_t val) noexcept; void sync(const reg_t val) noexcept;
protected: protected:
virtual bool unlogged_write(const reg_t val) noexcept override { return false; }; virtual bool unlogged_write(const reg_t UNUSED val) noexcept override { return false; };
private: private:
reg_t shadow_val; reg_t shadow_val;
}; };

3
riscv/entropy_source.h

@ -3,6 +3,7 @@
#include <iostream> #include <iostream>
#include "internals.h" #include "internals.h"
#include "common.h"
// //
// Used to model the cryptography extension entropy source. // Used to model the cryptography extension entropy source.
@ -30,7 +31,7 @@ public:
// seed register // seed register
// ------------------------------------------------------------ // ------------------------------------------------------------
void set_seed(reg_t val) { void set_seed(reg_t UNUSED val) {
// Always ignore writes to seed. // Always ignore writes to seed.
// This CSR is strictly read only. It occupies a RW CSR address // This CSR is strictly read only. It occupies a RW CSR address
// to handle the side-effect of the changing seed value on a read. // to handle the side-effect of the changing seed value on a read.

2
riscv/execute.cc

@ -156,7 +156,7 @@ static void commit_log_print_insn(processor_t *p, reg_t pc, insn_t insn)
} }
#endif #endif
inline void processor_t::update_histogram(reg_t pc) inline void processor_t::update_histogram(reg_t UNUSED pc)
{ {
#ifdef RISCV_ENABLE_HISTOGRAM #ifdef RISCV_ENABLE_HISTOGRAM
pc_histogram[pc]++; pc_histogram[pc]++;

2
riscv/extension.h

@ -15,7 +15,7 @@ class extension_t
virtual std::vector<disasm_insn_t*> get_disasms() = 0; virtual std::vector<disasm_insn_t*> get_disasms() = 0;
virtual const char* name() = 0; virtual const char* name() = 0;
virtual void reset() {}; virtual void reset() {};
virtual void set_debug(bool value) {}; virtual void set_debug(bool UNUSED value) {}
virtual ~extension_t(); virtual ~extension_t();
void set_processor(processor_t* _p) { p = _p; } void set_processor(processor_t* _p) { p = _p; }

2
riscv/insns/amoswap_d.h

@ -1,3 +1,3 @@
require_extension('A'); require_extension('A');
require_rv64; require_rv64;
WRITE_RD(MMU.amo_uint64(RS1, [&](uint64_t lhs) { return RS2; })); WRITE_RD(MMU.amo_uint64(RS1, [&](uint64_t UNUSED lhs) { return RS2; }));

2
riscv/insns/amoswap_w.h

@ -1,2 +1,2 @@
require_extension('A'); require_extension('A');
WRITE_RD(sext32(MMU.amo_uint32(RS1, [&](uint32_t lhs) { return RS2; }))); WRITE_RD(sext32(MMU.amo_uint32(RS1, [&](uint32_t UNUSED lhs) { return RS2; })));

2
riscv/mmu.cc

@ -114,7 +114,7 @@ reg_t reg_from_bytes(size_t len, const uint8_t* bytes)
abort(); abort();
} }
bool mmu_t::mmio_ok(reg_t addr, access_type type) bool mmu_t::mmio_ok(reg_t addr, access_type UNUSED type)
{ {
// Disallow access to debug region when not in debug mode // Disallow access to debug region when not in debug mode
if (addr >= DEBUG_START && addr <= DEBUG_END && proc && !proc->state.debug_mode) if (addr >= DEBUG_START && addr <= DEBUG_END && proc && !proc->state.debug_mode)

4
riscv/mmu.h

@ -52,7 +52,7 @@ public:
#define RISCV_XLATE_VIRT (1U << 0) #define RISCV_XLATE_VIRT (1U << 0)
#define RISCV_XLATE_VIRT_HLVX (1U << 1) #define RISCV_XLATE_VIRT_HLVX (1U << 1)
inline reg_t misaligned_load(reg_t addr, size_t size, uint32_t xlate_flags) inline reg_t misaligned_load(reg_t addr, size_t UNUSED size, uint32_t xlate_flags)
{ {
#ifdef RISCV_ENABLE_MISALIGNED #ifdef RISCV_ENABLE_MISALIGNED
reg_t res = 0; reg_t res = 0;
@ -72,7 +72,7 @@ public:
#endif #endif
} }
inline void misaligned_store(reg_t addr, reg_t data, size_t size, uint32_t xlate_flags, bool actually_store=true) inline void misaligned_store(reg_t addr, reg_t UNUSED data, size_t UNUSED size, uint32_t xlate_flags, bool UNUSED actually_store=true)
{ {
#ifdef RISCV_ENABLE_MISALIGNED #ifdef RISCV_ENABLE_MISALIGNED
for (size_t i = 0; i < size; i++) { for (size_t i = 0; i < size; i++) {

2
riscv/processor.cc

@ -960,7 +960,7 @@ reg_t processor_t::get_csr(int which, insn_t insn, bool write, bool peek)
throw trap_illegal_instruction(insn.bits()); throw trap_illegal_instruction(insn.bits());
} }
reg_t illegal_instruction(processor_t* p, insn_t insn, reg_t pc) reg_t illegal_instruction(processor_t UNUSED *p, insn_t insn, reg_t UNUSED pc)
{ {
// The illegal instruction can be longer than ILEN bits, where the tval will // The illegal instruction can be longer than ILEN bits, where the tval will
// contain the first ILEN bits of the faulting instruction. We hard-code the // contain the first ILEN bits of the faulting instruction. We hard-code the

2
riscv/processor.h

@ -401,7 +401,7 @@ public:
// vector element for varies SEW // vector element for varies SEW
template<class T> template<class T>
T& elt(reg_t vReg, reg_t n, bool is_write = false) { T& elt(reg_t vReg, reg_t n, bool UNUSED is_write = false) {
assert(vsew != 0); assert(vsew != 0);
assert((VLEN >> 3)/sizeof(T) > 0); assert((VLEN >> 3)/sizeof(T) > 0);
reg_t elts_per_reg = (VLEN >> 3) / (sizeof(T)); reg_t elts_per_reg = (VLEN >> 3) / (sizeof(T));

2
riscv/rocc.cc

@ -18,7 +18,7 @@
return pc+4; \ return pc+4; \
} \ } \
\ \
reg_t rocc_t::custom##n(rocc_insn_t insn, reg_t xs1, reg_t xs2) \ reg_t rocc_t::custom##n(rocc_insn_t UNUSED insn, reg_t UNUSED xs1, reg_t UNUSED xs2) \
{ \ { \
illegal_instruction(); \ illegal_instruction(); \
return 0; \ return 0; \

2
riscv/rom.cc

@ -13,7 +13,7 @@ bool rom_device_t::load(reg_t addr, size_t len, uint8_t* bytes)
return true; return true;
} }
bool rom_device_t::store(reg_t addr, size_t len, const uint8_t* bytes) bool rom_device_t::store(reg_t UNUSED addr, size_t UNUSED len, const uint8_t UNUSED *bytes)
{ {
return false; return false;
} }

2
riscv/tracer.h

@ -5,7 +5,7 @@
#include "processor.h" #include "processor.h"
static inline void trace_opcode(processor_t* p, insn_bits_t opc, insn_t insn) { static inline void trace_opcode(processor_t UNUSED *p, insn_bits_t UNUSED opc, insn_t UNUSED insn) {
} }
#endif #endif

2
riscv/triggers.cc

@ -62,7 +62,7 @@ bool mcontrol_t::tdata1_write(processor_t * const proc, const reg_t val) noexcep
return true; return true;
} }
reg_t mcontrol_t::tdata2_read(const processor_t * const proc) const noexcept { reg_t mcontrol_t::tdata2_read(const processor_t UNUSED * const proc) const noexcept {
return tdata2; return tdata2;
} }

4
riscv/v_ext_macros.h

@ -1410,14 +1410,14 @@ reg_t index[P.VU.vlmax]; \
switch (P.VU.vsew) { \ switch (P.VU.vsew) { \
case e32: { \ case e32: { \
auto vs3 = P.VU.elt< type ## 32_t>(vd, vreg_inx); \ auto vs3 = P.VU.elt< type ## 32_t>(vd, vreg_inx); \
auto val = MMU.amo_uint32(baseAddr + index[i], [&](type ## 32_t lhs) { op }); \ auto val = MMU.amo_uint32(baseAddr + index[i], [&](type ## 32_t UNUSED lhs) { op }); \
if (insn.v_wd()) \ if (insn.v_wd()) \
P.VU.elt< type ## 32_t>(vd, vreg_inx, true) = val; \ P.VU.elt< type ## 32_t>(vd, vreg_inx, true) = val; \
} \ } \
break; \ break; \
case e64: { \ case e64: { \
auto vs3 = P.VU.elt< type ## 64_t>(vd, vreg_inx); \ auto vs3 = P.VU.elt< type ## 64_t>(vd, vreg_inx); \
auto val = MMU.amo_uint64(baseAddr + index[i], [&](type ## 64_t lhs) { op }); \ auto val = MMU.amo_uint64(baseAddr + index[i], [&](type ## 64_t UNUSED lhs) { op }); \
if (insn.v_wd()) \ if (insn.v_wd()) \
P.VU.elt< type ## 64_t>(vd, vreg_inx, true) = val; \ P.VU.elt< type ## 64_t>(vd, vreg_inx, true) = val; \
} \ } \

Loading…
Cancel
Save