WebAssembly: comment out .globl when printing textual assembly
authorJF Bastien <jfb@google.com>
Tue, 25 Aug 2015 22:23:15 +0000 (22:23 +0000)
committerJF Bastien <jfb@google.com>
Tue, 25 Aug 2015 22:23:15 +0000 (22:23 +0000)
Do the same for .weak (not implemented for now, but may as well to it). Update comment string to two semicolons.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245982 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCAsmInfo.cpp
test/CodeGen/WebAssembly/globl.ll [new file with mode: 0644]

index c3ab48fd405555bccc463c578e3c7e19efc15013..e8732abbbc759b9ffb854319b9eb9272b40670e4 100644 (file)
@@ -28,7 +28,7 @@ WebAssemblyMCAsmInfo::WebAssemblyMCAsmInfo(const Triple &T) {
   // TODO: What should MaxInstLength be?
 
   // The s-expression format of WebAssembly uses LISP-style comments.
-  CommentString = ";";
+  CommentString = ";;";
 
   PrivateGlobalPrefix = "";
   PrivateLabelPrefix = "";
@@ -52,5 +52,8 @@ WebAssemblyMCAsmInfo::WebAssemblyMCAsmInfo(const Triple &T) {
   // For now, WebAssembly does not support exceptions.
   ExceptionsType = ExceptionHandling::None;
 
+  WeakDirective = "\t;; .weak\t";
+  GlobalDirective = "\t;; .globl\t";
+
   // TODO: UseIntegratedAssembler?
 }
diff --git a/test/CodeGen/WebAssembly/globl.ll b/test/CodeGen/WebAssembly/globl.ll
new file mode 100644 (file)
index 0000000..571f793
--- /dev/null
@@ -0,0 +1,14 @@
+; RUN: llc < %s -asm-verbose=false | FileCheck %s
+
+; Test that the `.globl` directive is commented out.
+
+target datalayout = "e-p:32:32-i64:64-v128:8:128-n32:64-S128"
+target triple = "wasm32-unknown-unknown"
+
+; CHECK-NOT: globl
+; CHECK: ;; .globl foo
+; CHECK-NOT: globl
+; CHECK-LABEL: foo:
+define void @foo() {
+  ret void
+}