Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions chapter04/src/main/java/com/seaofnodes/simple/node/AddNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public Node idealize () {

// Now we might see (add add non) or (add non non) but never (add non add) nor (add add add)
if( !(lhs instanceof AddNode) )
return spline_cmp(lhs,rhs) ? swap12() : null;
return spine_cmp(lhs,rhs) ? swap12() : null;

// Now we only see (add add non)

Expand All @@ -72,22 +72,22 @@ public Node idealize () {
if( lhs.in(2)._type.isConstant() && t2.isConstant() )
return new AddNode(lhs.in(1),new AddNode(lhs.in(2),rhs).peephole());

// Now we sort along the spline via rotates, to gather similar things together.
// Now we sort along the spine via rotates, to gather similar things together.

// Do we rotate (x + y) + z
// into (x + z) + y ?
if( spline_cmp(lhs.in(2),rhs) )
if( spine_cmp(lhs.in(2),rhs) )
return new AddNode(new AddNode(lhs.in(1),rhs).peephole(),lhs.in(2));

return null;
}

// Compare two off-spline nodes and decide what order they should be in.
// Compare two off-spine nodes and decide what order they should be in.
// Do we rotate ((x + hi) + lo) into ((x + lo) + hi) ?
// Generally constants always go right, then others.
// Ties with in a category sort by node ID.
// TRUE if swapping hi and lo.
static boolean spline_cmp( Node hi, Node lo ) {
static boolean spine_cmp( Node hi, Node lo ) {
if( lo._type.isConstant() ) return false;
if( hi._type.isConstant() ) return true ;

Expand Down
10 changes: 5 additions & 5 deletions chapter05/src/main/java/com/seaofnodes/simple/node/AddNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public Node idealize () {

// Now we might see (add add non) or (add non non) but never (add non add) nor (add add add)
if( !(lhs instanceof AddNode) )
return spline_cmp(lhs,rhs) ? swap12() : null;
return spine_cmp(lhs,rhs) ? swap12() : null;

// Now we only see (add add non)

Expand All @@ -90,22 +90,22 @@ public Node idealize () {
return new AddNode(lhs.in(1),new PhiNode(label,ns).peephole());
}

// Now we sort along the spline via rotates, to gather similar things together.
// Now we sort along the spine via rotates, to gather similar things together.

// Do we rotate (x + y) + z
// into (x + z) + y ?
if( spline_cmp(lhs.in(2),rhs) )
if( spine_cmp(lhs.in(2),rhs) )
return new AddNode(new AddNode(lhs.in(1),rhs).peephole(),lhs.in(2));

return null;
}

// Compare two off-spline nodes and decide what order they should be in.
// Compare two off-spine nodes and decide what order they should be in.
// Do we rotate ((x + hi) + lo) into ((x + lo) + hi) ?
// Generally constants always go right, then Phi-of-constants, then muls, then others.
// Ties with in a category sort by node ID.
// TRUE if swapping hi and lo.
static boolean spline_cmp( Node hi, Node lo ) {
static boolean spine_cmp( Node hi, Node lo ) {
if( lo._type.isConstant() ) return false;
if( hi._type.isConstant() ) return true ;

Expand Down
10 changes: 5 additions & 5 deletions chapter06/src/main/java/com/seaofnodes/simple/node/AddNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public Node idealize () {
// Now we might see (add add non) or (add non non) but never (add non add) nor (add add add)
if( !(lhs instanceof AddNode) )
// Rotate; look for (add (phi cons) con/(phi cons))
return spline_cmp(lhs,rhs) ? swap12() : phiCon(this,true);
return spine_cmp(lhs,rhs) ? swap12() : phiCon(this,true);

// Now we only see (add add non)

Expand All @@ -80,11 +80,11 @@ public Node idealize () {
Node phicon = phiCon(this,true);
if( phicon!=null ) return phicon;

// Now we sort along the spline via rotates, to gather similar things together.
// Now we sort along the spine via rotates, to gather similar things together.

// Do we rotate (x + y) + z
// into (x + z) + y ?
if( spline_cmp(lhs.in(2),rhs) )
if( spine_cmp(lhs.in(2),rhs) )
return new AddNode(new AddNode(lhs.in(1),rhs).peephole(),lhs.in(2));

return null;
Expand Down Expand Up @@ -131,12 +131,12 @@ static PhiNode pcon(Node op) {
return op instanceof PhiNode phi && phi.allCons() ? phi : null;
}

// Compare two off-spline nodes and decide what order they should be in.
// Compare two off-spine nodes and decide what order they should be in.
// Do we rotate ((x + hi) + lo) into ((x + lo) + hi) ?
// Generally constants always go right, then Phi-of-constants, then muls, then others.
// Ties with in a category sort by node ID.
// TRUE if swapping hi and lo.
static boolean spline_cmp( Node hi, Node lo ) {
static boolean spine_cmp( Node hi, Node lo ) {
if( lo._type.isConstant() ) return false;
if( hi._type.isConstant() ) return true ;

Expand Down
10 changes: 5 additions & 5 deletions chapter07/src/main/java/com/seaofnodes/simple/node/AddNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public Node idealize () {
// Now we might see (add add non) or (add non non) but never (add non add) nor (add add add)
if( !(lhs instanceof AddNode) )
// Rotate; look for (add (phi cons) con/(phi cons))
return spline_cmp(lhs,rhs) ? swap12() : phiCon(this,true);
return spine_cmp(lhs,rhs) ? swap12() : phiCon(this,true);

// Now we only see (add add non)

Expand All @@ -82,11 +82,11 @@ public Node idealize () {
Node phicon = phiCon(this,true);
if( phicon!=null ) return phicon;

// Now we sort along the spline via rotates, to gather similar things together.
// Now we sort along the spine via rotates, to gather similar things together.

// Do we rotate (x + y) + z
// into (x + z) + y ?
if( spline_cmp(lhs.in(2),rhs) )
if( spine_cmp(lhs.in(2),rhs) )
return new AddNode(new AddNode(lhs.in(1),rhs).peephole(),lhs.in(2));

return null;
Expand Down Expand Up @@ -133,12 +133,12 @@ static PhiNode pcon(Node op) {
return op instanceof PhiNode phi && phi.allCons() ? phi : null;
}

// Compare two off-spline nodes and decide what order they should be in.
// Compare two off-spine nodes and decide what order they should be in.
// Do we rotate ((x + hi) + lo) into ((x + lo) + hi) ?
// Generally constants always go right, then Phi-of-constants, then muls, then others.
// Ties with in a category sort by node ID.
// TRUE if swapping hi and lo.
static boolean spline_cmp( Node hi, Node lo ) {
static boolean spine_cmp( Node hi, Node lo ) {
if( lo._type.isConstant() ) return false;
if( hi._type.isConstant() ) return true ;

Expand Down
10 changes: 5 additions & 5 deletions chapter08/src/main/java/com/seaofnodes/simple/node/AddNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public Node idealize () {
// Now we might see (add add non) or (add non non) but never (add non add) nor (add add add)
if( !(lhs instanceof AddNode) )
// Rotate; look for (add (phi cons) con/(phi cons))
return spline_cmp(lhs,rhs) ? swap12() : phiCon(this,true);
return spine_cmp(lhs,rhs) ? swap12() : phiCon(this,true);

// Now we only see (add add non)

Expand All @@ -87,11 +87,11 @@ public Node idealize () {
Node phicon = phiCon(this,true);
if( phicon!=null ) return phicon;

// Now we sort along the spline via rotates, to gather similar things together.
// Now we sort along the spine via rotates, to gather similar things together.

// Do we rotate (x + y) + z
// into (x + z) + y ?
if( spline_cmp(lhs.in(2),rhs) )
if( spine_cmp(lhs.in(2),rhs) )
return new AddNode(new AddNode(lhs.in(1),rhs).peephole(),lhs.in(2));

return null;
Expand Down Expand Up @@ -138,12 +138,12 @@ static PhiNode pcon(Node op) {
return op instanceof PhiNode phi && phi.allCons() ? phi : null;
}

// Compare two off-spline nodes and decide what order they should be in.
// Compare two off-spine nodes and decide what order they should be in.
// Do we rotate ((x + hi) + lo) into ((x + lo) + hi) ?
// Generally constants always go right, then Phi-of-constants, then muls, then others.
// Ties with in a category sort by node ID.
// TRUE if swapping hi and lo.
static boolean spline_cmp( Node hi, Node lo ) {
static boolean spine_cmp( Node hi, Node lo ) {
if( lo._type.isConstant() ) return false;
if( hi._type.isConstant() ) return true ;

Expand Down