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

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

94 95 96 97 98 99 100
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]
101
    config.compiler_maj_version = re.sub('^([0-9]+\.[0-9]+).*',r'\1', v[0])
102
    config.compiler_tags = v[1:]