i64.const 1234
i32.call something2@FUNCTION
i32.const 0
- call_indirect
+ call_indirect 0
i32.const 1
i32.add
tee_local 0
# CHECK-NEXT: i64.const 1234
# CHECK-NEXT: i32.call something2@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
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;
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);