LLVM instruction as a string

Hi, I am trying to get a llvm IR instruction as a string. How can this be done?
Also, is there a way to know of the mapping of program variables to llvm registers?

As far as the first question, using operator << on the instruction should print it, the LHS needs to be a raw_ostream.