[LLVMdev] DIFactory interface is going away

Duncan Sands baldrick at free.fr
Fri Feb 25 08:57:47 PST 2011


Hi Devang,

>> It does make me wonder how you are supposed to represent types which cannot
>> be properly represented by LLVM types, for example structs with fields at
>> variable offsets from the start and/or of variable size; or structs with
>> fields that may or may not be present depending on the value of other fields.
>> Such types occur in Ada for example.
>
> The metadata constructs used to encode debugging information do not use (or refer) LLVM types directly.  Here is the interface to emit debug info for a member.

thanks for the explanation.

>
>      /// createMemberType - Create debugging information entry for a member.
>      /// @param Name         Member name.
>      /// @param File         File where this member is defined.
>      /// @param LineNo       Line number.
>      /// @param SizeInBits   Member size.

For Ada this needs to be a Value* since it is dynamic.  But presumably this
interface is a direct mapping to the Dwarf specification, i.e. Dwarf itself
has no way of encoding a variable size here?

>      /// @param AlignInBits  Member alignment.
>      /// @param OffsetInBits Member offset.

This is likewise dynamic in general.

>      /// @param Flags        Flags to encode member attribute, e.g. private
>      /// @param Ty           Parent type.
>      DIType createMemberType(StringRef Name, DIFile File,
>                              unsigned LineNo, uint64_t SizeInBits,
>                              uint64_t AlignInBits, uint64_t OffsetInBits,
>                              unsigned Flags, DIType Ty);
>
>
> Of course,  the FE needs to know the offset, size, alignment etc... for each field as per source language. The Parent type here is also debug info entry for the enclosing structure/class. Regarding variable size fields, I am not sure how they are encoded in DWARF.

GCC outputs some language specific Dwarf tags for Ada, perhaps to handle these
kinds of mad types.

Ciao, Duncan.



More information about the llvm-dev mailing list