diff options
Diffstat (limited to 'llvm/utils/update_llc_test_checks.py')
-rwxr-xr-x | llvm/utils/update_llc_test_checks.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/llvm/utils/update_llc_test_checks.py b/llvm/utils/update_llc_test_checks.py index 09b49a763b6..d85fed56c18 100755 --- a/llvm/utils/update_llc_test_checks.py +++ b/llvm/utils/update_llc_test_checks.py @@ -7,6 +7,8 @@ FileCheck patterns. It can either update all of the tests in the file or a single test function. """ +from __future__ import print_function + import argparse import os # Used to advertise this file's name ("autogenerated_note"). import string @@ -42,7 +44,7 @@ def main(): for test in args.tests: if args.verbose: - print >>sys.stderr, 'Scanning for RUN lines in test file: %s' % (test,) + print('Scanning for RUN lines in test file: %s' % (test,), file=sys.stderr) with open(test) as f: input_lines = [l.rstrip() for l in f] @@ -63,9 +65,9 @@ def main(): run_lines.append(l) if args.verbose: - print >>sys.stderr, 'Found %d RUN lines:' % (len(run_lines),) + print('Found %d RUN lines:' % (len(run_lines),), file=sys.stderr) for l in run_lines: - print >>sys.stderr, ' RUN: ' + l + print(' RUN: ' + l, file=sys.stderr) run_list = [] for l in run_lines: @@ -81,11 +83,11 @@ def main(): if len(commands) > 1: filecheck_cmd = commands[1] if not llc_cmd.startswith('llc '): - print >>sys.stderr, 'WARNING: Skipping non-llc RUN line: ' + l + print('WARNING: Skipping non-llc RUN line: ' + l, file=sys.stderr) continue if not filecheck_cmd.startswith('FileCheck '): - print >>sys.stderr, 'WARNING: Skipping non-FileChecked RUN line: ' + l + print('WARNING: Skipping non-FileChecked RUN line: ' + l, file=sys.stderr) continue llc_cmd_args = llc_cmd[len('llc'):].strip() @@ -107,12 +109,12 @@ def main(): func_dict.update({prefix: dict()}) for prefixes, llc_args, triple_in_cmd in run_list: if args.verbose: - print >>sys.stderr, 'Extracted LLC cmd: llc ' + llc_args - print >>sys.stderr, 'Extracted FileCheck prefixes: ' + str(prefixes) + print('Extracted LLC cmd: llc ' + llc_args, file=sys.stderr) + print('Extracted FileCheck prefixes: ' + str(prefixes), file=sys.stderr) raw_tool_output = common.invoke_tool(args.llc_binary, llc_args, test) if not (triple_in_cmd or triple_in_ir): - print >>sys.stderr, "Cannot find a triple. Assume 'x86'" + print("Cannot find a triple. Assume 'x86'", file=sys.stderr) asm.build_function_body_dictionary_for_triple(args, raw_tool_output, triple_in_cmd or triple_in_ir or 'x86', prefixes, func_dict) @@ -122,7 +124,7 @@ def main(): func_name = None prefix_set = set([prefix for p in run_list for prefix in p[0]]) if args.verbose: - print >>sys.stderr, 'Rewriting FileCheck prefixes: %s' % (prefix_set,) + print('Rewriting FileCheck prefixes: %s' % (prefix_set,), file=sys.stderr) output_lines = [] output_lines.append(autogenerated_note) @@ -167,7 +169,7 @@ def main(): is_in_function = is_in_function_start = True if args.verbose: - print>>sys.stderr, 'Writing %d lines to %s...' % (len(output_lines), test) + print('Writing %d lines to %s...' % (len(output_lines), test), file=sys.stderr) with open(test, 'wb') as f: f.writelines([l + '\n' for l in output_lines]) |