changeset 676:5e71527f9fd6

*** empty log message ***
author kono
date Sun, 06 May 2007 18:48:13 +0900
parents ba7110017db5
children 83459d1afa0d
files Changes Makefile Makefile.ia32 Makefile.mips Makefile.powerpc mc-code-ia32.c mc-code-powerpc.c mc-codegen.c mc-parse.c mc.h test/basic.c test/stackframe.c
diffstat 12 files changed, 373 insertions(+), 491 deletions(-) [+]
line wrap: on
line diff
--- a/Changes	Sat May 05 14:50:39 2007 +0900
+++ b/Changes	Sun May 06 18:48:13 2007 +0900
@@ -9279,4 +9279,78 @@
 ia32 のmake diff が通らないのは、「まだ」stack frame がずれ
 ているからだ。%edi を壊しているね。
 
-
+(gdb) x/20x $r1
+0xff909150:     0xff909180      0x00000000      0x00000000      0x00000001
+0xff909160:     0x00000002      0x00000003      0x00000004      0x00000005
+0xff909170:     0x00000006      0x00000007      0x0ff8dff4      0xff909180
+0xff909180:     0xff909350      0x10001344      0x00000008      0x00000009
+0xff909190:     0x0000000a      0x0000000b      0x0000000c      0x0000000d
+(gdb) 
+0xff9091a0:     0x0000000e      0x0000000f      0x00000010      0x00000011
+0xff9091b0:     0x00000012      0x00000013      0x00000014      0x00000015
+0xff9091c0:     0x00000016      0x00000017      0x00000018      0x00000019
+0xff9091d0:     0x0000001a      0x0000001b      0x0000001c      0x0000001d
+0xff9091e0:     0x0000001e      0x0000001f      0x00000020      0x00000021
+
+PS3 のPPC は、やっぱり引数の上に、なんか乗っているんだな。それが普通なのか。
+だったら、そうするか。(stdarg を内蔵関数以外で実現することが出来なくなるが)
+
+Sun May  6 09:31:46 JST 2007
+
+Ps3のPPCはできたけど、開いている穴の大きさが8と16の差がある。r1_offset の制御が
+出来てないみたいだね。
+
+
+Sun May  6 17:47:59 JST 2007
+
+statement expression が関数の引数の中で呼ばれると、
+
+	b L1
+    L2:
+	fuga
+                     use REGSTER  %esi AS temp  (a)
+	st value
+                     free %esi
+   
+	j L3
+    L1:
+	.........
+                     saved input in register var %esi
+	b L2             (a) が起きて、%esi を壊す
+    L3:
+	value 
+
+となって、esi を壊してしまう。complex argument のsaveと衝突するわけ
+だ。
+
+これは、他のarchitecure でも起きる問題なのか。ちょっと、
+根が深いな...
+
+statement expression の中で、temp として使ったregister var
+のlistを覚えておいて、それを LCALL でsave restore してやれ
+ば良い。
+
+あるいは、LCALL の時点で使っているレジスタ変数をすべて
+save/restore すれば良い。こちらの方が簡単だが量が多い。
+
+そうすると、statement expression の中で変更された
+レジスタ変数をoverwriteしてしまうので、だめ。
+
+	b L1
+    L2:
+	fuga
+                     use REGSTER  %esi AS temp  (a)
+	st value
+                     free %esi
+	j L3
+    L1:
+	.........
+                     saved input in register var %esi
+        save_register %esi
+	b L2             (a) が起きる
+    L3:
+        restore register %esi
+	value 
+
+というタイミングか。それよりは、その時点でparse treeを展開した方が
+まだ、ましか...
--- a/Makefile	Sat May 05 14:50:39 2007 +0900
+++ b/Makefile	Sun May 06 18:48:13 2007 +0900
@@ -1,7 +1,8 @@
 # CC = gcc -std=c99
 CC = cc 
 # -O3
-CFLAGS = -g -O -Wall -I. -DUSE_CODE_KEYWORD
+MCFLAGS = -DUSE_CODE_KEYWORD
+CFLAGS = -g -O -Wall -I. $(MCFLAGS)
 # CFLAGS = -g -Wall -I. -pg -fprofile-arcs -ftest-coverage
 # LDFLAGS = -pg
 # for Linux Zaurus
@@ -165,6 +166,17 @@
 	-$(CC) $(TARGET).s $(MLIB)
 	-./a.out > $(TARGET).code-out
 
+check-flip: mc $(MC)
+	-$(CC) -DFLIP -c test/basic2.c
+	-$(CC) basic2.o test/basic2.c
+	./a.out
+	-./$(MC) -s test/basic2.c
+	-$(CC) test/basic2.s -DFLIP test/basic2.c
+	./a.out
+	-./$(MC) -DFLIP -s test/basic2.c
+	-$(CC) test/basic2.s test/basic2.c
+	./a.out
+
 test/code-gen-all.c: test/code-gen.pl test/code-gen.c
 	perl test/code-gen.pl < test/code-gen.c > test/code-gen-all.c
 
@@ -203,37 +215,37 @@
 	$(CC) -g -o $@ $(PRINTF) b00.s b01.s b02.s b03.s b04.s mc-macro.o mc-inline.o $(CONVERTER)
 
 b00.s : mc-parse.c $(MC)
-	./$(MC) -s -ob00.s mc-parse.c
+	./$(MC) $(MCFLAGS) -s -ob00.s mc-parse.c
 b01.s : $(CODE) $(MC)
-	./$(MC) -s -ob01.s $(CODE)
+	./$(MC) $(MCFLAGS) -s -ob01.s $(CODE)
 b02.s : mc-codegen.c $(MC)
-	./$(MC) -s -ob02.s mc-codegen.c
+	./$(MC) $(MCFLAGS) -s -ob02.s mc-codegen.c
 b03.s : mc-tree.c $(MC)
-	./$(MC) -s -ob03.s mc-tree.c
+	./$(MC) $(MCFLAGS) -s -ob03.s mc-tree.c
 b04.s : mc-switch.c $(MC)
-	./$(MC) -s -ob04.s mc-switch.c
+	./$(MC) $(MCFLAGS) -s -ob04.s mc-switch.c
 
 b10.s : mc-parse.c mc1
-	./mc1 -s -ob10.s mc-parse.c
+	./mc1 $(MCFLAGS) -s -ob10.s mc-parse.c
 b11.s : $(CODE) $(PRINTF) mc1
-	./mc1 -s -ob11.s $(CODE)
+	./mc1 $(MCFLAGS) -s -ob11.s $(CODE)
 b12.s : mc-codegen.c mc1
-	./mc1 -s -ob12.s mc-codegen.c
+	./mc1 $(MCFLAGS) -s -ob12.s mc-codegen.c
 b13.s : mc-tree.c mc1
-	./mc1 -s -ob13.s mc-tree.c
+	./mc1 $(MCFLAGS) -s -ob13.s mc-tree.c
 b14.s : mc-switch.c mc1
-	./mc1 -s -ob14.s mc-switch.c
+	./mc1 $(MCFLAGS) -s -ob14.s mc-switch.c
 
 b20.s : mc-parse.c mc2
-	./mc2 -s -ob20.s mc-parse.c
+	./mc2 $(MCFLAGS) -s -ob20.s mc-parse.c
 b21.s : $(CODE) $(PRINTF) mc2
-	./mc2 -s -ob21.s $(CODE)
+	./mc2 $(MCFLAGS) -s -ob21.s $(CODE)
 b22.s : mc-codegen.c mc2
