OSDN Git Service

* config/alpha/alpha.c (TARGET_ASM_CAN_OUTPUT_MI_THUNK): True.
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 23 Oct 2002 17:55:56 +0000 (17:55 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 23 Oct 2002 17:55:56 +0000 (17:55 +0000)
        (alpha_output_mi_thunk_osf): Handle vcall_offset.
* g++.dg/inherit/thunk1.C: Enable for s390 and alpha.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@58462 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/alpha/alpha.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/inherit/thunk1.C

index 1141063..20f3b34 100644 (file)
@@ -1,3 +1,8 @@
+2002-10-23  Richard Henderson  <rth@redhat.com>
+
+       * config/alpha/alpha.c (TARGET_ASM_CAN_OUTPUT_MI_THUNK): True.
+       (alpha_output_mi_thunk_osf): Handle vcall_offset.
+
 2002-10-23  Zack Weinberg  <zack@codesourcery.com>
 
        * langhooks.h (struct lang_hooks_for_tree_inlining): Add
index 5555aae..d6a9f6b 100644 (file)
@@ -301,7 +301,7 @@ static void unicosmk_unique_section PARAMS ((tree, int));
 #undef TARGET_ASM_OUTPUT_MI_THUNK
 #define TARGET_ASM_OUTPUT_MI_THUNK alpha_output_mi_thunk_osf
 #undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
-#define TARGET_ASM_CAN_OUTPUT_MI_THUNK default_can_output_mi_thunk_no_vcall
+#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_tree_hwi_hwi_tree_true
 #endif
 
 struct gcc_target targetm = TARGET_INITIALIZER;
@@ -7866,7 +7866,7 @@ alpha_output_mi_thunk_osf (file, thunk_fndecl, delta, vcall_offset, function)
      FILE *file;
      tree thunk_fndecl ATTRIBUTE_UNUSED;
      HOST_WIDE_INT delta;
-     HOST_WIDE_INT vcall_offset ATTRIBUTE_UNUSED;
+     HOST_WIDE_INT vcall_offset;
      tree function;
 {
   HOST_WIDE_INT hi, lo;
@@ -7901,6 +7901,37 @@ alpha_output_mi_thunk_osf (file, thunk_fndecl, delta, vcall_offset, function)
       emit_insn (gen_adddi3 (this, this, tmp));
     }
 
+  /* Add a delta stored in the vtable at VCALL_OFFSET.  */
+  if (vcall_offset)
+    {
+      rtx tmp, tmp2;
+
+      tmp = gen_rtx_REG (Pmode, 0);
+      emit_move_insn (tmp, gen_rtx_MEM (Pmode, this));
+
+      lo = ((vcall_offset & 0xffff) ^ 0x8000) - 0x8000;
+      hi = (((vcall_offset - lo) & 0xffffffff) ^ 0x80000000) - 0x80000000;
+      if (hi + lo == vcall_offset)
+       {
+         if (hi)
+           emit_insn (gen_adddi3 (tmp, tmp, GEN_INT (hi)));
+       }
+      else
+       {
+         tmp2 = alpha_emit_set_long_const (gen_rtx_REG (Pmode, 1),
+                                           vcall_offset, -(vcall_offset < 0));
+          emit_insn (gen_adddi3 (tmp, tmp, tmp2));
+         lo = 0;
+       }
+      if (lo)
+       tmp2 = gen_rtx_PLUS (Pmode, tmp, GEN_INT (lo));
+      else
+       tmp2 = tmp;
+      emit_move_insn (tmp, gen_rtx_MEM (Pmode, tmp2));
+
+      emit_insn (gen_adddi3 (this, this, tmp));
+    }
+
   /* Generate a tail call to the target function.  */
   if (! TREE_USED (function))
     {
index 8635fdc..e79e4b5 100644 (file)
@@ -1,3 +1,7 @@
+2002-10-23  Richard Henderson  <rth@redhat.com>
+
+       * g++.dg/inherit/thunk1.C: Enable for s390 and alpha.
+
 2002-10-22  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/6579
index 0c9919a..4dd05c9 100644 (file)
@@ -1,4 +1,4 @@
-// { dg-do run { target i?86-*-* } }
+// { dg-do run { target i?86-*-* s390*-*-* alpha*-*-* } }
 
 #include <stdarg.h>