ghc 3.39 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']
12

13 14 15 16
config.hp2ps		     = 'hp2ps'
config.gs		     = 'gs'
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.
20 21
config.compile_ways	     = ['normal', 'optc', 'hpc']
config.run_ways		     = ['normal', 'optc', 'hpc']
22

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

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

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

40 41 42
if (ghc_with_interpreter == 1):
	config.run_ways.append('ghci')

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

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

50 51
config.way_flags = {
	'normal'     : [],
52
	'optc'       : ['-O -fvia-C'],
53
	'optasm'     : ['-O -fasm'],
54
	'profc'      : ['-O -prof -auto-all -fvia-C'],
55
	'profasm'    : ['-O -prof -auto-all -fasm'],
Simon Marlow's avatar
Simon Marlow committed
56
	'profthreaded' : ['-O -prof -auto-all -fasm -threaded'],
Simon Marlow's avatar
Simon Marlow committed
57
	'ghci'       : ['--interactive', '-v0', '-ignore-dot-ghci'],
58 59
	'extcore'    : ['-fext-core'],
	'optextcore' : ['-O -fext-core'],
60
	'threaded1'  : ['-threaded', '-debug'],
andy@galois.com's avatar
andy@galois.com committed
61
	'threaded2'  : ['-O', '-threaded'],
62 63 64 65 66
	'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'],
67 68
        'prof_hr'    : ['-O -prof -auto-all'],
        'dyn'        : ['-O -dynamic']
69 70 71 72
	}

config.way_rts_flags = { 
	'normal'     : [],
73
	'optc'       : [],
74
	'optasm'     : [],
75
	'profc'      : ['-p'],
76
	'profasm'    : ['-hc'], # test heap profiling too
Simon Marlow's avatar
Simon Marlow committed
77
	'profthreaded' : ['-p'],
78 79 80
	'ghci'       : [],
	'extcore'    : [],
	'optextcore' : [],
81
	'threaded1'  : [],
andy@galois.com's avatar
andy@galois.com committed
82
	'threaded2'  : ['-N2'],
83 84 85 86 87
	'hpc'	     : [],
        'prof_hc_hb' : ['-hc -hbvoid'],
        'prof_hb'    : ['-hb'],
        'prof_hd'    : ['-hd'],
        'prof_hy'    : ['-hy'],
88 89
        'prof_hr'    : ['-hr'],
        'dyn'        : []
90
    	}
91

92 93 94 95 96 97 98
def get_compiler_info():
    h = os.popen(config.compiler + ' --numeric-version', 'r')
    v = h.read()
    h.close()
    v = re.sub('[\r\n]', '', v)
    v = v.split('-')
    config.compiler_version = v[0]
99
    config.compiler_maj_version = re.sub('^([0-9]+\.[0-9]+).*',r'\1', v[0])
100
    config.compiler_tags = v[1:]
101 102 103 104 105 106

    # enable profthreaded only for GHC 6.9+ with profiling & threaded RTS:
    if version_ge(config.compiler_version, '6.9') \
          and ghc_with_profiling == 1 \
          and ghc_with_threaded_rts == 1:
        config.run_ways.append('profthreaded')
107 108 109

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