[patch] Add discriminators to DWARF line table
Daniel Jacobowitz
drow@false.org
Wed Apr 22 04:19:00 GMT 2009
On Tue, Apr 21, 2009 at 04:16:00PM -0700, Cary Coutant wrote:
> This patch adds a discriminator field to the basic block structure,
> and assigns discriminators during gimplification. Whenever we add an
> edge between two basic blocks where the end of the "from" block and
> the entry of the "to" block have the same source position, we assign a
> new discriminator to the "to" block. This value gets picked up at the
> end of the compilation and added to the .loc directive in the assembly
> output. I've added a configure check to make sure that discriminator
> support is available in the target assembler.
Why is this only necessary when the edge source and destination are
part of the same line? Imagine a conditional branch on line 5:
line 5 -> line 6 first half -> line 7
line 5 -> line 6 second half -> line 7
If we don't discriminate between the two 'line 6' blocks, then
profiling won't tell us which edge was taken out of line 5. I
don't have a straightforward C example, but I'm sure one could be
constructed given optimization. Perhaps:
x = (y > 0);
j = x ? foo () : bar ();
done ();
Anyway, you get the picture.
--
Daniel Jacobowitz
CodeSourcery
More information about the Gcc-patches
mailing list