]>
Commit | Line | Data |
---|---|---|
83ffe9cd | 1 | # Copyright (C) 2000-2023 Free Software Foundation, Inc. |
9220b511 TV |
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 | |
5 | # the Free Software Foundation; either version 3 of the License, or | |
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 | |
14 | # along with GCC; see the file COPYING3. If not see | |
15 | # <http://www.gnu.org/licenses/>. | |
16 | ||
17 | # Various utilities for scanning ltrans tree dump output, used by gcc-dg.exp and | |
18 | # g++-dg.exp. | |
19 | ||
20 | load_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 tree pass | |
27 | # Argument 2 handles expected failures and the like | |
28 | proc scan-ltrans-tree-dump { args } { | |
29 | ||
30 | if { [llength $args] < 2 } { | |
31 | error "scan-ltrans-tree-dump: too few arguments" | |
32 | return | |
33 | } | |
34 | if { [llength $args] > 3 } { | |
35 | error "scan-ltrans-tree-dump: too many arguments" | |
36 | return | |
37 | } | |
38 | if { [llength $args] >= 3 } { | |
39 | scan-dump "ltrans-tree" [lindex $args 0] \ | |
1dedc12d | 40 | "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ".ltrans0.ltrans" \ |
9220b511 TV |
41 | [lindex $args 2] |
42 | } else { | |
43 | scan-dump "ltrans-tree" [lindex $args 0] \ | |
1dedc12d | 44 | "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ".ltrans0.ltrans" |
9220b511 TV |
45 | } |
46 | } | |
47 | ||
48 | # Call pass if pattern is present given number of times, otherwise fail. | |
49 | # Argument 0 is the regexp to match | |
50 | # Argument 1 is number of times the regexp must be found | |
51 | # Argument 2 is the name of the dumped tree pass | |
52 | # Argument 3 handles expected failures and the like | |
53 | proc scan-ltrans-tree-dump-times { args } { | |
54 | ||
55 | if { [llength $args] < 3 } { | |
56 | error "scan-ltrans-tree-dump-times: too few arguments" | |
57 | return | |
58 | } | |
59 | if { [llength $args] > 4 } { | |
60 | error "scan-ltrans-tree-dump-times: too many arguments" | |
61 | return | |
62 | } | |
63 | if { [llength $args] >= 4 } { | |
64 | scan-dump-times "ltrans-tree" [lindex $args 0] [lindex $args 1] \ | |
65 | "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 2]" \ | |
1dedc12d | 66 | ".ltrans0.ltrans" [lindex $args 3] |
9220b511 TV |
67 | } else { |
68 | scan-dump-times "ltrans-tree" [lindex $args 0] [lindex $args 1] \ | |
1dedc12d | 69 | "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 2]" ".ltrans0.ltrans" |
9220b511 TV |
70 | } |
71 | } | |
72 | ||
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 tree pass | |
77 | # Argument 2 handles expected failures and the like | |
78 | proc scan-ltrans-tree-dump-not { args } { | |
79 | ||
80 | if { [llength $args] < 2 } { | |
81 | error "scan-ltrans-tree-dump-not: too few arguments" | |
82 | return | |
83 | } | |
84 | if { [llength $args] > 3 } { | |
85 | error "scan-ltrans-tree-dump-not: too many arguments" | |
86 | return | |
87 | } | |
88 | if { [llength $args] >= 3 } { | |
89 | scan-dump-not "ltrans-tree" [lindex $args 0] \ | |
1dedc12d | 90 | "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ".ltrans0.ltrans" \ |
9220b511 TV |
91 | [lindex $args 2] |
92 | } else { | |
93 | scan-dump-not "ltrans-tree" [lindex $args 0] \ | |
1dedc12d | 94 | "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ".ltrans0.ltrans" |
9220b511 TV |
95 | } |
96 | } | |
97 | ||
98 | # Utility for scanning demangled compiler result, invoked via dg-final. | |
99 | # Call pass if pattern is present, otherwise fail. | |
100 | # | |
101 | # Argument 0 is the regexp to match | |
102 | # Argument 1 is the name of the dumped tree pass | |
103 | # Argument 2 handles expected failures and the like | |
104 | proc scan-ltrans-tree-dump-dem { args } { | |
105 | ||
106 | if { [llength $args] < 2 } { | |
107 | error "scan-ltrans-tree-dump-dem: too few arguments" | |
108 | return | |
109 | } | |
110 | if { [llength $args] > 3 } { | |
111 | error "scan-ltrans-tree-dump-dem: too many arguments" | |
112 | return | |
113 | } | |
114 | if { [llength $args] >= 3 } { | |
115 | scan-dump-dem "ltrans-tree" [lindex $args 0] \ | |
1dedc12d | 116 | "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ".ltrans0.ltrans" \ |
9220b511 TV |
117 | [lindex $args 2] |
118 | } else { | |
119 | scan-dump-dem "ltrans-tree" [lindex $args 0] \ | |
1dedc12d | 120 | "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" ".ltrans0.ltrans" |
9220b511 TV |
121 | } |
122 | } | |
123 | ||
124 | # Call pass if demangled pattern is not present, otherwise fail. | |
125 | # | |
126 | # Argument 0 is the regexp to match | |
127 | # Argument 1 is the name of the dumped tree pass | |
128 | # Argument 2 handles expected failures and the like | |
129 | proc scan-ltrans-tree-dump-dem-not { args } { | |
130 | ||
131 | if { [llength $args] < 2 } { | |
132 | error "scan-ltrans-tree-dump-dem-not: too few arguments" | |
133 | return | |
134 | } | |
135 | if { [llength $args] > 3 } { | |
136 | error "scan-ltrans-tree-dump-dem-not: too many arguments" | |
137 | return | |
138 | } | |
139 | if { [llength $args] >= 3 } { | |
140 | scan-dump-dem-not "ltrans-tree" [lindex $args 0] \ | |
141 | "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" \ | |
1dedc12d | 142 | ".ltrans0.ltrans" [lindex $args 2] |
9220b511 TV |
143 | } else { |
144 | scan-dump-dem-not "ltrans-tree" [lindex $args 0] \ | |
145 | "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" \ | |
1dedc12d | 146 | ".ltrans0.ltrans" |
9220b511 TV |
147 | } |
148 | } |