[tree-ssa]: Easy way to get default def of a variable?
Daniel Berlin
dberlin@dberlin.org
Thu Jun 5 17:16:00 GMT 2003
On Thursday, June 5, 2003, at 12:06 PM, Andrew MacLeod wrote:
> On Thu, 2003-06-05 at 11:37, Daniel Berlin wrote:
>>
>> On Thursday, June 5, 2003, at 07:21 AM, Andrew MacLeod wrote:
>>
>>> On Thu, 2003-06-05 at 00:38, Daniel Berlin wrote:
>>>>>>
>>>>>>
>>>>> We now connect them to empty_stmt_expr. Do you want to connect
>>>>> them
>>>>> to
>>>>> this table so that we can traverse that table to look for live-
>>>>> on-entry
>>>>> or uninitialized uses? I guess we could do that.
>>>>
>>>> Well, remember, i want the table because right now i have to take a
>>>> use, and walk the entire def chain backwards, to get the default
>>>> def's
>>>> version.
>>>> This is expensive.
>>>>
>>>
>>> Out of curiosity, why do you need the default def? ie, why do you
>>> care
>>> that a_2 is live on entry when you have a_4 = a_3 + 2, and a_3 has a
>>> def?
>>
>> There are cases where we need to insert *before* the first "real"
>> definition of a variable.
>> They are the odd corner case, but it happens.
>> One is when we move things out of loops, need to generate a save
>> before
>> the beginning of the loop, and the only definition (of one of the
>> variables in our expression) on entry to the loop is the default one
>> coming from a function argument.
>> To insert the save before the loop, we need the default def (of that
>> variable).
>
>
> If your variable is a_5, and its live on entry to the loop, ie, having
> no DEF, couldn't you issue the save as
> pretmp_99 = a_5
> and say to heck with the def?
I don't know it's a_5, that's the problem.
Let me be more concrete:
In this case, we generate saves where we see expression phi operands
that have no actual occurrence associated with them yet (IE they need a
real expression save to back them up, but a usable one isn't there
already).
Thus, I need to figure out what version to use in the save.
We do this by walking up the dominator tree, looking for the closest
reaching def of the variable.
If there is none, after hitting the entry block, it must be live on
entry, and i need the default def.
>
> Andrew
>
More information about the Gcc
mailing list