diff options
author | Wouter van Oortmerssen <aardappel@gmail.com> | 2019-02-04 18:03:11 +0000 |
---|---|---|
committer | Wouter van Oortmerssen <aardappel@gmail.com> | 2019-02-04 18:03:11 +0000 |
commit | 0b3cf247c47e0ae718a5ff28195407f35f8523ac (patch) | |
tree | 24670b4f2bcff2f5a5adf8e572e41912a5f094e7 /llvm/lib/MC | |
parent | 79e33171d6aed199f08a172ac41bd39f8f3a35b4 (diff) | |
download | bcm5719-llvm-0b3cf247c47e0ae718a5ff28195407f35f8523ac.tar.gz bcm5719-llvm-0b3cf247c47e0ae718a5ff28195407f35f8523ac.zip |
[WebAssembly] Make segment/size/type directives optional in asm
Summary:
These were "boilerplate" that repeated information already present
in .functype and end_function, that needed to be repeated to Please
the particular way our object writing works, and missing them would
generate errors.
Instead, we generate the information for these automatically so the
user can concern itself with writing more canonical wasm functions
that always work as expected.
Reviewers: dschuff, sbc100
Subscribers: jgravelle-google, aheejin, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D57546
llvm-svn: 353067
Diffstat (limited to 'llvm/lib/MC')
-rw-r--r-- | llvm/lib/MC/MCParser/WasmAsmParser.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/MC/MCParser/WasmAsmParser.cpp b/llvm/lib/MC/MCParser/WasmAsmParser.cpp index d2099be9c8c..485be2285b0 100644 --- a/llvm/lib/MC/MCParser/WasmAsmParser.cpp +++ b/llvm/lib/MC/MCParser/WasmAsmParser.cpp @@ -91,8 +91,11 @@ public: Expect(AsmToken::Comma, ",") || Expect(AsmToken::At, "@") || Expect(AsmToken::EndOfStatement, "eol")) return true; - auto WS = getContext().getWasmSection(Name, SectionKind::getText()); - getStreamer().SwitchSection(WS); + // This is done automatically by the assembler for text sections currently, + // so we don't need to emit that here. This is what it would do (and may + // be needed later for other section types): + // auto WS = getContext().getWasmSection(Name, SectionKind::getText()); + // getStreamer().SwitchSection(WS); return false; } @@ -110,8 +113,10 @@ public: return true; if (Expect(AsmToken::EndOfStatement, "eol")) return true; - // MCWasmStreamer implements this. - getStreamer().emitELFSize(Sym, Expr); + // This is done automatically by the assembler for functions currently, + // so we don't need to emit that here. This is what it would do: + (void)Sym; + // getStreamer().emitELFSize(Sym, Expr); return false; } |