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

Side by Side Diff: crosstest/crosstest.py

Issue 265703002: Add Om1 lowering with no optimizations (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years, 7 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
OLDNEW
(Empty)
1 #!/usr/bin/env python2
2
3 import argparse
4 import os, sys
5 import subprocess
6 import tempfile
7
8 sys.path.insert(0, '../pydir')
9 from utils import shellcmd
10
11 if __name__ == '__main__':
12 argparser = argparse.ArgumentParser()
13 argparser.add_argument('--test', required=True, action='append',
14 help='List of C/C++/.ll files with test functions')
15 argparser.add_argument('--driver', required=True,
16 help='Driver program')
17 argparser.add_argument('--target', required=False, default='X8632',
JF 2014/05/01 00:16:55 X8632 isn't the naming you followed in the previou
Jim Stichnoth 2014/05/05 07:03:55 Looks like I was inconsistent in the previous CL.
18 help='Translation target string')
19 argparser.add_argument('-O', required=False, default='2', dest='optlevel',
20 choices=['m1', '-1', '0', '1', '2'],
JF 2014/05/01 00:16:55 Are m1 and -1 the same?
Jim Stichnoth 2014/05/05 07:03:55 Yes. Added to the help string.
21 help='Optimization level');
22 argparser.add_argument('--prefix', required=True,
23 help='String prepended to Subzero symbol names')
24 argparser.add_argument('--output', '-o', required=True,
25 help='Executable to produce')
26 argparser.add_argument('--dir', required=False, default='.',
27 help='Output directory for all files')
28 args = argparser.parse_args()
29
30 objs = []
31 for arg in args.test:
32 base, ext = os.path.splitext(arg)
33 if ext == '.ll':
34 bitcode = arg
35 else:
36 bitcode = os.path.join(args.dir, base + '.pnacl.ll')
37 shellcmd(['../pydir/build-pnacl-ir.py', '--dir', args.dir, arg])
38 shellcmd('sed -i "s/^define internal /define /" ' + bitcode)
39 shellcmd('sed -i "s/le32-unknown-nacl/i686-pc-linux-gnu/" ' + bitcod e)
JF 2014/05/01 00:16:55 sed?
Jim Stichnoth 2014/05/05 07:03:55 okok, I redid this with python regex.
40
41 asm_sz = os.path.join(args.dir, base + '.sz.s')
42 obj_sz = os.path.join(args.dir, base + '.sz.o')
43 obj_llc = os.path.join(args.dir, base + '.llc.o')
44 shellcmd(['../llvm2ice',
45 '-O' + args.optlevel,
46 '--target=' + args.target,
47 '--prefix=' + args.prefix,
48 '-o=' + asm_sz,
49 bitcode])
50 shellcmd(['$LLVM_BIN_PATH/llvm-mc',
JF 2014/05/01 00:16:55 Shouldn't LLVM_BIN_PATH be an argument instead?
Jim Stichnoth 2014/05/05 07:03:55 Done. Added --llvm-bin-path arg, and changed runte
51 '-arch=x86',
JF 2014/05/01 00:16:55 x86 always?
Jim Stichnoth 2014/05/05 07:03:55 Added the arch_map dictionary to map Subzero --tar
52 '-x86-asm-syntax=intel',
53 '-filetype=obj',
54 '-o=' + obj_sz,
55 asm_sz])
56 shellcmd(['$LLVM_BIN_PATH/llc',
57 '-filetype=obj',
58 '-o=' + obj_llc,
59 bitcode])
60 objs.append(obj_sz)
61 objs.append(bitcode)
62 #objs.append(obj_llc)
JF 2014/05/01 00:16:55 Commented out.
Jim Stichnoth 2014/05/05 07:03:55 This was left in intentionally, but I cleaned it u
63
64 shellcmd(['$LLVM_BIN_PATH/clang', '-g', '-m32', args.driver] +
65 objs +
66 ['-lm', '-o', os.path.join(args.dir, args.output)])
JF 2014/05/01 00:16:55 Doesn't this sometimes need to be clang++ to find
Jim Stichnoth 2014/05/05 07:03:55 You are right. 'clang' doesn't work as the linker
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698