[LLVMdev] LiveIntervals::handlePhysicalRegisterDef, unreachable MBBs

Vladimir Prus ghost at cs.msu.su
Fri Jul 9 05:06:01 PDT 2004

I've just spend some time looking at the above function, and while I 
understood what it does, a comment would have helped a lot.

Maybe, something like:

// Determine the end of the live interval for this register
// For physical register, all internvals are within basic blocks so
// we look for the instruction in this basic block which last uses it.

The first loop might have a comment like:

// If the register is dead at instruction which sets it (i.e. not used later)
// the live interval ends at the next instruction

The second loop might have a comment like:

// If the register is not dead at the defining instruction, it must be used
// and killed by some subsequent instruction. Find that instruction now, which
// always exists

Finally, why I've started all this. I forgot to add machine CFG edge and got 
misterious crash. I've applied the attached patch, which checks that all 
basic blocks are reachable from function entry. Any comments on:

- whether this check is reasonable?
- what's the right place for the check? LiveVariables.cpp is the simplest I 
could find, but does not seem right.

- Volodya

-------------- next part --------------
A non-text attachment was scrubbed...
Name: LiveVariables.diff
Type: text/x-diff
Size: 608 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20040709/e0fcec25/attachment.diff>

More information about the llvm-dev mailing list