Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jpinot
Copy link
Member

@jpinot jpinot commented Oct 30, 2024

Lower StringConstantOp to hw::ConstantOp. Encodes strings as APInt with byte-width based on string length, enabling representation of Moore string constant as bit vectors.

@jpinot jpinot changed the title Draft: [MooreToCore] Add support for moore::string_constant #7628 [MooreToCore] Add support for moore::string_constant #7628 Oct 30, 2024
Comment on lines 875 to 878
// CHECK: hw.constant 1415934836
%str = moore.string_constant "Test" : i2
// CHECK: hw.constant 0
%str_empty = moore.string_constant "" : i128
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add the : i2 and : i128 type suffices to the CHECK lines, to make sure the conversion does the right thing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Corrected types as mentioned above and added type suffixes to the CHECK lines.

@jpinot jpinot force-pushed the 7628-support-string-constants branch from 52e413f to 19a4bfa Compare November 4, 2024 14:33
Copy link
Contributor

@fabianschuiki fabianschuiki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM besides a minor nit on the hw.constant return type 👍 Thanks a lot for doing this work!

Lower string constant ops to constant op in the hw dialect.
@jpinot jpinot force-pushed the 7628-support-string-constants branch from 19a4bfa to 6e5adeb Compare November 5, 2024 08:22
@fabianschuiki
Copy link
Contributor

Really nice! @jpinot If you want, feel free to get commit access to CIRCT to merge the PR yourself, or let me know if I should land it for you.

Copy link
Member

@terapines-osc-circt terapines-osc-circt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 💯

@jpinot jpinot merged commit 52e924b into llvm:main Nov 6, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants