Python compat - print statement

Make sure all print statements are compatible with Python 2 and Python3 using
the `from __future__ import print_function` statement.

Differential Revision: https://reviews.llvm.org/D56249

llvm-svn: 350307
diff --git a/llvm/utils/update_llc_test_checks.py b/llvm/utils/update_llc_test_checks.py
index 09b49a7..d85fed5 100755
--- a/llvm/utils/update_llc_test_checks.py
+++ b/llvm/utils/update_llc_test_checks.py
@@ -7,6 +7,8 @@
 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 @@
 
   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 @@
         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 @@
       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 @@
         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 @@
     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 @@
       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])