[tree-ssa] reaching def. question
Devang Patel
dpatel@apple.com
Tue Mar 16 22:01:00 GMT 2004
On Mar 16, 2004, at 1:47 PM, Diego Novillo wrote:
> On Tue, 2004-03-16 at 16:39, Devang Patel wrote:
>> How do I find out reaching definitions of 'a' at statement S1?
>>
>> S1: a = b;
>>
>> What I want to know is whether S1 is defining 'a' first time
>> or killing earlier def of 'a'. compute_reaching_defs () is not
>> yet implemented. Is there any other alternative API?
>>
> compute_reaching_defs() wouldn't help you. There are no uses of 'a' in
> S1.
>
> You need to do a dominator walk and stop when you find the first
> definition. But, there can be more than one:
>
> if (...)
> a = b;
> else
> a = c;
>
> Both defs to 'a' are defininig 'a' for the "first time". Besides, in
> our current framework. Every definition is a different variable.
>
> What are you trying to solve?
during if-conversion
S1: a_1 = x;
S2: if (...)
S3: a_2 = b;
Now, to if-convert S3, I need to know if a_2 is first def. of variable
'a'
or not. Based on that info I can replace S3 with
S3: MODIFY_EXPR <a_2, COND_EXPR < c, b, a_1>>
OR
S3: MODIFY_EXPR <a_2, COND_EXPR < c, b, NULL>>
--
Devang
More information about the Gcc
mailing list