ruby-llvm/ruby-llvm — pull request #8 by ishikawa (2013-01-13 02:49:57+00:00)
Title: Add LLVM::Module#print(fd_or_io_object, should_close=false, unbuffered=false)

It can be used to write the module IR to a (temp)file.

```ruby
mod = LLVM::Module.new('test_print')
...
f = Tempfile.new('test_print')
mod.print(f)
File.read(f) # => IR code
```

The C wrapper function `LLVMPrintModuleToFD(...)` is also added in `ext/ruby-llvm-support/support.cpp` which just calls C++ [llvm::Module::print(raw_ostream &, AssemblyAnnotationWriter *)](http://llvm.org/docs/doxygen/html/classllvm_1_1Module.html#aa711d8571cb8212a7693fd4465719c31).