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]

Re: [PATCH] gcc/reload.c: Initialize several arrays before use them in find_reloads()


On 02/23/15 18:33, Chen Gang S wrote:
On 2/24/15 07:14, Jeff Law wrote:
On 02/23/15 16:09, Steven Bosscher wrote:


Which violate the rule for matching constraints.

...and should never have worked at all...
Yup.  It's only been fairly recently that we started statically
checking MD files in any significant way -- we've still got a long
way to go I'm sure.


OK, thanks. I shall try to finish within this month (although I am
not quite sure whether I can finish on time).
No problem.  Any contribution you can make in this area is appreciated.

OK, thanks. May I firstly finish it before fixing xtensa pattern?  I
guess it is more easier than fixing xtensa patten. (I guess 'warming'
is 'warning'.)
You can tackle them in any order you wish. However, I suspect fixing the xtensa backend may be easier. I don't have any good way to test xtensa, but something like the attached patch for the xtensa port should be sufficient.



By the way, can this patch "initialize several arrays before use them
in find_reloads()" will cause correctness issue? (I guess not, it
will skip optimization, but not cause correctness issue, and continue
compiling).
It will not cause any correctness issues, but it will cause unwanted/unnecessary initialization of those arrays each time we enter that function.

diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md
index 9c2afad..ccaa2b2 100644
--- a/gcc/config/xtensa/xtensa.md
+++ b/gcc/config/xtensa/xtensa.md
@@ -1290,11 +1290,11 @@
 
 (define_insn "zero_cost_loop_start"
   [(set (pc)
-        (if_then_else (ne (match_operand:SI 0 "register_operand" "2")
+        (if_then_else (ne (match_operand:SI 2 "register_operand" "0")
                           (const_int 1))
                       (label_ref (match_operand 1 "" ""))
                       (pc)))
-   (set (match_operand:SI 2 "register_operand" "=a")
+   (set (match_operand:SI 0 "register_operand" "=a")
         (plus (match_dup 0)
               (const_int -1)))
    (unspec [(const_int 0)] UNSPEC_LSETUP_START)]
@@ -1306,11 +1306,11 @@
 
 (define_insn "zero_cost_loop_end"
   [(set (pc)
-        (if_then_else (ne (match_operand:SI 0 "nonimmediate_operand" "2,2")
+        (if_then_else (ne (match_operand:SI 2 "nonimmediate_operand" "0,0")
                           (const_int 1))
                       (label_ref (match_operand 1 "" ""))
                       (pc)))
-   (set (match_operand:SI 2 "nonimmediate_operand" "=a,m")
+   (set (match_operand:SI 0 "nonimmediate_operand" "=a,m")
         (plus (match_dup 0)
               (const_int -1)))
    (unspec [(const_int 0)] UNSPEC_LSETUP_END)
@@ -1323,11 +1323,11 @@
 
 (define_insn "loop_end"
   [(set (pc)
-        (if_then_else (ne (match_operand:SI 0 "register_operand" "2")
+        (if_then_else (ne (match_operand:SI 2 "register_operand" "0")
                           (const_int 1))
                       (label_ref (match_operand 1 "" ""))
                       (pc)))
-   (set (match_operand:SI 2 "register_operand" "=a")
+   (set (match_operand:SI 0 "register_operand" "=a")
         (plus (match_dup 0)
               (const_int -1)))
    (unspec [(const_int 0)] UNSPEC_LSETUP_END)]

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