]> git.proxmox.com Git - mirror_qemu.git/commit
Hexagon (target/hexagon) Make generators object oriented - gen_tcg_funcs
authorTaylor Simpson <ltaylorsimpson@gmail.com>
Sun, 10 Dec 2023 22:07:05 +0000 (15:07 -0700)
committerBrian Cain <bcain@quicinc.com>
Mon, 22 Jan 2024 06:01:59 +0000 (22:01 -0800)
commitb44780740d4a1b70ff45a6e4d923e29880ce3c0e
tree01e745aca7353b492c2b5909db7d84ae3a632bff
parent421b53d589e2a714b3f3175dddedda9755e83387
Hexagon (target/hexagon) Make generators object oriented - gen_tcg_funcs

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 hex_common.bad_register
  If a regtype/regid is missing, the lookup in hex_common.get_register
  will fail
- We can remove the functions in hex_common that use regtype/regid
  (e.g., is_read)

This patch creates the class hierarchy in hex_common and converts
gen_tcg_funcs.py.  The other scripts will be converted in subsequent
patches in this series.

Signed-off-by: Taylor Simpson <ltaylorsimpson@gmail.com>
Reviewed-by: Brian Cain <bcain@quicinc.com>
Message-Id: <20231210220712.491494-3-ltaylorsimpson@gmail.com>
Signed-off-by: Brian Cain <bcain@quicinc.com>
target/hexagon/gen_tcg_funcs.py
target/hexagon/hex_common.py