qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH] Hexagon (target/hexagon) Make generators object oriented


From: Matheus Tavares Bernardino
Subject: Re: [RFC PATCH] Hexagon (target/hexagon) Make generators object oriented
Date: Fri, 10 Nov 2023 09:12:42 -0300

Taylor Simpson <ltaylorsimpson@gmail.com> wrote:
>
> RFC - This patch handles gen_tcg_funcs.py.  I'd like to get comments
> on the general approach before working on the other Python scripts.
> 
> The generators are generally a bunch of Python if-then-else
> statements based on the regtype and regid.  Encapsulate regtype/regid
> into a class hierarchy.  Clients lookup the register and invoke
> methods.
> 
> This has several advantages for making the code easier to read,
> understand, and maintain
> - The class name makes it more clear what the operand does
> - All the methods for a given type of operand are together
> - Don't need as many calls to hex_common.bad_register
> - We can remove the functions in hex_common that use regtype/regid
>   (e.g., is_read)
> 
> Signed-off-by: Taylor Simpson <ltaylorsimpson@gmail.com>

Really nice! I personally think it's a great separation and it improves
the code readability.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]