PATCH Re: [ast-optimizer-branch]: Simplify STMT_EXPR's
Jason Merrill
jason@redhat.com
Wed Jun 19 09:58:00 GMT 2002
>>>>> "Diego" == Diego Novillo <dnovillo@redhat.com> writes:
> On Wed, 19 Jun 2002, Jason Merrill wrote:
>> In this patch I haven't tried to preserve source position information for
>> inlined functions, because we don't support wrapping _STMTs in
>> EXPR_WITH_FILE_LOCATION. One obvious direction would be to support that.
>> I don't see a good way to use FILE_STMT to handle this, as we aren't
>> tracking source position during simplification. On the other hand, perhaps
>> we should be.
> But we are, after a fashion. When creating new _STMT nodes we
> set their line number from the originating statement. Would that
> suffice?
No; inlined functions are treated as coming from their point of definition,
not the call site. Anyway, I'm working on this.
>>>>> "Daniel" == Daniel Berlin <dberlin@dberlin.org> writes:
> On Wednesday, June 19, 2002, at 05:22 AM, Jason Merrill wrote:
>> Daniel's earlier patch would find the last EXPR_STMT at arbitrary depth.
>> I don't see anything in the docs or existing practice to suggest that
>> the return value can be nested further under the initial block, so I only
>> look there.
> I originally did this as well, relying on what the docs said. But IIRC,
> simplification accidently can create cases where the return value is
> nested under the initial block, and we need to handle this properly.
>[...]
> In fact, if you look at your code below, you changed it so it simplifies
> the body *after* creating the modify expression for the return value.
Yes, it's simpler that way.
> I'm not sure this doesn't screw up exactly because of the above.
> Have you checked to make sure the return value stays at the same scope
> level after we simplify the body?
No need; after we've created the modify expression, it doesn't matter where
it is, because we're not dealing with a STMT_EXPR anymore.
> We should probably add an abort if the last statement before the closing
> scope of the statement expression is now a scope end, rather than an
> executable statement (IE you have a close scope followed by a close
> scope, rather than an executable statement followed by a close scope), if
> it returns a value.
Yep, will do.
Jason
More information about the Gcc-patches
mailing list