Skip to content

Commit 9544948

Browse files
authored
Remove support for legacy bytecode instructions (#105705)
(A legacy instruction is of the form `instr(FOOBAR)`, i.e. missing the `(... -- ...)` stack/cache effect annotation.)
1 parent b9e7dc7 commit 9544948

File tree

3 files changed

+3
-22
lines changed

3 files changed

+3
-22
lines changed

Tools/cases_generator/generate_cases.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ class Instruction:
230230

231231
# Parts of the underlying instruction definition
232232
inst: parser.InstDef
233-
kind: typing.Literal["inst", "op", "legacy"] # Legacy means no (input -- output)
233+
kind: typing.Literal["inst", "op"]
234234
name: str
235235
block: parser.Block
236236
block_text: list[str] # Block.text, less curlies, less PREDICT() calls
@@ -856,8 +856,6 @@ def get_stack_effect_info(
856856
self, thing: parser.InstDef | parser.Macro | parser.Pseudo
857857
) -> tuple[AnyInstruction | None, str, str]:
858858
def effect_str(effects: list[StackEffect]) -> str:
859-
if getattr(thing, "kind", None) == "legacy":
860-
return str(-1)
861859
n_effect, sym_effect = list_effect_size(effects)
862860
if sym_effect:
863861
return f"{sym_effect} + {n_effect}" if n_effect else sym_effect

Tools/cases_generator/parser.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class OpName(Node):
101101
class InstHeader(Node):
102102
override: bool
103103
register: bool
104-
kind: Literal["inst", "op", "legacy"] # Legacy means no (inputs -- outputs)
104+
kind: Literal["inst", "op"]
105105
name: str
106106
inputs: list[InputEffect]
107107
outputs: list[OutputEffect]
@@ -111,7 +111,7 @@ class InstHeader(Node):
111111
class InstDef(Node):
112112
override: bool
113113
register: bool
114-
kind: Literal["inst", "op", "legacy"]
114+
kind: Literal["inst", "op"]
115115
name: str
116116
inputs: list[InputEffect]
117117
outputs: list[OutputEffect]
@@ -174,9 +174,6 @@ def inst_header(self) -> InstHeader | None:
174174
if self.expect(lx.RPAREN):
175175
if (tkn := self.peek()) and tkn.kind == lx.LBRACE:
176176
return InstHeader(override, register, kind, name, inp, outp)
177-
elif self.expect(lx.RPAREN) and kind == "inst":
178-
# No legacy stack effect if kind is "op".
179-
return InstHeader(override, register, "legacy", name, [], [])
180177
return None
181178

182179
def io_effect(self) -> tuple[list[InputEffect], list[OutputEffect]]:

Tools/cases_generator/test_generator.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,6 @@ def run_cases_test(input: str, expected: str):
6262
# print("End")
6363
assert actual.rstrip() == expected.rstrip()
6464

65-
def test_legacy():
66-
input = """
67-
inst(OP) {
68-
spam();
69-
}
70-
"""
71-
output = """
72-
TARGET(OP) {
73-
spam();
74-
DISPATCH();
75-
}
76-
"""
77-
run_cases_test(input, output)
78-
7965
def test_inst_no_args():
8066
input = """
8167
inst(OP, (--)) {

0 commit comments

Comments
 (0)