GH-122155: Track local variables between pops and pushes in cases generator (GH-122286)

This commit is contained in:
Mark Shannon 2024-08-01 09:27:26 +01:00 committed by GitHub
parent 46f5a4f9e1
commit a9d56e38a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 463 additions and 159 deletions

View file

@ -216,6 +216,7 @@ Part = Uop | Skip | Flush
@dataclass
class Instruction:
where: lexer.Token
name: str
parts: list[Part]
_properties: Properties | None
@ -690,9 +691,10 @@ def add_op(op: parser.InstDef, uops: dict[str, Uop]) -> None:
def add_instruction(
name: str, parts: list[Part], instructions: dict[str, Instruction]
where: lexer.Token, name: str, parts: list[Part],
instructions: dict[str, Instruction]
) -> None:
instructions[name] = Instruction(name, parts, None)
instructions[name] = Instruction(where, name, parts, None)
def desugar_inst(
@ -720,7 +722,7 @@ def desugar_inst(
parts.append(uop)
else:
parts[uop_index] = uop
add_instruction(name, parts, instructions)
add_instruction(inst.first_token, name, parts, instructions)
def add_macro(
@ -741,7 +743,7 @@ def add_macro(
case _:
assert False
assert parts
add_instruction(macro.name, parts, instructions)
add_instruction(macro.first_token, macro.name, parts, instructions)
def add_family(