MLIR  16.0.0git
MemRef.h
Go to the documentation of this file.
1 //===- MemRef.h - MemRef dialect --------------------------------*- 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_DIALECT_MEMREF_IR_MEMREF_H_
10 #define MLIR_DIALECT_MEMREF_IR_MEMREF_H_
11 
13 #include "mlir/IR/Dialect.h"
22 
23 namespace mlir {
24 
25 namespace arith {
26 enum class AtomicRMWKind : uint64_t;
27 class AtomicRMWKindAttr;
28 } // namespace arith
29 
30 class Location;
31 class OpBuilder;
32 
33 raw_ostream &operator<<(raw_ostream &os, const Range &range);
34 
35 /// Return the list of Range (i.e. offset, size, stride). Each Range
36 /// entry contains either the dynamic value or a ConstantIndexOp constructed
37 /// with `b` at location `loc`.
38 SmallVector<Range, 8> getOrCreateRanges(OffsetSizeAndStrideOpInterface op,
39  OpBuilder &b, Location loc);
40 
41 namespace memref {
42 
43 /// This is a common utility used for patterns of the form
44 /// "someop(memref.cast) -> someop". It folds the source of any memref.cast
45 /// into the root operation directly.
46 LogicalResult foldMemRefCast(Operation *op, Value inner = nullptr);
47 
48 /// Return an unranked/ranked tensor type for the given unranked/ranked memref
49 /// type.
50 Type getTensorTypeFromMemRefType(Type type);
51 
52 /// Finds a single dealloc operation for the given allocated value. If there
53 /// are > 1 deallocates for `allocValue`, returns None, else returns the single
54 /// deallocate if it exists or nullptr.
55 Optional<Operation *> findDealloc(Value allocValue);
56 
57 } // namespace memref
58 } // namespace mlir
59 
60 //===----------------------------------------------------------------------===//
61 // MemRef Dialect
62 //===----------------------------------------------------------------------===//
63 
64 #include "mlir/Dialect/MemRef/IR/MemRefOpsDialect.h.inc"
65 
66 //===----------------------------------------------------------------------===//
67 // MemRef Dialect Operations
68 //===----------------------------------------------------------------------===//
69 
70 #define GET_OP_CLASSES
71 #include "mlir/Dialect/MemRef/IR/MemRefOps.h.inc"
72 
73 #endif // MLIR_DIALECT_MEMREF_IR_MEMREF_H_
Include the generated interface declarations.