This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: scheduling vs lexical scopes
- From: Jason Merrill <jason at redhat dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 28 Dec 2001 21:52:11 +0000
- Subject: Re: scheduling vs lexical scopes
- References: <20011227151618.A31660@redhat.com>
>>>>> "Richard" == Richard Henderson <rth@redhat.com> writes:
> The reason the origin doesn't have a die is that the origin was never
> emitted. It wasn't emitted because the lexical block containing the
> origin was removed. The lexical block was removed because (1) if-conversion
> managed to transform this function into a single basic block and
> (2) scheduling doesn't know what to do with BLOCK_BEG/END notes,
> and so re-emits them _all_ at the beginning of the block and (3)
> remove_unnecessary_notes removes lexical blocks that contain no
> real instructions.
The fix for this is to emit the abstract function before any optimization
is done. That's what debug_hooks->outlining_inline_function is for. I
suppose we need to add such a call to expand_body if the function is
inline. Does the attached untested patch do the trick?
> Now, I also consider it a Bad Thing that any time scheduling is
> enabled for a function that has one basic block, we'll never be
> able to see any local variables.
Yes. This has annoyed me for a while.
> Solving this problem for real is hard. We'd have to remember
> which instruction belonged to which lexical block, then regenerate
> a modified block tree based on the final schedule. For extra
> points, figure out which instructions make no visible changes
> to user variables and consider them part of no lexical block
> so that scheduling is less likely to fragment a lexical block
> into thousands of little pieces.
The block tree wouldn't necessarily need to change; dwarf3 supports
discontiguous ranges.
Handling the trivial case should be a big improvement, though.
Jason
*** c-decl.c.~1~ Sat Dec 8 04:19:07 2001
--- c-decl.c Fri Dec 28 21:51:23 2001
*************** c_expand_body (fndecl, nested_p, can_def
*** 6918,6923 ****
--- 6918,6928 ----
timevar_push (TV_EXPAND);
+ if (DECL_INLINE (fn))
+ /* Do any preparation such as emitting abstract debug info for the
+ inline before it gets mangled by optimization. */
+ (*debug_hooks->outlining_inline_function) (fndecl);
+
if (nested_p)
{
/* Make sure that we will evaluate variable-sized types involved
*** cp/semantics.c.~1~ Tue Dec 18 13:26:10 2001
--- cp/semantics.c Fri Dec 28 21:44:28 2001
*************** expand_body (fn)
*** 2506,2511 ****
--- 2506,2516 ----
recorded when we finished processing the function. */
lineno = STMT_LINENO (DECL_SAVED_TREE (fn));
+ if (DECL_INLINE (fn))
+ /* Do any preparation such as emitting abstract debug info for the
+ inline before it gets mangled by optimization. */
+ (*debug_hooks->outlining_inline_function) (fndecl);
+
/* Generate code for the function. */
genrtl_finish_function (fn);