This is an archive of the discontinued LLVM Phabricator instance.

-fms-extensions: Implement half of #pragma init_seg
ClosedPublic

Authored by rnk on Jul 16 2014, 5:47 PM.

Details

Summary

This pragma is very rare. We could *hypothetically* lower some uses of
it down to @llvm.global_ctors, but given that GlobalOpt isn't able to
optimize prioritized global ctors today, there's really no point.

If we wanted to do this in the future, I would check if the section used
in the pragma started with ".CRT$XC" and had up to two characters after
it. Those two characters could form the 16-bit initialization priority
that we support in @llvm.global_ctors. We would have to teach LLVM to
lower prioritized global ctors on COFF as well.

This should let us compile some silly uses of this pragma in WebKit /
Blink.

Diff Detail

Repository
rL LLVM

Event Timeline

rnk updated this revision to Diff 11547.Jul 16 2014, 5:47 PM
rnk retitled this revision from to -fms-extensions: Implement half of #pragma init_seg.
rnk updated this object.
rnk added reviewers: rsmith, majnemer.
rnk added a subscriber: Unknown Object (MLST).
thakis added a subscriber: thakis.Jul 16 2014, 7:22 PM
thakis added inline comments.
include/clang/Basic/AttrDocs.td
44 ↗(On Diff #11547)

typo vailable

majnemer edited edge metadata.Jul 16 2014, 9:23 PM

Could you add a declspec(thread) testcase?

lib/CodeGen/CGDeclCXX.cpp
276 ↗(On Diff #11547)

... lowered down to a single-member ...

rnk updated this revision to Diff 11622.Jul 17 2014, 6:09 PM
rnk edited edge metadata.
  • Make pragma parsing more robust
rnk closed this revision.Jul 21 2014, 6:02 PM
rnk updated this revision to Diff 11732.

Closed by commit rL213593 (authored by @rnk).