This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Middle-end arrays, forward-ported to trunk (again)


Hi,

On Tue, 21 Jun 2011, Richard Guenther wrote:

> I failed to see where the scalarizer inserts the temporary vars it 
> creates into the scope blocks (thus the gimplify.c hunk ...).  Any help 
> here is welcome.

The scoping of the scalarizer is a bit funny.  gfc_start_scalarized_body 
sets up scopes for all dimensions and leaves with the 'body' scope open.  
The bound expressions are inserted (for your testcase) into the 'block' 
scope.  In between there are the loop->code[n] scopes.

You can't decide to not go into gfc_start_scalarized_body early, because 
lse.expr will only be set later, so you have to 
properly finish_block all these in-between blocks and wire them into 
loop.pre and then block, like gfc_trans_scalarizing_loops would do.  Of 
course you don't want to actually generate loops, which 
gfc_trans_scalarizing_loops does.  So you have to manually unwind the 
blocks.  If you do that, then you also don't need the ??? marked 
gfc_add_block_to_block (&block, &loop.pre).

So, the code in the VLA_VIEW_EXPR case should be roughly this:

  else if (TREE_CODE (lse.expr) == VLA_VIEW_EXPR)
    {
      int dim;
      stmtblock_t *pblock;

      pblock = &body;
      for (dim = 0; dim < loop.dimen + loop.codimen; dim++)
        {
          n = loop.order[dim];
          tmp = gfc_finish_block (pblock);
          gfc_add_expr_to_block (&loop.code[n], tmp);
          loop.loopvar[n] = NULL_TREE;
          pblock = &loop.code[n];
        }

      tmp = gfc_finish_block (pblock);
      gfc_add_expr_to_block (&loop.pre, tmp);
      gfc_add_block_to_block (&block, &loop.pre);
      gfc_add_block_to_block (&block, &loop.post);
      gfc_cleanup_loop (&loop);
    }

Sorry, no real patch, my quilt queue is busted somehow.


Ciao,
Michael.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]