cfg_builder
NotationCFGBuilder
¶
Incrementally builds control-flow graph for Finch Notation IR.
Source code in src/finch/finch_notation/cfg_builder.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | |
NumberedStatement
dataclass
¶
Bases: NotationStatement
Wrapper for NotationStatement that assigns a unique id to each statement.
Source code in src/finch/finch_notation/cfg_builder.py
notation_build_cfg(node, sid)
¶
Build control-flow graph for a FinchNotation node. Args: node: Root FinchNotation node to build CFG for. sid: Starting statement id for numbering additional statements during CFG desugaring. Returns: ControlFlowGraph: The constructed control-flow graph.
Source code in src/finch/finch_notation/cfg_builder.py
notation_dataflow_postprocess(node)
¶
Postprocess a FinchNotation node after dataflow analysis (remove numbering). Args: node: Root FinchNotation node to postprocess. Returns: NotationNode: The postprocessed FinchNotation node.
Source code in src/finch/finch_notation/cfg_builder.py
notation_dataflow_preprocess(node)
¶
Preprocess a FinchNotation node for dataflow analysis (number statements). Args: node: Root FinchNotation node to preprocess. Returns: NotationNode: The preprocessed FinchNotation node. sid: first unused statement id after preprocessing.
Source code in src/finch/finch_notation/cfg_builder.py
notation_desugar(root, sid)
¶
Lower surface syntax to a core AST shape before CFG construction.
If(cond, body)->IfElse(cond, body, Block())- function parameters get explicit numbered
Assign(arg, arg)statements at function entry so they can be referenced in the CFG