================
@@ -335,6 +335,111 @@ static ParseResult parseCIRKeyword(AsmParser &parser,
RetTy &result) {
return success();
}
+/// The memory classes that can be named individually, in the order they
+/// print. Positional: parseMemoryEffects and printMemoryEffects both index
+/// by position, so a class added here needs an access added alongside it in
+/// both. The spellings are LLVM's own, which underscores the target pair
+/// but not the rest.
+static constexpr llvm::StringLiteral memoryClassNames[] = {
+ "argmem", "inaccessiblemem", "errnomem", "target_mem0", "target_mem1"};
+
+/// Print memory effects in LLVM's compact form, except that the two target
+/// classes always print by name rather than collapsing to `target_mem`. The
+/// access covering every class not named individually comes first, then only
+/// the classes differing from it. That leading access is left out when it is
+/// `none` and some class does differ, since an unnamed class reads back as
+/// `none`.
+static void printMemoryEffects(mlir::AsmPrinter &printer,
----------------
adams381 wrote:
On second thought, I think you are right. The attribute is a slot-for-slot
copy of `#llvm.memory_effects`, and the printer is a copy of the `memory(`
block in `Attribute::getAsString`, which mine has already drifted from on
`target_mem`. So I'll switch to `LLVM::MemoryEffectsAttr` with the builtin
format, which drops the CIR enum, the printer, the parser and the conversion
helper.
https://github.com/llvm/llvm-project/pull/223890
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits