changeset 1:e8992ca15539

add test code
author Taiki TAIRA <e095767@ie.u-ryukyu.ac.jp>
date Fri, 15 Jun 2012 18:42:46 +0900
parents e16c397c8845
children c4f71c17c966
files CbCmemo.txt hello.cbc
diffstat 2 files changed, 22 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/CbCmemo.txt	Thu Apr 26 16:45:40 2012 +0900
+++ b/CbCmemo.txt	Fri Jun 15 18:42:46 2012 +0900
@@ -5,4 +5,18 @@
 loop 系の文は使わない。
     while for etc...
 
+-m64/-m32 
+    32 bit 環境用または64bit 環境用のコードを生成
+-ffreestanding 
+    コンパイル処理は自立環境(freestanding environment)で実行されるものと断定
+    標準ライブラリが存在しない可能性があり、main から始まらない可能性がある
+    暗黙的に[-fno-builtin]を指定
+-nostdlib
+    リンク時に標準システムスタートアップファイルや標準システムライブラリを使用しない。スタートアップは一切リンカに渡されない。libgcc を使用しない
+-pipe
+    コンパイル処理の各段階の間で通信を行うのに一時ファイルではなくpipeを使用
+-fno-common
+    初期化済みでない広域変数も共通ブロックとして生成するのではなくオブジェクト・ファイル中のbssセクションに割り当てます。 これには、 2つの異なるコンパイル単位の中で (externを使わずに) 同一の変数が宣言されていると、 それらをリンクする際にエラーが発生するようになるという効果があります。 これが役に立つかもしれない唯一のケースは、 常にこのような振る舞いをする他のシステム上でもプログラムが問題なく使えることを検証
 
+-fomit-frame-pointer
+    フレーム・ポインタを必要としない関数においては、 フレーム・ポインタをレジスタ内に保持しない 
--- a/hello.cbc	Thu Apr 26 16:45:40 2012 +0900
+++ b/hello.cbc	Fri Jun 15 18:42:46 2012 +0900
@@ -1,31 +1,24 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-__code loop_end(void)
-{
-    exit(0);
-}
+void loop0(int count);
 
 __code loop_print(int count)
 {
-    printf("helloWorld\n");
+    printf("loop_print\nhelloWorld\n");
     goto loop0(count);
 }
 
-__code loop0(int count)
+void loop0(int count)
 {
-    if (count <= 10) {
-        printf("count :%d\n", count);
-        goto loop_print(count+1);
-    } else {
-        goto loop_end();
-    }
+    printf("loop0\ncount :%d\n", count);
+    goto loop_print(count+1);
+    return;
 }
 
-int main (void)
+int main(void)
 {
     int count = 0;
-    goto loop0(count);
+    loop0(count);
     return 0;
 }
-