[llvm] r342753 - [WebAssembly] Made assembler only use stack instruction tablegen defs
Wouter van Oortmerssen via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 21 10:47:58 PDT 2018
Author: aardappel
Date: Fri Sep 21 10:47:58 2018
New Revision: 342753
URL: http://llvm.org/viewvc/llvm-project?rev=342753&view=rev
Log:
[WebAssembly] Made assembler only use stack instruction tablegen defs
Summary:
This ensures we have the non-register version of the instruction.
The stack version of call_indirect now wants a type index argument,
so that has been added in the existing tests.
Tested:
llvm-lit -v `find test -name WebAssembly`
Reviewers: dschuff
Subscribers: sbc100, jgravelle-google, aheejin, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D51662
Modified:
llvm/trunk/test/MC/WebAssembly/basic-assembly.s
llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
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=342753&r1=342752&r2=342753&view=diff
==============================================================================
--- llvm/trunk/test/MC/WebAssembly/basic-assembly.s (original)
+++ llvm/trunk/test/MC/WebAssembly/basic-assembly.s Fri Sep 21 10:47:58 2018
@@ -29,7 +29,7 @@ test0:
i64.const 1234
i32.call something2 at FUNCTION
i32.const 0
- call_indirect
+ call_indirect 0
i32.const 1
i32.add
tee_local 0
@@ -68,7 +68,7 @@ test0:
# CHECK-NEXT: i64.const 1234
# CHECK-NEXT: i32.call something2 at FUNCTION
# CHECK-NEXT: i32.const 0
-# CHECK-NEXT: call_indirect
+# CHECK-NEXT: call_indirect 0
# CHECK-NEXT: i32.const 1
# CHECK-NEXT: i32.add
# CHECK-NEXT: tee_local 0
Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=342753&r1=342752&r2=342753&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Fri Sep 21 10:47:58 2018
@@ -1479,6 +1479,8 @@ void AsmMatcherInfo::buildInfo() {
bool ReportMultipleNearMisses =
AsmParser->getValueAsBit("ReportMultipleNearMisses");
+ bool IsWebAssemblyTarget = Target.getName() == "WebAssembly";
+
// Parse the instructions; we need to do this first so that we can gather the
// singleton register classes.
SmallPtrSet<Record*, 16> SingletonRegisters;
@@ -1514,6 +1516,14 @@ void AsmMatcherInfo::buildInfo() {
if (!V.empty() && V != Variant.Name)
continue;
+ // [WebAssembly] Ignore non-stack instructions.
+ if (IsWebAssemblyTarget) {
+ auto Bit = CGI->TheDef->getValue("StackBased")->getValue()->
+ getCastTo(BitRecTy::get());
+ if (!Bit || !reinterpret_cast<const BitInit *>(Bit)->getValue())
+ continue;
+ }
+
auto II = llvm::make_unique<MatchableInfo>(*CGI);
II->initialize(*this, SingletonRegisters, Variant, HasMnemonicFirst);
More information about the llvm-commits
mailing list