dotnet / corert

This repo contains CoreRT, an experimental .NET Core runtime optimized for AOT (ahead of time compilation) scenarios, with the accompanying compiler toolchain.
http://dot.net
MIT License
2.91k stars 508 forks source link

ARM64: optimize PREPARE_EXTERNAL_VAR (#21) #8296

Closed RalfKornmannEnvision closed 4 years ago

RalfKornmannEnvision commented 4 years ago

There are multiple cases were we don't need just the pointer for an external variable but the value that is stored at this location. So far this was done with the PREPARE_EXTERNAL_VAR followed by an ldr x? [x?]. The PREPARE_EXTERNAL_VAR macro needs two instructions (adrp + add). As the ldr instruction supports an offset we can eliminate the add for this use case. The two new macros PREPARE_EXTERNAL_VAR_INDIRECT and PREPARE_EXTERNAL_VAR_INDIRECT_W make use of this.

RalfKornmannEnvision commented 4 years ago

I know this might be some unnecessary over optimizing but if we already use assembler for these helpers saving some more cycles might not be worst we can do.