This is an archive of the discontinued LLVM Phabricator instance.

[mips] Add assembler support for the "la $reg,symbol" pseudo-instruction.
ClosedPublic

Authored by tomatabacu on Aug 6 2014, 6:40 AM.

Details

Summary

This pseudo-instruction allows the programmer to load an address from a symbolic expression into a register.

Patch by David Chisnall.
His work was sponsored by: DARPA, AFRL

I've made some minor changes to the original, such as improving the formatting and adding some comments, and I've also added a test case.

Diff Detail

Event Timeline

tomatabacu updated this revision to Diff 12232.Aug 6 2014, 6:40 AM
tomatabacu retitled this revision from to [mips] Add assembler support for the "la $reg,symbol" pseudo-instruction..
tomatabacu updated this object.
tomatabacu edited the test plan for this revision. (Show Details)
tomatabacu added a reviewer: dsanders.
dsanders edited edge metadata.Aug 13 2014, 5:13 AM

LGTM with a formatting nit and one change to avoid creating objects that aren't used.

lib/Target/Mips/AsmParser/MipsAsmParser.cpp
1344–1349

These two shouldn't be created until we know we need them (which is in the if(isGP64bit()) block below).

1358

You'll need to sink this statement into the if-statement too.

1375–1379

I'd put braces around this since it spans several lines

tomatabacu updated this revision to Diff 12443.Aug 13 2014, 6:33 AM
tomatabacu edited edge metadata.

Addressed comments.
Also added the rest of the LUi-generating code inside the if-else, because it's much more readable this way.

dsanders accepted this revision.Aug 13 2014, 12:40 PM
dsanders edited edge metadata.

Thanks. LGTM with one whitespace nit I didn't notice the first time around.

test/MC/Mips/mips-expansions.s
20–35

Whitespace nit: Please align the start of the operand list for lui/ori to match the neighbouring instructions

This revision is now accepted and ready to land.Aug 13 2014, 12:40 PM
tomatabacu updated this revision to Diff 12490.Aug 14 2014, 1:30 AM
tomatabacu edited edge metadata.

Addressed comment.

tomatabacu closed this revision.Aug 14 2014, 1:41 AM