This is an archive of the discontinued LLVM Phabricator instance.

[mips] Expand 'lw/sw' instructions for 32-bit GOT
ClosedPublic

Authored by atanasyan on Sep 18 2019, 6:34 AM.

Details

Summary

In case of using 32-bit GOT access to the table requires two instructions with attached %got_hi and %got_lo relocations. This patch implements correct expansion of 'lw/sw' instructions in that case.

Diff Detail

Event Timeline

atanasyan created this revision.Sep 18 2019, 6:34 AM
Petar.Avramovic accepted this revision.Sep 18 2019, 8:28 AM

LGTM.

llvm/test/MC/Mips/mips64-expansions.s
3

Missing run line with -mattr=+xgot.

506

Do symbols have different handling in assembly file based on something, like getAddrLocal and getAddrGlobal/getAddrGlobalLargeGOT in MipsISelLowering.cpp ?

This revision is now accepted and ready to land.Sep 18 2019, 8:28 AM
atanasyan marked 2 inline comments as done.Sep 18 2019, 11:45 AM
atanasyan added inline comments.
llvm/test/MC/Mips/mips64-expansions.s
3

Good catch. I'll fix that.

506

Yes. The xgot flag does not affect taking address of local symbol. For global symbols with xgot flag we generate a pair of %got_hi/%got_lo relocations like the getAddrGlobalLargeGOT does. Without xgot flag we generate %got_disp in 64-bit case and %got in 32-bit case like the getAddrGlobal does.

This revision was automatically updated to reflect the committed changes.
llvm/trunk/test/MC/Mips/mips64-expansions.s
91 ↗(On Diff #220726)

Do symbols have different handling in assembly ...

Missed that sym is local.