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: define_constraints patch, re-revised


On Sun, Oct 01, 2006 at 08:19:49AM -0700, Zack Weinberg wrote:
> On 9/30/06, Rask Ingemann Lambertsen <rask@sygehus.dk> wrote:

> >; Supported immediate operands for "push".
> >(define_constraint      "Ipu"
> >        "A constant usable with the @code{push} instruction."
> >   (and (match_code "const_int")
> >        (match_test "TARGET_18x ? true : false")))

> This should be impossible.  The boilerplate logic generated at the top
> of each satisfies_constraint_XXX function unconditionally uses the
> "op" parameter, and so does the code generated for (match_code
> "const_int").  I would like to see the relevant excerpt of
> tm-constrs.h, please.

static inline bool
satisfies_constraint_Ipu (rtx op)
{
  return 
#line 95 "../../../cvssrc/gcc/gcc/config/ia16/constraints.md"
(TARGET_18x ? true : false);

#line 147 "/mnt/sysfs/rask/cvsbuild/gcc/gcc/tm-constrs.h"
}
#endif /* tm-constrs.h */

   Also, isn't the function supposed to return false if the match_code test
fails? A clean checkout of revision 117331 (this week's snapshot) gives this
for i686-pc-linux-gnu:

/* Generated automatically by the program 'build/genpreds'
   from the machine description file '../../../cvssrc/clean-gcc/gcc/config/i386/i386.md'.  */

#ifndef GCC_TM_CONSTRS_H
#define GCC_TM_CONSTRS_H

static inline bool
satisfies_constraint_I (rtx op)
{
  HOST_WIDE_INT ival = 0;
  if (GET_CODE (op) == CONST_INT)
    ival = INTVAL (op);
  return 
#line 93 "../../../cvssrc/clean-gcc/gcc/config/i386/constraints.md"
(ival >= 0 && ival <= 31);
}
[cut]

   If it isn't missing

     ival = INTVAL (op);
+  else
+    return false;
   return 

then I haven't understood how it is supposed to work. The constraint is
defined like this:

;; Integer constant constraints.
(define_constraint "I"
  "Integer constant in the range 0 @dots{} 31, for 32-bit shifts."
  (and (match_code "const_int")
       (match_test "ival >= 0 && ival <= 31")))

-- 
Rask Ingemann Lambertsen


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