This change preserves the original algorithm of generating history
for user variables, but makes it more clear.
High-level description of algorithm:
Scan all the machine basic blocks and machine instructions in the order
they are emitted to the object file. Do the following:
- If we see a DBG_VALUE instruction, add it to the history of the
corresponding user variable. Keep track of all user variables, whose
locations are described by a register.
- If we see a regular instruction, look at all the registers it clobbers,
and terminate the location range for all variables described by these registers.
- At the end of the basic block, terminate location ranges for all
user variables described by some register.
(3) is too restrictive, and may result in a poor debug info.
For example, the variable location can be described by %rsp, or any other
register which is never clobbered in a function. I think that handling
this special case may improve situation for many real-life programs and
plan to address this in future commits.