[Patch, fortran] [20..30/66] inline sum and product: Update core structs.

Mikael Morin mikael.morin@sfr.fr
Thu Oct 27 23:31:00 GMT 2011


These patches introduce the new scalarizer structures. As explained earlier,
the dim and dimen field are now part of the main gfc_ss structure.
All the common fields (type, expr, shape, string length, union data and all its
content) are moved to a new external structure gfc_ss_info to which a pointer
is kept in the main gfc_ss structure. The former gfc_ss_info is renamed to
gfc_array_info as it is only used for non-scalar case. The shape field is moved
to gfc_array_info as it is not used in non-array cases.

This is explained in the schema below (though I'm not sure it makes it more understandable).

struct gfc_ss                                       struct gfc_ss
{                                                   {
                                 ---- new ------->    struct gfc_ss_info *
                                                      {
                                 ---- new --------->    int refcount;

  gfc_ss_type type;   -------------+             +->    gfc_ss_type type;
  gfc_expr *expr;     -------------+-- moved ----+->    gfc_expr *expr;
  mpz_t *shape;    ----- moved ----|------+      |
  tree string_length; -------------+      |      +->    tree string_length;
  union      ----------------------+      |      +->    union
  {                                       |             {
    struct                                |               struct
    {                                     |               {
      tree expr;  ------------ renamed -------------->      tree value;
    }                                     |               }
    scalar;                               |               scalar;
                                          |
    struct                                |               struct
    {                                     |               {
      int dimen; ---------+               |                 int dimen;
      tree type;          |               |                 tree type;
    }                     |               |               }
    temp;                 |- merged --+   |               temp;
                          |           |   |
    struct gfc_ss_info  --|- renamed -|---|---------->    struct gfc_array_info
    {                     |           |   |               {
                          |           |   +----------->     mpz_t *shape;
      int dimen; ---------+           |
      gfc_ref *ref;                   |                     gfc_ref *ref;
      tree descriptor;                + moved +             tree descriptor;
      tree data;                      |       |             tree data;
      tree offset;                    |       |             tree offset;
      tree saved_offset;              |       |             tree saved_offset;
      tree stride0;                   |       |             tree stride0;
      gfc_ss *subscript[];            |       |             gfc_ss *subscript[];
                                      |       |
      tree start[];                   |       |             tree start[];
      tree end[];                     |       |             tree end[];
      tree stride[];                  |       |             tree stride[];
      tree delta[];                   |       |             tree delta[];
                                      |       |
      int dim[];  --------------------+       |
    } info;             ---------- renamed ---|------>    } array;
  }                                           |         }
  data;                                       |         data;
                                              |
                            +-----------------|---->    unsigned useflags:2;
                            +-----------------|---->    unsigned where:1;
                            |                 |       }
                           moved              |
                            |                 +-->    int dimen;
                            |                 +-->    int dim[];
                            |
  gfc_ss *loop_chain;       |                         gfc_ss *loop_chain;
  gfc_ss *next;             |                         gfc_ss *next;
                            |
  unsigned useflags:2;  ----+
  unsigned where:1;     ----+

  unsigned is_alloc_lhs:1;                            unsigned is_alloc_lhs:1;
}                                                   }
gfc_ss;                                             gfc_ss;



The follow-up messages are the step-by-step patches to change the structures
by moving fields one by one.  This is for those prefering more straightforward
patches (like me).
For the masoch^W^W those who prefer one single patch the combined patch is
attached to this mail.





Patch 20: Rename gfc_ss_info to gfc_array_info.
Patch 21: Move {dim,dimen} from gfc_array_info to gfc_ss.
Patch 22: Move shape from gfc_ss to gfc_array_info.
Patch 23: Move type from gfc_ss to a new gfc_ss_info.
Patch 24: Move expr from gfc_ss to gfc_ss_info.
Patch 25: Move string_length from gfc_ss to gfc_ss_info.
Patch 26: Move scalar struct from gfc_ss to gfc_ss_info.
Patch 27: Move temp struct from gfc_ss to gfc_ss_info.
Patch 28: Move info struct from gfc_ss to gfc_ss_info.
Patch 29: Move useflags from gfc_ss to gfc_ss_info.
Patch 30: Move where from gfc_ss to gfc_ss_info.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr43829-20..30.diff
Type: text/x-diff
Size: 80302 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20111027/a92fd191/attachment.bin>


More information about the Fortran mailing list