1# Interfaces
2
3MLIR is a generic and extensible framework, representing different dialects with
4their own attributes, operations, types, and so on. MLIR Dialects can express
5operations with a wide variety of semantics and different levels of abstraction.
6The downside to this is that MLIR transformations and analyses need to be able
7to account for the semantics of every operation, or be overly conservative.
8Without care, this can result in code with special-cases for each supported
9operation type. To combat this, MLIR provides a concept of `interfaces`.
10
11## Motivation
12
13Interfaces provide a generic way of interacting with the IR. The goal is to be
14able to express transformations/analyses in terms of these interfaces without
15encoding specific knowledge about the exact operation or dialect involved. This
16makes the compiler more easily extensible by allowing the addition of new
17dialects and operations in a decoupled way with respect to the implementation of
18transformations/analyses.
19
20### Dialect Interfaces
21
22Dialect interfaces are generally useful for transformation passes or analyses
23that want to operate generically on a set of attributes/operations/types, which
24may be defined in different dialects. These interfaces generally involve wide
25coverage over an entire dialect and are only used for a handful of analyses or
26transformations. In these cases, registering the interface directly on each
27operation is overly complex and cumbersome. The interface is not core to the
28operation, just to the specific transformation. An example of where this type of
29interface would be used is inlining. Inlining generally queries high-level
30information about the operations within a dialect, like cost modeling and
31legality, that often is not specific to one operation.
32
33A dialect interface can be defined by inheriting from the
34[CRTP](https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern) base
35class `DialectInterfaceBase::Base<>`. This class provides the necessary
36utilities for registering an interface with a dialect so that it can be
37referenced later. Once the interface has been defined, dialects can override it
38using dialect-specific information. The interfaces defined by a dialect are
39registered via `addInterfaces<>`, a similar mechanism to Attributes, Operations,
40Types, etc.
41
42```c++
43/// Define a base inlining interface class to allow for dialects to opt-in to
44/// the inliner.
45class DialectInlinerInterface :
46    public DialectInterface::Base<DialectInlinerInterface> {
47public:
48  /// Returns true if the given region 'src' can be inlined into the region
49  /// 'dest' that is attached to an operation registered to the current dialect.
50  /// 'valueMapping' contains any remapped values from within the 'src' region.
51  /// This can be used to examine what values will replace entry arguments into
52  /// the 'src' region, for example.
53  virtual bool isLegalToInline(Region *dest, Region *src,
54                               BlockAndValueMapping &valueMapping) const {
55    return false;
56  }
57};
58
59/// Override the inliner interface to add support for the AffineDialect to
60/// enable inlining affine operations.
61struct AffineInlinerInterface : public DialectInlinerInterface {
62  /// Affine structures have specific inlining constraints.
63  bool isLegalToInline(Region *dest, Region *src,
64                       BlockAndValueMapping &valueMapping) const final {
65    ...
66  }
67};
68
69/// Register the interface with the dialect.
70AffineDialect::AffineDialect(MLIRContext *context) ... {
71  addInterfaces<AffineInlinerInterface>();
72}
73```
74
75Once registered, these interfaces can be queried from the dialect by an analysis
76or transformation without the need to determine the specific dialect subclass:
77
78```c++
79Dialect *dialect = ...;
80if (DialectInlinerInterface *interface = dyn_cast<DialectInlinerInterface>(dialect)) {
81  // The dialect has provided an implementation of this interface.
82  ...
83}
84```
85
86#### DialectInterfaceCollection
87
88An additional utility is provided via `DialectInterfaceCollection`. This class
89allows collecting all of the dialects that have registered a given interface
90within an instance of the `MLIRContext`. This can be useful to hide and optimize
91the lookup of a registered dialect interface.
92
93```c++
94class InlinerInterface : public
95    DialectInterfaceCollection<DialectInlinerInterface> {
96  /// The hooks for this class mirror the hooks for the DialectInlinerInterface,
97  /// with default implementations that call the hook on the interface for a
98  /// given dialect.
99  virtual bool isLegalToInline(Region *dest, Region *src,
100                               BlockAndValueMapping &valueMapping) const {
101    auto *handler = getInterfaceFor(dest->getContainingOp());
102    return handler ? handler->isLegalToInline(dest, src, valueMapping) : false;
103  }
104};
105
106MLIRContext *ctx = ...;
107InlinerInterface interface(ctx);
108if(!interface.isLegalToInline(...))
109   ...
110```
111
112### Attribute/Operation/Type Interfaces
113
114Attribute/Operation/Type interfaces, as the names suggest, are those registered
115at the level of a specific attribute/operation/type. These interfaces provide
116access to derived objects by providing a virtual interface that must be
117implemented. As an example, many analyses and transformations want to reason
118about the side effects of an operation to improve performance and correctness.
119The side effects of an operation are generally tied to the semantics of a
120specific operation, for example an `affine.load` operation has a `read` effect
121(as the name may suggest).
122
123These interfaces are defined by overriding the
124[CRTP](https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern) class
125for the specific IR entity; `AttrInterface`, `OpInterface`, or `TypeInterface`
126respectively. These classes take, as a template parameter, a `Traits` class that
127defines a `Concept` and a `Model` class. These classes provide an implementation
128of concept-based polymorphism, where the `Concept` defines a set of virtual
129methods that are overridden by the `Model` that is templated on the concrete
130entity type. It is important to note that these classes should be pure, and
131should not contain non-static data members or other mutable data. To attach an
132interface to an object, the base interface classes provide a
133[`Trait`](Traits.md) class that can be appended to the trait list of that
134object.
135
136```c++
137struct ExampleOpInterfaceTraits {
138  /// Define a base concept class that specifies the virtual interface to be
139  /// implemented.
140  struct Concept {
141    virtual ~Concept();
142
143    /// This is an example of a non-static hook to an operation.
144    virtual unsigned exampleInterfaceHook(Operation *op) const = 0;
145
146    /// This is an example of a static hook to an operation. A static hook does
147    /// not require a concrete instance of the operation. The implementation is
148    /// a virtual hook, the same as the non-static case, because the
149    /// implementation of the hook itself still requires indirection.
150    virtual unsigned exampleStaticInterfaceHook() const = 0;
151  };
152
153  /// Define a model class that specializes a concept on a given operation type.
154  template <typename ConcreteOp>
155  struct Model : public Concept {
156    /// Override the method to dispatch on the concrete operation.
157    unsigned exampleInterfaceHook(Operation *op) const final {
158      return llvm::cast<ConcreteOp>(op).exampleInterfaceHook();
159    }
160
161    /// Override the static method to dispatch to the concrete operation type.
162    unsigned exampleStaticInterfaceHook() const final {
163      return ConcreteOp::exampleStaticInterfaceHook();
164    }
165  };
166};
167
168/// Define the main interface class that analyses and transformations will
169/// interface with.
170class ExampleOpInterface : public OpInterface<ExampleOpInterface,
171                                              ExampleOpInterfaceTraits> {
172public:
173  /// Inherit the base class constructor to support LLVM-style casting.
174  using OpInterface<ExampleOpInterface, ExampleOpInterfaceTraits>::OpInterface;
175
176  /// The interface dispatches to 'getImpl()', a method provided by the base
177  /// `OpInterface` class that returns an instance of the concept.
178  unsigned exampleInterfaceHook() const {
179    return getImpl()->exampleInterfaceHook(getOperation());
180  }
181  unsigned exampleStaticInterfaceHook() const {
182    return getImpl()->exampleStaticInterfaceHook(getOperation()->getName());
183  }
184};
185
186```
187
188Once the interface has been defined, it is registered to an operation by adding
189the provided trait `ExampleOpInterface::Trait` as described earlier. Using this
190interface is just like using any other derived operation type, i.e. casting:
191
192```c++
193/// When defining the operation, the interface is registered via the nested
194/// 'Trait' class provided by the 'OpInterface<>' base class.
195class MyOp : public Op<MyOp, ExampleOpInterface::Trait> {
196public:
197  /// The definition of the interface method on the derived operation.
198  unsigned exampleInterfaceHook() { return ...; }
199  static unsigned exampleStaticInterfaceHook() { return ...; }
200};
201
202/// Later, we can query if a specific operation(like 'MyOp') overrides the given
203/// interface.
204Operation *op = ...;
205if (ExampleOpInterface example = dyn_cast<ExampleOpInterface>(op))
206  llvm::errs() << "hook returned = " << example.exampleInterfaceHook() << "\n";
207```
208
209#### External Models for Attribute, Operation and Type Interfaces
210
211It may be desirable to provide an interface implementation for an IR object
212without modifying the definition of said object. Notably, this allows to
213implement interfaces for attributes, operations and types outside of the dialect
214that defines them, for example, to provide interfaces for built-in types.
215
216This is achieved by extending the concept-based polymorphism model with two more
217classes derived from `Concept` as follows.
218
219```c++
220struct ExampleTypeInterfaceTraits {
221  struct Concept {
222    virtual unsigned exampleInterfaceHook(Type type) const = 0;
223    virtual unsigned exampleStaticInterfaceHook() const = 0;
224  };
225
226  template <typename ConcreteType>
227  struct Model : public Concept { /*...*/ };
228
229  /// Unlike `Model`, `FallbackModel` passes the type object through to the
230  /// hook, making it accessible in the method body even if the method is not
231  /// defined in the class itself and thus has no `this` access. ODS
232  /// automatically generates this class for all interfaces.
233  template <typename ConcreteType>
234  struct FallbackModel : public Concept {
235    unsigned exampleInterfaceHook(Type type) const override {
236      getImpl()->exampleInterfaceHook(type);
237    }
238    unsigned exampleStaticInterfaceHook() const override {
239      ConcreteType::exampleStaticInterfaceHook();
240    }
241  };
242
243  /// `ExternalModel` provides a place for default implementations of interface
244  /// methods by explicitly separating the model class, which implements the
245  /// interface, from the type class, for which the interface is being
246  /// implemented. Default implementations can be then defined generically
247  /// making use of `cast<ConcreteType>`. If `ConcreteType` does not provide
248  /// the APIs required by the default implementation, custom implementations
249  /// may use `FallbackModel` directly to override the default implementation.
250  /// Being located in a class template, it never gets instantiated and does not
251  /// lead to compilation errors. ODS automatically generates this class and
252  /// places default method implementations in it.
253  template <typename ConcreteModel, typename ConcreteType>
254  struct ExternalModel : public FallbackModel<ConcreteModel> {
255    unsigned exampleInterfaceHook(Type type) const override {
256      // Default implementation can be provided here.
257      return type.cast<ConcreteType>().callSomeTypeSpecificMethod();
258    }
259  };
260};
261```
262
263External models can be provided for attribute, operation and type interfaces by
264deriving either `FallbackModel` or `ExternalModel` and by registering the model
265class with the relevant class in a given context. Other contexts will not see
266the interface unless registered.
267
268```c++
269/// External interface implementation for a concrete class. This does not
270/// require modifying the definition of the type class itself.
271struct ExternalModelExample
272    : public ExampleTypeInterface::ExternalModel<ExternalModelExample,
273                                                 IntegerType> {
274  static unsigned exampleStaticInterfaceHook() {
275    // Implementation is provided here.
276    return IntegerType::someStaticMethod();
277  }
278
279  // No need to define `exampleInterfaceHook` that has a default implementation
280  // in `ExternalModel`. But it can be overridden if desired.
281}
282
283int main() {
284  MLIRContext context;
285  /* ... */;
286
287  // Attach the interface model to the type in the given context before
288  // using it. The dialect containing the type is expected to have been loaded
289  // at this point.
290  IntegerType::attachInterface<ExternalModelExample>(context);
291}
292```
293
294Note: It is strongly encouraged to only use this mechanism if you "own" the
295interface being externally applied. This prevents a situation where neither the
296owner of the dialect containing the object nor the owner of the interface are
297aware of an interface implementation, which can lead to duplicate or
298diverging implementations.
299
300#### Dialect Fallback for OpInterface
301
302Some dialects have an open ecosystem and don't register all of the possible
303operations. In such cases it is still possible to provide support for
304implementing an `OpInterface` for these operation. When an operation isn't
305registered or does not provide an implementation for an interface, the query
306will fallback to the dialect itself.
307
308A second model is used for such cases and automatically generated when using ODS
309(see below) with the name `FallbackModel`. This model can be implemented for a
310particular dialect:
311
312```c++
313// This is the implementation of a dialect fallback for `ExampleOpInterface`.
314struct FallbackExampleOpInterface
315    : public ExampleOpInterface::FallbackModel<
316          FallbackExampleOpInterface> {
317  static bool classof(Operation *op) { return true; }
318
319  unsigned exampleInterfaceHook(Operation *op) const;
320  unsigned exampleStaticInterfaceHook() const;
321};
322```
323
324A dialect can then instantiate this implementation and returns it on specific
325operations by overriding the `getRegisteredInterfaceForOp` method :
326
327```c++
328void *TestDialect::getRegisteredInterfaceForOp(TypeID typeID,
329                                               StringAttr opName) {
330  if (typeID == TypeID::get<ExampleOpInterface>()) {
331    if (isSupported(opName))
332      return fallbackExampleOpInterface;
333    return nullptr;
334  }
335  return nullptr;
336}
337```
338
339#### Utilizing the ODS Framework
340
341Note: Before reading this section, the reader should have some familiarity with
342the concepts described in the
343[`Operation Definition Specification`](OpDefinitions.md) documentation.
344
345As detailed above, [Interfaces](#attributeoperationtype-interfaces) allow for
346attributes, operations, and types to expose method calls without requiring that
347the caller know the specific derived type. The downside to this infrastructure,
348is that it requires a bit of boiler plate to connect all of the pieces together.
349MLIR provides a mechanism with which to defines interfaces declaratively in ODS,
350and have the C++ definitions auto-generated.
351
352As an example, using the ODS framework would allow for defining the example
353interface above as:
354
355```tablegen
356def ExampleOpInterface : OpInterface<"ExampleOpInterface"> {
357  let description = [{
358    This is an example interface definition.
359  }];
360
361  let methods = [
362    InterfaceMethod<
363      "This is an example of a non-static hook to an operation.",
364      "unsigned", "exampleInterfaceHook"
365    >,
366    StaticInterfaceMethod<
367      "This is an example of a static hook to an operation.",
368      "unsigned", "exampleStaticInterfaceHook"
369    >,
370  ];
371}
372```
373
374Providing a definition of the `AttrInterface`, `OpInterface`, or `TypeInterface`
375class will auto-generate the C++ classes for the interface. Interfaces are
376comprised of the following components:
377
378*   C++ Class Name (Provided via template parameter)
379    -   The name of the C++ interface class.
380*   Description (`description`)
381    -   A string description of the interface, its invariants, example usages,
382        etc.
383*   C++ Namespace (`cppNamespace`)
384    -   The C++ namespace that the interface class should be generated in.
385*   Methods (`methods`)
386    -   The list of interface hook methods that are defined by the IR object.
387    -   The structure of these methods is defined below.
388*   Extra Class Declarations (Optional: `extraClassDeclaration`)
389    -   Additional C++ code that is generated in the declaration of the
390        interface class. This allows for defining methods and more on the user
391        facing interface class, that do not need to hook into the IR entity.
392        These declarations are _not_ implicitly visible in default
393        implementations of interface methods, but static declarations may be
394        accessed with full name qualification.
395*   Extra Shared Class Declarations (Optional: `extraSharedClassDeclaration`)
396    -   Additional C++ code that is injected into the declarations of both the
397        interface and the trait class. This allows for defining methods and more
398        that are exposed on both the interface and the trait class, e.g. to inject
399        utilties on both the interface and the derived entity implementing the
400        interface (e.g. attribute, operation, etc.).
401    -   In non-static methods, `$_attr`/`$_op`/`$_type`
402        (depending on the type of interface) may be used to refer to an
403        instance of the IR entity. In the interface declaration, the type of
404        the instance is the interface class. In the trait declaration, the
405        type of the instance is the concrete entity class
406        (e.g. `IntegerAttr`, `FuncOp`, etc.).
407
408`OpInterface` classes may additionally contain the following:
409
410*   Verifier (`verify`)
411    -   A C++ code block containing additional verification applied to the
412        operation that the interface is attached to.
413    -   The structure of this code block corresponds 1-1 with the structure of a
414        [`Trait::verifyTrait`](Traits.md) method.
415
416There are two types of methods that can be used with an interface,
417`InterfaceMethod` and `StaticInterfaceMethod`. They are both comprised of the
418same core components, with the distinction that `StaticInterfaceMethod` models a
419static method on the derived IR object.
420
421Interface methods are comprised of the following components:
422
423*   Description
424    -   A string description of this method, its invariants, example usages,
425        etc.
426*   ReturnType
427    -   A string corresponding to the C++ return type of the method.
428*   MethodName
429    -   A string corresponding to the C++ name of the method.
430*   Arguments (Optional)
431    -   A dag of strings that correspond to a C++ type and variable name
432        respectively.
433*   MethodBody (Optional)
434    -   An optional explicit implementation of the interface method.
435    -   This implementation is placed within the method defined on the `Model`
436        traits class, and is not defined by the `Trait` class that is attached
437        to the IR entity. More concretely, this body is only visible by the
438        interface class and does not affect the derived IR entity.
439    -   `ConcreteAttr`/`ConcreteOp`/`ConcreteType` is an implicitly defined
440        `typename` that can be used to refer to the type of the derived IR
441        entity currently being operated on.
442    -   In non-static methods, `$_op` and `$_self` may be used to refer to an
443        instance of the derived IR entity.
444*   DefaultImplementation (Optional)
445    -   An optional explicit default implementation of the interface method.
446    -   This implementation is placed within the `Trait` class that is attached
447        to the IR entity, and does not directly affect any of the interface
448        classes. As such, this method has the same characteristics as any other
449        [`Trait`](Traits.md) method.
450    -   `ConcreteAttr`/`ConcreteOp`/`ConcreteType` is an implicitly defined
451        `typename` that can be used to refer to the type of the derived IR
452        entity currently being operated on.
453    -   This may refer to static fields of the interface class using the
454        qualified name, e.g., `TestOpInterface::staticMethod()`.
455
456ODS also allows for generating declarations for the `InterfaceMethod`s of an
457operation if the operation specifies the interface with
458`DeclareOpInterfaceMethods` (see an example below).
459
460Examples:
461
462```tablegen
463def MyInterface : OpInterface<"MyInterface"> {
464  let description = [{
465    This is the description of the interface. It provides concrete information
466    on the semantics of the interface, and how it may be used by the compiler.
467  }];
468
469  let methods = [
470    InterfaceMethod<[{
471      This method represents a simple non-static interface method with no
472      inputs, and a void return type. This method is required to be implemented
473      by all operations implementing this interface. This method roughly
474      correlates to the following on an operation implementing this interface:
475
476      ```c++
477      class ConcreteOp ... {
478      public:
479        void nonStaticMethod();
480      };
481      ```
482    }], "void", "nonStaticMethod"
483    >,
484
485    InterfaceMethod<[{
486      This method represents a non-static interface method with a non-void
487      return value, as well as an `unsigned` input named `i`. This method is
488      required to be implemented by all operations implementing this interface.
489      This method roughly correlates to the following on an operation
490      implementing this interface:
491
492      ```c++
493      class ConcreteOp ... {
494      public:
495        Value nonStaticMethod(unsigned i);
496      };
497      ```
498    }], "Value", "nonStaticMethodWithParams", (ins "unsigned":$i)
499    >,
500
501    StaticInterfaceMethod<[{
502      This method represents a static interface method with no inputs, and a
503      void return type. This method is required to be implemented by all
504      operations implementing this interface. This method roughly correlates
505      to the following on an operation implementing this interface:
506
507      ```c++
508      class ConcreteOp ... {
509      public:
510        static void staticMethod();
511      };
512      ```
513    }], "void", "staticMethod"
514    >,
515
516    StaticInterfaceMethod<[{
517      This method corresponds to a static interface method that has an explicit
518      implementation of the method body. Given that the method body has been
519      explicitly implemented, this method should not be defined by the operation
520      implementing this method. This method merely takes advantage of properties
521      already available on the operation, in this case its `build` methods. This
522      method roughly correlates to the following on the interface `Model` class:
523
524      ```c++
525      struct InterfaceTraits {
526        /// ... The `Concept` class is elided here ...
527
528        template <typename ConcreteOp>
529        struct Model : public Concept {
530          Operation *create(OpBuilder &builder, Location loc) const override {
531            return builder.create<ConcreteOp>(loc);
532          }
533        }
534      };
535      ```
536
537      Note above how no modification is required for operations implementing an
538      interface with this method.
539    }],
540      "Operation *", "create", (ins "OpBuilder &":$builder, "Location":$loc),
541      /*methodBody=*/[{
542        return builder.create<ConcreteOp>(loc);
543    }]>,
544
545    InterfaceMethod<[{
546      This method represents a non-static method that has an explicit
547      implementation of the method body. Given that the method body has been
548      explicitly implemented, this method should not be defined by the operation
549      implementing this method. This method merely takes advantage of properties
550      already available on the operation, in this case its `build` methods. This
551      method roughly correlates to the following on the interface `Model` class:
552
553      ```c++
554      struct InterfaceTraits {
555        /// ... The `Concept` class is elided here ...
556
557        template <typename ConcreteOp>
558        struct Model : public Concept {
559          Operation *create(Operation *opaqueOp, OpBuilder &builder,
560                            Location loc) const override {
561            ConcreteOp op = cast<ConcreteOp>(opaqueOp);
562            return op.getNumInputs() + op.getNumOutputs();
563          }
564        }
565      };
566      ```
567
568      Note above how no modification is required for operations implementing an
569      interface with this method.
570    }],
571      "unsigned", "getNumInputsAndOutputs", (ins), /*methodBody=*/[{
572        return $_op.getNumInputs() + $_op.getNumOutputs();
573    }]>,
574
575    InterfaceMethod<[{
576      This method represents a non-static method that has a default
577      implementation of the method body. This means that the implementation
578      defined here will be placed in the trait class that is attached to every
579      operation that implements this interface. This has no effect on the
580      generated `Concept` and `Model` class. This method roughly correlates to
581      the following on the interface `Trait` class:
582
583      ```c++
584      template <typename ConcreteOp>
585      class MyTrait : public OpTrait::TraitBase<ConcreteType, MyTrait> {
586      public:
587        bool isSafeToTransform() {
588          ConcreteOp op = cast<ConcreteOp>(this->getOperation());
589          return op.getNumInputs() + op.getNumOutputs();
590        }
591      };
592      ```
593
594      As detailed in [Traits](Traits.md), given that each operation implementing
595      this interface will also add the interface trait, the methods on this
596      interface are inherited by the derived operation. This allows for
597      injecting a default implementation of this method into each operation that
598      implements this interface, without changing the interface class itself. If
599      an operation wants to override this default implementation, it merely
600      needs to implement the method and the derived implementation will be
601      picked up transparently by the interface class.
602
603      ```c++
604      class ConcreteOp ... {
605      public:
606        bool isSafeToTransform() {
607          // Here we can override the default implementation of the hook
608          // provided by the trait.
609        }
610      };
611      ```
612    }],
613      "bool", "isSafeToTransform", (ins), /*methodBody=*/[{}],
614      /*defaultImplementation=*/[{
615    }]>,
616  ];
617}
618
619// Operation interfaces can optionally be wrapped inside
620// `DeclareOpInterfaceMethods`. This would result in autogenerating declarations
621// for members `foo`, `bar` and `fooStatic`. Methods with bodies are not
622// declared inside the op declaration but instead handled by the op interface
623// trait directly.
624def OpWithInferTypeInterfaceOp : Op<...
625    [DeclareOpInterfaceMethods<MyInterface>]> { ... }
626
627// Methods that have a default implementation do not have declarations
628// generated. If an operation wishes to override the default behavior, it can
629// explicitly specify the method that it wishes to override. This will force
630// the generation of a declaration for those methods.
631def OpWithOverrideInferTypeInterfaceOp : Op<...
632    [DeclareOpInterfaceMethods<MyInterface, ["getNumWithDefault"]>]> { ... }
633```
634
635Note: Existing operation interfaces defined in C++ can be accessed in the ODS
636framework via the `OpInterfaceTrait` class.
637
638#### Operation Interface List
639
640MLIR includes standard interfaces providing functionality that is likely to be
641common across many different operations. Below is a list of some key interfaces
642that may be used directly by any dialect. The format of the header for each
643interface section goes as follows:
644
645*   `Interface class name`
646    -   (`C++ class` -- `ODS class`(if applicable))
647
648##### CallInterfaces
649
650*   `CallOpInterface` - Used to represent operations like 'call'
651    -   `CallInterfaceCallable getCallableForCallee()`
652*   `CallableOpInterface` - Used to represent the target callee of call.
653    -   `Region * getCallableRegion()`
654    -   `ArrayRef<Type> getCallableResults()`
655
656##### RegionKindInterfaces
657
658*   `RegionKindInterface` - Used to describe the abstract semantics of regions.
659    -   `RegionKind getRegionKind(unsigned index)` - Return the kind of the
660        region with the given index inside this operation.
661        -   RegionKind::Graph - represents a graph region without control flow
662            semantics
663        -   RegionKind::SSACFG - represents an
664            [SSA-style control flow](LangRef.md/#control-flow-and-ssacfg-regions) region
665            with basic blocks and reachability
666    -   `hasSSADominance(unsigned index)` - Return true if the region with the
667        given index inside this operation requires dominance.
668
669##### SymbolInterfaces
670
671*   `SymbolOpInterface` - Used to represent
672    [`Symbol`](SymbolsAndSymbolTables.md/#symbol) operations which reside
673    immediately within a region that defines a
674    [`SymbolTable`](SymbolsAndSymbolTables.md/#symbol-table).
675
676*   `SymbolUserOpInterface` - Used to represent operations that reference
677    [`Symbol`](SymbolsAndSymbolTables.md/#symbol) operations. This provides the
678    ability to perform safe and efficient verification of symbol uses, as well
679    as additional functionality.
680