Skip to content

[CIR] Refactor AddressSpace to use enum more thoroughly instead of attribute #1733

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

Merged
merged 1 commit into from
Jul 7, 2025

Conversation

xlauko
Copy link
Collaborator

@xlauko xlauko commented Jul 4, 2025

  • Remove redundant custom printer and parser for AddressSpace, relying instead on MLIR's default EnumAttr handling.
  • Leverage AddressSpace::Default to omit the attribute from the assembly form when not needed. Therefore, an empty attribute is no longer needed to represent the default address space.
  • Update PointerType to use the AddressSpace enum directly, instead of a boxed attribute.

@xlauko xlauko marked this pull request as ready for review July 4, 2025 20:03
@xlauko
Copy link
Collaborator Author

xlauko commented Jul 4, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

…tribute

- Remove redundant custom printer and parser for AddressSpace, relying instead on MLIR's default EnumAttr handling.
- Leverage AddressSpace::Default to omit the attribute from the assembly form when not needed. Therefore, an empty attribute is no longer needed to represent the default address space.
- Update PointerType to use the AddressSpace enum directly, instead of a boxed attribute.
@xlauko xlauko force-pushed the users/xlauko/cir-addrspace-attr branch from 6198709 to a695d3e Compare July 4, 2025 21:08
Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

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

Nice!

@xlauko xlauko merged commit b7dffc3 into main Jul 7, 2025
8 of 9 checks passed
xlauko added a commit to llvm/llvm-project that referenced this pull request Jul 15, 2025
xlauko added a commit to llvm/llvm-project that referenced this pull request Jul 15, 2025
xlauko added a commit to llvm/llvm-project that referenced this pull request Jul 15, 2025
…rest of attributes (#148850)

This change allows enum definition classes to be included in type definitions without creating cyclic dependencies between CIRTypes.td and CIRAttrs.td, since attributes already include CIRTypes.td. In the pull request mentioned below, this is used to define the AddressSpace enum alongside PointerType.

Additionally, this introduces `DefaultValuedEnumParameter`.

This mirrors some parts of incubator change from llvm/clangir#1733
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Jul 15, 2025
…ithout the rest of attributes (#148850)

This change allows enum definition classes to be included in type definitions without creating cyclic dependencies between CIRTypes.td and CIRAttrs.td, since attributes already include CIRTypes.td. In the pull request mentioned below, this is used to define the AddressSpace enum alongside PointerType.

Additionally, this introduces `DefaultValuedEnumParameter`.

This mirrors some parts of incubator change from llvm/clangir#1733
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants