diff mc-nop-386.c @ 36:9f89cef85b41

*** empty log message ***
author kono
date Mon, 10 Feb 2003 10:07:00 +0900
parents 8500dbb69dd9
children 412ad2e6c2a2
line wrap: on
line diff
--- a/mc-nop-386.c	Mon Feb 10 08:09:43 2003 +0900
+++ b/mc-nop-386.c	Mon Feb 10 10:07:00 2003 +0900
@@ -11,7 +11,8 @@
 extern void code_enter(char *name) ;
 extern void code_enter1(int disp0,int args);
 extern void code_init(void);
-extern void code_leave(char *name) ;
+extern void code_leave(char *name,int disp) ;
+extern void leave(int control,char *name,int disp0) ;
 extern void def_label(int cslabel, int dlabel) ;
 extern void emit_data(int e, int t, NMTBL *n);
 extern void emit_init(void);
@@ -71,6 +72,9 @@
 static int output_mode = TEXT_EMIT_MODE;
 static int data_alignment = 0;
 
+static int code_disp_label;
+static int func_disp_label;
+
 /*
          local1 <----24 local variable
         %esi        -20  <- disp_offset
@@ -1467,15 +1471,20 @@
 void
 code_enter1(int disp0,int args)
 {
+    code_disp_label=fwdlabel();
+    printf("\tsubl $_%d,%%esp\n",code_disp_label);
+    /*
     if(disp0) {
 	printf("\tsubl $%d,%%esp\n",-disp0);
     }
+     */
 printf("## args %d disp %d code_arg_offset=%d code_disp_offset=%d\n",args,disp,code_arg_offset,code_disp_offset); 
 }
 
 void
-code_leave(char *name)
+code_leave(char *name,int disp0)
 {
+    printf("\t.set _%d,%d\n",code_disp_label,-disp0);
     printf("_%d:\n",labelno);
     printf("\t.size\t%s,_%d-%s\n",name,labelno,name);
     local_table();
@@ -1500,11 +1509,13 @@
 void
 enter1(int disp)
 {
-    if(disp) printf("\tsubl $%d,%%esp\n",-disp);
+    func_disp_label=fwdlabel();
+    printf("\tsubl $_%d,%%esp\n",func_disp_label); 
+    /* if(disp) printf("\tsubl $%d,%%esp\n",-disp); */
 }
 
 void
-leave(int control, char *name)
+leave(int control, char *name,int disp)
 {
     if (control)
 	use_register(creg,REG_EAX,1);
@@ -1525,6 +1536,7 @@
     printf("\tpopl %%ebx\n");
     printf("\tleave\n");
     printf("\tret\n");
+    printf("\t.set _%d,%d\n",func_disp_label,-disp);
     printf("_%d:\n",labelno);
     printf("\t.size\t%s,_%d-%s\n",name,labelno,name);
     local_table();