ghc 4.05 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']
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 28
                                'prof_hd','prof_hy','prof_hr',
                                'threaded2_qw']
krc's avatar
krc committed
29

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

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

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

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

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

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

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

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

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

103 104 105 106 107 108 109 110
# 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'])

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

122
    # remove profthreaded for GHC <6.9, it didn't work
123
    if ('profthreaded' in config.run_ways) and version_lt(config.compiler_version, '6.9'):
124
        config.run_ways.remove('profthreaded')
125 126 127

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