|
66 | 66 | /// MemoryDefs are not disambiguated because it would require multiple reaching
|
67 | 67 | /// definitions, which would require multiple phis, and multiple memoryaccesses
|
68 | 68 | /// per instruction.
|
| 69 | +/// |
| 70 | +/// In addition to the def/use graph described above, MemoryDefs also contain |
| 71 | +/// an "optimized" definition use. The "optimized" use points to some def |
| 72 | +/// reachable through the memory def chain. The optimized def *may* (but is |
| 73 | +/// not required to) alias the original MemoryDef, but no def *closer* to the |
| 74 | +/// source def may alias it. As the name implies, the purpose of the optimized |
| 75 | +/// use is to allow caching of clobber searches for memory defs. The optimized |
| 76 | +/// def may be nullptr, in which case clients must walk the defining access |
| 77 | +/// chain. |
| 78 | +/// |
| 79 | +/// When iterating the uses of a MemoryDef, both defining uses and optimized |
| 80 | +/// uses will be encountered. If only one type is needed, the client must |
| 81 | +/// filter the use walk. |
69 | 82 | //
|
70 | 83 | //===----------------------------------------------------------------------===//
|
71 | 84 |
|
@@ -252,10 +265,11 @@ class MemoryUseOrDef : public MemoryAccess {
|
252 | 265 | return MA->getValueID() == MemoryUseVal || MA->getValueID() == MemoryDefVal;
|
253 | 266 | }
|
254 | 267 |
|
255 |
| - // Sadly, these have to be public because they are needed in some of the |
256 |
| - // iterators. |
| 268 | + /// Do we have an optimized use? |
257 | 269 | inline bool isOptimized() const;
|
| 270 | + /// Return the MemoryAccess associated with the optimized use, or nullptr. |
258 | 271 | inline MemoryAccess *getOptimized() const;
|
| 272 | + /// Sets the optimized use for a MemoryDef. |
259 | 273 | inline void setOptimized(MemoryAccess *);
|
260 | 274 |
|
261 | 275 | // Retrieve AliasResult type of the optimized access. Ideally this would be
|
|
0 commit comments