-
Notifications
You must be signed in to change notification settings - Fork 415
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: relaxed reset/reuse in the code generator
closes #4089
- Loading branch information
1 parent
883a3e7
commit bfdacf9
Showing
3 changed files
with
95 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
set_option trace.compiler.ir.reset_reuse true | ||
def f : Nat × Nat → Nat × Nat | ||
| (a, b) => (b, a) | ||
|
||
set_option trace.compiler.ir.reset_reuse true | ||
def Sigma.toProd : (_ : α) × β → α × β | ||
| ⟨a, b⟩ => (a, b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
[reset_reuse] | ||
def f (x_1 : obj) : obj := | ||
case x_1 : obj of | ||
Prod.mk → | ||
let x_2 : obj := proj[0] x_1; | ||
let x_3 : obj := proj[1] x_1; | ||
let x_5 : obj := reset[2] x_1; | ||
let x_4 : obj := reuse x_5 in ctor_0[Prod.mk] x_3 x_2; | ||
ret x_4 | ||
[reset_reuse] | ||
def Sigma.toProd._rarg (x_1 : obj) : obj := | ||
case x_1 : obj of | ||
Sigma.mk → | ||
let x_2 : obj := proj[0] x_1; | ||
let x_3 : obj := proj[1] x_1; | ||
let x_5 : obj := reset[2] x_1; | ||
let x_4 : obj := reuse x_5 in ctor_0[Prod.mk] x_2 x_3; | ||
ret x_4 | ||
def Sigma.toProd (x_1 : ◾) (x_2 : ◾) : obj := | ||
let x_3 : obj := pap Sigma.toProd._rarg; | ||
ret x_3 |