This is a question worth asking; it's just that not everyone can
answer all the time.
:)
If all you want to do is to follow the SSA def-use chain within a
single function, then this is very easy. All you have to do is use
the use_iterator of the Instruction object to iterate through its
def-use chain. For all uses that are instructions, use the
getParent() method to find the basic block containing the
instruction. That's it.
This approach won't work in two cases:
1) If you want to trace def/use through memory. Memory is not in
SSA form, and so you have to use extra analysis to track from which
store the result of a load originates.
2) If you want to track def/use inter-procedurally through function
arguments and return values. If you don't care about tracking
through memory, this is a fairly easy inter-procedural analysis to
do, and we have some code internally at University of Illinois that
does it. If you need it, I can talk to Vikram and see if we can
give you a copy.
For more information on how to iterate through def-use chains, see
the LLVM Programmer's Manual:
http://llvm.org/docs/ProgrammersManual.html#iterate_chains
-- John T.