This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][ARM][committed] Add comment in arm_legitimize_reload_address to discourage use of plus_constant


Hi all,

I've committed the attached patch to make it mode clear why we use gen_rtx_PLUS instead of plus_constant in that particular instance.

Committed as obvious with r203106.

Kyrill

2013-10-02  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

    * config/arm/arm.c (arm_legitimize_reload_address): Explain why
    plus_constant is not used.
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index e23e29a..2f1e0b8 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -7547,7 +7547,11 @@ arm_legitimize_reload_address (rtx *p,
 	return false;
 
       /* Reload the high part into a base reg; leave the low part
-	 in the mem.  */
+	 in the mem.
+	 Note that replacing this gen_rtx_PLUS with plus_constant is
+	 wrong in this case because we rely on the
+	 (plus (plus reg c1) c2) structure being preserved so that
+	 XEXP (*p, 0) in push_reload below uses the correct term.  */
       *p = gen_rtx_PLUS (GET_MODE (*p),
 			 gen_rtx_PLUS (GET_MODE (*p), XEXP (*p, 0),
 				       GEN_INT (high)),

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]