[clang] [CIR] Split side_effect into memory effects, nounwind, and willreturn (PR #223890)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 16 06:52:14 PDT 2026
================
@@ -1986,39 +1986,74 @@ def CIR_BlockAddrDiffAttr
}
//===----------------------------------------------------------------------===//
-// Side Effect
+// Memory Effects
//===----------------------------------------------------------------------===//
-def CIR_SideEffect : CIR_I32Enum<
- "SideEffect", "allowed side effects of a function", [
- I32EnumCase<"All", 0, "all">,
- I32EnumCase<"Pure", 1, "pure">,
- I32EnumCase<"Const", 2, "const">
+def CIR_ModRefInfo : CIR_I32Enum<
+ "ModRefInfo", "how a function accesses one class of memory", [
+ I32EnumCase<"NoModRef", 0, "none">,
+ I32EnumCase<"Ref", 1, "read">,
+ I32EnumCase<"Mod", 2, "write">,
+ I32EnumCase<"ModRef", 3, "readwrite">
]> {
let description = [{
- The side effect attribute specifies the possible side effects of a function
- or the target of a call operation. This is an enumeration attribute with
- the following possible values:
-
- - all: The function or callee can have any side effects. This is the default
- if no side effects are explicitly listed.
- - pure: The function or callee may read data from memory, but it cannot
- write data to memory. This has the same effect as the GNU C/C++ attribute
- `__attribute__((pure))`.
- - const: The function or callee may not read or write data from memory. This
- has the same effect as the GNU C/C++ attribute `__attribute__((const))`.
+ Whether a function may read and/or write one class of memory. The
+ spellings match LLVM's, so `none` means neither read nor written and
+ `readwrite` means both may happen.
+ }];
+}
- Examples:
+def CIR_MemoryEffectsAttr : CIR_Attr<"MemoryEffects", "memory_effects"> {
+ let summary = "What memory a function or callee may touch";
----------------
erichkeane wrote:
This needs a reworking too.
https://github.com/llvm/llvm-project/pull/223890
More information about the cfe-commits
mailing list