mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
Introduce llvm-c function LLVMPrintModuleToFile.
This lets you save the textual representation of the LLVM IR to a file. Before this patch it could only be printed to STDERR from llvm-c. Patch by Carlo Kok! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156479 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -115,6 +115,25 @@ void LLVMDumpModule(LLVMModuleRef M) {
|
||||
unwrap(M)->dump();
|
||||
}
|
||||
|
||||
LLVMBool LLVMPrintModuleToFile(LLVMModuleRef M, const char *Filename,
|
||||
char **ErrorMessage) {
|
||||
std::string error;
|
||||
raw_fd_ostream dest(Filename, error);
|
||||
if (!error.empty()) {
|
||||
*ErrorMessage = strdup(error.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
unwrap(M)->print(dest, NULL);
|
||||
|
||||
if (!error.empty()) {
|
||||
*ErrorMessage = strdup(error.c_str());
|
||||
return true;
|
||||
}
|
||||
dest.flush();
|
||||
return false;
|
||||
}
|
||||
|
||||
/*--.. Operations on inline assembler ......................................--*/
|
||||
void LLVMSetModuleInlineAsm(LLVMModuleRef M, const char *Asm) {
|
||||
unwrap(M)->setModuleInlineAsm(StringRef(Asm));
|
||||
|
Reference in New Issue
Block a user