Issue 230712.2: Complete Record Objects Allocated in Registers

Author: Ron Brender
Champion: Ron Brender
Date submitted: 2023-07-12
Date revised:
Date closed:
Type: Concept
Status: Open
DWARF Version: 6

Part II: Complete Record Objects Allocated in Registers

Introduction

For structure/union/class types, DWARF defines a DW_AT_location attribute used in DW_TAG_member components to specify the layout of the components in memory.

But what happens if an object of such a type is (desired to be) allocated in one or more registers? There is no guidance in DWARF about whether this can be described. Further, it is easy to see that the byte-oriented offsets used for in-memory layout descriptions do not map naturally or reasonably to registers.

There is one assumption that we do make: the ABI-defined register numbers can be usefully assumed to group registers with similar properties so they have contiguous numbers. Thus it is reasonable to think of register R1 as the successor of register R0 in an architecture that has at least two generally similar registers. Conversely, while dissimilar registers may have adjacent numbers, for example, vector register V0 may happen to have the next higher register number after general register R15 (in an architecture with 16 general registers), this is arbitrary and of no significance. We assume the ABI group will assign register numbers in a useful way.

Concept Overview

For data member entries (DW_TAG_member):

A data member may have either or both of these attributes. The DW_AT_data_member_address attribute will be used if/when the object is allocated in memory while DW_AT_data_member_regseg applies if/when the object is allocated in one or more registers.

In the later case, the register number part of the register segment name value is treated as a relative register number, with respect to the base register allocation of the object.

It is expected that if one member of a structure/union/class has a DW_AT_data_member_address attribute then all will. Similarly, if one member has a DW_AT_data_member_regseg attribute then all will.