summarylogtreecommitdiffstats
path: root/graphite.sh.in
blob: 88f30e39a6c625ae5d8ccf418b2a7fd12ab5721e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/bash
#
#   graphite.sh - Compile with polyhedral model optimization
#

[[ -n "$LIBMAKEPKG_BUILDENV_GRAPHITE_SH" ]] && return
LIBMAKEPKG_BUILDENV_GRAPHITE_SH=1

LIBRARY=${LIBRARY:-'@libmakepkgdir@'}

source "$LIBRARY/util/option.sh"

build_options+=('graphite' 'polly')
buildenv_functions+=('buildenv_graphite')

buildenv_graphite() {
  if check_buildoption "graphite" "y" || check_buildoption "polly" "y"; then
    graphiteflags=" -lgomp -mllvm -polly -mllvm -polly-num-threads=$(getconf _NPROCESSORS_ONLN) -mllvm -polly-parallel"
    check_buildoption "polly" "y" && \
     graphiteflags+=" -Xclang -load -Xclang LLVMPolly.so"
    check_buildoption "graphite" "y" && \
      graphiteflags=" -fgraphite-identity -floop-interchange -floop-nest-optimize -floop-parallelize-all -ftree-loop-distribution -ftree-parallelize-loops=$(getconf _NPROCESSORS_ONLN) -ftree-vectorize"

    CFLAGS+="$graphiteflags"
    CXXFLAGS+="$graphiteflags"
  fi
}