[llvm] [CHERI] Define CHERI capability address space in computeRISCVDataLayout (PR #190806)

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 7 09:11:42 PDT 2026


================
@@ -315,6 +317,24 @@ static std::string computeRISCVDataLayout(const Triple &TT, StringRef ABIName) {
   else
     Ret += "-S128";
 
+  // addrspace(200) represents CHERI capabilities across all modes and ABIs.
+  auto IsPureCapabilityABI =
+      StringSwitch<bool>(ABI)
+          .Cases({"il32pc64", "il32pc64f", "il32pc64d", "il32pc64e"}, true)
+          .Cases({"l64pc128", "l64pc128f", "l64pc128d"}, true)
+          .Cases({"cheriot", "cheriot-baremetal"}, true)
+          .Default(false);
+  bool HasCheri = IsPureCapabilityABI;
+  if (HasCheri) {
+    if (TT.isArch64Bit())
+      Ret += "-pf200:128:128:128:64";
+    else
+      Ret += "-pf200:64:64:64:32";
----------------
arichardson wrote:

```suggestion
      Ret += "-pe200:64:64:64:32";
```

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


More information about the llvm-commits mailing list