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

[CIR][CIRGen][LowerToLLVM] Support address space casting #652

Merged
merged 14 commits into from
Jun 6, 2024

Conversation

seven-mile
Copy link
Collaborator

  • New CastKind::addrspace_cast for cir.cast
  • TargetCIRGenInfo::performAddrSpaceCast helper for non-constant values only
  • CIRGen for address space casting of pointers and references
  • Lowering to LLVM

@seven-mile
Copy link
Collaborator Author

seven-mile commented Jun 2, 2024

Note that other versions of TargetCIRGenInfo::performAddrSpaceCast should include GlobalOp and ConstOp, which are unified as llvm::Constant in LLVM IR. Should track it by another issue.

clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp Show resolved Hide resolved
clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp Show resolved Hide resolved
clang/lib/CIR/CodeGen/CIRGenExpr.cpp Outdated Show resolved Hide resolved
clang/lib/CIR/Dialect/IR/CIRDialect.cpp Outdated Show resolved Hide resolved
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.

Overall looks good, more inline comments!

clang/include/clang/CIR/Dialect/IR/CIROps.td Outdated Show resolved Hide resolved
clang/test/CIR/IR/cast.cir Outdated Show resolved Hide resolved
clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp Show resolved Hide resolved
clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp Show resolved Hide resolved
clang/lib/CIR/Dialect/IR/CIRDialect.cpp Outdated Show resolved Hide resolved
@seven-mile
Copy link
Collaborator Author

Rebased. Updated except ABI-related nullptr representation.

@seven-mile
Copy link
Collaborator Author

Updated as suggested.

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.

Awesome, LGTM

@bcardosolopes bcardosolopes merged commit 5b44dd7 into llvm:main Jun 6, 2024
6 checks passed
bcardosolopes pushed a commit that referenced this pull request Jun 12, 2024
Continue the work of #652 . Test the branch of null pointer expressions
with side effects.
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.

4 participants