This is an archive of the discontinued LLVM Phabricator instance.

[llgo] irgen: modify the ABI to use init guards instead of priority
ClosedPublic

Authored by pcc on Dec 29 2014, 3:23 PM.

Details

Summary

The new ABI is simpler for use cases such as dynamically loaded packages.

The calling convention for import functions is similar to what go/ssa would
produce if BareInits were cleared. However, simply clearing this flag causes
two additional issues:

  1. We would need to special case the 'init$guard' variable (see discussion in https://codereview.appspot.com/78780043/).
  2. The call to __go_register_gc_roots needs to appear in the right place, i.e. after the guard check. Making this check appear in the right place with non-bare inits seems unreliable at best.

So we keep BareInits set and generate the necessary code manually.

It is still possible to get the old ABI by specifying a path to a gccgo
installation.

Diff Detail

Repository
rL LLVM

Event Timeline

pcc updated this revision to Diff 17689.Dec 29 2014, 3:23 PM
pcc retitled this revision from to [llgo] irgen: modify the ABI to use init guards instead of priority.
pcc updated this object.
pcc edited the test plan for this revision. (Show Details)
pcc added a reviewer: axw.
pcc added a subscriber: Unknown Object (MLST).
axw accepted this revision.Dec 29 2014, 4:50 PM
axw edited edge metadata.
axw added inline comments.
irgen/ssa.go
429 ↗(On Diff #17689)

Would you mind moving this code to a separate function? defineFunction is getting a bit long.

This revision is now accepted and ready to land.Dec 29 2014, 4:50 PM
pcc added inline comments.Dec 30 2014, 4:26 PM
irgen/ssa.go
429 ↗(On Diff #17689)

Done.

This revision was automatically updated to reflect the committed changes.