Calculate always defined registers at each CFG location. This analysis can work before exception insertion, since it is a sound assumption that registers defined in a block might not be initialized in its error handler. A register is defined if it has a value along all paths from t
(
blocks: list[BasicBlock],
cfg: CFG,
initial_defined: set[Value],
regs: Iterable[Value],
strict_errors: bool = False,
)
| 363 | |
| 364 | |
| 365 | def analyze_must_defined_regs( |
| 366 | blocks: list[BasicBlock], |
| 367 | cfg: CFG, |
| 368 | initial_defined: set[Value], |
| 369 | regs: Iterable[Value], |
| 370 | strict_errors: bool = False, |
| 371 | ) -> AnalysisResult[Value]: |
| 372 | """Calculate always defined registers at each CFG location. |
| 373 | |
| 374 | This analysis can work before exception insertion, since it is a |
| 375 | sound assumption that registers defined in a block might not be |
| 376 | initialized in its error handler. |
| 377 | |
| 378 | A register is defined if it has a value along all paths from the |
| 379 | initial location. |
| 380 | """ |
| 381 | return run_analysis( |
| 382 | blocks=blocks, |
| 383 | cfg=cfg, |
| 384 | gen_and_kill=DefinedVisitor(strict_errors=strict_errors), |
| 385 | initial=initial_defined, |
| 386 | backward=False, |
| 387 | kind=MUST_ANALYSIS, |
| 388 | universe=set(regs), |
| 389 | ) |
| 390 | |
| 391 | |
| 392 | class BorrowedArgumentsVisitor(BaseAnalysisVisitor[Value]): |
no test coverage detected
searching dependent graphs…