diff mc-code-ia32.c @ 138:e6e77af048a1 float-double

float/dobule configuration
author kono
date Tue, 06 May 2003 02:31:46 +0900
parents 9fb09db54436
children 742224f4da02
line wrap: on
line diff
--- a/mc-code-ia32.c	Sun May 04 22:08:20 2003 +0900
+++ b/mc-code-ia32.c	Tue May 06 02:31:46 2003 +0900
@@ -32,8 +32,18 @@
 int MAX_INPUT_REGISTER_VAR = 0;
 int MAX_CODE_INPUT_REGISTER_VAR = 2;
 int MAX_INPUT_DREGISTER_VAR = 0;
+int MAX_INPUT_FREGISTER_VAR = 0;
 int MAX_CODE_INPUT_DREGISTER_VAR = 0;
 
+int  reg_sp;   /* REGister Stack-Pointer */
+int reg_stack[MAX_MAX];  /* 実際のレジスタの領域 */
+
+/* floating point registers */
+
+int  freg_sp;  /* floating point REGister Stack-Pointer */
+int freg_stack[MAX_MAX]; /* 実際のレジスタの領域 */
+
+
 /*
                                            -28  -8 local2
                                            -24  -4 local1
@@ -226,19 +236,19 @@
 }
 
 int 
-get_input_fregister_var(int i,NMTBL *nptr,int is_code)
+get_input_dregister_var(int i,NMTBL *nptr,int is_code,int d)
 {
     return 0;
 }
 
 int 
-get_fregister(void)
+get_dregister(int d)
 {
     return -1;
 }
 
 void 
-free_fregister(int i) {
+free_dregister(int i,int d) {
     error(-1);
 }
 
@@ -328,7 +338,7 @@
                 cadddr(args)=size_of_int; /* why we need this? */
             }
         } else if (type==FLOAT||type==DOUBLE) {
-            if ((reg = get_input_fregister_var(freg_var,n,is_code0))) {
+            if ((reg = get_input_dregister_var(freg_var,n,is_code0,1))) {
                 n->sc = DREGISTER;
                 n->dsp = cadr(reg);
                 fregv[n->dsp]= 1;
@@ -412,15 +422,9 @@
 }
 
 int
-get_fregister_var(NMTBL *nptr)
+get_dregister_var(NMTBL *nptr,int d)
 {
-    return list2(LVAR,new_lvar(size_of_double));
-}
-
-int
-get_dregister_var(NMTBL *nptr)
-{
-    return get_fregister_var(nptr);
+    return list2(LVAR,new_lvar(d?size_of_double:size_of_float));
 }
 
 void 
@@ -1675,7 +1679,7 @@
     printf("\t%s %d(%%ebp)\n",fstore(d),lvar(e2));
 }
 
-void code_dassign_fregister(int e,int d,int freg)
+void code_dassign_dregister(int e,int d,int freg)
 {
     error(-1);
 }
@@ -1701,21 +1705,21 @@
     return (i[1] == 0x3ff00000)?j[1]:j[0];
 }
 
-void code_dconst(int e2,int freg)
+void code_dconst(int e2,int freg,int d)
 { 
     int lb;
-    double d = dcadr(e2);
+    double value = dcadr(e2);
 
-    if (d==0.0) {
+    if (value==0.0) {
 	printf("\tfldz\n"); return;
     }
-    if (d==1.0) {
+    if (value==1.0) {
 	printf("\tfld1\n"); return;
     }
     printf(" \t.section\t.rodata\n\t.align 8\n");
     lb=fwdlabel();
     printf("_%d:\n",lb);
-    printf("\t.long\t0x%x,0x%x\n",code_d1(d),code_d2(d));
+    printf("\t.long\t0x%x,0x%x\n",code_d1(value),code_d2(value));
     if (output_mode==TEXT_EMIT_MODE) {
 	printf(".text\n");
     } else {
@@ -1724,21 +1728,11 @@
     printf("\tfldl _%d\n",lb);
 }
 
-void code_fconst(int e2,int freg)
-{
-    code_dconst(e2,freg);
-}
-
-void code_dneg(int freg)
+void code_dneg(int freg,int d)
 { 
     printf("\tfchs\n");
 }
 
-void code_fneg(int freg)
-{
-    code_dneg(freg);
-}
-
 void code_d2i(int freg,int creg)
 { 
     printf("\tlea -%d(%%esp),%%esp\n",size_of_int*2);
@@ -1801,12 +1795,12 @@
     printf("\t%s %d(%%ebp)\n",fload(d),lvar(e2));
 }
 
-void code_cmp_drgvar(int e2)
+void code_cmp_drgvar(int e2,int d)
 { 
     printf("\tfcomp %s\n",((NMTBL*)cadr(e2))->nm);
 }
 
-void code_cmp_drlvar(int e2)
+void code_cmp_drlvar(int e2,int d)
 { 
     printf("\tfcomp %d(%%ebp)\n",lvar(e2));
 }
@@ -1896,13 +1890,13 @@
 }
 
 void 
-code_fregister(int e2,int freg)
+code_dregister(int e2,int freg,int d)
 {
     error(-1);
 }
 
-void 
-code_cmp_fregister(int r)
+void
+code_cmp_dregister(int e2,int d)
 {
     error(-1);
 }
@@ -1915,7 +1909,7 @@
 }
 
 int
-emit_dpop(int type)
+emit_dpop(int d)
 {
     int xreg;
     if ((xreg=pop_fregister())==-1) {
@@ -1930,7 +1924,7 @@
 }
 
 
-void emit_dpop_free(int e1)
+void emit_dpop_free(int e1,int d)
 { 
 }