1 # Copyright (C) 2018-2024 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with GCC; see the file COPYING3. If not see
15 # <http://www.gnu.org/licenses/>.
17 # Various utilities for scanning ipa dump output, used by gcc-dg.exp and
22 # Utility for scanning compiler result, invoked via dg-final.
23 # Call pass if pattern is present, otherwise fail.
25 # Argument 0 is the regexp to match
26 # Argument 1 is the name of the dumped ipa pass
27 # Argument 2 handles expected failures and the like
28 proc scan-wpa-ipa-dump { args } {
30 if { [llength $args] < 2 } {
31 error "scan-wpa-ipa-dump: too few arguments"
34 if { [llength $args] > 3 } {
35 error "scan-wpa-ipa-dump: too many arguments"
38 if { [llength $args] >= 3 } {
39 scan-dump "wpa-ipa" [lindex $args 0] \
40 "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".wpa" \
43 scan-dump "wpa-ipa" [lindex $args 0] \
44 "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".wpa"
48 # Argument 0 is the regexp to match
49 # Argument 1 is the name of the dumped ipa pass
50 # Argument 2 handles expected failures and the like
51 proc scan-pgo-wpa-ipa-dump { args } {
53 if { [llength $args] < 2 } {
54 error "scan-pgo-wpa-ipa-dump: too few arguments"
57 if { [llength $args] > 3 } {
58 error "scan-pgo-wpa-ipa-dump: too many arguments"
61 if { [llength $args] >= 3 } {
62 scan-dump "pgo-wpa-ipa" [lindex $args 0] \
63 "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".wpa" \
66 scan-dump "pgo-wpa-ipa" [lindex $args 0] \
67 "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".wpa"
71 # Call pass if pattern is present given number of times, otherwise fail.
72 # Argument 0 is the regexp to match
73 # Argument 1 is number of times the regexp must be found
74 # Argument 2 is the name of the dumped ipa pass
75 # Argument 3 handles expected failures and the like
76 proc scan-wpa-ipa-dump-times { args } {
78 if { [llength $args] < 3 } {
79 error "scan-wpa-ipa-dump-times: too few arguments"
82 if { [llength $args] > 4 } {
83 error "scan-wpa-ipa-dump-times: too many arguments"
86 if { [llength $args] >= 4 } {
87 scan-dump-times "wpa-ipa" [lindex $args 0] [lindex $args 1] \
88 "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 2]" ".wpa" \
91 scan-dump-times "wpa-ipa" [lindex $args 0] [lindex $args 1] \
92 "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 2]" ".wpa"
96 # Call pass if pattern is not present, otherwise fail.
98 # Argument 0 is the regexp to match
99 # Argument 1 is the name of the dumped ipa pass
100 # Argument 2 handles expected failures and the like
101 proc scan-wpa-ipa-dump-not { args } {
103 if { [llength $args] < 2 } {
104 error "scan-wpa-ipa-dump-not: too few arguments"
107 if { [llength $args] > 3 } {
108 error "scan-wpa-ipa-dump-not: too many arguments"
111 if { [llength $args] >= 3 } {
112 scan-dump-not "wpa-ipa" [lindex $args 0] \
113 "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".wpa" \
116 scan-dump-not "wpa-ipa" [lindex $args 0] \
117 "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".wpa"
121 # Utility for scanning demangled compiler result, invoked via dg-final.
122 # Call pass if pattern is present, otherwise fail.
124 # Argument 0 is the regexp to match
125 # Argument 1 is the name of the dumped ipa pass
126 # Argument 2 handles expected failures and the like
127 proc scan-wpa-ipa-dump-dem { args } {
129 if { [llength $args] < 2 } {
130 error "scan-wpa-ipa-dump-dem: too few arguments"
133 if { [llength $args] > 3 } {
134 error "scan-wpa-ipa-dump-dem: too many arguments"
137 if { [llength $args] >= 3 } {
138 scan-dump-dem "wpa-ipa" [lindex $args 0] \
139 "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".wpa" \
142 scan-dump-dem "wpa-ipa" [lindex $args 0] \
143 "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".wpa"
147 # Call pass if demangled pattern is not present, otherwise fail.
149 # Argument 0 is the regexp to match
150 # Argument 1 is the name of the dumped ipa pass
151 # Argument 2 handles expected failures and the like
152 proc scan-wpa-ipa-dump-dem-not { args } {
154 if { [llength $args] < 2 } {
155 error "scan-wpa-ipa-dump-dem-not: too few arguments"
158 if { [llength $args] > 3 } {
159 error "scan-wpa-ipa-dump-dem-not: too many arguments"
162 if { [llength $args] >= 3 } {
163 scan-dump-dem-not "wpa-ipa" [lindex $args 0] \
164 "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".wpa" \
167 scan-dump-dem-not "wpa-ipa" [lindex $args 0] \
168 "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" ".wpa"