This is an archive of the discontinued LLVM Phabricator instance.

[mips] Add support for accessing $gp as a named register.
ClosedPublic

Authored by dsanders on Jan 9 2015, 7:27 AM.

Details

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.

Diff Detail

Event Timeline

dsanders updated this revision to Diff 17926.Jan 9 2015, 7:27 AM
dsanders retitled this revision from to [mips] Add support for accessing $gp as a named register..
dsanders updated this object.
dsanders edited the test plan for this revision. (Show Details)
dsanders added reviewers: atanasyan, sstankovic, vmedic.
dsanders added a subscriber: Unknown Object (MLST).
atanasyan accepted this revision.Jan 9 2015, 7:56 AM
atanasyan edited edge metadata.

LGTM (with a nit).

lib/Target/Mips/MipsISelLowering.h
265

Missed override keyword?

This revision is now accepted and ready to land.Jan 9 2015, 7:56 AM
dsanders closed this revision.Jan 9 2015, 9:22 AM

Thanks.

Missed override keyword?

Oops. Fixed in the commit (r225529).