-	./mc2 -s -ob22.s mc-codegen.c
+	./mc2 $(MCFLAGS) -s -ob22.s mc-codegen.c
 b23.s : mc-tree.c mc2
-	./mc2 -s -ob23.s mc-tree.c
+	./mc2 $(MCFLAGS) -s -ob23.s mc-tree.c
 b24.s : mc-switch.c mc1
-	./mc2 -s -ob24.s mc-switch.c
+	./mc2 $(MCFLAGS) -s -ob24.s mc-switch.c
 
 diff :  b00.s b01.s b02.s b03.s b04.s b10.s b11.s b12.s b13.s b14.s
 	-diff b00.s b10.s
--- a/Makefile.ia32	Sat May 05 14:50:39 2007 +0900
+++ b/Makefile.ia32	Sun May 06 18:48:13 2007 +0900
@@ -1,7 +1,8 @@
 # CC = gcc -std=c99
 CC = cc 
 # -O3
-CFLAGS = -g -O -Wall -I. -DUSE_CODE_KEYWORD
+MCFLAGS = -DUSE_CODE_KEYWORD
+CFLAGS = -g -O -Wall -I. $(MCFLAGS)
 # CFLAGS = -g -Wall -I. -pg -fprofile-arcs -ftest-coverage
 # LDFLAGS = -pg
 # for Linux Zaurus
@@ -165,6 +166,17 @@
 	-$(CC) $(TARGET).s $(MLIB)
 	-./a.out > $(TARGET).code-out
 
+check-flip: mc $(MC)
+	-$(CC) -DFLIP -c test/basic2.c
+	-$(CC) basic2.o test/basic2.c
+	./a.out
+	-./$(MC) -s test/basic2.c
+	-$(CC) test/basic2.s -DFLIP test/basic2.c
+	./a.out
+	-./$(MC) -DFLIP -s test/basic2.c
+	-$(CC) test/basic2.s test/basic2.c
+	./a.out
+
 test/code-gen-all.c: test/code-gen.pl test/code-gen.c
 	perl test/code-gen.pl < test/code-gen.c > test/code-gen-all.c
 
@@ -203,37 +215,37 @@
 	$(CC) -g -o $@ $(PRINTF) b00.s b01.s b02.s b03.s b04.s mc-macro.o mc-inline.o $(CONVERTER)
 
 b00.s : mc-parse.c $(MC)
-	./$(MC) -s -ob00.s mc-parse.c
+	./$(MC) $(MCFLAGS) -s -ob00.s mc-parse.c
 b01.s : $(CODE) $(MC)
-	./$(MC) -s -ob01.s $(CODE)
+	./$(MC) $(MCFLAGS) -s -ob01.s $(CODE)
 b02.s : mc-codegen.c $(MC)
-	./$(MC) -s -ob02.s mc-codegen.c
+	./$(MC) $(MCFLAGS) -s -ob02.s mc-codegen.c
 b03.s : mc-tree.c $(MC)
-	./$(MC) -s -ob03.s mc-tree.c
+	./$(MC) $(MCFLAGS) -s -ob03.s mc-tree.c
 b04.s : mc-switch.c $(MC)
-	./$(MC) -s -ob04.s mc-switch.c
+	./$(MC) $(MCFLAGS) -s -ob04.s mc-switch.c
 
 b10.s : mc-parse.c mc1
-	./mc1 -s -ob10.s mc-parse.c
+	./mc1 $(MCFLAGS) -s -ob10.s mc-parse.c
 b11.s : $(CODE) $(PRINTF) mc1
-	./mc1 -s -ob11.s $(CODE)
+	./mc1 $(MCFLAGS) -s -ob11.s $(CODE)
 b12.s : mc-codegen.c mc1
-	./mc1 -s -ob12.s mc-codegen.c
+	./mc1 $(MCFLAGS) -s -ob12.s mc-codegen.c
 b13.s : mc-tree.c mc1
-	./mc1 -s -ob13.s mc-tree.c
+	./mc1 $(MCFLAGS) -s -ob13.s mc-tree.c
 b14.s : mc-switch.c mc1
-	./mc1 -s -ob14.s mc-switch.c
+	./mc1 $(MCFLAGS) -s -ob14.s mc-switch.c
 
 b20.s : mc-parse.c mc2
-	./mc2 -s -ob20.s mc-parse.c
+	./mc2 $(MCFLAGS) -s -ob20.s mc-parse.c
 b21.s : $(CODE) $(PRINTF) mc2
-	./mc2 -s -ob21.s $(CODE)
+	./mc2 $(MCFLAGS) -s -ob21.s $(CODE)
 b22.s : mc-codegen.c mc2
-	./mc2 -s -ob22.s mc-codegen.c
+	./mc2 $(MCFLAGS) -s -ob22.s mc-codegen.c
 b23.s : mc-tree.c mc2
-	./mc2 -s -ob23.s mc-tree.c
+	./mc2 $(MCFLAGS) -s -ob23.s mc-tree.c
 b24.s : mc-switch.c mc1
-	./mc2 -s -ob24.s mc-switch.c
+	./mc2 $(MCFLAGS) -s -ob24.s mc-switch.c
 
 diff :  b00.s b01.s b02.s b03.s b04.s b10.s b11.s b12.s b13.s b14.s
 	-diff b00.s b10.s
--- a/Makefile.mips	Sat May 05 14:50:39 2007 +0900
+++ b/Makefile.mips	Sun May 06 18:48:13 2007 +0900
@@ -245,114 +245,3 @@
 
 # DO NOT DELETE
 
