aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp28
1 files changed, 21 insertions, 7 deletions
diff --git a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
index 1045160..f693ef3 100644
--- a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
+++ b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
@@ -276,7 +276,18 @@ public:
: MCTargetAsmParser(Options, STI, MII), Parser(Parser),
Lexer(Parser.getLexer()), Is64(STI.getTargetTriple().isArch64Bit()),
TC(Parser, MII, Is64), SkipTypeCheck(Options.MCNoTypeCheck) {
- setAvailableFeatures(ComputeAvailableFeatures(STI.getFeatureBits()));
+ FeatureBitset FBS = ComputeAvailableFeatures(STI.getFeatureBits());
+
+ // bulk-memory implies bulk-memory-opt
+ if (FBS.test(WebAssembly::FeatureBulkMemory)) {
+ FBS.set(WebAssembly::FeatureBulkMemoryOpt);
+ }
+ // reference-types implies call-indirect-overlong
+ if (FBS.test(WebAssembly::FeatureReferenceTypes)) {
+ FBS.set(WebAssembly::FeatureCallIndirectOverlong);
+ }
+
+ setAvailableFeatures(FBS);
// Don't type check if this is inline asm, since that is a naked sequence of
// instructions without a function/locals decl.
auto &SM = Parser.getSourceManager();
@@ -291,7 +302,8 @@ public:
DefaultFunctionTable = getOrCreateFunctionTableSymbol(
getContext(), "__indirect_function_table", Is64);
- if (!STI->checkFeatures("+reference-types"))
+ if (!STI->checkFeatures("+call-indirect-overlong") &&
+ !STI->checkFeatures("+reference-types"))
DefaultFunctionTable->setOmitFromLinkingSection();
}
@@ -531,11 +543,13 @@ public:
}
bool parseFunctionTableOperand(std::unique_ptr<WebAssemblyOperand> *Op) {
- if (STI->checkFeatures("+reference-types")) {
- // If the reference-types feature is enabled, there is an explicit table
- // operand. To allow the same assembly to be compiled with or without
- // reference types, we allow the operand to be omitted, in which case we
- // default to __indirect_function_table.
+ if (STI->checkFeatures("+call-indirect-overlong") ||
+ STI->checkFeatures("+reference-types")) {
+ // If the call-indirect-overlong feature is enabled, or implied by the
+ // reference-types feature, there is an explicit table operand. To allow
+ // the same assembly to be compiled with or without
+ // call-indirect-overlong, we allow the operand to be omitted, in which
+ // case we default to __indirect_function_table.
auto &Tok = Lexer.getTok();
if (Tok.is(AsmToken::Identifier)) {
auto *Sym =