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

Valentin Clement バレンタイン クレメン via flang-commits flang-commits at lists.llvm.org
Tue Aug 13 09:30:59 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=?=,Valentin Clement
 <clementval at gmail.com>,Valentin Clement <clementval at gmail.com>,Valentin
 Clement <clementval at gmail.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/100690 at github.com>


================
@@ -420,6 +420,27 @@ class Descriptor {
 
   void Dump(FILE * = stdout) const;
 
+// Value of the addendum presence flag.
+#define _CFI_ADDENDUM_FLAG 1
+// Number of bits needed to be shifted when manipulating the allocator index.
+#define _CFI_ALLOCATOR_IDX_SHIFT 1
+// Allocator index mask.
+#define _CFI_ALLOCATOR_IDX_MASK 0b00001110
+
+  RT_API_ATTRS inline bool HasAddendum() const {
+    return raw_.extra & _CFI_ADDENDUM_FLAG;
+  }
+  RT_API_ATTRS inline void SetHasAddendum() {
+    raw_.extra |= _CFI_ADDENDUM_FLAG;
+  }
+  RT_API_ATTRS inline int GetAllocIdx() const {
+    return (raw_.extra & _CFI_ALLOCATOR_IDX_MASK) >> _CFI_ALLOCATOR_IDX_SHIFT;
+  }
+  RT_API_ATTRS inline void SetAllocIdx(int pos) {
+    raw_.extra &= ~_CFI_ALLOCATOR_IDX_MASK; // Clear the allocator index bits.
+    raw_.extra |= (pos << _CFI_ALLOCATOR_IDX_SHIFT);
----------------
clementval wrote:

It's hard to have `-DFLANG_ENABLE_WERROR=ON` for any compilers. Usually building with clang is warning free because it is what is used in upstream buildbots. 

I'm often building with gcc 9.3.0 and there is tons of warnings. 

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


More information about the flang-commits mailing list