NyuziToolchain
NyuziToolchain copied to clipboard
Optimize constant pool/global memory accesses
With new implementation, a constant pool load takes 3 instructions:
movehi s0, hi(.LCPI1_0)
or s0, s0, lo(.LCPI1_0)
load_32 s0, (s0)
This can be done in two instructions by using an immediate offset with the memory instruction:
movehi s0, hi(.LCPI1_0)
load_32 s0, lo(.LCPI1_0)(s0)
This will require a new type of relocation that can patch the memory instruction. Global variable loads and stores can be optimized similarly.