Profiling - basic block execution frequencies

I've read some small amounts of documentation including the Doxygen
docs on the LLVM Profiling capabilities. I'm looking to extract basic
block execution frequencies (I just need relative values within a
function) in to a simplified custom format for my work (research in to
instruction selection). The API seems geared more towards the use of
profiling data in LLVM Passes and I was wondering if anyone could just
give me a brief overview or point me in the direction of the right
part of the docs on how to easily generate profiling data and use C++
to interact with it and get what I need.

Thanks for your time and a great tool,
David Blaikie

Check out the code in tools/llvm-prof. llvm-prof is a thin wrapper around the profiling APIs the loads the data and prints it out for human consumption. From this you can figure out the APIs and convert it to whatever interface you'd like.