[Mlir-commits] [clang] [llvm] [mlir] [LLVM] Improve IR parsing and printing for target memory locations (PR #176968)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Feb 23 07:45:16 PST 2026
================
@@ -2568,20 +2568,37 @@ bool LLParser::parseAllocKind(AllocFnKind &Kind) {
return false;
}
-static std::optional<MemoryEffects::Location> keywordToLoc(lltok::Kind Tok) {
+static ArrayRef<IRMemLocation> keywordToLoc(lltok::Kind Tok) {
+ using Loc = IRMemLocation;
+
+ static constexpr auto ArgMem = Loc::ArgMem;
+ static constexpr auto InaccessibleMem = Loc::InaccessibleMem;
+ static constexpr auto ErrnoMem = Loc::ErrnoMem;
+ static constexpr auto TargetMem0 = Loc::TargetMem0;
+ static constexpr auto TargetMem1 = Loc::TargetMem1;
+ static constexpr auto TargetMem = {Loc::TargetMem0, Loc::TargetMem1};
----------------
CarolineConcatto wrote:
@antoniofrighetto and @nikic
I am using now SmallVector and using the targetMemLocations function.
```
+ /// Returns iterator over all target location kinds
+ static auto targetMemLocations() {
+ return enum_seq_inclusive(Location::TargetMem0, Location::TargetMem1,
+ force_iteration_on_noniterable_enum);
+ }
```
https://github.com/llvm/llvm-project/pull/176968
More information about the Mlir-commits
mailing list