OLD | NEW |
1 # -*- Python -*- | 1 # -*- Python -*- |
2 # Taken from utils/lit/tests in the LLVM tree and hacked together to support | 2 # Taken from utils/lit/tests in the LLVM tree and hacked together to support |
3 # our tests. | 3 # our tests. |
4 # | 4 # |
5 # Note: This configuration has simple commands to run Subzero's translator. | 5 # Note: This configuration has simple commands to run Subzero's translator. |
6 # They have the form %X2i (i.e. %p2i, %l2i, and %lc2i) where X is defined | 6 # They have the form %X2i (i.e. %p2i, %l2i, and %lc2i) where X is defined |
7 # as follows: | 7 # as follows: |
8 # | 8 # |
9 # p : Run Subzero's translator, building ICE from PNaCl bitcode directly. | 9 # p : Run Subzero's translator, building ICE from PNaCl bitcode directly. |
10 # l : Run Subzero's translator, converting the .ll file to a PNaCl bitcode | 10 # l : Run Subzero's translator, converting the .ll file to a PNaCl bitcode |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 bin_root = src_root | 59 bin_root = src_root |
60 config.substitutions.append(('%{src_root}', src_root)) | 60 config.substitutions.append(('%{src_root}', src_root)) |
61 config.substitutions.append(('%{python}', sys.executable)) | 61 config.substitutions.append(('%{python}', sys.executable)) |
62 | 62 |
63 pydir = os.path.join(bin_root, 'pydir') | 63 pydir = os.path.join(bin_root, 'pydir') |
64 | 64 |
65 # Finding LLVM binary tools. All tools used in the tests must be listed in | 65 # Finding LLVM binary tools. All tools used in the tests must be listed in |
66 # the llvmbintools list. | 66 # the llvmbintools list. |
67 llvmbinpath = os.path.abspath(os.environ.get('LLVM_BIN_PATH')) | 67 llvmbinpath = os.path.abspath(os.environ.get('LLVM_BIN_PATH')) |
68 | 68 |
| 69 # Find binutils tools. This is used for objdump. |
| 70 binutilsbinpath = os.path.abspath(os.environ.get('BINUTILS_BIN_PATH')) |
| 71 |
69 # Define the location of the llvm2ice tool. | 72 # Define the location of the llvm2ice tool. |
70 llvm2icetool = os.path.join(bin_root, 'llvm2ice') | 73 llvm2icetool = os.path.join(bin_root, 'llvm2ice') |
71 llvm2iceatts = shellcmd(' '.join([llvm2icetool, '--build-atts']), | 74 llvm2iceatts = shellcmd(' '.join([llvm2icetool, '--build-atts']), |
72 echo=False).split() | 75 echo=False).split() |
73 | 76 |
74 # Add build attributes of llvm2ice tool to the set of available features. | 77 # Add build attributes of llvm2ice tool to the set of available features. |
75 config.available_features.update(llvm2iceatts) | 78 config.available_features.update(llvm2iceatts) |
76 | 79 |
77 def if_cond_flag(Value): | 80 def if_cond_flag(Value): |
78 return '--cond=true' if Value else '--cond=false' | 81 return '--cond=true' if Value else '--cond=false' |
79 | 82 |
80 # shell conditional commands. | 83 # shell conditional commands. |
81 if_atts = [os.path.join(pydir, 'if.py')] | 84 if_atts = [os.path.join(pydir, 'if.py')] |
82 if_atts_cmd = if_atts + ['--have=' + att for att in llvm2iceatts] | 85 if_atts_cmd = if_atts + ['--have=' + att for att in llvm2iceatts] |
83 ifl2i_atts_cmd = if_atts + [if_cond_flag('allow_llvm_ir' in llvm2iceatts), | 86 ifl2i_atts_cmd = if_atts + [if_cond_flag('allow_llvm_ir' in llvm2iceatts), |
84 '--command'] | 87 '--command'] |
85 iflc2i_atts_cmd = if_atts + [if_cond_flag('allow_llvm_ir_as_input' | 88 iflc2i_atts_cmd = if_atts + [if_cond_flag('allow_llvm_ir_as_input' |
86 in llvm2iceatts), '--command'] | 89 in llvm2iceatts), '--command'] |
87 | 90 |
88 # Base command for running llvm2ice | 91 # Base command for running llvm2ice |
89 llvm2ice_cmd = [os.path.join(pydir, 'run-llvm2ice.py'), | 92 llvm2ice_cmd = [os.path.join(pydir, 'run-llvm2ice.py'), |
90 '--llvm2ice', llvm2icetool, | 93 '--llvm2ice', llvm2icetool, |
91 '--llvm-bin-path', llvmbinpath] | 94 '--llvm-bin-path', llvmbinpath, |
| 95 '--binutils-bin-path', binutilsbinpath] |
92 | 96 |
93 # Run commands only if corresponding build attributes apply, including | 97 # Run commands only if corresponding build attributes apply, including |
94 # for each compiler setup. | 98 # for each compiler setup. |
95 config.substitutions.append(('%ifp', ' ')) | 99 config.substitutions.append(('%ifp', ' ')) |
96 config.substitutions.append(('%iflc', ' '.join(iflc2i_atts_cmd))) | 100 config.substitutions.append(('%iflc', ' '.join(iflc2i_atts_cmd))) |
97 config.substitutions.append(('%ifl', ' '.join(ifl2i_atts_cmd))) | 101 config.substitutions.append(('%ifl', ' '.join(ifl2i_atts_cmd))) |
98 config.substitutions.append(('%if', ' '.join(if_atts_cmd))) | 102 config.substitutions.append(('%if', ' '.join(if_atts_cmd))) |
99 | 103 |
100 # Translate LLVM source for each compiler setup. | 104 # Translate LLVM source for each compiler setup. |
101 config.substitutions.append(('%p2i', ' '.join(llvm2ice_cmd))) | 105 config.substitutions.append(('%p2i', ' '.join(llvm2ice_cmd))) |
(...skipping 27 matching lines...) Expand all Loading... |
129 # Add a feature to detect the Python version. | 133 # Add a feature to detect the Python version. |
130 config.available_features.add("python%d.%d" % (sys.version_info[0], | 134 config.available_features.add("python%d.%d" % (sys.version_info[0], |
131 sys.version_info[1])) | 135 sys.version_info[1])) |
132 | 136 |
133 # Debugging output | 137 # Debugging output |
134 def dbg(s): | 138 def dbg(s): |
135 print '[DBG] %s' % s | 139 print '[DBG] %s' % s |
136 | 140 |
137 dbg('bin_root = %s' % bin_root) | 141 dbg('bin_root = %s' % bin_root) |
138 dbg('llvmbinpath = %s' % llvmbinpath) | 142 dbg('llvmbinpath = %s' % llvmbinpath) |
| 143 dbg('binutilsbinpath = %s' % binutilsbinpath) |
139 dbg("Build attributes = %s" % llvm2iceatts) | 144 dbg("Build attributes = %s" % llvm2iceatts) |
OLD | NEW |