Mercurial > hg > CbC > old > device
changeset 348:e77b3a7002ad
name table reconfigure compiled. debug start.
author | kono |
---|---|
date | Fri, 02 Jul 2004 07:19:15 +0900 |
parents | cef4d8eb9a26 |
children | b74b580c10f6 |
files | .gdbinit Changes conv/c.c mc-code-ia32.c mc-code-mips.c mc-code-powerpc.c mc-codegen.c mc-macro.c mc-parse.c mc-parse.h mc.h |
diffstat | 11 files changed, 33 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/.gdbinit Fri Jul 02 03:55:11 2004 +0900 +++ b/.gdbinit Fri Jul 02 07:19:15 2004 +0900 @@ -2,7 +2,7 @@ # run -s test/arg.c # run -s -ob00.s mc-parse.c # run -s l.c -run -s test/bitfield.c +run -s test/macro.c # run -s test/code-gen-all.c define regs printf "pc =%08x lr =%08x r0 =%08x r1 =%08x r3= %08x r4= %08x\n",$pc,$lr,$r0,$r1,$r3,$r4
--- a/Changes Fri Jul 02 03:55:11 2004 +0900 +++ b/Changes Fri Jul 02 07:19:15 2004 +0900 @@ -5385,3 +5385,7 @@ field であるべきだよね? + +Fri Jul 2 06:46:27 JST 2004 + +こんなに変更しちゃって、動くわけないよね。
--- a/conv/c.c Fri Jul 02 03:55:11 2004 +0900 +++ b/conv/c.c Fri Jul 02 07:19:15 2004 +0900 @@ -230,7 +230,7 @@ } void -string_(char *s){ +string_(char *s,int len){ int c; fprintf(vout,"\""); while((c=*s++)) {
--- a/mc-code-ia32.c Fri Jul 02 03:55:11 2004 +0900 +++ b/mc-code-ia32.c Fri Jul 02 07:19:15 2004 +0900 @@ -2073,7 +2073,7 @@ NMTBL *n; int init; init=0; - for(n=ntable;n < &ntable[GSYMS];n++) { + for(n=global_list;n;n = n->next) { if ((n->sc == GVAR||n->sc == STATIC) && n->dsp != -1) { /* n->dsp = -1 means initialized global */ if (init==0) { @@ -2092,7 +2092,7 @@ int init; init=0; /* static local variables */ - for(n=ntable+GSYMS;n < &ntable[GSYMS+LSYMS];n++) { + for(n=local_static_list;n;n = n->next) { if (n->sc == GVAR) { if (init==0) { data_mode(0);
--- a/mc-code-mips.c Fri Jul 02 03:55:11 2004 +0900 +++ b/mc-code-mips.c Fri Jul 02 07:19:15 2004 +0900 @@ -3340,7 +3340,7 @@ NMTBL *n; int init; init=0; - for(n=ntable;n < &ntable[GSYMS];n++) { + for(n=global_list;n;n=n->next) { if ((n->sc == GVAR) && n->dsp != -1) { /* n->dsp = -1 means initialized global */ if (init==0) { @@ -3367,7 +3367,7 @@ int init; init=0; /* static local variables */ - for(n=ntable+GSYMS;n < &ntable[GSYMS+LSYMS];n++) { + for(n=local_static_list;n;n=n->next) { if (n->sc == GVAR) { if (n->dsp != -1) { /* initialized static */ if (init==0) {
--- a/mc-code-powerpc.c Fri Jul 02 03:55:11 2004 +0900 +++ b/mc-code-powerpc.c Fri Jul 02 07:19:15 2004 +0900 @@ -224,9 +224,9 @@ #if FLOAT_CODE static -NMTBL float_zero = {"_float_zero",STATIC,FLOAT,0}; +NMTBL float_zero = {"_float_zero",0,STATIC,FLOAT,0}; static -NMTBL float_one = {"_float_one",STATIC,FLOAT,0}; +NMTBL float_one = {"_float_one",0,STATIC,FLOAT,0}; static char * fload(int d); @@ -3010,7 +3010,7 @@ NMTBL *n; int init; char *extrn; init=0; - for(n=ntable;n < &ntable[GSYMS];n++) { + for(n = global_list;n;n = n->next) { if ((n->sc == GVAR) && n->dsp != -1) { /* n->dsp = -1 means initialized global */ if (init==0) { @@ -3027,7 +3027,7 @@ printf(".lcomm _%s,%d\n",n->nm,size(n->ty)); } } - for(n=ntable;n < &ntable[GSYMS];n++) { + for(n = global_list;n;n = n->next) { if (is_code(n)||is_function(n)) { extrn = n->nm; if (n->sc==EXTRN1) { @@ -3059,7 +3059,7 @@ } } init=0; - for(n=ntable;n < &ntable[GSYMS];n++) { + for(n = global_list;n;n = n->next) { if (n->sc == GVAR) { if (init==0) { printf(".data\n"); @@ -3069,7 +3069,7 @@ } } init = 0; - for(n=ntable;n < &ntable[GSYMS];n++) { + for(n = global_list;n;n = n->next) { if (is_code(n)||is_function(n)) continue; if (n->sc==EXTRN1) { if(init==0) { @@ -3091,7 +3091,7 @@ int init; init=0; /* static local variables */ - for(n=ntable+GSYMS;n < &ntable[GSYMS+LSYMS];n++) { + for(n = local_static_list;n;n = n->next) { if (n->sc == GVAR) { if (init==0) { data_mode(0);
--- a/mc-codegen.c Fri Jul 02 03:55:11 2004 +0900 +++ b/mc-codegen.c Fri Jul 02 07:19:15 2004 +0900 @@ -2319,6 +2319,7 @@ n->ty = type; /* must be in global table/heap */ if(type>0&&(car(type)==FUNCTION || car(type)==CODE)) { if ((mode==GDECL)) { + n->next = global_list; global_list = n; fcheck(n); return n; /* function and code segment are defined using fdecl/code_decl */ @@ -2372,6 +2373,9 @@ n->sc = nsc; if (stmode==LDECL) { n = new_static_name(n->nm,'.'); + n->next = local_static_list; local_static_list = n; + } else { + n->next = global_list; global_list = n; } gpc +=sz; return n;
--- a/mc-macro.c Fri Jul 02 03:55:11 2004 +0900 +++ b/mc-macro.c Fri Jul 02 07:19:15 2004 +0900 @@ -694,7 +694,7 @@ { char *p; *result = cheap->ptr; - for(;lists;list= cadr(lists)) { + for(;lists;lists = cadr(lists)) { p = (char *)car(lists); for(;(*cheap->ptr=*p++);cheap = increment_cheap(cheap,0)) { // in_quote + \n case ? should be \n.
--- a/mc-parse.c Fri Jul 02 03:55:11 2004 +0900 +++ b/mc-parse.c Fri Jul 02 07:19:15 2004 +0900 @@ -66,6 +66,9 @@ int typedefed; int decl_str_init; +NMTBL *local_static_list,*global_list; + + struct {int fd,ln;char *name0;int inc;FILE *fcb;} *filep,filestack[FILES]; static NMTBL *decl0(void),*decl1(void),*lsearch(char *name,int sc); @@ -1328,6 +1331,7 @@ int t,arglist; if(!chk) gen_code_enter(n->nm); + local_static_list = 0; fnptr=n; n->sc = CODE; n->ty = type; @@ -1410,6 +1414,7 @@ int sd = stypedecl; int arglist; if(!chk) gen_enter(n->nm); + local_static_list = 0; fnptr=n; retlabel=fwdlabel(); retcont = 0; @@ -3437,7 +3442,7 @@ int next; while(current_scope) { ns = *(NMTBL **)car(current_scope); - free_nptr(ns); + if (ns->sc != GVAR) free_nptr(ns); *(NMTBL **)car(current_scope) = (NMTBL *)caddr(current_scope); next = cadr(current_scope); free_glist2(current_scope); // will destroy cadr @@ -3792,7 +3797,7 @@ extern void display_ntable(NMTBL *n, char *s) { - fprintf(stderr,"\n%s %0x %0x ",s,(int)n,(int)ntable); + fprintf(stderr,"\n%s ",s); fprintf(stderr,"nptr->sc %d ",n->sc); fprintf(stderr,"nptr->dsp %d ",n->dsp); fprintf(stderr,"nptr->ty %d ",n->ty);
--- a/mc-parse.h Fri Jul 02 03:55:11 2004 +0900 +++ b/mc-parse.h Fri Jul 02 07:19:15 2004 +0900 @@ -55,7 +55,6 @@ /* used in mc-code-* */ extern NMTBL null_nptr; -extern NMTBL ntable[GSYMS+LSYMS]; extern char * make_filename_with_extension(char *filename,char *ext);
--- a/mc.h Fri Jul 02 03:55:11 2004 +0900 +++ b/mc.h Fri Jul 02 07:19:15 2004 +0900 @@ -412,23 +412,22 @@ /* error number end */ -#define GSYMS 9000 -#define LSYMS 500 -#define MSYMS 3000 - #define FILES 10 #define MAX_INCLUDE_PATH_COUNT 10 +#define GSYMS 8192 #define HEAPSIZE 30000 -#define CHEAPSIZE 356000 +#define CHEAPSIZE (sizeof(NMTBL)*GSYMS) #define LBUFSIZE 4096 #define STRSIZE 4096 typedef struct nametable { char *nm; + struct nametable *next; int sc,ty,dsp; } NMTBL; extern int heap[HEAPSIZE]; +extern NMTBL *global_list,*local_static_list; #if FLOAT_CODE extern int dlist2(int e1, double e2);