MCPcopy Index your code
hub / github.com/python/cpython / add_macro

Function add_macro

Tools/cases_generator/analyzer.py:1131–1158  ·  view source on GitHub ↗
(
    macro: parser.Macro, instructions: dict[str, Instruction], uops: dict[str, Uop]
)

Source from the content-addressed store, hash-verified

1129
1130
1131def add_macro(
1132 macro: parser.Macro, instructions: dict[str, Instruction], uops: dict[str, Uop]
1133) -> None:
1134 parts: list[Part] = []
1135 first = True
1136 for part in macro.uops:
1137 match part:
1138 case parser.OpName():
1139 if part.name == "flush":
1140 parts.append(Flush())
1141 else:
1142 if part.name not in uops:
1143 raise analysis_error(
1144 f"No Uop named {part.name}", macro.tokens[0]
1145 )
1146 uop = uops[part.name]
1147 if uop.properties.records_value and not first:
1148 raise analysis_error(
1149 f"Recording uop {part.name} must be first in macro",
1150 macro.tokens[0])
1151 parts.append(uop)
1152 first = False
1153 case parser.CacheEffect():
1154 parts.append(Skip(part.size))
1155 case _:
1156 assert False
1157 assert parts
1158 add_instruction(macro.first_token, macro.name, parts, instructions)
1159
1160
1161def add_family(

Callers 1

analyze_forestFunction · 0.85

Calls 5

FlushClass · 0.85
analysis_errorFunction · 0.85
add_instructionFunction · 0.85
SkipClass · 0.70
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…