This is an archive of the discontinued LLVM Phabricator instance.

Add support for small-model PIC for PowerPC.
ClosedPublic

Authored by jhibbits on Sep 18 2014, 10:16 AM.

Details

Summary

Large-model was added first. With the addition of support for multiple PIC
models in LLVM, now add small-model PIC for 32-bit PowerPC, SysV4 ABI. This
generates more optimal code, for shared libraries with less than about 16380
data objects.

Diff Detail

Repository
rL LLVM

Event Timeline

jhibbits updated this revision to Diff 13837.Sep 18 2014, 10:16 AM
jhibbits retitled this revision from to Add support for small-model PIC for PowerPC..
jhibbits updated this object.
jhibbits edited the test plan for this revision. (Show Details)
jhibbits added reviewers: hfinkel, joerg.
jhibbits added a subscriber: Unknown Object (MLST).

Note: This also requires the patch in D5332.

emaste added a subscriber: emaste.Sep 18 2014, 10:20 AM
hfinkel added inline comments.Sep 18 2014, 10:46 AM
lib/Target/PowerPC/PPCAsmPrinter.cpp
323 ↗(On Diff #13837)

It would be nice to have a comment here explaining what the 4 means.

415 ↗(On Diff #13837)

Why?

lib/Target/PowerPC/PPCISelLowering.cpp
1700 ↗(On Diff #13837)

Should we rename the GOTPtr variable?

1733 ↗(On Diff #13837)

Same here.

lib/Target/PowerPC/PPCInstrInfo.td
3694 ↗(On Diff #13837)

Don't need to add a line here.

test/CodeGen/PowerPC/ppc32-pic.ll
11 ↗(On Diff #13837)

SMALL-BSS-LABEL: foo

(but make the name something that is not a substring of other things)

jhibbits added inline comments.Sep 18 2014, 11:01 AM
lib/Target/PowerPC/PPCAsmPrinter.cpp
415 ↗(On Diff #13837)

This was part of the cleanup of the original check-in (because both implementations are rather intertwined in code touched, I lumped them together). I can remove this change.

lib/Target/PowerPC/PPCISelLowering.cpp
1700 ↗(On Diff #13837)

In both cases it points to the GOT. Although, GOTPtr is a little silly for 64-bit.

lib/Target/PowerPC/PPCInstrInfo.td
3694 ↗(On Diff #13837)

Hmm, no idea how that snuck in there.

hfinkel added inline comments.Sep 18 2014, 11:19 AM
lib/Target/PowerPC/PPCAsmPrinter.cpp
415 ↗(On Diff #13837)

Specifically, I mean that you renamed ".L.TOC." to ".LTOC.", and I am curious why.

jhibbits added inline comments.Sep 18 2014, 11:30 AM
lib/Target/PowerPC/PPCAsmPrinter.cpp
415 ↗(On Diff #13837)

Aesthetics only. After submitting the PIC and TLS patches, I started cleaning up, and thought the .L.TOC. looked messy. No other reason at all.

jhibbits updated this revision to Diff 13844.Sep 18 2014, 12:42 PM

Address hfinkel's comments

jhibbits updated this revision to Diff 13845.Sep 18 2014, 12:44 PM

Remove files updated in D5332.

jhibbits updated this revision to Diff 15191.Oct 21 2014, 7:58 AM

Update to use the new Module API from D5882 instead.

jhibbits updated this revision to Diff 15449.Oct 24 2014, 8:38 PM

Update the patch to only switch on 'PICLevel::Small', so that the default PIC level is large-model. This way, if no PIC level is specified in the module flags it will always default to Large-model, rather than the current undefined.

jhibbits updated this revision to Diff 15840.Nov 5 2014, 6:35 PM

Update for new "PIC Level" flag

hfinkel accepted this revision.Nov 11 2014, 12:18 AM
hfinkel edited edge metadata.

LGTM, thanks!

This revision is now accepted and ready to land.Nov 11 2014, 12:18 AM
jhibbits closed this revision.Nov 12 2014, 7:16 AM
jhibbits updated this revision to Diff 16089.

Closed by commit rL221791 (authored by @jhibbits).