2121namespace mlir {
2222class Operation ;
2323namespace 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
2525// / memory space.
2626// / Compatible types are:
2727// / Vectors of rank 1, or scalars of `ptr` type.
2828LogicalResult isValidAddrSpaceCastImpl (Type tgt, Type src,
2929 Operation *diagnosticOp);
3030
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
3232// / the memory space.
3333// / Compatible types are:
3434// / IntLikeTy: Vectors of rank 1, or scalars of integer types or `index` type.
@@ -52,28 +52,29 @@ class MemorySpace {
5252 MemorySpace () = default ;
5353 MemorySpace (std::nullptr_t ) {}
5454 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),
5858 memorySpace(dyn_cast_or_null<MemorySpaceAttrInterface>(memorySpace)) {}
5959
60- operator Attribute () const { return memorySpaceAttr ; }
60+ operator Attribute () const { return underlyingMemorySpace ; }
6161 operator MemorySpaceAttrInterface () const { return memorySpace; }
6262 bool operator ==(const MemorySpace &memSpace) const {
63- return memSpace.memorySpaceAttr == memorySpaceAttr ;
63+ return memSpace.underlyingMemorySpace == underlyingMemorySpace ;
6464 }
6565
6666 // / Returns the underlying memory space.
67- Attribute getUnderlyingSpace () const { return memorySpaceAttr ; }
67+ Attribute getUnderlyingSpace () const { return underlyingMemorySpace ; }
6868
69- // / Returns true if the underlying memory space is null.
69+ // / Returns true if the memory space is null.
7070 bool isDefaultModel () const { return memorySpace == nullptr ; }
7171
7272 // / Returns the memory space as an integer, or 0 if using the default space.
7373 unsigned getAddressSpace () const {
7474 if (memorySpace)
7575 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))
7778 return intAttr.getInt ();
7879 return 0 ;
7980 }
@@ -84,9 +85,9 @@ class MemorySpace {
8485 return memorySpace ? memorySpace.getDefaultMemorySpace () : nullptr ;
8586 }
8687
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 .
9091 LogicalResult isValidLoad (Type type, AtomicOrdering ordering,
9192 IntegerAttr alignment,
9293 Operation *diagnosticOp = nullptr ) const {
@@ -95,9 +96,9 @@ class MemorySpace {
9596 : success ();
9697 }
9798
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 .
101102 LogicalResult isValidStore (Type type, AtomicOrdering ordering,
102103 IntegerAttr alignment,
103104 Operation *diagnosticOp = nullptr ) const {
@@ -106,8 +107,8 @@ class MemorySpace {
106107 : success ();
107108 }
108109
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.
111112 LogicalResult isValidAtomicOp (AtomicBinOp op, Type type,
112113 AtomicOrdering ordering, IntegerAttr alignment,
113114 Operation *diagnosticOp = nullptr ) const {
@@ -116,8 +117,8 @@ class MemorySpace {
116117 : success ();
117118 }
118119
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.
121122 LogicalResult isValidAtomicXchg (Type type, AtomicOrdering successOrdering,
122123 AtomicOrdering failureOrdering,
123124 IntegerAttr alignment,
@@ -128,17 +129,16 @@ class MemorySpace {
128129 : success ();
129130 }
130131
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.
133133 LogicalResult isValidAddrSpaceCast (Type tgt, Type src,
134134 Operation *diagnosticOp = nullptr ) const {
135135 return memorySpace
136136 ? memorySpace.isValidAddrSpaceCast (tgt, src, diagnosticOp)
137137 : isValidAddrSpaceCastImpl (tgt, src, diagnosticOp);
138138 }
139139
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.
142142 LogicalResult isValidPtrIntCast (Type intLikeTy, Type ptrLikeTy,
143143 Operation *diagnosticOp = nullptr ) const {
144144 return memorySpace
@@ -149,7 +149,7 @@ class MemorySpace {
149149
150150protected:
151151 // / Underlying memory space.
152- Attribute memorySpaceAttr {};
152+ Attribute underlyingMemorySpace {};
153153 // / Memory space.
154154 MemorySpaceAttrInterface memorySpace{};
155155};
0 commit comments