-mc-code-ia32.o: /usr/include/stdio.h /usr/include/features.h
-mc-code-ia32.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
-mc-code-ia32.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
-mc-code-ia32.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
-mc-code-ia32.o: /usr/include/bits/sched.h /usr/include/libio.h
-mc-code-ia32.o: /usr/include/_G_config.h /usr/include/wchar.h
-mc-code-ia32.o: /usr/include/bits/wchar.h /usr/include/gconv.h
-mc-code-ia32.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
-mc-code-ia32.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
-mc-code-ia32.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-codegen.h
-mc-code-ia32.o: mc-code.h
-mc-codegen.o: /usr/include/stdio.h /usr/include/features.h
-mc-codegen.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
-mc-codegen.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
-mc-codegen.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
-mc-codegen.o: /usr/include/bits/sched.h /usr/include/libio.h
-mc-codegen.o: /usr/include/_G_config.h /usr/include/wchar.h
-mc-codegen.o: /usr/include/bits/wchar.h /usr/include/gconv.h
-mc-codegen.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
-mc-codegen.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
-mc-codegen.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-codegen.h
-mc-codegen.o: mc-code.h mc-switch.h mc-inline.h
-mc-parse.o: /usr/include/stdio.h /usr/include/features.h
-mc-parse.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
-mc-parse.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
-mc-parse.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
-mc-parse.o: /usr/include/bits/sched.h /usr/include/libio.h
-mc-parse.o: /usr/include/_G_config.h /usr/include/wchar.h
-mc-parse.o: /usr/include/bits/wchar.h /usr/include/gconv.h
-mc-parse.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
-mc-parse.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
-mc-parse.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-codegen.h
-mc-parse.o: mc-switch.h mc-macro.h mc-inline.h conv/conv.h
-mc-tree.o: /usr/include/stdio.h /usr/include/features.h
-mc-tree.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
-mc-tree.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
-mc-tree.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
-mc-tree.o: /usr/include/bits/sched.h /usr/include/libio.h
-mc-tree.o: /usr/include/_G_config.h /usr/include/wchar.h
-mc-tree.o: /usr/include/bits/wchar.h /usr/include/gconv.h
-mc-tree.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
-mc-tree.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
-mc-tree.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h
-mc-switch.o: /usr/include/stdio.h /usr/include/features.h
-mc-switch.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
-mc-switch.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
-mc-switch.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
-mc-switch.o: /usr/include/bits/sched.h /usr/include/libio.h
-mc-switch.o: /usr/include/_G_config.h /usr/include/wchar.h
-mc-switch.o: /usr/include/bits/wchar.h /usr/include/gconv.h
-mc-switch.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
-mc-switch.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
-mc-switch.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-codegen.h
-mc-switch.o: mc-code.h
-mc-macro.o: /usr/include/stdio.h /usr/include/features.h
-mc-macro.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
-mc-macro.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
-mc-macro.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
-mc-macro.o: /usr/include/bits/sched.h /usr/include/libio.h
-mc-macro.o: /usr/include/_G_config.h /usr/include/wchar.h
-mc-macro.o: /usr/include/bits/wchar.h /usr/include/gconv.h
-mc-macro.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
-mc-macro.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
-mc-macro.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-macro.h
-mc-macro.o: mc-codegen.h mc-code.h
-conv/c.o: /usr/include/stdio.h /usr/include/features.h
-conv/c.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
-conv/c.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
-conv/c.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
-conv/c.o: /usr/include/bits/sched.h /usr/include/libio.h
-conv/c.o: /usr/include/_G_config.h /usr/include/wchar.h
-conv/c.o: /usr/include/bits/wchar.h /usr/include/gconv.h
-conv/c.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
-conv/c.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
-conv/c.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h conv/conv.h
-conv/c.o: conv/convdef.h conv/c.h
-conv/c2cbc.o: mc.h
-conv/cbc2c.o: mc.h
-conv/null.o: /usr/include/stdio.h /usr/include/features.h
-conv/null.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
-conv/null.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
-conv/null.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
-conv/null.o: /usr/include/bits/sched.h /usr/include/libio.h
-conv/null.o: /usr/include/_G_config.h /usr/include/wchar.h
-conv/null.o: /usr/include/bits/wchar.h /usr/include/gconv.h
-conv/null.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
-conv/null.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
-conv/null.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h conv/conv.h
-conv/null.o: conv/convdef.h conv/null.h
-mc-code-powerpc.o: /usr/include/stdio.h /usr/include/features.h
-mc-code-powerpc.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
-mc-code-powerpc.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
-mc-code-powerpc.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
-mc-code-powerpc.o: /usr/include/bits/sched.h /usr/include/libio.h
-mc-code-powerpc.o: /usr/include/_G_config.h /usr/include/wchar.h
-mc-code-powerpc.o: /usr/include/bits/wchar.h /usr/include/gconv.h
-mc-code-powerpc.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
-mc-code-powerpc.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
-mc-code-powerpc.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-code.h
-mc-code-powerpc.o: mc-codegen.h
-mc-code-mips.o: /usr/include/stdio.h /usr/include/features.h
-mc-code-mips.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
-mc-code-mips.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
-mc-code-mips.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
-mc-code-mips.o: /usr/include/bits/sched.h /usr/include/libio.h
-mc-code-mips.o: /usr/include/_G_config.h /usr/include/wchar.h
-mc-code-mips.o: /usr/include/bits/wchar.h /usr/include/gconv.h
-mc-code-mips.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
-mc-code-mips.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
-mc-code-mips.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-code.h
-mc-code-mips.o: mc-codegen.h
--- a/Makefile.powerpc	Sat May 05 14:50:39 2007 +0900
+++ b/Makefile.powerpc	Sun May 06 18:48:13 2007 +0900
@@ -262,177 +262,3 @@
 
 # DO NOT DELETE
 
