llvm / clangir

A new (MLIR based) high-level IR for clang.
https://clangir.org
Other
351 stars 95 forks source link

[CIR][CIRGen][LowerToLLVM] Add address space attribute for pointer type #606

Closed seven-mile closed 4 months ago

seven-mile commented 4 months ago

This is the prelude of address space support. Linked issue: #418 .

I want to solve it by these steps:

  1. This PR, add the attribute and implement asm format & type conversion.
  2. Enable the feature flag of address space, but break it into several other flags. And re-categorize / fix occurrences in the codebase. There is already a draft commit for this part. PR coming soon.
    • The proposed new feature flags are: addressSpaceCasting and (existing) addressSpaceInGlobalVar
  3. Implement clang::CK_AddressSpaceConversion as a new kind of cir.cast. Also fix the corresponding occurrences.
  4. Make ops like cir.global and cir.get_global aware of address space, and solve the latter flag.
  5. Relax the restriction of default alloca address space. Then we can use correct address spaces for languages like OpenCL in future.

Revert to this PR itself, which includes: