[flang-commits] [flang] [flang] Add ability to have special allocator for descriptor data (PR #100690)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Wed Jul 31 09:03:50 PDT 2024


Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,Valentin Clement
 <clementval at gmail.com>,Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/100690 at github.com>


================
@@ -155,6 +162,19 @@ typedef struct CFI_cdesc_t {
 #else
   CFI_dim_t dim[]; /* must appear last */
 #endif
+
+#ifdef __cplusplus
+  RT_API_ATTRS inline bool HasAddendum() const {
+    return extra & _CFI_ADDENDUM_FLAG;
+  }
+  RT_API_ATTRS inline void SetHasAddendum() { extra |= _CFI_ADDENDUM_FLAG; }
+  RT_API_ATTRS inline int GetAllocIdx() const {
+    return ((int)extra >> _CFI_ADDENDUM_BITS);
+  }
+  RT_API_ATTRS inline void SetAllocIdx(int pos) {
+    extra |= (pos << _CFI_ADDENDUM_BITS);
----------------
klausler wrote:

This isn't going to work if the field is initially nonzero.  Define a mask macro for the field and use it above and also here.

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


More information about the flang-commits mailing list