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