public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fix Blackfin MI thunks
@ 2007-02-27 16:29 Bernd Schmidt
  2007-02-28 12:27 ` Bernd Schmidt
  0 siblings, 1 reply; 2+ messages in thread
From: Bernd Schmidt @ 2007-02-27 16:29 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 474 bytes --]

We were using R2 as a scratch register, which is unfortunate since it's 
the third argument register.  Changed to R3, committed as 122376. 
Interestingly this wasn't caught by the g++ testsuite and showed up in a 
larger application.


Bernd
-- 
This footer brought to you by insane German lawmakers.
Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
Registergericht Muenchen HRB 40368
Geschaeftsfuehrer Thomas Wessel, Vincent Roche, Joseph E. McDonough

[-- Attachment #2: mithunk-scratch.diff --]
[-- Type: text/plain, Size: 947 bytes --]

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 122374)
+++ ChangeLog	(working copy)
@@ -43,6 +43,9 @@
 	* config/bfin/bfin.md (ssashiftv2hi3, ssashifthi3, lshiftv2hi3,
 	lshifthi3): Fix output template to use half reg for operand 2.
 
+	* config/bfin/bfin.c (bfin_output_mi_thunk): Use R3 as scratch reg
+	instead of R2.
+
 2007-02-27  Andreas Schwab  <schwab@suse.de>
 
 	* Makefile.in (TEXI_GCCINSTALL_FILES): Add gcc-common.texi.
Index: config/bfin/bfin.c
===================================================================
--- config/bfin/bfin.c	(revision 122372)
+++ config/bfin/bfin.c	(working copy)
@@ -4556,7 +4556,7 @@ bfin_output_mi_thunk (FILE *file ATTRIBU
   if (vcall_offset)
     {
       rtx p2tmp = gen_rtx_REG (Pmode, REG_P2);
-      rtx tmp = gen_rtx_REG (Pmode, REG_R2);
+      rtx tmp = gen_rtx_REG (Pmode, REG_R3);
 
       xops[1] = tmp;
       xops[2] = p2tmp;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Fix Blackfin MI thunks
  2007-02-27 16:29 Fix Blackfin MI thunks Bernd Schmidt
@ 2007-02-28 12:27 ` Bernd Schmidt
  0 siblings, 0 replies; 2+ messages in thread
From: Bernd Schmidt @ 2007-02-28 12:27 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 793 bytes --]

Bernd Schmidt wrote:
> We were using R2 as a scratch register, which is unfortunate since it's 
> the third argument register.  Changed to R3, committed as 122376. 
> Interestingly this wasn't caught by the g++ testsuite and showed up in a 
> larger application.

I've also checked in a new testcase for this.  It's probably more 
complicated than it needs to be; instead of trying to think about in 
which cases we use thunks, I just added stuff until the testcase failed 
(without the previous patch).

Committed after regression testing on bfin-elf.


Bernd
-- 
This footer brought to you by insane German lawmakers.
Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
Registergericht Muenchen HRB 40368
Geschaeftsfuehrer Thomas Wessel, Vincent Roche, Joseph E. McDonough

[-- Attachment #2: thunk7.diff --]
[-- Type: text/plain, Size: 1508 bytes --]

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 122395)
+++ ChangeLog	(working copy)
@@ -1,3 +1,7 @@
+2007-02-28  Bernd Schmidt  <bernd.schmidt@analog.com>
+
+	* g++.dg/inherit/thunk7.C: New test.
+
 2007-02-27  Uros Bizjak  <ubizjak@gmail.com>
 
 	PR target/30970
Index: g++.dg/inherit/thunk7.C
===================================================================
--- g++.dg/inherit/thunk7.C	(revision 0)
+++ g++.dg/inherit/thunk7.C	(revision 0)
@@ -0,0 +1,55 @@
+// { dg-do run }
+
+#include <stdlib.h>
+
+class A
+{
+    int a, b;
+public:
+    virtual void foo (int a, int b, int c, int d);
+};
+
+class B
+{
+    int c, d;
+public:
+    virtual void bar (int a, int b, int c, int d);
+};
+
+class D : public virtual A, public virtual B
+{
+    int e, f;
+};
+
+void A::foo(int a, int b, int c, int d)
+{
+    if (a != 1 || b != 2 || c != 3 || d != 4)
+	abort ();
+}
+
+void B::bar (int a, int b, int c, int d)
+{
+    if (a != 5 || b != 6 || c != 7 || d != 8)
+	abort ();
+}
+
+class C: private D, public virtual A, public virtual B
+{
+public:
+    virtual void foo (int a, int b, int c, int d) { A::foo (a, b, c, d); D::A::foo (a, b, c, d); }
+    virtual void bar (int a, int b, int c, int d) { B::bar (a, b, c, d); D::B::bar (a, b, c, d); }
+};
+
+C c1;
+C *c2 = &c1;
+A *c3 = &c1;
+B *c4 = &c1;
+
+int main()
+{
+    c2->foo (1, 2, 3, 4);
+    c2->bar (5, 6, 7, 8);
+    c3->foo (1, 2, 3, 4);
+    c4->bar (5, 6, 7, 8);
+    return 0;
+}

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-02-28  1:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-27 16:29 Fix Blackfin MI thunks Bernd Schmidt
2007-02-28 12:27 ` Bernd Schmidt

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