1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

[NFC] Fix minor python issues.

* llvm-gisel-cov.py: extra `)` after print
* chunk-print-before-all.py: py2-only print method
This commit is contained in:
Jordan Rupprecht 2020-02-28 14:11:21 -08:00
parent 7622b45921
commit 00276e417e
2 changed files with 8 additions and 6 deletions

View File

@ -5,6 +5,8 @@
# "crashinfo.txt" file leaving only the valid input IR in the last chunk. # "crashinfo.txt" file leaving only the valid input IR in the last chunk.
# Files are written to current working directory. # Files are written to current working directory.
from __future__ import print_function
import sys import sys
basename = "chunk-" basename = "chunk-"
@ -15,7 +17,7 @@ def print_chunk(lines):
global basename global basename
fname = basename + str(chunk_id) + ".ll" fname = basename + str(chunk_id) + ".ll"
chunk_id = chunk_id + 1 chunk_id = chunk_id + 1
print "writing chunk " + fname + " (" + str(len(lines)) + " lines)" print("writing chunk " + fname + " (" + str(len(lines)) + " lines)")
with open(fname, "w") as f: with open(fname, "w") as f:
f.writelines(lines) f.writelines(lines)
@ -35,7 +37,7 @@ for line in sys.stdin:
cur.append(line) cur.append(line)
if is_dump: if is_dump:
print "writing crashinfo.txt (" + str(len(cur)) + " lines)" print("writing crashinfo.txt (" + str(len(cur)) + " lines)")
with open("crashinfo.txt", "w") as f: with open("crashinfo.txt", "w") as f:
f.writelines(cur) f.writelines(cur)
else: else:

View File

@ -15,11 +15,11 @@ class FileFormatError(Exception):
def backend_int_pair(s): def backend_int_pair(s):
backend, sep, value = s.partition('=') backend, sep, value = s.partition('=')
if (sep is None): if sep is None:
raise argparse.ArgumentTypeError("'=' missing, expected name=value") raise argparse.ArgumentTypeError("'=' missing, expected name=value")
if (not backend): if not backend:
raise argparse.ArgumentTypeError("Expected name=value") raise argparse.ArgumentTypeError("Expected name=value")
if (not value): if not value:
raise argparse.ArgumentTypeError("Expected name=value") raise argparse.ArgumentTypeError("Expected name=value")
return backend, int(value) return backend, int(value)
@ -60,7 +60,7 @@ def main():
num_rules = dict(args.num_rules) num_rules = dict(args.num_rules)
for backend, rules_for_backend in covered_rules.items(): for backend, rules_for_backend in covered_rules.items():
if backend in num_rules: if backend in num_rules:
print("%s: %3.2f%% of rules covered" % (backend, float(len(rules_for_backend)) / num_rules[backend]) * 100)) print("%s: %3.2f%% of rules covered" % (backend, float(len(rules_for_backend)) / num_rules[backend]) * 100)
else: else:
print("%s: %d rules covered" % (backend, len(rules_for_backend))) print("%s: %d rules covered" % (backend, len(rules_for_backend)))