Gabe Black has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/49384 )
9 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the
submitted one.
Change subject: scons: Simplify the makeDebugFlagCC python function.
......................................................................
scons: Simplify the makeDebugFlagCC python function.
Change-Id: I3fdbdc5a4f2b45153550c65e0d447a3d6cec34f1
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49384
Maintainer: Gabe Black <[email protected]>
Tested-by: kokoro <[email protected]>
Reviewed-by: Hoa Nguyen <[email protected]>
---
M src/SConscript
1 file changed, 23 insertions(+), 37 deletions(-)
Approvals:
Hoa Nguyen: Looks good to me, approved
Gabe Black: Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/SConscript b/src/SConscript
index 932bed1..51c55f4 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -892,10 +892,6 @@
code = code_formatter()
- # delay definition of CompoundFlags until after all the definition
- # of all constituent SimpleFlags
- comp_code = code_formatter()
-
# file header
code('''
#include "base/compiler.hh" // For namespace deprecation
@@ -907,43 +903,33 @@
GEM5_DEPRECATED_NAMESPACE(Debug, debug);
namespace debug
{
-
''')
- for flag in sorted(env.get('DEBUG_FLAGS', [])):
- name, compound, desc, fmt = flag
+ all_flags = env.get('DEBUG_FLAGS', [])
+ simple_flags = sorted(filter(lambda f: not f[1], all_flags))
+ compound_flags = sorted(filter(lambda f: f[1], all_flags))
- # We intentionally make flag a reference to a heap allocated
object so
- # (1) It has a similar interface to a global object like before
- # (2) It does not get destructed at the end of simulation
- # The second property is desirable as global objects from different
- # translation units do not have a defined destruction order, so
it'll
- # be unsafe to access debug flags in their destructor in such
cases.
- if not compound:
- code('SimpleFlag& $name = *(')
- code.indent()
- if fmt:
- code('new SimpleFlag("$name", "$desc", true)')
- else:
- code('new SimpleFlag("$name", "$desc", false)')
- code.dedent()
- code(');')
- else:
- comp_code('CompoundFlag& $name = *(')
- comp_code.indent()
- comp_code('new CompoundFlag("$name", "$desc", {')
- comp_code.indent()
- for flag in compound:
- comp_code('&$flag,')
- comp_code.dedent()
- comp_code('})')
- comp_code.dedent()
- comp_code(');')
+ # We intentionally make flag a reference to a heap allocated object so
+ # (1) It has a similar interface to a global object like before
+ # (2) It does not get destructed at the end of simulation
+ # The second property is desirable as global objects from different
+ # translation units do not have a defined destruction order, so it'll
+ # be unsafe to access debug flags in their destructor in such cases.
+ for name, _, desc, fmt in simple_flags:
+ fmt = 'true' if fmt else 'false'
+ code('''
+SimpleFlag& $name = *(
+ new SimpleFlag("$name", "$desc", $fmt));''')
- code.append(comp_code)
- code()
- code('} // namespace debug')
- code('} // namespace gem5')
+ for name, compound, desc, _ in compound_flags:
+ code('''
+CompoundFlag& $name = *(new CompoundFlag("$name", "$desc", {
+ ${{', '.join('&' + flag for flag in compound)}}
+}));''')
+
+ code('''
+} // namespace debug
+} // namespace gem5''')
code.write(str(target[0]))
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/49384
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I3fdbdc5a4f2b45153550c65e0d447a3d6cec34f1
Gerrit-Change-Number: 49384
Gerrit-PatchSet: 11
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Hoa Nguyen <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s