================
@@ -379,8 +379,11 @@ static mlir::Type abiTypeToCIR(const llvm::abi::Type *ty,
MLIRContext *ctx) {
.Case([&](const llvm::abi::FloatType *fltTy) {
return cir::getFloatingPointType(*fltTy->getSemantics(), ctx);
})
- .Case([&](const llvm::abi::PointerType *) {
- return cir::PointerType::get(cir::VoidType::get(ctx));
+ .Case([&](const llvm::abi::PointerType *ptrTy) {
+ mlir::ptr::MemorySpaceAttrInterface addrSpace;
+ if (unsigned as = ptrTy->getAddrSpace())
+ addrSpace = cir::TargetAddressSpaceAttr::get(ctx, as);
+ return cir::PointerType::get(cir::VoidType::get(ctx), addrSpace);
----------------
steffenlarsen wrote:
You're right. I was looking at the wrong interfaces. Maybe it would be slightly
more appropriate to use an implementation similar to
`CIRBaseBuilderTy::getPointerTo`:
```suggestion
clang::LangAS as = ptrTy->getAddrSpace();
if (langAS == clang::LangAS::Default)
return cir::PointerType::get(ty);
return cir::PointerType::get(cir::VoidType::get(ctx),
cir::TargetAddressSpaceAttr::get(ctx, as));
```
https://github.com/llvm/llvm-project/pull/220197
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits