Skip to content

Commit 86a8707

Browse files
committed
Fix type errors
1 parent 5138884 commit 86a8707

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

Tools/cases_generator/analyzer.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -417,14 +417,11 @@ def analyze_caches(inputs: list[parser.InputEffect]) -> list[CacheEntry]:
417417
i for i in inputs if isinstance(i, parser.CacheEffect)
418418
]
419419
if caches:
420-
if caches[0].name == "unused":
421-
raise analysis_error(
422-
"First cache entry in op is unused. Move to enclosing macro.", cache.tokens[0]
423-
)
424-
if caches[-1].name == "unused":
425-
raise analysis_error(
426-
"Last cache entry in op is unused. Move to enclosing macro.", cache.tokens[0]
427-
)
420+
for cache in (caches[0], caches[-1]):
421+
if cache.name == "unused":
422+
raise analysis_error(
423+
"First cache entry in op is unused. Move to enclosing macro.", cache.tokens[0]
424+
)
428425
return [CacheEntry(i.name, int(i.size)) for i in caches]
429426

430427

Tools/cases_generator/opcode_metadata_generator.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ def generate_expansion_table(analysis: Analysis, out: CWriter) -> None:
319319
expansions_table: dict[str, list[tuple[str, str, int]]] = {}
320320
for inst in sorted(analysis.instructions.values(), key=lambda t: t.name):
321321
offset: int = 0 # Cache effect offset
322-
expansions: list[tuple[str, int, int]] = [] # [(name, size, offset), ...]
322+
expansions: list[tuple[str, str, int]] = [] # [(name, size, offset), ...]
323323
if inst.is_super():
324324
pieces = inst.name.split("_")
325325
assert len(pieces) == 4, f"{inst.name} doesn't look like a super-instr"
@@ -335,20 +335,19 @@ def generate_expansion_table(analysis: Analysis, out: CWriter) -> None:
335335
assert (
336336
len(instr2.parts) == 1
337337
), f"{name2} is not a good superinstruction part"
338-
expansions.append((instr1.parts[0].name, OPARG_KINDS["OPARG_TOP"], 0))
339-
expansions.append((instr2.parts[0].name, OPARG_KINDS["OPARG_BOTTOM"], 0))
338+
expansions.append((instr1.parts[0].name, "OPARG_TOP", 0))
339+
expansions.append((instr2.parts[0].name, "OPARG_BOTTOM", 0))
340340
elif not is_viable_expansion(inst):
341341
continue
342342
else:
343343
for part in inst.parts:
344344
size = part.size
345345
if isinstance(part, Uop):
346+
fmt = "0"
346347
if part.name == "_SAVE_RETURN_OFFSET":
347348
fmt = "OPARG_SAVE_RETURN_OFFSET"
348349
elif part.caches:
349350
fmt = str(part.caches[0].size)
350-
else:
351-
fmt = "0"
352351
# Skip specializations
353352
if "specializing" in part.annotations:
354353
continue

0 commit comments

Comments
 (0)