-mc-code-ia32.o: /usr/include/stdio.h /usr/include/features.h
-mc-code-ia32.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
-mc-code-ia32.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
-mc-code-ia32.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stddef.h
-mc-code-ia32.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
-mc-code-ia32.o: /usr/include/libio.h /usr/include/_G_config.h
-mc-code-ia32.o: /usr/include/wchar.h /usr/include/bits/wchar.h
-mc-code-ia32.o: /usr/include/gconv.h
-mc-code-ia32.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stdarg.h
-mc-code-ia32.o: /usr/include/bits/libio-ldbl.h /usr/include/bits/stdio_lim.h
-mc-code-ia32.o: /usr/include/bits/sys_errlist.h
-mc-code-ia32.o: /usr/include/bits/stdio-ldbl.h mc.h mc-parse.h mc-codegen.h
-mc-code-ia32.o: mc-code.h mc-include.c
-mc-codegen.o: /usr/include/stdio.h /usr/include/features.h
-mc-codegen.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
-mc-codegen.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
-mc-codegen.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stddef.h
-mc-codegen.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
-mc-codegen.o: /usr/include/libio.h /usr/include/_G_config.h
-mc-codegen.o: /usr/include/wchar.h /usr/include/bits/wchar.h
-mc-codegen.o: /usr/include/gconv.h
-mc-codegen.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stdarg.h
-mc-codegen.o: /usr/include/bits/libio-ldbl.h /usr/include/bits/stdio_lim.h
-mc-codegen.o: /usr/include/bits/sys_errlist.h /usr/include/bits/stdio-ldbl.h
-mc-codegen.o: mc.h mc-parse.h mc-codegen.h mc-code.h mc-switch.h mc-inline.h
-mc-codegen.o: conv/conv.h
-mc-parse.o: /usr/include/stdio.h /usr/include/features.h
-mc-parse.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
-mc-parse.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
-mc-parse.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stddef.h
-mc-parse.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
-mc-parse.o: /usr/include/libio.h /usr/include/_G_config.h
-mc-parse.o: /usr/include/wchar.h /usr/include/bits/wchar.h
-mc-parse.o: /usr/include/gconv.h
-mc-parse.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stdarg.h
-mc-parse.o: /usr/include/bits/libio-ldbl.h /usr/include/bits/stdio_lim.h
-mc-parse.o: /usr/include/bits/sys_errlist.h /usr/include/bits/stdio-ldbl.h
-mc-parse.o: mc.h mc-parse.h mc-codegen.h mc-switch.h mc-macro.h mc-inline.h
-mc-parse.o: conv/conv.h
-mc-tree.o: /usr/include/stdio.h /usr/include/features.h
-mc-tree.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
-mc-tree.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
-mc-tree.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stddef.h
-mc-tree.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
-mc-tree.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h
-mc-tree.o: /usr/include/bits/wchar.h /usr/include/gconv.h
-mc-tree.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stdarg.h
-mc-tree.o: /usr/include/bits/libio-ldbl.h /usr/include/bits/stdio_lim.h
-mc-tree.o: /usr/include/bits/sys_errlist.h /usr/include/bits/stdio-ldbl.h
-mc-tree.o: mc.h mc-parse.h mc-codegen.h
-mc-switch.o: /usr/include/stdio.h /usr/include/features.h
-mc-switch.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
-mc-switch.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
-mc-switch.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stddef.h
-mc-switch.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
-mc-switch.o: /usr/include/libio.h /usr/include/_G_config.h
-mc-switch.o: /usr/include/wchar.h /usr/include/bits/wchar.h
-mc-switch.o: /usr/include/gconv.h
-mc-switch.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stdarg.h
-mc-switch.o: /usr/include/bits/libio-ldbl.h /usr/include/bits/stdio_lim.h
-mc-switch.o: /usr/include/bits/sys_errlist.h /usr/include/bits/stdio-ldbl.h
-mc-switch.o: mc.h mc-parse.h mc-codegen.h mc-code.h
-mc-inline.o: /usr/include/stdio.h /usr/include/features.h
-mc-inline.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
-mc-inline.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
-mc-inline.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stddef.h
-mc-inline.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
-mc-inline.o: /usr/include/libio.h /usr/include/_G_config.h
-mc-inline.o: /usr/include/wchar.h /usr/include/bits/wchar.h
-mc-inline.o: /usr/include/gconv.h
-mc-inline.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stdarg.h
-mc-inline.o: /usr/include/bits/libio-ldbl.h /usr/include/bits/stdio_lim.h
-mc-inline.o: /usr/include/bits/sys_errlist.h /usr/include/bits/stdio-ldbl.h
-mc-inline.o: mc.h mc-parse.h mc-codegen.h mc-switch.h mc-code.h mc-inline.h
-mc-macro.o: /usr/include/stdio.h /usr/include/features.h
-mc-macro.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
-mc-macro.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
-mc-macro.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stddef.h
-mc-macro.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
-mc-macro.o: /usr/include/libio.h /usr/include/_G_config.h
-mc-macro.o: /usr/include/wchar.h /usr/include/bits/wchar.h
-mc-macro.o: /usr/include/gconv.h
-mc-macro.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stdarg.h
-mc-macro.o: /usr/include/bits/libio-ldbl.h /usr/include/bits/stdio_lim.h
-mc-macro.o: /usr/include/bits/sys_errlist.h /usr/include/bits/stdio-ldbl.h
-mc-macro.o: mc.h mc-parse.h mc-macro.h mc-codegen.h mc-code.h
-conv/c.o: /usr/include/stdio.h /usr/include/features.h
-conv/c.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
-conv/c.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
-conv/c.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stddef.h
-conv/c.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
-conv/c.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h
-conv/c.o: /usr/include/bits/wchar.h /usr/include/gconv.h
-conv/c.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stdarg.h
-conv/c.o: /usr/include/bits/libio-ldbl.h /usr/include/bits/stdio_lim.h
-conv/c.o: /usr/include/bits/sys_errlist.h /usr/include/bits/stdio-ldbl.h mc.h
-conv/c.o: mc-parse.h mc-codegen.h conv/conv.h conv/convdef.h conv/c.h
-conv/c2cbc.o: /usr/include/stdio.h /usr/include/features.h
-conv/c2cbc.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
-conv/c2cbc.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
-conv/c2cbc.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stddef.h
-conv/c2cbc.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
-conv/c2cbc.o: /usr/include/libio.h /usr/include/_G_config.h
-conv/c2cbc.o: /usr/include/wchar.h /usr/include/bits/wchar.h
-conv/c2cbc.o: /usr/include/gconv.h
-conv/c2cbc.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stdarg.h
-conv/c2cbc.o: /usr/include/bits/libio-ldbl.h /usr/include/bits/stdio_lim.h
-conv/c2cbc.o: /usr/include/bits/sys_errlist.h /usr/include/bits/stdio-ldbl.h
-conv/c2cbc.o: mc.h mc-parse.h mc-codegen.h conv/conv.h conv/convdef.h
-conv/c2cbc.o: conv/c2cbc.h
-conv/cbc2c.o: /usr/include/stdio.h /usr/include/features.h
-conv/cbc2c.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
-conv/cbc2c.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
-conv/cbc2c.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stddef.h
-conv/cbc2c.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
-conv/cbc2c.o: /usr/include/libio.h /usr/include/_G_config.h
-conv/cbc2c.o: /usr/include/wchar.h /usr/include/bits/wchar.h
-conv/cbc2c.o: /usr/include/gconv.h
-conv/cbc2c.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stdarg.h
-conv/cbc2c.o: /usr/include/bits/libio-ldbl.h /usr/include/bits/stdio_lim.h
-conv/cbc2c.o: /usr/include/bits/sys_errlist.h /usr/include/bits/stdio-ldbl.h
-conv/cbc2c.o: mc.h mc-parse.h mc-codegen.h conv/conv.h conv/convdef.h
-conv/cbc2c.o: conv/cbc2c.h
-conv/null.o: /usr/include/stdio.h /usr/include/features.h
-conv/null.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
-conv/null.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
-conv/null.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stddef.h
-conv/null.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
-conv/null.o: /usr/include/libio.h /usr/include/_G_config.h
-conv/null.o: /usr/include/wchar.h /usr/include/bits/wchar.h
-conv/null.o: /usr/include/gconv.h
-conv/null.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stdarg.h
-conv/null.o: /usr/include/bits/libio-ldbl.h /usr/include/bits/stdio_lim.h
-conv/null.o: /usr/include/bits/sys_errlist.h /usr/include/bits/stdio-ldbl.h
-conv/null.o: mc.h mc-parse.h conv/conv.h conv/convdef.h conv/null.h
-mc-code-arm.o: /usr/include/stdio.h /usr/include/features.h
-mc-code-arm.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
-mc-code-arm.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
-mc-code-arm.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stddef.h
-mc-code-arm.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
-mc-code-arm.o: /usr/include/libio.h /usr/include/_G_config.h
-mc-code-arm.o: /usr/include/wchar.h /usr/include/bits/wchar.h
-mc-code-arm.o: /usr/include/gconv.h
-mc-code-arm.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stdarg.h
-mc-code-arm.o: /usr/include/bits/libio-ldbl.h /usr/include/bits/stdio_lim.h
-mc-code-arm.o: /usr/include/bits/sys_errlist.h /usr/include/bits/stdio-ldbl.h
-mc-code-arm.o: mc.h mc-parse.h mc-code.h mc-codegen.h
-mc-code-powerpc.o: /usr/include/stdio.h /usr/include/features.h
-mc-code-powerpc.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
-mc-code-powerpc.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
-mc-code-powerpc.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stddef.h
-mc-code-powerpc.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
-mc-code-powerpc.o: /usr/include/libio.h /usr/include/_G_config.h
-mc-code-powerpc.o: /usr/include/wchar.h /usr/include/bits/wchar.h
-mc-code-powerpc.o: /usr/include/gconv.h
-mc-code-powerpc.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stdarg.h
-mc-code-powerpc.o: /usr/include/bits/libio-ldbl.h
-mc-code-powerpc.o: /usr/include/bits/stdio_lim.h
-mc-code-powerpc.o: /usr/include/bits/sys_errlist.h
-mc-code-powerpc.o: /usr/include/bits/stdio-ldbl.h mc.h mc-parse.h mc-code.h
-mc-code-powerpc.o: mc-codegen.h mc-include.c
-mc-code-mips.o: /usr/include/stdio.h /usr/include/features.h
-mc-code-mips.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
-mc-code-mips.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
-mc-code-mips.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stddef.h
-mc-code-mips.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
-mc-code-mips.o: /usr/include/libio.h /usr/include/_G_config.h
-mc-code-mips.o: /usr/include/wchar.h /usr/include/bits/wchar.h
-mc-code-mips.o: /usr/include/gconv.h
-mc-code-mips.o: /usr/lib/gcc/ppc64-redhat-linux/4.1.0/include/stdarg.h
-mc-code-mips.o: /usr/include/bits/libio-ldbl.h /usr/include/bits/stdio_lim.h
-mc-code-mips.o: /usr/include/bits/sys_errlist.h
-mc-code-mips.o: /usr/include/bits/stdio-ldbl.h mc.h mc-parse.h mc-code.h
-mc-code-mips.o: mc-codegen.h mc-include.c
--- a/mc-code-ia32.c	Sat May 05 14:50:39 2007 +0900
+++ b/mc-code-ia32.c	Sun May 06 18:48:13 2007 +0900
@@ -71,7 +71,6 @@
 #define __FLT_EPSILON__ 1.19209290e-7F\n\
 #define __LDBL_MIN__ 3.36210314311209350626e-4932L\n\
 #define __strong \n\
