259 superWordNodes(ADD_REDUCTION_VD, "AddReductionVD");
260 }
261
262 public static final String ADD_REDUCTION_VF = PREFIX + "ADD_REDUCTION_VF" + POSTFIX;
263 static {
264 superWordNodes(ADD_REDUCTION_VF, "AddReductionVF");
265 }
266
267 public static final String ADD_REDUCTION_VI = PREFIX + "ADD_REDUCTION_VI" + POSTFIX;
268 static {
269 superWordNodes(ADD_REDUCTION_VI, "AddReductionVI");
270 }
271
272 public static final String ADD_REDUCTION_VL = PREFIX + "ADD_REDUCTION_VL" + POSTFIX;
273 static {
274 superWordNodes(ADD_REDUCTION_VL, "AddReductionVL");
275 }
276
277 public static final String ALLOC = PREFIX + "ALLOC" + POSTFIX;
278 static {
279 String optoRegex = "(.*precise .*\\R((.*(?i:mov|mv|xorl|nop|spill).*|\\s*)\\R)*.*(?i:call,static).*wrapper for: _new_instance_Java" + END;
280 allocNodes(ALLOC, "Allocate", optoRegex);
281 }
282
283 public static final String ALLOC_OF = COMPOSITE_PREFIX + "ALLOC_OF" + POSTFIX;
284 static {
285 String regex = "(.*precise .*" + IS_REPLACED + ":.*\\R((.*(?i:mov|mv|xorl|nop|spill).*|\\s*)\\R)*.*(?i:call,static).*wrapper for: _new_instance_Java" + END;
286 optoOnly(ALLOC_OF, regex);
287 }
288
289 public static final String ALLOC_ARRAY = PREFIX + "ALLOC_ARRAY" + POSTFIX;
290 static {
291 String optoRegex = "(.*precise \\[.*\\R((.*(?i:mov|mv|xor|nop|spill).*|\\s*|.*(LGHI|LI).*)\\R)*.*(?i:call,static).*wrapper for: _new_array_Java" + END;
292 allocNodes(ALLOC_ARRAY, "AllocateArray", optoRegex);
293 }
294
295 public static final String ALLOC_ARRAY_OF = COMPOSITE_PREFIX + "ALLOC_ARRAY_OF" + POSTFIX;
296 static {
297 String regex = "(.*precise \\[.*" + IS_REPLACED + ":.*\\R((.*(?i:mov|mv|xorl|nop|spill).*|\\s*|.*(LGHI|LI).*)\\R)*.*(?i:call,static).*wrapper for: _new_array_Java" + END;
298 optoOnly(ALLOC_ARRAY_OF, regex);
299 }
300
301 public static final String AND = PREFIX + "AND" + POSTFIX;
302 static {
303 beforeMatchingNameRegex(AND, "And(I|L)");
304 }
305
306 public static final String AND_I = PREFIX + "AND_I" + POSTFIX;
307 static {
308 beforeMatchingNameRegex(AND_I, "AndI");
309 }
310
311 public static final String AND_L = PREFIX + "AND_L" + POSTFIX;
312 static {
313 beforeMatchingNameRegex(AND_L, "AndL");
314 }
315
316 public static final String AND_VB = VECTOR_PREFIX + "AND_VB" + POSTFIX;
317 static {
529 static {
530 String regex = "(.*Field: *" + END;
531 optoOnly(FIELD_ACCESS, regex);
532 }
533
534 public static final String FMA_VF = VECTOR_PREFIX + "FMA_VF" + POSTFIX;
535 static {
536 vectorNode(FMA_VF, "FmaVF", TYPE_FLOAT);
537 }
538
539 public static final String FMA_VD = VECTOR_PREFIX + "FMA_VD" + POSTFIX;
540 static {
541 vectorNode(FMA_VD, "FmaVD", TYPE_DOUBLE);
542 }
543
544 public static final String IF = PREFIX + "IF" + POSTFIX;
545 static {
546 beforeMatchingNameRegex(IF, "If\\b");
547 }
548
549 // Does not work for VM builds without JVMCI like x86_32 (a rule containing this regex will be skipped without having JVMCI built).
550 public static final String INTRINSIC_OR_TYPE_CHECKED_INLINING_TRAP = PREFIX + "INTRINSIC_OR_TYPE_CHECKED_INLINING_TRAP" + POSTFIX;
551 static {
552 trapNodes(INTRINSIC_OR_TYPE_CHECKED_INLINING_TRAP, "intrinsic_or_type_checked_inlining");
553 }
554
555 public static final String INTRINSIC_TRAP = PREFIX + "INTRINSIC_TRAP" + POSTFIX;
556 static {
557 trapNodes(INTRINSIC_TRAP, "intrinsic");
558 }
559
560 // Is only supported on riscv64.
561 public static final String IS_FINITE_D = PREFIX + "IS_FINITE_D" + POSTFIX;
562 static {
563 beforeMatchingNameRegex(IS_FINITE_D, "IsFiniteD");
564 }
565
566 // Is only supported on riscv64.
567 public static final String IS_FINITE_F = PREFIX + "IS_FINITE_F" + POSTFIX;
568 static {
2128 }
2129
2130 public static final String X86_TESTI_REG = PREFIX + "X86_TESTI_REG" + POSTFIX;
2131 static {
2132 machOnlyNameRegex(X86_TESTI_REG, "testI_reg");
2133 }
2134
2135 public static final String X86_TESTL_REG = PREFIX + "X86_TESTL_REG" + POSTFIX;
2136 static {
2137 machOnlyNameRegex(X86_TESTL_REG, "testL_reg");
2138 }
2139
2140 /*
2141 * Utility methods to set up IR_NODE_MAPPINGS.
2142 */
2143
2144 /**
2145 * Apply {@code regex} on all machine independent ideal graph phases up to and including
2146 * {@link CompilePhase#BEFORE_MATCHING}.
2147 */
2148 private static void beforeMatching(String irNodePlaceholder, String regex) {
2149 IR_NODE_MAPPINGS.put(irNodePlaceholder, new RegexTypeEntry(RegexType.IDEAL_INDEPENDENT, regex));
2150 }
2151
2152 /**
2153 * Apply {@code irNodeRegex} as regex for the IR node name on all machine independent ideal graph phases up to and
2154 * including {@link CompilePhase#BEFORE_MATCHING}.
2155 */
2156 private static void beforeMatchingNameRegex(String irNodePlaceholder, String irNodeRegex) {
2157 String regex = START + irNodeRegex + MID + END;
2158 IR_NODE_MAPPINGS.put(irNodePlaceholder, new RegexTypeEntry(RegexType.IDEAL_INDEPENDENT, regex));
2159 }
2160
2161 /**
2162 * Apply {@code irNodeRegex} as regex for the IR vector node name on all machine independent ideal graph phases up to and
2163 * including {@link CompilePhase#BEFORE_MATCHING}. Since this is a vector node, we can also check the vector element
2164 * type {@code typeString} and the vector size (number of elements), {@see VECTOR_SIZE}.
2165 */
2166 private static void vectorNode(String irNodePlaceholder, String irNodeRegex, String typeString) {
2167 TestFramework.check(isVectorIRNode(irNodePlaceholder), "vectorNode: failed prefix check for irNodePlaceholder "
2168 + irNodePlaceholder + " -> did you use VECTOR_PREFIX?");
2174
2175 private static void allocNodes(String irNode, String irNodeName, String optoRegex) {
2176 String idealIndependentRegex = START + irNodeName + "\\b" + MID + END;
2177 Map<PhaseInterval, String> intervalToRegexMap = new HashMap<>();
2178 intervalToRegexMap.put(new PhaseInterval(CompilePhase.BEFORE_REMOVEUSELESS, CompilePhase.PHASEIDEALLOOP_ITERATIONS),
2179 idealIndependentRegex);
2180 intervalToRegexMap.put(new PhaseInterval(CompilePhase.PRINT_OPTO_ASSEMBLY), optoRegex);
2181 MultiPhaseRangeEntry entry = new MultiPhaseRangeEntry(CompilePhase.PRINT_OPTO_ASSEMBLY, intervalToRegexMap);
2182 IR_NODE_MAPPINGS.put(irNode, entry);
2183 }
2184
2185 private static void callOfNodes(String irNodePlaceholder, String callRegex) {
2186 String regex = START + callRegex + MID + IS_REPLACED + " " + END;
2187 IR_NODE_MAPPINGS.put(irNodePlaceholder, new RegexTypeEntry(RegexType.IDEAL_INDEPENDENT, regex));
2188 }
2189
2190 /**
2191 * Apply {@code regex} on all machine dependant ideal graph phases (i.e. on the mach graph) starting from
2192 * {@link CompilePhase#MATCHING}.
2193 */
2194 private static void optoOnly(String irNodePlaceholder, String regex) {
2195 IR_NODE_MAPPINGS.put(irNodePlaceholder, new RegexTypeEntry(RegexType.OPTO_ASSEMBLY, regex));
2196 }
2197
2198 private static void machOnly(String irNodePlaceholder, String regex) {
2199 IR_NODE_MAPPINGS.put(irNodePlaceholder, new RegexTypeEntry(RegexType.MACH, regex));
2200 }
2201
2202 private static void machOnlyNameRegex(String irNodePlaceholder, String irNodeRegex) {
2203 String regex = START + irNodeRegex + MID + END;
2204 IR_NODE_MAPPINGS.put(irNodePlaceholder, new RegexTypeEntry(RegexType.MACH, regex));
2205 }
2206
2207 /**
2208 * Apply {@code regex} on all ideal graph phases starting from {@link CompilePhase#AFTER_CLOOPS}.
2209 */
2210 private static void fromAfterCountedLoops(String irNodePlaceholder, String regex) {
2211 IR_NODE_MAPPINGS.put(irNodePlaceholder, new SinglePhaseRangeEntry(CompilePhase.PRINT_IDEAL, regex,
2212 CompilePhase.AFTER_CLOOPS,
2213 CompilePhase.FINAL_CODE));
2214 }
|
259 superWordNodes(ADD_REDUCTION_VD, "AddReductionVD");
260 }
261
262 public static final String ADD_REDUCTION_VF = PREFIX + "ADD_REDUCTION_VF" + POSTFIX;
263 static {
264 superWordNodes(ADD_REDUCTION_VF, "AddReductionVF");
265 }
266
267 public static final String ADD_REDUCTION_VI = PREFIX + "ADD_REDUCTION_VI" + POSTFIX;
268 static {
269 superWordNodes(ADD_REDUCTION_VI, "AddReductionVI");
270 }
271
272 public static final String ADD_REDUCTION_VL = PREFIX + "ADD_REDUCTION_VL" + POSTFIX;
273 static {
274 superWordNodes(ADD_REDUCTION_VL, "AddReductionVL");
275 }
276
277 public static final String ALLOC = PREFIX + "ALLOC" + POSTFIX;
278 static {
279 String optoRegex = "(.*precise .*\\R((.*(?i:mov|mv|xorl|nop|spill|pushq|popq).*|\\s*)\\R)*.*(?i:call,static).*wrapper for: _new_instance_Java" + END;
280 allocNodes(ALLOC, "Allocate", optoRegex);
281 }
282
283 public static final String ALLOC_OF = COMPOSITE_PREFIX + "ALLOC_OF" + POSTFIX;
284 static {
285 String regex = "(.*precise .*" + IS_REPLACED + ":.*\\R((.*(?i:mov|mv|xorl|nop|spill|pushq|popq).*|\\s*)\\R)*.*(?i:call,static).*wrapper for: _new_instance_Java" + END;
286 optoOnly(ALLOC_OF, regex);
287 }
288
289 public static final String ALLOC_ARRAY = PREFIX + "ALLOC_ARRAY" + POSTFIX;
290 static {
291 String optoRegex = "(.*precise \\[.*\\R((.*(?i:mov|mv|xor|nop|spill|pushq|popq).*|\\s*|.*(LGHI|LI).*)\\R)*.*(?i:call,static).*wrapper for: _new_array_Java" + END;
292 allocNodes(ALLOC_ARRAY, "AllocateArray", optoRegex);
293 }
294
295 public static final String ALLOC_ARRAY_OF = COMPOSITE_PREFIX + "ALLOC_ARRAY_OF" + POSTFIX;
296 static {
297 String regex = "(.*precise \\[.*" + IS_REPLACED + ":.*\\R((.*(?i:mov|mv|xorl|nop|spill|pushq|popq).*|\\s*|.*(LGHI|LI).*)\\R)*.*(?i:call,static).*wrapper for: _new_array_Java" + END;
298 optoOnly(ALLOC_ARRAY_OF, regex);
299 }
300
301 public static final String AND = PREFIX + "AND" + POSTFIX;
302 static {
303 beforeMatchingNameRegex(AND, "And(I|L)");
304 }
305
306 public static final String AND_I = PREFIX + "AND_I" + POSTFIX;
307 static {
308 beforeMatchingNameRegex(AND_I, "AndI");
309 }
310
311 public static final String AND_L = PREFIX + "AND_L" + POSTFIX;
312 static {
313 beforeMatchingNameRegex(AND_L, "AndL");
314 }
315
316 public static final String AND_VB = VECTOR_PREFIX + "AND_VB" + POSTFIX;
317 static {
529 static {
530 String regex = "(.*Field: *" + END;
531 optoOnly(FIELD_ACCESS, regex);
532 }
533
534 public static final String FMA_VF = VECTOR_PREFIX + "FMA_VF" + POSTFIX;
535 static {
536 vectorNode(FMA_VF, "FmaVF", TYPE_FLOAT);
537 }
538
539 public static final String FMA_VD = VECTOR_PREFIX + "FMA_VD" + POSTFIX;
540 static {
541 vectorNode(FMA_VD, "FmaVD", TYPE_DOUBLE);
542 }
543
544 public static final String IF = PREFIX + "IF" + POSTFIX;
545 static {
546 beforeMatchingNameRegex(IF, "If\\b");
547 }
548
549 public static final String INLINE_TYPE = PREFIX + "INLINE_TYPE" + POSTFIX;
550 static {
551 beforeMatchingNameRegex(INLINE_TYPE, "InlineType");
552 }
553
554 // Does not work for VM builds without JVMCI like x86_32 (a rule containing this regex will be skipped without having JVMCI built).
555 public static final String INTRINSIC_OR_TYPE_CHECKED_INLINING_TRAP = PREFIX + "INTRINSIC_OR_TYPE_CHECKED_INLINING_TRAP" + POSTFIX;
556 static {
557 trapNodes(INTRINSIC_OR_TYPE_CHECKED_INLINING_TRAP, "intrinsic_or_type_checked_inlining");
558 }
559
560 public static final String INTRINSIC_TRAP = PREFIX + "INTRINSIC_TRAP" + POSTFIX;
561 static {
562 trapNodes(INTRINSIC_TRAP, "intrinsic");
563 }
564
565 // Is only supported on riscv64.
566 public static final String IS_FINITE_D = PREFIX + "IS_FINITE_D" + POSTFIX;
567 static {
568 beforeMatchingNameRegex(IS_FINITE_D, "IsFiniteD");
569 }
570
571 // Is only supported on riscv64.
572 public static final String IS_FINITE_F = PREFIX + "IS_FINITE_F" + POSTFIX;
573 static {
2133 }
2134
2135 public static final String X86_TESTI_REG = PREFIX + "X86_TESTI_REG" + POSTFIX;
2136 static {
2137 machOnlyNameRegex(X86_TESTI_REG, "testI_reg");
2138 }
2139
2140 public static final String X86_TESTL_REG = PREFIX + "X86_TESTL_REG" + POSTFIX;
2141 static {
2142 machOnlyNameRegex(X86_TESTL_REG, "testL_reg");
2143 }
2144
2145 /*
2146 * Utility methods to set up IR_NODE_MAPPINGS.
2147 */
2148
2149 /**
2150 * Apply {@code regex} on all machine independent ideal graph phases up to and including
2151 * {@link CompilePhase#BEFORE_MATCHING}.
2152 */
2153 public static void beforeMatching(String irNodePlaceholder, String regex) {
2154 IR_NODE_MAPPINGS.put(irNodePlaceholder, new RegexTypeEntry(RegexType.IDEAL_INDEPENDENT, regex));
2155 }
2156
2157 /**
2158 * Apply {@code irNodeRegex} as regex for the IR node name on all machine independent ideal graph phases up to and
2159 * including {@link CompilePhase#BEFORE_MATCHING}.
2160 */
2161 private static void beforeMatchingNameRegex(String irNodePlaceholder, String irNodeRegex) {
2162 String regex = START + irNodeRegex + MID + END;
2163 IR_NODE_MAPPINGS.put(irNodePlaceholder, new RegexTypeEntry(RegexType.IDEAL_INDEPENDENT, regex));
2164 }
2165
2166 /**
2167 * Apply {@code irNodeRegex} as regex for the IR vector node name on all machine independent ideal graph phases up to and
2168 * including {@link CompilePhase#BEFORE_MATCHING}. Since this is a vector node, we can also check the vector element
2169 * type {@code typeString} and the vector size (number of elements), {@see VECTOR_SIZE}.
2170 */
2171 private static void vectorNode(String irNodePlaceholder, String irNodeRegex, String typeString) {
2172 TestFramework.check(isVectorIRNode(irNodePlaceholder), "vectorNode: failed prefix check for irNodePlaceholder "
2173 + irNodePlaceholder + " -> did you use VECTOR_PREFIX?");
2179
2180 private static void allocNodes(String irNode, String irNodeName, String optoRegex) {
2181 String idealIndependentRegex = START + irNodeName + "\\b" + MID + END;
2182 Map<PhaseInterval, String> intervalToRegexMap = new HashMap<>();
2183 intervalToRegexMap.put(new PhaseInterval(CompilePhase.BEFORE_REMOVEUSELESS, CompilePhase.PHASEIDEALLOOP_ITERATIONS),
2184 idealIndependentRegex);
2185 intervalToRegexMap.put(new PhaseInterval(CompilePhase.PRINT_OPTO_ASSEMBLY), optoRegex);
2186 MultiPhaseRangeEntry entry = new MultiPhaseRangeEntry(CompilePhase.PRINT_OPTO_ASSEMBLY, intervalToRegexMap);
2187 IR_NODE_MAPPINGS.put(irNode, entry);
2188 }
2189
2190 private static void callOfNodes(String irNodePlaceholder, String callRegex) {
2191 String regex = START + callRegex + MID + IS_REPLACED + " " + END;
2192 IR_NODE_MAPPINGS.put(irNodePlaceholder, new RegexTypeEntry(RegexType.IDEAL_INDEPENDENT, regex));
2193 }
2194
2195 /**
2196 * Apply {@code regex} on all machine dependant ideal graph phases (i.e. on the mach graph) starting from
2197 * {@link CompilePhase#MATCHING}.
2198 */
2199 public static void optoOnly(String irNodePlaceholder, String regex) {
2200 IR_NODE_MAPPINGS.put(irNodePlaceholder, new RegexTypeEntry(RegexType.OPTO_ASSEMBLY, regex));
2201 }
2202
2203 private static void machOnly(String irNodePlaceholder, String regex) {
2204 IR_NODE_MAPPINGS.put(irNodePlaceholder, new RegexTypeEntry(RegexType.MACH, regex));
2205 }
2206
2207 private static void machOnlyNameRegex(String irNodePlaceholder, String irNodeRegex) {
2208 String regex = START + irNodeRegex + MID + END;
2209 IR_NODE_MAPPINGS.put(irNodePlaceholder, new RegexTypeEntry(RegexType.MACH, regex));
2210 }
2211
2212 /**
2213 * Apply {@code regex} on all ideal graph phases starting from {@link CompilePhase#AFTER_CLOOPS}.
2214 */
2215 private static void fromAfterCountedLoops(String irNodePlaceholder, String regex) {
2216 IR_NODE_MAPPINGS.put(irNodePlaceholder, new SinglePhaseRangeEntry(CompilePhase.PRINT_IDEAL, regex,
2217 CompilePhase.AFTER_CLOOPS,
2218 CompilePhase.FINAL_CODE));
2219 }
|