64 * True if block {@code a} dominates block {@code b}. 65 */ 66 static boolean dominates(AbstractBlockBase<?> a, AbstractBlockBase<?> b) { 67 assert a != null && b != null; 68 return isDominatedBy(b, a); 69 } 70 71 /** 72 * Calculates the common dominator of two blocks. 73 * 74 * Note that this algorithm makes use of special properties regarding the numbering of blocks. 75 * 76 * @see #getBlocks() 77 * @see CFGVerifier 78 */ 79 static AbstractBlockBase<?> commonDominator(AbstractBlockBase<?> a, AbstractBlockBase<?> b) { 80 if (a == null) { 81 return b; 82 } else if (b == null) { 83 return a; 84 } else { 85 int aDomDepth = a.getDominatorDepth(); 86 int bDomDepth = b.getDominatorDepth(); 87 AbstractBlockBase<?> aTemp; 88 AbstractBlockBase<?> bTemp; 89 if (aDomDepth > bDomDepth) { 90 aTemp = a; 91 bTemp = b; 92 } else { 93 aTemp = b; 94 bTemp = a; 95 } 96 return commonDominatorHelper(aTemp, bTemp); 97 } 98 } 99 100 static AbstractBlockBase<?> commonDominatorHelper(AbstractBlockBase<?> a, AbstractBlockBase<?> b) { 101 int domNumberA = a.getDominatorNumber(); 102 AbstractBlockBase<?> result = b; 103 while (domNumberA < result.getDominatorNumber()) { | 64 * True if block {@code a} dominates block {@code b}. 65 */ 66 static boolean dominates(AbstractBlockBase<?> a, AbstractBlockBase<?> b) { 67 assert a != null && b != null; 68 return isDominatedBy(b, a); 69 } 70 71 /** 72 * Calculates the common dominator of two blocks. 73 * 74 * Note that this algorithm makes use of special properties regarding the numbering of blocks. 75 * 76 * @see #getBlocks() 77 * @see CFGVerifier 78 */ 79 static AbstractBlockBase<?> commonDominator(AbstractBlockBase<?> a, AbstractBlockBase<?> b) { 80 if (a == null) { 81 return b; 82 } else if (b == null) { 83 return a; 84 } else if (a == b) { 85 return a; 86 } else { 87 int aDomDepth = a.getDominatorDepth(); 88 int bDomDepth = b.getDominatorDepth(); 89 AbstractBlockBase<?> aTemp; 90 AbstractBlockBase<?> bTemp; 91 if (aDomDepth > bDomDepth) { 92 aTemp = a; 93 bTemp = b; 94 } else { 95 aTemp = b; 96 bTemp = a; 97 } 98 return commonDominatorHelper(aTemp, bTemp); 99 } 100 } 101 102 static AbstractBlockBase<?> commonDominatorHelper(AbstractBlockBase<?> a, AbstractBlockBase<?> b) { 103 int domNumberA = a.getDominatorNumber(); 104 AbstractBlockBase<?> result = b; 105 while (domNumberA < result.getDominatorNumber()) { |