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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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. Tools used in the tests must be listed in | 65 # Finding LLVM binary tools. Tools used in the tests must be listed in |
66 # the llvmbintools list or binutilsbintools. | 66 # the llvmbintools list or binutilsbintools. |
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. | 69 # Find binutils tools. This is used for objdump. |
70 binutilsbinpath = os.path.abspath(os.environ.get('BINUTILS_BIN_PATH')) | 70 binutilsbinpath = os.path.abspath(os.environ.get('BINUTILS_BIN_PATH')) |
71 | 71 |
72 # Define the location of the llvm2ice tool. | 72 # Define the location of the pnacl-sz tool. |
73 llvm2icetool = os.path.join(bin_root, 'llvm2ice') | 73 pnacl_sz_tool = os.path.join(bin_root, 'pnacl-sz') |
74 llvm2iceatts = shellcmd(' '.join([llvm2icetool, '--build-atts']), | 74 pnacl_sz_atts = shellcmd(' '.join([pnacl_sz_tool, '--build-atts']), |
75 echo=False).split() | 75 echo=False).split() |
76 | 76 |
77 # Add build attributes of llvm2ice tool to the set of available features. | 77 # Add build attributes of pnacl-sz tool to the set of available features. |
78 config.available_features.update(llvm2iceatts) | 78 config.available_features.update(pnacl_sz_atts) |
79 | 79 |
80 def if_cond_flag(Value): | 80 def if_cond_flag(Value): |
81 return '--cond=true' if Value else '--cond=false' | 81 return '--cond=true' if Value else '--cond=false' |
82 | 82 |
83 # shell conditional commands. | 83 # shell conditional commands. |
84 if_atts = [os.path.join(pydir, 'if.py')] | 84 if_atts = [os.path.join(pydir, 'if.py')] |
85 if_atts_cmd = if_atts + ['--have=' + att for att in llvm2iceatts] | 85 if_atts_cmd = if_atts + ['--have=' + att for att in pnacl_sz_atts] |
86 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 pnacl_sz_atts), |
87 '--command'] | 87 '--command'] |
88 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' |
89 in llvm2iceatts), '--command'] | 89 in pnacl_sz_atts), '--command'] |
90 | 90 |
91 # Base command for running llvm2ice | 91 # Base command for running pnacl-sz |
92 llvm2ice_cmd = [os.path.join(pydir, 'run-llvm2ice.py'), | 92 pnacl_sz_cmd = [os.path.join(pydir, 'run-pnacl-sz.py'), |
93 '--llvm2ice', llvm2icetool, | 93 '--pnacl-sz', pnacl_sz_tool, |
94 '--llvm-bin-path', llvmbinpath, | 94 '--llvm-bin-path', llvmbinpath, |
95 '--binutils-bin-path', binutilsbinpath] | 95 '--binutils-bin-path', binutilsbinpath] |
96 | 96 |
97 # Run commands only if corresponding build attributes apply, including | 97 # Run commands only if corresponding build attributes apply, including |
98 # for each compiler setup. | 98 # for each compiler setup. |
99 config.substitutions.append(('%ifp', ' ')) | 99 config.substitutions.append(('%ifp', ' ')) |
100 config.substitutions.append(('%iflc', ' '.join(iflc2i_atts_cmd))) | 100 config.substitutions.append(('%iflc', ' '.join(iflc2i_atts_cmd))) |
101 config.substitutions.append(('%ifl', ' '.join(ifl2i_atts_cmd))) | 101 config.substitutions.append(('%ifl', ' '.join(ifl2i_atts_cmd))) |
102 config.substitutions.append(('%if', ' '.join(if_atts_cmd))) | 102 config.substitutions.append(('%if', ' '.join(if_atts_cmd))) |
103 | 103 |
104 # Translate LLVM source for each compiler setup. | 104 # Translate LLVM source for each compiler setup. |
105 config.substitutions.append(('%p2i', ' '.join(llvm2ice_cmd))) | 105 config.substitutions.append(('%p2i', ' '.join(pnacl_sz_cmd))) |
106 config.substitutions.append(('%l2i', ' '.join(ifl2i_atts_cmd + llvm2ice_cmd | 106 config.substitutions.append(('%l2i', ' '.join(ifl2i_atts_cmd + pnacl_sz_cmd |
107 + ['--llvm']))) | 107 + ['--llvm']))) |
108 config.substitutions.append(('%lc2i', ' '.join(iflc2i_atts_cmd + llvm2ice_cmd | 108 config.substitutions.append(('%lc2i', ' '.join(iflc2i_atts_cmd + pnacl_sz_cmd |
109 + ['--llvm-source']))) | 109 + ['--llvm-source']))) |
110 | 110 |
111 config.substitutions.append(('%llvm2ice', llvm2icetool)) | 111 config.substitutions.append(('%pnacl_sz', pnacl_sz_tool)) |
112 | 112 |
113 llvmbintools = [r"\bFileCheck\b", | 113 llvmbintools = [r"\bFileCheck\b", |
114 r"\bllvm-as\b", | 114 r"\bllvm-as\b", |
115 r"\bllvm-mc\b", | 115 r"\bllvm-mc\b", |
116 r"\bllvm-readobj\b", | 116 r"\bllvm-readobj\b", |
117 r"\bnot\b", | 117 r"\bnot\b", |
118 r"\bpnacl-freeze\b", | 118 r"\bpnacl-freeze\b", |
119 r"\bpnacl-bcdis\b"] | 119 r"\bpnacl-bcdis\b"] |
120 | 120 |
121 for tool in llvmbintools: | 121 for tool in llvmbintools: |
(...skipping 21 matching lines...) Expand all Loading... |
143 config.available_features.add("python%d.%d" % (sys.version_info[0], | 143 config.available_features.add("python%d.%d" % (sys.version_info[0], |
144 sys.version_info[1])) | 144 sys.version_info[1])) |
145 | 145 |
146 # Debugging output | 146 # Debugging output |
147 def dbg(s): | 147 def dbg(s): |
148 print '[DBG] %s' % s | 148 print '[DBG] %s' % s |
149 | 149 |
150 dbg('bin_root = %s' % bin_root) | 150 dbg('bin_root = %s' % bin_root) |
151 dbg('llvmbinpath = %s' % llvmbinpath) | 151 dbg('llvmbinpath = %s' % llvmbinpath) |
152 dbg('binutilsbinpath = %s' % binutilsbinpath) | 152 dbg('binutilsbinpath = %s' % binutilsbinpath) |
153 dbg("Build attributes = %s" % llvm2iceatts) | 153 dbg("Build attributes = %s" % pnacl_sz_atts) |
OLD | NEW |