Commit 0ea6b275 by Richard Kenner

(winnt_function_prologue): Deleted.

(gen_stdcall_suffix): New function.

From-SVN: r9199
parent f6b54ae8
...@@ -27,65 +27,33 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -27,65 +27,33 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "tree.h" #include "tree.h"
#include "flags.h" #include "flags.h"
/* This function generates the assembly code for function entry. /* Return string which is the former assembler name modified with a
FILE is an stdio stream to output the code to. suffix consisting of an atsign (@) followed by the number of bytes of
SIZE is an int: how many units of temporary storage to allocate. */ arguments */
void char *
winnt_function_prologue (file, size) gen_stdcall_suffix (decl)
FILE *file; tree decl;
int size;
{ {
register int regno; int total = 0;
int limit; char *asmname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
rtx xops[4]; char *newsym;
int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table
|| current_function_uses_const_pool);
xops[0] = stack_pointer_rtx; if (TYPE_ARG_TYPES (TREE_TYPE (decl)))
xops[1] = frame_pointer_rtx; if (TREE_VALUE (tree_last (TYPE_ARG_TYPES (TREE_TYPE (decl))))
xops[2] = GEN_INT (size); == void_type_node)
xops[3] = gen_rtx (REG, Pmode, 0); /* eax */
if (frame_pointer_needed)
{
output_asm_insn ("push%L1 %1", xops);
output_asm_insn (AS2 (mov%L0,%0,%1), xops);
}
if (size > 4095)
{
output_asm_insn (AS2 (mov%L0, %2, %3), xops);
output_asm_insn ("call __chkstk", xops);
}
else if (size)
output_asm_insn (AS2 (sub%L0,%2,%0), xops);
/* Note If use enter it is NOT reversed args.
This one is not reversed from intel!!
I think enter is slower. Also sdb doesn't like it.
But if you want it the code is:
{
xops[3] = const0_rtx;
output_asm_insn ("enter %2,%3", xops);
}
*/
limit = (frame_pointer_needed ? FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM);
for (regno = limit - 1; regno >= 0; regno--)
if ((regs_ever_live[regno] && ! call_used_regs[regno])
|| (regno == PIC_OFFSET_TABLE_REGNUM && pic_reg_used))
{ {
xops[0] = gen_rtx (REG, SImode, regno); tree formal_type = TYPE_ARG_TYPES (TREE_TYPE (decl));
output_asm_insn ("push%L0 %0", xops);
}
if (pic_reg_used) while (TREE_VALUE (formal_type) != void_type_node)
{ {
xops[0] = pic_offset_table_rtx; total += TREE_INT_CST_LOW (TYPE_SIZE (TREE_VALUE (formal_type)));
xops[1] = (rtx) gen_label_rtx (); formal_type = TREE_CHAIN (formal_type);
}
}
output_asm_insn (AS1 (call,%P1), xops); newsym = xmalloc (strlen (asmname) + 10);
ASM_OUTPUT_INTERNAL_LABEL (file, "L", CODE_LABEL_NUMBER (xops[1])); sprintf (newsym, "%s@%d", asmname, total/BITS_PER_UNIT);
output_asm_insn (AS1 (pop%L0,%0), xops); return IDENTIFIER_POINTER (get_identifier (newsym));
output_asm_insn ("addl $_GLOBAL_OFFSET_TABLE_+[.-%P1],%0", xops);
}
} }
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