8000 gh-104909: Implement conditional stack effects for macros by gvanrossum · Pull Request #105748 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-104909: Implement conditional stack effects for macros #105748

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jun 14, 2023
Merged
Next Next commit
Fix types and bug for pseudos
  • Loading branch information
gvanrossum committed Jun 12, 2023
commit 4291adf7bf97b51cf1981cf1da053e583e0a293b
7 changes: 4 additions & 3 deletions Tools/cases_generator/generate_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ class OverriddenInstructionPlaceHolder:
name: str


AnyInstruction = Instruction | MacroInstruction
AnyInstruction = Instruction | MacroInstruction | PseudoInstruction
INSTR_FMT_PREFIX = "INSTR_FMT_"


Expand Down Expand Up @@ -530,6 +530,7 @@ def error(self, msg: str, node: parser.Node) -> None:
macros: dict[str, parser.Macro]
macro_instrs: dict[str, MacroInstruction]
families: dict[str, parser.Family]
pseudos: dict[str, parser.Pseudo]
pseudo_instrs: dict[str, PseudoInstruction]

def parse(self) -> None:
Expand Down Expand Up @@ -587,7 +588,7 @@ def parse_file(self, filename: str, instrs_idx: dict[str, int]) -> None:

# Parse from start
psr.setpos(start)
thing: parser.InstDef | parser.Macro | parser.Family | None
thing: parser.InstDef | parser.Macro | parser.Pseudo | parser.Family | None
thing_first_token = psr.peek()
while thing := psr.definition():
match thing:
Expand Down Expand Up @@ -900,7 +901,7 @@ def effect_str(effects: list[StackEffect]) -> str:
popped = str(-low)
pushed = str(sp - low)
case parser.Pseudo():
instr = self.pseudos[thing.name]
instr = self.pseudo_instrs[thing.name]
popped = pushed = None
# Calculate stack effect, and check that it's the the same
# for all targets.
Expand Down
0