[Mlir-commits] [mlir] [mlir] Create an accessor for the operation name in `OperationState` (PR #82489)

Fabian Mora llvmlistbot at llvm.org
Wed Feb 21 04:55:39 PST 2024


https://github.com/fabianmcg created https://github.com/llvm/llvm-project/pull/82489

This accessor provides helpful introspection when building an operation. For example, it allows access to the dialect used to create the operation, which might provide extra context for building an operation.

>From 25c8b988280d1a39963afe3d291970885aa96b49 Mon Sep 17 00:00:00 2001
From: Fabian Mora <fmora.dev at gmail.com>
Date: Wed, 21 Feb 2024 12:45:27 +0000
Subject: [PATCH] [mlir] Create an accessor for the operation name in
 `OperationState`

This accessor provides helpful introspection when building an operation. For
example, it allows access to the dialect used to create the operation, which
might provide extra context for building an operation.
---
 mlir/include/mlir/IR/OperationSupport.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mlir/include/mlir/IR/OperationSupport.h b/mlir/include/mlir/IR/OperationSupport.h
index f2aa6cee840308..3bde71bd3938fa 100644
--- a/mlir/include/mlir/IR/OperationSupport.h
+++ b/mlir/include/mlir/IR/OperationSupport.h
@@ -1058,6 +1058,9 @@ struct OperationState {
 
   /// Get the context held by this operation state.
   MLIRContext *getContext() const { return location->getContext(); }
+
+  /// Get the operation name held by this operation state.
+  OperationName getOperationName() const { return name; }
 };
 
 //===----------------------------------------------------------------------===//



More information about the Mlir-commits mailing list