Page MenuHomePhabricator

[mips] Use less registers to load address of TargetExternalSymbol
ClosedPublic

Authored by atanasyan on Mon, Aug 26, 3:46 PM.

Details

Summary

There is no pattern matched add hi, (MipsLo texternalsym). As a result, loading an address of 32-bit symbol requires two registers and one more additional instruction:

addiu $1, $zero, %lo(foo)
lui   $2, %hi(foo)
addu  $25, $2, $1

This patch adds the missed pattern and enables generation more effective set of instructions:

lui   $1, %hi(foo)
addiu $25, $1, %lo(foo)

Diff Detail

Repository
rL LLVM

Event Timeline

atanasyan created this revision.Mon, Aug 26, 3:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptMon, Aug 26, 3:46 PM
This revision is now accepted and ready to land.Tue, Aug 27, 6:37 AM
This revision was automatically updated to reflect the committed changes.