Tighten up internal vs external functions, which lets optimiser do a better job, self.bin about 10% smaller.

This commit is contained in:
Toby Jaffey 2025-12-14 19:51:36 +00:00
parent 07bab3cca6
commit f917ba38ff
3 changed files with 22 additions and 21 deletions

View file

@ -47,18 +47,8 @@ SOFTWARE.
#define MINIRV32_NO_BREAKPOINT_NO_INTERRUPTS
#define MINI_RV32_RAM_SIZE UVM32_MEMORY_SIZE
#define MINIRV32_POSTEXEC(pc, ir, retval) {if (retval > 0) return retval;}
uint32_t _uvm32_extramLoad(void *userdata, uint32_t addr, uint32_t accessTyp);
uint32_t _uvm32_extramStore(void *userdata, uint32_t addr, uint32_t val, uint32_t accessTyp);
#define MINIRV32_HANDLE_MEM_LOAD_CONTROL( addy, rval ) rval = _uvm32_extramLoad(userdata, addy, ( ir >> 12 ) & 0x7);
#define MINIRV32_HANDLE_MEM_STORE_CONTROL( addy, val ) if( _uvm32_extramStore(userdata, addy, val, ( ir >> 12 ) & 0x7) ) return val;
void _uvm32_store4(void *p, uint32_t off, uint32_t val);
void _uvm32_store2(void *p, uint32_t off, uint16_t val);
void _uvm32_store1(void *p, uint32_t off, uint8_t val);
uint32_t _uvm32_load4(void *p, uint32_t off);
uint16_t _uvm32_load2(void *p, uint32_t off);
uint8_t _uvm32_load1(void *p, uint32_t off);
int16_t _uvm32_load2s(void *p, uint32_t off);
int8_t _uvm32_load1s(void *p, uint32_t off);
#define MINIRV32_CUSTOM_MEMORY_BUS
#define MINIRV32_STORE4( ofs, val ) _uvm32_store4(image, ofs, val)
#define MINIRV32_STORE2( ofs, val ) _uvm32_store2(image, ofs, val)
@ -70,6 +60,17 @@ int8_t _uvm32_load1s(void *p, uint32_t off);
#define MINIRV32_LOAD1_SIGNED( ofs ) _uvm32_load1s(image, ofs)
#ifndef MINIRV32_IMPLEMENTATION
#define MINIRV32_STEPPROTO
#else
static uint32_t _uvm32_extramLoad(void *userdata, uint32_t addr, uint32_t accessTyp);
static uint32_t _uvm32_extramStore(void *userdata, uint32_t addr, uint32_t val, uint32_t accessTyp);
static void _uvm32_store4(void *p, uint32_t off, uint32_t val);
static void _uvm32_store2(void *p, uint32_t off, uint16_t val);
static void _uvm32_store1(void *p, uint32_t off, uint8_t val);
static uint32_t _uvm32_load4(void *p, uint32_t off);
static uint16_t _uvm32_load2(void *p, uint32_t off);
static uint8_t _uvm32_load1(void *p, uint32_t off);
static int16_t _uvm32_load2s(void *p, uint32_t off);
static int8_t _uvm32_load1s(void *p, uint32_t off);
#endif
#include "mini-rv32ima.h"