;; Constraint definitions for Renesas H8/300. ;; Copyright (C) 2011-2014 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 ;; . ;; Register constraints. (define_register_constraint "a" "MAC_REGS" "@internal") (define_register_constraint "c" "COUNTER_REGS" "@internal") ;; Some patterns need to use er6 as a scratch register. This is ;; difficult to arrange since er6 is the frame pointer and usually can't ;; be spilled. ;; Such patterns should define two alternatives, one which allows only ;; er6 and one which allows any general register. The former ;; alternative should have a 'd' constraint while the latter should be ;; disparaged and use 'D'. ;; Normally, 'd' maps to DESTINATION_REGS and 'D' maps to GENERAL_REGS. ;; However, there are cases where they should be NO_REGS: ;; - 'd' should be NO_REGS when reloading a function that uses the ;; frame pointer. In this case, DESTINATION_REGS won't contain any ;; spillable registers, so the first alternative can't be used. ;; - -fno-omit-frame-pointer means that the frame pointer will ;; always be in use. It's therefore better to map 'd' to NO_REGS ;; before reload so that register allocator will pick the second ;; alternative. ;; - we would like 'D' to be be NO_REGS when the frame pointer isn't ;; live, but we the frame pointer may turn out to be needed after ;; we start reload, and then we may have already decided we don't ;; have a choice, so we can't do that. Forcing the register ;; allocator to use er6 if possible might produce better code for ;; small functions: it's more efficient to save and restore er6 in ;; the prologue & epilogue than to do it in a define_split. ;; Hopefully disparaging 'D' will have a similar effect, without ;; forcing a reload failure if the frame pointer is found to be ;; needed too late. (define_register_constraint "d" "(!flag_omit_frame_pointer && !reload_completed ? NO_REGS : (frame_pointer_needed && reload_in_progress ? NO_REGS : DESTINATION_REGS))" "@internal") (define_register_constraint "D" "GENERAL_REGS" "@internal") (define_register_constraint "f" "SOURCE_REGS" "@internal") ;; Integer constraints. (define_constraint "I" "Integer zero." (and (match_code "const_int") (match_test "ival == 0"))) (define_constraint "J" "An integer with its low byte clear." (and (match_code "const_int") (match_test "(ival & 0xff) == 0"))) (define_constraint "L" "1, 2 or 4 on the H8300H or S; 1 or 2 otherwise." (and (match_code "const_int") (if_then_else (match_test "TARGET_H8300H || TARGET_H8300S") (match_test "ival == 1 || ival == 2 || ival == 4") (match_test "ival == 1 || ival == 2")))) (define_constraint "M" "Integer 1 or 2." (and (match_code "const_int") (match_test "ival == 1 || ival == 2"))) (define_constraint "N" "-1, -2, or -4 on the H8300H or S; -1 or -2 otherwise." (and (match_code "const_int") (if_then_else (match_test "TARGET_H8300H || TARGET_H8300S") (match_test "ival == -1 || ival == -2 || ival == -4") (match_test "ival == -1 || ival == -2")))) (define_constraint "O" "Integer -1 or -2." (and (match_code "const_int") (match_test "ival == -1 || ival == -2"))) (define_constraint "P1>X" "A positive, non-zero integer that fits in 1 bits." (and (match_code "const_int") (match_test "TARGET_H8300SX") (match_test "IN_RANGE (ival, 1, (1 << 1) - 1)"))) (define_constraint "P3>X" "A positive, non-zero integer that fits in 3 bits." (and (match_code "const_int") (match_test "TARGET_H8300SX") (match_test "IN_RANGE (ival, 1, (1 << 3) - 1)"))) (define_constraint "P4>X" "A positive, non-zero integer that fits in 4 bits." (and (match_code "const_int") (match_test "TARGET_H8300SX") (match_test "IN_RANGE (ival, 1, (1 << 4) - 1)"))) (define_constraint "P5>X" "A positive, non-zero integer that fits in 5 bits." (and (match_code "const_int") (match_test "TARGET_H8300SX") (match_test "IN_RANGE (ival, 1, (1 << 5) - 1)"))) (define_constraint "P8>X" "A positive, non-zero integer that fits in 8 bits." (and (match_code "const_int") (match_test "TARGET_H8300SX") (match_test "IN_RANGE (ival, 1, (1 << 8) - 1)"))) (define_constraint "P3