eclipse / omr

Eclipse OMR™ Cross platform components for building reliable, high performance language runtimes
http://www.eclipse.org/omr
Other
945 stars 396 forks source link

Create an IL Validation Rule for checking Binary OpCode child layout #2158

Open rbanerjee opened 6 years ago

rbanerjee commented 6 years ago

As @vijaysun-omr pointed out here, one of the implicit expectations that our IL currently makes is:

For binary commutative operations, constants (if present) can only appear in the rightmost child.

With the ILValidator now in place (via https://github.com/eclipse/omr/pull/1826), this implicit expectation should be made into an IL Validation rule.

The process would involve implementing the steps outlined below:

fjeremic commented 6 years ago

Does this assume that simplifier will be a mandatory optimization pass on all optimization levels? IIRC simplifier is the pass which canonicalizes such IL, among other things.

Leonardo2718 commented 6 years ago

@fjeremic For the time being that's correct. Simplifier is already implicitly mandatory because existing evaluators will misbehave when given "un-canonicalized" IL (and I'm quite sure the different code generators are not consistent about this either).

Ideally, we should have a better definition of "canonicalized" IL, other than just "whatever the output of simplifier is". These new validation rules will hopefully help us get there. 🙂

rbanerjee commented 6 years ago

Does this assume that simplifier will be a mandatory optimization pass on all optimization levels?

@fjeremic Sorry it took me so long to circle back to this. @Leonardo2718 is correct. There's also this Issue #2161, which is partly related to identifying which Optimizations should even be part of the "mandatory optimization pass".