summaryrefslogtreecommitdiffstats
path: root/llvm/utils
diff options
context:
space:
mode:
authorWouter van Oortmerssen <aardappel@gmail.com>2018-09-21 17:47:58 +0000
committerWouter van Oortmerssen <aardappel@gmail.com>2018-09-21 17:47:58 +0000
commit7beaa30e4e95eef2f1c1d23d21c45b7a159912f4 (patch)
tree87384f1cf5c51ff4736d786941d5a5b46f39265f /llvm/utils
parent2eeb0489054888b580f4b0ccf54e2df34c4a91d9 (diff)
downloadbcm5719-llvm-7beaa30e4e95eef2f1c1d23d21c45b7a159912f4.tar.gz
bcm5719-llvm-7beaa30e4e95eef2f1c1d23d21c45b7a159912f4.zip
[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 llvm-svn: 342753
Diffstat (limited to 'llvm/utils')
-rw-r--r--llvm/utils/TableGen/AsmMatcherEmitter.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
index e808661b7a5..a0283fc8017 100644
--- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp
+++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
@@ -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);
OpenPOWER on IntegriCloud