Skip to content

Commit

Permalink
Hexagon (target/hexagon) Make generators object oriented - gen_tcg_funcs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
taylorsimpson authored and androm3da committed Jan 22, 2024
1 parent 421b53d commit b447807
Show file tree
Hide file tree
Showing 2 changed files with 683 additions and 547 deletions.

0 comments on commit b447807

Please sign in to comment.