aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeddy <[email protected]>2014-05-07 11:55:51 +0800
committerTeddy <[email protected]>2014-05-07 11:55:51 +0800
commit30ecc9941b8da7a3c0108bc6117a1434e9caab94 (patch)
tree6a24b25086c63a4aa112fc6173b29c31793099d8
parentbbb4de0693ba2b010cd2c44805d9a4ee4a2a8904 (diff)
parent52b29440f8f1310e0c074c8eb409e433c56bdd62 (diff)
Merge /home/ymf/work/cibic into optimization
-rw-r--r--README.rst3
-rw-r--r--compile_data/custom_const.c (renamed from testbed/custom_opt.c)0
-rw-r--r--compile_data/custom_struct.c (renamed from testbed/custom_struct.c)0
-rw-r--r--compile_data/custom_struct2.c (renamed from testbed/custom_struct2.c)0
-rw-r--r--compile_data/custom_struct3.c (renamed from testbed/custom_struct3.c)0
-rw-r--r--compile_data/custom_struct4.c (renamed from testbed/custom_struct4.c)0
-rw-r--r--compile_data/custom_subexp.c9
-rw-r--r--compile_data/custom_subexp2.c10
-rw-r--r--compile_data/func_pointer.c (renamed from testbed/func_pointer.c)0
-rw-r--r--obsolete/dom.c (renamed from dom.c)0
-rw-r--r--semantics_data/anonymous_struct1.c (renamed from testcases/anonymous_struct1.c)0
-rw-r--r--semantics_data/anonymous_struct2.c (renamed from testcases/anonymous_struct2.c)0
-rw-r--r--semantics_data/array_complete.c (renamed from testcases/array_complete.c)0
-rw-r--r--semantics_data/array_decl.c (renamed from testcases/array_decl.c)0
-rw-r--r--semantics_data/array_decl2.c (renamed from testcases/array_decl2.c)0
-rw-r--r--semantics_data/cast.c (renamed from testcases/cast.c)0
-rw-r--r--semantics_data/cast2.c (renamed from testcases/cast2.c)0
-rw-r--r--semantics_data/cast3.c (renamed from testcases/cast3.c)0
-rw-r--r--semantics_data/conflict.c (renamed from testcases/conflict.c)0
-rw-r--r--semantics_data/decl_comp.c (renamed from testcases/decl_comp.c)0
-rw-r--r--semantics_data/decl_comp2.c (renamed from testcases/decl_comp2.c)0
-rw-r--r--semantics_data/decl_comp3.c (renamed from testcases/decl_comp3.c)0
-rw-r--r--semantics_data/fail1.c (renamed from testcases/fail1.c)0
-rw-r--r--semantics_data/fail10.c (renamed from testcases/fail10.c)0
-rw-r--r--semantics_data/fail11.c (renamed from testcases/fail11.c)0
-rw-r--r--semantics_data/fail2.c (renamed from testcases/fail2.c)0
-rw-r--r--semantics_data/fail3.c (renamed from testcases/fail3.c)0
-rw-r--r--semantics_data/fail4.c (renamed from testcases/fail4.c)0
-rw-r--r--semantics_data/fail5.c (renamed from testcases/fail5.c)0
-rw-r--r--semantics_data/fail6.c (renamed from testcases/fail6.c)0
-rw-r--r--semantics_data/fail7.c (renamed from testcases/fail7.c)0
-rw-r--r--semantics_data/fail8.c (renamed from testcases/fail8.c)0
-rw-r--r--semantics_data/function_returns_function.c (renamed from testcases/function_returns_function.c)0
-rw-r--r--semantics_data/global_decl.c (renamed from testcases/global_decl.c)0
-rw-r--r--semantics_data/incomp_initr.c (renamed from testcases/incomp_initr.c)0
-rw-r--r--semantics_data/incomp_param.c (renamed from testcases/incomp_param.c)0
-rw-r--r--semantics_data/local_struct.c (renamed from testcases/local_struct.c)0
-rw-r--r--semantics_data/param1.c (renamed from testcases/param1.c)0
-rw-r--r--semantics_data/param2.c (renamed from testcases/param2.c)0
-rw-r--r--semantics_data/param3.c (renamed from testcases/param3.c)0
-rw-r--r--semantics_data/pass.c (renamed from testcases/pass.c)0
-rw-r--r--semantics_data/ref.c (renamed from testcases/ref.c)0
-rw-r--r--semantics_data/sizeof.c (renamed from testcases/sizeof.c)0
-rw-r--r--semantics_data/typedef1.c (renamed from testcases/typedef1.c)0
-rw-r--r--semantics_data/typedef2.c (renamed from testcases/typedef2.c)0
-rw-r--r--semantics_data/typedef3.c (renamed from testcases/typedef3.c)0
-rw-r--r--semantics_data/typedef4.c (renamed from testcases/typedef4.c)0
-rw-r--r--semantics_data/void_decl.c (renamed from testcases/void_decl.c)0
-rw-r--r--semantics_data/void_decl2.c (renamed from testcases/void_decl2.c)0
-rwxr-xr-xtest_compile.sh (renamed from run.sh)6
-rwxr-xr-xtest_semantics.sh (renamed from test_all.sh)2
51 files changed, 25 insertions, 5 deletions
diff --git a/README.rst b/README.rst
index ad625af..c2c3a05 100644
--- a/README.rst
+++ b/README.rst
@@ -14,7 +14,8 @@ Features
- ``typedef`` support (together with complex decl)
- Forward declaration
- Real Single Static Assignment (with dominator frontier, renaming, interval
- building and registor allocation algorithm)
+ building and register allocation algorithm)
+- Safe and conservative CSE (common subexpression elimination)
- Sophisticated semantic checking
- Small memory footprint
- Sophisticated error reporting
diff --git a/testbed/custom_opt.c b/compile_data/custom_const.c
index d0126f3..d0126f3 100644
--- a/testbed/custom_opt.c
+++ b/compile_data/custom_const.c
diff --git a/testbed/custom_struct.c b/compile_data/custom_struct.c
index 0d473f5..0d473f5 100644
--- a/testbed/custom_struct.c
+++ b/compile_data/custom_struct.c
diff --git a/testbed/custom_struct2.c b/compile_data/custom_struct2.c
index e147186..e147186 100644
--- a/testbed/custom_struct2.c
+++ b/compile_data/custom_struct2.c
diff --git a/testbed/custom_struct3.c b/compile_data/custom_struct3.c
index d7060b3..d7060b3 100644
--- a/testbed/custom_struct3.c
+++ b/compile_data/custom_struct3.c
diff --git a/testbed/custom_struct4.c b/compile_data/custom_struct4.c
index 75f50ea..75f50ea 100644
--- a/testbed/custom_struct4.c
+++ b/compile_data/custom_struct4.c
diff --git a/compile_data/custom_subexp.c b/compile_data/custom_subexp.c
new file mode 100644
index 0000000..bce5bdb
--- /dev/null
+++ b/compile_data/custom_subexp.c
@@ -0,0 +1,9 @@
+int N = 0;
+void f() { N = 2; }
+int main() {
+ int a, b;
+ a = N + 1;
+ f();
+ b = N + 1;
+ printf("%d\n", b);
+}
diff --git a/compile_data/custom_subexp2.c b/compile_data/custom_subexp2.c
new file mode 100644
index 0000000..1e4af93
--- /dev/null
+++ b/compile_data/custom_subexp2.c
@@ -0,0 +1,10 @@
+int flag = 0;
+int check(int x, int y) {
+ return x > 0 && y > 0 && (flag ^= 1);
+}
+int main() {
+ int x = 1, y = 2;
+ printf("%d\n", check(x, y));
+ printf("%d\n", check(x, y));
+ printf("%d\n", check(x, y));
+}
diff --git a/testbed/func_pointer.c b/compile_data/func_pointer.c
index e7b6484..e7b6484 100644
--- a/testbed/func_pointer.c
+++ b/compile_data/func_pointer.c
diff --git a/dom.c b/obsolete/dom.c
index c6eaa97..c6eaa97 100644
--- a/dom.c
+++ b/obsolete/dom.c
diff --git a/testcases/anonymous_struct1.c b/semantics_data/anonymous_struct1.c
index 2709f70..2709f70 100644
--- a/testcases/anonymous_struct1.c
+++ b/semantics_data/anonymous_struct1.c
diff --git a/testcases/anonymous_struct2.c b/semantics_data/anonymous_struct2.c
index b17e6c0..b17e6c0 100644
--- a/testcases/anonymous_struct2.c
+++ b/semantics_data/anonymous_struct2.c
diff --git a/testcases/array_complete.c b/semantics_data/array_complete.c
index 79c5c8a..79c5c8a 100644
--- a/testcases/array_complete.c
+++ b/semantics_data/array_complete.c
diff --git a/testcases/array_decl.c b/semantics_data/array_decl.c
index 33973e5..33973e5 100644
--- a/testcases/array_decl.c
+++ b/semantics_data/array_decl.c
diff --git a/testcases/array_decl2.c b/semantics_data/array_decl2.c
index d7f8a04..d7f8a04 100644
--- a/testcases/array_decl2.c
+++ b/semantics_data/array_decl2.c
diff --git a/testcases/cast.c b/semantics_data/cast.c
index b441552..b441552 100644
--- a/testcases/cast.c
+++ b/semantics_data/cast.c
diff --git a/testcases/cast2.c b/semantics_data/cast2.c
index 34b3484..34b3484 100644
--- a/testcases/cast2.c
+++ b/semantics_data/cast2.c
diff --git a/testcases/cast3.c b/semantics_data/cast3.c
index 4500cb1..4500cb1 100644
--- a/testcases/cast3.c
+++ b/semantics_data/cast3.c
diff --git a/testcases/conflict.c b/semantics_data/conflict.c
index f2798e7..f2798e7 100644
--- a/testcases/conflict.c
+++ b/semantics_data/conflict.c
diff --git a/testcases/decl_comp.c b/semantics_data/decl_comp.c
index f1b8bd2..f1b8bd2 100644
--- a/testcases/decl_comp.c
+++ b/semantics_data/decl_comp.c
diff --git a/testcases/decl_comp2.c b/semantics_data/decl_comp2.c
index f1298bd..f1298bd 100644
--- a/testcases/decl_comp2.c
+++ b/semantics_data/decl_comp2.c
diff --git a/testcases/decl_comp3.c b/semantics_data/decl_comp3.c
index 29d388f..29d388f 100644
--- a/testcases/decl_comp3.c
+++ b/semantics_data/decl_comp3.c
diff --git a/testcases/fail1.c b/semantics_data/fail1.c
index f80ecaa..f80ecaa 100644
--- a/testcases/fail1.c
+++ b/semantics_data/fail1.c
diff --git a/testcases/fail10.c b/semantics_data/fail10.c
index e287c6f..e287c6f 100644
--- a/testcases/fail10.c
+++ b/semantics_data/fail10.c
diff --git a/testcases/fail11.c b/semantics_data/fail11.c
index 4aa213a..4aa213a 100644
--- a/testcases/fail11.c
+++ b/semantics_data/fail11.c
diff --git a/testcases/fail2.c b/semantics_data/fail2.c
index a76d4e0..a76d4e0 100644
--- a/testcases/fail2.c
+++ b/semantics_data/fail2.c
diff --git a/testcases/fail3.c b/semantics_data/fail3.c
index ad47f5f..ad47f5f 100644
--- a/testcases/fail3.c
+++ b/semantics_data/fail3.c
diff --git a/testcases/fail4.c b/semantics_data/fail4.c
index 20033af..20033af 100644
--- a/testcases/fail4.c
+++ b/semantics_data/fail4.c
diff --git a/testcases/fail5.c b/semantics_data/fail5.c
index 0e8fba8..0e8fba8 100644
--- a/testcases/fail5.c
+++ b/semantics_data/fail5.c
diff --git a/testcases/fail6.c b/semantics_data/fail6.c
index 3419ce9..3419ce9 100644
--- a/testcases/fail6.c
+++ b/semantics_data/fail6.c
diff --git a/testcases/fail7.c b/semantics_data/fail7.c
index 5040408..5040408 100644
--- a/testcases/fail7.c
+++ b/semantics_data/fail7.c
diff --git a/testcases/fail8.c b/semantics_data/fail8.c
index 21efd5f..21efd5f 100644
--- a/testcases/fail8.c
+++ b/semantics_data/fail8.c
diff --git a/testcases/function_returns_function.c b/semantics_data/function_returns_function.c
index e590ddb..e590ddb 100644
--- a/testcases/function_returns_function.c
+++ b/semantics_data/function_returns_function.c
diff --git a/testcases/global_decl.c b/semantics_data/global_decl.c
index ff49829..ff49829 100644
--- a/testcases/global_decl.c
+++ b/semantics_data/global_decl.c
diff --git a/testcases/incomp_initr.c b/semantics_data/incomp_initr.c
index 1068284..1068284 100644
--- a/testcases/incomp_initr.c
+++ b/semantics_data/incomp_initr.c
diff --git a/testcases/incomp_param.c b/semantics_data/incomp_param.c
index c1ece5f..c1ece5f 100644
--- a/testcases/incomp_param.c
+++ b/semantics_data/incomp_param.c
diff --git a/testcases/local_struct.c b/semantics_data/local_struct.c
index 28cb223..28cb223 100644
--- a/testcases/local_struct.c
+++ b/semantics_data/local_struct.c
diff --git a/testcases/param1.c b/semantics_data/param1.c
index 6c22a2b..6c22a2b 100644
--- a/testcases/param1.c
+++ b/semantics_data/param1.c
diff --git a/testcases/param2.c b/semantics_data/param2.c
index 6b1726d..6b1726d 100644
--- a/testcases/param2.c
+++ b/semantics_data/param2.c
diff --git a/testcases/param3.c b/semantics_data/param3.c
index 8492455..8492455 100644
--- a/testcases/param3.c
+++ b/semantics_data/param3.c
diff --git a/testcases/pass.c b/semantics_data/pass.c
index a7d4481..a7d4481 100644
--- a/testcases/pass.c
+++ b/semantics_data/pass.c
diff --git a/testcases/ref.c b/semantics_data/ref.c
index 4644127..4644127 100644
--- a/testcases/ref.c
+++ b/semantics_data/ref.c
diff --git a/testcases/sizeof.c b/semantics_data/sizeof.c
index 4d0dceb..4d0dceb 100644
--- a/testcases/sizeof.c
+++ b/semantics_data/sizeof.c
diff --git a/testcases/typedef1.c b/semantics_data/typedef1.c
index e67c112..e67c112 100644
--- a/testcases/typedef1.c
+++ b/semantics_data/typedef1.c
diff --git a/testcases/typedef2.c b/semantics_data/typedef2.c
index be9f3a4..be9f3a4 100644
--- a/testcases/typedef2.c
+++ b/semantics_data/typedef2.c
diff --git a/testcases/typedef3.c b/semantics_data/typedef3.c
index 71c45d1..71c45d1 100644
--- a/testcases/typedef3.c
+++ b/semantics_data/typedef3.c
diff --git a/testcases/typedef4.c b/semantics_data/typedef4.c
index 0aeb0f4..0aeb0f4 100644
--- a/testcases/typedef4.c
+++ b/semantics_data/typedef4.c
diff --git a/testcases/void_decl.c b/semantics_data/void_decl.c
index 8a68b18..8a68b18 100644
--- a/testcases/void_decl.c
+++ b/semantics_data/void_decl.c
diff --git a/testcases/void_decl2.c b/semantics_data/void_decl2.c
index 30c7af6..30c7af6 100644
--- a/testcases/void_decl2.c
+++ b/semantics_data/void_decl2.c
diff --git a/run.sh b/test_compile.sh
index a3f67c3..073231c 100755
--- a/run.sh
+++ b/test_compile.sh
@@ -1,7 +1,7 @@
#! /bin/bash
-cp cibic testbed/
-cp lib.s testbed/
-cd testbed/
+cp cibic compile_data/
+cp lib.s compile_data/
+cd compile_data/
for f in *.c
do
echo $f
diff --git a/test_all.sh b/test_semantics.sh
index 03ff5d0..c84fc2a 100755
--- a/test_all.sh
+++ b/test_semantics.sh
@@ -1,5 +1,5 @@
#! /bin/bash
-dir=testcases/*.c
+dir=semantics_data/*.c
if [ "$#" != 0 ]; then
dir=$1
fi