Skip to content

Commit d9a88a1

Browse files
committed
call-indirect-overlong is implied by reference-types.
1 parent acca08a commit d9a88a1

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
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: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ def : ProcessorModel<"mvp", NoSchedModel, []>;
119119
// the importance of the features.
120120
def : ProcessorModel<"generic", NoSchedModel,
121121
[FeatureMultivalue, FeatureMutableGlobals,
122-
FeatureReferenceTypes, FeatureSignExt]>;
122+
FeatureReferenceTypes, FeatureCallIndirectOverlong,
123+
FeatureSignExt]>;
123124

124125
def : ProcessorModel<"trail1", NoSchedModel,
125126
[FeatureMultivalue, FeatureMutableGlobals,
@@ -129,13 +130,13 @@ def : ProcessorModel<"trail1", NoSchedModel,
129130

130131
// Latest and greatest experimental version of WebAssembly. Bugs included!
131132
def : ProcessorModel<"bleeding-edge", NoSchedModel,
132-
[FeatureAtomics, FeatureBulkMemory,
133+
[FeatureAtomics, FeatureBulkMemory, FeatureBulkMemoryOpt,
133134
FeatureExceptionHandling, FeatureExtendedConst,
134135
FeatureFP16, FeatureMultiMemory,
135136
FeatureMultivalue, FeatureMutableGlobals,
136137
FeatureNontrappingFPToInt, FeatureRelaxedSIMD,
137-
FeatureReferenceTypes, FeatureSIMD128, FeatureSignExt,
138-
FeatureTailCall]>;
138+
FeatureReferenceTypes, FeatureCallIndirectOverlong,
139+
FeatureSIMD128, FeatureSignExt, FeatureTailCall]>;
139140

140141
//===----------------------------------------------------------------------===//
141142
// Target Declaration

llvm/lib/Target/WebAssembly/WebAssemblySubtarget.h

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

0 commit comments

Comments
 (0)