Commit 03dd17b1 by Nathan Froyd

constraints.md: New file.

	* 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.

From-SVN: r190585
parent c42df5ef
2012-08-21 Nathan Froyd <froydnj@gcc.gnu.org> 2012-08-21 Nathan Froyd <froydnj@gcc.gnu.org>
* 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.
2012-08-21 Nathan Froyd <froydnj@gcc.gnu.org>
* config/mep/mep.h (REG_CLASS_FROM_CONSTRAINT): Delete. * config/mep/mep.h (REG_CLASS_FROM_CONSTRAINT): Delete.
(CONST_OK_FOR_LETTER_P, CONST_DOUBLE_OK_FOR_LETTER_P): Delete. (CONST_OK_FOR_LETTER_P, CONST_DOUBLE_OK_FOR_LETTER_P): Delete.
(CONSTRAINT_LEN, EXTRA_CONSTRAINT): Delete. (CONSTRAINT_LEN, EXTRA_CONSTRAINT): Delete.
......
;; 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")
(define_register_constraint "Ral" "TARGET_A24 ? A_REGS : NO_REGS"
"@internal")
(define_register_constraint "Rqi" "QI_REGS"
"@internal")
(define_register_constraint "Rad" "AD_REGS"
"@internal")
(define_register_constraint "Rsi" "SI_REGS"
"@internal")
(define_register_constraint "Rhi" "HI_REGS"
"@internal")
(define_register_constraint "Rhc" "HC_REGS"
"@internal")
(define_register_constraint "Rra" "RA_REGS"
"@internal")
(define_register_constraint "Rfl" "FLG_REGS"
"@internal")
(define_register_constraint "Rmm" "fixed_regs[MEM0_REGNO] ? NO_REGS : MEM_REGS"
"@internal")
(define_register_constraint "Rpi" "TARGET_A16 ? HI_REGS : RA_REGS"
"@internal")
;;; For integer constant constraints:
;;; s=signed u=unsigned n=nonzero m=minus l=log2able,
;;; [sun] bits [SUN] bytes, p=pointer size
;;; I[-0-9][0-9] matches that number
(define_constraint "Is3"
"@internal"
(and (match_code "const_int")
(match_test "IN_RANGE (ival, -8, 7)")))
(define_constraint "IS1"
"@internal"
(and (match_code "const_int")
(match_test "IN_RANGE (ival, -128, 127)")))
(define_constraint "IS2"
"@internal"
(and (match_code "const_int")
(match_test "IN_RANGE (ival, -32768, 32767)")))
(define_constraint "IU2"
"@internal"
(and (match_code "const_int")
(match_test "IN_RANGE (ival, 0, 65535)")))
(define_constraint "IU3"
"@internal"
(and (match_code "const_int")
(match_test "IN_RANGE (ival, 0, 0x00ffffff)")))
(define_constraint "In4"
"@internal"
(and (match_code "const_int")
(match_test "IN_RANGE (ival, -8, 8) && ival")))
(define_constraint "In5"
"@internal"
(and (match_code "const_int")
(match_test "IN_RANGE (ival, -16, 16) && ival")))
(define_constraint "In6"
"@internal"
(and (match_code "const_int")
(match_test "IN_RANGE (ival, -32, 32) && ival")))
(define_constraint "IM2"
"@internal"
(and (match_code "const_int")
(match_test "IN_RANGE (ival, -65536, -1)")))
(define_constraint "Ilb"
"@internal"
(and (match_code "const_int")
(match_test "IN_RANGE (exact_log2 (ival), 0, 7)")))
(define_constraint "Imb"
"@internal"
(and (match_code "const_int")
(match_test "IN_RANGE (exact_log2 ((ival ^ 0xff) & 0xff), 0, 7)")))
(define_constraint "ImB"
"@internal"
(and (match_code "const_int")
(match_test "IN_RANGE (exact_log2 ((ival ^ 0xffff) & 0xffff), 0, 7)")))
(define_constraint "Ilw"
"@internal"
(and (match_code "const_int")
(match_test "IN_RANGE (exact_log2 (ival), 0, 15)")))
(define_constraint "Imw"
"@internal"
(and (match_code "const_int")
(match_test "IN_RANGE (exact_log2 ((ival ^ 0xffff) & 0xffff), 0, 15)")))
(define_constraint "I00"
"@internal"
(and (match_code "const_int")
(match_test "ival == 0")))
(define_memory_constraint "SF"
"@internal"
(match_test "m32c_matches_constraint_p (op, CONSTRAINT_SF)"))
(define_memory_constraint "Sd"
"@internal"
(match_test "m32c_matches_constraint_p (op, CONSTRAINT_Sd)"))
(define_memory_constraint "Sa"
"@internal"
(match_test "m32c_matches_constraint_p (op, CONSTRAINT_Sa)"))
(define_memory_constraint "Si"
"@internal"
(match_test "m32c_matches_constraint_p (op, CONSTRAINT_Si)"))
(define_memory_constraint "Ss"
"@internal"
(match_test "m32c_matches_constraint_p (op, CONSTRAINT_Ss)"))
(define_memory_constraint "Sf"
"@internal"
(match_test "m32c_matches_constraint_p (op, CONSTRAINT_Sf)"))
(define_memory_constraint "Sb"
"@internal"
(match_test "m32c_matches_constraint_p (op, CONSTRAINT_Sb)"))
(define_memory_constraint "Sp"
"@internal"
(match_test "m32c_matches_constraint_p (op, CONSTRAINT_Sp)"))
(define_memory_constraint "S1"
"@internal"
(match_test "m32c_matches_constraint_p (op, CONSTRAINT_S1)"))
(define_constraint "Rpa"
"@internal"
(match_test "m32c_matches_constraint_p (op, CONSTRAINT_Rpa)"))
...@@ -20,21 +20,17 @@ ...@@ -20,21 +20,17 @@
<http://www.gnu.org/licenses/>. */ <http://www.gnu.org/licenses/>. */
void m32c_conditional_register_usage (void); void m32c_conditional_register_usage (void);
int m32c_const_ok_for_constraint_p (HOST_WIDE_INT, char, const char *);
unsigned int m32c_dwarf_frame_regnum (int); unsigned int m32c_dwarf_frame_regnum (int);
int m32c_eh_return_data_regno (int); int m32c_eh_return_data_regno (int);
void m32c_emit_epilogue (void); void m32c_emit_epilogue (void);
void m32c_emit_prologue (void); void m32c_emit_prologue (void);
int m32c_epilogue_uses (int); int m32c_epilogue_uses (int);
int m32c_extra_address_constraint (char, const char *);
int m32c_extra_memory_constraint (char, const char *);
int m32c_function_arg_regno_p (int); int m32c_function_arg_regno_p (int);
void m32c_init_expanders (void); void m32c_init_expanders (void);
int m32c_initial_elimination_offset (int, int); int m32c_initial_elimination_offset (int, int);
void m32c_output_reg_pop (FILE *, int); void m32c_output_reg_pop (FILE *, int);
void m32c_output_reg_push (FILE *, int); void m32c_output_reg_push (FILE *, int);
unsigned int m32c_push_rounding (int); unsigned int m32c_push_rounding (int);
int m32c_reg_class_from_constraint (char, const char *);
void m32c_register_pragmas (void); void m32c_register_pragmas (void);
void m32c_note_pragma_address (const char *, unsigned); void m32c_note_pragma_address (const char *, unsigned);
int m32c_regno_ok_for_base_p (int); int m32c_regno_ok_for_base_p (int);
...@@ -53,8 +49,7 @@ int m32c_expand_movmemhi (rtx *); ...@@ -53,8 +49,7 @@ int m32c_expand_movmemhi (rtx *);
int m32c_expand_movstr (rtx *); int m32c_expand_movstr (rtx *);
void m32c_expand_neg_mulpsi3 (rtx *); void m32c_expand_neg_mulpsi3 (rtx *);
int m32c_expand_setmemhi (rtx *); int m32c_expand_setmemhi (rtx *);
int m32c_extra_constraint_p (rtx, char, const char *); bool m32c_matches_constraint_p (rtx, int);
int m32c_extra_constraint_p2 (rtx, char, const char *);
int m32c_hard_regno_nregs (int, enum machine_mode); int m32c_hard_regno_nregs (int, enum machine_mode);
int m32c_hard_regno_ok (int, enum machine_mode); int m32c_hard_regno_ok (int, enum machine_mode);
bool m32c_illegal_subreg_p (rtx); bool m32c_illegal_subreg_p (rtx);
......
...@@ -405,15 +405,6 @@ enum reg_class ...@@ -405,15 +405,6 @@ enum reg_class
A - addresses (currently unused) A - addresses (currently unused)
*/ */
#define CONSTRAINT_LEN(CHAR,STR) \
((CHAR) == 'I' ? 3 \
: (CHAR) == 'R' ? 3 \
: (CHAR) == 'S' ? 2 \
: (CHAR) == 'A' ? 2 \
: DEFAULT_CONSTRAINT_LEN(CHAR,STR))
#define REG_CLASS_FROM_CONSTRAINT(CHAR,STR) \
(enum reg_class) m32c_reg_class_from_constraint (CHAR, STR)
#define REGNO_OK_FOR_BASE_P(NUM) m32c_regno_ok_for_base_p (NUM) #define REGNO_OK_FOR_BASE_P(NUM) m32c_regno_ok_for_base_p (NUM)
#define REGNO_OK_FOR_INDEX_P(NUM) 0 #define REGNO_OK_FOR_INDEX_P(NUM) 0
...@@ -427,16 +418,6 @@ enum reg_class ...@@ -427,16 +418,6 @@ enum reg_class
#define CANNOT_CHANGE_MODE_CLASS(F,T,C) m32c_cannot_change_mode_class(F,T,C) #define CANNOT_CHANGE_MODE_CLASS(F,T,C) m32c_cannot_change_mode_class(F,T,C)
#define CONST_OK_FOR_CONSTRAINT_P(VALUE,C,STR) \
m32c_const_ok_for_constraint_p (VALUE, C, STR)
#define CONST_DOUBLE_OK_FOR_CONSTRAINT_P(VALUE,C,STR) 0
#define EXTRA_CONSTRAINT_STR(VALUE,C,STR) \
m32c_extra_constraint_p (VALUE, C, STR)
#define EXTRA_MEMORY_CONSTRAINT(C,STR) \
m32c_extra_memory_constraint (C, STR)
#define EXTRA_ADDRESS_CONSTRAINT(C,STR) \
m32c_extra_address_constraint (C, STR)
/* STACK AND CALLING */ /* STACK AND CALLING */
/* Frame Layout */ /* Frame Layout */
......
...@@ -183,12 +183,12 @@ ...@@ -183,12 +183,12 @@
; TRUE for memory operands that are not indexed ; TRUE for memory operands that are not indexed
(define_predicate "memsym_operand" (define_predicate "memsym_operand"
(and (match_operand 0 "memory_operand" "") (and (match_operand 0 "memory_operand" "")
(match_test "m32c_extra_constraint_p (op, 'S', \"Si\")"))) (match_test "satisfies_constraint_Si (op)")))
; TRUE for memory operands with small integer addresses ; TRUE for memory operands with small integer addresses
(define_predicate "memimmed_operand" (define_predicate "memimmed_operand"
(and (match_operand 0 "memory_operand" "") (and (match_operand 0 "memory_operand" "")
(match_test "m32c_extra_constraint_p (op, 'S', \"Sp\")"))) (match_test "satisfies_constraint_Sp (op)")))
; TRUE for r1h. This is complicated since r1h isn't a register GCC ; TRUE for r1h. This is complicated since r1h isn't a register GCC
; normally knows about. ; normally knows about.
...@@ -274,22 +274,22 @@ ...@@ -274,22 +274,22 @@
; TRUE for constants we can multiply pointers by ; TRUE for constants we can multiply pointers by
(define_predicate "m32c_psi_scale" (define_predicate "m32c_psi_scale"
(and (match_operand 0 "const_int_operand") (and (match_operand 0 "const_int_operand")
(match_test "m32c_const_ok_for_constraint_p(INTVAL(op), 'I', \"Ilb\")"))) (match_test "satisfies_constraint_Ilb (op)")))
; TRUE for one bit set (bit) or clear (mask) out of N bits. ; TRUE for one bit set (bit) or clear (mask) out of N bits.
(define_predicate "m32c_1bit8_operand" (define_predicate "m32c_1bit8_operand"
(and (match_operand 0 "const_int_operand") (and (match_operand 0 "const_int_operand")
(match_test "m32c_const_ok_for_constraint_p(INTVAL(op), 'I', \"Ilb\")"))) (match_test "satisfies_constraint_Ilb (op)")))
(define_predicate "m32c_1bit16_operand" (define_predicate "m32c_1bit16_operand"
(and (match_operand 0 "const_int_operand") (and (match_operand 0 "const_int_operand")
(match_test "m32c_const_ok_for_constraint_p(INTVAL(op), 'I', \"Ilw\")"))) (match_test "satisfies_constraint_Ilw (op)")))
(define_predicate "m32c_1mask8_operand" (define_predicate "m32c_1mask8_operand"
(and (match_operand 0 "const_int_operand") (and (match_operand 0 "const_int_operand")
(match_test "m32c_const_ok_for_constraint_p(INTVAL(op), 'I', \"ImB\")"))) (match_test "satisfies_constraint_ImB (op)")))
(define_predicate "m32c_1mask16_operand" (define_predicate "m32c_1mask16_operand"
(and (match_operand 0 "const_int_operand") (and (match_operand 0 "const_int_operand")
(match_test "m32c_const_ok_for_constraint_p(INTVAL(op), 'I', \"Imw\")"))) (match_test "satisfies_constraint_Imw (op)")))
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
md_file = md md_file = md
MD_FILES = m32c predicates addsub bitops blkmov cond jump minmax mov muldiv prologue shift MD_FILES = m32c constraints predicates addsub bitops blkmov cond jump minmax mov muldiv prologue shift
# Doing it this way lets the gen* programs report the right line numbers. # Doing it this way lets the gen* programs report the right line numbers.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment