ghc 4.83 KB
Newer Older
1 2 3
import os
import re

4 5 6 7 8 9
# Testsuite configuration setup for GHC
#
# This file is Python source
#
config.compiler_type         = 'ghc'
config.compiler              = 'ghc'
10
config.compiler_always_flags = ['-fforce-recomp', '-dcore-lint', '-dcmm-lint', '-dno-debug-output', '-no-user-package-conf', '-rtsopts', '-fno-ghci-history']
11

dterei's avatar
dterei committed
12 13 14
config.hp2ps                 = 'hp2ps'
config.hpc                   = 'hpc'
config.gs                    = 'gs'
15 16
config.confdir               = '.'

andy@galois.com's avatar
andy@galois.com committed
17
# By default, we test the 'normal', 'opt' and 'hpc' ways.
18 19
# 'optasm' is added by mk/test.mk if the compiler has a native code gen,
# 'prof'   is added by mk/test.mk if the profiling way is enabled.
dterei's avatar
dterei committed
20 21
config.compile_ways       = ['normal', 'hpc']
config.run_ways           = ['normal', 'hpc']
22

krc's avatar
krc committed
23
# ways that are not enabled by default, but can always be invoked explicitly
dterei's avatar
dterei committed
24 25 26 27 28
config.other_ways         = ['extcore','optextcore',
                             'prof_hc_hb','prof_hb',
                             'prof_hd','prof_hy','prof_hr',
                             'threaded1_ls', 'threaded2_hT',
                             'llvm', 'debugllvm']
krc's avatar
krc committed
29

30
if (ghc_with_native_codegen == 1):
dterei's avatar
dterei committed
31 32
    config.compile_ways.append('optasm')
    config.run_ways.append('optasm')
33 34

if (ghc_with_profiling == 1):
dterei's avatar
dterei committed
35 36 37 38
    config.have_profiling = True
    if (ghc_with_native_codegen == 1):
        config.compile_ways.append('profasm')
        config.run_ways.append('profasm')
39

40
if (ghc_with_interpreter == 1):
dterei's avatar
dterei committed
41 42
    config.have_interp = True
    config.run_ways.append('ghci')
43

44 45
config.unregisterised = (ghc_unregisterised == 1)

46
if (ghc_with_threaded_rts == 1):
dterei's avatar
dterei committed
47 48 49
    config.run_ways.append('threaded1')
    if (ghc_with_smp == 1):
        config.run_ways.append('threaded2')
50

51
if (ghc_with_dynamic_rts == 1):
dterei's avatar
dterei committed
52 53
    config.have_shared_libs = True
    config.run_ways.append('dyn')
54

55
if (ghc_with_profiling == 1 and ghc_with_threaded_rts == 1):
dterei's avatar
dterei committed
56
    config.run_ways.append('profthreaded')
57

58
if (ghc_with_llvm == 1):
dterei's avatar
dterei committed
59
    config.run_ways.append('optllvm')
60

61 62
config.in_tree_compiler = in_tree_compiler

63
config.way_flags = {
dterei's avatar
dterei committed
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
    'normal'       : [],
    'g1'           : [],
    'optasm'       : ['-O -fasm'],
    'llvm'         : ['-fllvm'],
    'optllvm'      : ['-O -fllvm'],
    'debugllvm'    : ['-fllvm -keep-llvm-files'],
    'profasm'      : ['-O -prof -auto-all -fasm'],
    'profthreaded' : ['-O -prof -auto-all -fasm -threaded'],
    'ghci'         : ['--interactive', '-v0', '-ignore-dot-ghci', '+RTS', '-I0.1', '-RTS'],
    'extcore'      : ['-fext-core'],
    'optextcore'   : ['-O -fext-core'],
    'threaded1'    : ['-threaded', '-debug'],
    'threaded1_ls' : ['-threaded', '-debug'],
    'threaded2'    : ['-O', '-threaded', '-eventlog'],
    'threaded2_hT' : ['-O', '-threaded'],
    'hpc'          : ['-O', '-fhpc' ],
    'prof_hc_hb'   : ['-O -prof -auto-all'],
    'prof_hb'      : ['-O -prof -auto-all'],
    'prof_hd'      : ['-O -prof -auto-all'],
    'prof_hy'      : ['-O -prof -auto-all'],
    'prof_hr'      : ['-O -prof -auto-all'],
    'dyn'          : ['-O -dynamic']
   }
87 88

config.way_rts_flags = { 
dterei's avatar
dterei committed
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
    'normal'       : [],
    'g1'           : ['-G1'],
    'optasm'       : [],
    'llvm'         : [],
    'optllvm'      : [],
    'debugllvm'    : [],
    'profasm'      : ['-hc'], # test heap profiling too
    'profthreaded' : ['-p'],
    'ghci'         : [],
    'extcore'      : [],
    'optextcore'   : [],
    'threaded1'    : [],
    'threaded1_ls' : ['-ls'],
    'threaded2'    : ['-N2 -ls'],
    'threaded2_hT' : ['-N2', '-hT'],
    'hpc'          : [],
    'prof_hc_hb'   : ['-hc -hbvoid'],
    'prof_hb'      : ['-hb'],
    'prof_hd'      : ['-hd'],
    'prof_hy'      : ['-hy'],
    'prof_hr'      : ['-hr'],
    'dyn'          : []
   }
112

113 114 115
# Useful classes of ways:

prof_ways = filter(lambda x: x in config.run_ways, 
Ian Lynagh's avatar
Ian Lynagh committed
116
                   ['profasm','profthreaded'])
117 118 119 120

threaded_ways = filter(lambda x: x in config.run_ways, 
                       ['threaded1','threaded2','ghci','profthreaded'])

121
def get_compiler_info():
dterei's avatar
dterei committed
122
# This should really not go through the shell
123 124
    h = os.popen('"' + config.compiler + '" --info', 'r')
    s = h.read()
125
    s = re.sub('[\r\n]', '', s)
126
    h.close()
127 128 129
    compilerInfoDict = dict(eval(s))
    h = os.popen('"' + config.compiler + '" +RTS --info', 'r')
    s = h.read()
130
    s = re.sub('[\r\n]', '', s)
131 132 133 134
    h.close()
    rtsInfoDict = dict(eval(s))

    v = compilerInfoDict["Project version"].split('-')
135
    config.compiler_version = v[0]
136
    config.compiler_maj_version = re.sub('^([0-9]+\.[0-9]+).*',r'\1', v[0])
137
    config.compiler_tags = v[1:]
138

139 140
    if re.match(".*_p(_.*|$)", rtsInfoDict["RTS way"]):
        config.compiler_profiled = True
141
        config.run_ways = filter(lambda x: x != 'ghci', config.run_ways)
142 143 144
    else:
        config.compiler_profiled = False

145
    try:
dterei's avatar
dterei committed
146
        config.package_conf_cache_file = compilerInfoDict["Global Package DB"] + '/package.cache'
147
    except:
dterei's avatar
dterei committed
148
        config.package_conf_cache_file = ''