[LLVMdev] How to recognize the declaring code scopes of stack variables
David Blaikie
dblaikie at gmail.com
Thu Jul 11 20:23:42 PDT 2013
On Thu, Jul 11, 2013 at 8:19 PM, Eric Lu <eirc.lew at gmail.com> wrote:
> When parallelize the loop with OpenMP like models, I need to know what
> variables will be shared among different threads.
I imagined you'd want to recognize loops, not scopes. Sounds like a
backend kind of optimization type thing, just detecting values that
don't escape the loop. (this would catch cases where a variable is
declared outside the loop but never actually used in such a way, eg:
int i;
for (...) {
i = ...;
...
}
// no use of 'i' here
> So I want to know whether they are declared in loop scopes.
>
>
> On Fri, Jul 12, 2013 at 10:57 AM, David Blaikie <dblaikie at gmail.com> wrote:
>>
>> Clang can/now emits lifetime intrinsics to mark this information, I
>> believe - but I'm not sure if they'll suit your needs.
>>
>> What are you trying to do with this information?
>>
>> On Thu, Jul 11, 2013 at 7:45 PM, Eric Lu <eirc.lew at gmail.com> wrote:
>> > Hi,
>> >
>> > If I want to know where the stack variables are declared? For example,
>> > whether it is declared within a loop or not? Like variables a[100] and
>> > temp.
>> >
>> > int a[100];
>> > for( int i = 0; i < N; i++){
>> > int temp;
>> > }
>> >
>> > Can this be done in LLVM IR? Or should be implemented in Clang.
>> >
>> >
>> > Thanks!
>> >
>> >
>> > Eric
>> >
>> > _______________________________________________
>> > LLVM Developers mailing list
>> > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>> >
>
>
More information about the llvm-dev
mailing list