[PATCH]: Bug 18941 : clang fails to emit S file textually

lin zuojian manjian2006 at gmail.com
Tue Mar 11 18:42:23 PDT 2014


Hi,
    here's my patch & testcase. I don't know where to put the testcase
    file.So I just drop it to the root path.



Index: lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp	(revision 203630)
+++ lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp	(working copy)
@@ -78,6 +78,11 @@
   if (isNullTerminated)
     Str = Str.substr(0, Str.size()-1);
 
+  // If the output streamer is actually a .s file, just emit the blob textually.
+  if (OutStreamer.hasRawTextSupport()) {
+     OutStreamer.EmitRawText(Str);
+     return;
+  }
   // If the output streamer does not have mature MC support or the integrated
   // assembler has been disabled, just emit the blob textually.
   // Otherwise parse the asm and emit it via MC support.
Index: test-emit-s-file.cpp
===================================================================
--- test-emit-s-file.cpp	(revision 0)
+++ test-emit-s-file.cpp	(working copy)
@@ -0,0 +1,9 @@
+// RUN: clang -S -o - %s | FileCheck %s
+void foo() {
+  // CHECK:vp8_block_coeff EQU $8
+  asm("\n"
+      "vp8_block_coeff"
+      " EQU %0"
+      :
+      : "i"(8));
+}

---
Regards
lin zuojian



More information about the llvm-commits mailing list