1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[MachineScheduler] Add itinerary to schedcover.py. Make default work in the command line filter

Summary:
This patch adds itinerary support to the schedcover.py script. I've been trying to use this script to figure out why SSE and AVX instructions are ending up in separate tablegen scheduler classes and sometimes its because we are using different itineraries.

Rather than using None to indicate the default scheduler model, I now use the string "default". I had to hack around the sorting a little to keep "default" at the beginning. But this also makes it so you can specify "default" on the command line to just get the defaults

I also fixed the regular expression code so that the no_default wasn't evaluated twice.

Reviewers: RKSimon, atrick, jmolloy, javed.absar

Reviewed By: javed.absar

Subscribers: llvm-commits

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

llvm-svn: 328608
This commit is contained in:
Craig Topper 2018-03-27 04:26:39 +00:00
parent b836fe81fc
commit 069a428012

View File

@ -31,20 +31,26 @@ def filter_model(m):
def display(): def display():
global table, models global table, models
# remove default and itinerary so we can control their sort order to make
# them first
models.discard("default")
models.discard("itinerary")
ordered_table = sorted(table.items(), key=operator.itemgetter(0)) ordered_table = sorted(table.items(), key=operator.itemgetter(0))
ordered_models = filter(filter_model, sorted(models)) ordered_models = ["itinerary", "default"]
ordered_models.extend(sorted(models))
ordered_models = filter(filter_model, ordered_models)
# print header # print header
sys.stdout.write("instruction") sys.stdout.write("instruction")
for model in ordered_models: for model in ordered_models:
if not model: model = "default"
sys.stdout.write(", {}".format(model)) sys.stdout.write(", {}".format(model))
sys.stdout.write(os.linesep) sys.stdout.write(os.linesep)
for (instr, mapping) in ordered_table: for (instr, mapping) in ordered_table:
sys.stdout.write(instr) sys.stdout.write(instr)
for model in ordered_models: for model in ordered_models:
if model in mapping: if model in mapping and mapping[model] is not None:
sys.stdout.write(", {}".format(mapping[model])) sys.stdout.write(", {}".format(mapping[model]))
else: else:
sys.stdout.write(", ") sys.stdout.write(", ")
@ -57,18 +63,21 @@ def machineModelCover(path):
re_sched_no_default = re.compile("No machine model for ([^ ]*)\n"); re_sched_no_default = re.compile("No machine model for ([^ ]*)\n");
re_sched_spec = re.compile("InstRW on ([^ ]*) for ([^ ]*) (.*)\n"); re_sched_spec = re.compile("InstRW on ([^ ]*) for ([^ ]*) (.*)\n");
re_sched_no_spec = re.compile("No machine model for ([^ ]*) on processor (.*)\n"); re_sched_no_spec = re.compile("No machine model for ([^ ]*) on processor (.*)\n");
re_sched_itin = re.compile("Itinerary for ([^ ]*): ([^ ]*)\n")
# scan the file # scan the file
with open(path, 'r') as f: with open(path, 'r') as f:
for line in f.readlines(): for line in f.readlines():
match = re_sched_default.match(line) match = re_sched_default.match(line)
if match: add(match.group(1), None, match.group(2)) if match: add(match.group(1), "default", match.group(2))
match = re_sched_no_default.match(line) match = re_sched_no_default.match(line)
if match: add(match.group(1), None) if match: add(match.group(1), "default")
match = re_sched_spec.match(line) match = re_sched_spec.match(line)
if match: add(match.group(2), match.group(1), match.group(3)) if match: add(match.group(2), match.group(1), match.group(3))
match = re_sched_no_default.match(line) match = re_sched_no_spec.match(line)
if match: add(match.group(1), None) if match: add(match.group(1), match.group(2))
match = re_sched_itin.match(line)
if match: add(match.group(1), "itinerary", match.group(2))
display() display()