Issue 050224.1: UPC support

Author: James Cownie
Champion: James Cownie
Date submitted: 2005-02-24
Date revised:
Date closed:
Type: Enhancement
Status: Accepted
DWARF Version: 3
Revising a proposal from 2001 that we add all the items necessary for support of UPC.

   At the time (2001), this was rejected on the grounds that
   1) The standard was about to come out and it was much too late to add
      things. 
   2) There was no current practice to support it.

   Since then the standard hasn't come out :-(, and we now have current
   practice; these extensions (with an additional _UPC_ in tag names
   since they're extensions) are used by Intrepid's GCC-UPC compiler.

Here's the original message from 2001.

> Folks,
> 
> I know that it is now very late to be submitting new proposals for
> DWARF 2.1, and if the committee feels that I should therefore withdraw
> this proposal (in whole or in part), I will do so (and try to get it
> put up as "suggested practice" on the UPC site).
> 
> Rationale
> ---------
> 
> The UPC (Unified Parallel C) language ( http://hpc.gmu.edu/~upc ) is a
                                      now http://hpc.gwu.edu/~upc
> parallel version of C, and therefore most of the constructs in UPC are
> already well covered by DWARF.
> 
> However UPC extends C in two areas for which there is no obvious
> expression within DWARF at present. These are
> 
> 1) The "shared" type qualifier.
>    This is syntactically a type-qualifier (similar to const, volatile
>    or restrict), it differs only in that it also carries a positive
>    integer value with it which defines the shared block size. This is
>    a compile time constant which describes the way in which the shared
>    object is to be distributed over the UPC threads in the executing program.
> 
> 2) The expansible array decalaration.
>    UPC allows one dimension of a shared array to be dimensioned with a
>    bound which is a multiple of the number of UPC threads instanced at
>    run time.
> 
> Neither of these concepts maps into any existing DWARF attributes or
> tags, yet both could easily be represented using one new tag and one
> new attribute. With these two additions UPC would (I believe) be fully
> covered by DWARF.
> 
> The reason for asking that these be included in the DWARF standard
> (rather than as vendor extensions) is that there are already three or
> four compiler groups working on UPC compilers. It is likely that more
> than one of them will want to use DWARF debug format.  If the concepts
> are _not_ standardised, then debuggers will have to handle different
> ways of expressing the same information in DWARF. This is unnecessary
> work !
> 
> Detailed proposals
> ------------------
> (Page numbers are against the Dwarf2p1-dearf6-010515-dif-base.pdf file
> from the normal place).
> 
> Component 1: Add a standard language tag for UPC
> ------------
> Add DW_LANG_Upc to the supported set of languages,
> 
> Page 42/43: Add DW_LANG_Upc     Unified Parallel C
> to the table of language names.
> 
> Page 145: Add DW_LANG_Upc   0x000f
> to the table of language encodings
> 
> Index-4:  Add DW_LANG_Upc to the index.
> 
> Component 2: Add DW_TAG_shared_type
> ------------
> Add a new tag (analogous to DW_TAG_const_type or DW_TAG_volatile_type)
> to allow the specification of a shared type.
> 
> Page 8: In the table, add DW_TAG_shared_type
> 
> Page 69: In the table add
> 
>        DW_TAG_shared_type     UPC shared qualified type
> 
> Page 84 (say ?) add a description of the shared_type
>        Shared type entries
> 
>        The UPC language extends ANSI C by adding the concept of shared
>        objects which are expressed by adding the "shared [blocksize]"
>        directive to a type. For instance
>           int shared [10] foo;
>        declares an integer which is shared with a blocksize of 10, or
>           int shared *p;
>        declares a local pointer to a shared integer with blocksize 1.
>        The DW_TAG_shared tag allows this concept to be expressed in
>        DWARF.
> 
>        The DW_TAG_shared_type expects as children the attributes
> 
>        1) DW_AT_count which gives the shared block size (if this is
>           absent, then "infinite" blocksize is used, as expressed in UPC
>           by "shared []").
> 
>        2) DW_AT_type the type to which the shared property is being
>           applied.
> 
>        The type used in the first example above would then be expressed as
>        DW_TAG_shared
>           DW_AT_type    reference to "int"
>           DW_AT_count   10
> 
> Page 130: In the table add
>        DW_TAG_shared_type     0x3e
> 
> Page 159: In the table add
>        DW_TAG_shared_type     DW_AT_count
>                               DW_AT_type
> 
> Component 3: Support the "THREADS scaled" array declaration
> -----------
> Add a new attribute to allow the THREADS scaled array declaration to
> be expressed.
> 
> Page 16: In the table add
>        DW_AT_threads_scaled     Subrange type should be interpreted
>                                 scaled by THREADS
> 
> Page 85: In the description of the subrange type add.
>        If the subrange type has a DW_AT_threads_scaled attribute, then
>        it represents a UPC array bound which should be scaled by the
>        run time "THREADS" value (the number of UPC threads in this
>        execution of the program). This allows the expression of UPC
>        arrays declared like this example :-
> 
>        int shared foo[34*THREADS][10][20];
> 
> Page 133: In the table add
>      DW_AT_threads_scaled      0x60
> 
> Page 169: In the entry for DW_TAG_subrange_type
>      add DW_AT_threads_scaled