-#define __APPLE__ 1\n\
 #define __DECIMAL_DIG__ 21\n\
 #define __LDBL_HAS_QUIET_NAN__ 1\n\
 #define __DYNAMIC__ 1\n\
@@ -409,14 +408,14 @@
 #define round4(i)   ((i+0x3)&~0x3)
 
 
-#define func_disp_offset (8)
-#define code_disp_offset (8)
+#define func_disp_offset (16)
+#define code_disp_offset (16)
 
 #define arg_offset  8
 #define arg_offset1  0
 #define ARG_LVAR_OFFSET 0x10000000
 
-#define code_disp_offset0 (-8)
+#define code_disp_offset0 (-16)
 // disp_offset
 int disp_offset = code_disp_offset0;
 
@@ -462,8 +461,7 @@
     int l;
 #endif
     int code_f = is_code(fnptr);
-    int lvar_offsetv = 
-        round16(-disp);
+    int lvar_offsetv = round16(-disp);
     int r1_offsetv = round16(lvar_offsetv+max_func_args*SIZE_OF_INT+func_disp_offset)+8;
 
     if (code_f) {
@@ -1833,9 +1831,6 @@
 
     /* now all input register vars are free */
     code_save_stacks();
-#if FLOAT_CODE
-    code_save_fstacks();
-#endif
 
     // set_lreg(LREG_LREGISTER,0);
     set_freg(FREG_FREGISTER,0);
@@ -3395,6 +3390,9 @@
             if (regs[reg]!=REG_VAR) free_register(reg);
         }
     }
+#if FLOAT_CODE
+    code_save_fstacks();
+#endif
 }
 
 static void
--- a/mc-code-powerpc.c	Sat May 05 14:50:39 2007 +0900
+++ b/mc-code-powerpc.c	Sun May 06 18:48:13 2007 +0900
@@ -57,13 +57,10 @@
 #define __extension__\n\
 #define __const const\n\
 #define __inline__ inline\n\
-#define __builtin_va_list struct __vv {int *p; double *d;}\n\
-#define __builtin_va_start(ap,arg) (ap.p=(((int)(&arg))+sizeof(arg)),\
-                                   (ap.d=(double*)(ap.p+7)))\n\
-#define __builtin_va_arg(ap,type)  \
-           ((!__builtin_type_is_float(type))?\
-		(*((type *)ap.p)++):\
-		((type)(*(ap.d++))))\n\
+#define __builtin_va_list int\n\
+#define __builtin_va_start(ap,arg) ap=(((int)(&arg))+sizeof(arg))\n\
+#define __builtin_va_arg(ap,type)  (*((type *)ap)++)\n\
+// #define __builtin_va_arg(ap,type)  (*((type *)__builtin_va_next((type),&ap)))\n\
 #define alloca __builtin_alloca\n\
 #define __DBL_MIN_EXP__ (-1021)\n\
 #define __FLT_MIN__ 1.17549435e-38F\n\
@@ -190,6 +187,7 @@
 #ifndef __APPLE__
 static int arg_offset_label;
 #endif
+static int arg_offset_v = 0;
 
 static int reg_save;
 static int freg_save;
@@ -456,11 +454,11 @@
         lvar>0                         lvar<0       lvar>0x1000 0000
 
  function call stack frame (PS3)
-              <---------------r1_offset------------------------------>
-                                      r30-->
-                       <--arg_offset-->
-              <----------lvar_offset-->                         <----r1
- r+  +------+-+--------+---------------+----------+--------------+----+    -
+                <---------------r1_offset------------------------------>
+                                        r30-->
+                         <--arg_offset-->
+             xxx<----------lvar_offset-->                         <----r1
+ r+  +------+---+------+---------------+----------+--------------+----+    -
   callee arg   reg arg register save   local      caller arg     xx
                           reg_save      disp       max_func_args*SIZE_OF_INT
         lvar>0                         lvar<0       lvar>0x1000 0000
@@ -491,10 +489,10 @@
 #else
 
 #define arg_offset  (8)
+#define arg_offset0  (8)
 #define arg_offset1  (8)
 
 #define func_disp_offset (8)
-#define func_disp_offset1 (16)
 #define code_disp_offset0 (0)
 
 #endif
@@ -504,7 +502,11 @@
 #define CODE_LVAR(l) ((l)+code_disp_offset0)
 #define CODE_CALLER_ARG(l) ((l)+arg_offset1)
 #define FUNC_LVAR(l) ((l)+disp_offset)
+#ifdef __APPLE__
 #define CALLEE_ARG(l) ((l)+arg_offset)
+#else
+#define CALLEE_ARG(l) ((l)+arg_offset+((l>=arg_offset_v)?arg_offset0:0))
+#endif
 #define CALLER_ARG(l) ((l)+arg_offset1)
 
 #define round16(a)    ((a+0xf)&~0xf)
@@ -517,7 +519,7 @@
 #endif
     int lvar_offsetv = 
 	round16(-disp+max_func_args*SIZE_OF_INT)+func_disp_offset;
-    int r1_offsetv = round16(lvar_offsetv-reg_save)+func_disp_offset1;
+    int r1_offsetv = round16(lvar_offsetv-reg_save);
 
     printf(".set %s%d,%d\n",lpfx,lvar_offset_label,r1_offsetv-lvar_offsetv);
     if (r1_offsetv-lvar_offsetv > 65000) error(-1);
@@ -768,6 +770,11 @@
     // if (is_int_reg(creg) && creg!=ireg) error(-1);
 }
 
+/*
+    set variable storage type and offset
+    save register contents to our stack 
+    for & operator
+ */
 
 void
 code_arg_register(NMTBL *fnptr)
@@ -781,7 +788,7 @@
     int i;
     int is_code0 = is_code(fnptr);
     int dots;
-    int arg_offset_v = 0;
+    arg_offset_v = 0;
 
     function_type(fnptr->ty,&dots);
     while (args) {
@@ -826,15 +833,16 @@
         args = cadr(args);
     }
     if (is_function(fnptr)) {
-	code_save_input_registers(dots);
 #ifndef __APPLE__
 	if (dots) {
 		arg_offset_v =
-		    (MAX_TMP_REG -MIN_TMP_REG )*SIZE_OF_INT +
-		    (MAX_TMP_FREG +MIN_TMP_FREG)*SIZE_OF_DOUBLE;
+		    MAX_INPUT_REGISTER_VAR*SIZE_OF_INT +
+		    MAX_INPUT_DREGISTER_VAR*SIZE_OF_DOUBLE;
 	}
-	printf(".set %s%d, %d\n",lpfx, arg_offset_label,arg_offset_v);
+	printf(".set %s%d, %d\n",lpfx, arg_offset_label,
+	    arg_offset_v+ arg_offset);
 #endif
+	code_save_input_registers(dots);
     }
 }
 
@@ -2149,6 +2157,10 @@
     }
 }
 
