[loco] Extend Node with dialect method (#3730)
author박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Tue, 11 Jun 2019 10:04:06 +0000 (19:04 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Tue, 11 Jun 2019 10:04:06 +0000 (19:04 +0900)
This commit extends Node with dialect method as a step toward
multi-dialect support.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
contrib/loco/include/loco/IR/Node.h

index a43af42..0dc809b 100644 (file)
@@ -20,6 +20,7 @@
 #include "loco/ADT/AnnotatedItem.h"
 
 #include "loco/IR/Use.h"
+#include "loco/IR/Dialect.h"
 
 #include <array>
 #include <memory>
@@ -62,6 +63,14 @@ public:
   virtual ~Node() = default;
 
 public:
+  /**
+   * @brief Return "Dialect" identifier that this node belongs to
+   *
+   * dialect() returns nullptr if there is no corresponding dialect.
+   */
+  virtual Dialect *dialect(void) const { return nullptr; }
+
+public:
   /// @brief Return the number of arguments
   virtual uint32_t arity(void) const = 0;