Alexandre Oliva wrote:
> On Nov  7, 2007, Mark Mitchell <[EMAIL PROTECTED]> wrote:
> 
>> Until we all know what we're trying to do
> 
> Here's what I am trying to do:

I think these are laudable goals, but you didn't really provide the
information I wanted.  In particular, what I'd like to drill down from
goals (like "ensure that, for every user variable for which we emit
debug information, the information is correct") to concrete problems.

I think that most of the goals boil down to making sure that, at any
point in the program, the debug information for a variable meets the
following criteria:

(a) if the variable has not been optimized away, gives the location
where that variable's current value can be found, or
(b) if the variable has been optimized away, and the value is not a
constant, says that the value is not available, or
(c) if the variable has been optimized away, but is a constant, says
what the constant value is

Is that right?  (Note "at any point" above; it might be that the
variable is present in r0 for a while, and then optimized away, and then
present at *0xdeadbeef for a while, and then has the constant value 7.)

If so, how are you proposing to accomplish that?  It's easy enough to
design a representation (whether in the instruction stream, or on the
side) that says "from instruction A to instruction B, the value is in
this location".  So, I don't think we need to worry about that just yet.

But, how are we going to track this information?  Algorithmically, what
needs to change in the compiler to maintain this state?

For example, we need some way for an optimization pass to tell the rest
of the compiler that a variable was completely eliminated.  (Perhaps,
for example, because all uses of the variable were eliminated.)  So,
maybe we need a debug_var_eliminated API.  Then, every pass that blows
away variables can call this function, which can make whatever notations
on the VAR_DECL are required.  I'm not claiming that's the right
approach, but I'd like to understand the plan at that kind of level.

What changes will need to be made throughout the compiler to keep track
of the state?

-- 
Mark Mitchell
CodeSourcery
[EMAIL PROTECTED]
(650) 331-3385 x713

Reply via email to