[Mlir-commits] [mlir] [mlir][emitc] Restrict integer and float types (PR #85788)

Marius Brehler llvmlistbot at llvm.org
Tue Mar 19 09:34:06 PDT 2024


================
@@ -54,6 +54,35 @@ void mlir::emitc::buildTerminatedBody(OpBuilder &builder, Location loc) {
   builder.create<emitc::YieldOp>(loc);
 }
 
+bool mlir::emitc::isValidEmitCIntegerType(Type type) {
+  if (auto intType = llvm::dyn_cast<IntegerType>(type)) {
+    switch (intType.getWidth()) {
+    case 1:
+    case 8:
+    case 16:
+    case 32:
+    case 64:
+      return true;
+    default:
+      return false;
+    }
+  }
+  return false;
+}
+
+bool mlir::emitc::isValidEmitCFloatType(Type type) {
----------------
marbre wrote:

```suggestion
bool mlir::emitc::isSupportedFloatType(Type type) {
```

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


More information about the Mlir-commits mailing list