title: How do I print out an Instruction in LLVM?
body: <pre><code>for (BasicBlock::iterator i = bb-&gt;begin(), e = bb-&gt;end(); i != e; ++i) {
      i.print(errs()); ???
  </code></pre>
  
  <p>I am writing an <strong>LLVM PASS</strong> and I want to get the list of instructions inside the basic block, but how do print them out on the console so I can see them? The code above shows the code i have tried, it iterates through every instruction in the basic block but I get the error below for the print function.</p>
  
  <blockquote>
    <p>error: ‘llvm::BasicBlock::iterator’ has no member named ‘print’
        i.print(errs());</p>
  </blockquote>
  
  <p>Is there a better approach to printing out instructions?</p>