> On April 29, 2014, 6:38 a.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.
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).
- Andrew
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviews.gem5.org/r/2254/#review5042
-----------------------------------------------------------
On April 29, 2014, 4:35 p.m., Andreas Hansson wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviews.gem5.org/r/2254/
> -----------------------------------------------------------
>
> (Updated April 29, 2014, 4:35 p.m.)
>
>
> Review request for Default.
>
>
> Repository: gem5
>
>
> Description
> -------
>
> Changeset 10204:bdc2c87147ee
> ---------------------------
> imported patch static_inst_print_flags.patch
>
>
> 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