# Register Segment Name Type ## Part I: Register Segment Name Type ### Introduction 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: - The number identifying a register as defined by the ABI - A starting bit position, where `0 <= p < S` - A size in bits, where `0 <= s <= S` and `0 <= p + s <= S` 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). - `DW_OP_regseg_name` takes three ULEB operands, creates a register segment name value and pushes that value on the stack (a value of type DW_ITYPE==1). These parameters are the register number, the position and the size, respectively. - `DW_OP_reg_name` takes a single ULEB operand and uses that value to push a register segment name on the stack (a value of type `DW_ITYPE==1`). The position is 0 and the size is as specified in the ABI for that register. - _Additional variations of these operators with some or all parameters on the stack can be considered as well._ - `DW_OP_push_object_location` can push either an address or a register segment name value. This replaces `DW_OP_push_object_address` but can keep the same code. - `The DW_OP_deref[_size]` operators are extended to operate on a register segment name. The register segment name value is popped and the contents of the register segment is pushed on the stack as a value of the generic type. - The `DW_OP_deref_type` operator is extended to operate on a register segment name. The register segment name value is popped and the contents of the register segment is pushed on the stack as a value of the designated type. 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` `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` `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. --- 2026-01-04: Withdrawn.