misc: Generate StateMachine debug includes in deterministic order

Since 3454a4a36e the order of the debug/
includes is non-deterministic which can result in unnecessary rebuilds.

Change-Id: I583d2caf70632e08fa59ac85073786270991edbc
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54983
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Alex Richardson
2021-12-29 13:16:40 +00:00
parent 1f155ffd90
commit 5ac54aab7e

View File

@@ -105,6 +105,8 @@ class StateMachine(Symbol):
self.objects = []
self.TBEType = None
self.EntryType = None
# Python's sets are not sorted so we have to be careful when using
# this to generate deterministic output.
self.debug_flags = set()
self.debug_flags.add('RubyGenerated')
self.debug_flags.add('RubySlicc')
@@ -516,8 +518,9 @@ void unset_tbe(${{self.TBEType.c_ident}}*& m_tbe_ptr);
code(boolvec_include)
code(base_include)
for f in self.debug_flags:
# We have to sort self.debug_flags in order to produce deterministic
# output and avoid unnecessary rebuilds of the generated files.
for f in sorted(self.debug_flags):
code('#include "debug/${{f}}.hh"')
code('''
#include "mem/ruby/network/Network.hh"
@@ -1246,7 +1249,9 @@ $c_ident::functionalReadBuffers(PacketPtr& pkt, WriteMask &mask)
#include "base/logging.hh"
''')
for f in self.debug_flags:
# We have to sort self.debug_flags in order to produce deterministic
# output and avoid unnecessary rebuilds of the generated files.
for f in sorted(self.debug_flags):
code('#include "debug/${{f}}.hh"')
code('''
#include "mem/ruby/protocol/${ident}_Controller.hh"