What exactly I did: researching the material in tree-dump.c I realized that the field names of the bits where they are known come from structural DIEs and are difficult to track.
Then I decided to get a name from type BIT_FIELD_REF argument 0 (a reference to the structure), which is equal to RECORD_TYPE and saves all field sizes and offsets.
The problem was understanding that BIT_FIELD_REF does not refer to the bits themselves: it is used as BIT_FIELD_REF & INTEGER_CST , where the constant acts like a mask. Realizing this, I quickly calculated the offsets and got the name from the type.
source share