1 | //===-- Mem2RegInterfaces.h - Mem2Reg interfaces ----------------*- 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_INTERFACES_MEMORYSLOTINTERFACES_H |
10 | #define MLIR_INTERFACES_MEMORYSLOTINTERFACES_H |
11 | |
12 | #include "mlir/IR/Dominance.h" |
13 | #include "mlir/IR/OpDefinition.h" |
14 | #include "mlir/IR/PatternMatch.h" |
15 | |
16 | namespace mlir { |
17 | |
18 | /// Represents a slot in memory. This is generated by an allocating operation |
19 | /// (for example alloca). |
20 | struct MemorySlot { |
21 | /// Pointer to the memory slot, used by operations to refer to it. |
22 | Value ptr; |
23 | /// Type of the value contained in the slot. |
24 | Type elemType; |
25 | }; |
26 | |
27 | /// Memory slot attached with information about its destructuring procedure. |
28 | struct DestructurableMemorySlot : public MemorySlot { |
29 | /// Maps an index within the memory slot to the corresponding subelement type. |
30 | DenseMap<Attribute, Type> elementPtrs; |
31 | }; |
32 | |
33 | /// Returned by operation promotion logic requesting the deletion of an |
34 | /// operation. |
35 | enum class DeletionKind { |
36 | /// Keep the operation after promotion. |
37 | Keep, |
38 | /// Delete the operation after promotion. |
39 | Delete, |
40 | }; |
41 | |
42 | } // namespace mlir |
43 | |
44 | #include "mlir/Interfaces/MemorySlotOpInterfaces.h.inc" |
45 | #include "mlir/Interfaces/MemorySlotTypeInterfaces.h.inc" |
46 | |
47 | #endif // MLIR_INTERFACES_MEMORYSLOTINTERFACES_H |
48 | |