+/*
+    store input argument into stack
+    we need this always because of one path compiler
+ */
 static void
 code_save_input_registers(int dots)
 {
@@ -2156,7 +2168,7 @@
     NMTBL *n;
     int reg;
     int tag;
-    int lvar;
+    // int lvar;
     int t;
     /* fnptr->dsp=list4(type,fnptr->dsp,(int)n,0); */
     int reg_offset = 0;
@@ -2169,14 +2181,12 @@
 	reg = n->dsp;
 	if (!n||n==&null_nptr) error(REG_ERR);
 	if (tag==REGISTER) {
-	    /* regs[reg]==INPUT_REG case should be considered */
 	    n->dsp = offset;
 	    offset+=SIZE_OF_INT;
 	    t = INT;
 	    reg += reg_offset; /* for duplicated floating point argument */
 	    reg_var++;
 	} else if (tag==DREGISTER) {
-	    /* regs[reg]==INPUT_REG case should be considered */
 	    n->dsp = offset;
 	    t = n->ty;
 #ifdef __APPLE__
@@ -2190,7 +2200,6 @@
 	    else error(-1);
 #endif
 	} else if (tag==LREGISTER) {
-	    /* regs[reg]==INPUT_REG case should be considered */
 	    n->dsp = offset;
 	    t = n->ty;
 	    offset+=SIZE_OF_LONGLONG; 
@@ -2202,7 +2211,6 @@
 	    continue;
 	}
 	n->sc  = LVAR;
-	lvar = list3(LVAR,n->dsp,0);
 	g_expr_u(assign_expr0(
 	    list3(LVAR,n->dsp,0),list3(tag,reg,(int)n),n->ty,t));
 	if (tag==REGISTER||tag==DREGISTER||tag==FREGISTER||tag==LREGISTER) {
@@ -2378,6 +2386,14 @@
 #define AS_SAVE 1
 #define AS_ARG  0
 
+/*
+     set storage type of caller's arguments
+         register or stack
+     this muse corprate with code_arg_register();
+     if AS_SAVE is set, register variable (or temporary local variable)
+     is used.
+ */
+
 static int
 get_input_arg(int t,int mode,int nargs,int reg_arg,int freg_arg) 
 {
@@ -3477,10 +3493,9 @@
 " stfd    29,-24(1)",
 " stfd    31,-16(1)",
 " stfd    30,-8(1)",
-" stw     0,8(1)",
+" stw     0,4(1)",
 " blr",
 ".restFP:    ",
-" lwz     1,0(1)",
 " lfd     14,-144(1)",
 " lfd     15,-136(1)",
 " lfd     16,-128(1)",
@@ -6405,8 +6420,13 @@
     case UCHAR: 		bitsz= 8; align=1;break; 
     case SHORT:         sign=1; bitsz=16; align=2;break; 
     case USHORT:        sign=1; bitsz=16; align=2;break; 
+#ifdef __APPLE__
     case LONGLONG:      sign=1; bitsz=64; align=4;l=1; break; 
     case ULONGLONG:            	bitsz=64; align=4;l=1; break; 
+#else
+    case LONGLONG:      sign=1; bitsz=64; align=8;l=1; break; 
+    case ULONGLONG:            	bitsz=64; align=8;l=1; break; 
+#endif
     default: error(-1);
     }
     *psign = sign;
--- a/mc-codegen.c	Sat May 05 14:50:39 2007 +0900
+++ b/mc-codegen.c	Sun May 06 18:48:13 2007 +0900
@@ -575,6 +575,7 @@
 	code_environment(USE_CREG);
 	return ADDRESS;
     case LCALL:
+	// we cannot trust register variable either...
 	code_save_stacks();
 	gen_jmp(e2);
 	fwddef(caddr(e1));
--- a/mc-parse.c	Sat May 05 14:50:39 2007 +0900
+++ b/mc-parse.c	Sun May 06 18:48:13 2007 +0900
@@ -1,6 +1,3 @@
-
-
-
 /************************************************************************
 ** Copyright (C) 2006 Shinji Kono
 ** g機鐚 紊у怨轡絖腱 羃渇 羃  
@@ -222,6 +219,7 @@
 
 static int ac,ac2;
 static char **av;
+extern int gdb(int a,int b,const char *c);
 
 int
 main(int argc, char **argv)
@@ -619,7 +617,7 @@
     reserve("__builtin_inf",BUILTIN_INF,RESERVE);
     reserve("__builtin_inff",BUILTIN_INFF,RESERVE);
     reserve("__builtin_infl",BUILTIN_INFL,RESERVE);
-    reserve("__builtin_type_is_float",BUILTIN_IS_FLOAT,RESERVE);
+//    reserve("__builtin_type_is_float",BUILTIN_IS_FLOAT,RESERVE);
     reserve("__attribute__",ATTRIBUTE,RESERVE);
     reserve("__attribute",ATTRIBUTE,RESERVE);
     reserve("__label__",LABEL,RESERVE);
@@ -2138,6 +2136,7 @@
     tmp_struct = 0;
 
     disp=0;
+    control=1;
     arg_register(fnptr); // should fix n1->dsp
 
     // make calling argments
@@ -2156,7 +2155,6 @@
 
     if(!chk) gen_enter1();
 
-    control=1;
     cslabel = -1;
 
     if(!chk) gen_inline(e);
@@ -3593,6 +3591,7 @@
 	type = DOUBLE;
 	e = list2(op,0);
 	return e;
+#if 0
     case BUILTIN_IS_FLOAT:
         conv->prefix_(sym);
         if(getsym(0)==LPAR) {
@@ -3631,6 +3630,7 @@
 	}
         type=INT;
         return list2(CONST,(t==FLOAT || t==DOUBLE));
+#endif
     case SIZEOF:
 	conv->prefix_(sym);
 	if(getsym(0)==LPAR) {
@@ -4960,7 +4960,6 @@
 {
     int ns;
     NMTBL *n;
-
     for(ns=hash->dsp;ns;ns=cadr(ns)) {
 	if (car(ns)==sc) {
 	    return (NMTBL*)caddr(ns);
@@ -5229,7 +5228,6 @@
 list2(int e1, int e2)
 {
     int e;
-
     e=getfree(2);
     heap[e]=e1;
     heap[e+1]=e2;
@@ -5300,6 +5298,7 @@
     return e;
 }
 
+
 extern int
 glist2(int e1,int e2)
 {
@@ -5671,4 +5670,18 @@
 extern char *cc3(int d) { fprintf(stderr,"heap[%d]=",d);return (char *)cadddr(d); }
 extern char *cc4(int d) { fprintf(stderr,"heap[%d]=",d);return (char *)caddddr(d); }
 
+int
+gdb(int h,int l,const char *name) {
+    static int counter;
+    if (heap[h]>1200) return h;
+    if (heap[h+1]>1200) 
+	fprintf(stderr, "gdb %d: heap[%d]=%d at %s:%d\n",counter++, h, heap[h+0],
+	name,l);
+    else
+	fprintf(stderr, "gdb %d: heap[%d]=%d %d at %s:%d\n",counter++, h, heap[h+0],heap[h+1],
+	name,l);
+    return h;
+}
+
+
 /* end */
--- a/mc.h	Sat May 05 14:50:39 2007 +0900
+++ b/mc.h	Sun May 06 18:48:13 2007 +0900
@@ -192,29 +192,28 @@
 #define BUILTIN_INF	16
 #define BUILTIN_INFF	17
 #define BUILTIN_INFL	18
-#define BUILTIN_IS_FLOAT	19
-#define LABEL  	20
+#define LABEL  	19
 
 #define NULLARY_ARGS(i) (i==RETURN||i==ENVIRONMENT||i==LCALL||i==REGISTER||i==DREGISTER||i==FREGISTER||i==LREGISTER||(GVAR<=(i%SOP)&&(i%SOP)<=LABEL))
 
 /* unary  argments */
 
-#define ADDRESS	21
-#define MINUS  	22
-#define LNOT   	23
-#define BNOT   	24
-#define INC    	25
-#define PERIOD 	26
-#define ARROW  	27
-#define POSTINC	28
-#define UPOSTINC       	29
-#define PREINC 	30
-#define UPREINC	31
-#define POSTDEC	32
-#define UPOSTDEC       	33
-#define PREDEC 	34
-#define UPREDEC	35
-#define DEC    	36
+#define ADDRESS	20
+#define MINUS  	21
+#define LNOT   	22
+#define BNOT   	23
+#define INC    	24
+#define PERIOD 	25
+#define ARROW  	26
+#define POSTINC	27
+#define UPOSTINC       	28
+#define PREINC 	29
+#define UPREINC	30
+#define POSTDEC	31
+#define UPOSTDEC       	32
+#define PREDEC 	33
+#define UPREDEC	34
+#define DEC    	35
 #define CPOSTINC (COP+POSTINC)
 #define CUPOSTINC (COP+UPOSTINC)
 #define CPREINC (COP+PREINC)
@@ -239,9 +238,9 @@
 #define LPREINC (LOP+PREINC)
 #define LUPOSTINC       (LOP+UPOSTINC)
 #define LUPREINC        (LOP+UPREINC)
-#define INDIRECT       	37
-#define RINDIRECT      	38
-#define URINDIRECT     	39
+#define INDIRECT       	36
+#define RINDIRECT      	37
+#define URINDIRECT     	38
 #define CRINDIRECT      (COP+RINDIRECT)
 #define CURINDIRECT     (COP+URINDIRECT)
 #define SRINDIRECT      (SOP+RINDIRECT)
@@ -250,61 +249,61 @@
 #define DRINDIRECT      (DOP+RINDIRECT)
 #define LRINDIRECT      (LOP+RINDIRECT)
 #define LURINDIRECT     (LOP+URINDIRECT)
-#define RSTRUCT	40
-#define ALLOCA 	41
-#define BUILTINP 	42
-#define BUILTIN_EXPECT 	43
-#define BUILTIN_FABS	44
-#define BUILTIN_FABSF	45
-#define BUILTIN_FABSL	46
-#define ATTRIBUTE 	47
-#define BIT_FIELD 	48
-#define RBIT_FIELD 	49
-#define BPREINC 	50
-#define BPOSTINC 	51
-#define CONV   	52
+#define RSTRUCT	39
+#define ALLOCA 	40
+#define BUILTINP 	41
+#define BUILTIN_EXPECT 	42
+#define BUILTIN_FABS	43
+#define BUILTIN_FABSF	44
+#define BUILTIN_FABSL	45
+#define ATTRIBUTE 	46
+#define BIT_FIELD 	47
+#define RBIT_FIELD 	48
+#define BPREINC 	49
+#define BPOSTINC 	50
+#define CONV   	51
 
 #define UNARY_ARGS(i) (ADDRESS<=(i%SOP)&&(i%SOP)<=CONV)
 
 /* binary  argments */
 
-#define MUL    	53
-#define UMUL   	54
-#define DIV    	55
-#define UDIV   	56
-#define MOD    	57
-#define UMOD   	58
-#define ADD    	59
-#define SUB    	60
-#define CMP    	61      
-#define RSHIFT 	62
-#define URSHIFT	63
-#define LSHIFT 	64
-#define ULSHIFT	65
-#define GT     	66
-#define UGT    	67
-#define GE     	68
-#define UGE    	69
-#define LT     	70
-#define ULT    	71
-#define LE     	72
-#define ULE    	73
-#define EQ     	74
-#define NEQ    	75
-#define BAND   	76
-#define EOR    	77
-#define BOR    	78
-#define LAND   	79
-#define LOR    	80
-#define ASS    	81
-#define UCMP   	82
-#define UCMPGE 	83
-#define CMPGE  	84
-#define CMPEQ  	85
-#define CMPNEQ 	86
-#define ASSOP  	87
-#define UASSOP 	88
-#define COMMA  	89
+#define MUL    	52
+#define UMUL   	53
+#define DIV    	54
+#define UDIV   	55
+#define MOD    	56
+#define UMOD   	57
+#define ADD    	58
+#define SUB    	59
+#define CMP    	60      
+#define RSHIFT 	61
+#define URSHIFT	62
+#define LSHIFT 	63
+#define ULSHIFT	64
+#define GT     	65
+#define UGT    	66
+#define GE     	67
+#define UGE    	68
+#define LT     	69
+#define ULT    	70
+#define LE     	71
+#define ULE    	72
+#define EQ     	73
+#define NEQ    	74
+#define BAND   	75
+#define EOR    	76
+#define BOR    	77
+#define LAND   	78
+#define LOR    	79
+#define ASS    	80
+#define UCMP   	81
+#define UCMPGE 	82
+#define CMPGE  	83
+#define CMPEQ  	84
+#define CMPNEQ 	85
+#define ASSOP  	86
+#define UASSOP 	87
+#define COMMA  	88
 
 #define CASS   	(COP+ASS)
 #define CASSOP 	(COP+ASSOP)
@@ -364,21 +363,21 @@
 #define LEOR    (LOP+EOR)
 #define LBOR    (LOP+BOR)
 
-#define BASS   	90
-#define BASSOP 	91
-#define BFD_REPL 	92
+#define BASS   	89
+#define BASSOP 	90
+#define BFD_REPL 	91
 
-#define JUMP 	93
+#define JUMP 	92
 
-#define STASS  	94
+#define STASS  	93
 
 
 #define BINARY_ARGS(i) ((MUL<=(i%SOP)&&(i%SOP)<=STASS)||i==ARRAY)
 
 /* ternary  argments */
 
-#define COND   	95
-#define UCOND  	96
+#define COND   	94
+#define UCOND  	95
 #define SCOND   (SOP+COND)
 #define SUCOND   (SOP+UCOND)
 #define DCOND   (DOP+COND)
@@ -390,33 +389,33 @@
 
 /* not appeared as tags */
 
-#define LPAR   	97
-#define RPAR   	98
-#define LBRA   	99
-#define RBRA   	100
-#define LC     	101
-#define RC     	102
-#define COLON  	103
-#define SM     	104
-#define CNAME  	105
+#define LPAR   	96
+#define RPAR   	97
+#define LBRA   	98
+#define RBRA   	99
+#define LC     	100
+#define RC     	101
+#define COLON  	102
+#define SM     	103
+#define CNAME  	104
 
-#define I2C  	106
-#define I2S  	107
-#define I2I    	108
-#define I2U    	109
-#define I2D    	110
-#define I2F    	111
-#define I2LL   	112
-#define I2ULL  	113
+#define I2C  	105
+#define I2S  	106
+#define I2I    	107
+#define I2U    	108
+#define I2D    	109
+#define I2F    	110
+#define I2LL   	111
+#define I2ULL  	112
 
-#define U2UC  	114
-#define U2US  	115
-#define U2I    	116
-#define U2U    	117
-#define U2D    	118
-#define U2F    	119
-#define U2LL   	120
-#define U2ULL  	121
+#define U2UC  	113
+#define U2US  	114
+#define U2I    	115
+#define U2U    	116
+#define U2D    	117
+#define U2F    	118
+#define U2LL   	119
+#define U2ULL  	120
 
 
 #define D2I     (DOP+I2I)
@@ -451,27 +450,27 @@
 
 /* statement start */
 
-#define ST_DECL		122
-#define ST_IF		123
-#define ST_DO		124
-#define ST_WHILE	125
-#define ST_FOR		126
-#define ST_SWITCH	127
-#define ST_COMP		128
-#define ST_BREAK	129
-#define ST_CONTINUE	130
-#define ST_CASE		131
-#define ST_DEFAULT	132
-#define ST_RETURN	133
-#define ST_GOTO		134
-#define ST_ASM		135
-#define ST_LABEL	136
-#define ST_OP		137
-#define ST_COMMENT	138
+#define ST_DECL		121
+#define ST_IF		122
+#define ST_DO		123
+#define ST_WHILE	124
+#define ST_FOR		125
+#define ST_SWITCH	126
+#define ST_COMP		127
+#define ST_BREAK	128
+#define ST_CONTINUE	129
+#define ST_CASE		130
+#define ST_DEFAULT	131
+#define ST_RETURN	132
+#define ST_GOTO		133
+#define ST_ASM		134
+#define ST_LABEL	135
+#define ST_OP		136
+#define ST_COMMENT	137
 
 #define IS_STATEMENT(i) (i==INLINE||(ST_DECL<=i&&i<=ST_COMMENT))
 
-#define HAS_ADDRESS	139
+#define HAS_ADDRESS	138
 
 /* statement end */
 
@@ -571,9 +570,15 @@
 
 extern void print_expr(int e, FILE *vout);
 
+
 #if 1
 extern int heapsize;
+#if 0
+int gdb(int a,int b,const char *c);
+#define CHECK_HEAP(b) ({int _k=(int)(b);gdb(_k,__LINE__,__FUNCTION__);if(_k>heapsize||_k<=0)error(-1);_k;})
+#else
 #define CHECK_HEAP(b) ({int _k=(int)(b);if(_k>heapsize||_k<=0)error(-1);_k;})
+#endif
 #else
 #define CHECK_HEAP(b)  (b)
 #endif
--- a/test/basic.c	Sat May 05 14:50:39 2007 +0900
+++ b/test/basic.c	Sun May 06 18:48:13 2007 +0900
@@ -114,6 +114,17 @@
     return a8;
 }
 
+INLINE
+long long 
+l50(
+long long a0,long long a1,long long a2,long long a3,long long a4,long long a5,long long a6,long long a7,long long a8,long long a9,long long a10,long long a11,long long a12,long long a13,long long a14,long long a15,long long a16,long long a17,long long a18,long long a19,long long a20,long long a21,long long a22,long long a23,long long a24,long long a25,long long a26,long long a27,long long a28,long long a29,long long a30,long long a31,long long a32,long long a33,long long a34,long long a35,long long a36,long long a37,long long a38,long long a39,long long a40,long long a41,long long a42,long long a43,long long a44,long long a45,long long a46,long long a47,long long a48,long long a49
+)
+{
+    printf("#0110:l50: %lld\n",
+a0+a1+a2+a3+a4+a5+a6+a7+a8+a9+a10+a11+a12+a13+a14+a15+a16+a17+a18+a19+a20+a21+a22+a23+a24+a25+a26+a27+a28+a29+a30+a31+a32+a33+a34+a35+a36+a37+a38+a39+a40+a41+a42+a43+a44+a45+a46+a47+a48+a49
+    );
+    return a8;
+}
 
 INLINE
 int 
@@ -160,6 +171,10 @@
 0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,25.0,26.0,27.0,28.0,29.0,30.0,31.0,32.0,33.0,34.0,35.0,36.0,37.0,38.0,39.0,40.0,41.0,42.0,43.0,44.0,45.0,46.0,47.0,48.0,49.0
 );
 
