Previously, our codebase was suboptimal for the organization of load and store instructions. Each ISA instruction had its own separate enum field, resulting in redundancy and maintenance challenges. However, many load and store instructions share their meaningful fields.
Key Changes
Common Structure: By identifying a common structure for load and store instructions, it was possible to reduce the number of enum variants—from 12 down to just 2. This streamlined approach ensures scalability even if we decide to add support for floating-point or double-precision load and store instructions in the future.
Refactored Handlers: Sequentially refactored the handlers for load and store operations, consolidating them into just 2 functions. This reduction in repetition simplifies the codebase and improves maintainability.
Unsigned Load Support: Adding support for unsigned loads became trivial after these changes, so i decided to leave it on the same branch.
Summary
Previously, our codebase was suboptimal for the organization of load and store instructions. Each ISA instruction had its own separate enum field, resulting in redundancy and maintenance challenges. However, many load and store instructions share their meaningful fields.
Key Changes