1 |
149 |
jeremybenn |
# Copyright (C) 2000, 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
|
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 |
|
|
# .
|
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 } {
|
39 |
|
|
scan-dump "ipa" [lindex $args 0] "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" [lindex $args 2]
|
40 |
|
|
} else {
|
41 |
|
|
scan-dump "ipa" [lindex $args 0] "\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]"
|
42 |
|
|
}
|
43 |
|
|
}
|
44 |
|
|
|
45 |
|
|
# Call pass if pattern is present given number of times, otherwise fail.
|
46 |
|
|
# Argument 0 is the regexp to match
|
47 |
|
|
# Argument 1 is number of times the regexp must be found
|
48 |
|
|
# Argument 2 is the name of the dumped ipa pass
|
49 |
|
|
# Argument 3 handles expected failures and the like
|
50 |
|
|
proc scan-ipa-dump-times { args } {
|
51 |
|
|
|
52 |
|
|
if { [llength $args] < 3 } {
|
53 |
|
|
error "scan-ipa-dump: too few arguments"
|
54 |
|
|
return
|
55 |
|
|
}
|
56 |
|
|
if { [llength $args] > 4 } {
|
57 |
|
|
error "scan-ipa-dump: too many arguments"
|
58 |
|
|
return
|
59 |
|
|
}
|
60 |
|
|
if { [llength $args] >= 4 } {
|
61 |
|
|
scan-dump-times "ipa" [lindex $args 0] [lindex $args 1] \
|
62 |
|
|
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 2]" [lindex $args 3]
|
63 |
|
|
} else {
|
64 |
|
|
scan-dump-times "ipa" [lindex $args 0] [lindex $args 1] \
|
65 |
|
|
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 2]"
|
66 |
|
|
}
|
67 |
|
|
}
|
68 |
|
|
|
69 |
|
|
# Call pass if pattern is not present, otherwise fail.
|
70 |
|
|
#
|
71 |
|
|
# Argument 0 is the regexp to match
|
72 |
|
|
# Argument 1 is the name of the dumped ipa pass
|
73 |
|
|
# Argument 2 handles expected failures and the like
|
74 |
|
|
proc scan-ipa-dump-not { args } {
|
75 |
|
|
|
76 |
|
|
if { [llength $args] < 2 } {
|
77 |
|
|
error "scan-ipa-dump-not: too few arguments"
|
78 |
|
|
return
|
79 |
|
|
}
|
80 |
|
|
if { [llength $args] > 3 } {
|
81 |
|
|
error "scan-ipa-dump-not: too many arguments"
|
82 |
|
|
return
|
83 |
|
|
}
|
84 |
|
|
if { [llength $args] >= 3 } {
|
85 |
|
|
scan-dump-not "ipa" [lindex $args 0] \
|
86 |
|
|
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" [lindex $args 2]
|
87 |
|
|
} else {
|
88 |
|
|
scan-dump-not "ipa" [lindex $args 0] \
|
89 |
|
|
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]"
|
90 |
|
|
}
|
91 |
|
|
}
|
92 |
|
|
|
93 |
|
|
# Utility for scanning demangled compiler result, invoked via dg-final.
|
94 |
|
|
# Call pass if pattern is present, otherwise fail.
|
95 |
|
|
#
|
96 |
|
|
# Argument 0 is the regexp to match
|
97 |
|
|
# Argument 1 is the name of the dumped ipa pass
|
98 |
|
|
# Argument 2 handles expected failures and the like
|
99 |
|
|
proc scan-ipa-dump-dem { args } {
|
100 |
|
|
|
101 |
|
|
if { [llength $args] < 2 } {
|
102 |
|
|
error "scan-ipa-dump-dem: too few arguments"
|
103 |
|
|
return
|
104 |
|
|
}
|
105 |
|
|
if { [llength $args] > 3 } {
|
106 |
|
|
error "scan-ipa-dump-dem: too many arguments"
|
107 |
|
|
return
|
108 |
|
|
}
|
109 |
|
|
if { [llength $args] >= 3 } {
|
110 |
|
|
scan-dump-dem "ipa" [lindex $args 0] \
|
111 |
|
|
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" [lindex $args 2]
|
112 |
|
|
} else {
|
113 |
|
|
scan-dump-dem "ipa" [lindex $args 0] \
|
114 |
|
|
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]"
|
115 |
|
|
}
|
116 |
|
|
}
|
117 |
|
|
|
118 |
|
|
# Call pass if demangled pattern is not present, otherwise fail.
|
119 |
|
|
#
|
120 |
|
|
# Argument 0 is the regexp to match
|
121 |
|
|
# Argument 1 is the name of the dumped ipa pass
|
122 |
|
|
# Argument 2 handles expected failures and the like
|
123 |
|
|
proc scan-ipa-dump-dem-not { args } {
|
124 |
|
|
|
125 |
|
|
if { [llength $args] < 2 } {
|
126 |
|
|
error "scan-ipa-dump-dem-not: too few arguments"
|
127 |
|
|
return
|
128 |
|
|
}
|
129 |
|
|
if { [llength $args] > 3 } {
|
130 |
|
|
error "scan-ipa-dump-dem-not: too many arguments"
|
131 |
|
|
return
|
132 |
|
|
}
|
133 |
|
|
if { [llength $args] >= 3 } {
|
134 |
|
|
scan-dump-dem-not "ipa" [lindex $args 0] \
|
135 |
|
|
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]" \
|
136 |
|
|
[lindex $args 2]
|
137 |
|
|
} else {
|
138 |
|
|
scan-dump-dem-not "ipa" [lindex $args 0] \
|
139 |
|
|
"\[0-9\]\[0-9\]\[0-9\]i.[lindex $args 1]"
|
140 |
|
|
}
|
141 |
|
|
}
|