From 42e1a86e8103dcfc51e685f01e0a5a90ee11f27b Mon Sep 17 00:00:00 2001 From: JF Bastien Date: Tue, 25 Aug 2015 22:23:15 +0000 Subject: [PATCH] WebAssembly: comment out .globl when printing textual assembly 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 --- .../MCTargetDesc/WebAssemblyMCAsmInfo.cpp | 5 ++++- test/CodeGen/WebAssembly/globl.ll | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 test/CodeGen/WebAssembly/globl.ll diff --git a/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCAsmInfo.cpp b/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCAsmInfo.cpp index c3ab48fd405..e8732abbbc7 100644 --- a/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCAsmInfo.cpp +++ b/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCAsmInfo.cpp @@ -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 index 00000000000..571f793e3b7 --- /dev/null +++ b/test/CodeGen/WebAssembly/globl.ll @@ -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 +} -- 2.34.1