> On 2011-06-08 22:52:15, Gabe Black wrote:
> > I think you missed some (maybe just one) version of PC state defined in the 
> > ISAs themselves. ARM may be the only one, but you should double check to be 
> > sure. Also, for all these you could define them using ==, something like 
> > return !(*this == opc);
> 
> Korey Sewell wrote:
>     The "!(*this == opc)" is interesting. If you do it that way, it's 
> definitely more programmable for the long term since one change to the equals 
> operator definition will propagate. But, is that way adding two extra 
> operations there? 1 to dereference the this pointer and then another to do 
> the NOT operation? The "==" operator is the more used operator but if for 
> some reason the "!=" operator become popular within gem5 wouldnt it be 
> slightly slower?
> 
> Steve Reinhardt wrote:
>     I think defining != in terms of == is much preferred for the reasons you 
> said.  The compiler should inline the == definition into != where 
> appropriate, so the performance difference for optimized code should be 
> somewhere between non-existent and negligible, and certainly worthwhile given 
> how much simpler and more robust the code will be.  You should just be able 
> to define it once on the base class too which will simplify things even more.
> 
> Gabe Black wrote:
>     Be really careful just defining it in the base class. It's not virtual as 
> far as I remember, and generally speaking the subclasses add extra things to 
> check. You could end up using the base class version and not checking 
> everything, but it would frequently be right and could slip by pretty easily. 
> I'm not saying it won't work, just be very careful and verify it's doing 
> exactly what you think it is in all the ISAs one by one.

You're right, it doesn't work to just define it in the base class since the 
other functions are not virtual.  So forget my comment on that one, you will 
have to define it in each class where == is defined.  Defining != in terms of 
== is still the way to go though.


- Steve


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviews.m5sim.org/r/738/#review1303
-----------------------------------------------------------


On 2011-06-08 22:46:05, Korey Sewell wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviews.m5sim.org/r/738/
> -----------------------------------------------------------
> 
> (Updated 2011-06-08 22:46:05)
> 
> 
> Review request for Default, Ali Saidi, Gabe Black, Steve Reinhardt, and 
> Nathan Binkert.
> 
> 
> Summary
> -------
> 
> cpus/isa: add a != operator for pcstate
> 
> 
> Diffs
> -----
> 
>   src/arch/generic/types.hh 77d12d8f7971 
> 
> Diff: http://reviews.m5sim.org/r/738/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Korey
> 
>

_______________________________________________
gem5-dev mailing list
gem5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to