[llvm] [RFC][Draft] Extend MemoryEffects to Support Target-Specific Memory L… (PR #148650)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 14 09:04:43 PDT 2025


================
@@ -56,6 +56,11 @@ enum class ModRefInfo : uint8_t {
 /// Debug print ModRefInfo.
 LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, ModRefInfo MR);
 
+enum class InaccessibleTargetMemLocation {
----------------
antoniofrighetto wrote:

I wonder if we could have something around the following instead:
```cpp
enum class IRMemLocation {
  ArgMem = 0,
  InaccessibleMem = 1,
  ErrnoMem = 2,
  TargetSpecificMem = 3,
  Other = 4,

  First = ArgMem,
  Last = Other,
};
```
And then extending `MemoryEffectsBase` to have, like, a `Optional<TargetSpecificMemTag> TargetMem;` field, where `TargetMem` is, e.g.,:
```cpp
struct TargetSpecificMemTag {
  Triple::ArchType Arch;
  uint8_t Kind;
};
```
This would lead to know easily if the location is target-specific:
```cpp
bool isTargetSpecific() const { return Loc == Location::TargetSpecificMem; }
```
And I guess it would avoid having some `static_cast<IRMemLocation>` around. Not sure if the target-specific memory effects are decoupled enough this way though.

https://github.com/llvm/llvm-project/pull/148650


More information about the llvm-commits mailing list