Handle load flags (e.g., sign/zero extension, NaN boxing) at the end of ReadMem() regardless of whether RevMem or MemH is used.
Previously, the integer/floating-point load execute functions performed the operation on the destination register regardless of whether RevMem or MemH was used, causing a garbage temporary result in the destination register if MemH was used.
Use memcpy() and separate 1/2/4-byte variables to make the code C++-compliant and independent of host machine's endianness. Previously, the code assumed a little-endian host and performed undefined behavior with pointer casting, which violates the C/C++ strict aliasing rule (it is undefined behavior to cast a pointer from one type to another and then dereference it, unless the second type is a char).
Add another pseudoinstruction: ra as destination register is implicit in jal instruction -- objdump and other disassemblers do not list ra as a destination register but make it implicit by leaving it out of the disassembly -- only non-ra destination registers are explicitly listed in disassembly.
Handle load flags (e.g., sign/zero extension, NaN boxing) at the end of
ReadMem()
regardless of whetherRevMem
orMemH
is used.Previously, the integer/floating-point load execute functions performed the operation on the destination register regardless of whether
RevMem
orMemH
was used, causing a garbage temporary result in the destination register ifMemH
was used.Use
memcpy()
and separate 1/2/4-byte variables to make the code C++-compliant and independent of host machine's endianness. Previously, the code assumed a little-endian host and performed undefined behavior with pointer casting, which violates the C/C++ strict aliasing rule (it is undefined behavior to cast a pointer from one type to another and then dereference it, unless the second type is achar
).Add another pseudoinstruction:
ra
as destination register is implicit injal
instruction --objdump
and other disassemblers do not listra
as a destination register but make it implicit by leaving it out of the disassembly -- only non-ra
destination registers are explicitly listed in disassembly.