Skip to content
Prev Previous commit
Next Next commit
add a few comments
  • Loading branch information
iritkatriel committed Jun 10, 2023
commit 506eda52efaed3577b6ba2d007abde99ca192044
6 changes: 6 additions & 0 deletions Tools/cases_generator/generate_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,7 @@ def analyze_macro(self, macro: parser.Macro) -> MacroInstruction:
def analyze_pseudo(self, pseudo: parser.Pseudo) -> PseudoInstruction:
targets = [self.instrs[target] for target in pseudo.targets]
assert targets
# Make sure the targets have the same fmt
fmts = list(set([t.instr_fmt for t in targets]))
assert(len(fmts) == 1)
return PseudoInstruction(pseudo.name, fmts[0], targets)
Expand Down Expand Up @@ -960,8 +961,13 @@ def effect_str(effects: list[StackEffect]) -> str:
case parser.Pseudo():
instr = self.pseudos[thing.name]
popped = pushed = None
# Calculate stack effect, and check that it's the the same
# for all targets.
for target in self.pseudos[thing.name].targets:
Comment thread
gvanrossum marked this conversation as resolved.
target_instr = self.instrs.get(target)
# Currently target is always an instr. This could change
# in the future, e.g., if we have a pseudo targetting a
# macro instruction.
assert target_instr
Comment thread
iritkatriel marked this conversation as resolved.
target_popped = effect_str(target_instr.input_effects)
target_pushed = effect_str(target_instr.output_effects)
Comment thread
iritkatriel marked this conversation as resolved.
Expand Down