Re: [PATCH] convert m32c to constraints.md

2012-08-20 Thread DJ Delorie

I ran the testsuite for you; no regressions.  Looks OK to me, please
apply.  Thanks!


[PATCH] convert m32c to constraints.md

2012-08-17 Thread Nathan Froyd
As $SUBJECT suggests.

I haven't tested this.  It's possible my dejagnu installation is too old
and/or I have forgotten many subtleties for testing embedded targets,
but I could not make m32c-sim work and I didn't want to spend an
enormous amount of time making it work.

Nonetheless, I have compared assembly for libgcc and newlib on unpatched
and patched compilers and they are identical, so that is encouraging.

I suppose transferring the documentation from doc/md.texi to
constraints.md would be good.  I'd beg leaving that for a followup,
please.

m32c is the last machine (pending committal of the mmix constraints.md
patch) to be converted to constraints.md.  I suppose there is some
cleanup to come surrounding the constraints support; if anybody has bold
plans for what needs work, I'd be happy to hear them out.

OK to commit?

-Nathan

* config/m32c/constraints.md: New file.
* config/m32c/t-m32c (MD_FILES): Add constraints.
* config/m32c/m32c-protos.h (m32c_const_ok_for_constraint_p): Delete.
(m32c_extra_address_constraint, m32c_extra_memory_constraint): Delete.
(m32c_reg_class_from_constraint): Delete.
(m32c_extra_constraint_p, m32c_extra_constraint_p2): Delete.
(m32c_matches_constraint_p): Declare.
* config/m32c/m32c.h (CONSTRAINT_LEN): Delete.
(REG_CLASS_FROM_CONSTRAINT): Delete.
(CONST_OK_FOR_CONSTRAINT_P): Delete.
(CONST_DOUBLE_OK_FOR_CONSTRAINT_P): Delete.
(EXTRA_CONSTRAINT_STR): Delete.
(EXTRA_MEMORY_CONSTRAINT, EXTRA_ADDRESS_CONSTRAINT): Delete.
* config/m32c/m32c.c: Include tm-constrs.h
(m32c_reg_class_from_constraint): Delete.
(m32c_const_ok_for_constraint_p): Delete.
(m32c_extra_constraint_p2): Rename to...
(m32c_matches_constraint_p): ...this.  Make it return bool.  Tweak
formatting.
(m32c_extra_constraint_p): Delete.
(m32c_extra_address_constraint, m32c_extra_memory_constraint): Delete.
(m32c_split_move): Use satisfies_constraint_Ss.
* config/m32c/predicates.md (memsym_operand): Use 
satisfies_constraint_Si.
(memimmed_operand): Use satisfies_constraint_Sp.
(m32c_psi_scale, m32c_1bit8_operand): Use satisfies_constraint_Ilb.
(m32c_1bit16_operand): Use satisfies_constraint_Ilw.
(m32c_1mask8_operand): Use satisfies_constraint_ImB.
(m32c_1mask16_operand): Use satisfies_constraint_Imw.

---
 gcc/config/m32c/constraints.md |  225 
 gcc/config/m32c/m32c-protos.h  |7 +-
 gcc/config/m32c/m32c.c |  322 +++-
 gcc/config/m32c/m32c.h |   19 ---
 gcc/config/m32c/predicates.md  |   14 +-
 gcc/config/m32c/t-m32c |2 +-
 6 files changed, 286 insertions(+), 303 deletions(-)
 create mode 100644 gcc/config/m32c/constraints.md

diff --git a/gcc/config/m32c/constraints.md b/gcc/config/m32c/constraints.md
new file mode 100644
index 000..da7dda4
--- /dev/null
+++ b/gcc/config/m32c/constraints.md
@@ -0,0 +1,225 @@
+;; m32c constraints
+;; Copyright (C) 2012 Free Software Foundation, Inc.
+;;
+;; This file is part of GCC.
+;;
+;; GCC is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+;;
+;; GCC is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+;; License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GCC; see the file COPYING3.  If not see
+;; http://www.gnu.org/licenses/.
+
+(define_register_constraint Rsp SP_REGS
+  @internal)
+
+(define_register_constraint Rfb FB_REGS
+  @internal)
+
+(define_register_constraint Rsb SB_REGS
+  @internal)
+
+(define_register_constraint Rcr TARGET_A16 ? CR_REGS : NO_REGS
+  @internal)
+
+(define_register_constraint Rcl TARGET_A24 ? CR_REGS : NO_REGS
+  @internal)
+
+(define_register_constraint R0w R0_REGS
+  @internal)
+
+(define_register_constraint R1w R1_REGS
+  @internal)
+
+(define_register_constraint R2w R2_REGS
+  @internal)
+
+(define_register_constraint R3w R3_REGS
+  @internal)
+
+(define_register_constraint R02 R02_REGS
+  @internal)
+
+(define_register_constraint R13 R13_REGS
+  @internal)
+
+(define_register_constraint R03 R03_REGS
+  @internal)
+
+(define_register_constraint Rdi DI_REGS
+  @internal)
+
+(define_register_constraint Rhl HL_REGS
+  @internal)
+
+(define_register_constraint R23 R23_REGS
+  @internal)
+
+(define_register_constraint Ra0 A0_REGS
+  @internal)
+
+(define_register_constraint Ra1 A1_REGS
+  @internal)
+
+(define_register_constraint Raa A_REGS
+  @internal)
+
+(define_register_constraint Raw TARGET_A16 ? A_REGS : NO_REGS
+  @internal)
+