Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code gen category enum for operator #1

Open
eopXD opened this issue Oct 13, 2023 · 0 comments
Open

Add code gen category enum for operator #1

eopXD opened this issue Oct 13, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@eopXD
Copy link
Contributor

eopXD commented Oct 13, 2023

Currently under Operator.cpp code gen for different operations are done by a bunch of branching statements, and the branching statements are based on the OP_ID of the operations (e.g. _vv, _vx, or even specialized for a certain operator if (op->opType == "msbf_m")).

This is rather troublesome and bugs may hide inside type-o of these statements.

A better implementation would be have enums that represents categories of these code gen and appending the enun as a parameter inside the definition file of the operator.

Moreover, if the operator already contains codegen category enum, then the function generateOperatorCode can be template-ized.

template<enum CodeGenType>
void generateOperatorCode() { /* ... */ }

This issue can be solved by:

  1. build a chart mapping operators to specific code gen pattern
  2. adjust generation of definition file
  3. rewrite code under Operator.cpp to utilize the appended information
@eopXD eopXD added the enhancement New feature or request label Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant