ghc 3.76 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 53 54
if (ghc_with_dynamic_rts == 1):
	config.run_ways.append('dyn')

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

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

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

102
def get_compiler_info():
Ian Lynagh's avatar
Ian Lynagh committed
103 104
    # This should really not go through the shell
    h = os.popen('"' + config.compiler + '" --numeric-version', 'r')
105 106 107 108 109
    v = h.read()
    h.close()
    v = re.sub('[\r\n]', '', v)
    v = v.split('-')
    config.compiler_version = v[0]
110
    config.compiler_maj_version = re.sub('^([0-9]+\.[0-9]+).*',r'\1', v[0])
111
    config.compiler_tags = v[1:]
112

113
    # remove profthreaded for GHC <6.9, it didn't work
114
    if ('profthreaded' in config.run_ways) and version_lt(config.compiler_version, '6.9'):
115
        config.run_ways.remove('profthreaded')
116 117 118

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