ghc 4.31 KB
Newer Older
1 2 3 4

import os
import re

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

13
config.hp2ps		     = 'hp2ps'
14
config.hpc		     = 'hpc'
15 16 17
config.gs		     = 'gs'
config.confdir               = '.'

andy@galois.com's avatar
andy@galois.com committed
18
# By default, we test the 'normal', 'opt' and 'hpc' ways.
19 20
# '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.
21 22
config.compile_ways	     = ['normal', 'optc', 'hpc']
config.run_ways		     = ['normal', 'optc', 'hpc']
23

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

31 32 33 34 35
if (ghc_with_native_codegen == 1):
	config.compile_ways.append('optasm')
	config.run_ways.append('optasm')

if (ghc_with_profiling == 1):
36
	config.have_profiling = True
37 38
	config.compile_ways.append('profc')
	config.run_ways.append('profc')
39 40 41
	if (ghc_with_native_codegen == 1):
		config.compile_ways.append('profasm')
		config.run_ways.append('profasm')
42

43 44 45
if (ghc_with_interpreter == 1):
	config.run_ways.append('ghci')

46 47
config.unregisterised = (ghc_unregisterised == 1)

48
if (ghc_with_threaded_rts == 1):
49
	config.run_ways.append('threaded1')
50 51
	if (ghc_with_smp == 1):
		config.run_ways.append('threaded2')
52

53
if (ghc_with_dynamic_rts == 1):
Simon Marlow's avatar
Simon Marlow committed
54
        config.have_shared_libs = True
55 56
	config.run_ways.append('dyn')

57 58 59
if (ghc_with_profiling == 1 and ghc_with_threaded_rts == 1):
        config.run_ways.append('profthreaded')

60 61
config.in_tree_compiler = in_tree_compiler

62 63
config.way_flags = {
	'normal'     : [],
64
	'optc'       : ['-O -fno-warn-deprecated-flags -fvia-C'],
65
	'optasm'     : ['-O -fasm'],
66 67
	'llvm'       : ['-fllvm'],
	'optllvm'    : ['-O -fllvm'],
68
	'profc'      : ['-O -prof -auto-all -fno-warn-deprecated-flags -fvia-C'],
69
	'profasm'    : ['-O -prof -auto-all -fasm'],
Simon Marlow's avatar
Simon Marlow committed
70
	'profthreaded' : ['-O -prof -auto-all -fasm -threaded'],
71
	'ghci'       : ['--interactive', '-v0', '-ignore-dot-ghci', '+RTS', '-I0.1', '-RTS'],
72 73
	'extcore'    : ['-fext-core'],
	'optextcore' : ['-O -fext-core'],
74
	'threaded1'  : ['-threaded', '-debug'],
75
	'threaded2'  : ['-O', '-threaded', '-eventlog'],
76
	'threaded2_qw'  : ['-O', '-threaded'],
77 78 79 80 81
	'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'],
82 83
        'prof_hr'    : ['-O -prof -auto-all'],
        'dyn'        : ['-O -dynamic']
84 85 86 87
	}

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

110 111 112 113 114 115 116 117
# Useful classes of ways:

prof_ways = filter(lambda x: x in config.run_ways, 
                   ['profc','profasm','profthreaded'])

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

118
def get_compiler_info():
Ian Lynagh's avatar
Ian Lynagh committed
119 120
    # This should really not go through the shell
    h = os.popen('"' + config.compiler + '" --numeric-version', 'r')
121 122 123 124 125
    v = h.read()
    h.close()
    v = re.sub('[\r\n]', '', v)
    v = v.split('-')
    config.compiler_version = v[0]
126
    config.compiler_maj_version = re.sub('^([0-9]+\.[0-9]+).*',r'\1', v[0])
127
    config.compiler_tags = v[1:]
128

129
    # remove profthreaded for GHC <6.9, it didn't work
130
    if ('profthreaded' in config.run_ways) and version_lt(config.compiler_version, '6.9'):
131
        config.run_ways.remove('profthreaded')
132 133 134

    if version_ge(config.compiler_version, '6.9'):
        config.compiler_always_flags.append('-dno-debug-output')