[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 14:59:21 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>
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;
+// Number of bits used to encode the addendum presence flag.
+#define _CFI_ADDENDUM_BITS 1
+// Value of the addendum presence flag.
+#define _CFI_ADDENDUM_FLAG 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_ADDENDUM_BITS;
----------------
klausler wrote:
One last tweak, then I think I'm done: please rename _CFI_ADDENDUM_BITS, at least as it is used here, to something that signifies that it's the shift count for the ALLOCATOR_IDX field. That will make these two member functions independent of any assumption that the ALLOCATOR_IDX field has to be adjacent to the addendum flag and that both are right-justified.
https://github.com/llvm/llvm-project/pull/100690
More information about the flang-commits
mailing list