aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2022-05-25 18:34:57 -0700
committerAndrew Waterman <andrew@sifive.com>2022-05-25 18:34:57 -0700
commit40cc0837cfa82cd74daf631a46d01d4c544b1277 (patch)
tree2aa853b9aee24bf2f0a9a7f2c82e8682bda6c178
parentc8bceaefcea4daed34779d6193ddf5e4379b3bcc (diff)
downloadriscv-isa-sim-simplify-misaligned.zip
riscv-isa-sim-simplify-misaligned.tar.gz
riscv-isa-sim-simplify-misaligned.tar.bz2
Actually inline load_fast/store_fast for clang/ARMsimplify-misaligned
-rw-r--r--riscv/common.h2
-rw-r--r--riscv/mmu.h8
2 files changed, 6 insertions, 4 deletions
diff --git a/riscv/common.h b/riscv/common.h
index 002a83f..7d37001 100644
--- a/riscv/common.h
+++ b/riscv/common.h
@@ -8,11 +8,13 @@
# define unlikely(x) __builtin_expect(x, 0)
# define NOINLINE __attribute__ ((noinline))
# define NORETURN __attribute__ ((noreturn))
+# define ALWAYS_INLINE __attribute__ ((always_inline))
#else
# define likely(x) (x)
# define unlikely(x) (x)
# define NOINLINE
# define NORETURN
+# define ALWAYS_INLINE
#endif
#endif
diff --git a/riscv/mmu.h b/riscv/mmu.h
index 06122c4..7c44c1e 100644
--- a/riscv/mmu.h
+++ b/riscv/mmu.h
@@ -84,7 +84,7 @@ public:
#endif
template<class T, unsigned xlate_flags>
- inline T load_fast(reg_t addr, bool require_alignment = false) {
+ ALWAYS_INLINE T load_fast(reg_t addr, bool require_alignment = false) {
const size_t size = sizeof(T);
const reg_t vpn = addr >> PGSHIFT;
const bool normal_tlb_hit = likely(tlb_load_tag[vpn % TLB_ENTRIES] == vpn);
@@ -123,7 +123,7 @@ public:
// template for functions that load an aligned value from memory
#define load_func(type, prefix, xlate_flags) \
- inline type##_t prefix##_##type(reg_t addr, bool require_alignment = false) { \
+ ALWAYS_INLINE type##_t prefix##_##type(reg_t addr, bool require_alignment = false) { \
return load_fast<type##_t, xlate_flags>(addr, require_alignment); \
}
@@ -161,7 +161,7 @@ public:
#endif
template<class T, unsigned xlate_flags>
- inline void store_fast(reg_t addr, T val, bool actually_store=true, bool require_alignment=false) {
+ ALWAYS_INLINE void store_fast(reg_t addr, T val, bool actually_store=true, bool require_alignment=false) {
const size_t size = sizeof(T);
const reg_t vpn = addr >> PGSHIFT;
const bool misaligned = unlikely((addr & (size-1)) != 0);
@@ -197,7 +197,7 @@ public:
// template for functions that store an aligned value to memory
#define store_func(type, prefix, xlate_flags) \
- void prefix##_##type(reg_t addr, type##_t val, bool actually_store=true, bool require_alignment=false) { \
+ ALWAYS_INLINE void prefix##_##type(reg_t addr, type##_t val, bool actually_store=true, bool require_alignment=false) { \
store_fast<type##_t, (xlate_flags)>(addr, val, actually_store, require_alignment); \
}