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

Unified Diff: pydir/run-llvm2ice.py

Issue 914263005: Subzero: switch from llvm-objdump to objdump for lit tests (for LLVM merge) (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: fix some 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Makefile.standalone ('k') | tests_lit/assembler/x86/immediate_encodings.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pydir/run-llvm2ice.py
diff --git a/pydir/run-llvm2ice.py b/pydir/run-llvm2ice.py
index 3be4e0512ae979b53dd8eaf1ca76b8d9562787d8..d622e7f32b04b538775f2edef6db25906df4f793 100755
--- a/pydir/run-llvm2ice.py
+++ b/pydir/run-llvm2ice.py
@@ -6,6 +6,7 @@ import os
import re
import subprocess
import sys
+import tempfile
from utils import shellcmd
@@ -43,6 +44,18 @@ def main():
default=None, metavar='LLVM_BIN_PATH',
help='Path to LLVM executables ' +
'(for building PEXE files)')
+ argparser.add_argument('--binutils-bin-path', required=False,
+ default=None, metavar='BINUTILS_BIN_PATH',
+ help='Path to Binutils executables')
+ argparser.add_argument('--assemble', required=False,
+ action='store_true',
+ help='Assemble the output')
+ argparser.add_argument('--disassemble', required=False,
+ action='store_true',
+ help='Disassemble the assembled output')
+ argparser.add_argument('--dis-flags', required=False,
+ action='append', default=[],
+ help='Add a disassembler flag')
argparser.add_argument('--echo-cmd', required=False,
action='store_true',
help='Trace command that generates ICE instructions')
@@ -52,6 +65,7 @@ def main():
args = argparser.parse_args()
llvm_bin_path = args.llvm_bin_path
+ binutils_bin_path = args.binutils_bin_path
llfile = args.input
if args.llvm and args.llvm_source:
@@ -85,10 +99,28 @@ def main():
cmd += args.args
if args.llvm_source:
cmd += [llfile]
+ asm_temp = None
+ if args.assemble or args.disassemble:
+ # On windows we may need to close the file first before it can be
+ # re-opened by the other tools, so don't do delete-on-close,
+ # and instead manually delete.
+ asm_temp = tempfile.NamedTemporaryFile(delete=False)
+ asm_temp.close()
+ if args.assemble:
+ cmd += ['|', os.path.join(llvm_bin_path, 'llvm-mc'),
+ '-triple=i686-none-nacl',
+ '-filetype=obj', '-o', asm_temp.name]
+ if args.disassemble:
+ # Show wide instruction encodings, diassemble, and show relocs.
+ cmd += (['&&', os.path.join(binutils_bin_path, 'objdump')] +
+ args.dis_flags +
+ ['-w', '-d', '-r', '-Mintel', asm_temp.name])
stdout_result = shellcmd(cmd, echo=args.echo_cmd)
if not args.echo_cmd:
sys.stdout.write(stdout_result)
+ if asm_temp:
+ os.remove(asm_temp.name)
if __name__ == '__main__':
main()
« no previous file with comments | « Makefile.standalone ('k') | tests_lit/assembler/x86/immediate_encodings.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698