[Mlir-commits] [mlir] [mlir][emitc] Add EmitC index types (PR #93155)
Matthias Gehre
llvmlistbot at llvm.org
Mon May 27 23:48:20 PDT 2024
================
@@ -1570,6 +1570,10 @@ LogicalResult CppEmitter::emitType(Location loc, Type type) {
}
if (auto iType = dyn_cast<IndexType>(type))
return (os << "size_t"), success();
+ if (auto sType = dyn_cast<emitc::SizeTType>(type))
+ return (os << "size_t"), success();
+ if (auto sType = dyn_cast<emitc::SignedSizeTType>(type))
+ return (os << "ssize_t"), success();
----------------
mgehre-amd wrote:
Hm, this is my fault, I though `ssize_t` was standardized. How important is that to you?
We use `ssize_t` in lowerings that need to interpret `index` as `signed` (like `index.divs`).
Just brainstorming, we could emit this as `intmax_t`, `ptrdiff_t` (C) or `std::make_signed<std::size_t>` (C++11).
([cppreference says](https://en.cppreference.com/w/cpp/types/ptrdiff_t): `For char arrays shorter than PTRDIFF_MAX, std::ptrdiff_t acts as the signed counterpart of std::size_t`)
https://github.com/llvm/llvm-project/pull/93155
More information about the Mlir-commits
mailing list