Hey Rahil,
try this:
#include "llvm/Support/raw_ostream.h"
Function* f = ...
std::string errorMessage = "";
raw_fd_ostream file("file.txt", errorMessage);
f->print(file, NULL);
file.close();
The class "Module" also has a print-function you can use to dump the
entire module.
If you want to print additional, custom information (e.g. a comment
behind each instruction), have a look at the AssemblyAnnotationWriter class.
Best,
Ralf
Am 23.08.2011 17:25, schrieb Rahil Rahimian:> hi
> how can i write IRinstruction on a file.txt? when i use
> {for(inst_iterator I = inst_begin(F), E = inst_end(F); I != E;
> ++I,count++) IRcodefile << std::basic_ostream(*I)
<<"\n" } i get error.
> is there any way that i can write it on file?
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev