Mercurial > hg > CbC > old > device
changeset 201:3ae7e188416f
*** empty log message ***
author | kono |
---|---|
date | Sat, 10 Apr 2004 22:15:29 +0900 |
parents | d83291712bf7 |
children | 601301152d9c |
files | .gdbinit Changes mc-parse.c mc.h test/code-gen.c test/code-gen.pl |
diffstat | 6 files changed, 264 insertions(+), 215 deletions(-) [+] |
line wrap: on
line diff
--- a/.gdbinit Thu Apr 08 22:18:27 2004 +0900 +++ b/.gdbinit Sat Apr 10 22:15:29 2004 +0900 @@ -1,5 +1,6 @@ tb main -run -s -ob00.s mc-parse.c +# run -s -ob00.s mc-parse.c +run -Itest/ 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 printf "r10=%08x r11=%08x r12=%08x r13=%08x r14=%08x r15=%08x\n",$r10,$r11,$r12,$r13,$r14,$r15
--- a/Changes Thu Apr 08 22:18:27 2004 +0900 +++ b/Changes Sat Apr 10 22:15:29 2004 +0900 @@ -3869,3 +3869,9 @@ 包括的なテストルーチンがあった方が便利。long.c を消しちゃったし。 +Fri Apr 9 02:11:42 JST 2004 + +やっぱり incore compiler と、non textural syntax が欲しい。 +ま、そうだよね。 + +あと、#include の search path のセマンティクスを直さないと。
--- a/mc-parse.c Thu Apr 08 22:18:27 2004 +0900 +++ b/mc-parse.c Sat Apr 10 22:15:29 2004 +0900 @@ -1556,7 +1556,8 @@ int integral(int t) { - return(t==INT||t==CHAR||t==UNSIGNED||t==UCHAR||t==SHORT||t==USHORT||t==ENUM); + return(t==INT||t==SIGNED||t==CHAR||t==UNSIGNED|| + t==UCHAR||t==SHORT||t==USHORT||t==ENUM); } static void @@ -1980,7 +1981,7 @@ { if(nptr->sc == FLABEL) fwddef(nptr->dsp); - else if(nptr->sc != EMPTY) + else if(nptr->sc != EMPTY && nptr->sc != EXTRN1) error(TYERR); nptr->sc = BLABEL; nptr->dsp = backdef();
--- a/mc.h Thu Apr 08 22:18:27 2004 +0900 +++ b/mc.h Sat Apr 10 22:15:29 2004 +0900 @@ -11,7 +11,7 @@ #endif #define FLOAT_CODE 1 -#define LONGLONG_CODE 0 +#define LONGLONG_CODE 1 #define SIZE_INT 4
--- a/test/code-gen.c Thu Apr 08 22:18:27 2004 +0900 +++ b/test/code-gen.c Sat Apr 10 22:15:29 2004 +0900 @@ -6,6 +6,8 @@ // code_lvar(int e2,int creg) +extern int printf(const char *fmt,...); + void code_lvar() { @@ -13,12 +15,12 @@ unsigned char uc1,uc2; int i1,i2; short s1,s2; - unsinged short us1,us2; + unsigned short us1,us2; i1 = 1; i2 = -2; s1 = -1; s2 = -3; us1 = 65535; us2 = 65535; printf("code_lvar %d %d %d %d %u %u\n",i1,i2,s1,s2,us1,us2); - c1 = -1; c2 = -3; uc1 = 65535; uc2 = 65535; + c1 = -1; c2 = -3; uc1 = 200; uc2 = 202; printf("code_lvar %d %d %u %u\n",c1,c2,uc1,uc2); } @@ -42,11 +44,12 @@ static char s_c1,s_c2; static unsigned char s_uc1,s_uc2; int i1,i2; +unsigned int ui1,ui2; short s1,s2; -unsinged short us1,us2; +unsigned short us1,us2; static int s_i1,s_i2; static short s_s1,s_s2; -static unsinged short s_us1,s_us2; +static unsigned short s_us1,s_us2; #if FLOAT_CODE float f0,f1; double d0,d1; @@ -66,35 +69,37 @@ i1 = 1; i2 = -2; s1 = -1; s2 = -3; us1 = 65535; us2 = 65535; printf("code_gvar %d %d %u %u %u %u\n",i1,i2,s1,s2,us1,us2); - c1 = -1; c2 = -3; uc1 = 65535; uc2 = 65535; + c1 = -1; c2 = -3; uc1 = 200; uc2 = 202; printf("code_gvar %d %d %u %u\n",c1,c2,uc1,uc2); s_i1 = 1; s_i2 = 2; s_s1 = -1; s_s2 = -3; s_us1 = 65535; s_us2 = 65535; printf("code_gvar %d %d %u %u %u %u\n",s_i1,s_i2,s1,s_s2,s_us1,s_us2); - s_c1 = -1; s_c2 = -3; s_uc1 = 65535; s_uc2 = 65535; + s_c1 = -1; s_c2 = -3; s_uc1 = 200; s_uc2 = 202; printf("code_gvar %d %d %u %u\n",s_c1,s_c2,s_uc1,s_uc2); } // code_register(int e2,int creg) +void code_register() { register char c1,c2; register unsigned char uc1,uc2; register int i1,i2; register short s1,s2; - register unsinged short us1,us2; + register unsigned short us1,us2; i1 = 1; i2 = -2; s1 = -1; s2 = -3; us1 = 65535; us2 = 65535; printf("code_lvar %d %d %u %u %u %u\n",i1,i2,s1,s2,us1,us2); - c1 = -1; c2 = -3; uc1 = 65535; uc2 = 65535; + c1 = -1; c2 = -3; uc1 = 200; uc2 = 202; printf("code_gvar %d %d %u %u\n",c1,c2,uc1,uc2); } // code_fname(NMTBL *n,int creg) +void code_fname() { int i,j; @@ -144,7 +149,7 @@ void code_upostinc() { - unsinged int i,j; + unsigned int i,j; i = 123123123;j = 0; printf("code_upreinc %d %d\n",i++,j--); } @@ -169,42 +174,71 @@ // code_return(int creg) + int + code_return_int0() +{ + return 1; +} +void code_return_int() { - return 1; + printf("code_return_int %d\n",code_return_int0()); } #if FLOAT_CODE float -code_return_float() + code_return_float0() { return 1.0; } +void +code_return_float() +{ + printf("code_return_float %g\n",code_return_float0()); +} double -code_return_double() + code_return_double0() { return 1.0; } +void +code_return_double() +{ + printf("code_return_double %g\n",code_return_double0()); +} + #endif #if LONGLONG_CODE long long -code_return_longlong() + code_return_longlong0() { return 10LL; } +void +code_return_longlong() +{ + printf("code_return_longlong %lld\n",code_return_longlong0()); +} + #endif struct aa { char a[100]; } a0; struct aa -code_return_struct() + code_return_struct0() { a0.a[55]=3; return a0; } +void +code_return_struct() +{ + printf("code_return_struct %d\n", code_return_struct0().a[55]); +} + // code_gt(int cond) void code_gt() @@ -281,11 +315,11 @@ unsigned char uc1,uc2; int i1,i2; short s1,s2; - unsinged short us1,us2; + unsigned short us1,us2; i1 = 1; i2 = -2; s1 = -1; s2 = -3; us1 = 65535; us2 = 65535; - c1 = -1; c2 = -3; uc1 = 65535; uc2 = 65535; + c1 = -1; c2 = -3; uc1 = 200; uc2 = 202; i1 && printf("code_bool local 1\n"); s1 && printf("code_bool local 2\n"); us1 && printf("code_bool local 3\n"); @@ -298,7 +332,7 @@ { i1 = 1; i2 = -2; s1 = -1; s2 = -3; us1 = 65535; us2 = 65535; - c1 = -1; c2 = -3; uc1 = 65535; uc2 = 65535; + c1 = -1; c2 = -3; uc1 = 200; uc2 = 202; i1 && printf("code_bool global 1\n"); s1 && printf("code_bool global 2\n"); us1 && printf("code_bool global 3\n"); @@ -313,11 +347,11 @@ register unsigned char uc1,uc2; register int i1,i2; register short s1,s2; - register unsinged short us1,us2; + register unsigned short us1,us2; i1 = 1; i2 = -2; s1 = -1; s2 = -3; us1 = 65535; us2 = 65535; - c1 = -1; c2 = -3; uc1 = 65535; uc2 = 65535; + c1 = -1; c2 = -3; uc1 = 200; uc2 = 202; i1 && printf("code_bool register 1\n"); s1 && printf("code_bool register 2\n"); us1 && printf("code_bool register 3\n"); @@ -330,7 +364,7 @@ // code_string(int e1,int creg) void -code_string(int e1,int creg) +code_string() { printf("code_string test\n"); } @@ -338,11 +372,11 @@ // struct_push(int e4,int t,int arg) struct aa -struct_push0(int i,struct aa a) + struct_push0(int i,struct aa a) { a.a[55]++; if (i==0) { - return struct_push(1,a0); + return struct_push0(1,a0); } return a0; } @@ -480,6 +514,7 @@ } // code_register_assop(int e2,int op,int byte) +void code_register_assop() { register int i1; @@ -497,9 +532,9 @@ printf("code_assop 4 %d\n",i1); i1 |= 234; printf("code_assop 5 %d\n",i1); - i1 &= 2324234234234234; + i1 &= 23244234; printf("code_assop 6 %d\n",i1); - i1 ^= 5523234234234234; + i1 ^= 55244234; printf("code_assop 7 %d\n",i1); i1 <<= 3; printf("code_assop 8 %d\n",i1); @@ -507,26 +542,27 @@ printf("code_assop 9 %d\n",i1); ui1 += 3; - printf("code_assop 1 %ud\n",i1); + printf("code_assop 1 %u\n",ui1); ui1 -= 3; - printf("code_assop 2 %ud\n",i1); + printf("code_assop 2 %u\n",ui1); ui1 /= 3; - printf("code_assop 3 %ud\n",i1); + printf("code_assop 3 %u\n",ui1); ui1 *= 3; - printf("code_assop 4 %ud\n",i1); + printf("code_assop 4 %u\n",ui1); ui1 |= 234; - printf("code_assop 5 %ud\n",i1); - ui1 &= 2324234234234234; - printf("code_assop 6 %ud\n",i1); - ui1 ^= 5523234234234234; - printf("code_assop 7 %ud\n",i1); + printf("code_assop 5 %u\n",ui1); + ui1 &= 23234234; + printf("code_assop 6 %u\n",ui1); + ui1 ^= 55234234; + printf("code_assop 7 %u\n",ui1); ui1 <<= 3; - printf("code_assop 8 %ud\n",i1); + printf("code_assop 8 %u\n",ui1); ui1 >>= 3; - printf("code_assop 9 %ud\n",i1); + printf("code_assop 9 %u\n",ui1); } // code_assop(int op,int byte,int sign) +void code_assop() { int i1,i2; @@ -544,9 +580,9 @@ printf("code_assop 4 %d\n",i1); i1 |= 234; printf("code_assop 5 %d\n",i1); - i1 &= 2324234234234234; + i1 &= 23234234; printf("code_assop 6 %d\n",i1); - i1 ^= 5523234234234234; + i1 ^= 55444234; printf("code_assop 7 %d\n",i1); i1 <<= 3; printf("code_assop 8 %d\n",i1); @@ -554,23 +590,23 @@ printf("code_assop 9 %d\n",i1); ui1 += 3; - printf("code_assop 1 %ud\n",i1); + printf("code_assop 1 %u\n",ui1); ui1 -= 3; - printf("code_assop 2 %ud\n",i1); + printf("code_assop 2 %u\n",ui1); ui1 /= 3; - printf("code_assop 3 %ud\n",i1); + printf("code_assop 3 %u\n",ui1); ui1 *= 3; - printf("code_assop 4 %ud\n",i1); + printf("code_assop 4 %u\n",ui1); ui1 |= 234; - printf("code_assop 5 %ud\n",i1); - ui1 &= 2324234234234234; - printf("code_assop 6 %ud\n",i1); - ui1 ^= 5523234234234234; - printf("code_assop 7 %ud\n",i1); + printf("code_assop 5 %u\n",ui1); + ui1 &= 23234234; + printf("code_assop 6 %u\n",ui1); + ui1 ^= 54234234; + printf("code_assop 7 %u\n",ui1); ui1 <<= 3; - printf("code_assop 8 %ud\n",i1); + printf("code_assop 8 %u\n",ui1); ui1 >>= 3; - printf("code_assop 9 %ud\n",i1); + printf("code_assop 9 %u\n",ui1); } @@ -580,47 +616,47 @@ tosop() { int i1,i2,i; - unsigned int ui1,ui2,u; + unsigned int u1,u2,u; i1 = -555; i2= 555; - ui1 = 632423423; ui2= 32394234; + u1 = 632423423; u2= 32394234; i = i1 + i2; - printf("tosop 1 %d\n",i1); + printf("tosop 1 %d\n",i); i = i1 - i2; - printf("tosop 2 %d\n",i1); + printf("tosop 2 %d\n",i); i = i1 / i2; - printf("tosop 3 %d\n",i1); + printf("tosop 3 %d\n",i); i = i1 * i2; - printf("tosop 4 %d\n",i1); + printf("tosop 4 %d\n",i); i = i1 | i2; - printf("tosop 5 %d\n",i1); + printf("tosop 5 %d\n",i); i = i1 & i2; - printf("tosop 6 %d\n",i1); + printf("tosop 6 %d\n",i); i = i1 ^ i2; - printf("tosop 7 %d\n",i1); + printf("tosop 7 %d\n",i); i = i1 << i2; - printf("tosop 8 %d\n",i1); + printf("tosop 8 %d\n",i); i = i1 >> i2; - printf("tosop 9 %d\n",i1); + printf("tosop 9 %d\n",i); u = u1 + u2; - printf("tosop 1 %ud\n",u1); + printf("tosop 1 %u\n",u); u = u1 - u2; - printf("tosop 2 %ud\n",u1); + printf("tosop 2 %u\n",u); u = u1 / u2; - printf("tosop 3 %ud\n",u1); + printf("tosop 3 %u\n",u); u = u1 * u2; - printf("tosop 4 %ud\n",u1); + printf("tosop 4 %u\n",u); u = u1 | u2; - printf("tosop 5 %ud\n",u1); + printf("tosop 5 %u\n",u); u = u1 & u2; - printf("tosop 6 %ud\n",u1); + printf("tosop 6 %u\n",u); u = u1 ^ u2; - printf("tosop 7 %ud\n",u1); + printf("tosop 7 %u\n",u); u = u1 << u2; - printf("tosop 8 %ud\n",u1); + printf("tosop 8 %u\n",u); u = u1 >> u2; - printf("tosop 9 %ud\n",u1); + printf("tosop 9 %u\n",u); } // oprtc(int op,int v) @@ -628,47 +664,47 @@ oprtc() { int i1,i; - unsigned int ui1,u; + unsigned int u1,u; i1 = -555; - ui1 = 632423423; + u1 = 632423423; i = i1 + 3; - printf("oprtc 1 %d\n",i1); + printf("oprtc 1 %d\n",i); i = i1 - 3; - printf("oprtc 2 %d\n",i1); + printf("oprtc 2 %d\n",i); i = i1 / 3; - printf("oprtc 3 %d\n",i1); + printf("oprtc 3 %d\n",i); i = i1 * 3; - printf("oprtc 4 %d\n",i1); + printf("oprtc 4 %d\n",i); i = i1 | 234234234; - printf("oprtc 5 %d\n",i1); - i = i1 & 234234234234; - printf("oprtc 6 %d\n",i1); - i = i1 ^ 234234234234; - printf("oprtc 7 %d\n",i1); + printf("oprtc 5 %d\n",i); + i = i1 & 23234234; + printf("oprtc 6 %d\n",i); + i = i1 ^ 23234234; + printf("oprtc 7 %d\n",i); i = i1 << 5; - printf("oprtc 8 %d\n",i1); + printf("oprtc 8 %d\n",i); i = i1 >> 5; - printf("oprtc 9 %d\n",i1); + printf("oprtc 9 %d\n",i); u = u1 + 3; - printf("oprtc 1 %ud\n",u1); + printf("oprtc 1 %u\n",u); u = u1 - 3; - printf("oprtc 2 %ud\n",u1); + printf("oprtc 2 %u\n",u); u = u1 / 3; - printf("oprtc 3 %ud\n",u1); + printf("oprtc 3 %u\n",u); u = u1 * 3; - printf("oprtc 4 %ud\n",u1); + printf("oprtc 4 %u\n",u); u = u1 | 234234234; - printf("oprtc 5 %ud\n",u1); + printf("oprtc 5 %u\n",u); u = u1 & 234234234; - printf("oprtc 6 %ud\n",u1); - u = u1 ^ 23234234234; - printf("oprtc 7 %ud\n",u1); + printf("oprtc 6 %u\n",u); + u = u1 ^ 234234234; + printf("oprtc 7 %u\n",u); u = u1 << 5; - printf("oprtc 8 %ud\n",u1); + printf("oprtc 8 %u\n",u); u = u1 >> 5; - printf("oprtc 9 %ud\n",u1); + printf("oprtc 9 %u\n",u); } @@ -687,13 +723,14 @@ } // code_dregister(int e2,int freg,int d) +void code_dregister() { register float f0,f1; register double d0,d1; f0 = 0.0; f1 = 0.2; d0 = 10; d1 = 10e10; - printf("code_lvar float %f %f %g %g\n",i1,i2,f0,f1,d0,d1); + printf("code_lvar float %f %f %g %g\n",f0,f1,d0,d1); } // code_dassign_gvar(int e2,int freg,int d) @@ -704,15 +741,17 @@ void code_dassign() { - float i1,i2; + int i1,i2; + float f1,f2; double ui1,ui2; float *pi1,*pi2; double *pui1,*pui2; i1 = -555; i2= 555; + f1 = -555; f2= 555; ui1 = 632423423; ui2= 32394234; - pi1 = &i1; - pi2 = &i2; + pi1 = &f1; + pi2 = &f2; pui1 = &ui1; pui2 = &ui2; @@ -749,7 +788,7 @@ { double d; int i; - i = 24234342342; + i = 242342342; d = i; printf("code_i2d %g\n",d); } @@ -767,7 +806,7 @@ { double d; unsigned int i; - i = 24234342342; + i = 242342342; d = i; printf("code_u2d %g\n",d); } @@ -785,7 +824,7 @@ { float d; int i; - i = 24234342342; + i = 24234342; d = i; printf("code_i2f %g\n",d); } @@ -803,7 +842,7 @@ { float d; unsigned int i; - i = 24234342342; + i = 242342342; d = i; printf("code_u2f %g\n",d); } @@ -815,10 +854,10 @@ { f0 = 0.0; f1 = 0.2; d0 = 10; d1 = 10e10; - printf("code_gvar float %f %f %g %g\n",i1,i2,f0,f1,d0,d1); + printf("code_gvar float %f %f %g %g\n",f0,f1,d0,d1); s_f0 = 0.0; s_f1 = 0.2; s_d0 = 10; s_d1 = 10e10; - printf("code_gvar float %f %f %g %g\n",s_i1,s_i2,s_f0,s_f1,s_d0,s_d1); + printf("code_gvar float %f %f %g %g\n",s_f0,s_f1,s_d0,s_d1); } // code_drlvar(int e2,int d,int freg) @@ -829,7 +868,7 @@ double d0,d1; f0 = 0.0; f1 = 0.2; d0 = 10; d1 = 10e10; - printf("code_lvar float %f %f %g %g\n",i1,i2,f0,f1,d0,d1); + printf("code_lvar float %f %f %g %g\n",f0,f1,d0,d1); } @@ -861,30 +900,31 @@ dtosop() { double i1,i2,i; - float ui1,ui2,u; + float u1,u2,u; i1 = -555; i2= 555; - ui1 = 632423423; ui2= 32394234; + u1 = 632423423; u2= 32394234; i = i1 + i2; - printf("dtosop 1 %g\n",i1); + printf("dtosop 1 %g\n",i); i = i1 - i2; - printf("dtosop 2 %g\n",i1); + printf("dtosop 2 %g\n",i); i = i1 / i2; - printf("dtosop 3 %g\n",i1); + printf("dtosop 3 %g\n",i); i = i1 * i2; - printf("dtosop 4 %g\n",i1); + printf("dtosop 4 %g\n",i); u = u1 + u2; - printf("dtosop 1 %g\n",u1); + printf("dtosop 1 %g\n",u); u = u1 - u2; - printf("dtosop 2 %g\n",u1); + printf("dtosop 2 %g\n",u); u = u1 / u2; - printf("tosop 3 %g\n",u1); + printf("dtosop 3 %g\n",u); u = u1 * u2; - printf("dtosop 4 %g\n",u1); + printf("dtosop 4 %g\n",u); } // code_dassop(int op,int d) +void code_dassop() { double i1,i2; @@ -902,13 +942,13 @@ printf("code_dassop 4 %g\n",i1); ui1 += 3; - printf("code_dassop 1 %g\n",i1); + printf("code_dassop 1 %g\n",ui1); ui1 -= 3; - printf("code_dassop 2 %g\n",i1); + printf("code_dassop 2 %g\n",ui1); ui1 /= 3; - printf("code_dassop 3 %g\n",i1); + printf("code_dassop 3 %g\n",ui1); ui1 *= 3; - printf("code_dassop 4 %g\n",i1); + printf("code_dassop 4 %g\n",ui1); } @@ -1020,7 +1060,8 @@ // int lpop_register() // code_lregister(int e2,int reg) -code_register() +void +code_lregister() { register long long l0,l1; register unsigned long long ul0,ul1; @@ -1028,7 +1069,7 @@ l1 = 123123123LL; ul0 = 123123123LL; ul1 = 123123123LL; - printf("code_lvar long long %ll %ll %ull %ull\n",i1,i2,f0,f1,d0,d1); + printf("code_lvar long long %llu %llu %llu %llu\n",l0,l1,ul0,ul1); } // code_cmp_lregister(int reg) @@ -1112,12 +1153,12 @@ l1 = 123123123LL; ul0 = 123123123LL; ul1 = 123123123LL; - printf("code_lrgvar long long %ll %ll %ull %ull\n",i1,i2,f0,f1,d0,d1); + printf("code_lrgvar long long %lld %lld %llu %llu\n",l0,l1,ul0,ul1); s_l0 = 123123123LL; s_l1 = 123123123LL; s_ul0 = 123123123LL; s_ul1 = 123123123LL; - printf("code_lrgvar long long %ll %ll %ull %ull\n",s_i1,s_i2,s_f0,s_f1,s_d0,s_d1); + printf("code_lrgvar long long %lld %lld %llu %llu\n",s_l0,s_l1,s_ul0,s_ul1); } // code_lrlvar(int e1,int e2) @@ -1130,7 +1171,7 @@ l1 = 123123123LL; ul0 = 123123123LL; ul1 = 123123123LL; - printf("code_lvar long long %ll %ll %ull %ull\n",i1,i2,f0,f1,d0,d1); + printf("code_lvar long long %lld %lld %llu %llu\n",l0,l1,ul0,ul1); } // ltosop(int e1,int e2) @@ -1138,47 +1179,47 @@ ltosop() { long long i1,i2,i; - unsigned long long ui1,ui2,u; + unsigned long long u1,u2,u; i1 = -555; i2= 555; - ui1 = 632423423; ui2= 32394234; + u1 = 632423423; u2= 32394234; i = i1 + i2; - printf("ltosop 1 %lld\n",i1); + printf("ltosop 1 %lld\n",i); i = i1 - i2; - printf("ltosop 2 %lld\n",i1); + printf("ltosop 2 %lld\n",i); i = i1 / i2; - printf("ltosop 3 %lld\n",i1); + printf("ltosop 3 %lld\n",i); i = i1 * i2; - printf("ltosop 4 %lld\n",i1); + printf("ltosop 4 %lld\n",i); i = i1 | i2; - printf("ltosop 5 %lld\n",i1); + printf("ltosop 5 %lld\n",i); i = i1 & i2; - printf("ltosop 6 %lld\n",i1); + printf("ltosop 6 %lld\n",i); i = i1 ^ i2; - printf("ltosop 7 %lld\n",i1); + printf("ltosop 7 %lld\n",i); i = i1 << i2; - printf("ltosop 8 %lld\n",i1); + printf("ltosop 8 %lld\n",i); i = i1 >> i2; - printf("ltosop 9 %lld\n",i1); + printf("ltosop 9 %lld\n",i); u = u1 + u2; - printf("ltosop 1 %llud\n",u1); + printf("ltosop 1 %llu\n",u); u = u1 - u2; - printf("ltosop 2 %llud\n",u1); + printf("ltosop 2 %llu\n",u); u = u1 / u2; - printf("ltosop 3 %llud\n",u1); + printf("ltosop 3 %llu\n",u); u = u1 * u2; - printf("ltosop 4 %llud\n",u1); + printf("ltosop 4 %llu\n",u); u = u1 | u2; - printf("ltosop 5 %llud\n",u1); + printf("ltosop 5 %llu\n",u); u = u1 & u2; - printf("ltosop 6 %llud\n",u1); + printf("ltosop 6 %llu\n",u); u = u1 ^ u2; - printf("ltosop 7 %llud\n",u1); + printf("ltosop 7 %llu\n",u); u = u1 << u2; - printf("ltosop 8 %llud\n",u1); + printf("ltosop 8 %llu\n",u); u = u1 >> u2; - printf("ltosop 9 %llud\n",u1); + printf("ltosop 9 %llu\n",u); } // code_i2ll(int creg) @@ -1186,7 +1227,7 @@ { long long d; int i; - i = 2342342342; + i = 23442342; d = i; printf("code_i2ll %lld\n",d); } @@ -1195,7 +1236,7 @@ { unsigned long long d; int i; - i = 2342342342; + i = 23442342; d = i; printf("code_i2ull %lld\n",d); } @@ -1204,25 +1245,25 @@ { long long d; unsigned int i; - i = 2342342342; + i = 23442342; d = i; printf("code_u2ll %lld\n",d); } // code_u2ull(int creg) -void code_i2ull() +void code_u2ull() { unsigned long long d; unsigned int i; - i = 2342342342; + i = 23342342; d = i; - printf("code_u2ull %ulld\n",d); + printf("code_u2ull %llu\n",d); } // code_ll2i(int creg) void code_ll2i() { long long d; int i; - d = 2342342342; + d = 2342342342LL; i = d; printf("code_ll2i %d\n",i); } @@ -1231,7 +1272,7 @@ { long long d; unsigned int i; - d = 2342342342; + d = 2342342342LL; i = d; printf("code_ll2i %ud\n",i); } @@ -1240,7 +1281,7 @@ { unsigned long long d; int i; - d = 2342342342; + d = 2342342342LL; i = d; printf("code_ull2i %d\n",i); } @@ -1249,7 +1290,7 @@ { unsigned long long d; unsigned int i; - d = 2342342342; + d = 2342342342LL; i = d; printf("code_ll2i %ud\n",i); } @@ -1259,7 +1300,7 @@ { long long d; double i; - i = 2342342342; + i = 2342342342LL; d = i; printf("code_d2ll %lld\n",d); } @@ -1268,16 +1309,16 @@ { unsigned long long d; double i; - i = 2342342342; + i = 2342342342LL; d = i; - printf("code_d2ll %ulld\n",d); + printf("code_d2ll %llu\n",d); } // code_f2ll(int creg) void code_f2ll() { long long d; float i; - i = 2342342342; + i = 2342342342LL; d = i; printf("code_d2ll %lld\n",d); } @@ -1286,16 +1327,16 @@ { unsigned long long d; float i; - i = 2342342342; + i = 2342342342LL; d = i; - printf("code_d2ll %ulld\n",d); + printf("code_d2ll %llu\n",d); } // code_ll2d(int creg) void code_ll2d() { long long d; double i; - d = 2342342342; + d = 2342342342LL; i = d; printf("code_d2ll %g\n",i); } @@ -1304,7 +1345,7 @@ { long long d; float i; - d = 2342342342; + d = 2342342342LL; i = d; printf("code_d2ll %g\n",i); } @@ -1313,7 +1354,7 @@ { long long d; double i; - d = 2342342342; + d = 2342342342LL; i = d; printf("code_d2ll %g\n",i); } @@ -1322,14 +1363,12 @@ { long long d; float i; - d = 2342342342; + d = 2342342342LL; i = d; printf("code_d2ll %g\n",i); } #endif -#if LONGLONG_CODE - // code_lpreinc(int e1,int e2,int reg) void code_lpreinc() @@ -1354,7 +1393,7 @@ { unsigned long long i,j; i = 123123123;j = 0; - printf("code_preinc %ulld %ulld\n",++i,--j); + printf("code_preinc %llu %llu\n",++i,--j); } // code_lpostinc(int e1,int e2,int reg) @@ -1363,12 +1402,13 @@ { unsigned long long i,j; i = 123123123;j = 0; - printf("code_preinc %ulld %ulld\n",i++,j--); + printf("code_preinc %llu %llu\n",i++,j--); } // code_lassop(int op) // code_register_assop(int e2,int op,int byte) +void code_register_lassop() { register long long i1; @@ -1377,45 +1417,46 @@ ui1 = 632423423; i1 += 3; - printf("code_register_lassop 1 %d\n",i1); + printf("code_register_lassop 1 %lld\n",i1); i1 -= 3; - printf("code_register_lassop 2 %d\n",i1); + printf("code_register_lassop 2 %lld\n",i1); i1 /= 3; - printf("code_register_lassop 3 %d\n",i1); + printf("code_register_lassop 3 %lld\n",i1); i1 *= 3; - printf("code_register_lassop 4 %d\n",i1); + printf("code_register_lassop 4 %lld\n",i1); i1 |= 234; - printf("code_register_lassop 5 %d\n",i1); - i1 &= 2324234234234234; - printf("code_register_lassop 6 %d\n",i1); - i1 ^= 5523234234234234; - printf("code_register_lassop 7 %d\n",i1); + printf("code_register_lassop 5 %lld\n",i1); + i1 &= 2324234234234234LL; + printf("code_register_lassop 6 %lld\n",i1); + i1 ^= 5523234234234234LL; + printf("code_register_lassop 7 %lld\n",i1); i1 <<= 3; - printf("code_register_lassop 8 %d\n",i1); + printf("code_register_lassop 8 %lld\n",i1); i1 >>= 3; - printf("code_register_lassop 9 %d\n",i1); + printf("code_register_lassop 9 %lld\n",i1); ui1 += 3; - printf("code_register_lassop 1 %ud\n",i1); + printf("code_register_lassop 1 %llu\n",ui1); ui1 -= 3; - printf("code_register_lassop 2 %ud\n",i1); + printf("code_register_lassop 2 %llu\n",ui1); ui1 /= 3; - printf("code_register_lassop 3 %ud\n",i1); + printf("code_register_lassop 3 %llu\n",ui1); ui1 *= 3; - printf("code_register_lassop 4 %ud\n",i1); + printf("code_register_lassop 4 %llu\n",ui1); ui1 |= 234; - printf("code_register_lassop 5 %ud\n",i1); - ui1 &= 2324234234234234; - printf("code_register_lassop 6 %ud\n",i1); - ui1 ^= 5523234234234234; - printf("code_register_lassop 7 %ud\n",i1); + printf("code_register_lassop 5 %llu\n",ui1); + ui1 &= 2324234234234234LL; + printf("code_register_lassop 6 %llu\n",ui1); + ui1 ^= 5523234234234234LL; + printf("code_register_lassop 7 %llu\n",ui1); ui1 <<= 3; - printf("code_register_lassop 8 %ud\n",i1); + printf("code_register_lassop 8 %llu\n",ui1); ui1 >>= 3; - printf("code_register_lassop 9 %ud\n",i1); + printf("code_register_lassop 9 %llu\n",ui1); } // code_lassop(int op,int byte,int sign) +void code_lassop() { long long i1,i2; @@ -1424,42 +1465,42 @@ ui1 = 632423423; ui2= 32394234; i1 += 3; - printf("code_lassop 1 %d\n",i1); + printf("code_lassop 1 %lld\n",i1); i1 -= 3; - printf("code_lassop 2 %d\n",i1); + printf("code_lassop 2 %lld\n",i1); i1 /= 3; - printf("code_lassop 3 %d\n",i1); + printf("code_lassop 3 %lld\n",i1); i1 *= 3; - printf("code_lassop 4 %d\n",i1); + printf("code_lassop 4 %lld\n",i1); i1 |= 234; - printf("code_lassop 5 %d\n",i1); - i1 &= 2324234234234234; - printf("code_lassop 6 %d\n",i1); - i1 ^= 5523234234234234; - printf("code_lassop 7 %d\n",i1); + printf("code_lassop 5 %lld\n",i1); + i1 &= 2324234234234234LL; + printf("code_lassop 6 %lld\n",i1); + i1 ^= 5523234234234234LL; + printf("code_lassop 7 %lld\n",i1); i1 <<= 3; - printf("code_lassop 8 %d\n",i1); + printf("code_lassop 8 %lld\n",i1); i1 >>= 3; - printf("code_lassop 9 %d\n",i1); + printf("code_lassop 9 %lld\n",i1); ui1 += 3; - printf("code_lassop 1 %ud\n",i1); + printf("code_lassop 1 %llu\n",ui1); ui1 -= 3; - printf("code_lassop 2 %ud\n",i1); + printf("code_lassop 2 %llu\n",ui1); ui1 /= 3; - printf("code_lassop 3 %ud\n",i1); + printf("code_lassop 3 %llu\n",ui1); ui1 *= 3; - printf("code_lassop 4 %ud\n",i1); + printf("code_lassop 4 %llu\n",ui1); ui1 |= 234; - printf("code_lassop 5 %ud\n",i1); - ui1 &= 2324234234234234; - printf("code_lassop 6 %ud\n",i1); - ui1 ^= 5523234234234234; - printf("code_lassop 7 %ud\n",i1); + printf("code_lassop 5 %llu\n",ui1); + ui1 &= 2324234234234234LL; + printf("code_lassop 6 %llu\n",ui1); + ui1 ^= 5523234234234234LL; + printf("code_lassop 7 %llu\n",ui1); ui1 <<= 3; - printf("code_lassop 8 %ud\n",i1); + printf("code_lassop 8 %llu\n",ui1); ui1 >>= 3; - printf("code_lassop 9 %ud\n",i1); + printf("code_lassop 9 %llu\n",ui1); } // code_lgt(int cond)
--- a/test/code-gen.pl Thu Apr 08 22:18:27 2004 +0900 +++ b/test/code-gen.pl Sat Apr 10 22:15:29 2004 +0900 @@ -1,7 +1,7 @@ #!/usr/bin/perl print "#include \"code-gen.c\"\n"; -print "main() {\n"; +print "int main() {\n"; while(<>) { @@ -9,4 +9,4 @@ print "\t$&",");\n"; } } -print "}\n"; +print "return 1; }\n";