MLIR  20.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 
16 namespace llvm {
17 class raw_ostream;
18 } // namespace llvm
19 namespace mlir {
20 class Operation;
21 class Region;
22 class Block;
23 class Value;
24 
25 /// IRUnit is a union of the different types of IR objects that consistute the
26 /// IR structure (other than Type and Attribute), that is Operation, Region, and
27 /// Block.
28 class IRUnit : public PointerUnion<Operation *, Region *, Block *, Value> {
29 public:
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 
38 raw_ostream &operator<<(raw_ostream &os, const IRUnit &unit);
39 
40 } // end namespace mlir
41 
42 namespace llvm {
43 
44 // Allow llvm::cast style functions.
45 template <typename To>
46 struct CastInfo<To, mlir::IRUnit>
47  : public CastInfo<To, mlir::IRUnit::PointerUnion> {};
48 
49 template <typename To>
50 struct CastInfo<To, const mlir::IRUnit>
51  : public CastInfo<To, const mlir::IRUnit::PointerUnion> {};
52 
53 } // namespace llvm
54 
55 #endif // MLIR_IR_UNIT_H
IRUnit is a union of the different types of IR objects that consistute 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:50
Set of flags used to control the behavior of the various IR print methods (e.g.
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)
Definition: AliasAnalysis.h:78