Skip to content

Commit 33a6fd3

Browse files
committed
call-indirect-overlong is implied by reference-types.
1 parent 0d6cedc commit 33a6fd3

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,8 @@ class WebAssemblyAsmParser final : public MCTargetAsmParser {
292292

293293
DefaultFunctionTable = getOrCreateFunctionTableSymbol(
294294
getContext(), "__indirect_function_table", Is64);
295-
if (!STI->checkFeatures("+call-indirect-overlong"))
295+
if (!STI->checkFeatures("+call-indirect-overlong") &&
296+
!STI->checkFeatures("+reference-types"))
296297
DefaultFunctionTable->setOmitFromLinkingSection();
297298
}
298299

@@ -532,11 +533,13 @@ class WebAssemblyAsmParser final : public MCTargetAsmParser {
532533
}
533534

534535
bool parseFunctionTableOperand(std::unique_ptr<WebAssemblyOperand> *Op) {
535-
if (STI->checkFeatures("+call-indirect-overlong")) {
536-
// If the call-indirect-overlong feature is enabled, there is an explicit
537-
// table operand. To allow the same assembly to be compiled with or
538-
// without call-indirect overlong, we allow the operand to be omitted, in
539-
// which case we default to __indirect_function_table.
536+
if (STI->checkFeatures("+call-indirect-overlong") ||
537+
STI->checkFeatures("+reference-types")) {
538+
// If the call-indirect-overlong feature is enabled, or implied by the
539+
// reference-types feature, there is an explicit table operand. To allow
540+
// the same assembly to be compiled with or without
541+
// call-indirect-overlong, we allow the operand to be omitted, in which
542+
// case we default to __indirect_function_table.
540543
auto &Tok = Lexer.getTok();
541544
if (Tok.is(AsmToken::Identifier)) {
542545
auto *Sym =

llvm/lib/Target/WebAssembly/WebAssembly.td

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,10 @@ def : ProcessorModel<"mvp", NoSchedModel, []>;
122122
// consideration given to available support in relevant engines and tools, and
123123
// the importance of the features.
124124
def : ProcessorModel<"generic", NoSchedModel,
125-
[FeatureBulkMemory, FeatureMultivalue,
126-
FeatureMutableGlobals, FeatureNontrappingFPToInt,
127-
FeatureReferenceTypes, FeatureSignExt]>;
125+
[FeatureBulkMemory, FeatureBulkMemoryOpt,
126+
FeatureMultivalue, FeatureMutableGlobals,
127+
FeatureNontrappingFPToInt, FeatureReferenceTypes,
128+
FeatureCallIndirectOverlong, FeatureSignExt]>;
128129

129130
def : ProcessorModel<"trail1", NoSchedModel,
130131
[FeatureMultivalue, FeatureMutableGlobals,
@@ -134,13 +135,13 @@ def : ProcessorModel<"trail1", NoSchedModel,
134135

135136
// Latest and greatest experimental version of WebAssembly. Bugs included!
136137
def : ProcessorModel<"bleeding-edge", NoSchedModel,
137-
[FeatureAtomics, FeatureBulkMemory,
138+
[FeatureAtomics, FeatureBulkMemory, FeatureBulkMemoryOpt,
138139
FeatureExceptionHandling, FeatureExtendedConst,
139140
FeatureFP16, FeatureMultiMemory,
140141
FeatureMultivalue, FeatureMutableGlobals,
141142
FeatureNontrappingFPToInt, FeatureRelaxedSIMD,
142-
FeatureReferenceTypes, FeatureSIMD128, FeatureSignExt,
143-
FeatureTailCall]>;
143+
FeatureReferenceTypes, FeatureCallIndirectOverlong,
144+
FeatureSIMD128, FeatureSignExt, FeatureTailCall]>;
144145

145146
//===----------------------------------------------------------------------===//
146147
// Target Declaration

llvm/lib/Target/WebAssembly/WebAssemblySubtarget.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class WebAssemblySubtarget final : public WebAssemblyGenSubtargetInfo {
9797
bool hasAddr64() const { return TargetTriple.isArch64Bit(); }
9898
bool hasAtomics() const { return HasAtomics; }
9999
bool hasBulkMemory() const { return HasBulkMemory; }
100-
bool hasBulkMemoryOpt() const { return HasBulkMemoryOpt; }
100+
bool hasBulkMemoryOpt() const { return HasBulkMemoryOpt || HasBulkMemory; }
101101
bool hasExceptionHandling() const { return HasExceptionHandling; }
102102
bool hasExtendedConst() const { return HasExtendedConst; }
103103
bool hasFP16() const { return HasFP16; }
@@ -106,7 +106,7 @@ class WebAssemblySubtarget final : public WebAssemblyGenSubtargetInfo {
106106
bool hasMutableGlobals() const { return HasMutableGlobals; }
107107
bool hasNontrappingFPToInt() const { return HasNontrappingFPToInt; }
108108
bool hasReferenceTypes() const { return HasReferenceTypes; }
109-
bool hasCallIndirectOverlong() const { return HasCallIndirectOverlong; }
109+
bool hasCallIndirectOverlong() const { return HasCallIndirectOverlong || HasReferenceTypes; }
110110
bool hasRelaxedSIMD() const { return SIMDLevel >= RelaxedSIMD; }
111111
bool hasSignExt() const { return HasSignExt; }
112112
bool hasSIMD128() const { return SIMDLevel >= SIMD128; }

0 commit comments

Comments
 (0)