[llvm-branch-commits] [clang] [CIR] Propagate MemorySpaceAttrInterface for Lang and Target specific AS attributes (PR #179073)
Konstantinos Parasyris via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Feb 1 19:59:58 PST 2026
================
@@ -1043,55 +1057,42 @@ void printAddressSpaceValue(mlir::AsmPrinter &p,
llvm_unreachable("unexpected address-space attribute kind");
}
-cir::TargetAddressSpaceAttr
-cir::toCIRTargetAddressSpace(mlir::MLIRContext &context, clang::LangAS langAS) {
- return cir::TargetAddressSpaceAttr::get(
- &context,
- IntegerAttr::get(&context,
- llvm::APSInt(clang::toTargetAddressSpace(langAS))));
-}
+mlir::ptr::MemorySpaceAttrInterface
+cir::toCIRAddressSpaceAttr(mlir::MLIRContext *ctx, clang::LangAS langAS) {
+ using clang::LangAS;
-bool cir::isMatchingAddressSpace(cir::TargetAddressSpaceAttr cirAS,
- clang::LangAS as) {
- // If there is no CIR target attr, consider it "default" and only match
- // when the AST address space is LangAS::Default.
- if (!cirAS)
- return as == clang::LangAS::Default;
+ if (langAS == LangAS::Default)
+ return {}; // Default address space is represented as an empty attribute.
----------------
koparasy wrote:
Opinion: I would prefer not having "default = empty", but follow some fixed value. I don't know how that would translate to the rest of the implementation.
https://github.com/llvm/llvm-project/pull/179073
More information about the llvm-branch-commits
mailing list