# Copyright (C) 2020-2023 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GCC; see the file COPYING3. If not see # . # Utility for scanning offloading dump output, used by libgomp.exp. # Format an offload dump suffix given the offload target name in # OFFTGT and any suffix, probably empty, in SUFFIX. proc scoff-format { offtgt suffix } { return ".x$offtgt.mkoffload$suffix" } # Adjust an offload dump TESTNAME for offload TARGET. proc scoff-testname { target testname } { return "$target-$testname" } # Adjust the arglist ARGS, so that argument IDX gets scoff-formatted, # and argument 0 (the test name) gets scoff-testnamed. proc scoff-adjust { args idx target } { lset args $idx "[scoff-format $target [lindex $args $idx]]" lset args 0 "[scoff-testname $target [lindex $args 0]]" return $args } # Wrapper for scan procs. # Argument 0 is the index of the argument to replace when calling # argument 1 with the remaining arguments. Use end-1 or end or so. proc scoff { args } { set idx [lindex $args 0] set prc [lindex $args 1] set args [lreplace $args 0 1] global offload_target if [info exists offload_target] { set target $offload_target if { "$target" != "disable" } { eval $prc [scoff-adjust $args $idx $target] } } else { global offload_targets foreach target [split $offload_targets ","] { # HSA offloading is doing things differently, doesn't use 'mkoffload'. if { "$target" == "hsa" } continue eval $prc [scoff-adjust $args $idx $target] } } }