Mercurial > hg > CbC > old > device
changeset 689:baa67e2e54d2
*** empty log message ***
author | kono |
---|---|
date | Sun, 07 Oct 2007 17:46:00 +0900 |
parents | 10c8eaf0f73b |
children | 5d3b4669854c |
files | Changes Makefile mc-code-ia32.c test/call.c |
diffstat | 4 files changed, 44 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/Changes Sat Oct 06 15:49:04 2007 +0900 +++ b/Changes Sun Oct 07 17:46:00 2007 +0900 @@ -9515,3 +9515,8 @@ fdecl を pfdecl を呼び出すようにする。(直接生成はoptionで残す?) +Sun Oct 7 17:43:42 JST 2007 + +parse tree を導入するのだったら、one path mode は、切ってしまった +方が、mc-parse.c が小さくなる。どうせ、debug しなくなるだろうし。 +case 文の逐次比較モードと同じか。
--- a/Makefile Sat Oct 06 15:49:04 2007 +0900 +++ b/Makefile Sun Oct 07 17:46:00 2007 +0900 @@ -1,6 +1,5 @@ # CC = gcc -std=c99 -arch ppc CC = gcc -std=c99 -# CC = cc # -O3 MCFLAGS = -DUSE_CODE_KEYWORD CFLAGS = -g -O -Wall -I. $(MCFLAGS)
--- a/mc-code-ia32.c Sat Oct 06 15:49:04 2007 +0900 +++ b/mc-code-ia32.c Sun Oct 07 17:46:00 2007 +0900 @@ -1530,6 +1530,9 @@ #define MAX_COPY_LEN 20 +/* ARG_ORDER==1 case do not allow library call in emit_copy +*/ + void emit_copy(int from,int to,int length,int offset,int value,int det) { @@ -1663,6 +1666,13 @@ #define caller_arg_offset_v(arg) (ARG_LVAR_OFFSET+(arg)*SIZE_OF_INT) +/* + Eary implementation uses pushl arg for function call. gcc + use the same arguement evaluation order. Of course, the + order is unspecified in C language, but it is better to + use same argument evaluation order. Especially for test + program. + */ #define ARG_ORDER 1 #if (ARG_ORDER==1) @@ -1784,7 +1794,10 @@ int half_register = 0; #if (ARG_ORDER==1) int save_delayed_arg = delayed_arg; + int as_save = AS_ARG; // 1st pushed argment will evaluate at the last delayed_arg = 0; +#else + const int as_save = AS_SAVE; #endif special_lvar = -1; @@ -1820,8 +1833,11 @@ } if ((e5= !simple_arg(car(e3)))) { if (complex_) { - arg = get_input_arg(caddr(complex_),AS_SAVE, + arg = get_input_arg(caddr(complex_),as_save, pnargs,preg_arg,pfreg_arg); +#if ARG_ORDER==1 + as_save = AS_SAVE; +#endif reg_arg_list = compute_complex_arg(complex_,reg_arg_list,arg); } // memorise last complex arg parameter @@ -1857,7 +1873,7 @@ } #if (ARG_ORDER==1) if (complex_) { - arg = get_input_arg(caddr(complex_),AS_SAVE, + arg = get_input_arg(caddr(complex_),as_save, pnargs,preg_arg,pfreg_arg); reg_arg_list = compute_complex_arg(complex_,reg_arg_list,arg); } @@ -1879,6 +1895,10 @@ // override by other complex arguments. But before this we have to check // complex_. + // ARG_ORDER==1 case put the last value on the top of stack. + // emit_copy/push_struct must preserve argument stack, i.e. + // no library call is allowed. + if (stargs) { #if (ARG_ORDER!=1) if (complex_) {
--- a/test/call.c Sat Oct 06 15:49:04 2007 +0900 +++ b/test/call.c Sun Oct 07 17:46:00 2007 +0900 @@ -1,42 +1,51 @@ +#ifndef INLINE +#define INLINE +#endif + int printf(const char *format, ...); - +INLINE int a0(int i); int (*conv)(int); +INLINE int a0(int i) { return i+3; } +INLINE int a1(int i) { return i-3; } - +INLINE int a2(int i,int conv(int)) { return conv(i); } +INLINE int a3(int i,int (*conv)(int)) { return conv(i); } +INLINE int a4(int i,int conv(int)) { return (*conv)(i); } +INLINE static int a5(int i,int (*conv)(int)) { @@ -63,26 +72,32 @@ +INLINE void print( int i, void (*print)(int i,void (*)()) ); +INLINE void print0( int i, void (*print1)(int i,void (*)()) ) { printf("print0 %d %d\n",print1 == print,i); } +INLINE void print( int i, void (*print)(int i,void (*)()) ) { print0(i,print); (*print)(i,print); } +INLINE void pppp( void (*pppp)(void (*)()) ); +INLINE void pppp0( void (*pppp1)(void (*)()) ) { printf("pppp0 %d\n",pppp1 == pppp); } +INLINE void pppp( void (*pppp)(void (*)()) ) { pppp0(pppp);