[Mlir-commits] [mlir] [mlir][emitc] Add EmitC index types (PR #93155)

Corentin Ferry llvmlistbot at llvm.org
Mon May 27 23:41:45 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();
----------------
cferry-AMD wrote:

Great point. I keep worrying about the fact that `ssize_t` can only represent -1 where we'll need another type for `index`-type values below -1. How about using [`ptrdiff_t`](https://en.cppreference.com/w/c/types/ptrdiff_t)?

https://github.com/llvm/llvm-project/pull/93155


More information about the Mlir-commits mailing list