21
21
namespace mlir {
22
22
class Operation ;
23
23
namespace ptr {
24
- // / This method checks if it's valid to perform an `addrspacecast` op in the
24
+ // / Checks if it's valid to perform an `addrspacecast` op in the
25
25
// / memory space.
26
26
// / Compatible types are:
27
27
// / Vectors of rank 1, or scalars of `ptr` type.
28
28
LogicalResult isValidAddrSpaceCastImpl (Type tgt, Type src,
29
29
Operation *diagnosticOp);
30
30
31
- // / This method checks if it's valid to perform a `ptrtoint` or `inttoptr` op in
31
+ // / Checks if it's valid to perform a `ptrtoint` or `inttoptr` op in
32
32
// / the memory space.
33
33
// / Compatible types are:
34
34
// / IntLikeTy: Vectors of rank 1, or scalars of integer types or `index` type.
@@ -52,28 +52,29 @@ class MemorySpace {
52
52
MemorySpace () = default ;
53
53
MemorySpace (std::nullptr_t ) {}
54
54
MemorySpace (MemorySpaceAttrInterface memorySpace)
55
- : memorySpaceAttr (memorySpace), memorySpace(memorySpace) {}
56
- MemorySpace (Attribute memorySpace)
57
- : memorySpaceAttr (memorySpace),
55
+ : underlyingMemorySpace (memorySpace), memorySpace(memorySpace) {}
56
+ explicit MemorySpace (Attribute memorySpace)
57
+ : underlyingMemorySpace (memorySpace),
58
58
memorySpace(dyn_cast_or_null<MemorySpaceAttrInterface>(memorySpace)) {}
59
59
60
- operator Attribute () const { return memorySpaceAttr ; }
60
+ operator Attribute () const { return underlyingMemorySpace ; }
61
61
operator MemorySpaceAttrInterface () const { return memorySpace; }
62
62
bool operator ==(const MemorySpace &memSpace) const {
63
- return memSpace.memorySpaceAttr == memorySpaceAttr ;
63
+ return memSpace.underlyingMemorySpace == underlyingMemorySpace ;
64
64
}
65
65
66
66
// / Returns the underlying memory space.
67
- Attribute getUnderlyingSpace () const { return memorySpaceAttr ; }
67
+ Attribute getUnderlyingSpace () const { return underlyingMemorySpace ; }
68
68
69
- // / Returns true if the underlying memory space is null.
69
+ // / Returns true if the memory space is null.
70
70
bool isDefaultModel () const { return memorySpace == nullptr ; }
71
71
72
72
// / Returns the memory space as an integer, or 0 if using the default space.
73
73
unsigned getAddressSpace () const {
74
74
if (memorySpace)
75
75
return memorySpace.getAddressSpace ();
76
- if (auto intAttr = llvm::dyn_cast_or_null<IntegerAttr>(memorySpaceAttr))
76
+ if (auto intAttr =
77
+ llvm::dyn_cast_or_null<IntegerAttr>(underlyingMemorySpace))
77
78
return intAttr.getInt ();
78
79
return 0 ;
79
80
}
@@ -84,9 +85,9 @@ class MemorySpace {
84
85
return memorySpace ? memorySpace.getDefaultMemorySpace () : nullptr ;
85
86
}
86
87
87
- // / This method checks if it's valid to load a value from the memory space
88
- // / with a specific type, alignment, and atomic ordering. The default model
89
- // / assumes all values are loadable .
88
+ // / Checks if it's valid to load a value from the memory space with a specific
89
+ // / type, alignment, and atomic ordering. The default model assumes all values
90
+ // / can be loaded .
90
91
LogicalResult isValidLoad (Type type, AtomicOrdering ordering,
91
92
IntegerAttr alignment,
92
93
Operation *diagnosticOp = nullptr ) const {
@@ -95,9 +96,9 @@ class MemorySpace {
95
96
: success ();
96
97
}
97
98
98
- // / This method checks if it's valid to store a value in the memory space with
99
- // / a specific type, alignment, and atomic ordering. The default model assumes
100
- // / all values are loadable .
99
+ // / Checks if it's valid to store a value in the memory space with a specific
100
+ // / type, alignment, and atomic ordering. The default model assumes all values
101
+ // / can be stored .
101
102
LogicalResult isValidStore (Type type, AtomicOrdering ordering,
102
103
IntegerAttr alignment,
103
104
Operation *diagnosticOp = nullptr ) const {
@@ -106,8 +107,8 @@ class MemorySpace {
106
107
: success ();
107
108
}
108
109
109
- // / This method checks if it's valid to perform an atomic operation in the
110
- // / memory space with a specific type, alignment, and atomic ordering.
110
+ // / Checks if it's valid to perform an atomic operation in the memory space
111
+ // / with a specific type, alignment, and atomic ordering.
111
112
LogicalResult isValidAtomicOp (AtomicBinOp op, Type type,
112
113
AtomicOrdering ordering, IntegerAttr alignment,
113
114
Operation *diagnosticOp = nullptr ) const {
@@ -116,8 +117,8 @@ class MemorySpace {
116
117
: success ();
117
118
}
118
119
119
- // / This method checks if it's valid to perform an atomic operation in the
120
- // / memory space with a specific type, alignment, and atomic ordering.
120
+ // / Checks if it's valid to perform an atomic exchange operation in the memory
121
+ // / space with a specific type, alignment, and atomic ordering.
121
122
LogicalResult isValidAtomicXchg (Type type, AtomicOrdering successOrdering,
122
123
AtomicOrdering failureOrdering,
123
124
IntegerAttr alignment,
@@ -128,17 +129,16 @@ class MemorySpace {
128
129
: success ();
129
130
}
130
131
131
- // / This method checks if it's valid to perform an `addrspacecast` op in the
132
- // / memory space.
132
+ // / Checks if it's valid to perform an `addrspacecast` op in the memory space.
133
133
LogicalResult isValidAddrSpaceCast (Type tgt, Type src,
134
134
Operation *diagnosticOp = nullptr ) const {
135
135
return memorySpace
136
136
? memorySpace.isValidAddrSpaceCast (tgt, src, diagnosticOp)
137
137
: isValidAddrSpaceCastImpl (tgt, src, diagnosticOp);
138
138
}
139
139
140
- // / This method checks if it's valid to perform a `ptrtoint` or `inttoptr` op
141
- // / in the memory space.
140
+ // / Checks if it's valid to perform a `ptrtoint` or `inttoptr` op in the
141
+ // / memory space.
142
142
LogicalResult isValidPtrIntCast (Type intLikeTy, Type ptrLikeTy,
143
143
Operation *diagnosticOp = nullptr ) const {
144
144
return memorySpace
@@ -149,7 +149,7 @@ class MemorySpace {
149
149
150
150
protected:
151
151
// / Underlying memory space.
152
- Attribute memorySpaceAttr {};
152
+ Attribute underlyingMemorySpace {};
153
153
// / Memory space.
154
154
MemorySpaceAttrInterface memorySpace{};
155
155
};
0 commit comments