aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorSimon Atanasyan <simon@atanasyan.com>2019-08-28 12:35:53 +0000
committerSimon Atanasyan <simon@atanasyan.com>2019-08-28 12:35:53 +0000
commitf46ba4f0771be75016b3a2cde6779e5d0210350f (patch)
tree6692023ef73148b7508462d8ad5072d506193605 /llvm/lib
parent95686fa898e62c57529a649758e7f735d851c00d (diff)
downloadllvm-f46ba4f0771be75016b3a2cde6779e5d0210350f.zip
llvm-f46ba4f0771be75016b3a2cde6779e5d0210350f.tar.gz
llvm-f46ba4f0771be75016b3a2cde6779e5d0210350f.tar.bz2
[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 llvm-svn: 370196
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/Mips/MipsInstrInfo.td2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Target/Mips/MipsInstrInfo.td b/llvm/lib/Target/Mips/MipsInstrInfo.td
index 834d9d8..49413c9 100644
--- a/llvm/lib/Target/Mips/MipsInstrInfo.td
+++ b/llvm/lib/Target/Mips/MipsInstrInfo.td
@@ -3165,6 +3165,8 @@ multiclass MipsHiLoRelocs<Instruction Lui, Instruction Addiu,
(Addiu GPROpnd:$hi, tconstpool:$lo)>;
def : MipsPat<(add GPROpnd:$hi, (MipsLo tglobaltlsaddr:$lo)),
(Addiu GPROpnd:$hi, tglobaltlsaddr:$lo)>;
+ def : MipsPat<(add GPROpnd:$hi, (MipsLo texternalsym:$lo)),
+ (Addiu GPROpnd:$hi, texternalsym:$lo)>;
}
// wrapper_pic