From: Richard Sandiford <richard.sandiford@arm.com>
To: gcc-patches@gcc.gnu.org
Cc: vmakarov@redhat.com, ubizjak@gmail.com, markus@trippelsdorf.de,
Ganesh.Gopalasubramanian@amd.com
Subject: [PATCH 1/5] Add recog_constrain_insn
Date: Fri, 17 Oct 2014 14:48:00 -0000 [thread overview]
Message-ID: <874mv2bvnt.fsf@e105548-lin.cambridge.arm.com> (raw)
In-Reply-To: <87bnpabvvx.fsf@e105548-lin.cambridge.arm.com> (Richard Sandiford's message of "Fri, 17 Oct 2014 15:42:26 +0100")
This patch just adds a new utility function called recog_constrain_insn,
to go alongside the existing recog_constrain_insn_cached.
Note that the extract_insn in lra.c wasn't used when checking is disabled.
The function just moved on to the next instruction straight away.
Richard
gcc/
* recog.h (extract_constrain_insn): Declare.
* recog.c (extract_constrain_insn): New function.
* lra.c (check_rtl): Use it.
* postreload.c (reload_cse_simplify_operands): Likewise.
* reg-stack.c (check_asm_stack_operands): Likewise.
(subst_asm_stack_regs): Likewise.
* regcprop.c (copyprop_hardreg_forward_1): Likewise.
* regrename.c (build_def_use): Likewise.
* sel-sched.c (get_reg_class): Likewise.
* config/arm/arm.c (note_invalid_constants): Likewise.
* config/s390/predicates.md (execute_operation): Likewise.
Index: gcc/recog.h
===================================================================
--- gcc/recog.h 2014-09-18 11:40:31.223690858 +0100
+++ gcc/recog.h 2014-10-17 15:44:50.219398486 +0100
@@ -134,6 +134,7 @@ extern void add_clobbers (rtx, int);
extern int added_clobbers_hard_reg_p (int);
extern void insn_extract (rtx_insn *);
extern void extract_insn (rtx_insn *);
+extern void extract_constrain_insn (rtx_insn *insn);
extern void extract_constrain_insn_cached (rtx_insn *);
extern void extract_insn_cached (rtx_insn *);
extern void preprocess_constraints (int, int, const char **,
Index: gcc/recog.c
===================================================================
--- gcc/recog.c 2014-09-22 08:36:23.889794255 +0100
+++ gcc/recog.c 2014-10-17 15:44:50.219398486 +0100
@@ -2110,6 +2110,17 @@ extract_insn_cached (rtx_insn *insn)
recog_data.insn = insn;
}
+/* Do uncached extract_insn, constrain_operands and complain about failures.
+ This should be used when extracting a pre-existing constrained instruction
+ if the caller wants to know which alternative was chosen. */
+void
+extract_constrain_insn (rtx_insn *insn)
+{
+ extract_insn (insn);
+ if (!constrain_operands (reload_completed))
+ fatal_insn_not_found (insn);
+}
+
/* Do cached extract_insn, constrain_operands and complain about failures.
Used by insn_attrtab. */
void
Index: gcc/lra.c
===================================================================
--- gcc/lra.c 2014-09-26 16:05:57.868394574 +0100
+++ gcc/lra.c 2014-10-17 15:44:50.219398486 +0100
@@ -1919,8 +1919,9 @@ check_rtl (bool final_p)
{
if (final_p)
{
- extract_insn (insn);
- lra_assert (constrain_operands (1));
+#ifdef ENABLED_CHECKING
+ extract_constrain_insn (insn);
+#endif
continue;
}
/* LRA code is based on assumption that all addresses can be
Index: gcc/postreload.c
===================================================================
--- gcc/postreload.c 2014-08-26 12:09:02.182959856 +0100
+++ gcc/postreload.c 2014-10-17 15:44:50.219398486 +0100
@@ -401,15 +401,11 @@ reload_cse_simplify_operands (rtx_insn *
/* Array of alternatives, sorted in order of decreasing desirability. */
int *alternative_order;
- extract_insn (insn);
+ extract_constrain_insn (insn);
if (recog_data.n_alternatives == 0 || recog_data.n_operands == 0)
return 0;
- /* Figure out which alternative currently matches. */
- if (! constrain_operands (1))
- fatal_insn_not_found (insn);
-
alternative_reject = XALLOCAVEC (int, recog_data.n_alternatives);
alternative_nregs = XALLOCAVEC (int, recog_data.n_alternatives);
alternative_order = XALLOCAVEC (int, recog_data.n_alternatives);
Index: gcc/reg-stack.c
===================================================================
--- gcc/reg-stack.c 2014-09-18 11:40:31.307689884 +0100
+++ gcc/reg-stack.c 2014-10-17 15:44:50.219398486 +0100
@@ -469,8 +469,7 @@ check_asm_stack_operands (rtx_insn *insn
/* Find out what the constraints require. If no constraint
alternative matches, this asm is malformed. */
- extract_insn (insn);
- constrain_operands (1);
+ extract_constrain_insn (insn);
preprocess_constraints (insn);
@@ -2016,8 +2015,7 @@ subst_asm_stack_regs (rtx_insn *insn, st
/* Find out what the constraints required. If no constraint
alternative matches, that is a compiler bug: we should have caught
such an insn in check_asm_stack_operands. */
- extract_insn (insn);
- constrain_operands (1);
+ extract_constrain_insn (insn);
preprocess_constraints (insn);
const operand_alternative *op_alt = which_op_alt ();
Index: gcc/regcprop.c
===================================================================
--- gcc/regcprop.c 2014-10-13 08:02:41.225135081 +0100
+++ gcc/regcprop.c 2014-10-17 15:44:50.227398391 +0100
@@ -762,9 +762,7 @@ copyprop_hardreg_forward_1 (basic_block
}
set = single_set (insn);
- extract_insn (insn);
- if (! constrain_operands (1))
- fatal_insn_not_found (insn);
+ extract_constrain_insn (insn);
preprocess_constraints (insn);
const operand_alternative *op_alt = which_op_alt ();
n_ops = recog_data.n_operands;
@@ -865,9 +863,7 @@ copyprop_hardreg_forward_1 (basic_block
}
/* We need to re-extract as validate_change clobbers
recog_data. */
- extract_insn (insn);
- if (! constrain_operands (1))
- fatal_insn_not_found (insn);
+ extract_constrain_insn (insn);
preprocess_constraints (insn);
}
@@ -893,9 +889,7 @@ copyprop_hardreg_forward_1 (basic_block
}
/* We need to re-extract as validate_change clobbers
recog_data. */
- extract_insn (insn);
- if (! constrain_operands (1))
- fatal_insn_not_found (insn);
+ extract_constrain_insn (insn);
preprocess_constraints (insn);
}
}
Index: gcc/regrename.c
===================================================================
--- gcc/regrename.c 2014-08-26 12:08:57.679011819 +0100
+++ gcc/regrename.c 2014-10-17 15:44:50.227398391 +0100
@@ -1564,9 +1564,7 @@ build_def_use (basic_block bb)
to be marked unrenamable or even cause us to abort the entire
basic block. */
- extract_insn (insn);
- if (! constrain_operands (1))
- fatal_insn_not_found (insn);
+ extract_constrain_insn (insn);
preprocess_constraints (insn);
const operand_alternative *op_alt = which_op_alt ();
n_ops = recog_data.n_operands;
Index: gcc/sel-sched.c
===================================================================
--- gcc/sel-sched.c 2014-09-18 11:40:31.163691553 +0100
+++ gcc/sel-sched.c 2014-10-17 15:44:50.227398391 +0100
@@ -994,9 +994,7 @@ get_reg_class (rtx_insn *insn)
{
int i, n_ops;
- extract_insn (insn);
- if (! constrain_operands (1))
- fatal_insn_not_found (insn);
+ extract_constrain_insn (insn);
preprocess_constraints (insn);
n_ops = recog_data.n_operands;
Index: gcc/config/arm/arm.c
===================================================================
--- gcc/config/arm/arm.c 2014-09-22 08:36:24.541786033 +0100
+++ gcc/config/arm/arm.c 2014-10-17 15:44:50.215398533 +0100
@@ -17022,10 +17022,7 @@ note_invalid_constants (rtx_insn *insn,
{
int opno;
- extract_insn (insn);
-
- if (!constrain_operands (1))
- fatal_insn_not_found (insn);
+ extract_constrain_insn (insn);
if (recog_data.n_alternatives == 0)
return;
Index: gcc/config/s390/predicates.md
===================================================================
--- gcc/config/s390/predicates.md 2014-09-12 08:26:02.847292053 +0100
+++ gcc/config/s390/predicates.md 2014-10-17 15:44:50.219398486 +0100
@@ -406,8 +406,7 @@ (define_special_predicate "execute_opera
if (icode < 0)
return false;
- extract_insn (insn);
- constrain_operands (1);
+ extract_constrain_insn (insn);
return which_alternative >= 0;
})
next prev parent reply other threads:[~2014-10-17 14:47 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-17 14:47 [PATCH 0/5] Add preferred_for_{size,speed} attributes Richard Sandiford
2014-10-17 14:48 ` Richard Sandiford [this message]
2014-10-21 14:56 ` [PATCH 1/5] Add recog_constrain_insn Vladimir Makarov
2014-10-21 15:45 ` Jeff Law
2014-10-17 14:51 ` [PATCH 2/5] Add preferred_for_{size,speed} attributes Richard Sandiford
2014-10-21 14:57 ` Vladimir Makarov
2014-10-21 17:34 ` Jeff Law
2015-08-03 14:54 ` H.J. Lu
2014-10-17 14:52 ` [PATCH 3/5] Pass an alternative_mask to constrain_operands Richard Sandiford
2014-10-21 15:36 ` Vladimir Makarov
2014-10-21 17:46 ` Jeff Law
2014-10-17 14:55 ` [PATCH 4/5] Remove recog_data.enabled_alternatives Richard Sandiford
2014-10-21 14:57 ` Vladimir Makarov
2014-10-21 15:35 ` Jeff Law
2014-10-17 14:58 ` [PATCH 5/5] Use preferred_for_speed in i386.md Richard Sandiford
2014-10-17 16:59 ` Uros Bizjak
2014-10-21 15:08 ` Vladimir Makarov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874mv2bvnt.fsf@e105548-lin.cambridge.arm.com \
--to=richard.sandiford@arm.com \
--cc=Ganesh.Gopalasubramanian@amd.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=markus@trippelsdorf.de \
--cc=ubizjak@gmail.com \
--cc=vmakarov@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).