Skip to content

Commit aeba85f

Browse files
committed
Abstract interpretation based analysis rewrite
1 parent e115107 commit aeba85f

File tree

6 files changed

+2261
-7
lines changed

6 files changed

+2261
-7
lines changed

src/exo/API.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from .pattern_match import match_pattern
2020
from .prelude import *
2121
from .new_eff import Check_Aliasing
22+
from .dataflow import dataflow_analysis
2223

2324
# Moved to new file
2425
from .proc_eqv import decl_new_proc, derive_proc, assert_eqv_proc, check_eqv_proc
@@ -391,3 +392,6 @@ def is_eq(self, proc: "Procedure"):
391392

392393
def _root(self):
393394
return IC.Cursor.create(self._loopir_proc)
395+
396+
def dataflow(self):
397+
return dataflow_analysis(self._loopir_proc)

src/exo/LoopIR_pprint.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -321,33 +321,33 @@ def ptype(self, t):
321321
# LoopIR Pretty Printing
322322

323323

324-
def _format_code(code):
324+
def format_code(code):
325325
return FormatCode(code)[0].rstrip("\n")
326326

327327

328328
@extclass(LoopIR.proc)
329329
def __str__(self):
330-
return _format_code("\n".join(_print_proc(self, PrintEnv(), "")))
330+
return format_code("\n".join(_print_proc(self, PrintEnv(), "")))
331331

332332

333333
@extclass(LoopIR.fnarg)
334334
def __str__(self):
335-
return _format_code(_print_fnarg(self, PrintEnv()))
335+
return format_code(_print_fnarg(self, PrintEnv()))
336336

337337

338338
@extclass(LoopIR.stmt)
339339
def __str__(self):
340-
return _format_code("\n".join(_print_stmt(self, PrintEnv(), "")))
340+
return format_code("\n".join(_print_stmt(self, PrintEnv(), "")))
341341

342342

343343
@extclass(LoopIR.expr)
344344
def __str__(self):
345-
return _format_code(_print_expr(self, PrintEnv()))
345+
return format_code(_print_expr(self, PrintEnv()))
346346

347347

348348
@extclass(LoopIR.type)
349349
def __str__(self):
350-
return _format_code(_print_type(self, PrintEnv()))
350+
return format_code(_print_type(self, PrintEnv()))
351351

352352

353353
del __str__
@@ -588,7 +588,7 @@ def _print_cursor(cur):
588588

589589
root_cur = cur.root()
590590
lines = _print_cursor_proc(root_cur, cur, PrintEnv(), "")
591-
code = _format_code("\n".join(lines))
591+
code = format_code("\n".join(lines))
592592
# need to use "..." for Python parsing, but unquoted ellipses are prettier
593593
code = code.replace('"..."', "...")
594594
return code

0 commit comments

Comments
 (0)