]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | # -*- Python -*- |
2 | ||
3 | import os | |
4 | ||
5 | # Setup config name. | |
6 | config.name = 'Profile' | |
7 | ||
8 | # Setup source root. | |
9 | config.test_source_root = os.path.dirname(__file__) | |
10 | ||
11 | # Setup executable root. | |
12 | if hasattr(config, 'profile_lit_binary_dir') and \ | |
13 | config.profile_lit_binary_dir is not None: | |
14 | config.test_exec_root = config.profile_lit_binary_dir | |
15 | ||
16 | # If the above check didn't work, we're probably in the source tree. Use some | |
17 | # magic to re-execute from the build tree. | |
18 | if config.test_exec_root is None: | |
19 | # The magic relies on knowing compilerrt_site_basedir. | |
20 | compilerrt_basedir = lit_config.params.get('compilerrt_site_basedir', None) | |
21 | if compilerrt_basedir: | |
22 | site_cfg = os.path.join(compilerrt_basedir, 'profile', 'lit.site.cfg') | |
23 | if os.path.exists(site_cfg): | |
24 | lit_config.load_config(config, site_cfg) | |
25 | raise SystemExit | |
26 | ||
92a42be0 SL |
27 | if config.host_os in ['Linux']: |
28 | extra_linkflags = ["-ldl"] | |
29 | else: | |
30 | extra_linkflags = [] | |
31 | ||
1a4d82fc JJ |
32 | # Test suffixes. |
33 | config.suffixes = ['.c', '.cc', '.cpp', '.m', '.mm', '.ll', '.test'] | |
34 | ||
92a42be0 SL |
35 | # What to exclude. |
36 | config.excludes = ['Inputs'] | |
37 | ||
1a4d82fc | 38 | # Clang flags. |
92a42be0 | 39 | clang_cflags = [config.target_cflags] + extra_linkflags |
1a4d82fc JJ |
40 | |
41 | def build_invocation(compile_flags): | |
42 | return " " + " ".join([config.clang] + compile_flags) + " " | |
43 | ||
44 | # Add clang substitutions. | |
92a42be0 | 45 | config.substitutions.append( ("%clang ", build_invocation(clang_cflags)) ) |
1a4d82fc JJ |
46 | config.substitutions.append( ("%clang_profgen ", build_invocation(clang_cflags) + " -fprofile-instr-generate ") ) |
47 | config.substitutions.append( ("%clang_profuse=", build_invocation(clang_cflags) + " -fprofile-instr-use=") ) | |
92a42be0 SL |
48 | config.substitutions.append( ("%clang_profgen_gcc=", build_invocation(clang_cflags) + " -fprofile-generate=") ) |
49 | config.substitutions.append( ("%clang_profuse_gcc=", build_invocation(clang_cflags) + " -fprofile-use=") ) | |
50 | ||
51 | if config.host_os not in ['Darwin', 'FreeBSD', 'Linux']: | |
52 | config.unsupported = True | |
1a4d82fc | 53 | |
92a42be0 | 54 | if config.target_arch in ['armv7l']: |
1a4d82fc | 55 | config.unsupported = True |