title: writing module to .bc bitcode file
body: <p>i've assumed that dumping a .bc file from a module was a trivial operation, but now,
  first time i have to actually do it from code, for the life of me i
  can't find one missing step in the process:</p>
  
  <pre><code>static void WriteModule ( const Module *  M, BitstreamWriter &amp;  Stream )
  </code></pre>
  
  <p><a href="http://llvm.org/docs/doxygen/html/BitcodeWriter_8cpp.html#a828cec7a8fed9d232556420efef7ae89" rel="noreferrer">http://llvm.org/docs/doxygen/html/BitcodeWriter_8cpp.html#a828cec7a8fed9d232556420efef7ae89</a></p>
  
  <p>to write that module, first i need a BistreamWriter</p>
  
  <pre><code>BitstreamWriter::BitstreamWriter (SmallVectorImpl&lt; char &gt; &amp;O)
  </code></pre>
  
  <p><a href="http://llvm.org/docs/doxygen/html/classllvm_1_1BitstreamWriter.html" rel="noreferrer">http://llvm.org/docs/doxygen/html/classllvm_1_1BitstreamWriter.html</a></p>
  
  <p>and for a BitstreamWriter i need a SmallVectorImpl. But, what next?
  Should i write the content of the SmallVectorImpl byte by byte on a
  file handler myself? is there a llvm api for this? do i need something
  else?</p>