ghc 4.09 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', '-dno-debug-output', '-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 62
if (ghc_with_llvm == 1):
        config.run_ways.append('optllvm')

63 64
config.in_tree_compiler = in_tree_compiler

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

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

113 114 115 116 117 118 119 120
# 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'])

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