Mercurial > hg > CbC > old > device
changeset 691:25115b50d033
*** empty log message ***
author | kono |
---|---|
date | Wed, 10 Oct 2007 17:58:15 +0900 |
parents | 5d3b4669854c |
children | 6785c63f0558 |
files | Makefile mc-codegen.c mc-inline.c mc-parse.c mc.h |
diffstat | 5 files changed, 77 insertions(+), 52 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Wed Oct 10 15:05:04 2007 +0900 +++ b/Makefile Wed Oct 10 17:58:15 2007 +0900 @@ -39,19 +39,19 @@ mc-inline.h mc-inline.c \ conv/conv.h conv/convdef.h conv/null.c -mc-powerpc :mc-include.c mc-code-powerpc.o $(COMPLIB) $(CONVERTER) +mc-powerpc :conv/conv.h mc-include.c mc-code-powerpc.o $(COMPLIB) $(CONVERTER) $(CC) $(LDFLAGS) -g mc-code-powerpc.o $(COMPLIB) $(CONVERTER) -o $@ -mc-ia32 :mc-include.c mc-code-ia32.o $(COMPLIB) $(CONVERTER) +mc-ia32 :conv/conv.h mc-include.c mc-code-ia32.o $(COMPLIB) $(CONVERTER) $(CC) $(LDFLAGS) -g mc-code-ia32.o $(COMPLIB) $(CONVERTER) -o $@ -mc-mips :mc-include.c mc-code-mips.o $(COMPLIB) $(CONVERTER) +mc-mips :conv/conv.h mc-include.c mc-code-mips.o $(COMPLIB) $(CONVERTER) $(CC) $(LDFLAGS) -g mc-code-mips.o $(COMPLIB) $(CONVERTER) -o $@ -mc-arm :mc-include.c mc-code-arm.o $(COMPLIB) $(CONVERTER) +mc-arm :conv/conv.h mc-include.c mc-code-arm.o $(COMPLIB) $(CONVERTER) $(CC) $(LDFLAGS) -g mc-code-arm.o $(COMPLIB) $(CONVERTER) -o $@ -mc-spu :mc-include.c mc-code-spu.o $(COMPLIB) $(CONVERTER) +mc-spu :conv/conv.h mc-include.c mc-code-spu.o $(COMPLIB) $(CONVERTER) $(CC) $(LDFLAGS) -g mc-code-spu.o $(COMPLIB) $(CONVERTER) -o $@ conv/conv.h: conv_func.tbl tools/conv_func.pl
--- a/mc-codegen.c Wed Oct 10 15:05:04 2007 +0900 +++ b/mc-codegen.c Wed Oct 10 17:58:15 2007 +0900 @@ -907,7 +907,7 @@ extern int is_inline(NMTBL *f) { - return (f && attr_value(f,INLINE)); + return (f && !attr_value(f,NOINLINE) && attr_value(f,INLINE)); } extern int
--- a/mc-inline.c Wed Oct 10 15:05:04 2007 +0900 +++ b/mc-inline.c Wed Oct 10 17:58:15 2007 +0900 @@ -407,7 +407,7 @@ gen_jmp(cadr(e1)); control=0; return ; - } else if (car(e1)==CODE) { + } else if (car(e1)==JUMP) { /* CbC continuation */ // conv->jump_(env); // should be separate function @@ -1081,6 +1081,12 @@ if (!(e1=heap[pdisp+lb])) { e1 = heap[pdisp+lb]=list2(FLABEL,fwdlabel()); } + break; + case JUMP: + e1 = list3(JUMP,pexpr(cadr(e1)),pexpr(caddr(e1))); + break; + default: + error(-1); } } return list3(ST_GOTO,pexpr(cadr(e)),e1); @@ -1190,6 +1196,7 @@ case BUILTIN_INF: case BUILTIN_INFF: case BUILTIN_INFL: + case CODE: return e1; case RSTRUCT: // list3(RSTRUCT,e,size) @@ -1240,7 +1247,6 @@ return binop(e2,e1,pexpr(cadr(e3)),caddr(e3),cadddr(e3)); case MINUS: if ((e3 = pexpr(e2))==e2) return e1; - if ((e3 = pexpr(e2))==e2) return e1; if (car(e3)==CONST) return list2(CONST,-cadr(e3)); return list2(car(e1),e3); #if LONGLONG_CODE
--- a/mc-parse.c Wed Oct 10 15:05:04 2007 +0900 +++ b/mc-parse.c Wed Oct 10 17:58:15 2007 +0900 @@ -936,9 +936,9 @@ init = decl_data(type,n,0,0); data_closing(n); } if (inmode && (mode==LDECL||mode==LLDECL)) { - NMTBL *n1 = get_nptr(); - *n1 = *n; // to prevent rewind in leave scope - parse = list5(ST_DECL,parse,(int)n1,list3(mode,stmode,ctmode),init); + // NMTBL *n1 = get_nptr(); + // *n1 = *n; // to prevent rewind in leave scope + parse = list5(ST_DECL,parse,(int)n,list3(mode,stmode,ctmode),init); } while(sym==COMMA) { init = 0; @@ -2016,6 +2016,8 @@ { int t,arglist; int sinmode; + int arg_disp; + if (parse_mode) { sinmode = inmode; inmode = INLINE; @@ -2063,6 +2065,8 @@ } arg_register(fnptr); } + arg_disp = args; + typedefed=0; conv->code_(fnptr); conv->lc_(); /* local variable declaration */ @@ -2077,7 +2081,18 @@ error(CODE_ERR); control=0; conv->code_end_(); - if(!inmode && !chk) gen_code_leave(fnptr->nm); + if (inmode) { + set_attr(n,INLINE, + list4(reverse0(parse),arg_disp,disp,(int)local_static_list)); + if (parse_mode && ! sinmode) { + set_attr(n,NOINLINE,-1); + } + parse = 0; + inline_funcs = list2((int)n,inline_funcs); + } else { + if(!chk) gen_code_leave(fnptr->nm); + } + args = 0; // lfree_type_limit = 0; if (parse_mode) { @@ -2166,6 +2181,9 @@ if (inmode) { set_attr(n,INLINE, list4(reverse0(parse),arg_disp,disp,(int)local_static_list)); + if (parse_mode && ! sinmode) { + set_attr(n,NOINLINE,-1); + } parse = 0; inline_funcs = list2((int)n,inline_funcs); inmode = 0;
--- a/mc.h Wed Oct 10 15:05:04 2007 +0900 +++ b/mc.h Wed Oct 10 17:58:15 2007 +0900 @@ -64,55 +64,56 @@ #define VOLATILE (-25) #define RESTRICT (-26) #define INLINE (-27) -#define REGISTER (-28) -#define FREGISTER (-29) -#define DREGISTER (-30) -#define LREGISTER (-31) -#define POSSIBLE_VALUES (-32) +#define NOINLINE (-28) +#define REGISTER (-29) +#define FREGISTER (-30) +#define DREGISTER (-31) +#define LREGISTER (-32) +#define POSSIBLE_VALUES (-33) -#define DOTS (-33) +#define DOTS (-34) /* keyword */ -#define GOTO (-34) -#define RETURN (-35) -#define BREAK (-36) -#define CONTINUE (-37) -#define IF (-38) -#define ELSE (-39) -#define FOR (-40) -#define DO (-41) -#define WHILE (-42) -#define SWITCH (-43) -#define CASE (-44) -#define DEFAULT (-45) -#define RESERVE (-46) -#define TAG (-47) -#define FIELD (-48) -#define IDENT (-49) -#define MACRO (-50) -#define BLABEL (-51) -#define FLABEL (-52) -#define TYPEDEF (-53) -#define SIZEOF (-54) -#define TYPE (-55) -#define DEFINED (-56) +#define GOTO (-35) +#define RETURN (-36) +#define BREAK (-37) +#define CONTINUE (-38) +#define IF (-39) +#define ELSE (-40) +#define FOR (-41) +#define DO (-42) +#define WHILE (-43) +#define SWITCH (-44) +#define CASE (-45) +#define DEFAULT (-46) +#define RESERVE (-47) +#define TAG (-48) +#define FIELD (-49) +#define IDENT (-50) +#define MACRO (-51) +#define BLABEL (-52) +#define FLABEL (-53) +#define TYPEDEF (-54) +#define SIZEOF (-55) +#define TYPE (-56) +#define DEFINED (-57) -#define ENVIRONMENT (-57) +#define ENVIRONMENT (-58) -#define FMACRO (-58) -#define LMACRO (-59) +#define FMACRO (-59) +#define LMACRO (-60) -#define TYPEOF (-60) -#define ASM (-61) +#define TYPEOF (-61) +#define ASM (-62) -#define C_FILE (-62) -#define C_FUNCTION (-63) -#define C_LINE (-64) +#define C_FILE (-63) +#define C_FUNCTION (-64) +#define C_LINE (-65) -#define ALIGNED (-65) -#define GENERATED (-66) -#define NORETURN (-67) +#define ALIGNED (-66) +#define GENERATED (-67) +#define NORETURN (-68) /* reserved word end */