[PATCH] -fms-extensions: Implement half of #pragma init_seg
Aaron Ballman
aaron at aaronballman.com
Thu Jul 17 05:28:37 PDT 2014
On Wed, Jul 16, 2014 at 8:47 PM, Reid Kleckner <rnk at google.com> wrote:
> Hi rsmith, majnemer,
>
> 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.
>
> + assert(SegmentName->getCharByteWidth() == 1 &&
> + "only C strings are accepted here");
Please do not assert here -- this should be an error instead.
I'd like to see some parser test cases for the situation where
something other than a string literal is given to the pragma. A test
using a wide string literal would also be good.
~Aaron
More information about the cfe-commits
mailing list