HomePhabricator

[mips] Use less registers to load address of TargetExternalSymbol

Description

[mips] Use less registers to load address of TargetExternalSymbol

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)

Differential Revision: https://reviews.llvm.org/D66771

Details