Issue 230712.1: Register Segment Name Type

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

Part I: Register Segment Name Type


Several proposals seek to revise the meaning of location descriptions. However, this seems excessively complicated when the problems to be solved seem solely related to dealing with registers, either in whole or in part. This proposal sets forward an alternative, which serves as a foundation for further proposals.

Concept Overview

Define a new DWARF built-in data type (by analogy with the DWARF generic type) called the register segment name type. A value of this type identifies or names a part of a given register beginning at a given bit position p from the ABI specified end of the register and including s contiguous bits toward the other end of the register. In the common case where the position is 0 and the size is the same as the register size S, such a value is conveniently called a register name.

A register segment name is a triple consisting of:

While the internal encoding of a register segment name is not specified, it is expected that the total size of a register segment name value is the same as the size of the generic type.

This type is identified in contexts that require a type parameter using the value DW_ITYPE_regseg_name == 1. For completeness, the existing generic type can be identified using DW_ITYPE_gen_type == 0. (ITYPE is intended to suggest “intrinsic type”.)

Note: the largest possible value of DW_ITYPE is conservatively limited by the size of the smallest possible compilation unit DIE or type unit DIE that can begin a compilation. That should suffice.

None of the existing operators operate on values of this type except as specified in the following (or an additional later proposal).

Note: DW_OP_xderef* operators are not relevant here. The register segment name type can be thought of as analogous to a kind of distinct “address space identifier”.

The DW_AT_use_location attribute provides an expression used to compute the address of a member for a pointer-to-member type, and expects the evaluation mechanism to provide the value of the pointer and the location of the object as implicitly-pushed elements on the stack. The latter element is allowed to be an address or a register [segment] name.

The DW_OP_call* operators are allowed to leave a register [segment] name value on the stack.

Register Segment Name Forms

It will sometimes be useful to directly specify a register segment name as the value of an attribute. For this, define the new forms:

DW_FORM_regseg_name takes three unsigned LEB128 operands. These values specify the register number, position and size values respectively of a register segment name value.

DW_FORM_reg_name takes one unsigned LEB128 operand. This value specifies the register number of a register segment name value, where the position is 0 and the size covers the full register.

Class regseg

The form DW_FORM_reg[seg]_name forms does not fit naturally in any existing class. Define a new class regseg consisting of just these forms.