Skip to content

Commit 4fe62a0

Browse files
aheejinPhilippRados
authored andcommitted
[WebAssembly] Remove WASM_FEATURE_PREFIX_REQUIRED (NFC) (llvm#113729)
This has not been emitted since llvm@3f34e1b. The corresponding proposed tool-conventions change: WebAssembly/tool-conventions#236
1 parent dcc0220 commit 4fe62a0

File tree

9 files changed

+2
-135
lines changed

9 files changed

+2
-135
lines changed

lld/test/wasm/Inputs/require-feature-foo.yaml

Lines changed: 0 additions & 13 deletions
This file was deleted.

lld/test/wasm/target-feature-required.yaml

Lines changed: 0 additions & 90 deletions
This file was deleted.

lld/test/wasm/target-feature-used.yaml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
# RUN: yaml2obj %S/Inputs/use-feature-foo.yaml -o %t.used.o
1010
# RUN: wasm-ld --no-entry -o - %t1.o %t.used.o | obj2yaml | FileCheck %s --check-prefix USED
1111

12-
# RUN: yaml2obj %S/Inputs/require-feature-foo.yaml -o %t.required.o
13-
# RUN: wasm-ld --no-entry -o - %t1.o %t.required.o | obj2yaml | FileCheck %s --check-prefix REQUIRED
14-
1512
# RUN: yaml2obj %S/Inputs/disallow-feature-foo.yaml -o %t.disallowed.o
1613
# RUN: not wasm-ld --no-entry -o /dev/null %t1.o %t.disallowed.o 2>&1 | FileCheck %s --check-prefix DISALLOWED
1714

@@ -24,7 +21,6 @@
2421
# give the expected results:
2522
#
2623
# USED x USED => USED
27-
# USED x REQUIRED => USED
2824
# USED x DISALLOWED => Error
2925
# USED x NONE => USED
3026

@@ -73,13 +69,6 @@ Sections:
7369
# USED-NEXT: Name: foo
7470
# USED-NEXT: ...
7571

76-
# REQUIRED: - Type: CUSTOM
77-
# REQUIRED: Name: target_features
78-
# REQUIRED-NEXT: Features:
79-
# REQUIRED-NEXT: - Prefix: USED
80-
# REQUIRED-NEXT: Name: foo
81-
# REQUIRED-NEXT: ...
82-
8372
# DISALLOWED: Target feature 'foo' used in {{.*}}target-feature-used.yaml.tmp1.o is disallowed by {{.*}}target-feature-used.yaml.tmp.disallowed.o. Use --no-check-features to suppress.{{$}}
8473

8574
# DISALLOWED-NOCHECK: - Type: CUSTOM

lld/wasm/Writer.cpp

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,6 @@ void Writer::finalizeSections() {
572572

573573
void Writer::populateTargetFeatures() {
574574
StringMap<std::string> used;
575-
StringMap<std::string> required;
576575
StringMap<std::string> disallowed;
577576
SmallSet<std::string, 8> &allowed = out.targetFeaturesSec->features;
578577
bool tlsUsed = false;
@@ -599,18 +598,14 @@ void Writer::populateTargetFeatures() {
599598
goto done;
600599
}
601600

602-
// Find the sets of used, required, and disallowed features
601+
// Find the sets of used and disallowed features
603602
for (ObjFile *file : ctx.objectFiles) {
604603
StringRef fileName(file->getName());
605604
for (auto &feature : file->getWasmObj()->getTargetFeatures()) {
606605
switch (feature.Prefix) {
607606
case WASM_FEATURE_PREFIX_USED:
608607
used.insert({feature.Name, std::string(fileName)});
609608
break;
610-
case WASM_FEATURE_PREFIX_REQUIRED:
611-
used.insert({feature.Name, std::string(fileName)});
612-
required.insert({feature.Name, std::string(fileName)});
613-
break;
614609
case WASM_FEATURE_PREFIX_DISALLOWED:
615610
disallowed.insert({feature.Name, std::string(fileName)});
616611
break;
@@ -662,7 +657,7 @@ void Writer::populateTargetFeatures() {
662657
}
663658
}
664659

665-
// Validate the required and disallowed constraints for each file
660+
// Validate the disallowed constraints for each file
666661
for (ObjFile *file : ctx.objectFiles) {
667662
StringRef fileName(file->getName());
668663
SmallSet<std::string, 8> objectFeatures;
@@ -675,12 +670,6 @@ void Writer::populateTargetFeatures() {
675670
fileName + " is disallowed by " + disallowed[feature.Name] +
676671
". Use --no-check-features to suppress.");
677672
}
678-
for (const auto &feature : required.keys()) {
679-
if (!objectFeatures.count(std::string(feature)))
680-
error(Twine("Missing target feature '") + feature + "' in " + fileName +
681-
", required by " + required[feature] +
682-
". Use --no-check-features to suppress.");
683-
}
684673
}
685674

686675
done:

llvm/include/llvm/BinaryFormat/Wasm.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ const unsigned WASM_ELEM_SEGMENT_MASK_HAS_ELEM_KIND = 0x3;
175175
// Feature policy prefixes used in the custom "target_features" section
176176
enum : uint8_t {
177177
WASM_FEATURE_PREFIX_USED = '+',
178-
WASM_FEATURE_PREFIX_REQUIRED = '=',
179178
WASM_FEATURE_PREFIX_DISALLOWED = '-',
180179
};
181180

llvm/lib/Object/WasmObjectFile.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,6 @@ Error WasmObjectFile::parseTargetFeaturesSection(ReadContext &Ctx) {
999999
Feature.Prefix = readUint8(Ctx);
10001000
switch (Feature.Prefix) {
10011001
case wasm::WASM_FEATURE_PREFIX_USED:
1002-
case wasm::WASM_FEATURE_PREFIX_REQUIRED:
10031002
case wasm::WASM_FEATURE_PREFIX_DISALLOWED:
10041003
break;
10051004
default:

llvm/lib/ObjectYAML/WasmYAML.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,6 @@ void ScalarEnumerationTraits<WasmYAML::FeaturePolicyPrefix>::enumeration(
342342
IO &IO, WasmYAML::FeaturePolicyPrefix &Kind) {
343343
#define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_FEATURE_PREFIX_##X);
344344
ECase(USED);
345-
ECase(REQUIRED);
346345
ECase(DISALLOWED);
347346
#undef ECase
348347
}

llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,6 @@ void WebAssemblyAsmPrinter::EmitTargetFeatures(Module &M) {
518518

519519
// Silently ignore invalid metadata
520520
if (Entry.Prefix != wasm::WASM_FEATURE_PREFIX_USED &&
521-
Entry.Prefix != wasm::WASM_FEATURE_PREFIX_REQUIRED &&
522521
Entry.Prefix != wasm::WASM_FEATURE_PREFIX_DISALLOWED)
523522
return;
524523

llvm/test/ObjectYAML/wasm/target-features-section.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ Sections:
88
Features:
99
- Prefix: USED
1010
Name: "foo"
11-
- Prefix: REQUIRED
12-
Name: "bar"
1311
- Prefix: DISALLOWED
1412
Name: ""
1513
...
@@ -19,7 +17,5 @@ Sections:
1917
# CHECK-NEXT: Features:
2018
# CHECK-NEXT: - Prefix: USED
2119
# CHECK-NEXT: Name: foo
22-
# CHECK-NEXT: - Prefix: REQUIRED
23-
# CHECK-NEXT: Name: bar
2420
# CHECK-NEXT: - Prefix: DISALLOWED
2521
# CHECK-NEXT: Name: ''

0 commit comments

Comments
 (0)