From: Richard Henderson Date: Wed, 23 Oct 2002 17:55:56 +0000 (-0700) Subject: alpha.c (TARGET_ASM_CAN_OUTPUT_MI_THUNK): True. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e23580688cbb529bbbb5ed691b65f01aba1945e0;p=gcc.git alpha.c (TARGET_ASM_CAN_OUTPUT_MI_THUNK): True. * config/alpha/alpha.c (TARGET_ASM_CAN_OUTPUT_MI_THUNK): True. (alpha_output_mi_thunk_osf): Handle vcall_offset. * g++.dg/inherit/thunk1.C: Enable for s390 and alpha. From-SVN: r58462 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 114106377ab..20f3b347390 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2002-10-23 Richard Henderson + + * config/alpha/alpha.c (TARGET_ASM_CAN_OUTPUT_MI_THUNK): True. + (alpha_output_mi_thunk_osf): Handle vcall_offset. + 2002-10-23 Zack Weinberg * langhooks.h (struct lang_hooks_for_tree_inlining): Add diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 5555aaebb18..d6a9f6bc661 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -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)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8635fdc2c81..e79e4b51461 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2002-10-23 Richard Henderson + + * g++.dg/inherit/thunk1.C: Enable for s390 and alpha. + 2002-10-22 Mark Mitchell PR c++/6579 diff --git a/gcc/testsuite/g++.dg/inherit/thunk1.C b/gcc/testsuite/g++.dg/inherit/thunk1.C index 0c9919a192c..4dd05c91d73 100644 --- a/gcc/testsuite/g++.dg/inherit/thunk1.C +++ b/gcc/testsuite/g++.dg/inherit/thunk1.C @@ -1,4 +1,4 @@ -// { dg-do run { target i?86-*-* } } +// { dg-do run { target i?86-*-* s390*-*-* alpha*-*-* } } #include