Skip to content

Commit

Permalink
Make fparse-llvm work with tau_f90.sh
Browse files Browse the repository at this point in the history
More unification and tidying/cleanup is required
  • Loading branch information
zbeekman committed Dec 15, 2024
1 parent 601e2e9 commit 7e5d16c
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/fparse-llvm.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fi
function usage {
echo "Usage: $0 [-h] [-o output_file] [-show] input_file [args]"
echo " -h: print this help message and exit"
echo " -o output_file: specify the output file name"
echo " --tau_output=output_file: specify the output file name"
echo " -show: print the command line without running it"
echo " input_file: the Fortran source file to parse and instrument"
echo " args: additional arguments to pass to the flang compiler (include flags etc.)"
Expand All @@ -54,11 +54,19 @@ fi
# Loop over the arguments and check for the output file -o flag and it's argument
# If found, set the output file name to the argument following the -o flag and remove the -o flag and argument from the argument list
# If not found, set the output file name to the first argument with a .inst extension
#echo "Passed command line arguments: $*"

args=()
expecting_output_file=false
forward_remaining_args=false
show=false
for arg in "$@"; do
#echo "working on arg: $arg"
if [[ $forward_remaining_args == true ]]; then
args+=("${@}")
#echo "args remaining: $*"
break
fi
if [[ $arg == -h ]]; then
usage
exit 0
Expand All @@ -67,14 +75,18 @@ for arg in "$@"; do
expecting_output_file=false
shift || true
#echo "args remaining: $*"
elif [[ $arg == -o ]]; then
elif [[ $arg == -o || $arg == --tau_output ]]; then
shift
expecting_output_file=true
#echo "args remaining: $*"
elif [[ $arg == -o* ]]; then
output_file="${arg#-o}"
shift || true
#echo "args remaining: $*"
elif [[ $arg == --tau_output=* ]]; then
output_file="${arg#--tau_output=}"
shift || true
#echo "args remaining: $*"
elif [[ $arg == *.[Ff]90 || $arg == *.[Ff] || $arg == *.[Ff]03 ]]; then
input_file="$arg"
shift || true
Expand All @@ -87,6 +99,10 @@ for arg in "$@"; do
FORTRAN_CONFIG_FILE="${arg#--config_file=}"
shift || true
#echo "args remaining: $*"
elif [[ $arg == -- ]]; then
shift
forward_remaining_args=true
#echo "args remaining: $*"
elif [[ -n ${arg:-} ]]; then
args+=("${arg}")
shift || true
Expand Down

0 comments on commit 7e5d16c

Please sign in to comment.