[clang] [CIR] Split side_effect into memory effects, nounwind, and willreturn (PR #223890)

Adam Smith via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 16 18:05:43 PDT 2026


================
@@ -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:

I've made the switch.  The CIR enum, the attribute, the printer, the parser and the conversion helper are all gone.

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


More information about the cfe-commits mailing list