[llvm] r342772 - [WebAssembly] Simplified selecting asmmatcher stack instructions.
Wouter van Oortmerssen via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 21 13:53:55 PDT 2018
Author: aardappel
Date: Fri Sep 21 13:53:55 2018
New Revision: 342772
URL: http://llvm.org/viewvc/llvm-project?rev=342772&view=rev
Log:
[WebAssembly] Simplified selecting asmmatcher stack instructions.
Summary:
By using the existing isCodeGenOnly bit in the tablegen defs, as
suggested by tlively in https://reviews.llvm.org/D51662
Tested: llvm-lit -v `find test -name WebAssembly`
Reviewers: tlively
Subscribers: dschuff, sbc100, jgravelle-google, aheejin, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D52373
Modified:
llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrControl.td
llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrFormats.td
llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrControl.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrControl.td?rev=342772&r1=342771&r2=342772&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrControl.td (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrControl.td Fri Sep 21 13:53:55 2018
@@ -47,6 +47,7 @@ let Defs = [ARGUMENTS] in {
// FIXME: this can't inherit from I<> since there is no way to inherit from a
// multiclass and still have the let statements.
let isTerminator = 1, hasCtrlDep = 1, isBarrier = 1 in {
+let isCodeGenOnly = 1 in
def BR_TABLE_I32 : NI<(outs), (ins I32:$index, variable_ops),
[(WebAssemblybr_table I32:$index)], 0,
"br_table \t$index", 0x0e> {
@@ -59,6 +60,7 @@ def BR_TABLE_I32_S : NI<(outs), (ins var
let TSFlags{0} = 1;
let TSFlags{1} = 1;
}
+let isCodeGenOnly = 1 in
def BR_TABLE_I64 : NI<(outs), (ins I64:$index, variable_ops),
[(WebAssemblybr_table I64:$index)], 0,
"br_table \t$index"> {
Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrFormats.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrFormats.td?rev=342772&r1=342771&r2=342772&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrFormats.td (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrFormats.td Fri Sep 21 13:53:55 2018
@@ -48,6 +48,7 @@ class NI<dag oops, dag iops, list<dag> p
multiclass I<dag oops_r, dag iops_r, dag oops_s, dag iops_s,
list<dag> pattern_r, string asmstr_r = "", string asmstr_s = "",
bits<32> inst = -1> {
+ let isCodeGenOnly = 1 in
def "" : NI<oops_r, iops_r, pattern_r, 0, asmstr_r, inst>;
def _S : NI<oops_s, iops_s, [], 1, asmstr_s, inst>;
}
Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=342772&r1=342771&r2=342772&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Fri Sep 21 13:53:55 2018
@@ -1479,8 +1479,6 @@ 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;
@@ -1516,14 +1514,6 @@ 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