Skip to content

Commit

Permalink
Add support for clang to pgo.bash .
Browse files Browse the repository at this point in the history
clang is an LLVM-based C/C++/etc. compiler.
  • Loading branch information
shlomif committed Jan 22, 2016
1 parent 7d132a6 commit 843b434
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions fc-solve/source/scripts/pgo.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@

# This is a script for PGO - Profile Guided Optimisations in gcc.

compiler="$1"
real_compiler="$1"
shift
mode="$1"
shift

if test "$real_compiler" = "clang" ; then
compiler="gcc"
else
compiler="$real_compiler"
fi

pgo_flags=""
make_vars=()

Expand All @@ -32,7 +38,7 @@ run_self()
local cmd="$1"
shift

bash "$src"/scripts/pgo.bash "$compiler" "$cmd"
bash "$src"/scripts/pgo.bash "$real_compiler" "$cmd"
}

run_timing()
Expand Down Expand Up @@ -77,13 +83,17 @@ elif test "$mode" = "gen" ; then
echo "Unknown compiler '$compiler'!" 1>&2
exit -1
fi

else
echo "Unknown mode '$mode'!" 1>&2
exit -1
fi

if test \( "$real_compiler" = "clang" \) -a \( "$mode" = "use" \) ; then
llvm-profdata merge -output default.profdata default.profraw
fi

run_make FREECELL_ONLY=1 \
EXTRA_CFLAGS="$pgo_flags" \
COMPILER="$compiler" \
COMPILER="$real_compiler" \
$make_vars

0 comments on commit 843b434

Please sign in to comment.