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

Side by Side Diff: pydir/build-pnacl-ir.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: Add frem test; add LOWERING.rst file 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 tempfile
6 from utils import shellcmd
7
8 if __name__ == '__main__':
9 argparser = argparse.ArgumentParser()
10 argparser.add_argument('cfile', nargs='+', type=str,
11 help='C file(s) to convert')
12 argparser.add_argument('--nacl_sdk_root', nargs='?', type=str,
13 help='Path to NACL_SDK_ROOT')
14 argparser.add_argument('--dir', nargs='?', type=str, default='.',
15 help='Output directory')
16 argparser.add_argument('--disable-verify', action='store_true')
17 args = argparser.parse_args()
18
19 nacl_sdk_root = os.environ.get('NACL_SDK_ROOT', None)
20 if args.nacl_sdk_root:
21 nacl_sdk_root = os.path.expanduser(args.nacl_sdk_root)
22
23 if not nacl_sdk_root or not os.path.exists(nacl_sdk_root):
24 print '''\
25 Please set the NACL_SDK_ROOT environment variable or pass the path through
26 --nacl_sdk_root to point to a valid Native Client SDK installation.'''
27 sys.exit(1)
28
29 includes_path = os.path.join(nacl_sdk_root, 'include')
30 toolchain_path = os.path.join(nacl_sdk_root, 'toolchain', 'linux_pnacl')
31 clang_path = os.path.join(toolchain_path, 'bin64', 'pnacl-clang')
32 opt_path = os.path.join(toolchain_path, 'host_x86_64', 'bin', 'opt')
33
34 tempdir = tempfile.mkdtemp()
35
36 for cname in args.cfile:
37 basename = os.path.splitext(cname)[0]
38 llname = os.path.join(tempdir, basename + '.ll')
39 pnaclname = basename + '.pnacl.ll'
40 pnaclname = os.path.join(args.dir, pnaclname)
41
42 shellcmd(clang_path + ' -I{0} -c {1} -o {2}'.format(
43 includes_path, cname, llname))
44 shellcmd(opt_path +
45 ' -O2 -pnacl-abi-simplify-preopt -pnacl-abi-simplify-postopt' +
46 ('' if args.disable_verify else
47 ' -verify-pnaclabi-module -verify-pnaclabi-functions') +
48 ' -pnaclabi-allow-debug-metadata -disable-simplify-libcalls'
49 ' {0} -S -o {1}'.format(llname, pnaclname))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698