[cfe-dev] Define new pragma in Clang
Alex
xinfinity_a at yahoo.com
Sat Dec 12 15:13:13 PST 2009
Daniel Dunbar <daniel at ...> writes:
> What exactly are you having trouble with? Generally the pragma parser
> just handles the parsing logic of the pragma, and then calls a handler
> in Sema which will mark some information in the AST (for example,
> adding an attribute or setting a bit in the decl).
>
> - Daniel
>
> > What I want is to have a pragma in the *.cpp file:
> >
> > #pragma optimizeLoop
> > for(int i=0 ....)
> >
> > and to obtain the LLVM IR in the *.ll file:
> >
> > bb1:
> > %0 = load i32* %i, align 4, !pragma !0
> > ...
> >
> >
> > !0 = metadata !{metadata !"optimizeLoop"}
My question is how can I attach the pragma to the following 'for' loop? What
should I set in the AST such that I can translate it in the metadata in the LLVM
IR?
Thank you.
More information about the cfe-dev
mailing list