MLIR 22.0.0git
Unit.h
Go to the documentation of this file.
1//===- Unit.h - IR Unit definition--------------------*- C++ -*-=============//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef MLIR_IR_UNIT_H
10#define MLIR_IR_UNIT_H
11
13#include "llvm/ADT/PointerUnion.h"
14#include "llvm/Support/raw_ostream.h"
15
16namespace llvm {
17class raw_ostream;
18} // namespace llvm
19namespace mlir {
20class Operation;
21class Region;
22class Block;
23class Value;
24
25/// IRUnit is a union of the different types of IR objects that constitute the
26/// IR structure (other than Type and Attribute), that is Operation, Region, and
27/// Block.
28class IRUnit : public PointerUnion<Operation *, Region *, Block *, Value> {
29public:
30 using PointerUnion::PointerUnion;
31
32 /// Print the IRUnit to the given stream.
33 void print(raw_ostream &os,
34 OpPrintingFlags flags =
35 OpPrintingFlags().skipRegions().useLocalScope()) const;
36};
37
39
40} // end namespace mlir
41
42namespace llvm {
43
44// Allow llvm::cast style functions.
45template <typename To>
46struct CastInfo<To, mlir::IRUnit>
47 : public CastInfo<To, mlir::IRUnit::PointerUnion> {};
48
49template <typename To>
50struct CastInfo<To, const mlir::IRUnit>
51 : public CastInfo<To, const mlir::IRUnit::PointerUnion> {};
52
53} // namespace llvm
54
55#endif // MLIR_IR_UNIT_H
Block represents an ordered list of Operations.
Definition Block.h:33
IRUnit is a union of the different types of IR objects that constitute the IR structure (other than T...
Definition Unit.h:28
void print(raw_ostream &os, OpPrintingFlags flags=OpPrintingFlags().skipRegions().useLocalScope()) const
Print the IRUnit to the given stream.
Definition Unit.cpp:49
Set of flags used to control the behavior of the various IR print methods (e.g.
Operation is the basic unit of execution within MLIR.
Definition Operation.h:88
This class contains a list of basic blocks and a link to the parent operation it is attached to.
Definition Region.h:26
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
Definition Value.h:96
The OpAsmOpInterface, see OpAsmInterface.td for more details.
Definition CallGraph.h:229
Include the generated interface declarations.
raw_ostream & operator<<(raw_ostream &os, const AliasResult &result)