Liveness analysis on MachineBasicBlock

Hi all,

I am trying to compute the liveness information for each MachineInstr in each MachineBasicBlock. I am not sure if it is correct. Here is how I compute the info.

For each MachineBasicBlock MBB
     compute the LiveOuts of MBB by unioning all the LiveIns of its successors
     for each MachineInstr MI = MBB->rbegin() to MBB->rend()
         compute the LiveOuts of each MI by LiveIn = Uses Union (LiveOuts - Defs)

I am not sure that the LiveIns of each MachineBasicBlock are updated during each pass.
Also, it seems that the MachineBasicBlock's at the end of a MachineFunction should include the
registers that live out of the MachineFunction, which usually are the return values through physical
registers.

Any advice will be appreciated. Thanks in advance.

~Bin