[mips] Add support for accessing $gp as a named register.
authorDaniel Sanders <daniel.sanders@imgtec.com>
Fri, 9 Jan 2015 17:21:30 +0000 (17:21 +0000)
committerDaniel Sanders <daniel.sanders@imgtec.com>
Fri, 9 Jan 2015 17:21:30 +0000 (17:21 +0000)
commit1440bb2a26ff13df1b29762658ee122cc0bc47ae
treebd1540702f4a6f77010173a9988b1ab2f9ec389a
parent2ce8169ed3c8f49c3ae02c1fd10a684265c1dfcf
[mips] Add support for accessing $gp as a named register.

Summary:
Mips Linux uses $gp to hold a pointer to thread info structure and accesses it
with a named register. This makes this work for LLVM.

The N32 ABI doesn't quite work yet since the frontend generates incorrect IR
for this case. It neglects to truncate the 64-bit GPR to a 32-bit value before
converting to a pointer. Given correct IR (as in the testcase in this patch),
it works correctly.

Reviewers: sstankovic, vmedic, atanasyan

Reviewed By: atanasyan

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D6893

llvm-svn: 225529
llvm/lib/Target/Mips/MipsISelLowering.cpp
llvm/lib/Target/Mips/MipsISelLowering.h
llvm/test/CodeGen/Mips/named-register-n32.ll [new file with mode: 0644]
llvm/test/CodeGen/Mips/named-register-n64.ll [new file with mode: 0644]
llvm/test/CodeGen/Mips/named-register-o32.ll [new file with mode: 0644]