Skip to content

Commit

Permalink
Add assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
Fidget-Spinner committed Dec 21, 2024
1 parent 09478c5 commit bc478e4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Tools/cases_generator/tier2_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

DEFAULT_OUTPUT = ROOT / "Python/executor_cases.c.h"

MAX_UOP_LEN = 9

def declare_variable(var: StackItem, out: CWriter) -> None:
type, null = type_and_null(var)
space = " " if type[-1].isalnum() else ""
Expand Down Expand Up @@ -305,12 +307,16 @@ def declare_variables_tier2(uop: Uop, out: CWriter) -> None:
def tier2_not_viable(inst: Instruction) -> str:
if inst.properties.needs_prev:
return "/* Not viable for tier 2 (needs prev_instr) */\n"
count = 0
for part in inst.parts:
if isinstance(part, Uop):
if len(part.caches) > 2:
return f"/* Not viable for tier 2 (more than 2 cache entries) */\n"
if part.properties.needs_this and not "specializing" in part.annotations and part.name not in {"_SAVE_RETURN_OFFSET"}:
return f"/* Not viable for tier 2 (needs this_instr in {part.name}, and can't ignore specializing) */\n"
if "specializing" not in part.annotations:
count += 1
assert count <= MAX_UOP_LEN, inst.name
return ""


Expand Down

0 comments on commit bc478e4

Please sign in to comment.