-
Notifications
You must be signed in to change notification settings - Fork 5.8k
/
Copy pathIRNode.java
2976 lines (2449 loc) · 106 KB
/
IRNode.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package compiler.lib.ir_framework;
import compiler.lib.ir_framework.driver.irmatching.mapping.*;
import compiler.lib.ir_framework.driver.irmatching.parser.VMInfo;
import compiler.lib.ir_framework.shared.CheckedTestFrameworkException;
import compiler.lib.ir_framework.shared.TestFormat;
import compiler.lib.ir_framework.shared.TestFormatException;
import jdk.test.lib.Platform;
import jdk.test.whitebox.WhiteBox;
import java.util.HashMap;
import java.util.Map;
/**
* This class specifies IR node placeholder strings (also referred to as just "IR nodes") with mappings to regexes
* depending on the selected compile phases. The mappings are stored in {@link #IR_NODE_MAPPINGS}. Each IR node
* placeholder string is mapped to a {@link IRNodeMapEntry} instance defined in
* {@link compiler.lib.ir_framework.driver.irmatching.mapping}.
*
* <p>
* IR node placeholder strings can be used in {@link IR#failOn()} and/or {@link IR#counts()} attributes to define IR
* constraints. They usually represent a single C2 IR node or a group of them.
*
* <p>
* Each IR node placeholder string is accompanied by a static block that defines an IR node placeholder to regex(es)
* mapping. The IR framework will automatically replace each IR node placeholder string in a user defined test with a
* regex depending on the selected compile phases in {@link IR#phase} and the provided mapping.
*
* <p>
* Each mapping must define a default compile phase which is applied when the user does not explicitly set the
* {@link IR#phase()} attribute or when directly using {@link CompilePhase#DEFAULT}. In this case, the IR framework
* falls back on the default compile phase of any {@link IRNodeMapEntry}.
*
* <p>
* The IR framework reports a {@link TestFormatException} if:
* <ul>
* <li><p> A user test specifies a compile phase for which no mapping is defined in this class.</li>
* <li><p> An IR node placeholder string is either missing a mapping or does not provide a regex for a specified
* compile phase in {@link IR#phase}.
* </ul>
*
* <p>
* There are two types of IR nodes:
* <ul>
* <li><p>Normal IR nodes: The IR node placeholder string is directly replaced by a regex.</li>
* <li><p>Composite IR nodes: The IR node placeholder string contains an additional {@link #COMPOSITE_PREFIX}.
* Using this IR node expects another user provided string in the constraint list of
* {@link IR#failOn()} and {@link IR#counts()}. They cannot be used as normal IR nodes.
* Trying to do so will result in a format violation error.</li>
* <li><p>Vector IR nodes: The IR node placeholder string contains an additional {@link #VECTOR_PREFIX}.
* Using this IR node, one can check for the type and size of a vector. The type must
* be directly specified in {@link #vectorNode}. The size can be specified directly with
* an additional argument using {@link #VECTOR_SIZE}, followed by a size tag or a comma
* separated list of sizes. If the size argument is not given, then a default size of
* {@link #VECTOR_SIZE_MAX} is taken, which is the number of elements that can fit in a
* vector of the specified type (depends on the VM flag MaxVectorSize and CPU features).
* However, when using {@link IR#failOn} or {@link IR#counts()} with comparison {@code <},
* or {@code <=} or {@code =0}, the default size is {@link #VECTOR_SIZE_ANY}, allowing any
* size. The motivation for these default values is that in most cases one wants to have
* vectorization with maximal vector width, or no vectorization of any vector width.
* </ul>
*/
public class IRNode {
/**
* Prefix for normal IR nodes.
*/
private static final String PREFIX = "_#";
/**
* Prefix for composite IR nodes.
*/
private static final String COMPOSITE_PREFIX = PREFIX + "C#";
/**
* Prefix for vector IR nodes.
*/
private static final String VECTOR_PREFIX = PREFIX + "V#";
private static final String POSTFIX = "#_";
private static final String START = "(\\d+(\\s){2}(";
private static final String MID = ".*)+(\\s){2}===.*";
private static final String END = ")";
private static final String STORE_OF_CLASS_POSTFIX = "(:|\\+)\\S* \\*" + END;
private static final String LOAD_OF_CLASS_POSTFIX = "(:|\\+)\\S* \\*" + END;
public static final String IS_REPLACED = "#IS_REPLACED#"; // Is replaced by an additional user-defined string.
public static final String VECTOR_SIZE = "_@";
public static final String VECTOR_SIZE_TAG_ANY = "any";
public static final String VECTOR_SIZE_TAG_MAX = "max_for_type";
public static final String VECTOR_SIZE_ANY = VECTOR_SIZE + VECTOR_SIZE_TAG_ANY; // default for counts "=0" and failOn
public static final String VECTOR_SIZE_MAX = VECTOR_SIZE + VECTOR_SIZE_TAG_MAX; // default in counts
public static final String VECTOR_SIZE_2 = VECTOR_SIZE + "2";
public static final String VECTOR_SIZE_4 = VECTOR_SIZE + "4";
public static final String VECTOR_SIZE_8 = VECTOR_SIZE + "8";
public static final String VECTOR_SIZE_16 = VECTOR_SIZE + "16";
public static final String VECTOR_SIZE_32 = VECTOR_SIZE + "32";
public static final String VECTOR_SIZE_64 = VECTOR_SIZE + "64";
private static final String TYPE_BYTE = "B";
private static final String TYPE_CHAR = "C";
private static final String TYPE_SHORT = "S";
private static final String TYPE_INT = "I";
private static final String TYPE_LONG = "J";
private static final String TYPE_FLOAT = "F";
private static final String TYPE_DOUBLE = "D";
/**
* IR placeholder string to regex-for-compile-phase map.
*/
private static final Map<String, IRNodeMapEntry> IR_NODE_MAPPINGS = new HashMap<>();
/**
* Map every vectorNode to a type string.
*/
private static final Map<String, String> VECTOR_NODE_TYPE = new HashMap<>();
/*
* Start of IR placeholder string definitions followed by a static block defining the regex-for-compile-phase mapping.
* An IR node placeholder string must start with PREFIX for normal IR nodes or COMPOSITE_PREFIX for composite IR
* nodes, or VECTOR_PREFIX for vector nodes (see class description above).
*
* An IR node definition looks like this:
*
* public static final String IR_NODE = [PREFIX|COMPOSITE_PREFIX|VECTOR_PREFIX] + "IR_NODE" + POSTFIX;
* static {
* // Define IR_NODE to regex-for-compile-phase mapping. Create a new IRNodeMapEntry object and add it to
* // IR_NODE_MAPPINGS. This can be done by using the helper methods defined after all IR node placeholder string
* // definitions.
* }
*/
public static final String ABS_D = PREFIX + "ABS_D" + POSTFIX;
static {
beforeMatchingNameRegex(ABS_D, "AbsD");
}
public static final String ABS_F = PREFIX + "ABS_F" + POSTFIX;
static {
beforeMatchingNameRegex(ABS_F, "AbsF");
}
public static final String ABS_I = PREFIX + "ABS_I" + POSTFIX;
static {
beforeMatchingNameRegex(ABS_I, "AbsI");
}
public static final String ABS_L = PREFIX + "ABS_L" + POSTFIX;
static {
beforeMatchingNameRegex(ABS_L, "AbsL");
}
public static final String ABS_VB = VECTOR_PREFIX + "ABS_VB" + POSTFIX;
static {
vectorNode(ABS_VB, "AbsVB", TYPE_BYTE);
}
// ABS_VC / AbsVC does not exist (char is 2 byte unsigned)
public static final String ABS_VS = VECTOR_PREFIX + "ABS_VS" + POSTFIX;
static {
vectorNode(ABS_VS, "AbsVS", TYPE_SHORT);
}
public static final String ABS_VI = VECTOR_PREFIX + "ABS_VI" + POSTFIX;
static {
vectorNode(ABS_VI, "AbsVI", TYPE_INT);
}
public static final String ABS_VL = VECTOR_PREFIX + "ABS_VL" + POSTFIX;
static {
vectorNode(ABS_VL, "AbsVL", TYPE_LONG);
}
public static final String ABS_VF = VECTOR_PREFIX + "ABS_VF" + POSTFIX;
static {
vectorNode(ABS_VF, "AbsVF", TYPE_FLOAT);
}
public static final String ABS_VD = VECTOR_PREFIX + "ABS_VD" + POSTFIX;
static {
vectorNode(ABS_VD, "AbsVD", TYPE_DOUBLE);
}
public static final String ADD = PREFIX + "ADD" + POSTFIX;
static {
beforeMatchingNameRegex(ADD, "Add(I|L|F|D|P)");
}
public static final String ADD_F = PREFIX + "ADD_F" + POSTFIX;
static {
beforeMatchingNameRegex(ADD_F, "AddF");
}
public static final String ADD_I = PREFIX + "ADD_I" + POSTFIX;
static {
beforeMatchingNameRegex(ADD_I, "AddI");
}
public static final String ADD_L = PREFIX + "ADD_L" + POSTFIX;
static {
beforeMatchingNameRegex(ADD_L, "AddL");
}
public static final String ADD_HF = PREFIX + "ADD_HF" + POSTFIX;
static {
beforeMatchingNameRegex(ADD_HF, "AddHF");
}
public static final String ADD_P = PREFIX + "ADD_P" + POSTFIX;
static {
beforeMatchingNameRegex(ADD_P, "AddP");
}
public static final String ADD_VD = VECTOR_PREFIX + "ADD_VD" + POSTFIX;
static {
vectorNode(ADD_VD, "AddVD", TYPE_DOUBLE);
}
public static final String ADD_VI = VECTOR_PREFIX + "ADD_VI" + POSTFIX;
static {
vectorNode(ADD_VI, "AddVI", TYPE_INT);
}
public static final String ADD_VF = VECTOR_PREFIX + "ADD_VF" + POSTFIX;
static {
vectorNode(ADD_VF, "AddVF", TYPE_FLOAT);
}
public static final String ADD_VB = VECTOR_PREFIX + "ADD_VB" + POSTFIX;
static {
vectorNode(ADD_VB, "AddVB", TYPE_BYTE);
}
public static final String ADD_VS = VECTOR_PREFIX + "ADD_VS" + POSTFIX;
static {
vectorNode(ADD_VS, "AddVS", TYPE_SHORT);
}
public static final String ADD_VL = VECTOR_PREFIX + "ADD_VL" + POSTFIX;
static {
vectorNode(ADD_VL, "AddVL", TYPE_LONG);
}
public static final String SATURATING_ADD_VB = VECTOR_PREFIX + "SATURATING_ADD_VB" + POSTFIX;
static {
vectorNode(SATURATING_ADD_VB, "SaturatingAddV", TYPE_BYTE);
}
public static final String SATURATING_ADD_VS = VECTOR_PREFIX + "SATURATING_ADD_VS" + POSTFIX;
static {
vectorNode(SATURATING_ADD_VS, "SaturatingAddV", TYPE_SHORT);
}
public static final String SATURATING_ADD_VI = VECTOR_PREFIX + "SATURATING_ADD_VI" + POSTFIX;
static {
vectorNode(SATURATING_ADD_VI, "SaturatingAddV", TYPE_INT);
}
public static final String SATURATING_ADD_VL = VECTOR_PREFIX + "SATURATING_ADD_VL" + POSTFIX;
static {
vectorNode(SATURATING_ADD_VL, "SaturatingAddV", TYPE_LONG);
}
public static final String SATURATING_SUB_VB = VECTOR_PREFIX + "SATURATING_SUB_VB" + POSTFIX;
static {
vectorNode(SATURATING_SUB_VB, "SaturatingSubV", TYPE_BYTE);
}
public static final String SATURATING_SUB_VS = VECTOR_PREFIX + "SATURATING_SUB_VS" + POSTFIX;
static {
vectorNode(SATURATING_SUB_VS, "SaturatingSubV", TYPE_SHORT);
}
public static final String SATURATING_SUB_VI = VECTOR_PREFIX + "SATURATING_SUB_VI" + POSTFIX;
static {
vectorNode(SATURATING_SUB_VI, "SaturatingSubV", TYPE_INT);
}
public static final String SATURATING_SUB_VL = VECTOR_PREFIX + "SATURATING_SUB_VL" + POSTFIX;
static {
vectorNode(SATURATING_SUB_VL, "SaturatingSubV", TYPE_LONG);
}
public static final String ADD_REDUCTION_V = PREFIX + "ADD_REDUCTION_V" + POSTFIX;
static {
beforeMatchingNameRegex(ADD_REDUCTION_V, "AddReductionV(B|S|I|L|F|D)");
}
public static final String ADD_REDUCTION_VD = PREFIX + "ADD_REDUCTION_VD" + POSTFIX;
static {
superWordNodes(ADD_REDUCTION_VD, "AddReductionVD");
}
public static final String ADD_REDUCTION_VF = PREFIX + "ADD_REDUCTION_VF" + POSTFIX;
static {
superWordNodes(ADD_REDUCTION_VF, "AddReductionVF");
}
public static final String ADD_REDUCTION_VI = PREFIX + "ADD_REDUCTION_VI" + POSTFIX;
static {
superWordNodes(ADD_REDUCTION_VI, "AddReductionVI");
}
public static final String ADD_REDUCTION_VL = PREFIX + "ADD_REDUCTION_VL" + POSTFIX;
static {
superWordNodes(ADD_REDUCTION_VL, "AddReductionVL");
}
public static final String OPAQUE_MULTIVERSIONING = PREFIX + "OPAQUE_MULTIVERSIONING" + POSTFIX;
static {
beforeMatchingNameRegex(OPAQUE_MULTIVERSIONING, "OpaqueMultiversioning");
}
public static final String ADD_P_OF = COMPOSITE_PREFIX + "ADD_P_OF" + POSTFIX;
static {
String regex = START + "addP_" + IS_REPLACED + MID + ".*" + END;
machOnly(ADD_P_OF, regex);
}
public static final String ALLOC = PREFIX + "ALLOC" + POSTFIX;
static {
String regex = START + "Allocate\\b" + MID + END;
macroNodes(ALLOC, regex);
}
public static final String ALLOC_OF = COMPOSITE_PREFIX + "ALLOC_OF" + POSTFIX;
static {
String regex = START + "Allocate\\b" + MID + "allocationKlass:.*\\b" + IS_REPLACED + "\\s.*" + END;
macroNodes(ALLOC_OF, regex);
}
public static final String ALLOC_ARRAY = PREFIX + "ALLOC_ARRAY" + POSTFIX;
static {
String regex = START + "AllocateArray\\b" + MID + END;
macroNodes(ALLOC_ARRAY, regex);
}
public static final String ALLOC_ARRAY_OF = COMPOSITE_PREFIX + "ALLOC_ARRAY_OF" + POSTFIX;
static {
// Assuming we are looking for an array of "some/package/MyClass". The printout is
// [Lsome/package/MyClass;
// or, with more dimensions
// [[[Lsome/package/MyClass;
// Case where the searched string is a not fully qualified name (but maybe partially qualified):
// package/MyClass or MyClass
// The ".*\\b" will eat the "some/" and "some/package/" resp.
String partial_name_prefix = ".+\\b";
// The thing after "allocationKlass:" (the name of the allocated class) is a sequence of:
// - a non-empty sequence of "["
// - a single character ("L"),
// - maybe a non-empty sequence of characters ending on a word boundary
// this sequence is omitted if the given name is already fully qualified (exact match)
// but will eat the package path prefix in the cases described above
// - the name we are looking for
// - the final ";".
String name_part = "\\[+.(" + partial_name_prefix + ")?" + IS_REPLACED + ";";
String regex = START + "AllocateArray\\b" + MID + "allocationKlass:" + name_part + ".*" + END;
macroNodes(ALLOC_ARRAY_OF, regex);
}
public static final String OR = PREFIX + "OR" + POSTFIX;
static {
beforeMatchingNameRegex(OR, "Or(I|L)");
}
public static final String AND = PREFIX + "AND" + POSTFIX;
static {
beforeMatchingNameRegex(AND, "And(I|L)");
}
public static final String AND_I = PREFIX + "AND_I" + POSTFIX;
static {
beforeMatchingNameRegex(AND_I, "AndI");
}
public static final String AND_L = PREFIX + "AND_L" + POSTFIX;
static {
beforeMatchingNameRegex(AND_L, "AndL");
}
public static final String AND_VB = VECTOR_PREFIX + "AND_VB" + POSTFIX;
static {
vectorNode(AND_VB, "AndV", TYPE_BYTE);
}
public static final String AND_VC = VECTOR_PREFIX + "AND_VC" + POSTFIX;
static {
vectorNode(AND_VC, "AndV", TYPE_CHAR);
}
public static final String AND_VS = VECTOR_PREFIX + "AND_VS" + POSTFIX;
static {
vectorNode(AND_VS, "AndV", TYPE_SHORT);
}
public static final String AND_VI = VECTOR_PREFIX + "AND_VI" + POSTFIX;
static {
vectorNode(AND_VI, "AndV", TYPE_INT);
}
public static final String AND_VL = VECTOR_PREFIX + "AND_VL" + POSTFIX;
static {
vectorNode(AND_VL, "AndV", TYPE_LONG);
}
public static final String AND_V_MASK = PREFIX + "AND_V_MASK" + POSTFIX;
static {
beforeMatchingNameRegex(AND_V_MASK, "AndVMask");
}
public static final String AND_REDUCTION_V = PREFIX + "AND_REDUCTION_V" + POSTFIX;
static {
superWordNodes(AND_REDUCTION_V, "AndReductionV");
}
public static final String CALL = PREFIX + "CALL" + POSTFIX;
static {
beforeMatchingNameRegex(CALL, "Call.*Java");
}
public static final String CALL_OF = COMPOSITE_PREFIX + "CALL_OF" + POSTFIX;
static {
callOfNodes(CALL_OF, "Call.*");
}
public static final String CALL_OF_METHOD = COMPOSITE_PREFIX + "CALL_OF_METHOD" + POSTFIX;
static {
callOfNodes(CALL_OF_METHOD, "Call.*Java");
}
public static final String STATIC_CALL_OF_METHOD = COMPOSITE_PREFIX + "STATIC_CALL_OF_METHOD" + POSTFIX;
static {
callOfNodes(STATIC_CALL_OF_METHOD, "CallStaticJava");
}
public static final String CAST_II = PREFIX + "CAST_II" + POSTFIX;
static {
beforeMatchingNameRegex(CAST_II, "CastII");
}
public static final String CAST_LL = PREFIX + "CAST_LL" + POSTFIX;
static {
beforeMatchingNameRegex(CAST_LL, "CastLL");
}
public static final String CBNZW_HI = PREFIX + "CBNZW_HI" + POSTFIX;
static {
optoOnly(CBNZW_HI, "cbwhi");
}
public static final String CBZW_LS = PREFIX + "CBZW_LS" + POSTFIX;
static {
optoOnly(CBZW_LS, "cbwls");
}
public static final String CBZ_LS = PREFIX + "CBZ_LS" + POSTFIX;
static {
optoOnly(CBZ_LS, "cbls");
}
public static final String CBZ_HI = PREFIX + "CBZ_HI" + POSTFIX;
static {
optoOnly(CBZ_HI, "cbhi");
}
public static final String CHECKCAST_ARRAY = PREFIX + "CHECKCAST_ARRAY" + POSTFIX;
static {
String regex = "(((?i:cmp|CLFI|CLR).*precise \\[.*:|.*(?i:mov|mv|or).*precise \\[.*:.*\\R.*(cmp|CMP|CLR))" + END;
optoOnly(CHECKCAST_ARRAY, regex);
}
public static final String CHECKCAST_ARRAY_OF = COMPOSITE_PREFIX + "CHECKCAST_ARRAY_OF" + POSTFIX;
static {
String regex = "(((?i:cmp|CLFI|CLR).*precise \\[.*" + IS_REPLACED + ":|.*(?i:mov|mv|or).*precise \\[.*" + IS_REPLACED + ":.*\\R.*(cmp|CMP|CLR))" + END;
optoOnly(CHECKCAST_ARRAY_OF, regex);
}
// Does not work on s390 (a rule containing this regex will be skipped on s390).
public static final String CHECKCAST_ARRAYCOPY = PREFIX + "CHECKCAST_ARRAYCOPY" + POSTFIX;
static {
String regex = "(.*((?i:call_leaf_nofp,runtime)|CALL,\\s?runtime leaf nofp|BCTRL.*.leaf call).*checkcast_arraycopy.*" + END;
optoOnly(CHECKCAST_ARRAYCOPY, regex);
}
public static final String CLASS_CHECK_TRAP = PREFIX + "CLASS_CHECK_TRAP" + POSTFIX;
static {
trapNodes(CLASS_CHECK_TRAP, "class_check");
}
public static final String CMOVE_I = PREFIX + "CMOVE_I" + POSTFIX;
static {
beforeMatchingNameRegex(CMOVE_I, "CMoveI");
}
public static final String CMP_I = PREFIX + "CMP_I" + POSTFIX;
static {
beforeMatchingNameRegex(CMP_I, "CmpI");
}
public static final String CMP_L = PREFIX + "CMP_L" + POSTFIX;
static {
beforeMatchingNameRegex(CMP_L, "CmpL");
}
public static final String CMP_U = PREFIX + "CMP_U" + POSTFIX;
static {
beforeMatchingNameRegex(CMP_U, "CmpU\\b");
}
public static final String CMP_U3 = PREFIX + "CMP_U3" + POSTFIX;
static {
beforeMatchingNameRegex(CMP_U3, "CmpU3");
}
public static final String CMP_UL = PREFIX + "CMP_UL" + POSTFIX;
static {
beforeMatchingNameRegex(CMP_UL, "CmpUL");
}
public static final String CMP_UL3 = PREFIX + "CMP_UL3" + POSTFIX;
static {
beforeMatchingNameRegex(CMP_UL3, "CmpUL3");
}
public static final String CMP_P = PREFIX + "CMP_P" + POSTFIX;
static {
beforeMatchingNameRegex(CMP_P, "CmpP");
}
public static final String COMPRESS_BITS = PREFIX + "COMPRESS_BITS" + POSTFIX;
static {
beforeMatchingNameRegex(COMPRESS_BITS, "CompressBits");
}
public static final String CONV = PREFIX + "CONV" + POSTFIX;
static {
beforeMatchingNameRegex(CONV, "Conv");
}
public static final String CONV_F2HF = PREFIX + "CONV_F2HF" + POSTFIX;
static {
beforeMatchingNameRegex(CONV_F2HF, "ConvF2HF");
}
public static final String CONV_I2L = PREFIX + "CONV_I2L" + POSTFIX;
static {
beforeMatchingNameRegex(CONV_I2L, "ConvI2L");
}
public static final String CONV_L2I = PREFIX + "CONV_L2I" + POSTFIX;
static {
beforeMatchingNameRegex(CONV_L2I, "ConvL2I");
}
public static final String CONV_HF2F = PREFIX + "CONV_HF2F" + POSTFIX;
static {
beforeMatchingNameRegex(CONV_HF2F, "ConvHF2F");
}
public static final String CON_I = PREFIX + "CON_I" + POSTFIX;
static {
beforeMatchingNameRegex(CON_I, "ConI");
}
public static final String CON_L = PREFIX + "CON_L" + POSTFIX;
static {
beforeMatchingNameRegex(CON_L, "ConL");
}
public static final String CON_D = PREFIX + "CON_D" + POSTFIX;
static {
beforeMatchingNameRegex(CON_D, "ConD");
}
public static final String CON_F = PREFIX + "CON_F" + POSTFIX;
static {
beforeMatchingNameRegex(CON_F, "ConF");
}
public static final String COUNTED_LOOP = PREFIX + "COUNTED_LOOP" + POSTFIX;
static {
String regex = START + "CountedLoop\\b" + MID + END;
fromAfterCountedLoops(COUNTED_LOOP, regex);
}
public static final String COUNTED_LOOP_MAIN = PREFIX + "COUNTED_LOOP_MAIN" + POSTFIX;
static {
String regex = START + "CountedLoop\\b" + MID + "main" + END;
fromAfterCountedLoops(COUNTED_LOOP_MAIN, regex);
}
public static final String DIV = PREFIX + "DIV" + POSTFIX;
static {
beforeMatchingNameRegex(DIV, "Div(I|L|F|D)");
}
public static final String UDIV = PREFIX + "UDIV" + POSTFIX;
static {
beforeMatchingNameRegex(UDIV, "UDiv(I|L|F|D)");
}
public static final String DIV_BY_ZERO_TRAP = PREFIX + "DIV_BY_ZERO_TRAP" + POSTFIX;
static {
trapNodes(DIV_BY_ZERO_TRAP, "div0_check");
}
public static final String DIV_I = PREFIX + "DIV_I" + POSTFIX;
static {
beforeMatchingNameRegex(DIV_I, "DivI");
}
public static final String DIV_L = PREFIX + "DIV_L" + POSTFIX;
static {
beforeMatchingNameRegex(DIV_L, "DivL");
}
public static final String DIV_MOD_I = PREFIX + "DIV_MOD_I" + POSTFIX;
static {
beforeMatchingNameRegex(DIV_MOD_I, "DivModI");
}
public static final String DIV_MOD_L = PREFIX + "DIV_MOD_L" + POSTFIX;
static {
beforeMatchingNameRegex(DIV_MOD_L, "DivModL");
}
public static final String DIV_VF = VECTOR_PREFIX + "DIV_VF" + POSTFIX;
static {
vectorNode(DIV_VF, "DivVF", TYPE_FLOAT);
}
public static final String DIV_VD = VECTOR_PREFIX + "DIV_VD" + POSTFIX;
static {
vectorNode(DIV_VD, "DivVD", TYPE_DOUBLE);
}
public static final String DYNAMIC_CALL_OF_METHOD = COMPOSITE_PREFIX + "DYNAMIC_CALL_OF_METHOD" + POSTFIX;
static {
callOfNodes(DYNAMIC_CALL_OF_METHOD, "CallDynamicJava");
}
public static final String EXPAND_BITS = PREFIX + "EXPAND_BITS" + POSTFIX;
static {
beforeMatchingNameRegex(EXPAND_BITS, "ExpandBits");
}
public static final String FAST_LOCK = PREFIX + "FAST_LOCK" + POSTFIX;
static {
beforeMatchingNameRegex(FAST_LOCK, "FastLock");
}
public static final String FAST_UNLOCK = PREFIX + "FAST_UNLOCK" + POSTFIX;
static {
String regex = START + "FastUnlock" + MID + END;
fromMacroToBeforeMatching(FAST_UNLOCK, regex);
}
public static final String FIELD_ACCESS = PREFIX + "FIELD_ACCESS" + POSTFIX;
static {
String regex = "(.*Field: *" + END;
optoOnly(FIELD_ACCESS, regex);
}
public static final String FMA_VF = VECTOR_PREFIX + "FMA_VF" + POSTFIX;
static {
vectorNode(FMA_VF, "FmaVF", TYPE_FLOAT);
}
public static final String FMA_VD = VECTOR_PREFIX + "FMA_VD" + POSTFIX;
static {
vectorNode(FMA_VD, "FmaVD", TYPE_DOUBLE);
}
public static final String FMA_HF = PREFIX + "FMA_HF" + POSTFIX;
static {
beforeMatchingNameRegex(FMA_HF, "FmaHF");
}
public static final String G1_COMPARE_AND_EXCHANGE_N_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "G1_COMPARE_AND_EXCHANGE_N_WITH_BARRIER_FLAG" + POSTFIX;
static {
String regex = START + "g1CompareAndExchangeN\\S*" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END;
machOnly(G1_COMPARE_AND_EXCHANGE_N_WITH_BARRIER_FLAG, regex);
}
public static final String G1_COMPARE_AND_EXCHANGE_P_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "G1_COMPARE_AND_EXCHANGE_P_WITH_BARRIER_FLAG" + POSTFIX;
static {
String regex = START + "g1CompareAndExchangeP\\S*" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END;
machOnly(G1_COMPARE_AND_EXCHANGE_P_WITH_BARRIER_FLAG, regex);
}
public static final String G1_COMPARE_AND_SWAP_N_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "G1_COMPARE_AND_SWAP_N_WITH_BARRIER_FLAG" + POSTFIX;
static {
String regex = START + "g1CompareAndSwapN\\S*" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END;
machOnly(G1_COMPARE_AND_SWAP_N_WITH_BARRIER_FLAG, regex);
}
public static final String G1_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "G1_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG" + POSTFIX;
static {
String regex = START + "g1CompareAndSwapP\\S*" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END;
machOnly(G1_COMPARE_AND_SWAP_P_WITH_BARRIER_FLAG, regex);
}
public static final String G1_ENCODE_P_AND_STORE_N = PREFIX + "G1_ENCODE_P_AND_STORE_N" + POSTFIX;
static {
machOnlyNameRegex(G1_ENCODE_P_AND_STORE_N, "g1EncodePAndStoreN");
}
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;
static {
String regex = START + "g1EncodePAndStoreN\\S*" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END;
machOnly(G1_ENCODE_P_AND_STORE_N_WITH_BARRIER_FLAG, regex);
}
public static final String G1_GET_AND_SET_N_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "G1_GET_AND_SET_N_WITH_BARRIER_FLAG" + POSTFIX;
static {
String regex = START + "g1GetAndSetN\\S*" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END;
machOnly(G1_GET_AND_SET_N_WITH_BARRIER_FLAG, regex);
}
public static final String G1_GET_AND_SET_P_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "G1_GET_AND_SET_P_WITH_BARRIER_FLAG" + POSTFIX;
static {
String regex = START + "g1GetAndSetP\\S*" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END;
machOnly(G1_GET_AND_SET_P_WITH_BARRIER_FLAG, regex);
}
public static final String G1_LOAD_N = PREFIX + "G1_LOAD_N" + POSTFIX;
static {
machOnlyNameRegex(G1_LOAD_N, "g1LoadN");
}
public static final String G1_LOAD_N_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "G1_LOAD_N_WITH_BARRIER_FLAG" + POSTFIX;
static {
String regex = START + "g1LoadN\\S*" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END;
machOnly(G1_LOAD_N_WITH_BARRIER_FLAG, regex);
}
public static final String G1_LOAD_P_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "G1_LOAD_P_WITH_BARRIER_FLAG" + POSTFIX;
static {
String regex = START + "g1LoadP\\S*" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END;
machOnly(G1_LOAD_P_WITH_BARRIER_FLAG, regex);
}
public static final String G1_STORE_N = PREFIX + "G1_STORE_N" + POSTFIX;
static {
machOnlyNameRegex(G1_STORE_N, "g1StoreN");
}
public static final String G1_STORE_N_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "G1_STORE_N_WITH_BARRIER_FLAG" + POSTFIX;
static {
String regex = START + "g1StoreN\\S*" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END;
machOnly(G1_STORE_N_WITH_BARRIER_FLAG, regex);
}
public static final String G1_STORE_P = PREFIX + "G1_STORE_P" + POSTFIX;
static {
machOnlyNameRegex(G1_STORE_P, "g1StoreP");
}
public static final String G1_STORE_P_WITH_BARRIER_FLAG = COMPOSITE_PREFIX + "G1_STORE_P_WITH_BARRIER_FLAG" + POSTFIX;
static {
String regex = START + "g1StoreP\\S*" + MID + "barrier\\(\\s*" + IS_REPLACED + "\\s*\\)" + END;
machOnly(G1_STORE_P_WITH_BARRIER_FLAG, regex);
}
public static final String IF = PREFIX + "IF" + POSTFIX;
static {
beforeMatchingNameRegex(IF, "If\\b");
}
// Does not work for VM builds without JVMCI like x86_32 (a rule containing this regex will be skipped without having JVMCI built).
public static final String INTRINSIC_OR_TYPE_CHECKED_INLINING_TRAP = PREFIX + "INTRINSIC_OR_TYPE_CHECKED_INLINING_TRAP" + POSTFIX;
static {
trapNodes(INTRINSIC_OR_TYPE_CHECKED_INLINING_TRAP, "intrinsic_or_type_checked_inlining");
}
public static final String INTRINSIC_TRAP = PREFIX + "INTRINSIC_TRAP" + POSTFIX;
static {
trapNodes(INTRINSIC_TRAP, "intrinsic");
}
// Is only supported on riscv64.
public static final String IS_FINITE_D = PREFIX + "IS_FINITE_D" + POSTFIX;
static {
beforeMatchingNameRegex(IS_FINITE_D, "IsFiniteD");
}
// Is only supported on riscv64.
public static final String IS_FINITE_F = PREFIX + "IS_FINITE_F" + POSTFIX;
static {
beforeMatchingNameRegex(IS_FINITE_F, "IsFiniteF");
}
public static final String IS_INFINITE_D = PREFIX + "IS_INFINITE_D" + POSTFIX;
static {
beforeMatchingNameRegex(IS_INFINITE_D, "IsInfiniteD");
}
public static final String IS_INFINITE_F = PREFIX + "IS_INFINITE_F" + POSTFIX;
static {
beforeMatchingNameRegex(IS_INFINITE_F, "IsInfiniteF");
}
public static final String LOAD = PREFIX + "LOAD" + POSTFIX;
static {
beforeMatchingNameRegex(LOAD, "Load(B|UB|S|US|I|L|F|D|P|N)");
}
public static final String LOAD_OF_CLASS = COMPOSITE_PREFIX + "LOAD_OF_CLASS" + POSTFIX;
static {
loadOfNodes(LOAD_OF_CLASS, "Load(B|UB|S|US|I|L|F|D|P|N)");
}
public static final String LOAD_B = PREFIX + "LOAD_B" + POSTFIX;
static {
beforeMatchingNameRegex(LOAD_B, "LoadB");
}
public static final String LOAD_B_OF_CLASS = COMPOSITE_PREFIX + "LOAD_B_OF_CLASS" + POSTFIX;
static {
loadOfNodes(LOAD_B_OF_CLASS, "LoadB");
}
public static final String LOAD_D = PREFIX + "LOAD_D" + POSTFIX;
static {
beforeMatchingNameRegex(LOAD_D, "LoadD");
}
public static final String LOAD_D_OF_CLASS = COMPOSITE_PREFIX + "LOAD_D_OF_CLASS" + POSTFIX;
static {
loadOfNodes(LOAD_D_OF_CLASS, "LoadD");
}
public static final String LOAD_F = PREFIX + "LOAD_F" + POSTFIX;
static {
beforeMatchingNameRegex(LOAD_F, "LoadF");
}
public static final String LOAD_F_OF_CLASS = COMPOSITE_PREFIX + "LOAD_F_OF_CLASS" + POSTFIX;
static {
loadOfNodes(LOAD_F_OF_CLASS, "LoadF");
}
public static final String LOAD_I = PREFIX + "LOAD_I" + POSTFIX;
static {
beforeMatchingNameRegex(LOAD_I, "LoadI");
}
public static final String LOAD_I_OF_CLASS = COMPOSITE_PREFIX + "LOAD_I_OF_CLASS" + POSTFIX;
static {
loadOfNodes(LOAD_I_OF_CLASS, "LoadI");
}
public static final String LOAD_KLASS = PREFIX + "LOAD_KLASS" + POSTFIX;
static {
beforeMatchingNameRegex(LOAD_KLASS, "LoadKlass");
}
public static final String LOAD_NKLASS = PREFIX + "LOAD_NKLASS" + POSTFIX;
static {
beforeMatchingNameRegex(LOAD_NKLASS, "LoadNKlass");
}
public static final String LOAD_KLASS_OR_NKLASS = PREFIX + "LOAD_KLASS_OR_NKLASS" + POSTFIX;
static {
beforeMatchingNameRegex(LOAD_KLASS_OR_NKLASS, "LoadN?Klass");
}
public static final String LOAD_L = PREFIX + "LOAD_L" + POSTFIX;
static {
beforeMatchingNameRegex(LOAD_L, "LoadL");
}
public static final String LOAD_L_OF_CLASS = COMPOSITE_PREFIX + "LOAD_L_OF_CLASS" + POSTFIX;
static {
loadOfNodes(LOAD_L_OF_CLASS, "LoadL");
}
public static final String LOAD_N = PREFIX + "LOAD_N" + POSTFIX;
static {
beforeMatchingNameRegex(LOAD_N, "LoadN");
}
public static final String LOAD_N_OF_CLASS = COMPOSITE_PREFIX + "LOAD_N_OF_CLASS" + POSTFIX;
static {
loadOfNodes(LOAD_N_OF_CLASS, "LoadN");
}
public static final String LOAD_OF_FIELD = COMPOSITE_PREFIX + "LOAD_OF_FIELD" + POSTFIX;
static {
String regex = START + "Load(B|C|S|I|L|F|D|P|N)" + MID + "@.*name=" + IS_REPLACED + ",.*" + END;
beforeMatching(LOAD_OF_FIELD, regex);
}
public static final String LOAD_P = PREFIX + "LOAD_P" + POSTFIX;
static {
beforeMatchingNameRegex(LOAD_P, "LoadP");
}
public static final String LOAD_P_OF_CLASS = COMPOSITE_PREFIX + "LOAD_P_OF_CLASS" + POSTFIX;
static {
loadOfNodes(LOAD_P_OF_CLASS, "LoadP");
}
public static final String LOAD_S = PREFIX + "LOAD_S" + POSTFIX;
static {
beforeMatchingNameRegex(LOAD_S, "LoadS");
}
public static final String LOAD_S_OF_CLASS = COMPOSITE_PREFIX + "LOAD_S_OF_CLASS" + POSTFIX;
static {
loadOfNodes(LOAD_S_OF_CLASS, "LoadS");
}
public static final String LOAD_UB = PREFIX + "LOAD_UB" + POSTFIX;
static {
beforeMatchingNameRegex(LOAD_UB, "LoadUB");
}
public static final String LOAD_UB_OF_CLASS = COMPOSITE_PREFIX + "LOAD_UB_OF_CLASS" + POSTFIX;
static {
loadOfNodes(LOAD_UB_OF_CLASS, "LoadUB");
}
public static final String LOAD_US = PREFIX + "LOAD_US" + POSTFIX;
static {
beforeMatchingNameRegex(LOAD_US, "LoadUS");
}
public static final String LOAD_US_OF_CLASS = COMPOSITE_PREFIX + "LOAD_US_OF_CLASS" + POSTFIX;
static {
loadOfNodes(LOAD_US_OF_CLASS, "LoadUS");
}
public static final String LOAD_VECTOR_B = VECTOR_PREFIX + "LOAD_VECTOR_B" + POSTFIX;
static {
vectorNode(LOAD_VECTOR_B, "LoadVector", TYPE_BYTE);
}
public static final String LOAD_VECTOR_C = VECTOR_PREFIX + "LOAD_VECTOR_C" + POSTFIX;
static {
vectorNode(LOAD_VECTOR_C, "LoadVector", TYPE_CHAR);
}
public static final String LOAD_VECTOR_S = VECTOR_PREFIX + "LOAD_VECTOR_S" + POSTFIX;
static {
vectorNode(LOAD_VECTOR_S, "LoadVector", TYPE_SHORT);
}
public static final String LOAD_VECTOR_I = VECTOR_PREFIX + "LOAD_VECTOR_I" + POSTFIX;
static {
vectorNode(LOAD_VECTOR_I, "LoadVector", TYPE_INT);
}
public static final String LOAD_VECTOR_L = VECTOR_PREFIX + "LOAD_VECTOR_L" + POSTFIX;
static {
vectorNode(LOAD_VECTOR_L, "LoadVector", TYPE_LONG);
}
public static final String LOAD_VECTOR_F = VECTOR_PREFIX + "LOAD_VECTOR_F" + POSTFIX;
static {
vectorNode(LOAD_VECTOR_F, "LoadVector", TYPE_FLOAT);
}
public static final String LOAD_VECTOR_D = VECTOR_PREFIX + "LOAD_VECTOR_D" + POSTFIX;
static {
vectorNode(LOAD_VECTOR_D, "LoadVector", TYPE_DOUBLE);
}
public static final String LOAD_VECTOR_GATHER = PREFIX + "LOAD_VECTOR_GATHER" + POSTFIX;
static {
beforeMatchingNameRegex(LOAD_VECTOR_GATHER, "LoadVectorGather");
}
public static final String LOAD_VECTOR_MASKED = PREFIX + "LOAD_VECTOR_MASKED" + POSTFIX;
static {