]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/lib/scanrtl.exp
Update copyright years.
[thirdparty/gcc.git] / gcc / testsuite / lib / scanrtl.exp
CommitLineData
85ec4feb 1# Copyright (C) 2006-2018 Free Software Foundation, Inc.
0444390f
PB
2
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
cd976c16 5# the Free Software Foundation; either version 3 of the License, or
0444390f
PB
6# (at your option) any later version.
7#
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.
12#
13# You should have received a copy of the GNU General Public License
cd976c16
NC
14# along with GCC; see the file COPYING3. If not see
15# <http://www.gnu.org/licenses/>.
0444390f
PB
16
17# Various utilities for scanning rtl dump output, used by gcc-dg.exp and
18# g++-dg.exp.
19
20load_lib scandump.exp
21
22# Utility for scanning compiler result, invoked via dg-final.
23# Call pass if pattern is present, otherwise fail.
24#
25# Argument 0 is the regexp to match
26# Argument 1 is the name of the dumped rtl pass
27# Argument 2 handles expected failures and the like
28proc scan-rtl-dump { args } {
29
30 if { [llength $args] < 2 } {
31 error "scan-rtl-dump: too few arguments"
32 return
33 }
34 if { [llength $args] > 3 } {
35 error "scan-rtl-dump: too many arguments"
36 return
37 }
38 if { [llength $args] >= 3 } {
39 scan-dump "rtl" [lindex $args 0] "\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 1]" [lindex $args 2]
40 } else {
41 scan-dump "rtl" [lindex $args 0] "\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 1]"
42 }
43}
44
6d1a1d9d
RS
45force_conventional_output_for scan-rtl-dump
46
0444390f
PB
47# Call pass if pattern is present given number of times, otherwise fail.
48# Argument 0 is the regexp to match
49# Argument 1 is number of times the regexp must be found
50# Argument 2 is the name of the dumped rtl pass
51# Argument 3 handles expected failures and the like
52proc scan-rtl-dump-times { args } {
53
54 if { [llength $args] < 3 } {
55 error "scan-rtl-dump: too few arguments"
56 return
57 }
58 if { [llength $args] > 4 } {
59 error "scan-rtl-dump: too many arguments"
60 return
61 }
62 if { [llength $args] >= 4 } {
63 scan-dump-times "rtl" [lindex $args 0] [lindex $args 1] \
64 "\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 2]" [lindex $args 3]
65 } else {
66 scan-dump-times "rtl" [lindex $args 0] [lindex $args 1] \
67 "\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 2]"
68 }
69}
70
6d1a1d9d
RS
71force_conventional_output_for scan-rtl-dump-times
72
0444390f
PB
73# Call pass if pattern is not present, otherwise fail.
74#
75# Argument 0 is the regexp to match
76# Argument 1 is the name of the dumped rtl pass
77# Argument 2 handles expected failures and the like
78proc scan-rtl-dump-not { args } {
79
80 if { [llength $args] < 2 } {
81 error "scan-rtl-dump-not: too few arguments"
82 return
83 }
84 if { [llength $args] > 3 } {
85 error "scan-rtl-dump-not: too many arguments"
86 return
87 }
88 if { [llength $args] >= 3 } {
89 scan-dump-not "rtl" [lindex $args 0] \
90 "\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 1]" [lindex $args 2]
91 } else {
92 scan-dump-not "rtl" [lindex $args 0] \
93 "\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 1]"
94 }
95}
96
6d1a1d9d
RS
97force_conventional_output_for scan-rtl-dump-not
98
0444390f
PB
99# Utility for scanning demangled compiler result, invoked via dg-final.
100# Call pass if pattern is present, otherwise fail.
101#
102# Argument 0 is the regexp to match
103# Argument 1 is the name of the dumped rtl pass
104# Argument 2 handles expected failures and the like
105proc scan-rtl-dump-dem { args } {
106
107 if { [llength $args] < 2 } {
108 error "scan-rtl-dump-dem: too few arguments"
109 return
110 }
111 if { [llength $args] > 3 } {
112 error "scan-rtl-dump-dem: too many arguments"
113 return
114 }
115 if { [llength $args] >= 3 } {
116 scan-dump-dem "rtl" [lindex $args 0] \
117 "\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 1]" [lindex $args 2]
118 } else {
119 scan-dump-dem "rtl" [lindex $args 0] \
120 "\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 1]"
121 }
122}
123
6d1a1d9d
RS
124force_conventional_output_for scan-rtl-dump-dem
125
0444390f
PB
126# Call pass if demangled pattern is not present, otherwise fail.
127#
128# Argument 0 is the regexp to match
129# Argument 1 is the name of the dumped rtl pass
130# Argument 2 handles expected failures and the like
131proc scan-rtl-dump-dem-not { args } {
132
133 if { [llength $args] < 2 } {
134 error "scan-rtl-dump-dem-not: too few arguments"
135 return
136 }
137 if { [llength $args] > 3 } {
138 error "scan-rtl-dump-dem-not: too many arguments"
139 return
140 }
141 if { [llength $args] >= 3 } {
142 scan-dump-dem-not "rtl" [lindex $args 0] \
143 "\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 1]" \
144 [lindex $args 2]
145 } else {
146 scan-dump-dem-not "rtl" [lindex $args 0] \
147 "\[0-9\]\[0-9\]\[0-9\]r.[lindex $args 1]"
148 }
149}
6d1a1d9d
RS
150
151force_conventional_output_for scan-rtl-dump-dem-not