1 /*
   2  * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 package compiler.lib.ir_framework;
  25 
  26 import compiler.lib.ir_framework.driver.irmatching.mapping.*;
  27 import compiler.lib.ir_framework.driver.irmatching.parser.VMInfo;
  28 import compiler.lib.ir_framework.shared.CheckedTestFrameworkException;
  29 import compiler.lib.ir_framework.shared.TestFormat;
  30 import compiler.lib.ir_framework.shared.TestFormatException;
  31 import jdk.test.lib.Platform;
  32 import jdk.test.whitebox.WhiteBox;
  33 
  34 import java.util.HashMap;
  35 import java.util.Map;
  36 
  37 /**
  38  * This class specifies IR node placeholder strings (also referred to as just "IR nodes") with mappings to regexes
  39  * depending on the selected compile phases. The mappings are stored in {@link #IR_NODE_MAPPINGS}. Each IR node
  40  * placeholder string is mapped to a {@link IRNodeMapEntry} instance defined in
  41  * {@link compiler.lib.ir_framework.driver.irmatching.mapping}.
  42  *
  43  * <p>
  44  * IR node placeholder strings can be used in {@link IR#failOn()} and/or {@link IR#counts()} attributes to define IR
  45  * constraints. They usually represent a single C2 IR node or a group of them.
  46  *
  47  * <p>
  48  * Each IR node placeholder string is accompanied by a static block that defines an IR node placeholder to regex(es)
  49  * mapping. The IR framework will automatically replace each IR node placeholder string in a user defined test with a
  50  * regex depending on the selected compile phases in {@link IR#phase} and the provided mapping.
  51  *
  52  * <p>
  53  * Each mapping must define a default compile phase which is applied when the user does not explicitly set the
  54  * {@link IR#phase()} attribute or when directly using {@link CompilePhase#DEFAULT}. In this case, the IR framework
  55  * falls back on the default compile phase of any {@link IRNodeMapEntry}.
  56  *
  57  * <p>
  58  * The IR framework reports a {@link TestFormatException} if:
  59  * <ul>
  60  *     <li><p> A user test specifies a compile phase for which no mapping is defined in this class.</li>
  61  *     <li><p> An IR node placeholder string is either missing a mapping or does not provide a regex for a specified
  62  *             compile phase in {@link IR#phase}.
  63  * </ul>
  64  *
  65  * <p>
  66  * There are two types of IR nodes:
  67  * <ul>
  68  *     <li><p>Normal IR nodes: The IR node placeholder string is directly replaced by a regex.</li>
  69  *     <li><p>Composite IR nodes:  The IR node placeholder string contains an additional {@link #COMPOSITE_PREFIX}.
  70  *                                 Using this IR node expects another user provided string in the constraint list of
  71  *                                 {@link IR#failOn()} and {@link IR#counts()}. They cannot be used as normal IR nodes.
  72  *                                 Trying to do so will result in a format violation error.</li>
  73  *     <li><p>Vector IR nodes:  The IR node placeholder string contains an additional {@link #VECTOR_PREFIX}.
  74  *                              Using this IR node, one can check for the type and size of a vector. The type must
  75  *                              be directly specified in {@link #vectorNode}. The size can be specified directly with
  76  *                              an additional argument using {@link #VECTOR_SIZE}, followed by a size tag or a comma
  77  *                              separated list of sizes. If the size argument is not given, then a default size of
  78  *                              {@link #VECTOR_SIZE_MAX} is taken, which is the number of elements that can fit in a
  79  *                              vector of the specified type (depends on the VM flag MaxVectorSize and CPU features).
  80  *                              However, when using {@link IR#failOn} or {@link IR#counts()} with comparison {@code <},
  81  *                              or {@code <=} or {@code =0}, the default size is {@link #VECTOR_SIZE_ANY}, allowing any
  82  *                              size. The motivation for these default values is that in most cases one wants to have
  83  *                              vectorization with maximal vector width, or no vectorization of any vector width.
  84  * </ul>
  85  */
  86 public class IRNode {
  87     /**
  88      * Prefix for normal IR nodes.
  89      */
  90     private static final String PREFIX = "_#";
  91     /**
  92      * Prefix for composite IR nodes.
  93      */
  94     private static final String COMPOSITE_PREFIX = PREFIX + "C#";
  95     /**
  96      * Prefix for vector IR nodes.
  97      */
  98     private static final String VECTOR_PREFIX = PREFIX + "V#";
  99 
 100     private static final String POSTFIX = "#_";
 101 
 102     private static final String START = "(\\d+(\\s){2}(";
 103     private static final String MID = ".*)+(\\s){2}===.*";
 104     private static final String END = ")";
 105     private static final String STORE_OF_CLASS_POSTFIX = "(:|\\+)\\S* \\*" + END;
 106     private static final String LOAD_OF_CLASS_POSTFIX = "(:|\\+)\\S* \\*" + END;
 107 
 108     public static final String IS_REPLACED = "#IS_REPLACED#"; // Is replaced by an additional user-defined string.
 109 
 110     public static final String VECTOR_SIZE = "_@";
 111     public static final String VECTOR_SIZE_TAG_ANY = "any";
 112     public static final String VECTOR_SIZE_TAG_MAX = "max_for_type";
 113     public static final String VECTOR_SIZE_ANY = VECTOR_SIZE + VECTOR_SIZE_TAG_ANY; // default for counts "=0" and failOn
 114     public static final String VECTOR_SIZE_MAX = VECTOR_SIZE + VECTOR_SIZE_TAG_MAX; // default in counts
 115     public static final String VECTOR_SIZE_2   = VECTOR_SIZE + "2";
 116     public static final String VECTOR_SIZE_4   = VECTOR_SIZE + "4";
 117     public static final String VECTOR_SIZE_8   = VECTOR_SIZE + "8";
 118     public static final String VECTOR_SIZE_16  = VECTOR_SIZE + "16";
 119     public static final String VECTOR_SIZE_32  = VECTOR_SIZE + "32";
 120     public static final String VECTOR_SIZE_64  = VECTOR_SIZE + "64";
 121 
 122     private static final String TYPE_BYTE   = "B";
 123     private static final String TYPE_CHAR   = "C";
 124     private static final String TYPE_SHORT  = "S";
 125     private static final String TYPE_INT    = "I";
 126     private static final String TYPE_LONG   = "J";
 127     private static final String TYPE_FLOAT  = "F";
 128     private static final String TYPE_DOUBLE = "D";
 129 
 130     /**
 131      * IR placeholder string to regex-for-compile-phase map.
 132      */
 133     private static final Map<String, IRNodeMapEntry> IR_NODE_MAPPINGS = new HashMap<>();
 134 
 135     /**
 136      * Map every vectorNode to a type string.
 137      */
 138     private static final Map<String, String> VECTOR_NODE_TYPE = new HashMap<>();
 139 
 140     /*
 141      * Start of IR placeholder string definitions followed by a static block defining the regex-for-compile-phase mapping.
 142      * An IR node placeholder string must start with PREFIX for normal IR nodes or COMPOSITE_PREFIX for composite IR
 143      * nodes, or VECTOR_PREFIX for vector nodes (see class description above).
 144      *
 145      * An IR node definition looks like this:
 146      *
 147      * public static final String IR_NODE = [PREFIX|COMPOSITE_PREFIX|VECTOR_PREFIX] + "IR_NODE" + POSTFIX;
 148      * static {
 149      *    // Define IR_NODE to regex-for-compile-phase mapping. Create a new IRNodeMapEntry object and add it to
 150      *    // IR_NODE_MAPPINGS. This can be done by using the helper methods defined after all IR node placeholder string
 151      *    // definitions.
 152      * }
 153      */
 154 
 155     public static final String ABS_D = PREFIX + "ABS_D" + POSTFIX;
 156     static {
 157         beforeMatchingNameRegex(ABS_D, "AbsD");
 158     }
 159 
 160     public static final String ABS_F = PREFIX + "ABS_F" + POSTFIX;
 161     static {
 162         beforeMatchingNameRegex(ABS_F, "AbsF");
 163     }
 164 
 165     public static final String ABS_I = PREFIX + "ABS_I" + POSTFIX;
 166     static {
 167         beforeMatchingNameRegex(ABS_I, "AbsI");
 168     }
 169 
 170     public static final String ABS_L = PREFIX + "ABS_L" + POSTFIX;
 171     static {
 172         beforeMatchingNameRegex(ABS_L, "AbsL");
 173     }
 174 
 175     public static final String ABS_VB = VECTOR_PREFIX + "ABS_VB" + POSTFIX;
 176     static {
 177         vectorNode(ABS_VB, "AbsVB", TYPE_BYTE);
 178     }
 179 
 180     // ABS_VC / AbsVC does not exist (char is 2 byte unsigned)
 181 
 182     public static final String ABS_VS = VECTOR_PREFIX + "ABS_VS" + POSTFIX;
 183     static {
 184         vectorNode(ABS_VS, "AbsVS", TYPE_SHORT);
 185     }
 186 
 187     public static final String ABS_VI = VECTOR_PREFIX + "ABS_VI" + POSTFIX;
 188     static {
 189         vectorNode(ABS_VI, "AbsVI", TYPE_INT);
 190     }
 191 
 192     public static final String ABS_VL = VECTOR_PREFIX + "ABS_VL" + POSTFIX;
 193     static {
 194         vectorNode(ABS_VL, "AbsVL", TYPE_LONG);
 195     }
 196 
 197     public static final String ABS_VF = VECTOR_PREFIX + "ABS_VF" + POSTFIX;
 198     static {
 199         vectorNode(ABS_VF, "AbsVF", TYPE_FLOAT);
 200     }
 201 
 202     public static final String ABS_VD = VECTOR_PREFIX + "ABS_VD" + POSTFIX;
 203     static {
 204         vectorNode(ABS_VD, "AbsVD", TYPE_DOUBLE);
 205     }
 206 
 207     public static final String ADD = PREFIX + "ADD" + POSTFIX;
 208     static {
 209         beforeMatchingNameRegex(ADD, "Add(I|L|F|D|P)");
 210     }
 211 
 212     public static final String ADD_I = PREFIX + "ADD_I" + POSTFIX;
 213     static {
 214         beforeMatchingNameRegex(ADD_I, "AddI");
 215     }
 216 
 217     public static final String ADD_L = PREFIX + "ADD_L" + POSTFIX;
 218     static {
 219         beforeMatchingNameRegex(ADD_L, "AddL");
 220     }
 221 
 222     public static final String ADD_VD = VECTOR_PREFIX + "ADD_VD" + POSTFIX;
 223     static {
 224         vectorNode(ADD_VD, "AddVD", TYPE_DOUBLE);
 225     }
 226 
 227     public static final String ADD_VI = VECTOR_PREFIX + "ADD_VI" + POSTFIX;
 228     static {
 229         vectorNode(ADD_VI, "AddVI", TYPE_INT);
 230     }
 231 
 232     public static final String ADD_VF = VECTOR_PREFIX + "ADD_VF" + POSTFIX;
 233     static {
 234         vectorNode(ADD_VF, "AddVF", TYPE_FLOAT);
 235     }
 236 
 237     public static final String ADD_VB = VECTOR_PREFIX + "ADD_VB" + POSTFIX;
 238     static {
 239         vectorNode(ADD_VB, "AddVB", TYPE_BYTE);
 240     }
 241 
 242     public static final String ADD_VS = VECTOR_PREFIX + "ADD_VS" + POSTFIX;
 243     static {
 244         vectorNode(ADD_VS, "AddVS", TYPE_SHORT);
 245     }
 246 
 247     public static final String ADD_VL = VECTOR_PREFIX + "ADD_VL" + POSTFIX;
 248     static {
 249         vectorNode(ADD_VL, "AddVL", TYPE_LONG);
 250     }
 251 
 252     public static final String ADD_REDUCTION_V = PREFIX + "ADD_REDUCTION_V" + POSTFIX;
 253     static {
 254         beforeMatchingNameRegex(ADD_REDUCTION_V, "AddReductionV(B|S|I|L|F|D)");
 255     }
 256 
 257     public static final String ADD_REDUCTION_VD = PREFIX + "ADD_REDUCTION_VD" + POSTFIX;
 258     static {
 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: C2 Runtime new_instance" + 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: C2 Runtime new_instance" + 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: C2 Runtime new_array" + 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: C2 Runtime new_array" + END;
 298         optoOnly(ALLOC_ARRAY_OF, regex);
 299     }
 300 
 301     public static final String OR = PREFIX + "OR" + POSTFIX;
 302     static {
 303         beforeMatchingNameRegex(OR, "Or(I|L)");
 304     }
 305 
 306     public static final String AND = PREFIX + "AND" + POSTFIX;
 307     static {
 308         beforeMatchingNameRegex(AND, "And(I|L)");
 309     }
 310 
 311     public static final String AND_I = PREFIX + "AND_I" + POSTFIX;
 312     static {
 313         beforeMatchingNameRegex(AND_I, "AndI");
 314     }
 315 
 316     public static final String AND_L = PREFIX + "AND_L" + POSTFIX;
 317     static {
 318         beforeMatchingNameRegex(AND_L, "AndL");
 319     }
 320 
 321     public static final String AND_VB = VECTOR_PREFIX + "AND_VB" + POSTFIX;
 322     static {
 323         vectorNode(AND_VB, "AndV", TYPE_BYTE);
 324     }
 325 
 326     public static final String AND_VC = VECTOR_PREFIX + "AND_VC" + POSTFIX;
 327     static {
 328         vectorNode(AND_VC, "AndV", TYPE_CHAR);
 329     }
 330 
 331     public static final String AND_VS = VECTOR_PREFIX + "AND_VS" + POSTFIX;
 332     static {
 333         vectorNode(AND_VS, "AndV", TYPE_SHORT);
 334     }
 335 
 336     public static final String AND_VI = VECTOR_PREFIX + "AND_VI" + POSTFIX;
 337     static {
 338         vectorNode(AND_VI, "AndV", TYPE_INT);
 339     }
 340 
 341     public static final String AND_VL = VECTOR_PREFIX + "AND_VL" + POSTFIX;
 342     static {
 343         vectorNode(AND_VL, "AndV", TYPE_LONG);
 344     }
 345 
 346     public static final String AND_V_MASK = PREFIX + "AND_V_MASK" + POSTFIX;
 347     static {
 348         beforeMatchingNameRegex(AND_V_MASK, "AndVMask");
 349     }
 350 
 351     public static final String AND_REDUCTION_V = PREFIX + "AND_REDUCTION_V" + POSTFIX;
 352     static {
 353         superWordNodes(AND_REDUCTION_V, "AndReductionV");
 354     }
 355 
 356     public static final String CALL = PREFIX + "CALL" + POSTFIX;
 357     static {
 358         beforeMatchingNameRegex(CALL, "Call.*Java");
 359     }
 360 
 361     public static final String CALL_OF = COMPOSITE_PREFIX + "CALL_OF" + POSTFIX;
 362     static {
 363         callOfNodes(CALL_OF, "Call.*");
 364     }
 365 
 366     public static final String CALL_OF_METHOD = COMPOSITE_PREFIX + "CALL_OF_METHOD" + POSTFIX;
 367     static {
 368         callOfNodes(CALL_OF_METHOD, "Call.*Java");
 369     }
 370 
 371     public static final String STATIC_CALL_OF_METHOD = COMPOSITE_PREFIX + "STATIC_CALL_OF_METHOD" + POSTFIX;
 372     static {
 373         callOfNodes(STATIC_CALL_OF_METHOD, "CallStaticJava");
 374     }
 375 
 376     public static final String CAST_II = PREFIX + "CAST_II" + POSTFIX;
 377     static {
 378         beforeMatchingNameRegex(CAST_II, "CastII");
 379     }
 380 
 381     public static final String CAST_LL = PREFIX + "CAST_LL" + POSTFIX;
 382     static {
 383         beforeMatchingNameRegex(CAST_LL, "CastLL");
 384     }
 385 
 386     public static final String CBNZW_HI = PREFIX + "CBNZW_HI" + POSTFIX;
 387     static {
 388         optoOnly(CBNZW_HI, "cbwhi");
 389     }
 390 
 391     public static final String CBZW_LS = PREFIX + "CBZW_LS" + POSTFIX;
 392     static {
 393         optoOnly(CBZW_LS, "cbwls");
 394     }
 395 
 396     public static final String CBZ_LS = PREFIX + "CBZ_LS" + POSTFIX;
 397     static {
 398         optoOnly(CBZ_LS, "cbls");
 399     }
 400 
 401     public static final String CBZ_HI = PREFIX + "CBZ_HI" + POSTFIX;
 402     static {
 403         optoOnly(CBZ_HI, "cbhi");
 404     }
 405 
 406     public static final String CHECKCAST_ARRAY = PREFIX + "CHECKCAST_ARRAY" + POSTFIX;
 407     static {
 408         String regex = "(((?i:cmp|CLFI|CLR).*precise \\[.*:|.*(?i:mov|mv|or).*precise \\[.*:.*\\R.*(cmp|CMP|CLR))" + END;
 409         optoOnly(CHECKCAST_ARRAY, regex);
 410     }
 411 
 412     public static final String CHECKCAST_ARRAY_OF = COMPOSITE_PREFIX + "CHECKCAST_ARRAY_OF" + POSTFIX;
 413     static {
 414         String regex = "(((?i:cmp|CLFI|CLR).*precise \\[.*" + IS_REPLACED + ":|.*(?i:mov|mv|or).*precise \\[.*" + IS_REPLACED + ":.*\\R.*(cmp|CMP|CLR))" + END;
 415         optoOnly(CHECKCAST_ARRAY_OF, regex);
 416     }
 417 
 418     // Does not work on s390 (a rule containing this regex will be skipped on s390).
 419     public static final String CHECKCAST_ARRAYCOPY = PREFIX + "CHECKCAST_ARRAYCOPY" + POSTFIX;
 420     static {
 421         String regex = "(.*((?i:call_leaf_nofp,runtime)|CALL,\\s?runtime leaf nofp|BCTRL.*.leaf call).*checkcast_arraycopy.*" + END;
 422         optoOnly(CHECKCAST_ARRAYCOPY, regex);
 423     }
 424 
 425     public static final String CLASS_CHECK_TRAP = PREFIX + "CLASS_CHECK_TRAP" + POSTFIX;
 426     static {
 427         trapNodes(CLASS_CHECK_TRAP, "class_check");
 428     }
 429 
 430     public static final String CMOVE_I = PREFIX + "CMOVE_I" + POSTFIX;
 431     static {
 432         beforeMatchingNameRegex(CMOVE_I, "CMoveI");
 433     }
 434 
 435     public static final String CMP_I = PREFIX + "CMP_I" + POSTFIX;
 436     static {
 437         beforeMatchingNameRegex(CMP_I, "CmpI");
 438     }
 439 
 440     public static final String CMP_L = PREFIX + "CMP_L" + POSTFIX;
 441     static {
 442         beforeMatchingNameRegex(CMP_L, "CmpL");
 443     }
 444 
 445     public static final String CMP_U = PREFIX + "CMP_U" + POSTFIX;
 446     static {
 447         beforeMatchingNameRegex(CMP_U, "CmpU\\b");
 448     }
 449 
 450     public static final String CMP_U3 = PREFIX + "CMP_U3" + POSTFIX;
 451     static {
 452         beforeMatchingNameRegex(CMP_U3, "CmpU3");
 453     }
 454 
 455     public static final String CMP_UL = PREFIX + "CMP_UL" + POSTFIX;
 456     static {
 457         beforeMatchingNameRegex(CMP_UL, "CmpUL");
 458     }
 459 
 460     public static final String CMP_UL3 = PREFIX + "CMP_UL3" + POSTFIX;
 461     static {
 462         beforeMatchingNameRegex(CMP_UL3, "CmpUL3");
 463     }
 464 
 465     public static final String CMP_P = PREFIX + "CMP_P" + POSTFIX;
 466     static {
 467         beforeMatchingNameRegex(CMP_P, "CmpP");
 468     }
 469 
 470     public static final String COMPRESS_BITS = PREFIX + "COMPRESS_BITS" + POSTFIX;
 471     static {
 472         beforeMatchingNameRegex(COMPRESS_BITS, "CompressBits");
 473     }
 474 
 475     public static final String CONV = PREFIX + "CONV" + POSTFIX;
 476     static {
 477         beforeMatchingNameRegex(CONV, "Conv");
 478     }
 479 
 480     public static final String CONV_I2L = PREFIX + "CONV_I2L" + POSTFIX;
 481     static {
 482         beforeMatchingNameRegex(CONV_I2L, "ConvI2L");
 483     }
 484 
 485     public static final String CONV_L2I = PREFIX + "CONV_L2I" + POSTFIX;
 486     static {
 487         beforeMatchingNameRegex(CONV_L2I, "ConvL2I");
 488     }
 489 
 490     public static final String CON_I = PREFIX + "CON_I" + POSTFIX;
 491     static {
 492         beforeMatchingNameRegex(CON_I, "ConI");
 493     }
 494 
 495     public static final String CON_L = PREFIX + "CON_L" + POSTFIX;
 496     static {
 497         beforeMatchingNameRegex(CON_L, "ConL");
 498     }
 499 
 500     public static final String COUNTED_LOOP = PREFIX + "COUNTED_LOOP" + POSTFIX;
 501     static {
 502         String regex = START + "CountedLoop\\b" + MID + END;
 503         fromAfterCountedLoops(COUNTED_LOOP, regex);
 504     }
 505 
 506     public static final String COUNTED_LOOP_MAIN = PREFIX + "COUNTED_LOOP_MAIN" + POSTFIX;
 507     static {
 508         String regex = START + "CountedLoop\\b" + MID + "main" + END;
 509         fromAfterCountedLoops(COUNTED_LOOP_MAIN, regex);
 510     }
 511 
 512     public static final String DIV = PREFIX + "DIV" + POSTFIX;
 513     static {
 514         beforeMatchingNameRegex(DIV, "Div(I|L|F|D)");
 515     }
 516 
 517     public static final String DIV_BY_ZERO_TRAP = PREFIX + "DIV_BY_ZERO_TRAP" + POSTFIX;
 518     static {
 519         trapNodes(DIV_BY_ZERO_TRAP, "div0_check");
 520     }
 521 
 522     public static final String DIV_I = PREFIX + "DIV_I" + POSTFIX;
 523     static {
 524         beforeMatchingNameRegex(DIV_I, "DivI");
 525     }
 526 
 527     public static final String DIV_L = PREFIX + "DIV_L" + POSTFIX;
 528     static {
 529         beforeMatchingNameRegex(DIV_L, "DivL");
 530     }
 531 
 532     public static final String DIV_MOD_I = PREFIX + "DIV_MOD_I" + POSTFIX;
 533     static {
 534         beforeMatchingNameRegex(DIV_MOD_I, "DivModI");
 535     }
 536 
 537     public static final String DIV_MOD_L = PREFIX + "DIV_MOD_L" + POSTFIX;
 538     static {
 539         beforeMatchingNameRegex(DIV_MOD_L, "DivModL");
 540     }
 541 
 542     public static final String DIV_VF = VECTOR_PREFIX + "DIV_VF" + POSTFIX;
 543     static {
 544         vectorNode(DIV_VF, "DivVF", TYPE_FLOAT);
 545     }
 546 
 547     public static final String DIV_VD = VECTOR_PREFIX + "DIV_VD" + POSTFIX;
 548     static {
 549         vectorNode(DIV_VD, "DivVD", TYPE_DOUBLE);
 550     }
 551 
 552     public static final String DYNAMIC_CALL_OF_METHOD = COMPOSITE_PREFIX + "DYNAMIC_CALL_OF_METHOD" + POSTFIX;
 553     static {
 554         callOfNodes(DYNAMIC_CALL_OF_METHOD, "CallDynamicJava");
 555     }
 556 
 557     public static final String EXPAND_BITS = PREFIX + "EXPAND_BITS" + POSTFIX;
 558     static {
 559         beforeMatchingNameRegex(EXPAND_BITS, "ExpandBits");
 560     }
 561 
 562     public static final String FAST_LOCK = PREFIX + "FAST_LOCK" + POSTFIX;
 563     static {
 564         beforeMatchingNameRegex(FAST_LOCK, "FastLock");
 565     }
 566 
 567     public static final String FAST_UNLOCK = PREFIX + "FAST_UNLOCK" + POSTFIX;
 568     static {
 569         String regex = START + "FastUnlock" + MID + END;
 570         fromMacroToBeforeMatching(FAST_UNLOCK, regex);
 571     }
 572 
 573     public static final String FIELD_ACCESS = PREFIX + "FIELD_ACCESS" + POSTFIX;
 574     static {
 575         String regex = "(.*Field: *" + END;
 576         optoOnly(FIELD_ACCESS, regex);
 577     }
 578 
 579     public static final String FMA_VF = VECTOR_PREFIX + "FMA_VF" + POSTFIX;
 580     static {
 581         vectorNode(FMA_VF, "FmaVF", TYPE_FLOAT);
 582     }
 583 
 584     public static final String FMA_VD = VECTOR_PREFIX + "FMA_VD" + POSTFIX;
 585     static {
 586         vectorNode(FMA_VD, "FmaVD", TYPE_DOUBLE);
 587     }
 588 
 589     public static final String G1_COMPARE_AND_EXCHANGE_N_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "G1_COMPARE_AND_EXCHANGE_N_WITH_BARRIER_FLAG" + POSTFIX;
 590     static {
 591         String regex = START + "g1CompareAndExchangeN\\S*" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END;
 592         machOnly(G1_COMPARE_AND_EXCHANGE_N_WITH_BARRIER_FLAG, regex);
 593     }
 594 
 595     public static final String G1_COMPARE_AND_EXCHANGE_P_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "G1_COMPARE_AND_EXCHANGE_P_WITH_BARRIER_FLAG" + POSTFIX;
 596     static {
 597         String regex = START + "g1CompareAndExchangeP\\S*" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END;
 598         machOnly(G1_COMPARE_AND_EXCHANGE_P_WITH_BARRIER_FLAG, regex);
 599     }
 600 
 601     public static final String G1_COMPARE_AND_SWAP_N_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "G1_COMPARE_AND_SWAP_N_WITH_BARRIER_FLAG" + POSTFIX;
 602     static {
 603         String regex = START + "g1CompareAndSwapN\\S*" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END;
 604         machOnly(G1_COMPARE_AND_SWAP_N_WITH_BARRIER_FLAG, regex);
 605     }
 606 
 607     public static final String G1_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "G1_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG" + POSTFIX;
 608     static {
 609         String regex = START + "g1CompareAndSwapP\\S*" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END;
 610         machOnly(G1_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG, regex);
 611     }
 612 
 613     public static final String G1_ENCODE_P_AND_STORE_N = PREFIX + "G1_ENCODE_P_AND_STORE_N" + POSTFIX;
 614     static {
 615         machOnlyNameRegex(G1_ENCODE_P_AND_STORE_N, "g1EncodePAndStoreN");
 616     }
 617 
 618     public static final String G1_ENCODE_P_AND_STORE_N_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "G1_ENCODE_P_AND_STORE_N_WITH_BARRIER_FLAG" + POSTFIX;
 619     static {
 620         String regex = START + "g1EncodePAndStoreN\\S*" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END;
 621         machOnly(G1_ENCODE_P_AND_STORE_N_WITH_BARRIER_FLAG, regex);
 622     }
 623 
 624     public static final String G1_GET_AND_SET_N_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "G1_GET_AND_SET_N_WITH_BARRIER_FLAG" + POSTFIX;
 625     static {
 626         String regex = START + "g1GetAndSetN\\S*" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END;
 627         machOnly(G1_GET_AND_SET_N_WITH_BARRIER_FLAG, regex);
 628     }
 629 
 630     public static final String G1_GET_AND_SET_P_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "G1_GET_AND_SET_P_WITH_BARRIER_FLAG" + POSTFIX;
 631     static {
 632         String regex = START + "g1GetAndSetP\\S*" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END;
 633         machOnly(G1_GET_AND_SET_P_WITH_BARRIER_FLAG, regex);
 634     }
 635 
 636     public static final String G1_LOAD_N = PREFIX + "G1_LOAD_N" + POSTFIX;
 637     static {
 638         machOnlyNameRegex(G1_LOAD_N, "g1LoadN");
 639     }
 640 
 641     public static final String G1_LOAD_N_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "G1_LOAD_N_WITH_BARRIER_FLAG" + POSTFIX;
 642     static {
 643         String regex = START + "g1LoadN\\S*" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END;
 644         machOnly(G1_LOAD_N_WITH_BARRIER_FLAG, regex);
 645     }
 646 
 647     public static final String G1_LOAD_P_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "G1_LOAD_P_WITH_BARRIER_FLAG" + POSTFIX;
 648     static {
 649         String regex = START + "g1LoadP\\S*" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END;
 650         machOnly(G1_LOAD_P_WITH_BARRIER_FLAG, regex);
 651     }
 652 
 653     public static final String G1_STORE_N = PREFIX + "G1_STORE_N" + POSTFIX;
 654     static {
 655         machOnlyNameRegex(G1_STORE_N, "g1StoreN");
 656     }
 657 
 658     public static final String G1_STORE_N_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "G1_STORE_N_WITH_BARRIER_FLAG" + POSTFIX;
 659     static {
 660         String regex = START + "g1StoreN\\S*" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END;
 661         machOnly(G1_STORE_N_WITH_BARRIER_FLAG, regex);
 662     }
 663 
 664     public static final String G1_STORE_P = PREFIX + "G1_STORE_P" + POSTFIX;
 665     static {
 666         machOnlyNameRegex(G1_STORE_P, "g1StoreP");
 667     }
 668 
 669     public static final String G1_STORE_P_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "G1_STORE_P_WITH_BARRIER_FLAG" + POSTFIX;
 670     static {
 671         String regex = START + "g1StoreP\\S*" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END;
 672         machOnly(G1_STORE_P_WITH_BARRIER_FLAG, regex);
 673     }
 674 
 675     public static final String IF = PREFIX + "IF" + POSTFIX;
 676     static {
 677         beforeMatchingNameRegex(IF, "If\\b");
 678     }
 679 
 680     // Does not work for VM builds without JVMCI like x86_32 (a rule containing this regex will be skipped without having JVMCI built).
 681     public static final String INTRINSIC_OR_TYPE_CHECKED_INLINING_TRAP = PREFIX + "INTRINSIC_OR_TYPE_CHECKED_INLINING_TRAP" + POSTFIX;
 682     static {
 683         trapNodes(INTRINSIC_OR_TYPE_CHECKED_INLINING_TRAP, "intrinsic_or_type_checked_inlining");
 684     }
 685 
 686     public static final String INTRINSIC_TRAP = PREFIX + "INTRINSIC_TRAP" + POSTFIX;
 687     static {
 688         trapNodes(INTRINSIC_TRAP, "intrinsic");
 689     }
 690 
 691     // Is only supported on riscv64.
 692     public static final String IS_FINITE_D = PREFIX + "IS_FINITE_D" + POSTFIX;
 693     static {
 694         beforeMatchingNameRegex(IS_FINITE_D, "IsFiniteD");
 695     }
 696 
 697     // Is only supported on riscv64.
 698     public static final String IS_FINITE_F = PREFIX + "IS_FINITE_F" + POSTFIX;
 699     static {
 700         beforeMatchingNameRegex(IS_FINITE_F, "IsFiniteF");
 701     }
 702 
 703     public static final String IS_INFINITE_D = PREFIX + "IS_INFINITE_D" + POSTFIX;
 704     static {
 705         beforeMatchingNameRegex(IS_INFINITE_D, "IsInfiniteD");
 706     }
 707 
 708     public static final String IS_INFINITE_F = PREFIX + "IS_INFINITE_F" + POSTFIX;
 709     static {
 710         beforeMatchingNameRegex(IS_INFINITE_F, "IsInfiniteF");
 711     }
 712 
 713     public static final String LOAD = PREFIX + "LOAD" + POSTFIX;
 714     static {
 715         beforeMatchingNameRegex(LOAD, "Load(B|UB|S|US|I|L|F|D|P|N)");
 716     }
 717 
 718     public static final String LOAD_OF_CLASS = COMPOSITE_PREFIX + "LOAD_OF_CLASS" + POSTFIX;
 719     static {
 720         loadOfNodes(LOAD_OF_CLASS, "Load(B|UB|S|US|I|L|F|D|P|N)");
 721     }
 722 
 723     public static final String LOAD_B = PREFIX + "LOAD_B" + POSTFIX;
 724     static {
 725         beforeMatchingNameRegex(LOAD_B, "LoadB");
 726     }
 727 
 728     public static final String LOAD_B_OF_CLASS = COMPOSITE_PREFIX + "LOAD_B_OF_CLASS" + POSTFIX;
 729     static {
 730         loadOfNodes(LOAD_B_OF_CLASS, "LoadB");
 731     }
 732 
 733     public static final String LOAD_D = PREFIX + "LOAD_D" + POSTFIX;
 734     static {
 735         beforeMatchingNameRegex(LOAD_D, "LoadD");
 736     }
 737 
 738     public static final String LOAD_D_OF_CLASS = COMPOSITE_PREFIX + "LOAD_D_OF_CLASS" + POSTFIX;
 739     static {
 740         loadOfNodes(LOAD_D_OF_CLASS, "LoadD");
 741     }
 742 
 743     public static final String LOAD_F = PREFIX + "LOAD_F" + POSTFIX;
 744     static {
 745         beforeMatchingNameRegex(LOAD_F, "LoadF");
 746     }
 747 
 748     public static final String LOAD_F_OF_CLASS = COMPOSITE_PREFIX + "LOAD_F_OF_CLASS" + POSTFIX;
 749     static {
 750         loadOfNodes(LOAD_F_OF_CLASS, "LoadF");
 751     }
 752 
 753     public static final String LOAD_I = PREFIX + "LOAD_I" + POSTFIX;
 754     static {
 755         beforeMatchingNameRegex(LOAD_I, "LoadI");
 756     }
 757 
 758     public static final String LOAD_I_OF_CLASS = COMPOSITE_PREFIX + "LOAD_I_OF_CLASS" + POSTFIX;
 759     static {
 760         loadOfNodes(LOAD_I_OF_CLASS, "LoadI");
 761     }
 762 
 763     public static final String LOAD_KLASS = PREFIX + "LOAD_KLASS" + POSTFIX;
 764     static {
 765         beforeMatchingNameRegex(LOAD_KLASS, "LoadKlass");
 766     }
 767 
 768     public static final String LOAD_NKLASS = PREFIX + "LOAD_NKLASS" + POSTFIX;
 769     static {
 770         beforeMatchingNameRegex(LOAD_NKLASS, "LoadNKlass");
 771     }
 772 
 773     public static final String LOAD_KLASS_OR_NKLASS = PREFIX + "LOAD_KLASS_OR_NKLASS" + POSTFIX;
 774     static {
 775         beforeMatchingNameRegex(LOAD_KLASS_OR_NKLASS, "LoadN?Klass");
 776     }
 777 
 778     public static final String LOAD_L = PREFIX + "LOAD_L" + POSTFIX;
 779     static {
 780         beforeMatchingNameRegex(LOAD_L, "LoadL");
 781     }
 782 
 783     public static final String LOAD_L_OF_CLASS = COMPOSITE_PREFIX + "LOAD_L_OF_CLASS" + POSTFIX;
 784     static {
 785         loadOfNodes(LOAD_L_OF_CLASS, "LoadL");
 786     }
 787 
 788     public static final String LOAD_N = PREFIX + "LOAD_N" + POSTFIX;
 789     static {
 790         beforeMatchingNameRegex(LOAD_N, "LoadN");
 791     }
 792 
 793     public static final String LOAD_N_OF_CLASS = COMPOSITE_PREFIX + "LOAD_N_OF_CLASS" + POSTFIX;
 794     static {
 795         loadOfNodes(LOAD_N_OF_CLASS, "LoadN");
 796     }
 797 
 798     public static final String LOAD_OF_FIELD = COMPOSITE_PREFIX + "LOAD_OF_FIELD" + POSTFIX;
 799     static {
 800         String regex = START + "Load(B|C|S|I|L|F|D|P|N)" + MID + "@.*name=" + IS_REPLACED + ",.*" + END;
 801         beforeMatching(LOAD_OF_FIELD, regex);
 802     }
 803 
 804     public static final String LOAD_P = PREFIX + "LOAD_P" + POSTFIX;
 805     static {
 806         beforeMatchingNameRegex(LOAD_P, "LoadP");
 807     }
 808 
 809     public static final String LOAD_P_OF_CLASS = COMPOSITE_PREFIX + "LOAD_P_OF_CLASS" + POSTFIX;
 810     static {
 811         loadOfNodes(LOAD_P_OF_CLASS, "LoadP");
 812     }
 813 
 814     public static final String LOAD_S = PREFIX + "LOAD_S" + POSTFIX;
 815     static {
 816         beforeMatchingNameRegex(LOAD_S, "LoadS");
 817     }
 818 
 819     public static final String LOAD_S_OF_CLASS = COMPOSITE_PREFIX + "LOAD_S_OF_CLASS" + POSTFIX;
 820     static {
 821         loadOfNodes(LOAD_S_OF_CLASS, "LoadS");
 822     }
 823 
 824     public static final String LOAD_UB = PREFIX + "LOAD_UB" + POSTFIX;
 825     static {
 826         beforeMatchingNameRegex(LOAD_UB, "LoadUB");
 827     }
 828 
 829     public static final String LOAD_UB_OF_CLASS = COMPOSITE_PREFIX + "LOAD_UB_OF_CLASS" + POSTFIX;
 830     static {
 831         loadOfNodes(LOAD_UB_OF_CLASS, "LoadUB");
 832     }
 833 
 834     public static final String LOAD_US = PREFIX + "LOAD_US" + POSTFIX;
 835     static {
 836         beforeMatchingNameRegex(LOAD_US, "LoadUS");
 837     }
 838 
 839     public static final String LOAD_US_OF_CLASS = COMPOSITE_PREFIX + "LOAD_US_OF_CLASS" + POSTFIX;
 840     static {
 841         loadOfNodes(LOAD_US_OF_CLASS, "LoadUS");
 842     }
 843 
 844     public static final String LOAD_VECTOR_B = VECTOR_PREFIX + "LOAD_VECTOR_B" + POSTFIX;
 845     static {
 846         vectorNode(LOAD_VECTOR_B, "LoadVector", TYPE_BYTE);
 847     }
 848 
 849     public static final String LOAD_VECTOR_C = VECTOR_PREFIX + "LOAD_VECTOR_C" + POSTFIX;
 850     static {
 851         vectorNode(LOAD_VECTOR_C, "LoadVector", TYPE_CHAR);
 852     }
 853 
 854     public static final String LOAD_VECTOR_S = VECTOR_PREFIX + "LOAD_VECTOR_S" + POSTFIX;
 855     static {
 856         vectorNode(LOAD_VECTOR_S, "LoadVector", TYPE_SHORT);
 857     }
 858 
 859     public static final String LOAD_VECTOR_I = VECTOR_PREFIX + "LOAD_VECTOR_I" + POSTFIX;
 860     static {
 861         vectorNode(LOAD_VECTOR_I, "LoadVector", TYPE_INT);
 862     }
 863 
 864     public static final String LOAD_VECTOR_L = VECTOR_PREFIX + "LOAD_VECTOR_L" + POSTFIX;
 865     static {
 866         vectorNode(LOAD_VECTOR_L, "LoadVector", TYPE_LONG);
 867     }
 868 
 869     public static final String LOAD_VECTOR_F = VECTOR_PREFIX + "LOAD_VECTOR_F" + POSTFIX;
 870     static {
 871         vectorNode(LOAD_VECTOR_F, "LoadVector", TYPE_FLOAT);
 872     }
 873 
 874     public static final String LOAD_VECTOR_D = VECTOR_PREFIX + "LOAD_VECTOR_D" + POSTFIX;
 875     static {
 876         vectorNode(LOAD_VECTOR_D, "LoadVector", TYPE_DOUBLE);
 877     }
 878 
 879     public static final String LOAD_VECTOR_GATHER = PREFIX + "LOAD_VECTOR_GATHER" + POSTFIX;
 880     static {
 881         beforeMatchingNameRegex(LOAD_VECTOR_GATHER, "LoadVectorGather");
 882     }
 883 
 884     public static final String LOAD_VECTOR_MASKED = PREFIX + "LOAD_VECTOR_MASKED" + POSTFIX;
 885     static {
 886         beforeMatchingNameRegex(LOAD_VECTOR_MASKED, "LoadVectorMasked");
 887     }
 888 
 889     public static final String LOAD_VECTOR_GATHER_MASKED = PREFIX + "LOAD_VECTOR_GATHER_MASKED" + POSTFIX;
 890     static {
 891         beforeMatchingNameRegex(LOAD_VECTOR_GATHER_MASKED, "LoadVectorGatherMasked");
 892     }
 893 
 894     public static final String LONG_COUNTED_LOOP = PREFIX + "LONG_COUNTED_LOOP" + POSTFIX;
 895     static {
 896         String regex = START + "LongCountedLoop\\b" + MID + END;
 897         fromAfterCountedLoops(LONG_COUNTED_LOOP, regex);
 898     }
 899 
 900     public static final String LOOP = PREFIX + "LOOP" + POSTFIX;
 901     static {
 902         String regex = START + "Loop" + MID + END;
 903         fromBeforeCountedLoops(LOOP, regex);
 904     }
 905 
 906     public static final String LSHIFT = PREFIX + "LSHIFT" + POSTFIX;
 907     static {
 908         beforeMatchingNameRegex(LSHIFT, "LShift(I|L)");
 909     }
 910 
 911     public static final String LSHIFT_I = PREFIX + "LSHIFT_I" + POSTFIX;
 912     static {
 913         beforeMatchingNameRegex(LSHIFT_I, "LShiftI");
 914     }
 915 
 916     public static final String LSHIFT_L = PREFIX + "LSHIFT_L" + POSTFIX;
 917     static {
 918         beforeMatchingNameRegex(LSHIFT_L, "LShiftL");
 919     }
 920 
 921     public static final String LSHIFT_VB = VECTOR_PREFIX + "LSHIFT_VB" + POSTFIX;
 922     static {
 923         vectorNode(LSHIFT_VB, "LShiftVB", TYPE_BYTE);
 924     }
 925 
 926     public static final String LSHIFT_VS = VECTOR_PREFIX + "LSHIFT_VS" + POSTFIX;
 927     static {
 928         vectorNode(LSHIFT_VS, "LShiftVS", TYPE_SHORT);
 929     }
 930 
 931     public static final String LSHIFT_VC = VECTOR_PREFIX + "LSHIFT_VC" + POSTFIX;
 932     static {
 933         vectorNode(LSHIFT_VC, "LShiftVS", TYPE_CHAR); // using short op with char type
 934     }
 935 
 936     public static final String LSHIFT_VI = VECTOR_PREFIX + "LSHIFT_VI" + POSTFIX;
 937     static {
 938         vectorNode(LSHIFT_VI, "LShiftVI", TYPE_INT);
 939     }
 940 
 941     public static final String LSHIFT_VL = VECTOR_PREFIX + "LSHIFT_VL" + POSTFIX;
 942     static {
 943         vectorNode(LSHIFT_VL, "LShiftVL", TYPE_LONG);
 944     }
 945 
 946     public static final String MACH_TEMP = PREFIX + "MACH_TEMP" + POSTFIX;
 947     static {
 948         machOnlyNameRegex(MACH_TEMP, "MachTemp");
 949     }
 950 
 951     public static final String MACRO_LOGIC_V = PREFIX + "MACRO_LOGIC_V" + POSTFIX;
 952     static {
 953         afterBarrierExpansionToBeforeMatching(MACRO_LOGIC_V, "MacroLogicV");
 954     }
 955 
 956     public static final String MAX = PREFIX + "MAX" + POSTFIX;
 957     static {
 958         beforeMatchingNameRegex(MAX, "Max(I|L|F|D)");
 959     }
 960 
 961     public static final String MAX_D = PREFIX + "MAX_D" + POSTFIX;
 962     static {
 963         beforeMatchingNameRegex(MAX_D, "MaxD");
 964     }
 965 
 966     public static final String MAX_D_REDUCTION_REG = PREFIX + "MAX_D_REDUCTION_REG" + POSTFIX;
 967     static {
 968         machOnlyNameRegex(MAX_D_REDUCTION_REG, "maxD_reduction_reg");
 969     }
 970 
 971     public static final String MAX_D_REG = PREFIX + "MAX_D_REG" + POSTFIX;
 972     static {
 973         machOnlyNameRegex(MAX_D_REG, "maxD_reg");
 974     }
 975 
 976     public static final String MAX_F = PREFIX + "MAX_F" + POSTFIX;
 977     static {
 978         beforeMatchingNameRegex(MAX_F, "MaxF");
 979     }
 980 
 981     public static final String MAX_F_REDUCTION_REG = PREFIX + "MAX_F_REDUCTION_REG" + POSTFIX;
 982     static {
 983         machOnlyNameRegex(MAX_F_REDUCTION_REG, "maxF_reduction_reg");
 984     }
 985 
 986     public static final String MAX_F_REG = PREFIX + "MAX_F_REG" + POSTFIX;
 987     static {
 988         machOnlyNameRegex(MAX_F_REG, "maxF_reg");
 989     }
 990 
 991     public static final String MAX_I = PREFIX + "MAX_I" + POSTFIX;
 992     static {
 993         beforeMatchingNameRegex(MAX_I, "MaxI");
 994     }
 995 
 996     public static final String MAX_L = PREFIX + "MAX_L" + POSTFIX;
 997     static {
 998         beforeMatchingNameRegex(MAX_L, "MaxL");
 999     }
1000 
1001     public static final String MAX_VI = VECTOR_PREFIX + "MAX_VI" + POSTFIX;
1002     static {
1003         vectorNode(MAX_VI, "MaxV", TYPE_INT);
1004     }
1005 
1006     public static final String MAX_VF = VECTOR_PREFIX + "MAX_VF" + POSTFIX;
1007     static {
1008         vectorNode(MAX_VF, "MaxV", TYPE_FLOAT);
1009     }
1010 
1011     public static final String MAX_VD = VECTOR_PREFIX + "MAX_VD" + POSTFIX;
1012     static {
1013         vectorNode(MAX_VD, "MaxV", TYPE_DOUBLE);
1014     }
1015 
1016     public static final String MAX_VL = VECTOR_PREFIX + "MAX_VL" + POSTFIX;
1017     static {
1018         vectorNode(MAX_VL, "MaxV", TYPE_LONG);
1019     }
1020 
1021     public static final String MEMBAR = PREFIX + "MEMBAR" + POSTFIX;
1022     static {
1023         beforeMatchingNameRegex(MEMBAR, "MemBar");
1024     }
1025 
1026     public static final String MEMBAR_ACQUIRE = PREFIX + "MEMBAR_ACQUIRE" + POSTFIX;
1027     static {
1028         beforeMatchingNameRegex(MEMBAR_ACQUIRE, "MemBarAcquire");
1029     }
1030 
1031     public static final String MEMBAR_RELEASE = PREFIX + "MEMBAR_RELEASE" + POSTFIX;
1032     static {
1033         beforeMatchingNameRegex(MEMBAR_RELEASE, "MemBarRelease");
1034     }
1035 
1036     public static final String MEMBAR_STORESTORE = PREFIX + "MEMBAR_STORESTORE" + POSTFIX;
1037     static {
1038         beforeMatchingNameRegex(MEMBAR_STORESTORE, "MemBarStoreStore");
1039     }
1040 
1041     public static final String MEMBAR_VOLATILE = PREFIX + "MEMBAR_VOLATILE" + POSTFIX;
1042     static {
1043         beforeMatchingNameRegex(MEMBAR_VOLATILE, "MemBarVolatile");
1044     }
1045 
1046     public static final String MIN = PREFIX + "MIN" + POSTFIX;
1047     static {
1048         beforeMatchingNameRegex(MIN, "Min(I|L)");
1049     }
1050 
1051     public static final String MIN_D = PREFIX + "MIN_D" + POSTFIX;
1052     static {
1053         beforeMatchingNameRegex(MIN_D, "MinD");
1054     }
1055 
1056     public static final String MIN_D_REDUCTION_REG = PREFIX + "MIN_D_REDUCTION_REG" + POSTFIX;
1057     static {
1058         machOnlyNameRegex(MIN_D_REDUCTION_REG, "minD_reduction_reg");
1059     }
1060 
1061     public static final String MIN_D_REG = PREFIX + "MIN_D_REG" + POSTFIX;
1062     static {
1063         machOnlyNameRegex(MIN_D_REG, "minD_reg");
1064     }
1065 
1066     public static final String MIN_F = PREFIX + "MIN_F" + POSTFIX;
1067     static {
1068         beforeMatchingNameRegex(MIN_F, "MinF");
1069     }
1070 
1071     public static final String MIN_F_REDUCTION_REG = PREFIX + "MIN_F_REDUCTION_REG" + POSTFIX;
1072     static {
1073         machOnlyNameRegex(MIN_F_REDUCTION_REG, "minF_reduction_reg");
1074     }
1075 
1076     public static final String MIN_F_REG = PREFIX + "MIN_F_REG" + POSTFIX;
1077     static {
1078         machOnlyNameRegex(MIN_F_REG, "minF_reg");
1079     }
1080 
1081     public static final String MIN_I = PREFIX + "MIN_I" + POSTFIX;
1082     static {
1083         beforeMatchingNameRegex(MIN_I, "MinI");
1084     }
1085 
1086     public static final String MIN_L = PREFIX + "MIN_L" + POSTFIX;
1087     static {
1088         beforeMatchingNameRegex(MIN_L, "MinL");
1089     }
1090 
1091     public static final String MIN_VI = VECTOR_PREFIX + "MIN_VI" + POSTFIX;
1092     static {
1093         vectorNode(MIN_VI, "MinV", TYPE_INT);
1094     }
1095 
1096     public static final String MIN_VF = VECTOR_PREFIX + "MIN_VF" + POSTFIX;
1097     static {
1098         vectorNode(MIN_VF, "MinV", TYPE_FLOAT);
1099     }
1100 
1101     public static final String MIN_VD = VECTOR_PREFIX + "MIN_VD" + POSTFIX;
1102     static {
1103         vectorNode(MIN_VD, "MinV", TYPE_DOUBLE);
1104     }
1105 
1106     public static final String MIN_VL = VECTOR_PREFIX + "MIN_VL" + POSTFIX;
1107     static {
1108         vectorNode(MIN_VL, "MinV", TYPE_LONG);
1109     }
1110 
1111     public static final String MOD_I = PREFIX + "MOD_I" + POSTFIX;
1112     static {
1113         beforeMatchingNameRegex(MOD_I, "ModI");
1114     }
1115 
1116     public static final String MOD_L = PREFIX + "MOD_L" + POSTFIX;
1117     static {
1118         beforeMatchingNameRegex(MOD_L, "ModL");
1119     }
1120 
1121     public static final String MUL = PREFIX + "MUL" + POSTFIX;
1122     static {
1123         beforeMatchingNameRegex(MUL, "Mul(I|L|F|D)");
1124     }
1125 
1126     public static final String MUL_ADD_S2I = PREFIX + "MUL_ADD_S2I" + POSTFIX;
1127     static {
1128         beforeMatchingNameRegex(MUL_ADD_S2I, "MulAddS2I");
1129     }
1130 
1131     public static final String MUL_ADD_VS2VI = VECTOR_PREFIX + "MUL_ADD_VS2VI" + POSTFIX;
1132     static {
1133         vectorNode(MUL_ADD_VS2VI, "MulAddVS2VI", TYPE_INT);
1134     }
1135 
1136     // Can only be used if avx512_vnni is available.
1137     public static final String MUL_ADD_VS2VI_VNNI = PREFIX + "MUL_ADD_VS2VI_VNNI" + POSTFIX;
1138     static {
1139         machOnly(MUL_ADD_VS2VI_VNNI, "vmuladdaddS2I_reg");
1140     }
1141 
1142     public static final String MUL_D = PREFIX + "MUL_D" + POSTFIX;
1143     static {
1144         beforeMatchingNameRegex(MUL_D, "MulD");
1145     }
1146 
1147     public static final String MUL_F = PREFIX + "MUL_F" + POSTFIX;
1148     static {
1149         beforeMatchingNameRegex(MUL_F, "MulF");
1150     }
1151 
1152     public static final String MUL_I = PREFIX + "MUL_I" + POSTFIX;
1153     static {
1154         beforeMatchingNameRegex(MUL_I, "MulI");
1155     }
1156 
1157     public static final String MUL_L = PREFIX + "MUL_L" + POSTFIX;
1158     static {
1159         beforeMatchingNameRegex(MUL_L, "MulL");
1160     }
1161 
1162     public static final String MUL_VL = VECTOR_PREFIX + "MUL_VL" + POSTFIX;
1163     static {
1164         vectorNode(MUL_VL, "MulVL", TYPE_LONG);
1165     }
1166 
1167     public static final String MUL_VI = VECTOR_PREFIX + "MUL_VI" + POSTFIX;
1168     static {
1169         vectorNode(MUL_VI, "MulVI", TYPE_INT);
1170     }
1171 
1172     public static final String MUL_VF = VECTOR_PREFIX + "MUL_VF" + POSTFIX;
1173     static {
1174         vectorNode(MUL_VF, "MulVF", TYPE_FLOAT);
1175     }
1176 
1177     public static final String MUL_VD = VECTOR_PREFIX + "MUL_VD" + POSTFIX;
1178     static {
1179         vectorNode(MUL_VD, "MulVD", TYPE_DOUBLE);
1180     }
1181 
1182     public static final String MUL_VB = VECTOR_PREFIX + "MUL_VB" + POSTFIX;
1183     static {
1184         vectorNode(MUL_VB, "MulVB", TYPE_BYTE);
1185     }
1186 
1187     public static final String MUL_VS = VECTOR_PREFIX + "MUL_VS" + POSTFIX;
1188     static {
1189         vectorNode(MUL_VS, "MulVS", TYPE_SHORT);
1190     }
1191 
1192     public static final String MUL_REDUCTION_VD = PREFIX + "MUL_REDUCTION_VD" + POSTFIX;
1193     static {
1194         superWordNodes(MUL_REDUCTION_VD, "MulReductionVD");
1195     }
1196 
1197     public static final String MUL_REDUCTION_VF = PREFIX + "MUL_REDUCTION_VF" + POSTFIX;
1198     static {
1199         superWordNodes(MUL_REDUCTION_VF, "MulReductionVF");
1200     }
1201 
1202     public static final String MUL_REDUCTION_VI = PREFIX + "MUL_REDUCTION_VI" + POSTFIX;
1203     static {
1204         superWordNodes(MUL_REDUCTION_VI, "MulReductionVI");
1205     }
1206 
1207     public static final String MUL_REDUCTION_VL = PREFIX + "MUL_REDUCTION_VL" + POSTFIX;
1208     static {
1209         superWordNodes(MUL_REDUCTION_VL, "MulReductionVL");
1210     }
1211 
1212     public static final String MIN_REDUCTION_V = PREFIX + "MIN_REDUCTION_V" + POSTFIX;
1213     static {
1214         superWordNodes(MIN_REDUCTION_V, "MinReductionV");
1215     }
1216 
1217     public static final String MAX_REDUCTION_V = PREFIX + "MAX_REDUCTION_V" + POSTFIX;
1218     static {
1219         superWordNodes(MAX_REDUCTION_V, "MaxReductionV");
1220     }
1221 
1222     public static final String NEG_VF = VECTOR_PREFIX + "NEG_VF" + POSTFIX;
1223     static {
1224         vectorNode(NEG_VF, "NegVF", TYPE_FLOAT);
1225     }
1226 
1227     public static final String NEG_VD = VECTOR_PREFIX + "NEG_VD" + POSTFIX;
1228     static {
1229         vectorNode(NEG_VD, "NegVD", TYPE_DOUBLE);
1230     }
1231 
1232     public static final String NOP = PREFIX + "NOP" + POSTFIX;
1233     static {
1234         machOnlyNameRegex(NOP, "Nop");
1235     }
1236 
1237     public static final String NULL_ASSERT_TRAP = PREFIX + "NULL_ASSERT_TRAP" + POSTFIX;
1238     static {
1239         trapNodes(NULL_ASSERT_TRAP, "null_assert");
1240     }
1241 
1242     public static final String NULL_CHECK_TRAP = PREFIX + "NULL_CHECK_TRAP" + POSTFIX;
1243     static {
1244         trapNodes(NULL_CHECK_TRAP, "null_check");
1245     }
1246 
1247     public static final String OOPMAP_WITH = COMPOSITE_PREFIX + "OOPMAP_WITH" + POSTFIX;
1248     static {
1249         String regex = "(#\\s*OopMap\\s*\\{.*" + IS_REPLACED + ".*\\})";
1250         optoOnly(OOPMAP_WITH, regex);
1251     }
1252 
1253     public static final String OR_VB = VECTOR_PREFIX + "OR_VB" + POSTFIX;
1254     static {
1255         vectorNode(OR_VB, "OrV", TYPE_BYTE);
1256     }
1257 
1258     public static final String OR_VS = VECTOR_PREFIX + "OR_VS" + POSTFIX;
1259     static {
1260         vectorNode(OR_VS, "OrV", TYPE_SHORT);
1261     }
1262 
1263     public static final String OR_VI = VECTOR_PREFIX + "OR_VI" + POSTFIX;
1264     static {
1265         vectorNode(OR_VI, "OrV", TYPE_INT);
1266     }
1267 
1268     public static final String OR_VL = VECTOR_PREFIX + "OR_VL" + POSTFIX;
1269     static {
1270         vectorNode(OR_VL, "OrV", TYPE_LONG);
1271     }
1272 
1273     public static final String OR_V_MASK = PREFIX + "OR_V_MASK" + POSTFIX;
1274     static {
1275         beforeMatchingNameRegex(OR_V_MASK, "OrVMask");
1276     }
1277 
1278     public static final String OR_REDUCTION_V = PREFIX + "OR_REDUCTION_V" + POSTFIX;
1279     static {
1280         superWordNodes(OR_REDUCTION_V, "OrReductionV");
1281     }
1282 
1283     public static final String OUTER_STRIP_MINED_LOOP = PREFIX + "OUTER_STRIP_MINED_LOOP" + POSTFIX;
1284     static {
1285         String regex = START + "OuterStripMinedLoop\\b" + MID + END;
1286         fromAfterCountedLoops(OUTER_STRIP_MINED_LOOP, regex);
1287     }
1288 
1289     public static final String PARTIAL_SUBTYPE_CHECK = PREFIX + "PARTIAL_SUBTYPE_CHECK" + POSTFIX;
1290     static {
1291         beforeMatchingNameRegex(PARTIAL_SUBTYPE_CHECK, "PartialSubtypeCheck");
1292     }
1293 
1294     public static final String PHI = PREFIX + "PHI" + POSTFIX;
1295     static {
1296         beforeMatchingNameRegex(PHI, "Phi");
1297     }
1298 
1299     public static final String POPCOUNT_L = PREFIX + "POPCOUNT_L" + POSTFIX;
1300     static {
1301         beforeMatchingNameRegex(POPCOUNT_L, "PopCountL");
1302     }
1303 
1304     public static final String POPCOUNT_VI = VECTOR_PREFIX + "POPCOUNT_VI" + POSTFIX;
1305     static {
1306         vectorNode(POPCOUNT_VI, "PopCountVI", TYPE_INT);
1307     }
1308 
1309     public static final String POPCOUNT_VL = VECTOR_PREFIX + "POPCOUNT_VL" + POSTFIX;
1310     static {
1311         vectorNode(POPCOUNT_VL, "PopCountVL", TYPE_LONG);
1312     }
1313 
1314     public static final String COUNT_TRAILING_ZEROS_VL = VECTOR_PREFIX + "COUNT_TRAILING_ZEROS_VL" + POSTFIX;
1315     static {
1316         vectorNode(COUNT_TRAILING_ZEROS_VL, "CountTrailingZerosV", TYPE_LONG);
1317     }
1318 
1319     public static final String COUNT_TRAILING_ZEROS_VI = VECTOR_PREFIX + "COUNT_TRAILING_ZEROS_VI" + POSTFIX;
1320     static {
1321         vectorNode(COUNT_TRAILING_ZEROS_VI, "CountTrailingZerosV", TYPE_INT);
1322     }
1323 
1324     public static final String COUNT_LEADING_ZEROS_VL = VECTOR_PREFIX + "COUNT_LEADING_ZEROS_VL" + POSTFIX;
1325     static {
1326         vectorNode(COUNT_LEADING_ZEROS_VL, "CountLeadingZerosV", TYPE_LONG);
1327     }
1328 
1329     public static final String COUNT_LEADING_ZEROS_VI = VECTOR_PREFIX + "COUNT_LEADING_ZEROS_VI" + POSTFIX;
1330     static {
1331         vectorNode(COUNT_LEADING_ZEROS_VI, "CountLeadingZerosV", TYPE_INT);
1332     }
1333 
1334     public static final String POPULATE_INDEX = PREFIX + "POPULATE_INDEX" + POSTFIX;
1335     static {
1336         String regex = START + "PopulateIndex" + MID + END;
1337         IR_NODE_MAPPINGS.put(POPULATE_INDEX, new SinglePhaseRangeEntry(CompilePhase.PRINT_IDEAL, regex,
1338                                                                        CompilePhase.AFTER_CLOOPS,
1339                                                                        CompilePhase.BEFORE_MATCHING));
1340     }
1341 
1342     public static final String PREDICATE_TRAP = PREFIX + "PREDICATE_TRAP" + POSTFIX;
1343     static {
1344         trapNodes(PREDICATE_TRAP, "predicate");
1345     }
1346 
1347     public static final String RANGE_CHECK_TRAP = PREFIX + "RANGE_CHECK_TRAP" + POSTFIX;
1348     static {
1349         trapNodes(RANGE_CHECK_TRAP, "range_check");
1350     }
1351 
1352     public static final String REPLICATE_B = VECTOR_PREFIX + "REPLICATE_B" + POSTFIX;
1353     static {
1354         vectorNode(REPLICATE_B, "Replicate", TYPE_BYTE);
1355     }
1356 
1357     public static final String REPLICATE_S = VECTOR_PREFIX + "REPLICATE_S" + POSTFIX;
1358     static {
1359         vectorNode(REPLICATE_S, "Replicate", TYPE_SHORT);
1360     }
1361 
1362     public static final String REPLICATE_I = VECTOR_PREFIX + "REPLICATE_I" + POSTFIX;
1363     static {
1364         vectorNode(REPLICATE_I, "Replicate", TYPE_INT);
1365     }
1366 
1367     public static final String REPLICATE_L = VECTOR_PREFIX + "REPLICATE_L" + POSTFIX;
1368     static {
1369         vectorNode(REPLICATE_L, "Replicate", TYPE_LONG);
1370     }
1371 
1372     public static final String REPLICATE_F = VECTOR_PREFIX + "REPLICATE_F" + POSTFIX;
1373     static {
1374         vectorNode(REPLICATE_F, "Replicate", TYPE_FLOAT);
1375     }
1376 
1377     public static final String REPLICATE_D = VECTOR_PREFIX + "REPLICATE_D" + POSTFIX;
1378     static {
1379         vectorNode(REPLICATE_D, "Replicate", TYPE_DOUBLE);
1380     }
1381 
1382     public static final String REVERSE_BYTES_VB = VECTOR_PREFIX + "REVERSE_BYTES_VB" + POSTFIX;
1383     static {
1384         vectorNode(REVERSE_BYTES_VB, "ReverseBytesV", TYPE_BYTE);
1385     }
1386 
1387     public static final String REVERSE_BYTES_VS = VECTOR_PREFIX + "REVERSE_BYTES_VS" + POSTFIX;
1388     static {
1389         vectorNode(REVERSE_BYTES_VS, "ReverseBytesV", TYPE_SHORT);
1390     }
1391 
1392     public static final String REVERSE_BYTES_VI = VECTOR_PREFIX + "REVERSE_BYTES_VI" + POSTFIX;
1393     static {
1394         vectorNode(REVERSE_BYTES_VI, "ReverseBytesV", TYPE_INT);
1395     }
1396 
1397     public static final String REVERSE_BYTES_VL = VECTOR_PREFIX + "REVERSE_BYTES_VL" + POSTFIX;
1398     static {
1399         vectorNode(REVERSE_BYTES_VL, "ReverseBytesV", TYPE_LONG);
1400     }
1401 
1402     public static final String REVERSE_I = PREFIX + "REVERSE_I" + POSTFIX;
1403     static {
1404         beforeMatchingNameRegex(REVERSE_I, "ReverseI");
1405     }
1406 
1407     public static final String REVERSE_L = PREFIX + "REVERSE_L" + POSTFIX;
1408     static {
1409         beforeMatchingNameRegex(REVERSE_L, "ReverseL");
1410     }
1411 
1412     public static final String REVERSE_VI = VECTOR_PREFIX + "REVERSE_VI" + POSTFIX;
1413     static {
1414         vectorNode(REVERSE_VI, "ReverseV", TYPE_INT);
1415     }
1416 
1417     public static final String REVERSE_VL = VECTOR_PREFIX + "REVERSE_VL" + POSTFIX;
1418     static {
1419         vectorNode(REVERSE_VL, "ReverseV", TYPE_LONG);
1420     }
1421 
1422     public static final String ROUND_VD = VECTOR_PREFIX + "ROUND_VD" + POSTFIX;
1423     static {
1424         vectorNode(ROUND_VD, "RoundVD", TYPE_LONG);
1425     }
1426 
1427     public static final String ROUND_VF = VECTOR_PREFIX + "ROUND_VF" + POSTFIX;
1428     static {
1429         vectorNode(ROUND_VF, "RoundVF", TYPE_INT);
1430     }
1431 
1432     public static final String ROTATE_LEFT = PREFIX + "ROTATE_LEFT" + POSTFIX;
1433     static {
1434         beforeMatchingNameRegex(ROTATE_LEFT, "RotateLeft");
1435     }
1436 
1437     public static final String ROTATE_RIGHT = PREFIX + "ROTATE_RIGHT" + POSTFIX;
1438     static {
1439         beforeMatchingNameRegex(ROTATE_RIGHT, "RotateRight");
1440     }
1441 
1442     public static final String ROTATE_LEFT_V = PREFIX + "ROTATE_LEFT_V" + POSTFIX;
1443     static {
1444         beforeMatchingNameRegex(ROTATE_LEFT_V, "RotateLeftV");
1445     }
1446 
1447     public static final String ROTATE_RIGHT_V = PREFIX + "ROTATE_RIGHT_V" + POSTFIX;
1448     static {
1449         beforeMatchingNameRegex(ROTATE_RIGHT_V, "RotateRightV");
1450     }
1451 
1452     public static final String ROUND_DOUBLE_MODE_V = VECTOR_PREFIX + "ROUND_DOUBLE_MODE_V" + POSTFIX;
1453     static {
1454         vectorNode(ROUND_DOUBLE_MODE_V, "RoundDoubleModeV", TYPE_DOUBLE);
1455     }
1456 
1457     public static final String RSHIFT = PREFIX + "RSHIFT" + POSTFIX;
1458     static {
1459         beforeMatchingNameRegex(RSHIFT, "RShift(I|L)");
1460     }
1461 
1462     public static final String RSHIFT_I = PREFIX + "RSHIFT_I" + POSTFIX;
1463     static {
1464         beforeMatchingNameRegex(RSHIFT_I, "RShiftI");
1465     }
1466 
1467     public static final String RSHIFT_L = PREFIX + "RSHIFT_L" + POSTFIX;
1468     static {
1469         beforeMatchingNameRegex(RSHIFT_L, "RShiftL");
1470     }
1471 
1472     public static final String RSHIFT_VB = VECTOR_PREFIX + "RSHIFT_VB" + POSTFIX;
1473     static {
1474         vectorNode(RSHIFT_VB, "RShiftVB", TYPE_BYTE);
1475     }
1476 
1477     public static final String RSHIFT_VS = VECTOR_PREFIX + "RSHIFT_VS" + POSTFIX;
1478     static {
1479         vectorNode(RSHIFT_VS, "RShiftVS", TYPE_SHORT);
1480     }
1481 
1482     public static final String RSHIFT_VC = VECTOR_PREFIX + "RSHIFT_VC" + POSTFIX;
1483     static {
1484         vectorNode(RSHIFT_VC, "RShiftVS", TYPE_CHAR); // short computation with char type
1485     }
1486 
1487     public static final String RSHIFT_VI = VECTOR_PREFIX + "RSHIFT_VI" + POSTFIX;
1488     static {
1489         vectorNode(RSHIFT_VI, "RShiftVI", TYPE_INT);
1490     }
1491 
1492     public static final String RSHIFT_VL = VECTOR_PREFIX + "RSHIFT_VL" + POSTFIX;
1493     static {
1494         vectorNode(RSHIFT_VL, "RShiftVL", TYPE_LONG);
1495     }
1496 
1497     public static final String SAFEPOINT = PREFIX + "SAFEPOINT" + POSTFIX;
1498     static {
1499         beforeMatchingNameRegex(SAFEPOINT, "SafePoint");
1500     }
1501 
1502     public static final String SCOPE_OBJECT = PREFIX + "SCOPE_OBJECT" + POSTFIX;
1503     static {
1504         String regex = "(.*# ScObj.*" + END;
1505         optoOnly(SCOPE_OBJECT, regex);
1506     }
1507 
1508     public static final String SIGNUM_VD = VECTOR_PREFIX + "SIGNUM_VD" + POSTFIX;
1509     static {
1510         vectorNode(SIGNUM_VD, "SignumVD", TYPE_DOUBLE);
1511     }
1512 
1513     public static final String SIGNUM_VF = VECTOR_PREFIX + "SIGNUM_VF" + POSTFIX;
1514     static {
1515         vectorNode(SIGNUM_VF, "SignumVF", TYPE_FLOAT);
1516     }
1517 
1518     public static final String SQRT_VF = VECTOR_PREFIX + "SQRT_VF" + POSTFIX;
1519     static {
1520         vectorNode(SQRT_VF, "SqrtVF", TYPE_FLOAT);
1521     }
1522 
1523     public static final String SQRT_VD = VECTOR_PREFIX + "SQRT_VD" + POSTFIX;
1524     static {
1525         vectorNode(SQRT_VD, "SqrtVD", TYPE_DOUBLE);
1526     }
1527 
1528     public static final String STORE = PREFIX + "STORE" + POSTFIX;
1529     static {
1530         beforeMatchingNameRegex(STORE, "Store(B|C|S|I|L|F|D|P|N)");
1531     }
1532 
1533     public static final String STORE_B = PREFIX + "STORE_B" + POSTFIX;
1534     static {
1535         beforeMatchingNameRegex(STORE_B, "StoreB");
1536     }
1537 
1538     public static final String STORE_B_OF_CLASS = COMPOSITE_PREFIX + "STORE_B_OF_CLASS" + POSTFIX;
1539     static {
1540         storeOfNodes(STORE_B_OF_CLASS, "StoreB");
1541     }
1542 
1543     public static final String STORE_C = PREFIX + "STORE_C" + POSTFIX;
1544     static {
1545         beforeMatchingNameRegex(STORE_C, "StoreC");
1546     }
1547 
1548     public static final String STORE_C_OF_CLASS = COMPOSITE_PREFIX + "STORE_C_OF_CLASS" + POSTFIX;
1549     static {
1550         storeOfNodes(STORE_C_OF_CLASS, "StoreC");
1551     }
1552 
1553     public static final String STORE_D = PREFIX + "STORE_D" + POSTFIX;
1554     static {
1555         beforeMatchingNameRegex(STORE_D, "StoreD");
1556     }
1557 
1558     public static final String STORE_D_OF_CLASS = COMPOSITE_PREFIX + "STORE_D_OF_CLASS" + POSTFIX;
1559     static {
1560         storeOfNodes(STORE_D_OF_CLASS, "StoreD");
1561     }
1562 
1563     public static final String STORE_F = PREFIX + "STORE_F" + POSTFIX;
1564     static {
1565         beforeMatchingNameRegex(STORE_F, "StoreF");
1566     }
1567 
1568     public static final String STORE_F_OF_CLASS = COMPOSITE_PREFIX + "STORE_F_OF_CLASS" + POSTFIX;
1569     static {
1570         storeOfNodes(STORE_F_OF_CLASS, "StoreF");
1571     }
1572 
1573     public static final String STORE_I = PREFIX + "STORE_I" + POSTFIX;
1574     static {
1575         beforeMatchingNameRegex(STORE_I, "StoreI");
1576     }
1577 
1578     public static final String STORE_I_OF_CLASS = COMPOSITE_PREFIX + "STORE_I_OF_CLASS" + POSTFIX;
1579     static {
1580         storeOfNodes(STORE_I_OF_CLASS, "StoreI");
1581     }
1582 
1583     public static final String STORE_L = PREFIX + "STORE_L" + POSTFIX;
1584     static {
1585         beforeMatchingNameRegex(STORE_L, "StoreL");
1586     }
1587 
1588     public static final String STORE_L_OF_CLASS = COMPOSITE_PREFIX + "STORE_L_OF_CLASS" + POSTFIX;
1589     static {
1590         storeOfNodes(STORE_L_OF_CLASS, "StoreL");
1591     }
1592 
1593     public static final String STORE_N = PREFIX + "STORE_N" + POSTFIX;
1594     static {
1595         beforeMatchingNameRegex(STORE_N, "StoreN");
1596     }
1597 
1598     public static final String STORE_N_OF_CLASS = COMPOSITE_PREFIX + "STORE_N_OF_CLASS" + POSTFIX;
1599     static {
1600         storeOfNodes(STORE_N_OF_CLASS, "StoreN");
1601     }
1602 
1603     public static final String STORE_OF_CLASS = COMPOSITE_PREFIX + "STORE_OF_CLASS" + POSTFIX;
1604     static {
1605         storeOfNodes(STORE_OF_CLASS, "Store(B|C|S|I|L|F|D|P|N)");
1606     }
1607 
1608     public static final String STORE_OF_FIELD = COMPOSITE_PREFIX + "STORE_OF_FIELD" + POSTFIX;
1609     static {
1610         String regex = START + "Store(B|C|S|I|L|F|D|P|N)" + MID + "@.*name=" + IS_REPLACED + ",.*" + END;
1611         beforeMatching(STORE_OF_FIELD, regex);
1612     }
1613 
1614     public static final String STORE_P = PREFIX + "STORE_P" + POSTFIX;
1615     static {
1616         beforeMatchingNameRegex(STORE_P, "StoreP");
1617     }
1618 
1619     public static final String STORE_P_OF_CLASS = COMPOSITE_PREFIX + "STORE_P_OF_CLASS" + POSTFIX;
1620     static {
1621         storeOfNodes(STORE_P_OF_CLASS, "StoreP");
1622     }
1623 
1624     public static final String STORE_VECTOR = PREFIX + "STORE_VECTOR" + POSTFIX;
1625     static {
1626         beforeMatchingNameRegex(STORE_VECTOR, "StoreVector");
1627     }
1628 
1629     public static final String STORE_VECTOR_SCATTER = PREFIX + "STORE_VECTOR_SCATTER" + POSTFIX;
1630     static {
1631         beforeMatchingNameRegex(STORE_VECTOR_SCATTER, "StoreVectorScatter");
1632     }
1633 
1634     public static final String STORE_VECTOR_MASKED = PREFIX + "STORE_VECTOR_MASKED" + POSTFIX;
1635     static {
1636         beforeMatchingNameRegex(STORE_VECTOR_MASKED, "StoreVectorMasked");
1637     }
1638 
1639     public static final String STORE_VECTOR_SCATTER_MASKED = PREFIX + "STORE_VECTOR_SCATTER_MASKED" + POSTFIX;
1640     static {
1641         beforeMatchingNameRegex(STORE_VECTOR_SCATTER_MASKED, "StoreVectorScatterMasked");
1642     }
1643 
1644     public static final String SUB = PREFIX + "SUB" + POSTFIX;
1645     static {
1646         beforeMatchingNameRegex(SUB, "Sub(I|L|F|D)");
1647     }
1648 
1649     public static final String SUB_D = PREFIX + "SUB_D" + POSTFIX;
1650     static {
1651         beforeMatchingNameRegex(SUB_D, "SubD");
1652     }
1653 
1654     public static final String SUB_F = PREFIX + "SUB_F" + POSTFIX;
1655     static {
1656         beforeMatchingNameRegex(SUB_F, "SubF");
1657     }
1658 
1659     public static final String SUB_I = PREFIX + "SUB_I" + POSTFIX;
1660     static {
1661         beforeMatchingNameRegex(SUB_I, "SubI");
1662     }
1663 
1664     public static final String SUB_L = PREFIX + "SUB_L" + POSTFIX;
1665     static {
1666         beforeMatchingNameRegex(SUB_L, "SubL");
1667     }
1668 
1669     public static final String SUB_VB = VECTOR_PREFIX + "SUB_VB" + POSTFIX;
1670     static {
1671         vectorNode(SUB_VB, "SubVB", TYPE_BYTE);
1672     }
1673 
1674     public static final String SUB_VS = VECTOR_PREFIX + "SUB_VS" + POSTFIX;
1675     static {
1676         vectorNode(SUB_VS, "SubVS", TYPE_SHORT);
1677     }
1678 
1679     public static final String SUB_VI = VECTOR_PREFIX + "SUB_VI" + POSTFIX;
1680     static {
1681         vectorNode(SUB_VI, "SubVI", TYPE_INT);
1682     }
1683 
1684     public static final String SUB_VL = VECTOR_PREFIX + "SUB_VL" + POSTFIX;
1685     static {
1686         vectorNode(SUB_VL, "SubVL", TYPE_LONG);
1687     }
1688 
1689     public static final String SUB_VF = VECTOR_PREFIX + "SUB_VF" + POSTFIX;
1690     static {
1691         vectorNode(SUB_VF, "SubVF", TYPE_FLOAT);
1692     }
1693 
1694     public static final String SUB_VD = VECTOR_PREFIX + "SUB_VD" + POSTFIX;
1695     static {
1696         vectorNode(SUB_VD, "SubVD", TYPE_DOUBLE);
1697     }
1698 
1699     public static final String SUBTYPE_CHECK = PREFIX + "SUBTYPE_CHECK" + POSTFIX;
1700     static {
1701         beforeMatchingNameRegex(SUBTYPE_CHECK, "SubTypeCheck");
1702     }
1703 
1704     public static final String TRAP = PREFIX + "TRAP" + POSTFIX;
1705     static {
1706         trapNodes(TRAP, "reason");
1707     }
1708 
1709     public static final String UDIV_I = PREFIX + "UDIV_I" + POSTFIX;
1710     static {
1711         beforeMatchingNameRegex(UDIV_I, "UDivI");
1712     }
1713 
1714     public static final String UDIV_L = PREFIX + "UDIV_L" + POSTFIX;
1715     static {
1716         beforeMatchingNameRegex(UDIV_L, "UDivL");
1717     }
1718 
1719     public static final String UDIV_MOD_I = PREFIX + "UDIV_MOD_I" + POSTFIX;
1720     static {
1721         beforeMatchingNameRegex(UDIV_MOD_I, "UDivModI");
1722     }
1723 
1724     public static final String UDIV_MOD_L = PREFIX + "UDIV_MOD_L" + POSTFIX;
1725     static {
1726         beforeMatchingNameRegex(UDIV_MOD_L, "UDivModL");
1727     }
1728 
1729     public static final String UMOD_I = PREFIX + "UMOD_I" + POSTFIX;
1730     static {
1731         beforeMatchingNameRegex(UMOD_I, "UModI");
1732     }
1733 
1734     public static final String UMOD_L = PREFIX + "UMOD_L" + POSTFIX;
1735     static {
1736         beforeMatchingNameRegex(UMOD_L, "UModL");
1737     }
1738 
1739     public static final String UNHANDLED_TRAP = PREFIX + "UNHANDLED_TRAP" + POSTFIX;
1740     static {
1741         trapNodes(UNHANDLED_TRAP, "unhandled");
1742     }
1743 
1744     public static final String UNSTABLE_IF_TRAP = PREFIX + "UNSTABLE_IF_TRAP" + POSTFIX;
1745     static {
1746         trapNodes(UNSTABLE_IF_TRAP, "unstable_if");
1747     }
1748 
1749     public static final String UNREACHED_TRAP = PREFIX + "UNREACHED_TRAP" + POSTFIX;
1750     static {
1751         trapNodes(UNREACHED_TRAP, "unreached");
1752     }
1753 
1754     public static final String URSHIFT = PREFIX + "URSHIFT" + POSTFIX;
1755     static {
1756         beforeMatchingNameRegex(URSHIFT, "URShift(B|S|I|L)");
1757     }
1758 
1759     public static final String URSHIFT_B = PREFIX + "URSHIFT_B" + POSTFIX;
1760     static {
1761         beforeMatchingNameRegex(URSHIFT_B, "URShiftB");
1762     }
1763 
1764     public static final String URSHIFT_I = PREFIX + "URSHIFT_I" + POSTFIX;
1765     static {
1766         beforeMatchingNameRegex(URSHIFT_I, "URShiftI");
1767     }
1768 
1769     public static final String URSHIFT_L = PREFIX + "URSHIFT_L" + POSTFIX;
1770     static {
1771         beforeMatchingNameRegex(URSHIFT_L, "URShiftL");
1772     }
1773 
1774     public static final String URSHIFT_S = PREFIX + "URSHIFT_S" + POSTFIX;
1775     static {
1776         beforeMatchingNameRegex(URSHIFT_S, "URShiftS");
1777     }
1778 
1779     public static final String URSHIFT_VB = VECTOR_PREFIX + "URSHIFT_VB" + POSTFIX;
1780     static {
1781         vectorNode(URSHIFT_VB, "URShiftVB", TYPE_BYTE);
1782     }
1783 
1784     public static final String URSHIFT_VS = VECTOR_PREFIX + "URSHIFT_VS" + POSTFIX;
1785     static {
1786         vectorNode(URSHIFT_VS, "URShiftVS", TYPE_SHORT);
1787     }
1788 
1789     public static final String URSHIFT_VC = VECTOR_PREFIX + "URSHIFT_VC" + POSTFIX;
1790     static {
1791         vectorNode(URSHIFT_VC, "URShiftVS", TYPE_CHAR); // short computation with char type
1792     }
1793 
1794     public static final String URSHIFT_VI = VECTOR_PREFIX + "URSHIFT_VI" + POSTFIX;
1795     static {
1796         vectorNode(URSHIFT_VI, "URShiftVI", TYPE_INT);
1797     }
1798 
1799     public static final String URSHIFT_VL = VECTOR_PREFIX + "URSHIFT_VL" + POSTFIX;
1800     static {
1801         vectorNode(URSHIFT_VL, "URShiftVL", TYPE_LONG);
1802     }
1803 
1804     public static final String VAND_NOT_I = PREFIX + "VAND_NOT_I" + POSTFIX;
1805     static {
1806         machOnlyNameRegex(VAND_NOT_I, "vand_notI");
1807     }
1808 
1809     public static final String VAND_NOT_L = PREFIX + "VAND_NOT_L" + POSTFIX;
1810     static {
1811         machOnlyNameRegex(VAND_NOT_L, "vand_notL");
1812     }
1813 
1814     public static final String VECTOR_BLEND_B = VECTOR_PREFIX + "VECTOR_BLEND_B" + POSTFIX;
1815     static {
1816         vectorNode(VECTOR_BLEND_B, "VectorBlend", TYPE_BYTE);
1817     }
1818 
1819     public static final String VECTOR_BLEND_F = VECTOR_PREFIX + "VECTOR_BLEND_F" + POSTFIX;
1820     static {
1821         vectorNode(VECTOR_BLEND_F, "VectorBlend", TYPE_FLOAT);
1822     }
1823 
1824     public static final String VECTOR_BLEND_D = VECTOR_PREFIX + "VECTOR_BLEND_D" + POSTFIX;
1825     static {
1826         vectorNode(VECTOR_BLEND_D, "VectorBlend", TYPE_DOUBLE);
1827     }
1828 
1829     public static final String VECTOR_MASK_CMP_I = VECTOR_PREFIX + "VECTOR_MASK_CMP_I" + POSTFIX;
1830     static {
1831         vectorNode(VECTOR_MASK_CMP_I, "VectorMaskCmp", TYPE_INT);
1832     }
1833 
1834     public static final String VECTOR_MASK_CMP_L = VECTOR_PREFIX + "VECTOR_MASK_CMP_L" + POSTFIX;
1835     static {
1836         vectorNode(VECTOR_MASK_CMP_L, "VectorMaskCmp", TYPE_LONG);
1837     }
1838 
1839     public static final String VECTOR_MASK_CMP_F = VECTOR_PREFIX + "VECTOR_MASK_CMP_F" + POSTFIX;
1840     static {
1841         vectorNode(VECTOR_MASK_CMP_F, "VectorMaskCmp", TYPE_FLOAT);
1842     }
1843 
1844     public static final String VECTOR_MASK_CMP_D = VECTOR_PREFIX + "VECTOR_MASK_CMP_D" + POSTFIX;
1845     static {
1846         vectorNode(VECTOR_MASK_CMP_D, "VectorMaskCmp", TYPE_DOUBLE);
1847     }
1848 
1849     public static final String VECTOR_CAST_B2S = VECTOR_PREFIX + "VECTOR_CAST_B2S" + POSTFIX;
1850     static {
1851         vectorNode(VECTOR_CAST_B2S, "VectorCastB2X", TYPE_SHORT);
1852     }
1853 
1854     public static final String VECTOR_CAST_B2I = VECTOR_PREFIX + "VECTOR_CAST_B2I" + POSTFIX;
1855     static {
1856         vectorNode(VECTOR_CAST_B2I, "VectorCastB2X", TYPE_INT);
1857     }
1858 
1859     public static final String VECTOR_CAST_B2L = VECTOR_PREFIX + "VECTOR_CAST_B2L" + POSTFIX;
1860     static {
1861         vectorNode(VECTOR_CAST_B2L, "VectorCastB2X", TYPE_LONG);
1862     }
1863 
1864     public static final String VECTOR_CAST_B2F = VECTOR_PREFIX + "VECTOR_CAST_B2F" + POSTFIX;
1865     static {
1866         vectorNode(VECTOR_CAST_B2F, "VectorCastB2X", TYPE_FLOAT);
1867     }
1868 
1869     public static final String VECTOR_CAST_B2D = VECTOR_PREFIX + "VECTOR_CAST_B2D" + POSTFIX;
1870     static {
1871         vectorNode(VECTOR_CAST_B2D, "VectorCastB2X", TYPE_DOUBLE);
1872     }
1873 
1874     public static final String VECTOR_CAST_D2B = VECTOR_PREFIX + "VECTOR_CAST_D2B" + POSTFIX;
1875     static {
1876         vectorNode(VECTOR_CAST_D2B, "VectorCastD2X", TYPE_BYTE);
1877     }
1878 
1879     public static final String VECTOR_CAST_D2S = VECTOR_PREFIX + "VECTOR_CAST_D2S" + POSTFIX;
1880     static {
1881         vectorNode(VECTOR_CAST_D2S, "VectorCastD2X", TYPE_SHORT);
1882     }
1883 
1884     public static final String VECTOR_CAST_D2I = VECTOR_PREFIX + "VECTOR_CAST_D2I" + POSTFIX;
1885     static {
1886         vectorNode(VECTOR_CAST_D2I, "VectorCastD2X", TYPE_INT);
1887     }
1888 
1889     public static final String VECTOR_CAST_D2L = VECTOR_PREFIX + "VECTOR_CAST_D2L" + POSTFIX;
1890     static {
1891         vectorNode(VECTOR_CAST_D2L, "VectorCastD2X", TYPE_LONG);
1892     }
1893 
1894     public static final String VECTOR_CAST_D2F = VECTOR_PREFIX + "VECTOR_CAST_D2F" + POSTFIX;
1895     static {
1896         vectorNode(VECTOR_CAST_D2F, "VectorCastD2X", TYPE_FLOAT);
1897     }
1898 
1899     public static final String VECTOR_CAST_F2B = VECTOR_PREFIX + "VECTOR_CAST_F2B" + POSTFIX;
1900     static {
1901         vectorNode(VECTOR_CAST_F2B, "VectorCastF2X", TYPE_BYTE);
1902     }
1903 
1904     public static final String VECTOR_CAST_F2S = VECTOR_PREFIX + "VECTOR_CAST_F2S" + POSTFIX;
1905     static {
1906         vectorNode(VECTOR_CAST_F2S, "VectorCastF2X", TYPE_SHORT);
1907     }
1908 
1909     public static final String VECTOR_CAST_F2I = VECTOR_PREFIX + "VECTOR_CAST_F2I" + POSTFIX;
1910     static {
1911         vectorNode(VECTOR_CAST_F2I, "VectorCastF2X", TYPE_INT);
1912     }
1913 
1914     public static final String VECTOR_CAST_F2L = VECTOR_PREFIX + "VECTOR_CAST_F2L" + POSTFIX;
1915     static {
1916         vectorNode(VECTOR_CAST_F2L, "VectorCastF2X", TYPE_LONG);
1917     }
1918 
1919     public static final String VECTOR_CAST_F2D = VECTOR_PREFIX + "VECTOR_CAST_F2D" + POSTFIX;
1920     static {
1921         vectorNode(VECTOR_CAST_F2D, "VectorCastF2X", TYPE_DOUBLE);
1922     }
1923 
1924     public static final String VECTOR_CAST_I2B = VECTOR_PREFIX + "VECTOR_CAST_I2B" + POSTFIX;
1925     static {
1926         vectorNode(VECTOR_CAST_I2B, "VectorCastI2X", TYPE_BYTE);
1927     }
1928 
1929     public static final String VECTOR_CAST_I2S = VECTOR_PREFIX + "VECTOR_CAST_I2S" + POSTFIX;
1930     static {
1931         vectorNode(VECTOR_CAST_I2S, "VectorCastI2X", TYPE_SHORT);
1932     }
1933 
1934     public static final String VECTOR_CAST_I2L = VECTOR_PREFIX + "VECTOR_CAST_I2L" + POSTFIX;
1935     static {
1936         vectorNode(VECTOR_CAST_I2L, "VectorCastI2X", TYPE_LONG);
1937     }
1938 
1939     public static final String VECTOR_CAST_I2F = VECTOR_PREFIX + "VECTOR_CAST_I2F" + POSTFIX;
1940     static {
1941         vectorNode(VECTOR_CAST_I2F, "VectorCastI2X", TYPE_FLOAT);
1942     }
1943 
1944     public static final String VECTOR_CAST_I2D = VECTOR_PREFIX + "VECTOR_CAST_I2D" + POSTFIX;
1945     static {
1946         vectorNode(VECTOR_CAST_I2D, "VectorCastI2X", TYPE_DOUBLE);
1947     }
1948 
1949     public static final String VECTOR_CAST_L2B = VECTOR_PREFIX + "VECTOR_CAST_L2B" + POSTFIX;
1950     static {
1951         vectorNode(VECTOR_CAST_L2B, "VectorCastL2X", TYPE_BYTE);
1952     }
1953 
1954     public static final String VECTOR_CAST_L2S = VECTOR_PREFIX + "VECTOR_CAST_L2S" + POSTFIX;
1955     static {
1956         vectorNode(VECTOR_CAST_L2S, "VectorCastL2X", TYPE_SHORT);
1957     }
1958 
1959     public static final String VECTOR_CAST_L2I = VECTOR_PREFIX + "VECTOR_CAST_L2I" + POSTFIX;
1960     static {
1961         vectorNode(VECTOR_CAST_L2I, "VectorCastL2X", TYPE_INT);
1962     }
1963 
1964     public static final String VECTOR_CAST_L2F = VECTOR_PREFIX + "VECTOR_CAST_L2F" + POSTFIX;
1965     static {
1966         vectorNode(VECTOR_CAST_L2F, "VectorCastL2X", TYPE_FLOAT);
1967     }
1968 
1969     public static final String VECTOR_CAST_L2D = VECTOR_PREFIX + "VECTOR_CAST_L2D" + POSTFIX;
1970     static {
1971         vectorNode(VECTOR_CAST_L2D, "VectorCastL2X", TYPE_DOUBLE);
1972     }
1973 
1974     public static final String VECTOR_CAST_S2B = VECTOR_PREFIX + "VECTOR_CAST_S2B" + POSTFIX;
1975     static {
1976         vectorNode(VECTOR_CAST_S2B, "VectorCastS2X", TYPE_BYTE);
1977     }
1978 
1979     public static final String VECTOR_CAST_S2I = VECTOR_PREFIX + "VECTOR_CAST_S2I" + POSTFIX;
1980     static {
1981         vectorNode(VECTOR_CAST_S2I, "VectorCastS2X", TYPE_INT);
1982     }
1983 
1984     public static final String VECTOR_CAST_S2L = VECTOR_PREFIX + "VECTOR_CAST_S2L" + POSTFIX;
1985     static {
1986         vectorNode(VECTOR_CAST_S2L, "VectorCastS2X", TYPE_LONG);
1987     }
1988 
1989     public static final String VECTOR_CAST_S2F = VECTOR_PREFIX + "VECTOR_CAST_S2F" + POSTFIX;
1990     static {
1991         vectorNode(VECTOR_CAST_S2F, "VectorCastS2X", TYPE_FLOAT);
1992     }
1993 
1994     public static final String VECTOR_CAST_S2D = VECTOR_PREFIX + "VECTOR_CAST_S2D" + POSTFIX;
1995     static {
1996         vectorNode(VECTOR_CAST_S2D, "VectorCastS2X", TYPE_DOUBLE);
1997     }
1998 
1999     public static final String VECTOR_CAST_F2HF = VECTOR_PREFIX + "VECTOR_CAST_F2HF" + POSTFIX;
2000     static {
2001         vectorNode(VECTOR_CAST_F2HF, "VectorCastF2HF", TYPE_SHORT);
2002     }
2003 
2004     public static final String VECTOR_CAST_HF2F = VECTOR_PREFIX + "VECTOR_CAST_HF2F" + POSTFIX;
2005     static {
2006         vectorNode(VECTOR_CAST_HF2F, "VectorCastHF2F", TYPE_FLOAT);
2007     }
2008 
2009     public static final String VECTOR_MASK_CAST = PREFIX + "VECTOR_MASK_CAST" + POSTFIX;
2010     static {
2011         beforeMatchingNameRegex(VECTOR_MASK_CAST, "VectorMaskCast");
2012     }
2013 
2014     public static final String VECTOR_REINTERPRET = PREFIX + "VECTOR_REINTERPRET" + POSTFIX;
2015     static {
2016         beforeMatchingNameRegex(VECTOR_REINTERPRET, "VectorReinterpret");
2017     }
2018 
2019     public static final String VECTOR_UCAST_B2S = VECTOR_PREFIX + "VECTOR_UCAST_B2S" + POSTFIX;
2020     static {
2021         vectorNode(VECTOR_UCAST_B2S, "VectorUCastB2X", TYPE_SHORT);
2022     }
2023 
2024     public static final String VECTOR_UCAST_B2I = VECTOR_PREFIX + "VECTOR_UCAST_B2I" + POSTFIX;
2025     static {
2026         vectorNode(VECTOR_UCAST_B2I, "VectorUCastB2X", TYPE_INT);
2027     }
2028 
2029     public static final String VECTOR_UCAST_B2L = VECTOR_PREFIX + "VECTOR_UCAST_B2L" + POSTFIX;
2030     static {
2031         vectorNode(VECTOR_UCAST_B2L, "VectorUCastB2X", TYPE_LONG);
2032     }
2033 
2034     public static final String VECTOR_UCAST_I2L = VECTOR_PREFIX + "VECTOR_UCAST_I2L" + POSTFIX;
2035     static {
2036         vectorNode(VECTOR_UCAST_I2L, "VectorUCastI2X", TYPE_LONG);
2037     }
2038 
2039     public static final String VECTOR_UCAST_S2I = VECTOR_PREFIX + "VECTOR_UCAST_S2I" + POSTFIX;
2040     static {
2041         vectorNode(VECTOR_UCAST_S2I, "VectorUCastS2X", TYPE_INT);
2042     }
2043 
2044     public static final String VECTOR_UCAST_S2L = VECTOR_PREFIX + "VECTOR_UCAST_S2L" + POSTFIX;
2045     static {
2046         vectorNode(VECTOR_UCAST_S2L, "VectorUCastS2X", TYPE_LONG);
2047     }
2048 
2049     public static final String VECTOR_TEST = PREFIX + "VECTOR_TEST" + POSTFIX;
2050     static {
2051         beforeMatchingNameRegex(VECTOR_TEST, "VectorTest");
2052     }
2053 
2054     public static final String VFABD = PREFIX + "VFABD" + POSTFIX;
2055     static {
2056         machOnlyNameRegex(VFABD, "vfabd");
2057     }
2058 
2059     public static final String VFABD_MASKED = PREFIX + "VFABD_MASKED" + POSTFIX;
2060     static {
2061         machOnlyNameRegex(VFABD_MASKED, "vfabd_masked");
2062     }
2063 
2064     public static final String VFMSB_MASKED = PREFIX + "VFMSB_MASKED" + POSTFIX;
2065     static {
2066         machOnlyNameRegex(VFMSB_MASKED, "vfmsb_masked");
2067     }
2068 
2069     public static final String VFNMAD_MASKED = PREFIX + "VFNMAD_MASKED" + POSTFIX;
2070     static {
2071         machOnlyNameRegex(VFNMAD_MASKED, "vfnmad_masked");
2072     }
2073 
2074     public static final String VFNMSB_MASKED = PREFIX + "VFNMSB_MASKED" + POSTFIX;
2075     static {
2076         machOnlyNameRegex(VFNMSB_MASKED, "vfnmsb_masked");
2077     }
2078 
2079     public static final String VFMAD_MASKED = PREFIX + "VFMAD_MASKED" + POSTFIX;
2080     static {
2081         machOnlyNameRegex(VFMAD_MASKED, "vfmad_masked");
2082     }
2083 
2084     public static final String VMASK_AND_NOT_L = PREFIX + "VMASK_AND_NOT_L" + POSTFIX;
2085     static {
2086         machOnlyNameRegex(VMASK_AND_NOT_L, "vmask_and_notL");
2087     }
2088 
2089     public static final String VMLA = PREFIX + "VMLA" + POSTFIX;
2090     static {
2091         machOnlyNameRegex(VMLA, "vmla");
2092     }
2093 
2094     public static final String VMLA_MASKED = PREFIX + "VMLA_MASKED" + POSTFIX;
2095     static {
2096         machOnlyNameRegex(VMLA_MASKED, "vmla_masked");
2097     }
2098 
2099     public static final String FMSUB = PREFIX + "FMSUB" + POSTFIX;
2100     static {
2101         machOnlyNameRegex(FMSUB, "msub(F|D)_reg_reg");
2102     }
2103 
2104     public static final String FNMADD = PREFIX + "FNMADD" + POSTFIX;
2105     static {
2106         machOnlyNameRegex(FNMADD, "mnadd(F|D)_reg_reg");
2107     }
2108 
2109     public static final String FNMSUB = PREFIX + "FNMSUB" + POSTFIX;
2110     static {
2111         machOnlyNameRegex(FNMSUB, "mnsub(F|D)_reg_reg");
2112     }
2113 
2114     public static final String VFMLA = PREFIX + "VFMLA" + POSTFIX;
2115     static {
2116         machOnlyNameRegex(VFMLA, "vfmla");
2117     }
2118 
2119     public static final String VFMLS = PREFIX + "VFMLS" + POSTFIX;
2120     static {
2121         machOnlyNameRegex(VFMLS, "vfmls");
2122     }
2123 
2124     public static final String VFNMLA = PREFIX + "VFNMLA" + POSTFIX;
2125     static {
2126         machOnlyNameRegex(VFNMLA, "vfnmla");
2127     }
2128 
2129     public static final String VMLS = PREFIX + "VMLS" + POSTFIX;
2130     static {
2131         machOnlyNameRegex(VMLS, "vmls");
2132     }
2133 
2134     public static final String VMLS_MASKED = PREFIX + "VMLS_MASKED" + POSTFIX;
2135     static {
2136         machOnlyNameRegex(VMLS_MASKED, "vmls_masked");
2137     }
2138 
2139     public static final String VMASK_CMP_ZERO_I_NEON = PREFIX + "VMASK_CMP_ZERO_I_NEON" + POSTFIX;
2140     static {
2141         machOnlyNameRegex(VMASK_CMP_ZERO_I_NEON, "vmaskcmp_zeroI_neon");
2142     }
2143 
2144     public static final String VMASK_CMP_ZERO_L_NEON = PREFIX + "VMASK_CMP_ZERO_L_NEON" + POSTFIX;
2145     static {
2146         machOnlyNameRegex(VMASK_CMP_ZERO_L_NEON, "vmaskcmp_zeroL_neon");
2147     }
2148 
2149     public static final String VMASK_CMP_ZERO_F_NEON = PREFIX + "VMASK_CMP_ZERO_F_NEON" + POSTFIX;
2150     static {
2151         machOnlyNameRegex(VMASK_CMP_ZERO_F_NEON, "vmaskcmp_zeroF_neon");
2152     }
2153 
2154     public static final String VMASK_CMP_ZERO_D_NEON = PREFIX + "VMASK_CMP_ZERO_D_NEON" + POSTFIX;
2155     static {
2156         machOnlyNameRegex(VMASK_CMP_ZERO_D_NEON, "vmaskcmp_zeroD_neon");
2157     }
2158 
2159     public static final String VMASK_CMP_IMM_I_SVE = PREFIX + "VMASK_CMP_IMM_I_SVE" + POSTFIX;
2160     static {
2161         machOnlyNameRegex(VMASK_CMP_IMM_I_SVE, "vmaskcmp_immI_sve");
2162     }
2163 
2164     public static final String VMASK_CMPU_IMM_I_SVE = PREFIX + "VMASK_CMPU_IMM_I_SVE" + POSTFIX;
2165     static {
2166         machOnlyNameRegex(VMASK_CMPU_IMM_I_SVE, "vmaskcmpU_immI_sve");
2167     }
2168 
2169     public static final String VMASK_CMP_IMM_L_SVE = PREFIX + "VMASK_CMP_IMM_L_SVE" + POSTFIX;
2170     static {
2171         machOnlyNameRegex(VMASK_CMP_IMM_L_SVE, "vmaskcmp_immL_sve");
2172     }
2173 
2174     public static final String VMASK_CMPU_IMM_L_SVE = PREFIX + "VMASK_CMPU_IMM_L_SVE" + POSTFIX;
2175     static {
2176         machOnlyNameRegex(VMASK_CMPU_IMM_L_SVE, "vmaskcmpU_immL_sve");
2177     }
2178 
2179     public static final String VNOT_I_MASKED = PREFIX + "VNOT_I_MASKED" + POSTFIX;
2180     static {
2181         machOnlyNameRegex(VNOT_I_MASKED, "vnotI_masked");
2182     }
2183 
2184     public static final String VNOT_L_MASKED = PREFIX + "VNOT_L_MASKED" + POSTFIX;
2185     static {
2186         machOnlyNameRegex(VNOT_L_MASKED, "vnotL_masked");
2187     }
2188 
2189     public static final String VSTOREMASK_TRUECOUNT = PREFIX + "VSTOREMASK_TRUECOUNT" + POSTFIX;
2190     static {
2191         machOnlyNameRegex(VSTOREMASK_TRUECOUNT, "vstoremask_truecount_neon");
2192     }
2193 
2194     public static final String XOR = PREFIX + "XOR" + POSTFIX;
2195     static {
2196         beforeMatchingNameRegex(XOR, "Xor(I|L)");
2197     }
2198 
2199     public static final String XOR_I = PREFIX + "XOR_I" + POSTFIX;
2200     static {
2201         beforeMatchingNameRegex(XOR_I, "XorI");
2202     }
2203 
2204     public static final String XOR_L = PREFIX + "XOR_L" + POSTFIX;
2205     static {
2206         beforeMatchingNameRegex(XOR_L, "XorL");
2207     }
2208 
2209     public static final String XOR_VB = VECTOR_PREFIX + "XOR_VB" + POSTFIX;
2210     static {
2211         vectorNode(XOR_VB, "XorV", TYPE_BYTE);
2212     }
2213 
2214     public static final String XOR_VS = VECTOR_PREFIX + "XOR_VS" + POSTFIX;
2215     static {
2216         vectorNode(XOR_VS, "XorV", TYPE_SHORT);
2217     }
2218 
2219     public static final String XOR_VI = VECTOR_PREFIX + "XOR_VI" + POSTFIX;
2220     static {
2221         vectorNode(XOR_VI, "XorV", TYPE_INT);
2222     }
2223 
2224     public static final String XOR_VL = VECTOR_PREFIX + "XOR_VL" + POSTFIX;
2225     static {
2226         vectorNode(XOR_VL, "XorV", TYPE_LONG);
2227     }
2228 
2229     public static final String XOR_V_MASK = PREFIX + "XOR_V_MASK" + POSTFIX;
2230     static {
2231         beforeMatchingNameRegex(XOR_V_MASK, "XorVMask");
2232     }
2233 
2234     public static final String XOR_REDUCTION_V = PREFIX + "XOR_REDUCTION_V" + POSTFIX;
2235     static {
2236         superWordNodes(XOR_REDUCTION_V, "XorReductionV");
2237     }
2238 
2239     public static final String XOR3_NEON = PREFIX + "XOR3_NEON" + POSTFIX;
2240     static {
2241         machOnlyNameRegex(XOR3_NEON, "veor3_neon");
2242     }
2243 
2244     public static final String XOR3_SVE = PREFIX + "XOR3_SVE" + POSTFIX;
2245     static {
2246         machOnlyNameRegex(XOR3_SVE, "veor3_sve");
2247     }
2248 
2249     public static final String COMPRESS_BITS_VI = VECTOR_PREFIX + "COMPRESS_BITS_VI" + POSTFIX;
2250     static {
2251         vectorNode(COMPRESS_BITS_VI, "CompressBitsV", TYPE_INT);
2252     }
2253 
2254     public static final String COMPRESS_BITS_VL = VECTOR_PREFIX + "COMPRESS_BITS_VL" + POSTFIX;
2255     static {
2256         vectorNode(COMPRESS_BITS_VL, "CompressBitsV", TYPE_LONG);
2257     }
2258 
2259     public static final String EXPAND_BITS_VI = VECTOR_PREFIX + "EXPAND_BITS_VI" + POSTFIX;
2260     static {
2261         vectorNode(EXPAND_BITS_VI, "ExpandBitsV", TYPE_INT);
2262     }
2263 
2264     public static final String EXPAND_BITS_VL = VECTOR_PREFIX + "EXPAND_BITS_VL" + POSTFIX;
2265     static {
2266         vectorNode(EXPAND_BITS_VL, "ExpandBitsV", TYPE_LONG);
2267     }
2268 
2269     public static final String Z_LOAD_P_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "Z_LOAD_P_WITH_BARRIER_FLAG" + POSTFIX;
2270     static {
2271         String regex = START + "zLoadP\\S*" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END;
2272         machOnly(Z_LOAD_P_WITH_BARRIER_FLAG, regex);
2273     }
2274 
2275     public static final String Z_STORE_P_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "Z_STORE_P_WITH_BARRIER_FLAG" + POSTFIX;
2276     static {
2277         String regex = START + "zStoreP\\S*" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END;
2278         machOnly(Z_STORE_P_WITH_BARRIER_FLAG, regex);
2279     }
2280 
2281     public static final String Z_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "Z_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG" + POSTFIX;
2282     static {
2283         String regex = START + "zCompareAndSwapP" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END;
2284         machOnly(Z_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG, regex);
2285     }
2286 
2287     public static final String Z_GET_AND_SET_P_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "Z_GET_AND_SET_P_WITH_BARRIER_FLAG" + POSTFIX;
2288     static {
2289         String regex = START + "(zXChgP)|(zGetAndSetP\\S*)" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END;
2290         machOnly(Z_GET_AND_SET_P_WITH_BARRIER_FLAG, regex);
2291     }
2292 
2293     public static final String X86_LOCK_ADDB_REG = PREFIX + "X86_LOCK_ADDB_REG" + POSTFIX;
2294     static {
2295         machOnlyNameRegex(X86_LOCK_ADDB_REG, "xaddB_reg_no_res");
2296     }
2297 
2298     public static final String X86_LOCK_ADDB_IMM = PREFIX + "X86_LOCK_ADDB_IMM" + POSTFIX;
2299     static {
2300         machOnlyNameRegex(X86_LOCK_ADDB_IMM, "xaddB_imm_no_res");
2301     }
2302 
2303     public static final String X86_LOCK_XADDB = PREFIX + "X86_LOCK_XADDB" + POSTFIX;
2304     static {
2305         machOnlyNameRegex(X86_LOCK_XADDB, "xaddB");
2306     }
2307 
2308     public static final String X86_LOCK_ADDS_REG = PREFIX + "X86_LOCK_ADDS_REG" + POSTFIX;
2309     static {
2310         machOnlyNameRegex(X86_LOCK_ADDS_REG, "xaddS_reg_no_res");
2311     }
2312 
2313     public static final String X86_LOCK_ADDS_IMM = PREFIX + "X86_LOCK_ADDS_IMM" + POSTFIX;
2314     static {
2315         machOnlyNameRegex(X86_LOCK_ADDS_IMM, "xaddS_imm_no_res");
2316     }
2317 
2318     public static final String X86_LOCK_XADDS = PREFIX + "X86_LOCK_XADDS" + POSTFIX;
2319     static {
2320         machOnlyNameRegex(X86_LOCK_XADDS, "xaddS");
2321     }
2322 
2323     public static final String X86_LOCK_ADDI_REG = PREFIX + "X86_LOCK_ADDI_REG" + POSTFIX;
2324     static {
2325         machOnlyNameRegex(X86_LOCK_ADDI_REG, "xaddI_reg_no_res");
2326     }
2327 
2328     public static final String X86_LOCK_ADDI_IMM = PREFIX + "X86_LOCK_ADDI_IMM" + POSTFIX;
2329     static {
2330         machOnlyNameRegex(X86_LOCK_ADDI_IMM, "xaddI_imm_no_res");
2331     }
2332 
2333     public static final String X86_LOCK_XADDI = PREFIX + "X86_LOCK_XADDI" + POSTFIX;
2334     static {
2335         machOnlyNameRegex(X86_LOCK_XADDI, "xaddI");
2336     }
2337 
2338     public static final String X86_LOCK_ADDL_REG = PREFIX + "X86_LOCK_ADDL_REG" + POSTFIX;
2339     static {
2340         machOnlyNameRegex(X86_LOCK_ADDL_REG, "xaddL_reg_no_res");
2341     }
2342 
2343     public static final String X86_LOCK_ADDL_IMM = PREFIX + "X86_LOCK_ADDL_IMM" + POSTFIX;
2344     static {
2345         machOnlyNameRegex(X86_LOCK_ADDL_IMM, "xaddL_imm_no_res");
2346     }
2347 
2348     public static final String X86_LOCK_XADDL = PREFIX + "X86_LOCK_XADDL" + POSTFIX;
2349     static {
2350         machOnlyNameRegex(X86_LOCK_XADDL, "xaddL");
2351     }
2352 
2353     public static final String X86_TESTI_REG = PREFIX + "X86_TESTI_REG" + POSTFIX;
2354     static {
2355         machOnlyNameRegex(X86_TESTI_REG, "testI_reg");
2356     }
2357 
2358     public static final String X86_TESTL_REG = PREFIX + "X86_TESTL_REG" + POSTFIX;
2359     static {
2360         machOnlyNameRegex(X86_TESTL_REG, "testL_reg");
2361     }
2362 
2363     public static final String X86_CMOVEL_IMM01 = PREFIX + "X86_CMOVEL_IMM01" + POSTFIX;
2364     static {
2365         machOnlyNameRegex(X86_CMOVEL_IMM01, "cmovL_imm_01");
2366     }
2367 
2368     public static final String X86_CMOVEL_IMM01U = PREFIX + "X86_CMOVEL_IMM01U" + POSTFIX;
2369     static {
2370         machOnlyNameRegex(X86_CMOVEL_IMM01U, "cmovL_imm_01U");
2371     }
2372 
2373     public static final String X86_CMOVEL_IMM01UCF = PREFIX + "X86_CMOVEL_IMM01UCF" + POSTFIX;
2374     static {
2375         machOnlyNameRegex(X86_CMOVEL_IMM01UCF, "cmovL_imm_01UCF");
2376     }
2377 
2378     /*
2379      * Utility methods to set up IR_NODE_MAPPINGS.
2380      */
2381 
2382     /**
2383      * Apply {@code regex} on all machine independent ideal graph phases up to and including
2384      * {@link CompilePhase#BEFORE_MATCHING}.
2385      */
2386     private static void beforeMatching(String irNodePlaceholder, String regex) {
2387         IR_NODE_MAPPINGS.put(irNodePlaceholder, new RegexTypeEntry(RegexType.IDEAL_INDEPENDENT, regex));
2388     }
2389 
2390     /**
2391      * Apply {@code irNodeRegex} as regex for the IR node name on all machine independent ideal graph phases up to and
2392      * including {@link CompilePhase#BEFORE_MATCHING}.
2393      */
2394     private static void beforeMatchingNameRegex(String irNodePlaceholder, String irNodeRegex) {
2395         String regex = START + irNodeRegex + MID + END;
2396         IR_NODE_MAPPINGS.put(irNodePlaceholder, new RegexTypeEntry(RegexType.IDEAL_INDEPENDENT, regex));
2397     }
2398 
2399     /**
2400      * Apply {@code irNodeRegex} as regex for the IR vector node name on all machine independent ideal graph phases up to and
2401      * including {@link CompilePhase#BEFORE_MATCHING}. Since this is a vector node, we can also check the vector element
2402      * type {@code typeString} and the vector size (number of elements), {@see VECTOR_SIZE}.
2403      */
2404     private static void vectorNode(String irNodePlaceholder, String irNodeRegex, String typeString) {
2405         TestFramework.check(isVectorIRNode(irNodePlaceholder), "vectorNode: failed prefix check for irNodePlaceholder "
2406                                                                + irNodePlaceholder + " -> did you use VECTOR_PREFIX?");
2407         // IS_REPLACED is later replaced with the specific type and size of the vector.
2408         String regex = START + irNodeRegex + MID  + IS_REPLACED + END;
2409         IR_NODE_MAPPINGS.put(irNodePlaceholder, new RegexTypeEntry(RegexType.IDEAL_INDEPENDENT, regex));
2410         VECTOR_NODE_TYPE.put(irNodePlaceholder, typeString);
2411     }
2412 
2413     private static void allocNodes(String irNode, String irNodeName, String optoRegex) {
2414         String idealIndependentRegex = START + irNodeName + "\\b" + MID + END;
2415         Map<PhaseInterval, String> intervalToRegexMap = new HashMap<>();
2416         intervalToRegexMap.put(new PhaseInterval(CompilePhase.BEFORE_REMOVEUSELESS, CompilePhase.PHASEIDEALLOOP_ITERATIONS),
2417                                idealIndependentRegex);
2418         intervalToRegexMap.put(new PhaseInterval(CompilePhase.PRINT_OPTO_ASSEMBLY), optoRegex);
2419         MultiPhaseRangeEntry entry = new MultiPhaseRangeEntry(CompilePhase.PRINT_OPTO_ASSEMBLY, intervalToRegexMap);
2420         IR_NODE_MAPPINGS.put(irNode, entry);
2421     }
2422 
2423     private static void callOfNodes(String irNodePlaceholder, String callRegex) {
2424         String regex = START + callRegex + MID + IS_REPLACED + " " +  END;
2425         IR_NODE_MAPPINGS.put(irNodePlaceholder, new RegexTypeEntry(RegexType.IDEAL_INDEPENDENT, regex));
2426     }
2427 
2428     /**
2429      * Apply {@code regex} on all machine dependant ideal graph phases (i.e. on the mach graph) starting from
2430      * {@link CompilePhase#MATCHING}.
2431      */
2432     private static void optoOnly(String irNodePlaceholder, String regex) {
2433         IR_NODE_MAPPINGS.put(irNodePlaceholder, new RegexTypeEntry(RegexType.OPTO_ASSEMBLY, regex));
2434     }
2435 
2436     private static void machOnly(String irNodePlaceholder, String regex) {
2437         IR_NODE_MAPPINGS.put(irNodePlaceholder, new RegexTypeEntry(RegexType.MACH, regex));
2438     }
2439 
2440     private static void machOnlyNameRegex(String irNodePlaceholder, String irNodeRegex) {
2441         String regex = START + irNodeRegex + MID + END;
2442         IR_NODE_MAPPINGS.put(irNodePlaceholder, new RegexTypeEntry(RegexType.MACH, regex));
2443     }
2444 
2445     /**
2446      * Apply {@code regex} on all ideal graph phases starting from {@link CompilePhase#AFTER_CLOOPS}.
2447      */
2448     private static void fromAfterCountedLoops(String irNodePlaceholder, String regex) {
2449         IR_NODE_MAPPINGS.put(irNodePlaceholder, new SinglePhaseRangeEntry(CompilePhase.PRINT_IDEAL, regex,
2450                                                                           CompilePhase.AFTER_CLOOPS,
2451                                                                           CompilePhase.FINAL_CODE));
2452     }
2453 
2454     /**
2455      * Apply {@code regex} on all ideal graph phases starting from {@link CompilePhase#BEFORE_CLOOPS}.
2456      */
2457     private static void fromBeforeCountedLoops(String irNodePlaceholder, String regex) {
2458         IR_NODE_MAPPINGS.put(irNodePlaceholder, new SinglePhaseRangeEntry(CompilePhase.PRINT_IDEAL, regex,
2459                                                                           CompilePhase.BEFORE_CLOOPS,
2460                                                                           CompilePhase.FINAL_CODE));
2461     }
2462 
2463     /**
2464      * Apply {@code regex} on all ideal graph phases starting from {@link CompilePhase#BEFORE_CLOOPS} up to and
2465      * including {@link CompilePhase#BEFORE_MATCHING}
2466      */
2467     private static void fromMacroToBeforeMatching(String irNodePlaceholder, String regex) {
2468         IR_NODE_MAPPINGS.put(irNodePlaceholder, new SinglePhaseRangeEntry(CompilePhase.PRINT_IDEAL, regex,
2469                                                                           CompilePhase.AFTER_MACRO_EXPANSION,
2470                                                                           CompilePhase.BEFORE_MATCHING));
2471     }
2472 
2473     /**
2474      * Apply {@code regex} on all ideal graph phases starting from {@link CompilePhase#BEFORE_CLOOPS} up to and
2475      * including {@link CompilePhase#BEFORE_MATCHING}
2476      */
2477     private static void afterBarrierExpansionToBeforeMatching(String irNodePlaceholder, String regex) {
2478         IR_NODE_MAPPINGS.put(irNodePlaceholder, new SinglePhaseRangeEntry(CompilePhase.PRINT_IDEAL, regex,
2479                                                                           CompilePhase.OPTIMIZE_FINISHED,
2480                                                                           CompilePhase.BEFORE_MATCHING));
2481     }
2482 
2483     private static void trapNodes(String irNodePlaceholder, String trapReason) {
2484         String regex = START + "CallStaticJava" + MID + "uncommon_trap.*" + trapReason + END;
2485         beforeMatching(irNodePlaceholder, regex);
2486     }
2487 
2488     private static void loadOfNodes(String irNodePlaceholder, String irNodeRegex) {
2489         String regex = START + irNodeRegex + MID + "@\\S*" + IS_REPLACED + LOAD_OF_CLASS_POSTFIX;
2490         beforeMatching(irNodePlaceholder, regex);
2491     }
2492 
2493     private static void storeOfNodes(String irNodePlaceholder, String irNodeRegex) {
2494         String regex = START + irNodeRegex + MID + "@\\S*" + IS_REPLACED + STORE_OF_CLASS_POSTFIX;
2495         beforeMatching(irNodePlaceholder, regex);
2496     }
2497 
2498     /**
2499      * Apply {@code regex} on all ideal graph phases starting from {@link CompilePhase#PHASEIDEALLOOP1} which is the
2500      * first phase that could contain vector nodes from super word.
2501      */
2502     private static void superWordNodes(String irNodePlaceholder, String irNodeRegex) {
2503         String regex = START + irNodeRegex + MID + END;
2504         IR_NODE_MAPPINGS.put(irNodePlaceholder, new SinglePhaseRangeEntry(CompilePhase.PRINT_IDEAL, regex,
2505                                                                           CompilePhase.PHASEIDEALLOOP1,
2506                                                                           CompilePhase.BEFORE_MATCHING));
2507     }
2508 
2509 
2510     /*
2511      * Methods used internally by the IR framework.
2512      */
2513 
2514     /**
2515      * Is {@code irNodeString} an IR node placeholder string?
2516      */
2517     public static boolean isIRNode(String irNodeString) {
2518         return irNodeString.startsWith(PREFIX);
2519     }
2520 
2521     /**
2522      * Is {@code irCompositeNodeString} an IR composite node placeholder string?
2523      */
2524     public static boolean isCompositeIRNode(String irCompositeNodeString) {
2525         return irCompositeNodeString.startsWith(COMPOSITE_PREFIX);
2526     }
2527 
2528     /**
2529      * Is {@code irVectorNodeString} an IR vector node placeholder string?
2530      */
2531     public static boolean isVectorIRNode(String irVectorNodeString) {
2532         return irVectorNodeString.startsWith(VECTOR_PREFIX);
2533     }
2534 
2535     /**
2536      * Is {@code irVectorSizeString} a vector size string?
2537      */
2538     public static boolean isVectorSize(String irVectorSizeString) {
2539         return irVectorSizeString.startsWith(VECTOR_SIZE);
2540     }
2541 
2542     /**
2543      * Parse {@code sizeString} and generate a regex pattern to match for the size in the IR dump.
2544      */
2545     public static String parseVectorNodeSize(String sizeString, String typeString, VMInfo vmInfo) {
2546         if (sizeString.equals(VECTOR_SIZE_TAG_ANY)) {
2547             return "\\\\d+"; // match with any number
2548         }
2549         // Try to parse any tags, convert to comma separated list of ints
2550         sizeString = parseVectorNodeSizeTag(sizeString, typeString, vmInfo);
2551         // Parse comma separated list of numbers
2552         String[] sizes = sizeString.split(",");
2553         String regex = "";
2554         for (int i = 0; i < sizes.length; i++) {
2555             int size = 0;
2556             try {
2557                 size = Integer.parseInt(sizes[i]);
2558             } catch (NumberFormatException e) {
2559                 throw new TestFormatException("Vector node has invalid size \"" + sizes[i] + "\", in \"" + sizeString + "\"");
2560             }
2561             TestFormat.checkNoReport(size > 1, "Vector node size must be 2 or larger, but got \"" + sizes[i] + "\", in \"" + sizeString + "\"");
2562             regex += ((i > 0) ? "|" : "") + size;
2563         }
2564         if (sizes.length > 1) {
2565            regex = "(" + regex + ")";
2566         }
2567         return regex;
2568     }
2569 
2570     /**
2571      * If {@code sizeTagString} is a size tag, return the list of accepted sizes, else return sizeTagString.
2572      */
2573     public static String parseVectorNodeSizeTag(String sizeTagString, String typeString, VMInfo vmInfo) {
2574         // Parse out "min(a,b,c,...)"
2575         if (sizeTagString.startsWith("min(") && sizeTagString.endsWith(")")) {
2576             return parseVectorNodeSizeTagMin(sizeTagString, typeString, vmInfo);
2577         }
2578 
2579         // Parse individual tags
2580         return switch (sizeTagString) {
2581             case VECTOR_SIZE_TAG_MAX -> String.valueOf(getMaxElementsForType(typeString, vmInfo));
2582             case "max_byte"          -> String.valueOf(getMaxElementsForType(TYPE_BYTE, vmInfo));
2583             case "max_char"          -> String.valueOf(getMaxElementsForType(TYPE_CHAR, vmInfo));
2584             case "max_short"         -> String.valueOf(getMaxElementsForType(TYPE_SHORT, vmInfo));
2585             case "max_int"           -> String.valueOf(getMaxElementsForType(TYPE_INT, vmInfo));
2586             case "max_long"          -> String.valueOf(getMaxElementsForType(TYPE_LONG, vmInfo));
2587             case "max_float"         -> String.valueOf(getMaxElementsForType(TYPE_FLOAT, vmInfo));
2588             case "max_double"        -> String.valueOf(getMaxElementsForType(TYPE_DOUBLE, vmInfo));
2589             case "LoopMaxUnroll"     -> String.valueOf(vmInfo.getLongValue("LoopMaxUnroll"));
2590             default                  -> sizeTagString;
2591         };
2592     }
2593 
2594     /**
2595      * Parse {@code sizeTagString}, which must be a min-clause.
2596      */
2597     public static String parseVectorNodeSizeTagMin(String sizeTagString, String typeString, VMInfo vmInfo) {
2598         String[] tags = sizeTagString.substring(4, sizeTagString.length() - 1).split(",");
2599         TestFormat.checkNoReport(tags.length > 1, "Vector node size \"min(...)\" must have at least 2 comma separated arguments, got \"" + sizeTagString + "\"");
2600         int minVal = 1024;
2601         for (int i = 0; i < tags.length; i++) {
2602             String tag = parseVectorNodeSizeTag(tags[i].trim(), typeString, vmInfo);
2603             int tag_val = 0;
2604             try {
2605                 tag_val = Integer.parseInt(tag);
2606             } catch (NumberFormatException e) {
2607                 throw new TestFormatException("Vector node has invalid size in \"min(...)\", argument " + i + ", \"" + tag + "\", in \"" + sizeTagString + "\"");
2608             }
2609             minVal = Math.min(minVal, tag_val);
2610         }
2611         return String.valueOf(minVal);
2612     }
2613 
2614     /**
2615      * Return maximal number of elements that can fit in a vector of the specified type.
2616      */
2617     public static long getMaxElementsForType(String typeString, VMInfo vmInfo) {
2618         long maxVectorSize = vmInfo.getLongValue("MaxVectorSize");
2619         TestFormat.checkNoReport(maxVectorSize > 0, "VMInfo: MaxVectorSize is not larger than zero");
2620         long maxBytes = maxVectorSize;
2621 
2622         if (Platform.isX64() || Platform.isX86()) {
2623             maxBytes = Math.min(maxBytes, getMaxElementsForTypeOnX86(typeString, vmInfo));
2624         }
2625 
2626         // compute elements per vector: vector bytes divided by bytes per element
2627         int bytes = getTypeSizeInBytes(typeString);
2628         return maxBytes / bytes;
2629     }
2630 
2631     /**
2632      * Return maximal number of elements that can fit in a vector of the specified type, on x86 / x64.
2633      */
2634     public static long getMaxElementsForTypeOnX86(String typeString, VMInfo vmInfo) {
2635         // restrict maxBytes for specific features, see Matcher::vector_width_in_bytes in x86.ad:
2636         boolean avx1 = vmInfo.hasCPUFeature("avx");
2637         boolean avx2 = vmInfo.hasCPUFeature("avx2");
2638         boolean avx512 = vmInfo.hasCPUFeature("avx512f");
2639         boolean avx512bw = vmInfo.hasCPUFeature("avx512bw");
2640         long maxBytes;
2641         if (avx512) {
2642             maxBytes = 64;
2643         } else if (avx2) {
2644             maxBytes = 32;
2645         } else {
2646             maxBytes = 16;
2647         }
2648         if (avx1 && (typeString.equals(TYPE_FLOAT) || typeString.equals(TYPE_DOUBLE))) {
2649             maxBytes = avx512 ? 64 : 32;
2650         }
2651         if (avx512 && (typeString.equals(TYPE_BYTE) || typeString.equals(TYPE_SHORT) || typeString.equals(TYPE_CHAR))) {
2652             maxBytes = avx512bw ? 64 : 32;
2653         }
2654 
2655         return maxBytes;
2656     }
2657 
2658     /**
2659      * Return size in bytes of type named by {@code typeString}, return 0 if it does not name a type.
2660      */
2661     public static int getTypeSizeInBytes(String typeString) {
2662         return switch (typeString) {
2663             case TYPE_BYTE              -> 1;
2664             case TYPE_CHAR, TYPE_SHORT  -> 2;
2665             case TYPE_INT, TYPE_FLOAT   -> 4;
2666             case TYPE_LONG, TYPE_DOUBLE -> 8;
2667             default                     -> 0;
2668         };
2669     }
2670 
2671     /**
2672      * Returns "IRNode.XYZ", where XYZ is one of the IR node placeholder variable names defined above.
2673      */
2674     public static String getIRNodeAccessString(String irNodeString) {
2675         int prefixLength;
2676         if (isCompositeIRNode(irNodeString)) {
2677             TestFramework.check(irNodeString.length() > COMPOSITE_PREFIX.length() + POSTFIX.length(),
2678                                 "Invalid composite node placeholder: " + irNodeString);
2679             prefixLength = COMPOSITE_PREFIX.length();
2680         } else if (isVectorIRNode(irNodeString)) {
2681             TestFramework.check(irNodeString.length() > VECTOR_PREFIX.length() + POSTFIX.length(),
2682                                 "Invalid vector node placeholder: " + irNodeString);
2683             prefixLength = VECTOR_PREFIX.length();
2684         } else {
2685             prefixLength = PREFIX.length();
2686         }
2687         return "IRNode." + irNodeString.substring(prefixLength, irNodeString.length() - POSTFIX.length());
2688     }
2689 
2690     /**
2691      * Is this IR node supported on current platform, used VM build, etc.?
2692      * Throws a {@link CheckedTestFrameworkException} if the IR node is unsupported.
2693      */
2694     public static void checkIRNodeSupported(String node) throws CheckedTestFrameworkException {
2695         switch (node) {
2696             case INTRINSIC_OR_TYPE_CHECKED_INLINING_TRAP -> {
2697                 if (!WhiteBox.getWhiteBox().isJVMCISupportedByGC()) {
2698                     throw new CheckedTestFrameworkException("INTRINSIC_OR_TYPE_CHECKED_INLINING_TRAP is unsupported " +
2699                                                             "in builds without JVMCI.");
2700                 }
2701             }
2702             case CHECKCAST_ARRAYCOPY -> {
2703                 if (Platform.isS390x()) {
2704                     throw new CheckedTestFrameworkException("CHECKCAST_ARRAYCOPY is unsupported on s390.");
2705                 }
2706             }
2707             case IS_FINITE_D, IS_FINITE_F -> {
2708                 if (!Platform.isRISCV64()) {
2709                     throw new CheckedTestFrameworkException("IS_FINITE_* is only supported on riscv64.");
2710                 }
2711             }
2712             // default: do nothing -> IR node is supported and can be used by the user.
2713         }
2714     }
2715 
2716     /**
2717      * Get the regex of an IR node for a specific compile phase. If {@code irNode} is not an IR node placeholder string
2718      * or if there is no regex specified for {@code compilePhase}, a {@link TestFormatException} is reported.
2719      */
2720     public static String getRegexForCompilePhase(String irNode, CompilePhase compilePhase) {
2721         IRNodeMapEntry entry = IR_NODE_MAPPINGS.get(irNode);
2722         String failMsg = "IR Node \"" + irNode + "\" defined in class IRNode has no regex/compiler phase mapping " +
2723                          "(i.e. no static initializer block that adds a mapping entry to IRNode.IR_NODE_MAPPINGS)." +
2724                          System.lineSeparator() +
2725                          "   Have you just created the entry \"" + irNode + "\" in class IRNode and forgot to add a " +
2726                          "mapping?" + System.lineSeparator() +
2727                          "   Violation";
2728         TestFormat.checkNoReport(entry != null, failMsg);
2729         String regex = entry.regexForCompilePhase(compilePhase);
2730         failMsg = "IR Node \"" + irNode + "\" defined in class IRNode has no regex defined for compile phase "
2731                   + compilePhase + "." + System.lineSeparator() +
2732                   "   If you think this compile phase should be supported, update the mapping for \"" + irNode +
2733                   "\" in class IRNode (i.e the static initializer block immediately following the definition of \"" +
2734                   irNode + "\")." + System.lineSeparator() +
2735                   "   Violation";
2736         TestFormat.checkNoReport(regex != null, failMsg);
2737         return regex;
2738     }
2739 
2740     /**
2741      * Get the default phase of an IR node. If {@code irNode} is not an IR node placeholder string, a
2742      * {@link TestFormatException} is reported.
2743      */
2744     public static CompilePhase getDefaultPhase(String irNode) {
2745         IRNodeMapEntry entry = IR_NODE_MAPPINGS.get(irNode);
2746         String failMsg = "\"" + irNode + "\" is not an IR node defined in class IRNode and " +
2747                          "has therefore no default compile phase specified." + System.lineSeparator() +
2748                          "   If your regex represents a C2 IR node, consider adding an entry to class IRNode together " +
2749                          "with a static initializer block that adds a mapping to IRNode.IR_NODE_MAPPINGS." +
2750                          System.lineSeparator() +
2751                          "   Otherwise, set the @IR \"phase\" attribute to a compile phase different from " +
2752                          "CompilePhase.DEFAULT to explicitly tell the IR framework on which compile phase your rule" +
2753                          " should be applied on." + System.lineSeparator() +
2754                          "   Violation";
2755         TestFormat.checkNoReport(entry != null, failMsg);
2756         return entry.defaultCompilePhase();
2757     }
2758 
2759     public static String getVectorNodeType(String irNode) {
2760         String typeString = VECTOR_NODE_TYPE.get(irNode);
2761         String failMsg = "\"" + irNode + "\" is not a Vector IR node defined in class IRNode";
2762         TestFormat.check(typeString != null, failMsg);
2763         return typeString;
2764     }
2765 }