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: PR middle-end/28779


Jan Hubicka wrote:

This patch fixes it by making logic similar to what expand_call does:
using declaration arguments first, if not avaialble declaration type, if
not call type and actual arguments otherwise. All these steps are
needed as our in-place duplicate_decls causes slight type mismatches
here, so what should be all the same might be actually slightly
different.

I think this logic is sound, but I wonder if there is a way to factor that out to common code? What you're doing is getting a bunch of argument types (by one mechanism or another), and then computing a cost for each of them.


At last for the first two cases (where you are using either DECL_ARGUMENTS or TYPE_ARG_TYPES), you don't need any information about the actual call arguments. It's inconvenient that the information is in TREE_TYPE for DECL_ARGUMENTS and TREE_VALUE for TYPE_ARG_TYPES, but we could still do something like:

  bool for_each_arg (tree fn,
                     void (*f)(tree type, void *data),
                     void *data)
  {
     if (DECL_ARGUMENTS (fn))
       {
          for (arg = DECL_ARGUMENTS (fn) ...)
            f(TREE_TYPE (arg), data);
          return true;
       }
     else if (TREE_TYPE (fn) && prototype_p (TREE_TYPE (fn))
       {
          ...
          return true;
       }

     return false;
  }

This isn't a big deal, but this is a nasty bit of logic, and it seems like we should try to put it in a well-defined place for use and reuse...

--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


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