src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/cfg/AbstractBlockBase.java
equal
deleted
inserted
replaced
92 |
92 |
93 public T getDominator() { |
93 public T getDominator() { |
94 return dominator; |
94 return dominator; |
95 } |
95 } |
96 |
96 |
|
97 /** |
|
98 * Returns the next dominator of this block that is either in the same loop of this block or in |
|
99 * an outer loop. |
|
100 * |
|
101 * @return the next dominator while skipping over loops |
|
102 */ |
|
103 public T getDominatorSkipLoops() { |
|
104 T d = getDominator(); |
|
105 |
|
106 if (d == null) { |
|
107 // We are at the start block and don't have a dominator. |
|
108 return null; |
|
109 } |
|
110 |
|
111 if (isLoopHeader()) { |
|
112 // We are moving out of current loop => just return dominator. |
|
113 assert d.getLoopDepth() == getLoopDepth() - 1; |
|
114 assert d.getLoop() != getLoop(); |
|
115 return d; |
|
116 } |
|
117 |
|
118 while (d.getLoop() != getLoop()) { |
|
119 // We have a case where our dominator is in a different loop. Move further along |
|
120 // the domiantor tree until we hit our loop again. |
|
121 d = d.getDominator(); |
|
122 } |
|
123 |
|
124 assert d.getLoopDepth() <= getLoopDepth(); |
|
125 |
|
126 return d; |
|
127 } |
|
128 |
97 public void setDominator(T dominator) { |
129 public void setDominator(T dominator) { |
98 this.dominator = dominator; |
130 this.dominator = dominator; |
99 this.domDepth = dominator.domDepth + 1; |
131 this.domDepth = dominator.domDepth + 1; |
100 } |
132 } |
101 |
133 |