Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(845)

Side by Side Diff: pydir/run-llvm2ice.py

Issue 952993006: Omit textual emitConstPool in MINIMAL build. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: line wrap Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/IceTargetLoweringX8632.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python2 1 #!/usr/bin/env python2
2 2
3 import argparse 3 import argparse
4 import itertools 4 import itertools
5 import os 5 import os
6 import re 6 import re
7 import subprocess 7 import subprocess
8 import sys 8 import sys
9 import tempfile 9 import tempfile
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 help='Path to Binutils executables') 49 help='Path to Binutils executables')
50 argparser.add_argument('--assemble', required=False, 50 argparser.add_argument('--assemble', required=False,
51 action='store_true', 51 action='store_true',
52 help='Assemble the output') 52 help='Assemble the output')
53 argparser.add_argument('--disassemble', required=False, 53 argparser.add_argument('--disassemble', required=False,
54 action='store_true', 54 action='store_true',
55 help='Disassemble the assembled output') 55 help='Disassemble the assembled output')
56 argparser.add_argument('--dis-flags', required=False, 56 argparser.add_argument('--dis-flags', required=False,
57 action='append', default=[], 57 action='append', default=[],
58 help='Add a disassembler flag') 58 help='Add a disassembler flag')
59 argparser.add_argument('--filetype', default='iasm', dest='filetype',
60 choices=['obj', 'asm', 'iasm'],
61 help='Output file type. Default %(default)s.')
59 argparser.add_argument('--echo-cmd', required=False, 62 argparser.add_argument('--echo-cmd', required=False,
60 action='store_true', 63 action='store_true',
61 help='Trace command that generates ICE instructions') 64 help='Trace command that generates ICE instructions')
62 argparser.add_argument('--args', '-a', nargs=argparse.REMAINDER, 65 argparser.add_argument('--args', '-a', nargs=argparse.REMAINDER,
63 default=[], 66 default=[],
64 help='Remaining arguments are passed to llvm2ice') 67 help='Remaining arguments are passed to llvm2ice')
65 68
66 args = argparser.parse_args() 69 args = argparser.parse_args()
67 llvm_bin_path = args.llvm_bin_path 70 llvm_bin_path = args.llvm_bin_path
68 binutils_bin_path = args.binutils_bin_path 71 binutils_bin_path = args.binutils_bin_path
(...skipping 20 matching lines...) Expand all
89 # reassembled into order. 92 # reassembled into order.
90 cmd += ['-verbose', 'inst', '-notranslate', '-threads=0'] 93 cmd += ['-verbose', 'inst', '-notranslate', '-threads=0']
91 if not args.llvm_source: 94 if not args.llvm_source:
92 cmd += ['--bitcode-format=pnacl'] 95 cmd += ['--bitcode-format=pnacl']
93 if not args.no_local_syms: 96 if not args.no_local_syms:
94 cmd += ['--allow-local-symbol-tables'] 97 cmd += ['--allow-local-symbol-tables']
95 if args.llvm or args.llvm_source: 98 if args.llvm or args.llvm_source:
96 cmd += ['--build-on-read=0'] 99 cmd += ['--build-on-read=0']
97 else: 100 else:
98 cmd += ['--build-on-read=1'] 101 cmd += ['--build-on-read=1']
102 cmd += ['--filetype=' + args.filetype]
99 cmd += args.args 103 cmd += args.args
100 if args.llvm_source: 104 if args.llvm_source:
101 cmd += [llfile] 105 cmd += [llfile]
102 asm_temp = None 106 asm_temp = None
103 if args.assemble or args.disassemble: 107 if args.assemble or args.disassemble:
104 # On windows we may need to close the file first before it can be 108 # On windows we may need to close the file first before it can be
105 # re-opened by the other tools, so don't do delete-on-close, 109 # re-opened by the other tools, so don't do delete-on-close,
106 # and instead manually delete. 110 # and instead manually delete.
107 asm_temp = tempfile.NamedTemporaryFile(delete=False) 111 asm_temp = tempfile.NamedTemporaryFile(delete=False)
108 asm_temp.close() 112 asm_temp.close()
109 if args.assemble: 113 if args.assemble and args.filetype != 'obj':
110 cmd += ['|', os.path.join(llvm_bin_path, 'llvm-mc'), 114 cmd += ['|', os.path.join(llvm_bin_path, 'llvm-mc'),
111 '-triple=i686-none-nacl', 115 '-triple=i686-none-nacl',
112 '-filetype=obj', '-o', asm_temp.name] 116 '-filetype=obj', '-o', asm_temp.name]
117 elif asm_temp:
118 cmd += ['-o', asm_temp.name]
113 if args.disassemble: 119 if args.disassemble:
114 # Show wide instruction encodings, diassemble, and show relocs. 120 # Show wide instruction encodings, diassemble, and show relocs.
115 cmd += (['&&', os.path.join(binutils_bin_path, 'objdump')] + 121 cmd += (['&&', os.path.join(binutils_bin_path, 'objdump')] +
116 args.dis_flags + 122 args.dis_flags +
117 ['-w', '-d', '-r', '-Mintel', asm_temp.name]) 123 ['-w', '-d', '-r', '-Mintel', asm_temp.name])
118 124
119 stdout_result = shellcmd(cmd, echo=args.echo_cmd) 125 stdout_result = shellcmd(cmd, echo=args.echo_cmd)
120 if not args.echo_cmd: 126 if not args.echo_cmd:
121 sys.stdout.write(stdout_result) 127 sys.stdout.write(stdout_result)
122 if asm_temp: 128 if asm_temp:
123 os.remove(asm_temp.name) 129 os.remove(asm_temp.name)
124 130
125 if __name__ == '__main__': 131 if __name__ == '__main__':
126 main() 132 main()
OLDNEW
« no previous file with comments | « no previous file | src/IceTargetLoweringX8632.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698