+l50(
+0LL,1LL,2LL,3LL,4LL,5LL,6LL,7LL,8LL,9LL,10LL,11LL,12LL,13LL,14LL,15LL,16LL,17LL,18LL,19LL,20LL,21LL,22LL,23LL,24LL,25LL,26LL,27LL,28LL,29LL,30LL,31LL,32LL,33LL,34LL,35LL,36LL,37LL,38LL,39LL,40LL,41LL,42LL,43LL,44LL,45LL,46LL,47LL,48LL,49LL
+);
+
     h(0,1,2,3,4,5,6,7,1);
 g(g(0,1,2,3,4,5,6,7,0),
     g(0,1,2,3,4,5,6,7,1),
--- a/test/stackframe.c	Sat May 05 14:50:39 2007 +0900
+++ b/test/stackframe.c	Sun May 06 18:48:13 2007 +0900
@@ -23,10 +23,19 @@
 
 static inline void frame_pointer(char *s)
 {
+#ifdef i386
+    void *fr,*st;
+    __asm__("\tmovl %%ebp,%0\n": "=r" (fr));
+    __asm__("\tmovl %%esp,%0\n": "=r" (st));
+    printf("fr=%08x st=%08x at %s\n",fr,st,s);
+#else
+#ifdef ppc
     void *fr,*st;
     __asm__("\tmr %0,31\n": "=r" (fr));
     __asm__("\tmr %0,1\n": "=r" (st));
     printf("fr=%08x st=%08x at %s\n",fr,st,s);
+#endif
+#endif
 }
 
 
@@ -74,12 +83,17 @@
 frame(int a0,int a1,int a2)
 {
     int l0 = L0;
-    int *top = (int *)__builtin_alloca(16);
+    int *top;
     int *p;
     int i = 0;
     int l1 = L1;
     frame_pointer("frame");
-    printf("alloca %08x\n",top);
+    if (a1==1) {
+	top = (int *)__builtin_alloca(16);
+	printf("alloca %08x\n",top);
+    } else {
+	top = &l0;
+    }
     printf("local  %08x\n",&l0);
 
     *top = L2;
@@ -88,21 +102,23 @@
     i = -OFFSET;
     for(p = top-OFFSET;p<top+0x100; ) {
 	if (*p==(int)ret) {
-	    printf("%08x: ret address\n",i);
+	    printf("%08x: %08x ret address\n",p,i);
 	} else if (*p==A0) {
-	    printf("%08x: caller arg 1\n",i);
+	    printf("%08x: %08x caller arg 1\n",p,i);
 	} else if (*p==A2) {
-	    printf("%08x: caller arg last\n",i);
+	    printf("%08x: %08x caller arg last\n",p,i);
 	} else if (*p==A3) {
-	    printf("%08x: callee arg 1\n",i);
+	    printf("%08x: %08x callee arg 1\n",p,i);
 	} else if (*p==A4) {
-	    printf("%08x: callee arg last\n",i);
+	    printf("%08x: %08x callee arg last\n",p,i);
 	} else if (*p==L0) {
-	    printf("%08x: local var top\n",i);
+	    printf("%08x: %08x local var top\n",p,i);
 	} else if (*p==L1) {
-	    printf("%08x: local var end\n",i);
+	    printf("%08x: %08x local var end\n",p,i);
 	} else if (*p==L2) {
-	    printf("%08x: stack top (alloca)\n",i);
+	    printf("%08x: %08x stack top (alloca)\n",p,i);
+	} else {
+	    // printf(" %08x",*p);
 	}
 	i+= sizeof(int);
 	p++;
@@ -116,6 +132,7 @@
     frame_pointer("main");
     ret = &&label;
     frame(A0,A1,A2);
+    frame(A0,1,A2);
     printf("\n");
     float_frame(A0);
     int_frame(A0);