forked from p4lang/p4c
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a constant folding pass after inlining (p4lang#4727)
* Add a constant folding pass after inlining Signed-off-by: Mihai Budiu <[email protected]> * Updated reference outputs Signed-off-by: Mihai Budiu <[email protected]> --------- Signed-off-by: Mihai Budiu <[email protected]>
- Loading branch information
1 parent
7f98dad
commit de82285
Showing
17 changed files
with
93 additions
and
16 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,20 @@ | ||
#include <core.p4> | ||
|
||
bit<16> fun1(bit<8> args1) { | ||
return (bit<16>)args1; | ||
} | ||
bit<8> fun2(bit<4> args2) { | ||
fun1(8w10); | ||
return 8w0; | ||
} | ||
|
||
control ingress() { | ||
apply { | ||
fun2(4w3); | ||
fun2(4w3); | ||
} | ||
} | ||
|
||
control Ingress(); | ||
package top( Ingress ig); | ||
top( ingress()) main; |
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
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
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
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
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 |
---|---|---|
|
@@ -7,9 +7,7 @@ extern void baz(); | |
control c() { | ||
apply { | ||
bar(E.e0); | ||
if (E.e0 == E.e0) { | ||
baz(); | ||
} | ||
baz(); | ||
} | ||
} | ||
|
||
|
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,19 @@ | ||
#include <core.p4> | ||
|
||
bit<16> fun1(bit<8> args1) { | ||
return (bit<16>)args1; | ||
} | ||
bit<8> fun2(bit<4> args2) { | ||
fun1(8w10); | ||
return 8w0; | ||
} | ||
control ingress() { | ||
apply { | ||
fun2(4w3); | ||
fun2(4w3); | ||
} | ||
} | ||
|
||
control Ingress(); | ||
package top(Ingress ig); | ||
top(ingress()) main; |
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,10 @@ | ||
#include <core.p4> | ||
|
||
control ingress() { | ||
apply { | ||
} | ||
} | ||
|
||
control Ingress(); | ||
package top(Ingress ig); | ||
top(ingress()) main; |
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,10 @@ | ||
#include <core.p4> | ||
|
||
control ingress() { | ||
apply { | ||
} | ||
} | ||
|
||
control Ingress(); | ||
package top(Ingress ig); | ||
top(ingress()) main; |
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,19 @@ | ||
#include <core.p4> | ||
|
||
bit<16> fun1(bit<8> args1) { | ||
return (bit<16>)args1; | ||
} | ||
bit<8> fun2(bit<4> args2) { | ||
fun1(8w10); | ||
return 8w0; | ||
} | ||
control ingress() { | ||
apply { | ||
fun2(4w3); | ||
fun2(4w3); | ||
} | ||
} | ||
|
||
control Ingress(); | ||
package top(Ingress ig); | ||
top(ingress()) main; |
Empty file.
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