Skip to content

Commit

Permalink
Improve output so instr lists will show outgoing edges next to bb hea…
Browse files Browse the repository at this point in the history
…der.

Makes seeing possible next BB much simpler than lookup up above.
  • Loading branch information
enebo committed Oct 18, 2018
1 parent 60f9cb2 commit 4e8150d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion core/src/main/java/org/jruby/ir/representations/BasicBlock.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.jruby.ir.representations;

import org.jruby.RubyInstanceConfig;
import org.jruby.dirgra.Edge;
import org.jruby.dirgra.ExplicitVertexID;
import org.jruby.ir.IRManager;
import org.jruby.ir.instructions.CallBase;
Expand All @@ -15,6 +16,7 @@
import org.jruby.ir.transformations.inlining.SimpleCloneInfo;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public class BasicBlock implements ExplicitVertexID, Comparable {
Expand Down Expand Up @@ -250,7 +252,15 @@ public String toString() {
}

public String toStringInstrs() {
StringBuilder buf = new StringBuilder(toString()).append('\n');
StringBuilder buf = new StringBuilder(toString());

Collection<Edge<BasicBlock>> outs = cfg.getOutgoingEdges(this);
if (!outs.isEmpty()) {
for (Edge<BasicBlock> edge : outs) {
buf.append(" -" + edge.getType() + "->" + edge.getDestination().getID());
}
}
buf.append('\n');

for (Instr instr : getInstrs()) {
buf.append('\t').append(instr).append('\n');
Expand Down

0 comments on commit 4e8150d

Please sign in to comment.