Emit the llvm-ir bytecode from my llvm pass

Hi,

Is there anyway to emit the llvm-ir bytecode from inside my pass, into a file? I want the same format that I am getting by using the opt tool, so I can pass this file to the opt later.

Kind Regards,
Kyriakos

You can use the llvm::WriteBitcodeToFile function.

Eli