-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom rules. Iteration 2 #423
Comments
DSL specification: We consider usage of variables and literals on both sides of bidning:
RESERVED LITERALS:
VARIABLES. Start with
FUNCTIONS YAML FORMAT: // describe all used variables in 'patterns' section with required conditions.
// example of condition: $τ5: matches($, "java_util_Stream$map")
// "For all variables ... where ... and $τ5 matches to "java_util_Stream$map" and ..."
forall:
$τ0:
$τ1:
$τ5: matches($, "java_util_Stream$map")
$b1:
$b2:
$B1:
$t1:
// "For all variables ... which match the patterns..."
patterns:
- |
$τ0 ↦ ⟦
$τ1 ↦ $b1.$τ5(
α0 ↦ $b2
) * $t1,
$B1
⟧
// describe all used variables in 'results' section with required conditions.
// conditions in such section may use variables from 'forall' section
// "For all variables ... which match the pattern ... such variables exist ..."
exists:
$τ2: and(unique($, $B1), not(equal($, $τ1)))
$τ3: and(unique($, $B1), not(equal($, $τ1)), not(equal($, $τ2)))
// describe result after transformation
// "For all variables ... which match the pattern ... such variables exist ... so result patterns may be applied"
results:
- |
$τ0 ↦ ⟦
$τ2 ↦ $b1,
$τ3 ↦ QQ.opeo.map-for-each(
α0 ↦ ξ.$τ2,
α1 ↦ $b2
),
$τ1 ↦ ξ.$τ3 * $t1,
$B1
⟧ |
A few comments on the suggested format:
|
We want to make bytecode optimizations via phi normalizer. We've developed a new format for custom rules which should be more strict than v1.
Toy example of optimization: replace
.java_util_Stream$map
withfor-each
atom call.PHI:
The text was updated successfully, but these errors were encountered: