]>
Commit | Line | Data |
---|---|---|
85ec4feb | 1 | # Copyright (C) 2000-2018 Free Software Foundation, Inc. |
9cb5fdd0 JC |
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 |
9cb5fdd0 JC |
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/>. | |
9cb5fdd0 JC |
16 | |
17 | # Various utilities for scanning ipa 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 ipa pass | |
27 | # Argument 2 handles expected failures and the like | |
28 | proc scan-ipa-dump { args } { | |
29 | ||
30 | if { [llength $args] < 2 } { | |
31 | error "scan-ipa-dump: too few arguments" | |
32 | return | |
33 | } | |
34 | if { [llength $args] > 3 } { | |
35 | error "scan-ipa-dump: too many arguments" | |
36 | return | |
37 | } | |
38 | if { [llength $args] >= 3 } { | |
6c3c13c1 TV |
39 | scan-dump "ipa" [lindex $args 0] \ |
40 | "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" "" [lindex $args 2] | |
9cb5fdd0 | 41 | } else { |
6c3c13c1 TV |
42 | scan-dump "ipa" [lindex $args 0] \ |
43 | "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" "" | |
9cb5fdd0 JC |
44 | } |
45 | } | |
46 | ||
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 ipa pass | |
51 | # Argument 3 handles expected failures and the like | |
52 | proc scan-ipa-dump-times { args } { | |
53 | ||
54 | if { [llength $args] < 3 } { | |
55 | error "scan-ipa-dump: too few arguments" | |
56 | return | |
57 | } | |
58 | if { [llength $args] > 4 } { | |
59 | error "scan-ipa-dump: too many arguments" | |
60 | return | |
61 | } | |
62 | if { [llength $args] >= 4 } { | |
63 | scan-dump-times "ipa" [lindex $args 0] [lindex $args 1] \ | |
6c3c13c1 TV |
64 | "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 2]" "" \ |
65 | [lindex $args 3] | |
9cb5fdd0 JC |
66 | } else { |
67 | scan-dump-times "ipa" [lindex $args 0] [lindex $args 1] \ | |
6c3c13c1 | 68 | "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 2]" "" |
9cb5fdd0 JC |
69 | } |
70 | } | |
71 | ||
72 | # Call pass if pattern is not present, otherwise fail. | |
73 | # | |
74 | # Argument 0 is the regexp to match | |
75 | # Argument 1 is the name of the dumped ipa pass | |
76 | # Argument 2 handles expected failures and the like | |
77 | proc scan-ipa-dump-not { args } { | |
78 | ||
79 | if { [llength $args] < 2 } { | |
80 | error "scan-ipa-dump-not: too few arguments" | |
81 | return | |
82 | } | |
83 | if { [llength $args] > 3 } { | |
84 | error "scan-ipa-dump-not: too many arguments" | |
85 | return | |
86 | } | |
87 | if { [llength $args] >= 3 } { | |
88 | scan-dump-not "ipa" [lindex $args 0] \ | |
6c3c13c1 TV |
89 | "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" "" \ |
90 | [lindex $args 2] | |
9cb5fdd0 JC |
91 | } else { |
92 | scan-dump-not "ipa" [lindex $args 0] \ | |
6c3c13c1 | 93 | "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" "" |
9cb5fdd0 JC |
94 | } |
95 | } | |
96 | ||
97 | # Utility for scanning demangled compiler result, invoked via dg-final. | |
98 | # Call pass if pattern is present, otherwise fail. | |
99 | # | |
100 | # Argument 0 is the regexp to match | |
101 | # Argument 1 is the name of the dumped ipa pass | |
102 | # Argument 2 handles expected failures and the like | |
103 | proc scan-ipa-dump-dem { args } { | |
104 | ||
105 | if { [llength $args] < 2 } { | |
106 | error "scan-ipa-dump-dem: too few arguments" | |
107 | return | |
108 | } | |
109 | if { [llength $args] > 3 } { | |
110 | error "scan-ipa-dump-dem: too many arguments" | |
111 | return | |
112 | } | |
113 | if { [llength $args] >= 3 } { | |
114 | scan-dump-dem "ipa" [lindex $args 0] \ | |
6c3c13c1 TV |
115 | "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" "" \ |
116 | [lindex $args 2] | |
9cb5fdd0 JC |
117 | } else { |
118 | scan-dump-dem "ipa" [lindex $args 0] \ | |
6c3c13c1 | 119 | "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" "" |
9cb5fdd0 JC |
120 | } |
121 | } | |
122 | ||
123 | # Call pass if demangled pattern is not present, otherwise fail. | |
124 | # | |
125 | # Argument 0 is the regexp to match | |
126 | # Argument 1 is the name of the dumped ipa pass | |
127 | # Argument 2 handles expected failures and the like | |
128 | proc scan-ipa-dump-dem-not { args } { | |
129 | ||
130 | if { [llength $args] < 2 } { | |
131 | error "scan-ipa-dump-dem-not: too few arguments" | |
132 | return | |
133 | } | |
134 | if { [llength $args] > 3 } { | |
135 | error "scan-ipa-dump-dem-not: too many arguments" | |
136 | return | |
137 | } | |
138 | if { [llength $args] >= 3 } { | |
139 | scan-dump-dem-not "ipa" [lindex $args 0] \ | |
6c3c13c1 | 140 | "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" "" \ |
9cb5fdd0 JC |
141 | [lindex $args 2] |
142 | } else { | |
143 | scan-dump-dem-not "ipa" [lindex $args 0] \ | |
6c3c13c1 | 144 | "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" "" |
9cb5fdd0 JC |
145 | } |
146 | } |