> On April 28, 2014, 11:38 p.m., Nilay Vaish wrote:
> > Is it possible write some preprocessing macro that generates both the
> > enum and the quoted strings?
>
> Andrew Bardsley wrote:
> It would be desirable to keep enums and string representations in sync
> that way, but it's more world-reorganisation than I feel this patch
> immediately demands.
>
> To make things a bit better I've changed the array into a switch
> statement so that the order of the enumeration elements no longer matters,
> removed flags will cause an error and added flags will at least fall back on
> printing their int representations.
>
> Ali Saidi wrote:
> I'd prefer to leave it as is, but just put a static_assert in the code
> that at least fails compilation if something is added in one but not both
> places.
>
> Andrew Bardsley wrote:
> To match the static_assert in arch/arm/faults.hh, presumably. Any
> thoughts, Nilay?
>
> Steve Reinhardt wrote:
> The python Enum class (in src/python/m5/params.py) does what you want, I
> think. See, for example, OpClass in src/cpu/FuncUnit.py, which generates
> build/*/enums/OpClass.{cc,hh}. This was originally designed to support enums
> being used as SimObject parameters, but there's no reason it has to be
> limited to that.
>
> Andrew Bardsley wrote:
> I've put the static_assert in as suggested. Using Enum would
> significantly complicate using StaticInst::Flags, not least because it
> changes the scoping of the enumeration elements (assuming that it's used
> without modification).
>
> Steve Reinhardt wrote:
> It would be nice if the python code had more flexibility to deal with
> different scopes, but it seems like you could get around the issue with a
> 'using' declaration, right?
>
Actually a typedef would probably make more sense... define the enum as
StaticInstFlags, then inside StaticInst put:
typedef Enums::StaticInstFlags Flags;
- Steve
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviews.gem5.org/r/2254/#review5042
-----------------------------------------------------------
On April 29, 2014, 9:47 a.m., Andreas Hansson wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviews.gem5.org/r/2254/
> -----------------------------------------------------------
>
> (Updated April 29, 2014, 9:47 a.m.)
>
>
> Review request for Default.
>
>
> Repository: gem5
>
>
> Description
> -------
>
> Changeset 10204:1eaca056de71
> ---------------------------
> 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
>
>
> Diffs
> -----
>
> src/cpu/static_inst.hh e40b35147270
> src/cpu/static_inst.cc e40b35147270
>
> Diff: http://reviews.gem5.org/r/2254/diff/
>
>
> Testing
> -------
>
>
> Thanks,
>
> Andreas Hansson
>
>
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev