Commit 1bfce0b8 by Stan Cox

(ASM_OUTPUT_MI_THUNK): Handle functions returning an aggregate.

From-SVN: r12739
parent 7fcdf4c2
...@@ -150,42 +150,45 @@ Boston, MA 02111-1307, USA. */ ...@@ -150,42 +150,45 @@ Boston, MA 02111-1307, USA. */
/* Output code to add DELTA to the first argument, and then jump to FUNCTION. /* Output code to add DELTA to the first argument, and then jump to FUNCTION.
Used for C++ multiple inheritance. */ Used for C++ multiple inheritance. */
#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \ #define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
do { \ do { \
tree parm; \ tree parm; \
\ \
if (i386_regparm > 0) \ if (i386_regparm > 0) \
parm = TYPE_ARG_TYPES (TREE_TYPE (function)); \ parm = TYPE_ARG_TYPES (TREE_TYPE (function)); \
else \ else \
parm = NULL_TREE; \ parm = NULL_TREE; \
for (; parm; parm = TREE_CHAIN (parm)) \ for (; parm; parm = TREE_CHAIN (parm)) \
if (TREE_VALUE (parm) == void_type_node) \ if (TREE_VALUE (parm) == void_type_node) \
break; \ break; \
fprintf (FILE, "\taddl $%d,%s\n", DELTA, parm ? "%eax" : "4(%esp)"); \ fprintf (FILE, "\taddl $%d,%s\n", DELTA, \
\ parm ? "%eax" \
if (flag_pic) \ : aggregate_value_p (TREE_TYPE (TREE_TYPE (FUNCTION))) ? "8(%esp)" \
{ \ : "4(%esp)"); \
rtx xops[2]; \ \
xops[0] = pic_offset_table_rtx; \ if (flag_pic) \
xops[1] = (rtx) gen_label_rtx (); \ { \
\ rtx xops[2]; \
if (i386_regparm > 2) \ xops[0] = pic_offset_table_rtx; \
abort (); \ xops[1] = (rtx) gen_label_rtx (); \
output_asm_insn ("push%L0 %0", xops); \ \
output_asm_insn (AS1 (call,%P1), xops); \ if (i386_regparm > 2) \
ASM_OUTPUT_INTERNAL_LABEL (FILE, "L", CODE_LABEL_NUMBER (xops[1])); \ abort (); \
output_asm_insn (AS1 (pop%L0,%0), xops); \ output_asm_insn ("push%L0 %0", xops); \
output_asm_insn ("addl $_GLOBAL_OFFSET_TABLE_+[.-%P1],%0", xops); \ output_asm_insn (AS1 (call,%P1), xops); \
fprintf (FILE, "\tmovl "); \ ASM_OUTPUT_INTERNAL_LABEL (FILE, "L", CODE_LABEL_NUMBER (xops[1])); \
assemble_name \ output_asm_insn (AS1 (pop%L0,%0), xops); \
(FILE, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (FUNCTION))); \ output_asm_insn ("addl $_GLOBAL_OFFSET_TABLE_+[.-%P1],%0", xops); \
fprintf (FILE, "@GOT(%%ebx),%%ecx\n\tpopl %%ebx\n\tjmp *%%ecx\n"); \ fprintf (FILE, "\tmovl "); \
} \ assemble_name \
else \ (FILE, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (FUNCTION))); \
{ \ fprintf (FILE, "@GOT(%%ebx),%%ecx\n\tpopl %%ebx\n\tjmp *%%ecx\n"); \
fprintf (FILE, "\tjmp "); \ } \
assemble_name \ else \
(FILE, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (FUNCTION))); \ { \
fprintf (FILE, "\n"); \ fprintf (FILE, "\tjmp "); \
} \ assemble_name \
(FILE, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (FUNCTION))); \
fprintf (FILE, "\n"); \
} \
} while (0) } while (0)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment