| 1 |
# Copyright (C) 2018-2025 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 |
# <http://www.gnu.org/licenses/>. |
| 16 |
|
| 17 |
# Various utilities for scanning offloading tree dump output, used by |
| 18 |
# libgomp.exp. |
| 19 |
|
| 20 |
load_lib scandump.exp |
| 21 |
load_lib scanoffload.exp |
| 22 |
|
| 23 |
# Utility for scanning compiler result, invoked via dg-final. |
| 24 |
# Call pass if pattern is present, otherwise fail. |
| 25 |
# |
| 26 |
# Argument 0 is the regexp to match |
| 27 |
# Argument 1 is the name of the dumped tree pass |
| 28 |
# Argument 2 handles expected failures and the like |
| 29 |
proc scan-offload-tree-dump { args } { |
| 30 |
|
| 31 |
if { [llength $args] < 2 } { |
| 32 |
error "scan-offload-tree-dump: too few arguments" |
| 33 |
return |
| 34 |
} |
| 35 |
if { [llength $args] > 3 } { |
| 36 |
error "scan-offload-tree-dump: too many arguments" |
| 37 |
return |
| 38 |
} |
| 39 |
if { [llength $args] >= 3 } { |
| 40 |
scoff end-1 scan-dump "offload-tree" [lindex $args 0] \ |
| 41 |
"\[0-9\]\[0-9\]\[0-9]t.[lindex $args 1]" "" \ |
| 42 |
[lindex $args 2] |
| 43 |
} else { |
| 44 |
scoff end scan-dump "offload-tree" [lindex $args 0] \ |
| 45 |
"\[0-9\]\[0-9\]\[0-9]t.[lindex $args 1]" "" |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
# Call pass if pattern is present given number of times, otherwise fail. |
| 50 |
# Argument 0 is the regexp to match |
| 51 |
# Argument 1 is number of times the regexp must be found |
| 52 |
# Argument 2 is the name of the dumped tree pass |
| 53 |
# Argument 3 handles expected failures and the like |
| 54 |
proc scan-offload-tree-dump-times { args } { |
| 55 |
|
| 56 |
if { [llength $args] < 3 } { |
| 57 |
error "scan-offload-tree-dump-times: too few arguments" |
| 58 |
return |
| 59 |
} |
| 60 |
if { [llength $args] > 4 } { |
| 61 |
error "scan-offload-tree-dump-times: too many arguments" |
| 62 |
return |
| 63 |
} |
| 64 |
if { [llength $args] >= 4 } { |
| 65 |
scoff end-1 scan-dump-times "offload-tree" [lindex $args 0] \ |
| 66 |
[lindex $args 1] "\[0-9\]\[0-9\]\[0-9]t.[lindex $args 2]" "" \ |
| 67 |
[lindex $args 3] |
| 68 |
} else { |
| 69 |
scoff end scan-dump-times "offload-tree" [lindex $args 0] \ |
| 70 |
[lindex $args 1] "\[0-9\]\[0-9\]\[0-9]t.[lindex $args 2]" "" |
| 71 |
} |
| 72 |
} |
| 73 |
|
| 74 |
# Call pass if pattern is not present, otherwise fail. |
| 75 |
# |
| 76 |
# Argument 0 is the regexp to match |
| 77 |
# Argument 1 is the name of the dumped tree pass |
| 78 |
# Argument 2 handles expected failures and the like |
| 79 |
proc scan-offload-tree-dump-not { args } { |
| 80 |
|
| 81 |
if { [llength $args] < 2 } { |
| 82 |
error "scan-offload-tree-dump-not: too few arguments" |
| 83 |
return |
| 84 |
} |
| 85 |
if { [llength $args] > 3 } { |
| 86 |
error "scan-offload-tree-dump-not: too many arguments" |
| 87 |
return |
| 88 |
} |
| 89 |
if { [llength $args] >= 3 } { |
| 90 |
scoff end-1 scan-dump-not "offload-tree" [lindex $args 0] \ |
| 91 |
"\[0-9\]\[0-9\]\[0-9]t.[lindex $args 1]" "" \ |
| 92 |
[lindex $args 2] |
| 93 |
} else { |
| 94 |
scoff end scan-dump-not "offload-tree" [lindex $args 0] \ |
| 95 |
"\[0-9\]\[0-9\]\[0-9]t.[lindex $args 1]" "" |
| 96 |
} |
| 97 |
} |
| 98 |
|
| 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 tree pass |
| 104 |
# Argument 2 handles expected failures and the like |
| 105 |
proc scan-offload-tree-dump-dem { args } { |
| 106 |
|
| 107 |
if { [llength $args] < 2 } { |
| 108 |
error "scan-offload-tree-dump-dem: too few arguments" |
| 109 |
return |
| 110 |
} |
| 111 |
if { [llength $args] > 3 } { |
| 112 |
error "scan-offload-tree-dump-dem: too many arguments" |
| 113 |
return |
| 114 |
} |
| 115 |
if { [llength $args] >= 3 } { |
| 116 |
scoff end-1 scan-dump-dem "offload-tree" [lindex $args 0] \ |
| 117 |
"\[0-9\]\[0-9\]\[0-9]t.[lindex $args 1]" "" \ |
| 118 |
[lindex $args 2] |
| 119 |
} else { |
| 120 |
scoff end scan-dump-dem "offload-tree" [lindex $args 0] \ |
| 121 |
"\[0-9\]\[0-9\]\[0-9]t.[lindex $args 1]" "" |
| 122 |
} |
| 123 |
} |
| 124 |
|
| 125 |
# Call pass if demangled pattern is not present, otherwise fail. |
| 126 |
# |
| 127 |
# Argument 0 is the regexp to match |
| 128 |
# Argument 1 is the name of the dumped tree pass |
| 129 |
# Argument 2 handles expected failures and the like |
| 130 |
proc scan-offload-tree-dump-dem-not { args } { |
| 131 |
|
| 132 |
if { [llength $args] < 2 } { |
| 133 |
error "scan-offload-tree-dump-dem-not: too few arguments" |
| 134 |
return |
| 135 |
} |
| 136 |
if { [llength $args] > 3 } { |
| 137 |
error "scan-offload-tree-dump-dem-not: too many arguments" |
| 138 |
return |
| 139 |
} |
| 140 |
if { [llength $args] >= 3 } { |
| 141 |
scoff end-1 scan-dump-dem-not "offload-tree" [lindex $args 0] \ |
| 142 |
"\[0-9\]\[0-9\]\[0-9]t.[lindex $args 1]" "" \ |
| 143 |
[lindex $args 2] |
| 144 |
} else { |
| 145 |
scoff end scan-dump-dem-not "offload-tree" [lindex $args 0] \ |
| 146 |
"\[0-9\]\[0-9\]\[0-9]t.[lindex $args 1]" "" |
| 147 |
} |
| 148 |
} |