[LLVMdev] Support for per-loop pragma

Junjie Gu jgu222 at gmail.com
Wed Jun 2 14:07:22 PDT 2010


If LLVM would like to support OpenMP pragma in the future,  not sure
if attaching metadata to instructions is still a good choice.

Junjie

On Wed, Jun 2, 2010 at 11:08 AM, Junjie Gu <jgu222 at gmail.com> wrote:
> Thanks for comments/suggestions.
>
> Yes, attaching metadata to instructions will be good choices for many
> cases. But for loops,
> attaching metadata to back-edges requires that the front end to build
> loops, which is an
> additional task for the front end. And this task is really a backend's
> job, not the front end's.
>
> If the only concern is that it is hard for pragma intrinsics to stay
> with their associated code,
> another choice is to process pragma intrinsic at the beginning of
> optimizer and associates
> them to instructions by either attaching metadata to instructions and
> some kind maps (between
> instructions/BB to metadata, etc).
>
> Junjie
>
> On Wed, Jun 2, 2010 at 9:48 AM, Devang Patel <devang.patel at gmail.com> wrote:
>> On Tue, Jun 1, 2010 at 5:42 PM, Junjie Gu <jgu222 at gmail.com> wrote:
>>> Any suggestions/ideas ?
>>
>> IIUC, Chris suggested something like following ...
>>
>> header:
>>  br i1 %x, label %then, %label endif
>> then:
>>  ...
>>  br i1 %y, label %loop_exit, label %header, !loop_pragma !1
>> endif:
>>  ...
>>  br i1 %z, label %loop_exit, label %header, !loop_pragma !2
>> loop_exit:
>>  ret i32 1
>>
>>
>> Where !1 and !2 are the metadata for your loop pragma.
>>
>> -
>> Devang
>>
>




More information about the llvm-dev mailing list