Hi,

I created a set of scripts that generates predicates.md based on
PREDICATE_CODES in tm.h.  The generated file looks like this:

;; Predicate definitions for FIXME FIXME.
;; Copyright (C) 2005 Free Software Foundation, Inc.
;;
;; This file is part of GCC.
;;
;; :
;; : Usual copyright notice
;; :

;; Return true if OP is a valid source operand for an integer move instruction.

(define_predicate "general_operand_src"
  (match_code 
"const_int,const_double,const,symbol_ref,label_ref,subreg,reg,mem")
{
  if (GET_MODE (op) == mode
      && GET_CODE (op) == MEM
      && GET_CODE (XEXP (op, 0)) == POST_INC)
    return 1;
  return general_operand (op, mode);
})

  :
  : More predicates follow.
  :

1. A copyright is automatically inserted except the port name.

2. A comment for each function is taken from tm.c.

3. The name of a predicate along with codes it accepts are
   automatically taken from PREDICATE_CODES.

4. The C code for a predicate is automatically taken from tm.c.

My scripts will only generate predicate.md.  It does not remove
PREDICATE_CODES from tm.h, predicates from tm.c, or prototypes from
tm-protos.h.  All these are left for your code cleanup pleasure. :-)

Another thing that my scripts won't do is to convert a C-style
predicate to a LISP-style predicate.  My scripts are only meant to
alleviate the mechanical part of the conversion.

Anyway, untar the attachment and run

  predicatecodes.sh h8300

under config/h8300 to generate predicates.md.  Of course, you can
replace h8300 with any port with PREDICATE_CODES.  My scripts are not
robust, so don't blame me if they eat your files.

I might actually start posting patches to convert to predicate.md.

Kazu Hirata

Attachment: conv_predicate_codes.tar.gz
Description: Binary data

Reply via email to