On 10/30/2015 03:04 PM, Nathan Sidwell wrote:
On 10/30/15 13:54, Jeff Law wrote:
On 10/30/2015 02:52 PM, Nathan Sidwell wrote:
This bit of trunk code in cgraph_node::create at around line  500 of
cgraph.c looks wrong.  Specifically the contents of the #ifdef -- it's
uncompilable as there's no 'g'.

  if ((flag_openacc || flag_openmp)
       && lookup_attribute ("omp declare target", DECL_ATTRIBUTES
(decl)))
     {
       node->offloadable = 1;
#ifdef ENABLE_OFFLOADING
       g->have_offload = true;
#endif
     }
Missing #include of context.h.  This was missed because the ptx
backend doesn't
appear in config-list.mk.  I'm looking to see what it would take to
add the ptx
backend right now :-0

Thanks Jeff!
NP. Having the target in config-list.mk is definitely a good thing as it'll be built much more regularly.

I only see two issues.

First HARD_REGNO_NREGS is a constant. This causes grief in ree.c because after macro expansion we don't actually use either of the arguments passed into HARD_REGNO_NREGS:

     machine_mode dst_mode = GET_MODE (SET_DEST (PATTERN (cand->insn)));
      rtx src_reg = get_extended_src_reg (SET_SRC (PATTERN (cand->insn)));

      /* Ensure the number of hard registers of the copy match.  */
      if (HARD_REGNO_NREGS (REGNO (src_reg), dst_mode)
          != HARD_REGNO_NREGS (REGNO (src_reg), GET_MODE (src_reg)))
        return false;

So when we don't use src_reg or dst_mode, we'll get a warning about the unused variable. I guess this is the first port where HARD_REGNO_NREGS is a constant.


This is trivially fixed by indirecting through a function for hard_regno_nregs.


Second, MOVE_MAX is 4. That's causing out-of-bounds array access warnings in various places.

In particular if we look at reload.h we have:

  machine_mode (x_regno_save_mode
                     [FIRST_PSEUDO_REGISTER]
                     [MAX_MOVE_MAX / MIN_UNITS_PER_WORD + 1]);

Which ends up allocating an array as [FIRST_PSEUDO_REGISTER][0]. This runs afoul of caller-save which assumes the array always is always at least FIRST_PSEUDO_REGISTER[1] elements via:

        regno_save_mode[i][1] = VOIDmode;


There were a variety of other problems associated with MOVE_MAX being smaller than a word. If I change MOVE_MAX to 8, then everything is good.

If those two items get fixed, then we can add nvptx-elf to config-list.mk.

jeff

Reply via email to