Mercurial > hg > CbC > old > device
changeset 328:7ecb023d29b8 codegen-reconfig
macro/codegen reorganization done.
author | kono |
---|---|
date | Tue, 22 Jun 2004 01:24:00 +0900 |
parents | da2e3f2d127d |
children | 4c8f8ef8c0cf |
files | Changes Makefile mc-code-ia32.c mc-code-mips.c mc-code-powerpc.c mc-codegen.c mc-codegen.h mc-parse.c mc-parse.h |
diffstat | 9 files changed, 34 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/Changes Mon Jun 21 23:50:34 2004 +0900 +++ b/Changes Tue Jun 22 01:24:00 2004 +0900 @@ -5065,3 +5065,8 @@ mc-codegen の使っている変数のうち、どれがstaticなんだが検出できない。 emit_data_closing の場所が変。 + +Tue Jun 22 01:05:09 JST 2004 + +ようやっとリカバリできたよ。 +
--- a/Makefile Mon Jun 21 23:50:34 2004 +0900 +++ b/Makefile Tue Jun 22 01:24:00 2004 +0900 @@ -136,6 +136,7 @@ depend : makedepend mc-code-ia32.c mc-code.h mc-codegen.c mc-codegen.h \ mc-parse.c mc-tree.c mc-switch.c mc-switch.h mc.h \ + mc-macro.c mc-macro.h mc-parse.h \ conv/c.c conv/c.h conv/c2cbc.c conv/c2cbc.h conv/cbc2c.c \ conv/cbc2c.h conv/conv.h conv/convdef.h conv/null.c conv/null.h \ mc-code-powerpc.c \
--- a/mc-code-ia32.c Mon Jun 21 23:50:34 2004 +0900 +++ b/mc-code-ia32.c Tue Jun 22 01:24:00 2004 +0900 @@ -57,7 +57,7 @@ static int reg_sp; /* REGister Stack-Pointer */ static int reg_stack[MAX_MAX]; /* 実際のレジスタの領域 */ -int stack_depth = 0; +static int stack_depth = 0; /* floating point registers */ @@ -86,7 +86,7 @@ see enter/enter1/leave see code_enter */ static int arg_offset; -// static int disp_offset = -12; +int disp_offset = -12; #define func_disp_offset -12 #define code_disp_offset 0 // static int jump_offset = 0; @@ -3107,7 +3107,7 @@ */ int -asm_operand(char *p,int e1,int mode,int repl,int n,int repl0) +code_asm_operand(char *p,int e1,int mode,int repl,int n,int repl0) { int r; int c; @@ -3162,7 +3162,7 @@ } void -free_asm_operand(int repl) +code_free_asm_operand(int repl) { for(;repl;repl=cadr(repl)) { if (car(car(repl))==REGISTER) @@ -3172,7 +3172,7 @@ extern void -replace_asm_string(char *asm_str,int repl) +code_asm(char *asm_str,int repl) { int c,i,rstr,val; char *p;
--- a/mc-code-mips.c Mon Jun 21 23:50:34 2004 +0900 +++ b/mc-code-mips.c Tue Jun 22 01:24:00 2004 +0900 @@ -326,6 +326,7 @@ #define arg_offset 8 #define arg_offset1 0 +int disp_offset = 0; #define disp_offset 0 #define func_disp_offset 8 @@ -478,7 +479,6 @@ endian = ENDIAN; init_src = init_src0; - init_ptr_cache(); reg=RET_LREGISTER; regv_l(reg) = RET_LREGISTER_L; regv_h(reg) = RET_LREGISTER_H; @@ -494,6 +494,7 @@ emit_reinit() { /* called for each file */ + init_ptr_cache(); } @@ -5311,7 +5312,7 @@ */ int -asm_operand(char *p,int e1,int mode,int repl,int n,int repl0) +code_asm_operand(char *p,int e1,int mode,int repl,int n,int repl0) { int r; int c; @@ -5366,7 +5367,7 @@ } void -free_asm_operand(int repl) +code_free_asm_operand(int repl) { for(;repl;repl=cadr(repl)) { if (car(car(repl))==REGISTER) @@ -5376,7 +5377,7 @@ extern void -replace_asm_string(char *asm_str,int repl) +code_asm(char *asm_str,int repl) { int c,i,rstr,val; char *p;
--- a/mc-code-powerpc.c Mon Jun 21 23:50:34 2004 +0900 +++ b/mc-code-powerpc.c Tue Jun 22 01:24:00 2004 +0900 @@ -418,7 +418,6 @@ size_of_longlong = SIZE_OF_LONGLONG; endian = ENDIAN; - init_ptr_cache(); regv_l(RET_LREGISTER) = RET_LREGISTER_L; regv_h(RET_LREGISTER) = RET_LREGISTER_H; } @@ -427,6 +426,8 @@ emit_reinit() { /* called for each file */ + /* heap is initialized here, setup ptr cache free list */ + init_ptr_cache(); } void
--- a/mc-codegen.c Mon Jun 21 23:50:34 2004 +0900 +++ b/mc-codegen.c Tue Jun 22 01:24:00 2004 +0900 @@ -2358,8 +2358,6 @@ return 2; // allow override keep unique } -static int decl_str_init; - extern int assign_data(int e, int t, NMTBL *n,int offset) { @@ -2387,6 +2385,13 @@ return offset+((t==EMPTY)?cadr(e):size(t)); } +extern void +data_closing(NMTBL *n) +{ + emit_data_closing(n); +} + + extern int arg_reorder(int arg,int new_arg) {
--- a/mc-codegen.h Mon Jun 21 23:50:34 2004 +0900 +++ b/mc-codegen.h Tue Jun 22 01:24:00 2004 +0900 @@ -38,6 +38,7 @@ extern int cond(int t,int e1,int e2,int e3); extern int correct_type(int e,int t); extern int csvalue(); +extern void data_closing(NMTBL *n); extern void def_label(int cslabel, int dlabel); extern void emit_init_vars(void); extern void fdecl_struct(int fntype);
--- a/mc-parse.c Mon Jun 21 23:50:34 2004 +0900 +++ b/mc-parse.c Tue Jun 22 01:24:00 2004 +0900 @@ -55,6 +55,8 @@ int struct_return; int sym,type,mode,stmode; int typedefed; +int decl_str_init; + struct {int fd,ln;char *name0;int inc;FILE *fcb;} *filep,filestack[FILES]; static NMTBL *decl0(void),*decl1(void),*lsearch(char *name,int sc); @@ -152,7 +154,6 @@ static int clabel; static int ilabel; static int stat_no; -static int decl_str_init; static NMTBL mtable[MSYMS]; @@ -327,7 +328,6 @@ cheapp=cheap; for(nptr = ntable,i = GSYMS; i--;) (nptr++)->sc = 0; for(nptr = mtable,i = MSYMS; i--;) (nptr++)->sc = 0; - codegen_reinit(); reserve("int",INT); reserve("void",VOID); @@ -374,7 +374,7 @@ #endif heap_init(); - macro_define("__micro_c__ 1\n"); + codegen_reinit(); macro_define("__restrict\n"); macro_define("__micro_c__ 1\n"); #ifdef __APPLE__ @@ -391,7 +391,6 @@ static void init(void) { - heap_init(); codegen_init(); reinit(); filep=filestack; @@ -575,7 +574,8 @@ } conv->return_type_(type,n,sd); def(n); - if (sym==ASS) decl_data(type,n,0,0); + if (sym==ASS) { decl_data(type,n,0,0); data_closing(n); } + while(sym==COMMA) { conv->comma_(); getsym(0); @@ -585,7 +585,7 @@ if(n == &null_nptr) error(DCERR); conv->return_type_(type,n,1); def(n); - if (sym==ASS) decl_data(type,n,0,0); + if (sym==ASS) { decl_data(type,n,0,0); data_closing(n); } } if(sym!=SM) error(DCERR); conv->sm_();