diff options
| author | Chris Lattner <sabre@nondot.org> | 2006-01-24 00:45:30 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2006-01-24 00:45:30 +0000 |
| commit | efaf35d52acc7cb36d79abbdbf8cf378594e0d4c (patch) | |
| tree | 5556c00dd71602b7a42309c68b9f683c7e26e385 | |
| parent | 3acaf5cb1162f06eb9e3af44254f69f1066d46b3 (diff) | |
| download | bcm5719-llvm-efaf35d52acc7cb36d79abbdbf8cf378594e0d4c.tar.gz bcm5719-llvm-efaf35d52acc7cb36d79abbdbf8cf378594e0d4c.zip | |
Pretty print file-scope asm blocks.
llvm-svn: 25568
| -rw-r--r-- | llvm/lib/VMCore/AsmWriter.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp index d66497aed6a..d0b8478f24c 100644 --- a/llvm/lib/VMCore/AsmWriter.cpp +++ b/llvm/lib/VMCore/AsmWriter.cpp @@ -776,8 +776,22 @@ void AssemblyWriter::printModule(const Module *M) { Out << "target triple = \"" << M->getTargetTriple() << "\"\n"; if (!M->getInlineAsm().empty()) { + // Split the string into lines, to make it easier to read the .ll file. + std::string Asm = M->getInlineAsm(); + size_t CurPos = 0; + size_t NewLine = Asm.find_first_of('\n', CurPos); + while (NewLine != std::string::npos) { + // We found a newline, print the portion of the asm string from the + // last newline up to this newline. + Out << "module asm \""; + PrintEscapedString(std::string(Asm.begin()+CurPos, Asm.begin()+NewLine), + Out); + Out << "\"\n"; + CurPos = NewLine+1; + NewLine = Asm.find_first_of('\n', CurPos); + } Out << "module asm \""; - PrintEscapedString(M->getInlineAsm(), Out); + PrintEscapedString(std::string(Asm.begin()+CurPos, Asm.end()), Out); Out << "\"\n"; } |

