| 1 |
# Copyright (C) 2000-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 ltrans tree dump output, used by gcc-dg.exp and |
| 18 |
# g++-dg.exp. |
| 19 |
|
| 20 |
load_lib scandump.exp |
| 21 |
|
| 22 |
# Define scan-ltrans-{tree,rtl}-dump{,-not,-dem,-dem-not}. These are LTO |
| 23 |
# variants of the corresponding functions without -ltrans in the name. |
| 24 |
foreach ir { tree rtl } { |
| 25 |
foreach modifier { {} -not -dem -dem-not } { |
| 26 |
eval [string map [list @NAME@ scan-ltrans-$ir-dump$modifier \ |
| 27 |
@SCAN@ scan-dump$modifier \ |
| 28 |
@TYPE@ ltrans-$ir \ |
| 29 |
@SUFFIX@ [string index $ir 0]] { |
| 30 |
proc @NAME@ { args } { |
| 31 |
if { [llength $args] < 2 } { |
| 32 |
error "@NAME@: too few arguments" |
| 33 |
return |
| 34 |
} |
| 35 |
if { [llength $args] > 3 } { |
| 36 |
error "@NAME@: too many arguments" |
| 37 |
return |
| 38 |
} |
| 39 |
if { [llength $args] >= 3 } { |
| 40 |
@SCAN@ @TYPE@ [lindex $args 0] \ |
| 41 |
"\[0-9\]\[0-9\]\[0-9\]@SUFFIX@.[lindex $args 1]" \ |
| 42 |
".ltrans0.ltrans" \ |
| 43 |
[lindex $args 2] |
| 44 |
} else { |
| 45 |
@SCAN@ @TYPE@ [lindex $args 0] \ |
| 46 |
"\[0-9\]\[0-9\]\[0-9\]@SUFFIX@.[lindex $args 1]" \ |
| 47 |
".ltrans0.ltrans" |
| 48 |
} |
| 49 |
} |
| 50 |
}] |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
# Define scan-ltrans-{tree,rtl}-dump-times. These are LTO variants of the |
| 55 |
# corresponding functions without -ltrans in the name. |
| 56 |
foreach ir { tree rtl } { |
| 57 |
eval [string map [list @NAME@ scan-ltrans-$ir-dump-times \ |
| 58 |
@TYPE@ ltrans-$ir \ |
| 59 |
@SUFFIX@ [string index $ir 0]] { |
| 60 |
proc @NAME@ { args } { |
| 61 |
if { [llength $args] < 3 } { |
| 62 |
error "@NAME@: too few arguments" |
| 63 |
return |
| 64 |
} |
| 65 |
if { [llength $args] > 4 } { |
| 66 |
error "@NAME@: too many arguments" |
| 67 |
return |
| 68 |
} |
| 69 |
if { [llength $args] >= 4 } { |
| 70 |
scan-dump-times "@TYPE@" [lindex $args 0] [lindex $args 1] \ |
| 71 |
"\[0-9\]\[0-9\]\[0-9\]@SUFFIX@.[lindex $args 2]" \ |
| 72 |
".ltrans0.ltrans" [lindex $args 3] |
| 73 |
} else { |
| 74 |
scan-dump-times "@TYPE@" [lindex $args 0] [lindex $args 1] \ |
| 75 |
"\[0-9\]\[0-9\]\[0-9\]@SUFFIX@.[lindex $args 2]" \ |
| 76 |
".ltrans0.ltrans" |
| 77 |
} |
| 78 |
} |
| 79 |
}] |
| 80 |
} |