cpu: Add flag name printing to StaticInst
Review Request #2254 - Created April 23, 2014 and submitted
| Information | |
|---|---|
| Andreas Hansson | |
| gem5 | |
| default | |
| Reviewers | |
| Default | |
Changeset 10204:b2e59be375f0 --------------------------- cpu: Add flag name printing to StaticInst This patch adds a the member function StaticInst::printFlags to allow all of an instruction's flags to be printed without using the individual is... member functions or resorting to exposing the 'flags' vector It also replaces the enum definition StaticInst::Flags with a Python-generated enumeration and adds to the enum generation mechanism in src/python/m5/params.py to allow Enums to be placed in namespaces other than Enums or, alternatively, in wrapper structs allowing them to be inherited by other classes (so populating that class's name-space with the enumeration element names).
Is it possible write some preprocessing macro that generates both the enum and the quoted strings?
Description: |
|
||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 2 (+161) |
Summary: |
|
|||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: |
|
|||||||||||||||||||||||||||
Diff: |
Revision 3 (+70) |
Summary: |
|
|||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: |
|
|||||||||||||||||||||||||||
Diff: |
Revision 4 (+70) |
Description: |
|
|||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 5 (+187 -104) |
Ship It!
Thanks! Interesting idea to generate a class and then derive from it. Looks reasonable to me. The comment called out below got me to wondering though... why did it already talk about wrapping the enum in a class/struct when the code was using a namespace? I tracked the change down to this massive changeset of Nate's: http://repo.gem5.org/gem5/rev/c94e103c83ad which---without explanation---changed the original code, which used a struct: http://repo.gem5.org/gem5/annotate/9f5df8033a44/src/python/m5/params.py#l569 to this namespace-based code: http://repo.gem5.org/gem5/annotate/c94e103c83ad/src/python/m5/params.py#l652 So why was the change made? Nate? What was wrong with using structs to begin with? Should we just go back to always using structs? If we did, it would simplify the changes you had to make. I'd be happy to play around with this a little myself, though sadly that won't happen all that soon...
-
src/python/m5/params.py (Diff revision 5) -
note the comment here
Description: |
|
|||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 6 (+188 -105) |
