Mercurial > hg > CbC > old > device
comparison mc-code-mips.c @ 267:e7ab23c992e5
static double define fix
author | kono |
---|---|
date | Mon, 17 May 2004 11:41:51 +0900 |
parents | 86e315702d9e |
children | 3a368fc37559 |
comparison
equal
deleted
inserted
replaced
266:86e315702d9e | 267:e7ab23c992e5 |
---|---|
2907 } else if(car(e)==GVAR) { | 2907 } else if(car(e)==GVAR) { |
2908 printf("\t.long %s\n",((NMTBL *)cadr(e))->nm); | 2908 printf("\t.long %s\n",((NMTBL *)cadr(e))->nm); |
2909 } else if(car(e)==STRING) { | 2909 } else if(car(e)==STRING) { |
2910 if (car(n->ty)!=ARRAY || cadr(n->ty)!=CHAR) { | 2910 if (car(n->ty)!=ARRAY || cadr(n->ty)!=CHAR) { |
2911 l = fwdlabel(); | 2911 l = fwdlabel(); |
2912 printf("\t.long L_%d\n",l); | 2912 printf("\t.long $L_%d\n",l); |
2913 // printf(".cstring\n\t.align 2\n"); | 2913 // printf(".cstring\n\t.align 2\n"); |
2914 printf("$L_%d:\n",l); | 2914 printf("$L_%d:\n",l); |
2915 output_mode = RODATA_EMIT_MODE; | 2915 output_mode = RODATA_EMIT_MODE; |
2916 } | 2916 } |
2917 ascii((char *)cadr(e)); | 2917 ascii((char *)cadr(e)); |
2934 printf("\t.size\t%s,$L_%d-%s\n",n->nm,lb,n->nm); | 2934 printf("\t.size\t%s,$L_%d-%s\n",n->nm,lb,n->nm); |
2935 #endif | 2935 #endif |
2936 } | 2936 } |
2937 } | 2937 } |
2938 | 2938 |
2939 static void | |
2940 comm(NMTBL *n) | |
2941 { | |
2942 printf(".comm %s,%d,%d\n",n->nm,size(n->ty), | |
2943 (n->ty==DOUBLE||n->ty==LONGLONG||n->ty==ULONGLONG)?8:4 | |
2944 ); | |
2945 } | |
2946 | |
2939 void | 2947 void |
2940 global_table(void) | 2948 global_table(void) |
2941 { | 2949 { |
2942 NMTBL *n; | 2950 NMTBL *n; |
2943 int init; | 2951 int init; |
2947 /* n->dsp = -1 means initialized global */ | 2955 /* n->dsp = -1 means initialized global */ |
2948 if (init==0) { | 2956 if (init==0) { |
2949 data_mode(0); | 2957 data_mode(0); |
2950 init=1; | 2958 init=1; |
2951 } | 2959 } |
2952 printf(".comm %s,%d\n",n->nm,size(n->ty)); | 2960 comm(n); |
2953 } else if ((n->sc==STATIC) && n->dsp != -1) { | 2961 } else if ((n->sc==STATIC) && n->dsp != -1) { |
2954 /* n->dsp = -1 means initialized global */ | 2962 /* n->dsp = -1 means initialized global */ |
2955 if (init==0) { | 2963 if (init==0) { |
2956 data_mode(0); | 2964 data_mode(0); |
2957 init=1; | 2965 init=1; |
2958 } | 2966 } |
2959 printf(".local %s\n",n->nm); | 2967 printf(".local %s\n",n->nm); |
2960 printf(".comm %s,%d\n",n->nm,size(n->ty)); | 2968 comm(n); |
2961 } | 2969 } |
2962 } | 2970 } |
2963 } | 2971 } |
2964 | 2972 |
2965 void | 2973 void |
2969 int init; | 2977 int init; |
2970 init=0; | 2978 init=0; |
2971 /* static local variables */ | 2979 /* static local variables */ |
2972 for(n=ntable+GSYMS;n < &ntable[GSYMS+LSYMS];n++) { | 2980 for(n=ntable+GSYMS;n < &ntable[GSYMS+LSYMS];n++) { |
2973 if (n->sc == GVAR) { | 2981 if (n->sc == GVAR) { |
2974 if (init==0) { | |
2975 data_mode(0); | |
2976 init=1; | |
2977 } | |
2978 if (n->dsp != -1) { /* initialized static */ | 2982 if (n->dsp != -1) { /* initialized static */ |
2979 printf(".local %s\n",n->nm); | 2983 if (init==0) { |
2980 printf(".comm %s,%d\n",n->nm,size(n->ty)); | 2984 data_mode(0); |
2985 init=1; | |
2986 } | |
2987 comm(n); | |
2981 } | 2988 } |
2982 } | 2989 } |
2983 } | 2990 } |
2991 text_mode(2); | |
2984 } | 2992 } |
2985 | 2993 |
2986 void | 2994 void |
2987 text_mode(int align) | 2995 text_mode(int align) |
2988 { | 2996 { |