[llvm] r330370 - [WebAssembly] Enabled -triple=wasm32-unknown-unknown-wasm path using ELF directive parser.

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 19 15:00:53 PDT 2018


Author: sbc
Date: Thu Apr 19 15:00:53 2018
New Revision: 330370

URL: http://llvm.org/viewvc/llvm-project?rev=330370&view=rev
Log:
[WebAssembly] Enabled -triple=wasm32-unknown-unknown-wasm path using ELF directive parser.

This is a temporary solution until a proper WASM implementation of
MCAsmParserExtension is in place, but at least for now will unblock this
path.

Added test to make sure this path works with the WASM Assembler.

Patch By Wouter van Oortmerssen!

Differential Revision: https://reviews.llvm.org/D45386

Modified:
    llvm/trunk/lib/MC/MCParser/AsmParser.cpp
    llvm/trunk/test/MC/WebAssembly/basic-assembly.s

Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=330370&r1=330369&r2=330370&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Thu Apr 19 15:00:53 2018
@@ -691,7 +691,11 @@ AsmParser::AsmParser(SourceMgr &SM, MCCo
     PlatformParser.reset(createELFAsmParser());
     break;
   case MCObjectFileInfo::IsWasm:
-    llvm_unreachable("Wasm parsing not supported yet");
+    // TODO: WASM will need its own MCAsmParserExtension implementation, but
+    // for now we can re-use the ELF one, since the directives can be the
+    // same for now, and this makes the -triple=wasm32-unknown-unknown-wasm
+    // path work.
+    PlatformParser.reset(createELFAsmParser());
     break;
   }
 
@@ -1305,7 +1309,7 @@ AsmParser::applyModifierToExpr(const MCE
 /// the End argument will be filled with the last location pointed to the '>'
 /// character.
 
-/// There is a gap between the AltMacro's documentation and the single quote implementation. 
+/// There is a gap between the AltMacro's documentation and the single quote implementation.
 /// GCC does not fully support this feature and so we will not support it.
 /// TODO: Adding single quote as a string.
 bool AsmParser::isAltmacroString(SMLoc &StrLoc, SMLoc &EndLoc) {
@@ -2204,7 +2208,7 @@ bool AsmParser::parseStatement(ParseStat
 }
 
 // Parse and erase curly braces marking block start/end
-bool 
+bool
 AsmParser::parseCurlyBlockScope(SmallVectorImpl<AsmRewrite> &AsmStrRewrites) {
   // Identify curly brace marking block start/end
   if (Lexer.isNot(AsmToken::LCurly) && Lexer.isNot(AsmToken::RCurly))

Modified: llvm/trunk/test/MC/WebAssembly/basic-assembly.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/WebAssembly/basic-assembly.s?rev=330370&r1=330369&r2=330370&view=diff
==============================================================================
--- llvm/trunk/test/MC/WebAssembly/basic-assembly.s (original)
+++ llvm/trunk/test/MC/WebAssembly/basic-assembly.s Thu Apr 19 15:00:53 2018
@@ -1,4 +1,5 @@
 # RUN: llvm-mc -triple=wasm32-unknown-unknown-elf < %s | FileCheck %s
+# RUN: llvm-mc -triple=wasm32-unknown-unknown-wasm < %s | FileCheck %s
 
     .text
     .type    test0, at function




More information about the llvm-commits mailing list