From 75ff98e4d65862ff5b36b533b4f6e3ea71ede1d5 Mon Sep 17 00:00:00 2001 From: Tuowen Zhao Date: Sat, 17 Sep 2016 03:22:53 +0000 Subject: cmake build --- CMakeLists.txt | 13 + Makefile.am | 139 - Makefile.in | 1646 - README | 1 - README.md | 5 + aclocal.m4 | 1402 - buildall | 140 - chill/CMakeLists.txt | 59 + chill/include/chill_error.hh | 19 + chill/include/chill_run_util.hh | 29 + chill/include/chilldebug.h | 11 + chill/include/chillmodule.hh | 21 + chill/include/config.h.in | 32 + chill/include/dep.hh | 85 + chill/include/graph.hh | 319 + chill/include/ir_code.hh | 263 + chill/include/ir_rose.hh | 289 + chill/include/ir_rose_utils.hh | 18 + chill/include/irtools.hh | 40 + chill/include/loop.hh | 168 + chill/include/omegatools.hh | 97 + chill/src/chill_run.cc | 394 + chill/src/chill_run_util.cc | 129 + chill/src/chillmodule.cc | 1834 + chill/src/dep.cc | 567 + chill/src/ir_rose.cc | 2296 + chill/src/ir_rose_utils.cc | 88 + chill/src/irtools.cc | 279 + chill/src/loop.cc | 1870 + chill/src/loop_basic.cc | 1538 + chill/src/loop_datacopy.cc | 2166 + chill/src/loop_extra.cc | 224 + chill/src/loop_tile.cc | 630 + chill/src/loop_unroll.cc | 1166 + chill/src/omegatools.cc | 2312 + chill/src/parse_expr.ll | 24 + chill/src/parse_expr.yy | 85 + chill_error.hh | 19 - chill_run.cc | 394 - chill_run_util.cc | 129 - chill_run_util.hh | 29 - chilldebug.h | 11 - chillmodule.cc | 1834 - chillmodule.hh | 21 - compile | 347 - configure | 7048 -- configure.ac | 112 - dep.cc | 567 - dep.hh | 85 - depcomp | 530 - graph.hh | 319 - include/chill_error.hh | 1 - include/config.h.in | 32 - include/dep.hh | 1 - include/graph.hh | 1 - include/ir_code.hh | 1 - include/loop.hh | 1 - include/omegatools.hh | 1 - install-sh | 323 - ir_code.hh | 263 - ir_rose.cc | 2296 - ir_rose.hh | 289 - ir_rose_utils.cc | 88 - ir_rose_utils.hh | 18 - irtools.cc | 279 - irtools.hh | 40 - loop.cc | 1870 - loop.hh | 168 - loop_basic.cc | 1538 - loop_datacopy.cc | 2166 - loop_extra.cc | 224 - loop_tile.cc | 630 - loop_unroll.cc | 1166 - missing | 360 - omega/LICENSE | 705 - omega/Makefile.am | 2 - omega/aclocal.m4 | 1227 - omega/ar-lib | 270 - omega/basic/include/basic/Bag.c | 329 - omega/basic/include/basic/Bag.h | 78 - omega/basic/include/basic/BoolSet.h | 283 - omega/basic/include/basic/Collection.h | 47 - omega/basic/include/basic/Collections.h | 12 - omega/basic/include/basic/ConstString.h | 58 - omega/basic/include/basic/Dynamic_Array.c | 219 - omega/basic/include/basic/Dynamic_Array.h | 103 - omega/basic/include/basic/Iterator.h | 131 - omega/basic/include/basic/Link.h | 98 - omega/basic/include/basic/List.c | 149 - omega/basic/include/basic/List.h | 95 - omega/basic/include/basic/Map.c | 63 - omega/basic/include/basic/Map.h | 68 - omega/basic/include/basic/Section.c | 79 - omega/basic/include/basic/Section.h | 63 - omega/basic/include/basic/SimpleList.c | 105 - omega/basic/include/basic/SimpleList.h | 93 - omega/basic/include/basic/Tuple.c | 254 - omega/basic/include/basic/Tuple.h | 90 - omega/basic/include/basic/boolset-test.cc | 72 - omega/basic/include/basic/boolset.h | 637 - omega/basic/include/basic/omega_error.h | 14 - omega/basic/include/basic/util.h | 263 - omega/basic/src/ConstString.cc | 134 - omega/basic/src/Link.cc | 41 - omega/code_gen/include/code_gen/CG.h | 118 - omega/code_gen/include/code_gen/CG_outputBuilder.h | 177 - omega/code_gen/include/code_gen/CG_outputRepr.h | 31 - omega/code_gen/include/code_gen/CG_roseBuilder.h | 164 - omega/code_gen/include/code_gen/CG_roseRepr.h | 47 - omega/code_gen/include/code_gen/CG_stringBuilder.h | 44 - omega/code_gen/include/code_gen/CG_stringRepr.h | 43 - omega/code_gen/include/code_gen/CG_suifBuilder.h | 88 - omega/code_gen/include/code_gen/CG_suifRepr.h | 36 - omega/code_gen/include/code_gen/CG_utils.h | 45 - omega/code_gen/include/code_gen/code_gen.h | 47 - omega/code_gen/include/code_gen/codegen.h | 44 - omega/code_gen/include/code_gen/codegen_error.h | 15 - omega/code_gen/include/code_gen/cscope.out | 42592 --------- omega/code_gen/include/code_gen/output_repr.h | 46 - omega/code_gen/include/code_gen/rose_attributes.h | 91 - omega/code_gen/obj/Makefile.am | 10 - omega/code_gen/obj/Makefile.in | 671 - omega/code_gen/src/CG.cc | 1163 - omega/code_gen/src/CG_roseBuilder.cc | 1533 - omega/code_gen/src/CG_roseRepr.cc | 176 - omega/code_gen/src/CG_stringBuilder.cc | 487 - omega/code_gen/src/CG_stringRepr.cc | 54 - omega/code_gen/src/CG_suifBuilder.cc | 678 - omega/code_gen/src/CG_suifRepr.cc | 81 - omega/code_gen/src/CG_utils.cc | 1735 - omega/code_gen/src/code_gen.cc | 656 - omega/code_gen/src/codegen.cc | 378 - omega/code_gen/src/cscope.out | 89773 ------------------- omega/code_gen/src/output_repr.cc | 1931 - omega/code_gen/src/rose_attributes.cc | 183 - omega/code_gen/src/tags | 158 - omega/compile | 347 - omega/configure | 6643 -- omega/configure.ac | 39 - omega/depcomp | 530 - omega/doc/calculator.pdf | Bin 108062 -> 0 bytes omega/doc/interface.pdf | Bin 276190 -> 0 bytes omega/examples/basics | 30 - omega/examples/basics.out | 76 - omega/examples/c_code/Makefile | 21 - omega/examples/c_code/PT-example.c | 12 - omega/examples/c_code/example.c | 89 - omega/examples/c_code/library_example.c | 190 - omega/examples/code_gen | 60 - omega/examples/code_gen.out | 33 - omega/examples/experiments/gemm/codegen.input | 14 - omega/examples/experiments/gemm/gemm.out | 58 - omega/examples/experiments/gemv/codegen.input | 14 - omega/examples/experiments/gemv/gemv.out | 40 - omega/examples/experiments/lu/codegen.input | 33 - omega/examples/experiments/lu/lu.out | 141 - omega/examples/experiments/qr/codegen.input | 17 - omega/examples/experiments/qr/qr.out | 54 - omega/examples/experiments/swim/swim-codegen.input | 53 - omega/examples/experiments/swim/swim.out | 176 - omega/examples/floor_bound | 46 - omega/examples/floor_bound.out | 76 - omega/examples/gist | 60 - omega/examples/gist.out | 110 - omega/examples/hpf | 49 - omega/examples/hpf.out | 59 - omega/examples/hull | 102 - omega/examples/hull.out | 40 - omega/examples/if_then | 19 - omega/examples/interface | 15 - omega/examples/interface.out | 36 - omega/examples/lu | 41 - omega/examples/lu.out | 117 - omega/examples/old_test/affineClosure | 19 - omega/examples/old_test/affineClosure.oc-rt | 32 - omega/examples/old_test/affineClosure2 | 55 - omega/examples/old_test/affineClosure2.oc-rt | 70 - omega/examples/old_test/beatrice2 | 51 - omega/examples/old_test/beatrice2.oc-rt | 56 - omega/examples/old_test/blume1.w | 6 - omega/examples/old_test/blume1.w.oc-rt | 12 - omega/examples/old_test/cfft2d1 | 21 - omega/examples/old_test/cfft2d1.oc-rt | 29 - omega/examples/old_test/chosol | 11 - omega/examples/old_test/chosol.oc-rt | 32 - omega/examples/old_test/closure1 | 8 - omega/examples/old_test/closure1.oc-rt | 31 - omega/examples/old_test/closure2 | 4 - omega/examples/old_test/closure2.oc-rt | 22 - omega/examples/old_test/closure3 | 10 - omega/examples/old_test/closure3.oc-rt | 48 - omega/examples/old_test/closure4 | 8 - omega/examples/old_test/closure4.oc-rt | 28 - omega/examples/old_test/closure5 | 6 - omega/examples/old_test/closure5.oc-rt | 18 - omega/examples/old_test/closure6 | 13 - omega/examples/old_test/closure6.oc-rt | 29 - omega/examples/old_test/closure7 | 12 - omega/examples/old_test/closure7.oc-rt | 36 - omega/examples/old_test/closure8 | 1 - omega/examples/old_test/closure8.oc-rt | 6 - omega/examples/old_test/collard | 16 - omega/examples/old_test/collard.oc-rt | 49 - omega/examples/old_test/cover | 6 - omega/examples/old_test/cover.oc-rt | 16 - omega/examples/old_test/dagstuhl1 | 7 - omega/examples/old_test/dagstuhl1.oc-rt | 23 - omega/examples/old_test/dagstuhl2 | 6 - omega/examples/old_test/dagstuhl2.oc-rt | 11 - omega/examples/old_test/dagstuhl3 | 4 - omega/examples/old_test/dagstuhl3.oc-rt | 9 - omega/examples/old_test/davew1 | 25 - omega/examples/old_test/davew1.oc-rt | 67 - omega/examples/old_test/ddtest | 97 - omega/examples/old_test/ddtest.oc-rt | 152 - omega/examples/old_test/emit | 38 - omega/examples/old_test/emit.oc-rt | 61 - omega/examples/old_test/example1 | 4 - omega/examples/old_test/example1.oc-rt | 10 - omega/examples/old_test/farkas | 8 - omega/examples/old_test/farkas.oc-rt | 17 - omega/examples/old_test/farkas2 | 6 - omega/examples/old_test/farkas2.oc-rt | 22 - omega/examples/old_test/farkas3 | 3 - omega/examples/old_test/farkas3.oc-rt | 9 - omega/examples/old_test/fc1 | 23 - omega/examples/old_test/fc1.oc-rt | 89 - omega/examples/old_test/fc2 | 29 - omega/examples/old_test/fc2.oc-rt | 115 - omega/examples/old_test/foo | 13 - omega/examples/old_test/foo.oc-rt | 37 - omega/examples/old_test/foo2 | 3 - omega/examples/old_test/foo2.oc-rt | 8 - omega/examples/old_test/foo6 | 1 - omega/examples/old_test/foo6.oc-rt | 6 - omega/examples/old_test/forall | 21 - omega/examples/old_test/forall.oc-rt | 28 - omega/examples/old_test/gc | 6 - omega/examples/old_test/gc.oc-rt | 20 - omega/examples/old_test/ge | 9 - omega/examples/old_test/ge.oc-rt | 38 - omega/examples/old_test/givens2 | 15 - omega/examples/old_test/givens2.oc-rt | 38 - omega/examples/old_test/guard1 | 11 - omega/examples/old_test/guard1.oc-rt | 25 - omega/examples/old_test/hull1 | 4 - omega/examples/old_test/hull1.oc-rt | 14 - omega/examples/old_test/hull2 | 3 - omega/examples/old_test/hull2.oc-rt | 14 - omega/examples/old_test/hull3 | 17 - omega/examples/old_test/hull3.oc-rt | 40 - omega/examples/old_test/ip1 | 13 - omega/examples/old_test/ip1.oc-rt | 15 - omega/examples/old_test/ip2 | 11 - omega/examples/old_test/ip2.oc-rt | 13 - omega/examples/old_test/ip3 | 18 - omega/examples/old_test/ip3.oc-rt | 23 - omega/examples/old_test/iter1 | 2 - omega/examples/old_test/iter1.oc-rt | 9 - omega/examples/old_test/iter2 | 2 - omega/examples/old_test/iter2.oc-rt | 11 - omega/examples/old_test/iter3 | 2 - omega/examples/old_test/iter3.oc-rt | 11 - omega/examples/old_test/iter4 | 2 - omega/examples/old_test/iter4.oc-rt | 11 - omega/examples/old_test/iter5 | 2 - omega/examples/old_test/iter5.oc-rt | 11 - omega/examples/old_test/iter6 | 6 - omega/examples/old_test/iter6.oc-rt | 22 - omega/examples/old_test/iter7 | 3 - omega/examples/old_test/iter7.oc-rt | 15 - omega/examples/old_test/iter8 | 12 - omega/examples/old_test/iter8.oc-rt | 23 - omega/examples/old_test/iter9 | 40 - omega/examples/old_test/iter9.oc-rt | 121 - omega/examples/old_test/lefur00 | 15 - omega/examples/old_test/lefur00.oc-rt | 28 - omega/examples/old_test/lefur01 | 14 - omega/examples/old_test/lefur01.oc-rt | 103 - omega/examples/old_test/lefur03 | 16 - omega/examples/old_test/lefur03-3 | 20 - omega/examples/old_test/lefur03-3.oc-rt | 107 - omega/examples/old_test/lefur03.c | 36 - omega/examples/old_test/lefur03.oc-rt | 35 - omega/examples/old_test/lefur04 | 19 - omega/examples/old_test/lefur04.oc-rt | 42 - omega/examples/old_test/lefur05 | 49 - omega/examples/old_test/lefur05.oc-rt | 118 - omega/examples/old_test/lift1 | 16 - omega/examples/old_test/lift1.oc-rt | 147 - omega/examples/old_test/lift2 | 16 - omega/examples/old_test/lift2.oc-rt | 190 - omega/examples/old_test/long_input | 2 - omega/examples/old_test/long_input.oc-rt | 11 - omega/examples/old_test/lu_ijk | 17 - omega/examples/old_test/lu_ijk.oc-rt | 81 - omega/examples/old_test/lu_spmd | 19 - omega/examples/old_test/lu_spmd.oc-rt | 58 - omega/examples/old_test/m1 | 6 - omega/examples/old_test/m1.oc-rt | 41 - omega/examples/old_test/m10 | 5 - omega/examples/old_test/m10.oc-rt | 47 - omega/examples/old_test/m11 | 10 - omega/examples/old_test/m11.oc-rt | 32 - omega/examples/old_test/m12 | 8 - omega/examples/old_test/m12.oc-rt | 54 - omega/examples/old_test/m2 | 4 - omega/examples/old_test/m2.oc-rt | 35 - omega/examples/old_test/m3 | 2 - omega/examples/old_test/m3.oc-rt | 11 - omega/examples/old_test/m4 | 11 - omega/examples/old_test/m4.oc-rt | 28 - omega/examples/old_test/m7 | 6 - omega/examples/old_test/m7.oc-rt | 35 - omega/examples/old_test/m8 | 6 - omega/examples/old_test/m8.oc-rt | 35 - omega/examples/old_test/m9 | 5 - omega/examples/old_test/m9.oc-rt | 20 - omega/examples/old_test/maximize | 7 - omega/examples/old_test/maximize.oc-rt | 24 - omega/examples/old_test/olda | 9 - omega/examples/old_test/olda.oc-rt | 52 - omega/examples/old_test/p.delft | 22 - omega/examples/old_test/p.delft.oc-rt | 43 - omega/examples/old_test/p.delft2 | 24 - omega/examples/old_test/p.delft2.oc-rt | 80 - omega/examples/old_test/p.delft3 | 20 - omega/examples/old_test/p.delft3.oc-rt | 29 - omega/examples/old_test/p.subset | 3 - omega/examples/old_test/p.subset.oc-rt | 10 - omega/examples/old_test/p1 | 1 - omega/examples/old_test/p1.oc-rt | 6 - omega/examples/old_test/p10 | 1 - omega/examples/old_test/p10.oc-rt | 6 - omega/examples/old_test/p11 | 10 - omega/examples/old_test/p11.oc-rt | 17 - omega/examples/old_test/p12 | 7 - omega/examples/old_test/p12.oc-rt | 33 - omega/examples/old_test/p13 | 3 - omega/examples/old_test/p13.oc-rt | 13 - omega/examples/old_test/p2 | 1 - omega/examples/old_test/p2.oc-rt | 6 - omega/examples/old_test/p3 | 2 - omega/examples/old_test/p3.oc-rt | 8 - omega/examples/old_test/p4 | 5 - omega/examples/old_test/p4.oc-rt | 22 - omega/examples/old_test/p5 | 8 - omega/examples/old_test/p5.oc-rt | 16 - omega/examples/old_test/p6 | 25 - omega/examples/old_test/p6.oc-rt | 129 - omega/examples/old_test/p7 | 1 - omega/examples/old_test/p7.oc-rt | 7 - omega/examples/old_test/p8 | 6 - omega/examples/old_test/p8.oc-rt | 21 - omega/examples/old_test/p9 | 7 - omega/examples/old_test/p9.oc-rt | 13 - omega/examples/old_test/pufs1 | 2 - omega/examples/old_test/pufs1.oc-rt | 9 - omega/examples/old_test/pufs2 | 9 - omega/examples/old_test/pufs2.oc-rt | 35 - omega/examples/old_test/pufs3 | 8 - omega/examples/old_test/pufs3.oc-rt | 29 - omega/examples/old_test/pufs4 | 16 - omega/examples/old_test/pufs4.oc-rt | 26 - omega/examples/old_test/pufs5 | 22 - omega/examples/old_test/pufs5.oc-rt | 98 - omega/examples/old_test/pufs6 | 19 - omega/examples/old_test/pufs6.oc-rt | 42 - omega/examples/old_test/pufs7 | 6 - omega/examples/old_test/pufs7.oc-rt | 18 - omega/examples/old_test/reach1 | 5 - omega/examples/old_test/reach1.oc-rt | 9 - omega/examples/old_test/reach2 | 29 - omega/examples/old_test/reach2.oc-rt | 61 - omega/examples/old_test/reach3 | 18 - omega/examples/old_test/reach3.oc-rt | 40 - omega/examples/old_test/red1 | 3 - omega/examples/old_test/red1.oc-rt | 10 - omega/examples/old_test/saman | 20 - omega/examples/old_test/saman.oc-rt | 31 - omega/examples/old_test/sample1 | 14 - omega/examples/old_test/sample1.oc-rt | 39 - omega/examples/old_test/sample2 | 11 - omega/examples/old_test/sample2.oc-rt | 33 - omega/examples/old_test/sample3 | 11 - omega/examples/old_test/sample3.oc-rt | 37 - omega/examples/old_test/stodghil | 21 - omega/examples/old_test/stodghil.oc-rt | 28 - omega/examples/old_test/stride1 | 2 - omega/examples/old_test/stride1.oc-rt | 9 - omega/examples/old_test/stride2 | 4 - omega/examples/old_test/stride2.oc-rt | 14 - omega/examples/old_test/stride3 | 4 - omega/examples/old_test/stride3.oc-rt | 14 - omega/examples/old_test/stride4 | 4 - omega/examples/old_test/stride4.oc-rt | 12 - omega/examples/old_test/stride5 | 4 - omega/examples/old_test/stride5.oc-rt | 14 - omega/examples/old_test/stride6 | 10 - omega/examples/old_test/stride6.oc-rt | 36 - omega/examples/old_test/stride7 | 6 - omega/examples/old_test/stride7.oc-rt | 47 - omega/examples/old_test/subsets1 | 20 - omega/examples/old_test/subsets1.oc-rt | 70 - omega/examples/old_test/subsets2 | 5 - omega/examples/old_test/subsets2.oc-rt | 18 - omega/examples/old_test/tex1 | 49 - omega/examples/old_test/tex1.oc-rt | 58 - omega/examples/old_test/tricky | 11 - omega/examples/old_test/tricky.oc-rt | 25 - omega/examples/old_test/ts1d-check-sblock | 155 - omega/examples/old_test/ts1d-check-sblock.oc-rt | 227 - omega/examples/old_test/ts1d-check0 | 176 - omega/examples/old_test/ts1d-check0.oc-rt | 260 - omega/examples/old_test/ts1d-mp-i_ts-m_b | 289 - omega/examples/old_test/ts1d-mp-i_ts-m_b.oc-rt | 430 - omega/examples/old_test/ts1d-orig0 | 151 - omega/examples/old_test/ts1d-orig0.oc-rt | 220 - omega/examples/old_test/tseng | 16 - omega/examples/old_test/tseng.oc-rt | 54 - omega/examples/old_test/verlind1 | 44 - omega/examples/old_test/verlind1.oc-rt | 120 - omega/examples/old_test/verlind1a | 3 - omega/examples/old_test/verlind1a.oc-rt | 9 - omega/examples/old_test/wak1 | 13 - omega/examples/old_test/wak1.oc-rt | 87 - omega/examples/old_test/wak2 | 10 - omega/examples/old_test/wak2.oc-rt | 307 - omega/examples/old_test/wak3 | 12 - omega/examples/old_test/wak3.oc-rt | 59 - omega/examples/old_test/wak4 | 9 - omega/examples/old_test/wak4.oc-rt | 20 - omega/examples/old_test/wak5 | 4 - omega/examples/old_test/wak5.oc-rt | 11 - omega/examples/old_test/wak6 | 14 - omega/examples/old_test/wak6.oc-rt | 36 - omega/examples/old_test/wak7 | 5 - omega/examples/old_test/wak7.oc-rt | 11 - omega/examples/old_test/wak8 | 15 - omega/examples/old_test/wak8.oc-rt | 30 - omega/examples/old_test/wielage | 13 - omega/examples/old_test/wielage.oc-rt | 22 - omega/examples/old_test/wild | 13 - omega/examples/old_test/wild.oc-rt | 43 - omega/examples/old_test/wrap | 12 - omega/examples/old_test/wrap.oc-rt | 50 - omega/examples/old_test/wrap0 | 7 - omega/examples/old_test/wrap0.oc-rt | 26 - omega/examples/old_test/wrap1 | 8 - omega/examples/old_test/wrap1.oc-rt | 25 - omega/examples/old_test/x | 9 - omega/examples/old_test/x.oc-rt | 84 - omega/examples/pufs | 20 - omega/examples/pufs.out | 50 - omega/examples/substitution | 35 - omega/examples/substitution.out | 60 - omega/examples/syr2k | 17 - omega/examples/syr2k.out | 69 - omega/examples/union | 64 - omega/examples/union.out | 96 - omega/include/basic | 1 - omega/include/code_gen | 1 - omega/include/codegen.h | 1 - omega/include/config.h.in | 35 - omega/include/omega | 1 - omega/include/omega.h | 1 - omega/install-sh | 323 - omega/missing | 360 - omega/omega_calc/doc/calculator.pdf | Bin 108062 -> 0 bytes omega/omega_calc/include/omega_calc/AST.h | 310 - omega/omega_calc/include/omega_calc/PT-omega.c | 81 - omega/omega_calc/include/omega_calc/myflex.h | 27 - omega/omega_calc/obj/FlexLexer.h | 206 - omega/omega_calc/obj/Makefile.am | 32 - omega/omega_calc/obj/Makefile.in | 631 - omega/omega_calc/obj/lex.yy.cc | 3966 - omega/omega_calc/obj/tile.script | 5 - omega/omega_calc/src/AST.cc | 467 - omega/omega_calc/src/myflex.cc | 421 - omega/omega_calc/src/parser.l | 350 - omega/omega_calc/src/parser.ll | 350 - omega/omega_calc/src/parser.y | 1925 - omega/omega_calc/src/parser.yy | 1928 - omega/omega_lib/doc/interface.pdf | Bin 276190 -> 0 bytes omega/omega_lib/include/omega.h | 71 - omega/omega_lib/include/omega/RelBody.h | 165 - omega/omega_lib/include/omega/Rel_map.h | 161 - omega/omega_lib/include/omega/Relation.h | 299 - omega/omega_lib/include/omega/Relations.h | 88 - omega/omega_lib/include/omega/closure.h | 31 - omega/omega_lib/include/omega/evac.h | 15 - omega/omega_lib/include/omega/farkas.h | 19 - omega/omega_lib/include/omega/hull.h | 89 - .../omega_lib/include/omega/omega_core/debugging.h | 30 - omega/omega_lib/include/omega/omega_core/oc.h | 350 - omega/omega_lib/include/omega/omega_core/oc_i.h | 79 - omega/omega_lib/include/omega/omega_i.h | 30 - omega/omega_lib/include/omega/pres_cmpr.h | 49 - omega/omega_lib/include/omega/pres_cnstr.h | 192 - omega/omega_lib/include/omega/pres_conj.h | 299 - omega/omega_lib/include/omega/pres_decl.h | 55 - omega/omega_lib/include/omega/pres_dnf.h | 87 - omega/omega_lib/include/omega/pres_form.h | 112 - omega/omega_lib/include/omega/pres_gen.h | 192 - omega/omega_lib/include/omega/pres_logic.h | 90 - omega/omega_lib/include/omega/pres_quant.h | 63 - omega/omega_lib/include/omega/pres_subs.h | 88 - omega/omega_lib/include/omega/pres_tree.h | 15 - omega/omega_lib/include/omega/pres_var.h | 230 - omega/omega_lib/include/omega/reach.h | 23 - omega/omega_lib/obj/Makefile.am | 47 - omega/omega_lib/obj/Makefile.in | 1257 - omega/omega_lib/src/RelBody.cc | 906 - omega/omega_lib/src/RelVar.cc | 71 - omega/omega_lib/src/Relation.cc | 279 - omega/omega_lib/src/Relations.cc | 2882 - omega/omega_lib/src/closure.cc | 2100 - omega/omega_lib/src/evac.cc | 339 - omega/omega_lib/src/farkas.cc | 480 - omega/omega_lib/src/hull.cc | 1489 - omega/omega_lib/src/hull_legacy.cc | 1484 - omega/omega_lib/src/hull_simple.cc | 1013 - omega/omega_lib/src/omega_core/oc.cc | 754 - omega/omega_lib/src/omega_core/oc_eq.cc | 653 - omega/omega_lib/src/omega_core/oc_exp_kill.cc | 297 - omega/omega_lib/src/omega_core/oc_global.cc | 45 - omega/omega_lib/src/omega_core/oc_print.cc | 686 - omega/omega_lib/src/omega_core/oc_problems.cc | 198 - omega/omega_lib/src/omega_core/oc_query.cc | 478 - omega/omega_lib/src/omega_core/oc_quick_kill.cc | 775 - omega/omega_lib/src/omega_core/oc_simple.cc | 1373 - omega/omega_lib/src/omega_core/oc_solve.cc | 1378 - omega/omega_lib/src/omega_core/oc_util.cc | 327 - omega/omega_lib/src/pres_beaut.cc | 235 - omega/omega_lib/src/pres_cnstr.cc | 450 - omega/omega_lib/src/pres_col.cc | 104 - omega/omega_lib/src/pres_conj.cc | 1460 - omega/omega_lib/src/pres_decl.cc | 71 - omega/omega_lib/src/pres_dnf.cc | 1416 - omega/omega_lib/src/pres_form.cc | 147 - omega/omega_lib/src/pres_gen.cc | 45 - omega/omega_lib/src/pres_logic.cc | 226 - omega/omega_lib/src/pres_print.cc | 908 - omega/omega_lib/src/pres_quant.cc | 95 - omega/omega_lib/src/pres_rear.cc | 131 - omega/omega_lib/src/pres_subs.cc | 131 - omega/omega_lib/src/pres_var.cc | 459 - omega/omega_lib/src/reach.cc | 211 - omegalib/CMakeLists.txt | 15 + omegalib/LICENSE | 705 + omegalib/basic/include/basic/Bag.c | 329 + omegalib/basic/include/basic/Bag.h | 78 + omegalib/basic/include/basic/BoolSet.h | 283 + omegalib/basic/include/basic/Collection.h | 47 + omegalib/basic/include/basic/Collections.h | 12 + omegalib/basic/include/basic/ConstString.h | 58 + omegalib/basic/include/basic/Dynamic_Array.c | 219 + omegalib/basic/include/basic/Dynamic_Array.h | 103 + omegalib/basic/include/basic/Iterator.h | 131 + omegalib/basic/include/basic/Link.h | 98 + omegalib/basic/include/basic/List.c | 149 + omegalib/basic/include/basic/List.h | 95 + omegalib/basic/include/basic/Map.c | 63 + omegalib/basic/include/basic/Map.h | 68 + omegalib/basic/include/basic/Section.c | 79 + omegalib/basic/include/basic/Section.h | 63 + omegalib/basic/include/basic/SimpleList.c | 105 + omegalib/basic/include/basic/SimpleList.h | 93 + omegalib/basic/include/basic/Tuple.c | 254 + omegalib/basic/include/basic/Tuple.h | 90 + omegalib/basic/include/basic/boolset-test.cc | 72 + omegalib/basic/include/basic/boolset.h | 637 + omegalib/basic/include/basic/omega_error.h | 14 + omegalib/basic/include/basic/util.h | 263 + omegalib/basic/src/ConstString.cc | 134 + omegalib/basic/src/Link.cc | 41 + omegalib/code_gen/CMakeLists.txt | 26 + omegalib/code_gen/include/code_gen/CG.h | 118 + .../code_gen/include/code_gen/CG_outputBuilder.h | 177 + omegalib/code_gen/include/code_gen/CG_outputRepr.h | 31 + .../code_gen/include/code_gen/CG_roseBuilder.h | 164 + omegalib/code_gen/include/code_gen/CG_roseRepr.h | 47 + .../code_gen/include/code_gen/CG_stringBuilder.h | 44 + omegalib/code_gen/include/code_gen/CG_stringRepr.h | 43 + .../code_gen/include/code_gen/CG_suifBuilder.h | 88 + omegalib/code_gen/include/code_gen/CG_suifRepr.h | 36 + omegalib/code_gen/include/code_gen/CG_utils.h | 45 + omegalib/code_gen/include/code_gen/code_gen.h | 47 + omegalib/code_gen/include/code_gen/codegen.h | 44 + omegalib/code_gen/include/code_gen/codegen_error.h | 15 + omegalib/code_gen/include/code_gen/cscope.out | 42592 +++++++++ omegalib/code_gen/include/code_gen/output_repr.h | 46 + .../code_gen/include/code_gen/rose_attributes.h | 91 + omegalib/code_gen/src/CG.cc | 1163 + omegalib/code_gen/src/CG_roseBuilder.cc | 1533 + omegalib/code_gen/src/CG_roseRepr.cc | 176 + omegalib/code_gen/src/CG_stringBuilder.cc | 487 + omegalib/code_gen/src/CG_stringRepr.cc | 54 + omegalib/code_gen/src/CG_suifBuilder.cc | 678 + omegalib/code_gen/src/CG_suifRepr.cc | 81 + omegalib/code_gen/src/CG_utils.cc | 1735 + omegalib/code_gen/src/code_gen.cc | 656 + omegalib/code_gen/src/codegen.cc | 378 + omegalib/code_gen/src/cscope.out | 89773 +++++++++++++++++++ omegalib/code_gen/src/output_repr.cc | 1931 + omegalib/code_gen/src/rose_attributes.cc | 183 + omegalib/code_gen/src/tags | 158 + omegalib/doc/calculator.pdf | Bin 0 -> 108062 bytes omegalib/doc/interface.pdf | Bin 0 -> 276190 bytes omegalib/examples/basics | 30 + omegalib/examples/basics.out | 76 + omegalib/examples/c_code/PT-example.c | 12 + omegalib/examples/c_code/example.c | 89 + omegalib/examples/c_code/library_example.c | 190 + omegalib/examples/code_gen | 60 + omegalib/examples/code_gen.out | 33 + omegalib/examples/experiments/gemm/codegen.input | 14 + omegalib/examples/experiments/gemm/gemm.out | 58 + omegalib/examples/experiments/gemv/codegen.input | 14 + omegalib/examples/experiments/gemv/gemv.out | 40 + omegalib/examples/experiments/lu/codegen.input | 33 + omegalib/examples/experiments/lu/lu.out | 141 + omegalib/examples/experiments/qr/codegen.input | 17 + omegalib/examples/experiments/qr/qr.out | 54 + .../examples/experiments/swim/swim-codegen.input | 53 + omegalib/examples/experiments/swim/swim.out | 176 + omegalib/examples/floor_bound | 46 + omegalib/examples/floor_bound.out | 76 + omegalib/examples/gist | 60 + omegalib/examples/gist.out | 110 + omegalib/examples/hpf | 49 + omegalib/examples/hpf.out | 59 + omegalib/examples/hull | 102 + omegalib/examples/hull.out | 40 + omegalib/examples/if_then | 19 + omegalib/examples/interface | 15 + omegalib/examples/interface.out | 36 + omegalib/examples/lu | 41 + omegalib/examples/lu.out | 117 + omegalib/examples/old_test/affineClosure | 19 + omegalib/examples/old_test/affineClosure.oc-rt | 32 + omegalib/examples/old_test/affineClosure2 | 55 + omegalib/examples/old_test/affineClosure2.oc-rt | 70 + omegalib/examples/old_test/beatrice2 | 51 + omegalib/examples/old_test/beatrice2.oc-rt | 56 + omegalib/examples/old_test/blume1.w | 6 + omegalib/examples/old_test/blume1.w.oc-rt | 12 + omegalib/examples/old_test/cfft2d1 | 21 + omegalib/examples/old_test/cfft2d1.oc-rt | 29 + omegalib/examples/old_test/chosol | 11 + omegalib/examples/old_test/chosol.oc-rt | 32 + omegalib/examples/old_test/closure1 | 8 + omegalib/examples/old_test/closure1.oc-rt | 31 + omegalib/examples/old_test/closure2 | 4 + omegalib/examples/old_test/closure2.oc-rt | 22 + omegalib/examples/old_test/closure3 | 10 + omegalib/examples/old_test/closure3.oc-rt | 48 + omegalib/examples/old_test/closure4 | 8 + omegalib/examples/old_test/closure4.oc-rt | 28 + omegalib/examples/old_test/closure5 | 6 + omegalib/examples/old_test/closure5.oc-rt | 18 + omegalib/examples/old_test/closure6 | 13 + omegalib/examples/old_test/closure6.oc-rt | 29 + omegalib/examples/old_test/closure7 | 12 + omegalib/examples/old_test/closure7.oc-rt | 36 + omegalib/examples/old_test/closure8 | 1 + omegalib/examples/old_test/closure8.oc-rt | 6 + omegalib/examples/old_test/collard | 16 + omegalib/examples/old_test/collard.oc-rt | 49 + omegalib/examples/old_test/cover | 6 + omegalib/examples/old_test/cover.oc-rt | 16 + omegalib/examples/old_test/dagstuhl1 | 7 + omegalib/examples/old_test/dagstuhl1.oc-rt | 23 + omegalib/examples/old_test/dagstuhl2 | 6 + omegalib/examples/old_test/dagstuhl2.oc-rt | 11 + omegalib/examples/old_test/dagstuhl3 | 4 + omegalib/examples/old_test/dagstuhl3.oc-rt | 9 + omegalib/examples/old_test/davew1 | 25 + omegalib/examples/old_test/davew1.oc-rt | 67 + omegalib/examples/old_test/ddtest | 97 + omegalib/examples/old_test/ddtest.oc-rt | 152 + omegalib/examples/old_test/emit | 38 + omegalib/examples/old_test/emit.oc-rt | 61 + omegalib/examples/old_test/example1 | 4 + omegalib/examples/old_test/example1.oc-rt | 10 + omegalib/examples/old_test/farkas | 8 + omegalib/examples/old_test/farkas.oc-rt | 17 + omegalib/examples/old_test/farkas2 | 6 + omegalib/examples/old_test/farkas2.oc-rt | 22 + omegalib/examples/old_test/farkas3 | 3 + omegalib/examples/old_test/farkas3.oc-rt | 9 + omegalib/examples/old_test/fc1 | 23 + omegalib/examples/old_test/fc1.oc-rt | 89 + omegalib/examples/old_test/fc2 | 29 + omegalib/examples/old_test/fc2.oc-rt | 115 + omegalib/examples/old_test/foo | 13 + omegalib/examples/old_test/foo.oc-rt | 37 + omegalib/examples/old_test/foo2 | 3 + omegalib/examples/old_test/foo2.oc-rt | 8 + omegalib/examples/old_test/foo6 | 1 + omegalib/examples/old_test/foo6.oc-rt | 6 + omegalib/examples/old_test/forall | 21 + omegalib/examples/old_test/forall.oc-rt | 28 + omegalib/examples/old_test/gc | 6 + omegalib/examples/old_test/gc.oc-rt | 20 + omegalib/examples/old_test/ge | 9 + omegalib/examples/old_test/ge.oc-rt | 38 + omegalib/examples/old_test/givens2 | 15 + omegalib/examples/old_test/givens2.oc-rt | 38 + omegalib/examples/old_test/guard1 | 11 + omegalib/examples/old_test/guard1.oc-rt | 25 + omegalib/examples/old_test/hull1 | 4 + omegalib/examples/old_test/hull1.oc-rt | 14 + omegalib/examples/old_test/hull2 | 3 + omegalib/examples/old_test/hull2.oc-rt | 14 + omegalib/examples/old_test/hull3 | 17 + omegalib/examples/old_test/hull3.oc-rt | 40 + omegalib/examples/old_test/ip1 | 13 + omegalib/examples/old_test/ip1.oc-rt | 15 + omegalib/examples/old_test/ip2 | 11 + omegalib/examples/old_test/ip2.oc-rt | 13 + omegalib/examples/old_test/ip3 | 18 + omegalib/examples/old_test/ip3.oc-rt | 23 + omegalib/examples/old_test/iter1 | 2 + omegalib/examples/old_test/iter1.oc-rt | 9 + omegalib/examples/old_test/iter2 | 2 + omegalib/examples/old_test/iter2.oc-rt | 11 + omegalib/examples/old_test/iter3 | 2 + omegalib/examples/old_test/iter3.oc-rt | 11 + omegalib/examples/old_test/iter4 | 2 + omegalib/examples/old_test/iter4.oc-rt | 11 + omegalib/examples/old_test/iter5 | 2 + omegalib/examples/old_test/iter5.oc-rt | 11 + omegalib/examples/old_test/iter6 | 6 + omegalib/examples/old_test/iter6.oc-rt | 22 + omegalib/examples/old_test/iter7 | 3 + omegalib/examples/old_test/iter7.oc-rt | 15 + omegalib/examples/old_test/iter8 | 12 + omegalib/examples/old_test/iter8.oc-rt | 23 + omegalib/examples/old_test/iter9 | 40 + omegalib/examples/old_test/iter9.oc-rt | 121 + omegalib/examples/old_test/lefur00 | 15 + omegalib/examples/old_test/lefur00.oc-rt | 28 + omegalib/examples/old_test/lefur01 | 14 + omegalib/examples/old_test/lefur01.oc-rt | 103 + omegalib/examples/old_test/lefur03 | 16 + omegalib/examples/old_test/lefur03-3 | 20 + omegalib/examples/old_test/lefur03-3.oc-rt | 107 + omegalib/examples/old_test/lefur03.c | 36 + omegalib/examples/old_test/lefur03.oc-rt | 35 + omegalib/examples/old_test/lefur04 | 19 + omegalib/examples/old_test/lefur04.oc-rt | 42 + omegalib/examples/old_test/lefur05 | 49 + omegalib/examples/old_test/lefur05.oc-rt | 118 + omegalib/examples/old_test/lift1 | 16 + omegalib/examples/old_test/lift1.oc-rt | 147 + omegalib/examples/old_test/lift2 | 16 + omegalib/examples/old_test/lift2.oc-rt | 190 + omegalib/examples/old_test/long_input | 2 + omegalib/examples/old_test/long_input.oc-rt | 11 + omegalib/examples/old_test/lu_ijk | 17 + omegalib/examples/old_test/lu_ijk.oc-rt | 81 + omegalib/examples/old_test/lu_spmd | 19 + omegalib/examples/old_test/lu_spmd.oc-rt | 58 + omegalib/examples/old_test/m1 | 6 + omegalib/examples/old_test/m1.oc-rt | 41 + omegalib/examples/old_test/m10 | 5 + omegalib/examples/old_test/m10.oc-rt | 47 + omegalib/examples/old_test/m11 | 10 + omegalib/examples/old_test/m11.oc-rt | 32 + omegalib/examples/old_test/m12 | 8 + omegalib/examples/old_test/m12.oc-rt | 54 + omegalib/examples/old_test/m2 | 4 + omegalib/examples/old_test/m2.oc-rt | 35 + omegalib/examples/old_test/m3 | 2 + omegalib/examples/old_test/m3.oc-rt | 11 + omegalib/examples/old_test/m4 | 11 + omegalib/examples/old_test/m4.oc-rt | 28 + omegalib/examples/old_test/m7 | 6 + omegalib/examples/old_test/m7.oc-rt | 35 + omegalib/examples/old_test/m8 | 6 + omegalib/examples/old_test/m8.oc-rt | 35 + omegalib/examples/old_test/m9 | 5 + omegalib/examples/old_test/m9.oc-rt | 20 + omegalib/examples/old_test/maximize | 7 + omegalib/examples/old_test/maximize.oc-rt | 24 + omegalib/examples/old_test/olda | 9 + omegalib/examples/old_test/olda.oc-rt | 52 + omegalib/examples/old_test/p.delft | 22 + omegalib/examples/old_test/p.delft.oc-rt | 43 + omegalib/examples/old_test/p.delft2 | 24 + omegalib/examples/old_test/p.delft2.oc-rt | 80 + omegalib/examples/old_test/p.delft3 | 20 + omegalib/examples/old_test/p.delft3.oc-rt | 29 + omegalib/examples/old_test/p.subset | 3 + omegalib/examples/old_test/p.subset.oc-rt | 10 + omegalib/examples/old_test/p1 | 1 + omegalib/examples/old_test/p1.oc-rt | 6 + omegalib/examples/old_test/p10 | 1 + omegalib/examples/old_test/p10.oc-rt | 6 + omegalib/examples/old_test/p11 | 10 + omegalib/examples/old_test/p11.oc-rt | 17 + omegalib/examples/old_test/p12 | 7 + omegalib/examples/old_test/p12.oc-rt | 33 + omegalib/examples/old_test/p13 | 3 + omegalib/examples/old_test/p13.oc-rt | 13 + omegalib/examples/old_test/p2 | 1 + omegalib/examples/old_test/p2.oc-rt | 6 + omegalib/examples/old_test/p3 | 2 + omegalib/examples/old_test/p3.oc-rt | 8 + omegalib/examples/old_test/p4 | 5 + omegalib/examples/old_test/p4.oc-rt | 22 + omegalib/examples/old_test/p5 | 8 + omegalib/examples/old_test/p5.oc-rt | 16 + omegalib/examples/old_test/p6 | 25 + omegalib/examples/old_test/p6.oc-rt | 129 + omegalib/examples/old_test/p7 | 1 + omegalib/examples/old_test/p7.oc-rt | 7 + omegalib/examples/old_test/p8 | 6 + omegalib/examples/old_test/p8.oc-rt | 21 + omegalib/examples/old_test/p9 | 7 + omegalib/examples/old_test/p9.oc-rt | 13 + omegalib/examples/old_test/pufs1 | 2 + omegalib/examples/old_test/pufs1.oc-rt | 9 + omegalib/examples/old_test/pufs2 | 9 + omegalib/examples/old_test/pufs2.oc-rt | 35 + omegalib/examples/old_test/pufs3 | 8 + omegalib/examples/old_test/pufs3.oc-rt | 29 + omegalib/examples/old_test/pufs4 | 16 + omegalib/examples/old_test/pufs4.oc-rt | 26 + omegalib/examples/old_test/pufs5 | 22 + omegalib/examples/old_test/pufs5.oc-rt | 98 + omegalib/examples/old_test/pufs6 | 19 + omegalib/examples/old_test/pufs6.oc-rt | 42 + omegalib/examples/old_test/pufs7 | 6 + omegalib/examples/old_test/pufs7.oc-rt | 18 + omegalib/examples/old_test/reach1 | 5 + omegalib/examples/old_test/reach1.oc-rt | 9 + omegalib/examples/old_test/reach2 | 29 + omegalib/examples/old_test/reach2.oc-rt | 61 + omegalib/examples/old_test/reach3 | 18 + omegalib/examples/old_test/reach3.oc-rt | 40 + omegalib/examples/old_test/red1 | 3 + omegalib/examples/old_test/red1.oc-rt | 10 + omegalib/examples/old_test/saman | 20 + omegalib/examples/old_test/saman.oc-rt | 31 + omegalib/examples/old_test/sample1 | 14 + omegalib/examples/old_test/sample1.oc-rt | 39 + omegalib/examples/old_test/sample2 | 11 + omegalib/examples/old_test/sample2.oc-rt | 33 + omegalib/examples/old_test/sample3 | 11 + omegalib/examples/old_test/sample3.oc-rt | 37 + omegalib/examples/old_test/stodghil | 21 + omegalib/examples/old_test/stodghil.oc-rt | 28 + omegalib/examples/old_test/stride1 | 2 + omegalib/examples/old_test/stride1.oc-rt | 9 + omegalib/examples/old_test/stride2 | 4 + omegalib/examples/old_test/stride2.oc-rt | 14 + omegalib/examples/old_test/stride3 | 4 + omegalib/examples/old_test/stride3.oc-rt | 14 + omegalib/examples/old_test/stride4 | 4 + omegalib/examples/old_test/stride4.oc-rt | 12 + omegalib/examples/old_test/stride5 | 4 + omegalib/examples/old_test/stride5.oc-rt | 14 + omegalib/examples/old_test/stride6 | 10 + omegalib/examples/old_test/stride6.oc-rt | 36 + omegalib/examples/old_test/stride7 | 6 + omegalib/examples/old_test/stride7.oc-rt | 47 + omegalib/examples/old_test/subsets1 | 20 + omegalib/examples/old_test/subsets1.oc-rt | 70 + omegalib/examples/old_test/subsets2 | 5 + omegalib/examples/old_test/subsets2.oc-rt | 18 + omegalib/examples/old_test/tex1 | 49 + omegalib/examples/old_test/tex1.oc-rt | 58 + omegalib/examples/old_test/tricky | 11 + omegalib/examples/old_test/tricky.oc-rt | 25 + omegalib/examples/old_test/ts1d-check-sblock | 155 + omegalib/examples/old_test/ts1d-check-sblock.oc-rt | 227 + omegalib/examples/old_test/ts1d-check0 | 176 + omegalib/examples/old_test/ts1d-check0.oc-rt | 260 + omegalib/examples/old_test/ts1d-mp-i_ts-m_b | 289 + omegalib/examples/old_test/ts1d-mp-i_ts-m_b.oc-rt | 430 + omegalib/examples/old_test/ts1d-orig0 | 151 + omegalib/examples/old_test/ts1d-orig0.oc-rt | 220 + omegalib/examples/old_test/tseng | 16 + omegalib/examples/old_test/tseng.oc-rt | 54 + omegalib/examples/old_test/verlind1 | 44 + omegalib/examples/old_test/verlind1.oc-rt | 120 + omegalib/examples/old_test/verlind1a | 3 + omegalib/examples/old_test/verlind1a.oc-rt | 9 + omegalib/examples/old_test/wak1 | 13 + omegalib/examples/old_test/wak1.oc-rt | 87 + omegalib/examples/old_test/wak2 | 10 + omegalib/examples/old_test/wak2.oc-rt | 307 + omegalib/examples/old_test/wak3 | 12 + omegalib/examples/old_test/wak3.oc-rt | 59 + omegalib/examples/old_test/wak4 | 9 + omegalib/examples/old_test/wak4.oc-rt | 20 + omegalib/examples/old_test/wak5 | 4 + omegalib/examples/old_test/wak5.oc-rt | 11 + omegalib/examples/old_test/wak6 | 14 + omegalib/examples/old_test/wak6.oc-rt | 36 + omegalib/examples/old_test/wak7 | 5 + omegalib/examples/old_test/wak7.oc-rt | 11 + omegalib/examples/old_test/wak8 | 15 + omegalib/examples/old_test/wak8.oc-rt | 30 + omegalib/examples/old_test/wielage | 13 + omegalib/examples/old_test/wielage.oc-rt | 22 + omegalib/examples/old_test/wild | 13 + omegalib/examples/old_test/wild.oc-rt | 43 + omegalib/examples/old_test/wrap | 12 + omegalib/examples/old_test/wrap.oc-rt | 50 + omegalib/examples/old_test/wrap0 | 7 + omegalib/examples/old_test/wrap0.oc-rt | 26 + omegalib/examples/old_test/wrap1 | 8 + omegalib/examples/old_test/wrap1.oc-rt | 25 + omegalib/examples/old_test/x | 9 + omegalib/examples/old_test/x.oc-rt | 84 + omegalib/examples/pufs | 20 + omegalib/examples/pufs.out | 50 + omegalib/examples/substitution | 35 + omegalib/examples/substitution.out | 60 + omegalib/examples/syr2k | 17 + omegalib/examples/syr2k.out | 69 + omegalib/examples/union | 64 + omegalib/examples/union.out | 96 + omegalib/include/basic | 1 + omegalib/include/code_gen | 1 + omegalib/include/codegen.h | 1 + omegalib/include/config.h | 36 + omegalib/include/config.h.in | 35 + omegalib/include/omega | 1 + omegalib/include/omega.h | 1 + omegalib/include/stamp-h1 | 1 + omegalib/omega_calc/CMakeLists.txt | 29 + omegalib/omega_calc/doc/calculator.pdf | Bin 0 -> 108062 bytes omegalib/omega_calc/include/omega_calc/AST.h | 310 + omegalib/omega_calc/include/omega_calc/PT-omega.c | 81 + omegalib/omega_calc/include/omega_calc/myflex.h | 27 + omegalib/omega_calc/src/AST.cc | 467 + omegalib/omega_calc/src/myflex.cc | 421 + omegalib/omega_calc/src/parser.l | 350 + omegalib/omega_calc/src/parser.ll | 350 + omegalib/omega_calc/src/parser.y | 1925 + omegalib/omega_calc/src/parser.yy | 1928 + omegalib/omega_lib/CMakeLists.txt | 64 + omegalib/omega_lib/doc/interface.pdf | Bin 0 -> 276190 bytes omegalib/omega_lib/include/omega.h | 71 + omegalib/omega_lib/include/omega/RelBody.h | 165 + omegalib/omega_lib/include/omega/Rel_map.h | 161 + omegalib/omega_lib/include/omega/Relation.h | 299 + omegalib/omega_lib/include/omega/Relations.h | 88 + omegalib/omega_lib/include/omega/closure.h | 31 + omegalib/omega_lib/include/omega/evac.h | 15 + omegalib/omega_lib/include/omega/farkas.h | 19 + omegalib/omega_lib/include/omega/hull.h | 89 + .../omega_lib/include/omega/omega_core/debugging.h | 30 + omegalib/omega_lib/include/omega/omega_core/oc.h | 350 + omegalib/omega_lib/include/omega/omega_core/oc_i.h | 79 + omegalib/omega_lib/include/omega/omega_i.h | 30 + omegalib/omega_lib/include/omega/pres_cmpr.h | 49 + omegalib/omega_lib/include/omega/pres_cnstr.h | 192 + omegalib/omega_lib/include/omega/pres_conj.h | 299 + omegalib/omega_lib/include/omega/pres_decl.h | 55 + omegalib/omega_lib/include/omega/pres_dnf.h | 87 + omegalib/omega_lib/include/omega/pres_form.h | 112 + omegalib/omega_lib/include/omega/pres_gen.h | 192 + omegalib/omega_lib/include/omega/pres_logic.h | 90 + omegalib/omega_lib/include/omega/pres_quant.h | 63 + omegalib/omega_lib/include/omega/pres_subs.h | 88 + omegalib/omega_lib/include/omega/pres_tree.h | 15 + omegalib/omega_lib/include/omega/pres_var.h | 230 + omegalib/omega_lib/include/omega/reach.h | 23 + omegalib/omega_lib/src/RelBody.cc | 906 + omegalib/omega_lib/src/RelVar.cc | 71 + omegalib/omega_lib/src/Relation.cc | 279 + omegalib/omega_lib/src/Relations.cc | 2882 + omegalib/omega_lib/src/closure.cc | 2100 + omegalib/omega_lib/src/evac.cc | 339 + omegalib/omega_lib/src/farkas.cc | 480 + omegalib/omega_lib/src/hull.cc | 1489 + omegalib/omega_lib/src/hull_legacy.cc | 1484 + omegalib/omega_lib/src/hull_simple.cc | 1013 + omegalib/omega_lib/src/omega_core/oc.cc | 754 + omegalib/omega_lib/src/omega_core/oc_eq.cc | 653 + omegalib/omega_lib/src/omega_core/oc_exp_kill.cc | 297 + omegalib/omega_lib/src/omega_core/oc_global.cc | 45 + omegalib/omega_lib/src/omega_core/oc_print.cc | 686 + omegalib/omega_lib/src/omega_core/oc_problems.cc | 198 + omegalib/omega_lib/src/omega_core/oc_query.cc | 478 + omegalib/omega_lib/src/omega_core/oc_quick_kill.cc | 775 + omegalib/omega_lib/src/omega_core/oc_simple.cc | 1373 + omegalib/omega_lib/src/omega_core/oc_solve.cc | 1378 + omegalib/omega_lib/src/omega_core/oc_util.cc | 327 + omegalib/omega_lib/src/pres_beaut.cc | 235 + omegalib/omega_lib/src/pres_cnstr.cc | 450 + omegalib/omega_lib/src/pres_col.cc | 104 + omegalib/omega_lib/src/pres_conj.cc | 1460 + omegalib/omega_lib/src/pres_decl.cc | 71 + omegalib/omega_lib/src/pres_dnf.cc | 1416 + omegalib/omega_lib/src/pres_form.cc | 147 + omegalib/omega_lib/src/pres_gen.cc | 45 + omegalib/omega_lib/src/pres_logic.cc | 226 + omegalib/omega_lib/src/pres_print.cc | 908 + omegalib/omega_lib/src/pres_quant.cc | 95 + omegalib/omega_lib/src/pres_rear.cc | 131 + omegalib/omega_lib/src/pres_subs.cc | 131 + omegalib/omega_lib/src/pres_var.cc | 459 + omegalib/omega_lib/src/reach.cc | 211 + omegatools.cc | 2312 - omegatools.hh | 97 - parse_expr.ll | 25 - parse_expr.yy | 85 - parser.ll | 97 - parser.yy | 1605 - 1015 files changed, 208252 insertions(+), 238348 deletions(-) create mode 100644 CMakeLists.txt delete mode 100644 Makefile.am delete mode 100644 Makefile.in delete mode 100644 README create mode 100644 README.md delete mode 100644 aclocal.m4 delete mode 100755 buildall create mode 100644 chill/CMakeLists.txt create mode 100644 chill/include/chill_error.hh create mode 100644 chill/include/chill_run_util.hh create mode 100644 chill/include/chilldebug.h create mode 100644 chill/include/chillmodule.hh create mode 100644 chill/include/config.h.in create mode 100644 chill/include/dep.hh create mode 100644 chill/include/graph.hh create mode 100644 chill/include/ir_code.hh create mode 100644 chill/include/ir_rose.hh create mode 100644 chill/include/ir_rose_utils.hh create mode 100644 chill/include/irtools.hh create mode 100644 chill/include/loop.hh create mode 100644 chill/include/omegatools.hh create mode 100644 chill/src/chill_run.cc create mode 100644 chill/src/chill_run_util.cc create mode 100644 chill/src/chillmodule.cc create mode 100644 chill/src/dep.cc create mode 100644 chill/src/ir_rose.cc create mode 100644 chill/src/ir_rose_utils.cc create mode 100644 chill/src/irtools.cc create mode 100644 chill/src/loop.cc create mode 100644 chill/src/loop_basic.cc create mode 100644 chill/src/loop_datacopy.cc create mode 100644 chill/src/loop_extra.cc create mode 100644 chill/src/loop_tile.cc create mode 100644 chill/src/loop_unroll.cc create mode 100644 chill/src/omegatools.cc create mode 100644 chill/src/parse_expr.ll create mode 100644 chill/src/parse_expr.yy delete mode 100644 chill_error.hh delete mode 100644 chill_run.cc delete mode 100644 chill_run_util.cc delete mode 100644 chill_run_util.hh delete mode 100644 chilldebug.h delete mode 100644 chillmodule.cc delete mode 100644 chillmodule.hh delete mode 100755 compile delete mode 100755 configure delete mode 100644 configure.ac delete mode 100644 dep.cc delete mode 100644 dep.hh delete mode 100755 depcomp delete mode 100644 graph.hh delete mode 120000 include/chill_error.hh delete mode 100644 include/config.h.in delete mode 120000 include/dep.hh delete mode 120000 include/graph.hh delete mode 120000 include/ir_code.hh delete mode 120000 include/loop.hh delete mode 120000 include/omegatools.hh delete mode 100755 install-sh delete mode 100644 ir_code.hh delete mode 100644 ir_rose.cc delete mode 100644 ir_rose.hh delete mode 100644 ir_rose_utils.cc delete mode 100644 ir_rose_utils.hh delete mode 100644 irtools.cc delete mode 100644 irtools.hh delete mode 100644 loop.cc delete mode 100644 loop.hh delete mode 100644 loop_basic.cc delete mode 100644 loop_datacopy.cc delete mode 100644 loop_extra.cc delete mode 100644 loop_tile.cc delete mode 100644 loop_unroll.cc delete mode 100755 missing delete mode 100644 omega/LICENSE delete mode 100644 omega/Makefile.am delete mode 100644 omega/aclocal.m4 delete mode 100755 omega/ar-lib delete mode 100644 omega/basic/include/basic/Bag.c delete mode 100644 omega/basic/include/basic/Bag.h delete mode 100644 omega/basic/include/basic/BoolSet.h delete mode 100644 omega/basic/include/basic/Collection.h delete mode 100644 omega/basic/include/basic/Collections.h delete mode 100644 omega/basic/include/basic/ConstString.h delete mode 100644 omega/basic/include/basic/Dynamic_Array.c delete mode 100644 omega/basic/include/basic/Dynamic_Array.h delete mode 100644 omega/basic/include/basic/Iterator.h delete mode 100644 omega/basic/include/basic/Link.h delete mode 100644 omega/basic/include/basic/List.c delete mode 100644 omega/basic/include/basic/List.h delete mode 100644 omega/basic/include/basic/Map.c delete mode 100644 omega/basic/include/basic/Map.h delete mode 100644 omega/basic/include/basic/Section.c delete mode 100644 omega/basic/include/basic/Section.h delete mode 100644 omega/basic/include/basic/SimpleList.c delete mode 100644 omega/basic/include/basic/SimpleList.h delete mode 100644 omega/basic/include/basic/Tuple.c delete mode 100644 omega/basic/include/basic/Tuple.h delete mode 100755 omega/basic/include/basic/boolset-test.cc delete mode 100755 omega/basic/include/basic/boolset.h delete mode 100644 omega/basic/include/basic/omega_error.h delete mode 100644 omega/basic/include/basic/util.h delete mode 100644 omega/basic/src/ConstString.cc delete mode 100644 omega/basic/src/Link.cc delete mode 100644 omega/code_gen/include/code_gen/CG.h delete mode 100644 omega/code_gen/include/code_gen/CG_outputBuilder.h delete mode 100644 omega/code_gen/include/code_gen/CG_outputRepr.h delete mode 100644 omega/code_gen/include/code_gen/CG_roseBuilder.h delete mode 100644 omega/code_gen/include/code_gen/CG_roseRepr.h delete mode 100644 omega/code_gen/include/code_gen/CG_stringBuilder.h delete mode 100644 omega/code_gen/include/code_gen/CG_stringRepr.h delete mode 100644 omega/code_gen/include/code_gen/CG_suifBuilder.h delete mode 100644 omega/code_gen/include/code_gen/CG_suifRepr.h delete mode 100755 omega/code_gen/include/code_gen/CG_utils.h delete mode 100644 omega/code_gen/include/code_gen/code_gen.h delete mode 100755 omega/code_gen/include/code_gen/codegen.h delete mode 100755 omega/code_gen/include/code_gen/codegen_error.h delete mode 100644 omega/code_gen/include/code_gen/cscope.out delete mode 100644 omega/code_gen/include/code_gen/output_repr.h delete mode 100644 omega/code_gen/include/code_gen/rose_attributes.h delete mode 100644 omega/code_gen/obj/Makefile.am delete mode 100644 omega/code_gen/obj/Makefile.in delete mode 100644 omega/code_gen/src/CG.cc delete mode 100644 omega/code_gen/src/CG_roseBuilder.cc delete mode 100644 omega/code_gen/src/CG_roseRepr.cc delete mode 100644 omega/code_gen/src/CG_stringBuilder.cc delete mode 100644 omega/code_gen/src/CG_stringRepr.cc delete mode 100644 omega/code_gen/src/CG_suifBuilder.cc delete mode 100644 omega/code_gen/src/CG_suifRepr.cc delete mode 100755 omega/code_gen/src/CG_utils.cc delete mode 100644 omega/code_gen/src/code_gen.cc delete mode 100755 omega/code_gen/src/codegen.cc delete mode 100644 omega/code_gen/src/cscope.out delete mode 100644 omega/code_gen/src/output_repr.cc delete mode 100644 omega/code_gen/src/rose_attributes.cc delete mode 100644 omega/code_gen/src/tags delete mode 100755 omega/compile delete mode 100755 omega/configure delete mode 100644 omega/configure.ac delete mode 100755 omega/depcomp delete mode 100755 omega/doc/calculator.pdf delete mode 100755 omega/doc/interface.pdf delete mode 100644 omega/examples/basics delete mode 100644 omega/examples/basics.out delete mode 100644 omega/examples/c_code/Makefile delete mode 100644 omega/examples/c_code/PT-example.c delete mode 100644 omega/examples/c_code/example.c delete mode 100644 omega/examples/c_code/library_example.c delete mode 100644 omega/examples/code_gen delete mode 100644 omega/examples/code_gen.out delete mode 100755 omega/examples/experiments/gemm/codegen.input delete mode 100644 omega/examples/experiments/gemm/gemm.out delete mode 100755 omega/examples/experiments/gemv/codegen.input delete mode 100644 omega/examples/experiments/gemv/gemv.out delete mode 100755 omega/examples/experiments/lu/codegen.input delete mode 100644 omega/examples/experiments/lu/lu.out delete mode 100755 omega/examples/experiments/qr/codegen.input delete mode 100644 omega/examples/experiments/qr/qr.out delete mode 100755 omega/examples/experiments/swim/swim-codegen.input delete mode 100644 omega/examples/experiments/swim/swim.out delete mode 100644 omega/examples/floor_bound delete mode 100644 omega/examples/floor_bound.out delete mode 100644 omega/examples/gist delete mode 100644 omega/examples/gist.out delete mode 100644 omega/examples/hpf delete mode 100644 omega/examples/hpf.out delete mode 100644 omega/examples/hull delete mode 100644 omega/examples/hull.out delete mode 100755 omega/examples/if_then delete mode 100644 omega/examples/interface delete mode 100644 omega/examples/interface.out delete mode 100644 omega/examples/lu delete mode 100644 omega/examples/lu.out delete mode 100644 omega/examples/old_test/affineClosure delete mode 100644 omega/examples/old_test/affineClosure.oc-rt delete mode 100644 omega/examples/old_test/affineClosure2 delete mode 100644 omega/examples/old_test/affineClosure2.oc-rt delete mode 100644 omega/examples/old_test/beatrice2 delete mode 100644 omega/examples/old_test/beatrice2.oc-rt delete mode 100644 omega/examples/old_test/blume1.w delete mode 100644 omega/examples/old_test/blume1.w.oc-rt delete mode 100644 omega/examples/old_test/cfft2d1 delete mode 100644 omega/examples/old_test/cfft2d1.oc-rt delete mode 100644 omega/examples/old_test/chosol delete mode 100644 omega/examples/old_test/chosol.oc-rt delete mode 100644 omega/examples/old_test/closure1 delete mode 100644 omega/examples/old_test/closure1.oc-rt delete mode 100644 omega/examples/old_test/closure2 delete mode 100644 omega/examples/old_test/closure2.oc-rt delete mode 100644 omega/examples/old_test/closure3 delete mode 100644 omega/examples/old_test/closure3.oc-rt delete mode 100644 omega/examples/old_test/closure4 delete mode 100644 omega/examples/old_test/closure4.oc-rt delete mode 100644 omega/examples/old_test/closure5 delete mode 100644 omega/examples/old_test/closure5.oc-rt delete mode 100644 omega/examples/old_test/closure6 delete mode 100644 omega/examples/old_test/closure6.oc-rt delete mode 100644 omega/examples/old_test/closure7 delete mode 100644 omega/examples/old_test/closure7.oc-rt delete mode 100644 omega/examples/old_test/closure8 delete mode 100644 omega/examples/old_test/closure8.oc-rt delete mode 100644 omega/examples/old_test/collard delete mode 100644 omega/examples/old_test/collard.oc-rt delete mode 100644 omega/examples/old_test/cover delete mode 100644 omega/examples/old_test/cover.oc-rt delete mode 100644 omega/examples/old_test/dagstuhl1 delete mode 100644 omega/examples/old_test/dagstuhl1.oc-rt delete mode 100644 omega/examples/old_test/dagstuhl2 delete mode 100644 omega/examples/old_test/dagstuhl2.oc-rt delete mode 100644 omega/examples/old_test/dagstuhl3 delete mode 100644 omega/examples/old_test/dagstuhl3.oc-rt delete mode 100644 omega/examples/old_test/davew1 delete mode 100644 omega/examples/old_test/davew1.oc-rt delete mode 100644 omega/examples/old_test/ddtest delete mode 100644 omega/examples/old_test/ddtest.oc-rt delete mode 100644 omega/examples/old_test/emit delete mode 100644 omega/examples/old_test/emit.oc-rt delete mode 100644 omega/examples/old_test/example1 delete mode 100644 omega/examples/old_test/example1.oc-rt delete mode 100644 omega/examples/old_test/farkas delete mode 100644 omega/examples/old_test/farkas.oc-rt delete mode 100644 omega/examples/old_test/farkas2 delete mode 100644 omega/examples/old_test/farkas2.oc-rt delete mode 100644 omega/examples/old_test/farkas3 delete mode 100644 omega/examples/old_test/farkas3.oc-rt delete mode 100644 omega/examples/old_test/fc1 delete mode 100644 omega/examples/old_test/fc1.oc-rt delete mode 100644 omega/examples/old_test/fc2 delete mode 100644 omega/examples/old_test/fc2.oc-rt delete mode 100644 omega/examples/old_test/foo delete mode 100644 omega/examples/old_test/foo.oc-rt delete mode 100644 omega/examples/old_test/foo2 delete mode 100644 omega/examples/old_test/foo2.oc-rt delete mode 100644 omega/examples/old_test/foo6 delete mode 100644 omega/examples/old_test/foo6.oc-rt delete mode 100644 omega/examples/old_test/forall delete mode 100644 omega/examples/old_test/forall.oc-rt delete mode 100644 omega/examples/old_test/gc delete mode 100644 omega/examples/old_test/gc.oc-rt delete mode 100644 omega/examples/old_test/ge delete mode 100644 omega/examples/old_test/ge.oc-rt delete mode 100644 omega/examples/old_test/givens2 delete mode 100644 omega/examples/old_test/givens2.oc-rt delete mode 100644 omega/examples/old_test/guard1 delete mode 100644 omega/examples/old_test/guard1.oc-rt delete mode 100644 omega/examples/old_test/hull1 delete mode 100644 omega/examples/old_test/hull1.oc-rt delete mode 100644 omega/examples/old_test/hull2 delete mode 100644 omega/examples/old_test/hull2.oc-rt delete mode 100644 omega/examples/old_test/hull3 delete mode 100644 omega/examples/old_test/hull3.oc-rt delete mode 100644 omega/examples/old_test/ip1 delete mode 100644 omega/examples/old_test/ip1.oc-rt delete mode 100644 omega/examples/old_test/ip2 delete mode 100644 omega/examples/old_test/ip2.oc-rt delete mode 100644 omega/examples/old_test/ip3 delete mode 100644 omega/examples/old_test/ip3.oc-rt delete mode 100644 omega/examples/old_test/iter1 delete mode 100644 omega/examples/old_test/iter1.oc-rt delete mode 100644 omega/examples/old_test/iter2 delete mode 100644 omega/examples/old_test/iter2.oc-rt delete mode 100644 omega/examples/old_test/iter3 delete mode 100644 omega/examples/old_test/iter3.oc-rt delete mode 100644 omega/examples/old_test/iter4 delete mode 100644 omega/examples/old_test/iter4.oc-rt delete mode 100644 omega/examples/old_test/iter5 delete mode 100644 omega/examples/old_test/iter5.oc-rt delete mode 100644 omega/examples/old_test/iter6 delete mode 100644 omega/examples/old_test/iter6.oc-rt delete mode 100644 omega/examples/old_test/iter7 delete mode 100644 omega/examples/old_test/iter7.oc-rt delete mode 100644 omega/examples/old_test/iter8 delete mode 100644 omega/examples/old_test/iter8.oc-rt delete mode 100644 omega/examples/old_test/iter9 delete mode 100644 omega/examples/old_test/iter9.oc-rt delete mode 100644 omega/examples/old_test/lefur00 delete mode 100644 omega/examples/old_test/lefur00.oc-rt delete mode 100644 omega/examples/old_test/lefur01 delete mode 100644 omega/examples/old_test/lefur01.oc-rt delete mode 100644 omega/examples/old_test/lefur03 delete mode 100644 omega/examples/old_test/lefur03-3 delete mode 100644 omega/examples/old_test/lefur03-3.oc-rt delete mode 100644 omega/examples/old_test/lefur03.c delete mode 100644 omega/examples/old_test/lefur03.oc-rt delete mode 100644 omega/examples/old_test/lefur04 delete mode 100644 omega/examples/old_test/lefur04.oc-rt delete mode 100644 omega/examples/old_test/lefur05 delete mode 100644 omega/examples/old_test/lefur05.oc-rt delete mode 100644 omega/examples/old_test/lift1 delete mode 100644 omega/examples/old_test/lift1.oc-rt delete mode 100644 omega/examples/old_test/lift2 delete mode 100644 omega/examples/old_test/lift2.oc-rt delete mode 100644 omega/examples/old_test/long_input delete mode 100644 omega/examples/old_test/long_input.oc-rt delete mode 100644 omega/examples/old_test/lu_ijk delete mode 100644 omega/examples/old_test/lu_ijk.oc-rt delete mode 100644 omega/examples/old_test/lu_spmd delete mode 100644 omega/examples/old_test/lu_spmd.oc-rt delete mode 100644 omega/examples/old_test/m1 delete mode 100644 omega/examples/old_test/m1.oc-rt delete mode 100644 omega/examples/old_test/m10 delete mode 100644 omega/examples/old_test/m10.oc-rt delete mode 100644 omega/examples/old_test/m11 delete mode 100644 omega/examples/old_test/m11.oc-rt delete mode 100644 omega/examples/old_test/m12 delete mode 100644 omega/examples/old_test/m12.oc-rt delete mode 100644 omega/examples/old_test/m2 delete mode 100644 omega/examples/old_test/m2.oc-rt delete mode 100644 omega/examples/old_test/m3 delete mode 100644 omega/examples/old_test/m3.oc-rt delete mode 100644 omega/examples/old_test/m4 delete mode 100644 omega/examples/old_test/m4.oc-rt delete mode 100644 omega/examples/old_test/m7 delete mode 100644 omega/examples/old_test/m7.oc-rt delete mode 100644 omega/examples/old_test/m8 delete mode 100644 omega/examples/old_test/m8.oc-rt delete mode 100644 omega/examples/old_test/m9 delete mode 100644 omega/examples/old_test/m9.oc-rt delete mode 100644 omega/examples/old_test/maximize delete mode 100644 omega/examples/old_test/maximize.oc-rt delete mode 100644 omega/examples/old_test/olda delete mode 100644 omega/examples/old_test/olda.oc-rt delete mode 100644 omega/examples/old_test/p.delft delete mode 100644 omega/examples/old_test/p.delft.oc-rt delete mode 100644 omega/examples/old_test/p.delft2 delete mode 100644 omega/examples/old_test/p.delft2.oc-rt delete mode 100644 omega/examples/old_test/p.delft3 delete mode 100644 omega/examples/old_test/p.delft3.oc-rt delete mode 100644 omega/examples/old_test/p.subset delete mode 100644 omega/examples/old_test/p.subset.oc-rt delete mode 100644 omega/examples/old_test/p1 delete mode 100644 omega/examples/old_test/p1.oc-rt delete mode 100644 omega/examples/old_test/p10 delete mode 100644 omega/examples/old_test/p10.oc-rt delete mode 100644 omega/examples/old_test/p11 delete mode 100644 omega/examples/old_test/p11.oc-rt delete mode 100644 omega/examples/old_test/p12 delete mode 100644 omega/examples/old_test/p12.oc-rt delete mode 100644 omega/examples/old_test/p13 delete mode 100644 omega/examples/old_test/p13.oc-rt delete mode 100644 omega/examples/old_test/p2 delete mode 100644 omega/examples/old_test/p2.oc-rt delete mode 100644 omega/examples/old_test/p3 delete mode 100644 omega/examples/old_test/p3.oc-rt delete mode 100644 omega/examples/old_test/p4 delete mode 100644 omega/examples/old_test/p4.oc-rt delete mode 100644 omega/examples/old_test/p5 delete mode 100644 omega/examples/old_test/p5.oc-rt delete mode 100644 omega/examples/old_test/p6 delete mode 100644 omega/examples/old_test/p6.oc-rt delete mode 100644 omega/examples/old_test/p7 delete mode 100644 omega/examples/old_test/p7.oc-rt delete mode 100644 omega/examples/old_test/p8 delete mode 100644 omega/examples/old_test/p8.oc-rt delete mode 100644 omega/examples/old_test/p9 delete mode 100644 omega/examples/old_test/p9.oc-rt delete mode 100644 omega/examples/old_test/pufs1 delete mode 100644 omega/examples/old_test/pufs1.oc-rt delete mode 100644 omega/examples/old_test/pufs2 delete mode 100644 omega/examples/old_test/pufs2.oc-rt delete mode 100644 omega/examples/old_test/pufs3 delete mode 100644 omega/examples/old_test/pufs3.oc-rt delete mode 100644 omega/examples/old_test/pufs4 delete mode 100644 omega/examples/old_test/pufs4.oc-rt delete mode 100644 omega/examples/old_test/pufs5 delete mode 100644 omega/examples/old_test/pufs5.oc-rt delete mode 100644 omega/examples/old_test/pufs6 delete mode 100644 omega/examples/old_test/pufs6.oc-rt delete mode 100644 omega/examples/old_test/pufs7 delete mode 100644 omega/examples/old_test/pufs7.oc-rt delete mode 100644 omega/examples/old_test/reach1 delete mode 100644 omega/examples/old_test/reach1.oc-rt delete mode 100644 omega/examples/old_test/reach2 delete mode 100644 omega/examples/old_test/reach2.oc-rt delete mode 100644 omega/examples/old_test/reach3 delete mode 100644 omega/examples/old_test/reach3.oc-rt delete mode 100644 omega/examples/old_test/red1 delete mode 100644 omega/examples/old_test/red1.oc-rt delete mode 100644 omega/examples/old_test/saman delete mode 100644 omega/examples/old_test/saman.oc-rt delete mode 100644 omega/examples/old_test/sample1 delete mode 100644 omega/examples/old_test/sample1.oc-rt delete mode 100644 omega/examples/old_test/sample2 delete mode 100644 omega/examples/old_test/sample2.oc-rt delete mode 100644 omega/examples/old_test/sample3 delete mode 100644 omega/examples/old_test/sample3.oc-rt delete mode 100644 omega/examples/old_test/stodghil delete mode 100644 omega/examples/old_test/stodghil.oc-rt delete mode 100644 omega/examples/old_test/stride1 delete mode 100644 omega/examples/old_test/stride1.oc-rt delete mode 100644 omega/examples/old_test/stride2 delete mode 100644 omega/examples/old_test/stride2.oc-rt delete mode 100644 omega/examples/old_test/stride3 delete mode 100644 omega/examples/old_test/stride3.oc-rt delete mode 100644 omega/examples/old_test/stride4 delete mode 100644 omega/examples/old_test/stride4.oc-rt delete mode 100644 omega/examples/old_test/stride5 delete mode 100644 omega/examples/old_test/stride5.oc-rt delete mode 100644 omega/examples/old_test/stride6 delete mode 100644 omega/examples/old_test/stride6.oc-rt delete mode 100644 omega/examples/old_test/stride7 delete mode 100644 omega/examples/old_test/stride7.oc-rt delete mode 100644 omega/examples/old_test/subsets1 delete mode 100644 omega/examples/old_test/subsets1.oc-rt delete mode 100644 omega/examples/old_test/subsets2 delete mode 100644 omega/examples/old_test/subsets2.oc-rt delete mode 100644 omega/examples/old_test/tex1 delete mode 100644 omega/examples/old_test/tex1.oc-rt delete mode 100644 omega/examples/old_test/tricky delete mode 100644 omega/examples/old_test/tricky.oc-rt delete mode 100644 omega/examples/old_test/ts1d-check-sblock delete mode 100644 omega/examples/old_test/ts1d-check-sblock.oc-rt delete mode 100644 omega/examples/old_test/ts1d-check0 delete mode 100644 omega/examples/old_test/ts1d-check0.oc-rt delete mode 100644 omega/examples/old_test/ts1d-mp-i_ts-m_b delete mode 100644 omega/examples/old_test/ts1d-mp-i_ts-m_b.oc-rt delete mode 100644 omega/examples/old_test/ts1d-orig0 delete mode 100644 omega/examples/old_test/ts1d-orig0.oc-rt delete mode 100644 omega/examples/old_test/tseng delete mode 100644 omega/examples/old_test/tseng.oc-rt delete mode 100644 omega/examples/old_test/verlind1 delete mode 100644 omega/examples/old_test/verlind1.oc-rt delete mode 100644 omega/examples/old_test/verlind1a delete mode 100644 omega/examples/old_test/verlind1a.oc-rt delete mode 100644 omega/examples/old_test/wak1 delete mode 100644 omega/examples/old_test/wak1.oc-rt delete mode 100644 omega/examples/old_test/wak2 delete mode 100644 omega/examples/old_test/wak2.oc-rt delete mode 100644 omega/examples/old_test/wak3 delete mode 100644 omega/examples/old_test/wak3.oc-rt delete mode 100644 omega/examples/old_test/wak4 delete mode 100644 omega/examples/old_test/wak4.oc-rt delete mode 100644 omega/examples/old_test/wak5 delete mode 100644 omega/examples/old_test/wak5.oc-rt delete mode 100644 omega/examples/old_test/wak6 delete mode 100644 omega/examples/old_test/wak6.oc-rt delete mode 100644 omega/examples/old_test/wak7 delete mode 100644 omega/examples/old_test/wak7.oc-rt delete mode 100644 omega/examples/old_test/wak8 delete mode 100644 omega/examples/old_test/wak8.oc-rt delete mode 100644 omega/examples/old_test/wielage delete mode 100644 omega/examples/old_test/wielage.oc-rt delete mode 100644 omega/examples/old_test/wild delete mode 100644 omega/examples/old_test/wild.oc-rt delete mode 100644 omega/examples/old_test/wrap delete mode 100644 omega/examples/old_test/wrap.oc-rt delete mode 100644 omega/examples/old_test/wrap0 delete mode 100644 omega/examples/old_test/wrap0.oc-rt delete mode 100644 omega/examples/old_test/wrap1 delete mode 100644 omega/examples/old_test/wrap1.oc-rt delete mode 100644 omega/examples/old_test/x delete mode 100644 omega/examples/old_test/x.oc-rt delete mode 100644 omega/examples/pufs delete mode 100644 omega/examples/pufs.out delete mode 100644 omega/examples/substitution delete mode 100644 omega/examples/substitution.out delete mode 100644 omega/examples/syr2k delete mode 100644 omega/examples/syr2k.out delete mode 100644 omega/examples/union delete mode 100644 omega/examples/union.out delete mode 120000 omega/include/basic delete mode 120000 omega/include/code_gen delete mode 120000 omega/include/codegen.h delete mode 100644 omega/include/config.h.in delete mode 120000 omega/include/omega delete mode 120000 omega/include/omega.h delete mode 100755 omega/install-sh delete mode 100755 omega/missing delete mode 100644 omega/omega_calc/doc/calculator.pdf delete mode 100644 omega/omega_calc/include/omega_calc/AST.h delete mode 100644 omega/omega_calc/include/omega_calc/PT-omega.c delete mode 100755 omega/omega_calc/include/omega_calc/myflex.h delete mode 100755 omega/omega_calc/obj/FlexLexer.h delete mode 100644 omega/omega_calc/obj/Makefile.am delete mode 100644 omega/omega_calc/obj/Makefile.in delete mode 100755 omega/omega_calc/obj/lex.yy.cc delete mode 100644 omega/omega_calc/obj/tile.script delete mode 100644 omega/omega_calc/src/AST.cc delete mode 100755 omega/omega_calc/src/myflex.cc delete mode 100644 omega/omega_calc/src/parser.l delete mode 100755 omega/omega_calc/src/parser.ll delete mode 100644 omega/omega_calc/src/parser.y delete mode 100755 omega/omega_calc/src/parser.yy delete mode 100644 omega/omega_lib/doc/interface.pdf delete mode 100644 omega/omega_lib/include/omega.h delete mode 100644 omega/omega_lib/include/omega/RelBody.h delete mode 100644 omega/omega_lib/include/omega/Rel_map.h delete mode 100644 omega/omega_lib/include/omega/Relation.h delete mode 100644 omega/omega_lib/include/omega/Relations.h delete mode 100644 omega/omega_lib/include/omega/closure.h delete mode 100644 omega/omega_lib/include/omega/evac.h delete mode 100644 omega/omega_lib/include/omega/farkas.h delete mode 100644 omega/omega_lib/include/omega/hull.h delete mode 100644 omega/omega_lib/include/omega/omega_core/debugging.h delete mode 100644 omega/omega_lib/include/omega/omega_core/oc.h delete mode 100644 omega/omega_lib/include/omega/omega_core/oc_i.h delete mode 100644 omega/omega_lib/include/omega/omega_i.h delete mode 100644 omega/omega_lib/include/omega/pres_cmpr.h delete mode 100644 omega/omega_lib/include/omega/pres_cnstr.h delete mode 100644 omega/omega_lib/include/omega/pres_conj.h delete mode 100644 omega/omega_lib/include/omega/pres_decl.h delete mode 100644 omega/omega_lib/include/omega/pres_dnf.h delete mode 100644 omega/omega_lib/include/omega/pres_form.h delete mode 100644 omega/omega_lib/include/omega/pres_gen.h delete mode 100644 omega/omega_lib/include/omega/pres_logic.h delete mode 100644 omega/omega_lib/include/omega/pres_quant.h delete mode 100644 omega/omega_lib/include/omega/pres_subs.h delete mode 100644 omega/omega_lib/include/omega/pres_tree.h delete mode 100644 omega/omega_lib/include/omega/pres_var.h delete mode 100644 omega/omega_lib/include/omega/reach.h delete mode 100644 omega/omega_lib/obj/Makefile.am delete mode 100644 omega/omega_lib/obj/Makefile.in delete mode 100644 omega/omega_lib/src/RelBody.cc delete mode 100644 omega/omega_lib/src/RelVar.cc delete mode 100644 omega/omega_lib/src/Relation.cc delete mode 100644 omega/omega_lib/src/Relations.cc delete mode 100644 omega/omega_lib/src/closure.cc delete mode 100644 omega/omega_lib/src/evac.cc delete mode 100644 omega/omega_lib/src/farkas.cc delete mode 100644 omega/omega_lib/src/hull.cc delete mode 100755 omega/omega_lib/src/hull_legacy.cc delete mode 100755 omega/omega_lib/src/hull_simple.cc delete mode 100644 omega/omega_lib/src/omega_core/oc.cc delete mode 100644 omega/omega_lib/src/omega_core/oc_eq.cc delete mode 100644 omega/omega_lib/src/omega_core/oc_exp_kill.cc delete mode 100644 omega/omega_lib/src/omega_core/oc_global.cc delete mode 100644 omega/omega_lib/src/omega_core/oc_print.cc delete mode 100644 omega/omega_lib/src/omega_core/oc_problems.cc delete mode 100644 omega/omega_lib/src/omega_core/oc_query.cc delete mode 100644 omega/omega_lib/src/omega_core/oc_quick_kill.cc delete mode 100644 omega/omega_lib/src/omega_core/oc_simple.cc delete mode 100644 omega/omega_lib/src/omega_core/oc_solve.cc delete mode 100644 omega/omega_lib/src/omega_core/oc_util.cc delete mode 100644 omega/omega_lib/src/pres_beaut.cc delete mode 100644 omega/omega_lib/src/pres_cnstr.cc delete mode 100644 omega/omega_lib/src/pres_col.cc delete mode 100644 omega/omega_lib/src/pres_conj.cc delete mode 100644 omega/omega_lib/src/pres_decl.cc delete mode 100644 omega/omega_lib/src/pres_dnf.cc delete mode 100644 omega/omega_lib/src/pres_form.cc delete mode 100644 omega/omega_lib/src/pres_gen.cc delete mode 100644 omega/omega_lib/src/pres_logic.cc delete mode 100644 omega/omega_lib/src/pres_print.cc delete mode 100644 omega/omega_lib/src/pres_quant.cc delete mode 100644 omega/omega_lib/src/pres_rear.cc delete mode 100644 omega/omega_lib/src/pres_subs.cc delete mode 100644 omega/omega_lib/src/pres_var.cc delete mode 100644 omega/omega_lib/src/reach.cc create mode 100644 omegalib/CMakeLists.txt create mode 100644 omegalib/LICENSE create mode 100644 omegalib/basic/include/basic/Bag.c create mode 100644 omegalib/basic/include/basic/Bag.h create mode 100644 omegalib/basic/include/basic/BoolSet.h create mode 100644 omegalib/basic/include/basic/Collection.h create mode 100644 omegalib/basic/include/basic/Collections.h create mode 100644 omegalib/basic/include/basic/ConstString.h create mode 100644 omegalib/basic/include/basic/Dynamic_Array.c create mode 100644 omegalib/basic/include/basic/Dynamic_Array.h create mode 100644 omegalib/basic/include/basic/Iterator.h create mode 100644 omegalib/basic/include/basic/Link.h create mode 100644 omegalib/basic/include/basic/List.c create mode 100644 omegalib/basic/include/basic/List.h create mode 100644 omegalib/basic/include/basic/Map.c create mode 100644 omegalib/basic/include/basic/Map.h create mode 100644 omegalib/basic/include/basic/Section.c create mode 100644 omegalib/basic/include/basic/Section.h create mode 100644 omegalib/basic/include/basic/SimpleList.c create mode 100644 omegalib/basic/include/basic/SimpleList.h create mode 100644 omegalib/basic/include/basic/Tuple.c create mode 100644 omegalib/basic/include/basic/Tuple.h create mode 100755 omegalib/basic/include/basic/boolset-test.cc create mode 100755 omegalib/basic/include/basic/boolset.h create mode 100644 omegalib/basic/include/basic/omega_error.h create mode 100644 omegalib/basic/include/basic/util.h create mode 100644 omegalib/basic/src/ConstString.cc create mode 100644 omegalib/basic/src/Link.cc create mode 100644 omegalib/code_gen/CMakeLists.txt create mode 100644 omegalib/code_gen/include/code_gen/CG.h create mode 100644 omegalib/code_gen/include/code_gen/CG_outputBuilder.h create mode 100644 omegalib/code_gen/include/code_gen/CG_outputRepr.h create mode 100644 omegalib/code_gen/include/code_gen/CG_roseBuilder.h create mode 100644 omegalib/code_gen/include/code_gen/CG_roseRepr.h create mode 100644 omegalib/code_gen/include/code_gen/CG_stringBuilder.h create mode 100644 omegalib/code_gen/include/code_gen/CG_stringRepr.h create mode 100644 omegalib/code_gen/include/code_gen/CG_suifBuilder.h create mode 100644 omegalib/code_gen/include/code_gen/CG_suifRepr.h create mode 100755 omegalib/code_gen/include/code_gen/CG_utils.h create mode 100644 omegalib/code_gen/include/code_gen/code_gen.h create mode 100755 omegalib/code_gen/include/code_gen/codegen.h create mode 100755 omegalib/code_gen/include/code_gen/codegen_error.h create mode 100644 omegalib/code_gen/include/code_gen/cscope.out create mode 100644 omegalib/code_gen/include/code_gen/output_repr.h create mode 100644 omegalib/code_gen/include/code_gen/rose_attributes.h create mode 100644 omegalib/code_gen/src/CG.cc create mode 100644 omegalib/code_gen/src/CG_roseBuilder.cc create mode 100644 omegalib/code_gen/src/CG_roseRepr.cc create mode 100644 omegalib/code_gen/src/CG_stringBuilder.cc create mode 100644 omegalib/code_gen/src/CG_stringRepr.cc create mode 100644 omegalib/code_gen/src/CG_suifBuilder.cc create mode 100644 omegalib/code_gen/src/CG_suifRepr.cc create mode 100755 omegalib/code_gen/src/CG_utils.cc create mode 100644 omegalib/code_gen/src/code_gen.cc create mode 100755 omegalib/code_gen/src/codegen.cc create mode 100644 omegalib/code_gen/src/cscope.out create mode 100644 omegalib/code_gen/src/output_repr.cc create mode 100644 omegalib/code_gen/src/rose_attributes.cc create mode 100644 omegalib/code_gen/src/tags create mode 100755 omegalib/doc/calculator.pdf create mode 100755 omegalib/doc/interface.pdf create mode 100644 omegalib/examples/basics create mode 100644 omegalib/examples/basics.out create mode 100644 omegalib/examples/c_code/PT-example.c create mode 100644 omegalib/examples/c_code/example.c create mode 100644 omegalib/examples/c_code/library_example.c create mode 100644 omegalib/examples/code_gen create mode 100644 omegalib/examples/code_gen.out create mode 100755 omegalib/examples/experiments/gemm/codegen.input create mode 100644 omegalib/examples/experiments/gemm/gemm.out create mode 100755 omegalib/examples/experiments/gemv/codegen.input create mode 100644 omegalib/examples/experiments/gemv/gemv.out create mode 100755 omegalib/examples/experiments/lu/codegen.input create mode 100644 omegalib/examples/experiments/lu/lu.out create mode 100755 omegalib/examples/experiments/qr/codegen.input create mode 100644 omegalib/examples/experiments/qr/qr.out create mode 100755 omegalib/examples/experiments/swim/swim-codegen.input create mode 100644 omegalib/examples/experiments/swim/swim.out create mode 100644 omegalib/examples/floor_bound create mode 100644 omegalib/examples/floor_bound.out create mode 100644 omegalib/examples/gist create mode 100644 omegalib/examples/gist.out create mode 100644 omegalib/examples/hpf create mode 100644 omegalib/examples/hpf.out create mode 100644 omegalib/examples/hull create mode 100644 omegalib/examples/hull.out create mode 100755 omegalib/examples/if_then create mode 100644 omegalib/examples/interface create mode 100644 omegalib/examples/interface.out create mode 100644 omegalib/examples/lu create mode 100644 omegalib/examples/lu.out create mode 100644 omegalib/examples/old_test/affineClosure create mode 100644 omegalib/examples/old_test/affineClosure.oc-rt create mode 100644 omegalib/examples/old_test/affineClosure2 create mode 100644 omegalib/examples/old_test/affineClosure2.oc-rt create mode 100644 omegalib/examples/old_test/beatrice2 create mode 100644 omegalib/examples/old_test/beatrice2.oc-rt create mode 100644 omegalib/examples/old_test/blume1.w create mode 100644 omegalib/examples/old_test/blume1.w.oc-rt create mode 100644 omegalib/examples/old_test/cfft2d1 create mode 100644 omegalib/examples/old_test/cfft2d1.oc-rt create mode 100644 omegalib/examples/old_test/chosol create mode 100644 omegalib/examples/old_test/chosol.oc-rt create mode 100644 omegalib/examples/old_test/closure1 create mode 100644 omegalib/examples/old_test/closure1.oc-rt create mode 100644 omegalib/examples/old_test/closure2 create mode 100644 omegalib/examples/old_test/closure2.oc-rt create mode 100644 omegalib/examples/old_test/closure3 create mode 100644 omegalib/examples/old_test/closure3.oc-rt create mode 100644 omegalib/examples/old_test/closure4 create mode 100644 omegalib/examples/old_test/closure4.oc-rt create mode 100644 omegalib/examples/old_test/closure5 create mode 100644 omegalib/examples/old_test/closure5.oc-rt create mode 100644 omegalib/examples/old_test/closure6 create mode 100644 omegalib/examples/old_test/closure6.oc-rt create mode 100644 omegalib/examples/old_test/closure7 create mode 100644 omegalib/examples/old_test/closure7.oc-rt create mode 100644 omegalib/examples/old_test/closure8 create mode 100644 omegalib/examples/old_test/closure8.oc-rt create mode 100644 omegalib/examples/old_test/collard create mode 100644 omegalib/examples/old_test/collard.oc-rt create mode 100644 omegalib/examples/old_test/cover create mode 100644 omegalib/examples/old_test/cover.oc-rt create mode 100644 omegalib/examples/old_test/dagstuhl1 create mode 100644 omegalib/examples/old_test/dagstuhl1.oc-rt create mode 100644 omegalib/examples/old_test/dagstuhl2 create mode 100644 omegalib/examples/old_test/dagstuhl2.oc-rt create mode 100644 omegalib/examples/old_test/dagstuhl3 create mode 100644 omegalib/examples/old_test/dagstuhl3.oc-rt create mode 100644 omegalib/examples/old_test/davew1 create mode 100644 omegalib/examples/old_test/davew1.oc-rt create mode 100644 omegalib/examples/old_test/ddtest create mode 100644 omegalib/examples/old_test/ddtest.oc-rt create mode 100644 omegalib/examples/old_test/emit create mode 100644 omegalib/examples/old_test/emit.oc-rt create mode 100644 omegalib/examples/old_test/example1 create mode 100644 omegalib/examples/old_test/example1.oc-rt create mode 100644 omegalib/examples/old_test/farkas create mode 100644 omegalib/examples/old_test/farkas.oc-rt create mode 100644 omegalib/examples/old_test/farkas2 create mode 100644 omegalib/examples/old_test/farkas2.oc-rt create mode 100644 omegalib/examples/old_test/farkas3 create mode 100644 omegalib/examples/old_test/farkas3.oc-rt create mode 100644 omegalib/examples/old_test/fc1 create mode 100644 omegalib/examples/old_test/fc1.oc-rt create mode 100644 omegalib/examples/old_test/fc2 create mode 100644 omegalib/examples/old_test/fc2.oc-rt create mode 100644 omegalib/examples/old_test/foo create mode 100644 omegalib/examples/old_test/foo.oc-rt create mode 100644 omegalib/examples/old_test/foo2 create mode 100644 omegalib/examples/old_test/foo2.oc-rt create mode 100644 omegalib/examples/old_test/foo6 create mode 100644 omegalib/examples/old_test/foo6.oc-rt create mode 100644 omegalib/examples/old_test/forall create mode 100644 omegalib/examples/old_test/forall.oc-rt create mode 100644 omegalib/examples/old_test/gc create mode 100644 omegalib/examples/old_test/gc.oc-rt create mode 100644 omegalib/examples/old_test/ge create mode 100644 omegalib/examples/old_test/ge.oc-rt create mode 100644 omegalib/examples/old_test/givens2 create mode 100644 omegalib/examples/old_test/givens2.oc-rt create mode 100644 omegalib/examples/old_test/guard1 create mode 100644 omegalib/examples/old_test/guard1.oc-rt create mode 100644 omegalib/examples/old_test/hull1 create mode 100644 omegalib/examples/old_test/hull1.oc-rt create mode 100644 omegalib/examples/old_test/hull2 create mode 100644 omegalib/examples/old_test/hull2.oc-rt create mode 100644 omegalib/examples/old_test/hull3 create mode 100644 omegalib/examples/old_test/hull3.oc-rt create mode 100644 omegalib/examples/old_test/ip1 create mode 100644 omegalib/examples/old_test/ip1.oc-rt create mode 100644 omegalib/examples/old_test/ip2 create mode 100644 omegalib/examples/old_test/ip2.oc-rt create mode 100644 omegalib/examples/old_test/ip3 create mode 100644 omegalib/examples/old_test/ip3.oc-rt create mode 100644 omegalib/examples/old_test/iter1 create mode 100644 omegalib/examples/old_test/iter1.oc-rt create mode 100644 omegalib/examples/old_test/iter2 create mode 100644 omegalib/examples/old_test/iter2.oc-rt create mode 100644 omegalib/examples/old_test/iter3 create mode 100644 omegalib/examples/old_test/iter3.oc-rt create mode 100644 omegalib/examples/old_test/iter4 create mode 100644 omegalib/examples/old_test/iter4.oc-rt create mode 100644 omegalib/examples/old_test/iter5 create mode 100644 omegalib/examples/old_test/iter5.oc-rt create mode 100644 omegalib/examples/old_test/iter6 create mode 100644 omegalib/examples/old_test/iter6.oc-rt create mode 100644 omegalib/examples/old_test/iter7 create mode 100644 omegalib/examples/old_test/iter7.oc-rt create mode 100644 omegalib/examples/old_test/iter8 create mode 100644 omegalib/examples/old_test/iter8.oc-rt create mode 100644 omegalib/examples/old_test/iter9 create mode 100644 omegalib/examples/old_test/iter9.oc-rt create mode 100644 omegalib/examples/old_test/lefur00 create mode 100644 omegalib/examples/old_test/lefur00.oc-rt create mode 100644 omegalib/examples/old_test/lefur01 create mode 100644 omegalib/examples/old_test/lefur01.oc-rt create mode 100644 omegalib/examples/old_test/lefur03 create mode 100644 omegalib/examples/old_test/lefur03-3 create mode 100644 omegalib/examples/old_test/lefur03-3.oc-rt create mode 100644 omegalib/examples/old_test/lefur03.c create mode 100644 omegalib/examples/old_test/lefur03.oc-rt create mode 100644 omegalib/examples/old_test/lefur04 create mode 100644 omegalib/examples/old_test/lefur04.oc-rt create mode 100644 omegalib/examples/old_test/lefur05 create mode 100644 omegalib/examples/old_test/lefur05.oc-rt create mode 100644 omegalib/examples/old_test/lift1 create mode 100644 omegalib/examples/old_test/lift1.oc-rt create mode 100644 omegalib/examples/old_test/lift2 create mode 100644 omegalib/examples/old_test/lift2.oc-rt create mode 100644 omegalib/examples/old_test/long_input create mode 100644 omegalib/examples/old_test/long_input.oc-rt create mode 100644 omegalib/examples/old_test/lu_ijk create mode 100644 omegalib/examples/old_test/lu_ijk.oc-rt create mode 100644 omegalib/examples/old_test/lu_spmd create mode 100644 omegalib/examples/old_test/lu_spmd.oc-rt create mode 100644 omegalib/examples/old_test/m1 create mode 100644 omegalib/examples/old_test/m1.oc-rt create mode 100644 omegalib/examples/old_test/m10 create mode 100644 omegalib/examples/old_test/m10.oc-rt create mode 100644 omegalib/examples/old_test/m11 create mode 100644 omegalib/examples/old_test/m11.oc-rt create mode 100644 omegalib/examples/old_test/m12 create mode 100644 omegalib/examples/old_test/m12.oc-rt create mode 100644 omegalib/examples/old_test/m2 create mode 100644 omegalib/examples/old_test/m2.oc-rt create mode 100644 omegalib/examples/old_test/m3 create mode 100644 omegalib/examples/old_test/m3.oc-rt create mode 100644 omegalib/examples/old_test/m4 create mode 100644 omegalib/examples/old_test/m4.oc-rt create mode 100644 omegalib/examples/old_test/m7 create mode 100644 omegalib/examples/old_test/m7.oc-rt create mode 100644 omegalib/examples/old_test/m8 create mode 100644 omegalib/examples/old_test/m8.oc-rt create mode 100644 omegalib/examples/old_test/m9 create mode 100644 omegalib/examples/old_test/m9.oc-rt create mode 100644 omegalib/examples/old_test/maximize create mode 100644 omegalib/examples/old_test/maximize.oc-rt create mode 100644 omegalib/examples/old_test/olda create mode 100644 omegalib/examples/old_test/olda.oc-rt create mode 100644 omegalib/examples/old_test/p.delft create mode 100644 omegalib/examples/old_test/p.delft.oc-rt create mode 100644 omegalib/examples/old_test/p.delft2 create mode 100644 omegalib/examples/old_test/p.delft2.oc-rt create mode 100644 omegalib/examples/old_test/p.delft3 create mode 100644 omegalib/examples/old_test/p.delft3.oc-rt create mode 100644 omegalib/examples/old_test/p.subset create mode 100644 omegalib/examples/old_test/p.subset.oc-rt create mode 100644 omegalib/examples/old_test/p1 create mode 100644 omegalib/examples/old_test/p1.oc-rt create mode 100644 omegalib/examples/old_test/p10 create mode 100644 omegalib/examples/old_test/p10.oc-rt create mode 100644 omegalib/examples/old_test/p11 create mode 100644 omegalib/examples/old_test/p11.oc-rt create mode 100644 omegalib/examples/old_test/p12 create mode 100644 omegalib/examples/old_test/p12.oc-rt create mode 100644 omegalib/examples/old_test/p13 create mode 100644 omegalib/examples/old_test/p13.oc-rt create mode 100644 omegalib/examples/old_test/p2 create mode 100644 omegalib/examples/old_test/p2.oc-rt create mode 100644 omegalib/examples/old_test/p3 create mode 100644 omegalib/examples/old_test/p3.oc-rt create mode 100644 omegalib/examples/old_test/p4 create mode 100644 omegalib/examples/old_test/p4.oc-rt create mode 100644 omegalib/examples/old_test/p5 create mode 100644 omegalib/examples/old_test/p5.oc-rt create mode 100644 omegalib/examples/old_test/p6 create mode 100644 omegalib/examples/old_test/p6.oc-rt create mode 100644 omegalib/examples/old_test/p7 create mode 100644 omegalib/examples/old_test/p7.oc-rt create mode 100644 omegalib/examples/old_test/p8 create mode 100644 omegalib/examples/old_test/p8.oc-rt create mode 100644 omegalib/examples/old_test/p9 create mode 100644 omegalib/examples/old_test/p9.oc-rt create mode 100644 omegalib/examples/old_test/pufs1 create mode 100644 omegalib/examples/old_test/pufs1.oc-rt create mode 100644 omegalib/examples/old_test/pufs2 create mode 100644 omegalib/examples/old_test/pufs2.oc-rt create mode 100644 omegalib/examples/old_test/pufs3 create mode 100644 omegalib/examples/old_test/pufs3.oc-rt create mode 100644 omegalib/examples/old_test/pufs4 create mode 100644 omegalib/examples/old_test/pufs4.oc-rt create mode 100644 omegalib/examples/old_test/pufs5 create mode 100644 omegalib/examples/old_test/pufs5.oc-rt create mode 100644 omegalib/examples/old_test/pufs6 create mode 100644 omegalib/examples/old_test/pufs6.oc-rt create mode 100644 omegalib/examples/old_test/pufs7 create mode 100644 omegalib/examples/old_test/pufs7.oc-rt create mode 100644 omegalib/examples/old_test/reach1 create mode 100644 omegalib/examples/old_test/reach1.oc-rt create mode 100644 omegalib/examples/old_test/reach2 create mode 100644 omegalib/examples/old_test/reach2.oc-rt create mode 100644 omegalib/examples/old_test/reach3 create mode 100644 omegalib/examples/old_test/reach3.oc-rt create mode 100644 omegalib/examples/old_test/red1 create mode 100644 omegalib/examples/old_test/red1.oc-rt create mode 100644 omegalib/examples/old_test/saman create mode 100644 omegalib/examples/old_test/saman.oc-rt create mode 100644 omegalib/examples/old_test/sample1 create mode 100644 omegalib/examples/old_test/sample1.oc-rt create mode 100644 omegalib/examples/old_test/sample2 create mode 100644 omegalib/examples/old_test/sample2.oc-rt create mode 100644 omegalib/examples/old_test/sample3 create mode 100644 omegalib/examples/old_test/sample3.oc-rt create mode 100644 omegalib/examples/old_test/stodghil create mode 100644 omegalib/examples/old_test/stodghil.oc-rt create mode 100644 omegalib/examples/old_test/stride1 create mode 100644 omegalib/examples/old_test/stride1.oc-rt create mode 100644 omegalib/examples/old_test/stride2 create mode 100644 omegalib/examples/old_test/stride2.oc-rt create mode 100644 omegalib/examples/old_test/stride3 create mode 100644 omegalib/examples/old_test/stride3.oc-rt create mode 100644 omegalib/examples/old_test/stride4 create mode 100644 omegalib/examples/old_test/stride4.oc-rt create mode 100644 omegalib/examples/old_test/stride5 create mode 100644 omegalib/examples/old_test/stride5.oc-rt create mode 100644 omegalib/examples/old_test/stride6 create mode 100644 omegalib/examples/old_test/stride6.oc-rt create mode 100644 omegalib/examples/old_test/stride7 create mode 100644 omegalib/examples/old_test/stride7.oc-rt create mode 100644 omegalib/examples/old_test/subsets1 create mode 100644 omegalib/examples/old_test/subsets1.oc-rt create mode 100644 omegalib/examples/old_test/subsets2 create mode 100644 omegalib/examples/old_test/subsets2.oc-rt create mode 100644 omegalib/examples/old_test/tex1 create mode 100644 omegalib/examples/old_test/tex1.oc-rt create mode 100644 omegalib/examples/old_test/tricky create mode 100644 omegalib/examples/old_test/tricky.oc-rt create mode 100644 omegalib/examples/old_test/ts1d-check-sblock create mode 100644 omegalib/examples/old_test/ts1d-check-sblock.oc-rt create mode 100644 omegalib/examples/old_test/ts1d-check0 create mode 100644 omegalib/examples/old_test/ts1d-check0.oc-rt create mode 100644 omegalib/examples/old_test/ts1d-mp-i_ts-m_b create mode 100644 omegalib/examples/old_test/ts1d-mp-i_ts-m_b.oc-rt create mode 100644 omegalib/examples/old_test/ts1d-orig0 create mode 100644 omegalib/examples/old_test/ts1d-orig0.oc-rt create mode 100644 omegalib/examples/old_test/tseng create mode 100644 omegalib/examples/old_test/tseng.oc-rt create mode 100644 omegalib/examples/old_test/verlind1 create mode 100644 omegalib/examples/old_test/verlind1.oc-rt create mode 100644 omegalib/examples/old_test/verlind1a create mode 100644 omegalib/examples/old_test/verlind1a.oc-rt create mode 100644 omegalib/examples/old_test/wak1 create mode 100644 omegalib/examples/old_test/wak1.oc-rt create mode 100644 omegalib/examples/old_test/wak2 create mode 100644 omegalib/examples/old_test/wak2.oc-rt create mode 100644 omegalib/examples/old_test/wak3 create mode 100644 omegalib/examples/old_test/wak3.oc-rt create mode 100644 omegalib/examples/old_test/wak4 create mode 100644 omegalib/examples/old_test/wak4.oc-rt create mode 100644 omegalib/examples/old_test/wak5 create mode 100644 omegalib/examples/old_test/wak5.oc-rt create mode 100644 omegalib/examples/old_test/wak6 create mode 100644 omegalib/examples/old_test/wak6.oc-rt create mode 100644 omegalib/examples/old_test/wak7 create mode 100644 omegalib/examples/old_test/wak7.oc-rt create mode 100644 omegalib/examples/old_test/wak8 create mode 100644 omegalib/examples/old_test/wak8.oc-rt create mode 100644 omegalib/examples/old_test/wielage create mode 100644 omegalib/examples/old_test/wielage.oc-rt create mode 100644 omegalib/examples/old_test/wild create mode 100644 omegalib/examples/old_test/wild.oc-rt create mode 100644 omegalib/examples/old_test/wrap create mode 100644 omegalib/examples/old_test/wrap.oc-rt create mode 100644 omegalib/examples/old_test/wrap0 create mode 100644 omegalib/examples/old_test/wrap0.oc-rt create mode 100644 omegalib/examples/old_test/wrap1 create mode 100644 omegalib/examples/old_test/wrap1.oc-rt create mode 100644 omegalib/examples/old_test/x create mode 100644 omegalib/examples/old_test/x.oc-rt create mode 100644 omegalib/examples/pufs create mode 100644 omegalib/examples/pufs.out create mode 100644 omegalib/examples/substitution create mode 100644 omegalib/examples/substitution.out create mode 100644 omegalib/examples/syr2k create mode 100644 omegalib/examples/syr2k.out create mode 100644 omegalib/examples/union create mode 100644 omegalib/examples/union.out create mode 120000 omegalib/include/basic create mode 120000 omegalib/include/code_gen create mode 120000 omegalib/include/codegen.h create mode 100644 omegalib/include/config.h create mode 100644 omegalib/include/config.h.in create mode 120000 omegalib/include/omega create mode 120000 omegalib/include/omega.h create mode 100644 omegalib/include/stamp-h1 create mode 100644 omegalib/omega_calc/CMakeLists.txt create mode 100644 omegalib/omega_calc/doc/calculator.pdf create mode 100644 omegalib/omega_calc/include/omega_calc/AST.h create mode 100644 omegalib/omega_calc/include/omega_calc/PT-omega.c create mode 100755 omegalib/omega_calc/include/omega_calc/myflex.h create mode 100644 omegalib/omega_calc/src/AST.cc create mode 100755 omegalib/omega_calc/src/myflex.cc create mode 100644 omegalib/omega_calc/src/parser.l create mode 100755 omegalib/omega_calc/src/parser.ll create mode 100644 omegalib/omega_calc/src/parser.y create mode 100755 omegalib/omega_calc/src/parser.yy create mode 100644 omegalib/omega_lib/CMakeLists.txt create mode 100644 omegalib/omega_lib/doc/interface.pdf create mode 100644 omegalib/omega_lib/include/omega.h create mode 100644 omegalib/omega_lib/include/omega/RelBody.h create mode 100644 omegalib/omega_lib/include/omega/Rel_map.h create mode 100644 omegalib/omega_lib/include/omega/Relation.h create mode 100644 omegalib/omega_lib/include/omega/Relations.h create mode 100644 omegalib/omega_lib/include/omega/closure.h create mode 100644 omegalib/omega_lib/include/omega/evac.h create mode 100644 omegalib/omega_lib/include/omega/farkas.h create mode 100644 omegalib/omega_lib/include/omega/hull.h create mode 100644 omegalib/omega_lib/include/omega/omega_core/debugging.h create mode 100644 omegalib/omega_lib/include/omega/omega_core/oc.h create mode 100644 omegalib/omega_lib/include/omega/omega_core/oc_i.h create mode 100644 omegalib/omega_lib/include/omega/omega_i.h create mode 100644 omegalib/omega_lib/include/omega/pres_cmpr.h create mode 100644 omegalib/omega_lib/include/omega/pres_cnstr.h create mode 100644 omegalib/omega_lib/include/omega/pres_conj.h create mode 100644 omegalib/omega_lib/include/omega/pres_decl.h create mode 100644 omegalib/omega_lib/include/omega/pres_dnf.h create mode 100644 omegalib/omega_lib/include/omega/pres_form.h create mode 100644 omegalib/omega_lib/include/omega/pres_gen.h create mode 100644 omegalib/omega_lib/include/omega/pres_logic.h create mode 100644 omegalib/omega_lib/include/omega/pres_quant.h create mode 100644 omegalib/omega_lib/include/omega/pres_subs.h create mode 100644 omegalib/omega_lib/include/omega/pres_tree.h create mode 100644 omegalib/omega_lib/include/omega/pres_var.h create mode 100644 omegalib/omega_lib/include/omega/reach.h create mode 100644 omegalib/omega_lib/src/RelBody.cc create mode 100644 omegalib/omega_lib/src/RelVar.cc create mode 100644 omegalib/omega_lib/src/Relation.cc create mode 100644 omegalib/omega_lib/src/Relations.cc create mode 100644 omegalib/omega_lib/src/closure.cc create mode 100644 omegalib/omega_lib/src/evac.cc create mode 100644 omegalib/omega_lib/src/farkas.cc create mode 100644 omegalib/omega_lib/src/hull.cc create mode 100755 omegalib/omega_lib/src/hull_legacy.cc create mode 100755 omegalib/omega_lib/src/hull_simple.cc create mode 100644 omegalib/omega_lib/src/omega_core/oc.cc create mode 100644 omegalib/omega_lib/src/omega_core/oc_eq.cc create mode 100644 omegalib/omega_lib/src/omega_core/oc_exp_kill.cc create mode 100644 omegalib/omega_lib/src/omega_core/oc_global.cc create mode 100644 omegalib/omega_lib/src/omega_core/oc_print.cc create mode 100644 omegalib/omega_lib/src/omega_core/oc_problems.cc create mode 100644 omegalib/omega_lib/src/omega_core/oc_query.cc create mode 100644 omegalib/omega_lib/src/omega_core/oc_quick_kill.cc create mode 100644 omegalib/omega_lib/src/omega_core/oc_simple.cc create mode 100644 omegalib/omega_lib/src/omega_core/oc_solve.cc create mode 100644 omegalib/omega_lib/src/omega_core/oc_util.cc create mode 100644 omegalib/omega_lib/src/pres_beaut.cc create mode 100644 omegalib/omega_lib/src/pres_cnstr.cc create mode 100644 omegalib/omega_lib/src/pres_col.cc create mode 100644 omegalib/omega_lib/src/pres_conj.cc create mode 100644 omegalib/omega_lib/src/pres_decl.cc create mode 100644 omegalib/omega_lib/src/pres_dnf.cc create mode 100644 omegalib/omega_lib/src/pres_form.cc create mode 100644 omegalib/omega_lib/src/pres_gen.cc create mode 100644 omegalib/omega_lib/src/pres_logic.cc create mode 100644 omegalib/omega_lib/src/pres_print.cc create mode 100644 omegalib/omega_lib/src/pres_quant.cc create mode 100644 omegalib/omega_lib/src/pres_rear.cc create mode 100644 omegalib/omega_lib/src/pres_subs.cc create mode 100644 omegalib/omega_lib/src/pres_var.cc create mode 100644 omegalib/omega_lib/src/reach.cc delete mode 100644 omegatools.cc delete mode 100644 omegatools.hh delete mode 100644 parse_expr.ll delete mode 100644 parse_expr.yy delete mode 100644 parser.ll delete mode 100644 parser.yy diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..da2d816 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 2.8) +project(chill) +set(CHILL_VERSION 0.2.1) # 2.8 doesn't support project version clause + +if(NOT DEFINED ROSEHOME) + message( FATAL_ERROR "ROSEHOME is not set, try use -DROSEHOME" ) +endif() +if (NOT DEFINED BOOSTHOME) + message( FATAL_ERROR "BOOSTHOME is not set, try use -DBOOSTHOME" ) +endif() + +add_subdirectory(chill) +add_subdirectory(omegalib) diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index ab2a5cc..0000000 --- a/Makefile.am +++ /dev/null @@ -1,139 +0,0 @@ -SUBDIRS = omega/omega_lib/obj omega/code_gen/obj -build_date = "\"`date +%m/%d/%Y`\"" - -## Core Libraries ## -core_libs = -lm -lrose -lrt -lutil -lomega -lcodegen -ldl -core_libs += -lboost_date_time -lboost_filesystem -lboost_program_options -core_libs += -lboost_regex -lboost_system -lboost_wave -lboost_iostreams - -core_libdirs = -Lomega/code_gen/obj -Lomega/omega_lib/obj -core_libdirs += -L$(ROSEHOME)/lib -L$(BOOSTHOME)/lib - - - -## Core Includes ## -core_includes = -Iomega/include -core_includes += -I$(ROSEHOME)/include -core_includes += -I$(BOOSTHOME)/include - - -## Source ## -# Core # -core_src = dep.cc -core_src += irtools.cc -core_src += loop.cc -core_src += loop_basic.cc -core_src += loop_datacopy.cc -core_src += loop_extra.cc -core_src += loop_tile.cc -core_src += loop_unroll.cc -core_src += omegatools.cc - -# chill # -# cudachill # -cudachill_src = mem_mapping_utils.cc -cudachill_src += loop_cuda_rose.cc - -# IR # -# chill -ir_chill_src = ir_rose.cc -ir_chill_src += ir_rose_utils.cc - -# cudachill -ir_cudachill_src = ir_rose.cc -ir_cudachill_src += ir_rose_utils.cc -ir_cudachill_src += ir_cudarose.cc -ir_cudachill_src += ir_cuda_rose_utils.cc - -# runner (interface) # -# cc -chill_script_runner_src = -chill_python_runner_src = chill_run.cc chill_run_util.cc chillmodule.cc -chill_lua_runner_src = chill_run.cc chill_run_util.cc chill_env.cc -# yacc -chill_script_yacc_src = lex.yy.cc parser.tab.cc -chill_lua_yacc_src = parse_expr.yy.cc parse_expr.tab.cc -chill_python_yacc_src = parse_expr.yy.cc parse_expr.tab.cc - - - -## Interface ## -# Libs/Source/Flags # -if PYTHON_OPT -runner_libs = -lpython$(PYTHON_VERSION) -runner_libdirs = -L$(PYTHON_LIBDIR) -runner_includes = -I$(PYTHON_INCDIR) -chill_runner_src = $(chill_python_runner_src) $(chill_python_yacc_src) -cudachill_runner_src = $(chill_python_runner_src) $(chill_python_yacc_src) -yacc_src = $(chill_python_yacc_src) -runner_flags = -DCHILL_BUILD_DATE=$(build_date) -runner_flags += -DCHILL_BUILD_VERSION=$(CHILL_BUILD_VERSION) -runner_flags += -DPYTHON -else -if LUA_OPT -runner_libs = -llua -lreadline -lhistory -lpthread -ldl -runner_libdirs = -L$(LUAHOME)/lib -runner_includes = -I$(LUAHOME)/include -chill_runner_src = $(chill_lua_runner_src) $(chill_lua_yacc_src) -cudachill_runner_src = $(chill_lua_runner_src) $(chill_lua_yacc_src) -yacc_src = $(chill_lua_yacc_src) -runner_flags = -DCHILL_BUILD_DATE=$(build_date) -runner_flags += -DCHILL_BUILD_VERSION=$(CHILL_BUILD_VERSION) -runner_flags += -DLUA -else -runner_libs = -runner_libdirs = -runner_includes = -chill_runner_src = $(chill_script_runner_src) $(chill_script_yacc_src) -yacc_src = $(chill_script_yacc_src) -runner_flags = -DCHILL_BUILD_DATE=$(build_date) -runner_flags += -DCHILL_BUILD_VERSION=$(CHILL_BUILD_VERSION) -endif -endif - - - -## Yacc ## -# config -BUILT_SOURCES=$(yacc_src) -AM_YFLAGS=-d -t - -# rules -lex.yy.cc: parser.ll parser.tab.cc - flex++ parser.ll - -parser.tab.cc: parser.yy - bison -t -d $< - -parse_expr.yy.cc: parse_expr.tab.cc parse_expr.ll - flex -o parse_expr.yy.cc parse_expr.ll - -parse_expr.tab.cc: parse_expr.yy - bison -t -d parse_expr.yy - - - -## Common ## -common_cppflags = $(core_includes) $(runner_includes) -common_cppflags += $(runner_flags) -common_cppflags += -DBUILD_ROSE -common_libs = $(core_libs) $(runner_libs) -common_libdirs = $(core_libdirs) $(runner_libdirs) - -## Binaries ## -if CUDACHILL_OPT -bin_PROGRAMS=cudachill -else -bin_PROGRAMS=chill -endif - -cudachill_CPPFLAGS =-DCUDACHILL $(common_cppflags) -cudachill_LDADD =$(common_libs) -cudachill_LDFLAGS =$(common_libdirs) -cudachill_SOURCES =$(core_src) $(cudachill_runner_src) $(cudachill_src) $(ir_cudachill_src) - -chill_CPPFLAGS =$(common_cppflags) $(chill_runner_cppflags) -chill_LDADD =$(common_libs) -chill_LDFLAGS =$(common_libdirs) -chill_SOURCES =$(core_src) $(chill_runner_src) $(chill_src) $(ir_chill_src) - diff --git a/Makefile.in b/Makefile.in deleted file mode 100644 index 796ef49..0000000 --- a/Makefile.in +++ /dev/null @@ -1,1646 +0,0 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -@CUDACHILL_OPT_FALSE@bin_PROGRAMS = chill$(EXEEXT) -@CUDACHILL_OPT_TRUE@bin_PROGRAMS = cudachill$(EXEEXT) -subdir = . -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/configure $(am__configure_deps) \ - $(top_srcdir)/include/config.h.in depcomp README compile \ - install-sh missing -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno config.status.lineno -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/include/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" -PROGRAMS = $(bin_PROGRAMS) -am__chill_SOURCES_DIST = dep.cc irtools.cc loop.cc loop_basic.cc \ - loop_datacopy.cc loop_extra.cc loop_tile.cc loop_unroll.cc \ - omegatools.cc lex.yy.cc parser.tab.cc chill_run.cc \ - chill_run_util.cc chill_env.cc parse_expr.yy.cc \ - parse_expr.tab.cc chillmodule.cc ir_rose.cc ir_rose_utils.cc -am__objects_1 = chill-dep.$(OBJEXT) chill-irtools.$(OBJEXT) \ - chill-loop.$(OBJEXT) chill-loop_basic.$(OBJEXT) \ - chill-loop_datacopy.$(OBJEXT) chill-loop_extra.$(OBJEXT) \ - chill-loop_tile.$(OBJEXT) chill-loop_unroll.$(OBJEXT) \ - chill-omegatools.$(OBJEXT) -am__objects_2 = -am__objects_3 = chill-lex.yy.$(OBJEXT) chill-parser.tab.$(OBJEXT) -am__objects_4 = chill-chill_run.$(OBJEXT) \ - chill-chill_run_util.$(OBJEXT) chill-chill_env.$(OBJEXT) -am__objects_5 = chill-parse_expr.yy.$(OBJEXT) \ - chill-parse_expr.tab.$(OBJEXT) -am__objects_6 = chill-chill_run.$(OBJEXT) \ - chill-chill_run_util.$(OBJEXT) chill-chillmodule.$(OBJEXT) -@LUA_OPT_FALSE@@PYTHON_OPT_FALSE@am__objects_7 = $(am__objects_2) \ -@LUA_OPT_FALSE@@PYTHON_OPT_FALSE@ $(am__objects_3) -@LUA_OPT_TRUE@@PYTHON_OPT_FALSE@am__objects_7 = $(am__objects_4) \ -@LUA_OPT_TRUE@@PYTHON_OPT_FALSE@ $(am__objects_5) -@PYTHON_OPT_TRUE@am__objects_7 = $(am__objects_6) $(am__objects_5) -am__objects_8 = chill-ir_rose.$(OBJEXT) chill-ir_rose_utils.$(OBJEXT) -am_chill_OBJECTS = $(am__objects_1) $(am__objects_7) $(am__objects_8) -chill_OBJECTS = $(am_chill_OBJECTS) -am__DEPENDENCIES_1 = -am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) -chill_DEPENDENCIES = $(am__DEPENDENCIES_2) -chill_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(chill_LDFLAGS) \ - $(LDFLAGS) -o $@ -am__cudachill_SOURCES_DIST = dep.cc irtools.cc loop.cc loop_basic.cc \ - loop_datacopy.cc loop_extra.cc loop_tile.cc loop_unroll.cc \ - omegatools.cc chill_run.cc chill_run_util.cc chill_env.cc \ - parse_expr.yy.cc parse_expr.tab.cc chillmodule.cc \ - mem_mapping_utils.cc loop_cuda_rose.cc ir_rose.cc \ - ir_rose_utils.cc ir_cudarose.cc ir_cuda_rose_utils.cc -am__objects_9 = cudachill-dep.$(OBJEXT) cudachill-irtools.$(OBJEXT) \ - cudachill-loop.$(OBJEXT) cudachill-loop_basic.$(OBJEXT) \ - cudachill-loop_datacopy.$(OBJEXT) \ - cudachill-loop_extra.$(OBJEXT) cudachill-loop_tile.$(OBJEXT) \ - cudachill-loop_unroll.$(OBJEXT) cudachill-omegatools.$(OBJEXT) -am__objects_10 = cudachill-chill_run.$(OBJEXT) \ - cudachill-chill_run_util.$(OBJEXT) \ - cudachill-chill_env.$(OBJEXT) -am__objects_11 = cudachill-parse_expr.yy.$(OBJEXT) \ - cudachill-parse_expr.tab.$(OBJEXT) -am__objects_12 = cudachill-chill_run.$(OBJEXT) \ - cudachill-chill_run_util.$(OBJEXT) \ - cudachill-chillmodule.$(OBJEXT) -@LUA_OPT_TRUE@@PYTHON_OPT_FALSE@am__objects_13 = $(am__objects_10) \ -@LUA_OPT_TRUE@@PYTHON_OPT_FALSE@ $(am__objects_11) -@PYTHON_OPT_TRUE@am__objects_13 = $(am__objects_12) $(am__objects_11) -am__objects_14 = cudachill-mem_mapping_utils.$(OBJEXT) \ - cudachill-loop_cuda_rose.$(OBJEXT) -am__objects_15 = cudachill-ir_rose.$(OBJEXT) \ - cudachill-ir_rose_utils.$(OBJEXT) \ - cudachill-ir_cudarose.$(OBJEXT) \ - cudachill-ir_cuda_rose_utils.$(OBJEXT) -am_cudachill_OBJECTS = $(am__objects_9) $(am__objects_13) \ - $(am__objects_14) $(am__objects_15) -cudachill_OBJECTS = $(am_cudachill_OBJECTS) -cudachill_DEPENDENCIES = $(am__DEPENDENCIES_2) -cudachill_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ - $(cudachill_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -AM_V_CXX = $(am__v_CXX_@AM_V@) -am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) -am__v_CXX_0 = @echo " CXX " $@; -am__v_CXX_1 = -CXXLD = $(CXX) -CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ - -o $@ -AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) -am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) -am__v_CXXLD_0 = @echo " CXXLD " $@; -am__v_CXXLD_1 = -SOURCES = $(chill_SOURCES) $(cudachill_SOURCES) -DIST_SOURCES = $(am__chill_SOURCES_DIST) $(am__cudachill_SOURCES_DIST) -RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ - ctags-recursive dvi-recursive html-recursive info-recursive \ - install-data-recursive install-dvi-recursive \ - install-exec-recursive install-html-recursive \ - install-info-recursive install-pdf-recursive \ - install-ps-recursive install-recursive installcheck-recursive \ - installdirs-recursive pdf-recursive ps-recursive \ - tags-recursive uninstall-recursive -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -am__recursive_targets = \ - $(RECURSIVE_TARGETS) \ - $(RECURSIVE_CLEAN_TARGETS) \ - $(am__extra_recursive_targets) -AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - cscope distdir dist dist-all distcheck -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -CSCOPE = cscope -DIST_SUBDIRS = $(SUBDIRS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) -am__remove_distdir = \ - if test -d "$(distdir)"; then \ - find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -rf "$(distdir)" \ - || { sleep 5 && rm -rf "$(distdir)"; }; \ - else :; fi -am__post_remove_distdir = $(am__remove_distdir) -am__relativize = \ - dir0=`pwd`; \ - sed_first='s,^\([^/]*\)/.*$$,\1,'; \ - sed_rest='s,^[^/]*/*,,'; \ - sed_last='s,^.*/\([^/]*\)$$,\1,'; \ - sed_butlast='s,/*[^/]*$$,,'; \ - while test -n "$$dir1"; do \ - first=`echo "$$dir1" | sed -e "$$sed_first"`; \ - if test "$$first" != "."; then \ - if test "$$first" = ".."; then \ - dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ - dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ - else \ - first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ - if test "$$first2" = "$$first"; then \ - dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ - else \ - dir2="../$$dir2"; \ - fi; \ - dir0="$$dir0"/"$$first"; \ - fi; \ - fi; \ - dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ - done; \ - reldir="$$dir2" -DIST_ARCHIVES = $(distdir).tar.gz -GZIP_ENV = --best -DIST_TARGETS = dist-gzip -distuninstallcheck_listfiles = find . -type f -print -am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ - | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' -distcleancheck_listfiles = find . -type f -print -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BOOSTHOME = @BOOSTHOME@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CCLD = @CCLD@ -CFLAGS = @CFLAGS@ -CHILL_BUILD_VERSION = @CHILL_BUILD_VERSION@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EXEEXT = @EXEEXT@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -OBJEXT = @OBJEXT@ -OMEGAHOME = @OMEGAHOME@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PYTHON = @PYTHON@ -PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ -PYTHON_INCDIR = @PYTHON_INCDIR@ -PYTHON_LIBDIR = @PYTHON_LIBDIR@ -PYTHON_PLATFORM = @PYTHON_PLATFORM@ -PYTHON_PREFIX = @PYTHON_PREFIX@ -PYTHON_VERSION = @PYTHON_VERSION@ -RANLIB = @RANLIB@ -ROSEHOME = @ROSEHOME@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -YACC = @YACC@ -YFLAGS = @YFLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build_alias = @build_alias@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_coverage = @enable_coverage@ -enable_cuda = @enable_cuda@ -exec_prefix = @exec_prefix@ -host_alias = @host_alias@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -pkgpyexecdir = @pkgpyexecdir@ -pkgpythondir = @pkgpythondir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pyexecdir = @pyexecdir@ -python_builds = @python_builds@ -pythondir = @pythondir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -subdirs = @subdirs@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -SUBDIRS = omega/omega_lib/obj omega/code_gen/obj -build_date = "\"`date +%m/%d/%Y`\"" -core_libs = -lm -lrose -lrt -lutil -lomega -lcodegen -ldl \ - -lboost_date_time -lboost_filesystem -lboost_program_options \ - -lboost_regex -lboost_system -lboost_wave -lboost_iostreams -core_libdirs = -Lomega/code_gen/obj -Lomega/omega_lib/obj \ - -L$(ROSEHOME)/lib -L$(BOOSTHOME)/lib -core_includes = -Iomega/include -I$(ROSEHOME)/include/rose \ - -I$(BOOSTHOME)/include - -# Core # -core_src = dep.cc irtools.cc loop.cc loop_basic.cc loop_datacopy.cc \ - loop_extra.cc loop_tile.cc loop_unroll.cc omegatools.cc - -# chill # -# cudachill # -cudachill_src = mem_mapping_utils.cc loop_cuda_rose.cc - -# IR # -# chill -ir_chill_src = ir_rose.cc ir_rose_utils.cc - -# cudachill -ir_cudachill_src = ir_rose.cc ir_rose_utils.cc ir_cudarose.cc \ - ir_cuda_rose_utils.cc - -# runner (interface) # -# cc -chill_script_runner_src = -chill_python_runner_src = chill_run.cc chill_run_util.cc chillmodule.cc -chill_lua_runner_src = chill_run.cc chill_run_util.cc chill_env.cc -# yacc -chill_script_yacc_src = lex.yy.cc parser.tab.cc -chill_lua_yacc_src = parse_expr.yy.cc parse_expr.tab.cc -chill_python_yacc_src = parse_expr.yy.cc parse_expr.tab.cc -@LUA_OPT_FALSE@@PYTHON_OPT_FALSE@runner_libs = -@LUA_OPT_TRUE@@PYTHON_OPT_FALSE@runner_libs = -llua -lreadline -lhistory -lpthread -ldl - -# Libs/Source/Flags # -@PYTHON_OPT_TRUE@runner_libs = -lpython$(PYTHON_VERSION) -@LUA_OPT_FALSE@@PYTHON_OPT_FALSE@runner_libdirs = -@LUA_OPT_TRUE@@PYTHON_OPT_FALSE@runner_libdirs = -L$(LUAHOME)/lib -@PYTHON_OPT_TRUE@runner_libdirs = -L$(PYTHON_LIBDIR) -@LUA_OPT_FALSE@@PYTHON_OPT_FALSE@runner_includes = -@LUA_OPT_TRUE@@PYTHON_OPT_FALSE@runner_includes = -I$(LUAHOME)/include -@PYTHON_OPT_TRUE@runner_includes = -I$(PYTHON_INCDIR) -@LUA_OPT_FALSE@@PYTHON_OPT_FALSE@chill_runner_src = $(chill_script_runner_src) $(chill_script_yacc_src) -@LUA_OPT_TRUE@@PYTHON_OPT_FALSE@chill_runner_src = $(chill_lua_runner_src) $(chill_lua_yacc_src) -@PYTHON_OPT_TRUE@chill_runner_src = $(chill_python_runner_src) $(chill_python_yacc_src) -@LUA_OPT_TRUE@@PYTHON_OPT_FALSE@cudachill_runner_src = $(chill_lua_runner_src) $(chill_lua_yacc_src) -@PYTHON_OPT_TRUE@cudachill_runner_src = $(chill_python_runner_src) $(chill_python_yacc_src) -@LUA_OPT_FALSE@@PYTHON_OPT_FALSE@yacc_src = $(chill_script_yacc_src) -@LUA_OPT_TRUE@@PYTHON_OPT_FALSE@yacc_src = $(chill_lua_yacc_src) -@PYTHON_OPT_TRUE@yacc_src = $(chill_python_yacc_src) -@LUA_OPT_FALSE@@PYTHON_OPT_FALSE@runner_flags = -DCHILL_BUILD_DATE=$(build_date) \ -@LUA_OPT_FALSE@@PYTHON_OPT_FALSE@ -DCHILL_BUILD_VERSION=$(CHILL_BUILD_VERSION) -@LUA_OPT_TRUE@@PYTHON_OPT_FALSE@runner_flags = -DCHILL_BUILD_DATE=$(build_date) \ -@LUA_OPT_TRUE@@PYTHON_OPT_FALSE@ -DCHILL_BUILD_VERSION=$(CHILL_BUILD_VERSION) \ -@LUA_OPT_TRUE@@PYTHON_OPT_FALSE@ -DLUA -@PYTHON_OPT_TRUE@runner_flags = -DCHILL_BUILD_DATE=$(build_date) \ -@PYTHON_OPT_TRUE@ -DCHILL_BUILD_VERSION=$(CHILL_BUILD_VERSION) \ -@PYTHON_OPT_TRUE@ -DPYTHON - -# config -BUILT_SOURCES = $(yacc_src) -AM_YFLAGS = -d -t -common_cppflags = $(core_includes) $(runner_includes) $(runner_flags) \ - -DBUILD_ROSE -common_libs = $(core_libs) $(runner_libs) -common_libdirs = $(core_libdirs) $(runner_libdirs) -cudachill_CPPFLAGS = -DCUDACHILL $(common_cppflags) -cudachill_LDADD = $(common_libs) -cudachill_LDFLAGS = $(common_libdirs) -cudachill_SOURCES = $(core_src) $(cudachill_runner_src) $(cudachill_src) $(ir_cudachill_src) -chill_CPPFLAGS = $(common_cppflags) $(chill_runner_cppflags) -chill_LDADD = $(common_libs) -chill_LDFLAGS = $(common_libdirs) -chill_SOURCES = $(core_src) $(chill_runner_src) $(chill_src) $(ir_chill_src) -all: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) all-recursive - -.SUFFIXES: -.SUFFIXES: .cc .o .obj -am--refresh: Makefile - @: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ - $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - echo ' $(SHELL) ./config.status'; \ - $(SHELL) ./config.status;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck - -$(top_srcdir)/configure: $(am__configure_deps) - $(am__cd) $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) -$(am__aclocal_m4_deps): - -include/config.h: include/stamp-h1 - @test -f $@ || rm -f include/stamp-h1 - @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) include/stamp-h1 - -include/stamp-h1: $(top_srcdir)/include/config.h.in $(top_builddir)/config.status - @rm -f include/stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status include/config.h -$(top_srcdir)/include/config.h.in: $(am__configure_deps) - ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) - rm -f include/stamp-h1 - touch $@ - -distclean-hdr: - -rm -f include/config.h include/stamp-h1 -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ - fi; \ - for p in $$list; do echo "$$p $$p"; done | \ - sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p \ - ; then echo "$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n;h' \ - -e 's|.*|.|' \ - -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ - sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) files[d] = files[d] " " $$1; \ - else { print "f", $$3 "/" $$4, $$1; } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ - $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' \ - `; \ - test -n "$$list" || exit 0; \ - echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(bindir)" && rm -f $$files - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) - -chill$(EXEEXT): $(chill_OBJECTS) $(chill_DEPENDENCIES) $(EXTRA_chill_DEPENDENCIES) - @rm -f chill$(EXEEXT) - $(AM_V_CXXLD)$(chill_LINK) $(chill_OBJECTS) $(chill_LDADD) $(LIBS) - -cudachill$(EXEEXT): $(cudachill_OBJECTS) $(cudachill_DEPENDENCIES) $(EXTRA_cudachill_DEPENDENCIES) - @rm -f cudachill$(EXEEXT) - $(AM_V_CXXLD)$(cudachill_LINK) $(cudachill_OBJECTS) $(cudachill_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chill-chill_env.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chill-chill_run.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chill-chill_run_util.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chill-chillmodule.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chill-dep.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chill-ir_rose.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chill-ir_rose_utils.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chill-irtools.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chill-lex.yy.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chill-loop.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chill-loop_basic.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chill-loop_datacopy.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chill-loop_extra.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chill-loop_tile.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chill-loop_unroll.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chill-omegatools.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chill-parse_expr.tab.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chill-parse_expr.yy.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chill-parser.tab.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cudachill-chill_env.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cudachill-chill_run.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cudachill-chill_run_util.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cudachill-chillmodule.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cudachill-dep.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cudachill-ir_cuda_rose_utils.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cudachill-ir_cudarose.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cudachill-ir_rose.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cudachill-ir_rose_utils.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cudachill-irtools.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cudachill-loop.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cudachill-loop_basic.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cudachill-loop_cuda_rose.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cudachill-loop_datacopy.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cudachill-loop_extra.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cudachill-loop_tile.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cudachill-loop_unroll.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cudachill-mem_mapping_utils.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cudachill-omegatools.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cudachill-parse_expr.tab.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cudachill-parse_expr.yy.Po@am__quote@ - -.cc.o: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< - -.cc.obj: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -chill-dep.o: dep.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-dep.o -MD -MP -MF $(DEPDIR)/chill-dep.Tpo -c -o chill-dep.o `test -f 'dep.cc' || echo '$(srcdir)/'`dep.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-dep.Tpo $(DEPDIR)/chill-dep.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='dep.cc' object='chill-dep.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-dep.o `test -f 'dep.cc' || echo '$(srcdir)/'`dep.cc - -chill-dep.obj: dep.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-dep.obj -MD -MP -MF $(DEPDIR)/chill-dep.Tpo -c -o chill-dep.obj `if test -f 'dep.cc'; then $(CYGPATH_W) 'dep.cc'; else $(CYGPATH_W) '$(srcdir)/dep.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-dep.Tpo $(DEPDIR)/chill-dep.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='dep.cc' object='chill-dep.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-dep.obj `if test -f 'dep.cc'; then $(CYGPATH_W) 'dep.cc'; else $(CYGPATH_W) '$(srcdir)/dep.cc'; fi` - -chill-irtools.o: irtools.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-irtools.o -MD -MP -MF $(DEPDIR)/chill-irtools.Tpo -c -o chill-irtools.o `test -f 'irtools.cc' || echo '$(srcdir)/'`irtools.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-irtools.Tpo $(DEPDIR)/chill-irtools.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='irtools.cc' object='chill-irtools.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-irtools.o `test -f 'irtools.cc' || echo '$(srcdir)/'`irtools.cc - -chill-irtools.obj: irtools.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-irtools.obj -MD -MP -MF $(DEPDIR)/chill-irtools.Tpo -c -o chill-irtools.obj `if test -f 'irtools.cc'; then $(CYGPATH_W) 'irtools.cc'; else $(CYGPATH_W) '$(srcdir)/irtools.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-irtools.Tpo $(DEPDIR)/chill-irtools.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='irtools.cc' object='chill-irtools.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-irtools.obj `if test -f 'irtools.cc'; then $(CYGPATH_W) 'irtools.cc'; else $(CYGPATH_W) '$(srcdir)/irtools.cc'; fi` - -chill-loop.o: loop.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-loop.o -MD -MP -MF $(DEPDIR)/chill-loop.Tpo -c -o chill-loop.o `test -f 'loop.cc' || echo '$(srcdir)/'`loop.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-loop.Tpo $(DEPDIR)/chill-loop.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='loop.cc' object='chill-loop.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-loop.o `test -f 'loop.cc' || echo '$(srcdir)/'`loop.cc - -chill-loop.obj: loop.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-loop.obj -MD -MP -MF $(DEPDIR)/chill-loop.Tpo -c -o chill-loop.obj `if test -f 'loop.cc'; then $(CYGPATH_W) 'loop.cc'; else $(CYGPATH_W) '$(srcdir)/loop.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-loop.Tpo $(DEPDIR)/chill-loop.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='loop.cc' object='chill-loop.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-loop.obj `if test -f 'loop.cc'; then $(CYGPATH_W) 'loop.cc'; else $(CYGPATH_W) '$(srcdir)/loop.cc'; fi` - -chill-loop_basic.o: loop_basic.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-loop_basic.o -MD -MP -MF $(DEPDIR)/chill-loop_basic.Tpo -c -o chill-loop_basic.o `test -f 'loop_basic.cc' || echo '$(srcdir)/'`loop_basic.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-loop_basic.Tpo $(DEPDIR)/chill-loop_basic.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='loop_basic.cc' object='chill-loop_basic.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-loop_basic.o `test -f 'loop_basic.cc' || echo '$(srcdir)/'`loop_basic.cc - -chill-loop_basic.obj: loop_basic.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-loop_basic.obj -MD -MP -MF $(DEPDIR)/chill-loop_basic.Tpo -c -o chill-loop_basic.obj `if test -f 'loop_basic.cc'; then $(CYGPATH_W) 'loop_basic.cc'; else $(CYGPATH_W) '$(srcdir)/loop_basic.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-loop_basic.Tpo $(DEPDIR)/chill-loop_basic.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='loop_basic.cc' object='chill-loop_basic.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-loop_basic.obj `if test -f 'loop_basic.cc'; then $(CYGPATH_W) 'loop_basic.cc'; else $(CYGPATH_W) '$(srcdir)/loop_basic.cc'; fi` - -chill-loop_datacopy.o: loop_datacopy.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-loop_datacopy.o -MD -MP -MF $(DEPDIR)/chill-loop_datacopy.Tpo -c -o chill-loop_datacopy.o `test -f 'loop_datacopy.cc' || echo '$(srcdir)/'`loop_datacopy.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-loop_datacopy.Tpo $(DEPDIR)/chill-loop_datacopy.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='loop_datacopy.cc' object='chill-loop_datacopy.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-loop_datacopy.o `test -f 'loop_datacopy.cc' || echo '$(srcdir)/'`loop_datacopy.cc - -chill-loop_datacopy.obj: loop_datacopy.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-loop_datacopy.obj -MD -MP -MF $(DEPDIR)/chill-loop_datacopy.Tpo -c -o chill-loop_datacopy.obj `if test -f 'loop_datacopy.cc'; then $(CYGPATH_W) 'loop_datacopy.cc'; else $(CYGPATH_W) '$(srcdir)/loop_datacopy.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-loop_datacopy.Tpo $(DEPDIR)/chill-loop_datacopy.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='loop_datacopy.cc' object='chill-loop_datacopy.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-loop_datacopy.obj `if test -f 'loop_datacopy.cc'; then $(CYGPATH_W) 'loop_datacopy.cc'; else $(CYGPATH_W) '$(srcdir)/loop_datacopy.cc'; fi` - -chill-loop_extra.o: loop_extra.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-loop_extra.o -MD -MP -MF $(DEPDIR)/chill-loop_extra.Tpo -c -o chill-loop_extra.o `test -f 'loop_extra.cc' || echo '$(srcdir)/'`loop_extra.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-loop_extra.Tpo $(DEPDIR)/chill-loop_extra.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='loop_extra.cc' object='chill-loop_extra.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-loop_extra.o `test -f 'loop_extra.cc' || echo '$(srcdir)/'`loop_extra.cc - -chill-loop_extra.obj: loop_extra.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-loop_extra.obj -MD -MP -MF $(DEPDIR)/chill-loop_extra.Tpo -c -o chill-loop_extra.obj `if test -f 'loop_extra.cc'; then $(CYGPATH_W) 'loop_extra.cc'; else $(CYGPATH_W) '$(srcdir)/loop_extra.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-loop_extra.Tpo $(DEPDIR)/chill-loop_extra.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='loop_extra.cc' object='chill-loop_extra.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-loop_extra.obj `if test -f 'loop_extra.cc'; then $(CYGPATH_W) 'loop_extra.cc'; else $(CYGPATH_W) '$(srcdir)/loop_extra.cc'; fi` - -chill-loop_tile.o: loop_tile.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-loop_tile.o -MD -MP -MF $(DEPDIR)/chill-loop_tile.Tpo -c -o chill-loop_tile.o `test -f 'loop_tile.cc' || echo '$(srcdir)/'`loop_tile.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-loop_tile.Tpo $(DEPDIR)/chill-loop_tile.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='loop_tile.cc' object='chill-loop_tile.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-loop_tile.o `test -f 'loop_tile.cc' || echo '$(srcdir)/'`loop_tile.cc - -chill-loop_tile.obj: loop_tile.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-loop_tile.obj -MD -MP -MF $(DEPDIR)/chill-loop_tile.Tpo -c -o chill-loop_tile.obj `if test -f 'loop_tile.cc'; then $(CYGPATH_W) 'loop_tile.cc'; else $(CYGPATH_W) '$(srcdir)/loop_tile.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-loop_tile.Tpo $(DEPDIR)/chill-loop_tile.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='loop_tile.cc' object='chill-loop_tile.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-loop_tile.obj `if test -f 'loop_tile.cc'; then $(CYGPATH_W) 'loop_tile.cc'; else $(CYGPATH_W) '$(srcdir)/loop_tile.cc'; fi` - -chill-loop_unroll.o: loop_unroll.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-loop_unroll.o -MD -MP -MF $(DEPDIR)/chill-loop_unroll.Tpo -c -o chill-loop_unroll.o `test -f 'loop_unroll.cc' || echo '$(srcdir)/'`loop_unroll.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-loop_unroll.Tpo $(DEPDIR)/chill-loop_unroll.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='loop_unroll.cc' object='chill-loop_unroll.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-loop_unroll.o `test -f 'loop_unroll.cc' || echo '$(srcdir)/'`loop_unroll.cc - -chill-loop_unroll.obj: loop_unroll.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-loop_unroll.obj -MD -MP -MF $(DEPDIR)/chill-loop_unroll.Tpo -c -o chill-loop_unroll.obj `if test -f 'loop_unroll.cc'; then $(CYGPATH_W) 'loop_unroll.cc'; else $(CYGPATH_W) '$(srcdir)/loop_unroll.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-loop_unroll.Tpo $(DEPDIR)/chill-loop_unroll.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='loop_unroll.cc' object='chill-loop_unroll.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-loop_unroll.obj `if test -f 'loop_unroll.cc'; then $(CYGPATH_W) 'loop_unroll.cc'; else $(CYGPATH_W) '$(srcdir)/loop_unroll.cc'; fi` - -chill-omegatools.o: omegatools.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-omegatools.o -MD -MP -MF $(DEPDIR)/chill-omegatools.Tpo -c -o chill-omegatools.o `test -f 'omegatools.cc' || echo '$(srcdir)/'`omegatools.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-omegatools.Tpo $(DEPDIR)/chill-omegatools.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='omegatools.cc' object='chill-omegatools.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-omegatools.o `test -f 'omegatools.cc' || echo '$(srcdir)/'`omegatools.cc - -chill-omegatools.obj: omegatools.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-omegatools.obj -MD -MP -MF $(DEPDIR)/chill-omegatools.Tpo -c -o chill-omegatools.obj `if test -f 'omegatools.cc'; then $(CYGPATH_W) 'omegatools.cc'; else $(CYGPATH_W) '$(srcdir)/omegatools.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-omegatools.Tpo $(DEPDIR)/chill-omegatools.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='omegatools.cc' object='chill-omegatools.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-omegatools.obj `if test -f 'omegatools.cc'; then $(CYGPATH_W) 'omegatools.cc'; else $(CYGPATH_W) '$(srcdir)/omegatools.cc'; fi` - -chill-lex.yy.o: lex.yy.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-lex.yy.o -MD -MP -MF $(DEPDIR)/chill-lex.yy.Tpo -c -o chill-lex.yy.o `test -f 'lex.yy.cc' || echo '$(srcdir)/'`lex.yy.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-lex.yy.Tpo $(DEPDIR)/chill-lex.yy.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='lex.yy.cc' object='chill-lex.yy.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-lex.yy.o `test -f 'lex.yy.cc' || echo '$(srcdir)/'`lex.yy.cc - -chill-lex.yy.obj: lex.yy.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-lex.yy.obj -MD -MP -MF $(DEPDIR)/chill-lex.yy.Tpo -c -o chill-lex.yy.obj `if test -f 'lex.yy.cc'; then $(CYGPATH_W) 'lex.yy.cc'; else $(CYGPATH_W) '$(srcdir)/lex.yy.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-lex.yy.Tpo $(DEPDIR)/chill-lex.yy.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='lex.yy.cc' object='chill-lex.yy.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-lex.yy.obj `if test -f 'lex.yy.cc'; then $(CYGPATH_W) 'lex.yy.cc'; else $(CYGPATH_W) '$(srcdir)/lex.yy.cc'; fi` - -chill-parser.tab.o: parser.tab.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-parser.tab.o -MD -MP -MF $(DEPDIR)/chill-parser.tab.Tpo -c -o chill-parser.tab.o `test -f 'parser.tab.cc' || echo '$(srcdir)/'`parser.tab.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-parser.tab.Tpo $(DEPDIR)/chill-parser.tab.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='parser.tab.cc' object='chill-parser.tab.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-parser.tab.o `test -f 'parser.tab.cc' || echo '$(srcdir)/'`parser.tab.cc - -chill-parser.tab.obj: parser.tab.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-parser.tab.obj -MD -MP -MF $(DEPDIR)/chill-parser.tab.Tpo -c -o chill-parser.tab.obj `if test -f 'parser.tab.cc'; then $(CYGPATH_W) 'parser.tab.cc'; else $(CYGPATH_W) '$(srcdir)/parser.tab.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-parser.tab.Tpo $(DEPDIR)/chill-parser.tab.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='parser.tab.cc' object='chill-parser.tab.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-parser.tab.obj `if test -f 'parser.tab.cc'; then $(CYGPATH_W) 'parser.tab.cc'; else $(CYGPATH_W) '$(srcdir)/parser.tab.cc'; fi` - -chill-chill_run.o: chill_run.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-chill_run.o -MD -MP -MF $(DEPDIR)/chill-chill_run.Tpo -c -o chill-chill_run.o `test -f 'chill_run.cc' || echo '$(srcdir)/'`chill_run.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-chill_run.Tpo $(DEPDIR)/chill-chill_run.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='chill_run.cc' object='chill-chill_run.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-chill_run.o `test -f 'chill_run.cc' || echo '$(srcdir)/'`chill_run.cc - -chill-chill_run.obj: chill_run.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-chill_run.obj -MD -MP -MF $(DEPDIR)/chill-chill_run.Tpo -c -o chill-chill_run.obj `if test -f 'chill_run.cc'; then $(CYGPATH_W) 'chill_run.cc'; else $(CYGPATH_W) '$(srcdir)/chill_run.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-chill_run.Tpo $(DEPDIR)/chill-chill_run.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='chill_run.cc' object='chill-chill_run.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-chill_run.obj `if test -f 'chill_run.cc'; then $(CYGPATH_W) 'chill_run.cc'; else $(CYGPATH_W) '$(srcdir)/chill_run.cc'; fi` - -chill-chill_run_util.o: chill_run_util.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-chill_run_util.o -MD -MP -MF $(DEPDIR)/chill-chill_run_util.Tpo -c -o chill-chill_run_util.o `test -f 'chill_run_util.cc' || echo '$(srcdir)/'`chill_run_util.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-chill_run_util.Tpo $(DEPDIR)/chill-chill_run_util.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='chill_run_util.cc' object='chill-chill_run_util.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-chill_run_util.o `test -f 'chill_run_util.cc' || echo '$(srcdir)/'`chill_run_util.cc - -chill-chill_run_util.obj: chill_run_util.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-chill_run_util.obj -MD -MP -MF $(DEPDIR)/chill-chill_run_util.Tpo -c -o chill-chill_run_util.obj `if test -f 'chill_run_util.cc'; then $(CYGPATH_W) 'chill_run_util.cc'; else $(CYGPATH_W) '$(srcdir)/chill_run_util.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-chill_run_util.Tpo $(DEPDIR)/chill-chill_run_util.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='chill_run_util.cc' object='chill-chill_run_util.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-chill_run_util.obj `if test -f 'chill_run_util.cc'; then $(CYGPATH_W) 'chill_run_util.cc'; else $(CYGPATH_W) '$(srcdir)/chill_run_util.cc'; fi` - -chill-chill_env.o: chill_env.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-chill_env.o -MD -MP -MF $(DEPDIR)/chill-chill_env.Tpo -c -o chill-chill_env.o `test -f 'chill_env.cc' || echo '$(srcdir)/'`chill_env.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-chill_env.Tpo $(DEPDIR)/chill-chill_env.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='chill_env.cc' object='chill-chill_env.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-chill_env.o `test -f 'chill_env.cc' || echo '$(srcdir)/'`chill_env.cc - -chill-chill_env.obj: chill_env.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-chill_env.obj -MD -MP -MF $(DEPDIR)/chill-chill_env.Tpo -c -o chill-chill_env.obj `if test -f 'chill_env.cc'; then $(CYGPATH_W) 'chill_env.cc'; else $(CYGPATH_W) '$(srcdir)/chill_env.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-chill_env.Tpo $(DEPDIR)/chill-chill_env.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='chill_env.cc' object='chill-chill_env.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-chill_env.obj `if test -f 'chill_env.cc'; then $(CYGPATH_W) 'chill_env.cc'; else $(CYGPATH_W) '$(srcdir)/chill_env.cc'; fi` - -chill-parse_expr.yy.o: parse_expr.yy.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-parse_expr.yy.o -MD -MP -MF $(DEPDIR)/chill-parse_expr.yy.Tpo -c -o chill-parse_expr.yy.o `test -f 'parse_expr.yy.cc' || echo '$(srcdir)/'`parse_expr.yy.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-parse_expr.yy.Tpo $(DEPDIR)/chill-parse_expr.yy.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='parse_expr.yy.cc' object='chill-parse_expr.yy.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-parse_expr.yy.o `test -f 'parse_expr.yy.cc' || echo '$(srcdir)/'`parse_expr.yy.cc - -chill-parse_expr.yy.obj: parse_expr.yy.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-parse_expr.yy.obj -MD -MP -MF $(DEPDIR)/chill-parse_expr.yy.Tpo -c -o chill-parse_expr.yy.obj `if test -f 'parse_expr.yy.cc'; then $(CYGPATH_W) 'parse_expr.yy.cc'; else $(CYGPATH_W) '$(srcdir)/parse_expr.yy.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-parse_expr.yy.Tpo $(DEPDIR)/chill-parse_expr.yy.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='parse_expr.yy.cc' object='chill-parse_expr.yy.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-parse_expr.yy.obj `if test -f 'parse_expr.yy.cc'; then $(CYGPATH_W) 'parse_expr.yy.cc'; else $(CYGPATH_W) '$(srcdir)/parse_expr.yy.cc'; fi` - -chill-parse_expr.tab.o: parse_expr.tab.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-parse_expr.tab.o -MD -MP -MF $(DEPDIR)/chill-parse_expr.tab.Tpo -c -o chill-parse_expr.tab.o `test -f 'parse_expr.tab.cc' || echo '$(srcdir)/'`parse_expr.tab.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-parse_expr.tab.Tpo $(DEPDIR)/chill-parse_expr.tab.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='parse_expr.tab.cc' object='chill-parse_expr.tab.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-parse_expr.tab.o `test -f 'parse_expr.tab.cc' || echo '$(srcdir)/'`parse_expr.tab.cc - -chill-parse_expr.tab.obj: parse_expr.tab.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-parse_expr.tab.obj -MD -MP -MF $(DEPDIR)/chill-parse_expr.tab.Tpo -c -o chill-parse_expr.tab.obj `if test -f 'parse_expr.tab.cc'; then $(CYGPATH_W) 'parse_expr.tab.cc'; else $(CYGPATH_W) '$(srcdir)/parse_expr.tab.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-parse_expr.tab.Tpo $(DEPDIR)/chill-parse_expr.tab.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='parse_expr.tab.cc' object='chill-parse_expr.tab.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-parse_expr.tab.obj `if test -f 'parse_expr.tab.cc'; then $(CYGPATH_W) 'parse_expr.tab.cc'; else $(CYGPATH_W) '$(srcdir)/parse_expr.tab.cc'; fi` - -chill-chillmodule.o: chillmodule.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-chillmodule.o -MD -MP -MF $(DEPDIR)/chill-chillmodule.Tpo -c -o chill-chillmodule.o `test -f 'chillmodule.cc' || echo '$(srcdir)/'`chillmodule.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-chillmodule.Tpo $(DEPDIR)/chill-chillmodule.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='chillmodule.cc' object='chill-chillmodule.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-chillmodule.o `test -f 'chillmodule.cc' || echo '$(srcdir)/'`chillmodule.cc - -chill-chillmodule.obj: chillmodule.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-chillmodule.obj -MD -MP -MF $(DEPDIR)/chill-chillmodule.Tpo -c -o chill-chillmodule.obj `if test -f 'chillmodule.cc'; then $(CYGPATH_W) 'chillmodule.cc'; else $(CYGPATH_W) '$(srcdir)/chillmodule.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-chillmodule.Tpo $(DEPDIR)/chill-chillmodule.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='chillmodule.cc' object='chill-chillmodule.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-chillmodule.obj `if test -f 'chillmodule.cc'; then $(CYGPATH_W) 'chillmodule.cc'; else $(CYGPATH_W) '$(srcdir)/chillmodule.cc'; fi` - -chill-ir_rose.o: ir_rose.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-ir_rose.o -MD -MP -MF $(DEPDIR)/chill-ir_rose.Tpo -c -o chill-ir_rose.o `test -f 'ir_rose.cc' || echo '$(srcdir)/'`ir_rose.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-ir_rose.Tpo $(DEPDIR)/chill-ir_rose.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ir_rose.cc' object='chill-ir_rose.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-ir_rose.o `test -f 'ir_rose.cc' || echo '$(srcdir)/'`ir_rose.cc - -chill-ir_rose.obj: ir_rose.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-ir_rose.obj -MD -MP -MF $(DEPDIR)/chill-ir_rose.Tpo -c -o chill-ir_rose.obj `if test -f 'ir_rose.cc'; then $(CYGPATH_W) 'ir_rose.cc'; else $(CYGPATH_W) '$(srcdir)/ir_rose.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-ir_rose.Tpo $(DEPDIR)/chill-ir_rose.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ir_rose.cc' object='chill-ir_rose.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-ir_rose.obj `if test -f 'ir_rose.cc'; then $(CYGPATH_W) 'ir_rose.cc'; else $(CYGPATH_W) '$(srcdir)/ir_rose.cc'; fi` - -chill-ir_rose_utils.o: ir_rose_utils.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-ir_rose_utils.o -MD -MP -MF $(DEPDIR)/chill-ir_rose_utils.Tpo -c -o chill-ir_rose_utils.o `test -f 'ir_rose_utils.cc' || echo '$(srcdir)/'`ir_rose_utils.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-ir_rose_utils.Tpo $(DEPDIR)/chill-ir_rose_utils.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ir_rose_utils.cc' object='chill-ir_rose_utils.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-ir_rose_utils.o `test -f 'ir_rose_utils.cc' || echo '$(srcdir)/'`ir_rose_utils.cc - -chill-ir_rose_utils.obj: ir_rose_utils.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT chill-ir_rose_utils.obj -MD -MP -MF $(DEPDIR)/chill-ir_rose_utils.Tpo -c -o chill-ir_rose_utils.obj `if test -f 'ir_rose_utils.cc'; then $(CYGPATH_W) 'ir_rose_utils.cc'; else $(CYGPATH_W) '$(srcdir)/ir_rose_utils.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/chill-ir_rose_utils.Tpo $(DEPDIR)/chill-ir_rose_utils.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ir_rose_utils.cc' object='chill-ir_rose_utils.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(chill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o chill-ir_rose_utils.obj `if test -f 'ir_rose_utils.cc'; then $(CYGPATH_W) 'ir_rose_utils.cc'; else $(CYGPATH_W) '$(srcdir)/ir_rose_utils.cc'; fi` - -cudachill-dep.o: dep.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-dep.o -MD -MP -MF $(DEPDIR)/cudachill-dep.Tpo -c -o cudachill-dep.o `test -f 'dep.cc' || echo '$(srcdir)/'`dep.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-dep.Tpo $(DEPDIR)/cudachill-dep.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='dep.cc' object='cudachill-dep.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-dep.o `test -f 'dep.cc' || echo '$(srcdir)/'`dep.cc - -cudachill-dep.obj: dep.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-dep.obj -MD -MP -MF $(DEPDIR)/cudachill-dep.Tpo -c -o cudachill-dep.obj `if test -f 'dep.cc'; then $(CYGPATH_W) 'dep.cc'; else $(CYGPATH_W) '$(srcdir)/dep.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-dep.Tpo $(DEPDIR)/cudachill-dep.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='dep.cc' object='cudachill-dep.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-dep.obj `if test -f 'dep.cc'; then $(CYGPATH_W) 'dep.cc'; else $(CYGPATH_W) '$(srcdir)/dep.cc'; fi` - -cudachill-irtools.o: irtools.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-irtools.o -MD -MP -MF $(DEPDIR)/cudachill-irtools.Tpo -c -o cudachill-irtools.o `test -f 'irtools.cc' || echo '$(srcdir)/'`irtools.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-irtools.Tpo $(DEPDIR)/cudachill-irtools.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='irtools.cc' object='cudachill-irtools.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-irtools.o `test -f 'irtools.cc' || echo '$(srcdir)/'`irtools.cc - -cudachill-irtools.obj: irtools.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-irtools.obj -MD -MP -MF $(DEPDIR)/cudachill-irtools.Tpo -c -o cudachill-irtools.obj `if test -f 'irtools.cc'; then $(CYGPATH_W) 'irtools.cc'; else $(CYGPATH_W) '$(srcdir)/irtools.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-irtools.Tpo $(DEPDIR)/cudachill-irtools.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='irtools.cc' object='cudachill-irtools.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-irtools.obj `if test -f 'irtools.cc'; then $(CYGPATH_W) 'irtools.cc'; else $(CYGPATH_W) '$(srcdir)/irtools.cc'; fi` - -cudachill-loop.o: loop.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-loop.o -MD -MP -MF $(DEPDIR)/cudachill-loop.Tpo -c -o cudachill-loop.o `test -f 'loop.cc' || echo '$(srcdir)/'`loop.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-loop.Tpo $(DEPDIR)/cudachill-loop.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='loop.cc' object='cudachill-loop.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-loop.o `test -f 'loop.cc' || echo '$(srcdir)/'`loop.cc - -cudachill-loop.obj: loop.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-loop.obj -MD -MP -MF $(DEPDIR)/cudachill-loop.Tpo -c -o cudachill-loop.obj `if test -f 'loop.cc'; then $(CYGPATH_W) 'loop.cc'; else $(CYGPATH_W) '$(srcdir)/loop.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-loop.Tpo $(DEPDIR)/cudachill-loop.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='loop.cc' object='cudachill-loop.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-loop.obj `if test -f 'loop.cc'; then $(CYGPATH_W) 'loop.cc'; else $(CYGPATH_W) '$(srcdir)/loop.cc'; fi` - -cudachill-loop_basic.o: loop_basic.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-loop_basic.o -MD -MP -MF $(DEPDIR)/cudachill-loop_basic.Tpo -c -o cudachill-loop_basic.o `test -f 'loop_basic.cc' || echo '$(srcdir)/'`loop_basic.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-loop_basic.Tpo $(DEPDIR)/cudachill-loop_basic.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='loop_basic.cc' object='cudachill-loop_basic.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-loop_basic.o `test -f 'loop_basic.cc' || echo '$(srcdir)/'`loop_basic.cc - -cudachill-loop_basic.obj: loop_basic.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-loop_basic.obj -MD -MP -MF $(DEPDIR)/cudachill-loop_basic.Tpo -c -o cudachill-loop_basic.obj `if test -f 'loop_basic.cc'; then $(CYGPATH_W) 'loop_basic.cc'; else $(CYGPATH_W) '$(srcdir)/loop_basic.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-loop_basic.Tpo $(DEPDIR)/cudachill-loop_basic.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='loop_basic.cc' object='cudachill-loop_basic.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-loop_basic.obj `if test -f 'loop_basic.cc'; then $(CYGPATH_W) 'loop_basic.cc'; else $(CYGPATH_W) '$(srcdir)/loop_basic.cc'; fi` - -cudachill-loop_datacopy.o: loop_datacopy.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-loop_datacopy.o -MD -MP -MF $(DEPDIR)/cudachill-loop_datacopy.Tpo -c -o cudachill-loop_datacopy.o `test -f 'loop_datacopy.cc' || echo '$(srcdir)/'`loop_datacopy.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-loop_datacopy.Tpo $(DEPDIR)/cudachill-loop_datacopy.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='loop_datacopy.cc' object='cudachill-loop_datacopy.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-loop_datacopy.o `test -f 'loop_datacopy.cc' || echo '$(srcdir)/'`loop_datacopy.cc - -cudachill-loop_datacopy.obj: loop_datacopy.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-loop_datacopy.obj -MD -MP -MF $(DEPDIR)/cudachill-loop_datacopy.Tpo -c -o cudachill-loop_datacopy.obj `if test -f 'loop_datacopy.cc'; then $(CYGPATH_W) 'loop_datacopy.cc'; else $(CYGPATH_W) '$(srcdir)/loop_datacopy.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-loop_datacopy.Tpo $(DEPDIR)/cudachill-loop_datacopy.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='loop_datacopy.cc' object='cudachill-loop_datacopy.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-loop_datacopy.obj `if test -f 'loop_datacopy.cc'; then $(CYGPATH_W) 'loop_datacopy.cc'; else $(CYGPATH_W) '$(srcdir)/loop_datacopy.cc'; fi` - -cudachill-loop_extra.o: loop_extra.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-loop_extra.o -MD -MP -MF $(DEPDIR)/cudachill-loop_extra.Tpo -c -o cudachill-loop_extra.o `test -f 'loop_extra.cc' || echo '$(srcdir)/'`loop_extra.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-loop_extra.Tpo $(DEPDIR)/cudachill-loop_extra.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='loop_extra.cc' object='cudachill-loop_extra.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-loop_extra.o `test -f 'loop_extra.cc' || echo '$(srcdir)/'`loop_extra.cc - -cudachill-loop_extra.obj: loop_extra.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-loop_extra.obj -MD -MP -MF $(DEPDIR)/cudachill-loop_extra.Tpo -c -o cudachill-loop_extra.obj `if test -f 'loop_extra.cc'; then $(CYGPATH_W) 'loop_extra.cc'; else $(CYGPATH_W) '$(srcdir)/loop_extra.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-loop_extra.Tpo $(DEPDIR)/cudachill-loop_extra.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='loop_extra.cc' object='cudachill-loop_extra.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-loop_extra.obj `if test -f 'loop_extra.cc'; then $(CYGPATH_W) 'loop_extra.cc'; else $(CYGPATH_W) '$(srcdir)/loop_extra.cc'; fi` - -cudachill-loop_tile.o: loop_tile.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-loop_tile.o -MD -MP -MF $(DEPDIR)/cudachill-loop_tile.Tpo -c -o cudachill-loop_tile.o `test -f 'loop_tile.cc' || echo '$(srcdir)/'`loop_tile.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-loop_tile.Tpo $(DEPDIR)/cudachill-loop_tile.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='loop_tile.cc' object='cudachill-loop_tile.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-loop_tile.o `test -f 'loop_tile.cc' || echo '$(srcdir)/'`loop_tile.cc - -cudachill-loop_tile.obj: loop_tile.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-loop_tile.obj -MD -MP -MF $(DEPDIR)/cudachill-loop_tile.Tpo -c -o cudachill-loop_tile.obj `if test -f 'loop_tile.cc'; then $(CYGPATH_W) 'loop_tile.cc'; else $(CYGPATH_W) '$(srcdir)/loop_tile.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-loop_tile.Tpo $(DEPDIR)/cudachill-loop_tile.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='loop_tile.cc' object='cudachill-loop_tile.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-loop_tile.obj `if test -f 'loop_tile.cc'; then $(CYGPATH_W) 'loop_tile.cc'; else $(CYGPATH_W) '$(srcdir)/loop_tile.cc'; fi` - -cudachill-loop_unroll.o: loop_unroll.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-loop_unroll.o -MD -MP -MF $(DEPDIR)/cudachill-loop_unroll.Tpo -c -o cudachill-loop_unroll.o `test -f 'loop_unroll.cc' || echo '$(srcdir)/'`loop_unroll.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-loop_unroll.Tpo $(DEPDIR)/cudachill-loop_unroll.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='loop_unroll.cc' object='cudachill-loop_unroll.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-loop_unroll.o `test -f 'loop_unroll.cc' || echo '$(srcdir)/'`loop_unroll.cc - -cudachill-loop_unroll.obj: loop_unroll.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-loop_unroll.obj -MD -MP -MF $(DEPDIR)/cudachill-loop_unroll.Tpo -c -o cudachill-loop_unroll.obj `if test -f 'loop_unroll.cc'; then $(CYGPATH_W) 'loop_unroll.cc'; else $(CYGPATH_W) '$(srcdir)/loop_unroll.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-loop_unroll.Tpo $(DEPDIR)/cudachill-loop_unroll.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='loop_unroll.cc' object='cudachill-loop_unroll.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-loop_unroll.obj `if test -f 'loop_unroll.cc'; then $(CYGPATH_W) 'loop_unroll.cc'; else $(CYGPATH_W) '$(srcdir)/loop_unroll.cc'; fi` - -cudachill-omegatools.o: omegatools.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-omegatools.o -MD -MP -MF $(DEPDIR)/cudachill-omegatools.Tpo -c -o cudachill-omegatools.o `test -f 'omegatools.cc' || echo '$(srcdir)/'`omegatools.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-omegatools.Tpo $(DEPDIR)/cudachill-omegatools.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='omegatools.cc' object='cudachill-omegatools.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-omegatools.o `test -f 'omegatools.cc' || echo '$(srcdir)/'`omegatools.cc - -cudachill-omegatools.obj: omegatools.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-omegatools.obj -MD -MP -MF $(DEPDIR)/cudachill-omegatools.Tpo -c -o cudachill-omegatools.obj `if test -f 'omegatools.cc'; then $(CYGPATH_W) 'omegatools.cc'; else $(CYGPATH_W) '$(srcdir)/omegatools.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-omegatools.Tpo $(DEPDIR)/cudachill-omegatools.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='omegatools.cc' object='cudachill-omegatools.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-omegatools.obj `if test -f 'omegatools.cc'; then $(CYGPATH_W) 'omegatools.cc'; else $(CYGPATH_W) '$(srcdir)/omegatools.cc'; fi` - -cudachill-chill_run.o: chill_run.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-chill_run.o -MD -MP -MF $(DEPDIR)/cudachill-chill_run.Tpo -c -o cudachill-chill_run.o `test -f 'chill_run.cc' || echo '$(srcdir)/'`chill_run.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-chill_run.Tpo $(DEPDIR)/cudachill-chill_run.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='chill_run.cc' object='cudachill-chill_run.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-chill_run.o `test -f 'chill_run.cc' || echo '$(srcdir)/'`chill_run.cc - -cudachill-chill_run.obj: chill_run.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-chill_run.obj -MD -MP -MF $(DEPDIR)/cudachill-chill_run.Tpo -c -o cudachill-chill_run.obj `if test -f 'chill_run.cc'; then $(CYGPATH_W) 'chill_run.cc'; else $(CYGPATH_W) '$(srcdir)/chill_run.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-chill_run.Tpo $(DEPDIR)/cudachill-chill_run.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='chill_run.cc' object='cudachill-chill_run.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-chill_run.obj `if test -f 'chill_run.cc'; then $(CYGPATH_W) 'chill_run.cc'; else $(CYGPATH_W) '$(srcdir)/chill_run.cc'; fi` - -cudachill-chill_run_util.o: chill_run_util.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-chill_run_util.o -MD -MP -MF $(DEPDIR)/cudachill-chill_run_util.Tpo -c -o cudachill-chill_run_util.o `test -f 'chill_run_util.cc' || echo '$(srcdir)/'`chill_run_util.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-chill_run_util.Tpo $(DEPDIR)/cudachill-chill_run_util.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='chill_run_util.cc' object='cudachill-chill_run_util.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-chill_run_util.o `test -f 'chill_run_util.cc' || echo '$(srcdir)/'`chill_run_util.cc - -cudachill-chill_run_util.obj: chill_run_util.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-chill_run_util.obj -MD -MP -MF $(DEPDIR)/cudachill-chill_run_util.Tpo -c -o cudachill-chill_run_util.obj `if test -f 'chill_run_util.cc'; then $(CYGPATH_W) 'chill_run_util.cc'; else $(CYGPATH_W) '$(srcdir)/chill_run_util.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-chill_run_util.Tpo $(DEPDIR)/cudachill-chill_run_util.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='chill_run_util.cc' object='cudachill-chill_run_util.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-chill_run_util.obj `if test -f 'chill_run_util.cc'; then $(CYGPATH_W) 'chill_run_util.cc'; else $(CYGPATH_W) '$(srcdir)/chill_run_util.cc'; fi` - -cudachill-chill_env.o: chill_env.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-chill_env.o -MD -MP -MF $(DEPDIR)/cudachill-chill_env.Tpo -c -o cudachill-chill_env.o `test -f 'chill_env.cc' || echo '$(srcdir)/'`chill_env.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-chill_env.Tpo $(DEPDIR)/cudachill-chill_env.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='chill_env.cc' object='cudachill-chill_env.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-chill_env.o `test -f 'chill_env.cc' || echo '$(srcdir)/'`chill_env.cc - -cudachill-chill_env.obj: chill_env.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-chill_env.obj -MD -MP -MF $(DEPDIR)/cudachill-chill_env.Tpo -c -o cudachill-chill_env.obj `if test -f 'chill_env.cc'; then $(CYGPATH_W) 'chill_env.cc'; else $(CYGPATH_W) '$(srcdir)/chill_env.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-chill_env.Tpo $(DEPDIR)/cudachill-chill_env.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='chill_env.cc' object='cudachill-chill_env.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-chill_env.obj `if test -f 'chill_env.cc'; then $(CYGPATH_W) 'chill_env.cc'; else $(CYGPATH_W) '$(srcdir)/chill_env.cc'; fi` - -cudachill-parse_expr.yy.o: parse_expr.yy.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-parse_expr.yy.o -MD -MP -MF $(DEPDIR)/cudachill-parse_expr.yy.Tpo -c -o cudachill-parse_expr.yy.o `test -f 'parse_expr.yy.cc' || echo '$(srcdir)/'`parse_expr.yy.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-parse_expr.yy.Tpo $(DEPDIR)/cudachill-parse_expr.yy.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='parse_expr.yy.cc' object='cudachill-parse_expr.yy.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-parse_expr.yy.o `test -f 'parse_expr.yy.cc' || echo '$(srcdir)/'`parse_expr.yy.cc - -cudachill-parse_expr.yy.obj: parse_expr.yy.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-parse_expr.yy.obj -MD -MP -MF $(DEPDIR)/cudachill-parse_expr.yy.Tpo -c -o cudachill-parse_expr.yy.obj `if test -f 'parse_expr.yy.cc'; then $(CYGPATH_W) 'parse_expr.yy.cc'; else $(CYGPATH_W) '$(srcdir)/parse_expr.yy.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-parse_expr.yy.Tpo $(DEPDIR)/cudachill-parse_expr.yy.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='parse_expr.yy.cc' object='cudachill-parse_expr.yy.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-parse_expr.yy.obj `if test -f 'parse_expr.yy.cc'; then $(CYGPATH_W) 'parse_expr.yy.cc'; else $(CYGPATH_W) '$(srcdir)/parse_expr.yy.cc'; fi` - -cudachill-parse_expr.tab.o: parse_expr.tab.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-parse_expr.tab.o -MD -MP -MF $(DEPDIR)/cudachill-parse_expr.tab.Tpo -c -o cudachill-parse_expr.tab.o `test -f 'parse_expr.tab.cc' || echo '$(srcdir)/'`parse_expr.tab.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-parse_expr.tab.Tpo $(DEPDIR)/cudachill-parse_expr.tab.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='parse_expr.tab.cc' object='cudachill-parse_expr.tab.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-parse_expr.tab.o `test -f 'parse_expr.tab.cc' || echo '$(srcdir)/'`parse_expr.tab.cc - -cudachill-parse_expr.tab.obj: parse_expr.tab.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-parse_expr.tab.obj -MD -MP -MF $(DEPDIR)/cudachill-parse_expr.tab.Tpo -c -o cudachill-parse_expr.tab.obj `if test -f 'parse_expr.tab.cc'; then $(CYGPATH_W) 'parse_expr.tab.cc'; else $(CYGPATH_W) '$(srcdir)/parse_expr.tab.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-parse_expr.tab.Tpo $(DEPDIR)/cudachill-parse_expr.tab.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='parse_expr.tab.cc' object='cudachill-parse_expr.tab.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-parse_expr.tab.obj `if test -f 'parse_expr.tab.cc'; then $(CYGPATH_W) 'parse_expr.tab.cc'; else $(CYGPATH_W) '$(srcdir)/parse_expr.tab.cc'; fi` - -cudachill-chillmodule.o: chillmodule.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-chillmodule.o -MD -MP -MF $(DEPDIR)/cudachill-chillmodule.Tpo -c -o cudachill-chillmodule.o `test -f 'chillmodule.cc' || echo '$(srcdir)/'`chillmodule.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-chillmodule.Tpo $(DEPDIR)/cudachill-chillmodule.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='chillmodule.cc' object='cudachill-chillmodule.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-chillmodule.o `test -f 'chillmodule.cc' || echo '$(srcdir)/'`chillmodule.cc - -cudachill-chillmodule.obj: chillmodule.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-chillmodule.obj -MD -MP -MF $(DEPDIR)/cudachill-chillmodule.Tpo -c -o cudachill-chillmodule.obj `if test -f 'chillmodule.cc'; then $(CYGPATH_W) 'chillmodule.cc'; else $(CYGPATH_W) '$(srcdir)/chillmodule.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-chillmodule.Tpo $(DEPDIR)/cudachill-chillmodule.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='chillmodule.cc' object='cudachill-chillmodule.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-chillmodule.obj `if test -f 'chillmodule.cc'; then $(CYGPATH_W) 'chillmodule.cc'; else $(CYGPATH_W) '$(srcdir)/chillmodule.cc'; fi` - -cudachill-mem_mapping_utils.o: mem_mapping_utils.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-mem_mapping_utils.o -MD -MP -MF $(DEPDIR)/cudachill-mem_mapping_utils.Tpo -c -o cudachill-mem_mapping_utils.o `test -f 'mem_mapping_utils.cc' || echo '$(srcdir)/'`mem_mapping_utils.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-mem_mapping_utils.Tpo $(DEPDIR)/cudachill-mem_mapping_utils.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='mem_mapping_utils.cc' object='cudachill-mem_mapping_utils.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-mem_mapping_utils.o `test -f 'mem_mapping_utils.cc' || echo '$(srcdir)/'`mem_mapping_utils.cc - -cudachill-mem_mapping_utils.obj: mem_mapping_utils.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-mem_mapping_utils.obj -MD -MP -MF $(DEPDIR)/cudachill-mem_mapping_utils.Tpo -c -o cudachill-mem_mapping_utils.obj `if test -f 'mem_mapping_utils.cc'; then $(CYGPATH_W) 'mem_mapping_utils.cc'; else $(CYGPATH_W) '$(srcdir)/mem_mapping_utils.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-mem_mapping_utils.Tpo $(DEPDIR)/cudachill-mem_mapping_utils.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='mem_mapping_utils.cc' object='cudachill-mem_mapping_utils.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-mem_mapping_utils.obj `if test -f 'mem_mapping_utils.cc'; then $(CYGPATH_W) 'mem_mapping_utils.cc'; else $(CYGPATH_W) '$(srcdir)/mem_mapping_utils.cc'; fi` - -cudachill-loop_cuda_rose.o: loop_cuda_rose.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-loop_cuda_rose.o -MD -MP -MF $(DEPDIR)/cudachill-loop_cuda_rose.Tpo -c -o cudachill-loop_cuda_rose.o `test -f 'loop_cuda_rose.cc' || echo '$(srcdir)/'`loop_cuda_rose.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-loop_cuda_rose.Tpo $(DEPDIR)/cudachill-loop_cuda_rose.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='loop_cuda_rose.cc' object='cudachill-loop_cuda_rose.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-loop_cuda_rose.o `test -f 'loop_cuda_rose.cc' || echo '$(srcdir)/'`loop_cuda_rose.cc - -cudachill-loop_cuda_rose.obj: loop_cuda_rose.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-loop_cuda_rose.obj -MD -MP -MF $(DEPDIR)/cudachill-loop_cuda_rose.Tpo -c -o cudachill-loop_cuda_rose.obj `if test -f 'loop_cuda_rose.cc'; then $(CYGPATH_W) 'loop_cuda_rose.cc'; else $(CYGPATH_W) '$(srcdir)/loop_cuda_rose.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-loop_cuda_rose.Tpo $(DEPDIR)/cudachill-loop_cuda_rose.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='loop_cuda_rose.cc' object='cudachill-loop_cuda_rose.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-loop_cuda_rose.obj `if test -f 'loop_cuda_rose.cc'; then $(CYGPATH_W) 'loop_cuda_rose.cc'; else $(CYGPATH_W) '$(srcdir)/loop_cuda_rose.cc'; fi` - -cudachill-ir_rose.o: ir_rose.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-ir_rose.o -MD -MP -MF $(DEPDIR)/cudachill-ir_rose.Tpo -c -o cudachill-ir_rose.o `test -f 'ir_rose.cc' || echo '$(srcdir)/'`ir_rose.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-ir_rose.Tpo $(DEPDIR)/cudachill-ir_rose.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ir_rose.cc' object='cudachill-ir_rose.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-ir_rose.o `test -f 'ir_rose.cc' || echo '$(srcdir)/'`ir_rose.cc - -cudachill-ir_rose.obj: ir_rose.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-ir_rose.obj -MD -MP -MF $(DEPDIR)/cudachill-ir_rose.Tpo -c -o cudachill-ir_rose.obj `if test -f 'ir_rose.cc'; then $(CYGPATH_W) 'ir_rose.cc'; else $(CYGPATH_W) '$(srcdir)/ir_rose.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-ir_rose.Tpo $(DEPDIR)/cudachill-ir_rose.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ir_rose.cc' object='cudachill-ir_rose.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-ir_rose.obj `if test -f 'ir_rose.cc'; then $(CYGPATH_W) 'ir_rose.cc'; else $(CYGPATH_W) '$(srcdir)/ir_rose.cc'; fi` - -cudachill-ir_rose_utils.o: ir_rose_utils.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-ir_rose_utils.o -MD -MP -MF $(DEPDIR)/cudachill-ir_rose_utils.Tpo -c -o cudachill-ir_rose_utils.o `test -f 'ir_rose_utils.cc' || echo '$(srcdir)/'`ir_rose_utils.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-ir_rose_utils.Tpo $(DEPDIR)/cudachill-ir_rose_utils.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ir_rose_utils.cc' object='cudachill-ir_rose_utils.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-ir_rose_utils.o `test -f 'ir_rose_utils.cc' || echo '$(srcdir)/'`ir_rose_utils.cc - -cudachill-ir_rose_utils.obj: ir_rose_utils.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-ir_rose_utils.obj -MD -MP -MF $(DEPDIR)/cudachill-ir_rose_utils.Tpo -c -o cudachill-ir_rose_utils.obj `if test -f 'ir_rose_utils.cc'; then $(CYGPATH_W) 'ir_rose_utils.cc'; else $(CYGPATH_W) '$(srcdir)/ir_rose_utils.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-ir_rose_utils.Tpo $(DEPDIR)/cudachill-ir_rose_utils.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ir_rose_utils.cc' object='cudachill-ir_rose_utils.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-ir_rose_utils.obj `if test -f 'ir_rose_utils.cc'; then $(CYGPATH_W) 'ir_rose_utils.cc'; else $(CYGPATH_W) '$(srcdir)/ir_rose_utils.cc'; fi` - -cudachill-ir_cudarose.o: ir_cudarose.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-ir_cudarose.o -MD -MP -MF $(DEPDIR)/cudachill-ir_cudarose.Tpo -c -o cudachill-ir_cudarose.o `test -f 'ir_cudarose.cc' || echo '$(srcdir)/'`ir_cudarose.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-ir_cudarose.Tpo $(DEPDIR)/cudachill-ir_cudarose.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ir_cudarose.cc' object='cudachill-ir_cudarose.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-ir_cudarose.o `test -f 'ir_cudarose.cc' || echo '$(srcdir)/'`ir_cudarose.cc - -cudachill-ir_cudarose.obj: ir_cudarose.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-ir_cudarose.obj -MD -MP -MF $(DEPDIR)/cudachill-ir_cudarose.Tpo -c -o cudachill-ir_cudarose.obj `if test -f 'ir_cudarose.cc'; then $(CYGPATH_W) 'ir_cudarose.cc'; else $(CYGPATH_W) '$(srcdir)/ir_cudarose.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-ir_cudarose.Tpo $(DEPDIR)/cudachill-ir_cudarose.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ir_cudarose.cc' object='cudachill-ir_cudarose.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-ir_cudarose.obj `if test -f 'ir_cudarose.cc'; then $(CYGPATH_W) 'ir_cudarose.cc'; else $(CYGPATH_W) '$(srcdir)/ir_cudarose.cc'; fi` - -cudachill-ir_cuda_rose_utils.o: ir_cuda_rose_utils.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-ir_cuda_rose_utils.o -MD -MP -MF $(DEPDIR)/cudachill-ir_cuda_rose_utils.Tpo -c -o cudachill-ir_cuda_rose_utils.o `test -f 'ir_cuda_rose_utils.cc' || echo '$(srcdir)/'`ir_cuda_rose_utils.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-ir_cuda_rose_utils.Tpo $(DEPDIR)/cudachill-ir_cuda_rose_utils.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ir_cuda_rose_utils.cc' object='cudachill-ir_cuda_rose_utils.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-ir_cuda_rose_utils.o `test -f 'ir_cuda_rose_utils.cc' || echo '$(srcdir)/'`ir_cuda_rose_utils.cc - -cudachill-ir_cuda_rose_utils.obj: ir_cuda_rose_utils.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cudachill-ir_cuda_rose_utils.obj -MD -MP -MF $(DEPDIR)/cudachill-ir_cuda_rose_utils.Tpo -c -o cudachill-ir_cuda_rose_utils.obj `if test -f 'ir_cuda_rose_utils.cc'; then $(CYGPATH_W) 'ir_cuda_rose_utils.cc'; else $(CYGPATH_W) '$(srcdir)/ir_cuda_rose_utils.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cudachill-ir_cuda_rose_utils.Tpo $(DEPDIR)/cudachill-ir_cuda_rose_utils.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ir_cuda_rose_utils.cc' object='cudachill-ir_cuda_rose_utils.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cudachill_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cudachill-ir_cuda_rose_utils.obj `if test -f 'ir_cuda_rose_utils.cc'; then $(CYGPATH_W) 'ir_cuda_rose_utils.cc'; else $(CYGPATH_W) '$(srcdir)/ir_cuda_rose_utils.cc'; fi` - -# This directory's subdirectories are mostly independent; you can cd -# into them and run 'make' without going through this Makefile. -# To change the values of 'make' variables: instead of editing Makefiles, -# (1) if the variable is set in 'config.status', edit 'config.status' -# (which will cause the Makefiles to be regenerated when you run 'make'); -# (2) otherwise, pass the desired values on the 'make' command line. -$(am__recursive_targets): - @fail=; \ - if $(am__make_keepgoing); then \ - failcom='fail=yes'; \ - else \ - failcom='exit 1'; \ - fi; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-recursive -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-recursive - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscope: cscope.files - test ! -s cscope.files \ - || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) -clean-cscope: - -rm -f cscope.files -cscope.files: clean-cscope cscopelist -cscopelist: cscopelist-recursive - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -rm -f cscope.out cscope.in.out cscope.po.out cscope.files - -distdir: $(DISTFILES) - $(am__remove_distdir) - test -d "$(distdir)" || mkdir "$(distdir)" - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - $(am__make_dryrun) \ - || test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ - $(am__relativize); \ - new_distdir=$$reldir; \ - dir1=$$subdir; dir2="$(top_distdir)"; \ - $(am__relativize); \ - new_top_distdir=$$reldir; \ - echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ - echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ - ($(am__cd) $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$new_top_distdir" \ - distdir="$$new_distdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - am__skip_mode_fix=: \ - distdir) \ - || exit 1; \ - fi; \ - done - -test -n "$(am__skip_mode_fix)" \ - || find "$(distdir)" -type d ! -perm -755 \ - -exec chmod u+rwx,go+rx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r "$(distdir)" -dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__post_remove_distdir) - -dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 - $(am__post_remove_distdir) - -dist-lzip: distdir - tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz - $(am__post_remove_distdir) - -dist-xz: distdir - tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz - $(am__post_remove_distdir) - -dist-tarZ: distdir - @echo WARNING: "Support for shar distribution archives is" \ - "deprecated." >&2 - @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__post_remove_distdir) - -dist-shar: distdir - @echo WARNING: "Support for distribution archives compressed with" \ - "legacy program 'compress' is deprecated." >&2 - @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__post_remove_distdir) - -dist-zip: distdir - -rm -f $(distdir).zip - zip -rq $(distdir).zip $(distdir) - $(am__post_remove_distdir) - -dist dist-all: - $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' - $(am__post_remove_distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - case '$(DIST_ARCHIVES)' in \ - *.tar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ - *.tar.bz2*) \ - bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.lz*) \ - lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ - *.tar.xz*) \ - xz -dc $(distdir).tar.xz | $(am__untar) ;;\ - *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ - *.shar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ - *.zip*) \ - unzip $(distdir).zip ;;\ - esac - chmod -R a-w $(distdir) - chmod u+w $(distdir) - mkdir $(distdir)/_build $(distdir)/_inst - chmod a-w $(distdir) - test -d $(distdir)/_build || exit 0; \ - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ - && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && am__cwd=`pwd` \ - && $(am__cd) $(distdir)/_build \ - && ../configure \ - $(AM_DISTCHECK_CONFIGURE_FLAGS) \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - --srcdir=.. --prefix="$$dc_install_base" \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ - distuninstallcheck \ - && chmod -R a-w "$$dc_install_base" \ - && ({ \ - (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ - distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ - } || { rm -rf "$$dc_destdir"; exit 1; }) \ - && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ - && cd "$$am__cwd" \ - || exit 1 - $(am__post_remove_distdir) - @(echo "$(distdir) archives ready for distribution: "; \ - list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' -distuninstallcheck: - @test -n '$(distuninstallcheck_dir)' || { \ - echo 'ERROR: trying to run $@ with an empty' \ - '$$(distuninstallcheck_dir)' >&2; \ - exit 1; \ - }; \ - $(am__cd) '$(distuninstallcheck_dir)' || { \ - echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ - exit 1; \ - }; \ - test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left after uninstall:" ; \ - if test -n "$(DESTDIR)"; then \ - echo " (check DESTDIR support)"; \ - fi ; \ - $(distuninstallcheck_listfiles) ; \ - exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 -check-am: all-am -check: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) check-recursive -all-am: Makefile $(PROGRAMS) -installdirs: installdirs-recursive -installdirs-am: - for dir in "$(DESTDIR)$(bindir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -clean: clean-recursive - -clean-am: clean-binPROGRAMS clean-generic mostlyclean-am - -distclean: distclean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-hdr distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -html-am: - -info: info-recursive - -info-am: - -install-data-am: - -install-dvi: install-dvi-recursive - -install-dvi-am: - -install-exec-am: install-binPROGRAMS - -install-html: install-html-recursive - -install-html-am: - -install-info: install-info-recursive - -install-info-am: - -install-man: - -install-pdf: install-pdf-recursive - -install-pdf-am: - -install-ps: install-ps-recursive - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf $(top_srcdir)/autom4te.cache - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-binPROGRAMS - -.MAKE: $(am__recursive_targets) all check install install-am \ - install-strip - -.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ - am--refresh check check-am clean clean-binPROGRAMS \ - clean-cscope clean-generic cscope cscopelist-am ctags ctags-am \ - dist dist-all dist-bzip2 dist-gzip dist-lzip dist-shar \ - dist-tarZ dist-xz dist-zip distcheck distclean \ - distclean-compile distclean-generic distclean-hdr \ - distclean-tags distcleancheck distdir distuninstallcheck dvi \ - dvi-am html html-am info info-am install install-am \ - install-binPROGRAMS install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - installdirs-am maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ - ps ps-am tags tags-am uninstall uninstall-am \ - uninstall-binPROGRAMS - - -# rules -lex.yy.cc: parser.ll parser.tab.cc - flex++ parser.ll - -parser.tab.cc: parser.yy - bison -t -d $< - -parse_expr.yy.cc: parse_expr.tab.cc parse_expr.ll - flex -o parse_expr.yy.cc parse_expr.ll - -parse_expr.tab.cc: parse_expr.yy - bison -t -d parse_expr.yy - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/README b/README deleted file mode 100644 index 8a3db5b..0000000 --- a/README +++ /dev/null @@ -1 +0,0 @@ -Please see user manual CHiLL.pdf for installation instructions. diff --git a/README.md b/README.md new file mode 100644 index 0000000..547f161 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# Build + +`cmake -DROSEHOME=$INSROOT -DBOOSTHOME=$INSROOT -H. -Bbuild` +`cmake --build build -- -j10` + diff --git a/aclocal.m4 b/aclocal.m4 deleted file mode 100644 index 6acbc5f..0000000 --- a/aclocal.m4 +++ /dev/null @@ -1,1402 +0,0 @@ -# generated automatically by aclocal 1.14.1 -*- Autoconf -*- - -# Copyright (C) 1996-2013 Free Software Foundation, Inc. - -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, -[m4_warning([this file was generated for autoconf 2.69. -You have another version of autoconf. It may work, but is not guaranteed to. -If you have problems, you may need to regenerate the build system entirely. -To do so, use the procedure documented by the package, typically 'autoreconf'.])]) - -# Copyright (C) 2002-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_AUTOMAKE_VERSION(VERSION) -# ---------------------------- -# Automake X.Y traces this macro to ensure aclocal.m4 has been -# generated from the m4 files accompanying Automake X.Y. -# (This private macro should not be called outside this file.) -AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.14' -dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to -dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.14.1], [], - [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl -]) - -# _AM_AUTOCONF_VERSION(VERSION) -# ----------------------------- -# aclocal traces this macro to find the Autoconf version. -# This is a private macro too. Using m4_define simplifies -# the logic in aclocal, which can simply ignore this definition. -m4_define([_AM_AUTOCONF_VERSION], []) - -# AM_SET_CURRENT_AUTOMAKE_VERSION -# ------------------------------- -# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. -# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. -AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.14.1])dnl -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) - -# AM_AUX_DIR_EXPAND -*- Autoconf -*- - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to -# '$srcdir', '$srcdir/..', or '$srcdir/../..'. -# -# Of course, Automake must honor this variable whenever it calls a -# tool from the auxiliary directory. The problem is that $srcdir (and -# therefore $ac_aux_dir as well) can be either absolute or relative, -# depending on how configure is run. This is pretty annoying, since -# it makes $ac_aux_dir quite unusable in subdirectories: in the top -# source directory, any form will work fine, but in subdirectories a -# relative path needs to be adjusted first. -# -# $ac_aux_dir/missing -# fails when called from a subdirectory if $ac_aux_dir is relative -# $top_srcdir/$ac_aux_dir/missing -# fails if $ac_aux_dir is absolute, -# fails when called from a subdirectory in a VPATH build with -# a relative $ac_aux_dir -# -# The reason of the latter failure is that $top_srcdir and $ac_aux_dir -# are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is '.', but things will broke when you -# start a VPATH build or use an absolute $srcdir. -# -# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, -# iff we strip the leading $srcdir from $ac_aux_dir. That would be: -# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` -# and then we would define $MISSING as -# MISSING="\${SHELL} $am_aux_dir/missing" -# This will work as long as MISSING is not called from configure, because -# unfortunately $(top_srcdir) has no meaning in configure. -# However there are other variables, like CC, which are often used in -# configure, and could therefore not use this "fixed" $ac_aux_dir. -# -# Another solution, used here, is to always expand $ac_aux_dir to an -# absolute PATH. The drawback is that using absolute paths prevent a -# configured tree to be moved without reconfiguration. - -AC_DEFUN([AM_AUX_DIR_EXPAND], -[dnl Rely on autoconf to set up CDPATH properly. -AC_PREREQ([2.50])dnl -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` -]) - -# AM_CONDITIONAL -*- Autoconf -*- - -# Copyright (C) 1997-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_CONDITIONAL(NAME, SHELL-CONDITION) -# ------------------------------------- -# Define a conditional. -AC_DEFUN([AM_CONDITIONAL], -[AC_PREREQ([2.52])dnl - m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl -AC_SUBST([$1_TRUE])dnl -AC_SUBST([$1_FALSE])dnl -_AM_SUBST_NOTMAKE([$1_TRUE])dnl -_AM_SUBST_NOTMAKE([$1_FALSE])dnl -m4_define([_AM_COND_VALUE_$1], [$2])dnl -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi -AC_CONFIG_COMMANDS_PRE( -[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then - AC_MSG_ERROR([[conditional "$1" was never defined. -Usually this means the macro was only invoked conditionally.]]) -fi])]) - -# Copyright (C) 1999-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - - -# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be -# written in clear, in which case automake, when reading aclocal.m4, -# will think it sees a *use*, and therefore will trigger all it's -# C support machinery. Also note that it means that autoscan, seeing -# CC etc. in the Makefile, will ask for an AC_PROG_CC use... - - -# _AM_DEPENDENCIES(NAME) -# ---------------------- -# See how the compiler implements dependency checking. -# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". -# We try a few techniques and use that to set a single cache variable. -# -# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was -# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular -# dependency, and given that the user is not expected to run this macro, -# just rely on AC_PROG_CC. -AC_DEFUN([_AM_DEPENDENCIES], -[AC_REQUIRE([AM_SET_DEPDIR])dnl -AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl -AC_REQUIRE([AM_MAKE_INCLUDE])dnl -AC_REQUIRE([AM_DEP_TRACK])dnl - -m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], - [$1], [CXX], [depcc="$CXX" am_compiler_list=], - [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], - [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], - [$1], [UPC], [depcc="$UPC" am_compiler_list=], - [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) - -AC_CACHE_CHECK([dependency style of $depcc], - [am_cv_$1_dependencies_compiler_type], -[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_$1_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` - fi - am__universal=false - m4_case([$1], [CC], - [case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac], - [CXX], - [case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac]) - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_$1_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_$1_dependencies_compiler_type=none -fi -]) -AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) -AM_CONDITIONAL([am__fastdep$1], [ - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) -]) - - -# AM_SET_DEPDIR -# ------------- -# Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES. -AC_DEFUN([AM_SET_DEPDIR], -[AC_REQUIRE([AM_SET_LEADING_DOT])dnl -AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl -]) - - -# AM_DEP_TRACK -# ------------ -AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE([dependency-tracking], [dnl -AS_HELP_STRING( - [--enable-dependency-tracking], - [do not reject slow dependency extractors]) -AS_HELP_STRING( - [--disable-dependency-tracking], - [speeds up one-time build])]) -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' - am__nodep='_no' -fi -AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -AC_SUBST([AMDEPBACKSLASH])dnl -_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl -AC_SUBST([am__nodep])dnl -_AM_SUBST_NOTMAKE([am__nodep])dnl -]) - -# Generate code to set up dependency tracking. -*- Autoconf -*- - -# Copyright (C) 1999-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - - -# _AM_OUTPUT_DEPENDENCY_COMMANDS -# ------------------------------ -AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], -[{ - # Older Autoconf quotes --file arguments for eval, but not when files - # are listed without --file. Let's play safe and only enable the eval - # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac - shift - for mf - do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME(["$file"])` - AS_MKDIR_P([$dirpart/$fdir]) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done - done -} -])# _AM_OUTPUT_DEPENDENCY_COMMANDS - - -# AM_OUTPUT_DEPENDENCY_COMMANDS -# ----------------------------- -# This macro should only be invoked once -- use via AC_REQUIRE. -# -# This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each '.P' file that we will -# need in order to bootstrap the dependency handling code. -AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], -[AC_CONFIG_COMMANDS([depfiles], - [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], - [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) -]) - -# Do all the work for Automake. -*- Autoconf -*- - -# Copyright (C) 1996-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This macro actually does too much. Some checks are only needed if -# your package does certain things. But this isn't really a big deal. - -dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. -m4_define([AC_PROG_CC], -m4_defn([AC_PROG_CC]) -[_AM_PROG_CC_C_O -]) - -# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) -# AM_INIT_AUTOMAKE([OPTIONS]) -# ----------------------------------------------- -# The call with PACKAGE and VERSION arguments is the old style -# call (pre autoconf-2.50), which is being phased out. PACKAGE -# and VERSION should now be passed to AC_INIT and removed from -# the call to AM_INIT_AUTOMAKE. -# We support both call styles for the transition. After -# the next Automake release, Autoconf can make the AC_INIT -# arguments mandatory, and then we can depend on a new Autoconf -# release and drop the old call support. -AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_PREREQ([2.65])dnl -dnl Autoconf wants to disallow AM_ names. We explicitly allow -dnl the ones we care about. -m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl -AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl -AC_REQUIRE([AC_PROG_INSTALL])dnl -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) - fi -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi -AC_SUBST([CYGPATH_W]) - -# Define the identity of the package. -dnl Distinguish between old-style and new-style calls. -m4_ifval([$2], -[AC_DIAGNOSE([obsolete], - [$0: two- and three-arguments forms are deprecated.]) -m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl - AC_SUBST([PACKAGE], [$1])dnl - AC_SUBST([VERSION], [$2])], -[_AM_SET_OPTIONS([$1])dnl -dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. -m4_if( - m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), - [ok:ok],, - [m4_fatal([AC_INIT should be called with package and version arguments])])dnl - AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl - AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl - -_AM_IF_OPTION([no-define],, -[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) - AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl - -# Some tools Automake needs. -AC_REQUIRE([AM_SANITY_CHECK])dnl -AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) -AM_MISSING_PROG([AUTOCONF], [autoconf]) -AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) -AM_MISSING_PROG([AUTOHEADER], [autoheader]) -AM_MISSING_PROG([MAKEINFO], [makeinfo]) -AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl -AC_REQUIRE([AC_PROG_MKDIR_P])dnl -# For better backward compatibility. To be removed once Automake 1.9.x -# dies out for good. For more background, see: -# -# -AC_SUBST([mkdir_p], ['$(MKDIR_P)']) -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([AC_PROG_MAKE_SET])dnl -AC_REQUIRE([AM_SET_LEADING_DOT])dnl -_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], - [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], - [_AM_PROG_TAR([v7])])]) -_AM_IF_OPTION([no-dependencies],, -[AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES([CC])], - [m4_define([AC_PROG_CC], - m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl -AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES([CXX])], - [m4_define([AC_PROG_CXX], - m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl -AC_PROVIDE_IFELSE([AC_PROG_OBJC], - [_AM_DEPENDENCIES([OBJC])], - [m4_define([AC_PROG_OBJC], - m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl -AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], - [_AM_DEPENDENCIES([OBJCXX])], - [m4_define([AC_PROG_OBJCXX], - m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl -]) -AC_REQUIRE([AM_SILENT_RULES])dnl -dnl The testsuite driver may need to know about EXEEXT, so add the -dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This -dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. -AC_CONFIG_COMMANDS_PRE(dnl -[m4_provide_if([_AM_COMPILER_EXEEXT], - [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl - -# POSIX will say in a future version that running "rm -f" with no argument -# is OK; and we want to be able to make that assumption in our Makefile -# recipes. So use an aggressive probe to check that the usage we want is -# actually supported "in the wild" to an acceptable degree. -# See automake bug#10828. -# To make any issue more visible, cause the running configure to be aborted -# by default if the 'rm' program in use doesn't match our expectations; the -# user can still override this though. -if rm -f && rm -fr && rm -rf; then : OK; else - cat >&2 <<'END' -Oops! - -Your 'rm' program seems unable to run without file operands specified -on the command line, even when the '-f' option is present. This is contrary -to the behaviour of most rm programs out there, and not conforming with -the upcoming POSIX standard: - -Please tell bug-automake@gnu.org about your system, including the value -of your $PATH and any error possibly output before this message. This -can help us improve future automake versions. - -END - if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then - echo 'Configuration will proceed anyway, since you have set the' >&2 - echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 - echo >&2 - else - cat >&2 <<'END' -Aborting the configuration process, to ensure you take notice of the issue. - -You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . - -If you want to complete the configuration process using your problematic -'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM -to "yes", and re-run configure. - -END - AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) - fi -fi]) - -dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not -dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further -dnl mangled by Autoconf and run in a shell conditional statement. -m4_define([_AC_COMPILER_EXEEXT], -m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) - -# When config.status generates a header, we must update the stamp-h file. -# This file resides in the same directory as the config header -# that is generated. The stamp files are numbered to have different names. - -# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the -# loop where config.status creates the headers, so we can generate -# our stamp files there. -AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], -[# Compute $1's index in $config_headers. -_am_arg=$1 -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $_am_arg | $_am_arg:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. -AC_DEFUN([AM_PROG_INSTALL_SH], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -if test x"${install_sh}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; - *) - install_sh="\${SHELL} $am_aux_dir/install-sh" - esac -fi -AC_SUBST([install_sh])]) - -# Copyright (C) 2003-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# Check whether the underlying file-system supports filenames -# with a leading dot. For instance MS-DOS doesn't. -AC_DEFUN([AM_SET_LEADING_DOT], -[rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null -AC_SUBST([am__leading_dot])]) - -# Copyright (C) 1998-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_LEX -# ----------- -# Autoconf leaves LEX=: if lex or flex can't be found. Change that to a -# "missing" invocation, for better error output. -AC_DEFUN([AM_PROG_LEX], -[AC_PREREQ([2.50])dnl -AC_REQUIRE([AM_MISSING_HAS_RUN])dnl -AC_REQUIRE([AC_PROG_LEX])dnl -if test "$LEX" = :; then - LEX=${am_missing_run}flex -fi]) - -# Check to see how 'make' treats includes. -*- Autoconf -*- - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_MAKE_INCLUDE() -# ----------------- -# Check to see how make treats includes. -AC_DEFUN([AM_MAKE_INCLUDE], -[am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf -]) - -# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- - -# Copyright (C) 1997-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_MISSING_PROG(NAME, PROGRAM) -# ------------------------------ -AC_DEFUN([AM_MISSING_PROG], -[AC_REQUIRE([AM_MISSING_HAS_RUN]) -$1=${$1-"${am_missing_run}$2"} -AC_SUBST($1)]) - -# AM_MISSING_HAS_RUN -# ------------------ -# Define MISSING if not defined so far and test if it is modern enough. -# If it is, set am_missing_run to use it, otherwise, to nothing. -AC_DEFUN([AM_MISSING_HAS_RUN], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([missing])dnl -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac -fi -# Use eval to expand $SHELL -if eval "$MISSING --is-lightweight"; then - am_missing_run="$MISSING " -else - am_missing_run= - AC_MSG_WARN(['missing' script is too old or missing]) -fi -]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_MANGLE_OPTION(NAME) -# ----------------------- -AC_DEFUN([_AM_MANGLE_OPTION], -[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) - -# _AM_SET_OPTION(NAME) -# -------------------- -# Set option NAME. Presently that only means defining a flag for this option. -AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) - -# _AM_SET_OPTIONS(OPTIONS) -# ------------------------ -# OPTIONS is a space-separated list of Automake options. -AC_DEFUN([_AM_SET_OPTIONS], -[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) - -# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) -# ------------------------------------------- -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -AC_DEFUN([_AM_IF_OPTION], -[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) - -# Copyright (C) 1999-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_PROG_CC_C_O -# --------------- -# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC -# to automatically call this. -AC_DEFUN([_AM_PROG_CC_C_O], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([compile])dnl -AC_LANG_PUSH([C])dnl -AC_CACHE_CHECK( - [whether $CC understands -c and -o together], - [am_cv_prog_cc_c_o], - [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) - # Make sure it works both with $CC and with simple cc. - # Following AC_PROG_CC_C_O, we do the test twice because some - # compilers refuse to overwrite an existing .o file with -o, - # though they will create one. - am_cv_prog_cc_c_o=yes - for am_i in 1 2; do - if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ - && test -f conftest2.$ac_objext; then - : OK - else - am_cv_prog_cc_c_o=no - break - fi - done - rm -f core conftest* - unset am_i]) -if test "$am_cv_prog_cc_c_o" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" -fi -AC_LANG_POP([C])]) - -# For backward compatibility. -AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) - -# Copyright (C) 1999-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - - -# AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# --------------------------------------------------------------------------- -# Adds support for distributing Python modules and packages. To -# install modules, copy them to $(pythondir), using the python_PYTHON -# automake variable. To install a package with the same name as the -# automake package, install to $(pkgpythondir), or use the -# pkgpython_PYTHON automake variable. -# -# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as -# locations to install python extension modules (shared libraries). -# Another macro is required to find the appropriate flags to compile -# extension modules. -# -# If your package is configured with a different prefix to python, -# users will have to add the install directory to the PYTHONPATH -# environment variable, or create a .pth file (see the python -# documentation for details). -# -# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will -# cause an error if the version of python installed on the system -# doesn't meet the requirement. MINIMUM-VERSION should consist of -# numbers and dots only. -AC_DEFUN([AM_PATH_PYTHON], - [ - dnl Find a Python interpreter. Python versions prior to 2.0 are not - dnl supported. (2.0 was released on October 16, 2000). - m4_define_default([_AM_PYTHON_INTERPRETER_LIST], -[python python2 python3 python3.3 python3.2 python3.1 python3.0 python2.7 dnl - python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0]) - - AC_ARG_VAR([PYTHON], [the Python interpreter]) - - m4_if([$1],[],[ - dnl No version check is needed. - # Find any Python interpreter. - if test -z "$PYTHON"; then - AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :) - fi - am_display_PYTHON=python - ], [ - dnl A version check is needed. - if test -n "$PYTHON"; then - # If the user set $PYTHON, use it and don't search something else. - AC_MSG_CHECKING([whether $PYTHON version is >= $1]) - AM_PYTHON_CHECK_VERSION([$PYTHON], [$1], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - AC_MSG_ERROR([Python interpreter is too old])]) - am_display_PYTHON=$PYTHON - else - # Otherwise, try each interpreter until we find one that satisfies - # VERSION. - AC_CACHE_CHECK([for a Python interpreter with version >= $1], - [am_cv_pathless_PYTHON],[ - for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do - test "$am_cv_pathless_PYTHON" = none && break - AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break]) - done]) - # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. - if test "$am_cv_pathless_PYTHON" = none; then - PYTHON=: - else - AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON]) - fi - am_display_PYTHON=$am_cv_pathless_PYTHON - fi - ]) - - if test "$PYTHON" = :; then - dnl Run any user-specified action, or abort. - m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])]) - else - - dnl Query Python for its version number. Getting [:3] seems to be - dnl the best way to do this; it's what "site.py" does in the standard - dnl library. - - AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version], - [am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[[:3]])"`]) - AC_SUBST([PYTHON_VERSION], [$am_cv_python_version]) - - dnl Use the values of $prefix and $exec_prefix for the corresponding - dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made - dnl distinct variables so they can be overridden if need be. However, - dnl general consensus is that you shouldn't need this ability. - - AC_SUBST([PYTHON_PREFIX], ['${prefix}']) - AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}']) - - dnl At times (like when building shared libraries) you may want - dnl to know which OS platform Python thinks this is. - - AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform], - [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`]) - AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform]) - - # Just factor out some code duplication. - am_python_setup_sysconfig="\ -import sys -# Prefer sysconfig over distutils.sysconfig, for better compatibility -# with python 3.x. See automake bug#10227. -try: - import sysconfig -except ImportError: - can_use_sysconfig = 0 -else: - can_use_sysconfig = 1 -# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs: -# -try: - from platform import python_implementation - if python_implementation() == 'CPython' and sys.version[[:3]] == '2.7': - can_use_sysconfig = 0 -except ImportError: - pass" - - dnl Set up 4 directories: - - dnl pythondir -- where to install python scripts. This is the - dnl site-packages directory, not the python standard library - dnl directory like in previous automake betas. This behavior - dnl is more consistent with lispdir.m4 for example. - dnl Query distutils for this directory. - AC_CACHE_CHECK([for $am_display_PYTHON script directory], - [am_cv_python_pythondir], - [if test "x$prefix" = xNONE - then - am_py_prefix=$ac_default_prefix - else - am_py_prefix=$prefix - fi - am_cv_python_pythondir=`$PYTHON -c " -$am_python_setup_sysconfig -if can_use_sysconfig: - sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'}) -else: - from distutils import sysconfig - sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix') -sys.stdout.write(sitedir)"` - case $am_cv_python_pythondir in - $am_py_prefix*) - am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` - am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"` - ;; - *) - case $am_py_prefix in - /usr|/System*) ;; - *) - am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages - ;; - esac - ;; - esac - ]) - AC_SUBST([pythondir], [$am_cv_python_pythondir]) - - dnl pkgpythondir -- $PACKAGE directory under pythondir. Was - dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is - dnl more consistent with the rest of automake. - - AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE]) - - dnl pyexecdir -- directory for installing python extension modules - dnl (shared libraries) - dnl Query distutils for this directory. - AC_CACHE_CHECK([for $am_display_PYTHON extension module directory], - [am_cv_python_pyexecdir], - [if test "x$exec_prefix" = xNONE - then - am_py_exec_prefix=$am_py_prefix - else - am_py_exec_prefix=$exec_prefix - fi - am_cv_python_pyexecdir=`$PYTHON -c " -$am_python_setup_sysconfig -if can_use_sysconfig: - sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'}) -else: - from distutils import sysconfig - sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix') -sys.stdout.write(sitedir)"` - case $am_cv_python_pyexecdir in - $am_py_exec_prefix*) - am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` - am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"` - ;; - *) - case $am_py_exec_prefix in - /usr|/System*) ;; - *) - am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages - ;; - esac - ;; - esac - ]) - AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir]) - - dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE) - - AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE]) - - dnl Run any user-specified action. - $2 - fi - -]) - - -# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) -# --------------------------------------------------------------------------- -# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION. -# Run ACTION-IF-FALSE otherwise. -# This test uses sys.hexversion instead of the string equivalent (first -# word of sys.version), in order to cope with versions such as 2.2c1. -# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000). -AC_DEFUN([AM_PYTHON_CHECK_VERSION], - [prog="import sys -# split strings by '.' and convert to numeric. Append some zeros -# because we need at least 4 digits for the hex conversion. -# map returns an iterator in Python 3.0 and a list in 2.x -minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]] -minverhex = 0 -# xrange is not present in Python 3.0 and range returns an iterator -for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]] -sys.exit(sys.hexversion < minverhex)" - AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])]) - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_RUN_LOG(COMMAND) -# ------------------- -# Run COMMAND, save the exit status in ac_status, and log it. -# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) -AC_DEFUN([AM_RUN_LOG], -[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD - ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - (exit $ac_status); }]) - -# Check to make sure that the build environment is sane. -*- Autoconf -*- - -# Copyright (C) 1996-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_SANITY_CHECK -# --------------- -AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' -' -case `pwd` in - *[[\\\"\#\$\&\'\`$am_lf]]*) - AC_MSG_ERROR([unsafe absolute working directory name]);; -esac -case $srcdir in - *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) - AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; -esac - -# Do 'set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - am_has_slept=no - for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken - alias in your environment]) - fi - if test "$[2]" = conftest.file || test $am_try -eq 2; then - break - fi - # Just in case. - sleep 1 - am_has_slept=yes - done - test "$[2]" = conftest.file - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -AC_MSG_RESULT([yes]) -# If we didn't sleep, we still need to ensure time stamps of config.status and -# generated files are strictly newer. -am_sleep_pid= -if grep 'slept: no' conftest.file >/dev/null 2>&1; then - ( sleep 1 ) & - am_sleep_pid=$! -fi -AC_CONFIG_COMMANDS_PRE( - [AC_MSG_CHECKING([that generated files are newer than configure]) - if test -n "$am_sleep_pid"; then - # Hide warnings about reused PIDs. - wait $am_sleep_pid 2>/dev/null - fi - AC_MSG_RESULT([done])]) -rm -f conftest.file -]) - -# Copyright (C) 2009-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_SILENT_RULES([DEFAULT]) -# -------------------------- -# Enable less verbose build rules; with the default set to DEFAULT -# ("yes" being less verbose, "no" or empty being verbose). -AC_DEFUN([AM_SILENT_RULES], -[AC_ARG_ENABLE([silent-rules], [dnl -AS_HELP_STRING( - [--enable-silent-rules], - [less verbose build output (undo: "make V=1")]) -AS_HELP_STRING( - [--disable-silent-rules], - [verbose build output (undo: "make V=0")])dnl -]) -case $enable_silent_rules in @%:@ ((( - yes) AM_DEFAULT_VERBOSITY=0;; - no) AM_DEFAULT_VERBOSITY=1;; - *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; -esac -dnl -dnl A few 'make' implementations (e.g., NonStop OS and NextStep) -dnl do not support nested variable expansions. -dnl See automake bug#9928 and bug#10237. -am_make=${MAKE-make} -AC_CACHE_CHECK([whether $am_make supports nested variables], - [am_cv_make_support_nested_variables], - [if AS_ECHO([['TRUE=$(BAR$(V)) -BAR0=false -BAR1=true -V=1 -am__doit: - @$(TRUE) -.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then - am_cv_make_support_nested_variables=yes -else - am_cv_make_support_nested_variables=no -fi]) -if test $am_cv_make_support_nested_variables = yes; then - dnl Using '$V' instead of '$(V)' breaks IRIX make. - AM_V='$(V)' - AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' -else - AM_V=$AM_DEFAULT_VERBOSITY - AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY -fi -AC_SUBST([AM_V])dnl -AM_SUBST_NOTMAKE([AM_V])dnl -AC_SUBST([AM_DEFAULT_V])dnl -AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl -AC_SUBST([AM_DEFAULT_VERBOSITY])dnl -AM_BACKSLASH='\' -AC_SUBST([AM_BACKSLASH])dnl -_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl -]) - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_STRIP -# --------------------- -# One issue with vendor 'install' (even GNU) is that you can't -# specify the program used to strip binaries. This is especially -# annoying in cross-compiling environments, where the build's strip -# is unlikely to handle the host's binaries. -# Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in "make install-strip", and initialize -# STRIPPROG with the value of the STRIP variable (set by the user). -AC_DEFUN([AM_PROG_INSTALL_STRIP], -[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using 'strip' when the user -# run "make install-strip". However 'strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the 'STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. -if test "$cross_compiling" != no; then - AC_CHECK_TOOL([STRIP], [strip], :) -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) - -# Copyright (C) 2006-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_SUBST_NOTMAKE(VARIABLE) -# --------------------------- -# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. -# This macro is traced by Automake. -AC_DEFUN([_AM_SUBST_NOTMAKE]) - -# AM_SUBST_NOTMAKE(VARIABLE) -# -------------------------- -# Public sister of _AM_SUBST_NOTMAKE. -AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) - -# Check how to create a tarball. -*- Autoconf -*- - -# Copyright (C) 2004-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_PROG_TAR(FORMAT) -# -------------------- -# Check how to create a tarball in format FORMAT. -# FORMAT should be one of 'v7', 'ustar', or 'pax'. -# -# Substitute a variable $(am__tar) that is a command -# writing to stdout a FORMAT-tarball containing the directory -# $tardir. -# tardir=directory && $(am__tar) > result.tar -# -# Substitute a variable $(am__untar) that extract such -# a tarball read from stdin. -# $(am__untar) < result.tar -# -AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. Yes, it's still used -# in the wild :-( We should find a proper way to deprecate it ... -AC_SUBST([AMTAR], ['$${TAR-tar}']) - -# We'll loop over all known methods to create a tar archive until one works. -_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' - -m4_if([$1], [v7], - [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], - - [m4_case([$1], - [ustar], - [# The POSIX 1988 'ustar' format is defined with fixed-size fields. - # There is notably a 21 bits limit for the UID and the GID. In fact, - # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 - # and bug#13588). - am_max_uid=2097151 # 2^21 - 1 - am_max_gid=$am_max_uid - # The $UID and $GID variables are not portable, so we need to resort - # to the POSIX-mandated id(1) utility. Errors in the 'id' calls - # below are definitely unexpected, so allow the users to see them - # (that is, avoid stderr redirection). - am_uid=`id -u || echo unknown` - am_gid=`id -g || echo unknown` - AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) - if test $am_uid -le $am_max_uid; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - _am_tools=none - fi - AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) - if test $am_gid -le $am_max_gid; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - _am_tools=none - fi], - - [pax], - [], - - [m4_fatal([Unknown tar format])]) - - AC_MSG_CHECKING([how to create a $1 tar archive]) - - # Go ahead even if we have the value already cached. We do so because we - # need to set the values for the 'am__tar' and 'am__untar' variables. - _am_tools=${am_cv_prog_tar_$1-$_am_tools} - - for _am_tool in $_am_tools; do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break - - # tar/untar a dummy directory, and stop if the command works. - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) - rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi - done - rm -rf conftest.dir - - AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) - AC_MSG_RESULT([$am_cv_prog_tar_$1])]) - -AC_SUBST([am__tar]) -AC_SUBST([am__untar]) -]) # _AM_PROG_TAR - diff --git a/buildall b/buildall deleted file mode 100755 index cb203d4..0000000 --- a/buildall +++ /dev/null @@ -1,140 +0,0 @@ -#!/bin/bash -# Set up environment to build and install CHiLL at Blue Waters - -echo "This script needs to be customized before it is executed..." -exit - -# Package directory ... -export PACKAGEDIR=/sw/sources/chill - -# Directory to build in ... -export BUILDDIR=/u/sciteam/rwheeler/scratch - -# Directory to install permanent files ... -export INSTALLDIR=/sw/xe/chill - -# Install tools in seperate directories -export AUTOCONFINSTALLDIR=$INSTALLDIR/autoconf -export GCCINSTALLDIR=$INSTALLDIR/gcc -export BOOSTINSTALLDIR=$INSTALLDIR/boost -export ROSEINSTALLDIR=$INSTALLDIR/rose - -# Packages already installed -export JAVA_HOME=/opt/java/jdk1.7.0_45 -export PYTHON_INCDIR=/usr/include/python2.6 -export PYTHON_LIBDIR=/usr/lib64 -export PYTHON_VERSION=2.6 - -# Create toplevel build and installation directories if they do not already exist... -if false; then -mkdir -p $BUILDDIR -mkdir -p $INSTALLDIR -mkdir -p $INSTALLDIR/lib -mkdir -p $INSTALLDIR/lib64 -mkdir -p $INSTALLDIR/bin -mkdir -p $AUTOCONFINSTALLDIR -mkdir -p $GCCINSTALLDIR -mkdir -p $BOOSTINSTALLDIR -mkdir -p $ROSEINSTALLDIR -fi - -export PATH=$INSTALLDIR/bin:$PATH - -# -# Unpack needed items into the build area -# -if false; then -cd $BUILDDIR -for dir in autoconf/autoconf-2.69 gcc/gcc-4.4.7 boost/boost_1_45_0 rose/edg4x-rose chill/chill-0.2.1; do - mkdir -p `dirname $dir`/build - echo checking for `basename $dir` - if [ ! -d $dir ]; then - echo unpacking tar file `basename $dir`.tar.gz - (cd `dirname $dir`; tar xzf $PACKAGEDIR/`basename $dir`.tar.gz) - fi -done -fi - -# -# Configure and build autoconf -# -if false; then -echo Building autoconf -cd $BUILDDIR/autoconf/build -../autoconf-2.69/configure --prefix=$AUTOCONFINSTALLDIR -make -j`nproc` -make -j`nproc` install -fi - -export PATH=$AUTOCONFINSTALLDIR/bin:$PATH - -# -# Configure and build gcc -# -if false; then -echo Building gcc -cd $BUILDDIR/gcc/build -../gcc-4.4.7/configure --prefix=$GCCINSTALLDIR -make -j`nproc` -make -j`nproc` install -fi - -export PATH=$GCCINSTALLDIR/bin:$PATH -export LD_LIBRARY_PATH=$GCCINSTALLDIR/lib64:$LD_LIBRARY_PATH -export C_INCLUDE_PATH=$GCCINSTALLDIR/include:$C_INCLUDE_PATH -export CPLUS_INCLUDE_PATH=$C_INCLUDE_PATH - -# -# Configure and build boost -# -if false; then -echo Building Boost -export BOOSTLIBSNEEDED=date_time,filesystem,program_options,regex,system,thread,wave,iostreams -cd $BUILDDIR/boost/boost_1_45_0 -./bootstrap.sh --prefix=$BOOSTINSTALLDIR --with-libraries=$BOOSTLIBSNEEDED -./bjam install --prefix=$BOOSTINSTALLDIR --build-dir=../build -fi - -export LD_LIBRARY_PATH=$BOOSTINSTALLDIR/lib:$LD_LIBRARY_PATH -export C_INCLUDE_PATH=$BOOSTINSTALLDIR/include:$C_INCLUDE_PATH -export CPLUS_INCLUDE_PATH=$C_INCLUDE_PATH - -# -# Configure and build rose -# -if false; then -echo Building Rose -cd $BUILDDIR/rose/build -../edg4x-rose/configure --prefix=$ROSEINSTALLDIR --with-boost=$BOOSTINSTALLDIR -make -j`nproc` -make -j`nproc` install -fi - -export LD_LIBRARY_PATH=$ROSEINSTALLDIR/lib:$JAVA_HOME/jre/lib/amd64/server:$LD_LIBRARY_PATH -export C_INCLUDE_PATH=$ROSEINSTALLDIR/include:$ROSEINSTALLDIR/include/rose:$C_INCLUDE_PATH -export CPLUS_INCLUDE_PATH=$C_INCLUDE_PATH - -# -# Configure and build chill -# -if false; then -echo Building CHiLL -cd $BUILDDIR/chill/chill-0.2.1 -./configure --with-interface=python --prefix=$INSTALLDIR --with-rose=$ROSEINSTALLDIR --with-boost=$BOOSTINSTALLDIR -make -j`nproc` -make -j`nproc` install -fi - -# -# Test CHiLL -# -if false; then -echo Testing CHiLL -cd $BUILDDIR/chill/chill-0.2.1/test-chill -./runtests -fi - -echo Remember to set your paths to... -echo -echo 'export PATH=$PATH:'$INSTALLDIR/bin -echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:'$ROSEINSTALLDIR/lib:$BOOSTINSTALLDIR/lib:$JAVA_HOME/jre/lib/amd64/server diff --git a/chill/CMakeLists.txt b/chill/CMakeLists.txt new file mode 100644 index 0000000..49e4937 --- /dev/null +++ b/chill/CMakeLists.txt @@ -0,0 +1,59 @@ +find_package(PythonLibs REQUIRED) +find_package(BISON) +find_package(FLEX) + +FLEX_TARGET(ExprScanner src/parse_expr.ll ${CMAKE_CURRENT_BINARY_DIR}/parse_expr.yy.cc COMPILE_FLAGS + "--header-file=${CMAKE_CURRENT_BINARY_DIR}/parse_expr.ll.hh") # Hack to avoid generating header in root +BISON_TARGET(ExprParser src/parse_expr.yy ${CMAKE_CURRENT_BINARY_DIR}/parse_expr.tab.cc COMPILE_FLAGS "-t -d") +ADD_FLEX_BISON_DEPENDENCY(ExprScanner ExprParser) + +string(TIMESTAMP build_date "\\\"%m/%d/%Y\\\"") + +set(CORE_LIBS + m rose rt util omega codegen dl + boost_date_time boost_filesystem boost_program_options + boost_regex boost_system boost_wave boost_iostreams) + +set(CORE_SRC + src/dep.cc + src/irtools.cc + src/loop.cc + src/loop_basic.cc + src/loop_datacopy.cc + src/loop_extra.cc + src/loop_tile.cc + src/loop_unroll.cc + src/omegatools.cc + ) + +set(IR_CHILL_SRC + src/ir_rose.cc + src/ir_rose_utils.cc + ) + +set(PYTHON_SRC + src/chill_run.cc + src/chill_run_util.cc + src/chillmodule.cc + ${FLEX_ExprScanner_OUTPUTS} + ${BISON_ExprParser_OUTPUTS} + ) + +set(COMMON_FLAGS "-DBUILD_ROSE -DCHILL_BUILD_DATE=\"${build_date}\" -DCHILL_BUILD_VERSION=\"\\\"0.2.1\\\"\"") + +set(CMAKE_CXX_FLAGS "-DPYTHON ${COMMON_FLAGS}") + +link_directories(${ROSEHOME}/lib ${BOOSTOME}/lib) + +include_directories( + include + ${PROJECT_SOURCE_DIR}/omegalib/include + ${ROSEHOME}/include + ${ROSEHOME}/include/rose + ${BOOSTHOME}/include + ${CMAKE_CURRENT_BINARY_DIR} + ${PYTHON_INCLUDE_DIRS}) + +add_executable(chill ${CORE_SRC} ${PYTHON_SRC} ${IR_CHILL_SRC}) +target_link_libraries(chill ${CORE_LIBS} ${PYTHON_LIBRARY}) +add_dependencies(chill omega codegen) diff --git a/chill/include/chill_error.hh b/chill/include/chill_error.hh new file mode 100644 index 0000000..dc7432f --- /dev/null +++ b/chill/include/chill_error.hh @@ -0,0 +1,19 @@ +#ifndef CHILL_ERROR_HH +#define CHILL_ERROR_HH + +// for loop transformation problem +struct loop_error: public std::runtime_error { + loop_error(const std::string &msg): std::runtime_error(msg){} +}; + +// for generic compiler intermediate code handling problem +struct ir_error: public std::runtime_error { + ir_error(const std::string &msg): std::runtime_error(msg){} +}; + +// specific for expression to preburger math translation problem +struct ir_exp_error: public ir_error { + ir_exp_error(const std::string &msg): ir_error(msg){} +}; + +#endif diff --git a/chill/include/chill_run_util.hh b/chill/include/chill_run_util.hh new file mode 100644 index 0000000..8df5871 --- /dev/null +++ b/chill/include/chill_run_util.hh @@ -0,0 +1,29 @@ +#ifndef CHILL_RUN_UTIL_HH +#define CHILL_RUN_UTIL_HH + +#include +#include +#include + +typedef std::map simap_t; +typedef std::vector > simap_vec_t; + +// in chill_run_util.cc +simap_vec_t* make_prog(simap_vec_t* cond); +simap_vec_t* make_cond_gt(simap_t* lhs, simap_t* rhs); +simap_vec_t* make_cond_lt(simap_t* lhs, simap_t* rhs); +simap_vec_t* make_cond_ge(simap_t* lhs, simap_t* rhs); +simap_vec_t* make_cond_le(simap_t* lhs, simap_t* rhs); +simap_vec_t* make_cond_eq(simap_t* lhs, simap_t* rhs); +simap_t* make_cond_item_add(simap_t* lhs, simap_t* rhs); +simap_t* make_cond_item_sub(simap_t* lhs, simap_t* rhs); +simap_t* make_cond_item_mul(simap_t* lhs, simap_t* rhs); +simap_t* make_cond_item_neg(simap_t* expr); +simap_t* make_cond_item_number(int n); +simap_t* make_cond_item_variable(const char* var); +simap_t* make_cond_item_level(int n); + +// in parse_expr.yy +simap_vec_t* parse_relation_vector(const char* expr); + +#endif diff --git a/chill/include/chilldebug.h b/chill/include/chilldebug.h new file mode 100644 index 0000000..4abbb82 --- /dev/null +++ b/chill/include/chilldebug.h @@ -0,0 +1,11 @@ + +// a central place to turn on debugging messages + +// enable the next line to get lots of output +//#define DEBUGCHILL + +#ifdef DEBUGCHILL +#define DEBUG_PRINT(args...) fprintf(stderr, args ) +#else +#define DEBUG_PRINT(args...) /* Don't do anything */ +#endif diff --git a/chill/include/chillmodule.hh b/chill/include/chillmodule.hh new file mode 100644 index 0000000..a64ad1b --- /dev/null +++ b/chill/include/chillmodule.hh @@ -0,0 +1,21 @@ +#ifndef BASIC_CHILLMODULE_HH +#define BASIC_CHILLMODULE_HH +// TODO Python.h defines these and something else does too +#undef _POSIX_C_SOURCE +#undef _XOPEN_SOURCE + +#include + +// a C routine that will be called from python +//static PyObject * chill_print_code(PyObject *self, PyObject *args); + +//static PyMethodDef ChillMethods[] ; + +#ifndef CUDACHILL +void finalize_loop(int loop_num_start, int loop_num_end); +int get_loop_num_start(); +int get_loop_num_end(); +#endif + +PyMODINIT_FUNC initchill() ; // pass C methods to python +#endif diff --git a/chill/include/config.h.in b/chill/include/config.h.in new file mode 100644 index 0000000..77e32da --- /dev/null +++ b/chill/include/config.h.in @@ -0,0 +1,32 @@ +/* include/config.h.in. Generated from configure.ac by autoheader. */ + +/* Use ROSE */ +#undef BUILD_ROSE + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Version number of package */ +#undef VERSION + +/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a + `char[]'. */ +#undef YYTEXT_POINTER diff --git a/chill/include/dep.hh b/chill/include/dep.hh new file mode 100644 index 0000000..1fa1280 --- /dev/null +++ b/chill/include/dep.hh @@ -0,0 +1,85 @@ +#ifndef DEP_HH +#define DEP_HH + +#include +#include "graph.hh" +#include "ir_code.hh" +#include "chill_error.hh" + +enum DependenceType { DEP_W2R, DEP_R2W, DEP_W2W, DEP_R2R, DEP_CONTROL, DEP_UNKNOWN }; + +class DependenceVector; +typedef std::vector DependenceList; + +struct DependenceVector { + DependenceType type; + IR_Symbol *sym; + + bool is_reduction; // used to identify a class of flow dependence + // that can be broken + std::vector lbounds; + std::vector ubounds; + + bool quasi; + bool is_scalar_dependence; + DependenceVector() { + type = DEP_UNKNOWN; + sym = NULL; + is_reduction = false; + quasi = false; + is_scalar_dependence = false; + } + // DependenceVector(int size); + DependenceVector(const DependenceVector &that); + ~DependenceVector() {delete sym;} + DependenceVector &operator=(const DependenceVector &that); + + bool is_data_dependence() const; + bool is_control_dependence() const; + bool has_negative_been_carried_at(int dim) const; + bool has_been_carried_at(int dim) const; + bool has_been_carried_before(int dim) const; + + // the following functions will be cleaned up or removed later + bool isZero() const; + bool isPositive() const; + bool isNegative() const; + bool isAllPositive() const; + bool isAllNegative() const; + bool isZero(int dim) const; + bool hasPositive(int dim) const; + bool hasNegative(int dim) const; + bool isCarried(int dim, omega::coef_t distance = posInfinity) const; + bool canPermute(const std::vector &pi) const; + + std::vector normalize() const; + std::vector permute(const std::vector &pi) const; + DependenceVector reverse() const; + // std::vector matrix(const std::vector > &M) const; + DependenceType getType() const; + friend std::ostream& operator<<(std::ostream &os, const DependenceVector &d); +}; + + + +class DependenceGraph: public Graph { + +protected: + int num_dim_; + +public: + DependenceGraph(int n) { num_dim_ = n; } + DependenceGraph() { num_dim_ = 0; } + ~DependenceGraph() {} + int num_dim() const { return num_dim_; } +// DependenceGraph permute(const std::vector &pi) const; + DependenceGraph permute(const std::vector &pi, + const std::set &active = std::set()) const; + // DependenceGraph matrix(const std::vector > &M) const; + DependenceGraph subspace(int dim) const; + bool isPositive() const; + bool hasPositive(int dim) const; + bool hasNegative(int dim) const; +}; + +#endif diff --git a/chill/include/graph.hh b/chill/include/graph.hh new file mode 100644 index 0000000..f8471df --- /dev/null +++ b/chill/include/graph.hh @@ -0,0 +1,319 @@ +/***************************************************************************** + Copyright (C) 2008 University of Southern California + Copyright (C) 2010 University of Utah + All Rights Reserved. + + Purpose: + Graph template class supports topological sort + with return result observing strongly connected component. + + Notes: + The result of topologically sorting a graph V={1,2,3,4} and E={1->2, 1->3, + 2->3, 3->2, 3->4} is ({1}, {2,3}, {4}). + + History: + 01/2006 Created by Chun Chen. + 07/2010 add a new topological order, -chun +*****************************************************************************/ + +#ifndef GRAPH_HH +#define GRAPH_HH + +#include +#include +#include +#include +#include +#include +#include + +struct Empty { + Empty() {}; + bool operator<(const Empty &) const { return true; }; + bool operator==(const Empty &) const { return false; }; + friend std::ostream& operator<<(std::ostream &os, const Empty &) { return os; }; +}; + +namespace { + enum GraphColorType {WHITE, GREY, BLACK}; +} + +template struct Graph; +template std::ostream& operator<<(std::ostream &os, const Graph &g); + +template +struct Graph { + typedef std::map > EdgeList; + typedef std::vector > VertexList; + + VertexList vertex; + bool directed; + + Graph(bool directed = true); + + int vertexCount() const; + int edgeCount() const; + bool isEmpty() const; + bool isDirected() const; + int insert(const VertexType &v = VertexType()); + void connect(int v1, int v2, const EdgeType &e = EdgeType()); + void connect(int v1, int v2, const std::vector &e); + void disconnect(int v1, int v2); + bool hasEdge(int v1, int v2) const; + std::vector getEdge(int v1, int v2) const; + + std::vector > topoSort() const; + std::vector > packed_topoSort() const; + + void dump() { + std::cout << *this; + } + + friend std::ostream& operator<< <>(std::ostream &os, const Graph &g); +}; + +template +std::ostream& operator<<(std::ostream &os, const Graph &g) { + for (int i = 0; i < g.vertex.size(); i++) + for (typename Graph::EdgeList::const_iterator j = g.vertex[i].second.begin(); j != g.vertex[i].second.end(); j++) { + // os << i+1 << "->" << j->first+1 << ":"; + os << "s" << i << "->" << "s" << j->first << ":"; + for (typename std::vector::const_iterator k = j->second.begin(); k != j->second.end(); k++) + os << " " << *k; + os << std::endl; + } + + return os; +} + + +template +Graph::Graph(bool directed_): + directed(directed_) { +} + +template +int Graph::vertexCount() const { + return vertex.size(); +} + +template +int Graph::edgeCount() const { + int result = 0; + + for (int i = 0; i < vertex.size(); i++) + for (typename EdgeList::const_iterator j = vertex[i].second.begin(); j != vertex[i].second.end(); j++) + result += j->second.size(); + + if (!directed) + result = result/2; + + return result; +} + +template +bool Graph::isEmpty() const { + return vertex.size() == 0; +} + +template +bool Graph::isDirected() const { + return directed; +} + +template +int Graph::insert(const VertexType & v) { + for (int i = 0; i < vertex.size(); i++) + if (vertex[i].first == v) + return i; + + vertex.push_back(std::make_pair(v, EdgeList())); + return vertex.size() - 1; +} + + +template +void Graph::connect(int v1, int v2, const EdgeType &e) { + assert(v1 < vertex.size() && v2 < vertex.size()); + + vertex[v1].second[v2].push_back(e);; + if (!directed) + vertex[v2].second[v1].push_back(e); +} + +template +void Graph::connect(int v1, int v2, const std::vector &e) { + assert(v1 < vertex.size() && v2 < vertex.size()); + + if (e.size() == 0) + return; + + copy(e.begin(), e.end(), back_inserter(vertex[v1].second[v2])); + if (!directed) + copy(e.begin(), e.end(), back_inserter(vertex[v2].second[v1])); +} + +template +void Graph::disconnect(int v1, int v2) { + assert(v1 < vertex.size() && v2 < vertex.size()); + + vertex[v1].second.erase(v2); + if (!directed) + vertex[v2].second.erase(v1); +} + +template +bool Graph::hasEdge(int v1, int v2) const { + return vertex[v1].second.find(v2) != vertex[v1].second.end(); +} + +template +std::vector Graph::getEdge(int v1, int v2) const { + if (!hasEdge(v1, v2)) + return std::vector(); + + return vertex[v1].second.find(v2)->second; +} + +// This topological sort does handle SCC in graph. +template +std::vector > Graph::topoSort() const { + const int n = vertex.size(); + std::vector color(n, WHITE); + std::stack S; + + std::vector order(n); + int c = n; + + // first DFS + for (int i = n-1; i >= 0; i--) + if (color[i] == WHITE) { + S.push(i); + while (!S.empty()) { + int v = S.top(); + + if (color[v] == WHITE) { + for (typename EdgeList::const_iterator j = vertex[v].second.begin(); j != vertex[v].second.end(); j++) + if (color[j->first] == WHITE) + S.push(j->first); + + color[v] = GREY; + } + else if (color[v] == GREY) { + color[v] = BLACK; + S.pop(); + order[--c] = v; + } + else { + S.pop(); + } + } + } + + // transpose edge + std::vector > edgeT(n); + for (int i = 0; i < n; i++) + for (typename EdgeList::const_iterator j = vertex[i].second.begin(); j != vertex[i].second.end(); j++) + edgeT[j->first].insert(i); + + // second DFS in transposed graph starting from last finished vertex + fill(color.begin(), color.end(), WHITE); + std::vector > result; + for (int i = 0; i < n; i++) + if (color[order[i]] == WHITE) { + std::set s; + + S.push(order[i]); + while (!S.empty()) { + int v = S.top(); + + if(color[v] == WHITE) { + for (std::set::const_iterator j = edgeT[v].begin(); j != edgeT[v].end(); j++) + if (color[*j] == WHITE) + S.push(*j); + + color[v] = GREY; + } + else if (color[v] == GREY) { + color[v] = BLACK; + S.pop(); + s.insert(v); + } + else { + S.pop(); + } + } + + result.push_back(s); + } + + return result; +} + +// This topological sort does not handle SCC in graph. +template +std::vector > Graph::packed_topoSort() const { + const int n = vertex.size(); + std::vector color(n, WHITE); + std::stack S; + + std::vector is_root(n, false); + std::vector > edges(n); + + // first DFS + for (int i = n-1; i >= 0; i--) + if (color[i] == WHITE) { + S.push(i); + is_root[i] = true; + while (!S.empty()) { + int v = S.top(); + + if (color[v] == WHITE) { + for (typename EdgeList::const_iterator j = vertex[v].second.begin(); j != vertex[v].second.end(); j++) + if (color[j->first] == WHITE) { + S.push(j->first); + edges[v].insert(j->first); + } + else if (color[j->first] == BLACK) { + if (is_root[j->first]) { + is_root[j->first] = false; + edges[v].insert(j->first); + } + } + + color[v] = GREY; + } + else if (color[v] == GREY) { + color[v] = BLACK; + S.pop(); + } + else { + S.pop(); + } + } + } + + + // second BFS in DFS tree starting from roots + std::vector > result; + std::set s; + for (int i = 0; i < n; i++) + if (is_root[i]) + s.insert(i); + if (s.size() != 0) { + result.push_back(s); + while (true) { + std::set s; + for (std::set::iterator i = result[result.size()-1].begin(); i != result[result.size()-1].end(); i++) + s.insert(edges[*i].begin(), edges[*i].end()); + if (s.size() != 0) + result.push_back(s); + else + break; + } + } + + return result; +} + +#endif diff --git a/chill/include/ir_code.hh b/chill/include/ir_code.hh new file mode 100644 index 0000000..1f853fa --- /dev/null +++ b/chill/include/ir_code.hh @@ -0,0 +1,263 @@ +/***************************************************************************** + Copyright (C) 2009-2010 University of Utah + All Rights Reserved. + + Purpose: + CHiLL's compiler intermediate representation interface that extends + Omega's builder interface to accomodate compiler analyses and + extra code generation. +. + Notes: + Unlike CG_outputRepr, IR_Symbol,IR_Ref and IR_Control are place holders + to the underlying code, thus deleting or duplicating them does not affect + the actual code. Similar to Omega builder's memory allocation strategy, + all non-const pointer parameters of CG_outputRepr/IR_Symbol/IR_Ref/IR_Control + are destroyed after the call. + + History: + 02/2009 Created by Chun Chen. + 06/2010 Add IR_Control interface, by chun. +*****************************************************************************/ + +#ifndef IR_CODE_HH +#define IR_CODE_HH + +#include +#include +#include + +enum IR_OPERATION_TYPE {IR_OP_CONSTANT, IR_OP_VARIABLE, + IR_OP_PLUS, IR_OP_MINUS, IR_OP_MULTIPLY, IR_OP_DIVIDE, + IR_OP_POSITIVE, IR_OP_NEGATIVE, + IR_OP_MIN, IR_OP_MAX, + IR_OP_ASSIGNMENT, + IR_OP_NULL, IR_OP_UNKNOWN}; +enum IR_CONTROL_TYPE {IR_CONTROL_LOOP, IR_CONTROL_IF, IR_CONTROL_WHILE, IR_CONTROL_BLOCK}; +enum IR_CONSTANT_TYPE {IR_CONSTANT_INT, IR_CONSTANT_FLOAT, + IR_CONSTANT_UNKNOWN}; +enum IR_CONDITION_TYPE {IR_COND_LT, IR_COND_LE, + IR_COND_GT, IR_COND_GE, + IR_COND_EQ, IR_COND_NE, + IR_COND_UNKNOWN}; +enum IR_ARRAY_LAYOUT_TYPE {IR_ARRAY_LAYOUT_ROW_MAJOR, + IR_ARRAY_LAYOUT_COLUMN_MAJOR, + IR_ARRAY_LAYOUT_SPACE_FILLING}; + +class IR_Code; + + +// Base abstract class for scalar and array symbols. This is a place +// holder for related declaration in IR code. +struct IR_Symbol { + const IR_Code *ir_; + + virtual ~IR_Symbol() {/* ir_ is not the responsibility of this object */} + virtual int n_dim() const = 0; + virtual std::string name() const = 0; + virtual bool operator==(const IR_Symbol &that) const = 0; + virtual bool operator!=(const IR_Symbol &that) const {return !(*this == that);} + virtual IR_Symbol *clone() const = 0; /* shallow copy */ +}; + + +struct IR_ScalarSymbol: public IR_Symbol { + virtual ~IR_ScalarSymbol() {} + int n_dim() const {return 0;} + virtual int size() const = 0; +}; + + +struct IR_ArraySymbol: public IR_Symbol { + virtual ~IR_ArraySymbol() {} + virtual int elem_size() const = 0; + virtual omega::CG_outputRepr *size(int dim) const = 0; + virtual IR_ARRAY_LAYOUT_TYPE layout_type() const = 0; +}; + + +// Base abstract class for scalar and array references. This is a +// place holder for related code in IR code. +struct IR_Ref { + const IR_Code *ir_; + + virtual ~IR_Ref() {/* ir_ is not the responsibility of this object */} + virtual int n_dim() const = 0; + virtual bool is_write() const = 0; + virtual std::string name() const = 0; + virtual bool operator==(const IR_Ref &that) const = 0; + virtual bool operator!=(const IR_Ref &that) const {return !(*this == that);} + virtual omega::CG_outputRepr *convert() = 0; + virtual IR_Ref *clone() const = 0; /* shallow copy */ +}; + + +struct IR_ConstantRef: public IR_Ref { + IR_CONSTANT_TYPE type_; + + virtual ~IR_ConstantRef() {} + int n_dim() const {return 0;} + bool is_write() const {return false;} + std::string name() const {return std::string();} + virtual bool is_integer() const {return type_ == IR_CONSTANT_INT;} + virtual omega::coef_t integer() const = 0; +}; + + +struct IR_ScalarRef: public IR_Ref { + virtual ~IR_ScalarRef() {} + int n_dim() const {return 0;} + virtual IR_ScalarSymbol *symbol() const = 0; + std::string name() const { + IR_ScalarSymbol *sym = symbol(); + std::string s = sym->name(); + delete sym; + return s; + } + virtual int size() const { + IR_ScalarSymbol *sym = symbol(); + int s = sym->size(); + delete sym; + return s; + } +}; + + +struct IR_ArrayRef: public IR_Ref { + virtual ~IR_ArrayRef() {} + int n_dim() const { + IR_ArraySymbol *sym = symbol(); + int n = sym->n_dim(); + delete sym; + return n; + } + virtual omega::CG_outputRepr *index(int dim) const = 0; + virtual IR_ArraySymbol *symbol() const = 0; + std::string name() const { + IR_ArraySymbol *sym = symbol(); + std::string s = sym->name(); + delete sym; + return s; + } + virtual int elem_size() const { + IR_ArraySymbol *sym = symbol(); + int s = sym->elem_size(); + delete sym; + return s; + } + virtual IR_ARRAY_LAYOUT_TYPE layout_type() const { + IR_ArraySymbol *sym = symbol(); + IR_ARRAY_LAYOUT_TYPE t = sym->layout_type(); + delete sym; + return t; + } +}; + + +struct IR_Block; + +// Base abstract class for code structures. This is a place holder +// for the actual structure in the IR code. However, in cases that +// original source code may be transformed during loop initialization +// such as converting a while loop to a for loop or reconstructing the +// loop from low level IR code, the helper loop class (NOT +// IMPLEMENTED) must contain the transformed code that needs to be +// freed when out of service. +struct IR_Control { + const IR_Code *ir_; + + virtual ~IR_Control() {/* ir_ is not the responsibility of this object */} + virtual IR_CONTROL_TYPE type() const = 0; + virtual IR_Block *convert() = 0; + virtual IR_Control *clone() const = 0; /* shallow copy */ +}; + + +struct IR_Loop: public IR_Control { + virtual ~IR_Loop() {} + virtual IR_ScalarSymbol *index() const = 0; + virtual omega::CG_outputRepr *lower_bound() const = 0; + virtual omega::CG_outputRepr *upper_bound() const = 0; + virtual IR_CONDITION_TYPE stop_cond() const = 0; + virtual IR_Block *body() const = 0; + virtual int step_size() const = 0; + IR_CONTROL_TYPE type() const { return IR_CONTROL_LOOP; } +}; + + +struct IR_Block: public IR_Control { + virtual ~IR_Block() {} + virtual omega::CG_outputRepr *extract() const = 0; + IR_Block *convert() {return this;} + IR_CONTROL_TYPE type() const { return IR_CONTROL_BLOCK; } + virtual omega::CG_outputRepr *original() const = 0; +}; + + +struct IR_If: public IR_Control { + virtual ~IR_If() {} + virtual omega::CG_outputRepr *condition() const = 0; + virtual IR_Block *then_body() const = 0; + virtual IR_Block *else_body() const = 0; + IR_CONTROL_TYPE type() const { return IR_CONTROL_IF; } +}; + + + +struct IR_While: public IR_Control { + // NOT IMPLEMENTED +}; + + +// Abstract class for compiler IR. +class IR_Code { +protected: + omega::CG_outputBuilder *ocg_; + omega::CG_outputRepr *init_code_; + omega::CG_outputRepr *cleanup_code_; + +public: + IR_Code() {ocg_ = NULL; init_code_ = cleanup_code_ = NULL;} + virtual ~IR_Code() { delete ocg_; delete init_code_; delete cleanup_code_; } /* the content of init and cleanup code have already been released in derived classes */ + + // memory_type is for differentiating the location of where the new memory is allocated. + // this is useful for processors with heterogeneous memory hierarchy. + virtual IR_ScalarSymbol *CreateScalarSymbol(const IR_Symbol *sym, int memory_type) = 0; + virtual IR_ArraySymbol *CreateArraySymbol(const IR_Symbol *sym, std::vector &size, int memory_type) = 0; + + virtual IR_ScalarRef *CreateScalarRef(const IR_ScalarSymbol *sym) = 0; + virtual IR_ArrayRef *CreateArrayRef(const IR_ArraySymbol *sym, std::vector &index) = 0; + virtual int ArrayIndexStartAt() {return 0;} + + // Array references should be returned in their accessing order. + // e.g. s1: A[i] = A[i-1] + // s2: B[C[i]] = D[i] + E[i] + // return A[i-1], A[i], D[i], E[i], C[i], B[C[i]] in this order. + virtual std::vector FindArrayRef(const omega::CG_outputRepr *repr) const = 0; + virtual std::vector FindScalarRef(const omega::CG_outputRepr *repr) const = 0; + + // If there is no sub structure interesting inside the block, return empty, + // so we know when to stop looking inside. + virtual std::vector FindOneLevelControlStructure(const IR_Block *block) const = 0; + + // All controls must be in the same block, at the same level and in + // contiguous lexical order as appeared in parameter vector. + virtual IR_Block *MergeNeighboringControlStructures(const std::vector &controls) const = 0; + + virtual IR_Block *GetCode() const = 0; + virtual void ReplaceCode(IR_Control *old, omega::CG_outputRepr *repr) = 0; + virtual void ReplaceExpression(IR_Ref *old, omega::CG_outputRepr *repr) = 0; + + virtual IR_OPERATION_TYPE QueryExpOperation(const omega::CG_outputRepr *repr) const = 0; + virtual IR_CONDITION_TYPE QueryBooleanExpOperation(const omega::CG_outputRepr *repr) const = 0; + virtual std::vector QueryExpOperand(const omega::CG_outputRepr *repr) const = 0; + virtual IR_Ref *Repr2Ref(const omega::CG_outputRepr *repr) const = 0; + + //--------------------------------------------------------------------------- + // CC Omega code builder interface here + //--------------------------------------------------------------------------- + omega::CG_outputBuilder *builder() const {return ocg_;} + +}; + +#endif + diff --git a/chill/include/ir_rose.hh b/chill/include/ir_rose.hh new file mode 100644 index 0000000..0c0417a --- /dev/null +++ b/chill/include/ir_rose.hh @@ -0,0 +1,289 @@ +#ifndef IR_ROSE_HH +#define IR_ROSE_HH + +#include +#include "ir_code.hh" +#include "ir_rose_utils.hh" +#include +#include "chill_error.hh" +#include "staticSingleAssignment.h" +#include "VariableRenaming.h" +#include "ssaUnfilteredCfg.h" +#include "virtualCFG.h" +#include + +struct IR_roseScalarSymbol: public IR_ScalarSymbol { + SgVariableSymbol* vs_; + + IR_roseScalarSymbol(const IR_Code *ir, SgVariableSymbol *vs) { + ir_ = ir; + vs_ = vs; + } + + std::string name() const; + int size() const; + bool operator==(const IR_Symbol &that) const; + IR_Symbol *clone() const; +}; + +struct IR_roseArraySymbol: public IR_ArraySymbol { + + SgVariableSymbol* vs_; + + IR_roseArraySymbol(const IR_Code *ir, SgVariableSymbol* vs) { + ir_ = ir; + vs_ = vs; + } + std::string name() const; + int elem_size() const; + int n_dim() const; + omega::CG_outputRepr *size(int dim) const; + bool operator==(const IR_Symbol &that) const; + IR_ARRAY_LAYOUT_TYPE layout_type() const; + IR_Symbol *clone() const; + +}; + +struct IR_roseConstantRef: public IR_ConstantRef { + union { + omega::coef_t i_; + double f_; + }; + + IR_roseConstantRef(const IR_Code *ir, omega::coef_t i) { + ir_ = ir; + type_ = IR_CONSTANT_INT; + i_ = i; + } + IR_roseConstantRef(const IR_Code *ir, double f) { + ir_ = ir; + type_ = IR_CONSTANT_FLOAT; + f_ = f; + } + omega::coef_t integer() const { + assert(is_integer()); + return i_; + } + bool operator==(const IR_Ref &that) const; + omega::CG_outputRepr *convert(); + IR_Ref *clone() const; + +}; + +struct IR_roseScalarRef: public IR_ScalarRef { + SgAssignOp *ins_pos_; + int op_pos_; // -1 means destination operand, otherwise source operand + SgVarRefExp *vs_; + int is_write_; + IR_roseScalarRef(const IR_Code *ir, SgVarRefExp *sym) { + ir_ = ir; + ins_pos_ = isSgAssignOp(sym->get_parent()); + op_pos_ = 0; + if (ins_pos_ != NULL) + if (sym == isSgVarRefExp(ins_pos_->get_lhs_operand())) + op_pos_ = -1; + + vs_ = sym; + } + IR_roseScalarRef(const IR_Code *ir, SgVarRefExp *ins, int pos) { + ir_ = ir; + /* ins_pos_ = ins; + op_pos_ = pos; + SgExpression* op; + if (pos == -1) + op = ins->get_lhs_operand(); + else + op = ins->get_rhs_operand(); + + */ + + is_write_ = pos; + + /* if (vs_ == NULL || pos > 0) + throw ir_error( + "Src operand not a variable or more than one src operand!!"); + */ + + vs_ = ins; + + } + bool is_write() const; + IR_ScalarSymbol *symbol() const; + bool operator==(const IR_Ref &that) const; + omega::CG_outputRepr *convert(); + IR_Ref *clone() const; +}; + +struct IR_roseArrayRef: public IR_ArrayRef { + + SgPntrArrRefExp *ia_; + + int is_write_; + IR_roseArrayRef(const IR_Code *ir, SgPntrArrRefExp *ia, int write) { + ir_ = ir; + ia_ = ia; + is_write_ = write; + } + bool is_write() const; + omega::CG_outputRepr *index(int dim) const; + IR_ArraySymbol *symbol() const; + bool operator==(const IR_Ref &that) const; + omega::CG_outputRepr *convert(); + IR_Ref *clone() const; +}; + +struct IR_roseLoop: public IR_Loop { + SgNode *tf_; + + IR_roseLoop(const IR_Code *ir, SgNode *tf) { + ir_ = ir; + tf_ = tf; + } + + IR_ScalarSymbol *index() const; + omega::CG_outputRepr *lower_bound() const; + omega::CG_outputRepr *upper_bound() const; + IR_CONDITION_TYPE stop_cond() const; + IR_Block *body() const; + IR_Block *convert(); + int step_size() const; + IR_Control *clone() const; +}; + +struct IR_roseBlock: public IR_Block { + SgNode* tnl_; + SgNode *start_, *end_; + + IR_roseBlock(const IR_Code *ir, SgNode *tnl, SgNode *start, SgNode *end) { + ir_ = ir; + tnl_ = tnl; + start_ = start; + end_ = end; + } + + IR_roseBlock(const IR_Code *ir, SgNode *tnl) { + ir_ = ir; + tnl_ = tnl; + start_ = tnl_->get_traversalSuccessorByIndex(0); + end_ = tnl_->get_traversalSuccessorByIndex( + (tnl_->get_numberOfTraversalSuccessors()) - 1); + } + omega::CG_outputRepr *extract() const; + omega::CG_outputRepr *original() const; + IR_Control *clone() const; +}; + +struct IR_roseIf: public IR_If { + SgNode *ti_; + + IR_roseIf(const IR_Code *ir, SgNode *ti) { + ir_ = ir; + ti_ = ti; + } + ~IR_roseIf() { + } + omega::CG_outputRepr *condition() const; + IR_Block *then_body() const; + IR_Block *else_body() const; + IR_Block *convert(); + IR_Control *clone() const; +}; + +class IR_roseCode_Global_Init { +private: + static IR_roseCode_Global_Init *pinstance; +public: + SgProject* project; + static IR_roseCode_Global_Init *Instance(char** argv); +}; + +class IR_roseCode: public IR_Code { +protected: + SgSourceFile* file; + SgGlobal *root; + SgGlobal *firstScope; + SgSymbolTable* symtab_; + SgSymbolTable* symtab2_; + SgSymbolTable* symtab3_; + SgDeclarationStatementPtrList::iterator p; + SgFunctionDeclaration *func; + bool is_fortran_; + int i_; + StaticSingleAssignment *ssa_for_scalar; + ssa_unfiltered_cfg::SSA_UnfilteredCfg *main_ssa; + VariableRenaming *varRenaming_for_scalar; +public: + IR_roseCode(const char *filename, const char* proc_name); + ~IR_roseCode(); + + IR_ScalarSymbol *CreateScalarSymbol(const IR_Symbol *sym, int memory_type = + 0); + IR_ArraySymbol *CreateArraySymbol(const IR_Symbol *sym, + std::vector &size, int memory_type = 0); + IR_ScalarRef *CreateScalarRef(const IR_ScalarSymbol *sym); + IR_ArrayRef *CreateArrayRef(const IR_ArraySymbol *sym, + std::vector &index); + int ArrayIndexStartAt() { + if (is_fortran_) + return 1; + else + return 0; + } + + void populateLists(SgNode* tnl_1, SgStatementPtrList* list_1, + SgStatementPtrList& output_list_1); + void populateScalars(const omega::CG_outputRepr *repr1, + std::map &read_scalars_1, + std::map &write_scalars_1, + std::set &indices, std::vector &index); + // std::set &def_vars); + /*void findDefinitions(SgStatementPtrList &list_1, + std::set &reaching_defs_1, + std::map &write_scalars_1, + std::set &def_vars); + */ + /* void checkDependency(SgStatementPtrList &output_list_1, + std::vector &dvs1, + std::map &read_scalars_1, + std::map &write_scalars_1, + std::vector &index, int i, int j); + void checkSelfDependency(SgStatementPtrList &output_list_1, + std::vector &dvs1, + std::map &read_scalars_1, + std::map &write_scalars_1, + std::vector &index, int i, int j); + void checkWriteDependency(SgStatementPtrList &output_list_1, + std::vector &dvs1, + std::map &read_scalars_1, + std::map &write_scalars_1, + std::vector &index, int i, int j); + */ + std::vector FindArrayRef( + const omega::CG_outputRepr *repr) const; + std::vector FindScalarRef( + const omega::CG_outputRepr *repr) const; + std::vector FindOneLevelControlStructure( + const IR_Block *block) const; + IR_Block *MergeNeighboringControlStructures( + const std::vector &controls) const; + IR_Block *GetCode() const; + void ReplaceCode(IR_Control *old, omega::CG_outputRepr *repr); + void ReplaceExpression(IR_Ref *old, omega::CG_outputRepr *repr); + + IR_OPERATION_TYPE QueryExpOperation(const omega::CG_outputRepr *repr) const; + IR_CONDITION_TYPE QueryBooleanExpOperation( + const omega::CG_outputRepr *repr) const; + std::vector QueryExpOperand( + const omega::CG_outputRepr *repr) const; + IR_Ref *Repr2Ref(const omega::CG_outputRepr *) const; + /* std::pair, std::vector > + FindScalarDeps(const omega::CG_outputRepr *repr1, + const omega::CG_outputRepr *repr2, std::vector index, + int i, int j); + */ + void finalizeRose(); + friend class IR_roseArraySymbol; + friend class IR_roseArrayRef; +}; + +#endif diff --git a/chill/include/ir_rose_utils.hh b/chill/include/ir_rose_utils.hh new file mode 100644 index 0000000..9e98aee --- /dev/null +++ b/chill/include/ir_rose_utils.hh @@ -0,0 +1,18 @@ +#ifndef IR_ROSE_UTILS_HH +#define IR_ROSE_UTILS_HH +#include +#include +#include "sageBuilder.h" + + + +std::vector find_deepest_loops(SgNode *tnl); +std::vector find_loops(SgNode *tnl); + + + +SgNode* loop_body_at_level(SgNode* tnl, int level); +SgNode* loop_body_at_level(SgForStatement* loop, int level); +void swap_node_for_node_list(SgNode* tn, SgNode* new_tnl); + +#endif diff --git a/chill/include/irtools.hh b/chill/include/irtools.hh new file mode 100644 index 0000000..8dc8e28 --- /dev/null +++ b/chill/include/irtools.hh @@ -0,0 +1,40 @@ +#ifndef IRTOOLS_HH +#define IRTOOLS_HH + +#include +#include +#include +#include "ir_code.hh" +#include "dep.hh" + +// IR tree is used to initialize a loop. For a loop node, payload is +// its mapped iteration space dimension. For a simple block node, +// payload is its mapped statement number. Normal if-else is splitted +// into two nodes where the one with odd payload represents then-part and +// the one with even payload represents else-part. +struct ir_tree_node { + IR_Control *content; + ir_tree_node *parent; + std::vector children; + int payload; + + ~ir_tree_node() { + for (int i = 0; i < children.size(); i++) + delete children[i]; + delete content; + } +}; + +std::vector build_ir_tree(IR_Control *control, + ir_tree_node *parent = NULL); +std::vector extract_ir_stmts( + const std::vector &ir_tree); +bool is_dependence_valid(ir_tree_node *src_node, ir_tree_node *dst_node, + const DependenceVector &dv, bool before); +std::pair, std::vector > test_data_dependences( + IR_Code *ir, const omega::CG_outputRepr *repr1, + const omega::Relation &IS1, const omega::CG_outputRepr *repr2, + const omega::Relation &IS2, std::vector &freevar, + std::vector index, int i, int j); + +#endif diff --git a/chill/include/loop.hh b/chill/include/loop.hh new file mode 100644 index 0000000..c3366ef --- /dev/null +++ b/chill/include/loop.hh @@ -0,0 +1,168 @@ +#ifndef LOOP_HH +#define LOOP_HH + +#include +#include +#include +#include +#include +#include +#include "dep.hh" +#include "ir_code.hh" +#include "irtools.hh" + +class IR_Code; + +enum TilingMethodType { StridedTile, CountedTile }; +enum LoopLevelType { LoopLevelOriginal, LoopLevelTile, LoopLevelUnknown }; + + +// Describes properties of each loop level of a statement. "payload" +// for LoopLevelOriginal means iteration space dimension, for +// LoopLevelTile means tiled loop level. Special value -1 for +// LoopLevelTile means purely derived loop. For dependence dimension +// payloads, the values must be in an increasing order. +// "parallel_level" will be used by code generation to support +// multi-level parallelization (default 0 means sequential loop under +// the current parallelization level). +struct LoopLevel { + LoopLevelType type; + int payload; + int parallel_level; +}; + +struct Statement { + omega::CG_outputRepr *code; + omega::Relation IS; + omega::Relation xform; + std::vector loop_level; + ir_tree_node *ir_stmt_node; + //protonu--temporarily putting this back here + //omega::Tuple nonSplitLevels; + //end--protonu. +}; + + +class Loop { +protected: + int tmp_loop_var_name_counter; + static const std::string tmp_loop_var_name_prefix; + int overflow_var_name_counter; + static const std::string overflow_var_name_prefix; + std::vector stmt_nesting_level_; + std::vector index; + std::map replace; + +public: + IR_Code *ir; + std::vector freevar; + std::vector stmt; + std::vector ir_stmt; + std::vector ir_tree; + DependenceGraph dep; + int num_dep_dim; + omega::Relation known; + omega::CG_outputRepr *init_code; + omega::CG_outputRepr *cleanup_code; + std::map > overflow; + + +protected: + mutable omega::CodeGen *last_compute_cg_; + mutable omega::CG_result *last_compute_cgr_; + mutable int last_compute_effort_; + +protected: + bool init_loop(std::vector &ir_tree, std::vector &ir_stmt); + int get_dep_dim_of(int stmt, int level) const; + int get_last_dep_dim_before(int stmt, int level) const; + std::vector getNewIS() const; + omega::Relation getNewIS(int stmt_num) const; + std::vector getLexicalOrder(int stmt_num) const; + int getLexicalOrder(int stmt_num, int level) const; + std::set getStatements(const std::vector &lex, int dim) const; + void shiftLexicalOrder(const std::vector &lex, int dim, int amount); + void setLexicalOrder(int dim, const std::set &active, int starting_order = 0, std::vector< std::vector >idxNames= std::vector< std::vector >()); + void apply_xform(int stmt_num); + void apply_xform(std::set &active); + void apply_xform(); + std::set getSubLoopNest(int stmt_num, int level) const; + + +public: + Loop() { ir = NULL; tmp_loop_var_name_counter = 1; init_code = NULL; } + Loop(const IR_Control *control); + ~Loop(); + + omega::CG_outputRepr *getCode(int effort = 1) const; + void printCode(int effort = 1) const; + void addKnown(const omega::Relation &cond); + void print_internal_loop_structure() const; + bool isInitialized() const; + int num_statement() const { return stmt.size(); } + void printIterationSpace() const; + void printDependenceGraph() const; + void removeDependence(int stmt_num_from, int stmt_num_to); + void dump() const; + + std::vector > sort_by_same_loops(std::set active, int level); + // + // legacy unimodular transformations for perfectly nested loops + // e.g. M*(i,j)^T = (i',j')^T or M*(i,j,1)^T = (i',j')^T + // + bool nonsingular(const std::vector > &M); + + // + // high-level loop transformations + // + void permute(const std::set &active, const std::vector &pi); + void permute(int stmt_num, int level, const std::vector &pi); + void permute(const std::vector &pi); + void original(); + + void tile(int stmt_num, int level, int tile_size, int outer_level = 1, TilingMethodType method = StridedTile, int alignment_offset = 0, int alignment_multiple = 1); + std::set split(int stmt_num, int level, const omega::Relation &cond); + std::set unroll(int stmt_num, int level, int unroll_amount, std::vector< std::vector >idxNames= std::vector< std::vector >(), int cleanup_split_level = 0); + + bool datacopy(const std::vector > > &array_ref_nums, int level, bool allow_extra_read = false, int fastest_changing_dimension = -1, int padding_stride = 1, int padding_alignment = 4, int memory_type = 0); + bool datacopy(int stmt_num, int level, const std::string &array_name, bool allow_extra_read = false, int fastest_changing_dimension = -1, int padding_stride = 1, int padding_alignment = 4, int memory_type = 0); + bool datacopy_privatized(int stmt_num, int level, const std::string &array_name, const std::vector &privatized_levels, bool allow_extra_read = false, int fastest_changing_dimension = -1, int padding_stride = 1, int padding_alignment = 1, int memory_type = 0); + bool datacopy_privatized(const std::vector > > &array_ref_nums, int level, const std::vector &privatized_levels, bool allow_extra_read = false, int fastest_changing_dimension = -1, int padding_stride = 1, int padding_alignment = 1, int memory_type = 0); + bool datacopy_privatized(const std::vector > > &stmt_refs, int level, const std::vector &privatized_levels, bool allow_extra_read, int fastest_changing_dimension, int padding_stride, int padding_alignment, int memory_type = 0); + //std::set scalar_replacement_inner(int stmt_num); + + + + Graph, bool> construct_induced_graph_at_level(std::vector > s, DependenceGraph dep, int dep_dim); + std::vector > typed_fusion(Graph, bool> g); + void fuse(const std::set &stmt_nums, int level); + void distribute(const std::set &stmt_nums, int level); + void skew(const std::set &stmt_nums, int level, const std::vector &skew_amount); + void shift(const std::set &stmt_nums, int level, int shift_amount); + void scale(const std::set &stmt_nums, int level, int scale_amount); + void reverse(const std::set &stmt_nums, int level); + void peel(int stmt_num, int level, int peel_amount = 1); + // + // more fancy loop transformations + // + void modular_shift(int stmt_num, int level, int shift_amount) {} + void diagonal_map(int stmt_num, const std::pair &levels, int offset) {} + void modular_partition(int stmt_num, int level, int stride) {} + + // + // derived loop transformations + // + void shift_to(int stmt_num, int level, int absolute_position); + std::set unroll_extra(int stmt_num, int level, int unroll_amount, int cleanup_split_level = 0); + bool is_dependence_valid_based_on_lex_order(int i, int j, + const DependenceVector &dv, bool before); + // + // other public operations + // + void pragma(int stmt_num, int level, const std::string &pragmaText); + void prefetch(int stmt_num, int level, const std::string &arrName, int hint); + //void prefetch(int stmt_num, int level, const std::string &arrName, const std::string &indexName, int offset, int hint); +}; + + +#endif diff --git a/chill/include/omegatools.hh b/chill/include/omegatools.hh new file mode 100644 index 0000000..206079c --- /dev/null +++ b/chill/include/omegatools.hh @@ -0,0 +1,97 @@ +#ifndef OMEGATOOLS_HH +#define OMEGATOOLS_HH + +#include +#include +#include "dep.hh" +#include "ir_code.hh" + +std::string tmp_e(); + +void exp2formula(IR_Code *ir, omega::Relation &r, omega::F_And *f_root, + std::vector &freevars, + omega::CG_outputRepr *repr, omega::Variable_ID lhs, char side, + IR_CONDITION_TYPE rel, bool destroy); +omega::Relation arrays2relation(IR_Code *ir, std::vector &freevars, + const IR_ArrayRef *ref_src, const omega::Relation &IS_w, + const IR_ArrayRef *ref_dst, const omega::Relation &IS_r); +std::pair, std::vector > relation2dependences( + const IR_ArrayRef *ref_src, const IR_ArrayRef *ref_dst, const omega::Relation &r); + +void exp2constraint(IR_Code *ir, omega::Relation &r, omega::F_And *f_root, + std::vector &freevars, + omega::CG_outputRepr *repr, bool destroy); + +// suif legacy code +// void suif2formula(Relation &r, F_And *f_root, +// std::vector &freevars, +// operand op, Variable_ID lhs, +// char side, char rel); +// void suif2formula(Relation &r, F_And *f_root, +// std::vector &freevars, +// instruction *ins, Variable_ID lhs, +// char side, char rel); +// void add_loop_stride_constraints(omega::Relation &r, omega::F_And *f_root, +// std::vector &freevars, +// tree_for *tnf, char side); +// void add_loop_bound_constraints(IR_Code *ir, omega::Relation &r, omega::F_And *f_root, +// std::vector &freevars, +// tree_for *tnf, +// char upper_or_lower, char side, IR_CONDITION_TYPE rel); +// Relation loop_iteration_space(std::vector &freevars, +// tree_node *tn, std::vector &loops); + +// Relation arrays2relation(std::vector &freevars, +// in_array *ia_w, const Relation &IS1, +// in_array *ia_r, const Relation &IS2); +// std::vector relation2dependences(IR_Code *ir, in_array *ia_w, +// in_array *ia_r, const Relation &r); + +// end of suif legacy code + +bool is_single_iteration(const omega::Relation &r, int dim); +void assign_const(omega::Relation &r, int dim, int val); +int get_const(const omega::Relation &r, int dim, omega::Var_Kind type); +omega::Variable_ID find_index(omega::Relation &r, const std::string &s, char side); +omega::Relation permute_relation(const std::vector &pi); +omega::Relation get_loop_bound(const omega::Relation &r, int dim); +bool is_single_loop_iteration(const omega::Relation &r, int level, const omega::Relation &known); +omega::Relation get_loop_bound(const omega::Relation &r, int level, const omega::Relation &known); +omega::Relation get_max_loop_bound(const std::vector &r, int dim); +omega::Relation get_min_loop_bound(const std::vector &r, int dim); +void add_loop_stride(omega::Relation &r, const omega::Relation &bound, int dim, int stride); +bool is_inner_loop_depend_on_level(const omega::Relation &r, int level, const omega::Relation &known); +// void adjust_loop_bound(omega::Relation &r, int dim, int adjustment, std::vector globals = std::vector()); +omega::Relation adjust_loop_bound(const omega::Relation &r, int level, int adjustment); +// void adjust_loop_bound(Relation &r, int dim, int adjustment); +// void adjust_loop_bound(Relation &r, int dim, Free_Var_Decl *global_var, int adjustment); +// boolean is_private_statement(const omega::Relation &r, int dim); + +// coef_t mod(const Relation &r, Variable_ID v, int dividend); + + +enum LexicalOrderType {LEX_MATCH, LEX_BEFORE, LEX_AFTER, LEX_UNKNOWN}; + +// template +// LexicalOrderType lexical_order(const std::vector &a, const std::vector &b) { +// int size = min(a.size(), b.size()); +// for (int i = 0; i < size; i++) { +// if (a[i] < b[i]) +// return LEX_BEFORE; +// else if (b[i] < a[i]) +// return LEX_AFTER; +// } +// if (a.size() < b.size()) +// return LEX_BEFORE; +// else if (b.size() < a.size()) +// return LEX_AFTER; +// else +// return LEX_MATCH; +// } + +// struct LoopException { +// std::string descr; +// LoopException(const std::string &s): descr(s) {}; +// }; + +#endif diff --git a/chill/src/chill_run.cc b/chill/src/chill_run.cc new file mode 100644 index 0000000..59cd6e5 --- /dev/null +++ b/chill/src/chill_run.cc @@ -0,0 +1,394 @@ +#include "chilldebug.h" + +// this is a little messy. the Makefile should be able to define one or the other +#ifndef PYTHON +#ifndef LUA +#define LUA +#endif +#endif + +#include +#include +#include +#include + +//#include "chill_env.hh" + +#include "loop.hh" +#include +#include "ir_code.hh" + +#ifdef CUDACHILL + +#ifdef BUILD_ROSE +#include "loop_cuda_rose.hh" +#include "ir_cudarose.hh" +#elif BUILD_SUIF +#include "loop_cuda.hh" +#include "ir_cudasuif.hh" +#endif + +#else + +#ifdef BUILD_ROSE +#include "ir_rose.hh" +#elif BUILD_SUIF +#include "ir_suif.hh" +#endif + +#endif + +#ifdef LUA +#define lua_c //Get the configuration defines for doing an interactive shell +#include //All lua includes wrapped in extern "C" +#include "chill_env.hh" // Lua wrapper functions for CHiLL +#elif PYTHON +#include "chillmodule.hh" // Python wrapper functions for CHiLL +#endif + +//--- +// CHiLL globals +//--- +Loop *myloop = NULL; +IR_Code *ir_code = NULL; +bool repl_stop = false; +bool is_interactive = false; + +std::vector ir_controls; +std::vector loops; + +// this whole section belongs somewhere else +#ifdef LUA +//--- +// Interactive mode functions, directly copied out of lua.c +//--- +// The Lua interpreter state +static lua_State *globalL = NULL; +static const char *progname = "CHiLL"; + +static void lstop (lua_State *L, lua_Debug *ar) { + (void)ar; /* unused arg. */ + lua_sethook(L, NULL, 0, 0); + luaL_error(L, "interrupted!"); +} + + +static void laction (int i) { + signal(i, SIG_DFL); /* if another SIGINT happens before lstop, + terminate process (default action) */ + lua_sethook(globalL, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1); +} + + +static void l_message (const char *pname, const char *msg) { + if (pname) fprintf(stderr, "%s: ", pname); + fprintf(stderr, "%s\n", msg); + fflush(stderr); // ? does this do anything ? +} + + +static int report (lua_State *L, int status) { + if (status && !lua_isnil(L, -1)) { + const char *msg = lua_tostring(L, -1); + if (msg == NULL) msg = "(error object is not a string)"; + l_message(progname, msg); + lua_pop(L, 1); + } + return status; +} + + +static int traceback (lua_State *L) { + if (!lua_isstring(L, 1)) /* 'message' not a string? */ + return 1; /* keep it intact */ + lua_getfield(L, LUA_GLOBALSINDEX, "debug"); + if (!lua_istable(L, -1)) { + lua_pop(L, 1); + return 1; + } + lua_getfield(L, -1, "traceback"); + if (!lua_isfunction(L, -1)) { + lua_pop(L, 2); + return 1; + } + lua_pushvalue(L, 1); /* pass error message */ + lua_pushinteger(L, 2); /* skip this function and traceback */ + lua_call(L, 2, 1); /* call debug.traceback */ + return 1; +} + + +static int docall (lua_State *L, int narg, int clear) { + DEBUG_PRINT("\ndocall()\n"); + int status; + int base = lua_gettop(L) - narg; /* function index */ + lua_pushcfunction(L, traceback); /* push traceback function */ + lua_insert(L, base); /* put it under chunk and args */ + signal(SIGINT, laction); + + DEBUG_PRINT("status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base);\n"); + + status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base); + signal(SIGINT, SIG_DFL); + lua_remove(L, base); /* remove traceback function */ + /* force a complete garbage collection in case of errors */ + if (status != 0) lua_gc(L, LUA_GCCOLLECT, 0); + return status; +} + +static int dofile (lua_State *L, const char *name) { + int status = luaL_loadfile(L, name) || docall(L, 0, 1); + return report(L, status); +} + +static const char *get_prompt (lua_State *L, int firstline) { + const char *p; + lua_getfield(L, LUA_GLOBALSINDEX, firstline ? "_PROMPT" : "_PROMPT2"); + p = lua_tostring(L, -1); + if (p == NULL) p = (firstline ? LUA_PROMPT : LUA_PROMPT2); + lua_pop(L, 1); /* remove global */ + return p; +} + + +static int incomplete (lua_State *L, int status) { + if (status == LUA_ERRSYNTAX) { + size_t lmsg; + const char *msg = lua_tolstring(L, -1, &lmsg); + const char *tp = msg + lmsg - (sizeof(LUA_QL("")) - 1); + if (strstr(msg, LUA_QL("")) == tp) { + lua_pop(L, 1); + return 1; + } + } + return 0; /* else... */ +} + + +static int pushline (lua_State *L, int firstline) { + char buffer[LUA_MAXINPUT]; + char *b = buffer; + size_t l; + const char *prmt = get_prompt(L, firstline); + if (lua_readline(L, b, prmt) == 0) + return 0; /* no input */ + l = strlen(b); + if (l > 0 && b[l-1] == '\n') /* line ends with newline? */ + b[l-1] = '\0'; /* remove it */ + if (firstline && b[0] == '=') /* first line starts with `=' ? */ + lua_pushfstring(L, "return %s", b+1); /* change it to `return' */ + else + lua_pushstring(L, b); + lua_freeline(L, b); + return 1; +} + + +static int loadline (lua_State *L) { + int status; + lua_settop(L, 0); + if (!pushline(L, 1)) + return -1; /* no input */ + for (;;) { /* repeat until gets a complete line */ + status = luaL_loadbuffer(L, lua_tostring(L, 1), lua_strlen(L, 1), "=stdin"); + if (!incomplete(L, status)) break; /* cannot try to add lines? */ + if (!pushline(L, 0)) /* no more input? */ + return -1; + lua_pushliteral(L, "\n"); /* add a new line... */ + lua_insert(L, -2); /* ...between the two lines */ + lua_concat(L, 3); /* join them */ + } + lua_saveline(L, 1); + lua_remove(L, 1); /* remove line */ + return status; +} + + +static void dotty (lua_State *L) { + int status; + const char *oldprogname = progname; + progname = NULL; + while ((status = loadline(L)) != -1) { + if (status == 0) status = docall(L, 0, 0); + report(L, status); + if(repl_stop) + break; + if (status == 0 && lua_gettop(L) > 0) { /* any result to print? */ + lua_getglobal(L, "print"); + lua_insert(L, 1); + if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != 0) + l_message(progname, lua_pushfstring(L, + "error calling " LUA_QL("print") " (%s)", + lua_tostring(L, -1))); + } + } + lua_settop(L, 0); /* clear stack */ + fputs("\n", stdout); + fflush(stdout); + progname = oldprogname; +} +#endif + +//--- +//--- + +//--- +// CHiLL program main +// Initialize state and run script or interactive mode +//--- +int main( int argc, char* argv[] ) +{ + DEBUG_PRINT("%s main()\n", argv[0]); + if (argc > 2) { + fprintf(stderr, "Usage: %s [script_file]\n", argv[0]); + exit(-1); + } + + int fail = 0; + +#ifdef PYTHON + // Create PYTHON interpreter + /* Pass argv[0] to the Python interpreter */ + Py_SetProgramName(argv[0]); + + /* Initialize the Python interpreter. Required. */ + Py_Initialize(); + + /* Add a static module */ + initchill(); + + if (argc == 2) { +/* #ifdef CUDACHILL --- This code is for translating lua to python before interprating. --- + //DEBUG_PRINT("\ncalling python\n"); + // file interpretlua.py has routines to read the lua transformation file + PyRun_SimpleString("from interpretlua import *"); + //DEBUG_PRINT("DONE calling python import of functions\n\n"); + char pythoncommand[800]; + sprintf(pythoncommand, "\n\ndopytransform(\"%s\")\0", argv[1]); + //DEBUG_PRINT("in C, running python command '%s'\n", pythoncommand); + + PyRun_SimpleString( pythoncommand ); + #else*/ + FILE* f = fopen(argv[1], "r"); + if(!f){ + printf("can't open script file \"%s\"\n", argv[1]); + exit(-1); + } + PyRun_SimpleFile(f, argv[1]); + fclose(f); + } + if (argc == 1) { + //--- + // Run a CHiLL interpreter + //--- + printf("CHiLL v0.2.1 (built on %s)\n", CHILL_BUILD_DATE); + printf("Copyright (C) 2008 University of Southern California\n"); + printf("Copyright (C) 2009-2012 University of Utah\n"); + //is_interactive = true; // let the lua interpreter know. + fflush(stdout); + // TODO: read lines of python code. + //Not sure if we should set fail from interactive mode + printf("CHiLL ending...\n"); + fflush(stdout); + } + + //printf("DONE with PyRun_SimpleString()\n"); +// #endif --- endif for CUDACHILL --- +#endif + //END python setup +#ifdef LUA + + //Create interpreter + lua_State* L = lua_open(); + globalL = L; + + //Initialize the std libs + luaL_openlibs(L); + + //Initialize globals + register_globals(L); + + //Register CHiLL functions + register_functions(L); + + if (argc == 2) { + //--- + // Run a CHiLL script from a file + //--- + + //Check that the file can be opened + FILE* f = fopen(argv[1],"r"); + if(!f){ + printf("can't open script file \"%s\"\n", argv[1]); + exit(-1); + } + fclose(f); + + DEBUG_PRINT("\n*********************evaluating file '%s'\n", argv[1]); + + //Evaluate the file + fail = dofile(L, argv[1]); + if(!fail){ + fprintf(stderr, "script success!\n"); + } + } + if (argc == 1 && isatty((int)fileno(stdin))) { + //--- + // Run a CHiLL interpreter + //--- + printf("CUDA-CHiLL v0.2.1 (built on %s)\n", CHILL_BUILD_DATE); + printf("Copyright (C) 2008 University of Southern California\n"); + printf("Copyright (C) 2009-2012 University of Utah\n"); + is_interactive = true; // let the lua interpreter know. + fflush(stdout); + dotty(L); + //Not sure if we should set fail from interactive mode + printf("CUDA-CHiLL ending...\n"); + fflush(stdout); + } +#endif + + + if (!fail && ir_code != NULL && myloop != NULL && myloop->stmt.size() != 0 && !myloop->stmt[0].xform.is_null()) { +#ifdef CUDACHILL + int lnum; + #ifdef PYTHON + lnum = 0; + #else + lnum = get_loop_num( L ); + #endif + #ifdef BUILD_ROSE + ((IR_cudaroseCode *)(ir_code))->commit_loop(myloop, lnum); + #elif BUILD_SUIF + ((IR_cudasuifCode *)(ir_code))->commit_loop(myloop, lnum); + #endif +#else + int lnum_start; + int lnum_end; + #ifdef PYTHON + lnum_start = get_loop_num_start(); + lnum_end = get_loop_num_end(); + DEBUG_PRINT("calling ROSE code gen? loop num %d\n", lnum); + #else + lnum_start = get_loop_num_start(L); + lnum_end = get_loop_num_end(L); + DEBUG_PRINT("calling ROSE code gen? loop num %d - %d\n", lnum_start, lnum_end); + #endif +#endif + #ifdef BUILD_ROSE + finalize_loop(lnum_start, lnum_end); + //((IR_roseCode*)(ir_cide))->commit_loop(myloop, lnum); + ((IR_roseCode*)(ir_code))->finalizeRose(); + //#elif BUILD_SUIF + //((IR_suifCode*)(ir_code))->commit_loop(myloop, lnum); + #endif + delete ir_code; + } +#ifdef PYTHON + Py_Finalize(); +#endif +#ifdef LUA + lua_close(L); +#endif + return 0; +} diff --git a/chill/src/chill_run_util.cc b/chill/src/chill_run_util.cc new file mode 100644 index 0000000..566bc61 --- /dev/null +++ b/chill/src/chill_run_util.cc @@ -0,0 +1,129 @@ +#include +#include +#include "chill_run_util.hh" + +static std::string to_string(int ival) { + char buffer[4]; + sprintf(buffer, "%d", ival); + return std::string(buffer); +} + +simap_vec_t* make_prog(simap_vec_t* cond) { + return cond; +} + +simap_vec_t* make_cond_gt(simap_t* lhs, simap_t* rhs) { + simap_vec_t* nvec = new simap_vec_t(); + for(simap_t::iterator it = rhs->begin(); it != rhs->end(); it++) + (*lhs)[it->first] -= it->second; + (*lhs)[to_string(0)] -= 1; + nvec->push_back(*lhs); + delete rhs; + delete lhs; + return nvec; +} + +simap_vec_t* make_cond_lt(simap_t* lhs, simap_t* rhs) { + return make_cond_gt(rhs, lhs); +} + +simap_vec_t* make_cond_ge(simap_t* lhs, simap_t* rhs) { + simap_vec_t* nvec = new simap_vec_t(); + for(simap_t::iterator it = rhs->begin(); it != rhs->end(); it++) + (*lhs)[it->first] -= it->second; + nvec->push_back(*lhs); + delete rhs; + delete lhs; + return nvec; +} + +simap_vec_t* make_cond_le(simap_t* lhs, simap_t* rhs) { + return make_cond_ge(rhs, lhs); +} + +simap_vec_t* make_cond_eq(simap_t* lhs, simap_t* rhs) { + simap_vec_t* nvec = new simap_vec_t(); + for(simap_t::iterator it = lhs->begin(); it != lhs->end(); it++) + (*rhs)[it->first] -= it->second; + nvec->push_back(*rhs); + for(simap_t::iterator it = rhs->begin(); it != rhs->end(); it++) + it->second = -it->second; + nvec->push_back(*rhs); + delete rhs; + delete lhs; + return nvec; +} + +simap_t* make_cond_item_add(simap_t* lhs, simap_t* rhs) { + for(simap_t::iterator it = lhs->begin(); it != lhs->end(); it++) + (*rhs)[it->first] += it->second; + delete lhs; + return rhs; +} + +simap_t* make_cond_item_sub(simap_t* lhs, simap_t* rhs) { + for(simap_t::iterator it = lhs->begin(); it != lhs->end(); it++) + (*rhs)[it->first] -= it->second; + delete lhs; + return rhs; +} + +simap_t* make_cond_item_mul(simap_t* lhs, simap_t* rhs) { + (*lhs)[to_string(0)] += 0; + (*rhs)[to_string(0)] += 0; + if(rhs->size() == 1) { + int t = (*rhs)[to_string(0)]; + for(simap_t::iterator it = lhs->begin(); it != lhs->end(); it++) + it->second *= t; + delete rhs; + return lhs; + } + else if(rhs->size() == 1) { + int t = (*lhs)[to_string(0)]; + for(simap_t::iterator it = rhs->begin(); it != rhs->end(); it++) + it->second *= t; + delete lhs; + return rhs; + } + else { + fprintf(stderr, "require Presburger formula"); + delete lhs; + delete rhs; + // exit(2); <-- this may be a boost feature + } +} + +simap_t* make_cond_item_neg(simap_t* expr) { + for (simap_t::iterator it = expr->begin(); it != expr->end(); it++) { + it->second = -(it->second); + } + return expr; +} + +simap_t* make_cond_item_number(int n) { + simap_t* nmap = new simap_t(); + (*nmap)[to_string(0)] = n; + return nmap; +} + +simap_t* make_cond_item_variable(const char* var) { + simap_t* nmap = new simap_t(); + (*nmap)[std::string(var)] = 1; + return nmap; +} + +simap_t* make_cond_item_level(int n) { + simap_t* nmap = new simap_t(); + (*nmap)[to_string(n)] = 1; + return nmap; +} + +/*simap_t* make_cond_item_variable(const char* varname) { + simap_t* nmap = new simap_t(); +#ifdef PYTHON + PyObject* globals = PyEval_GetGlobals(); + PyObject* itemval = PyDict_GetItemString(globals, varname); + +#elif LUA +#endif +}*/ diff --git a/chill/src/chillmodule.cc b/chill/src/chillmodule.cc new file mode 100644 index 0000000..fbeb477 --- /dev/null +++ b/chill/src/chillmodule.cc @@ -0,0 +1,1834 @@ + +// chill interface to python + +#include "chilldebug.h" + +#ifdef CUDACHILL + +#include "rose.h" // ?? +#include "loop_cuda_rose.hh" +#include "ir_rose.hh" +#include "ir_cudarose.hh" + +#include + +#else + +#include "chill_run_util.hh" + +#include +#include +#include +#include + +#include +#include "loop.hh" +#include "ir_code.hh" +#ifdef BUILD_ROSE +#include "ir_rose.hh" +#elif BUILD_SUIF +#include "ir_suif.hh" +#endif + +#endif + +#include "chillmodule.hh" + +// TODO +#undef _POSIX_C_SOURCE +#undef _XOPEN_SOURCE +#include + +using namespace omega; + +// -- Cuda CHiLL global variables -- +#ifdef CUDACHILL + +extern LoopCuda *myloop; +extern IR_Code *ir_code; +extern std::vector ir_controls; +extern std::vector loops; + +#else + +extern Loop *myloop; +extern IR_Code *ir_code; +extern bool is_interactive; +extern bool repl_stop; + +std::string procedure_name; +std::string source_filename; + +int loop_start_num; +int loop_end_num; + +extern std::vector ir_controls; +extern std::vector loops; + +#endif + +// ----------------------- // +// CHiLL support functions // +// ----------------------- // +#ifndef CUDACHILL +// not sure yet if this actually needs to be exposed to the python interface +// these four functions are here to maintain similarity to the Lua interface +int get_loop_num_start() { + return loop_start_num; +} + +int get_loop_num_end() { + return loop_end_num; +} + +static void set_loop_num_start(int start_num) { + loop_start_num = start_num; +} + +static void set_loop_num_end(int end_num) { + loop_end_num = end_num; +} + +// TODO: finalize_loop(int,int) and init_loop(int,int) are identical to thier Lua counterparts. +// consider integrating them + +void finalize_loop(int loop_num_start, int loop_num_end) { + if (loop_num_start == loop_num_end) { + ir_code->ReplaceCode(ir_controls[loops[loop_num_start]], myloop->getCode()); + ir_controls[loops[loop_num_start]] = NULL; + } + else { + std::vector parm; + for (int i = loops[loop_num_start]; i <= loops[loop_num_end]; i++) + parm.push_back(ir_controls[i]); + IR_Block *block = ir_code->MergeNeighboringControlStructures(parm); + ir_code->ReplaceCode(block, myloop->getCode()); + for (int i = loops[loop_num_start]; i <= loops[loop_num_end]; i++) { + delete ir_controls[i]; + ir_controls[i] = NULL; + } + } + delete myloop; +} +void finalize_loop() { + int loop_num_start = get_loop_num_start(); + int loop_num_end = get_loop_num_end(); + finalize_loop(loop_num_start, loop_num_end); +} +static void init_loop(int loop_num_start, int loop_num_end) { + if (source_filename.empty()) { + fprintf(stderr, "source file not set when initializing the loop"); + if (!is_interactive) + exit(2); + } + else { + if (ir_code == NULL) { + #ifdef BUILD_ROSE + if (procedure_name.empty()) + procedure_name = "main"; + #elif BUILD_SUIF + if (procedure_number == -1) + procedure_number = 0; + #endif + + #ifdef BUILD_ROSE + ir_code = new IR_roseCode(source_filename.c_str(), procedure_name.c_str()); + #elif BUILD_SUIF + ir_code = new IR_suifCode(source_filename.c_str(), procedure_name.c_str()); + #endif + + IR_Block *block = ir_code->GetCode(); + ir_controls = ir_code->FindOneLevelControlStructure(block); + for (int i = 0; i < ir_controls.size(); i++) { + if (ir_controls[i]->type() == IR_CONTROL_LOOP) + loops.push_back(i); + } + delete block; + } + if (myloop != NULL && myloop->isInitialized()) { + finalize_loop(); + } + } + set_loop_num_start(loop_num_start); + set_loop_num_end(loop_num_end); + if (loop_num_end < loop_num_start) { + fprintf(stderr, "the last loop must be after the start loop"); + if (!is_interactive) + exit(2); + } + if (loop_num_end >= loops.size()) { + fprintf(stderr, "loop %d does not exist", loop_num_end); + if (!is_interactive) + exit(2); + } + std::vector parm; + for (int i = loops[loop_num_start]; i <= loops[loop_num_end]; i++) { + if (ir_controls[i] == NULL) { + fprintf(stderr, "loop has already been processed"); + if (!is_interactive) + exit(2); + } + parm.push_back(ir_controls[i]); + } + IR_Block *block = ir_code->MergeNeighboringControlStructures(parm); + myloop = new Loop(block); + delete block; + //if (is_interactive) printf("%s ", PROMPT_STRING); +} +#endif + +// ----------------------- // +// Python support funcions // +// ----------------------- // + +// -- CHiLL support -- // +static void strict_arg_num(PyObject* args, int arg_num, const char* fname = NULL) { + int arg_given = PyTuple_Size(args); + char msg[128]; + if(arg_num != arg_given) { + if(fname) + sprintf(msg, "%s: expected %i arguments, was given %i.", fname, arg_num, arg_given); + else + sprintf(msg, "Expected %i argumets, was given %i.", arg_num, arg_given); + throw std::runtime_error(msg); + } +} + +static int strict_arg_range(PyObject* args, int arg_min, int arg_max, const char* fname = NULL) { + int arg_given = PyTuple_Size(args); + char msg[128]; + if(arg_given < arg_min || arg_given > arg_max) { + if(fname) + sprintf(msg, "%s: expected %i to %i arguments, was given %i.", fname, arg_min, arg_max, arg_given); + else + sprintf(msg, "Expected %i to %i, argumets, was given %i.", arg_min, arg_max, arg_given); + throw std::runtime_error(msg); + } + return arg_given; +} + +static int intArg(PyObject* args, int index, int dval = 0) { + if(PyTuple_Size(args) <= index) + return dval; + int ival; + PyObject *item = PyTuple_GetItem(args, index); + Py_INCREF(item); + if (PyInt_Check(item)) ival = PyInt_AsLong(item); + else { + fprintf(stderr, "argument at index %i is not an int\n", index); + exit(-1); + } + return ival; +} + +static std::string strArg(PyObject* args, int index, const char* dval = NULL) { + if(PyTuple_Size(args) <= index) + return dval; + std::string strval; + PyObject *item = PyTuple_GetItem(args, index); + Py_INCREF(item); + if (PyString_Check(item)) strval = strdup(PyString_AsString(item)); + else { + fprintf(stderr, "argument at index %i is not an string\n", index); + exit(-1); + } + return strval; +} + +static bool boolArg(PyObject* args, int index, bool dval = false) { + if(PyTuple_Size(args) <= index) + return dval; + bool bval; + PyObject* item = PyTuple_GetItem(args, index); + Py_INCREF(item); + return (bool)PyObject_IsTrue(item); +} + +static bool tostringintmapvector(PyObject* args, int index, std::vector >& vec) { + if(PyTuple_Size(args) <= index) + return false; + PyObject* seq = PyTuple_GetItem(args, index); + //TODO: Typecheck + int seq_len = PyList_Size(seq); + for(int i = 0; i < seq_len; i++) { + std::map map; + PyObject* dict = PyList_GetItem(seq, i); + PyObject* keys = PyDict_Keys(dict); + //TODO: Typecheck + int dict_len = PyList_Size(keys); + for(int j = 0; j < dict_len; j++) { + PyObject* key = PyList_GetItem(keys, j); + PyObject* value = PyDict_GetItem(dict, key); + std::string str_key = strdup(PyString_AsString(key)); + int int_value = PyInt_AsLong(value); + map[str_key] = int_value; + } + vec.push_back(map); + } + return true; +} + +static bool tointvector(PyObject* seq, std::vector& vec) { + //TODO: Typecheck + int seq_len = PyList_Size(seq); + for(int i = 0; i < seq_len; i++) { + PyObject* item = PyList_GetItem(seq, i); + vec.push_back(PyInt_AsLong(item)); + } + return true; +} + +static bool tointvector(PyObject* args, int index, std::vector& vec) { + if(PyTuple_Size(args) <= index) + return false; + PyObject* seq = PyTuple_GetItem(args, index); + return tointvector(seq, vec); +} + +static bool tointset(PyObject* args, int index, std::set& set) { + if(PyTuple_Size(args) <= index) + return false; + PyObject* seq = PyTuple_GetItem(args, index); + //TODO: Typecheck + int seq_len = PyList_Size(seq); + for(int i = 0; i < seq_len; i++) { + PyObject* item = PyList_GetItem(seq, i); + set.insert(PyInt_AsLong(item)); + } + return true; +} +static bool tointmatrix(PyObject* args, int index, std::vector >& mat) { + if(PyTuple_Size(args) <= index) + return false; + PyObject* seq_one = PyTuple_GetItem(args, index); + int seq_one_len = PyList_Size(seq_one); + for(int i = 0; i < seq_one_len; i++) { + std::vector vec; + PyObject* seq_two = PyList_GetItem(seq_one, i); + int seq_two_len = PyList_Size(seq_two); + for(int j = 0; j < seq_two_len; j++) { + PyObject* item = PyList_GetItem(seq_two, j); + vec.push_back(PyInt_AsLong(item)); + } + mat.push_back(vec); + } + return true; +} + +#ifdef CUDACHILL +// ------------------------------ // +// Cuda CHiLL interface functions // +// ------------------------------ // + +static PyObject * +chill_print_code(PyObject *self, PyObject *args) +{ + //DEBUG_PRINT("\nC print_code() PY\n"); + + myloop->printCode(); + + Py_RETURN_NONE; // return Py_BuildValue( "" ); + +} + +static PyObject * +chill_print_ri(PyObject *self, PyObject *args) +{ + //DEBUG_PRINT("\nC chill_print_ri() called from python\n"); + myloop->printRuntimeInfo(); + DEBUG_PRINT("\n"); + Py_RETURN_NONE; // return Py_BuildValue( "" ); +} + +static PyObject * +chill_print_idx(PyObject *self, PyObject *args) +{ + //DEBUG_PRINT("\nC chill_print_idx() called from python\n"); + myloop->printIndexes(); + DEBUG_PRINT("\n"); + Py_RETURN_NONE; // return Py_BuildValue( "" ); +} + +static PyObject * +chill_print_dep(PyObject *self, PyObject *args) +{ + DEBUG_PRINT("\nC chill_print_dep()\n"); + std::cout << myloop->dep; + Py_RETURN_NONE; // return Py_BuildValue( "" ); +} + +static PyObject * +chill_print_space(PyObject *self, PyObject *args) +{ + DEBUG_PRINT("\nC chill_print_space()\n"); + for (int i = 0; i < myloop->stmt.size(); i++) { + DEBUG_PRINT("s%d: ", i+1); + Relation r; + if (!myloop->stmt[i].xform.is_null()) + r = Composition(copy(myloop->stmt[i].xform), copy(myloop->stmt[i].IS)); + else + r = copy(myloop->stmt[i].IS); + r.simplify(2, 4); + r.print(); + } + Py_RETURN_NONE; // return Py_BuildValue( "" ); +} + +static PyObject * +chill_num_statements(PyObject *self, PyObject *args) +{ + //DEBUG_PRINT("\nC chill_num_statements() called from python\n"); + int num = myloop->stmt.size(); + //DEBUG_PRINT("C num_statement() = %d\n", num); + return Py_BuildValue( "i", num ); // BEWARE "d" is DOUBLE, not int +} + +static PyObject * +chill_does_var_exist( PyObject *self, PyObject *args) +{ + DEBUG_PRINT("\nC chill_does_var_exist()\n"); + int yesno = 0; + // TODO if (myloop->symbolExists(symName)) yesno = 1; + DEBUG_PRINT("*** chill_does_var_exist *** UNIMPLEMENTED\n"); + return Py_BuildValue( "i", yesno); // there seems to be no boolean type +} + + +static PyObject * +chill_add_sync(PyObject *self, PyObject *args) +{ + //DEBUG_PRINT("\nC chill_add_sync() *UNTESTED*\n"); + int sstmt = -123; + // char index_name[180]; + static char Buffer[1024]; + static char *index_name = &Buffer[0]; + + if (!PyArg_ParseTuple(args, "is", &sstmt, &index_name)){ + fprintf(stderr, "chill_add_sync, can't parse statement number and name passed from python\n"); + exit(-1); + } + + DEBUG_PRINT("chill_add_sync, statement %d index_name '%s'\n", + sstmt, index_name); + std::string idxName( index_name); // ?? + myloop->addSync(sstmt, idxName); + + Py_RETURN_NONE; // return Py_BuildValue( "" ); +} + +static PyObject * +chill_rename_index(PyObject *self, PyObject *args) +{ + DEBUG_PRINT("\nC chill_rename_index() called from python\n"); + int sstmt; + //char oldname[80], newname[80]; + static char old[1024], newn[1024]; + + static char *oldname = &old[0], *newname=&newn[0]; + + if (!PyArg_ParseTuple(args, "iss", &sstmt, &oldname, &newname)){ + fprintf(stderr, "chill_rename_index, can't parse statement number and names passed from python\n"); + exit(-1); + } + + //DEBUG_PRINT("chill_rename_index, statement %d oldname '%s' newname '%s'\n", + //sstmt, oldname, newname); + + std::string idxName(oldname); + std::string newName(newname); + + //DEBUG_PRINT("calling myloop->renameIndex( %d, %s, %s )\n", + //sstmt, idxName.c_str(), newName.c_str()); + + myloop->renameIndex(sstmt, idxName, newName); + + //DEBUG_PRINT("after myloop->renameIndex()\n"); + + Py_RETURN_NONE; // return Py_BuildValue( "" ); +} + + + +//THIS NEEDS TO MOVE + + + +static PyObject * +chill_permute_v2(PyObject *self, PyObject *args) +{ + //DEBUG_PRINT("C permute_v2()\n"); + //int tot = sizeof(args); + //int things = tot / sizeof(PyObject *); + //DEBUG_PRINT("tot %d bytes, %d things\n", tot, things); + + int sstmt = -123; + PyObject *pyObj; + + //if (!PyArg_ParseTuple( args, "iO", &sstmt, &pyObj)) { + //if (!PyArg_ParseTuple( args, "i", &sstmt)) { + if (!PyArg_ParseTuple( args, "O", &pyObj)) { // everything on a single tuple + fprintf(stderr, "failed to parse tuple\n"); + exit(-1); + } + Py_XINCREF(pyObj); + + // the ONLY arg is a tuple. figure out how big it is + int tupleSize = PyTuple_Size(pyObj); + //DEBUG_PRINT("%d things in order tuple\n", tupleSize); + + // first has to be the statement number + PyObject *tupleItem = PyTuple_GetItem(pyObj, 0); + Py_XINCREF(tupleItem); + if (PyInt_Check( tupleItem )) sstmt = PyInt_AsLong( tupleItem ); + else { + fflush(stdout); + fprintf(stderr, "first tuple item in chill_permute_v2 is not an int?\n"); + exit(-1); + } + + //DEBUG_PRINT("stmt %d\n", sstmt); + + char **strings; + std::vector order; + std::string *cppstrptr; + std::string cppstr; + + strings = (char **) malloc( sizeof(char *) * tupleSize ) ; // too big + for (int i=1; ipermute_cuda(sstmt,order); + //DEBUG_PRINT("returned from permute_cuda()\n"); + Py_RETURN_NONE; // return Py_BuildValue( "" ); +} + + +static PyObject * +chill_tile_v2_3arg( PyObject *self, PyObject *args) +{ + //DEBUG_PRINT("in chillmodule.cc, chill_tile_v2_3arg()\n"); + + int sstmt, level, tile_size, outer_level; + //char index_name[80], control_name[80]; + static char *index_name, *control_name; + int tiling_method; + + if (!PyArg_ParseTuple(args, "iii", &sstmt, &level, &outer_level)) { + fprintf(stderr,"chill_tile_v2, can't parse parameters passed from python\n"); + exit(-1); + } + + // 3 parameter version + //DEBUG_PRINT("chill_tile_v2( %d %d %d) (3 parameter version) \n", + //sstmt,level,outer_level); + myloop->tile_cuda(sstmt,level,outer_level); + //DEBUG_PRINT("chill_tile_v2 3 parameter version returning normally\n"); + Py_RETURN_NONE; +} + + +static PyObject * +chill_tile_v2_7arg( PyObject *self, PyObject *args) +{ + //DEBUG_PRINT("in chillmodule.cc, chill_tile_v2_7arg()\n"); + + int sstmt, level, tile_size, outer_level; + //char index_name[80], control_name[80]; + static char iname[1024], cname[1024]; + static char *index_name = &iname[0], *control_name=&cname[0]; + int tiling_method; + + if (!PyArg_ParseTuple(args, "iiiissi", + &sstmt, &level, &tile_size, &outer_level, + &index_name, &control_name, &tiling_method)){ + fprintf(stderr, "chill_tile_v2_7arg, can't parse parameters passed from python\n"); + exit(-1); + } + + //DEBUG_PRINT("7 parameter version was called?\n"); + + // 7 parameter version was called + //DEBUG_PRINT("tile_v2( %d, %d, %d, %d ... )\n", + // sstmt, level, tile_size, outer_level); + + //DEBUG_PRINT("tile_v2( %d, %d, %d, %d, %s, %s, %d)\n", + //sstmt,level,tile_size,outer_level,index_name, control_name, tiling_method); + + TilingMethodType method = StridedTile; + if (tiling_method == 0) method = StridedTile; + else if (tiling_method == 1) method = CountedTile; + else fprintf(stderr, "ERROR: tile_v2 illegal tiling method, using StridedTile\n"); + + //DEBUG_PRINT("outer level %d\n", outer_level); + //DEBUG_PRINT("calling myloop->tile_cuda( %d, %d, %d, %d, %s, %s, method)\n", + // sstmt, level, tile_size, outer_level, index_name, control_name); + + // BUH level+1? + myloop->tile_cuda(sstmt, level, tile_size, outer_level, index_name, control_name, method); + Py_RETURN_NONE; +} + + +static PyObject * +chill_cur_indices(PyObject *self, PyObject *args) +{ + int stmt_num = -123; + if (!PyArg_ParseTuple(args, "i", &stmt_num)){ + fprintf(stderr, "chill_cur_indides, can't parse statement number passed from python\n"); + exit(-1); + } + //DEBUG_PRINT("cur_indices( %d )\n", stmt_num); + + char formatstring[1024]; + for (int i=0; i<1024; i++) formatstring[i] = '\0'; + + int num = myloop->idxNames[stmt_num].size(); + for(int i=0; iidxNames[%d] index %d = '%s'\n", + //stmt_num, i, myloop->idxNames[stmt_num][i].c_str()); + + // backwards, works because all entries are the same + //sprintf(formatstring, "i %s", formatstring); + strcat( formatstring, "s "); + // put this in a list or something to pass back to python + } + + int l = strlen(formatstring); + if (l > 0) formatstring[l-1] = '\0'; + + //DEBUG_PRINT("%d current indices, format string '%s'\n\n",num,formatstring); + //DEBUG_PRINT("%d current indices\n\n", num); + + //return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(),myloop->idxNames[stmt_num][1].c_str() ); + + // I don't know a clean way to do this. + if (num == 2) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), + myloop->idxNames[stmt_num][1].c_str()); + if (num == 3) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), + myloop->idxNames[stmt_num][1].c_str(), + myloop->idxNames[stmt_num][2].c_str()); + if (num == 4) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), + myloop->idxNames[stmt_num][1].c_str(), + myloop->idxNames[stmt_num][2].c_str(), + myloop->idxNames[stmt_num][3].c_str()); + if (num == 5) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), + myloop->idxNames[stmt_num][1].c_str(), + myloop->idxNames[stmt_num][2].c_str(), + myloop->idxNames[stmt_num][3].c_str(), + myloop->idxNames[stmt_num][4].c_str()); + if (num == 6) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), + myloop->idxNames[stmt_num][1].c_str(), + myloop->idxNames[stmt_num][2].c_str(), + myloop->idxNames[stmt_num][3].c_str(), + myloop->idxNames[stmt_num][4].c_str(), + myloop->idxNames[stmt_num][5].c_str()); + if (num == 7) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), + myloop->idxNames[stmt_num][1].c_str(), + myloop->idxNames[stmt_num][2].c_str(), + myloop->idxNames[stmt_num][3].c_str(), + myloop->idxNames[stmt_num][4].c_str(), + myloop->idxNames[stmt_num][5].c_str(), + myloop->idxNames[stmt_num][6].c_str()); + if (num == 8) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), + myloop->idxNames[stmt_num][1].c_str(), + myloop->idxNames[stmt_num][2].c_str(), + myloop->idxNames[stmt_num][3].c_str(), + myloop->idxNames[stmt_num][4].c_str(), + myloop->idxNames[stmt_num][5].c_str(), + myloop->idxNames[stmt_num][6].c_str(), + myloop->idxNames[stmt_num][7].c_str()); + if (num == 9) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), + myloop->idxNames[stmt_num][1].c_str(), + myloop->idxNames[stmt_num][2].c_str(), + myloop->idxNames[stmt_num][3].c_str(), + myloop->idxNames[stmt_num][4].c_str(), + myloop->idxNames[stmt_num][5].c_str(), + myloop->idxNames[stmt_num][6].c_str(), + myloop->idxNames[stmt_num][7].c_str(), + myloop->idxNames[stmt_num][8].c_str()); + if (num == 10) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), + myloop->idxNames[stmt_num][1].c_str(), + myloop->idxNames[stmt_num][2].c_str(), + myloop->idxNames[stmt_num][3].c_str(), + myloop->idxNames[stmt_num][4].c_str(), + myloop->idxNames[stmt_num][5].c_str(), + myloop->idxNames[stmt_num][6].c_str(), + myloop->idxNames[stmt_num][7].c_str(), + myloop->idxNames[stmt_num][8].c_str(), + myloop->idxNames[stmt_num][9].c_str()); + if (num == 11) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), + myloop->idxNames[stmt_num][1].c_str(), + myloop->idxNames[stmt_num][2].c_str(), + myloop->idxNames[stmt_num][3].c_str(), + myloop->idxNames[stmt_num][4].c_str(), + myloop->idxNames[stmt_num][5].c_str(), + myloop->idxNames[stmt_num][6].c_str(), + myloop->idxNames[stmt_num][7].c_str(), + myloop->idxNames[stmt_num][8].c_str(), + myloop->idxNames[stmt_num][9].c_str(), + myloop->idxNames[stmt_num][10].c_str()); + if (num == 12) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), + myloop->idxNames[stmt_num][1].c_str(), + myloop->idxNames[stmt_num][2].c_str(), + myloop->idxNames[stmt_num][3].c_str(), + myloop->idxNames[stmt_num][4].c_str(), + myloop->idxNames[stmt_num][5].c_str(), + myloop->idxNames[stmt_num][6].c_str(), + myloop->idxNames[stmt_num][7].c_str(), + myloop->idxNames[stmt_num][8].c_str(), + myloop->idxNames[stmt_num][9].c_str(), + myloop->idxNames[stmt_num][10].c_str(), + myloop->idxNames[stmt_num][11].c_str()); + if (num == 13) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), + myloop->idxNames[stmt_num][1].c_str(), + myloop->idxNames[stmt_num][2].c_str(), + myloop->idxNames[stmt_num][3].c_str(), + myloop->idxNames[stmt_num][4].c_str(), + myloop->idxNames[stmt_num][5].c_str(), + myloop->idxNames[stmt_num][6].c_str(), + myloop->idxNames[stmt_num][7].c_str(), + myloop->idxNames[stmt_num][8].c_str(), + myloop->idxNames[stmt_num][9].c_str(), + myloop->idxNames[stmt_num][10].c_str(), + myloop->idxNames[stmt_num][11].c_str(), + myloop->idxNames[stmt_num][12].c_str()); + if (num == 14) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), + myloop->idxNames[stmt_num][1].c_str(), + myloop->idxNames[stmt_num][2].c_str(), + myloop->idxNames[stmt_num][3].c_str(), + myloop->idxNames[stmt_num][4].c_str(), + myloop->idxNames[stmt_num][5].c_str(), + myloop->idxNames[stmt_num][6].c_str(), + myloop->idxNames[stmt_num][7].c_str(), + myloop->idxNames[stmt_num][8].c_str(), + myloop->idxNames[stmt_num][9].c_str(), + myloop->idxNames[stmt_num][10].c_str(), + myloop->idxNames[stmt_num][11].c_str(), + myloop->idxNames[stmt_num][12].c_str(), + myloop->idxNames[stmt_num][13].c_str()); + if (num == 15) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), + myloop->idxNames[stmt_num][1].c_str(), + myloop->idxNames[stmt_num][2].c_str(), + myloop->idxNames[stmt_num][3].c_str(), + myloop->idxNames[stmt_num][4].c_str(), + myloop->idxNames[stmt_num][5].c_str(), + myloop->idxNames[stmt_num][6].c_str(), + myloop->idxNames[stmt_num][7].c_str(), + myloop->idxNames[stmt_num][8].c_str(), + myloop->idxNames[stmt_num][9].c_str(), + myloop->idxNames[stmt_num][10].c_str(), + myloop->idxNames[stmt_num][11].c_str(), + myloop->idxNames[stmt_num][12].c_str(), + myloop->idxNames[stmt_num][13].c_str(), + myloop->idxNames[stmt_num][14].c_str()); + if (num == 16) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), + myloop->idxNames[stmt_num][1].c_str(), + myloop->idxNames[stmt_num][2].c_str(), + myloop->idxNames[stmt_num][3].c_str(), + myloop->idxNames[stmt_num][4].c_str(), + myloop->idxNames[stmt_num][5].c_str(), + myloop->idxNames[stmt_num][6].c_str(), + myloop->idxNames[stmt_num][7].c_str(), + myloop->idxNames[stmt_num][8].c_str(), + myloop->idxNames[stmt_num][9].c_str(), + myloop->idxNames[stmt_num][10].c_str(), + myloop->idxNames[stmt_num][11].c_str(), + myloop->idxNames[stmt_num][12].c_str(), + myloop->idxNames[stmt_num][13].c_str(), + myloop->idxNames[stmt_num][14].c_str(), + myloop->idxNames[stmt_num][15].c_str()); + if (num == 17) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), + myloop->idxNames[stmt_num][1].c_str(), + myloop->idxNames[stmt_num][2].c_str(), + myloop->idxNames[stmt_num][3].c_str(), + myloop->idxNames[stmt_num][4].c_str(), + myloop->idxNames[stmt_num][5].c_str(), + myloop->idxNames[stmt_num][6].c_str(), + myloop->idxNames[stmt_num][7].c_str(), + myloop->idxNames[stmt_num][8].c_str(), + myloop->idxNames[stmt_num][9].c_str(), + myloop->idxNames[stmt_num][10].c_str(), + myloop->idxNames[stmt_num][11].c_str(), + myloop->idxNames[stmt_num][12].c_str(), + myloop->idxNames[stmt_num][13].c_str(), + myloop->idxNames[stmt_num][14].c_str(), + myloop->idxNames[stmt_num][15].c_str(), + myloop->idxNames[stmt_num][16].c_str()); + if (num == 18) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), + myloop->idxNames[stmt_num][1].c_str(), + myloop->idxNames[stmt_num][2].c_str(), + myloop->idxNames[stmt_num][3].c_str(), + myloop->idxNames[stmt_num][4].c_str(), + myloop->idxNames[stmt_num][5].c_str(), + myloop->idxNames[stmt_num][6].c_str(), + myloop->idxNames[stmt_num][7].c_str(), + myloop->idxNames[stmt_num][8].c_str(), + myloop->idxNames[stmt_num][9].c_str(), + myloop->idxNames[stmt_num][10].c_str(), + myloop->idxNames[stmt_num][11].c_str(), + myloop->idxNames[stmt_num][12].c_str(), + myloop->idxNames[stmt_num][13].c_str(), + myloop->idxNames[stmt_num][14].c_str(), + myloop->idxNames[stmt_num][15].c_str(), + myloop->idxNames[stmt_num][16].c_str(), + myloop->idxNames[stmt_num][17].c_str()); + + fprintf(stderr, "going to die horribly, num=%d\n", num); +} + + +static PyObject * +chill_block_indices(PyObject *self, PyObject *args) { + + // I'm unsure what the legal states are here + // is it always "bx", or ("bx" and "by") ? + int howmany = 0; + char *loopnames[2]; + if (myloop->cu_bx > 1) { + loopnames[howmany] = strdup("bx"); + howmany++; + } + if (myloop->cu_by > 1) { + loopnames[howmany] = strdup("by"); + howmany++; + } + + if (howmany == 0) return Py_BuildValue("()"); + if (howmany == 1) return Py_BuildValue("(s)", loopnames[0]); + if (howmany == 2) return Py_BuildValue("(ss)", loopnames[0], loopnames[1]); + fprintf(stderr, "chill_block_indices(), gonna die, howmany == %d", howmany); + exit(666); + + Py_RETURN_NONE; +} + +static PyObject * +chill_thread_indices(PyObject *self, PyObject *args) { + + // I'm unsure what the legal states are here + // is it always "tx", or ("tx" and "ty") or ("tx" and "ty" and "tz") ? + int howmany = 0; + char *loopnames[3]; + if (myloop->cu_tx > 1) { + loopnames[howmany++] = strdup("tx"); + } + if (myloop->cu_ty > 1) { + loopnames[howmany++] = strdup("ty"); + } + if (myloop->cu_tz > 1) { + loopnames[howmany++] = strdup("tz"); + } + + if (howmany == 0) return Py_BuildValue("()"); + if (howmany == 1) return Py_BuildValue("(s)", + loopnames[0]); + if (howmany == 2) return Py_BuildValue("(ss)", + loopnames[0], + loopnames[1]); + if (howmany == 3) return Py_BuildValue("(sss)", + loopnames[0], + loopnames[1], + loopnames[2]); + + fprintf(stderr, "chill_thread_indices(), gonna die, howmany == %d", howmany); + exit(999); +} + + + + + +static PyObject * +block_dims(PyObject *self, PyObject *args) +{ + //DEBUG_PRINT("block_dims() returning %d %d\n", myloop->cu_bx, myloop->cu_by); + Py_BuildValue( "i i", myloop->cu_bx, myloop->cu_by); +} + + +static PyObject * +thread_dims(PyObject *self, PyObject *args) +{ + //DEBUG_PRINT("thread_dims() returning %d %d %d\n", + //myloop->cu_tx, myloop->cu_ty, myloop->cu_tz); + + Py_BuildValue( "i i i", myloop->cu_tx, myloop->cu_ty, myloop->cu_tz); +} + + +static PyObject * +chill_hard_loop_bounds(PyObject *self, PyObject *args) +{ + //DEBUG_PRINT("hard_loop_bounds("); + int sstmt, level; // input parameters + int upper, lower; // output + + if (!PyArg_ParseTuple(args, "ii", &sstmt, &level)){ + fprintf(stderr, "hard_loop_bounds, "); + fprintf(stderr, "can't parse statement numbers passed from python\n"); + exit(-1); + } + //DEBUG_PRINT(" %d, %d )\n", sstmt, level); + + myloop->extractCudaUB(sstmt, level, upper, lower); + + //DEBUG_PRINT("lower %d upper %d\n", lower, upper); + + Py_BuildValue( "i i", lower, upper); +} + + +static PyObject * +chill_datacopy9(PyObject *self, PyObject *args) +{ + //DEBUG_PRINT("\n\n\n***** datacopy_v2() 9ARGS\n"); + + int sstmt; + int level; + std::string cppstr; + std::string array_name; + std::vector new_idxs; + bool allow_extra_read; + int fastest_changing_dimension; + int padding_stride; + int padding_alignment; + bool cuda_shared; + + PyObject *pyObj; + + if (!PyArg_ParseTuple( args, "O", &pyObj)) { // everything on a single tuple + + fprintf(stderr, "failed to parse tuple\n"); + exit(-1); + } + Py_XINCREF( pyObj ); + + //if (PyList_Check(pyObj)) fprintf(stderr, "it's a list\n"); + //if (PyTuple_Check(pyObj)) fprintf(stderr, "it's a tuple\n"); + + + + // the ONLY arg is a tuple. figure out how big it is + int tupleSize = PyTuple_Size(pyObj); + //DEBUG_PRINT("%d things in object tuple\n", tupleSize); + + // first has to be the statement number + PyObject *tupleItem1 = PyTuple_GetItem(pyObj, 0); + Py_INCREF(tupleItem1); + if (PyInt_Check( tupleItem1)) sstmt = PyInt_AsLong( tupleItem1 ); + else { + fprintf(stderr, "second tuple item in chill_datacopy9 is not an int?\n"); + exit(-1); + } + //DEBUG_PRINT("stmt %d\n", sstmt); + + PyObject *tupleItem2 = PyTuple_GetItem(pyObj, 1); // second item is level + Py_INCREF(tupleItem2); + if (PyInt_Check( tupleItem2 )) level = PyInt_AsLong( tupleItem2); + else { + fprintf(stderr, "second tuple item in chill_datacopy9 is not an int?\n"); + exit(-1); + } + //DEBUG_PRINT("level %d\n", level ); + + // third item is array name + PyObject *tupleItem3 = PyTuple_GetItem(pyObj, 2); + Py_INCREF(tupleItem3); + array_name = strdup(PyString_AsString(tupleItem3)); + //DEBUG_PRINT("array name '%s'\n", array_name.c_str()); + + + // integer number of indices + PyObject *tupleItem4 = PyTuple_GetItem(pyObj, 3); + Py_INCREF(tupleItem4); + int numindex= PyInt_AsLong( tupleItem4 ); + //DEBUG_PRINT("%d indices\n", numindex); + + + PyObject *tupleItemTEMP; + for (int i=0; idatacopy_cuda()\n"); + + // corruption happenes in here??? + myloop->datacopy_cuda(sstmt, level, array_name, new_idxs, + allow_extra_read, fastest_changing_dimension, + padding_stride, padding_alignment, cuda_shared); + + DEBUG_PRINT("before attempt (after actual datacopy)\n"); + //myloop->printCode(); // attempt to debug + DEBUG_PRINT("back from attempt\n"); + + //DEBUG_PRINT("datacopy_9args returning\n"); + + Py_RETURN_NONE; +} + + + + + +static PyObject * +chill_datacopy_privatized(PyObject *self, PyObject *args) +{ + //DEBUG_PRINT("C datacopy_privatized\n"); + PyObject *pyObj; + if (!PyArg_ParseTuple( args, "O", &pyObj)) { // everything on a single tuple + fprintf(stderr, "failed to parse tuple\n"); + exit(-1); + } + + PyObject *tupleItem = PyTuple_GetItem(pyObj, 0); // statement number + Py_XINCREF(tupleItem); + int sstmt = PyInt_AsLong( tupleItem ); + + tupleItem = PyTuple_GetItem(pyObj, 1); // start_loop + Py_XINCREF(tupleItem); + std::string start_loop = strdup(PyString_AsString(tupleItem)); + int level = myloop->findCurLevel(sstmt, start_loop); + + + tupleItem = PyTuple_GetItem(pyObj, 2); // array_name + Py_XINCREF(tupleItem); + std::string array_name = strdup(PyString_AsString(tupleItem)); + + // things to hold constant - first a count, then the things + tupleItem = PyTuple_GetItem(pyObj, 3); // how many things in the array + Py_XINCREF(tupleItem); + int howmany = PyInt_AsLong( tupleItem ); + + //DEBUG_PRINT("%d things to hold constant: ", howmany); + std::vector holdconstant; + std::string cppstr; + + for (int i=0; i privatized_levels(howmany); + for(int i=0; ifindCurLevel(sstmt, holdconstant[i]); + //DEBUG_PRINT("privatized_levels[ %d ] = %d\n", i, privatized_levels[i] ); + } + + bool allow_extra_read = false; + int fastest_changing_dimension = -1; + int padding_stride = 1; + int padding_alignment = 1; + bool cuda_shared = false; + + + myloop->datacopy_privatized_cuda(sstmt, level, array_name, privatized_levels, + allow_extra_read, fastest_changing_dimension, + padding_stride, padding_alignment, + cuda_shared); + + + Py_RETURN_NONE; +} + + + + + + +static PyObject * +chill_unroll(PyObject *self, PyObject *args) +{ + int sstmt, level, unroll_amount; + + if (!PyArg_ParseTuple(args, "iii", &sstmt, &level, &unroll_amount)) { + fprintf(stderr, "chill_unroll, can't parse parameters passed from python\n"); + exit(-1); + } + + //DEBUG_PRINT("chill_unroll( %d, %d, %d)\n", sstmt, level, unroll_amount ); + bool does_expand = myloop->unroll_cuda(sstmt,level,unroll_amount); + + // TODO return the boolean? + Py_RETURN_NONE; +} + + + + +static PyObject * +chill_cudaize_v2(PyObject *self, PyObject *args) +{ + //DEBUG_PRINT("cudaize_v2\n"); + PyObject *pyObj; + if (!PyArg_ParseTuple( args, "O", &pyObj)) { // everything on a single tuple + fprintf(stderr, "failed to parse tuple\n"); + exit(-1); + } + + // the ONLY arg is a tuple. figure out how big it is + int tupleSize = PyTuple_Size(pyObj); + //DEBUG_PRINT("%d things in tuple\n", tupleSize); + + PyObject *tupleItem = PyTuple_GetItem(pyObj, 0); //the kernel name + Py_XINCREF(tupleItem); + std::string kernel_name = strdup(PyString_AsString(tupleItem)); + + std::map array_sizes; + tupleItem = PyTuple_GetItem(pyObj, 1); // number of array sizes + Py_XINCREF(tupleItem); + int numarraysizes = PyInt_AsLong( tupleItem ); + + std::string cppstr; + int offset = 2; + for (int i=0; i blockIdxs; + tupleItem = PyTuple_GetItem(pyObj, offset++); // integer number of blocks + Py_XINCREF(tupleItem); + int numblocks = PyInt_AsLong( tupleItem ); + //DEBUG_PRINT("%d blocks\n", numblocks); + for (int i=0; i threadIdxs; + tupleItem = PyTuple_GetItem(pyObj, offset++); // integer number of threads + Py_XINCREF(tupleItem); + int numthreads= PyInt_AsLong( tupleItem ); + //DEBUG_PRINT("%d threads\n", numthreads); + for (int i=0; icudaize_v2(kernel_name, array_sizes, blockIdxs, threadIdxs); + + Py_RETURN_NONE; // return Py_BuildValue( "" ); +} + + + +static PyObject *get_loop_num() { + // TODO get_loop_num() it's a global value? + fprintf(stderr, "get_loop_num() UNIMPLEMENTED\n"); + exit(-1); +} + + + + +static PyObject * +chill_copy_to_texture(PyObject *self, PyObject *args) +{ + //DEBUG_PRINT("C copy_to_texture() called from python \n"); + const char *array_name; + if (!PyArg_ParseTuple(args, "s", &array_name)){ + fprintf(stderr, "chill_copy_to_texture can't parse array name\n"); + exit(-1); + } + //DEBUG_PRINT("array name = %s\n", array_name); + myloop->copy_to_texture(array_name); + + Py_RETURN_NONE; +} + + + + + + + +static PyObject * +chill_init(PyObject *self, PyObject *args) +{ + DEBUG_PRINT("C chill_init() called from python as read_IR()\n"); + DEBUG_PRINT("C init( "); + const char *filename; + const char *procname; + if (!PyArg_ParseTuple(args, "ss", &filename, &procname)){ + fprintf(stderr, "umwut? can't parse file name and procedure name?\n"); + exit(-1); + } + + int loop_num = 0; + + DEBUG_PRINT("%s, 0, 0 )\n", filename); + + DEBUG_PRINT("GETTING IR CODE in chill_init() in chillmodule.cc\n"); + DEBUG_PRINT("ir_code = new IR_cudaroseCode(%s, %s);\n",filename, procname); + ir_code = new IR_cudaroseCode(filename, procname); //this produces 15000 lines of output + fflush(stdout); + + + + + //protonu--here goes my initializations + //A lot of this code was lifted from Chun's parser.yy + //the plan is now to create the LoopCuda object directly + IR_Block *block = ir_code->GetCode(); + DEBUG_PRINT("ir_code->FindOneLevelControlStructure(block); chillmodule.cc\n"); + ir_controls = ir_code->FindOneLevelControlStructure(block); + + int loop_count = 0; + for (int i = 0; i < ir_controls.size(); i++) { + if (ir_controls[i]->type() == IR_CONTROL_LOOP) { + loops.push_back(i); + loop_count++; + } + } + delete block; + + + std::vector parm; + for(int j = 0; j < loop_count; j++) + parm.push_back(ir_controls[loops[j]]); + + + DEBUG_PRINT("block = ir_code->MergeNeighboringControlStructures(parm);\n"); + block = ir_code->MergeNeighboringControlStructures(parm); + + //DEBUG_PRINT("myloop = new LoopCuda(block, loop_num); in chillmodule.cc\n"); + myloop = new LoopCuda(block, loop_num); + fflush(stdout); DEBUG_PRINT("back\n"); + delete block; + + //end-protonu + + fflush(stdout); + DEBUG_PRINT("myloop->original();\n"); + myloop->original(); + fflush(stdout); + DEBUG_PRINT("myloop->useIdxNames=true;\n"); + myloop->useIdxNames=true;//Use idxName in code_gen + //register_v2(L); + + fflush(stdout); + DEBUG_PRINT("chill_init DONE\n"); + Py_RETURN_NONE; // return Py_BuildValue( "" ); + +} + +#else +// ------------------------- // +// CHiLL interface functions // +// ------------------------- // + +static PyObject* chill_source(PyObject* self, PyObject* args) { + strict_arg_num(args, 1, "source"); + source_filename = strArg(args, 0); + Py_RETURN_NONE; +} + +static PyObject* chill_procedure(PyObject* self, PyObject* args) { + if(!procedure_name.empty()) { + fprintf(stderr, "only one procedure can be handled in a script"); + if(!is_interactive) + exit(2); + } + procedure_name = strArg(args, 0); + Py_RETURN_NONE; +} + +static PyObject* chill_loop(PyObject* self, PyObject* args) { + // loop (n) + // loop (n:m) + + int nargs = PyTuple_Size(args); + int start_num; + int end_num; + if(nargs == 1) { + start_num = intArg(args, 0); + end_num = start_num; + } + else if(nargs == 2) { + start_num = intArg(args, 0); + end_num = intArg(args, 1); + } + else { + fprintf(stderr, "loop takes one or two arguments"); + if(!is_interactive) + exit(2); + } + set_loop_num_start(start_num); + set_loop_num_end(end_num); + init_loop(start_num, end_num); + Py_RETURN_NONE; +} + +static PyObject* chill_print_code(PyObject* self, PyObject* args) { + strict_arg_num(args, 0, "print_code"); + myloop->printCode(); + printf("\n"); + Py_RETURN_NONE; +} + +static PyObject* chill_print_dep(PyObject* self, PyObject* args) { + strict_arg_num(args, 0, "print_dep"); + myloop->printDependenceGraph(); + Py_RETURN_NONE; +} + +static PyObject* chill_print_space(PyObject* self, PyObject* args) { + strict_arg_num(args, 0, "print_space"); + myloop->printIterationSpace(); + Py_RETURN_NONE; +} + +static PyObject* chill_exit(PyObject* self, PyObject* args) { + strict_arg_num(args, 0, "exit"); + repl_stop = true; + Py_RETURN_NONE; +} + +static void add_known(std::string cond_expr) { + int num_dim = myloop->known.n_set(); + std::vector >* cond; + cond = parse_relation_vector(cond_expr.c_str()); + + Relation rel(num_dim); + F_And *f_root = rel.add_and(); + for (int j = 0; j < cond->size(); j++) { + GEQ_Handle h = f_root->add_GEQ(); + for (std::map::iterator it = (*cond)[j].begin(); it != (*cond)[j].end(); it++) { + try { + int dim = from_string(it->first); + if (dim == 0) + h.update_const(it->second); + else + throw std::invalid_argument("only symbolic variables are allowed in known condition"); + } + catch (std::ios::failure e) { + Free_Var_Decl *g = NULL; + for (unsigned i = 0; i < myloop->freevar.size(); i++) { + std::string name = myloop->freevar[i]->base_name(); + if (name == it->first) { + g = myloop->freevar[i]; + break; + } + } + if (g == NULL) + throw std::invalid_argument("symbolic variable " + it->first + " not found"); + else + h.update_coef(rel.get_local(g), it->second); + } + } + } + myloop->addKnown(rel); +} + +static PyObject* chill_known(PyObject* self, PyObject* args) { + strict_arg_num(args, 1, "known"); + if (PyList_Check(PyTuple_GetItem(args, 0))) { + PyObject* list = PyTuple_GetItem(args, 0); + for (int i = 0; i < PyList_Size(list); i++) { + add_known(std::string(PyString_AsString(PyList_GetItem(list, i)))); + } + } + else { + add_known(strArg(args, 0)); + } + Py_RETURN_NONE; +} + +static PyObject* chill_remove_dep(PyObject* self, PyObject* args) { + strict_arg_num(args, 0, "remove_dep"); + int from = intArg(args, 0); + int to = intArg(args, 1); + myloop->removeDependence(from, to); + Py_RETURN_NONE; +} + +static PyObject* chill_original(PyObject* self, PyObject* args) { + strict_arg_num(args, 0, "original"); + myloop->original(); + Py_RETURN_NONE; +} + +static PyObject* chill_permute(PyObject* self, PyObject* args) { + int nargs = strict_arg_range(args, 1, 3, "permute"); + if((nargs < 1) || (nargs > 3)) + throw std::runtime_error("incorrect number of arguments in permute"); + if(nargs == 1) { + // premute ( vector ) + std::vector pi; + if(!tointvector(args, 0, pi)) + throw std::runtime_error("first arg in permute(pi) must be an int vector"); + myloop->permute(pi); + } + else if (nargs == 2) { + // permute ( set, vector ) + std::set active; + std::vector pi; + if(!tointset(args, 0, active)) + throw std::runtime_error("the first argument in permute(active, pi) must be an int set"); + if(!tointvector(args, 1, pi)) + throw std::runtime_error("the second argument in permute(active, pi) must be an int vector"); + myloop->permute(active, pi); + } + else if (nargs == 3) { + int stmt_num = intArg(args, 1); + int level = intArg(args, 2); + std::vector pi; + if(!tointvector(args, 3, pi)) + throw std::runtime_error("the third argument in permute(stmt_num, level, pi) must be an int vector"); + myloop->permute(stmt_num, level, pi); + } + Py_RETURN_NONE; +} + +static PyObject* chill_pragma(PyObject* self, PyObject* args) { + strict_arg_num(args, 3, "pragma"); + int stmt_num = intArg(args, 1); + int level = intArg(args, 1); + std::string pragmaText = strArg(args, 2); + myloop->pragma(stmt_num, level, pragmaText); + Py_RETURN_NONE; +} + +static PyObject* chill_prefetch(PyObject* self, PyObject* args) { + strict_arg_num(args, 3, "prefetch"); + int stmt_num = intArg(args, 0); + int level = intArg(args, 1); + std::string prefetchText = strArg(args, 2); + int hint = intArg(args, 3); + myloop->prefetch(stmt_num, level, prefetchText, hint); + Py_RETURN_NONE; +} + +static PyObject* chill_tile(PyObject* self, PyObject* args) { + int nargs = strict_arg_range(args, 3, 7, "tile"); + int stmt_num = intArg(args, 0); + int level = intArg(args, 1); + int tile_size = intArg(args, 2); + if(nargs == 3) { + myloop->tile(stmt_num, level, tile_size); + } + else if(nargs >= 4) { + int outer_level = intArg(args, 3); + if(nargs >= 5) { + TilingMethodType method = StridedTile; + int imethod = intArg(args, 4, 2); //< don't know if a default value is needed + // check method input against expected values + if (imethod == 0) + method = StridedTile; + else if (imethod == 1) + method = CountedTile; + else + throw std::runtime_error("5th argument must be either strided or counted"); + if(nargs >= 6) { + int alignment_offset = intArg(args, 5); + if(nargs == 7) { + int alignment_multiple = intArg(args, 6, 1); + myloop->tile(stmt_num, level, tile_size, outer_level, method, alignment_offset, alignment_multiple); + } + if(nargs == 6) + myloop->tile(stmt_num, level, tile_size, outer_level, method, alignment_offset); + } + if(nargs == 5) + myloop->tile(stmt_num, level, tile_size, outer_level, method); + } + if(nargs == 4) + myloop->tile(stmt_num, level, tile_size, outer_level); + } + Py_RETURN_NONE; +} + +static void chill_datacopy_vec(PyObject* args) { + // Overload 1: bool datacopy( + // const std::vector > > &array_ref_nums, + // int level, + // bool allow_extra_read = false, + // int fastest_changing_dimension = -1, + // int padding_stride = 1, + // int padding_alignment = 4, + // int memory_type = 0); + std::vector > > array_ref_nums; + // expect list(tuple(int,list(int))) + // or dict(int,list(int)) + if(PyList_CheckExact(PyTuple_GetItem(args, 0))) { + PyObject* list = PyTuple_GetItem(args, 0); + for(int i = 0; i < PyList_Size(list); i ++) { + PyObject* tup = PyList_GetItem(list, i); + int index = PyLong_AsLong(PyTuple_GetItem(tup, 0)); + std::vector vec; + tointvector(PyTuple_GetItem(tup, 1), vec); + array_ref_nums.push_back(std::pair >(index, vec)); + } + } + else if(PyList_CheckExact(PyTuple_GetItem(args, 0))) { + PyObject* dict = PyTuple_GetItem(args, 0); + PyObject* klist = PyDict_Keys(dict); + for(int ki = 0; ki < PyList_Size(klist); ki++) { + PyObject* index = PyList_GetItem(klist, ki); + std::vector vec; + tointvector(PyDict_GetItem(dict,index), vec); + array_ref_nums.push_back(std::pair >(PyLong_AsLong(index), vec)); + } + Py_DECREF(klist); + } + else { + //TODO: this should never happen + } + int level = intArg(args, 1); + bool allow_extra_read = boolArg(args, 2, false); + int fastest_changing_dimension = intArg(args, 3, -1); + int padding_stride = intArg(args, 4, 1); + int padding_alignment = intArg(args, 5, 4); + int memory_type = intArg(args, 6, 0); + myloop->datacopy(array_ref_nums, level, allow_extra_read, fastest_changing_dimension, padding_stride, padding_alignment, memory_type); +} + +static void chill_datacopy_int(PyObject* args) { + int stmt_num = intArg(args, 0); + int level = intArg(args, 1); + std::string array_name = strArg(args,2,0); + bool allow_extra_read = boolArg(args,3,false); + int fastest_changing_dimension = intArg(args, 4, -1); + int padding_stride = intArg(args, 5, 1); + int padding_alignment = intArg(args, 6, 4); + int memory_type = intArg(args, 7, 0); + myloop->datacopy(stmt_num, level, array_name, allow_extra_read, fastest_changing_dimension, padding_stride, padding_alignment, memory_type); +} + +static PyObject* chill_datacopy(PyObject* self, PyObject* args) { + // Overload 2: bool datacopy(int stmt_num, int level, const std::string &array_name, bool allow_extra_read = false, int fastest_changing_dimension = -1, int padding_stride = 1, int padding_alignment = 4, int memory_type = 0); + int nargs = strict_arg_range(args, 3, 7, "datacopy"); + if(PyList_CheckExact(PyTuple_GetItem(args,0)) || PyDict_CheckExact(PyTuple_GetItem(args, 0))) { + chill_datacopy_vec(args); + } + else { + chill_datacopy_int(args); + } + Py_RETURN_NONE; +} + +static PyObject* chill_datacopy_privatized(PyObject* self, PyObject* args) { + // bool datacopy_privatized(int stmt_num, int level, const std::string &array_name, const std::vector &privatized_levels, bool allow_extra_read = false, int fastest_changing_dimension = -1, int padding_stride = 1, int padding_alignment = 1, int memory_type = 0); + int nargs = strict_arg_range(args, 4, 9, "datacopy_privatized"); + int stmt_num = intArg(args, 0); + int level = intArg(args, 1); + std::string array_name = strArg(args, 2); + std::vector privatized_levels; + tointvector(args, 3, privatized_levels); + bool allow_extra_read = boolArg(args, 4, false); + int fastest_changing_dimension = intArg(args, 5, -1); + int padding_stride = intArg(args, 6, 1); + int padding_alignment = intArg(args, 7, 1); + int memory_type = intArg(args, 8); + myloop->datacopy_privatized(stmt_num, level, array_name, privatized_levels, allow_extra_read, fastest_changing_dimension, padding_stride, padding_alignment, memory_type); + Py_RETURN_NONE; +} + +static PyObject* chill_unroll(PyObject* self, PyObject* args) { + int nargs = strict_arg_range(args, 3, 4, "unroll"); + //std::set unroll(int stmt_num, int level, int unroll_amount, std::vector< std::vector >idxNames= std::vector< std::vector >(), int cleanup_split_level = 0); + int stmt_num = intArg(args, 0); + int level = intArg(args, 1); + int unroll_amount = intArg(args, 2); + std::vector< std::vector > idxNames = std::vector< std::vector >(); + int cleanup_split_level = intArg(args, 3); + myloop->unroll(stmt_num, level, unroll_amount, idxNames, cleanup_split_level); + Py_RETURN_NONE; +} + +static PyObject* chill_unroll_extra(PyObject* self, PyObject* args) { + int nargs = strict_arg_range(args, 3, 4, "unroll_extra"); + int stmt_num = intArg(args, 0); + int level = intArg(args, 1); + int unroll_amount = intArg(args, 2); + int cleanup_split_level = intArg(args, 3, 0); + myloop->unroll_extra(stmt_num, level, unroll_amount, cleanup_split_level); + Py_RETURN_NONE; +} + +static PyObject* chill_split(PyObject* self, PyObject* args) { + strict_arg_num(args, 3, "split"); + int stmt_num = intArg(args, 0); + int level = intArg(args, 1); + int num_dim = myloop->stmt[stmt_num].xform.n_out(); + + std::vector >* cond; + std::string cond_expr = strArg(args, 2); + cond = parse_relation_vector(cond_expr.c_str()); + + Relation rel((num_dim-1)/2); + F_And *f_root = rel.add_and(); + for (int j = 0; j < cond->size(); j++) { + GEQ_Handle h = f_root->add_GEQ(); + for (std::map::iterator it = (*cond)[j].begin(); it != (*cond)[j].end(); it++) { + try { + int dim = from_string(it->first); + if (dim == 0) + h.update_const(it->second); + else { + if (dim > (num_dim-1)/2) + throw std::invalid_argument("invalid loop level " + to_string(dim) + " in split condition"); + h.update_coef(rel.set_var(dim), it->second); + } + } + catch (std::ios::failure e) { + Free_Var_Decl *g = NULL; + for (unsigned i = 0; i < myloop->freevar.size(); i++) { + std::string name = myloop->freevar[i]->base_name(); + if (name == it->first) { + g = myloop->freevar[i]; + break; + } + } + if (g == NULL) + throw std::invalid_argument("unrecognized variable " + to_string(it->first.c_str())); + h.update_coef(rel.get_local(g), it->second); + } + } + } + myloop->split(stmt_num,level,rel); + Py_RETURN_NONE; +} + +static PyObject* chill_nonsingular(PyObject* self, PyObject* args) { + std::vector< std::vector > mat; + tointmatrix(args, 0, mat); + myloop->nonsingular(mat); + Py_RETURN_NONE; +} + +static PyObject* chill_skew(PyObject* self, PyObject* args) { + std::set stmt_nums; + std::vector skew_amounts; + int level = intArg(args, 1); + tointset(args, 0, stmt_nums); + tointvector(args, 2, skew_amounts); + myloop->skew(stmt_nums, level, skew_amounts); + Py_RETURN_NONE; +} + +static PyObject* chill_scale(PyObject* self, PyObject* args) { + strict_arg_num(args, 3); + std::set stmt_nums; + int level = intArg(args, 1); + int scale_amount = intArg(args, 2); + tointset(args, 0, stmt_nums); + myloop->scale(stmt_nums, level, scale_amount); + Py_RETURN_NONE; +} + +static PyObject* chill_reverse(PyObject* self, PyObject* args) { + strict_arg_num(args, 2); + std::set stmt_nums; + int level = intArg(args, 1); + tointset(args, 0, stmt_nums); + myloop->reverse(stmt_nums, level); + Py_RETURN_NONE; +} + +static PyObject* chill_shift(PyObject* self, PyObject* args) { + strict_arg_num(args, 3); + std::set stmt_nums; + int level = intArg(args, 1); + int shift_amount = intArg(args, 2); + tointset(args, 0, stmt_nums); + myloop->shift(stmt_nums, level, shift_amount); + Py_RETURN_NONE; +} + +static PyObject* chill_shift_to(PyObject* self, PyObject* args) { + strict_arg_num(args, 3); + int stmt_num = intArg(args, 0); + int level = intArg(args, 1); + int absolute_pos = intArg(args, 2); + myloop->shift_to(stmt_num, level, absolute_pos); + Py_RETURN_NONE; +} + +static PyObject* chill_peel(PyObject* self, PyObject* args) { + strict_arg_range(args, 2, 3); + int stmt_num = intArg(args, 0); + int level = intArg(args, 1); + int amount = intArg(args, 2); + myloop->peel(stmt_num, level, amount); + Py_RETURN_NONE; +} + +static PyObject* chill_fuse(PyObject* self, PyObject* args) { + strict_arg_num(args, 2); + std::set stmt_nums; + int level = intArg(args, 1); + tointset(args, 0, stmt_nums); + myloop->fuse(stmt_nums, level); + Py_RETURN_NONE; +} + +static PyObject* chill_distribute(PyObject* self, PyObject* args) { + strict_arg_num(args, 2); + std::set stmts; + int level = intArg(args, 1); + tointset(args, 0, stmts); + myloop->distribute(stmts, level); + Py_RETURN_NONE; +} + +static PyObject * +chill_num_statements(PyObject *self, PyObject *args) +{ + //DEBUG_PRINT("\nC chill_num_statements() called from python\n"); + int num = myloop->stmt.size(); + //DEBUG_PRINT("C num_statement() = %d\n", num); + return Py_BuildValue( "i", num ); // BEWARE "d" is DOUBLE, not int +} +#endif + +#ifdef CUDACHILL +static PyMethodDef ChillMethods[] = { + + // python name C routine parameter passing comment + {"print_code", chill_print_code, METH_VARARGS, "print the code at this point"}, + {"print_ri", chill_print_ri , METH_VARARGS, "print Runtime Info "}, + {"print_idx", chill_print_idx , METH_VARARGS, "print indices "}, + {"print_dep", chill_print_dep , METH_VARARGS, "print dep, dependecies?"}, + {"print_space", chill_print_space, METH_VARARGS, "print something or other "}, + {"add_sync", chill_add_sync, METH_VARARGS, "add sync, whatever that is"}, + {"rename_index", chill_rename_index, METH_VARARGS, "rename a loop index"}, + {"permute", chill_permute, METH_VARARGS, "change the order of loops?"}, + {"tile3", chill_tile_v2_3arg, METH_VARARGS, "something to do with tile"}, + {"tile7", chill_tile_v2_7arg, METH_VARARGS, "something to do with tile"}, + {"thread_dims", thread_dims, METH_VARARGS, "tx, ty, tz "}, + {"block_dims", block_dims, METH_VARARGS, "bx, by"}, + {"thread_indices", chill_thread_indices, METH_VARARGS, "bx, by"}, + {"block_indices", chill_block_indices, METH_VARARGS, "bx, by"}, + {"hard_loop_bounds", chill_hard_loop_bounds, METH_VARARGS, "lower, upper"}, + {"unroll", chill_unroll, METH_VARARGS, "unroll a loop"}, + {"cudaize", chill_cudaize_v2, METH_VARARGS, "dunno"}, + {"datacopy_privatized", chill_datacopy_privatized, METH_VARARGS, "dunno"}, + + {"datacopy_9arg", chill_datacopy9, METH_VARARGS, "datacopy with 9 arguments"}, + {"copy_to_texture", chill_copy_to_texture, METH_VARARGS, "copy to texture mem"}, + {"read_IR", chill_init, METH_VARARGS, "read an Intermediate Representation file"}, + {"cur_indices", chill_cur_indices, METH_VARARGS, "currently active indices"}, + {"num_statements", chill_num_statements, METH_VARARGS, "number of statements in ... something"}, + {NULL, NULL, 0, NULL} /* Sentinel */ + + //{"copy_to_constant", chill_copy_to_constant, METH_VARARGS, "copy to constant mem"}, + +}; +#else +static PyMethodDef ChillMethods[] = { + + //python name C routine parameter passing comment + {"source", chill_source, METH_VARARGS, "set source file for chill script"}, + {"procedure", chill_procedure, METH_VARARGS, "set the name of the procedure"}, + {"loop", chill_loop, METH_VARARGS, "indicate which loop to optimize"}, + {"print_code", chill_print_code, METH_VARARGS, "print generated code"}, + {"print_dep", chill_print_dep, METH_VARARGS, "print the dependencies graph"}, + {"print_space", chill_print_space, METH_VARARGS, "print space"}, + {"exit", chill_exit, METH_VARARGS, "exit the interactive consule"}, + {"known", chill_known, METH_VARARGS, "knwon"}, + {"remove_dep", chill_remove_dep, METH_VARARGS, "remove dependency i suppose"}, + {"original", chill_original, METH_VARARGS, "original"}, + {"permute", chill_permute, METH_VARARGS, "permute"}, + {"pragma", chill_pragma, METH_VARARGS, "pragma"}, + {"prefetch", chill_prefetch, METH_VARARGS, "prefetch"}, + {"tile", chill_tile, METH_VARARGS, "tile"}, + {"datacopy", chill_datacopy, METH_VARARGS, "datacopy"}, + {"datacopy_privitized", chill_datacopy_privatized, METH_VARARGS, "datacopy_privatized"}, + {"unroll", chill_unroll, METH_VARARGS, "unroll"}, + {"unroll_extra", chill_unroll_extra, METH_VARARGS, "unroll_extra"}, + {"split", chill_split, METH_VARARGS, "split"}, + {"nonsingular", chill_nonsingular, METH_VARARGS, "nonsingular"}, + {"skew", chill_skew, METH_VARARGS, "skew"}, + {"scale", chill_scale, METH_VARARGS, "scale"}, + {"reverse", chill_reverse, METH_VARARGS, "reverse"}, + {"shift", chill_shift, METH_VARARGS, "shift"}, + {"shift_to", chill_shift_to, METH_VARARGS, "shift_to"}, + {"peel", chill_peel, METH_VARARGS, "peel"}, + {"fuse", chill_fuse, METH_VARARGS, "fuse"}, + {"distribute", chill_distribute, METH_VARARGS, "distribute"}, + {"num_statements", chill_num_statements, METH_VARARGS, "number of statements in the current loop"}, + {NULL, NULL, 0, NULL} +}; +#endif + +static void register_globals(PyObject* m) { + // Preset globals + PyModule_AddStringConstant(m, "VERSION", CHILL_BUILD_VERSION); + PyModule_AddStringConstant(m, "dest", "C"); + PyModule_AddStringConstant(m, "C", "C"); + // Tile method + PyModule_AddIntConstant(m, "strided", 0); + PyModule_AddIntConstant(m, "counted", 1); + // Memory mode + PyModule_AddIntConstant(m, "global", 0); + PyModule_AddIntConstant(m, "shared", 1); + PyModule_AddIntConstant(m, "textured", 2); + // Bool flags + PyModule_AddIntConstant(m, "sync", 1); +} + +PyMODINIT_FUNC +initchill(void) // pass C methods to python +{ + DEBUG_PRINT("in C, initchill() to set up C methods to be called from python\n"); + PyObject* m = Py_InitModule("chill", ChillMethods); + register_globals(m); +} diff --git a/chill/src/dep.cc b/chill/src/dep.cc new file mode 100644 index 0000000..a675d03 --- /dev/null +++ b/chill/src/dep.cc @@ -0,0 +1,567 @@ +/***************************************************************************** + Copyright (C) 2008 University of Southern California + Copyright (C) 2009-2010 University of Utah + All Rights Reserved. + + Purpose: + Data dependence vector and graph. + + Notes: + All dependence vectors are normalized, i.e., the first non-zero distance + must be positve. Thus the correct dependence meaning can be given based on + source/destination pair's read/write type. Suppose for a dependence vector + 1, 0~5, -3), we want to permute the first and the second dimension, + the result would be two dependence vectors (0, 1, -3) and (1~5, 1, -3). + All operations on dependence vectors are non-destructive, i.e., new + dependence vectors are returned. + + History: + 01/2006 Created by Chun Chen. + 03/2009 Use IR_Ref interface in source and destination arrays -chun +*****************************************************************************/ + +#include "dep.hh" + +//----------------------------------------------------------------------------- +// Class: DependeceVector +//----------------------------------------------------------------------------- + +std::ostream& operator<<(std::ostream &os, const DependenceVector &d) { + if (d.sym != NULL) { + os << d.sym->name(); + os << ':'; + if (d.quasi) + os << "_quasi"; + + } + + switch (d.type) { + case DEP_W2R: + os << "true"; + if (d.is_reduction) + os << "_reduction"; + break; + case DEP_R2W: + os << "anti"; + break; + case DEP_W2W: + os << "output"; + break; + case DEP_R2R: + os << "input"; + break; + case DEP_CONTROL: + os << "control"; + break; + default: + os << "unknown"; + break; + } + + os << '('; + + for (int i = 0; i < d.lbounds.size(); i++) { + omega::coef_t lbound = d.lbounds[i]; + omega::coef_t ubound = d.ubounds[i]; + + if (lbound == ubound) + os << lbound; + else { + if (lbound == -posInfinity) + if (ubound == posInfinity) + os << '*'; + else { + if (ubound == -1) + os << '-'; + else + os << ubound << '-'; + } + else if (ubound == posInfinity) { + if (lbound == 1) + os << '+'; + else + os << lbound << '+'; + } else + os << lbound << '~' << ubound; + } + + if (i < d.lbounds.size() - 1) + os << ", "; + } + + os << ')'; + + return os; +} + +// DependenceVector::DependenceVector(int size): +// lbounds(std::vector(size, 0)), +// ubounds(std::vector(size, 0)) { +// src = NULL; +// dst = NULL; +// } + +DependenceVector::DependenceVector(const DependenceVector &that) { + if (that.sym != NULL) + this->sym = that.sym->clone(); + else + this->sym = NULL; + this->type = that.type; + this->lbounds = that.lbounds; + this->ubounds = that.ubounds; + quasi = that.quasi; + is_scalar_dependence = that.is_scalar_dependence; + is_reduction = that.is_reduction; +} + +DependenceVector &DependenceVector::operator=(const DependenceVector &that) { + if (this != &that) { + delete this->sym; + if (that.sym != NULL) + this->sym = that.sym->clone(); + else + this->sym = NULL; + this->type = that.type; + this->lbounds = that.lbounds; + this->ubounds = that.ubounds; + quasi = that.quasi; + is_scalar_dependence = that.is_scalar_dependence; + is_reduction = that.is_reduction; + } + return *this; +} +DependenceType DependenceVector::getType() const { + return type; +} + +bool DependenceVector::is_data_dependence() const { + if (type == DEP_W2R || type == DEP_R2W || type == DEP_W2W + || type == DEP_R2R) + return true; + else + return false; +} + +bool DependenceVector::is_control_dependence() const { + if (type == DEP_CONTROL) + return true; + else + return false; +} + +bool DependenceVector::has_negative_been_carried_at(int dim) const { + if (!is_data_dependence()) + throw std::invalid_argument("only works for data dependences"); + + if (dim < 0 || dim >= lbounds.size()) + return false; + + for (int i = 0; i < dim; i++) + if (lbounds[i] > 0 || ubounds[i] < 0) + return false; + + if (lbounds[dim] < 0) + return true; + else + return false; +} + + +bool DependenceVector::has_been_carried_at(int dim) const { + if (!is_data_dependence()) + throw std::invalid_argument("only works for data dependences"); + + if (dim < 0 || dim >= lbounds.size()) + return false; + + for (int i = 0; i < dim; i++) + if (lbounds[i] > 0 || ubounds[i] < 0) + return false; + + if ((lbounds[dim] != 0) || (ubounds[dim] !=0)) + return true; + + return false; +} + +bool DependenceVector::has_been_carried_before(int dim) const { + if (!is_data_dependence()) + throw std::invalid_argument("only works for data dependences"); + + if (dim < 0) + return false; + if (dim > lbounds.size()) + dim = lbounds.size(); + + for (int i = 0; i < dim; i++) { + if (lbounds[i] > 0) + return true; + if (ubounds[i] < 0) + return true; + } + + return false; +} + +bool DependenceVector::isZero() const { + return isZero(lbounds.size() - 1); +} + +bool DependenceVector::isZero(int dim) const { + if (dim >= lbounds.size()) + throw std::invalid_argument("invalid dependence dimension"); + + for (int i = 0; i <= dim; i++) + if (lbounds[i] != 0 || ubounds[i] != 0) + return false; + + return true; +} + +bool DependenceVector::isPositive() const { + for (int i = 0; i < lbounds.size(); i++) + if (lbounds[i] != 0 || ubounds[i] != 0) { + if (lbounds[i] < 0) + return false; + else if (lbounds[i] > 0) + return true; + } + + return false; +} + +bool DependenceVector::isNegative() const { + for (int i = 0; i < lbounds.size(); i++) + if (lbounds[i] != 0 || ubounds[i] != 0) { + if (ubounds[i] > 0) + return false; + else if (ubounds[i] < 0) + return true; + } + + return false; +} + +bool DependenceVector::isAllPositive() const { + for (int i = 0; i < lbounds.size(); i++) + if (lbounds[i] < 0) + return false; + + return true; +} + +bool DependenceVector::isAllNegative() const { + for (int i = 0; i < ubounds.size(); i++) + if (ubounds[i] > 0) + return false; + + return true; +} + +bool DependenceVector::hasPositive(int dim) const { + if (dim >= lbounds.size()) + throw std::invalid_argument("invalid dependence dimension"); + + if (lbounds[dim] > 0) + //av: changed from ubounds to lbounds may have side effects + return true; + else + return false; +} + +bool DependenceVector::hasNegative(int dim) const { + if (dim >= lbounds.size()) + throw std::invalid_argument("invalid dependence dimension"); + + if (ubounds[dim] < 0) + //av: changed from lbounds to ubounds may have side effects + return true; + else + return false; +} + +bool DependenceVector::isCarried(int dim, omega::coef_t distance) const { + if (distance <= 0) + throw std::invalid_argument("invalid dependence distance size"); + + if (dim > lbounds.size()) + dim = lbounds.size(); + + for (int i = 0; i < dim; i++) + if (lbounds[i] > 0) + return false; + else if (ubounds[i] < 0) + return false; + + if (dim >= lbounds.size()) + return true; + + if (lbounds[dim] > distance) + return false; + else if (ubounds[dim] < -distance) + return false; + + return true; +} + +bool DependenceVector::canPermute(const std::vector &pi) const { + if (pi.size() != lbounds.size()) + throw std::invalid_argument( + "permute dimensionality do not match dependence space"); + + for (int i = 0; i < pi.size(); i++) { + if (lbounds[pi[i]] > 0) + return true; + else if (lbounds[pi[i]] < 0) + return false; + } + + return true; +} + +std::vector DependenceVector::normalize() const { + std::vector result; + + DependenceVector dv(*this); + for (int i = 0; i < dv.lbounds.size(); i++) { + if (dv.lbounds[i] < 0 && dv.ubounds[i] >= 0) { + omega::coef_t t = dv.ubounds[i]; + dv.ubounds[i] = -1; + result.push_back(dv); + dv.lbounds[i] = 0; + dv.ubounds[i] = t; + } + if (dv.lbounds[i] == 0 && dv.ubounds[i] > 0) { + dv.lbounds[i] = 1; + result.push_back(dv); + dv.lbounds[i] = 0; + dv.ubounds[i] = 0; + } + if (dv.lbounds[i] == 0 && dv.ubounds[i] == 0) + continue; + else + break; + } + + result.push_back(dv); + return result; +} + +std::vector DependenceVector::permute( + const std::vector &pi) const { + if (pi.size() != lbounds.size()) + throw std::invalid_argument( + "permute dimensionality do not match dependence space"); + + const int n = lbounds.size(); + + DependenceVector dv(*this); + for (int i = 0; i < n; i++) { + dv.lbounds[i] = lbounds[pi[i]]; + dv.ubounds[i] = ubounds[pi[i]]; + } + + int violated = 0; + + for (int i = 0; i < n; i++) { + if (dv.lbounds[i] > 0) + break; + else if (dv.lbounds[i] < 0) + violated = 1; + } + + if (((violated == 1) && !quasi) && !is_scalar_dependence) { + throw ir_error("dependence violation"); + + } + + return dv.normalize(); +} + +DependenceVector DependenceVector::reverse() const { + const int n = lbounds.size(); + + DependenceVector dv(*this); + switch (type) { + case DEP_W2R: + dv.type = DEP_R2W; + break; + case DEP_R2W: + dv.type = DEP_W2R; + break; + default: + dv.type = type; + } + + for (int i = 0; i < n; i++) { + dv.lbounds[i] = -ubounds[i]; + dv.ubounds[i] = -lbounds[i]; + } + dv.quasi = true; + + return dv; +} + +// std::vector DependenceVector::matrix(const std::vector > &M) const { +// if (M.size() != lbounds.size()) +// throw std::invalid_argument("(non)unimodular transformation dimensionality does not match dependence space"); + +// const int n = lbounds.size(); +// DependenceVector dv; +// if (sym != NULL) +// dv.sym = sym->clone(); +// else +// dv.sym = NULL; +// dv.type = type; + +// for (int i = 0; i < n; i++) { +// assert(M[i].size() == n+1 || M[i].size() == n); + +// omega::coef_t lb, ub; +// if (M[i].size() == n+1) +// lb = ub = M[i][n]; +// else +// lb = ub = 0; + +// for (int j = 0; j < n; j++) { +// int c = M[i][j]; +// if (c == 0) +// continue; + +// if (c > 0) { +// if (lbounds[j] == -posInfinity) +// lb = -posInfinity; +// else if (lb != -posInfinity) +// lb += c * lbounds[j]; +// if (ubounds[j] == posInfinity) +// ub = posInfinity; +// else if (ub != posInfinity) +// ub += c * ubounds[j]; +// } +// else { +// if (ubounds[j] == posInfinity) +// lb = -posInfinity; +// else if (lb != -posInfinity) +// lb += c * ubounds[j]; +// if (lbounds[j] == -posInfinity) +// ub = posInfinity; +// else if (ub != posInfinity) +// ub += c * lbounds[j]; +// } +// } +// dv.lbounds.push_back(lb); +// dv.ubounds.push_back(ub); +// } +// dv.is_reduction = is_reduction; + +// return dv.normalize(); +// } + +//----------------------------------------------------------------------------- +// Class: DependenceGraph +//----------------------------------------------------------------------------- + +DependenceGraph DependenceGraph::permute(const std::vector &pi, + const std::set &active) const { + DependenceGraph g; + + for (int i = 0; i < vertex.size(); i++) + g.insert(vertex[i].first); + + for (int i = 0; i < vertex.size(); i++) + for (EdgeList::const_iterator j = vertex[i].second.begin(); + j != vertex[i].second.end(); j++) { + if (active.empty() + || (active.find(i) != active.end() + && active.find(j->first) != active.end())) { + for (int k = 0; k < j->second.size(); k++) { + std::vector dv = j->second[k].permute(pi); + g.connect(i, j->first, dv); + } + } else if (active.find(i) == active.end() + && active.find(j->first) == active.end()) { + std::vector dv = j->second; + g.connect(i, j->first, dv); + } else { + std::vector dv = j->second; + for (int k = 0; k < dv.size(); k++) + for (int d = 0; d < pi.size(); d++) + if (pi[d] != d) { + dv[k].lbounds[d] = -posInfinity; + dv[k].ubounds[d] = posInfinity; + } + g.connect(i, j->first, dv); + } + } + + return g; +} + +// DependenceGraph DependenceGraph::matrix(const std::vector > &M) const { +// DependenceGraph g; + +// for (int i = 0; i < vertex.size(); i++) +// g.insert(vertex[i].first); + +// for (int i = 0; i < vertex.size(); i++) +// for (EdgeList::const_iterator j = vertex[i].second.begin(); j != vertex[i].second.end(); j++) +// for (int k = 0; k < j->second.size(); k++) +// g.connect(i, j->first, j->second[k].matrix(M)); + +// return g; +// } + +DependenceGraph DependenceGraph::subspace(int dim) const { + DependenceGraph g; + + for (int i = 0; i < vertex.size(); i++) + g.insert(vertex[i].first); + + for (int i = 0; i < vertex.size(); i++) + for (EdgeList::const_iterator j = vertex[i].second.begin(); + j != vertex[i].second.end(); j++) + + for (int k = 0; k < j->second.size(); k++) { + if(j->second[k].type != DEP_CONTROL){ + if (j->second[k].isCarried(dim)) + g.connect(i, j->first, j->second[k]); + }else + g.connect(i, j->first, j->second[k]); + + } + + return g; +} + +bool DependenceGraph::isPositive() const { + for (int i = 0; i < vertex.size(); i++) + for (EdgeList::const_iterator j = vertex[i].second.begin(); + j != vertex[i].second.end(); j++) + for (int k = 0; k < j->second.size(); k++) + if (!j->second[k].isPositive()) + return false; + + return true; +} + +bool DependenceGraph::hasPositive(int dim) const { + for (int i = 0; i < vertex.size(); i++) + for (EdgeList::const_iterator j = vertex[i].second.begin(); + j != vertex[i].second.end(); j++) + for (int k = 0; k < j->second.size(); k++) + if (!j->second[k].hasPositive(dim)) + return false; + + return true; +} + +bool DependenceGraph::hasNegative(int dim) const { + for (int i = 0; i < vertex.size(); i++) + for (EdgeList::const_iterator j = vertex[i].second.begin(); + j != vertex[i].second.end(); j++) + for (int k = 0; k < j->second.size(); k++) + if (!j->second[k].hasNegative(dim)) + return false; + + return true; +} diff --git a/chill/src/ir_rose.cc b/chill/src/ir_rose.cc new file mode 100644 index 0000000..5acb175 --- /dev/null +++ b/chill/src/ir_rose.cc @@ -0,0 +1,2296 @@ +/***************************************************************************** + Copyright (C) 2009-2010 University of Utah + All Rights Reserved. + + Purpose: + CHiLL's rose interface. + + Notes: + Array supports mixed pointer and array type in a single declaration. + + History: + 02/23/2009 Created by Chun Chen. +*****************************************************************************/ +#include +#include "ir_rose.hh" +#include "ir_rose_utils.hh" +#include +#include +#include + +using namespace SageBuilder; +using namespace SageInterface; +using namespace omega; +// ---------------------------------------------------------------------------- +// Class: IR_roseScalarSymbol +// ---------------------------------------------------------------------------- + +std::string IR_roseScalarSymbol::name() const { + return vs_->get_name().getString(); +} + +int IR_roseScalarSymbol::size() const { + return (vs_->get_type()->memoryUsage()) / (vs_->get_type()->numberOfNodes()); +} + +bool IR_roseScalarSymbol::operator==(const IR_Symbol &that) const { + if (typeid(*this) != typeid(that)) + return false; + + const IR_roseScalarSymbol *l_that = + static_cast(&that); + return this->vs_ == l_that->vs_; +} + +IR_Symbol *IR_roseScalarSymbol::clone() const { + return NULL; +} + +// ---------------------------------------------------------------------------- +// Class: IR_roseArraySymbol +// ---------------------------------------------------------------------------- + +std::string IR_roseArraySymbol::name() const { + return (vs_->get_declaration()->get_name().getString()); +} + +int IR_roseArraySymbol::elem_size() const { + + SgType *tn = vs_->get_type(); + SgType* arrType; + + int elemsize; + + if (arrType = isSgArrayType(tn)) { + while (isSgArrayType(arrType)) { + arrType = arrType->findBaseType(); + } + } else if (arrType = isSgPointerType(tn)) { + while (isSgPointerType(arrType)) { + arrType = arrType->findBaseType(); + } + } + + elemsize = (int) arrType->memoryUsage() / arrType->numberOfNodes(); + return elemsize; +} + +int IR_roseArraySymbol::n_dim() const { + int dim = 0; + SgType* arrType = isSgArrayType(vs_->get_type()); + SgType* ptrType = isSgPointerType(vs_->get_type()); + if (arrType != NULL) { + while (isSgArrayType(arrType)) { + arrType = isSgArrayType(arrType)->get_base_type(); + dim++; + } + } else if (ptrType != NULL) { + while (isSgPointerType(ptrType)) { + ptrType = isSgPointerType(ptrType)->get_base_type(); + dim++; + } + } + + // Manu:: fortran support + if (static_cast(ir_)->is_fortran_) { + + if (arrType != NULL) { + dim = 0; + SgExprListExp * dimList = isSgArrayType(vs_->get_type())->get_dim_info(); + SgExpressionPtrList::iterator it = dimList->get_expressions().begin(); + for(;it != dimList->get_expressions().end(); it++) { + dim++; + } + } else if (ptrType != NULL) { + //std::cout << "pntrType \n"; + ; // not sure if this case will happen + } + } + + return dim; +} + +omega::CG_outputRepr *IR_roseArraySymbol::size(int dim) const { + + SgArrayType* arrType = isSgArrayType(vs_->get_type()); + // SgExprListExp* dimList = arrType->get_dim_info(); + int count = 0; + SgExpression* expr; + SgType* pntrType = isSgPointerType(vs_->get_type()); + + if (arrType != NULL) { + SgExprListExp* dimList = arrType->get_dim_info(); + if (!static_cast(ir_)->is_fortran_) { + SgExpressionPtrList::iterator it = + dimList->get_expressions().begin(); + + while ((it != dimList->get_expressions().end()) && (count < dim)) { + it++; + count++; + } + + expr = *it; + } else { + SgExpressionPtrList::reverse_iterator i = + dimList->get_expressions().rbegin(); + for (; (i != dimList->get_expressions().rend()) && (count < dim); + i++) { + + count++; + } + + expr = *i; + } + } else if (pntrType != NULL) { + + while (count < dim) { + pntrType = (isSgPointerType(pntrType))->get_base_type(); + count++; + } + if (isSgPointerType(pntrType)) + expr = new SgExpression; + } + + if (!expr) + throw ir_error("Index variable is NULL!!"); + + // Manu :: debug + std::cout << "---------- size :: " << isSgNode(expr)->unparseToString().c_str() << "\n"; + + return new omega::CG_roseRepr(expr); + +} + +IR_ARRAY_LAYOUT_TYPE IR_roseArraySymbol::layout_type() const { + if (static_cast(ir_)->is_fortran_) + return IR_ARRAY_LAYOUT_COLUMN_MAJOR; + else + return IR_ARRAY_LAYOUT_ROW_MAJOR; + +} + +bool IR_roseArraySymbol::operator==(const IR_Symbol &that) const { + + if (typeid(*this) != typeid(that)) + return false; + + const IR_roseArraySymbol *l_that = + static_cast(&that); + return this->vs_ == l_that->vs_; + +} + +IR_Symbol *IR_roseArraySymbol::clone() const { + return new IR_roseArraySymbol(ir_, vs_); +} + +// ---------------------------------------------------------------------------- +// Class: IR_roseConstantRef +// ---------------------------------------------------------------------------- + +bool IR_roseConstantRef::operator==(const IR_Ref &that) const { + + if (typeid(*this) != typeid(that)) + return false; + + const IR_roseConstantRef *l_that = + static_cast(&that); + + if (this->type_ != l_that->type_) + return false; + + if (this->type_ == IR_CONSTANT_INT) + return this->i_ == l_that->i_; + else + return this->f_ == l_that->f_; + +} + +omega::CG_outputRepr *IR_roseConstantRef::convert() { + if (type_ == IR_CONSTANT_INT) { + omega::CG_roseRepr *result = new omega::CG_roseRepr( + isSgExpression(buildIntVal(static_cast(i_)))); + delete this; + return result; + } else + throw ir_error("constant type not supported"); + +} + +IR_Ref *IR_roseConstantRef::clone() const { + if (type_ == IR_CONSTANT_INT) + return new IR_roseConstantRef(ir_, i_); + else if (type_ == IR_CONSTANT_FLOAT) + return new IR_roseConstantRef(ir_, f_); + else + throw ir_error("constant type not supported"); + +} + +// ---------------------------------------------------------------------------- +// Class: IR_roseScalarRef +// ---------------------------------------------------------------------------- + +bool IR_roseScalarRef::is_write() const { + /* if (ins_pos_ != NULL && op_pos_ == -1) + return true; + else + return false; + */ + + if (is_write_ == 1) + return true; + + return false; +} + +IR_ScalarSymbol *IR_roseScalarRef::symbol() const { + return new IR_roseScalarSymbol(ir_, vs_->get_symbol()); +} + +bool IR_roseScalarRef::operator==(const IR_Ref &that) const { + if (typeid(*this) != typeid(that)) + return false; + + const IR_roseScalarRef *l_that = + static_cast(&that); + + if (this->ins_pos_ == NULL) + return this->vs_ == l_that->vs_; + else + return this->ins_pos_ == l_that->ins_pos_ + && this->op_pos_ == l_that->op_pos_; +} + +omega::CG_outputRepr *IR_roseScalarRef::convert() { + omega::CG_roseRepr *result = new omega::CG_roseRepr(isSgExpression(vs_)); + delete this; + return result; + +} + +IR_Ref * IR_roseScalarRef::clone() const { + //if (ins_pos_ == NULL) + return new IR_roseScalarRef(ir_, vs_, this->is_write_); + //else + // return new IR_roseScalarRef(ir_, , op_pos_); + +} + +// ---------------------------------------------------------------------------- +// Class: IR_roseArrayRef +// ---------------------------------------------------------------------------- + +bool IR_roseArrayRef::is_write() const { + SgAssignOp* assignment; + + if (is_write_ == 1 || is_write_ == 0) + return is_write_; + if (assignment = isSgAssignOp(ia_->get_parent())) { + if (assignment->get_lhs_operand() == ia_) + return true; + } else if (SgExprStatement* expr_stmt = isSgExprStatement( + ia_->get_parent())) { + SgExpression* exp = expr_stmt->get_expression(); + + if (exp) { + if (assignment = isSgAssignOp(exp)) { + if (assignment->get_lhs_operand() == ia_) + return true; + + } + } + + } + return false; +} + +omega::CG_outputRepr *IR_roseArrayRef::index(int dim) const { + + SgExpression *current = isSgExpression(ia_); + SgExpression* expr; + int count = 0; + + while (isSgPntrArrRefExp(current)) { + current = isSgPntrArrRefExp(current)->get_lhs_operand(); + count++; + } + + current = ia_; + + while (count > dim) { + expr = isSgPntrArrRefExp(current)->get_rhs_operand(); + current = isSgPntrArrRefExp(current)->get_lhs_operand(); + count--; + } + + // Manu:: fortran support + if (static_cast(ir_)->is_fortran_) { + expr = isSgPntrArrRefExp(ia_)->get_rhs_operand(); + count = 0; + if (isSgExprListExp(expr)) { + SgExpressionPtrList::iterator indexList = isSgExprListExp(expr)->get_expressions().begin(); + while (count < dim) { + indexList++; + count++; + } + expr = isSgExpression(*indexList); + } + } + + if (!expr) + throw ir_error("Index variable is NULL!!"); + + + omega::CG_roseRepr* ind = new omega::CG_roseRepr(expr); + + return ind->clone(); + +} + +IR_ArraySymbol *IR_roseArrayRef::symbol() const { + + SgExpression *current = isSgExpression(ia_); + + SgVarRefExp* base; + SgVariableSymbol *arrSymbol; + while (isSgPntrArrRefExp(current) || isSgUnaryOp(current)) { + if (isSgPntrArrRefExp(current)) + current = isSgPntrArrRefExp(current)->get_lhs_operand(); + else if (isSgUnaryOp(current)) + /* To handle support for addressof operator and pointer dereference + * both of which are unary ops + */ + current = isSgUnaryOp(current)->get_operand(); + } + if (base = isSgVarRefExp(current)) { + arrSymbol = (SgVariableSymbol*) (base->get_symbol()); + std::string x = arrSymbol->get_name().getString(); + } else + throw ir_error("Array Symbol is not a variable?!"); + + return new IR_roseArraySymbol(ir_, arrSymbol); + +} + +bool IR_roseArrayRef::operator==(const IR_Ref &that) const { + if (typeid(*this) != typeid(that)) + return false; + + const IR_roseArrayRef *l_that = static_cast(&that); + + return this->ia_ == l_that->ia_; +} + +omega::CG_outputRepr *IR_roseArrayRef::convert() { + omega::CG_roseRepr *temp = new omega::CG_roseRepr( + isSgExpression(this->ia_)); + omega::CG_outputRepr *result = temp->clone(); +// delete this; // Commented by Manu + return result; +} + +IR_Ref *IR_roseArrayRef::clone() const { + return new IR_roseArrayRef(ir_, ia_, is_write_); +} + +// ---------------------------------------------------------------------------- +// Class: IR_roseLoop +// ---------------------------------------------------------------------------- + +IR_ScalarSymbol *IR_roseLoop::index() const { + SgForStatement *tf = isSgForStatement(tf_); + SgFortranDo *tfortran = isSgFortranDo(tf_); + SgVariableSymbol* vs = NULL; + if (tf) { + SgForInitStatement* list = tf->get_for_init_stmt(); + SgStatementPtrList& initStatements = list->get_init_stmt(); + SgStatementPtrList::const_iterator j = initStatements.begin(); + + if (SgExprStatement *expr = isSgExprStatement(*j)) + if (SgAssignOp* op = isSgAssignOp(expr->get_expression())) + if (SgVarRefExp* var_ref = isSgVarRefExp(op->get_lhs_operand())) + vs = var_ref->get_symbol(); + } else if (tfortran) { + SgExpression* init = tfortran->get_initialization(); + + if (SgAssignOp* op = isSgAssignOp(init)) + if (SgVarRefExp* var_ref = isSgVarRefExp(op->get_lhs_operand())) + vs = var_ref->get_symbol(); + + } + + if (vs == NULL) + throw ir_error("Index variable is NULL!!"); + + return new IR_roseScalarSymbol(ir_, vs); +} + +omega::CG_outputRepr *IR_roseLoop::lower_bound() const { + SgForStatement *tf = isSgForStatement(tf_); + SgFortranDo *tfortran = isSgFortranDo(tf_); + + SgExpression* lowerBound = NULL; + + if (tf) { + SgForInitStatement* list = tf->get_for_init_stmt(); + SgStatementPtrList& initStatements = list->get_init_stmt(); + SgStatementPtrList::const_iterator j = initStatements.begin(); + + if (SgExprStatement *expr = isSgExprStatement(*j)) + if (SgAssignOp* op = isSgAssignOp(expr->get_expression())) { + lowerBound = op->get_rhs_operand(); + //Rose sometimes introduces an unnecessary cast which is a unary op + if (isSgUnaryOp(lowerBound)) + lowerBound = isSgUnaryOp(lowerBound)->get_operand(); + + } + } else if (tfortran) { + SgExpression* init = tfortran->get_initialization(); + + if (SgAssignOp* op = isSgAssignOp(init)) + lowerBound = op->get_rhs_operand(); + } + + if (lowerBound == NULL) + throw ir_error("Lower Bound is NULL!!"); + + return new omega::CG_roseRepr(lowerBound); +} + +omega::CG_outputRepr *IR_roseLoop::upper_bound() const { + SgForStatement *tf = isSgForStatement(tf_); + SgFortranDo *tfortran = isSgFortranDo(tf_); + SgExpression* upperBound = NULL; + if (tf) { + SgBinaryOp* test_expr = isSgBinaryOp(tf->get_test_expr()); + if (test_expr == NULL) + throw ir_error("Test Expression is NULL!!"); + + upperBound = test_expr->get_rhs_operand(); + //Rose sometimes introduces an unnecessary cast which is a unary op + if (isSgUnaryOp(upperBound)) + upperBound = isSgUnaryOp(upperBound)->get_operand(); + if (upperBound == NULL) + throw ir_error("Upper Bound is NULL!!"); + } else if (tfortran) { + + upperBound = tfortran->get_bound(); + + } + + return new omega::CG_roseRepr(upperBound); + +} + +IR_CONDITION_TYPE IR_roseLoop::stop_cond() const { + SgForStatement *tf = isSgForStatement(tf_); + SgFortranDo *tfortran = isSgFortranDo(tf_); + + if (tf) { + SgExpression* stopCond = NULL; + SgExpression* test_expr = tf->get_test_expr(); + + if (isSgLessThanOp(test_expr)) + return IR_COND_LT; + else if (isSgLessOrEqualOp(test_expr)) + return IR_COND_LE; + else if (isSgGreaterThanOp(test_expr)) + return IR_COND_GT; + else if (isSgGreaterOrEqualOp(test_expr)) + return IR_COND_GE; + + else + throw ir_error("loop stop condition unsupported"); + } else if (tfortran) { + SgExpression* increment = tfortran->get_increment(); + if (!isSgNullExpression(increment)) { + if (isSgMinusOp(increment) + && !isSgBinaryOp(isSgMinusOp(increment)->get_operand())) + return IR_COND_GE; + else + return IR_COND_LE; + } else { + return IR_COND_LE; // Manu:: if increment is not present, assume it to be 1. Just a workaround, not sure if it will be correct for all cases. + SgExpression* lowerBound = NULL; + SgExpression* upperBound = NULL; + SgExpression* init = tfortran->get_initialization(); + SgIntVal* ub; + SgIntVal* lb; + if (SgAssignOp* op = isSgAssignOp(init)) + lowerBound = op->get_rhs_operand(); + + upperBound = tfortran->get_bound(); + + if ((upperBound != NULL) && (lowerBound != NULL)) { + + if ((ub = isSgIntVal(isSgValueExp(upperBound))) && (lb = + isSgIntVal(isSgValueExp(lowerBound)))) { + if (ub->get_value() > lb->get_value()) + return IR_COND_LE; + else + return IR_COND_GE; + } else + throw ir_error("loop stop condition unsupported"); + + } else + throw ir_error("malformed fortran loop bounds!!"); + + } + } + +} + +IR_Block *IR_roseLoop::body() const { + SgForStatement *tf = isSgForStatement(tf_); + SgFortranDo *tfortran = isSgFortranDo(tf_); + SgNode* loop_body = NULL; + SgStatement* body_statements = NULL; + + if (tf) { + body_statements = tf->get_loop_body(); + } else if (tfortran) { + body_statements = isSgStatement(tfortran->get_body()); + + } + + loop_body = isSgNode(body_statements); + + SgStatementPtrList list; + if (isSgBasicBlock(loop_body)) { + list = isSgBasicBlock(loop_body)->get_statements(); + + if (list.size() == 1) + loop_body = isSgNode(*(list.begin())); + } + + if (loop_body == NULL) + throw ir_error("for loop body is NULL!!"); + + return new IR_roseBlock(ir_, loop_body); +} + +int IR_roseLoop::step_size() const { + + SgForStatement *tf = isSgForStatement(tf_); + SgFortranDo *tfortran = isSgFortranDo(tf_); + + if (tf) { + SgExpression *increment = tf->get_increment(); + + if (isSgPlusPlusOp(increment)) + return 1; + if (isSgMinusMinusOp(increment)) + return -1; + else if (SgAssignOp* assignment = isSgAssignOp(increment)) { + SgBinaryOp* stepsize = isSgBinaryOp(assignment->get_lhs_operand()); + if (stepsize == NULL) + throw ir_error("Step size expression is NULL!!"); + SgIntVal* step = isSgIntVal(stepsize->get_lhs_operand()); + return step->get_value(); + } else if (SgBinaryOp* inc = isSgPlusAssignOp(increment)) { + SgIntVal* step = isSgIntVal(inc->get_rhs_operand()); + return (step->get_value()); + } else if (SgBinaryOp * inc = isSgMinusAssignOp(increment)) { + SgIntVal* step = isSgIntVal(inc->get_rhs_operand()); + return -(step->get_value()); + } else if (SgBinaryOp * inc = isSgCompoundAssignOp(increment)) { + SgIntVal* step = isSgIntVal(inc->get_rhs_operand()); + return (step->get_value()); + } + + } else if (tfortran) { + + SgExpression* increment = tfortran->get_increment(); + + if (!isSgNullExpression(increment)) { + if (isSgMinusOp(increment)) { + if (SgValueExp *inc = isSgValueExp( + isSgMinusOp(increment)->get_operand())) + if (isSgIntVal(inc)) + return -(isSgIntVal(inc)->get_value()); + } else { + if (SgValueExp* inc = isSgValueExp(increment)) + if (isSgIntVal(inc)) + return isSgIntVal(inc)->get_value(); + } + } else { + return 1; // Manu:: if increment is not present, assume it to be 1. Just a workaround, not sure if it will be correct for all cases. + SgExpression* lowerBound = NULL; + SgExpression* upperBound = NULL; + SgExpression* init = tfortran->get_initialization(); + SgIntVal* ub; + SgIntVal* lb; + if (SgAssignOp* op = isSgAssignOp(init)) + lowerBound = op->get_rhs_operand(); + + upperBound = tfortran->get_bound(); + + if ((upperBound != NULL) && (lowerBound != NULL)) { + + if ((ub = isSgIntVal(isSgValueExp(upperBound))) && (lb = + isSgIntVal(isSgValueExp(lowerBound)))) { + if (ub->get_value() > lb->get_value()) + return 1; + else + return -1; + } else + throw ir_error("loop stop condition unsupported"); + + } else + throw ir_error("loop stop condition unsupported"); + + } + + } + +} + +IR_Block *IR_roseLoop::convert() { + const IR_Code *ir = ir_; + SgNode *tnl = isSgNode(tf_); + delete this; + return new IR_roseBlock(ir, tnl); +} + +IR_Control *IR_roseLoop::clone() const { + + return new IR_roseLoop(ir_, tf_); + +} + +// ---------------------------------------------------------------------------- +// Class: IR_roseBlock +// ---------------------------------------------------------------------------- + +omega::CG_outputRepr *IR_roseBlock::original() const { + + omega::CG_outputRepr * tnl; + + if (isSgBasicBlock(tnl_)) { + + SgStatementPtrList *bb = new SgStatementPtrList(); + SgStatementPtrList::iterator it; + for (it = (isSgBasicBlock(tnl_)->get_statements()).begin(); + it != (isSgBasicBlock(tnl_)->get_statements()).end() + && (*it != start_); it++) + ; + + if (it != (isSgBasicBlock(tnl_)->get_statements()).end()) { + for (; it != (isSgBasicBlock(tnl_)->get_statements()).end(); it++) { + bb->push_back(*it); + if ((*it) == end_) + break; + } + } + tnl = new omega::CG_roseRepr(bb); + //block = tnl->clone(); + + } else { + tnl = new omega::CG_roseRepr(tnl_); + + //block = tnl->clone(); + } + + return tnl; + +} +omega::CG_outputRepr *IR_roseBlock::extract() const { + + std::string x = tnl_->unparseToString(); + + omega::CG_roseRepr * tnl; + + omega::CG_outputRepr* block; + + if (isSgBasicBlock(tnl_)) { + + SgStatementPtrList *bb = new SgStatementPtrList(); + SgStatementPtrList::iterator it; + for (it = (isSgBasicBlock(tnl_)->get_statements()).begin(); + it != (isSgBasicBlock(tnl_)->get_statements()).end() + && (*it != start_); it++) + ; + + if (it != (isSgBasicBlock(tnl_)->get_statements()).end()) { + for (; it != (isSgBasicBlock(tnl_)->get_statements()).end(); it++) { + bb->push_back(*it); + if ((*it) == end_) + break; + } + } + tnl = new omega::CG_roseRepr(bb); + block = tnl->clone(); + + } else { + tnl = new omega::CG_roseRepr(tnl_); + + block = tnl->clone(); + } + + delete tnl; + return block; +} + +IR_Control *IR_roseBlock::clone() const { + return new IR_roseBlock(ir_, tnl_, start_, end_); + +} +// ---------------------------------------------------------------------------- +// Class: IR_roseIf +// ---------------------------------------------------------------------------- +omega::CG_outputRepr *IR_roseIf::condition() const { + SgNode *tnl = isSgNode(isSgIfStmt(ti_)->get_conditional()); + SgExpression* exp = NULL; + if (SgExprStatement* stmt = isSgExprStatement(tnl)) + exp = stmt->get_expression(); + /* + SgExpression *op = iter(tnl); + if (iter.is_empty()) + throw ir_error("unrecognized if structure"); + tree_node *tn = iter.step(); + if (!iter.is_empty()) + throw ir_error("unrecognized if structure"); + if (!tn->is_instr()) + throw ir_error("unrecognized if structure"); + instruction *ins = static_cast(tn)->instr(); + if (!ins->opcode() == io_bfalse) + throw ir_error("unrecognized if structure"); + operand op = ins->src_op(0);*/ + if (exp == NULL) + return new omega::CG_roseRepr(tnl); + else + return new omega::CG_roseRepr(exp); +} + +IR_Block *IR_roseIf::then_body() const { + SgNode *tnl = isSgNode(isSgIfStmt(ti_)->get_true_body()); + + //tree_node_list *tnl = ti_->then_part(); + if (tnl == NULL) + return NULL; + /* + tree_node_list_iter iter(tnl); + if (iter.is_empty()) + return NULL; */ + + return new IR_roseBlock(ir_, tnl); +} + +IR_Block *IR_roseIf::else_body() const { + SgNode *tnl = isSgNode(isSgIfStmt(ti_)->get_false_body()); + + //tree_node_list *tnl = ti_->else_part(); + + if (tnl == NULL) + return NULL; + /* + tree_node_list_iter iter(tnl); + if (iter.is_empty()) + return NULL;*/ + + return new IR_roseBlock(ir_, tnl); +} + +IR_Block *IR_roseIf::convert() { + const IR_Code *ir = ir_; + /* SgNode *tnl = ti_->get_parent(); + SgNode *start, *end; + start = end = ti_; + + //tree_node_list *tnl = ti_->parent(); + //tree_node_list_e *start, *end; + //start = end = ti_->list_e(); + */ + delete this; + return new IR_roseBlock(ir, ti_); +} + +IR_Control *IR_roseIf::clone() const { + return new IR_roseIf(ir_, ti_); +} + +// -----------------------------------------------------------y----------------- +// Class: IR_roseCode_Global_Init +// ---------------------------------------------------------------------------- + +IR_roseCode_Global_Init *IR_roseCode_Global_Init::pinstance = 0; + +IR_roseCode_Global_Init * IR_roseCode_Global_Init::Instance(char** argv) { + if (pinstance == 0) { + pinstance = new IR_roseCode_Global_Init; + pinstance->project = frontend(2, argv); + + } + return pinstance; +} + +// ---------------------------------------------------------------------------- +// Class: IR_roseCode +// ---------------------------------------------------------------------------- + +IR_roseCode::IR_roseCode(const char *filename, const char* proc_name) : + IR_Code() { + + SgProject* project; + + char* argv[2]; + int counter = 0; + argv[0] = (char*) malloc(5 * sizeof(char)); + argv[1] = (char*) malloc((strlen(filename) + 1) * sizeof(char)); + strcpy(argv[0], "rose"); + strcpy(argv[1], filename); + + project = (IR_roseCode_Global_Init::Instance(argv))->project; + //main_ssa = new ssa_unfiltered_cfg::SSA_UnfilteredCfg(project); + //main_ssa->run(); + firstScope = getFirstGlobalScope(project); + SgFilePtrList& file_list = project->get_fileList(); + + for (SgFilePtrList::iterator it = file_list.begin(); it != file_list.end(); + it++) { + file = isSgSourceFile(*it); + if (file->get_outputLanguage() == SgFile::e_Fortran_output_language) + is_fortran_ = true; + else + is_fortran_ = false; + + // Manu:: debug + // if (is_fortran_) + // std::cout << "Input is a fortran file\n"; + // else + // std::cout << "Input is a C file\n"; + + root = file->get_globalScope(); + + if (!is_fortran_) { // Manu:: this macro should not be created if the input code is in fortran + buildCpreprocessorDefineDeclaration(root, + "#define __rose_lt(x,y) ((x)<(y)?(x):(y))", + PreprocessingInfo::before); + buildCpreprocessorDefineDeclaration(root, + "#define __rose_gt(x,y) ((x)>(y)?(x):(y))", + PreprocessingInfo::before); + } + + symtab_ = isSgScopeStatement(root)->get_symbol_table(); + SgDeclarationStatementPtrList& declList = root->get_declarations(); + + p = declList.begin(); + + while (p != declList.end()) { + func = isSgFunctionDeclaration(*p); + if (func) { + if (!strcmp((func->get_name().getString()).c_str(), proc_name)) + break; + + } + p++; + counter++; + } + if (p != declList.end()) + break; + + } + + symtab2_ = func->get_definition()->get_symbol_table(); + symtab3_ = func->get_definition()->get_body()->get_symbol_table(); + // ocg_ = new omega::CG_roseBuilder(func->get_definition()->get_body()->get_symbol_table() , isSgNode(func->get_definition()->get_body())); + // Manu:: added is_fortran_ parameter + ocg_ = new omega::CG_roseBuilder(is_fortran_, root, firstScope, + func->get_definition()->get_symbol_table(), + func->get_definition()->get_body()->get_symbol_table(), + isSgNode(func->get_definition()->get_body())); + + i_ = 0; /*i_ handling may need revision */ + + free(argv[1]); + free(argv[0]); + +} + +IR_roseCode::~IR_roseCode() { +} + +void IR_roseCode::finalizeRose() { + // Moved this out of the deconstructor + // ???? + SgProject* project = (IR_roseCode_Global_Init::Instance(NULL))->project; + // -- Causes coredump. commented out for now -- // + // processes attributes left in Rose Ast + //postProcessRoseCodeInsertion(project); + project->unparse(); + //backend((IR_roseCode_Global_Init::Instance(NULL))->project); +} + +IR_ScalarSymbol *IR_roseCode::CreateScalarSymbol(const IR_Symbol *sym, int) { + char str1[14]; + if (typeid(*sym) == typeid(IR_roseScalarSymbol)) { + SgType *tn = + static_cast(sym)->vs_->get_type(); + sprintf(str1, "newVariable%i\0", i_); + SgVariableDeclaration* defn = buildVariableDeclaration(str1, tn); + i_++; + + SgInitializedNamePtrList& variables = defn->get_variables(); + SgInitializedNamePtrList::const_iterator i = variables.begin(); + SgInitializedName* initializedName = *i; + SgVariableSymbol* vs = new SgVariableSymbol(initializedName); + + prependStatement(defn, + isSgScopeStatement(func->get_definition()->get_body())); + vs->set_parent(symtab_); + symtab_->insert(str1, vs); + + if (vs == NULL) + throw ir_error("in CreateScalarSymbol: vs is NULL!!"); + + return new IR_roseScalarSymbol(this, vs); + } else if (typeid(*sym) == typeid(IR_roseArraySymbol)) { + SgType *tn1 = + static_cast(sym)->vs_->get_type(); + while (isSgArrayType(tn1) || isSgPointerType(tn1)) { + if (isSgArrayType(tn1)) + tn1 = isSgArrayType(tn1)->get_base_type(); + else if (isSgPointerType(tn1)) + tn1 = isSgPointerType(tn1)->get_base_type(); + else + throw ir_error( + "in CreateScalarSymbol: symbol not an array nor a pointer!"); + } + + sprintf(str1, "newVariable%i\0", i_); + i_++; + + SgVariableDeclaration* defn1 = buildVariableDeclaration(str1, tn1); + SgInitializedNamePtrList& variables1 = defn1->get_variables(); + + SgInitializedNamePtrList::const_iterator i1 = variables1.begin(); + SgInitializedName* initializedName1 = *i1; + + SgVariableSymbol *vs1 = new SgVariableSymbol(initializedName1); + prependStatement(defn1, + isSgScopeStatement(func->get_definition()->get_body())); + + vs1->set_parent(symtab_); + symtab_->insert(str1, vs1); + + if (vs1 == NULL) + throw ir_error("in CreateScalarSymbol: vs1 is NULL!!"); + + return new IR_roseScalarSymbol(this, vs1); + } else + throw std::bad_typeid(); + +} + +IR_ArraySymbol *IR_roseCode::CreateArraySymbol(const IR_Symbol *sym, + std::vector &size, int) { + SgType *tn; + char str1[14]; + + if (typeid(*sym) == typeid(IR_roseScalarSymbol)) { + tn = static_cast(sym)->vs_->get_type(); + } else if (typeid(*sym) == typeid(IR_roseArraySymbol)) { + tn = static_cast(sym)->vs_->get_type(); + while (isSgArrayType(tn) || isSgPointerType(tn)) { + if (isSgArrayType(tn)) + tn = isSgArrayType(tn)->get_base_type(); + else if (isSgPointerType(tn)) + tn = isSgPointerType(tn)->get_base_type(); + else + throw ir_error( + "in CreateScalarSymbol: symbol not an array nor a pointer!"); + } + } else + throw std::bad_typeid(); + + + // Manu:: Fortran support + std::vectorexprs; + SgExprListExp *exprLstExp; + SgExpression* sizeExpression = new SgNullExpression(); + SgArrayType* arrayType = new SgArrayType(tn,sizeExpression); + sizeExpression->set_parent(arrayType); + + if (!is_fortran_) { + for (int i = size.size() - 1; i >= 0; i--) { + tn = buildArrayType(tn,static_cast(size[i])->GetExpression()); + } + } else { // Manu:: required for fortran support + for (int i = size.size() - 1; i >= 0; i--) { + exprs.push_back(static_cast(size[i])->GetExpression()); + } + } + + if (is_fortran_) { + exprLstExp = buildExprListExp(exprs); + arrayType->set_dim_info(exprLstExp); + exprLstExp->set_parent(arrayType); + arrayType->set_rank(exprLstExp->get_expressions().size()); + } + + static int rose_array_counter = 1; + SgVariableDeclaration* defn2; + std::string s; + if (!is_fortran_) { + s = std::string("_P") + omega::to_string(rose_array_counter++); + defn2 = buildVariableDeclaration(const_cast(s.c_str()), tn); + } else {// Manu:: fortran support + s = std::string("f_P") + omega::to_string(rose_array_counter++); + defn2 = buildVariableDeclaration(const_cast(s.c_str()), arrayType); + } + + + SgInitializedNamePtrList& variables2 = defn2->get_variables(); + + SgInitializedNamePtrList::const_iterator i2 = variables2.begin(); + SgInitializedName* initializedName2 = *i2; + SgVariableSymbol *vs = new SgVariableSymbol(initializedName2); + + prependStatement(defn2, + isSgScopeStatement(func->get_definition()->get_body())); + + vs->set_parent(symtab_); + symtab_->insert(SgName(s.c_str()), vs); + + return new IR_roseArraySymbol(this, vs); +} + +IR_ScalarRef *IR_roseCode::CreateScalarRef(const IR_ScalarSymbol *sym) { + return new IR_roseScalarRef(this, + buildVarRefExp(static_cast(sym)->vs_)); + +} + +IR_ArrayRef *IR_roseCode::CreateArrayRef(const IR_ArraySymbol *sym, + std::vector &index) { + + int t; + + if (sym->n_dim() != index.size()) + throw std::invalid_argument("incorrect array symbol dimensionality"); + + const IR_roseArraySymbol *l_sym = + static_cast(sym); + + SgVariableSymbol *vs = l_sym->vs_; + SgExpression* ia1 = buildVarRefExp(vs); + + + + if (is_fortran_) { // Manu:: fortran support + std::vectorexprs; + for (int i = 0 ; i < index.size(); i++) { + exprs.push_back(static_cast(index[i])->GetExpression()); + } + SgExprListExp *exprLstExp; + exprLstExp = buildExprListExp(exprs); + ia1 = buildPntrArrRefExp(ia1,exprLstExp); + } else { + for (int i = 0; i < index.size(); i++) { +/* + if (is_fortran_) + t = index.size() - i - 1; + else + t = i; +*/ + + // std::string y = + // isSgNode( + // static_cast(index[i])->GetExpression())->unparseToString(); + ia1 = buildPntrArrRefExp(ia1, + static_cast(index[i])->GetExpression()); + + } + } + + SgPntrArrRefExp *ia = isSgPntrArrRefExp(ia1); + //std::string z = isSgNode(ia)->unparseToString(); + + return new IR_roseArrayRef(this, ia, -1); + +} + +std::vector IR_roseCode::FindScalarRef( + const omega::CG_outputRepr *repr) const { + std::vector scalars; + SgNode *tnl = static_cast(repr)->GetCode(); + SgStatementPtrList *list = + static_cast(repr)->GetList(); + SgStatement* stmt; + SgExpression * exp; + + if (list != NULL) { + for (SgStatementPtrList::iterator it = (*list).begin(); + it != (*list).end(); it++) { + omega::CG_roseRepr *r = new omega::CG_roseRepr(isSgNode(*it)); + std::vector a = FindScalarRef(r); + delete r; + std::copy(a.begin(), a.end(), back_inserter(scalars)); + } + } + + else if (tnl != NULL) { + if (stmt = isSgStatement(tnl)) { + if (isSgBasicBlock(stmt)) { + SgStatementPtrList& stmts = + isSgBasicBlock(stmt)->get_statements(); + for (int i = 0; i < stmts.size(); i++) { + omega::CG_roseRepr *r = new omega::CG_roseRepr( + isSgNode(stmts[i])); + std::vector a = FindScalarRef(r); + delete r; + std::copy(a.begin(), a.end(), back_inserter(scalars)); + } + + } else if (isSgForStatement(stmt)) { + + SgForStatement *tnf = isSgForStatement(stmt); + omega::CG_roseRepr *r = new omega::CG_roseRepr( + isSgStatement(tnf->get_loop_body())); + std::vector a = FindScalarRef(r); + delete r; + std::copy(a.begin(), a.end(), back_inserter(scalars)); + } else if (isSgFortranDo(stmt)) { + SgFortranDo *tfortran = isSgFortranDo(stmt); + omega::CG_roseRepr *r = new omega::CG_roseRepr( + isSgStatement(tfortran->get_body())); + std::vector a = FindScalarRef(r); + delete r; + std::copy(a.begin(), a.end(), back_inserter(scalars)); + } else if (isSgIfStmt(stmt)) { + SgIfStmt* tni = isSgIfStmt(stmt); + omega::CG_roseRepr *r = new omega::CG_roseRepr( + isSgNode(tni->get_conditional())); + std::vector a = FindScalarRef(r); + delete r; + std::copy(a.begin(), a.end(), back_inserter(scalars)); + r = new omega::CG_roseRepr(isSgNode(tni->get_true_body())); + a = FindScalarRef(r); + delete r; + std::copy(a.begin(), a.end(), back_inserter(scalars)); + r = new omega::CG_roseRepr(isSgNode(tni->get_false_body())); + a = FindScalarRef(r); + delete r; + std::copy(a.begin(), a.end(), back_inserter(scalars)); + } else if (isSgExprStatement(stmt)) { + omega::CG_roseRepr *r = new omega::CG_roseRepr( + isSgExpression( + isSgExprStatement(stmt)->get_expression())); + std::vector a = FindScalarRef(r); + delete r; + std::copy(a.begin(), a.end(), back_inserter(scalars)); + + } + } + } else { + SgExpression* op = + static_cast(repr)->GetExpression(); + if (isSgVarRefExp(op) + && (!isSgArrayType(isSgVarRefExp(op)->get_type()))) { + /* if ((isSgAssignOp(isSgNode(op)->get_parent())) + && ((isSgAssignOp(isSgNode(op)->get_parent())->get_lhs_operand()) + == op)) + scalars.push_back( + new IR_roseScalarRef(this, + isSgAssignOp(isSgNode(op)->get_parent()), -1)); + else + */ + if (SgBinaryOp* op_ = isSgBinaryOp( + isSgVarRefExp(op)->get_parent())) { + if (SgCompoundAssignOp *op__ = isSgCompoundAssignOp(op_)) { + if (isSgCompoundAssignOp(op_)->get_lhs_operand() + == isSgVarRefExp(op)) { + scalars.push_back( + new IR_roseScalarRef(this, isSgVarRefExp(op), + 1)); + scalars.push_back( + new IR_roseScalarRef(this, isSgVarRefExp(op), + 0)); + } + } + } else if (SgAssignOp* assmt = isSgAssignOp( + isSgVarRefExp(op)->get_parent())) { + + if (assmt->get_lhs_operand() == isSgVarRefExp(op)) + scalars.push_back( + new IR_roseScalarRef(this, isSgVarRefExp(op), 1)); + } else if (SgAssignOp * assmt = isSgAssignOp( + isSgVarRefExp(op)->get_parent())) { + + if (assmt->get_rhs_operand() == isSgVarRefExp(op)) + scalars.push_back( + new IR_roseScalarRef(this, isSgVarRefExp(op), 0)); + } else + scalars.push_back( + new IR_roseScalarRef(this, isSgVarRefExp(op), 0)); + } else if (isSgAssignOp(op)) { + omega::CG_roseRepr *r1 = new omega::CG_roseRepr( + isSgAssignOp(op)->get_lhs_operand()); + std::vector a1 = FindScalarRef(r1); + delete r1; + std::copy(a1.begin(), a1.end(), back_inserter(scalars)); + omega::CG_roseRepr *r2 = new omega::CG_roseRepr( + isSgAssignOp(op)->get_rhs_operand()); + std::vector a2 = FindScalarRef(r2); + delete r2; + std::copy(a2.begin(), a2.end(), back_inserter(scalars)); + + } else if (isSgBinaryOp(op)) { + omega::CG_roseRepr *r1 = new omega::CG_roseRepr( + isSgBinaryOp(op)->get_lhs_operand()); + std::vector a1 = FindScalarRef(r1); + delete r1; + std::copy(a1.begin(), a1.end(), back_inserter(scalars)); + omega::CG_roseRepr *r2 = new omega::CG_roseRepr( + isSgBinaryOp(op)->get_rhs_operand()); + std::vector a2 = FindScalarRef(r2); + delete r2; + std::copy(a2.begin(), a2.end(), back_inserter(scalars)); + } else if (isSgUnaryOp(op)) { + omega::CG_roseRepr *r1 = new omega::CG_roseRepr( + isSgUnaryOp(op)->get_operand()); + std::vector a1 = FindScalarRef(r1); + delete r1; + std::copy(a1.begin(), a1.end(), back_inserter(scalars)); + } + + } + return scalars; + +} + +std::vector IR_roseCode::FindArrayRef( + const omega::CG_outputRepr *repr) const { + std::vector arrays; + SgNode *tnl = static_cast(repr)->GetCode(); + SgStatementPtrList* list = + static_cast(repr)->GetList(); + SgStatement* stmt; + SgExpression * exp; + + if (list != NULL) { + for (SgStatementPtrList::iterator it = (*list).begin(); + it != (*list).end(); it++) { + omega::CG_roseRepr *r = new omega::CG_roseRepr(isSgNode(*it)); + std::vector a = FindArrayRef(r); + delete r; + std::copy(a.begin(), a.end(), back_inserter(arrays)); + } + } else if (tnl != NULL) { + if (stmt = isSgStatement(tnl)) { + if (isSgBasicBlock(stmt)) { + SgStatementPtrList& stmts = + isSgBasicBlock(stmt)->get_statements(); + for (int i = 0; i < stmts.size(); i++) { + omega::CG_roseRepr *r = new omega::CG_roseRepr( + isSgNode(stmts[i])); + std::vector a = FindArrayRef(r); + delete r; + std::copy(a.begin(), a.end(), back_inserter(arrays)); + } + + } else if (isSgForStatement(stmt)) { + + SgForStatement *tnf = isSgForStatement(stmt); + omega::CG_roseRepr *r = new omega::CG_roseRepr( + isSgStatement(tnf->get_loop_body())); + std::vector a = FindArrayRef(r); + delete r; + std::copy(a.begin(), a.end(), back_inserter(arrays)); + } else if (isSgFortranDo(stmt)) { + SgFortranDo *tfortran = isSgFortranDo(stmt); + omega::CG_roseRepr *r = new omega::CG_roseRepr( + isSgStatement(tfortran->get_body())); + std::vector a = FindArrayRef(r); + delete r; + std::copy(a.begin(), a.end(), back_inserter(arrays)); + } else if (isSgIfStmt(stmt)) { + SgIfStmt* tni = isSgIfStmt(stmt); + omega::CG_roseRepr *r = new omega::CG_roseRepr( + isSgNode(tni->get_conditional())); + std::vector a = FindArrayRef(r); + delete r; + std::copy(a.begin(), a.end(), back_inserter(arrays)); + r = new omega::CG_roseRepr(isSgNode(tni->get_true_body())); + a = FindArrayRef(r); + delete r; + std::copy(a.begin(), a.end(), back_inserter(arrays)); + r = new omega::CG_roseRepr(isSgNode(tni->get_false_body())); + a = FindArrayRef(r); + delete r; + std::copy(a.begin(), a.end(), back_inserter(arrays)); + } else if (isSgExprStatement(stmt)) { + omega::CG_roseRepr *r = new omega::CG_roseRepr( + isSgExpression( + isSgExprStatement(stmt)->get_expression())); + std::vector a = FindArrayRef(r); + delete r; + std::copy(a.begin(), a.end(), back_inserter(arrays)); + + } + } + } else { + SgExpression* op = + static_cast(repr)->GetExpression(); + if (isSgPntrArrRefExp(op)) { + + SgVarRefExp* base; + SgExpression* op2; + if (isSgCompoundAssignOp(isSgPntrArrRefExp(op)->get_parent())) { + IR_roseArrayRef *ref1 = new IR_roseArrayRef(this, + isSgPntrArrRefExp(op), 0); + arrays.push_back(ref1); + IR_roseArrayRef *ref2 = new IR_roseArrayRef(this, + isSgPntrArrRefExp(op), 1); + arrays.push_back(ref2); + } else { + IR_roseArrayRef *ref3 = new IR_roseArrayRef(this, + isSgPntrArrRefExp(op), -1); + arrays.push_back(ref3); + + while (isSgPntrArrRefExp(op)) { + op2 = isSgPntrArrRefExp(op)->get_rhs_operand(); + op = isSgPntrArrRefExp(op)->get_lhs_operand(); + omega::CG_roseRepr *r = new omega::CG_roseRepr(op2); + std::vector a = FindArrayRef(r); + delete r; + std::copy(a.begin(), a.end(), back_inserter(arrays)); + + } + } + /* base = isSgVarRefExp(op); + SgVariableSymbol *arrSymbol = (SgVariableSymbol*)(base->get_symbol()); + SgArrayType *arrType = isSgArrayType(arrSymbol->get_type()); + + SgExprListExp* dimList = arrType->get_dim_info(); + + if(dimList != NULL){ + SgExpressionPtrList::iterator it = dimList->get_expressions().begin(); + SgExpression *expr; + + + for (int i = 0; it != dimList->get_expressions().end(); it++, i++) + { + expr = *it; + + omega::CG_roseRepr *r = new omega::CG_roseRepr(expr); + std::vector a = FindArrayRef(r); + delete r; + std::copy(a.begin(), a.end(), back_inserter(arrays)); + } + + } + arrays.push_back(ref); + */ + } else if (isSgAssignOp(op)) { + omega::CG_roseRepr *r1 = new omega::CG_roseRepr( + isSgAssignOp(op)->get_lhs_operand()); + std::vector a1 = FindArrayRef(r1); + delete r1; + std::copy(a1.begin(), a1.end(), back_inserter(arrays)); + omega::CG_roseRepr *r2 = new omega::CG_roseRepr( + isSgAssignOp(op)->get_rhs_operand()); + std::vector a2 = FindArrayRef(r2); + delete r2; + std::copy(a2.begin(), a2.end(), back_inserter(arrays)); + + } else if (isSgBinaryOp(op)) { + omega::CG_roseRepr *r1 = new omega::CG_roseRepr( + isSgBinaryOp(op)->get_lhs_operand()); + std::vector a1 = FindArrayRef(r1); + delete r1; + std::copy(a1.begin(), a1.end(), back_inserter(arrays)); + omega::CG_roseRepr *r2 = new omega::CG_roseRepr( + isSgBinaryOp(op)->get_rhs_operand()); + std::vector a2 = FindArrayRef(r2); + delete r2; + std::copy(a2.begin(), a2.end(), back_inserter(arrays)); + } else if (isSgUnaryOp(op)) { + omega::CG_roseRepr *r1 = new omega::CG_roseRepr( + isSgUnaryOp(op)->get_operand()); + std::vector a1 = FindArrayRef(r1); + delete r1; + std::copy(a1.begin(), a1.end(), back_inserter(arrays)); + } + + } + return arrays; + + /* std::string x; + SgStatement* stmt = isSgStatement(tnl); + SGExprStatement* expr_statement = isSgExprStatement(stmt); + SgExpression* exp= NULL; + if(expr_statement == NULL){ + if(! (SgExpression* exp = isSgExpression(tnl)) + throw ir_error("FindArrayRef: Not a stmt nor an expression!!"); + + if( expr_statement != NULL){ + for(int i=0; i < tnl->get_numberOfTraversalSuccessors(); i++){ + + SgNode* tn = isSgStatement(tnl); + SgStatement* stmt = isSgStatement(tn); + if(stmt != NULL){ + SgExprStatement* expr_statement = isSgExprStatement(tn); + if(expr_statement != NULL) + x = isSgNode(expr_statement)->unparseToString(); + exp = expr_statement->get_expression(); + + } + else{ + + exp = isSgExpression(tn); + } + if(exp != NULL){ + x = isSgNode(exp)->unparseToString(); + + if(SgPntrArrRefExp* arrRef = isSgPntrArrRefExp(exp) ){ + if(arrRef == NULL) + throw ir_error("something wrong"); + IR_roseArrayRef *ref = new IR_roseArrayRef(this, arrRef); + arrays.push_back(ref); + } + + omega::CG_outputRepr *r = new omega::CG_roseRepr(isSgNode(exp->get_rhs_operand())); + std::vector a = FindArrayRef(r); + delete r; + std::copy(a.begin(), a.end(), back_inserter(arrays)); + + omega::CG_outputRepr *r1 = new omega::CG_roseRepr(isSgNode(exp->get_lhs_operand())); + std::vector a1 = FindArrayRef(r1); + delete r1; + std::copy(a1.begin(), a1.end(), back_inserter(arrays)); + + } + }*/ + +} + +std::vector IR_roseCode::FindOneLevelControlStructure( + const IR_Block *block) const { + + std::vector controls; + int i; + int j; + int begin; + int end; + SgNode* tnl_ = + ((static_cast(const_cast(block)))->tnl_); + + if (isSgForStatement(tnl_)) + controls.push_back(new IR_roseLoop(this, tnl_)); + else if (isSgFortranDo(tnl_)) + controls.push_back(new IR_roseLoop(this, tnl_)); + else if (isSgIfStmt(tnl_)) + controls.push_back(new IR_roseIf(this, tnl_)); + + else if (isSgBasicBlock(tnl_)) { + + SgStatementPtrList& stmts = isSgBasicBlock(tnl_)->get_statements(); + + for (i = 0; i < stmts.size(); i++) { + if (isSgNode(stmts[i]) + == ((static_cast(const_cast(block)))->start_)) + begin = i; + if (isSgNode(stmts[i]) + == ((static_cast(const_cast(block)))->end_)) + end = i; + } + + SgNode* start = NULL; + SgNode* prev = NULL; + for (i = begin; i <= end; i++) { + if (isSgForStatement(stmts[i]) || isSgFortranDo(stmts[i])) { + if (start != NULL) { + controls.push_back( + new IR_roseBlock(this, + (static_cast(const_cast(block)))->tnl_, + start, prev)); + start = NULL; + } + controls.push_back(new IR_roseLoop(this, isSgNode(stmts[i]))); + } else if (isSgIfStmt(stmts[i])) { + if (start != NULL) { + controls.push_back( + new IR_roseBlock(this, + (static_cast(const_cast(block)))->tnl_, + start, prev)); + start = NULL; + } + controls.push_back(new IR_roseIf(this, isSgNode(stmts[i]))); + + } else if (start == NULL) + start = isSgNode(stmts[i]); + + prev = isSgNode(stmts[i]); + } + + if ((start != NULL) && (start != isSgNode(stmts[begin]))) + controls.push_back( + new IR_roseBlock(this, + (static_cast(const_cast(block)))->tnl_, + start, prev)); + } + + return controls; + +} + +/*std::vector IR_roseCode::FindOneLevelControlStructure(const IR_Block *block) const { + + std::vector controls; + int i; + int j; + SgNode* tnl_ = ((static_cast(const_cast(block)))->tnl_); + + + if(isSgForStatement(tnl_)) + controls.push_back(new IR_roseLoop(this,tnl_)); + + else if(isSgBasicBlock(tnl_)){ + + SgStatementPtrList& stmts = isSgBasicBlock(tnl_)->get_statements(); + + for(i =0; i < stmts.size(); i++){ + if(isSgNode(stmts[i]) == ((static_cast(const_cast(block)))->start_)) + break; + } + + + SgNode* start= NULL; + SgNode* prev= NULL; + for(; i < stmts.size(); i++){ + if ( isSgForStatement(stmts[i]) || isSgFortranDo(stmts[i])){ + if(start != NULL){ + controls.push_back(new IR_roseBlock(this, (static_cast(const_cast(block)))->tnl_ , start, prev)); + start = NULL; + } + controls.push_back(new IR_roseLoop(this, isSgNode(stmts[i]))); + } + else if( start == NULL ) + start = isSgNode(stmts[i]); + + prev = isSgNode(stmts[i]); + } + + if((start != NULL) && (start != isSgNode(stmts[0]))) + controls.push_back(new IR_roseBlock(this, (static_cast(const_cast(block)))->tnl_, start, prev)); + } + + return controls; + + } + +*/ +IR_Block *IR_roseCode::MergeNeighboringControlStructures( + const std::vector &controls) const { + if (controls.size() == 0) + return NULL; + + SgNode *tnl = NULL; + SgNode *start, *end; + for (int i = 0; i < controls.size(); i++) { + switch (controls[i]->type()) { + case IR_CONTROL_LOOP: { + SgNode *tf = static_cast(controls[i])->tf_; + if (tnl == NULL) { + tnl = tf->get_parent(); + start = end = tf; + } else { + if (tnl != tf->get_parent()) + throw ir_error("controls to merge not at the same level"); + end = tf; + } + break; + } + case IR_CONTROL_BLOCK: { + if (tnl == NULL) { + tnl = static_cast(controls[0])->tnl_; + start = static_cast(controls[0])->start_; + end = static_cast(controls[0])->end_; + } else { + if (tnl != static_cast(controls[0])->tnl_) + throw ir_error("controls to merge not at the same level"); + end = static_cast(controls[0])->end_; + } + break; + } + default: + throw ir_error("unrecognized control to merge"); + } + } + + return new IR_roseBlock(controls[0]->ir_, tnl, start, end); +} + +IR_Block *IR_roseCode::GetCode() const { + SgFunctionDefinition* def = NULL; + SgBasicBlock* block = NULL; + if (func != 0) { + if (def = func->get_definition()) { + if (block = def->get_body()) + return new IR_roseBlock(this, + func->get_definition()->get_body()); + } + } + + return NULL; + +} + +void IR_roseCode::ReplaceCode(IR_Control *old, omega::CG_outputRepr *repr) { + /* SgStatementPtrList *tnl = + static_cast(repr)->GetList(); + SgNode *tf_old; + */ + SgStatementPtrList *tnl = + static_cast(repr)->GetList(); + SgNode* node_ = static_cast(repr)->GetCode(); + SgNode * tf_old; + + /* May need future revision it tnl has more than one statement */ + + switch (old->type()) { + + case IR_CONTROL_LOOP: + tf_old = static_cast(old)->tf_; + break; + case IR_CONTROL_BLOCK: + tf_old = static_cast(old)->start_; + break; + + default: + throw ir_error("control structure to be replaced not supported"); + break; + } + + std::string y = tf_old->unparseToString(); + SgStatement *s = isSgStatement(tf_old); + if (s != 0) { + SgStatement *p = isSgStatement(tf_old->get_parent()); + + if (p != 0) { + SgStatement* temp = s; + if (tnl != NULL) { + SgStatementPtrList::iterator it = (*tnl).begin(); + p->insert_statement(temp, *it, true); + temp = *it; + p->remove_statement(s); + it++; + for (; it != (*tnl).end(); it++) { + p->insert_statement(temp, *it, false); + temp = *it; + } + } else if (node_ != NULL) { + if (!isSgStatement(node_)) + throw ir_error("Replacing Code not a statement!"); + else { + SgStatement* replace_ = isSgStatement(node_); + p->insert_statement(s, replace_, true); + p->remove_statement(s); + + } + } else { + throw ir_error("Replacing Code not a statement!"); + } + } else + throw ir_error("Replacing Code not a statement!"); + } else + throw ir_error("Replacing Code not a statement!"); + + delete old; + delete repr; + /* May need future revision it tnl has more than one statement */ + /* + switch (old->type()) { + + case IR_CONTROL_LOOP: + tf_old = static_cast(old)->tf_; + break; + case IR_CONTROL_BLOCK: + tf_old = static_cast(old)->start_; + break; + + default: + throw ir_error("control structure to be replaced not supported"); + break; + } + + // std::string y = tf_old->unparseToString(); + SgStatement *s = isSgStatement(tf_old); + if (s != 0) { + SgStatement *p = isSgStatement(tf_old->get_parent()); + + if (p != 0) { + // SgStatement* it2 = isSgStatement(tnl); + + // if(it2 != NULL){ + p->replace_statement(s, *tnl); + // } + // else { + // throw ir_error("Replacing Code not a statement!"); + // } + } else + throw ir_error("Replacing Code not a statement!"); + } else + throw ir_error("Replacing Code not a statement!"); + // y = tnl->unparseToString(); + delete old; + delete repr; + */ +} + +void IR_roseCode::ReplaceExpression(IR_Ref *old, omega::CG_outputRepr *repr) { + + SgExpression* op = static_cast(repr)->GetExpression(); + + if (typeid(*old) == typeid(IR_roseArrayRef)) { + SgPntrArrRefExp* ia_orig = static_cast(old)->ia_; + SgExpression* parent = isSgExpression(isSgNode(ia_orig)->get_parent()); + std::string x = isSgNode(op)->unparseToString(); + std::string y = isSgNode(ia_orig)->unparseToString(); + if (parent != NULL) { + std::string z = isSgNode(parent)->unparseToString(); + parent->replace_expression(ia_orig, op); + isSgNode(op)->set_parent(isSgNode(parent)); + + /* if(isSgBinaryOp(parent)) + { + if(isSgBinaryOp(parent)->get_lhs_operand() == ia_orig){ + isSgBinaryOp(parent)->set_lhs_operand(op); + }else if(isSgBinaryOp(parent)->get_rhs_operand() == ia_orig){ + isSgBinaryOp(parent)->set_rhs_operand(op); + + + } + else + parent->replace_expression(ia_orig, op); + */ + } else { + SgStatement* parent_stmt = isSgStatement( + isSgNode(ia_orig)->get_parent()); + if (parent_stmt != NULL) + parent_stmt->replace_expression(ia_orig, op); + else + throw ir_error( + "ReplaceExpression: parent neither expression nor statement"); + } + } else + throw ir_error("replacing a scalar variable not implemented"); + + delete old; +} + +/*std::pair, std::vector > IR_roseCode::FindScalarDeps( + const omega::CG_outputRepr *repr1, const omega::CG_outputRepr *repr2, + std::vector index, int i, int j) { + + std::vector dvs1; + std::vector dvs2; + SgNode *tnl_1 = static_cast(repr1)->GetCode(); + SgNode *tnl_2 = static_cast(repr2)->GetCode(); + SgStatementPtrList* list_1 = + static_cast(repr1)->GetList(); + SgStatementPtrList output_list_1; + + std::map read_scalars_1; + std::map write_scalars_1; + std::set indices; + //std::set reaching_defs_1; + std::set def_vars_1; + + populateLists(tnl_1, list_1, output_list_1); + populateScalars(repr1, read_scalars_1, write_scalars_1, indices, index); + //def_vars_1); + //findDefinitions(output_list_1, reaching_defs_1, write_scalars_1); + //def_vars_1); + if (repr1 == repr2) + checkSelfDependency(output_list_1, dvs1, read_scalars_1, + write_scalars_1, index, i, j); + else { + SgStatementPtrList* list_2 = + static_cast(repr2)->GetList(); + SgStatementPtrList output_list_2; + + std::map read_scalars_2; + std::map write_scalars_2; + //std::set reaching_defs_2; + std::set def_vars_2; + + populateLists(tnl_2, list_2, output_list_2); + populateScalars(repr2, read_scalars_2, write_scalars_2, indices, index); + //def_vars_2); + + checkDependency(output_list_2, dvs1, read_scalars_2, write_scalars_1, + index, i, j); + checkDependency(output_list_1, dvs1, read_scalars_1, write_scalars_2, + index, i, j); + checkWriteDependency(output_list_2, dvs1, write_scalars_2, + write_scalars_1, index, i, j); + checkWriteDependency(output_list_1, dvs1, write_scalars_1, + write_scalars_2, index, i, j); + } + + return std::make_pair(dvs1, dvs2); + //populateLists(tnl_2, list_2, list2); + + } +*/ +IR_OPERATION_TYPE IR_roseCode::QueryExpOperation( + const omega::CG_outputRepr *repr) const { + SgExpression* op = + static_cast(repr)->GetExpression(); + + if (isSgValueExp(op)) + return IR_OP_CONSTANT; + else if (isSgVarRefExp(op) || isSgPntrArrRefExp(op)) + return IR_OP_VARIABLE; + else if (isSgAssignOp(op) || isSgCompoundAssignOp(op)) + return IR_OP_ASSIGNMENT; + else if (isSgAddOp(op)) + return IR_OP_PLUS; + else if (isSgSubtractOp(op)) + return IR_OP_MINUS; + else if (isSgMultiplyOp(op)) + return IR_OP_MULTIPLY; + else if (isSgDivideOp(op)) + return IR_OP_DIVIDE; + else if (isSgMinusOp(op)) + return IR_OP_NEGATIVE; + else if (isSgConditionalExp(op)) { + SgExpression* cond = isSgConditionalExp(op)->get_conditional_exp(); + if (isSgGreaterThanOp(cond)) + return IR_OP_MAX; + else if (isSgLessThanOp(cond)) + return IR_OP_MIN; + } else if (isSgUnaryAddOp(op)) + return IR_OP_POSITIVE; + else if (isSgNullExpression(op)) + return IR_OP_NULL; + else + return IR_OP_UNKNOWN; +} +/*void IR_roseCode::populateLists(SgNode* tnl_1, SgStatementPtrList* list_1, + SgStatementPtrList& output_list_1) { + if ((tnl_1 == NULL) && (list_1 != NULL)) { + output_list_1 = *list_1; + } else if (tnl_1 != NULL) { + + if (isSgForStatement(tnl_1)) { + SgStatement* check = isSgForStatement(tnl_1)->get_loop_body(); + if (isSgBasicBlock(check)) { + output_list_1 = isSgBasicBlock(check)->get_statements(); + + } else + output_list_1.push_back(check); + + } else if (isSgBasicBlock(tnl_1)) + output_list_1 = isSgBasicBlock(tnl_1)->get_statements(); + else if (isSgExprStatement(tnl_1)) + output_list_1.push_back(isSgExprStatement(tnl_1)); + else + //if (isSgIfStmt(tnl_1)) { + + throw ir_error( + "Statement type not handled, (probably IF statement)!!"); + + } + + } + + void IR_roseCode::populateScalars(const omega::CG_outputRepr *repr1, + std::map &read_scalars_1, + std::map &write_scalars_1, + std::set &indices, std::vector &index) { + + //std::set &def_vars) { + std::vector scalars = FindScalarRef(repr1); + + for (int k = 0; k < index.size(); k++) + indices.insert(index[k]); + + for (int k = 0; k < scalars.size(); k++) + if (indices.find(scalars[k]->name()) == indices.end()) { + if (scalars[k]->is_write()) { + write_scalars_1.insert( + std::pair( + (isSgVarRefExp( + static_cast(scalars[k]->convert())->GetExpression())), + scalars[k])); + + } else + + read_scalars_1.insert( + std::pair( + (isSgVarRefExp( + static_cast(scalars[k]->convert())->GetExpression())), + scalars[k])); + } + + } + + + void IR_roseCode::checkWriteDependency(SgStatementPtrList &output_list_1, + std::vector &dvs1, + std::map &read_scalars_1, + std::map &write_scalars_1, + std::vector &index, int i, int j) { + + for (std::map::iterator it = + read_scalars_1.begin(); it != read_scalars_1.end(); it++) { + SgVarRefExp* var__ = it->first; + + ssa_unfiltered_cfg::SSA_UnfilteredCfg::NodeReachingDefTable to_compare = + main_ssa->getReachingDefsBefore(isSgNode(var__)); + + for (ssa_unfiltered_cfg::SSA_UnfilteredCfg::NodeReachingDefTable::iterator it4 = + to_compare.begin(); it4 != to_compare.end(); it4++) { + ssa_unfiltered_cfg::SSA_UnfilteredCfg::VarName var_ = it4->first; + for (int j = 0; j < var_.size(); j++) { + int found = 0; + if (var_[j] == var__->get_symbol()->get_declaration()) { + + ssa_unfiltered_cfg::ReachingDef::ReachingDefPtr to_compare_2 = + it4->second; + + if (to_compare_2->isPhiFunction()) { + std::set to_compare_set = + to_compare_2->getActualDefinitions(); + for (std::set::iterator cfg_it = + to_compare_set.begin(); + cfg_it != to_compare_set.end(); cfg_it++) { + + if (isSgAssignOp(cfg_it->getNode()) + || isSgCompoundAssignOp(cfg_it->getNode())) + if (SgVarRefExp* variable = + isSgVarRefExp( + isSgBinaryOp(cfg_it->getNode())->get_lhs_operand())) { + + if (write_scalars_1.find(variable) + != write_scalars_1.end()) { + + + //end debug + found = 1; + DependenceVector dv1; + dv1.sym = it->second->symbol(); + dv1.is_scalar_dependence = true; + + int max = (j > i) ? j : i; + int start = index.size() - max; + + //1.lbounds.push_back(0); + //1.ubounds.push_back(0); + //dv2.sym = + // read_scalars_2.find(*di)->second->symbol(); + for (int k = 0; k < index.size(); k++) { + if (k >= max) { + dv1.lbounds.push_back( + negInfinity); + dv1.ubounds.push_back(-1); + } else { + dv1.lbounds.push_back(0); + dv1.ubounds.push_back(0); + + } + + } + dvs1.push_back(dv1); + break; + } + } + } + + } + + } + if (found == 1) + break; + } + } + } + } + void IR_roseCode::checkDependency(SgStatementPtrList &output_list_1, + std::vector &dvs1, + std::map &read_scalars_1, + std::map &write_scalars_1, + std::vector &index, int i, int j) { + + for (SgStatementPtrList::iterator it2 = output_list_1.begin(); + it2 != output_list_1.end(); it2++) { + + std::set vars_1 = main_ssa->getUsesAtNode( + isSgNode(isSgExprStatement(*it2)->get_expression())); + + std::set::iterator di; + + for (di = vars_1.begin(); di != vars_1.end(); di++) { + int found = 0; + if (read_scalars_1.find(*di) != read_scalars_1.end()) { + + ssa_unfiltered_cfg::ReachingDef::ReachingDefPtr to_compare = + main_ssa->getDefinitionForUse(*di); + if (to_compare->isPhiFunction()) { + + std::set to_compare_set = + to_compare->getActualDefinitions(); + + for (std::set::iterator cfg_it = + to_compare_set.begin(); + cfg_it != to_compare_set.end(); cfg_it++) { + + + if (SgAssignOp* definition = isSgAssignOp( + cfg_it->getNode())) + if (SgVarRefExp* variable = isSgVarRefExp( + definition->get_lhs_operand())) { + + if (write_scalars_1.find(variable) + != write_scalars_1.end()) { + + found = 1; + DependenceVector dv1; + //DependenceVector dv2; + dv1.sym = + read_scalars_1.find(*di)->second->symbol(); + dv1.is_scalar_dependence = true; + + int max = (j > i) ? j : i; + int start = index.size() - max; + + //1.lbounds.push_back(0); + //1.ubounds.push_back(0); + //dv2.sym = + // read_scalars_2.find(*di)->second->symbol(); + for (int k = 0; k < index.size(); k++) { + if (k >= max) { + dv1.lbounds.push_back(negInfinity); + dv1.ubounds.push_back(-1); + } else { + dv1.lbounds.push_back(0); + dv1.ubounds.push_back(0); + + } + + } + dvs1.push_back(dv1); + break; + } + } + } + } + if (found == 1) + break; + } + } + } + + } + + void IR_roseCode::checkSelfDependency(SgStatementPtrList &output_list_1, + std::vector &dvs1, + std::map &read_scalars_1, + std::map &write_scalars_1, + std::vector &index, int i, int j) { + + for (SgStatementPtrList::iterator it2 = output_list_1.begin(); + it2 != output_list_1.end(); it2++) { + + std::set vars_1 = main_ssa->getUsesAtNode( + isSgNode(isSgExprStatement(*it2)->get_expression())); + + std::set::iterator di; + + for (di = vars_1.begin(); di != vars_1.end(); di++) { + + if (read_scalars_1.find(*di) != read_scalars_1.end()) { + + ssa_unfiltered_cfg::ReachingDef::ReachingDefPtr to_compare = + main_ssa->getDefinitionForUse(*di); + if (to_compare->isPhiFunction()) { + + std::set to_compare_set = + to_compare->getActualDefinitions(); + int found = 0; + for (std::set::iterator cfg_it = + to_compare_set.begin(); + cfg_it != to_compare_set.end(); cfg_it++) { + + if (isSgAssignOp(cfg_it->getNode()) + || isSgCompoundAssignOp(cfg_it->getNode())) + if (SgVarRefExp* variable = + isSgVarRefExp( + isSgBinaryOp(cfg_it->getNode())->get_lhs_operand())) { + + if (write_scalars_1.find(variable) + == write_scalars_1.end()) { + + + found = 1; + DependenceVector dv1; + dv1.sym = + read_scalars_1.find(*di)->second->symbol(); + dv1.is_scalar_dependence = true; + + int max = (j > i) ? j : i; + int start = index.size() - max; + + //1.lbounds.push_back(0); + //1.ubounds.push_back(0); + //dv2.sym = + // read_scalars_2.find(*di)->second->symbol(); + for (int k = 0; k < index.size(); k++) { + if (k >= max) { + dv1.lbounds.push_back(negInfinity); + dv1.ubounds.push_back(-1); + } else { + dv1.lbounds.push_back(0); + dv1.ubounds.push_back(0); + + } + + } + dvs1.push_back(dv1); + break; + } + } + } + } + + } + } + } + + } +*/ +IR_CONDITION_TYPE IR_roseCode::QueryBooleanExpOperation( + const omega::CG_outputRepr *repr) const { + SgExpression* op2 = + static_cast(repr)->GetExpression(); + SgNode* op; + + if (op2 == NULL) { + op = static_cast(repr)->GetCode(); + + if (op != NULL) { + if (isSgExprStatement(op)) + op2 = isSgExprStatement(op)->get_expression(); + else + return IR_COND_UNKNOWN; + } else + return IR_COND_UNKNOWN; + } + + if (isSgEqualityOp(op2)) + return IR_COND_EQ; + else if (isSgNotEqualOp(op2)) + return IR_COND_NE; + else if (isSgLessThanOp(op2)) + return IR_COND_LT; + else if (isSgLessOrEqualOp(op2)) + return IR_COND_LE; + else if (isSgGreaterThanOp(op2)) + return IR_COND_GT; + else if (isSgGreaterOrEqualOp(op2)) + return IR_COND_GE; + + return IR_COND_UNKNOWN; + +} + +std::vector IR_roseCode::QueryExpOperand( + const omega::CG_outputRepr *repr) const { + std::vector v; + SgExpression* op1; + SgExpression* op2; + SgExpression* op = + static_cast(repr)->GetExpression(); + omega::CG_roseRepr *repr1; + + if (isSgValueExp(op) || isSgVarRefExp(op)) { + omega::CG_roseRepr *repr = new omega::CG_roseRepr(op); + v.push_back(repr); + } else if (isSgAssignOp(op)) { + op1 = isSgAssignOp(op)->get_rhs_operand(); + repr1 = new omega::CG_roseRepr(op1); + v.push_back(repr1); + /*may be a problem as assignOp is a binaryop destop might be needed */ + } else if (isSgMinusOp(op)) { + op1 = isSgMinusOp(op)->get_operand(); + repr1 = new omega::CG_roseRepr(op1); + v.push_back(repr1); + } else if (isSgUnaryAddOp(op)) { + op1 = isSgUnaryAddOp(op)->get_operand(); + repr1 = new omega::CG_roseRepr(op1); + v.push_back(repr1); + } else if ((isSgAddOp(op) || isSgSubtractOp(op)) + || (isSgMultiplyOp(op) || isSgDivideOp(op))) { + op1 = isSgBinaryOp(op)->get_lhs_operand(); + repr1 = new omega::CG_roseRepr(op1); + v.push_back(repr1); + + op2 = isSgBinaryOp(op)->get_rhs_operand(); + repr1 = new omega::CG_roseRepr(op2); + v.push_back(repr1); + } else if (isSgConditionalExp(op)) { + SgExpression* cond = isSgConditionalExp(op)->get_conditional_exp(); + op1 = isSgBinaryOp(cond)->get_lhs_operand(); + repr1 = new omega::CG_roseRepr(op1); + v.push_back(repr1); + + op2 = isSgBinaryOp(cond)->get_rhs_operand(); + repr1 = new omega::CG_roseRepr(op2); + v.push_back(repr1); + } else if (isSgCompoundAssignOp(op)) { + SgExpression* cond = isSgCompoundAssignOp(op); + op1 = isSgBinaryOp(cond)->get_lhs_operand(); + repr1 = new omega::CG_roseRepr(op1); + v.push_back(repr1); + + op2 = isSgBinaryOp(cond)->get_rhs_operand(); + repr1 = new omega::CG_roseRepr(op2); + v.push_back(repr1); + + } else if (isSgBinaryOp(op)) { + + op1 = isSgBinaryOp(op)->get_lhs_operand(); + repr1 = new omega::CG_roseRepr(op1); + v.push_back(repr1); + + op2 = isSgBinaryOp(op)->get_rhs_operand(); + repr1 = new omega::CG_roseRepr(op2); + v.push_back(repr1); + } + + else + throw ir_error("operation not supported"); + + return v; +} + +IR_Ref *IR_roseCode::Repr2Ref(const omega::CG_outputRepr *repr) const { + SgExpression* op = + static_cast(repr)->GetExpression(); + + if (SgValueExp* im = isSgValueExp(op)) { + if (isSgIntVal(im)) + return new IR_roseConstantRef(this, + static_cast(isSgIntVal(im)->get_value())); + else if (isSgUnsignedIntVal(im)) + return new IR_roseConstantRef(this, + static_cast(isSgUnsignedIntVal(im)->get_value())); + else if (isSgLongIntVal(im)) + return new IR_roseConstantRef(this, + static_cast(isSgLongIntVal(im)->get_value())); + else if (isSgFloatVal(im)) + return new IR_roseConstantRef(this, isSgFloatVal(im)->get_value()); + else + assert(0); + + } else if (isSgVarRefExp(op)) + return new IR_roseScalarRef(this, isSgVarRefExp(op)); + else + assert(0); + +} + diff --git a/chill/src/ir_rose_utils.cc b/chill/src/ir_rose_utils.cc new file mode 100644 index 0000000..fbce2f1 --- /dev/null +++ b/chill/src/ir_rose_utils.cc @@ -0,0 +1,88 @@ +/***************************************************************************** + Copyright (C) 2008 University of Southern California + Copyright (C) 2009 University of Utah + All Rights Reserved. + + Purpose: + SUIF interface utilities. + + Notes: + + Update history: + 01/2006 created by Chun Chen +*****************************************************************************/ + +//#include +//#include +//#include +//#include +//#include +#include "ir_rose_utils.hh" + + + +std::vector find_loops(SgNode *tnl) { + std::vector result; + + //tree_node_list_iter iter(tnl); + + /*while (!iter.is_empty()) { + tree_node *tn = iter.step(); + if (tn->kind() == TREE_FOR) + result.push_back(static_cast(tn)); + } + */ + + SgStatementPtrList& blockStatements = isSgBasicBlock(tnl)->get_statements(); + for(SgStatementPtrList::const_iterator j = blockStatements.begin(); j != blockStatements.end(); j++) + if(isSgForStatement(*j)) + result.push_back(isSgForStatement(*j)); + + return result; +} + +std::vector find_deepest_loops(SgStatementPtrList& tnl) { + + std::vector loops; + + + + for(SgStatementPtrList::const_iterator j = tnl.begin(); j != tnl.end(); j++) + { + std::vector t = find_deepest_loops(isSgNode(*j)); + if (t.size() > loops.size()) + loops = t; + } + + + + return loops; + +} + + + + + + + + +std::vector find_deepest_loops(SgNode *tn) { + if (isSgForStatement(tn)) { + std::vector loops; + + SgForStatement *tnf = static_cast(tn); + loops.insert(loops.end(), tnf); + std::vector t = find_deepest_loops(isSgNode(tnf->get_loop_body())); + std::copy(t.begin(), t.end(), std::back_inserter(loops)); + + return loops; + } + else if (isSgBasicBlock(tn)) { + SgBasicBlock *tnb = static_cast(tn); + return find_deepest_loops(tnb->get_statements()); + } + else + return std::vector(); +} + diff --git a/chill/src/irtools.cc b/chill/src/irtools.cc new file mode 100644 index 0000000..4ab6c85 --- /dev/null +++ b/chill/src/irtools.cc @@ -0,0 +1,279 @@ +/***************************************************************************** + Copyright (C) 2010 University of Utah + All Rights Reserved. + + Purpose: + Useful tools to analyze code in compiler IR format. + + Notes: + + History: + 06/2010 Created by Chun Chen. +*****************************************************************************/ + +#include +#include +#include "irtools.hh" +#include "omegatools.hh" +#include "chill_error.hh" + +using namespace omega; + +// Build IR tree from the source code. Block type node can only be +// leaf, i.e., there is no further structures inside a block allowed. +std::vector build_ir_tree(IR_Control *control, ir_tree_node *parent) { + std::vector result; + + switch (control->type()) { + case IR_CONTROL_BLOCK: { + std::vector controls = control->ir_->FindOneLevelControlStructure(static_cast(control)); + if (controls.size() == 0) { + ir_tree_node *node = new ir_tree_node; + node->content = control; + node->parent = parent; + node->payload = -1; + result.push_back(node); + } + else { + delete control; + for (int i = 0; i < controls.size(); i++) + switch (controls[i]->type()) { + case IR_CONTROL_BLOCK: { + std::vector t = build_ir_tree(controls[i], parent); + result.insert(result.end(), t.begin(), t.end()); + break; + } + case IR_CONTROL_LOOP: { + ir_tree_node *node = new ir_tree_node; + node->content = controls[i]; + node->parent = parent; + node->children = build_ir_tree(static_cast(controls[i])->body(), node); + node->payload = -1; + result.push_back(node); + break; + } + case IR_CONTROL_IF: { + static int unique_if_identifier = 0; + + IR_Block *block = static_cast(controls[i])->then_body(); + if (block != NULL) { + ir_tree_node *node = new ir_tree_node; + node->content = controls[i]; + node->parent = parent; + node->children = build_ir_tree(block, node); + node->payload = unique_if_identifier+1; + result.push_back(node); + } + + + block = static_cast(controls[i])->else_body(); + if ( block != NULL) { + ir_tree_node *node = new ir_tree_node; + node->content = controls[i]->clone(); + node->parent = parent; + node->children = build_ir_tree(block, node); + node->payload = unique_if_identifier; + result.push_back(node); + } + + unique_if_identifier += 2; + break; + } + default: + ir_tree_node *node = new ir_tree_node; + node->content = controls[i]; + node->parent = parent; + node->payload = -1; + result.push_back(node); + break; + } + } + break; + } + case IR_CONTROL_LOOP: { + ir_tree_node *node = new ir_tree_node; + node->content = control; + node->parent = parent; + node->children = build_ir_tree(static_cast(control)->body(), node); + node->payload = -1; + result.push_back(node); + break; + } + default: + ir_tree_node *node = new ir_tree_node; + node->content = control; + node->parent = parent; + node->payload = -1; + result.push_back(node); + break; + } + + return result; +} + + +// Extract statements from IR tree. Statements returned are ordered in +// lexical order in the source code. +std::vector extract_ir_stmts(const std::vector &ir_tree) { + std::vector result; + for (int i = 0; i < ir_tree.size(); i++) + switch (ir_tree[i]->content->type()) { + case IR_CONTROL_BLOCK: + result.push_back(ir_tree[i]); + break; + case IR_CONTROL_LOOP: { + // clear loop payload from previous unsuccessful initialization process + ir_tree[i]->payload = -1; + + std::vector t = extract_ir_stmts(ir_tree[i]->children); + result.insert(result.end(), t.begin(), t.end()); + break; + } + case IR_CONTROL_IF: { + std::vector t = extract_ir_stmts(ir_tree[i]->children); + result.insert(result.end(), t.begin(), t.end()); + break; + } + default: + throw std::invalid_argument("invalid ir tree"); + } + + return result; +} + + +bool is_dependence_valid(ir_tree_node *src_node, ir_tree_node *dst_node, + const DependenceVector &dv, bool before) { + std::set loop_nodes; + ir_tree_node *itn = src_node; + + if (!dv.is_scalar_dependence) { + while (itn->parent != NULL) { + itn = itn->parent; + if (itn->content->type() == IR_CONTROL_LOOP) + loop_nodes.insert(itn); + } + + int last_dim = -1; + itn = dst_node; + while (itn->parent != NULL) { + itn = itn->parent; + if (itn->content->type() == IR_CONTROL_LOOP + && loop_nodes.find(itn) != loop_nodes.end() + && itn->payload > last_dim) + last_dim = itn->payload; + } + + if (last_dim == -1) + return true; + + for (int i = 0; i <= last_dim; i++) { + if (dv.lbounds[i] > 0) + return true; + else if (dv.lbounds[i] < 0) + return false; + } + + if (before) + return true; + else + return false; + } + + return true; + +} + + + +// Test data dependences between two statements. The first statement +// in parameter must be lexically before the second statement in +// parameter. Returned dependences are all lexicographically +// positive. The first vector in returned pair is dependences from the +// first statement to the second statement and the second vector in +// returned pair is in reverse order. +std::pair, std::vector > test_data_dependences( + IR_Code *ir, const CG_outputRepr *repr1, const Relation &IS1, + const CG_outputRepr *repr2, const Relation &IS2, + std::vector &freevar, std::vector index, + int i, int j) { + std::pair, std::vector > result; + + if (repr1 == repr2) { + std::vector access = ir->FindArrayRef(repr1); + + for (int i = 0; i < access.size(); i++) { + IR_ArrayRef *a = access[i]; + IR_ArraySymbol *sym_a = a->symbol(); + for (int j = i; j < access.size(); j++) { + IR_ArrayRef *b = access[j]; + IR_ArraySymbol *sym_b = b->symbol(); + + if (*sym_a == *sym_b && (a->is_write() || b->is_write())) { + Relation r = arrays2relation(ir, freevar, a, IS1, b, IS2); + std::pair, + std::vector > dv = + relation2dependences(a, b, r); + result.first.insert(result.first.end(), dv.first.begin(), + dv.first.end()); + result.second.insert(result.second.end(), dv.second.begin(), + dv.second.end()); + } + delete sym_b; + } + delete sym_a; + + } + + for (int i = 0; i < access.size(); i++) + delete access[i]; + } else { + std::vector access1 = ir->FindArrayRef(repr1); + std::vector access2 = ir->FindArrayRef(repr2); + + for (int i = 0; i < access1.size(); i++) { + IR_ArrayRef *a = access1[i]; + IR_ArraySymbol *sym_a = a->symbol(); + + for (int j = 0; j < access2.size(); j++) { + IR_ArrayRef *b = access2[j]; + IR_ArraySymbol *sym_b = b->symbol(); + if (*sym_a == *sym_b && (a->is_write() || b->is_write())) { + Relation r = arrays2relation(ir, freevar, a, IS1, b, IS2); + std::pair, + std::vector > dv = + relation2dependences(a, b, r); + + result.first.insert(result.first.end(), dv.first.begin(), + dv.first.end()); + result.second.insert(result.second.end(), dv.second.begin(), + dv.second.end()); + } + delete sym_b; + } + delete sym_a; + } + + for (int i = 0; i < access1.size(); i++) + delete access1[i]; + for (int i = 0; i < access2.size(); i++) + delete access2[i]; + } + /*std::pair, + std::vector > dv = + ir->FindScalarDeps(repr1, repr2, index, i, j); + + + result.first.insert(result.first.end(), dv.first.begin(), + dv.first.end()); + result.second.insert(result.second.end(), dv.second.begin(), + dv.second.end());*/ + /*result.first.insert(result.first.end(), dv.first.begin(), + dv.first.end()); + result.second.insert(result.second.end(), dv.second.begin(), + dv.second.end()); + */ + + return result; +} + diff --git a/chill/src/loop.cc b/chill/src/loop.cc new file mode 100644 index 0000000..0a82f7a --- /dev/null +++ b/chill/src/loop.cc @@ -0,0 +1,1870 @@ +/***************************************************************************** + Copyright (C) 2008 University of Southern California + Copyright (C) 2009-2010 University of Utah + All Rights Reserved. + + Purpose: + Core loop transformation functionality. + + Notes: + "level" (starting from 1) means loop level and it corresponds to "dim" + (starting from 0) in transformed iteration space [c_1,l_1,c_2,l_2,...., + c_n,l_n,c_(n+1)], e.g., l_2 is loop level 2 in generated code, dim 3 + in transformed iteration space, and variable 4 in Omega relation. + All c's are constant numbers only and they will not show up as actual loops. + Formula: + dim = 2*level - 1 + var = dim + 1 + + History: + 10/2005 Created by Chun Chen. + 09/2009 Expand tile functionality, -chun + 10/2009 Initialize unfusible loop nest without bailing out, -chun +*****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include "loop.hh" +#include "omegatools.hh" +#include "irtools.hh" +#include "chill_error.hh" +#include +#include +using namespace omega; + +const std::string Loop::tmp_loop_var_name_prefix = std::string("chill_t"); // Manu:: In fortran, first character of a variable name must be a letter, so this change +const std::string Loop::overflow_var_name_prefix = std::string("over"); + +//----------------------------------------------------------------------------- +// Class Loop +//----------------------------------------------------------------------------- +// --begin Anand: Added from CHiLL 0.2 + +bool Loop::isInitialized() const { + return stmt.size() != 0 && !stmt[0].xform.is_null(); +} + +//--end Anand: added from CHiLL 0.2 + +bool Loop::init_loop(std::vector &ir_tree, + std::vector &ir_stmt) { + + ir_stmt = extract_ir_stmts(ir_tree); + stmt_nesting_level_.resize(ir_stmt.size()); + std::vector stmt_nesting_level(ir_stmt.size()); + for (int i = 0; i < ir_stmt.size(); i++) { + ir_stmt[i]->payload = i; + int t = 0; + ir_tree_node *itn = ir_stmt[i]; + while (itn->parent != NULL) { + itn = itn->parent; + if (itn->content->type() == IR_CONTROL_LOOP) + t++; + } + stmt_nesting_level_[i] = t; + stmt_nesting_level[i] = t; + } + + stmt = std::vector(ir_stmt.size()); + int n_dim = -1; + int max_loc; + //std::vector index; + for (int i = 0; i < ir_stmt.size(); i++) { + int max_nesting_level = -1; + int loc; + for (int j = 0; j < ir_stmt.size(); j++) + if (stmt_nesting_level[j] > max_nesting_level) { + max_nesting_level = stmt_nesting_level[j]; + loc = j; + } + + // most deeply nested statement acting as a reference point + if (n_dim == -1) { + n_dim = max_nesting_level; + max_loc = loc; + + index = std::vector(n_dim); + + ir_tree_node *itn = ir_stmt[loc]; + int cur_dim = n_dim - 1; + while (itn->parent != NULL) { + itn = itn->parent; + if (itn->content->type() == IR_CONTROL_LOOP) { + index[cur_dim] = + static_cast(itn->content)->index()->name(); + itn->payload = cur_dim--; + } + } + } + + // align loops by names, temporary solution + ir_tree_node *itn = ir_stmt[loc]; + int depth = stmt_nesting_level_[loc] - 1; + /* while (itn->parent != NULL) { + itn = itn->parent; + if (itn->content->type() == IR_CONTROL_LOOP && itn->payload == -1) { + std::string name = static_cast(itn->content)->index()->name(); + for (int j = 0; j < n_dim; j++) + if (index[j] == name) { + itn->payload = j; + break; + } + if (itn->payload == -1) + throw loop_error("no complex alignment yet"); + } + } + */ + for (int t = depth; t >= 0; t--) { + int y = t; + ir_tree_node *itn = ir_stmt[loc]; + + while ((itn->parent != NULL) && (y >= 0)) { + itn = itn->parent; + if (itn->content->type() == IR_CONTROL_LOOP) + y--; + } + + if (itn->content->type() == IR_CONTROL_LOOP && itn->payload == -1) { + CG_outputBuilder *ocg = ir->builder(); + + itn->payload = depth - t; + + CG_outputRepr *code = + static_cast(ir_stmt[loc]->content)->extract(); + + std::vector index_expr; + std::vector old_index; + CG_outputRepr *repl = ocg->CreateIdent(index[itn->payload]); + index_expr.push_back(repl); + old_index.push_back( + static_cast(itn->content)->index()->name()); + code = ocg->CreateSubstitutedStmt(0, code, old_index, + index_expr); + + replace.insert(std::pair(loc, code)); + //stmt[loc].code = code; + + } + } + + // set relation variable names + Relation r(n_dim); + F_And *f_root = r.add_and(); + itn = ir_stmt[loc]; + int temp_depth = depth; + while (itn->parent != NULL) { + + itn = itn->parent; + if (itn->content->type() == IR_CONTROL_LOOP) { + r.name_set_var(itn->payload + 1, index[temp_depth]); + + temp_depth--; + } + //static_cast(itn->content)->index()->name()); + } + + /*while (itn->parent != NULL) { + itn = itn->parent; + if (itn->content->type() == IR_CONTROL_LOOP) + r.name_set_var(itn->payload+1, static_cast(itn->content)->index()->name()); + }*/ + + // extract information from loop/if structures + std::vector processed(n_dim, false); + std::vector vars_to_be_reversed; + itn = ir_stmt[loc]; + while (itn->parent != NULL) { + itn = itn->parent; + + switch (itn->content->type()) { + case IR_CONTROL_LOOP: { + IR_Loop *lp = static_cast(itn->content); + Variable_ID v = r.set_var(itn->payload + 1); + int c; + + try { + c = lp->step_size(); + if (c > 0) { + CG_outputRepr *lb = lp->lower_bound(); + exp2formula(ir, r, f_root, freevar, lb, v, 's', + IR_COND_GE, true); + CG_outputRepr *ub = lp->upper_bound(); + IR_CONDITION_TYPE cond = lp->stop_cond(); + if (cond == IR_COND_LT || cond == IR_COND_LE) + exp2formula(ir, r, f_root, freevar, ub, v, 's', + cond, true); + else + throw ir_error("loop condition not supported"); + + } else if (c < 0) { + CG_outputBuilder *ocg = ir->builder(); + CG_outputRepr *lb = lp->lower_bound(); + lb = ocg->CreateMinus(NULL, lb); + exp2formula(ir, r, f_root, freevar, lb, v, 's', + IR_COND_GE, true); + CG_outputRepr *ub = lp->upper_bound(); + ub = ocg->CreateMinus(NULL, ub); + IR_CONDITION_TYPE cond = lp->stop_cond(); + if (cond == IR_COND_GE) + exp2formula(ir, r, f_root, freevar, ub, v, 's', + IR_COND_LE, true); + else if (cond == IR_COND_GT) + exp2formula(ir, r, f_root, freevar, ub, v, 's', + IR_COND_LT, true); + else + throw ir_error("loop condition not supported"); + + vars_to_be_reversed.push_back(lp->index()->name()); + } else + throw ir_error("loop step size zero"); + } catch (const ir_error &e) { + for (int i = 0; i < itn->children.size(); i++) + delete itn->children[i]; + itn->children = std::vector(); + itn->content = itn->content->convert(); + return false; + } + + if (abs(c) != 1) { + F_Exists *f_exists = f_root->add_exists(); + Variable_ID e = f_exists->declare(); + F_And *f_and = f_exists->add_and(); + Stride_Handle h = f_and->add_stride(abs(c)); + if (c > 0) + h.update_coef(e, 1); + else + h.update_coef(e, -1); + h.update_coef(v, -1); + CG_outputRepr *lb = lp->lower_bound(); + exp2formula(ir, r, f_and, freevar, lb, e, 's', IR_COND_EQ, + true); + } + + processed[itn->payload] = true; + break; + } + case IR_CONTROL_IF: { + CG_outputRepr *cond = + static_cast(itn->content)->condition(); + try { + if (itn->payload % 2 == 1) + exp2constraint(ir, r, f_root, freevar, cond, true); + else { + F_Not *f_not = f_root->add_not(); + F_And *f_and = f_not->add_and(); + exp2constraint(ir, r, f_and, freevar, cond, true); + } + } catch (const ir_error &e) { + std::vector *t; + if (itn->parent == NULL) + t = &ir_tree; + else + t = &(itn->parent->children); + int id = itn->payload; + int i = t->size() - 1; + while (i >= 0) { + if ((*t)[i] == itn) { + for (int j = 0; j < itn->children.size(); j++) + delete itn->children[j]; + itn->children = std::vector(); + itn->content = itn->content->convert(); + } else if ((*t)[i]->payload >> 1 == id >> 1) { + delete (*t)[i]; + t->erase(t->begin() + i); + } + i--; + } + return false; + } + + break; + } + default: + for (int i = 0; i < itn->children.size(); i++) + delete itn->children[i]; + itn->children = std::vector(); + itn->content = itn->content->convert(); + return false; + } + } + + // add information for missing loops + for (int j = 0; j < n_dim; j++) + if (!processed[j]) { + ir_tree_node *itn = ir_stmt[max_loc]; + while (itn->parent != NULL) { + itn = itn->parent; + if (itn->content->type() == IR_CONTROL_LOOP + && itn->payload == j) + break; + } + + Variable_ID v = r.set_var(j + 1); + if (loc < max_loc) { + + CG_outputBuilder *ocg = ir->builder(); + + CG_outputRepr *lb = + static_cast(itn->content)->lower_bound(); + + exp2formula(ir, r, f_root, freevar, lb, v, 's', IR_COND_EQ, + false); + + /* if (ir->QueryExpOperation( + static_cast(itn->content)->lower_bound()) + == IR_OP_VARIABLE) { + IR_ScalarRef *ref = + static_cast(ir->Repr2Ref( + static_cast(itn->content)->lower_bound())); + std::string name_ = ref->name(); + + for (int i = 0; i < index.size(); i++) + if (index[i] == name_) { + exp2formula(ir, r, f_root, freevar, lb, v, 's', + IR_COND_GE, false); + + CG_outputRepr *ub = + static_cast(itn->content)->upper_bound(); + IR_CONDITION_TYPE cond = + static_cast(itn->content)->stop_cond(); + if (cond == IR_COND_LT || cond == IR_COND_LE) + exp2formula(ir, r, f_root, freevar, ub, v, + 's', cond, false); + + + + } + + } + */ + + } else { // loc > max_loc + + CG_outputBuilder *ocg = ir->builder(); + CG_outputRepr *ub = + static_cast(itn->content)->upper_bound(); + + exp2formula(ir, r, f_root, freevar, ub, v, 's', IR_COND_EQ, + false); + /*if (ir->QueryExpOperation( + static_cast(itn->content)->upper_bound()) + == IR_OP_VARIABLE) { + IR_ScalarRef *ref = + static_cast(ir->Repr2Ref( + static_cast(itn->content)->upper_bound())); + std::string name_ = ref->name(); + + for (int i = 0; i < index.size(); i++) + if (index[i] == name_) { + + CG_outputRepr *lb = + static_cast(itn->content)->lower_bound(); + + exp2formula(ir, r, f_root, freevar, lb, v, 's', + IR_COND_GE, false); + + CG_outputRepr *ub = + static_cast(itn->content)->upper_bound(); + IR_CONDITION_TYPE cond = + static_cast(itn->content)->stop_cond(); + if (cond == IR_COND_LT || cond == IR_COND_LE) + exp2formula(ir, r, f_root, freevar, ub, v, + 's', cond, false); + + + } + } + */ + } + } + + r.setup_names(); + r.simplify(); + + // insert the statement + CG_outputBuilder *ocg = ir->builder(); + std::vector reverse_expr; + for (int j = 1; j <= vars_to_be_reversed.size(); j++) { + CG_outputRepr *repl = ocg->CreateIdent(vars_to_be_reversed[j]); + repl = ocg->CreateMinus(NULL, repl); + reverse_expr.push_back(repl); + } + CG_outputRepr *code = + static_cast(ir_stmt[loc]->content)->extract(); + code = ocg->CreateSubstitutedStmt(0, code, vars_to_be_reversed, + reverse_expr); + stmt[loc].code = code; + stmt[loc].IS = r; + stmt[loc].loop_level = std::vector(n_dim); + stmt[loc].ir_stmt_node = ir_stmt[loc]; + for (int i = 0; i < n_dim; i++) { + stmt[loc].loop_level[i].type = LoopLevelOriginal; + stmt[loc].loop_level[i].payload = i; + stmt[loc].loop_level[i].parallel_level = 0; + } + + stmt_nesting_level[loc] = -1; + } + + return true; +} + +Loop::Loop(const IR_Control *control) { + + last_compute_cgr_ = NULL; + last_compute_cg_ = NULL; + + ir = const_cast(control->ir_); + init_code = NULL; + cleanup_code = NULL; + tmp_loop_var_name_counter = 1; + overflow_var_name_counter = 1; + known = Relation::True(0); + + ir_tree = build_ir_tree(control->clone(), NULL); + // std::vector ir_stmt; + + while (!init_loop(ir_tree, ir_stmt)) { + } + + + + for (int i = 0; i < stmt.size(); i++) { + std::map::iterator it = replace.find(i); + + if (it != replace.end()) + stmt[i].code = it->second; + else + stmt[i].code = stmt[i].code; + } + + if (stmt.size() != 0) + dep = DependenceGraph(stmt[0].IS.n_set()); + else + dep = DependenceGraph(0); + // init the dependence graph + for (int i = 0; i < stmt.size(); i++) + dep.insert(); + + for (int i = 0; i < stmt.size(); i++) + for (int j = i; j < stmt.size(); j++) { + std::pair, + std::vector > dv = test_data_dependences( + ir, stmt[i].code, stmt[i].IS, stmt[j].code, stmt[j].IS, + freevar, index, stmt_nesting_level_[i], + stmt_nesting_level_[j]); + + for (int k = 0; k < dv.first.size(); k++) { + if (is_dependence_valid(ir_stmt[i], ir_stmt[j], dv.first[k], + true)) + dep.connect(i, j, dv.first[k]); + else { + dep.connect(j, i, dv.first[k].reverse()); + } + + } + for (int k = 0; k < dv.second.size(); k++) + if (is_dependence_valid(ir_stmt[j], ir_stmt[i], dv.second[k], + false)) + dep.connect(j, i, dv.second[k]); + else { + dep.connect(i, j, dv.second[k].reverse()); + } + // std::pair, + // std::vector > dv_ = test_data_dependences( + + } + + + + // init dumb transformation relations e.g. [i, j] -> [ 0, i, 0, j, 0] + for (int i = 0; i < stmt.size(); i++) { + int n = stmt[i].IS.n_set(); + stmt[i].xform = Relation(n, 2 * n + 1); + F_And *f_root = stmt[i].xform.add_and(); + + for (int j = 1; j <= n; j++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(stmt[i].xform.output_var(2 * j), 1); + h.update_coef(stmt[i].xform.input_var(j), -1); + } + + for (int j = 1; j <= 2 * n + 1; j += 2) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(stmt[i].xform.output_var(j), 1); + } + stmt[i].xform.simplify(); + } + + if (stmt.size() != 0) + num_dep_dim = stmt[0].IS.n_set(); + else + num_dep_dim = 0; + // debug + /*for (int i = 0; i < stmt.size(); i++) { + std::cout << i << ": "; + //stmt[i].xform.print(); + stmt[i].IS.print(); + std::cout << std::endl; + + }*/ + //end debug +} + +Loop::~Loop() { + + delete last_compute_cgr_; + delete last_compute_cg_; + + for (int i = 0; i < stmt.size(); i++) + if (stmt[i].code != NULL) { + stmt[i].code->clear(); + delete stmt[i].code; + } + + for (int i = 0; i < ir_tree.size(); i++) + delete ir_tree[i]; + + if (init_code != NULL) { + init_code->clear(); + delete init_code; + } + if (cleanup_code != NULL) { + cleanup_code->clear(); + delete cleanup_code; + } +} + +int Loop::get_dep_dim_of(int stmt_num, int level) const { + if (stmt_num < 0 || stmt_num >= stmt.size()) + throw std::invalid_argument("invaid statement " + to_string(stmt_num)); + + if (level < 1 || level > stmt[stmt_num].loop_level.size()) + return -1; + + int trip_count = 0; + while (true) { + switch (stmt[stmt_num].loop_level[level - 1].type) { + case LoopLevelOriginal: + return stmt[stmt_num].loop_level[level - 1].payload; + case LoopLevelTile: + level = stmt[stmt_num].loop_level[level - 1].payload; + if (level < 1) + return -1; + if (level > stmt[stmt_num].loop_level.size()) + throw loop_error( + "incorrect loop level information for statement " + + to_string(stmt_num)); + break; + default: + throw loop_error( + "unknown loop level information for statement " + + to_string(stmt_num)); + } + trip_count++; + if (trip_count >= stmt[stmt_num].loop_level.size()) + throw loop_error( + "incorrect loop level information for statement " + + to_string(stmt_num)); + } +} + +int Loop::get_last_dep_dim_before(int stmt_num, int level) const { + if (stmt_num < 0 || stmt_num >= stmt.size()) + throw std::invalid_argument("invaid statement " + to_string(stmt_num)); + + if (level < 1) + return -1; + if (level > stmt[stmt_num].loop_level.size()) + level = stmt[stmt_num].loop_level.size() + 1; + + for (int i = level - 1; i >= 1; i--) + if (stmt[stmt_num].loop_level[i - 1].type == LoopLevelOriginal) + return stmt[stmt_num].loop_level[i - 1].payload; + + return -1; +} + +void Loop::print_internal_loop_structure() const { + for (int i = 0; i < stmt.size(); i++) { + std::vector lex = getLexicalOrder(i); + std::cout << "s" << i + 1 << ": "; + for (int j = 0; j < stmt[i].loop_level.size(); j++) { + if (2 * j < lex.size()) + std::cout << lex[2 * j]; + switch (stmt[i].loop_level[j].type) { + case LoopLevelOriginal: + std::cout << "(dim:" << stmt[i].loop_level[j].payload << ")"; + break; + case LoopLevelTile: + std::cout << "(tile:" << stmt[i].loop_level[j].payload << ")"; + break; + default: + std::cout << "(unknown)"; + } + std::cout << ' '; + } + for (int j = 2 * stmt[i].loop_level.size(); j < lex.size(); j += 2) { + std::cout << lex[j]; + if (j != lex.size() - 1) + std::cout << ' '; + } + std::cout << std::endl; + } +} + +CG_outputRepr *Loop::getCode(int effort) const { + const int m = stmt.size(); + if (m == 0) + return NULL; + const int n = stmt[0].xform.n_out(); + + if (last_compute_cg_ == NULL) { + std::vector IS(m); + std::vector xforms(m); + for (int i = 0; i < m; i++) { + IS[i] = stmt[i].IS; + xforms[i] = stmt[i].xform; + } + Relation known = Extend_Set(copy(this->known), n - this->known.n_set()); + + last_compute_cg_ = new CodeGen(xforms, IS, known); + delete last_compute_cgr_; + last_compute_cgr_ = NULL; + } + + if (last_compute_cgr_ == NULL || last_compute_effort_ != effort) { + delete last_compute_cgr_; + last_compute_cgr_ = last_compute_cg_->buildAST(effort); + last_compute_effort_ = effort; + } + + std::vector stmts(m); + for (int i = 0; i < m; i++) + stmts[i] = stmt[i].code; + CG_outputBuilder *ocg = ir->builder(); + CG_outputRepr *repr = last_compute_cgr_->printRepr(ocg, stmts); + + if (init_code != NULL) + repr = ocg->StmtListAppend(init_code->clone(), repr); + if (cleanup_code != NULL) + repr = ocg->StmtListAppend(repr, cleanup_code->clone()); + + return repr; +} + +void Loop::printCode(int effort) const { + const int m = stmt.size(); + if (m == 0) + return; + const int n = stmt[0].xform.n_out(); + + if (last_compute_cg_ == NULL) { + std::vector IS(m); + std::vector xforms(m); + for (int i = 0; i < m; i++) { + IS[i] = stmt[i].IS; + xforms[i] = stmt[i].xform; + } + Relation known = Extend_Set(copy(this->known), n - this->known.n_set()); + + last_compute_cg_ = new CodeGen(xforms, IS, known); + delete last_compute_cgr_; + last_compute_cgr_ = NULL; + } + + if (last_compute_cgr_ == NULL || last_compute_effort_ != effort) { + delete last_compute_cgr_; + last_compute_cgr_ = last_compute_cg_->buildAST(effort); + last_compute_effort_ = effort; + } + + std::string repr = last_compute_cgr_->printString(); + std::cout << repr << std::endl; +} + +void Loop::printIterationSpace() const { + for (int i = 0; i < stmt.size(); i++) { + std::cout << "s" << i << ": "; + Relation r = getNewIS(i); + for (int j = 1; j <= r.n_inp(); j++) + r.name_input_var(j, CodeGen::loop_var_name_prefix + to_string(j)); + r.setup_names(); + r.print(); + } +} + +void Loop::printDependenceGraph() const { + if (dep.edgeCount() == 0) + std::cout << "no dependence exists" << std::endl; + else { + std::cout << "dependence graph:" << std::endl; + std::cout << dep; + } +} + +Relation Loop::getNewIS(int stmt_num) const { + Relation result; + + if (stmt[stmt_num].xform.is_null()) { + Relation known = Extend_Set(copy(this->known), + stmt[stmt_num].IS.n_set() - this->known.n_set()); + result = Intersection(copy(stmt[stmt_num].IS), known); + } else { + Relation known = Extend_Set(copy(this->known), + stmt[stmt_num].xform.n_out() - this->known.n_set()); + result = Intersection( + Range( + Restrict_Domain(copy(stmt[stmt_num].xform), + copy(stmt[stmt_num].IS))), known); + } + + result.simplify(2, 4); + + return result; +} + +std::vector Loop::getNewIS() const { + const int m = stmt.size(); + + std::vector new_IS(m); + for (int i = 0; i < m; i++) + new_IS[i] = getNewIS(i); + + return new_IS; +} + +void Loop::pragma(int stmt_num, int level, const std::string &pragmaText) { + // check sanity of parameters + if(stmt_num < 0) + throw std::invalid_argument("invalid statement " + to_string(stmt_num)); + + CG_outputBuilder *ocg = ir->builder(); + CG_outputRepr *code = stmt[stmt_num].code; + ocg->CreatePragmaAttribute(code, level, pragmaText); +} +/* +void Loop::prefetch(int stmt_num, int level, const std::string &arrName, const std::string &indexName, int offset, int hint) { + // check sanity of parameters + if(stmt_num < 0) + throw std::invalid_argument("invalid statement " + to_string(stmt_num)); + + CG_outputBuilder *ocg = ir->builder(); + CG_outputRepr *code = stmt[stmt_num].code; + ocg->CreatePrefetchAttribute(code, level, arrName, indexName, int offset, hint); +} +*/ + +void Loop::prefetch(int stmt_num, int level, const std::string &arrName, int hint) { + // check sanity of parameters + if(stmt_num < 0) + throw std::invalid_argument("invalid statement " + to_string(stmt_num)); + + CG_outputBuilder *ocg = ir->builder(); + CG_outputRepr *code = stmt[stmt_num].code; + ocg->CreatePrefetchAttribute(code, level, arrName, hint); +} + +std::vector Loop::getLexicalOrder(int stmt_num) const { + assert(stmt_num < stmt.size()); + + const int n = stmt[stmt_num].xform.n_out(); + std::vector lex(n, 0); + + for (int i = 0; i < n; i += 2) + lex[i] = get_const(stmt[stmt_num].xform, i, Output_Var); + + return lex; +} + +// find the sub loop nest specified by stmt_num and level, +// only iteration space satisfiable statements returned. +std::set Loop::getSubLoopNest(int stmt_num, int level) const { + assert(stmt_num >= 0 && stmt_num < stmt.size()); + assert(level > 0 && level <= stmt[stmt_num].loop_level.size()); + + std::set working; + for (int i = 0; i < stmt.size(); i++) + if (const_cast(this)->stmt[i].IS.is_upper_bound_satisfiable() + && stmt[i].loop_level.size() >= level) + working.insert(i); + + for (int i = 1; i <= level; i++) { + int a = getLexicalOrder(stmt_num, i); + for (std::set::iterator j = working.begin(); j != working.end();) { + int b = getLexicalOrder(*j, i); + if (b != a) + working.erase(j++); + else + ++j; + } + } + + return working; +} + +int Loop::getLexicalOrder(int stmt_num, int level) const { + assert(stmt_num >= 0 && stmt_num < stmt.size()); + assert(level > 0 && level <= stmt[stmt_num].loop_level.size()+1); + + Relation &r = const_cast(this)->stmt[stmt_num].xform; + for (EQ_Iterator e(r.single_conjunct()->EQs()); e; e++) + if (abs((*e).get_coef(r.output_var(2 * level - 1))) == 1) { + bool is_const = true; + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) + if (cvi.curr_var() != r.output_var(2 * level - 1)) { + is_const = false; + break; + } + if (is_const) { + int t = static_cast((*e).get_const()); + return (*e).get_coef(r.output_var(2 * level - 1)) > 0 ? -t : t; + } + } + + throw loop_error( + "can't find lexical order for statement " + to_string(stmt_num) + + "'s loop level " + to_string(level)); +} + +std::set Loop::getStatements(const std::vector &lex, int dim) const { + const int m = stmt.size(); + + std::set same_loops; + for (int i = 0; i < m; i++) { + if (dim < 0) + same_loops.insert(i); + else { + std::vector a_lex = getLexicalOrder(i); + int j; + for (j = 0; j <= dim; j += 2) + if (lex[j] != a_lex[j]) + break; + if (j > dim) + same_loops.insert(i); + } + + } + + return same_loops; +} + +void Loop::shiftLexicalOrder(const std::vector &lex, int dim, int amount) { + const int m = stmt.size(); + + if (amount == 0) + return; + + for (int i = 0; i < m; i++) { + std::vector lex2 = getLexicalOrder(i); + + bool need_shift = true; + + for (int j = 0; j < dim; j++) + if (lex2[j] != lex[j]) { + need_shift = false; + break; + } + + if (!need_shift) + continue; + + if (amount > 0) { + if (lex2[dim] < lex[dim]) + continue; + } else if (amount < 0) { + if (lex2[dim] > lex[dim]) + continue; + } + + assign_const(stmt[i].xform, dim, lex2[dim] + amount); + } +} + +std::vector > Loop::sort_by_same_loops(std::set active, + int level) { + + std::set not_nested_at_this_level; + std::map > sorted_by_loop; + std::map > sorted_by_lex_order; + std::vector > to_return; + bool lex_order_already_set = false; + for (std::set::iterator it = active.begin(); it != active.end(); + it++) { + + if (stmt[*it].ir_stmt_node == NULL) + lex_order_already_set = true; + } + + if (lex_order_already_set) { + + for (std::set::iterator it = active.begin(); it != active.end(); + it++) { + std::map >::iterator it2 = + sorted_by_lex_order.find( + get_const(stmt[*it].xform, 2 * (level - 1), + Output_Var)); + + if (it2 != sorted_by_lex_order.end()) + it2->second.insert(*it); + else { + + std::set to_insert; + + to_insert.insert(*it); + + sorted_by_lex_order.insert( + std::pair >( + get_const(stmt[*it].xform, 2 * (level - 1), + Output_Var), to_insert)); + + } + + } + + for (std::map >::iterator it2 = + sorted_by_lex_order.begin(); it2 != sorted_by_lex_order.end(); + it2++) + to_return.push_back(it2->second); + + } else { + + for (std::set::iterator it = active.begin(); it != active.end(); + it++) { + + ir_tree_node* itn = stmt[*it].ir_stmt_node; + itn = itn->parent; + while ((itn != NULL) && (itn->payload != level - 1)) + itn = itn->parent; + + if (itn == NULL) + not_nested_at_this_level.insert(*it); + else { + std::map >::iterator it2 = + sorted_by_loop.find(itn); + + if (it2 != sorted_by_loop.end()) + it2->second.insert(*it); + else { + std::set to_insert; + + to_insert.insert(*it); + + sorted_by_loop.insert( + std::pair >(itn, + to_insert)); + + } + + } + + } + if (not_nested_at_this_level.size() > 0) { + for (std::set::iterator it = not_nested_at_this_level.begin(); + it != not_nested_at_this_level.end(); it++) { + std::set temp; + temp.insert(*it); + to_return.push_back(temp); + + } + } + for (std::map >::iterator it2 = + sorted_by_loop.begin(); it2 != sorted_by_loop.end(); it2++) + to_return.push_back(it2->second); + } + return to_return; +} + +void update_successors(int n, int node_num[], int cant_fuse_with[], + Graph, bool> &g, std::list &work_list) { + + std::set disconnect; + for (Graph, bool>::EdgeList::iterator i = + g.vertex[n].second.begin(); i != g.vertex[n].second.end(); i++) { + int m = i->first; + + if (node_num[m] != -1) + throw loop_error("Graph input for fusion has cycles not a DAG!!"); + + std::vector check_ = g.getEdge(n, m); + + bool has_bad_edge_path = false; + for (int i = 0; i < check_.size(); i++) + if (!check_[i]) { + has_bad_edge_path = true; + break; + } + if (has_bad_edge_path) + cant_fuse_with[m] = std::max(cant_fuse_with[m], node_num[n]); + else + cant_fuse_with[m] = std::max(cant_fuse_with[m], cant_fuse_with[n]); + disconnect.insert(m); + } + + + for (std::set::iterator i = disconnect.begin(); i != disconnect.end(); + i++) { + g.disconnect(n, *i); + + bool no_incoming_edges = true; + for (int j = 0; j < g.vertex.size(); j++) + if (j != *i) + if (g.hasEdge(j, *i)) { + no_incoming_edges = false; + break; + } + + + if (no_incoming_edges) + work_list.push_back(*i); + } + +} + +Graph, bool> Loop::construct_induced_graph_at_level( + std::vector > s, DependenceGraph dep, int dep_dim) { + Graph, bool> g; + + for (int i = 0; i < s.size(); i++) + g.insert(s[i]); + + for (int i = 0; i < s.size(); i++) { + + for (int j = i + 1; j < s.size(); j++) { + bool has_true_edge_i_to_j = false; + bool has_true_edge_j_to_i = false; + bool is_connected_i_to_j = false; + bool is_connected_j_to_i = false; + for (std::set::iterator ii = s[i].begin(); ii != s[i].end(); + ii++) { + + for (std::set::iterator jj = s[j].begin(); + jj != s[j].end(); jj++) { + + std::vector dvs = dep.getEdge(*ii, *jj); + for (int k = 0; k < dvs.size(); k++) + if (dvs[k].is_control_dependence() + || (dvs[k].is_data_dependence() + && dvs[k].has_been_carried_at(dep_dim))) { + + if (dvs[k].is_data_dependence() + && dvs[k].has_negative_been_carried_at( + dep_dim)) { + //g.connect(i, j, false); + is_connected_i_to_j = true; + break; + } else { + //g.connect(i, j, true); + + has_true_edge_i_to_j = true; + //break + } + } + + //if (is_connected) + + // break; + // if (has_true_edge_i_to_j && !is_connected_i_to_j) + // g.connect(i, j, true); + dvs = dep.getEdge(*jj, *ii); + for (int k = 0; k < dvs.size(); k++) + if (dvs[k].is_control_dependence() + || (dvs[k].is_data_dependence() + && dvs[k].has_been_carried_at(dep_dim))) { + + if (is_connected_i_to_j || has_true_edge_i_to_j) + throw loop_error( + "Graph input for fusion has cycles not a DAG!!"); + + if (dvs[k].is_data_dependence() + && dvs[k].has_negative_been_carried_at( + dep_dim)) { + //g.connect(i, j, false); + is_connected_j_to_i = true; + break; + } else { + //g.connect(i, j, true); + + has_true_edge_j_to_i = true; + //break; + } + } + + // if (is_connected) + //break; + // if (is_connected) + //break; + } + + + //if (is_connected) + // break; + } + + + if (is_connected_i_to_j) + g.connect(i, j, false); + else if (has_true_edge_i_to_j) + g.connect(i, j, true); + + if (is_connected_j_to_i) + g.connect(j, i, false); + else if (has_true_edge_j_to_i) + g.connect(j, i, true); + + + } + } + return g; +} + +std::vector > Loop::typed_fusion(Graph, bool> g) { + + bool roots[g.vertex.size()]; + + for (int i = 0; i < g.vertex.size(); i++) + roots[i] = true; + + for (int i = 0; i < g.vertex.size(); i++) + for (int j = i + 1; j < g.vertex.size(); j++) { + + if (g.hasEdge(i, j)) + roots[j] = false; + + if (g.hasEdge(j, i)) + roots[i] = false; + + } + + std::list work_list; + int cant_fuse_with[g.vertex.size()]; + std::vector > s; + //Each Fused set's representative node + + int node_to_fused_nodes[g.vertex.size()]; + int node_num[g.vertex.size()]; + for (int i = 0; i < g.vertex.size(); i++) { + if (roots[i] == true) + work_list.push_back(i); + cant_fuse_with[i] = 0; + node_to_fused_nodes[i] = 0; + node_num[i] = -1; + } + // topological sort according to chun's permute algorithm + // std::vector > s = g.topoSort(); + std::vector > s2 = g.topoSort(); + if (work_list.empty() || (s2.size() != g.vertex.size())) { + + std::cout << s2.size() << "\t" << g.vertex.size() << std::endl; + throw loop_error("Input for fusion not a DAG!!"); + + + } + int fused_nodes_counter = 0; + while (!work_list.empty()) { + int n = work_list.front(); + //int n_ = g.vertex[n].first; + work_list.pop_front(); + int node; + if (cant_fuse_with[n] == 0) + node = 0; + else + node = cant_fuse_with[n]; + + if ((fused_nodes_counter != 0) && (node != fused_nodes_counter)) { + int rep_node = node_to_fused_nodes[node]; + node_num[n] = node_num[rep_node]; + + try { + update_successors(n, node_num, cant_fuse_with, g, work_list); + } catch (const loop_error &e) { + + throw loop_error( + "statements cannot be fused together due to negative dependence"); + + + } + for (std::set::iterator it = g.vertex[n].first.begin(); + it != g.vertex[n].first.end(); it++) + s[node].insert(*it); + } else { + //std::set new_node; + //new_node.insert(n_); + s.push_back(g.vertex[n].first); + node_to_fused_nodes[node] = n; + node_num[n] = ++node; + try { + update_successors(n, node_num, cant_fuse_with, g, work_list); + } catch (const loop_error &e) { + + throw loop_error( + "statements cannot be fused together due to negative dependence"); + + + } + fused_nodes_counter++; + } + } + + return s; +} + +void Loop::setLexicalOrder(int dim, const std::set &active, + int starting_order, std::vector > idxNames) { + if (active.size() == 0) + return; + + // check for sanity of parameters + if (dim < 0 || dim % 2 != 0) + throw std::invalid_argument( + "invalid constant loop level to set lexicographical order"); + std::vector lex; + int ref_stmt_num; + for (std::set::iterator i = active.begin(); i != active.end(); i++) { + if ((*i) < 0 || (*i) >= stmt.size()) + throw std::invalid_argument( + "invalid statement number " + to_string(*i)); + if (dim >= stmt[*i].xform.n_out()) + throw std::invalid_argument( + "invalid constant loop level to set lexicographical order"); + if (i == active.begin()) { + lex = getLexicalOrder(*i); + ref_stmt_num = *i; + } else { + std::vector lex2 = getLexicalOrder(*i); + for (int j = 0; j < dim; j += 2) + if (lex[j] != lex2[j]) + throw std::invalid_argument( + "statements are not in the same sub loop nest"); + } + } + + // sepearate statements by current loop level types + int level = (dim + 2) / 2; + std::map, std::set > active_by_level_type; + std::set active_by_no_level; + for (std::set::iterator i = active.begin(); i != active.end(); i++) { + if (level > stmt[*i].loop_level.size()) + active_by_no_level.insert(*i); + else + active_by_level_type[std::make_pair( + stmt[*i].loop_level[level - 1].type, + stmt[*i].loop_level[level - 1].payload)].insert(*i); + } + + // further separate statements due to control dependences + std::vector > active_by_level_type_splitted; + for (std::map, std::set >::iterator i = + active_by_level_type.begin(); i != active_by_level_type.end(); i++) + active_by_level_type_splitted.push_back(i->second); + for (std::set::iterator i = active_by_no_level.begin(); + i != active_by_no_level.end(); i++) + for (int j = active_by_level_type_splitted.size() - 1; j >= 0; j--) { + std::set controlled, not_controlled; + for (std::set::iterator k = + active_by_level_type_splitted[j].begin(); + k != active_by_level_type_splitted[j].end(); k++) { + std::vector dvs = dep.getEdge(*i, *k); + bool is_controlled = false; + for (int kk = 0; kk < dvs.size(); kk++) + if (dvs[kk].type = DEP_CONTROL) { + is_controlled = true; + break; + } + if (is_controlled) + controlled.insert(*k); + else + not_controlled.insert(*k); + } + if (controlled.size() != 0 && not_controlled.size() != 0) { + active_by_level_type_splitted.erase( + active_by_level_type_splitted.begin() + j); + active_by_level_type_splitted.push_back(controlled); + active_by_level_type_splitted.push_back(not_controlled); + } + } + + // set lexical order separating loops with different loop types first + if (active_by_level_type_splitted.size() + active_by_no_level.size() > 1) { + int dep_dim = get_last_dep_dim_before(ref_stmt_num, level) + 1; + + Graph, Empty> g; + for (std::vector >::iterator i = + active_by_level_type_splitted.begin(); + i != active_by_level_type_splitted.end(); i++) + g.insert(*i); + for (std::set::iterator i = active_by_no_level.begin(); + i != active_by_no_level.end(); i++) { + std::set t; + t.insert(*i); + g.insert(t); + } + for (int i = 0; i < g.vertex.size(); i++) + for (int j = i + 1; j < g.vertex.size(); j++) { + bool connected = false; + for (std::set::iterator ii = g.vertex[i].first.begin(); + ii != g.vertex[i].first.end(); ii++) { + for (std::set::iterator jj = g.vertex[j].first.begin(); + jj != g.vertex[j].first.end(); jj++) { + std::vector dvs = dep.getEdge(*ii, + *jj); + for (int k = 0; k < dvs.size(); k++) + if (dvs[k].is_control_dependence() + || (dvs[k].is_data_dependence() + && !dvs[k].has_been_carried_before( + dep_dim))) { + g.connect(i, j); + connected = true; + break; + } + if (connected) + break; + } + if (connected) + break; + } + connected = false; + for (std::set::iterator ii = g.vertex[i].first.begin(); + ii != g.vertex[i].first.end(); ii++) { + for (std::set::iterator jj = g.vertex[j].first.begin(); + jj != g.vertex[j].first.end(); jj++) { + std::vector dvs = dep.getEdge(*jj, + *ii); + // find the sub loop nest specified by stmt_num and level, + // only iteration space satisfiable statements returned. + for (int k = 0; k < dvs.size(); k++) + if (dvs[k].is_control_dependence() + || (dvs[k].is_data_dependence() + && !dvs[k].has_been_carried_before( + dep_dim))) { + g.connect(j, i); + connected = true; + break; + } + if (connected) + break; + } + if (connected) + break; + } + } + + std::vector > s = g.topoSort(); + if (s.size() != g.vertex.size()) + throw loop_error( + "cannot separate statements with different loop types at loop level " + + to_string(level)); + + // assign lexical order + int order = starting_order; + for (int i = 0; i < s.size(); i++) { + std::set &cur_scc = g.vertex[*(s[i].begin())].first; + int sz = cur_scc.size(); + if (sz == 1) { + int cur_stmt = *(cur_scc.begin()); + assign_const(stmt[cur_stmt].xform, dim, order); + for (int j = dim + 2; j < stmt[cur_stmt].xform.n_out(); j += 2) + assign_const(stmt[cur_stmt].xform, j, 0); + order++; + } else { + setLexicalOrder(dim, cur_scc, order, idxNames); + order += sz; + } + } + } + // set lexical order seperating single iteration statements and loops + else { + std::set true_singles; + std::set nonsingles; + std::map > fake_singles; + std::set fake_singles_; + + // sort out statements that do not require loops + for (std::set::iterator i = active.begin(); i != active.end(); + i++) { + Relation cur_IS = getNewIS(*i); + if (is_single_iteration(cur_IS, dim + 1)) { + bool is_all_single = true; + for (int j = dim + 3; j < stmt[*i].xform.n_out(); j += 2) + if (!is_single_iteration(cur_IS, j)) { + is_all_single = false; + break; + } + if (is_all_single) + true_singles.insert(*i); + else { + fake_singles_.insert(*i); + try { + fake_singles[get_const(cur_IS, dim + 1, Set_Var)].insert( + *i); + } catch (const std::exception &e) { + fake_singles[posInfinity].insert(*i); + } + } + } else + nonsingles.insert(*i); + } + + + // split nonsingles forcibly according to negative dependences present (loop unfusible) + int dep_dim = get_dep_dim_of(ref_stmt_num, level); + + if (dim < stmt[ref_stmt_num].xform.n_out() - 1) { + + bool dummy_level_found = false; + + std::vector > s; + + s = sort_by_same_loops(active, level); + bool further_levels_exist = false; + + if (!idxNames.empty()) + if (level <= idxNames[ref_stmt_num].size()) + if (idxNames[ref_stmt_num][level - 1].length() == 0) { + // && s.size() == 1) { + int order1 = 0; + dummy_level_found = true; + + for (int i = level; i < idxNames[ref_stmt_num].size(); + i++) + if (idxNames[ref_stmt_num][i].length() > 0) + further_levels_exist = true; + + } + + //if (!dummy_level_found) { + + if (s.size() > 1) { + + Graph, bool> g = construct_induced_graph_at_level( + s, dep, dep_dim); + s = typed_fusion(g); + } + int order = 0; + for (int i = 0; i < s.size(); i++) { + + for (std::set::iterator it = s[i].begin(); + it != s[i].end(); it++) + assign_const(stmt[*it].xform, dim, order); + + if ((dim + 2) <= (stmt[ref_stmt_num].xform.n_out() - 1)) + setLexicalOrder(dim + 2, s[i], order, idxNames); + + order++; + } + //} + /* else { + + int order1 = 0; + int order = 0; + for (std::set::iterator i = active.begin(); + i != active.end(); i++) { + if (!further_levels_exist) + assign_const(stmt[*i].xform, dim, order1++); + else + assign_const(stmt[*i].xform, dim, order1); + + } + + if ((dim + 2) <= (stmt[ref_stmt_num].xform.n_out() - 1) && further_levels_exist) + setLexicalOrder(dim + 2, active, order, idxNames); + } + */ + } else { + int dummy_order = 0; + for (std::set::iterator i = active.begin(); i != active.end(); + i++) + assign_const(stmt[*i].xform, dim, dummy_order++); + } + /*for (int i = 0; i < g2.vertex.size(); i++) + for (int j = i+1; j < g2.vertex.size(); j++) { + std::vector dvs = dep.getEdge(g2.vertex[i].first, g2.vertex[j].first); + for (int k = 0; k < dvs.size(); k++) + if (dvs[k].is_control_dependence() || + (dvs[k].is_data_dependence() && dvs[k].has_negative_been_carried_at(dep_dim))) { + g2.connect(i, j); + break; + } + dvs = dep.getEdge(g2.vertex[j].first, g2.vertex[i].first); + for (int k = 0; k < dvs.size(); k++) + if (dvs[k].is_control_dependence() || + (dvs[k].is_data_dependence() && dvs[k].has_negative_been_carried_at(dep_dim))) { + g2.connect(j, i); + break; + } + } + + std::vector > s2 = g2.packed_topoSort(); + + std::vector > splitted_nonsingles; + for (int i = 0; i < s2.size(); i++) { + std::set cur_scc; + for (std::set::iterator j = s2[i].begin(); j != s2[i].end(); j++) + cur_scc.insert(g2.vertex[*j].first); + splitted_nonsingles.push_back(cur_scc); + } + */ + //convert to dependence graph for grouped statements + //dep_dim = get_last_dep_dim_before(ref_stmt_num, level) + 1; + /*int order = 0; + for (std::set::iterator j = active.begin(); j != active.end(); + j++) { + std::set continuous; + std::cout<< active.size()< 0) { + std::vector > s = typed_fusion(continuous, dep, + dep_dim); + + for (int i = 0; i < s.size(); i++) { + for (std::set::iterator l = s[i].begin(); + l != s[i].end(); l++) { + assign_const(stmt[*l].xform, dim + 2, order); + setLexicalOrder(dim + 2, s[i]); + } + order++; + } + } + + if (j != active.end()) { + assign_const(stmt[*j].xform, dim + 2, order); + + for (int k = dim + 4; k < stmt[*j].xform.n_out(); k += 2) + assign_const(stmt[*j].xform, k, 0); + order++; + } + + if( j == active.end()) + break; + } + */ + + + // assign lexical order + /*int order = starting_order; + for (int i = 0; i < s.size(); i++) { + // translate each SCC into original statements + std::set cur_scc; + for (std::set::iterator j = s[i].begin(); j != s[i].end(); j++) + copy(s[i].begin(), s[i].end(), + inserter(cur_scc, cur_scc.begin())); + + // now assign the constant + for (std::set::iterator j = cur_scc.begin(); + j != cur_scc.end(); j++) + assign_const(stmt[*j].xform, dim, order); + + if (cur_scc.size() > 1) + setLexicalOrder(dim + 2, cur_scc); + else if (cur_scc.size() == 1) { + int cur_stmt = *(cur_scc.begin()); + for (int j = dim + 2; j < stmt[cur_stmt].xform.n_out(); j += 2) + assign_const(stmt[cur_stmt].xform, j, 0); + } + + if (cur_scc.size() > 0) + order++; + } + */ + } +} + +void Loop::apply_xform() { + std::set active; + for (int i = 0; i < stmt.size(); i++) + active.insert(i); + apply_xform(active); +} + +void Loop::apply_xform(int stmt_num) { + std::set active; + active.insert(stmt_num); + apply_xform(active); +} + +void Loop::apply_xform(std::set &active) { + int max_n = 0; + + CG_outputBuilder *ocg = ir->builder(); + for (std::set::iterator i = active.begin(); i != active.end(); i++) { + int n = stmt[*i].loop_level.size(); + if (n > max_n) + max_n = n; + + std::vector lex = getLexicalOrder(*i); + + Relation mapping(2 * n + 1, n); + F_And *f_root = mapping.add_and(); + for (int j = 1; j <= n; j++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.output_var(j), 1); + h.update_coef(mapping.input_var(2 * j), -1); + } + mapping = Composition(mapping, stmt[*i].xform); + mapping.simplify(); + + // match omega input/output variables to variable names in the code + for (int j = 1; j <= stmt[*i].IS.n_set(); j++) + mapping.name_input_var(j, stmt[*i].IS.set_var(j)->name()); + for (int j = 1; j <= n; j++) + mapping.name_output_var(j, + tmp_loop_var_name_prefix + + to_string(tmp_loop_var_name_counter + j - 1)); + mapping.setup_names(); + + Relation known = Extend_Set(copy(this->known), + mapping.n_out() - this->known.n_set()); + //stmt[*i].code = outputStatement(ocg, stmt[*i].code, 0, mapping, known, std::vector(mapping.n_out(), NULL)); + std::vector loop_vars; + for (int j = 1; j <= stmt[*i].IS.n_set(); j++) + loop_vars.push_back(stmt[*i].IS.set_var(j)->name()); + std::vector subs = output_substitutions(ocg, + Inverse(copy(mapping)), + std::vector >(mapping.n_out(), + std::make_pair(static_cast(NULL), 0))); + stmt[*i].code = ocg->CreateSubstitutedStmt(0, stmt[*i].code, loop_vars, + subs); + stmt[*i].IS = Range(Restrict_Domain(mapping, stmt[*i].IS)); + stmt[*i].IS.simplify(); + + // replace original transformation relation with straight 1-1 mapping + mapping = Relation(n, 2 * n + 1); + f_root = mapping.add_and(); + for (int j = 1; j <= n; j++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.output_var(2 * j), 1); + h.update_coef(mapping.input_var(j), -1); + } + for (int j = 1; j <= 2 * n + 1; j += 2) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.output_var(j), 1); + h.update_const(-lex[j - 1]); + } + stmt[*i].xform = mapping; + } + + tmp_loop_var_name_counter += max_n; +} + +void Loop::addKnown(const Relation &cond) { + + // invalidate saved codegen computation + delete last_compute_cgr_; + last_compute_cgr_ = NULL; + delete last_compute_cg_; + last_compute_cg_ = NULL; + + int n1 = this->known.n_set(); + + Relation r = copy(cond); + int n2 = r.n_set(); + + if (n1 < n2) + this->known = Extend_Set(this->known, n2 - n1); + else if (n1 > n2) + r = Extend_Set(r, n1 - n2); + + this->known = Intersection(this->known, r); +} + +void Loop::removeDependence(int stmt_num_from, int stmt_num_to) { + // check for sanity of parameters + if (stmt_num_from >= stmt.size()) + throw std::invalid_argument( + "invalid statement number " + to_string(stmt_num_from)); + if (stmt_num_to >= stmt.size()) + throw std::invalid_argument( + "invalid statement number " + to_string(stmt_num_to)); + + dep.disconnect(stmt_num_from, stmt_num_to); +} + +void Loop::dump() const { + for (int i = 0; i < stmt.size(); i++) { + std::vector lex = getLexicalOrder(i); + std::cout << "s" << i + 1 << ": "; + for (int j = 0; j < stmt[i].loop_level.size(); j++) { + if (2 * j < lex.size()) + std::cout << lex[2 * j]; + switch (stmt[i].loop_level[j].type) { + case LoopLevelOriginal: + std::cout << "(dim:" << stmt[i].loop_level[j].payload << ")"; + break; + case LoopLevelTile: + std::cout << "(tile:" << stmt[i].loop_level[j].payload << ")"; + break; + default: + std::cout << "(unknown)"; + } + std::cout << ' '; + } + for (int j = 2 * stmt[i].loop_level.size(); j < lex.size(); j += 2) { + std::cout << lex[j]; + if (j != lex.size() - 1) + std::cout << ' '; + } + std::cout << std::endl; + } +} + +bool Loop::nonsingular(const std::vector > &T) { + if (stmt.size() == 0) + return true; + + // check for sanity of parameters + for (int i = 0; i < stmt.size(); i++) { + if (stmt[i].loop_level.size() != num_dep_dim) + throw std::invalid_argument( + "nonsingular loop transformations must be applied to original perfect loop nest"); + for (int j = 0; j < stmt[i].loop_level.size(); j++) + if (stmt[i].loop_level[j].type != LoopLevelOriginal) + throw std::invalid_argument( + "nonsingular loop transformations must be applied to original perfect loop nest"); + } + if (T.size() != num_dep_dim) + throw std::invalid_argument("invalid transformation matrix"); + for (int i = 0; i < stmt.size(); i++) + if (T[i].size() != num_dep_dim + 1 && T[i].size() != num_dep_dim) + throw std::invalid_argument("invalid transformation matrix"); + // invalidate saved codegen computation + delete last_compute_cgr_; + last_compute_cgr_ = NULL; + delete last_compute_cg_; + last_compute_cg_ = NULL; + // build relation from matrix + Relation mapping(2 * num_dep_dim + 1, 2 * num_dep_dim + 1); + F_And *f_root = mapping.add_and(); + for (int i = 0; i < num_dep_dim; i++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.output_var(2 * (i + 1)), -1); + for (int j = 0; j < num_dep_dim; j++) + if (T[i][j] != 0) + h.update_coef(mapping.input_var(2 * (j + 1)), T[i][j]); + if (T[i].size() == num_dep_dim + 1) + h.update_const(T[i][num_dep_dim]); + } + for (int i = 1; i <= 2 * num_dep_dim + 1; i += 2) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.output_var(i), -1); + h.update_coef(mapping.input_var(i), 1); + } + + // update transformation relations + for (int i = 0; i < stmt.size(); i++) + stmt[i].xform = Composition(copy(mapping), stmt[i].xform); + + // update dependence graph + for (int i = 0; i < dep.vertex.size(); i++) + for (DependenceGraph::EdgeList::iterator j = + dep.vertex[i].second.begin(); j != dep.vertex[i].second.end(); + j++) { + std::vector dvs = j->second; + for (int k = 0; k < dvs.size(); k++) { + DependenceVector &dv = dvs[k]; + switch (dv.type) { + case DEP_W2R: + case DEP_R2W: + case DEP_W2W: + case DEP_R2R: { + std::vector lbounds(num_dep_dim), ubounds( + num_dep_dim); + for (int p = 0; p < num_dep_dim; p++) { + coef_t lb = 0; + coef_t ub = 0; + for (int q = 0; q < num_dep_dim; q++) { + if (T[p][q] > 0) { + if (lb == -posInfinity + || dv.lbounds[q] == -posInfinity) + lb = -posInfinity; + else + lb += T[p][q] * dv.lbounds[q]; + if (ub == posInfinity + || dv.ubounds[q] == posInfinity) + ub = posInfinity; + else + ub += T[p][q] * dv.ubounds[q]; + } else if (T[p][q] < 0) { + if (lb == -posInfinity + || dv.ubounds[q] == posInfinity) + lb = -posInfinity; + else + lb += T[p][q] * dv.ubounds[q]; + if (ub == posInfinity + || dv.lbounds[q] == -posInfinity) + ub = posInfinity; + else + ub += T[p][q] * dv.lbounds[q]; + } + } + if (T[p].size() == num_dep_dim + 1) { + if (lb != -posInfinity) + lb += T[p][num_dep_dim]; + if (ub != posInfinity) + ub += T[p][num_dep_dim]; + } + lbounds[p] = lb; + ubounds[p] = ub; + } + dv.lbounds = lbounds; + dv.ubounds = ubounds; + + break; + } + default: + ; + } + } + j->second = dvs; + } + + // set constant loop values + std::set active; + for (int i = 0; i < stmt.size(); i++) + active.insert(i); + setLexicalOrder(0, active); + + return true; +} + + +bool Loop::is_dependence_valid_based_on_lex_order(int i, int j, + const DependenceVector &dv, bool before) { + std::vector lex_i = getLexicalOrder(i); + std::vector lex_j = getLexicalOrder(j); + int last_dim; + if (!dv.is_scalar_dependence) { + for (last_dim = 0; + last_dim < lex_i.size() && (lex_i[last_dim] == lex_j[last_dim]); + last_dim++) + ; + last_dim = last_dim / 2; + if (last_dim == 0) + return true; + + for (int i = 0; i < last_dim; i++) { + if (dv.lbounds[i] > 0) + return true; + else if (dv.lbounds[i] < 0) + return false; + } + } + if (before) + return true; + + return false; + +} + diff --git a/chill/src/loop_basic.cc b/chill/src/loop_basic.cc new file mode 100644 index 0000000..f5234b9 --- /dev/null +++ b/chill/src/loop_basic.cc @@ -0,0 +1,1538 @@ +/* + * loop_basic.cc + * + * Created on: Nov 12, 2012 + * Author: anand + */ + +#include "loop.hh" +#include "chill_error.hh" +#include +#include "omegatools.hh" +#include + +using namespace omega; + +void Loop::permute(const std::vector &pi) { + std::set active; + for (int i = 0; i < stmt.size(); i++) + active.insert(i); + + permute(active, pi); +} + +void Loop::original() { + std::set active; + for (int i = 0; i < stmt.size(); i++) + active.insert(i); + setLexicalOrder(0, active); +} +void Loop::permute(int stmt_num, int level, const std::vector &pi) { + // check for sanity of parameters + int starting_order; + if (stmt_num < 0 || stmt_num >= stmt.size()) + throw std::invalid_argument( + "invalid statement number " + to_string(stmt_num)); + std::set active; + if (level < 0 || level > stmt[stmt_num].loop_level.size()) + throw std::invalid_argument("invalid loop level " + to_string(level)); + else if (level == 0) { + for (int i = 0; i < stmt.size(); i++) + active.insert(i); + level = 1; + starting_order = 0; + } else { + std::vector lex = getLexicalOrder(stmt_num); + active = getStatements(lex, 2 * level - 2); + starting_order = lex[2 * level - 2]; + lex[2 * level - 2]++; + shiftLexicalOrder(lex, 2 * level - 2, active.size() - 1); + } + std::vector pi_inverse(pi.size(), 0); + for (int i = 0; i < pi.size(); i++) { + if (pi[i] >= level + pi.size() || pi[i] < level + || pi_inverse[pi[i] - level] != 0) + throw std::invalid_argument("invalid permuation"); + pi_inverse[pi[i] - level] = level + i; + } + for (std::set::iterator i = active.begin(); i != active.end(); i++) + if (level + pi.size() - 1 > stmt[*i].loop_level.size()) + throw std::invalid_argument( + "invalid permutation for statement " + to_string(*i)); + + // invalidate saved codegen computation + delete last_compute_cgr_; + last_compute_cgr_ = NULL; + delete last_compute_cg_; + last_compute_cg_ = NULL; + + // Update transformation relations + for (std::set::iterator i = active.begin(); i != active.end(); i++) { + int n = stmt[*i].xform.n_out(); + Relation mapping(n, n); + F_And *f_root = mapping.add_and(); + for (int j = 1; j <= 2 * level - 2; j++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.output_var(j), 1); + h.update_coef(mapping.input_var(j), -1); + } + for (int j = level; j <= level + pi.size() - 1; j++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.output_var(2 * j), 1); + h.update_coef(mapping.input_var(2 * pi[j - level]), -1); + } + for (int j = level; j <= level + pi.size() - 1; j++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.output_var(2 * j - 1), 1); + h.update_coef(mapping.input_var(2 * j - 1), -1); + } + for (int j = 2 * (level + pi.size() - 1) + 1; j <= n; j++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.output_var(j), 1); + h.update_coef(mapping.input_var(j), -1); + } + stmt[*i].xform = Composition(mapping, stmt[*i].xform); + stmt[*i].xform.simplify(); + } + + // get the permuation for dependence vectors + std::vector t; + for (int i = 0; i < pi.size(); i++) + if (stmt[stmt_num].loop_level[pi[i] - 1].type == LoopLevelOriginal) + t.push_back(stmt[stmt_num].loop_level[pi[i] - 1].payload); + int max_dep_dim = -1; + int min_dep_dim = dep.num_dim(); + for (int i = 0; i < t.size(); i++) { + if (t[i] > max_dep_dim) + max_dep_dim = t[i]; + if (t[i] < min_dep_dim) + min_dep_dim = t[i]; + } + if (min_dep_dim > max_dep_dim) + return; + if (max_dep_dim - min_dep_dim + 1 != t.size()) + throw loop_error("cannot update the dependence graph after permuation"); + std::vector dep_pi(dep.num_dim()); + for (int i = 0; i < min_dep_dim; i++) + dep_pi[i] = i; + for (int i = min_dep_dim; i <= max_dep_dim; i++) + dep_pi[i] = t[i - min_dep_dim]; + for (int i = max_dep_dim + 1; i < dep.num_dim(); i++) + dep_pi[i] = i; + + dep.permute(dep_pi, active); + + // update the dependence graph + DependenceGraph g(dep.num_dim()); + for (int i = 0; i < dep.vertex.size(); i++) + g.insert(); + for (int i = 0; i < dep.vertex.size(); i++) + for (DependenceGraph::EdgeList::iterator j = + dep.vertex[i].second.begin(); j != dep.vertex[i].second.end(); + j++) { + if ((active.find(i) != active.end() + && active.find(j->first) != active.end())) { + std::vector dv = j->second; + for (int k = 0; k < dv.size(); k++) { + switch (dv[k].type) { + case DEP_W2R: + case DEP_R2W: + case DEP_W2W: + case DEP_R2R: { + std::vector lbounds(dep.num_dim()); + std::vector ubounds(dep.num_dim()); + for (int d = 0; d < dep.num_dim(); d++) { + lbounds[d] = dv[k].lbounds[dep_pi[d]]; + ubounds[d] = dv[k].ubounds[dep_pi[d]]; + } + dv[k].lbounds = lbounds; + dv[k].ubounds = ubounds; + break; + } + case DEP_CONTROL: { + break; + } + default: + throw loop_error("unknown dependence type"); + } + } + g.connect(i, j->first, dv); + } else if (active.find(i) == active.end() + && active.find(j->first) == active.end()) { + std::vector dv = j->second; + g.connect(i, j->first, dv); + } else { + std::vector dv = j->second; + for (int k = 0; k < dv.size(); k++) + switch (dv[k].type) { + case DEP_W2R: + case DEP_R2W: + case DEP_W2W: + case DEP_R2R: { + for (int d = 0; d < dep.num_dim(); d++) + if (dep_pi[d] != d) { + dv[k].lbounds[d] = -posInfinity; + dv[k].ubounds[d] = posInfinity; + } + break; + } + case DEP_CONTROL: + break; + default: + throw loop_error("unknown dependence type"); + } + g.connect(i, j->first, dv); + } + } + dep = g; + + // update loop level information + for (std::set::iterator i = active.begin(); i != active.end(); i++) { + int cur_dep_dim = min_dep_dim; + std::vector new_loop_level(stmt[*i].loop_level.size()); + for (int j = 1; j <= stmt[*i].loop_level.size(); j++) + if (j >= level && j < level + pi.size()) { + switch (stmt[*i].loop_level[pi_inverse[j - level] - 1].type) { + case LoopLevelOriginal: + new_loop_level[j - 1].type = LoopLevelOriginal; + new_loop_level[j - 1].payload = cur_dep_dim++; + new_loop_level[j - 1].parallel_level = + stmt[*i].loop_level[pi_inverse[j - level] - 1].parallel_level; + break; + case LoopLevelTile: { + new_loop_level[j - 1].type = LoopLevelTile; + int ref_level = stmt[*i].loop_level[pi_inverse[j - level] + - 1].payload; + if (ref_level >= level && ref_level < level + pi.size()) + new_loop_level[j - 1].payload = pi_inverse[ref_level + - level]; + else + new_loop_level[j - 1].payload = ref_level; + new_loop_level[j - 1].parallel_level = stmt[*i].loop_level[j + - 1].parallel_level; + break; + } + default: + throw loop_error( + "unknown loop level information for statement " + + to_string(*i)); + } + } else { + switch (stmt[*i].loop_level[j - 1].type) { + case LoopLevelOriginal: + new_loop_level[j - 1].type = LoopLevelOriginal; + new_loop_level[j - 1].payload = + stmt[*i].loop_level[j - 1].payload; + new_loop_level[j - 1].parallel_level = stmt[*i].loop_level[j + - 1].parallel_level; + break; + case LoopLevelTile: { + new_loop_level[j - 1].type = LoopLevelTile; + int ref_level = stmt[*i].loop_level[j - 1].payload; + if (ref_level >= level && ref_level < level + pi.size()) + new_loop_level[j - 1].payload = pi_inverse[ref_level + - level]; + else + new_loop_level[j - 1].payload = ref_level; + new_loop_level[j - 1].parallel_level = stmt[*i].loop_level[j + - 1].parallel_level; + break; + } + default: + throw loop_error( + "unknown loop level information for statement " + + to_string(*i)); + } + } + stmt[*i].loop_level = new_loop_level; + } + + setLexicalOrder(2 * level - 2, active, starting_order); +} +void Loop::permute(const std::set &active, const std::vector &pi) { + if (active.size() == 0 || pi.size() == 0) + return; + + // check for sanity of parameters + int level = pi[0]; + for (int i = 1; i < pi.size(); i++) + if (pi[i] < level) + level = pi[i]; + if (level < 1) + throw std::invalid_argument("invalid permuation"); + std::vector reverse_pi(pi.size(), 0); + for (int i = 0; i < pi.size(); i++) + if (pi[i] >= level + pi.size()) + throw std::invalid_argument("invalid permutation"); + else + reverse_pi[pi[i] - level] = i + level; + for (int i = 0; i < reverse_pi.size(); i++) + if (reverse_pi[i] == 0) + throw std::invalid_argument("invalid permuation"); + int ref_stmt_num; + std::vector lex; + for (std::set::iterator i = active.begin(); i != active.end(); i++) { + if (*i < 0 || *i >= stmt.size()) + throw std::invalid_argument("invalid statement " + to_string(*i)); + if (i == active.begin()) { + ref_stmt_num = *i; + lex = getLexicalOrder(*i); + } else { + if (level + pi.size() - 1 > stmt[*i].loop_level.size()) + throw std::invalid_argument("invalid permuation"); + std::vector lex2 = getLexicalOrder(*i); + for (int j = 0; j < 2 * level - 3; j += 2) + if (lex[j] != lex2[j]) + throw std::invalid_argument( + "statements to permute must be in the same subloop"); + for (int j = 0; j < pi.size(); j++) + if (!(stmt[*i].loop_level[level + j - 1].type + == stmt[ref_stmt_num].loop_level[level + j - 1].type + && stmt[*i].loop_level[level + j - 1].payload + == stmt[ref_stmt_num].loop_level[level + j - 1].payload)) + throw std::invalid_argument( + "permuted loops must have the same loop level types"); + } + } + // invalidate saved codegen computation + delete last_compute_cgr_; + last_compute_cgr_ = NULL; + delete last_compute_cg_; + last_compute_cg_ = NULL; + + // Update transformation relations + for (std::set::iterator i = active.begin(); i != active.end(); i++) { + int n = stmt[*i].xform.n_out(); + Relation mapping(n, n); + F_And *f_root = mapping.add_and(); + for (int j = 1; j <= n; j += 2) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.output_var(j), 1); + h.update_coef(mapping.input_var(j), -1); + } + for (int j = 0; j < pi.size(); j++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.output_var(2 * (level + j)), 1); + h.update_coef(mapping.input_var(2 * pi[j]), -1); + } + for (int j = 1; j < level; j++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.output_var(2 * j), 1); + h.update_coef(mapping.input_var(2 * j), -1); + } + for (int j = level + pi.size(); j <= stmt[*i].loop_level.size(); j++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.output_var(2 * j), 1); + h.update_coef(mapping.input_var(2 * j), -1); + } + + stmt[*i].xform = Composition(mapping, stmt[*i].xform); + stmt[*i].xform.simplify(); + } + + // get the permuation for dependence vectors + std::vector t; + for (int i = 0; i < pi.size(); i++) + if (stmt[ref_stmt_num].loop_level[pi[i] - 1].type == LoopLevelOriginal) + t.push_back(stmt[ref_stmt_num].loop_level[pi[i] - 1].payload); + int max_dep_dim = -1; + int min_dep_dim = num_dep_dim; + for (int i = 0; i < t.size(); i++) { + if (t[i] > max_dep_dim) + max_dep_dim = t[i]; + if (t[i] < min_dep_dim) + min_dep_dim = t[i]; + } + if (min_dep_dim > max_dep_dim) + return; + if (max_dep_dim - min_dep_dim + 1 != t.size()) + throw loop_error("cannot update the dependence graph after permuation"); + std::vector dep_pi(num_dep_dim); + for (int i = 0; i < min_dep_dim; i++) + dep_pi[i] = i; + for (int i = min_dep_dim; i <= max_dep_dim; i++) + dep_pi[i] = t[i - min_dep_dim]; + for (int i = max_dep_dim + 1; i < num_dep_dim; i++) + dep_pi[i] = i; + + dep.permute(dep_pi, active); + + // update the dependence graph + DependenceGraph g(dep.num_dim()); + for (int i = 0; i < dep.vertex.size(); i++) + g.insert(); + for (int i = 0; i < dep.vertex.size(); i++) + for (DependenceGraph::EdgeList::iterator j = + dep.vertex[i].second.begin(); j != dep.vertex[i].second.end(); + j++) { // + if ((active.find(i) != active.end() + && active.find(j->first) != active.end())) { + std::vector dv = j->second; + for (int k = 0; k < dv.size(); k++) { + switch (dv[k].type) { + case DEP_W2R: + case DEP_R2W: + case DEP_W2W: + case DEP_R2R: { + std::vector lbounds(num_dep_dim); + std::vector ubounds(num_dep_dim); + for (int d = 0; d < num_dep_dim; d++) { + lbounds[d] = dv[k].lbounds[dep_pi[d]]; + ubounds[d] = dv[k].ubounds[dep_pi[d]]; + } + dv[k].lbounds = lbounds; + dv[k].ubounds = ubounds; + break; + } + case DEP_CONTROL: { + break; + } + default: + throw loop_error("unknown dependence type"); + } + } + g.connect(i, j->first, dv); + } else if (active.find(i) == active.end() + && active.find(j->first) == active.end()) { + std::vector dv = j->second; + g.connect(i, j->first, dv); + } else { + std::vector dv = j->second; + for (int k = 0; k < dv.size(); k++) + switch (dv[k].type) { + case DEP_W2R: + case DEP_R2W: + case DEP_W2W: + case DEP_R2R: { + for (int d = 0; d < num_dep_dim; d++) + if (dep_pi[d] != d) { + dv[k].lbounds[d] = -posInfinity; + dv[k].ubounds[d] = posInfinity; + } + break; + } + case DEP_CONTROL: + break; + default: + throw loop_error("unknown dependence type"); + } + g.connect(i, j->first, dv); + } + } + dep = g; + + // update loop level information + for (std::set::iterator i = active.begin(); i != active.end(); i++) { + int cur_dep_dim = min_dep_dim; + std::vector new_loop_level(stmt[*i].loop_level.size()); + for (int j = 1; j <= stmt[*i].loop_level.size(); j++) + if (j >= level && j < level + pi.size()) { + switch (stmt[*i].loop_level[reverse_pi[j - level] - 1].type) { + case LoopLevelOriginal: + new_loop_level[j - 1].type = LoopLevelOriginal; + new_loop_level[j - 1].payload = cur_dep_dim++; + new_loop_level[j - 1].parallel_level = + stmt[*i].loop_level[reverse_pi[j - level] - 1].parallel_level; + break; + case LoopLevelTile: { + new_loop_level[j - 1].type = LoopLevelTile; + int ref_level = stmt[*i].loop_level[reverse_pi[j - level] + - 1].payload; + if (ref_level >= level && ref_level < level + pi.size()) + new_loop_level[j - 1].payload = reverse_pi[ref_level + - level]; + else + new_loop_level[j - 1].payload = ref_level; + new_loop_level[j - 1].parallel_level = + stmt[*i].loop_level[reverse_pi[j - level] - 1].parallel_level; + break; + } + default: + throw loop_error( + "unknown loop level information for statement " + + to_string(*i)); + } + } else { + switch (stmt[*i].loop_level[j - 1].type) { + case LoopLevelOriginal: + new_loop_level[j - 1].type = LoopLevelOriginal; + new_loop_level[j - 1].payload = + stmt[*i].loop_level[j - 1].payload; + new_loop_level[j - 1].parallel_level = stmt[*i].loop_level[j + - 1].parallel_level; + break; + case LoopLevelTile: { + new_loop_level[j - 1].type = LoopLevelTile; + int ref_level = stmt[*i].loop_level[j - 1].payload; + if (ref_level >= level && ref_level < level + pi.size()) + new_loop_level[j - 1].payload = reverse_pi[ref_level + - level]; + else + new_loop_level[j - 1].payload = ref_level; + new_loop_level[j - 1].parallel_level = stmt[*i].loop_level[j + - 1].parallel_level; + break; + } + default: + throw loop_error( + "unknown loop level information for statement " + + to_string(*i)); + } + } + stmt[*i].loop_level = new_loop_level; + } + + setLexicalOrder(2 * level - 2, active); +} + +std::set Loop::split(int stmt_num, int level, const Relation &cond) { + // check for sanity of parameters + if (stmt_num < 0 || stmt_num >= stmt.size()) + throw std::invalid_argument("invalid statement " + to_string(stmt_num)); + if (level <= 0 || level > stmt[stmt_num].loop_level.size()) + throw std::invalid_argument("invalid loop level " + to_string(level)); + + std::set result; + int dim = 2 * level - 1; + std::vector lex = getLexicalOrder(stmt_num); + std::set same_loop = getStatements(lex, dim - 1); + + Relation cond2 = copy(cond); + cond2.simplify(); + cond2 = EQs_to_GEQs(cond2); + Conjunct *c = cond2.single_conjunct(); + int cur_lex = lex[dim - 1]; + + for (GEQ_Iterator gi(c->GEQs()); gi; gi++) { + int max_level = (*gi).max_tuple_pos(); + Relation single_cond(max_level); + single_cond.and_with_GEQ(*gi); + + // TODO: should decide where to place newly created statements with + // complementary split condition from dependence graph. + bool place_after; + if (max_level == 0) + place_after = true; + else if ((*gi).get_coef(cond2.set_var(max_level)) < 0) + place_after = true; + else + place_after = false; + + bool temp_place_after; // = place_after; + bool assigned = false; + int part1_to_part2; + int part2_to_part1; + // original statements with split condition, + // new statements with complement of split condition + int old_num_stmt = stmt.size(); + std::map what_stmt_num; + apply_xform(same_loop); + for (std::set::iterator i = same_loop.begin(); + i != same_loop.end(); i++) { + int n = stmt[*i].IS.n_set(); + Relation part1, part2; + if (max_level > n) { + part1 = copy(stmt[*i].IS); + part2 = Relation::False(0); + } else { + part1 = Intersection(copy(stmt[*i].IS), + Extend_Set(copy(single_cond), n - max_level)); + part2 = Intersection(copy(stmt[*i].IS), + Extend_Set(Complement(copy(single_cond)), + n - max_level)); + } + + //split dependence check + + if (max_level > level) { + + DNF_Iterator di1(stmt[*i].IS.query_DNF()); + DNF_Iterator di2(part1.query_DNF()); + for (; di1 && di2; di1++, di2++) { + //printf("In next conjunct,\n"); + EQ_Iterator ei1 = (*di1)->EQs(); + EQ_Iterator ei2 = (*di2)->EQs(); + for (; ei1 && ei2; ei1++, ei2++) { + //printf(" In next equality constraint,\n"); + Constr_Vars_Iter cvi1(*ei1); + Constr_Vars_Iter cvi2(*ei2); + int dimension = (*cvi1).var->get_position(); + int same = 0; + bool identical = false; + if (identical = !strcmp((*cvi1).var->char_name(), + (*cvi2).var->char_name())) { + + for (; cvi1 && cvi2; cvi1++, cvi2++) { + + if (((*cvi1).coef != (*cvi2).coef + || (*ei1).get_const() + != (*ei2).get_const()) + || (strcmp((*cvi1).var->char_name(), + (*cvi2).var->char_name()))) { + + same++; + } + } + } + if ((same != 0) || !identical) { + + dimension = dimension - 1; + + while (stmt[*i].loop_level[dimension].type + == LoopLevelTile) + dimension = + stmt[*i].loop_level[dimension].payload; + + dimension = stmt[*i].loop_level[dimension].payload; + + for (int i = 0; i < stmt.size(); i++) { + std::vector > D; + for (DependenceGraph::EdgeList::iterator j = + dep.vertex[i].second.begin(); + j != dep.vertex[i].second.end(); j++) { + for (int k = 0; k < j->second.size(); k++) { + DependenceVector dv = j->second[k]; + if (dv.type != DEP_CONTROL) + if (dv.hasNegative(dimension) + && !dv.quasi) + throw loop_error( + "loop error: Split is illegal, dependence violation!"); + + } + } + } + + } + + GEQ_Iterator gi1 = (*di1)->GEQs(); + GEQ_Iterator gi2 = (*di2)->GEQs(); + + for (; gi1 && gi2; gi++, gi2++) { + + Constr_Vars_Iter cvi1(*gi1); + Constr_Vars_Iter cvi2(*gi2); + int dimension = (*cvi1).var->get_position(); + int same = 0; + bool identical = false; + if (identical = !strcmp((*cvi1).var->char_name(), + (*cvi2).var->char_name())) { + + for (; cvi1 && cvi2; cvi1++, cvi2++) { + + if (((*cvi1).coef != (*cvi2).coef + || (*gi1).get_const() + != (*gi2).get_const()) + || (strcmp((*cvi1).var->char_name(), + (*cvi2).var->char_name()))) { + + same++; + } + } + } + if ((same != 0) || !identical) { + dimension = dimension - 1; + + while (stmt[*i].loop_level[dimension].type + == LoopLevelTile) + stmt[*i].loop_level[dimension].payload; + + dimension = + stmt[*i].loop_level[dimension].payload; + + for (int i = 0; i < stmt.size(); i++) { + std::vector > D; + for (DependenceGraph::EdgeList::iterator j = + dep.vertex[i].second.begin(); + j != dep.vertex[i].second.end(); + j++) { + for (int k = 0; k < j->second.size(); + k++) { + DependenceVector dv = j->second[k]; + if (dv.type != DEP_CONTROL) + if (dv.hasNegative(dimension) + && !dv.quasi) + + throw loop_error( + "loop error: Split is illegal, dependence violation!"); + + } + } + } + + } + + } + + } + + } + + DNF_Iterator di3(stmt[*i].IS.query_DNF()); + DNF_Iterator di4(part2.query_DNF()); // + for (; di3 && di4; di3++, di4++) { + EQ_Iterator ei1 = (*di3)->EQs(); + EQ_Iterator ei2 = (*di4)->EQs(); + for (; ei1 && ei2; ei1++, ei2++) { + Constr_Vars_Iter cvi1(*ei1); + Constr_Vars_Iter cvi2(*ei2); + int dimension = (*cvi1).var->get_position(); + int same = 0; + bool identical = false; + if (identical = !strcmp((*cvi1).var->char_name(), + (*cvi2).var->char_name())) { + + for (; cvi1 && cvi2; cvi1++, cvi2++) { + + if (((*cvi1).coef != (*cvi2).coef + || (*ei1).get_const() + != (*ei2).get_const()) + || (strcmp((*cvi1).var->char_name(), + (*cvi2).var->char_name()))) { + + same++; + } + } + } + if ((same != 0) || !identical) { + dimension = dimension - 1; + + while (stmt[*i].loop_level[dimension].type + == LoopLevelTile) + stmt[*i].loop_level[dimension].payload; + + dimension = stmt[*i].loop_level[dimension].payload; + + for (int i = 0; i < stmt.size(); i++) { + std::vector > D; + for (DependenceGraph::EdgeList::iterator j = + dep.vertex[i].second.begin(); + j != dep.vertex[i].second.end(); j++) { + for (int k = 0; k < j->second.size(); k++) { + DependenceVector dv = j->second[k]; + if (dv.type != DEP_CONTROL) + if (dv.hasNegative(dimension) + && !dv.quasi) + + throw loop_error( + "loop error: Split is illegal, dependence violation!"); + + } + } + } + + } + + } + GEQ_Iterator gi1 = (*di3)->GEQs(); + GEQ_Iterator gi2 = (*di4)->GEQs(); + + for (; gi1 && gi2; gi++, gi2++) { + Constr_Vars_Iter cvi1(*gi1); + Constr_Vars_Iter cvi2(*gi2); + int dimension = (*cvi1).var->get_position(); + int same = 0; + bool identical = false; + if (identical = !strcmp((*cvi1).var->char_name(), + (*cvi2).var->char_name())) { + + for (; cvi1 && cvi2; cvi1++, cvi2++) { + + if (((*cvi1).coef != (*cvi2).coef + || (*gi1).get_const() + != (*gi2).get_const()) + || (strcmp((*cvi1).var->char_name(), + (*cvi2).var->char_name()))) { + + same++; + } + } + } + if ((same != 0) || !identical) { + dimension = dimension - 1; + + while (stmt[*i].loop_level[dimension].type // + == LoopLevelTile) + stmt[*i].loop_level[dimension].payload; + + dimension = stmt[*i].loop_level[dimension].payload; + + for (int i = 0; i < stmt.size(); i++) { + std::vector > D; + for (DependenceGraph::EdgeList::iterator j = + dep.vertex[i].second.begin(); + j != dep.vertex[i].second.end(); j++) { + for (int k = 0; k < j->second.size(); k++) { + DependenceVector dv = j->second[k]; + if (dv.type != DEP_CONTROL) + if (dv.hasNegative(dimension) + && !dv.quasi) + + throw loop_error( + "loop error: Split is illegal, dependence violation!"); + + } + } + } + + } + + } + + } + + } + + stmt[*i].IS = part1; + + if (Intersection(copy(part2), + Extend_Set(copy(this->known), n - this->known.n_set())).is_upper_bound_satisfiable()) { + Statement new_stmt; + new_stmt.code = stmt[*i].code->clone(); + new_stmt.IS = part2; + new_stmt.xform = copy(stmt[*i].xform); + new_stmt.ir_stmt_node = NULL; + new_stmt.loop_level = stmt[*i].loop_level; + + stmt_nesting_level_.push_back(stmt_nesting_level_[*i]); + + /*std::pair, + std::vector > dv = + test_data_dependences(ir, stmt[*i].code, part1, + stmt[*i].code, part2, freevar, index, + stmt_nesting_level_[*i], + stmt_nesting_level_[stmt.size() - 1]); + + + + + for (int k = 0; k < dv.first.size(); k++) + part1_to_part2++; + if (part1_to_part2 > 0 && part2_to_part1 > 0) + throw loop_error( + "loop error: Aborting, split resulted in impossible dependence cycle!"); + + for (int k = 0; k < dv.second.size(); k++) + part2_to_part1++; + + + + if (part1_to_part2 > 0 && part2_to_part1 > 0) + throw loop_error( + "loop error: Aborting, split resulted in impossible dependence cycle!"); + + + + if (part2_to_part1 > 0){ + temp_place_after = false; + assigned = true; + + }else if (part1_to_part2 > 0){ + temp_place_after = true; + + assigned = true; + } + + */ + + if (place_after) + assign_const(new_stmt.xform, dim - 1, cur_lex + 1); + else + assign_const(new_stmt.xform, dim - 1, cur_lex - 1); + + stmt.push_back(new_stmt); + dep.insert(); + what_stmt_num[*i] = stmt.size() - 1; + if (*i == stmt_num) + result.insert(stmt.size() - 1); + } + + } + // make adjacent lexical number available for new statements + if (place_after) { + lex[dim - 1] = cur_lex + 1; + shiftLexicalOrder(lex, dim - 1, 1); + } else { + lex[dim - 1] = cur_lex - 1; + shiftLexicalOrder(lex, dim - 1, -1); + } + // update dependence graph + int dep_dim = get_dep_dim_of(stmt_num, level); + for (int i = 0; i < old_num_stmt; i++) { + std::vector > > D; + + for (DependenceGraph::EdgeList::iterator j = + dep.vertex[i].second.begin(); + j != dep.vertex[i].second.end(); j++) { + if (same_loop.find(i) != same_loop.end()) { + if (same_loop.find(j->first) != same_loop.end()) { + if (what_stmt_num.find(i) != what_stmt_num.end() + && what_stmt_num.find(j->first) + != what_stmt_num.end()) + dep.connect(what_stmt_num[i], + what_stmt_num[j->first], j->second); + if (place_after + && what_stmt_num.find(j->first) + != what_stmt_num.end()) { + std::vector dvs; + for (int k = 0; k < j->second.size(); k++) { + DependenceVector dv = j->second[k]; + if (dv.is_data_dependence() && dep_dim != -1) { + dv.lbounds[dep_dim] = -posInfinity; + dv.ubounds[dep_dim] = posInfinity; + } + dvs.push_back(dv); + } + if (dvs.size() > 0) + D.push_back( + std::make_pair(what_stmt_num[j->first], + dvs)); + } else if (!place_after + && what_stmt_num.find(i) + != what_stmt_num.end()) { + std::vector dvs; + for (int k = 0; k < j->second.size(); k++) { + DependenceVector dv = j->second[k]; + if (dv.is_data_dependence() && dep_dim != -1) { + dv.lbounds[dep_dim] = -posInfinity; + dv.ubounds[dep_dim] = posInfinity; + } + dvs.push_back(dv); + } + if (dvs.size() > 0) + dep.connect(what_stmt_num[i], j->first, dvs); + + } + } else { + if (what_stmt_num.find(i) != what_stmt_num.end()) + dep.connect(what_stmt_num[i], j->first, j->second); + } + } else if (same_loop.find(j->first) != same_loop.end()) { + if (what_stmt_num.find(j->first) != what_stmt_num.end()) + D.push_back( + std::make_pair(what_stmt_num[j->first], + j->second)); + } + } + + for (int j = 0; j < D.size(); j++) + dep.connect(i, D[j].first, D[j].second); + } + + } + + return result; +} + +void Loop::skew(const std::set &stmt_nums, int level, + const std::vector &skew_amount) { + if (stmt_nums.size() == 0) + return; + + // check for sanity of parameters + int ref_stmt_num = *(stmt_nums.begin()); + for (std::set::const_iterator i = stmt_nums.begin(); + i != stmt_nums.end(); i++) { + if (*i < 0 || *i >= stmt.size()) + throw std::invalid_argument( + "invalid statement number " + to_string(*i)); + if (level < 1 || level > stmt[*i].loop_level.size()) + throw std::invalid_argument( + "invalid loop level " + to_string(level)); + for (int j = stmt[*i].loop_level.size(); j < skew_amount.size(); j++) + if (skew_amount[j] != 0) + throw std::invalid_argument("invalid skewing formula"); + } + + // invalidate saved codegen computation + delete last_compute_cgr_; + last_compute_cgr_ = NULL; + delete last_compute_cg_; + last_compute_cg_ = NULL; + + // set trasformation relations + for (std::set::const_iterator i = stmt_nums.begin(); + i != stmt_nums.end(); i++) { + int n = stmt[*i].xform.n_out(); + Relation r(n, n); + F_And *f_root = r.add_and(); + for (int j = 1; j <= n; j++) + if (j != 2 * level) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(r.input_var(j), 1); + h.update_coef(r.output_var(j), -1); + } + EQ_Handle h = f_root->add_EQ(); + h.update_coef(r.output_var(2 * level), -1); + for (int j = 0; j < skew_amount.size(); j++) + if (skew_amount[j] != 0) + h.update_coef(r.input_var(2 * (j + 1)), skew_amount[j]); + + stmt[*i].xform = Composition(r, stmt[*i].xform); + stmt[*i].xform.simplify(); + } + + // update dependence graph + if (stmt[ref_stmt_num].loop_level[level - 1].type == LoopLevelOriginal) { + int dep_dim = stmt[ref_stmt_num].loop_level[level - 1].payload; + for (std::set::const_iterator i = stmt_nums.begin(); + i != stmt_nums.end(); i++) + for (DependenceGraph::EdgeList::iterator j = + dep.vertex[*i].second.begin(); + j != dep.vertex[*i].second.end(); j++) + if (stmt_nums.find(j->first) != stmt_nums.end()) { + // dependence between skewed statements + std::vector dvs = j->second; + for (int k = 0; k < dvs.size(); k++) { + DependenceVector &dv = dvs[k]; + if (dv.is_data_dependence()) { + coef_t lb = 0; + coef_t ub = 0; + for (int kk = 0; kk < skew_amount.size(); kk++) { + int cur_dep_dim = get_dep_dim_of(*i, kk + 1); + if (skew_amount[kk] > 0) { + if (lb != -posInfinity + && stmt[*i].loop_level[kk].type + == LoopLevelOriginal + && dv.lbounds[cur_dep_dim] + != -posInfinity) + lb += skew_amount[kk] + * dv.lbounds[cur_dep_dim]; + else { + if (cur_dep_dim != -1 + && !(dv.lbounds[cur_dep_dim] + == 0 + && dv.ubounds[cur_dep_dim] + == 0)) + lb = -posInfinity; + } + if (ub != posInfinity + && stmt[*i].loop_level[kk].type + == LoopLevelOriginal + && dv.ubounds[cur_dep_dim] + != posInfinity) + ub += skew_amount[kk] + * dv.ubounds[cur_dep_dim]; + else { + if (cur_dep_dim != -1 + && !(dv.lbounds[cur_dep_dim] + == 0 + && dv.ubounds[cur_dep_dim] + == 0)) + ub = posInfinity; + } + } else if (skew_amount[kk] < 0) { + if (lb != -posInfinity + && stmt[*i].loop_level[kk].type + == LoopLevelOriginal + && dv.ubounds[cur_dep_dim] + != posInfinity) + lb += skew_amount[kk] + * dv.ubounds[cur_dep_dim]; + else { + if (cur_dep_dim != -1 + && !(dv.lbounds[cur_dep_dim] + == 0 + && dv.ubounds[cur_dep_dim] + == 0)) + lb = -posInfinity; + } + if (ub != posInfinity + && stmt[*i].loop_level[kk].type + == LoopLevelOriginal + && dv.lbounds[cur_dep_dim] + != -posInfinity) + ub += skew_amount[kk] + * dv.lbounds[cur_dep_dim]; + else { + if (cur_dep_dim != -1 + && !(dv.lbounds[cur_dep_dim] + == 0 + && dv.ubounds[cur_dep_dim] + == 0)) + ub = posInfinity; + } + } + } + dv.lbounds[dep_dim] = lb; + dv.ubounds[dep_dim] = ub; + if ((dv.isCarried(dep_dim) + && dv.hasPositive(dep_dim)) && dv.quasi) + dv.quasi = false; + + if ((dv.isCarried(dep_dim) + && dv.hasNegative(dep_dim)) && !dv.quasi) + throw loop_error( + "loop error: Skewing is illegal, dependence violation!"); + dv.lbounds[dep_dim] = lb; + dv.ubounds[dep_dim] = ub; + if ((dv.isCarried(dep_dim) + && dv.hasPositive(dep_dim)) && dv.quasi) + dv.quasi = false; + + if ((dv.isCarried(dep_dim) + && dv.hasNegative(dep_dim)) && !dv.quasi) + throw loop_error( + "loop error: Skewing is illegal, dependence violation!"); + } + } + j->second = dvs; + } else { + // dependence from skewed statement to unskewed statement becomes jumbled, + // put distance value at skewed dimension to unknown + std::vector dvs = j->second; + for (int k = 0; k < dvs.size(); k++) { + DependenceVector &dv = dvs[k]; + if (dv.is_data_dependence()) { + dv.lbounds[dep_dim] = -posInfinity; + dv.ubounds[dep_dim] = posInfinity; + } + } + j->second = dvs; + } + for (int i = 0; i < dep.vertex.size(); i++) + if (stmt_nums.find(i) == stmt_nums.end()) + for (DependenceGraph::EdgeList::iterator j = + dep.vertex[i].second.begin(); + j != dep.vertex[i].second.end(); j++) + if (stmt_nums.find(j->first) != stmt_nums.end()) { + // dependence from unskewed statement to skewed statement becomes jumbled, + // put distance value at skewed dimension to unknown + std::vector dvs = j->second; + for (int k = 0; k < dvs.size(); k++) { + DependenceVector &dv = dvs[k]; + if (dv.is_data_dependence()) { + dv.lbounds[dep_dim] = -posInfinity; + dv.ubounds[dep_dim] = posInfinity; + } + } + j->second = dvs; + } + } +} + + +void Loop::shift(const std::set &stmt_nums, int level, int shift_amount) { + if (stmt_nums.size() == 0) + return; + + // check for sanity of parameters + int ref_stmt_num = *(stmt_nums.begin()); + for (std::set::const_iterator i = stmt_nums.begin(); + i != stmt_nums.end(); i++) { + if (*i < 0 || *i >= stmt.size()) + throw std::invalid_argument( + "invalid statement number " + to_string(*i)); + if (level < 1 || level > stmt[*i].loop_level.size()) + throw std::invalid_argument( + "invalid loop level " + to_string(level)); + } + + // do nothing + if (shift_amount == 0) + return; + + // invalidate saved codegen computation + delete last_compute_cgr_; + last_compute_cgr_ = NULL; + delete last_compute_cg_; + last_compute_cg_ = NULL; + + // set trasformation relations + for (std::set::const_iterator i = stmt_nums.begin(); + i != stmt_nums.end(); i++) { + int n = stmt[*i].xform.n_out(); + + Relation r(n, n); + F_And *f_root = r.add_and(); + for (int j = 1; j <= n; j++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(r.input_var(j), 1); + h.update_coef(r.output_var(j), -1); + if (j == 2 * level) + h.update_const(shift_amount); + } + + stmt[*i].xform = Composition(r, stmt[*i].xform); + stmt[*i].xform.simplify(); + } + + // update dependence graph + if (stmt[ref_stmt_num].loop_level[level - 1].type == LoopLevelOriginal) { + int dep_dim = stmt[ref_stmt_num].loop_level[level - 1].payload; + for (std::set::const_iterator i = stmt_nums.begin(); + i != stmt_nums.end(); i++) + for (DependenceGraph::EdgeList::iterator j = + dep.vertex[*i].second.begin(); + j != dep.vertex[*i].second.end(); j++) + if (stmt_nums.find(j->first) == stmt_nums.end()) { + // dependence from shifted statement to unshifted statement + std::vector dvs = j->second; + for (int k = 0; k < dvs.size(); k++) { + DependenceVector &dv = dvs[k]; + if (dv.is_data_dependence()) { + if (dv.lbounds[dep_dim] != -posInfinity) + dv.lbounds[dep_dim] -= shift_amount; + if (dv.ubounds[dep_dim] != posInfinity) + dv.ubounds[dep_dim] -= shift_amount; + } + } + j->second = dvs; + } + for (int i = 0; i < dep.vertex.size(); i++) + if (stmt_nums.find(i) == stmt_nums.end()) + for (DependenceGraph::EdgeList::iterator j = + dep.vertex[i].second.begin(); + j != dep.vertex[i].second.end(); j++) + if (stmt_nums.find(j->first) != stmt_nums.end()) { + // dependence from unshifted statement to shifted statement + std::vector dvs = j->second; + for (int k = 0; k < dvs.size(); k++) { + DependenceVector &dv = dvs[k]; + if (dv.is_data_dependence()) { + if (dv.lbounds[dep_dim] != -posInfinity) + dv.lbounds[dep_dim] += shift_amount; + if (dv.ubounds[dep_dim] != posInfinity) + dv.ubounds[dep_dim] += shift_amount; + } + } + j->second = dvs; + } + } +} + +void Loop::scale(const std::set &stmt_nums, int level, int scale_amount) { + std::vector skew_amount(level, 0); + skew_amount[level - 1] = scale_amount; + skew(stmt_nums, level, skew_amount); +} + +void Loop::reverse(const std::set &stmt_nums, int level) { + scale(stmt_nums, level, -1); +} + +void Loop::fuse(const std::set &stmt_nums, int level) { + if (stmt_nums.size() == 0 || stmt_nums.size() == 1) + return; + + // invalidate saved codegen computation + delete last_compute_cgr_; + last_compute_cgr_ = NULL; + delete last_compute_cg_; + last_compute_cg_ = NULL; + + int dim = 2 * level - 1; + // check for sanity of parameters + std::vector ref_lex; + int ref_stmt_num; + for (std::set::const_iterator i = stmt_nums.begin(); + i != stmt_nums.end(); i++) { + if (*i < 0 || *i >= stmt.size()) + throw std::invalid_argument( + "invalid statement number " + to_string(*i)); + if (level <= 0 + || (level > (stmt[*i].xform.n_out() - 1) / 2 + || level > stmt[*i].loop_level.size())) + throw std::invalid_argument( + "invalid loop level " + to_string(level)); + if (ref_lex.size() == 0) { + ref_lex = getLexicalOrder(*i); + ref_stmt_num = *i; + } else { + std::vector lex = getLexicalOrder(*i); + for (int j = 0; j < dim - 1; j += 2) + if (lex[j] != ref_lex[j]) + throw std::invalid_argument( + "statements for fusion must be in the same level-" + + to_string(level - 1) + " subloop"); + } + } + + // collect lexicographical order values from to-be-fused statements + std::set lex_values; + for (std::set::const_iterator i = stmt_nums.begin(); + i != stmt_nums.end(); i++) { + std::vector lex = getLexicalOrder(*i); + lex_values.insert(lex[dim - 1]); + } + if (lex_values.size() == 1) + return; + // negative dependence would prevent fusion + + int dep_dim = get_dep_dim_of(ref_stmt_num, level); + + for (std::set::iterator i = lex_values.begin(); i != lex_values.end(); + i++) { + ref_lex[dim - 1] = *i; + std::set a = getStatements(ref_lex, dim - 1); + std::set::iterator j = i; + j++; + for (; j != lex_values.end(); j++) { + ref_lex[dim - 1] = *j; + std::set b = getStatements(ref_lex, dim - 1); + for (std::set::iterator ii = a.begin(); ii != a.end(); ii++) + for (std::set::iterator jj = b.begin(); jj != b.end(); + jj++) { + std::vector dvs; + dvs = dep.getEdge(*ii, *jj); + for (int k = 0; k < dvs.size(); k++) + if (dvs[k].isCarried(dep_dim) + && dvs[k].hasNegative(dep_dim)) + throw loop_error( + "loop error: statements " + to_string(*ii) + + " and " + to_string(*jj) + + " cannot be fused together due to negative dependence"); + dvs = dep.getEdge(*jj, *ii); + for (int k = 0; k < dvs.size(); k++) + if (dvs[k].isCarried(dep_dim) + && dvs[k].hasNegative(dep_dim)) + throw loop_error( + "loop error: statements " + to_string(*jj) + + " and " + to_string(*ii) + + " cannot be fused together due to negative dependence"); + } + } + } + + std::set same_loop = getStatements(ref_lex, dim - 3); + + std::vector > s = sort_by_same_loops(same_loop, level); + + std::set s1; + std::set s2; + std::set s4; + std::vector > s3; + for (std::set::iterator kk = stmt_nums.begin(); kk != stmt_nums.end(); + kk++) + for (int i = 0; i < s.size(); i++) + if (s[i].find(*kk) != s[i].end()) { + s1.insert(s[i].begin(), s[i].end()); + s2.insert(i); + } + + s3.push_back(s1); + for (int i = 0; i < s.size(); i++) + if (s2.find(i) == s2.end()) { + s3.push_back(s[i]); + s4.insert(s[i].begin(), s[i].end()); + } + try { + std::vector > s5; + s5.push_back(s1); + s5.push_back(s4); + + //Dependence Check for Ordering Constraint + //Graph, bool> dummy = construct_induced_graph_at_level(s5, + // dep, dep_dim); + + Graph, bool> g = construct_induced_graph_at_level(s3, dep, + dep_dim); + + s = typed_fusion(g); + } catch (const loop_error &e) { + + throw loop_error( + "statements cannot be fused together due to negative dependence"); + + } + + if (s3.size() == s.size()) { + int order = 0; + for (int i = 0; i < s.size(); i++) { + + for (std::set::iterator it = s[i].begin(); it != s[i].end(); + it++) { + + assign_const(stmt[*it].xform, 2 * level - 2, order); + + } + + order++; + } + } else if (s3.size() > s.size()) { + + int order = 0; + for (int j = 0; j < s.size(); j++) { + std::set::iterator it3; + for (it3 = s1.begin(); it3 != s1.end(); it3++) { + if (s[j].find(*it3) != s[j].end()) + break; + } + if (it3 != s1.end()) { + for (std::set::iterator it = s1.begin(); it != s1.end(); + it++) + assign_const(stmt[*it].xform, 2 * level - 2, order); + + order++; + + } + + for (int i = 0; i < s3.size(); i++) { + std::set::iterator it2; + + for (it2 = s3[i].begin(); it2 != s3[i].end(); it2++) { + if (s[j].find(*it2) != s[j].end()) + break; + } + + if (it2 != s3[i].end()) { + for (std::set::iterator it = s3[i].begin(); + it != s3[i].end(); it++) + assign_const(stmt[*it].xform, 2 * level - 2, order); + + order++; + + } + } + } + + } else + throw loop_error("Typed Fusion Error"); + +} + + + +void Loop::distribute(const std::set &stmt_nums, int level) { + if (stmt_nums.size() == 0 || stmt_nums.size() == 1) + return; + + // invalidate saved codegen computation + delete last_compute_cgr_; + last_compute_cgr_ = NULL; + delete last_compute_cg_; + last_compute_cg_ = NULL; + int dim = 2 * level - 1; + int ref_stmt_num; + // check for sanity of parameters + std::vector ref_lex; + for (std::set::const_iterator i = stmt_nums.begin(); + i != stmt_nums.end(); i++) { + if (*i < 0 || *i >= stmt.size()) + throw std::invalid_argument( + "invalid statement number " + to_string(*i)); + if (level < 1 + || (level > (stmt[*i].xform.n_out() - 1) / 2 + || level > stmt[*i].loop_level.size())) + throw std::invalid_argument( + "invalid loop level " + to_string(level)); + if (ref_lex.size() == 0) { + ref_lex = getLexicalOrder(*i); + ref_stmt_num = *i; + } else { + std::vector lex = getLexicalOrder(*i); + for (int j = 0; j <= dim - 1; j += 2) + if (lex[j] != ref_lex[j]) + throw std::invalid_argument( + "statements for distribution must be in the same level-" + + to_string(level) + " subloop"); + } + } + // find SCC in the to-be-distributed loop + int dep_dim = get_dep_dim_of(ref_stmt_num, level); + std::set same_loop = getStatements(ref_lex, dim - 1); + Graph g; + for (std::set::iterator i = same_loop.begin(); i != same_loop.end(); + i++) + g.insert(*i); + for (int i = 0; i < g.vertex.size(); i++) + for (int j = i + 1; j < g.vertex.size(); j++) { + std::vector dvs; + dvs = dep.getEdge(g.vertex[i].first, g.vertex[j].first); + for (int k = 0; k < dvs.size(); k++) + if (dvs[k].isCarried(dep_dim)) { + g.connect(i, j); + break; + } + dvs = dep.getEdge(g.vertex[j].first, g.vertex[i].first); + for (int k = 0; k < dvs.size(); k++) + if (dvs[k].isCarried(dep_dim)) { + g.connect(j, i); + break; + } + } + std::vector > s = g.topoSort(); + // find statements that cannot be distributed due to dependence cycle + Graph, Empty> g2; + for (int i = 0; i < s.size(); i++) { + std::set t; + for (std::set::iterator j = s[i].begin(); j != s[i].end(); j++) + if (stmt_nums.find(g.vertex[*j].first) != stmt_nums.end()) + t.insert(g.vertex[*j].first); + if (!t.empty()) + g2.insert(t); + } + for (int i = 0; i < g2.vertex.size(); i++) + for (int j = i + 1; j < g2.vertex.size(); j++) + for (std::set::iterator ii = g2.vertex[i].first.begin(); + ii != g2.vertex[i].first.end(); ii++) + for (std::set::iterator jj = g2.vertex[j].first.begin(); + jj != g2.vertex[j].first.end(); jj++) { + std::vector dvs; + dvs = dep.getEdge(*ii, *jj); + for (int k = 0; k < dvs.size(); k++) + if (dvs[k].isCarried(dep_dim)) { + g2.connect(i, j); + break; + } + dvs = dep.getEdge(*jj, *ii); + for (int k = 0; k < dvs.size(); k++) + if (dvs[k].isCarried(dep_dim)) { + g2.connect(j, i); + break; + } + } + std::vector > s2 = g2.topoSort(); + // nothing to distribute + if (s2.size() == 1) + throw loop_error( + "loop error: no statement can be distributed due to dependence cycle"); + std::vector > s3; + for (int i = 0; i < s2.size(); i++) { + std::set t; + for (std::set::iterator j = s2[i].begin(); j != s2[i].end(); j++) + std::set_union(t.begin(), t.end(), g2.vertex[*j].first.begin(), + g2.vertex[*j].first.end(), inserter(t, t.begin())); + s3.push_back(t); + } + // associate other affected statements with the right distributed statements + for (std::set::iterator i = same_loop.begin(); i != same_loop.end(); + i++) + if (stmt_nums.find(*i) == stmt_nums.end()) { + bool is_inserted = false; + int potential_insertion_point = 0; + for (int j = 0; j < s3.size(); j++) { + for (std::set::iterator k = s3[j].begin(); + k != s3[j].end(); k++) { + std::vector dvs; + dvs = dep.getEdge(*i, *k); + for (int kk = 0; kk < dvs.size(); kk++) + if (dvs[kk].isCarried(dep_dim)) { + s3[j].insert(*i); + is_inserted = true; + break; + } + dvs = dep.getEdge(*k, *i); + for (int kk = 0; kk < dvs.size(); kk++) + if (dvs[kk].isCarried(dep_dim)) + potential_insertion_point = j; + } + if (is_inserted) + break; + } + if (!is_inserted) + s3[potential_insertion_point].insert(*i); + } + // set lexicographical order after distribution + int order = ref_lex[dim - 1]; + shiftLexicalOrder(ref_lex, dim - 1, s3.size() - 1); + for (std::vector >::iterator i = s3.begin(); i != s3.end(); + i++) { + for (std::set::iterator j = (*i).begin(); j != (*i).end(); j++) + assign_const(stmt[*j].xform, dim - 1, order); + order++; + } + // no need to update dependence graph + ; + return; +} + diff --git a/chill/src/loop_datacopy.cc b/chill/src/loop_datacopy.cc new file mode 100644 index 0000000..36acb01 --- /dev/null +++ b/chill/src/loop_datacopy.cc @@ -0,0 +1,2166 @@ +/***************************************************************************** + Copyright (C) 2008 University of Southern California + Copyright (C) 2009-2010 University of Utah + All Rights Reserved. + + Purpose: + Various data copy schemes. + + Notes: + + History: + 02/20/09 Created by Chun Chen by splitting original datacopy from loop.cc +*****************************************************************************/ + +#include +#include +#include "loop.hh" +#include "omegatools.hh" +#include "ir_code.hh" +#include "chill_error.hh" + +using namespace omega; + +// +// data copy function by referring arrays by numbers. +// e.g. A[i] = A[i-1] + B[i] +// parameter array_ref_num=[0,2] means to copy data touched by A[i-1] and A[i] +// +bool Loop::datacopy(const std::vector > > &array_ref_nums, int level, + bool allow_extra_read, int fastest_changing_dimension, int padding_stride, int padding_alignment, int memory_type) { + // check for sanity of parameters + std::set same_loop; + for (int i = 0; i < array_ref_nums.size(); i++) { + int stmt_num = array_ref_nums[i].first; + if (stmt_num < 0 || stmt_num >= stmt.size()) + throw std::invalid_argument("invalid statement number " + to_string(stmt_num)); + if (level <= 0 || level > stmt[stmt_num].loop_level.size()) + throw std::invalid_argument("invalid loop level " + to_string(level)); + if (i == 0) { + std::vector lex = getLexicalOrder(stmt_num); + same_loop = getStatements(lex, 2*level-2); + } + else if (same_loop.find(stmt_num) == same_loop.end()) + throw std::invalid_argument("array references for data copy must be located in the same subloop"); + } + + // convert array reference numbering scheme to actual array references + std::vector > > selected_refs; + for (int i = 0; i < array_ref_nums.size(); i++) { + if (array_ref_nums[i].second.size() == 0) + continue; + + int stmt_num = array_ref_nums[i].first; + selected_refs.push_back(std::make_pair(stmt_num, std::vector())); + std::vector refs = ir->FindArrayRef(stmt[stmt_num].code); + std::vector selected(refs.size(), false); + for (int j = 0; j < array_ref_nums[i].second.size(); j++) { + int ref_num = array_ref_nums[i].second[j]; + if (ref_num < 0 || ref_num >= refs.size()) { + for (int k = 0; k < refs.size(); k++) + delete refs[k]; + throw std::invalid_argument("invalid array reference number " + to_string(ref_num) + " in statement " + to_string(stmt_num)); + } + selected_refs[selected_refs.size()-1].second.push_back(refs[ref_num]); + selected[ref_num] = true; + } + for (int j = 0; j < refs.size(); j++) + if (!selected[j]) + delete refs[j]; + } + if (selected_refs.size() == 0) + throw std::invalid_argument("found no array references to copy"); + + // do the copy + return datacopy_privatized(selected_refs, level, std::vector(), allow_extra_read, fastest_changing_dimension, padding_stride, padding_alignment, memory_type); +} + +// +// data copy function by referring arrays by name. +// e.g. A[i] = A[i-1] + B[i] +// parameter array_name=A means to copy data touched by A[i-1] and A[i] +// +bool Loop::datacopy(int stmt_num, int level, const std::string &array_name, + bool allow_extra_read, int fastest_changing_dimension, int padding_stride, int padding_alignment, int memory_type) { + // check for sanity of parameters + if (stmt_num < 0 || stmt_num >= stmt.size()) + throw std::invalid_argument("invalid statement number " + to_string(stmt_num)); + if (level <= 0 || level > stmt[stmt_num].loop_level.size()) + throw std::invalid_argument("invalid loop level " + to_string(level)); + + // collect array references by name + std::vector lex = getLexicalOrder(stmt_num); + int dim = 2*level - 1; + std::set same_loop = getStatements(lex, dim-1); + + std::vector > > selected_refs; + for (std::set::iterator i = same_loop.begin(); i != same_loop.end(); i++) { + std::vector t; + std::vector refs = ir->FindArrayRef(stmt[*i].code); + for (int j = 0; j < refs.size(); j++) + if (refs[j]->name() == array_name) + t.push_back(refs[j]); + else + delete refs[j]; + if (t.size() != 0) + selected_refs.push_back(std::make_pair(*i, t)); + } + if (selected_refs.size() == 0) + throw std::invalid_argument("found no array references with name " + to_string(array_name) + " to copy"); + + // do the copy + return datacopy_privatized(selected_refs, level, std::vector(), allow_extra_read, fastest_changing_dimension, padding_stride, padding_alignment, memory_type); +} + + +bool Loop::datacopy_privatized(int stmt_num, int level, const std::string &array_name, const std::vector &privatized_levels, + bool allow_extra_read, int fastest_changing_dimension, int padding_stride, int padding_alignment, int memory_type) { + // check for sanity of parameters + if (stmt_num < 0 || stmt_num >= stmt.size()) + throw std::invalid_argument("invalid statement number " + to_string(stmt_num)); + if (level <= 0 || level > stmt[stmt_num].loop_level.size()) + throw std::invalid_argument("invalid loop level " + to_string(level)); + + // collect array references by name + std::vector lex = getLexicalOrder(stmt_num); + int dim = 2*level - 1; + std::set same_loop = getStatements(lex, dim-1); + + std::vector > > selected_refs; + for (std::set::iterator i = same_loop.begin(); i != same_loop.end(); i++) { + selected_refs.push_back(std::make_pair(*i, std::vector())); + + std::vector refs = ir->FindArrayRef(stmt[*i].code); + for (int j = 0; j < refs.size(); j++) + if (refs[j]->name() == array_name) + selected_refs[selected_refs.size()-1].second.push_back(refs[j]); + else + delete refs[j]; + } + if (selected_refs.size() == 0) + throw std::invalid_argument("found no array references with name " + to_string(array_name) + " to copy"); + + // do the copy + return datacopy_privatized(selected_refs, level, privatized_levels, allow_extra_read, fastest_changing_dimension, padding_stride, padding_alignment, memory_type); +} + + +bool Loop::datacopy_privatized(const std::vector > > &array_ref_nums, int level, const std::vector &privatized_levels, bool allow_extra_read, int fastest_changing_dimension, int padding_stride, int padding_alignment, int memory_type) { + // check for sanity of parameters + std::set same_loop; + for (int i = 0; i < array_ref_nums.size(); i++) { + int stmt_num = array_ref_nums[i].first; + if (stmt_num < 0 || stmt_num >= stmt.size()) + throw std::invalid_argument("invalid statement number " + to_string(stmt_num)); + if (level <= 0 || level > stmt[stmt_num].loop_level.size()) + throw std::invalid_argument("invalid loop level " + to_string(level)); + if (i == 0) { + std::vector lex = getLexicalOrder(stmt_num); + same_loop = getStatements(lex, 2*level-2); + } + else if (same_loop.find(stmt_num) == same_loop.end()) + throw std::invalid_argument("array references for data copy must be located in the same subloop"); + } + + // convert array reference numbering scheme to actual array references + std::vector > > selected_refs; + for (int i = 0; i < array_ref_nums.size(); i++) { + if (array_ref_nums[i].second.size() == 0) + continue; + + int stmt_num = array_ref_nums[i].first; + selected_refs.push_back(std::make_pair(stmt_num, std::vector())); + std::vector refs = ir->FindArrayRef(stmt[stmt_num].code); + std::vector selected(refs.size(), false); + for (int j = 0; j < array_ref_nums[i].second.size(); j++) { + int ref_num = array_ref_nums[i].second[j]; + if (ref_num < 0 || ref_num >= refs.size()) { + for (int k = 0; k < refs.size(); k++) + delete refs[k]; + throw std::invalid_argument("invalid array reference number " + to_string(ref_num) + " in statement " + to_string(stmt_num)); + } + selected_refs[selected_refs.size()-1].second.push_back(refs[ref_num]); + selected[ref_num] = true; + } + for (int j = 0; j < refs.size(); j++) + if (!selected[j]) + delete refs[j]; + } + if (selected_refs.size() == 0) + throw std::invalid_argument("found no array references to copy"); + + // do the copy + return datacopy_privatized(selected_refs, level, privatized_levels, allow_extra_read, fastest_changing_dimension, padding_stride, padding_alignment, memory_type); +} + + +// +// Implement low level datacopy function with lots of options. +// +/*bool Loop::datacopy_privatized(const std::vector > > &stmt_refs, int level, + const std::vector &privatized_levels, + bool allow_extra_read, int fastest_changing_dimension, + int padding_stride, int padding_alignment, int memory_type) { + if (stmt_refs.size() == 0) + return true; + + // check for sanity of parameters + IR_ArraySymbol *sym = NULL; + std::vector lex; + std::set active; + if (level <= 0) + throw std::invalid_argument("invalid loop level " + to_string(level)); + for (int i = 0; i < privatized_levels.size(); i++) { + if (i == 0) { + if (privatized_levels[i] < level) + throw std::invalid_argument("privatized loop levels must be no less than level " + to_string(level)); + } + else if (privatized_levels[i] <= privatized_levels[i-1]) + throw std::invalid_argument("privatized loop levels must be in ascending order"); + } + for (int i = 0; i < stmt_refs.size(); i++) { + int stmt_num = stmt_refs[i].first; + active.insert(stmt_num); + if (stmt_num < 0 || stmt_num >= stmt.size()) + throw std::invalid_argument("invalid statement number " + to_string(stmt_num)); + if (privatized_levels.size() != 0) { + if (privatized_levels[privatized_levels.size()-1] > stmt[stmt_num].loop_level.size()) + throw std::invalid_argument("invalid loop level " + to_string(privatized_levels[privatized_levels.size()-1]) + " for statement " + to_string(stmt_num)); + } + else { + if (level > stmt[stmt_num].loop_level.size()) + throw std::invalid_argument("invalid loop level " + to_string(level) + " for statement " + to_string(stmt_num)); + } + for (int j = 0; j < stmt_refs[i].second.size(); j++) { + if (sym == NULL) { + sym = stmt_refs[i].second[j]->symbol(); + lex = getLexicalOrder(stmt_num); + } + else { + IR_ArraySymbol *t = stmt_refs[i].second[j]->symbol(); + if (t->name() != sym->name()) { + delete t; + delete sym; + throw std::invalid_argument("try to copy data from different arrays"); + } + delete t; + } + } + } + if (!(fastest_changing_dimension >= -1 && fastest_changing_dimension < sym->n_dim())) + throw std::invalid_argument("invalid fastest changing dimension for the array to be copied"); + if (padding_stride < 0) + throw std::invalid_argument("invalid temporary array stride requirement"); + if (padding_alignment == -1 || padding_alignment == 0) + throw std::invalid_argument("invalid temporary array alignment requirement"); + + int dim = 2*level - 1; + int n_dim = sym->n_dim(); + + if (fastest_changing_dimension == -1) + switch (sym->layout_type()) { + case IR_ARRAY_LAYOUT_ROW_MAJOR: + fastest_changing_dimension = n_dim - 1; + break; + case IR_ARRAY_LAYOUT_COLUMN_MAJOR: + fastest_changing_dimension = 0; + break; + default: + throw loop_error("unsupported array layout"); + } + + + // build iteration spaces for all reads and for all writes separately + apply_xform(active); + bool has_write_refs = false; + bool has_read_refs = false; + Relation wo_copy_is = Relation::False(level-1+privatized_levels.size()+n_dim); + Relation ro_copy_is = Relation::False(level-1+privatized_levels.size()+n_dim); + for (int i = 0; i < stmt_refs.size(); i++) { + int stmt_num = stmt_refs[i].first; + + for (int j = 0; j < stmt_refs[i].second.size(); j++) { + Relation mapping(stmt[stmt_num].IS.n_set(), level-1+privatized_levels.size()+n_dim); + for (int k = 1; k <= mapping.n_inp(); k++) + mapping.name_input_var(k, stmt[stmt_num].IS.set_var(k)->name()); + mapping.setup_names(); + F_And *f_root = mapping.add_and(); + for (int k = 1; k <= level-1; k++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.input_var(k), 1); + h.update_coef(mapping.output_var(k), -1); + } + for (int k = 0; k < privatized_levels.size(); k++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.input_var(privatized_levels[k]), 1); + h.update_coef(mapping.output_var(level+k), -1); + } + for (int k = 0; k < n_dim; k++) { + CG_outputRepr *repr = stmt_refs[i].second[j]->index(k); + exp2formula(ir, mapping, f_root, freevar, repr, mapping.output_var(level-1+privatized_levels.size()+k+1), 'w', IR_COND_EQ, false); + repr->clear(); + delete repr; + } + Relation r = Range(Restrict_Domain(mapping, Intersection(copy(stmt[stmt_num].IS), Extend_Set(copy(this->known), stmt[stmt_num].IS.n_set() - this->known.n_set())))); + if (stmt_refs[i].second[j]->is_write()) { + has_write_refs = true; + wo_copy_is = Union(wo_copy_is, r); + wo_copy_is.simplify(2, 4); + } + else { + has_read_refs = true; + //protonu--removing the next line for now + ro_copy_is = Union(ro_copy_is, r); + ro_copy_is.simplify(2, 4); + //ro_copy_is = ConvexRepresentation(Union(ro_copy_is, r)); + + } + } + } + + if (allow_extra_read) { + Relation t = DecoupledConvexHull(copy(ro_copy_is)); + if (t.number_of_conjuncts() > 1) + ro_copy_is = RectHull(ro_copy_is); + else + ro_copy_is = t; + } + else { + Relation t = ConvexRepresentation(copy(ro_copy_is)); + if (t.number_of_conjuncts() > 1) + ro_copy_is = RectHull(ro_copy_is); + else + ro_copy_is = t; + } + wo_copy_is = ConvexRepresentation(wo_copy_is); + + if (allow_extra_read) { + Tuple Rs; + Tuple active; + for (DNF_Iterator di(ro_copy_is.query_DNF()); di; di++) { + Rs.append(Relation(ro_copy_is, di.curr())); + active.append(1); + } + Relation the_gcs = Relation::True(ro_copy_is.n_set()); + for (int i = level-1+privatized_levels.size()+1; i <= level-1+privatized_levels.size()+n_dim; i++) { + Relation r = greatest_common_step(Rs, active, i, Relation::Null()); + the_gcs = Intersection(the_gcs, r); + } + + ro_copy_is = Approximate(ro_copy_is); + ro_copy_is = ConvexRepresentation(ro_copy_is); + ro_copy_is = Intersection(ro_copy_is, the_gcs); + ro_copy_is.simplify(); + } + + + + for (int i = 1; i < level; i++) { + std::string s = stmt[*active.begin()].IS.input_var(i)->name(); + wo_copy_is.name_set_var(i, s); + ro_copy_is.name_set_var(i, s); + } + for (int i = 0; i < privatized_levels.size(); i++) { + std::string s = stmt[*active.begin()].IS.input_var(privatized_levels[i])->name(); + wo_copy_is.name_set_var(level+i, s); + ro_copy_is.name_set_var(level+i, s); + } + for (int i = level+privatized_levels.size(); i < level+privatized_levels.size()+n_dim; i++) { + std::string s = tmp_loop_var_name_prefix + to_string(tmp_loop_var_name_counter+i-level-privatized_levels.size()); + wo_copy_is.name_set_var(i, s); + ro_copy_is.name_set_var(i, s); + } + tmp_loop_var_name_counter += n_dim; + + //protonu--end change + + wo_copy_is.setup_names(); + ro_copy_is.setup_names(); + + // build merged iteration space for calculating temporary array size + bool already_use_recthull = false; + Relation untampered_copy_is = ConvexRepresentation(Union(copy(wo_copy_is), copy(ro_copy_is))); + Relation copy_is = untampered_copy_is; + if (copy_is.number_of_conjuncts() > 1) { + try { + copy_is = ConvexHull(copy(untampered_copy_is)); + } + catch (const std::overflow_error &e) { + copy_is = RectHull(copy(untampered_copy_is)); + already_use_recthull = true; + } + } + + + Retry_copy_is: + // extract temporary array information + CG_outputBuilder *ocg = ir->builder(); + std::vector index_lb(n_dim); // initialized to NULL + std::vector index_stride(n_dim, 1); + std::vector is_index_eq(n_dim, false); + std::vector > index_sz(0); + Relation reduced_copy_is = copy(copy_is); + + for (int i = 0; i < n_dim; i++) { + if (i != 0) + reduced_copy_is = Project(reduced_copy_is, level-1+privatized_levels.size()+i, Set_Var); + Relation bound = get_loop_bound(reduced_copy_is, level-1+privatized_levels.size()+i); + + // extract stride + EQ_Handle stride_eq; + { + bool simple_stride = true; + int strides = countStrides(bound.query_DNF()->single_conjunct(), bound.set_var(level-1+privatized_levels.size()+i+1), stride_eq, simple_stride); + if (strides > 1) { + throw loop_error("too many strides"); + } + else if (strides == 1) { + int sign = stride_eq.get_coef(bound.set_var(level-1+privatized_levels.size()+i+1)); + Constr_Vars_Iter it(stride_eq, true); + index_stride[i] = abs((*it).coef/sign); + } + } + + // check if this arary index requires loop + Conjunct *c = bound.query_DNF()->single_conjunct(); + for (EQ_Iterator ei(c->EQs()); ei; ei++) { + if ((*ei).has_wildcards()) + continue; + + int coef = (*ei).get_coef(bound.set_var(level-1+privatized_levels.size()+i+1)); + if (coef != 0) { + int sign = 1; + if (coef < 0) { + coef = -coef; + sign = -1; + } + + CG_outputRepr *op = NULL; + for (Constr_Vars_Iter ci(*ei); ci; ci++) { + switch ((*ci).var->kind()) { + case Input_Var: + { + if ((*ci).var != bound.set_var(level-1+privatized_levels.size()+i+1)) + if ((*ci).coef*sign == 1) + op = ocg->CreateMinus(op, ocg->CreateIdent((*ci).var->name())); + else if ((*ci).coef*sign == -1) + op = ocg->CreatePlus(op, ocg->CreateIdent((*ci).var->name())); + else if ((*ci).coef*sign > 1) + op = ocg->CreateMinus(op, ocg->CreateTimes(ocg->CreateInt(abs((*ci).coef)), ocg->CreateIdent((*ci).var->name()))); + else // (*ci).coef*sign < -1 + op = ocg->CreatePlus(op, ocg->CreateTimes(ocg->CreateInt(abs((*ci).coef)), ocg->CreateIdent((*ci).var->name()))); + break; + } + case Global_Var: + { + Global_Var_ID g = (*ci).var->get_global_var(); + if ((*ci).coef*sign == 1) + op = ocg->CreateMinus(op, ocg->CreateIdent(g->base_name())); + else if ((*ci).coef*sign == -1) + op = ocg->CreatePlus(op, ocg->CreateIdent(g->base_name())); + else if ((*ci).coef*sign > 1) + op = ocg->CreateMinus(op, ocg->CreateTimes(ocg->CreateInt(abs((*ci).coef)), ocg->CreateIdent(g->base_name()))); + else // (*ci).coef*sign < -1 + op = ocg->CreatePlus(op, ocg->CreateTimes(ocg->CreateInt(abs((*ci).coef)), ocg->CreateIdent(g->base_name()))); + break; + } + default: + throw loop_error("unsupported array index expression"); + } + } + if ((*ei).get_const() != 0) + op = ocg->CreatePlus(op, ocg->CreateInt(-sign*((*ei).get_const()))); + if (coef != 1) + op = ocg->CreateIntegerDivide(op, ocg->CreateInt(coef)); + + index_lb[i] = op; + is_index_eq[i] = true; + break; + } + } + if (is_index_eq[i]) + continue; + + // seperate lower and upper bounds + std::vector lb_list, ub_list; + for (GEQ_Iterator gi(c->GEQs()); gi; gi++) { + int coef = (*gi).get_coef(bound.set_var(level-1+privatized_levels.size()+i+1)); + if (coef != 0 && (*gi).has_wildcards()) { + bool clean_bound = true; + GEQ_Handle h; + for (Constr_Vars_Iter cvi(*gi, true); gi; gi++) + if (!findFloorInequality(bound, (*cvi).var, h, bound.set_var(level-1+privatized_levels.size()+i+1))) { + clean_bound = false; + break; + } + if (!clean_bound) + continue; + } + + if (coef > 0) + lb_list.push_back(*gi); + else if (coef < 0) + ub_list.push_back(*gi); + } + if (lb_list.size() == 0 || ub_list.size() == 0) + if (already_use_recthull) + throw loop_error("failed to calcuate array footprint size"); + else { + copy_is = RectHull(copy(untampered_copy_is)); + already_use_recthull = true; + goto Retry_copy_is; + } + + // build lower bound representation + Tuple lb_repr_list; + for (int j = 0; j < lb_list.size(); j++) + lb_repr_list.append(outputLBasRepr(ocg, lb_list[j], bound, + bound.set_var(level-1+privatized_levels.size()+i+1), + index_stride[i], stride_eq, Relation::True(bound.n_set()), + std::vector(bound.n_set()))); + + if (lb_repr_list.size() > 1) + index_lb[i] = ocg->CreateInvoke("max", lb_repr_list); + else if (lb_repr_list.size() == 1) + index_lb[i] = lb_repr_list[1]; + + // build temporary array size representation + { + Relation cal(copy_is.n_set(), 1); + F_And *f_root = cal.add_and(); + for (int j = 0; j < ub_list.size(); j++) + for (int k = 0; k < lb_list.size(); k++) { + GEQ_Handle h = f_root->add_GEQ(); + + for (Constr_Vars_Iter ci(ub_list[j]); ci; ci++) { + switch ((*ci).var->kind()) { + case Input_Var: + { + int pos = (*ci).var->get_position(); + h.update_coef(cal.input_var(pos), (*ci).coef); + break; + } + case Global_Var: + { + Global_Var_ID g = (*ci).var->get_global_var(); + Variable_ID v; + if (g->arity() == 0) + v = cal.get_local(g); + else + v = cal.get_local(g, (*ci).var->function_of()); + h.update_coef(v, (*ci).coef); + break; + } + default: + throw loop_error("cannot calculate temporay array size statically"); + } + } + h.update_const(ub_list[j].get_const()); + + for (Constr_Vars_Iter ci(lb_list[k]); ci; ci++) { + switch ((*ci).var->kind()) { + case Input_Var: + { + int pos = (*ci).var->get_position(); + h.update_coef(cal.input_var(pos), (*ci).coef); + break; + } + case Global_Var: + { + Global_Var_ID g = (*ci).var->get_global_var(); + Variable_ID v; + if (g->arity() == 0) + v = cal.get_local(g); + else + v = cal.get_local(g, (*ci).var->function_of()); + h.update_coef(v, (*ci).coef); + break; + } + default: + throw loop_error("cannot calculate temporay array size statically"); + } + } + h.update_const(lb_list[k].get_const()); + + h.update_const(1); + h.update_coef(cal.output_var(1), -1); + } + + cal = Restrict_Domain(cal, copy(copy_is)); + for (int j = 1; j <= cal.n_inp(); j++) + cal = Project(cal, j, Input_Var); + cal.simplify(); + + // pad temporary array size + // TODO: for variable array size, create padding formula + Conjunct *c = cal.query_DNF()->single_conjunct(); + bool is_index_bound_const = false; + for (GEQ_Iterator gi(c->GEQs()); gi && !is_index_bound_const; gi++) + if ((*gi).is_const(cal.output_var(1))) { + coef_t size = (*gi).get_const() / (-(*gi).get_coef(cal.output_var(1))); + if (padding_stride != 0) { + size = (size + index_stride[i] - 1) / index_stride[i]; + if (i == fastest_changing_dimension) + size = size * padding_stride; + } + if (i == fastest_changing_dimension) { + if (padding_alignment > 1) { // align to boundary for data packing + int residue = size % padding_alignment; + if (residue) + size = size+padding_alignment-residue; + } + else if (padding_alignment < -1) { // un-alignment for memory bank conflicts + while (gcd(size, static_cast(-padding_alignment)) != 1) + size++; + } + } + index_sz.push_back(std::make_pair(i, ocg->CreateInt(size))); + is_index_bound_const = true; + } + + if (!is_index_bound_const) { + for (GEQ_Iterator gi(c->GEQs()); gi && !is_index_bound_const; gi++) { + int coef = (*gi).get_coef(cal.output_var(1)); + if (coef < 0) { + CG_outputRepr *op = NULL; + for (Constr_Vars_Iter ci(*gi); ci; ci++) { + if ((*ci).var != cal.output_var(1)) { + switch((*ci).var->kind()) { + case Global_Var: + { + Global_Var_ID g = (*ci).var->get_global_var(); + if ((*ci).coef == 1) + op = ocg->CreatePlus(op, ocg->CreateIdent(g->base_name())); + else if ((*ci).coef == -1) + op = ocg->CreateMinus(op, ocg->CreateIdent(g->base_name())); + else if ((*ci).coef > 1) + op = ocg->CreatePlus(op, ocg->CreateTimes(ocg->CreateInt((*ci).coef), ocg->CreateIdent(g->base_name()))); + else // (*ci).coef < -1 + op = ocg->CreateMinus(op, ocg->CreateTimes(ocg->CreateInt(-(*ci).coef), ocg->CreateIdent(g->base_name()))); + break; + } + default: + throw loop_error("failed to generate array index bound code"); + } + } + } + int c = (*gi).get_const(); + if (c > 0) + op = ocg->CreatePlus(op, ocg->CreateInt(c)); + else if (c < 0) + op = ocg->CreateMinus(op, ocg->CreateInt(-c)); + if (padding_stride != 0) { + if (i == fastest_changing_dimension) { + coef_t g = gcd(index_stride[i], static_cast(padding_stride)); + coef_t t1 = index_stride[i] / g; + if (t1 != 1) + op = ocg->CreateIntegerDivide(ocg->CreatePlus(op, ocg->CreateInt(t1-1)), ocg->CreateInt(t1)); + coef_t t2 = padding_stride / g; + if (t2 != 1) + op = ocg->CreateTimes(op, ocg->CreateInt(t2)); + } + else if (index_stride[i] != 1) { + op = ocg->CreateIntegerDivide(ocg->CreatePlus(op, ocg->CreateInt(index_stride[i]-1)), ocg->CreateInt(index_stride[i])); + } + } + + index_sz.push_back(std::make_pair(i, op)); + break; + } + } + } + } + } + + // change the temporary array index order + for (int i = 0; i < index_sz.size(); i++) + if (index_sz[i].first == fastest_changing_dimension) + switch (sym->layout_type()) { + case IR_ARRAY_LAYOUT_ROW_MAJOR: + std::swap(index_sz[index_sz.size()-1], index_sz[i]); + break; + case IR_ARRAY_LAYOUT_COLUMN_MAJOR: + std::swap(index_sz[0], index_sz[i]); + break; + default: + throw loop_error("unsupported array layout"); + } + + // declare temporary array or scalar + IR_Symbol *tmp_sym; + if (index_sz.size() == 0) { + tmp_sym = ir->CreateScalarSymbol(sym, memory_type); + } + else { + std::vector tmp_array_size(index_sz.size()); + for (int i = 0; i < index_sz.size(); i++) + tmp_array_size[i] = index_sz[i].second->clone(); + tmp_sym = ir->CreateArraySymbol(sym, tmp_array_size, memory_type); + } + + // create temporary array read initialization code + CG_outputRepr *copy_code_read; + if (has_read_refs) + if (index_sz.size() == 0) { + IR_ScalarRef *tmp_scalar_ref = ir->CreateScalarRef(static_cast(tmp_sym)); + + std::vector rhs_index(n_dim); + for (int i = 0; i < index_lb.size(); i++) + if (is_index_eq[i]) + rhs_index[i] = index_lb[i]->clone(); + else + rhs_index[i] = ir->builder()->CreateIdent(copy_is.set_var(level-1+privatized_levels.size()+i+1)->name()); + IR_ArrayRef *copied_array_ref = ir->CreateArrayRef(sym, rhs_index); + + copy_code_read = ir->builder()->CreateAssignment(0, tmp_scalar_ref->convert(), copied_array_ref->convert()); + } + else { + std::vector lhs_index(index_sz.size()); + for (int i = 0; i < index_sz.size(); i++) { + int cur_index_num = index_sz[i].first; + CG_outputRepr *cur_index_repr = ocg->CreateMinus(ocg->CreateIdent(copy_is.set_var(level-1+privatized_levels.size()+cur_index_num+1)->name()), index_lb[cur_index_num]->clone()); + if (padding_stride != 0) { + if (i == n_dim-1) { + coef_t g = gcd(index_stride[cur_index_num], static_cast(padding_stride)); + coef_t t1 = index_stride[cur_index_num] / g; + if (t1 != 1) + cur_index_repr = ocg->CreateIntegerDivide(cur_index_repr, ocg->CreateInt(t1)); + coef_t t2 = padding_stride / g; + if (t2 != 1) + cur_index_repr = ocg->CreateTimes(cur_index_repr, ocg->CreateInt(t2)); + } + else if (index_stride[cur_index_num] != 1) { + cur_index_repr = ocg->CreateIntegerDivide(cur_index_repr, ocg->CreateInt(index_stride[cur_index_num])); + } + } + + if (ir->ArrayIndexStartAt() != 0) + cur_index_repr = ocg->CreatePlus(cur_index_repr, ocg->CreateInt(ir->ArrayIndexStartAt())); + lhs_index[i] = cur_index_repr; + } + + IR_ArrayRef *tmp_array_ref = ir->CreateArrayRef(static_cast(tmp_sym), lhs_index); + + std::vector rhs_index(n_dim); + for (int i = 0; i < index_lb.size(); i++) + if (is_index_eq[i]) + rhs_index[i] = index_lb[i]->clone(); + else + rhs_index[i] = ir->builder()->CreateIdent(copy_is.set_var(level-1+privatized_levels.size()+i+1)->name()); + IR_ArrayRef *copied_array_ref = ir->CreateArrayRef(sym, rhs_index); + + copy_code_read = ir->builder()->CreateAssignment(0, tmp_array_ref->convert(), copied_array_ref->convert()); + } + + // create temporary array write back code + CG_outputRepr *copy_code_write; + if (has_write_refs) + if (index_sz.size() == 0) { + IR_ScalarRef *tmp_scalar_ref = ir->CreateScalarRef(static_cast(tmp_sym)); + + std::vector rhs_index(n_dim); + for (int i = 0; i < index_lb.size(); i++) + if (is_index_eq[i]) + rhs_index[i] = index_lb[i]->clone(); + else + rhs_index[i] = ir->builder()->CreateIdent(copy_is.set_var(level-1+privatized_levels.size()+i+1)->name()); + IR_ArrayRef *copied_array_ref = ir->CreateArrayRef(sym, rhs_index); + + copy_code_write = ir->builder()->CreateAssignment(0, copied_array_ref->convert(), tmp_scalar_ref->convert()); + } + else { + std::vector lhs_index(n_dim); + for (int i = 0; i < index_lb.size(); i++) + if (is_index_eq[i]) + lhs_index[i] = index_lb[i]->clone(); + else + lhs_index[i] = ir->builder()->CreateIdent(copy_is.set_var(level-1+privatized_levels.size()+i+1)->name()); + IR_ArrayRef *copied_array_ref = ir->CreateArrayRef(sym, lhs_index); + + std::vector rhs_index(index_sz.size()); + for (int i = 0; i < index_sz.size(); i++) { + int cur_index_num = index_sz[i].first; + CG_outputRepr *cur_index_repr = ocg->CreateMinus(ocg->CreateIdent(copy_is.set_var(level-1+privatized_levels.size()+cur_index_num+1)->name()), index_lb[cur_index_num]->clone()); + if (padding_stride != 0) { + if (i == n_dim-1) { + coef_t g = gcd(index_stride[cur_index_num], static_cast(padding_stride)); + coef_t t1 = index_stride[cur_index_num] / g; + if (t1 != 1) + cur_index_repr = ocg->CreateIntegerDivide(cur_index_repr, ocg->CreateInt(t1)); + coef_t t2 = padding_stride / g; + if (t2 != 1) + cur_index_repr = ocg->CreateTimes(cur_index_repr, ocg->CreateInt(t2)); + } + else if (index_stride[cur_index_num] != 1) { + cur_index_repr = ocg->CreateIntegerDivide(cur_index_repr, ocg->CreateInt(index_stride[cur_index_num])); + } + } + + if (ir->ArrayIndexStartAt() != 0) + cur_index_repr = ocg->CreatePlus(cur_index_repr, ocg->CreateInt(ir->ArrayIndexStartAt())); + rhs_index[i] = cur_index_repr; + } + IR_ArrayRef *tmp_array_ref = ir->CreateArrayRef(static_cast(tmp_sym), rhs_index); + + copy_code_write = ir->builder()->CreateAssignment(0, copied_array_ref->convert(), tmp_array_ref->convert()); + } + + // now we can remove those loops for array indexes that are + // dependent on others + if (!(index_sz.size() == n_dim && (sym->layout_type() == IR_ARRAY_LAYOUT_ROW_MAJOR || n_dim <= 1))) { + Relation mapping(level-1+privatized_levels.size()+n_dim, level-1+privatized_levels.size()+index_sz.size()); + F_And *f_root = mapping.add_and(); + for (int i = 1; i <= level-1+privatized_levels.size(); i++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.input_var(i), 1); + h.update_coef(mapping.output_var(i), -1); + } + + int cur_index = 0; + std::vector mapped_index(index_sz.size()); + for (int i = 0; i < n_dim; i++) + if (!is_index_eq[i]) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.input_var(level-1+privatized_levels.size()+i+1), 1); + switch (sym->layout_type()) { + case IR_ARRAY_LAYOUT_COLUMN_MAJOR: { + h.update_coef(mapping.output_var(level-1+privatized_levels.size()+index_sz.size()-cur_index), -1); + mapped_index[index_sz.size()-cur_index-1] = i; + break; + } + case IR_ARRAY_LAYOUT_ROW_MAJOR: { + h.update_coef(mapping.output_var(level-1+privatized_levels.size()+cur_index+1), -1); + mapped_index[cur_index] = i; + break; + } + default: + throw loop_error("unsupported array layout"); + } + cur_index++; + } + + wo_copy_is = Range(Restrict_Domain(copy(mapping), wo_copy_is)); + ro_copy_is = Range(Restrict_Domain(copy(mapping), ro_copy_is)); + + // protonu--replacing Chun's old code + for (int i = 1; i <= level-1+privatized_levels.size(); i++) { + wo_copy_is.name_set_var(i, copy_is.set_var(i)->name()); + ro_copy_is.name_set_var(i, copy_is.set_var(i)->name()); + } + + + + for (int i = 0; i < index_sz.size(); i++) { + wo_copy_is.name_set_var(level-1+privatized_levels.size()+i+1, copy_is.set_var(level-1+privatized_levels.size()+mapped_index[i]+1)->name()); + ro_copy_is.name_set_var(level-1+privatized_levels.size()+i+1, copy_is.set_var(level-1+privatized_levels.size()+mapped_index[i]+1)->name()); + } + wo_copy_is.setup_names(); + ro_copy_is.setup_names(); + } + + // insert read copy statement + int old_num_stmt = stmt.size(); + int ro_copy_stmt_num = -1; + if (has_read_refs) { + Relation copy_xform(ro_copy_is.n_set(), 2*ro_copy_is.n_set()+1); + { + F_And *f_root = copy_xform.add_and(); + for (int i = 1; i <= ro_copy_is.n_set(); i++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(copy_xform.input_var(i), 1); + h.update_coef(copy_xform.output_var(2*i), -1); + } + for (int i = 1; i <= dim; i+=2) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(copy_xform.output_var(i), -1); + h.update_const(lex[i-1]); + } + for (int i = dim+2; i <= copy_xform.n_out(); i+=2) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(copy_xform.output_var(i), 1); + } + } + + Statement copy_stmt_read; + copy_stmt_read.IS = ro_copy_is; + copy_stmt_read.xform = copy_xform; + copy_stmt_read.code = copy_code_read; + copy_stmt_read.loop_level = std::vector(ro_copy_is.n_set()); + copy_stmt_read.ir_stmt_node = NULL; + for (int i = 0; i < level-1; i++) { + copy_stmt_read.loop_level[i].type = stmt[*(active.begin())].loop_level[i].type; + if (stmt[*(active.begin())].loop_level[i].type == LoopLevelTile && + stmt[*(active.begin())].loop_level[i].payload >= level) { + int j; + for (j = 0; j < privatized_levels.size(); j++) + if (privatized_levels[j] == stmt[*(active.begin())].loop_level[i].payload) + break; + if (j == privatized_levels.size()) + copy_stmt_read.loop_level[i].payload = -1; + else + copy_stmt_read.loop_level[i].payload = level + j; + } + else + copy_stmt_read.loop_level[i].payload = stmt[*(active.begin())].loop_level[i].payload; + copy_stmt_read.loop_level[i].parallel_level = stmt[*(active.begin())].loop_level[i].parallel_level; + } + for (int i = 0; i < privatized_levels.size(); i++) { + copy_stmt_read.loop_level[level-1+i].type = stmt[*(active.begin())].loop_level[privatized_levels[i]].type; + copy_stmt_read.loop_level[level-1+i].payload = stmt[*(active.begin())].loop_level[privatized_levels[i]].payload; + copy_stmt_read.loop_level[level-1+i].parallel_level = stmt[*(active.begin())].loop_level[privatized_levels[i]].parallel_level; + } + int left_num_dim = num_dep_dim - (get_last_dep_dim_before(*(active.begin()), level) + 1); + for (int i = 0; i < min(left_num_dim, static_cast(index_sz.size())); i++) { + copy_stmt_read.loop_level[level-1+privatized_levels.size()+i].type = LoopLevelOriginal; + copy_stmt_read.loop_level[level-1+privatized_levels.size()+i].payload = num_dep_dim-left_num_dim+i; + copy_stmt_read.loop_level[level-1+privatized_levels.size()+i].parallel_level = 0; + } + for (int i = min(left_num_dim, static_cast(index_sz.size())); i < index_sz.size(); i++) { + copy_stmt_read.loop_level[level-1+privatized_levels.size()+i].type = LoopLevelUnknown; + copy_stmt_read.loop_level[level-1+privatized_levels.size()+i].payload = -1; + copy_stmt_read.loop_level[level-1+privatized_levels.size()+i].parallel_level = 0; + } + + shiftLexicalOrder(lex, dim-1, 1); + stmt.push_back(copy_stmt_read); + ro_copy_stmt_num = stmt.size() - 1; + dep.insert(); + } + + // insert write copy statement + int wo_copy_stmt_num = -1; + if (has_write_refs) { + Relation copy_xform(wo_copy_is.n_set(), 2*wo_copy_is.n_set()+1); + { + F_And *f_root = copy_xform.add_and(); + for (int i = 1; i <= wo_copy_is.n_set(); i++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(copy_xform.input_var(i), 1); + h.update_coef(copy_xform.output_var(2*i), -1); + } + for (int i = 1; i <= dim; i+=2) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(copy_xform.output_var(i), -1); + h.update_const(lex[i-1]); + } + for (int i = dim+2; i <= copy_xform.n_out(); i+=2) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(copy_xform.output_var(i), 1); + } + } + + Statement copy_stmt_write; + copy_stmt_write.IS = wo_copy_is; + copy_stmt_write.xform = copy_xform; + copy_stmt_write.code = copy_code_write; + copy_stmt_write.loop_level = std::vector(wo_copy_is.n_set()); + copy_stmt_write.ir_stmt_node = NULL; + + for (int i = 0; i < level-1; i++) { + copy_stmt_write.loop_level[i].type = stmt[*(active.begin())].loop_level[i].type; + if (stmt[*(active.begin())].loop_level[i].type == LoopLevelTile && + stmt[*(active.begin())].loop_level[i].payload >= level) { + int j; + for (j = 0; j < privatized_levels.size(); j++) + if (privatized_levels[j] == stmt[*(active.begin())].loop_level[i].payload) + break; + if (j == privatized_levels.size()) + copy_stmt_write.loop_level[i].payload = -1; + else + copy_stmt_write.loop_level[i].payload = level + j; + } + else + copy_stmt_write.loop_level[i].payload = stmt[*(active.begin())].loop_level[i].payload; + copy_stmt_write.loop_level[i].parallel_level = stmt[*(active.begin())].loop_level[i].parallel_level; + } + for (int i = 0; i < privatized_levels.size(); i++) { + copy_stmt_write.loop_level[level-1+i].type = stmt[*(active.begin())].loop_level[privatized_levels[i]].type; + copy_stmt_write.loop_level[level-1+i].payload = stmt[*(active.begin())].loop_level[privatized_levels[i]].payload; + copy_stmt_write.loop_level[level-1+i].parallel_level = stmt[*(active.begin())].loop_level[privatized_levels[i]].parallel_level; + } + int left_num_dim = num_dep_dim - (get_last_dep_dim_before(*(active.begin()), level) + 1); + for (int i = 0; i < min(left_num_dim, static_cast(index_sz.size())); i++) { + copy_stmt_write.loop_level[level-1+privatized_levels.size()+i].type = LoopLevelOriginal; + copy_stmt_write.loop_level[level-1+privatized_levels.size()+i].payload = num_dep_dim-left_num_dim+i; + copy_stmt_write.loop_level[level-1+privatized_levels.size()+i].parallel_level = 0; + } + for (int i = min(left_num_dim, static_cast(index_sz.size())); i < index_sz.size(); i++) { + copy_stmt_write.loop_level[level-1+privatized_levels.size()+i].type = LoopLevelUnknown; + copy_stmt_write.loop_level[level-1+privatized_levels.size()+i].payload = -1; + copy_stmt_write.loop_level[level-1+privatized_levels.size()+i].parallel_level = 0; + } + + lex[dim-1]++; + shiftLexicalOrder(lex, dim-1, -2); + stmt.push_back(copy_stmt_write); + wo_copy_stmt_num = stmt.size() - 1; + dep.insert(); + } + + // replace original array accesses with temporary array accesses + for (int i =0; i < stmt_refs.size(); i++) + for (int j = 0; j < stmt_refs[i].second.size(); j++) { + if (index_sz.size() == 0) { + IR_ScalarRef *tmp_scalar_ref = ir->CreateScalarRef(static_cast(tmp_sym)); + ir->ReplaceExpression(stmt_refs[i].second[j], tmp_scalar_ref->convert()); + } + else { + std::vector index_repr(index_sz.size()); + for (int k = 0; k < index_sz.size(); k++) { + int cur_index_num = index_sz[k].first; + + CG_outputRepr *cur_index_repr = ocg->CreateMinus(stmt_refs[i].second[j]->index(cur_index_num), index_lb[cur_index_num]->clone()); + if (padding_stride != 0) { + if (k == n_dim-1) { + coef_t g = gcd(index_stride[cur_index_num], static_cast(padding_stride)); + coef_t t1 = index_stride[cur_index_num] / g; + if (t1 != 1) + cur_index_repr = ocg->CreateIntegerDivide(cur_index_repr, ocg->CreateInt(t1)); + coef_t t2 = padding_stride / g; + if (t2 != 1) + cur_index_repr = ocg->CreateTimes(cur_index_repr, ocg->CreateInt(t2)); + } + else if (index_stride[cur_index_num] != 1) { + cur_index_repr = ocg->CreateIntegerDivide(cur_index_repr, ocg->CreateInt(index_stride[cur_index_num])); + } + } + + if (ir->ArrayIndexStartAt() != 0) + cur_index_repr = ocg->CreatePlus(cur_index_repr, ocg->CreateInt(ir->ArrayIndexStartAt())); + index_repr[k] = cur_index_repr; + } + + IR_ArrayRef *tmp_array_ref = ir->CreateArrayRef(static_cast(tmp_sym), index_repr); + ir->ReplaceExpression(stmt_refs[i].second[j], tmp_array_ref->convert()); + } + } + + // update dependence graph + int dep_dim = get_last_dep_dim_before(*(active.begin()), level) + 1; + if (ro_copy_stmt_num != -1) { + for (int i = 0; i < old_num_stmt; i++) { + std::vector > D; + + for (DependenceGraph::EdgeList::iterator j = dep.vertex[i].second.begin(); j != dep.vertex[i].second.end();) { + if (active.find(i) != active.end() && active.find(j->first) == active.end()) { + std::vector dvs1, dvs2; + for (int k = 0; k < j->second.size(); k++) { + DependenceVector dv = j->second[k]; + if (dv.sym != NULL && dv.sym->name() == sym->name() && (dv.type == DEP_R2R || dv.type == DEP_R2W)) + dvs1.push_back(dv); + else + dvs2.push_back(dv); + } + j->second = dvs2; + if (dvs1.size() > 0) + dep.connect(ro_copy_stmt_num, j->first, dvs1); + } + else if (active.find(i) == active.end() && active.find(j->first) != active.end()) { + std::vector dvs1, dvs2; + for (int k = 0; k < j->second.size(); k++) { + DependenceVector dv = j->second[k]; + if (dv.sym != NULL && dv.sym->name() == sym->name() && (dv.type == DEP_R2R || dv.type == DEP_W2R)) + dvs1.push_back(dv); + else + dvs2.push_back(dv); + } + j->second = dvs2; + if (dvs1.size() > 0) + D.push_back(dvs1); + } + + if (j->second.size() == 0) + dep.vertex[i].second.erase(j++); + else + j++; + } + + for (int j = 0; j < D.size(); j++) + dep.connect(i, ro_copy_stmt_num, D[j]); + } + + // insert dependences from copy statement loop to copied statements + DependenceVector dv; + dv.type = DEP_W2R; + dv.sym = tmp_sym->clone(); + dv.lbounds = std::vector(num_dep_dim, 0); + dv.ubounds = std::vector(num_dep_dim, 0); + for (int i = dep_dim; i < num_dep_dim; i++) { + dv.lbounds[i] = -posInfinity; + dv.ubounds[i] = posInfinity; + } + for (std::set::iterator i = active.begin(); i != active.end(); i++) + dep.connect(ro_copy_stmt_num, *i, dv); + } + + if (wo_copy_stmt_num != -1) { + for (int i = 0; i < old_num_stmt; i++) { + std::vector > D; + + for (DependenceGraph::EdgeList::iterator j = dep.vertex[i].second.begin(); j != dep.vertex[i].second.end();) { + if (active.find(i) != active.end() && active.find(j->first) == active.end()) { + std::vector dvs1, dvs2; + for (int k = 0; k < j->second.size(); k++) { + DependenceVector dv = j->second[k]; + if (dv.sym != NULL && dv.sym->name() == sym->name() && (dv.type == DEP_W2R || dv.type == DEP_W2W)) + dvs1.push_back(dv); + else + dvs2.push_back(dv); + } + j->second = dvs2; + if (dvs1.size() > 0) + dep.connect(wo_copy_stmt_num, j->first, dvs1); + } + else if (active.find(i) == active.end() && active.find(j->first) != active.end()) { + std::vector dvs1, dvs2; + for (int k = 0; k < j->second.size(); k++) { + DependenceVector dv = j->second[k]; + if (dv.sym != NULL && dv.sym->name() == sym->name() && (dv.type == DEP_R2W || dv.type == DEP_W2W)) + dvs1.push_back(dv); + else + dvs2.push_back(dv); + } + j->second = dvs2; + if (dvs1.size() > 0) + D.push_back(dvs1); + } + + if (j->second.size() == 0) + dep.vertex[i].second.erase(j++); + else + j++; + } + + for (int j = 0; j < D.size(); j++) + dep.connect(i, wo_copy_stmt_num, D[j]); + } + + // insert dependences from copied statements to write statements + DependenceVector dv; + dv.type = DEP_W2R; + dv.sym = tmp_sym->clone(); + dv.lbounds = std::vector(num_dep_dim, 0); + dv.ubounds = std::vector(num_dep_dim, 0); + for (int i = dep_dim; i < num_dep_dim; i++) { + dv.lbounds[i] = -posInfinity; + dv.ubounds[i] = posInfinity; + } + for (std::set::iterator i = active.begin(); i != active.end(); i++) + dep.connect(*i, wo_copy_stmt_num, dv); + + } + + // update variable name for dependences among copied statements + for (int i = 0; i < old_num_stmt; i++) { + if (active.find(i) != active.end()) + for (DependenceGraph::EdgeList::iterator j = dep.vertex[i].second.begin(); j != dep.vertex[i].second.end(); j++) + if (active.find(j->first) != active.end()) + for (int k = 0; k < j->second.size(); k++) { + IR_Symbol *s = tmp_sym->clone(); + j->second[k].sym = s; + } + } + + // insert anti-dependence from write statement to read statement + if (ro_copy_stmt_num != -1 && wo_copy_stmt_num != -1) + if (dep_dim >= 0) { + DependenceVector dv; + dv.type = DEP_R2W; + dv.sym = tmp_sym->clone(); + dv.lbounds = std::vector(num_dep_dim, 0); + dv.ubounds = std::vector(num_dep_dim, 0); + for (int k = dep_dim; k < num_dep_dim; k++) { + dv.lbounds[k] = -posInfinity; + dv.ubounds[k] = posInfinity; + } + for (int k = 0; k < dep_dim; k++) { + if (k != 0) { + dv.lbounds[k-1] = 0; + dv.ubounds[k-1] = 0; + } + dv.lbounds[k] = 1; + dv.ubounds[k] = posInfinity; + dep.connect(wo_copy_stmt_num, ro_copy_stmt_num, dv); + } + } + + + // cleanup + delete sym; + delete tmp_sym; + for (int i = 0; i < index_lb.size(); i++) { + index_lb[i]->clear(); + delete index_lb[i]; + } + for (int i = 0; i < index_sz.size(); i++) { + index_sz[i].second->clear(); + delete index_sz[i].second; + } + + return true; + } +*/ +bool Loop::datacopy_privatized(const std::vector > > &stmt_refs, int level, + const std::vector &privatized_levels, + bool allow_extra_read, int fastest_changing_dimension, + int padding_stride, int padding_alignment, int memory_type) { + if (stmt_refs.size() == 0) + return true; + + // check for sanity of parameters + IR_ArraySymbol *sym = NULL; + std::vector lex; + std::set active; + if (level <= 0) + throw std::invalid_argument("invalid loop level " + to_string(level)); + for (int i = 0; i < privatized_levels.size(); i++) { + if (i == 0) { + if (privatized_levels[i] < level) + throw std::invalid_argument("privatized loop levels must be no less than level " + to_string(level)); + } + else if (privatized_levels[i] <= privatized_levels[i-1]) + throw std::invalid_argument("privatized loop levels must be in ascending order"); + } + for (int i = 0; i < stmt_refs.size(); i++) { + int stmt_num = stmt_refs[i].first; + active.insert(stmt_num); + if (stmt_num < 0 || stmt_num >= stmt.size()) + throw std::invalid_argument("invalid statement number " + to_string(stmt_num)); + if (privatized_levels.size() != 0) { + if (privatized_levels[privatized_levels.size()-1] > stmt[stmt_num].loop_level.size()) + throw std::invalid_argument("invalid loop level " + to_string(privatized_levels[privatized_levels.size()-1]) + " for statement " + to_string(stmt_num)); + } + else { + if (level > stmt[stmt_num].loop_level.size()) + throw std::invalid_argument("invalid loop level " + to_string(level) + " for statement " + to_string(stmt_num)); + } + for (int j = 0; j < stmt_refs[i].second.size(); j++) { + if (sym == NULL) { + sym = stmt_refs[i].second[j]->symbol(); + lex = getLexicalOrder(stmt_num); + } + else { + IR_ArraySymbol *t = stmt_refs[i].second[j]->symbol(); + if (t->name() != sym->name()) { + delete t; + delete sym; + throw std::invalid_argument("try to copy data from different arrays"); + } + delete t; + } + } + } + if (!(fastest_changing_dimension >= -1 && fastest_changing_dimension < sym->n_dim())) + throw std::invalid_argument("invalid fastest changing dimension for the array to be copied"); + if (padding_stride < 0) + throw std::invalid_argument("invalid temporary array stride requirement"); + if (padding_alignment == -1 || padding_alignment == 0) + throw std::invalid_argument("invalid temporary array alignment requirement"); + + int dim = 2*level - 1; + int n_dim = sym->n_dim(); + + + if (fastest_changing_dimension == -1) + switch (sym->layout_type()) { + case IR_ARRAY_LAYOUT_ROW_MAJOR: + fastest_changing_dimension = n_dim - 1; + break; + case IR_ARRAY_LAYOUT_COLUMN_MAJOR: + fastest_changing_dimension = 0; + break; + default: + throw loop_error("unsupported array layout"); + } + + + // invalidate saved codegen computation + delete last_compute_cgr_; + last_compute_cgr_ = NULL; + delete last_compute_cg_; + last_compute_cg_ = NULL; + + // build iteration spaces for all reads and for all writes separately + apply_xform(active); + + bool has_write_refs = false; + bool has_read_refs = false; + Relation wo_copy_is = Relation::False(level-1+privatized_levels.size()+n_dim); + Relation ro_copy_is = Relation::False(level-1+privatized_levels.size()+n_dim); + for (int i = 0; i < stmt_refs.size(); i++) { + int stmt_num = stmt_refs[i].first; + + for (int j = 0; j < stmt_refs[i].second.size(); j++) { + Relation mapping(stmt[stmt_num].IS.n_set(), level-1+privatized_levels.size()+n_dim); + for (int k = 1; k <= mapping.n_inp(); k++) + mapping.name_input_var(k, stmt[stmt_num].IS.set_var(k)->name()); + mapping.setup_names(); + F_And *f_root = mapping.add_and(); + for (int k = 1; k <= level-1; k++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.input_var(k), 1); + h.update_coef(mapping.output_var(k), -1); + } + for (int k = 0; k < privatized_levels.size(); k++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.input_var(privatized_levels[k]), 1); + h.update_coef(mapping.output_var(level+k), -1); + } + for (int k = 0; k < n_dim; k++) { + CG_outputRepr *repr = stmt_refs[i].second[j]->index(k); + exp2formula(ir, mapping, f_root, freevar, repr, mapping.output_var(level-1+privatized_levels.size()+k+1), 'w', IR_COND_EQ, false); + repr->clear(); + delete repr; + } + Relation r = Range(Restrict_Domain(mapping, Intersection(copy(stmt[stmt_num].IS), Extend_Set(copy(this->known), stmt[stmt_num].IS.n_set() - this->known.n_set())))); + if (stmt_refs[i].second[j]->is_write()) { + has_write_refs = true; + wo_copy_is = Union(wo_copy_is, r); + wo_copy_is.simplify(2, 4); + + + } + else { + has_read_refs = true; + ro_copy_is = Union(ro_copy_is, r); + ro_copy_is.simplify(2, 4); + + } + } + } + + // simplify read and write footprint iteration space + { + if (allow_extra_read) + ro_copy_is = SimpleHull(ro_copy_is, true, true); + else + ro_copy_is = ConvexRepresentation(ro_copy_is); + + wo_copy_is = ConvexRepresentation(wo_copy_is); + if (wo_copy_is.number_of_conjuncts() > 1) { + Relation t = SimpleHull(wo_copy_is, true, true); + if (Must_Be_Subset(copy(t), copy(ro_copy_is))) + wo_copy_is = t; + else if (Must_Be_Subset(copy(wo_copy_is), copy(ro_copy_is))) + wo_copy_is = ro_copy_is; + } + } + + // make copy statement variable names match the ones in the original statements which + // already have the same names due to apply_xform + { + int ref_stmt = *active.begin(); + for (std::set::iterator i = active.begin(); i != active.end(); i++) + if (stmt[*i].IS.n_set() > stmt[ref_stmt].IS.n_set()) + ref_stmt = *i; + for (int i = 1; i < level; i++) { + std::string s = stmt[ref_stmt].IS.input_var(i)->name(); + wo_copy_is.name_set_var(i, s); + ro_copy_is.name_set_var(i, s); + } + for (int i = 0; i < privatized_levels.size(); i++) { + std::string s = stmt[ref_stmt].IS.input_var(privatized_levels[i])->name(); + wo_copy_is.name_set_var(level+i, s); + ro_copy_is.name_set_var(level+i, s); + } + for (int i = level+privatized_levels.size(); i < level+privatized_levels.size()+n_dim; i++) { + std::string s = tmp_loop_var_name_prefix + to_string(tmp_loop_var_name_counter+i-level-privatized_levels.size()); + wo_copy_is.name_set_var(i, s); + ro_copy_is.name_set_var(i, s); + } + tmp_loop_var_name_counter += n_dim; + wo_copy_is.setup_names(); + ro_copy_is.setup_names(); + } + + // build merged footprint iteration space for calculating temporary array size + Relation copy_is = SimpleHull(Union(copy(ro_copy_is), copy(wo_copy_is)), true, true); + + // extract temporary array information + CG_outputBuilder *ocg = ir->builder(); + std::vector index_lb(n_dim); // initialized to NULL + std::vector index_stride(n_dim); + std::vector is_index_eq(n_dim, false); + std::vector > index_sz(0); + Relation reduced_copy_is = copy(copy_is); + + for (int i = 0; i < n_dim; i++) { + if (i != 0) + reduced_copy_is = Project(reduced_copy_is, level-1+privatized_levels.size()+i, Set_Var); + Relation bound = get_loop_bound(reduced_copy_is, level-1+privatized_levels.size()+i); + + // extract stride + std::pair result = find_simplest_stride(bound, bound.set_var(level-1+privatized_levels.size()+i+1)); + if (result.second != NULL) + index_stride[i] = abs(result.first.get_coef(result.second))/gcd(abs(result.first.get_coef(result.second)), abs(result.first.get_coef(bound.set_var(level-1+privatized_levels.size()+i+1)))); + else + index_stride[i] = 1; + + // check if this arary index requires loop + Conjunct *c = bound.query_DNF()->single_conjunct(); + for (EQ_Iterator ei(c->EQs()); ei; ei++) { + if ((*ei).has_wildcards()) + continue; + + int coef = (*ei).get_coef(bound.set_var(level-1+privatized_levels.size()+i+1)); + if (coef != 0) { + int sign = 1; + if (coef < 0) { + coef = -coef; + sign = -1; + } + + CG_outputRepr *op = NULL; + for (Constr_Vars_Iter ci(*ei); ci; ci++) { + switch ((*ci).var->kind()) { + case Input_Var: + { + if ((*ci).var != bound.set_var(level-1+privatized_levels.size()+i+1)) + if ((*ci).coef*sign == 1) + op = ocg->CreateMinus(op, ocg->CreateIdent((*ci).var->name())); + else if ((*ci).coef*sign == -1) + op = ocg->CreatePlus(op, ocg->CreateIdent((*ci).var->name())); + else if ((*ci).coef*sign > 1) + op = ocg->CreateMinus(op, ocg->CreateTimes(ocg->CreateInt(abs((*ci).coef)), ocg->CreateIdent((*ci).var->name()))); + else // (*ci).coef*sign < -1 + op = ocg->CreatePlus(op, ocg->CreateTimes(ocg->CreateInt(abs((*ci).coef)), ocg->CreateIdent((*ci).var->name()))); + break; + } + case Global_Var: + { + Global_Var_ID g = (*ci).var->get_global_var(); + if ((*ci).coef*sign == 1) + op = ocg->CreateMinus(op, ocg->CreateIdent(g->base_name())); + else if ((*ci).coef*sign == -1) + op = ocg->CreatePlus(op, ocg->CreateIdent(g->base_name())); + else if ((*ci).coef*sign > 1) + op = ocg->CreateMinus(op, ocg->CreateTimes(ocg->CreateInt(abs((*ci).coef)), ocg->CreateIdent(g->base_name()))); + else // (*ci).coef*sign < -1 + op = ocg->CreatePlus(op, ocg->CreateTimes(ocg->CreateInt(abs((*ci).coef)), ocg->CreateIdent(g->base_name()))); + break; + } + default: + throw loop_error("unsupported array index expression"); + } + } + if ((*ei).get_const() != 0) + op = ocg->CreatePlus(op, ocg->CreateInt(-sign*((*ei).get_const()))); + if (coef != 1) + op = ocg->CreateIntegerFloor(op, ocg->CreateInt(coef)); + + index_lb[i] = op; + is_index_eq[i] = true; + break; + } + } + if (is_index_eq[i]) + continue; + + // seperate lower and upper bounds + std::vector lb_list, ub_list; + std::set excluded_floor_vars; + excluded_floor_vars.insert(bound.set_var(level-1+privatized_levels.size()+i+1)); + for (GEQ_Iterator gi(c->GEQs()); gi; gi++) { + int coef = (*gi).get_coef(bound.set_var(level-1+privatized_levels.size()+i+1)); + if (coef != 0 && (*gi).has_wildcards()) { + bool clean_bound = true; + GEQ_Handle h; + for (Constr_Vars_Iter cvi(*gi, true); gi; gi++) + if (!find_floor_definition(bound, (*cvi).var, excluded_floor_vars).first) { + clean_bound = false; + break; + } + if (!clean_bound) + continue; + } + + if (coef > 0) + lb_list.push_back(*gi); + else if (coef < 0) + ub_list.push_back(*gi); + } + if (lb_list.size() == 0 || ub_list.size() == 0) + throw loop_error("failed to calcuate array footprint size"); + + // build lower bound representation + std::vector lb_repr_list; + for (int j = 0; j < lb_list.size(); j++){ + if(this->known.n_set() == 0) + lb_repr_list.push_back(output_lower_bound_repr(ocg, lb_list[j], bound.set_var(level-1+privatized_levels.size()+i+1), result.first, result.second, bound, Relation::True(bound.n_set()), std::vector >(bound.n_set(), std::make_pair(static_cast(NULL), 0)))); + else + lb_repr_list.push_back(output_lower_bound_repr(ocg, lb_list[j], bound.set_var(level-1+privatized_levels.size()+i+1), result.first, result.second, bound, this->known, std::vector >(bound.n_set(), std::make_pair(static_cast(NULL), 0)))); + } + if (lb_repr_list.size() > 1) + index_lb[i] = ocg->CreateInvoke("max", lb_repr_list); + else if (lb_repr_list.size() == 1) + index_lb[i] = lb_repr_list[0]; + + // build temporary array size representation + { + Relation cal(copy_is.n_set(), 1); + F_And *f_root = cal.add_and(); + for (int j = 0; j < ub_list.size(); j++) + for (int k = 0; k < lb_list.size(); k++) { + GEQ_Handle h = f_root->add_GEQ(); + + for (Constr_Vars_Iter ci(ub_list[j]); ci; ci++) { + switch ((*ci).var->kind()) { + case Input_Var: + { + int pos = (*ci).var->get_position(); + h.update_coef(cal.input_var(pos), (*ci).coef); + break; + } + case Global_Var: + { + Global_Var_ID g = (*ci).var->get_global_var(); + Variable_ID v; + if (g->arity() == 0) + v = cal.get_local(g); + else + v = cal.get_local(g, (*ci).var->function_of()); + h.update_coef(v, (*ci).coef); + break; + } + default: + throw loop_error("cannot calculate temporay array size statically"); + } + } + h.update_const(ub_list[j].get_const()); + + for (Constr_Vars_Iter ci(lb_list[k]); ci; ci++) { + switch ((*ci).var->kind()) { + case Input_Var: + { + int pos = (*ci).var->get_position(); + h.update_coef(cal.input_var(pos), (*ci).coef); + break; + } + case Global_Var: + { + Global_Var_ID g = (*ci).var->get_global_var(); + Variable_ID v; + if (g->arity() == 0) + v = cal.get_local(g); + else + v = cal.get_local(g, (*ci).var->function_of()); + h.update_coef(v, (*ci).coef); + break; + } + default: + throw loop_error("cannot calculate temporay array size statically"); + } + } + h.update_const(lb_list[k].get_const()); + + h.update_const(1); + h.update_coef(cal.output_var(1), -1); + } + + cal = Restrict_Domain(cal, copy(copy_is)); + for (int j = 1; j <= cal.n_inp(); j++) + cal = Project(cal, j, Input_Var); + cal.simplify(); + + // pad temporary array size + // TODO: for variable array size, create padding formula + Conjunct *c = cal.query_DNF()->single_conjunct(); + bool is_index_bound_const = false; + for (GEQ_Iterator gi(c->GEQs()); gi && !is_index_bound_const; gi++) + if ((*gi).is_const(cal.output_var(1))) { + coef_t size = (*gi).get_const() / (-(*gi).get_coef(cal.output_var(1))); + if (padding_stride != 0) { + size = (size + index_stride[i] - 1) / index_stride[i]; + if (i == fastest_changing_dimension) + size = size * padding_stride; + } + if (i == fastest_changing_dimension) { + if (padding_alignment > 1) { // align to boundary for data packing + int residue = size % padding_alignment; + if (residue) + size = size+padding_alignment-residue; + } + else if (padding_alignment < -1) { // un-alignment for memory bank conflicts + while (gcd(size, static_cast(-padding_alignment)) != 1) + size++; + } + } + index_sz.push_back(std::make_pair(i, ocg->CreateInt(size))); + is_index_bound_const = true; + } + + if (!is_index_bound_const) { + for (GEQ_Iterator gi(c->GEQs()); gi && !is_index_bound_const; gi++) { + int coef = (*gi).get_coef(cal.output_var(1)); + if (coef < 0) { + CG_outputRepr *op = NULL; + for (Constr_Vars_Iter ci(*gi); ci; ci++) { + if ((*ci).var != cal.output_var(1)) { + switch((*ci).var->kind()) { + case Global_Var: + { + Global_Var_ID g = (*ci).var->get_global_var(); + if ((*ci).coef == 1) + op = ocg->CreatePlus(op, ocg->CreateIdent(g->base_name())); + else if ((*ci).coef == -1) + op = ocg->CreateMinus(op, ocg->CreateIdent(g->base_name())); + else if ((*ci).coef > 1) + op = ocg->CreatePlus(op, ocg->CreateTimes(ocg->CreateInt((*ci).coef), ocg->CreateIdent(g->base_name()))); + else // (*ci).coef < -1 + op = ocg->CreateMinus(op, ocg->CreateTimes(ocg->CreateInt(-(*ci).coef), ocg->CreateIdent(g->base_name()))); + break; + } + default: + throw loop_error("failed to generate array index bound code"); + } + } + } + int c = (*gi).get_const(); + if (c > 0) + op = ocg->CreatePlus(op, ocg->CreateInt(c)); + else if (c < 0) + op = ocg->CreateMinus(op, ocg->CreateInt(-c)); + if (padding_stride != 0) { + if (i == fastest_changing_dimension) { + coef_t g = gcd(index_stride[i], static_cast(padding_stride)); + coef_t t1 = index_stride[i] / g; + if (t1 != 1) + op = ocg->CreateIntegerFloor(ocg->CreatePlus(op, ocg->CreateInt(t1-1)), ocg->CreateInt(t1)); + coef_t t2 = padding_stride / g; + if (t2 != 1) + op = ocg->CreateTimes(op, ocg->CreateInt(t2)); + } + else if (index_stride[i] != 1) { + op = ocg->CreateIntegerFloor(ocg->CreatePlus(op, ocg->CreateInt(index_stride[i]-1)), ocg->CreateInt(index_stride[i])); + } + } + + index_sz.push_back(std::make_pair(i, op)); + break; + } + } + } + } + } + + // change the temporary array index order + for (int i = 0; i < index_sz.size(); i++) + if (index_sz[i].first == fastest_changing_dimension) + switch (sym->layout_type()) { + case IR_ARRAY_LAYOUT_ROW_MAJOR: + std::swap(index_sz[index_sz.size()-1], index_sz[i]); + break; + case IR_ARRAY_LAYOUT_COLUMN_MAJOR: + std::swap(index_sz[0], index_sz[i]); + break; + default: + throw loop_error("unsupported array layout"); + } + + // declare temporary array or scalar + IR_Symbol *tmp_sym; + if (index_sz.size() == 0) { + tmp_sym = ir->CreateScalarSymbol(sym, memory_type); + } + else { + std::vector tmp_array_size(index_sz.size()); + for (int i = 0; i < index_sz.size(); i++) + tmp_array_size[i] = index_sz[i].second->clone(); + tmp_sym = ir->CreateArraySymbol(sym, tmp_array_size, memory_type); + } + + // create temporary array read initialization code + CG_outputRepr *copy_code_read; + if (has_read_refs) + if (index_sz.size() == 0) { + IR_ScalarRef *tmp_scalar_ref = ir->CreateScalarRef(static_cast(tmp_sym)); + + std::vector rhs_index(n_dim); + for (int i = 0; i < index_lb.size(); i++) + if (is_index_eq[i]) + rhs_index[i] = index_lb[i]->clone(); + else + rhs_index[i] = ir->builder()->CreateIdent(copy_is.set_var(level-1+privatized_levels.size()+i+1)->name()); + IR_ArrayRef *copied_array_ref = ir->CreateArrayRef(sym, rhs_index); + + copy_code_read = ir->builder()->CreateAssignment(0, tmp_scalar_ref->convert(), copied_array_ref->convert()); + } + else { + std::vector lhs_index(index_sz.size()); + for (int i = 0; i < index_sz.size(); i++) { + int cur_index_num = index_sz[i].first; + CG_outputRepr *cur_index_repr = ocg->CreateMinus(ocg->CreateIdent(copy_is.set_var(level-1+privatized_levels.size()+cur_index_num+1)->name()), index_lb[cur_index_num]->clone()); + if (padding_stride != 0) { + if (i == n_dim-1) { + coef_t g = gcd(index_stride[cur_index_num], static_cast(padding_stride)); + coef_t t1 = index_stride[cur_index_num] / g; + if (t1 != 1) + cur_index_repr = ocg->CreateIntegerFloor(cur_index_repr, ocg->CreateInt(t1)); + coef_t t2 = padding_stride / g; + if (t2 != 1) + cur_index_repr = ocg->CreateTimes(cur_index_repr, ocg->CreateInt(t2)); + } + else if (index_stride[cur_index_num] != 1) { + cur_index_repr = ocg->CreateIntegerFloor(cur_index_repr, ocg->CreateInt(index_stride[cur_index_num])); + } + } + + if (ir->ArrayIndexStartAt() != 0) + cur_index_repr = ocg->CreatePlus(cur_index_repr, ocg->CreateInt(ir->ArrayIndexStartAt())); + lhs_index[i] = cur_index_repr; + } + + IR_ArrayRef *tmp_array_ref = ir->CreateArrayRef(static_cast(tmp_sym), lhs_index); + + std::vector rhs_index(n_dim); + for (int i = 0; i < index_lb.size(); i++) + if (is_index_eq[i]) + rhs_index[i] = index_lb[i]->clone(); + else + rhs_index[i] = ir->builder()->CreateIdent(copy_is.set_var(level-1+privatized_levels.size()+i+1)->name()); + IR_ArrayRef *copied_array_ref = ir->CreateArrayRef(sym, rhs_index); + + copy_code_read = ir->builder()->CreateAssignment(0, tmp_array_ref->convert(), copied_array_ref->convert()); + } + + // create temporary array write back code + CG_outputRepr *copy_code_write; + if (has_write_refs) + if (index_sz.size() == 0) { + IR_ScalarRef *tmp_scalar_ref = ir->CreateScalarRef(static_cast(tmp_sym)); + + std::vector rhs_index(n_dim); + for (int i = 0; i < index_lb.size(); i++) + if (is_index_eq[i]) + rhs_index[i] = index_lb[i]->clone(); + else + rhs_index[i] = ir->builder()->CreateIdent(copy_is.set_var(level-1+privatized_levels.size()+i+1)->name()); + IR_ArrayRef *copied_array_ref = ir->CreateArrayRef(sym, rhs_index); + + copy_code_write = ir->builder()->CreateAssignment(0, copied_array_ref->convert(), tmp_scalar_ref->convert()); + } + else { + std::vector lhs_index(n_dim); + for (int i = 0; i < index_lb.size(); i++) + if (is_index_eq[i]) + lhs_index[i] = index_lb[i]->clone(); + else + lhs_index[i] = ir->builder()->CreateIdent(copy_is.set_var(level-1+privatized_levels.size()+i+1)->name()); + IR_ArrayRef *copied_array_ref = ir->CreateArrayRef(sym, lhs_index); + + std::vector rhs_index(index_sz.size()); + for (int i = 0; i < index_sz.size(); i++) { + int cur_index_num = index_sz[i].first; + CG_outputRepr *cur_index_repr = ocg->CreateMinus(ocg->CreateIdent(copy_is.set_var(level-1+privatized_levels.size()+cur_index_num+1)->name()), index_lb[cur_index_num]->clone()); + if (padding_stride != 0) { + if (i == n_dim-1) { + coef_t g = gcd(index_stride[cur_index_num], static_cast(padding_stride)); + coef_t t1 = index_stride[cur_index_num] / g; + if (t1 != 1) + cur_index_repr = ocg->CreateIntegerFloor(cur_index_repr, ocg->CreateInt(t1)); + coef_t t2 = padding_stride / g; + if (t2 != 1) + cur_index_repr = ocg->CreateTimes(cur_index_repr, ocg->CreateInt(t2)); + } + else if (index_stride[cur_index_num] != 1) { + cur_index_repr = ocg->CreateIntegerFloor(cur_index_repr, ocg->CreateInt(index_stride[cur_index_num])); + } + } + + if (ir->ArrayIndexStartAt() != 0) + cur_index_repr = ocg->CreatePlus(cur_index_repr, ocg->CreateInt(ir->ArrayIndexStartAt())); + rhs_index[i] = cur_index_repr; + } + IR_ArrayRef *tmp_array_ref = ir->CreateArrayRef(static_cast(tmp_sym), rhs_index); + + copy_code_write = ir->builder()->CreateAssignment(0, copied_array_ref->convert(), tmp_array_ref->convert()); + } + + // now we can remove those loops for array indexes that are + // dependent on others + if (!(index_sz.size() == n_dim && (sym->layout_type() == IR_ARRAY_LAYOUT_ROW_MAJOR || n_dim <= 1))) { + Relation mapping(level-1+privatized_levels.size()+n_dim, level-1+privatized_levels.size()+index_sz.size()); + F_And *f_root = mapping.add_and(); + for (int i = 1; i <= level-1+privatized_levels.size(); i++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.input_var(i), 1); + h.update_coef(mapping.output_var(i), -1); + } + + int cur_index = 0; + std::vector mapped_index(index_sz.size()); + for (int i = 0; i < n_dim; i++) + if (!is_index_eq[i]) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.input_var(level-1+privatized_levels.size()+i+1), 1); + switch (sym->layout_type()) { + case IR_ARRAY_LAYOUT_COLUMN_MAJOR: { + h.update_coef(mapping.output_var(level-1+privatized_levels.size()+index_sz.size()-cur_index), -1); + mapped_index[index_sz.size()-cur_index-1] = i; + break; + } + case IR_ARRAY_LAYOUT_ROW_MAJOR: { + h.update_coef(mapping.output_var(level-1+privatized_levels.size()+cur_index+1), -1); + mapped_index[cur_index] = i; + break; + } + default: + throw loop_error("unsupported array layout"); + } + cur_index++; + } + + wo_copy_is = Range(Restrict_Domain(copy(mapping), wo_copy_is)); + ro_copy_is = Range(Restrict_Domain(copy(mapping), ro_copy_is)); + for (int i = 1; i <= level-1+privatized_levels.size(); i++) { + wo_copy_is.name_set_var(i, copy_is.set_var(i)->name()); + ro_copy_is.name_set_var(i, copy_is.set_var(i)->name()); + } + for (int i = 0; i < index_sz.size(); i++) { + wo_copy_is.name_set_var(level-1+privatized_levels.size()+i+1, copy_is.set_var(level-1+privatized_levels.size()+mapped_index[i]+1)->name()); + ro_copy_is.name_set_var(level-1+privatized_levels.size()+i+1, copy_is.set_var(level-1+privatized_levels.size()+mapped_index[i]+1)->name()); + } + wo_copy_is.setup_names(); + ro_copy_is.setup_names(); + } + + // insert read copy statement + int old_num_stmt = stmt.size(); + int ro_copy_stmt_num = -1; + if (has_read_refs) { + Relation copy_xform(ro_copy_is.n_set(), 2*ro_copy_is.n_set()+1); + { + F_And *f_root = copy_xform.add_and(); + for (int i = 1; i <= ro_copy_is.n_set(); i++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(copy_xform.input_var(i), 1); + h.update_coef(copy_xform.output_var(2*i), -1); + } + for (int i = 1; i <= dim; i+=2) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(copy_xform.output_var(i), -1); + h.update_const(lex[i-1]); + } + for (int i = dim+2; i <= copy_xform.n_out(); i+=2) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(copy_xform.output_var(i), 1); + } + } + + Statement copy_stmt_read; + copy_stmt_read.IS = ro_copy_is; + copy_stmt_read.xform = copy_xform; + copy_stmt_read.code = copy_code_read; + copy_stmt_read.loop_level = std::vector(ro_copy_is.n_set()); + copy_stmt_read.ir_stmt_node = NULL; + for (int i = 0; i < level-1; i++) { + copy_stmt_read.loop_level[i].type = stmt[*(active.begin())].loop_level[i].type; + if (stmt[*(active.begin())].loop_level[i].type == LoopLevelTile && + stmt[*(active.begin())].loop_level[i].payload >= level) { + int j; + for (j = 0; j < privatized_levels.size(); j++) + if (privatized_levels[j] == stmt[*(active.begin())].loop_level[i].payload) + break; + if (j == privatized_levels.size()) + copy_stmt_read.loop_level[i].payload = -1; + else + copy_stmt_read.loop_level[i].payload = level + j; + } + else + copy_stmt_read.loop_level[i].payload = stmt[*(active.begin())].loop_level[i].payload; + copy_stmt_read.loop_level[i].parallel_level = stmt[*(active.begin())].loop_level[i].parallel_level; + } + for (int i = 0; i < privatized_levels.size(); i++) { + copy_stmt_read.loop_level[level-1+i].type = stmt[*(active.begin())].loop_level[privatized_levels[i]].type; + copy_stmt_read.loop_level[level-1+i].payload = stmt[*(active.begin())].loop_level[privatized_levels[i]].payload; + copy_stmt_read.loop_level[level-1+i].parallel_level = stmt[*(active.begin())].loop_level[privatized_levels[i]].parallel_level; + } + int left_num_dim = num_dep_dim - (get_last_dep_dim_before(*(active.begin()), level) + 1); + for (int i = 0; i < min(left_num_dim, static_cast(index_sz.size())); i++) { + copy_stmt_read.loop_level[level-1+privatized_levels.size()+i].type = LoopLevelOriginal; + copy_stmt_read.loop_level[level-1+privatized_levels.size()+i].payload = num_dep_dim-left_num_dim+i; + copy_stmt_read.loop_level[level-1+privatized_levels.size()+i].parallel_level = 0; + } + for (int i = min(left_num_dim, static_cast(index_sz.size())); i < index_sz.size(); i++) { + copy_stmt_read.loop_level[level-1+privatized_levels.size()+i].type = LoopLevelUnknown; + copy_stmt_read.loop_level[level-1+privatized_levels.size()+i].payload = -1; + copy_stmt_read.loop_level[level-1+privatized_levels.size()+i].parallel_level = 0; + } + + + shiftLexicalOrder(lex, dim-1, 1); + stmt.push_back(copy_stmt_read); + ro_copy_stmt_num = stmt.size() - 1; + dep.insert(); + } + + // insert write copy statement + int wo_copy_stmt_num = -1; + if (has_write_refs) { + Relation copy_xform(wo_copy_is.n_set(), 2*wo_copy_is.n_set()+1); + { + F_And *f_root = copy_xform.add_and(); + for (int i = 1; i <= wo_copy_is.n_set(); i++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(copy_xform.input_var(i), 1); + h.update_coef(copy_xform.output_var(2*i), -1); + } + for (int i = 1; i <= dim; i+=2) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(copy_xform.output_var(i), -1); + h.update_const(lex[i-1]); + } + for (int i = dim+2; i <= copy_xform.n_out(); i+=2) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(copy_xform.output_var(i), 1); + } + } + + Statement copy_stmt_write; + copy_stmt_write.IS = wo_copy_is; + copy_stmt_write.xform = copy_xform; + copy_stmt_write.code = copy_code_write; + copy_stmt_write.loop_level = std::vector(wo_copy_is.n_set()); + copy_stmt_write.ir_stmt_node = NULL; + + for (int i = 0; i < level-1; i++) { + copy_stmt_write.loop_level[i].type = stmt[*(active.begin())].loop_level[i].type; + if (stmt[*(active.begin())].loop_level[i].type == LoopLevelTile && + stmt[*(active.begin())].loop_level[i].payload >= level) { + int j; + for (j = 0; j < privatized_levels.size(); j++) + if (privatized_levels[j] == stmt[*(active.begin())].loop_level[i].payload) + break; + if (j == privatized_levels.size()) + copy_stmt_write.loop_level[i].payload = -1; + else + copy_stmt_write.loop_level[i].payload = level + j; + } + else + copy_stmt_write.loop_level[i].payload = stmt[*(active.begin())].loop_level[i].payload; + copy_stmt_write.loop_level[i].parallel_level = stmt[*(active.begin())].loop_level[i].parallel_level; + } + for (int i = 0; i < privatized_levels.size(); i++) { + copy_stmt_write.loop_level[level-1+i].type = stmt[*(active.begin())].loop_level[privatized_levels[i]].type; + copy_stmt_write.loop_level[level-1+i].payload = stmt[*(active.begin())].loop_level[privatized_levels[i]].payload; + copy_stmt_write.loop_level[level-1+i].parallel_level = stmt[*(active.begin())].loop_level[privatized_levels[i]].parallel_level; + } + int left_num_dim = num_dep_dim - (get_last_dep_dim_before(*(active.begin()), level) + 1); + for (int i = 0; i < min(left_num_dim, static_cast(index_sz.size())); i++) { + copy_stmt_write.loop_level[level-1+privatized_levels.size()+i].type = LoopLevelOriginal; + copy_stmt_write.loop_level[level-1+privatized_levels.size()+i].payload = num_dep_dim-left_num_dim+i; + copy_stmt_write.loop_level[level-1+privatized_levels.size()+i].parallel_level = 0; + } + for (int i = min(left_num_dim, static_cast(index_sz.size())); i < index_sz.size(); i++) { + copy_stmt_write.loop_level[level-1+privatized_levels.size()+i].type = LoopLevelUnknown; + copy_stmt_write.loop_level[level-1+privatized_levels.size()+i].payload = -1; + copy_stmt_write.loop_level[level-1+privatized_levels.size()+i].parallel_level = 0; + } + lex[dim-1]++; + shiftLexicalOrder(lex, dim-1, -2); + stmt.push_back(copy_stmt_write); + wo_copy_stmt_num = stmt.size() - 1; + dep.insert(); + } + + // replace original array accesses with temporary array accesses + for (int i =0; i < stmt_refs.size(); i++) + for (int j = 0; j < stmt_refs[i].second.size(); j++) { + if (index_sz.size() == 0) { + IR_ScalarRef *tmp_scalar_ref = ir->CreateScalarRef(static_cast(tmp_sym)); + ir->ReplaceExpression(stmt_refs[i].second[j], tmp_scalar_ref->convert()); + } + else { + std::vector index_repr(index_sz.size()); + for (int k = 0; k < index_sz.size(); k++) { + int cur_index_num = index_sz[k].first; + + CG_outputRepr *cur_index_repr = ocg->CreateMinus(stmt_refs[i].second[j]->index(cur_index_num), index_lb[cur_index_num]->clone()); + if (padding_stride != 0) { + if (k == n_dim-1) { + coef_t g = gcd(index_stride[cur_index_num], static_cast(padding_stride)); + coef_t t1 = index_stride[cur_index_num] / g; + if (t1 != 1) + cur_index_repr = ocg->CreateIntegerFloor(cur_index_repr, ocg->CreateInt(t1)); + coef_t t2 = padding_stride / g; + if (t2 != 1) + cur_index_repr = ocg->CreateTimes(cur_index_repr, ocg->CreateInt(t2)); + } + else if (index_stride[cur_index_num] != 1) { + cur_index_repr = ocg->CreateIntegerFloor(cur_index_repr, ocg->CreateInt(index_stride[cur_index_num])); + } + } + + if (ir->ArrayIndexStartAt() != 0) + cur_index_repr = ocg->CreatePlus(cur_index_repr, ocg->CreateInt(ir->ArrayIndexStartAt())); + index_repr[k] = cur_index_repr; + } + + IR_ArrayRef *tmp_array_ref = ir->CreateArrayRef(static_cast(tmp_sym), index_repr); + ir->ReplaceExpression(stmt_refs[i].second[j], tmp_array_ref->convert()); + } + } + + // update dependence graph + int dep_dim = get_last_dep_dim_before(*(active.begin()), level) + 1; + if (ro_copy_stmt_num != -1) { + for (int i = 0; i < old_num_stmt; i++) { + std::vector > D; + + for (DependenceGraph::EdgeList::iterator j = dep.vertex[i].second.begin(); j != dep.vertex[i].second.end();) { + if (active.find(i) != active.end() && active.find(j->first) == active.end()) { + std::vector dvs1, dvs2; + for (int k = 0; k < j->second.size(); k++) { + DependenceVector dv = j->second[k]; + if (dv.sym != NULL && dv.sym->name() == sym->name() && (dv.type == DEP_R2R || dv.type == DEP_R2W)) + dvs1.push_back(dv); + else + dvs2.push_back(dv); + } + j->second = dvs2; + if (dvs1.size() > 0) + dep.connect(ro_copy_stmt_num, j->first, dvs1); + } + else if (active.find(i) == active.end() && active.find(j->first) != active.end()) { + std::vector dvs1, dvs2; + for (int k = 0; k < j->second.size(); k++) { + DependenceVector dv = j->second[k]; + if (dv.sym != NULL && dv.sym->name() == sym->name() && (dv.type == DEP_R2R || dv.type == DEP_W2R)) + dvs1.push_back(dv); + else + dvs2.push_back(dv); + } + j->second = dvs2; + if (dvs1.size() > 0) + D.push_back(dvs1); + } + + if (j->second.size() == 0) + dep.vertex[i].second.erase(j++); + else + j++; + } + + for (int j = 0; j < D.size(); j++) + dep.connect(i, ro_copy_stmt_num, D[j]); + } + + // insert dependences from copy statement loop to copied statements + DependenceVector dv; + dv.type = DEP_W2R; + dv.sym = tmp_sym->clone(); + dv.lbounds = std::vector(dep.num_dim(), 0); + dv.ubounds = std::vector(dep.num_dim(), 0); + for (int i = dep_dim; i < dep.num_dim(); i++) { + dv.lbounds[i] = -posInfinity; + dv.ubounds[i] = posInfinity; + } + for (std::set::iterator i = active.begin(); i != active.end(); i++) + dep.connect(ro_copy_stmt_num, *i, dv); + } + + if (wo_copy_stmt_num != -1) { + for (int i = 0; i < old_num_stmt; i++) { + std::vector > D; + + for (DependenceGraph::EdgeList::iterator j = dep.vertex[i].second.begin(); j != dep.vertex[i].second.end();) { + if (active.find(i) != active.end() && active.find(j->first) == active.end()) { + std::vector dvs1, dvs2; + for (int k = 0; k < j->second.size(); k++) { + DependenceVector dv = j->second[k]; + if (dv.sym != NULL && dv.sym->name() == sym->name() && (dv.type == DEP_W2R || dv.type == DEP_W2W)) + dvs1.push_back(dv); + else + dvs2.push_back(dv); + } + j->second = dvs2; + if (dvs1.size() > 0) + dep.connect(wo_copy_stmt_num, j->first, dvs1); + } + else if (active.find(i) == active.end() && active.find(j->first) != active.end()) { + std::vector dvs1, dvs2; + for (int k = 0; k < j->second.size(); k++) { + DependenceVector dv = j->second[k]; + if (dv.sym != NULL && dv.sym->name() == sym->name() && (dv.type == DEP_R2W || dv.type == DEP_W2W)) + dvs1.push_back(dv); + else + dvs2.push_back(dv); + } + j->second = dvs2; + if (dvs1.size() > 0) + D.push_back(dvs1); + } + + if (j->second.size() == 0) + dep.vertex[i].second.erase(j++); + else + j++; + } + + for (int j = 0; j < D.size(); j++) + dep.connect(i, wo_copy_stmt_num, D[j]); + } + + // insert dependences from copied statements to write statements + DependenceVector dv; + dv.type = DEP_W2R; + dv.sym = tmp_sym->clone(); + dv.lbounds = std::vector(dep.num_dim(), 0); + dv.ubounds = std::vector(dep.num_dim(), 0); + for (int i = dep_dim; i < dep.num_dim(); i++) { + dv.lbounds[i] = -posInfinity; + dv.ubounds[i] = posInfinity; + } + for (std::set::iterator i = active.begin(); i != active.end(); i++) + dep.connect(*i, wo_copy_stmt_num, dv); + + } + + // update variable name for dependences among copied statements + for (int i = 0; i < old_num_stmt; i++) { + if (active.find(i) != active.end()) + for (DependenceGraph::EdgeList::iterator j = dep.vertex[i].second.begin(); j != dep.vertex[i].second.end(); j++) + if (active.find(j->first) != active.end()) + for (int k = 0; k < j->second.size(); k++) { + IR_Symbol *s = tmp_sym->clone(); + j->second[k].sym = s; + } + } + + // insert anti-dependence from write statement to read statement + if (ro_copy_stmt_num != -1 && wo_copy_stmt_num != -1) + if (dep_dim >= 0) { + DependenceVector dv; + dv.type = DEP_R2W; + dv.sym = tmp_sym->clone(); + dv.lbounds = std::vector(dep.num_dim(), 0); + dv.ubounds = std::vector(dep.num_dim(), 0); + for (int k = dep_dim; k < dep.num_dim(); k++) { + dv.lbounds[k] = -posInfinity; + dv.ubounds[k] = posInfinity; + } + for (int k = 0; k < dep_dim; k++) { + if (k != 0) { + dv.lbounds[k-1] = 0; + dv.ubounds[k-1] = 0; + } + dv.lbounds[k] = 1; + dv.ubounds[k] = posInfinity; + dep.connect(wo_copy_stmt_num, ro_copy_stmt_num, dv); + } + } + + // cleanup + delete sym; + delete tmp_sym; + for (int i = 0; i < index_lb.size(); i++) { + index_lb[i]->clear(); + delete index_lb[i]; + } + for (int i = 0; i < index_sz.size(); i++) { + index_sz[i].second->clear(); + delete index_sz[i].second; + } + + return true; +} diff --git a/chill/src/loop_extra.cc b/chill/src/loop_extra.cc new file mode 100644 index 0000000..2412403 --- /dev/null +++ b/chill/src/loop_extra.cc @@ -0,0 +1,224 @@ +/***************************************************************************** + Copyright (C) 2010 University of Utah + All Rights Reserved. + + Purpose: + Additional loop transformations. + + Notes: + + History: + 07/31/10 Created by Chun Chen +*****************************************************************************/ + +#include +#include +#include "loop.hh" +#include "omegatools.hh" +#include "ir_code.hh" +#include "chill_error.hh" + +using namespace omega; + + +void Loop::shift_to(int stmt_num, int level, int absolute_position) { + // combo + tile(stmt_num, level, 1, level, CountedTile); + std::vector lex = getLexicalOrder(stmt_num); + std::set active = getStatements(lex, 2*level-2); + shift(active, level, absolute_position); + + // remove unnecessary tiled loop since tile size is one + for (std::set::iterator i = active.begin(); i != active.end(); i++) { + int n = stmt[*i].xform.n_out(); + Relation mapping(n, n-2); + F_And *f_root = mapping.add_and(); + for (int j = 1; j <= 2*level; j++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.output_var(j), 1); + h.update_coef(mapping.input_var(j), -1); + } + for (int j = 2*level+3; j <= n; j++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.output_var(j-2), 1); + h.update_coef(mapping.input_var(j), -1); + } + stmt[*i].xform = Composition(mapping, stmt[*i].xform); + stmt[*i].xform.simplify(); + + for (int j = 0; j < stmt[*i].loop_level.size(); j++) + if (j != level-1 && + stmt[*i].loop_level[j].type == LoopLevelTile && + stmt[*i].loop_level[j].payload >= level) + stmt[*i].loop_level[j].payload--; + + stmt[*i].loop_level.erase(stmt[*i].loop_level.begin()+level-1); + } +} + + +std::set Loop::unroll_extra(int stmt_num, int level, int unroll_amount, int cleanup_split_level) { + std::set cleanup_stmts = unroll(stmt_num, level, unroll_amount,std::vector< std::vector >(), cleanup_split_level); + for (std::set::iterator i = cleanup_stmts.begin(); i != cleanup_stmts.end(); i++) + unroll(*i, level, 0); + + return cleanup_stmts; +} + +void Loop::peel(int stmt_num, int level, int peel_amount) { + // check for sanity of parameters + if (stmt_num < 0 || stmt_num >= stmt.size()) + throw std::invalid_argument("invalid statement number " + to_string(stmt_num)); + if (level <= 0 || level > stmt[stmt_num].loop_level.size()) + throw std::invalid_argument("invalid loop level " + to_string(level)); + + if (peel_amount == 0) + return; + + std::set subloop = getSubLoopNest(stmt_num, level); + std::vector Rs; + for (std::set::iterator i = subloop.begin(); i != subloop.end(); i++) { + Relation r = getNewIS(*i); + Relation f(r.n_set(), level); + F_And *f_root = f.add_and(); + for (int j = 1; j <= level; j++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(f.input_var(2*j), 1); + h.update_coef(f.output_var(j), -1); + } + r = Composition(f, r); + r.simplify(); + Rs.push_back(r); + } + Relation hull = SimpleHull(Rs); + + if (peel_amount > 0) { + GEQ_Handle bound_eq; + bool found_bound = false; + for (GEQ_Iterator e(hull.single_conjunct()->GEQs()); e; e++) + if (!(*e).has_wildcards() && (*e).get_coef(hull.set_var(level)) > 0) { + bound_eq = *e; + found_bound = true; + break; + } + if (!found_bound) + for (GEQ_Iterator e(hull.single_conjunct()->GEQs()); e; e++) + if ((*e).has_wildcards() && (*e).get_coef(hull.set_var(level)) > 0) { + bool is_bound = true; + for (Constr_Vars_Iter cvi(*e, true); cvi; cvi++) { + std::pair result = find_floor_definition(hull, cvi.curr_var()); + if (!result.first) { + is_bound = false; + break; + } + } + if (is_bound) { + bound_eq = *e; + found_bound = true; + break; + } + } + if (!found_bound) + throw loop_error("can't find lower bound for peeling at loop level " + to_string(level)); + + for (int i = 1; i <= peel_amount; i++) { + Relation r(level); + F_Exists *f_exists = r.add_and()->add_exists(); + F_And *f_root = f_exists->add_and(); + GEQ_Handle h = f_root->add_GEQ(); + std::map exists_mapping; + for (Constr_Vars_Iter cvi(bound_eq); cvi; cvi++) + switch (cvi.curr_var()->kind()) { + case Input_Var: + h.update_coef(r.set_var(cvi.curr_var()->get_position()), cvi.curr_coef()); + break; + case Wildcard_Var: { + Variable_ID v = replicate_floor_definition(hull, cvi.curr_var(), r, f_exists, f_root, exists_mapping); + h.update_coef(v, cvi.curr_coef()); + break; + } + case Global_Var: { + Global_Var_ID g = cvi.curr_var()->get_global_var(); + Variable_ID v; + if (g->arity() == 0) + v = r.get_local(g); + else + v = r.get_local(g, cvi.curr_var()->function_of()); + h.update_coef(v, cvi.curr_coef()); + break; + } + default: + assert(false); + } + h.update_const(bound_eq.get_const() - i); + r.simplify(); + + split(stmt_num, level, r); + } + } + else { // peel_amount < 0 + GEQ_Handle bound_eq; + bool found_bound = false; + for (GEQ_Iterator e(hull.single_conjunct()->GEQs()); e; e++) + if (!(*e).has_wildcards() && (*e).get_coef(hull.set_var(level)) < 0) { + bound_eq = *e; + found_bound = true; + break; + } + if (!found_bound) + for (GEQ_Iterator e(hull.single_conjunct()->GEQs()); e; e++) + if ((*e).has_wildcards() && (*e).get_coef(hull.set_var(level)) < 0) { + bool is_bound = true; + for (Constr_Vars_Iter cvi(*e, true); cvi; cvi++) { + std::pair result = find_floor_definition(hull, cvi.curr_var()); + if (!result.first) { + is_bound = false; + break; + } + } + if (is_bound) { + bound_eq = *e; + found_bound = true; + break; + } + } + if (!found_bound) + throw loop_error("can't find upper bound for peeling at loop level " + to_string(level)); + + for (int i = 1; i <= -peel_amount; i++) { + Relation r(level); + F_Exists *f_exists = r.add_and()->add_exists(); + F_And *f_root = f_exists->add_and(); + GEQ_Handle h = f_root->add_GEQ(); + std::map exists_mapping; + for (Constr_Vars_Iter cvi(bound_eq); cvi; cvi++) + switch (cvi.curr_var()->kind()) { + case Input_Var: + h.update_coef(r.set_var(cvi.curr_var()->get_position()), cvi.curr_coef()); + break; + case Wildcard_Var: { + Variable_ID v = replicate_floor_definition(hull, cvi.curr_var(), r, f_exists, f_root, exists_mapping); + h.update_coef(v, cvi.curr_coef()); + break; + } + case Global_Var: { + Global_Var_ID g = cvi.curr_var()->get_global_var(); + Variable_ID v; + if (g->arity() == 0) + v = r.get_local(g); + else + v = r.get_local(g, cvi.curr_var()->function_of()); + h.update_coef(v, cvi.curr_coef()); + break; + } + default: + assert(false); + } + h.update_const(bound_eq.get_const() - i); + r.simplify(); + + split(stmt_num, level, r); + } + } +} + diff --git a/chill/src/loop_tile.cc b/chill/src/loop_tile.cc new file mode 100644 index 0000000..ad1d3b7 --- /dev/null +++ b/chill/src/loop_tile.cc @@ -0,0 +1,630 @@ +/* + * loop_tile.cc + * + * Created on: Nov 12, 2012 + * Author: anand + */ + +#include +#include "loop.hh" +#include "omegatools.hh" +#include "ir_code.hh" +#include "chill_error.hh" + +using namespace omega; + + + + +void Loop::tile(int stmt_num, int level, int tile_size, int outer_level, + TilingMethodType method, int alignment_offset, int alignment_multiple) { + // check for sanity of parameters + if (tile_size < 0) + throw std::invalid_argument("invalid tile size"); + if (alignment_multiple < 1 || alignment_offset < 0) + throw std::invalid_argument("invalid alignment for tile"); + if (stmt_num < 0 || stmt_num >= stmt.size()) + throw std::invalid_argument("invalid statement " + to_string(stmt_num)); + if (level <= 0) + throw std::invalid_argument("invalid loop level " + to_string(level)); + if (level > stmt[stmt_num].loop_level.size()) + throw std::invalid_argument( + "there is no loop level " + to_string(level) + " for statement " + + to_string(stmt_num)); + if (outer_level <= 0 || outer_level > level) + throw std::invalid_argument( + "invalid tile controlling loop level " + + to_string(outer_level)); + + // invalidate saved codegen computation + delete last_compute_cgr_; + last_compute_cgr_ = NULL; + delete last_compute_cg_; + last_compute_cg_ = NULL; + + int dim = 2 * level - 1; + int outer_dim = 2 * outer_level - 1; + std::vector lex = getLexicalOrder(stmt_num); + std::set same_tiled_loop = getStatements(lex, dim - 1); + std::set same_tile_controlling_loop = getStatements(lex, + outer_dim - 1); + + for (std::set::iterator i = same_tiled_loop.begin(); + i != same_tiled_loop.end(); i++) { + for (DependenceGraph::EdgeList::iterator j = + dep.vertex[*i].second.begin(); j != dep.vertex[*i].second.end(); + j++) { + if (same_tiled_loop.find(j->first) != same_tiled_loop.end()) + for (int k = 0; k < j->second.size(); k++) { + DependenceVector dv = j->second[k]; + int dim2 = level - 1; + if ((dv.type != DEP_CONTROL) && (dv.type != DEP_UNKNOWN)) { + while (stmt[*i].loop_level[dim2].type == LoopLevelTile) { + dim2 = stmt[*i].loop_level[dim2].payload - 1; + } + dim2 = stmt[*i].loop_level[dim2].payload; + + if (dv.hasNegative(dim2) && (!dv.quasi)) { + for (int l = outer_level; l < level; l++) + if (stmt[*i].loop_level[l - 1].type + != LoopLevelTile) { + if (dv.isCarried( + stmt[*i].loop_level[l - 1].payload) + && dv.hasPositive( + stmt[*i].loop_level[l - 1].payload)) + throw loop_error( + "loop error: Tiling is illegal, dependence violation!"); + } else { + + int dim3 = l - 1; + while (stmt[*i].loop_level[l - 1].type + != LoopLevelTile) { + dim3 = + stmt[*i].loop_level[l - 1].payload + - 1; + + } + + dim3 = stmt[*i].loop_level[l - 1].payload; + if (dim3 < level - 1) + if (dv.isCarried(dim3) + && dv.hasPositive(dim3)) + throw loop_error( + "loop error: Tiling is illegal, dependence violation!"); + } + } + } + } + } + } + // special case for no tiling + if (tile_size == 0) { + for (std::set::iterator i = same_tile_controlling_loop.begin(); + i != same_tile_controlling_loop.end(); i++) { + Relation r(stmt[*i].xform.n_out(), stmt[*i].xform.n_out() + 2); + F_And *f_root = r.add_and(); + for (int j = 1; j <= 2 * outer_level - 1; j++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(r.input_var(j), 1); + h.update_coef(r.output_var(j), -1); + } + EQ_Handle h1 = f_root->add_EQ(); + h1.update_coef(r.output_var(2 * outer_level), 1); + EQ_Handle h2 = f_root->add_EQ(); + h2.update_coef(r.output_var(2 * outer_level + 1), 1); + for (int j = 2 * outer_level; j <= stmt[*i].xform.n_out(); j++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(r.input_var(j), 1); + h.update_coef(r.output_var(j + 2), -1); + } + + stmt[*i].xform = Composition(copy(r), stmt[*i].xform); + } + } + // normal tiling + else { + std::set private_stmt; + for (std::set::iterator i = same_tile_controlling_loop.begin(); + i != same_tile_controlling_loop.end(); i++) { +// if (same_tiled_loop.find(*i) == same_tiled_loop.end() && !is_single_iteration(getNewIS(*i), dim)) +// same_tiled_loop.insert(*i); + + // should test dim's value directly but it is ok for now +// if (same_tiled_loop.find(*i) == same_tiled_loop.end() && get_const(stmt[*i].xform, dim+1, Output_Var) == posInfinity) + if (same_tiled_loop.find(*i) == same_tiled_loop.end() + && overflow.find(*i) != overflow.end()) + private_stmt.insert(*i); + } + + // extract the union of the iteration space to be considered + Relation hull; + /*{ + Tuple < Relation > r_list; + Tuple r_mask; + + for (std::set::iterator i = same_tile_controlling_loop.begin(); + i != same_tile_controlling_loop.end(); i++) + if (private_stmt.find(*i) == private_stmt.end()) { + Relation r = project_onto_levels(getNewIS(*i), dim + 1, + true); + for (int j = outer_dim; j < dim; j++) + r = Project(r, j + 1, Set_Var); + for (int j = 0; j < outer_dim; j += 2) + r = Project(r, j + 1, Set_Var); + r_list.append(r); + r_mask.append(1); + } + + hull = Hull(r_list, r_mask, 1, true); + }*/ + + { + std::vector r_list; + + for (std::set::iterator i = same_tile_controlling_loop.begin(); + i != same_tile_controlling_loop.end(); i++) + if (private_stmt.find(*i) == private_stmt.end()) { + Relation r = getNewIS(*i); + for (int j = dim + 2; j <= r.n_set(); j++) + r = Project(r, r.set_var(j)); + for (int j = outer_dim; j < dim; j++) + r = Project(r, j + 1, Set_Var); + for (int j = 0; j < outer_dim; j += 2) + r = Project(r, j + 1, Set_Var); + r.simplify(2, 4); + r_list.push_back(r); + } + + hull = SimpleHull(r_list); + // hull = Hull(r_list, std::vector(r_list.size(), true), 1, true); + } + + // extract the bound of the dimension to be tiled + Relation bound = get_loop_bound(hull, dim); + if (!bound.has_single_conjunct()) { + // further simplify the bound + hull = Approximate(hull); + bound = get_loop_bound(hull, dim); + + int i = outer_dim - 2; + while (!bound.has_single_conjunct() && i >= 0) { + hull = Project(hull, i + 1, Set_Var); + bound = get_loop_bound(hull, dim); + i -= 2; + } + + if (!bound.has_single_conjunct()) + throw loop_error("cannot handle tile bounds"); + } + + // separate lower and upper bounds + std::vector lb_list, ub_list; + { + Conjunct *c = bound.query_DNF()->single_conjunct(); + for (GEQ_Iterator gi(c->GEQs()); gi; gi++) { + int coef = (*gi).get_coef(bound.set_var(dim + 1)); + if (coef < 0) + ub_list.push_back(*gi); + else if (coef > 0) + lb_list.push_back(*gi); + } + } + if (lb_list.size() == 0) + throw loop_error( + "unable to calculate tile controlling loop lower bound"); + if (ub_list.size() == 0) + throw loop_error( + "unable to calculate tile controlling loop upper bound"); + + // find the simplest lower bound for StridedTile or simplest iteration count for CountedTile + int simplest_lb = 0, simplest_ub = 0; + if (method == StridedTile) { + int best_cost = INT_MAX; + for (int i = 0; i < lb_list.size(); i++) { + int cost = 0; + for (Constr_Vars_Iter ci(lb_list[i]); ci; ci++) { + switch ((*ci).var->kind()) { + case Input_Var: { + cost += 5; + break; + } + case Global_Var: { + cost += 2; + break; + } + default: + cost += 15; + break; + } + } + + if (cost < best_cost) { + best_cost = cost; + simplest_lb = i; + } + } + } else if (method == CountedTile) { + std::map s1, s2, s3; + int best_cost = INT_MAX; + for (int i = 0; i < lb_list.size(); i++) + for (int j = 0; j < ub_list.size(); j++) { + int cost = 0; + + for (Constr_Vars_Iter ci(lb_list[i]); ci; ci++) { + switch ((*ci).var->kind()) { + case Input_Var: { + s1[(*ci).var] += (*ci).coef; + break; + } + case Global_Var: { + s2[(*ci).var] += (*ci).coef; + break; + } + case Exists_Var: + case Wildcard_Var: { + s3[(*ci).var] += (*ci).coef; + break; + } + default: + cost = INT_MAX - 2; + break; + } + } + + for (Constr_Vars_Iter ci(ub_list[j]); ci; ci++) { + switch ((*ci).var->kind()) { + case Input_Var: { + s1[(*ci).var] += (*ci).coef; + break; + } + case Global_Var: { + s2[(*ci).var] += (*ci).coef; + break; + } + case Exists_Var: + case Wildcard_Var: { + s3[(*ci).var] += (*ci).coef; + break; + } + default: + if (cost == INT_MAX - 2) + cost = INT_MAX - 1; + else + cost = INT_MAX - 3; + break; + } + } + + if (cost == 0) { + for (std::map::iterator k = + s1.begin(); k != s1.end(); k++) + if ((*k).second != 0) + cost += 5; + for (std::map::iterator k = + s2.begin(); k != s2.end(); k++) + if ((*k).second != 0) + cost += 2; + for (std::map::iterator k = + s3.begin(); k != s3.end(); k++) + if ((*k).second != 0) + cost += 15; + } + + if (cost < best_cost) { + best_cost = cost; + simplest_lb = i; + simplest_ub = j; + } + } + } + + // prepare the new transformation relations + for (std::set::iterator i = same_tile_controlling_loop.begin(); + i != same_tile_controlling_loop.end(); i++) { + Relation r(stmt[*i].xform.n_out(), stmt[*i].xform.n_out() + 2); + F_And *f_root = r.add_and(); + for (int j = 0; j < outer_dim - 1; j++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(r.output_var(j + 1), 1); + h.update_coef(r.input_var(j + 1), -1); + } + + for (int j = outer_dim - 1; j < stmt[*i].xform.n_out(); j++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(r.output_var(j + 3), 1); + h.update_coef(r.input_var(j + 1), -1); + } + + EQ_Handle h = f_root->add_EQ(); + h.update_coef(r.output_var(outer_dim), 1); + h.update_const(-lex[outer_dim - 1]); + + stmt[*i].xform = Composition(r, stmt[*i].xform); + } + + // add tiling constraints. + for (std::set::iterator i = same_tile_controlling_loop.begin(); + i != same_tile_controlling_loop.end(); i++) { + F_And *f_super_root = stmt[*i].xform.and_with_and(); + F_Exists *f_exists = f_super_root->add_exists(); + F_And *f_root = f_exists->add_and(); + + // create a lower bound variable for easy formula creation later + Variable_ID aligned_lb; + { + Variable_ID lb = f_exists->declare(); + coef_t coef = lb_list[simplest_lb].get_coef( + bound.set_var(dim + 1)); + if (coef == 1) { // e.g. if i >= m+5, then LB = m+5 + EQ_Handle h = f_root->add_EQ(); + h.update_coef(lb, 1); + for (Constr_Vars_Iter ci(lb_list[simplest_lb]); ci; ci++) { + switch ((*ci).var->kind()) { + case Input_Var: { + int pos = (*ci).var->get_position(); + if (pos != dim + 1) + h.update_coef(stmt[*i].xform.output_var(pos), + (*ci).coef); + break; + } + case Global_Var: { + Global_Var_ID g = (*ci).var->get_global_var(); + Variable_ID v; + if (g->arity() == 0) + v = stmt[*i].xform.get_local(g); + else + v = stmt[*i].xform.get_local(g, + (*ci).var->function_of()); + h.update_coef(v, (*ci).coef); + break; + } + default: + throw loop_error("cannot handle tile bounds"); + } + } + h.update_const(lb_list[simplest_lb].get_const()); + } else { // e.g. if 2i >= m+5, then m+5 <= 2*LB < m+5+2 + GEQ_Handle h1 = f_root->add_GEQ(); + GEQ_Handle h2 = f_root->add_GEQ(); + for (Constr_Vars_Iter ci(lb_list[simplest_lb]); ci; ci++) { + switch ((*ci).var->kind()) { + case Input_Var: { + int pos = (*ci).var->get_position(); + if (pos == dim + 1) { + h1.update_coef(lb, (*ci).coef); + h2.update_coef(lb, -(*ci).coef); + } else { + h1.update_coef(stmt[*i].xform.output_var(pos), + (*ci).coef); + h2.update_coef(stmt[*i].xform.output_var(pos), + -(*ci).coef); + } + break; + } + case Global_Var: { + Global_Var_ID g = (*ci).var->get_global_var(); + Variable_ID v; + if (g->arity() == 0) + v = stmt[*i].xform.get_local(g); + else + v = stmt[*i].xform.get_local(g, + (*ci).var->function_of()); + h1.update_coef(v, (*ci).coef); + h2.update_coef(v, -(*ci).coef); + break; + } + default: + throw loop_error("cannot handle tile bounds"); + } + } + h1.update_const(lb_list[simplest_lb].get_const()); + h2.update_const(-lb_list[simplest_lb].get_const()); + h2.update_const(coef - 1); + } + + Variable_ID offset_lb; + if (alignment_offset == 0) + offset_lb = lb; + else { + EQ_Handle h = f_root->add_EQ(); + offset_lb = f_exists->declare(); + h.update_coef(offset_lb, 1); + h.update_coef(lb, -1); + h.update_const(alignment_offset); + } + + if (alignment_multiple == 1) { // trivial + aligned_lb = offset_lb; + } else { // e.g. to align at 4, aligned_lb = 4*alpha && LB-4 < 4*alpha <= LB + aligned_lb = f_exists->declare(); + Variable_ID e = f_exists->declare(); + + EQ_Handle h = f_root->add_EQ(); + h.update_coef(aligned_lb, 1); + h.update_coef(e, -alignment_multiple); + + GEQ_Handle h1 = f_root->add_GEQ(); + GEQ_Handle h2 = f_root->add_GEQ(); + h1.update_coef(e, alignment_multiple); + h2.update_coef(e, -alignment_multiple); + h1.update_coef(offset_lb, -1); + h2.update_coef(offset_lb, 1); + h1.update_const(alignment_multiple - 1); + } + } + + // create an upper bound variable for easy formula creation later + Variable_ID ub = f_exists->declare(); + { + coef_t coef = -ub_list[simplest_ub].get_coef( + bound.set_var(dim + 1)); + if (coef == 1) { // e.g. if i <= m+5, then UB = m+5 + EQ_Handle h = f_root->add_EQ(); + h.update_coef(ub, -1); + for (Constr_Vars_Iter ci(ub_list[simplest_ub]); ci; ci++) { + switch ((*ci).var->kind()) { + case Input_Var: { + int pos = (*ci).var->get_position(); + if (pos != dim + 1) + h.update_coef(stmt[*i].xform.output_var(pos), + (*ci).coef); + break; + } + case Global_Var: { + Global_Var_ID g = (*ci).var->get_global_var(); + Variable_ID v; + if (g->arity() == 0) + v = stmt[*i].xform.get_local(g); + else + v = stmt[*i].xform.get_local(g, + (*ci).var->function_of()); + h.update_coef(v, (*ci).coef); + break; + } + default: + throw loop_error("cannot handle tile bounds"); + } + } + h.update_const(ub_list[simplest_ub].get_const()); + } else { // e.g. if 2i <= m+5, then m+5-2 < 2*UB <= m+5 + GEQ_Handle h1 = f_root->add_GEQ(); + GEQ_Handle h2 = f_root->add_GEQ(); + for (Constr_Vars_Iter ci(ub_list[simplest_ub]); ci; ci++) { + switch ((*ci).var->kind()) { + case Input_Var: { + int pos = (*ci).var->get_position(); + if (pos == dim + 1) { + h1.update_coef(ub, -(*ci).coef); + h2.update_coef(ub, (*ci).coef); + } else { + h1.update_coef(stmt[*i].xform.output_var(pos), + -(*ci).coef); + h2.update_coef(stmt[*i].xform.output_var(pos), + (*ci).coef); + } + break; + } + case Global_Var: { + Global_Var_ID g = (*ci).var->get_global_var(); + Variable_ID v; + if (g->arity() == 0) + v = stmt[*i].xform.get_local(g); + else + v = stmt[*i].xform.get_local(g, + (*ci).var->function_of()); + h1.update_coef(v, -(*ci).coef); + h2.update_coef(v, (*ci).coef); + break; + } + default: + throw loop_error("cannot handle tile bounds"); + } + } + h1.update_const(-ub_list[simplest_ub].get_const()); + h2.update_const(ub_list[simplest_ub].get_const()); + h1.update_const(coef - 1); + } + } + + // insert tile controlling loop constraints + if (method == StridedTile) { // e.g. ii = LB + 32 * alpha && alpha >= 0 + Variable_ID e = f_exists->declare(); + GEQ_Handle h1 = f_root->add_GEQ(); + h1.update_coef(e, 1); + + EQ_Handle h2 = f_root->add_EQ(); + h2.update_coef(stmt[*i].xform.output_var(outer_dim + 1), 1); + h2.update_coef(e, -tile_size); + h2.update_coef(aligned_lb, -1); + } else if (method == CountedTile) { // e.g. 0 <= ii < ceiling((UB-LB+1)/32) + GEQ_Handle h1 = f_root->add_GEQ(); + h1.update_coef(stmt[*i].xform.output_var(outer_dim + 1), 1); + + GEQ_Handle h2 = f_root->add_GEQ(); + h2.update_coef(stmt[*i].xform.output_var(outer_dim + 1), + -tile_size); + h2.update_coef(aligned_lb, -1); + h2.update_coef(ub, 1); + } + + // special care for private statements like overflow assignment + if (private_stmt.find(*i) != private_stmt.end()) { // e.g. ii <= UB + GEQ_Handle h = f_root->add_GEQ(); + h.update_coef(stmt[*i].xform.output_var(outer_dim + 1), -1); + h.update_coef(ub, 1); + } + // if (private_stmt.find(*i) != private_stmt.end()) { + // if (stmt[*i].xform.n_out() > dim+3) { // e.g. ii <= UB && i = ii + // GEQ_Handle h = f_root->add_GEQ(); + // h.update_coef(stmt[*i].xform.output_var(outer_dim+1), -1); + // h.update_coef(ub, 1); + + // stmt[*i].xform = Project(stmt[*i].xform, dim+3, Output_Var); + // f_root = stmt[*i].xform.and_with_and(); + // EQ_Handle h1 = f_root->add_EQ(); + // h1.update_coef(stmt[*i].xform.output_var(dim+3), 1); + // h1.update_coef(stmt[*i].xform.output_var(outer_dim+1), -1); + // } + // else if (method == StridedTile) { // e.g. ii <= UB since i does not exist + // GEQ_Handle h = f_root->add_GEQ(); + // h.update_coef(stmt[*i].xform.output_var(outer_dim+1), -1); + // h.update_coef(ub, 1); + // } + // } + + // restrict original loop index inside the tile + else { + if (method == StridedTile) { // e.g. ii <= i < ii + tile_size + GEQ_Handle h1 = f_root->add_GEQ(); + h1.update_coef(stmt[*i].xform.output_var(dim + 3), 1); + h1.update_coef(stmt[*i].xform.output_var(outer_dim + 1), + -1); + + GEQ_Handle h2 = f_root->add_GEQ(); + h2.update_coef(stmt[*i].xform.output_var(dim + 3), -1); + h2.update_coef(stmt[*i].xform.output_var(outer_dim + 1), 1); + h2.update_const(tile_size - 1); + } else if (method == CountedTile) { // e.g. LB+32*ii <= i < LB+32*ii+tile_size + GEQ_Handle h1 = f_root->add_GEQ(); + h1.update_coef(stmt[*i].xform.output_var(outer_dim + 1), + -tile_size); + h1.update_coef(stmt[*i].xform.output_var(dim + 3), 1); + h1.update_coef(aligned_lb, -1); + + GEQ_Handle h2 = f_root->add_GEQ(); + h2.update_coef(stmt[*i].xform.output_var(outer_dim + 1), + tile_size); + h2.update_coef(stmt[*i].xform.output_var(dim + 3), -1); + h2.update_const(tile_size - 1); + h2.update_coef(aligned_lb, 1); + } + } + } + } + + // update loop level information + for (std::set::iterator i = same_tile_controlling_loop.begin(); + i != same_tile_controlling_loop.end(); i++) { + for (int j = 1; j <= stmt[*i].loop_level.size(); j++) + switch (stmt[*i].loop_level[j - 1].type) { + case LoopLevelOriginal: + break; + case LoopLevelTile: + if (stmt[*i].loop_level[j - 1].payload >= outer_level) + stmt[*i].loop_level[j - 1].payload++; + break; + default: + throw loop_error( + "unknown loop level type for statement " + + to_string(*i)); + } + + LoopLevel ll; + ll.type = LoopLevelTile; + ll.payload = level + 1; + ll.parallel_level = 0; + stmt[*i].loop_level.insert( + stmt[*i].loop_level.begin() + (outer_level - 1), ll); + } +} + diff --git a/chill/src/loop_unroll.cc b/chill/src/loop_unroll.cc new file mode 100644 index 0000000..b75b738 --- /dev/null +++ b/chill/src/loop_unroll.cc @@ -0,0 +1,1166 @@ +/* + * loop_unroll.cc + * + * Created on: Nov 12, 2012 + * Author: anand + */ + +#include +#include +#include "loop.hh" +#include "omegatools.hh" +#include "ir_code.hh" +#include "chill_error.hh" +#include + +using namespace omega; + + +std::set Loop::unroll(int stmt_num, int level, int unroll_amount, + std::vector > idxNames, + int cleanup_split_level) { + // check for sanity of parameters + // check for sanity of parameters + if (unroll_amount < 0) + throw std::invalid_argument( + "invalid unroll amount " + to_string(unroll_amount)); + if (stmt_num < 0 || stmt_num >= stmt.size()) + throw std::invalid_argument("invalid statement " + to_string(stmt_num)); + if (level <= 0 || level > stmt[stmt_num].loop_level.size()) + throw std::invalid_argument("invalid loop level " + to_string(level)); + + if (cleanup_split_level == 0) + cleanup_split_level = level; + if (cleanup_split_level > level) + throw std::invalid_argument( + "cleanup code must be split at or outside the unrolled loop level " + + to_string(level)); + if (cleanup_split_level <= 0) + throw std::invalid_argument( + "invalid split loop level " + to_string(cleanup_split_level)); + + // invalidate saved codegen computation + delete last_compute_cgr_; + last_compute_cgr_ = NULL; + delete last_compute_cg_; + last_compute_cg_ = NULL; + + int dim = 2 * level - 1; + std::vector lex = getLexicalOrder(stmt_num); + std::set same_loop = getStatements(lex, dim - 1); + + // nothing to do + if (unroll_amount == 1) + return std::set(); + + for (std::set::iterator i = same_loop.begin(); i != same_loop.end(); + i++) { + std::vector > D; + int n = stmt[*i].xform.n_out(); + for (DependenceGraph::EdgeList::iterator j = + dep.vertex[*i].second.begin(); j != dep.vertex[*i].second.end(); + j++) { + if (same_loop.find(j->first) != same_loop.end()) + for (int k = 0; k < j->second.size(); k++) { + DependenceVector dv = j->second[k]; + int dim2 = level - 1; + if (dv.type != DEP_CONTROL) { + + while (stmt[*i].loop_level[dim2].type == LoopLevelTile) { + dim2 = stmt[*i].loop_level[dim2].payload - 1; + } + dim2 = stmt[*i].loop_level[dim2].payload; + + /*if (dv.isCarried(dim2) + && (dv.hasNegative(dim2) && !dv.quasi)) + throw loop_error( + "loop error: Unrolling is illegal, dependence violation!"); + + if (dv.isCarried(dim2) + && (dv.hasPositive(dim2) && dv.quasi)) + throw loop_error( + "loop error: Unrolling is illegal, dependence violation!"); + */ + bool safe = false; + + if (dv.isCarried(dim2) && dv.hasPositive(dim2)) { + if (dv.quasi) + throw loop_error( + "loop error: a quasi dependence with a positive carried distance"); + if (!dv.quasi) { + if (dv.lbounds[dim2] != posInfinity) { + //if (dv.lbounds[dim2] != negInfinity) + if (dv.lbounds[dim2] > unroll_amount) + safe = true; + } else + safe = true; + }/* else { + if (dv.ubounds[dim2] != negInfinity) { + if (dv.ubounds[dim2] != posInfinity) + if ((-(dv.ubounds[dim2])) > unroll_amount) + safe = true; + } else + safe = true; + }*/ + + if (!safe) { + for (int l = level + 1; l <= (n - 1) / 2; l++) { + int dim3 = l - 1; + + if (stmt[*i].loop_level[dim3].type + != LoopLevelTile) + dim3 = + stmt[*i].loop_level[dim3].payload; + else { + while (stmt[*i].loop_level[dim3].type + == LoopLevelTile) { + dim3 = + stmt[*i].loop_level[dim3].payload + - 1; + } + dim3 = + stmt[*i].loop_level[dim3].payload; + } + + if (dim3 > dim2) { + + if (dv.hasPositive(dim3)) + break; + else if (dv.hasNegative(dim3)) + throw loop_error( + "loop error: Unrolling is illegal, dependence violation!"); + } + } + } + } + } + } + } + } + // extract the intersection of the iteration space to be considered + Relation hull = Relation::True(level); + apply_xform(same_loop); + for (std::set::iterator i = same_loop.begin(); i != same_loop.end(); + i++) { + if (stmt[*i].IS.is_upper_bound_satisfiable()) { + Relation mapping(stmt[*i].IS.n_set(), level); + F_And *f_root = mapping.add_and(); + for (int j = 1; j <= level; j++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.input_var(j), 1); + h.update_coef(mapping.output_var(j), -1); + } + hull = Intersection(hull, + Range(Restrict_Domain(mapping, copy(stmt[*i].IS)))); + hull.simplify(2, 4); + + } + } + for (int i = 1; i <= level; i++) { + std::string name = tmp_loop_var_name_prefix + to_string(i); + hull.name_set_var(i, name); + } + hull.setup_names(); + + // extract the exact loop bound of the dimension to be unrolled + if (is_single_loop_iteration(hull, level, this->known)) + return std::set(); + Relation bound = get_loop_bound(hull, level, this->known); + if (!bound.has_single_conjunct() || !bound.is_satisfiable() + || bound.is_tautology()) + throw loop_error("unable to extract loop bound for unrolling"); + + // extract the loop stride + coef_t stride; + std::pair result = find_simplest_stride(bound, + bound.set_var(level)); + if (result.second == NULL) + stride = 1; + else + stride = abs(result.first.get_coef(result.second)) + / gcd(abs(result.first.get_coef(result.second)), + abs(result.first.get_coef(bound.set_var(level)))); + + // separate lower and upper bounds + std::vector lb_list, ub_list; + { + Conjunct *c = bound.query_DNF()->single_conjunct(); + for (GEQ_Iterator gi(c->GEQs()); gi; gi++) { + int coef = (*gi).get_coef(bound.set_var(level)); + if (coef < 0) + ub_list.push_back(*gi); + else if (coef > 0) + lb_list.push_back(*gi); + } + } + + // simplify overflow expression for each pair of upper and lower bounds + std::vector > > overflow_table( + lb_list.size(), + std::vector >(ub_list.size(), + std::map())); + bool is_overflow_simplifiable = true; + for (int i = 0; i < lb_list.size(); i++) { + if (!is_overflow_simplifiable) + break; + + for (int j = 0; j < ub_list.size(); j++) { + // lower bound or upper bound has non-unit coefficient, can't simplify + if (ub_list[j].get_coef(bound.set_var(level)) != -1 + || lb_list[i].get_coef(bound.set_var(level)) != 1) { + is_overflow_simplifiable = false; + break; + } + + for (Constr_Vars_Iter ci(ub_list[j]); ci; ci++) { + switch ((*ci).var->kind()) { + case Input_Var: { + if ((*ci).var != bound.set_var(level)) + overflow_table[i][j][(*ci).var] += (*ci).coef; + + break; + } + case Global_Var: { + Global_Var_ID g = (*ci).var->get_global_var(); + Variable_ID v; + if (g->arity() == 0) + v = bound.get_local(g); + else + v = bound.get_local(g, (*ci).var->function_of()); + overflow_table[i][j][(*ci).var] += (*ci).coef; + break; + } + default: + throw loop_error("failed to calculate overflow amount"); + } + } + overflow_table[i][j][NULL] += ub_list[j].get_const(); + + for (Constr_Vars_Iter ci(lb_list[i]); ci; ci++) { + switch ((*ci).var->kind()) { + case Input_Var: { + if ((*ci).var != bound.set_var(level)) { + overflow_table[i][j][(*ci).var] += (*ci).coef; + if (overflow_table[i][j][(*ci).var] == 0) + overflow_table[i][j].erase( + overflow_table[i][j].find((*ci).var)); + } + break; + } + case Global_Var: { + Global_Var_ID g = (*ci).var->get_global_var(); + Variable_ID v; + if (g->arity() == 0) + v = bound.get_local(g); + else + v = bound.get_local(g, (*ci).var->function_of()); + overflow_table[i][j][(*ci).var] += (*ci).coef; + if (overflow_table[i][j][(*ci).var] == 0) + overflow_table[i][j].erase( + overflow_table[i][j].find((*ci).var)); + break; + } + default: + throw loop_error("failed to calculate overflow amount"); + } + } + overflow_table[i][j][NULL] += lb_list[i].get_const(); + + overflow_table[i][j][NULL] += stride; + if (unroll_amount == 0 + || (overflow_table[i][j].size() == 1 + && overflow_table[i][j][NULL] / stride + < unroll_amount)) + unroll_amount = overflow_table[i][j][NULL] / stride; + } + } + + // loop iteration count can't be determined, bail out gracefully + if (unroll_amount == 0) + return std::set(); + + // further simply overflow calculation using coefficients' modular + if (is_overflow_simplifiable) { + for (int i = 0; i < lb_list.size(); i++) + for (int j = 0; j < ub_list.size(); j++) + if (stride == 1) { + for (std::map::iterator k = + overflow_table[i][j].begin(); + k != overflow_table[i][j].end();) + if ((*k).first != NULL) { + int t = int_mod_hat((*k).second, unroll_amount); + if (t == 0) { + overflow_table[i][j].erase(k++); + } else { + int t2 = hull.query_variable_mod((*k).first, + unroll_amount); + if (t2 != INT_MAX) { + overflow_table[i][j][NULL] += t * t2; + overflow_table[i][j].erase(k++); + } else { + (*k).second = t; + k++; + } + } + } else + k++; + + overflow_table[i][j][NULL] = int_mod_hat( + overflow_table[i][j][NULL], unroll_amount); + + // Since we don't have MODULO instruction in SUIF yet (only MOD), make all coef positive in the final formula + for (std::map::iterator k = + overflow_table[i][j].begin(); + k != overflow_table[i][j].end(); k++) + if ((*k).second < 0) + (*k).second += unroll_amount; + } + } + + // build overflow statement + CG_outputBuilder *ocg = ir->builder(); + CG_outputRepr *overflow_code = NULL; + Relation cond_upper(level), cond_lower(level); + Relation overflow_constraint(0); + F_And *overflow_constraint_root = overflow_constraint.add_and(); + std::vector over_var_list; + if (is_overflow_simplifiable && lb_list.size() == 1) { + for (int i = 0; i < ub_list.size(); i++) { + if (overflow_table[0][i].size() == 1) { + // upper splitting condition + GEQ_Handle h = cond_upper.and_with_GEQ(ub_list[i]); + h.update_const( + ((overflow_table[0][i][NULL] / stride) % unroll_amount) + * -stride); + } else { + // upper splitting condition + std::string over_name = overflow_var_name_prefix + + to_string(overflow_var_name_counter++); + Free_Var_Decl *over_free_var = new Free_Var_Decl(over_name); + over_var_list.push_back(over_free_var); + GEQ_Handle h = cond_upper.and_with_GEQ(ub_list[i]); + h.update_coef(cond_upper.get_local(over_free_var), -stride); + + // insert constraint 0 <= overflow < unroll_amount + Variable_ID v = overflow_constraint.get_local(over_free_var); + GEQ_Handle h1 = overflow_constraint_root->add_GEQ(); + h1.update_coef(v, 1); + GEQ_Handle h2 = overflow_constraint_root->add_GEQ(); + h2.update_coef(v, -1); + h2.update_const(unroll_amount - 1); + + // create overflow assignment + bound.setup_names(); // hack to fix omega relation variable names issue + CG_outputRepr *rhs = NULL; + bool is_split_illegal = false; + for (std::map::iterator j = + overflow_table[0][i].begin(); + j != overflow_table[0][i].end(); j++) + if ((*j).first != NULL) { + if ((*j).first->kind() == Input_Var + && (*j).first->get_position() + >= cleanup_split_level) + is_split_illegal = true; + + CG_outputRepr *t = ocg->CreateIdent((*j).first->name()); + if ((*j).second != 1) + t = ocg->CreateTimes(ocg->CreateInt((*j).second), + t); + rhs = ocg->CreatePlus(rhs, t); + } else if ((*j).second != 0) + rhs = ocg->CreatePlus(rhs, ocg->CreateInt((*j).second)); + + if (is_split_illegal) { + rhs->clear(); + delete rhs; + throw loop_error( + "cannot split cleanup code at loop level " + + to_string(cleanup_split_level) + + " due to overflow variable data dependence"); + } + + if (stride != 1) + rhs = ocg->CreateIntegerCeil(rhs, ocg->CreateInt(stride)); + rhs = ocg->CreateIntegerMod(rhs, ocg->CreateInt(unroll_amount)); + + CG_outputRepr *lhs = ocg->CreateIdent(over_name); + init_code = ocg->StmtListAppend(init_code, + ocg->CreateAssignment(0, lhs, ocg->CreateInt(0))); + lhs = ocg->CreateIdent(over_name); + overflow_code = ocg->StmtListAppend(overflow_code, + ocg->CreateAssignment(0, lhs, rhs)); + } + } + + // lower splitting condition + GEQ_Handle h = cond_lower.and_with_GEQ(lb_list[0]); + } else if (is_overflow_simplifiable && ub_list.size() == 1) { + for (int i = 0; i < lb_list.size(); i++) { + + if (overflow_table[i][0].size() == 1) { + // lower splitting condition + GEQ_Handle h = cond_lower.and_with_GEQ(lb_list[i]); + h.update_const(overflow_table[i][0][NULL] * -stride); + } else { + // lower splitting condition + std::string over_name = overflow_var_name_prefix + + to_string(overflow_var_name_counter++); + Free_Var_Decl *over_free_var = new Free_Var_Decl(over_name); + over_var_list.push_back(over_free_var); + GEQ_Handle h = cond_lower.and_with_GEQ(lb_list[i]); + h.update_coef(cond_lower.get_local(over_free_var), -stride); + + // insert constraint 0 <= overflow < unroll_amount + Variable_ID v = overflow_constraint.get_local(over_free_var); + GEQ_Handle h1 = overflow_constraint_root->add_GEQ(); + h1.update_coef(v, 1); + GEQ_Handle h2 = overflow_constraint_root->add_GEQ(); + h2.update_coef(v, -1); + h2.update_const(unroll_amount - 1); + + // create overflow assignment + bound.setup_names(); // hack to fix omega relation variable names issue + CG_outputRepr *rhs = NULL; + for (std::map::iterator j = + overflow_table[0][i].begin(); + j != overflow_table[0][i].end(); j++) + if ((*j).first != NULL) { + CG_outputRepr *t = ocg->CreateIdent((*j).first->name()); + if ((*j).second != 1) + t = ocg->CreateTimes(ocg->CreateInt((*j).second), + t); + rhs = ocg->CreatePlus(rhs, t); + } else if ((*j).second != 0) + rhs = ocg->CreatePlus(rhs, ocg->CreateInt((*j).second)); + + if (stride != 1) + rhs = ocg->CreateIntegerCeil(rhs, ocg->CreateInt(stride)); + rhs = ocg->CreateIntegerMod(rhs, ocg->CreateInt(unroll_amount)); + + CG_outputRepr *lhs = ocg->CreateIdent(over_name); + init_code = ocg->StmtListAppend(init_code, + ocg->CreateAssignment(0, lhs, ocg->CreateInt(0))); + lhs = ocg->CreateIdent(over_name); + overflow_code = ocg->StmtListAppend(overflow_code, + ocg->CreateAssignment(0, lhs, rhs)); + } + } + + // upper splitting condition + GEQ_Handle h = cond_upper.and_with_GEQ(ub_list[0]); + } else { + std::string over_name = overflow_var_name_prefix + + to_string(overflow_var_name_counter++); + Free_Var_Decl *over_free_var = new Free_Var_Decl(over_name); + over_var_list.push_back(over_free_var); + + std::vector lb_repr_list, ub_repr_list; + for (int i = 0; i < lb_list.size(); i++) { + lb_repr_list.push_back( + output_lower_bound_repr(ocg, lb_list[i], + bound.set_var(dim + 1), result.first, result.second, + bound, Relation::True(bound.n_set()), + std::vector >( + bound.n_set(), + std::make_pair( + static_cast(NULL), + 0)))); + GEQ_Handle h = cond_lower.and_with_GEQ(lb_list[i]); + } + for (int i = 0; i < ub_list.size(); i++) { + ub_repr_list.push_back( + output_upper_bound_repr(ocg, ub_list[i], + bound.set_var(dim + 1), bound, + std::vector >( + bound.n_set(), + std::make_pair( + static_cast(NULL), + 0)))); + GEQ_Handle h = cond_upper.and_with_GEQ(ub_list[i]); + h.update_coef(cond_upper.get_local(over_free_var), -stride); + } + + CG_outputRepr *lbRepr, *ubRepr; + if (lb_repr_list.size() > 1) + lbRepr = ocg->CreateInvoke("max", lb_repr_list); + else if (lb_repr_list.size() == 1) + lbRepr = lb_repr_list[0]; + + if (ub_repr_list.size() > 1) + ubRepr = ocg->CreateInvoke("min", ub_repr_list); + else if (ub_repr_list.size() == 1) + ubRepr = ub_repr_list[0]; + + // create overflow assignment + CG_outputRepr *rhs = ocg->CreatePlus(ocg->CreateMinus(ubRepr, lbRepr), + ocg->CreateInt(1)); + if (stride != 1) + rhs = ocg->CreateIntegerFloor(rhs, ocg->CreateInt(stride)); + rhs = ocg->CreateIntegerMod(rhs, ocg->CreateInt(unroll_amount)); + CG_outputRepr *lhs = ocg->CreateIdent(over_name); + init_code = ocg->StmtListAppend(init_code, + ocg->CreateAssignment(0, lhs, ocg->CreateInt(0))); + lhs = ocg->CreateIdent(over_name); + overflow_code = ocg->CreateAssignment(0, lhs, rhs); + + // insert constraint 0 <= overflow < unroll_amount + Variable_ID v = overflow_constraint.get_local(over_free_var); + GEQ_Handle h1 = overflow_constraint_root->add_GEQ(); + h1.update_coef(v, 1); + GEQ_Handle h2 = overflow_constraint_root->add_GEQ(); + h2.update_coef(v, -1); + h2.update_const(unroll_amount - 1); + } + + // insert overflow statement + int overflow_stmt_num = -1; + if (overflow_code != NULL) { + // build iteration space for overflow statement + Relation mapping(level, cleanup_split_level - 1); + F_And *f_root = mapping.add_and(); + for (int i = 1; i < cleanup_split_level; i++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.output_var(i), 1); + h.update_coef(mapping.input_var(i), -1); + } + Relation overflow_IS = Range(Restrict_Domain(mapping, copy(hull))); + for (int i = 1; i < cleanup_split_level; i++) + overflow_IS.name_set_var(i, hull.set_var(i)->name()); + overflow_IS.setup_names(); + + // build dumb transformation relation for overflow statement + Relation overflow_xform(cleanup_split_level - 1, + 2 * (cleanup_split_level - 1) + 1); + f_root = overflow_xform.add_and(); + for (int i = 1; i <= cleanup_split_level - 1; i++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(overflow_xform.output_var(2 * i), 1); + h.update_coef(overflow_xform.input_var(i), -1); + + h = f_root->add_EQ(); + h.update_coef(overflow_xform.output_var(2 * i - 1), 1); + h.update_const(-lex[2 * i - 2]); + } + EQ_Handle h = f_root->add_EQ(); + h.update_coef( + overflow_xform.output_var(2 * (cleanup_split_level - 1) + 1), + 1); + h.update_const(-lex[2 * (cleanup_split_level - 1)]); + + shiftLexicalOrder(lex, 2 * cleanup_split_level - 2, 1); + Statement overflow_stmt; + + overflow_stmt.code = overflow_code; + overflow_stmt.IS = overflow_IS; + overflow_stmt.xform = overflow_xform; + overflow_stmt.loop_level = std::vector(level - 1); + overflow_stmt.ir_stmt_node = NULL; + for (int i = 0; i < level - 1; i++) { + overflow_stmt.loop_level[i].type = + stmt[stmt_num].loop_level[i].type; + if (stmt[stmt_num].loop_level[i].type == LoopLevelTile + && stmt[stmt_num].loop_level[i].payload >= level) + overflow_stmt.loop_level[i].payload = -1; + else + overflow_stmt.loop_level[i].payload = + stmt[stmt_num].loop_level[i].payload; + overflow_stmt.loop_level[i].parallel_level = + stmt[stmt_num].loop_level[i].parallel_level; + } + + stmt.push_back(overflow_stmt); + dep.insert(); + overflow_stmt_num = stmt.size() - 1; + overflow[overflow_stmt_num] = over_var_list; + + // update the global known information on overflow variable + this->known = Intersection(this->known, + Extend_Set(copy(overflow_constraint), + this->known.n_set() - overflow_constraint.n_set())); + + // update dependence graph + DependenceVector dv; + dv.type = DEP_CONTROL; + for (std::set::iterator i = same_loop.begin(); + i != same_loop.end(); i++) + dep.connect(overflow_stmt_num, *i, dv); + dv.type = DEP_W2W; + { + IR_ScalarSymbol *overflow_sym = NULL; + std::vector scalars = ir->FindScalarRef( + overflow_code); + for (int i = scalars.size() - 1; i >= 0; i--) + if (scalars[i]->is_write()) { + overflow_sym = scalars[i]->symbol(); + break; + } + for (int i = scalars.size() - 1; i >= 0; i--) + delete scalars[i]; + dv.sym = overflow_sym; + } + dv.lbounds = std::vector(dep.num_dim(), 0); + dv.ubounds = std::vector(dep.num_dim(), 0); + int dep_dim = get_last_dep_dim_before(stmt_num, level); + for (int i = dep_dim + 1; i < dep.num_dim(); i++) { + dv.lbounds[i] = -posInfinity; + dv.ubounds[i] = posInfinity; + } + for (int i = 0; i <= dep_dim; i++) { + if (i != 0) { + dv.lbounds[i - 1] = 0; + dv.ubounds[i - 1] = 0; + } + dv.lbounds[i] = 1; + dv.ubounds[i] = posInfinity; + dep.connect(overflow_stmt_num, overflow_stmt_num, dv); + } + } + + // split the loop so it can be fully unrolled + std::set new_stmts = split(stmt_num, cleanup_split_level, cond_upper); + std::set new_stmts2 = split(stmt_num, cleanup_split_level, cond_lower); + new_stmts.insert(new_stmts2.begin(), new_stmts2.end()); + + // check if unrolled statements can be trivially lumped together as one statement + bool can_be_lumped = true; + if (can_be_lumped) { + for (std::set::iterator i = same_loop.begin(); + i != same_loop.end(); i++) + if (*i != stmt_num) { + if (stmt[*i].loop_level.size() + != stmt[stmt_num].loop_level.size()) { + can_be_lumped = false; + break; + } + for (int j = 0; j < stmt[stmt_num].loop_level.size(); j++) + if (!(stmt[*i].loop_level[j].type + == stmt[stmt_num].loop_level[j].type + && stmt[*i].loop_level[j].payload + == stmt[stmt_num].loop_level[j].payload)) { + can_be_lumped = false; + break; + } + if (!can_be_lumped) + break; + std::vector lex2 = getLexicalOrder(*i); + for (int j = 2 * level; j < lex.size() - 1; j += 2) + if (lex[j] != lex2[j]) { + can_be_lumped = false; + break; + } + if (!can_be_lumped) + break; + } + } + if (can_be_lumped) { + for (std::set::iterator i = same_loop.begin(); + i != same_loop.end(); i++) + if (is_inner_loop_depend_on_level(stmt[*i].IS, level, + this->known)) { + can_be_lumped = false; + break; + } + } + if (can_be_lumped) { + for (std::set::iterator i = same_loop.begin(); + i != same_loop.end(); i++) + if (*i != stmt_num) { + if (!(Must_Be_Subset(copy(stmt[*i].IS), copy(stmt[stmt_num].IS)) + && Must_Be_Subset(copy(stmt[stmt_num].IS), + copy(stmt[*i].IS)))) { + can_be_lumped = false; + break; + } + } + } + if (can_be_lumped) { + for (std::set::iterator i = same_loop.begin(); + i != same_loop.end(); i++) { + for (DependenceGraph::EdgeList::iterator j = + dep.vertex[*i].second.begin(); + j != dep.vertex[*i].second.end(); j++) + if (same_loop.find(j->first) != same_loop.end()) { + for (int k = 0; k < j->second.size(); k++) + if (j->second[k].type == DEP_CONTROL + || j->second[k].type == DEP_UNKNOWN) { + can_be_lumped = false; + break; + } + if (!can_be_lumped) + break; + } + if (!can_be_lumped) + break; + } + } + + // insert unrolled statements + int old_num_stmt = stmt.size(); + if (!can_be_lumped) { + std::map > what_stmt_num; + + for (int j = 1; j < unroll_amount; j++) { + for (std::set::iterator i = same_loop.begin(); + i != same_loop.end(); i++) { + Statement new_stmt; + + std::vector loop_vars; + std::vector subs; + loop_vars.push_back(stmt[*i].IS.set_var(level)->name()); + subs.push_back( + ocg->CreatePlus( + ocg->CreateIdent( + stmt[*i].IS.set_var(level)->name()), + ocg->CreateInt(j * stride))); + new_stmt.code = ocg->CreateSubstitutedStmt(0, + stmt[*i].code->clone(), loop_vars, subs); + + new_stmt.IS = adjust_loop_bound(stmt[*i].IS, level, j * stride); + add_loop_stride(new_stmt.IS, bound, level - 1, + unroll_amount * stride); + + new_stmt.xform = copy(stmt[*i].xform); + + new_stmt.loop_level = stmt[*i].loop_level; + new_stmt.ir_stmt_node = NULL; + stmt.push_back(new_stmt); + dep.insert(); + what_stmt_num[*i].push_back(stmt.size() - 1); + } + } + for (std::set::iterator i = same_loop.begin(); + i != same_loop.end(); i++) + add_loop_stride(stmt[*i].IS, bound, level - 1, + unroll_amount * stride); + + // update dependence graph + if (stmt[stmt_num].loop_level[level - 1].type == LoopLevelOriginal) { + int dep_dim = stmt[stmt_num].loop_level[level - 1].payload; + int new_stride = unroll_amount * stride; + for (int i = 0; i < old_num_stmt; i++) { + std::vector > D; + + for (DependenceGraph::EdgeList::iterator j = + dep.vertex[i].second.begin(); + j != dep.vertex[i].second.end();) { + if (same_loop.find(i) != same_loop.end()) { + if (same_loop.find(j->first) != same_loop.end()) { + for (int k = 0; k < j->second.size(); k++) { + DependenceVector dv = j->second[k]; + if (dv.type == DEP_CONTROL + || dv.type == DEP_UNKNOWN) { + D.push_back(std::make_pair(j->first, dv)); + for (int kk = 0; kk < unroll_amount - 1; + kk++) + if (what_stmt_num[i][kk] != -1 + && what_stmt_num[j->first][kk] + != -1) + dep.connect(what_stmt_num[i][kk], + what_stmt_num[j->first][kk], + dv); + } else { + coef_t lb = dv.lbounds[dep_dim]; + coef_t ub = dv.ubounds[dep_dim]; + if (ub == lb + && int_mod(lb, + static_cast(new_stride)) + == 0) { + D.push_back( + std::make_pair(j->first, dv)); + for (int kk = 0; kk < unroll_amount - 1; + kk++) + if (what_stmt_num[i][kk] != -1 + && what_stmt_num[j->first][kk] + != -1) + dep.connect( + what_stmt_num[i][kk], + what_stmt_num[j->first][kk], + dv); + } else if (lb == -posInfinity + && ub == posInfinity) { + D.push_back( + std::make_pair(j->first, dv)); + for (int kk = 0; kk < unroll_amount; + kk++) + if (kk == 0) + D.push_back( + std::make_pair(j->first, + dv)); + else if (what_stmt_num[j->first][kk + - 1] != -1) + D.push_back( + std::make_pair( + what_stmt_num[j->first][kk + - 1], + dv)); + for (int t = 0; t < unroll_amount - 1; + t++) + if (what_stmt_num[i][t] != -1) + for (int kk = 0; + kk < unroll_amount; + kk++) + if (kk == 0) + dep.connect( + what_stmt_num[i][t], + j->first, dv); + else if (what_stmt_num[j->first][kk + - 1] != -1) + dep.connect( + what_stmt_num[i][t], + what_stmt_num[j->first][kk + - 1], + dv); + } else { + for (int kk = 0; kk < unroll_amount; + kk++) { + if (lb != -posInfinity) { + if (kk * stride + < int_mod(lb, + static_cast(new_stride))) + dv.lbounds[dep_dim] = + floor( + static_cast(lb) + / new_stride) + * new_stride + + new_stride; + else + dv.lbounds[dep_dim] = + floor( + static_cast(lb) + / new_stride) + * new_stride; + } + if (ub != posInfinity) { + if (kk * stride + > int_mod(ub, + static_cast(new_stride))) + dv.ubounds[dep_dim] = + floor( + static_cast(ub) + / new_stride) + * new_stride + - new_stride; + else + dv.ubounds[dep_dim] = + floor( + static_cast(ub) + / new_stride) + * new_stride; + } + if (dv.ubounds[dep_dim] + >= dv.lbounds[dep_dim]) { + if (kk == 0) + D.push_back( + std::make_pair( + j->first, + dv)); + else if (what_stmt_num[j->first][kk + - 1] != -1) + D.push_back( + std::make_pair( + what_stmt_num[j->first][kk + - 1], + dv)); + } + } + for (int t = 0; t < unroll_amount - 1; + t++) + if (what_stmt_num[i][t] != -1) + for (int kk = 0; + kk < unroll_amount; + kk++) { + if (lb != -posInfinity) { + if (kk * stride + < int_mod( + lb + t + + 1, + static_cast(new_stride))) + dv.lbounds[dep_dim] = + floor( + static_cast(lb + + (t + + 1) + * stride) + / new_stride) + * new_stride + + new_stride; + else + dv.lbounds[dep_dim] = + floor( + static_cast(lb + + (t + + 1) + * stride) + / new_stride) + * new_stride; + } + if (ub != posInfinity) { + if (kk * stride + > int_mod( + ub + t + + 1, + static_cast(new_stride))) + dv.ubounds[dep_dim] = + floor( + static_cast(ub + + (t + + 1) + * stride) + / new_stride) + * new_stride + - new_stride; + else + dv.ubounds[dep_dim] = + floor( + static_cast(ub + + (t + + 1) + * stride) + / new_stride) + * new_stride; + } + if (dv.ubounds[dep_dim] + >= dv.lbounds[dep_dim]) { + if (kk == 0) + dep.connect( + what_stmt_num[i][t], + j->first, + dv); + else if (what_stmt_num[j->first][kk + - 1] != -1) + dep.connect( + what_stmt_num[i][t], + what_stmt_num[j->first][kk + - 1], + dv); + } + } + } + } + } + + dep.vertex[i].second.erase(j++); + } else { + for (int kk = 0; kk < unroll_amount - 1; kk++) + if (what_stmt_num[i][kk] != -1) + dep.connect(what_stmt_num[i][kk], j->first, + j->second); + + j++; + } + } else { + if (same_loop.find(j->first) != same_loop.end()) + for (int k = 0; k < j->second.size(); k++) + for (int kk = 0; kk < unroll_amount - 1; kk++) + if (what_stmt_num[j->first][kk] != -1) + D.push_back( + std::make_pair( + what_stmt_num[j->first][kk], + j->second[k])); + j++; + } + } + + for (int j = 0; j < D.size(); j++) + dep.connect(i, D[j].first, D[j].second); + } + } + + // reset lexical order for the unrolled loop body + std::set new_same_loop; + + int count = 0; + + for (std::map >::iterator i = + what_stmt_num.begin(); i != what_stmt_num.end(); i++) { + + new_same_loop.insert(i->first); + for (int k = dim + 1; k < stmt[i->first].xform.n_out(); k += 2) + assign_const(stmt[i->first].xform, k, + get_const(stmt[(what_stmt_num.begin())->first].xform, k, + Output_Var) + count); + count++; + for (int j = 0; j < i->second.size(); j++) { + new_same_loop.insert(i->second[j]); + for (int k = dim + 1; k < stmt[i->second[j]].xform.n_out(); k += + 2) + assign_const(stmt[i->second[j]].xform, k, + get_const( + stmt[(what_stmt_num.begin())->first].xform, + k, Output_Var) + count); + count++; + } + } + setLexicalOrder(dim + 1, new_same_loop, 0, idxNames); + } else { + for (std::set::iterator i = same_loop.begin(); + i != same_loop.end(); i++) + add_loop_stride(stmt[*i].IS, bound, level - 1, + unroll_amount * stride); + + int max_level = stmt[stmt_num].loop_level.size(); + std::vector > stmt_order; + for (std::set::iterator i = same_loop.begin(); + i != same_loop.end(); i++) + stmt_order.push_back( + std::make_pair( + get_const(stmt[*i].xform, 2 * max_level, + Output_Var), *i)); + sort(stmt_order.begin(), stmt_order.end()); + + Statement new_stmt; + new_stmt.code = NULL; + for (int j = 1; j < unroll_amount; j++) + for (int i = 0; i < stmt_order.size(); i++) { + std::vector loop_vars; + std::vector subs; + loop_vars.push_back( + stmt[stmt_order[i].second].IS.set_var(level)->name()); + subs.push_back( + ocg->CreatePlus( + ocg->CreateIdent( + stmt[stmt_order[i].second].IS.set_var( + level)->name()), + ocg->CreateInt(j * stride))); + CG_outputRepr *code = ocg->CreateSubstitutedStmt(0, + stmt[stmt_order[i].second].code->clone(), loop_vars, + subs); + new_stmt.code = ocg->StmtListAppend(new_stmt.code, code); + } + + new_stmt.IS = copy(stmt[stmt_num].IS); + new_stmt.xform = copy(stmt[stmt_num].xform); + assign_const(new_stmt.xform, 2 * max_level, + stmt_order[stmt_order.size() - 1].first + 1); + new_stmt.loop_level = stmt[stmt_num].loop_level; + new_stmt.ir_stmt_node = NULL; + stmt.push_back(new_stmt); + dep.insert(); + + // update dependence graph + if (stmt[stmt_num].loop_level[level - 1].type == LoopLevelOriginal) { + int dep_dim = stmt[stmt_num].loop_level[level - 1].payload; + int new_stride = unroll_amount * stride; + for (int i = 0; i < old_num_stmt; i++) { + std::vector > > D; + + for (DependenceGraph::EdgeList::iterator j = + dep.vertex[i].second.begin(); + j != dep.vertex[i].second.end();) { + if (same_loop.find(i) != same_loop.end()) { + if (same_loop.find(j->first) != same_loop.end()) { + std::vector dvs11, dvs12, dvs22, + dvs21; + for (int k = 0; k < j->second.size(); k++) { + DependenceVector dv = j->second[k]; + if (dv.type == DEP_CONTROL + || dv.type == DEP_UNKNOWN) { + if (i == j->first) { + dvs11.push_back(dv); + dvs22.push_back(dv); + } else + throw loop_error( + "unrolled statements lumped together illegally"); + } else { + coef_t lb = dv.lbounds[dep_dim]; + coef_t ub = dv.ubounds[dep_dim]; + if (ub == lb + && int_mod(lb, + static_cast(new_stride)) + == 0) { + dvs11.push_back(dv); + dvs22.push_back(dv); + } else { + if (lb != -posInfinity) + dv.lbounds[dep_dim] = ceil( + static_cast(lb) + / new_stride) + * new_stride; + if (ub != posInfinity) + dv.ubounds[dep_dim] = floor( + static_cast(ub) + / new_stride) + * new_stride; + if (dv.ubounds[dep_dim] + >= dv.lbounds[dep_dim]) + dvs11.push_back(dv); + + if (lb != -posInfinity) + dv.lbounds[dep_dim] = ceil( + static_cast(lb) + / new_stride) + * new_stride; + if (ub != posInfinity) + dv.ubounds[dep_dim] = ceil( + static_cast(ub) + / new_stride) + * new_stride; + if (dv.ubounds[dep_dim] + >= dv.lbounds[dep_dim]) + dvs21.push_back(dv); + + if (lb != -posInfinity) + dv.lbounds[dep_dim] = floor( + static_cast(lb) + / new_stride) + * new_stride; + if (ub != posInfinity) + dv.ubounds[dep_dim] = floor( + static_cast(ub + - stride) + / new_stride) + * new_stride; + if (dv.ubounds[dep_dim] + >= dv.lbounds[dep_dim]) + dvs12.push_back(dv); + + if (lb != -posInfinity) + dv.lbounds[dep_dim] = floor( + static_cast(lb) + / new_stride) + * new_stride; + if (ub != posInfinity) + dv.ubounds[dep_dim] = ceil( + static_cast(ub + - stride) + / new_stride) + * new_stride; + if (dv.ubounds[dep_dim] + >= dv.lbounds[dep_dim]) + dvs22.push_back(dv); + } + } + } + if (dvs11.size() > 0) + D.push_back(std::make_pair(i, dvs11)); + if (dvs22.size() > 0) + dep.connect(old_num_stmt, old_num_stmt, dvs22); + if (dvs12.size() > 0) + D.push_back( + std::make_pair(old_num_stmt, dvs12)); + if (dvs21.size() > 0) + dep.connect(old_num_stmt, i, dvs21); + + dep.vertex[i].second.erase(j++); + } else { + dep.connect(old_num_stmt, j->first, j->second); + j++; + } + } else { + if (same_loop.find(j->first) != same_loop.end()) + D.push_back( + std::make_pair(old_num_stmt, j->second)); + j++; + } + } + + for (int j = 0; j < D.size(); j++) + dep.connect(i, D[j].first, D[j].second); + } + } + } + + return new_stmts; +} + + diff --git a/chill/src/omegatools.cc b/chill/src/omegatools.cc new file mode 100644 index 0000000..d88fd2a --- /dev/null +++ b/chill/src/omegatools.cc @@ -0,0 +1,2312 @@ +/***************************************************************************** + Copyright (C) 2008 University of Southern California + Copyright (C) 2009-2010 University of Utah + All Rights Reserved. + + Purpose: + Useful tools involving Omega manipulation. + + Notes: + + History: + 01/2006 Created by Chun Chen. + 03/2009 Upgrade Omega's interaction with compiler to IR_Code, by Chun Chen. +*****************************************************************************/ + +#include +// #include +#include "omegatools.hh" +#include "ir_code.hh" +#include "chill_error.hh" + +using namespace omega; + +namespace { + struct DependenceLevel { + Relation r; + int level; + int dir; // direction upto current level: + // -1:negative, 0: undetermined, 1: postive + std::vector lbounds; + std::vector ubounds; + DependenceLevel(const Relation &_r, int _dims): + r(_r), level(0), dir(0), lbounds(_dims), ubounds(_dims) {} + }; +} + + + + +std::string tmp_e() { + static int counter = 1; + return std::string("e")+to_string(counter++); +} + + + +//----------------------------------------------------------------------------- +// Convert expression tree to omega relation. "destroy" means shallow +// deallocation of "repr", not freeing the actual code inside. +// ----------------------------------------------------------------------------- +void exp2formula(IR_Code *ir, Relation &r, F_And *f_root, std::vector &freevars, + CG_outputRepr *repr, Variable_ID lhs, char side, IR_CONDITION_TYPE rel, bool destroy) { + +// void exp2formula(IR_Code *ir, Relation &r, F_And *f_root, std::vector &freevars, +// CG_outputRepr *repr, Variable_ID lhs, char side, char rel, bool destroy) { + + switch (ir->QueryExpOperation(repr)) { + case IR_OP_CONSTANT: + { + std::vector v = ir->QueryExpOperand(repr); + IR_ConstantRef *ref = static_cast(ir->Repr2Ref(v[0])); + if (!ref->is_integer()) + throw ir_exp_error("non-integer constant coefficient"); + + coef_t c = ref->integer(); + if (rel == IR_COND_GE || rel == IR_COND_GT) { + GEQ_Handle h = f_root->add_GEQ(); + h.update_coef(lhs, 1); + if (rel == IR_COND_GE) + h.update_const(-c); + else + h.update_const(-c-1); + } + else if (rel == IR_COND_LE || rel == IR_COND_LT) { + GEQ_Handle h = f_root->add_GEQ(); + h.update_coef(lhs, -1); + if (rel == IR_COND_LE) + h.update_const(c); + else + h.update_const(c-1); + } + else if (rel == IR_COND_EQ) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(lhs, 1); + h.update_const(-c); + } + else + throw std::invalid_argument("unsupported condition type"); + + delete v[0]; + delete ref; + if (destroy) + delete repr; + break; + } + case IR_OP_VARIABLE: + { + std::vector v = ir->QueryExpOperand(repr); + IR_ScalarRef *ref = static_cast(ir->Repr2Ref(v[0])); + + std::string s = ref->name(); + Variable_ID e = find_index(r, s, side); + + if (e == NULL) { // must be free variable + Free_Var_Decl *t = NULL; + for (unsigned i = 0; i < freevars.size(); i++) { + std::string ss = freevars[i]->base_name(); + if (s == ss) { + t = freevars[i]; + break; + } + } + + if (t == NULL) { + t = new Free_Var_Decl(s); + freevars.insert(freevars.end(), t); + } + + e = r.get_local(t); + } + + if (rel == IR_COND_GE || rel == IR_COND_GT) { + GEQ_Handle h = f_root->add_GEQ(); + h.update_coef(lhs, 1); + h.update_coef(e, -1); + if (rel == IR_COND_GT) + h.update_const(-1); + } + else if (rel == IR_COND_LE || rel == IR_COND_LT) { + GEQ_Handle h = f_root->add_GEQ(); + h.update_coef(lhs, -1); + h.update_coef(e, 1); + if (rel == IR_COND_LT) + h.update_const(-1); + } + else if (rel == IR_COND_EQ) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(lhs, 1); + h.update_coef(e, -1); + } + else + throw std::invalid_argument("unsupported condition type"); + + // delete v[0]; + delete ref; + if (destroy) + delete repr; + break; + } + case IR_OP_ASSIGNMENT: + { + std::vector v = ir->QueryExpOperand(repr); + exp2formula(ir, r, f_root, freevars, v[0], lhs, side, rel, true); + if (destroy) + delete repr; + break; + } + case IR_OP_PLUS: + { + F_Exists *f_exists = f_root->add_exists(); + Variable_ID e1 = f_exists->declare(tmp_e()); + Variable_ID e2 = f_exists->declare(tmp_e()); + F_And *f_and = f_exists->add_and(); + + if (rel == IR_COND_GE || rel == IR_COND_GT) { + GEQ_Handle h = f_and->add_GEQ(); + h.update_coef(lhs, 1); + h.update_coef(e1, -1); + h.update_coef(e2, -1); + if (rel == IR_COND_GT) + h.update_const(-1); + } + else if (rel == IR_COND_LE || rel == IR_COND_LT) { + GEQ_Handle h = f_and->add_GEQ(); + h.update_coef(lhs, -1); + h.update_coef(e1, 1); + h.update_coef(e2, 1); + if (rel == IR_COND_LT) + h.update_const(-1); + } + else if (rel == IR_COND_EQ) { + EQ_Handle h = f_and->add_EQ(); + h.update_coef(lhs, 1); + h.update_coef(e1, -1); + h.update_coef(e2, -1); + } + else + throw std::invalid_argument("unsupported condition type"); + + std::vector v = ir->QueryExpOperand(repr); + exp2formula(ir, r, f_and, freevars, v[0], e1, side, IR_COND_EQ, true); + exp2formula(ir, r, f_and, freevars, v[1], e2, side, IR_COND_EQ, true); + if (destroy) + delete repr; + break; + } + case IR_OP_MINUS: + { + F_Exists *f_exists = f_root->add_exists(); + Variable_ID e1 = f_exists->declare(tmp_e()); + Variable_ID e2 = f_exists->declare(tmp_e()); + F_And *f_and = f_exists->add_and(); + + if (rel == IR_COND_GE || rel == IR_COND_GT) { + GEQ_Handle h = f_and->add_GEQ(); + h.update_coef(lhs, 1); + h.update_coef(e1, -1); + h.update_coef(e2, 1); + if (rel == IR_COND_GT) + h.update_const(-1); + } + else if (rel == IR_COND_LE || rel == IR_COND_LT) { + GEQ_Handle h = f_and->add_GEQ(); + h.update_coef(lhs, -1); + h.update_coef(e1, 1); + h.update_coef(e2, -1); + if (rel == IR_COND_LT) + h.update_const(-1); + } + else if (rel == IR_COND_EQ) { + EQ_Handle h = f_and->add_EQ(); + h.update_coef(lhs, 1); + h.update_coef(e1, -1); + h.update_coef(e2, 1); + } + else + throw std::invalid_argument("unsupported condition type"); + + std::vector v = ir->QueryExpOperand(repr); + exp2formula(ir, r, f_and, freevars, v[0], e1, side, IR_COND_EQ, true); + exp2formula(ir, r, f_and, freevars, v[1], e2, side, IR_COND_EQ, true); + if (destroy) + delete repr; + break; + } + case IR_OP_MULTIPLY: + { + std::vector v = ir->QueryExpOperand(repr); + + coef_t coef; + CG_outputRepr *term; + if (ir->QueryExpOperation(v[0]) == IR_OP_CONSTANT) { + IR_ConstantRef *ref = static_cast(ir->Repr2Ref(v[0])); + coef = ref->integer(); + delete v[0]; + delete ref; + term = v[1]; + } + else if (ir->QueryExpOperation(v[1]) == IR_OP_CONSTANT) { + IR_ConstantRef *ref = static_cast(ir->Repr2Ref(v[1])); + coef = ref->integer(); + delete v[1]; + delete ref; + term = v[0]; + } + else + throw ir_exp_error("not presburger expression"); + + F_Exists *f_exists = f_root->add_exists(); + Variable_ID e = f_exists->declare(tmp_e()); + F_And *f_and = f_exists->add_and(); + + if (rel == IR_COND_GE || rel == IR_COND_GT) { + GEQ_Handle h = f_and->add_GEQ(); + h.update_coef(lhs, 1); + h.update_coef(e, -coef); + if (rel == IR_COND_GT) + h.update_const(-1); + } + else if (rel == IR_COND_LE || rel == IR_COND_LT) { + GEQ_Handle h = f_and->add_GEQ(); + h.update_coef(lhs, -1); + h.update_coef(e, coef); + if (rel == IR_COND_LT) + h.update_const(-1); + } + else if (rel == IR_COND_EQ) { + EQ_Handle h = f_and->add_EQ(); + h.update_coef(lhs, 1); + h.update_coef(e, -coef); + } + else + throw std::invalid_argument("unsupported condition type"); + + exp2formula(ir, r, f_and, freevars, term, e, side, IR_COND_EQ, true); + if (destroy) + delete repr; + break; + } + case IR_OP_DIVIDE: + { + std::vector v = ir->QueryExpOperand(repr); + + assert(ir->QueryExpOperation(v[1]) == IR_OP_CONSTANT); + IR_ConstantRef *ref = static_cast(ir->Repr2Ref(v[1])); + coef_t coef = ref->integer(); + delete v[1]; + delete ref; + + F_Exists *f_exists = f_root->add_exists(); + Variable_ID e = f_exists->declare(tmp_e()); + F_And *f_and = f_exists->add_and(); + + if (rel == IR_COND_GE || rel == IR_COND_GT) { + GEQ_Handle h = f_and->add_GEQ(); + h.update_coef(lhs, coef); + h.update_coef(e, -1); + if (rel == IR_COND_GT) + h.update_const(-1); + } + else if (rel == IR_COND_LE || rel == IR_COND_LT) { + GEQ_Handle h = f_and->add_GEQ(); + h.update_coef(lhs, -coef); + h.update_coef(e, 1); + if (rel == IR_COND_LT) + h.update_const(-1); + } + else if (rel == IR_COND_EQ) { + EQ_Handle h = f_and->add_EQ(); + h.update_coef(lhs, coef); + h.update_coef(e, -1); + } + else + throw std::invalid_argument("unsupported condition type"); + + exp2formula(ir, r, f_and, freevars, v[0], e, side, IR_COND_EQ, true); + if (destroy) + delete repr; + break; + } + case IR_OP_POSITIVE: + { + std::vector v = ir->QueryExpOperand(repr); + + exp2formula(ir, r, f_root, freevars, v[0], lhs, side, rel, true); + if (destroy) + delete repr; + break; + } + case IR_OP_NEGATIVE: + { + std::vector v = ir->QueryExpOperand(repr); + + F_Exists *f_exists = f_root->add_exists(); + Variable_ID e = f_exists->declare(tmp_e()); + F_And *f_and = f_exists->add_and(); + + if (rel == IR_COND_GE || rel == IR_COND_GT) { + GEQ_Handle h = f_and->add_GEQ(); + h.update_coef(lhs, 1); + h.update_coef(e, 1); + if (rel == IR_COND_GT) + h.update_const(-1); + } + else if (rel == IR_COND_LE || rel == IR_COND_LT) { + GEQ_Handle h = f_and->add_GEQ(); + h.update_coef(lhs, -1); + h.update_coef(e, -1); + if (rel == IR_COND_LT) + h.update_const(-1); + } + else if (rel == IR_COND_EQ) { + EQ_Handle h = f_and->add_EQ(); + h.update_coef(lhs, 1); + h.update_coef(e, 1); + } + else + throw std::invalid_argument("unsupported condition type"); + + exp2formula(ir, r, f_and, freevars, v[0], e, side, IR_COND_EQ, true); + if (destroy) + delete repr; + break; + } + case IR_OP_MIN: + { + std::vector v = ir->QueryExpOperand(repr); + + F_Exists *f_exists = f_root->add_exists(); + + if (rel == IR_COND_GE || rel == IR_COND_GT) { + F_Or *f_or = f_exists->add_and()->add_or(); + for (int i = 0; i < v.size(); i++) { + Variable_ID e = f_exists->declare(tmp_e()); + F_And *f_and = f_or->add_and(); + GEQ_Handle h = f_and->add_GEQ(); + h.update_coef(lhs, 1); + h.update_coef(e, -1); + if (rel == IR_COND_GT) + h.update_const(-1); + + exp2formula(ir, r, f_and, freevars, v[i], e, side, IR_COND_EQ, true); + } + } + else if (rel == IR_COND_LE || rel == IR_COND_LT) { + F_And *f_and = f_exists->add_and(); + for (int i = 0; i < v.size(); i++) { + Variable_ID e = f_exists->declare(tmp_e()); + GEQ_Handle h = f_and->add_GEQ(); + h.update_coef(lhs, -1); + h.update_coef(e, 1); + if (rel == IR_COND_LT) + h.update_const(-1); + + exp2formula(ir, r, f_and, freevars, v[i], e, side, IR_COND_EQ, true); + } + } + else if (rel == IR_COND_EQ) { + F_Or *f_or = f_exists->add_and()->add_or(); + for (int i = 0; i < v.size(); i++) { + Variable_ID e = f_exists->declare(tmp_e()); + F_And *f_and = f_or->add_and(); + + EQ_Handle h = f_and->add_EQ(); + h.update_coef(lhs, 1); + h.update_coef(e, -1); + + exp2formula(ir, r, f_and, freevars, v[i], e, side, IR_COND_EQ, false); + + for (int j = 0; j < v.size(); j++) + if (j != i) { + Variable_ID e2 = f_exists->declare(tmp_e()); + GEQ_Handle h2 = f_and->add_GEQ(); + h2.update_coef(e, -1); + h2.update_coef(e2, 1); + + exp2formula(ir, r, f_and, freevars, v[j], e2, side, IR_COND_EQ, false); + } + } + + for (int i = 0; i < v.size(); i++) + delete v[i]; + } + else + throw std::invalid_argument("unsupported condition type"); + + if (destroy) + delete repr; + } + case IR_OP_MAX: + { + std::vector v = ir->QueryExpOperand(repr); + + F_Exists *f_exists = f_root->add_exists(); + + if (rel == IR_COND_LE || rel == IR_COND_LT) { + F_Or *f_or = f_exists->add_and()->add_or(); + for (int i = 0; i < v.size(); i++) { + Variable_ID e = f_exists->declare(tmp_e()); + F_And *f_and = f_or->add_and(); + GEQ_Handle h = f_and->add_GEQ(); + h.update_coef(lhs, -1); + h.update_coef(e, 1); + if (rel == IR_COND_LT) + h.update_const(-1); + + exp2formula(ir, r, f_and, freevars, v[i], e, side, IR_COND_EQ, true); + } + } + else if (rel == IR_COND_GE || rel == IR_COND_GT) { + F_And *f_and = f_exists->add_and(); + for (int i = 0; i < v.size(); i++) { + Variable_ID e = f_exists->declare(tmp_e()); + GEQ_Handle h = f_and->add_GEQ(); + h.update_coef(lhs, 1); + h.update_coef(e, -1); + if (rel == IR_COND_GT) + h.update_const(-1); + + exp2formula(ir, r, f_and, freevars, v[i], e, side, IR_COND_EQ, true); + } + } + else if (rel == IR_COND_EQ) { + F_Or *f_or = f_exists->add_and()->add_or(); + for (int i = 0; i < v.size(); i++) { + Variable_ID e = f_exists->declare(tmp_e()); + F_And *f_and = f_or->add_and(); + + EQ_Handle h = f_and->add_EQ(); + h.update_coef(lhs, 1); + h.update_coef(e, -1); + + exp2formula(ir, r, f_and, freevars, v[i], e, side, IR_COND_EQ, false); + + for (int j = 0; j < v.size(); j++) + if (j != i) { + Variable_ID e2 = f_exists->declare(tmp_e()); + GEQ_Handle h2 = f_and->add_GEQ(); + h2.update_coef(e, 1); + h2.update_coef(e2, -1); + + exp2formula(ir, r, f_and, freevars, v[j], e2, side, IR_COND_EQ, false); + } + } + + for (int i = 0; i < v.size(); i++) + delete v[i]; + } + else + throw std::invalid_argument("unsupported condition type"); + + if (destroy) + delete repr; + } + case IR_OP_NULL: + break; + default: + throw ir_exp_error("unsupported operand type"); + } +} + + +//----------------------------------------------------------------------------- +// Build dependence relation for two array references. +// ----------------------------------------------------------------------------- +Relation arrays2relation(IR_Code *ir, std::vector &freevars, + const IR_ArrayRef *ref_src, const Relation &IS_w, + const IR_ArrayRef *ref_dst, const Relation &IS_r) { + Relation &IS1 = const_cast(IS_w); + Relation &IS2 = const_cast(IS_r); + + Relation r(IS1.n_set(), IS2.n_set()); + + for (int i = 1; i <= IS1.n_set(); i++) + r.name_input_var(i, IS1.set_var(i)->name()); + + for (int i = 1; i <= IS2.n_set(); i++) + r.name_output_var(i, IS2.set_var(i)->name()+"'"); + + IR_Symbol *sym_src = ref_src->symbol(); + IR_Symbol *sym_dst = ref_dst->symbol(); + if (*sym_src != *sym_dst) { + r.add_or(); // False Relation + delete sym_src; + delete sym_dst; + return r; + } + else { + delete sym_src; + delete sym_dst; + } + + F_And *f_root = r.add_and(); + + for (int i = 0; i < ref_src->n_dim(); i++) { + F_Exists *f_exists = f_root->add_exists(); + Variable_ID e1 = f_exists->declare(tmp_e()); + Variable_ID e2 = f_exists->declare(tmp_e()); + F_And *f_and = f_exists->add_and(); + + CG_outputRepr *repr_src = ref_src->index(i); + CG_outputRepr *repr_dst = ref_dst->index(i); + + bool has_complex_formula = false; + try { + exp2formula(ir, r, f_and, freevars, repr_src, e1, 'w', IR_COND_EQ, false); + exp2formula(ir, r, f_and, freevars, repr_dst, e2, 'r', IR_COND_EQ, false); + } + catch (const ir_exp_error &e) { + has_complex_formula = true; + } + + if (!has_complex_formula) { + EQ_Handle h = f_and->add_EQ(); + h.update_coef(e1, 1); + h.update_coef(e2, -1); + } + + repr_src->clear(); + repr_dst->clear(); + delete repr_src; + delete repr_dst; + } + + // add iteration space restriction + r = Restrict_Domain(r, copy(IS1)); + r = Restrict_Range(r, copy(IS2)); + + // reset the output variable names lost in restriction + for (int i = 1; i <= IS2.n_set(); i++) + r.name_output_var(i, IS2.set_var(i)->name()+"'"); + + return r; +} + + +//----------------------------------------------------------------------------- +// Convert array dependence relation into set of dependence vectors, assuming +// ref_w is lexicographically before ref_r in the source code. +// ----------------------------------------------------------------------------- +std::pair, std::vector > relation2dependences (const IR_ArrayRef *ref_src, const IR_ArrayRef *ref_dst, const Relation &r) { + assert(r.n_inp() == r.n_out()); + + std::vector dependences1, dependences2; + std::stack working; + working.push(DependenceLevel(r, r.n_inp())); + + while (!working.empty()) { + DependenceLevel dep = working.top(); + working.pop(); + + // No dependence exists, move on. + if (!dep.r.is_satisfiable()) + continue; + + if (dep.level == r.n_inp()) { + DependenceVector dv; + + // for loop independent dependence, use lexical order to + // determine the correct source and destination + if (dep.dir == 0) { + if (*ref_src == *ref_dst) + continue; // trivial self zero-dependence + + if (ref_src->is_write()) { + if (ref_dst->is_write()) + dv.type = DEP_W2W; + else + dv.type = DEP_W2R; + } + else { + if (ref_dst->is_write()) + dv.type = DEP_R2W; + else + dv.type = DEP_R2R; + } + + } + else if (dep.dir == 1) { + if (ref_src->is_write()) { + if (ref_dst->is_write()) + dv.type = DEP_W2W; + else + dv.type = DEP_W2R; + } + else { + if (ref_dst->is_write()) + dv.type = DEP_R2W; + else + dv.type = DEP_R2R; + } + } + else { // dep.dir == -1 + if (ref_dst->is_write()) { + if (ref_src->is_write()) + dv.type = DEP_W2W; + else + dv.type = DEP_W2R; + } + else { + if (ref_src->is_write()) + dv.type = DEP_R2W; + else + dv.type = DEP_R2R; + } + } + + dv.lbounds = dep.lbounds; + dv.ubounds = dep.ubounds; + dv.sym = ref_src->symbol(); + + if (dep.dir == 0 || dep.dir == 1) + dependences1.push_back(dv); + else + dependences2.push_back(dv); + } + else { + // now work on the next dimension level + int level = ++dep.level; + + coef_t lbound, ubound; + Relation delta = Deltas(copy(dep.r)); + delta.query_variable_bounds(delta.set_var(level), lbound, ubound); + + if (dep.dir == 0) { + if (lbound > 0) { + dep.dir = 1; + dep.lbounds[level-1] = lbound; + dep.ubounds[level-1] = ubound; + + working.push(dep); + } + else if (ubound < 0) { + dep.dir = -1; + dep.lbounds[level-1] = -ubound; + dep.ubounds[level-1] = -lbound; + + working.push(dep); + } + else { + // split the dependence vector into flow- and anti-dependence + // for the first non-zero distance, also separate zero distance + // at this level. + { + DependenceLevel dep2 = dep; + + dep2.lbounds[level-1] = 0; + dep2.ubounds[level-1] = 0; + + F_And *f_root = dep2.r.and_with_and(); + EQ_Handle h = f_root->add_EQ(); + h.update_coef(dep2.r.input_var(level), 1); + h.update_coef(dep2.r.output_var(level), -1); + + working.push(dep2); + } + + if (lbound < 0 && *ref_src != *ref_dst) { + DependenceLevel dep2 = dep; + + F_And *f_root = dep2.r.and_with_and(); + GEQ_Handle h = f_root->add_GEQ(); + h.update_coef(dep2.r.input_var(level), 1); + h.update_coef(dep2.r.output_var(level), -1); + h.update_const(-1); + + // get tighter bounds under new constraints + coef_t lbound, ubound; + delta = Deltas(copy(dep2.r)); + delta.query_variable_bounds(delta.set_var(level), + lbound, ubound); + + dep2.dir = -1; + dep2.lbounds[level-1] = max(-ubound,static_cast(1)); // use max() to avoid Omega retardness + dep2.ubounds[level-1] = -lbound; + + working.push(dep2); + } + + if (ubound > 0) { + DependenceLevel dep2 = dep; + + F_And *f_root = dep2.r.and_with_and(); + GEQ_Handle h = f_root->add_GEQ(); + h.update_coef(dep2.r.input_var(level), -1); + h.update_coef(dep2.r.output_var(level), 1); + h.update_const(-1); + + // get tighter bonds under new constraints + coef_t lbound, ubound; + delta = Deltas(copy(dep2.r)); + delta.query_variable_bounds(delta.set_var(level), + lbound, ubound); + dep2.dir = 1; + dep2.lbounds[level-1] = max(lbound,static_cast(1)); // use max() to avoid Omega retardness + dep2.ubounds[level-1] = ubound; + + working.push(dep2); + } + } + } + // now deal with dependence vector with known direction + // determined at previous levels + else { + // For messy bounds, further test to see if the dependence distance + // can be reduced to positive/negative. This is an omega hack. + if (lbound == negInfinity && ubound == posInfinity) { + { + Relation t = dep.r; + F_And *f_root = t.and_with_and(); + GEQ_Handle h = f_root->add_GEQ(); + h.update_coef(t.input_var(level), 1); + h.update_coef(t.output_var(level), -1); + h.update_const(-1); + + if (!t.is_satisfiable()) { + lbound = 0; + } + } + { + Relation t = dep.r; + F_And *f_root = t.and_with_and(); + GEQ_Handle h = f_root->add_GEQ(); + h.update_coef(t.input_var(level), -1); + h.update_coef(t.output_var(level), 1); + h.update_const(-1); + + if (!t.is_satisfiable()) { + ubound = 0; + } + } + } + + // Same thing as above, test to see if zero dependence + // distance possible. + if (lbound == 0 || ubound == 0) { + Relation t = dep.r; + F_And *f_root = t.and_with_and(); + EQ_Handle h = f_root->add_EQ(); + h.update_coef(t.input_var(level), 1); + h.update_coef(t.output_var(level), -1); + + if (!t.is_satisfiable()) { + if (lbound == 0) + lbound = 1; + if (ubound == 0) + ubound = -1; + } + } + + if (dep.dir == -1) { + dep.lbounds[level-1] = -ubound; + dep.ubounds[level-1] = -lbound; + } + else { // dep.dir == 1 + dep.lbounds[level-1] = lbound; + dep.ubounds[level-1] = ubound; + } + + working.push(dep); + } + } + } + + return std::make_pair(dependences1, dependences2); +} + + +//----------------------------------------------------------------------------- +// Convert a boolean expression to omega relation. "destroy" means shallow +// deallocation of "repr", not freeing the actual code inside. +//----------------------------------------------------------------------------- +void exp2constraint(IR_Code *ir, Relation &r, F_And *f_root, + std::vector &freevars, + CG_outputRepr *repr, bool destroy) { + IR_CONDITION_TYPE cond = ir->QueryBooleanExpOperation(repr); + switch (cond) { + case IR_COND_LT: + case IR_COND_LE: + case IR_COND_EQ: + case IR_COND_GT: + case IR_COND_GE: { + F_Exists *f_exist = f_root->add_exists(); + Variable_ID e = f_exist->declare(); + F_And *f_and = f_exist->add_and(); + std::vector op = ir->QueryExpOperand(repr); + exp2formula(ir, r, f_and, freevars, op[0], e, 's', IR_COND_EQ, true); + exp2formula(ir, r, f_and, freevars, op[1], e, 's', cond, true); + if (destroy) + delete repr; + break; + } + case IR_COND_NE: { + F_Exists *f_exist = f_root->add_exists(); + Variable_ID e = f_exist->declare(); + F_Or *f_or = f_exist->add_or(); + F_And *f_and = f_or->add_and(); + std::vector op = ir->QueryExpOperand(repr); + exp2formula(ir, r, f_and, freevars, op[0], e, 's', IR_COND_EQ, false); + exp2formula(ir, r, f_and, freevars, op[1], e, 's', IR_COND_GT, false); + + f_and = f_or->add_and(); + exp2formula(ir, r, f_and, freevars, op[0], e, 's', IR_COND_EQ, true); + exp2formula(ir, r, f_and, freevars, op[1], e, 's', IR_COND_LT, true); + + if (destroy) + delete repr; + break; + } + default: + throw ir_exp_error("unrecognized conditional expression"); + } +} + + + + + +// inline void exp2formula(IR_Code *ir, Relation &r, F_And *f_root, +// std::vector &freevars, +// const CG_outputRepr *repr, Variable_ID lhs, char side, char rel) { +// exp2formula(ir, r, f_root, freevars, const_cast(repr), lhs, side, rel, false); +// } + + + + + + + +//----------------------------------------------------------------------------- +// Convert suif expression tree to omega relation. +//----------------------------------------------------------------------------- + +// void suif2formula(Relation &r, F_And *f_root, +// std::vector &freevars, +// operand op, Variable_ID lhs, +// char side, char rel) { +// if (op.is_immed()) { +// immed im = op.immediate(); + +// if (im.is_integer()) { +// int c = im.integer(); + +// if (rel == '>') { +// GEQ_Handle h = f_root->add_GEQ(); +// h.update_coef(lhs, 1); +// h.update_const(-1*c); +// } +// else if (rel == '<') { +// GEQ_Handle h = f_root->add_GEQ(); +// h.update_coef(lhs, -1); +// h.update_const(c); +// } +// else { // '=' +// EQ_Handle h = f_root->add_EQ(); +// h.update_coef(lhs, 1); +// h.update_const(-1*c); +// } +// } +// else { +// return; //add Function in the future +// } +// } +// else if (op.is_symbol()) { +// String s = op.symbol()->name(); +// Variable_ID e = find_index(r, s, side); + +// if (e == NULL) { // must be free variable +// Free_Var_Decl *t = NULL; +// for (unsigned i = 0; i < freevars.size(); i++) { +// String ss = freevars[i]->base_name(); +// if (s == ss) { +// t = freevars[i]; +// break; +// } +// } + +// if (t == NULL) { +// t = new Free_Var_Decl(s); +// freevars.insert(freevars.end(), t); +// } + +// e = r.get_local(t); +// } + +// if (rel == '>') { +// GEQ_Handle h = f_root->add_GEQ(); +// h.update_coef(lhs, 1); +// h.update_coef(e, -1); +// } +// else if (rel == '<') { +// GEQ_Handle h = f_root->add_GEQ(); +// h.update_coef(lhs, -1); +// h.update_coef(e, 1); +// } +// else { // '=' +// EQ_Handle h = f_root->add_EQ(); +// h.update_coef(lhs, 1); +// h.update_coef(e, -1); +// } +// } +// else if (op.is_instr()) +// suif2formula(r, f_root, freevars, op.instr(), lhs, side, rel); +// } + + +// void suif2formula(Relation &r, F_And *f_root, +// std::vector &freevars, +// instruction *ins, Variable_ID lhs, +// char side, char rel) { +// if (ins->opcode() == io_cpy) { +// suif2formula(r, f_root, freevars, ins->src_op(0), lhs, side, rel); +// } +// else if (ins->opcode() == io_add || ins->opcode() == io_sub) { +// F_Exists *f_exists = f_root->add_exists(); +// Variable_ID e1 = f_exists->declare(tmp_e()); +// Variable_ID e2 = f_exists->declare(tmp_e()); +// F_And *f_and = f_exists->add_and(); + +// int add_or_sub = ins->opcode() == io_add ? 1 : -1; +// if (rel == '>') { +// GEQ_Handle h = f_and->add_GEQ(); +// h.update_coef(lhs, 1); +// h.update_coef(e1, -1); +// h.update_coef(e2, -1 * add_or_sub); +// } +// else if (rel == '<') { +// GEQ_Handle h = f_and->add_GEQ(); +// h.update_coef(lhs, -1); +// h.update_coef(e1, 1); +// h.update_coef(e2, 1 * add_or_sub); +// } +// else { // '=' +// EQ_Handle h = f_and->add_EQ(); +// h.update_coef(lhs, 1); +// h.update_coef(e1, -1); +// h.update_coef(e2, -1 * add_or_sub); +// } + +// suif2formula(r, f_and, freevars, ins->src_op(0), e1, side, '='); +// suif2formula(r, f_and, freevars, ins->src_op(1), e2, side, '='); +// } +// else if (ins->opcode() == io_mul) { +// operand op1 = ins->src_op(0); +// operand op2 = ins->src_op(1); + +// if (!op1.is_immed() && !op2.is_immed()) +// return; // add Function in the future +// else { +// operand op; +// immed im; +// if (op1.is_immed()) { +// im = op1.immediate(); +// op = op2; +// } +// else { +// im = op2.immediate(); +// op = op1; +// } + +// if (!im.is_integer()) +// return; //add Function in the future +// else { +// int c = im.integer(); + +// F_Exists *f_exists = f_root->add_exists(); +// Variable_ID e = f_exists->declare(tmp_e()); +// F_And *f_and = f_exists->add_and(); + +// if (rel == '>') { +// GEQ_Handle h = f_and->add_GEQ(); +// h.update_coef(lhs, 1); +// h.update_coef(e, -c); +// } +// else if (rel == '<') { +// GEQ_Handle h = f_and->add_GEQ(); +// h.update_coef(lhs, -1); +// h.update_coef(e, c); +// } +// else { +// EQ_Handle h = f_and->add_EQ(); +// h.update_coef(lhs, 1); +// h.update_coef(e, -c); +// } + +// suif2formula(r, f_and, freevars, op, e, side, '='); +// } +// } +// } +// else if (ins->opcode() == io_div) { +// operand op1 = ins->src_op(0); +// operand op2 = ins->src_op(1); + +// if (!op2.is_immed()) +// return; //add Function in the future +// else { +// immed im = op2.immediate(); + +// if (!im.is_integer()) +// return; //add Function in the future +// else { +// int c = im.integer(); + +// F_Exists *f_exists = f_root->add_exists(); +// Variable_ID e = f_exists->declare(tmp_e()); +// F_And *f_and = f_exists->add_and(); + +// if (rel == '>') { +// GEQ_Handle h = f_and->add_GEQ(); +// h.update_coef(lhs, c); +// h.update_coef(e, -1); +// } +// else if (rel == '<') { +// GEQ_Handle h = f_and->add_GEQ(); +// h.update_coef(lhs, -c); +// h.update_coef(e, 1); +// } +// else { +// EQ_Handle h = f_and->add_EQ(); +// h.update_coef(lhs, c); +// h.update_coef(e, -1); +// } + +// suif2formula(r, f_and, freevars, op1, e, side, '='); +// } +// } +// } +// else if (ins->opcode() == io_neg) { +// F_Exists *f_exists = f_root->add_exists(); +// Variable_ID e = f_exists->declare(tmp_e()); +// F_And *f_and = f_exists->add_and(); + +// if (rel == '>') { +// GEQ_Handle h = f_and->add_GEQ(); +// h.update_coef(lhs, 1); +// h.update_coef(e, 1); +// } +// else if (rel == '<') { +// GEQ_Handle h = f_and->add_GEQ(); +// h.update_coef(lhs, -1); +// h.update_coef(e, -1); +// } +// else { +// EQ_Handle h = f_and->add_EQ(); +// h.update_coef(lhs, 1); +// h.update_coef(e, 1); +// } + +// suif2formula(r, f_and, freevars, ins->src_op(0), e, side, '='); +// } +// else if (ins->opcode() == io_min) { +// operand op1 = ins->src_op(0); +// operand op2 = ins->src_op(1); + +// F_Exists *f_exists = f_root->add_exists(); +// Variable_ID e1 = f_exists->declare(tmp_e()); +// Variable_ID e2 = f_exists->declare(tmp_e()); +// F_And *f_and = f_exists->add_and(); + +// if (rel == '>') { +// F_Or *f_or = f_and->add_or(); +// F_And *f_and1 = f_or->add_and(); +// GEQ_Handle h1 = f_and1->add_GEQ(); +// h1.update_coef(lhs, 1); +// h1.update_coef(e1, -1); +// F_And *f_and2 = f_or->add_and(); +// GEQ_Handle h2 = f_and2->add_GEQ(); +// h2.update_coef(lhs, 1); +// h2.update_coef(e2, -1); +// } +// else if (rel == '<') { +// GEQ_Handle h1 = f_and->add_GEQ(); +// h1.update_coef(lhs, -1); +// h1.update_coef(e1, 1); +// GEQ_Handle h2 = f_and->add_GEQ(); +// h2.update_coef(lhs, -1); +// h2.update_coef(e2, 1); +// } +// else { +// F_Or *f_or = f_and->add_or(); +// F_And *f_and1 = f_or->add_and(); +// EQ_Handle h1 = f_and1->add_EQ(); +// h1.update_coef(lhs, 1); +// h1.update_coef(e1, -1); +// GEQ_Handle h2 = f_and1->add_GEQ(); +// h2.update_coef(e1, -1); +// h2.update_coef(e2, 1); +// F_And *f_and2 = f_or->add_and(); +// EQ_Handle h3 = f_and2->add_EQ(); +// h3.update_coef(lhs, 1); +// h3.update_coef(e2, -1); +// GEQ_Handle h4 = f_and2->add_GEQ(); +// h4.update_coef(e1, 1); +// h4.update_coef(e2, -1); +// } + +// suif2formula(r, f_and, freevars, op1, e1, side, '='); +// suif2formula(r, f_and, freevars, op2, e2, side, '='); +// } +// else if (ins->opcode() == io_max) { +// operand op1 = ins->src_op(0); +// operand op2 = ins->src_op(1); + +// F_Exists *f_exists = f_root->add_exists(); +// Variable_ID e1 = f_exists->declare(tmp_e()); +// Variable_ID e2 = f_exists->declare(tmp_e()); +// F_And *f_and = f_exists->add_and(); + +// if (rel == '>') { +// GEQ_Handle h1 = f_and->add_GEQ(); +// h1.update_coef(lhs, 1); +// h1.update_coef(e1, -1); +// GEQ_Handle h2 = f_and->add_GEQ(); +// h2.update_coef(lhs, 1); +// h2.update_coef(e2, -1); +// } +// else if (rel == '<') { +// F_Or *f_or = f_and->add_or(); +// F_And *f_and1 = f_or->add_and(); +// GEQ_Handle h1 = f_and1->add_GEQ(); +// h1.update_coef(lhs, -1); +// h1.update_coef(e1, 1); +// F_And *f_and2 = f_or->add_and(); +// GEQ_Handle h2 = f_and2->add_GEQ(); +// h2.update_coef(lhs, -1); +// h2.update_coef(e2, 1); +// } +// else { +// F_Or *f_or = f_and->add_or(); +// F_And *f_and1 = f_or->add_and(); +// EQ_Handle h1 = f_and1->add_EQ(); +// h1.update_coef(lhs, 1); +// h1.update_coef(e1, -1); +// GEQ_Handle h2 = f_and1->add_GEQ(); +// h2.update_coef(e1, 1); +// h2.update_coef(e2, -1); +// F_And *f_and2 = f_or->add_and(); +// EQ_Handle h3 = f_and2->add_EQ(); +// h3.update_coef(lhs, 1); +// h3.update_coef(e2, -1); +// GEQ_Handle h4 = f_and2->add_GEQ(); +// h4.update_coef(e1, -1); +// h4.update_coef(e2, 1); +// } + +// suif2formula(r, f_and, freevars, op1, e1, side, '='); +// suif2formula(r, f_and, freevars, op2, e2, side, '='); +// } +// } + +//----------------------------------------------------------------------------- +// Generate iteration space constraints +//----------------------------------------------------------------------------- + +// void add_loop_stride_constraints(Relation &r, F_And *f_root, +// std::vector &freevars, +// tree_for *tnf, char side) { + +// std::string name(tnf->index()->name()); +// int dim = 0; +// for (;dim < r.n_set(); dim++) +// if (r.set_var(dim+1)->name() == name) +// break; + +// Relation bound = get_loop_bound(r, dim); + +// operand op = tnf->step_op(); +// if (!op.is_null()) { +// if (op.is_immed()) { +// immed im = op.immediate(); +// if (im.is_integer()) { +// int c = im.integer(); + +// if (c != 1 && c != -1) +// add_loop_stride(r, bound, dim, c); +// } +// else +// assert(0); // messy stride +// } +// else +// assert(0); // messy stride +// } +// } + +// void add_loop_bound_constraints(IR_Code *ir, Relation &r, F_And *f_root, +// std::vector &freevars, +// tree_for *tnf, +// char upper_or_lower, char side, IR_CONDITION_TYPE rel) { +// Variable_ID v = find_index(r, tnf->index()->name(), side); + +// tree_node_list *tnl; + +// if (upper_or_lower == 'u') +// tnl = tnf->ub_list(); +// else +// tnl = tnf->lb_list(); + +// tree_node_list_iter iter(tnl); +// while (!iter.is_empty()) { +// tree_node *tn = iter.step(); +// if (tn->kind() != TREE_INSTR) +// break; // messy bounds + +// instruction *ins = static_cast(tn)->instr(); + + +// if (upper_or_lower == 'u' && (tnf->test() == FOR_SLT || tnf->test() == FOR_ULT)) { +// operand op1(ins->clone()); +// operand op2(new in_ldc(type_s32, operand(), immed(1))); +// instruction *t = new in_rrr(io_sub, op1.type(), operand(), op1, op2); + +// CG_suifRepr *repr = new CG_suifRepr(operand(t)); +// exp2formula(ir, r, f_root, freevars, repr, v, side, rel, true); +// delete t; +// } +// else if (tnf->test() == FOR_SLT || tnf->test() == FOR_SLTE || tnf->test() == FOR_ULT || tnf->test() == FOR_ULTE) { +// CG_suifRepr *repr = new CG_suifRepr(operand(ins)); +// exp2formula(ir, r, f_root, freevars, repr, v, side, rel, true); +// } +// else +// assert(0); +// } +// } + + +// Relation loop_iteration_space(std::vector &freevars, +// tree_node *tn, std::vector &loops) { +// Relation r(loops.size()); +// for (unsigned i = 0; i < loops.size(); i++) { +// String s = loops[i]->index()->name(); +// r.name_set_var(i+1, s); +// } + +// F_And *f_root = r.add_and(); + +// std::vector outer = find_outer_loops(tn); +// std::vector loops_lex(loops.size(), LEX_UNKNOWN); + +// for (unsigned i = 0; i < outer.size(); i++) { +// unsigned j; + +// for (j = 0; j < loops.size(); j++) { +// if (outer[i] == loops[j]) { +// loops_lex[j] = LEX_MATCH; +// break; +// } else if (outer[i]->index() == loops[j]->index()) { +// loops_lex[j] = lexical_order(outer[i],loops[j]); +// break; +// } +// } + +// if (j != loops.size()) { +// add_loop_bound_constraints(r, f_root, freevars, outer[i], 'l', 's', '>'); +// add_loop_bound_constraints(r, f_root, freevars, outer[i], 'u', 's', '<'); +// add_loop_stride_constraints(r,f_root, freevars, outer[i], 's'); +// } +// } + +// // Add degenerated constraints for non-enclosing loops for this +// // statement. We treat low-dim space as part of whole +// // iteration space. +// LexicalOrderType lex = LEX_MATCH; +// for (unsigned i = 0; i < loops.size(); i++) { +// if (loops_lex[i] != 0) { +// if (lex == LEX_MATCH) +// lex = loops_lex[i]; +// continue; +// } + +// if (lex == LEX_MATCH) { +// for (unsigned j = i+1; j < loops.size(); j++) { +// if (loops_lex[j] == LEX_BEFORE || loops_lex[j] == LEX_AFTER) { +// lex = loops_lex[j]; +// break; +// } +// } +// } + +// if (lex == LEX_MATCH) +// lex = lexical_order(tn, loops[i]); + +// if (lex == LEX_BEFORE) +// add_loop_bound_constraints(r, f_root, freevars, loops[i], 'l', 's', '='); +// else +// add_loop_bound_constraints(r, f_root, freevars, loops[i], 'u', 's', '='); +// } + +// return r; +// } + +// Relation arrays2relation(std::vector &freevars, +// in_array *ia_w, const Relation &IS1_, +// in_array *ia_r, const Relation &IS2_) { +// Relation &IS1 = const_cast(IS1_); +// Relation &IS2 = const_cast(IS2_); + +// Relation r(IS1.n_set(), IS2.n_set()); + +// for (int i = 1; i <= IS1.n_set(); i++) +// r.name_input_var(i, IS1.set_var(i)->name()); + +// for (int i = 1; i <= IS2.n_set(); i++) +// r.name_output_var(i, IS2.set_var(i)->name()+"'"); + +// if (get_sym_of_array(ia_w) != get_sym_of_array(ia_r)) { +// r.add_or(); // False Relation +// return r; +// } + +// F_And *f_root = r.add_and(); + +// for (unsigned i = 0; i < ia_w->dims(); i++) { +// F_Exists *f_exists = f_root->add_exists(); +// Variable_ID e = f_exists->declare(tmp_e()); +// F_And *f_and = f_exists->add_and(); + +// suif2formula(r, f_and, freevars, ia_w->index(i), e, 'w', '='); +// suif2formula(r, f_and, freevars, ia_r->index(i), e, 'r', '='); +// } + +// // add iteration space restriction +// r = Restrict_Domain(r, copy(IS1)); +// r = Restrict_Range(r, copy(IS2)); + +// // reset the output variable names lost in restriction +// for (int i = 1; i <= IS2.n_set(); i++) +// r.name_output_var(i, IS2.set_var(i)->name()+"'"); + +// return r; +// } + + +// std::vector relation2dependences (IR_Code *ir, in_array *ia_w, in_array *ia_r, const Relation &r) { +// assert(r.n_inp() == r.n_out()); + +// std::vector dependences; + +// std::stack working; +// working.push(DependenceLevel(r, r.n_inp())); + +// while (!working.empty()) { +// DependenceLevel dep = working.top(); +// working.pop(); + +// // No dependence exists, move on. +// if (!dep.r.is_satisfiable()) +// continue; + +// if (dep.level == r.n_inp()) { +// DependenceVector dv; + +// // for loop independent dependence, use lexical order to +// // determine the correct source and destination +// if (dep.dir == 0) { +// LexicalOrderType order = lexical_order(ia_w->parent(), ia_r->parent()); + +// if (order == LEX_MATCH) +// continue; //trivial self zero-dependence +// else if (order == LEX_AFTER) { +// dv.src = new IR_suifArrayRef(ir, ia_r); +// dv.dst = new IR_suifArrayRef(ir, ia_w); +// } +// else { +// dv.src = new IR_suifArrayRef(ir, ia_w); +// dv.dst = new IR_suifArrayRef(ir,ia_r); +// } +// } +// else if (dep.dir == 1) { +// dv.src = new IR_suifArrayRef(ir, ia_w); +// dv.dst = new IR_suifArrayRef(ir, ia_r); +// } +// else { // dep.dir == -1 +// dv.src = new IR_suifArrayRef(ir, ia_r); +// dv.dst = new IR_suifArrayRef(ir, ia_w); +// } + +// dv.lbounds = dep.lbounds; +// dv.ubounds = dep.ubounds; + +// // // set the dependence type +// // if (is_lhs(dv.source) && is_lhs(dv.dest)) +// // dv.type = 'o'; +// // else if (!is_lhs(dv.source) && ! is_lhs(dv.dest)) +// // dv.type = 'i'; +// // else if (is_lhs(dv.source)) +// // dv.type = 'f'; +// // else +// // dv.type = 'a'; + +// dependences.push_back(dv); +// } +// else { +// // now work on the next dimension level +// int level = ++dep.level; + +// coef_t lbound, ubound; +// Relation delta = Deltas(copy(dep.r)); +// delta.query_variable_bounds(delta.set_var(level), lbound, ubound); + +// if (dep.dir == 0) { +// if (lbound > 0) { +// dep.dir = 1; +// dep.lbounds[level-1] = lbound; +// dep.ubounds[level-1] = ubound; + +// working.push(dep); +// } +// else if (ubound < 0) { +// dep.dir = -1; +// dep.lbounds[level-1] = -ubound; +// dep.ubounds[level-1] = -lbound; + +// working.push(dep); +// } +// else { +// // split the dependence vector into flow- and anti-dependence +// // for the first non-zero distance, also separate zero distance +// // at this level. +// { +// DependenceLevel dep2 = dep; + +// dep2.lbounds[level-1] = 0; +// dep2.ubounds[level-1] = 0; + +// F_And *f_root = dep2.r.and_with_and(); +// EQ_Handle h = f_root->add_EQ(); +// h.update_coef(dep2.r.input_var(level), 1); +// h.update_coef(dep2.r.output_var(level), -1); + +// working.push(dep2); +// } + +// if (lbound < 0 && ia_w != ia_r) { +// DependenceLevel dep2 = dep; + +// F_And *f_root = dep2.r.and_with_and(); +// GEQ_Handle h = f_root->add_GEQ(); +// h.update_coef(dep2.r.input_var(level), 1); +// h.update_coef(dep2.r.output_var(level), -1); +// h.update_const(-1); + +// // get tighter bounds under new constraints +// coef_t lbound, ubound; +// delta = Deltas(copy(dep2.r)); +// delta.query_variable_bounds(delta.set_var(level), +// lbound, ubound); + +// dep2.dir = -1; +// dep2.lbounds[level-1] = max(-ubound,static_cast(1)); // use max() to avoid Omega retardness +// dep2.ubounds[level-1] = -lbound; + +// working.push(dep2); +// } + +// if (ubound > 0) { +// DependenceLevel dep2 = dep; + +// F_And *f_root = dep2.r.and_with_and(); +// GEQ_Handle h = f_root->add_GEQ(); +// h.update_coef(dep2.r.input_var(level), -1); +// h.update_coef(dep2.r.output_var(level), 1); +// h.update_const(-1); + +// // get tighter bonds under new constraints +// coef_t lbound, ubound; +// delta = Deltas(copy(dep2.r)); +// delta.query_variable_bounds(delta.set_var(level), +// lbound, ubound); +// dep2.dir = 1; +// dep2.lbounds[level-1] = max(lbound,static_cast(1)); // use max() to avoid Omega retardness +// dep2.ubounds[level-1] = ubound; + +// working.push(dep2); +// } +// } +// } +// // now deal with dependence vector with known direction +// // determined at previous levels +// else { +// // For messy bounds, further test to see if the dependence distance +// // can be reduced to positive/negative. This is an omega hack. +// if (lbound == negInfinity && ubound == posInfinity) { +// { +// Relation t = dep.r; +// F_And *f_root = t.and_with_and(); +// GEQ_Handle h = f_root->add_GEQ(); +// h.update_coef(t.input_var(level), 1); +// h.update_coef(t.output_var(level), -1); +// h.update_const(-1); + +// if (!t.is_satisfiable()) { +// lbound = 0; +// } +// } +// { +// Relation t = dep.r; +// F_And *f_root = t.and_with_and(); +// GEQ_Handle h = f_root->add_GEQ(); +// h.update_coef(t.input_var(level), -1); +// h.update_coef(t.output_var(level), 1); +// h.update_const(-1); + +// if (!t.is_satisfiable()) { +// ubound = 0; +// } +// } +// } + +// // Same thing as above, test to see if zero dependence +// // distance possible. +// if (lbound == 0 || ubound == 0) { +// Relation t = dep.r; +// F_And *f_root = t.and_with_and(); +// EQ_Handle h = f_root->add_EQ(); +// h.update_coef(t.input_var(level), 1); +// h.update_coef(t.output_var(level), -1); + +// if (!t.is_satisfiable()) { +// if (lbound == 0) +// lbound = 1; +// if (ubound == 0) +// ubound = -1; +// } +// } + +// if (dep.dir == -1) { +// dep.lbounds[level-1] = -ubound; +// dep.ubounds[level-1] = -lbound; +// } +// else { // dep.dir == 1 +// dep.lbounds[level-1] = lbound; +// dep.ubounds[level-1] = ubound; +// } + +// working.push(dep); +// } +// } +// } + +// return dependences; +// } + +//----------------------------------------------------------------------------- +// Determine whether the loop (starting from 0) in the iteration space +// has only one iteration. +//----------------------------------------------------------------------------- +bool is_single_loop_iteration(const Relation &r, int level, const Relation &known) { + int n = r.n_set(); + Relation r1 = Intersection(copy(r), Extend_Set(copy(known), n-known.n_set())); + + Relation mapping(n, n); + F_And *f_root = mapping.add_and(); + for (int i = 1; i <= level; i++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.input_var(i), 1); + h.update_coef(mapping.output_var(i), -1); + } + r1 = Range(Restrict_Domain(mapping, r1)); + r1.simplify(); + + Variable_ID v = r1.set_var(level); + for (DNF_Iterator di(r1.query_DNF()); di; di++) { + bool is_single = false; + for (EQ_Iterator ei((*di)->EQs()); ei; ei++) + if ((*ei).get_coef(v) != 0 && !(*ei).has_wildcards()) { + is_single = true; + break; + } + + if (!is_single) + return false; + } + + return true; +} + + + + +bool is_single_iteration(const Relation &r, int dim) { + assert(r.is_set()); + const int n = r.n_set(); + + if (dim >= n) + return true; + + Relation bound = get_loop_bound(r, dim); + +// if (!bound.has_single_conjunct()) +// return false; + +// Conjunct *c = bound.query_DNF()->single_conjunct(); + + for (DNF_Iterator di(bound.query_DNF()); di; di++) { + bool is_single = false; + for (EQ_Iterator ei((*di)->EQs()); ei; ei++) + if (!(*ei).has_wildcards()) { + is_single = true; + break; + } + + if (!is_single) + return false; + } + + return true; + + + + +// Relation r = copy(r_); +// const int n = r.n_set(); + +// if (dim >= n) +// return true; + +// Relation bound = get_loop_bound(r, dim); +// bound = Approximate(bound); +// Conjunct *c = bound.query_DNF()->single_conjunct(); + +// return c->n_GEQs() == 0; + + + + + +// Relation r = copy(r_); +// r.simplify(); +// const int n = r.n_set(); + +// if (dim >= n) +// return true; + +// for (DNF_Iterator i(r.query_DNF()); i; i++) { +// std::vector is_single(n); +// for (int j = 0; j < dim; j++) +// is_single[j] = true; +// for (int j = dim; j < n; j++) +// is_single[j] = false; + +// bool found_new_single = true; +// while (found_new_single) { +// found_new_single = false; + +// for (EQ_Iterator j = (*i)->EQs(); j; j++) { +// int saved_pos = -1; +// for (Constr_Vars_Iter k(*j); k; k++) +// if ((*k).var->kind() == Set_Var || (*k).var->kind() == Input_Var) { +// int pos = (*k).var->get_position() - 1; +// if (!is_single[pos]) +// if (saved_pos == -1) +// saved_pos = pos; +// else { +// saved_pos = -1; +// break; +// } +// } + +// if (saved_pos != -1) { +// is_single[saved_pos] = true; +// found_new_single = true; +// } +// } + +// if (is_single[dim]) +// break; +// } + +// if (!is_single[dim]) +// return false; +// } + +// return true; +} + +//----------------------------------------------------------------------------- +// Set/get the value of a variable which is know to be constant. +//----------------------------------------------------------------------------- +void assign_const(Relation &r, int dim, int val) { + const int n = r.n_out(); + + Relation mapping(n, n); + F_And *f_root = mapping.add_and(); + + for (int i = 1; i <= n; i++) { + if (i != dim+1) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.output_var(i), 1); + h.update_coef(mapping.input_var(i), -1); + } + else { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.output_var(i), 1); + h.update_const(-val); + } + } + + r = Composition(mapping, r); +} + + +int get_const(const Relation &r, int dim, Var_Kind type) { +// Relation rr = copy(r); + Relation &rr = const_cast(r); + + Variable_ID v; + switch (type) { + // case Set_Var: + // v = rr.set_var(dim+1); + // break; + case Input_Var: + v = rr.input_var(dim+1); + break; + case Output_Var: + v = rr.output_var(dim+1); + break; + default: + throw std::invalid_argument("unsupported variable type"); + } + + for (DNF_Iterator di(rr.query_DNF()); di; di++) + for (EQ_Iterator ei = (*di)->EQs(); ei; ei++) + if ((*ei).is_const(v)) + return (*ei).get_const(); + + throw std::runtime_error("cannot get variable's constant value"); +} + + + + + + +//--------------------------------------------------------------------------- +// Get the bound for a specific loop. +//--------------------------------------------------------------------------- +Relation get_loop_bound(const Relation &r, int dim) { + assert(r.is_set()); + const int n = r.n_set(); + +// Relation r1 = project_onto_levels(copy(r), dim+1, true); + Relation mapping(n,n); + F_And *f_root = mapping.add_and(); + for (int i = 1; i <= dim+1; i++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.input_var(i), 1); + h.update_coef(mapping.output_var(i), -1); + } + Relation r1 = Range(Restrict_Domain(mapping, copy(r))); + for (int i = 1; i <= n; i++) + r1.name_set_var(i, const_cast(r).set_var(i)->name()); + r1.setup_names(); + Relation r2 = Project(copy(r1), dim+1, Set_Var); + + return Gist(r1, r2, 1); +} + +Relation get_loop_bound(const Relation &r, int level, const Relation &known) { + int n = r.n_set(); + Relation r1 = Intersection(copy(r), Extend_Set(copy(known), n-known.n_set())); + + Relation mapping(n, n); + F_And *f_root = mapping.add_and(); + for (int i = 1; i <= level; i++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.input_var(i), 1); + h.update_coef(mapping.output_var(i), -1); + } + r1 = Range(Restrict_Domain(mapping, r1)); + Relation r2 = Project(copy(r1), level, Set_Var); + r1 = Gist(r1, r2, 1); + + for (int i = 1; i <= n; i++) + r1.name_set_var(i, const_cast(r).set_var(i)->name()); + r1.setup_names(); + + return r1; +} + + + +Relation get_max_loop_bound(const std::vector &r, int dim) { + if (r.size() == 0) + return Relation::Null(); + + const int n = r[0].n_set(); + Relation res(Relation::False(n)); + for (int i = 0; i < r.size(); i++) { + Relation &t = const_cast(r[i]); + if (t.is_satisfiable()) + res = Union(get_loop_bound(t, dim), res); + } + + res.simplify(); + + return res; +} + +Relation get_min_loop_bound(const std::vector &r, int dim) { + if (r.size() == 0) + return Relation::Null(); + + const int n = r[0].n_set(); + Relation res(Relation::True(n)); + for (int i = 0; i < r.size(); i++) { + Relation &t = const_cast(r[i]); + if (t.is_satisfiable()) + res = Intersection(get_loop_bound(t, dim), res); + } + + res.simplify(); + + return res; +} + +//----------------------------------------------------------------------------- +// Add strident to a loop. +// Issues: +// - Don't work with relations with multiple disjuncts. +// - Omega's dealing with max lower bound is awkward. +//----------------------------------------------------------------------------- +void add_loop_stride(Relation &r, const Relation &bound_, int dim, int stride) { + F_And *f_root = r.and_with_and(); + Relation &bound = const_cast(bound_); + for (DNF_Iterator di(bound.query_DNF()); di; di++) { + F_Exists *f_exists = f_root->add_exists(); + Variable_ID e1 = f_exists->declare(tmp_e()); + Variable_ID e2 = f_exists->declare(tmp_e()); + F_And *f_and = f_exists->add_and(); + EQ_Handle stride_eq = f_and->add_EQ(); + stride_eq.update_coef(e1, 1); + stride_eq.update_coef(e2, stride); + if (!r.is_set()) + stride_eq.update_coef(r.output_var(dim+1), -1); + else + stride_eq.update_coef(r.set_var(dim+1), -1); + F_Or *f_or = f_and->add_or(); + + for (GEQ_Iterator gi = (*di)->GEQs(); gi; gi++) { + if ((*gi).get_coef(bound.set_var(dim+1)) > 0) { + // copy the lower bound constraint + EQ_Handle h1 = f_or->add_and()->add_EQ(); + GEQ_Handle h2 = f_and->add_GEQ(); + for (Constr_Vars_Iter ci(*gi); ci; ci++) { + switch ((*ci).var->kind()) { + // case Set_Var: + case Input_Var: { + int pos = (*ci).var->get_position(); + if (pos == dim + 1) { + h1.update_coef(e1, (*ci).coef); + h2.update_coef(e1, (*ci).coef); + } + else { + if (!r.is_set()) { + h1.update_coef(r.output_var(pos), (*ci).coef); + h2.update_coef(r.output_var(pos), (*ci).coef); + } + else { + h1.update_coef(r.set_var(pos), (*ci).coef); + h2.update_coef(r.set_var(pos), (*ci).coef); + } + } + break; + } + case Global_Var: { + Global_Var_ID g = (*ci).var->get_global_var(); + h1.update_coef(r.get_local(g, (*ci).var->function_of()), (*ci).coef); + h2.update_coef(r.get_local(g, (*ci).var->function_of()), (*ci).coef); + break; + } + default: + break; + } + } + h1.update_const((*gi).get_const()); + h2.update_const((*gi).get_const()); + } + } + } +} + + +bool is_inner_loop_depend_on_level(const Relation &r, int level, const Relation &known) { + Relation r1 = Intersection(copy(r), Extend_Set(copy(known), r.n_set()-known.n_set())); + Relation r2 = copy(r1); + for (int i = level+1; i <= r2.n_set(); i++) + r2 = Project(r2, r2.set_var(i)); + r2.simplify(2, 4); + Relation r3 = Gist(r1, r2); + + Variable_ID v = r3.set_var(level); + for (DNF_Iterator di(r3.query_DNF()); di; di++) { + for (EQ_Iterator ei = (*di)->EQs(); ei; ei++) + if ((*ei).get_coef(v) != 0) + return true; + + for (GEQ_Iterator gi = (*di)->GEQs(); gi; gi++) + if ((*gi).get_coef(v) != 0) + return true; + } + + return false; +} + + +//----------------------------------------------------------------------------- +// Suppose loop dim is i. Replace i with i+adjustment in loop bounds. +// e.g. do i = 1, n +// do j = i, n +// after call with dim = 0 and adjustment = 1: +// do i = 1, n +// do j = i+1, n +// ----------------------------------------------------------------------------- +Relation adjust_loop_bound(const Relation &r, int level, int adjustment) { + if (adjustment == 0) + return copy(r); + + const int n = r.n_set(); + Relation r1 = copy(r); + for (int i = level+1; i <= r1.n_set(); i++) + r1 = Project(r1, r1.set_var(i)); + r1.simplify(2, 4); + Relation r2 = Gist(copy(r), copy(r1)); + + Relation mapping(n, n); + F_And *f_root = mapping.add_and(); + for (int i = 1; i <= n; i++) + if (i == level) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.input_var(level), -1); + h.update_coef(mapping.output_var(level), 1); + h.update_const(static_cast(adjustment)); + } + else { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.input_var(i), -1); + h.update_coef(mapping.output_var(i), 1); + } + + r2 = Range(Restrict_Domain(mapping, r2)); + r1 = Intersection(r1, r2); + r1.simplify(); + + for (int i = 1; i <= n; i++) + r1.name_set_var(i, const_cast(r).set_var(i)->name()); + r1.setup_names(); + return r1; +} + + +// commented out on 07/14/2010 +// void adjust_loop_bound(Relation &r, int dim, int adjustment, std::vector globals) { +// assert(r.is_set()); + +// if (adjustment == 0) +// return; + +// const int n = r.n_set(); +// Tuple name(n); +// for (int i = 1; i <= n; i++) +// name[i] = r.set_var(i)->name(); + +// Relation r1 = project_onto_levels(copy(r), dim+1, true); +// Relation r2 = Gist(copy(r), copy(r1)); + +// // remove old bogus global variable conditions since we are going to +// // update the value. +// if (globals.size() > 0) +// r1 = Gist(r1, project_onto_levels(copy(r), 0, true)); + +// Relation r4 = Relation::True(n); + +// for (DNF_Iterator di(r2.query_DNF()); di; di++) { +// for (EQ_Iterator ei = (*di)->EQs(); ei; ei++) { +// EQ_Handle h = r4.and_with_EQ(*ei); + +// Variable_ID v = r2.set_var(dim+1); +// coef_t c = (*ei).get_coef(v); +// if (c != 0) +// h.update_const(c*adjustment); + +// for (int i = 0; i < globals.size(); i++) { +// Variable_ID v = r2.get_local(globals[i]); +// coef_t c = (*ei).get_coef(v); +// if (c != 0) +// h.update_const(c*adjustment); +// } +// } + +// for (GEQ_Iterator gi = (*di)->GEQs(); gi; gi++) { +// GEQ_Handle h = r4.and_with_GEQ(*gi); + +// Variable_ID v = r2.set_var(dim+1); +// coef_t c = (*gi).get_coef(v); +// if (c != 0) +// h.update_const(c*adjustment); + +// for (int i = 0; i < globals.size(); i++) { +// Variable_ID v = r2.get_local(globals[i]); +// coef_t c = (*gi).get_coef(v); +// if (c != 0) +// h.update_const(c*adjustment); +// } +// } +// } +// r = Intersection(r1, r4); +// // } +// // else +// // r = Intersection(r1, r2); + +// for (int i = 1; i <= n; i++) +// r.name_set_var(i, name[i]); +// r.setup_names(); +// } + + +// void adjust_loop_bound(Relation &r, int dim, int adjustment) { +// assert(r.is_set()); +// const int n = r.n_set(); +// Tuple name(n); +// for (int i = 1; i <= n; i++) +// name[i] = r.set_var(i)->name(); + +// Relation r1 = project_onto_levels(copy(r), dim+1, true); +// Relation r2 = Gist(r, copy(r1)); + +// Relation r3(n, n); +// F_And *f_root = r3.add_and(); +// for (int i = 0; i < n; i++) { +// EQ_Handle h = f_root->add_EQ(); +// h.update_coef(r3.output_var(i+1), 1); +// h.update_coef(r3.input_var(i+1), -1); +// if (i == dim) +// h.update_const(adjustment); +// } + +// r2 = Range(Restrict_Domain(r3, r2)); +// r = Intersection(r1, r2); + +// for (int i = 1; i <= n; i++) +// r.name_set_var(i, name[i]); +// r.setup_names(); +// } + +// void adjust_loop_bound(Relation &r, int dim, Free_Var_Decl *global_var, int adjustment) { +// assert(r.is_set()); +// const int n = r.n_set(); +// Tuple name(n); +// for (int i = 1; i <= n; i++) +// name[i] = r.set_var(i)->name(); + +// Relation r1 = project_onto_levels(copy(r), dim+1, true); +// Relation r2 = Gist(r, copy(r1)); + +// Relation r3(n); +// Variable_ID v = r2.get_local(global_var); + +// for (DNF_Iterator di(r2.query_DNF()); di; di++) { +// for (EQ_Iterator ei = (*di)->EQs(); ei; ei++) { +// coef_t c = (*ei).get_coef(v); +// EQ_Handle h = r3.and_with_EQ(*ei); +// if (c != 0) +// h.update_const(c*adjustment); +// } +// for (GEQ_Iterator gi = (*di)->GEQs(); gi; gi++) { +// coef_t c = (*gi).get_coef(v); +// GEQ_Handle h = r3.and_with_GEQ(*gi); +// if (c != 0) +// h.update_const(c*adjustment); +// } +// } + +// r = Intersection(r1, r3); +// for (int i = 1; i <= n; i++) +// r.name_set_var(i, name[i]); +// r.setup_names(); +// } + + + +//------------------------------------------------------------------------------ +// If the dimension has value posInfinity, the statement should be privatized +// at this dimension. +//------------------------------------------------------------------------------ +// boolean is_private_statement(const Relation &r, int dim) { +// int n; +// if (r.is_set()) +// n = r.n_set(); +// else +// n = r.n_out(); + +// if (dim >= n) +// return false; + +// try { +// coef_t c; +// if (r.is_set()) +// c = get_const(r, dim, Set_Var); +// else +// c = get_const(r, dim, Output_Var); +// if (c == posInfinity) +// return true; +// else +// return false; +// } +// catch (loop_error e){ +// } + +// return false; +// } + + + +// // ---------------------------------------------------------------------------- +// // Calculate v mod dividend based on equations inside relation r. +// // Return posInfinity if it is not a constant. +// // ---------------------------------------------------------------------------- +// static coef_t mod_(const Relation &r_, Variable_ID v, int dividend, std::set &working_on) { +// assert(dividend > 0); +// if (v->kind() == Forall_Var || v->kind() == Exists_Var || v->kind() == Wildcard_Var) +// return posInfinity; + +// working_on.insert(v); + +// Relation &r = const_cast(r_); +// Conjunct *c = r.query_DNF()->single_conjunct(); + +// for (EQ_Iterator ei(c->EQs()); ei; ei++) { +// int coef = mod((*ei).get_coef(v), dividend); +// if (coef != 1 && coef != dividend - 1 ) +// continue; + +// coef_t result = 0; +// for (Constr_Vars_Iter cvi(*ei); cvi; cvi++) +// if ((*cvi).var != v) { +// int p = mod((*cvi).coef, dividend); + +// if (p == 0) +// continue; + +// if (working_on.find((*cvi).var) != working_on.end()) { +// result = posInfinity; +// break; +// } + +// coef_t q = mod_(r, (*cvi).var, dividend, working_on); +// if (q == posInfinity) { +// result = posInfinity; +// break; +// } +// result += p * q; +// } + +// if (result != posInfinity) { +// result += (*ei).get_const(); +// if (coef == 1) +// result = -result; +// working_on.erase(v); + +// return mod(result, dividend); +// } +// } + +// working_on.erase(v); +// return posInfinity; +// } + + +// coef_t mod(const Relation &r, Variable_ID v, int dividend) { +// std::set working_on = std::set(); + +// return mod_(r, v, dividend, working_on); +// } + + + +//----------------------------------------------------------------------------- +// Generate mapping relation for permuation. +//----------------------------------------------------------------------------- +Relation permute_relation(const std::vector &pi) { + const int n = pi.size(); + + Relation r(n, n); + F_And *f_root = r.add_and(); + + for (int i = 0; i < n; i++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(r.output_var(i+1), 1); + h.update_coef(r.input_var(pi[i]+1), -1); + } + + return r; +} + + + +//--------------------------------------------------------------------------- +// Find the position index variable in a Relation by name. +//--------------------------------------------------------------------------- +Variable_ID find_index(Relation &r, const std::string &s, char side) { + // Omega quirks: assure the names are propagated inside the relation + r.setup_names(); + + if (r.is_set()) { // side == 's' + for (int i = 1; i <= r.n_set(); i++) { + std::string ss = r.set_var(i)->name(); + if (s == ss) { + return r.set_var(i); + } + } + } + else if (side == 'w') { + for (int i = 1; i <= r.n_inp(); i++) { + std::string ss = r.input_var(i)->name(); + if (s == ss) { + return r.input_var(i); + } + } + } + else { // side == 'r' + for (int i = 1; i <= r.n_out(); i++) { + std::string ss = r.output_var(i)->name(); + if (s+"'" == ss) { + return r.output_var(i); + } + } + } + + return NULL; +} + +// EQ_Handle get_eq(const Relation &r, int dim, Var_Kind type) { +// Variable_ID v; +// switch (type) { +// case Set_Var: +// v = r.set_var(dim+1); +// break; +// case Input_Var: +// v = r.input_var(dim+1); +// break; +// case Output_Var: +// v = r.output_var(dim+1); +// break; +// default: +// return NULL; +// } +// for (DNF_iterator di(r.query_DNF()); di; di++) +// for (EQ_Iterator ei = (*di)->EQs(); ei; ei++) +// if ((*ei).get_coef(v) != 0) +// return (*ei); + +// return NULL; +// } + + +// std::Pair split_loop(const Relation &r, const Relation &cond) { +// Relation r1 = Intersection(copy(r), copy(cond)); +// Relation r2 = Intersection(copy(r), Complement(copy(cond))); + +// return std::Pair(r1, r2); +// } diff --git a/chill/src/parse_expr.ll b/chill/src/parse_expr.ll new file mode 100644 index 0000000..a9b389f --- /dev/null +++ b/chill/src/parse_expr.ll @@ -0,0 +1,24 @@ +%{ +// some C++ code +#include "chill_run_util.hh" +#include "parse_expr.tab.hh" +%} + +%option noyywrap + +%% +[ \t]+ /*ignore*/ +\n /*ignore*/ +L[0-9]+ { yylval.val = atoi(&yytext[1]); return LEVEL; } +[0-9]+ { yylval.val = atoi(yytext); return NUMBER; } +\<\= return LE; +\>\= return GE; +\=(\=)? return EQ; +[a-zA-Z_][a-zA-Z_0-9]* { + yylval.str_val = new char[yyleng+1]; + strcpy(yylval.str_val, yytext); + return VARIABLE; + } +. return (int)yytext[0]; +%% + diff --git a/chill/src/parse_expr.yy b/chill/src/parse_expr.yy new file mode 100644 index 0000000..c2943c2 --- /dev/null +++ b/chill/src/parse_expr.yy @@ -0,0 +1,85 @@ +%{ +#include "chill_run_util.hh" +#include "parse_expr.ll.hh" + +extern int yydebug; + +void yyerror(const char*); +int yyparse(simap_vec_t** rel); + +static simap_vec_t* return_rel; // used as the return value for yyparse + +%} + +%union { + int val; + char* str_val; + simap_t* cond_item; + simap_vec_t* cond; +} + +%token NUMBER +%token LEVEL +%token VARIABLE + +%left LE GE EQ '<' '>' +%left '-' '+' '*' '/' + +/*the final output from this language should be an Omega Relation object*/ +%type cond prog +%type expr add_expr mul_expr neg_expr + +%% +prog : cond { return_rel = make_prog($1); } +; + +cond : expr '>' expr { $$ = make_cond_gt($1, $3); } + | expr '<' expr { $$ = make_cond_lt($1, $3); } + | expr GE expr { $$ = make_cond_ge($1, $3); } + | expr LE expr { $$ = make_cond_le($1, $3); } + | expr EQ expr { $$ = make_cond_eq($1, $3); } +; + +expr : add_expr { $$ = $1; } +; + +add_expr : add_expr '+' mul_expr { $$ = make_cond_item_add($1,$3); } + | add_expr '-' mul_expr { $$ = make_cond_item_sub($1,$3); } + | mul_expr { $$ = $1; } +; + +mul_expr : mul_expr '*' neg_expr { $$ = make_cond_item_mul($1,$3); } + | neg_expr { $$ = $1; } +; + +neg_expr : '-' neg_expr { $$ = make_cond_item_neg($2); } + | '(' expr ')' { $$ = $2; } + | NUMBER { $$ = make_cond_item_number($1); } + | LEVEL { $$ = make_cond_item_level($1); } + | VARIABLE { $$ = make_cond_item_variable($1); } +; +%% + +void yyerror(const char* msg) { + fprintf(stderr, "Parse error: %s", msg); +} + +simap_vec_t* parse_relation_vector(const char* expr) { + yydebug=0; + YY_BUFFER_STATE state; + + //if(yylex_init()) { + // TODO: error out or something + //} + + state = yy_scan_string(expr); + + if(yyparse()) { + // TODO: error out or something + } + + yy_delete_buffer(state); + yylex_destroy(); + return return_rel; +} + diff --git a/chill_error.hh b/chill_error.hh deleted file mode 100644 index dc7432f..0000000 --- a/chill_error.hh +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef CHILL_ERROR_HH -#define CHILL_ERROR_HH - -// for loop transformation problem -struct loop_error: public std::runtime_error { - loop_error(const std::string &msg): std::runtime_error(msg){} -}; - -// for generic compiler intermediate code handling problem -struct ir_error: public std::runtime_error { - ir_error(const std::string &msg): std::runtime_error(msg){} -}; - -// specific for expression to preburger math translation problem -struct ir_exp_error: public ir_error { - ir_exp_error(const std::string &msg): ir_error(msg){} -}; - -#endif diff --git a/chill_run.cc b/chill_run.cc deleted file mode 100644 index 59cd6e5..0000000 --- a/chill_run.cc +++ /dev/null @@ -1,394 +0,0 @@ -#include "chilldebug.h" - -// this is a little messy. the Makefile should be able to define one or the other -#ifndef PYTHON -#ifndef LUA -#define LUA -#endif -#endif - -#include -#include -#include -#include - -//#include "chill_env.hh" - -#include "loop.hh" -#include -#include "ir_code.hh" - -#ifdef CUDACHILL - -#ifdef BUILD_ROSE -#include "loop_cuda_rose.hh" -#include "ir_cudarose.hh" -#elif BUILD_SUIF -#include "loop_cuda.hh" -#include "ir_cudasuif.hh" -#endif - -#else - -#ifdef BUILD_ROSE -#include "ir_rose.hh" -#elif BUILD_SUIF -#include "ir_suif.hh" -#endif - -#endif - -#ifdef LUA -#define lua_c //Get the configuration defines for doing an interactive shell -#include //All lua includes wrapped in extern "C" -#include "chill_env.hh" // Lua wrapper functions for CHiLL -#elif PYTHON -#include "chillmodule.hh" // Python wrapper functions for CHiLL -#endif - -//--- -// CHiLL globals -//--- -Loop *myloop = NULL; -IR_Code *ir_code = NULL; -bool repl_stop = false; -bool is_interactive = false; - -std::vector ir_controls; -std::vector loops; - -// this whole section belongs somewhere else -#ifdef LUA -//--- -// Interactive mode functions, directly copied out of lua.c -//--- -// The Lua interpreter state -static lua_State *globalL = NULL; -static const char *progname = "CHiLL"; - -static void lstop (lua_State *L, lua_Debug *ar) { - (void)ar; /* unused arg. */ - lua_sethook(L, NULL, 0, 0); - luaL_error(L, "interrupted!"); -} - - -static void laction (int i) { - signal(i, SIG_DFL); /* if another SIGINT happens before lstop, - terminate process (default action) */ - lua_sethook(globalL, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1); -} - - -static void l_message (const char *pname, const char *msg) { - if (pname) fprintf(stderr, "%s: ", pname); - fprintf(stderr, "%s\n", msg); - fflush(stderr); // ? does this do anything ? -} - - -static int report (lua_State *L, int status) { - if (status && !lua_isnil(L, -1)) { - const char *msg = lua_tostring(L, -1); - if (msg == NULL) msg = "(error object is not a string)"; - l_message(progname, msg); - lua_pop(L, 1); - } - return status; -} - - -static int traceback (lua_State *L) { - if (!lua_isstring(L, 1)) /* 'message' not a string? */ - return 1; /* keep it intact */ - lua_getfield(L, LUA_GLOBALSINDEX, "debug"); - if (!lua_istable(L, -1)) { - lua_pop(L, 1); - return 1; - } - lua_getfield(L, -1, "traceback"); - if (!lua_isfunction(L, -1)) { - lua_pop(L, 2); - return 1; - } - lua_pushvalue(L, 1); /* pass error message */ - lua_pushinteger(L, 2); /* skip this function and traceback */ - lua_call(L, 2, 1); /* call debug.traceback */ - return 1; -} - - -static int docall (lua_State *L, int narg, int clear) { - DEBUG_PRINT("\ndocall()\n"); - int status; - int base = lua_gettop(L) - narg; /* function index */ - lua_pushcfunction(L, traceback); /* push traceback function */ - lua_insert(L, base); /* put it under chunk and args */ - signal(SIGINT, laction); - - DEBUG_PRINT("status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base);\n"); - - status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base); - signal(SIGINT, SIG_DFL); - lua_remove(L, base); /* remove traceback function */ - /* force a complete garbage collection in case of errors */ - if (status != 0) lua_gc(L, LUA_GCCOLLECT, 0); - return status; -} - -static int dofile (lua_State *L, const char *name) { - int status = luaL_loadfile(L, name) || docall(L, 0, 1); - return report(L, status); -} - -static const char *get_prompt (lua_State *L, int firstline) { - const char *p; - lua_getfield(L, LUA_GLOBALSINDEX, firstline ? "_PROMPT" : "_PROMPT2"); - p = lua_tostring(L, -1); - if (p == NULL) p = (firstline ? LUA_PROMPT : LUA_PROMPT2); - lua_pop(L, 1); /* remove global */ - return p; -} - - -static int incomplete (lua_State *L, int status) { - if (status == LUA_ERRSYNTAX) { - size_t lmsg; - const char *msg = lua_tolstring(L, -1, &lmsg); - const char *tp = msg + lmsg - (sizeof(LUA_QL("")) - 1); - if (strstr(msg, LUA_QL("")) == tp) { - lua_pop(L, 1); - return 1; - } - } - return 0; /* else... */ -} - - -static int pushline (lua_State *L, int firstline) { - char buffer[LUA_MAXINPUT]; - char *b = buffer; - size_t l; - const char *prmt = get_prompt(L, firstline); - if (lua_readline(L, b, prmt) == 0) - return 0; /* no input */ - l = strlen(b); - if (l > 0 && b[l-1] == '\n') /* line ends with newline? */ - b[l-1] = '\0'; /* remove it */ - if (firstline && b[0] == '=') /* first line starts with `=' ? */ - lua_pushfstring(L, "return %s", b+1); /* change it to `return' */ - else - lua_pushstring(L, b); - lua_freeline(L, b); - return 1; -} - - -static int loadline (lua_State *L) { - int status; - lua_settop(L, 0); - if (!pushline(L, 1)) - return -1; /* no input */ - for (;;) { /* repeat until gets a complete line */ - status = luaL_loadbuffer(L, lua_tostring(L, 1), lua_strlen(L, 1), "=stdin"); - if (!incomplete(L, status)) break; /* cannot try to add lines? */ - if (!pushline(L, 0)) /* no more input? */ - return -1; - lua_pushliteral(L, "\n"); /* add a new line... */ - lua_insert(L, -2); /* ...between the two lines */ - lua_concat(L, 3); /* join them */ - } - lua_saveline(L, 1); - lua_remove(L, 1); /* remove line */ - return status; -} - - -static void dotty (lua_State *L) { - int status; - const char *oldprogname = progname; - progname = NULL; - while ((status = loadline(L)) != -1) { - if (status == 0) status = docall(L, 0, 0); - report(L, status); - if(repl_stop) - break; - if (status == 0 && lua_gettop(L) > 0) { /* any result to print? */ - lua_getglobal(L, "print"); - lua_insert(L, 1); - if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != 0) - l_message(progname, lua_pushfstring(L, - "error calling " LUA_QL("print") " (%s)", - lua_tostring(L, -1))); - } - } - lua_settop(L, 0); /* clear stack */ - fputs("\n", stdout); - fflush(stdout); - progname = oldprogname; -} -#endif - -//--- -//--- - -//--- -// CHiLL program main -// Initialize state and run script or interactive mode -//--- -int main( int argc, char* argv[] ) -{ - DEBUG_PRINT("%s main()\n", argv[0]); - if (argc > 2) { - fprintf(stderr, "Usage: %s [script_file]\n", argv[0]); - exit(-1); - } - - int fail = 0; - -#ifdef PYTHON - // Create PYTHON interpreter - /* Pass argv[0] to the Python interpreter */ - Py_SetProgramName(argv[0]); - - /* Initialize the Python interpreter. Required. */ - Py_Initialize(); - - /* Add a static module */ - initchill(); - - if (argc == 2) { -/* #ifdef CUDACHILL --- This code is for translating lua to python before interprating. --- - //DEBUG_PRINT("\ncalling python\n"); - // file interpretlua.py has routines to read the lua transformation file - PyRun_SimpleString("from interpretlua import *"); - //DEBUG_PRINT("DONE calling python import of functions\n\n"); - char pythoncommand[800]; - sprintf(pythoncommand, "\n\ndopytransform(\"%s\")\0", argv[1]); - //DEBUG_PRINT("in C, running python command '%s'\n", pythoncommand); - - PyRun_SimpleString( pythoncommand ); - #else*/ - FILE* f = fopen(argv[1], "r"); - if(!f){ - printf("can't open script file \"%s\"\n", argv[1]); - exit(-1); - } - PyRun_SimpleFile(f, argv[1]); - fclose(f); - } - if (argc == 1) { - //--- - // Run a CHiLL interpreter - //--- - printf("CHiLL v0.2.1 (built on %s)\n", CHILL_BUILD_DATE); - printf("Copyright (C) 2008 University of Southern California\n"); - printf("Copyright (C) 2009-2012 University of Utah\n"); - //is_interactive = true; // let the lua interpreter know. - fflush(stdout); - // TODO: read lines of python code. - //Not sure if we should set fail from interactive mode - printf("CHiLL ending...\n"); - fflush(stdout); - } - - //printf("DONE with PyRun_SimpleString()\n"); -// #endif --- endif for CUDACHILL --- -#endif - //END python setup -#ifdef LUA - - //Create interpreter - lua_State* L = lua_open(); - globalL = L; - - //Initialize the std libs - luaL_openlibs(L); - - //Initialize globals - register_globals(L); - - //Register CHiLL functions - register_functions(L); - - if (argc == 2) { - //--- - // Run a CHiLL script from a file - //--- - - //Check that the file can be opened - FILE* f = fopen(argv[1],"r"); - if(!f){ - printf("can't open script file \"%s\"\n", argv[1]); - exit(-1); - } - fclose(f); - - DEBUG_PRINT("\n*********************evaluating file '%s'\n", argv[1]); - - //Evaluate the file - fail = dofile(L, argv[1]); - if(!fail){ - fprintf(stderr, "script success!\n"); - } - } - if (argc == 1 && isatty((int)fileno(stdin))) { - //--- - // Run a CHiLL interpreter - //--- - printf("CUDA-CHiLL v0.2.1 (built on %s)\n", CHILL_BUILD_DATE); - printf("Copyright (C) 2008 University of Southern California\n"); - printf("Copyright (C) 2009-2012 University of Utah\n"); - is_interactive = true; // let the lua interpreter know. - fflush(stdout); - dotty(L); - //Not sure if we should set fail from interactive mode - printf("CUDA-CHiLL ending...\n"); - fflush(stdout); - } -#endif - - - if (!fail && ir_code != NULL && myloop != NULL && myloop->stmt.size() != 0 && !myloop->stmt[0].xform.is_null()) { -#ifdef CUDACHILL - int lnum; - #ifdef PYTHON - lnum = 0; - #else - lnum = get_loop_num( L ); - #endif - #ifdef BUILD_ROSE - ((IR_cudaroseCode *)(ir_code))->commit_loop(myloop, lnum); - #elif BUILD_SUIF - ((IR_cudasuifCode *)(ir_code))->commit_loop(myloop, lnum); - #endif -#else - int lnum_start; - int lnum_end; - #ifdef PYTHON - lnum_start = get_loop_num_start(); - lnum_end = get_loop_num_end(); - DEBUG_PRINT("calling ROSE code gen? loop num %d\n", lnum); - #else - lnum_start = get_loop_num_start(L); - lnum_end = get_loop_num_end(L); - DEBUG_PRINT("calling ROSE code gen? loop num %d - %d\n", lnum_start, lnum_end); - #endif -#endif - #ifdef BUILD_ROSE - finalize_loop(lnum_start, lnum_end); - //((IR_roseCode*)(ir_cide))->commit_loop(myloop, lnum); - ((IR_roseCode*)(ir_code))->finalizeRose(); - //#elif BUILD_SUIF - //((IR_suifCode*)(ir_code))->commit_loop(myloop, lnum); - #endif - delete ir_code; - } -#ifdef PYTHON - Py_Finalize(); -#endif -#ifdef LUA - lua_close(L); -#endif - return 0; -} diff --git a/chill_run_util.cc b/chill_run_util.cc deleted file mode 100644 index 566bc61..0000000 --- a/chill_run_util.cc +++ /dev/null @@ -1,129 +0,0 @@ -#include -#include -#include "chill_run_util.hh" - -static std::string to_string(int ival) { - char buffer[4]; - sprintf(buffer, "%d", ival); - return std::string(buffer); -} - -simap_vec_t* make_prog(simap_vec_t* cond) { - return cond; -} - -simap_vec_t* make_cond_gt(simap_t* lhs, simap_t* rhs) { - simap_vec_t* nvec = new simap_vec_t(); - for(simap_t::iterator it = rhs->begin(); it != rhs->end(); it++) - (*lhs)[it->first] -= it->second; - (*lhs)[to_string(0)] -= 1; - nvec->push_back(*lhs); - delete rhs; - delete lhs; - return nvec; -} - -simap_vec_t* make_cond_lt(simap_t* lhs, simap_t* rhs) { - return make_cond_gt(rhs, lhs); -} - -simap_vec_t* make_cond_ge(simap_t* lhs, simap_t* rhs) { - simap_vec_t* nvec = new simap_vec_t(); - for(simap_t::iterator it = rhs->begin(); it != rhs->end(); it++) - (*lhs)[it->first] -= it->second; - nvec->push_back(*lhs); - delete rhs; - delete lhs; - return nvec; -} - -simap_vec_t* make_cond_le(simap_t* lhs, simap_t* rhs) { - return make_cond_ge(rhs, lhs); -} - -simap_vec_t* make_cond_eq(simap_t* lhs, simap_t* rhs) { - simap_vec_t* nvec = new simap_vec_t(); - for(simap_t::iterator it = lhs->begin(); it != lhs->end(); it++) - (*rhs)[it->first] -= it->second; - nvec->push_back(*rhs); - for(simap_t::iterator it = rhs->begin(); it != rhs->end(); it++) - it->second = -it->second; - nvec->push_back(*rhs); - delete rhs; - delete lhs; - return nvec; -} - -simap_t* make_cond_item_add(simap_t* lhs, simap_t* rhs) { - for(simap_t::iterator it = lhs->begin(); it != lhs->end(); it++) - (*rhs)[it->first] += it->second; - delete lhs; - return rhs; -} - -simap_t* make_cond_item_sub(simap_t* lhs, simap_t* rhs) { - for(simap_t::iterator it = lhs->begin(); it != lhs->end(); it++) - (*rhs)[it->first] -= it->second; - delete lhs; - return rhs; -} - -simap_t* make_cond_item_mul(simap_t* lhs, simap_t* rhs) { - (*lhs)[to_string(0)] += 0; - (*rhs)[to_string(0)] += 0; - if(rhs->size() == 1) { - int t = (*rhs)[to_string(0)]; - for(simap_t::iterator it = lhs->begin(); it != lhs->end(); it++) - it->second *= t; - delete rhs; - return lhs; - } - else if(rhs->size() == 1) { - int t = (*lhs)[to_string(0)]; - for(simap_t::iterator it = rhs->begin(); it != rhs->end(); it++) - it->second *= t; - delete lhs; - return rhs; - } - else { - fprintf(stderr, "require Presburger formula"); - delete lhs; - delete rhs; - // exit(2); <-- this may be a boost feature - } -} - -simap_t* make_cond_item_neg(simap_t* expr) { - for (simap_t::iterator it = expr->begin(); it != expr->end(); it++) { - it->second = -(it->second); - } - return expr; -} - -simap_t* make_cond_item_number(int n) { - simap_t* nmap = new simap_t(); - (*nmap)[to_string(0)] = n; - return nmap; -} - -simap_t* make_cond_item_variable(const char* var) { - simap_t* nmap = new simap_t(); - (*nmap)[std::string(var)] = 1; - return nmap; -} - -simap_t* make_cond_item_level(int n) { - simap_t* nmap = new simap_t(); - (*nmap)[to_string(n)] = 1; - return nmap; -} - -/*simap_t* make_cond_item_variable(const char* varname) { - simap_t* nmap = new simap_t(); -#ifdef PYTHON - PyObject* globals = PyEval_GetGlobals(); - PyObject* itemval = PyDict_GetItemString(globals, varname); - -#elif LUA -#endif -}*/ diff --git a/chill_run_util.hh b/chill_run_util.hh deleted file mode 100644 index 8df5871..0000000 --- a/chill_run_util.hh +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef CHILL_RUN_UTIL_HH -#define CHILL_RUN_UTIL_HH - -#include -#include -#include - -typedef std::map simap_t; -typedef std::vector > simap_vec_t; - -// in chill_run_util.cc -simap_vec_t* make_prog(simap_vec_t* cond); -simap_vec_t* make_cond_gt(simap_t* lhs, simap_t* rhs); -simap_vec_t* make_cond_lt(simap_t* lhs, simap_t* rhs); -simap_vec_t* make_cond_ge(simap_t* lhs, simap_t* rhs); -simap_vec_t* make_cond_le(simap_t* lhs, simap_t* rhs); -simap_vec_t* make_cond_eq(simap_t* lhs, simap_t* rhs); -simap_t* make_cond_item_add(simap_t* lhs, simap_t* rhs); -simap_t* make_cond_item_sub(simap_t* lhs, simap_t* rhs); -simap_t* make_cond_item_mul(simap_t* lhs, simap_t* rhs); -simap_t* make_cond_item_neg(simap_t* expr); -simap_t* make_cond_item_number(int n); -simap_t* make_cond_item_variable(const char* var); -simap_t* make_cond_item_level(int n); - -// in parse_expr.yy -simap_vec_t* parse_relation_vector(const char* expr); - -#endif diff --git a/chilldebug.h b/chilldebug.h deleted file mode 100644 index 4abbb82..0000000 --- a/chilldebug.h +++ /dev/null @@ -1,11 +0,0 @@ - -// a central place to turn on debugging messages - -// enable the next line to get lots of output -//#define DEBUGCHILL - -#ifdef DEBUGCHILL -#define DEBUG_PRINT(args...) fprintf(stderr, args ) -#else -#define DEBUG_PRINT(args...) /* Don't do anything */ -#endif diff --git a/chillmodule.cc b/chillmodule.cc deleted file mode 100644 index fbeb477..0000000 --- a/chillmodule.cc +++ /dev/null @@ -1,1834 +0,0 @@ - -// chill interface to python - -#include "chilldebug.h" - -#ifdef CUDACHILL - -#include "rose.h" // ?? -#include "loop_cuda_rose.hh" -#include "ir_rose.hh" -#include "ir_cudarose.hh" - -#include - -#else - -#include "chill_run_util.hh" - -#include -#include -#include -#include - -#include -#include "loop.hh" -#include "ir_code.hh" -#ifdef BUILD_ROSE -#include "ir_rose.hh" -#elif BUILD_SUIF -#include "ir_suif.hh" -#endif - -#endif - -#include "chillmodule.hh" - -// TODO -#undef _POSIX_C_SOURCE -#undef _XOPEN_SOURCE -#include - -using namespace omega; - -// -- Cuda CHiLL global variables -- -#ifdef CUDACHILL - -extern LoopCuda *myloop; -extern IR_Code *ir_code; -extern std::vector ir_controls; -extern std::vector loops; - -#else - -extern Loop *myloop; -extern IR_Code *ir_code; -extern bool is_interactive; -extern bool repl_stop; - -std::string procedure_name; -std::string source_filename; - -int loop_start_num; -int loop_end_num; - -extern std::vector ir_controls; -extern std::vector loops; - -#endif - -// ----------------------- // -// CHiLL support functions // -// ----------------------- // -#ifndef CUDACHILL -// not sure yet if this actually needs to be exposed to the python interface -// these four functions are here to maintain similarity to the Lua interface -int get_loop_num_start() { - return loop_start_num; -} - -int get_loop_num_end() { - return loop_end_num; -} - -static void set_loop_num_start(int start_num) { - loop_start_num = start_num; -} - -static void set_loop_num_end(int end_num) { - loop_end_num = end_num; -} - -// TODO: finalize_loop(int,int) and init_loop(int,int) are identical to thier Lua counterparts. -// consider integrating them - -void finalize_loop(int loop_num_start, int loop_num_end) { - if (loop_num_start == loop_num_end) { - ir_code->ReplaceCode(ir_controls[loops[loop_num_start]], myloop->getCode()); - ir_controls[loops[loop_num_start]] = NULL; - } - else { - std::vector parm; - for (int i = loops[loop_num_start]; i <= loops[loop_num_end]; i++) - parm.push_back(ir_controls[i]); - IR_Block *block = ir_code->MergeNeighboringControlStructures(parm); - ir_code->ReplaceCode(block, myloop->getCode()); - for (int i = loops[loop_num_start]; i <= loops[loop_num_end]; i++) { - delete ir_controls[i]; - ir_controls[i] = NULL; - } - } - delete myloop; -} -void finalize_loop() { - int loop_num_start = get_loop_num_start(); - int loop_num_end = get_loop_num_end(); - finalize_loop(loop_num_start, loop_num_end); -} -static void init_loop(int loop_num_start, int loop_num_end) { - if (source_filename.empty()) { - fprintf(stderr, "source file not set when initializing the loop"); - if (!is_interactive) - exit(2); - } - else { - if (ir_code == NULL) { - #ifdef BUILD_ROSE - if (procedure_name.empty()) - procedure_name = "main"; - #elif BUILD_SUIF - if (procedure_number == -1) - procedure_number = 0; - #endif - - #ifdef BUILD_ROSE - ir_code = new IR_roseCode(source_filename.c_str(), procedure_name.c_str()); - #elif BUILD_SUIF - ir_code = new IR_suifCode(source_filename.c_str(), procedure_name.c_str()); - #endif - - IR_Block *block = ir_code->GetCode(); - ir_controls = ir_code->FindOneLevelControlStructure(block); - for (int i = 0; i < ir_controls.size(); i++) { - if (ir_controls[i]->type() == IR_CONTROL_LOOP) - loops.push_back(i); - } - delete block; - } - if (myloop != NULL && myloop->isInitialized()) { - finalize_loop(); - } - } - set_loop_num_start(loop_num_start); - set_loop_num_end(loop_num_end); - if (loop_num_end < loop_num_start) { - fprintf(stderr, "the last loop must be after the start loop"); - if (!is_interactive) - exit(2); - } - if (loop_num_end >= loops.size()) { - fprintf(stderr, "loop %d does not exist", loop_num_end); - if (!is_interactive) - exit(2); - } - std::vector parm; - for (int i = loops[loop_num_start]; i <= loops[loop_num_end]; i++) { - if (ir_controls[i] == NULL) { - fprintf(stderr, "loop has already been processed"); - if (!is_interactive) - exit(2); - } - parm.push_back(ir_controls[i]); - } - IR_Block *block = ir_code->MergeNeighboringControlStructures(parm); - myloop = new Loop(block); - delete block; - //if (is_interactive) printf("%s ", PROMPT_STRING); -} -#endif - -// ----------------------- // -// Python support funcions // -// ----------------------- // - -// -- CHiLL support -- // -static void strict_arg_num(PyObject* args, int arg_num, const char* fname = NULL) { - int arg_given = PyTuple_Size(args); - char msg[128]; - if(arg_num != arg_given) { - if(fname) - sprintf(msg, "%s: expected %i arguments, was given %i.", fname, arg_num, arg_given); - else - sprintf(msg, "Expected %i argumets, was given %i.", arg_num, arg_given); - throw std::runtime_error(msg); - } -} - -static int strict_arg_range(PyObject* args, int arg_min, int arg_max, const char* fname = NULL) { - int arg_given = PyTuple_Size(args); - char msg[128]; - if(arg_given < arg_min || arg_given > arg_max) { - if(fname) - sprintf(msg, "%s: expected %i to %i arguments, was given %i.", fname, arg_min, arg_max, arg_given); - else - sprintf(msg, "Expected %i to %i, argumets, was given %i.", arg_min, arg_max, arg_given); - throw std::runtime_error(msg); - } - return arg_given; -} - -static int intArg(PyObject* args, int index, int dval = 0) { - if(PyTuple_Size(args) <= index) - return dval; - int ival; - PyObject *item = PyTuple_GetItem(args, index); - Py_INCREF(item); - if (PyInt_Check(item)) ival = PyInt_AsLong(item); - else { - fprintf(stderr, "argument at index %i is not an int\n", index); - exit(-1); - } - return ival; -} - -static std::string strArg(PyObject* args, int index, const char* dval = NULL) { - if(PyTuple_Size(args) <= index) - return dval; - std::string strval; - PyObject *item = PyTuple_GetItem(args, index); - Py_INCREF(item); - if (PyString_Check(item)) strval = strdup(PyString_AsString(item)); - else { - fprintf(stderr, "argument at index %i is not an string\n", index); - exit(-1); - } - return strval; -} - -static bool boolArg(PyObject* args, int index, bool dval = false) { - if(PyTuple_Size(args) <= index) - return dval; - bool bval; - PyObject* item = PyTuple_GetItem(args, index); - Py_INCREF(item); - return (bool)PyObject_IsTrue(item); -} - -static bool tostringintmapvector(PyObject* args, int index, std::vector >& vec) { - if(PyTuple_Size(args) <= index) - return false; - PyObject* seq = PyTuple_GetItem(args, index); - //TODO: Typecheck - int seq_len = PyList_Size(seq); - for(int i = 0; i < seq_len; i++) { - std::map map; - PyObject* dict = PyList_GetItem(seq, i); - PyObject* keys = PyDict_Keys(dict); - //TODO: Typecheck - int dict_len = PyList_Size(keys); - for(int j = 0; j < dict_len; j++) { - PyObject* key = PyList_GetItem(keys, j); - PyObject* value = PyDict_GetItem(dict, key); - std::string str_key = strdup(PyString_AsString(key)); - int int_value = PyInt_AsLong(value); - map[str_key] = int_value; - } - vec.push_back(map); - } - return true; -} - -static bool tointvector(PyObject* seq, std::vector& vec) { - //TODO: Typecheck - int seq_len = PyList_Size(seq); - for(int i = 0; i < seq_len; i++) { - PyObject* item = PyList_GetItem(seq, i); - vec.push_back(PyInt_AsLong(item)); - } - return true; -} - -static bool tointvector(PyObject* args, int index, std::vector& vec) { - if(PyTuple_Size(args) <= index) - return false; - PyObject* seq = PyTuple_GetItem(args, index); - return tointvector(seq, vec); -} - -static bool tointset(PyObject* args, int index, std::set& set) { - if(PyTuple_Size(args) <= index) - return false; - PyObject* seq = PyTuple_GetItem(args, index); - //TODO: Typecheck - int seq_len = PyList_Size(seq); - for(int i = 0; i < seq_len; i++) { - PyObject* item = PyList_GetItem(seq, i); - set.insert(PyInt_AsLong(item)); - } - return true; -} -static bool tointmatrix(PyObject* args, int index, std::vector >& mat) { - if(PyTuple_Size(args) <= index) - return false; - PyObject* seq_one = PyTuple_GetItem(args, index); - int seq_one_len = PyList_Size(seq_one); - for(int i = 0; i < seq_one_len; i++) { - std::vector vec; - PyObject* seq_two = PyList_GetItem(seq_one, i); - int seq_two_len = PyList_Size(seq_two); - for(int j = 0; j < seq_two_len; j++) { - PyObject* item = PyList_GetItem(seq_two, j); - vec.push_back(PyInt_AsLong(item)); - } - mat.push_back(vec); - } - return true; -} - -#ifdef CUDACHILL -// ------------------------------ // -// Cuda CHiLL interface functions // -// ------------------------------ // - -static PyObject * -chill_print_code(PyObject *self, PyObject *args) -{ - //DEBUG_PRINT("\nC print_code() PY\n"); - - myloop->printCode(); - - Py_RETURN_NONE; // return Py_BuildValue( "" ); - -} - -static PyObject * -chill_print_ri(PyObject *self, PyObject *args) -{ - //DEBUG_PRINT("\nC chill_print_ri() called from python\n"); - myloop->printRuntimeInfo(); - DEBUG_PRINT("\n"); - Py_RETURN_NONE; // return Py_BuildValue( "" ); -} - -static PyObject * -chill_print_idx(PyObject *self, PyObject *args) -{ - //DEBUG_PRINT("\nC chill_print_idx() called from python\n"); - myloop->printIndexes(); - DEBUG_PRINT("\n"); - Py_RETURN_NONE; // return Py_BuildValue( "" ); -} - -static PyObject * -chill_print_dep(PyObject *self, PyObject *args) -{ - DEBUG_PRINT("\nC chill_print_dep()\n"); - std::cout << myloop->dep; - Py_RETURN_NONE; // return Py_BuildValue( "" ); -} - -static PyObject * -chill_print_space(PyObject *self, PyObject *args) -{ - DEBUG_PRINT("\nC chill_print_space()\n"); - for (int i = 0; i < myloop->stmt.size(); i++) { - DEBUG_PRINT("s%d: ", i+1); - Relation r; - if (!myloop->stmt[i].xform.is_null()) - r = Composition(copy(myloop->stmt[i].xform), copy(myloop->stmt[i].IS)); - else - r = copy(myloop->stmt[i].IS); - r.simplify(2, 4); - r.print(); - } - Py_RETURN_NONE; // return Py_BuildValue( "" ); -} - -static PyObject * -chill_num_statements(PyObject *self, PyObject *args) -{ - //DEBUG_PRINT("\nC chill_num_statements() called from python\n"); - int num = myloop->stmt.size(); - //DEBUG_PRINT("C num_statement() = %d\n", num); - return Py_BuildValue( "i", num ); // BEWARE "d" is DOUBLE, not int -} - -static PyObject * -chill_does_var_exist( PyObject *self, PyObject *args) -{ - DEBUG_PRINT("\nC chill_does_var_exist()\n"); - int yesno = 0; - // TODO if (myloop->symbolExists(symName)) yesno = 1; - DEBUG_PRINT("*** chill_does_var_exist *** UNIMPLEMENTED\n"); - return Py_BuildValue( "i", yesno); // there seems to be no boolean type -} - - -static PyObject * -chill_add_sync(PyObject *self, PyObject *args) -{ - //DEBUG_PRINT("\nC chill_add_sync() *UNTESTED*\n"); - int sstmt = -123; - // char index_name[180]; - static char Buffer[1024]; - static char *index_name = &Buffer[0]; - - if (!PyArg_ParseTuple(args, "is", &sstmt, &index_name)){ - fprintf(stderr, "chill_add_sync, can't parse statement number and name passed from python\n"); - exit(-1); - } - - DEBUG_PRINT("chill_add_sync, statement %d index_name '%s'\n", - sstmt, index_name); - std::string idxName( index_name); // ?? - myloop->addSync(sstmt, idxName); - - Py_RETURN_NONE; // return Py_BuildValue( "" ); -} - -static PyObject * -chill_rename_index(PyObject *self, PyObject *args) -{ - DEBUG_PRINT("\nC chill_rename_index() called from python\n"); - int sstmt; - //char oldname[80], newname[80]; - static char old[1024], newn[1024]; - - static char *oldname = &old[0], *newname=&newn[0]; - - if (!PyArg_ParseTuple(args, "iss", &sstmt, &oldname, &newname)){ - fprintf(stderr, "chill_rename_index, can't parse statement number and names passed from python\n"); - exit(-1); - } - - //DEBUG_PRINT("chill_rename_index, statement %d oldname '%s' newname '%s'\n", - //sstmt, oldname, newname); - - std::string idxName(oldname); - std::string newName(newname); - - //DEBUG_PRINT("calling myloop->renameIndex( %d, %s, %s )\n", - //sstmt, idxName.c_str(), newName.c_str()); - - myloop->renameIndex(sstmt, idxName, newName); - - //DEBUG_PRINT("after myloop->renameIndex()\n"); - - Py_RETURN_NONE; // return Py_BuildValue( "" ); -} - - - -//THIS NEEDS TO MOVE - - - -static PyObject * -chill_permute_v2(PyObject *self, PyObject *args) -{ - //DEBUG_PRINT("C permute_v2()\n"); - //int tot = sizeof(args); - //int things = tot / sizeof(PyObject *); - //DEBUG_PRINT("tot %d bytes, %d things\n", tot, things); - - int sstmt = -123; - PyObject *pyObj; - - //if (!PyArg_ParseTuple( args, "iO", &sstmt, &pyObj)) { - //if (!PyArg_ParseTuple( args, "i", &sstmt)) { - if (!PyArg_ParseTuple( args, "O", &pyObj)) { // everything on a single tuple - fprintf(stderr, "failed to parse tuple\n"); - exit(-1); - } - Py_XINCREF(pyObj); - - // the ONLY arg is a tuple. figure out how big it is - int tupleSize = PyTuple_Size(pyObj); - //DEBUG_PRINT("%d things in order tuple\n", tupleSize); - - // first has to be the statement number - PyObject *tupleItem = PyTuple_GetItem(pyObj, 0); - Py_XINCREF(tupleItem); - if (PyInt_Check( tupleItem )) sstmt = PyInt_AsLong( tupleItem ); - else { - fflush(stdout); - fprintf(stderr, "first tuple item in chill_permute_v2 is not an int?\n"); - exit(-1); - } - - //DEBUG_PRINT("stmt %d\n", sstmt); - - char **strings; - std::vector order; - std::string *cppstrptr; - std::string cppstr; - - strings = (char **) malloc( sizeof(char *) * tupleSize ) ; // too big - for (int i=1; ipermute_cuda(sstmt,order); - //DEBUG_PRINT("returned from permute_cuda()\n"); - Py_RETURN_NONE; // return Py_BuildValue( "" ); -} - - -static PyObject * -chill_tile_v2_3arg( PyObject *self, PyObject *args) -{ - //DEBUG_PRINT("in chillmodule.cc, chill_tile_v2_3arg()\n"); - - int sstmt, level, tile_size, outer_level; - //char index_name[80], control_name[80]; - static char *index_name, *control_name; - int tiling_method; - - if (!PyArg_ParseTuple(args, "iii", &sstmt, &level, &outer_level)) { - fprintf(stderr,"chill_tile_v2, can't parse parameters passed from python\n"); - exit(-1); - } - - // 3 parameter version - //DEBUG_PRINT("chill_tile_v2( %d %d %d) (3 parameter version) \n", - //sstmt,level,outer_level); - myloop->tile_cuda(sstmt,level,outer_level); - //DEBUG_PRINT("chill_tile_v2 3 parameter version returning normally\n"); - Py_RETURN_NONE; -} - - -static PyObject * -chill_tile_v2_7arg( PyObject *self, PyObject *args) -{ - //DEBUG_PRINT("in chillmodule.cc, chill_tile_v2_7arg()\n"); - - int sstmt, level, tile_size, outer_level; - //char index_name[80], control_name[80]; - static char iname[1024], cname[1024]; - static char *index_name = &iname[0], *control_name=&cname[0]; - int tiling_method; - - if (!PyArg_ParseTuple(args, "iiiissi", - &sstmt, &level, &tile_size, &outer_level, - &index_name, &control_name, &tiling_method)){ - fprintf(stderr, "chill_tile_v2_7arg, can't parse parameters passed from python\n"); - exit(-1); - } - - //DEBUG_PRINT("7 parameter version was called?\n"); - - // 7 parameter version was called - //DEBUG_PRINT("tile_v2( %d, %d, %d, %d ... )\n", - // sstmt, level, tile_size, outer_level); - - //DEBUG_PRINT("tile_v2( %d, %d, %d, %d, %s, %s, %d)\n", - //sstmt,level,tile_size,outer_level,index_name, control_name, tiling_method); - - TilingMethodType method = StridedTile; - if (tiling_method == 0) method = StridedTile; - else if (tiling_method == 1) method = CountedTile; - else fprintf(stderr, "ERROR: tile_v2 illegal tiling method, using StridedTile\n"); - - //DEBUG_PRINT("outer level %d\n", outer_level); - //DEBUG_PRINT("calling myloop->tile_cuda( %d, %d, %d, %d, %s, %s, method)\n", - // sstmt, level, tile_size, outer_level, index_name, control_name); - - // BUH level+1? - myloop->tile_cuda(sstmt, level, tile_size, outer_level, index_name, control_name, method); - Py_RETURN_NONE; -} - - -static PyObject * -chill_cur_indices(PyObject *self, PyObject *args) -{ - int stmt_num = -123; - if (!PyArg_ParseTuple(args, "i", &stmt_num)){ - fprintf(stderr, "chill_cur_indides, can't parse statement number passed from python\n"); - exit(-1); - } - //DEBUG_PRINT("cur_indices( %d )\n", stmt_num); - - char formatstring[1024]; - for (int i=0; i<1024; i++) formatstring[i] = '\0'; - - int num = myloop->idxNames[stmt_num].size(); - for(int i=0; iidxNames[%d] index %d = '%s'\n", - //stmt_num, i, myloop->idxNames[stmt_num][i].c_str()); - - // backwards, works because all entries are the same - //sprintf(formatstring, "i %s", formatstring); - strcat( formatstring, "s "); - // put this in a list or something to pass back to python - } - - int l = strlen(formatstring); - if (l > 0) formatstring[l-1] = '\0'; - - //DEBUG_PRINT("%d current indices, format string '%s'\n\n",num,formatstring); - //DEBUG_PRINT("%d current indices\n\n", num); - - //return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(),myloop->idxNames[stmt_num][1].c_str() ); - - // I don't know a clean way to do this. - if (num == 2) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), - myloop->idxNames[stmt_num][1].c_str()); - if (num == 3) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), - myloop->idxNames[stmt_num][1].c_str(), - myloop->idxNames[stmt_num][2].c_str()); - if (num == 4) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), - myloop->idxNames[stmt_num][1].c_str(), - myloop->idxNames[stmt_num][2].c_str(), - myloop->idxNames[stmt_num][3].c_str()); - if (num == 5) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), - myloop->idxNames[stmt_num][1].c_str(), - myloop->idxNames[stmt_num][2].c_str(), - myloop->idxNames[stmt_num][3].c_str(), - myloop->idxNames[stmt_num][4].c_str()); - if (num == 6) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), - myloop->idxNames[stmt_num][1].c_str(), - myloop->idxNames[stmt_num][2].c_str(), - myloop->idxNames[stmt_num][3].c_str(), - myloop->idxNames[stmt_num][4].c_str(), - myloop->idxNames[stmt_num][5].c_str()); - if (num == 7) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), - myloop->idxNames[stmt_num][1].c_str(), - myloop->idxNames[stmt_num][2].c_str(), - myloop->idxNames[stmt_num][3].c_str(), - myloop->idxNames[stmt_num][4].c_str(), - myloop->idxNames[stmt_num][5].c_str(), - myloop->idxNames[stmt_num][6].c_str()); - if (num == 8) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), - myloop->idxNames[stmt_num][1].c_str(), - myloop->idxNames[stmt_num][2].c_str(), - myloop->idxNames[stmt_num][3].c_str(), - myloop->idxNames[stmt_num][4].c_str(), - myloop->idxNames[stmt_num][5].c_str(), - myloop->idxNames[stmt_num][6].c_str(), - myloop->idxNames[stmt_num][7].c_str()); - if (num == 9) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), - myloop->idxNames[stmt_num][1].c_str(), - myloop->idxNames[stmt_num][2].c_str(), - myloop->idxNames[stmt_num][3].c_str(), - myloop->idxNames[stmt_num][4].c_str(), - myloop->idxNames[stmt_num][5].c_str(), - myloop->idxNames[stmt_num][6].c_str(), - myloop->idxNames[stmt_num][7].c_str(), - myloop->idxNames[stmt_num][8].c_str()); - if (num == 10) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), - myloop->idxNames[stmt_num][1].c_str(), - myloop->idxNames[stmt_num][2].c_str(), - myloop->idxNames[stmt_num][3].c_str(), - myloop->idxNames[stmt_num][4].c_str(), - myloop->idxNames[stmt_num][5].c_str(), - myloop->idxNames[stmt_num][6].c_str(), - myloop->idxNames[stmt_num][7].c_str(), - myloop->idxNames[stmt_num][8].c_str(), - myloop->idxNames[stmt_num][9].c_str()); - if (num == 11) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), - myloop->idxNames[stmt_num][1].c_str(), - myloop->idxNames[stmt_num][2].c_str(), - myloop->idxNames[stmt_num][3].c_str(), - myloop->idxNames[stmt_num][4].c_str(), - myloop->idxNames[stmt_num][5].c_str(), - myloop->idxNames[stmt_num][6].c_str(), - myloop->idxNames[stmt_num][7].c_str(), - myloop->idxNames[stmt_num][8].c_str(), - myloop->idxNames[stmt_num][9].c_str(), - myloop->idxNames[stmt_num][10].c_str()); - if (num == 12) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), - myloop->idxNames[stmt_num][1].c_str(), - myloop->idxNames[stmt_num][2].c_str(), - myloop->idxNames[stmt_num][3].c_str(), - myloop->idxNames[stmt_num][4].c_str(), - myloop->idxNames[stmt_num][5].c_str(), - myloop->idxNames[stmt_num][6].c_str(), - myloop->idxNames[stmt_num][7].c_str(), - myloop->idxNames[stmt_num][8].c_str(), - myloop->idxNames[stmt_num][9].c_str(), - myloop->idxNames[stmt_num][10].c_str(), - myloop->idxNames[stmt_num][11].c_str()); - if (num == 13) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), - myloop->idxNames[stmt_num][1].c_str(), - myloop->idxNames[stmt_num][2].c_str(), - myloop->idxNames[stmt_num][3].c_str(), - myloop->idxNames[stmt_num][4].c_str(), - myloop->idxNames[stmt_num][5].c_str(), - myloop->idxNames[stmt_num][6].c_str(), - myloop->idxNames[stmt_num][7].c_str(), - myloop->idxNames[stmt_num][8].c_str(), - myloop->idxNames[stmt_num][9].c_str(), - myloop->idxNames[stmt_num][10].c_str(), - myloop->idxNames[stmt_num][11].c_str(), - myloop->idxNames[stmt_num][12].c_str()); - if (num == 14) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), - myloop->idxNames[stmt_num][1].c_str(), - myloop->idxNames[stmt_num][2].c_str(), - myloop->idxNames[stmt_num][3].c_str(), - myloop->idxNames[stmt_num][4].c_str(), - myloop->idxNames[stmt_num][5].c_str(), - myloop->idxNames[stmt_num][6].c_str(), - myloop->idxNames[stmt_num][7].c_str(), - myloop->idxNames[stmt_num][8].c_str(), - myloop->idxNames[stmt_num][9].c_str(), - myloop->idxNames[stmt_num][10].c_str(), - myloop->idxNames[stmt_num][11].c_str(), - myloop->idxNames[stmt_num][12].c_str(), - myloop->idxNames[stmt_num][13].c_str()); - if (num == 15) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), - myloop->idxNames[stmt_num][1].c_str(), - myloop->idxNames[stmt_num][2].c_str(), - myloop->idxNames[stmt_num][3].c_str(), - myloop->idxNames[stmt_num][4].c_str(), - myloop->idxNames[stmt_num][5].c_str(), - myloop->idxNames[stmt_num][6].c_str(), - myloop->idxNames[stmt_num][7].c_str(), - myloop->idxNames[stmt_num][8].c_str(), - myloop->idxNames[stmt_num][9].c_str(), - myloop->idxNames[stmt_num][10].c_str(), - myloop->idxNames[stmt_num][11].c_str(), - myloop->idxNames[stmt_num][12].c_str(), - myloop->idxNames[stmt_num][13].c_str(), - myloop->idxNames[stmt_num][14].c_str()); - if (num == 16) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), - myloop->idxNames[stmt_num][1].c_str(), - myloop->idxNames[stmt_num][2].c_str(), - myloop->idxNames[stmt_num][3].c_str(), - myloop->idxNames[stmt_num][4].c_str(), - myloop->idxNames[stmt_num][5].c_str(), - myloop->idxNames[stmt_num][6].c_str(), - myloop->idxNames[stmt_num][7].c_str(), - myloop->idxNames[stmt_num][8].c_str(), - myloop->idxNames[stmt_num][9].c_str(), - myloop->idxNames[stmt_num][10].c_str(), - myloop->idxNames[stmt_num][11].c_str(), - myloop->idxNames[stmt_num][12].c_str(), - myloop->idxNames[stmt_num][13].c_str(), - myloop->idxNames[stmt_num][14].c_str(), - myloop->idxNames[stmt_num][15].c_str()); - if (num == 17) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), - myloop->idxNames[stmt_num][1].c_str(), - myloop->idxNames[stmt_num][2].c_str(), - myloop->idxNames[stmt_num][3].c_str(), - myloop->idxNames[stmt_num][4].c_str(), - myloop->idxNames[stmt_num][5].c_str(), - myloop->idxNames[stmt_num][6].c_str(), - myloop->idxNames[stmt_num][7].c_str(), - myloop->idxNames[stmt_num][8].c_str(), - myloop->idxNames[stmt_num][9].c_str(), - myloop->idxNames[stmt_num][10].c_str(), - myloop->idxNames[stmt_num][11].c_str(), - myloop->idxNames[stmt_num][12].c_str(), - myloop->idxNames[stmt_num][13].c_str(), - myloop->idxNames[stmt_num][14].c_str(), - myloop->idxNames[stmt_num][15].c_str(), - myloop->idxNames[stmt_num][16].c_str()); - if (num == 18) return Py_BuildValue(formatstring, myloop->idxNames[stmt_num][0].c_str(), - myloop->idxNames[stmt_num][1].c_str(), - myloop->idxNames[stmt_num][2].c_str(), - myloop->idxNames[stmt_num][3].c_str(), - myloop->idxNames[stmt_num][4].c_str(), - myloop->idxNames[stmt_num][5].c_str(), - myloop->idxNames[stmt_num][6].c_str(), - myloop->idxNames[stmt_num][7].c_str(), - myloop->idxNames[stmt_num][8].c_str(), - myloop->idxNames[stmt_num][9].c_str(), - myloop->idxNames[stmt_num][10].c_str(), - myloop->idxNames[stmt_num][11].c_str(), - myloop->idxNames[stmt_num][12].c_str(), - myloop->idxNames[stmt_num][13].c_str(), - myloop->idxNames[stmt_num][14].c_str(), - myloop->idxNames[stmt_num][15].c_str(), - myloop->idxNames[stmt_num][16].c_str(), - myloop->idxNames[stmt_num][17].c_str()); - - fprintf(stderr, "going to die horribly, num=%d\n", num); -} - - -static PyObject * -chill_block_indices(PyObject *self, PyObject *args) { - - // I'm unsure what the legal states are here - // is it always "bx", or ("bx" and "by") ? - int howmany = 0; - char *loopnames[2]; - if (myloop->cu_bx > 1) { - loopnames[howmany] = strdup("bx"); - howmany++; - } - if (myloop->cu_by > 1) { - loopnames[howmany] = strdup("by"); - howmany++; - } - - if (howmany == 0) return Py_BuildValue("()"); - if (howmany == 1) return Py_BuildValue("(s)", loopnames[0]); - if (howmany == 2) return Py_BuildValue("(ss)", loopnames[0], loopnames[1]); - fprintf(stderr, "chill_block_indices(), gonna die, howmany == %d", howmany); - exit(666); - - Py_RETURN_NONE; -} - -static PyObject * -chill_thread_indices(PyObject *self, PyObject *args) { - - // I'm unsure what the legal states are here - // is it always "tx", or ("tx" and "ty") or ("tx" and "ty" and "tz") ? - int howmany = 0; - char *loopnames[3]; - if (myloop->cu_tx > 1) { - loopnames[howmany++] = strdup("tx"); - } - if (myloop->cu_ty > 1) { - loopnames[howmany++] = strdup("ty"); - } - if (myloop->cu_tz > 1) { - loopnames[howmany++] = strdup("tz"); - } - - if (howmany == 0) return Py_BuildValue("()"); - if (howmany == 1) return Py_BuildValue("(s)", - loopnames[0]); - if (howmany == 2) return Py_BuildValue("(ss)", - loopnames[0], - loopnames[1]); - if (howmany == 3) return Py_BuildValue("(sss)", - loopnames[0], - loopnames[1], - loopnames[2]); - - fprintf(stderr, "chill_thread_indices(), gonna die, howmany == %d", howmany); - exit(999); -} - - - - - -static PyObject * -block_dims(PyObject *self, PyObject *args) -{ - //DEBUG_PRINT("block_dims() returning %d %d\n", myloop->cu_bx, myloop->cu_by); - Py_BuildValue( "i i", myloop->cu_bx, myloop->cu_by); -} - - -static PyObject * -thread_dims(PyObject *self, PyObject *args) -{ - //DEBUG_PRINT("thread_dims() returning %d %d %d\n", - //myloop->cu_tx, myloop->cu_ty, myloop->cu_tz); - - Py_BuildValue( "i i i", myloop->cu_tx, myloop->cu_ty, myloop->cu_tz); -} - - -static PyObject * -chill_hard_loop_bounds(PyObject *self, PyObject *args) -{ - //DEBUG_PRINT("hard_loop_bounds("); - int sstmt, level; // input parameters - int upper, lower; // output - - if (!PyArg_ParseTuple(args, "ii", &sstmt, &level)){ - fprintf(stderr, "hard_loop_bounds, "); - fprintf(stderr, "can't parse statement numbers passed from python\n"); - exit(-1); - } - //DEBUG_PRINT(" %d, %d )\n", sstmt, level); - - myloop->extractCudaUB(sstmt, level, upper, lower); - - //DEBUG_PRINT("lower %d upper %d\n", lower, upper); - - Py_BuildValue( "i i", lower, upper); -} - - -static PyObject * -chill_datacopy9(PyObject *self, PyObject *args) -{ - //DEBUG_PRINT("\n\n\n***** datacopy_v2() 9ARGS\n"); - - int sstmt; - int level; - std::string cppstr; - std::string array_name; - std::vector new_idxs; - bool allow_extra_read; - int fastest_changing_dimension; - int padding_stride; - int padding_alignment; - bool cuda_shared; - - PyObject *pyObj; - - if (!PyArg_ParseTuple( args, "O", &pyObj)) { // everything on a single tuple - - fprintf(stderr, "failed to parse tuple\n"); - exit(-1); - } - Py_XINCREF( pyObj ); - - //if (PyList_Check(pyObj)) fprintf(stderr, "it's a list\n"); - //if (PyTuple_Check(pyObj)) fprintf(stderr, "it's a tuple\n"); - - - - // the ONLY arg is a tuple. figure out how big it is - int tupleSize = PyTuple_Size(pyObj); - //DEBUG_PRINT("%d things in object tuple\n", tupleSize); - - // first has to be the statement number - PyObject *tupleItem1 = PyTuple_GetItem(pyObj, 0); - Py_INCREF(tupleItem1); - if (PyInt_Check( tupleItem1)) sstmt = PyInt_AsLong( tupleItem1 ); - else { - fprintf(stderr, "second tuple item in chill_datacopy9 is not an int?\n"); - exit(-1); - } - //DEBUG_PRINT("stmt %d\n", sstmt); - - PyObject *tupleItem2 = PyTuple_GetItem(pyObj, 1); // second item is level - Py_INCREF(tupleItem2); - if (PyInt_Check( tupleItem2 )) level = PyInt_AsLong( tupleItem2); - else { - fprintf(stderr, "second tuple item in chill_datacopy9 is not an int?\n"); - exit(-1); - } - //DEBUG_PRINT("level %d\n", level ); - - // third item is array name - PyObject *tupleItem3 = PyTuple_GetItem(pyObj, 2); - Py_INCREF(tupleItem3); - array_name = strdup(PyString_AsString(tupleItem3)); - //DEBUG_PRINT("array name '%s'\n", array_name.c_str()); - - - // integer number of indices - PyObject *tupleItem4 = PyTuple_GetItem(pyObj, 3); - Py_INCREF(tupleItem4); - int numindex= PyInt_AsLong( tupleItem4 ); - //DEBUG_PRINT("%d indices\n", numindex); - - - PyObject *tupleItemTEMP; - for (int i=0; idatacopy_cuda()\n"); - - // corruption happenes in here??? - myloop->datacopy_cuda(sstmt, level, array_name, new_idxs, - allow_extra_read, fastest_changing_dimension, - padding_stride, padding_alignment, cuda_shared); - - DEBUG_PRINT("before attempt (after actual datacopy)\n"); - //myloop->printCode(); // attempt to debug - DEBUG_PRINT("back from attempt\n"); - - //DEBUG_PRINT("datacopy_9args returning\n"); - - Py_RETURN_NONE; -} - - - - - -static PyObject * -chill_datacopy_privatized(PyObject *self, PyObject *args) -{ - //DEBUG_PRINT("C datacopy_privatized\n"); - PyObject *pyObj; - if (!PyArg_ParseTuple( args, "O", &pyObj)) { // everything on a single tuple - fprintf(stderr, "failed to parse tuple\n"); - exit(-1); - } - - PyObject *tupleItem = PyTuple_GetItem(pyObj, 0); // statement number - Py_XINCREF(tupleItem); - int sstmt = PyInt_AsLong( tupleItem ); - - tupleItem = PyTuple_GetItem(pyObj, 1); // start_loop - Py_XINCREF(tupleItem); - std::string start_loop = strdup(PyString_AsString(tupleItem)); - int level = myloop->findCurLevel(sstmt, start_loop); - - - tupleItem = PyTuple_GetItem(pyObj, 2); // array_name - Py_XINCREF(tupleItem); - std::string array_name = strdup(PyString_AsString(tupleItem)); - - // things to hold constant - first a count, then the things - tupleItem = PyTuple_GetItem(pyObj, 3); // how many things in the array - Py_XINCREF(tupleItem); - int howmany = PyInt_AsLong( tupleItem ); - - //DEBUG_PRINT("%d things to hold constant: ", howmany); - std::vector holdconstant; - std::string cppstr; - - for (int i=0; i privatized_levels(howmany); - for(int i=0; ifindCurLevel(sstmt, holdconstant[i]); - //DEBUG_PRINT("privatized_levels[ %d ] = %d\n", i, privatized_levels[i] ); - } - - bool allow_extra_read = false; - int fastest_changing_dimension = -1; - int padding_stride = 1; - int padding_alignment = 1; - bool cuda_shared = false; - - - myloop->datacopy_privatized_cuda(sstmt, level, array_name, privatized_levels, - allow_extra_read, fastest_changing_dimension, - padding_stride, padding_alignment, - cuda_shared); - - - Py_RETURN_NONE; -} - - - - - - -static PyObject * -chill_unroll(PyObject *self, PyObject *args) -{ - int sstmt, level, unroll_amount; - - if (!PyArg_ParseTuple(args, "iii", &sstmt, &level, &unroll_amount)) { - fprintf(stderr, "chill_unroll, can't parse parameters passed from python\n"); - exit(-1); - } - - //DEBUG_PRINT("chill_unroll( %d, %d, %d)\n", sstmt, level, unroll_amount ); - bool does_expand = myloop->unroll_cuda(sstmt,level,unroll_amount); - - // TODO return the boolean? - Py_RETURN_NONE; -} - - - - -static PyObject * -chill_cudaize_v2(PyObject *self, PyObject *args) -{ - //DEBUG_PRINT("cudaize_v2\n"); - PyObject *pyObj; - if (!PyArg_ParseTuple( args, "O", &pyObj)) { // everything on a single tuple - fprintf(stderr, "failed to parse tuple\n"); - exit(-1); - } - - // the ONLY arg is a tuple. figure out how big it is - int tupleSize = PyTuple_Size(pyObj); - //DEBUG_PRINT("%d things in tuple\n", tupleSize); - - PyObject *tupleItem = PyTuple_GetItem(pyObj, 0); //the kernel name - Py_XINCREF(tupleItem); - std::string kernel_name = strdup(PyString_AsString(tupleItem)); - - std::map array_sizes; - tupleItem = PyTuple_GetItem(pyObj, 1); // number of array sizes - Py_XINCREF(tupleItem); - int numarraysizes = PyInt_AsLong( tupleItem ); - - std::string cppstr; - int offset = 2; - for (int i=0; i blockIdxs; - tupleItem = PyTuple_GetItem(pyObj, offset++); // integer number of blocks - Py_XINCREF(tupleItem); - int numblocks = PyInt_AsLong( tupleItem ); - //DEBUG_PRINT("%d blocks\n", numblocks); - for (int i=0; i threadIdxs; - tupleItem = PyTuple_GetItem(pyObj, offset++); // integer number of threads - Py_XINCREF(tupleItem); - int numthreads= PyInt_AsLong( tupleItem ); - //DEBUG_PRINT("%d threads\n", numthreads); - for (int i=0; icudaize_v2(kernel_name, array_sizes, blockIdxs, threadIdxs); - - Py_RETURN_NONE; // return Py_BuildValue( "" ); -} - - - -static PyObject *get_loop_num() { - // TODO get_loop_num() it's a global value? - fprintf(stderr, "get_loop_num() UNIMPLEMENTED\n"); - exit(-1); -} - - - - -static PyObject * -chill_copy_to_texture(PyObject *self, PyObject *args) -{ - //DEBUG_PRINT("C copy_to_texture() called from python \n"); - const char *array_name; - if (!PyArg_ParseTuple(args, "s", &array_name)){ - fprintf(stderr, "chill_copy_to_texture can't parse array name\n"); - exit(-1); - } - //DEBUG_PRINT("array name = %s\n", array_name); - myloop->copy_to_texture(array_name); - - Py_RETURN_NONE; -} - - - - - - - -static PyObject * -chill_init(PyObject *self, PyObject *args) -{ - DEBUG_PRINT("C chill_init() called from python as read_IR()\n"); - DEBUG_PRINT("C init( "); - const char *filename; - const char *procname; - if (!PyArg_ParseTuple(args, "ss", &filename, &procname)){ - fprintf(stderr, "umwut? can't parse file name and procedure name?\n"); - exit(-1); - } - - int loop_num = 0; - - DEBUG_PRINT("%s, 0, 0 )\n", filename); - - DEBUG_PRINT("GETTING IR CODE in chill_init() in chillmodule.cc\n"); - DEBUG_PRINT("ir_code = new IR_cudaroseCode(%s, %s);\n",filename, procname); - ir_code = new IR_cudaroseCode(filename, procname); //this produces 15000 lines of output - fflush(stdout); - - - - - //protonu--here goes my initializations - //A lot of this code was lifted from Chun's parser.yy - //the plan is now to create the LoopCuda object directly - IR_Block *block = ir_code->GetCode(); - DEBUG_PRINT("ir_code->FindOneLevelControlStructure(block); chillmodule.cc\n"); - ir_controls = ir_code->FindOneLevelControlStructure(block); - - int loop_count = 0; - for (int i = 0; i < ir_controls.size(); i++) { - if (ir_controls[i]->type() == IR_CONTROL_LOOP) { - loops.push_back(i); - loop_count++; - } - } - delete block; - - - std::vector parm; - for(int j = 0; j < loop_count; j++) - parm.push_back(ir_controls[loops[j]]); - - - DEBUG_PRINT("block = ir_code->MergeNeighboringControlStructures(parm);\n"); - block = ir_code->MergeNeighboringControlStructures(parm); - - //DEBUG_PRINT("myloop = new LoopCuda(block, loop_num); in chillmodule.cc\n"); - myloop = new LoopCuda(block, loop_num); - fflush(stdout); DEBUG_PRINT("back\n"); - delete block; - - //end-protonu - - fflush(stdout); - DEBUG_PRINT("myloop->original();\n"); - myloop->original(); - fflush(stdout); - DEBUG_PRINT("myloop->useIdxNames=true;\n"); - myloop->useIdxNames=true;//Use idxName in code_gen - //register_v2(L); - - fflush(stdout); - DEBUG_PRINT("chill_init DONE\n"); - Py_RETURN_NONE; // return Py_BuildValue( "" ); - -} - -#else -// ------------------------- // -// CHiLL interface functions // -// ------------------------- // - -static PyObject* chill_source(PyObject* self, PyObject* args) { - strict_arg_num(args, 1, "source"); - source_filename = strArg(args, 0); - Py_RETURN_NONE; -} - -static PyObject* chill_procedure(PyObject* self, PyObject* args) { - if(!procedure_name.empty()) { - fprintf(stderr, "only one procedure can be handled in a script"); - if(!is_interactive) - exit(2); - } - procedure_name = strArg(args, 0); - Py_RETURN_NONE; -} - -static PyObject* chill_loop(PyObject* self, PyObject* args) { - // loop (n) - // loop (n:m) - - int nargs = PyTuple_Size(args); - int start_num; - int end_num; - if(nargs == 1) { - start_num = intArg(args, 0); - end_num = start_num; - } - else if(nargs == 2) { - start_num = intArg(args, 0); - end_num = intArg(args, 1); - } - else { - fprintf(stderr, "loop takes one or two arguments"); - if(!is_interactive) - exit(2); - } - set_loop_num_start(start_num); - set_loop_num_end(end_num); - init_loop(start_num, end_num); - Py_RETURN_NONE; -} - -static PyObject* chill_print_code(PyObject* self, PyObject* args) { - strict_arg_num(args, 0, "print_code"); - myloop->printCode(); - printf("\n"); - Py_RETURN_NONE; -} - -static PyObject* chill_print_dep(PyObject* self, PyObject* args) { - strict_arg_num(args, 0, "print_dep"); - myloop->printDependenceGraph(); - Py_RETURN_NONE; -} - -static PyObject* chill_print_space(PyObject* self, PyObject* args) { - strict_arg_num(args, 0, "print_space"); - myloop->printIterationSpace(); - Py_RETURN_NONE; -} - -static PyObject* chill_exit(PyObject* self, PyObject* args) { - strict_arg_num(args, 0, "exit"); - repl_stop = true; - Py_RETURN_NONE; -} - -static void add_known(std::string cond_expr) { - int num_dim = myloop->known.n_set(); - std::vector >* cond; - cond = parse_relation_vector(cond_expr.c_str()); - - Relation rel(num_dim); - F_And *f_root = rel.add_and(); - for (int j = 0; j < cond->size(); j++) { - GEQ_Handle h = f_root->add_GEQ(); - for (std::map::iterator it = (*cond)[j].begin(); it != (*cond)[j].end(); it++) { - try { - int dim = from_string(it->first); - if (dim == 0) - h.update_const(it->second); - else - throw std::invalid_argument("only symbolic variables are allowed in known condition"); - } - catch (std::ios::failure e) { - Free_Var_Decl *g = NULL; - for (unsigned i = 0; i < myloop->freevar.size(); i++) { - std::string name = myloop->freevar[i]->base_name(); - if (name == it->first) { - g = myloop->freevar[i]; - break; - } - } - if (g == NULL) - throw std::invalid_argument("symbolic variable " + it->first + " not found"); - else - h.update_coef(rel.get_local(g), it->second); - } - } - } - myloop->addKnown(rel); -} - -static PyObject* chill_known(PyObject* self, PyObject* args) { - strict_arg_num(args, 1, "known"); - if (PyList_Check(PyTuple_GetItem(args, 0))) { - PyObject* list = PyTuple_GetItem(args, 0); - for (int i = 0; i < PyList_Size(list); i++) { - add_known(std::string(PyString_AsString(PyList_GetItem(list, i)))); - } - } - else { - add_known(strArg(args, 0)); - } - Py_RETURN_NONE; -} - -static PyObject* chill_remove_dep(PyObject* self, PyObject* args) { - strict_arg_num(args, 0, "remove_dep"); - int from = intArg(args, 0); - int to = intArg(args, 1); - myloop->removeDependence(from, to); - Py_RETURN_NONE; -} - -static PyObject* chill_original(PyObject* self, PyObject* args) { - strict_arg_num(args, 0, "original"); - myloop->original(); - Py_RETURN_NONE; -} - -static PyObject* chill_permute(PyObject* self, PyObject* args) { - int nargs = strict_arg_range(args, 1, 3, "permute"); - if((nargs < 1) || (nargs > 3)) - throw std::runtime_error("incorrect number of arguments in permute"); - if(nargs == 1) { - // premute ( vector ) - std::vector pi; - if(!tointvector(args, 0, pi)) - throw std::runtime_error("first arg in permute(pi) must be an int vector"); - myloop->permute(pi); - } - else if (nargs == 2) { - // permute ( set, vector ) - std::set active; - std::vector pi; - if(!tointset(args, 0, active)) - throw std::runtime_error("the first argument in permute(active, pi) must be an int set"); - if(!tointvector(args, 1, pi)) - throw std::runtime_error("the second argument in permute(active, pi) must be an int vector"); - myloop->permute(active, pi); - } - else if (nargs == 3) { - int stmt_num = intArg(args, 1); - int level = intArg(args, 2); - std::vector pi; - if(!tointvector(args, 3, pi)) - throw std::runtime_error("the third argument in permute(stmt_num, level, pi) must be an int vector"); - myloop->permute(stmt_num, level, pi); - } - Py_RETURN_NONE; -} - -static PyObject* chill_pragma(PyObject* self, PyObject* args) { - strict_arg_num(args, 3, "pragma"); - int stmt_num = intArg(args, 1); - int level = intArg(args, 1); - std::string pragmaText = strArg(args, 2); - myloop->pragma(stmt_num, level, pragmaText); - Py_RETURN_NONE; -} - -static PyObject* chill_prefetch(PyObject* self, PyObject* args) { - strict_arg_num(args, 3, "prefetch"); - int stmt_num = intArg(args, 0); - int level = intArg(args, 1); - std::string prefetchText = strArg(args, 2); - int hint = intArg(args, 3); - myloop->prefetch(stmt_num, level, prefetchText, hint); - Py_RETURN_NONE; -} - -static PyObject* chill_tile(PyObject* self, PyObject* args) { - int nargs = strict_arg_range(args, 3, 7, "tile"); - int stmt_num = intArg(args, 0); - int level = intArg(args, 1); - int tile_size = intArg(args, 2); - if(nargs == 3) { - myloop->tile(stmt_num, level, tile_size); - } - else if(nargs >= 4) { - int outer_level = intArg(args, 3); - if(nargs >= 5) { - TilingMethodType method = StridedTile; - int imethod = intArg(args, 4, 2); //< don't know if a default value is needed - // check method input against expected values - if (imethod == 0) - method = StridedTile; - else if (imethod == 1) - method = CountedTile; - else - throw std::runtime_error("5th argument must be either strided or counted"); - if(nargs >= 6) { - int alignment_offset = intArg(args, 5); - if(nargs == 7) { - int alignment_multiple = intArg(args, 6, 1); - myloop->tile(stmt_num, level, tile_size, outer_level, method, alignment_offset, alignment_multiple); - } - if(nargs == 6) - myloop->tile(stmt_num, level, tile_size, outer_level, method, alignment_offset); - } - if(nargs == 5) - myloop->tile(stmt_num, level, tile_size, outer_level, method); - } - if(nargs == 4) - myloop->tile(stmt_num, level, tile_size, outer_level); - } - Py_RETURN_NONE; -} - -static void chill_datacopy_vec(PyObject* args) { - // Overload 1: bool datacopy( - // const std::vector > > &array_ref_nums, - // int level, - // bool allow_extra_read = false, - // int fastest_changing_dimension = -1, - // int padding_stride = 1, - // int padding_alignment = 4, - // int memory_type = 0); - std::vector > > array_ref_nums; - // expect list(tuple(int,list(int))) - // or dict(int,list(int)) - if(PyList_CheckExact(PyTuple_GetItem(args, 0))) { - PyObject* list = PyTuple_GetItem(args, 0); - for(int i = 0; i < PyList_Size(list); i ++) { - PyObject* tup = PyList_GetItem(list, i); - int index = PyLong_AsLong(PyTuple_GetItem(tup, 0)); - std::vector vec; - tointvector(PyTuple_GetItem(tup, 1), vec); - array_ref_nums.push_back(std::pair >(index, vec)); - } - } - else if(PyList_CheckExact(PyTuple_GetItem(args, 0))) { - PyObject* dict = PyTuple_GetItem(args, 0); - PyObject* klist = PyDict_Keys(dict); - for(int ki = 0; ki < PyList_Size(klist); ki++) { - PyObject* index = PyList_GetItem(klist, ki); - std::vector vec; - tointvector(PyDict_GetItem(dict,index), vec); - array_ref_nums.push_back(std::pair >(PyLong_AsLong(index), vec)); - } - Py_DECREF(klist); - } - else { - //TODO: this should never happen - } - int level = intArg(args, 1); - bool allow_extra_read = boolArg(args, 2, false); - int fastest_changing_dimension = intArg(args, 3, -1); - int padding_stride = intArg(args, 4, 1); - int padding_alignment = intArg(args, 5, 4); - int memory_type = intArg(args, 6, 0); - myloop->datacopy(array_ref_nums, level, allow_extra_read, fastest_changing_dimension, padding_stride, padding_alignment, memory_type); -} - -static void chill_datacopy_int(PyObject* args) { - int stmt_num = intArg(args, 0); - int level = intArg(args, 1); - std::string array_name = strArg(args,2,0); - bool allow_extra_read = boolArg(args,3,false); - int fastest_changing_dimension = intArg(args, 4, -1); - int padding_stride = intArg(args, 5, 1); - int padding_alignment = intArg(args, 6, 4); - int memory_type = intArg(args, 7, 0); - myloop->datacopy(stmt_num, level, array_name, allow_extra_read, fastest_changing_dimension, padding_stride, padding_alignment, memory_type); -} - -static PyObject* chill_datacopy(PyObject* self, PyObject* args) { - // Overload 2: bool datacopy(int stmt_num, int level, const std::string &array_name, bool allow_extra_read = false, int fastest_changing_dimension = -1, int padding_stride = 1, int padding_alignment = 4, int memory_type = 0); - int nargs = strict_arg_range(args, 3, 7, "datacopy"); - if(PyList_CheckExact(PyTuple_GetItem(args,0)) || PyDict_CheckExact(PyTuple_GetItem(args, 0))) { - chill_datacopy_vec(args); - } - else { - chill_datacopy_int(args); - } - Py_RETURN_NONE; -} - -static PyObject* chill_datacopy_privatized(PyObject* self, PyObject* args) { - // bool datacopy_privatized(int stmt_num, int level, const std::string &array_name, const std::vector &privatized_levels, bool allow_extra_read = false, int fastest_changing_dimension = -1, int padding_stride = 1, int padding_alignment = 1, int memory_type = 0); - int nargs = strict_arg_range(args, 4, 9, "datacopy_privatized"); - int stmt_num = intArg(args, 0); - int level = intArg(args, 1); - std::string array_name = strArg(args, 2); - std::vector privatized_levels; - tointvector(args, 3, privatized_levels); - bool allow_extra_read = boolArg(args, 4, false); - int fastest_changing_dimension = intArg(args, 5, -1); - int padding_stride = intArg(args, 6, 1); - int padding_alignment = intArg(args, 7, 1); - int memory_type = intArg(args, 8); - myloop->datacopy_privatized(stmt_num, level, array_name, privatized_levels, allow_extra_read, fastest_changing_dimension, padding_stride, padding_alignment, memory_type); - Py_RETURN_NONE; -} - -static PyObject* chill_unroll(PyObject* self, PyObject* args) { - int nargs = strict_arg_range(args, 3, 4, "unroll"); - //std::set unroll(int stmt_num, int level, int unroll_amount, std::vector< std::vector >idxNames= std::vector< std::vector >(), int cleanup_split_level = 0); - int stmt_num = intArg(args, 0); - int level = intArg(args, 1); - int unroll_amount = intArg(args, 2); - std::vector< std::vector > idxNames = std::vector< std::vector >(); - int cleanup_split_level = intArg(args, 3); - myloop->unroll(stmt_num, level, unroll_amount, idxNames, cleanup_split_level); - Py_RETURN_NONE; -} - -static PyObject* chill_unroll_extra(PyObject* self, PyObject* args) { - int nargs = strict_arg_range(args, 3, 4, "unroll_extra"); - int stmt_num = intArg(args, 0); - int level = intArg(args, 1); - int unroll_amount = intArg(args, 2); - int cleanup_split_level = intArg(args, 3, 0); - myloop->unroll_extra(stmt_num, level, unroll_amount, cleanup_split_level); - Py_RETURN_NONE; -} - -static PyObject* chill_split(PyObject* self, PyObject* args) { - strict_arg_num(args, 3, "split"); - int stmt_num = intArg(args, 0); - int level = intArg(args, 1); - int num_dim = myloop->stmt[stmt_num].xform.n_out(); - - std::vector >* cond; - std::string cond_expr = strArg(args, 2); - cond = parse_relation_vector(cond_expr.c_str()); - - Relation rel((num_dim-1)/2); - F_And *f_root = rel.add_and(); - for (int j = 0; j < cond->size(); j++) { - GEQ_Handle h = f_root->add_GEQ(); - for (std::map::iterator it = (*cond)[j].begin(); it != (*cond)[j].end(); it++) { - try { - int dim = from_string(it->first); - if (dim == 0) - h.update_const(it->second); - else { - if (dim > (num_dim-1)/2) - throw std::invalid_argument("invalid loop level " + to_string(dim) + " in split condition"); - h.update_coef(rel.set_var(dim), it->second); - } - } - catch (std::ios::failure e) { - Free_Var_Decl *g = NULL; - for (unsigned i = 0; i < myloop->freevar.size(); i++) { - std::string name = myloop->freevar[i]->base_name(); - if (name == it->first) { - g = myloop->freevar[i]; - break; - } - } - if (g == NULL) - throw std::invalid_argument("unrecognized variable " + to_string(it->first.c_str())); - h.update_coef(rel.get_local(g), it->second); - } - } - } - myloop->split(stmt_num,level,rel); - Py_RETURN_NONE; -} - -static PyObject* chill_nonsingular(PyObject* self, PyObject* args) { - std::vector< std::vector > mat; - tointmatrix(args, 0, mat); - myloop->nonsingular(mat); - Py_RETURN_NONE; -} - -static PyObject* chill_skew(PyObject* self, PyObject* args) { - std::set stmt_nums; - std::vector skew_amounts; - int level = intArg(args, 1); - tointset(args, 0, stmt_nums); - tointvector(args, 2, skew_amounts); - myloop->skew(stmt_nums, level, skew_amounts); - Py_RETURN_NONE; -} - -static PyObject* chill_scale(PyObject* self, PyObject* args) { - strict_arg_num(args, 3); - std::set stmt_nums; - int level = intArg(args, 1); - int scale_amount = intArg(args, 2); - tointset(args, 0, stmt_nums); - myloop->scale(stmt_nums, level, scale_amount); - Py_RETURN_NONE; -} - -static PyObject* chill_reverse(PyObject* self, PyObject* args) { - strict_arg_num(args, 2); - std::set stmt_nums; - int level = intArg(args, 1); - tointset(args, 0, stmt_nums); - myloop->reverse(stmt_nums, level); - Py_RETURN_NONE; -} - -static PyObject* chill_shift(PyObject* self, PyObject* args) { - strict_arg_num(args, 3); - std::set stmt_nums; - int level = intArg(args, 1); - int shift_amount = intArg(args, 2); - tointset(args, 0, stmt_nums); - myloop->shift(stmt_nums, level, shift_amount); - Py_RETURN_NONE; -} - -static PyObject* chill_shift_to(PyObject* self, PyObject* args) { - strict_arg_num(args, 3); - int stmt_num = intArg(args, 0); - int level = intArg(args, 1); - int absolute_pos = intArg(args, 2); - myloop->shift_to(stmt_num, level, absolute_pos); - Py_RETURN_NONE; -} - -static PyObject* chill_peel(PyObject* self, PyObject* args) { - strict_arg_range(args, 2, 3); - int stmt_num = intArg(args, 0); - int level = intArg(args, 1); - int amount = intArg(args, 2); - myloop->peel(stmt_num, level, amount); - Py_RETURN_NONE; -} - -static PyObject* chill_fuse(PyObject* self, PyObject* args) { - strict_arg_num(args, 2); - std::set stmt_nums; - int level = intArg(args, 1); - tointset(args, 0, stmt_nums); - myloop->fuse(stmt_nums, level); - Py_RETURN_NONE; -} - -static PyObject* chill_distribute(PyObject* self, PyObject* args) { - strict_arg_num(args, 2); - std::set stmts; - int level = intArg(args, 1); - tointset(args, 0, stmts); - myloop->distribute(stmts, level); - Py_RETURN_NONE; -} - -static PyObject * -chill_num_statements(PyObject *self, PyObject *args) -{ - //DEBUG_PRINT("\nC chill_num_statements() called from python\n"); - int num = myloop->stmt.size(); - //DEBUG_PRINT("C num_statement() = %d\n", num); - return Py_BuildValue( "i", num ); // BEWARE "d" is DOUBLE, not int -} -#endif - -#ifdef CUDACHILL -static PyMethodDef ChillMethods[] = { - - // python name C routine parameter passing comment - {"print_code", chill_print_code, METH_VARARGS, "print the code at this point"}, - {"print_ri", chill_print_ri , METH_VARARGS, "print Runtime Info "}, - {"print_idx", chill_print_idx , METH_VARARGS, "print indices "}, - {"print_dep", chill_print_dep , METH_VARARGS, "print dep, dependecies?"}, - {"print_space", chill_print_space, METH_VARARGS, "print something or other "}, - {"add_sync", chill_add_sync, METH_VARARGS, "add sync, whatever that is"}, - {"rename_index", chill_rename_index, METH_VARARGS, "rename a loop index"}, - {"permute", chill_permute, METH_VARARGS, "change the order of loops?"}, - {"tile3", chill_tile_v2_3arg, METH_VARARGS, "something to do with tile"}, - {"tile7", chill_tile_v2_7arg, METH_VARARGS, "something to do with tile"}, - {"thread_dims", thread_dims, METH_VARARGS, "tx, ty, tz "}, - {"block_dims", block_dims, METH_VARARGS, "bx, by"}, - {"thread_indices", chill_thread_indices, METH_VARARGS, "bx, by"}, - {"block_indices", chill_block_indices, METH_VARARGS, "bx, by"}, - {"hard_loop_bounds", chill_hard_loop_bounds, METH_VARARGS, "lower, upper"}, - {"unroll", chill_unroll, METH_VARARGS, "unroll a loop"}, - {"cudaize", chill_cudaize_v2, METH_VARARGS, "dunno"}, - {"datacopy_privatized", chill_datacopy_privatized, METH_VARARGS, "dunno"}, - - {"datacopy_9arg", chill_datacopy9, METH_VARARGS, "datacopy with 9 arguments"}, - {"copy_to_texture", chill_copy_to_texture, METH_VARARGS, "copy to texture mem"}, - {"read_IR", chill_init, METH_VARARGS, "read an Intermediate Representation file"}, - {"cur_indices", chill_cur_indices, METH_VARARGS, "currently active indices"}, - {"num_statements", chill_num_statements, METH_VARARGS, "number of statements in ... something"}, - {NULL, NULL, 0, NULL} /* Sentinel */ - - //{"copy_to_constant", chill_copy_to_constant, METH_VARARGS, "copy to constant mem"}, - -}; -#else -static PyMethodDef ChillMethods[] = { - - //python name C routine parameter passing comment - {"source", chill_source, METH_VARARGS, "set source file for chill script"}, - {"procedure", chill_procedure, METH_VARARGS, "set the name of the procedure"}, - {"loop", chill_loop, METH_VARARGS, "indicate which loop to optimize"}, - {"print_code", chill_print_code, METH_VARARGS, "print generated code"}, - {"print_dep", chill_print_dep, METH_VARARGS, "print the dependencies graph"}, - {"print_space", chill_print_space, METH_VARARGS, "print space"}, - {"exit", chill_exit, METH_VARARGS, "exit the interactive consule"}, - {"known", chill_known, METH_VARARGS, "knwon"}, - {"remove_dep", chill_remove_dep, METH_VARARGS, "remove dependency i suppose"}, - {"original", chill_original, METH_VARARGS, "original"}, - {"permute", chill_permute, METH_VARARGS, "permute"}, - {"pragma", chill_pragma, METH_VARARGS, "pragma"}, - {"prefetch", chill_prefetch, METH_VARARGS, "prefetch"}, - {"tile", chill_tile, METH_VARARGS, "tile"}, - {"datacopy", chill_datacopy, METH_VARARGS, "datacopy"}, - {"datacopy_privitized", chill_datacopy_privatized, METH_VARARGS, "datacopy_privatized"}, - {"unroll", chill_unroll, METH_VARARGS, "unroll"}, - {"unroll_extra", chill_unroll_extra, METH_VARARGS, "unroll_extra"}, - {"split", chill_split, METH_VARARGS, "split"}, - {"nonsingular", chill_nonsingular, METH_VARARGS, "nonsingular"}, - {"skew", chill_skew, METH_VARARGS, "skew"}, - {"scale", chill_scale, METH_VARARGS, "scale"}, - {"reverse", chill_reverse, METH_VARARGS, "reverse"}, - {"shift", chill_shift, METH_VARARGS, "shift"}, - {"shift_to", chill_shift_to, METH_VARARGS, "shift_to"}, - {"peel", chill_peel, METH_VARARGS, "peel"}, - {"fuse", chill_fuse, METH_VARARGS, "fuse"}, - {"distribute", chill_distribute, METH_VARARGS, "distribute"}, - {"num_statements", chill_num_statements, METH_VARARGS, "number of statements in the current loop"}, - {NULL, NULL, 0, NULL} -}; -#endif - -static void register_globals(PyObject* m) { - // Preset globals - PyModule_AddStringConstant(m, "VERSION", CHILL_BUILD_VERSION); - PyModule_AddStringConstant(m, "dest", "C"); - PyModule_AddStringConstant(m, "C", "C"); - // Tile method - PyModule_AddIntConstant(m, "strided", 0); - PyModule_AddIntConstant(m, "counted", 1); - // Memory mode - PyModule_AddIntConstant(m, "global", 0); - PyModule_AddIntConstant(m, "shared", 1); - PyModule_AddIntConstant(m, "textured", 2); - // Bool flags - PyModule_AddIntConstant(m, "sync", 1); -} - -PyMODINIT_FUNC -initchill(void) // pass C methods to python -{ - DEBUG_PRINT("in C, initchill() to set up C methods to be called from python\n"); - PyObject* m = Py_InitModule("chill", ChillMethods); - register_globals(m); -} diff --git a/chillmodule.hh b/chillmodule.hh deleted file mode 100644 index a64ad1b..0000000 --- a/chillmodule.hh +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef BASIC_CHILLMODULE_HH -#define BASIC_CHILLMODULE_HH -// TODO Python.h defines these and something else does too -#undef _POSIX_C_SOURCE -#undef _XOPEN_SOURCE - -#include - -// a C routine that will be called from python -//static PyObject * chill_print_code(PyObject *self, PyObject *args); - -//static PyMethodDef ChillMethods[] ; - -#ifndef CUDACHILL -void finalize_loop(int loop_num_start, int loop_num_end); -int get_loop_num_start(); -int get_loop_num_end(); -#endif - -PyMODINIT_FUNC initchill() ; // pass C methods to python -#endif diff --git a/compile b/compile deleted file mode 100755 index 531136b..0000000 --- a/compile +++ /dev/null @@ -1,347 +0,0 @@ -#! /bin/sh -# Wrapper for compilers which do not understand '-c -o'. - -scriptversion=2012-10-14.11; # UTC - -# Copyright (C) 1999-2013 Free Software Foundation, Inc. -# Written by Tom Tromey . -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -nl=' -' - -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent tools from complaining about whitespace usage. -IFS=" "" $nl" - -file_conv= - -# func_file_conv build_file lazy -# Convert a $build file to $host form and store it in $file -# Currently only supports Windows hosts. If the determined conversion -# type is listed in (the comma separated) LAZY, no conversion will -# take place. -func_file_conv () -{ - file=$1 - case $file in - / | /[!/]*) # absolute file, and not a UNC file - if test -z "$file_conv"; then - # lazily determine how to convert abs files - case `uname -s` in - MINGW*) - file_conv=mingw - ;; - CYGWIN*) - file_conv=cygwin - ;; - *) - file_conv=wine - ;; - esac - fi - case $file_conv/,$2, in - *,$file_conv,*) - ;; - mingw/*) - file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` - ;; - cygwin/*) - file=`cygpath -m "$file" || echo "$file"` - ;; - wine/*) - file=`winepath -w "$file" || echo "$file"` - ;; - esac - ;; - esac -} - -# func_cl_dashL linkdir -# Make cl look for libraries in LINKDIR -func_cl_dashL () -{ - func_file_conv "$1" - if test -z "$lib_path"; then - lib_path=$file - else - lib_path="$lib_path;$file" - fi - linker_opts="$linker_opts -LIBPATH:$file" -} - -# func_cl_dashl library -# Do a library search-path lookup for cl -func_cl_dashl () -{ - lib=$1 - found=no - save_IFS=$IFS - IFS=';' - for dir in $lib_path $LIB - do - IFS=$save_IFS - if $shared && test -f "$dir/$lib.dll.lib"; then - found=yes - lib=$dir/$lib.dll.lib - break - fi - if test -f "$dir/$lib.lib"; then - found=yes - lib=$dir/$lib.lib - break - fi - if test -f "$dir/lib$lib.a"; then - found=yes - lib=$dir/lib$lib.a - break - fi - done - IFS=$save_IFS - - if test "$found" != yes; then - lib=$lib.lib - fi -} - -# func_cl_wrapper cl arg... -# Adjust compile command to suit cl -func_cl_wrapper () -{ - # Assume a capable shell - lib_path= - shared=: - linker_opts= - for arg - do - if test -n "$eat"; then - eat= - else - case $1 in - -o) - # configure might choose to run compile as 'compile cc -o foo foo.c'. - eat=1 - case $2 in - *.o | *.[oO][bB][jJ]) - func_file_conv "$2" - set x "$@" -Fo"$file" - shift - ;; - *) - func_file_conv "$2" - set x "$@" -Fe"$file" - shift - ;; - esac - ;; - -I) - eat=1 - func_file_conv "$2" mingw - set x "$@" -I"$file" - shift - ;; - -I*) - func_file_conv "${1#-I}" mingw - set x "$@" -I"$file" - shift - ;; - -l) - eat=1 - func_cl_dashl "$2" - set x "$@" "$lib" - shift - ;; - -l*) - func_cl_dashl "${1#-l}" - set x "$@" "$lib" - shift - ;; - -L) - eat=1 - func_cl_dashL "$2" - ;; - -L*) - func_cl_dashL "${1#-L}" - ;; - -static) - shared=false - ;; - -Wl,*) - arg=${1#-Wl,} - save_ifs="$IFS"; IFS=',' - for flag in $arg; do - IFS="$save_ifs" - linker_opts="$linker_opts $flag" - done - IFS="$save_ifs" - ;; - -Xlinker) - eat=1 - linker_opts="$linker_opts $2" - ;; - -*) - set x "$@" "$1" - shift - ;; - *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) - func_file_conv "$1" - set x "$@" -Tp"$file" - shift - ;; - *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) - func_file_conv "$1" mingw - set x "$@" "$file" - shift - ;; - *) - set x "$@" "$1" - shift - ;; - esac - fi - shift - done - if test -n "$linker_opts"; then - linker_opts="-link$linker_opts" - fi - exec "$@" $linker_opts - exit 1 -} - -eat= - -case $1 in - '') - echo "$0: No command. Try '$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: compile [--help] [--version] PROGRAM [ARGS] - -Wrapper for compilers which do not understand '-c -o'. -Remove '-o dest.o' from ARGS, run PROGRAM with the remaining -arguments, and rename the output as expected. - -If you are trying to build a whole package this is not the -right script to run: please start by reading the file 'INSTALL'. - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "compile $scriptversion" - exit $? - ;; - cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) - func_cl_wrapper "$@" # Doesn't return... - ;; -esac - -ofile= -cfile= - -for arg -do - if test -n "$eat"; then - eat= - else - case $1 in - -o) - # configure might choose to run compile as 'compile cc -o foo foo.c'. - # So we strip '-o arg' only if arg is an object. - eat=1 - case $2 in - *.o | *.obj) - ofile=$2 - ;; - *) - set x "$@" -o "$2" - shift - ;; - esac - ;; - *.c) - cfile=$1 - set x "$@" "$1" - shift - ;; - *) - set x "$@" "$1" - shift - ;; - esac - fi - shift -done - -if test -z "$ofile" || test -z "$cfile"; then - # If no '-o' option was seen then we might have been invoked from a - # pattern rule where we don't need one. That is ok -- this is a - # normal compilation that the losing compiler can handle. If no - # '.c' file was seen then we are probably linking. That is also - # ok. - exec "$@" -fi - -# Name of file we expect compiler to create. -cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` - -# Create the lock directory. -# Note: use '[/\\:.-]' here to ensure that we don't use the same name -# that we are using for the .o file. Also, base the name on the expected -# object file name, since that is what matters with a parallel build. -lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d -while true; do - if mkdir "$lockdir" >/dev/null 2>&1; then - break - fi - sleep 1 -done -# FIXME: race condition here if user kills between mkdir and trap. -trap "rmdir '$lockdir'; exit 1" 1 2 15 - -# Run the compile. -"$@" -ret=$? - -if test -f "$cofile"; then - test "$cofile" = "$ofile" || mv "$cofile" "$ofile" -elif test -f "${cofile}bj"; then - test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" -fi - -rmdir "$lockdir" -exit $ret - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/configure b/configure deleted file mode 100755 index df8d785..0000000 --- a/configure +++ /dev/null @@ -1,7048 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for chill 0.2.1. -# -# -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. -# -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -# Use a proper internal environment variable to ensure we don't fall - # into an infinite loop, continuously re-executing ourselves. - if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then - _as_can_reexec=no; export _as_can_reexec; - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 - fi - # We don't want this to propagate to other subprocesses. - { _as_can_reexec=; unset _as_can_reexec;} -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1 -test -x / || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : - break 2 -fi -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - export CONFIG_SHELL - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a shell if you do have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # If we had to re-execute with $CONFIG_SHELL, we're ensured to have - # already done that, so ensure we don't try to do so again and fall - # in an infinite loop. This has already happened in practice. - _as_can_reexec=no; export _as_can_reexec - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -test -n "$DJDIR" || exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= - -# Identity of this package. -PACKAGE_NAME='chill' -PACKAGE_TARNAME='chill' -PACKAGE_VERSION='0.2.1' -PACKAGE_STRING='chill 0.2.1' -PACKAGE_BUGREPORT='' -PACKAGE_URL='' - -enable_option_checking=no -ac_subst_vars='am__EXEEXT_FALSE -am__EXEEXT_TRUE -LTLIBOBJS -LIBOBJS -subdirs -LUA_OPT_FALSE -LUA_OPT_TRUE -PYTHON_OPT_FALSE -PYTHON_OPT_TRUE -OMEGAHOME -BOOSTHOME -ROSEHOME -enable_coverage -CUDACHILL_OPT_FALSE -CUDACHILL_OPT_TRUE -enable_cuda -PYTHON_LIBDIR -PYTHON_INCDIR -pkgpyexecdir -pyexecdir -pkgpythondir -pythondir -PYTHON_PLATFORM -PYTHON_EXEC_PREFIX -PYTHON_PREFIX -PYTHON_VERSION -python_builds -PYTHON -YFLAGS -YACC -RANLIB -am__fastdepCXX_FALSE -am__fastdepCXX_TRUE -CXXDEPMODE -ac_ct_CXX -CXXFLAGS -CXX -LEXLIB -am__fastdepCC_FALSE -am__fastdepCC_TRUE -CCDEPMODE -am__nodep -AMDEPBACKSLASH -AMDEP_FALSE -AMDEP_TRUE -am__quote -am__include -DEPDIR -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -LEX_OUTPUT_ROOT -LEX -CHILL_BUILD_VERSION -CCLD -AM_BACKSLASH -AM_DEFAULT_VERBOSITY -AM_DEFAULT_V -AM_V -am__untar -am__tar -AMTAR -am__leading_dot -SET_MAKE -AWK -mkdir_p -MKDIR_P -INSTALL_STRIP_PROGRAM -STRIP -install_sh -MAKEINFO -AUTOHEADER -AUTOMAKE -AUTOCONF -ACLOCAL -VERSION -PACKAGE -CYGPATH_W -am__isrc -INSTALL_DATA -INSTALL_SCRIPT -INSTALL_PROGRAM -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_URL -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -enable_silent_rules -enable_dependency_tracking -enable_cuda -enable_coverage -with_rose -with_boost -with_omega -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CXX -CXXFLAGS -CCC -YACC -YFLAGS -PYTHON' -ac_subdirs_all='omega' - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *=) ac_optarg= ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures chill 0.2.1 to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/chill] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -Program names: - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM run sed PROGRAM on installed program names -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of chill 0.2.1:";; - esac - cat <<\_ACEOF - -Optional Features: - --disable-option-checking ignore unrecognized --enable/--with options - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-silent-rules less verbose build output (undo: "make V=1") - --disable-silent-rules verbose build output (undo: "make V=0") - --enable-dependency-tracking - do not reject slow dependency extractors - --disable-dependency-tracking - speeds up one-time build - - --enable-cuda builds cudachill - - - --enable-coverage enables coverage testing - - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - - --with-rose set rose home - - - --with-boost set boost home - - - --with-omega set omega home - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CXX C++ compiler command - CXXFLAGS C++ compiler flags - YACC The `Yet Another Compiler Compiler' implementation to use. - Defaults to the first program found out of: `bison -y', `byacc', - `yacc'. - YFLAGS The list of arguments that will be passed by default to $YACC. - This script will default YFLAGS to the empty string to avoid a - default value of `-d' given by some make applications. - PYTHON the Python interpreter - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to the package provider. -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -chill configure 0.2.1 -generated by GNU Autoconf 2.69 - -Copyright (C) 2012 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - -# ac_fn_cxx_try_compile LINENO -# ---------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_compile -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by chill $as_me 0.2.1, which was -generated by GNU Autoconf 2.69. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" - done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; - 2) - as_fn_append ac_configure_args1 " '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - as_fn_append ac_configure_args " '$ac_arg'" - ;; - esac - done -done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - $as_echo "## ---------------- ## -## Cache variables. ## -## ---------------- ##" - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - $as_echo "## ----------------- ## -## Output variables. ## -## ----------------- ##" - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## -## File substitutions. ## -## ------------------- ##" - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - $as_echo "## ----------- ## -## confdefs.h. ## -## ----------- ##" - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -$as_echo "/* confdefs.h */" > confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac -elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site -else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site -fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" -do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -ac_aux_dir= -for ac_dir in . "$srcdir"/.; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in . \"$srcdir\"/." "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -am__api_version='1.14' - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - fi - done - done - ;; -esac - - done -IFS=$as_save_IFS - -rm -rf conftest.one conftest.two conftest.dir - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 -$as_echo_n "checking whether build environment is sane... " >&6; } -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' -' -case `pwd` in - *[\\\"\#\$\&\'\`$am_lf]*) - as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; -esac -case $srcdir in - *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; -esac - -# Do 'set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - am_has_slept=no - for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - as_fn_error $? "ls -t appears to fail. Make sure there is not a broken - alias in your environment" "$LINENO" 5 - fi - if test "$2" = conftest.file || test $am_try -eq 2; then - break - fi - # Just in case. - sleep 1 - am_has_slept=yes - done - test "$2" = conftest.file - ) -then - # Ok. - : -else - as_fn_error $? "newly created file is older than distributed files! -Check your system clock" "$LINENO" 5 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -# If we didn't sleep, we still need to ensure time stamps of config.status and -# generated files are strictly newer. -am_sleep_pid= -if grep 'slept: no' conftest.file >/dev/null 2>&1; then - ( sleep 1 ) & - am_sleep_pid=$! -fi - -rm -f conftest.file - -test "$program_prefix" != NONE && - program_transform_name="s&^&$program_prefix&;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s&\$&$program_suffix&;$program_transform_name" -# Double any \ or $. -# By default was `s,x,x', remove it if useless. -ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` - -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` - -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac -fi -# Use eval to expand $SHELL -if eval "$MISSING --is-lightweight"; then - am_missing_run="$MISSING " -else - am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} -fi - -if test x"${install_sh}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; - *) - install_sh="\${SHELL} $am_aux_dir/install-sh" - esac -fi - -# Installed binaries are usually stripped using 'strip' when the user -# run "make install-strip". However 'strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the 'STRIP' environment variable to overrule this program. -if test "$cross_compiling" != no; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 -$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } -if test -z "$MKDIR_P"; then - if ${ac_cv_path_mkdir+:} false; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in mkdir gmkdir; do - for ac_exec_ext in '' $ac_executable_extensions; do - as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ - 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext - break 3;; - esac - done - done - done -IFS=$as_save_IFS - -fi - - test -d ./--version && rmdir ./--version - if test "${ac_cv_path_mkdir+set}" = set; then - MKDIR_P="$ac_cv_path_mkdir -p" - else - # As a last resort, use the slow shell script. Don't cache a - # value for MKDIR_P within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - MKDIR_P="$ac_install_sh -d" - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 -$as_echo "$MKDIR_P" >&6; } - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AWK" && break -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } -set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - SET_MAKE= -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - -rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null - -# Check whether --enable-silent-rules was given. -if test "${enable_silent_rules+set}" = set; then : - enableval=$enable_silent_rules; -fi - -case $enable_silent_rules in # ((( - yes) AM_DEFAULT_VERBOSITY=0;; - no) AM_DEFAULT_VERBOSITY=1;; - *) AM_DEFAULT_VERBOSITY=1;; -esac -am_make=${MAKE-make} -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 -$as_echo_n "checking whether $am_make supports nested variables... " >&6; } -if ${am_cv_make_support_nested_variables+:} false; then : - $as_echo_n "(cached) " >&6 -else - if $as_echo 'TRUE=$(BAR$(V)) -BAR0=false -BAR1=true -V=1 -am__doit: - @$(TRUE) -.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then - am_cv_make_support_nested_variables=yes -else - am_cv_make_support_nested_variables=no -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 -$as_echo "$am_cv_make_support_nested_variables" >&6; } -if test $am_cv_make_support_nested_variables = yes; then - AM_V='$(V)' - AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' -else - AM_V=$AM_DEFAULT_VERBOSITY - AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY -fi -AM_BACKSLASH='\' - -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - am__isrc=' -I$(srcdir)' - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 - fi -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi - - -# Define the identity of the package. - PACKAGE='chill' - VERSION='0.2.1' - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF - -# Some tools Automake needs. - -ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} - - -AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} - - -AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} - - -AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} - - -MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - -# For better backward compatibility. To be removed once Automake 1.9.x -# dies out for good. For more background, see: -# -# -mkdir_p='$(MKDIR_P)' - -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -# Always define AMTAR for backward compatibility. Yes, it's still used -# in the wild :-( We should find a proper way to deprecate it ... -AMTAR='$${TAR-tar}' - - -# We'll loop over all known methods to create a tar archive until one works. -_am_tools='gnutar pax cpio none' - -am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' - - - - - - -# POSIX will say in a future version that running "rm -f" with no argument -# is OK; and we want to be able to make that assumption in our Makefile -# recipes. So use an aggressive probe to check that the usage we want is -# actually supported "in the wild" to an acceptable degree. -# See automake bug#10828. -# To make any issue more visible, cause the running configure to be aborted -# by default if the 'rm' program in use doesn't match our expectations; the -# user can still override this though. -if rm -f && rm -fr && rm -rf; then : OK; else - cat >&2 <<'END' -Oops! - -Your 'rm' program seems unable to run without file operands specified -on the command line, even when the '-f' option is present. This is contrary -to the behaviour of most rm programs out there, and not conforming with -the upcoming POSIX standard: - -Please tell bug-automake@gnu.org about your system, including the value -of your $PATH and any error possibly output before this message. This -can help us improve future automake versions. - -END - if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then - echo 'Configuration will proceed anyway, since you have set the' >&2 - echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 - echo >&2 - else - cat >&2 <<'END' -Aborting the configuration process, to ensure you take notice of the issue. - -You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . - -If you want to complete the configuration process using your problematic -'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM -to "yes", and re-run configure. - -END - as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 - fi -fi - -#AC_SUBST([prefix],["$(pwd)/bin"]) - -### Use the C++ compiler for linking (C is default) ### -CCLD="$""(CXX)" - -CHILL_BUILD_VERSION="\\\"0.2.1\\\"" - - -AM_PROG_AC -DEPDIR="${am__leading_dot}deps" - -ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf - -# Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : - enableval=$enable_dependency_tracking; -fi - -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' - am__nodep='_no' -fi - if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 -$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } -if ${am_cv_prog_cc_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF - # Make sure it works both with $CC and with simple cc. - # Following AC_PROG_CC_C_O, we do the test twice because some - # compilers refuse to overwrite an existing .o file with -o, - # though they will create one. - am_cv_prog_cc_c_o=yes - for am_i in 1 2; do - if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 - ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } \ - && test -f conftest2.$ac_objext; then - : OK - else - am_cv_prog_cc_c_o=no - break - fi - done - rm -f core conftest* - unset am_i -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 -$as_echo "$am_cv_prog_cc_c_o" >&6; } -if test "$am_cv_prog_cc_c_o" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -depcc="$CC" am_compiler_list= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - - -for ac_prog in flex lex -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_LEX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$LEX"; then - ac_cv_prog_LEX="$LEX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_LEX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -LEX=$ac_cv_prog_LEX -if test -n "$LEX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LEX" >&5 -$as_echo "$LEX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$LEX" && break -done -test -n "$LEX" || LEX=":" - -if test "x$LEX" != "x:"; then - cat >conftest.l <<_ACEOF -%% -a { ECHO; } -b { REJECT; } -c { yymore (); } -d { yyless (1); } -e { /* IRIX 6.5 flex 2.5.4 underquotes its yyless argument. */ - yyless ((input () != 0)); } -f { unput (yytext[0]); } -. { BEGIN INITIAL; } -%% -#ifdef YYTEXT_POINTER -extern char *yytext; -#endif -int -main (void) -{ - return ! yylex () + ! yywrap (); -} -_ACEOF -{ { ac_try="$LEX conftest.l" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$LEX conftest.l") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking lex output file root" >&5 -$as_echo_n "checking lex output file root... " >&6; } -if ${ac_cv_prog_lex_root+:} false; then : - $as_echo_n "(cached) " >&6 -else - -if test -f lex.yy.c; then - ac_cv_prog_lex_root=lex.yy -elif test -f lexyy.c; then - ac_cv_prog_lex_root=lexyy -else - as_fn_error $? "cannot find output from $LEX; giving up" "$LINENO" 5 -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_root" >&5 -$as_echo "$ac_cv_prog_lex_root" >&6; } -LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root - -if test -z "${LEXLIB+set}"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex library" >&5 -$as_echo_n "checking lex library... " >&6; } -if ${ac_cv_lib_lex+:} false; then : - $as_echo_n "(cached) " >&6 -else - - ac_save_LIBS=$LIBS - ac_cv_lib_lex='none needed' - for ac_lib in '' -lfl -ll; do - LIBS="$ac_lib $ac_save_LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -`cat $LEX_OUTPUT_ROOT.c` -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_lex=$ac_lib -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - test "$ac_cv_lib_lex" != 'none needed' && break - done - LIBS=$ac_save_LIBS - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lex" >&5 -$as_echo "$ac_cv_lib_lex" >&6; } - test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether yytext is a pointer" >&5 -$as_echo_n "checking whether yytext is a pointer... " >&6; } -if ${ac_cv_prog_lex_yytext_pointer+:} false; then : - $as_echo_n "(cached) " >&6 -else - # POSIX says lex can declare yytext either as a pointer or an array; the -# default is implementation-dependent. Figure out which it is, since -# not all implementations provide the %pointer and %array declarations. -ac_cv_prog_lex_yytext_pointer=no -ac_save_LIBS=$LIBS -LIBS="$LEXLIB $ac_save_LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #define YYTEXT_POINTER 1 -`cat $LEX_OUTPUT_ROOT.c` -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_prog_lex_yytext_pointer=yes -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_save_LIBS - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_yytext_pointer" >&5 -$as_echo "$ac_cv_prog_lex_yytext_pointer" >&6; } -if test $ac_cv_prog_lex_yytext_pointer = yes; then - -$as_echo "#define YYTEXT_POINTER 1" >>confdefs.h - -fi -rm -f conftest.l $LEX_OUTPUT_ROOT.c - -fi -if test "$LEX" = :; then - LEX=${am_missing_run}flex -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 -$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } -if ${am_cv_prog_cc_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF - # Make sure it works both with $CC and with simple cc. - # Following AC_PROG_CC_C_O, we do the test twice because some - # compilers refuse to overwrite an existing .o file with -o, - # though they will create one. - am_cv_prog_cc_c_o=yes - for am_i in 1 2; do - if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 - ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } \ - && test -f conftest2.$ac_objext; then - : OK - else - am_cv_prog_cc_c_o=no - break - fi - done - rm -f core conftest* - unset am_i -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 -$as_echo "$am_cv_prog_cc_c_o" >&6; } -if test "$am_cv_prog_cc_c_o" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -depcc="$CC" am_compiler_list= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -$as_echo "$CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CXX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -$as_echo "$ac_ct_CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CXX" && break -done - - if test "x$ac_ct_CXX" = x; then - CXX="g++" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CXX=$ac_ct_CXX - fi -fi - - fi -fi -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 -$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } -if ${ac_cv_cxx_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GXX=yes -else - GXX= -fi -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -$as_echo_n "checking whether $CXX accepts -g... " >&6; } -if ${ac_cv_prog_cxx_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_cxx_werror_flag=$ac_cxx_werror_flag - ac_cxx_werror_flag=yes - ac_cv_prog_cxx_g=no - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_g=yes -else - CXXFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - -else - ac_cxx_werror_flag=$ac_save_cxx_werror_flag - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_cxx_werror_flag=$ac_save_cxx_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -$as_echo "$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -depcc="$CXX" am_compiler_list= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CXX_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CXX_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CXX_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CXX_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } -CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then - am__fastdepCXX_TRUE= - am__fastdepCXX_FALSE='#' -else - am__fastdepCXX_TRUE='#' - am__fastdepCXX_FALSE= -fi - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -for ac_prog in 'bison -y' byacc -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_YACC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$YACC"; then - ac_cv_prog_YACC="$YACC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_YACC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -YACC=$ac_cv_prog_YACC -if test -n "$YACC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5 -$as_echo "$YACC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$YACC" && break -done -test -n "$YACC" || YACC="yacc" - - - - - - - - - if test -n "$PYTHON"; then - # If the user set $PYTHON, use it and don't search something else. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $PYTHON version is >= 2.7" >&5 -$as_echo_n "checking whether $PYTHON version is >= 2.7... " >&6; } - prog="import sys -# split strings by '.' and convert to numeric. Append some zeros -# because we need at least 4 digits for the hex conversion. -# map returns an iterator in Python 3.0 and a list in 2.x -minver = list(map(int, '2.7'.split('.'))) + [0, 0, 0] -minverhex = 0 -# xrange is not present in Python 3.0 and range returns an iterator -for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i] -sys.exit(sys.hexversion < minverhex)" - if { echo "$as_me:$LINENO: $PYTHON -c "$prog"" >&5 - ($PYTHON -c "$prog") >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "Python interpreter is too old" "$LINENO" 5 -fi - am_display_PYTHON=$PYTHON - else - # Otherwise, try each interpreter until we find one that satisfies - # VERSION. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a Python interpreter with version >= 2.7" >&5 -$as_echo_n "checking for a Python interpreter with version >= 2.7... " >&6; } -if ${am_cv_pathless_PYTHON+:} false; then : - $as_echo_n "(cached) " >&6 -else - - for am_cv_pathless_PYTHON in python python2 python3 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do - test "$am_cv_pathless_PYTHON" = none && break - prog="import sys -# split strings by '.' and convert to numeric. Append some zeros -# because we need at least 4 digits for the hex conversion. -# map returns an iterator in Python 3.0 and a list in 2.x -minver = list(map(int, '2.7'.split('.'))) + [0, 0, 0] -minverhex = 0 -# xrange is not present in Python 3.0 and range returns an iterator -for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i] -sys.exit(sys.hexversion < minverhex)" - if { echo "$as_me:$LINENO: $am_cv_pathless_PYTHON -c "$prog"" >&5 - ($am_cv_pathless_PYTHON -c "$prog") >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then : - break -fi - done -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_pathless_PYTHON" >&5 -$as_echo "$am_cv_pathless_PYTHON" >&6; } - # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. - if test "$am_cv_pathless_PYTHON" = none; then - PYTHON=: - else - # Extract the first word of "$am_cv_pathless_PYTHON", so it can be a program name with args. -set dummy $am_cv_pathless_PYTHON; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PYTHON+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PYTHON in - [\\/]* | ?:[\\/]*) - ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PYTHON=$ac_cv_path_PYTHON -if test -n "$PYTHON"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 -$as_echo "$PYTHON" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi - am_display_PYTHON=$am_cv_pathless_PYTHON - fi - - - if test "$PYTHON" = :; then - - python_builds=no - - else - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON version" >&5 -$as_echo_n "checking for $am_display_PYTHON version... " >&6; } -if ${am_cv_python_version+:} false; then : - $as_echo_n "(cached) " >&6 -else - am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[:3])"` -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_version" >&5 -$as_echo "$am_cv_python_version" >&6; } - PYTHON_VERSION=$am_cv_python_version - - - - PYTHON_PREFIX='${prefix}' - - PYTHON_EXEC_PREFIX='${exec_prefix}' - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON platform" >&5 -$as_echo_n "checking for $am_display_PYTHON platform... " >&6; } -if ${am_cv_python_platform+:} false; then : - $as_echo_n "(cached) " >&6 -else - am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"` -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_platform" >&5 -$as_echo "$am_cv_python_platform" >&6; } - PYTHON_PLATFORM=$am_cv_python_platform - - - # Just factor out some code duplication. - am_python_setup_sysconfig="\ -import sys -# Prefer sysconfig over distutils.sysconfig, for better compatibility -# with python 3.x. See automake bug#10227. -try: - import sysconfig -except ImportError: - can_use_sysconfig = 0 -else: - can_use_sysconfig = 1 -# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs: -# -try: - from platform import python_implementation - if python_implementation() == 'CPython' and sys.version[:3] == '2.7': - can_use_sysconfig = 0 -except ImportError: - pass" - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON script directory" >&5 -$as_echo_n "checking for $am_display_PYTHON script directory... " >&6; } -if ${am_cv_python_pythondir+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$prefix" = xNONE - then - am_py_prefix=$ac_default_prefix - else - am_py_prefix=$prefix - fi - am_cv_python_pythondir=`$PYTHON -c " -$am_python_setup_sysconfig -if can_use_sysconfig: - sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'}) -else: - from distutils import sysconfig - sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix') -sys.stdout.write(sitedir)"` - case $am_cv_python_pythondir in - $am_py_prefix*) - am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` - am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"` - ;; - *) - case $am_py_prefix in - /usr|/System*) ;; - *) - am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages - ;; - esac - ;; - esac - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pythondir" >&5 -$as_echo "$am_cv_python_pythondir" >&6; } - pythondir=$am_cv_python_pythondir - - - - pkgpythondir=\${pythondir}/$PACKAGE - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON extension module directory" >&5 -$as_echo_n "checking for $am_display_PYTHON extension module directory... " >&6; } -if ${am_cv_python_pyexecdir+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$exec_prefix" = xNONE - then - am_py_exec_prefix=$am_py_prefix - else - am_py_exec_prefix=$exec_prefix - fi - am_cv_python_pyexecdir=`$PYTHON -c " -$am_python_setup_sysconfig -if can_use_sysconfig: - sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'}) -else: - from distutils import sysconfig - sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix') -sys.stdout.write(sitedir)"` - case $am_cv_python_pyexecdir in - $am_py_exec_prefix*) - am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` - am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"` - ;; - *) - case $am_py_exec_prefix in - /usr|/System*) ;; - *) - am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages - ;; - esac - ;; - esac - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pyexecdir" >&5 -$as_echo "$am_cv_python_pyexecdir" >&6; } - pyexecdir=$am_cv_python_pyexecdir - - - - pkgpyexecdir=\${pyexecdir}/$PACKAGE - - - - PYTHON_INCDIR=`${PYTHON} -c "from distutils import sysconfig; print(sysconfig.get_python_inc())"` - - PYTHON_LIBDIR=`${PYTHON} -c "from distutils import sysconfig; print(sysconfig.get_config_var('LIBDIR'))"` - - python_builds=yes - - fi - - - - -#AC_ARG_ENABLE([cuda],[ -# AS_HELP_STRING([--enable-cuda],[builds cudachill])],[ -# AS_IF([test "x$enableval" != xno],[ -# AC_SUBST([enable_cuda],[yes])])]) - -# Check whether --enable-cuda was given. -if test "${enable_cuda+set}" = set; then : - enableval=$enable_cuda; - if test "x$enableval" != xno; then : - - enable_cuda=yes - -fi -fi - - - if test "x$enable_cuda" == xyes; then - CUDACHILL_OPT_TRUE= - CUDACHILL_OPT_FALSE='#' -else - CUDACHILL_OPT_TRUE='#' - CUDACHILL_OPT_FALSE= -fi - - - -# Check whether --enable-coverage was given. -if test "${enable_coverage+set}" = set; then : - enableval=$enable_coverage; - if "x$enableval" != xno; then : - - enable_coverage=yes - - CFLAGS="-g -fprofile-arcs -ftest-coverage" - - CPPFLAGS="-g -fprofile-arcs -ftest-coverage" - -fi -fi - - - -# Check whether --with-rose was given. -if test "${with_rose+set}" = set; then : - withval=$with_rose; - ROSEHOME=$withval - - -$as_echo "#define BUILD_ROSE /**/" >>confdefs.h - - -else - - ROSEHOME="${ROSEHOME}" - - -$as_echo "#define BUILD_ROSE /**/" >>confdefs.h - -fi - - - -# Check whether --with-boost was given. -if test "${with_boost+set}" = set; then : - withval=$with_boost; - BOOSTHOME=$withval - - -else - - BOOSTHOME="${BOOSTHOME}" - -fi - - - -# Check whether --with-omega was given. -if test "${with_omega+set}" = set; then : - withval=$with_omega; - OMEGAHOME=$withval - -else - - OMEGAHOME="$(pwd)/omega" - -fi - - -#AC_ARG_WITH([python],[ -# AS_HELP_STRING([--with-python],[set python as the interface languge]) -# ],[ -# AC_SUBST([interface_lang],[python]) -# ],[ -# AC_SUBST([interface_lang],[python])]) - -#AC_ARG_WITH([lua],[ -# AS_HELP_STRING([--with-lua],[set lua as the interface langauge.])],[ -# AC_SUBST([LUAHOME], ["${LUAHOME}"]) -# AC_SUBST([interface_lang], [lua]) -# ],[ -# AC_SUBST([LUAHOME], ["${LUAHOME}"])]) - -#AC_ARG_WITH([interface],[ -# AS_HELP_STRING([--with-interface],[select interface language])],[ -# AC_SUBST([interface_lang],[$withval])],[ -# AC_SUBST([interface_lang],[default])]) - -#AS_IF([test "x$interface_lang" == xdefault],[ -# AS_IF([test "x$enable_cuda" == xyes],[ -# AC_SUBST([use_python],[yes]) -# AC_SUBST([use_lua],[no]) -# AC_SUBST([interface_lang],[python]) -# ],[ -# AC_SUBST([use_python],[yes]) -# AC_SUBST([use_lua],[no]) -# AC_SUBST([interface_lang],[python])])],[]) - -#AS_IF([test "x$interface_lang" == xlua],[ -# AC_SUBST([use_python],[no]) -# AC_SUBST([use_lua],[yes])],[]) -#AS_IF([test "x$interface_lang" == xpython],[ -# AC_SUBST([use_python],[yes]) -# AC_SUBST([use_lua],[no])],[]) - - if test 1 = 1; then - PYTHON_OPT_TRUE= - PYTHON_OPT_FALSE='#' -else - PYTHON_OPT_TRUE='#' - PYTHON_OPT_FALSE= -fi - - if test 1 = 0; then - LUA_OPT_TRUE= - LUA_OPT_FALSE='#' -else - LUA_OPT_TRUE='#' - LUA_OPT_FALSE= -fi - - -ac_config_headers="$ac_config_headers include/config.h" - -ac_config_files="$ac_config_files Makefile" - - - -subdirs="$subdirs omega" - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -U= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 -$as_echo_n "checking that generated files are newer than configure... " >&6; } - if test -n "$am_sleep_pid"; then - # Hide warnings about reused PIDs. - wait $am_sleep_pid 2>/dev/null - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 -$as_echo "done" >&6; } - if test -n "$EXEEXT"; then - am__EXEEXT_TRUE= - am__EXEEXT_FALSE='#' -else - am__EXEEXT_TRUE='#' - am__EXEEXT_FALSE= -fi - -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - as_fn_error $? "conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${CUDACHILL_OPT_TRUE}" && test -z "${CUDACHILL_OPT_FALSE}"; then - as_fn_error $? "conditional \"CUDACHILL_OPT\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${PYTHON_OPT_TRUE}" && test -z "${PYTHON_OPT_FALSE}"; then - as_fn_error $? "conditional \"PYTHON_OPT\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LUA_OPT_TRUE}" && test -z "${LUA_OPT_FALSE}"; then - as_fn_error $? "conditional \"LUA_OPT\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi - -: "${CONFIG_STATUS=./config.status}" -ac_write_fail=0 -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by chill $as_me 0.2.1, which was -generated by GNU Autoconf 2.69. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac - -case $ac_config_headers in *" -"*) set x $ac_config_headers; shift; ac_config_headers=$*;; -esac - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" -config_headers="$ac_config_headers" -config_commands="$ac_config_commands" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration commands: -$config_commands - -Report bugs to the package provider." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" -ac_cs_version="\\ -chill config.status 0.2.1 -configured by $0, generated by GNU Autoconf 2.69, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2012 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -INSTALL='$INSTALL' -MKDIR_P='$MKDIR_P' -AWK='$AWK' -test -n "\$AWK" || AWK=awk -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=?*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append CONFIG_HEADERS " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h) - # Conflict between --help and --header - as_fn_error $? "ambiguous option: \`$1' -Try \`$0 --help' for more information.";; - --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -if \$ac_cs_recheck; then - set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' - export CONFIG_SHELL - exec "\$@" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - $as_echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# -# INIT-COMMANDS -# -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= ac_tmp= - trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\)..*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\)..*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove sole $(srcdir), -# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - -# Set up the scripts for CONFIG_HEADERS section. -# No need to generate them if there are no CONFIG_HEADERS. -# This happens for instance with `./config.status Makefile'. -if test -n "$CONFIG_HEADERS"; then -cat >"$ac_tmp/defines.awk" <<\_ACAWK || -BEGIN { -_ACEOF - -# Transform confdefs.h into an awk script `defines.awk', embedded as -# here-document in config.status, that substitutes the proper values into -# config.h.in to produce config.h. - -# Create a delimiter string that does not exist in confdefs.h, to ease -# handling of long lines. -ac_delim='%!_!# ' -for ac_last_try in false false :; do - ac_tt=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_tt"; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -# For the awk script, D is an array of macro values keyed by name, -# likewise P contains macro parameters if any. Preserve backslash -# newline sequences. - -ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* -sed -n ' -s/.\{148\}/&'"$ac_delim"'/g -t rset -:rset -s/^[ ]*#[ ]*define[ ][ ]*/ / -t def -d -:def -s/\\$// -t bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3"/p -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p -d -:bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3\\\\\\n"\\/p -t cont -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p -t cont -d -:cont -n -s/.\{148\}/&'"$ac_delim"'/g -t clear -:clear -s/\\$// -t bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/"/p -d -:bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p -b cont -' >$CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - for (key in D) D_is_set[key] = 1 - FS = "" -} -/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { - line = \$ 0 - split(line, arg, " ") - if (arg[1] == "#") { - defundef = arg[2] - mac1 = arg[3] - } else { - defundef = substr(arg[1], 2) - mac1 = arg[2] - } - split(mac1, mac2, "(") #) - macro = mac2[1] - prefix = substr(line, 1, index(line, defundef) - 1) - if (D_is_set[macro]) { - # Preserve the white space surrounding the "#". - print prefix "define", macro P[macro] D[macro] - next - } else { - # Replace #undef with comments. This is necessary, for example, - # in the case of _POSIX_SOURCE, which is predefined and required - # on some systems where configure will not decide to define it. - if (defundef == "undef") { - print "/*", prefix defundef, macro, "*/" - next - } - } -} -{ print } -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 -fi # test -n "$CONFIG_HEADERS" - - -eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$ac_tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; - esac - ac_MKDIR_P=$MKDIR_P - case $MKDIR_P in - [\\/$]* | ?:[\\/]* ) ;; - */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; - esac -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -s&@INSTALL@&$ac_INSTALL&;t t -s&@MKDIR_P@&$ac_MKDIR_P&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} - - rm -f "$ac_tmp/stdin" - case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; - :H) - # - # CONFIG_HEADER - # - if test x"$ac_file" != x-; then - { - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" - } >"$ac_tmp/config.h" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} - else - rm -f "$ac_file" - mv "$ac_tmp/config.h" "$ac_file" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - fi - else - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error $? "could not create -" "$LINENO" 5 - fi -# Compute "$ac_file"'s index in $config_headers. -_am_arg="$ac_file" -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $_am_arg | $_am_arg:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || -$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$_am_arg" : 'X\(//\)[^/]' \| \ - X"$_am_arg" : 'X\(//\)$' \| \ - X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$_am_arg" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'`/stamp-h$_am_stamp_count - ;; - - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} - ;; - esac - - - case $ac_file$ac_mode in - "depfiles":C) test x"$AMDEP_TRUE" != x"" || { - # Older Autoconf quotes --file arguments for eval, but not when files - # are listed without --file. Let's play safe and only enable the eval - # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac - shift - for mf - do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done - done -} - ;; - - esac -done # for ac_tag - - -as_fn_exit 0 -_ACEOF -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit 1 -fi - -# -# CONFIG_SUBDIRS section. -# -if test "$no_recursion" != yes; then - - # Remove --cache-file, --srcdir, and --disable-option-checking arguments - # so they do not pile up. - ac_sub_configure_args= - ac_prev= - eval "set x $ac_configure_args" - shift - for ac_arg - do - if test -n "$ac_prev"; then - ac_prev= - continue - fi - case $ac_arg in - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ - | --c=*) - ;; - --config-cache | -C) - ;; - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - ;; - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - ;; - --disable-option-checking) - ;; - *) - case $ac_arg in - *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append ac_sub_configure_args " '$ac_arg'" ;; - esac - done - - # Always prepend --prefix to ensure using the same prefix - # in subdir configurations. - ac_arg="--prefix=$prefix" - case $ac_arg in - *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args" - - # Pass --silent - if test "$silent" = yes; then - ac_sub_configure_args="--silent $ac_sub_configure_args" - fi - - # Always prepend --disable-option-checking to silence warnings, since - # different subdirs can have different --enable and --with options. - ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args" - - ac_popdir=`pwd` - for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue - - # Do not complain, so a configure script can configure whichever - # parts of a large source tree are present. - test -d "$srcdir/$ac_dir" || continue - - ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" - $as_echo "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5 - $as_echo "$ac_msg" >&6 - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - cd "$ac_dir" - - # Check for guested configure; otherwise get Cygnus style configure. - if test -f "$ac_srcdir/configure.gnu"; then - ac_sub_configure=$ac_srcdir/configure.gnu - elif test -f "$ac_srcdir/configure"; then - ac_sub_configure=$ac_srcdir/configure - elif test -f "$ac_srcdir/configure.in"; then - # This should be Cygnus configure. - ac_sub_configure=$ac_aux_dir/configure - else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5 -$as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} - ac_sub_configure= - fi - - # The recursion is here. - if test -n "$ac_sub_configure"; then - # Make the cache file name correct relative to the subdirectory. - case $cache_file in - [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; - *) # Relative name. - ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; - esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 -$as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} - # The eval makes quoting arguments work. - eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ - --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || - as_fn_error $? "$ac_sub_configure failed for $ac_dir" "$LINENO" 5 - fi - - cd "$ac_popdir" - done -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 4b65960..0000000 --- a/configure.ac +++ /dev/null @@ -1,112 +0,0 @@ -AC_INIT([chill],[0.2.1]) -AC_CONFIG_AUX_DIR([.]) -AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects]) - -#AC_SUBST([prefix],["$(pwd)/bin"]) - -### Use the C++ compiler for linking (C is default) ### -AC_SUBST([CCLD],["$""(CXX)"]) -AC_SUBST([CHILL_BUILD_VERSION],["\\\"0.2.1\\\""]) - -m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) -AM_PROG_LEX -AC_PROG_CC -AC_PROG_CXX -AC_PROG_RANLIB -AC_PROG_YACC - -AM_PATH_PYTHON([2.7],[ - AC_SUBST([PYTHON_INCDIR], - [`${PYTHON} -c "from distutils import sysconfig; print(sysconfig.get_python_inc())"`]) - AC_SUBST([PYTHON_LIBDIR], - [`${PYTHON} -c "from distutils import sysconfig; print(sysconfig.get_config_var('LIBDIR'))"`]) - AC_SUBST([python_builds],[yes])],[ - AC_SUBST([python_builds],[no])]) - - -#AC_ARG_ENABLE([cuda],[ -# AS_HELP_STRING([--enable-cuda],[builds cudachill])],[ -# AS_IF([test "x$enableval" != xno],[ -# AC_SUBST([enable_cuda],[yes])])]) - -AC_ARG_ENABLE([cuda],[ - AS_HELP_STRING([--enable-cuda],[builds cudachill]) - ],[ - AS_IF([test "x$enableval" != xno],[ - AC_SUBST([enable_cuda],[yes])])]) - -AM_CONDITIONAL([CUDACHILL_OPT],[test "x$enable_cuda" == xyes]) - - -AC_ARG_ENABLE([coverage],[ - AS_HELP_STRING([--enable-coverage],[enables coverage testing]) - ],[ - AS_IF(["x$enableval" != xno],[ - AC_SUBST([enable_coverage],[yes]) - AC_SUBST([CFLAGS],["-g -fprofile-arcs -ftest-coverage"]) - AC_SUBST([CPPFLAGS],["-g -fprofile-arcs -ftest-coverage"])],[])]) - -AC_ARG_WITH([rose],[ - AS_HELP_STRING([--with-rose],[set rose home]) - ],[ - AC_SUBST([ROSEHOME], [$withval]) - AC_DEFINE([BUILD_ROSE],[],[Use ROSE]) - ],[ - AC_SUBST([ROSEHOME], ["${ROSEHOME}"]) - AC_DEFINE([BUILD_ROSE],[],[Use ROSE])]) - -AC_ARG_WITH([boost],[ - AS_HELP_STRING([--with-boost],[set boost home]) - ],[ - AC_SUBST([BOOSTHOME], [$withval]) - ],[ - AC_SUBST([BOOSTHOME], ["${BOOSTHOME}"])]) - -AC_ARG_WITH([omega],[ - AS_HELP_STRING([--with-omega],[set omega home])],[ - AC_SUBST([OMEGAHOME], [$withval])],[ - AC_SUBST([OMEGAHOME], ["$(pwd)/omega"])]) - -AC_ARG_WITH([python],[ - AS_HELP_STRING([--with-python],[set python as the interface languge]) - ],[ - AC_SUBST([interface_lang],[python]) - ],[ - AC_SUBST([interface_lang],[default])]) - -AC_ARG_WITH([lua],[ - AS_HELP_STRING([--with-lua],[set lua as the interface langauge.])],[ - AC_SUBST([LUAHOME], ["${LUAHOME}"]) - AC_SUBST([interface_lang], [lua]) - ],[ - AC_SUBST([LUAHOME], ["${LUAHOME}"])]) - -#AC_ARG_WITH([interface],[ -# AS_HELP_STRING([--with-interface],[select interface language])],[ -# AC_SUBST([interface_lang],[$withval])],[ -# AC_SUBST([interface_lang],[default])]) - -AS_IF([test "x$interface_lang" == xdefault],[ - AS_IF([test "x$enable_cuda" == xyes],[ - AC_SUBST([use_python],[yes]) - AC_SUBST([use_lua],[no]) - AC_SUBST([interface_lang],[python]) - ],[ - AC_SUBST([use_python],[yes]) - AC_SUBST([use_lua],[no]) - AC_SUBST([interface_lang],[python])])],[]) - -AS_IF([test "x$interface_lang" == xlua],[ - AC_SUBST([use_python],[no]) - AC_SUBST([use_lua],[yes])],[]) -AS_IF([test "x$interface_lang" == xpython],[ - AC_SUBST([use_python],[yes]) - AC_SUBST([use_lua],[no])],[]) - -AM_CONDITIONAL([PYTHON_OPT],[test "x$use_python" = xyes]) -AM_CONDITIONAL([LUA_OPT],[test "x$use_lua" = xyes]) - -AC_CONFIG_HEADERS([include/config.h]) -AC_CONFIG_FILES([Makefile]) -AC_CONFIG_SUBDIRS([omega]) -AC_OUTPUT diff --git a/dep.cc b/dep.cc deleted file mode 100644 index a675d03..0000000 --- a/dep.cc +++ /dev/null @@ -1,567 +0,0 @@ -/***************************************************************************** - Copyright (C) 2008 University of Southern California - Copyright (C) 2009-2010 University of Utah - All Rights Reserved. - - Purpose: - Data dependence vector and graph. - - Notes: - All dependence vectors are normalized, i.e., the first non-zero distance - must be positve. Thus the correct dependence meaning can be given based on - source/destination pair's read/write type. Suppose for a dependence vector - 1, 0~5, -3), we want to permute the first and the second dimension, - the result would be two dependence vectors (0, 1, -3) and (1~5, 1, -3). - All operations on dependence vectors are non-destructive, i.e., new - dependence vectors are returned. - - History: - 01/2006 Created by Chun Chen. - 03/2009 Use IR_Ref interface in source and destination arrays -chun -*****************************************************************************/ - -#include "dep.hh" - -//----------------------------------------------------------------------------- -// Class: DependeceVector -//----------------------------------------------------------------------------- - -std::ostream& operator<<(std::ostream &os, const DependenceVector &d) { - if (d.sym != NULL) { - os << d.sym->name(); - os << ':'; - if (d.quasi) - os << "_quasi"; - - } - - switch (d.type) { - case DEP_W2R: - os << "true"; - if (d.is_reduction) - os << "_reduction"; - break; - case DEP_R2W: - os << "anti"; - break; - case DEP_W2W: - os << "output"; - break; - case DEP_R2R: - os << "input"; - break; - case DEP_CONTROL: - os << "control"; - break; - default: - os << "unknown"; - break; - } - - os << '('; - - for (int i = 0; i < d.lbounds.size(); i++) { - omega::coef_t lbound = d.lbounds[i]; - omega::coef_t ubound = d.ubounds[i]; - - if (lbound == ubound) - os << lbound; - else { - if (lbound == -posInfinity) - if (ubound == posInfinity) - os << '*'; - else { - if (ubound == -1) - os << '-'; - else - os << ubound << '-'; - } - else if (ubound == posInfinity) { - if (lbound == 1) - os << '+'; - else - os << lbound << '+'; - } else - os << lbound << '~' << ubound; - } - - if (i < d.lbounds.size() - 1) - os << ", "; - } - - os << ')'; - - return os; -} - -// DependenceVector::DependenceVector(int size): -// lbounds(std::vector(size, 0)), -// ubounds(std::vector(size, 0)) { -// src = NULL; -// dst = NULL; -// } - -DependenceVector::DependenceVector(const DependenceVector &that) { - if (that.sym != NULL) - this->sym = that.sym->clone(); - else - this->sym = NULL; - this->type = that.type; - this->lbounds = that.lbounds; - this->ubounds = that.ubounds; - quasi = that.quasi; - is_scalar_dependence = that.is_scalar_dependence; - is_reduction = that.is_reduction; -} - -DependenceVector &DependenceVector::operator=(const DependenceVector &that) { - if (this != &that) { - delete this->sym; - if (that.sym != NULL) - this->sym = that.sym->clone(); - else - this->sym = NULL; - this->type = that.type; - this->lbounds = that.lbounds; - this->ubounds = that.ubounds; - quasi = that.quasi; - is_scalar_dependence = that.is_scalar_dependence; - is_reduction = that.is_reduction; - } - return *this; -} -DependenceType DependenceVector::getType() const { - return type; -} - -bool DependenceVector::is_data_dependence() const { - if (type == DEP_W2R || type == DEP_R2W || type == DEP_W2W - || type == DEP_R2R) - return true; - else - return false; -} - -bool DependenceVector::is_control_dependence() const { - if (type == DEP_CONTROL) - return true; - else - return false; -} - -bool DependenceVector::has_negative_been_carried_at(int dim) const { - if (!is_data_dependence()) - throw std::invalid_argument("only works for data dependences"); - - if (dim < 0 || dim >= lbounds.size()) - return false; - - for (int i = 0; i < dim; i++) - if (lbounds[i] > 0 || ubounds[i] < 0) - return false; - - if (lbounds[dim] < 0) - return true; - else - return false; -} - - -bool DependenceVector::has_been_carried_at(int dim) const { - if (!is_data_dependence()) - throw std::invalid_argument("only works for data dependences"); - - if (dim < 0 || dim >= lbounds.size()) - return false; - - for (int i = 0; i < dim; i++) - if (lbounds[i] > 0 || ubounds[i] < 0) - return false; - - if ((lbounds[dim] != 0) || (ubounds[dim] !=0)) - return true; - - return false; -} - -bool DependenceVector::has_been_carried_before(int dim) const { - if (!is_data_dependence()) - throw std::invalid_argument("only works for data dependences"); - - if (dim < 0) - return false; - if (dim > lbounds.size()) - dim = lbounds.size(); - - for (int i = 0; i < dim; i++) { - if (lbounds[i] > 0) - return true; - if (ubounds[i] < 0) - return true; - } - - return false; -} - -bool DependenceVector::isZero() const { - return isZero(lbounds.size() - 1); -} - -bool DependenceVector::isZero(int dim) const { - if (dim >= lbounds.size()) - throw std::invalid_argument("invalid dependence dimension"); - - for (int i = 0; i <= dim; i++) - if (lbounds[i] != 0 || ubounds[i] != 0) - return false; - - return true; -} - -bool DependenceVector::isPositive() const { - for (int i = 0; i < lbounds.size(); i++) - if (lbounds[i] != 0 || ubounds[i] != 0) { - if (lbounds[i] < 0) - return false; - else if (lbounds[i] > 0) - return true; - } - - return false; -} - -bool DependenceVector::isNegative() const { - for (int i = 0; i < lbounds.size(); i++) - if (lbounds[i] != 0 || ubounds[i] != 0) { - if (ubounds[i] > 0) - return false; - else if (ubounds[i] < 0) - return true; - } - - return false; -} - -bool DependenceVector::isAllPositive() const { - for (int i = 0; i < lbounds.size(); i++) - if (lbounds[i] < 0) - return false; - - return true; -} - -bool DependenceVector::isAllNegative() const { - for (int i = 0; i < ubounds.size(); i++) - if (ubounds[i] > 0) - return false; - - return true; -} - -bool DependenceVector::hasPositive(int dim) const { - if (dim >= lbounds.size()) - throw std::invalid_argument("invalid dependence dimension"); - - if (lbounds[dim] > 0) - //av: changed from ubounds to lbounds may have side effects - return true; - else - return false; -} - -bool DependenceVector::hasNegative(int dim) const { - if (dim >= lbounds.size()) - throw std::invalid_argument("invalid dependence dimension"); - - if (ubounds[dim] < 0) - //av: changed from lbounds to ubounds may have side effects - return true; - else - return false; -} - -bool DependenceVector::isCarried(int dim, omega::coef_t distance) const { - if (distance <= 0) - throw std::invalid_argument("invalid dependence distance size"); - - if (dim > lbounds.size()) - dim = lbounds.size(); - - for (int i = 0; i < dim; i++) - if (lbounds[i] > 0) - return false; - else if (ubounds[i] < 0) - return false; - - if (dim >= lbounds.size()) - return true; - - if (lbounds[dim] > distance) - return false; - else if (ubounds[dim] < -distance) - return false; - - return true; -} - -bool DependenceVector::canPermute(const std::vector &pi) const { - if (pi.size() != lbounds.size()) - throw std::invalid_argument( - "permute dimensionality do not match dependence space"); - - for (int i = 0; i < pi.size(); i++) { - if (lbounds[pi[i]] > 0) - return true; - else if (lbounds[pi[i]] < 0) - return false; - } - - return true; -} - -std::vector DependenceVector::normalize() const { - std::vector result; - - DependenceVector dv(*this); - for (int i = 0; i < dv.lbounds.size(); i++) { - if (dv.lbounds[i] < 0 && dv.ubounds[i] >= 0) { - omega::coef_t t = dv.ubounds[i]; - dv.ubounds[i] = -1; - result.push_back(dv); - dv.lbounds[i] = 0; - dv.ubounds[i] = t; - } - if (dv.lbounds[i] == 0 && dv.ubounds[i] > 0) { - dv.lbounds[i] = 1; - result.push_back(dv); - dv.lbounds[i] = 0; - dv.ubounds[i] = 0; - } - if (dv.lbounds[i] == 0 && dv.ubounds[i] == 0) - continue; - else - break; - } - - result.push_back(dv); - return result; -} - -std::vector DependenceVector::permute( - const std::vector &pi) const { - if (pi.size() != lbounds.size()) - throw std::invalid_argument( - "permute dimensionality do not match dependence space"); - - const int n = lbounds.size(); - - DependenceVector dv(*this); - for (int i = 0; i < n; i++) { - dv.lbounds[i] = lbounds[pi[i]]; - dv.ubounds[i] = ubounds[pi[i]]; - } - - int violated = 0; - - for (int i = 0; i < n; i++) { - if (dv.lbounds[i] > 0) - break; - else if (dv.lbounds[i] < 0) - violated = 1; - } - - if (((violated == 1) && !quasi) && !is_scalar_dependence) { - throw ir_error("dependence violation"); - - } - - return dv.normalize(); -} - -DependenceVector DependenceVector::reverse() const { - const int n = lbounds.size(); - - DependenceVector dv(*this); - switch (type) { - case DEP_W2R: - dv.type = DEP_R2W; - break; - case DEP_R2W: - dv.type = DEP_W2R; - break; - default: - dv.type = type; - } - - for (int i = 0; i < n; i++) { - dv.lbounds[i] = -ubounds[i]; - dv.ubounds[i] = -lbounds[i]; - } - dv.quasi = true; - - return dv; -} - -// std::vector DependenceVector::matrix(const std::vector > &M) const { -// if (M.size() != lbounds.size()) -// throw std::invalid_argument("(non)unimodular transformation dimensionality does not match dependence space"); - -// const int n = lbounds.size(); -// DependenceVector dv; -// if (sym != NULL) -// dv.sym = sym->clone(); -// else -// dv.sym = NULL; -// dv.type = type; - -// for (int i = 0; i < n; i++) { -// assert(M[i].size() == n+1 || M[i].size() == n); - -// omega::coef_t lb, ub; -// if (M[i].size() == n+1) -// lb = ub = M[i][n]; -// else -// lb = ub = 0; - -// for (int j = 0; j < n; j++) { -// int c = M[i][j]; -// if (c == 0) -// continue; - -// if (c > 0) { -// if (lbounds[j] == -posInfinity) -// lb = -posInfinity; -// else if (lb != -posInfinity) -// lb += c * lbounds[j]; -// if (ubounds[j] == posInfinity) -// ub = posInfinity; -// else if (ub != posInfinity) -// ub += c * ubounds[j]; -// } -// else { -// if (ubounds[j] == posInfinity) -// lb = -posInfinity; -// else if (lb != -posInfinity) -// lb += c * ubounds[j]; -// if (lbounds[j] == -posInfinity) -// ub = posInfinity; -// else if (ub != posInfinity) -// ub += c * lbounds[j]; -// } -// } -// dv.lbounds.push_back(lb); -// dv.ubounds.push_back(ub); -// } -// dv.is_reduction = is_reduction; - -// return dv.normalize(); -// } - -//----------------------------------------------------------------------------- -// Class: DependenceGraph -//----------------------------------------------------------------------------- - -DependenceGraph DependenceGraph::permute(const std::vector &pi, - const std::set &active) const { - DependenceGraph g; - - for (int i = 0; i < vertex.size(); i++) - g.insert(vertex[i].first); - - for (int i = 0; i < vertex.size(); i++) - for (EdgeList::const_iterator j = vertex[i].second.begin(); - j != vertex[i].second.end(); j++) { - if (active.empty() - || (active.find(i) != active.end() - && active.find(j->first) != active.end())) { - for (int k = 0; k < j->second.size(); k++) { - std::vector dv = j->second[k].permute(pi); - g.connect(i, j->first, dv); - } - } else if (active.find(i) == active.end() - && active.find(j->first) == active.end()) { - std::vector dv = j->second; - g.connect(i, j->first, dv); - } else { - std::vector dv = j->second; - for (int k = 0; k < dv.size(); k++) - for (int d = 0; d < pi.size(); d++) - if (pi[d] != d) { - dv[k].lbounds[d] = -posInfinity; - dv[k].ubounds[d] = posInfinity; - } - g.connect(i, j->first, dv); - } - } - - return g; -} - -// DependenceGraph DependenceGraph::matrix(const std::vector > &M) const { -// DependenceGraph g; - -// for (int i = 0; i < vertex.size(); i++) -// g.insert(vertex[i].first); - -// for (int i = 0; i < vertex.size(); i++) -// for (EdgeList::const_iterator j = vertex[i].second.begin(); j != vertex[i].second.end(); j++) -// for (int k = 0; k < j->second.size(); k++) -// g.connect(i, j->first, j->second[k].matrix(M)); - -// return g; -// } - -DependenceGraph DependenceGraph::subspace(int dim) const { - DependenceGraph g; - - for (int i = 0; i < vertex.size(); i++) - g.insert(vertex[i].first); - - for (int i = 0; i < vertex.size(); i++) - for (EdgeList::const_iterator j = vertex[i].second.begin(); - j != vertex[i].second.end(); j++) - - for (int k = 0; k < j->second.size(); k++) { - if(j->second[k].type != DEP_CONTROL){ - if (j->second[k].isCarried(dim)) - g.connect(i, j->first, j->second[k]); - }else - g.connect(i, j->first, j->second[k]); - - } - - return g; -} - -bool DependenceGraph::isPositive() const { - for (int i = 0; i < vertex.size(); i++) - for (EdgeList::const_iterator j = vertex[i].second.begin(); - j != vertex[i].second.end(); j++) - for (int k = 0; k < j->second.size(); k++) - if (!j->second[k].isPositive()) - return false; - - return true; -} - -bool DependenceGraph::hasPositive(int dim) const { - for (int i = 0; i < vertex.size(); i++) - for (EdgeList::const_iterator j = vertex[i].second.begin(); - j != vertex[i].second.end(); j++) - for (int k = 0; k < j->second.size(); k++) - if (!j->second[k].hasPositive(dim)) - return false; - - return true; -} - -bool DependenceGraph::hasNegative(int dim) const { - for (int i = 0; i < vertex.size(); i++) - for (EdgeList::const_iterator j = vertex[i].second.begin(); - j != vertex[i].second.end(); j++) - for (int k = 0; k < j->second.size(); k++) - if (!j->second[k].hasNegative(dim)) - return false; - - return true; -} diff --git a/dep.hh b/dep.hh deleted file mode 100644 index 1fa1280..0000000 --- a/dep.hh +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef DEP_HH -#define DEP_HH - -#include -#include "graph.hh" -#include "ir_code.hh" -#include "chill_error.hh" - -enum DependenceType { DEP_W2R, DEP_R2W, DEP_W2W, DEP_R2R, DEP_CONTROL, DEP_UNKNOWN }; - -class DependenceVector; -typedef std::vector DependenceList; - -struct DependenceVector { - DependenceType type; - IR_Symbol *sym; - - bool is_reduction; // used to identify a class of flow dependence - // that can be broken - std::vector lbounds; - std::vector ubounds; - - bool quasi; - bool is_scalar_dependence; - DependenceVector() { - type = DEP_UNKNOWN; - sym = NULL; - is_reduction = false; - quasi = false; - is_scalar_dependence = false; - } - // DependenceVector(int size); - DependenceVector(const DependenceVector &that); - ~DependenceVector() {delete sym;} - DependenceVector &operator=(const DependenceVector &that); - - bool is_data_dependence() const; - bool is_control_dependence() const; - bool has_negative_been_carried_at(int dim) const; - bool has_been_carried_at(int dim) const; - bool has_been_carried_before(int dim) const; - - // the following functions will be cleaned up or removed later - bool isZero() const; - bool isPositive() const; - bool isNegative() const; - bool isAllPositive() const; - bool isAllNegative() const; - bool isZero(int dim) const; - bool hasPositive(int dim) const; - bool hasNegative(int dim) const; - bool isCarried(int dim, omega::coef_t distance = posInfinity) const; - bool canPermute(const std::vector &pi) const; - - std::vector normalize() const; - std::vector permute(const std::vector &pi) const; - DependenceVector reverse() const; - // std::vector matrix(const std::vector > &M) const; - DependenceType getType() const; - friend std::ostream& operator<<(std::ostream &os, const DependenceVector &d); -}; - - - -class DependenceGraph: public Graph { - -protected: - int num_dim_; - -public: - DependenceGraph(int n) { num_dim_ = n; } - DependenceGraph() { num_dim_ = 0; } - ~DependenceGraph() {} - int num_dim() const { return num_dim_; } -// DependenceGraph permute(const std::vector &pi) const; - DependenceGraph permute(const std::vector &pi, - const std::set &active = std::set()) const; - // DependenceGraph matrix(const std::vector > &M) const; - DependenceGraph subspace(int dim) const; - bool isPositive() const; - bool hasPositive(int dim) const; - bool hasNegative(int dim) const; -}; - -#endif diff --git a/depcomp b/depcomp deleted file mode 100755 index 04701da..0000000 --- a/depcomp +++ /dev/null @@ -1,530 +0,0 @@ -#! /bin/sh -# depcomp - compile a program generating dependencies as side-effects - -scriptversion=2005-07-09.11 - -# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Alexandre Oliva . - -case $1 in - '') - echo "$0: No command. Try \`$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: depcomp [--help] [--version] PROGRAM [ARGS] - -Run PROGRAMS ARGS to compile a file, generating dependencies -as side-effects. - -Environment variables: - depmode Dependency tracking mode. - source Source file read by `PROGRAMS ARGS'. - object Object file output by `PROGRAMS ARGS'. - DEPDIR directory where to store dependencies. - depfile Dependency file to output. - tmpdepfile Temporary file to use when outputing dependencies. - libtool Whether libtool is used (yes/no). - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "depcomp $scriptversion" - exit $? - ;; -esac - -if test -z "$depmode" || test -z "$source" || test -z "$object"; then - echo "depcomp: Variables source, object and depmode must be set" 1>&2 - exit 1 -fi - -# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. -depfile=${depfile-`echo "$object" | - sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} -tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} - -rm -f "$tmpdepfile" - -# Some modes work just like other modes, but use different flags. We -# parameterize here, but still list the modes in the big case below, -# to make depend.m4 easier to write. Note that we *cannot* use a case -# here, because this file can only contain one case statement. -if test "$depmode" = hp; then - # HP compiler uses -M and no extra arg. - gccflag=-M - depmode=gcc -fi - -if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout -fi - -case "$depmode" in -gcc3) -## gcc 3 implements dependency tracking that does exactly what -## we want. Yay! Note: for some reason libtool 1.4 doesn't like -## it if -MD -MP comes after the -MF stuff. Hmm. - "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - mv "$tmpdepfile" "$depfile" - ;; - -gcc) -## There are various ways to get dependency output from gcc. Here's -## why we pick this rather obscure method: -## - Don't want to use -MD because we'd like the dependencies to end -## up in a subdir. Having to rename by hand is ugly. -## (We might end up doing this anyway to support other compilers.) -## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). -## - Using -M directly means running the compiler twice (even worse -## than renaming). - if test -z "$gccflag"; then - gccflag=-MD, - fi - "$@" -Wp,"$gccflag$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz -## The second -e expression handles DOS-style file names with drive letters. - sed -e 's/^[^:]*: / /' \ - -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the `deleted header file' problem. -## The problem is that when a header file which appears in a .P file -## is deleted, the dependency causes make to die (because there is -## typically no way to rebuild the header). We avoid this by adding -## dummy dependencies for each header file. Too bad gcc doesn't do -## this for us directly. - tr ' ' ' -' < "$tmpdepfile" | -## Some versions of gcc put a space before the `:'. On the theory -## that the space means something, we add a space to the output as -## well. -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -sgi) - if test "$libtool" = yes; then - "$@" "-Wp,-MDupdate,$tmpdepfile" - else - "$@" -MDupdate "$tmpdepfile" - fi - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - - if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files - echo "$object : \\" > "$depfile" - - # Clip off the initial element (the dependent). Don't try to be - # clever and replace this with sed code, as IRIX sed won't handle - # lines with more than a fixed number of characters (4096 in - # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; - # the IRIX cc adds comments like `#:fec' to the end of the - # dependency line. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ - tr ' -' ' ' >> $depfile - echo >> $depfile - - # The second pass generates a dummy entry for each header file. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> $depfile - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -aix) - # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. In older versions, this file always lives in the - # current directory. Also, the AIX compiler puts `$object:' at the - # start of each line; $object doesn't have directory information. - # Version 6 uses the directory in both cases. - stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` - tmpdepfile="$stripped.u" - if test "$libtool" = yes; then - "$@" -Wc,-M - else - "$@" -M - fi - stat=$? - - if test -f "$tmpdepfile"; then : - else - stripped=`echo "$stripped" | sed 's,^.*/,,'` - tmpdepfile="$stripped.u" - fi - - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - - if test -f "$tmpdepfile"; then - outname="$stripped.o" - # Each line is of the form `foo.o: dependent.h'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" - sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -icc) - # Intel's C compiler understands `-MD -MF file'. However on - # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c - # ICC 7.0 will fill foo.d with something like - # foo.o: sub/foo.c - # foo.o: sub/foo.h - # which is wrong. We want: - # sub/foo.o: sub/foo.c - # sub/foo.o: sub/foo.h - # sub/foo.c: - # sub/foo.h: - # ICC 7.1 will output - # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using \ : - # foo.o: sub/foo.c ... \ - # sub/foo.h ... \ - # ... - - "$@" -MD -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each line is of the form `foo.o: dependent.h', - # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | - sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -tru64) - # The Tru64 compiler uses -MD to generate dependencies as a side - # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in `foo.d' instead, so we check for that too. - # Subdirectories are respected. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - - if test "$libtool" = yes; then - # With Tru64 cc, shared objects can also be used to make a - # static library. This mecanism is used in libtool 1.4 series to - # handle both shared and static libraries in a single compilation. - # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. - # - # With libtool 1.5 this exception was removed, and libtool now - # generates 2 separate objects for the 2 libraries. These two - # compilations output dependencies in in $dir.libs/$base.o.d and - # in $dir$base.o.d. We have to check for both files, because - # one of the two compilations can be disabled. We should prefer - # $dir$base.o.d over $dir.libs/$base.o.d because the latter is - # automatically cleaned when .libs/ is deleted, while ignoring - # the former would cause a distcleancheck panic. - tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 - tmpdepfile2=$dir$base.o.d # libtool 1.5 - tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 - tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 - "$@" -Wc,-MD - else - tmpdepfile1=$dir$base.o.d - tmpdepfile2=$dir$base.d - tmpdepfile3=$dir$base.d - tmpdepfile4=$dir$base.d - "$@" -MD - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a tab and a space in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -#nosideeffect) - # This comment above is used by automake to tell side-effect - # dependency tracking mechanisms from slower ones. - -dashmstdout) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - test -z "$dashmflag" && dashmflag=-M - # Require at least two characters before searching for `:' - # in the target name. This is to cope with DOS-style filenames: - # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. - "$@" $dashmflag | - sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - tr ' ' ' -' < "$tmpdepfile" | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -dashXmstdout) - # This case only exists to satisfy depend.m4. It is never actually - # run, as this mode is specially recognized in the preamble. - exit 1 - ;; - -makedepend) - "$@" || exit $? - # Remove any Libtool call - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - # X makedepend - shift - cleared=no - for arg in "$@"; do - case $cleared in - no) - set ""; shift - cleared=yes ;; - esac - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift ;; - # Strip any option that makedepend may not understand. Remove - # the object too, otherwise makedepend will parse it as a source file. - -*|$object) - ;; - *) - set fnord "$@" "$arg"; shift ;; - esac - done - obj_suffix="`echo $object | sed 's/^.*\././'`" - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - sed '1,2d' "$tmpdepfile" | tr ' ' ' -' | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" "$tmpdepfile".bak - ;; - -cpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - "$@" -E | - sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | - sed '$ s: \\$::' > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - cat < "$tmpdepfile" >> "$depfile" - sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvisualcpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - "$@" || exit $? - IFS=" " - for arg - do - case "$arg" in - "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") - set fnord "$@" - shift - shift - ;; - *) - set fnord "$@" "$arg" - shift - shift - ;; - esac - done - "$@" -E | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" - echo " " >> "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -none) - exec "$@" - ;; - -*) - echo "Unknown depmode $depmode" 1>&2 - exit 1 - ;; -esac - -exit 0 - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/graph.hh b/graph.hh deleted file mode 100644 index f8471df..0000000 --- a/graph.hh +++ /dev/null @@ -1,319 +0,0 @@ -/***************************************************************************** - Copyright (C) 2008 University of Southern California - Copyright (C) 2010 University of Utah - All Rights Reserved. - - Purpose: - Graph template class supports topological sort - with return result observing strongly connected component. - - Notes: - The result of topologically sorting a graph V={1,2,3,4} and E={1->2, 1->3, - 2->3, 3->2, 3->4} is ({1}, {2,3}, {4}). - - History: - 01/2006 Created by Chun Chen. - 07/2010 add a new topological order, -chun -*****************************************************************************/ - -#ifndef GRAPH_HH -#define GRAPH_HH - -#include -#include -#include -#include -#include -#include -#include - -struct Empty { - Empty() {}; - bool operator<(const Empty &) const { return true; }; - bool operator==(const Empty &) const { return false; }; - friend std::ostream& operator<<(std::ostream &os, const Empty &) { return os; }; -}; - -namespace { - enum GraphColorType {WHITE, GREY, BLACK}; -} - -template struct Graph; -template std::ostream& operator<<(std::ostream &os, const Graph &g); - -template -struct Graph { - typedef std::map > EdgeList; - typedef std::vector > VertexList; - - VertexList vertex; - bool directed; - - Graph(bool directed = true); - - int vertexCount() const; - int edgeCount() const; - bool isEmpty() const; - bool isDirected() const; - int insert(const VertexType &v = VertexType()); - void connect(int v1, int v2, const EdgeType &e = EdgeType()); - void connect(int v1, int v2, const std::vector &e); - void disconnect(int v1, int v2); - bool hasEdge(int v1, int v2) const; - std::vector getEdge(int v1, int v2) const; - - std::vector > topoSort() const; - std::vector > packed_topoSort() const; - - void dump() { - std::cout << *this; - } - - friend std::ostream& operator<< <>(std::ostream &os, const Graph &g); -}; - -template -std::ostream& operator<<(std::ostream &os, const Graph &g) { - for (int i = 0; i < g.vertex.size(); i++) - for (typename Graph::EdgeList::const_iterator j = g.vertex[i].second.begin(); j != g.vertex[i].second.end(); j++) { - // os << i+1 << "->" << j->first+1 << ":"; - os << "s" << i << "->" << "s" << j->first << ":"; - for (typename std::vector::const_iterator k = j->second.begin(); k != j->second.end(); k++) - os << " " << *k; - os << std::endl; - } - - return os; -} - - -template -Graph::Graph(bool directed_): - directed(directed_) { -} - -template -int Graph::vertexCount() const { - return vertex.size(); -} - -template -int Graph::edgeCount() const { - int result = 0; - - for (int i = 0; i < vertex.size(); i++) - for (typename EdgeList::const_iterator j = vertex[i].second.begin(); j != vertex[i].second.end(); j++) - result += j->second.size(); - - if (!directed) - result = result/2; - - return result; -} - -template -bool Graph::isEmpty() const { - return vertex.size() == 0; -} - -template -bool Graph::isDirected() const { - return directed; -} - -template -int Graph::insert(const VertexType & v) { - for (int i = 0; i < vertex.size(); i++) - if (vertex[i].first == v) - return i; - - vertex.push_back(std::make_pair(v, EdgeList())); - return vertex.size() - 1; -} - - -template -void Graph::connect(int v1, int v2, const EdgeType &e) { - assert(v1 < vertex.size() && v2 < vertex.size()); - - vertex[v1].second[v2].push_back(e);; - if (!directed) - vertex[v2].second[v1].push_back(e); -} - -template -void Graph::connect(int v1, int v2, const std::vector &e) { - assert(v1 < vertex.size() && v2 < vertex.size()); - - if (e.size() == 0) - return; - - copy(e.begin(), e.end(), back_inserter(vertex[v1].second[v2])); - if (!directed) - copy(e.begin(), e.end(), back_inserter(vertex[v2].second[v1])); -} - -template -void Graph::disconnect(int v1, int v2) { - assert(v1 < vertex.size() && v2 < vertex.size()); - - vertex[v1].second.erase(v2); - if (!directed) - vertex[v2].second.erase(v1); -} - -template -bool Graph::hasEdge(int v1, int v2) const { - return vertex[v1].second.find(v2) != vertex[v1].second.end(); -} - -template -std::vector Graph::getEdge(int v1, int v2) const { - if (!hasEdge(v1, v2)) - return std::vector(); - - return vertex[v1].second.find(v2)->second; -} - -// This topological sort does handle SCC in graph. -template -std::vector > Graph::topoSort() const { - const int n = vertex.size(); - std::vector color(n, WHITE); - std::stack S; - - std::vector order(n); - int c = n; - - // first DFS - for (int i = n-1; i >= 0; i--) - if (color[i] == WHITE) { - S.push(i); - while (!S.empty()) { - int v = S.top(); - - if (color[v] == WHITE) { - for (typename EdgeList::const_iterator j = vertex[v].second.begin(); j != vertex[v].second.end(); j++) - if (color[j->first] == WHITE) - S.push(j->first); - - color[v] = GREY; - } - else if (color[v] == GREY) { - color[v] = BLACK; - S.pop(); - order[--c] = v; - } - else { - S.pop(); - } - } - } - - // transpose edge - std::vector > edgeT(n); - for (int i = 0; i < n; i++) - for (typename EdgeList::const_iterator j = vertex[i].second.begin(); j != vertex[i].second.end(); j++) - edgeT[j->first].insert(i); - - // second DFS in transposed graph starting from last finished vertex - fill(color.begin(), color.end(), WHITE); - std::vector > result; - for (int i = 0; i < n; i++) - if (color[order[i]] == WHITE) { - std::set s; - - S.push(order[i]); - while (!S.empty()) { - int v = S.top(); - - if(color[v] == WHITE) { - for (std::set::const_iterator j = edgeT[v].begin(); j != edgeT[v].end(); j++) - if (color[*j] == WHITE) - S.push(*j); - - color[v] = GREY; - } - else if (color[v] == GREY) { - color[v] = BLACK; - S.pop(); - s.insert(v); - } - else { - S.pop(); - } - } - - result.push_back(s); - } - - return result; -} - -// This topological sort does not handle SCC in graph. -template -std::vector > Graph::packed_topoSort() const { - const int n = vertex.size(); - std::vector color(n, WHITE); - std::stack S; - - std::vector is_root(n, false); - std::vector > edges(n); - - // first DFS - for (int i = n-1; i >= 0; i--) - if (color[i] == WHITE) { - S.push(i); - is_root[i] = true; - while (!S.empty()) { - int v = S.top(); - - if (color[v] == WHITE) { - for (typename EdgeList::const_iterator j = vertex[v].second.begin(); j != vertex[v].second.end(); j++) - if (color[j->first] == WHITE) { - S.push(j->first); - edges[v].insert(j->first); - } - else if (color[j->first] == BLACK) { - if (is_root[j->first]) { - is_root[j->first] = false; - edges[v].insert(j->first); - } - } - - color[v] = GREY; - } - else if (color[v] == GREY) { - color[v] = BLACK; - S.pop(); - } - else { - S.pop(); - } - } - } - - - // second BFS in DFS tree starting from roots - std::vector > result; - std::set s; - for (int i = 0; i < n; i++) - if (is_root[i]) - s.insert(i); - if (s.size() != 0) { - result.push_back(s); - while (true) { - std::set s; - for (std::set::iterator i = result[result.size()-1].begin(); i != result[result.size()-1].end(); i++) - s.insert(edges[*i].begin(), edges[*i].end()); - if (s.size() != 0) - result.push_back(s); - else - break; - } - } - - return result; -} - -#endif diff --git a/include/chill_error.hh b/include/chill_error.hh deleted file mode 120000 index 8736730..0000000 --- a/include/chill_error.hh +++ /dev/null @@ -1 +0,0 @@ -../chill_error.hh \ No newline at end of file diff --git a/include/config.h.in b/include/config.h.in deleted file mode 100644 index 77e32da..0000000 --- a/include/config.h.in +++ /dev/null @@ -1,32 +0,0 @@ -/* include/config.h.in. Generated from configure.ac by autoheader. */ - -/* Use ROSE */ -#undef BUILD_ROSE - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Version number of package */ -#undef VERSION - -/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a - `char[]'. */ -#undef YYTEXT_POINTER diff --git a/include/dep.hh b/include/dep.hh deleted file mode 120000 index d94d7e1..0000000 --- a/include/dep.hh +++ /dev/null @@ -1 +0,0 @@ -../dep.hh \ No newline at end of file diff --git a/include/graph.hh b/include/graph.hh deleted file mode 120000 index 897a234..0000000 --- a/include/graph.hh +++ /dev/null @@ -1 +0,0 @@ -../graph.hh \ No newline at end of file diff --git a/include/ir_code.hh b/include/ir_code.hh deleted file mode 120000 index 163a87a..0000000 --- a/include/ir_code.hh +++ /dev/null @@ -1 +0,0 @@ -../ir_code.hh \ No newline at end of file diff --git a/include/loop.hh b/include/loop.hh deleted file mode 120000 index ec3c3ab..0000000 --- a/include/loop.hh +++ /dev/null @@ -1 +0,0 @@ -../loop.hh \ No newline at end of file diff --git a/include/omegatools.hh b/include/omegatools.hh deleted file mode 120000 index 081318d..0000000 --- a/include/omegatools.hh +++ /dev/null @@ -1 +0,0 @@ -../omegatools.hh \ No newline at end of file diff --git a/install-sh b/install-sh deleted file mode 100755 index 4d4a951..0000000 --- a/install-sh +++ /dev/null @@ -1,323 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2005-05-14.22 - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -chmodcmd="$chmodprog 0755" -chowncmd= -chgrpcmd= -stripcmd= -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src= -dst= -dir_arg= -dstarg= -no_target_directory= - -usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: --c (ignored) --d create directories instead of installing files. --g GROUP $chgrpprog installed files to GROUP. --m MODE $chmodprog installed files to MODE. --o USER $chownprog installed files to USER. --s $stripprog installed files. --t DIRECTORY install into DIRECTORY. --T report an error if DSTFILE is a directory. ---help display this help and exit. ---version display version info and exit. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG -" - -while test -n "$1"; do - case $1 in - -c) shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - --help) echo "$usage"; exit $?;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -s) stripcmd=$stripprog - shift - continue;; - - -t) dstarg=$2 - shift - shift - continue;; - - -T) no_target_directory=true - shift - continue;; - - --version) echo "$0 $scriptversion"; exit $?;; - - *) # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - test -n "$dir_arg$dstarg" && break - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dstarg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dstarg" - shift # fnord - fi - shift # arg - dstarg=$arg - done - break;; - esac -done - -if test -z "$1"; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src ;; - esac - - if test -n "$dir_arg"; then - dst=$src - src= - - if test -d "$dst"; then - mkdircmd=: - chmodcmd= - else - mkdircmd=$mkdirprog - fi - else - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dstarg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dstarg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst ;; - esac - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dstarg: Is a directory" >&2 - exit 1 - fi - dst=$dst/`basename "$src"` - fi - fi - - # This sed command emulates the dirname command. - dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` - - # Make sure that the destination directory exists. - - # Skip lots of stat calls in the usual case. - if test ! -d "$dstdir"; then - defaultIFS=' - ' - IFS="${IFS-$defaultIFS}" - - oIFS=$IFS - # Some sh's can't handle IFS=/ for some reason. - IFS='%' - set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` - shift - IFS=$oIFS - - pathcomp= - - while test $# -ne 0 ; do - pathcomp=$pathcomp$1 - shift - if test ! -d "$pathcomp"; then - $mkdirprog "$pathcomp" - # mkdir can fail with a `File exist' error in case several - # install-sh are creating the directory concurrently. This - # is OK. - test -d "$pathcomp" || exit - fi - pathcomp=$pathcomp/ - done - fi - - if test -n "$dir_arg"; then - $doit $mkdircmd "$dst" \ - && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } - - else - dstfile=`basename "$dst"` - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - trap '(exit $?); exit' 1 2 13 15 - - # Copy the file name to the temp name. - $doit $cpprog "$src" "$dsttmp" && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && - - # Now rename the file to the real destination. - { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ - || { - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - if test -f "$dstdir/$dstfile"; then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ - || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ - || { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit 1 - } - else - : - fi - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - } - } - fi || { (exit 1); exit 1; } -done - -# The final little trick to "correctly" pass the exit status to the exit trap. -{ - (exit 0); exit 0 -} - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/ir_code.hh b/ir_code.hh deleted file mode 100644 index 1f853fa..0000000 --- a/ir_code.hh +++ /dev/null @@ -1,263 +0,0 @@ -/***************************************************************************** - Copyright (C) 2009-2010 University of Utah - All Rights Reserved. - - Purpose: - CHiLL's compiler intermediate representation interface that extends - Omega's builder interface to accomodate compiler analyses and - extra code generation. -. - Notes: - Unlike CG_outputRepr, IR_Symbol,IR_Ref and IR_Control are place holders - to the underlying code, thus deleting or duplicating them does not affect - the actual code. Similar to Omega builder's memory allocation strategy, - all non-const pointer parameters of CG_outputRepr/IR_Symbol/IR_Ref/IR_Control - are destroyed after the call. - - History: - 02/2009 Created by Chun Chen. - 06/2010 Add IR_Control interface, by chun. -*****************************************************************************/ - -#ifndef IR_CODE_HH -#define IR_CODE_HH - -#include -#include -#include - -enum IR_OPERATION_TYPE {IR_OP_CONSTANT, IR_OP_VARIABLE, - IR_OP_PLUS, IR_OP_MINUS, IR_OP_MULTIPLY, IR_OP_DIVIDE, - IR_OP_POSITIVE, IR_OP_NEGATIVE, - IR_OP_MIN, IR_OP_MAX, - IR_OP_ASSIGNMENT, - IR_OP_NULL, IR_OP_UNKNOWN}; -enum IR_CONTROL_TYPE {IR_CONTROL_LOOP, IR_CONTROL_IF, IR_CONTROL_WHILE, IR_CONTROL_BLOCK}; -enum IR_CONSTANT_TYPE {IR_CONSTANT_INT, IR_CONSTANT_FLOAT, - IR_CONSTANT_UNKNOWN}; -enum IR_CONDITION_TYPE {IR_COND_LT, IR_COND_LE, - IR_COND_GT, IR_COND_GE, - IR_COND_EQ, IR_COND_NE, - IR_COND_UNKNOWN}; -enum IR_ARRAY_LAYOUT_TYPE {IR_ARRAY_LAYOUT_ROW_MAJOR, - IR_ARRAY_LAYOUT_COLUMN_MAJOR, - IR_ARRAY_LAYOUT_SPACE_FILLING}; - -class IR_Code; - - -// Base abstract class for scalar and array symbols. This is a place -// holder for related declaration in IR code. -struct IR_Symbol { - const IR_Code *ir_; - - virtual ~IR_Symbol() {/* ir_ is not the responsibility of this object */} - virtual int n_dim() const = 0; - virtual std::string name() const = 0; - virtual bool operator==(const IR_Symbol &that) const = 0; - virtual bool operator!=(const IR_Symbol &that) const {return !(*this == that);} - virtual IR_Symbol *clone() const = 0; /* shallow copy */ -}; - - -struct IR_ScalarSymbol: public IR_Symbol { - virtual ~IR_ScalarSymbol() {} - int n_dim() const {return 0;} - virtual int size() const = 0; -}; - - -struct IR_ArraySymbol: public IR_Symbol { - virtual ~IR_ArraySymbol() {} - virtual int elem_size() const = 0; - virtual omega::CG_outputRepr *size(int dim) const = 0; - virtual IR_ARRAY_LAYOUT_TYPE layout_type() const = 0; -}; - - -// Base abstract class for scalar and array references. This is a -// place holder for related code in IR code. -struct IR_Ref { - const IR_Code *ir_; - - virtual ~IR_Ref() {/* ir_ is not the responsibility of this object */} - virtual int n_dim() const = 0; - virtual bool is_write() const = 0; - virtual std::string name() const = 0; - virtual bool operator==(const IR_Ref &that) const = 0; - virtual bool operator!=(const IR_Ref &that) const {return !(*this == that);} - virtual omega::CG_outputRepr *convert() = 0; - virtual IR_Ref *clone() const = 0; /* shallow copy */ -}; - - -struct IR_ConstantRef: public IR_Ref { - IR_CONSTANT_TYPE type_; - - virtual ~IR_ConstantRef() {} - int n_dim() const {return 0;} - bool is_write() const {return false;} - std::string name() const {return std::string();} - virtual bool is_integer() const {return type_ == IR_CONSTANT_INT;} - virtual omega::coef_t integer() const = 0; -}; - - -struct IR_ScalarRef: public IR_Ref { - virtual ~IR_ScalarRef() {} - int n_dim() const {return 0;} - virtual IR_ScalarSymbol *symbol() const = 0; - std::string name() const { - IR_ScalarSymbol *sym = symbol(); - std::string s = sym->name(); - delete sym; - return s; - } - virtual int size() const { - IR_ScalarSymbol *sym = symbol(); - int s = sym->size(); - delete sym; - return s; - } -}; - - -struct IR_ArrayRef: public IR_Ref { - virtual ~IR_ArrayRef() {} - int n_dim() const { - IR_ArraySymbol *sym = symbol(); - int n = sym->n_dim(); - delete sym; - return n; - } - virtual omega::CG_outputRepr *index(int dim) const = 0; - virtual IR_ArraySymbol *symbol() const = 0; - std::string name() const { - IR_ArraySymbol *sym = symbol(); - std::string s = sym->name(); - delete sym; - return s; - } - virtual int elem_size() const { - IR_ArraySymbol *sym = symbol(); - int s = sym->elem_size(); - delete sym; - return s; - } - virtual IR_ARRAY_LAYOUT_TYPE layout_type() const { - IR_ArraySymbol *sym = symbol(); - IR_ARRAY_LAYOUT_TYPE t = sym->layout_type(); - delete sym; - return t; - } -}; - - -struct IR_Block; - -// Base abstract class for code structures. This is a place holder -// for the actual structure in the IR code. However, in cases that -// original source code may be transformed during loop initialization -// such as converting a while loop to a for loop or reconstructing the -// loop from low level IR code, the helper loop class (NOT -// IMPLEMENTED) must contain the transformed code that needs to be -// freed when out of service. -struct IR_Control { - const IR_Code *ir_; - - virtual ~IR_Control() {/* ir_ is not the responsibility of this object */} - virtual IR_CONTROL_TYPE type() const = 0; - virtual IR_Block *convert() = 0; - virtual IR_Control *clone() const = 0; /* shallow copy */ -}; - - -struct IR_Loop: public IR_Control { - virtual ~IR_Loop() {} - virtual IR_ScalarSymbol *index() const = 0; - virtual omega::CG_outputRepr *lower_bound() const = 0; - virtual omega::CG_outputRepr *upper_bound() const = 0; - virtual IR_CONDITION_TYPE stop_cond() const = 0; - virtual IR_Block *body() const = 0; - virtual int step_size() const = 0; - IR_CONTROL_TYPE type() const { return IR_CONTROL_LOOP; } -}; - - -struct IR_Block: public IR_Control { - virtual ~IR_Block() {} - virtual omega::CG_outputRepr *extract() const = 0; - IR_Block *convert() {return this;} - IR_CONTROL_TYPE type() const { return IR_CONTROL_BLOCK; } - virtual omega::CG_outputRepr *original() const = 0; -}; - - -struct IR_If: public IR_Control { - virtual ~IR_If() {} - virtual omega::CG_outputRepr *condition() const = 0; - virtual IR_Block *then_body() const = 0; - virtual IR_Block *else_body() const = 0; - IR_CONTROL_TYPE type() const { return IR_CONTROL_IF; } -}; - - - -struct IR_While: public IR_Control { - // NOT IMPLEMENTED -}; - - -// Abstract class for compiler IR. -class IR_Code { -protected: - omega::CG_outputBuilder *ocg_; - omega::CG_outputRepr *init_code_; - omega::CG_outputRepr *cleanup_code_; - -public: - IR_Code() {ocg_ = NULL; init_code_ = cleanup_code_ = NULL;} - virtual ~IR_Code() { delete ocg_; delete init_code_; delete cleanup_code_; } /* the content of init and cleanup code have already been released in derived classes */ - - // memory_type is for differentiating the location of where the new memory is allocated. - // this is useful for processors with heterogeneous memory hierarchy. - virtual IR_ScalarSymbol *CreateScalarSymbol(const IR_Symbol *sym, int memory_type) = 0; - virtual IR_ArraySymbol *CreateArraySymbol(const IR_Symbol *sym, std::vector &size, int memory_type) = 0; - - virtual IR_ScalarRef *CreateScalarRef(const IR_ScalarSymbol *sym) = 0; - virtual IR_ArrayRef *CreateArrayRef(const IR_ArraySymbol *sym, std::vector &index) = 0; - virtual int ArrayIndexStartAt() {return 0;} - - // Array references should be returned in their accessing order. - // e.g. s1: A[i] = A[i-1] - // s2: B[C[i]] = D[i] + E[i] - // return A[i-1], A[i], D[i], E[i], C[i], B[C[i]] in this order. - virtual std::vector FindArrayRef(const omega::CG_outputRepr *repr) const = 0; - virtual std::vector FindScalarRef(const omega::CG_outputRepr *repr) const = 0; - - // If there is no sub structure interesting inside the block, return empty, - // so we know when to stop looking inside. - virtual std::vector FindOneLevelControlStructure(const IR_Block *block) const = 0; - - // All controls must be in the same block, at the same level and in - // contiguous lexical order as appeared in parameter vector. - virtual IR_Block *MergeNeighboringControlStructures(const std::vector &controls) const = 0; - - virtual IR_Block *GetCode() const = 0; - virtual void ReplaceCode(IR_Control *old, omega::CG_outputRepr *repr) = 0; - virtual void ReplaceExpression(IR_Ref *old, omega::CG_outputRepr *repr) = 0; - - virtual IR_OPERATION_TYPE QueryExpOperation(const omega::CG_outputRepr *repr) const = 0; - virtual IR_CONDITION_TYPE QueryBooleanExpOperation(const omega::CG_outputRepr *repr) const = 0; - virtual std::vector QueryExpOperand(const omega::CG_outputRepr *repr) const = 0; - virtual IR_Ref *Repr2Ref(const omega::CG_outputRepr *repr) const = 0; - - //--------------------------------------------------------------------------- - // CC Omega code builder interface here - //--------------------------------------------------------------------------- - omega::CG_outputBuilder *builder() const {return ocg_;} - -}; - -#endif - diff --git a/ir_rose.cc b/ir_rose.cc deleted file mode 100644 index 5acb175..0000000 --- a/ir_rose.cc +++ /dev/null @@ -1,2296 +0,0 @@ -/***************************************************************************** - Copyright (C) 2009-2010 University of Utah - All Rights Reserved. - - Purpose: - CHiLL's rose interface. - - Notes: - Array supports mixed pointer and array type in a single declaration. - - History: - 02/23/2009 Created by Chun Chen. -*****************************************************************************/ -#include -#include "ir_rose.hh" -#include "ir_rose_utils.hh" -#include -#include -#include - -using namespace SageBuilder; -using namespace SageInterface; -using namespace omega; -// ---------------------------------------------------------------------------- -// Class: IR_roseScalarSymbol -// ---------------------------------------------------------------------------- - -std::string IR_roseScalarSymbol::name() const { - return vs_->get_name().getString(); -} - -int IR_roseScalarSymbol::size() const { - return (vs_->get_type()->memoryUsage()) / (vs_->get_type()->numberOfNodes()); -} - -bool IR_roseScalarSymbol::operator==(const IR_Symbol &that) const { - if (typeid(*this) != typeid(that)) - return false; - - const IR_roseScalarSymbol *l_that = - static_cast(&that); - return this->vs_ == l_that->vs_; -} - -IR_Symbol *IR_roseScalarSymbol::clone() const { - return NULL; -} - -// ---------------------------------------------------------------------------- -// Class: IR_roseArraySymbol -// ---------------------------------------------------------------------------- - -std::string IR_roseArraySymbol::name() const { - return (vs_->get_declaration()->get_name().getString()); -} - -int IR_roseArraySymbol::elem_size() const { - - SgType *tn = vs_->get_type(); - SgType* arrType; - - int elemsize; - - if (arrType = isSgArrayType(tn)) { - while (isSgArrayType(arrType)) { - arrType = arrType->findBaseType(); - } - } else if (arrType = isSgPointerType(tn)) { - while (isSgPointerType(arrType)) { - arrType = arrType->findBaseType(); - } - } - - elemsize = (int) arrType->memoryUsage() / arrType->numberOfNodes(); - return elemsize; -} - -int IR_roseArraySymbol::n_dim() const { - int dim = 0; - SgType* arrType = isSgArrayType(vs_->get_type()); - SgType* ptrType = isSgPointerType(vs_->get_type()); - if (arrType != NULL) { - while (isSgArrayType(arrType)) { - arrType = isSgArrayType(arrType)->get_base_type(); - dim++; - } - } else if (ptrType != NULL) { - while (isSgPointerType(ptrType)) { - ptrType = isSgPointerType(ptrType)->get_base_type(); - dim++; - } - } - - // Manu:: fortran support - if (static_cast(ir_)->is_fortran_) { - - if (arrType != NULL) { - dim = 0; - SgExprListExp * dimList = isSgArrayType(vs_->get_type())->get_dim_info(); - SgExpressionPtrList::iterator it = dimList->get_expressions().begin(); - for(;it != dimList->get_expressions().end(); it++) { - dim++; - } - } else if (ptrType != NULL) { - //std::cout << "pntrType \n"; - ; // not sure if this case will happen - } - } - - return dim; -} - -omega::CG_outputRepr *IR_roseArraySymbol::size(int dim) const { - - SgArrayType* arrType = isSgArrayType(vs_->get_type()); - // SgExprListExp* dimList = arrType->get_dim_info(); - int count = 0; - SgExpression* expr; - SgType* pntrType = isSgPointerType(vs_->get_type()); - - if (arrType != NULL) { - SgExprListExp* dimList = arrType->get_dim_info(); - if (!static_cast(ir_)->is_fortran_) { - SgExpressionPtrList::iterator it = - dimList->get_expressions().begin(); - - while ((it != dimList->get_expressions().end()) && (count < dim)) { - it++; - count++; - } - - expr = *it; - } else { - SgExpressionPtrList::reverse_iterator i = - dimList->get_expressions().rbegin(); - for (; (i != dimList->get_expressions().rend()) && (count < dim); - i++) { - - count++; - } - - expr = *i; - } - } else if (pntrType != NULL) { - - while (count < dim) { - pntrType = (isSgPointerType(pntrType))->get_base_type(); - count++; - } - if (isSgPointerType(pntrType)) - expr = new SgExpression; - } - - if (!expr) - throw ir_error("Index variable is NULL!!"); - - // Manu :: debug - std::cout << "---------- size :: " << isSgNode(expr)->unparseToString().c_str() << "\n"; - - return new omega::CG_roseRepr(expr); - -} - -IR_ARRAY_LAYOUT_TYPE IR_roseArraySymbol::layout_type() const { - if (static_cast(ir_)->is_fortran_) - return IR_ARRAY_LAYOUT_COLUMN_MAJOR; - else - return IR_ARRAY_LAYOUT_ROW_MAJOR; - -} - -bool IR_roseArraySymbol::operator==(const IR_Symbol &that) const { - - if (typeid(*this) != typeid(that)) - return false; - - const IR_roseArraySymbol *l_that = - static_cast(&that); - return this->vs_ == l_that->vs_; - -} - -IR_Symbol *IR_roseArraySymbol::clone() const { - return new IR_roseArraySymbol(ir_, vs_); -} - -// ---------------------------------------------------------------------------- -// Class: IR_roseConstantRef -// ---------------------------------------------------------------------------- - -bool IR_roseConstantRef::operator==(const IR_Ref &that) const { - - if (typeid(*this) != typeid(that)) - return false; - - const IR_roseConstantRef *l_that = - static_cast(&that); - - if (this->type_ != l_that->type_) - return false; - - if (this->type_ == IR_CONSTANT_INT) - return this->i_ == l_that->i_; - else - return this->f_ == l_that->f_; - -} - -omega::CG_outputRepr *IR_roseConstantRef::convert() { - if (type_ == IR_CONSTANT_INT) { - omega::CG_roseRepr *result = new omega::CG_roseRepr( - isSgExpression(buildIntVal(static_cast(i_)))); - delete this; - return result; - } else - throw ir_error("constant type not supported"); - -} - -IR_Ref *IR_roseConstantRef::clone() const { - if (type_ == IR_CONSTANT_INT) - return new IR_roseConstantRef(ir_, i_); - else if (type_ == IR_CONSTANT_FLOAT) - return new IR_roseConstantRef(ir_, f_); - else - throw ir_error("constant type not supported"); - -} - -// ---------------------------------------------------------------------------- -// Class: IR_roseScalarRef -// ---------------------------------------------------------------------------- - -bool IR_roseScalarRef::is_write() const { - /* if (ins_pos_ != NULL && op_pos_ == -1) - return true; - else - return false; - */ - - if (is_write_ == 1) - return true; - - return false; -} - -IR_ScalarSymbol *IR_roseScalarRef::symbol() const { - return new IR_roseScalarSymbol(ir_, vs_->get_symbol()); -} - -bool IR_roseScalarRef::operator==(const IR_Ref &that) const { - if (typeid(*this) != typeid(that)) - return false; - - const IR_roseScalarRef *l_that = - static_cast(&that); - - if (this->ins_pos_ == NULL) - return this->vs_ == l_that->vs_; - else - return this->ins_pos_ == l_that->ins_pos_ - && this->op_pos_ == l_that->op_pos_; -} - -omega::CG_outputRepr *IR_roseScalarRef::convert() { - omega::CG_roseRepr *result = new omega::CG_roseRepr(isSgExpression(vs_)); - delete this; - return result; - -} - -IR_Ref * IR_roseScalarRef::clone() const { - //if (ins_pos_ == NULL) - return new IR_roseScalarRef(ir_, vs_, this->is_write_); - //else - // return new IR_roseScalarRef(ir_, , op_pos_); - -} - -// ---------------------------------------------------------------------------- -// Class: IR_roseArrayRef -// ---------------------------------------------------------------------------- - -bool IR_roseArrayRef::is_write() const { - SgAssignOp* assignment; - - if (is_write_ == 1 || is_write_ == 0) - return is_write_; - if (assignment = isSgAssignOp(ia_->get_parent())) { - if (assignment->get_lhs_operand() == ia_) - return true; - } else if (SgExprStatement* expr_stmt = isSgExprStatement( - ia_->get_parent())) { - SgExpression* exp = expr_stmt->get_expression(); - - if (exp) { - if (assignment = isSgAssignOp(exp)) { - if (assignment->get_lhs_operand() == ia_) - return true; - - } - } - - } - return false; -} - -omega::CG_outputRepr *IR_roseArrayRef::index(int dim) const { - - SgExpression *current = isSgExpression(ia_); - SgExpression* expr; - int count = 0; - - while (isSgPntrArrRefExp(current)) { - current = isSgPntrArrRefExp(current)->get_lhs_operand(); - count++; - } - - current = ia_; - - while (count > dim) { - expr = isSgPntrArrRefExp(current)->get_rhs_operand(); - current = isSgPntrArrRefExp(current)->get_lhs_operand(); - count--; - } - - // Manu:: fortran support - if (static_cast(ir_)->is_fortran_) { - expr = isSgPntrArrRefExp(ia_)->get_rhs_operand(); - count = 0; - if (isSgExprListExp(expr)) { - SgExpressionPtrList::iterator indexList = isSgExprListExp(expr)->get_expressions().begin(); - while (count < dim) { - indexList++; - count++; - } - expr = isSgExpression(*indexList); - } - } - - if (!expr) - throw ir_error("Index variable is NULL!!"); - - - omega::CG_roseRepr* ind = new omega::CG_roseRepr(expr); - - return ind->clone(); - -} - -IR_ArraySymbol *IR_roseArrayRef::symbol() const { - - SgExpression *current = isSgExpression(ia_); - - SgVarRefExp* base; - SgVariableSymbol *arrSymbol; - while (isSgPntrArrRefExp(current) || isSgUnaryOp(current)) { - if (isSgPntrArrRefExp(current)) - current = isSgPntrArrRefExp(current)->get_lhs_operand(); - else if (isSgUnaryOp(current)) - /* To handle support for addressof operator and pointer dereference - * both of which are unary ops - */ - current = isSgUnaryOp(current)->get_operand(); - } - if (base = isSgVarRefExp(current)) { - arrSymbol = (SgVariableSymbol*) (base->get_symbol()); - std::string x = arrSymbol->get_name().getString(); - } else - throw ir_error("Array Symbol is not a variable?!"); - - return new IR_roseArraySymbol(ir_, arrSymbol); - -} - -bool IR_roseArrayRef::operator==(const IR_Ref &that) const { - if (typeid(*this) != typeid(that)) - return false; - - const IR_roseArrayRef *l_that = static_cast(&that); - - return this->ia_ == l_that->ia_; -} - -omega::CG_outputRepr *IR_roseArrayRef::convert() { - omega::CG_roseRepr *temp = new omega::CG_roseRepr( - isSgExpression(this->ia_)); - omega::CG_outputRepr *result = temp->clone(); -// delete this; // Commented by Manu - return result; -} - -IR_Ref *IR_roseArrayRef::clone() const { - return new IR_roseArrayRef(ir_, ia_, is_write_); -} - -// ---------------------------------------------------------------------------- -// Class: IR_roseLoop -// ---------------------------------------------------------------------------- - -IR_ScalarSymbol *IR_roseLoop::index() const { - SgForStatement *tf = isSgForStatement(tf_); - SgFortranDo *tfortran = isSgFortranDo(tf_); - SgVariableSymbol* vs = NULL; - if (tf) { - SgForInitStatement* list = tf->get_for_init_stmt(); - SgStatementPtrList& initStatements = list->get_init_stmt(); - SgStatementPtrList::const_iterator j = initStatements.begin(); - - if (SgExprStatement *expr = isSgExprStatement(*j)) - if (SgAssignOp* op = isSgAssignOp(expr->get_expression())) - if (SgVarRefExp* var_ref = isSgVarRefExp(op->get_lhs_operand())) - vs = var_ref->get_symbol(); - } else if (tfortran) { - SgExpression* init = tfortran->get_initialization(); - - if (SgAssignOp* op = isSgAssignOp(init)) - if (SgVarRefExp* var_ref = isSgVarRefExp(op->get_lhs_operand())) - vs = var_ref->get_symbol(); - - } - - if (vs == NULL) - throw ir_error("Index variable is NULL!!"); - - return new IR_roseScalarSymbol(ir_, vs); -} - -omega::CG_outputRepr *IR_roseLoop::lower_bound() const { - SgForStatement *tf = isSgForStatement(tf_); - SgFortranDo *tfortran = isSgFortranDo(tf_); - - SgExpression* lowerBound = NULL; - - if (tf) { - SgForInitStatement* list = tf->get_for_init_stmt(); - SgStatementPtrList& initStatements = list->get_init_stmt(); - SgStatementPtrList::const_iterator j = initStatements.begin(); - - if (SgExprStatement *expr = isSgExprStatement(*j)) - if (SgAssignOp* op = isSgAssignOp(expr->get_expression())) { - lowerBound = op->get_rhs_operand(); - //Rose sometimes introduces an unnecessary cast which is a unary op - if (isSgUnaryOp(lowerBound)) - lowerBound = isSgUnaryOp(lowerBound)->get_operand(); - - } - } else if (tfortran) { - SgExpression* init = tfortran->get_initialization(); - - if (SgAssignOp* op = isSgAssignOp(init)) - lowerBound = op->get_rhs_operand(); - } - - if (lowerBound == NULL) - throw ir_error("Lower Bound is NULL!!"); - - return new omega::CG_roseRepr(lowerBound); -} - -omega::CG_outputRepr *IR_roseLoop::upper_bound() const { - SgForStatement *tf = isSgForStatement(tf_); - SgFortranDo *tfortran = isSgFortranDo(tf_); - SgExpression* upperBound = NULL; - if (tf) { - SgBinaryOp* test_expr = isSgBinaryOp(tf->get_test_expr()); - if (test_expr == NULL) - throw ir_error("Test Expression is NULL!!"); - - upperBound = test_expr->get_rhs_operand(); - //Rose sometimes introduces an unnecessary cast which is a unary op - if (isSgUnaryOp(upperBound)) - upperBound = isSgUnaryOp(upperBound)->get_operand(); - if (upperBound == NULL) - throw ir_error("Upper Bound is NULL!!"); - } else if (tfortran) { - - upperBound = tfortran->get_bound(); - - } - - return new omega::CG_roseRepr(upperBound); - -} - -IR_CONDITION_TYPE IR_roseLoop::stop_cond() const { - SgForStatement *tf = isSgForStatement(tf_); - SgFortranDo *tfortran = isSgFortranDo(tf_); - - if (tf) { - SgExpression* stopCond = NULL; - SgExpression* test_expr = tf->get_test_expr(); - - if (isSgLessThanOp(test_expr)) - return IR_COND_LT; - else if (isSgLessOrEqualOp(test_expr)) - return IR_COND_LE; - else if (isSgGreaterThanOp(test_expr)) - return IR_COND_GT; - else if (isSgGreaterOrEqualOp(test_expr)) - return IR_COND_GE; - - else - throw ir_error("loop stop condition unsupported"); - } else if (tfortran) { - SgExpression* increment = tfortran->get_increment(); - if (!isSgNullExpression(increment)) { - if (isSgMinusOp(increment) - && !isSgBinaryOp(isSgMinusOp(increment)->get_operand())) - return IR_COND_GE; - else - return IR_COND_LE; - } else { - return IR_COND_LE; // Manu:: if increment is not present, assume it to be 1. Just a workaround, not sure if it will be correct for all cases. - SgExpression* lowerBound = NULL; - SgExpression* upperBound = NULL; - SgExpression* init = tfortran->get_initialization(); - SgIntVal* ub; - SgIntVal* lb; - if (SgAssignOp* op = isSgAssignOp(init)) - lowerBound = op->get_rhs_operand(); - - upperBound = tfortran->get_bound(); - - if ((upperBound != NULL) && (lowerBound != NULL)) { - - if ((ub = isSgIntVal(isSgValueExp(upperBound))) && (lb = - isSgIntVal(isSgValueExp(lowerBound)))) { - if (ub->get_value() > lb->get_value()) - return IR_COND_LE; - else - return IR_COND_GE; - } else - throw ir_error("loop stop condition unsupported"); - - } else - throw ir_error("malformed fortran loop bounds!!"); - - } - } - -} - -IR_Block *IR_roseLoop::body() const { - SgForStatement *tf = isSgForStatement(tf_); - SgFortranDo *tfortran = isSgFortranDo(tf_); - SgNode* loop_body = NULL; - SgStatement* body_statements = NULL; - - if (tf) { - body_statements = tf->get_loop_body(); - } else if (tfortran) { - body_statements = isSgStatement(tfortran->get_body()); - - } - - loop_body = isSgNode(body_statements); - - SgStatementPtrList list; - if (isSgBasicBlock(loop_body)) { - list = isSgBasicBlock(loop_body)->get_statements(); - - if (list.size() == 1) - loop_body = isSgNode(*(list.begin())); - } - - if (loop_body == NULL) - throw ir_error("for loop body is NULL!!"); - - return new IR_roseBlock(ir_, loop_body); -} - -int IR_roseLoop::step_size() const { - - SgForStatement *tf = isSgForStatement(tf_); - SgFortranDo *tfortran = isSgFortranDo(tf_); - - if (tf) { - SgExpression *increment = tf->get_increment(); - - if (isSgPlusPlusOp(increment)) - return 1; - if (isSgMinusMinusOp(increment)) - return -1; - else if (SgAssignOp* assignment = isSgAssignOp(increment)) { - SgBinaryOp* stepsize = isSgBinaryOp(assignment->get_lhs_operand()); - if (stepsize == NULL) - throw ir_error("Step size expression is NULL!!"); - SgIntVal* step = isSgIntVal(stepsize->get_lhs_operand()); - return step->get_value(); - } else if (SgBinaryOp* inc = isSgPlusAssignOp(increment)) { - SgIntVal* step = isSgIntVal(inc->get_rhs_operand()); - return (step->get_value()); - } else if (SgBinaryOp * inc = isSgMinusAssignOp(increment)) { - SgIntVal* step = isSgIntVal(inc->get_rhs_operand()); - return -(step->get_value()); - } else if (SgBinaryOp * inc = isSgCompoundAssignOp(increment)) { - SgIntVal* step = isSgIntVal(inc->get_rhs_operand()); - return (step->get_value()); - } - - } else if (tfortran) { - - SgExpression* increment = tfortran->get_increment(); - - if (!isSgNullExpression(increment)) { - if (isSgMinusOp(increment)) { - if (SgValueExp *inc = isSgValueExp( - isSgMinusOp(increment)->get_operand())) - if (isSgIntVal(inc)) - return -(isSgIntVal(inc)->get_value()); - } else { - if (SgValueExp* inc = isSgValueExp(increment)) - if (isSgIntVal(inc)) - return isSgIntVal(inc)->get_value(); - } - } else { - return 1; // Manu:: if increment is not present, assume it to be 1. Just a workaround, not sure if it will be correct for all cases. - SgExpression* lowerBound = NULL; - SgExpression* upperBound = NULL; - SgExpression* init = tfortran->get_initialization(); - SgIntVal* ub; - SgIntVal* lb; - if (SgAssignOp* op = isSgAssignOp(init)) - lowerBound = op->get_rhs_operand(); - - upperBound = tfortran->get_bound(); - - if ((upperBound != NULL) && (lowerBound != NULL)) { - - if ((ub = isSgIntVal(isSgValueExp(upperBound))) && (lb = - isSgIntVal(isSgValueExp(lowerBound)))) { - if (ub->get_value() > lb->get_value()) - return 1; - else - return -1; - } else - throw ir_error("loop stop condition unsupported"); - - } else - throw ir_error("loop stop condition unsupported"); - - } - - } - -} - -IR_Block *IR_roseLoop::convert() { - const IR_Code *ir = ir_; - SgNode *tnl = isSgNode(tf_); - delete this; - return new IR_roseBlock(ir, tnl); -} - -IR_Control *IR_roseLoop::clone() const { - - return new IR_roseLoop(ir_, tf_); - -} - -// ---------------------------------------------------------------------------- -// Class: IR_roseBlock -// ---------------------------------------------------------------------------- - -omega::CG_outputRepr *IR_roseBlock::original() const { - - omega::CG_outputRepr * tnl; - - if (isSgBasicBlock(tnl_)) { - - SgStatementPtrList *bb = new SgStatementPtrList(); - SgStatementPtrList::iterator it; - for (it = (isSgBasicBlock(tnl_)->get_statements()).begin(); - it != (isSgBasicBlock(tnl_)->get_statements()).end() - && (*it != start_); it++) - ; - - if (it != (isSgBasicBlock(tnl_)->get_statements()).end()) { - for (; it != (isSgBasicBlock(tnl_)->get_statements()).end(); it++) { - bb->push_back(*it); - if ((*it) == end_) - break; - } - } - tnl = new omega::CG_roseRepr(bb); - //block = tnl->clone(); - - } else { - tnl = new omega::CG_roseRepr(tnl_); - - //block = tnl->clone(); - } - - return tnl; - -} -omega::CG_outputRepr *IR_roseBlock::extract() const { - - std::string x = tnl_->unparseToString(); - - omega::CG_roseRepr * tnl; - - omega::CG_outputRepr* block; - - if (isSgBasicBlock(tnl_)) { - - SgStatementPtrList *bb = new SgStatementPtrList(); - SgStatementPtrList::iterator it; - for (it = (isSgBasicBlock(tnl_)->get_statements()).begin(); - it != (isSgBasicBlock(tnl_)->get_statements()).end() - && (*it != start_); it++) - ; - - if (it != (isSgBasicBlock(tnl_)->get_statements()).end()) { - for (; it != (isSgBasicBlock(tnl_)->get_statements()).end(); it++) { - bb->push_back(*it); - if ((*it) == end_) - break; - } - } - tnl = new omega::CG_roseRepr(bb); - block = tnl->clone(); - - } else { - tnl = new omega::CG_roseRepr(tnl_); - - block = tnl->clone(); - } - - delete tnl; - return block; -} - -IR_Control *IR_roseBlock::clone() const { - return new IR_roseBlock(ir_, tnl_, start_, end_); - -} -// ---------------------------------------------------------------------------- -// Class: IR_roseIf -// ---------------------------------------------------------------------------- -omega::CG_outputRepr *IR_roseIf::condition() const { - SgNode *tnl = isSgNode(isSgIfStmt(ti_)->get_conditional()); - SgExpression* exp = NULL; - if (SgExprStatement* stmt = isSgExprStatement(tnl)) - exp = stmt->get_expression(); - /* - SgExpression *op = iter(tnl); - if (iter.is_empty()) - throw ir_error("unrecognized if structure"); - tree_node *tn = iter.step(); - if (!iter.is_empty()) - throw ir_error("unrecognized if structure"); - if (!tn->is_instr()) - throw ir_error("unrecognized if structure"); - instruction *ins = static_cast(tn)->instr(); - if (!ins->opcode() == io_bfalse) - throw ir_error("unrecognized if structure"); - operand op = ins->src_op(0);*/ - if (exp == NULL) - return new omega::CG_roseRepr(tnl); - else - return new omega::CG_roseRepr(exp); -} - -IR_Block *IR_roseIf::then_body() const { - SgNode *tnl = isSgNode(isSgIfStmt(ti_)->get_true_body()); - - //tree_node_list *tnl = ti_->then_part(); - if (tnl == NULL) - return NULL; - /* - tree_node_list_iter iter(tnl); - if (iter.is_empty()) - return NULL; */ - - return new IR_roseBlock(ir_, tnl); -} - -IR_Block *IR_roseIf::else_body() const { - SgNode *tnl = isSgNode(isSgIfStmt(ti_)->get_false_body()); - - //tree_node_list *tnl = ti_->else_part(); - - if (tnl == NULL) - return NULL; - /* - tree_node_list_iter iter(tnl); - if (iter.is_empty()) - return NULL;*/ - - return new IR_roseBlock(ir_, tnl); -} - -IR_Block *IR_roseIf::convert() { - const IR_Code *ir = ir_; - /* SgNode *tnl = ti_->get_parent(); - SgNode *start, *end; - start = end = ti_; - - //tree_node_list *tnl = ti_->parent(); - //tree_node_list_e *start, *end; - //start = end = ti_->list_e(); - */ - delete this; - return new IR_roseBlock(ir, ti_); -} - -IR_Control *IR_roseIf::clone() const { - return new IR_roseIf(ir_, ti_); -} - -// -----------------------------------------------------------y----------------- -// Class: IR_roseCode_Global_Init -// ---------------------------------------------------------------------------- - -IR_roseCode_Global_Init *IR_roseCode_Global_Init::pinstance = 0; - -IR_roseCode_Global_Init * IR_roseCode_Global_Init::Instance(char** argv) { - if (pinstance == 0) { - pinstance = new IR_roseCode_Global_Init; - pinstance->project = frontend(2, argv); - - } - return pinstance; -} - -// ---------------------------------------------------------------------------- -// Class: IR_roseCode -// ---------------------------------------------------------------------------- - -IR_roseCode::IR_roseCode(const char *filename, const char* proc_name) : - IR_Code() { - - SgProject* project; - - char* argv[2]; - int counter = 0; - argv[0] = (char*) malloc(5 * sizeof(char)); - argv[1] = (char*) malloc((strlen(filename) + 1) * sizeof(char)); - strcpy(argv[0], "rose"); - strcpy(argv[1], filename); - - project = (IR_roseCode_Global_Init::Instance(argv))->project; - //main_ssa = new ssa_unfiltered_cfg::SSA_UnfilteredCfg(project); - //main_ssa->run(); - firstScope = getFirstGlobalScope(project); - SgFilePtrList& file_list = project->get_fileList(); - - for (SgFilePtrList::iterator it = file_list.begin(); it != file_list.end(); - it++) { - file = isSgSourceFile(*it); - if (file->get_outputLanguage() == SgFile::e_Fortran_output_language) - is_fortran_ = true; - else - is_fortran_ = false; - - // Manu:: debug - // if (is_fortran_) - // std::cout << "Input is a fortran file\n"; - // else - // std::cout << "Input is a C file\n"; - - root = file->get_globalScope(); - - if (!is_fortran_) { // Manu:: this macro should not be created if the input code is in fortran - buildCpreprocessorDefineDeclaration(root, - "#define __rose_lt(x,y) ((x)<(y)?(x):(y))", - PreprocessingInfo::before); - buildCpreprocessorDefineDeclaration(root, - "#define __rose_gt(x,y) ((x)>(y)?(x):(y))", - PreprocessingInfo::before); - } - - symtab_ = isSgScopeStatement(root)->get_symbol_table(); - SgDeclarationStatementPtrList& declList = root->get_declarations(); - - p = declList.begin(); - - while (p != declList.end()) { - func = isSgFunctionDeclaration(*p); - if (func) { - if (!strcmp((func->get_name().getString()).c_str(), proc_name)) - break; - - } - p++; - counter++; - } - if (p != declList.end()) - break; - - } - - symtab2_ = func->get_definition()->get_symbol_table(); - symtab3_ = func->get_definition()->get_body()->get_symbol_table(); - // ocg_ = new omega::CG_roseBuilder(func->get_definition()->get_body()->get_symbol_table() , isSgNode(func->get_definition()->get_body())); - // Manu:: added is_fortran_ parameter - ocg_ = new omega::CG_roseBuilder(is_fortran_, root, firstScope, - func->get_definition()->get_symbol_table(), - func->get_definition()->get_body()->get_symbol_table(), - isSgNode(func->get_definition()->get_body())); - - i_ = 0; /*i_ handling may need revision */ - - free(argv[1]); - free(argv[0]); - -} - -IR_roseCode::~IR_roseCode() { -} - -void IR_roseCode::finalizeRose() { - // Moved this out of the deconstructor - // ???? - SgProject* project = (IR_roseCode_Global_Init::Instance(NULL))->project; - // -- Causes coredump. commented out for now -- // - // processes attributes left in Rose Ast - //postProcessRoseCodeInsertion(project); - project->unparse(); - //backend((IR_roseCode_Global_Init::Instance(NULL))->project); -} - -IR_ScalarSymbol *IR_roseCode::CreateScalarSymbol(const IR_Symbol *sym, int) { - char str1[14]; - if (typeid(*sym) == typeid(IR_roseScalarSymbol)) { - SgType *tn = - static_cast(sym)->vs_->get_type(); - sprintf(str1, "newVariable%i\0", i_); - SgVariableDeclaration* defn = buildVariableDeclaration(str1, tn); - i_++; - - SgInitializedNamePtrList& variables = defn->get_variables(); - SgInitializedNamePtrList::const_iterator i = variables.begin(); - SgInitializedName* initializedName = *i; - SgVariableSymbol* vs = new SgVariableSymbol(initializedName); - - prependStatement(defn, - isSgScopeStatement(func->get_definition()->get_body())); - vs->set_parent(symtab_); - symtab_->insert(str1, vs); - - if (vs == NULL) - throw ir_error("in CreateScalarSymbol: vs is NULL!!"); - - return new IR_roseScalarSymbol(this, vs); - } else if (typeid(*sym) == typeid(IR_roseArraySymbol)) { - SgType *tn1 = - static_cast(sym)->vs_->get_type(); - while (isSgArrayType(tn1) || isSgPointerType(tn1)) { - if (isSgArrayType(tn1)) - tn1 = isSgArrayType(tn1)->get_base_type(); - else if (isSgPointerType(tn1)) - tn1 = isSgPointerType(tn1)->get_base_type(); - else - throw ir_error( - "in CreateScalarSymbol: symbol not an array nor a pointer!"); - } - - sprintf(str1, "newVariable%i\0", i_); - i_++; - - SgVariableDeclaration* defn1 = buildVariableDeclaration(str1, tn1); - SgInitializedNamePtrList& variables1 = defn1->get_variables(); - - SgInitializedNamePtrList::const_iterator i1 = variables1.begin(); - SgInitializedName* initializedName1 = *i1; - - SgVariableSymbol *vs1 = new SgVariableSymbol(initializedName1); - prependStatement(defn1, - isSgScopeStatement(func->get_definition()->get_body())); - - vs1->set_parent(symtab_); - symtab_->insert(str1, vs1); - - if (vs1 == NULL) - throw ir_error("in CreateScalarSymbol: vs1 is NULL!!"); - - return new IR_roseScalarSymbol(this, vs1); - } else - throw std::bad_typeid(); - -} - -IR_ArraySymbol *IR_roseCode::CreateArraySymbol(const IR_Symbol *sym, - std::vector &size, int) { - SgType *tn; - char str1[14]; - - if (typeid(*sym) == typeid(IR_roseScalarSymbol)) { - tn = static_cast(sym)->vs_->get_type(); - } else if (typeid(*sym) == typeid(IR_roseArraySymbol)) { - tn = static_cast(sym)->vs_->get_type(); - while (isSgArrayType(tn) || isSgPointerType(tn)) { - if (isSgArrayType(tn)) - tn = isSgArrayType(tn)->get_base_type(); - else if (isSgPointerType(tn)) - tn = isSgPointerType(tn)->get_base_type(); - else - throw ir_error( - "in CreateScalarSymbol: symbol not an array nor a pointer!"); - } - } else - throw std::bad_typeid(); - - - // Manu:: Fortran support - std::vectorexprs; - SgExprListExp *exprLstExp; - SgExpression* sizeExpression = new SgNullExpression(); - SgArrayType* arrayType = new SgArrayType(tn,sizeExpression); - sizeExpression->set_parent(arrayType); - - if (!is_fortran_) { - for (int i = size.size() - 1; i >= 0; i--) { - tn = buildArrayType(tn,static_cast(size[i])->GetExpression()); - } - } else { // Manu:: required for fortran support - for (int i = size.size() - 1; i >= 0; i--) { - exprs.push_back(static_cast(size[i])->GetExpression()); - } - } - - if (is_fortran_) { - exprLstExp = buildExprListExp(exprs); - arrayType->set_dim_info(exprLstExp); - exprLstExp->set_parent(arrayType); - arrayType->set_rank(exprLstExp->get_expressions().size()); - } - - static int rose_array_counter = 1; - SgVariableDeclaration* defn2; - std::string s; - if (!is_fortran_) { - s = std::string("_P") + omega::to_string(rose_array_counter++); - defn2 = buildVariableDeclaration(const_cast(s.c_str()), tn); - } else {// Manu:: fortran support - s = std::string("f_P") + omega::to_string(rose_array_counter++); - defn2 = buildVariableDeclaration(const_cast(s.c_str()), arrayType); - } - - - SgInitializedNamePtrList& variables2 = defn2->get_variables(); - - SgInitializedNamePtrList::const_iterator i2 = variables2.begin(); - SgInitializedName* initializedName2 = *i2; - SgVariableSymbol *vs = new SgVariableSymbol(initializedName2); - - prependStatement(defn2, - isSgScopeStatement(func->get_definition()->get_body())); - - vs->set_parent(symtab_); - symtab_->insert(SgName(s.c_str()), vs); - - return new IR_roseArraySymbol(this, vs); -} - -IR_ScalarRef *IR_roseCode::CreateScalarRef(const IR_ScalarSymbol *sym) { - return new IR_roseScalarRef(this, - buildVarRefExp(static_cast(sym)->vs_)); - -} - -IR_ArrayRef *IR_roseCode::CreateArrayRef(const IR_ArraySymbol *sym, - std::vector &index) { - - int t; - - if (sym->n_dim() != index.size()) - throw std::invalid_argument("incorrect array symbol dimensionality"); - - const IR_roseArraySymbol *l_sym = - static_cast(sym); - - SgVariableSymbol *vs = l_sym->vs_; - SgExpression* ia1 = buildVarRefExp(vs); - - - - if (is_fortran_) { // Manu:: fortran support - std::vectorexprs; - for (int i = 0 ; i < index.size(); i++) { - exprs.push_back(static_cast(index[i])->GetExpression()); - } - SgExprListExp *exprLstExp; - exprLstExp = buildExprListExp(exprs); - ia1 = buildPntrArrRefExp(ia1,exprLstExp); - } else { - for (int i = 0; i < index.size(); i++) { -/* - if (is_fortran_) - t = index.size() - i - 1; - else - t = i; -*/ - - // std::string y = - // isSgNode( - // static_cast(index[i])->GetExpression())->unparseToString(); - ia1 = buildPntrArrRefExp(ia1, - static_cast(index[i])->GetExpression()); - - } - } - - SgPntrArrRefExp *ia = isSgPntrArrRefExp(ia1); - //std::string z = isSgNode(ia)->unparseToString(); - - return new IR_roseArrayRef(this, ia, -1); - -} - -std::vector IR_roseCode::FindScalarRef( - const omega::CG_outputRepr *repr) const { - std::vector scalars; - SgNode *tnl = static_cast(repr)->GetCode(); - SgStatementPtrList *list = - static_cast(repr)->GetList(); - SgStatement* stmt; - SgExpression * exp; - - if (list != NULL) { - for (SgStatementPtrList::iterator it = (*list).begin(); - it != (*list).end(); it++) { - omega::CG_roseRepr *r = new omega::CG_roseRepr(isSgNode(*it)); - std::vector a = FindScalarRef(r); - delete r; - std::copy(a.begin(), a.end(), back_inserter(scalars)); - } - } - - else if (tnl != NULL) { - if (stmt = isSgStatement(tnl)) { - if (isSgBasicBlock(stmt)) { - SgStatementPtrList& stmts = - isSgBasicBlock(stmt)->get_statements(); - for (int i = 0; i < stmts.size(); i++) { - omega::CG_roseRepr *r = new omega::CG_roseRepr( - isSgNode(stmts[i])); - std::vector a = FindScalarRef(r); - delete r; - std::copy(a.begin(), a.end(), back_inserter(scalars)); - } - - } else if (isSgForStatement(stmt)) { - - SgForStatement *tnf = isSgForStatement(stmt); - omega::CG_roseRepr *r = new omega::CG_roseRepr( - isSgStatement(tnf->get_loop_body())); - std::vector a = FindScalarRef(r); - delete r; - std::copy(a.begin(), a.end(), back_inserter(scalars)); - } else if (isSgFortranDo(stmt)) { - SgFortranDo *tfortran = isSgFortranDo(stmt); - omega::CG_roseRepr *r = new omega::CG_roseRepr( - isSgStatement(tfortran->get_body())); - std::vector a = FindScalarRef(r); - delete r; - std::copy(a.begin(), a.end(), back_inserter(scalars)); - } else if (isSgIfStmt(stmt)) { - SgIfStmt* tni = isSgIfStmt(stmt); - omega::CG_roseRepr *r = new omega::CG_roseRepr( - isSgNode(tni->get_conditional())); - std::vector a = FindScalarRef(r); - delete r; - std::copy(a.begin(), a.end(), back_inserter(scalars)); - r = new omega::CG_roseRepr(isSgNode(tni->get_true_body())); - a = FindScalarRef(r); - delete r; - std::copy(a.begin(), a.end(), back_inserter(scalars)); - r = new omega::CG_roseRepr(isSgNode(tni->get_false_body())); - a = FindScalarRef(r); - delete r; - std::copy(a.begin(), a.end(), back_inserter(scalars)); - } else if (isSgExprStatement(stmt)) { - omega::CG_roseRepr *r = new omega::CG_roseRepr( - isSgExpression( - isSgExprStatement(stmt)->get_expression())); - std::vector a = FindScalarRef(r); - delete r; - std::copy(a.begin(), a.end(), back_inserter(scalars)); - - } - } - } else { - SgExpression* op = - static_cast(repr)->GetExpression(); - if (isSgVarRefExp(op) - && (!isSgArrayType(isSgVarRefExp(op)->get_type()))) { - /* if ((isSgAssignOp(isSgNode(op)->get_parent())) - && ((isSgAssignOp(isSgNode(op)->get_parent())->get_lhs_operand()) - == op)) - scalars.push_back( - new IR_roseScalarRef(this, - isSgAssignOp(isSgNode(op)->get_parent()), -1)); - else - */ - if (SgBinaryOp* op_ = isSgBinaryOp( - isSgVarRefExp(op)->get_parent())) { - if (SgCompoundAssignOp *op__ = isSgCompoundAssignOp(op_)) { - if (isSgCompoundAssignOp(op_)->get_lhs_operand() - == isSgVarRefExp(op)) { - scalars.push_back( - new IR_roseScalarRef(this, isSgVarRefExp(op), - 1)); - scalars.push_back( - new IR_roseScalarRef(this, isSgVarRefExp(op), - 0)); - } - } - } else if (SgAssignOp* assmt = isSgAssignOp( - isSgVarRefExp(op)->get_parent())) { - - if (assmt->get_lhs_operand() == isSgVarRefExp(op)) - scalars.push_back( - new IR_roseScalarRef(this, isSgVarRefExp(op), 1)); - } else if (SgAssignOp * assmt = isSgAssignOp( - isSgVarRefExp(op)->get_parent())) { - - if (assmt->get_rhs_operand() == isSgVarRefExp(op)) - scalars.push_back( - new IR_roseScalarRef(this, isSgVarRefExp(op), 0)); - } else - scalars.push_back( - new IR_roseScalarRef(this, isSgVarRefExp(op), 0)); - } else if (isSgAssignOp(op)) { - omega::CG_roseRepr *r1 = new omega::CG_roseRepr( - isSgAssignOp(op)->get_lhs_operand()); - std::vector a1 = FindScalarRef(r1); - delete r1; - std::copy(a1.begin(), a1.end(), back_inserter(scalars)); - omega::CG_roseRepr *r2 = new omega::CG_roseRepr( - isSgAssignOp(op)->get_rhs_operand()); - std::vector a2 = FindScalarRef(r2); - delete r2; - std::copy(a2.begin(), a2.end(), back_inserter(scalars)); - - } else if (isSgBinaryOp(op)) { - omega::CG_roseRepr *r1 = new omega::CG_roseRepr( - isSgBinaryOp(op)->get_lhs_operand()); - std::vector a1 = FindScalarRef(r1); - delete r1; - std::copy(a1.begin(), a1.end(), back_inserter(scalars)); - omega::CG_roseRepr *r2 = new omega::CG_roseRepr( - isSgBinaryOp(op)->get_rhs_operand()); - std::vector a2 = FindScalarRef(r2); - delete r2; - std::copy(a2.begin(), a2.end(), back_inserter(scalars)); - } else if (isSgUnaryOp(op)) { - omega::CG_roseRepr *r1 = new omega::CG_roseRepr( - isSgUnaryOp(op)->get_operand()); - std::vector a1 = FindScalarRef(r1); - delete r1; - std::copy(a1.begin(), a1.end(), back_inserter(scalars)); - } - - } - return scalars; - -} - -std::vector IR_roseCode::FindArrayRef( - const omega::CG_outputRepr *repr) const { - std::vector arrays; - SgNode *tnl = static_cast(repr)->GetCode(); - SgStatementPtrList* list = - static_cast(repr)->GetList(); - SgStatement* stmt; - SgExpression * exp; - - if (list != NULL) { - for (SgStatementPtrList::iterator it = (*list).begin(); - it != (*list).end(); it++) { - omega::CG_roseRepr *r = new omega::CG_roseRepr(isSgNode(*it)); - std::vector a = FindArrayRef(r); - delete r; - std::copy(a.begin(), a.end(), back_inserter(arrays)); - } - } else if (tnl != NULL) { - if (stmt = isSgStatement(tnl)) { - if (isSgBasicBlock(stmt)) { - SgStatementPtrList& stmts = - isSgBasicBlock(stmt)->get_statements(); - for (int i = 0; i < stmts.size(); i++) { - omega::CG_roseRepr *r = new omega::CG_roseRepr( - isSgNode(stmts[i])); - std::vector a = FindArrayRef(r); - delete r; - std::copy(a.begin(), a.end(), back_inserter(arrays)); - } - - } else if (isSgForStatement(stmt)) { - - SgForStatement *tnf = isSgForStatement(stmt); - omega::CG_roseRepr *r = new omega::CG_roseRepr( - isSgStatement(tnf->get_loop_body())); - std::vector a = FindArrayRef(r); - delete r; - std::copy(a.begin(), a.end(), back_inserter(arrays)); - } else if (isSgFortranDo(stmt)) { - SgFortranDo *tfortran = isSgFortranDo(stmt); - omega::CG_roseRepr *r = new omega::CG_roseRepr( - isSgStatement(tfortran->get_body())); - std::vector a = FindArrayRef(r); - delete r; - std::copy(a.begin(), a.end(), back_inserter(arrays)); - } else if (isSgIfStmt(stmt)) { - SgIfStmt* tni = isSgIfStmt(stmt); - omega::CG_roseRepr *r = new omega::CG_roseRepr( - isSgNode(tni->get_conditional())); - std::vector a = FindArrayRef(r); - delete r; - std::copy(a.begin(), a.end(), back_inserter(arrays)); - r = new omega::CG_roseRepr(isSgNode(tni->get_true_body())); - a = FindArrayRef(r); - delete r; - std::copy(a.begin(), a.end(), back_inserter(arrays)); - r = new omega::CG_roseRepr(isSgNode(tni->get_false_body())); - a = FindArrayRef(r); - delete r; - std::copy(a.begin(), a.end(), back_inserter(arrays)); - } else if (isSgExprStatement(stmt)) { - omega::CG_roseRepr *r = new omega::CG_roseRepr( - isSgExpression( - isSgExprStatement(stmt)->get_expression())); - std::vector a = FindArrayRef(r); - delete r; - std::copy(a.begin(), a.end(), back_inserter(arrays)); - - } - } - } else { - SgExpression* op = - static_cast(repr)->GetExpression(); - if (isSgPntrArrRefExp(op)) { - - SgVarRefExp* base; - SgExpression* op2; - if (isSgCompoundAssignOp(isSgPntrArrRefExp(op)->get_parent())) { - IR_roseArrayRef *ref1 = new IR_roseArrayRef(this, - isSgPntrArrRefExp(op), 0); - arrays.push_back(ref1); - IR_roseArrayRef *ref2 = new IR_roseArrayRef(this, - isSgPntrArrRefExp(op), 1); - arrays.push_back(ref2); - } else { - IR_roseArrayRef *ref3 = new IR_roseArrayRef(this, - isSgPntrArrRefExp(op), -1); - arrays.push_back(ref3); - - while (isSgPntrArrRefExp(op)) { - op2 = isSgPntrArrRefExp(op)->get_rhs_operand(); - op = isSgPntrArrRefExp(op)->get_lhs_operand(); - omega::CG_roseRepr *r = new omega::CG_roseRepr(op2); - std::vector a = FindArrayRef(r); - delete r; - std::copy(a.begin(), a.end(), back_inserter(arrays)); - - } - } - /* base = isSgVarRefExp(op); - SgVariableSymbol *arrSymbol = (SgVariableSymbol*)(base->get_symbol()); - SgArrayType *arrType = isSgArrayType(arrSymbol->get_type()); - - SgExprListExp* dimList = arrType->get_dim_info(); - - if(dimList != NULL){ - SgExpressionPtrList::iterator it = dimList->get_expressions().begin(); - SgExpression *expr; - - - for (int i = 0; it != dimList->get_expressions().end(); it++, i++) - { - expr = *it; - - omega::CG_roseRepr *r = new omega::CG_roseRepr(expr); - std::vector a = FindArrayRef(r); - delete r; - std::copy(a.begin(), a.end(), back_inserter(arrays)); - } - - } - arrays.push_back(ref); - */ - } else if (isSgAssignOp(op)) { - omega::CG_roseRepr *r1 = new omega::CG_roseRepr( - isSgAssignOp(op)->get_lhs_operand()); - std::vector a1 = FindArrayRef(r1); - delete r1; - std::copy(a1.begin(), a1.end(), back_inserter(arrays)); - omega::CG_roseRepr *r2 = new omega::CG_roseRepr( - isSgAssignOp(op)->get_rhs_operand()); - std::vector a2 = FindArrayRef(r2); - delete r2; - std::copy(a2.begin(), a2.end(), back_inserter(arrays)); - - } else if (isSgBinaryOp(op)) { - omega::CG_roseRepr *r1 = new omega::CG_roseRepr( - isSgBinaryOp(op)->get_lhs_operand()); - std::vector a1 = FindArrayRef(r1); - delete r1; - std::copy(a1.begin(), a1.end(), back_inserter(arrays)); - omega::CG_roseRepr *r2 = new omega::CG_roseRepr( - isSgBinaryOp(op)->get_rhs_operand()); - std::vector a2 = FindArrayRef(r2); - delete r2; - std::copy(a2.begin(), a2.end(), back_inserter(arrays)); - } else if (isSgUnaryOp(op)) { - omega::CG_roseRepr *r1 = new omega::CG_roseRepr( - isSgUnaryOp(op)->get_operand()); - std::vector a1 = FindArrayRef(r1); - delete r1; - std::copy(a1.begin(), a1.end(), back_inserter(arrays)); - } - - } - return arrays; - - /* std::string x; - SgStatement* stmt = isSgStatement(tnl); - SGExprStatement* expr_statement = isSgExprStatement(stmt); - SgExpression* exp= NULL; - if(expr_statement == NULL){ - if(! (SgExpression* exp = isSgExpression(tnl)) - throw ir_error("FindArrayRef: Not a stmt nor an expression!!"); - - if( expr_statement != NULL){ - for(int i=0; i < tnl->get_numberOfTraversalSuccessors(); i++){ - - SgNode* tn = isSgStatement(tnl); - SgStatement* stmt = isSgStatement(tn); - if(stmt != NULL){ - SgExprStatement* expr_statement = isSgExprStatement(tn); - if(expr_statement != NULL) - x = isSgNode(expr_statement)->unparseToString(); - exp = expr_statement->get_expression(); - - } - else{ - - exp = isSgExpression(tn); - } - if(exp != NULL){ - x = isSgNode(exp)->unparseToString(); - - if(SgPntrArrRefExp* arrRef = isSgPntrArrRefExp(exp) ){ - if(arrRef == NULL) - throw ir_error("something wrong"); - IR_roseArrayRef *ref = new IR_roseArrayRef(this, arrRef); - arrays.push_back(ref); - } - - omega::CG_outputRepr *r = new omega::CG_roseRepr(isSgNode(exp->get_rhs_operand())); - std::vector a = FindArrayRef(r); - delete r; - std::copy(a.begin(), a.end(), back_inserter(arrays)); - - omega::CG_outputRepr *r1 = new omega::CG_roseRepr(isSgNode(exp->get_lhs_operand())); - std::vector a1 = FindArrayRef(r1); - delete r1; - std::copy(a1.begin(), a1.end(), back_inserter(arrays)); - - } - }*/ - -} - -std::vector IR_roseCode::FindOneLevelControlStructure( - const IR_Block *block) const { - - std::vector controls; - int i; - int j; - int begin; - int end; - SgNode* tnl_ = - ((static_cast(const_cast(block)))->tnl_); - - if (isSgForStatement(tnl_)) - controls.push_back(new IR_roseLoop(this, tnl_)); - else if (isSgFortranDo(tnl_)) - controls.push_back(new IR_roseLoop(this, tnl_)); - else if (isSgIfStmt(tnl_)) - controls.push_back(new IR_roseIf(this, tnl_)); - - else if (isSgBasicBlock(tnl_)) { - - SgStatementPtrList& stmts = isSgBasicBlock(tnl_)->get_statements(); - - for (i = 0; i < stmts.size(); i++) { - if (isSgNode(stmts[i]) - == ((static_cast(const_cast(block)))->start_)) - begin = i; - if (isSgNode(stmts[i]) - == ((static_cast(const_cast(block)))->end_)) - end = i; - } - - SgNode* start = NULL; - SgNode* prev = NULL; - for (i = begin; i <= end; i++) { - if (isSgForStatement(stmts[i]) || isSgFortranDo(stmts[i])) { - if (start != NULL) { - controls.push_back( - new IR_roseBlock(this, - (static_cast(const_cast(block)))->tnl_, - start, prev)); - start = NULL; - } - controls.push_back(new IR_roseLoop(this, isSgNode(stmts[i]))); - } else if (isSgIfStmt(stmts[i])) { - if (start != NULL) { - controls.push_back( - new IR_roseBlock(this, - (static_cast(const_cast(block)))->tnl_, - start, prev)); - start = NULL; - } - controls.push_back(new IR_roseIf(this, isSgNode(stmts[i]))); - - } else if (start == NULL) - start = isSgNode(stmts[i]); - - prev = isSgNode(stmts[i]); - } - - if ((start != NULL) && (start != isSgNode(stmts[begin]))) - controls.push_back( - new IR_roseBlock(this, - (static_cast(const_cast(block)))->tnl_, - start, prev)); - } - - return controls; - -} - -/*std::vector IR_roseCode::FindOneLevelControlStructure(const IR_Block *block) const { - - std::vector controls; - int i; - int j; - SgNode* tnl_ = ((static_cast(const_cast(block)))->tnl_); - - - if(isSgForStatement(tnl_)) - controls.push_back(new IR_roseLoop(this,tnl_)); - - else if(isSgBasicBlock(tnl_)){ - - SgStatementPtrList& stmts = isSgBasicBlock(tnl_)->get_statements(); - - for(i =0; i < stmts.size(); i++){ - if(isSgNode(stmts[i]) == ((static_cast(const_cast(block)))->start_)) - break; - } - - - SgNode* start= NULL; - SgNode* prev= NULL; - for(; i < stmts.size(); i++){ - if ( isSgForStatement(stmts[i]) || isSgFortranDo(stmts[i])){ - if(start != NULL){ - controls.push_back(new IR_roseBlock(this, (static_cast(const_cast(block)))->tnl_ , start, prev)); - start = NULL; - } - controls.push_back(new IR_roseLoop(this, isSgNode(stmts[i]))); - } - else if( start == NULL ) - start = isSgNode(stmts[i]); - - prev = isSgNode(stmts[i]); - } - - if((start != NULL) && (start != isSgNode(stmts[0]))) - controls.push_back(new IR_roseBlock(this, (static_cast(const_cast(block)))->tnl_, start, prev)); - } - - return controls; - - } - -*/ -IR_Block *IR_roseCode::MergeNeighboringControlStructures( - const std::vector &controls) const { - if (controls.size() == 0) - return NULL; - - SgNode *tnl = NULL; - SgNode *start, *end; - for (int i = 0; i < controls.size(); i++) { - switch (controls[i]->type()) { - case IR_CONTROL_LOOP: { - SgNode *tf = static_cast(controls[i])->tf_; - if (tnl == NULL) { - tnl = tf->get_parent(); - start = end = tf; - } else { - if (tnl != tf->get_parent()) - throw ir_error("controls to merge not at the same level"); - end = tf; - } - break; - } - case IR_CONTROL_BLOCK: { - if (tnl == NULL) { - tnl = static_cast(controls[0])->tnl_; - start = static_cast(controls[0])->start_; - end = static_cast(controls[0])->end_; - } else { - if (tnl != static_cast(controls[0])->tnl_) - throw ir_error("controls to merge not at the same level"); - end = static_cast(controls[0])->end_; - } - break; - } - default: - throw ir_error("unrecognized control to merge"); - } - } - - return new IR_roseBlock(controls[0]->ir_, tnl, start, end); -} - -IR_Block *IR_roseCode::GetCode() const { - SgFunctionDefinition* def = NULL; - SgBasicBlock* block = NULL; - if (func != 0) { - if (def = func->get_definition()) { - if (block = def->get_body()) - return new IR_roseBlock(this, - func->get_definition()->get_body()); - } - } - - return NULL; - -} - -void IR_roseCode::ReplaceCode(IR_Control *old, omega::CG_outputRepr *repr) { - /* SgStatementPtrList *tnl = - static_cast(repr)->GetList(); - SgNode *tf_old; - */ - SgStatementPtrList *tnl = - static_cast(repr)->GetList(); - SgNode* node_ = static_cast(repr)->GetCode(); - SgNode * tf_old; - - /* May need future revision it tnl has more than one statement */ - - switch (old->type()) { - - case IR_CONTROL_LOOP: - tf_old = static_cast(old)->tf_; - break; - case IR_CONTROL_BLOCK: - tf_old = static_cast(old)->start_; - break; - - default: - throw ir_error("control structure to be replaced not supported"); - break; - } - - std::string y = tf_old->unparseToString(); - SgStatement *s = isSgStatement(tf_old); - if (s != 0) { - SgStatement *p = isSgStatement(tf_old->get_parent()); - - if (p != 0) { - SgStatement* temp = s; - if (tnl != NULL) { - SgStatementPtrList::iterator it = (*tnl).begin(); - p->insert_statement(temp, *it, true); - temp = *it; - p->remove_statement(s); - it++; - for (; it != (*tnl).end(); it++) { - p->insert_statement(temp, *it, false); - temp = *it; - } - } else if (node_ != NULL) { - if (!isSgStatement(node_)) - throw ir_error("Replacing Code not a statement!"); - else { - SgStatement* replace_ = isSgStatement(node_); - p->insert_statement(s, replace_, true); - p->remove_statement(s); - - } - } else { - throw ir_error("Replacing Code not a statement!"); - } - } else - throw ir_error("Replacing Code not a statement!"); - } else - throw ir_error("Replacing Code not a statement!"); - - delete old; - delete repr; - /* May need future revision it tnl has more than one statement */ - /* - switch (old->type()) { - - case IR_CONTROL_LOOP: - tf_old = static_cast(old)->tf_; - break; - case IR_CONTROL_BLOCK: - tf_old = static_cast(old)->start_; - break; - - default: - throw ir_error("control structure to be replaced not supported"); - break; - } - - // std::string y = tf_old->unparseToString(); - SgStatement *s = isSgStatement(tf_old); - if (s != 0) { - SgStatement *p = isSgStatement(tf_old->get_parent()); - - if (p != 0) { - // SgStatement* it2 = isSgStatement(tnl); - - // if(it2 != NULL){ - p->replace_statement(s, *tnl); - // } - // else { - // throw ir_error("Replacing Code not a statement!"); - // } - } else - throw ir_error("Replacing Code not a statement!"); - } else - throw ir_error("Replacing Code not a statement!"); - // y = tnl->unparseToString(); - delete old; - delete repr; - */ -} - -void IR_roseCode::ReplaceExpression(IR_Ref *old, omega::CG_outputRepr *repr) { - - SgExpression* op = static_cast(repr)->GetExpression(); - - if (typeid(*old) == typeid(IR_roseArrayRef)) { - SgPntrArrRefExp* ia_orig = static_cast(old)->ia_; - SgExpression* parent = isSgExpression(isSgNode(ia_orig)->get_parent()); - std::string x = isSgNode(op)->unparseToString(); - std::string y = isSgNode(ia_orig)->unparseToString(); - if (parent != NULL) { - std::string z = isSgNode(parent)->unparseToString(); - parent->replace_expression(ia_orig, op); - isSgNode(op)->set_parent(isSgNode(parent)); - - /* if(isSgBinaryOp(parent)) - { - if(isSgBinaryOp(parent)->get_lhs_operand() == ia_orig){ - isSgBinaryOp(parent)->set_lhs_operand(op); - }else if(isSgBinaryOp(parent)->get_rhs_operand() == ia_orig){ - isSgBinaryOp(parent)->set_rhs_operand(op); - - - } - else - parent->replace_expression(ia_orig, op); - */ - } else { - SgStatement* parent_stmt = isSgStatement( - isSgNode(ia_orig)->get_parent()); - if (parent_stmt != NULL) - parent_stmt->replace_expression(ia_orig, op); - else - throw ir_error( - "ReplaceExpression: parent neither expression nor statement"); - } - } else - throw ir_error("replacing a scalar variable not implemented"); - - delete old; -} - -/*std::pair, std::vector > IR_roseCode::FindScalarDeps( - const omega::CG_outputRepr *repr1, const omega::CG_outputRepr *repr2, - std::vector index, int i, int j) { - - std::vector dvs1; - std::vector dvs2; - SgNode *tnl_1 = static_cast(repr1)->GetCode(); - SgNode *tnl_2 = static_cast(repr2)->GetCode(); - SgStatementPtrList* list_1 = - static_cast(repr1)->GetList(); - SgStatementPtrList output_list_1; - - std::map read_scalars_1; - std::map write_scalars_1; - std::set indices; - //std::set reaching_defs_1; - std::set def_vars_1; - - populateLists(tnl_1, list_1, output_list_1); - populateScalars(repr1, read_scalars_1, write_scalars_1, indices, index); - //def_vars_1); - //findDefinitions(output_list_1, reaching_defs_1, write_scalars_1); - //def_vars_1); - if (repr1 == repr2) - checkSelfDependency(output_list_1, dvs1, read_scalars_1, - write_scalars_1, index, i, j); - else { - SgStatementPtrList* list_2 = - static_cast(repr2)->GetList(); - SgStatementPtrList output_list_2; - - std::map read_scalars_2; - std::map write_scalars_2; - //std::set reaching_defs_2; - std::set def_vars_2; - - populateLists(tnl_2, list_2, output_list_2); - populateScalars(repr2, read_scalars_2, write_scalars_2, indices, index); - //def_vars_2); - - checkDependency(output_list_2, dvs1, read_scalars_2, write_scalars_1, - index, i, j); - checkDependency(output_list_1, dvs1, read_scalars_1, write_scalars_2, - index, i, j); - checkWriteDependency(output_list_2, dvs1, write_scalars_2, - write_scalars_1, index, i, j); - checkWriteDependency(output_list_1, dvs1, write_scalars_1, - write_scalars_2, index, i, j); - } - - return std::make_pair(dvs1, dvs2); - //populateLists(tnl_2, list_2, list2); - - } -*/ -IR_OPERATION_TYPE IR_roseCode::QueryExpOperation( - const omega::CG_outputRepr *repr) const { - SgExpression* op = - static_cast(repr)->GetExpression(); - - if (isSgValueExp(op)) - return IR_OP_CONSTANT; - else if (isSgVarRefExp(op) || isSgPntrArrRefExp(op)) - return IR_OP_VARIABLE; - else if (isSgAssignOp(op) || isSgCompoundAssignOp(op)) - return IR_OP_ASSIGNMENT; - else if (isSgAddOp(op)) - return IR_OP_PLUS; - else if (isSgSubtractOp(op)) - return IR_OP_MINUS; - else if (isSgMultiplyOp(op)) - return IR_OP_MULTIPLY; - else if (isSgDivideOp(op)) - return IR_OP_DIVIDE; - else if (isSgMinusOp(op)) - return IR_OP_NEGATIVE; - else if (isSgConditionalExp(op)) { - SgExpression* cond = isSgConditionalExp(op)->get_conditional_exp(); - if (isSgGreaterThanOp(cond)) - return IR_OP_MAX; - else if (isSgLessThanOp(cond)) - return IR_OP_MIN; - } else if (isSgUnaryAddOp(op)) - return IR_OP_POSITIVE; - else if (isSgNullExpression(op)) - return IR_OP_NULL; - else - return IR_OP_UNKNOWN; -} -/*void IR_roseCode::populateLists(SgNode* tnl_1, SgStatementPtrList* list_1, - SgStatementPtrList& output_list_1) { - if ((tnl_1 == NULL) && (list_1 != NULL)) { - output_list_1 = *list_1; - } else if (tnl_1 != NULL) { - - if (isSgForStatement(tnl_1)) { - SgStatement* check = isSgForStatement(tnl_1)->get_loop_body(); - if (isSgBasicBlock(check)) { - output_list_1 = isSgBasicBlock(check)->get_statements(); - - } else - output_list_1.push_back(check); - - } else if (isSgBasicBlock(tnl_1)) - output_list_1 = isSgBasicBlock(tnl_1)->get_statements(); - else if (isSgExprStatement(tnl_1)) - output_list_1.push_back(isSgExprStatement(tnl_1)); - else - //if (isSgIfStmt(tnl_1)) { - - throw ir_error( - "Statement type not handled, (probably IF statement)!!"); - - } - - } - - void IR_roseCode::populateScalars(const omega::CG_outputRepr *repr1, - std::map &read_scalars_1, - std::map &write_scalars_1, - std::set &indices, std::vector &index) { - - //std::set &def_vars) { - std::vector scalars = FindScalarRef(repr1); - - for (int k = 0; k < index.size(); k++) - indices.insert(index[k]); - - for (int k = 0; k < scalars.size(); k++) - if (indices.find(scalars[k]->name()) == indices.end()) { - if (scalars[k]->is_write()) { - write_scalars_1.insert( - std::pair( - (isSgVarRefExp( - static_cast(scalars[k]->convert())->GetExpression())), - scalars[k])); - - } else - - read_scalars_1.insert( - std::pair( - (isSgVarRefExp( - static_cast(scalars[k]->convert())->GetExpression())), - scalars[k])); - } - - } - - - void IR_roseCode::checkWriteDependency(SgStatementPtrList &output_list_1, - std::vector &dvs1, - std::map &read_scalars_1, - std::map &write_scalars_1, - std::vector &index, int i, int j) { - - for (std::map::iterator it = - read_scalars_1.begin(); it != read_scalars_1.end(); it++) { - SgVarRefExp* var__ = it->first; - - ssa_unfiltered_cfg::SSA_UnfilteredCfg::NodeReachingDefTable to_compare = - main_ssa->getReachingDefsBefore(isSgNode(var__)); - - for (ssa_unfiltered_cfg::SSA_UnfilteredCfg::NodeReachingDefTable::iterator it4 = - to_compare.begin(); it4 != to_compare.end(); it4++) { - ssa_unfiltered_cfg::SSA_UnfilteredCfg::VarName var_ = it4->first; - for (int j = 0; j < var_.size(); j++) { - int found = 0; - if (var_[j] == var__->get_symbol()->get_declaration()) { - - ssa_unfiltered_cfg::ReachingDef::ReachingDefPtr to_compare_2 = - it4->second; - - if (to_compare_2->isPhiFunction()) { - std::set to_compare_set = - to_compare_2->getActualDefinitions(); - for (std::set::iterator cfg_it = - to_compare_set.begin(); - cfg_it != to_compare_set.end(); cfg_it++) { - - if (isSgAssignOp(cfg_it->getNode()) - || isSgCompoundAssignOp(cfg_it->getNode())) - if (SgVarRefExp* variable = - isSgVarRefExp( - isSgBinaryOp(cfg_it->getNode())->get_lhs_operand())) { - - if (write_scalars_1.find(variable) - != write_scalars_1.end()) { - - - //end debug - found = 1; - DependenceVector dv1; - dv1.sym = it->second->symbol(); - dv1.is_scalar_dependence = true; - - int max = (j > i) ? j : i; - int start = index.size() - max; - - //1.lbounds.push_back(0); - //1.ubounds.push_back(0); - //dv2.sym = - // read_scalars_2.find(*di)->second->symbol(); - for (int k = 0; k < index.size(); k++) { - if (k >= max) { - dv1.lbounds.push_back( - negInfinity); - dv1.ubounds.push_back(-1); - } else { - dv1.lbounds.push_back(0); - dv1.ubounds.push_back(0); - - } - - } - dvs1.push_back(dv1); - break; - } - } - } - - } - - } - if (found == 1) - break; - } - } - } - } - void IR_roseCode::checkDependency(SgStatementPtrList &output_list_1, - std::vector &dvs1, - std::map &read_scalars_1, - std::map &write_scalars_1, - std::vector &index, int i, int j) { - - for (SgStatementPtrList::iterator it2 = output_list_1.begin(); - it2 != output_list_1.end(); it2++) { - - std::set vars_1 = main_ssa->getUsesAtNode( - isSgNode(isSgExprStatement(*it2)->get_expression())); - - std::set::iterator di; - - for (di = vars_1.begin(); di != vars_1.end(); di++) { - int found = 0; - if (read_scalars_1.find(*di) != read_scalars_1.end()) { - - ssa_unfiltered_cfg::ReachingDef::ReachingDefPtr to_compare = - main_ssa->getDefinitionForUse(*di); - if (to_compare->isPhiFunction()) { - - std::set to_compare_set = - to_compare->getActualDefinitions(); - - for (std::set::iterator cfg_it = - to_compare_set.begin(); - cfg_it != to_compare_set.end(); cfg_it++) { - - - if (SgAssignOp* definition = isSgAssignOp( - cfg_it->getNode())) - if (SgVarRefExp* variable = isSgVarRefExp( - definition->get_lhs_operand())) { - - if (write_scalars_1.find(variable) - != write_scalars_1.end()) { - - found = 1; - DependenceVector dv1; - //DependenceVector dv2; - dv1.sym = - read_scalars_1.find(*di)->second->symbol(); - dv1.is_scalar_dependence = true; - - int max = (j > i) ? j : i; - int start = index.size() - max; - - //1.lbounds.push_back(0); - //1.ubounds.push_back(0); - //dv2.sym = - // read_scalars_2.find(*di)->second->symbol(); - for (int k = 0; k < index.size(); k++) { - if (k >= max) { - dv1.lbounds.push_back(negInfinity); - dv1.ubounds.push_back(-1); - } else { - dv1.lbounds.push_back(0); - dv1.ubounds.push_back(0); - - } - - } - dvs1.push_back(dv1); - break; - } - } - } - } - if (found == 1) - break; - } - } - } - - } - - void IR_roseCode::checkSelfDependency(SgStatementPtrList &output_list_1, - std::vector &dvs1, - std::map &read_scalars_1, - std::map &write_scalars_1, - std::vector &index, int i, int j) { - - for (SgStatementPtrList::iterator it2 = output_list_1.begin(); - it2 != output_list_1.end(); it2++) { - - std::set vars_1 = main_ssa->getUsesAtNode( - isSgNode(isSgExprStatement(*it2)->get_expression())); - - std::set::iterator di; - - for (di = vars_1.begin(); di != vars_1.end(); di++) { - - if (read_scalars_1.find(*di) != read_scalars_1.end()) { - - ssa_unfiltered_cfg::ReachingDef::ReachingDefPtr to_compare = - main_ssa->getDefinitionForUse(*di); - if (to_compare->isPhiFunction()) { - - std::set to_compare_set = - to_compare->getActualDefinitions(); - int found = 0; - for (std::set::iterator cfg_it = - to_compare_set.begin(); - cfg_it != to_compare_set.end(); cfg_it++) { - - if (isSgAssignOp(cfg_it->getNode()) - || isSgCompoundAssignOp(cfg_it->getNode())) - if (SgVarRefExp* variable = - isSgVarRefExp( - isSgBinaryOp(cfg_it->getNode())->get_lhs_operand())) { - - if (write_scalars_1.find(variable) - == write_scalars_1.end()) { - - - found = 1; - DependenceVector dv1; - dv1.sym = - read_scalars_1.find(*di)->second->symbol(); - dv1.is_scalar_dependence = true; - - int max = (j > i) ? j : i; - int start = index.size() - max; - - //1.lbounds.push_back(0); - //1.ubounds.push_back(0); - //dv2.sym = - // read_scalars_2.find(*di)->second->symbol(); - for (int k = 0; k < index.size(); k++) { - if (k >= max) { - dv1.lbounds.push_back(negInfinity); - dv1.ubounds.push_back(-1); - } else { - dv1.lbounds.push_back(0); - dv1.ubounds.push_back(0); - - } - - } - dvs1.push_back(dv1); - break; - } - } - } - } - - } - } - } - - } -*/ -IR_CONDITION_TYPE IR_roseCode::QueryBooleanExpOperation( - const omega::CG_outputRepr *repr) const { - SgExpression* op2 = - static_cast(repr)->GetExpression(); - SgNode* op; - - if (op2 == NULL) { - op = static_cast(repr)->GetCode(); - - if (op != NULL) { - if (isSgExprStatement(op)) - op2 = isSgExprStatement(op)->get_expression(); - else - return IR_COND_UNKNOWN; - } else - return IR_COND_UNKNOWN; - } - - if (isSgEqualityOp(op2)) - return IR_COND_EQ; - else if (isSgNotEqualOp(op2)) - return IR_COND_NE; - else if (isSgLessThanOp(op2)) - return IR_COND_LT; - else if (isSgLessOrEqualOp(op2)) - return IR_COND_LE; - else if (isSgGreaterThanOp(op2)) - return IR_COND_GT; - else if (isSgGreaterOrEqualOp(op2)) - return IR_COND_GE; - - return IR_COND_UNKNOWN; - -} - -std::vector IR_roseCode::QueryExpOperand( - const omega::CG_outputRepr *repr) const { - std::vector v; - SgExpression* op1; - SgExpression* op2; - SgExpression* op = - static_cast(repr)->GetExpression(); - omega::CG_roseRepr *repr1; - - if (isSgValueExp(op) || isSgVarRefExp(op)) { - omega::CG_roseRepr *repr = new omega::CG_roseRepr(op); - v.push_back(repr); - } else if (isSgAssignOp(op)) { - op1 = isSgAssignOp(op)->get_rhs_operand(); - repr1 = new omega::CG_roseRepr(op1); - v.push_back(repr1); - /*may be a problem as assignOp is a binaryop destop might be needed */ - } else if (isSgMinusOp(op)) { - op1 = isSgMinusOp(op)->get_operand(); - repr1 = new omega::CG_roseRepr(op1); - v.push_back(repr1); - } else if (isSgUnaryAddOp(op)) { - op1 = isSgUnaryAddOp(op)->get_operand(); - repr1 = new omega::CG_roseRepr(op1); - v.push_back(repr1); - } else if ((isSgAddOp(op) || isSgSubtractOp(op)) - || (isSgMultiplyOp(op) || isSgDivideOp(op))) { - op1 = isSgBinaryOp(op)->get_lhs_operand(); - repr1 = new omega::CG_roseRepr(op1); - v.push_back(repr1); - - op2 = isSgBinaryOp(op)->get_rhs_operand(); - repr1 = new omega::CG_roseRepr(op2); - v.push_back(repr1); - } else if (isSgConditionalExp(op)) { - SgExpression* cond = isSgConditionalExp(op)->get_conditional_exp(); - op1 = isSgBinaryOp(cond)->get_lhs_operand(); - repr1 = new omega::CG_roseRepr(op1); - v.push_back(repr1); - - op2 = isSgBinaryOp(cond)->get_rhs_operand(); - repr1 = new omega::CG_roseRepr(op2); - v.push_back(repr1); - } else if (isSgCompoundAssignOp(op)) { - SgExpression* cond = isSgCompoundAssignOp(op); - op1 = isSgBinaryOp(cond)->get_lhs_operand(); - repr1 = new omega::CG_roseRepr(op1); - v.push_back(repr1); - - op2 = isSgBinaryOp(cond)->get_rhs_operand(); - repr1 = new omega::CG_roseRepr(op2); - v.push_back(repr1); - - } else if (isSgBinaryOp(op)) { - - op1 = isSgBinaryOp(op)->get_lhs_operand(); - repr1 = new omega::CG_roseRepr(op1); - v.push_back(repr1); - - op2 = isSgBinaryOp(op)->get_rhs_operand(); - repr1 = new omega::CG_roseRepr(op2); - v.push_back(repr1); - } - - else - throw ir_error("operation not supported"); - - return v; -} - -IR_Ref *IR_roseCode::Repr2Ref(const omega::CG_outputRepr *repr) const { - SgExpression* op = - static_cast(repr)->GetExpression(); - - if (SgValueExp* im = isSgValueExp(op)) { - if (isSgIntVal(im)) - return new IR_roseConstantRef(this, - static_cast(isSgIntVal(im)->get_value())); - else if (isSgUnsignedIntVal(im)) - return new IR_roseConstantRef(this, - static_cast(isSgUnsignedIntVal(im)->get_value())); - else if (isSgLongIntVal(im)) - return new IR_roseConstantRef(this, - static_cast(isSgLongIntVal(im)->get_value())); - else if (isSgFloatVal(im)) - return new IR_roseConstantRef(this, isSgFloatVal(im)->get_value()); - else - assert(0); - - } else if (isSgVarRefExp(op)) - return new IR_roseScalarRef(this, isSgVarRefExp(op)); - else - assert(0); - -} - diff --git a/ir_rose.hh b/ir_rose.hh deleted file mode 100644 index 0c0417a..0000000 --- a/ir_rose.hh +++ /dev/null @@ -1,289 +0,0 @@ -#ifndef IR_ROSE_HH -#define IR_ROSE_HH - -#include -#include "ir_code.hh" -#include "ir_rose_utils.hh" -#include -#include "chill_error.hh" -#include "staticSingleAssignment.h" -#include "VariableRenaming.h" -#include "ssaUnfilteredCfg.h" -#include "virtualCFG.h" -#include - -struct IR_roseScalarSymbol: public IR_ScalarSymbol { - SgVariableSymbol* vs_; - - IR_roseScalarSymbol(const IR_Code *ir, SgVariableSymbol *vs) { - ir_ = ir; - vs_ = vs; - } - - std::string name() const; - int size() const; - bool operator==(const IR_Symbol &that) const; - IR_Symbol *clone() const; -}; - -struct IR_roseArraySymbol: public IR_ArraySymbol { - - SgVariableSymbol* vs_; - - IR_roseArraySymbol(const IR_Code *ir, SgVariableSymbol* vs) { - ir_ = ir; - vs_ = vs; - } - std::string name() const; - int elem_size() const; - int n_dim() const; - omega::CG_outputRepr *size(int dim) const; - bool operator==(const IR_Symbol &that) const; - IR_ARRAY_LAYOUT_TYPE layout_type() const; - IR_Symbol *clone() const; - -}; - -struct IR_roseConstantRef: public IR_ConstantRef { - union { - omega::coef_t i_; - double f_; - }; - - IR_roseConstantRef(const IR_Code *ir, omega::coef_t i) { - ir_ = ir; - type_ = IR_CONSTANT_INT; - i_ = i; - } - IR_roseConstantRef(const IR_Code *ir, double f) { - ir_ = ir; - type_ = IR_CONSTANT_FLOAT; - f_ = f; - } - omega::coef_t integer() const { - assert(is_integer()); - return i_; - } - bool operator==(const IR_Ref &that) const; - omega::CG_outputRepr *convert(); - IR_Ref *clone() const; - -}; - -struct IR_roseScalarRef: public IR_ScalarRef { - SgAssignOp *ins_pos_; - int op_pos_; // -1 means destination operand, otherwise source operand - SgVarRefExp *vs_; - int is_write_; - IR_roseScalarRef(const IR_Code *ir, SgVarRefExp *sym) { - ir_ = ir; - ins_pos_ = isSgAssignOp(sym->get_parent()); - op_pos_ = 0; - if (ins_pos_ != NULL) - if (sym == isSgVarRefExp(ins_pos_->get_lhs_operand())) - op_pos_ = -1; - - vs_ = sym; - } - IR_roseScalarRef(const IR_Code *ir, SgVarRefExp *ins, int pos) { - ir_ = ir; - /* ins_pos_ = ins; - op_pos_ = pos; - SgExpression* op; - if (pos == -1) - op = ins->get_lhs_operand(); - else - op = ins->get_rhs_operand(); - - */ - - is_write_ = pos; - - /* if (vs_ == NULL || pos > 0) - throw ir_error( - "Src operand not a variable or more than one src operand!!"); - */ - - vs_ = ins; - - } - bool is_write() const; - IR_ScalarSymbol *symbol() const; - bool operator==(const IR_Ref &that) const; - omega::CG_outputRepr *convert(); - IR_Ref *clone() const; -}; - -struct IR_roseArrayRef: public IR_ArrayRef { - - SgPntrArrRefExp *ia_; - - int is_write_; - IR_roseArrayRef(const IR_Code *ir, SgPntrArrRefExp *ia, int write) { - ir_ = ir; - ia_ = ia; - is_write_ = write; - } - bool is_write() const; - omega::CG_outputRepr *index(int dim) const; - IR_ArraySymbol *symbol() const; - bool operator==(const IR_Ref &that) const; - omega::CG_outputRepr *convert(); - IR_Ref *clone() const; -}; - -struct IR_roseLoop: public IR_Loop { - SgNode *tf_; - - IR_roseLoop(const IR_Code *ir, SgNode *tf) { - ir_ = ir; - tf_ = tf; - } - - IR_ScalarSymbol *index() const; - omega::CG_outputRepr *lower_bound() const; - omega::CG_outputRepr *upper_bound() const; - IR_CONDITION_TYPE stop_cond() const; - IR_Block *body() const; - IR_Block *convert(); - int step_size() const; - IR_Control *clone() const; -}; - -struct IR_roseBlock: public IR_Block { - SgNode* tnl_; - SgNode *start_, *end_; - - IR_roseBlock(const IR_Code *ir, SgNode *tnl, SgNode *start, SgNode *end) { - ir_ = ir; - tnl_ = tnl; - start_ = start; - end_ = end; - } - - IR_roseBlock(const IR_Code *ir, SgNode *tnl) { - ir_ = ir; - tnl_ = tnl; - start_ = tnl_->get_traversalSuccessorByIndex(0); - end_ = tnl_->get_traversalSuccessorByIndex( - (tnl_->get_numberOfTraversalSuccessors()) - 1); - } - omega::CG_outputRepr *extract() const; - omega::CG_outputRepr *original() const; - IR_Control *clone() const; -}; - -struct IR_roseIf: public IR_If { - SgNode *ti_; - - IR_roseIf(const IR_Code *ir, SgNode *ti) { - ir_ = ir; - ti_ = ti; - } - ~IR_roseIf() { - } - omega::CG_outputRepr *condition() const; - IR_Block *then_body() const; - IR_Block *else_body() const; - IR_Block *convert(); - IR_Control *clone() const; -}; - -class IR_roseCode_Global_Init { -private: - static IR_roseCode_Global_Init *pinstance; -public: - SgProject* project; - static IR_roseCode_Global_Init *Instance(char** argv); -}; - -class IR_roseCode: public IR_Code { -protected: - SgSourceFile* file; - SgGlobal *root; - SgGlobal *firstScope; - SgSymbolTable* symtab_; - SgSymbolTable* symtab2_; - SgSymbolTable* symtab3_; - SgDeclarationStatementPtrList::iterator p; - SgFunctionDeclaration *func; - bool is_fortran_; - int i_; - StaticSingleAssignment *ssa_for_scalar; - ssa_unfiltered_cfg::SSA_UnfilteredCfg *main_ssa; - VariableRenaming *varRenaming_for_scalar; -public: - IR_roseCode(const char *filename, const char* proc_name); - ~IR_roseCode(); - - IR_ScalarSymbol *CreateScalarSymbol(const IR_Symbol *sym, int memory_type = - 0); - IR_ArraySymbol *CreateArraySymbol(const IR_Symbol *sym, - std::vector &size, int memory_type = 0); - IR_ScalarRef *CreateScalarRef(const IR_ScalarSymbol *sym); - IR_ArrayRef *CreateArrayRef(const IR_ArraySymbol *sym, - std::vector &index); - int ArrayIndexStartAt() { - if (is_fortran_) - return 1; - else - return 0; - } - - void populateLists(SgNode* tnl_1, SgStatementPtrList* list_1, - SgStatementPtrList& output_list_1); - void populateScalars(const omega::CG_outputRepr *repr1, - std::map &read_scalars_1, - std::map &write_scalars_1, - std::set &indices, std::vector &index); - // std::set &def_vars); - /*void findDefinitions(SgStatementPtrList &list_1, - std::set &reaching_defs_1, - std::map &write_scalars_1, - std::set &def_vars); - */ - /* void checkDependency(SgStatementPtrList &output_list_1, - std::vector &dvs1, - std::map &read_scalars_1, - std::map &write_scalars_1, - std::vector &index, int i, int j); - void checkSelfDependency(SgStatementPtrList &output_list_1, - std::vector &dvs1, - std::map &read_scalars_1, - std::map &write_scalars_1, - std::vector &index, int i, int j); - void checkWriteDependency(SgStatementPtrList &output_list_1, - std::vector &dvs1, - std::map &read_scalars_1, - std::map &write_scalars_1, - std::vector &index, int i, int j); - */ - std::vector FindArrayRef( - const omega::CG_outputRepr *repr) const; - std::vector FindScalarRef( - const omega::CG_outputRepr *repr) const; - std::vector FindOneLevelControlStructure( - const IR_Block *block) const; - IR_Block *MergeNeighboringControlStructures( - const std::vector &controls) const; - IR_Block *GetCode() const; - void ReplaceCode(IR_Control *old, omega::CG_outputRepr *repr); - void ReplaceExpression(IR_Ref *old, omega::CG_outputRepr *repr); - - IR_OPERATION_TYPE QueryExpOperation(const omega::CG_outputRepr *repr) const; - IR_CONDITION_TYPE QueryBooleanExpOperation( - const omega::CG_outputRepr *repr) const; - std::vector QueryExpOperand( - const omega::CG_outputRepr *repr) const; - IR_Ref *Repr2Ref(const omega::CG_outputRepr *) const; - /* std::pair, std::vector > - FindScalarDeps(const omega::CG_outputRepr *repr1, - const omega::CG_outputRepr *repr2, std::vector index, - int i, int j); - */ - void finalizeRose(); - friend class IR_roseArraySymbol; - friend class IR_roseArrayRef; -}; - -#endif diff --git a/ir_rose_utils.cc b/ir_rose_utils.cc deleted file mode 100644 index fbce2f1..0000000 --- a/ir_rose_utils.cc +++ /dev/null @@ -1,88 +0,0 @@ -/***************************************************************************** - Copyright (C) 2008 University of Southern California - Copyright (C) 2009 University of Utah - All Rights Reserved. - - Purpose: - SUIF interface utilities. - - Notes: - - Update history: - 01/2006 created by Chun Chen -*****************************************************************************/ - -//#include -//#include -//#include -//#include -//#include -#include "ir_rose_utils.hh" - - - -std::vector find_loops(SgNode *tnl) { - std::vector result; - - //tree_node_list_iter iter(tnl); - - /*while (!iter.is_empty()) { - tree_node *tn = iter.step(); - if (tn->kind() == TREE_FOR) - result.push_back(static_cast(tn)); - } - */ - - SgStatementPtrList& blockStatements = isSgBasicBlock(tnl)->get_statements(); - for(SgStatementPtrList::const_iterator j = blockStatements.begin(); j != blockStatements.end(); j++) - if(isSgForStatement(*j)) - result.push_back(isSgForStatement(*j)); - - return result; -} - -std::vector find_deepest_loops(SgStatementPtrList& tnl) { - - std::vector loops; - - - - for(SgStatementPtrList::const_iterator j = tnl.begin(); j != tnl.end(); j++) - { - std::vector t = find_deepest_loops(isSgNode(*j)); - if (t.size() > loops.size()) - loops = t; - } - - - - return loops; - -} - - - - - - - - -std::vector find_deepest_loops(SgNode *tn) { - if (isSgForStatement(tn)) { - std::vector loops; - - SgForStatement *tnf = static_cast(tn); - loops.insert(loops.end(), tnf); - std::vector t = find_deepest_loops(isSgNode(tnf->get_loop_body())); - std::copy(t.begin(), t.end(), std::back_inserter(loops)); - - return loops; - } - else if (isSgBasicBlock(tn)) { - SgBasicBlock *tnb = static_cast(tn); - return find_deepest_loops(tnb->get_statements()); - } - else - return std::vector(); -} - diff --git a/ir_rose_utils.hh b/ir_rose_utils.hh deleted file mode 100644 index 503d7f4..0000000 --- a/ir_rose_utils.hh +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef IR_ROSE_UTILS_HH -#define IR_ROSE_UTILS_HH -#include -#include "rose.h" -#include "sageBuilder.h" - - - -std::vector find_deepest_loops(SgNode *tnl); -std::vector find_loops(SgNode *tnl); - - - -SgNode* loop_body_at_level(SgNode* tnl, int level); -SgNode* loop_body_at_level(SgForStatement* loop, int level); -void swap_node_for_node_list(SgNode* tn, SgNode* new_tnl); - -#endif diff --git a/irtools.cc b/irtools.cc deleted file mode 100644 index 4ab6c85..0000000 --- a/irtools.cc +++ /dev/null @@ -1,279 +0,0 @@ -/***************************************************************************** - Copyright (C) 2010 University of Utah - All Rights Reserved. - - Purpose: - Useful tools to analyze code in compiler IR format. - - Notes: - - History: - 06/2010 Created by Chun Chen. -*****************************************************************************/ - -#include -#include -#include "irtools.hh" -#include "omegatools.hh" -#include "chill_error.hh" - -using namespace omega; - -// Build IR tree from the source code. Block type node can only be -// leaf, i.e., there is no further structures inside a block allowed. -std::vector build_ir_tree(IR_Control *control, ir_tree_node *parent) { - std::vector result; - - switch (control->type()) { - case IR_CONTROL_BLOCK: { - std::vector controls = control->ir_->FindOneLevelControlStructure(static_cast(control)); - if (controls.size() == 0) { - ir_tree_node *node = new ir_tree_node; - node->content = control; - node->parent = parent; - node->payload = -1; - result.push_back(node); - } - else { - delete control; - for (int i = 0; i < controls.size(); i++) - switch (controls[i]->type()) { - case IR_CONTROL_BLOCK: { - std::vector t = build_ir_tree(controls[i], parent); - result.insert(result.end(), t.begin(), t.end()); - break; - } - case IR_CONTROL_LOOP: { - ir_tree_node *node = new ir_tree_node; - node->content = controls[i]; - node->parent = parent; - node->children = build_ir_tree(static_cast(controls[i])->body(), node); - node->payload = -1; - result.push_back(node); - break; - } - case IR_CONTROL_IF: { - static int unique_if_identifier = 0; - - IR_Block *block = static_cast(controls[i])->then_body(); - if (block != NULL) { - ir_tree_node *node = new ir_tree_node; - node->content = controls[i]; - node->parent = parent; - node->children = build_ir_tree(block, node); - node->payload = unique_if_identifier+1; - result.push_back(node); - } - - - block = static_cast(controls[i])->else_body(); - if ( block != NULL) { - ir_tree_node *node = new ir_tree_node; - node->content = controls[i]->clone(); - node->parent = parent; - node->children = build_ir_tree(block, node); - node->payload = unique_if_identifier; - result.push_back(node); - } - - unique_if_identifier += 2; - break; - } - default: - ir_tree_node *node = new ir_tree_node; - node->content = controls[i]; - node->parent = parent; - node->payload = -1; - result.push_back(node); - break; - } - } - break; - } - case IR_CONTROL_LOOP: { - ir_tree_node *node = new ir_tree_node; - node->content = control; - node->parent = parent; - node->children = build_ir_tree(static_cast(control)->body(), node); - node->payload = -1; - result.push_back(node); - break; - } - default: - ir_tree_node *node = new ir_tree_node; - node->content = control; - node->parent = parent; - node->payload = -1; - result.push_back(node); - break; - } - - return result; -} - - -// Extract statements from IR tree. Statements returned are ordered in -// lexical order in the source code. -std::vector extract_ir_stmts(const std::vector &ir_tree) { - std::vector result; - for (int i = 0; i < ir_tree.size(); i++) - switch (ir_tree[i]->content->type()) { - case IR_CONTROL_BLOCK: - result.push_back(ir_tree[i]); - break; - case IR_CONTROL_LOOP: { - // clear loop payload from previous unsuccessful initialization process - ir_tree[i]->payload = -1; - - std::vector t = extract_ir_stmts(ir_tree[i]->children); - result.insert(result.end(), t.begin(), t.end()); - break; - } - case IR_CONTROL_IF: { - std::vector t = extract_ir_stmts(ir_tree[i]->children); - result.insert(result.end(), t.begin(), t.end()); - break; - } - default: - throw std::invalid_argument("invalid ir tree"); - } - - return result; -} - - -bool is_dependence_valid(ir_tree_node *src_node, ir_tree_node *dst_node, - const DependenceVector &dv, bool before) { - std::set loop_nodes; - ir_tree_node *itn = src_node; - - if (!dv.is_scalar_dependence) { - while (itn->parent != NULL) { - itn = itn->parent; - if (itn->content->type() == IR_CONTROL_LOOP) - loop_nodes.insert(itn); - } - - int last_dim = -1; - itn = dst_node; - while (itn->parent != NULL) { - itn = itn->parent; - if (itn->content->type() == IR_CONTROL_LOOP - && loop_nodes.find(itn) != loop_nodes.end() - && itn->payload > last_dim) - last_dim = itn->payload; - } - - if (last_dim == -1) - return true; - - for (int i = 0; i <= last_dim; i++) { - if (dv.lbounds[i] > 0) - return true; - else if (dv.lbounds[i] < 0) - return false; - } - - if (before) - return true; - else - return false; - } - - return true; - -} - - - -// Test data dependences between two statements. The first statement -// in parameter must be lexically before the second statement in -// parameter. Returned dependences are all lexicographically -// positive. The first vector in returned pair is dependences from the -// first statement to the second statement and the second vector in -// returned pair is in reverse order. -std::pair, std::vector > test_data_dependences( - IR_Code *ir, const CG_outputRepr *repr1, const Relation &IS1, - const CG_outputRepr *repr2, const Relation &IS2, - std::vector &freevar, std::vector index, - int i, int j) { - std::pair, std::vector > result; - - if (repr1 == repr2) { - std::vector access = ir->FindArrayRef(repr1); - - for (int i = 0; i < access.size(); i++) { - IR_ArrayRef *a = access[i]; - IR_ArraySymbol *sym_a = a->symbol(); - for (int j = i; j < access.size(); j++) { - IR_ArrayRef *b = access[j]; - IR_ArraySymbol *sym_b = b->symbol(); - - if (*sym_a == *sym_b && (a->is_write() || b->is_write())) { - Relation r = arrays2relation(ir, freevar, a, IS1, b, IS2); - std::pair, - std::vector > dv = - relation2dependences(a, b, r); - result.first.insert(result.first.end(), dv.first.begin(), - dv.first.end()); - result.second.insert(result.second.end(), dv.second.begin(), - dv.second.end()); - } - delete sym_b; - } - delete sym_a; - - } - - for (int i = 0; i < access.size(); i++) - delete access[i]; - } else { - std::vector access1 = ir->FindArrayRef(repr1); - std::vector access2 = ir->FindArrayRef(repr2); - - for (int i = 0; i < access1.size(); i++) { - IR_ArrayRef *a = access1[i]; - IR_ArraySymbol *sym_a = a->symbol(); - - for (int j = 0; j < access2.size(); j++) { - IR_ArrayRef *b = access2[j]; - IR_ArraySymbol *sym_b = b->symbol(); - if (*sym_a == *sym_b && (a->is_write() || b->is_write())) { - Relation r = arrays2relation(ir, freevar, a, IS1, b, IS2); - std::pair, - std::vector > dv = - relation2dependences(a, b, r); - - result.first.insert(result.first.end(), dv.first.begin(), - dv.first.end()); - result.second.insert(result.second.end(), dv.second.begin(), - dv.second.end()); - } - delete sym_b; - } - delete sym_a; - } - - for (int i = 0; i < access1.size(); i++) - delete access1[i]; - for (int i = 0; i < access2.size(); i++) - delete access2[i]; - } - /*std::pair, - std::vector > dv = - ir->FindScalarDeps(repr1, repr2, index, i, j); - - - result.first.insert(result.first.end(), dv.first.begin(), - dv.first.end()); - result.second.insert(result.second.end(), dv.second.begin(), - dv.second.end());*/ - /*result.first.insert(result.first.end(), dv.first.begin(), - dv.first.end()); - result.second.insert(result.second.end(), dv.second.begin(), - dv.second.end()); - */ - - return result; -} - diff --git a/irtools.hh b/irtools.hh deleted file mode 100644 index 8dc8e28..0000000 --- a/irtools.hh +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef IRTOOLS_HH -#define IRTOOLS_HH - -#include -#include -#include -#include "ir_code.hh" -#include "dep.hh" - -// IR tree is used to initialize a loop. For a loop node, payload is -// its mapped iteration space dimension. For a simple block node, -// payload is its mapped statement number. Normal if-else is splitted -// into two nodes where the one with odd payload represents then-part and -// the one with even payload represents else-part. -struct ir_tree_node { - IR_Control *content; - ir_tree_node *parent; - std::vector children; - int payload; - - ~ir_tree_node() { - for (int i = 0; i < children.size(); i++) - delete children[i]; - delete content; - } -}; - -std::vector build_ir_tree(IR_Control *control, - ir_tree_node *parent = NULL); -std::vector extract_ir_stmts( - const std::vector &ir_tree); -bool is_dependence_valid(ir_tree_node *src_node, ir_tree_node *dst_node, - const DependenceVector &dv, bool before); -std::pair, std::vector > test_data_dependences( - IR_Code *ir, const omega::CG_outputRepr *repr1, - const omega::Relation &IS1, const omega::CG_outputRepr *repr2, - const omega::Relation &IS2, std::vector &freevar, - std::vector index, int i, int j); - -#endif diff --git a/loop.cc b/loop.cc deleted file mode 100644 index 0a82f7a..0000000 --- a/loop.cc +++ /dev/null @@ -1,1870 +0,0 @@ -/***************************************************************************** - Copyright (C) 2008 University of Southern California - Copyright (C) 2009-2010 University of Utah - All Rights Reserved. - - Purpose: - Core loop transformation functionality. - - Notes: - "level" (starting from 1) means loop level and it corresponds to "dim" - (starting from 0) in transformed iteration space [c_1,l_1,c_2,l_2,...., - c_n,l_n,c_(n+1)], e.g., l_2 is loop level 2 in generated code, dim 3 - in transformed iteration space, and variable 4 in Omega relation. - All c's are constant numbers only and they will not show up as actual loops. - Formula: - dim = 2*level - 1 - var = dim + 1 - - History: - 10/2005 Created by Chun Chen. - 09/2009 Expand tile functionality, -chun - 10/2009 Initialize unfusible loop nest without bailing out, -chun -*****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include "loop.hh" -#include "omegatools.hh" -#include "irtools.hh" -#include "chill_error.hh" -#include -#include -using namespace omega; - -const std::string Loop::tmp_loop_var_name_prefix = std::string("chill_t"); // Manu:: In fortran, first character of a variable name must be a letter, so this change -const std::string Loop::overflow_var_name_prefix = std::string("over"); - -//----------------------------------------------------------------------------- -// Class Loop -//----------------------------------------------------------------------------- -// --begin Anand: Added from CHiLL 0.2 - -bool Loop::isInitialized() const { - return stmt.size() != 0 && !stmt[0].xform.is_null(); -} - -//--end Anand: added from CHiLL 0.2 - -bool Loop::init_loop(std::vector &ir_tree, - std::vector &ir_stmt) { - - ir_stmt = extract_ir_stmts(ir_tree); - stmt_nesting_level_.resize(ir_stmt.size()); - std::vector stmt_nesting_level(ir_stmt.size()); - for (int i = 0; i < ir_stmt.size(); i++) { - ir_stmt[i]->payload = i; - int t = 0; - ir_tree_node *itn = ir_stmt[i]; - while (itn->parent != NULL) { - itn = itn->parent; - if (itn->content->type() == IR_CONTROL_LOOP) - t++; - } - stmt_nesting_level_[i] = t; - stmt_nesting_level[i] = t; - } - - stmt = std::vector(ir_stmt.size()); - int n_dim = -1; - int max_loc; - //std::vector index; - for (int i = 0; i < ir_stmt.size(); i++) { - int max_nesting_level = -1; - int loc; - for (int j = 0; j < ir_stmt.size(); j++) - if (stmt_nesting_level[j] > max_nesting_level) { - max_nesting_level = stmt_nesting_level[j]; - loc = j; - } - - // most deeply nested statement acting as a reference point - if (n_dim == -1) { - n_dim = max_nesting_level; - max_loc = loc; - - index = std::vector(n_dim); - - ir_tree_node *itn = ir_stmt[loc]; - int cur_dim = n_dim - 1; - while (itn->parent != NULL) { - itn = itn->parent; - if (itn->content->type() == IR_CONTROL_LOOP) { - index[cur_dim] = - static_cast(itn->content)->index()->name(); - itn->payload = cur_dim--; - } - } - } - - // align loops by names, temporary solution - ir_tree_node *itn = ir_stmt[loc]; - int depth = stmt_nesting_level_[loc] - 1; - /* while (itn->parent != NULL) { - itn = itn->parent; - if (itn->content->type() == IR_CONTROL_LOOP && itn->payload == -1) { - std::string name = static_cast(itn->content)->index()->name(); - for (int j = 0; j < n_dim; j++) - if (index[j] == name) { - itn->payload = j; - break; - } - if (itn->payload == -1) - throw loop_error("no complex alignment yet"); - } - } - */ - for (int t = depth; t >= 0; t--) { - int y = t; - ir_tree_node *itn = ir_stmt[loc]; - - while ((itn->parent != NULL) && (y >= 0)) { - itn = itn->parent; - if (itn->content->type() == IR_CONTROL_LOOP) - y--; - } - - if (itn->content->type() == IR_CONTROL_LOOP && itn->payload == -1) { - CG_outputBuilder *ocg = ir->builder(); - - itn->payload = depth - t; - - CG_outputRepr *code = - static_cast(ir_stmt[loc]->content)->extract(); - - std::vector index_expr; - std::vector old_index; - CG_outputRepr *repl = ocg->CreateIdent(index[itn->payload]); - index_expr.push_back(repl); - old_index.push_back( - static_cast(itn->content)->index()->name()); - code = ocg->CreateSubstitutedStmt(0, code, old_index, - index_expr); - - replace.insert(std::pair(loc, code)); - //stmt[loc].code = code; - - } - } - - // set relation variable names - Relation r(n_dim); - F_And *f_root = r.add_and(); - itn = ir_stmt[loc]; - int temp_depth = depth; - while (itn->parent != NULL) { - - itn = itn->parent; - if (itn->content->type() == IR_CONTROL_LOOP) { - r.name_set_var(itn->payload + 1, index[temp_depth]); - - temp_depth--; - } - //static_cast(itn->content)->index()->name()); - } - - /*while (itn->parent != NULL) { - itn = itn->parent; - if (itn->content->type() == IR_CONTROL_LOOP) - r.name_set_var(itn->payload+1, static_cast(itn->content)->index()->name()); - }*/ - - // extract information from loop/if structures - std::vector processed(n_dim, false); - std::vector vars_to_be_reversed; - itn = ir_stmt[loc]; - while (itn->parent != NULL) { - itn = itn->parent; - - switch (itn->content->type()) { - case IR_CONTROL_LOOP: { - IR_Loop *lp = static_cast(itn->content); - Variable_ID v = r.set_var(itn->payload + 1); - int c; - - try { - c = lp->step_size(); - if (c > 0) { - CG_outputRepr *lb = lp->lower_bound(); - exp2formula(ir, r, f_root, freevar, lb, v, 's', - IR_COND_GE, true); - CG_outputRepr *ub = lp->upper_bound(); - IR_CONDITION_TYPE cond = lp->stop_cond(); - if (cond == IR_COND_LT || cond == IR_COND_LE) - exp2formula(ir, r, f_root, freevar, ub, v, 's', - cond, true); - else - throw ir_error("loop condition not supported"); - - } else if (c < 0) { - CG_outputBuilder *ocg = ir->builder(); - CG_outputRepr *lb = lp->lower_bound(); - lb = ocg->CreateMinus(NULL, lb); - exp2formula(ir, r, f_root, freevar, lb, v, 's', - IR_COND_GE, true); - CG_outputRepr *ub = lp->upper_bound(); - ub = ocg->CreateMinus(NULL, ub); - IR_CONDITION_TYPE cond = lp->stop_cond(); - if (cond == IR_COND_GE) - exp2formula(ir, r, f_root, freevar, ub, v, 's', - IR_COND_LE, true); - else if (cond == IR_COND_GT) - exp2formula(ir, r, f_root, freevar, ub, v, 's', - IR_COND_LT, true); - else - throw ir_error("loop condition not supported"); - - vars_to_be_reversed.push_back(lp->index()->name()); - } else - throw ir_error("loop step size zero"); - } catch (const ir_error &e) { - for (int i = 0; i < itn->children.size(); i++) - delete itn->children[i]; - itn->children = std::vector(); - itn->content = itn->content->convert(); - return false; - } - - if (abs(c) != 1) { - F_Exists *f_exists = f_root->add_exists(); - Variable_ID e = f_exists->declare(); - F_And *f_and = f_exists->add_and(); - Stride_Handle h = f_and->add_stride(abs(c)); - if (c > 0) - h.update_coef(e, 1); - else - h.update_coef(e, -1); - h.update_coef(v, -1); - CG_outputRepr *lb = lp->lower_bound(); - exp2formula(ir, r, f_and, freevar, lb, e, 's', IR_COND_EQ, - true); - } - - processed[itn->payload] = true; - break; - } - case IR_CONTROL_IF: { - CG_outputRepr *cond = - static_cast(itn->content)->condition(); - try { - if (itn->payload % 2 == 1) - exp2constraint(ir, r, f_root, freevar, cond, true); - else { - F_Not *f_not = f_root->add_not(); - F_And *f_and = f_not->add_and(); - exp2constraint(ir, r, f_and, freevar, cond, true); - } - } catch (const ir_error &e) { - std::vector *t; - if (itn->parent == NULL) - t = &ir_tree; - else - t = &(itn->parent->children); - int id = itn->payload; - int i = t->size() - 1; - while (i >= 0) { - if ((*t)[i] == itn) { - for (int j = 0; j < itn->children.size(); j++) - delete itn->children[j]; - itn->children = std::vector(); - itn->content = itn->content->convert(); - } else if ((*t)[i]->payload >> 1 == id >> 1) { - delete (*t)[i]; - t->erase(t->begin() + i); - } - i--; - } - return false; - } - - break; - } - default: - for (int i = 0; i < itn->children.size(); i++) - delete itn->children[i]; - itn->children = std::vector(); - itn->content = itn->content->convert(); - return false; - } - } - - // add information for missing loops - for (int j = 0; j < n_dim; j++) - if (!processed[j]) { - ir_tree_node *itn = ir_stmt[max_loc]; - while (itn->parent != NULL) { - itn = itn->parent; - if (itn->content->type() == IR_CONTROL_LOOP - && itn->payload == j) - break; - } - - Variable_ID v = r.set_var(j + 1); - if (loc < max_loc) { - - CG_outputBuilder *ocg = ir->builder(); - - CG_outputRepr *lb = - static_cast(itn->content)->lower_bound(); - - exp2formula(ir, r, f_root, freevar, lb, v, 's', IR_COND_EQ, - false); - - /* if (ir->QueryExpOperation( - static_cast(itn->content)->lower_bound()) - == IR_OP_VARIABLE) { - IR_ScalarRef *ref = - static_cast(ir->Repr2Ref( - static_cast(itn->content)->lower_bound())); - std::string name_ = ref->name(); - - for (int i = 0; i < index.size(); i++) - if (index[i] == name_) { - exp2formula(ir, r, f_root, freevar, lb, v, 's', - IR_COND_GE, false); - - CG_outputRepr *ub = - static_cast(itn->content)->upper_bound(); - IR_CONDITION_TYPE cond = - static_cast(itn->content)->stop_cond(); - if (cond == IR_COND_LT || cond == IR_COND_LE) - exp2formula(ir, r, f_root, freevar, ub, v, - 's', cond, false); - - - - } - - } - */ - - } else { // loc > max_loc - - CG_outputBuilder *ocg = ir->builder(); - CG_outputRepr *ub = - static_cast(itn->content)->upper_bound(); - - exp2formula(ir, r, f_root, freevar, ub, v, 's', IR_COND_EQ, - false); - /*if (ir->QueryExpOperation( - static_cast(itn->content)->upper_bound()) - == IR_OP_VARIABLE) { - IR_ScalarRef *ref = - static_cast(ir->Repr2Ref( - static_cast(itn->content)->upper_bound())); - std::string name_ = ref->name(); - - for (int i = 0; i < index.size(); i++) - if (index[i] == name_) { - - CG_outputRepr *lb = - static_cast(itn->content)->lower_bound(); - - exp2formula(ir, r, f_root, freevar, lb, v, 's', - IR_COND_GE, false); - - CG_outputRepr *ub = - static_cast(itn->content)->upper_bound(); - IR_CONDITION_TYPE cond = - static_cast(itn->content)->stop_cond(); - if (cond == IR_COND_LT || cond == IR_COND_LE) - exp2formula(ir, r, f_root, freevar, ub, v, - 's', cond, false); - - - } - } - */ - } - } - - r.setup_names(); - r.simplify(); - - // insert the statement - CG_outputBuilder *ocg = ir->builder(); - std::vector reverse_expr; - for (int j = 1; j <= vars_to_be_reversed.size(); j++) { - CG_outputRepr *repl = ocg->CreateIdent(vars_to_be_reversed[j]); - repl = ocg->CreateMinus(NULL, repl); - reverse_expr.push_back(repl); - } - CG_outputRepr *code = - static_cast(ir_stmt[loc]->content)->extract(); - code = ocg->CreateSubstitutedStmt(0, code, vars_to_be_reversed, - reverse_expr); - stmt[loc].code = code; - stmt[loc].IS = r; - stmt[loc].loop_level = std::vector(n_dim); - stmt[loc].ir_stmt_node = ir_stmt[loc]; - for (int i = 0; i < n_dim; i++) { - stmt[loc].loop_level[i].type = LoopLevelOriginal; - stmt[loc].loop_level[i].payload = i; - stmt[loc].loop_level[i].parallel_level = 0; - } - - stmt_nesting_level[loc] = -1; - } - - return true; -} - -Loop::Loop(const IR_Control *control) { - - last_compute_cgr_ = NULL; - last_compute_cg_ = NULL; - - ir = const_cast(control->ir_); - init_code = NULL; - cleanup_code = NULL; - tmp_loop_var_name_counter = 1; - overflow_var_name_counter = 1; - known = Relation::True(0); - - ir_tree = build_ir_tree(control->clone(), NULL); - // std::vector ir_stmt; - - while (!init_loop(ir_tree, ir_stmt)) { - } - - - - for (int i = 0; i < stmt.size(); i++) { - std::map::iterator it = replace.find(i); - - if (it != replace.end()) - stmt[i].code = it->second; - else - stmt[i].code = stmt[i].code; - } - - if (stmt.size() != 0) - dep = DependenceGraph(stmt[0].IS.n_set()); - else - dep = DependenceGraph(0); - // init the dependence graph - for (int i = 0; i < stmt.size(); i++) - dep.insert(); - - for (int i = 0; i < stmt.size(); i++) - for (int j = i; j < stmt.size(); j++) { - std::pair, - std::vector > dv = test_data_dependences( - ir, stmt[i].code, stmt[i].IS, stmt[j].code, stmt[j].IS, - freevar, index, stmt_nesting_level_[i], - stmt_nesting_level_[j]); - - for (int k = 0; k < dv.first.size(); k++) { - if (is_dependence_valid(ir_stmt[i], ir_stmt[j], dv.first[k], - true)) - dep.connect(i, j, dv.first[k]); - else { - dep.connect(j, i, dv.first[k].reverse()); - } - - } - for (int k = 0; k < dv.second.size(); k++) - if (is_dependence_valid(ir_stmt[j], ir_stmt[i], dv.second[k], - false)) - dep.connect(j, i, dv.second[k]); - else { - dep.connect(i, j, dv.second[k].reverse()); - } - // std::pair, - // std::vector > dv_ = test_data_dependences( - - } - - - - // init dumb transformation relations e.g. [i, j] -> [ 0, i, 0, j, 0] - for (int i = 0; i < stmt.size(); i++) { - int n = stmt[i].IS.n_set(); - stmt[i].xform = Relation(n, 2 * n + 1); - F_And *f_root = stmt[i].xform.add_and(); - - for (int j = 1; j <= n; j++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(stmt[i].xform.output_var(2 * j), 1); - h.update_coef(stmt[i].xform.input_var(j), -1); - } - - for (int j = 1; j <= 2 * n + 1; j += 2) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(stmt[i].xform.output_var(j), 1); - } - stmt[i].xform.simplify(); - } - - if (stmt.size() != 0) - num_dep_dim = stmt[0].IS.n_set(); - else - num_dep_dim = 0; - // debug - /*for (int i = 0; i < stmt.size(); i++) { - std::cout << i << ": "; - //stmt[i].xform.print(); - stmt[i].IS.print(); - std::cout << std::endl; - - }*/ - //end debug -} - -Loop::~Loop() { - - delete last_compute_cgr_; - delete last_compute_cg_; - - for (int i = 0; i < stmt.size(); i++) - if (stmt[i].code != NULL) { - stmt[i].code->clear(); - delete stmt[i].code; - } - - for (int i = 0; i < ir_tree.size(); i++) - delete ir_tree[i]; - - if (init_code != NULL) { - init_code->clear(); - delete init_code; - } - if (cleanup_code != NULL) { - cleanup_code->clear(); - delete cleanup_code; - } -} - -int Loop::get_dep_dim_of(int stmt_num, int level) const { - if (stmt_num < 0 || stmt_num >= stmt.size()) - throw std::invalid_argument("invaid statement " + to_string(stmt_num)); - - if (level < 1 || level > stmt[stmt_num].loop_level.size()) - return -1; - - int trip_count = 0; - while (true) { - switch (stmt[stmt_num].loop_level[level - 1].type) { - case LoopLevelOriginal: - return stmt[stmt_num].loop_level[level - 1].payload; - case LoopLevelTile: - level = stmt[stmt_num].loop_level[level - 1].payload; - if (level < 1) - return -1; - if (level > stmt[stmt_num].loop_level.size()) - throw loop_error( - "incorrect loop level information for statement " - + to_string(stmt_num)); - break; - default: - throw loop_error( - "unknown loop level information for statement " - + to_string(stmt_num)); - } - trip_count++; - if (trip_count >= stmt[stmt_num].loop_level.size()) - throw loop_error( - "incorrect loop level information for statement " - + to_string(stmt_num)); - } -} - -int Loop::get_last_dep_dim_before(int stmt_num, int level) const { - if (stmt_num < 0 || stmt_num >= stmt.size()) - throw std::invalid_argument("invaid statement " + to_string(stmt_num)); - - if (level < 1) - return -1; - if (level > stmt[stmt_num].loop_level.size()) - level = stmt[stmt_num].loop_level.size() + 1; - - for (int i = level - 1; i >= 1; i--) - if (stmt[stmt_num].loop_level[i - 1].type == LoopLevelOriginal) - return stmt[stmt_num].loop_level[i - 1].payload; - - return -1; -} - -void Loop::print_internal_loop_structure() const { - for (int i = 0; i < stmt.size(); i++) { - std::vector lex = getLexicalOrder(i); - std::cout << "s" << i + 1 << ": "; - for (int j = 0; j < stmt[i].loop_level.size(); j++) { - if (2 * j < lex.size()) - std::cout << lex[2 * j]; - switch (stmt[i].loop_level[j].type) { - case LoopLevelOriginal: - std::cout << "(dim:" << stmt[i].loop_level[j].payload << ")"; - break; - case LoopLevelTile: - std::cout << "(tile:" << stmt[i].loop_level[j].payload << ")"; - break; - default: - std::cout << "(unknown)"; - } - std::cout << ' '; - } - for (int j = 2 * stmt[i].loop_level.size(); j < lex.size(); j += 2) { - std::cout << lex[j]; - if (j != lex.size() - 1) - std::cout << ' '; - } - std::cout << std::endl; - } -} - -CG_outputRepr *Loop::getCode(int effort) const { - const int m = stmt.size(); - if (m == 0) - return NULL; - const int n = stmt[0].xform.n_out(); - - if (last_compute_cg_ == NULL) { - std::vector IS(m); - std::vector xforms(m); - for (int i = 0; i < m; i++) { - IS[i] = stmt[i].IS; - xforms[i] = stmt[i].xform; - } - Relation known = Extend_Set(copy(this->known), n - this->known.n_set()); - - last_compute_cg_ = new CodeGen(xforms, IS, known); - delete last_compute_cgr_; - last_compute_cgr_ = NULL; - } - - if (last_compute_cgr_ == NULL || last_compute_effort_ != effort) { - delete last_compute_cgr_; - last_compute_cgr_ = last_compute_cg_->buildAST(effort); - last_compute_effort_ = effort; - } - - std::vector stmts(m); - for (int i = 0; i < m; i++) - stmts[i] = stmt[i].code; - CG_outputBuilder *ocg = ir->builder(); - CG_outputRepr *repr = last_compute_cgr_->printRepr(ocg, stmts); - - if (init_code != NULL) - repr = ocg->StmtListAppend(init_code->clone(), repr); - if (cleanup_code != NULL) - repr = ocg->StmtListAppend(repr, cleanup_code->clone()); - - return repr; -} - -void Loop::printCode(int effort) const { - const int m = stmt.size(); - if (m == 0) - return; - const int n = stmt[0].xform.n_out(); - - if (last_compute_cg_ == NULL) { - std::vector IS(m); - std::vector xforms(m); - for (int i = 0; i < m; i++) { - IS[i] = stmt[i].IS; - xforms[i] = stmt[i].xform; - } - Relation known = Extend_Set(copy(this->known), n - this->known.n_set()); - - last_compute_cg_ = new CodeGen(xforms, IS, known); - delete last_compute_cgr_; - last_compute_cgr_ = NULL; - } - - if (last_compute_cgr_ == NULL || last_compute_effort_ != effort) { - delete last_compute_cgr_; - last_compute_cgr_ = last_compute_cg_->buildAST(effort); - last_compute_effort_ = effort; - } - - std::string repr = last_compute_cgr_->printString(); - std::cout << repr << std::endl; -} - -void Loop::printIterationSpace() const { - for (int i = 0; i < stmt.size(); i++) { - std::cout << "s" << i << ": "; - Relation r = getNewIS(i); - for (int j = 1; j <= r.n_inp(); j++) - r.name_input_var(j, CodeGen::loop_var_name_prefix + to_string(j)); - r.setup_names(); - r.print(); - } -} - -void Loop::printDependenceGraph() const { - if (dep.edgeCount() == 0) - std::cout << "no dependence exists" << std::endl; - else { - std::cout << "dependence graph:" << std::endl; - std::cout << dep; - } -} - -Relation Loop::getNewIS(int stmt_num) const { - Relation result; - - if (stmt[stmt_num].xform.is_null()) { - Relation known = Extend_Set(copy(this->known), - stmt[stmt_num].IS.n_set() - this->known.n_set()); - result = Intersection(copy(stmt[stmt_num].IS), known); - } else { - Relation known = Extend_Set(copy(this->known), - stmt[stmt_num].xform.n_out() - this->known.n_set()); - result = Intersection( - Range( - Restrict_Domain(copy(stmt[stmt_num].xform), - copy(stmt[stmt_num].IS))), known); - } - - result.simplify(2, 4); - - return result; -} - -std::vector Loop::getNewIS() const { - const int m = stmt.size(); - - std::vector new_IS(m); - for (int i = 0; i < m; i++) - new_IS[i] = getNewIS(i); - - return new_IS; -} - -void Loop::pragma(int stmt_num, int level, const std::string &pragmaText) { - // check sanity of parameters - if(stmt_num < 0) - throw std::invalid_argument("invalid statement " + to_string(stmt_num)); - - CG_outputBuilder *ocg = ir->builder(); - CG_outputRepr *code = stmt[stmt_num].code; - ocg->CreatePragmaAttribute(code, level, pragmaText); -} -/* -void Loop::prefetch(int stmt_num, int level, const std::string &arrName, const std::string &indexName, int offset, int hint) { - // check sanity of parameters - if(stmt_num < 0) - throw std::invalid_argument("invalid statement " + to_string(stmt_num)); - - CG_outputBuilder *ocg = ir->builder(); - CG_outputRepr *code = stmt[stmt_num].code; - ocg->CreatePrefetchAttribute(code, level, arrName, indexName, int offset, hint); -} -*/ - -void Loop::prefetch(int stmt_num, int level, const std::string &arrName, int hint) { - // check sanity of parameters - if(stmt_num < 0) - throw std::invalid_argument("invalid statement " + to_string(stmt_num)); - - CG_outputBuilder *ocg = ir->builder(); - CG_outputRepr *code = stmt[stmt_num].code; - ocg->CreatePrefetchAttribute(code, level, arrName, hint); -} - -std::vector Loop::getLexicalOrder(int stmt_num) const { - assert(stmt_num < stmt.size()); - - const int n = stmt[stmt_num].xform.n_out(); - std::vector lex(n, 0); - - for (int i = 0; i < n; i += 2) - lex[i] = get_const(stmt[stmt_num].xform, i, Output_Var); - - return lex; -} - -// find the sub loop nest specified by stmt_num and level, -// only iteration space satisfiable statements returned. -std::set Loop::getSubLoopNest(int stmt_num, int level) const { - assert(stmt_num >= 0 && stmt_num < stmt.size()); - assert(level > 0 && level <= stmt[stmt_num].loop_level.size()); - - std::set working; - for (int i = 0; i < stmt.size(); i++) - if (const_cast(this)->stmt[i].IS.is_upper_bound_satisfiable() - && stmt[i].loop_level.size() >= level) - working.insert(i); - - for (int i = 1; i <= level; i++) { - int a = getLexicalOrder(stmt_num, i); - for (std::set::iterator j = working.begin(); j != working.end();) { - int b = getLexicalOrder(*j, i); - if (b != a) - working.erase(j++); - else - ++j; - } - } - - return working; -} - -int Loop::getLexicalOrder(int stmt_num, int level) const { - assert(stmt_num >= 0 && stmt_num < stmt.size()); - assert(level > 0 && level <= stmt[stmt_num].loop_level.size()+1); - - Relation &r = const_cast(this)->stmt[stmt_num].xform; - for (EQ_Iterator e(r.single_conjunct()->EQs()); e; e++) - if (abs((*e).get_coef(r.output_var(2 * level - 1))) == 1) { - bool is_const = true; - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) - if (cvi.curr_var() != r.output_var(2 * level - 1)) { - is_const = false; - break; - } - if (is_const) { - int t = static_cast((*e).get_const()); - return (*e).get_coef(r.output_var(2 * level - 1)) > 0 ? -t : t; - } - } - - throw loop_error( - "can't find lexical order for statement " + to_string(stmt_num) - + "'s loop level " + to_string(level)); -} - -std::set Loop::getStatements(const std::vector &lex, int dim) const { - const int m = stmt.size(); - - std::set same_loops; - for (int i = 0; i < m; i++) { - if (dim < 0) - same_loops.insert(i); - else { - std::vector a_lex = getLexicalOrder(i); - int j; - for (j = 0; j <= dim; j += 2) - if (lex[j] != a_lex[j]) - break; - if (j > dim) - same_loops.insert(i); - } - - } - - return same_loops; -} - -void Loop::shiftLexicalOrder(const std::vector &lex, int dim, int amount) { - const int m = stmt.size(); - - if (amount == 0) - return; - - for (int i = 0; i < m; i++) { - std::vector lex2 = getLexicalOrder(i); - - bool need_shift = true; - - for (int j = 0; j < dim; j++) - if (lex2[j] != lex[j]) { - need_shift = false; - break; - } - - if (!need_shift) - continue; - - if (amount > 0) { - if (lex2[dim] < lex[dim]) - continue; - } else if (amount < 0) { - if (lex2[dim] > lex[dim]) - continue; - } - - assign_const(stmt[i].xform, dim, lex2[dim] + amount); - } -} - -std::vector > Loop::sort_by_same_loops(std::set active, - int level) { - - std::set not_nested_at_this_level; - std::map > sorted_by_loop; - std::map > sorted_by_lex_order; - std::vector > to_return; - bool lex_order_already_set = false; - for (std::set::iterator it = active.begin(); it != active.end(); - it++) { - - if (stmt[*it].ir_stmt_node == NULL) - lex_order_already_set = true; - } - - if (lex_order_already_set) { - - for (std::set::iterator it = active.begin(); it != active.end(); - it++) { - std::map >::iterator it2 = - sorted_by_lex_order.find( - get_const(stmt[*it].xform, 2 * (level - 1), - Output_Var)); - - if (it2 != sorted_by_lex_order.end()) - it2->second.insert(*it); - else { - - std::set to_insert; - - to_insert.insert(*it); - - sorted_by_lex_order.insert( - std::pair >( - get_const(stmt[*it].xform, 2 * (level - 1), - Output_Var), to_insert)); - - } - - } - - for (std::map >::iterator it2 = - sorted_by_lex_order.begin(); it2 != sorted_by_lex_order.end(); - it2++) - to_return.push_back(it2->second); - - } else { - - for (std::set::iterator it = active.begin(); it != active.end(); - it++) { - - ir_tree_node* itn = stmt[*it].ir_stmt_node; - itn = itn->parent; - while ((itn != NULL) && (itn->payload != level - 1)) - itn = itn->parent; - - if (itn == NULL) - not_nested_at_this_level.insert(*it); - else { - std::map >::iterator it2 = - sorted_by_loop.find(itn); - - if (it2 != sorted_by_loop.end()) - it2->second.insert(*it); - else { - std::set to_insert; - - to_insert.insert(*it); - - sorted_by_loop.insert( - std::pair >(itn, - to_insert)); - - } - - } - - } - if (not_nested_at_this_level.size() > 0) { - for (std::set::iterator it = not_nested_at_this_level.begin(); - it != not_nested_at_this_level.end(); it++) { - std::set temp; - temp.insert(*it); - to_return.push_back(temp); - - } - } - for (std::map >::iterator it2 = - sorted_by_loop.begin(); it2 != sorted_by_loop.end(); it2++) - to_return.push_back(it2->second); - } - return to_return; -} - -void update_successors(int n, int node_num[], int cant_fuse_with[], - Graph, bool> &g, std::list &work_list) { - - std::set disconnect; - for (Graph, bool>::EdgeList::iterator i = - g.vertex[n].second.begin(); i != g.vertex[n].second.end(); i++) { - int m = i->first; - - if (node_num[m] != -1) - throw loop_error("Graph input for fusion has cycles not a DAG!!"); - - std::vector check_ = g.getEdge(n, m); - - bool has_bad_edge_path = false; - for (int i = 0; i < check_.size(); i++) - if (!check_[i]) { - has_bad_edge_path = true; - break; - } - if (has_bad_edge_path) - cant_fuse_with[m] = std::max(cant_fuse_with[m], node_num[n]); - else - cant_fuse_with[m] = std::max(cant_fuse_with[m], cant_fuse_with[n]); - disconnect.insert(m); - } - - - for (std::set::iterator i = disconnect.begin(); i != disconnect.end(); - i++) { - g.disconnect(n, *i); - - bool no_incoming_edges = true; - for (int j = 0; j < g.vertex.size(); j++) - if (j != *i) - if (g.hasEdge(j, *i)) { - no_incoming_edges = false; - break; - } - - - if (no_incoming_edges) - work_list.push_back(*i); - } - -} - -Graph, bool> Loop::construct_induced_graph_at_level( - std::vector > s, DependenceGraph dep, int dep_dim) { - Graph, bool> g; - - for (int i = 0; i < s.size(); i++) - g.insert(s[i]); - - for (int i = 0; i < s.size(); i++) { - - for (int j = i + 1; j < s.size(); j++) { - bool has_true_edge_i_to_j = false; - bool has_true_edge_j_to_i = false; - bool is_connected_i_to_j = false; - bool is_connected_j_to_i = false; - for (std::set::iterator ii = s[i].begin(); ii != s[i].end(); - ii++) { - - for (std::set::iterator jj = s[j].begin(); - jj != s[j].end(); jj++) { - - std::vector dvs = dep.getEdge(*ii, *jj); - for (int k = 0; k < dvs.size(); k++) - if (dvs[k].is_control_dependence() - || (dvs[k].is_data_dependence() - && dvs[k].has_been_carried_at(dep_dim))) { - - if (dvs[k].is_data_dependence() - && dvs[k].has_negative_been_carried_at( - dep_dim)) { - //g.connect(i, j, false); - is_connected_i_to_j = true; - break; - } else { - //g.connect(i, j, true); - - has_true_edge_i_to_j = true; - //break - } - } - - //if (is_connected) - - // break; - // if (has_true_edge_i_to_j && !is_connected_i_to_j) - // g.connect(i, j, true); - dvs = dep.getEdge(*jj, *ii); - for (int k = 0; k < dvs.size(); k++) - if (dvs[k].is_control_dependence() - || (dvs[k].is_data_dependence() - && dvs[k].has_been_carried_at(dep_dim))) { - - if (is_connected_i_to_j || has_true_edge_i_to_j) - throw loop_error( - "Graph input for fusion has cycles not a DAG!!"); - - if (dvs[k].is_data_dependence() - && dvs[k].has_negative_been_carried_at( - dep_dim)) { - //g.connect(i, j, false); - is_connected_j_to_i = true; - break; - } else { - //g.connect(i, j, true); - - has_true_edge_j_to_i = true; - //break; - } - } - - // if (is_connected) - //break; - // if (is_connected) - //break; - } - - - //if (is_connected) - // break; - } - - - if (is_connected_i_to_j) - g.connect(i, j, false); - else if (has_true_edge_i_to_j) - g.connect(i, j, true); - - if (is_connected_j_to_i) - g.connect(j, i, false); - else if (has_true_edge_j_to_i) - g.connect(j, i, true); - - - } - } - return g; -} - -std::vector > Loop::typed_fusion(Graph, bool> g) { - - bool roots[g.vertex.size()]; - - for (int i = 0; i < g.vertex.size(); i++) - roots[i] = true; - - for (int i = 0; i < g.vertex.size(); i++) - for (int j = i + 1; j < g.vertex.size(); j++) { - - if (g.hasEdge(i, j)) - roots[j] = false; - - if (g.hasEdge(j, i)) - roots[i] = false; - - } - - std::list work_list; - int cant_fuse_with[g.vertex.size()]; - std::vector > s; - //Each Fused set's representative node - - int node_to_fused_nodes[g.vertex.size()]; - int node_num[g.vertex.size()]; - for (int i = 0; i < g.vertex.size(); i++) { - if (roots[i] == true) - work_list.push_back(i); - cant_fuse_with[i] = 0; - node_to_fused_nodes[i] = 0; - node_num[i] = -1; - } - // topological sort according to chun's permute algorithm - // std::vector > s = g.topoSort(); - std::vector > s2 = g.topoSort(); - if (work_list.empty() || (s2.size() != g.vertex.size())) { - - std::cout << s2.size() << "\t" << g.vertex.size() << std::endl; - throw loop_error("Input for fusion not a DAG!!"); - - - } - int fused_nodes_counter = 0; - while (!work_list.empty()) { - int n = work_list.front(); - //int n_ = g.vertex[n].first; - work_list.pop_front(); - int node; - if (cant_fuse_with[n] == 0) - node = 0; - else - node = cant_fuse_with[n]; - - if ((fused_nodes_counter != 0) && (node != fused_nodes_counter)) { - int rep_node = node_to_fused_nodes[node]; - node_num[n] = node_num[rep_node]; - - try { - update_successors(n, node_num, cant_fuse_with, g, work_list); - } catch (const loop_error &e) { - - throw loop_error( - "statements cannot be fused together due to negative dependence"); - - - } - for (std::set::iterator it = g.vertex[n].first.begin(); - it != g.vertex[n].first.end(); it++) - s[node].insert(*it); - } else { - //std::set new_node; - //new_node.insert(n_); - s.push_back(g.vertex[n].first); - node_to_fused_nodes[node] = n; - node_num[n] = ++node; - try { - update_successors(n, node_num, cant_fuse_with, g, work_list); - } catch (const loop_error &e) { - - throw loop_error( - "statements cannot be fused together due to negative dependence"); - - - } - fused_nodes_counter++; - } - } - - return s; -} - -void Loop::setLexicalOrder(int dim, const std::set &active, - int starting_order, std::vector > idxNames) { - if (active.size() == 0) - return; - - // check for sanity of parameters - if (dim < 0 || dim % 2 != 0) - throw std::invalid_argument( - "invalid constant loop level to set lexicographical order"); - std::vector lex; - int ref_stmt_num; - for (std::set::iterator i = active.begin(); i != active.end(); i++) { - if ((*i) < 0 || (*i) >= stmt.size()) - throw std::invalid_argument( - "invalid statement number " + to_string(*i)); - if (dim >= stmt[*i].xform.n_out()) - throw std::invalid_argument( - "invalid constant loop level to set lexicographical order"); - if (i == active.begin()) { - lex = getLexicalOrder(*i); - ref_stmt_num = *i; - } else { - std::vector lex2 = getLexicalOrder(*i); - for (int j = 0; j < dim; j += 2) - if (lex[j] != lex2[j]) - throw std::invalid_argument( - "statements are not in the same sub loop nest"); - } - } - - // sepearate statements by current loop level types - int level = (dim + 2) / 2; - std::map, std::set > active_by_level_type; - std::set active_by_no_level; - for (std::set::iterator i = active.begin(); i != active.end(); i++) { - if (level > stmt[*i].loop_level.size()) - active_by_no_level.insert(*i); - else - active_by_level_type[std::make_pair( - stmt[*i].loop_level[level - 1].type, - stmt[*i].loop_level[level - 1].payload)].insert(*i); - } - - // further separate statements due to control dependences - std::vector > active_by_level_type_splitted; - for (std::map, std::set >::iterator i = - active_by_level_type.begin(); i != active_by_level_type.end(); i++) - active_by_level_type_splitted.push_back(i->second); - for (std::set::iterator i = active_by_no_level.begin(); - i != active_by_no_level.end(); i++) - for (int j = active_by_level_type_splitted.size() - 1; j >= 0; j--) { - std::set controlled, not_controlled; - for (std::set::iterator k = - active_by_level_type_splitted[j].begin(); - k != active_by_level_type_splitted[j].end(); k++) { - std::vector dvs = dep.getEdge(*i, *k); - bool is_controlled = false; - for (int kk = 0; kk < dvs.size(); kk++) - if (dvs[kk].type = DEP_CONTROL) { - is_controlled = true; - break; - } - if (is_controlled) - controlled.insert(*k); - else - not_controlled.insert(*k); - } - if (controlled.size() != 0 && not_controlled.size() != 0) { - active_by_level_type_splitted.erase( - active_by_level_type_splitted.begin() + j); - active_by_level_type_splitted.push_back(controlled); - active_by_level_type_splitted.push_back(not_controlled); - } - } - - // set lexical order separating loops with different loop types first - if (active_by_level_type_splitted.size() + active_by_no_level.size() > 1) { - int dep_dim = get_last_dep_dim_before(ref_stmt_num, level) + 1; - - Graph, Empty> g; - for (std::vector >::iterator i = - active_by_level_type_splitted.begin(); - i != active_by_level_type_splitted.end(); i++) - g.insert(*i); - for (std::set::iterator i = active_by_no_level.begin(); - i != active_by_no_level.end(); i++) { - std::set t; - t.insert(*i); - g.insert(t); - } - for (int i = 0; i < g.vertex.size(); i++) - for (int j = i + 1; j < g.vertex.size(); j++) { - bool connected = false; - for (std::set::iterator ii = g.vertex[i].first.begin(); - ii != g.vertex[i].first.end(); ii++) { - for (std::set::iterator jj = g.vertex[j].first.begin(); - jj != g.vertex[j].first.end(); jj++) { - std::vector dvs = dep.getEdge(*ii, - *jj); - for (int k = 0; k < dvs.size(); k++) - if (dvs[k].is_control_dependence() - || (dvs[k].is_data_dependence() - && !dvs[k].has_been_carried_before( - dep_dim))) { - g.connect(i, j); - connected = true; - break; - } - if (connected) - break; - } - if (connected) - break; - } - connected = false; - for (std::set::iterator ii = g.vertex[i].first.begin(); - ii != g.vertex[i].first.end(); ii++) { - for (std::set::iterator jj = g.vertex[j].first.begin(); - jj != g.vertex[j].first.end(); jj++) { - std::vector dvs = dep.getEdge(*jj, - *ii); - // find the sub loop nest specified by stmt_num and level, - // only iteration space satisfiable statements returned. - for (int k = 0; k < dvs.size(); k++) - if (dvs[k].is_control_dependence() - || (dvs[k].is_data_dependence() - && !dvs[k].has_been_carried_before( - dep_dim))) { - g.connect(j, i); - connected = true; - break; - } - if (connected) - break; - } - if (connected) - break; - } - } - - std::vector > s = g.topoSort(); - if (s.size() != g.vertex.size()) - throw loop_error( - "cannot separate statements with different loop types at loop level " - + to_string(level)); - - // assign lexical order - int order = starting_order; - for (int i = 0; i < s.size(); i++) { - std::set &cur_scc = g.vertex[*(s[i].begin())].first; - int sz = cur_scc.size(); - if (sz == 1) { - int cur_stmt = *(cur_scc.begin()); - assign_const(stmt[cur_stmt].xform, dim, order); - for (int j = dim + 2; j < stmt[cur_stmt].xform.n_out(); j += 2) - assign_const(stmt[cur_stmt].xform, j, 0); - order++; - } else { - setLexicalOrder(dim, cur_scc, order, idxNames); - order += sz; - } - } - } - // set lexical order seperating single iteration statements and loops - else { - std::set true_singles; - std::set nonsingles; - std::map > fake_singles; - std::set fake_singles_; - - // sort out statements that do not require loops - for (std::set::iterator i = active.begin(); i != active.end(); - i++) { - Relation cur_IS = getNewIS(*i); - if (is_single_iteration(cur_IS, dim + 1)) { - bool is_all_single = true; - for (int j = dim + 3; j < stmt[*i].xform.n_out(); j += 2) - if (!is_single_iteration(cur_IS, j)) { - is_all_single = false; - break; - } - if (is_all_single) - true_singles.insert(*i); - else { - fake_singles_.insert(*i); - try { - fake_singles[get_const(cur_IS, dim + 1, Set_Var)].insert( - *i); - } catch (const std::exception &e) { - fake_singles[posInfinity].insert(*i); - } - } - } else - nonsingles.insert(*i); - } - - - // split nonsingles forcibly according to negative dependences present (loop unfusible) - int dep_dim = get_dep_dim_of(ref_stmt_num, level); - - if (dim < stmt[ref_stmt_num].xform.n_out() - 1) { - - bool dummy_level_found = false; - - std::vector > s; - - s = sort_by_same_loops(active, level); - bool further_levels_exist = false; - - if (!idxNames.empty()) - if (level <= idxNames[ref_stmt_num].size()) - if (idxNames[ref_stmt_num][level - 1].length() == 0) { - // && s.size() == 1) { - int order1 = 0; - dummy_level_found = true; - - for (int i = level; i < idxNames[ref_stmt_num].size(); - i++) - if (idxNames[ref_stmt_num][i].length() > 0) - further_levels_exist = true; - - } - - //if (!dummy_level_found) { - - if (s.size() > 1) { - - Graph, bool> g = construct_induced_graph_at_level( - s, dep, dep_dim); - s = typed_fusion(g); - } - int order = 0; - for (int i = 0; i < s.size(); i++) { - - for (std::set::iterator it = s[i].begin(); - it != s[i].end(); it++) - assign_const(stmt[*it].xform, dim, order); - - if ((dim + 2) <= (stmt[ref_stmt_num].xform.n_out() - 1)) - setLexicalOrder(dim + 2, s[i], order, idxNames); - - order++; - } - //} - /* else { - - int order1 = 0; - int order = 0; - for (std::set::iterator i = active.begin(); - i != active.end(); i++) { - if (!further_levels_exist) - assign_const(stmt[*i].xform, dim, order1++); - else - assign_const(stmt[*i].xform, dim, order1); - - } - - if ((dim + 2) <= (stmt[ref_stmt_num].xform.n_out() - 1) && further_levels_exist) - setLexicalOrder(dim + 2, active, order, idxNames); - } - */ - } else { - int dummy_order = 0; - for (std::set::iterator i = active.begin(); i != active.end(); - i++) - assign_const(stmt[*i].xform, dim, dummy_order++); - } - /*for (int i = 0; i < g2.vertex.size(); i++) - for (int j = i+1; j < g2.vertex.size(); j++) { - std::vector dvs = dep.getEdge(g2.vertex[i].first, g2.vertex[j].first); - for (int k = 0; k < dvs.size(); k++) - if (dvs[k].is_control_dependence() || - (dvs[k].is_data_dependence() && dvs[k].has_negative_been_carried_at(dep_dim))) { - g2.connect(i, j); - break; - } - dvs = dep.getEdge(g2.vertex[j].first, g2.vertex[i].first); - for (int k = 0; k < dvs.size(); k++) - if (dvs[k].is_control_dependence() || - (dvs[k].is_data_dependence() && dvs[k].has_negative_been_carried_at(dep_dim))) { - g2.connect(j, i); - break; - } - } - - std::vector > s2 = g2.packed_topoSort(); - - std::vector > splitted_nonsingles; - for (int i = 0; i < s2.size(); i++) { - std::set cur_scc; - for (std::set::iterator j = s2[i].begin(); j != s2[i].end(); j++) - cur_scc.insert(g2.vertex[*j].first); - splitted_nonsingles.push_back(cur_scc); - } - */ - //convert to dependence graph for grouped statements - //dep_dim = get_last_dep_dim_before(ref_stmt_num, level) + 1; - /*int order = 0; - for (std::set::iterator j = active.begin(); j != active.end(); - j++) { - std::set continuous; - std::cout<< active.size()< 0) { - std::vector > s = typed_fusion(continuous, dep, - dep_dim); - - for (int i = 0; i < s.size(); i++) { - for (std::set::iterator l = s[i].begin(); - l != s[i].end(); l++) { - assign_const(stmt[*l].xform, dim + 2, order); - setLexicalOrder(dim + 2, s[i]); - } - order++; - } - } - - if (j != active.end()) { - assign_const(stmt[*j].xform, dim + 2, order); - - for (int k = dim + 4; k < stmt[*j].xform.n_out(); k += 2) - assign_const(stmt[*j].xform, k, 0); - order++; - } - - if( j == active.end()) - break; - } - */ - - - // assign lexical order - /*int order = starting_order; - for (int i = 0; i < s.size(); i++) { - // translate each SCC into original statements - std::set cur_scc; - for (std::set::iterator j = s[i].begin(); j != s[i].end(); j++) - copy(s[i].begin(), s[i].end(), - inserter(cur_scc, cur_scc.begin())); - - // now assign the constant - for (std::set::iterator j = cur_scc.begin(); - j != cur_scc.end(); j++) - assign_const(stmt[*j].xform, dim, order); - - if (cur_scc.size() > 1) - setLexicalOrder(dim + 2, cur_scc); - else if (cur_scc.size() == 1) { - int cur_stmt = *(cur_scc.begin()); - for (int j = dim + 2; j < stmt[cur_stmt].xform.n_out(); j += 2) - assign_const(stmt[cur_stmt].xform, j, 0); - } - - if (cur_scc.size() > 0) - order++; - } - */ - } -} - -void Loop::apply_xform() { - std::set active; - for (int i = 0; i < stmt.size(); i++) - active.insert(i); - apply_xform(active); -} - -void Loop::apply_xform(int stmt_num) { - std::set active; - active.insert(stmt_num); - apply_xform(active); -} - -void Loop::apply_xform(std::set &active) { - int max_n = 0; - - CG_outputBuilder *ocg = ir->builder(); - for (std::set::iterator i = active.begin(); i != active.end(); i++) { - int n = stmt[*i].loop_level.size(); - if (n > max_n) - max_n = n; - - std::vector lex = getLexicalOrder(*i); - - Relation mapping(2 * n + 1, n); - F_And *f_root = mapping.add_and(); - for (int j = 1; j <= n; j++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.output_var(j), 1); - h.update_coef(mapping.input_var(2 * j), -1); - } - mapping = Composition(mapping, stmt[*i].xform); - mapping.simplify(); - - // match omega input/output variables to variable names in the code - for (int j = 1; j <= stmt[*i].IS.n_set(); j++) - mapping.name_input_var(j, stmt[*i].IS.set_var(j)->name()); - for (int j = 1; j <= n; j++) - mapping.name_output_var(j, - tmp_loop_var_name_prefix - + to_string(tmp_loop_var_name_counter + j - 1)); - mapping.setup_names(); - - Relation known = Extend_Set(copy(this->known), - mapping.n_out() - this->known.n_set()); - //stmt[*i].code = outputStatement(ocg, stmt[*i].code, 0, mapping, known, std::vector(mapping.n_out(), NULL)); - std::vector loop_vars; - for (int j = 1; j <= stmt[*i].IS.n_set(); j++) - loop_vars.push_back(stmt[*i].IS.set_var(j)->name()); - std::vector subs = output_substitutions(ocg, - Inverse(copy(mapping)), - std::vector >(mapping.n_out(), - std::make_pair(static_cast(NULL), 0))); - stmt[*i].code = ocg->CreateSubstitutedStmt(0, stmt[*i].code, loop_vars, - subs); - stmt[*i].IS = Range(Restrict_Domain(mapping, stmt[*i].IS)); - stmt[*i].IS.simplify(); - - // replace original transformation relation with straight 1-1 mapping - mapping = Relation(n, 2 * n + 1); - f_root = mapping.add_and(); - for (int j = 1; j <= n; j++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.output_var(2 * j), 1); - h.update_coef(mapping.input_var(j), -1); - } - for (int j = 1; j <= 2 * n + 1; j += 2) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.output_var(j), 1); - h.update_const(-lex[j - 1]); - } - stmt[*i].xform = mapping; - } - - tmp_loop_var_name_counter += max_n; -} - -void Loop::addKnown(const Relation &cond) { - - // invalidate saved codegen computation - delete last_compute_cgr_; - last_compute_cgr_ = NULL; - delete last_compute_cg_; - last_compute_cg_ = NULL; - - int n1 = this->known.n_set(); - - Relation r = copy(cond); - int n2 = r.n_set(); - - if (n1 < n2) - this->known = Extend_Set(this->known, n2 - n1); - else if (n1 > n2) - r = Extend_Set(r, n1 - n2); - - this->known = Intersection(this->known, r); -} - -void Loop::removeDependence(int stmt_num_from, int stmt_num_to) { - // check for sanity of parameters - if (stmt_num_from >= stmt.size()) - throw std::invalid_argument( - "invalid statement number " + to_string(stmt_num_from)); - if (stmt_num_to >= stmt.size()) - throw std::invalid_argument( - "invalid statement number " + to_string(stmt_num_to)); - - dep.disconnect(stmt_num_from, stmt_num_to); -} - -void Loop::dump() const { - for (int i = 0; i < stmt.size(); i++) { - std::vector lex = getLexicalOrder(i); - std::cout << "s" << i + 1 << ": "; - for (int j = 0; j < stmt[i].loop_level.size(); j++) { - if (2 * j < lex.size()) - std::cout << lex[2 * j]; - switch (stmt[i].loop_level[j].type) { - case LoopLevelOriginal: - std::cout << "(dim:" << stmt[i].loop_level[j].payload << ")"; - break; - case LoopLevelTile: - std::cout << "(tile:" << stmt[i].loop_level[j].payload << ")"; - break; - default: - std::cout << "(unknown)"; - } - std::cout << ' '; - } - for (int j = 2 * stmt[i].loop_level.size(); j < lex.size(); j += 2) { - std::cout << lex[j]; - if (j != lex.size() - 1) - std::cout << ' '; - } - std::cout << std::endl; - } -} - -bool Loop::nonsingular(const std::vector > &T) { - if (stmt.size() == 0) - return true; - - // check for sanity of parameters - for (int i = 0; i < stmt.size(); i++) { - if (stmt[i].loop_level.size() != num_dep_dim) - throw std::invalid_argument( - "nonsingular loop transformations must be applied to original perfect loop nest"); - for (int j = 0; j < stmt[i].loop_level.size(); j++) - if (stmt[i].loop_level[j].type != LoopLevelOriginal) - throw std::invalid_argument( - "nonsingular loop transformations must be applied to original perfect loop nest"); - } - if (T.size() != num_dep_dim) - throw std::invalid_argument("invalid transformation matrix"); - for (int i = 0; i < stmt.size(); i++) - if (T[i].size() != num_dep_dim + 1 && T[i].size() != num_dep_dim) - throw std::invalid_argument("invalid transformation matrix"); - // invalidate saved codegen computation - delete last_compute_cgr_; - last_compute_cgr_ = NULL; - delete last_compute_cg_; - last_compute_cg_ = NULL; - // build relation from matrix - Relation mapping(2 * num_dep_dim + 1, 2 * num_dep_dim + 1); - F_And *f_root = mapping.add_and(); - for (int i = 0; i < num_dep_dim; i++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.output_var(2 * (i + 1)), -1); - for (int j = 0; j < num_dep_dim; j++) - if (T[i][j] != 0) - h.update_coef(mapping.input_var(2 * (j + 1)), T[i][j]); - if (T[i].size() == num_dep_dim + 1) - h.update_const(T[i][num_dep_dim]); - } - for (int i = 1; i <= 2 * num_dep_dim + 1; i += 2) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.output_var(i), -1); - h.update_coef(mapping.input_var(i), 1); - } - - // update transformation relations - for (int i = 0; i < stmt.size(); i++) - stmt[i].xform = Composition(copy(mapping), stmt[i].xform); - - // update dependence graph - for (int i = 0; i < dep.vertex.size(); i++) - for (DependenceGraph::EdgeList::iterator j = - dep.vertex[i].second.begin(); j != dep.vertex[i].second.end(); - j++) { - std::vector dvs = j->second; - for (int k = 0; k < dvs.size(); k++) { - DependenceVector &dv = dvs[k]; - switch (dv.type) { - case DEP_W2R: - case DEP_R2W: - case DEP_W2W: - case DEP_R2R: { - std::vector lbounds(num_dep_dim), ubounds( - num_dep_dim); - for (int p = 0; p < num_dep_dim; p++) { - coef_t lb = 0; - coef_t ub = 0; - for (int q = 0; q < num_dep_dim; q++) { - if (T[p][q] > 0) { - if (lb == -posInfinity - || dv.lbounds[q] == -posInfinity) - lb = -posInfinity; - else - lb += T[p][q] * dv.lbounds[q]; - if (ub == posInfinity - || dv.ubounds[q] == posInfinity) - ub = posInfinity; - else - ub += T[p][q] * dv.ubounds[q]; - } else if (T[p][q] < 0) { - if (lb == -posInfinity - || dv.ubounds[q] == posInfinity) - lb = -posInfinity; - else - lb += T[p][q] * dv.ubounds[q]; - if (ub == posInfinity - || dv.lbounds[q] == -posInfinity) - ub = posInfinity; - else - ub += T[p][q] * dv.lbounds[q]; - } - } - if (T[p].size() == num_dep_dim + 1) { - if (lb != -posInfinity) - lb += T[p][num_dep_dim]; - if (ub != posInfinity) - ub += T[p][num_dep_dim]; - } - lbounds[p] = lb; - ubounds[p] = ub; - } - dv.lbounds = lbounds; - dv.ubounds = ubounds; - - break; - } - default: - ; - } - } - j->second = dvs; - } - - // set constant loop values - std::set active; - for (int i = 0; i < stmt.size(); i++) - active.insert(i); - setLexicalOrder(0, active); - - return true; -} - - -bool Loop::is_dependence_valid_based_on_lex_order(int i, int j, - const DependenceVector &dv, bool before) { - std::vector lex_i = getLexicalOrder(i); - std::vector lex_j = getLexicalOrder(j); - int last_dim; - if (!dv.is_scalar_dependence) { - for (last_dim = 0; - last_dim < lex_i.size() && (lex_i[last_dim] == lex_j[last_dim]); - last_dim++) - ; - last_dim = last_dim / 2; - if (last_dim == 0) - return true; - - for (int i = 0; i < last_dim; i++) { - if (dv.lbounds[i] > 0) - return true; - else if (dv.lbounds[i] < 0) - return false; - } - } - if (before) - return true; - - return false; - -} - diff --git a/loop.hh b/loop.hh deleted file mode 100644 index c3366ef..0000000 --- a/loop.hh +++ /dev/null @@ -1,168 +0,0 @@ -#ifndef LOOP_HH -#define LOOP_HH - -#include -#include -#include -#include -#include -#include -#include "dep.hh" -#include "ir_code.hh" -#include "irtools.hh" - -class IR_Code; - -enum TilingMethodType { StridedTile, CountedTile }; -enum LoopLevelType { LoopLevelOriginal, LoopLevelTile, LoopLevelUnknown }; - - -// Describes properties of each loop level of a statement. "payload" -// for LoopLevelOriginal means iteration space dimension, for -// LoopLevelTile means tiled loop level. Special value -1 for -// LoopLevelTile means purely derived loop. For dependence dimension -// payloads, the values must be in an increasing order. -// "parallel_level" will be used by code generation to support -// multi-level parallelization (default 0 means sequential loop under -// the current parallelization level). -struct LoopLevel { - LoopLevelType type; - int payload; - int parallel_level; -}; - -struct Statement { - omega::CG_outputRepr *code; - omega::Relation IS; - omega::Relation xform; - std::vector loop_level; - ir_tree_node *ir_stmt_node; - //protonu--temporarily putting this back here - //omega::Tuple nonSplitLevels; - //end--protonu. -}; - - -class Loop { -protected: - int tmp_loop_var_name_counter; - static const std::string tmp_loop_var_name_prefix; - int overflow_var_name_counter; - static const std::string overflow_var_name_prefix; - std::vector stmt_nesting_level_; - std::vector index; - std::map replace; - -public: - IR_Code *ir; - std::vector freevar; - std::vector stmt; - std::vector ir_stmt; - std::vector ir_tree; - DependenceGraph dep; - int num_dep_dim; - omega::Relation known; - omega::CG_outputRepr *init_code; - omega::CG_outputRepr *cleanup_code; - std::map > overflow; - - -protected: - mutable omega::CodeGen *last_compute_cg_; - mutable omega::CG_result *last_compute_cgr_; - mutable int last_compute_effort_; - -protected: - bool init_loop(std::vector &ir_tree, std::vector &ir_stmt); - int get_dep_dim_of(int stmt, int level) const; - int get_last_dep_dim_before(int stmt, int level) const; - std::vector getNewIS() const; - omega::Relation getNewIS(int stmt_num) const; - std::vector getLexicalOrder(int stmt_num) const; - int getLexicalOrder(int stmt_num, int level) const; - std::set getStatements(const std::vector &lex, int dim) const; - void shiftLexicalOrder(const std::vector &lex, int dim, int amount); - void setLexicalOrder(int dim, const std::set &active, int starting_order = 0, std::vector< std::vector >idxNames= std::vector< std::vector >()); - void apply_xform(int stmt_num); - void apply_xform(std::set &active); - void apply_xform(); - std::set getSubLoopNest(int stmt_num, int level) const; - - -public: - Loop() { ir = NULL; tmp_loop_var_name_counter = 1; init_code = NULL; } - Loop(const IR_Control *control); - ~Loop(); - - omega::CG_outputRepr *getCode(int effort = 1) const; - void printCode(int effort = 1) const; - void addKnown(const omega::Relation &cond); - void print_internal_loop_structure() const; - bool isInitialized() const; - int num_statement() const { return stmt.size(); } - void printIterationSpace() const; - void printDependenceGraph() const; - void removeDependence(int stmt_num_from, int stmt_num_to); - void dump() const; - - std::vector > sort_by_same_loops(std::set active, int level); - // - // legacy unimodular transformations for perfectly nested loops - // e.g. M*(i,j)^T = (i',j')^T or M*(i,j,1)^T = (i',j')^T - // - bool nonsingular(const std::vector > &M); - - // - // high-level loop transformations - // - void permute(const std::set &active, const std::vector &pi); - void permute(int stmt_num, int level, const std::vector &pi); - void permute(const std::vector &pi); - void original(); - - void tile(int stmt_num, int level, int tile_size, int outer_level = 1, TilingMethodType method = StridedTile, int alignment_offset = 0, int alignment_multiple = 1); - std::set split(int stmt_num, int level, const omega::Relation &cond); - std::set unroll(int stmt_num, int level, int unroll_amount, std::vector< std::vector >idxNames= std::vector< std::vector >(), int cleanup_split_level = 0); - - bool datacopy(const std::vector > > &array_ref_nums, int level, bool allow_extra_read = false, int fastest_changing_dimension = -1, int padding_stride = 1, int padding_alignment = 4, int memory_type = 0); - bool datacopy(int stmt_num, int level, const std::string &array_name, bool allow_extra_read = false, int fastest_changing_dimension = -1, int padding_stride = 1, int padding_alignment = 4, int memory_type = 0); - bool datacopy_privatized(int stmt_num, int level, const std::string &array_name, const std::vector &privatized_levels, bool allow_extra_read = false, int fastest_changing_dimension = -1, int padding_stride = 1, int padding_alignment = 1, int memory_type = 0); - bool datacopy_privatized(const std::vector > > &array_ref_nums, int level, const std::vector &privatized_levels, bool allow_extra_read = false, int fastest_changing_dimension = -1, int padding_stride = 1, int padding_alignment = 1, int memory_type = 0); - bool datacopy_privatized(const std::vector > > &stmt_refs, int level, const std::vector &privatized_levels, bool allow_extra_read, int fastest_changing_dimension, int padding_stride, int padding_alignment, int memory_type = 0); - //std::set scalar_replacement_inner(int stmt_num); - - - - Graph, bool> construct_induced_graph_at_level(std::vector > s, DependenceGraph dep, int dep_dim); - std::vector > typed_fusion(Graph, bool> g); - void fuse(const std::set &stmt_nums, int level); - void distribute(const std::set &stmt_nums, int level); - void skew(const std::set &stmt_nums, int level, const std::vector &skew_amount); - void shift(const std::set &stmt_nums, int level, int shift_amount); - void scale(const std::set &stmt_nums, int level, int scale_amount); - void reverse(const std::set &stmt_nums, int level); - void peel(int stmt_num, int level, int peel_amount = 1); - // - // more fancy loop transformations - // - void modular_shift(int stmt_num, int level, int shift_amount) {} - void diagonal_map(int stmt_num, const std::pair &levels, int offset) {} - void modular_partition(int stmt_num, int level, int stride) {} - - // - // derived loop transformations - // - void shift_to(int stmt_num, int level, int absolute_position); - std::set unroll_extra(int stmt_num, int level, int unroll_amount, int cleanup_split_level = 0); - bool is_dependence_valid_based_on_lex_order(int i, int j, - const DependenceVector &dv, bool before); - // - // other public operations - // - void pragma(int stmt_num, int level, const std::string &pragmaText); - void prefetch(int stmt_num, int level, const std::string &arrName, int hint); - //void prefetch(int stmt_num, int level, const std::string &arrName, const std::string &indexName, int offset, int hint); -}; - - -#endif diff --git a/loop_basic.cc b/loop_basic.cc deleted file mode 100644 index f5234b9..0000000 --- a/loop_basic.cc +++ /dev/null @@ -1,1538 +0,0 @@ -/* - * loop_basic.cc - * - * Created on: Nov 12, 2012 - * Author: anand - */ - -#include "loop.hh" -#include "chill_error.hh" -#include -#include "omegatools.hh" -#include - -using namespace omega; - -void Loop::permute(const std::vector &pi) { - std::set active; - for (int i = 0; i < stmt.size(); i++) - active.insert(i); - - permute(active, pi); -} - -void Loop::original() { - std::set active; - for (int i = 0; i < stmt.size(); i++) - active.insert(i); - setLexicalOrder(0, active); -} -void Loop::permute(int stmt_num, int level, const std::vector &pi) { - // check for sanity of parameters - int starting_order; - if (stmt_num < 0 || stmt_num >= stmt.size()) - throw std::invalid_argument( - "invalid statement number " + to_string(stmt_num)); - std::set active; - if (level < 0 || level > stmt[stmt_num].loop_level.size()) - throw std::invalid_argument("invalid loop level " + to_string(level)); - else if (level == 0) { - for (int i = 0; i < stmt.size(); i++) - active.insert(i); - level = 1; - starting_order = 0; - } else { - std::vector lex = getLexicalOrder(stmt_num); - active = getStatements(lex, 2 * level - 2); - starting_order = lex[2 * level - 2]; - lex[2 * level - 2]++; - shiftLexicalOrder(lex, 2 * level - 2, active.size() - 1); - } - std::vector pi_inverse(pi.size(), 0); - for (int i = 0; i < pi.size(); i++) { - if (pi[i] >= level + pi.size() || pi[i] < level - || pi_inverse[pi[i] - level] != 0) - throw std::invalid_argument("invalid permuation"); - pi_inverse[pi[i] - level] = level + i; - } - for (std::set::iterator i = active.begin(); i != active.end(); i++) - if (level + pi.size() - 1 > stmt[*i].loop_level.size()) - throw std::invalid_argument( - "invalid permutation for statement " + to_string(*i)); - - // invalidate saved codegen computation - delete last_compute_cgr_; - last_compute_cgr_ = NULL; - delete last_compute_cg_; - last_compute_cg_ = NULL; - - // Update transformation relations - for (std::set::iterator i = active.begin(); i != active.end(); i++) { - int n = stmt[*i].xform.n_out(); - Relation mapping(n, n); - F_And *f_root = mapping.add_and(); - for (int j = 1; j <= 2 * level - 2; j++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.output_var(j), 1); - h.update_coef(mapping.input_var(j), -1); - } - for (int j = level; j <= level + pi.size() - 1; j++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.output_var(2 * j), 1); - h.update_coef(mapping.input_var(2 * pi[j - level]), -1); - } - for (int j = level; j <= level + pi.size() - 1; j++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.output_var(2 * j - 1), 1); - h.update_coef(mapping.input_var(2 * j - 1), -1); - } - for (int j = 2 * (level + pi.size() - 1) + 1; j <= n; j++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.output_var(j), 1); - h.update_coef(mapping.input_var(j), -1); - } - stmt[*i].xform = Composition(mapping, stmt[*i].xform); - stmt[*i].xform.simplify(); - } - - // get the permuation for dependence vectors - std::vector t; - for (int i = 0; i < pi.size(); i++) - if (stmt[stmt_num].loop_level[pi[i] - 1].type == LoopLevelOriginal) - t.push_back(stmt[stmt_num].loop_level[pi[i] - 1].payload); - int max_dep_dim = -1; - int min_dep_dim = dep.num_dim(); - for (int i = 0; i < t.size(); i++) { - if (t[i] > max_dep_dim) - max_dep_dim = t[i]; - if (t[i] < min_dep_dim) - min_dep_dim = t[i]; - } - if (min_dep_dim > max_dep_dim) - return; - if (max_dep_dim - min_dep_dim + 1 != t.size()) - throw loop_error("cannot update the dependence graph after permuation"); - std::vector dep_pi(dep.num_dim()); - for (int i = 0; i < min_dep_dim; i++) - dep_pi[i] = i; - for (int i = min_dep_dim; i <= max_dep_dim; i++) - dep_pi[i] = t[i - min_dep_dim]; - for (int i = max_dep_dim + 1; i < dep.num_dim(); i++) - dep_pi[i] = i; - - dep.permute(dep_pi, active); - - // update the dependence graph - DependenceGraph g(dep.num_dim()); - for (int i = 0; i < dep.vertex.size(); i++) - g.insert(); - for (int i = 0; i < dep.vertex.size(); i++) - for (DependenceGraph::EdgeList::iterator j = - dep.vertex[i].second.begin(); j != dep.vertex[i].second.end(); - j++) { - if ((active.find(i) != active.end() - && active.find(j->first) != active.end())) { - std::vector dv = j->second; - for (int k = 0; k < dv.size(); k++) { - switch (dv[k].type) { - case DEP_W2R: - case DEP_R2W: - case DEP_W2W: - case DEP_R2R: { - std::vector lbounds(dep.num_dim()); - std::vector ubounds(dep.num_dim()); - for (int d = 0; d < dep.num_dim(); d++) { - lbounds[d] = dv[k].lbounds[dep_pi[d]]; - ubounds[d] = dv[k].ubounds[dep_pi[d]]; - } - dv[k].lbounds = lbounds; - dv[k].ubounds = ubounds; - break; - } - case DEP_CONTROL: { - break; - } - default: - throw loop_error("unknown dependence type"); - } - } - g.connect(i, j->first, dv); - } else if (active.find(i) == active.end() - && active.find(j->first) == active.end()) { - std::vector dv = j->second; - g.connect(i, j->first, dv); - } else { - std::vector dv = j->second; - for (int k = 0; k < dv.size(); k++) - switch (dv[k].type) { - case DEP_W2R: - case DEP_R2W: - case DEP_W2W: - case DEP_R2R: { - for (int d = 0; d < dep.num_dim(); d++) - if (dep_pi[d] != d) { - dv[k].lbounds[d] = -posInfinity; - dv[k].ubounds[d] = posInfinity; - } - break; - } - case DEP_CONTROL: - break; - default: - throw loop_error("unknown dependence type"); - } - g.connect(i, j->first, dv); - } - } - dep = g; - - // update loop level information - for (std::set::iterator i = active.begin(); i != active.end(); i++) { - int cur_dep_dim = min_dep_dim; - std::vector new_loop_level(stmt[*i].loop_level.size()); - for (int j = 1; j <= stmt[*i].loop_level.size(); j++) - if (j >= level && j < level + pi.size()) { - switch (stmt[*i].loop_level[pi_inverse[j - level] - 1].type) { - case LoopLevelOriginal: - new_loop_level[j - 1].type = LoopLevelOriginal; - new_loop_level[j - 1].payload = cur_dep_dim++; - new_loop_level[j - 1].parallel_level = - stmt[*i].loop_level[pi_inverse[j - level] - 1].parallel_level; - break; - case LoopLevelTile: { - new_loop_level[j - 1].type = LoopLevelTile; - int ref_level = stmt[*i].loop_level[pi_inverse[j - level] - - 1].payload; - if (ref_level >= level && ref_level < level + pi.size()) - new_loop_level[j - 1].payload = pi_inverse[ref_level - - level]; - else - new_loop_level[j - 1].payload = ref_level; - new_loop_level[j - 1].parallel_level = stmt[*i].loop_level[j - - 1].parallel_level; - break; - } - default: - throw loop_error( - "unknown loop level information for statement " - + to_string(*i)); - } - } else { - switch (stmt[*i].loop_level[j - 1].type) { - case LoopLevelOriginal: - new_loop_level[j - 1].type = LoopLevelOriginal; - new_loop_level[j - 1].payload = - stmt[*i].loop_level[j - 1].payload; - new_loop_level[j - 1].parallel_level = stmt[*i].loop_level[j - - 1].parallel_level; - break; - case LoopLevelTile: { - new_loop_level[j - 1].type = LoopLevelTile; - int ref_level = stmt[*i].loop_level[j - 1].payload; - if (ref_level >= level && ref_level < level + pi.size()) - new_loop_level[j - 1].payload = pi_inverse[ref_level - - level]; - else - new_loop_level[j - 1].payload = ref_level; - new_loop_level[j - 1].parallel_level = stmt[*i].loop_level[j - - 1].parallel_level; - break; - } - default: - throw loop_error( - "unknown loop level information for statement " - + to_string(*i)); - } - } - stmt[*i].loop_level = new_loop_level; - } - - setLexicalOrder(2 * level - 2, active, starting_order); -} -void Loop::permute(const std::set &active, const std::vector &pi) { - if (active.size() == 0 || pi.size() == 0) - return; - - // check for sanity of parameters - int level = pi[0]; - for (int i = 1; i < pi.size(); i++) - if (pi[i] < level) - level = pi[i]; - if (level < 1) - throw std::invalid_argument("invalid permuation"); - std::vector reverse_pi(pi.size(), 0); - for (int i = 0; i < pi.size(); i++) - if (pi[i] >= level + pi.size()) - throw std::invalid_argument("invalid permutation"); - else - reverse_pi[pi[i] - level] = i + level; - for (int i = 0; i < reverse_pi.size(); i++) - if (reverse_pi[i] == 0) - throw std::invalid_argument("invalid permuation"); - int ref_stmt_num; - std::vector lex; - for (std::set::iterator i = active.begin(); i != active.end(); i++) { - if (*i < 0 || *i >= stmt.size()) - throw std::invalid_argument("invalid statement " + to_string(*i)); - if (i == active.begin()) { - ref_stmt_num = *i; - lex = getLexicalOrder(*i); - } else { - if (level + pi.size() - 1 > stmt[*i].loop_level.size()) - throw std::invalid_argument("invalid permuation"); - std::vector lex2 = getLexicalOrder(*i); - for (int j = 0; j < 2 * level - 3; j += 2) - if (lex[j] != lex2[j]) - throw std::invalid_argument( - "statements to permute must be in the same subloop"); - for (int j = 0; j < pi.size(); j++) - if (!(stmt[*i].loop_level[level + j - 1].type - == stmt[ref_stmt_num].loop_level[level + j - 1].type - && stmt[*i].loop_level[level + j - 1].payload - == stmt[ref_stmt_num].loop_level[level + j - 1].payload)) - throw std::invalid_argument( - "permuted loops must have the same loop level types"); - } - } - // invalidate saved codegen computation - delete last_compute_cgr_; - last_compute_cgr_ = NULL; - delete last_compute_cg_; - last_compute_cg_ = NULL; - - // Update transformation relations - for (std::set::iterator i = active.begin(); i != active.end(); i++) { - int n = stmt[*i].xform.n_out(); - Relation mapping(n, n); - F_And *f_root = mapping.add_and(); - for (int j = 1; j <= n; j += 2) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.output_var(j), 1); - h.update_coef(mapping.input_var(j), -1); - } - for (int j = 0; j < pi.size(); j++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.output_var(2 * (level + j)), 1); - h.update_coef(mapping.input_var(2 * pi[j]), -1); - } - for (int j = 1; j < level; j++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.output_var(2 * j), 1); - h.update_coef(mapping.input_var(2 * j), -1); - } - for (int j = level + pi.size(); j <= stmt[*i].loop_level.size(); j++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.output_var(2 * j), 1); - h.update_coef(mapping.input_var(2 * j), -1); - } - - stmt[*i].xform = Composition(mapping, stmt[*i].xform); - stmt[*i].xform.simplify(); - } - - // get the permuation for dependence vectors - std::vector t; - for (int i = 0; i < pi.size(); i++) - if (stmt[ref_stmt_num].loop_level[pi[i] - 1].type == LoopLevelOriginal) - t.push_back(stmt[ref_stmt_num].loop_level[pi[i] - 1].payload); - int max_dep_dim = -1; - int min_dep_dim = num_dep_dim; - for (int i = 0; i < t.size(); i++) { - if (t[i] > max_dep_dim) - max_dep_dim = t[i]; - if (t[i] < min_dep_dim) - min_dep_dim = t[i]; - } - if (min_dep_dim > max_dep_dim) - return; - if (max_dep_dim - min_dep_dim + 1 != t.size()) - throw loop_error("cannot update the dependence graph after permuation"); - std::vector dep_pi(num_dep_dim); - for (int i = 0; i < min_dep_dim; i++) - dep_pi[i] = i; - for (int i = min_dep_dim; i <= max_dep_dim; i++) - dep_pi[i] = t[i - min_dep_dim]; - for (int i = max_dep_dim + 1; i < num_dep_dim; i++) - dep_pi[i] = i; - - dep.permute(dep_pi, active); - - // update the dependence graph - DependenceGraph g(dep.num_dim()); - for (int i = 0; i < dep.vertex.size(); i++) - g.insert(); - for (int i = 0; i < dep.vertex.size(); i++) - for (DependenceGraph::EdgeList::iterator j = - dep.vertex[i].second.begin(); j != dep.vertex[i].second.end(); - j++) { // - if ((active.find(i) != active.end() - && active.find(j->first) != active.end())) { - std::vector dv = j->second; - for (int k = 0; k < dv.size(); k++) { - switch (dv[k].type) { - case DEP_W2R: - case DEP_R2W: - case DEP_W2W: - case DEP_R2R: { - std::vector lbounds(num_dep_dim); - std::vector ubounds(num_dep_dim); - for (int d = 0; d < num_dep_dim; d++) { - lbounds[d] = dv[k].lbounds[dep_pi[d]]; - ubounds[d] = dv[k].ubounds[dep_pi[d]]; - } - dv[k].lbounds = lbounds; - dv[k].ubounds = ubounds; - break; - } - case DEP_CONTROL: { - break; - } - default: - throw loop_error("unknown dependence type"); - } - } - g.connect(i, j->first, dv); - } else if (active.find(i) == active.end() - && active.find(j->first) == active.end()) { - std::vector dv = j->second; - g.connect(i, j->first, dv); - } else { - std::vector dv = j->second; - for (int k = 0; k < dv.size(); k++) - switch (dv[k].type) { - case DEP_W2R: - case DEP_R2W: - case DEP_W2W: - case DEP_R2R: { - for (int d = 0; d < num_dep_dim; d++) - if (dep_pi[d] != d) { - dv[k].lbounds[d] = -posInfinity; - dv[k].ubounds[d] = posInfinity; - } - break; - } - case DEP_CONTROL: - break; - default: - throw loop_error("unknown dependence type"); - } - g.connect(i, j->first, dv); - } - } - dep = g; - - // update loop level information - for (std::set::iterator i = active.begin(); i != active.end(); i++) { - int cur_dep_dim = min_dep_dim; - std::vector new_loop_level(stmt[*i].loop_level.size()); - for (int j = 1; j <= stmt[*i].loop_level.size(); j++) - if (j >= level && j < level + pi.size()) { - switch (stmt[*i].loop_level[reverse_pi[j - level] - 1].type) { - case LoopLevelOriginal: - new_loop_level[j - 1].type = LoopLevelOriginal; - new_loop_level[j - 1].payload = cur_dep_dim++; - new_loop_level[j - 1].parallel_level = - stmt[*i].loop_level[reverse_pi[j - level] - 1].parallel_level; - break; - case LoopLevelTile: { - new_loop_level[j - 1].type = LoopLevelTile; - int ref_level = stmt[*i].loop_level[reverse_pi[j - level] - - 1].payload; - if (ref_level >= level && ref_level < level + pi.size()) - new_loop_level[j - 1].payload = reverse_pi[ref_level - - level]; - else - new_loop_level[j - 1].payload = ref_level; - new_loop_level[j - 1].parallel_level = - stmt[*i].loop_level[reverse_pi[j - level] - 1].parallel_level; - break; - } - default: - throw loop_error( - "unknown loop level information for statement " - + to_string(*i)); - } - } else { - switch (stmt[*i].loop_level[j - 1].type) { - case LoopLevelOriginal: - new_loop_level[j - 1].type = LoopLevelOriginal; - new_loop_level[j - 1].payload = - stmt[*i].loop_level[j - 1].payload; - new_loop_level[j - 1].parallel_level = stmt[*i].loop_level[j - - 1].parallel_level; - break; - case LoopLevelTile: { - new_loop_level[j - 1].type = LoopLevelTile; - int ref_level = stmt[*i].loop_level[j - 1].payload; - if (ref_level >= level && ref_level < level + pi.size()) - new_loop_level[j - 1].payload = reverse_pi[ref_level - - level]; - else - new_loop_level[j - 1].payload = ref_level; - new_loop_level[j - 1].parallel_level = stmt[*i].loop_level[j - - 1].parallel_level; - break; - } - default: - throw loop_error( - "unknown loop level information for statement " - + to_string(*i)); - } - } - stmt[*i].loop_level = new_loop_level; - } - - setLexicalOrder(2 * level - 2, active); -} - -std::set Loop::split(int stmt_num, int level, const Relation &cond) { - // check for sanity of parameters - if (stmt_num < 0 || stmt_num >= stmt.size()) - throw std::invalid_argument("invalid statement " + to_string(stmt_num)); - if (level <= 0 || level > stmt[stmt_num].loop_level.size()) - throw std::invalid_argument("invalid loop level " + to_string(level)); - - std::set result; - int dim = 2 * level - 1; - std::vector lex = getLexicalOrder(stmt_num); - std::set same_loop = getStatements(lex, dim - 1); - - Relation cond2 = copy(cond); - cond2.simplify(); - cond2 = EQs_to_GEQs(cond2); - Conjunct *c = cond2.single_conjunct(); - int cur_lex = lex[dim - 1]; - - for (GEQ_Iterator gi(c->GEQs()); gi; gi++) { - int max_level = (*gi).max_tuple_pos(); - Relation single_cond(max_level); - single_cond.and_with_GEQ(*gi); - - // TODO: should decide where to place newly created statements with - // complementary split condition from dependence graph. - bool place_after; - if (max_level == 0) - place_after = true; - else if ((*gi).get_coef(cond2.set_var(max_level)) < 0) - place_after = true; - else - place_after = false; - - bool temp_place_after; // = place_after; - bool assigned = false; - int part1_to_part2; - int part2_to_part1; - // original statements with split condition, - // new statements with complement of split condition - int old_num_stmt = stmt.size(); - std::map what_stmt_num; - apply_xform(same_loop); - for (std::set::iterator i = same_loop.begin(); - i != same_loop.end(); i++) { - int n = stmt[*i].IS.n_set(); - Relation part1, part2; - if (max_level > n) { - part1 = copy(stmt[*i].IS); - part2 = Relation::False(0); - } else { - part1 = Intersection(copy(stmt[*i].IS), - Extend_Set(copy(single_cond), n - max_level)); - part2 = Intersection(copy(stmt[*i].IS), - Extend_Set(Complement(copy(single_cond)), - n - max_level)); - } - - //split dependence check - - if (max_level > level) { - - DNF_Iterator di1(stmt[*i].IS.query_DNF()); - DNF_Iterator di2(part1.query_DNF()); - for (; di1 && di2; di1++, di2++) { - //printf("In next conjunct,\n"); - EQ_Iterator ei1 = (*di1)->EQs(); - EQ_Iterator ei2 = (*di2)->EQs(); - for (; ei1 && ei2; ei1++, ei2++) { - //printf(" In next equality constraint,\n"); - Constr_Vars_Iter cvi1(*ei1); - Constr_Vars_Iter cvi2(*ei2); - int dimension = (*cvi1).var->get_position(); - int same = 0; - bool identical = false; - if (identical = !strcmp((*cvi1).var->char_name(), - (*cvi2).var->char_name())) { - - for (; cvi1 && cvi2; cvi1++, cvi2++) { - - if (((*cvi1).coef != (*cvi2).coef - || (*ei1).get_const() - != (*ei2).get_const()) - || (strcmp((*cvi1).var->char_name(), - (*cvi2).var->char_name()))) { - - same++; - } - } - } - if ((same != 0) || !identical) { - - dimension = dimension - 1; - - while (stmt[*i].loop_level[dimension].type - == LoopLevelTile) - dimension = - stmt[*i].loop_level[dimension].payload; - - dimension = stmt[*i].loop_level[dimension].payload; - - for (int i = 0; i < stmt.size(); i++) { - std::vector > D; - for (DependenceGraph::EdgeList::iterator j = - dep.vertex[i].second.begin(); - j != dep.vertex[i].second.end(); j++) { - for (int k = 0; k < j->second.size(); k++) { - DependenceVector dv = j->second[k]; - if (dv.type != DEP_CONTROL) - if (dv.hasNegative(dimension) - && !dv.quasi) - throw loop_error( - "loop error: Split is illegal, dependence violation!"); - - } - } - } - - } - - GEQ_Iterator gi1 = (*di1)->GEQs(); - GEQ_Iterator gi2 = (*di2)->GEQs(); - - for (; gi1 && gi2; gi++, gi2++) { - - Constr_Vars_Iter cvi1(*gi1); - Constr_Vars_Iter cvi2(*gi2); - int dimension = (*cvi1).var->get_position(); - int same = 0; - bool identical = false; - if (identical = !strcmp((*cvi1).var->char_name(), - (*cvi2).var->char_name())) { - - for (; cvi1 && cvi2; cvi1++, cvi2++) { - - if (((*cvi1).coef != (*cvi2).coef - || (*gi1).get_const() - != (*gi2).get_const()) - || (strcmp((*cvi1).var->char_name(), - (*cvi2).var->char_name()))) { - - same++; - } - } - } - if ((same != 0) || !identical) { - dimension = dimension - 1; - - while (stmt[*i].loop_level[dimension].type - == LoopLevelTile) - stmt[*i].loop_level[dimension].payload; - - dimension = - stmt[*i].loop_level[dimension].payload; - - for (int i = 0; i < stmt.size(); i++) { - std::vector > D; - for (DependenceGraph::EdgeList::iterator j = - dep.vertex[i].second.begin(); - j != dep.vertex[i].second.end(); - j++) { - for (int k = 0; k < j->second.size(); - k++) { - DependenceVector dv = j->second[k]; - if (dv.type != DEP_CONTROL) - if (dv.hasNegative(dimension) - && !dv.quasi) - - throw loop_error( - "loop error: Split is illegal, dependence violation!"); - - } - } - } - - } - - } - - } - - } - - DNF_Iterator di3(stmt[*i].IS.query_DNF()); - DNF_Iterator di4(part2.query_DNF()); // - for (; di3 && di4; di3++, di4++) { - EQ_Iterator ei1 = (*di3)->EQs(); - EQ_Iterator ei2 = (*di4)->EQs(); - for (; ei1 && ei2; ei1++, ei2++) { - Constr_Vars_Iter cvi1(*ei1); - Constr_Vars_Iter cvi2(*ei2); - int dimension = (*cvi1).var->get_position(); - int same = 0; - bool identical = false; - if (identical = !strcmp((*cvi1).var->char_name(), - (*cvi2).var->char_name())) { - - for (; cvi1 && cvi2; cvi1++, cvi2++) { - - if (((*cvi1).coef != (*cvi2).coef - || (*ei1).get_const() - != (*ei2).get_const()) - || (strcmp((*cvi1).var->char_name(), - (*cvi2).var->char_name()))) { - - same++; - } - } - } - if ((same != 0) || !identical) { - dimension = dimension - 1; - - while (stmt[*i].loop_level[dimension].type - == LoopLevelTile) - stmt[*i].loop_level[dimension].payload; - - dimension = stmt[*i].loop_level[dimension].payload; - - for (int i = 0; i < stmt.size(); i++) { - std::vector > D; - for (DependenceGraph::EdgeList::iterator j = - dep.vertex[i].second.begin(); - j != dep.vertex[i].second.end(); j++) { - for (int k = 0; k < j->second.size(); k++) { - DependenceVector dv = j->second[k]; - if (dv.type != DEP_CONTROL) - if (dv.hasNegative(dimension) - && !dv.quasi) - - throw loop_error( - "loop error: Split is illegal, dependence violation!"); - - } - } - } - - } - - } - GEQ_Iterator gi1 = (*di3)->GEQs(); - GEQ_Iterator gi2 = (*di4)->GEQs(); - - for (; gi1 && gi2; gi++, gi2++) { - Constr_Vars_Iter cvi1(*gi1); - Constr_Vars_Iter cvi2(*gi2); - int dimension = (*cvi1).var->get_position(); - int same = 0; - bool identical = false; - if (identical = !strcmp((*cvi1).var->char_name(), - (*cvi2).var->char_name())) { - - for (; cvi1 && cvi2; cvi1++, cvi2++) { - - if (((*cvi1).coef != (*cvi2).coef - || (*gi1).get_const() - != (*gi2).get_const()) - || (strcmp((*cvi1).var->char_name(), - (*cvi2).var->char_name()))) { - - same++; - } - } - } - if ((same != 0) || !identical) { - dimension = dimension - 1; - - while (stmt[*i].loop_level[dimension].type // - == LoopLevelTile) - stmt[*i].loop_level[dimension].payload; - - dimension = stmt[*i].loop_level[dimension].payload; - - for (int i = 0; i < stmt.size(); i++) { - std::vector > D; - for (DependenceGraph::EdgeList::iterator j = - dep.vertex[i].second.begin(); - j != dep.vertex[i].second.end(); j++) { - for (int k = 0; k < j->second.size(); k++) { - DependenceVector dv = j->second[k]; - if (dv.type != DEP_CONTROL) - if (dv.hasNegative(dimension) - && !dv.quasi) - - throw loop_error( - "loop error: Split is illegal, dependence violation!"); - - } - } - } - - } - - } - - } - - } - - stmt[*i].IS = part1; - - if (Intersection(copy(part2), - Extend_Set(copy(this->known), n - this->known.n_set())).is_upper_bound_satisfiable()) { - Statement new_stmt; - new_stmt.code = stmt[*i].code->clone(); - new_stmt.IS = part2; - new_stmt.xform = copy(stmt[*i].xform); - new_stmt.ir_stmt_node = NULL; - new_stmt.loop_level = stmt[*i].loop_level; - - stmt_nesting_level_.push_back(stmt_nesting_level_[*i]); - - /*std::pair, - std::vector > dv = - test_data_dependences(ir, stmt[*i].code, part1, - stmt[*i].code, part2, freevar, index, - stmt_nesting_level_[*i], - stmt_nesting_level_[stmt.size() - 1]); - - - - - for (int k = 0; k < dv.first.size(); k++) - part1_to_part2++; - if (part1_to_part2 > 0 && part2_to_part1 > 0) - throw loop_error( - "loop error: Aborting, split resulted in impossible dependence cycle!"); - - for (int k = 0; k < dv.second.size(); k++) - part2_to_part1++; - - - - if (part1_to_part2 > 0 && part2_to_part1 > 0) - throw loop_error( - "loop error: Aborting, split resulted in impossible dependence cycle!"); - - - - if (part2_to_part1 > 0){ - temp_place_after = false; - assigned = true; - - }else if (part1_to_part2 > 0){ - temp_place_after = true; - - assigned = true; - } - - */ - - if (place_after) - assign_const(new_stmt.xform, dim - 1, cur_lex + 1); - else - assign_const(new_stmt.xform, dim - 1, cur_lex - 1); - - stmt.push_back(new_stmt); - dep.insert(); - what_stmt_num[*i] = stmt.size() - 1; - if (*i == stmt_num) - result.insert(stmt.size() - 1); - } - - } - // make adjacent lexical number available for new statements - if (place_after) { - lex[dim - 1] = cur_lex + 1; - shiftLexicalOrder(lex, dim - 1, 1); - } else { - lex[dim - 1] = cur_lex - 1; - shiftLexicalOrder(lex, dim - 1, -1); - } - // update dependence graph - int dep_dim = get_dep_dim_of(stmt_num, level); - for (int i = 0; i < old_num_stmt; i++) { - std::vector > > D; - - for (DependenceGraph::EdgeList::iterator j = - dep.vertex[i].second.begin(); - j != dep.vertex[i].second.end(); j++) { - if (same_loop.find(i) != same_loop.end()) { - if (same_loop.find(j->first) != same_loop.end()) { - if (what_stmt_num.find(i) != what_stmt_num.end() - && what_stmt_num.find(j->first) - != what_stmt_num.end()) - dep.connect(what_stmt_num[i], - what_stmt_num[j->first], j->second); - if (place_after - && what_stmt_num.find(j->first) - != what_stmt_num.end()) { - std::vector dvs; - for (int k = 0; k < j->second.size(); k++) { - DependenceVector dv = j->second[k]; - if (dv.is_data_dependence() && dep_dim != -1) { - dv.lbounds[dep_dim] = -posInfinity; - dv.ubounds[dep_dim] = posInfinity; - } - dvs.push_back(dv); - } - if (dvs.size() > 0) - D.push_back( - std::make_pair(what_stmt_num[j->first], - dvs)); - } else if (!place_after - && what_stmt_num.find(i) - != what_stmt_num.end()) { - std::vector dvs; - for (int k = 0; k < j->second.size(); k++) { - DependenceVector dv = j->second[k]; - if (dv.is_data_dependence() && dep_dim != -1) { - dv.lbounds[dep_dim] = -posInfinity; - dv.ubounds[dep_dim] = posInfinity; - } - dvs.push_back(dv); - } - if (dvs.size() > 0) - dep.connect(what_stmt_num[i], j->first, dvs); - - } - } else { - if (what_stmt_num.find(i) != what_stmt_num.end()) - dep.connect(what_stmt_num[i], j->first, j->second); - } - } else if (same_loop.find(j->first) != same_loop.end()) { - if (what_stmt_num.find(j->first) != what_stmt_num.end()) - D.push_back( - std::make_pair(what_stmt_num[j->first], - j->second)); - } - } - - for (int j = 0; j < D.size(); j++) - dep.connect(i, D[j].first, D[j].second); - } - - } - - return result; -} - -void Loop::skew(const std::set &stmt_nums, int level, - const std::vector &skew_amount) { - if (stmt_nums.size() == 0) - return; - - // check for sanity of parameters - int ref_stmt_num = *(stmt_nums.begin()); - for (std::set::const_iterator i = stmt_nums.begin(); - i != stmt_nums.end(); i++) { - if (*i < 0 || *i >= stmt.size()) - throw std::invalid_argument( - "invalid statement number " + to_string(*i)); - if (level < 1 || level > stmt[*i].loop_level.size()) - throw std::invalid_argument( - "invalid loop level " + to_string(level)); - for (int j = stmt[*i].loop_level.size(); j < skew_amount.size(); j++) - if (skew_amount[j] != 0) - throw std::invalid_argument("invalid skewing formula"); - } - - // invalidate saved codegen computation - delete last_compute_cgr_; - last_compute_cgr_ = NULL; - delete last_compute_cg_; - last_compute_cg_ = NULL; - - // set trasformation relations - for (std::set::const_iterator i = stmt_nums.begin(); - i != stmt_nums.end(); i++) { - int n = stmt[*i].xform.n_out(); - Relation r(n, n); - F_And *f_root = r.add_and(); - for (int j = 1; j <= n; j++) - if (j != 2 * level) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(r.input_var(j), 1); - h.update_coef(r.output_var(j), -1); - } - EQ_Handle h = f_root->add_EQ(); - h.update_coef(r.output_var(2 * level), -1); - for (int j = 0; j < skew_amount.size(); j++) - if (skew_amount[j] != 0) - h.update_coef(r.input_var(2 * (j + 1)), skew_amount[j]); - - stmt[*i].xform = Composition(r, stmt[*i].xform); - stmt[*i].xform.simplify(); - } - - // update dependence graph - if (stmt[ref_stmt_num].loop_level[level - 1].type == LoopLevelOriginal) { - int dep_dim = stmt[ref_stmt_num].loop_level[level - 1].payload; - for (std::set::const_iterator i = stmt_nums.begin(); - i != stmt_nums.end(); i++) - for (DependenceGraph::EdgeList::iterator j = - dep.vertex[*i].second.begin(); - j != dep.vertex[*i].second.end(); j++) - if (stmt_nums.find(j->first) != stmt_nums.end()) { - // dependence between skewed statements - std::vector dvs = j->second; - for (int k = 0; k < dvs.size(); k++) { - DependenceVector &dv = dvs[k]; - if (dv.is_data_dependence()) { - coef_t lb = 0; - coef_t ub = 0; - for (int kk = 0; kk < skew_amount.size(); kk++) { - int cur_dep_dim = get_dep_dim_of(*i, kk + 1); - if (skew_amount[kk] > 0) { - if (lb != -posInfinity - && stmt[*i].loop_level[kk].type - == LoopLevelOriginal - && dv.lbounds[cur_dep_dim] - != -posInfinity) - lb += skew_amount[kk] - * dv.lbounds[cur_dep_dim]; - else { - if (cur_dep_dim != -1 - && !(dv.lbounds[cur_dep_dim] - == 0 - && dv.ubounds[cur_dep_dim] - == 0)) - lb = -posInfinity; - } - if (ub != posInfinity - && stmt[*i].loop_level[kk].type - == LoopLevelOriginal - && dv.ubounds[cur_dep_dim] - != posInfinity) - ub += skew_amount[kk] - * dv.ubounds[cur_dep_dim]; - else { - if (cur_dep_dim != -1 - && !(dv.lbounds[cur_dep_dim] - == 0 - && dv.ubounds[cur_dep_dim] - == 0)) - ub = posInfinity; - } - } else if (skew_amount[kk] < 0) { - if (lb != -posInfinity - && stmt[*i].loop_level[kk].type - == LoopLevelOriginal - && dv.ubounds[cur_dep_dim] - != posInfinity) - lb += skew_amount[kk] - * dv.ubounds[cur_dep_dim]; - else { - if (cur_dep_dim != -1 - && !(dv.lbounds[cur_dep_dim] - == 0 - && dv.ubounds[cur_dep_dim] - == 0)) - lb = -posInfinity; - } - if (ub != posInfinity - && stmt[*i].loop_level[kk].type - == LoopLevelOriginal - && dv.lbounds[cur_dep_dim] - != -posInfinity) - ub += skew_amount[kk] - * dv.lbounds[cur_dep_dim]; - else { - if (cur_dep_dim != -1 - && !(dv.lbounds[cur_dep_dim] - == 0 - && dv.ubounds[cur_dep_dim] - == 0)) - ub = posInfinity; - } - } - } - dv.lbounds[dep_dim] = lb; - dv.ubounds[dep_dim] = ub; - if ((dv.isCarried(dep_dim) - && dv.hasPositive(dep_dim)) && dv.quasi) - dv.quasi = false; - - if ((dv.isCarried(dep_dim) - && dv.hasNegative(dep_dim)) && !dv.quasi) - throw loop_error( - "loop error: Skewing is illegal, dependence violation!"); - dv.lbounds[dep_dim] = lb; - dv.ubounds[dep_dim] = ub; - if ((dv.isCarried(dep_dim) - && dv.hasPositive(dep_dim)) && dv.quasi) - dv.quasi = false; - - if ((dv.isCarried(dep_dim) - && dv.hasNegative(dep_dim)) && !dv.quasi) - throw loop_error( - "loop error: Skewing is illegal, dependence violation!"); - } - } - j->second = dvs; - } else { - // dependence from skewed statement to unskewed statement becomes jumbled, - // put distance value at skewed dimension to unknown - std::vector dvs = j->second; - for (int k = 0; k < dvs.size(); k++) { - DependenceVector &dv = dvs[k]; - if (dv.is_data_dependence()) { - dv.lbounds[dep_dim] = -posInfinity; - dv.ubounds[dep_dim] = posInfinity; - } - } - j->second = dvs; - } - for (int i = 0; i < dep.vertex.size(); i++) - if (stmt_nums.find(i) == stmt_nums.end()) - for (DependenceGraph::EdgeList::iterator j = - dep.vertex[i].second.begin(); - j != dep.vertex[i].second.end(); j++) - if (stmt_nums.find(j->first) != stmt_nums.end()) { - // dependence from unskewed statement to skewed statement becomes jumbled, - // put distance value at skewed dimension to unknown - std::vector dvs = j->second; - for (int k = 0; k < dvs.size(); k++) { - DependenceVector &dv = dvs[k]; - if (dv.is_data_dependence()) { - dv.lbounds[dep_dim] = -posInfinity; - dv.ubounds[dep_dim] = posInfinity; - } - } - j->second = dvs; - } - } -} - - -void Loop::shift(const std::set &stmt_nums, int level, int shift_amount) { - if (stmt_nums.size() == 0) - return; - - // check for sanity of parameters - int ref_stmt_num = *(stmt_nums.begin()); - for (std::set::const_iterator i = stmt_nums.begin(); - i != stmt_nums.end(); i++) { - if (*i < 0 || *i >= stmt.size()) - throw std::invalid_argument( - "invalid statement number " + to_string(*i)); - if (level < 1 || level > stmt[*i].loop_level.size()) - throw std::invalid_argument( - "invalid loop level " + to_string(level)); - } - - // do nothing - if (shift_amount == 0) - return; - - // invalidate saved codegen computation - delete last_compute_cgr_; - last_compute_cgr_ = NULL; - delete last_compute_cg_; - last_compute_cg_ = NULL; - - // set trasformation relations - for (std::set::const_iterator i = stmt_nums.begin(); - i != stmt_nums.end(); i++) { - int n = stmt[*i].xform.n_out(); - - Relation r(n, n); - F_And *f_root = r.add_and(); - for (int j = 1; j <= n; j++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(r.input_var(j), 1); - h.update_coef(r.output_var(j), -1); - if (j == 2 * level) - h.update_const(shift_amount); - } - - stmt[*i].xform = Composition(r, stmt[*i].xform); - stmt[*i].xform.simplify(); - } - - // update dependence graph - if (stmt[ref_stmt_num].loop_level[level - 1].type == LoopLevelOriginal) { - int dep_dim = stmt[ref_stmt_num].loop_level[level - 1].payload; - for (std::set::const_iterator i = stmt_nums.begin(); - i != stmt_nums.end(); i++) - for (DependenceGraph::EdgeList::iterator j = - dep.vertex[*i].second.begin(); - j != dep.vertex[*i].second.end(); j++) - if (stmt_nums.find(j->first) == stmt_nums.end()) { - // dependence from shifted statement to unshifted statement - std::vector dvs = j->second; - for (int k = 0; k < dvs.size(); k++) { - DependenceVector &dv = dvs[k]; - if (dv.is_data_dependence()) { - if (dv.lbounds[dep_dim] != -posInfinity) - dv.lbounds[dep_dim] -= shift_amount; - if (dv.ubounds[dep_dim] != posInfinity) - dv.ubounds[dep_dim] -= shift_amount; - } - } - j->second = dvs; - } - for (int i = 0; i < dep.vertex.size(); i++) - if (stmt_nums.find(i) == stmt_nums.end()) - for (DependenceGraph::EdgeList::iterator j = - dep.vertex[i].second.begin(); - j != dep.vertex[i].second.end(); j++) - if (stmt_nums.find(j->first) != stmt_nums.end()) { - // dependence from unshifted statement to shifted statement - std::vector dvs = j->second; - for (int k = 0; k < dvs.size(); k++) { - DependenceVector &dv = dvs[k]; - if (dv.is_data_dependence()) { - if (dv.lbounds[dep_dim] != -posInfinity) - dv.lbounds[dep_dim] += shift_amount; - if (dv.ubounds[dep_dim] != posInfinity) - dv.ubounds[dep_dim] += shift_amount; - } - } - j->second = dvs; - } - } -} - -void Loop::scale(const std::set &stmt_nums, int level, int scale_amount) { - std::vector skew_amount(level, 0); - skew_amount[level - 1] = scale_amount; - skew(stmt_nums, level, skew_amount); -} - -void Loop::reverse(const std::set &stmt_nums, int level) { - scale(stmt_nums, level, -1); -} - -void Loop::fuse(const std::set &stmt_nums, int level) { - if (stmt_nums.size() == 0 || stmt_nums.size() == 1) - return; - - // invalidate saved codegen computation - delete last_compute_cgr_; - last_compute_cgr_ = NULL; - delete last_compute_cg_; - last_compute_cg_ = NULL; - - int dim = 2 * level - 1; - // check for sanity of parameters - std::vector ref_lex; - int ref_stmt_num; - for (std::set::const_iterator i = stmt_nums.begin(); - i != stmt_nums.end(); i++) { - if (*i < 0 || *i >= stmt.size()) - throw std::invalid_argument( - "invalid statement number " + to_string(*i)); - if (level <= 0 - || (level > (stmt[*i].xform.n_out() - 1) / 2 - || level > stmt[*i].loop_level.size())) - throw std::invalid_argument( - "invalid loop level " + to_string(level)); - if (ref_lex.size() == 0) { - ref_lex = getLexicalOrder(*i); - ref_stmt_num = *i; - } else { - std::vector lex = getLexicalOrder(*i); - for (int j = 0; j < dim - 1; j += 2) - if (lex[j] != ref_lex[j]) - throw std::invalid_argument( - "statements for fusion must be in the same level-" - + to_string(level - 1) + " subloop"); - } - } - - // collect lexicographical order values from to-be-fused statements - std::set lex_values; - for (std::set::const_iterator i = stmt_nums.begin(); - i != stmt_nums.end(); i++) { - std::vector lex = getLexicalOrder(*i); - lex_values.insert(lex[dim - 1]); - } - if (lex_values.size() == 1) - return; - // negative dependence would prevent fusion - - int dep_dim = get_dep_dim_of(ref_stmt_num, level); - - for (std::set::iterator i = lex_values.begin(); i != lex_values.end(); - i++) { - ref_lex[dim - 1] = *i; - std::set a = getStatements(ref_lex, dim - 1); - std::set::iterator j = i; - j++; - for (; j != lex_values.end(); j++) { - ref_lex[dim - 1] = *j; - std::set b = getStatements(ref_lex, dim - 1); - for (std::set::iterator ii = a.begin(); ii != a.end(); ii++) - for (std::set::iterator jj = b.begin(); jj != b.end(); - jj++) { - std::vector dvs; - dvs = dep.getEdge(*ii, *jj); - for (int k = 0; k < dvs.size(); k++) - if (dvs[k].isCarried(dep_dim) - && dvs[k].hasNegative(dep_dim)) - throw loop_error( - "loop error: statements " + to_string(*ii) - + " and " + to_string(*jj) - + " cannot be fused together due to negative dependence"); - dvs = dep.getEdge(*jj, *ii); - for (int k = 0; k < dvs.size(); k++) - if (dvs[k].isCarried(dep_dim) - && dvs[k].hasNegative(dep_dim)) - throw loop_error( - "loop error: statements " + to_string(*jj) - + " and " + to_string(*ii) - + " cannot be fused together due to negative dependence"); - } - } - } - - std::set same_loop = getStatements(ref_lex, dim - 3); - - std::vector > s = sort_by_same_loops(same_loop, level); - - std::set s1; - std::set s2; - std::set s4; - std::vector > s3; - for (std::set::iterator kk = stmt_nums.begin(); kk != stmt_nums.end(); - kk++) - for (int i = 0; i < s.size(); i++) - if (s[i].find(*kk) != s[i].end()) { - s1.insert(s[i].begin(), s[i].end()); - s2.insert(i); - } - - s3.push_back(s1); - for (int i = 0; i < s.size(); i++) - if (s2.find(i) == s2.end()) { - s3.push_back(s[i]); - s4.insert(s[i].begin(), s[i].end()); - } - try { - std::vector > s5; - s5.push_back(s1); - s5.push_back(s4); - - //Dependence Check for Ordering Constraint - //Graph, bool> dummy = construct_induced_graph_at_level(s5, - // dep, dep_dim); - - Graph, bool> g = construct_induced_graph_at_level(s3, dep, - dep_dim); - - s = typed_fusion(g); - } catch (const loop_error &e) { - - throw loop_error( - "statements cannot be fused together due to negative dependence"); - - } - - if (s3.size() == s.size()) { - int order = 0; - for (int i = 0; i < s.size(); i++) { - - for (std::set::iterator it = s[i].begin(); it != s[i].end(); - it++) { - - assign_const(stmt[*it].xform, 2 * level - 2, order); - - } - - order++; - } - } else if (s3.size() > s.size()) { - - int order = 0; - for (int j = 0; j < s.size(); j++) { - std::set::iterator it3; - for (it3 = s1.begin(); it3 != s1.end(); it3++) { - if (s[j].find(*it3) != s[j].end()) - break; - } - if (it3 != s1.end()) { - for (std::set::iterator it = s1.begin(); it != s1.end(); - it++) - assign_const(stmt[*it].xform, 2 * level - 2, order); - - order++; - - } - - for (int i = 0; i < s3.size(); i++) { - std::set::iterator it2; - - for (it2 = s3[i].begin(); it2 != s3[i].end(); it2++) { - if (s[j].find(*it2) != s[j].end()) - break; - } - - if (it2 != s3[i].end()) { - for (std::set::iterator it = s3[i].begin(); - it != s3[i].end(); it++) - assign_const(stmt[*it].xform, 2 * level - 2, order); - - order++; - - } - } - } - - } else - throw loop_error("Typed Fusion Error"); - -} - - - -void Loop::distribute(const std::set &stmt_nums, int level) { - if (stmt_nums.size() == 0 || stmt_nums.size() == 1) - return; - - // invalidate saved codegen computation - delete last_compute_cgr_; - last_compute_cgr_ = NULL; - delete last_compute_cg_; - last_compute_cg_ = NULL; - int dim = 2 * level - 1; - int ref_stmt_num; - // check for sanity of parameters - std::vector ref_lex; - for (std::set::const_iterator i = stmt_nums.begin(); - i != stmt_nums.end(); i++) { - if (*i < 0 || *i >= stmt.size()) - throw std::invalid_argument( - "invalid statement number " + to_string(*i)); - if (level < 1 - || (level > (stmt[*i].xform.n_out() - 1) / 2 - || level > stmt[*i].loop_level.size())) - throw std::invalid_argument( - "invalid loop level " + to_string(level)); - if (ref_lex.size() == 0) { - ref_lex = getLexicalOrder(*i); - ref_stmt_num = *i; - } else { - std::vector lex = getLexicalOrder(*i); - for (int j = 0; j <= dim - 1; j += 2) - if (lex[j] != ref_lex[j]) - throw std::invalid_argument( - "statements for distribution must be in the same level-" - + to_string(level) + " subloop"); - } - } - // find SCC in the to-be-distributed loop - int dep_dim = get_dep_dim_of(ref_stmt_num, level); - std::set same_loop = getStatements(ref_lex, dim - 1); - Graph g; - for (std::set::iterator i = same_loop.begin(); i != same_loop.end(); - i++) - g.insert(*i); - for (int i = 0; i < g.vertex.size(); i++) - for (int j = i + 1; j < g.vertex.size(); j++) { - std::vector dvs; - dvs = dep.getEdge(g.vertex[i].first, g.vertex[j].first); - for (int k = 0; k < dvs.size(); k++) - if (dvs[k].isCarried(dep_dim)) { - g.connect(i, j); - break; - } - dvs = dep.getEdge(g.vertex[j].first, g.vertex[i].first); - for (int k = 0; k < dvs.size(); k++) - if (dvs[k].isCarried(dep_dim)) { - g.connect(j, i); - break; - } - } - std::vector > s = g.topoSort(); - // find statements that cannot be distributed due to dependence cycle - Graph, Empty> g2; - for (int i = 0; i < s.size(); i++) { - std::set t; - for (std::set::iterator j = s[i].begin(); j != s[i].end(); j++) - if (stmt_nums.find(g.vertex[*j].first) != stmt_nums.end()) - t.insert(g.vertex[*j].first); - if (!t.empty()) - g2.insert(t); - } - for (int i = 0; i < g2.vertex.size(); i++) - for (int j = i + 1; j < g2.vertex.size(); j++) - for (std::set::iterator ii = g2.vertex[i].first.begin(); - ii != g2.vertex[i].first.end(); ii++) - for (std::set::iterator jj = g2.vertex[j].first.begin(); - jj != g2.vertex[j].first.end(); jj++) { - std::vector dvs; - dvs = dep.getEdge(*ii, *jj); - for (int k = 0; k < dvs.size(); k++) - if (dvs[k].isCarried(dep_dim)) { - g2.connect(i, j); - break; - } - dvs = dep.getEdge(*jj, *ii); - for (int k = 0; k < dvs.size(); k++) - if (dvs[k].isCarried(dep_dim)) { - g2.connect(j, i); - break; - } - } - std::vector > s2 = g2.topoSort(); - // nothing to distribute - if (s2.size() == 1) - throw loop_error( - "loop error: no statement can be distributed due to dependence cycle"); - std::vector > s3; - for (int i = 0; i < s2.size(); i++) { - std::set t; - for (std::set::iterator j = s2[i].begin(); j != s2[i].end(); j++) - std::set_union(t.begin(), t.end(), g2.vertex[*j].first.begin(), - g2.vertex[*j].first.end(), inserter(t, t.begin())); - s3.push_back(t); - } - // associate other affected statements with the right distributed statements - for (std::set::iterator i = same_loop.begin(); i != same_loop.end(); - i++) - if (stmt_nums.find(*i) == stmt_nums.end()) { - bool is_inserted = false; - int potential_insertion_point = 0; - for (int j = 0; j < s3.size(); j++) { - for (std::set::iterator k = s3[j].begin(); - k != s3[j].end(); k++) { - std::vector dvs; - dvs = dep.getEdge(*i, *k); - for (int kk = 0; kk < dvs.size(); kk++) - if (dvs[kk].isCarried(dep_dim)) { - s3[j].insert(*i); - is_inserted = true; - break; - } - dvs = dep.getEdge(*k, *i); - for (int kk = 0; kk < dvs.size(); kk++) - if (dvs[kk].isCarried(dep_dim)) - potential_insertion_point = j; - } - if (is_inserted) - break; - } - if (!is_inserted) - s3[potential_insertion_point].insert(*i); - } - // set lexicographical order after distribution - int order = ref_lex[dim - 1]; - shiftLexicalOrder(ref_lex, dim - 1, s3.size() - 1); - for (std::vector >::iterator i = s3.begin(); i != s3.end(); - i++) { - for (std::set::iterator j = (*i).begin(); j != (*i).end(); j++) - assign_const(stmt[*j].xform, dim - 1, order); - order++; - } - // no need to update dependence graph - ; - return; -} - diff --git a/loop_datacopy.cc b/loop_datacopy.cc deleted file mode 100644 index 36acb01..0000000 --- a/loop_datacopy.cc +++ /dev/null @@ -1,2166 +0,0 @@ -/***************************************************************************** - Copyright (C) 2008 University of Southern California - Copyright (C) 2009-2010 University of Utah - All Rights Reserved. - - Purpose: - Various data copy schemes. - - Notes: - - History: - 02/20/09 Created by Chun Chen by splitting original datacopy from loop.cc -*****************************************************************************/ - -#include -#include -#include "loop.hh" -#include "omegatools.hh" -#include "ir_code.hh" -#include "chill_error.hh" - -using namespace omega; - -// -// data copy function by referring arrays by numbers. -// e.g. A[i] = A[i-1] + B[i] -// parameter array_ref_num=[0,2] means to copy data touched by A[i-1] and A[i] -// -bool Loop::datacopy(const std::vector > > &array_ref_nums, int level, - bool allow_extra_read, int fastest_changing_dimension, int padding_stride, int padding_alignment, int memory_type) { - // check for sanity of parameters - std::set same_loop; - for (int i = 0; i < array_ref_nums.size(); i++) { - int stmt_num = array_ref_nums[i].first; - if (stmt_num < 0 || stmt_num >= stmt.size()) - throw std::invalid_argument("invalid statement number " + to_string(stmt_num)); - if (level <= 0 || level > stmt[stmt_num].loop_level.size()) - throw std::invalid_argument("invalid loop level " + to_string(level)); - if (i == 0) { - std::vector lex = getLexicalOrder(stmt_num); - same_loop = getStatements(lex, 2*level-2); - } - else if (same_loop.find(stmt_num) == same_loop.end()) - throw std::invalid_argument("array references for data copy must be located in the same subloop"); - } - - // convert array reference numbering scheme to actual array references - std::vector > > selected_refs; - for (int i = 0; i < array_ref_nums.size(); i++) { - if (array_ref_nums[i].second.size() == 0) - continue; - - int stmt_num = array_ref_nums[i].first; - selected_refs.push_back(std::make_pair(stmt_num, std::vector())); - std::vector refs = ir->FindArrayRef(stmt[stmt_num].code); - std::vector selected(refs.size(), false); - for (int j = 0; j < array_ref_nums[i].second.size(); j++) { - int ref_num = array_ref_nums[i].second[j]; - if (ref_num < 0 || ref_num >= refs.size()) { - for (int k = 0; k < refs.size(); k++) - delete refs[k]; - throw std::invalid_argument("invalid array reference number " + to_string(ref_num) + " in statement " + to_string(stmt_num)); - } - selected_refs[selected_refs.size()-1].second.push_back(refs[ref_num]); - selected[ref_num] = true; - } - for (int j = 0; j < refs.size(); j++) - if (!selected[j]) - delete refs[j]; - } - if (selected_refs.size() == 0) - throw std::invalid_argument("found no array references to copy"); - - // do the copy - return datacopy_privatized(selected_refs, level, std::vector(), allow_extra_read, fastest_changing_dimension, padding_stride, padding_alignment, memory_type); -} - -// -// data copy function by referring arrays by name. -// e.g. A[i] = A[i-1] + B[i] -// parameter array_name=A means to copy data touched by A[i-1] and A[i] -// -bool Loop::datacopy(int stmt_num, int level, const std::string &array_name, - bool allow_extra_read, int fastest_changing_dimension, int padding_stride, int padding_alignment, int memory_type) { - // check for sanity of parameters - if (stmt_num < 0 || stmt_num >= stmt.size()) - throw std::invalid_argument("invalid statement number " + to_string(stmt_num)); - if (level <= 0 || level > stmt[stmt_num].loop_level.size()) - throw std::invalid_argument("invalid loop level " + to_string(level)); - - // collect array references by name - std::vector lex = getLexicalOrder(stmt_num); - int dim = 2*level - 1; - std::set same_loop = getStatements(lex, dim-1); - - std::vector > > selected_refs; - for (std::set::iterator i = same_loop.begin(); i != same_loop.end(); i++) { - std::vector t; - std::vector refs = ir->FindArrayRef(stmt[*i].code); - for (int j = 0; j < refs.size(); j++) - if (refs[j]->name() == array_name) - t.push_back(refs[j]); - else - delete refs[j]; - if (t.size() != 0) - selected_refs.push_back(std::make_pair(*i, t)); - } - if (selected_refs.size() == 0) - throw std::invalid_argument("found no array references with name " + to_string(array_name) + " to copy"); - - // do the copy - return datacopy_privatized(selected_refs, level, std::vector(), allow_extra_read, fastest_changing_dimension, padding_stride, padding_alignment, memory_type); -} - - -bool Loop::datacopy_privatized(int stmt_num, int level, const std::string &array_name, const std::vector &privatized_levels, - bool allow_extra_read, int fastest_changing_dimension, int padding_stride, int padding_alignment, int memory_type) { - // check for sanity of parameters - if (stmt_num < 0 || stmt_num >= stmt.size()) - throw std::invalid_argument("invalid statement number " + to_string(stmt_num)); - if (level <= 0 || level > stmt[stmt_num].loop_level.size()) - throw std::invalid_argument("invalid loop level " + to_string(level)); - - // collect array references by name - std::vector lex = getLexicalOrder(stmt_num); - int dim = 2*level - 1; - std::set same_loop = getStatements(lex, dim-1); - - std::vector > > selected_refs; - for (std::set::iterator i = same_loop.begin(); i != same_loop.end(); i++) { - selected_refs.push_back(std::make_pair(*i, std::vector())); - - std::vector refs = ir->FindArrayRef(stmt[*i].code); - for (int j = 0; j < refs.size(); j++) - if (refs[j]->name() == array_name) - selected_refs[selected_refs.size()-1].second.push_back(refs[j]); - else - delete refs[j]; - } - if (selected_refs.size() == 0) - throw std::invalid_argument("found no array references with name " + to_string(array_name) + " to copy"); - - // do the copy - return datacopy_privatized(selected_refs, level, privatized_levels, allow_extra_read, fastest_changing_dimension, padding_stride, padding_alignment, memory_type); -} - - -bool Loop::datacopy_privatized(const std::vector > > &array_ref_nums, int level, const std::vector &privatized_levels, bool allow_extra_read, int fastest_changing_dimension, int padding_stride, int padding_alignment, int memory_type) { - // check for sanity of parameters - std::set same_loop; - for (int i = 0; i < array_ref_nums.size(); i++) { - int stmt_num = array_ref_nums[i].first; - if (stmt_num < 0 || stmt_num >= stmt.size()) - throw std::invalid_argument("invalid statement number " + to_string(stmt_num)); - if (level <= 0 || level > stmt[stmt_num].loop_level.size()) - throw std::invalid_argument("invalid loop level " + to_string(level)); - if (i == 0) { - std::vector lex = getLexicalOrder(stmt_num); - same_loop = getStatements(lex, 2*level-2); - } - else if (same_loop.find(stmt_num) == same_loop.end()) - throw std::invalid_argument("array references for data copy must be located in the same subloop"); - } - - // convert array reference numbering scheme to actual array references - std::vector > > selected_refs; - for (int i = 0; i < array_ref_nums.size(); i++) { - if (array_ref_nums[i].second.size() == 0) - continue; - - int stmt_num = array_ref_nums[i].first; - selected_refs.push_back(std::make_pair(stmt_num, std::vector())); - std::vector refs = ir->FindArrayRef(stmt[stmt_num].code); - std::vector selected(refs.size(), false); - for (int j = 0; j < array_ref_nums[i].second.size(); j++) { - int ref_num = array_ref_nums[i].second[j]; - if (ref_num < 0 || ref_num >= refs.size()) { - for (int k = 0; k < refs.size(); k++) - delete refs[k]; - throw std::invalid_argument("invalid array reference number " + to_string(ref_num) + " in statement " + to_string(stmt_num)); - } - selected_refs[selected_refs.size()-1].second.push_back(refs[ref_num]); - selected[ref_num] = true; - } - for (int j = 0; j < refs.size(); j++) - if (!selected[j]) - delete refs[j]; - } - if (selected_refs.size() == 0) - throw std::invalid_argument("found no array references to copy"); - - // do the copy - return datacopy_privatized(selected_refs, level, privatized_levels, allow_extra_read, fastest_changing_dimension, padding_stride, padding_alignment, memory_type); -} - - -// -// Implement low level datacopy function with lots of options. -// -/*bool Loop::datacopy_privatized(const std::vector > > &stmt_refs, int level, - const std::vector &privatized_levels, - bool allow_extra_read, int fastest_changing_dimension, - int padding_stride, int padding_alignment, int memory_type) { - if (stmt_refs.size() == 0) - return true; - - // check for sanity of parameters - IR_ArraySymbol *sym = NULL; - std::vector lex; - std::set active; - if (level <= 0) - throw std::invalid_argument("invalid loop level " + to_string(level)); - for (int i = 0; i < privatized_levels.size(); i++) { - if (i == 0) { - if (privatized_levels[i] < level) - throw std::invalid_argument("privatized loop levels must be no less than level " + to_string(level)); - } - else if (privatized_levels[i] <= privatized_levels[i-1]) - throw std::invalid_argument("privatized loop levels must be in ascending order"); - } - for (int i = 0; i < stmt_refs.size(); i++) { - int stmt_num = stmt_refs[i].first; - active.insert(stmt_num); - if (stmt_num < 0 || stmt_num >= stmt.size()) - throw std::invalid_argument("invalid statement number " + to_string(stmt_num)); - if (privatized_levels.size() != 0) { - if (privatized_levels[privatized_levels.size()-1] > stmt[stmt_num].loop_level.size()) - throw std::invalid_argument("invalid loop level " + to_string(privatized_levels[privatized_levels.size()-1]) + " for statement " + to_string(stmt_num)); - } - else { - if (level > stmt[stmt_num].loop_level.size()) - throw std::invalid_argument("invalid loop level " + to_string(level) + " for statement " + to_string(stmt_num)); - } - for (int j = 0; j < stmt_refs[i].second.size(); j++) { - if (sym == NULL) { - sym = stmt_refs[i].second[j]->symbol(); - lex = getLexicalOrder(stmt_num); - } - else { - IR_ArraySymbol *t = stmt_refs[i].second[j]->symbol(); - if (t->name() != sym->name()) { - delete t; - delete sym; - throw std::invalid_argument("try to copy data from different arrays"); - } - delete t; - } - } - } - if (!(fastest_changing_dimension >= -1 && fastest_changing_dimension < sym->n_dim())) - throw std::invalid_argument("invalid fastest changing dimension for the array to be copied"); - if (padding_stride < 0) - throw std::invalid_argument("invalid temporary array stride requirement"); - if (padding_alignment == -1 || padding_alignment == 0) - throw std::invalid_argument("invalid temporary array alignment requirement"); - - int dim = 2*level - 1; - int n_dim = sym->n_dim(); - - if (fastest_changing_dimension == -1) - switch (sym->layout_type()) { - case IR_ARRAY_LAYOUT_ROW_MAJOR: - fastest_changing_dimension = n_dim - 1; - break; - case IR_ARRAY_LAYOUT_COLUMN_MAJOR: - fastest_changing_dimension = 0; - break; - default: - throw loop_error("unsupported array layout"); - } - - - // build iteration spaces for all reads and for all writes separately - apply_xform(active); - bool has_write_refs = false; - bool has_read_refs = false; - Relation wo_copy_is = Relation::False(level-1+privatized_levels.size()+n_dim); - Relation ro_copy_is = Relation::False(level-1+privatized_levels.size()+n_dim); - for (int i = 0; i < stmt_refs.size(); i++) { - int stmt_num = stmt_refs[i].first; - - for (int j = 0; j < stmt_refs[i].second.size(); j++) { - Relation mapping(stmt[stmt_num].IS.n_set(), level-1+privatized_levels.size()+n_dim); - for (int k = 1; k <= mapping.n_inp(); k++) - mapping.name_input_var(k, stmt[stmt_num].IS.set_var(k)->name()); - mapping.setup_names(); - F_And *f_root = mapping.add_and(); - for (int k = 1; k <= level-1; k++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.input_var(k), 1); - h.update_coef(mapping.output_var(k), -1); - } - for (int k = 0; k < privatized_levels.size(); k++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.input_var(privatized_levels[k]), 1); - h.update_coef(mapping.output_var(level+k), -1); - } - for (int k = 0; k < n_dim; k++) { - CG_outputRepr *repr = stmt_refs[i].second[j]->index(k); - exp2formula(ir, mapping, f_root, freevar, repr, mapping.output_var(level-1+privatized_levels.size()+k+1), 'w', IR_COND_EQ, false); - repr->clear(); - delete repr; - } - Relation r = Range(Restrict_Domain(mapping, Intersection(copy(stmt[stmt_num].IS), Extend_Set(copy(this->known), stmt[stmt_num].IS.n_set() - this->known.n_set())))); - if (stmt_refs[i].second[j]->is_write()) { - has_write_refs = true; - wo_copy_is = Union(wo_copy_is, r); - wo_copy_is.simplify(2, 4); - } - else { - has_read_refs = true; - //protonu--removing the next line for now - ro_copy_is = Union(ro_copy_is, r); - ro_copy_is.simplify(2, 4); - //ro_copy_is = ConvexRepresentation(Union(ro_copy_is, r)); - - } - } - } - - if (allow_extra_read) { - Relation t = DecoupledConvexHull(copy(ro_copy_is)); - if (t.number_of_conjuncts() > 1) - ro_copy_is = RectHull(ro_copy_is); - else - ro_copy_is = t; - } - else { - Relation t = ConvexRepresentation(copy(ro_copy_is)); - if (t.number_of_conjuncts() > 1) - ro_copy_is = RectHull(ro_copy_is); - else - ro_copy_is = t; - } - wo_copy_is = ConvexRepresentation(wo_copy_is); - - if (allow_extra_read) { - Tuple Rs; - Tuple active; - for (DNF_Iterator di(ro_copy_is.query_DNF()); di; di++) { - Rs.append(Relation(ro_copy_is, di.curr())); - active.append(1); - } - Relation the_gcs = Relation::True(ro_copy_is.n_set()); - for (int i = level-1+privatized_levels.size()+1; i <= level-1+privatized_levels.size()+n_dim; i++) { - Relation r = greatest_common_step(Rs, active, i, Relation::Null()); - the_gcs = Intersection(the_gcs, r); - } - - ro_copy_is = Approximate(ro_copy_is); - ro_copy_is = ConvexRepresentation(ro_copy_is); - ro_copy_is = Intersection(ro_copy_is, the_gcs); - ro_copy_is.simplify(); - } - - - - for (int i = 1; i < level; i++) { - std::string s = stmt[*active.begin()].IS.input_var(i)->name(); - wo_copy_is.name_set_var(i, s); - ro_copy_is.name_set_var(i, s); - } - for (int i = 0; i < privatized_levels.size(); i++) { - std::string s = stmt[*active.begin()].IS.input_var(privatized_levels[i])->name(); - wo_copy_is.name_set_var(level+i, s); - ro_copy_is.name_set_var(level+i, s); - } - for (int i = level+privatized_levels.size(); i < level+privatized_levels.size()+n_dim; i++) { - std::string s = tmp_loop_var_name_prefix + to_string(tmp_loop_var_name_counter+i-level-privatized_levels.size()); - wo_copy_is.name_set_var(i, s); - ro_copy_is.name_set_var(i, s); - } - tmp_loop_var_name_counter += n_dim; - - //protonu--end change - - wo_copy_is.setup_names(); - ro_copy_is.setup_names(); - - // build merged iteration space for calculating temporary array size - bool already_use_recthull = false; - Relation untampered_copy_is = ConvexRepresentation(Union(copy(wo_copy_is), copy(ro_copy_is))); - Relation copy_is = untampered_copy_is; - if (copy_is.number_of_conjuncts() > 1) { - try { - copy_is = ConvexHull(copy(untampered_copy_is)); - } - catch (const std::overflow_error &e) { - copy_is = RectHull(copy(untampered_copy_is)); - already_use_recthull = true; - } - } - - - Retry_copy_is: - // extract temporary array information - CG_outputBuilder *ocg = ir->builder(); - std::vector index_lb(n_dim); // initialized to NULL - std::vector index_stride(n_dim, 1); - std::vector is_index_eq(n_dim, false); - std::vector > index_sz(0); - Relation reduced_copy_is = copy(copy_is); - - for (int i = 0; i < n_dim; i++) { - if (i != 0) - reduced_copy_is = Project(reduced_copy_is, level-1+privatized_levels.size()+i, Set_Var); - Relation bound = get_loop_bound(reduced_copy_is, level-1+privatized_levels.size()+i); - - // extract stride - EQ_Handle stride_eq; - { - bool simple_stride = true; - int strides = countStrides(bound.query_DNF()->single_conjunct(), bound.set_var(level-1+privatized_levels.size()+i+1), stride_eq, simple_stride); - if (strides > 1) { - throw loop_error("too many strides"); - } - else if (strides == 1) { - int sign = stride_eq.get_coef(bound.set_var(level-1+privatized_levels.size()+i+1)); - Constr_Vars_Iter it(stride_eq, true); - index_stride[i] = abs((*it).coef/sign); - } - } - - // check if this arary index requires loop - Conjunct *c = bound.query_DNF()->single_conjunct(); - for (EQ_Iterator ei(c->EQs()); ei; ei++) { - if ((*ei).has_wildcards()) - continue; - - int coef = (*ei).get_coef(bound.set_var(level-1+privatized_levels.size()+i+1)); - if (coef != 0) { - int sign = 1; - if (coef < 0) { - coef = -coef; - sign = -1; - } - - CG_outputRepr *op = NULL; - for (Constr_Vars_Iter ci(*ei); ci; ci++) { - switch ((*ci).var->kind()) { - case Input_Var: - { - if ((*ci).var != bound.set_var(level-1+privatized_levels.size()+i+1)) - if ((*ci).coef*sign == 1) - op = ocg->CreateMinus(op, ocg->CreateIdent((*ci).var->name())); - else if ((*ci).coef*sign == -1) - op = ocg->CreatePlus(op, ocg->CreateIdent((*ci).var->name())); - else if ((*ci).coef*sign > 1) - op = ocg->CreateMinus(op, ocg->CreateTimes(ocg->CreateInt(abs((*ci).coef)), ocg->CreateIdent((*ci).var->name()))); - else // (*ci).coef*sign < -1 - op = ocg->CreatePlus(op, ocg->CreateTimes(ocg->CreateInt(abs((*ci).coef)), ocg->CreateIdent((*ci).var->name()))); - break; - } - case Global_Var: - { - Global_Var_ID g = (*ci).var->get_global_var(); - if ((*ci).coef*sign == 1) - op = ocg->CreateMinus(op, ocg->CreateIdent(g->base_name())); - else if ((*ci).coef*sign == -1) - op = ocg->CreatePlus(op, ocg->CreateIdent(g->base_name())); - else if ((*ci).coef*sign > 1) - op = ocg->CreateMinus(op, ocg->CreateTimes(ocg->CreateInt(abs((*ci).coef)), ocg->CreateIdent(g->base_name()))); - else // (*ci).coef*sign < -1 - op = ocg->CreatePlus(op, ocg->CreateTimes(ocg->CreateInt(abs((*ci).coef)), ocg->CreateIdent(g->base_name()))); - break; - } - default: - throw loop_error("unsupported array index expression"); - } - } - if ((*ei).get_const() != 0) - op = ocg->CreatePlus(op, ocg->CreateInt(-sign*((*ei).get_const()))); - if (coef != 1) - op = ocg->CreateIntegerDivide(op, ocg->CreateInt(coef)); - - index_lb[i] = op; - is_index_eq[i] = true; - break; - } - } - if (is_index_eq[i]) - continue; - - // seperate lower and upper bounds - std::vector lb_list, ub_list; - for (GEQ_Iterator gi(c->GEQs()); gi; gi++) { - int coef = (*gi).get_coef(bound.set_var(level-1+privatized_levels.size()+i+1)); - if (coef != 0 && (*gi).has_wildcards()) { - bool clean_bound = true; - GEQ_Handle h; - for (Constr_Vars_Iter cvi(*gi, true); gi; gi++) - if (!findFloorInequality(bound, (*cvi).var, h, bound.set_var(level-1+privatized_levels.size()+i+1))) { - clean_bound = false; - break; - } - if (!clean_bound) - continue; - } - - if (coef > 0) - lb_list.push_back(*gi); - else if (coef < 0) - ub_list.push_back(*gi); - } - if (lb_list.size() == 0 || ub_list.size() == 0) - if (already_use_recthull) - throw loop_error("failed to calcuate array footprint size"); - else { - copy_is = RectHull(copy(untampered_copy_is)); - already_use_recthull = true; - goto Retry_copy_is; - } - - // build lower bound representation - Tuple lb_repr_list; - for (int j = 0; j < lb_list.size(); j++) - lb_repr_list.append(outputLBasRepr(ocg, lb_list[j], bound, - bound.set_var(level-1+privatized_levels.size()+i+1), - index_stride[i], stride_eq, Relation::True(bound.n_set()), - std::vector(bound.n_set()))); - - if (lb_repr_list.size() > 1) - index_lb[i] = ocg->CreateInvoke("max", lb_repr_list); - else if (lb_repr_list.size() == 1) - index_lb[i] = lb_repr_list[1]; - - // build temporary array size representation - { - Relation cal(copy_is.n_set(), 1); - F_And *f_root = cal.add_and(); - for (int j = 0; j < ub_list.size(); j++) - for (int k = 0; k < lb_list.size(); k++) { - GEQ_Handle h = f_root->add_GEQ(); - - for (Constr_Vars_Iter ci(ub_list[j]); ci; ci++) { - switch ((*ci).var->kind()) { - case Input_Var: - { - int pos = (*ci).var->get_position(); - h.update_coef(cal.input_var(pos), (*ci).coef); - break; - } - case Global_Var: - { - Global_Var_ID g = (*ci).var->get_global_var(); - Variable_ID v; - if (g->arity() == 0) - v = cal.get_local(g); - else - v = cal.get_local(g, (*ci).var->function_of()); - h.update_coef(v, (*ci).coef); - break; - } - default: - throw loop_error("cannot calculate temporay array size statically"); - } - } - h.update_const(ub_list[j].get_const()); - - for (Constr_Vars_Iter ci(lb_list[k]); ci; ci++) { - switch ((*ci).var->kind()) { - case Input_Var: - { - int pos = (*ci).var->get_position(); - h.update_coef(cal.input_var(pos), (*ci).coef); - break; - } - case Global_Var: - { - Global_Var_ID g = (*ci).var->get_global_var(); - Variable_ID v; - if (g->arity() == 0) - v = cal.get_local(g); - else - v = cal.get_local(g, (*ci).var->function_of()); - h.update_coef(v, (*ci).coef); - break; - } - default: - throw loop_error("cannot calculate temporay array size statically"); - } - } - h.update_const(lb_list[k].get_const()); - - h.update_const(1); - h.update_coef(cal.output_var(1), -1); - } - - cal = Restrict_Domain(cal, copy(copy_is)); - for (int j = 1; j <= cal.n_inp(); j++) - cal = Project(cal, j, Input_Var); - cal.simplify(); - - // pad temporary array size - // TODO: for variable array size, create padding formula - Conjunct *c = cal.query_DNF()->single_conjunct(); - bool is_index_bound_const = false; - for (GEQ_Iterator gi(c->GEQs()); gi && !is_index_bound_const; gi++) - if ((*gi).is_const(cal.output_var(1))) { - coef_t size = (*gi).get_const() / (-(*gi).get_coef(cal.output_var(1))); - if (padding_stride != 0) { - size = (size + index_stride[i] - 1) / index_stride[i]; - if (i == fastest_changing_dimension) - size = size * padding_stride; - } - if (i == fastest_changing_dimension) { - if (padding_alignment > 1) { // align to boundary for data packing - int residue = size % padding_alignment; - if (residue) - size = size+padding_alignment-residue; - } - else if (padding_alignment < -1) { // un-alignment for memory bank conflicts - while (gcd(size, static_cast(-padding_alignment)) != 1) - size++; - } - } - index_sz.push_back(std::make_pair(i, ocg->CreateInt(size))); - is_index_bound_const = true; - } - - if (!is_index_bound_const) { - for (GEQ_Iterator gi(c->GEQs()); gi && !is_index_bound_const; gi++) { - int coef = (*gi).get_coef(cal.output_var(1)); - if (coef < 0) { - CG_outputRepr *op = NULL; - for (Constr_Vars_Iter ci(*gi); ci; ci++) { - if ((*ci).var != cal.output_var(1)) { - switch((*ci).var->kind()) { - case Global_Var: - { - Global_Var_ID g = (*ci).var->get_global_var(); - if ((*ci).coef == 1) - op = ocg->CreatePlus(op, ocg->CreateIdent(g->base_name())); - else if ((*ci).coef == -1) - op = ocg->CreateMinus(op, ocg->CreateIdent(g->base_name())); - else if ((*ci).coef > 1) - op = ocg->CreatePlus(op, ocg->CreateTimes(ocg->CreateInt((*ci).coef), ocg->CreateIdent(g->base_name()))); - else // (*ci).coef < -1 - op = ocg->CreateMinus(op, ocg->CreateTimes(ocg->CreateInt(-(*ci).coef), ocg->CreateIdent(g->base_name()))); - break; - } - default: - throw loop_error("failed to generate array index bound code"); - } - } - } - int c = (*gi).get_const(); - if (c > 0) - op = ocg->CreatePlus(op, ocg->CreateInt(c)); - else if (c < 0) - op = ocg->CreateMinus(op, ocg->CreateInt(-c)); - if (padding_stride != 0) { - if (i == fastest_changing_dimension) { - coef_t g = gcd(index_stride[i], static_cast(padding_stride)); - coef_t t1 = index_stride[i] / g; - if (t1 != 1) - op = ocg->CreateIntegerDivide(ocg->CreatePlus(op, ocg->CreateInt(t1-1)), ocg->CreateInt(t1)); - coef_t t2 = padding_stride / g; - if (t2 != 1) - op = ocg->CreateTimes(op, ocg->CreateInt(t2)); - } - else if (index_stride[i] != 1) { - op = ocg->CreateIntegerDivide(ocg->CreatePlus(op, ocg->CreateInt(index_stride[i]-1)), ocg->CreateInt(index_stride[i])); - } - } - - index_sz.push_back(std::make_pair(i, op)); - break; - } - } - } - } - } - - // change the temporary array index order - for (int i = 0; i < index_sz.size(); i++) - if (index_sz[i].first == fastest_changing_dimension) - switch (sym->layout_type()) { - case IR_ARRAY_LAYOUT_ROW_MAJOR: - std::swap(index_sz[index_sz.size()-1], index_sz[i]); - break; - case IR_ARRAY_LAYOUT_COLUMN_MAJOR: - std::swap(index_sz[0], index_sz[i]); - break; - default: - throw loop_error("unsupported array layout"); - } - - // declare temporary array or scalar - IR_Symbol *tmp_sym; - if (index_sz.size() == 0) { - tmp_sym = ir->CreateScalarSymbol(sym, memory_type); - } - else { - std::vector tmp_array_size(index_sz.size()); - for (int i = 0; i < index_sz.size(); i++) - tmp_array_size[i] = index_sz[i].second->clone(); - tmp_sym = ir->CreateArraySymbol(sym, tmp_array_size, memory_type); - } - - // create temporary array read initialization code - CG_outputRepr *copy_code_read; - if (has_read_refs) - if (index_sz.size() == 0) { - IR_ScalarRef *tmp_scalar_ref = ir->CreateScalarRef(static_cast(tmp_sym)); - - std::vector rhs_index(n_dim); - for (int i = 0; i < index_lb.size(); i++) - if (is_index_eq[i]) - rhs_index[i] = index_lb[i]->clone(); - else - rhs_index[i] = ir->builder()->CreateIdent(copy_is.set_var(level-1+privatized_levels.size()+i+1)->name()); - IR_ArrayRef *copied_array_ref = ir->CreateArrayRef(sym, rhs_index); - - copy_code_read = ir->builder()->CreateAssignment(0, tmp_scalar_ref->convert(), copied_array_ref->convert()); - } - else { - std::vector lhs_index(index_sz.size()); - for (int i = 0; i < index_sz.size(); i++) { - int cur_index_num = index_sz[i].first; - CG_outputRepr *cur_index_repr = ocg->CreateMinus(ocg->CreateIdent(copy_is.set_var(level-1+privatized_levels.size()+cur_index_num+1)->name()), index_lb[cur_index_num]->clone()); - if (padding_stride != 0) { - if (i == n_dim-1) { - coef_t g = gcd(index_stride[cur_index_num], static_cast(padding_stride)); - coef_t t1 = index_stride[cur_index_num] / g; - if (t1 != 1) - cur_index_repr = ocg->CreateIntegerDivide(cur_index_repr, ocg->CreateInt(t1)); - coef_t t2 = padding_stride / g; - if (t2 != 1) - cur_index_repr = ocg->CreateTimes(cur_index_repr, ocg->CreateInt(t2)); - } - else if (index_stride[cur_index_num] != 1) { - cur_index_repr = ocg->CreateIntegerDivide(cur_index_repr, ocg->CreateInt(index_stride[cur_index_num])); - } - } - - if (ir->ArrayIndexStartAt() != 0) - cur_index_repr = ocg->CreatePlus(cur_index_repr, ocg->CreateInt(ir->ArrayIndexStartAt())); - lhs_index[i] = cur_index_repr; - } - - IR_ArrayRef *tmp_array_ref = ir->CreateArrayRef(static_cast(tmp_sym), lhs_index); - - std::vector rhs_index(n_dim); - for (int i = 0; i < index_lb.size(); i++) - if (is_index_eq[i]) - rhs_index[i] = index_lb[i]->clone(); - else - rhs_index[i] = ir->builder()->CreateIdent(copy_is.set_var(level-1+privatized_levels.size()+i+1)->name()); - IR_ArrayRef *copied_array_ref = ir->CreateArrayRef(sym, rhs_index); - - copy_code_read = ir->builder()->CreateAssignment(0, tmp_array_ref->convert(), copied_array_ref->convert()); - } - - // create temporary array write back code - CG_outputRepr *copy_code_write; - if (has_write_refs) - if (index_sz.size() == 0) { - IR_ScalarRef *tmp_scalar_ref = ir->CreateScalarRef(static_cast(tmp_sym)); - - std::vector rhs_index(n_dim); - for (int i = 0; i < index_lb.size(); i++) - if (is_index_eq[i]) - rhs_index[i] = index_lb[i]->clone(); - else - rhs_index[i] = ir->builder()->CreateIdent(copy_is.set_var(level-1+privatized_levels.size()+i+1)->name()); - IR_ArrayRef *copied_array_ref = ir->CreateArrayRef(sym, rhs_index); - - copy_code_write = ir->builder()->CreateAssignment(0, copied_array_ref->convert(), tmp_scalar_ref->convert()); - } - else { - std::vector lhs_index(n_dim); - for (int i = 0; i < index_lb.size(); i++) - if (is_index_eq[i]) - lhs_index[i] = index_lb[i]->clone(); - else - lhs_index[i] = ir->builder()->CreateIdent(copy_is.set_var(level-1+privatized_levels.size()+i+1)->name()); - IR_ArrayRef *copied_array_ref = ir->CreateArrayRef(sym, lhs_index); - - std::vector rhs_index(index_sz.size()); - for (int i = 0; i < index_sz.size(); i++) { - int cur_index_num = index_sz[i].first; - CG_outputRepr *cur_index_repr = ocg->CreateMinus(ocg->CreateIdent(copy_is.set_var(level-1+privatized_levels.size()+cur_index_num+1)->name()), index_lb[cur_index_num]->clone()); - if (padding_stride != 0) { - if (i == n_dim-1) { - coef_t g = gcd(index_stride[cur_index_num], static_cast(padding_stride)); - coef_t t1 = index_stride[cur_index_num] / g; - if (t1 != 1) - cur_index_repr = ocg->CreateIntegerDivide(cur_index_repr, ocg->CreateInt(t1)); - coef_t t2 = padding_stride / g; - if (t2 != 1) - cur_index_repr = ocg->CreateTimes(cur_index_repr, ocg->CreateInt(t2)); - } - else if (index_stride[cur_index_num] != 1) { - cur_index_repr = ocg->CreateIntegerDivide(cur_index_repr, ocg->CreateInt(index_stride[cur_index_num])); - } - } - - if (ir->ArrayIndexStartAt() != 0) - cur_index_repr = ocg->CreatePlus(cur_index_repr, ocg->CreateInt(ir->ArrayIndexStartAt())); - rhs_index[i] = cur_index_repr; - } - IR_ArrayRef *tmp_array_ref = ir->CreateArrayRef(static_cast(tmp_sym), rhs_index); - - copy_code_write = ir->builder()->CreateAssignment(0, copied_array_ref->convert(), tmp_array_ref->convert()); - } - - // now we can remove those loops for array indexes that are - // dependent on others - if (!(index_sz.size() == n_dim && (sym->layout_type() == IR_ARRAY_LAYOUT_ROW_MAJOR || n_dim <= 1))) { - Relation mapping(level-1+privatized_levels.size()+n_dim, level-1+privatized_levels.size()+index_sz.size()); - F_And *f_root = mapping.add_and(); - for (int i = 1; i <= level-1+privatized_levels.size(); i++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.input_var(i), 1); - h.update_coef(mapping.output_var(i), -1); - } - - int cur_index = 0; - std::vector mapped_index(index_sz.size()); - for (int i = 0; i < n_dim; i++) - if (!is_index_eq[i]) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.input_var(level-1+privatized_levels.size()+i+1), 1); - switch (sym->layout_type()) { - case IR_ARRAY_LAYOUT_COLUMN_MAJOR: { - h.update_coef(mapping.output_var(level-1+privatized_levels.size()+index_sz.size()-cur_index), -1); - mapped_index[index_sz.size()-cur_index-1] = i; - break; - } - case IR_ARRAY_LAYOUT_ROW_MAJOR: { - h.update_coef(mapping.output_var(level-1+privatized_levels.size()+cur_index+1), -1); - mapped_index[cur_index] = i; - break; - } - default: - throw loop_error("unsupported array layout"); - } - cur_index++; - } - - wo_copy_is = Range(Restrict_Domain(copy(mapping), wo_copy_is)); - ro_copy_is = Range(Restrict_Domain(copy(mapping), ro_copy_is)); - - // protonu--replacing Chun's old code - for (int i = 1; i <= level-1+privatized_levels.size(); i++) { - wo_copy_is.name_set_var(i, copy_is.set_var(i)->name()); - ro_copy_is.name_set_var(i, copy_is.set_var(i)->name()); - } - - - - for (int i = 0; i < index_sz.size(); i++) { - wo_copy_is.name_set_var(level-1+privatized_levels.size()+i+1, copy_is.set_var(level-1+privatized_levels.size()+mapped_index[i]+1)->name()); - ro_copy_is.name_set_var(level-1+privatized_levels.size()+i+1, copy_is.set_var(level-1+privatized_levels.size()+mapped_index[i]+1)->name()); - } - wo_copy_is.setup_names(); - ro_copy_is.setup_names(); - } - - // insert read copy statement - int old_num_stmt = stmt.size(); - int ro_copy_stmt_num = -1; - if (has_read_refs) { - Relation copy_xform(ro_copy_is.n_set(), 2*ro_copy_is.n_set()+1); - { - F_And *f_root = copy_xform.add_and(); - for (int i = 1; i <= ro_copy_is.n_set(); i++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(copy_xform.input_var(i), 1); - h.update_coef(copy_xform.output_var(2*i), -1); - } - for (int i = 1; i <= dim; i+=2) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(copy_xform.output_var(i), -1); - h.update_const(lex[i-1]); - } - for (int i = dim+2; i <= copy_xform.n_out(); i+=2) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(copy_xform.output_var(i), 1); - } - } - - Statement copy_stmt_read; - copy_stmt_read.IS = ro_copy_is; - copy_stmt_read.xform = copy_xform; - copy_stmt_read.code = copy_code_read; - copy_stmt_read.loop_level = std::vector(ro_copy_is.n_set()); - copy_stmt_read.ir_stmt_node = NULL; - for (int i = 0; i < level-1; i++) { - copy_stmt_read.loop_level[i].type = stmt[*(active.begin())].loop_level[i].type; - if (stmt[*(active.begin())].loop_level[i].type == LoopLevelTile && - stmt[*(active.begin())].loop_level[i].payload >= level) { - int j; - for (j = 0; j < privatized_levels.size(); j++) - if (privatized_levels[j] == stmt[*(active.begin())].loop_level[i].payload) - break; - if (j == privatized_levels.size()) - copy_stmt_read.loop_level[i].payload = -1; - else - copy_stmt_read.loop_level[i].payload = level + j; - } - else - copy_stmt_read.loop_level[i].payload = stmt[*(active.begin())].loop_level[i].payload; - copy_stmt_read.loop_level[i].parallel_level = stmt[*(active.begin())].loop_level[i].parallel_level; - } - for (int i = 0; i < privatized_levels.size(); i++) { - copy_stmt_read.loop_level[level-1+i].type = stmt[*(active.begin())].loop_level[privatized_levels[i]].type; - copy_stmt_read.loop_level[level-1+i].payload = stmt[*(active.begin())].loop_level[privatized_levels[i]].payload; - copy_stmt_read.loop_level[level-1+i].parallel_level = stmt[*(active.begin())].loop_level[privatized_levels[i]].parallel_level; - } - int left_num_dim = num_dep_dim - (get_last_dep_dim_before(*(active.begin()), level) + 1); - for (int i = 0; i < min(left_num_dim, static_cast(index_sz.size())); i++) { - copy_stmt_read.loop_level[level-1+privatized_levels.size()+i].type = LoopLevelOriginal; - copy_stmt_read.loop_level[level-1+privatized_levels.size()+i].payload = num_dep_dim-left_num_dim+i; - copy_stmt_read.loop_level[level-1+privatized_levels.size()+i].parallel_level = 0; - } - for (int i = min(left_num_dim, static_cast(index_sz.size())); i < index_sz.size(); i++) { - copy_stmt_read.loop_level[level-1+privatized_levels.size()+i].type = LoopLevelUnknown; - copy_stmt_read.loop_level[level-1+privatized_levels.size()+i].payload = -1; - copy_stmt_read.loop_level[level-1+privatized_levels.size()+i].parallel_level = 0; - } - - shiftLexicalOrder(lex, dim-1, 1); - stmt.push_back(copy_stmt_read); - ro_copy_stmt_num = stmt.size() - 1; - dep.insert(); - } - - // insert write copy statement - int wo_copy_stmt_num = -1; - if (has_write_refs) { - Relation copy_xform(wo_copy_is.n_set(), 2*wo_copy_is.n_set()+1); - { - F_And *f_root = copy_xform.add_and(); - for (int i = 1; i <= wo_copy_is.n_set(); i++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(copy_xform.input_var(i), 1); - h.update_coef(copy_xform.output_var(2*i), -1); - } - for (int i = 1; i <= dim; i+=2) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(copy_xform.output_var(i), -1); - h.update_const(lex[i-1]); - } - for (int i = dim+2; i <= copy_xform.n_out(); i+=2) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(copy_xform.output_var(i), 1); - } - } - - Statement copy_stmt_write; - copy_stmt_write.IS = wo_copy_is; - copy_stmt_write.xform = copy_xform; - copy_stmt_write.code = copy_code_write; - copy_stmt_write.loop_level = std::vector(wo_copy_is.n_set()); - copy_stmt_write.ir_stmt_node = NULL; - - for (int i = 0; i < level-1; i++) { - copy_stmt_write.loop_level[i].type = stmt[*(active.begin())].loop_level[i].type; - if (stmt[*(active.begin())].loop_level[i].type == LoopLevelTile && - stmt[*(active.begin())].loop_level[i].payload >= level) { - int j; - for (j = 0; j < privatized_levels.size(); j++) - if (privatized_levels[j] == stmt[*(active.begin())].loop_level[i].payload) - break; - if (j == privatized_levels.size()) - copy_stmt_write.loop_level[i].payload = -1; - else - copy_stmt_write.loop_level[i].payload = level + j; - } - else - copy_stmt_write.loop_level[i].payload = stmt[*(active.begin())].loop_level[i].payload; - copy_stmt_write.loop_level[i].parallel_level = stmt[*(active.begin())].loop_level[i].parallel_level; - } - for (int i = 0; i < privatized_levels.size(); i++) { - copy_stmt_write.loop_level[level-1+i].type = stmt[*(active.begin())].loop_level[privatized_levels[i]].type; - copy_stmt_write.loop_level[level-1+i].payload = stmt[*(active.begin())].loop_level[privatized_levels[i]].payload; - copy_stmt_write.loop_level[level-1+i].parallel_level = stmt[*(active.begin())].loop_level[privatized_levels[i]].parallel_level; - } - int left_num_dim = num_dep_dim - (get_last_dep_dim_before(*(active.begin()), level) + 1); - for (int i = 0; i < min(left_num_dim, static_cast(index_sz.size())); i++) { - copy_stmt_write.loop_level[level-1+privatized_levels.size()+i].type = LoopLevelOriginal; - copy_stmt_write.loop_level[level-1+privatized_levels.size()+i].payload = num_dep_dim-left_num_dim+i; - copy_stmt_write.loop_level[level-1+privatized_levels.size()+i].parallel_level = 0; - } - for (int i = min(left_num_dim, static_cast(index_sz.size())); i < index_sz.size(); i++) { - copy_stmt_write.loop_level[level-1+privatized_levels.size()+i].type = LoopLevelUnknown; - copy_stmt_write.loop_level[level-1+privatized_levels.size()+i].payload = -1; - copy_stmt_write.loop_level[level-1+privatized_levels.size()+i].parallel_level = 0; - } - - lex[dim-1]++; - shiftLexicalOrder(lex, dim-1, -2); - stmt.push_back(copy_stmt_write); - wo_copy_stmt_num = stmt.size() - 1; - dep.insert(); - } - - // replace original array accesses with temporary array accesses - for (int i =0; i < stmt_refs.size(); i++) - for (int j = 0; j < stmt_refs[i].second.size(); j++) { - if (index_sz.size() == 0) { - IR_ScalarRef *tmp_scalar_ref = ir->CreateScalarRef(static_cast(tmp_sym)); - ir->ReplaceExpression(stmt_refs[i].second[j], tmp_scalar_ref->convert()); - } - else { - std::vector index_repr(index_sz.size()); - for (int k = 0; k < index_sz.size(); k++) { - int cur_index_num = index_sz[k].first; - - CG_outputRepr *cur_index_repr = ocg->CreateMinus(stmt_refs[i].second[j]->index(cur_index_num), index_lb[cur_index_num]->clone()); - if (padding_stride != 0) { - if (k == n_dim-1) { - coef_t g = gcd(index_stride[cur_index_num], static_cast(padding_stride)); - coef_t t1 = index_stride[cur_index_num] / g; - if (t1 != 1) - cur_index_repr = ocg->CreateIntegerDivide(cur_index_repr, ocg->CreateInt(t1)); - coef_t t2 = padding_stride / g; - if (t2 != 1) - cur_index_repr = ocg->CreateTimes(cur_index_repr, ocg->CreateInt(t2)); - } - else if (index_stride[cur_index_num] != 1) { - cur_index_repr = ocg->CreateIntegerDivide(cur_index_repr, ocg->CreateInt(index_stride[cur_index_num])); - } - } - - if (ir->ArrayIndexStartAt() != 0) - cur_index_repr = ocg->CreatePlus(cur_index_repr, ocg->CreateInt(ir->ArrayIndexStartAt())); - index_repr[k] = cur_index_repr; - } - - IR_ArrayRef *tmp_array_ref = ir->CreateArrayRef(static_cast(tmp_sym), index_repr); - ir->ReplaceExpression(stmt_refs[i].second[j], tmp_array_ref->convert()); - } - } - - // update dependence graph - int dep_dim = get_last_dep_dim_before(*(active.begin()), level) + 1; - if (ro_copy_stmt_num != -1) { - for (int i = 0; i < old_num_stmt; i++) { - std::vector > D; - - for (DependenceGraph::EdgeList::iterator j = dep.vertex[i].second.begin(); j != dep.vertex[i].second.end();) { - if (active.find(i) != active.end() && active.find(j->first) == active.end()) { - std::vector dvs1, dvs2; - for (int k = 0; k < j->second.size(); k++) { - DependenceVector dv = j->second[k]; - if (dv.sym != NULL && dv.sym->name() == sym->name() && (dv.type == DEP_R2R || dv.type == DEP_R2W)) - dvs1.push_back(dv); - else - dvs2.push_back(dv); - } - j->second = dvs2; - if (dvs1.size() > 0) - dep.connect(ro_copy_stmt_num, j->first, dvs1); - } - else if (active.find(i) == active.end() && active.find(j->first) != active.end()) { - std::vector dvs1, dvs2; - for (int k = 0; k < j->second.size(); k++) { - DependenceVector dv = j->second[k]; - if (dv.sym != NULL && dv.sym->name() == sym->name() && (dv.type == DEP_R2R || dv.type == DEP_W2R)) - dvs1.push_back(dv); - else - dvs2.push_back(dv); - } - j->second = dvs2; - if (dvs1.size() > 0) - D.push_back(dvs1); - } - - if (j->second.size() == 0) - dep.vertex[i].second.erase(j++); - else - j++; - } - - for (int j = 0; j < D.size(); j++) - dep.connect(i, ro_copy_stmt_num, D[j]); - } - - // insert dependences from copy statement loop to copied statements - DependenceVector dv; - dv.type = DEP_W2R; - dv.sym = tmp_sym->clone(); - dv.lbounds = std::vector(num_dep_dim, 0); - dv.ubounds = std::vector(num_dep_dim, 0); - for (int i = dep_dim; i < num_dep_dim; i++) { - dv.lbounds[i] = -posInfinity; - dv.ubounds[i] = posInfinity; - } - for (std::set::iterator i = active.begin(); i != active.end(); i++) - dep.connect(ro_copy_stmt_num, *i, dv); - } - - if (wo_copy_stmt_num != -1) { - for (int i = 0; i < old_num_stmt; i++) { - std::vector > D; - - for (DependenceGraph::EdgeList::iterator j = dep.vertex[i].second.begin(); j != dep.vertex[i].second.end();) { - if (active.find(i) != active.end() && active.find(j->first) == active.end()) { - std::vector dvs1, dvs2; - for (int k = 0; k < j->second.size(); k++) { - DependenceVector dv = j->second[k]; - if (dv.sym != NULL && dv.sym->name() == sym->name() && (dv.type == DEP_W2R || dv.type == DEP_W2W)) - dvs1.push_back(dv); - else - dvs2.push_back(dv); - } - j->second = dvs2; - if (dvs1.size() > 0) - dep.connect(wo_copy_stmt_num, j->first, dvs1); - } - else if (active.find(i) == active.end() && active.find(j->first) != active.end()) { - std::vector dvs1, dvs2; - for (int k = 0; k < j->second.size(); k++) { - DependenceVector dv = j->second[k]; - if (dv.sym != NULL && dv.sym->name() == sym->name() && (dv.type == DEP_R2W || dv.type == DEP_W2W)) - dvs1.push_back(dv); - else - dvs2.push_back(dv); - } - j->second = dvs2; - if (dvs1.size() > 0) - D.push_back(dvs1); - } - - if (j->second.size() == 0) - dep.vertex[i].second.erase(j++); - else - j++; - } - - for (int j = 0; j < D.size(); j++) - dep.connect(i, wo_copy_stmt_num, D[j]); - } - - // insert dependences from copied statements to write statements - DependenceVector dv; - dv.type = DEP_W2R; - dv.sym = tmp_sym->clone(); - dv.lbounds = std::vector(num_dep_dim, 0); - dv.ubounds = std::vector(num_dep_dim, 0); - for (int i = dep_dim; i < num_dep_dim; i++) { - dv.lbounds[i] = -posInfinity; - dv.ubounds[i] = posInfinity; - } - for (std::set::iterator i = active.begin(); i != active.end(); i++) - dep.connect(*i, wo_copy_stmt_num, dv); - - } - - // update variable name for dependences among copied statements - for (int i = 0; i < old_num_stmt; i++) { - if (active.find(i) != active.end()) - for (DependenceGraph::EdgeList::iterator j = dep.vertex[i].second.begin(); j != dep.vertex[i].second.end(); j++) - if (active.find(j->first) != active.end()) - for (int k = 0; k < j->second.size(); k++) { - IR_Symbol *s = tmp_sym->clone(); - j->second[k].sym = s; - } - } - - // insert anti-dependence from write statement to read statement - if (ro_copy_stmt_num != -1 && wo_copy_stmt_num != -1) - if (dep_dim >= 0) { - DependenceVector dv; - dv.type = DEP_R2W; - dv.sym = tmp_sym->clone(); - dv.lbounds = std::vector(num_dep_dim, 0); - dv.ubounds = std::vector(num_dep_dim, 0); - for (int k = dep_dim; k < num_dep_dim; k++) { - dv.lbounds[k] = -posInfinity; - dv.ubounds[k] = posInfinity; - } - for (int k = 0; k < dep_dim; k++) { - if (k != 0) { - dv.lbounds[k-1] = 0; - dv.ubounds[k-1] = 0; - } - dv.lbounds[k] = 1; - dv.ubounds[k] = posInfinity; - dep.connect(wo_copy_stmt_num, ro_copy_stmt_num, dv); - } - } - - - // cleanup - delete sym; - delete tmp_sym; - for (int i = 0; i < index_lb.size(); i++) { - index_lb[i]->clear(); - delete index_lb[i]; - } - for (int i = 0; i < index_sz.size(); i++) { - index_sz[i].second->clear(); - delete index_sz[i].second; - } - - return true; - } -*/ -bool Loop::datacopy_privatized(const std::vector > > &stmt_refs, int level, - const std::vector &privatized_levels, - bool allow_extra_read, int fastest_changing_dimension, - int padding_stride, int padding_alignment, int memory_type) { - if (stmt_refs.size() == 0) - return true; - - // check for sanity of parameters - IR_ArraySymbol *sym = NULL; - std::vector lex; - std::set active; - if (level <= 0) - throw std::invalid_argument("invalid loop level " + to_string(level)); - for (int i = 0; i < privatized_levels.size(); i++) { - if (i == 0) { - if (privatized_levels[i] < level) - throw std::invalid_argument("privatized loop levels must be no less than level " + to_string(level)); - } - else if (privatized_levels[i] <= privatized_levels[i-1]) - throw std::invalid_argument("privatized loop levels must be in ascending order"); - } - for (int i = 0; i < stmt_refs.size(); i++) { - int stmt_num = stmt_refs[i].first; - active.insert(stmt_num); - if (stmt_num < 0 || stmt_num >= stmt.size()) - throw std::invalid_argument("invalid statement number " + to_string(stmt_num)); - if (privatized_levels.size() != 0) { - if (privatized_levels[privatized_levels.size()-1] > stmt[stmt_num].loop_level.size()) - throw std::invalid_argument("invalid loop level " + to_string(privatized_levels[privatized_levels.size()-1]) + " for statement " + to_string(stmt_num)); - } - else { - if (level > stmt[stmt_num].loop_level.size()) - throw std::invalid_argument("invalid loop level " + to_string(level) + " for statement " + to_string(stmt_num)); - } - for (int j = 0; j < stmt_refs[i].second.size(); j++) { - if (sym == NULL) { - sym = stmt_refs[i].second[j]->symbol(); - lex = getLexicalOrder(stmt_num); - } - else { - IR_ArraySymbol *t = stmt_refs[i].second[j]->symbol(); - if (t->name() != sym->name()) { - delete t; - delete sym; - throw std::invalid_argument("try to copy data from different arrays"); - } - delete t; - } - } - } - if (!(fastest_changing_dimension >= -1 && fastest_changing_dimension < sym->n_dim())) - throw std::invalid_argument("invalid fastest changing dimension for the array to be copied"); - if (padding_stride < 0) - throw std::invalid_argument("invalid temporary array stride requirement"); - if (padding_alignment == -1 || padding_alignment == 0) - throw std::invalid_argument("invalid temporary array alignment requirement"); - - int dim = 2*level - 1; - int n_dim = sym->n_dim(); - - - if (fastest_changing_dimension == -1) - switch (sym->layout_type()) { - case IR_ARRAY_LAYOUT_ROW_MAJOR: - fastest_changing_dimension = n_dim - 1; - break; - case IR_ARRAY_LAYOUT_COLUMN_MAJOR: - fastest_changing_dimension = 0; - break; - default: - throw loop_error("unsupported array layout"); - } - - - // invalidate saved codegen computation - delete last_compute_cgr_; - last_compute_cgr_ = NULL; - delete last_compute_cg_; - last_compute_cg_ = NULL; - - // build iteration spaces for all reads and for all writes separately - apply_xform(active); - - bool has_write_refs = false; - bool has_read_refs = false; - Relation wo_copy_is = Relation::False(level-1+privatized_levels.size()+n_dim); - Relation ro_copy_is = Relation::False(level-1+privatized_levels.size()+n_dim); - for (int i = 0; i < stmt_refs.size(); i++) { - int stmt_num = stmt_refs[i].first; - - for (int j = 0; j < stmt_refs[i].second.size(); j++) { - Relation mapping(stmt[stmt_num].IS.n_set(), level-1+privatized_levels.size()+n_dim); - for (int k = 1; k <= mapping.n_inp(); k++) - mapping.name_input_var(k, stmt[stmt_num].IS.set_var(k)->name()); - mapping.setup_names(); - F_And *f_root = mapping.add_and(); - for (int k = 1; k <= level-1; k++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.input_var(k), 1); - h.update_coef(mapping.output_var(k), -1); - } - for (int k = 0; k < privatized_levels.size(); k++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.input_var(privatized_levels[k]), 1); - h.update_coef(mapping.output_var(level+k), -1); - } - for (int k = 0; k < n_dim; k++) { - CG_outputRepr *repr = stmt_refs[i].second[j]->index(k); - exp2formula(ir, mapping, f_root, freevar, repr, mapping.output_var(level-1+privatized_levels.size()+k+1), 'w', IR_COND_EQ, false); - repr->clear(); - delete repr; - } - Relation r = Range(Restrict_Domain(mapping, Intersection(copy(stmt[stmt_num].IS), Extend_Set(copy(this->known), stmt[stmt_num].IS.n_set() - this->known.n_set())))); - if (stmt_refs[i].second[j]->is_write()) { - has_write_refs = true; - wo_copy_is = Union(wo_copy_is, r); - wo_copy_is.simplify(2, 4); - - - } - else { - has_read_refs = true; - ro_copy_is = Union(ro_copy_is, r); - ro_copy_is.simplify(2, 4); - - } - } - } - - // simplify read and write footprint iteration space - { - if (allow_extra_read) - ro_copy_is = SimpleHull(ro_copy_is, true, true); - else - ro_copy_is = ConvexRepresentation(ro_copy_is); - - wo_copy_is = ConvexRepresentation(wo_copy_is); - if (wo_copy_is.number_of_conjuncts() > 1) { - Relation t = SimpleHull(wo_copy_is, true, true); - if (Must_Be_Subset(copy(t), copy(ro_copy_is))) - wo_copy_is = t; - else if (Must_Be_Subset(copy(wo_copy_is), copy(ro_copy_is))) - wo_copy_is = ro_copy_is; - } - } - - // make copy statement variable names match the ones in the original statements which - // already have the same names due to apply_xform - { - int ref_stmt = *active.begin(); - for (std::set::iterator i = active.begin(); i != active.end(); i++) - if (stmt[*i].IS.n_set() > stmt[ref_stmt].IS.n_set()) - ref_stmt = *i; - for (int i = 1; i < level; i++) { - std::string s = stmt[ref_stmt].IS.input_var(i)->name(); - wo_copy_is.name_set_var(i, s); - ro_copy_is.name_set_var(i, s); - } - for (int i = 0; i < privatized_levels.size(); i++) { - std::string s = stmt[ref_stmt].IS.input_var(privatized_levels[i])->name(); - wo_copy_is.name_set_var(level+i, s); - ro_copy_is.name_set_var(level+i, s); - } - for (int i = level+privatized_levels.size(); i < level+privatized_levels.size()+n_dim; i++) { - std::string s = tmp_loop_var_name_prefix + to_string(tmp_loop_var_name_counter+i-level-privatized_levels.size()); - wo_copy_is.name_set_var(i, s); - ro_copy_is.name_set_var(i, s); - } - tmp_loop_var_name_counter += n_dim; - wo_copy_is.setup_names(); - ro_copy_is.setup_names(); - } - - // build merged footprint iteration space for calculating temporary array size - Relation copy_is = SimpleHull(Union(copy(ro_copy_is), copy(wo_copy_is)), true, true); - - // extract temporary array information - CG_outputBuilder *ocg = ir->builder(); - std::vector index_lb(n_dim); // initialized to NULL - std::vector index_stride(n_dim); - std::vector is_index_eq(n_dim, false); - std::vector > index_sz(0); - Relation reduced_copy_is = copy(copy_is); - - for (int i = 0; i < n_dim; i++) { - if (i != 0) - reduced_copy_is = Project(reduced_copy_is, level-1+privatized_levels.size()+i, Set_Var); - Relation bound = get_loop_bound(reduced_copy_is, level-1+privatized_levels.size()+i); - - // extract stride - std::pair result = find_simplest_stride(bound, bound.set_var(level-1+privatized_levels.size()+i+1)); - if (result.second != NULL) - index_stride[i] = abs(result.first.get_coef(result.second))/gcd(abs(result.first.get_coef(result.second)), abs(result.first.get_coef(bound.set_var(level-1+privatized_levels.size()+i+1)))); - else - index_stride[i] = 1; - - // check if this arary index requires loop - Conjunct *c = bound.query_DNF()->single_conjunct(); - for (EQ_Iterator ei(c->EQs()); ei; ei++) { - if ((*ei).has_wildcards()) - continue; - - int coef = (*ei).get_coef(bound.set_var(level-1+privatized_levels.size()+i+1)); - if (coef != 0) { - int sign = 1; - if (coef < 0) { - coef = -coef; - sign = -1; - } - - CG_outputRepr *op = NULL; - for (Constr_Vars_Iter ci(*ei); ci; ci++) { - switch ((*ci).var->kind()) { - case Input_Var: - { - if ((*ci).var != bound.set_var(level-1+privatized_levels.size()+i+1)) - if ((*ci).coef*sign == 1) - op = ocg->CreateMinus(op, ocg->CreateIdent((*ci).var->name())); - else if ((*ci).coef*sign == -1) - op = ocg->CreatePlus(op, ocg->CreateIdent((*ci).var->name())); - else if ((*ci).coef*sign > 1) - op = ocg->CreateMinus(op, ocg->CreateTimes(ocg->CreateInt(abs((*ci).coef)), ocg->CreateIdent((*ci).var->name()))); - else // (*ci).coef*sign < -1 - op = ocg->CreatePlus(op, ocg->CreateTimes(ocg->CreateInt(abs((*ci).coef)), ocg->CreateIdent((*ci).var->name()))); - break; - } - case Global_Var: - { - Global_Var_ID g = (*ci).var->get_global_var(); - if ((*ci).coef*sign == 1) - op = ocg->CreateMinus(op, ocg->CreateIdent(g->base_name())); - else if ((*ci).coef*sign == -1) - op = ocg->CreatePlus(op, ocg->CreateIdent(g->base_name())); - else if ((*ci).coef*sign > 1) - op = ocg->CreateMinus(op, ocg->CreateTimes(ocg->CreateInt(abs((*ci).coef)), ocg->CreateIdent(g->base_name()))); - else // (*ci).coef*sign < -1 - op = ocg->CreatePlus(op, ocg->CreateTimes(ocg->CreateInt(abs((*ci).coef)), ocg->CreateIdent(g->base_name()))); - break; - } - default: - throw loop_error("unsupported array index expression"); - } - } - if ((*ei).get_const() != 0) - op = ocg->CreatePlus(op, ocg->CreateInt(-sign*((*ei).get_const()))); - if (coef != 1) - op = ocg->CreateIntegerFloor(op, ocg->CreateInt(coef)); - - index_lb[i] = op; - is_index_eq[i] = true; - break; - } - } - if (is_index_eq[i]) - continue; - - // seperate lower and upper bounds - std::vector lb_list, ub_list; - std::set excluded_floor_vars; - excluded_floor_vars.insert(bound.set_var(level-1+privatized_levels.size()+i+1)); - for (GEQ_Iterator gi(c->GEQs()); gi; gi++) { - int coef = (*gi).get_coef(bound.set_var(level-1+privatized_levels.size()+i+1)); - if (coef != 0 && (*gi).has_wildcards()) { - bool clean_bound = true; - GEQ_Handle h; - for (Constr_Vars_Iter cvi(*gi, true); gi; gi++) - if (!find_floor_definition(bound, (*cvi).var, excluded_floor_vars).first) { - clean_bound = false; - break; - } - if (!clean_bound) - continue; - } - - if (coef > 0) - lb_list.push_back(*gi); - else if (coef < 0) - ub_list.push_back(*gi); - } - if (lb_list.size() == 0 || ub_list.size() == 0) - throw loop_error("failed to calcuate array footprint size"); - - // build lower bound representation - std::vector lb_repr_list; - for (int j = 0; j < lb_list.size(); j++){ - if(this->known.n_set() == 0) - lb_repr_list.push_back(output_lower_bound_repr(ocg, lb_list[j], bound.set_var(level-1+privatized_levels.size()+i+1), result.first, result.second, bound, Relation::True(bound.n_set()), std::vector >(bound.n_set(), std::make_pair(static_cast(NULL), 0)))); - else - lb_repr_list.push_back(output_lower_bound_repr(ocg, lb_list[j], bound.set_var(level-1+privatized_levels.size()+i+1), result.first, result.second, bound, this->known, std::vector >(bound.n_set(), std::make_pair(static_cast(NULL), 0)))); - } - if (lb_repr_list.size() > 1) - index_lb[i] = ocg->CreateInvoke("max", lb_repr_list); - else if (lb_repr_list.size() == 1) - index_lb[i] = lb_repr_list[0]; - - // build temporary array size representation - { - Relation cal(copy_is.n_set(), 1); - F_And *f_root = cal.add_and(); - for (int j = 0; j < ub_list.size(); j++) - for (int k = 0; k < lb_list.size(); k++) { - GEQ_Handle h = f_root->add_GEQ(); - - for (Constr_Vars_Iter ci(ub_list[j]); ci; ci++) { - switch ((*ci).var->kind()) { - case Input_Var: - { - int pos = (*ci).var->get_position(); - h.update_coef(cal.input_var(pos), (*ci).coef); - break; - } - case Global_Var: - { - Global_Var_ID g = (*ci).var->get_global_var(); - Variable_ID v; - if (g->arity() == 0) - v = cal.get_local(g); - else - v = cal.get_local(g, (*ci).var->function_of()); - h.update_coef(v, (*ci).coef); - break; - } - default: - throw loop_error("cannot calculate temporay array size statically"); - } - } - h.update_const(ub_list[j].get_const()); - - for (Constr_Vars_Iter ci(lb_list[k]); ci; ci++) { - switch ((*ci).var->kind()) { - case Input_Var: - { - int pos = (*ci).var->get_position(); - h.update_coef(cal.input_var(pos), (*ci).coef); - break; - } - case Global_Var: - { - Global_Var_ID g = (*ci).var->get_global_var(); - Variable_ID v; - if (g->arity() == 0) - v = cal.get_local(g); - else - v = cal.get_local(g, (*ci).var->function_of()); - h.update_coef(v, (*ci).coef); - break; - } - default: - throw loop_error("cannot calculate temporay array size statically"); - } - } - h.update_const(lb_list[k].get_const()); - - h.update_const(1); - h.update_coef(cal.output_var(1), -1); - } - - cal = Restrict_Domain(cal, copy(copy_is)); - for (int j = 1; j <= cal.n_inp(); j++) - cal = Project(cal, j, Input_Var); - cal.simplify(); - - // pad temporary array size - // TODO: for variable array size, create padding formula - Conjunct *c = cal.query_DNF()->single_conjunct(); - bool is_index_bound_const = false; - for (GEQ_Iterator gi(c->GEQs()); gi && !is_index_bound_const; gi++) - if ((*gi).is_const(cal.output_var(1))) { - coef_t size = (*gi).get_const() / (-(*gi).get_coef(cal.output_var(1))); - if (padding_stride != 0) { - size = (size + index_stride[i] - 1) / index_stride[i]; - if (i == fastest_changing_dimension) - size = size * padding_stride; - } - if (i == fastest_changing_dimension) { - if (padding_alignment > 1) { // align to boundary for data packing - int residue = size % padding_alignment; - if (residue) - size = size+padding_alignment-residue; - } - else if (padding_alignment < -1) { // un-alignment for memory bank conflicts - while (gcd(size, static_cast(-padding_alignment)) != 1) - size++; - } - } - index_sz.push_back(std::make_pair(i, ocg->CreateInt(size))); - is_index_bound_const = true; - } - - if (!is_index_bound_const) { - for (GEQ_Iterator gi(c->GEQs()); gi && !is_index_bound_const; gi++) { - int coef = (*gi).get_coef(cal.output_var(1)); - if (coef < 0) { - CG_outputRepr *op = NULL; - for (Constr_Vars_Iter ci(*gi); ci; ci++) { - if ((*ci).var != cal.output_var(1)) { - switch((*ci).var->kind()) { - case Global_Var: - { - Global_Var_ID g = (*ci).var->get_global_var(); - if ((*ci).coef == 1) - op = ocg->CreatePlus(op, ocg->CreateIdent(g->base_name())); - else if ((*ci).coef == -1) - op = ocg->CreateMinus(op, ocg->CreateIdent(g->base_name())); - else if ((*ci).coef > 1) - op = ocg->CreatePlus(op, ocg->CreateTimes(ocg->CreateInt((*ci).coef), ocg->CreateIdent(g->base_name()))); - else // (*ci).coef < -1 - op = ocg->CreateMinus(op, ocg->CreateTimes(ocg->CreateInt(-(*ci).coef), ocg->CreateIdent(g->base_name()))); - break; - } - default: - throw loop_error("failed to generate array index bound code"); - } - } - } - int c = (*gi).get_const(); - if (c > 0) - op = ocg->CreatePlus(op, ocg->CreateInt(c)); - else if (c < 0) - op = ocg->CreateMinus(op, ocg->CreateInt(-c)); - if (padding_stride != 0) { - if (i == fastest_changing_dimension) { - coef_t g = gcd(index_stride[i], static_cast(padding_stride)); - coef_t t1 = index_stride[i] / g; - if (t1 != 1) - op = ocg->CreateIntegerFloor(ocg->CreatePlus(op, ocg->CreateInt(t1-1)), ocg->CreateInt(t1)); - coef_t t2 = padding_stride / g; - if (t2 != 1) - op = ocg->CreateTimes(op, ocg->CreateInt(t2)); - } - else if (index_stride[i] != 1) { - op = ocg->CreateIntegerFloor(ocg->CreatePlus(op, ocg->CreateInt(index_stride[i]-1)), ocg->CreateInt(index_stride[i])); - } - } - - index_sz.push_back(std::make_pair(i, op)); - break; - } - } - } - } - } - - // change the temporary array index order - for (int i = 0; i < index_sz.size(); i++) - if (index_sz[i].first == fastest_changing_dimension) - switch (sym->layout_type()) { - case IR_ARRAY_LAYOUT_ROW_MAJOR: - std::swap(index_sz[index_sz.size()-1], index_sz[i]); - break; - case IR_ARRAY_LAYOUT_COLUMN_MAJOR: - std::swap(index_sz[0], index_sz[i]); - break; - default: - throw loop_error("unsupported array layout"); - } - - // declare temporary array or scalar - IR_Symbol *tmp_sym; - if (index_sz.size() == 0) { - tmp_sym = ir->CreateScalarSymbol(sym, memory_type); - } - else { - std::vector tmp_array_size(index_sz.size()); - for (int i = 0; i < index_sz.size(); i++) - tmp_array_size[i] = index_sz[i].second->clone(); - tmp_sym = ir->CreateArraySymbol(sym, tmp_array_size, memory_type); - } - - // create temporary array read initialization code - CG_outputRepr *copy_code_read; - if (has_read_refs) - if (index_sz.size() == 0) { - IR_ScalarRef *tmp_scalar_ref = ir->CreateScalarRef(static_cast(tmp_sym)); - - std::vector rhs_index(n_dim); - for (int i = 0; i < index_lb.size(); i++) - if (is_index_eq[i]) - rhs_index[i] = index_lb[i]->clone(); - else - rhs_index[i] = ir->builder()->CreateIdent(copy_is.set_var(level-1+privatized_levels.size()+i+1)->name()); - IR_ArrayRef *copied_array_ref = ir->CreateArrayRef(sym, rhs_index); - - copy_code_read = ir->builder()->CreateAssignment(0, tmp_scalar_ref->convert(), copied_array_ref->convert()); - } - else { - std::vector lhs_index(index_sz.size()); - for (int i = 0; i < index_sz.size(); i++) { - int cur_index_num = index_sz[i].first; - CG_outputRepr *cur_index_repr = ocg->CreateMinus(ocg->CreateIdent(copy_is.set_var(level-1+privatized_levels.size()+cur_index_num+1)->name()), index_lb[cur_index_num]->clone()); - if (padding_stride != 0) { - if (i == n_dim-1) { - coef_t g = gcd(index_stride[cur_index_num], static_cast(padding_stride)); - coef_t t1 = index_stride[cur_index_num] / g; - if (t1 != 1) - cur_index_repr = ocg->CreateIntegerFloor(cur_index_repr, ocg->CreateInt(t1)); - coef_t t2 = padding_stride / g; - if (t2 != 1) - cur_index_repr = ocg->CreateTimes(cur_index_repr, ocg->CreateInt(t2)); - } - else if (index_stride[cur_index_num] != 1) { - cur_index_repr = ocg->CreateIntegerFloor(cur_index_repr, ocg->CreateInt(index_stride[cur_index_num])); - } - } - - if (ir->ArrayIndexStartAt() != 0) - cur_index_repr = ocg->CreatePlus(cur_index_repr, ocg->CreateInt(ir->ArrayIndexStartAt())); - lhs_index[i] = cur_index_repr; - } - - IR_ArrayRef *tmp_array_ref = ir->CreateArrayRef(static_cast(tmp_sym), lhs_index); - - std::vector rhs_index(n_dim); - for (int i = 0; i < index_lb.size(); i++) - if (is_index_eq[i]) - rhs_index[i] = index_lb[i]->clone(); - else - rhs_index[i] = ir->builder()->CreateIdent(copy_is.set_var(level-1+privatized_levels.size()+i+1)->name()); - IR_ArrayRef *copied_array_ref = ir->CreateArrayRef(sym, rhs_index); - - copy_code_read = ir->builder()->CreateAssignment(0, tmp_array_ref->convert(), copied_array_ref->convert()); - } - - // create temporary array write back code - CG_outputRepr *copy_code_write; - if (has_write_refs) - if (index_sz.size() == 0) { - IR_ScalarRef *tmp_scalar_ref = ir->CreateScalarRef(static_cast(tmp_sym)); - - std::vector rhs_index(n_dim); - for (int i = 0; i < index_lb.size(); i++) - if (is_index_eq[i]) - rhs_index[i] = index_lb[i]->clone(); - else - rhs_index[i] = ir->builder()->CreateIdent(copy_is.set_var(level-1+privatized_levels.size()+i+1)->name()); - IR_ArrayRef *copied_array_ref = ir->CreateArrayRef(sym, rhs_index); - - copy_code_write = ir->builder()->CreateAssignment(0, copied_array_ref->convert(), tmp_scalar_ref->convert()); - } - else { - std::vector lhs_index(n_dim); - for (int i = 0; i < index_lb.size(); i++) - if (is_index_eq[i]) - lhs_index[i] = index_lb[i]->clone(); - else - lhs_index[i] = ir->builder()->CreateIdent(copy_is.set_var(level-1+privatized_levels.size()+i+1)->name()); - IR_ArrayRef *copied_array_ref = ir->CreateArrayRef(sym, lhs_index); - - std::vector rhs_index(index_sz.size()); - for (int i = 0; i < index_sz.size(); i++) { - int cur_index_num = index_sz[i].first; - CG_outputRepr *cur_index_repr = ocg->CreateMinus(ocg->CreateIdent(copy_is.set_var(level-1+privatized_levels.size()+cur_index_num+1)->name()), index_lb[cur_index_num]->clone()); - if (padding_stride != 0) { - if (i == n_dim-1) { - coef_t g = gcd(index_stride[cur_index_num], static_cast(padding_stride)); - coef_t t1 = index_stride[cur_index_num] / g; - if (t1 != 1) - cur_index_repr = ocg->CreateIntegerFloor(cur_index_repr, ocg->CreateInt(t1)); - coef_t t2 = padding_stride / g; - if (t2 != 1) - cur_index_repr = ocg->CreateTimes(cur_index_repr, ocg->CreateInt(t2)); - } - else if (index_stride[cur_index_num] != 1) { - cur_index_repr = ocg->CreateIntegerFloor(cur_index_repr, ocg->CreateInt(index_stride[cur_index_num])); - } - } - - if (ir->ArrayIndexStartAt() != 0) - cur_index_repr = ocg->CreatePlus(cur_index_repr, ocg->CreateInt(ir->ArrayIndexStartAt())); - rhs_index[i] = cur_index_repr; - } - IR_ArrayRef *tmp_array_ref = ir->CreateArrayRef(static_cast(tmp_sym), rhs_index); - - copy_code_write = ir->builder()->CreateAssignment(0, copied_array_ref->convert(), tmp_array_ref->convert()); - } - - // now we can remove those loops for array indexes that are - // dependent on others - if (!(index_sz.size() == n_dim && (sym->layout_type() == IR_ARRAY_LAYOUT_ROW_MAJOR || n_dim <= 1))) { - Relation mapping(level-1+privatized_levels.size()+n_dim, level-1+privatized_levels.size()+index_sz.size()); - F_And *f_root = mapping.add_and(); - for (int i = 1; i <= level-1+privatized_levels.size(); i++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.input_var(i), 1); - h.update_coef(mapping.output_var(i), -1); - } - - int cur_index = 0; - std::vector mapped_index(index_sz.size()); - for (int i = 0; i < n_dim; i++) - if (!is_index_eq[i]) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.input_var(level-1+privatized_levels.size()+i+1), 1); - switch (sym->layout_type()) { - case IR_ARRAY_LAYOUT_COLUMN_MAJOR: { - h.update_coef(mapping.output_var(level-1+privatized_levels.size()+index_sz.size()-cur_index), -1); - mapped_index[index_sz.size()-cur_index-1] = i; - break; - } - case IR_ARRAY_LAYOUT_ROW_MAJOR: { - h.update_coef(mapping.output_var(level-1+privatized_levels.size()+cur_index+1), -1); - mapped_index[cur_index] = i; - break; - } - default: - throw loop_error("unsupported array layout"); - } - cur_index++; - } - - wo_copy_is = Range(Restrict_Domain(copy(mapping), wo_copy_is)); - ro_copy_is = Range(Restrict_Domain(copy(mapping), ro_copy_is)); - for (int i = 1; i <= level-1+privatized_levels.size(); i++) { - wo_copy_is.name_set_var(i, copy_is.set_var(i)->name()); - ro_copy_is.name_set_var(i, copy_is.set_var(i)->name()); - } - for (int i = 0; i < index_sz.size(); i++) { - wo_copy_is.name_set_var(level-1+privatized_levels.size()+i+1, copy_is.set_var(level-1+privatized_levels.size()+mapped_index[i]+1)->name()); - ro_copy_is.name_set_var(level-1+privatized_levels.size()+i+1, copy_is.set_var(level-1+privatized_levels.size()+mapped_index[i]+1)->name()); - } - wo_copy_is.setup_names(); - ro_copy_is.setup_names(); - } - - // insert read copy statement - int old_num_stmt = stmt.size(); - int ro_copy_stmt_num = -1; - if (has_read_refs) { - Relation copy_xform(ro_copy_is.n_set(), 2*ro_copy_is.n_set()+1); - { - F_And *f_root = copy_xform.add_and(); - for (int i = 1; i <= ro_copy_is.n_set(); i++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(copy_xform.input_var(i), 1); - h.update_coef(copy_xform.output_var(2*i), -1); - } - for (int i = 1; i <= dim; i+=2) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(copy_xform.output_var(i), -1); - h.update_const(lex[i-1]); - } - for (int i = dim+2; i <= copy_xform.n_out(); i+=2) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(copy_xform.output_var(i), 1); - } - } - - Statement copy_stmt_read; - copy_stmt_read.IS = ro_copy_is; - copy_stmt_read.xform = copy_xform; - copy_stmt_read.code = copy_code_read; - copy_stmt_read.loop_level = std::vector(ro_copy_is.n_set()); - copy_stmt_read.ir_stmt_node = NULL; - for (int i = 0; i < level-1; i++) { - copy_stmt_read.loop_level[i].type = stmt[*(active.begin())].loop_level[i].type; - if (stmt[*(active.begin())].loop_level[i].type == LoopLevelTile && - stmt[*(active.begin())].loop_level[i].payload >= level) { - int j; - for (j = 0; j < privatized_levels.size(); j++) - if (privatized_levels[j] == stmt[*(active.begin())].loop_level[i].payload) - break; - if (j == privatized_levels.size()) - copy_stmt_read.loop_level[i].payload = -1; - else - copy_stmt_read.loop_level[i].payload = level + j; - } - else - copy_stmt_read.loop_level[i].payload = stmt[*(active.begin())].loop_level[i].payload; - copy_stmt_read.loop_level[i].parallel_level = stmt[*(active.begin())].loop_level[i].parallel_level; - } - for (int i = 0; i < privatized_levels.size(); i++) { - copy_stmt_read.loop_level[level-1+i].type = stmt[*(active.begin())].loop_level[privatized_levels[i]].type; - copy_stmt_read.loop_level[level-1+i].payload = stmt[*(active.begin())].loop_level[privatized_levels[i]].payload; - copy_stmt_read.loop_level[level-1+i].parallel_level = stmt[*(active.begin())].loop_level[privatized_levels[i]].parallel_level; - } - int left_num_dim = num_dep_dim - (get_last_dep_dim_before(*(active.begin()), level) + 1); - for (int i = 0; i < min(left_num_dim, static_cast(index_sz.size())); i++) { - copy_stmt_read.loop_level[level-1+privatized_levels.size()+i].type = LoopLevelOriginal; - copy_stmt_read.loop_level[level-1+privatized_levels.size()+i].payload = num_dep_dim-left_num_dim+i; - copy_stmt_read.loop_level[level-1+privatized_levels.size()+i].parallel_level = 0; - } - for (int i = min(left_num_dim, static_cast(index_sz.size())); i < index_sz.size(); i++) { - copy_stmt_read.loop_level[level-1+privatized_levels.size()+i].type = LoopLevelUnknown; - copy_stmt_read.loop_level[level-1+privatized_levels.size()+i].payload = -1; - copy_stmt_read.loop_level[level-1+privatized_levels.size()+i].parallel_level = 0; - } - - - shiftLexicalOrder(lex, dim-1, 1); - stmt.push_back(copy_stmt_read); - ro_copy_stmt_num = stmt.size() - 1; - dep.insert(); - } - - // insert write copy statement - int wo_copy_stmt_num = -1; - if (has_write_refs) { - Relation copy_xform(wo_copy_is.n_set(), 2*wo_copy_is.n_set()+1); - { - F_And *f_root = copy_xform.add_and(); - for (int i = 1; i <= wo_copy_is.n_set(); i++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(copy_xform.input_var(i), 1); - h.update_coef(copy_xform.output_var(2*i), -1); - } - for (int i = 1; i <= dim; i+=2) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(copy_xform.output_var(i), -1); - h.update_const(lex[i-1]); - } - for (int i = dim+2; i <= copy_xform.n_out(); i+=2) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(copy_xform.output_var(i), 1); - } - } - - Statement copy_stmt_write; - copy_stmt_write.IS = wo_copy_is; - copy_stmt_write.xform = copy_xform; - copy_stmt_write.code = copy_code_write; - copy_stmt_write.loop_level = std::vector(wo_copy_is.n_set()); - copy_stmt_write.ir_stmt_node = NULL; - - for (int i = 0; i < level-1; i++) { - copy_stmt_write.loop_level[i].type = stmt[*(active.begin())].loop_level[i].type; - if (stmt[*(active.begin())].loop_level[i].type == LoopLevelTile && - stmt[*(active.begin())].loop_level[i].payload >= level) { - int j; - for (j = 0; j < privatized_levels.size(); j++) - if (privatized_levels[j] == stmt[*(active.begin())].loop_level[i].payload) - break; - if (j == privatized_levels.size()) - copy_stmt_write.loop_level[i].payload = -1; - else - copy_stmt_write.loop_level[i].payload = level + j; - } - else - copy_stmt_write.loop_level[i].payload = stmt[*(active.begin())].loop_level[i].payload; - copy_stmt_write.loop_level[i].parallel_level = stmt[*(active.begin())].loop_level[i].parallel_level; - } - for (int i = 0; i < privatized_levels.size(); i++) { - copy_stmt_write.loop_level[level-1+i].type = stmt[*(active.begin())].loop_level[privatized_levels[i]].type; - copy_stmt_write.loop_level[level-1+i].payload = stmt[*(active.begin())].loop_level[privatized_levels[i]].payload; - copy_stmt_write.loop_level[level-1+i].parallel_level = stmt[*(active.begin())].loop_level[privatized_levels[i]].parallel_level; - } - int left_num_dim = num_dep_dim - (get_last_dep_dim_before(*(active.begin()), level) + 1); - for (int i = 0; i < min(left_num_dim, static_cast(index_sz.size())); i++) { - copy_stmt_write.loop_level[level-1+privatized_levels.size()+i].type = LoopLevelOriginal; - copy_stmt_write.loop_level[level-1+privatized_levels.size()+i].payload = num_dep_dim-left_num_dim+i; - copy_stmt_write.loop_level[level-1+privatized_levels.size()+i].parallel_level = 0; - } - for (int i = min(left_num_dim, static_cast(index_sz.size())); i < index_sz.size(); i++) { - copy_stmt_write.loop_level[level-1+privatized_levels.size()+i].type = LoopLevelUnknown; - copy_stmt_write.loop_level[level-1+privatized_levels.size()+i].payload = -1; - copy_stmt_write.loop_level[level-1+privatized_levels.size()+i].parallel_level = 0; - } - lex[dim-1]++; - shiftLexicalOrder(lex, dim-1, -2); - stmt.push_back(copy_stmt_write); - wo_copy_stmt_num = stmt.size() - 1; - dep.insert(); - } - - // replace original array accesses with temporary array accesses - for (int i =0; i < stmt_refs.size(); i++) - for (int j = 0; j < stmt_refs[i].second.size(); j++) { - if (index_sz.size() == 0) { - IR_ScalarRef *tmp_scalar_ref = ir->CreateScalarRef(static_cast(tmp_sym)); - ir->ReplaceExpression(stmt_refs[i].second[j], tmp_scalar_ref->convert()); - } - else { - std::vector index_repr(index_sz.size()); - for (int k = 0; k < index_sz.size(); k++) { - int cur_index_num = index_sz[k].first; - - CG_outputRepr *cur_index_repr = ocg->CreateMinus(stmt_refs[i].second[j]->index(cur_index_num), index_lb[cur_index_num]->clone()); - if (padding_stride != 0) { - if (k == n_dim-1) { - coef_t g = gcd(index_stride[cur_index_num], static_cast(padding_stride)); - coef_t t1 = index_stride[cur_index_num] / g; - if (t1 != 1) - cur_index_repr = ocg->CreateIntegerFloor(cur_index_repr, ocg->CreateInt(t1)); - coef_t t2 = padding_stride / g; - if (t2 != 1) - cur_index_repr = ocg->CreateTimes(cur_index_repr, ocg->CreateInt(t2)); - } - else if (index_stride[cur_index_num] != 1) { - cur_index_repr = ocg->CreateIntegerFloor(cur_index_repr, ocg->CreateInt(index_stride[cur_index_num])); - } - } - - if (ir->ArrayIndexStartAt() != 0) - cur_index_repr = ocg->CreatePlus(cur_index_repr, ocg->CreateInt(ir->ArrayIndexStartAt())); - index_repr[k] = cur_index_repr; - } - - IR_ArrayRef *tmp_array_ref = ir->CreateArrayRef(static_cast(tmp_sym), index_repr); - ir->ReplaceExpression(stmt_refs[i].second[j], tmp_array_ref->convert()); - } - } - - // update dependence graph - int dep_dim = get_last_dep_dim_before(*(active.begin()), level) + 1; - if (ro_copy_stmt_num != -1) { - for (int i = 0; i < old_num_stmt; i++) { - std::vector > D; - - for (DependenceGraph::EdgeList::iterator j = dep.vertex[i].second.begin(); j != dep.vertex[i].second.end();) { - if (active.find(i) != active.end() && active.find(j->first) == active.end()) { - std::vector dvs1, dvs2; - for (int k = 0; k < j->second.size(); k++) { - DependenceVector dv = j->second[k]; - if (dv.sym != NULL && dv.sym->name() == sym->name() && (dv.type == DEP_R2R || dv.type == DEP_R2W)) - dvs1.push_back(dv); - else - dvs2.push_back(dv); - } - j->second = dvs2; - if (dvs1.size() > 0) - dep.connect(ro_copy_stmt_num, j->first, dvs1); - } - else if (active.find(i) == active.end() && active.find(j->first) != active.end()) { - std::vector dvs1, dvs2; - for (int k = 0; k < j->second.size(); k++) { - DependenceVector dv = j->second[k]; - if (dv.sym != NULL && dv.sym->name() == sym->name() && (dv.type == DEP_R2R || dv.type == DEP_W2R)) - dvs1.push_back(dv); - else - dvs2.push_back(dv); - } - j->second = dvs2; - if (dvs1.size() > 0) - D.push_back(dvs1); - } - - if (j->second.size() == 0) - dep.vertex[i].second.erase(j++); - else - j++; - } - - for (int j = 0; j < D.size(); j++) - dep.connect(i, ro_copy_stmt_num, D[j]); - } - - // insert dependences from copy statement loop to copied statements - DependenceVector dv; - dv.type = DEP_W2R; - dv.sym = tmp_sym->clone(); - dv.lbounds = std::vector(dep.num_dim(), 0); - dv.ubounds = std::vector(dep.num_dim(), 0); - for (int i = dep_dim; i < dep.num_dim(); i++) { - dv.lbounds[i] = -posInfinity; - dv.ubounds[i] = posInfinity; - } - for (std::set::iterator i = active.begin(); i != active.end(); i++) - dep.connect(ro_copy_stmt_num, *i, dv); - } - - if (wo_copy_stmt_num != -1) { - for (int i = 0; i < old_num_stmt; i++) { - std::vector > D; - - for (DependenceGraph::EdgeList::iterator j = dep.vertex[i].second.begin(); j != dep.vertex[i].second.end();) { - if (active.find(i) != active.end() && active.find(j->first) == active.end()) { - std::vector dvs1, dvs2; - for (int k = 0; k < j->second.size(); k++) { - DependenceVector dv = j->second[k]; - if (dv.sym != NULL && dv.sym->name() == sym->name() && (dv.type == DEP_W2R || dv.type == DEP_W2W)) - dvs1.push_back(dv); - else - dvs2.push_back(dv); - } - j->second = dvs2; - if (dvs1.size() > 0) - dep.connect(wo_copy_stmt_num, j->first, dvs1); - } - else if (active.find(i) == active.end() && active.find(j->first) != active.end()) { - std::vector dvs1, dvs2; - for (int k = 0; k < j->second.size(); k++) { - DependenceVector dv = j->second[k]; - if (dv.sym != NULL && dv.sym->name() == sym->name() && (dv.type == DEP_R2W || dv.type == DEP_W2W)) - dvs1.push_back(dv); - else - dvs2.push_back(dv); - } - j->second = dvs2; - if (dvs1.size() > 0) - D.push_back(dvs1); - } - - if (j->second.size() == 0) - dep.vertex[i].second.erase(j++); - else - j++; - } - - for (int j = 0; j < D.size(); j++) - dep.connect(i, wo_copy_stmt_num, D[j]); - } - - // insert dependences from copied statements to write statements - DependenceVector dv; - dv.type = DEP_W2R; - dv.sym = tmp_sym->clone(); - dv.lbounds = std::vector(dep.num_dim(), 0); - dv.ubounds = std::vector(dep.num_dim(), 0); - for (int i = dep_dim; i < dep.num_dim(); i++) { - dv.lbounds[i] = -posInfinity; - dv.ubounds[i] = posInfinity; - } - for (std::set::iterator i = active.begin(); i != active.end(); i++) - dep.connect(*i, wo_copy_stmt_num, dv); - - } - - // update variable name for dependences among copied statements - for (int i = 0; i < old_num_stmt; i++) { - if (active.find(i) != active.end()) - for (DependenceGraph::EdgeList::iterator j = dep.vertex[i].second.begin(); j != dep.vertex[i].second.end(); j++) - if (active.find(j->first) != active.end()) - for (int k = 0; k < j->second.size(); k++) { - IR_Symbol *s = tmp_sym->clone(); - j->second[k].sym = s; - } - } - - // insert anti-dependence from write statement to read statement - if (ro_copy_stmt_num != -1 && wo_copy_stmt_num != -1) - if (dep_dim >= 0) { - DependenceVector dv; - dv.type = DEP_R2W; - dv.sym = tmp_sym->clone(); - dv.lbounds = std::vector(dep.num_dim(), 0); - dv.ubounds = std::vector(dep.num_dim(), 0); - for (int k = dep_dim; k < dep.num_dim(); k++) { - dv.lbounds[k] = -posInfinity; - dv.ubounds[k] = posInfinity; - } - for (int k = 0; k < dep_dim; k++) { - if (k != 0) { - dv.lbounds[k-1] = 0; - dv.ubounds[k-1] = 0; - } - dv.lbounds[k] = 1; - dv.ubounds[k] = posInfinity; - dep.connect(wo_copy_stmt_num, ro_copy_stmt_num, dv); - } - } - - // cleanup - delete sym; - delete tmp_sym; - for (int i = 0; i < index_lb.size(); i++) { - index_lb[i]->clear(); - delete index_lb[i]; - } - for (int i = 0; i < index_sz.size(); i++) { - index_sz[i].second->clear(); - delete index_sz[i].second; - } - - return true; -} diff --git a/loop_extra.cc b/loop_extra.cc deleted file mode 100644 index 2412403..0000000 --- a/loop_extra.cc +++ /dev/null @@ -1,224 +0,0 @@ -/***************************************************************************** - Copyright (C) 2010 University of Utah - All Rights Reserved. - - Purpose: - Additional loop transformations. - - Notes: - - History: - 07/31/10 Created by Chun Chen -*****************************************************************************/ - -#include -#include -#include "loop.hh" -#include "omegatools.hh" -#include "ir_code.hh" -#include "chill_error.hh" - -using namespace omega; - - -void Loop::shift_to(int stmt_num, int level, int absolute_position) { - // combo - tile(stmt_num, level, 1, level, CountedTile); - std::vector lex = getLexicalOrder(stmt_num); - std::set active = getStatements(lex, 2*level-2); - shift(active, level, absolute_position); - - // remove unnecessary tiled loop since tile size is one - for (std::set::iterator i = active.begin(); i != active.end(); i++) { - int n = stmt[*i].xform.n_out(); - Relation mapping(n, n-2); - F_And *f_root = mapping.add_and(); - for (int j = 1; j <= 2*level; j++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.output_var(j), 1); - h.update_coef(mapping.input_var(j), -1); - } - for (int j = 2*level+3; j <= n; j++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.output_var(j-2), 1); - h.update_coef(mapping.input_var(j), -1); - } - stmt[*i].xform = Composition(mapping, stmt[*i].xform); - stmt[*i].xform.simplify(); - - for (int j = 0; j < stmt[*i].loop_level.size(); j++) - if (j != level-1 && - stmt[*i].loop_level[j].type == LoopLevelTile && - stmt[*i].loop_level[j].payload >= level) - stmt[*i].loop_level[j].payload--; - - stmt[*i].loop_level.erase(stmt[*i].loop_level.begin()+level-1); - } -} - - -std::set Loop::unroll_extra(int stmt_num, int level, int unroll_amount, int cleanup_split_level) { - std::set cleanup_stmts = unroll(stmt_num, level, unroll_amount,std::vector< std::vector >(), cleanup_split_level); - for (std::set::iterator i = cleanup_stmts.begin(); i != cleanup_stmts.end(); i++) - unroll(*i, level, 0); - - return cleanup_stmts; -} - -void Loop::peel(int stmt_num, int level, int peel_amount) { - // check for sanity of parameters - if (stmt_num < 0 || stmt_num >= stmt.size()) - throw std::invalid_argument("invalid statement number " + to_string(stmt_num)); - if (level <= 0 || level > stmt[stmt_num].loop_level.size()) - throw std::invalid_argument("invalid loop level " + to_string(level)); - - if (peel_amount == 0) - return; - - std::set subloop = getSubLoopNest(stmt_num, level); - std::vector Rs; - for (std::set::iterator i = subloop.begin(); i != subloop.end(); i++) { - Relation r = getNewIS(*i); - Relation f(r.n_set(), level); - F_And *f_root = f.add_and(); - for (int j = 1; j <= level; j++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(f.input_var(2*j), 1); - h.update_coef(f.output_var(j), -1); - } - r = Composition(f, r); - r.simplify(); - Rs.push_back(r); - } - Relation hull = SimpleHull(Rs); - - if (peel_amount > 0) { - GEQ_Handle bound_eq; - bool found_bound = false; - for (GEQ_Iterator e(hull.single_conjunct()->GEQs()); e; e++) - if (!(*e).has_wildcards() && (*e).get_coef(hull.set_var(level)) > 0) { - bound_eq = *e; - found_bound = true; - break; - } - if (!found_bound) - for (GEQ_Iterator e(hull.single_conjunct()->GEQs()); e; e++) - if ((*e).has_wildcards() && (*e).get_coef(hull.set_var(level)) > 0) { - bool is_bound = true; - for (Constr_Vars_Iter cvi(*e, true); cvi; cvi++) { - std::pair result = find_floor_definition(hull, cvi.curr_var()); - if (!result.first) { - is_bound = false; - break; - } - } - if (is_bound) { - bound_eq = *e; - found_bound = true; - break; - } - } - if (!found_bound) - throw loop_error("can't find lower bound for peeling at loop level " + to_string(level)); - - for (int i = 1; i <= peel_amount; i++) { - Relation r(level); - F_Exists *f_exists = r.add_and()->add_exists(); - F_And *f_root = f_exists->add_and(); - GEQ_Handle h = f_root->add_GEQ(); - std::map exists_mapping; - for (Constr_Vars_Iter cvi(bound_eq); cvi; cvi++) - switch (cvi.curr_var()->kind()) { - case Input_Var: - h.update_coef(r.set_var(cvi.curr_var()->get_position()), cvi.curr_coef()); - break; - case Wildcard_Var: { - Variable_ID v = replicate_floor_definition(hull, cvi.curr_var(), r, f_exists, f_root, exists_mapping); - h.update_coef(v, cvi.curr_coef()); - break; - } - case Global_Var: { - Global_Var_ID g = cvi.curr_var()->get_global_var(); - Variable_ID v; - if (g->arity() == 0) - v = r.get_local(g); - else - v = r.get_local(g, cvi.curr_var()->function_of()); - h.update_coef(v, cvi.curr_coef()); - break; - } - default: - assert(false); - } - h.update_const(bound_eq.get_const() - i); - r.simplify(); - - split(stmt_num, level, r); - } - } - else { // peel_amount < 0 - GEQ_Handle bound_eq; - bool found_bound = false; - for (GEQ_Iterator e(hull.single_conjunct()->GEQs()); e; e++) - if (!(*e).has_wildcards() && (*e).get_coef(hull.set_var(level)) < 0) { - bound_eq = *e; - found_bound = true; - break; - } - if (!found_bound) - for (GEQ_Iterator e(hull.single_conjunct()->GEQs()); e; e++) - if ((*e).has_wildcards() && (*e).get_coef(hull.set_var(level)) < 0) { - bool is_bound = true; - for (Constr_Vars_Iter cvi(*e, true); cvi; cvi++) { - std::pair result = find_floor_definition(hull, cvi.curr_var()); - if (!result.first) { - is_bound = false; - break; - } - } - if (is_bound) { - bound_eq = *e; - found_bound = true; - break; - } - } - if (!found_bound) - throw loop_error("can't find upper bound for peeling at loop level " + to_string(level)); - - for (int i = 1; i <= -peel_amount; i++) { - Relation r(level); - F_Exists *f_exists = r.add_and()->add_exists(); - F_And *f_root = f_exists->add_and(); - GEQ_Handle h = f_root->add_GEQ(); - std::map exists_mapping; - for (Constr_Vars_Iter cvi(bound_eq); cvi; cvi++) - switch (cvi.curr_var()->kind()) { - case Input_Var: - h.update_coef(r.set_var(cvi.curr_var()->get_position()), cvi.curr_coef()); - break; - case Wildcard_Var: { - Variable_ID v = replicate_floor_definition(hull, cvi.curr_var(), r, f_exists, f_root, exists_mapping); - h.update_coef(v, cvi.curr_coef()); - break; - } - case Global_Var: { - Global_Var_ID g = cvi.curr_var()->get_global_var(); - Variable_ID v; - if (g->arity() == 0) - v = r.get_local(g); - else - v = r.get_local(g, cvi.curr_var()->function_of()); - h.update_coef(v, cvi.curr_coef()); - break; - } - default: - assert(false); - } - h.update_const(bound_eq.get_const() - i); - r.simplify(); - - split(stmt_num, level, r); - } - } -} - diff --git a/loop_tile.cc b/loop_tile.cc deleted file mode 100644 index ad1d3b7..0000000 --- a/loop_tile.cc +++ /dev/null @@ -1,630 +0,0 @@ -/* - * loop_tile.cc - * - * Created on: Nov 12, 2012 - * Author: anand - */ - -#include -#include "loop.hh" -#include "omegatools.hh" -#include "ir_code.hh" -#include "chill_error.hh" - -using namespace omega; - - - - -void Loop::tile(int stmt_num, int level, int tile_size, int outer_level, - TilingMethodType method, int alignment_offset, int alignment_multiple) { - // check for sanity of parameters - if (tile_size < 0) - throw std::invalid_argument("invalid tile size"); - if (alignment_multiple < 1 || alignment_offset < 0) - throw std::invalid_argument("invalid alignment for tile"); - if (stmt_num < 0 || stmt_num >= stmt.size()) - throw std::invalid_argument("invalid statement " + to_string(stmt_num)); - if (level <= 0) - throw std::invalid_argument("invalid loop level " + to_string(level)); - if (level > stmt[stmt_num].loop_level.size()) - throw std::invalid_argument( - "there is no loop level " + to_string(level) + " for statement " - + to_string(stmt_num)); - if (outer_level <= 0 || outer_level > level) - throw std::invalid_argument( - "invalid tile controlling loop level " - + to_string(outer_level)); - - // invalidate saved codegen computation - delete last_compute_cgr_; - last_compute_cgr_ = NULL; - delete last_compute_cg_; - last_compute_cg_ = NULL; - - int dim = 2 * level - 1; - int outer_dim = 2 * outer_level - 1; - std::vector lex = getLexicalOrder(stmt_num); - std::set same_tiled_loop = getStatements(lex, dim - 1); - std::set same_tile_controlling_loop = getStatements(lex, - outer_dim - 1); - - for (std::set::iterator i = same_tiled_loop.begin(); - i != same_tiled_loop.end(); i++) { - for (DependenceGraph::EdgeList::iterator j = - dep.vertex[*i].second.begin(); j != dep.vertex[*i].second.end(); - j++) { - if (same_tiled_loop.find(j->first) != same_tiled_loop.end()) - for (int k = 0; k < j->second.size(); k++) { - DependenceVector dv = j->second[k]; - int dim2 = level - 1; - if ((dv.type != DEP_CONTROL) && (dv.type != DEP_UNKNOWN)) { - while (stmt[*i].loop_level[dim2].type == LoopLevelTile) { - dim2 = stmt[*i].loop_level[dim2].payload - 1; - } - dim2 = stmt[*i].loop_level[dim2].payload; - - if (dv.hasNegative(dim2) && (!dv.quasi)) { - for (int l = outer_level; l < level; l++) - if (stmt[*i].loop_level[l - 1].type - != LoopLevelTile) { - if (dv.isCarried( - stmt[*i].loop_level[l - 1].payload) - && dv.hasPositive( - stmt[*i].loop_level[l - 1].payload)) - throw loop_error( - "loop error: Tiling is illegal, dependence violation!"); - } else { - - int dim3 = l - 1; - while (stmt[*i].loop_level[l - 1].type - != LoopLevelTile) { - dim3 = - stmt[*i].loop_level[l - 1].payload - - 1; - - } - - dim3 = stmt[*i].loop_level[l - 1].payload; - if (dim3 < level - 1) - if (dv.isCarried(dim3) - && dv.hasPositive(dim3)) - throw loop_error( - "loop error: Tiling is illegal, dependence violation!"); - } - } - } - } - } - } - // special case for no tiling - if (tile_size == 0) { - for (std::set::iterator i = same_tile_controlling_loop.begin(); - i != same_tile_controlling_loop.end(); i++) { - Relation r(stmt[*i].xform.n_out(), stmt[*i].xform.n_out() + 2); - F_And *f_root = r.add_and(); - for (int j = 1; j <= 2 * outer_level - 1; j++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(r.input_var(j), 1); - h.update_coef(r.output_var(j), -1); - } - EQ_Handle h1 = f_root->add_EQ(); - h1.update_coef(r.output_var(2 * outer_level), 1); - EQ_Handle h2 = f_root->add_EQ(); - h2.update_coef(r.output_var(2 * outer_level + 1), 1); - for (int j = 2 * outer_level; j <= stmt[*i].xform.n_out(); j++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(r.input_var(j), 1); - h.update_coef(r.output_var(j + 2), -1); - } - - stmt[*i].xform = Composition(copy(r), stmt[*i].xform); - } - } - // normal tiling - else { - std::set private_stmt; - for (std::set::iterator i = same_tile_controlling_loop.begin(); - i != same_tile_controlling_loop.end(); i++) { -// if (same_tiled_loop.find(*i) == same_tiled_loop.end() && !is_single_iteration(getNewIS(*i), dim)) -// same_tiled_loop.insert(*i); - - // should test dim's value directly but it is ok for now -// if (same_tiled_loop.find(*i) == same_tiled_loop.end() && get_const(stmt[*i].xform, dim+1, Output_Var) == posInfinity) - if (same_tiled_loop.find(*i) == same_tiled_loop.end() - && overflow.find(*i) != overflow.end()) - private_stmt.insert(*i); - } - - // extract the union of the iteration space to be considered - Relation hull; - /*{ - Tuple < Relation > r_list; - Tuple r_mask; - - for (std::set::iterator i = same_tile_controlling_loop.begin(); - i != same_tile_controlling_loop.end(); i++) - if (private_stmt.find(*i) == private_stmt.end()) { - Relation r = project_onto_levels(getNewIS(*i), dim + 1, - true); - for (int j = outer_dim; j < dim; j++) - r = Project(r, j + 1, Set_Var); - for (int j = 0; j < outer_dim; j += 2) - r = Project(r, j + 1, Set_Var); - r_list.append(r); - r_mask.append(1); - } - - hull = Hull(r_list, r_mask, 1, true); - }*/ - - { - std::vector r_list; - - for (std::set::iterator i = same_tile_controlling_loop.begin(); - i != same_tile_controlling_loop.end(); i++) - if (private_stmt.find(*i) == private_stmt.end()) { - Relation r = getNewIS(*i); - for (int j = dim + 2; j <= r.n_set(); j++) - r = Project(r, r.set_var(j)); - for (int j = outer_dim; j < dim; j++) - r = Project(r, j + 1, Set_Var); - for (int j = 0; j < outer_dim; j += 2) - r = Project(r, j + 1, Set_Var); - r.simplify(2, 4); - r_list.push_back(r); - } - - hull = SimpleHull(r_list); - // hull = Hull(r_list, std::vector(r_list.size(), true), 1, true); - } - - // extract the bound of the dimension to be tiled - Relation bound = get_loop_bound(hull, dim); - if (!bound.has_single_conjunct()) { - // further simplify the bound - hull = Approximate(hull); - bound = get_loop_bound(hull, dim); - - int i = outer_dim - 2; - while (!bound.has_single_conjunct() && i >= 0) { - hull = Project(hull, i + 1, Set_Var); - bound = get_loop_bound(hull, dim); - i -= 2; - } - - if (!bound.has_single_conjunct()) - throw loop_error("cannot handle tile bounds"); - } - - // separate lower and upper bounds - std::vector lb_list, ub_list; - { - Conjunct *c = bound.query_DNF()->single_conjunct(); - for (GEQ_Iterator gi(c->GEQs()); gi; gi++) { - int coef = (*gi).get_coef(bound.set_var(dim + 1)); - if (coef < 0) - ub_list.push_back(*gi); - else if (coef > 0) - lb_list.push_back(*gi); - } - } - if (lb_list.size() == 0) - throw loop_error( - "unable to calculate tile controlling loop lower bound"); - if (ub_list.size() == 0) - throw loop_error( - "unable to calculate tile controlling loop upper bound"); - - // find the simplest lower bound for StridedTile or simplest iteration count for CountedTile - int simplest_lb = 0, simplest_ub = 0; - if (method == StridedTile) { - int best_cost = INT_MAX; - for (int i = 0; i < lb_list.size(); i++) { - int cost = 0; - for (Constr_Vars_Iter ci(lb_list[i]); ci; ci++) { - switch ((*ci).var->kind()) { - case Input_Var: { - cost += 5; - break; - } - case Global_Var: { - cost += 2; - break; - } - default: - cost += 15; - break; - } - } - - if (cost < best_cost) { - best_cost = cost; - simplest_lb = i; - } - } - } else if (method == CountedTile) { - std::map s1, s2, s3; - int best_cost = INT_MAX; - for (int i = 0; i < lb_list.size(); i++) - for (int j = 0; j < ub_list.size(); j++) { - int cost = 0; - - for (Constr_Vars_Iter ci(lb_list[i]); ci; ci++) { - switch ((*ci).var->kind()) { - case Input_Var: { - s1[(*ci).var] += (*ci).coef; - break; - } - case Global_Var: { - s2[(*ci).var] += (*ci).coef; - break; - } - case Exists_Var: - case Wildcard_Var: { - s3[(*ci).var] += (*ci).coef; - break; - } - default: - cost = INT_MAX - 2; - break; - } - } - - for (Constr_Vars_Iter ci(ub_list[j]); ci; ci++) { - switch ((*ci).var->kind()) { - case Input_Var: { - s1[(*ci).var] += (*ci).coef; - break; - } - case Global_Var: { - s2[(*ci).var] += (*ci).coef; - break; - } - case Exists_Var: - case Wildcard_Var: { - s3[(*ci).var] += (*ci).coef; - break; - } - default: - if (cost == INT_MAX - 2) - cost = INT_MAX - 1; - else - cost = INT_MAX - 3; - break; - } - } - - if (cost == 0) { - for (std::map::iterator k = - s1.begin(); k != s1.end(); k++) - if ((*k).second != 0) - cost += 5; - for (std::map::iterator k = - s2.begin(); k != s2.end(); k++) - if ((*k).second != 0) - cost += 2; - for (std::map::iterator k = - s3.begin(); k != s3.end(); k++) - if ((*k).second != 0) - cost += 15; - } - - if (cost < best_cost) { - best_cost = cost; - simplest_lb = i; - simplest_ub = j; - } - } - } - - // prepare the new transformation relations - for (std::set::iterator i = same_tile_controlling_loop.begin(); - i != same_tile_controlling_loop.end(); i++) { - Relation r(stmt[*i].xform.n_out(), stmt[*i].xform.n_out() + 2); - F_And *f_root = r.add_and(); - for (int j = 0; j < outer_dim - 1; j++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(r.output_var(j + 1), 1); - h.update_coef(r.input_var(j + 1), -1); - } - - for (int j = outer_dim - 1; j < stmt[*i].xform.n_out(); j++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(r.output_var(j + 3), 1); - h.update_coef(r.input_var(j + 1), -1); - } - - EQ_Handle h = f_root->add_EQ(); - h.update_coef(r.output_var(outer_dim), 1); - h.update_const(-lex[outer_dim - 1]); - - stmt[*i].xform = Composition(r, stmt[*i].xform); - } - - // add tiling constraints. - for (std::set::iterator i = same_tile_controlling_loop.begin(); - i != same_tile_controlling_loop.end(); i++) { - F_And *f_super_root = stmt[*i].xform.and_with_and(); - F_Exists *f_exists = f_super_root->add_exists(); - F_And *f_root = f_exists->add_and(); - - // create a lower bound variable for easy formula creation later - Variable_ID aligned_lb; - { - Variable_ID lb = f_exists->declare(); - coef_t coef = lb_list[simplest_lb].get_coef( - bound.set_var(dim + 1)); - if (coef == 1) { // e.g. if i >= m+5, then LB = m+5 - EQ_Handle h = f_root->add_EQ(); - h.update_coef(lb, 1); - for (Constr_Vars_Iter ci(lb_list[simplest_lb]); ci; ci++) { - switch ((*ci).var->kind()) { - case Input_Var: { - int pos = (*ci).var->get_position(); - if (pos != dim + 1) - h.update_coef(stmt[*i].xform.output_var(pos), - (*ci).coef); - break; - } - case Global_Var: { - Global_Var_ID g = (*ci).var->get_global_var(); - Variable_ID v; - if (g->arity() == 0) - v = stmt[*i].xform.get_local(g); - else - v = stmt[*i].xform.get_local(g, - (*ci).var->function_of()); - h.update_coef(v, (*ci).coef); - break; - } - default: - throw loop_error("cannot handle tile bounds"); - } - } - h.update_const(lb_list[simplest_lb].get_const()); - } else { // e.g. if 2i >= m+5, then m+5 <= 2*LB < m+5+2 - GEQ_Handle h1 = f_root->add_GEQ(); - GEQ_Handle h2 = f_root->add_GEQ(); - for (Constr_Vars_Iter ci(lb_list[simplest_lb]); ci; ci++) { - switch ((*ci).var->kind()) { - case Input_Var: { - int pos = (*ci).var->get_position(); - if (pos == dim + 1) { - h1.update_coef(lb, (*ci).coef); - h2.update_coef(lb, -(*ci).coef); - } else { - h1.update_coef(stmt[*i].xform.output_var(pos), - (*ci).coef); - h2.update_coef(stmt[*i].xform.output_var(pos), - -(*ci).coef); - } - break; - } - case Global_Var: { - Global_Var_ID g = (*ci).var->get_global_var(); - Variable_ID v; - if (g->arity() == 0) - v = stmt[*i].xform.get_local(g); - else - v = stmt[*i].xform.get_local(g, - (*ci).var->function_of()); - h1.update_coef(v, (*ci).coef); - h2.update_coef(v, -(*ci).coef); - break; - } - default: - throw loop_error("cannot handle tile bounds"); - } - } - h1.update_const(lb_list[simplest_lb].get_const()); - h2.update_const(-lb_list[simplest_lb].get_const()); - h2.update_const(coef - 1); - } - - Variable_ID offset_lb; - if (alignment_offset == 0) - offset_lb = lb; - else { - EQ_Handle h = f_root->add_EQ(); - offset_lb = f_exists->declare(); - h.update_coef(offset_lb, 1); - h.update_coef(lb, -1); - h.update_const(alignment_offset); - } - - if (alignment_multiple == 1) { // trivial - aligned_lb = offset_lb; - } else { // e.g. to align at 4, aligned_lb = 4*alpha && LB-4 < 4*alpha <= LB - aligned_lb = f_exists->declare(); - Variable_ID e = f_exists->declare(); - - EQ_Handle h = f_root->add_EQ(); - h.update_coef(aligned_lb, 1); - h.update_coef(e, -alignment_multiple); - - GEQ_Handle h1 = f_root->add_GEQ(); - GEQ_Handle h2 = f_root->add_GEQ(); - h1.update_coef(e, alignment_multiple); - h2.update_coef(e, -alignment_multiple); - h1.update_coef(offset_lb, -1); - h2.update_coef(offset_lb, 1); - h1.update_const(alignment_multiple - 1); - } - } - - // create an upper bound variable for easy formula creation later - Variable_ID ub = f_exists->declare(); - { - coef_t coef = -ub_list[simplest_ub].get_coef( - bound.set_var(dim + 1)); - if (coef == 1) { // e.g. if i <= m+5, then UB = m+5 - EQ_Handle h = f_root->add_EQ(); - h.update_coef(ub, -1); - for (Constr_Vars_Iter ci(ub_list[simplest_ub]); ci; ci++) { - switch ((*ci).var->kind()) { - case Input_Var: { - int pos = (*ci).var->get_position(); - if (pos != dim + 1) - h.update_coef(stmt[*i].xform.output_var(pos), - (*ci).coef); - break; - } - case Global_Var: { - Global_Var_ID g = (*ci).var->get_global_var(); - Variable_ID v; - if (g->arity() == 0) - v = stmt[*i].xform.get_local(g); - else - v = stmt[*i].xform.get_local(g, - (*ci).var->function_of()); - h.update_coef(v, (*ci).coef); - break; - } - default: - throw loop_error("cannot handle tile bounds"); - } - } - h.update_const(ub_list[simplest_ub].get_const()); - } else { // e.g. if 2i <= m+5, then m+5-2 < 2*UB <= m+5 - GEQ_Handle h1 = f_root->add_GEQ(); - GEQ_Handle h2 = f_root->add_GEQ(); - for (Constr_Vars_Iter ci(ub_list[simplest_ub]); ci; ci++) { - switch ((*ci).var->kind()) { - case Input_Var: { - int pos = (*ci).var->get_position(); - if (pos == dim + 1) { - h1.update_coef(ub, -(*ci).coef); - h2.update_coef(ub, (*ci).coef); - } else { - h1.update_coef(stmt[*i].xform.output_var(pos), - -(*ci).coef); - h2.update_coef(stmt[*i].xform.output_var(pos), - (*ci).coef); - } - break; - } - case Global_Var: { - Global_Var_ID g = (*ci).var->get_global_var(); - Variable_ID v; - if (g->arity() == 0) - v = stmt[*i].xform.get_local(g); - else - v = stmt[*i].xform.get_local(g, - (*ci).var->function_of()); - h1.update_coef(v, -(*ci).coef); - h2.update_coef(v, (*ci).coef); - break; - } - default: - throw loop_error("cannot handle tile bounds"); - } - } - h1.update_const(-ub_list[simplest_ub].get_const()); - h2.update_const(ub_list[simplest_ub].get_const()); - h1.update_const(coef - 1); - } - } - - // insert tile controlling loop constraints - if (method == StridedTile) { // e.g. ii = LB + 32 * alpha && alpha >= 0 - Variable_ID e = f_exists->declare(); - GEQ_Handle h1 = f_root->add_GEQ(); - h1.update_coef(e, 1); - - EQ_Handle h2 = f_root->add_EQ(); - h2.update_coef(stmt[*i].xform.output_var(outer_dim + 1), 1); - h2.update_coef(e, -tile_size); - h2.update_coef(aligned_lb, -1); - } else if (method == CountedTile) { // e.g. 0 <= ii < ceiling((UB-LB+1)/32) - GEQ_Handle h1 = f_root->add_GEQ(); - h1.update_coef(stmt[*i].xform.output_var(outer_dim + 1), 1); - - GEQ_Handle h2 = f_root->add_GEQ(); - h2.update_coef(stmt[*i].xform.output_var(outer_dim + 1), - -tile_size); - h2.update_coef(aligned_lb, -1); - h2.update_coef(ub, 1); - } - - // special care for private statements like overflow assignment - if (private_stmt.find(*i) != private_stmt.end()) { // e.g. ii <= UB - GEQ_Handle h = f_root->add_GEQ(); - h.update_coef(stmt[*i].xform.output_var(outer_dim + 1), -1); - h.update_coef(ub, 1); - } - // if (private_stmt.find(*i) != private_stmt.end()) { - // if (stmt[*i].xform.n_out() > dim+3) { // e.g. ii <= UB && i = ii - // GEQ_Handle h = f_root->add_GEQ(); - // h.update_coef(stmt[*i].xform.output_var(outer_dim+1), -1); - // h.update_coef(ub, 1); - - // stmt[*i].xform = Project(stmt[*i].xform, dim+3, Output_Var); - // f_root = stmt[*i].xform.and_with_and(); - // EQ_Handle h1 = f_root->add_EQ(); - // h1.update_coef(stmt[*i].xform.output_var(dim+3), 1); - // h1.update_coef(stmt[*i].xform.output_var(outer_dim+1), -1); - // } - // else if (method == StridedTile) { // e.g. ii <= UB since i does not exist - // GEQ_Handle h = f_root->add_GEQ(); - // h.update_coef(stmt[*i].xform.output_var(outer_dim+1), -1); - // h.update_coef(ub, 1); - // } - // } - - // restrict original loop index inside the tile - else { - if (method == StridedTile) { // e.g. ii <= i < ii + tile_size - GEQ_Handle h1 = f_root->add_GEQ(); - h1.update_coef(stmt[*i].xform.output_var(dim + 3), 1); - h1.update_coef(stmt[*i].xform.output_var(outer_dim + 1), - -1); - - GEQ_Handle h2 = f_root->add_GEQ(); - h2.update_coef(stmt[*i].xform.output_var(dim + 3), -1); - h2.update_coef(stmt[*i].xform.output_var(outer_dim + 1), 1); - h2.update_const(tile_size - 1); - } else if (method == CountedTile) { // e.g. LB+32*ii <= i < LB+32*ii+tile_size - GEQ_Handle h1 = f_root->add_GEQ(); - h1.update_coef(stmt[*i].xform.output_var(outer_dim + 1), - -tile_size); - h1.update_coef(stmt[*i].xform.output_var(dim + 3), 1); - h1.update_coef(aligned_lb, -1); - - GEQ_Handle h2 = f_root->add_GEQ(); - h2.update_coef(stmt[*i].xform.output_var(outer_dim + 1), - tile_size); - h2.update_coef(stmt[*i].xform.output_var(dim + 3), -1); - h2.update_const(tile_size - 1); - h2.update_coef(aligned_lb, 1); - } - } - } - } - - // update loop level information - for (std::set::iterator i = same_tile_controlling_loop.begin(); - i != same_tile_controlling_loop.end(); i++) { - for (int j = 1; j <= stmt[*i].loop_level.size(); j++) - switch (stmt[*i].loop_level[j - 1].type) { - case LoopLevelOriginal: - break; - case LoopLevelTile: - if (stmt[*i].loop_level[j - 1].payload >= outer_level) - stmt[*i].loop_level[j - 1].payload++; - break; - default: - throw loop_error( - "unknown loop level type for statement " - + to_string(*i)); - } - - LoopLevel ll; - ll.type = LoopLevelTile; - ll.payload = level + 1; - ll.parallel_level = 0; - stmt[*i].loop_level.insert( - stmt[*i].loop_level.begin() + (outer_level - 1), ll); - } -} - diff --git a/loop_unroll.cc b/loop_unroll.cc deleted file mode 100644 index b75b738..0000000 --- a/loop_unroll.cc +++ /dev/null @@ -1,1166 +0,0 @@ -/* - * loop_unroll.cc - * - * Created on: Nov 12, 2012 - * Author: anand - */ - -#include -#include -#include "loop.hh" -#include "omegatools.hh" -#include "ir_code.hh" -#include "chill_error.hh" -#include - -using namespace omega; - - -std::set Loop::unroll(int stmt_num, int level, int unroll_amount, - std::vector > idxNames, - int cleanup_split_level) { - // check for sanity of parameters - // check for sanity of parameters - if (unroll_amount < 0) - throw std::invalid_argument( - "invalid unroll amount " + to_string(unroll_amount)); - if (stmt_num < 0 || stmt_num >= stmt.size()) - throw std::invalid_argument("invalid statement " + to_string(stmt_num)); - if (level <= 0 || level > stmt[stmt_num].loop_level.size()) - throw std::invalid_argument("invalid loop level " + to_string(level)); - - if (cleanup_split_level == 0) - cleanup_split_level = level; - if (cleanup_split_level > level) - throw std::invalid_argument( - "cleanup code must be split at or outside the unrolled loop level " - + to_string(level)); - if (cleanup_split_level <= 0) - throw std::invalid_argument( - "invalid split loop level " + to_string(cleanup_split_level)); - - // invalidate saved codegen computation - delete last_compute_cgr_; - last_compute_cgr_ = NULL; - delete last_compute_cg_; - last_compute_cg_ = NULL; - - int dim = 2 * level - 1; - std::vector lex = getLexicalOrder(stmt_num); - std::set same_loop = getStatements(lex, dim - 1); - - // nothing to do - if (unroll_amount == 1) - return std::set(); - - for (std::set::iterator i = same_loop.begin(); i != same_loop.end(); - i++) { - std::vector > D; - int n = stmt[*i].xform.n_out(); - for (DependenceGraph::EdgeList::iterator j = - dep.vertex[*i].second.begin(); j != dep.vertex[*i].second.end(); - j++) { - if (same_loop.find(j->first) != same_loop.end()) - for (int k = 0; k < j->second.size(); k++) { - DependenceVector dv = j->second[k]; - int dim2 = level - 1; - if (dv.type != DEP_CONTROL) { - - while (stmt[*i].loop_level[dim2].type == LoopLevelTile) { - dim2 = stmt[*i].loop_level[dim2].payload - 1; - } - dim2 = stmt[*i].loop_level[dim2].payload; - - /*if (dv.isCarried(dim2) - && (dv.hasNegative(dim2) && !dv.quasi)) - throw loop_error( - "loop error: Unrolling is illegal, dependence violation!"); - - if (dv.isCarried(dim2) - && (dv.hasPositive(dim2) && dv.quasi)) - throw loop_error( - "loop error: Unrolling is illegal, dependence violation!"); - */ - bool safe = false; - - if (dv.isCarried(dim2) && dv.hasPositive(dim2)) { - if (dv.quasi) - throw loop_error( - "loop error: a quasi dependence with a positive carried distance"); - if (!dv.quasi) { - if (dv.lbounds[dim2] != posInfinity) { - //if (dv.lbounds[dim2] != negInfinity) - if (dv.lbounds[dim2] > unroll_amount) - safe = true; - } else - safe = true; - }/* else { - if (dv.ubounds[dim2] != negInfinity) { - if (dv.ubounds[dim2] != posInfinity) - if ((-(dv.ubounds[dim2])) > unroll_amount) - safe = true; - } else - safe = true; - }*/ - - if (!safe) { - for (int l = level + 1; l <= (n - 1) / 2; l++) { - int dim3 = l - 1; - - if (stmt[*i].loop_level[dim3].type - != LoopLevelTile) - dim3 = - stmt[*i].loop_level[dim3].payload; - else { - while (stmt[*i].loop_level[dim3].type - == LoopLevelTile) { - dim3 = - stmt[*i].loop_level[dim3].payload - - 1; - } - dim3 = - stmt[*i].loop_level[dim3].payload; - } - - if (dim3 > dim2) { - - if (dv.hasPositive(dim3)) - break; - else if (dv.hasNegative(dim3)) - throw loop_error( - "loop error: Unrolling is illegal, dependence violation!"); - } - } - } - } - } - } - } - } - // extract the intersection of the iteration space to be considered - Relation hull = Relation::True(level); - apply_xform(same_loop); - for (std::set::iterator i = same_loop.begin(); i != same_loop.end(); - i++) { - if (stmt[*i].IS.is_upper_bound_satisfiable()) { - Relation mapping(stmt[*i].IS.n_set(), level); - F_And *f_root = mapping.add_and(); - for (int j = 1; j <= level; j++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.input_var(j), 1); - h.update_coef(mapping.output_var(j), -1); - } - hull = Intersection(hull, - Range(Restrict_Domain(mapping, copy(stmt[*i].IS)))); - hull.simplify(2, 4); - - } - } - for (int i = 1; i <= level; i++) { - std::string name = tmp_loop_var_name_prefix + to_string(i); - hull.name_set_var(i, name); - } - hull.setup_names(); - - // extract the exact loop bound of the dimension to be unrolled - if (is_single_loop_iteration(hull, level, this->known)) - return std::set(); - Relation bound = get_loop_bound(hull, level, this->known); - if (!bound.has_single_conjunct() || !bound.is_satisfiable() - || bound.is_tautology()) - throw loop_error("unable to extract loop bound for unrolling"); - - // extract the loop stride - coef_t stride; - std::pair result = find_simplest_stride(bound, - bound.set_var(level)); - if (result.second == NULL) - stride = 1; - else - stride = abs(result.first.get_coef(result.second)) - / gcd(abs(result.first.get_coef(result.second)), - abs(result.first.get_coef(bound.set_var(level)))); - - // separate lower and upper bounds - std::vector lb_list, ub_list; - { - Conjunct *c = bound.query_DNF()->single_conjunct(); - for (GEQ_Iterator gi(c->GEQs()); gi; gi++) { - int coef = (*gi).get_coef(bound.set_var(level)); - if (coef < 0) - ub_list.push_back(*gi); - else if (coef > 0) - lb_list.push_back(*gi); - } - } - - // simplify overflow expression for each pair of upper and lower bounds - std::vector > > overflow_table( - lb_list.size(), - std::vector >(ub_list.size(), - std::map())); - bool is_overflow_simplifiable = true; - for (int i = 0; i < lb_list.size(); i++) { - if (!is_overflow_simplifiable) - break; - - for (int j = 0; j < ub_list.size(); j++) { - // lower bound or upper bound has non-unit coefficient, can't simplify - if (ub_list[j].get_coef(bound.set_var(level)) != -1 - || lb_list[i].get_coef(bound.set_var(level)) != 1) { - is_overflow_simplifiable = false; - break; - } - - for (Constr_Vars_Iter ci(ub_list[j]); ci; ci++) { - switch ((*ci).var->kind()) { - case Input_Var: { - if ((*ci).var != bound.set_var(level)) - overflow_table[i][j][(*ci).var] += (*ci).coef; - - break; - } - case Global_Var: { - Global_Var_ID g = (*ci).var->get_global_var(); - Variable_ID v; - if (g->arity() == 0) - v = bound.get_local(g); - else - v = bound.get_local(g, (*ci).var->function_of()); - overflow_table[i][j][(*ci).var] += (*ci).coef; - break; - } - default: - throw loop_error("failed to calculate overflow amount"); - } - } - overflow_table[i][j][NULL] += ub_list[j].get_const(); - - for (Constr_Vars_Iter ci(lb_list[i]); ci; ci++) { - switch ((*ci).var->kind()) { - case Input_Var: { - if ((*ci).var != bound.set_var(level)) { - overflow_table[i][j][(*ci).var] += (*ci).coef; - if (overflow_table[i][j][(*ci).var] == 0) - overflow_table[i][j].erase( - overflow_table[i][j].find((*ci).var)); - } - break; - } - case Global_Var: { - Global_Var_ID g = (*ci).var->get_global_var(); - Variable_ID v; - if (g->arity() == 0) - v = bound.get_local(g); - else - v = bound.get_local(g, (*ci).var->function_of()); - overflow_table[i][j][(*ci).var] += (*ci).coef; - if (overflow_table[i][j][(*ci).var] == 0) - overflow_table[i][j].erase( - overflow_table[i][j].find((*ci).var)); - break; - } - default: - throw loop_error("failed to calculate overflow amount"); - } - } - overflow_table[i][j][NULL] += lb_list[i].get_const(); - - overflow_table[i][j][NULL] += stride; - if (unroll_amount == 0 - || (overflow_table[i][j].size() == 1 - && overflow_table[i][j][NULL] / stride - < unroll_amount)) - unroll_amount = overflow_table[i][j][NULL] / stride; - } - } - - // loop iteration count can't be determined, bail out gracefully - if (unroll_amount == 0) - return std::set(); - - // further simply overflow calculation using coefficients' modular - if (is_overflow_simplifiable) { - for (int i = 0; i < lb_list.size(); i++) - for (int j = 0; j < ub_list.size(); j++) - if (stride == 1) { - for (std::map::iterator k = - overflow_table[i][j].begin(); - k != overflow_table[i][j].end();) - if ((*k).first != NULL) { - int t = int_mod_hat((*k).second, unroll_amount); - if (t == 0) { - overflow_table[i][j].erase(k++); - } else { - int t2 = hull.query_variable_mod((*k).first, - unroll_amount); - if (t2 != INT_MAX) { - overflow_table[i][j][NULL] += t * t2; - overflow_table[i][j].erase(k++); - } else { - (*k).second = t; - k++; - } - } - } else - k++; - - overflow_table[i][j][NULL] = int_mod_hat( - overflow_table[i][j][NULL], unroll_amount); - - // Since we don't have MODULO instruction in SUIF yet (only MOD), make all coef positive in the final formula - for (std::map::iterator k = - overflow_table[i][j].begin(); - k != overflow_table[i][j].end(); k++) - if ((*k).second < 0) - (*k).second += unroll_amount; - } - } - - // build overflow statement - CG_outputBuilder *ocg = ir->builder(); - CG_outputRepr *overflow_code = NULL; - Relation cond_upper(level), cond_lower(level); - Relation overflow_constraint(0); - F_And *overflow_constraint_root = overflow_constraint.add_and(); - std::vector over_var_list; - if (is_overflow_simplifiable && lb_list.size() == 1) { - for (int i = 0; i < ub_list.size(); i++) { - if (overflow_table[0][i].size() == 1) { - // upper splitting condition - GEQ_Handle h = cond_upper.and_with_GEQ(ub_list[i]); - h.update_const( - ((overflow_table[0][i][NULL] / stride) % unroll_amount) - * -stride); - } else { - // upper splitting condition - std::string over_name = overflow_var_name_prefix - + to_string(overflow_var_name_counter++); - Free_Var_Decl *over_free_var = new Free_Var_Decl(over_name); - over_var_list.push_back(over_free_var); - GEQ_Handle h = cond_upper.and_with_GEQ(ub_list[i]); - h.update_coef(cond_upper.get_local(over_free_var), -stride); - - // insert constraint 0 <= overflow < unroll_amount - Variable_ID v = overflow_constraint.get_local(over_free_var); - GEQ_Handle h1 = overflow_constraint_root->add_GEQ(); - h1.update_coef(v, 1); - GEQ_Handle h2 = overflow_constraint_root->add_GEQ(); - h2.update_coef(v, -1); - h2.update_const(unroll_amount - 1); - - // create overflow assignment - bound.setup_names(); // hack to fix omega relation variable names issue - CG_outputRepr *rhs = NULL; - bool is_split_illegal = false; - for (std::map::iterator j = - overflow_table[0][i].begin(); - j != overflow_table[0][i].end(); j++) - if ((*j).first != NULL) { - if ((*j).first->kind() == Input_Var - && (*j).first->get_position() - >= cleanup_split_level) - is_split_illegal = true; - - CG_outputRepr *t = ocg->CreateIdent((*j).first->name()); - if ((*j).second != 1) - t = ocg->CreateTimes(ocg->CreateInt((*j).second), - t); - rhs = ocg->CreatePlus(rhs, t); - } else if ((*j).second != 0) - rhs = ocg->CreatePlus(rhs, ocg->CreateInt((*j).second)); - - if (is_split_illegal) { - rhs->clear(); - delete rhs; - throw loop_error( - "cannot split cleanup code at loop level " - + to_string(cleanup_split_level) - + " due to overflow variable data dependence"); - } - - if (stride != 1) - rhs = ocg->CreateIntegerCeil(rhs, ocg->CreateInt(stride)); - rhs = ocg->CreateIntegerMod(rhs, ocg->CreateInt(unroll_amount)); - - CG_outputRepr *lhs = ocg->CreateIdent(over_name); - init_code = ocg->StmtListAppend(init_code, - ocg->CreateAssignment(0, lhs, ocg->CreateInt(0))); - lhs = ocg->CreateIdent(over_name); - overflow_code = ocg->StmtListAppend(overflow_code, - ocg->CreateAssignment(0, lhs, rhs)); - } - } - - // lower splitting condition - GEQ_Handle h = cond_lower.and_with_GEQ(lb_list[0]); - } else if (is_overflow_simplifiable && ub_list.size() == 1) { - for (int i = 0; i < lb_list.size(); i++) { - - if (overflow_table[i][0].size() == 1) { - // lower splitting condition - GEQ_Handle h = cond_lower.and_with_GEQ(lb_list[i]); - h.update_const(overflow_table[i][0][NULL] * -stride); - } else { - // lower splitting condition - std::string over_name = overflow_var_name_prefix - + to_string(overflow_var_name_counter++); - Free_Var_Decl *over_free_var = new Free_Var_Decl(over_name); - over_var_list.push_back(over_free_var); - GEQ_Handle h = cond_lower.and_with_GEQ(lb_list[i]); - h.update_coef(cond_lower.get_local(over_free_var), -stride); - - // insert constraint 0 <= overflow < unroll_amount - Variable_ID v = overflow_constraint.get_local(over_free_var); - GEQ_Handle h1 = overflow_constraint_root->add_GEQ(); - h1.update_coef(v, 1); - GEQ_Handle h2 = overflow_constraint_root->add_GEQ(); - h2.update_coef(v, -1); - h2.update_const(unroll_amount - 1); - - // create overflow assignment - bound.setup_names(); // hack to fix omega relation variable names issue - CG_outputRepr *rhs = NULL; - for (std::map::iterator j = - overflow_table[0][i].begin(); - j != overflow_table[0][i].end(); j++) - if ((*j).first != NULL) { - CG_outputRepr *t = ocg->CreateIdent((*j).first->name()); - if ((*j).second != 1) - t = ocg->CreateTimes(ocg->CreateInt((*j).second), - t); - rhs = ocg->CreatePlus(rhs, t); - } else if ((*j).second != 0) - rhs = ocg->CreatePlus(rhs, ocg->CreateInt((*j).second)); - - if (stride != 1) - rhs = ocg->CreateIntegerCeil(rhs, ocg->CreateInt(stride)); - rhs = ocg->CreateIntegerMod(rhs, ocg->CreateInt(unroll_amount)); - - CG_outputRepr *lhs = ocg->CreateIdent(over_name); - init_code = ocg->StmtListAppend(init_code, - ocg->CreateAssignment(0, lhs, ocg->CreateInt(0))); - lhs = ocg->CreateIdent(over_name); - overflow_code = ocg->StmtListAppend(overflow_code, - ocg->CreateAssignment(0, lhs, rhs)); - } - } - - // upper splitting condition - GEQ_Handle h = cond_upper.and_with_GEQ(ub_list[0]); - } else { - std::string over_name = overflow_var_name_prefix - + to_string(overflow_var_name_counter++); - Free_Var_Decl *over_free_var = new Free_Var_Decl(over_name); - over_var_list.push_back(over_free_var); - - std::vector lb_repr_list, ub_repr_list; - for (int i = 0; i < lb_list.size(); i++) { - lb_repr_list.push_back( - output_lower_bound_repr(ocg, lb_list[i], - bound.set_var(dim + 1), result.first, result.second, - bound, Relation::True(bound.n_set()), - std::vector >( - bound.n_set(), - std::make_pair( - static_cast(NULL), - 0)))); - GEQ_Handle h = cond_lower.and_with_GEQ(lb_list[i]); - } - for (int i = 0; i < ub_list.size(); i++) { - ub_repr_list.push_back( - output_upper_bound_repr(ocg, ub_list[i], - bound.set_var(dim + 1), bound, - std::vector >( - bound.n_set(), - std::make_pair( - static_cast(NULL), - 0)))); - GEQ_Handle h = cond_upper.and_with_GEQ(ub_list[i]); - h.update_coef(cond_upper.get_local(over_free_var), -stride); - } - - CG_outputRepr *lbRepr, *ubRepr; - if (lb_repr_list.size() > 1) - lbRepr = ocg->CreateInvoke("max", lb_repr_list); - else if (lb_repr_list.size() == 1) - lbRepr = lb_repr_list[0]; - - if (ub_repr_list.size() > 1) - ubRepr = ocg->CreateInvoke("min", ub_repr_list); - else if (ub_repr_list.size() == 1) - ubRepr = ub_repr_list[0]; - - // create overflow assignment - CG_outputRepr *rhs = ocg->CreatePlus(ocg->CreateMinus(ubRepr, lbRepr), - ocg->CreateInt(1)); - if (stride != 1) - rhs = ocg->CreateIntegerFloor(rhs, ocg->CreateInt(stride)); - rhs = ocg->CreateIntegerMod(rhs, ocg->CreateInt(unroll_amount)); - CG_outputRepr *lhs = ocg->CreateIdent(over_name); - init_code = ocg->StmtListAppend(init_code, - ocg->CreateAssignment(0, lhs, ocg->CreateInt(0))); - lhs = ocg->CreateIdent(over_name); - overflow_code = ocg->CreateAssignment(0, lhs, rhs); - - // insert constraint 0 <= overflow < unroll_amount - Variable_ID v = overflow_constraint.get_local(over_free_var); - GEQ_Handle h1 = overflow_constraint_root->add_GEQ(); - h1.update_coef(v, 1); - GEQ_Handle h2 = overflow_constraint_root->add_GEQ(); - h2.update_coef(v, -1); - h2.update_const(unroll_amount - 1); - } - - // insert overflow statement - int overflow_stmt_num = -1; - if (overflow_code != NULL) { - // build iteration space for overflow statement - Relation mapping(level, cleanup_split_level - 1); - F_And *f_root = mapping.add_and(); - for (int i = 1; i < cleanup_split_level; i++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.output_var(i), 1); - h.update_coef(mapping.input_var(i), -1); - } - Relation overflow_IS = Range(Restrict_Domain(mapping, copy(hull))); - for (int i = 1; i < cleanup_split_level; i++) - overflow_IS.name_set_var(i, hull.set_var(i)->name()); - overflow_IS.setup_names(); - - // build dumb transformation relation for overflow statement - Relation overflow_xform(cleanup_split_level - 1, - 2 * (cleanup_split_level - 1) + 1); - f_root = overflow_xform.add_and(); - for (int i = 1; i <= cleanup_split_level - 1; i++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(overflow_xform.output_var(2 * i), 1); - h.update_coef(overflow_xform.input_var(i), -1); - - h = f_root->add_EQ(); - h.update_coef(overflow_xform.output_var(2 * i - 1), 1); - h.update_const(-lex[2 * i - 2]); - } - EQ_Handle h = f_root->add_EQ(); - h.update_coef( - overflow_xform.output_var(2 * (cleanup_split_level - 1) + 1), - 1); - h.update_const(-lex[2 * (cleanup_split_level - 1)]); - - shiftLexicalOrder(lex, 2 * cleanup_split_level - 2, 1); - Statement overflow_stmt; - - overflow_stmt.code = overflow_code; - overflow_stmt.IS = overflow_IS; - overflow_stmt.xform = overflow_xform; - overflow_stmt.loop_level = std::vector(level - 1); - overflow_stmt.ir_stmt_node = NULL; - for (int i = 0; i < level - 1; i++) { - overflow_stmt.loop_level[i].type = - stmt[stmt_num].loop_level[i].type; - if (stmt[stmt_num].loop_level[i].type == LoopLevelTile - && stmt[stmt_num].loop_level[i].payload >= level) - overflow_stmt.loop_level[i].payload = -1; - else - overflow_stmt.loop_level[i].payload = - stmt[stmt_num].loop_level[i].payload; - overflow_stmt.loop_level[i].parallel_level = - stmt[stmt_num].loop_level[i].parallel_level; - } - - stmt.push_back(overflow_stmt); - dep.insert(); - overflow_stmt_num = stmt.size() - 1; - overflow[overflow_stmt_num] = over_var_list; - - // update the global known information on overflow variable - this->known = Intersection(this->known, - Extend_Set(copy(overflow_constraint), - this->known.n_set() - overflow_constraint.n_set())); - - // update dependence graph - DependenceVector dv; - dv.type = DEP_CONTROL; - for (std::set::iterator i = same_loop.begin(); - i != same_loop.end(); i++) - dep.connect(overflow_stmt_num, *i, dv); - dv.type = DEP_W2W; - { - IR_ScalarSymbol *overflow_sym = NULL; - std::vector scalars = ir->FindScalarRef( - overflow_code); - for (int i = scalars.size() - 1; i >= 0; i--) - if (scalars[i]->is_write()) { - overflow_sym = scalars[i]->symbol(); - break; - } - for (int i = scalars.size() - 1; i >= 0; i--) - delete scalars[i]; - dv.sym = overflow_sym; - } - dv.lbounds = std::vector(dep.num_dim(), 0); - dv.ubounds = std::vector(dep.num_dim(), 0); - int dep_dim = get_last_dep_dim_before(stmt_num, level); - for (int i = dep_dim + 1; i < dep.num_dim(); i++) { - dv.lbounds[i] = -posInfinity; - dv.ubounds[i] = posInfinity; - } - for (int i = 0; i <= dep_dim; i++) { - if (i != 0) { - dv.lbounds[i - 1] = 0; - dv.ubounds[i - 1] = 0; - } - dv.lbounds[i] = 1; - dv.ubounds[i] = posInfinity; - dep.connect(overflow_stmt_num, overflow_stmt_num, dv); - } - } - - // split the loop so it can be fully unrolled - std::set new_stmts = split(stmt_num, cleanup_split_level, cond_upper); - std::set new_stmts2 = split(stmt_num, cleanup_split_level, cond_lower); - new_stmts.insert(new_stmts2.begin(), new_stmts2.end()); - - // check if unrolled statements can be trivially lumped together as one statement - bool can_be_lumped = true; - if (can_be_lumped) { - for (std::set::iterator i = same_loop.begin(); - i != same_loop.end(); i++) - if (*i != stmt_num) { - if (stmt[*i].loop_level.size() - != stmt[stmt_num].loop_level.size()) { - can_be_lumped = false; - break; - } - for (int j = 0; j < stmt[stmt_num].loop_level.size(); j++) - if (!(stmt[*i].loop_level[j].type - == stmt[stmt_num].loop_level[j].type - && stmt[*i].loop_level[j].payload - == stmt[stmt_num].loop_level[j].payload)) { - can_be_lumped = false; - break; - } - if (!can_be_lumped) - break; - std::vector lex2 = getLexicalOrder(*i); - for (int j = 2 * level; j < lex.size() - 1; j += 2) - if (lex[j] != lex2[j]) { - can_be_lumped = false; - break; - } - if (!can_be_lumped) - break; - } - } - if (can_be_lumped) { - for (std::set::iterator i = same_loop.begin(); - i != same_loop.end(); i++) - if (is_inner_loop_depend_on_level(stmt[*i].IS, level, - this->known)) { - can_be_lumped = false; - break; - } - } - if (can_be_lumped) { - for (std::set::iterator i = same_loop.begin(); - i != same_loop.end(); i++) - if (*i != stmt_num) { - if (!(Must_Be_Subset(copy(stmt[*i].IS), copy(stmt[stmt_num].IS)) - && Must_Be_Subset(copy(stmt[stmt_num].IS), - copy(stmt[*i].IS)))) { - can_be_lumped = false; - break; - } - } - } - if (can_be_lumped) { - for (std::set::iterator i = same_loop.begin(); - i != same_loop.end(); i++) { - for (DependenceGraph::EdgeList::iterator j = - dep.vertex[*i].second.begin(); - j != dep.vertex[*i].second.end(); j++) - if (same_loop.find(j->first) != same_loop.end()) { - for (int k = 0; k < j->second.size(); k++) - if (j->second[k].type == DEP_CONTROL - || j->second[k].type == DEP_UNKNOWN) { - can_be_lumped = false; - break; - } - if (!can_be_lumped) - break; - } - if (!can_be_lumped) - break; - } - } - - // insert unrolled statements - int old_num_stmt = stmt.size(); - if (!can_be_lumped) { - std::map > what_stmt_num; - - for (int j = 1; j < unroll_amount; j++) { - for (std::set::iterator i = same_loop.begin(); - i != same_loop.end(); i++) { - Statement new_stmt; - - std::vector loop_vars; - std::vector subs; - loop_vars.push_back(stmt[*i].IS.set_var(level)->name()); - subs.push_back( - ocg->CreatePlus( - ocg->CreateIdent( - stmt[*i].IS.set_var(level)->name()), - ocg->CreateInt(j * stride))); - new_stmt.code = ocg->CreateSubstitutedStmt(0, - stmt[*i].code->clone(), loop_vars, subs); - - new_stmt.IS = adjust_loop_bound(stmt[*i].IS, level, j * stride); - add_loop_stride(new_stmt.IS, bound, level - 1, - unroll_amount * stride); - - new_stmt.xform = copy(stmt[*i].xform); - - new_stmt.loop_level = stmt[*i].loop_level; - new_stmt.ir_stmt_node = NULL; - stmt.push_back(new_stmt); - dep.insert(); - what_stmt_num[*i].push_back(stmt.size() - 1); - } - } - for (std::set::iterator i = same_loop.begin(); - i != same_loop.end(); i++) - add_loop_stride(stmt[*i].IS, bound, level - 1, - unroll_amount * stride); - - // update dependence graph - if (stmt[stmt_num].loop_level[level - 1].type == LoopLevelOriginal) { - int dep_dim = stmt[stmt_num].loop_level[level - 1].payload; - int new_stride = unroll_amount * stride; - for (int i = 0; i < old_num_stmt; i++) { - std::vector > D; - - for (DependenceGraph::EdgeList::iterator j = - dep.vertex[i].second.begin(); - j != dep.vertex[i].second.end();) { - if (same_loop.find(i) != same_loop.end()) { - if (same_loop.find(j->first) != same_loop.end()) { - for (int k = 0; k < j->second.size(); k++) { - DependenceVector dv = j->second[k]; - if (dv.type == DEP_CONTROL - || dv.type == DEP_UNKNOWN) { - D.push_back(std::make_pair(j->first, dv)); - for (int kk = 0; kk < unroll_amount - 1; - kk++) - if (what_stmt_num[i][kk] != -1 - && what_stmt_num[j->first][kk] - != -1) - dep.connect(what_stmt_num[i][kk], - what_stmt_num[j->first][kk], - dv); - } else { - coef_t lb = dv.lbounds[dep_dim]; - coef_t ub = dv.ubounds[dep_dim]; - if (ub == lb - && int_mod(lb, - static_cast(new_stride)) - == 0) { - D.push_back( - std::make_pair(j->first, dv)); - for (int kk = 0; kk < unroll_amount - 1; - kk++) - if (what_stmt_num[i][kk] != -1 - && what_stmt_num[j->first][kk] - != -1) - dep.connect( - what_stmt_num[i][kk], - what_stmt_num[j->first][kk], - dv); - } else if (lb == -posInfinity - && ub == posInfinity) { - D.push_back( - std::make_pair(j->first, dv)); - for (int kk = 0; kk < unroll_amount; - kk++) - if (kk == 0) - D.push_back( - std::make_pair(j->first, - dv)); - else if (what_stmt_num[j->first][kk - - 1] != -1) - D.push_back( - std::make_pair( - what_stmt_num[j->first][kk - - 1], - dv)); - for (int t = 0; t < unroll_amount - 1; - t++) - if (what_stmt_num[i][t] != -1) - for (int kk = 0; - kk < unroll_amount; - kk++) - if (kk == 0) - dep.connect( - what_stmt_num[i][t], - j->first, dv); - else if (what_stmt_num[j->first][kk - - 1] != -1) - dep.connect( - what_stmt_num[i][t], - what_stmt_num[j->first][kk - - 1], - dv); - } else { - for (int kk = 0; kk < unroll_amount; - kk++) { - if (lb != -posInfinity) { - if (kk * stride - < int_mod(lb, - static_cast(new_stride))) - dv.lbounds[dep_dim] = - floor( - static_cast(lb) - / new_stride) - * new_stride - + new_stride; - else - dv.lbounds[dep_dim] = - floor( - static_cast(lb) - / new_stride) - * new_stride; - } - if (ub != posInfinity) { - if (kk * stride - > int_mod(ub, - static_cast(new_stride))) - dv.ubounds[dep_dim] = - floor( - static_cast(ub) - / new_stride) - * new_stride - - new_stride; - else - dv.ubounds[dep_dim] = - floor( - static_cast(ub) - / new_stride) - * new_stride; - } - if (dv.ubounds[dep_dim] - >= dv.lbounds[dep_dim]) { - if (kk == 0) - D.push_back( - std::make_pair( - j->first, - dv)); - else if (what_stmt_num[j->first][kk - - 1] != -1) - D.push_back( - std::make_pair( - what_stmt_num[j->first][kk - - 1], - dv)); - } - } - for (int t = 0; t < unroll_amount - 1; - t++) - if (what_stmt_num[i][t] != -1) - for (int kk = 0; - kk < unroll_amount; - kk++) { - if (lb != -posInfinity) { - if (kk * stride - < int_mod( - lb + t - + 1, - static_cast(new_stride))) - dv.lbounds[dep_dim] = - floor( - static_cast(lb - + (t - + 1) - * stride) - / new_stride) - * new_stride - + new_stride; - else - dv.lbounds[dep_dim] = - floor( - static_cast(lb - + (t - + 1) - * stride) - / new_stride) - * new_stride; - } - if (ub != posInfinity) { - if (kk * stride - > int_mod( - ub + t - + 1, - static_cast(new_stride))) - dv.ubounds[dep_dim] = - floor( - static_cast(ub - + (t - + 1) - * stride) - / new_stride) - * new_stride - - new_stride; - else - dv.ubounds[dep_dim] = - floor( - static_cast(ub - + (t - + 1) - * stride) - / new_stride) - * new_stride; - } - if (dv.ubounds[dep_dim] - >= dv.lbounds[dep_dim]) { - if (kk == 0) - dep.connect( - what_stmt_num[i][t], - j->first, - dv); - else if (what_stmt_num[j->first][kk - - 1] != -1) - dep.connect( - what_stmt_num[i][t], - what_stmt_num[j->first][kk - - 1], - dv); - } - } - } - } - } - - dep.vertex[i].second.erase(j++); - } else { - for (int kk = 0; kk < unroll_amount - 1; kk++) - if (what_stmt_num[i][kk] != -1) - dep.connect(what_stmt_num[i][kk], j->first, - j->second); - - j++; - } - } else { - if (same_loop.find(j->first) != same_loop.end()) - for (int k = 0; k < j->second.size(); k++) - for (int kk = 0; kk < unroll_amount - 1; kk++) - if (what_stmt_num[j->first][kk] != -1) - D.push_back( - std::make_pair( - what_stmt_num[j->first][kk], - j->second[k])); - j++; - } - } - - for (int j = 0; j < D.size(); j++) - dep.connect(i, D[j].first, D[j].second); - } - } - - // reset lexical order for the unrolled loop body - std::set new_same_loop; - - int count = 0; - - for (std::map >::iterator i = - what_stmt_num.begin(); i != what_stmt_num.end(); i++) { - - new_same_loop.insert(i->first); - for (int k = dim + 1; k < stmt[i->first].xform.n_out(); k += 2) - assign_const(stmt[i->first].xform, k, - get_const(stmt[(what_stmt_num.begin())->first].xform, k, - Output_Var) + count); - count++; - for (int j = 0; j < i->second.size(); j++) { - new_same_loop.insert(i->second[j]); - for (int k = dim + 1; k < stmt[i->second[j]].xform.n_out(); k += - 2) - assign_const(stmt[i->second[j]].xform, k, - get_const( - stmt[(what_stmt_num.begin())->first].xform, - k, Output_Var) + count); - count++; - } - } - setLexicalOrder(dim + 1, new_same_loop, 0, idxNames); - } else { - for (std::set::iterator i = same_loop.begin(); - i != same_loop.end(); i++) - add_loop_stride(stmt[*i].IS, bound, level - 1, - unroll_amount * stride); - - int max_level = stmt[stmt_num].loop_level.size(); - std::vector > stmt_order; - for (std::set::iterator i = same_loop.begin(); - i != same_loop.end(); i++) - stmt_order.push_back( - std::make_pair( - get_const(stmt[*i].xform, 2 * max_level, - Output_Var), *i)); - sort(stmt_order.begin(), stmt_order.end()); - - Statement new_stmt; - new_stmt.code = NULL; - for (int j = 1; j < unroll_amount; j++) - for (int i = 0; i < stmt_order.size(); i++) { - std::vector loop_vars; - std::vector subs; - loop_vars.push_back( - stmt[stmt_order[i].second].IS.set_var(level)->name()); - subs.push_back( - ocg->CreatePlus( - ocg->CreateIdent( - stmt[stmt_order[i].second].IS.set_var( - level)->name()), - ocg->CreateInt(j * stride))); - CG_outputRepr *code = ocg->CreateSubstitutedStmt(0, - stmt[stmt_order[i].second].code->clone(), loop_vars, - subs); - new_stmt.code = ocg->StmtListAppend(new_stmt.code, code); - } - - new_stmt.IS = copy(stmt[stmt_num].IS); - new_stmt.xform = copy(stmt[stmt_num].xform); - assign_const(new_stmt.xform, 2 * max_level, - stmt_order[stmt_order.size() - 1].first + 1); - new_stmt.loop_level = stmt[stmt_num].loop_level; - new_stmt.ir_stmt_node = NULL; - stmt.push_back(new_stmt); - dep.insert(); - - // update dependence graph - if (stmt[stmt_num].loop_level[level - 1].type == LoopLevelOriginal) { - int dep_dim = stmt[stmt_num].loop_level[level - 1].payload; - int new_stride = unroll_amount * stride; - for (int i = 0; i < old_num_stmt; i++) { - std::vector > > D; - - for (DependenceGraph::EdgeList::iterator j = - dep.vertex[i].second.begin(); - j != dep.vertex[i].second.end();) { - if (same_loop.find(i) != same_loop.end()) { - if (same_loop.find(j->first) != same_loop.end()) { - std::vector dvs11, dvs12, dvs22, - dvs21; - for (int k = 0; k < j->second.size(); k++) { - DependenceVector dv = j->second[k]; - if (dv.type == DEP_CONTROL - || dv.type == DEP_UNKNOWN) { - if (i == j->first) { - dvs11.push_back(dv); - dvs22.push_back(dv); - } else - throw loop_error( - "unrolled statements lumped together illegally"); - } else { - coef_t lb = dv.lbounds[dep_dim]; - coef_t ub = dv.ubounds[dep_dim]; - if (ub == lb - && int_mod(lb, - static_cast(new_stride)) - == 0) { - dvs11.push_back(dv); - dvs22.push_back(dv); - } else { - if (lb != -posInfinity) - dv.lbounds[dep_dim] = ceil( - static_cast(lb) - / new_stride) - * new_stride; - if (ub != posInfinity) - dv.ubounds[dep_dim] = floor( - static_cast(ub) - / new_stride) - * new_stride; - if (dv.ubounds[dep_dim] - >= dv.lbounds[dep_dim]) - dvs11.push_back(dv); - - if (lb != -posInfinity) - dv.lbounds[dep_dim] = ceil( - static_cast(lb) - / new_stride) - * new_stride; - if (ub != posInfinity) - dv.ubounds[dep_dim] = ceil( - static_cast(ub) - / new_stride) - * new_stride; - if (dv.ubounds[dep_dim] - >= dv.lbounds[dep_dim]) - dvs21.push_back(dv); - - if (lb != -posInfinity) - dv.lbounds[dep_dim] = floor( - static_cast(lb) - / new_stride) - * new_stride; - if (ub != posInfinity) - dv.ubounds[dep_dim] = floor( - static_cast(ub - - stride) - / new_stride) - * new_stride; - if (dv.ubounds[dep_dim] - >= dv.lbounds[dep_dim]) - dvs12.push_back(dv); - - if (lb != -posInfinity) - dv.lbounds[dep_dim] = floor( - static_cast(lb) - / new_stride) - * new_stride; - if (ub != posInfinity) - dv.ubounds[dep_dim] = ceil( - static_cast(ub - - stride) - / new_stride) - * new_stride; - if (dv.ubounds[dep_dim] - >= dv.lbounds[dep_dim]) - dvs22.push_back(dv); - } - } - } - if (dvs11.size() > 0) - D.push_back(std::make_pair(i, dvs11)); - if (dvs22.size() > 0) - dep.connect(old_num_stmt, old_num_stmt, dvs22); - if (dvs12.size() > 0) - D.push_back( - std::make_pair(old_num_stmt, dvs12)); - if (dvs21.size() > 0) - dep.connect(old_num_stmt, i, dvs21); - - dep.vertex[i].second.erase(j++); - } else { - dep.connect(old_num_stmt, j->first, j->second); - j++; - } - } else { - if (same_loop.find(j->first) != same_loop.end()) - D.push_back( - std::make_pair(old_num_stmt, j->second)); - j++; - } - } - - for (int j = 0; j < D.size(); j++) - dep.connect(i, D[j].first, D[j].second); - } - } - } - - return new_stmts; -} - - diff --git a/missing b/missing deleted file mode 100755 index 894e786..0000000 --- a/missing +++ /dev/null @@ -1,360 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. - -scriptversion=2005-06-08.21 - -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# Originally by Fran,cois Pinard , 1996. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -run=: - -# In the cases where this matters, `missing' is being run in the -# srcdir already. -if test -f configure.ac; then - configure_ac=configure.ac -else - configure_ac=configure.in -fi - -msg="missing on your system" - -case "$1" in ---run) - # Try to run requested program, and just exit if it succeeds. - run= - shift - "$@" && exit 0 - # Exit code 63 means version mismatch. This often happens - # when the user try to use an ancient version of a tool on - # a file that requires a minimum version. In this case we - # we should proceed has if the program had been absent, or - # if --run hadn't been passed. - if test $? = 63; then - run=: - msg="probably too old" - fi - ;; - - -h|--h|--he|--hel|--help) - echo "\ -$0 [OPTION]... PROGRAM [ARGUMENT]... - -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an -error status if there is no known handling for PROGRAM. - -Options: - -h, --help display this help and exit - -v, --version output version information and exit - --run try to run the given command, and emulate it if it fails - -Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' - automake touch all \`Makefile.in' files - bison create \`y.tab.[ch]', if possible, from existing .[ch] - flex create \`lex.yy.c', if possible, from existing .c - help2man touch the output file - lex create \`lex.yy.c', if possible, from existing .c - makeinfo touch the output file - tar try tar, gnutar, gtar, then tar without non-portable flags - yacc create \`y.tab.[ch]', if possible, from existing .[ch] - -Send bug reports to ." - exit $? - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing $scriptversion (GNU Automake)" - exit $? - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - -esac - -# Now exit if we have it, but it failed. Also exit now if we -# don't have it and --version was passed (most likely to detect -# the program). -case "$1" in - lex|yacc) - # Not GNU programs, they don't have --version. - ;; - - tar) - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - exit 1 - fi - ;; - - *) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - # Could not run --version or --help. This is probably someone - # running `$TOOL --version' or `$TOOL --help' to check whether - # $TOOL exists and not knowing $TOOL uses missing. - exit 1 - fi - ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case "$1" in - aclocal*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acinclude.m4' or \`${configure_ac}'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from - any GNU archive site." - touch aclocal.m4 - ;; - - autoconf) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`${configure_ac}'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU - archive site." - touch configure - ;; - - autoheader) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acconfig.h' or \`${configure_ac}'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them - from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` - test -z "$files" && files="config.h" - touch_files= - for f in $files; do - case "$f" in - *:*) touch_files="$touch_files "`echo "$f" | - sed -e 's/^[^:]*://' -e 's/:.*//'`;; - *) touch_files="$touch_files $f.in";; - esac - done - touch $touch_files - ;; - - automake*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. - You might want to install the \`Automake' and \`Perl' packages. - Grab them from any GNU archive site." - find . -type f -name Makefile.am -print | - sed 's/\.am$/.in/' | - while read f; do touch "$f"; done - ;; - - autom4te) - echo 1>&2 "\ -WARNING: \`$1' is needed, but is $msg. - You might have modified some files without having the - proper tools for further handling them. - You can get \`$1' as part of \`Autoconf' from any GNU - archive site." - - file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` - test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo "#! /bin/sh" - echo "# Created by GNU Automake missing as a replacement of" - echo "# $ $@" - echo "exit 0" - chmod +x $file - exit 1 - fi - ;; - - bison|yacc) - echo 1>&2 "\ -WARNING: \`$1' $msg. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package - in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." - rm -f y.tab.c y.tab.h - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if [ ! -f y.tab.h ]; then - echo >y.tab.h - fi - if [ ! -f y.tab.c ]; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex|flex) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.l' file. You may need the \`Flex' package - in order for those modifications to take effect. You can get - \`Flex' from any GNU archive site." - rm -f lex.yy.c - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if [ ! -f lex.yy.c ]; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - help2man) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a dependency of a manual page. You may need the - \`Help2man' package in order for those modifications to take - effect. You can get \`Help2man' from any GNU archive site." - - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` - fi - if [ -f "$file" ]; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit 1 - fi - ;; - - makeinfo) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file - indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." - # The file to touch is that specified with -o ... - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - # ... or it is the one specified with @setfilename ... - infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` - # ... or it is derived from the source name (dir/f.texi becomes f.info) - test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info - fi - # If the file does not exist, the user really needs makeinfo; - # let's fail without touching anything. - test -f $file || exit 1 - touch $file - ;; - - tar) - shift - - # We have already tried tar in the generic part. - # Look for gnutar/gtar before invocation to avoid ugly error - # messages. - if (gnutar --version > /dev/null 2>&1); then - gnutar "$@" && exit 0 - fi - if (gtar --version > /dev/null 2>&1); then - gtar "$@" && exit 0 - fi - firstarg="$1" - if shift; then - case "$firstarg" in - *o*) - firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - case "$firstarg" in - *h*) - firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - fi - - echo 1>&2 "\ -WARNING: I can't seem to be able to run \`tar' with the given arguments. - You may want to install GNU tar or Free paxutils, or check the - command line arguments." - exit 1 - ;; - - *) - echo 1>&2 "\ -WARNING: \`$1' is needed, and is $msg. - You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequisites for installing - this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." - exit 1 - ;; -esac - -exit 0 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/omega/LICENSE b/omega/LICENSE deleted file mode 100644 index f0fbe69..0000000 --- a/omega/LICENSE +++ /dev/null @@ -1,705 +0,0 @@ -Omega+ and CodeGen+ -Copyright (C) 2005-2011 Chun Chen -All rights reserved. - - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. - -============================================================================== - -The Omega Project -Copyright (C) 1994-2000 by the Omega Project -All rights reserved. - -NOTICE: This software is provided ``as is'', without any -warranty, including any implied warranty for merchantability or -fitness for a particular purpose. Under no circumstances shall -the Omega Project or its agents be liable for any use of, misuse -of, or inability to use this software, including incidental and -consequential damages. - -License is hereby given to use, modify, and redistribute this -software, in whole or in part, for any purpose, commercial or -non-commercial, provided that the user agrees to the terms of this -copyright notice, including disclaimer of warranty, and provided -that this copyright notice, including disclaimer of warranty, is -preserved in the source code and documentation of anything derived -from this software. Any redistributor of this software or -anything derived from this software assumes responsibility for -ensuring that any parties to whom such a redistribution is made -are fully aware of the terms of this license and disclaimer. - -The Omega project can be contacted at omega@cs.umd.edu -or http://www.cs.umd.edu/projects/omega diff --git a/omega/Makefile.am b/omega/Makefile.am deleted file mode 100644 index d4a353d..0000000 --- a/omega/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -SUBDIRS=omega_lib/obj omega_calc/obj code_gen/obj - diff --git a/omega/aclocal.m4 b/omega/aclocal.m4 deleted file mode 100644 index a2aaad2..0000000 --- a/omega/aclocal.m4 +++ /dev/null @@ -1,1227 +0,0 @@ -# generated automatically by aclocal 1.14.1 -*- Autoconf -*- - -# Copyright (C) 1996-2013 Free Software Foundation, Inc. - -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, -[m4_warning([this file was generated for autoconf 2.69. -You have another version of autoconf. It may work, but is not guaranteed to. -If you have problems, you may need to regenerate the build system entirely. -To do so, use the procedure documented by the package, typically 'autoreconf'.])]) - -# Copyright (C) 2002-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_AUTOMAKE_VERSION(VERSION) -# ---------------------------- -# Automake X.Y traces this macro to ensure aclocal.m4 has been -# generated from the m4 files accompanying Automake X.Y. -# (This private macro should not be called outside this file.) -AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.14' -dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to -dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.14.1], [], - [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl -]) - -# _AM_AUTOCONF_VERSION(VERSION) -# ----------------------------- -# aclocal traces this macro to find the Autoconf version. -# This is a private macro too. Using m4_define simplifies -# the logic in aclocal, which can simply ignore this definition. -m4_define([_AM_AUTOCONF_VERSION], []) - -# AM_SET_CURRENT_AUTOMAKE_VERSION -# ------------------------------- -# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. -# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. -AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.14.1])dnl -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) - -# Copyright (C) 2011-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_AR([ACT-IF-FAIL]) -# ------------------------- -# Try to determine the archiver interface, and trigger the ar-lib wrapper -# if it is needed. If the detection of archiver interface fails, run -# ACT-IF-FAIL (default is to abort configure with a proper error message). -AC_DEFUN([AM_PROG_AR], -[AC_BEFORE([$0], [LT_INIT])dnl -AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl -AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([ar-lib])dnl -AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false]) -: ${AR=ar} - -AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface], - [AC_LANG_PUSH([C]) - am_cv_ar_interface=ar - AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])], - [am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD' - AC_TRY_EVAL([am_ar_try]) - if test "$ac_status" -eq 0; then - am_cv_ar_interface=ar - else - am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&AS_MESSAGE_LOG_FD' - AC_TRY_EVAL([am_ar_try]) - if test "$ac_status" -eq 0; then - am_cv_ar_interface=lib - else - am_cv_ar_interface=unknown - fi - fi - rm -f conftest.lib libconftest.a - ]) - AC_LANG_POP([C])]) - -case $am_cv_ar_interface in -ar) - ;; -lib) - # Microsoft lib, so override with the ar-lib wrapper script. - # FIXME: It is wrong to rewrite AR. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__AR in this case, - # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something - # similar. - AR="$am_aux_dir/ar-lib $AR" - ;; -unknown) - m4_default([$1], - [AC_MSG_ERROR([could not determine $AR interface])]) - ;; -esac -AC_SUBST([AR])dnl -]) - -# AM_AUX_DIR_EXPAND -*- Autoconf -*- - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to -# '$srcdir', '$srcdir/..', or '$srcdir/../..'. -# -# Of course, Automake must honor this variable whenever it calls a -# tool from the auxiliary directory. The problem is that $srcdir (and -# therefore $ac_aux_dir as well) can be either absolute or relative, -# depending on how configure is run. This is pretty annoying, since -# it makes $ac_aux_dir quite unusable in subdirectories: in the top -# source directory, any form will work fine, but in subdirectories a -# relative path needs to be adjusted first. -# -# $ac_aux_dir/missing -# fails when called from a subdirectory if $ac_aux_dir is relative -# $top_srcdir/$ac_aux_dir/missing -# fails if $ac_aux_dir is absolute, -# fails when called from a subdirectory in a VPATH build with -# a relative $ac_aux_dir -# -# The reason of the latter failure is that $top_srcdir and $ac_aux_dir -# are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is '.', but things will broke when you -# start a VPATH build or use an absolute $srcdir. -# -# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, -# iff we strip the leading $srcdir from $ac_aux_dir. That would be: -# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` -# and then we would define $MISSING as -# MISSING="\${SHELL} $am_aux_dir/missing" -# This will work as long as MISSING is not called from configure, because -# unfortunately $(top_srcdir) has no meaning in configure. -# However there are other variables, like CC, which are often used in -# configure, and could therefore not use this "fixed" $ac_aux_dir. -# -# Another solution, used here, is to always expand $ac_aux_dir to an -# absolute PATH. The drawback is that using absolute paths prevent a -# configured tree to be moved without reconfiguration. - -AC_DEFUN([AM_AUX_DIR_EXPAND], -[dnl Rely on autoconf to set up CDPATH properly. -AC_PREREQ([2.50])dnl -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` -]) - -# AM_CONDITIONAL -*- Autoconf -*- - -# Copyright (C) 1997-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_CONDITIONAL(NAME, SHELL-CONDITION) -# ------------------------------------- -# Define a conditional. -AC_DEFUN([AM_CONDITIONAL], -[AC_PREREQ([2.52])dnl - m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl -AC_SUBST([$1_TRUE])dnl -AC_SUBST([$1_FALSE])dnl -_AM_SUBST_NOTMAKE([$1_TRUE])dnl -_AM_SUBST_NOTMAKE([$1_FALSE])dnl -m4_define([_AM_COND_VALUE_$1], [$2])dnl -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi -AC_CONFIG_COMMANDS_PRE( -[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then - AC_MSG_ERROR([[conditional "$1" was never defined. -Usually this means the macro was only invoked conditionally.]]) -fi])]) - -# Copyright (C) 1999-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - - -# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be -# written in clear, in which case automake, when reading aclocal.m4, -# will think it sees a *use*, and therefore will trigger all it's -# C support machinery. Also note that it means that autoscan, seeing -# CC etc. in the Makefile, will ask for an AC_PROG_CC use... - - -# _AM_DEPENDENCIES(NAME) -# ---------------------- -# See how the compiler implements dependency checking. -# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". -# We try a few techniques and use that to set a single cache variable. -# -# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was -# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular -# dependency, and given that the user is not expected to run this macro, -# just rely on AC_PROG_CC. -AC_DEFUN([_AM_DEPENDENCIES], -[AC_REQUIRE([AM_SET_DEPDIR])dnl -AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl -AC_REQUIRE([AM_MAKE_INCLUDE])dnl -AC_REQUIRE([AM_DEP_TRACK])dnl - -m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], - [$1], [CXX], [depcc="$CXX" am_compiler_list=], - [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], - [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], - [$1], [UPC], [depcc="$UPC" am_compiler_list=], - [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) - -AC_CACHE_CHECK([dependency style of $depcc], - [am_cv_$1_dependencies_compiler_type], -[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_$1_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` - fi - am__universal=false - m4_case([$1], [CC], - [case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac], - [CXX], - [case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac]) - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_$1_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_$1_dependencies_compiler_type=none -fi -]) -AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) -AM_CONDITIONAL([am__fastdep$1], [ - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) -]) - - -# AM_SET_DEPDIR -# ------------- -# Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES. -AC_DEFUN([AM_SET_DEPDIR], -[AC_REQUIRE([AM_SET_LEADING_DOT])dnl -AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl -]) - - -# AM_DEP_TRACK -# ------------ -AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE([dependency-tracking], [dnl -AS_HELP_STRING( - [--enable-dependency-tracking], - [do not reject slow dependency extractors]) -AS_HELP_STRING( - [--disable-dependency-tracking], - [speeds up one-time build])]) -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' - am__nodep='_no' -fi -AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -AC_SUBST([AMDEPBACKSLASH])dnl -_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl -AC_SUBST([am__nodep])dnl -_AM_SUBST_NOTMAKE([am__nodep])dnl -]) - -# Generate code to set up dependency tracking. -*- Autoconf -*- - -# Copyright (C) 1999-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - - -# _AM_OUTPUT_DEPENDENCY_COMMANDS -# ------------------------------ -AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], -[{ - # Older Autoconf quotes --file arguments for eval, but not when files - # are listed without --file. Let's play safe and only enable the eval - # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac - shift - for mf - do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME(["$file"])` - AS_MKDIR_P([$dirpart/$fdir]) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done - done -} -])# _AM_OUTPUT_DEPENDENCY_COMMANDS - - -# AM_OUTPUT_DEPENDENCY_COMMANDS -# ----------------------------- -# This macro should only be invoked once -- use via AC_REQUIRE. -# -# This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each '.P' file that we will -# need in order to bootstrap the dependency handling code. -AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], -[AC_CONFIG_COMMANDS([depfiles], - [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], - [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) -]) - -# Do all the work for Automake. -*- Autoconf -*- - -# Copyright (C) 1996-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This macro actually does too much. Some checks are only needed if -# your package does certain things. But this isn't really a big deal. - -dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. -m4_define([AC_PROG_CC], -m4_defn([AC_PROG_CC]) -[_AM_PROG_CC_C_O -]) - -# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) -# AM_INIT_AUTOMAKE([OPTIONS]) -# ----------------------------------------------- -# The call with PACKAGE and VERSION arguments is the old style -# call (pre autoconf-2.50), which is being phased out. PACKAGE -# and VERSION should now be passed to AC_INIT and removed from -# the call to AM_INIT_AUTOMAKE. -# We support both call styles for the transition. After -# the next Automake release, Autoconf can make the AC_INIT -# arguments mandatory, and then we can depend on a new Autoconf -# release and drop the old call support. -AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_PREREQ([2.65])dnl -dnl Autoconf wants to disallow AM_ names. We explicitly allow -dnl the ones we care about. -m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl -AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl -AC_REQUIRE([AC_PROG_INSTALL])dnl -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) - fi -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi -AC_SUBST([CYGPATH_W]) - -# Define the identity of the package. -dnl Distinguish between old-style and new-style calls. -m4_ifval([$2], -[AC_DIAGNOSE([obsolete], - [$0: two- and three-arguments forms are deprecated.]) -m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl - AC_SUBST([PACKAGE], [$1])dnl - AC_SUBST([VERSION], [$2])], -[_AM_SET_OPTIONS([$1])dnl -dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. -m4_if( - m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), - [ok:ok],, - [m4_fatal([AC_INIT should be called with package and version arguments])])dnl - AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl - AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl - -_AM_IF_OPTION([no-define],, -[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) - AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl - -# Some tools Automake needs. -AC_REQUIRE([AM_SANITY_CHECK])dnl -AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) -AM_MISSING_PROG([AUTOCONF], [autoconf]) -AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) -AM_MISSING_PROG([AUTOHEADER], [autoheader]) -AM_MISSING_PROG([MAKEINFO], [makeinfo]) -AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl -AC_REQUIRE([AC_PROG_MKDIR_P])dnl -# For better backward compatibility. To be removed once Automake 1.9.x -# dies out for good. For more background, see: -# -# -AC_SUBST([mkdir_p], ['$(MKDIR_P)']) -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([AC_PROG_MAKE_SET])dnl -AC_REQUIRE([AM_SET_LEADING_DOT])dnl -_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], - [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], - [_AM_PROG_TAR([v7])])]) -_AM_IF_OPTION([no-dependencies],, -[AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES([CC])], - [m4_define([AC_PROG_CC], - m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl -AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES([CXX])], - [m4_define([AC_PROG_CXX], - m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl -AC_PROVIDE_IFELSE([AC_PROG_OBJC], - [_AM_DEPENDENCIES([OBJC])], - [m4_define([AC_PROG_OBJC], - m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl -AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], - [_AM_DEPENDENCIES([OBJCXX])], - [m4_define([AC_PROG_OBJCXX], - m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl -]) -AC_REQUIRE([AM_SILENT_RULES])dnl -dnl The testsuite driver may need to know about EXEEXT, so add the -dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This -dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. -AC_CONFIG_COMMANDS_PRE(dnl -[m4_provide_if([_AM_COMPILER_EXEEXT], - [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl - -# POSIX will say in a future version that running "rm -f" with no argument -# is OK; and we want to be able to make that assumption in our Makefile -# recipes. So use an aggressive probe to check that the usage we want is -# actually supported "in the wild" to an acceptable degree. -# See automake bug#10828. -# To make any issue more visible, cause the running configure to be aborted -# by default if the 'rm' program in use doesn't match our expectations; the -# user can still override this though. -if rm -f && rm -fr && rm -rf; then : OK; else - cat >&2 <<'END' -Oops! - -Your 'rm' program seems unable to run without file operands specified -on the command line, even when the '-f' option is present. This is contrary -to the behaviour of most rm programs out there, and not conforming with -the upcoming POSIX standard: - -Please tell bug-automake@gnu.org about your system, including the value -of your $PATH and any error possibly output before this message. This -can help us improve future automake versions. - -END - if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then - echo 'Configuration will proceed anyway, since you have set the' >&2 - echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 - echo >&2 - else - cat >&2 <<'END' -Aborting the configuration process, to ensure you take notice of the issue. - -You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . - -If you want to complete the configuration process using your problematic -'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM -to "yes", and re-run configure. - -END - AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) - fi -fi]) - -dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not -dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further -dnl mangled by Autoconf and run in a shell conditional statement. -m4_define([_AC_COMPILER_EXEEXT], -m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) - -# When config.status generates a header, we must update the stamp-h file. -# This file resides in the same directory as the config header -# that is generated. The stamp files are numbered to have different names. - -# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the -# loop where config.status creates the headers, so we can generate -# our stamp files there. -AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], -[# Compute $1's index in $config_headers. -_am_arg=$1 -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $_am_arg | $_am_arg:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. -AC_DEFUN([AM_PROG_INSTALL_SH], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -if test x"${install_sh}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; - *) - install_sh="\${SHELL} $am_aux_dir/install-sh" - esac -fi -AC_SUBST([install_sh])]) - -# Copyright (C) 2003-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# Check whether the underlying file-system supports filenames -# with a leading dot. For instance MS-DOS doesn't. -AC_DEFUN([AM_SET_LEADING_DOT], -[rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null -AC_SUBST([am__leading_dot])]) - -# Copyright (C) 1998-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_LEX -# ----------- -# Autoconf leaves LEX=: if lex or flex can't be found. Change that to a -# "missing" invocation, for better error output. -AC_DEFUN([AM_PROG_LEX], -[AC_PREREQ([2.50])dnl -AC_REQUIRE([AM_MISSING_HAS_RUN])dnl -AC_REQUIRE([AC_PROG_LEX])dnl -if test "$LEX" = :; then - LEX=${am_missing_run}flex -fi]) - -# Check to see how 'make' treats includes. -*- Autoconf -*- - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_MAKE_INCLUDE() -# ----------------- -# Check to see how make treats includes. -AC_DEFUN([AM_MAKE_INCLUDE], -[am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf -]) - -# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- - -# Copyright (C) 1997-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_MISSING_PROG(NAME, PROGRAM) -# ------------------------------ -AC_DEFUN([AM_MISSING_PROG], -[AC_REQUIRE([AM_MISSING_HAS_RUN]) -$1=${$1-"${am_missing_run}$2"} -AC_SUBST($1)]) - -# AM_MISSING_HAS_RUN -# ------------------ -# Define MISSING if not defined so far and test if it is modern enough. -# If it is, set am_missing_run to use it, otherwise, to nothing. -AC_DEFUN([AM_MISSING_HAS_RUN], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([missing])dnl -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac -fi -# Use eval to expand $SHELL -if eval "$MISSING --is-lightweight"; then - am_missing_run="$MISSING " -else - am_missing_run= - AC_MSG_WARN(['missing' script is too old or missing]) -fi -]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_MANGLE_OPTION(NAME) -# ----------------------- -AC_DEFUN([_AM_MANGLE_OPTION], -[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) - -# _AM_SET_OPTION(NAME) -# -------------------- -# Set option NAME. Presently that only means defining a flag for this option. -AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) - -# _AM_SET_OPTIONS(OPTIONS) -# ------------------------ -# OPTIONS is a space-separated list of Automake options. -AC_DEFUN([_AM_SET_OPTIONS], -[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) - -# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) -# ------------------------------------------- -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -AC_DEFUN([_AM_IF_OPTION], -[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) - -# Copyright (C) 1999-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_PROG_CC_C_O -# --------------- -# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC -# to automatically call this. -AC_DEFUN([_AM_PROG_CC_C_O], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([compile])dnl -AC_LANG_PUSH([C])dnl -AC_CACHE_CHECK( - [whether $CC understands -c and -o together], - [am_cv_prog_cc_c_o], - [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) - # Make sure it works both with $CC and with simple cc. - # Following AC_PROG_CC_C_O, we do the test twice because some - # compilers refuse to overwrite an existing .o file with -o, - # though they will create one. - am_cv_prog_cc_c_o=yes - for am_i in 1 2; do - if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ - && test -f conftest2.$ac_objext; then - : OK - else - am_cv_prog_cc_c_o=no - break - fi - done - rm -f core conftest* - unset am_i]) -if test "$am_cv_prog_cc_c_o" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" -fi -AC_LANG_POP([C])]) - -# For backward compatibility. -AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_RUN_LOG(COMMAND) -# ------------------- -# Run COMMAND, save the exit status in ac_status, and log it. -# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) -AC_DEFUN([AM_RUN_LOG], -[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD - ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - (exit $ac_status); }]) - -# Check to make sure that the build environment is sane. -*- Autoconf -*- - -# Copyright (C) 1996-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_SANITY_CHECK -# --------------- -AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' -' -case `pwd` in - *[[\\\"\#\$\&\'\`$am_lf]]*) - AC_MSG_ERROR([unsafe absolute working directory name]);; -esac -case $srcdir in - *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) - AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; -esac - -# Do 'set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - am_has_slept=no - for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken - alias in your environment]) - fi - if test "$[2]" = conftest.file || test $am_try -eq 2; then - break - fi - # Just in case. - sleep 1 - am_has_slept=yes - done - test "$[2]" = conftest.file - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -AC_MSG_RESULT([yes]) -# If we didn't sleep, we still need to ensure time stamps of config.status and -# generated files are strictly newer. -am_sleep_pid= -if grep 'slept: no' conftest.file >/dev/null 2>&1; then - ( sleep 1 ) & - am_sleep_pid=$! -fi -AC_CONFIG_COMMANDS_PRE( - [AC_MSG_CHECKING([that generated files are newer than configure]) - if test -n "$am_sleep_pid"; then - # Hide warnings about reused PIDs. - wait $am_sleep_pid 2>/dev/null - fi - AC_MSG_RESULT([done])]) -rm -f conftest.file -]) - -# Copyright (C) 2009-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_SILENT_RULES([DEFAULT]) -# -------------------------- -# Enable less verbose build rules; with the default set to DEFAULT -# ("yes" being less verbose, "no" or empty being verbose). -AC_DEFUN([AM_SILENT_RULES], -[AC_ARG_ENABLE([silent-rules], [dnl -AS_HELP_STRING( - [--enable-silent-rules], - [less verbose build output (undo: "make V=1")]) -AS_HELP_STRING( - [--disable-silent-rules], - [verbose build output (undo: "make V=0")])dnl -]) -case $enable_silent_rules in @%:@ ((( - yes) AM_DEFAULT_VERBOSITY=0;; - no) AM_DEFAULT_VERBOSITY=1;; - *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; -esac -dnl -dnl A few 'make' implementations (e.g., NonStop OS and NextStep) -dnl do not support nested variable expansions. -dnl See automake bug#9928 and bug#10237. -am_make=${MAKE-make} -AC_CACHE_CHECK([whether $am_make supports nested variables], - [am_cv_make_support_nested_variables], - [if AS_ECHO([['TRUE=$(BAR$(V)) -BAR0=false -BAR1=true -V=1 -am__doit: - @$(TRUE) -.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then - am_cv_make_support_nested_variables=yes -else - am_cv_make_support_nested_variables=no -fi]) -if test $am_cv_make_support_nested_variables = yes; then - dnl Using '$V' instead of '$(V)' breaks IRIX make. - AM_V='$(V)' - AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' -else - AM_V=$AM_DEFAULT_VERBOSITY - AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY -fi -AC_SUBST([AM_V])dnl -AM_SUBST_NOTMAKE([AM_V])dnl -AC_SUBST([AM_DEFAULT_V])dnl -AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl -AC_SUBST([AM_DEFAULT_VERBOSITY])dnl -AM_BACKSLASH='\' -AC_SUBST([AM_BACKSLASH])dnl -_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl -]) - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_STRIP -# --------------------- -# One issue with vendor 'install' (even GNU) is that you can't -# specify the program used to strip binaries. This is especially -# annoying in cross-compiling environments, where the build's strip -# is unlikely to handle the host's binaries. -# Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in "make install-strip", and initialize -# STRIPPROG with the value of the STRIP variable (set by the user). -AC_DEFUN([AM_PROG_INSTALL_STRIP], -[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using 'strip' when the user -# run "make install-strip". However 'strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the 'STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. -if test "$cross_compiling" != no; then - AC_CHECK_TOOL([STRIP], [strip], :) -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) - -# Copyright (C) 2006-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_SUBST_NOTMAKE(VARIABLE) -# --------------------------- -# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. -# This macro is traced by Automake. -AC_DEFUN([_AM_SUBST_NOTMAKE]) - -# AM_SUBST_NOTMAKE(VARIABLE) -# -------------------------- -# Public sister of _AM_SUBST_NOTMAKE. -AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) - -# Check how to create a tarball. -*- Autoconf -*- - -# Copyright (C) 2004-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_PROG_TAR(FORMAT) -# -------------------- -# Check how to create a tarball in format FORMAT. -# FORMAT should be one of 'v7', 'ustar', or 'pax'. -# -# Substitute a variable $(am__tar) that is a command -# writing to stdout a FORMAT-tarball containing the directory -# $tardir. -# tardir=directory && $(am__tar) > result.tar -# -# Substitute a variable $(am__untar) that extract such -# a tarball read from stdin. -# $(am__untar) < result.tar -# -AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. Yes, it's still used -# in the wild :-( We should find a proper way to deprecate it ... -AC_SUBST([AMTAR], ['$${TAR-tar}']) - -# We'll loop over all known methods to create a tar archive until one works. -_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' - -m4_if([$1], [v7], - [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], - - [m4_case([$1], - [ustar], - [# The POSIX 1988 'ustar' format is defined with fixed-size fields. - # There is notably a 21 bits limit for the UID and the GID. In fact, - # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 - # and bug#13588). - am_max_uid=2097151 # 2^21 - 1 - am_max_gid=$am_max_uid - # The $UID and $GID variables are not portable, so we need to resort - # to the POSIX-mandated id(1) utility. Errors in the 'id' calls - # below are definitely unexpected, so allow the users to see them - # (that is, avoid stderr redirection). - am_uid=`id -u || echo unknown` - am_gid=`id -g || echo unknown` - AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) - if test $am_uid -le $am_max_uid; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - _am_tools=none - fi - AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) - if test $am_gid -le $am_max_gid; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - _am_tools=none - fi], - - [pax], - [], - - [m4_fatal([Unknown tar format])]) - - AC_MSG_CHECKING([how to create a $1 tar archive]) - - # Go ahead even if we have the value already cached. We do so because we - # need to set the values for the 'am__tar' and 'am__untar' variables. - _am_tools=${am_cv_prog_tar_$1-$_am_tools} - - for _am_tool in $_am_tools; do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break - - # tar/untar a dummy directory, and stop if the command works. - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) - rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi - done - rm -rf conftest.dir - - AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) - AC_MSG_RESULT([$am_cv_prog_tar_$1])]) - -AC_SUBST([am__tar]) -AC_SUBST([am__untar]) -]) # _AM_PROG_TAR - diff --git a/omega/ar-lib b/omega/ar-lib deleted file mode 100755 index fe2301e..0000000 --- a/omega/ar-lib +++ /dev/null @@ -1,270 +0,0 @@ -#! /bin/sh -# Wrapper for Microsoft lib.exe - -me=ar-lib -scriptversion=2012-03-01.08; # UTC - -# Copyright (C) 2010-2013 Free Software Foundation, Inc. -# Written by Peter Rosin . -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - - -# func_error message -func_error () -{ - echo "$me: $1" 1>&2 - exit 1 -} - -file_conv= - -# func_file_conv build_file -# Convert a $build file to $host form and store it in $file -# Currently only supports Windows hosts. -func_file_conv () -{ - file=$1 - case $file in - / | /[!/]*) # absolute file, and not a UNC file - if test -z "$file_conv"; then - # lazily determine how to convert abs files - case `uname -s` in - MINGW*) - file_conv=mingw - ;; - CYGWIN*) - file_conv=cygwin - ;; - *) - file_conv=wine - ;; - esac - fi - case $file_conv in - mingw) - file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` - ;; - cygwin) - file=`cygpath -m "$file" || echo "$file"` - ;; - wine) - file=`winepath -w "$file" || echo "$file"` - ;; - esac - ;; - esac -} - -# func_at_file at_file operation archive -# Iterate over all members in AT_FILE performing OPERATION on ARCHIVE -# for each of them. -# When interpreting the content of the @FILE, do NOT use func_file_conv, -# since the user would need to supply preconverted file names to -# binutils ar, at least for MinGW. -func_at_file () -{ - operation=$2 - archive=$3 - at_file_contents=`cat "$1"` - eval set x "$at_file_contents" - shift - - for member - do - $AR -NOLOGO $operation:"$member" "$archive" || exit $? - done -} - -case $1 in - '') - func_error "no command. Try '$0 --help' for more information." - ;; - -h | --h*) - cat < - -namespace omega { - -template Bag::Bag() { - contents = new List_Element ; - contents->tail = 0; - } -template Bag::~Bag() { - delete contents; - } - -template Ordered_Bag::Ordered_Bag() {} - -template Set::Set() {} - -template Bag::Bag(const Bag &L) { - contents = new List_Element(*L.contents); - } - -template Bag & Bag::operator=(const Bag &L) { - if (this != &L) { - delete contents; - contents = new List_Element(*L.contents); - } - return *this; - } - - - -template Set::Set(T e) { - assert(this->contents); - this->contents->tail = new List_Element(e, 0); - } - - -/**************************************************************** - * * - * Misc. simple Collection operations * - * * - ****************************************************************/ - -template bool Bag::empty() const { - return contents->tail == 0; - } - -template Iterator *Bag::new_iterator() - { - return new List_Element_Iterator(contents->tail); - } - - -template void Bag::clear() { - if (contents->tail) delete contents->tail; - contents->tail = 0; - } - -template int Bag::size() const { - int i = 0; - List_Element * p = contents->tail; - while (p) { - p = p->tail; - i++; - }; - return i; - } - - -/**************************************************************** - * * - * Collection/Element operations (e.g. insert, contains) * - * * - ****************************************************************/ - -template void Bag::remove(T e) { - List_Element * p = contents; - while (p->tail && p->tail->head != e) p = p->tail; - if (p->tail && p->tail->head == e) { - List_Element * q = p->tail; - p->tail = q->tail; - q->tail = 0; - delete q; - } - } - -template T Bag::extract() { - List_Element * p = contents->tail; - T e = p->head; - contents->tail = p->tail; - p->tail = 0; - delete p; - return e; - } - - -template void Bag::insert(T e) { - List_Element * q = new List_Element(e,contents->tail); - contents->tail = q; - } - -template void Ordered_Bag::insert(T e) { - List_Element * p = this->contents; - while (p->tail && p->tail->head < e) p = p->tail; - if (!p->tail || p->tail->head != e) { - List_Element * q = new List_Element(e,p->tail); - p->tail = q; - } - } - - -template bool Bag::contains(T e) const { - List_Element * p = contents; - while (p->tail && p->tail->head != e) p = p->tail; - return (p->tail && p->tail->head == e); - } - -template bool Ordered_Bag::contains(T e) const { - List_Element * p = this->contents; - while (p->tail && p->tail->head < e) p = p->tail; - return (p->tail && p->tail->head == e); - } - - -template bool Set::contains (const Set& b) const { - List_Element * p = this->contents; - List_Element * q = b.contents; - do { - /* consume matched elements in p and q */ - p = p->tail; - q = q->tail; - if (!q) return 1; /* no more elements to match */ - if (!p) return 0; /* nothing left in p to match with */ - if (q->head < p->head) { - /* nothing smaller than - p->head left in p, so q->head - can't be matched */ - return 0; - }; - while (p && p->head < q->head) { - /* toss away some elements from p */ - p = p->tail; - } - if (!p || q->head < p->head) return 0; - } while (q); - - return 1; - } - - - -/**************************************************************** - * * - * Collection/Collection operations (e.g. |=) * - * * - ****************************************************************/ - -template void Bag::operator |= (const Bag & b) { - assert(this != &b); - List_Element * q = b.contents->tail; - - while (q) { - List_Element * r = new List_Element(q->head,contents->tail); - contents->tail = r; - q = q->tail; - } - } - -template void Ordered_Bag::operator |= (const Ordered_Bag & b) { - if (this == &b) return; - List_Element * p = this->contents; - List_Element * q = b.contents->tail; - - while (q) { - while (p->tail && p->tail->head < q->head) p = p->tail; - List_Element * r = new List_Element(q->head,p->tail); - p->tail = r; - q = q->tail; - } - } - -template void Ordered_Bag::operator |= (const Bag & b) { - Ordered_Bag tmp; - for (List_Element *p = b.contents; p; p=p->tail) { - tmp.insert(p->head); - } - *this |= tmp; -} - -template void Set::operator |= (const Set & b) { - if (this == &b) return; - List_Element * p = this->contents; - List_Element * q = b.contents->tail; - - while (q) { - while (p->tail && p->tail->head < q->head) p = p->tail; - if (!p->tail || p->tail->head != q->head) { - List_Element * r = new List_Element(q->head,p->tail); - p->tail = r; - } - q = q->tail; - } - } - -template void Set::operator |= (const Ordered_Bag & b) { - Set tmp; - for (List_Element *p = b.contents; p; p=p->tail) { - tmp.insert(p->head); - } - *this |= tmp; -} - -template void Set::operator |= (const Bag & b) { - Set tmp; - for (List_Element *p = b.contents; p; p=p->tail) { - tmp.insert(p->head); - } - *this |= tmp; -} - - - -// delete items also in b -template void Set::operator -= (const Set & b) { - if (this == &b) { - this->clear(); - return; - } - List_Element * p = this->contents; - List_Element * q = b.contents->tail; - - while (q) { - while (p->tail && p->tail->head < q->head) p = p->tail; - if (p->tail && p->tail->head == q->head) { - List_Element * r = p->tail; - p->tail = r->tail; - r->tail = 0; - delete r; - } - q = q->tail; - } - } - - -// delete items not in b -template void Set::operator &= (const Set & b) - { - if (this == &b) return; - List_Element * p = this->contents; - List_Element * q = b.contents->tail; - - while (q) { - while (p->tail && p->tail->head < q->head) { - List_Element * r = p->tail; - p->tail = r->tail; - r->tail = 0; - delete r; - }; - if (p->tail && p->tail->head == q->head) { - /* allow p->tail->head into the result */ - p = p->tail; - } - /* q->head has matched anything it is going to match */ - q = q->tail; - } - if (p->tail) { - delete p->tail; - p->tail = 0; - }; - - } - - -template bool Set::operator & (const Set& b) const { - List_Element * p = this->contents; - List_Element * q = b.contents; - do { - p = p->tail; - q = q->tail; - while (p && q && p->head != q->head) { - while (p && p->head < q->head) p = p->tail; - while (p && q && q->head < p->head) q = q->tail; - }; - if (p && q && p->head == q->head) return 1; - } while (p && q); - - return 0; - } - - -template bool Ordered_Bag::operator == (const Ordered_Bag& b) const { - List_Element * p = this->contents; - List_Element * q = b.contents; - while (1) { - p = p->tail; - q = q->tail; - if (!p && !q) return 1; - if (!p || !q) return 0; - if (p->head != q->head) return 0; - }; - - } - -template bool Ordered_Bag::operator != (const Ordered_Bag& b) const { - return !(*this == b); - } - -template bool Ordered_Bag::operator < (const Ordered_Bag& b) const { - List_Element * p = this->contents; - List_Element * q = b.contents; - while (1) { - p = p->tail; - q = q->tail; - if (!p && !q) return 0; - if (!p) return 1; - if (!q) return 0; - if (p->head < q->head) return 1; - if (q->head < p->head) return 0; - }; - - return 1; - } - -} // namespace diff --git a/omega/basic/include/basic/Bag.h b/omega/basic/include/basic/Bag.h deleted file mode 100644 index 42285d0..0000000 --- a/omega/basic/include/basic/Bag.h +++ /dev/null @@ -1,78 +0,0 @@ -#if ! defined _Bag_h -#define _Bag_h 1 - -#include -#include -#include -#include - -namespace omega { - -template class Bag : public Collection { -public: -virtual ~Bag(); - Bag(); - Bag(const Bag&); - Bag & operator=(const Bag&); -virtual void operator |= (const Bag & b); // add elements in b - Iterator *new_iterator(); - bool empty() const; - void remove(T); -virtual void insert(T); - void clear(); -virtual bool contains(T) const; - int size() const; - T extract(); -// protected: breaks g++ 261 - List_Element* contents; -}; - - -template class Ordered_Bag : public Bag { -public: - Ordered_Bag(); -// virtual ~Ordered_Bag(); - Ordered_Bag(const Ordered_Bag& B) : Bag(B) {} - void insert(T); -virtual void operator |= (const Ordered_Bag & b); // add elements in b - void operator |= (const Bag & b); - bool contains(T) const; - bool operator == (const Ordered_Bag&) const; - bool operator != (const Ordered_Bag&) const; - bool operator < (const Ordered_Bag&) const; -}; - -template class Set : public Ordered_Bag { -public: - Set(); -// virtual ~Set(); - Set(T); - Set(const Set& S) : Ordered_Bag(S) {} - - bool contains (const Set& b) const; - bool contains (T t) const { return Ordered_Bag::contains(t); } - // the above makes "standard" C++ happy - -virtual void operator |= (const Set & b); // add elements in b - void operator |= (const Ordered_Bag & b); - void operator |= (const Bag & b); - - void operator -= (const Set & b); // delete items also in b - void operator &= (const Set & b); // delete items not in b - bool operator & (const Set &) const; // check for elements in common -}; - -} // namespace - -#if ! defined DONT_INCLUDE_TEMPLATE_CODE -#include -#endif - -#define instantiate_Bag(T) template class Bag; \ - instantiate_List_Element(T); -#define instantiate_Ordered_Bag(T) template class Ordered_Bag; \ - instantiate_Bag(T) -#define instantiate_Set(T) template class Set; \ - instantiate_Ordered_Bag(T) - -#endif diff --git a/omega/basic/include/basic/BoolSet.h b/omega/basic/include/basic/BoolSet.h deleted file mode 100644 index 9fcfd41..0000000 --- a/omega/basic/include/basic/BoolSet.h +++ /dev/null @@ -1,283 +0,0 @@ -/***************************************************************************** - Copyright (C) 2009 University of Utah - All Rights Reserved. - - Purpose: - Class of set of bools where each element is indexed by a small integer. - - Notes: - Set operands of binary operations can be of different sizes, missing - elements are treated as false. - - History: - 03/30/2009 Created by Chun Chen. -*****************************************************************************/ - -#ifndef BOOLSET_H -#define BOOLSET_H - -#include -#include -#include - -namespace omega { - -template -class BoolSet { -protected: - unsigned int size_; - std::vector set_; -public: - BoolSet(unsigned int size = 0); - ~BoolSet() {} - - void set(unsigned int); - void unset(unsigned int); - bool get(unsigned int) const; - unsigned int size() const {return size_;} - unsigned int num_elem() const; - bool imply(const BoolSet &) const; - bool empty() const; - - BoolSet &operator|=(const BoolSet &); - BoolSet &operator&=(const BoolSet &); - BoolSet &operator-=(const BoolSet &); - - template friend BoolSet operator|(const BoolSet &, const BoolSet &); // union - template friend BoolSet operator&(const BoolSet &, const BoolSet &); // intersection - template friend BoolSet operator-(const BoolSet &, const BoolSet &); // difference - template friend BoolSet operator~(const BoolSet &); // complement - template friend bool operator==(const BoolSet &, const BoolSet &); - template friend bool operator!=(const BoolSet &, const BoolSet &); - template friend std::ostream& operator<<(std::ostream &, const BoolSet &); -}; - - -template -BoolSet::BoolSet(unsigned int size) { - assert(size >= 0); - size_ = size; - unsigned int n = size / (sizeof(T)*8); - unsigned int r = size % (sizeof(T)*8); - if (r != 0) - n++; - set_ = std::vector(n, static_cast(0)); -} - - -template -void BoolSet::set(unsigned int i) { - assert(i < size_ && i >= 0); - unsigned int n = i / (sizeof(T)*8); - unsigned int r = i % (sizeof(T)*8); - - T t = static_cast(1) << r; - set_[n] |= t; -} - - -template -void BoolSet::unset(unsigned int i) { - assert(i < size_ && i >= 0); - unsigned int n = i / (sizeof(T)*8); - unsigned int r = i % (sizeof(T)*8); - - T t = static_cast(1) << r; - t = ~t; - set_[n] &= t; -} - - -template -bool BoolSet::get(unsigned int i) const { - assert(i < size_ && i >= 0); - unsigned int n = i / (sizeof(T)*8); - unsigned int r = i % (sizeof(T)*8); - - T t = static_cast(1) << r; - t = set_[n] & t; - if (t) - return true; - else - return false; -} - - -template -unsigned int BoolSet::num_elem() const { - unsigned int n = size_; - unsigned int c = 0; - unsigned int p = 0; - while (n != 0) { - unsigned int m; - if (n >= sizeof(T)*8) { - m = sizeof(T)*8; - n -= sizeof(T)*8; - } - else { - m = n; - n = 0; - } - - T v = set_[p++]; - if (v != static_cast(0)) { - for (unsigned int i = 0; i < m; i++) { - if (v & static_cast(1)) - c++; - v >>= 1; - } - } - } - - return c; -} - - -template -bool BoolSet::imply(const BoolSet &b) const { - if (size_ >= b.size_) { - for (unsigned int i = 0; i < b.set_.size(); i++) - if ((set_[i] & b.set_[i]) != b.set_[i]) - return false; - } - else { - for (unsigned int i = 0; i < set_.size(); i++) - if ((set_[i] & b.set_[i]) != b.set_[i]) - return false; - for (unsigned int i = set_.size(); i < b.set_.size(); i++) - if (b.set_[i] != static_cast(0)) - return false; - } - - return true; -} - - -template -bool BoolSet::empty() const { - for (int i = 0; i < set_.size(); i++) - if (set_[i] != static_cast(0)) - return false; - - return true; -} - - -template -BoolSet operator|(const BoolSet &a, const BoolSet &b) { - if (a.size_ >= b.size_) { - BoolSet c = a; - for (unsigned int i = 0; i < b.set_.size(); i++) - c.set_[i] |= b.set_[i]; - return c; - } - else { - BoolSet c = b; - for (unsigned int i = 0; i < a.set_.size(); i++) - c.set_[i] |= a.set_[i]; - return c; - } -} - - -template -BoolSet operator&(const BoolSet &a, const BoolSet &b) { - if (a.size_ >= b.size_) { - BoolSet c = a; - for (unsigned int i = 0; i < b.set_.size(); i++) - c.set_[i] &= b.set_[i]; - for (unsigned int i = b.set_.size(); i < a.set_.size(); i++) - c.set_[i] = static_cast(0); - return c; - } - else { - BoolSet c = b; - for (unsigned int i = 0; i < a.set_.size(); i++) - c.set_[i] &= a.set_[i]; - for (unsigned int i = a.set_.size(); i < b.set_.size(); i++) - c.set_[i] = static_cast(0); - return c; - } -} - - -template -BoolSet operator-(const BoolSet &a, const BoolSet &b) { - BoolSet c(a.size_); - - int sz = a.set_.size(); - if (sz > b.set_.size()) - sz = b.set_.size(); - for (int i = 0; i < sz; i++) - c.set_[i] = a.set_[i] ^ (a.set_[i] & b.set_[i]); - for (int i = sz; i < a.set_.size(); i++) - c.set_[i] = a.set_[i]; - - return c; -} - - -template -BoolSet operator~(const BoolSet &b) { - unsigned int r = b.size_ % (sizeof(T)*8); - BoolSet a(b.size_); - for (unsigned int i = 0; i < b.set_.size(); i++) - a.set_[i] = ~b.set_[i]; - - if (r != 0) { - T t = static_cast(1); - for (unsigned int i = 1; i < r; i++) - t = (t << 1) | static_cast(1); - a.set_[a.set_.size()-1] &= t; - } - return a; -} - - -template -bool operator==(const BoolSet &a, const BoolSet &b) { - return (a.size_ == b.size_) && (a.set_ == b.set_); -} - - -template -bool operator!=(const BoolSet &a, const BoolSet &b) { - return !(a == b); -} - - - -template -BoolSet & BoolSet::operator|=(const BoolSet &b) { - *this = *this | b; - return *this; -} - - -template -BoolSet & BoolSet::operator&=(const BoolSet &b) { - *this = *this & b; - return *this; -} - - -template -BoolSet & BoolSet::operator-=(const BoolSet &b) { - *this = *this - b; - return *this; -} - - -template -std::ostream& operator<<(std::ostream &os, const BoolSet &b) { - for (int i = b.size()-1; i >= 0; i--) - if (b.get(i)) - os << '1'; - else - os << '0'; - return os; -} - -} // namespace - -#endif diff --git a/omega/basic/include/basic/Collection.h b/omega/basic/include/basic/Collection.h deleted file mode 100644 index c7e4eef..0000000 --- a/omega/basic/include/basic/Collection.h +++ /dev/null @@ -1,47 +0,0 @@ -#if !defined Already_Included_Collection -#define Already_Included_Collection - -namespace omega { - -template class Iterator; -template class Any_Iterator; - - -/* - * protocol for any kind of collection - */ - -template class Collection { -public: - virtual Iterator *new_iterator() = 0; - virtual Any_Iterator any_iterator() { return Any_Iterator(new_iterator()); } - - virtual int size() const = 0; -}; - - -/* - * protocol for collections whose elements are ordered - * by the way they are entered into the collection, and - * whose elements can be accessed by "index" - * - * note that the implementation need not be a linked list - */ - -template class Sequence : public Collection { -public: - virtual const T &operator[](int) const = 0; - virtual T &operator[](int) = 0; - - virtual int index(const T &) const = 0; // Y in X --> X[X.index(Y)] == Y -}; - -} // namespace - -#define instantiate_Collection(T) template class Collection; \ - instantiate_Any_Iterator(T) -#define instantiate_Sequence(T) template class Sequence; \ - instantiate_Collection(T) - -#endif - diff --git a/omega/basic/include/basic/Collections.h b/omega/basic/include/basic/Collections.h deleted file mode 100644 index 1e68031..0000000 --- a/omega/basic/include/basic/Collections.h +++ /dev/null @@ -1,12 +0,0 @@ -#if !defined Already_Included_Collections -#define Already_Included_Collections - -#include -#include -#include -#include -#include -#include - -#endif - diff --git a/omega/basic/include/basic/ConstString.h b/omega/basic/include/basic/ConstString.h deleted file mode 100644 index 5149e55..0000000 --- a/omega/basic/include/basic/ConstString.h +++ /dev/null @@ -1,58 +0,0 @@ -#if ! defined _Const_String_h -#define _Const_String_h 1 - -#include - -namespace omega { - -// should be inside Const_String, but I can't get it to -// compile the hashTable when it is: hashTable can't be -// global, but if it and its size are static to Const_String, -// the compiler still doesn't seem to like the definition, -// or the declaration either for that matter. - -class ConstStringRep { -public: - const char *name; - int count; - ConstStringRep *nextInBucket; - ConstStringRep(const char *t); -}; - -class Const_String { -private: - ConstStringRep *rep; - void buildRep(const char *t); - -public: - Const_String(); - Const_String(const char* t); - Const_String(const std::string &s); - Const_String(const Const_String & t) {rep = t.rep;} - - operator int() const; - int null() const; - - operator const char*() const; - operator std::string() const; - int operator++(int); - int operator++(); - int operator--(int); - int operator--(); - friend int operator==(const Const_String &x, const Const_String &y); - friend int operator!=(const Const_String &x, const Const_String &y); - friend int operator<(const Const_String &x, const Const_String &y); - friend int operator >(const Const_String &x, const Const_String &y); - -}; - -#if defined SCREWED_UP_CASTING_RULES -static int operator==(const Const_String &x, const char *y) -{ return x == (Const_String) y; } -static int operator!=(const Const_String &x, const char *y) -{ return x != (Const_String) y; } -#endif - -} // namespace - -#endif diff --git a/omega/basic/include/basic/Dynamic_Array.c b/omega/basic/include/basic/Dynamic_Array.c deleted file mode 100644 index 0300fd8..0000000 --- a/omega/basic/include/basic/Dynamic_Array.c +++ /dev/null @@ -1,219 +0,0 @@ -#include -#include - -namespace omega { - -template void Dynamic_Array::do_constr() - { -// #if ! defined SHUT_UP_ABOUT_STATEMENT_WITH_NO_EFFECT_IN_DYNAMIC_ARRAY_CREATION -// assert(d > 0); -// #endif - bounds = 0; - elements = 0; - partial = false; - } - - -template void Dynamic_Array1::do_construct(int d0) - { - this->bounds = new int[1]; - this->bounds[0] = d0; - this->elements = new T [d0]; - this->partial = false; - } - -template void Dynamic_Array2::do_construct(int d0, int d1) - { - this->bounds = new int[2]; - this->bounds[0] = d0; - this->bounds[1] = d1; - this->elements = new T [d0 * d1]; - this->partial = false; - } - -template void Dynamic_Array3::do_construct(int d0,int d1,int d2) - { - this->bounds = new int[3]; - this->bounds[0] = d0; - this->bounds[1] = d1; - this->bounds[2] = d2; - this->elements = new T [d0 * d1 * d2]; - this->partial = false; - } - -template void Dynamic_Array4::do_construct(int d0,int d1,int d2,int d3) - { - this->bounds = new int[4]; - this->bounds[0] = d0; - this->bounds[1] = d1; - this->bounds[2] = d2; - this->bounds[3] = d3; - this->elements = new T [d0 * d1 * d2 * d3]; - this->partial = false; - } - -template Dynamic_Array::Dynamic_Array() - { - do_constr(); - } - -template Dynamic_Array1::Dynamic_Array1(const char *) - { - this->do_constr(); - } - -template Dynamic_Array2::Dynamic_Array2(const char *,const char *) - { - this->do_constr(); - } - -template Dynamic_Array3::Dynamic_Array3(const char *,const char *,const char *) - { - this->do_constr(); - } - -template Dynamic_Array4::Dynamic_Array4(const char *,const char *,const char *,const char *) - { - this->do_constr(); - } - -template Dynamic_Array1::Dynamic_Array1(int d0) - { - do_construct(d0); - } - -template Dynamic_Array2::Dynamic_Array2(int d0, int d1) - { - do_construct(d0, d1); - } - -template Dynamic_Array3::Dynamic_Array3(int d0,int d1,int d2) - { - do_construct(d0, d1, d2); - } - -template Dynamic_Array4::Dynamic_Array4(int d0,int d1,int d2,int d3) - { - do_construct(d0, d1, d2, d3); - } - - -template void Dynamic_Array::do_destruct() - { - if (! partial) - { - delete [] bounds; - delete [] elements; - } - } - - -template Dynamic_Array::~Dynamic_Array() - { - do_destruct(); - } - - -template void Dynamic_Array1::resize(int d0) - { - assert(!this->partial); - this->do_destruct(); - if (d0 == 0) - this->do_constr(); - else - do_construct(d0); - } - -template void Dynamic_Array2::resize(int d0, int d1) - { - assert(!this->partial); - this->do_destruct(); - if (d0 == 0 && d1 == 0) - this->do_constr(); - else - do_construct(d0, d1); - } - -template void Dynamic_Array3::resize(int d0, int d1, int d2) - { - assert(!this->partial); - this->do_destruct(); - if (d0 == 0 && d1 == 0 && d2 == 0) - this->do_constr(); - else - do_construct(d0, d1, d2); - } - -template void Dynamic_Array4::resize(int d0, int d1, int d2, int d3) - { - assert(!this->partial); - this->do_destruct(); - if (d0 == 0 && d1 == 0 && d2 == 0 && d3 == 0) - this->do_constr(); - else - do_construct(d0, d1, d2, d3); - } - - -template T& Dynamic_Array1::operator[](int d0) - { -#if !defined (NDEBUG) - assert(this->elements != 0 && "Trying to dereference undefined array"); - assert(0 <= d0 && d0 < this->bounds[0] && "Array subscript out of bounds"); -#endif - - return this->elements[d0]; - } - -template Dynamic_Array1 Dynamic_Array2::operator[](int d0) - { -#if !defined (NDEBUG) - assert(this->elements != 0 && "Trying to dereference undefined array"); - assert(0 <= d0 && d0 < this->bounds[0] && "Array subscript out of bounds"); -#endif - - Dynamic_Array1 result; - result.bounds = this->bounds+1; - result.elements = this->elements + this->bounds[1] * d0; - result.partial = true; - return result; - } - -template Dynamic_Array2 Dynamic_Array3::operator[](int d0) - { -#if !defined (NDEBUG) - assert(this->elements != 0 && "Trying to dereference undefined array"); - assert(0 <= d0 && d0 < this->bounds[0] && "Array subscript out of bounds"); -#endif - Dynamic_Array2 result; - result.bounds = this->bounds+1; - result.elements = this->elements + this->bounds[1] * this->bounds[2] * d0; - result.partial = true; - return result; - } - -template Dynamic_Array3 Dynamic_Array4::operator[](int d0) - { -#if !defined (NDEBUG) - assert(this->elements != 0 && "Trying to dereference undefined array"); - assert(0 <= d0 && d0 < this->bounds[0] && "Array subscript out of bounds"); -#endif - - Dynamic_Array3 result; - result.bounds = this->bounds+1; - result.elements = this->elements + this->bounds[1] * this->bounds[2] * this->bounds[3] * d0; - result.partial = true; - return result; - } - - -template - Dynamic_Array::Dynamic_Array(Dynamic_Array &D) - { - assert(D.elements != 0 && "Trying to copy an undefined array"); - partial = true; - bounds = D.bounds; - elements = D.elements; - } - -} // namespace diff --git a/omega/basic/include/basic/Dynamic_Array.h b/omega/basic/include/basic/Dynamic_Array.h deleted file mode 100644 index c0bdf12..0000000 --- a/omega/basic/include/basic/Dynamic_Array.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef Already_Included_Dynamic_Array -#define Already_Included_Dynamic_Array - -namespace omega { - -template class Dynamic_Array2; -template class Dynamic_Array3; -template class Dynamic_Array4; - -template class Dynamic_Array - { - public: - Dynamic_Array(Dynamic_Array &D); - ~Dynamic_Array(); - - protected: - Dynamic_Array(); - bool partial; - int *bounds; - T *elements; - - void do_constr(); - void do_destruct(); - }; - - -template class Dynamic_Array1 : public Dynamic_Array - { - public: - Dynamic_Array1(const char *s0 = 0); - Dynamic_Array1(int d0); - void resize(int d0); - T& operator[](int d); - - friend class Dynamic_Array2; - - private: - void do_construct(int d0); - }; - - -template class Dynamic_Array2 : public Dynamic_Array - { - public: - Dynamic_Array2(const char *s0 = 0, const char *s1 = 0); - Dynamic_Array2(int d0, int d1); - void resize(int d0, int d1); - Dynamic_Array1 operator[](int d); - - friend class Dynamic_Array3; - - private: - void do_construct(int d0, int d1); - }; - - -template class Dynamic_Array3 : public Dynamic_Array - { - public: - Dynamic_Array3(const char *s0 = 0, const char *s1 = 0, const char *s2 = 0); - Dynamic_Array3(int d0, int d1, int d2); - void resize(int d0, int d1, int d2); - Dynamic_Array2 operator[](int d); - - friend class Dynamic_Array4; - - private: - void do_construct(int d0, int d1, int d2); - }; - -template class Dynamic_Array4 : public Dynamic_Array - { - public: - Dynamic_Array4(const char *s0 = 0, const char *s1 = 0, const char *s2 = 0, const char *s3 = 0); - Dynamic_Array4(int d0, int d1, int d2, int d3); - void resize(int d0, int d1, int d2, int d3); - Dynamic_Array3 operator[](int d); - - private: - void do_construct(int d0, int d1, int d2, int d3); - }; - -} // namespace - -#if ! defined DONT_INCLUDE_TEMPLATE_CODE -#include -#endif - -#define instantiate_Dynamic_Array1(T) template class Dynamic_Array1; \ - template class Dynamic_Array; - -#define instantiate_Dynamic_Array2(T) template class Dynamic_Array2; \ - template class Dynamic_Array; \ - instantiate_Dynamic_Array1(T); - -#define instantiate_Dynamic_Array3(T) template class Dynamic_Array3; \ - template class Dynamic_Array; \ - instantiate_Dynamic_Array2(T); - -#define instantiate_Dynamic_Array4(T) template class Dynamic_Array4; \ - template class Dynamic_Array; \ - instantiate_Dynamic_Array3(T); -#endif diff --git a/omega/basic/include/basic/Iterator.h b/omega/basic/include/basic/Iterator.h deleted file mode 100644 index 8975d9e..0000000 --- a/omega/basic/include/basic/Iterator.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Base classes for iterators, generators - * - * These don't really work yet for constant collections. - * I'm not sure how to make that happen. - */ - -#if ! defined _Iterator_h -#define _Iterator_h 1 - -#include - -namespace omega { - -#define foreach(x,T,S,A) do {for (omega::Any_Iterator __P_##x = (S).any_iterator();__P_##x;__P_##x++) {T & x = *__P_##x; A;}} while (0) - -#define foreachSeparated(x,T,S,A,B) do {for (omega::Any_Iterator __P_##x = (S).any_iterator();__P_##x;) {T & x = *__P_##x; A; __P_##x++; if (__P_##x) B;}} while (0) - -/* - * Abstract base class Iterator - * Supports two styles of iteration: - * - * for ( ... initialize i (typically i = collection) ... ; i ; i++ ) - * operate_on(*i) - * - * or - * - * for ( ... initialize i ... ; i.live() ; i.next() ) - * operate_on(i.curr()) - * - * >>> IF THE COLLECTION IS CHANGED, THE ITERATOR IS NO LONGER VALID <<< - * - * For collections that are not "Sequence"s, the order in - * which the elements are returned may not be consistent. - */ - -template class Iterator { -public: - virtual const T & operator*() const = 0; - virtual T & operator*() = 0; - - virtual void operator++(int) = 0; - virtual void operator++() = 0; - - virtual bool live() const = 0; - operator bool() const { return live(); } - - const T & curr() const { return *(*this); } - T & curr() { return *(*this); } - void next() { (*this)++; } - - virtual Iterator *new_copy() const = 0; - virtual ~Iterator() {} -}; - - -// A generator is like an iterator but it gives out values, -// which may or may not exist in some writable collection - -template class Generator { -public: - virtual T operator*() const = 0; - - virtual void operator++(int) = 0; - virtual void operator++() = 0; - - virtual int live() const = 0; - operator int() const { return live(); } - - const T curr() const { return *(*this); } - T curr() { return *(*this); } - void next() { (*this)++; } -}; - - - -// Delegate to any kind of iterator (on the heap) -// If created via a reference, become a copy of the iterator -// If created via a pointer, manipulate that pointer and free *p when this dies -// -// Mostly useful for Collection::iterator -// Iterator::Iterator(Collection) - - -template class Any_Iterator : public Iterator { -public: - Any_Iterator(Collection &c); - Any_Iterator(const Iterator &i); // copy of i - - virtual ~Any_Iterator() { delete me; } - - Any_Iterator &operator=(const Any_Iterator &rhs) - { delete me; me = rhs.me->new_copy(); return *this; } - - const T & operator*() const { return *(*me); } - T & operator*() { return *(*me); } - void operator++(int) { (*me)++; } - void operator++() { ++(*me); } - bool live() const { return (*me).live(); } - - Iterator *new_copy() const { return new Any_Iterator((*me).new_copy()); } - -private: - Any_Iterator(Iterator *p) // take over *p, *p MUST BE ON THE HEAP - { me = p; } - friend class Collection; -#if 0 - // Couldn't make this work with g++258 - friend Any_Iterator Collection::any_iterator(); -#endif - Iterator *me; -}; - -template inline Any_Iterator::Any_Iterator(Collection &c) - { - me = c.new_iterator(); - } - -template inline Any_Iterator::Any_Iterator(const Iterator &i) - { - me = i.new_copy(); - } - -} // namespace - -#define instantiate_Iterator(T) template class Iterator; -#define instantiate_Generator(T) template class Generator; -#define instantiate_Any_Iterator(T) template class Any_Iterator; \ - instantiate_Iterator(T) - -#endif diff --git a/omega/basic/include/basic/Link.h b/omega/basic/include/basic/Link.h deleted file mode 100644 index ede7a2b..0000000 --- a/omega/basic/include/basic/Link.h +++ /dev/null @@ -1,98 +0,0 @@ -#if ! defined _Link_h -#define _Link_h 1 - -#include -#include - -namespace omega { - -// By default, if ndebug is not set, do not do free list - -#if ! defined ListElementFreeList -#if ! defined NDEBUG || defined ASSERTIONS_ANYWAY -#define ListElementFreeList 0 -#else -#define ListElementFreeList 1 -#endif -#endif - -/* - List_Element: one item in a list and the pointer to the next. - Each such object should be pointed to by either exactly one - other List_Element or by some other pointer(s), exactly one - of which will delete the List_Element. - ListElements should ONLY be allocated on the heap. - */ - -#if ListElementFreeList - // g++ 2.5.8 does not allow static data in template classes, so... - extern void *kludgy_List_Element_new(size_t size); - extern void kludgy_List_Element_delete(void *ptr, size_t size); -#endif - -template class List_Element { -public: -#if ListElementFreeList - void *operator new(size_t size) - { - return kludgy_List_Element_new(size); - } - void operator delete(void *ptr, size_t size) - { - kludgy_List_Element_delete(ptr, size); - } -#endif - - T head; - List_Element *tail; - - List_Element() { - tail = 0; - } - List_Element(T h, List_Element * t) { - head = h; - tail = t; - } - List_Element(const List_Element & L) { - head = L.head; - if (L.tail) tail = new List_Element(*L.tail); - else tail = 0; - } - List_Element & operator=(const List_Element &L) { - if (this != &L) { - head = L.head; - if (tail) delete tail; - if (L.tail) tail = new List_Element(*L.tail); - else tail = 0; - } - return *this; - } - virtual ~List_Element() { // virtual ensures 2nd arg of delete is right - delete tail; - } -}; - - - -template class List_Element_Iterator : public Iterator { -public: - List_Element_Iterator(List_Element* j) { i = j; } - virtual const T & operator*() const { return i->head; } - virtual T & operator*() { return i->head; } - virtual void operator++(int) { i = i->tail; } - virtual void operator++() { i = i->tail; } - virtual bool live() const { return i != 0; } - Iterator * new_copy() const { return new List_Element_Iterator(i);} - -protected: - List_Element *i; -}; - -} // namespace - -#define instantiate_Only_List_Element(T) template class List_Element; \ - template class List_Element_Iterator; -#define instantiate_List_Element(T) instantiate_Only_List_Element(T)\ - instantiate_Collection(T) - -#endif diff --git a/omega/basic/include/basic/List.c b/omega/basic/include/basic/List.c deleted file mode 100644 index f05e0de..0000000 --- a/omega/basic/include/basic/List.c +++ /dev/null @@ -1,149 +0,0 @@ -#include - -namespace omega { - -template List_Iterator::List_Iterator(List &l) -: List_Element_Iterator(l.contents) {} - -template List_Iterator::List_Iterator(const List &l) -: List_Element_Iterator(l.contents) {} - -template List_Iterator::List_Iterator() -: List_Element_Iterator(0) {} - -template Iterator *List::new_iterator() -{ - return new List_Iterator(*this); -} - -template const T &List::operator[](int i) const -{ - assert(i > 0 && "Subscript out of bounds"); - List_Iterator p(*this); - - while(--i > 0 && p) - p++; - - if (p) - return *p; - else - return *((T *)0); -} - -template T &List::operator[](int i) -{ - assert(i > 0 && "Subscript out of bounds"); - List_Iterator p(*this); - - while(--i > 0 && p) - p++; - - if (p) - return *p; - else - return *((T *)0); -} - -template int List::index(const T &item) const -{ - List_Iterator p(*this); - int i = 1; - - while(p && *p != item) - { - p++; - i++; - } - - if (p) - return i; - else - return 0; -} - -template int List::size() const - { - int i = 0; - List_Element * p = contents; - while (p) - { - p = p->tail; - i++; - } - return i; - } - -template T &List::front() const - { - return contents->head; - } - -template T List::remove_front() - { - List_Element *frunt = contents; - contents = contents->tail; - T fruntT = frunt->head; - frunt->tail = 0; - delete frunt; - return fruntT; - } - -template void List::prepend(const T &item) - { - contents = new List_Element(item, contents); - } - - -template void List::append(const T &item) - { - *(end()) = new List_Element(item, 0); - } - -template void List::ins_after(List_Iterator i, - const T &item) - { -#if ! defined NDEBUG - for (List_Element *e = contents; e != &(i.element()); e=e->tail) - { - assert(e); - } -#endif - i.element().tail = new List_Element(item, i.element().tail); - } - -template void List::del_front() - { - List_Element *e = contents; - contents = contents->tail; - e->tail = 0; - delete e; - } - -template void List::del_after(List_Iterator i) - { -#if ! defined NDEBUG - for (List_Element *e0 = contents; e0 != &(i.element()); e0=e0->tail) - { - assert(e0); - } -#endif - List_Element *e = i.element().tail; - i.element().tail = e->tail; - e->tail = 0; - delete e; - } - -template void List::clear() - { - delete contents; - contents = 0; - } - -template void List::join(List &consumed) - { - List_Element *e = consumed.contents; - consumed.contents = 0; - *(end()) = e; - } - -} // namespace diff --git a/omega/basic/include/basic/List.h b/omega/basic/include/basic/List.h deleted file mode 100644 index c6fc062..0000000 --- a/omega/basic/include/basic/List.h +++ /dev/null @@ -1,95 +0,0 @@ -#if ! defined _List_h -#define _List_h 1 - -/* - * Linked lists with an interface like a bit of libg++'s SLList class - */ - - -#if 0 -#include /* List requires assert which needs Exit which */ -#endif /* needs List! just include assert in List.c */ -#include // for NULL -#include -#include -#include - -namespace omega { - -template class List_Iterator; - -// -// indexing of Lists starts at 1, index == 0 means not there -// - -template class List : public Sequence { -public: - List(const List &l) - { contents = l.contents ? new List_Element(*l.contents) : 0; } - List() { contents = 0; } - virtual ~List() { delete contents; } - - Iterator *new_iterator(); - const T &operator[](int) const; - T &operator[](int); - - int index(const T &) const; - - int size() const; - int length() const { return size(); } - bool empty() const { return size() == 0; } - - T &front() const; - -// insertion/deletion on a list invalidates any iterators -// that are on/after the element added/removed - - T remove_front(); - - void prepend(const T &item); - void append(const T &item); - void ins_after(List_Iterator i, const T &item); - - void del_front(); - void del_after(List_Iterator i); - void clear(); - - void join(List &consumed); - -private: - friend class List_Iterator; - List_Element **end() - { - List_Element **e = &contents; - while (*e) - e = &((*e)->tail); - return e; - } - - List_Element *contents; -}; - - -template class List_Iterator : public List_Element_Iterator { -public: - List_Iterator(List &l); - List_Iterator(const List &l); - List_Iterator(); -private: - List_Element &element() { return *List_Element_Iterator::i; } ; - friend class List; -}; - -} // namespace - -#if ! defined DONT_INCLUDE_TEMPLATE_CODE -#include -#endif - -#define instantiate_List(T) template class List; \ - template class List_Iterator; \ - instantiate_Only_List_Element(T) \ - instantiate_Sequence(T) - - -#endif diff --git a/omega/basic/include/basic/Map.c b/omega/basic/include/basic/Map.c deleted file mode 100644 index 69cc3f7..0000000 --- a/omega/basic/include/basic/Map.c +++ /dev/null @@ -1,63 +0,0 @@ -namespace omega { - -template MapElement:: MapElement(const MapElement& M) { - if (M.tail) tail = new MapElement(*M.tail); - else tail = 0; - k = M.k; - v = M.v; - } - -template MapElement & - MapElement:: operator=(const MapElement& M) { - if (this != &M) { - if (tail) delete tail; - if (M.tail) tail = new MapElement(*M.tail); - else tail = 0; - k = M.k; - v = M.v; - } - return *this; - } - - - - -#if ! defined linux -template Map ::Map(const V &default_value) -#else -template Map ::Map(V default_value) -#endif - : _default_value(default_value) - { - contents = 0; - } - -template Map ::~Map() - { - delete contents; - } - -template V Map::operator()(K k) const { - MapElement * P = contents; - while (P) { - if (P->k == k) return P->v; - P = P->tail; - }; - return _default_value; - } - -template V & Map::operator[](K k) { - MapElement * P = contents; - while (P) { - if (P->k == k) return P->v; - P = P->tail; - }; - P = new MapElement ; - P->k = k; - P->v = _default_value; - P->tail = contents; - contents = P; - return P->v; - } - -} // namespace diff --git a/omega/basic/include/basic/Map.h b/omega/basic/include/basic/Map.h deleted file mode 100644 index f94a10c..0000000 --- a/omega/basic/include/basic/Map.h +++ /dev/null @@ -1,68 +0,0 @@ -#if ! defined _Map_h -#define _Map_h 1 - -#include -#include // for NULL - -namespace omega { - -#define foreach_map(k,K,v,V,M,A) {for (omega::MapElementIterator __M_##k = (M).iterator();__M_##k;__M_##k++) {K & k = *__M_##k; V & v = __M_##k.value(); A;}} - -template class MapElement { -public: - K k; - V v; - MapElement *tail; - MapElement(const MapElement&); - MapElement() {} - MapElement & operator=(const MapElement&); - ~MapElement() { delete tail; } -}; - -template class MapElementIterator { -public: - MapElementIterator(MapElement* j) { i = j;} - virtual const K & operator*() const { return i->k; } - virtual K & operator*() { return i->k;} - virtual const V & value() const { return i->v; } - virtual V & value() { return i->v; } - virtual void operator++(int) { i = i->tail; } - virtual void operator++() { i = i->tail; } - virtual bool live() const { return i != NULL; } - operator bool() const { return live(); } -protected: -MapElement *i; -}; - -template class Map { -public: -#if ! defined linux - Map(const V &default_value); -#else - // work around for '386 g++ on Linux - Map(V default_value); -#endif - ~Map(); - MapElementIterator iterator() - {return MapElementIterator(contents);} - int empty() const {return contents == NULL;} - V operator()(K) const; - V& operator[](K); -private: - MapElement * contents; - V _default_value; -}; - -} // namespace - -#if ! defined DONT_INCLUDE_TEMPLATE_CODE -#include -#endif - -#define instantiate_Map(T1,T2) template class Map; \ - template class MapElement; \ - template class MapElementIterator; -#define instantiate_MapElement(T1,T2) instantiate_Map(T1,T2) -#define instantiate_MapElementIterator(T1,T2) instantiate_Map(T1,T2) - -#endif diff --git a/omega/basic/include/basic/Section.c b/omega/basic/include/basic/Section.c deleted file mode 100644 index 754e002..0000000 --- a/omega/basic/include/basic/Section.c +++ /dev/null @@ -1,79 +0,0 @@ -#include - -namespace omega { - -template Section::Section(Sequence *s, int start, int length) - { - assert(s->size() >= start-1 + length); - it = s; - _start = start; - _length = length; - } - -template Iterator *Section::new_iterator() - { - return new Section_Iterator(*this); - } - -template const T &Section::operator[](int i) const - { - assert(1 <= i && i <= size()); - return (*it)[i+(_start-1)]; - } - -template T &Section::operator[](int i) - { - assert(1 <= i && i <= size()); - return (*it)[i+(_start-1)]; - } - -template int Section::index(const T &var) const - { - int i; - for (i=1; i<=size(); i++) - if ((*this)[i] == var) - return i; - return 0; - } - -template int Section::size() const - { - return _length; - } - - -template Section_Iterator::Section_Iterator(Section &sec) - { - it = sec.it->new_iterator(); - for (int i = 1; i < sec._start; i++) - (*it)++; - remaining = sec.size(); - } - - -template Section_Iterator::Section_Iterator(const Section_Iterator &si) : it(si.it), remaining(si.remaining) {} - - -template void Section_Iterator::operator++() - { this->operator++(0); } - -template void Section_Iterator::operator++(int) - { - if (remaining > 0) - { - (*it)++; - remaining--; - } - } - -template bool Section_Iterator::live() const - { - return (remaining > 0); - } - -template Iterator *Section_Iterator::new_copy() const - { - return new Section_Iterator(*this); - } - -} // namespace diff --git a/omega/basic/include/basic/Section.h b/omega/basic/include/basic/Section.h deleted file mode 100644 index 60821d1..0000000 --- a/omega/basic/include/basic/Section.h +++ /dev/null @@ -1,63 +0,0 @@ -#if ! defined _Section_h -#define _Section_h 1 -/* - Section of an existing collection viewed as a collection - */ - -#include - -namespace omega { - -template class Section_Iterator; - -template class Section : public Sequence { -public: - Section(Sequence *, int start, int length); - - Iterator *new_iterator(); - - const T &operator[](int) const; - T &operator[](int); - - int index(const T &) const; - int size() const; - - friend class Section_Iterator; - -private: - Sequence *it; - int _start, _length; -}; - -template class Section_Iterator : public Iterator { -public: - Section_Iterator(Section &sec); - virtual ~Section_Iterator() { delete it; } - - const T & operator*() const { return *(*it); } - T & operator*() { return *(*it); } - - void operator++(int); - void operator++(); - - bool live() const; - Iterator *new_copy() const; - -private: - Section_Iterator(const Section_Iterator &si); - Iterator *it; - int remaining; -}; - -} // namespace - -#if ! defined DONT_INCLUDE_TEMPLATE_CODE -#include -#endif - -#define instantiate_Section(T) template class Section; \ - template class Section_Iterator; \ - instantiate_Sequence(T) -#define instantiate_Section_Iterator(T) instantiate_Section(T) - -#endif diff --git a/omega/basic/include/basic/SimpleList.c b/omega/basic/include/basic/SimpleList.c deleted file mode 100644 index da7de9b..0000000 --- a/omega/basic/include/basic/SimpleList.c +++ /dev/null @@ -1,105 +0,0 @@ -namespace omega { - -template Simple_List_Iterator::Simple_List_Iterator(Simple_List &l) -: List_Element_Iterator(l.contents) {} - -template Simple_List_Iterator::Simple_List_Iterator(const Simple_List &l) -: List_Element_Iterator(l.contents) {} - -template Simple_List_Iterator::Simple_List_Iterator() -: List_Element_Iterator(0) {} - -template Iterator *Simple_List::new_iterator() -{ - return new Simple_List_Iterator(*this); -} - -template const T &Simple_List::operator[](int i) const -{ - Simple_List_Iterator p(*this); - - while(--i > 0 && p) - p++; - - if (p) - return *p; - else - return *((T *)0); -} - -template T &Simple_List::operator[](int i) -{ - Simple_List_Iterator p(*this); - - while(--i > 0 && p) - p++; - - if (p) - return *p; - else - return *((T *)0); -} - - -template int Simple_List::size() const - { - int i = 0; - List_Element * p = contents; - while (p) - { - p = p->tail; - i++; - } - return i; - } - -template T &Simple_List::front() const - { - return contents->head; - } - -template T Simple_List::remove_front() - { - List_Element *frunt = contents; - contents = contents->tail; - T fruntT = frunt->head; - frunt->tail = 0; - delete frunt; - return fruntT; - } - -template void Simple_List::prepend(const T &item) - { - contents = new List_Element(item, contents); - } - - -template void Simple_List::append(const T &item) - { - *(end()) = new List_Element(item, 0); - } - - -template void Simple_List::del_front() - { - List_Element *e = contents; - contents = contents->tail; - e->tail = 0; - delete e; - } - - -template void Simple_List::clear() - { - delete contents; - contents = 0; - } - -template void Simple_List::join(Simple_List &consumed) - { - List_Element *e = consumed.contents; - consumed.contents = 0; - *(end()) = e; - } - -} // namespace diff --git a/omega/basic/include/basic/SimpleList.h b/omega/basic/include/basic/SimpleList.h deleted file mode 100644 index a08b307..0000000 --- a/omega/basic/include/basic/SimpleList.h +++ /dev/null @@ -1,93 +0,0 @@ -#if ! defined _Simple_List_h -#define _Simple_List_h 1 - -/* - * Linked lists with an interface like a bit of libg++'s SLSimple_List class - */ - -#include -#include -#include -#include - -namespace omega { - -#define Simple_List Omega_Simple_List -#define Simple_List_Iterator Omega_Simple_List_Iterator - -template class Simple_List_Iterator; - -// A TEMPORARY HACK - ERROR IF YOU TRY TO USE "INDEX" - FERD - -template class Simple_List : public Sequence { -public: - Simple_List(const Simple_List &l) - { contents = l.contents ? new List_Element(*l.contents) : 0; } - Simple_List() { contents = 0; } - virtual ~Simple_List() { delete contents; } - - Iterator *new_iterator(); - const T &operator[](int) const; - T &operator[](int); - - - int size() const; - int length() const { return size(); } - int empty() const { return size() == 0; } - - T &front() const; - -// insertion/deletion on a list invalidates any iterators -// that are on/after the element added/removed - - T remove_front(); - - void prepend(const T &item); - void append(const T &item); - - void del_front(); - void clear(); - - void join(Simple_List &consumed); - - int index(const T &) const { - assert(0&&"ILLEGAL SimpleList operation\n"); - return -1; - } - -private: - friend class Simple_List_Iterator; - List_Element **end() - { - List_Element **e = &contents; - while (*e) - e = &((*e)->tail); - return e; - } - - List_Element *contents; -}; - - -template class Simple_List_Iterator : public List_Element_Iterator { -public: - Simple_List_Iterator(Simple_List &l); - Simple_List_Iterator(const Simple_List &l); - Simple_List_Iterator(); -private: - List_Element &element() { return *this->i; } ; - friend class Simple_List; -}; - -} // namespace - -#if ! defined DONT_INCLUDE_TEMPLATE_CODE -#include -#endif - -#define instantiate_Simple_List(T) template class Simple_List; \ - template class Simple_List_Iterator; \ - instantiate_Only_List_Element(T) \ - instantiate_Sequence(T) - -#endif diff --git a/omega/basic/include/basic/Tuple.c b/omega/basic/include/basic/Tuple.c deleted file mode 100644 index ce99e82..0000000 --- a/omega/basic/include/basic/Tuple.c +++ /dev/null @@ -1,254 +0,0 @@ -/* class Tuple */ - -// THESE FIRST TWO REALLY SHOULD BE INLINE BUT IT BREAKS CFRONT: - -namespace omega { - -template T &Tuple::operator[](int index) - { - assert(1 <= index && index <= sz); return data[index-1]; - } - -template const T &Tuple::operator[](int index) const - { - assert(1 <= index && index <= sz); return data[index-1]; - } - - -template Tuple::~Tuple() - { - if (data) - delete [] data; - } - -template Tuple::Tuple() : sz(0), alloc_sz(0), - prealloc_min(20),prealloc_pad(5), data(0) -{ - // nothing needs be done - } - -template Tuple::Tuple(int size) : sz(size), - prealloc_min(20),prealloc_pad(5) -{ - if (sz > 0) - { - alloc_sz = prealloc_size(sz); - data = new T[alloc_sz]; - assert(alloc_sz >= sz); - //Need some handling for out of memory. - assert (data!=0); - } - else { - alloc_sz = 0; - data = 0; - } -} - - -template Tuple::Tuple(const Tuple& t) - : sz(t.sz), alloc_sz(t.alloc_sz), prealloc_min(20),prealloc_pad(5) -{ - if (sz > 0) { - data = new T[alloc_sz]; - assert (data!=0); - assert (alloc_sz >= sz); - for (int i=0; i Tuple& Tuple::operator=(const Tuple& t) -{ - if (this != &t) { // Delete this - if (data) - delete [] data; - sz = t.sz; - alloc_sz = t.alloc_sz; - assert(alloc_sz >= sz); - if (sz > 0) { // Copy old - data = new T[alloc_sz]; - assert (data!=0); - for (int i=0; i void Tuple::reallocate(const int req_size) -{ - if (alloc_sz >= req_size) { // if (sz >= req_size), does this. - sz = req_size; - return; - } - alloc_sz = prealloc_size(req_size); - T* tmp_data = new T[alloc_sz]; - for(int i=0;i= req_size); -} - -template void Tuple::delete_last() -{ -assert(sz > 0); -sz --; -} - -template void Tuple::append(const T &v) -{ - // Check if reallocation is necessary. - if (sz == 0) { // Empty Tuple - assert(alloc_sz >= 0); // May be nonzero for cleared tuple - - if(alloc_sz == 0) { // If it's > 1 no allocation is necessary - alloc_sz = prealloc_size(1); - data = new T[alloc_sz]; - } - assert (alloc_sz > 0 && data != 0); - } else { - if(sz == alloc_sz) { // Requires new allocation - alloc_sz = realloc_size(alloc_sz); - T * data_tmp = new T[alloc_sz]; - assert (data_tmp!=0); - assert (alloc_sz > sz); - for (int i=0; i= sz); - data[sz++] = v; -} - -template void Tuple::append(const Tuple& t) { - int old_sz = sz; - reallocate(t.size()+size()); - assert(alloc_sz >= sz); - for(int i=0; i void Tuple::join(Tuple& t) { - int old_sz = sz; - reallocate(t.size()+size()); - assert(alloc_sz >= sz); - for(int i=0; i void Tuple::clear() { if (sz) delete [] data; data = 0; alloc_sz = 0; sz = 0; } - -template int Tuple::empty() const { return (sz == 0); } - -template Iterator *Tuple::new_iterator() -{ - return new Tuple_Iterator(*this); -} - -template int Tuple::index(const T & var) const -/* returns index or 0 if var isn't in the tuple */ -{ - int i; - for (i=0; i bool Tuple::operator == (const Tuple& b) const -{ - int i; - if (sz != b.size()) return false; - for (i=0; i Tuple_Iterator::Tuple_Iterator(const Tuple &tpl) : -current(tpl.data), lastptr(tpl.data+tpl.sz-1), firstptr(tpl.data), sz(tpl.sz) -{ -} - -template Tuple_Iterator::Tuple_Iterator(T * cr, T *frst, T * lst, - int insz) - : current(cr), lastptr(lst), firstptr(frst), sz(insz) -{ -} - -template const T & Tuple_Iterator::operator*() const -{ - assert (current<=lastptr && current>=firstptr); - return *current; -} - -template T & Tuple_Iterator::operator*() -{ - assert (current<=lastptr && current >=firstptr); - return *current; -} - -template void Tuple_Iterator::operator++(int) -{ - current++; -} - -template void Tuple_Iterator::operator++() -{ - current++; -} - -template void Tuple_Iterator::operator--(int) -{ - current--; -} - -template void Tuple_Iterator::operator--() -{ - current--; -} - -template void Tuple_Iterator::set_to_last() -{ - current = lastptr; -} - -template void Tuple_Iterator::set_to_first() -{ - current = firstptr; -} - -template void Tuple_Iterator::set_position(const int req_pos) -{ - assert(req_pos <= sz && 1 <= req_pos); - current = firstptr + (req_pos - 1); -} - - -template bool Tuple_Iterator::live() const -{ - return (current !=0 && current<=lastptr && current >= firstptr); -} - -template Iterator *Tuple_Iterator::new_copy() const { - return new Tuple_Iterator(current, firstptr, lastptr, sz); -} - -} // namespace diff --git a/omega/basic/include/basic/Tuple.h b/omega/basic/include/basic/Tuple.h deleted file mode 100644 index 28e83bd..0000000 --- a/omega/basic/include/basic/Tuple.h +++ /dev/null @@ -1,90 +0,0 @@ -#if !defined _Already_defined_tuple -#define _Already_defined_tuple - -#include - -#include -#include -#include - -namespace omega { - -template class Tuple_Iterator; - -// TUPLES ARE INDEXED STARTING AT 1 -// index\(i\) == 0 MEANS i IS NOT IN THE TUPLE - -template class Tuple : public Sequence { -public: - Tuple(); - Tuple(int size); - Tuple (const Tuple& tpl); - virtual ~Tuple(); - Tuple& operator=(const Tuple& tpl); - int size() const { return sz; } - int length() const { return sz; } - bool operator==(const Tuple &b) const; - void reallocate(const int); - void delete_last(); - void append(const Tuple &v); - void append(const T &v); - void join(Tuple &v); - void clear(); - int empty() const; - - Iterator *new_iterator(); - - virtual T &operator[](int index); - virtual const T &operator[](int index) const; - - int index(const T &) const; - - friend class Tuple_Iterator; - -private: - int prealloc_size(const int req_size) - { return max(req_size+prealloc_pad,prealloc_min); } - int realloc_size(const int oldsize) { return 2*oldsize; } - - - int sz, alloc_sz; // Number of elements, size of allocated array - int prealloc_min,prealloc_pad; // These should be static, but that - // causes portability prob. for initialization - -protected: - T * data; -}; - -template class Tuple_Iterator : public Iterator { -public: - Tuple_Iterator(const Tuple &tpl); - const T & operator*() const; - T & operator*(); - void set_position(const int req_pos); - void operator++(int); - void operator++(); - void operator--(int); - void operator--(); - void set_to_last(); - void set_to_first(); -// void set_position(const int req_pos); Don't do this, compiler bug - bool live() const; - Iterator *new_copy() const; - -private: - Tuple_Iterator(T * cr, T * frst, T *lst, int insz); - T * current, * lastptr, *firstptr; - int sz; -}; - -} // namespace - -#if ! defined DONT_INCLUDE_TEMPLATE_CODE -#include -#endif - -#define instantiate_Tuple(T) template class Tuple; \ - template class Tuple_Iterator; \ - instantiate_Sequence(T) - -#endif diff --git a/omega/basic/include/basic/boolset-test.cc b/omega/basic/include/basic/boolset-test.cc deleted file mode 100755 index 5b68220..0000000 --- a/omega/basic/include/basic/boolset-test.cc +++ /dev/null @@ -1,72 +0,0 @@ -#include "boolset.h" -#include - -using namespace omega; - -void foo(const BoolSet<> &B) { - for (BoolSet<>::const_iterator i = B.begin(); i != B.end(); i++) - std::cout << *i << ' '; - std::cout << std::endl; -} - -int main() { - BoolSet<> A(13); - - A.set(2); - std::cout << A << std::endl; - - A.set_all(); - std::cout << A << std::endl; - - A.unset_all(); - std::cout << A << std::endl; - - A.set(2); - A.set(4); - - BoolSet<> B(13); - B.set(2); - - std::cout << "A: " << A << std::endl; - std::cout << "B: " << B << std::endl; - - std::cout << A.imply(B) << std::endl; - std::cout << B.imply(A) << std::endl; - - B.set(10); - std::cout << (A|B) << std::endl; - std::cout << (A&B) << std::endl; - - BoolSet<> C(3); - C.set(0); - std::cout << (A|C) << std::endl; - std::cout << ~(A|C) << std::endl; - - B = BoolSet<>(23); - std::cout << "test iterator\n"; - B.set(12); - B.set(11); - B.set(0); - std::cout << B << std::endl; - for (BoolSet<>::const_iterator i = B.begin(); i != B.end(); i++) { - std::cout << *i << ' '; - if (*i == 11) - B.unset(*i); - } - std::cout << std::endl; - std::cout << B << std::endl; - std::cout << std::endl; - foo(B); - - std::cout << ~BoolSet<>(5) << std::endl; - - std::cout << "------\n"; - B.dump(); - std::cout << std::endl << *(B.begin()+1) << std::endl; - - for (BoolSet<>::iterator i = B.begin(); i != B.end(); i++) - for (BoolSet<>::iterator j = i; j != B.end(); j++) - if (j == i) - std::cout << "ehh-"; - -} diff --git a/omega/basic/include/basic/boolset.h b/omega/basic/include/basic/boolset.h deleted file mode 100755 index dc9ef83..0000000 --- a/omega/basic/include/basic/boolset.h +++ /dev/null @@ -1,637 +0,0 @@ -/***************************************************************************** - Copyright (C) 2009-2011 Chun Chen - All Rights Reserved. - - Purpose: - BoolSet class, used as a set of integers from 0..n-1 where n is a very - small integer. - - Notes: - Set operands of binary operations can be of different sizes, missing - elements are treated as false. - - History: - 03/30/09 Created by Chun Chen. - 03/26/11 iterator added, -chun -*****************************************************************************/ - -#ifndef _BOOLSET_H -#define _BOOLSET_H - -#include -#include -#include -#include -#include - -namespace omega { - -template -class BoolSet { -protected: - unsigned int size_; - std::vector set_; - -public: - BoolSet(unsigned int size = 0); - ~BoolSet() {} - - void set(unsigned int); - void unset(unsigned int); - void set_all(); - void unset_all(); - bool get(unsigned int) const; - unsigned int size() const {return size_;} - unsigned int num_elem() const; - bool imply(const BoolSet &) const; - bool empty() const; - void dump() const; - - BoolSet &operator|=(const BoolSet &); - BoolSet &operator&=(const BoolSet &); - BoolSet &operator-=(const BoolSet &); - - template friend BoolSet operator|(const BoolSet &, const BoolSet &); // union - template friend BoolSet operator&(const BoolSet &, const BoolSet &); // intersection - template friend BoolSet operator-(const BoolSet &, const BoolSet &); // difference - template friend BoolSet operator~(const BoolSet &); // complement - template friend bool operator==(const BoolSet &, const BoolSet &); - template friend bool operator!=(const BoolSet &, const BoolSet &); - template friend std::ostream& operator<<(std::ostream &, const BoolSet &); - template friend bool operator<(const BoolSet &, const BoolSet &); - -// iterator related -public: - class iterator; - class const_iterator; - iterator begin(); - iterator end(); - const_iterator begin() const; - const_iterator end() const; -}; - - -template -BoolSet::BoolSet(unsigned int size) { - assert(size >= 0); - size_ = size; - unsigned int n = size / (sizeof(T)*8); - unsigned int r = size % (sizeof(T)*8); - if (r != 0) - n++; - set_ = std::vector(n, static_cast(0)); -} - - -template -void BoolSet::set(unsigned int i) { - assert(i < size_ && i >= 0); - unsigned int n = i / (sizeof(T)*8); - unsigned int r = i % (sizeof(T)*8); - - T t = static_cast(1) << r; - set_[n] |= t; -} - - -template -void BoolSet::unset(unsigned int i) { - assert(i < size_ && i >= 0); - unsigned int n = i / (sizeof(T)*8); - unsigned int r = i % (sizeof(T)*8); - - T t = static_cast(1) << r; - t = ~t; - set_[n] &= t; -} - - -template -void BoolSet::set_all() { - unsigned int r = size_ % (sizeof(T)*8); - if (r == 0) { - for (unsigned int i = 0; i < set_.size(); i++) - set_[i] = ~static_cast(0); - } - else { - for (unsigned int i = 0; i < set_.size()-1; i++) - set_[i] = ~static_cast(0); - set_[set_.size()-1] = static_cast(0); - T t = static_cast(1); - for (unsigned int i = 0; i < r; i++) { - set_[set_.size()-1] |= t; - t = t<<1; - } - } -} - - -template -void BoolSet::unset_all() { - for (unsigned int i = 0; i < set_.size(); i++) - set_[i] = static_cast(0); -} - - -template -bool BoolSet::get(unsigned int i) const { - assert(i < size_ && i >= 0); - unsigned int n = i / (sizeof(T)*8); - unsigned int r = i % (sizeof(T)*8); - - T t = static_cast(1) << r; - t = set_[n] & t; - if (t) - return true; - else - return false; -} - - -template -unsigned int BoolSet::num_elem() const { - unsigned int n = size_; - unsigned int c = 0; - unsigned int p = 0; - while (n != 0) { - unsigned int m; - if (n >= sizeof(T)*8) { - m = sizeof(T)*8; - n -= sizeof(T)*8; - } - else { - m = n; - n = 0; - } - - T v = set_[p++]; - if (v != static_cast(0)) { - for (unsigned int i = 0; i < m; i++) { - if (v & static_cast(1)) - c++; - v >>= 1; - } - } - } - - return c; -} - - -template -bool BoolSet::imply(const BoolSet &b) const { - if (size_ >= b.size_) { - for (unsigned int i = 0; i < b.set_.size(); i++) - if ((set_[i] & b.set_[i]) != b.set_[i]) - return false; - } - else { - for (unsigned int i = 0; i < set_.size(); i++) - if ((set_[i] & b.set_[i]) != b.set_[i]) - return false; - for (unsigned int i = set_.size(); i < b.set_.size(); i++) - if (b.set_[i] != static_cast(0)) - return false; - } - - return true; -} - - -template -bool BoolSet::empty() const { - for (int i = 0; i < set_.size(); i++) - if (set_[i] != static_cast(0)) - return false; - - return true; -} - - -template -void BoolSet::dump() const { - int j = 1; - for (unsigned int i = 0; i < size(); i++) { - if (get(i)) - std::cout << '1'; - else - std::cout << '0'; - if (j%10 == 0 && i != size() - 1) { - std::cout << ' '; - j = 1; - } - else - j++; - } - std::cout << std::endl; - std::cout.flush(); -} - - -template -BoolSet operator|(const BoolSet &a, const BoolSet &b) { - if (a.size_ >= b.size_) { - BoolSet c = a; - for (unsigned int i = 0; i < b.set_.size(); i++) - c.set_[i] |= b.set_[i]; - return c; - } - else { - BoolSet c = b; - for (unsigned int i = 0; i < a.set_.size(); i++) - c.set_[i] |= a.set_[i]; - return c; - } -} - - -template -BoolSet operator&(const BoolSet &a, const BoolSet &b) { - if (a.size_ >= b.size_) { - BoolSet c = a; - for (unsigned int i = 0; i < b.set_.size(); i++) - c.set_[i] &= b.set_[i]; - for (unsigned int i = b.set_.size(); i < a.set_.size(); i++) - c.set_[i] = static_cast(0); - return c; - } - else { - BoolSet c = b; - for (unsigned int i = 0; i < a.set_.size(); i++) - c.set_[i] &= a.set_[i]; - for (unsigned int i = a.set_.size(); i < b.set_.size(); i++) - c.set_[i] = static_cast(0); - return c; - } -} - - -template -BoolSet operator-(const BoolSet &a, const BoolSet &b) { - BoolSet c(a.size_); - - int sz = a.set_.size(); - if (sz > b.set_.size()) - sz = b.set_.size(); - for (int i = 0; i < sz; i++) - c.set_[i] = a.set_[i] ^ (a.set_[i] & b.set_[i]); - for (int i = sz; i < a.set_.size(); i++) - c.set_[i] = a.set_[i]; - - return c; -} - - -template -BoolSet operator~(const BoolSet &b) { - unsigned int r = b.size_ % (sizeof(T)*8); - BoolSet a(b.size_); - for (unsigned int i = 0; i < b.set_.size(); i++) - a.set_[i] = ~b.set_[i]; - - if (r != 0) { - T t = static_cast(1); - for (unsigned int i = 1; i < r; i++) - t = (t << 1) | static_cast(1); - a.set_[a.set_.size()-1] &= t; - } - return a; -} - - -template -bool operator==(const BoolSet &a, const BoolSet &b) { - return (a.size_ == b.size_) && (a.set_ == b.set_); -} - - -template -bool operator!=(const BoolSet &a, const BoolSet &b) { - return !(a == b); -} - - - -template -BoolSet & BoolSet::operator|=(const BoolSet &b) { - *this = *this | b; - return *this; -} - - -template -BoolSet & BoolSet::operator&=(const BoolSet &b) { - *this = *this & b; - return *this; -} - - -template -BoolSet & BoolSet::operator-=(const BoolSet &b) { - *this = *this - b; - return *this; -} - - -template -std::ostream& operator<<(std::ostream &os, const BoolSet &b) { - os << '{'; - for (typename BoolSet::const_iterator i = b.begin(); i != b.end(); i++) { - os << *i; - if (i+1 != b.end()) - os << ','; - } - os << '}'; - - return os; -} - - -template -bool operator<(const BoolSet &a, const BoolSet &b) { - unsigned int t1, t2; - t1 = a.num_elem(); - t2 = b.num_elem(); - if (t1 < t2) - return true; - else if (t1 > t2) - return false; - else { - t1 = a.size(); - t2 = b.size(); - if (t1 < t2) - return true; - else if (t1 > t2) - return false; - else - for (unsigned int i = 0; i < a.set_.size(); i++) - if (a.set_[i] < b.set_[i]) - return true; - } - return false; -} - - -// -// iterator for BoolSet -// - -template -typename BoolSet::iterator BoolSet::begin() { - typename BoolSet::iterator it(this, 0); - if (size_ == 0) - return it; - else if (set_[0] & static_cast(1)) - return it; - else - return ++it; -} - - -template -typename BoolSet::iterator BoolSet::end() { - return typename BoolSet::iterator(this, size_); -} - - -template -typename BoolSet::const_iterator BoolSet::begin() const { - typename BoolSet::const_iterator it(this, 0); - if (size_ == 0) - return it; - else if (set_[0] & static_cast(1)) - return it; - else - return ++it; -} - - -template -typename BoolSet::const_iterator BoolSet::end() const { - return typename BoolSet::const_iterator(this, size_); -} - - -template -class BoolSet::iterator: public std::iterator { -protected: - BoolSet *s_; - unsigned int pos_; - -protected: - iterator(BoolSet *s, unsigned int pos) { s_ = s; pos_ = pos; } - -public: - ~iterator() {} - - typename BoolSet::iterator &operator++(); - typename BoolSet::iterator operator++(int); - typename BoolSet::iterator operator+(int) const; - unsigned int operator*() const; - bool operator==(const BoolSet::iterator &) const; - bool operator!=(const BoolSet::iterator &) const; - operator typename BoolSet::const_iterator(); - - friend class BoolSet; -}; - - -template -typename BoolSet::iterator &BoolSet::iterator::operator++() { - assert(pos_ < s_->size_); - - pos_++; - unsigned int n = pos_ / (sizeof(T)*8); - unsigned int r = pos_ % (sizeof(T)*8); - while (pos_ < s_->size_) { - if (s_->set_[n] == static_cast(0)) { - pos_ += sizeof(T)*8-r; - n++; - r = 0; - if (pos_ >= s_->size_) - break; - } - - if (r == 0) { - while (pos_ < s_->size_) { - if (s_->set_[n] == static_cast(0)) { - pos_ += sizeof(T)*8; - n++; - } - else - break; - } - if (pos_ >= s_->size_) - break; - } - - for (unsigned int i = r; i < sizeof(T)*8; i++) - if (s_->set_[n] & static_cast(1) << i) { - pos_ = pos_+i-r; - return *this; - } - - pos_ += sizeof(T)*8-r; - n++; - r = 0; - } - - pos_ = s_->size_; - return *this; -} - - -template -typename BoolSet::iterator BoolSet::iterator::operator++(int) { - typename BoolSet::iterator it(*this); - ++(*this); - return it; -} - - -template -typename BoolSet::iterator BoolSet::iterator::operator+(int n) const { - assert(n >= 0); - typename BoolSet::iterator it(*this); - while (n > 0) { - ++it; - --n; - } - return it; -} - - -template -unsigned int BoolSet::iterator::operator*() const { - assert(pos_ < s_->size_); - return pos_; -} - - -template -bool BoolSet::iterator::operator==(const BoolSet::iterator &other) const { - return s_ == other.s_ && pos_ == other.pos_; -} - - -template -bool BoolSet::iterator::operator!=(const BoolSet::iterator &other) const { - return !((*this) == other); -} - - -template -BoolSet::iterator::operator typename BoolSet::const_iterator() { - return BoolSet::const_iterator(s_, pos_); -} - - -template -class BoolSet::const_iterator: public std::iterator { -protected: - const BoolSet *s_; - unsigned int pos_; - -protected: - const_iterator(const BoolSet *s, unsigned int pos) { s_ = s; pos_ = pos; } - -public: - ~const_iterator() {} - - typename BoolSet::const_iterator &operator++(); - typename BoolSet::const_iterator operator++(int); - typename BoolSet::const_iterator operator+(int) const; - unsigned int operator*() const; - bool operator==(const BoolSet::const_iterator &) const; - bool operator!=(const BoolSet::const_iterator &) const; - - friend class BoolSet; -}; - - -template -typename BoolSet::const_iterator &BoolSet::const_iterator::operator++() { - assert(pos_ < s_->size_); - - pos_++; - unsigned int n = pos_ / (sizeof(T)*8); - unsigned int r = pos_ % (sizeof(T)*8); - while (pos_ < s_->size_) { - if (s_->set_[n] == static_cast(0)) { - pos_ += sizeof(T)*8-r; - n++; - r = 0; - if (pos_ >= s_->size_) - break; - } - - if (r == 0) { - while (pos_ < s_->size_) { - if (s_->set_[n] == static_cast(0)) { - pos_ += sizeof(T)*8; - n++; - } - else - break; - } - if (pos_ >= s_->size_) - break; - } - - for (unsigned int i = r; i < sizeof(T)*8; i++) - if (s_->set_[n] & static_cast(1) << i) { - pos_ = pos_+i-r; - return *this; - } - - pos_ += sizeof(T)*8-r; - n++; - r = 0; - } - - pos_ = s_->size_; - return *this; -} - - -template -typename BoolSet::const_iterator BoolSet::const_iterator::operator++(int) { - typename BoolSet::const_iterator it(*this); - ++(*this); - return it; -} - - -template -typename BoolSet::const_iterator BoolSet::const_iterator::operator+(int n) const { - assert(n >= 0); - typename BoolSet::const_iterator it(*this); - while (n > 0) { - ++it; - --n; - } - return it; -} - - -template -unsigned int BoolSet::const_iterator::operator*() const { - assert(pos_ < s_->size_); - return pos_; -} - - -template -bool BoolSet::const_iterator::operator==(const BoolSet::const_iterator &other) const { - return s_ == other.s_ && pos_ == other.pos_; -} - - -template -bool BoolSet::const_iterator::operator!=(const BoolSet::const_iterator &other) const { - return !((*this) == other); -} - -} - -#endif diff --git a/omega/basic/include/basic/omega_error.h b/omega/basic/include/basic/omega_error.h deleted file mode 100644 index e342efb..0000000 --- a/omega/basic/include/basic/omega_error.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef OMEGA_ERROR_H -#define OMEGA_ERROR_H - -namespace omega { - -struct presburger_error: public std::runtime_error { - presburger_error(const std::string &msg): std::runtime_error("presburger error: " + msg) {} -}; - - - -} -#endif - diff --git a/omega/basic/include/basic/util.h b/omega/basic/include/basic/util.h deleted file mode 100644 index 4e807cd..0000000 --- a/omega/basic/include/basic/util.h +++ /dev/null @@ -1,263 +0,0 @@ -#if ! defined Already_Included_Util -#define Already_Included_Util - -#include -#include -#include -#include -#include -#include - -namespace omega { - -#define LONG_LONG_COEF 1 - -#if LONG_LONG_COEF -#if defined BOGUS_LONG_DOUBLE_COEF -typedef long double coef_t; // type of coefficients -#define coef_fmt "%llf" -#define posInfinity (1e+24) -#define negInfinity (-1e+24) -#else -#ifdef WIN32 -typedef _int64 coef_t; // type of coefficients -#else -typedef long long coef_t; -#endif -#define coef_fmt "%lld" -#define posInfinity (0x7ffffffffffffffLL) -#define negInfinity (-0x7ffffffffffffffLL) -#endif -#else -typedef int coef_t; // type of coefficients -#define coef_fmt "%d" -#define posInfinity (0x7ffffff) -#define negInfinity (-0x7ffffff) -#endif - - -template inline const T& max(const T &x, const T &y) { - if (x >= y) return x; else return y; -} - - -template inline const T& max(const T &x, const T &y, const T &z) { - return max(x, max(y, z)); -} - -template inline const T& min(const T &x, const T &y) { - if (x <= y) return x; else return y; -} - -template inline const T& min(const T &x, const T &y, const T &z) { - return min(x, min(y, z)); -} - -template inline void set_max(T &m, const T &x) { - if (m < x) m = x; -} - -template inline void set_min(T &m, const T &x) { - if (m > x) m = x; -} - -/* template inline void swap(T &i, T &j) { */ -/* T tmp; */ -/* tmp = i; */ -/* i = j; */ -/* j = tmp; */ -/* } */ - -/* template inline T copy(const T &t) { return t; } */ - - -/* inline coef_t check_pos_mul(coef_t x, coef_t y) { */ -/* if (y >= 48051280 && y < posInfinity) */ -/* fprintf(stderr, "%d %d\n", x, y); */ -/* /\* #if !defined NDEBUG *\/ */ -/* /\* if (x != 0) *\/ */ -/* /\* assert(((MAXINT)/4) / x > y); *\/ */ -/* /\* #elif defined STILL_CHECK_MULT *\/ */ -/* /\* if (x != 0 && !(((MAXINT)/4) / x > y)) { *\/ */ -/* /\* assert(0&&"Integer overflow during multiplication (util.h)"); *\/ */ -/* /\* } *\/ */ -/* /\* #endif *\/ */ -/* #if !defined NDEBUG */ -/* if (x != 0 && y != 0) */ -/* assert(x*y > 0); */ -/* #elif defined STILL_CHECK_MULT */ -/* if (x != 0 && y != 0 && x*y < 0) */ -/* assert(0&&"Integer overflow during multiplication (util.h)"); */ -/* #endif */ -/* return x * y; */ -/* } */ - - -/* inline int */ -/* check_pos_mul(int x, int y) { */ -/* #if !defined NDEBUG */ -/* if (x != 0) */ -/* assert(((posInfinity)/4) / x > y); */ -/* #elif defined STILL_CHECK_MULT */ -/* if (x != 0 && !(((posInfinity)/4) / x > y)) { */ -/* assert(0&&"Integer overflow during multiplication (util.h)"); */ -/* } */ -/* #endif */ -/* return x * y; */ -/* } */ - -/* inline LONGLONG */ -/* check_pos_mul(LONGLONG x, LONGLONG y) { */ -/* #if !defined NDEBUG */ -/* if (x != 0) */ -/* assert(((posInfinity)/4) / x > y); */ -/* #elif defined STILL_CHECK_MULT */ -/* if (x != 0 && !(((posInfinity)/4) / x > y)) { */ -/* assert(0&&"Integer overflow during multiplication (util.h)"); */ -/* } */ -/* #endif */ -/* return x * y; */ -/* } */ - -/* inline LONGLONG abs(LONGLONG c) { return (c>=0?c:(-c)); } */ - -template inline T check_mul(const T &x, const T &y) { -#if defined NDEBUG && ! defined STILL_CHECK_MULT - return x*y; -#else - if (x == 0 || y == 0) - return 0; - - T z = x*y; - int sign_x = (x>0)?1:-1; - int sign_y = (y>0)?1:-1; - int sign_z = (z>0)?1:-1; - - if (sign_x * sign_y != sign_z) - throw std::overflow_error("coefficient multiply overflow"); - - return z; - - /* if (x > 0) { */ - /* if (y > 0) { */ - /* assert(x*y > 0); */ - /* } */ - /* else */ - /* assert(x*y < 0); */ - /* } */ - /* else { */ - /* if (y > 0) */ - /* assert(x*y < 0); */ - /* else */ - /* assert(x*y > 0); */ - /* } */ - /* return x*y; */ -#endif -} - -template inline T abs(const T &v) { - return (v >= static_cast(0))?v:-v; -} - -template inline T int_div(const T &a, const T &b) { - T result; - assert(b > 0); - if (a>0) result = a/b; - else result = -((-a+b-1)/b); - return result; -} - -template inline T int_mod(const T &a, const T &b) { - return a-b*int_div(a,b); -} - -template inline T int_mod_hat(const T &a, const T &b) { - T r; - assert(b > 0); - r = a-b*int_div(a,b); - if (r > -(r-b)) r -= b; - return r; -} - -template inline T gcd(T b, T a) {/* First argument is non-negative */ - assert(a >= 0); - assert(b >= 0); - if (b == 1) - return (1); - while (b != 0) { - T t = b; - b = a % b; - a = t; - } - return (a); -} - -template inline T lcm(T b, T a) { /* First argument is non-negative */ - assert(a >= 0); - assert(b >= 0); - return check_mul(a/gcd(a,b), b); -} - -template T square_root(const T &n, T precision = 1) { - T guess = 1; - - while (true) { - T next_guess = 0.5*(guess+n/guess); - if (abs(next_guess-guess) <= precision) - return next_guess; - else - guess = next_guess; - } -} - -template T factor(const T &n) { - assert(n >= 0); - if (n == 1) return 1; - - static int prime[30] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113}; - - if (n <= 113*113) { - for (int i = 0; i < 30; i++) - if (n % static_cast(prime[i]) == 0) - return static_cast(prime[i]); - - return n; - } - - T i = 1; - T k = 2; - T x = static_cast(rand())%n; - T y = x; - while(i < square_root(n, 1)) { - i++; - x = (x*x-1) % n; - T d = gcd(abs(y-x), n); - if(d != 1 && d != n) - return factor(d); - if(i == k) { - y = x; - k *= 2; - } - } - return n; -} - -/* #define implies(A,B) (A==(A&B)) */ - -template std::string to_string(const T &t) { - std::ostringstream ss; - ss << t; - return ss.str(); -} - -template T from_string(const std::string &s) { - std::istringstream ss(s); - ss.exceptions(std::ios::failbit); - T t; - ss >> t; - return t; -} - -} // namespace - -#endif diff --git a/omega/basic/src/ConstString.cc b/omega/basic/src/ConstString.cc deleted file mode 100644 index 7d2ec1e..0000000 --- a/omega/basic/src/ConstString.cc +++ /dev/null @@ -1,134 +0,0 @@ -#include -#include -#include -#include -#include -#include - -/* static const int CS_HashTable_Size = 1000; */ -/* static ConstStringRep *hashTable[CS_HashTable_Size] = {0}; */ - -namespace omega { - -const int CS_HashTable_Size = 1000; -class CS_HashTable { -public: - ConstStringRep *p[CS_HashTable_Size]; - CS_HashTable(); - ~CS_HashTable(); -}; - -namespace { - CS_HashTable hashTable; -} - -CS_HashTable::CS_HashTable() { - for (int i = 0; i < CS_HashTable_Size; i++) - p[i] = NULL; - } - -CS_HashTable::~CS_HashTable() { - for (int i = 0; i < CS_HashTable_Size; i++) { - ConstStringRep *t = p[i]; - while (t != NULL) { - ConstStringRep *tt = t->nextInBucket; - delete []t->name; - delete t; - t = tt; - } - } -} - -Const_String::Const_String() { - rep = 0; -} - -void Const_String::buildRep(const char* t) { - int hash = 0; - const char *s = t; - while (*s != '\0') - hash = hash*33 + *s++; - int hashBucket = hash % CS_HashTable_Size; - if (hashBucket < 0) hashBucket += CS_HashTable_Size; - assert(0 <= hashBucket && hashBucket < CS_HashTable_Size); - ConstStringRep **q = &(hashTable.p[hashBucket]); - ConstStringRep *p = *q; - while (p != 0) { - if (strcmp(p->name,t) == 0) break; - q = &p->nextInBucket; - p = *q; - } - if (p!= 0) rep = p; - else { - rep = new ConstStringRep(t); - *q = rep; - } -} - -Const_String::Const_String(const char * t) { - buildRep(t); -} - -Const_String::Const_String(const std::string &s) { - buildRep(s.c_str()); -} - -Const_String::operator const char*() const { - if (!rep) return 0; - return rep->name; -} - -Const_String::operator std::string() const { - if (!rep) return std::string(""); - return std::string(rep->name); -} - -int Const_String::operator++(int) { - return rep->count++; -} - -int Const_String::operator++() { - return ++rep->count; -} - -int Const_String:: operator--(int) { - return rep->count--; -} - -int Const_String:: operator--() { - return --rep->count; -} - -int operator ==(const Const_String &x, const Const_String &y) { - return x.rep == y.rep; -} - -int operator !=(const Const_String &x, const Const_String &y) { - return x.rep != y.rep; -} - -int operator <(const Const_String &x, const Const_String &y) { - return (strcmp(x.rep->name,y.rep->name) < 0); -} - -int operator >(const Const_String &x, const Const_String &y) { - return (strcmp(x.rep->name,y.rep->name) > 0); -} - -Const_String:: operator int() const { - return rep != 0; -} - -int Const_String::null() const { - return rep == 0; -} - -ConstStringRep:: ConstStringRep(const char *t) { - count = 0; - nextInBucket = 0; - char *s = new char[1+strlen(t)]; - strcpy(s,t); - name = s; -} - -} // namespace diff --git a/omega/basic/src/Link.cc b/omega/basic/src/Link.cc deleted file mode 100644 index 50b9441..0000000 --- a/omega/basic/src/Link.cc +++ /dev/null @@ -1,41 +0,0 @@ -#include - -namespace omega { - -#if ListElementFreeList - static List_Element *_kludgy_List_Element_free_list_pointer; -// we rely on the fact that that is initialized to 0 before any -// constructor-based initialization that could call List_Element::new. - - void *kludgy_List_Element_new(size_t size) - { - void *mem; - if (size == sizeof(List_Element) && - _kludgy_List_Element_free_list_pointer) - { - List_Element *it = _kludgy_List_Element_free_list_pointer; - _kludgy_List_Element_free_list_pointer = it->tail; - mem = it; - } - else - mem = ::operator new(size); - - return mem; - } - - void kludgy_List_Element_delete(void *ptr, size_t size) - { - if (ptr) - if (size == sizeof(List_Element)) - { - List_Element *it = (List_Element *) ptr; - it->tail = _kludgy_List_Element_free_list_pointer; - _kludgy_List_Element_free_list_pointer = it; - } - else - ::operator delete(ptr); - } - -#endif - -} // namespace diff --git a/omega/code_gen/include/code_gen/CG.h b/omega/code_gen/include/code_gen/CG.h deleted file mode 100644 index 4054d82..0000000 --- a/omega/code_gen/include/code_gen/CG.h +++ /dev/null @@ -1,118 +0,0 @@ -#ifndef _CG_H -#define _CG_H - -#include -#include -#include -#include - -namespace omega { - -class CodeGen; - -struct CG_result { - CodeGen *codegen_; - BoolSet<> active_; - - CG_result() { codegen_ = NULL; } - virtual ~CG_result() { /* not responsible for codegen_ */ } - - virtual CG_result *recompute(const BoolSet<> &parent_active, const Relation &known, const Relation &restriction) = 0; - virtual int populateDepth() = 0; - virtual std::pair liftOverhead(int depth, bool propagate_up) = 0; - virtual Relation hoistGuard() = 0; - virtual void removeGuard(const Relation &guard) = 0; - virtual CG_outputRepr *printRepr(int indent, CG_outputBuilder *ocg, const std::vector &stmts, const std::vector > &assigned_on_the_fly) const = 0; - CG_outputRepr *printRepr(CG_outputBuilder *ocg, const std::vector &stmts) const; - std::string printString() const; - int num_level() const; - virtual CG_result *clone() const = 0; - virtual void dump(int indent) const {} - void dump() { dump(0); } -}; - - -struct CG_split: public CG_result { - std::vector restrictions_; - std::vector clauses_; - - CG_split(CodeGen *codegen, const BoolSet<> &active, const std::vector &restrictions, const std::vector &clauses) { - codegen_ = codegen; - active_ = active; - restrictions_ = restrictions; - clauses_ = clauses; - } - ~CG_split() { - for (int i = 0; i < clauses_.size(); i++) - delete clauses_[i]; - } - - CG_result *recompute(const BoolSet<> &parent_active, const Relation &known, const Relation &restriction); - int populateDepth(); - std::pair liftOverhead(int depth, bool propagate_up); - Relation hoistGuard(); - void removeGuard(const Relation &guard); - CG_outputRepr *printRepr(int indent, CG_outputBuilder *ocg, const std::vector &stmts, const std::vector > &assigned_on_the_fly) const; - CG_result *clone() const; - void dump(int indent) const; - -private: - std::vector findNextLevel() const; -}; - - -struct CG_loop: public CG_result { - int level_; - CG_result *body_; - - Relation known_; - Relation restriction_; - Relation bounds_; - Relation guard_; - bool needLoop_; - int depth_; - - CG_loop(CodeGen *codegen, const BoolSet<> &active, int level, CG_result *body) { - codegen_ = codegen; - active_ = active; - level_ = level; - body_ = body; - } - ~CG_loop() { delete body_; } - - CG_result *recompute(const BoolSet<> &parent_active, const Relation &known, const Relation &restriction); - int populateDepth(); - std::pair liftOverhead(int depth, bool propagate_up); - Relation hoistGuard(); - void removeGuard(const Relation &guard); - CG_outputRepr *printRepr(int indent, CG_outputBuilder *ocg, const std::vector &stmts, const std::vector > &assigned_on_the_fly) const; - CG_outputRepr *printRepr(bool do_print_guard, int indent, CG_outputBuilder *ocg, const std::vector &stmts, const std::vector > &assigned_on_the_fly) const; - CG_result *clone() const; - void dump(int indent) const; -}; - - - -struct CG_leaf: public CG_result { - Relation known_; - std::map guards_; - - CG_leaf(CodeGen *codegen, const BoolSet<> &active) { - codegen_ = codegen; - active_ = active; - } - ~CG_leaf() {} - - CG_result *recompute(const BoolSet<> &parent_active, const Relation &known, const Relation &restriction); - int populateDepth() { return 0; } - std::pair liftOverhead(int depth, bool propagate_up); - Relation hoistGuard(); - void removeGuard(const Relation &guard); - CG_outputRepr *printRepr(int indent, CG_outputBuilder *ocg, const std::vector &stmts, const std::vector > &assigned_on_the_fly) const; - CG_result *clone() const; - void dump(int indent) const; -}; - -} - -#endif diff --git a/omega/code_gen/include/code_gen/CG_outputBuilder.h b/omega/code_gen/include/code_gen/CG_outputBuilder.h deleted file mode 100644 index 2203235..0000000 --- a/omega/code_gen/include/code_gen/CG_outputBuilder.h +++ /dev/null @@ -1,177 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 the Omega Project Team - Copyright (C) 2005-2011 Chun Chen - All Rights Reserved. - - Purpose: - abstract base class of comiler IR code builder - - Notes: - All "CG_outputRepr *" parameters are consumed inside the the function - unless explicitly stated otherwise, i.e., not valid after the call. - Parameter "indent" normally not used except it is used in unstructured - string output for correct indentation. - - History: - 04/17/96 created - Lei Zhou - 05/02/08 clarify integer floor/mod/ceil definitions, -chen - 05/31/08 use virtual clone to implement CreateCopy, -chun - 08/05/10 clarify NULL parameter allowance, -chun -*****************************************************************************/ - -#ifndef _CG_OUTPUTBUILDER_H -#define _CG_OUTPUTBUILDER_H - -#include - -#include -#include - -namespace omega { - -class CG_outputBuilder { -public: - CG_outputBuilder() {} - virtual ~CG_outputBuilder() {} - - //--------------------------------------------------------------------------- - // substitute variables in stmt - //--------------------------------------------------------------------------- - virtual CG_outputRepr *CreateSubstitutedStmt(int indent, CG_outputRepr *stmt, - const std::vector &vars, - std::vector &subs) const = 0; - - //--------------------------------------------------------------------------- - // assignment stmt generation - //--------------------------------------------------------------------------- - virtual CG_outputRepr *CreateAssignment(int indent, CG_outputRepr *lhs, - CG_outputRepr *rhs) const = 0; - - //--------------------------------------------------------------------------- - // function invocation generation - //--------------------------------------------------------------------------- - virtual CG_outputRepr *CreateInvoke(const std::string &funcName, - std::vector &argList) const = 0; - - //--------------------------------------------------------------------------- - // comment generation - //--------------------------------------------------------------------------- - virtual CG_outputRepr *CreateComment(int indent, - const std::string &commentText) const = 0; - - //--------------------------------------------------------------------------- - // Attribute generation - //--------------------------------------------------------------------------- - virtual CG_outputRepr* CreateAttribute(CG_outputRepr *control, - const std::string &commentText) const = 0; - //--------------------------------------------------------------------------- - // Pragma Attribute - // -------------------------------------------------------------------------- - virtual CG_outputRepr* CreatePragmaAttribute(CG_outputRepr *scopeStmt, int looplevel, const std::string &pragmaText) const = 0; - - //--------------------------------------------------------------------------- - // Prefetch Attribute - //--------------------------------------------------------------------------- - virtual CG_outputRepr* CreatePrefetchAttribute(CG_outputRepr *scopeStmt, int looplevel, const std::string &arrName, int hint) const = 0; - - //--------------------------------------------------------------------------- - // generate if stmt, true/false stmt can be NULL but not the condition - //--------------------------------------------------------------------------- - virtual CG_outputRepr *CreateIf(int indent, CG_outputRepr *guardCondition, - CG_outputRepr *true_stmtList, - CG_outputRepr *false_stmtList) const = 0; - - //--------------------------------------------------------------------------- - // generate loop inductive variable (loop control structure) - //--------------------------------------------------------------------------- - virtual CG_outputRepr *CreateInductive(CG_outputRepr *index, - CG_outputRepr *lower, - CG_outputRepr *upper, - CG_outputRepr *step) const = 0; - - //--------------------------------------------------------------------------- - // generate loop stmt from loop control and loop body, NULL parameter allowed - //--------------------------------------------------------------------------- - virtual CG_outputRepr *CreateLoop(int indent, CG_outputRepr *control, - CG_outputRepr *stmtList) const = 0; - - //--------------------------------------------------------------------------- - // copy operation, NULL parameter allowed. this function makes pointer - // handling uniform regardless NULL status - //--------------------------------------------------------------------------- - virtual CG_outputRepr *CreateCopy(CG_outputRepr *original) const { - if (original == NULL) - return NULL; - else - return original->clone(); - } - - //--------------------------------------------------------------------------- - // basic integer number creation - //--------------------------------------------------------------------------- - virtual CG_outputRepr *CreateInt(int num) const = 0; - virtual bool isInteger(CG_outputRepr *op) const = 0; - - - //--------------------------------------------------------------------------- - // basic identity/variable creation - //--------------------------------------------------------------------------- - virtual CG_outputRepr *CreateIdent(const std::string &varName) const = 0; - - //--------------------------------------------------------------------------- - // binary arithmetic operations, NULL parameter means 0, - // Note: - // integer division truncation method undefined, only use when lop is known - // to be multiple of rop, otherwise use integer floor instead - //--------------------------------------------------------------------------- - virtual CG_outputRepr *CreatePlus(CG_outputRepr *lop, CG_outputRepr *rop) const = 0; - virtual CG_outputRepr *CreateMinus(CG_outputRepr *lop, CG_outputRepr *rop) const = 0; - virtual CG_outputRepr *CreateTimes(CG_outputRepr *lop, CG_outputRepr *rop) const = 0; - virtual CG_outputRepr *CreateDivide(CG_outputRepr *lop, CG_outputRepr *rop) const { - return CreateIntegerFloor(lop, rop); - } - - //--------------------------------------------------------------------------- - // integer arithmetic functions, NULL parameter means 0, second parameter - // must be postive (i.e. b > 0 below), otherwise function undefined - // Note: - // ceil(a, b) = -floor(-a, b) or floor(a+b-1, b) or floor(a-1, b)+1 - // mod(a, b) = a-b*floor(a, b) - // where result must lie in range [0,b) - // floor(a, b) = a/b if a >= 0 - // (a-b+1)/b if a < 0 - // where native '/' operator behaves as 5/2 = 2, (-5)/2 = -2 - //--------------------------------------------------------------------------- - virtual CG_outputRepr *CreateIntegerFloor(CG_outputRepr *lop, CG_outputRepr *rop) const = 0; - virtual CG_outputRepr *CreateIntegerMod(CG_outputRepr *lop, CG_outputRepr *rop) const { - CG_outputRepr *lop2 = CreateCopy(lop); - CG_outputRepr *rop2 = CreateCopy(rop); - return CreateMinus(lop2, CreateTimes(rop2, CreateIntegerFloor(lop, rop))); - } - virtual CG_outputRepr *CreateIntegerCeil(CG_outputRepr *lop, CG_outputRepr *rop) const { - return CreateMinus(NULL, CreateIntegerFloor(CreateMinus(NULL, lop), rop)); - } - - //--------------------------------------------------------------------------- - // binary logical operation, NULL parameter means TRUE - //--------------------------------------------------------------------------- - virtual CG_outputRepr *CreateAnd(CG_outputRepr *lop, CG_outputRepr *rop) const = 0; - - //--------------------------------------------------------------------------- - // binary condition operations - //--------------------------------------------------------------------------- - virtual CG_outputRepr *CreateGE(CG_outputRepr *lop, CG_outputRepr *rop) const { - return CreateLE(rop, lop); - } - virtual CG_outputRepr *CreateLE(CG_outputRepr *lop, CG_outputRepr *rop) const = 0; - virtual CG_outputRepr *CreateEQ(CG_outputRepr *lop, CG_outputRepr *rop) const = 0; - - //--------------------------------------------------------------------------- - // join stmts together, NULL parameter allowed - //--------------------------------------------------------------------------- - virtual CG_outputRepr *StmtListAppend(CG_outputRepr *list1, CG_outputRepr *list2) const = 0; -}; - -} - -#endif diff --git a/omega/code_gen/include/code_gen/CG_outputRepr.h b/omega/code_gen/include/code_gen/CG_outputRepr.h deleted file mode 100644 index 92f3d9f..0000000 --- a/omega/code_gen/include/code_gen/CG_outputRepr.h +++ /dev/null @@ -1,31 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 the Omega Project Team - Copyright (C) 2005-2011 Chun Chen - All Rights Reserved. - - Purpose: - abstract base class of compiler IR code wrapper - - Notes: - - History: - 04/17/96 - Lei Zhou - created -*****************************************************************************/ - -#ifndef _CG_OUTPUTREPR_H -#define _CG_OUTPUTREPR_H - -namespace omega { - -class CG_outputRepr { -public: - CG_outputRepr() {} - virtual ~CG_outputRepr() { /* shallow delete */ } - virtual CG_outputRepr *clone() const = 0; - virtual void clear() { /* delete actual IR code wrapped inside */ } - virtual void dump() const {} -}; - -} - -#endif diff --git a/omega/code_gen/include/code_gen/CG_roseBuilder.h b/omega/code_gen/include/code_gen/CG_roseBuilder.h deleted file mode 100644 index 93b708e..0000000 --- a/omega/code_gen/include/code_gen/CG_roseBuilder.h +++ /dev/null @@ -1,164 +0,0 @@ -#ifndef CG_roseBuilder_h -#define CG_roseBuilder_h - -#include -#include -#include -#include -#include - -namespace omega { - -class CG_roseBuilder : public CG_outputBuilder { -public: - CG_roseBuilder(int isFortran, SgGlobal* global, SgGlobal* global_scope, SgSymbolTable* symtab1, SgSymbolTable* symtab2, SgNode* root); - ~CG_roseBuilder(); - - //--------------------------------------------------------------------------- - // place holder generation - //--------------------------------------------------------------------------- - // CG_outputRepr* CreatePlaceHolder(int indent, CG_outputRepr *stmt, - // Tuple &funcList, - // Tuple &loop_vars) const; - - - //--------------------------------------------------------------------------- - // substitute variables in stmt - //--------------------------------------------------------------------------- - - - - CG_outputRepr *CreateSubstitutedStmt(int indent, CG_outputRepr *stmt, - const std::vector &vars, - std::vector &subs) const; - - - - //--------------------------------------------------------------------------- - // assignment generation - //--------------------------------------------------------------------------- - CG_outputRepr* CreateAssignment(int indent, CG_outputRepr* lhs, - CG_outputRepr* rhs) const; - - //--------------------------------------------------------------------------- - // function invocation generation - //--------------------------------------------------------------------------- - CG_outputRepr* CreateInvoke(const std::string &funcName, - std::vector &argList) const; - - //--------------------------------------------------------------------------- - // comment generation - //--------------------------------------------------------------------------- - CG_outputRepr* CreateComment(int indent, const std::string &commentText) const; - //--------------------------------------------------------------------------- - // Attribute generation - //--------------------------------------------------------------------------- - CG_outputRepr* CreateAttribute(CG_outputRepr *control, - const std::string &commentText) const; - //--------------------------------------------------------------------------- - // Pragma Attribute - //--------------------------------------------------------------------------- - CG_outputRepr* CreatePragmaAttribute(CG_outputRepr *scopeStmt, int looplevel, - const std::string &pragmaText) const; - - //--------------------------------------------------------------------------- - // Prefetch Attribute - //--------------------------------------------------------------------------- - CG_outputRepr* CreatePrefetchAttribute(CG_outputRepr *scopeStmt, int looplevel, - const std::string &arrName, int hint) const; - - //--------------------------------------------------------------------------- - // if stmt gen operations - //--------------------------------------------------------------------------- - CG_outputRepr* CreateIf(int indent, CG_outputRepr* guardCondition, - CG_outputRepr* true_stmtList, CG_outputRepr* false_stmtList) const; - - //--------------------------------------------------------------------------- - // inductive variable generation, to be used in CreateLoop as control - //--------------------------------------------------------------------------- - CG_outputRepr* CreateInductive(CG_outputRepr* index, - CG_outputRepr* lower, - CG_outputRepr* upper, - CG_outputRepr* step) const; - - //--------------------------------------------------------------------------- - // loop stmt generation - //--------------------------------------------------------------------------- - CG_outputRepr* CreateLoop(int indent, CG_outputRepr* control, - CG_outputRepr* stmtList) const; - - //--------------------------------------------------------------------------- - // basic operations - //--------------------------------------------------------------------------- - CG_outputRepr* CreateInt(int num ) const; - bool isInteger(CG_outputRepr *op) const; - CG_outputRepr* CreateIdent(const std::string &varName) const; - - //--------------------------------------------------------------------------- - // binary arithmetic operations - //--------------------------------------------------------------------------- - CG_outputRepr* CreatePlus(CG_outputRepr* lop, CG_outputRepr* rop) const; - CG_outputRepr* CreateMinus(CG_outputRepr* lop, CG_outputRepr* rop) const; - CG_outputRepr* CreateTimes(CG_outputRepr* lop, CG_outputRepr* rop) const; - CG_outputRepr* CreateIntegerFloor(CG_outputRepr* lop, CG_outputRepr* rop) const; - CG_outputRepr* CreateIntegerMod(CG_outputRepr* lop, CG_outputRepr* rop) const; - - //--------------------------------------------------------------------------- - // binary logical operations - //--------------------------------------------------------------------------- - CG_outputRepr* CreateAnd(CG_outputRepr* lop, CG_outputRepr* rop) const; - - //--------------------------------------------------------------------------- - // binary relational operations - //--------------------------------------------------------------------------- - // CG_outputRepr* CreateGE(CG_outputRepr*, CG_outputRepr*) const; - CG_outputRepr* CreateLE(CG_outputRepr* lop, CG_outputRepr* rop) const; - CG_outputRepr* CreateEQ(CG_outputRepr* lop, CG_outputRepr* rop) const; - - //--------------------------------------------------------------------------- - // stmt list gen operations - //--------------------------------------------------------------------------- - // CG_outputRepr* - // CreateStmtList(CG_outputRepr *singleton = NULL) const; - // CG_outputRepr* - // StmtListInsertLast(CG_outputRepr* list, CG_outputRepr* node) const; - CG_outputRepr* - StmtListAppend(CG_outputRepr* list1, CG_outputRepr* list2) const; - - //CG_outputRepr* CreateDim3(const char* varName, int arg1, int arg2) const; - CG_outputRepr* CreateDim3(const char* varName, CG_outputRepr* arg1, CG_outputRepr* arg2, CG_outputRepr* arg3 = NULL) const; - - // Manu:: added for fortran support - bool isInputFortran() const; - - //--------------------------------------------------------------------------- - // kernel generation - //--------------------------------------------------------------------------- - // CG_outputRepr* CreateKernel(immed_list* iml) const; - - //--------------------------------------------------------------------------- - // Add a modifier to a type (for things like __global__) - //--------------------------------------------------------------------------- - //type_node* ModifyType(type_node* base, const char* modifier) const; - - -private: - SgSymbolTable *symtab_; - SgSymbolTable *symtab2_; - SgNode* root_; - SgGlobal* global_; - SgGlobal* global_scope; - int isFortran; // Manu:: added for fortran support -}; - -extern char *k_ocg_comment; - //bool substitute(SgExpression *in, SgVariableSymbol *sym, SgExpression *expr, SgNode* root, SgExpression* parent); - //bool substitute(SgStatement *tn, SgVariableSymbol *sym, SgExpression* expr, SgNode* root, SgSymbolTable* symtab); -std::vectorsubstitute(SgNode *tnl, const SgVariableSymbol *sym, SgExpression *expr,SgNode* root) ; - - - - -} // namespace - -#endif diff --git a/omega/code_gen/include/code_gen/CG_roseRepr.h b/omega/code_gen/include/code_gen/CG_roseRepr.h deleted file mode 100644 index 4861db7..0000000 --- a/omega/code_gen/include/code_gen/CG_roseRepr.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef CG_roseRepr_h -#define CG_roseRepr_h - -#include -#include "rose.h" - -namespace omega { - -class CG_roseRepr : public CG_outputRepr { - friend class CG_roseBuilder; -public: - CG_roseRepr(); - CG_roseRepr(SgNode *tnl); - CG_roseRepr(SgExpression *exp); - CG_roseRepr(SgStatementPtrList* stmtlist); - - ~CG_roseRepr(); - CG_outputRepr *clone() const; - void clear(); - - SgNode* GetCode() const; - SgStatementPtrList* GetList() const; - SgExpression *GetExpression() const; - - - - - //--------------------------------------------------------------------------- - // Dump operations - //--------------------------------------------------------------------------- - void Dump() const; - //void DumpToFile(FILE *fp = stderr) const; -private: - // only one of _tnl and _op would be active at any time, depending on - // whether it is building a statement list or an expression tree - SgNode *tnl_; - SgExpression *op_; - SgStatementPtrList *list_; - void DumpFileHelper(SgNode* node, FILE* fp) const; - //operand op_; -}; - - - -} // namespace - -#endif diff --git a/omega/code_gen/include/code_gen/CG_stringBuilder.h b/omega/code_gen/include/code_gen/CG_stringBuilder.h deleted file mode 100644 index 09d3503..0000000 --- a/omega/code_gen/include/code_gen/CG_stringBuilder.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef _CG_STRINGBUILDER_H -#define _CG_STRINGBUILDER_H - -#include -#include - -namespace omega { - -class CG_stringBuilder: public CG_outputBuilder { -public: - CG_stringBuilder() {} - ~CG_stringBuilder() {} - bool isInteger(CG_outputRepr *op) const; - CG_stringRepr *CreateSubstitutedStmt(int indent, CG_outputRepr *stmt, const std::vector &vars, std::vector &subs) const; - CG_stringRepr *CreateAssignment(int indent, CG_outputRepr *lhs, CG_outputRepr *rhs) const; - CG_stringRepr *CreateInvoke(const std::string &funcName, std::vector &argList) const; - CG_stringRepr *CreateComment(int indent, const std::string &commentText) const; - CG_stringRepr* CreateAttribute(CG_outputRepr *control, - const std::string &commentText) const; - CG_outputRepr *CreatePragmaAttribute(CG_outputRepr *scopeStmt, int looplevel, const std::string &pragmaText) const; - CG_outputRepr *CreatePrefetchAttribute(CG_outputRepr *scopeStmt, int looplevel, const std::string &arrName, int hint) const; - CG_stringRepr *CreateIf(int indent, CG_outputRepr *guardCondition, CG_outputRepr *true_stmtList, CG_outputRepr *false_stmtList) const; - CG_stringRepr *CreateInductive(CG_outputRepr *index, CG_outputRepr *lower, CG_outputRepr *upper, CG_outputRepr *step) const; - CG_stringRepr *CreateLoop(int indent, CG_outputRepr *control, CG_outputRepr *stmtList) const; - CG_stringRepr *CreateInt(int num) const; - CG_stringRepr *CreateIdent(const std::string &varName) const; - CG_stringRepr *CreatePlus(CG_outputRepr *lop, CG_outputRepr *rop) const; - CG_stringRepr *CreateMinus(CG_outputRepr *lop, CG_outputRepr *rop) const; - CG_stringRepr *CreateTimes(CG_outputRepr *lop, CG_outputRepr *rop) const; - CG_stringRepr *CreateDivide(CG_outputRepr *lop, CG_outputRepr *rop) const; - CG_stringRepr *CreateIntegerFloor(CG_outputRepr *lop, CG_outputRepr *rop) const; - CG_stringRepr *CreateIntegerMod(CG_outputRepr *lop, CG_outputRepr *rop) const; - CG_stringRepr *CreateIntegerCeil(CG_outputRepr *lop, CG_outputRepr *rop) const; - CG_stringRepr *CreateAnd(CG_outputRepr *lop, CG_outputRepr *rop) const; - CG_stringRepr *CreateGE(CG_outputRepr *lop, CG_outputRepr *rop) const; - CG_stringRepr *CreateLE(CG_outputRepr *lop, CG_outputRepr *rop) const; - CG_stringRepr *CreateEQ(CG_outputRepr *lop, CG_outputRepr *rop) const; - CG_stringRepr *StmtListAppend(CG_outputRepr *list1, CG_outputRepr *list2) const; -}; - - -} - -#endif diff --git a/omega/code_gen/include/code_gen/CG_stringRepr.h b/omega/code_gen/include/code_gen/CG_stringRepr.h deleted file mode 100644 index a6df85d..0000000 --- a/omega/code_gen/include/code_gen/CG_stringRepr.h +++ /dev/null @@ -1,43 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 the Omega Project Team - Copyright (C) 2005-2011 Chun Chen - All Rights Reserved. - - Purpose: - pseudo string code wrapper - - Notes: - - History: - 04/17/96 - Lei Zhou - created -*****************************************************************************/ - -#ifndef _CG_STRINGREPR_H -#define _CG_STRINGREPR_H - -#include -#include -#include - -namespace omega { - -class CG_stringRepr: public CG_outputRepr { -private: - std::string s_; - -public: - CG_stringRepr() {} - CG_stringRepr(const std::string &s) { s_ = s; } - ~CG_stringRepr() {} - CG_outputRepr *clone() const { return new CG_stringRepr(s_); } - void dump() const { std::cout << s_ << std::endl; } - - //--------------------------------------------------------------------------- - // basic operation - //--------------------------------------------------------------------------- - std::string GetString() const { return s_; } -}; - -} - -#endif diff --git a/omega/code_gen/include/code_gen/CG_suifBuilder.h b/omega/code_gen/include/code_gen/CG_suifBuilder.h deleted file mode 100644 index 9f57e3d..0000000 --- a/omega/code_gen/include/code_gen/CG_suifBuilder.h +++ /dev/null @@ -1,88 +0,0 @@ -#ifndef CG_suifBuilder_h -#define CG_suifBuilder_h - -#include -#include -#include -#include - -namespace omega { - - -class CG_suifBuilder: public CG_outputBuilder { -public: - //CG_suifBuilder(proc_symtab *symtab) {symtab_ = symtab;} - CG_suifBuilder(proc_symtab *symtab); - //protonu--initializing code_gen stuff for cuda - //this looks like a flaw in my design - //end--protonu - ~CG_suifBuilder() {} - - CG_outputRepr* CreatePlaceHolder(int indent, CG_outputRepr *stmt, - Tuple &funcList, - Tuple &loop_vars) const; - CG_outputRepr* CreateAssignment(int indent, CG_outputRepr* lhs, - CG_outputRepr* rhs) const; - CG_outputRepr* CreateInvoke(const std::string &fname, - Tuple &argList) const; - CG_outputRepr* CreateComment(int indent, const std::string &commentText) const; - CG_outputRepr* CreateAttribute(CG_outputRepr *control, - const std::string &commentText) const; - - CG_outputRepr* CreateIf(int indent, CG_outputRepr* guardCondition, - CG_outputRepr* true_stmtList, CG_outputRepr* false_stmtList) const; - CG_outputRepr* CreateInductive(CG_outputRepr* index, - CG_outputRepr* lower, - CG_outputRepr* upper, - CG_outputRepr* step) const; - CG_outputRepr* CreateLoop(int indent, CG_outputRepr* control, - CG_outputRepr* stmtList) const; - CG_outputRepr* CreateInt(int) const; - CG_outputRepr* CreateIdent(const std::string &idStr) const; - CG_outputRepr* CreatePlus(CG_outputRepr*, CG_outputRepr*) const; - CG_outputRepr* CreateMinus(CG_outputRepr*, CG_outputRepr*) const; - CG_outputRepr* CreateTimes(CG_outputRepr*, CG_outputRepr*) const; - CG_outputRepr* CreateIntegerDivide(CG_outputRepr*, CG_outputRepr*) const; - CG_outputRepr* CreateIntegerMod(CG_outputRepr*, CG_outputRepr*) const; - CG_outputRepr* CreateAnd(CG_outputRepr*, CG_outputRepr*) const; - CG_outputRepr* CreateGE(CG_outputRepr*, CG_outputRepr*) const; - CG_outputRepr* CreateLE(CG_outputRepr*, CG_outputRepr*) const; - CG_outputRepr* CreateEQ(CG_outputRepr*, CG_outputRepr*) const; - CG_outputRepr* StmtListAppend(CG_outputRepr* list1, CG_outputRepr* list2) const; - //--------------------------------------------------------------------------- - // pragma generation - //--------------------------------------------------------------------------- - virtual CG_outputRepr* CreatePragma(int indent, const std::string &pragmaText) const; - - //--------------------------------------------------------------------------- - // dim3 generation - //--------------------------------------------------------------------------- - virtual CG_outputRepr* CreateDim3(immed varName, immed arg1, immed arg2) const; - virtual CG_outputRepr* CreateDim3(immed varName, immed arg1, immed arg2, immed arg3) const; - - - //--------------------------------------------------------------------------- - // kernel generation - //--------------------------------------------------------------------------- - virtual CG_outputRepr* CreateKernel(immed_list* iml) const; - - //--------------------------------------------------------------------------- - // Add a modifier to a type (for things like __global__) - //--------------------------------------------------------------------------- - type_node* ModifyType(type_node* base, const char* modifier) const; -private: - proc_symtab *symtab_; -}; - -extern char *k_ocg_comment; - -bool substitute(instruction *in, var_sym *sym, operand expr, - base_symtab *st=NULL); -bool substitute(tree_node *tn, var_sym *sym, operand expr, - base_symtab *st=NULL); -bool substitute(tree_node_list *tnl, var_sym *sym, operand expr, - base_symtab *st = NULL); - -} - -#endif diff --git a/omega/code_gen/include/code_gen/CG_suifRepr.h b/omega/code_gen/include/code_gen/CG_suifRepr.h deleted file mode 100644 index ce7c6cd..0000000 --- a/omega/code_gen/include/code_gen/CG_suifRepr.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef CG_suifRepr_h -#define CG_suifRepr_h - -#include -#include - -namespace omega { - -class CG_suifRepr : public CG_outputRepr { - friend class CG_suifBuilder; -public: - CG_suifRepr(); - CG_suifRepr(tree_node_list *tnl); - CG_suifRepr(operand op); - virtual ~CG_suifRepr(); - virtual CG_outputRepr *clone(); - virtual void clear(); - - tree_node_list* GetCode() const; - operand GetExpression() const; - - //--------------------------------------------------------------------------- - // Dump operations - //--------------------------------------------------------------------------- - virtual void Dump() const; - virtual void DumpToFile(FILE *fp = stderr) const; -private: - // only one of _tnl and _op would be active at any time, depending on - // whether it is building a statement list or an expression tree - tree_node_list *tnl_; - operand op_; -}; - -} // namespace - -#endif diff --git a/omega/code_gen/include/code_gen/CG_utils.h b/omega/code_gen/include/code_gen/CG_utils.h deleted file mode 100755 index 9e44cb1..0000000 --- a/omega/code_gen/include/code_gen/CG_utils.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef _CG_UTILS_H -#define _CG_UTILS_H - -#include -#include -#include -#include -#include -#include - -namespace omega { - -class CG_loop; - -CG_outputRepr *output_inequality_repr(CG_outputBuilder *ocg, const GEQ_Handle &inequality, Variable_ID v, const Relation &R, const std::vector > &assigned_on_the_fly, std::set excluded_floor_vars = std::set()); -CG_outputRepr *output_substitution_repr(CG_outputBuilder *ocg, const EQ_Handle &equality, Variable_ID v, bool apply_v_coef, const Relation &R, const std::vector > &assigned_on_the_fly); -CG_outputRepr *output_upper_bound_repr(CG_outputBuilder *ocg, const GEQ_Handle &inequality, Variable_ID v, const Relation &R, const std::vector > &assigned_on_the_fly); -CG_outputRepr *output_lower_bound_repr(CG_outputBuilder *ocg, const GEQ_Handle &inequality, Variable_ID v, const EQ_Handle &stride_eq, Variable_ID wc, const Relation &R, const Relation &known, const std::vector > &assigned_on_the_fly); - -CG_outputRepr *output_ident(CG_outputBuilder *ocg, const Relation &R, Variable_ID v, const std::vector > &assigned_on_the_fly); -std::pair > output_assignment(CG_outputBuilder *ocg, const Relation &R, int level, const Relation &known, const std::vector > &assigned_on_the_fly); -CG_outputRepr *output_loop(CG_outputBuilder *ocg, const Relation &R, int level, const Relation &known, const std::vector > &assigned_on_the_fly); -CG_outputRepr *output_guard(CG_outputBuilder *ocg, const Relation &R, const std::vector > &assigned_on_the_fly); -std::vector output_substitutions(CG_outputBuilder *ocg, const Relation &R, const std::vector > &assigned_on_the_fly); - -bool bound_must_hit_stride(const GEQ_Handle &inequality, Variable_ID v, const EQ_Handle &stride_eq, Variable_ID wc, const Relation &bounds, const Relation &known); -std::pair find_simplest_assignment(const Relation &R, Variable_ID v, const std::vector > &assigned_on_the_fly = std::vector >()); -std::pair find_floor_definition(const Relation &R, Variable_ID v, std::set excluded_floor_vars = std::set()); -std::pair find_simplest_stride(const Relation &R, Variable_ID v); -Variable_ID replicate_floor_definition(const Relation &R, const Variable_ID floor_var, Relation &r, F_Exists *f_exists, F_And *f_root, std::map &exists_mapping); - -Relation pick_one_guard(const Relation &R, int level = 0); -CG_outputRepr *leaf_print_repr(BoolSet<> active, const std::map &guards, - CG_outputRepr *guard_repr, const Relation &known, - int indent, CG_outputBuilder *ocg, const std::vector &remap, - const std::vector &xforms, const std::vector &stmts, - const std::vector > &assigned_on_the_fly); -CG_outputRepr *loop_print_repr(const std::vector &loops, int start, int end, - const Relation &guard, CG_outputRepr *guard_repr, - int indent, CG_outputBuilder *ocg, const std::vector &stmts, - const std::vector > &assigned_on_the_fly); - -} - -#endif diff --git a/omega/code_gen/include/code_gen/code_gen.h b/omega/code_gen/include/code_gen/code_gen.h deleted file mode 100644 index abfab7c..0000000 --- a/omega/code_gen/include/code_gen/code_gen.h +++ /dev/null @@ -1,47 +0,0 @@ -#if !defined(Already_Included_code_gen) -#define Already_Included_code_gen - -#include -#include -#include -#include -#include - -namespace omega { - -typedef Tuple IntTuple; -typedef Tuple SetTuple; -typedef Tuple SetTupleTuple; -typedef Tuple RelTuple; -typedef Tuple RelTupleTuple; - -CG_outputRepr *MMGenerateCode(CG_outputBuilder* ocg, - Tuple &T, Tuple &old_IS, - const Tuple &stmt_content, - Relation &known, int effort=1); -std::string MMGenerateCode(Tuple &T, Tuple &old_IS, Relation &known, - int effort=1); - -//protonu-adding a new variant to keep Gabe's code happy -CG_outputRepr* MMGenerateCode(CG_outputBuilder* ocg, RelTuple &T, SetTuple &old_IS, - const Tuple &stmt_content, Relation &known, - Tuple< IntTuple >& smtNonSplitLevels_, - std::vector< std::pair > syncs_, - const Tuple< Tuple >& loopIdxNames_, - int effort=1); -//end-protonu - -struct Polyhedra { - int last_level; - Tuple transformations; - Relation known; - - Tuple remap; // after initial iteration space's disjoint set splitting, the new statement number maps to old statement number - Tuple > projected_nIS; - - Polyhedra(const Tuple &T, const Tuple &old_IS, const Relation &known = Relation::Null()); - ~Polyhedra() {} -}; - -} -#endif diff --git a/omega/code_gen/include/code_gen/codegen.h b/omega/code_gen/include/code_gen/codegen.h deleted file mode 100755 index 469653d..0000000 --- a/omega/code_gen/include/code_gen/codegen.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef _CODEGEN_H -#define _CODEGEN_H - -#include -#include -#include -#include -#include - -namespace omega { - -class CodeGen { -public: - static const std::string loop_var_name_prefix; - static const int var_substitution_threshold; - -protected: - std::vector > projected_IS_; // projected_IS_[level-1][new stmt#] - std::vector xforms_; // transformations[original stmt#] - Relation known_; // no need to generate code for constraints satisfied in known - std::vector remap_; // map new stmt# to original stmt# - -public: - CodeGen(const std::vector &xforms, const std::vector &IS, const Relation &known = Relation::Null(), - std::vector< std::vector > smtNonSplitLevels_ = std::vector< std::vector >(), - std::vector< std::vector > loopIdxNames_ = std::vector< std::vector >(), - std::vector< std::pair > syncs_ = std::vector< std::pair >() - ); - ~CodeGen() {} - - CG_result *buildAST(int effort = 1); - int num_level() const { return projected_IS_.size(); } - -private: - CG_result *buildAST(int level, const BoolSet<> &active, bool split_on_const, const Relation &restriction); - - friend class CG_result; - friend class CG_split; - friend class CG_loop; - friend class CG_leaf; -}; - -} -#endif diff --git a/omega/code_gen/include/code_gen/codegen_error.h b/omega/code_gen/include/code_gen/codegen_error.h deleted file mode 100755 index 06ecc2b..0000000 --- a/omega/code_gen/include/code_gen/codegen_error.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef _CODEGEN_ERROR_H -#define _CODEGEN_ERROR_H - -#include - -namespace omega { - -struct codegen_error: public std::runtime_error { - codegen_error(const std::string &msg): std::runtime_error("codegen error: " + msg) {} -}; - - -} -#endif - diff --git a/omega/code_gen/include/code_gen/cscope.out b/omega/code_gen/include/code_gen/cscope.out deleted file mode 100644 index 23b9ff6..0000000 --- a/omega/code_gen/include/code_gen/cscope.out +++ /dev/null @@ -1,42592 +0,0 @@ -cscope 15 $HOME/chill-latest/omega/code_gen/include/code_gen 0000237072 - @CG.h - -1 #ià! -defšed -( -AÌ—dy_šþuded_cg -) - -2  - #AÌ—dy_šþuded_cg - - - ) - -4  - ~ - -5  - ~ - -6  - ~ - -7  - ~ - -8  - ~ - -10 -Çme¥aû - - gomega - { - -12  - gTu¶e -<> - tIÁTu¶e -; - -13  - gTu¶e -< - tR–©iÚ -> - tS‘Tu¶e -; - -14  - gTu¶e -< - tS‘Tu¶e -> - tS‘Tu¶eTu¶e -; - -15  - gTu¶e -< - tR–©iÚ -> - tR–Tu¶e -; - -17 þas  - cCG_»suÉ - { - -18 - gpublic -: - -19 -Tu¶e -<> -isAùive -; - -20  - gËv– -; - -21 -R–©iÚ - - g»¡riùiÚs -; - -22 -R–©iÚ - - gknown -; - -24 - gpublic -: - -25 -CG_»suÉ -() {} - -26 -vœtu® - ~ -CG_»suÉ -() {} - -28 -vœtu® - -CG_»suÉ - * -þÚe -() = 0; - -29 -vœtu® -  -d•th -() = 0; - -30 -vœtu® - -boÞ - -isNuÎ -(è{  - gçl£ -;}; - -31 -vœtu® - -CG_»suÉ - * -liáOv”h—d -( -d•th -) = 0; - -32 -vœtu® - -R–©iÚ - -fšdOv”h—d -( -liáTo -) = 0; - -33 -vœtu® - -CG_»suÉ - * -fÜû_fš™e_bounds -() = 0; - -34 -vœtu® - -R–©iÚ - -hoi¡Gu¬d -() = 0; - -35 -vœtu® -  -»moveGu¬d -() = 0; - -36 -vœtu® - -CG_»suÉ - * -»compu‹ -(cÚ¡ -R–©iÚ - & -k -, cÚ¡ R–©iÚ & -r -) = 0; - -38 -vœtu® - -CG_ouutR•r - * -´štR•r -( -CG_ouutBužd” -* -ocg -,  -šd’t -, cÚ¡ -¡d -:: -veùÜ - & -assigÃd_Ú_the_æy -) = 0; - -39 -vœtu® - - g¡d -:: -¡ršg - -´štSŒuùu» -( -šd’t -) = 0; - -40 -vœtu® - - g¡d -:: -¡ršg - -´št -( -šd’t -); - -44 þas  - cCG_nuÎ - : -public - -CG_»suÉ - { - -45 -public -: - -46 -CG_»suÉ - * -þÚe -() { - -47  -Ãw - -CG_nuÎ -; - -49 - g¡d -:: -¡ršg - -´štSŒuùu» -() { - -52 -CG_ouutR•r - * -´štR•r -( -CG_ouutBužd” -*, , cÚ¡ -¡d -:: -veùÜ - &) - -53 {  ( -CG_ouutR•r - *)0; }; - -55  -d•th -() {  0; } - -56 -boÞ - -isNuÎ -(è{  - gŒue -;}; - -57 -CG_»suÉ - * -»compu‹ -(cÚ¡ -R–©iÚ - &, const Relation &) { - -58  - gthis -; - -60 -CG_»suÉ - * -liáOv”h—d -() { - -61  - gthis -; - -63 -R–©iÚ - -fšdOv”h—d -() { - -64  - gR–©iÚ -:: -True -(1); - -66 -CG_»suÉ - * -fÜû_fš™e_bounds -(è{  - gthis -; }; - -67 -R–©iÚ - -hoi¡Gu¬d -(è{  - gR–©iÚ -:: -True -(1); } - -68  -»moveGu¬d -() { } - -73 þas  - cCG_¥l™ - : -public - -CG_»suÉ - { - -74 -public -: - -75 -CG_»suÉ - * -ŒueCÏu£ -,* - gçl£CÏu£ -; - -76 -R–©iÚ - - gcÚd™iÚ -; - -77 -R–©iÚ - - ggu¬d -; - -79 - gpublic -: - -80 -CG_¥l™ -( -IÁTu¶e - & -aùive -,  -lvl -, cÚ¡ -R–©iÚ - & -cÚd_ -, -CG_»suÉ - * -T -, CG_»suÉ * -F -); - -81 ~ -CG_¥l™ -(è{ -d–‘e - - gŒueCÏu£ -; d–‘ - gçl£CÏu£ -; } - -83 -CG_»suÉ - * -þÚe -() { - -84 -R–©iÚ - - gc - = -cÚd™iÚ -; - -85  -Ãw - -CG_¥l™ -( -isAùive -, -Ëv– -, -c -, - -86 -ŒueCÏu£ --> -þÚe -(), -çl£CÏu£ -->clone()); - -88  -d•th -() - -89 {  -max -( -ŒueCÏu£ --> -d•th -(), -çl£CÏu£ -->depth()); } - -90 - g¡d -:: -¡ršg - -´štSŒuùu» -( -šd’t -); - -91 -CG_ouutR•r - * -´štR•r -( -CG_ouutBužd” -* -ocg -,  -šd’t -, cÚ¡ -¡d -:: -veùÜ - & -assigÃd_Ú_the_æy -); - -93 -CG_»suÉ - * -liáOv”h—d -( -d•th -); - -94 -CG_»suÉ - * -fÜû_fš™e_bounds -(); - -95 -R–©iÚ - -fšdOv”h—d -( -liáTo -); - -96 -CG_»suÉ - * -»compu‹ -(cÚ¡ -R–©iÚ - & -k -, cÚ¡ R–©iÚ & -r -); - -97 -R–©iÚ - -hoi¡Gu¬d -(); - -98  -»moveGu¬d -(è{ - ggu¬d - = -R–©iÚ -:: -True -( -cÚd™iÚ -. -n_£t -()); } - -104 þas  - cCG_Ëaf - : -public - -CG_»suÉ - { - -105 -public -: - -106 -S‘Tu¶e - -gu¬d -; - -108 - gpublic -: - -109 -CG_Ëaf -( -IÁTu¶e - & -aùive -) { - -110 -isAùive - = -aùive -; - -111 - ggu¬d -. -»®loÿ‹ -( -isAùive -. -size -()); - -113 ~ -CG_Ëaf -() {} - -115 -CG_»suÉ - * -þÚe -() { - -116  -Ãw - -CG_Ëaf -( -isAùive -); - -118 -CG_»suÉ - * -liáOv”h—d -() { - -119  - gthis -; - -121 -CG_»suÉ - * -fÜû_fš™e_bounds -() { - -122  - gthis -; - -124 -R–©iÚ - -fšdOv”h—d -( -liáTo -); - -125 - g¡d -:: -¡ršg - -´štSŒuùu» -( -šd’t -); - -126 -CG_ouutR•r - * -´štR•r -( -CG_ouutBužd” -* -ocg -,  -šd’t -, cÚ¡ -¡d -:: -veùÜ - & -assigÃd_Ú_the_æy -); - -127  -d•th -() {  0; } - -128 -CG_»suÉ - * -»compu‹ -(cÚ¡ -R–©iÚ - & -k -, cÚ¡ R–©iÚ & -r -); - -129 -R–©iÚ - -hoi¡Gu¬d -(); - -130  -»moveGu¬d -(); - -133 þas  - cCG_loÝ - : -public - -CG_»suÉ - { - -134 -public -: - -135 -R–©iÚ - -bounds -; - -136 -R–©iÚ - - ggu¬d -; - -137 -boÞ - - gÃedLoÝ -; - -138 -CG_»suÉ - * - gbody -; - -140 - gpublic -: - -141 -CG_loÝ -( -IÁTu¶e - & -aùive -,  -lvl -, -CG_»suÉ - * -b -) { - -142 - gisAùive - = -aùive -; - -143 - gËv– - = -lvl -; - -144 - gbody - = -b -; - -146 ~ -CG_loÝ -(è{ -d–‘e - - gbody -; } - -148 -CG_»suÉ - * -þÚe -() { - -149  -Ãw - -CG_loÝ -( -isAùive -, -Ëv– -, -body --> -þÚe -()); - -151 -R–©iÚ - -fšdOv”h—d -( -liáTo -); - -152 -CG_»suÉ - * -fÜû_fš™e_bounds -(); - -153 -CG_»suÉ - * -liáOv”h—d -( -d•th -); - -154 - g¡d -:: -¡ršg - -´štSŒuùu» -( -šd’t -); - -155 -CG_ouutR•r - * -´štR•r -( -CG_ouutBužd” -* -ocg -,  -šd’t -, cÚ¡ -¡d -:: -veùÜ - & -assigÃd_Ú_the_æy -); - -156  -d•th -(è{  ( - gÃedLoÝ -?1:0)+ -body -->depth(); } - -157 -CG_»suÉ - * -»compu‹ -(cÚ¡ -R–©iÚ - & -k -, cÚ¡ R–©iÚ & -r -); - -158 -R–©iÚ - -hoi¡Gu¬d -(); - -159  -»moveGu¬d -(è{ - ggu¬d - = -R–©iÚ -:: -True -( -bounds -. -n_£t -()); } - - @CG_outputBuilder.h - -21 #iâdeà -CG_ouutBužd”_h - - -22  - #CG_ouutBužd”_h - - - ) - -24  - ~ - -25  - ~ - -26  - ~<¡ršg -> - -28 -Çme¥aû - - gomega - { - -30 þas  - cCG_ouutBužd” - { - -31 - gpublic -: - -32 -CG_ouutBužd” -() {} - -33 -vœtu® - ~ -CG_ouutBužd” -() {} - -38 -vœtu® - -CG_ouutR•r -* -C»©ePÏûHÞd” -( -šd’t -, CG_ouutR•¸* -¡mt -, - -39 -Tu¶e -< -CG_ouutR•r -*> & -funcLi¡ -, - -40 -Tu¶e -< -¡d -:: -¡ršg -> & -loÝ_v¬s -) const = 0; - -45 -vœtu® - -CG_ouutR•r -* -C»©eAssignm’t -( -šd’t -, CG_ouutR•r* -lhs -, - -46 -CG_ouutR•r -* -rhs -) const = 0; - -51 -vœtu® - -CG_ouutR•r -* -C»©eInvoke -(cÚ¡ -¡d -:: -¡ršg - & -âame -, - -52 -Tu¶e -< -CG_ouutR•r -*> & -¬gLi¡ -) const = 0; - -57 -vœtu® - -CG_ouutR•r -* -C»©eComm’t -( -šd’t -, - -58 cÚ¡ -¡d -:: -¡ršg - & -comm’tText -) const = 0; - -63 -vœtu® - -CG_ouutR•r -* -C»©eIf -( -šd’t -, CG_ouutR•r* -gu¬dCÚd™iÚ -, - -64 -CG_ouutR•r -* -Œue_¡mtLi¡ -, - -65 -CG_ouutR•r -* -çl£_¡mtLi¡ -) const = 0; - -70 -vœtu® - -CG_ouutR•r -* -C»©eInduùive -(CG_ouutR•r* -šdex -, - -71 -CG_ouutR•r -* -low” -, - -72 -CG_ouutR•r -* -uµ” -, - -73 -CG_ouutR•r -* -¡• -) const = 0; - -78 -vœtu® - -CG_ouutR•r -* -C»©eLoÝ -( -šd’t -, CG_ouutR•r* -cÚŒÞ -, - -79 -CG_ouutR•r -* -¡mtLi¡ -) const = 0; - -84 -vœtu® - -CG_ouutR•r -* -C»©eCÝy -(CG_ouutR•r* -Üigš® -) const { - -85 ià( - gÜigš® - =ð -NULL -) - -86  -NULL -; - -88  - gÜigš® --> -þÚe -(); - -94 -vœtu® - -CG_ouutR•r -* -C»©eIÁ -() const = 0; - -95 -vœtu® - -CG_ouutR•r -* -C»©eId’t -(cÚ¡ -¡d -:: -¡ršg - & -idSŒ -) const = 0; - -100 -vœtu® - -CG_ouutR•r -* -C»©ePlus -(CG_outputRepr*, CG_outputRepr*) const = 0; - -101 -vœtu® - -CG_ouutR•r -* -C»©eMšus -(CG_outputRepr*, CG_outputRepr*) const = 0; - -102 -vœtu® - -CG_ouutR•r -* -C»©eTimes -(CG_outputRepr*, CG_outputRepr*) const = 0; - -117 -vœtu® - -CG_ouutR•r -* -C»©eIÁeg”Divide -(CG_outputRepr*, CG_outputRepr*) const = 0; - -118 -vœtu® - -CG_ouutR•r -* -C»©eIÁeg”Mod -(CG_ouutR•¸* -lÝ -, CG_ouutR•¸* -rÝ -) const { - -119 -CG_ouutR•r - * - glÝ2 - = -C»©eCÝy -( -lÝ -); - -120 -CG_ouutR•r - * - grÝ2 - = -C»©eCÝy -( -rÝ -); - -121  -C»©eMšus -( -lÝ2 -, -C»©eTimes -( -rÝ2 -, -C»©eIÁeg”Divide -( -lÝ -, -rÝ -))); - -123 -vœtu® - -CG_ouutR•r -* -C»©eIÁeg”Cež -(CG_ouutR•r* -lÝ -, CG_ouutR•r* -rÝ -) const { - -124  -C»©eMšus -( -NULL -, -C»©eIÁeg”Divide -(C»©eMšus(NULL, -lÝ -), -rÝ -)); - -130 -vœtu® - -CG_ouutR•r -* -C»©eAnd -(CG_outputRepr*, CG_outputRepr*) const = 0; - -135 -vœtu® - -CG_ouutR•r -* -C»©eGE -(CG_outputRepr*, CG_outputRepr*) const = 0; - -136 -vœtu® - -CG_ouutR•r -* -C»©eLE -(CG_outputRepr*, CG_outputRepr*) const = 0; - -137 -vœtu® - -CG_ouutR•r -* -C»©eEQ -(CG_outputRepr*, CG_outputRepr*) const = 0; - -142 -vœtu® - -CG_ouutR•r -* -StmtLi¡Aµ’d -(CG_ouutR•r* -li¡1 -, CG_ouutR•r* -li¡2 -) const = 0; - - @CG_outputRepr.h - -16 #iâdeà -CG_ouutR•r_h - - -17  - #CG_ouutR•r_h - - - ) - -19  - ~<¡dio.h -> - -20  - ~ - -21  - ~<¡ršg -> - -23 -Çme¥aû - - gomega - { - -25 þas  - cCG_ouutR•r - { - -26 - gpublic -: - -27 -vœtu® - ~ -CG_ouutR•r -() {}; - -28 -vœtu® - -CG_ouutR•r - * -þÚe -() = 0; - -29 -vœtu® -  -þ—r -() {}; - -34 -vœtu® -  -Dump -() const = 0; - -35 -vœtu® -  -DumpToFže -( -FILE - * -å - = -¡d”r -) const = 0; - - @CG_stringBuilder.h - -1 #iâdeà -CG_¡ršgBužd”_h - - -2  - #CG_¡ršgBužd”_h - - - ) - -4  - ~ - -5  - ~ - -7 -Çme¥aû - - gomega - { - -9 þas  - cCG_¡ršgBužd” -: -public - -CG_ouutBužd” - { - -10 -public -: - -11 -CG_¡ršgBužd” -() {} - -12 ~ -CG_¡ršgBužd” -() {} - -14 -CG_ouutR•r -* -C»©ePÏûHÞd” -( -šd’t -, CG_ouutR•¸* -¡mt -, - -15 -Tu¶e -< -CG_ouutR•r -*> & -funcLi¡ -, - -16 -Tu¶e -< -¡d -:: -¡ršg -> & -loÝ_v¬s -) const; - -18 -CG_ouutR•r -* -C»©eAssignm’t -( -šd’t -, CG_ouutR•r* -lhs -, - -19 -CG_ouutR•r -* -rhs -) const; - -20 -CG_ouutR•r -* -C»©eInvoke -(cÚ¡ -¡d -:: -¡ršg - & -âame -, - -21 -Tu¶e -< -CG_ouutR•r -*> & -¬gLi¡ -) const; - -22 -CG_ouutR•r -* -C»©eComm’t -( -šd’t -, cÚ¡ -¡d -:: -¡ršg - & -comm’tText -) const; - -23 -CG_ouutR•r -* -C»©eIf -( -šd’t -, CG_ouutR•r* -gu¬dCÚd™iÚ -, - -24 -CG_ouutR•r -* -Œue_¡mtLi¡ -, CG_ouutR•r* -çl£_¡mtLi¡ -) const; - -25 -CG_ouutR•r -* -C»©eInduùive -(CG_ouutR•r* -šdex -, - -26 -CG_ouutR•r -* -low” -, - -27 -CG_ouutR•r -* -uµ” -, - -28 -CG_ouutR•r -* -¡• -) const; - -29 -CG_ouutR•r -* -C»©eLoÝ -( -šd’t -, CG_ouutR•r* -cÚŒÞ -, - -30 -CG_ouutR•r -* -¡mtLi¡ -) const; - -31 -CG_ouutR•r -* -C»©eIÁ -() const; - -32 -CG_ouutR•r -* -C»©eId’t -(cÚ¡ -¡d -:: -¡ršg - & -idSŒ -) const; - -33 -CG_ouutR•r -* -C»©ePlus -(CG_outputRepr*, CG_outputRepr*) const; - -34 -CG_ouutR•r -* -C»©eMšus -(CG_outputRepr*, CG_outputRepr*) const; - -35 -CG_ouutR•r -* -C»©eTimes -(CG_outputRepr*, CG_outputRepr*) const; - -36 -CG_ouutR•r -* -C»©eIÁeg”Divide -(CG_outputRepr*, CG_outputRepr*) const; - -37 -CG_ouutR•r -* -C»©eIÁeg”Mod -(CG_outputRepr*, CG_outputRepr*) const; - -38 -CG_ouutR•r -* -C»©eIÁeg”Cež -(CG_outputRepr*, CG_outputRepr*) const; - -39 -CG_ouutR•r -* -C»©eAnd -(CG_outputRepr*, CG_outputRepr*) const; - -40 -CG_ouutR•r -* -C»©eGE -(CG_outputRepr*, CG_outputRepr*) const; - -41 -CG_ouutR•r -* -C»©eLE -(CG_outputRepr*, CG_outputRepr*) const; - -42 -CG_ouutR•r -* -C»©eEQ -(CG_outputRepr*, CG_outputRepr*) const; - -43 -CG_ouutR•r -* -StmtLi¡Aµ’d -(CG_ouutR•r* -li¡1 -, CG_ouutR•r* -li¡2 -) const; - -46 - g¡d -:: -¡ršg - -G‘SŒšg -( -CG_ouutR•r -* -»´ -); - -47 - g¡d -:: -¡ršg - -G‘Ind’tS·ûs -( -šd’t -); - - @CG_stringRepr.h - -1 #iâdeà -CG_¡ršgR•r_h - - -2  - #CG_¡ršgR•r_h - - - ) - -4  - ~<¡dio.h -> - -5  - ~ - -6  - ~<¡ršg -> - -8 -Çme¥aû - - gomega - { - -10 þas  - cCG_¡ršgR•r - : -public - -CG_ouutR•r - { - -11 -public -: - -12 -CG_¡ršgR•r -(); - -13 -CG_¡ršgR•r -(cÚ¡ -¡d -:: -¡ršg -& -_s -); - -14 - gvœtu® - ~ -CG_¡ršgR•r -(); - -15 -vœtu® - -CG_ouutR•r - * -þÚe -(); - -20 - g¡d -:: -¡ršg - -G‘SŒšg -() const; - -25 -vœtu® -  -Dump -() const; - -26 -vœtu® -  -DumpToFže -( -FILE - * -å - = -¡d”r -) const; - -27 - g´iv©e -: - -28 -¡d -:: -¡ršg - -s -; - - @CG_suifBuilder.h - -1 #iâdeà -CG_suifBužd”_h - - -2  - #CG_suifBužd”_h - - - ) - -4  - ~ - -5  - ~ - -6  - ~ - -7  - ~<¡ršg -> - -9 -Çme¥aû - - gomega - { - -11 þas  - cCG_suifBužd” -: -public - -CG_ouutBužd” - { - -12 -public -: - -13 -CG_suifBužd” -( -´oc_symb - * -symb -è{ -symb_ - = symtab;} - -14 ~ -CG_suifBužd” -() {} - -16 -CG_ouutR•r -* -C»©ePÏûHÞd” -( -šd’t -, CG_ouutR•¸* -¡mt -, - -17 -Tu¶e -< -CG_ouutR•r -*> & -funcLi¡ -, - -18 -Tu¶e -< -¡d -:: -¡ršg -> & -loÝ_v¬s -) const; - -19 -CG_ouutR•r -* -C»©eAssignm’t -( -šd’t -, CG_ouutR•r* -lhs -, - -20 -CG_ouutR•r -* -rhs -) const; - -21 -CG_ouutR•r -* -C»©eInvoke -(cÚ¡ -¡d -:: -¡ršg - & -âame -, - -22 -Tu¶e -< -CG_ouutR•r -*> & -¬gLi¡ -) const; - -23 -CG_ouutR•r -* -C»©eComm’t -( -šd’t -, cÚ¡ -¡d -:: -¡ršg - & -comm’tText -) const; - -24 -CG_ouutR•r -* -C»©eIf -( -šd’t -, CG_ouutR•r* -gu¬dCÚd™iÚ -, - -25 -CG_ouutR•r -* -Œue_¡mtLi¡ -, CG_ouutR•r* -çl£_¡mtLi¡ -) const; - -26 -CG_ouutR•r -* -C»©eInduùive -(CG_ouutR•r* -šdex -, - -27 -CG_ouutR•r -* -low” -, - -28 -CG_ouutR•r -* -uµ” -, - -29 -CG_ouutR•r -* -¡• -) const; - -30 -CG_ouutR•r -* -C»©eLoÝ -( -šd’t -, CG_ouutR•r* -cÚŒÞ -, - -31 -CG_ouutR•r -* -¡mtLi¡ -) const; - -32 -CG_ouutR•r -* -C»©eIÁ -() const; - -33 -CG_ouutR•r -* -C»©eId’t -(cÚ¡ -¡d -:: -¡ršg - & -idSŒ -) const; - -34 -CG_ouutR•r -* -C»©ePlus -(CG_outputRepr*, CG_outputRepr*) const; - -35 -CG_ouutR•r -* -C»©eMšus -(CG_outputRepr*, CG_outputRepr*) const; - -36 -CG_ouutR•r -* -C»©eTimes -(CG_outputRepr*, CG_outputRepr*) const; - -37 -CG_ouutR•r -* -C»©eIÁeg”Divide -(CG_outputRepr*, CG_outputRepr*) const; - -38 -CG_ouutR•r -* -C»©eIÁeg”Mod -(CG_outputRepr*, CG_outputRepr*) const; - -39 -CG_ouutR•r -* -C»©eAnd -(CG_outputRepr*, CG_outputRepr*) const; - -40 -CG_ouutR•r -* -C»©eGE -(CG_outputRepr*, CG_outputRepr*) const; - -41 -CG_ouutR•r -* -C»©eLE -(CG_outputRepr*, CG_outputRepr*) const; - -42 -CG_ouutR•r -* -C»©eEQ -(CG_outputRepr*, CG_outputRepr*) const; - -43 -CG_ouutR•r -* -StmtLi¡Aµ’d -(CG_ouutR•r* -li¡1 -, CG_ouutR•r* -li¡2 -) const; - -47 -vœtu® - -CG_ouutR•r -* -C»©eP¿gma -( -šd’t -, cÚ¡ -¡d -:: -¡ršg - & -´agmaText -) const; - -52 -vœtu® - -CG_ouutR•r -* -C»©eDim3 -( -immed - -v¬Name -, immed -¬g1 -, immed -¬g2 -) const; - -53 -vœtu® - -CG_ouutR•r -* -C»©eDim3 -( -immed - -v¬Name -, immed -¬g1 -, immed -¬g2 -, immed -¬g3 -) const; - -59 -vœtu® - -CG_ouutR•r -* -C»©eK”Ãl -( -immed_li¡ -* -iml -) const; - -64 -ty³_node -* -ModifyTy³ -Ñy³_node* -ba£ -, cÚ¡ * -modif›r -) const; - -65 - g´iv©e -: - -66 -´oc_symb - * -symb_ -; - -69 * -k_ocg_comm’t -; - -71 -boÞ - -sub¡™u‹ -( -š¡ruùiÚ - * -š -, -v¬_sym - * -sym -, -Ý”ªd - -ex´ -, - -72 -ba£_symb - * -¡ -= -NULL -); - -73 -boÞ - -sub¡™u‹ -( -Œ“_node - * -Š -, -v¬_sym - * -sym -, -Ý”ªd - -ex´ -, - -74 -ba£_symb - * -¡ -= -NULL -); - -75 -boÞ - -sub¡™u‹ -( -Œ“_node_li¡ - * -Šl -, -v¬_sym - * -sym -, -Ý”ªd - -ex´ -, - -76 -ba£_symb - * -¡ - = -NULL -); - - @CG_suifRepr.h - -1 #iâdeà -CG_suifR•r_h - - -2  - #CG_suifR•r_h - - - ) - -4  - ~ - -5  - ~ - -7 -Çme¥aû - - gomega - { - -9 þas  - cCG_suifR•r - : -public - -CG_ouutR•r - { - -10 -ä›nd - -þass - -CG_suifBužd” -; - -11 - gpublic -: - -12 -CG_suifR•r -(); - -13 -CG_suifR•r -( -Œ“_node_li¡ - * -Šl -); - -14 -CG_suifR•r -( -Ý”ªd - -Ý -); - -15 - gvœtu® - ~ -CG_suifR•r -(); - -16 -vœtu® - -CG_ouutR•r - * -þÚe -(); - -17 -vœtu® -  -þ—r -(); - -19 -Œ“_node_li¡ -* -G‘Code -() const; - -20 -Ý”ªd - -G‘Ex´essiÚ -() const; - -25 -vœtu® -  -Dump -() const; - -26 -vœtu® -  -DumpToFže -( -FILE - * -å - = -¡d”r -) const; - -27 - g´iv©e -: - -30 -Œ“_node_li¡ - * -Šl_ -; - -31 -Ý”ªd - - gÝ_ -; - - @code_gen.h - -1 #ià! -defšed -( -AÌ—dy_Inþuded_code_g’ -) - -2  - #AÌ—dy_Inþuded_code_g’ - - - ) - -4  - ~ - -5  - ~ - -6  - ~ - -7  - ~ - -8  - ~ - -10 -Çme¥aû - - gomega - { - -12  - gTu¶e -<> - tIÁTu¶e -; - -13  - gTu¶e -< - tR–©iÚ -> - tS‘Tu¶e -; - -14  - gTu¶e -< - tS‘Tu¶e -> - tS‘Tu¶eTu¶e -; - -15  - gTu¶e -< - tR–©iÚ -> - tR–Tu¶e -; - -16  - gTu¶e -< - tR–Tu¶e -> - tR–Tu¶eTu¶e -; - -18 -CG_ouutR•r - * -MMG’”©eCode -( -CG_ouutBužd” -* -ocg -, - -19 -Tu¶e -< -R–©iÚ -> & -T -, Tu¶e & -Þd_IS -, - -20 cÚ¡ -Tu¶e -< -CG_ouutR•r - *> & -¡mt_cÚ‹Á -, - -21 -R–©iÚ - & -known -,  -effÜt -=1); - -22 - g¡d -:: -¡ršg - -MMG’”©eCode -( -Tu¶e -< -R–©iÚ -> & -T -, Tu¶e & -Þd_IS -, R–©iÚ & -known -, - -23  -effÜt -=1); - -27  - sPÞyhed¿ - { - -28  - gÏ¡_Ëv– -; - -29 - gTu¶e -< - gR–©iÚ -> - gŒªsfÜm©iÚs -; - -30 -R–©iÚ - - gknown -; - -32 - gTu¶e -<> - g»m­ -; - -33 - gTu¶e - > - g´ojeùed_nIS -; - -35 -PÞyhed¿ -(cÚ¡ -Tu¶e -< -R–©iÚ -> & -T -, cÚ¡ Tu¶e & -Þd_IS -, cÚ¡ R–©iÚ & -known - = R–©iÚ:: -NuÎ -()); - -36 ~ -PÞyhed¿ -() {} - - @output_repr.h - -1 #iâdeà -OUTPUT_REPR_H - - -2  - #OUTPUT_REPR_H - - - ) - -4  - ~ - -5  - ~ - -6  - ~ - -7  - ~ - -8  - ~<£t -> - -10 -Çme¥aû - - gomega - { - -11  -Ï¡_Ëv– -; - -13 -CG_ouutR•r -* -ouutId’t -( -CG_ouutBužd” -* -ocg -, cÚ¡ -R–©iÚ - & -R -, -V¬ŸbË_ID - -v -, cÚ¡ -¡d -:: -veùÜ - & -assigÃd_Ú_the_æy -); - -14 - g¡d -:: -·œ -< -CG_ouutR•r - *, - gboÞ -> -ouutAssignm’t -( -CG_ouutBužd” - * -ocg -, cÚ¡ -R–©iÚ - & -R_ -, -V¬ŸbË_ID - -v -, R–©iÚ & -’fÜûd -, CG_ouutR•¸*& -if_»´ -, cÚ¡ -¡d -:: -veùÜ - & -assigÃd_Ú_the_æy -); - -15 - g¡d -:: -·œ -< -CG_ouutR•r - *, - gboÞ -> -ouutBounds -( -CG_ouutBužd” -* -ocg -, cÚ¡ -R–©iÚ - & -bounds -, -V¬ŸbË_ID - -v -,  -šd’t -, R–©iÚ & -’fÜûd -, cÚ¡ -¡d -:: -veùÜ - & -assigÃd_Ú_the_æy -); - -16 - gTu¶e -< - gCG_ouutR•r -*> -ouutSub¡™utiÚ -( -CG_ouutBužd” -* -ocg -, cÚ¡ -R–©iÚ - & -R -, cÚ¡ -¡d -:: -veùÜ -< -CG_ouutR•r - *> & -assigÃd_Ú_the_æy -); - -17 -CG_ouutR•r -* -ouutS‹m’t -( -CG_ouutBužd” -* -ocg -, CG_ouutR•¸* -¡mt -,  -šd’t -, cÚ¡ -R–©iÚ - & -m­pšg -, cÚ¡ R–©iÚ & -known -, cÚ¡ -¡d -:: -veùÜ - & -assigÃd_Ú_the_æy -); - -18 -CG_ouutR•r -* -ouutGu¬d -( -CG_ouutBužd” -* -ocg -, cÚ¡ -R–©iÚ - & -gu¬ds_š -, cÚ¡ -¡d -:: -veùÜ - & -assigÃd_Ú_the_æy -); - -19 -CG_ouutR•r -* -ouut_as_gu¬d -( -CG_ouutBužd” -* -ocg -, cÚ¡ -R–©iÚ - & -gu¬ds_š -, -CÚ¡¿št_HªdË - -e -, -boÞ - -is_equ®™y -, cÚ¡ -¡d -:: -veùÜ - & -assigÃd_Ú_the_æy -); - -20 -CG_ouutR•r -* -ouut_EQ_¡rides -( -CG_ouutBužd” -* -ocg -, cÚ¡ -R–©iÚ - & -gu¬ds_š -, cÚ¡ -¡d -:: -veùÜ - & -assigÃd_Ú_the_æy -); - -21 -CG_ouutR•r -* -ouut_GEQ_¡rides -( -CG_ouutBužd” -* -ocg -, cÚ¡ -R–©iÚ - & -gu¬ds_š -, cÚ¡ -¡d -:: -veùÜ - & -assigÃd_Ú_the_æy -); - -22 -CG_ouutR•r - * -ouutLBasR•r -( -CG_ouutBužd” -* -ocg -, cÚ¡ -GEQ_HªdË - & -g -, -R–©iÚ - & -bounds -, -V¬ŸbË_ID - -v -, -cÛf_t - -¡ride -, cÚ¡ -EQ_HªdË - & -¡rideEQ -, R–©iÚ -known -, cÚ¡ -¡d -:: -veùÜ - & -assigÃd_Ú_the_æy -); - -23 -CG_ouutR•r - * -ouutUBasR•r -( -CG_ouutBužd” -* -ocg -, cÚ¡ -GEQ_HªdË - & -g -, -R–©iÚ - & -bounds -, -V¬ŸbË_ID - -v -, - -24 -cÛf_t - , - -25 cÚ¡ -EQ_HªdË - & , - -26 cÚ¡ -¡d -:: -veùÜ -< -CG_ouutR•r - *> & -assigÃd_Ú_the_æy - = std::veùÜ( -Ï¡_Ëv– -, -¡©ic_ÿ¡ -( -NULL -))); - -27 -CG_ouutR•r -* -ouutEasyBoundAsR•r -( -CG_ouutBužd” -* -ocg -, -R–©iÚ - & -bounds -, cÚ¡ -CÚ¡¿št_HªdË - & -g -, -V¬ŸbË_ID - -v -, -boÞ - -ignÜeWC -,  -ûžšg -, cÚ¡ -¡d -:: -veùÜ - & -assigÃd_Ú_the_æy -); - -30 -boÞ - -boundH™sSŒide -(cÚ¡ -GEQ_HªdË - & -g -, -V¬ŸbË_ID - -v -, cÚ¡ -EQ_HªdË - & -¡rideEQ -, -cÛf_t - , -R–©iÚ - -known -); - -31 -R–©iÚ - -g»©e¡_commÚ_¡• -(cÚ¡ -Tu¶e - & -I -, cÚ¡ Tu¶e<> & -aùive -,  -Ëv– -, cÚ¡ R–©iÚ & -known - = R–©iÚ:: -NuÎ -()); - -32 -boÞ - -fšdFloÜIÃqu®™y -( -R–©iÚ - & -r -, -V¬ŸbË_ID - -v -, -GEQ_HªdË - & -h -, V¬ŸbË_ID -exþuded -); - -33 -R–©iÚ - -´ojeù_Úto_Ëv–s -(R–©iÚ -R -,  -Ï¡_Ëv– -, -boÞ - -wždÿrds -); - -34 -boÞ - -isSim¶eSŒide -(cÚ¡ -EQ_HªdË - & -g -, -V¬ŸbË_ID - -v -); - -35  -couÁSŒides -( -CÚjunù - * -c -, -V¬ŸbË_ID - -v -, -EQ_HªdË - & -¡rideEQ -, -boÞ - & -sim¶e -); - -36 -boÞ - -hasBound -( -R–©iÚ - -r -,  -Ëv– -,  -UB -); - -37 -boÞ - -fšd_ªy_cÚ¡¿št -( -s -,  -Ëv– -, -R–©iÚ - & -kr -,  -dœeùiÚ -, R–©iÚ & -S -, boÞ -­´ox -); - -38 -boÞ - -has_nÚ¡ride_EQ -( -R–©iÚ - -r -,  -Ëv– -); - -39 -R–©iÚ - -pickOv”h—d -(R–©iÚ -r -,  -liáTo -); - -40 -R–©iÚ - -mšMaxOv”h—d -(R–©iÚ -r -,  -Ëv– -); - -41  -max_fs_¬™y -(cÚ¡ -CÚ¡¿št_HªdË - & -c -); - - @/usr/include/stdio.h - -24 #iâdeà -_STDIO_H - - -26 #ià! -defšed - -__Ãed_FILE - && !defšed -__Ãed___FILE - - -27  - #_STDIO_H - 1 - - ) - -28  - ~<ã©u»s.h -> - -30 - g__BEGIN_DECLS - - -32  - #__Ãed_size_t - - - ) - -33  - #__Ãed_NULL - - - ) - -34  - ~<¡ddef.h -> - -36  - ~ - -37  - #__Ãed_FILE - - - ) - -38  - #__Ãed___FILE - - - ) - -42 #ià! -defšed - -__FILE_defšed - && defšed -__Ãed_FILE - - -45  - g_IO_FILE -; - -47 -__BEGIN_NAMESPACE_STD - - -49  -_IO_FILE - - tFILE -; - -50 - g__END_NAMESPACE_STD - - -51 #ià -defšed - -__USE_LARGEFILE64 - || defšed -__USE_SVID - || defšed -__USE_POSIX - \ - -52 || -defšed - - g__USE_BSD - || defšed - g__USE_ISOC99 - || defšed - g__USE_XOPEN - \ - -53 || -defšed - -__USE_POSIX2 - - -54 - $__USING_NAMESPACE_STD -( -FILE -) - -57  - #__FILE_defšed - 1 - - ) - -59 #undeà -__Ãed_FILE - - -62 #ià! -defšed - -____FILE_defšed - && defšed -__Ãed___FILE - - -65  -_IO_FILE - - t__FILE -; - -67  - #____FILE_defšed - 1 - - ) - -69 #undeà -__Ãed___FILE - - -72 #ifdef -_STDIO_H - - -73  - #_STDIO_USES_IOSTREAM - - - ) - -75  - ~ - -77 #ifdeà -__USE_XOPEN - - -78 #ifdeà -__GNUC__ - - -79 #iâdeà -_VA_LIST_DEFINED - - -80  -_G_va_li¡ - - tva_li¡ -; - -81  - #_VA_LIST_DEFINED - - - ) - -84  - ~<¡d¬g.h -> - -89 -__BEGIN_NAMESPACE_STD - - -90 #iâdeà -__USE_FILE_OFFSET64 - - -91  -_G_åos_t - - tåos_t -; - -93  -_G_åos64_t - - tåos_t -; - -95 -__END_NAMESPACE_STD - - -96 #ifdeà -__USE_LARGEFILE64 - - -97  -_G_åos64_t - - tåos64_t -; - -101  - #_IOFBF - 0 - - ) - -102  - #_IOLBF - 1 - - ) - -103  - #_IONBF - 2 - - ) - -107 #iâdeà -BUFSIZ - - -108  - #BUFSIZ - -_IO_BUFSIZ - - - ) - -114 #iâdeà -EOF - - -115  - #EOF - (-1) - - ) - -121  - #SEEK_SET - 0 - - ) - -122  - #SEEK_CUR - 1 - - ) - -123  - #SEEK_END - 2 - - ) - -126 #ià -defšed - -__USE_SVID - || defšed -__USE_XOPEN - - -128  - #P_tmpdœ - "/tmp" - - ) - -141  - ~ - -145  -_IO_FILE - * -¡dš -; - -146  -_IO_FILE - * -¡dout -; - -147  -_IO_FILE - * -¡d”r -; - -149  - #¡dš - -¡dš - - - ) - -150  - #¡dout - -¡dout - - - ) - -151  - #¡d”r - -¡d”r - - - ) - -153 -__BEGIN_NAMESPACE_STD - - -155  - $»move - ( -__cÚ¡ - * -__fž’ame -è -__THROW -; - -157  - $»Çme - ( -__cÚ¡ - * -__Þd -, __cÚ¡ * -__Ãw -è -__THROW -; - -158 -__END_NAMESPACE_STD - - -160 #ifdeà -__USE_ATFILE - - -162  - $»Çm—t - ( -__Þdfd -, -__cÚ¡ - * -__Þd -,  -__Ãwfd -, - -163 -__cÚ¡ - * -__Ãw -è -__THROW -; - -166 -__BEGIN_NAMESPACE_STD - - -171 #iâdeà -__USE_FILE_OFFSET64 - - -172 -FILE - * - $tmpfže - (è -__wur -; - -174 #ifdeà -__REDIRECT - - -175 -FILE - * - `__REDIRECT - ( -tmpfže -, (), -tmpfže64 -è -__wur -; - -177  - #tmpfže - -tmpfže64 - - - ) - -181 #ifdeà -__USE_LARGEFILE64 - - -182 -FILE - * - $tmpfže64 - (è -__wur -; - -186 * - $tm²am - (* -__s -è -__THROW - -__wur -; - -187 -__END_NAMESPACE_STD - - -189 #ifdeà -__USE_MISC - - -192 * - $tm²am_r - (* -__s -è -__THROW - -__wur -; - -196 #ià -defšed - -__USE_SVID - || defšed -__USE_XOPEN - - -204 * - $‹m²am - ( -__cÚ¡ - * -__dœ -, __cÚ¡ * -__pfx -) - -205 -__THROW - -__©Œibu‹_m®loc__ - -__wur -; - -209 -__BEGIN_NAMESPACE_STD - - -214  - `fþo£ - ( -FILE - * -__¡»am -); - -219  - `fæush - ( -FILE - * -__¡»am -); - -220 -__END_NAMESPACE_STD - - -222 #ifdeà -__USE_MISC - - -229  - `fæush_uÆocked - ( -FILE - * -__¡»am -); - -232 #ifdeà -__USE_GNU - - -239  - `fþo£®l - (); - -243 -__BEGIN_NAMESPACE_STD - - -244 #iâdeà -__USE_FILE_OFFSET64 - - -249 -FILE - * - $fÝ’ - ( -__cÚ¡ - * -__»¡riù - -__fž’ame -, - -250 -__cÚ¡ - * -__»¡riù - -__modes -è -__wur -; - -255 -FILE - * - $äeÝ’ - ( -__cÚ¡ - * -__»¡riù - -__fž’ame -, - -256 -__cÚ¡ - * -__»¡riù - -__modes -, - -257 -FILE - * -__»¡riù - -__¡»am -è -__wur -; - -259 #ifdeà -__REDIRECT - - -260 -FILE - * - `__REDIRECT - ( -fÝ’ -, ( -__cÚ¡ - * -__»¡riù - -__fž’ame -, - -261 -__cÚ¡ - * -__»¡riù - -__modes -), -fÝ’64 -) - -262 -__wur -; - -263 -FILE - * - `__REDIRECT - ( -äeÝ’ -, ( -__cÚ¡ - * -__»¡riù - -__fž’ame -, - -264 -__cÚ¡ - * -__»¡riù - -__modes -, - -265 -FILE - * -__»¡riù - -__¡»am -), -äeÝ’64 -) - -266 -__wur -; - -268  - #fÝ’ - -fÝ’64 - - - ) - -269  - #äeÝ’ - -äeÝ’64 - - - ) - -272 -__END_NAMESPACE_STD - - -273 #ifdeà -__USE_LARGEFILE64 - - -274 -FILE - * - $fÝ’64 - ( -__cÚ¡ - * -__»¡riù - -__fž’ame -, - -275 -__cÚ¡ - * -__»¡riù - -__modes -è -__wur -; - -276 -FILE - * - $äeÝ’64 - ( -__cÚ¡ - * -__»¡riù - -__fž’ame -, - -277 -__cÚ¡ - * -__»¡riù - -__modes -, - -278 -FILE - * -__»¡riù - -__¡»am -è -__wur -; - -281 #ifdef -__USE_POSIX - - -283 -FILE - * - $fdÝ’ - ( -__fd -, -__cÚ¡ - * -__modes -è -__THROW - -__wur -; - -286 #ifdef -__USE_GNU - - -289 -FILE - * - $fÝ’cook› - (* -__»¡riù - -__magic_cook› -, - -290 -__cÚ¡ - * -__»¡riù - -__modes -, - -291 -_IO_cook›_io_funùiÚs_t - -__io_funcs -è -__THROW - -__wur -; - -294 #ifdeà -__USE_XOPEN2K8 - - -296 -FILE - * - $fmemÝ’ - (* -__s -, -size_t - -__Ën -, -__cÚ¡ - * -__modes -) - -297 -__THROW - -__wur -; - -302 -FILE - * - $Ý’_mem¡»am - (** -__buæoc -, -size_t - * -__siz–oc -è -__THROW - -__wur -; - -306 -__BEGIN_NAMESPACE_STD - - -309  - $£tbuf - ( -FILE - * -__»¡riù - -__¡»am -, *__»¡riù -__buf -è -__THROW -; - -313  - $£tvbuf - ( -FILE - * -__»¡riù - -__¡»am -, *__»¡riù -__buf -, - -314  -__modes -, -size_t - -__n -è -__THROW -; - -315 -__END_NAMESPACE_STD - - -317 #ifdef -__USE_BSD - - -320  - $£tbufãr - ( -FILE - * -__»¡riù - -__¡»am -, *__»¡riù -__buf -, - -321 -size_t - -__size -è -__THROW -; - -324  - $£Žšebuf - ( -FILE - * -__¡»am -è -__THROW -; - -328 -__BEGIN_NAMESPACE_STD - - -333  - `årštf - ( -FILE - * -__»¡riù - -__¡»am -, - -334 -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...); - -339  - `´štf - ( -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...); - -341  - $¥rštf - (* -__»¡riù - -__s -, - -342 -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...è -__THROW -; - -348  - `vårštf - ( -FILE - * -__»¡riù - -__s -, -__cÚ¡ - *__»¡riù -__fÜm© -, - -349 -_G_va_li¡ - -__¬g -); - -354  - `v´štf - ( -__cÚ¡ - * -__»¡riù - -__fÜm© -, -_G_va_li¡ - -__¬g -); - -356  - $v¥rštf - (* -__»¡riù - -__s -, -__cÚ¡ - *__»¡riù -__fÜm© -, - -357 -_G_va_li¡ - -__¬g -è -__THROW -; - -358 -__END_NAMESPACE_STD - - -360 #ià -defšed - -__USE_BSD - || defšed -__USE_ISOC99 - || defšed -__USE_UNIX98 - - -361 -__BEGIN_NAMESPACE_C99 - - -363  - $¢´štf - (* -__»¡riù - -__s -, -size_t - -__maxËn -, - -364 -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...) - -365 -__THROW - - `__©Œibu‹__ - (( - `__fÜm©__ - ( -__´štf__ -, 3, 4))); - -367  - $v¢´štf - (* -__»¡riù - -__s -, -size_t - -__maxËn -, - -368 -__cÚ¡ - * -__»¡riù - -__fÜm© -, -_G_va_li¡ - -__¬g -) - -369 -__THROW - - `__©Œibu‹__ - (( - `__fÜm©__ - ( -__´štf__ -, 3, 0))); - -370 -__END_NAMESPACE_C99 - - -373 #ifdeà -__USE_GNU - - -376  - $va¥rštf - (** -__»¡riù - -__±r -, -__cÚ¡ - *__»¡riù -__f -, - -377 -_G_va_li¡ - -__¬g -) - -378 -__THROW - - `__©Œibu‹__ - (( - $__fÜm©__ - ( -__´štf__ -, 2, 0))è -__wur -; - -379  - $__a¥rštf - (** -__»¡riù - -__±r -, - -380 -__cÚ¡ - * -__»¡riù - -__fmt -, ...) - -381 -__THROW - - `__©Œibu‹__ - (( - $__fÜm©__ - ( -__´štf__ -, 2, 3))è -__wur -; - -382  - $a¥rštf - (** -__»¡riù - -__±r -, - -383 -__cÚ¡ - * -__»¡riù - -__fmt -, ...) - -384 -__THROW - - `__©Œibu‹__ - (( - $__fÜm©__ - ( -__´štf__ -, 2, 3))è -__wur -; - -387 #ifdeà -__USE_XOPEN2K8 - - -394  - $vd´štf - ( -__fd -, -__cÚ¡ - * -__»¡riù - -__fmt -, - -395 -_G_va_li¡ - -__¬g -) - -396 - `__©Œibu‹__ - (( - `__fÜm©__ - ( -__´štf__ -, 2, 0))); - -397  - $d´štf - ( -__fd -, -__cÚ¡ - * -__»¡riù - -__fmt -, ...) - -398 - `__©Œibu‹__ - (( - `__fÜm©__ - ( -__´štf__ -, 2, 3))); - -402 -__BEGIN_NAMESPACE_STD - - -407  - $fsÿnf - ( -FILE - * -__»¡riù - -__¡»am -, - -408 -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...è -__wur -; - -413  - $sÿnf - ( -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...è -__wur -; - -415  - $ssÿnf - ( -__cÚ¡ - * -__»¡riù - -__s -, - -416 -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...è -__THROW -; - -418 #ià -defšed - -__USE_ISOC99 - && !defšed -__USE_GNU - \ - -419 && (! -defšed - -__LDBL_COMPAT - || !defšed -__REDIRECT -) \ - -420 && ( -defšed - -__STRICT_ANSI__ - || defšed -__USE_XOPEN2K -) - -421 #ifdeà -__REDIRECT - - -425  - `__REDIRECT - ( -fsÿnf -, ( -FILE - * -__»¡riù - -__¡»am -, - -426 -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...), - -427 -__isoc99_fsÿnf -è -__wur -; - -428  - `__REDIRECT - ( -sÿnf -, ( -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...), - -429 -__isoc99_sÿnf -è -__wur -; - -430  - `__REDIRECT - ( -ssÿnf -, ( -__cÚ¡ - * -__»¡riù - -__s -, - -431 -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...), - -432 -__isoc99_ssÿnf -è -__THROW -; - -434  - $__isoc99_fsÿnf - ( -FILE - * -__»¡riù - -__¡»am -, - -435 -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...è -__wur -; - -436  - $__isoc99_sÿnf - ( -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...è -__wur -; - -437  - $__isoc99_ssÿnf - ( -__cÚ¡ - * -__»¡riù - -__s -, - -438 -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...è -__THROW -; - -439  - #fsÿnf - -__isoc99_fsÿnf - - - ) - -440  - #sÿnf - -__isoc99_sÿnf - - - ) - -441  - #ssÿnf - -__isoc99_ssÿnf - - - ) - -445 -__END_NAMESPACE_STD - - -447 #ifdef -__USE_ISOC99 - - -448 -__BEGIN_NAMESPACE_C99 - - -453  - $vfsÿnf - ( -FILE - * -__»¡riù - -__s -, -__cÚ¡ - *__»¡riù -__fÜm© -, - -454 -_G_va_li¡ - -__¬g -) - -455 - `__©Œibu‹__ - (( - $__fÜm©__ - ( -__sÿnf__ -, 2, 0))è -__wur -; - -461  - $vsÿnf - ( -__cÚ¡ - * -__»¡riù - -__fÜm© -, -_G_va_li¡ - -__¬g -) - -462 - `__©Œibu‹__ - (( - $__fÜm©__ - ( -__sÿnf__ -, 1, 0))è -__wur -; - -465  - $vssÿnf - ( -__cÚ¡ - * -__»¡riù - -__s -, - -466 -__cÚ¡ - * -__»¡riù - -__fÜm© -, -_G_va_li¡ - -__¬g -) - -467 -__THROW - - `__©Œibu‹__ - (( - `__fÜm©__ - ( -__sÿnf__ -, 2, 0))); - -469 #ià! -defšed - -__USE_GNU - \ - -470 && (! -defšed - -__LDBL_COMPAT - || !defšed -__REDIRECT -) \ - -471 && ( -defšed - -__STRICT_ANSI__ - || defšed -__USE_XOPEN2K -) - -472 #ifdeà -__REDIRECT - - -476  - `__REDIRECT - ( -vfsÿnf -, - -477 ( -FILE - * -__»¡riù - -__s -, - -478 -__cÚ¡ - * -__»¡riù - -__fÜm© -, -_G_va_li¡ - -__¬g -), - -479 -__isoc99_vfsÿnf -) - -480 - `__©Œibu‹__ - (( - $__fÜm©__ - ( -__sÿnf__ -, 2, 0))è -__wur -; - -481  - `__REDIRECT - ( -vsÿnf -, ( -__cÚ¡ - * -__»¡riù - -__fÜm© -, - -482 -_G_va_li¡ - -__¬g -), -__isoc99_vsÿnf -) - -483 - `__©Œibu‹__ - (( - $__fÜm©__ - ( -__sÿnf__ -, 1, 0))è -__wur -; - -484  - `__REDIRECT - ( -vssÿnf -, - -485 ( -__cÚ¡ - * -__»¡riù - -__s -, - -486 -__cÚ¡ - * -__»¡riù - -__fÜm© -, -_G_va_li¡ - -__¬g -), - -487 -__isoc99_vssÿnf -) - -488 -__THROW - - `__©Œibu‹__ - (( - `__fÜm©__ - ( -__sÿnf__ -, 2, 0))); - -490  - $__isoc99_vfsÿnf - ( -FILE - * -__»¡riù - -__s -, - -491 -__cÚ¡ - * -__»¡riù - -__fÜm© -, - -492 -_G_va_li¡ - -__¬g -è -__wur -; - -493  - $__isoc99_vsÿnf - ( -__cÚ¡ - * -__»¡riù - -__fÜm© -, - -494 -_G_va_li¡ - -__¬g -è -__wur -; - -495  - $__isoc99_vssÿnf - ( -__cÚ¡ - * -__»¡riù - -__s -, - -496 -__cÚ¡ - * -__»¡riù - -__fÜm© -, - -497 -_G_va_li¡ - -__¬g -è -__THROW -; - -498  - #vfsÿnf - -__isoc99_vfsÿnf - - - ) - -499  - #vsÿnf - -__isoc99_vsÿnf - - - ) - -500  - #vssÿnf - -__isoc99_vssÿnf - - - ) - -504 -__END_NAMESPACE_C99 - - -508 -__BEGIN_NAMESPACE_STD - - -513  - `fg‘c - ( -FILE - * -__¡»am -); - -514  - `g‘c - ( -FILE - * -__¡»am -); - -520  - `g‘ch¬ - (); - -521 -__END_NAMESPACE_STD - - -525  - #g‘c -( -_å -è - `_IO_g‘c - (_å) - - ) - -527 #ià -defšed - -__USE_POSIX - || defšed -__USE_MISC - - -532  - `g‘c_uÆocked - ( -FILE - * -__¡»am -); - -533  - `g‘ch¬_uÆocked - (); - -536 #ifdeà -__USE_MISC - - -543  - `fg‘c_uÆocked - ( -FILE - * -__¡»am -); - -547 -__BEGIN_NAMESPACE_STD - - -555  - `åutc - ( -__c -, -FILE - * -__¡»am -); - -556  - `putc - ( -__c -, -FILE - * -__¡»am -); - -562  - `putch¬ - ( -__c -); - -563 -__END_NAMESPACE_STD - - -567  - #putc -( -_ch -, -_å -è - `_IO_putc - (_ch, _å) - - ) - -569 #ifdeà -__USE_MISC - - -576  - `åutc_uÆocked - ( -__c -, -FILE - * -__¡»am -); - -579 #ià -defšed - -__USE_POSIX - || defšed -__USE_MISC - - -584  - `putc_uÆocked - ( -__c -, -FILE - * -__¡»am -); - -585  - `putch¬_uÆocked - ( -__c -); - -589 #ià -defšed - -__USE_SVID - || defšed -__USE_MISC - \ - -590 || ( -defšed - -__USE_XOPEN - && !defšed -__USE_XOPEN2K -) - -592  - `g‘w - ( -FILE - * -__¡»am -); - -595  - `putw - ( -__w -, -FILE - * -__¡»am -); - -599 -__BEGIN_NAMESPACE_STD - - -604 * - $fg‘s - (* -__»¡riù - -__s -,  -__n -, -FILE - *__»¡riù -__¡»am -) - -605 -__wur -; - -612 * - $g‘s - (* -__s -è -__wur -; - -613 -__END_NAMESPACE_STD - - -615 #ifdeà -__USE_GNU - - -622 * - $fg‘s_uÆocked - (* -__»¡riù - -__s -,  -__n -, - -623 -FILE - * -__»¡riù - -__¡»am -è -__wur -; - -627 #ifdef -__USE_XOPEN2K8 - - -638 -_IO_ssize_t - - $__g‘d–im - (** -__»¡riù - -__lš•Œ -, - -639 -size_t - * -__»¡riù - -__n -,  -__d–im™” -, - -640 -FILE - * -__»¡riù - -__¡»am -è -__wur -; - -641 -_IO_ssize_t - - $g‘d–im - (** -__»¡riù - -__lš•Œ -, - -642 -size_t - * -__»¡riù - -__n -,  -__d–im™” -, - -643 -FILE - * -__»¡riù - -__¡»am -è -__wur -; - -651 -_IO_ssize_t - - $g‘lše - (** -__»¡riù - -__lš•Œ -, - -652 -size_t - * -__»¡riù - -__n -, - -653 -FILE - * -__»¡riù - -__¡»am -è -__wur -; - -657 -__BEGIN_NAMESPACE_STD - - -662  - `åuts - ( -__cÚ¡ - * -__»¡riù - -__s -, -FILE - *__»¡riù -__¡»am -); - -668  - `puts - ( -__cÚ¡ - * -__s -); - -675  - `ung‘c - ( -__c -, -FILE - * -__¡»am -); - -682 -size_t - - $ä—d - (* -__»¡riù - -__±r -, -size_t - -__size -, - -683 -size_t - -__n -, -FILE - * -__»¡riù - -__¡»am -è -__wur -; - -688 -size_t - - `fwr™e - ( -__cÚ¡ - * -__»¡riù - -__±r -, size_ˆ -__size -, - -689 -size_t - -__n -, -FILE - * -__»¡riù - -__s -); - -690 -__END_NAMESPACE_STD - - -692 #ifdeà -__USE_GNU - - -699  - `åuts_uÆocked - ( -__cÚ¡ - * -__»¡riù - -__s -, - -700 -FILE - * -__»¡riù - -__¡»am -); - -703 #ifdeà -__USE_MISC - - -710 -size_t - - $ä—d_uÆocked - (* -__»¡riù - -__±r -, -size_t - -__size -, - -711 -size_t - -__n -, -FILE - * -__»¡riù - -__¡»am -è -__wur -; - -712 -size_t - - `fwr™e_uÆocked - ( -__cÚ¡ - * -__»¡riù - -__±r -, size_ˆ -__size -, - -713 -size_t - -__n -, -FILE - * -__»¡riù - -__¡»am -); - -717 -__BEGIN_NAMESPACE_STD - - -722  - `f£ek - ( -FILE - * -__¡»am -,  -__off -,  -__wh’û -); - -727  - $á–l - ( -FILE - * -__¡»am -è -__wur -; - -732  - `»wšd - ( -FILE - * -__¡»am -); - -733 -__END_NAMESPACE_STD - - -740 #ià -defšed - -__USE_LARGEFILE - || defšed -__USE_XOPEN2K - - -741 #iâdeà -__USE_FILE_OFFSET64 - - -746  - `f£eko - ( -FILE - * -__¡»am -, -__off_t - -__off -,  -__wh’û -); - -751 -__off_t - - $á–lo - ( -FILE - * -__¡»am -è -__wur -; - -753 #ifdeà -__REDIRECT - - -754  - `__REDIRECT - ( -f£eko -, - -755 ( -FILE - * -__¡»am -, -__off64_t - -__off -,  -__wh’û -), - -756 -f£eko64 -); - -757 -__off64_t - - `__REDIRECT - ( -á–lo -, ( -FILE - * -__¡»am -), -á–lo64 -); - -759  - #f£eko - -f£eko64 - - - ) - -760  - #á–lo - -á–lo64 - - - ) - -765 -__BEGIN_NAMESPACE_STD - - -766 #iâdeà -__USE_FILE_OFFSET64 - - -771  - `fg‘pos - ( -FILE - * -__»¡riù - -__¡»am -, -åos_t - *__»¡riù -__pos -); - -776  - `f£os - ( -FILE - * -__¡»am -, -__cÚ¡ - -åos_t - * -__pos -); - -778 #ifdeà -__REDIRECT - - -779  - `__REDIRECT - ( -fg‘pos -, ( -FILE - * -__»¡riù - -__¡»am -, - -780 -åos_t - * -__»¡riù - -__pos -), -fg‘pos64 -); - -781  - `__REDIRECT - ( -f£os -, - -782 ( -FILE - * -__¡»am -, -__cÚ¡ - -åos_t - * -__pos -), -f£os64 -); - -784  - #fg‘pos - -fg‘pos64 - - - ) - -785  - #f£os - -f£os64 - - - ) - -788 -__END_NAMESPACE_STD - - -790 #ifdeà -__USE_LARGEFILE64 - - -791  - `f£eko64 - ( -FILE - * -__¡»am -, -__off64_t - -__off -,  -__wh’û -); - -792 -__off64_t - - $á–lo64 - ( -FILE - * -__¡»am -è -__wur -; - -793  - `fg‘pos64 - ( -FILE - * -__»¡riù - -__¡»am -, -åos64_t - *__»¡riù -__pos -); - -794  - `f£os64 - ( -FILE - * -__¡»am -, -__cÚ¡ - -åos64_t - * -__pos -); - -797 -__BEGIN_NAMESPACE_STD - - -799  - $þ—»¼ - ( -FILE - * -__¡»am -è -__THROW -; - -801  - $ãof - ( -FILE - * -__¡»am -è -__THROW - -__wur -; - -803  - $ã¼Ü - ( -FILE - * -__¡»am -è -__THROW - -__wur -; - -804 -__END_NAMESPACE_STD - - -806 #ifdeà -__USE_MISC - - -808  - $þ—»¼_uÆocked - ( -FILE - * -__¡»am -è -__THROW -; - -809  - $ãof_uÆocked - ( -FILE - * -__¡»am -è -__THROW - -__wur -; - -810  - $ã¼Ü_uÆocked - ( -FILE - * -__¡»am -è -__THROW - -__wur -; - -814 -__BEGIN_NAMESPACE_STD - - -819  - `³¼Ü - ( -__cÚ¡ - * -__s -); - -820 -__END_NAMESPACE_STD - - -826  - ~ - -829 #ifdef -__USE_POSIX - - -831  - $fž’o - ( -FILE - * -__¡»am -è -__THROW - -__wur -; - -834 #ifdeà -__USE_MISC - - -836  - $fž’o_uÆocked - ( -FILE - * -__¡»am -è -__THROW - -__wur -; - -840 #ià( -defšed - -__USE_POSIX2 - || defšed -__USE_SVID - || defšed -__USE_BSD - || \ - -841 -defšed - -__USE_MISC -) - -846 -FILE - * - $pÝ’ - ( -__cÚ¡ - * -__commªd -, __cÚ¡ * -__modes -è -__wur -; - -852  - `pþo£ - ( -FILE - * -__¡»am -); - -856 #ifdef -__USE_POSIX - - -858 * - $ù”mid - (* -__s -è -__THROW -; - -862 #ifdeà -__USE_XOPEN - - -864 * - `cu£rid - (* -__s -); - -868 #ifdef -__USE_GNU - - -869  -ob¡ack -; - -872  - $ob¡ack_´štf - ( -ob¡ack - * -__»¡riù - -__ob¡ack -, - -873 -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...) - -874 -__THROW - - `__©Œibu‹__ - (( - `__fÜm©__ - ( -__´štf__ -, 2, 3))); - -875  - $ob¡ack_v´štf - ( -ob¡ack - * -__»¡riù - -__ob¡ack -, - -876 -__cÚ¡ - * -__»¡riù - -__fÜm© -, - -877 -_G_va_li¡ - -__¬gs -) - -878 -__THROW - - `__©Œibu‹__ - (( - `__fÜm©__ - ( -__´štf__ -, 2, 0))); - -882 #ià -defšed - -__USE_POSIX - || defšed -__USE_MISC - - -886  - $æockfže - ( -FILE - * -__¡»am -è -__THROW -; - -890  - $árylockfže - ( -FILE - * -__¡»am -è -__THROW - -__wur -; - -893  - $fuÆockfže - ( -FILE - * -__¡»am -è -__THROW -; - -896 #ià -defšed - -__USE_XOPEN - && !defšed -__USE_XOPEN2K - && !defšed -__USE_GNU - - -900  - #__Ãed_g‘Ýt - - - ) - -901  - ~ - -906 #ifdeà -__USE_EXTERN_INLINES - - -907  - ~ - -909 #ià -__USE_FORTIFY_LEVEL - > 0 && -defšed - -__ex‹º_®ways_šlše - - -910  - ~ - -912 #ifdeà -__LDBL_COMPAT - - -913  - ~ - -916 -__END_DECLS - - - @/usr/include/bits/stdio-ldbl.h - -20 #iâdeà -_STDIO_H - - -24 -__BEGIN_NAMESPACE_STD - - -25 - $__LDBL_REDIR_DECL - ( -årštf -) - -26 - $__LDBL_REDIR_DECL - ( -´štf -) - -27 - $__LDBL_REDIR_DECL - ( -¥rštf -) - -28 - $__LDBL_REDIR_DECL - ( -vårštf -) - -29 - $__LDBL_REDIR_DECL - ( -v´štf -) - -30 - $__LDBL_REDIR_DECL - ( -v¥rštf -) - -31 #ià -defšed - -__USE_ISOC99 - && !defšed -__USE_GNU - \ - -32 && ! -defšed - -__REDIRECT - \ - -33 && ( -defšed - -__STRICT_ANSI__ - || defšed -__USE_XOPEN2K -) - -34 - $__LDBL_REDIR1_DECL - ( -fsÿnf -, -__Ædbl___isoc99_fsÿnf -) - -35 - $__LDBL_REDIR1_DECL - ( -sÿnf -, -__Ædbl___isoc99_sÿnf -) - -36 - $__LDBL_REDIR1_DECL - ( -ssÿnf -, -__Ædbl___isoc99_ssÿnf -) - -38 - $__LDBL_REDIR_DECL - ( -fsÿnf -) - -39 - $__LDBL_REDIR_DECL - ( -sÿnf -) - -40 - $__LDBL_REDIR_DECL - ( -ssÿnf -) - -42 -__END_NAMESPACE_STD - - -44 #ià -defšed - -__USE_BSD - || defšed -__USE_ISOC99 - || defšed -__USE_UNIX98 - - -45 -__BEGIN_NAMESPACE_C99 - - -46 - $__LDBL_REDIR_DECL - ( -¢´štf -) - -47 - $__LDBL_REDIR_DECL - ( -v¢´štf -) - -48 -__END_NAMESPACE_C99 - - -51 #ifdef -__USE_ISOC99 - - -52 -__BEGIN_NAMESPACE_C99 - - -53 #ià! -defšed - -__USE_GNU - && !defšed -__REDIRECT - \ - -54 && ( -defšed - -__STRICT_ANSI__ - || defšed -__USE_XOPEN2K -) - -55 - $__LDBL_REDIR1_DECL - ( -vfsÿnf -, -__Ædbl___isoc99_vfsÿnf -) - -56 - $__LDBL_REDIR1_DECL - ( -vsÿnf -, -__Ædbl___isoc99_vsÿnf -) - -57 - $__LDBL_REDIR1_DECL - ( -vssÿnf -, -__Ædbl___isoc99_vssÿnf -) - -59 - $__LDBL_REDIR_DECL - ( -vfsÿnf -) - -60 - $__LDBL_REDIR_DECL - ( -vssÿnf -) - -61 - $__LDBL_REDIR_DECL - ( -vsÿnf -) - -63 -__END_NAMESPACE_C99 - - -66 #ifdeà -__USE_GNU - - -67 - $__LDBL_REDIR_DECL - ( -vd´štf -) - -68 - $__LDBL_REDIR_DECL - ( -d´štf -) - -69 - $__LDBL_REDIR_DECL - ( -va¥rštf -) - -70 - $__LDBL_REDIR_DECL - ( -__a¥rštf -) - -71 - $__LDBL_REDIR_DECL - ( -a¥rštf -) - -72 - $__LDBL_REDIR_DECL - ( -ob¡ack_´štf -) - -73 - $__LDBL_REDIR_DECL - ( -ob¡ack_v´štf -) - -76 #ià -__USE_FORTIFY_LEVEL - > 0 && -defšed - -__ex‹º_®ways_šlše - - -77 - $__LDBL_REDIR_DECL - ( -__¥rštf_chk -) - -78 - $__LDBL_REDIR_DECL - ( -__v¥rštf_chk -) - -79 #ià -defšed - -__USE_BSD - || defšed -__USE_ISOC99 - || defšed -__USE_UNIX98 - - -80 - $__LDBL_REDIR_DECL - ( -__¢´štf_chk -) - -81 - $__LDBL_REDIR_DECL - ( -__v¢´štf_chk -) - -83 #ià -__USE_FORTIFY_LEVEL - > 1 - -84 - $__LDBL_REDIR_DECL - ( -__årštf_chk -) - -85 - $__LDBL_REDIR_DECL - ( -__´štf_chk -) - -86 - $__LDBL_REDIR_DECL - ( -__vårštf_chk -) - -87 - $__LDBL_REDIR_DECL - ( -__v´štf_chk -) - -88 #ifdeà -__USE_GNU - - -89 - $__LDBL_REDIR_DECL - ( -__a¥rštf_chk -) - -90 - $__LDBL_REDIR_DECL - ( -__va¥rštf_chk -) - -91 - $__LDBL_REDIR_DECL - ( -__d´štf_chk -) - -92 - $__LDBL_REDIR_DECL - ( -__vd´štf_chk -) - -93 - $__LDBL_REDIR_DECL - ( -__ob¡ack_´štf_chk -) - -94 - $__LDBL_REDIR_DECL - ( -__ob¡ack_v´štf_chk -) - - @/usr/include/bits/stdio.h - -20 #iâdeà -_STDIO_H - - -24 #iâdeà -__ex‹º_šlše - - -25  - #__STDIO_INLINE - -šlše - - - ) - -27  - #__STDIO_INLINE - -__ex‹º_šlše - - - ) - -31 #ifdeà -__USE_EXTERN_INLINES - - -34 #ià!( -__USE_FORTIFY_LEVEL - > 0 && -defšed - -__ex‹º_®ways_šlše -) - -36 -__STDIO_INLINE -  - -37 - $v´štf - ( -__cÚ¡ - * -__»¡riù - -__fmt -, -_G_va_li¡ - -__¬g -) - -39  - `vårštf - ( -¡dout -, -__fmt -, -__¬g -); - -40 - } -} - -44 -__STDIO_INLINE -  - -45 - $g‘ch¬ - () - -47  - `_IO_g‘c - ( -¡dš -); - -48 - } -} - -51 #ifdeà -__USE_MISC - - -53 -__STDIO_INLINE -  - -54 - $fg‘c_uÆocked - ( -FILE - * -__å -) - -56  - `_IO_g‘c_uÆocked - ( -__å -); - -57 - } -} - -61 #ià -defšed - -__USE_POSIX - || defšed -__USE_MISC - - -63 -__STDIO_INLINE -  - -64 - $g‘c_uÆocked - ( -FILE - * -__å -) - -66  - `_IO_g‘c_uÆocked - ( -__å -); - -67 - } -} - -70 -__STDIO_INLINE -  - -71 - $g‘ch¬_uÆocked - () - -73  - `_IO_g‘c_uÆocked - ( -¡dš -); - -74 - } -} - -79 -__STDIO_INLINE -  - -80 - $putch¬ - ( -__c -) - -82  - `_IO_putc - ( -__c -, -¡dout -); - -83 - } -} - -86 #ifdeà -__USE_MISC - - -88 -__STDIO_INLINE -  - -89 - $åutc_uÆocked - ( -__c -, -FILE - * -__¡»am -) - -91  - `_IO_putc_uÆocked - ( -__c -, -__¡»am -); - -92 - } -} - -96 #ià -defšed - -__USE_POSIX - || defšed -__USE_MISC - - -98 -__STDIO_INLINE -  - -99 - $putc_uÆocked - ( -__c -, -FILE - * -__¡»am -) - -101  - `_IO_putc_uÆocked - ( -__c -, -__¡»am -); - -102 - } -} - -105 -__STDIO_INLINE -  - -106 - $putch¬_uÆocked - ( -__c -) - -108  - `_IO_putc_uÆocked - ( -__c -, -¡dout -); - -109 - } -} - -113 #ifdef -__USE_GNU - - -115 -__STDIO_INLINE - -_IO_ssize_t - - -116 - $g‘lše - (** -__lš•Œ -, -size_t - * -__n -, -FILE - * -__¡»am -) - -118  - `__g‘d–im - ( -__lš•Œ -, -__n -, '\n', -__¡»am -); - -119 - } -} - -123 #ifdeà -__USE_MISC - - -125 -__STDIO_INLINE -  - -126 -__NTH - ( - $ãof_uÆocked - ( -FILE - * -__¡»am -)) - -128  - `_IO_ãof_uÆocked - ( -__¡»am -); - -129 - } -} - -132 -__STDIO_INLINE -  - -133 -__NTH - ( - $ã¼Ü_uÆocked - ( -FILE - * -__¡»am -)) - -135  - `_IO_ã¼Ü_uÆocked - ( -__¡»am -); - -136 - } -} - -142 #ià -defšed - -__USE_MISC - && defšed -__GNUC__ - && defšed -__OPTIMIZE__ - \ - -143 && ! -defšed - - g__ýlu¥lus - - -145  - #ä—d_uÆocked -( -±r -, -size -, -n -, -¡»am -) \ - -146 ( - `__ex‹nsiÚ__ - (( - `__bužtš_cÚ¡ªt_p - ( -size -è&& __bužtš_cÚ¡ªt_°( -n -) \ - -147 && ( -size_t -è( -size -è* (size_tè( -n -) <= 8 \ - -148 && ( -size_t -è( -size -) != 0) \ - -149 ? ({ * -__±r - = (*è( -±r -); \ - -150 -FILE - * -__¡»am - = ( -¡»am -); \ - -151 -size_t - -__út -; \ - -152  -__út - = ( -size_t -è( -size -è* (size_tè( -n -); \ - -153 -__út - > 0; --__cnt) \ - -155  -__c - = - `_IO_g‘c_uÆocked - ( -__¡»am -); \ - -156 ià( -__c - =ð -EOF -) \ - -158 * -__±r -++ = -__c -; \ - -160 (( -size_t -è( -size -è* (size_tè( -n -è- -__út -) \ - -161 / ( -size_t -è( -size -); }) \ - -162 : ((( - `__bužtš_cÚ¡ªt_p - ( -size -è&& ( -size_t -) (size) == 0) \ - -163 || ( - `__bužtš_cÚ¡ªt_p - ( -n -è&& ( -size_t -) (n) == 0)) \ - -165 ? ((è( -±r -), (è( -¡»am -), (è( -size -), \ - -166 (è( -n -), ( -size_t -) 0) \ - -167 : - `ä—d_uÆocked - ( -±r -, -size -, -n -, -¡»am -)))) - - ) - -169  - #fwr™e_uÆocked -( -±r -, -size -, -n -, -¡»am -) \ - -170 ( - `__ex‹nsiÚ__ - (( - `__bužtš_cÚ¡ªt_p - ( -size -è&& __bužtš_cÚ¡ªt_°( -n -) \ - -171 && ( -size_t -è( -size -è* (size_tè( -n -) <= 8 \ - -172 && ( -size_t -è( -size -) != 0) \ - -173 ? ({ cÚ¡ * -__±r - = (cÚ¡ *è( -±r -); \ - -174 -FILE - * -__¡»am - = ( -¡»am -); \ - -175 -size_t - -__út -; \ - -176  -__út - = ( -size_t -è( -size -è* (size_tè( -n -); \ - -177 -__út - > 0; --__cnt) \ - -178 ià( - `_IO_putc_uÆocked - (* -__±r -++, -__¡»am -è=ð -EOF -) \ - -180 (( -size_t -è( -size -è* (size_tè( -n -è- -__út -) \ - -181 / ( -size_t -è( -size -); }) \ - -182 : ((( - `__bužtš_cÚ¡ªt_p - ( -size -è&& ( -size_t -) (size) == 0) \ - -183 || ( - `__bužtš_cÚ¡ªt_p - ( -n -è&& ( -size_t -) (n) == 0)) \ - -185 ? ((è( -±r -), (è( -¡»am -), (è( -size -), \ - -186 (è( -n -), ( -size_t -) 0) \ - -187 : - `fwr™e_uÆocked - ( -±r -, -size -, -n -, -¡»am -)))) - - ) - -191 #undeà -__STDIO_INLINE - - - @/usr/include/bits/stdio2.h - -20 #iâdeà -_STDIO_H - - -24  - $__¥rštf_chk - (* -__»¡riù - -__s -,  -__æag -, -size_t - -__¦’ -, - -25 -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...è -__THROW -; - -26  - $__v¥rštf_chk - (* -__»¡riù - -__s -,  -__æag -, -size_t - -__¦’ -, - -27 -__cÚ¡ - * -__»¡riù - -__fÜm© -, - -28 -_G_va_li¡ - -__­ -è -__THROW -; - -30 #ifdeà -__va_¬g_·ck - - -31 -__ex‹º_®ways_šlše -  - -32 - `__NTH - ( - $¥rštf - (* -__»¡riù - -__s -, -__cÚ¡ - *__»¡riù -__fmt -, ...)) - -34  - `__bužtš___¥rštf_chk - ( -__s -, -__USE_FORTIFY_LEVEL - - 1, - -35 - `__bos - ( -__s -), -__fmt -, - `__va_¬g_·ck - ()); - -36 - } -} - -37 #–ià! -defšed - -__ýlu¥lus - - -38  - #¥rštf -( -¡r -, ...) \ - -39 - `__bužtš___¥rštf_chk - ( -¡r -, -__USE_FORTIFY_LEVEL - - 1, - `__bos - (str), \ - -40 -__VA_ARGS__ -) - - ) - -43 -__ex‹º_®ways_šlše -  - -44 -__NTH - ( - $v¥rštf - (* -__»¡riù - -__s -, -__cÚ¡ - *__»¡riù -__fmt -, - -45 -_G_va_li¡ - -__­ -)) - -47  - `__bužtš___v¥rštf_chk - ( -__s -, -__USE_FORTIFY_LEVEL - - 1, - -48 - `__bos - ( -__s -), -__fmt -, -__­ -); - -49 - } -} - -51 #ià -defšed - -__USE_BSD - || defšed -__USE_ISOC99 - || defšed -__USE_UNIX98 - - -53  - $__¢´štf_chk - (* -__»¡riù - -__s -, -size_t - -__n -,  -__æag -, - -54 -size_t - -__¦’ -, -__cÚ¡ - * -__»¡riù - -__fÜm© -, - -55 ...è -__THROW -; - -56  - $__v¢´štf_chk - (* -__»¡riù - -__s -, -size_t - -__n -,  -__æag -, - -57 -size_t - -__¦’ -, -__cÚ¡ - * -__»¡riù - -__fÜm© -, - -58 -_G_va_li¡ - -__­ -è -__THROW -; - -60 #ifdeà -__va_¬g_·ck - - -61 -__ex‹º_®ways_šlše -  - -62 - `__NTH - ( - $¢´štf - (* -__»¡riù - -__s -, -size_t - -__n -, - -63 -__cÚ¡ - * -__»¡riù - -__fmt -, ...)) - -65  - `__bužtš___¢´štf_chk - ( -__s -, -__n -, -__USE_FORTIFY_LEVEL - - 1, - -66 - `__bos - ( -__s -), -__fmt -, - `__va_¬g_·ck - ()); - -67 - } -} - -68 #–ià! -defšed - -__ýlu¥lus - - -69  - #¢´štf -( -¡r -, -Ën -, ...) \ - -70 - `__bužtš___¢´štf_chk - ( -¡r -, -Ën -, -__USE_FORTIFY_LEVEL - - 1, - `__bos - (str), \ - -71 -__VA_ARGS__ -) - - ) - -74 -__ex‹º_®ways_šlše -  - -75 -__NTH - ( - $v¢´štf - (* -__»¡riù - -__s -, -size_t - -__n -, - -76 -__cÚ¡ - * -__»¡riù - -__fmt -, -_G_va_li¡ - -__­ -)) - -78  - `__bužtš___v¢´štf_chk - ( -__s -, -__n -, -__USE_FORTIFY_LEVEL - - 1, - -79 - `__bos - ( -__s -), -__fmt -, -__­ -); - -80 - } -} - -84 #ià -__USE_FORTIFY_LEVEL - > 1 - -86  -__årštf_chk - ( -FILE - * -__»¡riù - -__¡»am -,  -__æag -, - -87 -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...); - -88  -__´štf_chk - ( -__æag -, -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...); - -89  -__vårštf_chk - ( -FILE - * -__»¡riù - -__¡»am -,  -__æag -, - -90 -__cÚ¡ - * -__»¡riù - -__fÜm© -, -_G_va_li¡ - -__­ -); - -91  -__v´štf_chk - ( -__æag -, -__cÚ¡ - * -__»¡riù - -__fÜm© -, - -92 -_G_va_li¡ - -__­ -); - -94 #ifdeà -__va_¬g_·ck - - -95 -__ex‹º_®ways_šlše -  - -96 - $årštf - ( -FILE - * -__»¡riù - -__¡»am -, -__cÚ¡ - *__»¡riù -__fmt -, ...) - -98  - `__årštf_chk - ( -__¡»am -, -__USE_FORTIFY_LEVEL - - 1, -__fmt -, - -99 - `__va_¬g_·ck - ()); - -100 - } -} - -102 -__ex‹º_®ways_šlše -  - -103 - $´štf - ( -__cÚ¡ - * -__»¡riù - -__fmt -, ...) - -105  - `__´štf_chk - ( -__USE_FORTIFY_LEVEL - - 1, -__fmt -, - `__va_¬g_·ck - ()); - -106 - } -} - -107 #–ià! -defšed - -__ýlu¥lus - - -108  - #´štf -(...) \ - -109 - `__´štf_chk - ( -__USE_FORTIFY_LEVEL - - 1, -__VA_ARGS__ -) - - ) - -110  - #årštf -( -¡»am -, ...) \ - -111 - `__årštf_chk - ( -¡»am -, -__USE_FORTIFY_LEVEL - - 1, -__VA_ARGS__ -) - - ) - -114 -__ex‹º_®ways_šlše -  - -115 - $v´štf - ( -__cÚ¡ - * -__»¡riù - -__fmt -, -_G_va_li¡ - -__­ -) - -117 #ifdeà -__USE_EXTERN_INLINES - - -118  - `__vårštf_chk - ( -¡dout -, -__USE_FORTIFY_LEVEL - - 1, -__fmt -, -__­ -); - -120  - `__v´štf_chk - ( -__USE_FORTIFY_LEVEL - - 1, -__fmt -, -__­ -); - -122 - } -} - -124 -__ex‹º_®ways_šlše -  - -125 - $vårštf - ( -FILE - * -__»¡riù - -__¡»am -, - -126 -__cÚ¡ - * -__»¡riù - -__fmt -, -_G_va_li¡ - -__­ -) - -128  - `__vårštf_chk - ( -__¡»am -, -__USE_FORTIFY_LEVEL - - 1, -__fmt -, -__­ -); - -129 - } -} - -131 #ifdeà -__USE_GNU - - -133  - $__a¥rštf_chk - (** -__»¡riù - -__±r -,  -__æag -, - -134 -__cÚ¡ - * -__»¡riù - -__fmt -, ...) - -135 -__THROW - - `__©Œibu‹__ - (( - $__fÜm©__ - ( -__´štf__ -, 3, 4))è -__wur -; - -136  - $__va¥rštf_chk - (** -__»¡riù - -__±r -,  -__æag -, - -137 -__cÚ¡ - * -__»¡riù - -__fmt -, -_G_va_li¡ - -__¬g -) - -138 -__THROW - - `__©Œibu‹__ - (( - $__fÜm©__ - ( -__´štf__ -, 3, 0))è -__wur -; - -139  - $__d´štf_chk - ( -__fd -,  -__æag -, -__cÚ¡ - * -__»¡riù - -__fmt -, - -140 ...è - `__©Œibu‹__ - (( - `__fÜm©__ - ( -__´štf__ -, 3, 4))); - -141  - $__vd´štf_chk - ( -__fd -,  -__æag -, - -142 -__cÚ¡ - * -__»¡riù - -__fmt -, -_G_va_li¡ - -__¬g -) - -143 - `__©Œibu‹__ - (( - `__fÜm©__ - ( -__´štf__ -, 3, 0))); - -144  - $__ob¡ack_´štf_chk - ( -ob¡ack - * -__»¡riù - -__ob¡ack -, - -145  -__æag -, -__cÚ¡ - * -__»¡riù - -__fÜm© -, - -147 -__THROW - - `__©Œibu‹__ - (( - `__fÜm©__ - ( -__´štf__ -, 3, 4))); - -148  - $__ob¡ack_v´štf_chk - ( -ob¡ack - * -__»¡riù - -__ob¡ack -, - -149  -__æag -, - -150 -__cÚ¡ - * -__»¡riù - -__fÜm© -, - -151 -_G_va_li¡ - -__¬gs -) - -152 -__THROW - - `__©Œibu‹__ - (( - `__fÜm©__ - ( -__´štf__ -, 3, 0))); - -154 #ifdeà -__va_¬g_·ck - - -155 -__ex‹º_®ways_šlše -  - -156 - `__NTH - ( - $a¥rštf - (** -__»¡riù - -__±r -, -__cÚ¡ - *__»¡riù -__fmt -, ...)) - -158  - `__a¥rštf_chk - ( -__±r -, -__USE_FORTIFY_LEVEL - - 1, -__fmt -, - -159 - `__va_¬g_·ck - ()); - -160 - } -} - -162 -__ex‹º_®ways_šlše -  - -163 -__NTH - ( - $__a¥rštf - (** -__»¡riù - -__±r -, -__cÚ¡ - *__»¡riù -__fmt -, - -166  - `__a¥rštf_chk - ( -__±r -, -__USE_FORTIFY_LEVEL - - 1, -__fmt -, - -167 - `__va_¬g_·ck - ()); - -168 - } -} - -170 -__ex‹º_®ways_šlše -  - -171 - $d´štf - ( -__fd -, -__cÚ¡ - * -__»¡riù - -__fmt -, ...) - -173  - `__d´štf_chk - ( -__fd -, -__USE_FORTIFY_LEVEL - - 1, -__fmt -, - -174 - `__va_¬g_·ck - ()); - -175 - } -} - -177 -__ex‹º_®ways_šlše -  - -178 -__NTH - ( - $ob¡ack_´štf - ( -ob¡ack - * -__»¡riù - -__ob¡ack -, - -179 -__cÚ¡ - * -__»¡riù - -__fmt -, ...)) - -181  - `__ob¡ack_´štf_chk - ( -__ob¡ack -, -__USE_FORTIFY_LEVEL - - 1, -__fmt -, - -182 - `__va_¬g_·ck - ()); - -183 - } -} - -184 #–ià! -defšed - -__ýlu¥lus - - -185  - #a¥rštf -( -±r -, ...) \ - -186 - `__a¥rštf_chk - ( -±r -, -__USE_FORTIFY_LEVEL - - 1, -__VA_ARGS__ -) - - ) - -187  - #__a¥rštf -( -±r -, ...) \ - -188 - `__a¥rštf_chk - ( -±r -, -__USE_FORTIFY_LEVEL - - 1, -__VA_ARGS__ -) - - ) - -189  - #d´štf -( -fd -, ...) \ - -190 - `__d´štf_chk - ( -fd -, -__USE_FORTIFY_LEVEL - - 1, -__VA_ARGS__ -) - - ) - -191  - #ob¡ack_´štf -( -ob¡ack -, ...) \ - -192 - `__ob¡ack_´štf_chk - ( -ob¡ack -, -__USE_FORTIFY_LEVEL - - 1, -__VA_ARGS__ -) - - ) - -195 -__ex‹º_®ways_šlše -  - -196 -__NTH - ( - $va¥rštf - (** -__»¡riù - -__±r -, -__cÚ¡ - *__»¡riù -__fmt -, - -197 -_G_va_li¡ - -__­ -)) - -199  - `__va¥rštf_chk - ( -__±r -, -__USE_FORTIFY_LEVEL - - 1, -__fmt -, -__­ -); - -200 - } -} - -202 -__ex‹º_®ways_šlše -  - -203 - $vd´štf - ( -__fd -, -__cÚ¡ - * -__»¡riù - -__fmt -, -_G_va_li¡ - -__­ -) - -205  - `__vd´štf_chk - ( -__fd -, -__USE_FORTIFY_LEVEL - - 1, -__fmt -, -__­ -); - -206 - } -} - -208 -__ex‹º_®ways_šlše -  - -209 -__NTH - ( - $ob¡ack_v´štf - ( -ob¡ack - * -__»¡riù - -__ob¡ack -, - -210 -__cÚ¡ - * -__»¡riù - -__fmt -, -_G_va_li¡ - -__­ -)) - -212  - `__ob¡ack_v´štf_chk - ( -__ob¡ack -, -__USE_FORTIFY_LEVEL - - 1, -__fmt -, - -213 -__­ -); - -214 - } -} - -220 * - $__g‘s_chk - (* -__¡r -, -size_t -è -__wur -; - -221 * - `__REDIRECT - ( -__g‘s_w¬n -, (* -__¡r -), -g‘s -) - -222 -__wur - - `__w¬Ç‰r - ("please use fgets or getline instead, gets can't " - -225 -__ex‹º_®ways_šlše - -__wur - * - -226 - $g‘s - (* -__¡r -) - -228 ià( - `__bos - ( -__¡r -è!ð( -size_t -) -1) - -229  - `__g‘s_chk - ( -__¡r -, - `__bos - (__str)); - -230  - `__g‘s_w¬n - ( -__¡r -); - -231 - } -} - -233 * - $__fg‘s_chk - (* -__»¡riù - -__s -, -size_t - -__size -,  -__n -, - -234 -FILE - * -__»¡riù - -__¡»am -è -__wur -; - -235 * - `__REDIRECT - ( -__fg‘s_®Ÿs -, - -236 (* -__»¡riù - -__s -,  -__n -, - -237 -FILE - * -__»¡riù - -__¡»am -), -fg‘s -è -__wur -; - -238 * - `__REDIRECT - ( -__fg‘s_chk_w¬n -, - -239 (* -__»¡riù - -__s -, -size_t - -__size -,  -__n -, - -240 -FILE - * -__»¡riù - -__¡»am -), -__fg‘s_chk -) - -241 -__wur - - `__w¬Ç‰r - ("fgets called with bigger sizehan†ength " - -244 -__ex‹º_®ways_šlše - -__wur - * - -245 - $fg‘s - (* -__»¡riù - -__s -,  -__n -, -FILE - *__»¡riù -__¡»am -) - -247 ià( - `__bos - ( -__s -è!ð( -size_t -) -1) - -249 ià(! - `__bužtš_cÚ¡ªt_p - ( -__n -) || __n <= 0) - -250  - `__fg‘s_chk - ( -__s -, - `__bos - (__s), -__n -, -__¡»am -); - -252 ià(( -size_t -è -__n - > - `__bos - ( -__s -)) - -253  - `__fg‘s_chk_w¬n - ( -__s -, - `__bos - (__s), -__n -, -__¡»am -); - -255  - `__fg‘s_®Ÿs - ( -__s -, -__n -, -__¡»am -); - -256 - } -} - -258 -size_t - - $__ä—d_chk - (* -__»¡riù - -__±r -, -size_t - -__±¾’ -, - -259 -size_t - -__size -, size_ˆ -__n -, - -260 -FILE - * -__»¡riù - -__¡»am -è -__wur -; - -261 -size_t - - `__REDIRECT - ( -__ä—d_®Ÿs -, - -262 (* -__»¡riù - -__±r -, -size_t - -__size -, - -263 -size_t - -__n -, -FILE - * -__»¡riù - -__¡»am -), - -264 -ä—d -è -__wur -; - -265 -size_t - - `__REDIRECT - ( -__ä—d_chk_w¬n -, - -266 (* -__»¡riù - -__±r -, -size_t - -__±¾’ -, - -267 -size_t - -__size -, size_ˆ -__n -, - -268 -FILE - * -__»¡riù - -__¡»am -), - -269 -__ä—d_chk -) - -270 -__wur - - `__w¬Ç‰r - ("fread called with bigger size *‚membhan†ength " - -273 -__ex‹º_®ways_šlše - -__wur - -size_t - - -274 - $ä—d - (* -__»¡riù - -__±r -, -size_t - -__size -, size_ˆ -__n -, - -275 -FILE - * -__»¡riù - -__¡»am -) - -277 ià( - `__bos0 - ( -__±r -è!ð( -size_t -) -1) - -279 ià(! - `__bužtš_cÚ¡ªt_p - ( -__size -) - -280 || ! - `__bužtš_cÚ¡ªt_p - ( -__n -) - -281 || ( -__size - | -__n -è>ð((( -size_t -) 1) << (8 *  (size_t) / 2))) - -282  - `__ä—d_chk - ( -__±r -, - `__bos0 - (__±r), -__size -, -__n -, -__¡»am -); - -284 ià( -__size - * -__n - > - `__bos0 - ( -__±r -)) - -285  - `__ä—d_chk_w¬n - ( -__±r -, - `__bos0 - (__±r), -__size -, -__n -, -__¡»am -); - -287  - `__ä—d_®Ÿs - ( -__±r -, -__size -, -__n -, -__¡»am -); - -288 - } -} - -290 #ifdeà -__USE_GNU - - -291 * - $__fg‘s_uÆocked_chk - (* -__»¡riù - -__s -, -size_t - -__size -, - -292  -__n -, -FILE - * -__»¡riù - -__¡»am -è -__wur -; - -293 * - `__REDIRECT - ( -__fg‘s_uÆocked_®Ÿs -, - -294 (* -__»¡riù - -__s -,  -__n -, - -295 -FILE - * -__»¡riù - -__¡»am -), -fg‘s_uÆocked -è -__wur -; - -296 * - `__REDIRECT - ( -__fg‘s_uÆocked_chk_w¬n -, - -297 (* -__»¡riù - -__s -, -size_t - -__size -,  -__n -, - -298 -FILE - * -__»¡riù - -__¡»am -), -__fg‘s_uÆocked_chk -) - -299 -__wur - - `__w¬Ç‰r - ("fgets_unlocked called with bigger sizehan†ength " - -302 -__ex‹º_®ways_šlše - -__wur - * - -303 - $fg‘s_uÆocked - (* -__»¡riù - -__s -,  -__n -, -FILE - *__»¡riù -__¡»am -) - -305 ià( - `__bos - ( -__s -è!ð( -size_t -) -1) - -307 ià(! - `__bužtš_cÚ¡ªt_p - ( -__n -) || __n <= 0) - -308  - `__fg‘s_uÆocked_chk - ( -__s -, - `__bos - (__s), -__n -, -__¡»am -); - -310 ià(( -size_t -è -__n - > - `__bos - ( -__s -)) - -311  - `__fg‘s_uÆocked_chk_w¬n - ( -__s -, - `__bos - (__s), -__n -, -__¡»am -); - -313  - `__fg‘s_uÆocked_®Ÿs - ( -__s -, -__n -, -__¡»am -); - -314 - } -} - -317 #ifdeà -__USE_MISC - - -318 #undeà -ä—d_uÆocked - - -319 -size_t - - $__ä—d_uÆocked_chk - (* -__»¡riù - -__±r -, -size_t - -__±¾’ -, - -320 -size_t - -__size -, size_ˆ -__n -, - -321 -FILE - * -__»¡riù - -__¡»am -è -__wur -; - -322 -size_t - - `__REDIRECT - ( -__ä—d_uÆocked_®Ÿs -, - -323 (* -__»¡riù - -__±r -, -size_t - -__size -, - -324 -size_t - -__n -, -FILE - * -__»¡riù - -__¡»am -), - -325 -ä—d_uÆocked -è -__wur -; - -326 -size_t - - `__REDIRECT - ( -__ä—d_uÆocked_chk_w¬n -, - -327 (* -__»¡riù - -__±r -, -size_t - -__±¾’ -, - -328 -size_t - -__size -, size_ˆ -__n -, - -329 -FILE - * -__»¡riù - -__¡»am -), - -330 -__ä—d_uÆocked_chk -) - -331 -__wur - - `__w¬Ç‰r - ("fread_unlocked called with bigger size *‚membhan " - -334 -__ex‹º_®ways_šlše - -__wur - -size_t - - -335 - $ä—d_uÆocked - (* -__»¡riù - -__±r -, -size_t - -__size -, size_ˆ -__n -, - -336 -FILE - * -__»¡riù - -__¡»am -) - -338 ià( - `__bos0 - ( -__±r -è!ð( -size_t -) -1) - -340 ià(! - `__bužtš_cÚ¡ªt_p - ( -__size -) - -341 || ! - `__bužtš_cÚ¡ªt_p - ( -__n -) - -342 || ( -__size - | -__n -è>ð((( -size_t -) 1) << (8 *  (size_t) / 2))) - -343  - `__ä—d_uÆocked_chk - ( -__±r -, - `__bos0 - (__±r), -__size -, -__n -, - -344 -__¡»am -); - -346 ià( -__size - * -__n - > - `__bos0 - ( -__±r -)) - -347  - `__ä—d_uÆocked_chk_w¬n - ( -__±r -, - `__bos0 - (__±r), -__size -, -__n -, - -348 -__¡»am -); - -351 #ifdeà -__USE_EXTERN_INLINES - - -352 ià( - `__bužtš_cÚ¡ªt_p - ( -__size -) - -353 && - `__bužtš_cÚ¡ªt_p - ( -__n -) - -354 && ( -__size - | -__n -è< ((( -size_t -) 1) << (8 *  (size_t) / 2)) - -355 && -__size - * -__n - <= 8) - -357 -size_t - -__út - = -__size - * -__n -; - -358 * -__ýŒ - = (*è -__±r -; - -359 ià( -__út - == 0) - -362 ; -__út - > 0; --__cnt) - -364  -__c - = - `_IO_g‘c_uÆocked - ( -__¡»am -); - -365 ià( -__c - =ð -EOF -) - -367 * -__ýŒ -++ = -__c -; - -369  ( -__ýŒ - - (*è -__±r -è/ -__size -; - -372  - `__ä—d_uÆocked_®Ÿs - ( -__±r -, -__size -, -__n -, -__¡»am -); - -373 - } -} - - @/usr/include/bits/stdio_lim.h - -19 #ià! -defšed - -_STDIO_H - && !defšed -__Ãed_FOPEN_MAX - && !defšed -__Ãed_IOV_MAX - - -23 #ifdeà -_STDIO_H - - -24  - #L_tm²am - 20 - - ) - -25  - #TMP_MAX - 238328 - - ) - -26  - #FILENAME_MAX - 4096 - - ) - -28 #ifdeà -__USE_POSIX - - -29  - #L_ù”mid - 9 - - ) - -30 #ià! -defšed - -__USE_XOPEN2K - || defšed -__USE_GNU - - -31  - #L_cu£rid - 9 - - ) - -36 #ià -defšed - -__Ãed_FOPEN_MAX - || defšed -_STDIO_H - - -37 #undeà -FOPEN_MAX - - -38  - #FOPEN_MAX - 16 - - ) - -41 #ià -defšed - -__Ãed_IOV_MAX - && !defšed -IOV_MAX - - -42  - #IOV_MAX - 1024 - - ) - - @/usr/include/bits/sys_errlist.h - -20 #iâdeà -_STDIO_H - - -26 #ifdeà -__USE_BSD - - -27  -sys_ü -; - -28 -__cÚ¡ - *__cÚ¡ -sys_”¾i¡ -[]; - -30 #ifdeà -__USE_GNU - - -31  -_sys_ü -; - -32 -__cÚ¡ - *__cÚ¡ -_sys_”¾i¡ -[]; - - @/usr/include/bits/types.h - -24 #iâdef -_BITS_TYPES_H - - -25  - #_BITS_TYPES_H - 1 - - ) - -27  - ~<ã©u»s.h -> - -28  - ~ - -31  - t__u_ch¬ -; - -32  - t__u_shÜt -; - -33  - t__u_št -; - -34  - t__u_lÚg -; - -37 sigÃd  - t__št8_t -; - -38  - t__ušt8_t -; - -39 sigÃd  - t__št16_t -; - -40  - t__ušt16_t -; - -41 sigÃd  - t__št32_t -; - -42  - t__ušt32_t -; - -43 #ià -__WORDSIZE - == 64 - -44 sigÃd  - t__št64_t -; - -45  - t__ušt64_t -; - -46 #–ià -defšed - -__GLIBC_HAVE_LONG_LONG - - -47 -__ex‹nsiÚ__ - sigÃd  - t__št64_t -; - -48 -__ex‹nsiÚ__ -  - t__ušt64_t -; - -52 #ià -__WORDSIZE - == 64 - -53  - t__quad_t -; - -54  - t__u_quad_t -; - -55 #–ià -defšed - -__GLIBC_HAVE_LONG_LONG - - -56 -__ex‹nsiÚ__ -  - t__quad_t -; - -57 -__ex‹nsiÚ__ -  - t__u_quad_t -; - -61  - m__v® -[2]; - -62 } - t__quad_t -; - -65 -__u_lÚg - - m__v® -[2]; - -66 } - t__u_quad_t -; - -99  - #__S16_TYPE -  - - ) - -100  - #__U16_TYPE -  - - ) - -101  - #__S32_TYPE -  - - ) - -102  - #__U32_TYPE -  - - ) - -103  - #__SLONGWORD_TYPE -  - - ) - -104  - #__ULONGWORD_TYPE -  - - ) - -105 #ià -__WORDSIZE - == 32 - -106  - #__SQUAD_TYPE - -__quad_t - - - ) - -107  - #__UQUAD_TYPE - -__u_quad_t - - - ) - -108  - #__SWORD_TYPE -  - - ) - -109  - #__UWORD_TYPE -  - - ) - -110  - #__SLONG32_TYPE -  - - ) - -111  - #__ULONG32_TYPE -  - - ) - -112  - #__S64_TYPE - -__quad_t - - - ) - -113  - #__U64_TYPE - -__u_quad_t - - - ) - -116  - #__STD_TYPE - -__ex‹nsiÚ__ -  - - ) - -117 #–ià -__WORDSIZE - == 64 - -118  - t__SQUAD_TYPE -  - - ) - -119  - t__UQUAD_TYPE -  - - ) - -120  - t__SWORD_TYPE -  - - ) - -121  - t__UWORD_TYPE -  - - ) - -122  - t__SLONG32_TYPE -  - - ) - -123  - t__ULONG32_TYPE -  - - ) - -124  - t__S64_TYPE -  - - ) - -125  - t__U64_TYPE -  - - ) - -127  - t__STD_TYPE -  - - ) - -131  - ~ - -134 -__STD_TYPE - - t__DEV_T_TYPE - - t__dev_t -; - -135 -__STD_TYPE - -__UID_T_TYPE - - g__uid_t -; - -136 -__STD_TYPE - -__GID_T_TYPE - - g__gid_t -; - -137 -__STD_TYPE - -__INO_T_TYPE - - g__šo_t -; - -138 -__STD_TYPE - -__INO64_T_TYPE - - g__šo64_t -; - -139 -__STD_TYPE - -__MODE_T_TYPE - - g__mode_t -; - -140 -__STD_TYPE - -__NLINK_T_TYPE - - g__Æšk_t -; - -141 -__STD_TYPE - -__OFF_T_TYPE - - g__off_t -; - -142 -__STD_TYPE - -__OFF64_T_TYPE - - g__off64_t -; - -143 -__STD_TYPE - -__PID_T_TYPE - - g__pid_t -; - -144 -__STD_TYPE - -__FSID_T_TYPE - - g__fsid_t -; - -145 -__STD_TYPE - -__CLOCK_T_TYPE - - g__þock_t -; - -146 -__STD_TYPE - -__RLIM_T_TYPE - - g__¾im_t -; - -147 -__STD_TYPE - -__RLIM64_T_TYPE - - g__¾im64_t -; - -148 -__STD_TYPE - -__ID_T_TYPE - - g__id_t -; - -149 -__STD_TYPE - -__TIME_T_TYPE - - g__time_t -; - -150 -__STD_TYPE - -__USECONDS_T_TYPE - - g__u£cÚds_t -; - -151 -__STD_TYPE - -__SUSECONDS_T_TYPE - - g__su£cÚds_t -; - -153 -__STD_TYPE - -__DADDR_T_TYPE - - g__daddr_t -; - -154 -__STD_TYPE - -__SWBLK_T_TYPE - - g__swblk_t -; - -155 -__STD_TYPE - -__KEY_T_TYPE - - g__key_t -; - -158 -__STD_TYPE - -__CLOCKID_T_TYPE - - g__þockid_t -; - -161 -__STD_TYPE - -__TIMER_T_TYPE - - g__tim”_t -; - -164 -__STD_TYPE - -__BLKSIZE_T_TYPE - - g__blksize_t -; - -169 -__STD_TYPE - -__BLKCNT_T_TYPE - - g__blkút_t -; - -170 -__STD_TYPE - -__BLKCNT64_T_TYPE - - g__blkút64_t -; - -173 -__STD_TYPE - -__FSBLKCNT_T_TYPE - - g__fsblkút_t -; - -174 -__STD_TYPE - -__FSBLKCNT64_T_TYPE - - g__fsblkút64_t -; - -177 -__STD_TYPE - -__FSFILCNT_T_TYPE - - g__fsfžút_t -; - -178 -__STD_TYPE - -__FSFILCNT64_T_TYPE - - g__fsfžút64_t -; - -180 -__STD_TYPE - -__SSIZE_T_TYPE - - g__ssize_t -; - -184  -__off64_t - - t__loff_t -; - -185  -__quad_t - * - t__qaddr_t -; - -186 * - t__ÿddr_t -; - -189 -__STD_TYPE - -__SWORD_TYPE - - g__šŒ_t -; - -192 -__STD_TYPE - -__U32_TYPE - - g__sockËn_t -; - -195 #undeà -__STD_TYPE - - - @/usr/include/features.h - -19 #iâdef -_FEATURES_H - - -20  - #_FEATURES_H - 1 - - ) - -95 #undeà -__USE_ISOC99 - - -96 #undeà -__USE_ISOC95 - - -97 #undeà -__USE_POSIX - - -98 #undeà -__USE_POSIX2 - - -99 #undeà -__USE_POSIX199309 - - -100 #undeà -__USE_POSIX199506 - - -101 #undeà -__USE_XOPEN - - -102 #undeà -__USE_XOPEN_EXTENDED - - -103 #undeà -__USE_UNIX98 - - -104 #undeà -__USE_XOPEN2K - - -105 #undeà -__USE_XOPEN2K8 - - -106 #undeà -__USE_LARGEFILE - - -107 #undeà -__USE_LARGEFILE64 - - -108 #undeà -__USE_FILE_OFFSET64 - - -109 #undeà -__USE_BSD - - -110 #undeà -__USE_SVID - - -111 #undeà -__USE_MISC - - -112 #undeà -__USE_ATFILE - - -113 #undeà -__USE_GNU - - -114 #undeà -__USE_REENTRANT - - -115 #undeà -__USE_FORTIFY_LEVEL - - -116 #undeà -__FAVOR_BSD - - -117 #undeà -__KERNEL_STRICT_NAMES - - -121 #iâdeà -_LOOSE_KERNEL_NAMES - - -122  - #__KERNEL_STRICT_NAMES - - - ) - -126  - #__USE_ANSI - 1 - - ) - -135 #ià -defšed - -__GNUC__ - && defšed -__GNUC_MINOR__ - - -136  - #__GNUC_PREREQ -( -maj -, -mš -) \ - -137 (( -__GNUC__ - << 16è+ -__GNUC_MINOR__ - >ð(( -maj -è<< 16è+ ( -mš -)) - - ) - -139  - #__GNUC_PREREQ -( -maj -, -mš -è0 - - ) - -144 #ià -defšed - -_BSD_SOURCE - && \ - -145 !( -defšed - - g_POSIX_SOURCE - || defšed - g_POSIX_C_SOURCE - || \ - -146 -defšed - - g_XOPEN_SOURCE - || defšed - g_XOPEN_SOURCE_EXTENDED - || \ - -147 -defšed - - g_GNU_SOURCE - || defšed - g_SVID_SOURCE -) - -148  - #__FAVOR_BSD - 1 - - ) - -152 #ifdeà -_GNU_SOURCE - - -153 #undeà -_ISOC99_SOURCE - - -154  - #_ISOC99_SOURCE - 1 - - ) - -155 #undeà -_POSIX_SOURCE - - -156  - #_POSIX_SOURCE - 1 - - ) - -157 #undeà -_POSIX_C_SOURCE - - -158  - #_POSIX_C_SOURCE - 200809L - - ) - -159 #undeà -_XOPEN_SOURCE - - -160  - #_XOPEN_SOURCE - 700 - - ) - -161 #undeà -_XOPEN_SOURCE_EXTENDED - - -162  - #_XOPEN_SOURCE_EXTENDED - 1 - - ) - -163 #undeà -_LARGEFILE64_SOURCE - - -164  - #_LARGEFILE64_SOURCE - 1 - - ) - -165 #undeà -_BSD_SOURCE - - -166  - #_BSD_SOURCE - 1 - - ) - -167 #undeà -_SVID_SOURCE - - -168  - #_SVID_SOURCE - 1 - - ) - -169 #undeà -_ATFILE_SOURCE - - -170  - #_ATFILE_SOURCE - 1 - - ) - -175 #ià(! -defšed - -__STRICT_ANSI__ - && !defšed -_ISOC99_SOURCE - && \ - -176 ! -defšed - - g_POSIX_SOURCE - && !defšed - g_POSIX_C_SOURCE - && \ - -177 ! -defšed - - g_XOPEN_SOURCE - && !defšed - g_XOPEN_SOURCE_EXTENDED - && \ - -178 ! -defšed - - g_BSD_SOURCE - && !defšed - g_SVID_SOURCE -) - -179  - #_BSD_SOURCE - 1 - - ) - -180  - #_SVID_SOURCE - 1 - - ) - -187 #ià( -defšed - -_ISOC99_SOURCE - || defšed -_ISOC9X_SOURCE - \ - -188 || ( -defšed - - g__STDC_VERSION__ - && __STDC_VERSION__ >= 199901L)) - -189  - #__USE_ISOC99 - 1 - - ) - -193 #ià( -defšed - -_ISOC99_SOURCE - || defšed -_ISOC9X_SOURCE - \ - -194 || ( -defšed - -__STDC_VERSION__ - && __STDC_VERSION__ >= 199409L)) - -195  - #__USE_ISOC95 - 1 - - ) - -200 #ià((! -defšed - -__STRICT_ANSI__ - || ( -_XOPEN_SOURCE - - 0) >= 500) && \ - -201 ! -defšed - -_POSIX_SOURCE - && !defšed -_POSIX_C_SOURCE -) - -202  - #_POSIX_SOURCE - 1 - - ) - -203 #ià -defšed - -_XOPEN_SOURCE - && (_XOPEN_SOURCE - 0) < 500 - -204  - #_POSIX_C_SOURCE - 2 - - ) - -205 #–ià -defšed - -_XOPEN_SOURCE - && (_XOPEN_SOURCE - 0) < 600 - -206  - #_POSIX_C_SOURCE - 199506L - - ) - -207 #–ià -defšed - -_XOPEN_SOURCE - && (_XOPEN_SOURCE - 0) < 700 - -208  - #_POSIX_C_SOURCE - 200112L - - ) - -210  - #_POSIX_C_SOURCE - 200809L - - ) - -212  - #__USE_POSIX_IMPLICITLY - 1 - - ) - -215 #ià -defšed - -_POSIX_SOURCE - || -_POSIX_C_SOURCE - >ð1 || defšed -_XOPEN_SOURCE - - -216  - #__USE_POSIX - 1 - - ) - -219 #ià -defšed - -_POSIX_C_SOURCE - && _POSIX_C_SOURCE >ð2 || defšed -_XOPEN_SOURCE - - -220  - #__USE_POSIX2 - 1 - - ) - -223 #ià( -_POSIX_C_SOURCE - - 0) >= 199309L - -224  - #__USE_POSIX199309 - 1 - - ) - -227 #ià( -_POSIX_C_SOURCE - - 0) >= 199506L - -228  - #__USE_POSIX199506 - 1 - - ) - -231 #ià( -_POSIX_C_SOURCE - - 0) >= 200112L - -232  - #__USE_XOPEN2K - 1 - - ) - -233 #undeà -__USE_ISOC99 - - -234  - #__USE_ISOC99 - 1 - - ) - -237 #ià( -_POSIX_C_SOURCE - - 0) >= 200809L - -238  - #__USE_XOPEN2K8 - 1 - - ) - -239 #undeà -_ATFILE_SOURCE - - -240  - #_ATFILE_SOURCE - 1 - - ) - -243 #ifdef -_XOPEN_SOURCE - - -244  - #__USE_XOPEN - 1 - - ) - -245 #ià( -_XOPEN_SOURCE - - 0) >= 500 - -246  - #__USE_XOPEN_EXTENDED - 1 - - ) - -247  - #__USE_UNIX98 - 1 - - ) - -248 #undeà -_LARGEFILE_SOURCE - - -249  - #_LARGEFILE_SOURCE - 1 - - ) - -250 #ià( -_XOPEN_SOURCE - - 0) >= 600 - -251 #ià( -_XOPEN_SOURCE - - 0) >= 700 - -252  - #__USE_XOPEN2K8 - 1 - - ) - -254  - #__USE_XOPEN2K - 1 - - ) - -255 #undeà -__USE_ISOC99 - - -256  - #__USE_ISOC99 - 1 - - ) - -259 #ifdeà -_XOPEN_SOURCE_EXTENDED - - -260  - #__USE_XOPEN_EXTENDED - 1 - - ) - -265 #ifdeà -_LARGEFILE_SOURCE - - -266  - #__USE_LARGEFILE - 1 - - ) - -269 #ifdeà -_LARGEFILE64_SOURCE - - -270  - #__USE_LARGEFILE64 - 1 - - ) - -273 #ià -defšed - -_FILE_OFFSET_BITS - && _FILE_OFFSET_BITS == 64 - -274  - #__USE_FILE_OFFSET64 - 1 - - ) - -277 #ià -defšed - -_BSD_SOURCE - || defšed -_SVID_SOURCE - - -278  - #__USE_MISC - 1 - - ) - -281 #ifdef -_BSD_SOURCE - - -282  - #__USE_BSD - 1 - - ) - -285 #ifdef -_SVID_SOURCE - - -286  - #__USE_SVID - 1 - - ) - -289 #ifdef -_ATFILE_SOURCE - - -290  - #__USE_ATFILE - 1 - - ) - -293 #ifdef -_GNU_SOURCE - - -294  - #__USE_GNU - 1 - - ) - -297 #ià -defšed - -_REENTRANT - || defšed -_THREAD_SAFE - - -298  - #__USE_REENTRANT - 1 - - ) - -301 #ià -defšed - -_FORTIFY_SOURCE - && _FORTIFY_SOURCE > 0 \ - -302 && -__GNUC_PREREQ - (4, 1è&& -defšed - - g__OPTIMIZE__ - && __OPTIMIZE__ > 0 - -303 #ià -_FORTIFY_SOURCE - > 1 - -304  - #__USE_FORTIFY_LEVEL - 2 - - ) - -306  - #__USE_FORTIFY_LEVEL - 1 - - ) - -309  - #__USE_FORTIFY_LEVEL - 0 - - ) - -313  - ~ - -316  - #__STDC_ISO_10646__ - 200009L - - ) - -324 #undeà -__GNU_LIBRARY__ - - -325  - #__GNU_LIBRARY__ - 6 - - ) - -329  - #__GLIBC__ - 2 - - ) - -330  - #__GLIBC_MINOR__ - 11 - - ) - -332  - #__GLIBC_PREREQ -( -maj -, -mš -) \ - -333 (( -__GLIBC__ - << 16è+ -__GLIBC_MINOR__ - >ð(( -maj -è<< 16è+ ( -mš -)) - - ) - -336 #ià -defšed - -__GNUC__ - \ - -337 || ( -defšed - - g__PGI - && defšed - g__i386__ - ) \ - -338 || ( -defšed - - g__INTEL_COMPILER - && (defšed - g__i386__ - || defšed - g__Ÿ64__ -)) \ - -339 || ( -defšed - - g__STDC_VERSION__ - && __STDC_VERSION__ >= 199901L) - -340  - #__GLIBC_HAVE_LONG_LONG - 1 - - ) - -344 #iâdeà -__ASSEMBLER__ - - -345 #iâdeà -_SYS_CDEFS_H - - -346  - ~ - -351 #ià -defšed - -__USE_FILE_OFFSET64 - && !defšed -__REDIRECT - - -352  - #__USE_LARGEFILE - 1 - - ) - -353  - #__USE_LARGEFILE64 - 1 - - ) - -359 #ià -__GNUC_PREREQ - (2, 7è&& -defšed - -__OPTIMIZE__ - \ - -360 && ! -defšed - - g__OPTIMIZE_SIZE__ - && !defšed - g__NO_INLINE__ - \ - -361 && -defšed - - g__ex‹º_šlše - - -362  - #__USE_EXTERN_INLINES - 1 - - ) - -367 #ià -__GNUC_PREREQ - (2, 7è&& -defšed - -__OPTIMIZE__ - \ - -368 && ( -defšed - - g_LIBC - || !defšed - g__OPTIMIZE_SIZE__ -è&& !defšed - g__NO_INLINE__ - \ - -369 && -defšed - - g__ex‹º_šlše - - -370  - #__USE_EXTERN_INLINES_IN_LIBC - 1 - - ) - -378  - ~ - - @/usr/include/getopt.h - -21 #iâdeà -_GETOPT_H - - -23 #iâdeà -__Ãed_g‘Ýt - - -24  - #_GETOPT_H - 1 - - ) - -34 #ià! -defšed - -__GNU_LIBRARY__ - - -35  - ~<ùy³.h -> - -38 #iâdeà -__THROW - - -39 #iâdeà -__GNUC_PREREQ - - -40  - #__GNUC_PREREQ -( -maj -, -mš -è(0) - - ) - -42 #ià -defšed - -__ýlu¥lus - && -__GNUC_PREREQ - (2,8) - -43  - #__THROW - - `throw - () - - ) - -45  - #__THROW - - - ) - -49 #ifdef -__ýlu¥lus - - -59 * -Ýrg -; - -73  -Ýtšd -; - -78  -Ý‹¼ -; - -82  -ÝtÝt -; - -84 #iâdeà -__Ãed_g‘Ýt - - -106  - sÝtiÚ - - -108 cÚ¡ * - gÇme -; - -111  - ghas_¬g -; - -112 * - gæag -; - -113  - gv® -; - -118  - #no_¬gum’t - 0 - - ) - -119  - #»quœed_¬gum’t - 1 - - ) - -120  - #ÝtiÚ®_¬gum’t - 2 - - ) - -148 #ifdeà -__GNU_LIBRARY__ - - -152  -g‘Ýt - ( -___¬gc -, *cÚ¡ * -___¬gv -, cÚ¡ * -__shÜtÝts -) - -153 -__THROW -; - -155 #ià -defšed - -__Ãed_g‘Ýt - && defšed -__USE_POSIX2 - \ - -156 && ! -defšed - - g__USE_POSIX_IMPLICITLY - && !defšed - g__USE_GNU - - -160 #ifdeà -__REDIRECT - - -161  -__REDIRECT - ( -g‘Ýt -, ( -___¬gc -, *cÚ¡ * -___¬gv -, - -162 cÚ¡ * -__shÜtÝts -), - -163 -__posix_g‘Ýt -è -__THROW -; - -165  -__posix_g‘Ýt - ( -___¬gc -, *cÚ¡ * -___¬gv -, - -166 cÚ¡ * -__shÜtÝts -è -__THROW -; - -167  - #g‘Ýt - -__posix_g‘Ýt - - - ) - -171  -g‘Ýt - (); - -174 #iâdeà -__Ãed_g‘Ýt - - -175  -g‘Ýt_lÚg - ( -___¬gc -, *cÚ¡ * -___¬gv -, - -176 cÚ¡ * -__shÜtÝts -, - -177 cÚ¡  -ÝtiÚ - * -__lÚgÝts -, * -__lÚgšd -) - -178 -__THROW -; - -179  -g‘Ýt_lÚg_Úly - ( -___¬gc -, *cÚ¡ * -___¬gv -, - -180 cÚ¡ * -__shÜtÝts -, - -181 cÚ¡  -ÝtiÚ - * -__lÚgÝts -, * -__lÚgšd -) - -182 -__THROW -; - -186 #ifdef -__ýlu¥lus - - -191 #undeà -__Ãed_g‘Ýt - - - @/usr/include/libio.h - -29 #iâdeà -_IO_STDIO_H - - -30  - #_IO_STDIO_H - - - ) - -32  - ~<_G_cÚfig.h -> - -34  - #_IO_pos_t - -_G_åos_t - - - ) - -35  - #_IO_åos_t - -_G_åos_t - - - ) - -36  - #_IO_åos64_t - -_G_åos64_t - - - ) - -37  - #_IO_size_t - -_G_size_t - - - ) - -38  - #_IO_ssize_t - -_G_ssize_t - - - ) - -39  - #_IO_off_t - -_G_off_t - - - ) - -40  - #_IO_off64_t - -_G_off64_t - - - ) - -41  - #_IO_pid_t - -_G_pid_t - - - ) - -42  - #_IO_uid_t - -_G_uid_t - - - ) - -43  - #_IO_icÚv_t - -_G_icÚv_t - - - ) - -44  - #_IO_HAVE_SYS_WAIT - -_G_HAVE_SYS_WAIT - - - ) - -45  - #_IO_HAVE_ST_BLKSIZE - -_G_HAVE_ST_BLKSIZE - - - ) - -46  - #_IO_BUFSIZ - -_G_BUFSIZ - - - ) - -47  - #_IO_va_li¡ - -_G_va_li¡ - - - ) - -48  - #_IO_wšt_t - -_G_wšt_t - - - ) - -50 #ifdeà -_G_NEED_STDARG_H - - -52  - #__Ãed___va_li¡ - - - ) - -53  - ~<¡d¬g.h -> - -54 #ifdeà -__GNUC_VA_LIST - - -55 #undeà -_IO_va_li¡ - - -56  - #_IO_va_li¡ - -__gnuc_va_li¡ - - - ) - -60 #iâdeà -__P - - -61 #ià -_G_HAVE_SYS_CDEFS - - -62  - ~ - -64 #ifdeà -__STDC__ - - -65  - #__P -( -p -è - ) -p - -66  - #__PMT -( -p -è - ) -p - -68  - #__P -( -p -è() - - ) - -69  - #__PMT -( -p -è() - - ) - -75 #iâdeà -_PARAMS - - -76  - #_PARAMS -( -´Ùos -è - `__P -ÕrÙos) - - ) - -79 #iâdeà -__STDC__ - - -81 cÚ¡ - - ) - -84  - #_IO_UNIFIED_JUMPTABLES - 1 - - ) - -85 #iâdeà -_G_HAVE_PRINTF_FP - - -86  - #_IO_USE_DTOA - 1 - - ) - -89 #iâdeà -EOF - - -90  - #EOF - (-1) - - ) - -92 #iâdeà -NULL - - -93 #ià -defšed - -__GNUG__ - && \ - -94 ( - g__GNUC__ - > 2 || (__GNUC__ =ð2 && -__GNUC_MINOR__ - >= 8)) - -95  - #NULL - ( -__nuÎ -) - - ) - -97 #ià! -defšed -( -__ýlu¥lus -) - -98  - #NULL - ((*)0) - - ) - -100  - #NULL - (0) - - ) - -105  - #_IOS_INPUT - 1 - - ) - -106  - #_IOS_OUTPUT - 2 - - ) - -107  - #_IOS_ATEND - 4 - - ) - -108  - #_IOS_APPEND - 8 - - ) - -109  - #_IOS_TRUNC - 16 - - ) - -110  - #_IOS_NOCREATE - 32 - - ) - -111  - #_IOS_NOREPLACE - 64 - - ) - -112  - #_IOS_BIN - 128 - - ) - -120  - #_IO_MAGIC - 0xFBAD0000 - - ) - -121  - #_OLD_STDIO_MAGIC - 0xFABC0000 - - ) - -122  - #_IO_MAGIC_MASK - 0xFFFF0000 - - ) - -123  - #_IO_USER_BUF - 1 - - ) - -124  - #_IO_UNBUFFERED - 2 - - ) - -125  - #_IO_NO_READS - 4 - - ) - -126  - #_IO_NO_WRITES - 8 - - ) - -127  - #_IO_EOF_SEEN - 0x10 - - ) - -128  - #_IO_ERR_SEEN - 0x20 - - ) - -129  - #_IO_DELETE_DONT_CLOSE - 0x40 - - ) - -130  - #_IO_LINKED - 0x80 - - ) - -131  - #_IO_IN_BACKUP - 0x100 - - ) - -132  - #_IO_LINE_BUF - 0x200 - - ) - -133  - #_IO_TIED_PUT_GET - 0x400 - - ) - -134  - #_IO_CURRENTLY_PUTTING - 0x800 - - ) - -135  - #_IO_IS_APPENDING - 0x1000 - - ) - -136  - #_IO_IS_FILEBUF - 0x2000 - - ) - -137  - #_IO_BAD_SEEN - 0x4000 - - ) - -138  - #_IO_USER_LOCK - 0x8000 - - ) - -140  - #_IO_FLAGS2_MMAP - 1 - - ) - -141  - #_IO_FLAGS2_NOTCANCEL - 2 - - ) - -142 #ifdeà -_LIBC - - -143  - #_IO_FLAGS2_FORTIFY - 4 - - ) - -145  - #_IO_FLAGS2_USER_WBUF - 8 - - ) - -146 #ifdeà -_LIBC - - -147  - #_IO_FLAGS2_SCANF_STD - 16 - - ) - -151  - #_IO_SKIPWS - 01 - - ) - -152  - #_IO_LEFT - 02 - - ) - -153  - #_IO_RIGHT - 04 - - ) - -154  - #_IO_INTERNAL - 010 - - ) - -155  - #_IO_DEC - 020 - - ) - -156  - #_IO_OCT - 040 - - ) - -157  - #_IO_HEX - 0100 - - ) - -158  - #_IO_SHOWBASE - 0200 - - ) - -159  - #_IO_SHOWPOINT - 0400 - - ) - -160  - #_IO_UPPERCASE - 01000 - - ) - -161  - #_IO_SHOWPOS - 02000 - - ) - -162  - #_IO_SCIENTIFIC - 04000 - - ) - -163  - #_IO_FIXED - 010000 - - ) - -164  - #_IO_UNITBUF - 020000 - - ) - -165  - #_IO_STDIO - 040000 - - ) - -166  - #_IO_DONT_CLOSE - 0100000 - - ) - -167  - #_IO_BOOLALPHA - 0200000 - - ) - -170  -_IO_jump_t -;  - g_IO_FILE -; - -173 #ifdeà -_IO_MTSAFE_IO - - -174 #ià -defšed - -__GLIBC__ - && __GLIBC__ >= 2 - -175  - ~ - -180  - t_IO_lock_t -; - -186  - s_IO_m¬k” - { - -187  -_IO_m¬k” - * - m_Ãxt -; - -188  -_IO_FILE - * - m_sbuf -; - -192  - m_pos -; - -194  -£t_¡»ampos -( -¡»ampos - -¥ -è{ - m_¥os - = sp; } - -195  -£t_off£t -( -off£t -è{ - m_pos - = off£t; - m_¥os - = ( -¡»ampos -)(-2); } - -196 - mpublic -: - -197 -¡»amm¬k” -( -¡»ambuf - * -sb -); - -198 ~ -¡»amm¬k” -(); - -199  -§všg -(è{  - m_¥os - == -2; } - -200  -d– -( -¡»amm¬k” -&); - -201  -d– -(); - -206 - e__codecvt_»suÉ - - -208 - m__codecvt_ok -, - -209 - m__codecvt_·¹Ÿl -, - -210 - m__codecvt_”rÜ -, - -211 - m__codecvt_nocÚv - - -214 #ià -defšed - -_LIBC - || defšed -_GLIBCPP_USE_WCHAR_T - - -217  - s_IO_codecvt - - -219 (* - m__codecvt_de¡r -è( - m_IO_codecvt - *); - -220 -__codecvt_»suÉ - (* -__codecvt_do_out -è( - m_IO_codecvt - *, - -221 - m__mb¡©e_t - *, - -222 cÚ¡ - mwch¬_t - *, - -223 cÚ¡ - mwch¬_t - *, - -224 cÚ¡ - mwch¬_t - **, *, - -226 -__codecvt_»suÉ - (* -__codecvt_do_unshiá -è( - m_IO_codecvt - *, - -227 - m__mb¡©e_t - *, *, - -229 -__codecvt_»suÉ - (* -__codecvt_do_š -è( - m_IO_codecvt - *, - -230 - m__mb¡©e_t - *, - -232 cÚ¡ **, - mwch¬_t - *, - -233 - mwch¬_t - *, wchar_t **); - -234 (* - m__codecvt_do_’codšg -è( - m_IO_codecvt - *); - -235 (* - m__codecvt_do_®ways_nocÚv -è( - m_IO_codecvt - *); - -236 (* - m__codecvt_do_Ëngth -è( - m_IO_codecvt - *, - m__mb¡©e_t - *, - -237 cÚ¡ *, cÚ¡ *, - m_IO_size_t -); - -238 (* - m__codecvt_do_max_Ëngth -è( - m_IO_codecvt - *); - -240 -_IO_icÚv_t - - m__cd_š -; - -241 -_IO_icÚv_t - - m__cd_out -; - -245  - s_IO_wide_d©a - - -247 -wch¬_t - * - m_IO_»ad_±r -; - -248 -wch¬_t - * - m_IO_»ad_’d -; - -249 -wch¬_t - * - m_IO_»ad_ba£ -; - -250 -wch¬_t - * - m_IO_wr™e_ba£ -; - -251 -wch¬_t - * - m_IO_wr™e_±r -; - -252 -wch¬_t - * - m_IO_wr™e_’d -; - -253 -wch¬_t - * - m_IO_buf_ba£ -; - -254 -wch¬_t - * - m_IO_buf_’d -; - -256 -wch¬_t - * - m_IO_§ve_ba£ -; - -257 -wch¬_t - * - m_IO_backup_ba£ -; - -259 -wch¬_t - * - m_IO_§ve_’d -; - -261 -__mb¡©e_t - - m_IO_¡©e -; - -262 -__mb¡©e_t - - m_IO_Ï¡_¡©e -; - -263  -_IO_codecvt - - m_codecvt -; - -265 -wch¬_t - - m_shÜtbuf -[1]; - -267 cÚ¡  -_IO_jump_t - * - m_wide_vbË -; - -271  - s_IO_FILE - { - -272  - m_æags -; - -273  - #_IO_fže_æags - -_æags - - - ) - -277 * - m_IO_»ad_±r -; - -278 * - m_IO_»ad_’d -; - -279 * - m_IO_»ad_ba£ -; - -280 * - m_IO_wr™e_ba£ -; - -281 * - m_IO_wr™e_±r -; - -282 * - m_IO_wr™e_’d -; - -283 * - m_IO_buf_ba£ -; - -284 * - m_IO_buf_’d -; - -286 * - m_IO_§ve_ba£ -; - -287 * - m_IO_backup_ba£ -; - -288 * - m_IO_§ve_’d -; - -290  -_IO_m¬k” - * - m_m¬k”s -; - -292  -_IO_FILE - * - m_chaš -; - -294  - m_fž’o -; - -296  - m_blksize -; - -298  - m_æags2 -; - -300 -_IO_off_t - - m_Þd_off£t -; - -302  - #__HAVE_COLUMN - - - ) - -304  - m_cur_cÞumn -; - -305 sigÃd  - m_vbË_off£t -; - -306  - m_shÜtbuf -[1]; - -310 -_IO_lock_t - * - m_lock -; - -311 #ifdeà -_IO_USE_OLD_IO_FILE - - -314  - s_IO_FILE_com¶‘e - - -316  -_IO_FILE - - m_fže -; - -318 #ià -defšed - -_G_IO_IO_FILE_VERSION - && _G_IO_IO_FILE_VERSION == 0x20001 - -319 -_IO_off64_t - - m_off£t -; - -320 #ià -defšed - -_LIBC - || defšed -_GLIBCPP_USE_WCHAR_T - - -322  -_IO_codecvt - * - m_codecvt -; - -323  -_IO_wide_d©a - * - m_wide_d©a -; - -324  -_IO_FILE - * - m_ä“»s_li¡ -; - -325 * - m_ä“»s_buf -; - -326 -size_t - - m_ä“»s_size -; - -328 * - m__·d1 -; - -329 * - m__·d2 -; - -330 * - m__·d3 -; - -331 * - m__·d4 -; - -332 -size_t - - m__·d5 -; - -334  - m_mode -; - -336  - m_unu£d2 -[15 *  (è- 4 *  (*è-  ( -size_t -)]; - -340 #iâdeà -__ýlu¥lus - - -341  -_IO_FILE - - t_IO_FILE -; - -344  - g_IO_FILE_¶us -; - -346  -_IO_FILE_¶us - -_IO_2_1_¡dš_ -; - -347  -_IO_FILE_¶us - -_IO_2_1_¡dout_ -; - -348  -_IO_FILE_¶us - -_IO_2_1_¡d”r_ -; - -349 #iâdeà -_LIBC - - -350  - #_IO_¡dš - (( -_IO_FILE -*)(& -_IO_2_1_¡dš_ -)) - - ) - -351  - #_IO_¡dout - (( -_IO_FILE -*)(& -_IO_2_1_¡dout_ -)) - - ) - -352  - #_IO_¡d”r - (( -_IO_FILE -*)(& -_IO_2_1_¡d”r_ -)) - - ) - -354 -_IO_FILE - * -_IO_¡dš - -©Œibu‹_hidd’ -; - -355 -_IO_FILE - * -_IO_¡dout - -©Œibu‹_hidd’ -; - -356 -_IO_FILE - * -_IO_¡d”r - -©Œibu‹_hidd’ -; - -364  -__ssize_t - - t__io_»ad_â - (* - t__cook› -, * - t__buf -, - tsize_t - - t__nby‹s -); - -372  -__ssize_t - - t__io_wr™e_â - (* - t__cook› -, - t__cÚ¡ - * - t__buf -, - -373 - tsize_t - - t__n -); - -381  - t__io_£ek_â - (* - t__cook› -, - t_IO_off64_t - * - t__pos -,  - t__w -); - -384  - t__io_þo£_â - (* - t__cook› -); - -387 #ifdeà -_GNU_SOURCE - - -389  -__io_»ad_â - - tcook›_»ad_funùiÚ_t -; - -390  -__io_wr™e_â - - tcook›_wr™e_funùiÚ_t -; - -391  -__io_£ek_â - - tcook›_£ek_funùiÚ_t -; - -392  -__io_þo£_â - - tcook›_þo£_funùiÚ_t -; - -397 -__io_»ad_â - * - m»ad -; - -398 -__io_wr™e_â - * - mwr™e -; - -399 -__io_£ek_â - * - m£ek -; - -400 -__io_þo£_â - * - mþo£ -; - -401 } - t_IO_cook›_io_funùiÚs_t -; - -402  -_IO_cook›_io_funùiÚs_t - - tcook›_io_funùiÚs_t -; - -404  - g_IO_cook›_fže -; - -407  -_IO_cook›_š™ - ( -_IO_cook›_fže - * -__cfže -,  -__»ad_wr™e -, - -408 * -__cook› -, -_IO_cook›_io_funùiÚs_t - -__âs -); - -412 #ifdeà -__ýlu¥lus - - -416  -__und”æow - ( -_IO_FILE - *); - -417  -__uæow - ( -_IO_FILE - *); - -418  -__ov”æow - ( -_IO_FILE - *, ); - -419 #ià -defšed - -_LIBC - || defšed -_GLIBCPP_USE_WCHAR_T - - -420 -_IO_wšt_t - -__wund”æow - ( -_IO_FILE - *); - -421 -_IO_wšt_t - -__wuæow - ( -_IO_FILE - *); - -422 -_IO_wšt_t - -__wov”æow - ( -_IO_FILE - *, _IO_wint_t); - -425 #ià -__GNUC__ - >= 3 - -426  - #_IO_BE -( -ex´ -, -»s -è - `__bužtš_ex³ù - (Óx´),„es) - - ) - -428  - #_IO_BE -( -ex´ -, -»s -èÓx´) - - ) - -431  - #_IO_g‘c_uÆocked -( -_å -) \ - -432 ( - `_IO_BE - (( -_å -)-> -_IO_»ad_±r - >ð(_å)-> -_IO_»ad_’d -, 0) \ - -433 ? - `__uæow - ( -_å -è: *(*è(_å)-> -_IO_»ad_±r -++) - - ) - -434  - #_IO_³ekc_uÆocked -( -_å -) \ - -435 ( - `_IO_BE - (( -_å -)-> -_IO_»ad_±r - >ð(_å)-> -_IO_»ad_’d -, 0) \ - -436 && - `__und”æow - ( -_å -è=ð -EOF - ? EOF \ - -437 : *(*è( -_å -)-> -_IO_»ad_±r -) - - ) - -438  - #_IO_putc_uÆocked -( -_ch -, -_å -) \ - -439 ( - `_IO_BE - (( -_å -)-> -_IO_wr™e_±r - >ð(_å)-> -_IO_wr™e_’d -, 0) \ - -440 ? - `__ov”æow - ( -_å -, (è( -_ch -)) \ - -441 : (è(*( -_å -)-> -_IO_wr™e_±r -++ = ( -_ch -))) - - ) - -443 #ià -defšed - -_LIBC - || defšed -_GLIBCPP_USE_WCHAR_T - - -444  - #_IO_g‘wc_uÆocked -( -_å -) \ - -445 ( - `_IO_BE - (( -_å -)-> -_wide_d©a - =ð -NULL - \ - -446 || (( -_å -)-> -_wide_d©a --> -_IO_»ad_±r - \ - -447 >ð( -_å -)-> -_wide_d©a --> -_IO_»ad_’d -), 0) \ - -448 ? - `__wuæow - ( -_å -è: ( -_IO_wšt_t -è*(_å)-> -_wide_d©a --> -_IO_»ad_±r -++) - - ) - -449  - #_IO_putwc_uÆocked -( -_wch -, -_å -) \ - -450 ( - `_IO_BE - (( -_å -)-> -_wide_d©a - =ð -NULL - \ - -451 || (( -_å -)-> -_wide_d©a --> -_IO_wr™e_±r - \ - -452 >ð( -_å -)-> -_wide_d©a --> -_IO_wr™e_’d -), 0) \ - -453 ? - `__wov”æow - ( -_å -, -_wch -) \ - -454 : ( -_IO_wšt_t -è(*( -_å -)-> -_wide_d©a --> -_IO_wr™e_±r -++ = ( -_wch -))) - - ) - -457  - #_IO_ãof_uÆocked -( -__å -è(((__å)-> -_æags - & -_IO_EOF_SEEN -è!ð0) - - ) - -458  - #_IO_ã¼Ü_uÆocked -( -__å -è(((__å)-> -_æags - & -_IO_ERR_SEEN -è!ð0) - - ) - -460  -_IO_g‘c - ( -_IO_FILE - * -__å -); - -461  -_IO_putc - ( -__c -, -_IO_FILE - * -__å -); - -462  -_IO_ãof - ( -_IO_FILE - * -__å -è -__THROW -; - -463  -_IO_ã¼Ü - ( -_IO_FILE - * -__å -è -__THROW -; - -465  -_IO_³ekc_locked - ( -_IO_FILE - * -__å -); - -468  - #_IO_PENDING_OUTPUT_COUNT -( -_å -) \ - -469 (( -_å -)-> -_IO_wr™e_±r - - (_å)-> -_IO_wr™e_ba£ -) - - ) - -471  -_IO_æockfže - ( -_IO_FILE - *è -__THROW -; - -472  -_IO_fuÆockfže - ( -_IO_FILE - *è -__THROW -; - -473  -_IO_árylockfže - ( -_IO_FILE - *è -__THROW -; - -475 #ifdeà -_IO_MTSAFE_IO - - -476  - #_IO_³ekc -( -_å -è - `_IO_³ekc_locked - (_å) - - ) - -477  - #_IO_æockfže -( -_å -) \ - -478 ià((( -_å -)-> -_æags - & -_IO_USER_LOCK -è=ð0è - `_IO_æockfže - (_å) - - ) - -479  - #_IO_fuÆockfže -( -_å -) \ - -480 ià((( -_å -)-> -_æags - & -_IO_USER_LOCK -è=ð0è - `_IO_fuÆockfže - (_å) - - ) - -482  - #_IO_³ekc -( -_å -è - `_IO_³ekc_uÆocked - (_å) - - ) - -483  - #_IO_æockfže -( -_å -è - - ) - -484  - #_IO_fuÆockfže -( -_å -è - - ) - -485  - #_IO_árylockfže -( -_å -è - - ) - -486  - #_IO_þ—nup_»giÚ_¡¬t -( -_fù -, -_å -è - - ) - -487  - #_IO_þ—nup_»giÚ_’d -( -_Do™ -è - - ) - -490  -_IO_vfsÿnf - ( -_IO_FILE - * -__»¡riù -, const * __restrict, - -491 -_IO_va_li¡ -, * -__»¡riù -); - -492  -_IO_vårštf - ( -_IO_FILE - * -__»¡riù -, const *__restrict, - -493 -_IO_va_li¡ -); - -494 -_IO_ssize_t - -_IO_·dn - ( -_IO_FILE - *, , _IO_ssize_t); - -495 -_IO_size_t - -_IO_sg‘n - ( -_IO_FILE - *, *, _IO_size_t); - -497 -_IO_off64_t - -_IO_£ekoff - ( -_IO_FILE - *, _IO_off64_t, , ); - -498 -_IO_off64_t - -_IO_£ekpos - ( -_IO_FILE - *, _IO_off64_t, ); - -500  -_IO_ä“_backup_¬— - ( -_IO_FILE - *è -__THROW -; - -502 #ià -defšed - -_LIBC - || defšed -_GLIBCPP_USE_WCHAR_T - - -503 -_IO_wšt_t - -_IO_g‘wc - ( -_IO_FILE - * -__å -); - -504 -_IO_wšt_t - -_IO_putwc - ( -wch¬_t - -__wc -, -_IO_FILE - * -__å -); - -505  -_IO_fwide - ( -_IO_FILE - * -__å -,  -__mode -è -__THROW -; - -506 #ià -__GNUC__ - >= 2 - -509 #ià -defšed - -_LIBC - && defšed -SHARED - - -510  - ~ - -511 #ià -SHLIB_COMPAT - ( -libc -, -GLIBC_2_0 -, -GLIBC_2_1 -) - -512  - #_IO_fwide_maybe_šcom·tibË - \ - -513 ( - `__bužtš_ex³ù - (& -_IO_¡dš_u£d - =ð -NULL -, 0)) - - ) - -514 cÚ¡  -_IO_¡dš_u£d -; - -515 -w—k_ex‹º - ( -_IO_¡dš_u£d -); - -518 #iâdeà -_IO_fwide_maybe_šcom·tibË - - -519  - #_IO_fwide_maybe_šcom·tibË - (0) - - ) - -523  - #_IO_fwide -( -__å -, -__mode -) \ - -524 ({  -__»suÉ - = ( -__mode -); \ - -525 ià( -__»suÉ - < 0 && ! -_IO_fwide_maybe_šcom·tibË -) \ - -527 ià(( -__å -)-> -_mode - == 0) \ - -529 ( -__å -)-> -_mode - = -1; \ - -530 -__»suÉ - = ( -__å -)-> -_mode -; \ - -532 ià( - `__bužtš_cÚ¡ªt_p - ( -__mode -) && (__mode) == 0) \ - -533 -__»suÉ - = -_IO_fwide_maybe_šcom·tibË - ? -1 : ( -__å -)-> -_mode -; \ - -535 -__»suÉ - = - `_IO_fwide - ( -__å -, __result); \ - -536 -__»suÉ -; }) - - ) - -539  -_IO_vfwsÿnf - ( -_IO_FILE - * -__»¡riù -, cÚ¡ -wch¬_t - * __restrict, - -540 -_IO_va_li¡ -, * -__»¡riù -); - -541  -_IO_vfw´štf - ( -_IO_FILE - * -__»¡riù -, cÚ¡ -wch¬_t - *__restrict, - -542 -_IO_va_li¡ -); - -543 -_IO_ssize_t - -_IO_w·dn - ( -_IO_FILE - *, -wšt_t -, _IO_ssize_t); - -544  -_IO_ä“_wbackup_¬— - ( -_IO_FILE - *è -__THROW -; - -547 #ifdeà -__LDBL_COMPAT - - -548  - ~ - -551 #ifdeà -__ýlu¥lus - - - @/usr/include/_G_config.h - -4 #iâdeà -_G_cÚfig_h - - -5  - #_G_cÚfig_h - 1 - - ) - -9  - ~ - -10  - #__Ãed_size_t - - - ) - -11 #ià -defšed - -_LIBC - || defšed -_GLIBCPP_USE_WCHAR_T - - -12  - #__Ãed_wch¬_t - - - ) - -14  - #__Ãed_NULL - - - ) - -15  - ~<¡ddef.h -> - -16  - #__Ãed_mb¡©e_t - - - ) - -17 #ià -defšed - -_LIBC - || defšed -_GLIBCPP_USE_WCHAR_T - - -18  - #__Ãed_wšt_t - - - ) - -20  - ~ - -21  - #_G_size_t - -size_t - - - ) - -24 -__off_t - - m__pos -; - -25 -__mb¡©e_t - - m__¡©e -; - -26 } - t_G_åos_t -; - -29 -__off64_t - - m__pos -; - -30 -__mb¡©e_t - - m__¡©e -; - -31 } - t_G_åos64_t -; - -32  - #_G_ssize_t - -__ssize_t - - - ) - -33  - #_G_off_t - -__off_t - - - ) - -34  - #_G_off64_t - -__off64_t - - - ) - -35  - #_G_pid_t - -__pid_t - - - ) - -36  - #_G_uid_t - -__uid_t - - - ) - -37  - #_G_wch¬_t - -wch¬_t - - - ) - -38  - #_G_wšt_t - -wšt_t - - - ) - -39  - #_G_¡©64 - -¡©64 - - - ) - -40 #ià -defšed - -_LIBC - || defšed -_GLIBCPP_USE_WCHAR_T - - -41  - ~ - -44  -__gcÚv_šfo - - m__cd -; - -47  -__gcÚv_šfo - - m__cd -; - -48  -__gcÚv_¡•_d©a - - m__d©a -; - -49 } - m__combšed -; - -50 } - t_G_icÚv_t -; - -53  - t_G_št16_t - - t__©Œibu‹__ - (( - t__mode__ - ( - t__HI__ -))); - -54  - t_G_št32_t - - t__©Œibu‹__ - (( - t__mode__ - ( - t__SI__ -))); - -55  - t_G_ušt16_t - - t__©Œibu‹__ - (( - t__mode__ - ( - t__HI__ -))); - -56  - t_G_ušt32_t - - t__©Œibu‹__ - (( - t__mode__ - ( - t__SI__ -))); - -58  - #_G_HAVE_BOOL - 1 - - ) - -62  - #_G_HAVE_ATEXIT - 1 - - ) - -63  - #_G_HAVE_SYS_CDEFS - 1 - - ) - -64  - #_G_HAVE_SYS_WAIT - 1 - - ) - -65  - #_G_NEED_STDARG_H - 1 - - ) - -66  - #_G_va_li¡ - -__gnuc_va_li¡ - - - ) - -68  - #_G_HAVE_PRINTF_FP - 1 - - ) - -69  - #_G_HAVE_MMAP - 1 - - ) - -70  - #_G_HAVE_MREMAP - 1 - - ) - -71  - #_G_HAVE_LONG_DOUBLE_IO - 1 - - ) - -72  - #_G_HAVE_IO_FILE_OPEN - 1 - - ) - -73  - #_G_HAVE_IO_GETLINE_INFO - 1 - - ) - -75  - #_G_IO_IO_FILE_VERSION - 0x20001 - - ) - -77  - #_G_OPEN64 - -__Ý’64 - - - ) - -78  - #_G_LSEEK64 - -__l£ek64 - - - ) - -79  - #_G_MMAP64 - -__mm­64 - - - ) - -80  - #_G_FSTAT64 -( -fd -, -buf -è - `__fx¡©64 - ( -_STAT_VER -, fd, buf) - - ) - -83  - #_G_HAVE_ST_BLKSIZE - - `defšed - ( -_STATBUF_ST_BLKSIZE -) - - ) - -85  - #_G_BUFSIZ - 8192 - - ) - -88  - #_G_NAMES_HAVE_UNDERSCORE - 0 - - ) - -89  - #_G_VTABLE_LABEL_HAS_LENGTH - 1 - - ) - -90  - #_G_USING_THUNKS - 1 - - ) - -91  - #_G_VTABLE_LABEL_PREFIX - "__vt_" - - ) - -92  - #_G_VTABLE_LABEL_PREFIX_ID - -__vt_ - - - ) - -95 #ià -defšed - -__ýlu¥lus - || defšed -__STDC__ - - -96  - #_G_ARGS -( -ARGLIST -è - ) -ARGLIST - -98  - #_G_ARGS -( -ARGLIST -è() - - ) - - @/usr/include/bits/libio-ldbl.h - -20 #iâdeà -_IO_STDIO_H - - -24 - $__LDBL_REDIR_DECL - ( -_IO_vfsÿnf -) - -25 - `__LDBL_REDIR_DECL - ( -_IO_vårštf -) - - @/usr/include/bits/predefs.h - -19 #iâdeà -_FEATURES_H - - -23 #iâdeà -_PREDEFS_H - - -24  - #_PREDEFS_H - - - ) - -27  - #__STDC_IEC_559__ - 1 - - ) - -28  - #__STDC_IEC_559_COMPLEX__ - 1 - - ) - - @/usr/include/bits/stdio-lock.h - -20 #iâdeà -_BITS_STDIO_LOCK_H - - -21  - #_BITS_STDIO_LOCK_H - 1 - - ) - -23  - ~ - -24  - ~ - -28  - #_IO_lock_šex³nsive - 1 - - ) - -30 ¡ruù {  - mlock -;  - mút -; * - mowÃr -; } - t_IO_lock_t -; - -32  - #_IO_lock_š™Ÿliz” - { -LLL_LOCK_INITIALIZER -, 0, -NULL - } - - ) - -34  - #_IO_lock_š™ -( -_Çme -) \ - -35 (( -_Çme -èð( -_IO_lock_t -è -_IO_lock_š™Ÿliz” - , 0) - - ) - -37  - #_IO_lock_fši -( -_Çme -) \ - -38 ((è0) - - ) - -40  - #_IO_lock_lock -( -_Çme -) \ - -42 * -__£lf - = -THREAD_SELF -; \ - -43 ià(( -_Çme -). -owÃr - !ð -__£lf -) \ - -45 - `Îl_lock - (( -_Çme -). -lock -, -LLL_PRIVATE -); \ - -46 ( -_Çme -). -owÃr - = -__£lf -; \ - -48 ++( -_Çme -). -út -; \ - -49 } 0) - - ) - -51  - #_IO_lock_Œylock -( -_Çme -) \ - -53  -__»suÉ - = 0; \ - -54 * -__£lf - = -THREAD_SELF -; \ - -55 ià(( -_Çme -). -owÃr - !ð -__£lf -) \ - -57 ià( - `Îl_Œylock - (( -_Çme -). -lock -) == 0) \ - -59 ( -_Çme -). -owÃr - = -__£lf -; \ - -60 ( -_Çme -). -út - = 1; \ - -63 -__»suÉ - = -EBUSY -; \ - -66 ++( -_Çme -). -út -; \ - -67 -__»suÉ -; \ - -68 }) - - ) - -70  - #_IO_lock_uÆock -( -_Çme -) \ - -72 ià(--( -_Çme -). -út - == 0) \ - -74 ( -_Çme -). -owÃr - = -NULL -; \ - -75 - `Îl_uÆock - (( -_Çme -). -lock -, -LLL_PRIVATE -); \ - -77 } 0) - - ) - -81  - #_IO_þ—nup_»giÚ_¡¬t -( -_fù -, -_å -) \ - -82 - `__libc_þ—nup_»giÚ_¡¬t - ((( -_å -)-> -_æags - & -_IO_USER_LOCK -è=ð0, -_fù -, _å) - - ) - -83  - #_IO_þ—nup_»giÚ_¡¬t_nßrg -( -_fù -) \ - -84 - `__libc_þ—nup_»giÚ_¡¬t - (1, -_fù -, -NULL -) - - ) - -85  - #_IO_þ—nup_»giÚ_’d -( -_do™ -) \ - -86 - `__libc_þ—nup_»giÚ_’d - ( -_do™ -) - - ) - -88 #ià -defšed - -_LIBC - && !defšed -NOT_IN_libc - - -90 #ifdeà -__EXCEPTIONS - - -91  - #_IO_acquœe_lock -( -_å -) \ - -93 -_IO_FILE - * -_IO_acquœe_lock_fže - \ - -94 - `__©Œibu‹__ -(( - `þ—nup - ( -_IO_acquœe_lock_fù -))) \ - -95 ð( -_å -); \ - -96 - `_IO_æockfže - ( -_IO_acquœe_lock_fže -); - - ) - -97  - #_IO_acquœe_lock_þ—r_æags2 -( -_å -) \ - -99 -_IO_FILE - * -_IO_acquœe_lock_fže - \ - -100 - `__©Œibu‹__ -(( - `þ—nup - ( -_IO_acquœe_lock_þ—r_æags2_fù -))) \ - -101 ð( -_å -); \ - -102 - `_IO_æockfže - ( -_IO_acquœe_lock_fže -); - - ) - -104  - #_IO_acquœe_lock -( -_å -è -_IO_acquœe_lock_Ãeds_exû±iÚs_’abËd - - - ) - -105  - #_IO_acquœe_lock_þ—r_æags2 -( -_å -è - `_IO_acquœe_lock - (_å) - - ) - -107  - #_IO_»Ëa£_lock -( -_å -è; } 0) - - ) - - @/usr/include/bits/typesizes.h - -20 #iâdeà -_BITS_TYPES_H - - -24 #iâdef -_BITS_TYPESIZES_H - - -25  - #_BITS_TYPESIZES_H - 1 - - ) - -30  - #__DEV_T_TYPE - -__UQUAD_TYPE - - - ) - -31  - #__UID_T_TYPE - -__U32_TYPE - - - ) - -32  - #__GID_T_TYPE - -__U32_TYPE - - - ) - -33  - #__INO_T_TYPE - -__ULONGWORD_TYPE - - - ) - -34  - #__INO64_T_TYPE - -__UQUAD_TYPE - - - ) - -35  - #__MODE_T_TYPE - -__U32_TYPE - - - ) - -36  - #__NLINK_T_TYPE - -__UWORD_TYPE - - - ) - -37  - #__OFF_T_TYPE - -__SLONGWORD_TYPE - - - ) - -38  - #__OFF64_T_TYPE - -__SQUAD_TYPE - - - ) - -39  - #__PID_T_TYPE - -__S32_TYPE - - - ) - -40  - #__RLIM_T_TYPE - -__ULONGWORD_TYPE - - - ) - -41  - #__RLIM64_T_TYPE - -__UQUAD_TYPE - - - ) - -42  - #__BLKCNT_T_TYPE - -__SLONGWORD_TYPE - - - ) - -43  - #__BLKCNT64_T_TYPE - -__SQUAD_TYPE - - - ) - -44  - #__FSBLKCNT_T_TYPE - -__ULONGWORD_TYPE - - - ) - -45  - #__FSBLKCNT64_T_TYPE - -__UQUAD_TYPE - - - ) - -46  - #__FSFILCNT_T_TYPE - -__ULONGWORD_TYPE - - - ) - -47  - #__FSFILCNT64_T_TYPE - -__UQUAD_TYPE - - - ) - -48  - #__ID_T_TYPE - -__U32_TYPE - - - ) - -49  - #__CLOCK_T_TYPE - -__SLONGWORD_TYPE - - - ) - -50  - #__TIME_T_TYPE - -__SLONGWORD_TYPE - - - ) - -51  - #__USECONDS_T_TYPE - -__U32_TYPE - - - ) - -52  - #__SUSECONDS_T_TYPE - -__SLONGWORD_TYPE - - - ) - -53  - #__DADDR_T_TYPE - -__S32_TYPE - - - ) - -54  - #__SWBLK_T_TYPE - -__SLONGWORD_TYPE - - - ) - -55  - #__KEY_T_TYPE - -__S32_TYPE - - - ) - -56  - #__CLOCKID_T_TYPE - -__S32_TYPE - - - ) - -57  - #__TIMER_T_TYPE - * - - ) - -58  - #__BLKSIZE_T_TYPE - -__SLONGWORD_TYPE - - - ) - -59  - #__FSID_T_TYPE - sŒuù {  -__v® -[2]; } - - ) - -60  - #__SSIZE_T_TYPE - -__SWORD_TYPE - - - ) - -63  - #__FD_SETSIZE - 1024 - - ) - - @/usr/include/bits/wordsize.h - -3 #ià -defšed - -__x86_64__ - - -4  - #__WORDSIZE - 64 - - ) - -5  - #__WORDSIZE_COMPAT32 - 1 - - ) - -7  - #__WORDSIZE - 32 - - ) - - @/usr/include/ctype.h - -24 #iâdef -_CTYPE_H - - -25  - #_CTYPE_H - 1 - - ) - -27  - ~<ã©u»s.h -> - -28  - ~ - -30 - g__BEGIN_DECLS - - -32 #iâdeà -_ISb™ - - -41  - ~<’dŸn.h -> - -42 #ià -__BYTE_ORDER - =ð -__BIG_ENDIAN - - -43  - #_ISb™ -( -b™ -è(1 << (b™)) - - ) - -45  - #_ISb™ -( -b™ -è((b™è< 8 ? ((1 << (b™)è<< 8è: ((1 << (b™)è>> 8)) - - ) - -50 - m_ISuµ” - = -_ISb™ - (0), - -51 - m_ISlow” - = -_ISb™ - (1), - -52 - m_IS®pha - = -_ISb™ - (2), - -53 - m_ISdig™ - = -_ISb™ - (3), - -54 - m_ISxdig™ - = -_ISb™ - (4), - -55 - m_IS¥aû - = -_ISb™ - (5), - -56 - m_IS´št - = -_ISb™ - (6), - -57 - m_ISg¿ph - = -_ISb™ - (7), - -58 - m_ISbÏnk - = -_ISb™ - (8), - -59 - m_ISúŒl - = -_ISb™ - (9), - -60 - m_ISpunù - = -_ISb™ - (10), - -61 - m_IS®num - = -_ISb™ - (11) - -81 -__cÚ¡ - ** - $__ùy³_b_loc - () - -82 -__THROW - - `__©Œibu‹__ - (( -__cÚ¡ -)); - -83 -__cÚ¡ - -__št32_t - ** - $__ùy³_tÞow”_loc - () - -84 -__THROW - - `__©Œibu‹__ - (( -__cÚ¡ -)); - -85 -__cÚ¡ - -__št32_t - ** - $__ùy³_touµ”_loc - () - -86 -__THROW - - `__©Œibu‹__ - (( -__cÚ¡ -)); - -88  - #__isùy³ -( -c -, -ty³ -) \ - -89 ((* - `__ùy³_b_loc - ())[(è( -c -)] & (è -ty³ -) - - ) - -91  - #__i§scii -( -c -è(((cè& ~0x7fè=ð0è - - ) - -92  - #__tßscii -( -c -è((cè& 0x7fè - - ) - -94  - #__exùy³ -( -Çme -è  - `Çme - (è -__THROW - - - ) - -96 -__BEGIN_NAMESPACE_STD - - -102 - `__exùy³ - ( -i§Êum -); - -103 - `__exùy³ - ( -i§Íha -); - -104 - `__exùy³ - ( -isúŒl -); - -105 - `__exùy³ - ( -isdig™ -); - -106 - `__exùy³ - ( -i¦ow” -); - -107 - `__exùy³ - ( -isg¿ph -); - -108 - `__exùy³ - ( -i¥ršt -); - -109 - `__exùy³ - ( -i¥unù -); - -110 - `__exùy³ - ( -is¥aû -); - -111 - `__exùy³ - ( -isuµ” -); - -112 - `__exùy³ - ( -isxdig™ -); - -116  - $tÞow” - ( -__c -è -__THROW -; - -119  - $touµ” - ( -__c -è -__THROW -; - -121 -__END_NAMESPACE_STD - - -125 #ifdef -__USE_ISOC99 - - -126 -__BEGIN_NAMESPACE_C99 - - -128 - `__exùy³ - ( -isbÏnk -); - -130 -__END_NAMESPACE_C99 - - -133 #ifdeà -__USE_GNU - - -135  - $isùy³ - ( -__c -,  -__mask -è -__THROW -; - -138 #ià -defšed - -__USE_SVID - || defšed -__USE_MISC - || defšed -__USE_XOPEN - - -142  - $i§scii - ( -__c -è -__THROW -; - -146  - $tßscii - ( -__c -è -__THROW -; - -150 - `__exùy³ - ( -_touµ” -); - -151 - `__exùy³ - ( -_tÞow” -); - -155  - #__tobody -( -c -, -f -, -a -, -¬gs -) \ - -156 ( -__ex‹nsiÚ__ - \ - -157 ({  -__»s -; \ - -158 ià( ( -c -) > 1) \ - -160 ià( - `__bužtš_cÚ¡ªt_p - ( -c -)) \ - -162  -__c - = ( -c -); \ - -163 -__»s - = -__c - < -128 || __ø> 255 ? __ø: ( -a -)[__c]; \ - -166 -__»s - = -f - -¬gs -; \ - -169 -__»s - = ( -a -)[(è( -c -)]; \ - -170 -__»s -; - } -})) - - ) - -172 #ià! -defšed - -__NO_CTYPE - && !defšed -__ýlu¥lus - - -173  - #i§Êum -( -c -è - `__isùy³ -((c), -_IS®num -) - - ) - -174  - #i§Íha -( -c -è - `__isùy³ -((c), -_IS®pha -) - - ) - -175  - #isúŒl -( -c -è - `__isùy³ -((c), -_ISúŒl -) - - ) - -176  - #isdig™ -( -c -è - `__isùy³ -((c), -_ISdig™ -) - - ) - -177  - #i¦ow” -( -c -è - `__isùy³ -((c), -_ISlow” -) - - ) - -178  - #isg¿ph -( -c -è - `__isùy³ -((c), -_ISg¿ph -) - - ) - -179  - #i¥ršt -( -c -è - `__isùy³ -((c), -_IS´št -) - - ) - -180  - #i¥unù -( -c -è - `__isùy³ -((c), -_ISpunù -) - - ) - -181  - #is¥aû -( -c -è - `__isùy³ -((c), -_IS¥aû -) - - ) - -182  - #isuµ” -( -c -è - `__isùy³ -((c), -_ISuµ” -) - - ) - -183  - #isxdig™ -( -c -è - `__isùy³ -((c), -_ISxdig™ -) - - ) - -185 #ifdeà -__USE_ISOC99 - - -186  - #isbÏnk -( -c -è - `__isùy³ -((c), -_ISbÏnk -) - - ) - -189 #ifdeà -__USE_EXTERN_INLINES - - -190 -__ex‹º_šlše -  - -191 -__NTH - ( - $tÞow” - ( -__c -)) - -193  -__c - >ð-128 && __ø< 256 ? (* - `__ùy³_tÞow”_loc - ())[__c] : __c; - -194 - } -} - -196 -__ex‹º_šlše -  - -197 -__NTH - ( - $touµ” - ( -__c -)) - -199  -__c - >ð-128 && __ø< 256 ? (* - `__ùy³_touµ”_loc - ())[__c] : __c; - -200 - } -} - -203 #ià -__GNUC__ - >ð2 && -defšed - -__OPTIMIZE__ - && !defšed -__ýlu¥lus - - -204  - #tÞow” -( -c -è - `__tobody - (c, -tÞow” -, * - `__ùy³_tÞow”_loc - (), (c)) - - ) - -205  - #touµ” -( -c -è - `__tobody - (c, -touµ” -, * - `__ùy³_touµ”_loc - (), (c)) - - ) - -208 #ià -defšed - -__USE_SVID - || defšed -__USE_MISC - || defšed -__USE_XOPEN - - -209  - #i§scii -( -c -è - `__i§scii - (c) - - ) - -210  - #tßscii -( -c -è - `__tßscii - (c) - - ) - -212  - #_tÞow” -( -c -è((è(* - `__ùy³_tÞow”_loc - ())[(è(c)]) - - ) - -213  - #_touµ” -( -c -è((è(* - `__ùy³_touµ”_loc - ())[(è(c)]) - - ) - -219 #ifdeà -__USE_XOPEN2K8 - - -233  - ~ - -237  - #__isùy³_l -( -c -, -ty³ -, -loÿË -) \ - -238 (( -loÿË -)-> -__ùy³_b -[(è( -c -)] & (è -ty³ -) - - ) - -240  - #__exùy³_l -( -Çme -) \ - -241  - `Çme - (, -__loÿË_t -è -__THROW - - - ) - -247 -__exùy³_l - ( -i§Êum_l -); - -248 -__exùy³_l - ( -i§Íha_l -); - -249 -__exùy³_l - ( -isúŒl_l -); - -250 -__exùy³_l - ( -isdig™_l -); - -251 -__exùy³_l - ( -i¦ow”_l -); - -252 -__exùy³_l - ( -isg¿ph_l -); - -253 -__exùy³_l - ( -i¥ršt_l -); - -254 -__exùy³_l - ( -i¥unù_l -); - -255 -__exùy³_l - ( -is¥aû_l -); - -256 -__exùy³_l - ( -isuµ”_l -); - -257 -__exùy³_l - ( -isxdig™_l -); - -259 -__exùy³_l - ( -isbÏnk_l -); - -263  - $__tÞow”_l - ( -__c -, -__loÿË_t - -__l -è -__THROW -; - -264  - $tÞow”_l - ( -__c -, -__loÿË_t - -__l -è -__THROW -; - -267  - $__touµ”_l - ( -__c -, -__loÿË_t - -__l -è -__THROW -; - -268  - $touµ”_l - ( -__c -, -__loÿË_t - -__l -è -__THROW -; - -270 #ià -__GNUC__ - >ð2 && -defšed - -__OPTIMIZE__ - && !defšed -__ýlu¥lus - - -271  - #__tÞow”_l -( -c -, -loÿË -) \ - -272 - `__tobody - ( -c -, -__tÞow”_l -, ( -loÿË -)-> -__ùy³_tÞow” -, (c,†oÿË)) - - ) - -273  - #__touµ”_l -( -c -, -loÿË -) \ - -274 - `__tobody - ( -c -, -__touµ”_l -, ( -loÿË -)-> -__ùy³_touµ” -, (c,†oÿË)) - - ) - -275  - #tÞow”_l -( -c -, -loÿË -è - `__tÞow”_l - ((c), (loÿË)) - - ) - -276  - #touµ”_l -( -c -, -loÿË -è - `__touµ”_l - ((c), (loÿË)) - - ) - -280 #iâdeà -__NO_CTYPE - - -281  - #__i§Êum_l -( -c -, -l -è - `__isùy³_l -((c), -_IS®num -, (l)) - - ) - -282  - #__i§Íha_l -( -c -, -l -è - `__isùy³_l -((c), -_IS®pha -, (l)) - - ) - -283  - #__isúŒl_l -( -c -, -l -è - `__isùy³_l -((c), -_ISúŒl -, (l)) - - ) - -284  - #__isdig™_l -( -c -, -l -è - `__isùy³_l -((c), -_ISdig™ -, (l)) - - ) - -285  - #__i¦ow”_l -( -c -, -l -è - `__isùy³_l -((c), -_ISlow” -, (l)) - - ) - -286  - #__isg¿ph_l -( -c -, -l -è - `__isùy³_l -((c), -_ISg¿ph -, (l)) - - ) - -287  - #__i¥ršt_l -( -c -, -l -è - `__isùy³_l -((c), -_IS´št -, (l)) - - ) - -288  - #__i¥unù_l -( -c -, -l -è - `__isùy³_l -((c), -_ISpunù -, (l)) - - ) - -289  - #__is¥aû_l -( -c -, -l -è - `__isùy³_l -((c), -_IS¥aû -, (l)) - - ) - -290  - #__isuµ”_l -( -c -, -l -è - `__isùy³_l -((c), -_ISuµ” -, (l)) - - ) - -291  - #__isxdig™_l -( -c -, -l -è - `__isùy³_l -((c), -_ISxdig™ -, (l)) - - ) - -293  - #__isbÏnk_l -( -c -, -l -è - `__isùy³_l -((c), -_ISbÏnk -, (l)) - - ) - -295 #ià -defšed - -__USE_SVID - || defšed -__USE_MISC - - -296  - #__i§scii_l -( -c -, -l -è(Ö), - `__i§scii - (c)) - - ) - -297  - #__tßscii_l -( -c -, -l -è(Ö), - `__tßscii - (c)) - - ) - -300  - #i§Êum_l -( -c -, -l -è - `__i§Êum_l - ((c), (l)) - - ) - -301  - #i§Íha_l -( -c -, -l -è - `__i§Íha_l - ((c), (l)) - - ) - -302  - #isúŒl_l -( -c -, -l -è - `__isúŒl_l - ((c), (l)) - - ) - -303  - #isdig™_l -( -c -, -l -è - `__isdig™_l - ((c), (l)) - - ) - -304  - #i¦ow”_l -( -c -, -l -è - `__i¦ow”_l - ((c), (l)) - - ) - -305  - #isg¿ph_l -( -c -, -l -è - `__isg¿ph_l - ((c), (l)) - - ) - -306  - #i¥ršt_l -( -c -, -l -è - `__i¥ršt_l - ((c), (l)) - - ) - -307  - #i¥unù_l -( -c -, -l -è - `__i¥unù_l - ((c), (l)) - - ) - -308  - #is¥aû_l -( -c -, -l -è - `__is¥aû_l - ((c), (l)) - - ) - -309  - #isuµ”_l -( -c -, -l -è - `__isuµ”_l - ((c), (l)) - - ) - -310  - #isxdig™_l -( -c -, -l -è - `__isxdig™_l - ((c), (l)) - - ) - -312  - #isbÏnk_l -( -c -, -l -è - `__isbÏnk_l - ((c), (l)) - - ) - -314 #ià -defšed - -__USE_SVID - || defšed -__USE_MISC - - -315  - #i§scii_l -( -c -, -l -è - `__i§scii_l - ((c), (l)) - - ) - -316  - #tßscii_l -( -c -, -l -è - `__tßscii_l - ((c), (l)) - - ) - -323 -__END_DECLS - - - @/usr/include/gnu/stubs.h - -4  - ~ - -6 #ià -__WORDSIZE - == 32 - -7  - ~ - -8 #–ià -__WORDSIZE - == 64 - -9  - ~ - - @/usr/include/sys/cdefs.h - -20 #iâdef -_SYS_CDEFS_H - - -21  - #_SYS_CDEFS_H - 1 - - ) - -24 #iâdeà -_FEATURES_H - - -25  - ~<ã©u»s.h -> - -31 #ià -defšed - -__GNUC__ - && !defšed -__STDC__ - - -36 #undeà -__P - - -37 #undeà -__PMT - - -39 #ifdeà -__GNUC__ - - -46 #ià! -defšed - -__ýlu¥lus - && -__GNUC_PREREQ - (3, 3) - -47  - #__THROW - - `__©Œibu‹__ - (( -__nÙhrow__ -)) - - ) - -48  - #__NTH -( -fù -è - `__©Œibu‹__ - (( -__nÙhrow__ -)è - ) -fct - -50 #ià -defšed - -__ýlu¥lus - && -__GNUC_PREREQ - (2,8) - -51  - #__THROW - - `throw - () - - ) - -52  - #__NTH -( -fù -èfù - `throw - () - - ) - -54  - #__THROW - - - ) - -55  - #__NTH -( -fù -è - ) -fct - -61  - #__šlše - - - ) - -63  - #__THROW - - - ) - -64  - #__NTH -( -fù -è - ) -fct - -66  - #__cÚ¡ - cÚ¡ - - ) - -67  - #__sigÃd - sigÃd - - ) - -68  - #__vÞ©že - vÞ©že - - ) - -74  - #__P -( -¬gs -è - ) -args - -75  - #__PMT -( -¬gs -è - ) -args - -80  - #__CONCAT -( -x -, -y -èx ## - ) -y - -81  - #__STRING -( -x -è#x - - ) - -84  - #__±r_t - * - - ) - -85  - #__lÚg_doubË_t -  - - ) - -89 #ifdef -__ýlu¥lus - - -90  - #__BEGIN_DECLS - "C" { - - ) - -91  - #__END_DECLS - } - - ) - -93  - #__BEGIN_DECLS - - - ) - -94  - #__END_DECLS - - - ) - -103 #ià -defšed - -__ýlu¥lus - && defšed -_GLIBCPP_USE_NAMESPACES - - -104  - #__BEGIN_NAMESPACE_STD - -Çme¥aû - -¡d - { - - ) - -105  - #__END_NAMESPACE_STD - } - - ) - -106  - #__USING_NAMESPACE_STD -( -Çme -è -usšg - -¡d -::Çme; - - ) - -107  - #__BEGIN_NAMESPACE_C99 - -Çme¥aû - -__c99 - { - - ) - -108  - #__END_NAMESPACE_C99 - } - - ) - -109  - #__USING_NAMESPACE_C99 -( -Çme -è -usšg - -__c99 -::Çme; - - ) - -114  - #__BEGIN_NAMESPACE_STD - - - ) - -115  - #__END_NAMESPACE_STD - - - ) - -116  - #__USING_NAMESPACE_STD -( -Çme -) - - ) - -117  - #__BEGIN_NAMESPACE_C99 - - - ) - -118  - #__END_NAMESPACE_C99 - - - ) - -119  - #__USING_NAMESPACE_C99 -( -Çme -) - - ) - -124 #iâdeà -__BOUNDED_POINTERS__ - - -125  - #__bounded - - - ) - -126  - #__unbounded - - - ) - -127  - #__±rv®ue - - - ) - -132  - #__bos -( -±r -è - `__bužtš_objeù_size - (±r, -__USE_FORTIFY_LEVEL - > 1) - - ) - -133  - #__bos0 -( -±r -è - `__bužtš_objeù_size - (±r, 0) - - ) - -135 #ià -__GNUC_PREREQ - (4,3) - -136  - #__w¬ndeþ -( -Çme -, -msg -) \ - -137  - `Çme - (è - `__©Œibu‹__ -(( - `__w¬nšg__ - ( -msg -))) - - ) - -138  - #__w¬Ç‰r -( -msg -è - `__©Œibu‹__ -(( - `__w¬nšg__ - (msg))) - - ) - -139  - #__”rÜdeþ -( -Çme -, -msg -) \ - -140  - `Çme - (è - `__©Œibu‹__ -(( - `__”rÜ__ - ( -msg -))) - - ) - -142  - #__w¬ndeþ -( -Çme -, -msg -è  - `Çme - () - - ) - -143  - #__w¬Ç‰r -( -msg -) - - ) - -144  - #__”rÜdeþ -( -Çme -, -msg -è  - `Çme - () - - ) - -148 #ià -__GNUC_PREREQ - (2,97) - -150  - #__æex¬r - [] - - ) - -152 #ifdeà -__GNUC__ - - -153  - #__æex¬r - [0] - - ) - -155 #ià -defšed - -__STDC_VERSION__ - && __STDC_VERSION__ >= 199901L - -156  - #__æex¬r - [] - - ) - -159  - #__æex¬r - [1] - - ) - -175 #ià -defšed - -__GNUC__ - && __GNUC__ >= 2 - -177  - #__REDIRECT -( -Çme -, -´Ùo -, -®Ÿs -èÇm´ÙØ - `__asm__ - ( - `__ASMNAME - (#®Ÿs)) - - ) - -178 #ifdeà -__ýlu¥lus - - -179  - #__REDIRECT_NTH -( -Çme -, -´Ùo -, -®Ÿs -) \ - -180 -Çme - -´Ùo - -__THROW - - `__asm__ - ( - `__ASMNAME - (#®Ÿs)) - - ) - -182  - #__REDIRECT_NTH -( -Çme -, -´Ùo -, -®Ÿs -) \ - -183 -Çme - -´Ùo - - `__asm__ - ( - `__ASMNAME - (#®Ÿs)è -__THROW - - - ) - -185  - #__ASMNAME -( -úame -è - `__ASMNAME2 - ( -__USER_LABEL_PREFIX__ -, cÇme) - - ) - -186  - #__ASMNAME2 -( -´efix -, -úame -è - `__STRING - (´efixè - ) -cname - -199 #ià! -defšed - -__GNUC__ - || __GNUC__ < 2 - -200  - #__©Œibu‹__ -( -xyz -è - - ) - -206 #ià -__GNUC_PREREQ - (2,96) - -207  - #__©Œibu‹_m®loc__ - - `__©Œibu‹__ - (( -__m®loc__ -)) - - ) - -209  - #__©Œibu‹_m®loc__ - - - ) - -215 #ià -__GNUC_PREREQ - (2,96) - -216  - #__©Œibu‹_pu»__ - - `__©Œibu‹__ - (( -__pu»__ -)) - - ) - -218  - #__©Œibu‹_pu»__ - - - ) - -224 #ià -__GNUC_PREREQ - (3,1) - -225  - #__©Œibu‹_u£d__ - - `__©Œibu‹__ - (( -__u£d__ -)) - - ) - -226  - #__©Œibu‹_nošlše__ - - `__©Œibu‹__ - (( -__nošlše__ -)) - - ) - -228  - #__©Œibu‹_u£d__ - - `__©Œibu‹__ - (( -__unu£d__ -)) - - ) - -229  - #__©Œibu‹_nošlše__ - - - ) - -233 #ià -__GNUC_PREREQ - (3,2) - -234  - #__©Œibu‹_d•»ÿ‹d__ - - `__©Œibu‹__ - (( -__d•»ÿ‹d__ -)) - - ) - -236  - #__©Œibu‹_d•»ÿ‹d__ - - - ) - -245 #ià -__GNUC_PREREQ - (2,8) - -246  - #__©Œibu‹_fÜm©_¬g__ -( -x -è - `__©Œibu‹__ - (( - `__fÜm©_¬g__ - (x))) - - ) - -248  - #__©Œibu‹_fÜm©_¬g__ -( -x -è - - ) - -255 #ià -__GNUC_PREREQ - (2,97) - -256  - #__©Œibu‹_fÜm©_¡rfmÚ__ -( -a -, -b -) \ - -257 - `__©Œibu‹__ - (( - `__fÜm©__ - ( -__¡rfmÚ__ -, -a -, -b -))) - - ) - -259  - #__©Œibu‹_fÜm©_¡rfmÚ__ -( -a -, -b -è - - ) - -264 #ià -__GNUC_PREREQ - (3,3) - -265  - #__nÚnuÎ -( -·¿ms -è - `__©Œibu‹__ - (( -__nÚnuÎ__ -…¬ams)) - - ) - -267  - #__nÚnuÎ -( -·¿ms -) - - ) - -272 #ià -__GNUC_PREREQ - (3,4) - -273  - #__©Œibu‹_w¬n_unu£d_»suÉ__ - \ - -274 - `__©Œibu‹__ - (( -__w¬n_unu£d_»suÉ__ -)) - - ) - -275 #ià -__USE_FORTIFY_LEVEL - > 0 - -276  - #__wur - -__©Œibu‹_w¬n_unu£d_»suÉ__ - - - ) - -279  - #__©Œibu‹_w¬n_unu£d_»suÉ__ - - - ) - -281 #iâdeà -__wur - - -282  - #__wur - - - ) - -286 #ià -__GNUC_PREREQ - (3,2) - -287  - #__®ways_šlše - -__šlše - - `__©Œibu‹__ - (( -__®ways_šlše__ -)) - - ) - -289  - #__®ways_šlše - -__šlše - - - ) - -294 #ià! -defšed - -__ýlu¥lus - || -__GNUC_PREREQ - (4,3) - -295 #ià -defšed - -__GNUC_STDC_INLINE__ - || defšed -__ýlu¥lus - - -296  - #__ex‹º_šlše - -__šlše - - `__©Œibu‹__ - (( -__gnu_šlše__ -)) - - ) - -297 #ià -__GNUC_PREREQ - (4,3) - -298  - #__ex‹º_®ways_šlše - \ - -299 -__®ways_šlše - - `__©Œibu‹__ - (( -__gnu_šlše__ -, -__¬tificŸl__ -)) - - ) - -301  - #__ex‹º_®ways_šlše - \ - -302 -__®ways_šlše - - `__©Œibu‹__ - (( -__gnu_šlše__ -)) - - ) - -305  - #__ex‹º_šlše - -__šlše - - - ) - -306 #ià -__GNUC_PREREQ - (4,3) - -307  - #__ex‹º_®ways_šlše - \ - -308 -__®ways_šlše - - `__©Œibu‹__ - (( -__¬tificŸl__ -)) - - ) - -310  - #__ex‹º_®ways_šlše - -__®ways_šlše - - - ) - -317 #ià -__GNUC_PREREQ - (4,3) - -318  - #__va_¬g_·ck -(è - `__bužtš_va_¬g_·ck - () - - ) - -319  - #__va_¬g_·ck_Ën -(è - `__bužtš_va_¬g_·ck_Ën - () - - ) - -326 #ià! -__GNUC_PREREQ - (2,8) - -327  - #__ex‹nsiÚ__ - - - ) - -331 #ià! -__GNUC_PREREQ - (2,92) - -332  - #__»¡riù - - - ) - -338 #ià -__GNUC_PREREQ - (3,1è&& ! -defšed - -__GNUG__ - - -339  - #__»¡riù_¬r - -__»¡riù - - - ) - -341 #ifdeà -__GNUC__ - - -342  - #__»¡riù_¬r - - - ) - -344 #ià -defšed - -__STDC_VERSION__ - && __STDC_VERSION__ >= 199901L - -345  - #__»¡riù_¬r - -»¡riù - - - ) - -348  - #__»¡riù_¬r - - - ) - -353  - ~ - -355 #ià -defšed - -__LONG_DOUBLE_MATH_OPTIONAL - && defšed -__NO_LONG_DOUBLE_MATH - - -356  - #__LDBL_COMPAT - 1 - - ) - -357 #ifdeà -__REDIRECT - - -358  - #__LDBL_REDIR1 -( -Çme -, -´Ùo -, -®Ÿs -è - `__REDIRECT - (Çme,…rÙo,‡lŸs) - - ) - -359  - #__LDBL_REDIR -( -Çme -, -´Ùo -) \ - -360 - `__LDBL_REDIR1 - ( -Çme -, -´Ùo -, -__Ædbl_ -##Çme) - - ) - -361  - #__LDBL_REDIR1_NTH -( -Çme -, -´Ùo -, -®Ÿs -è - `__REDIRECT_NTH - (Çme,…rÙo,‡lŸs) - - ) - -362  - #__LDBL_REDIR_NTH -( -Çme -, -´Ùo -) \ - -363 - `__LDBL_REDIR1_NTH - ( -Çme -, -´Ùo -, -__Ædbl_ -##Çme) - - ) - -364  - #__LDBL_REDIR1_DECL -( -Çme -, -®Ÿs -) \ - -365 - `__ty³of - ( -Çme -èÇm - `__asm - ( - `__ASMNAME - (#®Ÿs)); - - ) - -366  - #__LDBL_REDIR_DECL -( -Çme -) \ - -367 - `__ty³of - ( -Çme -èÇm - `__asm - ( - `__ASMNAME - ("__Ædbl_" #Çme)); - - ) - -368  - #__REDIRECT_LDBL -( -Çme -, -´Ùo -, -®Ÿs -) \ - -369 - `__LDBL_REDIR1 - ( -Çme -, -´Ùo -, -__Ædbl_ -## -®Ÿs -) - - ) - -370  - #__REDIRECT_NTH_LDBL -( -Çme -, -´Ùo -, -®Ÿs -) \ - -371 - `__LDBL_REDIR1_NTH - ( -Çme -, -´Ùo -, -__Ædbl_ -## -®Ÿs -) - - ) - -374 #ià! -defšed - -__LDBL_COMPAT - || !defšed -__REDIRECT - - -375  - #__LDBL_REDIR1 -( -Çme -, -´Ùo -, -®Ÿs -èÇm - ) -proto - -376  - #__LDBL_REDIR -( -Çme -, -´Ùo -èÇm - ) -proto - -377  - #__LDBL_REDIR1_NTH -( -Çme -, -´Ùo -, -®Ÿs -èÇm´ÙØ -__THROW - - - ) - -378  - #__LDBL_REDIR_NTH -( -Çme -, -´Ùo -èÇm´ÙØ -__THROW - - - ) - -379  - #__LDBL_REDIR_DECL -( -Çme -) - - ) - -380 #ifdeà -__REDIRECT - - -381  - #__REDIRECT_LDBL -( -Çme -, -´Ùo -, -®Ÿs -è - `__REDIRECT - (Çme,…rÙo,‡lŸs) - - ) - -382  - #__REDIRECT_NTH_LDBL -( -Çme -, -´Ùo -, -®Ÿs -) \ - -383 - `__REDIRECT_NTH - ( -Çme -, -´Ùo -, -®Ÿs -) - - ) - - @/usr/include/bits/libc-lock.h - -20 #iâdeà -_BITS_LIBC_LOCK_H - - -21  - #_BITS_LIBC_LOCK_H - 1 - - ) - -23  - ~<±h»ad.h -> - -24  - #__Ãed_NULL - - - ) - -25  - ~<¡ddef.h -> - -34 #ifdeà -_LIBC - - -35  - ~ - -36  - ~<Žs.h -> - -37  - ~<±h»ad-funùiÚs.h -> - -38  - ~<”ºo.h -> - -39  - ~ - -43 #ià -defšed - -_LIBC - || defšed -_IO_MTSAFE_IO - - -44 #ià( -defšed - -NOT_IN_libc - && !defšed -IS_IN_lib±h»ad -è|| !defšed -_LIBC - - -45  -±h»ad_mu‹x_t - - t__libc_lock_t -; - -46 ¡ruù { -±h»ad_mu‹x_t - - mmu‹x -; } - t__libc_lock_»cursive_t -; - -48  - t__libc_lock_t -; - -49 ¡ruù {  - mlock -;  - mút -; * - mowÃr -; } - t__libc_lock_»cursive_t -; - -51 ¡ruù { -±h»ad_mu‹x_t - - mmu‹x -; } - t__¹ld_lock_»cursive_t -; - -52 #ifdeà -__USE_UNIX98 - - -53  -±h»ad_rwlock_t - - t__libc_rwlock_t -; - -55  -__libc_rwlock_Ýaque__ - - t__libc_rwlock_t -; - -58  -__libc_lock_Ýaque__ - - t__libc_lock_t -; - -59  -__libc_lock_»cursive_Ýaque__ - - t__libc_lock_»cursive_t -; - -60  -__libc_rwlock_Ýaque__ - - t__libc_rwlock_t -; - -64  -±h»ad_key_t - - t__libc_key_t -; - -73  - #__libc_lock_defše -( -CLASS -, -NAME -) \ - -74 -CLASS - -__libc_lock_t - -NAME -; - - ) - -75  - #__libc_rwlock_defše -( -CLASS -, -NAME -) \ - -76 -CLASS - -__libc_rwlock_t - -NAME -; - - ) - -77  - #__libc_lock_defše_»cursive -( -CLASS -, -NAME -) \ - -78 -CLASS - -__libc_lock_»cursive_t - -NAME -; - - ) - -79  - #__¹ld_lock_defše_»cursive -( -CLASS -, -NAME -) \ - -80 -CLASS - -__¹ld_lock_»cursive_t - -NAME -; - - ) - -91 #ià -defšed - -_LIBC - && (!defšed -NOT_IN_libc - || defšed -IS_IN_lib±h»ad -) - -92 #ià -LLL_LOCK_INITIALIZER - == 0 - -93  - #__libc_lock_defše_š™Ÿlized -( -CLASS -, -NAME -) \ - -94 -CLASS - -__libc_lock_t - -NAME -; - - ) - -96  - #__libc_lock_defše_š™Ÿlized -( -CLASS -, -NAME -) \ - -97 -CLASS - -__libc_lock_t - -NAME - = -LLL_LOCK_INITIALIZER -; - - ) - -100 #ià -__LT_SPINLOCK_INIT - == 0 - -101  - #__libc_lock_defše_š™Ÿlized -( -CLASS -, -NAME -) \ - -102 -CLASS - -__libc_lock_t - -NAME -; - - ) - -104  - #__libc_lock_defše_š™Ÿlized -( -CLASS -, -NAME -) \ - -105 -CLASS - -__libc_lock_t - -NAME - = -PTHREAD_MUTEX_INITIALIZER -; - - ) - -109  - #__libc_rwlock_defše_š™Ÿlized -( -CLASS -, -NAME -) \ - -110 -CLASS - -__libc_rwlock_t - -NAME - = -PTHREAD_RWLOCK_INITIALIZER -; - - ) - -114 #ià -defšed - -_LIBC - && (!defšed -NOT_IN_libc - || defšed -IS_IN_lib±h»ad -) - -115 #ià -LLL_LOCK_INITIALIZER - == 0 - -116  - #__libc_lock_defše_š™Ÿlized_»cursive -( -CLASS -, -NAME -) \ - -117 -CLASS - -__libc_lock_»cursive_t - -NAME -; - - ) - -119  - #__libc_lock_defše_š™Ÿlized_»cursive -( -CLASS -, -NAME -) \ - -120 -CLASS - -__libc_lock_»cursive_t - -NAME - = -_LIBC_LOCK_RECURSIVE_INITIALIZER -; - - ) - -122  - #_LIBC_LOCK_RECURSIVE_INITIALIZER - \ - -123 { -LLL_LOCK_INITIALIZER -, 0, -NULL - } - - ) - -125  - #__libc_lock_defše_š™Ÿlized_»cursive -( -CLASS -, -NAME -) \ - -126 -CLASS - -__libc_lock_»cursive_t - -NAME - = -_LIBC_LOCK_RECURSIVE_INITIALIZER -; - - ) - -127  - #_LIBC_LOCK_RECURSIVE_INITIALIZER - \ - -128 { -PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP -} - - ) - -131  - #__¹ld_lock_defše_š™Ÿlized_»cursive -( -CLASS -, -NAME -) \ - -132 -CLASS - -__¹ld_lock_»cursive_t - -NAME - = -_RTLD_LOCK_RECURSIVE_INITIALIZER -; - - ) - -133  - #_RTLD_LOCK_RECURSIVE_INITIALIZER - \ - -134 { -PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP -} - - ) - -136  - #__¹ld_lock_š™Ÿlize -( -NAME -) \ - -137 (è(( -NAME -èð( -__¹ld_lock_»cursive_t -è -_RTLD_LOCK_RECURSIVE_INITIALIZER -) - - ) - -144 #ifdeà -__PIC__ - - -145  - #__libc_maybe_ÿÎ -( -FUNC -, -ARGS -, -ELSE -) \ - -146 ( - `__ex‹nsiÚ__ - ({ - `__ty³of - ( -FUNC -è* -_â - = (FUNC); \ - -147 -_â - !ð -NULL - ? (*_âè -ARGS - : -ELSE -; })) - - ) - -149  - #__libc_maybe_ÿÎ -( -FUNC -, -ARGS -, -ELSE -) \ - -150 ( -FUNC - !ð -NULL - ? FUNC -ARGS - : -ELSE -) - - ) - -154 #ià -defšed - -SHARED - && !defšed -NOT_IN_libc - - -155  - #PTFAVAIL -( -NAME -è -__libc_±h»ad_funùiÚs_š™ - - - ) - -156  - #__libc_±f_ÿÎ -( -FUNC -, -ARGS -, -ELSE -) \ - -157 ( -__libc_±h»ad_funùiÚs_š™ - ? - `PTHFCT_CALL - ( -±r_ -## -FUNC -, -ARGS -è: -ELSE -) - - ) - -158  - #__libc_±f_ÿÎ_®ways -( -FUNC -, -ARGS -) \ - -159 - `PTHFCT_CALL - ( -±r_ -## -FUNC -, -ARGS -) - - ) - -161  - #PTFAVAIL -( -NAME -è(NAME !ð -NULL -) - - ) - -162  - #__libc_±f_ÿÎ -( -FUNC -, -ARGS -, -ELSE -) \ - -163 - `__libc_maybe_ÿÎ - ( -FUNC -, -ARGS -, -ELSE -) - - ) - -164  - #__libc_±f_ÿÎ_®ways -( -FUNC -, -ARGS -) \ - -165 -FUNC - -ARGS - - - ) - -171 #ià -defšed - -_LIBC - && (!defšed -NOT_IN_libc - || defšed -IS_IN_lib±h»ad -) - -172  - #__libc_lock_š™ -( -NAME -è((NAMEèð -LLL_LOCK_INITIALIZER -, 0) - - ) - -174  - #__libc_lock_š™ -( -NAME -) \ - -175 - `__libc_maybe_ÿÎ - ( -__±h»ad_mu‹x_š™ -, (&( -NAME -), -NULL -), 0) - - ) - -177 #ià -defšed - -SHARED - && !defšed -NOT_IN_libc - - -180  - #__libc_rwlock_š™ -( -NAME -) \ - -181 ( - `__bužtš_mem£t - (&( -NAME -), '\0',  (NAME)), 0) - - ) - -183  - #__libc_rwlock_š™ -( -NAME -) \ - -184 - `__libc_maybe_ÿÎ - ( -__±h»ad_rwlock_š™ -, (&( -NAME -), -NULL -), 0) - - ) - -188 #ià -defšed - -_LIBC - && (!defšed -NOT_IN_libc - || defšed -IS_IN_lib±h»ad -) - -189  - #__libc_lock_š™_»cursive -( -NAME -) \ - -190 (( -NAME -èð( -__libc_lock_»cursive_t -è -_LIBC_LOCK_RECURSIVE_INITIALIZER -, 0) - - ) - -192  - #__libc_lock_š™_»cursive -( -NAME -) \ - -194 ià( -__±h»ad_mu‹x_š™ - !ð -NULL -) \ - -196 -±h»ad_mu‹x©Œ_t - -__©Œ -; \ - -197 - `__±h»ad_mu‹x©Œ_š™ - (& -__©Œ -); \ - -198 - `__±h»ad_mu‹x©Œ_£‰y³ - (& -__©Œ -, -PTHREAD_MUTEX_RECURSIVE_NP -); \ - -199 - `__±h»ad_mu‹x_š™ - (&( -NAME -). -mu‹x -, & -__©Œ -); \ - -200 - `__±h»ad_mu‹x©Œ_de¡roy - (& -__©Œ -); \ - -202 } 0) - - ) - -205  - #__¹ld_lock_š™_»cursive -( -NAME -) \ - -207 ià( -__±h»ad_mu‹x_š™ - !ð -NULL -) \ - -209 -±h»ad_mu‹x©Œ_t - -__©Œ -; \ - -210 - `__±h»ad_mu‹x©Œ_š™ - (& -__©Œ -); \ - -211 - `__±h»ad_mu‹x©Œ_£‰y³ - (& -__©Œ -, -PTHREAD_MUTEX_RECURSIVE_NP -); \ - -212 - `__±h»ad_mu‹x_š™ - (&( -NAME -). -mu‹x -, & -__©Œ -); \ - -213 - `__±h»ad_mu‹x©Œ_de¡roy - (& -__©Œ -); \ - -215 } 0) - - ) - -220 #ià -defšed - -_LIBC - && (!defšed -NOT_IN_libc - || defšed -IS_IN_lib±h»ad -) - -221  - #__libc_lock_fši -( -NAME -è((è0) - - ) - -223  - #__libc_lock_fši -( -NAME -) \ - -224 - `__libc_maybe_ÿÎ - ( -__±h»ad_mu‹x_de¡roy -, (&( -NAME -)), 0) - - ) - -226 #ià -defšed - -SHARED - && !defšed -NOT_IN_libc - - -227  - #__libc_rwlock_fši -( -NAME -è((è0) - - ) - -229  - #__libc_rwlock_fši -( -NAME -) \ - -230 - `__libc_maybe_ÿÎ - ( -__±h»ad_rwlock_de¡roy -, (&( -NAME -)), 0) - - ) - -234 #ià -defšed - -_LIBC - && (!defšed -NOT_IN_libc - || defšed -IS_IN_lib±h»ad -) - -235  - #__libc_lock_fši_»cursive -( -NAME -è((è0) - - ) - -237  - #__libc_lock_fši_»cursive -( -NAME -) \ - -238 - `__libc_maybe_ÿÎ - ( -__±h»ad_mu‹x_de¡roy -, (&( -NAME -)), 0) - - ) - -242 #ià -defšed - -_LIBC - && (!defšed -NOT_IN_libc - || defšed -IS_IN_lib±h»ad -) - -243 #ià -__OPTION_EGLIBC_BIG_MACROS - != 1 - -247  -__libc_lock_lock_â - ( -__libc_lock_t - *); - -248 -libc_hidd’_´Ùo - ( -__libc_lock_lock_â -); - -250 #ià -__OPTION_EGLIBC_BIG_MACROS - - -251  - #__libc_lock_lock -( -NAME -) \ - -252 ({ - `Îl_lock - ( -NAME -, -LLL_PRIVATE -); 0; }) - - ) - -254  - #__libc_lock_lock -( -NAME -) \ - -255 - `__libc_lock_lock_â - (&( -NAME -)) - - ) - -258  - #__libc_lock_lock -( -NAME -) \ - -259 - `__libc_maybe_ÿÎ - ( -__±h»ad_mu‹x_lock -, (&( -NAME -)), 0) - - ) - -261  - #__libc_rwlock_rdlock -( -NAME -) \ - -262 - `__libc_±f_ÿÎ - ( -__±h»ad_rwlock_rdlock -, (&( -NAME -)), 0) - - ) - -263  - #__libc_rwlock_w¾ock -( -NAME -) \ - -264 - `__libc_±f_ÿÎ - ( -__±h»ad_rwlock_w¾ock -, (&( -NAME -)), 0) - - ) - -267 #ià -defšed - -_LIBC - && (!defšed -NOT_IN_libc - || defšed -IS_IN_lib±h»ad -) - -268 #ià -__OPTION_EGLIBC_BIG_MACROS - != 1 - -272  -__libc_lock_lock_»cursive_â - ( -__libc_lock_»cursive_t - *); - -273 -libc_hidd’_´Ùo - ( -__libc_lock_lock_»cursive_â -); - -275 #ià -__OPTION_EGLIBC_BIG_MACROS - - -276  - #__libc_lock_lock_»cursive -( -NAME -) \ - -278 * -£lf - = -THREAD_SELF -; \ - -279 ià(( -NAME -). -owÃr - !ð -£lf -) \ - -281 - `Îl_lock - (( -NAME -). -lock -, -LLL_PRIVATE -); \ - -282 ( -NAME -). -owÃr - = -£lf -; \ - -284 ++( -NAME -). -út -; \ - -285 } 0) - - ) - -287  - #__libc_lock_lock_»cursive -( -NAME -) \ - -288 - `__libc_lock_lock_»cursive_â - (&( -NAME -)) - - ) - -291  - #__libc_lock_lock_»cursive -( -NAME -) \ - -292 - `__libc_maybe_ÿÎ - ( -__±h»ad_mu‹x_lock -, (&( -NAME -). -mu‹x -), 0) - - ) - -296 #ià -defšed - -_LIBC - && (!defšed -NOT_IN_libc - || defšed -IS_IN_lib±h»ad -) - -297 #ià -__OPTION_EGLIBC_BIG_MACROS - != 1 - -301  -__libc_lock_Œylock_â - ( -__libc_lock_t - *); - -302 -libc_hidd’_´Ùo - ( -__libc_lock_Œylock_â -); - -304 #ià -__OPTION_EGLIBC_BIG_MACROS - - -305  - #__libc_lock_Œylock -( -NAME -) \ - -306 - `Îl_Œylock - ( -NAME -) - - ) - -308  - #__libc_lock_Œylock -( -NAME -) \ - -309 - `__libc_lock_Œylock_â - (&( -NAME -)) - - ) - -312  - #__libc_lock_Œylock -( -NAME -) \ - -313 - `__libc_maybe_ÿÎ - ( -__±h»ad_mu‹x_Œylock -, (&( -NAME -)), 0) - - ) - -315  - #__libc_rwlock_Œyrdlock -( -NAME -) \ - -316 - `__libc_maybe_ÿÎ - ( -__±h»ad_rwlock_Œyrdlock -, (&( -NAME -)), 0) - - ) - -317  - #__libc_rwlock_Œyw¾ock -( -NAME -) \ - -318 - `__libc_maybe_ÿÎ - ( -__±h»ad_rwlock_Œyw¾ock -, (&( -NAME -)), 0) - - ) - -321 #ià -defšed - -_LIBC - && (!defšed -NOT_IN_libc - || defšed -IS_IN_lib±h»ad -) - -322 #ià -__OPTION_EGLIBC_BIG_MACROS - != 1 - -326  -__libc_lock_Œylock_»cursive_â - ( -__libc_lock_»cursive_t - *); - -327 -libc_hidd’_´Ùo - ( -__libc_lock_Œylock_»cursive_â -); - -329 #ià -__OPTION_EGLIBC_BIG_MACROS - - -330  - #__libc_lock_Œylock_»cursive -( -NAME -) \ - -332  -»suÉ - = 0; \ - -333 * -£lf - = -THREAD_SELF -; \ - -334 ià(( -NAME -). -owÃr - !ð -£lf -) \ - -336 ià( - `Îl_Œylock - (( -NAME -). -lock -) == 0) \ - -338 ( -NAME -). -owÃr - = -£lf -; \ - -339 ( -NAME -). -út - = 1; \ - -342 -»suÉ - = -EBUSY -; \ - -345 ++( -NAME -). -út -; \ - -346 -»suÉ -; \ - -347 }) - - ) - -349  - #__libc_lock_Œylock_»cursive -( -NAME -) \ - -350 - `__libc_lock_Œylock_»cursive_â - (&( -NAME -)) - - ) - -353  - #__libc_lock_Œylock_»cursive -( -NAME -) \ - -354 - `__libc_maybe_ÿÎ - ( -__±h»ad_mu‹x_Œylock -, (&( -NAME -)), 0) - - ) - -357  - #__¹ld_lock_Œylock_»cursive -( -NAME -) \ - -358 - `__libc_maybe_ÿÎ - ( -__±h»ad_mu‹x_Œylock -, (&( -NAME -). -mu‹x -), 0) - - ) - -361 #ià -defšed - -_LIBC - && (!defšed -NOT_IN_libc - || defšed -IS_IN_lib±h»ad -) - -362 #ià -__OPTION_EGLIBC_BIG_MACROS - != 1 - -366  -__libc_lock_uÆock_â - ( -__libc_lock_t - *); - -367 -libc_hidd’_´Ùo - ( -__libc_lock_uÆock_â -); - -369 #ià -__OPTION_EGLIBC_BIG_MACROS - - -370  - #__libc_lock_uÆock -( -NAME -) \ - -371 - `Îl_uÆock - ( -NAME -, -LLL_PRIVATE -) - - ) - -373  - #__libc_lock_uÆock -( -NAME -) \ - -374 - `__libc_lock_uÆock_â - (&( -NAME -)) - - ) - -377  - #__libc_lock_uÆock -( -NAME -) \ - -378 - `__libc_maybe_ÿÎ - ( -__±h»ad_mu‹x_uÆock -, (&( -NAME -)), 0) - - ) - -380  - #__libc_rwlock_uÆock -( -NAME -) \ - -381 - `__libc_±f_ÿÎ - ( -__±h»ad_rwlock_uÆock -, (&( -NAME -)), 0) - - ) - -384 #ià -defšed - -_LIBC - && (!defšed -NOT_IN_libc - || defšed -IS_IN_lib±h»ad -) - -385 #ià -__OPTION_EGLIBC_BIG_MACROS - != 1 - -389  -__libc_lock_uÆock_»cursive_â - ( -__libc_lock_»cursive_t - *); - -390 -libc_hidd’_´Ùo - ( -__libc_lock_uÆock_»cursive_â -); - -392 #ià -__OPTION_EGLIBC_BIG_MACROS - - -394  - #__libc_lock_uÆock_»cursive -( -NAME -) \ - -396 ià(--( -NAME -). -út - == 0) \ - -398 ( -NAME -). -owÃr - = -NULL -; \ - -399 - `Îl_uÆock - (( -NAME -). -lock -, -LLL_PRIVATE -); \ - -401 } 0) - - ) - -403  - #__libc_lock_uÆock_»cursive -( -NAME -) \ - -404 - `__libc_lock_uÆock_»cursive_â - (&( -NAME -)) - - ) - -407  - #__libc_lock_uÆock_»cursive -( -NAME -) \ - -408 - `__libc_maybe_ÿÎ - ( -__±h»ad_mu‹x_uÆock -, (&( -NAME -)), 0) - - ) - -411 #ià -defšed - -_LIBC - && defšed -SHARED - - -412  - #__¹ld_lock_deçuÉ_lock_»cursive -( -lock -) \ - -413 ++(( -±h»ad_mu‹x_t - *)( -lock -))-> -__d©a -. -__couÁ -; - - ) - -415  - #__¹ld_lock_deçuÉ_uÆock_»cursive -( -lock -) \ - -416 --(( -±h»ad_mu‹x_t - *)( -lock -))-> -__d©a -. -__couÁ -; - - ) - -418  - #__¹ld_lock_lock_»cursive -( -NAME -) \ - -419 - `GL -( -dl_¹ld_lock_»cursive -è(&( -NAME -). -mu‹x -) - - ) - -421  - #__¹ld_lock_uÆock_»cursive -( -NAME -) \ - -422 - `GL -( -dl_¹ld_uÆock_»cursive -è(&( -NAME -). -mu‹x -) - - ) - -424  - #__¹ld_lock_lock_»cursive -( -NAME -) \ - -425 - `__libc_maybe_ÿÎ - ( -__±h»ad_mu‹x_lock -, (&( -NAME -). -mu‹x -), 0) - - ) - -427  - #__¹ld_lock_uÆock_»cursive -( -NAME -) \ - -428 - `__libc_maybe_ÿÎ - ( -__±h»ad_mu‹x_uÆock -, (&( -NAME -). -mu‹x -), 0) - - ) - -432 #ià -PTHREAD_ONCE_INIT - == 0 - -435  - #__libc_Úû_defše -( -CLASS -, -NAME -) \ - -436 -CLASS - -±h»ad_Úû_t - -NAME - - - ) - -438  - #__libc_Úû_defše -( -CLASS -, -NAME -) \ - -439 -CLASS - -±h»ad_Úû_t - -NAME - = -PTHREAD_ONCE_INIT - - - ) - -443  - #__libc_Úû -( -ONCE_CONTROL -, -INIT_FUNCTION -) \ - -445 ià( - `PTFAVAIL - ( -__±h»ad_Úû -)) \ - -446 - `__libc_±f_ÿÎ_®ways - ( -__±h»ad_Úû -, (&( -ONCE_CONTROL -), \ - -447 -INIT_FUNCTION -)); \ - -448 ià(( -ONCE_CONTROL -è=ð -PTHREAD_ONCE_INIT -) { \ - -449 - `INIT_FUNCTION - (); \ - -450 ( -ONCE_CONTROL -) |= 2; \ - -452 } 0) - - ) - -459  -_±h»ad_þ—nup_push - ( -_±h»ad_þ—nup_bufãr - * -bufãr -, - -460 (* -routše -è(*), * -¬g -); - -461  - `_±h»ad_þ—nup_pÝ - ( -_±h»ad_þ—nup_bufãr - * -bufãr -, - -462  -execu‹ -); - -463  - `_±h»ad_þ—nup_push_deãr - ( -_±h»ad_þ—nup_bufãr - * -bufãr -, - -464 (* -routše -è(*), * -¬g -); - -465  - `_±h»ad_þ—nup_pÝ_»¡Üe - ( -_±h»ad_þ—nup_bufãr - * -bufãr -, - -466  -execu‹ -); - -469  - #__libc_þ—nup_»giÚ_¡¬t -( -DOIT -, -FCT -, -ARG -) \ - -470 {  -_±h»ad_þ—nup_bufãr - -_bufãr -; \ - -471  -_avaž -; \ - -472 ià( -DOIT -) { \ - -473 -_avaž - = - `PTFAVAIL - ( -_±h»ad_þ—nup_push_deãr -); \ - -474 ià( -_avaž -) { \ - -475 - `__libc_±f_ÿÎ_®ways - ( -_±h»ad_þ—nup_push_deãr -, (& -_bufãr -, -FCT -, \ - -476 -ARG -)); \ - -478 -_bufãr -. -__routše - = ( -FCT -); \ - -479 -_bufãr -. -__¬g - = ( -ARG -); \ - -482 -_avaž - = 0; \ - -483 } - - ) - -486  - #__libc_þ—nup_»giÚ_’d -( -DOIT -) \ - -487 ià( -_avaž -) { \ - -488 - `__libc_±f_ÿÎ_®ways - ( -_±h»ad_þ—nup_pÝ_»¡Üe -, (& -_bufãr -, -DOIT -));\ - -489 } ià( -DOIT -) \ - -490 -_bufãr -. - `__routše - (_bufãr. -__¬g -); \ - -491 - } - - ) -} - -494  - #__libc_þ—nup_’d -( -DOIT -) \ - -495 ià( -_avaž -) { \ - -496 - `__libc_±f_ÿÎ_®ways - ( -_±h»ad_þ—nup_pÝ_»¡Üe -, (& -_bufãr -, -DOIT -));\ - -497 } ià( -DOIT -) \ - -498 -_bufãr -. - `__routše - (_bufãr. -__¬g -) - - ) - -502 -__ex‹º_šlše -  - -503 - $__libc_þ—nup_routše - ( -__±h»ad_þ—nup_äame - * -f -) - -505 ià( -f --> -__do_™ -) - -506 -f --> - `__ÿnûl_routše - (f-> -__ÿnûl_¬g -); - -507 - } -} - -509  - #__libc_þ—nup_push -( -fù -, -¬g -) \ - -511  -__±h»ad_þ—nup_äame - -__þäame - \ - -512 - `__©Œibu‹__ - (( - `__þ—nup__ - ( -__libc_þ—nup_routše -))) \ - -513 ð{ . -__ÿnûl_routše - = ( -fù -), . -__ÿnûl_¬g - = ( -¬g -), \ - -514 . -__do_™ - = 1 }; - - ) - -516  - #__libc_þ—nup_pÝ -( -execu‹ -) \ - -517 -__þäame -. -__do_™ - = ( -execu‹ -); \ - -518 } 0) - - ) - -522  - #__libc_key_ü—‹ -( -KEY -, -DESTRUCTOR -) \ - -523 - `__libc_±f_ÿÎ - ( -__±h»ad_key_ü—‹ -, ( -KEY -, -DESTRUCTOR -), 1) - - ) - -526  - #__libc_g‘¥ecific -( -KEY -) \ - -527 - `__libc_±f_ÿÎ - ( -__±h»ad_g‘¥ecific -, ( -KEY -), -NULL -) - - ) - -530  - #__libc_£t¥ecific -( -KEY -, -VALUE -) \ - -531 - `__libc_±f_ÿÎ - ( -__±h»ad_£t¥ecific -, ( -KEY -, -VALUE -), 0) - - ) - -537  - #__libc_©fÜk -( -PREPARE -, -PARENT -, -CHILD -) \ - -538 - `__»gi¡”_©fÜk - ( -PREPARE -, -PARENT -, -CHILD -, -NULL -) - - ) - -539  -__»gi¡”_©fÜk - ((* -__´•¬e -) (), - -540 (* -__·»Á -) (), - -541 (* -__chžd -) (), - -542 * -__dso_hªdË -); - -547  - `__±h»ad_mu‹x_š™ - ( -±h»ad_mu‹x_t - * -__mu‹x -, - -548 -__cÚ¡ - -±h»ad_mu‹x©Œ_t - * -__mu‹x_©Œ -); - -550  - `__±h»ad_mu‹x_de¡roy - ( -±h»ad_mu‹x_t - * -__mu‹x -); - -552  - `__±h»ad_mu‹x_Œylock - ( -±h»ad_mu‹x_t - * -__mu‹x -); - -554  - `__±h»ad_mu‹x_lock - ( -±h»ad_mu‹x_t - * -__mu‹x -); - -556  - `__±h»ad_mu‹x_uÆock - ( -±h»ad_mu‹x_t - * -__mu‹x -); - -558  - `__±h»ad_mu‹x©Œ_š™ - ( -±h»ad_mu‹x©Œ_t - * -__©Œ -); - -560  - `__±h»ad_mu‹x©Œ_de¡roy - ( -±h»ad_mu‹x©Œ_t - * -__©Œ -); - -562  - `__±h»ad_mu‹x©Œ_£‰y³ - ( -±h»ad_mu‹x©Œ_t - * -__©Œ -, - -563  -__kšd -); - -565 #ifdeà -__USE_UNIX98 - - -566  - `__±h»ad_rwlock_š™ - ( -±h»ad_rwlock_t - * -__rwlock -, - -567 -__cÚ¡ - -±h»ad_rwlock©Œ_t - * -__©Œ -); - -569  - `__±h»ad_rwlock_de¡roy - ( -±h»ad_rwlock_t - * -__rwlock -); - -571  - `__±h»ad_rwlock_rdlock - ( -±h»ad_rwlock_t - * -__rwlock -); - -573  - `__±h»ad_rwlock_Œyrdlock - ( -±h»ad_rwlock_t - * -__rwlock -); - -575  - `__±h»ad_rwlock_w¾ock - ( -±h»ad_rwlock_t - * -__rwlock -); - -577  - `__±h»ad_rwlock_Œyw¾ock - ( -±h»ad_rwlock_t - * -__rwlock -); - -579  - `__±h»ad_rwlock_uÆock - ( -±h»ad_rwlock_t - * -__rwlock -); - -582  - `__±h»ad_key_ü—‹ - ( -±h»ad_key_t - * -__key -, - -583 (* -__de¡r_funùiÚ -) (*)); - -585  - `__±h»ad_£t¥ecific - ( -±h»ad_key_t - -__key -, - -586 -__cÚ¡ - * -__poš‹r -); - -588 * - `__±h»ad_g‘¥ecific - ( -±h»ad_key_t - -__key -); - -590  - `__±h»ad_Úû - ( -±h»ad_Úû_t - * -__Úû_cÚŒÞ -, - -591 (* -__š™_routše -) ()); - -593  - `__±h»ad_©fÜk - ((* -__´•¬e -) (), - -594 (* -__·»Á -) (), - -595 (* -__chžd -) ()); - -601 #iâdeà -__NO_WEAK_PTHREAD_ALIASES - - -602 #ifdeà -w—k_ex‹º - - -603 #ià -_LIBC - - -604  - ~ - -606  - #BP_SYM -( -sym -è - ) -sym - -608 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_mu‹x_š™ -)) - -609 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_mu‹x_de¡roy -)) - -610 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_mu‹x_lock -)) - -611 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_mu‹x_Œylock -)) - -612 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_mu‹x_uÆock -)) - -613 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_mu‹x©Œ_š™ -)) - -614 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_mu‹x©Œ_de¡roy -)) - -615 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_mu‹x©Œ_£‰y³ -)) - -616 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_rwlock_š™ -)) - -617 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_rwlock_de¡roy -)) - -618 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_rwlock_rdlock -)) - -619 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_rwlock_Œyrdlock -)) - -620 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_rwlock_w¾ock -)) - -621 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_rwlock_Œyw¾ock -)) - -622 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_rwlock_uÆock -)) - -623 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_key_ü—‹ -)) - -624 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_£t¥ecific -)) - -625 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_g‘¥ecific -)) - -626 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_Úû -)) - -627 - $w—k_ex‹º - ( -__±h»ad_š™Ÿlize -) - -628 - $w—k_ex‹º - ( -__±h»ad_©fÜk -) - -629 - `w—k_ex‹º - ( - $BP_SYM - ( -_±h»ad_þ—nup_push_deãr -)) - -630 - `w—k_ex‹º - ( - $BP_SYM - ( -_±h»ad_þ—nup_pÝ_»¡Üe -)) - -631 - `w—k_ex‹º - ( - $BP_SYM - ( -±h»ad_£tÿnûl¡©e -)) - -633 #´agm¨ -w—k - -__±h»ad_mu‹x_š™ - - -634 #´agm¨ -w—k - -__±h»ad_mu‹x_de¡roy - - -635 #´agm¨ -w—k - -__±h»ad_mu‹x_lock - - -636 #´agm¨ -w—k - -__±h»ad_mu‹x_Œylock - - -637 #´agm¨ -w—k - -__±h»ad_mu‹x_uÆock - - -638 #´agm¨ -w—k - -__±h»ad_mu‹x©Œ_š™ - - -639 #´agm¨ -w—k - -__±h»ad_mu‹x©Œ_de¡roy - - -640 #´agm¨ -w—k - -__±h»ad_mu‹x©Œ_£‰y³ - - -641 #´agm¨ -w—k - -__±h»ad_rwlock_de¡roy - - -642 #´agm¨ -w—k - -__±h»ad_rwlock_rdlock - - -643 #´agm¨ -w—k - -__±h»ad_rwlock_Œyrdlock - - -644 #´agm¨ -w—k - -__±h»ad_rwlock_w¾ock - - -645 #´agm¨ -w—k - -__±h»ad_rwlock_Œyw¾ock - - -646 #´agm¨ -w—k - -__±h»ad_rwlock_uÆock - - -647 #´agm¨ -w—k - -__±h»ad_key_ü—‹ - - -648 #´agm¨ -w—k - -__±h»ad_£t¥ecific - - -649 #´agm¨ -w—k - -__±h»ad_g‘¥ecific - - -650 #´agm¨ -w—k - -__±h»ad_Úû - - -651 #´agm¨ -w—k - -__±h»ad_š™Ÿlize - - -652 #´agm¨ -w—k - -__±h»ad_©fÜk - - -653 #´agm¨ -w—k - -_±h»ad_þ—nup_push_deãr - - -654 #´agm¨ -w—k - -_±h»ad_þ—nup_pÝ_»¡Üe - - -655 #´agm¨ -w—k - -±h»ad_£tÿnûl¡©e - - - @/usr/include/endian.h - -19 #iâdef -_ENDIAN_H - - -20  - #_ENDIAN_H - 1 - - ) - -22  - ~<ã©u»s.h -> - -32  - #__LITTLE_ENDIAN - 1234 - - ) - -33  - #__BIG_ENDIAN - 4321 - - ) - -34  - #__PDP_ENDIAN - 3412 - - ) - -37  - ~ - -41 #iâdeà -__FLOAT_WORD_ORDER - - -42  - #__FLOAT_WORD_ORDER - -__BYTE_ORDER - - - ) - -45 #ifdef -__USE_BSD - - -46  - #LITTLE_ENDIAN - -__LITTLE_ENDIAN - - - ) - -47  - #BIG_ENDIAN - -__BIG_ENDIAN - - - ) - -48  - #PDP_ENDIAN - -__PDP_ENDIAN - - - ) - -49  - #BYTE_ORDER - -__BYTE_ORDER - - - ) - -52 #ià -__BYTE_ORDER - =ð -__LITTLE_ENDIAN - - -53  - #__LONG_LONG_PAIR -( -HI -, -LO -èLO, - ) -HI - -54 #–ià -__BYTE_ORDER - =ð -__BIG_ENDIAN - - -55  - #__LONG_LONG_PAIR -( -HI -, -LO -èHI, - ) -LO - -59 #ifdeà -__USE_BSD - - -61  - ~ - -63 #ià -__BYTE_ORDER - =ð -__LITTLE_ENDIAN - - -64  - #htobe16 -( -x -è - `__bsw­_16 - (x) - - ) - -65  - #htÞe16 -( -x -è(x) - - ) - -66  - #be16toh -( -x -è - `__bsw­_16 - (x) - - ) - -67  - #Ë16toh -( -x -è(x) - - ) - -69  - #htobe32 -( -x -è - `__bsw­_32 - (x) - - ) - -70  - #htÞe32 -( -x -è(x) - - ) - -71  - #be32toh -( -x -è - `__bsw­_32 - (x) - - ) - -72  - #Ë32toh -( -x -è(x) - - ) - -74  - #htobe64 -( -x -è - `__bsw­_64 - (x) - - ) - -75  - #htÞe64 -( -x -è(x) - - ) - -76  - #be64toh -( -x -è - `__bsw­_64 - (x) - - ) - -77  - #Ë64toh -( -x -è(x) - - ) - -79  - #htobe16 -( -x -è(x) - - ) - -80  - #htÞe16 -( -x -è - `__bsw­_16 - (x) - - ) - -81  - #be16toh -( -x -è(x) - - ) - -82  - #Ë16toh -( -x -è - `__bsw­_16 - (x) - - ) - -84  - #htobe32 -( -x -è(x) - - ) - -85  - #htÞe32 -( -x -è - `__bsw­_32 - (x) - - ) - -86  - #be32toh -( -x -è(x) - - ) - -87  - #Ë32toh -( -x -è - `__bsw­_32 - (x) - - ) - -89  - #htobe64 -( -x -è(x) - - ) - -90  - #htÞe64 -( -x -è - `__bsw­_64 - (x) - - ) - -91  - #be64toh -( -x -è(x) - - ) - -92  - #Ë64toh -( -x -è - `__bsw­_64 - (x) - - ) - - @/usr/include/gconv.h - -23 #iâdeà -_GCONV_H - - -24  - #_GCONV_H - 1 - - ) - -26  - ~<ã©u»s.h -> - -27  - #__Ãed_mb¡©e_t - - - ) - -28  - #__Ãed_wšt_t - - - ) - -29  - ~ - -30  - #__Ãed_size_t - - - ) - -31  - #__Ãed_wch¬_t - - - ) - -32  - ~<¡ddef.h -> - -35  - #__UNKNOWN_10646_CHAR - (( -wch¬_t -è0xfffd) - - ) - -40 - m__GCONV_OK - = 0, - -41 - m__GCONV_NOCONV -, - -42 - m__GCONV_NODB -, - -43 - m__GCONV_NOMEM -, - -45 - m__GCONV_EMPTY_INPUT -, - -46 - m__GCONV_FULL_OUTPUT -, - -47 - m__GCONV_ILLEGAL_INPUT -, - -48 - m__GCONV_INCOMPLETE_INPUT -, - -50 - m__GCONV_ILLEGAL_DESCRIPTOR -, - -51 - m__GCONV_INTERNAL_ERROR - - -58 - m__GCONV_IS_LAST - = 0x0001, - -59 - m__GCONV_IGNORE_ERRORS - = 0x0002 - -64  - g__gcÚv_¡• -; - -65  - g__gcÚv_¡•_d©a -; - -66  - g__gcÚv_lßded_objeù -; - -67  - g__gcÚv_Œªs_d©a -; - -71 (* - t__gcÚv_fù -è( - t__gcÚv_¡• - *,  - t__gcÚv_¡•_d©a - *, - -72 - t__cÚ¡ - **, __const *, - -73 **, - tsize_t - *, , ); - -76  - $wšt_t - (* - t__gcÚv_btowc_fù -è( - t__gcÚv_¡• - *, ); - -79 (* - t__gcÚv_š™_fù -è( - t__gcÚv_¡• - *); - -80 (* - t__gcÚv_’d_fù -è( - t__gcÚv_¡• - *); - -84 (* - t__gcÚv_Œªs_fù -è( - t__gcÚv_¡• - *, - -85  - t__gcÚv_¡•_d©a - *, *, - -86 - t__cÚ¡ - *, - -87 - t__cÚ¡ - **, - -88 - t__cÚ¡ - *, **, - -89 - tsize_t - *); - -92 (* - t__gcÚv_Œªs_cÚ‹xt_fù -è(*, - t__cÚ¡ - *, - -93 - t__cÚ¡ - *, - -97 (* - t__gcÚv_Œªs_qu”y_fù -è( - t__cÚ¡ - *, __const ***, - -98 - tsize_t - *); - -101 (* - t__gcÚv_Œªs_š™_fù -) (**, const *); - -102 (* - t__gcÚv_Œªs_’d_fù -) (*); - -104  - s__gcÚv_Œªs_d©a - - -107 -__gcÚv_Œªs_fù - -__Œªs_fù -; - -108 -__gcÚv_Œªs_cÚ‹xt_fù - -__Œªs_cÚ‹xt_fù -; - -109 -__gcÚv_Œªs_’d_fù - -__Œªs_’d_fù -; - -110 * -__d©a -; - -111  -__gcÚv_Œªs_d©a - * -__Ãxt -; - -116  - s__gcÚv_¡• - - -118  -__gcÚv_lßded_objeù - * -__shlib_hªdË -; - -119 -__cÚ¡ - * -__modÇme -; - -121  -__couÁ” -; - -123 * -__äom_Çme -; - -124 * -__to_Çme -; - -126 -__gcÚv_fù - -__fù -; - -127 -__gcÚv_btowc_fù - -__btowc_fù -; - -128 -__gcÚv_š™_fù - -__š™_fù -; - -129 -__gcÚv_’d_fù - -__’d_fù -; - -133  -__mš_Ãeded_äom -; - -134  -__max_Ãeded_äom -; - -135  -__mš_Ãeded_to -; - -136  -__max_Ãeded_to -; - -139  -__¡©eful -; - -141 * -__d©a -; - -146  - s__gcÚv_¡•_d©a - - -148 * -__outbuf -; - -149 * -__outbuãnd -; - -153  -__æags -; - -157  -__švoÿtiÚ_couÁ” -; - -161  -__š‹º®_u£ -; - -163 -__mb¡©e_t - * -__¡©• -; - -164 -__mb¡©e_t - -__¡©e -; - -168  -__gcÚv_Œªs_d©a - * -__Œªs -; - -173  - s__gcÚv_šfo - - -175 -size_t - -__n¡•s -; - -176  -__gcÚv_¡• - * -__¡•s -; - -177 -__ex‹nsiÚ__ -  -__gcÚv_¡•_d©a - -__d©a - -__æex¬r -; - -178 } * - t__gcÚv_t -; - - @/usr/include/gnu/stubs-32.h - -6 #ifdeà -_LIBC - - -7 #”rÜ -AµliÿtiÚs - -may - -nÙ - -defše - -the - -maüo - -_LIBC - - -10  - #__¡ub___k”Ãl_co¦ - - - ) - -11  - #__¡ub___k”Ãl_sšl - - - ) - -12  - #__¡ub___k”Ãl_Æ - - - ) - -13  - #__¡ub_chæags - - - ) - -14  - #__¡ub_ç‰ach - - - ) - -15  - #__¡ub_fchæags - - - ) - -16  - #__¡ub_fd‘ach - - - ) - -17  - #__¡ub_g‰y - - - ) - -18  - #__¡ub_lchmod - - - ) - -19  - #__¡ub_»voke - - - ) - -20  - #__¡ub_£Žogš - - - ) - -21  - #__¡ub_sig»tuº - - - ) - -22  - #__¡ub_s¡k - - - ) - -23  - #__¡ub_¡ty - - - ) - - @/usr/include/gnu/stubs-64.h - -6 #ifdeà -_LIBC - - -7 #”rÜ -AµliÿtiÚs - -may - -nÙ - -defše - -the - -maüo - -_LIBC - - -10  - #__¡ub_bdæush - - - ) - -11  - #__¡ub_chæags - - - ) - -12  - #__¡ub_ç‰ach - - - ) - -13  - #__¡ub_fchæags - - - ) - -14  - #__¡ub_fd‘ach - - - ) - -15  - #__¡ub_g‘msg - - - ) - -16  - #__¡ub_g‰y - - - ) - -17  - #__¡ub_lchmod - - - ) - -18  - #__¡ub_putmsg - - - ) - -19  - #__¡ub_»voke - - - ) - -20  - #__¡ub_£Žogš - - - ) - -21  - #__¡ub_sig»tuº - - - ) - -22  - #__¡ub_s¡k - - - ) - -23  - #__¡ub_¡ty - - - ) - - @/usr/include/wchar.h - -24 #iâdeà -_WCHAR_H - - -26 #ià! -defšed - -__Ãed_mb¡©e_t - && !defšed -__Ãed_wšt_t - - -27  - #_WCHAR_H - 1 - - ) - -28  - ~<ã©u»s.h -> - -31 #ifdeà -_WCHAR_H - - -33  - #__Ãed___FILE - - - ) - -34 #ià -defšed - -__USE_UNIX98 - || defšed -__USE_XOPEN2K - - -35  - #__Ãed_FILE - - - ) - -37  - ~<¡dio.h -> - -39  - #__Ãed___va_li¡ - - - ) - -40  - ~<¡d¬g.h -> - -42  - ~ - -45  - #__Ãed_size_t - - - ) - -46  - #__Ãed_wch¬_t - - - ) - -47  - #__Ãed_NULL - - - ) - -49 #ià -defšed - -_WCHAR_H - || defšed -__Ãed_wšt_t - || !defšed -__WINT_TYPE__ - - -50 #undeà -__Ãed_wšt_t - - -51  - #__Ãed_wšt_t - - - ) - -52  - ~<¡ddef.h -> - -55 #ià -defšed - -__ýlu¥lus - && -__GNUC_PREREQ - (4, 4) - -56  - #__CORRECT_ISO_CPP_WCHAR_H_PROTO - - - ) - -61 #iâdeà -_WINT_T - - -66  - #_WINT_T - - - ) - -67  - twšt_t -; - -71 #ià -defšed - -__ýlu¥lus - && defšed -_GLIBCPP_USE_NAMESPACES - \ - -72 && -defšed - -__WINT_TYPE__ - - -73 -__BEGIN_NAMESPACE_STD - - -74  -__WINT_TYPE__ - - twšt_t -; - -75 - g__END_NAMESPACE_STD - - -80 #ià( -defšed - -_WCHAR_H - || defšed -__Ãed_mb¡©e_t -è&& !defšed -__mb¡©e_t_defšed - - -81  - #__mb¡©e_t_defšed - 1 - - ) - -85  - m__couÁ -; - -88 #ifdeà -__WINT_TYPE__ - - -89 -__WINT_TYPE__ - - m__wch -; - -91 -wšt_t - - m__wch -; - -93  - m__wchb -[4]; - -94 } - m__v®ue -; - -95 } - t__mb¡©e_t -; - -97 #undeà -__Ãed_mb¡©e_t - - -102 #ifdeà -_WCHAR_H - - -104 -__BEGIN_NAMESPACE_C99 - - -106  -__mb¡©e_t - - tmb¡©e_t -; - -107 - g__END_NAMESPACE_C99 - - -108 #ifdeà -__USE_GNU - - -109 - $__USING_NAMESPACE_C99 -( -mb¡©e_t -) - -112 #iâdeà -WCHAR_MIN - - -114  - #WCHAR_MIN - -__WCHAR_MIN - - - ) - -115  - #WCHAR_MAX - -__WCHAR_MAX - - - ) - -118 #iâdeà -WEOF - - -119  - #WEOF - (0xffffffffu) - - ) - -124 #ià -defšed - -__USE_XOPEN - && !defšed -__USE_UNIX98 - - -125  - ~ - -129 -__BEGIN_DECLS - - -131 -__BEGIN_NAMESPACE_STD - - -134  -tm -; - -135 -__END_NAMESPACE_STD - - -139 - $__USING_NAMESPACE_STD -( -tm -) - -142 -__BEGIN_NAMESPACE_STD - - -144 -wch¬_t - * - $wcsýy - ( -wch¬_t - * -__»¡riù - -__de¡ -, - -145 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -è -__THROW -; - -147 -wch¬_t - * - $wc¢ýy - ( -wch¬_t - * -__»¡riù - -__de¡ -, - -148 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, -size_t - -__n -) - -149 -__THROW -; - -152 -wch¬_t - * - $wcsÿt - ( -wch¬_t - * -__»¡riù - -__de¡ -, - -153 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -è -__THROW -; - -155 -wch¬_t - * - $wc¢ÿt - ( -wch¬_t - * -__»¡riù - -__de¡ -, - -156 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, -size_t - -__n -) - -157 -__THROW -; - -160  - $wcscmp - ( -__cÚ¡ - -wch¬_t - * -__s1 -, __cÚ¡ wch¬_ˆ* -__s2 -) - -161 -__THROW - -__©Œibu‹_pu»__ -; - -163  - $wc¢cmp - ( -__cÚ¡ - -wch¬_t - * -__s1 -, __cÚ¡ wch¬_ˆ* -__s2 -, -size_t - -__n -) - -164 -__THROW - -__©Œibu‹_pu»__ -; - -165 -__END_NAMESPACE_STD - - -167 #ifdeà -__USE_XOPEN2K8 - - -169  - $wcsÿ£cmp - ( -__cÚ¡ - -wch¬_t - * -__s1 -, __cÚ¡ wch¬_ˆ* -__s2 -è -__THROW -; - -172  - $wc¢ÿ£cmp - ( -__cÚ¡ - -wch¬_t - * -__s1 -, __cÚ¡ wch¬_ˆ* -__s2 -, - -173 -size_t - -__n -è -__THROW -; - -177  - ~ - -179  - $wcsÿ£cmp_l - ( -__cÚ¡ - -wch¬_t - * -__s1 -, __cÚ¡ wch¬_ˆ* -__s2 -, - -180 -__loÿË_t - -__loc -è -__THROW -; - -182  - $wc¢ÿ£cmp_l - ( -__cÚ¡ - -wch¬_t - * -__s1 -, __cÚ¡ wch¬_ˆ* -__s2 -, - -183 -size_t - -__n -, -__loÿË_t - -__loc -è -__THROW -; - -186 -__BEGIN_NAMESPACE_STD - - -189  - $wcscÞl - ( -__cÚ¡ - -wch¬_t - * -__s1 -, __cÚ¡ wch¬_ˆ* -__s2 -è -__THROW -; - -193 -size_t - - $wcsxäm - ( -wch¬_t - * -__»¡riù - -__s1 -, - -194 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s2 -, -size_t - -__n -è -__THROW -; - -195 -__END_NAMESPACE_STD - - -197 #ifdeà -__USE_XOPEN2K8 - - -203  - $wcscÞl_l - ( -__cÚ¡ - -wch¬_t - * -__s1 -, __cÚ¡ wch¬_ˆ* -__s2 -, - -204 -__loÿË_t - -__loc -è -__THROW -; - -209 -size_t - - $wcsxäm_l - ( -wch¬_t - * -__s1 -, -__cÚ¡ - wch¬_ˆ* -__s2 -, - -210 -size_t - -__n -, -__loÿË_t - -__loc -è -__THROW -; - -213 -wch¬_t - * - $wcsdup - ( -__cÚ¡ - -wch¬_t - * -__s -è -__THROW - -__©Œibu‹_m®loc__ -; - -216 -__BEGIN_NAMESPACE_STD - - -218 #ifdeà -__CORRECT_ISO_CPP_WCHAR_H_PROTO - - -219 "C++" -wch¬_t - * - $wcschr - ( -wch¬_t - * -__wcs -, wch¬_ˆ -__wc -) - -220 -__THROW - - `__asm - ("wcschr"è -__©Œibu‹_pu»__ -; - -221 "C++" -__cÚ¡ - -wch¬_t - * - $wcschr - ( -__cÚ¡ - -wch¬_t - * -__wcs -, wch¬_ˆ -__wc -) - -222 -__THROW - - `__asm - ("wcschr"è -__©Œibu‹_pu»__ -; - -224 -wch¬_t - * - $wcschr - ( -__cÚ¡ - -wch¬_t - * -__wcs -, wch¬_ˆ -__wc -) - -225 -__THROW - -__©Œibu‹_pu»__ -; - -228 #ifdeà -__CORRECT_ISO_CPP_WCHAR_H_PROTO - - -229 "C++" -wch¬_t - * - $wc¤chr - ( -wch¬_t - * -__wcs -, wch¬_ˆ -__wc -) - -230 -__THROW - - `__asm - ("wc¤chr"è -__©Œibu‹_pu»__ -; - -231 "C++" -__cÚ¡ - -wch¬_t - * - $wc¤chr - ( -__cÚ¡ - -wch¬_t - * -__wcs -, wch¬_ˆ -__wc -) - -232 -__THROW - - `__asm - ("wc¤chr"è -__©Œibu‹_pu»__ -; - -234 -wch¬_t - * - $wc¤chr - ( -__cÚ¡ - -wch¬_t - * -__wcs -, wch¬_ˆ -__wc -) - -235 -__THROW - -__©Œibu‹_pu»__ -; - -237 -__END_NAMESPACE_STD - - -239 #ifdeà -__USE_GNU - - -242 -wch¬_t - * - $wcschºul - ( -__cÚ¡ - -wch¬_t - * -__s -, wch¬_ˆ -__wc -) - -243 -__THROW - -__©Œibu‹_pu»__ -; - -246 -__BEGIN_NAMESPACE_STD - - -249 -size_t - - $wcsc¥n - ( -__cÚ¡ - -wch¬_t - * -__wcs -, __cÚ¡ wch¬_ˆ* -__»jeù -) - -250 -__THROW - -__©Œibu‹_pu»__ -; - -253 -size_t - - $wcs¥n - ( -__cÚ¡ - -wch¬_t - * -__wcs -, __cÚ¡ wch¬_ˆ* -__acû± -) - -254 -__THROW - -__©Œibu‹_pu»__ -; - -256 #ifdeà -__CORRECT_ISO_CPP_WCHAR_H_PROTO - - -257 "C++" -wch¬_t - * - $wc¥brk - ( -wch¬_t - * -__wcs -, -__cÚ¡ - wch¬_ˆ* -__acû± -) - -258 -__THROW - - `__asm - ("wc¥brk"è -__©Œibu‹_pu»__ -; - -259 "C++" -__cÚ¡ - -wch¬_t - * - $wc¥brk - ( -__cÚ¡ - -wch¬_t - * -__wcs -, - -260 -__cÚ¡ - -wch¬_t - * -__acû± -) - -261 -__THROW - - `__asm - ("wc¥brk"è -__©Œibu‹_pu»__ -; - -263 -wch¬_t - * - $wc¥brk - ( -__cÚ¡ - -wch¬_t - * -__wcs -, __cÚ¡ wch¬_ˆ* -__acû± -) - -264 -__THROW - -__©Œibu‹_pu»__ -; - -267 #ifdeà -__CORRECT_ISO_CPP_WCHAR_H_PROTO - - -268 "C++" -wch¬_t - * - $wcs¡r - ( -wch¬_t - * -__hay¡ack -, -__cÚ¡ - wch¬_ˆ* -__ÃedË -) - -269 -__THROW - - `__asm - ("wcs¡r"è -__©Œibu‹_pu»__ -; - -270 "C++" -__cÚ¡ - -wch¬_t - * - $wcs¡r - ( -__cÚ¡ - -wch¬_t - * -__hay¡ack -, - -271 -__cÚ¡ - -wch¬_t - * -__ÃedË -) - -272 -__THROW - - `__asm - ("wcs¡r"è -__©Œibu‹_pu»__ -; - -274 -wch¬_t - * - $wcs¡r - ( -__cÚ¡ - -wch¬_t - * -__hay¡ack -, __cÚ¡ wch¬_ˆ* -__ÃedË -) - -275 -__THROW - -__©Œibu‹_pu»__ -; - -279 -wch¬_t - * - $wc¡ok - ( -wch¬_t - * -__»¡riù - -__s -, - -280 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__d–im -, - -281 -wch¬_t - ** -__»¡riù - -__±r -è -__THROW -; - -284 -size_t - - $wc¦’ - ( -__cÚ¡ - -wch¬_t - * -__s -è -__THROW - -__©Œibu‹_pu»__ -; - -285 -__END_NAMESPACE_STD - - -287 #ifdeà -__USE_XOPEN - - -289 #ifdeà -__CORRECT_ISO_CPP_WCHAR_H_PROTO - - -290 "C++" -wch¬_t - * - $wcswcs - ( -wch¬_t - * -__hay¡ack -, -__cÚ¡ - wch¬_ˆ* -__ÃedË -) - -291 -__THROW - - `__asm - ("wcswcs"è -__©Œibu‹_pu»__ -; - -292 "C++" -__cÚ¡ - -wch¬_t - * - $wcswcs - ( -__cÚ¡ - -wch¬_t - * -__hay¡ack -, - -293 -__cÚ¡ - -wch¬_t - * -__ÃedË -) - -294 -__THROW - - `__asm - ("wcswcs"è -__©Œibu‹_pu»__ -; - -296 -wch¬_t - * - $wcswcs - ( -__cÚ¡ - -wch¬_t - * -__hay¡ack -, __cÚ¡ wch¬_ˆ* -__ÃedË -) - -297 -__THROW - -__©Œibu‹_pu»__ -; - -301 #ifdeà -__USE_XOPEN2K8 - - -303 -size_t - - $wc¢Ën - ( -__cÚ¡ - -wch¬_t - * -__s -, -size_t - -__maxËn -) - -304 -__THROW - -__©Œibu‹_pu»__ -; - -308 -__BEGIN_NAMESPACE_STD - - -310 #ifdeà -__CORRECT_ISO_CPP_WCHAR_H_PROTO - - -311 "C++" -wch¬_t - * - $wmemchr - ( -wch¬_t - * -__s -, wch¬_ˆ -__c -, -size_t - -__n -) - -312 -__THROW - - `__asm - ("wmemchr"è -__©Œibu‹_pu»__ -; - -313 "C++" -__cÚ¡ - -wch¬_t - * - $wmemchr - ( -__cÚ¡ - -wch¬_t - * -__s -, wch¬_ˆ -__c -, - -314 -size_t - -__n -) - -315 -__THROW - - `__asm - ("wmemchr"è -__©Œibu‹_pu»__ -; - -317 -wch¬_t - * - $wmemchr - ( -__cÚ¡ - -wch¬_t - * -__s -, wch¬_ˆ -__c -, -size_t - -__n -) - -318 -__THROW - -__©Œibu‹_pu»__ -; - -322  - $wmemcmp - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s1 -, - -323 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s2 -, -size_t - -__n -) - -324 -__THROW - -__©Œibu‹_pu»__ -; - -327 -wch¬_t - * - $wmemýy - ( -wch¬_t - * -__»¡riù - -__s1 -, - -328 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s2 -, -size_t - -__n -è -__THROW -; - -332 -wch¬_t - * - $wmemmove - ( -wch¬_t - * -__s1 -, -__cÚ¡ - wch¬_ˆ* -__s2 -, -size_t - -__n -) - -333 -__THROW -; - -336 -wch¬_t - * - $wmem£t - ( -wch¬_t - * -__s -, wch¬_ˆ -__c -, -size_t - -__n -è -__THROW -; - -337 -__END_NAMESPACE_STD - - -339 #ifdeà -__USE_GNU - - -342 -wch¬_t - * - $wmempýy - ( -wch¬_t - * -__»¡riù - -__s1 -, - -343 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s2 -, -size_t - -__n -) - -344 -__THROW -; - -348 -__BEGIN_NAMESPACE_STD - - -351 -wšt_t - - $btowc - ( -__c -è -__THROW -; - -355  - $wùob - ( -wšt_t - -__c -è -__THROW -; - -359  - $mbsš™ - ( -__cÚ¡ - -mb¡©e_t - * -__ps -è -__THROW - -__©Œibu‹_pu»__ -; - -363 -size_t - - $mb¹owc - ( -wch¬_t - * -__»¡riù - -__pwc -, - -364 -__cÚ¡ - * -__»¡riù - -__s -, -size_t - -__n -, - -365 -mb¡©e_t - * -__p -è -__THROW -; - -368 -size_t - - $wütomb - (* -__»¡riù - -__s -, -wch¬_t - -__wc -, - -369 -mb¡©e_t - * -__»¡riù - -__ps -è -__THROW -; - -372 -size_t - - $__mb¾’ - ( -__cÚ¡ - * -__»¡riù - -__s -, -size_t - -__n -, - -373 -mb¡©e_t - * -__»¡riù - -__ps -è -__THROW -; - -374 -size_t - - $mb¾’ - ( -__cÚ¡ - * -__»¡riù - -__s -, -size_t - -__n -, - -375 -mb¡©e_t - * -__»¡riù - -__ps -è -__THROW -; - -376 -__END_NAMESPACE_STD - - -378 #ifdeà -__USE_EXTERN_INLINES - - -384 -wšt_t - - $__btowc_®Ÿs - ( -__c -è - `__asm - ("btowc"); - -385 -__ex‹º_šlše - -wšt_t - - -386 - `__NTH - ( - $btowc - ( -__c -)) - -387 {  ( - `__bužtš_cÚ¡ªt_p - ( -__c -) && __c >= '\0' && __c <= '\x7f' - -388 ? ( -wšt_t -è -__c - : - `__btowc_®Ÿs - (__c)); - } -} - -390  - $__wùob_®Ÿs - ( -wšt_t - -__c -è - `__asm - ("wctob"); - -391 -__ex‹º_šlše -  - -392 - `__NTH - ( - $wùob - ( -wšt_t - -__wc -)) - -393 {  ( - `__bužtš_cÚ¡ªt_p - ( -__wc -è&& __wø>ð -L -'\0' && __wc <= L'\x7f' - -394 ? (è -__wc - : - `__wùob_®Ÿs - (__wc)); - } -} - -396 -__ex‹º_šlše - -size_t - - -397 -__NTH - ( - $mb¾’ - ( -__cÚ¡ - * -__»¡riù - -__s -, -size_t - -__n -, - -398 -mb¡©e_t - * -__»¡riù - -__ps -)) - -399 {  ( -__ps - !ð -NULL - - -400 ? - `mb¹owc - ( -NULL -, -__s -, -__n -, -__ps -è: - `__mb¾’ - (__s, __n, NULL)); - } -} - -403 -__BEGIN_NAMESPACE_STD - - -406 -size_t - - $mb¤towcs - ( -wch¬_t - * -__»¡riù - -__d¡ -, - -407 -__cÚ¡ - ** -__»¡riù - -__¤c -, -size_t - -__Ën -, - -408 -mb¡©e_t - * -__»¡riù - -__ps -è -__THROW -; - -412 -size_t - - $wc¤tombs - (* -__»¡riù - -__d¡ -, - -413 -__cÚ¡ - -wch¬_t - ** -__»¡riù - -__¤c -, -size_t - -__Ën -, - -414 -mb¡©e_t - * -__»¡riù - -__ps -è -__THROW -; - -415 -__END_NAMESPACE_STD - - -418 #ifdef -__USE_XOPEN2K8 - - -421 -size_t - - $mb¢¹owcs - ( -wch¬_t - * -__»¡riù - -__d¡ -, - -422 -__cÚ¡ - ** -__»¡riù - -__¤c -, -size_t - -__nmc -, - -423 -size_t - -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -è -__THROW -; - -427 -size_t - - $wc¢¹ombs - (* -__»¡riù - -__d¡ -, - -428 -__cÚ¡ - -wch¬_t - ** -__»¡riù - -__¤c -, - -429 -size_t - -__nwc -, size_ˆ -__Ën -, - -430 -mb¡©e_t - * -__»¡riù - -__ps -è -__THROW -; - -435 #ifdeà -__USE_XOPEN - - -437  - $wcwidth - ( -wch¬_t - -__c -è -__THROW -; - -441  - $wcswidth - ( -__cÚ¡ - -wch¬_t - * -__s -, -size_t - -__n -è -__THROW -; - -445 -__BEGIN_NAMESPACE_STD - - -448  - $wc¡od - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -449 -wch¬_t - ** -__»¡riù - -__’d±r -è -__THROW -; - -450 -__END_NAMESPACE_STD - - -452 #ifdeà -__USE_ISOC99 - - -453 -__BEGIN_NAMESPACE_C99 - - -455  - $wc¡of - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -456 -wch¬_t - ** -__»¡riù - -__’d±r -è -__THROW -; - -457  - $wc¡Þd - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -458 -wch¬_t - ** -__»¡riù - -__’d±r -è -__THROW -; - -459 -__END_NAMESPACE_C99 - - -463 -__BEGIN_NAMESPACE_STD - - -466  - $wc¡Þ - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -467 -wch¬_t - ** -__»¡riù - -__’d±r -,  -__ba£ -è -__THROW -; - -471  - $wc¡oul - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -472 -wch¬_t - ** -__»¡riù - -__’d±r -,  -__ba£ -) - -473 -__THROW -; - -474 -__END_NAMESPACE_STD - - -476 #ià -defšed - -__USE_ISOC99 - || (defšed -__GNUC__ - && defšed -__USE_GNU -) - -477 -__BEGIN_NAMESPACE_C99 - - -480 -__ex‹nsiÚ__ - - -481  - $wc¡Þl - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -482 -wch¬_t - ** -__»¡riù - -__’d±r -,  -__ba£ -) - -483 -__THROW -; - -487 -__ex‹nsiÚ__ - - -488  - $wc¡ouÎ - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -489 -wch¬_t - ** -__»¡riù - -__’d±r -, - -490  -__ba£ -è -__THROW -; - -491 -__END_NAMESPACE_C99 - - -494 #ià -defšed - -__GNUC__ - && defšed -__USE_GNU - - -497 -__ex‹nsiÚ__ - - -498  - $wc¡oq - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -499 -wch¬_t - ** -__»¡riù - -__’d±r -,  -__ba£ -) - -500 -__THROW -; - -504 -__ex‹nsiÚ__ - - -505  - $wc¡ouq - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -506 -wch¬_t - ** -__»¡riù - -__’d±r -, - -507  -__ba£ -è -__THROW -; - -510 #ifdeà -__USE_GNU - - -524  - ~ - -528  - $wc¡Þ_l - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -529 -wch¬_t - ** -__»¡riù - -__’d±r -,  -__ba£ -, - -530 -__loÿË_t - -__loc -è -__THROW -; - -532  - $wc¡oul_l - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -533 -wch¬_t - ** -__»¡riù - -__’d±r -, - -534  -__ba£ -, -__loÿË_t - -__loc -è -__THROW -; - -536 -__ex‹nsiÚ__ - - -537  - $wc¡Þl_l - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -538 -wch¬_t - ** -__»¡riù - -__’d±r -, - -539  -__ba£ -, -__loÿË_t - -__loc -è -__THROW -; - -541 -__ex‹nsiÚ__ - - -542  - $wc¡ouÎ_l - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -543 -wch¬_t - ** -__»¡riù - -__’d±r -, - -544  -__ba£ -, -__loÿË_t - -__loc -) - -545 -__THROW -; - -547  - $wc¡od_l - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -548 -wch¬_t - ** -__»¡riù - -__’d±r -, -__loÿË_t - -__loc -) - -549 -__THROW -; - -551  - $wc¡of_l - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -552 -wch¬_t - ** -__»¡riù - -__’d±r -, -__loÿË_t - -__loc -) - -553 -__THROW -; - -555  - $wc¡Þd_l - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -556 -wch¬_t - ** -__»¡riù - -__’d±r -, - -557 -__loÿË_t - -__loc -è -__THROW -; - -561 #ifdef -__USE_XOPEN2K8 - - -564 -wch¬_t - * - $wýýy - ( -wch¬_t - * -__de¡ -, -__cÚ¡ - wch¬_ˆ* -__¤c -è -__THROW -; - -568 -wch¬_t - * - $wýnýy - ( -wch¬_t - * -__de¡ -, -__cÚ¡ - wch¬_ˆ* -__¤c -, -size_t - -__n -) - -569 -__THROW -; - -575 #ifdef -__USE_XOPEN2K8 - - -578 -__FILE - * - $Ý’_wmem¡»am - ( -wch¬_t - ** -__buæoc -, -size_t - * -__siz–oc -è -__THROW -; - -581 #ià -defšed - -__USE_ISOC95 - || defšed -__USE_UNIX98 - - -582 -__BEGIN_NAMESPACE_STD - - -585  - $fwide - ( -__FILE - * -__å -,  -__mode -è -__THROW -; - -592  - `fw´štf - ( -__FILE - * -__»¡riù - -__¡»am -, - -593 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...) - -599  - `w´štf - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...) - -602  - $sw´štf - ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__n -, - -603 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...) - -604 -__THROW - ; - -610  - `vfw´štf - ( -__FILE - * -__»¡riù - -__s -, - -611 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -612 -__gnuc_va_li¡ - -__¬g -) - -618  - `vw´štf - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -619 -__gnuc_va_li¡ - -__¬g -) - -623  - $vsw´štf - ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__n -, - -624 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -625 -__gnuc_va_li¡ - -__¬g -) - -626 -__THROW - ; - -633  - `fwsÿnf - ( -__FILE - * -__»¡riù - -__¡»am -, - -634 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...) - -640  - `wsÿnf - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...) - -643  - $swsÿnf - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s -, - -644 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...) - -645 -__THROW - ; - -647 #ià -defšed - -__USE_ISOC99 - && !defšed -__USE_GNU - \ - -648 && (! -defšed - -__LDBL_COMPAT - || !defšed -__REDIRECT -) \ - -649 && ( -defšed - -__STRICT_ANSI__ - || defšed -__USE_XOPEN2K -) - -650 #ifdeà -__REDIRECT - - -654  - `__REDIRECT - ( -fwsÿnf -, ( -__FILE - * -__»¡riù - -__¡»am -, - -655 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...), - -656 -__isoc99_fwsÿnf -) - -658  - `__REDIRECT - ( -wsÿnf -, ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...), - -659 -__isoc99_wsÿnf -) - -661  - `__REDIRECT - ( -swsÿnf -, ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s -, - -662 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...), - -663 -__isoc99_swsÿnf -) - -664 -__THROW - ; - -666  - `__isoc99_fwsÿnf - ( -__FILE - * -__»¡riù - -__¡»am -, - -667 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...); - -668  - `__isoc99_wsÿnf - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...); - -669  - $__isoc99_swsÿnf - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s -, - -670 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...) - -671 -__THROW -; - -672  - #fwsÿnf - -__isoc99_fwsÿnf - - - ) - -673  - #wsÿnf - -__isoc99_wsÿnf - - - ) - -674  - #swsÿnf - -__isoc99_swsÿnf - - - ) - -678 -__END_NAMESPACE_STD - - -681 #ifdeà -__USE_ISOC99 - - -682 -__BEGIN_NAMESPACE_C99 - - -687  - `vfwsÿnf - ( -__FILE - * -__»¡riù - -__s -, - -688 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -689 -__gnuc_va_li¡ - -__¬g -) - -695  - `vwsÿnf - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -696 -__gnuc_va_li¡ - -__¬g -) - -699  - $vswsÿnf - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s -, - -700 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -701 -__gnuc_va_li¡ - -__¬g -) - -702 -__THROW - ; - -704 #ià! -defšed - -__USE_GNU - \ - -705 && (! -defšed - -__LDBL_COMPAT - || !defšed -__REDIRECT -) \ - -706 && ( -defšed - -__STRICT_ANSI__ - || defšed -__USE_XOPEN2K -) - -707 #ifdeà -__REDIRECT - - -708  - `__REDIRECT - ( -vfwsÿnf -, ( -__FILE - * -__»¡riù - -__s -, - -709 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -710 -__gnuc_va_li¡ - -__¬g -), -__isoc99_vfwsÿnf -) - -712  - `__REDIRECT - ( -vwsÿnf -, ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -713 -__gnuc_va_li¡ - -__¬g -), -__isoc99_vwsÿnf -) - -715  - `__REDIRECT - ( -vswsÿnf -, ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s -, - -716 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -717 -__gnuc_va_li¡ - -__¬g -), -__isoc99_vswsÿnf -) - -718 -__THROW - ; - -720  - `__isoc99_vfwsÿnf - ( -__FILE - * -__»¡riù - -__s -, - -721 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -722 -__gnuc_va_li¡ - -__¬g -); - -723  - `__isoc99_vwsÿnf - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -724 -__gnuc_va_li¡ - -__¬g -); - -725  - $__isoc99_vswsÿnf - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s -, - -726 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -727 -__gnuc_va_li¡ - -__¬g -è -__THROW -; - -728  - #vfwsÿnf - -__isoc99_vfwsÿnf - - - ) - -729  - #vwsÿnf - -__isoc99_vwsÿnf - - - ) - -730  - #vswsÿnf - -__isoc99_vswsÿnf - - - ) - -734 -__END_NAMESPACE_C99 - - -738 -__BEGIN_NAMESPACE_STD - - -743 -wšt_t - - `fg‘wc - ( -__FILE - * -__¡»am -); - -744 -wšt_t - - `g‘wc - ( -__FILE - * -__¡»am -); - -750 -wšt_t - - `g‘wch¬ - (); - -757 -wšt_t - - `åutwc - ( -wch¬_t - -__wc -, -__FILE - * -__¡»am -); - -758 -wšt_t - - `putwc - ( -wch¬_t - -__wc -, -__FILE - * -__¡»am -); - -764 -wšt_t - - `putwch¬ - ( -wch¬_t - -__wc -); - -772 -wch¬_t - * - `fg‘ws - (wch¬_ˆ* -__»¡riù - -__ws -,  -__n -, - -773 -__FILE - * -__»¡riù - -__¡»am -); - -779  - `åutws - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ws -, - -780 -__FILE - * -__»¡riù - -__¡»am -); - -787 -wšt_t - - `ung‘wc - (wšt_ˆ -__wc -, -__FILE - * -__¡»am -); - -788 -__END_NAMESPACE_STD - - -791 #ifdeà -__USE_GNU - - -799 -wšt_t - - `g‘wc_uÆocked - ( -__FILE - * -__¡»am -); - -800 -wšt_t - - `g‘wch¬_uÆocked - (); - -808 -wšt_t - - `fg‘wc_uÆocked - ( -__FILE - * -__¡»am -); - -816 -wšt_t - - `åutwc_uÆocked - ( -wch¬_t - -__wc -, -__FILE - * -__¡»am -); - -825 -wšt_t - - `putwc_uÆocked - ( -wch¬_t - -__wc -, -__FILE - * -__¡»am -); - -826 -wšt_t - - `putwch¬_uÆocked - ( -wch¬_t - -__wc -); - -835 -wch¬_t - * - `fg‘ws_uÆocked - (wch¬_ˆ* -__»¡riù - -__ws -,  -__n -, - -836 -__FILE - * -__»¡riù - -__¡»am -); - -844  - `åutws_uÆocked - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ws -, - -845 -__FILE - * -__»¡riù - -__¡»am -); - -849 -__BEGIN_NAMESPACE_C99 - - -853 -size_t - - $wcsáime - ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__maxsize -, - -854 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -855 -__cÚ¡ -  -tm - * -__»¡riù - -__ -è -__THROW -; - -856 -__END_NAMESPACE_C99 - - -858 #ifdeà -__USE_GNU - - -859  - ~ - -863 -size_t - - $wcsáime_l - ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__maxsize -, - -864 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -865 -__cÚ¡ -  -tm - * -__»¡riù - -__ -, - -866 -__loÿË_t - -__loc -è -__THROW -; - -875 #ià -defšed - -__USE_UNIX98 - && !defšed -__USE_GNU - - -876  - #__Ãed_iswxxx - - - ) - -877  - ~ - -881 #ià -__USE_FORTIFY_LEVEL - > 0 && -defšed - -__ex‹º_®ways_šlše - - -882  - ~ - -885 #ifdeà -__LDBL_COMPAT - - -886  - ~ - -889 -__END_DECLS - - -897 #undeà -__Ãed_mb¡©e_t - - -898 #undeà -__Ãed_wšt_t - - - @/usr/include/xlocale.h - -21 #iâdeà -_XLOCALE_H - - -22  - #_XLOCALE_H - 1 - - ) - -28  - s__loÿË_¡ruù - - -31  -loÿË_d©a - * - m__loÿËs -[13]; - -34 cÚ¡ * - m__ùy³_b -; - -35 cÚ¡ * - m__ùy³_tÞow” -; - -36 cÚ¡ * - m__ùy³_touµ” -; - -39 cÚ¡ * - m__Çmes -[13]; - -40 } * - t__loÿË_t -; - -43  -__loÿË_t - - tloÿË_t -; - - @/usr/include/bits/byteswap.h - -21 #ià! -defšed - -_BYTESWAP_H - && !defšed -_NETINET_IN_H - && !defšed -_ENDIAN_H - - -25 #iâdeà -_BITS_BYTESWAP_H - - -26  - #_BITS_BYTESWAP_H - 1 - - ) - -28  - ~ - -31  - #__bsw­_cÚ¡ªt_16 -( -x -) \ - -32 (((( -x -è>> 8è& 0xffè| (((xè& 0xffè<< 8)) - - ) - -34 #ià -defšed - -__GNUC__ - && __GNUC__ >= 2 - -35  - #__bsw­_16 -( -x -) \ - -36 ( -__ex‹nsiÚ__ - \ - -37 ({  -__v -, -__x - = ( -x -); \ - -38 ià( - `__bužtš_cÚ¡ªt_p - ( -__x -)) \ - -39 -__v - = - `__bsw­_cÚ¡ªt_16 - ( -__x -); \ - -41 - `__asm__ - ("rorw $8, %w0" \ - -42 : "ô" ( -__v -) \ - -43 : "0" ( -__x -) \ - -45 -__v -; })) - - ) - -48  - #__bsw­_16 -( -x -) \ - -49 ( -__ex‹nsiÚ__ - \ - -50 ({  -__x - = ( -x -); - `__bsw­_cÚ¡ªt_16 - (__x); })) - - ) - -55  - #__bsw­_cÚ¡ªt_32 -( -x -) \ - -56 (((( -x -) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ - -57 ((( -x -è& 0x0000ff00è<< 8è| (((xè& 0x000000ffè<< 24)) - - ) - -59 #ià -defšed - -__GNUC__ - && __GNUC__ >= 2 - -60 #ià -__WORDSIZE - =ð64 || ( -defšed - -__i486__ - || defšed -__³Áium__ - \ - -61 || -defšed - - g__³Áium´o__ - || defšed - g__³Áium4__ - \ - -62 || -defšed - - g__k8__ - || defšed - g__©hlÚ__ - \ - -63 || -defšed - - g__k6__ - || defšed - g__nocÚa__ - \ - -64 || -defšed - - g__cÜe2__ - || defšed - g__geode__ - \ - -65 || -defšed - - g__amdçm10__ -) - -68  - #__bsw­_32 -( -x -) \ - -69 ( -__ex‹nsiÚ__ - \ - -70 ({  -__v -, -__x - = ( -x -); \ - -71 ià( - `__bužtš_cÚ¡ªt_p - ( -__x -)) \ - -72 -__v - = - `__bsw­_cÚ¡ªt_32 - ( -__x -); \ - -74 - `__asm__ - ("bsw­ %0" : "ô" ( -__v -è: "0" ( -__x -)); \ - -75 -__v -; })) - - ) - -77  - #__bsw­_32 -( -x -) \ - -78 ( -__ex‹nsiÚ__ - \ - -79 ({  -__v -, -__x - = ( -x -); \ - -80 ià( - `__bužtš_cÚ¡ªt_p - ( -__x -)) \ - -81 -__v - = - `__bsw­_cÚ¡ªt_32 - ( -__x -); \ - -83 - `__asm__ - ("rorw $8, %w0;" \ - -86 : "ô" ( -__v -) \ - -87 : "0" ( -__x -) \ - -89 -__v -; })) - - ) - -92  - #__bsw­_32 -( -x -) \ - -93 ( -__ex‹nsiÚ__ - \ - -94 ({  -__x - = ( -x -); - `__bsw­_cÚ¡ªt_32 - (__x); })) - - ) - -98 #ià -defšed - -__GNUC__ - && __GNUC__ >= 2 - -100  - #__bsw­_cÚ¡ªt_64 -( -x -) \ - -101 (((( -x -) & 0xff00000000000000ull) >> 56) \ - -102 | ((( -x -) & 0x00ff000000000000ull) >> 40) \ - -103 | ((( -x -) & 0x0000ff0000000000ull) >> 24) \ - -104 | ((( -x -) & 0x000000ff00000000ull) >> 8) \ - -105 | ((( -x -) & 0x00000000ff000000ull) << 8) \ - -106 | ((( -x -) & 0x0000000000ff0000ull) << 24) \ - -107 | ((( -x -) & 0x000000000000ff00ull) << 40) \ - -108 | ((( -x -è& 0x00000000000000ffuÎè<< 56)) - - ) - -110 #ià -__WORDSIZE - == 64 - -111  - #__bsw­_64 -( -x -) \ - -112 ( -__ex‹nsiÚ__ - \ - -113 ({  -__v -, -__x - = ( -x -); \ - -114 ià( - `__bužtš_cÚ¡ªt_p - ( -__x -)) \ - -115 -__v - = - `__bsw­_cÚ¡ªt_64 - ( -__x -); \ - -117 - `__asm__ - ("bsw­ %q0" : "ô" ( -__v -è: "0" ( -__x -)); \ - -118 -__v -; })) - - ) - -120  - #__bsw­_64 -( -x -) \ - -121 ( -__ex‹nsiÚ__ - \ - -122 ({ uniÚ { -__ex‹nsiÚ__ -  -__Î -; \ - -123  -__l -[2]; } -__w -, -__r -; \ - -124 ià( - `__bužtš_cÚ¡ªt_p - ( -x -)) \ - -125 -__r -. -__Î - = - `__bsw­_cÚ¡ªt_64 - ( -x -); \ - -128 -__w -. -__Î - = ( -x -); \ - -129 -__r -. -__l -[0] = - `__bsw­_32 - ( -__w -.__l[1]); \ - -130 -__r -. -__l -[1] = - `__bsw­_32 - ( -__w -.__l[0]); \ - -132 -__r -. -__Î -; })) - - ) - - @/usr/include/bits/endian.h - -3 #iâdeà -_ENDIAN_H - - -7  - #__BYTE_ORDER - -__LITTLE_ENDIAN - - - ) - - @/usr/include/bits/wchar-ldbl.h - -20 #iâdeà -_WCHAR_H - - -24 #ià -defšed - -__USE_ISOC95 - || defšed -__USE_UNIX98 - - -25 -__BEGIN_NAMESPACE_C99 - - -26 -__LDBL_REDIR_DECL - ( -fw´štf -); - -27 -__LDBL_REDIR_DECL - ( -w´štf -); - -28 -__LDBL_REDIR_DECL - ( -sw´štf -); - -29 -__LDBL_REDIR_DECL - ( -vfw´štf -); - -30 -__LDBL_REDIR_DECL - ( -vw´štf -); - -31 -__LDBL_REDIR_DECL - ( -vsw´štf -); - -32 #ià -defšed - -__USE_ISOC99 - && !defšed -__USE_GNU - \ - -33 && ! -defšed - - g__REDIRECT - \ - -34 && ( -defšed - - g__STRICT_ANSI__ - || defšed - g__USE_XOPEN2K -) - -35 - $__LDBL_REDIR1_DECL - ( -fwsÿnf -, -__Ædbl___isoc99_fwsÿnf -) - -36 - $__LDBL_REDIR1_DECL - ( -wsÿnf -, -__Ædbl___isoc99_wsÿnf -) - -37 - $__LDBL_REDIR1_DECL - ( -swsÿnf -, -__Ædbl___isoc99_swsÿnf -) - -39 - `__LDBL_REDIR_DECL - ( -fwsÿnf -); - -40 - `__LDBL_REDIR_DECL - ( -wsÿnf -); - -41 - `__LDBL_REDIR_DECL - ( -swsÿnf -); - -43 -__END_NAMESPACE_C99 - - -46 #ifdeà -__USE_ISOC99 - - -47 -__BEGIN_NAMESPACE_C99 - - -48 - `__LDBL_REDIR1_DECL - ( -wc¡Þd -, -wc¡od -); - -49 #ià! -defšed - -__USE_GNU - && !defšed -__REDIRECT - \ - -50 && ( -defšed - -__STRICT_ANSI__ - || defšed -__USE_XOPEN2K -) - -51 - $__LDBL_REDIR1_DECL - ( -vfwsÿnf -, -__Ædbl___isoc99_vfwsÿnf -) - -52 - $__LDBL_REDIR1_DECL - ( -vwsÿnf -, -__Ædbl___isoc99_vwsÿnf -) - -53 - $__LDBL_REDIR1_DECL - ( -vswsÿnf -, -__Ædbl___isoc99_vswsÿnf -) - -55 - `__LDBL_REDIR_DECL - ( -vfwsÿnf -); - -56 - `__LDBL_REDIR_DECL - ( -vwsÿnf -); - -57 - `__LDBL_REDIR_DECL - ( -vswsÿnf -); - -59 -__END_NAMESPACE_C99 - - -62 #ifdeà -__USE_GNU - - -63 - `__LDBL_REDIR1_DECL - ( -wc¡Þd_l -, -wc¡od_l -); - -66 #ià -__USE_FORTIFY_LEVEL - > 0 && -defšed - -__ex‹º_®ways_šlše - - -67 - $__LDBL_REDIR_DECL - ( -__sw´štf_chk -) - -68 - $__LDBL_REDIR_DECL - ( -__vsw´štf_chk -) - -69 #ià -__USE_FORTIFY_LEVEL - > 1 - -70 - $__LDBL_REDIR_DECL - ( -__fw´štf_chk -) - -71 - $__LDBL_REDIR_DECL - ( -__w´štf_chk -) - -72 - $__LDBL_REDIR_DECL - ( -__vfw´štf_chk -) - -73 - $__LDBL_REDIR_DECL - ( -__vw´štf_chk -) - - @/usr/include/bits/wchar.h - -20 #iâdeà -_BITS_WCHAR_H - - -21  - #_BITS_WCHAR_H - 1 - - ) - -24 #ifdeà -__WCHAR_MAX__ - - -25  - #__WCHAR_MAX - -__WCHAR_MAX__ - - - ) - -27  - #__WCHAR_MAX - (2147483647) - - ) - -32 #ifdeà -__WCHAR_UNSIGNED__ - - -33  - #__WCHAR_MIN - -L -'\0' - - ) - -37 #–ià -L -'\0' - 1 > 0 - -38  - #__WCHAR_MIN - -L -'\0' - - ) - -40  - #__WCHAR_MIN - (- -__WCHAR_MAX - - 1) - - ) - - @/usr/include/bits/wchar2.h - -20 #iâdeà -_WCHAR_H - - -25 -wch¬_t - * - $__wmemýy_chk - ( -wch¬_t - * -__»¡riù - -__s1 -, - -26 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s2 -, -size_t - -__n -, - -27 -size_t - -__ns1 -è -__THROW -; - -28 -wch¬_t - * - `__REDIRECT_NTH - ( -__wmemýy_®Ÿs -, - -29 ( -wch¬_t - * -__»¡riù - -__s1 -, - -30 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s2 -, -size_t - -__n -), - -31 -wmemýy -); - -32 -wch¬_t - * - `__REDIRECT_NTH - ( -__wmemýy_chk_w¬n -, - -33 ( -wch¬_t - * -__»¡riù - -__s1 -, - -34 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s2 -, -size_t - -__n -, - -35 -size_t - -__ns1 -), -__wmemýy_chk -) - -36 - `__w¬Ç‰r - ("wmemcpy called with†ength biggerhan size of destination " - -39 -__ex‹º_®ways_šlše - -wch¬_t - * - -40 - `__NTH - ( - $wmemýy - ( -wch¬_t - * -__»¡riù - -__s1 -, -__cÚ¡ - wch¬_ˆ*__»¡riù -__s2 -, - -41 -size_t - -__n -)) - -43 ià( - `__bos0 - ( -__s1 -è!ð( -size_t -) -1) - -45 ià(! - `__bužtš_cÚ¡ªt_p - ( -__n -)) - -46  - `__wmemýy_chk - ( -__s1 -, -__s2 -, -__n -, - -47 - `__bos0 - ( -__s1 -è/  ( -wch¬_t -)); - -49 ià( -__n - > - `__bos0 - ( -__s1 -è/  ( -wch¬_t -)) - -50  - `__wmemýy_chk_w¬n - ( -__s1 -, -__s2 -, -__n -, - -51 - `__bos0 - ( -__s1 -è/  ( -wch¬_t -)); - -53  - `__wmemýy_®Ÿs - ( -__s1 -, -__s2 -, -__n -); - -54 - } -} - -57 -wch¬_t - * - $__wmemmove_chk - ( -wch¬_t - * -__s1 -, -__cÚ¡ - wch¬_ˆ* -__s2 -, - -58 -size_t - -__n -, size_ˆ -__ns1 -è -__THROW -; - -59 -wch¬_t - * - `__REDIRECT_NTH - ( -__wmemmove_®Ÿs -, (wch¬_ˆ* -__s1 -, - -60 -__cÚ¡ - -wch¬_t - * -__s2 -, - -61 -size_t - -__n -), -wmemmove -); - -62 -wch¬_t - * - `__REDIRECT_NTH - ( -__wmemmove_chk_w¬n -, - -63 ( -wch¬_t - * -__»¡riù - -__s1 -, - -64 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s2 -, -size_t - -__n -, - -65 -size_t - -__ns1 -), -__wmemmove_chk -) - -66 - `__w¬Ç‰r - ("wmemmove called with†ength biggerhan size of destination " - -69 -__ex‹º_®ways_šlše - -wch¬_t - * - -70 - `__NTH - ( - $wmemmove - ( -wch¬_t - * -__»¡riù - -__s1 -, -__cÚ¡ - wch¬_ˆ*__»¡riù -__s2 -, - -71 -size_t - -__n -)) - -73 ià( - `__bos0 - ( -__s1 -è!ð( -size_t -) -1) - -75 ià(! - `__bužtš_cÚ¡ªt_p - ( -__n -)) - -76  - `__wmemmove_chk - ( -__s1 -, -__s2 -, -__n -, - -77 - `__bos0 - ( -__s1 -è/  ( -wch¬_t -)); - -79 ià( -__n - > - `__bos0 - ( -__s1 -è/  ( -wch¬_t -)) - -80  - `__wmemmove_chk_w¬n - ( -__s1 -, -__s2 -, -__n -, - -81 - `__bos0 - ( -__s1 -è/  ( -wch¬_t -)); - -83  - `__wmemmove_®Ÿs - ( -__s1 -, -__s2 -, -__n -); - -84 - } -} - -87 #ifdeà -__USE_GNU - - -88 -wch¬_t - * - $__wmempýy_chk - ( -wch¬_t - * -__»¡riù - -__s1 -, - -89 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s2 -, -size_t - -__n -, - -90 -size_t - -__ns1 -è -__THROW -; - -91 -wch¬_t - * - `__REDIRECT_NTH - ( -__wmempýy_®Ÿs -, - -92 ( -wch¬_t - * -__»¡riù - -__s1 -, - -93 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s2 -, - -94 -size_t - -__n -), -wmempýy -); - -95 -wch¬_t - * - `__REDIRECT_NTH - ( -__wmempýy_chk_w¬n -, - -96 ( -wch¬_t - * -__»¡riù - -__s1 -, - -97 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s2 -, -size_t - -__n -, - -98 -size_t - -__ns1 -), -__wmempýy_chk -) - -99 - `__w¬Ç‰r - ("wmempcpy called with†ength biggerhan size of destination " - -102 -__ex‹º_®ways_šlše - -wch¬_t - * - -103 - `__NTH - ( - $wmempýy - ( -wch¬_t - * -__»¡riù - -__s1 -, -__cÚ¡ - wch¬_ˆ*__»¡riù -__s2 -, - -104 -size_t - -__n -)) - -106 ià( - `__bos0 - ( -__s1 -è!ð( -size_t -) -1) - -108 ià(! - `__bužtš_cÚ¡ªt_p - ( -__n -)) - -109  - `__wmempýy_chk - ( -__s1 -, -__s2 -, -__n -, - -110 - `__bos0 - ( -__s1 -è/  ( -wch¬_t -)); - -112 ià( -__n - > - `__bos0 - ( -__s1 -è/  ( -wch¬_t -)) - -113  - `__wmempýy_chk_w¬n - ( -__s1 -, -__s2 -, -__n -, - -114 - `__bos0 - ( -__s1 -è/  ( -wch¬_t -)); - -116  - `__wmempýy_®Ÿs - ( -__s1 -, -__s2 -, -__n -); - -117 - } -} - -121 -wch¬_t - * - $__wmem£t_chk - ( -wch¬_t - * -__s -, wch¬_ˆ -__c -, -size_t - -__n -, - -122 -size_t - -__ns -è -__THROW -; - -123 -wch¬_t - * - `__REDIRECT_NTH - ( -__wmem£t_®Ÿs -, (wch¬_ˆ* -__s -, wch¬_ˆ -__c -, - -124 -size_t - -__n -), -wmem£t -); - -125 -wch¬_t - * - `__REDIRECT_NTH - ( -__wmem£t_chk_w¬n -, - -126 ( -wch¬_t - * -__s -, wch¬_ˆ -__c -, -size_t - -__n -, - -127 -size_t - -__ns -), -__wmem£t_chk -) - -128 - `__w¬Ç‰r - ("wmemset called with†ength biggerhan size of destination " - -131 -__ex‹º_®ways_šlše - -wch¬_t - * - -132 - `__NTH - ( - $wmem£t - ( -wch¬_t - * -__»¡riù - -__s -, wch¬_ˆ -__c -, -size_t - -__n -)) - -134 ià( - `__bos0 - ( -__s -è!ð( -size_t -) -1) - -136 ià(! - `__bužtš_cÚ¡ªt_p - ( -__n -)) - -137  - `__wmem£t_chk - ( -__s -, -__c -, -__n -, - `__bos0 - (__sè/  ( -wch¬_t -)); - -139 ià( -__n - > - `__bos0 - ( -__s -è/  ( -wch¬_t -)) - -140  - `__wmem£t_chk_w¬n - ( -__s -, -__c -, -__n -, - -141 - `__bos0 - ( -__s -è/  ( -wch¬_t -)); - -143  - `__wmem£t_®Ÿs - ( -__s -, -__c -, -__n -); - -144 - } -} - -147 -wch¬_t - * - $__wcsýy_chk - ( -wch¬_t - * -__»¡riù - -__de¡ -, - -148 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, - -149 -size_t - -__n -è -__THROW -; - -150 -wch¬_t - * - `__REDIRECT_NTH - ( -__wcsýy_®Ÿs -, - -151 ( -wch¬_t - * -__»¡riù - -__de¡ -, - -152 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -), -wcsýy -); - -154 -__ex‹º_®ways_šlše - -wch¬_t - * - -155 - `__NTH - ( - $wcsýy - ( -wch¬_t - * -__de¡ -, -__cÚ¡ - wch¬_ˆ* -__¤c -)) - -157 ià( - `__bos - ( -__de¡ -è!ð( -size_t -) -1) - -158  - `__wcsýy_chk - ( -__de¡ -, -__¤c -, - `__bos - (__de¡è/  ( -wch¬_t -)); - -159  - `__wcsýy_®Ÿs - ( -__de¡ -, -__¤c -); - -160 - } -} - -163 -wch¬_t - * - $__wýýy_chk - ( -wch¬_t - * -__de¡ -, -__cÚ¡ - wch¬_ˆ* -__¤c -, - -164 -size_t - -__de¡Ën -è -__THROW -; - -165 -wch¬_t - * - `__REDIRECT_NTH - ( -__wýýy_®Ÿs -, (wch¬_ˆ* -__de¡ -, - -166 -__cÚ¡ - -wch¬_t - * -__¤c -), - -167 -wýýy -); - -169 -__ex‹º_®ways_šlše - -wch¬_t - * - -170 - `__NTH - ( - $wýýy - ( -wch¬_t - * -__de¡ -, -__cÚ¡ - wch¬_ˆ* -__¤c -)) - -172 ià( - `__bos - ( -__de¡ -è!ð( -size_t -) -1) - -173  - `__wýýy_chk - ( -__de¡ -, -__¤c -, - `__bos - (__de¡è/  ( -wch¬_t -)); - -174  - `__wýýy_®Ÿs - ( -__de¡ -, -__¤c -); - -175 - } -} - -178 -wch¬_t - * - $__wc¢ýy_chk - ( -wch¬_t - * -__»¡riù - -__de¡ -, - -179 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, -size_t - -__n -, - -180 -size_t - -__de¡Ën -è -__THROW -; - -181 -wch¬_t - * - `__REDIRECT_NTH - ( -__wc¢ýy_®Ÿs -, - -182 ( -wch¬_t - * -__»¡riù - -__de¡ -, - -183 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, - -184 -size_t - -__n -), -wc¢ýy -); - -185 -wch¬_t - * - `__REDIRECT_NTH - ( -__wc¢ýy_chk_w¬n -, - -186 ( -wch¬_t - * -__»¡riù - -__de¡ -, - -187 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, - -188 -size_t - -__n -, size_ˆ -__de¡Ën -), -__wc¢ýy_chk -) - -189 - `__w¬Ç‰r - ("wcsncpy called with†ength biggerhan size of destination " - -192 -__ex‹º_®ways_šlše - -wch¬_t - * - -193 - `__NTH - ( - $wc¢ýy - ( -wch¬_t - * -__de¡ -, -__cÚ¡ - wch¬_ˆ* -__¤c -, -size_t - -__n -)) - -195 ià( - `__bos - ( -__de¡ -è!ð( -size_t -) -1) - -197 ià(! - `__bužtš_cÚ¡ªt_p - ( -__n -)) - -198  - `__wc¢ýy_chk - ( -__de¡ -, -__¤c -, -__n -, - -199 - `__bos - ( -__de¡ -è/  ( -wch¬_t -)); - -200 ià( -__n - > - `__bos - ( -__de¡ -è/  ( -wch¬_t -)) - -201  - `__wc¢ýy_chk_w¬n - ( -__de¡ -, -__¤c -, -__n -, - -202 - `__bos - ( -__de¡ -è/  ( -wch¬_t -)); - -204  - `__wc¢ýy_®Ÿs - ( -__de¡ -, -__¤c -, -__n -); - -205 - } -} - -208 -wch¬_t - * - $__wýnýy_chk - ( -wch¬_t - * -__»¡riù - -__de¡ -, - -209 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, -size_t - -__n -, - -210 -size_t - -__de¡Ën -è -__THROW -; - -211 -wch¬_t - * - `__REDIRECT_NTH - ( -__wýnýy_®Ÿs -, - -212 ( -wch¬_t - * -__»¡riù - -__de¡ -, - -213 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, - -214 -size_t - -__n -), -wýnýy -); - -215 -wch¬_t - * - `__REDIRECT_NTH - ( -__wýnýy_chk_w¬n -, - -216 ( -wch¬_t - * -__»¡riù - -__de¡ -, - -217 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, - -218 -size_t - -__n -, size_ˆ -__de¡Ën -), -__wýnýy_chk -) - -219 - `__w¬Ç‰r - ("wcpncpy called with†ength biggerhan size of destination " - -222 -__ex‹º_®ways_šlše - -wch¬_t - * - -223 - `__NTH - ( - $wýnýy - ( -wch¬_t - * -__de¡ -, -__cÚ¡ - wch¬_ˆ* -__¤c -, -size_t - -__n -)) - -225 ià( - `__bos - ( -__de¡ -è!ð( -size_t -) -1) - -227 ià(! - `__bužtš_cÚ¡ªt_p - ( -__n -)) - -228  - `__wýnýy_chk - ( -__de¡ -, -__¤c -, -__n -, - -229 - `__bos - ( -__de¡ -è/  ( -wch¬_t -)); - -230 ià( -__n - > - `__bos - ( -__de¡ -è/  ( -wch¬_t -)) - -231  - `__wýnýy_chk_w¬n - ( -__de¡ -, -__¤c -, -__n -, - -232 - `__bos - ( -__de¡ -è/  ( -wch¬_t -)); - -234  - `__wýnýy_®Ÿs - ( -__de¡ -, -__¤c -, -__n -); - -235 - } -} - -238 -wch¬_t - * - $__wcsÿt_chk - ( -wch¬_t - * -__»¡riù - -__de¡ -, - -239 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, - -240 -size_t - -__de¡Ën -è -__THROW -; - -241 -wch¬_t - * - `__REDIRECT_NTH - ( -__wcsÿt_®Ÿs -, - -242 ( -wch¬_t - * -__»¡riù - -__de¡ -, - -243 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -), -wcsÿt -); - -245 -__ex‹º_®ways_šlše - -wch¬_t - * - -246 - `__NTH - ( - $wcsÿt - ( -wch¬_t - * -__de¡ -, -__cÚ¡ - wch¬_ˆ* -__¤c -)) - -248 ià( - `__bos - ( -__de¡ -è!ð( -size_t -) -1) - -249  - `__wcsÿt_chk - ( -__de¡ -, -__¤c -, - `__bos - (__de¡è/  ( -wch¬_t -)); - -250  - `__wcsÿt_®Ÿs - ( -__de¡ -, -__¤c -); - -251 - } -} - -254 -wch¬_t - * - $__wc¢ÿt_chk - ( -wch¬_t - * -__»¡riù - -__de¡ -, - -255 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, - -256 -size_t - -__n -, size_ˆ -__de¡Ën -è -__THROW -; - -257 -wch¬_t - * - `__REDIRECT_NTH - ( -__wc¢ÿt_®Ÿs -, - -258 ( -wch¬_t - * -__»¡riù - -__de¡ -, - -259 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, - -260 -size_t - -__n -), -wc¢ÿt -); - -262 -__ex‹º_®ways_šlše - -wch¬_t - * - -263 - `__NTH - ( - $wc¢ÿt - ( -wch¬_t - * -__de¡ -, -__cÚ¡ - wch¬_ˆ* -__¤c -, -size_t - -__n -)) - -265 ià( - `__bos - ( -__de¡ -è!ð( -size_t -) -1) - -266  - `__wc¢ÿt_chk - ( -__de¡ -, -__¤c -, -__n -, - -267 - `__bos - ( -__de¡ -è/  ( -wch¬_t -)); - -268  - `__wc¢ÿt_®Ÿs - ( -__de¡ -, -__¤c -, -__n -); - -269 - } -} - -272  - $__sw´štf_chk - ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__n -, - -273  -__æag -, -size_t - -__s_Ën -, - -274 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...) - -275 -__THROW - ; - -277  - `__REDIRECT_NTH_LDBL - ( -__sw´štf_®Ÿs -, - -278 ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__n -, - -279 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fmt -, ...), - -280 -sw´štf -); - -282 #ifdeà -__va_¬g_·ck - - -283 -__ex‹º_®ways_šlše -  - -284 - `__NTH - ( - $sw´štf - ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__n -, - -285 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fmt -, ...)) - -287 ià( - `__bos - ( -__s -è!ð( -size_t -è-1 || -__USE_FORTIFY_LEVEL - > 1) - -288  - `__sw´štf_chk - ( -__s -, -__n -, -__USE_FORTIFY_LEVEL - - 1, - -289 - `__bos - ( -__s -è/  ( -wch¬_t -), - -290 -__fmt -, - `__va_¬g_·ck - ()); - -291  - `__sw´štf_®Ÿs - ( -__s -, -__n -, -__fmt -, - `__va_¬g_·ck - ()); - -292 - } -} - -293 #–ià! -defšed - -__ýlu¥lus - - -295  - #sw´štf -( -s -, -n -, ...) \ - -296 ( - `__bos - ( -s -è!ð( -size_t -è-1 || -__USE_FORTIFY_LEVEL - > 1 \ - -297 ? - `__sw´štf_chk - ( -s -, -n -, -__USE_FORTIFY_LEVEL - - 1, \ - -298 - `__bos - ( -s -è/  ( -wch¬_t -), -__VA_ARGS__ -) \ - -299 : - `sw´štf - ( -s -, -n -, -__VA_ARGS__ -)) - - ) - -302  - $__vsw´štf_chk - ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__n -, - -303  -__æag -, -size_t - -__s_Ën -, - -304 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -305 -__gnuc_va_li¡ - -__¬g -) - -306 -__THROW - ; - -308  - `__REDIRECT_NTH_LDBL - ( -__vsw´štf_®Ÿs -, - -309 ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__n -, - -310 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fmt -, - -311 -__gnuc_va_li¡ - -__­ -), -vsw´štf -); - -313 -__ex‹º_®ways_šlše -  - -314 - `__NTH - ( - $vsw´štf - ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__n -, - -315 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fmt -, -__gnuc_va_li¡ - -__­ -)) - -317 ià( - `__bos - ( -__s -è!ð( -size_t -è-1 || -__USE_FORTIFY_LEVEL - > 1) - -318  - `__vsw´štf_chk - ( -__s -, -__n -, -__USE_FORTIFY_LEVEL - - 1, - -319 - `__bos - ( -__s -è/  ( -wch¬_t -), -__fmt -, -__­ -); - -320  - `__vsw´štf_®Ÿs - ( -__s -, -__n -, -__fmt -, -__­ -); - -321 - } -} - -324 #ià -__USE_FORTIFY_LEVEL - > 1 - -326  -__fw´štf_chk - ( -__FILE - * -__»¡riù - -__¡»am -,  -__æag -, - -327 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...); - -328  -__w´štf_chk - ( -__æag -, -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -330  -__vfw´štf_chk - ( -__FILE - * -__»¡riù - -__¡»am -,  -__æag -, - -331 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -332 -__gnuc_va_li¡ - -__­ -); - -333  -__vw´štf_chk - ( -__æag -, -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -334 -__gnuc_va_li¡ - -__­ -); - -336 #ifdeà -__va_¬g_·ck - - -337 -__ex‹º_®ways_šlše -  - -338 - $w´štf - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fmt -, ...) - -340  - `__w´štf_chk - ( -__USE_FORTIFY_LEVEL - - 1, -__fmt -, - `__va_¬g_·ck - ()); - -341 - } -} - -343 -__ex‹º_®ways_šlše -  - -344 - $fw´štf - ( -__FILE - * -__»¡riù - -__¡»am -, -__cÚ¡ - -wch¬_t - *__»¡riù -__fmt -, ...) - -346  - `__fw´štf_chk - ( -__¡»am -, -__USE_FORTIFY_LEVEL - - 1, -__fmt -, - -347 - `__va_¬g_·ck - ()); - -348 - } -} - -349 #–ià! -defšed - -__ýlu¥lus - - -350  - #w´štf -(...) \ - -351 - `__w´štf_chk - ( -__USE_FORTIFY_LEVEL - - 1, -__VA_ARGS__ -) - - ) - -352  - #fw´štf -( -¡»am -, ...) \ - -353 - `__fw´štf_chk - ( -¡»am -, -__USE_FORTIFY_LEVEL - - 1, -__VA_ARGS__ -) - - ) - -356 -__ex‹º_®ways_šlše -  - -357 - $vw´štf - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fmt -, -__gnuc_va_li¡ - -__­ -) - -359  - `__vw´štf_chk - ( -__USE_FORTIFY_LEVEL - - 1, -__fmt -, -__­ -); - -360 - } -} - -362 -__ex‹º_®ways_šlše -  - -363 - $vfw´štf - ( -__FILE - * -__»¡riù - -__¡»am -, - -364 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fmt -, -__gnuc_va_li¡ - -__­ -) - -366  - `__vfw´štf_chk - ( -__¡»am -, -__USE_FORTIFY_LEVEL - - 1, -__fmt -, -__­ -); - -367 - } -} - -371 -wch¬_t - * - $__fg‘ws_chk - ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__size -,  -__n -, - -372 -__FILE - * -__»¡riù - -__¡»am -è -__wur -; - -373 -wch¬_t - * - `__REDIRECT - ( -__fg‘ws_®Ÿs -, - -374 ( -wch¬_t - * -__»¡riù - -__s -,  -__n -, - -375 -__FILE - * -__»¡riù - -__¡»am -), -fg‘ws -è -__wur -; - -376 -wch¬_t - * - `__REDIRECT - ( -__fg‘ws_chk_w¬n -, - -377 ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__size -,  -__n -, - -378 -__FILE - * -__»¡riù - -__¡»am -), -__fg‘ws_chk -) - -379 -__wur - - `__w¬Ç‰r - ("fgetws called with bigger sizehan†ength " - -382 -__ex‹º_®ways_šlše - -__wur - -wch¬_t - * - -383 - $fg‘ws - ( -wch¬_t - * -__»¡riù - -__s -,  -__n -, -__FILE - *__»¡riù -__¡»am -) - -385 ià( - `__bos - ( -__s -è!ð( -size_t -) -1) - -387 ià(! - `__bužtš_cÚ¡ªt_p - ( -__n -) || __n <= 0) - -388  - `__fg‘ws_chk - ( -__s -, - `__bos - (__sè/  ( -wch¬_t -), - -389 -__n -, -__¡»am -); - -391 ià(( -size_t -è -__n - > - `__bos - ( -__s -è/  ( -wch¬_t -)) - -392  - `__fg‘ws_chk_w¬n - ( -__s -, - `__bos - (__sè/  ( -wch¬_t -), - -393 -__n -, -__¡»am -); - -395  - `__fg‘ws_®Ÿs - ( -__s -, -__n -, -__¡»am -); - -396 - } -} - -398 #ifdeà -__USE_GNU - - -399 -wch¬_t - * - $__fg‘ws_uÆocked_chk - ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__size -, - -400  -__n -, -__FILE - * -__»¡riù - -__¡»am -) - -401 -__wur -; - -402 -wch¬_t - * - `__REDIRECT - ( -__fg‘ws_uÆocked_®Ÿs -, - -403 ( -wch¬_t - * -__»¡riù - -__s -,  -__n -, - -404 -__FILE - * -__»¡riù - -__¡»am -), -fg‘ws_uÆocked -) - -405 -__wur -; - -406 -wch¬_t - * - `__REDIRECT - ( -__fg‘ws_uÆocked_chk_w¬n -, - -407 ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__size -,  -__n -, - -408 -__FILE - * -__»¡riù - -__¡»am -), - -409 -__fg‘ws_uÆocked_chk -) - -410 -__wur - - `__w¬Ç‰r - ("fgetws_unlocked called with bigger sizehan†ength " - -413 -__ex‹º_®ways_šlše - -__wur - -wch¬_t - * - -414 - $fg‘ws_uÆocked - ( -wch¬_t - * -__»¡riù - -__s -,  -__n -, -__FILE - *__»¡riù -__¡»am -) - -416 ià( - `__bos - ( -__s -è!ð( -size_t -) -1) - -418 ià(! - `__bužtš_cÚ¡ªt_p - ( -__n -) || __n <= 0) - -419  - `__fg‘ws_uÆocked_chk - ( -__s -, - `__bos - (__sè/  ( -wch¬_t -), - -420 -__n -, -__¡»am -); - -422 ià(( -size_t -è -__n - > - `__bos - ( -__s -è/  ( -wch¬_t -)) - -423  - `__fg‘ws_uÆocked_chk_w¬n - ( -__s -, - `__bos - (__sè/  ( -wch¬_t -), - -424 -__n -, -__¡»am -); - -426  - `__fg‘ws_uÆocked_®Ÿs - ( -__s -, -__n -, -__¡»am -); - -427 - } -} - -431 -size_t - - $__wütomb_chk - (* -__s -, -wch¬_t - -__wch¬ -, -mb¡©e_t - * -__p -, - -432 -size_t - -__buæ’ -è -__THROW - -__wur -; - -433 -size_t - - `__REDIRECT_NTH - ( -__wütomb_®Ÿs -, - -434 (* -__»¡riù - -__s -, -wch¬_t - -__wch¬ -, - -435 -mb¡©e_t - * -__»¡riù - -__ps -), -wütomb -è -__wur -; - -437 -__ex‹º_®ways_šlše - -__wur - -size_t - - -438 - `__NTH - ( - $wütomb - (* -__s -, -wch¬_t - -__wch¬ -, -mb¡©e_t - * -__ps -)) - -443  - #__WCHAR_MB_LEN_MAX - 16 - - ) - -444 #ià -defšed - -MB_LEN_MAX - && MB_LEN_MAX !ð -__WCHAR_MB_LEN_MAX - - -447 ià( - `__bos - ( -__s -è!ð( -size_t -è-1 && -__WCHAR_MB_LEN_MAX - > __bos (__s)) - -448  - `__wütomb_chk - ( -__s -, -__wch¬ -, -__ps -, - `__bos - (__s)); - -449  - `__wütomb_®Ÿs - ( -__s -, -__wch¬ -, -__ps -); - -450 - } -} - -453 -size_t - - $__mb¤towcs_chk - ( -wch¬_t - * -__»¡riù - -__d¡ -, - -454 -__cÚ¡ - ** -__»¡riù - -__¤c -, - -455 -size_t - -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -, - -456 -size_t - -__d¡Ën -è -__THROW -; - -457 -size_t - - `__REDIRECT_NTH - ( -__mb¤towcs_®Ÿs -, - -458 ( -wch¬_t - * -__»¡riù - -__d¡ -, - -459 -__cÚ¡ - ** -__»¡riù - -__¤c -, - -460 -size_t - -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -), - -461 -mb¤towcs -); - -462 -size_t - - `__REDIRECT_NTH - ( -__mb¤towcs_chk_w¬n -, - -463 ( -wch¬_t - * -__»¡riù - -__d¡ -, - -464 -__cÚ¡ - ** -__»¡riù - -__¤c -, - -465 -size_t - -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -, - -466 -size_t - -__d¡Ën -), -__mb¤towcs_chk -) - -467 - `__w¬Ç‰r - ("mbsrtowcs called with dst buffer smallerhan†en " - -470 -__ex‹º_®ways_šlše - -size_t - - -471 - `__NTH - ( - $mb¤towcs - ( -wch¬_t - * -__»¡riù - -__d¡ -, -__cÚ¡ - **__»¡riù -__¤c -, - -472 -size_t - -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -)) - -474 ià( - `__bos - ( -__d¡ -è!ð( -size_t -) -1) - -476 ià(! - `__bužtš_cÚ¡ªt_p - ( -__Ën -)) - -477  - `__mb¤towcs_chk - ( -__d¡ -, -__¤c -, -__Ën -, -__ps -, - -478 - `__bos - ( -__d¡ -è/  ( -wch¬_t -)); - -480 ià( -__Ën - > - `__bos - ( -__d¡ -è/  ( -wch¬_t -)) - -481  - `__mb¤towcs_chk_w¬n - ( -__d¡ -, -__¤c -, -__Ën -, -__ps -, - -482 - `__bos - ( -__d¡ -è/  ( -wch¬_t -)); - -484  - `__mb¤towcs_®Ÿs - ( -__d¡ -, -__¤c -, -__Ën -, -__ps -); - -485 - } -} - -488 -size_t - - $__wc¤tombs_chk - (* -__»¡riù - -__d¡ -, - -489 -__cÚ¡ - -wch¬_t - ** -__»¡riù - -__¤c -, - -490 -size_t - -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -, - -491 -size_t - -__d¡Ën -è -__THROW -; - -492 -size_t - - `__REDIRECT_NTH - ( -__wc¤tombs_®Ÿs -, - -493 (* -__»¡riù - -__d¡ -, - -494 -__cÚ¡ - -wch¬_t - ** -__»¡riù - -__¤c -, - -495 -size_t - -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -), - -496 -wc¤tombs -); - -497 -size_t - - `__REDIRECT_NTH - ( -__wc¤tombs_chk_w¬n -, - -498 (* -__»¡riù - -__d¡ -, - -499 -__cÚ¡ - -wch¬_t - ** -__»¡riù - -__¤c -, - -500 -size_t - -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -, - -501 -size_t - -__d¡Ën -), -__wc¤tombs_chk -) - -502 - `__w¬Ç‰r - ("wcsrtombs called with dst buffer smallerhan†en"); - -504 -__ex‹º_®ways_šlše - -size_t - - -505 - `__NTH - ( - $wc¤tombs - (* -__»¡riù - -__d¡ -, -__cÚ¡ - -wch¬_t - **__»¡riù -__¤c -, - -506 -size_t - -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -)) - -508 ià( - `__bos - ( -__d¡ -è!ð( -size_t -) -1) - -510 ià(! - `__bužtš_cÚ¡ªt_p - ( -__Ën -)) - -511  - `__wc¤tombs_chk - ( -__d¡ -, -__¤c -, -__Ën -, -__ps -, - `__bos - (__dst)); - -513 ià( -__Ën - > - `__bos - ( -__d¡ -)) - -514  - `__wc¤tombs_chk_w¬n - ( -__d¡ -, -__¤c -, -__Ën -, -__ps -, - `__bos - (__dst)); - -516  - `__wc¤tombs_®Ÿs - ( -__d¡ -, -__¤c -, -__Ën -, -__ps -); - -517 - } -} - -520 #ifdeà -__USE_GNU - - -521 -size_t - - $__mb¢¹owcs_chk - ( -wch¬_t - * -__»¡riù - -__d¡ -, - -522 -__cÚ¡ - ** -__»¡riù - -__¤c -, -size_t - -__nmc -, - -523 -size_t - -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -, - -524 -size_t - -__d¡Ën -è -__THROW -; - -525 -size_t - - `__REDIRECT_NTH - ( -__mb¢¹owcs_®Ÿs -, - -526 ( -wch¬_t - * -__»¡riù - -__d¡ -, - -527 -__cÚ¡ - ** -__»¡riù - -__¤c -, -size_t - -__nmc -, - -528 -size_t - -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -), - -529 -mb¢¹owcs -); - -530 -size_t - - `__REDIRECT_NTH - ( -__mb¢¹owcs_chk_w¬n -, - -531 ( -wch¬_t - * -__»¡riù - -__d¡ -, - -532 -__cÚ¡ - ** -__»¡riù - -__¤c -, -size_t - -__nmc -, - -533 -size_t - -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -, - -534 -size_t - -__d¡Ën -), -__mb¢¹owcs_chk -) - -535 - `__w¬Ç‰r - ("mbsnrtowcs called with dst buffer smallerhan†en " - -538 -__ex‹º_®ways_šlše - -size_t - - -539 - `__NTH - ( - $mb¢¹owcs - ( -wch¬_t - * -__»¡riù - -__d¡ -, -__cÚ¡ - **__»¡riù -__¤c -, - -540 -size_t - -__nmc -, size_ˆ -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -)) - -542 ià( - `__bos - ( -__d¡ -è!ð( -size_t -) -1) - -544 ià(! - `__bužtš_cÚ¡ªt_p - ( -__Ën -)) - -545  - `__mb¢¹owcs_chk - ( -__d¡ -, -__¤c -, -__nmc -, -__Ën -, -__ps -, - -546 - `__bos - ( -__d¡ -è/  ( -wch¬_t -)); - -548 ià( -__Ën - > - `__bos - ( -__d¡ -è/  ( -wch¬_t -)) - -549  - `__mb¢¹owcs_chk_w¬n - ( -__d¡ -, -__¤c -, -__nmc -, -__Ën -, -__ps -, - -550 - `__bos - ( -__d¡ -è/  ( -wch¬_t -)); - -552  - `__mb¢¹owcs_®Ÿs - ( -__d¡ -, -__¤c -, -__nmc -, -__Ën -, -__ps -); - -553 - } -} - -556 -size_t - - $__wc¢¹ombs_chk - (* -__»¡riù - -__d¡ -, - -557 -__cÚ¡ - -wch¬_t - ** -__»¡riù - -__¤c -, - -558 -size_t - -__nwc -, size_ˆ -__Ën -, - -559 -mb¡©e_t - * -__»¡riù - -__ps -, -size_t - -__d¡Ën -) - -560 -__THROW -; - -561 -size_t - - `__REDIRECT_NTH - ( -__wc¢¹ombs_®Ÿs -, - -562 (* -__»¡riù - -__d¡ -, - -563 -__cÚ¡ - -wch¬_t - ** -__»¡riù - -__¤c -, - -564 -size_t - -__nwc -, size_ˆ -__Ën -, - -565 -mb¡©e_t - * -__»¡riù - -__ps -), -wc¢¹ombs -); - -566 -size_t - - `__REDIRECT_NTH - ( -__wc¢¹ombs_chk_w¬n -, - -567 (* -__»¡riù - -__d¡ -, - -568 -__cÚ¡ - -wch¬_t - ** -__»¡riù - -__¤c -, - -569 -size_t - -__nwc -, size_ˆ -__Ën -, - -570 -mb¡©e_t - * -__»¡riù - -__ps -, - -571 -size_t - -__d¡Ën -), -__wc¢¹ombs_chk -) - -572 - `__w¬Ç‰r - ("wcsnrtombs called with dst buffer smallerhan†en"); - -574 -__ex‹º_®ways_šlše - -size_t - - -575 - `__NTH - ( - $wc¢¹ombs - (* -__»¡riù - -__d¡ -, -__cÚ¡ - -wch¬_t - **__»¡riù -__¤c -, - -576 -size_t - -__nwc -, size_ˆ -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -)) - -578 ià( - `__bos - ( -__d¡ -è!ð( -size_t -) -1) - -580 ià(! - `__bužtš_cÚ¡ªt_p - ( -__Ën -)) - -581  - `__wc¢¹ombs_chk - ( -__d¡ -, -__¤c -, -__nwc -, -__Ën -, -__ps -, - -582 - `__bos - ( -__d¡ -)); - -584 ià( -__Ën - > - `__bos - ( -__d¡ -)) - -585  - `__wc¢¹ombs_chk_w¬n - ( -__d¡ -, -__¤c -, -__nwc -, -__Ën -, -__ps -, - -586 - `__bos - ( -__d¡ -)); - -588  - `__wc¢¹ombs_®Ÿs - ( -__d¡ -, -__¤c -, -__nwc -, -__Ën -, -__ps -); - -589 - } -} - - @/usr/include/errno.h - -23 #iâdef -_ERRNO_H - - -27 #iâdef -__Ãed_Em©h - - -28  - #_ERRNO_H - 1 - - ) - -29  - ~<ã©u»s.h -> - -32 - g__BEGIN_DECLS - - -36  - ~ - -37 #undeà -__Ãed_Em©h - - -39 #ifdef -_ERRNO_H - - -46 #iâdef -”ºo - - -47  -”ºo -; - -50 #ifdeà -__USE_GNU - - -55 * -´og¿m_švoÿtiÚ_Çme -, * -´og¿m_švoÿtiÚ_shÜt_Çme -; - -59 - g__END_DECLS - - -67 #ià -defšed - -__USE_GNU - || defšed -__Ãed_”rÜ_t - - -68 #iâdeà -__”rÜ_t_defšed - - -69  - t”rÜ_t -; - -70  - #__”rÜ_t_defšed - 1 - - ) - -72 #undeà -__Ãed_”rÜ_t - - - @/usr/include/gnu/option-groups.h - -10 #iâdeà -__GNU_OPTION_GROUPS_H - - -11  - #__GNU_OPTION_GROUPS_H - - - ) - -13  - #__OPTION_EGLIBC_ADVANCED_INET6 - 1 - - ) - -14  - #__OPTION_EGLIBC_BACKTRACE - 1 - - ) - -15  - #__OPTION_EGLIBC_BIG_MACROS - 1 - - ) - -16  - #__OPTION_EGLIBC_BSD - 1 - - ) - -17  - #__OPTION_EGLIBC_CATGETS - 1 - - ) - -18  - #__OPTION_EGLIBC_CHARSETS - 1 - - ) - -19  - #__OPTION_EGLIBC_CXX_TESTS - 1 - - ) - -20  - #__OPTION_EGLIBC_DB_ALIASES - 1 - - ) - -21  - #__OPTION_EGLIBC_ENVZ - 1 - - ) - -22  - #__OPTION_EGLIBC_FCVT - 1 - - ) - -23  - #__OPTION_EGLIBC_FMTMSG - 1 - - ) - -24  - #__OPTION_EGLIBC_FSTAB - 1 - - ) - -25  - #__OPTION_EGLIBC_FTRAVERSE - 1 - - ) - -26  - #__OPTION_EGLIBC_GETLOGIN - 1 - - ) - -27  - #__OPTION_EGLIBC_INET - 1 - - ) - -28  - #__OPTION_EGLIBC_LIBM - 1 - - ) - -29  - #__OPTION_EGLIBC_LOCALES - 1 - - ) - -30  - #__OPTION_EGLIBC_LOCALE_CODE - 1 - - ) - -31  - #__OPTION_EGLIBC_MEMUSAGE - 1 - - ) - -32  - #__OPTION_EGLIBC_NIS - 1 - - ) - -33  - #__OPTION_EGLIBC_NSSWITCH - 1 - - ) - -34  - #__OPTION_EGLIBC_RCMD - 1 - - ) - -35  - #__OPTION_EGLIBC_SPAWN - 1 - - ) - -36  - #__OPTION_EGLIBC_STREAMS - 1 - - ) - -37  - #__OPTION_EGLIBC_SUNRPC - 1 - - ) - -38  - #__OPTION_EGLIBC_UTMP - 1 - - ) - -39  - #__OPTION_EGLIBC_UTMPX - 1 - - ) - -40  - #__OPTION_EGLIBC_WORDEXP - 1 - - ) - -41  - #__OPTION_POSIX_C_LANG_WIDE_CHAR - 1 - - ) - -42  - #__OPTION_POSIX_REGEXP - 1 - - ) - -43  - #__OPTION_POSIX_REGEXP_GLIBC - 1 - - ) - -44  - #__OPTION_POSIX_WIDE_CHAR_DEVICE_IO - 1 - - ) - - @/usr/include/pthread.h - -20 #iâdeà -_PTHREAD_H - - -21  - #_PTHREAD_H - 1 - - ) - -23  - ~<ã©u»s.h -> - -24  - ~<’dŸn.h -> - -25  - ~ - -26  - ~ - -28  - #__Ãed_sig£t_t - - - ) - -29  - ~ - -30  - ~ - -31  - ~ - -32  - ~ - -38 - mPTHREAD_CREATE_JOINABLE -, - -39  - #PTHREAD_CREATE_JOINABLE - -PTHREAD_CREATE_JOINABLE - - - ) - -40 - mPTHREAD_CREATE_DETACHED - - -41  - #PTHREAD_CREATE_DETACHED - -PTHREAD_CREATE_DETACHED - - - ) - -48 - mPTHREAD_MUTEX_TIMED_NP -, - -49 - mPTHREAD_MUTEX_RECURSIVE_NP -, - -50 - mPTHREAD_MUTEX_ERRORCHECK_NP -, - -51 - mPTHREAD_MUTEX_ADAPTIVE_NP - - -52 #ifdeà -__USE_UNIX98 - - -54 - mPTHREAD_MUTEX_NORMAL - = -PTHREAD_MUTEX_TIMED_NP -, - -55 - mPTHREAD_MUTEX_RECURSIVE - = -PTHREAD_MUTEX_RECURSIVE_NP -, - -56 - mPTHREAD_MUTEX_ERRORCHECK - = -PTHREAD_MUTEX_ERRORCHECK_NP -, - -57 - mPTHREAD_MUTEX_DEFAULT - = -PTHREAD_MUTEX_NORMAL - - -59 #ifdeà -__USE_GNU - - -61 , - mPTHREAD_MUTEX_FAST_NP - = -PTHREAD_MUTEX_TIMED_NP - - -66 #ifdeà -__USE_XOPEN2K - - -70 - mPTHREAD_MUTEX_STALLED -, - -71 - mPTHREAD_MUTEX_STALLED_NP - = -PTHREAD_MUTEX_STALLED -, - -72 - mPTHREAD_MUTEX_ROBUST -, - -73 - mPTHREAD_MUTEX_ROBUST_NP - = -PTHREAD_MUTEX_ROBUST - - -78 #ifdeà -__USE_UNIX98 - - -82 - mPTHREAD_PRIO_NONE -, - -83 - mPTHREAD_PRIO_INHERIT -, - -84 - mPTHREAD_PRIO_PROTECT - - -90 #ià -__WORDSIZE - == 64 - -91  - #PTHREAD_MUTEX_INITIALIZER - \ - -92 { { 0, 0, 0, 0, 0, 0, { 0, 0 } } } - - ) - -93 #ifdeà -__USE_GNU - - -94  - #PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP - \ - -95 { { 0, 0, 0, 0, -PTHREAD_MUTEX_RECURSIVE_NP -, 0, { 0, 0 } } } - - ) - -96  - #PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP - \ - -97 { { 0, 0, 0, 0, -PTHREAD_MUTEX_ERRORCHECK_NP -, 0, { 0, 0 } } } - - ) - -98  - #PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP - \ - -99 { { 0, 0, 0, 0, -PTHREAD_MUTEX_ADAPTIVE_NP -, 0, { 0, 0 } } } - - ) - -102  - #PTHREAD_MUTEX_INITIALIZER - \ - -103 { { 0, 0, 0, 0, 0, { 0 } } } - - ) - -104 #ifdeà -__USE_GNU - - -105  - #PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP - \ - -106 { { 0, 0, 0, -PTHREAD_MUTEX_RECURSIVE_NP -, 0, { 0 } } } - - ) - -107  - #PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP - \ - -108 { { 0, 0, 0, -PTHREAD_MUTEX_ERRORCHECK_NP -, 0, { 0 } } } - - ) - -109  - #PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP - \ - -110 { { 0, 0, 0, -PTHREAD_MUTEX_ADAPTIVE_NP -, 0, { 0 } } } - - ) - -116 #ià -defšed - -__USE_UNIX98 - || defšed -__USE_XOPEN2K - - -119 - mPTHREAD_RWLOCK_PREFER_READER_NP -, - -120 - mPTHREAD_RWLOCK_PREFER_WRITER_NP -, - -121 - mPTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP -, - -122 - mPTHREAD_RWLOCK_DEFAULT_NP - = -PTHREAD_RWLOCK_PREFER_READER_NP - - -126  - #PTHREAD_RWLOCK_INITIALIZER - \ - -127 { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } - - ) - -128 #ifdeà -__USE_GNU - - -129 #ià -__WORDSIZE - == 64 - -130  - #PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP - \ - -132 -PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP - } } - - ) - -134 #ià -__BYTE_ORDER - =ð -__LITTLE_ENDIAN - - -135  - #PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP - \ - -136 { { 0, 0, 0, 0, 0, 0, -PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP -, \ - -137 0, 0, 0, 0 } } - - ) - -139  - #PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP - \ - -140 { { 0, 0, 0, 0, 0, 0, 0, 0, 0, -PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP -,\ - -141 0 } } - - ) - -151 - mPTHREAD_INHERIT_SCHED -, - -152  - #PTHREAD_INHERIT_SCHED - -PTHREAD_INHERIT_SCHED - - - ) - -153 - mPTHREAD_EXPLICIT_SCHED - - -154  - #PTHREAD_EXPLICIT_SCHED - -PTHREAD_EXPLICIT_SCHED - - - ) - -161 - mPTHREAD_SCOPE_SYSTEM -, - -162  - #PTHREAD_SCOPE_SYSTEM - -PTHREAD_SCOPE_SYSTEM - - - ) - -163 - mPTHREAD_SCOPE_PROCESS - - -164  - #PTHREAD_SCOPE_PROCESS - -PTHREAD_SCOPE_PROCESS - - - ) - -171 - mPTHREAD_PROCESS_PRIVATE -, - -172  - #PTHREAD_PROCESS_PRIVATE - -PTHREAD_PROCESS_PRIVATE - - - ) - -173 - mPTHREAD_PROCESS_SHARED - - -174  - #PTHREAD_PROCESS_SHARED - -PTHREAD_PROCESS_SHARED - - - ) - -180  - #PTHREAD_COND_INITIALIZER - { { 0, 0, 0, 0, 0, (*è0, 0, 0 } } - - ) - -184  - s_±h»ad_þ—nup_bufãr - - -186 (* - m__routše -) (*); - -187 * - m__¬g -; - -188  - m__ÿnûÉy³ -; - -189  -_±h»ad_þ—nup_bufãr - * - m__´ev -; - -195 - mPTHREAD_CANCEL_ENABLE -, - -196  - #PTHREAD_CANCEL_ENABLE - -PTHREAD_CANCEL_ENABLE - - - ) - -197 - mPTHREAD_CANCEL_DISABLE - - -198  - #PTHREAD_CANCEL_DISABLE - -PTHREAD_CANCEL_DISABLE - - - ) - -202 - mPTHREAD_CANCEL_DEFERRED -, - -203  - #PTHREAD_CANCEL_DEFERRED - -PTHREAD_CANCEL_DEFERRED - - - ) - -204 - mPTHREAD_CANCEL_ASYNCHRONOUS - - -205  - #PTHREAD_CANCEL_ASYNCHRONOUS - -PTHREAD_CANCEL_ASYNCHRONOUS - - - ) - -207  - #PTHREAD_CANCELED - ((*è-1) - - ) - -211  - #PTHREAD_ONCE_INIT - 0 - - ) - -214 #ifdeà -__USE_XOPEN2K - - -218  - #PTHREAD_BARRIER_SERIAL_THREAD - -1 - - ) - -222 -__BEGIN_DECLS - - -227  -±h»ad_ü—‹ - ( -±h»ad_t - * -__»¡riù - -__Ãwth»ad -, - -228 -__cÚ¡ - -±h»ad_©Œ_t - * -__»¡riù - -__©Œ -, - -229 *(* -__¡¬t_routše -) (*), - -230 * -__»¡riù - -__¬g -è -__THROW - -__nÚnuÎ - ((1, 3)); - -236  - $±h»ad_ex™ - (* -__»tv® -è - `__©Œibu‹__ - (( -__nÜ‘uº__ -)); - -244  - `±h»ad_još - ( -±h»ad_t - -__th -, ** -__th»ad_»tuº -); - -246 #ifdeà -__USE_GNU - - -249  - $±h»ad_Œyjoš_Å - ( -±h»ad_t - -__th -, ** -__th»ad_»tuº -è -__THROW -; - -257  - `±h»ad_timedjoš_Å - ( -±h»ad_t - -__th -, ** -__th»ad_»tuº -, - -258 -__cÚ¡ -  -time¥ec - * -__ab¡ime -); - -265  - $±h»ad_d‘ach - ( -±h»ad_t - -__th -è -__THROW -; - -269 -±h»ad_t - - $±h»ad_£lf - (è -__THROW - - `__©Œibu‹__ - (( -__cÚ¡__ -)); - -272  - $±h»ad_equ® - ( -±h»ad_t - -__th»ad1 -,…th»ad_ˆ -__th»ad2 -è -__THROW -; - -280  - $±h»ad_©Œ_š™ - ( -±h»ad_©Œ_t - * -__©Œ -è -__THROW - - `__nÚnuÎ - ((1)); - -283  - $±h»ad_©Œ_de¡roy - ( -±h»ad_©Œ_t - * -__©Œ -) - -284 -__THROW - - `__nÚnuÎ - ((1)); - -287  - $±h»ad_©Œ_g‘d‘ach¡©e - ( -__cÚ¡ - -±h»ad_©Œ_t - * -__©Œ -, - -288 * -__d‘ach¡©e -) - -289 -__THROW - - `__nÚnuÎ - ((1, 2)); - -292  - $±h»ad_©Œ_£td‘ach¡©e - ( -±h»ad_©Œ_t - * -__©Œ -, - -293  -__d‘ach¡©e -) - -294 -__THROW - - `__nÚnuÎ - ((1)); - -298  - $±h»ad_©Œ_g‘gu¬dsize - ( -__cÚ¡ - -±h»ad_©Œ_t - * -__©Œ -, - -299 -size_t - * -__gu¬dsize -) - -300 -__THROW - - `__nÚnuÎ - ((1, 2)); - -303  - $±h»ad_©Œ_£tgu¬dsize - ( -±h»ad_©Œ_t - * -__©Œ -, - -304 -size_t - -__gu¬dsize -) - -305 -__THROW - - `__nÚnuÎ - ((1)); - -309  - $±h»ad_©Œ_g‘sched·¿m - ( -__cÚ¡ - -±h»ad_©Œ_t - * -__»¡riù - - -310 -__©Œ -, - -311  -sched_·¿m - * -__»¡riù - -__·¿m -) - -312 -__THROW - - `__nÚnuÎ - ((1, 2)); - -315  - $±h»ad_©Œ_£tsched·¿m - ( -±h»ad_©Œ_t - * -__»¡riù - -__©Œ -, - -316 -__cÚ¡ -  -sched_·¿m - * -__»¡riù - - -317 -__·¿m -è -__THROW - - `__nÚnuÎ - ((1, 2)); - -320  - $±h»ad_©Œ_g‘schedpÞicy - ( -__cÚ¡ - -±h»ad_©Œ_t - * -__»¡riù - - -321 -__©Œ -, * -__»¡riù - -__pÞicy -) - -322 -__THROW - - `__nÚnuÎ - ((1, 2)); - -325  - $±h»ad_©Œ_£tschedpÞicy - ( -±h»ad_©Œ_t - * -__©Œ -,  -__pÞicy -) - -326 -__THROW - - `__nÚnuÎ - ((1)); - -329  - $±h»ad_©Œ_g‘šh”™sched - ( -__cÚ¡ - -±h»ad_©Œ_t - * -__»¡riù - - -330 -__©Œ -, * -__»¡riù - -__šh”™ -) - -331 -__THROW - - `__nÚnuÎ - ((1, 2)); - -334  - $±h»ad_©Œ_£tšh”™sched - ( -±h»ad_©Œ_t - * -__©Œ -, - -335  -__šh”™ -) - -336 -__THROW - - `__nÚnuÎ - ((1)); - -340  - $±h»ad_©Œ_g‘scÝe - ( -__cÚ¡ - -±h»ad_©Œ_t - * -__»¡riù - -__©Œ -, - -341 * -__»¡riù - -__scÝe -) - -342 -__THROW - - `__nÚnuÎ - ((1, 2)); - -345  - $±h»ad_©Œ_£tscÝe - ( -±h»ad_©Œ_t - * -__©Œ -,  -__scÝe -) - -346 -__THROW - - `__nÚnuÎ - ((1)); - -349  - $±h»ad_©Œ_g‘¡ackaddr - ( -__cÚ¡ - -±h»ad_©Œ_t - * -__»¡riù - - -350 -__©Œ -, ** -__»¡riù - -__¡ackaddr -) - -351 -__THROW - - `__nÚnuÎ - ((1, 2)è -__©Œibu‹_d•»ÿ‹d__ -; - -357  - $±h»ad_©Œ_£t¡ackaddr - ( -±h»ad_©Œ_t - * -__©Œ -, - -358 * -__¡ackaddr -) - -359 -__THROW - - `__nÚnuÎ - ((1)è -__©Œibu‹_d•»ÿ‹d__ -; - -362  - $±h»ad_©Œ_g‘¡acksize - ( -__cÚ¡ - -±h»ad_©Œ_t - * -__»¡riù - - -363 -__©Œ -, -size_t - * -__»¡riù - -__¡acksize -) - -364 -__THROW - - `__nÚnuÎ - ((1, 2)); - -369  - $±h»ad_©Œ_£t¡acksize - ( -±h»ad_©Œ_t - * -__©Œ -, - -370 -size_t - -__¡acksize -) - -371 -__THROW - - `__nÚnuÎ - ((1)); - -373 #ifdeà -__USE_XOPEN2K - - -375  - $±h»ad_©Œ_g‘¡ack - ( -__cÚ¡ - -±h»ad_©Œ_t - * -__»¡riù - -__©Œ -, - -376 ** -__»¡riù - -__¡ackaddr -, - -377 -size_t - * -__»¡riù - -__¡acksize -) - -378 -__THROW - - `__nÚnuÎ - ((1, 2, 3)); - -383  - $±h»ad_©Œ_£t¡ack - ( -±h»ad_©Œ_t - * -__©Œ -, * -__¡ackaddr -, - -384 -size_t - -__¡acksize -è -__THROW - - `__nÚnuÎ - ((1)); - -387 #ifdeà -__USE_GNU - - -390  - $±h»ad_©Œ_£ffš™y_Å - ( -±h»ad_©Œ_t - * -__©Œ -, - -391 -size_t - -__ýu£tsize -, - -392 -__cÚ¡ - -ýu_£t_t - * -__ýu£t -) - -393 -__THROW - - `__nÚnuÎ - ((1, 3)); - -397  - $±h»ad_©Œ_g‘affš™y_Å - ( -__cÚ¡ - -±h»ad_©Œ_t - * -__©Œ -, - -398 -size_t - -__ýu£tsize -, - -399 -ýu_£t_t - * -__ýu£t -) - -400 -__THROW - - `__nÚnuÎ - ((1, 3)); - -406  - $±h»ad_g‘©Œ_Å - ( -±h»ad_t - -__th -, -±h»ad_©Œ_t - * -__©Œ -) - -407 -__THROW - - `__nÚnuÎ - ((2)); - -415  - $±h»ad_£tsched·¿m - ( -±h»ad_t - -__rg‘_th»ad -,  -__pÞicy -, - -416 -__cÚ¡ -  -sched_·¿m - * -__·¿m -) - -417 -__THROW - - `__nÚnuÎ - ((3)); - -420  - $±h»ad_g‘sched·¿m - ( -±h»ad_t - -__rg‘_th»ad -, - -421 * -__»¡riù - -__pÞicy -, - -422  -sched_·¿m - * -__»¡riù - -__·¿m -) - -423 -__THROW - - `__nÚnuÎ - ((2, 3)); - -426  - $±h»ad_£tsched´io - ( -±h»ad_t - -__rg‘_th»ad -,  -__´io -) - -427 -__THROW -; - -430 #ifdeà -__USE_UNIX98 - - -432  - $±h»ad_g‘cÚcu¼’cy - (è -__THROW -; - -435  - $±h»ad_£tcÚcu¼’cy - ( -__Ëv– -è -__THROW -; - -438 #ifdeà -__USE_GNU - - -443  - $±h»ad_y›ld - (è -__THROW -; - -448  - $±h»ad_£ffš™y_Å - ( -±h»ad_t - -__th -, -size_t - -__ýu£tsize -, - -449 -__cÚ¡ - -ýu_£t_t - * -__ýu£t -) - -450 -__THROW - - `__nÚnuÎ - ((3)); - -453  - $±h»ad_g‘affš™y_Å - ( -±h»ad_t - -__th -, -size_t - -__ýu£tsize -, - -454 -ýu_£t_t - * -__ýu£t -) - -455 -__THROW - - `__nÚnuÎ - ((3)); - -468  - `±h»ad_Úû - ( -±h»ad_Úû_t - * -__Úû_cÚŒÞ -, - -469 (* -__š™_routše -è()è - `__nÚnuÎ - ((1, 2)); - -480  - `±h»ad_£tÿnûl¡©e - ( -__¡©e -, * -__Þd¡©e -); - -484  - `±h»ad_£tÿnûÉy³ - ( -__ty³ -, * -__Þdty³ -); - -487  - `±h»ad_ÿnûl - ( -±h»ad_t - -__th -); - -492  - `±h»ad_‹¡ÿnûl - (); - -501 -__jmp_buf - -__ÿnûl_jmp_buf -; - -502  -__mask_was_§ved -; - -503 } -__ÿnûl_jmp_buf -[1]; - -504 * -__·d -[4]; - -505 } - t__±h»ad_unwšd_buf_t - - t__©Œibu‹__ - (( - t__®igÃd__ -)); - -508 #iâdeà -__þ—nup_fù_©Œibu‹ - - -509  - #__þ—nup_fù_©Œibu‹ - - - ) - -514  - s__±h»ad_þ—nup_äame - - -516 (* -__ÿnûl_routše -) (*); - -517 * -__ÿnûl_¬g -; - -518  -__do_™ -; - -519  -__ÿnûl_ty³ -; - -522 #ià -defšed - -__GNUC__ - && defšed -__EXCEPTIONS - - -523 #ifdeà -__ýlu¥lus - - -525 þas  - c__±h»ad_þ—nup_þass - - -527 (* -__ÿnûl_routše -) (*); - -528 * -__ÿnûl_¬g -; - -529  -__do_™ -; - -530  -__ÿnûl_ty³ -; - -532 -public -: - -533 - `__±h»ad_þ—nup_þass - ((* -__fù -è(*), * -__¬g -) - -534 : - `__ÿnûl_routše - ( -__fù -), - `__ÿnûl_¬g - ( -__¬g -), - $__do_™ - (1) { } - -535 ~ - $__±h»ad_þ—nup_þass - (è{ ià( -__do_™ -è - `__ÿnûl_routše - ( -__ÿnûl_¬g -); - } -} - -536  - $__£tdo™ - ( -__Ãwv® -è{ -__do_™ - = __Ãwv®; - } -} - -537  - $__deãr - (è{ - `±h»ad_£tÿnûÉy³ - ( -PTHREAD_CANCEL_DEFERRED -, - -538 & -__ÿnûl_ty³ -); - } -} - -539  - $__»¡Üe - (ècÚ¡ { - `±h»ad_£tÿnûÉy³ - ( -__ÿnûl_ty³ -, 0); - } -} - -549  - #±h»ad_þ—nup_push -( -routše -, -¬g -) \ - -551 -__±h»ad_þ—nup_þass - - `__þäame - ( -routše -, -¬g -) - - ) - -555  - #±h»ad_þ—nup_pÝ -( -execu‹ -) \ - -556 -__þäame -. - `__£tdo™ - ( -execu‹ -); \ - -557 } 0) - - ) - -559 #ifdeà -__USE_GNU - - -563  - #±h»ad_þ—nup_push_deãr_Å -( -routše -, -¬g -) \ - -565 -__±h»ad_þ—nup_þass - - `__þäame - ( -routše -, -¬g -); \ - -566 -__þäame -. - `__deãr - () - - ) - -571  - #±h»ad_þ—nup_pÝ_»¡Üe_Å -( -execu‹ -) \ - -572 -__þäame -. - `__»¡Üe - (); \ - -573 -__þäame -. - `__£tdo™ - ( -execu‹ -); \ - -574 } 0) - - ) - -581 -__ex‹º_šlše -  - -582 - $__±h»ad_þ—nup_routše - ( -__±h»ad_þ—nup_äame - * -__äame -) - -584 ià( -__äame --> -__do_™ -) - -585 -__äame --> - `__ÿnûl_routše - (__äame-> -__ÿnûl_¬g -); - -586 - } -} - -595  - #±h»ad_þ—nup_push -( -routše -, -¬g -) \ - -597  -__±h»ad_þ—nup_äame - -__þäame - \ - -598 - `__©Œibu‹__ - (( - `__þ—nup__ - ( -__±h»ad_þ—nup_routše -))) \ - -599 ð{ . -__ÿnûl_routše - = ( -routše -), . -__ÿnûl_¬g - = ( -¬g -), \ - -600 . -__do_™ - = 1 }; - - ) - -604  - #±h»ad_þ—nup_pÝ -( -execu‹ -) \ - -605 -__þäame -. -__do_™ - = ( -execu‹ -); \ - -606 } 0) - - ) - -608 #ifdeà -__USE_GNU - - -612  - #±h»ad_þ—nup_push_deãr_Å -( -routše -, -¬g -) \ - -614  -__±h»ad_þ—nup_äame - -__þäame - \ - -615 - `__©Œibu‹__ - (( - `__þ—nup__ - ( -__±h»ad_þ—nup_routše -))) \ - -616 ð{ . -__ÿnûl_routše - = ( -routše -), . -__ÿnûl_¬g - = ( -¬g -), \ - -617 . -__do_™ - = 1 }; \ - -618 (è - `±h»ad_£tÿnûÉy³ - ( -PTHREAD_CANCEL_DEFERRED -, \ - -619 & -__þäame -. -__ÿnûl_ty³ -) - - ) - -624  - #±h»ad_þ—nup_pÝ_»¡Üe_Å -( -execu‹ -) \ - -625 (è - `±h»ad_£tÿnûÉy³ - ( -__þäame -. -__ÿnûl_ty³ -, -NULL -); \ - -626 -__þäame -. -__do_™ - = ( -execu‹ -); \ - -627 } 0) - - ) - -638  - #±h»ad_þ—nup_push -( -routše -, -¬g -) \ - -640 -__±h»ad_unwšd_buf_t - -__ÿnûl_buf -; \ - -641 (* -__ÿnûl_routše -è(*èð( -routše -); \ - -642 * -__ÿnûl_¬g - = ( -¬g -); \ - -643  -nÙ_fœ¡_ÿÎ - = - `__sig£tjmp - (( -__jmp_buf_g - *) (*) \ - -644 -__ÿnûl_buf -. -__ÿnûl_jmp_buf -, 0); \ - -645 ià( - `__bužtš_ex³ù - ( -nÙ_fœ¡_ÿÎ -, 0)) \ - -647 - `__ÿnûl_routše - ( -__ÿnûl_¬g -); \ - -648 - `__±h»ad_unwšd_Ãxt - (& -__ÿnûl_buf -); \ - -652 - `__±h»ad_»gi¡”_ÿnûl - (& -__ÿnûl_buf -); \ - -653 dØ{ - - ) - -654  -__±h»ad_»gi¡”_ÿnûl - ( -__±h»ad_unwšd_buf_t - * -__buf -) - -655 -__þ—nup_fù_©Œibu‹ -; - -659  - #±h»ad_þ—nup_pÝ -( -execu‹ -) \ - -662 - `__±h»ad_uÄegi¡”_ÿnûl - (& -__ÿnûl_buf -); \ - -663 ià( -execu‹ -) \ - -664 - `__ÿnûl_routše - ( -__ÿnûl_¬g -); \ - -665 } 0) - - ) - -666  - $__±h»ad_uÄegi¡”_ÿnûl - ( -__±h»ad_unwšd_buf_t - * -__buf -) - -667 -__þ—nup_fù_©Œibu‹ -; - -669 #ifdeà -__USE_GNU - - -673  - #±h»ad_þ—nup_push_deãr_Å -( -routše -, -¬g -) \ - -675 -__±h»ad_unwšd_buf_t - -__ÿnûl_buf -; \ - -676 (* -__ÿnûl_routše -è(*èð( -routše -); \ - -677 * -__ÿnûl_¬g - = ( -¬g -); \ - -678  -nÙ_fœ¡_ÿÎ - = - `__sig£tjmp - (( -__jmp_buf_g - *) (*) \ - -679 -__ÿnûl_buf -. -__ÿnûl_jmp_buf -, 0); \ - -680 ià( - `__bužtš_ex³ù - ( -nÙ_fœ¡_ÿÎ -, 0)) \ - -682 - `__ÿnûl_routše - ( -__ÿnûl_¬g -); \ - -683 - `__±h»ad_unwšd_Ãxt - (& -__ÿnûl_buf -); \ - -687 - `__±h»ad_»gi¡”_ÿnûl_deãr - (& -__ÿnûl_buf -); \ - -688 dØ{ - - ) - -689  - `__±h»ad_»gi¡”_ÿnûl_deãr - ( -__±h»ad_unwšd_buf_t - * -__buf -) - -690 -__þ—nup_fù_©Œibu‹ -; - -695  - #±h»ad_þ—nup_pÝ_»¡Üe_Å -( -execu‹ -) \ - -698 - `__±h»ad_uÄegi¡”_ÿnûl_»¡Üe - (& -__ÿnûl_buf -); \ - -699 ià( -execu‹ -) \ - -700 - `__ÿnûl_routše - ( -__ÿnûl_¬g -); \ - -701 - } -} 0) - - ) - -702  - $__±h»ad_uÄegi¡”_ÿnûl_»¡Üe - ( -__±h»ad_unwšd_buf_t - * -__buf -) - -703 -__þ—nup_fù_©Œibu‹ -; - -707  - $__±h»ad_unwšd_Ãxt - ( -__±h»ad_unwšd_buf_t - * -__buf -) - -708 -__þ—nup_fù_©Œibu‹ - - `__©Œibu‹__ - (( -__nÜ‘uº__ -)) - -709 #iâdeà -SHARED - - -710 - `__©Œibu‹__ - (( -__w—k__ -)) - -716  -__jmp_buf_g -; - -717  - $__sig£tjmp - ( -__jmp_buf_g - * -__’v -,  -__§vemask -è -__THROW -; - -723  - $±h»ad_mu‹x_š™ - ( -±h»ad_mu‹x_t - * -__mu‹x -, - -724 -__cÚ¡ - -±h»ad_mu‹x©Œ_t - * -__mu‹x©Œ -) - -725 -__THROW - - `__nÚnuÎ - ((1)); - -728  - $±h»ad_mu‹x_de¡roy - ( -±h»ad_mu‹x_t - * -__mu‹x -) - -729 -__THROW - - `__nÚnuÎ - ((1)); - -732  - $±h»ad_mu‹x_Œylock - ( -±h»ad_mu‹x_t - * -__mu‹x -) - -733 -__THROW - - `__nÚnuÎ - ((1)); - -736  - $±h»ad_mu‹x_lock - ( -±h»ad_mu‹x_t - * -__mu‹x -) - -737 -__THROW - - `__nÚnuÎ - ((1)); - -739 #ifdeà -__USE_XOPEN2K - - -741  - $±h»ad_mu‹x_timedlock - ( -±h»ad_mu‹x_t - * -__»¡riù - -__mu‹x -, - -742 -__cÚ¡ -  -time¥ec - * -__»¡riù - - -743 -__ab¡ime -è -__THROW - - `__nÚnuÎ - ((1, 2)); - -747  - $±h»ad_mu‹x_uÆock - ( -±h»ad_mu‹x_t - * -__mu‹x -) - -748 -__THROW - - `__nÚnuÎ - ((1)); - -751 #ifdeà -__USE_UNIX98 - - -753  - $±h»ad_mu‹x_g‘´ioûžšg - ( -__cÚ¡ - -±h»ad_mu‹x_t - * - -754 -__»¡riù - -__mu‹x -, - -755 * -__»¡riù - -__´ioûžšg -) - -756 -__THROW - - `__nÚnuÎ - ((1, 2)); - -760  - $±h»ad_mu‹x_£rioûžšg - ( -±h»ad_mu‹x_t - * -__»¡riù - -__mu‹x -, - -761  -__´ioûžšg -, - -762 * -__»¡riù - -__Þd_ûžšg -) - -763 -__THROW - - `__nÚnuÎ - ((1, 3)); - -767 #ifdeà -__USE_XOPEN2K8 - - -769  - $±h»ad_mu‹x_cÚsi¡’t_Å - ( -±h»ad_mu‹x_t - * -__mu‹x -) - -770 -__THROW - - `__nÚnuÎ - ((1)); - -771 #ifdeà -__USE_GNU - - -772  - $±h»ad_mu‹x_cÚsi¡’t_Å - ( -±h»ad_mu‹x_t - * -__mu‹x -) - -773 -__THROW - - `__nÚnuÎ - ((1)); - -782  - $±h»ad_mu‹x©Œ_š™ - ( -±h»ad_mu‹x©Œ_t - * -__©Œ -) - -783 -__THROW - - `__nÚnuÎ - ((1)); - -786  - $±h»ad_mu‹x©Œ_de¡roy - ( -±h»ad_mu‹x©Œ_t - * -__©Œ -) - -787 -__THROW - - `__nÚnuÎ - ((1)); - -790  - $±h»ad_mu‹x©Œ_g‘psh¬ed - ( -__cÚ¡ - -±h»ad_mu‹x©Œ_t - * - -791 -__»¡riù - -__©Œ -, - -792 * -__»¡riù - -__psh¬ed -) - -793 -__THROW - - `__nÚnuÎ - ((1, 2)); - -796  - $±h»ad_mu‹x©Œ_£sh¬ed - ( -±h»ad_mu‹x©Œ_t - * -__©Œ -, - -797  -__psh¬ed -) - -798 -__THROW - - `__nÚnuÎ - ((1)); - -800 #ifdeà -__USE_UNIX98 - - -802  - $±h»ad_mu‹x©Œ_g‘ty³ - ( -__cÚ¡ - -±h»ad_mu‹x©Œ_t - * -__»¡riù - - -803 -__©Œ -, * -__»¡riù - -__kšd -) - -804 -__THROW - - `__nÚnuÎ - ((1, 2)); - -809  - $±h»ad_mu‹x©Œ_£‰y³ - ( -±h»ad_mu‹x©Œ_t - * -__©Œ -,  -__kšd -) - -810 -__THROW - - `__nÚnuÎ - ((1)); - -813  - $±h»ad_mu‹x©Œ_g‘´ÙocÞ - ( -__cÚ¡ - -±h»ad_mu‹x©Œ_t - * - -814 -__»¡riù - -__©Œ -, - -815 * -__»¡riù - -__´ÙocÞ -) - -816 -__THROW - - `__nÚnuÎ - ((1, 2)); - -820  - $±h»ad_mu‹x©Œ_£rÙocÞ - ( -±h»ad_mu‹x©Œ_t - * -__©Œ -, - -821  -__´ÙocÞ -) - -822 -__THROW - - `__nÚnuÎ - ((1)); - -825  - $±h»ad_mu‹x©Œ_g‘´ioûžšg - ( -__cÚ¡ - -±h»ad_mu‹x©Œ_t - * - -826 -__»¡riù - -__©Œ -, - -827 * -__»¡riù - -__´ioûžšg -) - -828 -__THROW - - `__nÚnuÎ - ((1, 2)); - -831  - $±h»ad_mu‹x©Œ_£rioûžšg - ( -±h»ad_mu‹x©Œ_t - * -__©Œ -, - -832  -__´ioûžšg -) - -833 -__THROW - - `__nÚnuÎ - ((1)); - -836 #ifdeà -__USE_XOPEN2K - - -838  - $±h»ad_mu‹x©Œ_g‘robu¡ - ( -__cÚ¡ - -±h»ad_mu‹x©Œ_t - * -__©Œ -, - -839 * -__robu¡Ãss -) - -840 -__THROW - - `__nÚnuÎ - ((1, 2)); - -841 #ifdeà -__USE_GNU - - -842  - $±h»ad_mu‹x©Œ_g‘robu¡_Å - ( -__cÚ¡ - -±h»ad_mu‹x©Œ_t - * -__©Œ -, - -843 * -__robu¡Ãss -) - -844 -__THROW - - `__nÚnuÎ - ((1, 2)); - -848  - $±h»ad_mu‹x©Œ_£Œobu¡ - ( -±h»ad_mu‹x©Œ_t - * -__©Œ -, - -849  -__robu¡Ãss -) - -850 -__THROW - - `__nÚnuÎ - ((1)); - -851 #ifdeà -__USE_GNU - - -852  - $±h»ad_mu‹x©Œ_£Œobu¡_Å - ( -±h»ad_mu‹x©Œ_t - * -__©Œ -, - -853  -__robu¡Ãss -) - -854 -__THROW - - `__nÚnuÎ - ((1)); - -859 #ià -defšed - -__USE_UNIX98 - || defšed -__USE_XOPEN2K - - -864  - $±h»ad_rwlock_š™ - ( -±h»ad_rwlock_t - * -__»¡riù - -__rwlock -, - -865 -__cÚ¡ - -±h»ad_rwlock©Œ_t - * -__»¡riù - - -866 -__©Œ -è -__THROW - - `__nÚnuÎ - ((1)); - -869  - $±h»ad_rwlock_de¡roy - ( -±h»ad_rwlock_t - * -__rwlock -) - -870 -__THROW - - `__nÚnuÎ - ((1)); - -873  - $±h»ad_rwlock_rdlock - ( -±h»ad_rwlock_t - * -__rwlock -) - -874 -__THROW - - `__nÚnuÎ - ((1)); - -877  - $±h»ad_rwlock_Œyrdlock - ( -±h»ad_rwlock_t - * -__rwlock -) - -878 -__THROW - - `__nÚnuÎ - ((1)); - -880 #ifdeà -__USE_XOPEN2K - - -882  - $±h»ad_rwlock_timedrdlock - ( -±h»ad_rwlock_t - * -__»¡riù - -__rwlock -, - -883 -__cÚ¡ -  -time¥ec - * -__»¡riù - - -884 -__ab¡ime -è -__THROW - - `__nÚnuÎ - ((1, 2)); - -888  - $±h»ad_rwlock_w¾ock - ( -±h»ad_rwlock_t - * -__rwlock -) - -889 -__THROW - - `__nÚnuÎ - ((1)); - -892  - $±h»ad_rwlock_Œyw¾ock - ( -±h»ad_rwlock_t - * -__rwlock -) - -893 -__THROW - - `__nÚnuÎ - ((1)); - -895 #ifdeà -__USE_XOPEN2K - - -897  - $±h»ad_rwlock_timedw¾ock - ( -±h»ad_rwlock_t - * -__»¡riù - -__rwlock -, - -898 -__cÚ¡ -  -time¥ec - * -__»¡riù - - -899 -__ab¡ime -è -__THROW - - `__nÚnuÎ - ((1, 2)); - -903  - $±h»ad_rwlock_uÆock - ( -±h»ad_rwlock_t - * -__rwlock -) - -904 -__THROW - - `__nÚnuÎ - ((1)); - -910  - $±h»ad_rwlock©Œ_š™ - ( -±h»ad_rwlock©Œ_t - * -__©Œ -) - -911 -__THROW - - `__nÚnuÎ - ((1)); - -914  - $±h»ad_rwlock©Œ_de¡roy - ( -±h»ad_rwlock©Œ_t - * -__©Œ -) - -915 -__THROW - - `__nÚnuÎ - ((1)); - -918  - $±h»ad_rwlock©Œ_g‘psh¬ed - ( -__cÚ¡ - -±h»ad_rwlock©Œ_t - * - -919 -__»¡riù - -__©Œ -, - -920 * -__»¡riù - -__psh¬ed -) - -921 -__THROW - - `__nÚnuÎ - ((1, 2)); - -924  - $±h»ad_rwlock©Œ_£sh¬ed - ( -±h»ad_rwlock©Œ_t - * -__©Œ -, - -925  -__psh¬ed -) - -926 -__THROW - - `__nÚnuÎ - ((1)); - -929  - $±h»ad_rwlock©Œ_g‘kšd_Å - ( -__cÚ¡ - -±h»ad_rwlock©Œ_t - * - -930 -__»¡riù - -__©Œ -, - -931 * -__»¡riù - -__´ef -) - -932 -__THROW - - `__nÚnuÎ - ((1, 2)); - -935  - $±h»ad_rwlock©Œ_£tkšd_Å - ( -±h»ad_rwlock©Œ_t - * -__©Œ -, - -936  -__´ef -è -__THROW - - `__nÚnuÎ - ((1)); - -944  - $±h»ad_cÚd_š™ - ( -±h»ad_cÚd_t - * -__»¡riù - -__cÚd -, - -945 -__cÚ¡ - -±h»ad_cÚd©Œ_t - * -__»¡riù - - -946 -__cÚd_©Œ -è -__THROW - - `__nÚnuÎ - ((1)); - -949  - $±h»ad_cÚd_de¡roy - ( -±h»ad_cÚd_t - * -__cÚd -) - -950 -__THROW - - `__nÚnuÎ - ((1)); - -953  - $±h»ad_cÚd_sigÇl - ( -±h»ad_cÚd_t - * -__cÚd -) - -954 -__THROW - - `__nÚnuÎ - ((1)); - -957  - $±h»ad_cÚd_brßdÿ¡ - ( -±h»ad_cÚd_t - * -__cÚd -) - -958 -__THROW - - `__nÚnuÎ - ((1)); - -965  - $±h»ad_cÚd_wa™ - ( -±h»ad_cÚd_t - * -__»¡riù - -__cÚd -, - -966 -±h»ad_mu‹x_t - * -__»¡riù - -__mu‹x -) - -967 - `__nÚnuÎ - ((1, 2)); - -976  - $±h»ad_cÚd_timedwa™ - ( -±h»ad_cÚd_t - * -__»¡riù - -__cÚd -, - -977 -±h»ad_mu‹x_t - * -__»¡riù - -__mu‹x -, - -978 -__cÚ¡ -  -time¥ec - * -__»¡riù - - -979 -__ab¡ime -è - `__nÚnuÎ - ((1, 2, 3)); - -984  - $±h»ad_cÚd©Œ_š™ - ( -±h»ad_cÚd©Œ_t - * -__©Œ -) - -985 -__THROW - - `__nÚnuÎ - ((1)); - -988  - $±h»ad_cÚd©Œ_de¡roy - ( -±h»ad_cÚd©Œ_t - * -__©Œ -) - -989 -__THROW - - `__nÚnuÎ - ((1)); - -992  - $±h»ad_cÚd©Œ_g‘psh¬ed - ( -__cÚ¡ - -±h»ad_cÚd©Œ_t - * - -993 -__»¡riù - -__©Œ -, - -994 * -__»¡riù - -__psh¬ed -) - -995 -__THROW - - `__nÚnuÎ - ((1, 2)); - -998  - $±h»ad_cÚd©Œ_£sh¬ed - ( -±h»ad_cÚd©Œ_t - * -__©Œ -, - -999  -__psh¬ed -è -__THROW - - `__nÚnuÎ - ((1)); - -1001 #ifdeà -__USE_XOPEN2K - - -1003  - $±h»ad_cÚd©Œ_g‘þock - ( -__cÚ¡ - -±h»ad_cÚd©Œ_t - * - -1004 -__»¡riù - -__©Œ -, - -1005 -__þockid_t - * -__»¡riù - -__þock_id -) - -1006 -__THROW - - `__nÚnuÎ - ((1, 2)); - -1009  - $±h»ad_cÚd©Œ_£tþock - ( -±h»ad_cÚd©Œ_t - * -__©Œ -, - -1010 -__þockid_t - -__þock_id -) - -1011 -__THROW - - `__nÚnuÎ - ((1)); - -1015 #ifdeà -__USE_XOPEN2K - - -1020  - $±h»ad_¥š_š™ - ( -±h»ad_¥šlock_t - * -__lock -,  -__psh¬ed -) - -1021 -__THROW - - `__nÚnuÎ - ((1)); - -1024  - $±h»ad_¥š_de¡roy - ( -±h»ad_¥šlock_t - * -__lock -) - -1025 -__THROW - - `__nÚnuÎ - ((1)); - -1028  - $±h»ad_¥š_lock - ( -±h»ad_¥šlock_t - * -__lock -) - -1029 -__THROW - - `__nÚnuÎ - ((1)); - -1032  - $±h»ad_¥š_Œylock - ( -±h»ad_¥šlock_t - * -__lock -) - -1033 -__THROW - - `__nÚnuÎ - ((1)); - -1036  - $±h»ad_¥š_uÆock - ( -±h»ad_¥šlock_t - * -__lock -) - -1037 -__THROW - - `__nÚnuÎ - ((1)); - -1044  - $±h»ad_b¬r›r_š™ - ( -±h»ad_b¬r›r_t - * -__»¡riù - -__b¬r›r -, - -1045 -__cÚ¡ - -±h»ad_b¬r›¿‰r_t - * -__»¡riù - - -1046 -__©Œ -,  -__couÁ -) - -1047 -__THROW - - `__nÚnuÎ - ((1)); - -1050  - $±h»ad_b¬r›r_de¡roy - ( -±h»ad_b¬r›r_t - * -__b¬r›r -) - -1051 -__THROW - - `__nÚnuÎ - ((1)); - -1054  - $±h»ad_b¬r›r_wa™ - ( -±h»ad_b¬r›r_t - * -__b¬r›r -) - -1055 -__THROW - - `__nÚnuÎ - ((1)); - -1059  - $±h»ad_b¬r›¿‰r_š™ - ( -±h»ad_b¬r›¿‰r_t - * -__©Œ -) - -1060 -__THROW - - `__nÚnuÎ - ((1)); - -1063  - $±h»ad_b¬r›¿‰r_de¡roy - ( -±h»ad_b¬r›¿‰r_t - * -__©Œ -) - -1064 -__THROW - - `__nÚnuÎ - ((1)); - -1067  - $±h»ad_b¬r›¿‰r_g‘psh¬ed - ( -__cÚ¡ - -±h»ad_b¬r›¿‰r_t - * - -1068 -__»¡riù - -__©Œ -, - -1069 * -__»¡riù - -__psh¬ed -) - -1070 -__THROW - - `__nÚnuÎ - ((1, 2)); - -1073  - $±h»ad_b¬r›¿‰r_£sh¬ed - ( -±h»ad_b¬r›¿‰r_t - * -__©Œ -, - -1074  -__psh¬ed -) - -1075 -__THROW - - `__nÚnuÎ - ((1)); - -1087  - `±h»ad_key_ü—‹ - ( -±h»ad_key_t - * -__key -, - -1088 (* -__de¡r_funùiÚ -) (*)) - -1089 -__THROW - - `__nÚnuÎ - ((1)); - -1092  - $±h»ad_key_d–‘e - ( -±h»ad_key_t - -__key -è -__THROW -; - -1095 * - $±h»ad_g‘¥ecific - ( -±h»ad_key_t - -__key -è -__THROW -; - -1098  - $±h»ad_£t¥ecific - ( -±h»ad_key_t - -__key -, - -1099 -__cÚ¡ - * -__poš‹r -è -__THROW - ; - -1102 #ifdeà -__USE_XOPEN2K - - -1104  - $±h»ad_g‘ýuþockid - ( -±h»ad_t - -__th»ad_id -, - -1105 -__þockid_t - * -__þock_id -) - -1106 -__THROW - - `__nÚnuÎ - ((2)); - -1121  - `±h»ad_©fÜk - ((* -__´•¬e -) (), - -1122 (* -__·»Á -) (), - -1123 (* -__chžd -è()è -__THROW -; - -1126 #ifdeà -__USE_EXTERN_INLINES - - -1128 -__ex‹º_šlše -  - -1129 - `__NTH - ( - $±h»ad_equ® - ( -±h»ad_t - -__th»ad1 -,…th»ad_ˆ -__th»ad2 -)) - -1131  -__th»ad1 - =ð -__th»ad2 -; - -1132 - } -} - -1135 - g__END_DECLS - - - @/usr/include/wctype.h - -24 #iâdeà -_WCTYPE_H - - -26  - ~<ã©u»s.h -> - -27  - ~ - -29 #iâdeà -__Ãed_iswxxx - - -30  - #_WCTYPE_H - 1 - - ) - -33  - #__Ãed_wšt_t - - - ) - -34  - ~<¡ddef.h -> - -38 #iâdeà -WEOF - - -39  - #WEOF - (0xffffffffu) - - ) - -42 #undeà -__Ãed_iswxxx - - -47 #iâdeà -__iswxxx_defšed - - -48  - #__iswxxx_defšed - 1 - - ) - -50 -__BEGIN_NAMESPACE_C99 - - -53  - twùy³_t -; - -54 - g__END_NAMESPACE_C99 - - -56 #iâdeà -_ISwb™ - - -61  - ~<’dŸn.h -> - -62 #ià -__BYTE_ORDER - =ð -__BIG_ENDIAN - - -63  - #_ISwb™ -( -b™ -è(1 << (b™)) - - ) - -65  - #_ISwb™ -( -b™ -) \ - -66 (( -b™ -) < 8 ? () ((1UL << (bit)) << 24) \ - -67 : (( -b™ -) < 16 ? () ((1UL << (bit)) << 8) \ - -68 : (( -b™ -) < 24 ? () ((1UL << (bit)) >> 8) \ - -69 : (è((1UL << ( -b™ -)è>> 24)))) - - ) - -74 - m__ISwuµ” - = 0, - -75 - m__ISwlow” - = 1, - -76 - m__ISw®pha - = 2, - -77 - m__ISwdig™ - = 3, - -78 - m__ISwxdig™ - = 4, - -79 - m__ISw¥aû - = 5, - -80 - m__ISw´št - = 6, - -81 - m__ISwg¿ph - = 7, - -82 - m__ISwbÏnk - = 8, - -83 - m__ISwúŒl - = 9, - -84 - m__ISwpunù - = 10, - -85 - m__ISw®num - = 11, - -87 - m_ISwuµ” - = -_ISwb™ - ( -__ISwuµ” -), - -88 - m_ISwlow” - = -_ISwb™ - ( -__ISwlow” -), - -89 - m_ISw®pha - = -_ISwb™ - ( -__ISw®pha -), - -90 - m_ISwdig™ - = -_ISwb™ - ( -__ISwdig™ -), - -91 - m_ISwxdig™ - = -_ISwb™ - ( -__ISwxdig™ -), - -92 - m_ISw¥aû - = -_ISwb™ - ( -__ISw¥aû -), - -93 - m_ISw´št - = -_ISwb™ - ( -__ISw´št -), - -94 - m_ISwg¿ph - = -_ISwb™ - ( -__ISwg¿ph -), - -95 - m_ISwbÏnk - = -_ISwb™ - ( -__ISwbÏnk -), - -96 - m_ISwúŒl - = -_ISwb™ - ( -__ISwúŒl -), - -97 - m_ISwpunù - = -_ISwb™ - ( -__ISwpunù -), - -98 - m_ISw®num - = -_ISwb™ - ( -__ISw®num -) - -103 -__BEGIN_DECLS - - -105 -__BEGIN_NAMESPACE_C99 - - -112  - $isw®num - ( -wšt_t - -__wc -è -__THROW -; - -118  - $isw®pha - ( -wšt_t - -__wc -è -__THROW -; - -121  - $iswúŒl - ( -wšt_t - -__wc -è -__THROW -; - -125  - $iswdig™ - ( -wšt_t - -__wc -è -__THROW -; - -129  - $iswg¿ph - ( -wšt_t - -__wc -è -__THROW -; - -134  - $iswlow” - ( -wšt_t - -__wc -è -__THROW -; - -137  - $isw´št - ( -wšt_t - -__wc -è -__THROW -; - -142  - $iswpunù - ( -wšt_t - -__wc -è -__THROW -; - -147  - $isw¥aû - ( -wšt_t - -__wc -è -__THROW -; - -152  - $iswuµ” - ( -wšt_t - -__wc -è -__THROW -; - -157  - $iswxdig™ - ( -wšt_t - -__wc -è -__THROW -; - -162 #ifdeà -__USE_ISOC99 - - -163  - $iswbÏnk - ( -wšt_t - -__wc -è -__THROW -; - -172 -wùy³_t - - $wùy³ - ( -__cÚ¡ - * -__´Ý”ty -è -__THROW -; - -176  - $iswùy³ - ( -wšt_t - -__wc -, -wùy³_t - -__desc -è -__THROW -; - -177 -__END_NAMESPACE_C99 - - -184 -__BEGIN_NAMESPACE_C99 - - -187  -__cÚ¡ - - t__št32_t - * - twù¿ns_t -; - -188 -__END_NAMESPACE_C99 - - -189 #ifdeà -__USE_GNU - - -190 - $__USING_NAMESPACE_C99 -( -wù¿ns_t -) - -193 -__BEGIN_NAMESPACE_C99 - - -195 -wšt_t - - $towlow” - ( -wšt_t - -__wc -è -__THROW -; - -198 -wšt_t - - $towuµ” - ( -wšt_t - -__wc -è -__THROW -; - -199 -__END_NAMESPACE_C99 - - -201 -__END_DECLS - - -208 #ifdeà -_WCTYPE_H - - -214 -__BEGIN_DECLS - - -216 -__BEGIN_NAMESPACE_C99 - - -219 -wù¿ns_t - - $wù¿ns - ( -__cÚ¡ - * -__´Ý”ty -è -__THROW -; - -222 -wšt_t - - $towù¿ns - ( -wšt_t - -__wc -, -wù¿ns_t - -__desc -è -__THROW -; - -223 -__END_NAMESPACE_C99 - - -225 #ifdeà -__USE_XOPEN2K8 - - -227  - ~ - -231  - $isw®num_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -237  - $isw®pha_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -240  - $iswúŒl_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -244  - $iswdig™_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -248  - $iswg¿ph_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -253  - $iswlow”_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -256  - $isw´št_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -261  - $iswpunù_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -266  - $isw¥aû_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -271  - $iswuµ”_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -276  - $iswxdig™_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -281  - $iswbÏnk_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -285 -wùy³_t - - $wùy³_l - ( -__cÚ¡ - * -__´Ý”ty -, -__loÿË_t - -__loÿË -) - -286 -__THROW -; - -290  - $iswùy³_l - ( -wšt_t - -__wc -, -wùy³_t - -__desc -, -__loÿË_t - -__loÿË -) - -291 -__THROW -; - -299 -wšt_t - - $towlow”_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -302 -wšt_t - - $towuµ”_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -306 -wù¿ns_t - - $wù¿ns_l - ( -__cÚ¡ - * -__´Ý”ty -, -__loÿË_t - -__loÿË -) - -307 -__THROW -; - -310 -wšt_t - - $towù¿ns_l - ( -wšt_t - -__wc -, -wù¿ns_t - -__desc -, - -311 -__loÿË_t - -__loÿË -è -__THROW -; - -315 -__END_DECLS - - - @/usr/include/bits/errno.h - -20 #ifdeà -_ERRNO_H - - -22 #undeà -EDOM - - -23 #undeà -EILSEQ - - -24 #undeà -ERANGE - - -25  - ~ - -28  - #ENOTSUP - -EOPNOTSUPP - - - ) - -31 #iâdeà -ECANCELED - - -32  - #ECANCELED - 125 - - ) - -36 #iâdeà -EOWNERDEAD - - -37  - #EOWNERDEAD - 130 - - ) - -38  - #ENOTRECOVERABLE - 131 - - ) - -41 #iâdeà -__ASSEMBLER__ - - -43 * - $__”ºo_loÿtiÚ - (è -__THROW - - `__©Œibu‹__ - (( -__cÚ¡__ -)); - -45 #ià! -defšed - -_LIBC - || defšed -_LIBC_REENTRANT - - -47  - #”ºo - (* - `__”ºo_loÿtiÚ - ()) - - ) - -52 #ià! -defšed - -_ERRNO_H - && defšed -__Ãed_Em©h - - -56  - #EDOM - 33 - - ) - -57  - #EILSEQ - 84 - - ) - -58  - #ERANGE - 34 - - ) - - @/usr/include/bits/pthreadtypes.h - -20 #iâdeà -_BITS_PTHREADTYPES_H - - -21  - #_BITS_PTHREADTYPES_H - 1 - - ) - -23  - ~ - -25 #ià -__WORDSIZE - == 64 - -26  - #__SIZEOF_PTHREAD_ATTR_T - 56 - - ) - -27  - #__SIZEOF_PTHREAD_MUTEX_T - 40 - - ) - -28  - #__SIZEOF_PTHREAD_MUTEXATTR_T - 4 - - ) - -29  - #__SIZEOF_PTHREAD_COND_T - 48 - - ) - -30  - #__SIZEOF_PTHREAD_CONDATTR_T - 4 - - ) - -31  - #__SIZEOF_PTHREAD_RWLOCK_T - 56 - - ) - -32  - #__SIZEOF_PTHREAD_RWLOCKATTR_T - 8 - - ) - -33  - #__SIZEOF_PTHREAD_BARRIER_T - 32 - - ) - -34  - #__SIZEOF_PTHREAD_BARRIERATTR_T - 4 - - ) - -36  - #__SIZEOF_PTHREAD_ATTR_T - 36 - - ) - -37  - #__SIZEOF_PTHREAD_MUTEX_T - 24 - - ) - -38  - #__SIZEOF_PTHREAD_MUTEXATTR_T - 4 - - ) - -39  - #__SIZEOF_PTHREAD_COND_T - 48 - - ) - -40  - #__SIZEOF_PTHREAD_CONDATTR_T - 4 - - ) - -41  - #__SIZEOF_PTHREAD_RWLOCK_T - 32 - - ) - -42  - #__SIZEOF_PTHREAD_RWLOCKATTR_T - 8 - - ) - -43  - #__SIZEOF_PTHREAD_BARRIER_T - 20 - - ) - -44  - #__SIZEOF_PTHREAD_BARRIERATTR_T - 4 - - ) - -50  - t±h»ad_t -; - -55  - m__size -[ -__SIZEOF_PTHREAD_ATTR_T -]; - -56  - m__®ign -; - -57 } - t±h»ad_©Œ_t -; - -60 #ià -__WORDSIZE - == 64 - -61  - s__±h»ad_š‹º®_li¡ - - -63  -__±h»ad_š‹º®_li¡ - * - m__´ev -; - -64  -__±h»ad_š‹º®_li¡ - * - m__Ãxt -; - -65 } - t__±h»ad_li¡_t -; - -67  - s__±h»ad_š‹º®_¦i¡ - - -69  -__±h»ad_š‹º®_¦i¡ - * - m__Ãxt -; - -70 } - t__±h»ad_¦i¡_t -; - -78  - s__±h»ad_mu‹x_s - - -80  - m__lock -; - -81  - m__couÁ -; - -82  - m__owÃr -; - -83 #ià -__WORDSIZE - == 64 - -84  - m__nu£rs -; - -88  - m__kšd -; - -89 #ià -__WORDSIZE - == 64 - -90  - m__¥šs -; - -91 -__±h»ad_li¡_t - - m__li¡ -; - -92  - #__PTHREAD_MUTEX_HAVE_PREV - 1 - - ) - -94  - m__nu£rs -; - -95 -__ex‹nsiÚ__ - union - -97  - m__¥šs -; - -98 -__±h»ad_¦i¡_t - - m__li¡ -; - -101 } - m__d©a -; - -102  - m__size -[ -__SIZEOF_PTHREAD_MUTEX_T -]; - -103  - m__®ign -; - -104 } - t±h»ad_mu‹x_t -; - -108  - m__size -[ -__SIZEOF_PTHREAD_MUTEXATTR_T -]; - -109  - m__®ign -; - -110 } - t±h»ad_mu‹x©Œ_t -; - -119  - m__lock -; - -120  - m__fu‹x -; - -121 -__ex‹nsiÚ__ -  - m__tÙ®_£q -; - -122 -__ex‹nsiÚ__ -  - m__wakeup_£q -; - -123 -__ex‹nsiÚ__ -  - m__wok’_£q -; - -124 * - m__mu‹x -; - -125  - m__nwa™”s -; - -126  - m__brßdÿ¡_£q -; - -127 } - m__d©a -; - -128  - m__size -[ -__SIZEOF_PTHREAD_COND_T -]; - -129 -__ex‹nsiÚ__ -  - m__®ign -; - -130 } - t±h»ad_cÚd_t -; - -134  - m__size -[ -__SIZEOF_PTHREAD_CONDATTR_T -]; - -135  - m__®ign -; - -136 } - t±h»ad_cÚd©Œ_t -; - -140  - t±h»ad_key_t -; - -144  - t±h»ad_Úû_t -; - -147 #ià -defšed - -__USE_UNIX98 - || defšed -__USE_XOPEN2K - - -152 #ià -__WORDSIZE - == 64 - -155  - m__lock -; - -156  - m__Ä_»ad”s -; - -157  - m__»ad”s_wakeup -; - -158  - m__wr™”_wakeup -; - -159  - m__Ä_»ad”s_queued -; - -160  - m__Ä_wr™”s_queued -; - -161  - m__wr™” -; - -162  - m__sh¬ed -; - -163  - m__·d1 -; - -164  - m__·d2 -; - -167  - m__æags -; - -168 } - m__d©a -; - -172  - m__lock -; - -173  - m__Ä_»ad”s -; - -174  - m__»ad”s_wakeup -; - -175  - m__wr™”_wakeup -; - -176  - m__Ä_»ad”s_queued -; - -177  - m__Ä_wr™”s_queued -; - -180  - m__æags -; - -181  - m__sh¬ed -; - -182  - m__·d1 -; - -183  - m__·d2 -; - -184  - m__wr™” -; - -185 } - m__d©a -; - -187  - m__size -[ -__SIZEOF_PTHREAD_RWLOCK_T -]; - -188  - m__®ign -; - -189 } - t±h»ad_rwlock_t -; - -193  - m__size -[ -__SIZEOF_PTHREAD_RWLOCKATTR_T -]; - -194  - m__®ign -; - -195 } - t±h»ad_rwlock©Œ_t -; - -199 #ifdeà -__USE_XOPEN2K - - -201 vÞ©ž - t±h»ad_¥šlock_t -; - -208  - m__size -[ -__SIZEOF_PTHREAD_BARRIER_T -]; - -209  - m__®ign -; - -210 } - t±h»ad_b¬r›r_t -; - -214  - m__size -[ -__SIZEOF_PTHREAD_BARRIERATTR_T -]; - -215  - m__®ign -; - -216 } - t±h»ad_b¬r›¿‰r_t -; - -220 #ià -__WORDSIZE - == 32 - -222  - #__þ—nup_fù_©Œibu‹ - - `__©Œibu‹__ - (( - `__»g·rm__ - (1))) - - ) - - @/usr/include/bits/setjmp.h - -20 #iâdeà -_BITS_SETJMP_H - - -21  - #_BITS_SETJMP_H - 1 - - ) - -23 #ià! -defšed - -_SETJMP_H - && !defšed -_PTHREAD_H - - -27  - ~ - -29 #iâdeà -_ASM - - -31 #ià -__WORDSIZE - == 64 - -32  - t__jmp_buf -[8]; - -34  - t__jmp_buf -[6]; - - @/usr/include/sched.h - -20 #iâdef -_SCHED_H - - -21  - #_SCHED_H - 1 - - ) - -23  - ~<ã©u»s.h -> - -26  - ~ - -28  - #__Ãed_size_t - - - ) - -29  - ~<¡ddef.h -> - -31  - #__Ãed_time¥ec - - - ) - -32  - ~ - -35  - ~ - -37  - #sched_´iÜ™y - -__sched_´iÜ™y - - - ) - -40 -__BEGIN_DECLS - - -43  - $sched_£¬am - ( -__pid_t - -__pid -, -__cÚ¡ -  -sched_·¿m - * -__·¿m -) - -44 -__THROW -; - -47  - $sched_g‘·¿m - ( -__pid_t - -__pid -,  -sched_·¿m - * -__·¿m -è -__THROW -; - -50  - $sched_£tscheduËr - ( -__pid_t - -__pid -,  -__pÞicy -, - -51 -__cÚ¡ -  -sched_·¿m - * -__·¿m -è -__THROW -; - -54  - $sched_g‘scheduËr - ( -__pid_t - -__pid -è -__THROW -; - -57  - $sched_y›ld - (è -__THROW -; - -60  - $sched_g‘_´iÜ™y_max - ( -__®gÜ™hm -è -__THROW -; - -63  - $sched_g‘_´iÜ™y_mš - ( -__®gÜ™hm -è -__THROW -; - -66  - $sched_¼_g‘_š‹rv® - ( -__pid_t - -__pid -,  -time¥ec - * -__t -è -__THROW -; - -69 #ifdeà -__USE_GNU - - -71  - #CPU_SETSIZE - -__CPU_SETSIZE - - - ) - -72  - #CPU_SET -( -ýu -, -ýu£ -è - `__CPU_SET_S - (ýu,  ( -ýu_£t_t -), cpu£) - - ) - -73  - #CPU_CLR -( -ýu -, -ýu£ -è - `__CPU_CLR_S - (ýu,  ( -ýu_£t_t -), cpu£) - - ) - -74  - #CPU_ISSET -( -ýu -, -ýu£ -è - `__CPU_ISSET_S - (ýu,  ( -ýu_£t_t -), \ - -75 -ýu£ -) - - ) - -76  - #CPU_ZERO -( -ýu£ -è - `__CPU_ZERO_S - ( ( -ýu_£t_t -), cpu£) - - ) - -77  - #CPU_COUNT -( -ýu£ -è - `__CPU_COUNT_S - ( ( -ýu_£t_t -), cpu£) - - ) - -79  - #CPU_SET_S -( -ýu -, -£tsize -, -ýu£ -è - `__CPU_SET_S - (ýu, s‘size, cpu£) - - ) - -80  - #CPU_CLR_S -( -ýu -, -£tsize -, -ýu£ -è - `__CPU_CLR_S - (ýu, s‘size, cpu£) - - ) - -81  - #CPU_ISSET_S -( -ýu -, -£tsize -, -ýu£ -è - `__CPU_ISSET_S - (cpu, setsize, \ - -82 -ýu£ -) - - ) - -83  - #CPU_ZERO_S -( -£tsize -, -ýu£ -è - `__CPU_ZERO_S - (£tsize, cpu£) - - ) - -84  - #CPU_COUNT_S -( -£tsize -, -ýu£ -è - `__CPU_COUNT_S - (£tsize, cpu£) - - ) - -86  - #CPU_EQUAL -( -ýu£1 -, -ýu£2 -) \ - -87 - `__CPU_EQUAL_S - ( ( -ýu_£t_t -), -ýu£1 -, -ýu£2 -) - - ) - -88  - #CPU_EQUAL_S -( -£tsize -, -ýu£1 -, -ýu£2 -) \ - -89 - `__CPU_EQUAL_S - ( -£tsize -, -ýu£1 -, -ýu£2 -) - - ) - -91  - #CPU_AND -( -de¡£t -, -¤c£t1 -, -¤c£t2 -) \ - -92 - `__CPU_OP_S - ( ( -ýu_£t_t -), -de¡£t -, -¤c£t1 -, -¤c£t2 -, &) - - ) - -93  - #CPU_OR -( -de¡£t -, -¤c£t1 -, -¤c£t2 -) \ - -94 - `__CPU_OP_S - ( ( -ýu_£t_t -), -de¡£t -, -¤c£t1 -, -¤c£t2 -, |) - - ) - -95  - #CPU_XOR -( -de¡£t -, -¤c£t1 -, -¤c£t2 -) \ - -96 - `__CPU_OP_S - ( ( -ýu_£t_t -), -de¡£t -, -¤c£t1 -, -¤c£t2 -, ^) - - ) - -97  - #CPU_AND_S -( -£tsize -, -de¡£t -, -¤c£t1 -, -¤c£t2 -) \ - -98 - `__CPU_OP_S - ( -£tsize -, -de¡£t -, -¤c£t1 -, -¤c£t2 -, &) - - ) - -99  - #CPU_OR_S -( -£tsize -, -de¡£t -, -¤c£t1 -, -¤c£t2 -) \ - -100 - `__CPU_OP_S - ( -£tsize -, -de¡£t -, -¤c£t1 -, -¤c£t2 -, |) - - ) - -101  - #CPU_XOR_S -( -£tsize -, -de¡£t -, -¤c£t1 -, -¤c£t2 -) \ - -102 - `__CPU_OP_S - ( -£tsize -, -de¡£t -, -¤c£t1 -, -¤c£t2 -, ^) - - ) - -104  - #CPU_ALLOC_SIZE -( -couÁ -è - `__CPU_ALLOC_SIZE - (couÁ) - - ) - -105  - #CPU_ALLOC -( -couÁ -è - `__CPU_ALLOC - (couÁ) - - ) - -106  - #CPU_FREE -( -ýu£t -è - `__CPU_FREE - (ýu£t) - - ) - -110  - $sched_£ffš™y - ( -__pid_t - -__pid -, -size_t - -__ýu£tsize -, - -111 -__cÚ¡ - -ýu_£t_t - * -__ýu£t -è -__THROW -; - -114  - $sched_g‘affš™y - ( -__pid_t - -__pid -, -size_t - -__ýu£tsize -, - -115 -ýu_£t_t - * -__ýu£t -è -__THROW -; - -118 -__END_DECLS - - - @/usr/include/signal.h - -23 #iâdef -_SIGNAL_H - - -25 #ià! -defšed - -__Ãed_sig_©omic_t - && !defšed -__Ãed_sig£t_t - - -26  - #_SIGNAL_H - - - ) - -29  - ~<ã©u»s.h -> - -31 - g__BEGIN_DECLS - - -33  - ~ - -37 #ià -defšed - -__Ãed_sig_©omic_t - || defšed -_SIGNAL_H - - -38 #iâdeà -__sig_©omic_t_defšed - - -39  - #__sig_©omic_t_defšed - - - ) - -40 -__BEGIN_NAMESPACE_STD - - -41  -__sig_©omic_t - - tsig_©omic_t -; - -42 - g__END_NAMESPACE_STD - - -44 #undeà -__Ãed_sig_©omic_t - - -47 #ià -defšed - -__Ãed_sig£t_t - || (defšed -_SIGNAL_H - && defšed -__USE_POSIX -) - -48 #iâdeà -__sig£t_t_defšed - - -49  - #__sig£t_t_defšed - - - ) - -50  -__sig£t_t - - tsig£t_t -; - -52 #undeà -__Ãed_sig£t_t - - -55 #ifdeà -_SIGNAL_H - - -57  - ~ - -58  - ~ - -60 #ià -defšed - -__USE_XOPEN - || defšed -__USE_XOPEN2K - - -61 #iâdeà -__pid_t_defšed - - -62  -__pid_t - - tpid_t -; - -63  - #__pid_t_defšed - - - ) - -65 #ifdeà -__USE_XOPEN - - -67 #iâdeà -__uid_t_defšed - - -68  -__uid_t - - tuid_t -; - -69  - #__uid_t_defšed - - - ) - -73 #ifdeà -__USE_POSIX199309 - - -75  - #__Ãed_time¥ec - - - ) - -76  - ~ - -79  - ~ - -84 (* - t__sighªdËr_t -) (); - -89 -__sighªdËr_t - - $__sysv_sigÇl - ( -__sig -, -__sighªdËr_t - -__hªdËr -) - -90 -__THROW -; - -91 #ifdeà -__USE_GNU - - -92 -__sighªdËr_t - - $sysv_sigÇl - ( -__sig -, -__sighªdËr_t - -__hªdËr -) - -93 -__THROW -; - -99 -__BEGIN_NAMESPACE_STD - - -100 #ifdeà -__USE_BSD - - -101 -__sighªdËr_t - - $sigÇl - ( -__sig -, -__sighªdËr_t - -__hªdËr -) - -102 -__THROW -; - -105 #ifdeà -__REDIRECT_NTH - - -106 -__sighªdËr_t - - `__REDIRECT_NTH - ( -sigÇl -, - -107 ( -__sig -, -__sighªdËr_t - -__hªdËr -), - -108 -__sysv_sigÇl -); - -110  - #sigÇl - -__sysv_sigÇl - - - ) - -113 -__END_NAMESPACE_STD - - -115 #ifdeà -__USE_XOPEN - - -118 -__sighªdËr_t - - $bsd_sigÇl - ( -__sig -, -__sighªdËr_t - -__hªdËr -) - -119 -__THROW -; - -125 #ifdeà -__USE_POSIX - - -126  - $kžl - ( -__pid_t - -__pid -,  -__sig -è -__THROW -; - -129 #ià -defšed - -__USE_BSD - || defšed -__USE_XOPEN_EXTENDED - - -133  - $kžÍg - ( -__pid_t - -__pg½ -,  -__sig -è -__THROW -; - -136 -__BEGIN_NAMESPACE_STD - - -138  - $¿i£ - ( -__sig -è -__THROW -; - -139 -__END_NAMESPACE_STD - - -141 #ifdeà -__USE_SVID - - -143 -__sighªdËr_t - - $ssigÇl - ( -__sig -, -__sighªdËr_t - -__hªdËr -) - -144 -__THROW -; - -145  - $gsigÇl - ( -__sig -è -__THROW -; - -148 #ià -defšed - -__USE_MISC - || defšed -__USE_XOPEN2K - - -150  - `psigÇl - ( -__sig -, -__cÚ¡ - * -__s -); - -153 #ifdeà -__USE_XOPEN2K - - -155  - `psigšfo - ( -__cÚ¡ - -sigšfo_t - * -__pšfo -, __cÚ¡ * -__s -); - -168  - `__sig·u£ - ( -__sig_Ü_mask -,  -__is_sig -); - -170 #ifdeà -__FAVOR_BSD - - -173  - $sig·u£ - ( -__mask -è -__THROW - -__©Œibu‹_d•»ÿ‹d__ -; - -175 #ifdeà -__USE_XOPEN - - -176 #ifdeà -__GNUC__ - - -177  - $sig·u£ - ( -__sig -è - `__asm__ - ("__xpg_sigpause"); - -180  - #sig·u£ -( -sig -è - `__sig·u£ - ((sig), 1) - - ) - -186 #ifdeà -__USE_BSD - - -193  - #sigmask -( -sig -è - `__sigmask -(sig) - - ) - -196  - $sigblock - ( -__mask -è -__THROW - -__©Œibu‹_d•»ÿ‹d__ -; - -199  - $sig£tmask - ( -__mask -è -__THROW - -__©Œibu‹_d•»ÿ‹d__ -; - -202  - $sigg‘mask - (è -__THROW - -__©Œibu‹_d•»ÿ‹d__ -; - -206 #ifdeà -__USE_MISC - - -207  - #NSIG - -_NSIG - - - ) - -210 #ifdeà -__USE_GNU - - -211  -__sighªdËr_t - - tsighªdËr_t -; - -215 #ifdeà -__USE_BSD - - -216  -__sighªdËr_t - - tsig_t -; - -219 #ifdeà -__USE_POSIX - - -222  - $sigem±y£t - ( -sig£t_t - * -__£t -è -__THROW - - `__nÚnuÎ - ((1)); - -225  - $sigfžl£t - ( -sig£t_t - * -__£t -è -__THROW - - `__nÚnuÎ - ((1)); - -228  - $sigadd£t - ( -sig£t_t - * -__£t -,  -__signo -è -__THROW - - `__nÚnuÎ - ((1)); - -231  - $sigd–£t - ( -sig£t_t - * -__£t -,  -__signo -è -__THROW - - `__nÚnuÎ - ((1)); - -234  - $sigismemb” - ( -__cÚ¡ - -sig£t_t - * -__£t -,  -__signo -) - -235 -__THROW - - `__nÚnuÎ - ((1)); - -237 #ifdeà -__USE_GNU - - -239  - $sigi£m±y£t - ( -__cÚ¡ - -sig£t_t - * -__£t -è -__THROW - - `__nÚnuÎ - ((1)); - -242  - $sigªd£t - ( -sig£t_t - * -__£t -, -__cÚ¡ - sig£t_ˆ* -__Ëá -, - -243 -__cÚ¡ - -sig£t_t - * -__right -è -__THROW - - `__nÚnuÎ - ((1, 2, 3)); - -246  - $sigÜ£t - ( -sig£t_t - * -__£t -, -__cÚ¡ - sig£t_ˆ* -__Ëá -, - -247 -__cÚ¡ - -sig£t_t - * -__right -è -__THROW - - `__nÚnuÎ - ((1, 2, 3)); - -252  - ~ - -255  - $sig´ocmask - ( -__how -, -__cÚ¡ - -sig£t_t - * -__»¡riù - -__£t -, - -256 -sig£t_t - * -__»¡riù - -__o£t -è -__THROW -; - -263  - $sigsu¥’d - ( -__cÚ¡ - -sig£t_t - * -__£t -è - `__nÚnuÎ - ((1)); - -266  - $sigaùiÚ - ( -__sig -, -__cÚ¡ -  -sigaùiÚ - * -__»¡riù - -__aù -, - -267  -sigaùiÚ - * -__»¡riù - -__ßù -è -__THROW -; - -270  - $sig³ndšg - ( -sig£t_t - * -__£t -è -__THROW - - `__nÚnuÎ - ((1)); - -277  - $sigwa™ - ( -__cÚ¡ - -sig£t_t - * -__»¡riù - -__£t -, *__»¡riù -__sig -) - -278 - `__nÚnuÎ - ((1, 2)); - -280 #ifdeà -__USE_POSIX199309 - - -285  - $sigwa™šfo - ( -__cÚ¡ - -sig£t_t - * -__»¡riù - -__£t -, - -286 -sigšfo_t - * -__»¡riù - -__šfo -è - `__nÚnuÎ - ((1)); - -293  - $sigtimedwa™ - ( -__cÚ¡ - -sig£t_t - * -__»¡riù - -__£t -, - -294 -sigšfo_t - * -__»¡riù - -__šfo -, - -295 -__cÚ¡ -  -time¥ec - * -__»¡riù - -__timeout -) - -296 - `__nÚnuÎ - ((1)); - -300  - $sigqueue - ( -__pid_t - -__pid -,  -__sig -, -__cÚ¡ -  -sigv® - -__v® -) - -301 -__THROW -; - -306 #ifdeà -__USE_BSD - - -310 -__cÚ¡ - *__cÚ¡ -_sys_sigli¡ -[ -_NSIG -]; - -311 -__cÚ¡ - *__cÚ¡ -sys_sigli¡ -[ -_NSIG -]; - -314  - ssigvec - - -316 -__sighªdËr_t - -sv_hªdËr -; - -317  -sv_mask -; - -319  -sv_æags -; - -320  - #sv_Ú¡ack - -sv_æags - - - ) - -324  - #SV_ONSTACK - (1 << 0) - - ) - -325  - #SV_INTERRUPT - (1 << 1) - - ) - -326  - #SV_RESETHAND - (1 << 2) - - ) - -334  - $sigvec - ( -__sig -, -__cÚ¡ -  -sigvec - * -__vec -, - -335  -sigvec - * -__ovec -è -__THROW -; - -339  - ~ - -342  - $sig»tuº - ( -sigcÚ‹xt - * -__sý -è -__THROW -; - -347 #ià -defšed - -__USE_BSD - || defšed -__USE_XOPEN_EXTENDED - - -348  - #__Ãed_size_t - - - ) - -349  - ~<¡ddef.h -> - -354  - $sigš‹¼u± - ( -__sig -,  -__š‹¼u± -è -__THROW -; - -356  - ~ - -357 #ifdeà -__USE_XOPEN - - -359  - ~ - -365  - $sig¡ack - ( -sig¡ack - * -__ss -, sig¡ack * -__oss -) - -366 -__THROW - -__©Œibu‹_d•»ÿ‹d__ -; - -370  - $sig®t¡ack - ( -__cÚ¡ -  -sig®t¡ack - * -__»¡riù - -__ss -, - -371  -sig®t¡ack - * -__»¡riù - -__oss -è -__THROW -; - -375 #ifdeà -__USE_XOPEN_EXTENDED - - -379  - $sighÞd - ( -__sig -è -__THROW -; - -382  - $sig»l£ - ( -__sig -è -__THROW -; - -385  - $sigignÜe - ( -__sig -è -__THROW -; - -388 -__sighªdËr_t - - $sig£t - ( -__sig -, -__sighªdËr_t - -__di¥ -è -__THROW -; - -391 #ià -defšed - -__USE_POSIX199506 - || defšed -__USE_UNIX98 - - -394  - ~ - -395  - ~ - -402  - $__libc_cu¼’t_sig¹mš - (è -__THROW -; - -404  - $__libc_cu¼’t_sig¹max - (è -__THROW -; - -408 -__END_DECLS - - - @/usr/include/time.h - -23 #iâdef -_TIME_H - - -25 #ià(! -defšed - -__Ãed_time_t - && !defšed -__Ãed_þock_t - && \ - -26 ! -defšed - - g__Ãed_time¥ec -) - -27  - #_TIME_H - 1 - - ) - -28  - ~<ã©u»s.h -> - -30 - g__BEGIN_DECLS - - -34 #ifdef -_TIME_H - - -36  - #__Ãed_size_t - - - ) - -37  - #__Ãed_NULL - - - ) - -38  - ~<¡ddef.h -> - -42  - ~ - -45 #ià! -defšed - -__STRICT_ANSI__ - && !defšed -__USE_XOPEN2K - - -46 #iâdeà -CLK_TCK - - -47  - #CLK_TCK - -CLOCKS_PER_SEC - - - ) - -53 #ià! -defšed - -__þock_t_defšed - && (defšed -_TIME_H - || defšed -__Ãed_þock_t -) - -54  - #__þock_t_defšed - 1 - - ) - -56  - ~ - -58 -__BEGIN_NAMESPACE_STD - - -60  -__þock_t - - tþock_t -; - -61 - g__END_NAMESPACE_STD - - -62 #ià -defšed - -__USE_XOPEN - || defšed -__USE_POSIX - || defšed -__USE_MISC - - -63 - $__USING_NAMESPACE_STD -( -þock_t -) - -67 #undeà -__Ãed_þock_t - - -69 #ià! -defšed - -__time_t_defšed - && (defšed -_TIME_H - || defšed -__Ãed_time_t -) - -70  - #__time_t_defšed - 1 - - ) - -72  - ~ - -74 -__BEGIN_NAMESPACE_STD - - -76  -__time_t - - ttime_t -; - -77 -__END_NAMESPACE_STD - - -78 #ià -defšed - -__USE_POSIX - || defšed -__USE_MISC - || defšed -__USE_SVID - - -79 - $__USING_NAMESPACE_STD -( -time_t -) - -83 #undeà -__Ãed_time_t - - -85 #ià! -defšed - -__þockid_t_defšed - && \ - -86 (( -defšed - -_TIME_H - && defšed -__USE_POSIX199309 -è|| defšed -__Ãed_þockid_t -) - -87  - #__þockid_t_defšed - 1 - - ) - -89  - ~ - -92  -__þockid_t - - tþockid_t -; - -95 #undeà -__þockid_time_t - - -97 #ià! -defšed - -__tim”_t_defšed - && \ - -98 (( -defšed - -_TIME_H - && defšed -__USE_POSIX199309 -è|| defšed -__Ãed_tim”_t -) - -99  - #__tim”_t_defšed - 1 - - ) - -101  - ~ - -104  -__tim”_t - - ttim”_t -; - -107 #undeà -__Ãed_tim”_t - - -110 #ià! -defšed - -__time¥ec_defšed - && \ - -111 (( -defšed - -_TIME_H - && \ - -112 ( -defšed - -__USE_POSIX199309 - || defšed -__USE_MISC -)) || \ - -113 -defšed - -__Ãed_time¥ec -) - -114  - #__time¥ec_defšed - 1 - - ) - -116  - ~ - -120  - stime¥ec - - -122 -__time_t - -tv_£c -; - -123  -tv_n£c -; - -127 #undeà -__Ãed_time¥ec - - -130 #ifdef -_TIME_H - - -131 -__BEGIN_NAMESPACE_STD - - -133  - stm - - -135  -tm_£c -; - -136  -tm_mš -; - -137  -tm_hour -; - -138  -tm_mday -; - -139  -tm_mÚ -; - -140  -tm_y—r -; - -141  -tm_wday -; - -142  -tm_yday -; - -143  -tm_isd¡ -; - -145 #ifdef -__USE_BSD - - -146  -tm_gmtoff -; - -147 -__cÚ¡ - * -tm_zÚe -; - -149  -__tm_gmtoff -; - -150 -__cÚ¡ - * -__tm_zÚe -; - -153 -__END_NAMESPACE_STD - - -154 #ià -defšed - -__USE_XOPEN - || defšed -__USE_POSIX - || defšed -__USE_MISC - - -155 - $__USING_NAMESPACE_STD -( -tm -) - -159 #ifdeà -__USE_POSIX199309 - - -161  - s™im”¥ec - - -163  -time¥ec - -™_š‹rv® -; - -164  -time¥ec - -™_v®ue -; - -168  -sigev’t -; - -172 #ifdeà -__USE_XOPEN2K - - -173 #iâdeà -__pid_t_defšed - - -174  -__pid_t - - tpid_t -; - -175  - #__pid_t_defšed - - - ) - -180 -__BEGIN_NAMESPACE_STD - - -183 -þock_t - - $þock - (è -__THROW -; - -186 -time_t - - $time - ( -time_t - * -__tim” -è -__THROW -; - -189  - $difáime - ( -time_t - -__time1 -,ime_ˆ -__time0 -) - -190 -__THROW - - `__©Œibu‹__ - (( -__cÚ¡__ -)); - -193 -time_t - - $mktime - ( -tm - * -__ -è -__THROW -; - -199 -size_t - - $¡ráime - (* -__»¡riù - -__s -, -size_t - -__maxsize -, - -200 -__cÚ¡ - * -__»¡riù - -__fÜm© -, - -201 -__cÚ¡ -  -tm - * -__»¡riù - -__ -è -__THROW -; - -202 -__END_NAMESPACE_STD - - -204 #ifdeà -__USE_XOPEN - - -207 * - $¡½time - ( -__cÚ¡ - * -__»¡riù - -__s -, - -208 -__cÚ¡ - * -__»¡riù - -__fmt -,  -tm - * -__ -) - -209 -__THROW -; - -212 #ifdeà -__USE_XOPEN2K8 - - -215  - ~ - -217 -size_t - - $¡ráime_l - (* -__»¡riù - -__s -, -size_t - -__maxsize -, - -218 -__cÚ¡ - * -__»¡riù - -__fÜm© -, - -219 -__cÚ¡ -  -tm - * -__»¡riù - -__ -, - -220 -__loÿË_t - -__loc -è -__THROW -; - -223 #ifdeà -__USE_GNU - - -224 * - $¡½time_l - ( -__cÚ¡ - * -__»¡riù - -__s -, - -225 -__cÚ¡ - * -__»¡riù - -__fmt -,  -tm - * -__ -, - -226 -__loÿË_t - -__loc -è -__THROW -; - -230 -__BEGIN_NAMESPACE_STD - - -233  -tm - * - $gmtime - ( -__cÚ¡ - -time_t - * -__tim” -è -__THROW -; - -237  -tm - * - $loÿÉime - ( -__cÚ¡ - -time_t - * -__tim” -è -__THROW -; - -238 -__END_NAMESPACE_STD - - -240 #ià -defšed - -__USE_POSIX - || defšed -__USE_MISC - - -243  -tm - * - $gmtime_r - ( -__cÚ¡ - -time_t - * -__»¡riù - -__tim” -, - -244  -tm - * -__»¡riù - -__ -è -__THROW -; - -248  -tm - * - $loÿÉime_r - ( -__cÚ¡ - -time_t - * -__»¡riù - -__tim” -, - -249  -tm - * -__»¡riù - -__ -è -__THROW -; - -252 -__BEGIN_NAMESPACE_STD - - -255 * - $asùime - ( -__cÚ¡ -  -tm - * -__ -è -__THROW -; - -258 * - $ùime - ( -__cÚ¡ - -time_t - * -__tim” -è -__THROW -; - -259 -__END_NAMESPACE_STD - - -261 #ià -defšed - -__USE_POSIX - || defšed -__USE_MISC - - -266 * - $asùime_r - ( -__cÚ¡ -  -tm - * -__»¡riù - -__ -, - -267 * -__»¡riù - -__buf -è -__THROW -; - -270 * - $ùime_r - ( -__cÚ¡ - -time_t - * -__»¡riù - -__tim” -, - -271 * -__»¡riù - -__buf -è -__THROW -; - -276 * -__tzÇme -[2]; - -277  -__daylight -; - -278  -__timezÚe -; - -281 #ifdef -__USE_POSIX - - -283 * -tzÇme -[2]; - -287  - $tz£t - (è -__THROW -; - -290 #ià -defšed - -__USE_SVID - || defšed -__USE_XOPEN - - -291  -daylight -; - -292  -timezÚe -; - -295 #ifdeà -__USE_SVID - - -298  - $¡ime - ( -__cÚ¡ - -time_t - * -__wh’ -è -__THROW -; - -304  - #__i¦—p -( -y—r -) \ - -305 (( -y—r -è% 4 =ð0 && ((y—rè% 100 !ð0 || (y—rè% 400 =ð0)) - - ) - -308 #ifdeà -__USE_MISC - - -313 -time_t - - $timegm - ( -tm - * -__ -è -__THROW -; - -316 -time_t - - $tim–oÿl - ( -tm - * -__ -è -__THROW -; - -319  - $dysize - ( -__y—r -è -__THROW - - `__©Œibu‹__ - (( -__cÚ¡__ -)); - -323 #ifdeà -__USE_POSIX199309 - - -328  - `Çno¦“p - ( -__cÚ¡ -  -time¥ec - * -__»que¡ed_time -, - -329  -time¥ec - * -__»maššg -); - -333  - $þock_g‘»s - ( -þockid_t - -__þock_id -,  -time¥ec - * -__»s -è -__THROW -; - -336  - $þock_g‘time - ( -þockid_t - -__þock_id -,  -time¥ec - * -__ -è -__THROW -; - -339  - $þock_£‰ime - ( -þockid_t - -__þock_id -, -__cÚ¡ -  -time¥ec - * -__ -) - -340 -__THROW -; - -342 #ifdeà -__USE_XOPEN2K - - -347  - `þock_Çno¦“p - ( -þockid_t - -__þock_id -,  -__æags -, - -348 -__cÚ¡ -  -time¥ec - * -__»q -, - -349  -time¥ec - * -__»m -); - -352  - $þock_g‘ýuþockid - ( -pid_t - -__pid -, -þockid_t - * -__þock_id -è -__THROW -; - -357  - $tim”_ü—‹ - ( -þockid_t - -__þock_id -, - -358  -sigev’t - * -__»¡riù - -__evp -, - -359 -tim”_t - * -__»¡riù - -__tim”id -è -__THROW -; - -362  - $tim”_d–‘e - ( -tim”_t - -__tim”id -è -__THROW -; - -365  - $tim”_£‰ime - ( -tim”_t - -__tim”id -,  -__æags -, - -366 -__cÚ¡ -  -™im”¥ec - * -__»¡riù - -__v®ue -, - -367  -™im”¥ec - * -__»¡riù - -__ov®ue -è -__THROW -; - -370  - $tim”_g‘time - ( -tim”_t - -__tim”id -,  -™im”¥ec - * -__v®ue -) - -371 -__THROW -; - -374  - $tim”_g‘ov”run - ( -tim”_t - -__tim”id -è -__THROW -; - -378 #ifdeà -__USE_XOPEN_EXTENDED - - -390  -g‘d©e_”r -; - -399  -tm - * - `g‘d©e - ( -__cÚ¡ - * -__¡ršg -); - -402 #ifdeà -__USE_GNU - - -413  - `g‘d©e_r - ( -__cÚ¡ - * -__»¡riù - -__¡ršg -, - -414  -tm - * -__»¡riù - -__»sbuå -); - -417 -__END_DECLS - - - @/usr/include/bits/sched.h - -22 #iâdeà -__Ãed_sched·¿m - - -24 #iâdeà -_SCHED_H - - -30  - #SCHED_OTHER - 0 - - ) - -31  - #SCHED_FIFO - 1 - - ) - -32  - #SCHED_RR - 2 - - ) - -33 #ifdeà -__USE_GNU - - -34  - #SCHED_BATCH - 3 - - ) - -37 #ifdeà -__USE_MISC - - -39  - #CSIGNAL - 0x000000fà - - ) - -40  - #CLONE_VM - 0x00000100 - - ) - -41  - #CLONE_FS - 0x00000200 - - ) - -42  - #CLONE_FILES - 0x00000400 - - ) - -43  - #CLONE_SIGHAND - 0x00000800 - - ) - -44  - #CLONE_PTRACE - 0x00002000 - - ) - -45  - #CLONE_VFORK - 0x00004000 - - ) - -47  - #CLONE_PARENT - 0x00008000 - - ) - -49  - #CLONE_THREAD - 0x00010000 - - ) - -50  - #CLONE_NEWNS - 0x00020000 - - ) - -51  - #CLONE_SYSVSEM - 0x00040000 - - ) - -52  - #CLONE_SETTLS - 0x00080000 - - ) - -53  - #CLONE_PARENT_SETTID - 0x00100000 - - ) - -55  - #CLONE_CHILD_CLEARTID - 0x00200000 - - ) - -57  - #CLONE_DETACHED - 0x00400000 - - ) - -58  - #CLONE_UNTRACED - 0x00800000 - - ) - -60  - #CLONE_CHILD_SETTID - 0x01000000 - - ) - -62  - #CLONE_NEWUTS - 0x04000000 - - ) - -63  - #CLONE_NEWIPC - 0x08000000 - - ) - -64  - #CLONE_NEWUSER - 0x10000000 - - ) - -65  - #CLONE_NEWPID - 0x20000000 - - ) - -66  - #CLONE_NEWNET - 0x40000000 - - ) - -67  - #CLONE_IO - 0x80000000 - - ) - -71  - ssched_·¿m - - -73  - m__sched_´iÜ™y -; - -76 - g__BEGIN_DECLS - - -78 #ifdeà -__USE_MISC - - -80  -þÚe - ((* -__â -è(* -__¬g -), * -__chžd_¡ack -, - -81  -__æags -, * -__¬g -, ...è -__THROW -; - -84  - $unsh¬e - ( -__æags -è -__THROW -; - -87  - $sched_g‘ýu - (è -__THROW -; - -90 -__END_DECLS - - -94 #ià! -defšed - -__defšed_sched·¿m - \ - -95 && ( -defšed - -__Ãed_sched·¿m - || defšed -_SCHED_H -) - -96  - #__defšed_sched·¿m - 1 - - ) - -98  - s__sched_·¿m - - -100  -__sched_´iÜ™y -; - -102 #undeà -__Ãed_sched·¿m - - -106 #ià -defšed - -_SCHED_H - && !defšed -__ýu_£t_t_defšed - - -107  - #__ýu_£t_t_defšed - - - ) - -109  - #__CPU_SETSIZE - 1024 - - ) - -110  - #__NCPUBITS - (8 *  ( -__ýu_mask -)) - - ) - -113  - t__ýu_mask -; - -116  - #__CPUELT -( -ýu -è((ýuè/ -__NCPUBITS -) - - ) - -117  - #__CPUMASK -( -ýu -è(( -__ýu_mask -è1 << ((ýuè% -__NCPUBITS -)) - - ) - -122 -__ýu_mask - -__b™s -[ -__CPU_SETSIZE - / -__NCPUBITS -]; - -123 } - týu_£t_t -; - -126 #ià - `__GNUC_PREREQ - (2, 91) - -127  - #__CPU_ZERO_S -( -£tsize -, -ýu£ -) \ - -128 dØ - `__bužtš_mem£t - ( -ýu£ -, '\0', -£tsize -); 0) - - ) - -130  - #__CPU_ZERO_S -( -£tsize -, -ýu£ -) \ - -132 -size_t - -__i -; \ - -133 -size_t - -__imax - = ( -£tsize -è/  ( -__ýu_mask -); \ - -134 -__ýu_mask - * -__b™s - = ( -ýu£ -)->__bits; \ - -135  -__i - = 0; __˜< -__imax -; ++__i) \ - -136 -__b™s -[ -__i -] = 0; \ - -137 - } -} 0) - - ) - -139  - #__CPU_SET_S -( -ýu -, -£tsize -, -ýu£ -) \ - -140 ( -__ex‹nsiÚ__ - \ - -141 ({ -size_t - -__ýu - = ( -ýu -); \ - -142 -__ýu - < 8 * ( -£tsize -) \ - -143 ? ((( -__ýu_mask - *è(( -ýu£ -)-> -__b™s -))[ - `__CPUELT - ( -__ýu -)] \ - -144 |ð - `__CPUMASK - ( -__ýu -)) \ - -145 : 0; })) - - ) - -146  - #__CPU_CLR_S -( -ýu -, -£tsize -, -ýu£ -) \ - -147 ( -__ex‹nsiÚ__ - \ - -148 ({ -size_t - -__ýu - = ( -ýu -); \ - -149 -__ýu - < 8 * ( -£tsize -) \ - -150 ? ((( -__ýu_mask - *è(( -ýu£ -)-> -__b™s -))[ - `__CPUELT - ( -__ýu -)] \ - -151 &ð~ - `__CPUMASK - ( -__ýu -)) \ - -152 : 0; })) - - ) - -153  - #__CPU_ISSET_S -( -ýu -, -£tsize -, -ýu£ -) \ - -154 ( -__ex‹nsiÚ__ - \ - -155 ({ -size_t - -__ýu - = ( -ýu -); \ - -156 -__ýu - < 8 * ( -£tsize -) \ - -157 ? (((( -__cÚ¡ - -__ýu_mask - *è(( -ýu£ -)-> -__b™s -))[ - `__CPUELT - ( -__ýu -)] \ - -158 & - `__CPUMASK - ( -__ýu -))) != 0 \ - -159 : 0; })) - - ) - -161  - #__CPU_COUNT_S -( -£tsize -, -ýu£ -) \ - -162 - `__sched_ýucouÁ - ( -£tsize -, -ýu£ -) - - ) - -164 #ià -__GNUC_PREREQ - (2, 91) - -165  - #__CPU_EQUAL_S -( -£tsize -, -ýu£1 -, -ýu£2 -) \ - -166 ( - `__bužtš_memcmp - ( -ýu£1 -, -ýu£2 -, -£tsize -è=ð0) - - ) - -168  - #__CPU_EQUAL_S -( -£tsize -, -ýu£1 -, -ýu£2 -) \ - -169 ( -__ex‹nsiÚ__ - \ - -170 ({ -__cÚ¡ - -__ýu_mask - * -__¬r1 - = ( -ýu£1 -)-> -__b™s -; \ - -171 -__cÚ¡ - -__ýu_mask - * -__¬r2 - = ( -ýu£2 -)-> -__b™s -; \ - -172 -size_t - -__imax - = ( -£tsize -è/  ( -__ýu_mask -); \ - -173 -size_t - -__i -; \ - -174  -__i - = 0; __˜< -__imax -; ++__i) \ - -175 ià( -__b™s -[ -__i -] != __bits[__i]) \ - -177 -__i - =ð -__imax -; })) - - ) - -180  - #__CPU_OP_S -( -£tsize -, -de¡£t -, -¤c£t1 -, -¤c£t2 -, -Ý -) \ - -181 ( -__ex‹nsiÚ__ - \ - -182 ({ -ýu_£t_t - * -__de¡ - = ( -de¡£t -); \ - -183 -__cÚ¡ - -__ýu_mask - * -__¬r1 - = ( -¤c£t1 -)-> -__b™s -; \ - -184 -__cÚ¡ - -__ýu_mask - * -__¬r2 - = ( -¤c£t2 -)-> -__b™s -; \ - -185 -size_t - -__imax - = ( -£tsize -è/  ( -__ýu_mask -); \ - -186 -size_t - -__i -; \ - -187  -__i - = 0; __˜< -__imax -; ++__i) \ - -188 (( -__ýu_mask - *è -__de¡ --> -__b™s -)[ -__i -] = -__¬r1 -[__i] -Ý - -__¬r2 -[__i]; \ - -189 -__de¡ -; })) - - ) - -191  - #__CPU_ALLOC_SIZE -( -couÁ -) \ - -192 (((( -couÁ -è+ -__NCPUBITS - - 1è/ __NCPUBITSè*  ( -__ýu_mask -)) - - ) - -193  - #__CPU_ALLOC -( -couÁ -è - `__sched_ýu®loc - (couÁ) - - ) - -194  - #__CPU_FREE -( -ýu£t -è - `__sched_ýuä“ - (ýu£t) - - ) - -196 -__BEGIN_DECLS - - -198  - $__sched_ýucouÁ - ( -size_t - -__£tsize -, cÚ¡ -ýu_£t_t - * -__£ -) - -199 -__THROW -; - -200 -ýu_£t_t - * - $__sched_ýu®loc - ( -size_t - -__couÁ -è -__THROW - -__wur -; - -201  - $__sched_ýuä“ - ( -ýu_£t_t - * -__£t -è -__THROW -; - -203 -__END_DECLS - - - @/usr/include/bits/sigaction.h - -20 #iâdeà -_SIGNAL_H - - -25  - ssigaùiÚ - - -28 #ifdeà -__USE_POSIX199309 - - -32 -__sighªdËr_t - - m§_hªdËr -; - -34 (* - m§_sigaùiÚ -è(, - msigšfo_t - *, *); - -36 - m__sigaùiÚ_hªdËr -; - -37  - #§_hªdËr - -__sigaùiÚ_hªdËr -. -§_hªdËr - - - ) - -38  - #§_sigaùiÚ - -__sigaùiÚ_hªdËr -. -§_sigaùiÚ - - - ) - -40 -__sighªdËr_t - - m§_hªdËr -; - -44 -__sig£t_t - - m§_mask -; - -47  - m§_æags -; - -50 (* - m§_»¡Ü” -) (); - -54  - #SA_NOCLDSTOP - 1 - - ) - -55  - #SA_NOCLDWAIT - 2 - - ) - -56  - #SA_SIGINFO - 4 - - ) - -58 #ià -defšed - -__USE_UNIX98 - || defšed -__USE_MISC - - -59  - #SA_ONSTACK - 0x08000000 - - ) - -60  - #SA_RESTART - 0x10000000 - - ) - -61  - #SA_NODEFER - 0x40000000 - - ) - -63  - #SA_RESETHAND - 0x80000000 - - ) - -65 #ifdeà -__USE_MISC - - -66  - #SA_INTERRUPT - 0x20000000 - - ) - -69  - #SA_NOMASK - -SA_NODEFER - - - ) - -70  - #SA_ONESHOT - -SA_RESETHAND - - - ) - -71  - #SA_STACK - -SA_ONSTACK - - - ) - -75  - #SIG_BLOCK - 0 - - ) - -76  - #SIG_UNBLOCK - 1 - - ) - -77  - #SIG_SETMASK - 2 - - ) - - @/usr/include/bits/sigcontext.h - -19 #iâdeà -_BITS_SIGCONTEXT_H - - -20  - #_BITS_SIGCONTEXT_H - 1 - - ) - -22 #ià! -defšed - -_SIGNAL_H - && !defšed -_SYS_UCONTEXT_H - - -26  - ~ - -28  - s_å»g - - -30  - msignifiÿnd -[4]; - -31  - mexpÚ’t -; - -34  - s_åx»g - - -36  - msignifiÿnd -[4]; - -37  - mexpÚ’t -; - -38  - m·ddšg -[3]; - -41  - s_xmm»g - - -43 -__ušt32_t - - m–em’t -[4]; - -48 #ià -__WORDSIZE - == 32 - -50  - s_å¡©e - - -53 -__ušt32_t - - mcw -; - -54 -__ušt32_t - - msw -; - -55 -__ušt32_t - - mg -; - -56 -__ušt32_t - - moff -; - -57 -__ušt32_t - - mcs£l -; - -58 -__ušt32_t - - md©aoff -; - -59 -__ušt32_t - - md©a£l -; - -60  -_å»g - - m_¡ -[8]; - -61  - m¡©us -; - -62  - mmagic -; - -65 -__ušt32_t - - m_fx¤_’v -[6]; - -66 -__ušt32_t - - mmxc¤ -; - -67 -__ušt32_t - - m»£rved -; - -68  -_åx»g - - m_fx¤_¡ -[8]; - -69  -_xmm»g - - m_xmm -[8]; - -70 -__ušt32_t - - m·ddšg -[56]; - -73 #iâdeà -sigcÚ‹xt_¡ruù - - -78  - #sigcÚ‹xt_¡ruù - -sigcÚ‹xt - - - ) - -81  - ssigcÚ‹xt - - -83  - mgs -, - m__gsh -; - -84  - mfs -, - m__fsh -; - -85  - mes -, - m__esh -; - -86  - mds -, - m__dsh -; - -87  - medi -; - -88  - mesi -; - -89  - mebp -; - -90  - me¥ -; - -91  - mebx -; - -92  - medx -; - -93  - mecx -; - -94  - m—x -; - -95  - mŒ­no -; - -96  - m”r -; - -97  - me -; - -98  - mcs -, - m__csh -; - -99  - meæags -; - -100  - me¥_©_sigÇl -; - -101  - mss -, - m__ssh -; - -102  -_å¡©e - * - må¡©e -; - -103  - mÞdmask -; - -104  - mü2 -; - -109  - s_å¡©e - - -112 -__ušt16_t - - mcwd -; - -113 -__ušt16_t - - mswd -; - -114 -__ušt16_t - - máw -; - -115 -__ušt16_t - - mfÝ -; - -116 -__ušt64_t - - mr -; - -117 -__ušt64_t - - mrdp -; - -118 -__ušt32_t - - mmxc¤ -; - -119 -__ušt32_t - - mmxü_mask -; - -120  -_åx»g - - m_¡ -[8]; - -121  -_xmm»g - - m_xmm -[16]; - -122 -__ušt32_t - - m·ddšg -[24]; - -125  - ssigcÚ‹xt - - -127  - mr8 -; - -128  - mr9 -; - -129  - mr10 -; - -130  - mr11 -; - -131  - mr12 -; - -132  - mr13 -; - -133  - mr14 -; - -134  - mr15 -; - -135  - mrdi -; - -136  - mrsi -; - -137  - mrbp -; - -138  - mrbx -; - -139  - mrdx -; - -140  - m¿x -; - -141  - mrcx -; - -142  - mr¥ -; - -143  - mr -; - -144  - meæags -; - -145  - mcs -; - -146  - mgs -; - -147  - mfs -; - -148  - m__·d0 -; - -149  - m”r -; - -150  - mŒ­no -; - -151  - mÞdmask -; - -152  - mü2 -; - -153  -_å¡©e - * - må¡©e -; - -154  - m__»£rved1 - [8]; - - @/usr/include/bits/siginfo.h - -20 #ià! -defšed - -_SIGNAL_H - && !defšed -__Ãed_sigšfo_t - \ - -21 && ! -defšed - - g__Ãed_sigev’t_t - - -25  - ~ - -27 #ià(! -defšed - -__have_sigv®_t - \ - -28 && ( -defšed - - g_SIGNAL_H - || defšed - g__Ãed_sigšfo_t - \ - -29 || -defšed - - g__Ãed_sigev’t_t -)) - -30  - #__have_sigv®_t - 1 - - ) - -33  - usigv® - - -35  - msiv®_št -; - -36 * - msiv®_±r -; - -37 } - tsigv®_t -; - -40 #ià(! -defšed - -__have_sigšfo_t - \ - -41 && ( -defšed - - g_SIGNAL_H - || defšed - g__Ãed_sigšfo_t -)) - -42  - #__have_sigšfo_t - 1 - - ) - -44  - #__SI_MAX_SIZE - 128 - - ) - -45 #ià -__WORDSIZE - == 64 - -46  - #__SI_PAD_SIZE - (( -__SI_MAX_SIZE - /  ()è- 4) - - ) - -48  - #__SI_PAD_SIZE - (( -__SI_MAX_SIZE - /  ()è- 3) - - ) - -51  - ssigšfo - - -53  - msi_signo -; - -54  - msi_”ºo -; - -56  - msi_code -; - -60  - m_·d -[ -__SI_PAD_SIZE -]; - -65 -__pid_t - - msi_pid -; - -66 -__uid_t - - msi_uid -; - -67 } - m_kžl -; - -72  - msi_tid -; - -73  - msi_ov”run -; - -74 -sigv®_t - - msi_sigv® -; - -75 } - m_tim” -; - -80 -__pid_t - - msi_pid -; - -81 -__uid_t - - msi_uid -; - -82 -sigv®_t - - msi_sigv® -; - -83 } - m_¹ -; - -88 -__pid_t - - msi_pid -; - -89 -__uid_t - - msi_uid -; - -90  - msi_¡©us -; - -91 -__þock_t - - msi_utime -; - -92 -__þock_t - - msi_¡ime -; - -93 } - m_sigchld -; - -98 * - msi_addr -; - -99 } - m_sigçuÉ -; - -104  - msi_bªd -; - -105  - msi_fd -; - -106 } - m_sigpÞl -; - -107 } - m_sif›lds -; - -108 } - tsigšfo_t -; - -112  - #si_pid - -_sif›lds -. -_kžl -. -si_pid - - - ) - -113  - #si_uid - -_sif›lds -. -_kžl -. -si_uid - - - ) - -114  - #si_tim”id - -_sif›lds -. -_tim” -. -si_tid - - - ) - -115  - #si_ov”run - -_sif›lds -. -_tim” -. -si_ov”run - - - ) - -116  - #si_¡©us - -_sif›lds -. -_sigchld -. -si_¡©us - - - ) - -117  - #si_utime - -_sif›lds -. -_sigchld -. -si_utime - - - ) - -118  - #si_¡ime - -_sif›lds -. -_sigchld -. -si_¡ime - - - ) - -119  - #si_v®ue - -_sif›lds -. -_¹ -. -si_sigv® - - - ) - -120  - #si_št - -_sif›lds -. -_¹ -. -si_sigv® -. -siv®_št - - - ) - -121  - #si_±r - -_sif›lds -. -_¹ -. -si_sigv® -. -siv®_±r - - - ) - -122  - #si_addr - -_sif›lds -. -_sigçuÉ -. -si_addr - - - ) - -123  - #si_bªd - -_sif›lds -. -_sigpÞl -. -si_bªd - - - ) - -124  - #si_fd - -_sif›lds -. -_sigpÞl -. -si_fd - - - ) - -131 - mSI_ASYNCNL - = -60, - -132  - #SI_ASYNCNL - -SI_ASYNCNL - - - ) - -133 - mSI_TKILL - = -6, - -134  - #SI_TKILL - -SI_TKILL - - - ) - -135 - mSI_SIGIO -, - -136  - #SI_SIGIO - -SI_SIGIO - - - ) - -137 - mSI_ASYNCIO -, - -138  - #SI_ASYNCIO - -SI_ASYNCIO - - - ) - -139 - mSI_MESGQ -, - -140  - #SI_MESGQ - -SI_MESGQ - - - ) - -141 - mSI_TIMER -, - -142  - #SI_TIMER - -SI_TIMER - - - ) - -143 - mSI_QUEUE -, - -144  - #SI_QUEUE - -SI_QUEUE - - - ) - -145 - mSI_USER -, - -146  - #SI_USER - -SI_USER - - - ) - -147 - mSI_KERNEL - = 0x80 - -148  - #SI_KERNEL - -SI_KERNEL - - - ) - -155 - mILL_ILLOPC - = 1, - -156  - #ILL_ILLOPC - -ILL_ILLOPC - - - ) - -157 - mILL_ILLOPN -, - -158  - #ILL_ILLOPN - -ILL_ILLOPN - - - ) - -159 - mILL_ILLADR -, - -160  - #ILL_ILLADR - -ILL_ILLADR - - - ) - -161 - mILL_ILLTRP -, - -162  - #ILL_ILLTRP - -ILL_ILLTRP - - - ) - -163 - mILL_PRVOPC -, - -164  - #ILL_PRVOPC - -ILL_PRVOPC - - - ) - -165 - mILL_PRVREG -, - -166  - #ILL_PRVREG - -ILL_PRVREG - - - ) - -167 - mILL_COPROC -, - -168  - #ILL_COPROC - -ILL_COPROC - - - ) - -169 - mILL_BADSTK - - -170  - #ILL_BADSTK - -ILL_BADSTK - - - ) - -176 - mFPE_INTDIV - = 1, - -177  - #FPE_INTDIV - -FPE_INTDIV - - - ) - -178 - mFPE_INTOVF -, - -179  - #FPE_INTOVF - -FPE_INTOVF - - - ) - -180 - mFPE_FLTDIV -, - -181  - #FPE_FLTDIV - -FPE_FLTDIV - - - ) - -182 - mFPE_FLTOVF -, - -183  - #FPE_FLTOVF - -FPE_FLTOVF - - - ) - -184 - mFPE_FLTUND -, - -185  - #FPE_FLTUND - -FPE_FLTUND - - - ) - -186 - mFPE_FLTRES -, - -187  - #FPE_FLTRES - -FPE_FLTRES - - - ) - -188 - mFPE_FLTINV -, - -189  - #FPE_FLTINV - -FPE_FLTINV - - - ) - -190 - mFPE_FLTSUB - - -191  - #FPE_FLTSUB - -FPE_FLTSUB - - - ) - -197 - mSEGV_MAPERR - = 1, - -198  - #SEGV_MAPERR - -SEGV_MAPERR - - - ) - -199 - mSEGV_ACCERR - - -200  - #SEGV_ACCERR - -SEGV_ACCERR - - - ) - -206 - mBUS_ADRALN - = 1, - -207  - #BUS_ADRALN - -BUS_ADRALN - - - ) - -208 - mBUS_ADRERR -, - -209  - #BUS_ADRERR - -BUS_ADRERR - - - ) - -210 - mBUS_OBJERR - - -211  - #BUS_OBJERR - -BUS_OBJERR - - - ) - -217 - mTRAP_BRKPT - = 1, - -218  - #TRAP_BRKPT - -TRAP_BRKPT - - - ) - -219 - mTRAP_TRACE - - -220  - #TRAP_TRACE - -TRAP_TRACE - - - ) - -226 - mCLD_EXITED - = 1, - -227  - #CLD_EXITED - -CLD_EXITED - - - ) - -228 - mCLD_KILLED -, - -229  - #CLD_KILLED - -CLD_KILLED - - - ) - -230 - mCLD_DUMPED -, - -231  - #CLD_DUMPED - -CLD_DUMPED - - - ) - -232 - mCLD_TRAPPED -, - -233  - #CLD_TRAPPED - -CLD_TRAPPED - - - ) - -234 - mCLD_STOPPED -, - -235  - #CLD_STOPPED - -CLD_STOPPED - - - ) - -236 - mCLD_CONTINUED - - -237  - #CLD_CONTINUED - -CLD_CONTINUED - - - ) - -243 - mPOLL_IN - = 1, - -244  - #POLL_IN - -POLL_IN - - - ) - -245 - mPOLL_OUT -, - -246  - #POLL_OUT - -POLL_OUT - - - ) - -247 - mPOLL_MSG -, - -248  - #POLL_MSG - -POLL_MSG - - - ) - -249 - mPOLL_ERR -, - -250  - #POLL_ERR - -POLL_ERR - - - ) - -251 - mPOLL_PRI -, - -252  - #POLL_PRI - -POLL_PRI - - - ) - -253 - mPOLL_HUP - - -254  - #POLL_HUP - -POLL_HUP - - - ) - -257 #undeà -__Ãed_sigšfo_t - - -261 #ià( -defšed - -_SIGNAL_H - || defšed -__Ãed_sigev’t_t -) \ - -262 && ! -defšed - - g__have_sigev’t_t - - -263  - #__have_sigev’t_t - 1 - - ) - -266  - #__SIGEV_MAX_SIZE - 64 - - ) - -267 #ià -__WORDSIZE - == 64 - -268  - #__SIGEV_PAD_SIZE - (( -__SIGEV_MAX_SIZE - /  ()è- 4) - - ) - -270  - #__SIGEV_PAD_SIZE - (( -__SIGEV_MAX_SIZE - /  ()è- 3) - - ) - -273  - ssigev’t - - -275 -sigv®_t - - msigev_v®ue -; - -276  - msigev_signo -; - -277  - msigev_nÙify -; - -281  - m_·d -[ -__SIGEV_PAD_SIZE -]; - -285 -__pid_t - - m_tid -; - -289 (* - m_funùiÚ -è( - msigv®_t -); - -290 * - m_©Œibu‹ -; - -291 } - m_sigev_th»ad -; - -292 } - m_sigev_un -; - -293 } - tsigev’t_t -; - -296  - #sigev_nÙify_funùiÚ - -_sigev_un -. -_sigev_th»ad -. -_funùiÚ - - - ) - -297  - #sigev_nÙify_©Œibu‹s - -_sigev_un -. -_sigev_th»ad -. -_©Œibu‹ - - - ) - -302 - mSIGEV_SIGNAL - = 0, - -303  - #SIGEV_SIGNAL - -SIGEV_SIGNAL - - - ) - -304 - mSIGEV_NONE -, - -305  - #SIGEV_NONE - -SIGEV_NONE - - - ) - -306 - mSIGEV_THREAD -, - -307  - #SIGEV_THREAD - -SIGEV_THREAD - - - ) - -309 - mSIGEV_THREAD_ID - = 4 - -310  - #SIGEV_THREAD_ID - -SIGEV_THREAD_ID - - - ) - - @/usr/include/bits/signum.h - -20 #ifdef -_SIGNAL_H - - -23  - #SIG_ERR - (( -__sighªdËr_t -è-1è - - ) - -24  - #SIG_DFL - (( -__sighªdËr_t -è0è - - ) - -25  - #SIG_IGN - (( -__sighªdËr_t -è1è - - ) - -27 #ifdeà -__USE_UNIX98 - - -28  - #SIG_HOLD - (( -__sighªdËr_t -è2è - - ) - -33  - #SIGHUP - 1 - - ) - -34  - #SIGINT - 2 - - ) - -35  - #SIGQUIT - 3 - - ) - -36  - #SIGILL - 4 - - ) - -37  - #SIGTRAP - 5 - - ) - -38  - #SIGABRT - 6 - - ) - -39  - #SIGIOT - 6 - - ) - -40  - #SIGBUS - 7 - - ) - -41  - #SIGFPE - 8 - - ) - -42  - #SIGKILL - 9 - - ) - -43  - #SIGUSR1 - 10 - - ) - -44  - #SIGSEGV - 11 - - ) - -45  - #SIGUSR2 - 12 - - ) - -46  - #SIGPIPE - 13 - - ) - -47  - #SIGALRM - 14 - - ) - -48  - #SIGTERM - 15 - - ) - -49  - #SIGSTKFLT - 16 - - ) - -50  - #SIGCLD - -SIGCHLD - - - ) - -51  - #SIGCHLD - 17 - - ) - -52  - #SIGCONT - 18 - - ) - -53  - #SIGSTOP - 19 - - ) - -54  - #SIGTSTP - 20 - - ) - -55  - #SIGTTIN - 21 - - ) - -56  - #SIGTTOU - 22 - - ) - -57  - #SIGURG - 23 - - ) - -58  - #SIGXCPU - 24 - - ) - -59  - #SIGXFSZ - 25 - - ) - -60  - #SIGVTALRM - 26 - - ) - -61  - #SIGPROF - 27 - - ) - -62  - #SIGWINCH - 28 - - ) - -63  - #SIGPOLL - -SIGIO - - - ) - -64  - #SIGIO - 29 - - ) - -65  - #SIGPWR - 30 - - ) - -66  - #SIGSYS - 31 - - ) - -67  - #SIGUNUSED - 31 - - ) - -69  - #_NSIG - 65 - - ) - -72  - #SIGRTMIN - ( - `__libc_cu¼’t_sig¹mš - ()) - - ) - -73  - #SIGRTMAX - ( - `__libc_cu¼’t_sig¹max - ()) - - ) - -77  - #__SIGRTMIN - 32 - - ) - -78  - #__SIGRTMAX - ( -_NSIG - - 1) - - ) - - @/usr/include/bits/sigset.h - -21 #iâdef -_SIGSET_H_ty³s - - -22  - #_SIGSET_H_ty³s - 1 - - ) - -24  - t__sig_©omic_t -; - -28  - #_SIGSET_NWORDS - (1024 / (8 *  ())) - - ) - -31  - m__v® -[ -_SIGSET_NWORDS -]; - -32 } - t__sig£t_t -; - -43 #ià! -defšed - -_SIGSET_H_âs - && defšed -_SIGNAL_H - - -44  - #_SIGSET_H_âs - 1 - - ) - -46 #iâdeà -_EXTERN_INLINE - - -47  - #_EXTERN_INLINE - -__ex‹º_šlše - - - ) - -51  - #__sigmask -( -sig -) \ - -52 (((è1è<< ((( -sig -è- 1è% (8 *  ()))) - - ) - -55  - #__sigwÜd -( -sig -è(((sigè- 1è/ (8 *  ())) - - ) - -57 #ià -defšed - -__GNUC__ - && __GNUC__ >= 2 - -58  - #__sigem±y£t -( -£t -) \ - -59 ( - `__ex‹nsiÚ__ - ({  -__út - = -_SIGSET_NWORDS -; \ - -60 -sig£t_t - * -__£t - = ( -£t -); \ - -61 -- -__út - >ð0è -__£t --> -__v® -[__cnt] = 0; \ - -62 0; })) - - ) - -63  - #__sigfžl£t -( -£t -) \ - -64 ( - `__ex‹nsiÚ__ - ({  -__út - = -_SIGSET_NWORDS -; \ - -65 -sig£t_t - * -__£t - = ( -£t -); \ - -66 -- -__út - >ð0è -__£t --> -__v® -[__cnt] = ~0UL; \ - -67 0; })) - - ) - -69 #ifdeà -__USE_GNU - - -73  - #__sigi£m±y£t -( -£t -) \ - -74 ( - `__ex‹nsiÚ__ - ({  -__út - = -_SIGSET_NWORDS -; \ - -75 cÚ¡ -sig£t_t - * -__£t - = ( -£t -); \ - -76  -__»t - = -__£t --> -__v® -[-- -__út -]; \ - -77 ! -__»t - && -- -__út - >= 0) \ - -78 -__»t - = -__£t --> -__v® -[ -__út -]; \ - -79 -__»t - =ð0; })) - - ) - -80  - #__sigªd£t -( -de¡ -, -Ëá -, -right -) \ - -81 ( - `__ex‹nsiÚ__ - ({  -__út - = -_SIGSET_NWORDS -; \ - -82 -sig£t_t - * -__de¡ - = ( -de¡ -); \ - -83 cÚ¡ -sig£t_t - * -__Ëá - = ( -Ëá -); \ - -84 cÚ¡ -sig£t_t - * -__right - = ( -right -); \ - -85 -- -__út - >= 0) \ - -86 -__de¡ --> -__v® -[ -__út -] = ( -__Ëá -->__val[__cnt] \ - -87 & -__right --> -__v® -[ -__út -]); \ - -88 0; })) - - ) - -89  - #__sigÜ£t -( -de¡ -, -Ëá -, -right -) \ - -90 ( - `__ex‹nsiÚ__ - ({  -__út - = -_SIGSET_NWORDS -; \ - -91 -sig£t_t - * -__de¡ - = ( -de¡ -); \ - -92 cÚ¡ -sig£t_t - * -__Ëá - = ( -Ëá -); \ - -93 cÚ¡ -sig£t_t - * -__right - = ( -right -); \ - -94 -- -__út - >= 0) \ - -95 -__de¡ --> -__v® -[ -__út -] = ( -__Ëá -->__val[__cnt] \ - -96 | -__right --> -__v® -[ -__út -]); \ - -97 0; })) - - ) - -104  -__sigismemb” - ( -__cÚ¡ - -__sig£t_t - *, ); - -105  -__sigadd£t - ( -__sig£t_t - *, ); - -106  -__sigd–£t - ( -__sig£t_t - *, ); - -108 #ifdeà -__USE_EXTERN_INLINES - - -109  - #__SIGSETFN -( -NAME -, -BODY -, -CONST -) \ - -110 -_EXTERN_INLINE - \ - -111 - `NAME - ( -CONST - -__sig£t_t - * -__£t -,  -__sig -) \ - -113  -__mask - = - `__sigmask - ( -__sig -); \ - -114  -__wÜd - = - `__sigwÜd - ( -__sig -); \ - -115  -BODY -; \ - -116 } - - ) - -118 -__SIGSETFN - ( -__sigismemb” -, ( -__£t --> -__v® -[ -__wÜd -] & -__mask -è? 1 : 0, -__cÚ¡ -) - -119 -__SIGSETFN - ( -__sigadd£t -, (( -__£t --> -__v® -[ -__wÜd -] |ð -__mask -), 0), ) - -120 -__SIGSETFN - ( -__sigd–£t -, (( -__£t --> -__v® -[ -__wÜd -] &ð~ -__mask -), 0), ) - -122 #undeà -__SIGSETFN - - - @/usr/include/bits/sigstack.h - -20 #iâdeà -_SIGNAL_H - - -26  - ssig¡ack - - -28 * - mss_¥ -; - -29  - mss_Ú¡ack -; - -36 - mSS_ONSTACK - = 1, - -37  - #SS_ONSTACK - -SS_ONSTACK - - - ) - -38 - mSS_DISABLE - - -39  - #SS_DISABLE - -SS_DISABLE - - - ) - -43  - #MINSIGSTKSZ - 2048 - - ) - -46  - #SIGSTKSZ - 8192 - - ) - -50  - ssig®t¡ack - - -52 * - mss_¥ -; - -53  - mss_æags -; - -54 -size_t - - mss_size -; - -55 } - t¡ack_t -; - - @/usr/include/bits/sigthread.h - -20 #iâdeà -_BITS_SIGTHREAD_H - - -21  - #_BITS_SIGTHREAD_H - 1 - - ) - -23 #ià! -defšed - -_SIGNAL_H - && !defšed -_PTHREAD_H - - -31  - $±h»ad_sigmask - ( -__how -, - -32 -__cÚ¡ - -__sig£t_t - * -__»¡riù - -__Ãwmask -, - -33 -__sig£t_t - * -__»¡riù - -__Þdmask -) -__THROW -; - -36  - $±h»ad_kžl - ( -±h»ad_t - -__th»adid -,  -__signo -è -__THROW -; - -38 #ifdeà -__USE_GNU - - -40  - $±h»ad_sigqueue - ( -±h»ad_t - -__th»adid -,  -__signo -, - -41 cÚ¡  -sigv® - -__v®ue -è -__THROW -; - - @/usr/include/bits/time.h - -24 #iâdeà -__Ãed_timev® - - -25 #iâdeà -_BITS_TIME_H - - -26  - #_BITS_TIME_H - 1 - - ) - -34  - #CLOCKS_PER_SEC - 1000000l - - ) - -36 #ià! -defšed - -__STRICT_ANSI__ - && !defšed -__USE_XOPEN2K - - -39  - ~ - -40  -__syscÚf - (); - -41  - #CLK_TCK - (( -__þock_t -è - `__syscÚf - (2)è - - ) - -44 #ifdeà -__USE_POSIX199309 - - -46  - #CLOCK_REALTIME - 0 - - ) - -48  - #CLOCK_MONOTONIC - 1 - - ) - -50  - #CLOCK_PROCESS_CPUTIME_ID - 2 - - ) - -52  - #CLOCK_THREAD_CPUTIME_ID - 3 - - ) - -55  - #TIMER_ABSTIME - 1 - - ) - -61 #ifdeà -__Ãed_timev® - - -62 #undeà -__Ãed_timev® - - -63 #iâdeà -_STRUCT_TIMEVAL - - -64  - #_STRUCT_TIMEVAL - 1 - - ) - -65  - ~ - -69  - stimev® - - -71 -__time_t - - mtv_£c -; - -72 -__su£cÚds_t - - mtv_u£c -; - - @/usr/include/linux/errno.h - -1 #iâdeà -_LINUX_ERRNO_H - - -2  - #_LINUX_ERRNO_H - - - ) - -4  - ~ - - @/usr/include/sys/ucontext.h - -19 #iâdeà -_SYS_UCONTEXT_H - - -20  - #_SYS_UCONTEXT_H - 1 - - ) - -22  - ~<ã©u»s.h -> - -23  - ~ - -24  - ~ - -28  - ~ - -30 #ià -__WORDSIZE - == 64 - -33  - tg»g_t -; - -36  - #NGREG - 23 - - ) - -39  -g»g_t - - tg»g£t_t -[ -NGREG -]; - -41 #ifdeà -__USE_GNU - - -45 - mREG_R8 - = 0, - -46  - #REG_R8 - -REG_R8 - - - ) - -47 - mREG_R9 -, - -48  - #REG_R9 - -REG_R9 - - - ) - -49 - mREG_R10 -, - -50  - #REG_R10 - -REG_R10 - - - ) - -51 - mREG_R11 -, - -52  - #REG_R11 - -REG_R11 - - - ) - -53 - mREG_R12 -, - -54  - #REG_R12 - -REG_R12 - - - ) - -55 - mREG_R13 -, - -56  - #REG_R13 - -REG_R13 - - - ) - -57 - mREG_R14 -, - -58  - #REG_R14 - -REG_R14 - - - ) - -59 - mREG_R15 -, - -60  - #REG_R15 - -REG_R15 - - - ) - -61 - mREG_RDI -, - -62  - #REG_RDI - -REG_RDI - - - ) - -63 - mREG_RSI -, - -64  - #REG_RSI - -REG_RSI - - - ) - -65 - mREG_RBP -, - -66  - #REG_RBP - -REG_RBP - - - ) - -67 - mREG_RBX -, - -68  - #REG_RBX - -REG_RBX - - - ) - -69 - mREG_RDX -, - -70  - #REG_RDX - -REG_RDX - - - ) - -71 - mREG_RAX -, - -72  - #REG_RAX - -REG_RAX - - - ) - -73 - mREG_RCX -, - -74  - #REG_RCX - -REG_RCX - - - ) - -75 - mREG_RSP -, - -76  - #REG_RSP - -REG_RSP - - - ) - -77 - mREG_RIP -, - -78  - #REG_RIP - -REG_RIP - - - ) - -79 - mREG_EFL -, - -80  - #REG_EFL - -REG_EFL - - - ) - -81 - mREG_CSGSFS -, - -82  - #REG_CSGSFS - -REG_CSGSFS - - - ) - -83 - mREG_ERR -, - -84  - #REG_ERR - -REG_ERR - - - ) - -85 - mREG_TRAPNO -, - -86  - #REG_TRAPNO - -REG_TRAPNO - - - ) - -87 - mREG_OLDMASK -, - -88  - #REG_OLDMASK - -REG_OLDMASK - - - ) - -89 - mREG_CR2 - - -90  - #REG_CR2 - -REG_CR2 - - - ) - -94  - s_libc_åx»g - - -96  - msignifiÿnd -[4]; - -97  - mexpÚ’t -; - -98  - m·ddšg -[3]; - -101  - s_libc_xmm»g - - -103 -__ušt32_t - - m–em’t -[4]; - -106  - s_libc_å¡©e - - -109 -__ušt16_t - - mcwd -; - -110 -__ušt16_t - - mswd -; - -111 -__ušt16_t - - máw -; - -112 -__ušt16_t - - mfÝ -; - -113 -__ušt64_t - - mr -; - -114 -__ušt64_t - - mrdp -; - -115 -__ušt32_t - - mmxc¤ -; - -116 -__ušt32_t - - mmxü_mask -; - -117  -_libc_åx»g - - m_¡ -[8]; - -118  -_libc_xmm»g - - m_xmm -[16]; - -119 -__ušt32_t - - m·ddšg -[24]; - -123  -_libc_å¡©e - * - tå»g£t_t -; - -128 -g»g£t_t - - mg»gs -; - -130 -å»g£t_t - - må»gs -; - -131  - m__»£rved1 - [8]; - -132 } - tmcÚ‹xt_t -; - -135  - sucÚ‹xt - - -137  - muc_æags -; - -138  -ucÚ‹xt - * - muc_lšk -; - -139 -¡ack_t - - muc_¡ack -; - -140 -mcÚ‹xt_t - - muc_mcÚ‹xt -; - -141 -__sig£t_t - - muc_sigmask -; - -142  -_libc_å¡©e - - m__å»gs_mem -; - -143 } - tucÚ‹xt_t -; - -148  - tg»g_t -; - -151  - #NGREG - 19 - - ) - -154  -g»g_t - - tg»g£t_t -[ -NGREG -]; - -156 #ifdeà -__USE_GNU - - -160 - mREG_GS - = 0, - -161  - #REG_GS - -REG_GS - - - ) - -162 - mREG_FS -, - -163  - #REG_FS - -REG_FS - - - ) - -164 - mREG_ES -, - -165  - #REG_ES - -REG_ES - - - ) - -166 - mREG_DS -, - -167  - #REG_DS - -REG_DS - - - ) - -168 - mREG_EDI -, - -169  - #REG_EDI - -REG_EDI - - - ) - -170 - mREG_ESI -, - -171  - #REG_ESI - -REG_ESI - - - ) - -172 - mREG_EBP -, - -173  - #REG_EBP - -REG_EBP - - - ) - -174 - mREG_ESP -, - -175  - #REG_ESP - -REG_ESP - - - ) - -176 - mREG_EBX -, - -177  - #REG_EBX - -REG_EBX - - - ) - -178 - mREG_EDX -, - -179  - #REG_EDX - -REG_EDX - - - ) - -180 - mREG_ECX -, - -181  - #REG_ECX - -REG_ECX - - - ) - -182 - mREG_EAX -, - -183  - #REG_EAX - -REG_EAX - - - ) - -184 - mREG_TRAPNO -, - -185  - #REG_TRAPNO - -REG_TRAPNO - - - ) - -186 - mREG_ERR -, - -187  - #REG_ERR - -REG_ERR - - - ) - -188 - mREG_EIP -, - -189  - #REG_EIP - -REG_EIP - - - ) - -190 - mREG_CS -, - -191  - #REG_CS - -REG_CS - - - ) - -192 - mREG_EFL -, - -193  - #REG_EFL - -REG_EFL - - - ) - -194 - mREG_UESP -, - -195  - #REG_UESP - -REG_UESP - - - ) - -196 - mREG_SS - - -197  - #REG_SS - -REG_SS - - - ) - -202  - s_libc_å»g - - -204  - msignifiÿnd -[4]; - -205  - mexpÚ’t -; - -208  - s_libc_å¡©e - - -210  - mcw -; - -211  - msw -; - -212  - mg -; - -213  - moff -; - -214  - mcs£l -; - -215  - md©aoff -; - -216  - md©a£l -; - -217  -_libc_å»g - - m_¡ -[8]; - -218  - m¡©us -; - -222  -_libc_å¡©e - * - tå»g£t_t -; - -227 -g»g£t_t - - mg»gs -; - -230 -å»g£t_t - - må»gs -; - -231  - mÞdmask -; - -232  - mü2 -; - -233 } - tmcÚ‹xt_t -; - -236  - sucÚ‹xt - - -238  - muc_æags -; - -239  -ucÚ‹xt - * - muc_lšk -; - -240 -¡ack_t - - muc_¡ack -; - -241 -mcÚ‹xt_t - - muc_mcÚ‹xt -; - -242 -__sig£t_t - - muc_sigmask -; - -243  -_libc_å¡©e - - m__å»gs_mem -; - -244 } - tucÚ‹xt_t -; - - @/usr/include/asm/errno.h - -1  - ~ - - @/usr/include/asm-generic/errno.h - -1 #iâdeà -_ASM_GENERIC_ERRNO_H - - -2  - #_ASM_GENERIC_ERRNO_H - - - ) - -4  - ~ - -6  - #EDEADLK - 35 - - ) - -7  - #ENAMETOOLONG - 36 - - ) - -8  - #ENOLCK - 37 - - ) - -9  - #ENOSYS - 38 - - ) - -10  - #ENOTEMPTY - 39 - - ) - -11  - #ELOOP - 40 - - ) - -12  - #EWOULDBLOCK - -EAGAIN - - - ) - -13  - #ENOMSG - 42 - - ) - -14  - #EIDRM - 43 - - ) - -15  - #ECHRNG - 44 - - ) - -16  - #EL2NSYNC - 45 - - ) - -17  - #EL3HLT - 46 - - ) - -18  - #EL3RST - 47 - - ) - -19  - #ELNRNG - 48 - - ) - -20  - #EUNATCH - 49 - - ) - -21  - #ENOCSI - 50 - - ) - -22  - #EL2HLT - 51 - - ) - -23  - #EBADE - 52 - - ) - -24  - #EBADR - 53 - - ) - -25  - #EXFULL - 54 - - ) - -26  - #ENOANO - 55 - - ) - -27  - #EBADRQC - 56 - - ) - -28  - #EBADSLT - 57 - - ) - -30  - #EDEADLOCK - -EDEADLK - - - ) - -32  - #EBFONT - 59 - - ) - -33  - #ENOSTR - 60 - - ) - -34  - #ENODATA - 61 - - ) - -35  - #ETIME - 62 - - ) - -36  - #ENOSR - 63 - - ) - -37  - #ENONET - 64 - - ) - -38  - #ENOPKG - 65 - - ) - -39  - #EREMOTE - 66 - - ) - -40  - #ENOLINK - 67 - - ) - -41  - #EADV - 68 - - ) - -42  - #ESRMNT - 69 - - ) - -43  - #ECOMM - 70 - - ) - -44  - #EPROTO - 71 - - ) - -45  - #EMULTIHOP - 72 - - ) - -46  - #EDOTDOT - 73 - - ) - -47  - #EBADMSG - 74 - - ) - -48  - #EOVERFLOW - 75 - - ) - -49  - #ENOTUNIQ - 76 - - ) - -50  - #EBADFD - 77 - - ) - -51  - #EREMCHG - 78 - - ) - -52  - #ELIBACC - 79 - - ) - -53  - #ELIBBAD - 80 - - ) - -54  - #ELIBSCN - 81 - - ) - -55  - #ELIBMAX - 82 - - ) - -56  - #ELIBEXEC - 83 - - ) - -57  - #EILSEQ - 84 - - ) - -58  - #ERESTART - 85 - - ) - -59  - #ESTRPIPE - 86 - - ) - -60  - #EUSERS - 87 - - ) - -61  - #ENOTSOCK - 88 - - ) - -62  - #EDESTADDRREQ - 89 - - ) - -63  - #EMSGSIZE - 90 - - ) - -64  - #EPROTOTYPE - 91 - - ) - -65  - #ENOPROTOOPT - 92 - - ) - -66  - #EPROTONOSUPPORT - 93 - - ) - -67  - #ESOCKTNOSUPPORT - 94 - - ) - -68  - #EOPNOTSUPP - 95 - - ) - -69  - #EPFNOSUPPORT - 96 - - ) - -70  - #EAFNOSUPPORT - 97 - - ) - -71  - #EADDRINUSE - 98 - - ) - -72  - #EADDRNOTAVAIL - 99 - - ) - -73  - #ENETDOWN - 100 - - ) - -74  - #ENETUNREACH - 101 - - ) - -75  - #ENETRESET - 102 - - ) - -76  - #ECONNABORTED - 103 - - ) - -77  - #ECONNRESET - 104 - - ) - -78  - #ENOBUFS - 105 - - ) - -79  - #EISCONN - 106 - - ) - -80  - #ENOTCONN - 107 - - ) - -81  - #ESHUTDOWN - 108 - - ) - -82  - #ETOOMANYREFS - 109 - - ) - -83  - #ETIMEDOUT - 110 - - ) - -84  - #ECONNREFUSED - 111 - - ) - -85  - #EHOSTDOWN - 112 - - ) - -86  - #EHOSTUNREACH - 113 - - ) - -87  - #EALREADY - 114 - - ) - -88  - #EINPROGRESS - 115 - - ) - -89  - #ESTALE - 116 - - ) - -90  - #EUCLEAN - 117 - - ) - -91  - #ENOTNAM - 118 - - ) - -92  - #ENAVAIL - 119 - - ) - -93  - #EISNAM - 120 - - ) - -94  - #EREMOTEIO - 121 - - ) - -95  - #EDQUOT - 122 - - ) - -97  - #ENOMEDIUM - 123 - - ) - -98  - #EMEDIUMTYPE - 124 - - ) - -99  - #ECANCELED - 125 - - ) - -100  - #ENOKEY - 126 - - ) - -101  - #EKEYEXPIRED - 127 - - ) - -102  - #EKEYREVOKED - 128 - - ) - -103  - #EKEYREJECTED - 129 - - ) - -106  - #EOWNERDEAD - 130 - - ) - -107  - #ENOTRECOVERABLE - 131 - - ) - -109  - #ERFKILL - 132 - - ) - - @/usr/include/asm-generic/errno-base.h - -1 #iâdeà -_ASM_GENERIC_ERRNO_BASE_H - - -2  - #_ASM_GENERIC_ERRNO_BASE_H - - - ) - -4  - #EPERM - 1 - - ) - -5  - #ENOENT - 2 - - ) - -6  - #ESRCH - 3 - - ) - -7  - #EINTR - 4 - - ) - -8  - #EIO - 5 - - ) - -9  - #ENXIO - 6 - - ) - -10  - #E2BIG - 7 - - ) - -11  - #ENOEXEC - 8 - - ) - -12  - #EBADF - 9 - - ) - -13  - #ECHILD - 10 - - ) - -14  - #EAGAIN - 11 - - ) - -15  - #ENOMEM - 12 - - ) - -16  - #EACCES - 13 - - ) - -17  - #EFAULT - 14 - - ) - -18  - #ENOTBLK - 15 - - ) - -19  - #EBUSY - 16 - - ) - -20  - #EEXIST - 17 - - ) - -21  - #EXDEV - 18 - - ) - -22  - #ENODEV - 19 - - ) - -23  - #ENOTDIR - 20 - - ) - -24  - #EISDIR - 21 - - ) - -25  - #EINVAL - 22 - - ) - -26  - #ENFILE - 23 - - ) - -27  - #EMFILE - 24 - - ) - -28  - #ENOTTY - 25 - - ) - -29  - #ETXTBSY - 26 - - ) - -30  - #EFBIG - 27 - - ) - -31  - #ENOSPC - 28 - - ) - -32  - #ESPIPE - 29 - - ) - -33  - #EROFS - 30 - - ) - -34  - #EMLINK - 31 - - ) - -35  - #EPIPE - 32 - - ) - -36  - #EDOM - 33 - - ) - -37  - #ERANGE - 34 - - ) - - @ -1 -. -1 -/usr/include -64 -1601 -CG.h -CG_outputBuilder.h -CG_outputRepr.h -CG_stringBuilder.h -CG_stringRepr.h -CG_suifBuilder.h -CG_suifRepr.h -code_gen.h -output_repr.h -/usr/include/stdio.h -/usr/include/bits/stdio-ldbl.h -/usr/include/bits/stdio.h -/usr/include/bits/stdio2.h -/usr/include/bits/stdio_lim.h -/usr/include/bits/sys_errlist.h -/usr/include/bits/types.h -/usr/include/features.h -/usr/include/getopt.h -/usr/include/libio.h -/usr/include/_G_config.h -/usr/include/bits/libio-ldbl.h -/usr/include/bits/predefs.h -/usr/include/bits/stdio-lock.h -/usr/include/bits/typesizes.h -/usr/include/bits/wordsize.h -/usr/include/ctype.h -/usr/include/gnu/stubs.h -/usr/include/sys/cdefs.h -/usr/include/bits/libc-lock.h -/usr/include/endian.h -/usr/include/gconv.h -/usr/include/gnu/stubs-32.h -/usr/include/gnu/stubs-64.h -/usr/include/wchar.h -/usr/include/xlocale.h -/usr/include/bits/byteswap.h -/usr/include/bits/endian.h -/usr/include/bits/wchar-ldbl.h -/usr/include/bits/wchar.h -/usr/include/bits/wchar2.h -/usr/include/errno.h -/usr/include/gnu/option-groups.h -/usr/include/pthread.h -/usr/include/wctype.h -/usr/include/bits/errno.h -/usr/include/bits/pthreadtypes.h -/usr/include/bits/setjmp.h -/usr/include/sched.h -/usr/include/signal.h -/usr/include/time.h -/usr/include/bits/sched.h -/usr/include/bits/sigaction.h -/usr/include/bits/sigcontext.h -/usr/include/bits/siginfo.h -/usr/include/bits/signum.h -/usr/include/bits/sigset.h -/usr/include/bits/sigstack.h -/usr/include/bits/sigthread.h -/usr/include/bits/time.h -/usr/include/linux/errno.h -/usr/include/sys/ucontext.h -/usr/include/asm/errno.h -/usr/include/asm-generic/errno.h -/usr/include/asm-generic/errno-base.h diff --git a/omega/code_gen/include/code_gen/output_repr.h b/omega/code_gen/include/code_gen/output_repr.h deleted file mode 100644 index 254e71b..0000000 --- a/omega/code_gen/include/code_gen/output_repr.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef OUTPUT_REPR_H -#define OUTPUT_REPR_H - -#include -#include -#include -#include -#include - -namespace omega { -extern int last_level; - -CG_outputRepr* outputIdent(CG_outputBuilder* ocg, const Relation &R, Variable_ID v, const std::vector &assigned_on_the_fly); -std::pair outputAssignment(CG_outputBuilder *ocg, const Relation &R_, Variable_ID v, Relation &enforced, CG_outputRepr *&if_repr, const std::vector &assigned_on_the_fly); -std::pair outputBounds(CG_outputBuilder* ocg, const Relation &bounds, Variable_ID v, int indent, Relation &enforced, const std::vector &assigned_on_the_fly); -Tuple outputSubstitution(CG_outputBuilder* ocg, const Relation &R, const std::vector &assigned_on_the_fly); -CG_outputRepr* outputStatement(CG_outputBuilder* ocg, CG_outputRepr *stmt, int indent, const Relation &mapping, const Relation &known, const std::vector &assigned_on_the_fly); -CG_outputRepr* outputGuard(CG_outputBuilder* ocg, const Relation &guards_in, const std::vector &assigned_on_the_fly); -CG_outputRepr* output_as_guard(CG_outputBuilder* ocg, const Relation &guards_in, Constraint_Handle e, bool is_equality, const std::vector &assigned_on_the_fly); -CG_outputRepr* output_EQ_strides(CG_outputBuilder* ocg, const Relation &guards_in, const std::vector &assigned_on_the_fly); -CG_outputRepr* output_GEQ_strides(CG_outputBuilder* ocg, const Relation &guards_in, const std::vector &assigned_on_the_fly); -CG_outputRepr *outputLBasRepr(CG_outputBuilder* ocg, const GEQ_Handle &g, Relation &bounds, Variable_ID v, coef_t stride, const EQ_Handle &strideEQ, Relation known, const std::vector &assigned_on_the_fly); -CG_outputRepr *outputUBasRepr(CG_outputBuilder* ocg, const GEQ_Handle &g, Relation & bounds, Variable_ID v, - coef_t /*stride*/, // currently unused - const EQ_Handle &/*strideEQ*/, - const std::vector &assigned_on_the_fly = std::vector(last_level, static_cast(NULL))); -CG_outputRepr* outputEasyBoundAsRepr(CG_outputBuilder* ocg, Relation &bounds, const Constraint_Handle &g, Variable_ID v, bool ignoreWC, int ceiling, const std::vector &assigned_on_the_fly); - - -bool boundHitsStride(const GEQ_Handle &g, Variable_ID v, const EQ_Handle &strideEQ, coef_t /*stride, currently unused*/, Relation known); -Relation greatest_common_step(const Tuple &I, const Tuple &active, int level, const Relation &known = Relation::Null()); -bool findFloorInequality(Relation &r, Variable_ID v, GEQ_Handle &h, Variable_ID excluded); -Relation project_onto_levels(Relation R, int last_level, bool wildcards); -bool isSimpleStride(const EQ_Handle &g, Variable_ID v); -int countStrides(Conjunct *c, Variable_ID v, EQ_Handle &strideEQ, bool &simple); -bool hasBound(Relation r, int level, int UB); -bool find_any_constraint(int s, int level, Relation &kr, int direction, Relation &S, bool approx); -bool has_nonstride_EQ(Relation r, int level); -Relation pickOverhead(Relation r, int liftTo); -Relation minMaxOverhead(Relation r, int level); -int max_fs_arity(const Constraint_Handle &c); - - -} - -#endif diff --git a/omega/code_gen/include/code_gen/rose_attributes.h b/omega/code_gen/include/code_gen/rose_attributes.h deleted file mode 100644 index 9766f52..0000000 --- a/omega/code_gen/include/code_gen/rose_attributes.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef ROSE_ATTRIBUTES_HH -#define ROSE_ATTRIBUTES_HH - -#include "rose.h" -#include -#include -#include - -namespace omega { - -class CodeInsertion; - -typedef std::vector CodeInsertionPtrList; -typedef std::vector::iterator CodeInsertionPtrListItr; - -class CodeInsertion { -public: - int loop_level; - bool marked; - CodeInsertion(int looplevel) { this->loop_level = looplevel; marked = false; } - ~CodeInsertion() {} - virtual SgStatement* getStatement(SgScopeStatement* scopeStmt = NULL) = 0; -}; - -class PragmaInsertion : public CodeInsertion { -private: - std::string name; -public: - PragmaInsertion(int loop_level, const std::string &pragma) : CodeInsertion(loop_level) { this->name = std::string(pragma); } - ~PragmaInsertion() { } - virtual SgStatement* getStatement(SgScopeStatement* scopeStmt = NULL); -}; - -class MMPrefetchInsertion : public CodeInsertion { -private: - std::string arrName; - std::vector indecies; - std::vector offsets; - int indexCount; - int cacheHint; - void initialize(const std::string& arrName, int hint); - void addDim(int offset); - void addDim(int offset, const std::string& indexer); - SgExpression* buildArrArg(SgScopeStatement* scopeStmt); - SgExpression* makeIndexExp(int dim, SgScopeStatement* scopeStmt); -public: - MMPrefetchInsertion(int loop_level, const std::string &arr, int hint) : CodeInsertion(loop_level) - { this->initialize(arr, hint); } - ~MMPrefetchInsertion() { } - virtual SgStatement* getStatement(SgScopeStatement* scopeStmt = NULL); -}; - -class CodeInsertionAttribute : public AstAttribute { -private: - std::vector code_insertions; -public: - CodeInsertionAttribute() { code_insertions = std::vector(); } - ~CodeInsertionAttribute() {} - - void add(CodeInsertion* ci) { code_insertions.push_back(ci); } - CodeInsertionPtrListItr begin() { return code_insertions.begin(); } - CodeInsertionPtrListItr end() { return code_insertions.end(); } - void remove(CodeInsertion* ci) { std::remove(code_insertions.begin(), code_insertions.end(), ci); } - int countCodeInsertions() { return code_insertions.size(); } -}; - -struct CodeInsertionMark { -public: - SgStatement* stmt; - CodeInsertion* ci; -}; - -class CodeInsertionVisitor : public AstPrePostProcessing { -private: - int loop_level; - std::vector ci_marks; - void markStmt(SgStatement* stmt, CodeInsertion* ci); -public: - void initialize(); - virtual void preOrderVisit(SgNode* n); - virtual void postOrderVisit(SgNode* n); - void insertCode(); -}; - -void postProcessRoseCodeInsertion(SgProject* proj); -void copyAttributes(SgNode* s, SgNode* d); -CodeInsertionAttribute* getOrCreateCodeInsertionAttribute(SgNode* node); - -} - -#endif diff --git a/omega/code_gen/obj/Makefile.am b/omega/code_gen/obj/Makefile.am deleted file mode 100644 index cd85b8b..0000000 --- a/omega/code_gen/obj/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ - -noinst_LIBRARIES =libcodegen.a - -libcodegen_a_SOURCES =../src/codegen.cc ../src/CG_stringBuilder.cc ../src/CG.cc ../src/CG_utils.cc -libcodegen_a_CFLAGS =-Wno-write-strings -libcodegen_a_CPPFLAGS =-I../include -I../../omega_lib/include -I$(ROSEHOME)/include -I$(BOOSTHOME)/include -#if BUILD_ROSE -libcodegen_a_SOURCES += ../src/rose_attributes.cc ../src/CG_roseRepr.cc ../src/CG_roseBuilder.cc -#endif - diff --git a/omega/code_gen/obj/Makefile.in b/omega/code_gen/obj/Makefile.in deleted file mode 100644 index 876e7e9..0000000 --- a/omega/code_gen/obj/Makefile.in +++ /dev/null @@ -1,671 +0,0 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -subdir = code_gen/obj -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/include/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -LIBRARIES = $(noinst_LIBRARIES) -ARFLAGS = cru -AM_V_AR = $(am__v_AR_@AM_V@) -am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) -am__v_AR_0 = @echo " AR " $@; -am__v_AR_1 = -libcodegen_a_AR = $(AR) $(ARFLAGS) -libcodegen_a_LIBADD = -am__dirstamp = $(am__leading_dot)dirstamp -am_libcodegen_a_OBJECTS = ../src/libcodegen_a-codegen.$(OBJEXT) \ - ../src/libcodegen_a-CG_stringBuilder.$(OBJEXT) \ - ../src/libcodegen_a-CG.$(OBJEXT) \ - ../src/libcodegen_a-CG_utils.$(OBJEXT) \ - ../src/libcodegen_a-rose_attributes.$(OBJEXT) \ - ../src/libcodegen_a-CG_roseRepr.$(OBJEXT) \ - ../src/libcodegen_a-CG_roseBuilder.$(OBJEXT) -libcodegen_a_OBJECTS = $(am_libcodegen_a_OBJECTS) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -AM_V_CXX = $(am__v_CXX_@AM_V@) -am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) -am__v_CXX_0 = @echo " CXX " $@; -am__v_CXX_1 = -CXXLD = $(CXX) -CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ - -o $@ -AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) -am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) -am__v_CXXLD_0 = @echo " CXXLD " $@; -am__v_CXXLD_1 = -SOURCES = $(libcodegen_a_SOURCES) -DIST_SOURCES = $(libcodegen_a_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BOOSTHOME = @BOOSTHOME@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CCLD = @CCLD@ -CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EXEEXT = @EXEEXT@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -ROSEHOME = @ROSEHOME@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -YACC = @YACC@ -YFLAGS = @YFLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build_alias = @build_alias@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host_alias = @host_alias@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -noinst_LIBRARIES = libcodegen.a -#if BUILD_ROSE -libcodegen_a_SOURCES = ../src/codegen.cc ../src/CG_stringBuilder.cc \ - ../src/CG.cc ../src/CG_utils.cc ../src/rose_attributes.cc \ - ../src/CG_roseRepr.cc ../src/CG_roseBuilder.cc -libcodegen_a_CFLAGS = -Wno-write-strings -libcodegen_a_CPPFLAGS = -I../include -I../../omega_lib/include -I$(ROSEHOME)/include/rose -I$(BOOSTHOME)/include -all: all-am - -.SUFFIXES: -.SUFFIXES: .cc .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign code_gen/obj/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign code_gen/obj/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -../src/$(am__dirstamp): - @$(MKDIR_P) ../src - @: > ../src/$(am__dirstamp) -../src/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) ../src/$(DEPDIR) - @: > ../src/$(DEPDIR)/$(am__dirstamp) -../src/libcodegen_a-codegen.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libcodegen_a-CG_stringBuilder.$(OBJEXT): \ - ../src/$(am__dirstamp) ../src/$(DEPDIR)/$(am__dirstamp) -../src/libcodegen_a-CG.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libcodegen_a-CG_utils.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libcodegen_a-rose_attributes.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libcodegen_a-CG_roseRepr.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libcodegen_a-CG_roseBuilder.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) - -libcodegen.a: $(libcodegen_a_OBJECTS) $(libcodegen_a_DEPENDENCIES) $(EXTRA_libcodegen_a_DEPENDENCIES) - $(AM_V_at)-rm -f libcodegen.a - $(AM_V_AR)$(libcodegen_a_AR) libcodegen.a $(libcodegen_a_OBJECTS) $(libcodegen_a_LIBADD) - $(AM_V_at)$(RANLIB) libcodegen.a - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -rm -f ../src/*.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libcodegen_a-CG.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libcodegen_a-CG_roseBuilder.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libcodegen_a-CG_roseRepr.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libcodegen_a-CG_stringBuilder.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libcodegen_a-CG_utils.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libcodegen_a-codegen.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libcodegen_a-rose_attributes.Po@am__quote@ - -.cc.o: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< - -.cc.obj: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -../src/libcodegen_a-codegen.o: ../src/codegen.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libcodegen_a-codegen.o -MD -MP -MF ../src/$(DEPDIR)/libcodegen_a-codegen.Tpo -c -o ../src/libcodegen_a-codegen.o `test -f '../src/codegen.cc' || echo '$(srcdir)/'`../src/codegen.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libcodegen_a-codegen.Tpo ../src/$(DEPDIR)/libcodegen_a-codegen.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/codegen.cc' object='../src/libcodegen_a-codegen.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libcodegen_a-codegen.o `test -f '../src/codegen.cc' || echo '$(srcdir)/'`../src/codegen.cc - -../src/libcodegen_a-codegen.obj: ../src/codegen.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libcodegen_a-codegen.obj -MD -MP -MF ../src/$(DEPDIR)/libcodegen_a-codegen.Tpo -c -o ../src/libcodegen_a-codegen.obj `if test -f '../src/codegen.cc'; then $(CYGPATH_W) '../src/codegen.cc'; else $(CYGPATH_W) '$(srcdir)/../src/codegen.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libcodegen_a-codegen.Tpo ../src/$(DEPDIR)/libcodegen_a-codegen.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/codegen.cc' object='../src/libcodegen_a-codegen.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libcodegen_a-codegen.obj `if test -f '../src/codegen.cc'; then $(CYGPATH_W) '../src/codegen.cc'; else $(CYGPATH_W) '$(srcdir)/../src/codegen.cc'; fi` - -../src/libcodegen_a-CG_stringBuilder.o: ../src/CG_stringBuilder.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libcodegen_a-CG_stringBuilder.o -MD -MP -MF ../src/$(DEPDIR)/libcodegen_a-CG_stringBuilder.Tpo -c -o ../src/libcodegen_a-CG_stringBuilder.o `test -f '../src/CG_stringBuilder.cc' || echo '$(srcdir)/'`../src/CG_stringBuilder.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libcodegen_a-CG_stringBuilder.Tpo ../src/$(DEPDIR)/libcodegen_a-CG_stringBuilder.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/CG_stringBuilder.cc' object='../src/libcodegen_a-CG_stringBuilder.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libcodegen_a-CG_stringBuilder.o `test -f '../src/CG_stringBuilder.cc' || echo '$(srcdir)/'`../src/CG_stringBuilder.cc - -../src/libcodegen_a-CG_stringBuilder.obj: ../src/CG_stringBuilder.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libcodegen_a-CG_stringBuilder.obj -MD -MP -MF ../src/$(DEPDIR)/libcodegen_a-CG_stringBuilder.Tpo -c -o ../src/libcodegen_a-CG_stringBuilder.obj `if test -f '../src/CG_stringBuilder.cc'; then $(CYGPATH_W) '../src/CG_stringBuilder.cc'; else $(CYGPATH_W) '$(srcdir)/../src/CG_stringBuilder.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libcodegen_a-CG_stringBuilder.Tpo ../src/$(DEPDIR)/libcodegen_a-CG_stringBuilder.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/CG_stringBuilder.cc' object='../src/libcodegen_a-CG_stringBuilder.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libcodegen_a-CG_stringBuilder.obj `if test -f '../src/CG_stringBuilder.cc'; then $(CYGPATH_W) '../src/CG_stringBuilder.cc'; else $(CYGPATH_W) '$(srcdir)/../src/CG_stringBuilder.cc'; fi` - -../src/libcodegen_a-CG.o: ../src/CG.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libcodegen_a-CG.o -MD -MP -MF ../src/$(DEPDIR)/libcodegen_a-CG.Tpo -c -o ../src/libcodegen_a-CG.o `test -f '../src/CG.cc' || echo '$(srcdir)/'`../src/CG.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libcodegen_a-CG.Tpo ../src/$(DEPDIR)/libcodegen_a-CG.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/CG.cc' object='../src/libcodegen_a-CG.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libcodegen_a-CG.o `test -f '../src/CG.cc' || echo '$(srcdir)/'`../src/CG.cc - -../src/libcodegen_a-CG.obj: ../src/CG.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libcodegen_a-CG.obj -MD -MP -MF ../src/$(DEPDIR)/libcodegen_a-CG.Tpo -c -o ../src/libcodegen_a-CG.obj `if test -f '../src/CG.cc'; then $(CYGPATH_W) '../src/CG.cc'; else $(CYGPATH_W) '$(srcdir)/../src/CG.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libcodegen_a-CG.Tpo ../src/$(DEPDIR)/libcodegen_a-CG.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/CG.cc' object='../src/libcodegen_a-CG.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libcodegen_a-CG.obj `if test -f '../src/CG.cc'; then $(CYGPATH_W) '../src/CG.cc'; else $(CYGPATH_W) '$(srcdir)/../src/CG.cc'; fi` - -../src/libcodegen_a-CG_utils.o: ../src/CG_utils.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libcodegen_a-CG_utils.o -MD -MP -MF ../src/$(DEPDIR)/libcodegen_a-CG_utils.Tpo -c -o ../src/libcodegen_a-CG_utils.o `test -f '../src/CG_utils.cc' || echo '$(srcdir)/'`../src/CG_utils.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libcodegen_a-CG_utils.Tpo ../src/$(DEPDIR)/libcodegen_a-CG_utils.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/CG_utils.cc' object='../src/libcodegen_a-CG_utils.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libcodegen_a-CG_utils.o `test -f '../src/CG_utils.cc' || echo '$(srcdir)/'`../src/CG_utils.cc - -../src/libcodegen_a-CG_utils.obj: ../src/CG_utils.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libcodegen_a-CG_utils.obj -MD -MP -MF ../src/$(DEPDIR)/libcodegen_a-CG_utils.Tpo -c -o ../src/libcodegen_a-CG_utils.obj `if test -f '../src/CG_utils.cc'; then $(CYGPATH_W) '../src/CG_utils.cc'; else $(CYGPATH_W) '$(srcdir)/../src/CG_utils.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libcodegen_a-CG_utils.Tpo ../src/$(DEPDIR)/libcodegen_a-CG_utils.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/CG_utils.cc' object='../src/libcodegen_a-CG_utils.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libcodegen_a-CG_utils.obj `if test -f '../src/CG_utils.cc'; then $(CYGPATH_W) '../src/CG_utils.cc'; else $(CYGPATH_W) '$(srcdir)/../src/CG_utils.cc'; fi` - -../src/libcodegen_a-rose_attributes.o: ../src/rose_attributes.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libcodegen_a-rose_attributes.o -MD -MP -MF ../src/$(DEPDIR)/libcodegen_a-rose_attributes.Tpo -c -o ../src/libcodegen_a-rose_attributes.o `test -f '../src/rose_attributes.cc' || echo '$(srcdir)/'`../src/rose_attributes.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libcodegen_a-rose_attributes.Tpo ../src/$(DEPDIR)/libcodegen_a-rose_attributes.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/rose_attributes.cc' object='../src/libcodegen_a-rose_attributes.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libcodegen_a-rose_attributes.o `test -f '../src/rose_attributes.cc' || echo '$(srcdir)/'`../src/rose_attributes.cc - -../src/libcodegen_a-rose_attributes.obj: ../src/rose_attributes.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libcodegen_a-rose_attributes.obj -MD -MP -MF ../src/$(DEPDIR)/libcodegen_a-rose_attributes.Tpo -c -o ../src/libcodegen_a-rose_attributes.obj `if test -f '../src/rose_attributes.cc'; then $(CYGPATH_W) '../src/rose_attributes.cc'; else $(CYGPATH_W) '$(srcdir)/../src/rose_attributes.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libcodegen_a-rose_attributes.Tpo ../src/$(DEPDIR)/libcodegen_a-rose_attributes.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/rose_attributes.cc' object='../src/libcodegen_a-rose_attributes.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libcodegen_a-rose_attributes.obj `if test -f '../src/rose_attributes.cc'; then $(CYGPATH_W) '../src/rose_attributes.cc'; else $(CYGPATH_W) '$(srcdir)/../src/rose_attributes.cc'; fi` - -../src/libcodegen_a-CG_roseRepr.o: ../src/CG_roseRepr.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libcodegen_a-CG_roseRepr.o -MD -MP -MF ../src/$(DEPDIR)/libcodegen_a-CG_roseRepr.Tpo -c -o ../src/libcodegen_a-CG_roseRepr.o `test -f '../src/CG_roseRepr.cc' || echo '$(srcdir)/'`../src/CG_roseRepr.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libcodegen_a-CG_roseRepr.Tpo ../src/$(DEPDIR)/libcodegen_a-CG_roseRepr.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/CG_roseRepr.cc' object='../src/libcodegen_a-CG_roseRepr.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libcodegen_a-CG_roseRepr.o `test -f '../src/CG_roseRepr.cc' || echo '$(srcdir)/'`../src/CG_roseRepr.cc - -../src/libcodegen_a-CG_roseRepr.obj: ../src/CG_roseRepr.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libcodegen_a-CG_roseRepr.obj -MD -MP -MF ../src/$(DEPDIR)/libcodegen_a-CG_roseRepr.Tpo -c -o ../src/libcodegen_a-CG_roseRepr.obj `if test -f '../src/CG_roseRepr.cc'; then $(CYGPATH_W) '../src/CG_roseRepr.cc'; else $(CYGPATH_W) '$(srcdir)/../src/CG_roseRepr.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libcodegen_a-CG_roseRepr.Tpo ../src/$(DEPDIR)/libcodegen_a-CG_roseRepr.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/CG_roseRepr.cc' object='../src/libcodegen_a-CG_roseRepr.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libcodegen_a-CG_roseRepr.obj `if test -f '../src/CG_roseRepr.cc'; then $(CYGPATH_W) '../src/CG_roseRepr.cc'; else $(CYGPATH_W) '$(srcdir)/../src/CG_roseRepr.cc'; fi` - -../src/libcodegen_a-CG_roseBuilder.o: ../src/CG_roseBuilder.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libcodegen_a-CG_roseBuilder.o -MD -MP -MF ../src/$(DEPDIR)/libcodegen_a-CG_roseBuilder.Tpo -c -o ../src/libcodegen_a-CG_roseBuilder.o `test -f '../src/CG_roseBuilder.cc' || echo '$(srcdir)/'`../src/CG_roseBuilder.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libcodegen_a-CG_roseBuilder.Tpo ../src/$(DEPDIR)/libcodegen_a-CG_roseBuilder.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/CG_roseBuilder.cc' object='../src/libcodegen_a-CG_roseBuilder.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libcodegen_a-CG_roseBuilder.o `test -f '../src/CG_roseBuilder.cc' || echo '$(srcdir)/'`../src/CG_roseBuilder.cc - -../src/libcodegen_a-CG_roseBuilder.obj: ../src/CG_roseBuilder.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libcodegen_a-CG_roseBuilder.obj -MD -MP -MF ../src/$(DEPDIR)/libcodegen_a-CG_roseBuilder.Tpo -c -o ../src/libcodegen_a-CG_roseBuilder.obj `if test -f '../src/CG_roseBuilder.cc'; then $(CYGPATH_W) '../src/CG_roseBuilder.cc'; else $(CYGPATH_W) '$(srcdir)/../src/CG_roseBuilder.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libcodegen_a-CG_roseBuilder.Tpo ../src/$(DEPDIR)/libcodegen_a-CG_roseBuilder.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/CG_roseBuilder.cc' object='../src/libcodegen_a-CG_roseBuilder.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcodegen_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libcodegen_a-CG_roseBuilder.obj `if test -f '../src/CG_roseBuilder.cc'; then $(CYGPATH_W) '../src/CG_roseBuilder.cc'; else $(CYGPATH_W) '$(srcdir)/../src/CG_roseBuilder.cc'; fi` - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LIBRARIES) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -rm -f ../src/$(DEPDIR)/$(am__dirstamp) - -rm -f ../src/$(am__dirstamp) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ../src/$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ../src/$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-noinstLIBRARIES cscopelist-am ctags ctags-am distclean \ - distclean-compile distclean-generic distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ - uninstall-am - -#endif - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/omega/code_gen/src/CG.cc b/omega/code_gen/src/CG.cc deleted file mode 100644 index 42bd172..0000000 --- a/omega/code_gen/src/CG.cc +++ /dev/null @@ -1,1163 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 the Omega Project Team - Copyright (C) 2005-2011 Chun Chen - All Rights Reserved. - - Purpose: - CG node classes, used to build AST tree from polyhedra scanning. - - Notes: - Parameter "restriction" is always tighter than "known" since CG_split - node does not correspond to any code for enforcement. This property is - destroyed after hoistGuard since "restriction" is not used anymore. - CG node's children are guaranteed not to be NULL, either NULL child is - removed from the children or the parent node itself becomes NULL. - - History: - 04/20/96 printRepr added by D people. Lei Zhou - 10/24/06 hoistGuard added by chun - 08/03/10 collect CG classes into one place, by Chun Chen - 08/04/10 track dynamically substituted variables in printRepr, by chun - 04/02/11 rewrite the CG node classes, by chun - *****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace omega { - -extern std::vector > smtNonSplitLevels; -extern std::vector > loopIdxNames; //per stmt -extern std::vector > syncs; - -extern int checkLoopLevel; -extern int stmtForLoopCheck; -extern int upperBoundForLevel; -extern int lowerBoundForLevel; -extern bool fillInBounds; - -//----------------------------------------------------------------------------- -// Class: CG_result -//----------------------------------------------------------------------------- - -CG_outputRepr *CG_result::printRepr(CG_outputBuilder *ocg, - const std::vector &stmts) const { - return printRepr(1, ocg, stmts, - std::vector >(num_level(), - std::make_pair(static_cast(NULL), 0))); -} - -std::string CG_result::printString() const { - CG_stringBuilder ocg; - std::vector stmts(codegen_->xforms_.size()); - for (int i = 0; i < stmts.size(); i++) - stmts[i] = new CG_stringRepr("s" + to_string(i)); - CG_stringRepr *repr = static_cast(printRepr(&ocg, stmts)); - for (int i = 0; i < stmts.size(); i++) - delete stmts[i]; - - if (repr != NULL) { - std::string s = repr->GetString(); - delete repr; - return s; - } else - return std::string(); -} - -int CG_result::num_level() const { - return codegen_->num_level(); -} - -//----------------------------------------------------------------------------- -// Class: CG_split -//----------------------------------------------------------------------------- - -CG_result *CG_split::recompute(const BoolSet<> &parent_active, - const Relation &known, const Relation &restriction) { - active_ &= parent_active; - if (active_.empty()) { - delete this; - return NULL; - } - - - int i = 0; - while (i < restrictions_.size()) { - Relation new_restriction = Intersection(copy(restrictions_[i]), - copy(restriction)); - - new_restriction.simplify(2, 4); - //new_restriction.simplify(); - clauses_[i] = clauses_[i]->recompute(active_, copy(known), - new_restriction); - if (clauses_[i] == NULL) { - restrictions_.erase(restrictions_.begin() + i); - clauses_.erase(clauses_.begin() + i); - } else - i++; - } - - - if (restrictions_.size() == 0) { - delete this; - return NULL; - } else - return this; -} - -int CG_split::populateDepth() { - int max_depth = 0; - for (int i = 0; i < clauses_.size(); i++) { - int t = clauses_[i]->populateDepth(); - if (t > max_depth) - max_depth = t; - } - return max_depth; -} - -std::pair CG_split::liftOverhead(int depth, - bool propagate_up) { - for (int i = 0; i < clauses_.size();) { - std::pair result = clauses_[i]->liftOverhead( - depth, propagate_up); - if (result.first == NULL) - clauses_.erase(clauses_.begin() + i); - else { - clauses_[i] = result.first; - if (!result.second.is_obvious_tautology()) - return std::make_pair(this, result.second); - i++; - } - - } - - if (clauses_.size() == 0) { - delete this; - return std::make_pair(static_cast(NULL), - Relation::True(num_level())); - } else - return std::make_pair(this, Relation::True(num_level())); -} - -Relation CG_split::hoistGuard() { - std::vector guards; - for (int i = 0; i < clauses_.size(); i++) - guards.push_back(clauses_[i]->hoistGuard()); - - return SimpleHull(guards, true, true); -} - -void CG_split::removeGuard(const Relation &guard) { - for (int i = 0; i < clauses_.size(); i++) - clauses_[i]->removeGuard(guard); -} - -std::vector CG_split::findNextLevel() const { - std::vector result; - for (int i = 0; i < clauses_.size(); i++) { - CG_split *splt = dynamic_cast(clauses_[i]); - if (splt != NULL) { - std::vector t = splt->findNextLevel(); - result.insert(result.end(), t.begin(), t.end()); - } else - result.push_back(clauses_[i]); - } - - return result; -} - -CG_outputRepr *CG_split::printRepr(int indent, CG_outputBuilder *ocg, - const std::vector &stmts, - const std::vector > &assigned_on_the_fly) const { - CG_outputRepr *stmtList = NULL; - std::vector next_level = findNextLevel(); - - std::vector cur_loops; - for (int i = 0; i < next_level.size(); i++) { - CG_loop *lp = dynamic_cast(next_level[i]); - if (lp != NULL) { - cur_loops.push_back(lp); - } else { - stmtList = ocg->StmtListAppend(stmtList, - loop_print_repr(cur_loops, 0, cur_loops.size(), - Relation::True(num_level()), NULL, indent, ocg, - stmts, assigned_on_the_fly)); - stmtList = ocg->StmtListAppend(stmtList, - next_level[i]->printRepr(indent, ocg, stmts, - assigned_on_the_fly)); - cur_loops.clear(); - } - } - - stmtList = ocg->StmtListAppend(stmtList, - loop_print_repr(cur_loops, 0, cur_loops.size(), - Relation::True(num_level()), NULL, indent, ocg, stmts, - assigned_on_the_fly)); - return stmtList; -} - -CG_result *CG_split::clone() const { - std::vector clauses(clauses_.size()); - for (int i = 0; i < clauses_.size(); i++) - clauses[i] = clauses_[i]->clone(); - return new CG_split(codegen_, active_, restrictions_, clauses); -} - -void CG_split::dump(int indent) const { - std::string prefix; - for (int i = 0; i < indent; i++) - prefix += " "; - std::cout << prefix << "SPLIT: " << active_ << std::endl; - for (int i = 0; i < restrictions_.size(); i++) { - std::cout << prefix << "restriction: "; - const_cast(this)->restrictions_[i].print(); - clauses_[i]->dump(indent + 1); - } - -} - -//----------------------------------------------------------------------------- -// Class: CG_loop -//----------------------------------------------------------------------------- - -CG_result *CG_loop::recompute(const BoolSet<> &parent_active, - const Relation &known, const Relation &restriction) { - known_ = copy(known); - restriction_ = copy(restriction); - active_ &= parent_active; - - std::vector Rs; - for (BoolSet<>::iterator i = active_.begin(); i != active_.end(); i++) { - Relation r = Intersection(copy(restriction), - copy(codegen_->projected_IS_[level_ - 1][*i])); - - //r.simplify(2, 4); - r.simplify(); - if (!r.is_upper_bound_satisfiable()) { - active_.unset(*i); - continue; - } - Rs.push_back(copy(r)); - } - - if (active_.empty()) { - delete this; - return NULL; - } - - Relation hull = SimpleHull(Rs, true, true); - - //hull.simplify(2,4); - - // check if actual loop is needed - std::pair result = find_simplest_assignment(hull, - hull.set_var(level_)); - if (result.second < INT_MAX) { - needLoop_ = false; - - bounds_ = Relation(hull.n_set()); - F_Exists *f_exists = bounds_.add_and()->add_exists(); - F_And *f_root = f_exists->add_and(); - std::map exists_mapping; - EQ_Handle h = f_root->add_EQ(); - for (Constr_Vars_Iter cvi(result.first); cvi; cvi++) { - Variable_ID v = cvi.curr_var(); - switch (v->kind()) { - case Input_Var: - h.update_coef(bounds_.input_var(v->get_position()), - cvi.curr_coef()); - break; - case Wildcard_Var: { - Variable_ID v2 = replicate_floor_definition(hull, v, bounds_, - f_exists, f_root, exists_mapping); - h.update_coef(v2, cvi.curr_coef()); - break; - } - case Global_Var: { - Global_Var_ID g = v->get_global_var(); - Variable_ID v2; - if (g->arity() == 0) - v2 = bounds_.get_local(g); - else - v2 = bounds_.get_local(g, v->function_of()); - h.update_coef(v2, cvi.curr_coef()); - break; - } - default: - assert(false); - } - } - h.update_const(result.first.get_const()); - bounds_.simplify(); - } - // loop iterates more than once, extract bounds now - else { - needLoop_ = true; - - bounds_ = Relation(hull.n_set()); - F_Exists *f_exists = bounds_.add_and()->add_exists(); - F_And *f_root = f_exists->add_and(); - std::map exists_mapping; - - Relation b = Gist(copy(hull), copy(known), 1); - bool has_unresolved_bound = false; - - std::set excluded_floor_vars; - excluded_floor_vars.insert(b.set_var(level_)); - for (GEQ_Iterator e(b.single_conjunct()->GEQs()); e; e++) - if ((*e).get_coef(b.set_var(level_)) != 0) { - bool is_bound = true; - for (Constr_Vars_Iter cvi(*e, true); cvi; cvi++) { - std::pair result = find_floor_definition( - b, cvi.curr_var(), excluded_floor_vars); - if (!result.first) { - is_bound = false; - has_unresolved_bound = true; - break; - } - } - - if (!is_bound) - continue; - - GEQ_Handle h = f_root->add_GEQ(); - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) { - Variable_ID v = cvi.curr_var(); - switch (v->kind()) { - case Input_Var: - h.update_coef(bounds_.input_var(v->get_position()), - cvi.curr_coef()); - break; - case Wildcard_Var: { - Variable_ID v2 = replicate_floor_definition(b, v, - bounds_, f_exists, f_root, exists_mapping); - h.update_coef(v2, cvi.curr_coef()); - break; - } - case Global_Var: { - Global_Var_ID g = v->get_global_var(); - Variable_ID v2; - if (g->arity() == 0) - v2 = bounds_.get_local(g); - else - v2 = bounds_.get_local(g, v->function_of()); - h.update_coef(v2, cvi.curr_coef()); - break; - } - default: - assert(false); - } - } - h.update_const((*e).get_const()); - } - - if (has_unresolved_bound) { - b = Approximate(b); - b.simplify(2, 4); - //Simplification of Hull - hull = Approximate(hull); - hull.simplify(2, 4); - //end : Anand - for (GEQ_Iterator e(b.single_conjunct()->GEQs()); e; e++) - if ((*e).get_coef(b.set_var(level_)) != 0) - f_root->add_GEQ(*e); - } - bounds_.simplify(); - hull.simplify(2,4); - // Since current SimpleHull does not support max() upper bound or min() lower bound, - // we have to forcefully split the loop when hull approximation does not return any bound. - bool has_lb = false; - bool has_ub = false; - for (GEQ_Iterator e = bounds_.single_conjunct()->GEQs(); e; e++) { - if ((*e).get_coef(bounds_.set_var(level_)) > 0) - has_lb = true; - else if ((*e).get_coef(bounds_.set_var(level_)) < 0) - has_ub = true; - if (has_lb && has_ub) - break; - } - - if (!has_lb) { - for (int i = 0; i < Rs.size(); i++) { - Relation r = Approximate(copy(Rs[i])); - r.simplify(2, 4); - for (GEQ_Iterator e = r.single_conjunct()->GEQs(); e; e++) - if ((*e).get_coef(r.input_var(level_)) > 0) { - Relation r2 = Relation::True(num_level()); - r2.and_with_GEQ(*e); - r2.simplify(); - std::vector restrictions(2); - restrictions[0] = Complement(copy(r2)); - restrictions[0].simplify(); - restrictions[1] = r2; - std::vector clauses(2); - clauses[0] = this; - clauses[1] = this->clone(); - CG_result *cgr = new CG_split(codegen_, active_, - restrictions, clauses); - cgr = cgr->recompute(active_, copy(known), - copy(restriction)); - return cgr; - } - } - for (int i = 0; i < Rs.size(); i++) { - Relation r = Approximate(copy(Rs[i])); - r.simplify(2, 4); - for (EQ_Iterator e = r.single_conjunct()->EQs(); e; e++) - if ((*e).get_coef(r.input_var(level_)) != 0) { - Relation r2 = Relation::True(num_level()); - r2.and_with_GEQ(*e); - r2.simplify(); - std::vector restrictions(2); - if ((*e).get_coef(r.input_var(level_)) > 0) { - restrictions[0] = Complement(copy(r2)); - restrictions[0].simplify(); - restrictions[1] = r2; - } else { - restrictions[0] = r2; - restrictions[1] = Complement(copy(r2)); - restrictions[1].simplify(); - } - std::vector clauses(2); - clauses[0] = this; - clauses[1] = this->clone(); - CG_result *cgr = new CG_split(codegen_, active_, - restrictions, clauses); - cgr = cgr->recompute(active_, copy(known), - copy(restriction)); - return cgr; - } - } - } else if (!has_ub) { - for (int i = 0; i < Rs.size(); i++) { - Relation r = Approximate(copy(Rs[i])); - r.simplify(2, 4); - for (GEQ_Iterator e = r.single_conjunct()->GEQs(); e; e++) - if ((*e).get_coef(r.input_var(level_)) < 0) { - Relation r2 = Relation::True(num_level()); - r2.and_with_GEQ(*e); - r2.simplify(); - std::vector restrictions(2); - restrictions[1] = Complement(copy(r2)); - restrictions[1].simplify(); - restrictions[0] = r2; - std::vector clauses(2); - clauses[0] = this; - clauses[1] = this->clone(); - CG_result *cgr = new CG_split(codegen_, active_, - restrictions, clauses); - cgr = cgr->recompute(active_, copy(known), - copy(restriction)); - return cgr; - } - } - for (int i = 0; i < Rs.size(); i++) { - Relation r = Approximate(copy(Rs[i])); - r.simplify(2, 4); - for (EQ_Iterator e = r.single_conjunct()->EQs(); e; e++) - if ((*e).get_coef(r.input_var(level_)) != 0) { - Relation r2 = Relation::True(num_level()); - r2.and_with_GEQ(*e); - r2.simplify(); - std::vector restrictions(2); - if ((*e).get_coef(r.input_var(level_)) > 0) { - restrictions[0] = Complement(copy(r2)); - restrictions[0].simplify(); - restrictions[1] = r2; - } else { - restrictions[0] = r2; - restrictions[1] = Complement(copy(r2)); - restrictions[1].simplify(); - } - std::vector clauses(2); - clauses[0] = this; - clauses[1] = this->clone(); - CG_result *cgr = new CG_split(codegen_, active_, - restrictions, clauses); - cgr = cgr->recompute(active_, copy(known), - copy(restriction)); - return cgr; - } - } - } - - if (!has_lb && !has_ub) - throw codegen_error( - "can't find any bound at loop level " + to_string(level_)); - else if (!has_lb) - throw codegen_error( - "can't find lower bound at loop level " - + to_string(level_)); - else if (!has_ub) - throw codegen_error( - "can't find upper bound at loop level " - + to_string(level_)); - } - bounds_.copy_names(hull); - bounds_.setup_names(); - - // additional guard/stride condition extraction - if (needLoop_) { - Relation cur_known = Intersection(copy(bounds_), copy(known_)); - cur_known.simplify(); - hull = Gist(hull, copy(cur_known), 1); - - std::pair result = find_simplest_stride(hull, - hull.set_var(level_)); - if (result.second != NULL) - if (abs(result.first.get_coef(hull.set_var(level_))) == 1) { - F_Exists *f_exists = bounds_.and_with_and()->add_exists(); - F_And *f_root = f_exists->add_and(); - std::map exists_mapping; - EQ_Handle h = f_root->add_EQ(); - for (Constr_Vars_Iter cvi(result.first); cvi; cvi++) { - Variable_ID v = cvi.curr_var(); - switch (v->kind()) { - case Input_Var: - h.update_coef(bounds_.input_var(v->get_position()), - cvi.curr_coef()); - break; - case Wildcard_Var: { - Variable_ID v2; - if (v == result.second) - v2 = f_exists->declare(); - else - v2 = replicate_floor_definition(hull, v, bounds_, - f_exists, f_root, exists_mapping); - h.update_coef(v2, cvi.curr_coef()); - break; - } - case Global_Var: { - Global_Var_ID g = v->get_global_var(); - Variable_ID v2; - if (g->arity() == 0) - v2 = bounds_.get_local(g); - else - v2 = bounds_.get_local(g, v->function_of()); - h.update_coef(v2, cvi.curr_coef()); - break; - } - default: - assert(false); - } - } - h.update_const(result.first.get_const()); - } else { - // since gist is not powerful enough on modular constraints for now, - // make an educated guess - coef_t stride = abs(result.first.get_coef(result.second)) - / gcd(abs(result.first.get_coef(result.second)), - abs( - result.first.get_coef( - hull.set_var(level_)))); - - Relation r1(hull.n_inp()); - F_Exists *f_exists = r1.add_and()->add_exists(); - F_And *f_root = f_exists->add_and(); - std::map exists_mapping; - EQ_Handle h = f_root->add_EQ(); - for (Constr_Vars_Iter cvi(result.first); cvi; cvi++) { - Variable_ID v = cvi.curr_var(); - switch (v->kind()) { - case Input_Var: - h.update_coef(r1.input_var(v->get_position()), - cvi.curr_coef()); - break; - case Wildcard_Var: { - Variable_ID v2; - if (v == result.second) - v2 = f_exists->declare(); - else - v2 = replicate_floor_definition(hull, v, r1, - f_exists, f_root, exists_mapping); - h.update_coef(v2, cvi.curr_coef()); - break; - } - case Global_Var: { - Global_Var_ID g = v->get_global_var(); - Variable_ID v2; - if (g->arity() == 0) - v2 = r1.get_local(g); - else - v2 = r1.get_local(g, v->function_of()); - h.update_coef(v2, cvi.curr_coef()); - break; - } - default: - assert(false); - } - } - h.update_const(result.first.get_const()); - r1.simplify(); - - bool guess_success = false; - for (GEQ_Iterator e(bounds_.single_conjunct()->GEQs()); e; e++) - if ((*e).get_coef(bounds_.set_var(level_)) == 1) { - Relation r2(hull.n_inp()); - F_Exists *f_exists = r2.add_and()->add_exists(); - F_And *f_root = f_exists->add_and(); - std::map exists_mapping; - EQ_Handle h = f_root->add_EQ(); - h.update_coef(f_exists->declare(), stride); - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) { - Variable_ID v = cvi.curr_var(); - switch (v->kind()) { - case Input_Var: - h.update_coef(r2.input_var(v->get_position()), - cvi.curr_coef()); - break; - case Wildcard_Var: { - Variable_ID v2 = replicate_floor_definition( - hull, v, r2, f_exists, f_root, - exists_mapping); - h.update_coef(v2, cvi.curr_coef()); - break; - } - case Global_Var: { - Global_Var_ID g = v->get_global_var(); - Variable_ID v2; - if (g->arity() == 0) - v2 = r2.get_local(g); - else - v2 = r2.get_local(g, v->function_of()); - h.update_coef(v2, cvi.curr_coef()); - break; - } - default: - assert(false); - } - } - h.update_const((*e).get_const()); - r2.simplify(); - - if (Gist(copy(r1), - Intersection(copy(cur_known), copy(r2)), 1).is_obvious_tautology() - && Gist(copy(r2), - Intersection(copy(cur_known), copy(r1)), - 1).is_obvious_tautology()) { - bounds_ = Intersection(bounds_, r2); - bounds_.simplify(); - guess_success = true; - break; - } - } - - // this is really a stride with non-unit coefficient for this loop variable - if (!guess_success) { - // TODO: for stride ax = b mod n it might be beneficial to - // generate modular linear equation solver code for - // runtime to get the starting position in printRepr, - // and stride would be n/gcd(|a|,n), thus this stride - // can be put into bounds_ too. - } - - } - - hull = Project(hull, hull.set_var(level_)); - hull.simplify(2, 4); - guard_ = Gist(hull, Intersection(copy(bounds_), copy(known_)), 1); - } - // don't generate guard for non-actual loop, postpone it. otherwise - // redundant if-conditions might be generated since for-loop semantics - // includes implicit comparison checking. -- by chun 09/14/10 - else - guard_ = Relation::True(num_level()); - guard_.copy_names(bounds_); - guard_.setup_names(); - - //guard_.simplify(); - // recursively down the AST - Relation new_known = Intersection(copy(known), - Intersection(copy(bounds_), copy(guard_))); - new_known.simplify(2, 4); - Relation new_restriction = Intersection(copy(restriction), - Intersection(copy(bounds_), copy(guard_))); - new_restriction.simplify(2, 4); - body_ = body_->recompute(active_, new_known, new_restriction); - if (body_ == NULL) { - delete this; - return NULL; - } else - return this; -} - -int CG_loop::populateDepth() { - int depth = body_->populateDepth(); - if (needLoop_) - depth_ = depth + 1; - else - depth_ = depth; - return depth_; -} - -std::pair CG_loop::liftOverhead(int depth, - bool propagate_up) { - if (depth_ > depth) { - assert(propagate_up == false); - std::pair result = body_->liftOverhead(depth, - false); - body_ = result.first; - return std::make_pair(this, Relation::True(num_level())); - } else { // (depth_ <= depth) - if (propagate_up) { - Relation r = pick_one_guard(guard_, level_); - if (!r.is_obvious_tautology()) - return std::make_pair(this, r); - } - - std::pair result; - if (propagate_up || needLoop_) - result = body_->liftOverhead(depth, true); - else - result = body_->liftOverhead(depth, false); - body_ = result.first; - if (result.second.is_obvious_tautology()) - return std::make_pair(this, result.second); - - // loop is an assignment, replace this loop variable in overhead condition - if (!needLoop_) { - result.second = Intersection(result.second, copy(bounds_)); - result.second = Project(result.second, - result.second.set_var(level_)); - result.second.simplify(2, 4); - } - - - int max_level = 0; - bool has_wildcard = false; - bool direction = true; - for (EQ_Iterator e(result.second.single_conjunct()->EQs()); e; e++) - if ((*e).has_wildcards()) { - if (has_wildcard) - assert(false); - else - has_wildcard = true; - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) - if (cvi.curr_var()->kind() == Input_Var - && cvi.curr_var()->get_position() > max_level) - max_level = cvi.curr_var()->get_position(); - } else - assert(false); - - if (!has_wildcard) { - int num_simple_geq = 0; - for (GEQ_Iterator e(result.second.single_conjunct()->GEQs()); e; - e++) - if (!(*e).has_wildcards()) { - num_simple_geq++; - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) - if (cvi.curr_var()->kind() == Input_Var - && cvi.curr_var()->get_position() > max_level) { - max_level = cvi.curr_var()->get_position(); - direction = (cvi.curr_coef() < 0) ? true : false; - } - } else { - has_wildcard = true; - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) - if (cvi.curr_var()->kind() == Input_Var - && cvi.curr_var()->get_position() > max_level) { - max_level = cvi.curr_var()->get_position(); - } - } - assert( - (has_wildcard && num_simple_geq == 0) || (!has_wildcard && num_simple_geq == 1)); - } - - // check if this is the top loop level for splitting for this overhead - if (!propagate_up || (has_wildcard && max_level == level_ - 1) - || (!has_wildcard && max_level == level_)) { - std::vector restrictions(2); - std::vector clauses(2); - int saved_num_level = num_level(); - if (has_wildcard || direction) { - restrictions[1] = Complement(copy(result.second)); - restrictions[1].simplify(); - clauses[1] = this->clone(); - restrictions[0] = result.second; - clauses[0] = this; - } else { - restrictions[0] = Complement(copy(result.second)); - restrictions[0].simplify(); - clauses[0] = this->clone(); - restrictions[1] = result.second; - clauses[1] = this; - } - CG_result *cgr = new CG_split(codegen_, active_, restrictions, - clauses); - CG_result *new_cgr = cgr->recompute(active_, copy(known_), - copy(restriction_)); - new_cgr->populateDepth(); - assert(new_cgr==cgr); - if (static_cast(new_cgr)->clauses_.size() == 1) - // infinite recursion detected, bail out - return std::make_pair(new_cgr, Relation::True(saved_num_level)); - else - return cgr->liftOverhead(depth, propagate_up); - } else - return std::make_pair(this, result.second); - } -} - -Relation CG_loop::hoistGuard() { - - Relation r = body_->hoistGuard(); - - // TODO: should bookkeep catched contraints in loop output as enforced and check if anything missing - // if (!Gist(copy(b), copy(enforced)).is_obvious_tautology()) { - // fprintf(stderr, "need to generate extra guard inside the loop\n"); - // } - - if (!needLoop_) - r = Intersection(r, copy(bounds_)); - r = Project(r, r.set_var(level_)); - r = Gist(r, copy(known_), 1); - - Relation eliminate_existentials_r; - Relation eliminate_existentials_known; - - eliminate_existentials_r = copy(r); - if (!r.is_obvious_tautology()) { - eliminate_existentials_r = Approximate(copy(r)); - eliminate_existentials_r.simplify(2,4); - eliminate_existentials_known = Approximate(copy(known_)); - eliminate_existentials_known.simplify(2,4); - - eliminate_existentials_r = Gist( eliminate_existentials_r, eliminate_existentials_known, 1); - } - - - if (!eliminate_existentials_r.is_obvious_tautology()) { - // if (!r.is_obvious_tautology()) { - body_->removeGuard(r); - guard_ = Intersection(guard_, copy(r)); - guard_.simplify(); - } - - return guard_; - - // return ifList; - // } - - -} - -void CG_loop::removeGuard(const Relation &guard) { - known_ = Intersection(known_, copy(guard)); - known_.simplify(); - - guard_ = Gist(guard_, copy(known_), 1); - guard_.copy_names(known_); - guard_.setup_names(); -} - -CG_outputRepr *CG_loop::printRepr(int indent, CG_outputBuilder *ocg, - const std::vector &stmts, - const std::vector > &assigned_on_the_fly) const { - return printRepr(true, indent, ocg, stmts, assigned_on_the_fly); -} - -CG_outputRepr *CG_loop::printRepr(bool do_print_guard, int indent, - CG_outputBuilder *ocg, const std::vector &stmts, - const std::vector > &assigned_on_the_fly) const { - CG_outputRepr *guardRepr; - if (do_print_guard) - guardRepr = output_guard(ocg, guard_, assigned_on_the_fly); - else - guardRepr = NULL; - - Relation cur_known = Intersection(copy(known_), copy(guard_)); - cur_known.simplify(); - if (needLoop_) { - - if (checkLoopLevel) - if (level_ == checkLoopLevel) - if (active_.get(stmtForLoopCheck)) - fillInBounds = true; - - CG_outputRepr *ctrlRepr = output_loop(ocg, bounds_, level_, cur_known, - assigned_on_the_fly); - - fillInBounds = false; - - CG_outputRepr *bodyRepr = body_->printRepr( - (guardRepr == NULL) ? indent + 1 : indent + 2, ocg, stmts, - assigned_on_the_fly); - CG_outputRepr * loopRepr; - - if (guardRepr == NULL) - loopRepr = ocg->CreateLoop(indent, ctrlRepr, bodyRepr); - else - loopRepr = ocg->CreateLoop(indent + 1, ctrlRepr, bodyRepr); - - if (!smtNonSplitLevels.empty()) { - bool blockLoop = false; - bool threadLoop = false; - bool sync = false; - int firstActiveStmt = -1; - for (int s = 0; s < active_.size(); s++) { - if (active_.get(s)) { - if (firstActiveStmt < 0) - firstActiveStmt = s; - //We assume smtNonSplitLevels is only used to mark the first of - //the block or thread loops to be reduced in CUDA-CHiLL. Here we - //place some comments to help with final code generation. - //int idx = smtNonSplitLevels[s].index(level_); - - if (s < smtNonSplitLevels.size()) { - if (smtNonSplitLevels[s].size() > 0) - if (smtNonSplitLevels[s][0] == level_) { - blockLoop = true; - } - //Assume every stmt marked with a thread loop index also has a block loop idx - if (smtNonSplitLevels[s].size() > 1) - if (smtNonSplitLevels[s][1] == level_) { - threadLoop = true; - } - } - } - } - if (blockLoop && threadLoop) { - fprintf(stderr, - "Warning, have %d level more than once in smtNonSplitLevels\n", - level_); - threadLoop = false; - } - std::string preferredIdx; - if (loopIdxNames.size() - && (level_ / 2) - 1 < loopIdxNames[firstActiveStmt].size()) - preferredIdx = loopIdxNames[firstActiveStmt][(level_ / 2) - 1]; - for (int s = 0; s < active_.size(); s++) { - if (active_.get(s)) { - for (int i = 0; i < syncs.size(); i++) { - if (syncs[i].first == s - && strcmp(syncs[i].second.c_str(), - preferredIdx.c_str()) == 0) { - sync = true; - //printf("FOUND SYNC\n"); - } - - } - } - - } - if (threadLoop || blockLoop || preferredIdx.length() != 0) { - char buf[1024]; - std::string loop; - if (blockLoop) - loop = "blockLoop "; - if (threadLoop) - loop = "threadLoop "; - if (preferredIdx.length() != 0 && sync) { - sprintf(buf, "~cuda~ %spreferredIdx: %s sync", loop.c_str(), - preferredIdx.c_str()); - } else if (preferredIdx.length() != 0) { - sprintf(buf, "~cuda~ %spreferredIdx: %s", loop.c_str(), - preferredIdx.c_str()); - } else { - sprintf(buf, "~cuda~ %s", loop.c_str()); - } - - - loopRepr = ocg->CreateAttribute(loopRepr, buf); - } - - } - if (guardRepr == NULL) - return loopRepr; - else - return ocg->CreateIf(indent, guardRepr, loopRepr, NULL); - } else { - std::pair > result = - output_assignment(ocg, bounds_, level_, cur_known, - assigned_on_the_fly); - guardRepr = ocg->CreateAnd(guardRepr, result.first); - - if (result.second.second < CodeGen::var_substitution_threshold) { - std::vector > atof = - assigned_on_the_fly; - atof[level_ - 1] = result.second; - CG_outputRepr *bodyRepr = body_->printRepr( - (guardRepr == NULL) ? indent : indent + 1, ocg, stmts, - atof); - delete atof[level_ - 1].first; - if (guardRepr == NULL) - return bodyRepr; - else - return ocg->CreateIf(indent, guardRepr, bodyRepr, NULL); - } else { - CG_outputRepr *assignRepr = ocg->CreateAssignment( - (guardRepr == NULL) ? indent : indent + 1, - output_ident(ocg, bounds_, - const_cast(this)->bounds_.set_var( - level_), assigned_on_the_fly), - result.second.first); - CG_outputRepr *bodyRepr = body_->printRepr( - (guardRepr == NULL) ? indent : indent + 1, ocg, stmts, - assigned_on_the_fly); - if (guardRepr == NULL) - return ocg->StmtListAppend(assignRepr, bodyRepr); - else - return ocg->CreateIf(indent, guardRepr, - ocg->StmtListAppend(assignRepr, bodyRepr), NULL); - } - - } -} - -CG_result *CG_loop::clone() const { - return new CG_loop(codegen_, active_, level_, body_->clone()); -} - -void CG_loop::dump(int indent) const { - std::string prefix; - for (int i = 0; i < indent; i++) - prefix += " "; - std::cout << prefix << "LOOP (level " << level_ << "): " << active_ - << std::endl; - std::cout << prefix << "known: "; - const_cast(this)->known_.print(); - std::cout << prefix << "restriction: "; - const_cast(this)->restriction_.print(); - std::cout << prefix << "bounds: "; - const_cast(this)->bounds_.print(); - std::cout << prefix << "guard: "; - const_cast(this)->guard_.print(); - body_->dump(indent + 1); -} - -//----------------------------------------------------------------------------- -// Class: CG_leaf -//----------------------------------------------------------------------------- - -CG_result* CG_leaf::recompute(const BoolSet<> &parent_active, - const Relation &known, const Relation &restriction) { - active_ &= parent_active; - known_ = copy(known); - - guards_.clear(); - for (BoolSet<>::iterator i = active_.begin(); i != active_.end(); i++) { - Relation r = Intersection( - copy(codegen_->projected_IS_[num_level() - 1][*i]), - copy(restriction)); - r.simplify(2, 4); - if (!r.is_upper_bound_satisfiable()) - active_.unset(*i); - else { - r = Gist(r, copy(known), 1); - if (!r.is_obvious_tautology()) { - guards_[*i] = r; - guards_[*i].copy_names(known); - guards_[*i].setup_names(); - } - } - } - - - if (active_.empty()) { - delete this; - return NULL; - } else - return this; -} - -std::pair CG_leaf::liftOverhead(int depth, bool) { - if (depth == 0) - return std::make_pair(this, Relation::True(num_level())); - - for (std::map::iterator i = guards_.begin(); - i != guards_.end(); i++) { - Relation r = pick_one_guard(i->second); - if (!r.is_obvious_tautology()) { - bool has_wildcard = false; - int max_level = 0; - for (EQ_Iterator e(r.single_conjunct()->EQs()); e; e++) { - if ((*e).has_wildcards()) - has_wildcard = true; - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) - if (cvi.curr_var()->kind() == Input_Var - && cvi.curr_var()->get_position() > max_level) - max_level = cvi.curr_var()->get_position(); - } - for (GEQ_Iterator e(r.single_conjunct()->GEQs()); e; e++) { - if ((*e).has_wildcards()) - has_wildcard = true; - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) - if (cvi.curr_var()->kind() == Input_Var - && cvi.curr_var()->get_position() > max_level) - max_level = cvi.curr_var()->get_position(); - } - - if (!(has_wildcard && max_level == codegen_->num_level())) - return std::make_pair(this, r); - } - } - - return std::make_pair(this, Relation::True(num_level())); -} - -Relation CG_leaf::hoistGuard() { - std::vector guards; - for (BoolSet<>::iterator i = active_.begin(); i != active_.end(); i++) { - std::map::iterator j = guards_.find(*i); - if (j == guards_.end()) { - Relation r = Relation::True(num_level()); - r.copy_names(known_); - r.setup_names(); - return r; - } else { - guards.push_back(j->second); - } - } - - return SimpleHull(guards, true, true); -} - -void CG_leaf::removeGuard(const Relation &guard) { - known_ = Intersection(known_, copy(guard)); - known_.simplify(); - - std::map::iterator i = guards_.begin(); - while (i != guards_.end()) { - i->second = Gist(i->second, copy(known_), 1); - if (i->second.is_obvious_tautology()) - guards_.erase(i++); - else - ++i; - } -} - -CG_outputRepr *CG_leaf::printRepr(int indent, CG_outputBuilder *ocg, - const std::vector &stmts, - const std::vector > &assigned_on_the_fly) const { - return leaf_print_repr(active_, guards_, NULL, known_, indent, ocg, - codegen_->remap_, codegen_->xforms_, stmts, assigned_on_the_fly); -} - -CG_result *CG_leaf::clone() const { - return new CG_leaf(codegen_, active_); -} - -void CG_leaf::dump(int indent) const { - std::string prefix; - for (int i = 0; i < indent; i++) - prefix += " "; - std::cout << prefix << "LEAF: " << active_ << std::endl; - std::cout << prefix << "known: "; - const_cast(this)->known_.print(); - for (std::map::const_iterator i = guards_.begin(); - i != guards_.end(); i++) { - std::cout << prefix << "guard #" << i->first << ":"; - const_cast(i->second).print(); - } -} - -} diff --git a/omega/code_gen/src/CG_roseBuilder.cc b/omega/code_gen/src/CG_roseBuilder.cc deleted file mode 100644 index eb16830..0000000 --- a/omega/code_gen/src/CG_roseBuilder.cc +++ /dev/null @@ -1,1533 +0,0 @@ -/***************************************************************************** - Copyright (C) 2008 University of Southern California - Copyright (C) 2009-2010 University of Utah - All Rights Reserved. - - Purpose: - generate suif code for omega - - Notes: - - History: - 02/01/06 created by Chun Chen - *****************************************************************************/ - -#include -#include -#include - -struct ir_error: public std::runtime_error { - ir_error(const std::string &msg) : - std::runtime_error(msg) { - } -}; - -using namespace SageBuilder; -using namespace SageInterface; -using namespace OmpSupport; - -namespace omega { - -//----------------------------------------------------------------------------- -// make suif initilization happy -//----------------------------------------------------------------------------- -char *k_ocg_comment; - -// void __attribute__ ((constructor)) my_init(void) { -// ANNOTE(k_ocg_comment, "omega_comment", TRUE); -// } - -/* - const char *libcode_gen_ver_string = ""; - const char *libcode_gen_who_string = ""; - const char *libcode_gen_suif_string = ""; - - void init_code_gen(int&, char* []) { - ANNOTE(k_ocg_comment, "omega_comment", TRUE); - } - - void exit_code_gen(void) { - } - */ -CG_roseBuilder::CG_roseBuilder(int is_fortran, SgGlobal* global, SgGlobal* firstScope, - SgSymbolTable* symtab, SgSymbolTable* symtab2, SgNode* root) : - isFortran(is_fortran), global_(global), global_scope(firstScope), symtab_(symtab), symtab2_( - symtab2), root_(root) { -} - - -CG_roseBuilder::~CG_roseBuilder() { -} - -// Manu:: returns true if input is in fortran, else returns false -bool CG_roseBuilder::isInputFortran() const{ - if (isFortran) - return true; - else - return false; -} - -//----------------------------------------------------------------------------- -// place holder generation -//----------------------------------------------------------------------------- -CG_outputRepr* CG_roseBuilder::CreateSubstitutedStmt(int, CG_outputRepr *stmt, - const std::vector &vars, std::vector &subs) const { - - SgStatementPtrList* list = static_cast(stmt)->list_; - SgNode *tnl; - SgStatement* statement; - if (list != NULL) { - //statement = *((*list).begin()); - //tnl = isSgNode(statement); - delete stmt; - for (int i = 0; i < subs.size(); i++) { - if (subs[i] == NULL) - continue; - - CG_roseRepr *repr = static_cast(subs[i]); - SgExpression* op = repr->op_; - - for (SgStatementPtrList::iterator it = (*list).begin(); - it != (*list).end(); it++) { - statement = (*it); - tnl = isSgNode(statement); - - // std::string master = tnl->unparseToString(); - - int j; - int not_in_symtab_; - - not_in_symtab_ = 0; - - SgVariableSymbol *vs = symtab_->find_variable( - SgName(vars[i].c_str())); - - if (vs == NULL) { - - not_in_symtab_ = 1; - - vs = symtab2_->find_variable(SgName(vars[i].c_str())); - } - if (vs != NULL) { - //std::string x = vars[i].c_str() ; - //std::string y = isSgNode(op)->unparseToString(); - - std::vector array = substitute(tnl, - (const SgVariableSymbol*) vs, op, root_); - for (std::vector::iterator it = - array.begin(); it != array.end(); it++) { - - // std::string z = isSgNode(array[j])->unparseToString(); - if (isSgVarRefExp(op)) { - if (strcmp( - isSgVarRefExp(op)->get_symbol()->get_name().getString().c_str(), - vs->get_name().getString().c_str())) { - - (*it)->set_symbol( - isSgVarRefExp(op)->get_symbol()); - // std::string z = isSgNode(array[j])->unparseToString(); - - // isSgBinaryOp(array[j]->get_parent())->replace_expression(array[j], op); - - } - } else if (isSgExpression(op)) { - - if (isSgBinaryOp((*it)->get_parent())) - isSgBinaryOp((*it)->get_parent())->replace_expression( - *it, op); - else if (isSgUnaryOp((*it)->get_parent())) - isSgUnaryOp((*it)->get_parent())->replace_expression( - *it, op); - else if (isSgExprListExp((*it)->get_parent())) - isSgExprListExp((*it)->get_parent())->replace_expression( - *it, op); - else - throw ir_error("unrecognized expression type"); - } - - } - /* std::vector array2 = substitute (tnl,(const SgVariableSymbol*) vs, op, root_); - if(array2.size() != 0) - throw ir_error("variable replacement unsuccessful"); - */ - } - - } - - delete repr; - subs[i] = NULL; - - if (subs[i] != NULL) - throw ir_error("not freed properly"); - - } - - return new CG_roseRepr(list); - - } else { - tnl = static_cast(stmt)->tnl_; - //std::string master = tnl->unparseToString(); - - if (tnl == NULL) - throw ir_error("both list and tnl are null!!"); - - delete stmt; - int j; - int not_in_symtab_; - for (int i = 0; i < subs.size(); i++) { - if (subs[i] == NULL) - continue; - not_in_symtab_ = 0; - - - CG_roseRepr *repr = static_cast(subs[i]); - SgExpression* op = repr->op_; - delete repr; - subs[i] = NULL; - - SgVariableSymbol *vs = symtab_->find_variable( - SgName(vars[i].c_str())); - - if (vs == NULL) { - - not_in_symtab_ = 1; - - vs = symtab2_->find_variable(SgName(vars[i].c_str())); - } - if (vs != NULL) { - //std::string x = vars[i].c_str() ; - //std::string y = isSgNode(op)->unparseToString(); - std::vector array = substitute(tnl, vs, op, - root_); - - if (not_in_symtab_ && isSgVarRefExp(op)) { - if (strcmp( - isSgVarRefExp(op)->get_symbol()->get_name().getString().c_str(), - vs->get_name().getString().c_str())) { - // symtab2_->remove(vs); - } - } - /* else if(not_in_symtab_ && isSgVarRefExp(isSgAddOp(op)->get_lhs_operand())){ - if(strcmp(isSgVarRefExp(isSgAddOp(op)->get_lhs_operand())->get_symbol()->get_name().getString().c_str(),\ - vs->get_name().getString().c_str())){ - symtab2_->remove(vs); - } - }*/ - //symtab2_->remove(vs); - for (std::vector::iterator j = array.begin(); - j != array.end(); j++) { - // std::string z = isSgNode(array[j])->unparseToString(); - - if (isSgVarRefExp(op)) { - if (strcmp( - isSgVarRefExp(op)->get_symbol()->get_name().getString().c_str(), - vs->get_name().getString().c_str())) { - (*j)->set_symbol(isSgVarRefExp(op)->get_symbol()); - //isSgBinaryOp(array[j]->get_parent())->replace_expression(array[j], op); - // std::string z = isSgNode(array[j])->unparseToString(); - - } - } else if (isSgExpression(op)) { - - if (isSgBinaryOp((*j)->get_parent())) - isSgBinaryOp((*j)->get_parent())->replace_expression( - *j, op); - else if (isSgUnaryOp((*j)->get_parent())) - isSgUnaryOp((*j)->get_parent())->replace_expression( - *j, op); - else if (isSgExprListExp((*j)->get_parent())) { // Manu:: fortran indices are stored this way - isSgExprListExp((*j)->get_parent())->replace_expression(*j, op); - } - else - throw ir_error("unrecognized expression type"); - /* if(strcmp(isSgVarRefExp(isSgAddOp(op)->get_lhs_operand())->get_symbol()->get_name().getString().c_str(),\ - vs->get_name().getString().c_str() )){ - array[j]->set_symbol(isSgVarRefExp(isSgAddOp(op)->get_lhs_operand())->get_symbol()); - - */ - - } - - } - /* std::vector array2 = substitute (tnl,(const SgVariableSymbol*) vs, op, root_); - if(array2.size() != 0) - throw ir_error("variable replacement unsuccessful"); - */ - } - /* SgExpression* exp = NULL; - - if(stmt1 = isSgStatement(tnl)){ - if (SgExprStatement* expr_stmt = isSgExprStatement(stmt1)) - exp = expr_stmt->get_expression(); - else if( block = isSgBasicBlock(tnl)){ - SgStatementPtrList& stmts = block->get_statements(); - SgExpression* exp2; - for(int i =0; i < stmts.size(); i++){ - if(isSgExprStatement(stmts[i])){ - exp2 = isSgExprStatement(stmts[i])->get_expression(); - if(exp2 != NULL){ - - if(isSgBinaryOp(exp2)) { - substitute(isSgBinaryOp(exp2)->get_lhs_operand(), vs, op, root_, exp2); - substitute(isSgBinaryOp(exp2)->get_rhs_operand(), vs, op, root_, exp2); - } - else if (isSgUnaryOp(exp2)) - substitute(isSgUnaryOp(exp2)->get_operand(), vs, op, root_, exp2); - - - }//end if - - }//end if - }//end for - - }//end else - else if(SgForStatement* for_stmt = isSgForStatement(tnl)){ - SgForStatement* temp = for_stmt; - while(isSgForStatement(temp)){ - - - - } - - - - - } - - - }//end if - else - exp = isSgExpression(tnl); - - if(exp != NULL){ - if(isSgBinaryOp(exp)) { - substitute(isSgBinaryOp(exp)->get_lhs_operand(), vs, op, root_, exp); - substitute(isSgBinaryOp(exp)->get_rhs_operand(), vs, op, root_, exp); - } - else if (isSgUnaryOp(exp)) - substitute(isSgUnaryOp(exp)->get_operand(), vs, op, root_, exp); - - } - // if (op.is_instr()) - // delete op.instr(); - } - */ - } - return new CG_roseRepr(tnl); - } - -} - -//----------------------------------------------------------------------------- -// assignment generation -//----------------------------------------------------------------------------- -CG_outputRepr* CG_roseBuilder::CreateAssignment(int, CG_outputRepr *lhs, - CG_outputRepr *rhs) const { - if (lhs == NULL || rhs == NULL) { - fprintf(stderr, "Code generation: Missing lhs or rhs\n"); - return NULL; - } - - SgExpression* src = static_cast(rhs)->op_; - SgExpression* dst = static_cast(lhs)->op_; - - SgExprStatement* ins = buildAssignStatement(dst, src); - src->set_parent(ins); - dst->set_parent(ins); - - SgStatementPtrList* new_list = new SgStatementPtrList; - - (*new_list).push_back(isSgStatement(ins)); - - delete lhs; - delete rhs; - - return new CG_roseRepr(new_list); - -} - -//----------------------------------------------------------------------------- -// function invocation generation -//----------------------------------------------------------------------------- -CG_outputRepr* CG_roseBuilder::CreateInvoke(const std::string &fname, - std::vector &list) const { - - // Manu:: debug -// std::cout << "--------- CreateInvoke --------- \n"; - - if (fname == std::string("max") || fname == std::string("min")) { - if (list.size() == 0) { - return NULL; - } else if (list.size() == 1) { - return list[0]; - } else { - int last = list.size() - 1; - SgExpression* op2 = static_cast(list[last])->op_; - delete list[last]; - list.erase(list.end()-1); - CG_roseRepr *repr = static_cast(CreateInvoke(fname, - list)); - SgExpression* op1 = repr->op_; - - - SgExpression *ins; - SgExprListExp* arg_list = buildExprListExp(); - appendExpression(arg_list, op1); - appendExpression(arg_list, op2); - SgVarRefExp* opaque_var; - - - if (fname == std::string("max")) { - opaque_var = buildOpaqueVarRefExp("__rose_gt", global_); - ins = isSgExpression(buildFunctionCallExp(opaque_var, arg_list)); - - // Manu:: fortran support - if (isInputFortran()) { - SgName fName("merge"); - SgTypeInt *retType = buildIntType(); - - SgExpression *cond = static_cast(CreateLE(new CG_roseRepr(op2), new CG_roseRepr(op1)))->op_; - appendExpression(arg_list, cond); - ins = isSgExpression(buildFunctionCallExp(fName, retType, arg_list, global_)); -// std::cout << "--------- CreateInvoke:: " << isSgNode(ins)->unparseToString().c_str() << "\n"; - } - - } else { - opaque_var = buildOpaqueVarRefExp("__rose_lt", global_); - ins = isSgExpression(buildFunctionCallExp(opaque_var, arg_list)); - - // Manu:: fortran support - if (isInputFortran()) { - SgName fName("merge"); - SgTypeInt *retType = buildIntType(); - - SgExpression *cond = static_cast(CreateLE(new CG_roseRepr(op1), new CG_roseRepr(op2)))->op_; - appendExpression(arg_list, cond); - ins = isSgExpression(buildFunctionCallExp(fName, retType, arg_list, global_)); -// std::cout << "--------- CreateInvoke:: " << isSgNode(ins)->unparseToString().c_str() << "\n"; - } - - } - - repr->op_ = ins; - return repr; - } - } else { - fprintf(stderr, - "Code generation: invoke function io_call not implemented\n"); - return NULL; - } - -} - -//----------------------------------------------------------------------------- -// comment generation -//----------------------------------------------------------------------------- -CG_outputRepr* CG_roseBuilder::CreateComment(int, - const std::string &commentText) const { - if (commentText == std::string("")) { - return NULL; - } - - SgLocatedNode *tnl = new SgLocatedNode(); - buildComment(tnl, "//omega_comment: " + commentText); - - return new CG_roseRepr(isSgNode(tnl)); - -} - -//----------------------------------------------------------------------------- -// if stmt gen operations -//----------------------------------------------------------------------------- -CG_outputRepr* CG_roseBuilder::CreateIf(int, CG_outputRepr *guardList, - CG_outputRepr *true_stmtList, CG_outputRepr *false_stmtList) const { - - // static int if_counter = 1; - // std::string s = std::string("omegaif_")+to_string(if_counter++); - // SgLabelStatement* label =buildLabelStatement(SgName(const_cast(s.c_str()))); - - if (true_stmtList == NULL && false_stmtList == NULL) { - delete guardList; - return NULL; - } else if (guardList == NULL) { - return StmtListAppend(true_stmtList, false_stmtList); - } - - SgExpression* header = static_cast(guardList)->op_; - - SgStatementPtrList *then_part1, *else_part1; - SgStatement* then_part; - SgStatement* else_part; - SgBasicBlock* then_part2; - SgBasicBlock* else_part2; - if (true_stmtList != NULL) { - then_part1 = static_cast(true_stmtList)->list_; - if (then_part1 != NULL) { - then_part = *((*then_part1).begin()); - - if ((*then_part1).size() > 1) { - then_part2 = buildBasicBlock(); - for (SgStatementPtrList::iterator it = (*then_part1).begin(); - it != (*then_part1).end(); it++) { - then_part2->append_statement(*it); - - } - then_part = isSgStatement(then_part2); - - } - } else { - // Manu:: fortran support (if part) - if (isInputFortran()) { - then_part2 = buildBasicBlock(); - then_part2->append_statement(isSgStatement(static_cast(true_stmtList)->tnl_)); - then_part = isSgStatement(then_part2); - } else - then_part = isSgStatement(static_cast(true_stmtList)->tnl_); - } - } else { - then_part = NULL; - } - if (false_stmtList != NULL) { - else_part1 = static_cast(false_stmtList)->list_; - if (else_part1 != NULL) { - else_part = *((*else_part1).begin()); - if ((*else_part1).size() > 1) { - else_part2 = buildBasicBlock(); - for (SgStatementPtrList::iterator it2 = (*else_part1).begin(); - it2 != (*else_part1).end(); it2++) { - else_part2->append_statement(*it2); - - } - else_part = isSgStatement(else_part2); - - } - } else { - // Manu:: fortran support (if part) - if (isInputFortran()) { - else_part2 = buildBasicBlock(); - else_part2->append_statement(isSgStatement(static_cast(false_stmtList)->tnl_)); - else_part = isSgStatement(else_part2); - } else - else_part = isSgStatement(static_cast(false_stmtList)->tnl_); - } - } else { - else_part = NULL; - } - - SgIfStmt* ti = buildIfStmt(header, isSgStatement(then_part), - isSgStatement(else_part)); - -// label->set_scope(ti);//may have to be shifted to after symbol table insertion -// SgLabelSymbol* if_label = isSgLabelSymbol(label->get_symbol_from_symbol_table()); - -// symtab_->insert( SgName(const_cast(s.c_str())) , isSgSymbol(if_label)); - - delete guardList; - delete true_stmtList; - delete false_stmtList; - - return new CG_roseRepr(isSgNode(ti)); - -} - -//----------------------------------------------------------------------------- -// inductive variable generation, to be used in CreateLoop as control -//----------------------------------------------------------------------------- -CG_outputRepr* CG_roseBuilder::CreateInductive(CG_outputRepr *index, - CG_outputRepr *lower, CG_outputRepr *upper, CG_outputRepr *step) const { - - if (index == NULL || lower == NULL || upper == NULL) { - fprintf(stderr, - "Code generation: something wrong in CreateInductive\n"); - return NULL; - } - - if (step == NULL) - step = new CG_roseRepr(isSgExpression(buildIntVal(1))); - - SgVarRefExp *index_sym = isSgVarRefExp( - static_cast(index)->op_); - SgExpression* lower_bound = static_cast(lower)->op_; - SgExpression* upper_bound = static_cast(upper)->op_; - SgExpression* step_size = static_cast(step)->op_; - - /* label_sym *contLabel = new label_sym(""); - label_sym *brkLabel = new label_sym(""); may not be required on rose?! - */ - - SgStatement* for_init_stmt = buildAssignStatement(index_sym, lower_bound); - SgLessOrEqualOp* cond = buildLessOrEqualOp(index_sym, upper_bound); - SgExprStatement* test = buildExprStatement(cond); - SgPlusAssignOp* increment = buildPlusAssignOp(index_sym, step_size); - SgForStatement *for_stmt = buildForStatement(for_init_stmt, - isSgStatement(test), increment, NULL); - - delete index; - delete lower; - delete upper; - delete step; - - - // Manu - if (isInputFortran()) { - // std::cout << "CG_roseBuilder:: need to construct a fortran do statement\n"; - SgFortranDo * forStmt=new SgFortranDo(Sg_File_Info::generateDefaultFileInfoForTransformationNode()); - forStmt->set_has_end_statement(true); - forStmt->set_bound(upper_bound); - forStmt->set_increment(step_size); - forStmt->set_initialization(isSgExprStatement(for_init_stmt)->get_expression()); - return new CG_roseRepr(isSgNode(forStmt)); - } else { -// std::cout << "CG_roseBuilder:: for statement is fine\n"; - - return new CG_roseRepr(isSgNode(for_stmt)); - - } - -} - -//----------------------------------------------------------------------------- -// Attribute Creation -//----------------------------------------------------------------------------- -CG_outputRepr* CG_roseBuilder::CreateAttribute(CG_outputRepr *control, - const std::string &commentText) const { - - SgNode *tnl = static_cast(control)->tnl_; - - tnl->setAttribute("omega_comment", new AstTextAttribute(commentText)); - - return static_cast(control); - -} - -//----------------------------------------------------------------------------- -// Pragma Attribute -//----------------------------------------------------------------------------- -CG_outputRepr* CG_roseBuilder::CreatePragmaAttribute(CG_outputRepr *stmt, int looplevel, const std::string &pragmaText) const { - SgNode *tnl = static_cast(stmt)->tnl_; - CodeInsertionAttribute* attr = NULL; - if (!tnl->attributeExists("code_insertion")) { - attr = new CodeInsertionAttribute(); - tnl->setAttribute("code_insertion", attr); - } - else { - attr = static_cast(tnl->getAttribute("code_insertion")); - } - attr->add(new PragmaInsertion(looplevel, pragmaText)); - return stmt; -} - -//----------------------------------------------------------------------------- -// Prefetch Attribute -//----------------------------------------------------------------------------- -CG_outputRepr* CG_roseBuilder::CreatePrefetchAttribute(CG_outputRepr* stmt, int looplevel, const std::string &arrName, int hint) const { - SgNode *tnl = static_cast(stmt)->tnl_; - CodeInsertionAttribute *attr = getOrCreateCodeInsertionAttribute(tnl); - attr->add(new MMPrefetchInsertion(looplevel, arrName, hint)); -} - -//----------------------------------------------------------------------------- -// loop stmt generation -//----------------------------------------------------------------------------- -CG_outputRepr* CG_roseBuilder::CreateLoop(int, CG_outputRepr *control, - CG_outputRepr *stmtList) const { - if (stmtList == NULL) { - delete control; - return NULL; - } else if (control == NULL) { - fprintf(stderr, "Code generation: no inductive for this loop\n"); - return stmtList; - } - - SgNode *tnl = static_cast(control)->tnl_; - SgForStatement *tf = isSgForStatement(tnl); - - // Manu :: fortran support - SgFortranDo *tfd = NULL; - if (isInputFortran()) { - tfd = isSgFortranDo(tnl); - } - // Manu:: debug -/* if (!tf) { - std::cout << "CreateLoop:: Not a for loop\n"; - if (isSgFortranDo(tnl)) - std::cout << "CreateLoop:: It is a fortran do loop\n"; - } -*/ - - SgStatementPtrList * body = static_cast(stmtList)->list_; - - if (body != NULL) { - if (!((*body).empty())) { - if ((*body).size() == 1) { - // if(isSgBasicBlock(*((*body).begin()))){ - if (!isInputFortran()) { // Manu:: added if-else for fortran support - tf->set_loop_body(*((*body).begin())); - (*((*body).begin()))->set_parent(tf); - } else { - SgBasicBlock* bb1 = buildBasicBlock(); - bb1->set_parent(tfd); - bb1->append_statement(*((*body).begin())); - tfd->set_body(bb1); - } - // } - /* else{ - SgBasicBlock* bb1 = buildBasicBlock(); - bb1->set_parent(tf); - bb1->append_statement(*((*body).begin())); - tf->set_loop_body(bb1); - - }*/ - } else { - // Manu:: support for fortran label (do - continue) - SgName *sname = NULL; - - SgBasicBlock* bb = buildBasicBlock(); - if (!isInputFortran()) - bb->set_parent(tf); - else - bb->set_parent(tfd); - for (SgStatementPtrList::iterator it = (*body).begin(); - it != (*body).end(); it++) { - bb->append_statement(*it); - (*it)->set_parent(bb); - } - if (!isInputFortran()) - tf->set_loop_body(bb); - else { - tfd->set_body(bb); - } - } - } - } else { - SgNode* tnl2 = static_cast(stmtList)->tnl_; - - if (tnl2 != NULL) { - if (!isInputFortran()) { - tf->set_loop_body(isSgStatement(tnl2)); - tnl2->set_parent(tf); - } else { - SgBasicBlock* bb1 = buildBasicBlock(); - bb1->set_parent(tfd); - bb1->append_statement(isSgStatement(tnl2)); - tfd->set_body(bb1); - tnl2->set_parent(bb1); - } - } - } - - delete stmtList; - - return control; -} - -//----------------------------------------------------------------------------- -// basic int, identifier gen operations -//----------------------------------------------------------------------------- -CG_outputRepr* CG_roseBuilder::CreateInt(int _i) const { - return new CG_roseRepr(isSgExpression(buildIntVal(_i))); -} -bool CG_roseBuilder::isInteger(CG_outputRepr *op) const{ - - SgExpression *op1 = static_cast(op)->op_; - - if(op1) - if(isSgIntVal(op1)) - return true; - - return false; -} -CG_outputRepr* CG_roseBuilder::CreateIdent(const std::string &_s) const { - - SgVariableSymbol *vs = symtab_->find_variable(SgName(_s.c_str())); - SgVariableSymbol *vs2 = symtab2_->find_variable(SgName(_s.c_str())); - - if (vs == NULL && vs2 == NULL) { - - SgVariableDeclaration* defn = buildVariableDeclaration( - SgName(_s.c_str()), buildIntType()); - SgInitializedNamePtrList& variables = defn->get_variables(); - SgInitializedNamePtrList::const_iterator i = variables.begin(); - SgInitializedName* initializedName = *i; - vs = new SgVariableSymbol(initializedName); - prependStatement(defn, isSgScopeStatement(root_)); - - vs->set_parent(symtab2_); - symtab2_->insert(SgName(_s.c_str()), vs); - return new CG_roseRepr(isSgExpression(buildVarRefExp(vs))); - - } - - /* May have problem */ - - if (!isSgExpression(buildVarRefExp(SgName(_s.c_str())))) - throw ir_error("error in Create ident!!"); - if (vs2 != NULL) - return new CG_roseRepr(isSgExpression(buildVarRefExp(vs2))); - - return new CG_roseRepr(isSgExpression(buildVarRefExp(vs))); - -} - -//----------------------------------------------------------------------------- -// binary arithmetic operations -//----------------------------------------------------------------------------- -CG_outputRepr* CG_roseBuilder::CreatePlus(CG_outputRepr *lop, - CG_outputRepr *rop) const { - if (rop == NULL) { - return lop; - } else if (lop == NULL) { - return rop; - } - - SgExpression* op1 = static_cast(lop)->op_; - SgExpression* op2 = static_cast(rop)->op_; - - SgAddOp *ins = buildAddOp(op1, op2); - op1->set_parent(ins); - op2->set_parent(ins); - delete lop; - delete rop; - - return new CG_roseRepr(isSgExpression(ins)); - -} - -CG_outputRepr* CG_roseBuilder::CreateMinus(CG_outputRepr *lop, - CG_outputRepr *rop) const { - if (rop == NULL) { - return lop; /* May Cause Problem */ - } else if (lop == NULL) { - SgExpression *op = static_cast(rop)->op_; - SgMinusOp *ins = buildMinusOp(op); - - delete rop; - - return new CG_roseRepr(isSgExpression(ins)); - } else { - SgExpression* op1 = static_cast(lop)->op_; - SgExpression* op2 = static_cast(rop)->op_; - - SgSubtractOp *ins = buildSubtractOp(op1, op2); - op1->set_parent(ins); - op2->set_parent(ins); - delete lop; - delete rop; - return new CG_roseRepr(isSgExpression(ins)); - } - -} - -CG_outputRepr* CG_roseBuilder::CreateTimes(CG_outputRepr *lop, - CG_outputRepr *rop) const { - if (rop == NULL || lop == NULL) { - if (rop != NULL) { - rop->clear(); - delete rop; - } - if (lop != NULL) { - lop->clear(); - delete lop; - } - return NULL; - } - - SgExpression* op1 = static_cast(lop)->op_; - SgExpression* op2 = static_cast(rop)->op_; - - SgMultiplyOp *ins = buildMultiplyOp(op1, op2); - op1->set_parent(ins); - op2->set_parent(ins); - delete lop; - delete rop; - - return new CG_roseRepr(isSgExpression(ins)); - -} - -CG_outputRepr* CG_roseBuilder::CreateIntegerFloor(CG_outputRepr *lop, - CG_outputRepr *rop) const { - if (rop == NULL) { - fprintf(stderr, "Code generation: divide by NULL\n"); - return NULL; - } else if (lop == NULL) { - delete rop; - return NULL; - } - - // (6+5)*10 / 4 - SgExpression* op1 = static_cast(lop)->op_; - SgExpression* op2 = static_cast(rop)->op_; - - // bugs in SUIF prevent use of correct io_divfloor - SgDivideOp *ins = buildDivideOp(op1, op2); - - delete lop; - delete rop; - - return new CG_roseRepr(isSgExpression(ins)); - -} - -CG_outputRepr* CG_roseBuilder::CreateIntegerMod(CG_outputRepr *lop, - CG_outputRepr *rop) const { - if (rop == NULL || lop == NULL) { - return NULL; - } - - SgExpression* op1 = static_cast(lop)->op_; - SgExpression* op2 = static_cast(rop)->op_; - - // bugs in SUIF prevent use of correct io_mod - SgModOp *ins; - if (!isInputFortran()) { - ins = buildModOp(op1, op2); - delete lop; - delete rop; - - return new CG_roseRepr(isSgExpression(ins)); - } else { // Manu:: fortran mod is a function call and not an operator (f77 and f90) - SgExpression *fins; - SgName fName("MOD"); - SgExprListExp* arg_list = buildExprListExp(); - appendExpression(arg_list, op1); - appendExpression(arg_list, op2); - SgTypeInt *retType = buildIntType(); - fins = isSgExpression(buildFunctionCallExp(fName, retType, arg_list, global_)); - return new CG_roseRepr(isSgExpression(fins)); - } - -} - -//----------------------------------------------------------------------------- -// binary logical operations -//----------------------------------------------------------------------------- -CG_outputRepr* CG_roseBuilder::CreateAnd(CG_outputRepr *lop, - CG_outputRepr *rop) const { - /*if (rop == NULL || lop == NULL) { - return NULL; - }*/ - - if (rop == NULL) - return lop; - else if (lop == NULL) - return rop; - - SgExpression* op1 = static_cast(lop)->op_; - SgExpression* op2 = static_cast(rop)->op_; - - SgAndOp *ins = buildAndOp(op1, op2); - - delete lop; - delete rop; - - return new CG_roseRepr(isSgExpression(ins)); - -} - -//----------------------------------------------------------------------------- -// binary relational operations -//----------------------------------------------------------------------------- -/*CG_outputRepr* CG_roseBuilder::CreateGE(CG_outputRepr *lop, - CG_outputRepr *rop) const { - return CreateLE(rop, lop); -}*/ - -CG_outputRepr* CG_roseBuilder::CreateLE(CG_outputRepr *lop, - CG_outputRepr *rop) const { - if (rop == NULL || lop == NULL) { - return NULL; - } - - SgExpression* op1 = static_cast(lop)->op_; - SgExpression* op2 = static_cast(rop)->op_; - - SgLessOrEqualOp *ins = buildLessOrEqualOp(op1, op2); - - delete lop; - delete rop; - - return new CG_roseRepr(isSgExpression(ins)); - -} - -CG_outputRepr* CG_roseBuilder::CreateEQ(CG_outputRepr *lop, - CG_outputRepr *rop) const { - if (rop == NULL || lop == NULL) { - return NULL; - } - - SgExpression* op1 = static_cast(lop)->op_; - SgExpression* op2 = static_cast(rop)->op_; - - SgEqualityOp *ins = buildEqualityOp(op1, op2); - - delete lop; - delete rop; - - return new CG_roseRepr(isSgExpression(ins)); - -} - -//----------------------------------------------------------------------------- -// stmt list gen operations -//----------------------------------------------------------------------------- -/*CG_outputRepr* CG_roseBuilder::CreateStmtList(CG_outputRepr *singleton) const { - - if (singleton == NULL) { - return new CG_roseRepr(new SgStatementPtrList); - } - - SgStatementPtrList *tnl = static_cast(singleton)->list_; - SgNode* sgn = static_cast(singleton)->tnl_; - - if (tnl == NULL) - tnl = new SgStatementPtrList; - - if (sgn == NULL) { - SgExpression* op = static_cast(singleton)->op_; - - if (op != NULL) - (*tnl).push_back( - buildExprStatement( - static_cast(singleton)->op_)); - - } else - (*tnl).push_back(isSgStatement(sgn)); - - delete singleton; - return new CG_roseRepr(tnl); - -// tnl = isSgNode(buildBasicBlock(buildExprStatement(static_cast(singleton)->op_))); - -// delete singleton; -// return new CG_roseRepr(tnl); - -} - -CG_outputRepr* CG_roseBuilder::StmtListInsertLast(CG_outputRepr *list, - CG_outputRepr *node) const { - return StmtListAppend(list, node); -} -*/ -CG_outputRepr* CG_roseBuilder::StmtListAppend(CG_outputRepr *list1, - CG_outputRepr *list2) const { - - if (list2 == NULL) { - return list1; - } else if (list1 == NULL) { - return list2; - } - - // SgStatement* parent; - // SgStatement* stmt1; - // SgStatement* stmt2; - - SgStatementPtrList* new_list; - - SgStatementPtrList* tnl1 = static_cast(list1)->list_; - SgStatementPtrList* tnl2 = static_cast(list2)->list_; - SgNode* one = static_cast(list1)->tnl_; - SgNode* two = static_cast(list2)->tnl_; - - SgExpression* exp1 = static_cast(list1)->op_; - SgExpression* exp2 = static_cast(list2)->op_; - - if (exp1 || exp2) - throw ir_error("error in stmtlistappend!!"); - - if (tnl1 && one) - throw ir_error("error in stmtlistappend!!"); - - if (tnl2 && two) - throw ir_error("error in stmtlistappend!!"); -// SgNode* sg1 = static_cast(list1)->tnl_; - -//if((*tnl1).empty()){ - -// if(SgStatement* stmt = isSgStatement(sg1)) -// (*tnl1).push_back(stmt); -//else if(isSgScopeStatement(sg1)){ -// SgStatementPtrList scopeStmtPtrLst = isSgScopeStatement(sg1)->generateStatementList(); - -// for(SgStatementPtrList::iterator it1 = scopeStmtPtrLst.begin();it1 != scopeStmtPtrLst.end(); it1++) -// (*tnl1).push_back(*it1); -//} -//} - - if ((tnl1 == NULL) && (tnl2 == NULL)) { - - if ((one != NULL) && (two != NULL)) { - - new_list = new SgStatementPtrList; - - (*new_list).push_back(isSgStatement(one)); - (*new_list).push_back(isSgStatement(two)); - - CG_roseRepr* new_rep = new CG_roseRepr(new_list); - - return static_cast(new_rep); - - } else if ((one != NULL) && (two == NULL)) { - - return static_cast(new CG_roseRepr(one)); - - } else if ((two != NULL) && (one == NULL)) { - return static_cast(new CG_roseRepr(two)); - - } - - } else { - if ((tnl2 != NULL) && (tnl1 == NULL)) { - /* for(SgStatementPtrList::iterator it = (*tnl2).begin(); it != (*tnl2).end(); it++) - { - (*tnl1).push_back(*it); - - } - */ - if (one == NULL) - return list2; - else { - new_list = new SgStatementPtrList; - (*new_list).push_back(isSgStatement(one)); - - for (SgStatementPtrList::iterator it = (*tnl2).begin(); - it != (*tnl2).end(); it++) { - (*new_list).push_back(*it); - - } - //delete list2; - return static_cast(new CG_roseRepr(new_list)); - } - } else if ((tnl1 != NULL) && (tnl2 == NULL)) { - if (two == NULL) - return list1; - else { - - (*tnl1).push_back(isSgStatement(two)); - // delete list1; - return static_cast(new CG_roseRepr(tnl1)); - - } - - } else if ((tnl1 != NULL) && (tnl2 != NULL)) { - - for (SgStatementPtrList::iterator it = (*tnl2).begin(); - it != (*tnl2).end(); it++) { - (*tnl1).push_back(*it); - - } - - // delete list2; - // delete list1; - return static_cast(new CG_roseRepr(tnl1)); - } -//else{ -// SgNode* tnll2 = static_cast(list2)->tnl_; -// if(tnll2 != NULL){ -// if(isSgStatement(tnll2)) -// (*tnl1).push_back(isSgStatement(tnll2)); -// else if(isSgScopeStatement(tnll2)){ -// SgStatementPtrList scopeStmtPtrLst1 = isSgScopeStatement(tnll2)->generateStatementList(); - -// for(SgStatementPtrList::iterator it2 = scopeStmtPtrLst1.begin();it2 != scopeStmtPtrLst1.end(); it2++) -// (*tnl1).push_back(*it2); - -// } -//} -// else{ -// SgStatement* stmt2 = isSgStatement(buildExprStatement(static_cast(list2)->op_)); -// (*tnl1).push_back(stmt2); - -// } - -//} - // stmt2 = isSgStatement(tnl2); - -// std::string c = tnl1->unparseToString(); - -// std::string d = isSgNode(stmt2)->unparseToString(); - -// if(isSgForStatement(tnl1) || isSgBasicBlock(tnl1)) -// isSgScopeStatement(tnl1)->append_statement(stmt2); -// else -// { - // stmt1 = isSgStatement(tnl1); - // parent = isSgStatement(tnl1->get_parent()); - // if(isSgForStatement(tnl1->get_parent()) || isSgBasicBlock(tnl1->get_parent())) - // isSgScopeStatement(tnl1->get_parent())->append_statement(stmt2); - // else if (isSgStatement(tnl1->get_parent())) - // isSgStatement(tnl1->get_parent())->insert_statement(stmt1, stmt2, false); - -// } - - } -// delete list2; - -// return list1; - -} - - -CG_outputRepr* CG_roseBuilder::CreateDim3(const char* varName, CG_outputRepr* arg1, - CG_outputRepr* arg2, CG_outputRepr* arg3) const { - - //SgName type_name("dim3"); - //SgClassSymbol * type_symbol = global_scope->lookup_class_symbol(type_name); - // SgClassDeclaration * type_decl = isSgClassDeclaration( - // type_symbol->get_declaration()); - - //SgVariableDeclaration * var_decl = buildVariableDeclaration(varName, type_symbol->get_type()); - - SgFunctionSymbol * ctor_symbol = global_scope->lookup_function_symbol( - SgName("dim3")); - - SgExprListExp * ctor_args; - if(arg3 != NULL) - ctor_args = buildExprListExp(static_cast(arg1)->op_, - static_cast(arg2)->op_, static_cast(arg3)->op_); - else - ctor_args = buildExprListExp(static_cast(arg1)->op_, - static_cast(arg2)->op_); - SgFunctionCallExp * dim3_func_call = buildFunctionCallExp( - buildFunctionRefExp(ctor_symbol->get_declaration()), ctor_args); - - char joined_str[20]; - - strcpy(joined_str, "dim3 "); - strcat(joined_str, varName); - - SgExprStatement* decl = buildAssignStatement( - buildOpaqueVarRefExp(joined_str, isSgScopeStatement(root_)), - dim3_func_call); - - SgStatementPtrList *tnl2 = new SgStatementPtrList; - - // (*tnl2).push_back(var_decl); - (*tnl2).push_back(decl); - return new CG_roseRepr(tnl2); - -} - -/*CG_outputRepr* CG_roseBuilder::CreateDim3(const char* varName, int arg1, - int arg2) const { - - SgName type_name("dim3"); - SgClassSymbol * type_symbol = global_scope->lookup_class_symbol(type_name); - SgClassDeclaration * type_decl = isSgClassDeclaration( - type_symbol->get_declaration()); - - //SgVariableDeclaration * var_decl = buildVariableDeclaration(varName, type_symbol->get_type()); - - SgFunctionSymbol * ctor_symbol = global_scope->lookup_function_symbol( - SgName("dim3")); - - SgExprListExp * ctor_args = buildExprListExp(buildIntVal(arg1), - buildIntVal(arg2)); - - SgFunctionCallExp * dim3_func_call = buildFunctionCallExp( - buildFunctionRefExp(ctor_symbol->get_declaration()), ctor_args); - - char joined_str[20]; - - strcpy(joined_str, "dim3 "); - strcat(joined_str, varName); - - SgExprStatement* decl = buildAssignStatement( - buildOpaqueVarRefExp(joined_str, isSgScopeStatement(root_)), - dim3_func_call); - - SgStatementPtrList *tnl2 = new SgStatementPtrList; - - // (*tnl2).push_back(var_decl); - (*tnl2).push_back(decl); - return new CG_roseRepr(tnl2); -} - -CG_outputRepr* CG_roseBuilder::CreateDim3(const char* varName, int arg1, - int arg2, int arg3) const { - - SgName type_name("dim3"); - SgClassSymbol * type_symbol = global_scope->lookup_class_symbol(type_name); - SgClassDeclaration * type_decl = isSgClassDeclaration( - type_symbol->get_declaration()); - - //SgVariableDeclaration * var_decl = buildVariableDeclaration(varName, type_symbol->get_type()); - - SgFunctionSymbol * ctor_symbol = global_scope->lookup_function_symbol( - SgName("dim3")); - - SgExprListExp * ctor_args = buildExprListExp(buildIntVal(arg1), - buildIntVal(arg2), buildIntVal(arg3)); - - SgFunctionCallExp * dim3_func_call = buildFunctionCallExp( - buildFunctionRefExp(ctor_symbol->get_declaration()), ctor_args); - - char joined_str[20]; - - strcpy(joined_str, "dim3 "); - strcat(joined_str, varName); - - SgExprStatement* decl = buildAssignStatement( - buildOpaqueVarRefExp(joined_str, isSgScopeStatement(root_)), - dim3_func_call); - - SgStatementPtrList *tnl2 = new SgStatementPtrList; - - // (*tnl2).push_back(var_decl); - (*tnl2).push_back(decl); - return new CG_roseRepr(tnl2); - - - -} -*/ - -/*CG_outputRepr* CG_suifBuilder::CreateKernel(immed_list* iml) const { - instruction *ins = new in_rrr(io_mrk); - ins->append_annote(k_cuda_kernel, iml); - tree_node_list *tnl = new tree_node_list; - tnl->append(new tree_instr(ins)); - return new CG_suifRepr(tnl); - } - - type_node* CG_suifBuilder::ModifyType(type_node* base, const char* modifier) const { - modifier_type* result = new modifier_type(TYPE_NULL, base); - immed_list *iml = new immed_list; - iml->append(immed((char*)modifier)); - result->append_annote(k_cuda_modifier, iml); - return result; - } - */ - -std::vector substitute(SgNode *in, const SgVariableSymbol *sym, - SgExpression* expr, SgNode* root) { - - SgStatement* stmt; - SgExpression* op; - std::vector arrays; - - if (in != NULL) { - if (stmt = isSgStatement(in)) { - if (isSgBasicBlock(stmt)) { - SgStatementPtrList& stmts = - isSgBasicBlock(stmt)->get_statements(); - for (int i = 0; i < stmts.size(); i++) { - stmts[i]->set_parent(stmt); - std::vector a = substitute( - isSgNode(stmts[i]), sym, expr, root); - std::copy(a.begin(), a.end(), back_inserter(arrays)); - } - } else if (isSgForStatement(stmt)) { - SgForStatement *tnf = isSgForStatement(stmt); - tnf->get_for_init_stmt()->set_parent(tnf); - tnf->get_test()->set_parent(tnf); - tnf->get_increment()->set_parent(tnf); - tnf->get_loop_body()->set_parent(tnf); - std::vector a = substitute( - isSgNode(tnf->get_for_init_stmt()), sym, expr, root); - std::copy(a.begin(), a.end(), back_inserter(arrays)); - std::vector a1 = substitute( - isSgNode(tnf->get_test()), sym, expr, root); - std::copy(a1.begin(), a1.end(), back_inserter(arrays)); - std::vector a2 = substitute( - isSgNode(tnf->get_increment()), sym, expr, root); - std::copy(a2.begin(), a2.end(), back_inserter(arrays)); - std::vector a3 = substitute( - isSgNode(tnf->get_loop_body()), sym, expr, root); - std::copy(a3.begin(), a3.end(), back_inserter(arrays)); - } else if (isSgFortranDo(stmt)) { // Manu:: fortran support - SgFortranDo *tnf = isSgFortranDo(stmt); - tnf->get_initialization()->set_parent(tnf); - tnf->get_bound()->set_parent(tnf); - tnf->get_increment()->set_parent(tnf); - tnf->get_body()->set_parent(tnf); - std::vector a = substitute( - isSgNode(tnf->get_initialization()), sym, expr, root); - std::copy(a.begin(), a.end(), back_inserter(arrays)); - std::vector a1 = substitute( - isSgNode(tnf->get_bound()), sym, expr, root); - std::copy(a1.begin(), a1.end(), back_inserter(arrays)); - std::vector a2 = substitute( - isSgNode(tnf->get_increment()), sym, expr, root); - std::copy(a2.begin(), a2.end(), back_inserter(arrays)); - std::vector a3 = substitute( - isSgNode(tnf->get_body()), sym, expr, root); - std::copy(a3.begin(), a3.end(), back_inserter(arrays)); - } else if (isSgForInitStatement(stmt)) { - - SgStatementPtrList& stmts = - isSgForInitStatement(stmt)->get_init_stmt(); - - for (SgStatementPtrList::iterator it = stmts.begin(); - it != stmts.end(); it++) { - std::vector a = substitute(isSgNode(*it), - sym, expr, root); - - std::copy(a.begin(), a.end(), back_inserter(arrays)); - } - } - /*else if(isSgFortranDo(stmt)){ - SgFortranDo *tfortran = isSgFortranDo(stmt); - omega::CG_roseRepr *r = new omega::CG_roseRepr(isSgStatement(tfortran->get_body())); - std::vector a = FindArrayRef(r); - delete r; - std::copy(a.begin(), a.end(), back_inserter(arrays)); - }*/ - else if (isSgVariableDeclaration(stmt)) { - if (SgExpression *init = - isSgVariableDeclaration(stmt)->get_variables().front()->get_initializer()) { - if (isSgAssignInitializer(init)) { - std::vector a = substitute( - isSgAssignInitializer(init)->get_operand(), sym, - expr, root); - std::copy(a.begin(), a.end(), back_inserter(arrays)); - } - } - } else if (isSgIfStmt(stmt)) { - SgIfStmt* tni = isSgIfStmt(stmt); - //tni->get_conditional()->set_parent(tni); - //tni->get_true_body()->set_parent(tni); - //tni->get_false_body()->set_parent(tni); - std::vector a = substitute( - isSgNode(tni->get_conditional()), sym, expr, root); - std::copy(a.begin(), a.end(), back_inserter(arrays)); - std::vector a1 = substitute( - isSgNode(tni->get_true_body()), sym, expr, root); - std::copy(a1.begin(), a1.end(), back_inserter(arrays)); - std::vector a2 = substitute( - isSgNode(tni->get_false_body()), sym, expr, root); - std::copy(a2.begin(), a2.end(), back_inserter(arrays)); - } else if (isSgExprStatement(stmt)) { - (isSgExprStatement(stmt)->get_expression())->set_parent( - isSgExprStatement(stmt)); - std::vector a = substitute( - isSgNode(isSgExprStatement(stmt)->get_expression()), - sym, expr, root); - std::copy(a.begin(), a.end(), back_inserter(arrays)); - } //end else if - } //end if - else { - op = isSgExpression(in); - // std::string x = isSgNode(op)->unparseToString(); - std::string y = sym->get_name().getString(); -// std::cout << "------substitute else:: " << in->unparseToString().c_str() << ", " << y.c_str() << "\n"; - - if (isSgBinaryOp(op)) { - - isSgBinaryOp(op)->get_lhs_operand()->set_parent(op); - isSgBinaryOp(op)->get_rhs_operand()->set_parent(op); - - std::vector a = substitute( - isSgBinaryOp(op)->get_lhs_operand(), sym, expr, root); - std::copy(a.begin(), a.end(), back_inserter(arrays)); - std::vector a1 = substitute( - isSgBinaryOp(op)->get_rhs_operand(), sym, expr, root); - std::copy(a1.begin(), a1.end(), back_inserter(arrays)); - } else if (isSgUnaryOp(op)) { - //isSgUnaryOp(op)->get_operand()->set_parent(op); - //std::string x = isSgNode(op)->unparseToString(); - //std::cout< a = substitute( - isSgUnaryOp(op)->get_operand(), sym, expr, root); - std::copy(a.begin(), a.end(), back_inserter(arrays)); - } else if (isSgVarRefExp(op)) { - std::string z = - isSgVarRefExp(op)->get_symbol()->get_name().getString(); - if (!strcmp(z.c_str(), y.c_str())) { - //isSgVarRefExp(op)->set_symbol(isSgVarRefExp(expr)->get_symbol()); - arrays.push_back(isSgVarRefExp(op)); - //replaceVariableReferences(root, isSgVarRefExp(in)->get_symbol(), temp); - //r = true; - } //end if - } //end else if - else if (isSgCallExpression(op)) { - SgExprListExp* exprs = isSgCallExpression(op)->get_args(); - SgExpressionPtrList &expr_list = exprs->get_expressions(); - - for (SgExpressionPtrList::iterator it = expr_list.begin(); - it != expr_list.end(); it++) { - std::vector a = substitute(isSgNode(*it), - sym, expr, root); - std::copy(a.begin(), a.end(), back_inserter(arrays)); - } - } else if (isSgExprListExp(op)) { // Manu:: fortran indices are stored this way - SgExpressionPtrList &expr_list = isSgExprListExp(op)->get_expressions(); - - for (SgExpressionPtrList::iterator it = expr_list.begin(); - it != expr_list.end(); it++) { - std::vector a = substitute(isSgNode(*it), - sym, expr, root); - std::copy(a.begin(), a.end(), back_inserter(arrays)); - } - - } - - //end else if - //else if(!isSgValueExp(op)) - // throw ir_error("unrecognized expression type"); - } //end else - } //end if - - /* bool r = false; - if (isSgVarRefExp(in) && (isSgVarRefExp(in)->get_symbol() == sym)) { - omega::CG_roseRepr *result = new omega::CG_roseRepr(expr); - SgExpression* expr1 = result->GetExpression(); - delete result; - SgVariableSymbol* temp = isSgVarRefExp(expr1)->get_symbol(); - parent->replace_expression(in, expr1); - replaceVariableReferences(root, isSgVarRefExp(in)->get_symbol(), temp); - r = true; - } - else if(isSgBinaryOp(in)){ - substitute(isSgBinaryOp(in)->get_lhs_operand(), sym, expr, root, in); - substitute(isSgBinaryOp(in)->get_rhs_operand(), sym, expr, root, in); - } - else if(isSgUnaryOp(in)) - substitute(isSgUnaryOp(in)->get_operand(), sym, expr, root, in); - - */ - - return arrays; -} - -/*bool substitute(SgStatement *tn, SgVariableSymbol *sym, SgExpression* expr, SgNode* root, SgSymbolTable* symtab) { - if (tn == NULL) - return false; - - bool r = false; - if( tn != NULL){ - if(isSgExpression(tn)){ - r = substitute(isSgExpression(tn), sym, expr, root, isSgExpression(tn)) || r; - - } - else { - omega::CG_roseRepr *result = new omega::CG_roseRepr(expr); - SgExpression* expr1 = result->GetExpression(); - tn->replace_expression(buildVarRefExp(sym), expr1); - for (unsigned i = 0; i < tn->get_numberOfTraversalSuccessors(); i++) - r = substitute(isSgStatement(tn->get_traversalSuccessorByIndex(i)), sym, expr, root, symtab) || r; - - } - } - return r; - } - - bool substitute(SgNode *tnl, SgVariableSymbol *sym, SgExpression* expr, SgNode* root, SgSymbolTable* symtab) { - if (tnl == NULL) - return false; - - bool r = false; - - for(int i=0; i < tnl->get_numberOfTraversalSuccessors(); i++){ - - SgNode* tn = tnl->get_traversalSuccessorByIndex(i); - r = substitute(isSgStatement(tn), sym, expr, root, symtab) || r; - } - - - return r; - } - */ - -} // namespace diff --git a/omega/code_gen/src/CG_roseRepr.cc b/omega/code_gen/src/CG_roseRepr.cc deleted file mode 100644 index 99cf973..0000000 --- a/omega/code_gen/src/CG_roseRepr.cc +++ /dev/null @@ -1,176 +0,0 @@ -/***************************************************************************** - Copyright (C) 2008 University of Southern California. - All Rights Reserved. - - Purpose: - omega holder for suif implementaion - - Notes: - - History: - 02/01/06 - Chun Chen - created -*****************************************************************************/ - -#include -#include -#include -#include -#include -namespace omega { - - - - -CG_roseRepr::CG_roseRepr(): tnl_(NULL), op_(NULL), list_(NULL){ - -} - -CG_roseRepr::CG_roseRepr(SgNode *tnl): tnl_(tnl), op_(NULL),list_(NULL) { -} - -CG_roseRepr::CG_roseRepr(SgExpression* op): tnl_(NULL), op_(op),list_(NULL){ -} -CG_roseRepr::CG_roseRepr(SgStatementPtrList* stmtlist):tnl_(NULL), op_(NULL), list_(stmtlist){ -} - -CG_roseRepr::~CG_roseRepr() { - // delete nothing here. operand or tree_node_list should already be - // grafted to other expression tree or statement list -} - -CG_outputRepr* CG_roseRepr::clone() const { - - if( tnl_ != NULL) { - SgTreeCopy tc; - SgNode *tnl = tnl_->copy(tc); - copyAttributes(tnl_, tnl); - - tnl->set_parent(tnl_->get_parent()); - return new CG_roseRepr(tnl); - } - else if(op_ != NULL) - { - SgTreeCopy tc1; - SgNode* op = isSgNode(op_)->copy(tc1); - copyAttributes(op_, op); - - op->set_parent(isSgNode(op_)->get_parent()); - return new CG_roseRepr(isSgExpression(op)); - } - else if(list_ != NULL) - { - SgStatementPtrList* list2 = new SgStatementPtrList; - - for(SgStatementPtrList::iterator it = (*list_).begin(); it != (*list_).end(); it++){ - SgTreeCopy tc3; - SgNode *tnl2 = isSgNode(*it)->copy(tc3); - copyAttributes(*it, tnl2); - - tnl2->set_parent(isSgNode(*it)->get_parent()); - - (*list2).push_back(isSgStatement(tnl2)); - } - return new CG_roseRepr(list2); - } - - return NULL; -} - -void CG_roseRepr::clear() { - if(tnl_ != NULL) { - delete tnl_; - tnl_ = NULL; - } -} - -SgNode* CG_roseRepr::GetCode() const { - return tnl_; -} - -SgStatementPtrList* CG_roseRepr::GetList() const { - return list_; -} - -SgExpression* CG_roseRepr::GetExpression() const { - return op_; -} -void CG_roseRepr::Dump() const { -SgNode* tnl = tnl_; -SgExpression* op = op_ ; - if(tnl != NULL) - DumpFileHelper(tnl, stdout); - else if(op != NULL) - DumpFileHelper(isSgNode(op), stdout); - -} - -void CG_roseRepr::DumpFileHelper(SgNode* node, FILE *fp) const{ - std::string x; - size_t numberOfSuccessors = node->get_numberOfTraversalSuccessors(); - if(numberOfSuccessors == 0){ - x = node->unparseToString (); - fprintf(fp, "%s", x.c_str()); - } - else{ - for (size_t idx = 0; idx < numberOfSuccessors; idx++) - { - SgNode *child = NULL; - child = node->get_traversalSuccessorByIndex(idx); - DumpFileHelper(child, fp); - } - -} -} - -/*void CG_roseRepr::DumpToFile(FILE *fp) const { -// std::string x; -SgNode* tnl = tnl_; -SgExpression* op = op_ ; - -if(tnl!= NULL){ - std::string x = tnl->unparseToString(); - fprintf(fp, "%s", x.c_str()); - -} -else if(op != NULL){ - std::string x = isSgNode(op)->unparseToString(); - fprintf(fp, "%s", x.c_str()); - - - -} -} -*/ -/* -SgNode* CG_roseRepr::copyAST ( SgNode* node ) -{ - -// This is a better implementation using a derived class from SgCopyHelp to control the -// copying process (skipping the copy of any function definition). This is a variable -// declaration with an explicitly declared class type. -class RestrictedCopyType : public SgCopyHelp - { - // DQ (9/26/2005): This class demonstrates the use of the copy mechanism - // within Sage III (originally designed and implemented by Qing Yi). - // One problem with it is that there is no context information permitted. - - public: - virtual SgNode *copyAst(const SgNode *n) - { - // This is the simpliest possible version of a deep copy SgCopyHelp::copyAst() member function. - SgNode *returnValue = n->copy(*this); - - return returnValue; - } - } restrictedCopyType; - - - - -// This triggers a bug with test2005_152.C (the unparsed code fails for g++ 4.1.2, but not 3.5.6) -SgNode* copyOfNode = node->copy(restrictedCopyType); -return copyOfNode; - -} -*/ -} // namespace diff --git a/omega/code_gen/src/CG_stringBuilder.cc b/omega/code_gen/src/CG_stringBuilder.cc deleted file mode 100644 index 2f9286f..0000000 --- a/omega/code_gen/src/CG_stringBuilder.cc +++ /dev/null @@ -1,487 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 the Omega Project Team - Copyright (C) 2005-2011 Chun Chen - All Rights Reserved. - - Purpose: - generate pseudo string code - - Notes: - There is no need to check illegal NULL parameter and throw invalid_argument - in other IR interface implementation. They are for debugging purpose. - intMod implements modular function that returns positve remainder no matter - lop is postive or nagative and rop is guranteed to be positive here. - - History: - 04/17/96 - Lei Zhou - created - 08/31/09 add parenthesis to string operands, Chun Chen -*****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include - -namespace { - -std::string SafeguardString(const std::string &s, char op) { - int len = s.length(); - int paren_level = 0; - int num_plusminus = 0; - int num_mul = 0; - int num_div = 0; - for (int i = 0; i < len; i++) - switch (s[i]) { - case '(': - paren_level++; - break; - case ')': - paren_level--; - break; - case '+': - case '-': - if (paren_level == 0) - num_plusminus++; - break; - case '*': - if (paren_level == 0) - num_mul++; - break; - case '/': - if (paren_level == 0) - num_div++; - break; - default: - break; - } - - bool need_paren = false; - switch (op) { - case '-': - if (num_plusminus > 0) - need_paren = true; - break; - case '*': - if (num_plusminus > 0 || num_div > 0) - need_paren = true; - break; - case '/': - if (num_plusminus > 0 || num_div > 0 || num_mul > 0) - need_paren = true; - break; - default: - break; - } - - if (need_paren) - return "(" + s + ")"; - else - return s; -} - - -std::string GetIndentSpaces(int indent) { - std::string indentStr; - for (int i = 1; i < indent; i++) { - indentStr += " "; - } - return indentStr; -} - - -// A shortcut to extract the string enclosed in the CG_outputRepr and delete -// the original holder. -std::string GetString(omega::CG_outputRepr *repr) { - std::string result = static_cast(repr)->GetString(); - delete repr; - return result; -} - -} - - -namespace omega { - - - -//----------------------------------------------------------------------------- -// Class: CG_stringBuilder -//----------------------------------------------------------------------------- - -CG_stringRepr *CG_stringBuilder::CreateSubstitutedStmt(int indent, CG_outputRepr *stmt, - const std::vector &vars, - std::vector &subs) const { - std::string listStr = ""; - - for (int i = 0; i < subs.size(); i++) { - if (subs[i] == NULL) - listStr += "N/A"; - else - listStr += GetString(subs[i]); - if (i < subs.size() - 1) - listStr += ","; - } - - std::string stmtName = GetString(stmt); - std::string indentStr = GetIndentSpaces(indent); - - return new CG_stringRepr(indentStr + stmtName + "(" + listStr + ");\n"); -} - -CG_stringRepr *CG_stringBuilder::CreateAssignment(int indent, - CG_outputRepr *lhs, - CG_outputRepr *rhs) const { - if (lhs == NULL || rhs == NULL) - throw std::invalid_argument("missing lhs or rhs in assignment"); - - std::string lhsStr = GetString(lhs); - std::string rhsStr = GetString(rhs); - - std::string indentStr = GetIndentSpaces(indent); - - return new CG_stringRepr(indentStr + lhsStr + "=" + rhsStr + ";\n"); -} - - -CG_stringRepr *CG_stringBuilder::CreateInvoke(const std::string &funcName, - std::vector &list) const { - std::string listStr = ""; - - for (int i = 0; i < list.size(); i++) { - listStr += GetString(list[i]); - if ( i < list.size()-1) - listStr += ","; - } - - return new CG_stringRepr(funcName + "(" + listStr + ")"); -} - - -CG_stringRepr *CG_stringBuilder::CreateComment(int indent, const std::string &commentText) const { - if (commentText == std::string("")) { - return NULL; - } - - std::string indentStr = GetIndentSpaces(indent); - - return new CG_stringRepr(indentStr + "// " + commentText + "\n"); -} - -CG_stringRepr* CG_stringBuilder::CreateAttribute(CG_outputRepr *control, - const std::string &commentText) const { - if (commentText == std::string("")) { - return static_cast (control); - } - - std::string controlString = GetString(control); - - return new CG_stringRepr("// " + commentText + "\n" + controlString); - -} - -CG_outputRepr* CG_stringBuilder::CreatePragmaAttribute(CG_outputRepr *scopeStmt, int looplevel, const std::string &pragmaText) const { - // -- Not Implemented - return scopeStmt; -} - -CG_outputRepr* CG_stringBuilder::CreatePrefetchAttribute(CG_outputRepr* scopeStmt, int looplevel, const std::string& arrName, int hint) const { - // -- Not Implemented - return scopeStmt; -} - -CG_stringRepr *CG_stringBuilder::CreateIf(int indent, CG_outputRepr *guardList, - CG_outputRepr *true_stmtList, CG_outputRepr *false_stmtList) const { - if (guardList == NULL) - throw std::invalid_argument("missing if condition"); - - if (true_stmtList == NULL && false_stmtList == NULL) { - delete guardList; - return NULL; - } - - std::string guardListStr = GetString(guardList); - std::string indentStr = GetIndentSpaces(indent); - std::string s; - if (true_stmtList != NULL && false_stmtList == NULL) { - s = indentStr + "if (" + guardListStr + ") {\n" - + GetString(true_stmtList) - + indentStr + "}\n"; - } - else if (true_stmtList == NULL && false_stmtList != NULL) { - s = indentStr + "if !(" + guardListStr + ") {\n" - + GetString(false_stmtList) - + indentStr + "}\n"; - } - else { - s = indentStr + "if (" + guardListStr + ") {\n" - + GetString(true_stmtList) - + indentStr + "}\n" - + indentStr + "else {\n" - + GetString(false_stmtList) - + indentStr + "}\n"; - } - - return new CG_stringRepr(s); -} - - - -CG_stringRepr *CG_stringBuilder::CreateInductive(CG_outputRepr *index, - CG_outputRepr *lower, CG_outputRepr *upper, - CG_outputRepr *step) const { - if (index == NULL) - throw std::invalid_argument("missing loop index"); - if (lower == NULL) - throw std::invalid_argument("missing loop lower bound"); - if (upper == NULL) - throw std::invalid_argument("missing loop upper bound"); - if (step == NULL) - throw std::invalid_argument("missing loop step size"); - - std::string indexStr = GetString(index); - std::string lowerStr = GetString(lower); - std::string upperStr = GetString(upper); - - std::string doStr = "for(" + indexStr + " = " + lowerStr + "; " - + indexStr + " <= " + upperStr + "; " - + indexStr; - - std::string stepStr = GetString(step); - if (stepStr == to_string(1)) - doStr += "++"; - else - doStr += " += " + stepStr; - - doStr += ")"; - - return new CG_stringRepr(doStr); -} - - -CG_stringRepr *CG_stringBuilder::CreateLoop(int indent, CG_outputRepr *control, - CG_outputRepr *stmtList) const { - if (stmtList == NULL) { - delete control; - return NULL; - } - else if (control == NULL) - return static_cast(stmtList); - - std::string ctrlStr = GetString(control); - std::string stmtStr = GetString(stmtList); - - std::string indentStr = GetIndentSpaces(indent); - - std::string s = indentStr + ctrlStr + " {\n" - + stmtStr - + indentStr + "}\n"; - - return new CG_stringRepr(s); -} - - - -CG_stringRepr *CG_stringBuilder::CreateInt(int num) const { - std::string s = to_string(num); - return new CG_stringRepr(s); -} - - - -bool CG_stringBuilder::isInteger(CG_outputRepr *op) const { - - char * cstr; - std::string s = GetString(op); - cstr = new char [s.size()+1]; - strcpy (cstr, s.c_str()); - int count = 0; - while(cstr[count] != '\n' && cstr[count] != '\0' ) - if( !isdigit(cstr[count])) - return false; - - - return true; -} - - - -CG_stringRepr *CG_stringBuilder::CreateIdent(const std::string &varName) const { - if (varName == std::string("")) { - return NULL; - } - - return new CG_stringRepr(varName); -} - - -CG_stringRepr *CG_stringBuilder::CreatePlus(CG_outputRepr *lop, CG_outputRepr *rop) const { - if (rop == NULL) { - return static_cast(lop); - } - else if (lop == NULL) { - return static_cast(rop); - } - - std::string lopStr = GetString(lop); - std::string ropStr = GetString(rop); - - return new CG_stringRepr(lopStr + "+" + ropStr); -} - - -CG_stringRepr *CG_stringBuilder::CreateMinus(CG_outputRepr *lop, CG_outputRepr *rop) const { - if (rop == NULL) { - return static_cast(lop); - } - else if (lop == NULL) { - std::string ropStr = GetString(rop); - return new CG_stringRepr("-" + SafeguardString(ropStr, '-')); - } - - std::string lopStr = GetString(lop); - std::string ropStr = GetString(rop); - - return new CG_stringRepr(lopStr + "-" + SafeguardString(ropStr, '-')); -} - - -CG_stringRepr *CG_stringBuilder::CreateTimes(CG_outputRepr *lop, CG_outputRepr *rop) const { - if (rop == NULL || lop == NULL) { - delete rop; - delete lop; - return NULL; - } - - std::string lopStr = GetString(lop); - std::string ropStr = GetString(rop); - - return new CG_stringRepr(SafeguardString(lopStr, '*') + "*" + SafeguardString(ropStr, '*')); -} - - -CG_stringRepr *CG_stringBuilder::CreateDivide(CG_outputRepr *lop, CG_outputRepr *rop) const { - if (rop == NULL) - throw codegen_error("integer division by zero"); - else if (lop == NULL) { - delete rop; - return NULL; - } - - std::string lopStr = GetString(lop); - std::string ropStr = GetString(rop); - - return new CG_stringRepr(SafeguardString(lopStr, '/') + "/" + SafeguardString(ropStr, '/')); -} - - -CG_stringRepr *CG_stringBuilder::CreateIntegerFloor(CG_outputRepr *lop, CG_outputRepr *rop) const { - if (rop == NULL) - throw codegen_error("integer division by zero"); - else if (lop == NULL) { - delete rop; - return NULL; - } - - std::string lopStr = GetString(lop); - std::string ropStr = GetString(rop); - - return new CG_stringRepr("intFloor(" + lopStr + "," + ropStr + ")"); -} - - -CG_stringRepr *CG_stringBuilder::CreateIntegerMod(CG_outputRepr *lop, CG_outputRepr *rop) const { - if (rop == NULL) - throw codegen_error("integer modulo by zero"); - else if (lop == NULL) { - delete rop; - return NULL; - } - - std::string lopStr = GetString(lop); - std::string ropStr = GetString(rop); - - return new CG_stringRepr("intMod(" + lopStr + "," + ropStr + ")"); -} - -CG_stringRepr *CG_stringBuilder::CreateIntegerCeil(CG_outputRepr *lop, CG_outputRepr *rop) const { - if (rop == 0) - throw codegen_error("integer ceiling by zero"); - else if (lop == NULL) { - delete rop; - return NULL; - } - - std::string lopStr = GetString(lop); - std::string ropStr = GetString(rop); - - return new CG_stringRepr("intCeil(" + lopStr + "," + ropStr + ")"); -} - - -CG_stringRepr *CG_stringBuilder::CreateAnd(CG_outputRepr *lop, CG_outputRepr *rop) const { - if (rop == NULL) - return static_cast(lop); - else if (lop == NULL) - return static_cast(rop); - - std::string lopStr = GetString(lop); - std::string ropStr = GetString(rop); - - return new CG_stringRepr(lopStr + " && " + ropStr); -} - - -CG_stringRepr *CG_stringBuilder::CreateGE(CG_outputRepr *lop, CG_outputRepr *rop) const { - if (rop == NULL || lop == NULL) - throw std::invalid_argument("missing operand in greater than equal comparison condition"); - - std::string lopStr = GetString(lop); - std::string ropStr = GetString(rop); - - return new CG_stringRepr(lopStr + " >= " + ropStr); -} - - - -CG_stringRepr *CG_stringBuilder::CreateLE(CG_outputRepr *lop, CG_outputRepr *rop) const { - if (rop == NULL || lop == NULL) - throw std::invalid_argument("missing operand in less than equal comparison condition"); - - std::string lopStr = GetString(lop); - std::string ropStr = GetString(rop); - - return new CG_stringRepr(lopStr + " <= " + ropStr); -} - - - -CG_stringRepr *CG_stringBuilder::CreateEQ(CG_outputRepr *lop, CG_outputRepr *rop) const { - if (rop == NULL || lop == NULL) - throw std::invalid_argument("missing operand in equal comparison condition"); - - std::string lopStr = GetString(lop); - std::string ropStr = GetString(rop); - - return new CG_stringRepr(lopStr + " == " + ropStr); -} - - - -CG_stringRepr *CG_stringBuilder::StmtListAppend(CG_outputRepr *list1, CG_outputRepr *list2) const { - if (list2 == NULL) { - return static_cast(list1); - } - else if (list1 == NULL) { - return static_cast(list2); - } - - std::string list1Str = GetString(list1); - std::string list2Str = GetString(list2); - - return new CG_stringRepr(list1Str + list2Str); -} - -} diff --git a/omega/code_gen/src/CG_stringRepr.cc b/omega/code_gen/src/CG_stringRepr.cc deleted file mode 100644 index 63a1657..0000000 --- a/omega/code_gen/src/CG_stringRepr.cc +++ /dev/null @@ -1,54 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 University of Maryland - Copyright (C) 2008 University of Southern California - Copyright (C) 2009 University of Utah - All Rights Reserved. - - Purpose: - omega holder for string implementation. - - Notes: - - History: - 04/17/96 - Lei Zhou - created -*****************************************************************************/ - -#include -#include - -namespace omega { - -CG_stringRepr::CG_stringRepr() { -} - -CG_stringRepr::CG_stringRepr(const std::string& _s) : s(_s) { -} - -CG_stringRepr::~CG_stringRepr() { -} - -CG_outputRepr* CG_stringRepr::clone() { - return new CG_stringRepr(s); -} - - -//----------------------------------------------------------------------------- -// basic operation -//----------------------------------------------------------------------------- -std::string CG_stringRepr::GetString() const { - return s; -} - - -//----------------------------------------------------------------------------- -// Dump operations -//----------------------------------------------------------------------------- -void CG_stringRepr::Dump() const { - printf("%s\n", s.c_str()); -} - -void CG_stringRepr::DumpToFile(FILE *fp) const { - fprintf(fp,"%s", s.c_str()); -} - -} // namespace diff --git a/omega/code_gen/src/CG_suifBuilder.cc b/omega/code_gen/src/CG_suifBuilder.cc deleted file mode 100644 index 6bb91b7..0000000 --- a/omega/code_gen/src/CG_suifBuilder.cc +++ /dev/null @@ -1,678 +0,0 @@ -/***************************************************************************** - Copyright (C) 2008 University of Southern California - Copyright (C) 2009-2010 University of Utah - All Rights Reserved. - - Purpose: - generate suif code for omega - - Notes: - - History: - 02/01/06 created by Chun Chen -*****************************************************************************/ - -#include -#include -#include -#include - -namespace omega { - -//----------------------------------------------------------------------------- -// make suif initilization happy -//----------------------------------------------------------------------------- -char *k_ocg_comment; -char *k_s2c_pragma; -char *k_cuda_dim3; -char *k_cuda_kernel; -char *k_cuda_modifier; -char *k_cuda_texture_memory; //protonu--added to track texture memory type - -// void __attribute__ ((constructor)) my_init(void) { -// ANNOTE(k_ocg_comment, "omega_comment", TRUE); -// } - -//protonu--extern decls -//protonu--adding stuff to make Chun's code work with Gabe's -extern Tuple< Tuple > smtNonSplitLevels; -extern Tuple< Tuple > loopIdxNames;//per stmt -extern std::vector< std::pair > syncs; -extern int checkLoopLevel; -extern int stmtForLoopCheck; -extern int upperBoundForLevel; -extern int lowerBoundForLevel; -extern bool fillInBounds; - - -const char *libcode_gen_ver_string = ""; -const char *libcode_gen_who_string = ""; -const char *libcode_gen_suif_string = ""; - - -void init_code_gen() { - static bool isInit = false; - if(!isInit) - { - isInit = true; - ANNOTE(k_ocg_comment, "omega_comment", TRUE); - ANNOTE(k_s2c_pragma, "s2c pragma", TRUE); - ANNOTE(k_cuda_dim3, "cuda dim3", TRUE); - ANNOTE(k_cuda_kernel, "cuda kernel", TRUE); - ANNOTE(k_cuda_modifier, "cuda modifier", TRUE); - } -} - - -void exit_code_gen(void) { -} - - -//----------------------------------------------------------------------------- -// Class: CG_suifBuilder -//----------------------------------------------------------------------------- - -CG_suifBuilder::CG_suifBuilder(proc_symtab *symtab) -{ - symtab_ = symtab; - init_code_gen(); -} - -CG_outputRepr* CG_suifBuilder::CreatePlaceHolder (int, CG_outputRepr *stmt, - Tuple &funcList, Tuple &loop_vars) const { - tree_node_list *tnl = static_cast(stmt)->tnl_; - delete stmt; - - for (int i = 1; i <= funcList.size(); i++) { - if (funcList[i] == NULL) - continue; - - CG_suifRepr *repr = static_cast(funcList[i]); - operand op = repr->op_; - delete repr; - - var_sym *vs = static_cast(symtab_->lookup_sym(loop_vars[i].c_str(), SYM_VAR)); - - substitute(tnl, vs, op, symtab_); - - if (op.is_instr()) - delete op.instr(); - } - - return new CG_suifRepr(tnl); -} - - -CG_outputRepr* CG_suifBuilder::CreateAssignment(int, CG_outputRepr *lhs, - CG_outputRepr *rhs) const { - if ( lhs == NULL || rhs == NULL ) { - fprintf(stderr, "Code generation: Missing lhs or rhs\n"); - return NULL; - } - - operand src = static_cast(rhs)->op_; - if (src.is_instr() && src.instr()->opcode() == io_array) { - in_array *ia = static_cast(src.instr()); - instruction *ins = new in_rrr(io_lod, ia->elem_type(), operand(), ia); - src = operand(ins); - } - - instruction *ins; - operand dst = static_cast(lhs)->op_; - if (dst.is_instr() && dst.instr()->opcode() == io_array) { - in_array *ia = static_cast(dst.instr()); - ins = new in_rrr(io_str, type_void, operand(), operand(ia), src); - } - else - ins = new in_rrr(io_cpy, src.type(), dst, src); - - delete lhs; - delete rhs; - - tree_node_list *tnl = new tree_node_list; - tnl->append(new tree_instr(ins)); - - return new CG_suifRepr(tnl); -} - - -CG_outputRepr* CG_suifBuilder::CreateInvoke(const std::string &fname, - Tuple &list) const { - if (fname == std::string("max") || fname == std::string("min")) { - if (list.size() == 0) { - return NULL; - } - else if (list.size() == 1) { - return list[1]; - } - else { - int last = list.size(); - operand op2 = static_cast(list[last])->op_; - delete list[last]; - list.delete_last(); - CG_suifRepr *repr = static_cast(CreateInvoke(fname, list)); - operand op1 = repr->op_; - - instruction *ins; - if (fname == std::string("max")) - ins = new in_rrr(io_max, op1.type(), operand(), op1, op2); - else - ins = new in_rrr(io_min, op1.type(), operand(), op1, op2); - - repr->op_ = operand(ins); - - return repr; - } - } - else { - fprintf(stderr, "Code generation: invoke function io_call not implemented\n"); - return NULL; - } -} - - -CG_outputRepr* CG_suifBuilder::CreateAttribute(CG_outputRepr *control, - const std::string &commentText)const { - if (commentText == std::string("")) { - return control; - } - - instruction *ins = new in_rrr(io_mrk); - - immed_list *iml = new immed_list; - iml->append(immed(const_cast(commentText.c_str()))); - ins->prepend_annote(k_ocg_comment, iml); - - tree_node_list *tnl ; - tnl = static_cast(control)->tnl_; - tnl->append(new tree_instr(ins)); - - - return new CG_suifRepr(tnl); - - -} - - - -CG_outputRepr* CG_suifBuilder::CreateComment(int, const std::string &commentText) const { - if ( commentText == std::string("") ) { - return NULL; - } - - instruction *ins = new in_rrr(io_mrk); - - immed_list *iml = new immed_list; - iml->append(immed(const_cast(commentText.c_str()))); - ins->prepend_annote(k_ocg_comment, iml); - - tree_node_list *tnl = new tree_node_list; - tnl->append(new tree_instr(ins)); - - return new CG_suifRepr(tnl); -} - - -CG_outputRepr* CG_suifBuilder::CreateIf(int, CG_outputRepr *guardList, - CG_outputRepr *true_stmtList, CG_outputRepr *false_stmtList) const { - static int if_counter = 1; - std::string s = std::string("omegaif_")+to_string(if_counter++); - label_sym *if_label = new label_sym(const_cast(s.c_str())); - symtab_->add_sym(if_label); - - if ( true_stmtList == NULL && false_stmtList == NULL ) { - delete guardList; - return NULL; - } - else if ( guardList == NULL ) { - return StmtListAppend(true_stmtList, false_stmtList); - } - - tree_node_list *header = new tree_node_list; - operand op = static_cast(guardList)->op_; - - std::stack S; - S.push(op.instr()); - while(!S.empty()) { - instruction *ins = static_cast(S.top()); - S.pop(); - if (ins->opcode() == io_and) { - instruction *ins1 = ins->src_op(0).instr(); - ins1->remove(); - S.push(ins1); - instruction *ins2 = ins->src_op(1).instr(); - ins2->remove(); - S.push(ins2); - delete ins; - } - else { - ins = new in_bj(io_bfalse, if_label, operand(ins)); - header->append(new tree_instr(ins)); - } - } - - tree_node_list *then_part, *else_part; - if (true_stmtList != NULL) - then_part = static_cast(true_stmtList)->tnl_; - else - then_part = NULL; - if (false_stmtList != NULL) - else_part = static_cast(false_stmtList)->tnl_; - else - else_part = NULL; - tree_if *ti = new tree_if(if_label, header, then_part, else_part); - - tree_node_list *tnl = new tree_node_list; - tnl->append(ti); - - delete guardList; - delete true_stmtList; - delete false_stmtList; - - return new CG_suifRepr(tnl); -} - - -CG_outputRepr* CG_suifBuilder::CreateInductive(CG_outputRepr *index, - CG_outputRepr *lower, - CG_outputRepr *upper, - CG_outputRepr *step) const { - if ( index == NULL || lower == NULL || upper == NULL ) { - fprintf(stderr, "Code generation: something wrong in CreateInductive\n"); - return NULL; - } - - if (step == NULL) - step = CreateInt(1); - - var_sym *index_sym = static_cast(index)->op_.symbol(); - operand lower_bound = static_cast(lower)->op_; - operand upper_bound = static_cast(upper)->op_; - operand step_size = static_cast(step)->op_; - - label_sym *contLabel = new label_sym(""); - label_sym *brkLabel = new label_sym(""); - symtab_->add_sym(contLabel); - symtab_->add_sym(brkLabel); - tree_for *tf = new tree_for(index_sym, FOR_SLTE, contLabel, brkLabel, NULL, - lower_bound, upper_bound, step_size, NULL); - - tree_node_list *tnl = new tree_node_list; - tnl->append(tf); - - delete index; - delete lower; - delete upper; - delete step; - - return new CG_suifRepr(tnl); -} - - -CG_outputRepr* CG_suifBuilder::CreateLoop(int, CG_outputRepr *control, - CG_outputRepr *stmtList) const { - if ( stmtList == NULL ) { - delete control; - return NULL; - } - else if ( control == NULL ) { - fprintf(stderr, "Code generation: no inductive for this loop\n"); - return stmtList; - } - - tree_node_list *tnl = static_cast(control)->tnl_; - tree_node_list_iter iter(tnl); - tree_for *tf = static_cast(iter.step()); - - tree_node_list *body = static_cast(stmtList)->tnl_; - tf->set_body(body); - - delete stmtList; - - return control; -} - - -CG_outputRepr* CG_suifBuilder::CreateInt(int _i) const { - in_ldc *ins = new in_ldc(type_s32, operand(), immed(_i)); - - return new CG_suifRepr(operand(ins)); -} - - -CG_outputRepr* CG_suifBuilder::CreateIdent(const std::string &_s) const { - if ( &_s == NULL || _s == std::string("") ) { - return NULL; - } - - var_sym *vs = static_cast(symtab_->lookup_sym(_s.c_str(), SYM_VAR)); - - if (vs == NULL) { - vs = new var_sym(type_s32, const_cast(_s.c_str())); - symtab_->add_sym(vs); - } - - return new CG_suifRepr(operand(vs)); -} - - -CG_outputRepr* CG_suifBuilder::CreatePlus(CG_outputRepr *lop, - CG_outputRepr *rop) const { - if ( rop == NULL ) { - return lop; - } - else if ( lop == NULL ) { - return rop; - } - - operand op1 = static_cast(lop)->op_; - operand op2 = static_cast(rop)->op_; - - instruction *ins = new in_rrr(io_add, op1.type(), operand(), op1, op2); - - delete lop; - delete rop; - - return new CG_suifRepr(operand(ins)); -} - - -CG_outputRepr* CG_suifBuilder::CreateMinus(CG_outputRepr *lop, - CG_outputRepr *rop) const { - if ( rop == NULL ) { - return lop; - } - else if ( lop == NULL ) { - operand op = static_cast(rop)->op_; - instruction *ins = new in_rrr(io_neg, op.type(), operand(), op); - - delete rop; - - return new CG_suifRepr(operand(ins)); - } - else { - operand op1 = static_cast(lop)->op_; - operand op2 = static_cast(rop)->op_; - - instruction *ins = new in_rrr(io_sub, op1.type(), operand(), op1, op2); - - delete lop; - delete rop; - - return new CG_suifRepr(operand(ins)); - } -} - - -CG_outputRepr* CG_suifBuilder::CreateTimes(CG_outputRepr *lop, - CG_outputRepr *rop) const { - if ( rop == NULL || lop == NULL) { - if (rop != NULL) { - rop->clear(); - delete rop; - } - if (lop != NULL) { - lop->clear(); - delete lop; - } - return NULL; - } - - operand op1 = static_cast(lop)->op_; - operand op2 = static_cast(rop)->op_; - - instruction *ins = new in_rrr(io_mul, op1.type(), operand(), op1, op2); - - delete lop; - delete rop; - - return new CG_suifRepr(operand(ins)); -} - - -CG_outputRepr* CG_suifBuilder::CreateIntegerDivide(CG_outputRepr *lop, - CG_outputRepr *rop) const { - if ( rop == NULL ) { - fprintf(stderr, "Code generation: divide by NULL\n"); - return NULL; - } - else if ( lop == NULL ) { - delete rop; - return NULL; - } - - // (6+5)*10 / 4 - operand op1 = static_cast(lop)->op_; - operand op2 = static_cast(rop)->op_; - - // bugs in SUIF prevent use of correct io_divfloor - instruction *ins = new in_rrr(io_div, op1.type(), operand(), op1, op2); - - delete lop; - delete rop; - - return new CG_suifRepr(operand(ins)); -} - - -CG_outputRepr* CG_suifBuilder::CreateIntegerMod(CG_outputRepr *lop, - CG_outputRepr *rop) const { - if ( rop == NULL || lop == NULL ) { - return NULL; - } - - operand op1 = static_cast(lop)->op_; - operand op2 = static_cast(rop)->op_; - - // bugs in SUIF prevent use of correct io_mod - instruction *ins = new in_rrr(io_rem, type_s32, operand(), op1, op2); - - delete lop; - delete rop; - - return new CG_suifRepr(operand(ins)); -} - - -CG_outputRepr* CG_suifBuilder::CreateAnd(CG_outputRepr *lop, - CG_outputRepr *rop) const { - if (rop == NULL) - return lop; - else if (lop == NULL) - return rop; - - operand op1 = static_cast(lop)->op_; - operand op2 = static_cast(rop)->op_; - - instruction *ins = new in_rrr(io_and, op1.type(), operand(), op1, op2); - - delete lop; - delete rop; - - return new CG_suifRepr(operand(ins)); -} - - -CG_outputRepr* CG_suifBuilder::CreateGE(CG_outputRepr *lop, - CG_outputRepr *rop) const { - return CreateLE(rop, lop); -} - - -CG_outputRepr* CG_suifBuilder::CreateLE(CG_outputRepr *lop, - CG_outputRepr *rop) const { - if ( rop == NULL || lop == NULL ) { - return NULL; - } - - operand op1 = static_cast(lop)->op_; - operand op2 = static_cast(rop)->op_; - - instruction *ins = new in_rrr(io_sle, type_s32, operand(), op1, op2); - - delete lop; - delete rop; - - return new CG_suifRepr(operand(ins)); -} - - -CG_outputRepr* CG_suifBuilder::CreateEQ(CG_outputRepr *lop, - CG_outputRepr *rop) const { - if ( rop == NULL || lop == NULL ) { - return NULL; - } - - operand op1 = static_cast(lop)->op_; - operand op2 = static_cast(rop)->op_; - - instruction *ins = new in_rrr(io_seq, type_s32, operand(), op1, op2); - - delete lop; - delete rop; - - return new CG_suifRepr(operand(ins)); -} - - - -CG_outputRepr* CG_suifBuilder::StmtListAppend(CG_outputRepr *list1, - CG_outputRepr *list2) const { - if ( list2 == NULL ) { - return list1; - } - else if ( list1 == NULL ) { - return list2; - } - - tree_node_list *tnl1 = static_cast(list1)->tnl_; - tree_node_list *tnl2 = static_cast(list2)->tnl_; - if (tnl2 == NULL) - tnl1->append(new tree_instr(static_cast(list2)->op_.instr())); - else - tnl1->append(tnl2); - - delete list2; - - return list1; -} - -//protonu--Gabe's stuff added here -//----------------------------------------------------------------------------- -// pragma generation -// TODO: Could allow for a immed_list* instead of a String for strongly typed prgma args -//----------------------------------------------------------------------------- -CG_outputRepr* CG_suifBuilder::CreatePragma(int, - const std::string &pragmaText) const { - if ( pragmaText == std::string("") ) { - return NULL; - } - instruction *ins = new in_rrr(io_mrk); - immed_list *iml = new immed_list; - iml->append(immed(const_cast(pragmaText.c_str()))); - ins->append_annote(k_s2c_pragma, iml); - tree_node_list *tnl = new tree_node_list; - tnl->append(new tree_instr(ins)); - return new CG_suifRepr(tnl); -} - -CG_outputRepr* CG_suifBuilder::CreateDim3(immed varName, immed arg1, immed arg2) const { - instruction *ins = new in_rrr(io_mrk); - immed_list *iml = new immed_list; - iml->append(immed(varName)); - iml->append(arg1); - iml->append(arg2); - ins->append_annote(k_cuda_dim3, iml); - tree_node_list *tnl = new tree_node_list; - tnl->append(new tree_instr(ins)); - return new CG_suifRepr(tnl); -} - -CG_outputRepr* CG_suifBuilder::CreateDim3(immed varName, immed arg1, immed arg2, immed arg3) const { - instruction *ins = new in_rrr(io_mrk); - immed_list *iml = new immed_list; - iml->append(immed(varName)); - iml->append(arg1); - iml->append(arg2); - iml->append(arg3); - ins->append_annote(k_cuda_dim3, iml); - tree_node_list *tnl = new tree_node_list; - tnl->append(new tree_instr(ins)); - return new CG_suifRepr(tnl); -} - -CG_outputRepr* CG_suifBuilder::CreateKernel(immed_list* iml) const { - instruction *ins = new in_rrr(io_mrk); - ins->append_annote(k_cuda_kernel, iml); - tree_node_list *tnl = new tree_node_list; - tnl->append(new tree_instr(ins)); - return new CG_suifRepr(tnl); -} - -type_node* CG_suifBuilder::ModifyType(type_node* base, const char* modifier) const { - modifier_type* result = new modifier_type(TYPE_NULL, base); - immed_list *iml = new immed_list; - iml->append(immed((char*)modifier)); - result->append_annote(k_cuda_modifier, iml); - return result; -} -//end-protonu - - -//----------------------------------------------------------------------------- -// suif utility -//----------------------------------------------------------------------------- - -bool substitute(instruction *in, var_sym *sym, operand expr, base_symtab *st) { - if (in == NULL || sym == NULL) - return false; - - bool r = false; - for (unsigned i = 0; i < in->num_srcs(); i++) { - operand op(in->src_op(i)); - - if (op.is_symbol() && op.symbol() == sym) { - in->set_src_op(i, expr.clone(st)); - r = true; - } - else if (op.is_instr()) { - r = substitute(op.instr(), sym, expr, st) || r; - } - } - - return r; -} - -bool substitute(tree_node *tn, var_sym *sym, operand expr, base_symtab *st) { - if (tn == NULL) - return false; - - bool r = false; - if (tn->kind() == TREE_INSTR) - r = substitute(static_cast(tn)->instr(), sym, expr, st) || r; - else { - for (unsigned i = 0; i < tn->num_child_lists(); i++) { - r = substitute(tn->child_list_num(i), sym, expr, st) || r; - } - } - - return r; -} - -bool substitute(tree_node_list *tnl, var_sym *sym, operand expr, - base_symtab *st) { - if (tnl == NULL) - return false; - - bool r = false; - tree_node_list_iter iter(tnl); - while (!iter.is_empty()) { - tree_node *tn = iter.step(); - - r = substitute(tn, sym, expr, st) || r; - } - - return r; -} - -} diff --git a/omega/code_gen/src/CG_suifRepr.cc b/omega/code_gen/src/CG_suifRepr.cc deleted file mode 100644 index f4f987d..0000000 --- a/omega/code_gen/src/CG_suifRepr.cc +++ /dev/null @@ -1,81 +0,0 @@ -/***************************************************************************** - Copyright (C) 2008 University of Southern California. - All Rights Reserved. - - Purpose: - omega holder for suif implementaion - - Notes: - - History: - 02/01/06 - Chun Chen - created -*****************************************************************************/ - -#include -#include - -namespace omega { - -CG_suifRepr::CG_suifRepr(): tnl_(NULL), op_() { -} - -CG_suifRepr::CG_suifRepr(tree_node_list *tnl): tnl_(tnl),op_() { -} - -CG_suifRepr::CG_suifRepr(operand op): tnl_(NULL), op_(op) { -} - -CG_suifRepr::~CG_suifRepr() { - // delete nothing here. operand or tree_node_list should already be - // grafted to other expression tree or statement list -} - -CG_outputRepr* CG_suifRepr::clone() { - if (!op_.is_null() ) { - operand op = op_.clone(); - return new CG_suifRepr(op); - } - else if (tnl_ != NULL) { - tree_node_list *tnl = tnl_->clone(); - return new CG_suifRepr(tnl); - } - else - return new CG_suifRepr(); -} - -void CG_suifRepr::clear() { - if (!op_.is_null()) { - if (op_.is_instr()) - delete op_.instr(); - op_.set_null(); - } - else if (tnl_ != NULL) { - delete tnl_; - tnl_ = NULL; - } -} - -tree_node_list* CG_suifRepr::GetCode() const { - return tnl_; -} - -operand CG_suifRepr::GetExpression() const { - return op_; -} - -void CG_suifRepr::Dump() const { - if (tnl_ != NULL) - tnl_->print(); - else if (!op_.is_null()) - op_.print(); -} - -void CG_suifRepr::DumpToFile(FILE *fp) const { - if (tnl_ != NULL) - tnl_->print(fp); - else if (!op_.is_null()) - op_.print(fp); -} - - -} // namespace diff --git a/omega/code_gen/src/CG_utils.cc b/omega/code_gen/src/CG_utils.cc deleted file mode 100755 index d3a5f71..0000000 --- a/omega/code_gen/src/CG_utils.cc +++ /dev/null @@ -1,1735 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 the Omega Project Team - Copyright (C) 2005-2011 Chun Chen - All Rights Reserved. - - Purpose: - Utility functions for processing CG tree. - - Notes: - - History: - 07/19/07 when generating output variable substitutions for a mapping - relation, map it to each output to get correct equality, -chun - 07/29/10 when translating equality to assignment, generate appropriate - if-condition when necesssary, -chun -*****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include - -namespace omega { - -int checkLoopLevel; -int stmtForLoopCheck; -int upperBoundForLevel; -int lowerBoundForLevel; -bool fillInBounds; - -//trick to static init checkLoopLevel to 0 -class JunkStaticInit{ public: JunkStaticInit(){ checkLoopLevel=0; fillInBounds=false;} }; -static JunkStaticInit junkInitInstance__; - - - - -namespace { - -Relation find_best_guard(const Relation &R, const BoolSet<> &active, const std::map &guards) { - std::pair best_cost = std::make_pair(0, 0); - Relation best_cond = Relation::True(R.n_set()); - - Relation r = copy(R); - int max_iter_count = 2*(r.single_conjunct()->n_EQs()) + r.single_conjunct()->n_GEQs(); - int iter_count = 0; - while (!r.is_obvious_tautology()) { - std::pair cost = std::make_pair(0, 0); - Relation cond = pick_one_guard(r); - Relation complement_cond = Complement(copy(cond)); - complement_cond.simplify(); - for (BoolSet<>::const_iterator i = active.begin(); i != active.end(); i++) { - std::map::const_iterator j = guards.find(*i); - if (j == guards.end()) - continue; - if (Must_Be_Subset(copy(j->second), copy(cond))) - cost.first++; - else if (Must_Be_Subset(copy(j->second), copy(complement_cond))) - cost.second++; - } - if (cost > best_cost) { - best_cost = cost; - best_cond = copy(cond); - } - r = Gist(r, cond, 1); - - if (iter_count > max_iter_count) - throw codegen_error("guard condition too complex to handle"); - - iter_count++; - } - - return best_cond; -} - - -Relation find_best_guard(const Relation &R, const std::vector &loops, int start, int end) { - std::pair best_cost = std::make_pair(0, 0); - Relation best_cond = Relation::True(R.n_set()); - - Relation r = copy(R); - int max_iter_count = 2*(r.single_conjunct()->n_EQs()) + r.single_conjunct()->n_GEQs(); - int iter_count = 0; - while (!r.is_obvious_tautology()) { - std::pair cost = std::make_pair(0, 0); - Relation cond = pick_one_guard(r); - int i = start; - for ( ; i < end; i++) { - if (Must_Be_Subset(copy(loops[i]->guard_), copy(cond))) - cost.first++; - else - break; - } - Relation complement_cond = Complement(copy(cond)); - complement_cond.simplify(); - for (int j = i; j < end; j++) - if (Must_Be_Subset(copy(loops[j]->guard_), copy(complement_cond))) - cost.second++; - else - break; - - if (cost > best_cost) { - best_cost = cost; - best_cond = copy(cond); - } - r = Gist(r, cond, 1); - - if (iter_count > max_iter_count) - throw codegen_error("guard condition too complex to handle"); - - iter_count++; - } - - return best_cond; -} - -} - -bool bound_must_hit_stride(const GEQ_Handle &inequality, Variable_ID v, const EQ_Handle &stride_eq, Variable_ID wc, const Relation &bounds, const Relation &known) { - assert(inequality.get_coef(v) != 0 && abs(stride_eq.get_coef(v)) == 1 && wc->kind() == Wildcard_Var && abs(stride_eq.get_coef(wc)) > 1); - - // if bound expression uses floor operation, bail out for now - // TODO: in the future, handle this - if (abs(inequality.get_coef(v)) != 1) - return false; - - coef_t stride = abs(stride_eq.get_coef(wc)); - - Relation r1(known.n_set()); - F_Exists *f_exists1 = r1.add_and()->add_exists(); - F_And *f_root1 = f_exists1->add_and(); - std::map exists_mapping1; - EQ_Handle h1 = f_root1->add_EQ(); - Relation r2(known.n_set()); - F_Exists *f_exists2 = r2.add_and()->add_exists(); - F_And *f_root2 = f_exists2->add_and(); - std::map exists_mapping2; - EQ_Handle h2 = f_root2->add_EQ(); - for (Constr_Vars_Iter cvi(inequality); cvi; cvi++) { - Variable_ID v = cvi.curr_var(); - switch (v->kind()) { - case Input_Var: - h1.update_coef(r1.input_var(v->get_position()), cvi.curr_coef()); - h2.update_coef(r2.input_var(v->get_position()), cvi.curr_coef()); - break; - case Global_Var: { - Global_Var_ID g = v->get_global_var(); - Variable_ID v1, v2; - if (g->arity() == 0) { - v1 = r1.get_local(g); - v2 = r2.get_local(g); - } - else { - v1 = r1.get_local(g, v->function_of()); - v2 = r2.get_local(g, v->function_of()); - } - h1.update_coef(v1, cvi.curr_coef()); - h2.update_coef(v2, cvi.curr_coef()); - break; - } - case Wildcard_Var: { - Variable_ID v1 = replicate_floor_definition(bounds, v, r1, f_exists1, f_root1, exists_mapping1); - Variable_ID v2 = replicate_floor_definition(bounds, v, r2, f_exists2, f_root2, exists_mapping2); - h1.update_coef(v1, cvi.curr_coef()); - h2.update_coef(v2, cvi.curr_coef()); - break; - } - default: - assert(false); - } - } - h1.update_const(inequality.get_const()); - h1.update_coef(f_exists1->declare(), stride); - h2.update_const(inequality.get_const()); - r1.simplify(); - r2.simplify(); - - Relation all_known = Intersection(copy(bounds), copy(known)); - all_known.simplify(); - - if (Gist(r1, copy(all_known), 1).is_obvious_tautology()) { - Relation r3(known.n_set()); - F_Exists *f_exists3 = r3.add_and()->add_exists(); - F_And *f_root3 = f_exists3->add_and(); - std::map exists_mapping3; - EQ_Handle h3 = f_root3->add_EQ(); - for (Constr_Vars_Iter cvi(stride_eq); cvi; cvi++) { - Variable_ID v= cvi.curr_var(); - switch (v->kind()) { - case Input_Var: - h3.update_coef(r3.input_var(v->get_position()), cvi.curr_coef()); - break; - case Global_Var: { - Global_Var_ID g = v->get_global_var(); - Variable_ID v3; - if (g->arity() == 0) - v3 = r3.get_local(g); - else - v3 = r3.get_local(g, v->function_of()); - h3.update_coef(v3, cvi.curr_coef()); - break; - } - case Wildcard_Var: - if (v == wc) - h3.update_coef(f_exists3->declare(), cvi.curr_coef()); - else { - Variable_ID v3 = replicate_floor_definition(bounds, v, r3, f_exists3, f_root3, exists_mapping3); - h3.update_coef(v3, cvi.curr_coef()); - } - break; - default: - assert(false); - } - } - h3.update_const(stride_eq.get_const()); - r3.simplify(); - - if (Gist(r3, Intersection(r2, all_known), 1).is_obvious_tautology()) - return true; - else - return false; - } - else - return false; -} - - -// -// output variable by its name, however if this variable need to be substituted, -// return the substitution. -// -CG_outputRepr *output_ident(CG_outputBuilder *ocg, const Relation &R, Variable_ID v, const std::vector > &assigned_on_the_fly) { - const_cast(R).setup_names(); // hack - - if (v->kind() == Input_Var) { - int pos = v->get_position(); - if (assigned_on_the_fly[pos-1].first != NULL) - return assigned_on_the_fly[pos-1].first->clone(); - else - return ocg->CreateIdent(v->name()); - } - else if (v->kind() == Global_Var) { - if (v->get_global_var()->arity() == 0) - return ocg->CreateIdent(v->name()); - else { - /* This should be improved to take into account the possible elimination - of the set variables. */ - int arity = v->get_global_var()->arity(); - std::vector argList; - for(int i = 1; i <= arity; i++) - argList.push_back(ocg->CreateIdent(const_cast(R).input_var(i)->name())); - CG_outputRepr *call = ocg->CreateInvoke(v->get_global_var()->base_name(), argList); - return call; - } - } - else - assert(false); -} - - -// -// return pair > -// -std::pair > output_assignment(CG_outputBuilder *ocg, const Relation &R, int level, const Relation &known, const std::vector > &assigned_on_the_fly) { - Variable_ID v = const_cast(R).set_var(level); - Conjunct *c = const_cast(R).single_conjunct(); - - std::pair result = find_simplest_assignment(R, v, assigned_on_the_fly); - - if (result.second == INT_MAX) - return std::make_pair(static_cast(NULL), std::make_pair(static_cast(NULL), INT_MAX)); - - CG_outputRepr *if_repr = NULL; - CG_outputRepr *assign_repr = NULL; - // check whether to generate if-conditions from equality constraints - if (abs(result.first.get_coef(v)) != 1) { - Relation r(R.n_set()); - F_Exists *f_exists = r.add_and()->add_exists(); - F_And *f_root = f_exists->add_and(); - std::map exists_mapping; - exists_mapping[v] = f_exists->declare(); - - EQ_Handle h = f_root->add_EQ(); - for (Constr_Vars_Iter cvi(result.first); cvi; cvi++) - switch (cvi.curr_var()->kind()) { - case Input_Var: { - if (cvi.curr_var() == v) - h.update_coef(exists_mapping[v], cvi.curr_coef()); - else - h.update_coef(r.set_var(cvi.curr_var()->get_position()), cvi.curr_coef()); - break; - } - case Global_Var: { - Global_Var_ID g = cvi.curr_var()->get_global_var(); - Variable_ID v2; - if (g->arity() == 0) - v2 = r.get_local(g); - else - v2 = r.get_local(g, cvi.curr_var()->function_of()); - h.update_coef(v2, cvi.curr_coef()); - break; - } - case Wildcard_Var: { - std::map::iterator p = exists_mapping.find(cvi.curr_var()); - Variable_ID v2; - if (p == exists_mapping.end()) { - v2 = f_exists->declare(); - exists_mapping[cvi.curr_var()] = v2; - } - else - v2 = p->second; - h.update_coef(v2, cvi.curr_coef()); - break; - } - default: - assert(0); - } - h.update_const(result.first.get_const()); - - for (EQ_Iterator e(c->EQs()); e; e++) - if (!((*e) == result.first)) { - EQ_Handle h = f_root->add_EQ(); - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) - switch (cvi.curr_var()->kind()) { - case Input_Var: { - assert(cvi.curr_var() != v); - h.update_coef(r.set_var(cvi.curr_var()->get_position()), cvi.curr_coef()); - break; - } - case Global_Var: { - Global_Var_ID g = cvi.curr_var()->get_global_var(); - Variable_ID v2; - if (g->arity() == 0) - v2 = r.get_local(g); - else - v2 = r.get_local(g, cvi.curr_var()->function_of()); - h.update_coef(v2, cvi.curr_coef()); - break; - } - case Wildcard_Var: { - std::map::iterator p = exists_mapping.find(cvi.curr_var()); - Variable_ID v2; - if (p == exists_mapping.end()) { - v2 = f_exists->declare(); - exists_mapping[cvi.curr_var()] = v2; - } - else - v2 = p->second; - h.update_coef(v2, cvi.curr_coef()); - break; - } - default: - assert(0); - } - h.update_const((*e).get_const()); - } - - for (GEQ_Iterator e(c->GEQs()); e; e++) { - GEQ_Handle h = f_root->add_GEQ(); - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) - switch (cvi.curr_var()->kind()) { - case Input_Var: { - h.update_coef(r.set_var(cvi.curr_var()->get_position()), cvi.curr_coef()); - break; - } - case Global_Var: { - Global_Var_ID g = cvi.curr_var()->get_global_var(); - Variable_ID v2; - if (g->arity() == 0) - v2 = r.get_local(g); - else - v2 = r.get_local(g, cvi.curr_var()->function_of()); - h.update_coef(v2, cvi.curr_coef()); - break; - } - case Wildcard_Var: { - std::map::iterator p = exists_mapping.find(cvi.curr_var()); - Variable_ID v2; - if (p == exists_mapping.end()) { - v2 = f_exists->declare(); - exists_mapping[cvi.curr_var()] = v2; - } - else - v2 = p->second; - h.update_coef(v2, cvi.curr_coef()); - break; - } - default: - assert(0); - } - h.update_const((*e).get_const()); - } - - r.simplify(); - if (!Gist(r, copy(known), 1).is_obvious_tautology()) { - CG_outputRepr *lhs = output_substitution_repr(ocg, result.first, v, false, R, assigned_on_the_fly); - if_repr = ocg->CreateEQ(ocg->CreateIntegerMod(lhs->clone(), ocg->CreateInt(abs(result.first.get_coef(v)))), ocg->CreateInt(0)); - assign_repr = ocg->CreateDivide(lhs, ocg->CreateInt(abs(result.first.get_coef(v)))); - } - else - assign_repr = output_substitution_repr(ocg, result.first, v, true, R, assigned_on_the_fly); - } - else - assign_repr = output_substitution_repr(ocg, result.first, v, true, R, assigned_on_the_fly); - - if (assign_repr == NULL) - assign_repr = ocg->CreateInt(0); - - return std::make_pair(if_repr, std::make_pair(assign_repr, result.second)); -} - - -// -// return NULL if 0 -// -CG_outputRepr *output_substitution_repr(CG_outputBuilder *ocg, const EQ_Handle &equality, Variable_ID v, bool apply_v_coef, const Relation &R, const std::vector > &assigned_on_the_fly) { - const_cast(R).setup_names(); // hack - - coef_t a = equality.get_coef(v); - assert(a != 0); - - CG_outputRepr *repr = NULL; - for (Constr_Vars_Iter cvi(equality); cvi; cvi++) - if (cvi.curr_var() != v) { - CG_outputRepr *t; - if (cvi.curr_var()->kind() == Wildcard_Var) { - std::pair result = find_floor_definition(R, cvi.curr_var()); - if (!result.first) { - delete repr; - throw codegen_error("can't output non floor defined wildcard"); - } - t = output_inequality_repr(ocg, result.second, cvi.curr_var(), R, assigned_on_the_fly); - } - else - t = output_ident(ocg, R, cvi.curr_var(), assigned_on_the_fly); - coef_t coef = cvi.curr_coef(); - - if (a > 0) { - if (coef > 0) { - if (coef == 1) - repr = ocg->CreateMinus(repr, t); - else - repr = ocg->CreateMinus(repr, ocg->CreateTimes(ocg->CreateInt(coef), t)); - } - else { // coef < 0 - if (coef == -1) - repr = ocg->CreatePlus(repr, t); - else - repr = ocg->CreatePlus(repr, ocg->CreateTimes(ocg->CreateInt(-coef), t)); - } - } - else { - if (coef > 0) { - if (coef == 1) - repr = ocg->CreatePlus(repr, t); - else - repr = ocg->CreatePlus(repr, ocg->CreateTimes(ocg->CreateInt(coef), t)); - } - else { // coef < 0 - if (coef == -1) - repr = ocg->CreateMinus(repr, t); - else - repr = ocg->CreateMinus(repr, ocg->CreateTimes(ocg->CreateInt(-coef), t)); - } - } - } - - int c = equality.get_const(); - if (a > 0) { - if (c > 0) - repr = ocg->CreateMinus(repr, ocg->CreateInt(c)); - else if (c < 0) - repr = ocg->CreatePlus(repr, ocg->CreateInt(-c)); - } - else { - if (c > 0) - repr = ocg->CreatePlus(repr, ocg->CreateInt(c)); - else if (c < 0) - repr = ocg->CreateMinus(repr, ocg->CreateInt(-c)); - } - - if (apply_v_coef && abs(a) != 1) - repr = ocg->CreateDivide(repr, ocg->CreateInt(abs(a))); - - return repr; -} - - -// -// original Substitutions class from omega can't handle integer -// division, this is new way. -// -std::vector output_substitutions(CG_outputBuilder *ocg, const Relation &R, const std::vector > &assigned_on_the_fly) { - std::vector subs; - - for (int i = 1; i <= R.n_out(); i++) { - Relation mapping(R.n_out(), 1); - F_And *f_root = mapping.add_and(); - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.output_var(1), 1); - h.update_coef(mapping.input_var(i), -1); - Relation r = Composition(mapping, copy(R)); - r.simplify(); - - Variable_ID v = r.output_var(1); - CG_outputRepr *repr = NULL; - std::pair result = find_simplest_assignment(r, v, assigned_on_the_fly); - if (result.second < INT_MAX) - repr = output_substitution_repr(ocg, result.first, v, true, r, assigned_on_the_fly); - else { - std::pair result = find_floor_definition(R, v); - if (result.first) - try { - repr = output_inequality_repr(ocg, result.second, v, R, assigned_on_the_fly); - } - catch (const codegen_error &) { - } - } - - subs.push_back(repr); - } - - return subs; -} - - -// -// handle floor definition wildcards in equality, the second in returned pair -// is the cost. -// -std::pair find_simplest_assignment(const Relation &R, Variable_ID v, const std::vector > &assigned_on_the_fly) { - Conjunct *c = const_cast(R).single_conjunct(); - - int min_cost = INT_MAX; - EQ_Handle eq; - for (EQ_Iterator e(c->EQs()); e; e++) - if (!(*e).has_wildcards() && (*e).get_coef(v) != 0) { - int cost = 0; - - if (abs((*e).get_coef(v)) != 1) - cost += 4; // divide cost - - int num_var = 0; - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) - if (cvi.curr_var() != v) { - num_var++; - if (abs(cvi.curr_coef()) != 1) - cost += 2; // multiply cost - if (cvi.curr_var()->kind() == Global_Var && cvi.curr_var()->get_global_var()->arity() > 0) - cost += 10; // function cost - else if (cvi.curr_var()->kind() == Input_Var && - assigned_on_the_fly.size() >= cvi.curr_var()->get_position() && - assigned_on_the_fly[cvi.curr_var()->get_position()-1].first != NULL) - cost += assigned_on_the_fly[cvi.curr_var()->get_position()-1].second; // substitution cost on record - } - if ((*e).get_const() != 0) - num_var++; - if (num_var > 1) - cost += num_var - 1; // addition cost - - if (cost < min_cost) { - min_cost = cost; - eq = *e; - } - } - - if (min_cost < INT_MAX) - return std::make_pair(eq, min_cost); - - for (EQ_Iterator e(c->EQs()); e; e++) - if ((*e).has_wildcards() && (*e).get_coef(v) != 0) { - bool is_assignment = true; - for (Constr_Vars_Iter cvi(*e, true); cvi; cvi++) { - std::pair result = find_floor_definition(R, v); - if (!result.first) { - is_assignment = false; - break; - } - } - if (!is_assignment) - continue; - - int cost = 0; - - if (abs((*e).get_coef(v)) != 1) - cost += 4; // divide cost - - int num_var = 0; - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) - if (cvi.curr_var() != v) { - num_var++; - if (abs(cvi.curr_coef()) != 1) - cost += 2; // multiply cost - if (cvi.curr_var()->kind() == Wildcard_Var) - cost += 10; // floor operation cost - else if (cvi.curr_var()->kind() == Global_Var && cvi.curr_var()->get_global_var()->arity() > 0) - cost += 20; // function cost - else if (cvi.curr_var()->kind() == Input_Var && - assigned_on_the_fly.size() >= cvi.curr_var()->get_position() && - assigned_on_the_fly[cvi.curr_var()->get_position()-1].first != NULL) - cost += assigned_on_the_fly[cvi.curr_var()->get_position()-1].second; // substitution cost on record - } - if ((*e).get_const() != 0) - num_var++; - if (num_var > 1) - cost += num_var - 1; // addition cost - - if (cost < min_cost) { - min_cost = cost; - eq = *e; - } - } - - return std::make_pair(eq, min_cost); -} - - -// -// find floor definition for variable v, e.g. m-c <= 4v <= m, (c is -// constant and 0 <= c < 4). this translates to v = floor(m, 4) and -// return 4v<=m in this case. All wildcards in such inequality are -// also floor defined. -// -std::pair find_floor_definition(const Relation &R, Variable_ID v, std::set excluded_floor_vars) { - Conjunct *c = const_cast(R).single_conjunct(); - - excluded_floor_vars.insert(v); - for (GEQ_Iterator e = c->GEQs(); e; e++) { - coef_t a = (*e).get_coef(v); - if (a >= -1) - continue; - a = -a; - - bool interested = true; - for (std::set::const_iterator i = excluded_floor_vars.begin(); i != excluded_floor_vars.end(); i++) - if ((*i) != v && (*e).get_coef(*i) != 0) { - interested = false; - break; - } - if (!interested) - continue; - - // check if any wildcard is floor defined - bool has_undefined_wc = false; - for (Constr_Vars_Iter cvi(*e, true); cvi; cvi++) - if (excluded_floor_vars.find(cvi.curr_var()) == excluded_floor_vars.end()) { - std::pair result = find_floor_definition(R, cvi.curr_var(), excluded_floor_vars); - if (!result.first) { - has_undefined_wc = true; - break; - } - } - if (has_undefined_wc) - continue; - - // find the matching upper bound for floor definition - for (GEQ_Iterator e2 = c->GEQs(); e2; e2++) - if ((*e2).get_coef(v) == a && (*e).get_const() + (*e2).get_const() < a) { - bool match = true; - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) - if ((*e2).get_coef(cvi.curr_var()) != -cvi.curr_coef()) { - match = false; - break; - } - if (!match) - continue; - for (Constr_Vars_Iter cvi(*e2); cvi; cvi++) - if ((*e).get_coef(cvi.curr_var()) != -cvi.curr_coef()) { - match = false; - break; - } - if (match) - return std::make_pair(true, *e); - } - } - - return std::make_pair(false, GEQ_Handle()); -} - -// -// find the stride involving the specified variable, the stride -// equality can have other wildcards as long as they are defined as -// floor variables. -// -std::pair find_simplest_stride(const Relation &R, Variable_ID v) { - int best_num_var = INT_MAX; - coef_t best_coef; - EQ_Handle best_eq; - Variable_ID best_stride_wc; - for (EQ_Iterator e(const_cast(R).single_conjunct()->EQs()); e; e++) - if ((*e).has_wildcards() && (*e).get_coef(v) != 0) { - bool is_stride = true; - bool found_free = false; - int num_var = 0; - int num_floor = 0; - Variable_ID stride_wc; - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) { - switch (cvi.curr_var()->kind()) { - case Wildcard_Var: { - bool is_free = true; - for (GEQ_Iterator e2(const_cast(R).single_conjunct()->GEQs()); e2; e2++) - if ((*e2).get_coef(cvi.curr_var()) != 0) { - is_free = false; - break; - } - if (is_free) { - if (found_free) - is_stride = false; - else { - found_free = true; - stride_wc = cvi.curr_var(); - } - } - else { - std::pair result = find_floor_definition(R, cvi.curr_var()); - if (result.first) - num_floor++; - else - is_stride = false; - } - break; - } - case Input_Var: - num_var++; - break; - default: - ; - } - - if (!is_stride) - break; - } - - if (is_stride) { - coef_t coef = abs((*e).get_coef(v)); - if (best_num_var == INT_MAX || coef < best_coef || - (coef == best_coef && num_var < best_num_var)) { - best_coef = coef; - best_num_var = num_var; - best_eq = *e; - best_stride_wc = stride_wc; - } - } - } - - if (best_num_var != INT_MAX) - return std::make_pair(best_eq, best_stride_wc); - else - return std::make_pair(EQ_Handle(), static_cast(NULL)); -} - -// -// convert relation to if-condition -// -CG_outputRepr *output_guard(CG_outputBuilder *ocg, const Relation &R, const std::vector > &assigned_on_the_fly) { - assert(R.n_out()==0); - - CG_outputRepr *result = NULL; - Conjunct *c = const_cast(R).single_conjunct(); - - // e.g. 4i=5*j - for (EQ_Iterator e = c->EQs(); e; e++) - if (!(*e).has_wildcards()) { - CG_outputRepr *lhs = NULL; - CG_outputRepr *rhs = NULL; - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) { - CG_outputRepr *v = output_ident(ocg, R, cvi.curr_var(), assigned_on_the_fly); - coef_t coef = cvi.curr_coef(); - if (coef > 0) { - if (coef == 1) - lhs = ocg->CreatePlus(lhs, v); - else - lhs = ocg->CreatePlus(lhs, ocg->CreateTimes(ocg->CreateInt(coef), v)); - } - else { // coef < 0 - if (coef == -1) - rhs = ocg->CreatePlus(rhs, v); - else - rhs = ocg->CreatePlus(rhs, ocg->CreateTimes(ocg->CreateInt(-coef), v)); - } - } - coef_t c = (*e).get_const(); - - CG_outputRepr *term; - if (lhs == NULL) - term = ocg->CreateEQ(rhs, ocg->CreateInt(c)); - else { - if (c > 0) - rhs = ocg->CreateMinus(rhs, ocg->CreateInt(c)); - else if (c < 0) - rhs = ocg->CreatePlus(rhs, ocg->CreateInt(-c)); - else if (rhs == NULL) - rhs = ocg->CreateInt(0); - term = ocg->CreateEQ(lhs, rhs); - } - result = ocg->CreateAnd(result, term); - } - - // e.g. i>5j - for (GEQ_Iterator e = c->GEQs(); e; e++) - if (!(*e).has_wildcards()) { - CG_outputRepr *lhs = NULL; - CG_outputRepr *rhs = NULL; - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) { - CG_outputRepr *v = output_ident(ocg, R, cvi.curr_var(), assigned_on_the_fly); - coef_t coef = cvi.curr_coef(); - if (coef > 0) { - if (coef == 1) - lhs = ocg->CreatePlus(lhs, v); - else - lhs = ocg->CreatePlus(lhs, ocg->CreateTimes(ocg->CreateInt(coef), v)); - } - else { // coef < 0 - if (coef == -1) - rhs = ocg->CreatePlus(rhs, v); - else - rhs = ocg->CreatePlus(rhs, ocg->CreateTimes(ocg->CreateInt(-coef), v)); - } - } - coef_t c = (*e).get_const(); - - CG_outputRepr *term; - if (lhs == NULL) - term = ocg->CreateLE(rhs, ocg->CreateInt(c)); - else { - if (c > 0) - rhs = ocg->CreateMinus(rhs, ocg->CreateInt(c)); - else if (c < 0) - rhs = ocg->CreatePlus(rhs, ocg->CreateInt(-c)); - else if (rhs == NULL) - rhs = ocg->CreateInt(0); - term = ocg->CreateGE(lhs, rhs); - } - result = ocg->CreateAnd(result, term); - } - - // e.g. 4i=5j+4alpha - for (EQ_Iterator e = c->EQs(); e; e++) - if ((*e).has_wildcards()) { - Variable_ID wc; - int num_wildcard = 0; - int num_positive = 0; - int num_negative = 0; - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) { - if (cvi.curr_var()->kind() == Wildcard_Var) { - num_wildcard++; - wc = cvi.curr_var(); - } - else { - if (cvi.curr_coef() > 0) - num_positive++; - else - num_negative++; - } - } - - if (num_wildcard > 1) { - delete result; - throw codegen_error("Can't generate equality condition with multiple wildcards"); - } - int sign = (num_positive>=num_negative)?1:-1; - - CG_outputRepr *lhs = NULL; - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) { - if (cvi.curr_var() != wc) { - CG_outputRepr *v = output_ident(ocg, R, cvi.curr_var(), assigned_on_the_fly); - coef_t coef = cvi.curr_coef(); - if (sign == 1) { - if (coef > 0) { - if (coef == 1) - lhs = ocg->CreatePlus(lhs, v); - else - lhs = ocg->CreatePlus(lhs, ocg->CreateTimes(ocg->CreateInt(coef), v)); - } - else { // coef < 0 - if (coef == -1) - lhs = ocg->CreateMinus(lhs, v); - else - lhs = ocg->CreateMinus(lhs, ocg->CreateTimes(ocg->CreateInt(-coef), v)); - } - } - else { - if (coef > 0) { - if (coef == 1) - lhs = ocg->CreateMinus(lhs, v); - else - lhs = ocg->CreateMinus(lhs, ocg->CreateTimes(ocg->CreateInt(coef), v)); - } - else { // coef < 0 - if (coef == -1) - lhs = ocg->CreatePlus(lhs, v); - else - lhs = ocg->CreatePlus(lhs, ocg->CreateTimes(ocg->CreateInt(-coef), v)); - } - } - } - } - coef_t c = (*e).get_const(); - if (sign == 1) { - if (c > 0) - lhs = ocg->CreatePlus(lhs, ocg->CreateInt(c)); - else if (c < 0) - lhs = ocg->CreateMinus(lhs, ocg->CreateInt(-c)); - } - else { - if (c > 0) - lhs = ocg->CreateMinus(lhs, ocg->CreateInt(c)); - else if (c < 0) - lhs = ocg->CreatePlus(lhs, ocg->CreateInt(-c)); - } - - lhs = ocg->CreateIntegerMod(lhs, ocg->CreateInt(abs((*e).get_coef(wc)))); - CG_outputRepr *term = ocg->CreateEQ(lhs, ocg->CreateInt(0)); - result = ocg->CreateAnd(result, term); - } - - // e.g. 4alpha<=i<=5alpha - for (GEQ_Iterator e = c->GEQs(); e; e++) - if ((*e).has_wildcards()) { - Variable_ID wc; - int num_wildcard = 0; - for (Constr_Vars_Iter cvi(*e, true); cvi; cvi++) - if (num_wildcard == 0) { - wc = cvi.curr_var(); - num_wildcard = 1; - } - else - num_wildcard++; - - if (num_wildcard > 1) { - delete result; - // e.g. c*alpha - x >= 0 (*) - // -d*alpha + y >= 0 (*) - // e1*alpha + f1*beta + g1 >= 0 (**) - // e2*alpha + f2*beta + g2 >= 0 (**) - // ... - // TODO: should generate a testing loop for alpha using its lower and - // upper bounds from (*) constraints and do the same if-condition test - // for beta from each pair of opposite (**) constraints as above, - // and exit the loop when if-condition satisfied. - throw codegen_error("Can't generate multiple wildcard GEQ guards right now"); - } - - coef_t c = (*e).get_coef(wc); - int sign = (c>0)?1:-1; - - GEQ_Iterator e2 = e; - e2++; - for ( ; e2; e2++) { - coef_t c2 = (*e2).get_coef(wc); - if (c2 == 0) - continue; - int sign2 = (c2>0)?1:-1; - if (sign != -sign2) - continue; - int num_wildcard2 = 0; - for (Constr_Vars_Iter cvi(*e2, true); cvi; cvi++) - num_wildcard2++; - if (num_wildcard2 > 1) - continue; - - GEQ_Handle lb, ub; - if (sign == 1) { - lb = (*e); - ub = (*e2); - } - else { - lb = (*e2); - ub = (*e); - } - - CG_outputRepr *lhs = NULL; - for (Constr_Vars_Iter cvi(lb); cvi; cvi++) - if (cvi.curr_var() != wc) { - CG_outputRepr *v = output_ident(ocg, R, cvi.curr_var(), assigned_on_the_fly); - coef_t coef = cvi.curr_coef(); - if (coef > 0) { - if (coef == 1) - lhs = ocg->CreateMinus(lhs, v); - else - lhs = ocg->CreateMinus(lhs, ocg->CreateTimes(ocg->CreateInt(coef), v)); - } - else { // coef < 0 - if (coef == -1) - lhs = ocg->CreatePlus(lhs, v); - else - lhs = ocg->CreatePlus(lhs, ocg->CreateTimes(ocg->CreateInt(-coef), v)); - } - } - coef_t c = lb.get_const(); - if (c > 0) - lhs = ocg->CreateMinus(lhs, ocg->CreateInt(c)); - else if (c < 0) - lhs = ocg->CreatePlus(lhs, ocg->CreateInt(-c)); - - CG_outputRepr *rhs = NULL; - for (Constr_Vars_Iter cvi(ub); cvi; cvi++) - if (cvi.curr_var() != wc) { - CG_outputRepr *v = output_ident(ocg, R, cvi.curr_var(), assigned_on_the_fly); - coef_t coef = cvi.curr_coef(); - if (coef > 0) { - if (coef == 1) - rhs = ocg->CreatePlus(rhs, v); - else - rhs = ocg->CreatePlus(rhs, ocg->CreateTimes(ocg->CreateInt(coef), v)); - } - else { // coef < 0 - if (coef == -1) - rhs = ocg->CreateMinus(rhs, v); - else - rhs = ocg->CreateMinus(rhs, ocg->CreateTimes(ocg->CreateInt(-coef), v)); - } - } - c = ub.get_const(); - if (c > 0) - rhs = ocg->CreatePlus(rhs, ocg->CreateInt(c)); - else if (c < 0) - rhs = ocg->CreateMinus(rhs, ocg->CreateInt(-c)); - - rhs = ocg->CreateIntegerFloor(rhs, ocg->CreateInt(-ub.get_coef(wc))); - rhs = ocg->CreateTimes(ocg->CreateInt(lb.get_coef(wc)), rhs); - CG_outputRepr *term = ocg->CreateLE(lhs, rhs); - result = ocg->CreateAnd(result, term); - } - } - - return result; -} - - -// -// return NULL if 0 -// -CG_outputRepr *output_inequality_repr(CG_outputBuilder *ocg, const GEQ_Handle &inequality, Variable_ID v, const Relation &R, const std::vector > &assigned_on_the_fly, std::set excluded_floor_vars) { - const_cast(R).setup_names(); // hack - - coef_t a = inequality.get_coef(v); - assert(a != 0); - excluded_floor_vars.insert(v); - - CG_outputRepr *repr = NULL; - for (Constr_Vars_Iter cvi(inequality); cvi; cvi++) - if (cvi.curr_var() != v) { - CG_outputRepr *t; - if (cvi.curr_var()->kind() == Wildcard_Var) { - std::pair result = find_floor_definition(R, cvi.curr_var(), excluded_floor_vars); - if (!result.first) { - delete repr; - throw codegen_error("Can't generate bound expression with wildcard not involved in floor definition"); - } - try { - t = output_inequality_repr(ocg, result.second, cvi.curr_var(), R, assigned_on_the_fly, excluded_floor_vars); - } - catch (const std::exception &e) { - delete repr; - throw e; - } - } - else - t = output_ident(ocg, R, cvi.curr_var(), assigned_on_the_fly); - - coef_t coef = cvi.curr_coef(); - if (a > 0) { - if (coef > 0) { - if (coef == 1) - repr = ocg->CreateMinus(repr, t); - else - repr = ocg->CreateMinus(repr, ocg->CreateTimes(ocg->CreateInt(coef), t)); - } - else { - if (coef == -1) - repr = ocg->CreatePlus(repr, t); - else - repr = ocg->CreatePlus(repr, ocg->CreateTimes(ocg->CreateInt(-coef), t)); - } - } - else { - if (coef > 0) { - if (coef == 1) - repr = ocg->CreatePlus(repr, t); - else - repr = ocg->CreatePlus(repr, ocg->CreateTimes(ocg->CreateInt(coef), t)); - } - else { - if (coef == -1) - repr = ocg->CreateMinus(repr, t); - else - repr = ocg->CreateMinus(repr, ocg->CreateTimes(ocg->CreateInt(-coef), t)); - } - } - } - coef_t c = inequality.get_const(); - if (c > 0) { - if (a > 0) - repr = ocg->CreateMinus(repr, ocg->CreateInt(c)); - else - repr = ocg->CreatePlus(repr, ocg->CreateInt(c)); - } - else if (c < 0) { - if (a > 0) - repr = ocg->CreatePlus(repr, ocg->CreateInt(-c)); - else - repr = ocg->CreateMinus(repr, ocg->CreateInt(-c)); - } - - if (abs(a) == 1) - return repr; - else if (a > 0) - return ocg->CreateIntegerCeil(repr, ocg->CreateInt(a)); - else // a < 0 - return ocg->CreateIntegerFloor(repr, ocg->CreateInt(-a)); -} - - -// -// nothing special, just an alias -// -CG_outputRepr *output_upper_bound_repr(CG_outputBuilder *ocg, const GEQ_Handle &inequality, Variable_ID v, const Relation &R, const std::vector > &assigned_on_the_fly) { - assert(inequality.get_coef(v) < 0); - CG_outputRepr* zero_; - - zero_ = output_inequality_repr(ocg, inequality, v, R, assigned_on_the_fly); - - if(!zero_) - zero_ = ocg->CreateInt(0); - - return zero_; - -} - - -// -// output lower bound with respect to lattice -// -CG_outputRepr *output_lower_bound_repr(CG_outputBuilder *ocg, const GEQ_Handle &inequality, Variable_ID v, const EQ_Handle &stride_eq, Variable_ID wc, const Relation &R, const Relation &known, const std::vector > &assigned_on_the_fly) { - assert(inequality.get_coef(v) > 0); - CG_outputRepr* zero_; - if (wc == NULL || bound_must_hit_stride(inequality, v, stride_eq, wc, R, known)){ - zero_ = output_inequality_repr(ocg, inequality, v, R, assigned_on_the_fly); - if(!zero_) - zero_ = ocg->CreateInt(0); - - return zero_; - } - CG_outputRepr *strideBoundRepr = NULL; - int sign = (stride_eq.get_coef(v)>0)?1:-1; - for (Constr_Vars_Iter cvi(stride_eq); cvi; cvi++) { - Variable_ID v2 = cvi.curr_var(); - if (v2 == v || v2 == wc) - continue; - - CG_outputRepr *v_repr; - if (v2->kind() == Input_Var || v2->kind() == Global_Var) - v_repr = output_ident(ocg, R, v2, assigned_on_the_fly); - else if (v2->kind() == Wildcard_Var) { - std::pair result = find_floor_definition(R, v2); - assert(result.first); - v_repr = output_inequality_repr(ocg, result.second, v2, R, assigned_on_the_fly); - } - - coef_t coef = cvi.curr_coef(); - if (sign < 0) { - if (coef > 0) { - if (coef == 1) - strideBoundRepr = ocg->CreatePlus(strideBoundRepr, v_repr); - else - strideBoundRepr = ocg->CreatePlus(strideBoundRepr, ocg->CreateTimes(ocg->CreateInt(coef), v_repr)); - } - else { // coef < 0 - if (coef == -1) - strideBoundRepr = ocg->CreateMinus(strideBoundRepr, v_repr); - else - strideBoundRepr = ocg->CreateMinus(strideBoundRepr, ocg->CreateTimes(ocg->CreateInt(-coef), v_repr)); - } - } - else { - if (coef > 0) { - if (coef == 1) - strideBoundRepr = ocg->CreateMinus(strideBoundRepr, v_repr); - else - strideBoundRepr = ocg->CreateMinus(strideBoundRepr, ocg->CreateTimes(ocg->CreateInt(coef), v_repr)); - } - else { // coef < 0 - if (coef == -1) - strideBoundRepr = ocg->CreatePlus(strideBoundRepr, v_repr); - else - strideBoundRepr = ocg->CreatePlus(strideBoundRepr, ocg->CreateTimes(ocg->CreateInt(-coef), v_repr)); - } - } - } - coef_t c = stride_eq.get_const(); - if (c > 0) { - if (sign < 0) - strideBoundRepr = ocg->CreatePlus(strideBoundRepr, ocg->CreateInt(c)); - else - strideBoundRepr = ocg->CreateMinus(strideBoundRepr, ocg->CreateInt(c)); - } - else if (c < 0) { - if (sign < 0) - strideBoundRepr = ocg->CreateMinus(strideBoundRepr, ocg->CreateInt(-c)); - else - strideBoundRepr = ocg->CreatePlus(strideBoundRepr, ocg->CreateInt(-c)); - } - - CG_outputRepr *repr = output_inequality_repr(ocg, inequality, v, R, assigned_on_the_fly); - CG_outputRepr *repr2 = ocg->CreateCopy(repr); - repr = ocg->CreatePlus(repr2, ocg->CreateIntegerMod(ocg->CreateMinus(strideBoundRepr, repr), ocg->CreateInt(abs(stride_eq.get_coef(wc))))); - - return repr; -} - - -// -// return loop control structure only -// -CG_outputRepr *output_loop(CG_outputBuilder *ocg, const Relation &R, int level, const Relation &known, const std::vector > &assigned_on_the_fly) { - std::pair result = find_simplest_stride(R, const_cast(R).set_var(level)); - if (result.second != NULL) - assert(abs(result.first.get_coef(const_cast(R).set_var(level))) == 1); - - std::vector lbList, ubList; - try { - - coef_t const_lb = negInfinity, const_ub = posInfinity; - - for (GEQ_Iterator e(const_cast(R).single_conjunct()->GEQs()); e; e++) { - coef_t coef = (*e).get_coef(const_cast(R).set_var(level)); - - if (coef > 0) { - CG_outputRepr *repr = output_lower_bound_repr(ocg, *e, const_cast(R).set_var(level), result.first, result.second, R, known, assigned_on_the_fly); - if (repr == NULL) - repr = ocg->CreateInt(0); - lbList.push_back(repr); - - if ((*e).is_const(const_cast(R).set_var(level))){ - if(!result.second) { - - //no variables but v in constr - coef_t L,m; - L = -((*e).get_const()); - - m = (*e).get_coef(const_cast(R).set_var(level)); - coef_t sb = (int) (ceil(((float) L) /m)); - set_max(const_lb, sb); - } - else{ - - coef_t L,m,s,c; - L = -((*e).get_const()); - m = (*e).get_coef(const_cast(R).set_var(level)); - s = abs(result.first.get_coef(result.second)); - c = result.first.get_const(); - coef_t sb = (s * (int) (ceil( (float) (L - (c * m)) /(s*m))))+ c; - set_max(const_lb, sb); - - } - } - - } - else if (coef < 0) { - CG_outputRepr *repr = output_upper_bound_repr(ocg, *e, const_cast(R).set_var(level), R, assigned_on_the_fly); - if (repr == NULL) - repr = ocg->CreateInt(0); - ubList.push_back(repr); - - if ((*e).is_const(const_cast(R).set_var(level))) { - // no variables but v in constraint - set_min(const_ub,-(*e).get_const()/(*e).get_coef(const_cast(R).set_var(level))); - } - - } - } - - if(fillInBounds && lbList.size() == 1 && const_lb != negInfinity) - lowerBoundForLevel = const_lb; - - if(fillInBounds && const_ub != posInfinity) - upperBoundForLevel = const_ub; - if (lbList.size() == 0) - throw codegen_error("missing lower bound at loop level " + to_string(level)); - if (ubList.size() == 0) - throw codegen_error("missing upper bound at loop level " + to_string(level)); - } - catch (const std::exception &e) { - for (int i = 0; i < lbList.size(); i++) - delete lbList[i]; - for (int i = 0; i < ubList.size(); i++) - delete ubList[i]; - throw e; - } - - CG_outputRepr *lbRepr = NULL; - if (lbList.size() > 1) - lbRepr = ocg->CreateInvoke("max", lbList); - else // (lbList.size() == 1) - lbRepr = lbList[0]; - - CG_outputRepr *ubRepr = NULL; - if (ubList.size() > 1) - ubRepr = ocg->CreateInvoke("min", ubList); - else // (ubList.size() == 1) - ubRepr = ubList[0]; - - CG_outputRepr *stRepr; - if (result.second == NULL) - stRepr = ocg->CreateInt(1); - else - stRepr = ocg->CreateInt(abs(result.first.get_coef(result.second))); - CG_outputRepr *indexRepr = output_ident(ocg, R, const_cast(R).set_var(level), assigned_on_the_fly); - return ocg->CreateInductive(indexRepr, lbRepr, ubRepr, stRepr); -} - - -// -// parameter f_root is inside f_exists, not the other way around. -// return replicated variable in new relation, with all cascaded floor definitions -// using wildcards defined in the same way as in the original relation. -// -Variable_ID replicate_floor_definition(const Relation &R, const Variable_ID floor_var, - Relation &r, F_Exists *f_exists, F_And *f_root, - std::map &exists_mapping) { - assert(R.n_out() == 0 && r.n_out() == 0 && R.n_inp() == r.n_inp()); - - std::set excluded_floor_vars; - std::stack to_fill; - to_fill.push(floor_var); - - while (!to_fill.empty()) { - Variable_ID v = to_fill.top(); - to_fill.pop(); - if (excluded_floor_vars.find(v) != excluded_floor_vars.end()) - continue; - - std::pair result = find_floor_definition(R, v, excluded_floor_vars); - assert(result.first); - excluded_floor_vars.insert(v); - - GEQ_Handle h1 = f_root->add_GEQ(); - GEQ_Handle h2 = f_root->add_GEQ(); - for (Constr_Vars_Iter cvi(result.second); cvi; cvi++) { - Variable_ID v2 = cvi.curr_var(); - switch (v2->kind()) { - case Input_Var: { - int pos = v2->get_position(); - h1.update_coef(r.input_var(pos), cvi.curr_coef()); - h2.update_coef(r.input_var(pos), -cvi.curr_coef()); - break; - } - case Wildcard_Var: { - std::map::iterator p = exists_mapping.find(v2); - Variable_ID v3; - if (p == exists_mapping.end()) { - v3 = f_exists->declare(); - exists_mapping[v2] = v3; - } - else - v3 = p->second; - h1.update_coef(v3, cvi.curr_coef()); - h2.update_coef(v3, -cvi.curr_coef()); - if (v2 != v) - to_fill.push(v2); - break; - } - case Global_Var: { - Global_Var_ID g = v2->get_global_var(); - Variable_ID v3; - if (g->arity() == 0) - v3 = r.get_local(g); - else - v3 = r.get_local(g, v2->function_of()); - h1.update_coef(v3, cvi.curr_coef()); - h2.update_coef(v3, -cvi.curr_coef()); - break; - } - default: - assert(false); - } - } - h1.update_const(result.second.get_const()); - h2.update_const(-result.second.get_const()-result.second.get_coef(v)-1); - } - - if (floor_var->kind() == Input_Var) - return r.input_var(floor_var->get_position()); - else if (floor_var->kind() == Wildcard_Var) - return exists_mapping[floor_var]; - else - assert(false); -} - - -// -// pick one guard condition from relation. it can involve multiple -// constraints when involving wildcards, as long as its complement -// is a single conjunct. -// -Relation pick_one_guard(const Relation &R, int level) { - assert(R.n_out()==0); - - Relation r = Relation::True(R.n_set()); - - for (GEQ_Iterator e(const_cast(R).single_conjunct()->GEQs()); e; e++) - if (!(*e).has_wildcards()) { - r.and_with_GEQ(*e); - r.simplify(); - r.copy_names(R); - r.setup_names(); - return r; - } - - for (EQ_Iterator e(const_cast(R).single_conjunct()->EQs()); e; e++) - if (!(*e).has_wildcards()) { - r.and_with_GEQ(*e); - r.simplify(); - r.copy_names(R); - r.setup_names(); - return r; - } - - for (EQ_Iterator e(const_cast(R).single_conjunct()->EQs()); e; e++) - if ((*e).has_wildcards()) { - int num_wildcard = 0; - int max_level = 0; - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) - switch (cvi.curr_var()->kind()) { - case Wildcard_Var: - num_wildcard++; - break; - case Input_Var: - if (cvi.curr_var()->get_position() > max_level) - max_level = cvi.curr_var()->get_position(); - break; - default: - ; - } - - if (num_wildcard == 1 && max_level != level-1) { - r.and_with_EQ(*e); - r.simplify(); - r.copy_names(R); - r.setup_names(); - return r; - } - } - - for (GEQ_Iterator e(const_cast(R).single_conjunct()->GEQs()); e; e++) - if ((*e).has_wildcards()) { - int num_wildcard = 0; - int max_level = 0; - bool direction; - Variable_ID wc; - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) - switch (cvi.curr_var()->kind()) { - case Wildcard_Var: - num_wildcard++; - wc = cvi.curr_var(); - direction = cvi.curr_coef()>0?true:false; - break; - case Input_Var: - if (cvi.curr_var()->get_position() > max_level) - max_level = cvi.curr_var()->get_position(); - break; - default: - ; - } - - if (num_wildcard == 1 && max_level != level-1) { - // find the pairing inequality - GEQ_Iterator e2 = e; - e2++; - for ( ; e2; e2++) { - int num_wildcard2 = 0; - int max_level2 = 0; - bool direction2; - Variable_ID wc2; - for (Constr_Vars_Iter cvi(*e2); cvi; cvi++) - switch (cvi.curr_var()->kind()) { - case Wildcard_Var: - num_wildcard2++; - wc2 = cvi.curr_var(); - direction2 = cvi.curr_coef()>0?true:false; - break; - case Input_Var: - if (cvi.curr_var()->get_position() > max_level2) - max_level2 = cvi.curr_var()->get_position(); - break; - default: - ; - } - - if (num_wildcard2 == 1 && max_level2 != level-1 && wc2 == wc && direction2 == not direction) { - F_Exists *f_exists = r.and_with_and()->add_exists(); - Variable_ID wc3 = f_exists->declare(); - F_And *f_root = f_exists->add_and(); - GEQ_Handle h = f_root->add_GEQ(); - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) { - switch (cvi.curr_var()->kind()) { - case Wildcard_Var: - h.update_coef(wc3, cvi.curr_coef()); - break; - case Input_Var: - h.update_coef(r.input_var(cvi.curr_var()->get_position()), cvi.curr_coef()); - break; - case Global_Var: { - Global_Var_ID g = cvi.curr_var()->get_global_var(); - Variable_ID v; - if (g->arity() == 0) - v = r.get_local(g); - else - v = r.get_local(g, cvi.curr_var()->function_of()); - h.update_coef(v, cvi.curr_coef()); - break; - } - default: - assert(false); - } - } - h.update_const((*e).get_const()); - - h = f_root->add_GEQ(); - for (Constr_Vars_Iter cvi(*e2); cvi; cvi++) { - switch (cvi.curr_var()->kind()) { - case Wildcard_Var: - h.update_coef(wc3, cvi.curr_coef()); - break; - case Input_Var: - h.update_coef(r.input_var(cvi.curr_var()->get_position()), cvi.curr_coef()); - break; - case Global_Var: { - Global_Var_ID g = cvi.curr_var()->get_global_var(); - Variable_ID v; - if (g->arity() == 0) - v = r.get_local(g); - else - v = r.get_local(g, cvi.curr_var()->function_of()); - h.update_coef(v, cvi.curr_coef()); - break; - } - default: - assert(false); - } - } - h.update_const((*e2).get_const()); - - r.simplify(); - r.copy_names(R); - r.setup_names(); - return r; - } - } - } - } -} - - -// -// heavy lifting for code output for one leaf node -// -CG_outputRepr *leaf_print_repr(BoolSet<> active, const std::map &guards, - CG_outputRepr *guard_repr, const Relation &known, - int indent, CG_outputBuilder *ocg, const std::vector &remap, - const std::vector &xforms, const std::vector &stmts, - const std::vector > &assigned_on_the_fly) { - if (active.num_elem() == 0) - return NULL; - - CG_outputRepr *stmt_list = NULL; - for (BoolSet<>::iterator i = active.begin(); i != active.end(); i++) { - std::map::const_iterator j = guards.find(*i); - if (j == guards.end() || Must_Be_Subset(copy(known), copy(j->second))) { - Relation mapping = Inverse(copy((xforms[remap[*i]]))); - mapping.simplify(); - mapping.setup_names(); - std::vector loop_vars; - for (int k = 1; k <= mapping.n_out(); k++) { - loop_vars.push_back(mapping.output_var(k)->name()); -// std::cout << "CG_Utils:: " << k << ", " << mapping.output_var(k)->name().c_str() << "\n"; - } - std::vector sList = output_substitutions(ocg, mapping, assigned_on_the_fly); - stmt_list = ocg->StmtListAppend(stmt_list, ocg->CreateSubstitutedStmt((guard_repr==NULL)?indent:indent+1, stmts[remap[*i]]->clone(), loop_vars, sList)); - active.unset(*i); - } - } - - if (stmt_list != NULL) { - if (active.num_elem() != 0) - stmt_list = ocg->StmtListAppend(stmt_list, leaf_print_repr(active, guards, NULL, known, (guard_repr==NULL)?indent:indent+1, ocg, remap, xforms, stmts, assigned_on_the_fly)); - if (guard_repr == NULL) - return stmt_list; - else - return ocg->CreateIf(indent, guard_repr, stmt_list, NULL); - } - else { - Relation then_cond = find_best_guard(const_cast &>(guards)[*(active.begin())], active, guards); - assert(!then_cond.is_obvious_tautology()); - Relation new_then_known = Intersection(copy(known), copy(then_cond)); - new_then_known.simplify(); - Relation else_cond = Complement(copy(then_cond)); - else_cond.simplify(); - Relation new_else_known = Intersection(copy(known), copy(else_cond)); - new_else_known.simplify(); - - BoolSet<> then_active(active.size()), else_active(active.size()), indep_active(active.size()); - std::map then_guards, else_guards; - for (BoolSet<>::iterator i = active.begin(); i != active.end(); i++) { - Relation &r = const_cast &>(guards)[*i]; - if (Must_Be_Subset(copy(r), copy(then_cond))) { - Relation r2 = Gist(copy(r), copy(then_cond), 1); - if (!r2.is_obvious_tautology()) - then_guards[*i] = r2; - then_active.set(*i); - } - else if (Must_Be_Subset(copy(r), copy(else_cond))) { - Relation r2 = Gist(copy(r), copy(else_cond), 1); - if (!r2.is_obvious_tautology()) - else_guards[*i] = r2; - else_active.set(*i); - } - else - indep_active.set(*i); - } - assert(!then_active.empty()); - - CG_outputRepr *new_guard_repr = output_guard(ocg, then_cond, assigned_on_the_fly); - if (else_active.empty() && indep_active.empty()) { - guard_repr = ocg->CreateAnd(guard_repr, new_guard_repr); - return leaf_print_repr(then_active, then_guards, guard_repr, new_then_known, indent, ocg, remap, xforms, stmts, assigned_on_the_fly); - } - else if (else_active.empty() && !indep_active.empty()) { - int new_indent = (guard_repr==NULL)?indent:indent+1; - stmt_list = leaf_print_repr(then_active, then_guards, new_guard_repr, new_then_known, new_indent, ocg, remap, xforms, stmts, assigned_on_the_fly); - stmt_list = ocg->StmtListAppend(stmt_list, leaf_print_repr(indep_active, guards, NULL, known, new_indent, ocg, remap, xforms, stmts, assigned_on_the_fly)); - if (guard_repr == NULL) - return stmt_list; - else - return ocg->CreateIf(indent, guard_repr, stmt_list, NULL); - } - else { // (!else_active.empty()) - int new_indent = (guard_repr==NULL)?indent:indent+1; - CG_outputRepr *then_stmt_list = leaf_print_repr(then_active, then_guards, NULL, new_then_known, new_indent+1, ocg, remap, xforms, stmts, assigned_on_the_fly); - CG_outputRepr *else_stmt_list = leaf_print_repr(else_active, else_guards, NULL, new_else_known, new_indent+1, ocg, remap, xforms, stmts, assigned_on_the_fly); - stmt_list = ocg->CreateIf(new_indent, new_guard_repr, then_stmt_list, else_stmt_list); - if (!indep_active.empty()) - stmt_list = ocg->StmtListAppend(stmt_list, leaf_print_repr(indep_active, guards, NULL, known, new_indent, ocg, remap, xforms, stmts, assigned_on_the_fly)); - if (guard_repr == NULL) - return stmt_list; - else - return ocg->CreateIf(indent, guard_repr, stmt_list, NULL); - } - } -} - - -// -// heavy lifting for code output for one level of loop nodes -// -CG_outputRepr *loop_print_repr(const std::vector &loops, int start, int end, - const Relation &guard, CG_outputRepr *guard_repr, - int indent, CG_outputBuilder *ocg, const std::vector &stmts, - const std::vector > &assigned_on_the_fly) { - if (start >= end) - return NULL; - - Relation R = Gist(copy(loops[start]->guard_), copy(guard), 1); - if (Must_Be_Subset(Intersection(copy(loops[start]->known_), copy(guard)), copy(R))) { - int new_indent = (guard_repr==NULL)?indent:indent+1; - int i = start+1; - for ( ; i < end; i++) - if (!Gist(copy(loops[i]->guard_), copy(guard), 1).is_obvious_tautology()) - break; - CG_outputRepr *stmt_list = NULL; - for (int j = start; j < i; j++) - stmt_list = ocg->StmtListAppend(stmt_list, loops[j]->printRepr(false, new_indent, ocg, stmts, assigned_on_the_fly)); - stmt_list = ocg->StmtListAppend(stmt_list, loop_print_repr(loops, i, end, guard, NULL, new_indent, ocg, stmts, assigned_on_the_fly)); - if (guard_repr == NULL) - return stmt_list; - else - return ocg->CreateIf(indent, guard_repr, stmt_list, NULL); - } - - Relation then_cond = find_best_guard(R, loops, start, end); - assert(!then_cond.is_obvious_tautology()); - Relation else_cond = Complement(copy(then_cond)); - else_cond.simplify(); - - std::vector then_loops, else_loops, indep_loops; - int i = start; - for ( ; i < end; i++) - if (!Must_Be_Subset(copy(loops[i]->guard_), copy(then_cond))) - break; - int j = i; - for ( ; j < end; j++) - if (!Must_Be_Subset(copy(loops[j]->guard_), copy(else_cond))) - break; - assert(i>start); - - CG_outputRepr *new_guard_repr = output_guard(ocg, then_cond, assigned_on_the_fly); - if (j == i && end == j) { - guard_repr = ocg->CreateAnd(guard_repr, new_guard_repr); - Relation new_guard = Intersection(copy(guard), copy(then_cond)); - new_guard.simplify(); - return loop_print_repr(loops, start, end, new_guard, guard_repr, indent, ocg, stmts, assigned_on_the_fly); - } - else if (j == i && end > j) { - int new_indent = (guard_repr==NULL)?indent:indent+1; - Relation new_guard = Intersection(copy(guard), copy(then_cond)); - new_guard.simplify(); - CG_outputRepr *stmt_list = loop_print_repr(loops, start, i, new_guard, new_guard_repr, new_indent, ocg, stmts, assigned_on_the_fly); - stmt_list = ocg->StmtListAppend(stmt_list, loop_print_repr(loops, j, end, guard, NULL, new_indent, ocg, stmts, assigned_on_the_fly)); - if (guard_repr == NULL) - return stmt_list; - else - return ocg->CreateIf(indent, guard_repr, stmt_list, NULL); - } - else { // (j > i) - int new_indent = (guard_repr==NULL)?indent:indent+1; - Relation then_new_guard = Intersection(copy(guard), copy(then_cond)); - then_new_guard.simplify(); - CG_outputRepr *then_stmt_list = loop_print_repr(loops, start, i, then_new_guard, NULL, new_indent+1, ocg, stmts, assigned_on_the_fly); - Relation else_new_guard = Intersection(copy(guard), copy(else_cond)); - else_new_guard.simplify(); - CG_outputRepr *else_stmt_list = loop_print_repr(loops, i, j, else_new_guard, NULL, new_indent+1, ocg, stmts, assigned_on_the_fly); - CG_outputRepr *stmt_list = ocg->CreateIf(new_indent, new_guard_repr, then_stmt_list, else_stmt_list); - stmt_list = ocg->StmtListAppend(stmt_list, loop_print_repr(loops, j, end, guard, NULL, new_indent, ocg, stmts, assigned_on_the_fly)); - if (guard_repr == NULL) - return stmt_list; - else - return ocg->CreateIf(indent, guard_repr, stmt_list, NULL); - } -} - -} diff --git a/omega/code_gen/src/code_gen.cc b/omega/code_gen/src/code_gen.cc deleted file mode 100644 index 168c86b..0000000 --- a/omega/code_gen/src/code_gen.cc +++ /dev/null @@ -1,656 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 University of Maryland - Copyright (C) 2008 University of Southern California - Copyright (C) 2009-2010 University of Utah - All Rights Reserved. - - Purpose: - Start code generation process here. - - Notes: - - History: - 04/24/96 MMGenerateCode implementation, added by D people. Lei Zhou -*****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -namespace omega { - - -int last_level;// Should not be global, but it is. -SetTuple new_IS; -SetTupleTuple projected_nIS; -Tuple statementInfo; -RelTuple transformations; - -//protonu--adding stuff to make Chun's code work with Gabe's -Tuple< Tuple > smtNonSplitLevels; -Tuple< Tuple > loopIdxNames;//per stmt -std::vector< std::pair > syncs; - -//protonu-putting this in for now, not sure what all these do -//This lovely ugly hack allows us to extract hard upper-bounds at -//specific loop levels -int checkLoopLevel; -int stmtForLoopCheck; -int upperBoundForLevel; -int lowerBoundForLevel; -bool fillInBounds; - -//trick to static init checkLoopLevel to 0 -class JunkStaticInit{ public: JunkStaticInit(){ checkLoopLevel=0; fillInBounds=false;} }; -static JunkStaticInit junkInitInstance__; - -//end--protonu. - - -CG_result * gen_recursive(int level, IntTuple &isActive); - - -int code_gen_debug=0; - - -SetTuple filter_function_symbols(SetTuple &sets, bool keep_fs){ - SetTuple new_sets(sets.size()); - for(int i = 1; i <= sets.size(); i++) { - Relation R = sets[i]; - Relation &S = new_sets[i]; - assert(R.is_set()); - - S = Relation(R.n_set()); - S.copy_names(R); - F_Exists *fe = S.add_exists(); - F_Or *fo = fe->add_or(); - for(DNF_Iterator D(R.query_DNF()); D; D++) { - F_And *fa = fo->add_and(); - Variable_ID_Tuple &oldlocals = (*D)->locals(); - Section newlocals = fe->declare_tuple(oldlocals.size()); - - /* copy constraints. This is much more difficult than it needs - to be, but add_EQ(Constraint_Handle) doesn't work because it can't - keep track of existentially quantified varaibles across calls. - Sigh. */ - - for(EQ_Iterator e(*D); e; e++) - if((max_fs_arity(*e) > 0) == keep_fs){ - EQ_Handle n = fa->add_EQ(); - for(Constr_Vars_Iter cvi(*e,false);cvi;cvi++) - if((*cvi).var->kind() == Wildcard_Var) - n.update_coef(newlocals[oldlocals.index((*cvi).var)], - (*cvi).coef); - else - if((*cvi).var->kind() == Global_Var) - n.update_coef(S.get_local((*cvi).var->get_global_var(), - (*cvi).var->function_of()), - (*cvi).coef); - else - n.update_coef((*cvi).var,(*cvi).coef); - n.update_const((*e).get_const()); - n.finalize(); - } - - for(GEQ_Iterator g(*D); g; g++) - if((max_fs_arity(*g) > 0) == keep_fs) { - GEQ_Handle n = fa->add_GEQ(); - for(Constr_Vars_Iter cvi(*g,false);cvi;cvi++) - if((*cvi).var->kind() == Wildcard_Var) - n.update_coef(newlocals[oldlocals.index((*cvi).var)], - (*cvi).coef); - else - if((*cvi).var->kind() == Global_Var) - n.update_coef(S.get_local((*cvi).var->get_global_var(), - (*cvi).var->function_of()), - (*cvi).coef); - else - n.update_coef((*cvi).var,(*cvi).coef); - n.update_const((*g).get_const()); - n.finalize(); - } - } - S.finalize(); - } - - return new_sets; -} - - -RelTuple strip_function_symbols(SetTuple &sets) { - return filter_function_symbols(sets,false); -} - -RelTuple extract_function_symbols(SetTuple &sets) { - return filter_function_symbols(sets,true); -} - - -std::string MMGenerateCode(RelTuple &T, SetTuple &old_IS, Relation &known, int effort) { - Tuple nameInfo; - for (int stmt = 1; stmt <= T.size(); stmt++) - nameInfo.append(new CG_stringRepr("s" + to_string(stmt))); - - CG_stringBuilder ocg; - CG_stringRepr *sRepr = static_cast(MMGenerateCode(&ocg, T, old_IS, nameInfo, known, effort)); - - for (int i = 1; i <= nameInfo.size(); i++) - delete nameInfo[i]; - if (sRepr != NULL) - return GetString(sRepr); - else - return std::string(); -} - - -//***************************************************************************** -// MMGenerateCode implementation, added by D people. Lei Zhou, Apr. 24, 96 -//***************************************************************************** -CG_outputRepr* MMGenerateCode(CG_outputBuilder* ocg, RelTuple &T, SetTuple &old_IS, const Tuple &stmt_content, Relation &known, int effort) { - int stmts = T.size(); - if (stmts == 0) - return ocg->CreateComment(1, "No statements found!"); - if (!known.is_null()) - known.simplify(); - - // prepare iteration spaces by splitting disjoint conjunctions - int maxStmt = 1; - last_level = 0; - for (int stmt = 1; stmt <= stmts; stmt++) { - int old_dim = T[stmt].n_out(); - if (old_dim > last_level) - last_level = old_dim; - - for (int i = 1; i <= old_IS[stmt].n_set(); i++) - T[stmt].name_input_var(i, old_IS[stmt].set_var(i)->name()); - for (int i = 1; i <= old_dim; i++) - T[stmt].name_output_var(i, std::string("t")+to_string(i)); - T[stmt].setup_names(); - - Relation R = Range(Restrict_Domain(copy(T[stmt]), copy(old_IS[stmt]))); - R.simplify(); - while(R.is_upper_bound_satisfiable()) { - new_IS.reallocate(maxStmt); - transformations.reallocate(maxStmt); - statementInfo.reallocate(maxStmt); - DNF *dnf = R.query_DNF(); - DNF_Iterator c(dnf); - Relation R2 = Relation(R, *c); - R2.simplify(); - if (R2.is_inexact()) - throw codegen_error("unknown constraint in loop bounds"); - if (known.is_null()) { - new_IS[maxStmt] = R2; - transformations[maxStmt] = T[stmt]; - statementInfo[maxStmt] = stmt_content[stmt]; - maxStmt++; - } - else { - Relation R2_extended = copy(R2); - Relation known_extended = copy(known); - if (R2.n_set() > known.n_set()) - known_extended = Extend_Set(known_extended, R2.n_set()-known.n_set()); - else if (R2.n_set() < known.n_set()) - R2_extended = Extend_Set(R2_extended, known.n_set()-R2.n_set()); - if (Intersection(R2_extended, known_extended).is_upper_bound_satisfiable()) { - new_IS[maxStmt] = R2; - transformations[maxStmt] = T[stmt]; - statementInfo[maxStmt] = stmt_content[stmt]; - maxStmt++; - } - } - c.next(); - if (!c.live()) - break; - if(code_gen_debug) { - fprintf(DebugFile, "splitting iteration space for disjoint form\n"); - fprintf(DebugFile, "Original iteration space: \n"); - R.print_with_subs(DebugFile); - fprintf(DebugFile, "First conjunct: \n"); - R2.print_with_subs(DebugFile); - } - Relation remainder(R, *c); - c.next(); - while (c.live()) { - remainder = Union(remainder, Relation(R, *c)); - c.next(); - } - R = Difference(remainder, copy(R2)); - R.simplify(); - if(code_gen_debug) { - fprintf(DebugFile, "Remaining iteration space: \n"); - R.print_with_subs(DebugFile); - } - } - } - - // reset number of statements - stmts = maxStmt-1; - if(stmts == 0) - return ocg->CreateComment(1, "No points in any of the iteration spaces!"); - - // entend iteration spaces to maximum dimension - for (int stmt = 1; stmt <= stmts; stmt++) { - int old_dim = new_IS[stmt].n_set(); - if (old_dim < last_level) { - new_IS[stmt] = Extend_Set(new_IS[stmt], last_level-old_dim); - F_And *f_root = new_IS[stmt].and_with_and(); - for (int i = old_dim+1; i <= last_level; i++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(new_IS[stmt].set_var(i), 1); - h.update_const(posInfinity); - } - } - } - - // standarize the known condition - if(known.is_null()) { - known = Relation::True(last_level); - } - known = Extend_Set(known, last_level-known.n_set()); - for (int i = 1; i <= last_level; i++) - known.name_set_var(i, std::string("t")+to_string(i)); - known.setup_names(); - - // prepare projected subspaces for each loop level - projected_nIS.clear(); - projected_nIS.reallocate(last_level); - for(int i = 1; i <= last_level; i++ ) { - projected_nIS[i].reallocate(stmts); - } - for (int stmt = 1; stmt <= stmts; stmt++) { - if (last_level > 0) - projected_nIS[last_level][stmt] = new_IS[stmt]; - for (int i = last_level-1; i >= 1; i--) { - projected_nIS[i][stmt] = Project(copy(projected_nIS[i+1][stmt]), i+1, Set_Var); - projected_nIS[i][stmt].simplify(); - } - } - - // recursively generate AST - IntTuple allStmts(stmts); - for(int i = 1; i <= stmts; i++) - allStmts[i] = 1; - CG_result *cg = gen_recursive(1, allStmts); - - // always force finite bounds - cg = cg->recompute(known, known); - cg = cg->force_finite_bounds(); - - // loop overhead removal based on actual nesting depth -- by chun 09/17/2008 - for (int i = 1; i <= min(effort, cg->depth()); i++) - cg = cg->liftOverhead(i); - - // merge adjacent if-conditions -- by chun 10/24/2006 - cg->hoistGuard(); - - // really print out the loop - //CG_outputRepr* sRepr = cg->printRepr(ocg, 1, std::vector(last_level, NULL)); - CG_outputRepr* sRepr = cg->printRepr(ocg, 1, std::vector(last_level)); - delete cg; - cg = NULL; - projected_nIS.clear(); - transformations.clear(); - new_IS.clear(); - - return sRepr; -} - -//protonu--overload the above MMGenerateCode to take into the CUDA-CHiLL -CG_outputRepr* MMGenerateCode(CG_outputBuilder* ocg, RelTuple &T, SetTuple &old_IS, - const Tuple &stmt_content, Relation &known, - Tuple< IntTuple >& smtNonSplitLevels_, - std::vector< std::pair > syncs_, - const Tuple< Tuple >& loopIdxNames_, - int effort) { - int stmts = T.size(); - if (stmts == 0) - return ocg->CreateComment(1, "No statements found!"); - if (!known.is_null()) - known.simplify(); - - //protonu-- - //easier to handle this as a global - smtNonSplitLevels = smtNonSplitLevels_; - syncs = syncs_; - loopIdxNames = loopIdxNames_; - //end-protonu - - - - // prepare iteration spaces by splitting disjoint conjunctions - int maxStmt = 1; - last_level = 0; - for (int stmt = 1; stmt <= stmts; stmt++) { - int old_dim = T[stmt].n_out(); - if (old_dim > last_level) - last_level = old_dim; - - for (int i = 1; i <= old_IS[stmt].n_set(); i++) - T[stmt].name_input_var(i, old_IS[stmt].set_var(i)->name()); - for (int i = 1; i <= old_dim; i++) - T[stmt].name_output_var(i, std::string("t")+to_string(i)); - T[stmt].setup_names(); - - Relation R = Range(Restrict_Domain(copy(T[stmt]), copy(old_IS[stmt]))); - R.simplify(); - while(R.is_upper_bound_satisfiable()) { - new_IS.reallocate(maxStmt); - transformations.reallocate(maxStmt); - statementInfo.reallocate(maxStmt); - - //protonu--putting in fix provided by Mark Hall - smtNonSplitLevels.reallocate(maxStmt); - //end-protonu - - - DNF *dnf = R.query_DNF(); - DNF_Iterator c(dnf); - Relation R2 = Relation(R, *c); - R2.simplify(); - if (R2.is_inexact()) - throw codegen_error("unknown constraint in loop bounds"); - if (known.is_null()) { - new_IS[maxStmt] = R2; - transformations[maxStmt] = T[stmt]; - statementInfo[maxStmt] = stmt_content[stmt]; - maxStmt++; - } - else { - Relation R2_extended = copy(R2); - Relation known_extended = copy(known); - if (R2.n_set() > known.n_set()) - known_extended = Extend_Set(known_extended, R2.n_set()-known.n_set()); - else if (R2.n_set() < known.n_set()) - R2_extended = Extend_Set(R2_extended, known.n_set()-R2.n_set()); - if (Intersection(R2_extended, known_extended).is_upper_bound_satisfiable()) { - new_IS[maxStmt] = R2; - transformations[maxStmt] = T[stmt]; - statementInfo[maxStmt] = stmt_content[stmt]; - maxStmt++; - } - } - c.next(); - if (!c.live()) - break; - if(code_gen_debug) { - fprintf(DebugFile, "splitting iteration space for disjoint form\n"); - fprintf(DebugFile, "Original iteration space: \n"); - R.print_with_subs(DebugFile); - fprintf(DebugFile, "First conjunct: \n"); - R2.print_with_subs(DebugFile); - } - Relation remainder(R, *c); - c.next(); - while (c.live()) { - remainder = Union(remainder, Relation(R, *c)); - c.next(); - } - R = Difference(remainder, copy(R2)); - R.simplify(); - if(code_gen_debug) { - fprintf(DebugFile, "Remaining iteration space: \n"); - R.print_with_subs(DebugFile); - } - } - } - - // reset number of statements - stmts = maxStmt-1; - if(stmts == 0) - return ocg->CreateComment(1, "No points in any of the iteration spaces!"); - - // entend iteration spaces to maximum dimension - for (int stmt = 1; stmt <= stmts; stmt++) { - int old_dim = new_IS[stmt].n_set(); - if (old_dim < last_level) { - new_IS[stmt] = Extend_Set(new_IS[stmt], last_level-old_dim); - F_And *f_root = new_IS[stmt].and_with_and(); - for (int i = old_dim+1; i <= last_level; i++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(new_IS[stmt].set_var(i), 1); - h.update_const(posInfinity); - } - } - } - - // standarize the known condition - if(known.is_null()) { - known = Relation::True(last_level); - } - known = Extend_Set(known, last_level-known.n_set()); - for (int i = 1; i <= last_level; i++) - known.name_set_var(i, std::string("t")+to_string(i)); - known.setup_names(); - - // prepare projected subspaces for each loop level - projected_nIS.clear(); - projected_nIS.reallocate(last_level); - for(int i = 1; i <= last_level; i++ ) { - projected_nIS[i].reallocate(stmts); - } - for (int stmt = 1; stmt <= stmts; stmt++) { - if (last_level > 0) - projected_nIS[last_level][stmt] = new_IS[stmt]; - for (int i = last_level-1; i >= 1; i--) { - projected_nIS[i][stmt] = Project(copy(projected_nIS[i+1][stmt]), i+1, Set_Var); - projected_nIS[i][stmt].simplify(); - } - } - - // recursively generate AST - IntTuple allStmts(stmts); - for(int i = 1; i <= stmts; i++) - allStmts[i] = 1; - CG_result *cg = gen_recursive(1, allStmts); - - // always force finite bounds - cg = cg->recompute(known, known); - cg = cg->force_finite_bounds(); - - // loop overhead removal based on actual nesting depth -- by chun 09/17/2008 - for (int i = 1; i <= min(effort, cg->depth()); i++) - cg = cg->liftOverhead(i); - - // merge adjacent if-conditions -- by chun 10/24/2006 - cg->hoistGuard(); - - // really print out the loop - //CG_outputRepr* sRepr = cg->printRepr(ocg, 1, std::vector(last_level, NULL)); - CG_outputRepr* sRepr = cg->printRepr(ocg, 1, std::vector(last_level )); - delete cg; - cg = NULL; - projected_nIS.clear(); - transformations.clear(); - new_IS.clear(); - - return sRepr; -} - -CG_result *gen_recursive(int level, IntTuple &isActive) { - int stmts = isActive.size(); - - Set active; - int s; - for(s = 1; s <= stmts; s++) - if(isActive[s]) active.insert(s); - - assert (active.size() >= 1); - if(level > last_level) return new CG_leaf(isActive); - - if (active.size() == 1) - return new CG_loop(isActive,level, gen_recursive(level+1,isActive)); - - bool constantLevel = true; - - int test_rel_size; - coef_t start,finish; - finish = -(posInfinity-1); // -(MAXINT-1); - start = posInfinity; // MAXINT; - Tuple when(stmts); - for(s=1; s<=stmts; s++) if (isActive[s]) { - coef_t lb,ub; - test_rel_size = projected_nIS[level][s].n_set(); - projected_nIS[level][s].single_conjunct() - ->query_variable_bounds( - projected_nIS[level][s].set_var(level), - lb,ub); - if(code_gen_debug) { - fprintf(DebugFile, "IS%d: " coef_fmt " <= t%d <= " coef_fmt "\n",s, - lb,level,ub); - projected_nIS[level][s].prefix_print(DebugFile); - } - if (lb != ub) { - constantLevel = false; - break; - } - else { - set_max(finish,lb); - set_min(start,lb); - when[s] = lb; - } - } - - - if (constantLevel && finish-start <= stmts) { - IntTuple newActive(isActive.size()); - for(int i=1; i<=stmts; i++) - newActive[i] = isActive[i] && when[i] == start; - CG_result *r = new CG_loop(isActive,level, - gen_recursive(level+1,newActive)); - for(coef_t time = start+1; time <= finish; time++) { - int count = 0; - for(int i=1; i<=stmts; i++) { - newActive[i] = isActive[i] && when[i] == time; - if (newActive[i]) count++; - } - if (count) { - Relation test_rel(test_rel_size); - GEQ_Handle g = test_rel.and_with_GEQ(); - g.update_coef(test_rel.set_var(level),-1); - g.update_const(time-1); - - r = new CG_split(isActive,level,test_rel,r, - new CG_loop(isActive,level, - gen_recursive(level+1,newActive))); - } - } - return r; - } - -// Since the Hull computation is approximate, we will get regions that -// have no stmts. (since we will have split on constraints on the -// hull, and thus we are looking at a region outside the convex hull -// of all the iteration spaces.) -#if 1 - Relation hull = Hull(projected_nIS[level],isActive,1); -#else - Relation hull = Hull(projected_nIS[level],isActive,0); -#endif - - if(code_gen_debug) { - fprintf(DebugFile, "Hull (level %d) is:\n",level); - hull.prefix_print(DebugFile); - } - - - IntTuple firstChunk(isActive); - IntTuple secondChunk(isActive); - - //protonu-warn Chun about this change - //This does some fancy splitting of statements into loops with the - //fewest dimentions, but that's not necessarily what we want when - //code-gening for CUDA. smtNonSplitLevels keeps track per-statment of - //the levels that should not be split on. - bool checkForSplits = true; - for (int s = 1; s <= isActive.size(); s++){ - if (isActive[s]) { - if(s < smtNonSplitLevels.size() && smtNonSplitLevels[s].index(level-2) != 0){ - checkForSplits = false; - break; - } - } - } - - //protonu-modifying the next for loop - for (int s = 1; checkForSplits && s <= isActive.size(); s++) - if (isActive[s]) { - Relation gist = Gist(copy(projected_nIS[level][s]),copy(hull),1); - if (gist.is_obvious_tautology()) break; - gist.simplify(); - Conjunct *s_conj = gist.single_conjunct(); - for(GEQ_Iterator G(s_conj); G; G++) { - Relation test_rel(gist.n_set()); - test_rel.and_with_GEQ(*G); - Variable_ID v = set_var(level); - coef_t sign = (*G).get_coef(v); - if(sign > 0) test_rel = Complement(test_rel); - if(code_gen_debug) { - fprintf(DebugFile, "Considering split from stmt %d:\n",s); - test_rel.prefix_print(DebugFile); - } - - firstChunk[s] = sign <= 0; - secondChunk[s] = sign > 0; - int numberFirst = sign <= 0; - int numberSecond = sign > 0; - - for (int s2 = 1; s2 <= isActive.size(); s2++) - if (isActive[s2] && s2 != s) { - if(code_gen_debug) - fprintf(DebugFile,"Consider stmt %d\n",s2); - bool t = Intersection(copy(projected_nIS[level][s2]), - copy(test_rel)).is_upper_bound_satisfiable(); - bool f = Difference(copy(projected_nIS[level][s2]), - copy(test_rel)).is_upper_bound_satisfiable(); - assert(t || f); - if(code_gen_debug && t&&f) - fprintf(DebugFile, "Slashes stmt %d\n",s2); - if (t&&f) goto nextGEQ; - if(code_gen_debug) { - if (t) - fprintf(DebugFile, "true for stmt %d\n",s2); - else - fprintf(DebugFile, "false for stmt %d\n",s2); - } - if (t) numberFirst++; - else numberSecond++; - firstChunk[s2] = t; - secondChunk[s2] = !t; - } - - assert(numberFirst+numberSecond>1 && "Can't handle wildcard in iteration space"); - if(code_gen_debug) - fprintf(DebugFile, "%d true, %d false\n", - numberFirst, - numberSecond); - if (numberFirst && numberSecond) { - // Found a dividing constraint - return new CG_split(isActive,level,test_rel, - gen_recursive(level,firstChunk), - gen_recursive(level,secondChunk)); - } - nextGEQ: ; - } - } - - // No way found to divide stmts without splitting, generate loop - - return new CG_loop(isActive,level, gen_recursive(level+1,isActive)); -} - -} diff --git a/omega/code_gen/src/codegen.cc b/omega/code_gen/src/codegen.cc deleted file mode 100755 index 92ca702..0000000 --- a/omega/code_gen/src/codegen.cc +++ /dev/null @@ -1,378 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 the Omega Project Team - Copyright (C) 2005-2011 Chun Chen - All Rights Reserved. - - Purpose: - CodeGen class as entry point for code generation. - - Notes: - Loop variable name prefix should not cause any possible name conflicts - with original loop variables wrapped in statement holder. This guarantees - that variable substitution done correctly in the generated code. - - History: - 04/24/96 MMGenerateCode, added by Fortran D people. Lei Zhou - 09/17/08 loop overhead removal based on actual nesting depth -- by chun - 03/05/11 fold MMGenerateCode into CodeGen class, Chun Chen -*****************************************************************************/ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -namespace omega { - -const std::string CodeGen::loop_var_name_prefix = "t"; -const int CodeGen::var_substitution_threshold = 10; - -//Anand--adding stuff to make Chun's code work with Gabe's -std::vector< std::vector > smtNonSplitLevels; -std::vector< std::vector > loopIdxNames;//per stmt -std::vector< std::pair > syncs; - - - -CodeGen::CodeGen(const std::vector &xforms, const std::vector &IS, const Relation &known, std::vector< std::vector > smtNonSplitLevels_ , std::vector< std::vector > loopIdxNames_, std::vector< std::pair > syncs_) { - // check for sanity of parameters - int num_stmt = IS.size(); - if (xforms.size() != num_stmt) - throw std::invalid_argument("number of iteration spaces does not match number of transformations"); - known_ = copy(known); - if (known_.n_out() != 0) - throw std::invalid_argument("known condition must be a set relation"); - if (known_.is_null()) - known_ = Relation::True(0); - else - known_.simplify(2, 4); - if (!known_.is_upper_bound_satisfiable()) - return; - if (known_.number_of_conjuncts() > 1) - throw std::invalid_argument("only one conjunct allowed in known condition"); - xforms_ = xforms; - for (int i = 0; i < num_stmt; i++) { - xforms_[i].simplify(); - if (!xforms_[i].has_single_conjunct()) - throw std::invalid_argument("mapping relation must have only one conjunct"); - if (xforms_[i].n_inp() != IS[i].n_inp() || IS[i].n_out() != 0) - throw std::invalid_argument("illegal iteration space or transformation arity"); - } - - - //protonu-- - //easier to handle this as a global - smtNonSplitLevels = smtNonSplitLevels_; - syncs = syncs_; - loopIdxNames = loopIdxNames_; - //end-protonu - - - - // find the maximum iteration space dimension we are going to operate on - int num_level = known_.n_inp(); - for (int i = 0; i < num_stmt; i++) - if (xforms_[i].n_out() > num_level) - num_level = xforms_[i].n_out(); - known_ = Extend_Set(known_, num_level-known_.n_inp()); - for (int i = 1; i <= num_level; i++) - known_.name_set_var(i, loop_var_name_prefix + to_string(i)); - known_.setup_names(); - - // split disjoint conjunctions in original iteration spaces - std::vector new_IS; - for (int i = 0; i < num_stmt; i++) { - for (int j = 1; j <= IS[i].n_inp(); j++) - xforms_[i].name_input_var(j, const_cast &>(IS)[i].input_var(j)->name()); - for (int j = 1; j <= xforms_[i].n_out(); j++) - xforms_[i].name_output_var(j, loop_var_name_prefix + to_string(j)); - xforms_[i].setup_names(); - - Relation R = Range(Restrict_Domain(copy(xforms_[i]), copy(IS[i]))); - R = Intersection(Extend_Set(R, num_level-R.n_inp()), copy(known_)); - R.simplify(2, 4); - if (R.is_inexact()) - throw codegen_error("cannot generate code for inexact iteration spaces"); - - while(R.is_upper_bound_satisfiable()) { - DNF *dnf = R.query_DNF(); - DNF_Iterator c(dnf); - Relation R2 = Relation(R, *c); - R2.simplify(); - new_IS.push_back(copy(R2)); - remap_.push_back(i); - c.next(); - if (!c.live()) - break; - Relation remainder(R, *c); - c.next(); - while (c.live()) { - remainder = Union(remainder, Relation(R, *c)); - c.next(); - } - R = Difference(remainder, R2); - R.simplify(2, 4); - } - } - - // number of new statements after splitting - num_stmt = new_IS.size(); - if(!smtNonSplitLevels.empty()) - smtNonSplitLevels.resize(num_stmt); - // assign a dummy value to loops created for the purpose of expanding to maximum dimension - for (int i = 0; i < num_stmt; i++) { - if (xforms[remap_[i]].n_out() < num_level) { - F_And *f_root = new_IS[i].and_with_and(); - for (int j = xforms[remap_[i]].n_out()+1; j <= num_level; j++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(new_IS[i].set_var(j), 1); - h.update_const(posInfinity); - } - new_IS[i].simplify(); - } - } - - // calculate projected subspaces for each loop level once and save for CG tree manipulation later - projected_IS_ = std::vector >(num_level); - for (int i = 0; i < num_level; i++) - projected_IS_[i] = std::vector(num_stmt); - for (int i = 0; i < num_stmt; i++) { - if (num_level > 0) - projected_IS_[num_level-1][i] = new_IS[i]; - for (int j = num_level-1; j >= 1; j--) { - projected_IS_[j-1][i] = Project(copy(projected_IS_[j][i]), j+1, Set_Var); - projected_IS_[j-1][i].simplify(2, 4); - } - } -} - - -CG_result *CodeGen::buildAST(int level, const BoolSet<> &active, bool split_on_const, const Relation &restriction) { - if (level > num_level()) - return new CG_leaf(this, active); - - int num_active_stmt = active.num_elem(); - if (num_active_stmt == 0) - return NULL; - else if (num_active_stmt == 1) - return new CG_loop(this, active, level, buildAST(level+1, active, true, restriction)); - - // use estimated constant bounds for fast non-overlap iteration space splitting - if (split_on_const) { - std::vector, int> > bounds; - - for (BoolSet<>::const_iterator i = active.begin(); i != active.end(); i++) { - Relation r = Intersection(copy(projected_IS_[level-1][*i]), copy(restriction)); - r.simplify(2, 4); - if (!r.is_upper_bound_satisfiable()) - continue; - coef_t lb, ub; - r.single_conjunct()->query_variable_bounds(r.set_var(level),lb,ub); - bounds.push_back(std::make_pair(std::make_pair(lb, ub), *i)); - } - sort(bounds.begin(), bounds.end()); - - std::vector split_cond; - std::vector split_child; - - coef_t prev_val = -posInfinity; - coef_t next_val = bounds[0].first.second; - BoolSet<> next_active(active.size()); - int i = 0; - while (i < bounds.size()) { - if (bounds[i].first.first <= next_val) { - next_active.set(bounds[i].second); - next_val = max(next_val, bounds[i].first.second); - i++; - } - else { - Relation r(num_level()); - F_And *f_root = r.add_and(); - if (prev_val != -posInfinity) { - GEQ_Handle h = f_root->add_GEQ(); - h.update_coef(r.set_var(level), 1); - h.update_const(-prev_val-1); - } - if (next_val != posInfinity) { - GEQ_Handle h = f_root->add_GEQ(); - h.update_coef(r.set_var(level), -1); - h.update_const(next_val); - } - r.simplify(); - - Relation new_restriction = Intersection(copy(r), copy(restriction)); - new_restriction.simplify(2, 4); - CG_result *child = buildAST(level, next_active, false, new_restriction); - if (child != NULL) { - split_cond.push_back(copy(r)); - split_child.push_back(child); - } - next_active.unset_all(); - prev_val = next_val; - next_val = bounds[i].first.second; - } - } - if (!next_active.empty()) { - Relation r = Relation::True(num_level()); - if (prev_val != -posInfinity) { - F_And *f_root = r.and_with_and(); - GEQ_Handle h = f_root->add_GEQ(); - h.update_coef(r.set_var(level), 1); - h.update_const(-prev_val-1); - r.simplify(); - } - Relation new_restriction = Intersection(copy(r), copy(restriction)); - new_restriction.simplify(2, 4); - CG_result *child = buildAST(level, next_active, false, new_restriction); - if (child != NULL) { - split_cond.push_back(copy(r)); - split_child.push_back(child); - } - } - - if (split_child.size() == 0) - return NULL; - else if (split_child.size() == 1) - return split_child[0]; - else - return new CG_split(this, active, split_cond, split_child); - } - // check bound conditions exhaustively for non-overlap iteration space splitting - else { - std::vector Rs(active.size()); - for (BoolSet<>::const_iterator i = active.begin(); i != active.end(); i++) { - Rs[*i] = Intersection(Approximate(copy(projected_IS_[level-1][*i])), copy(restriction)); - Rs[*i].simplify(2, 4); - } - Relation hull = SimpleHull(Rs); - - //protonu-warn Chun about this change - //This does some fancy splitting of statements into loops with the - //fewest dimentions, but that's not necessarily what we want when - //code-gening for CUDA. smtNonSplitLevels keeps track per-statment of - //the levels that should not be split on. - bool checkForSplits = true; - for (BoolSet<>::const_iterator i = active.begin(); i != active.end(); i++) { - if(*i < smtNonSplitLevels.size()) - for(int k = 0; k ::const_iterator i = active.begin(); i != active.end() && checkForSplits; i++) { - Relation r = Gist(copy(Rs[*i]), copy(hull), 1); - if (r.is_obvious_tautology()) - continue; - r = EQs_to_GEQs(r); - - for (GEQ_Iterator e = r.single_conjunct()->GEQs(); e; e++) { - if ((*e).has_wildcards()) - continue; - - Relation cond = Relation::True(num_level()); - BoolSet<> first_chunk(active.size()); - BoolSet<> second_chunk(active.size()); - - if ((*e).get_coef(hull.set_var(level)) > 0) { - cond.and_with_GEQ(*e); - cond = Complement(cond);; - cond.simplify(); - second_chunk.set(*i); - } - else if ((*e).get_coef(hull.set_var(level)) < 0) { - cond.and_with_GEQ(*e); - cond.simplify(); - first_chunk.set(*i); - } - else - continue; - - bool is_proper_split_cond = true; - for (BoolSet<>::const_iterator j = active.begin(); j != active.end(); j++) - if ( *j != *i) { - bool in_first = Intersection(copy(Rs[*j]), copy(cond)).is_upper_bound_satisfiable(); - bool in_second = Difference(copy(Rs[*j]), copy(cond)).is_upper_bound_satisfiable(); - - if (in_first && in_second) { - is_proper_split_cond = false; - break; - } - - if (in_first) - first_chunk.set(*j); - else if (in_second) - second_chunk.set(*j); - } - - if (is_proper_split_cond && first_chunk.num_elem() != 0 && second_chunk.num_elem() != 0) { - CG_result *first_cg = buildAST(level, first_chunk, false, copy(cond)); - CG_result *second_cg = buildAST(level, second_chunk, false, Complement(copy(cond))); - if (first_cg == NULL) - return second_cg; - else if (second_cg == NULL) - return first_cg; - else { - std::vector split_cond; - std::vector split_child; - split_cond.push_back(copy(cond)); - split_child.push_back(first_cg); - split_cond.push_back(Complement(copy(cond))); - split_child.push_back(second_cg); - - return new CG_split(this, active, split_cond, split_child); - } - } - } - } - return new CG_loop(this, active, level, buildAST(level+1, active, true, restriction)); - } -} - - -CG_result *CodeGen::buildAST(int effort) { - if (remap_.size() == 0) - return NULL; - - CG_result *cgr = buildAST(1, ~BoolSet<>(remap_.size()), true, Relation::True(num_level())); - if (cgr == NULL) - return NULL; - - - // break down the complete iteration space condition to levels of bound/guard condtions - cgr = cgr->recompute(cgr->active_, copy(known_), copy(known_)); - - - - if (cgr == NULL) - return NULL; - - // calculate each loop's nesting depth - int depth = cgr->populateDepth(); - - - // redistribute guard condition locations by additional splittings - std::pair result = cgr->liftOverhead(min(effort,depth), false); - - // since guard conditions are postponed for non-loop levels, hoist them now. - // this enables proper if-condition simplication when outputting actual code. - result.first->hoistGuard(); - - - - - return result.first; -} - -} diff --git a/omega/code_gen/src/cscope.out b/omega/code_gen/src/cscope.out deleted file mode 100644 index ac4e74f..0000000 --- a/omega/code_gen/src/cscope.out +++ /dev/null @@ -1,89773 +0,0 @@ -cscope 15 $HOME/suif-cuda-omega-latest/code_gen/src 0000481316 - @CG.cc - -21  - ~ - -22  - ~<¡ršg.h -> - -23  - ~ - -24  - ~ - -25  - ~ - -26  - ~ - -27  - ~ - -28  - ~ - -29  - ~<¡ack -> - -31 -Çme¥aû - - gomega - { - -33 -Tu¶e -< -R–©iÚ -> -Ãw_IS -; - -34 -Tu¶e - > -´ojeùed_nIS -; - -35 -Tu¶e -< -CG_ouutR•r - *> -¡©em’tInfo -; - -36 -Tu¶e -< -R–©iÚ -> -ŒªsfÜm©iÚs -; - -37  -Ï¡_Ëv– -; - -39 -CG_»suÉ - * -g’_»cursive -( -Ëv– -, -IÁTu¶e - & -isAùive -); - -43 -Çme¥aû - - gomega - { - -45 -Tu¶e -< -IÁTu¶e -> -smtNÚS¶™Lev–s -; - -46 -Tu¶e - > -loÝIdxNames -; - -47 -¡d -:: -veùÜ -<¡d:: -·œ -<, std:: -¡ršg -> > -syncs -; - -48  -checkLoÝLev– -; - -49  -¡mtFÜLoÝCheck -; - -50  -uµ”BoundFÜLev– -; - -51  -low”BoundFÜLev– -; - -52 -boÞ - -fžlInBounds -; - -58 - g¡d -:: -¡ršg - -CG_»suÉ -:: -´št -( -šd’t -) { - -59 -CG_¡ršgBužd” - -ocg -; - -60 -CG_ouutR•r - * - g»´ - = -´štR•r -(& -ocg -, -šd’t -, - -61 -¡d -:: -veùÜ -< -CG_ouutR•r - *>( -Ï¡_Ëv– -, - -62 -¡©ic_ÿ¡ -< -CG_ouutR•r - *>( -NULL -))); - -63 ià( - g»´ - =ð -NULL -) - -64  -¡d -:: -¡ršg -(); - -66  -G‘SŒšg -( -»´ -); - -73 - gCG_¥l™ -:: -CG_¥l™ -( -IÁTu¶e - & -aùive -,  -lvl -, cÚ¡ -R–©iÚ - & -cÚd_ -, - -74 -CG_»suÉ - * -T -, CG_»suÉ * -F -) { - -75 -R–©iÚ - - gcÚd - = -cÝy -( -cÚd_ -); - -76 -as£¹ -( -cÚd -. -has_sšgË_cÚjunù -()); - -78 -cÛf_t - - gc - = 0; - -79  - gpos - = -1; - -80 -GEQ_I‹¿tÜ - -G -( -cÚd -. -sšgË_cÚjunù -()); - -81 ià( - gG -) { - -82  -CÚ¡r_V¬s_I‹r - -cvi -(* -G -, -çl£ -); - gcvi -; cvi++) - -83 ià((* - gcvi -). - gcÛf - && (*cvi). - gv¬ --> -kšd -(è=ð -IÅut_V¬ - - -84 && (* -cvi -). -v¬ --> -g‘_pos™iÚ -(è> -pos -) { - -85 -pos - = (* -cvi -). -v¬ --> -g‘_pos™iÚ -(); - -86 - gc - = (* -cvi -). -cÛf -; - -89 #iâdeà -NDEBUG - - -90 ià( - gpos - > - glvl - + 1) { - -91 -årštf -( -DebugFže -, "IÎeg® s¶™‡ˆlvÈ%d\n", -lvl -); - -92 - gcÚd -. -´efix_´št -( -DebugFže -); - -93 - gcode_g’_debug - = 1; - -97 -as£¹ -( -pos - =ð0 ||…o <ð -lvl - + 1); - -99 ià( - gpos - > 0 && - gc - > 0) { - -100 -CG_»suÉ - * - gfoo - = -T -; - -101 - gT - = -F -; - -102 - gF - = -foo -; - -103 ià( - gcode_g’_debug -) { - -104 -årštf -( -DebugFže -, - -105 "Rev”sšg cÏu£ iÀÃw s¶™‚od©†vÈ%d\n", -lvl -); - -106 - gcÚd -. -´efix_´št -( -DebugFže -); - -108 - gcÚd - = -Com¶em’t -( -cÚd -); - -110 - gcÚd -. -sim¶ify -(); - -112 -as£¹ -( -cÚd -. -has_sšgË_cÚjunù -()); - -115 -as£¹ -( -EQ_I‹¿tÜ -( -cÚd -. -sšgË_cÚjunù -())); - -117 - gisAùive - = -aùive -; - -118 - gcÚd™iÚ - = -cÚd -; - -119 - gËv– - = -lvl -; - -120 - gŒueCÏu£ - = -T -; - -121 - gçl£CÏu£ - = -F -; - -124 - g¡d -:: -¡ršg - -CG_¥l™ -:: -´štSŒuùu» -( -šd’t -) { - -125 -¡d -:: -¡ršg - -»suÉ - = -G‘Ind’tS·ûs -( -šd’t -) + "// split‡t " - -126 + -to_¡ršg -((*è -this -è+ "\n" + -G‘Ind’tS·ûs -( -šd’t -) - -127 + "// gu¬d:" + -gu¬d -. -´št_fÜmuÏ_to_¡ršg -() + "\n" - -128 + -G‘Ind’tS·ûs -( -šd’t -) + "// if " - -129 + -cÚd™iÚ -. -´št_fÜmuÏ_to_¡ršg -() + "hen\n" - -130 + -ŒueCÏu£ --> -´štSŒuùu» -( -šd’t - + 1è+ -G‘Ind’tS·ûs -(indent) - -131 + "//ƒl£\n" + -çl£CÏu£ --> -´štSŒuùu» -( -šd’t - + 1); - -132  - g»suÉ -; - -135 -CG_ouutR•r -* - gCG_¥l™ -:: -´štR•r -( -CG_ouutBužd” -* -ocg -,  -šd’t -, - -136 cÚ¡ -¡d -:: -veùÜ -< -CG_ouutR•r - *> & -assigÃd_Ú_the_æy -) { - -138 ià(! -Mu¡_Be_Sub£t -( -cÝy -( -»¡riùiÚs -), cÝy( -known -))) - -139 -´štf -("------------wrong------------------\n"); - -141 -CG_ouutR•r -* - g¡mtLi¡ -; - -143 -CG_ouutR•r - * - gù¾R•r - = -NULL -; - -144 ià(! - ggu¬d -. -is_nuÎ -(è&& !gu¬d. -is_obvious_utÞogy -()) { - -145 - gù¾R•r - = -ouutGu¬d -( -ocg -, -gu¬d -, -assigÃd_Ú_the_æy -); - -146 - gšd’t -++; - -148 ià( - gù¾R•r - !ð -NULL -) - -149 -¡mtLi¡ - = -ocg --> -C»©eIf -( -šd’t - - 1, -ù¾R•r -, - -150 -ŒueCÏu£ --> -´štR•r -( -ocg -, -šd’t -, -assigÃd_Ú_the_æy -), - -151 -çl£CÏu£ --> -´štR•r -( -ocg -, -šd’t -, -assigÃd_Ú_the_æy -)); - -153 - g¡mtLi¡ - = -ocg --> -StmtLi¡Aµ’d -( - -154 -ŒueCÏu£ --> -´štR•r -( -ocg -, -šd’t -, -assigÃd_Ú_the_æy -), - -155 -çl£CÏu£ --> -´štR•r -( -ocg -, -šd’t -, -assigÃd_Ú_the_æy -)); - -157  - g¡mtLi¡ -; - -160 -CG_»suÉ - * - gCG_¥l™ -:: -liáOv”h—d -( -d•th -) { - -161 -as£¹ -( -d•th - >= 1); - -162 - gŒueCÏu£ - = -ŒueCÏu£ --> -liáOv”h—d -( -d•th -); - -163 - gçl£CÏu£ - = -çl£CÏu£ --> -liáOv”h—d -( -d•th -); - -164  - gthis -; - -167 -CG_»suÉ - * - gCG_¥l™ -:: -fÜû_fš™e_bounds -() { - -168 -ŒueCÏu£ - =rueCÏu£-> -fÜû_fš™e_bounds -(); - -169 - gçl£CÏu£ - = -çl£CÏu£ --> -fÜû_fš™e_bounds -(); - -170  - gthis -; - -173 -R–©iÚ - - gCG_¥l™ -:: -fšdOv”h—d -( -liáTo -) { - -174 -R–©iÚ - -r - = -ŒueCÏu£ --> -fšdOv”h—d -( -liáTo -); - -175 ià( - gr -. -is_obvious_utÞogy -()) - -176 - gr - = -çl£CÏu£ --> -fšdOv”h—d -( -liáTo -); - -177  - gr -; - -180 -CG_»suÉ - * - gCG_¥l™ -:: -»compu‹ -(cÚ¡ -R–©iÚ - & -k -, cÚ¡ R–©iÚ & -r -) { - -181 - gknown - = -cÝy -( -k -); - -182 - g»¡riùiÚs - = -cÝy -( -r -); - -184  - gnumAùive - = 0; - -185  - gs - = 1; s <ð -isAùive -. -size -(); s++) - -186 ià( - gisAùive -[ -s -]) { - -187 -R–©iÚ - - gI - = -´ojeùed_nIS -[ -Ëv– -][ -s -]; - -188 ià(! -IÁ”£ùiÚ -( -cÝy -( -»¡riùiÚs -), -I -). -is_uµ”_bound_§tisfŸbË -()) - -189 - gisAùive -[ -s -] = 0; - -191 - gnumAùive -++; - -193 ià( - gnumAùive - == 0) { - -194 -d–‘e - -this -; - -195  -Ãw - - gCG_nuÎ -; - -196 } ià( - gnumAùive - == 1 && 0) { - -199 -CG_»suÉ - * -cg - = -g’_»cursive -( -Ëv– -, -isAùive -); - -200 - gcg - = -cg --> -»compu‹ -( -k -, -r -); - -201 -d–‘e - - gthis -; - -202  - gcg -; - -205 -R–©iÚ - - gÃw_»¡riùiÚs - = -IÁ”£ùiÚ -( -cÝy -( -»¡riùiÚs -), - -206 -cÝy -( -cÚd™iÚ -)); - -207 - gÃw_»¡riùiÚs -. -sim¶ify -(); - -208 - gŒueCÏu£ - = -ŒueCÏu£ --> -»compu‹ -( -known -, -Ãw_»¡riùiÚs -); - -209 - gÃw_»¡riùiÚs - = -Difã»nû -( -cÝy -( -»¡riùiÚs -), cÝy( -cÚd™iÚ -)); - -210 - gÃw_»¡riùiÚs -. -sim¶ify -(); - -211 - gçl£CÏu£ - = -çl£CÏu£ --> -»compu‹ -( -known -, -Ãw_»¡riùiÚs -); - -213 ià( - gŒueCÏu£ --> -isNuÎ -()) { - -214 -CG_»suÉ - * - gcg - = -çl£CÏu£ -; - -215 - gçl£CÏu£ - = -NULL -; - -216 -d–‘e - - gthis -; - -217  - gcg -; - -219 ià( - gçl£CÏu£ --> -isNuÎ -()) { - -220 -CG_»suÉ - * - gcg - = -ŒueCÏu£ -; - -221 - gŒueCÏu£ - = -NULL -; - -222 -d–‘e - - gthis -; - -223  - gcg -; - -225  - gthis -; - -228 -R–©iÚ - - gCG_¥l™ -:: -hoi¡Gu¬d -() { - -229 -R–©iÚ - -gu¬d1 - = -ŒueCÏu£ --> -hoi¡Gu¬d -(); - -230 -R–©iÚ - - ggu¬d2 - = -çl£CÏu£ --> -hoi¡Gu¬d -(); - -231 ià( - ggu¬d -. -is_nuÎ -()) - -232 - ggu¬d - = -R–©iÚ -:: -True -( -cÚd™iÚ -. -n_£t -()); - -234 ià(! - ggu¬d1 -. -is_obvious_utÞogy -(è&& ! - ggu¬d2 -.is_obvious_tautology() - -235 && -Mu¡_Be_Sub£t -( -cÝy -( -gu¬d1 -), cÝy( -gu¬d2 -)) - -236 && -Mu¡_Be_Sub£t -( -cÝy -( -gu¬d2 -), cÝy( -gu¬d1 -))) { - -237 - gŒueCÏu£ --> -»moveGu¬d -(); - -238 - gçl£CÏu£ --> -»moveGu¬d -(); - -239 - ggu¬d - = -IÁ”£ùiÚ -( -gu¬d -, -gu¬d1 -); - -242  - ggu¬d -; - -249 -R–©iÚ - - gCG_Ëaf -:: -fšdOv”h—d -( -liáTo -) { - -250  -s - = 1; - gs - <ð -isAùive -. -size -(); s++) - -251 ià( - gisAùive -[ -s -]) { - -252  - gbb - = ! -gu¬d -[ -s -]. -is_obvious_utÞogy -(); - -253 ià( - gbb -) { - -254 ià( - gcode_g’_debug -) - -255 -årštf -( -DebugFže -, - -257 -s -, -gu¬d -[s]. -´št_fÜmuÏ_to_¡ršg -(). -c_¡r -()); - -258 -R–©iÚ - - gr - = -pickOv”h—d -( -gu¬d -[ -s -], -liáTo -); - -259 ià(! - gr -. -is_obvious_utÞogy -()) - -260  - gr -; - -263  - gR–©iÚ -:: -True -( -known -. -n_£t -()); - -266 - g¡d -:: -¡ršg - -CG_Ëaf -:: -´štSŒuùu» -() { - -267 -¡d -:: -¡ršg - -»suÉ -; - -268  - gs - = 1; s <ð -isAùive -. -size -(); s++) - -269 ià( - gisAùive -[ -s -]) { - -270 - g»suÉ - +ð -¡d -:: -¡ršg -("s"è+ -to_¡ršg -( -s -); - -272  - g»suÉ - + "\n"; - -275 -CG_ouutR•r -* - gCG_Ëaf -:: -´štR•r -( -CG_ouutBužd” -* -ocg -,  -šd’t -, - -276 cÚ¡ -¡d -:: -veùÜ -< -CG_ouutR•r - *> & -assigÃd_Ú_the_æy -) { - -278 ià(! -Mu¡_Be_Sub£t -( -cÝy -( -»¡riùiÚs -), cÝy( -known -))) - -279 -´štf -("------------wrong------------------\n"); - -281 - g¡d -:: -¡ršg - -»suÉ -; - -282 -CG_ouutR•r -* - g¡mtLi¡ - = -NULL -; - -283 -CG_ouutR•r -* - g¡mtNode - = -NULL -; - -285 - gTu¶e -<> - gwÜkšg -; - -287 ià( - gcode_g’_debug - > 1) { - -288 - g»suÉ - = "known: " + -known -. -´št_fÜmuÏ_to_¡ršg -(); - -289 - g¡mtLi¡ - = -ocg --> -StmtLi¡Aµ’d -( -¡mtLi¡ -, - -290 -ocg --> -C»©eComm’t -( -šd’t -, -»suÉ -)); - -293  - gs - = 1; s <ð -isAùive -. -size -(); s++) - -294 ià( - gisAùive -[ -s -]) { - -295 ià( - ggu¬d -[ -s -]. -is_obvious_utÞogy -()) { - -296 - g¡mtNode - = -ouutS‹m’t -( -ocg -, -¡©em’tInfo -[ -s -]-> -þÚe -(), - -297 -šd’t -, -ŒªsfÜm©iÚs -[ -s -], -known -, -assigÃd_Ú_the_æy -); - -298 - g¡mtLi¡ - = -ocg --> -StmtLi¡Aµ’d -( -¡mtLi¡ -, -¡mtNode -); - -300 ià( - gcode_g’_debug - > 1) { - -301 - g»suÉ - = "restrictions: " - -302 + -»¡riùiÚs -. -´št_fÜmuÏ_to_¡ršg -(); - -303 - g¡mtLi¡ - = -ocg --> -StmtLi¡Aµ’d -( -¡mtLi¡ -, - -304 -ocg --> -C»©eComm’t -( -šd’t -, -»suÉ -)); - -306 - gwÜkšg -. -­³nd -( -s -); - -311  - gi - = 1; i <ð -wÜkšg -. -size -(); i++) - -312 ià( - gwÜkšg -[ -i -] != 0) { - -313 -R–©iÚ - -g - = -IÁ”£ùiÚ -( -cÝy -( -gu¬d -[ -wÜkšg -[ -i -]]), cÝy( -known -)); - -314 - g¡mtNode - = -ouutS‹m’t -( -ocg -, -¡©em’tInfo -[ -wÜkšg -[ -i -]]-> -þÚe -(), - -315 -šd’t - + 1, -ŒªsfÜm©iÚs -[ -wÜkšg -[ -i -]], -g -, - -316 -assigÃd_Ú_the_æy -); - -318  - gj - = -i - + 1; j <ð -wÜkšg -. -size -(); j++) - -319 ià( - gwÜkšg -[ -j -] != 0) { - -320 ià( -Mu¡_Be_Sub£t -( -cÝy -( -gu¬d -[ -wÜkšg -[ -i -]]), - -321 -cÝy -( -gu¬d -[ -wÜkšg -[ -j -]])) - -322 && -Mu¡_Be_Sub£t -( -cÝy -( -gu¬d -[ -wÜkšg -[ -j -]]), - -323 -cÝy -( -gu¬d -[ -wÜkšg -[ -i -]]))) { - -324 -¡mtNode - = -ocg --> -StmtLi¡Aµ’d -(stmtNode, - -325 -ouutS‹m’t -( -ocg -, - -326 -¡©em’tInfo -[ -wÜkšg -[ -j -]]-> -þÚe -(), - -327 -šd’t - + 1, -ŒªsfÜm©iÚs -[ -wÜkšg -[ -j -]], - -328 -g -, -assigÃd_Ú_the_æy -)); - -329 - gwÜkšg -[ -j -] = 0; - -333 -CG_ouutR•r - * - gifGu¬d - = -ouutGu¬d -( -ocg -, -gu¬d -[ -wÜkšg -[ -i -]], - -334 -assigÃd_Ú_the_æy -); - -335 - g¡mtNode - = -ocg --> -C»©eIf -( -šd’t -, -ifGu¬d -, -¡mtNode -, -NULL -); - -336 - g¡mtLi¡ - = -ocg --> -StmtLi¡Aµ’d -( -¡mtLi¡ -, -¡mtNode -); - -339  - g¡mtLi¡ -; - -342 -CG_»suÉ -* - gCG_Ëaf -:: -»compu‹ -(cÚ¡ -R–©iÚ - & -k -, cÚ¡ R–©iÚ & -r -) { - -343 - gknown - = -cÝy -( -k -); - -344 - g»¡riùiÚs - = -cÝy -( -r -); - -346 - ggu¬d -. -»®loÿ‹ -( -isAùive -. -size -()); - -348 -boÞ - - gªyAùive - = -çl£ -; - -349  - gs - = 1; s <ð -isAùive -. -size -(); s++) - -350 ià( - gisAùive -[ -s -]) { - -351 -R–©iÚ - - gI - = -IÁ”£ùiÚ -( -cÝy -( -»¡riùiÚs -), cÝy( -Ãw_IS -[ -s -])); - -352 ià(! - gI -. -is_uµ”_bound_§tisfŸbË -()) - -353 - gisAùive -[ -s -] = 0; - -355 - gªyAùive - = -Œue -; - -356 -as£¹ -(! -I -. -is_nuÎ -()); - -357 - ggu¬d -[ -s -] = -Gi¡ -( -cÝy -( -I -), cÝy( -known -), 1); - -363 ià(! - gªyAùive -) { - -364 -d–‘e - - gthis -; - -365  -Ãw - -CG_nuÎ -(); - -367  - gthis -; - -370 -R–©iÚ - - gCG_Ëaf -:: -hoi¡Gu¬d -() { - -371  -s -; - -372  - gs - = 1; s <ð -isAùive -. -size -(è&& !isAùive[ -s -]; s++) - -375 ià( - gs - > - gisAùive -. -size -()) - -376  - gR–©iÚ -:: -True -(1); - -378 -R–©iÚ - - ggu¬d1 - = -gu¬d -[ -s -]; - -380  - gi - = -s - + 1; i <ð -isAùive -. -size -(); i++) - -381 ià( - gisAùive -[ -i -] - -382 && !( -Mu¡_Be_Sub£t -( -cÝy -( -gu¬d1 -), cÝy( -gu¬d -[ -i -])) - -383 && -Mu¡_Be_Sub£t -( -cÝy -( -gu¬d -[ -i -]), cÝy( -gu¬d1 -)))) - -384  - gR–©iÚ -:: -True -( -gu¬d1 -. -n_£t -()); - -386  - ggu¬d1 -; - -389  - gCG_Ëaf -:: -»moveGu¬d -() { - -390  -i - = 1; - gi - <ð -isAùive -. -size -(); i++) - -391 ià( - gisAùive -[ -i -]) - -392 - ggu¬d -[ -i -] = -R–©iÚ -:: -True -( -gu¬d -[i]. -n_£t -()); - -399 -CG_»suÉ - * - gCG_loÝ -:: -fÜû_fš™e_bounds -() { - -400 ià(! -ÃedLoÝ - - -401 || ( -hasBound -( -bounds -, -Ëv– -, 0) && hasBound(bounds,†evel, 1))) { - -402 - gbody - = -body --> -fÜû_fš™e_bounds -(); - -403  - gthis -; - -406 ià( - gcode_g’_debug -) - -407 -årštf -( -DebugFže -, "Don't have finite bounds in:\n%s\n\n", - -408 -this --> -´št -(2). -c_¡r -()); - -409 -boÞ - - gbb - = ! -hasBound -( -bounds -, -Ëv– -, 0); - -410  - gdœeùiÚ - = -bb - ? 0 : 1; - -411  - gs -; - -412 -R–©iÚ - - gS -; - -413  - gs - = 1; s <ð -isAùive -. -size -(); s++) - -414 ià( - gisAùive -[ -s -]) - -415 ià( -fšd_ªy_cÚ¡¿št -( -s -, -Ëv– -, -»¡riùiÚs -, -dœeùiÚ -, -S -, - -416 -çl£ -)) - -420 ià( - gS -. -is_nuÎ -()) - -421  - gs - = 1; s <ð -isAùive -. -size -(); s++) - -422 ià( - gisAùive -[ -s -]) - -423 ià( -fšd_ªy_cÚ¡¿št -( -s -, -Ëv– -, -»¡riùiÚs -, -dœeùiÚ -, -S -, - -424 -Œue -)) - -427 ià( - gS -. -is_nuÎ -()) { - -429 -årštf -( -DebugFže -,"hasBound(%s,%d,%sè§id f®£, buˆov”h—d wa utÞogy\n", -I -. -´št_fÜmuÏ_to_¡ršg -(). -c_¡r -(), -Ëv– -, -dœeùiÚ -?"upper bound":"lower bound"); - -431 -throw - -codeg’_”rÜ -("unableo force finite bounds"); - -436 -´štf -("S¶™šg oÀ%s\n", -S -. -´št_fÜmuÏ_to_¡ršg -(). -c_¡r -()); - -438 -CG_»suÉ - * - g¥l - = -Ãw - -CG_¥l™ -( -isAùive -, -Ëv– -, -S -, -this -,his-> -þÚe -()); - -439 - g¥l - = -¥l --> -»compu‹ -( -cÝy -( -known -), cÝy( -»¡riùiÚs -)); - -441 ià( - gcode_g’_debug -) - -442 -årštf -( -DebugFže -,"S¶™ oÀtØü—‹ fš™bounds:\n%s\n\n", -¥l --> -´št -(2). -c_¡r -()); - -444  - g¥l --> -fÜû_fš™e_bounds -(); - -447 -CG_»suÉ - * - gCG_loÝ -:: -liáOv”h—d -( -d•th -) { - -448 -as£¹ -( -d•th - >= 1); - -449 ià( - gthis --> -d•th -(è< - gd•th -) - -450  - gthis -; - -451 ià(!( - gÃedLoÝ - && - gthis --> -d•th -() == depth)) { - -452 -body - = body-> -liáOv”h—d -( -d•th -); - -453  - gthis -; - -456 -R–©iÚ - - gc - = -body --> -fšdOv”h—d -( -Ëv– -); - -457 ià( - gc -. -is_obvious_utÞogy -()) - -458  - gthis -; - -459 -as£¹ -( -c -. -is_uµ”_bound_§tisfŸbË -()); - -460 - g¡d -:: -¡ršg - -befÜe -; - -461 ià( - gcode_g’_debug -) { - -462 - gbefÜe - = -´št -(1); - -464 -CG_»suÉ - * - gs - = -Ãw - -CG_¥l™ -( -isAùive -, -Ëv– -, -c -, -this -,his-> -þÚe -()); - -466 - gs - = -s --> -»compu‹ -( -cÝy -( -known -), cÝy( -»¡riùiÚs -)); - -467 ià( - gcode_g’_debug -) { - -468 - g¡d -:: -¡ršg - -aá” - = -s --> -´št -(1); - -469 -årštf -( -DebugFže -, "Lifted out overhead of %s\n", - -470 -c -. -´št_fÜmuÏ_to_¡ršg -(). -c_¡r -()); - -471 -årštf -( -DebugFže -, "äom:\n%s\n", -befÜe -. -c_¡r -()); - -472 -årštf -( -DebugFže -, "tØg‘:\n%s--\n", -aá” -. -c_¡r -()); - -474 - gs - = -s --> -liáOv”h—d -( -d•th -); - -475  - gs -; - -478 - g¡d -:: -¡ršg - -CG_loÝ -:: -´štSŒuùu» -( -šd’t -) { - -479 -¡d -:: -¡ršg - -s - = ""; - -480  - gšdÁ - = -šd’t -; - -481 - gs - +ð -G‘Ind’tS·ûs -( -šd’t -è+ "//†oÝ" + ( -ÃedLoÝ - ? "" : "(single)") - -482 + " fÜ" + -to_¡ršg -( -Ëv– -è+ "‡ˆ" +o_¡ršg((*è -this -) - -484 - gs - +ð -G‘Ind’tS·ûs -( -šd’t -) + "// known: " - -485 + -known -. -´št_fÜmuÏ_to_¡ršg -() + "\n"; - -486 - gs - +ð -G‘Ind’tS·ûs -( -šd’t -) + "// guard: " - -487 + -gu¬d -. -´št_fÜmuÏ_to_¡ršg -() + "\n"; - -488 - gs - +ð -G‘Ind’tS·ûs -( -šd’t -) + "// bounds: " - -489 + -bounds -. -´št_fÜmuÏ_to_¡ršg -() + "\n"; - -492  - gi - = 1; i <ð -isAùive -. -size -(); i++) - -493 ià( - gisAùive -[ -i -]) { - -494 - gs - +ð -G‘Ind’tS·ûs -( -šd’t -è+ "// " + "s" + -to_¡ršg -( -i -) + ":" - -495 + -´ojeùed_nIS -[ -Ëv– -][ -i -]. -´št_fÜmuÏ_to_¡ršg -() + "\n"; - -498  - gs - + - gbody --> -´štSŒuùu» -( -šdÁ - + 1è+ -G‘Ind’tS·ûs -(indnt + 1) - -502 -CG_ouutR•r -* - gCG_loÝ -:: -´štR•r -( -CG_ouutBužd” -* -ocg -,  -šd’t -, - -503 cÚ¡ -¡d -:: -veùÜ -< -CG_ouutR•r - *> & -assigÃd_Ú_the_æy -) { - -505 ià(! -Mu¡_Be_Sub£t -( -cÝy -( -»¡riùiÚs -), cÝy( -known -))) - -506 -´štf -("------------wrong------------------\n"); - -529 -CG_ouutR•r -* - ggu¬dR•r - = -ouutGu¬d -( -ocg -, -gu¬d -, -assigÃd_Ú_the_æy -); - -530 -R–©iÚ - - g’fÜûd - = -IÁ”£ùiÚ -( -cÝy -( -known -), cÝy( -gu¬d -)); - -531 - g’fÜûd -. -sim¶ify -(); - -536 - g¡d -:: -veùÜ -< -CG_ouutR•r - *> -aÙf - = -assigÃd_Ú_the_æy -; - -538 - g¡d -:: -·œ -< -CG_ouutR•r - *, - gboÞ -> - geqR•r - = -ouutAssignm’t -( -ocg -, -bounds -, - -539 -bounds -. -£t_v¬ -( -Ëv– -), -’fÜûd -, -gu¬dR•r -, -aÙf -); - -540 ià(! - geqR•r -. - g£cÚd -) - -541 - gaÙf -[ -Ëv– - - 1] = -eqR•r -. -fœ¡ -; - -543  - gšdÁ - = -šd’t -; - -544 ià( - ggu¬dR•r - !ð -NULL -) - -545 -šdÁ -++; - -548 ià( - gcheckLoÝLev– -) { - -549 ià( - gËv– - =ð -checkLoÝLev– -) { - -550 -boÞ - -¡mtP»£Á - = -çl£ -; - -551  - gs - = 1; s <ð -isAùive -. -size -(); s++) { - -552 ià( - gisAùive -[ -s -] && - gs - - 1 =ð -¡mtFÜLoÝCheck -) - -553 -¡mtP»£Á - = -Œue -; - -555 ià( - g¡mtP»£Á -) { - -556 - gfžlInBounds - = -Œue -; - -563 - g¡d -:: -·œ -< -CG_ouutR•r - *, - gboÞ -> - gù¾R•r - = -ouutBounds -( -ocg -, -bounds -, - -564 -bounds -. -£t_v¬ -( -Ëv– -), -šdÁ -, -’fÜûd -, -aÙf -); - -567 - gfžlInBounds - = -çl£ -; - -570 -R–©iÚ - - gËá_ov” - = -Gi¡ -( -cÝy -( -bounds -), cÝy( -’fÜûd -), 1); - -572 ià(! - gËá_ov” -. -is_obvious_utÞogy -()) - -573 -´štf -("=============something wrong===============\n"); - -575 -CG_ouutR•r - * - gloÝR•r - = -NULL -; - -576 ià( - geqR•r -. - g£cÚd -) { - -577 -CG_ouutR•r - * - gbodyR•r - = -body --> -´štR•r -( -ocg -, -šdÁ -, -aÙf -); - -578 -CG_ouutR•r - * - gassignR•r - = -ocg --> -C»©eAssignm’t -( -šdÁ -, - -579 -ocg --> -C»©eId’t -( -bounds -. -£t_v¬ -( -Ëv– -)-> -Çme -()), -eqR•r -. -fœ¡ -); - -580 - gloÝR•r - = -ocg --> -StmtLi¡Aµ’d -( -assignR•r -, -bodyR•r -); - -581 } ià( - gù¾R•r -. - g£cÚd -) { - -582 -CG_ouutR•r - * - gbodyR•r - = -body --> -´štR•r -( -ocg -, -šdÁ - + 1, -aÙf -); - -583 - gloÝR•r - = -ocg --> -C»©eLoÝ -( -šdÁ -, -ù¾R•r -. -fœ¡ -, -bodyR•r -); - -585 #ifdeà -BUILDCUDA - - -591 -boÞ - - gblockLoÝ - = -çl£ -; - -592 -boÞ - - gth»adLoÝ - = -çl£ -; - -593 -boÞ - - gsync - = -çl£ -; - -594  - gfœ¡AùiveStmt - = -1; - -595  - gs - = 1; s <ð -isAùive -. -size -(); s++) { - -596 ià( - gisAùive -[ -s -]) { - -597 ià( - gfœ¡AùiveStmt - < 0) - -598 - gfœ¡AùiveStmt - = -s -; - -602  - gidx - = -smtNÚS¶™Lev–s -[ -s -]. -šdex -( -Ëv– -); - -603 ià( - gidx - == 1) { - -604 -blockLoÝ - = -Œue -; - -607 ià( - gidx - == 2) { - -608 -th»adLoÝ - = -Œue -; - -612 ià( - gblockLoÝ - && - gth»adLoÝ -) { - -613 -årštf -( -¡d”r -, - -615 -Ëv– -); - -616 - gth»adLoÝ - = -çl£ -; - -618 - g¡d -:: -¡ršg - -´eã¼edIdx -; - -619 ià( - gloÝIdxNames -. -size -() - -620 && ( - gËv– - / 2è- 1 < - gloÝIdxNames -[ -fœ¡AùiveStmt -]. -size -()) - -621 - g´eã¼edIdx - = -loÝIdxNames -[ -fœ¡AùiveStmt -][( -Ëv– - / 2)]; - -622  - gs - = 1; s <ð -isAùive -. -size -(); s++) { - -623 ià( - gisAùive -[ -s -]) { - -624  - gi - = 0; i < - gsyncs -. -size -(); i++) { - -625 ià( - gsyncs -[ -i -]. - gfœ¡ - =ð -s - - 1 - -626 && -¡rcmp -( -syncs -[ -i -]. -£cÚd -. -c_¡r -(), - -627 -´eã¼edIdx -. -c_¡r -()) == 0) { - -628 -sync - = -Œue -; - -634 ià( - gth»adLoÝ - || - gblockLoÝ - || - g´eã¼edIdx -. -Ëngth -() != 0) { - -635  -buf -[1024]; - -636 - g¡d -:: -¡ršg - -loÝ -; - -637 ià( - gblockLoÝ -) - -638 - gloÝ - = "blockLoop "; - -639 ià( - gth»adLoÝ -) - -640 - gloÝ - = "threadLoop "; - -641 ià( - g´eã¼edIdx -. -Ëngth -(è!ð0 && -sync -) { - -642 -¥rštf -( -buf -, "~cuda~ %¥»ã¼edIdx: % sync", -loÝ -. -c_¡r -(), - -643 -´eã¼edIdx -. -c_¡r -()); - -644 } ià( - g´eã¼edIdx -. -Ëngth -() != 0) { - -645 -¥rštf -( -buf -, "~cuda~ %¥»ã¼edIdx: %s", -loÝ -. -c_¡r -(), - -646 -´eã¼edIdx -. -c_¡r -()); - -648 -¥rštf -( -buf -, "~cuda~ %s", -loÝ -. -c_¡r -()); - -651 #ifdeà -BUILD_ROSE - - -652 - gloÝR•r - = -ocg --> -C»©eA‰ribu‹ -( -loÝR•r -, -buf -); - -658 - gloÝR•r - = -ocg --> -StmtLi¡Aµ’d -(ocg-> -C»©eComm’t -( -šdÁ -, -buf -), - -659 -loÝR•r -); - -668 } ià( - gù¾R•r -. - gfœ¡ - !ð -NULL -) { - -669 -CG_ouutR•r - * -bodyR•r - = -body --> -´štR•r -( -ocg -, -šdÁ -, -aÙf -); - -670 - gloÝR•r - = -ocg --> -StmtLi¡Aµ’d -( -ù¾R•r -. -fœ¡ -, -bodyR•r -); - -672 - gloÝR•r - = -body --> -´štR•r -( -ocg -, -šdÁ -, -aÙf -); - -674 ià( - ggu¬dR•r - !ð -NULL -) - -675 -loÝR•r - = -ocg --> -C»©eIf -( -šd’t -, -gu¬dR•r -,†oÝR•r, -NULL -); - -677 -d–‘e - - gaÙf -[ -Ëv– - - 1]; - -678  - gloÝR•r -; - -757 -R–©iÚ - - gCG_loÝ -:: -fšdOv”h—d -( -liáTo -) { - -760 ià( -ÃedLoÝ -) { - -761  -bb - = ! -gu¬d -. -is_obvious_utÞogy -(); - -762 ià( - gbb -) { - -764 -årštf -( -DebugFže -,"Tryingo„emove overhead on guard of†oop %x‡t†evel %d: %s\n", - -765 (*è -this -, -Ëv– -, -gu¬d -. -´št_fÜmuÏ_to_¡ršg -(). -c_¡r -()); - -767 -R–©iÚ - - gr - = -pickOv”h—d -( -gu¬d -, -liáTo -); - -768 ià(! - gr -. -is_obvious_utÞogy -()) - -769  - gr -; - -771 -R–©iÚ - - gb - = -bounds -; - -772 -R–©iÚ - - gr - = -mšMaxOv”h—d -( -b -, -Ëv– -); - -773 ià(! - gr -. -is_obvious_utÞogy -()) { - -775 -årštf -( -DebugFže -,"Tryingo„emove minMax overhead on guard of†oop %x‡t†evel %d: %s\n", - -776 (*è -this -, -Ëv– -, -gu¬d -. -´št_fÜmuÏ_to_¡ršg -(). -c_¡r -()); - -778  - gr -; - -781 -R–©iÚ - - gr - = -body --> -fšdOv”h—d -( -liáTo -); - -782 ià( - gr -. -is_obvious_utÞogy -()) - -783  - gr -; - -797 - gr - = -IÁ”£ùiÚ -( -r -, -cÝy -( -bounds -)); - -799 - gr - = -´ojeù_Úto_Ëv–s -( -r -, -Ëv– -, 0); - -801 - gr - = -Gi¡ -( -r -, -cÝy -( -bounds -), 1); - -804  - gr -; - -807 -CG_»suÉ - * - gCG_loÝ -:: -»compu‹ -(cÚ¡ -R–©iÚ - & -k -, cÚ¡ R–©iÚ & -r -) { - -808 - gknown - = -cÝy -( -k -); - -809 - g»¡riùiÚs - = -cÝy -( -r -); - -813 -boÞ - - gªyAùive - = -çl£ -; - -814  - gs - = 1; s <ð -isAùive -. -size -(); s++) - -815 ià( - gisAùive -[ -s -]) { - -816 ià(! -IÁ”£ùiÚ -( -cÝy -( -»¡riùiÚs -), - -817 -cÝy -( -´ojeùed_nIS -[ -Ëv– -][ -s -])). -is_uµ”_bound_§tisfŸbË -()) { - -818 - gisAùive -[ -s -] = 0; - -820 - gªyAùive - = -Œue -; - -823 ià(! - gªyAùive -) { - -824 -d–‘e - - gthis -; - -825  -Ãw - -CG_nuÎ -(); - -832 -R–©iÚ - - ghuÎ - = -HuÎ -( -´ojeùed_nIS -[ -Ëv– -], -isAùive -, 1, -Œue -, - -833 -cÝy -( -»¡riùiÚs -)); - -834 - ghuÎ - = -IÁ”£ùiÚ -( -huÎ -, -cÝy -( -»¡riùiÚs -)); - -835 - ghuÎ -. -sim¶ify -(2, 4); - -838 - gÃedLoÝ - = -Œue -; - -839  -EQ_I‹¿tÜ - - ge - = -huÎ -. -sšgË_cÚjunù -()-> -EQs -();ƒ;ƒ++) { - -840 ià(!(* - ge -). -has_wždÿrds -(è&& (*e). -g‘_cÛf -( -huÎ -. -£t_v¬ -( -Ëv– -)) != 0) { - -841 -ÃedLoÝ - = -çl£ -; - -842 - gbounds - = -R–©iÚ -:: -True -( -huÎ -. -n_£t -()); - -843 - gbounds -. -ªd_w™h_EQ -(* -e -); - -844 - gbounds -. -sim¶ify -(); - -845 - gbounds -. -cÝy_Çmes -( -huÎ -); - -846 - gbounds -. -£tup_Çmes -(); - -852 ià( - gÃedLoÝ -) { - -853 - ghuÎ - = -Gi¡ -( -huÎ -, -cÝy -( -known -), 1); - -854 -R–©iÚ - - gb - = -huÎ -; - -856 - gbounds - = -R–©iÚ -( -huÎ -. -n_£t -()); - -857 -F_Exi¡s - * - gã - = -bounds -. -add_ªd -()-> -add_exi¡s -(); - -858 -F_And - * - gf_roÙ - = -ã --> -add_ªd -(); - -861 -boÞ - - ghas_uÄesÞved_bound - = -çl£ -; - -863 -CÚjunù - * - gc - = -b -. -sšgË_cÚjunù -(); - -864 -V¬ŸbË_ID - - gv - = -b -. -£t_v¬ -( -Ëv– -); - -865 - g¡d -:: -m­ - < -V¬ŸbË_ID -, - gV¬ŸbË_ID - > - gexi¡s_m­pšg -; - -866 - g¡d -:: -¡ack - < -¡d -:: -·œ -< -GEQ_HªdË -, - gV¬ŸbË_ID -> > - gæoÜ_geq_¡ack -; - -867 - g¡d -:: -£t - < -V¬ŸbË_ID - > -æoÜ_v¬_£t -; - -870  -GEQ_I‹¿tÜ - -gi -( -c -); - ggi -; gi++) - -871 ià((* - ggi -). -g‘_cÛf -( -v -) != 0) { - -872 -boÞ - -is_·¹_of_bound - = -Œue -; - -873 -GEQ_HªdË - - gh2 -; - -874  -CÚ¡r_V¬s_I‹r - -cvi -(* -gi -, -Œue -); - gcvi -; cvi++) - -875 ià(! -fšdFloÜIÃqu®™y -( -b -, -cvi -. -cu¼_v¬ -(), -h2 -, -v -)) { - -876 - ghas_uÄesÞved_bound - = -Œue -; - -877 - gis_·¹_of_bound - = -çl£ -; - -880 ià(! - gis_·¹_of_bound -) - -883 -GEQ_HªdË - - gh - = -f_roÙ --> -add_GEQ -(); - -884  -CÚ¡r_V¬s_I‹r - -cvi -(* -gi -); - gcvi -; cvi++) { - -885 -V¬ŸbË_ID - - gv2 - = -cvi -. -cu¼_v¬ -(); - -886  - gv2 --> -kšd -()) { - -887  - gIÅut_V¬ -: { - -888  -pos - = -v2 --> -g‘_pos™iÚ -(); - -889 - gh -. -upd©e_cÛf -( -bounds -. -£t_v¬ -( -pos -), -cvi -. -cu¼_cÛf -()); - -892  - gExi¡s_V¬ -: - -893  -Wždÿrd_V¬ -: { - -894 -¡d -:: -m­ -< -V¬ŸbË_ID -, - gV¬ŸbË_ID ->:: -™”©Ü - -p - = - -895 -exi¡s_m­pšg -. -fšd -( -v2 -); - -896 -V¬ŸbË_ID - - ge -; - -897 ià( - gp - =ð -exi¡s_m­pšg -. -’d -()) { - -898 -e - = -ã --> -deþ¬e -(); - -899 - gexi¡s_m­pšg -[ -v2 -] = -e -; - -901 - ge - = (* -p -). -£cÚd -; - -902 - gh -. -upd©e_cÛf -( -e -, -cvi -. -cu¼_cÛf -()); - -904 ià( - gæoÜ_v¬_£t -. -fšd -( -v2 -è=ð -æoÜ_v¬_£t -. -’d -()) { - -905 -fšdFloÜIÃqu®™y -( -b -, -v2 -, -h2 -, -v -); - -906 - gæoÜ_geq_¡ack -. -push -( -¡d -:: -make_·œ -( -h2 -, -v2 -)); - -907 - gæoÜ_v¬_£t -. -š£¹ -( -v2 -); - -911  - gGlob®_V¬ -: { - -912 -Glob®_V¬_ID - -g - = -v2 --> -g‘_glob®_v¬ -(); - -913 -V¬ŸbË_ID - - gv3 -; - -914 ià( - gg --> -¬™y -() == 0) - -915 -v3 - = -bounds -. -g‘_loÿl -( -g -); - -917 - gv3 - = -bounds -. -g‘_loÿl -( -g -, -v2 --> -funùiÚ_of -()); - -918 - gh -. -upd©e_cÛf -( -v3 -, -cvi -. -cu¼_cÛf -()); - -922 -as£¹ -(0); - -925 - gh -. -upd©e_cÚ¡ -((* -gi -). -g‘_cÚ¡ -()); - -929 ! - gæoÜ_geq_¡ack -. -em±y -()) { - -930 - g¡d -:: -·œ - < -GEQ_HªdË -, - gV¬ŸbË_ID - > - gp - = -æoÜ_geq_¡ack -. -tÝ -(); - -931 - gæoÜ_geq_¡ack -. -pÝ -(); - -933 -GEQ_HªdË - - gh1 - = -f_roÙ --> -add_GEQ -(); - -934 -GEQ_HªdË - - gh2 - = -f_roÙ --> -add_GEQ -(); - -935  -CÚ¡r_V¬s_I‹r - -cvi -( -p -. -fœ¡ -); - gcvi -; cvi++) { - -936 -V¬ŸbË_ID - - gv2 - = (* -cvi -). -v¬ -; - -937  - gv2 --> -kšd -()) { - -938  - gIÅut_V¬ -: { - -939  -pos - = -v2 --> -g‘_pos™iÚ -(); - -940 - gh1 -. -upd©e_cÛf -( -bounds -. -šput_v¬ -( -pos -), -cvi -. -cu¼_cÛf -()); - -941 - gh2 -. -upd©e_cÛf -( -bounds -. -šput_v¬ -( -pos -), - -cvi -. -cu¼_cÛf -()); - -944  - gExi¡s_V¬ -: - -945  -Wždÿrd_V¬ -: { - -946 -¡d -:: -m­ -< -V¬ŸbË_ID -, - gV¬ŸbË_ID ->:: -™”©Ü - -p2 - = - -947 -exi¡s_m­pšg -. -fšd -( -v2 -); - -948 -V¬ŸbË_ID - - ge -; - -949 ià( - gp2 - =ð -exi¡s_m­pšg -. -’d -()) { - -950 -e - = -ã --> -deþ¬e -(); - -951 - gexi¡s_m­pšg -[ -v2 -] = -e -; - -953 - ge - = (* -p2 -). -£cÚd -; - -954 - gh1 -. -upd©e_cÛf -( -e -, -cvi -. -cu¼_cÛf -()); - -955 - gh2 -. -upd©e_cÛf -( -e -, - -cvi -. -cu¼_cÛf -()); - -957 ià( - gæoÜ_v¬_£t -. -fšd -( -v2 -è=ð -æoÜ_v¬_£t -. -’d -()) { - -958 -GEQ_HªdË - -h3 -; - -959 -fšdFloÜIÃqu®™y -( -b -, -v2 -, -h3 -, -v -); - -960 - gæoÜ_geq_¡ack -. -push -( -¡d -:: -make_·œ -( -h3 -, -v2 -)); - -961 - gæoÜ_v¬_£t -. -š£¹ -( -v2 -); - -965  - gGlob®_V¬ -: { - -966 -Glob®_V¬_ID - -g - = -v2 --> -g‘_glob®_v¬ -(); - -967 -V¬ŸbË_ID - - gv3 -; - -968 ià( - gg --> -¬™y -() == 0) - -969 -v3 - = -bounds -. -g‘_loÿl -( -g -); - -971 - gv3 - = -bounds -. -g‘_loÿl -( -g -, -v2 --> -funùiÚ_of -()); - -972 - gh1 -. -upd©e_cÛf -( -v3 -, -cvi -. -cu¼_cÛf -()); - -973 - gh2 -. -upd©e_cÛf -( -v3 -, - -cvi -. -cu¼_cÛf -()); - -977 -as£¹ -(0); - -980 - gh1 -. -upd©e_cÚ¡ -( -p -. -fœ¡ -. -g‘_cÚ¡ -()); - -981 - gh2 -. -upd©e_cÚ¡ -(- -p -. -fœ¡ -. -g‘_cÚ¡ -()); - -982 - gh2 -. -upd©e_cÚ¡ -(- -p -. -fœ¡ -. -g‘_cÛf -Õ. -£cÚd -) - 1); - -985 ià( - ghas_uÄesÞved_bound -) { - -986 - gb - = -Aµroxim©e -( -b -); - -987 - gb -. -sim¶ify -(); - -988 - gc - = -b -. -sšgË_cÚjunù -(); - -990  -GEQ_I‹¿tÜ - -gi -( -c -); - ggi -; gi++) - -991 ià((* - ggi -). -g‘_cÛf -( -v -) != 0) - -992 -f_roÙ --> -add_GEQ -(* -gi -); - -996 -R–©iÚ - - gthe_gcs - = -g»©e¡_commÚ_¡• -( -´ojeùed_nIS -[ -Ëv– -], -isAùive -, - -997 -Ëv– -, -known -); - -998 - gbounds - = -IÁ”£ùiÚ -( -bounds -, -cÝy -( -the_gcs -)); - -999 - gbounds -. -sim¶ify -(); - -1000 - gbounds -. -cÝy_Çmes -( -huÎ -); - -1001 - gbounds -. -£tup_Çmes -(); - -1005 ià( - gÃedLoÝ -) { - -1006 - ggu¬d - = -Gi¡ -( -cÝy -( -huÎ -), cÝy( -bounds -)); - -1007 - ggu¬d - = -Projeù -( -gu¬d -, gu¬d. -£t_v¬ -( -Ëv– -)); - -1008 - ggu¬d - = -Gi¡ -( -gu¬d -, -cÝy -( -known -)); - -1009 - ggu¬d -. -sim¶ify -(); - -1014 - ggu¬d - = -R–©iÚ -:: -True -( -huÎ -. -n_£t -()); - -1016 - ggu¬d -. -cÝy_Çmes -( -huÎ -); - -1017 - ggu¬d -. -£tup_Çmes -(); - -1020 -R–©iÚ - - g’fÜûd - = -IÁ”£ùiÚ -( -cÝy -( -bounds -), cÝy( -gu¬d -)); - -1021 - g’fÜûd -. -sim¶ify -(); - -1022 -R–©iÚ - - gÃw_known - = -IÁ”£ùiÚ -( -cÝy -( -known -), cÝy( -’fÜûd -)); - -1023 - gÃw_known -. -sim¶ify -(); - -1024 -R–©iÚ - - gÃw_»¡riùiÚs - = -IÁ”£ùiÚ -( -cÝy -( -»¡riùiÚs -), - -1025 -cÝy -( -’fÜûd -)); - -1026 - gÃw_»¡riùiÚs -. -sim¶ify -(); - -1027 - gbody - = -body --> -»compu‹ -( -Ãw_known -, -Ãw_»¡riùiÚs -); - -1028  - gthis -; - -1031 -R–©iÚ - - gCG_loÝ -:: -hoi¡Gu¬d -() { - -1032 -R–©iÚ - -r - = -body --> -hoi¡Gu¬d -(); - -1033 ià(! - gr -. -is_obvious_utÞogy -()) { - -1035 -boÞ - - g­³¬ - = -çl£ -; - -1036  -DNF_I‹¿tÜ - -di -( -r -. -qu”y_DNF -()); - gdi -; di++) { - -1037  -GEQ_I‹¿tÜ - -gi -((* -di -)-> -GEQs -()); - ggi -; gi++) - -1038 ià((* - ggi -). -g‘_cÛf -( -r -. -£t_v¬ -( -Ëv– -)) != 0) { - -1039 -­³¬ - = -Œue -; - -1042 ià( - g­³¬ -) - -1045  -EQ_I‹¿tÜ - -ei -((* -di -)-> -EQs -()); - gei -;ƒi++) - -1046 ià((* - gei -). -g‘_cÛf -( -r -. -£t_v¬ -( -Ëv– -)) != 0) { - -1047 -­³¬ - = -Œue -; - -1050 ià( - g­³¬ -) - -1054 ià(! - g­³¬ -) { - -1055 - gbody --> -»moveGu¬d -(); - -1056 - ggu¬d - = -IÁ”£ùiÚ -( -gu¬d -, -r -); - -1062 ià( - gÃedLoÝ -) - -1063  - gR–©iÚ -:: -True -( -bounds -. -n_£t -()); - -1065  - ggu¬d -; - - @CG_roseBuilder.cc - -15  - ~<¡ack -> - -16  - ~ - -17  - ~<¡ršg -> - -19  - gœ_”rÜ -: -public - -¡d -:: -ruÁime_”rÜ - { - -20 -œ_”rÜ -(cÚ¡ -¡d -:: -¡ršg - & -msg -) : - -21 -¡d -:: -ruÁime_”rÜ -( -msg -) { - -25 -usšg - -Çme¥aû - - gSageBužd” -; - -26 -usšg - -Çme¥aû - - gSageIÁ”çû -; - -27 -usšg - -Çme¥aû - - gOmpSuµÜt -; - -29 -Çme¥aû - - gomega - { - -34 * - gk_ocg_comm’t -; - -52 - gCG_ro£Bužd” -:: -CG_ro£Bužd” -( -SgGlob® -* -glob® -, SgGlob®* -fœ¡ScÝe -, - -53 -SgSymbÞTabË -* -symb -, SgSymbÞTabË* -symb2 -, -SgNode -* -roÙ -) : - -54 -glob®_ -( -glob® -), -glob®_scÝe -( -fœ¡ScÝe -), -symb_ -( -symb -), -symb2_ -( - -55 -symb2 -), -roÙ_ -( -roÙ -) { - -58 - gCG_ro£Bužd” -::~ -CG_ro£Bužd” -() { - -64 -CG_ouutR•r -* -CG_ro£Bužd” -:: -C»©ePÏûHÞd” -(, CG_ouutR•¸* -¡mt -, - -65 -Tu¶e -< -CG_ouutR•r -*> & -funcLi¡ -, Tu¶e< -¡d -:: -¡ršg -> & -loÝ_v¬s -) const { - -67 -SgS‹m’tPŒLi¡ -* -li¡ - = -¡©ic_ÿ¡ -< -CG_ro£R•r - *>( -¡mt -)-> -li¡_ -; - -68 -SgNode - * - gŠl -; - -69 -SgS‹m’t -* - g¡©em’t -; - -70 ià( - gli¡ - !ð -NULL -) { - -73 -d–‘e - -¡mt -; - -74  - gi - = 1; i <ð -funcLi¡ -. -size -(); i++) { - -76 ià(( - gfuncLi¡ -[ -i -] =ð -NULL -è&& (˜< -funcLi¡ -. -size -())) - -78 ià(( - gfuncLi¡ -[ -i -] =ð -NULL -è&& (˜=ð -funcLi¡ -. -size -())) - -81 -CG_ro£R•r - * - g»´ - = -¡©ic_ÿ¡ -( -funcLi¡ -[ -i -]); - -82 -SgEx´essiÚ -* - gÝ - = -»´ --> -Ý_ -; - -84  - gSgS‹m’tPŒLi¡ -:: -™”©Ü - -™ - = (* -li¡ -). -begš -(); - -85 - g™ - !ð(* -li¡ -). -’d -(); it++) { - -86 - g¡©em’t - = (* -™ -); - -87 - gŠl - = -isSgNode -( -¡©em’t -); - -91  - gj -; - -92  - gnÙ_š_symb_ -; - -94 - gnÙ_š_symb_ - = 0; - -96 -SgV¬ŸbËSymbÞ - * - gvs - = -symb_ --> -fšd_v¬ŸbË -( - -97 -SgName -( -loÝ_v¬s -[ -i -]. -c_¡r -())); - -99 ià( - gvs - =ð -NULL -) { - -101 -nÙ_š_symb_ - = 1; - -103 - gvs - = -symb2_ --> -fšd_v¬ŸbË -( -SgName -( -loÝ_v¬s -[ -i -]. -c_¡r -())); - -105 ià( - gvs - !ð -NULL -) { - -109 -¡d -:: -veùÜ -< -SgV¬RefExp - *> -¬¿y - = -sub¡™u‹ -( -Šl -, - -110 (cÚ¡ -SgV¬ŸbËSymbÞ -*è -vs -, -Ý -, -roÙ_ -); - -111  - g¡d -:: -veùÜ -< -SgV¬RefExp - *>:: -™”©Ü - -™ - = - -112 -¬¿y -. -begš -(); - g™ - !ð¬¿y. -’d -(); it++) { - -115 ià( -isSgV¬RefExp -( -Ý -)) { - -116 ià( -¡rcmp -( - -117 -isSgV¬RefExp -( -Ý -)-> -g‘_symbÞ -()-> -g‘_Çme -(). -g‘SŒšg -(). -c_¡r -(), - -118 -vs --> -g‘_Çme -(). -g‘SŒšg -(). -c_¡r -())) { - -120 (* - g™ -)-> -£t_symbÞ -( - -121 -isSgV¬RefExp -( -Ý -)-> -g‘_symbÞ -()); - -127 } ià( -isSgEx´essiÚ -( -Ý -)) { - -129 ià( -isSgBš¬yOp -((* -™ -)-> -g‘_·»Á -())) - -130 -isSgBš¬yOp -((* -™ -)-> -g‘_·»Á -())-> -»¶aû_ex´essiÚ -( - -131 * -™ -, -Ý -); - -143 -d–‘e - - g»´ -; - -144 - gfuncLi¡ -[ -i -] = -NULL -; - -146 ià( - gfuncLi¡ -[ -i -] !ð -NULL -) - -147 -throw - -œ_”rÜ -("not freed…roperly"); - -151  -Ãw - -CG_ro£R•r -( -li¡ -); - -154 - gŠl - = -¡©ic_ÿ¡ -< -CG_ro£R•r - *>( -¡mt -)-> -Šl_ -; - -157 ià( - gŠl - =ð -NULL -) - -158 -throw - -œ_”rÜ -("both†ist‡ndnl‡re‚ull!!"); - -160 -d–‘e - - g¡mt -; - -161  - gj -; - -162  - gnÙ_š_symb_ -; - -163  - gi - = 1; i <ð -funcLi¡ -. -size -(); i++) { - -164 - gnÙ_š_symb_ - = 0; - -166 ià(( - gfuncLi¡ -[ -i -] =ð -NULL -è&& (˜< -funcLi¡ -. -size -())) - -168 ià(( - gfuncLi¡ -[ -i -] =ð -NULL -è&& (˜=ð -funcLi¡ -. -size -())) - -171 -CG_ro£R•r - * - g»´ - = -¡©ic_ÿ¡ -( -funcLi¡ -[ -i -]); - -172 -SgEx´essiÚ -* - gÝ - = -»´ --> -Ý_ -; - -173 -d–‘e - - g»´ -; - -174 - gfuncLi¡ -[ -i -] = -NULL -; - -176 -SgV¬ŸbËSymbÞ - * - gvs - = -symb_ --> -fšd_v¬ŸbË -( - -177 -SgName -( -loÝ_v¬s -[ -i -]. -c_¡r -())); - -179 ià( - gvs - =ð -NULL -) { - -181 -nÙ_š_symb_ - = 1; - -183 - gvs - = -symb2_ --> -fšd_v¬ŸbË -( -SgName -( -loÝ_v¬s -[ -i -]. -c_¡r -())); - -185 ià( - gvs - !ð -NULL -) { - -188 -¡d -:: -veùÜ -< -SgV¬RefExp - *> -¬¿y - = -sub¡™u‹ -( -Šl -, -vs -, -Ý -, - -189 -roÙ_ -); - -191 ià( - gnÙ_š_symb_ - && -isSgV¬RefExp -( -Ý -)) { - -192 ià( -¡rcmp -( - -193 -isSgV¬RefExp -( -Ý -)-> -g‘_symbÞ -()-> -g‘_Çme -(). -g‘SŒšg -(). -c_¡r -(), - -194 -vs --> -g‘_Çme -(). -g‘SŒšg -(). -c_¡r -())) { - -205  - g¡d -:: -veùÜ -< -SgV¬RefExp - *>:: -™”©Ü - -j - = -¬¿y -. -begš -(); - -206 - gj - !ð -¬¿y -. -’d -(); j++) { - -209 ià( -isSgV¬RefExp -( -Ý -)) { - -210 ià( -¡rcmp -( - -211 -isSgV¬RefExp -( -Ý -)-> -g‘_symbÞ -()-> -g‘_Çme -(). -g‘SŒšg -(). -c_¡r -(), - -212 -vs --> -g‘_Çme -(). -g‘SŒšg -(). -c_¡r -())) { - -213 (* - gj -)-> -£t_symbÞ -( -isSgV¬RefExp -( -Ý -)-> -g‘_symbÞ -()); - -218 } ià( -isSgEx´essiÚ -( -Ý -)) { - -220 ià( -isSgBš¬yOp -((* -j -)-> -g‘_·»Á -())) - -221 -isSgBš¬yOp -((* -j -)-> -g‘_·»Á -())-> -»¶aû_ex´essiÚ -( - -222 * -j -, -Ý -); - -297  -Ãw - -CG_ro£R•r -( -Šl -); - -305 -CG_ouutR•r -* - gCG_ro£Bužd” -:: -C»©eAssignm’t -(, CG_ouutR•¸* -lhs -, - -306 -CG_ouutR•r - * -rhs -) const { - -307 ià( - glhs - =ð -NULL - || -rhs - == NULL) { - -308 -årštf -( -¡d”r -, "Code generation: Missing†hs or„hs\n"); - -309  - gNULL -; - -312 -SgEx´essiÚ -* - g¤c - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -rhs -)-> -Ý_ -; - -313 -SgEx´essiÚ -* - gd¡ - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -lhs -)-> -Ý_ -; - -315 -SgEx´S‹m’t -* - gšs - = -buždAssignS‹m’t -( -d¡ -, -¤c -); - -316 - g¤c --> -£t_·»Á -( -šs -); - -317 - gd¡ --> -£t_·»Á -( -šs -); - -319 -SgS‹m’tPŒLi¡ -* - gÃw_li¡ - = -Ãw - SgStatementPtrList; - -321 (* - gÃw_li¡ -). -push_back -( -isSgS‹m’t -( -šs -)); - -323 -d–‘e - - glhs -; - -324 -d–‘e - - grhs -; - -326  -Ãw - -CG_ro£R•r -( -Ãw_li¡ -); - -333 -CG_ouutR•r -* - gCG_ro£Bužd” -:: -C»©eInvoke -(cÚ¡ -¡d -:: -¡ršg - & -âame -, - -334 -Tu¶e -< -CG_ouutR•r -*> & -li¡ -) const { - -336 ià( - gâame - =ð -¡d -:: -¡ršg -("max"è|| -âame - == std::string("min")) { - -337 ià( -li¡ -. -size -() == 0) { - -338  -NULL -; - -339 } ià( - gli¡ -. -size -() == 1) { - -340  -li¡ -[1]; - -342  - gÏ¡ - = -li¡ -. -size -(); - -343 -SgEx´essiÚ -* - gÝ2 - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -li¡ -[ -Ï¡ -])-> -Ý_ -; - -344 -d–‘e - - gli¡ -[ -Ï¡ -]; - -345 - gli¡ -. -d–‘e_Ï¡ -(); - -346 -CG_ro£R•r - * - g»´ - = -¡©ic_ÿ¡ -( -C»©eInvoke -( -âame -, - -347 -li¡ -)); - -348 -SgEx´essiÚ -* - gÝ1 - = -»´ --> -Ý_ -; - -350 -SgEx´essiÚ - * - gšs -; - -351 -SgEx´Li¡Exp -* - g¬g_li¡ - = -buždEx´Li¡Exp -(); - -352 -­³ndEx´essiÚ -( -¬g_li¡ -, -Ý1 -); - -353 -­³ndEx´essiÚ -( -¬g_li¡ -, -Ý2 -); - -354 -SgV¬RefExp -* - gÝaque_v¬ -; - -356 ià( - gâame - =ð -¡d -:: -¡ršg -("max")) { - -357 -Ýaque_v¬ - = -buždO·queV¬RefExp -("__ro£_gt", -glob®_ -); - -358 - gšs - = -isSgEx´essiÚ -( - -359 -buždFunùiÚC®lExp -( -Ýaque_v¬ -, -¬g_li¡ -)); - -362 - gÝaque_v¬ - = -buždO·queV¬RefExp -("__ro£_É", -glob®_ -); - -363 - gšs - = -isSgEx´essiÚ -( - -364 -buždFunùiÚC®lExp -( -Ýaque_v¬ -, -¬g_li¡ -)); - -366 - g»´ --> - gÝ_ - = -šs -; - -368  - g»´ -; - -371 -årštf -( -¡d”r -, - -373  - gNULL -; - -381 -CG_ouutR•r -* - gCG_ro£Bužd” -:: -C»©eComm’t -(, - -382 cÚ¡ -¡d -:: -¡ršg - & -comm’tText -) const { - -383 ià( -comm’tText - =ð -¡d -:: -¡ršg -("")) { - -384  -NULL -; - -387 -SgLoÿ‹dNode - * - gŠl - = -Ãw - SgLocatedNode(); - -388 -buždComm’t -( -Šl -, "//omega_comm’t: " + -comm’tText -); - -390  -Ãw - -CG_ro£R•r -( -isSgNode -( -Šl -)); - -397 -CG_ouutR•r -* - gCG_ro£Bužd” -:: -C»©eIf -(, CG_ouutR•¸* -gu¬dLi¡ -, - -398 -CG_ouutR•r - * -Œue_¡mtLi¡ -, CG_ouutR•¸* -çl£_¡mtLi¡ -) const { - -404 ià( - gŒue_¡mtLi¡ - =ð -NULL - && -çl£_¡mtLi¡ - == NULL) { - -405 -d–‘e - -gu¬dLi¡ -; - -406  - gNULL -; - -407 } ià( - ggu¬dLi¡ - =ð -NULL -) { - -408  -StmtLi¡Aµ’d -( -Œue_¡mtLi¡ -, -çl£_¡mtLi¡ -); - -411 -SgEx´essiÚ -* - gh—d” - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -gu¬dLi¡ -)-> -Ý_ -; - -413 -SgS‹m’tPŒLi¡ - * - gth’_·¹1 -, * - g–£_·¹1 -; - -414 -SgS‹m’t -* - gth’_·¹ -; - -415 -SgS‹m’t -* - g–£_·¹ -; - -416 -SgBasicBlock -* - gth’_·¹2 -; - -417 -SgBasicBlock -* - g–£_·¹2 -; - -418 ià( - gŒue_¡mtLi¡ - !ð -NULL -) { - -419 -th’_·¹1 - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -Œue_¡mtLi¡ -)-> -li¡_ -; - -420 ià( - gth’_·¹1 - !ð -NULL -) { - -421 -th’_·¹ - = *((* -th’_·¹1 -). -begš -()); - -423 ià((* - gth’_·¹1 -). -size -() > 1) { - -424 - gth’_·¹2 - = -buždBasicBlock -(); - -425  - gSgS‹m’tPŒLi¡ -:: -™”©Ü - -™ - = (* -th’_·¹1 -). -begš -(); - -426 - g™ - !ð(* -th’_·¹1 -). -’d -(); it++) { - -427 - gth’_·¹2 --> -­³nd_¡©em’t -(* -™ -); - -430 - gth’_·¹ - = -isSgS‹m’t -( -th’_·¹2 -); - -434 - gth’_·¹ - = -isSgS‹m’t -( - -435 -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -Œue_¡mtLi¡ -)-> -Šl_ -); - -437 - gth’_·¹ - = -NULL -; - -439 ià( - gçl£_¡mtLi¡ - !ð -NULL -) { - -440 -–£_·¹1 - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -çl£_¡mtLi¡ -)-> -li¡_ -; - -441 ià( - g–£_·¹1 - !ð -NULL -) { - -442 -–£_·¹ - = *((* -–£_·¹1 -). -begš -()); - -443 ià((* - g–£_·¹1 -). -size -() > 1) { - -444 - g–£_·¹2 - = -buždBasicBlock -(); - -445  - gSgS‹m’tPŒLi¡ -:: -™”©Ü - -™2 - = (* -–£_·¹1 -). -begš -(); - -446 - g™2 - !ð(* -–£_·¹1 -). -’d -(); it2++) { - -447 - g–£_·¹2 --> -­³nd_¡©em’t -(* -™2 -); - -450 - g–£_·¹ - = -isSgS‹m’t -( -–£_·¹2 -); - -454 - g–£_·¹ - = -isSgS‹m’t -( - -455 -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -çl£_¡mtLi¡ -)-> -Šl_ -); - -457 - g–£_·¹ - = -NULL -; - -460 -SgIfStmt -* - gti - = -buždIfStmt -( -h—d” -, -isSgS‹m’t -( -th’_·¹ -), - -461 -isSgS‹m’t -( -–£_·¹ -)); - -468 -d–‘e - - ggu¬dLi¡ -; - -469 -d–‘e - - gŒue_¡mtLi¡ -; - -470 -d–‘e - - gçl£_¡mtLi¡ -; - -472  -Ãw - -CG_ro£R•r -( -isSgNode -( -ti -)); - -479 -CG_ouutR•r -* - gCG_ro£Bužd” -:: -C»©eInduùive -(CG_ouutR•¸* -šdex -, - -480 -CG_ouutR•r - * -low” -, CG_ouutR•¸* -uµ” -, CG_ouutR•¸* -¡• -) const { - -482 ià( - gšdex - =ð -NULL - || -low” - =ðNULL || -uµ” - == NULL) { - -483 -årštf -( -¡d”r -, - -485  - gNULL -; - -488 ià( - g¡• - =ð -NULL -) - -489 -¡• - = -Ãw - -CG_ro£R•r -( -isSgEx´essiÚ -( -buždIÁV® -(1))); - -491 -SgV¬RefExp - * - gšdex_sym - = -isSgV¬RefExp -( - -492 -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -šdex -)-> -Ý_ -); - -493 -SgEx´essiÚ -* - glow”_bound - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -low” -)-> -Ý_ -; - -494 -SgEx´essiÚ -* - guµ”_bound - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -uµ” -)-> -Ý_ -; - -495 -SgEx´essiÚ -* - g¡•_size - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -¡• -)-> -Ý_ -; - -501 -SgS‹m’t -* - gfÜ_š™_¡mt - = -buždAssignS‹m’t -( -šdex_sym -, -low”_bound -); - -502 -SgLessOrEqu®Op -* - gcÚd - = -buždLessOrEqu®Op -( -šdex_sym -, -uµ”_bound -); - -503 -SgEx´S‹m’t -* - g‹¡ - = -buždEx´S‹m’t -( -cÚd -); - -504 -SgPlusAssignOp -* - gšüem’t - = -buždPlusAssignOp -( -šdex_sym -, -¡•_size -); - -505 -SgFÜS‹m’t - * - gfÜ_¡mt - = -buždFÜS‹m’t -( -fÜ_š™_¡mt -, - -506 -isSgS‹m’t -( -‹¡ -), -šüem’t -, -NULL -); - -508 -d–‘e - - gšdex -; - -509 -d–‘e - - glow” -; - -510 -d–‘e - - guµ” -; - -511 -d–‘e - - g¡• -; - -513  -Ãw - -CG_ro£R•r -( -isSgNode -( -fÜ_¡mt -)); - -520 -CG_ouutR•r -* - gCG_ro£Bužd” -:: -C»©eA‰ribu‹ -(CG_ouutR•¸* -cÚŒÞ -, - -521 cÚ¡ -¡d -:: -¡ršg - & -comm’tText -) const { - -523 -SgNode - * -Šl - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -cÚŒÞ -)-> -Šl_ -; - -525 - gŠl --> -£tA‰ribu‹ -("omega_comm’t", -Ãw - -A¡TextA‰ribu‹ -( -comm’tText -)); - -527  - g¡©ic_ÿ¡ -< - gCG_ro£R•r -*>( - gcÚŒÞ -); - -534 -CG_ouutR•r -* - gCG_ro£Bužd” -:: -C»©eLoÝ -(, CG_ouutR•¸* -cÚŒÞ -, - -535 -CG_ouutR•r - * -¡mtLi¡ -) const { - -536 ià( - g¡mtLi¡ - =ð -NULL -) { - -537 -d–‘e - -cÚŒÞ -; - -538  - gNULL -; - -539 } ià( - gcÚŒÞ - =ð -NULL -) { - -540 -årštf -( -¡d”r -, "Code generation:‚o inductive forhis†oop\n"); - -541  - g¡mtLi¡ -; - -544 -SgNode - * - gŠl - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -cÚŒÞ -)-> -Šl_ -; - -545 -SgFÜS‹m’t - * - gtf - = -isSgFÜS‹m’t -( -Šl -); - -547 -SgS‹m’tPŒLi¡ - * - gbody - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -¡mtLi¡ -)-> -li¡_ -; - -549 ià( - gbody - !ð -NULL -) { - -550 ià(!((* -body -). -em±y -())) { - -551 ià((* -body -). -size -() == 1) { - -553 -tf --> -£t_loÝ_body -(*((* -body -). -begš -())); - -554 (*((* - gbody -). -begš -()))-> -£t_·»Á -( -tf -); - -564 -SgBasicBlock -* - gbb - = -buždBasicBlock -(); - -565 - gbb --> -£t_·»Á -( -tf -); - -566  - gSgS‹m’tPŒLi¡ -:: -™”©Ü - -™ - = (* -body -). -begš -(); - -567 - g™ - !ð(* -body -). -’d -(); it++) { - -568 - gbb --> -­³nd_¡©em’t -(* -™ -); - -569 (* - g™ -)-> -£t_·»Á -( -bb -); - -571 - gtf --> -£t_loÝ_body -( -bb -); - -576 -SgNode -* - gŠl2 - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -¡mtLi¡ -)-> -Šl_ -; - -578 ià( - gŠl2 - !ð -NULL -) { - -579 -tf --> -£t_loÝ_body -( -isSgS‹m’t -( -Šl2 -)); - -580 - gŠl2 --> -£t_·»Á -( -tf -); - -584 -d–‘e - - g¡mtLi¡ -; - -586  - gcÚŒÞ -; - -592 -CG_ouutR•r -* - gCG_ro£Bužd” -:: -C»©eIÁ -( -_i -) const { - -593  -Ãw - -CG_ro£R•r -( -isSgEx´essiÚ -( -buždIÁV® -( -_i -))); - -596 -CG_ouutR•r -* - gCG_ro£Bužd” -:: -C»©eId’t -(cÚ¡ -¡d -:: -¡ršg - & -_s -) const { - -598 -SgV¬ŸbËSymbÞ - * -vs - = -symb_ --> -fšd_v¬ŸbË -( -SgName -( -_s -. -c_¡r -())); - -599 -SgV¬ŸbËSymbÞ - * - gvs2 - = -symb2_ --> -fšd_v¬ŸbË -( -SgName -( -_s -. -c_¡r -())); - -601 ià( - gvs - =ð -NULL - && -vs2 - == NULL) { - -603 -SgV¬ŸbËDeþ¬©iÚ -* -deâ - = -buždV¬ŸbËDeþ¬©iÚ -( - -604 -SgName -( -_s -. -c_¡r -()), -buždIÁTy³ -()); - -605 - gSgIn™ŸlizedNamePŒLi¡ -& - gv¬ŸbËs - = -deâ --> -g‘_v¬ŸbËs -(); - -606 - gSgIn™ŸlizedNamePŒLi¡ -:: -cÚ¡_™”©Ü - -i - = -v¬ŸbËs -. -begš -(); - -607 -SgIn™ŸlizedName -* - gš™ŸlizedName - = * -i -; - -608 - gvs - = -Ãw - -SgV¬ŸbËSymbÞ -( -š™ŸlizedName -); - -609 -´•’dS‹m’t -( -deâ -, -isSgScÝeS‹m’t -( -roÙ_ -)); - -611 - gvs --> -£t_·»Á -( -symb2_ -); - -612 - gsymb2_ --> -š£¹ -( -SgName -( -_s -. -c_¡r -()), -vs -); - -613  -Ãw - -CG_ro£R•r -( -isSgEx´essiÚ -( -buždV¬RefExp -( -vs -))); - -619 ià(! -isSgEx´essiÚ -( -buždV¬RefExp -( -SgName -( -_s -. -c_¡r -())))) - -620 -throw - -œ_”rÜ -("error in Create ident!!"); - -621 ià( - gvs2 - !ð -NULL -) - -622  -Ãw - -CG_ro£R•r -( -isSgEx´essiÚ -( -buždV¬RefExp -( -vs2 -))); - -624  -Ãw - -CG_ro£R•r -( -isSgEx´essiÚ -( -buždV¬RefExp -( -vs -))); - -631 -CG_ouutR•r -* - gCG_ro£Bužd” -:: -C»©ePlus -(CG_ouutR•¸* -lÝ -, - -632 -CG_ouutR•r - * -rÝ -) const { - -633 ià( - grÝ - =ð -NULL -) { - -634  -lÝ -; - -635 } ià( - glÝ - =ð -NULL -) { - -636  -rÝ -; - -639 -SgEx´essiÚ -* - gÝ1 - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -lÝ -)-> -Ý_ -; - -640 -SgEx´essiÚ -* - gÝ2 - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -rÝ -)-> -Ý_ -; - -642 -SgAddOp - * - gšs - = -buždAddOp -( -Ý1 -, -Ý2 -); - -643 - gÝ1 --> -£t_·»Á -( -šs -); - -644 - gÝ2 --> -£t_·»Á -( -šs -); - -645 -d–‘e - - glÝ -; - -646 -d–‘e - - grÝ -; - -648  -Ãw - -CG_ro£R•r -( -isSgEx´essiÚ -( -šs -)); - -652 -CG_ouutR•r -* - gCG_ro£Bužd” -:: -C»©eMšus -(CG_ouutR•¸* -lÝ -, - -653 -CG_ouutR•r - * -rÝ -) const { - -654 ià( - grÝ - =ð -NULL -) { - -655  -lÝ -; - -656 } ià( - glÝ - =ð -NULL -) { - -657 -SgEx´essiÚ - * -Ý - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -rÝ -)-> -Ý_ -; - -658 -SgMšusOp - * - gšs - = -buždMšusOp -( -Ý -); - -660 -d–‘e - - grÝ -; - -662  -Ãw - -CG_ro£R•r -( -isSgEx´essiÚ -( -šs -)); - -664 -SgEx´essiÚ -* - gÝ1 - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -lÝ -)-> -Ý_ -; - -665 -SgEx´essiÚ -* - gÝ2 - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -rÝ -)-> -Ý_ -; - -667 -SgSubŒaùOp - * - gšs - = -buždSubŒaùOp -( -Ý1 -, -Ý2 -); - -668 - gÝ1 --> -£t_·»Á -( -šs -); - -669 - gÝ2 --> -£t_·»Á -( -šs -); - -670 -d–‘e - - glÝ -; - -671 -d–‘e - - grÝ -; - -672  -Ãw - -CG_ro£R•r -( -isSgEx´essiÚ -( -šs -)); - -677 -CG_ouutR•r -* - gCG_ro£Bužd” -:: -C»©eTimes -(CG_ouutR•¸* -lÝ -, - -678 -CG_ouutR•r - * -rÝ -) const { - -679 ià( - grÝ - =ð -NULL - || -lÝ - == NULL) { - -680 ià( -rÝ - !ð -NULL -) { - -681 -rÝ --> -þ—r -(); - -682 -d–‘e - - grÝ -; - -684 ià( - glÝ - !ð -NULL -) { - -685 -lÝ --> -þ—r -(); - -686 -d–‘e - - glÝ -; - -688  - gNULL -; - -691 -SgEx´essiÚ -* - gÝ1 - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -lÝ -)-> -Ý_ -; - -692 -SgEx´essiÚ -* - gÝ2 - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -rÝ -)-> -Ý_ -; - -694 -SgMuÉlyOp - * - gšs - = -buždMuÉlyOp -( -Ý1 -, -Ý2 -); - -695 - gÝ1 --> -£t_·»Á -( -šs -); - -696 - gÝ2 --> -£t_·»Á -( -šs -); - -697 -d–‘e - - glÝ -; - -698 -d–‘e - - grÝ -; - -700  -Ãw - -CG_ro£R•r -( -isSgEx´essiÚ -( -šs -)); - -704 -CG_ouutR•r -* - gCG_ro£Bužd” -:: -C»©eIÁeg”Divide -(CG_ouutR•¸* -lÝ -, - -705 -CG_ouutR•r - * -rÝ -) const { - -706 ià( - grÝ - =ð -NULL -) { - -707 -årštf -( -¡d”r -, "Code generation: divide by NULL\n"); - -708  - gNULL -; - -709 } ià( - glÝ - =ð -NULL -) { - -710 -d–‘e - -rÝ -; - -711  - gNULL -; - -715 -SgEx´essiÚ -* - gÝ1 - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -lÝ -)-> -Ý_ -; - -716 -SgEx´essiÚ -* - gÝ2 - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -rÝ -)-> -Ý_ -; - -719 -SgDivideOp - * - gšs - = -buždDivideOp -( -Ý1 -, -Ý2 -); - -721 -d–‘e - - glÝ -; - -722 -d–‘e - - grÝ -; - -724  -Ãw - -CG_ro£R•r -( -isSgEx´essiÚ -( -šs -)); - -728 -CG_ouutR•r -* - gCG_ro£Bužd” -:: -C»©eIÁeg”Mod -(CG_ouutR•¸* -lÝ -, - -729 -CG_ouutR•r - * -rÝ -) const { - -730 ià( - grÝ - =ð -NULL - || -lÝ - == NULL) { - -731  -NULL -; - -734 -SgEx´essiÚ -* - gÝ1 - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -lÝ -)-> -Ý_ -; - -735 -SgEx´essiÚ -* - gÝ2 - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -rÝ -)-> -Ý_ -; - -738 -SgModOp - * - gšs - = -buždModOp -( -Ý1 -, -Ý2 -); - -740 -d–‘e - - glÝ -; - -741 -d–‘e - - grÝ -; - -743  -Ãw - -CG_ro£R•r -( -isSgEx´essiÚ -( -šs -)); - -750 -CG_ouutR•r -* - gCG_ro£Bužd” -:: -C»©eAnd -(CG_ouutR•¸* -lÝ -, - -751 -CG_ouutR•r - * -rÝ -) const { - -752 ià( - grÝ - =ð -NULL - || -lÝ - == NULL) { - -753  -NULL -; - -756 -SgEx´essiÚ -* - gÝ1 - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -lÝ -)-> -Ý_ -; - -757 -SgEx´essiÚ -* - gÝ2 - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -rÝ -)-> -Ý_ -; - -759 -SgAndOp - * - gšs - = -buždAndOp -( -Ý1 -, -Ý2 -); - -761 -d–‘e - - glÝ -; - -762 -d–‘e - - grÝ -; - -764  -Ãw - -CG_ro£R•r -( -isSgEx´essiÚ -( -šs -)); - -771 -CG_ouutR•r -* - gCG_ro£Bužd” -:: -C»©eGE -(CG_ouutR•¸* -lÝ -, - -772 -CG_ouutR•r - * -rÝ -) const { - -773  -C»©eLE -( -rÝ -, -lÝ -); - -776 -CG_ouutR•r -* - gCG_ro£Bužd” -:: -C»©eLE -(CG_ouutR•¸* -lÝ -, - -777 -CG_ouutR•r - * -rÝ -) const { - -778 ià( - grÝ - =ð -NULL - || -lÝ - == NULL) { - -779  -NULL -; - -782 -SgEx´essiÚ -* - gÝ1 - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -lÝ -)-> -Ý_ -; - -783 -SgEx´essiÚ -* - gÝ2 - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -rÝ -)-> -Ý_ -; - -785 -SgLessOrEqu®Op - * - gšs - = -buždLessOrEqu®Op -( -Ý1 -, -Ý2 -); - -787 -d–‘e - - glÝ -; - -788 -d–‘e - - grÝ -; - -790  -Ãw - -CG_ro£R•r -( -isSgEx´essiÚ -( -šs -)); - -794 -CG_ouutR•r -* - gCG_ro£Bužd” -:: -C»©eEQ -(CG_ouutR•¸* -lÝ -, - -795 -CG_ouutR•r - * -rÝ -) const { - -796 ià( - grÝ - =ð -NULL - || -lÝ - == NULL) { - -797  -NULL -; - -800 -SgEx´essiÚ -* - gÝ1 - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -lÝ -)-> -Ý_ -; - -801 -SgEx´essiÚ -* - gÝ2 - = -¡©ic_ÿ¡ -< -CG_ro£R•r -*>( -rÝ -)-> -Ý_ -; - -803 -SgEqu®™yOp - * - gšs - = -buždEqu®™yOp -( -Ý1 -, -Ý2 -); - -805 -d–‘e - - glÝ -; - -806 -d–‘e - - grÝ -; - -808  -Ãw - -CG_ro£R•r -( -isSgEx´essiÚ -( -šs -)); - -815 -CG_ouutR•r -* - gCG_ro£Bužd” -:: -C»©eStmtLi¡ -(CG_ouutR•¸* -sšgËtÚ -) const { - -819 ià( -sšgËtÚ - =ð -NULL -) { - -820  -Ãw - -CG_ro£R•r -Òew -SgS‹m’tPŒLi¡ -); - -823 -SgS‹m’tPŒLi¡ - * - gŠl - = -¡©ic_ÿ¡ -< -CG_ro£R•r - *>( -sšgËtÚ -)-> -li¡_ -; - -824 -SgNode -* - gsgn - = -¡©ic_ÿ¡ -< -CG_ro£R•r - *>( -sšgËtÚ -)-> -Šl_ -; - -826 ià( - gŠl - =ð -NULL -) - -827 -Šl - = -Ãw - -SgS‹m’tPŒLi¡ -; - -829 ià( - gsgn - =ð -NULL -) { - -830 -SgEx´essiÚ -* -Ý - = -¡©ic_ÿ¡ -< -CG_ro£R•r - *>( -sšgËtÚ -)-> -Ý_ -; - -832 ià( - gÝ - !ð -NULL -) - -833 (* -Šl -). -push_back -( - -834 -buždEx´S‹m’t -( - -835 -¡©ic_ÿ¡ -< -CG_ro£R•r - *>( -sšgËtÚ -)-> -Ý_ -)); - -838 (* - gŠl -). -push_back -( -isSgS‹m’t -( -sgn -)); - -840 -d–‘e - - gsšgËtÚ -; - -841  -Ãw - -CG_ro£R•r -( -Šl -); - -850 -CG_ouutR•r -* - gCG_ro£Bužd” -:: -StmtLi¡In£¹La¡ -(CG_ouutR•¸* -li¡ -, - -851 -CG_ouutR•r - * -node -) const { - -852  -StmtLi¡Aµ’d -( -li¡ -, -node -); - -855 -CG_ouutR•r -* - gCG_ro£Bužd” -:: -StmtLi¡Aµ’d -(CG_ouutR•¸* -li¡1 -, - -856 -CG_ouutR•r - * -li¡2 -) const { - -858 ià( - gli¡2 - =ð -NULL -) { - -859  -li¡1 -; - -860 } ià( - gli¡1 - =ð -NULL -) { - -861  -li¡2 -; - -868 -SgS‹m’tPŒLi¡ -* - gÃw_li¡ -; - -870 -SgS‹m’tPŒLi¡ -* - gŠl1 - = -¡©ic_ÿ¡ -< -CG_ro£R•r - *>( -li¡1 -)-> -li¡_ -; - -871 -SgS‹m’tPŒLi¡ -* - gŠl2 - = -¡©ic_ÿ¡ -< -CG_ro£R•r - *>( -li¡2 -)-> -li¡_ -; - -872 -SgNode -* - gÚe - = -¡©ic_ÿ¡ -< -CG_ro£R•r - *>( -li¡1 -)-> -Šl_ -; - -873 -SgNode -* - gtwo - = -¡©ic_ÿ¡ -< -CG_ro£R•r - *>( -li¡2 -)-> -Šl_ -; - -875 -SgEx´essiÚ -* - gexp1 - = -¡©ic_ÿ¡ -< -CG_ro£R•r - *>( -li¡1 -)-> -Ý_ -; - -876 -SgEx´essiÚ -* - gexp2 - = -¡©ic_ÿ¡ -< -CG_ro£R•r - *>( -li¡2 -)-> -Ý_ -; - -878 ià( - gexp1 - || - gexp2 -) - -879 -throw - -œ_”rÜ -("error in stmtlistappend!!"); - -895 ià(( - gŠl1 - =ð -NULL -è&& ( -Šl2 - == NULL)) { - -897 ià(( -Úe - !ð -NULL -è&& ( -two - != NULL)) { - -899 -Ãw_li¡ - = -Ãw - -SgS‹m’tPŒLi¡ -; - -901 (* - gÃw_li¡ -). -push_back -( -isSgS‹m’t -( -Úe -)); - -902 (* - gÃw_li¡ -). -push_back -( -isSgS‹m’t -( -two -)); - -904 -CG_ro£R•r -* - gÃw_»p - = -Ãw - CG_ro£R•r( -Ãw_li¡ -); - -906  - g¡©ic_ÿ¡ -< - gCG_ouutR•r - *>( - gÃw_»p -); - -908 } ià(( - gÚe - !ð -NULL -è&& ( -two - == NULL)) { - -910  -¡©ic_ÿ¡ -< -CG_ouutR•r - *>( -Ãw - -CG_ro£R•r -( -Úe -)); - -912 } ià(( - gtwo - !ð -NULL -è&& ( -Úe - == NULL)) { - -913  -¡©ic_ÿ¡ -< -CG_ouutR•r - *>( -Ãw - -CG_ro£R•r -( -two -)); - -918 ià(( - gŠl2 - !ð -NULL -è&& ( -Šl1 - == NULL)) { - -925 ià( -Úe - =ð -NULL -) - -926  -li¡2 -; - -929 (* - gŠl2 -). -push_back -( -isSgS‹m’t -( -Úe -)); - -931  - g¡©ic_ÿ¡ -< - gCG_ouutR•r - *>( -Ãw - -CG_ro£R•r -( -Šl2 -)); - -933 } ià(( - gŠl1 - !ð -NULL -è&& ( -Šl2 - == NULL)) { - -934 ià( -two - =ð -NULL -) - -935  -li¡1 -; - -938 (* - gŠl1 -). -push_back -( -isSgS‹m’t -( -two -)); - -940  - g¡©ic_ÿ¡ -< - gCG_ouutR•r - *>( -Ãw - -CG_ro£R•r -( -Šl1 -)); - -944 } ià(( - gŠl1 - !ð -NULL -è&& ( -Šl2 - != NULL)) { - -946  -SgS‹m’tPŒLi¡ -:: -™”©Ü - -™ - = (* -Šl2 -). -begš -(); - -947 - g™ - !ð(* -Šl2 -). -’d -(); it++) { - -948 (* - gŠl1 -). -push_back -(* -™ -); - -954  - g¡©ic_ÿ¡ -< - gCG_ouutR•r - *>( -Ãw - -CG_ro£R•r -( -Šl1 -)); - -1002 -CG_ouutR•r -* - gCG_ro£Bužd” -:: -C»©eDim3 -(cÚ¡ * -v¬Name -,  -¬g1 -, - -1003  -¬g2 -) const { - -1005 -SgName - -ty³_Çme -("dim3"); - -1006 -SgCÏssSymbÞ - * - gty³_symbÞ - = -glob®_scÝe --> -lookup_þass_symbÞ -( -ty³_Çme -); - -1007 -SgCÏssDeþ¬©iÚ - * - gty³_deþ - = -isSgCÏssDeþ¬©iÚ -( - -1008 -ty³_symbÞ --> -g‘_deþ¬©iÚ -()); - -1012 -SgFunùiÚSymbÞ - * - gùÜ_symbÞ - = -glob®_scÝe --> -lookup_funùiÚ_symbÞ -( - -1013 -SgName -("dim3")); - -1015 -SgEx´Li¡Exp - * - gùÜ_¬gs - = -buždEx´Li¡Exp -( -buždIÁV® -( -¬g1 -), - -1016 -buždIÁV® -( -¬g2 -)); - -1018 -SgFunùiÚC®lExp - * - gdim3_func_ÿÎ - = -buždFunùiÚC®lExp -( - -1019 -buždFunùiÚRefExp -( -ùÜ_symbÞ --> -g‘_deþ¬©iÚ -()), -ùÜ_¬gs -); - -1021  - gjošed_¡r -[20]; - -1023 -¡rýy -( -jošed_¡r -, "dim3 "); - -1024 -¡rÿt -( -jošed_¡r -, -v¬Name -); - -1026 -SgEx´S‹m’t -* - gdeþ - = -buždAssignS‹m’t -( - -1027 -buždO·queV¬RefExp -( -jošed_¡r -, -isSgScÝeS‹m’t -( -roÙ_ -)), - -1028 -dim3_func_ÿÎ -); - -1030 -SgS‹m’tPŒLi¡ - * - gŠl2 - = -Ãw - SgStatementPtrList; - -1033 (* - gŠl2 -). -push_back -( -deþ -); - -1034  -Ãw - -CG_ro£R•r -( -Šl2 -); - -1037 -CG_ouutR•r -* - gCG_ro£Bužd” -:: -C»©eDim3 -(cÚ¡ * -v¬Name -,  -¬g1 -, - -1038  -¬g2 -,  -¬g3 -) const { - -1040 -SgName - -ty³_Çme -("dim3"); - -1041 -SgCÏssSymbÞ - * - gty³_symbÞ - = -glob®_scÝe --> -lookup_þass_symbÞ -( -ty³_Çme -); - -1042 -SgCÏssDeþ¬©iÚ - * - gty³_deþ - = -isSgCÏssDeþ¬©iÚ -( - -1043 -ty³_symbÞ --> -g‘_deþ¬©iÚ -()); - -1047 -SgFunùiÚSymbÞ - * - gùÜ_symbÞ - = -glob®_scÝe --> -lookup_funùiÚ_symbÞ -( - -1048 -SgName -("dim3")); - -1050 -SgEx´Li¡Exp - * - gùÜ_¬gs - = -buždEx´Li¡Exp -( -buždIÁV® -( -¬g1 -), - -1051 -buždIÁV® -( -¬g2 -), buždIÁV®( -¬g3 -)); - -1053 -SgFunùiÚC®lExp - * - gdim3_func_ÿÎ - = -buždFunùiÚC®lExp -( - -1054 -buždFunùiÚRefExp -( -ùÜ_symbÞ --> -g‘_deþ¬©iÚ -()), -ùÜ_¬gs -); - -1056  - gjošed_¡r -[20]; - -1058 -¡rýy -( -jošed_¡r -, "dim3 "); - -1059 -¡rÿt -( -jošed_¡r -, -v¬Name -); - -1061 -SgEx´S‹m’t -* - gdeþ - = -buždAssignS‹m’t -( - -1062 -buždO·queV¬RefExp -( -jošed_¡r -, -isSgScÝeS‹m’t -( -roÙ_ -)), - -1063 -dim3_func_ÿÎ -); - -1065 -SgS‹m’tPŒLi¡ - * - gŠl2 - = -Ãw - SgStatementPtrList; - -1068 (* - gŠl2 -). -push_back -( -deþ -); - -1069  -Ãw - -CG_ro£R•r -( -Šl2 -); - -1144 - g¡d -:: -veùÜ -< -SgV¬RefExp - *> -sub¡™u‹ -( -SgNode - * -š -, cÚ¡ -SgV¬ŸbËSymbÞ - * -sym -, - -1145 -SgEx´essiÚ -* -ex´ -, -SgNode -* -roÙ -) { - -1147 -SgS‹m’t -* - g¡mt -; - -1148 -SgEx´essiÚ -* - gÝ -; - -1149 - g¡d -:: -veùÜ -< -SgV¬RefExp - *> -¬¿ys -; - -1151 ià( - gš - !ð -NULL -) { - -1152 ià( -¡mt - = -isSgS‹m’t -( -š -)) { - -1153 ià( -isSgBasicBlock -( -¡mt -)) { - -1154 -SgS‹m’tPŒLi¡ -& -¡mts - = - -1155 -isSgBasicBlock -( -¡mt -)-> -g‘_¡©em’ts -(); - -1156  - gi - = 0; i < - g¡mts -. -size -(); i++) { - -1157 - g¡mts -[ -i -]-> -£t_·»Á -( -¡mt -); - -1158 - g¡d -:: -veùÜ -< -SgV¬RefExp - *> -a - = -sub¡™u‹ -( - -1159 -isSgNode -( -¡mts -[ -i -]), -sym -, -ex´ -, -roÙ -); - -1160 - g¡d -:: -cÝy -( -a -. -begš -(),‡. -’d -(), -back_š£¹” -( -¬¿ys -)); - -1162 } ià( -isSgFÜS‹m’t -( -¡mt -)) { - -1163 -SgFÜS‹m’t - * - gŠf - = -isSgFÜS‹m’t -( -¡mt -); - -1164 - gŠf --> -g‘_fÜ_š™_¡mt -()-> -£t_·»Á -( -Šf -); - -1165 - gŠf --> -g‘_‹¡ -()-> -£t_·»Á -( -Šf -); - -1166 - gŠf --> -g‘_šüem’t -()-> -£t_·»Á -( -Šf -); - -1167 - gŠf --> -g‘_loÝ_body -()-> -£t_·»Á -( -Šf -); - -1168 - g¡d -:: -veùÜ -< -SgV¬RefExp - *> -a - = -sub¡™u‹ -( - -1169 -isSgNode -( -Šf --> -g‘_fÜ_š™_¡mt -()), -sym -, -ex´ -, -roÙ -); - -1170 - g¡d -:: -cÝy -( -a -. -begš -(),‡. -’d -(), -back_š£¹” -( -¬¿ys -)); - -1171 - g¡d -:: -veùÜ -< -SgV¬RefExp - *> -a1 - = -sub¡™u‹ -( - -1172 -isSgNode -( -Šf --> -g‘_‹¡ -()), -sym -, -ex´ -, -roÙ -); - -1173 - g¡d -:: -cÝy -( -a1 -. -begš -(),‡1. -’d -(), -back_š£¹” -( -¬¿ys -)); - -1174 - g¡d -:: -veùÜ -< -SgV¬RefExp - *> -a2 - = -sub¡™u‹ -( - -1175 -isSgNode -( -Šf --> -g‘_šüem’t -()), -sym -, -ex´ -, -roÙ -); - -1176 - g¡d -:: -cÝy -( -a2 -. -begš -(),‡2. -’d -(), -back_š£¹” -( -¬¿ys -)); - -1177 - g¡d -:: -veùÜ -< -SgV¬RefExp - *> -a3 - = -sub¡™u‹ -( - -1178 -isSgNode -( -Šf --> -g‘_loÝ_body -()), -sym -, -ex´ -, -roÙ -); - -1179 - g¡d -:: -cÝy -( -a3 -. -begš -(),‡3. -’d -(), -back_š£¹” -( -¬¿ys -)); - -1188 ià( -isSgV¬ŸbËDeþ¬©iÚ -( -¡mt -)) { - -1189 ià( -SgEx´essiÚ - * - gš™ - = - -1190 -isSgV¬ŸbËDeþ¬©iÚ -( -¡mt -)-> -g‘_v¬ŸbËs -(). -äÚt -()-> -g‘_š™Ÿliz” -()) { - -1191 ià( -isSgAssignIn™Ÿliz” -( -š™ -)) { - -1192 -¡d -:: -veùÜ -< -SgV¬RefExp - *> -a - = -sub¡™u‹ -( - -1193 -isSgAssignIn™Ÿliz” -( -š™ -)-> -g‘_Ý”ªd -(), -sym -, - -1194 -ex´ -, -roÙ -); - -1195 - g¡d -:: -cÝy -( -a -. -begš -(),‡. -’d -(), -back_š£¹” -( -¬¿ys -)); - -1198 } ià( -isSgIfStmt -( -¡mt -)) { - -1199 -SgIfStmt -* - gŠi - = -isSgIfStmt -( -¡mt -); - -1200 - gŠi --> -g‘_cÚd™iÚ® -()-> -£t_·»Á -( -Ši -); - -1201 - gŠi --> -g‘_Œue_body -()-> -£t_·»Á -( -Ši -); - -1202 - gŠi --> -g‘_çl£_body -()-> -£t_·»Á -( -Ši -); - -1203 - g¡d -:: -veùÜ -< -SgV¬RefExp - *> -a - = -sub¡™u‹ -( - -1204 -isSgNode -( -Ši --> -g‘_cÚd™iÚ® -()), -sym -, -ex´ -, -roÙ -); - -1205 - g¡d -:: -cÝy -( -a -. -begš -(),‡. -’d -(), -back_š£¹” -( -¬¿ys -)); - -1206 - g¡d -:: -veùÜ -< -SgV¬RefExp - *> -a1 - = -sub¡™u‹ -( - -1207 -isSgNode -( -Ši --> -g‘_Œue_body -()), -sym -, -ex´ -, -roÙ -); - -1208 - g¡d -:: -cÝy -( -a1 -. -begš -(),‡1. -’d -(), -back_š£¹” -( -¬¿ys -)); - -1209 - g¡d -:: -veùÜ -< -SgV¬RefExp - *> -a2 - = -sub¡™u‹ -( - -1210 -isSgNode -( -Ši --> -g‘_çl£_body -()), -sym -, -ex´ -, -roÙ -); - -1211 - g¡d -:: -cÝy -( -a2 -. -begš -(),‡2. -’d -(), -back_š£¹” -( -¬¿ys -)); - -1212 } ià( -isSgEx´S‹m’t -( -¡mt -)) { - -1213 ( -isSgEx´S‹m’t -( -¡mt -)-> -g‘_ex´essiÚ -())-> -£t_·»Á -( - -1214 -isSgEx´S‹m’t -( -¡mt -)); - -1215 - g¡d -:: -veùÜ -< -SgV¬RefExp - *> -a - = -sub¡™u‹ -( - -1216 -isSgNode -( -isSgEx´S‹m’t -( -¡mt -)-> -g‘_ex´essiÚ -()), - -1217 -sym -, -ex´ -, -roÙ -); - -1218 - g¡d -:: -cÝy -( -a -. -begš -(),‡. -’d -(), -back_š£¹” -( -¬¿ys -)); - -1222 - gÝ - = -isSgEx´essiÚ -( -š -); - -1224 - g¡d -:: -¡ršg - -y - = -sym --> -g‘_Çme -(). -g‘SŒšg -(); - -1226 ià( -isSgBš¬yOp -( -Ý -)) { - -1228 -isSgBš¬yOp -( -Ý -)-> -g‘_lhs_Ý”ªd -()-> -£t_·»Á -(op); - -1229 -isSgBš¬yOp -( -Ý -)-> -g‘_rhs_Ý”ªd -()-> -£t_·»Á -(op); - -1231 - g¡d -:: -veùÜ -< -SgV¬RefExp - *> -a - = -sub¡™u‹ -( - -1232 -isSgBš¬yOp -( -Ý -)-> -g‘_lhs_Ý”ªd -(), -sym -, -ex´ -, -roÙ -); - -1233 - g¡d -:: -cÝy -( -a -. -begš -(),‡. -’d -(), -back_š£¹” -( -¬¿ys -)); - -1234 - g¡d -:: -veùÜ -< -SgV¬RefExp - *> -a1 - = -sub¡™u‹ -( - -1235 -isSgBš¬yOp -( -Ý -)-> -g‘_rhs_Ý”ªd -(), -sym -, -ex´ -, -roÙ -); - -1236 - g¡d -:: -cÝy -( -a1 -. -begš -(),‡1. -’d -(), -back_š£¹” -( -¬¿ys -)); - -1237 } ià( -isSgUÇryOp -( -Ý -)) { - -1238 -isSgUÇryOp -( -Ý -)-> -g‘_Ý”ªd -()-> -£t_·»Á -(op); - -1239 - g¡d -:: -veùÜ -< -SgV¬RefExp - *> -a - = -sub¡™u‹ -( - -1240 -isSgUÇryOp -( -Ý -)-> -g‘_Ý”ªd -(), -sym -, -ex´ -, -roÙ -); - -1241 - g¡d -:: -cÝy -( -a -. -begš -(),‡. -’d -(), -back_š£¹” -( -¬¿ys -)); - -1242 } ià( -isSgV¬RefExp -( -Ý -)) { - -1243 - g¡d -:: -¡ršg - -z - = - -1244 -isSgV¬RefExp -( -Ý -)-> -g‘_symbÞ -()-> -g‘_Çme -(). -g‘SŒšg -(); - -1245 ià(! -¡rcmp -( -z -. -c_¡r -(), -y -.c_str())) { - -1247 - g¬¿ys -. -push_back -( -isSgV¬RefExp -( -Ý -)); - -1273  - g¬¿ys -; - - @CG_roseRepr.cc - -14  - ~ - -15  - ~<¡dio.h -> - -16  - ~<¡ršg.h -> - -17  - ~ - -18 -Çme¥aû - - gomega - { - -23 - gCG_ro£R•r -:: -CG_ro£R•r -(): -Šl_ -( -NULL -), -Ý_ -(NULL), -li¡_ -(NULL){ - -27 - gCG_ro£R•r -:: -CG_ro£R•r -( -SgNode - * -Šl -): -Šl_ -ÑÆ), -Ý_ -( -NULL -), -li¡_ -(NULL) { - -30 - gCG_ro£R•r -:: -CG_ro£R•r -( -SgEx´essiÚ -* -Ý -): -Šl_ -( -NULL -), -Ý_ -(Ý), -li¡_ -(NULL){ - -32 - gCG_ro£R•r -:: -CG_ro£R•r -( -SgS‹m’tPŒLi¡ -* -¡mŽi¡ -): -Šl_ -( -NULL -), -Ý_ -(NULL), -li¡_ -(stmtlist){ - -35 - gCG_ro£R•r -::~ -CG_ro£R•r -() { - -40 -CG_ouutR•r -* -CG_ro£R•r -:: -þÚe -() { - -42 ifÐ -Šl_ - !ð -NULL -) { - -43 -SgT»eCÝy - -tc -; - -44 -SgNode - * - gŠl - = -Šl_ --> -cÝy -( -tc -); - -45 - gŠl --> -£t_·»Á -( -Šl_ --> -g‘_·»Á -()); - -46  -Ãw - -CG_ro£R•r -( -Šl -); - -48 if( - gÝ_ - !ð -NULL -) - -50 -SgT»eCÝy - -tc1 -; - -51 -SgNode -* - gÝ - = -isSgNode -( -Ý_ -)-> -cÝy -( -tc1 -); - -53 - gÝ --> -£t_·»Á -( -isSgNode -( -Ý_ -)-> -g‘_·»Á -()); - -54  -Ãw - -CG_ro£R•r -( -isSgEx´essiÚ -( -Ý -)); - -56 if( - gli¡_ - !ð -NULL -) - -58 -SgS‹m’tPŒLi¡ -* -li¡2 - = -Ãw - SgStatementPtrList; - -60  - gSgS‹m’tPŒLi¡ -:: -™”©Ü - -™ - = (* -li¡_ -). -begš -(); - g™ - !ð(*li¡_). -’d -(); it++){ - -61 -SgT»eCÝy - - gtc3 -; - -62 -SgNode - * - gŠl2 - = -isSgNode -(* -™ -)-> -cÝy -( -tc3 -); - -63 - gŠl2 --> -£t_·»Á -( -isSgNode -(* -™ -)-> -g‘_·»Á -()); - -65 (* - gli¡2 -). -push_back -( -isSgS‹m’t -( -Šl2 -)); - -67  -Ãw - -CG_ro£R•r -( -li¡2 -); - -70  - gNULL -; - -73  - gCG_ro£R•r -:: -þ—r -() { - -74 if( -Šl_ - !ð -NULL -) { - -75 -d–‘e - -Šl_ -; - -76 - gŠl_ - = -NULL -; - -80 -SgNode -* - gCG_ro£R•r -:: -G‘Code -() const { - -81  -Šl_ -; - -84 -SgS‹m’tPŒLi¡ -* - gCG_ro£R•r -:: -G‘Li¡ -() const { - -85  -li¡_ -; - -88 -SgEx´essiÚ -* - gCG_ro£R•r -:: -G‘Ex´essiÚ -() const { - -89  -Ý_ -; - -91  - gCG_ro£R•r -:: -Dump -() const { - -92 -SgNode -* -Šl - = -Šl_ -; - -93 -SgEx´essiÚ -* - gÝ - = -Ý_ - ; - -94 if( - gŠl - !ð -NULL -) - -95 -DumpFžeH–³r -( -Šl -, -¡dout -); - -96 if( - gÝ - !ð -NULL -) - -97 -DumpFžeH–³r -( -isSgNode -( -Ý -), -¡dout -); - -101  - gCG_ro£R•r -:: -DumpFžeH–³r -( -SgNode -* -node -, -FILE - * -å -) const{ - -102 - g¡d -:: -¡ršg - -x -; - -103 -size_t - - gnumb”OfSucûssÜs - = -node --> -g‘_numb”OfT¿v”§lSucûssÜs -(); - -104 if( - gnumb”OfSucûssÜs - == 0){ - -105 -x - = -node --> -uŬ£ToSŒšg - (); - -106 -årštf -( -å -, "%s", -x -. -c_¡r -()); - -109  -size_t - - gidx - = 0; idx < - gnumb”OfSucûssÜs -; idx++) - -111 -SgNode - * - gchžd - = -NULL -; - -112 - gchžd - = -node --> -g‘_Œav”§lSucûssÜByIndex -( -idx -); - -113 -DumpFžeH–³r -( -chžd -, -å -); - -119  - gCG_ro£R•r -:: -DumpToFže -( -FILE - * -å -) const { - -121 -SgNode -* -Šl - = -Šl_ -; - -122 -SgEx´essiÚ -* - gÝ - = -Ý_ - ; - -124 if( - gŠl -!ð -NULL -){ - -125 -¡d -:: -¡ršg - -x - = -Šl --> -uŬ£ToSŒšg -(); - -126 -årštf -( -å -, "%s", -x -. -c_¡r -()); - -129 if( - gÝ - !ð -NULL -){ - -130 -¡d -:: -¡ršg - -x - = -isSgNode -( -Ý -)-> -uŬ£ToSŒšg -(); - -131 -årštf -( -å -, "%s", -x -. -c_¡r -()); - - @CG_stringBuilder.cc - -17  - ~ - -18  - ~ - -19  - ~<¡ršg -> - -21 -Çme¥aû - - gomega - { - -23  - g¡d -:: -¡ršg - -Saãgu¬dSŒšg -(cÚ¡ -¡d -::¡ršg & -s -,  -Ý -); - -29 -CG_ouutR•r -* - gCG_¡ršgBužd” -:: -C»©ePÏûHÞd” -( -šd’t -, - -30 -CG_ouutR•r - * -¡mt -, -Tu¶e - & -funcLi¡ -, - -31 -Tu¶e -< -¡d -:: -¡ršg -> &) const { - -32 -¡d -:: -¡ršg - -li¡SŒ - = ""; - -34  - gi - = 1; i <ð -funcLi¡ -. -size -(); i++) { - -35 ià( - gfuncLi¡ -[ -i -] =ð -NULL -) - -36 -li¡SŒ - += "N/A"; - -38 - gli¡SŒ - +ð -G‘SŒšg -( -funcLi¡ -[ -i -]); - -39 ià( - gi - < - gfuncLi¡ -. -size -()) - -40 - gli¡SŒ - += ","; - -43 - g¡d -:: -¡ršg - -¡mtName - = -G‘SŒšg -( -¡mt -); - -44 - g¡d -:: -¡ršg - -šd’tSŒ - = -G‘Ind’tS·ûs -( -šd’t -); - -46  -Ãw - -CG_¡ršgR•r -( -šd’tSŒ - + -¡mtName - + "(" + -li¡SŒ - + ");\n"); - -49 -CG_ouutR•r -* - gCG_¡ršgBužd” -:: -C»©eAssignm’t -( -šd’t -, - -50 -CG_ouutR•r -* -lhs -, CG_ouutR•r* -rhs -) const { - -51 ià( - glhs - =ð -NULL - || -rhs - == NULL) { - -52 -årštf -( -¡d”r -, "Code generation: missing†hs or„hs\n"); - -53  - gNULL -; - -56 - g¡d -:: -¡ršg - -lhsSŒ - = -G‘SŒšg -( -lhs -); - -57 - g¡d -:: -¡ršg - -rhsSŒ - = -G‘SŒšg -( -rhs -); - -59 - g¡d -:: -¡ršg - -šd’tSŒ - = -G‘Ind’tS·ûs -( -šd’t -); - -61  -Ãw - -CG_¡ršgR•r -( -šd’tSŒ - + -lhsSŒ - + "=" + -rhsSŒ - + ";\n"); - -64 -CG_ouutR•r -* - gCG_¡ršgBužd” -:: -C»©eInvoke -(cÚ¡ -¡d -:: -¡ršg - & -âame -, - -65 -Tu¶e -< -CG_ouutR•r -*> & -li¡ -) const { - -66 - g¡d -:: -¡ršg - -li¡SŒ - = ""; - -68  - gi - = 1; i <ð -li¡ -. -size -(); i++) { - -69 - gli¡SŒ - +ð -G‘SŒšg -( -li¡ -[ -i -]); - -70 ià( - gi - < - gli¡ -. -size -()) - -71 - gli¡SŒ - += ","; - -74  -Ãw - -CG_¡ršgR•r -( -âame - + "(" + -li¡SŒ - + ")"); - -77 -CG_ouutR•r -* - gCG_¡ršgBužd” -:: -C»©eComm’t -( -šd’t -, - -78 cÚ¡ -¡d -:: -¡ršg - & -comm’tText -) const { - -79 ià( -comm’tText - =ð -¡d -:: -¡ršg -("")) { - -80  -NULL -; - -83 - g¡d -:: -¡ršg - -šd’tSŒ - = -G‘Ind’tS·ûs -( -šd’t -); - -85  -Ãw - -CG_¡ršgR•r -( -šd’tSŒ - + "// " + -comm’tText - + "\n"); - -88 -CG_ouutR•r -* - gCG_¡ršgBužd” -:: -C»©eA‰ribu‹ -(CG_ouutR•¸* -cÚŒÞ -, - -89 cÚ¡ -¡d -:: -¡ršg - & -comm’tText -) const { - -90 ià( -comm’tText - =ð -¡d -:: -¡ršg -("")) { - -91  -cÚŒÞ -; - -94 - g¡d -:: -¡ršg - -cÚŒÞSŒšg - = -G‘SŒšg -( -cÚŒÞ -); - -96  -Ãw - -CG_¡ršgR•r -("// " + -comm’tText - + "\n" + -cÚŒÞSŒšg -); - -100 -CG_ouutR•r -* - gCG_¡ršgBužd” -:: -C»©eIf -( -šd’t -, CG_ouutR•r* -gu¬dLi¡ -, - -101 -CG_ouutR•r -* -Œue_¡mtLi¡ -, CG_ouutR•r* -çl£_¡mtLi¡ -) const { - -102 ià( - gŒue_¡mtLi¡ - =ð -NULL - && -çl£_¡mtLi¡ - == NULL) { - -103 -d–‘e - -gu¬dLi¡ -; - -104  - gNULL -; - -105 } ià( - ggu¬dLi¡ - =ð -NULL -) { - -106  -StmtLi¡Aµ’d -( -Œue_¡mtLi¡ -, -çl£_¡mtLi¡ -); - -109 - g¡d -:: -¡ršg - -gu¬dLi¡SŒ - = -G‘SŒšg -( -gu¬dLi¡ -); - -110 - g¡d -:: -¡ršg - -šd’tSŒ - = -G‘Ind’tS·ûs -( -šd’t -); - -111 - g¡d -:: -¡ršg - -s -; - -112 ià( - gŒue_¡mtLi¡ - !ð -NULL - && -çl£_¡mtLi¡ - == NULL) { - -113 -s - = -šd’tSŒ - + "ià(" + -gu¬dLi¡SŒ - + ") {\n" - -114 + -G‘SŒšg -( -Œue_¡mtLi¡ -è+ -šd’tSŒ - + "}\n"; - -115 } ià( - gŒue_¡mtLi¡ - =ð -NULL - && -çl£_¡mtLi¡ - != NULL) { - -116 -s - = -šd’tSŒ - + "ià!(" + -gu¬dLi¡SŒ - + ") {\n" - -117 + -G‘SŒšg -( -çl£_¡mtLi¡ -è+ -šd’tSŒ - + "}\n"; - -119 - gs - = -šd’tSŒ - + "ià(" + -gu¬dLi¡SŒ - + ") {\n" - -120 + -G‘SŒšg -( -Œue_¡mtLi¡ -è+ -šd’tSŒ - + "}\n" + indentStr - -121 + "–£ {\n" + -G‘SŒšg -( -çl£_¡mtLi¡ -è+ -šd’tSŒ - + "}\n"; - -124  -Ãw - -CG_¡ršgR•r -( -s -); - -127 -CG_ouutR•r -* - gCG_¡ršgBužd” -:: -C»©eInduùive -(CG_ouutR•r* -šdex -, - -128 -CG_ouutR•r -* -low” -, CG_ouutR•r* -uµ” -, CG_ouutR•r* -¡• -) const { - -129 ià( - gšdex - =ð -NULL -) { - -130 -årštf -( -¡d”r -, "Code generation: missing†oop index\n"); - -131  - gNULL -; - -134 ià( - glow” - =ð -NULL - || -uµ” - == NULL) { - -135 -årštf -( -¡d”r -, "Code generation: missing†oop bound\n"); - -138 - g¡d -:: -¡ršg - -šdexSŒ - = -G‘SŒšg -( -šdex -); - -139 - g¡d -:: -¡ršg - -low”SŒ -, - guµ”SŒ -; - -140 ià( - glow” - !ð -NULL -) - -141 -low”SŒ - = -G‘SŒšg -( -low” -); - -143 - glow”SŒ - = -¡d -:: -¡ršg -("-infinity"); - -144 ià( - guµ” - !ð -NULL -) - -145 -uµ”SŒ - = -G‘SŒšg -( -uµ” -); - -147 - guµ”SŒ - = -¡d -:: -¡ršg -("+infinity"); - -149 - g¡d -:: -¡ršg - -doSŒ - = "fÜ(" + -šdexSŒ - + " = " + -low”SŒ - + "; " + indexStr - -150 + " <ð" + -uµ”SŒ - + "; " + -šdexSŒ -; - -152 ià( - g¡• - !ð -NULL -) { - -153 -¡d -:: -¡ršg - -¡•SŒ - = -G‘SŒšg -( -¡• -); - -154 - gdoSŒ - +ð" +ð" + -¡•SŒ -; - -156 - gdoSŒ - += "++"; - -159 - gdoSŒ - += ")"; - -161  -Ãw - -CG_¡ršgR•r -( -doSŒ -); - -164 -CG_ouutR•r -* - gCG_¡ršgBužd” -:: -C»©eLoÝ -( -šd’t -, CG_ouutR•r* -cÚŒÞ -, - -165 -CG_ouutR•r -* -¡mtLi¡ -) const { - -166 ià( - g¡mtLi¡ - =ð -NULL -) { - -167 -d–‘e - -cÚŒÞ -; - -168  - gNULL -; - -169 } ià( - gcÚŒÞ - =ð -NULL -) { - -170 -årštf -( -¡d”r -, "Code generation:‚o inductive forhis†oop\n"); - -171  - g¡mtLi¡ -; - -174 - g¡d -:: -¡ršg - -ù¾SŒ - = -G‘SŒšg -( -cÚŒÞ -); - -175 - g¡d -:: -¡ršg - -¡mtSŒ - = -G‘SŒšg -( -¡mtLi¡ -); - -177 - g¡d -:: -¡ršg - -šd’tSŒ - = -G‘Ind’tS·ûs -( -šd’t -); - -179 - g¡d -:: -¡ršg - -s - = -šd’tSŒ - + -ù¾SŒ - + " {\n" + -¡mtSŒ - + indentStr + "}\n"; - -181  -Ãw - -CG_¡ršgR•r -( -s -); - -184 -CG_ouutR•r -* - gCG_¡ršgBužd” -:: -C»©eIÁ -( -_i -) const { - -185 -¡d -:: -¡ršg - -_s - = -to_¡ršg -( -_i -); - -186  -Ãw - -CG_¡ršgR•r -( -_s -); - -189 -CG_ouutR•r -* - gCG_¡ršgBužd” -:: -C»©eId’t -(cÚ¡ -¡d -:: -¡ršg - & -_s -) const { - -190 ià(& -_s - =ð -NULL - || _ =ð -¡d -:: -¡ršg -("")) { - -191  -NULL -; - -194  -Ãw - -CG_¡ršgR•r -( -_s -); - -197 -CG_ouutR•r -* - gCG_¡ršgBužd” -:: -C»©ePlus -(CG_ouutR•r* -lÝ -, - -198 -CG_ouutR•r -* -rÝ -) const { - -199 ià( - grÝ - =ð -NULL -) { - -200  -lÝ -; - -201 } ià( - glÝ - =ð -NULL -) { - -202  -rÝ -; - -205 - g¡d -:: -¡ršg - -lÝSŒ - = -G‘SŒšg -( -lÝ -); - -206 - g¡d -:: -¡ršg - -rÝSŒ - = -G‘SŒšg -( -rÝ -); - -208  -Ãw - -CG_¡ršgR•r -( -lÝSŒ - + "+" + -rÝSŒ -); - -211 -CG_ouutR•r -* - gCG_¡ršgBužd” -:: -C»©eMšus -(CG_ouutR•r* -lÝ -, - -212 -CG_ouutR•r -* -rÝ -) const { - -213 ià( - grÝ - =ð -NULL -) { - -214  -lÝ -; - -215 } ià( - glÝ - =ð -NULL -) { - -216 -¡d -:: -¡ršg - -rÝSŒ - = -G‘SŒšg -( -rÝ -); - -217  -Ãw - -CG_¡ršgR•r -("-" + -Saãgu¬dSŒšg -( -rÝSŒ -, '-')); - -220 - g¡d -:: -¡ršg - -lÝSŒ - = -G‘SŒšg -( -lÝ -); - -221 - g¡d -:: -¡ršg - -rÝSŒ - = -G‘SŒšg -( -rÝ -); - -223  -Ãw - -CG_¡ršgR•r -( -lÝSŒ - + "-" + -Saãgu¬dSŒšg -( -rÝSŒ -, '-')); - -226 -CG_ouutR•r -* - gCG_¡ršgBužd” -:: -C»©eTimes -(CG_ouutR•r* -lÝ -, - -227 -CG_ouutR•r -* -rÝ -) const { - -228 ià( - grÝ - =ð -NULL - || -lÝ - == NULL) { - -229 -d–‘e - -rÝ -; - -230 -d–‘e - - glÝ -; - -231  - gNULL -; - -234 - g¡d -:: -¡ršg - -lÝSŒ - = -G‘SŒšg -( -lÝ -); - -235 - g¡d -:: -¡ršg - -rÝSŒ - = -G‘SŒšg -( -rÝ -); - -237  -Ãw - -CG_¡ršgR•r -( - -238 -Saãgu¬dSŒšg -( -lÝSŒ -, '*'è+ "*" + Saãgu¬dSŒšg( -rÝSŒ -, '*')); - -241 -CG_ouutR•r -* - gCG_¡ršgBužd” -:: -C»©eIÁeg”Divide -(CG_ouutR•r* -lÝ -, - -242 -CG_ouutR•r -* -rÝ -) const { - -243 ià( - grÝ - =ð -NULL -) { - -244 -årštf -( -¡d”r -, "Code generation: divide by NULL\n"); - -245  - gNULL -; - -246 } ià( - glÝ - =ð -NULL -) { - -247 -d–‘e - -rÝ -; - -248  - gNULL -; - -251 - g¡d -:: -¡ršg - -lÝSŒ - = -G‘SŒšg -( -lÝ -); - -252 - g¡d -:: -¡ršg - -rÝSŒ - = -G‘SŒšg -( -rÝ -); - -254  -Ãw - -CG_¡ršgR•r -("štDiv(" + -lÝSŒ - + "," + -rÝSŒ - + ")"); - -257 -CG_ouutR•r -* - gCG_¡ršgBužd” -:: -C»©eIÁeg”Mod -(CG_ouutR•r* -lÝ -, - -258 -CG_ouutR•r -* -rÝ -) const { - -259 ià( - grÝ - =ð -NULL - || -lÝ - == NULL) { - -260  -NULL -; - -263 - g¡d -:: -¡ršg - -lÝSŒ - = -G‘SŒšg -( -lÝ -); - -264 - g¡d -:: -¡ršg - -rÝSŒ - = -G‘SŒšg -( -rÝ -); - -266  -Ãw - -CG_¡ršgR•r -("štMod(" + -lÝSŒ - + "," + -rÝSŒ - + ")"); - -269 -CG_ouutR•r -* - gCG_¡ršgBužd” -:: -C»©eIÁeg”Cež -(CG_ouutR•r* -lÝ -, - -270 -CG_ouutR•r -* -rÝ -) const { - -271 ià( - grÝ - =ð -NULL - || -lÝ - == NULL) { - -272  -NULL -; - -275 - g¡d -:: -¡ršg - -lÝSŒ - = -G‘SŒšg -( -lÝ -); - -276 - g¡d -:: -¡ršg - -rÝSŒ - = -G‘SŒšg -( -rÝ -); - -278  -Ãw - -CG_¡ršgR•r -("štCež(" + -lÝSŒ - + "," + -rÝSŒ - + ")"); - -281 -CG_ouutR•r -* - gCG_¡ršgBužd” -:: -C»©eAnd -(CG_ouutR•r* -lÝ -, - -282 -CG_ouutR•r -* -rÝ -) const { - -283 ià( - grÝ - =ð -NULL -) - -284  -lÝ -; - -285 ià( - glÝ - =ð -NULL -) - -286  -rÝ -; - -288 - g¡d -:: -¡ršg - -lÝSŒ - = -G‘SŒšg -( -lÝ -); - -289 - g¡d -:: -¡ršg - -rÝSŒ - = -G‘SŒšg -( -rÝ -); - -291  -Ãw - -CG_¡ršgR•r -( -lÝSŒ - + " && " + -rÝSŒ -); - -294 -CG_ouutR•r -* - gCG_¡ršgBužd” -:: -C»©eGE -(CG_ouutR•r* -lÝ -, - -295 -CG_ouutR•r -* -rÝ -) const { - -296 ià( - grÝ - =ð -NULL - || -lÝ - == NULL) { - -297  -NULL -; - -300 - g¡d -:: -¡ršg - -lÝSŒ - = -G‘SŒšg -( -lÝ -); - -301 - g¡d -:: -¡ršg - -rÝSŒ - = -G‘SŒšg -( -rÝ -); - -303  -Ãw - -CG_¡ršgR•r -( -lÝSŒ - + " >ð" + -rÝSŒ -); - -306 -CG_ouutR•r -* - gCG_¡ršgBužd” -:: -C»©eLE -(CG_ouutR•r* -lÝ -, - -307 -CG_ouutR•r -* -rÝ -) const { - -308 ià( - grÝ - =ð -NULL - || -lÝ - == NULL) { - -309  -NULL -; - -312 - g¡d -:: -¡ršg - -lÝSŒ - = -G‘SŒšg -( -lÝ -); - -313 - g¡d -:: -¡ršg - -rÝSŒ - = -G‘SŒšg -( -rÝ -); - -315  -Ãw - -CG_¡ršgR•r -( -lÝSŒ - + " <ð" + -rÝSŒ -); - -318 -CG_ouutR•r -* - gCG_¡ršgBužd” -:: -C»©eEQ -(CG_ouutR•r* -lÝ -, - -319 -CG_ouutR•r -* -rÝ -) const { - -320 ià( - grÝ - =ð -NULL - || -lÝ - == NULL) { - -321  -NULL -; - -324 - g¡d -:: -¡ršg - -lÝSŒ - = -G‘SŒšg -( -lÝ -); - -325 - g¡d -:: -¡ršg - -rÝSŒ - = -G‘SŒšg -( -rÝ -); - -327  -Ãw - -CG_¡ršgR•r -( -lÝSŒ - + " =ð" + -rÝSŒ -); - -330 -CG_ouutR•r -* - gCG_¡ršgBužd” -:: -StmtLi¡Aµ’d -(CG_ouutR•r* -li¡1 -, - -331 -CG_ouutR•r -* -li¡2 -) const { - -332 ià( - gli¡2 - =ð -NULL -) { - -333  -li¡1 -; - -334 } ià( - gli¡1 - =ð -NULL -) { - -335  -li¡2 -; - -338 - g¡d -:: -¡ršg - -li¡1SŒ - = -G‘SŒšg -( -li¡1 -); - -339 - g¡d -:: -¡ršg - -li¡2SŒ - = -G‘SŒšg -( -li¡2 -); - -341  -Ãw - -CG_¡ršgR•r -( -li¡1SŒ - + -li¡2SŒ -); - -347 - g¡d -:: -¡ršg - -G‘Ind’tS·ûs -( -šd’t -) { - -348 -¡d -:: -¡ršg - -šd’tSŒ -; - -349  - gi - = 1; i < - gšd’t -; i++) { - -350 - gšd’tSŒ - += " "; - -352  - gšd’tSŒ -; - -359 - g¡d -:: -¡ršg - -G‘SŒšg -( -CG_ouutR•r -* -»´ -) { - -360 -¡d -:: -¡ršg - -»suÉ - = -¡©ic_ÿ¡ -< -CG_¡ršgR•r - *>( -»´ -)-> -G‘SŒšg -(); - -361 -d–‘e - - g»´ -; - -362  - g»suÉ -; - -365  - g¡d -:: -¡ršg - -Saãgu¬dSŒšg -(cÚ¡ -¡d -::¡ršg & -s -,  -Ý -) { - -366  - gËn - = -s -. -Ëngth -(); - -367  - g·»n_Ëv– - = 0; - -368  - gnum_¶usmšus - = 0; - -369  - gnum_mul - = 0; - -370  - gnum_div - = 0; - -371  - gi - = 0; i < - gËn -; i++) - -372  - gs -[ -i -]) { - -374 -·»n_Ëv– -++; - -377 -·»n_Ëv– ---; - -381 ià( -·»n_Ëv– - == 0) - -382 -num_¶usmšus -++; - -385 ià( -·»n_Ëv– - == 0) - -386 -num_mul -++; - -389 ià( -·»n_Ëv– - == 0) - -390 -num_div -++; - -396 -boÞ - - gÃed_·»n - = -çl£ -; - -397  - gÝ -) { - -399 ià( -num_¶usmšus - > 0) - -400 -Ãed_·»n - = -Œue -; - -403 ià( -num_¶usmšus - > 0 || -num_div - > 0) - -404 -Ãed_·»n - = -Œue -; - -407 ià( -num_¶usmšus - > 0 || -num_div - > 0 || -num_mul - > 0) - -408 -Ãed_·»n - = -Œue -; - -414 ià( - gÃed_·»n -) - -415  "(" + - gs - + ")"; - -417  - gs -; - - @CG_stringRepr.cc - -16  - ~ - -17  - ~<¡dio.h -> - -19 -Çme¥aû - - gomega - { - -21 - gCG_¡ršgR•r -:: -CG_¡ršgR•r -() { - -24 -CG_¡ršgR•r -::CG_¡ršgR•r(cÚ¡ -¡d -:: -¡ršg -& -_s -è: -s -(_s) { - -27 -CG_¡ršgR•r -::~CG_stringRepr() { - -30 -CG_ouutR•r -* -CG_¡ršgR•r -:: -þÚe -() { - -31  -Ãw - -CG_¡ršgR•r -( -s -); - -38 - g¡d -:: -¡ršg - -CG_¡ršgR•r -:: -G‘SŒšg -() const { - -39  -s -; - -46  - gCG_¡ršgR•r -:: -Dump -() const { - -47 -´štf -("%s\n", -s -. -c_¡r -()); - -50  - gCG_¡ršgR•r -:: -DumpToFže -( -FILE - * -å -) const { - -51 -årštf -( -å -,"%s", -s -. -c_¡r -()); - - @CG_suifBuilder.cc - -15  - ~<¡ack -> - -16  - ~ - -17  - ~ - -18  - ~ - -20 -Çme¥aû - - gomega - { - -25 * - gk_ocg_comm’t -; - -26 * - gk_s2c_´agma -; - -27 * - gk_cuda_dim3 -; - -28 * - gk_cuda_k”Ãl -; - -29 * - gk_cuda_modif›r -; - -30 * - gk_cuda_‹xtu»_memÜy -; - -38 -Tu¶e -< Tu¶e<> > -smtNÚS¶™Lev–s -; - -39 -Tu¶e -< Tu¶e< -¡d -:: -¡ršg -> > -loÝIdxNames -; - -40 -¡d -:: -veùÜ -< std:: -·œ -<, std:: -¡ršg -> > -syncs -; - -41  -checkLoÝLev– -; - -42  -¡mtFÜLoÝCheck -; - -43  -uµ”BoundFÜLev– -; - -44  -low”BoundFÜLev– -; - -45 -boÞ - -fžlInBounds -; - -48 cÚ¡ * - glibcode_g’_v”_¡ršg - = ""; - -49 cÚ¡ * - glibcode_g’_who_¡ršg - = ""; - -50 cÚ¡ * - glibcode_g’_suif_¡ršg - = ""; - -53  -š™_code_g’ -() { - -54  -boÞ - - gisIn™ - = -çl£ -; - -55 if(! - gisIn™ -) - -57 - gisIn™ - = -Œue -; - -58 -ANNOTE -( -k_ocg_comm’t -, "omega_comm’t", -TRUE -); - -59 -ANNOTE -( -k_s2c_´agma -, "s2ø´agma", -TRUE -); - -60 -ANNOTE -( -k_cuda_dim3 -, "cud¨dim3", -TRUE -); - -61 -ANNOTE -( -k_cuda_k”Ãl -, "cud¨k”Ãl", -TRUE -); - -62 -ANNOTE -( -k_cuda_modif›r -, "cud¨modif›r", -TRUE -); - -67  -ex™_code_g’ -() { - -75 - gCG_suifBužd” -:: -CG_suifBužd” -( -´oc_symb - * -symb -) - -77 -symb_ - = -symb -; - -78 -š™_code_g’ -(); - -81 -CG_ouutR•r -* - gCG_suifBužd” -:: -C»©ePÏûHÞd” - (, CG_ouutR•¸* -¡mt -, - -82 -Tu¶e -< -CG_ouutR•r -*> & -funcLi¡ -, Tu¶e< -¡d -:: -¡ršg -> & -loÝ_v¬s -) const { - -83 -Œ“_node_li¡ - * -Šl - = -¡©ic_ÿ¡ -< -CG_suifR•r - *>( -¡mt -)-> -Šl_ -; - -84 -d–‘e - - g¡mt -; - -86  - gi - = 1; i <ð -funcLi¡ -. -size -(); i++) { - -87 ià( - gfuncLi¡ -[ -i -] =ð -NULL -) - -90 -CG_suifR•r - * - g»´ - = -¡©ic_ÿ¡ -( -funcLi¡ -[ -i -]); - -91 -Ý”ªd - - gÝ - = -»´ --> -Ý_ -; - -92 -d–‘e - - g»´ -; - -94 -v¬_sym - * - gvs - = -¡©ic_ÿ¡ -( -symb_ --> -lookup_sym -( -loÝ_v¬s -[ -i -]. -c_¡r -(), -SYM_VAR -)); - -96 -sub¡™u‹ -( -Šl -, -vs -, -Ý -, -symb_ -); - -98 ià( - gÝ -. -is_š¡r -()) - -99 -d–‘e - - gÝ -. -š¡r -(); - -102  -Ãw - -CG_suifR•r -( -Šl -); - -106 -CG_ouutR•r -* - gCG_suifBužd” -:: -C»©eAssignm’t -(, CG_ouutR•¸* -lhs -, - -107 -CG_ouutR•r - * -rhs -) const { - -108 iàÐ - glhs - =ð -NULL - || -rhs - == NULL ) { - -109 -årštf -( -¡d”r -, "Code generation: Missing†hs or„hs\n"); - -110  - gNULL -; - -113 -Ý”ªd - - g¤c - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -rhs -)-> -Ý_ -; - -114 ià( - g¤c -. -is_š¡r -(è&& src. -š¡r -()-> -Ýcode -(è=ð -io_¬¿y -) { - -115 -š_¬¿y - * -Ÿ - = -¡©ic_ÿ¡ -<š_¬¿y *>( -¤c -. -š¡r -()); - -116 -š¡ruùiÚ - * - gšs - = -Ãw - -š_¼r -( -io_lod -, -Ÿ --> -–em_ty³ -(), -Ý”ªd -(), ia); - -117 - g¤c - = -Ý”ªd -( -šs -); - -120 -š¡ruùiÚ - * - gšs -; - -121 -Ý”ªd - - gd¡ - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -lhs -)-> -Ý_ -; - -122 ià( - gd¡ -. -is_š¡r -(è&& d¡. -š¡r -()-> -Ýcode -(è=ð -io_¬¿y -) { - -123 -š_¬¿y - * -Ÿ - = -¡©ic_ÿ¡ -<š_¬¿y *>( -d¡ -. -š¡r -()); - -124 - gšs - = -Ãw - -š_¼r -( -io_¡r -, -ty³_void -, -Ý”ªd -(), o³¿nd( -Ÿ -), -¤c -); - -127 - gšs - = -Ãw - -š_¼r -( -io_ýy -, -¤c -. -ty³ -(), -d¡ -, src); - -129 -d–‘e - - glhs -; - -130 -d–‘e - - grhs -; - -132 -Œ“_node_li¡ - * - gŠl - = -Ãw -ree_node_list; - -133 - gŠl --> -­³nd -( -Ãw - -Œ“_š¡r -( -šs -)); - -135  -Ãw - -CG_suifR•r -( -Šl -); - -139 -CG_ouutR•r -* - gCG_suifBužd” -:: -C»©eInvoke -(cÚ¡ -¡d -:: -¡ršg - & -âame -, - -140 -Tu¶e -< -CG_ouutR•r -*> & -li¡ -) const { - -141 ià( - gâame - =ð -¡d -:: -¡ršg -("max"è|| -âame - == std::string("min")) { - -142 ià( -li¡ -. -size -() == 0) { - -143  -NULL -; - -145 ià( - gli¡ -. -size -() == 1) { - -146  -li¡ -[1]; - -149  - gÏ¡ - = -li¡ -. -size -(); - -150 -Ý”ªd - - gÝ2 - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -li¡ -[ -Ï¡ -])-> -Ý_ -; - -151 -d–‘e - - gli¡ -[ -Ï¡ -]; - -152 - gli¡ -. -d–‘e_Ï¡ -(); - -153 -CG_suifR•r - * - g»´ - = -¡©ic_ÿ¡ -( -C»©eInvoke -( -âame -, -li¡ -)); - -154 -Ý”ªd - - gÝ1 - = -»´ --> -Ý_ -; - -156 -š¡ruùiÚ - * - gšs -; - -157 ià( - gâame - =ð -¡d -:: -¡ršg -("max")) - -158 -šs - = -Ãw - -š_¼r -( -io_max -, -Ý1 -. -ty³ -(), -Ý”ªd -(), op1, -Ý2 -); - -160 - gšs - = -Ãw - -š_¼r -( -io_mš -, -Ý1 -. -ty³ -(), -Ý”ªd -(), op1, -Ý2 -); - -162 - g»´ --> - gÝ_ - = -Ý”ªd -( -šs -); - -164  - g»´ -; - -168 -årštf -( -¡d”r -, "Code generation: invoke function io_call‚ot implemented\n"); - -169  - gNULL -; - -174 -CG_ouutR•r -* - gCG_suifBužd” -:: -C»©eA‰ribu‹ -(CG_ouutR•¸* -cÚŒÞ -, - -175 cÚ¡ -¡d -:: -¡ršg - & -comm’tText -)const { - -176 ià( -comm’tText - =ð -¡d -:: -¡ršg -("")) { - -177  -cÚŒÞ -; - -180 -š¡ruùiÚ - * - gšs - = -Ãw - -š_¼r -( -io_mrk -); - -182 -immed_li¡ - * - giml - = -Ãw - immed_list; - -183 - giml --> -­³nd -( -immed -( -cÚ¡_ÿ¡ -<*>( -comm’tText -. -c_¡r -()))); - -184 - gšs --> -´•’d_ªnÙe -( -k_ocg_comm’t -, -iml -); - -186 -Œ“_node_li¡ - * - gŠl - ; - -187 - gŠl - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -cÚŒÞ -)-> -Šl_ -; - -188 - gŠl --> -­³nd -( -Ãw - -Œ“_š¡r -( -šs -)); - -191  -Ãw - -CG_suifR•r -( -Šl -); - -198 -CG_ouutR•r -* - gCG_suifBužd” -:: -C»©eComm’t -(, cÚ¡ -¡d -:: -¡ršg - & -comm’tText -) const { - -199 iàÐ -comm’tText - =ð -¡d -:: -¡ršg -("") ) { - -200  -NULL -; - -203 -š¡ruùiÚ - * - gšs - = -Ãw - -š_¼r -( -io_mrk -); - -205 -immed_li¡ - * - giml - = -Ãw - immed_list; - -206 - giml --> -­³nd -( -immed -( -cÚ¡_ÿ¡ -<*>( -comm’tText -. -c_¡r -()))); - -207 - gšs --> -´•’d_ªnÙe -( -k_ocg_comm’t -, -iml -); - -209 -Œ“_node_li¡ - * - gŠl - = -Ãw -ree_node_list; - -210 - gŠl --> -­³nd -( -Ãw - -Œ“_š¡r -( -šs -)); - -212  -Ãw - -CG_suifR•r -( -Šl -); - -216 -CG_ouutR•r -* - gCG_suifBužd” -:: -C»©eIf -(, CG_ouutR•¸* -gu¬dLi¡ -, - -217 -CG_ouutR•r - * -Œue_¡mtLi¡ -, CG_ouutR•¸* -çl£_¡mtLi¡ -) const { - -218  - gif_couÁ” - = 1; - -219 - g¡d -:: -¡ršg - -s - = -¡d -::¡ršg("omegaif_")+ -to_¡ršg -( -if_couÁ” -++); - -220 -Ïb–_sym - * - gif_Ïb– - = -Ãw -†ab–_sym( -cÚ¡_ÿ¡ -<*>( -s -. -c_¡r -())); - -221 - gsymb_ --> -add_sym -( -if_Ïb– -); - -223 iàÐ - gŒue_¡mtLi¡ - =ð -NULL - && -çl£_¡mtLi¡ - == NULL ) { - -224 -d–‘e - -gu¬dLi¡ -; - -225  - gNULL -; - -227 iàÐ - ggu¬dLi¡ - =ð -NULL - ) { - -228  -StmtLi¡Aµ’d -( -Œue_¡mtLi¡ -, -çl£_¡mtLi¡ -); - -231 -Œ“_node_li¡ - * - gh—d” - = -Ãw -ree_node_list; - -232 -Ý”ªd - - gÝ - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -gu¬dLi¡ -)-> -Ý_ -; - -234 - g¡d -:: -¡ack -<*> -S -; - -235 - gS -. -push -( -Ý -. -š¡r -()); - -236 ! - gS -. -em±y -()) { - -237 -š¡ruùiÚ - * - gšs - = -¡©ic_ÿ¡ -<š¡ruùiÚ *>( -S -. -tÝ -()); - -238 - gS -. -pÝ -(); - -239 ià( - gšs --> -Ýcode -(è=ð -io_ªd -) { - -240 -š¡ruùiÚ - * -šs1 - = -šs --> -¤c_Ý -(0). -š¡r -(); - -241 - gšs1 --> -»move -(); - -242 - gS -. -push -( -šs1 -); - -243 -š¡ruùiÚ - * - gšs2 - = -šs --> -¤c_Ý -(1). -š¡r -(); - -244 - gšs2 --> -»move -(); - -245 - gS -. -push -( -šs2 -); - -246 -d–‘e - - gšs -; - -249 - gšs - = -Ãw - -š_bj -( -io_bçl£ -, -if_Ïb– -, -Ý”ªd -( -šs -)); - -250 - gh—d” --> -­³nd -( -Ãw - -Œ“_š¡r -( -šs -)); - -254 -Œ“_node_li¡ - * - gth’_·¹ -, * - g–£_·¹ -; - -255 ià( - gŒue_¡mtLi¡ - !ð -NULL -) - -256 -th’_·¹ - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -Œue_¡mtLi¡ -)-> -Šl_ -; - -258 - gth’_·¹ - = -NULL -; - -259 ià( - gçl£_¡mtLi¡ - !ð -NULL -) - -260 -–£_·¹ - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -çl£_¡mtLi¡ -)-> -Šl_ -; - -262 - g–£_·¹ - = -NULL -; - -263 -Œ“_if - * - gti - = -Ãw -»e_if( -if_Ïb– -, -h—d” -, -th’_·¹ -, -–£_·¹ -); - -265 -Œ“_node_li¡ - * - gŠl - = -Ãw -ree_node_list; - -266 - gŠl --> -­³nd -( -ti -); - -268 -d–‘e - - ggu¬dLi¡ -; - -269 -d–‘e - - gŒue_¡mtLi¡ -; - -270 -d–‘e - - gçl£_¡mtLi¡ -; - -272  -Ãw - -CG_suifR•r -( -Šl -); - -276 -CG_ouutR•r -* - gCG_suifBužd” -:: -C»©eInduùive -(CG_ouutR•¸* -šdex -, - -277 -CG_ouutR•r - * -low” -, - -278 -CG_ouutR•r - * -uµ” -, - -279 -CG_ouutR•r - * -¡• -) const { - -280 iàÐ - gšdex - =ð -NULL - || -low” - =ðNULL || -uµ” - == NULL ) { - -281 -årštf -( -¡d”r -, "Code generation: something wrong in CreateInductive\n"); - -282  - gNULL -; - -285 ià( - g¡• - =ð -NULL -) - -286 -¡• - = -C»©eIÁ -(1); - -288 -v¬_sym - * - gšdex_sym - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -šdex -)-> -Ý_ -. -symbÞ -(); - -289 -Ý”ªd - - glow”_bound - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -low” -)-> -Ý_ -; - -290 -Ý”ªd - - guµ”_bound - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -uµ” -)-> -Ý_ -; - -291 -Ý”ªd - - g¡•_size - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -¡• -)-> -Ý_ -; - -293 -Ïb–_sym - * - gcÚtLab– - = -Ãw -†abel_sym(""); - -294 -Ïb–_sym - * - gbrkLab– - = -Ãw -†abel_sym(""); - -295 - gsymb_ --> -add_sym -( -cÚtLab– -); - -296 - gsymb_ --> -add_sym -( -brkLab– -); - -297 -Œ“_fÜ - * - gtf - = -Ãw -»e_fÜ( -šdex_sym -, -FOR_SLTE -, -cÚtLab– -, -brkLab– -, -NULL -, - -298 -low”_bound -, -uµ”_bound -, -¡•_size -, -NULL -); - -300 -Œ“_node_li¡ - * - gŠl - = -Ãw -ree_node_list; - -301 - gŠl --> -­³nd -( -tf -); - -303 -d–‘e - - gšdex -; - -304 -d–‘e - - glow” -; - -305 -d–‘e - - guµ” -; - -306 -d–‘e - - g¡• -; - -308  -Ãw - -CG_suifR•r -( -Šl -); - -312 -CG_ouutR•r -* - gCG_suifBužd” -:: -C»©eLoÝ -(, CG_ouutR•¸* -cÚŒÞ -, - -313 -CG_ouutR•r - * -¡mtLi¡ -) const { - -314 iàÐ - g¡mtLi¡ - =ð -NULL - ) { - -315 -d–‘e - -cÚŒÞ -; - -316  - gNULL -; - -318 iàÐ - gcÚŒÞ - =ð -NULL - ) { - -319 -årštf -( -¡d”r -, "Code generation:‚o inductive forhis†oop\n"); - -320  - g¡mtLi¡ -; - -323 -Œ“_node_li¡ - * - gŠl - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -cÚŒÞ -)-> -Šl_ -; - -324 -Œ“_node_li¡_™” - -™” -( -Šl -); - -325 -Œ“_fÜ - * - gtf - = -¡©ic_ÿ¡ -<Œ“_fÜ*>( -™” -. -¡• -()); - -327 -Œ“_node_li¡ - * - gbody - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -¡mtLi¡ -)-> -Šl_ -; - -328 - gtf --> -£t_body -( -body -); - -330 -d–‘e - - g¡mtLi¡ -; - -332  - gcÚŒÞ -; - -336 -CG_ouutR•r -* - gCG_suifBužd” -:: -C»©eIÁ -( -_i -) const { - -337 -š_ldc - * -šs - = -Ãw - in_ldc( -ty³_s32 -, -Ý”ªd -(), -immed -( -_i -)); - -339  -Ãw - -CG_suifR•r -( -Ý”ªd -( -šs -)); - -343 -CG_ouutR•r -* - gCG_suifBužd” -:: -C»©eId’t -(cÚ¡ -¡d -:: -¡ršg - & -_s -) const { - -344 iàÐ& -_s - =ð -NULL - || _ =ð -¡d -:: -¡ršg -("") ) { - -345  -NULL -; - -348 -v¬_sym - * - gvs - = -¡©ic_ÿ¡ -( -symb_ --> -lookup_sym -( -_s -. -c_¡r -(), -SYM_VAR -)); - -350 ià( - gvs - =ð -NULL -) { - -351 -vs - = -Ãw - -v¬_sym -( -ty³_s32 -, -cÚ¡_ÿ¡ -<*>( -_s -. -c_¡r -())); - -352 - gsymb_ --> -add_sym -( -vs -); - -355  -Ãw - -CG_suifR•r -( -Ý”ªd -( -vs -)); - -359 -CG_ouutR•r -* - gCG_suifBužd” -:: -C»©ePlus -(CG_ouutR•¸* -lÝ -, - -360 -CG_ouutR•r - * -rÝ -) const { - -361 iàÐ - grÝ - =ð -NULL - ) { - -362  -lÝ -; - -364 iàÐ - glÝ - =ð -NULL - ) { - -365  -rÝ -; - -368 -Ý”ªd - - gÝ1 - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -lÝ -)-> -Ý_ -; - -369 -Ý”ªd - - gÝ2 - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -rÝ -)-> -Ý_ -; - -371 -š¡ruùiÚ - * - gšs - = -Ãw - -š_¼r -( -io_add -, -Ý1 -. -ty³ -(), -Ý”ªd -(), op1, -Ý2 -); - -373 -d–‘e - - glÝ -; - -374 -d–‘e - - grÝ -; - -376  -Ãw - -CG_suifR•r -( -Ý”ªd -( -šs -)); - -380 -CG_ouutR•r -* - gCG_suifBužd” -:: -C»©eMšus -(CG_ouutR•¸* -lÝ -, - -381 -CG_ouutR•r - * -rÝ -) const { - -382 iàÐ - grÝ - =ð -NULL - ) { - -383  -lÝ -; - -385 iàÐ - glÝ - =ð -NULL - ) { - -386 -Ý”ªd - -Ý - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -rÝ -)-> -Ý_ -; - -387 -š¡ruùiÚ - * - gšs - = -Ãw - -š_¼r -( -io_Ãg -, -Ý -. -ty³ -(), -Ý”ªd -(), op); - -389 -d–‘e - - grÝ -; - -391  -Ãw - -CG_suifR•r -( -Ý”ªd -( -šs -)); - -394 -Ý”ªd - - gÝ1 - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -lÝ -)-> -Ý_ -; - -395 -Ý”ªd - - gÝ2 - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -rÝ -)-> -Ý_ -; - -397 -š¡ruùiÚ - * - gšs - = -Ãw - -š_¼r -( -io_sub -, -Ý1 -. -ty³ -(), -Ý”ªd -(), op1, -Ý2 -); - -399 -d–‘e - - glÝ -; - -400 -d–‘e - - grÝ -; - -402  -Ãw - -CG_suifR•r -( -Ý”ªd -( -šs -)); - -407 -CG_ouutR•r -* - gCG_suifBužd” -:: -C»©eTimes -(CG_ouutR•¸* -lÝ -, - -408 -CG_ouutR•r - * -rÝ -) const { - -409 iàÐ - grÝ - =ð -NULL - || -lÝ - == NULL) { - -410 ià( -rÝ - !ð -NULL -) { - -411 -rÝ --> -þ—r -(); - -412 -d–‘e - - grÝ -; - -414 ià( - glÝ - !ð -NULL -) { - -415 -lÝ --> -þ—r -(); - -416 -d–‘e - - glÝ -; - -418  - gNULL -; - -421 -Ý”ªd - - gÝ1 - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -lÝ -)-> -Ý_ -; - -422 -Ý”ªd - - gÝ2 - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -rÝ -)-> -Ý_ -; - -424 -š¡ruùiÚ - * - gšs - = -Ãw - -š_¼r -( -io_mul -, -Ý1 -. -ty³ -(), -Ý”ªd -(), op1, -Ý2 -); - -426 -d–‘e - - glÝ -; - -427 -d–‘e - - grÝ -; - -429  -Ãw - -CG_suifR•r -( -Ý”ªd -( -šs -)); - -433 -CG_ouutR•r -* - gCG_suifBužd” -:: -C»©eIÁeg”Divide -(CG_ouutR•¸* -lÝ -, - -434 -CG_ouutR•r - * -rÝ -) const { - -435 iàÐ - grÝ - =ð -NULL - ) { - -436 -årštf -( -¡d”r -, "Code generation: divide by NULL\n"); - -437  - gNULL -; - -439 iàÐ - glÝ - =ð -NULL - ) { - -440 -d–‘e - -rÝ -; - -441  - gNULL -; - -445 -Ý”ªd - - gÝ1 - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -lÝ -)-> -Ý_ -; - -446 -Ý”ªd - - gÝ2 - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -rÝ -)-> -Ý_ -; - -449 -š¡ruùiÚ - * - gšs - = -Ãw - -š_¼r -( -io_div -, -Ý1 -. -ty³ -(), -Ý”ªd -(), op1, -Ý2 -); - -451 -d–‘e - - glÝ -; - -452 -d–‘e - - grÝ -; - -454  -Ãw - -CG_suifR•r -( -Ý”ªd -( -šs -)); - -458 -CG_ouutR•r -* - gCG_suifBužd” -:: -C»©eIÁeg”Mod -(CG_ouutR•¸* -lÝ -, - -459 -CG_ouutR•r - * -rÝ -) const { - -460 iàÐ - grÝ - =ð -NULL - || -lÝ - == NULL ) { - -461  -NULL -; - -464 -Ý”ªd - - gÝ1 - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -lÝ -)-> -Ý_ -; - -465 -Ý”ªd - - gÝ2 - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -rÝ -)-> -Ý_ -; - -468 -š¡ruùiÚ - * - gšs - = -Ãw - -š_¼r -( -io_»m -, -ty³_s32 -, -Ý”ªd -(), -Ý1 -, -Ý2 -); - -470 -d–‘e - - glÝ -; - -471 -d–‘e - - grÝ -; - -473  -Ãw - -CG_suifR•r -( -Ý”ªd -( -šs -)); - -477 -CG_ouutR•r -* - gCG_suifBužd” -:: -C»©eAnd -(CG_ouutR•¸* -lÝ -, - -478 -CG_ouutR•r - * -rÝ -) const { - -479 ià( - grÝ - =ð -NULL -) - -480  -lÝ -; - -481 ià( - glÝ - =ð -NULL -) - -482  -rÝ -; - -484 -Ý”ªd - - gÝ1 - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -lÝ -)-> -Ý_ -; - -485 -Ý”ªd - - gÝ2 - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -rÝ -)-> -Ý_ -; - -487 -š¡ruùiÚ - * - gšs - = -Ãw - -š_¼r -( -io_ªd -, -Ý1 -. -ty³ -(), -Ý”ªd -(), op1, -Ý2 -); - -489 -d–‘e - - glÝ -; - -490 -d–‘e - - grÝ -; - -492  -Ãw - -CG_suifR•r -( -Ý”ªd -( -šs -)); - -496 -CG_ouutR•r -* - gCG_suifBužd” -:: -C»©eGE -(CG_ouutR•¸* -lÝ -, - -497 -CG_ouutR•r - * -rÝ -) const { - -498  -C»©eLE -( -rÝ -, -lÝ -); - -502 -CG_ouutR•r -* - gCG_suifBužd” -:: -C»©eLE -(CG_ouutR•¸* -lÝ -, - -503 -CG_ouutR•r - * -rÝ -) const { - -504 iàÐ - grÝ - =ð -NULL - || -lÝ - == NULL ) { - -505  -NULL -; - -508 -Ý”ªd - - gÝ1 - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -lÝ -)-> -Ý_ -; - -509 -Ý”ªd - - gÝ2 - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -rÝ -)-> -Ý_ -; - -511 -š¡ruùiÚ - * - gšs - = -Ãw - -š_¼r -( -io_¦e -, -ty³_s32 -, -Ý”ªd -(), -Ý1 -, -Ý2 -); - -513 -d–‘e - - glÝ -; - -514 -d–‘e - - grÝ -; - -516  -Ãw - -CG_suifR•r -( -Ý”ªd -( -šs -)); - -520 -CG_ouutR•r -* - gCG_suifBužd” -:: -C»©eEQ -(CG_ouutR•¸* -lÝ -, - -521 -CG_ouutR•r - * -rÝ -) const { - -522 iàÐ - grÝ - =ð -NULL - || -lÝ - == NULL ) { - -523  -NULL -; - -526 -Ý”ªd - - gÝ1 - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -lÝ -)-> -Ý_ -; - -527 -Ý”ªd - - gÝ2 - = -¡©ic_ÿ¡ -< -CG_suifR•r -*>( -rÝ -)-> -Ý_ -; - -529 -š¡ruùiÚ - * - gšs - = -Ãw - -š_¼r -( -io_£q -, -ty³_s32 -, -Ý”ªd -(), -Ý1 -, -Ý2 -); - -531 -d–‘e - - glÝ -; - -532 -d–‘e - - grÝ -; - -534  -Ãw - -CG_suifR•r -( -Ý”ªd -( -šs -)); - -539 -CG_ouutR•r -* - gCG_suifBužd” -:: -StmtLi¡Aµ’d -(CG_ouutR•¸* -li¡1 -, - -540 -CG_ouutR•r - * -li¡2 -) const { - -541 iàÐ - gli¡2 - =ð -NULL - ) { - -542  -li¡1 -; - -544 iàÐ - gli¡1 - =ð -NULL - ) { - -545  -li¡2 -; - -548 -Œ“_node_li¡ - * - gŠl1 - = -¡©ic_ÿ¡ -< -CG_suifR•r - *>( -li¡1 -)-> -Šl_ -; - -549 -Œ“_node_li¡ - * - gŠl2 - = -¡©ic_ÿ¡ -< -CG_suifR•r - *>( -li¡2 -)-> -Šl_ -; - -550 ià( - gŠl2 - =ð -NULL -) - -551 -Šl1 --> -­³nd -( -Ãw - -Œ“_š¡r -( -¡©ic_ÿ¡ -< -CG_suifR•r - *>( -li¡2 -)-> -Ý_ -. -š¡r -())); - -553 - gŠl1 --> -­³nd -( -Šl2 -); - -555 -d–‘e - - gli¡2 -; - -557  - gli¡1 -; - -565 -CG_ouutR•r -* - gCG_suifBužd” -:: -C»©eP¿gma -(, - -566 cÚ¡ -¡d -:: -¡ršg - & -´agmaText -) const { - -567 iàÐ -´agmaText - =ð -¡d -:: -¡ršg -("") ) { - -568  -NULL -; - -570 -š¡ruùiÚ - * - gšs - = -Ãw - -š_¼r -( -io_mrk -); - -571 -immed_li¡ - * - giml - = -Ãw - immed_list; - -572 - giml --> -­³nd -( -immed -( -cÚ¡_ÿ¡ -<*>( -´agmaText -. -c_¡r -()))); - -573 - gšs --> -­³nd_ªnÙe -( -k_s2c_´agma -, -iml -); - -574 -Œ“_node_li¡ - * - gŠl - = -Ãw -ree_node_list; - -575 - gŠl --> -­³nd -( -Ãw - -Œ“_š¡r -( -šs -)); - -576  -Ãw - -CG_suifR•r -( -Šl -); - -579 -CG_ouutR•r -* - gCG_suifBužd” -:: -C»©eDim3 -( -immed - -v¬Name -, immed -¬g1 -, immed -¬g2 -) const { - -580 -š¡ruùiÚ - * - gšs - = -Ãw - -š_¼r -( -io_mrk -); - -581 -immed_li¡ - * - giml - = -Ãw - immed_list; - -582 - giml --> -­³nd -( -immed -( -v¬Name -)); - -583 - giml --> -­³nd -( -¬g1 -); - -584 - giml --> -­³nd -( -¬g2 -); - -585 - gšs --> -­³nd_ªnÙe -( -k_cuda_dim3 -, -iml -); - -586 -Œ“_node_li¡ - * - gŠl - = -Ãw -ree_node_list; - -587 - gŠl --> -­³nd -( -Ãw - -Œ“_š¡r -( -šs -)); - -588  -Ãw - -CG_suifR•r -( -Šl -); - -591 -CG_ouutR•r -* - gCG_suifBužd” -:: -C»©eDim3 -( -immed - -v¬Name -, immed -¬g1 -, immed -¬g2 -, immed -¬g3 -) const { - -592 -š¡ruùiÚ - * - gšs - = -Ãw - -š_¼r -( -io_mrk -); - -593 -immed_li¡ - * - giml - = -Ãw - immed_list; - -594 - giml --> -­³nd -( -immed -( -v¬Name -)); - -595 - giml --> -­³nd -( -¬g1 -); - -596 - giml --> -­³nd -( -¬g2 -); - -597 - giml --> -­³nd -( -¬g3 -); - -598 - gšs --> -­³nd_ªnÙe -( -k_cuda_dim3 -, -iml -); - -599 -Œ“_node_li¡ - * - gŠl - = -Ãw -ree_node_list; - -600 - gŠl --> -­³nd -( -Ãw - -Œ“_š¡r -( -šs -)); - -601  -Ãw - -CG_suifR•r -( -Šl -); - -604 -CG_ouutR•r -* - gCG_suifBužd” -:: -C»©eK”Ãl -( -immed_li¡ -* -iml -) const { - -605 -š¡ruùiÚ - * -šs - = -Ãw - -š_¼r -( -io_mrk -); - -606 - gšs --> -­³nd_ªnÙe -( -k_cuda_k”Ãl -, -iml -); - -607 -Œ“_node_li¡ - * - gŠl - = -Ãw -ree_node_list; - -608 - gŠl --> -­³nd -( -Ãw - -Œ“_š¡r -( -šs -)); - -609  -Ãw - -CG_suifR•r -( -Šl -); - -612 -ty³_node -* - gCG_suifBužd” -:: -ModifyTy³ -Ñy³_node* -ba£ -, cÚ¡ * -modif›r -) const { - -613 -modif›r_ty³ -* - g»suÉ - = -Ãw - modif›r_ty³( -TYPE_NULL -, -ba£ -); - -614 -immed_li¡ - * - giml - = -Ãw - immed_list; - -615 - giml --> -­³nd -( -immed -((*) -modif›r -)); - -616 - g»suÉ --> -­³nd_ªnÙe -( -k_cuda_modif›r -, -iml -); - -617  - g»suÉ -; - -626 -boÞ - -sub¡™u‹ -( -š¡ruùiÚ - * -š -, -v¬_sym - * -sym -, -Ý”ªd - -ex´ -, -ba£_symb - * -¡ -) { - -627 ià( - gš - =ð -NULL - || -sym - == NULL) - -628  -çl£ -; - -630 -boÞ - - gr - = -çl£ -; - -631  - gi - = 0; i < - gš --> -num_¤cs -(); i++) { - -632 -Ý”ªd - -Ý -( -š --> -¤c_Ý -( -i -)); - -634 ià( - gÝ -. -is_symbÞ -(è&& op. -symbÞ -(è=ð -sym -) { - -635 -š --> -£t_¤c_Ý -( -i -, -ex´ -. -þÚe -( -¡ -)); - -636 - gr - = -Œue -; - -638 ià( - gÝ -. -is_š¡r -()) { - -639 - gr - = -sub¡™u‹ -( -Ý -. -š¡r -(), -sym -, -ex´ -, -¡ -) ||„; - -643  - gr -; - -646 -boÞ - -sub¡™u‹ -( -Œ“_node - * -Š -, -v¬_sym - * -sym -, -Ý”ªd - -ex´ -, -ba£_symb - * -¡ -) { - -647 ià( - gŠ - =ð -NULL -) - -648  -çl£ -; - -650 -boÞ - - gr - = -çl£ -; - -651 ià( - gŠ --> -kšd -(è=ð -TREE_INSTR -) - -652 -r - = -sub¡™u‹ -( -¡©ic_ÿ¡ -< -Œ“_š¡r -*>( -Š -)-> -š¡r -(), -sym -, -ex´ -, -¡ -è|| - gr -; - -654  - gi - = 0; i < - gŠ --> -num_chžd_li¡s -(); i++) { - -655 - gr - = -sub¡™u‹ -( -Š --> -chžd_li¡_num -( -i -), -sym -, -ex´ -, -¡ -) ||„; - -659  - gr -; - -662 -boÞ - -sub¡™u‹ -( -Œ“_node_li¡ - * -Šl -, -v¬_sym - * -sym -, -Ý”ªd - -ex´ -, - -663 -ba£_symb - * -¡ -) { - -664 ià( - gŠl - =ð -NULL -) - -665  -çl£ -; - -667 -boÞ - - gr - = -çl£ -; - -668 -Œ“_node_li¡_™” - -™” -( -Šl -); - -669 ! - g™” -. -is_em±y -()) { - -670 -Œ“_node - * - gŠ - = -™” -. -¡• -(); - -672 - gr - = -sub¡™u‹ -( -Š -, -sym -, -ex´ -, -¡ -) ||„; - -675  - gr -; - - @CG_suifRepr.cc - -14  - ~ - -15  - ~<¡dio.h -> - -17 -Çme¥aû - - gomega - { - -19 - gCG_suifR•r -:: -CG_suifR•r -(): -Šl_ -( -NULL -), -Ý_ -() { - -22 - gCG_suifR•r -:: -CG_suifR•r -( -Œ“_node_li¡ - * -Šl -): -Šl_ -ÑÆ), -Ý_ -() { - -25 - gCG_suifR•r -:: -CG_suifR•r -( -Ý”ªd - -Ý -): -Šl_ -( -NULL -), -Ý_ -(op) { - -28 - gCG_suifR•r -::~ -CG_suifR•r -() { - -33 -CG_ouutR•r -* -CG_suifR•r -:: -þÚe -() { - -34 ià(! -Ý_ -. -is_nuÎ -() ) { - -35 -Ý”ªd - -Ý - = -Ý_ -. -þÚe -(); - -36  -Ãw - -CG_suifR•r -( -Ý -); - -38 ià( - gŠl_ - !ð -NULL -) { - -39 -Œ“_node_li¡ - * -Šl - = -Šl_ --> -þÚe -(); - -40  -Ãw - -CG_suifR•r -( -Šl -); - -43  -Ãw - -CG_suifR•r -(); - -46  - gCG_suifR•r -:: -þ—r -() { - -47 ià(! -Ý_ -. -is_nuÎ -()) { - -48 ià( -Ý_ -. -is_š¡r -()) - -49 -d–‘e - -Ý_ -. -š¡r -(); - -50 - gÝ_ -. -£t_nuÎ -(); - -52 ià( - gŠl_ - !ð -NULL -) { - -53 -d–‘e - -Šl_ -; - -54 - gŠl_ - = -NULL -; - -58 -Œ“_node_li¡ -* - gCG_suifR•r -:: -G‘Code -() const { - -59  -Šl_ -; - -62 -Ý”ªd - - gCG_suifR•r -:: -G‘Ex´essiÚ -() const { - -63  -Ý_ -; - -66  - gCG_suifR•r -:: -Dump -() const { - -67 ià( -Šl_ - !ð -NULL -) - -68 -Šl_ --> -´št -(); - -69 ià(! - gÝ_ -. -is_nuÎ -()) - -70 - gÝ_ -. -´št -(); - -73  - gCG_suifR•r -:: -DumpToFže -( -FILE - * -å -) const { - -74 ià( -Šl_ - !ð -NULL -) - -75 -Šl_ --> -´št -( -å -); - -76 ià(! - gÝ_ -. -is_nuÎ -()) - -77 - gÝ_ -. -´št -( -å -); - - @code_gen.cc - -16  - ~ - -17  - ~ - -18  - ~ - -19  - ~ - -20  - ~ - -21  - ~ - -22  - ~ - -23  - ~ - -24  - ~ - -26  - ~ - -27  - ~ - -28  - ~ - -29  - ~ - -30  - ~ - -31  - ~ - -32  - ~ - -34 -Çme¥aû - - gomega - { - -37  - gÏ¡_Ëv– -; - -38 -S‘Tu¶e - - gÃw_IS -; - -39 -S‘Tu¶eTu¶e - - g´ojeùed_nIS -; - -40 - gTu¶e -< - gCG_ouutR•r - *> - g¡©em’tInfo -; - -41 -R–Tu¶e - - gŒªsfÜm©iÚs -; - -44 - gTu¶e -< Tu¶e<> > - gsmtNÚS¶™Lev–s -; - -45 - gTu¶e -< Tu¶e< - g¡d -:: -¡ršg -> > -loÝIdxNames -; - -46 - g¡d -:: -veùÜ -< -¡d -:: -·œ -<, std:: -¡ršg -> > -syncs -; - -51  - gcheckLoÝLev– -; - -52  - g¡mtFÜLoÝCheck -; - -53  - guµ”BoundFÜLev– -; - -54  - glow”BoundFÜLev– -; - -55 -boÞ - - gfžlInBounds -; - -58 þas  - cJunkSticIn™ -{ - gpublic -: -JunkSticIn™ -(){ -checkLoÝLev– -=0; - gfžlInBounds -= -çl£ -;} }; - -59  -JunkSticIn™ - - gjunkIn™In¡ªû__ -; - -64 -CG_»suÉ - * -g’_»cursive -( -Ëv– -, -IÁTu¶e - & -isAùive -); - -67  - gcode_g’_debug -=0; - -70 -S‘Tu¶e - - $fž‹r_funùiÚ_symbÞs -( -S‘Tu¶e - & -£ts -, -boÞ - -k“p_fs -){ - -71 -S‘Tu¶e - - `Ãw_£ts -( -£ts -. - `size -()); - -72  -i - = 1; i <ð -£ts -. - `size -(); i++) { - -73 -R–©iÚ - -R - = -£ts -[ -i -]; - -74 -R–©iÚ - & -S - = -Ãw_£ts -[ -i -]; - -75 - `as£¹ -( -R -. - `is_£t -()); - -77 -S - = - `R–©iÚ -( -R -. - `n_£t -()); - -78 -S -. - `cÝy_Çmes -( -R -); - -79 -F_Exi¡s - * -ã - = -S -. - `add_exi¡s -(); - -80 -F_Or - * -fo - = -ã --> - `add_Ü -(); - -81  -DNF_I‹¿tÜ - - `D -( -R -. - `qu”y_DNF -()); -D -; D++) { - -82 -F_And - * -ç - = -fo --> - `add_ªd -(); - -83 -V¬ŸbË_ID_Tu¶e - & -Þdloÿls - = (* -D -)-> - `loÿls -(); - -84 -SeùiÚ -< -V¬ŸbË_ID -> -Ãwloÿls - = -ã --> - `deþ¬e_tu¶e -( -Þdloÿls -. - `size -()); - -91  -EQ_I‹¿tÜ - - `e -(* -D -); -e -;ƒ++) - -92 if(( - `max_fs_¬™y -(* -e -è> 0è=ð -k“p_fs -){ - -93 -EQ_HªdË - -n - = -ç --> - `add_EQ -(); - -94  -CÚ¡r_V¬s_I‹r - - `cvi -(* -e -, -çl£ -); -cvi -;cvi++) - -95 if((* -cvi -). -v¬ --> - `kšd -(è=ð -Wždÿrd_V¬ -) - -96 -n -. - `upd©e_cÛf -( -Ãwloÿls -[ -Þdloÿls -. - `šdex -((* -cvi -). -v¬ -)], - -97 (* -cvi -). -cÛf -); - -99 if((* -cvi -). -v¬ --> - `kšd -(è=ð -Glob®_V¬ -) - -100 -n -. - `upd©e_cÛf -( -S -. - `g‘_loÿl -((* -cvi -). -v¬ --> - `g‘_glob®_v¬ -(), - -101 (* -cvi -). -v¬ --> - `funùiÚ_of -()), - -102 (* -cvi -). -cÛf -); - -104 -n -. - `upd©e_cÛf -((* -cvi -). -v¬ -,(*cvi). -cÛf -); - -105 -n -. - `upd©e_cÚ¡ -((* -e -). - `g‘_cÚ¡ -()); - -106 -n -. - `fš®ize -(); - -109  -GEQ_I‹¿tÜ - - `g -(* -D -); -g -; g++) - -110 if(( - `max_fs_¬™y -(* -g -è> 0è=ð -k“p_fs -) { - -111 -GEQ_HªdË - -n - = -ç --> - `add_GEQ -(); - -112  -CÚ¡r_V¬s_I‹r - - `cvi -(* -g -, -çl£ -); -cvi -;cvi++) - -113 if((* -cvi -). -v¬ --> - `kšd -(è=ð -Wždÿrd_V¬ -) - -114 -n -. - `upd©e_cÛf -( -Ãwloÿls -[ -Þdloÿls -. - `šdex -((* -cvi -). -v¬ -)], - -115 (* -cvi -). -cÛf -); - -117 if((* -cvi -). -v¬ --> - `kšd -(è=ð -Glob®_V¬ -) - -118 -n -. - `upd©e_cÛf -( -S -. - `g‘_loÿl -((* -cvi -). -v¬ --> - `g‘_glob®_v¬ -(), - -119 (* -cvi -). -v¬ --> - `funùiÚ_of -()), - -120 (* -cvi -). -cÛf -); - -122 -n -. - `upd©e_cÛf -((* -cvi -). -v¬ -,(*cvi). -cÛf -); - -123 -n -. - `upd©e_cÚ¡ -((* -g -). - `g‘_cÚ¡ -()); - -124 -n -. - `fš®ize -(); - -127 -S -. - `fš®ize -(); - -130  -Ãw_£ts -; - -131 - } -} - -134 -R–Tu¶e - - $¡r_funùiÚ_symbÞs -( -S‘Tu¶e - & -£ts -) { - -135  - `fž‹r_funùiÚ_symbÞs -( -£ts -, -çl£ -); - -136 - } -} - -138 -R–Tu¶e - - $exŒaù_funùiÚ_symbÞs -( -S‘Tu¶e - & -£ts -) { - -139  - `fž‹r_funùiÚ_symbÞs -( -£ts -, -Œue -); - -140 - } -} - -143 - g¡d -:: -¡ršg - - $MMG’”©eCode -( -R–Tu¶e - & -T -, -S‘Tu¶e - & -Þd_IS -, -R–©iÚ - & -known -,  -effÜt -) { - -144 -Tu¶e -< -CG_ouutR•r - *> -ÇmeInfo -; - -145  -¡mt - = 1; stmˆ<ð -T -. - `size -(); stmt++) - -146 -ÇmeInfo -. - `­³nd -( -Ãw - - `CG_¡ršgR•r -("s" + - `to_¡ršg -( -¡mt -))); - -148 -CG_¡ršgBužd” - -ocg -; - -149 -CG_¡ršgR•r - * -sR•r - = -¡©ic_ÿ¡ -( - `MMG’”©eCode -(& -ocg -, -T -, -Þd_IS -, -ÇmeInfo -, -known -, -effÜt -)); - -151  -i - = 1; i <ð -ÇmeInfo -. - `size -(); i++) - -152 -d–‘e - -ÇmeInfo -[ -i -]; - -153 ià( -sR•r - !ð -NULL -) - -154  - `G‘SŒšg -( -sR•r -); - -156  -¡d -:: - `¡ršg -(); - -157 - } -} - -163 -CG_ouutR•r -* -MMG’”©eCode -( -CG_ouutBužd” -* -ocg -, -R–Tu¶e - & -T -, -S‘Tu¶e - & -Þd_IS -, cÚ¡ -Tu¶e - & -¡mt_cÚ‹Á -, -R–©iÚ - & -known -,  -effÜt -) { - -164  - g¡mts - = -T -. -size -(); - -165 ià( - g¡mts - == 0) - -166  -ocg --> -C»©eComm’t -(1, "No statements found!"); - -167 ià(! - gknown -. -is_nuÎ -()) - -168 - gknown -. -sim¶ify -(); - -171  - gmaxStmt - = 1; - -172 - gÏ¡_Ëv– - = 0; - -173  - g¡mt - = 1; stmˆ<ð -¡mts -; stmt++) { - -174  - gÞd_dim - = -T -[ -¡mt -]. -n_out -(); - -175 ià( - gÞd_dim - > - gÏ¡_Ëv– -) - -176 - gÏ¡_Ëv– - = -Þd_dim -; - -178  - gi - = 1; i <ð -Þd_IS -[ -¡mt -]. -n_£t -(); i++) - -179 - gT -[ -¡mt -]. -Çme_šput_v¬ -( -i -, -Þd_IS -[¡mt]. -£t_v¬ -(i)-> -Çme -()); - -180  - gi - = 1; i <ð -Þd_dim -; i++) - -181 - gT -[ -¡mt -]. -Çme_ouut_v¬ -( -i -, -¡d -:: -¡ršg -("t")+ -to_¡ršg -(i)); - -182 - gT -[ -¡mt -]. -£tup_Çmes -(); - -184 -R–©iÚ - - gR - = -Rªge -( -Re¡riù_Domaš -( -cÝy -( -T -[ -¡mt -]), cÝy( -Þd_IS -[stmt]))); - -185 - gR -. -sim¶ify -(); - -186  - gR -. -is_uµ”_bound_§tisfŸbË -()) { - -187 - gÃw_IS -. -»®loÿ‹ -( -maxStmt -); - -188 - gŒªsfÜm©iÚs -. -»®loÿ‹ -( -maxStmt -); - -189 - g¡©em’tInfo -. -»®loÿ‹ -( -maxStmt -); - -190 -DNF - * - gdnf - = -R -. -qu”y_DNF -(); - -191 -DNF_I‹¿tÜ - -c -( -dnf -); - -192 -R–©iÚ - - gR2 - = R–©iÚ( -R -, * -c -); - -193 - gR2 -. -sim¶ify -(); - -194 ià( - gR2 -. -is_šexaù -()) - -195 -throw - -codeg’_”rÜ -("unknown constraint in†oop bounds"); - -196 ià( - gknown -. -is_nuÎ -()) { - -197 - gÃw_IS -[ -maxStmt -] = -R2 -; - -198 - gŒªsfÜm©iÚs -[ -maxStmt -] = -T -[ -¡mt -]; - -199 - g¡©em’tInfo -[ -maxStmt -] = -¡mt_cÚ‹Á -[ -¡mt -]; - -200 - gmaxStmt -++; - -203 -R–©iÚ - - gR2_ex‹nded - = -cÝy -( -R2 -); - -204 -R–©iÚ - - gknown_ex‹nded - = -cÝy -( -known -); - -205 ià( - gR2 -. -n_£t -(è> - gknown -.n_set()) - -206 - gknown_ex‹nded - = -Ex‹nd_S‘ -( -known_ex‹nded -, -R2 -. -n_£t -()- -known -.n_set()); - -207 ià( - gR2 -. -n_£t -(è< - gknown -.n_set()) - -208 - gR2_ex‹nded - = -Ex‹nd_S‘ -( -R2_ex‹nded -, -known -. -n_£t -()- -R2 -.n_set()); - -209 ià( -IÁ”£ùiÚ -( -R2_ex‹nded -, -known_ex‹nded -). -is_uµ”_bound_§tisfŸbË -()) { - -210 - gÃw_IS -[ -maxStmt -] = -R2 -; - -211 - gŒªsfÜm©iÚs -[ -maxStmt -] = -T -[ -¡mt -]; - -212 - g¡©em’tInfo -[ -maxStmt -] = -¡mt_cÚ‹Á -[ -¡mt -]; - -213 - gmaxStmt -++; - -216 - gc -. -Ãxt -(); - -217 ià(! - gc -. -live -()) - -219 if( - gcode_g’_debug -) { - -220 -årštf -( -DebugFže -, "splitting iteration space for disjoint form\n"); - -221 -årštf -( -DebugFže -, "Original iteration space: \n"); - -222 - gR -. -´št_w™h_subs -( -DebugFže -); - -223 -årštf -( -DebugFže -, "First conjunct: \n"); - -224 - gR2 -. -´št_w™h_subs -( -DebugFže -); - -226 -R–©iÚ - -»mašd” -( -R -, * -c -); - -227 - gc -. -Ãxt -(); - -228  - gc -. -live -()) { - -229 - g»mašd” - = -UniÚ -( -»mašd” -, -R–©iÚ -( -R -, * -c -)); - -230 - gc -. -Ãxt -(); - -232 - gR - = -Difã»nû -( -»mašd” -, -cÝy -( -R2 -)); - -233 - gR -. -sim¶ify -(); - -234 if( - gcode_g’_debug -) { - -235 -årštf -( -DebugFže -, "Remaining iteration space: \n"); - -236 - gR -. -´št_w™h_subs -( -DebugFže -); - -242 - g¡mts - = -maxStmt --1; - -243 if( - g¡mts - == 0) - -244  -ocg --> -C»©eComm’t -(1, "No…oints in‡ny ofhe iteration spaces!"); - -247  - g¡mt - = 1; stmˆ<ð -¡mts -; stmt++) { - -248  - gÞd_dim - = -Ãw_IS -[ -¡mt -]. -n_£t -(); - -249 ià( - gÞd_dim - < - gÏ¡_Ëv– -) { - -250 - gÃw_IS -[ -¡mt -] = -Ex‹nd_S‘ -( -Ãw_IS -[¡mt], -Ï¡_Ëv– -- -Þd_dim -); - -251 -F_And - * - gf_roÙ - = -Ãw_IS -[ -¡mt -]. -ªd_w™h_ªd -(); - -252  - gi - = -Þd_dim -+1; i <ð -Ï¡_Ëv– -; i++) { - -253 -EQ_HªdË - - gh - = -f_roÙ --> -add_EQ -(); - -254 - gh -. -upd©e_cÛf -( -Ãw_IS -[ -¡mt -]. -£t_v¬ -( -i -), 1); - -255 - gh -. -upd©e_cÚ¡ -( -posInfš™y -); - -261 if( - gknown -. -is_nuÎ -()) { - -262 - gknown - = -R–©iÚ -:: -True -( -Ï¡_Ëv– -); - -264 - gknown - = -Ex‹nd_S‘ -( -known -, -Ï¡_Ëv– --known. -n_£t -()); - -265  - gi - = 1; i <ð -Ï¡_Ëv– -; i++) - -266 - gknown -. -Çme_£t_v¬ -( -i -, -¡d -:: -¡ršg -("t")+ -to_¡ršg -(i)); - -267 - gknown -. -£tup_Çmes -(); - -270 - g´ojeùed_nIS -. -þ—r -(); - -271 - g´ojeùed_nIS -. -»®loÿ‹ -( -Ï¡_Ëv– -); - -272  - gi - = 1; i <ð -Ï¡_Ëv– -; i++ ) { - -273 - g´ojeùed_nIS -[ -i -]. -»®loÿ‹ -( -¡mts -); - -275  - g¡mt - = 1; stmˆ<ð -¡mts -; stmt++) { - -276 ià( - gÏ¡_Ëv– - > 0) - -277 - g´ojeùed_nIS -[ -Ï¡_Ëv– -][ -¡mt -] = -Ãw_IS -[stmt]; - -278  - gi - = -Ï¡_Ëv– --1; i >= 1; i--) { - -279 - g´ojeùed_nIS -[ -i -][ -¡mt -] = -Projeù -( -cÝy -( -´ojeùed_nIS -[i+1][¡mt]), i+1, -S‘_V¬ -); - -280 - g´ojeùed_nIS -[ -i -][ -¡mt -]. -sim¶ify -(); - -285 -IÁTu¶e - -®lStmts -( -¡mts -); - -286  - gi - = 1; i <ð -¡mts -; i++) - -287 - g®lStmts -[ -i -] = 1; - -288 -CG_»suÉ - * - gcg - = -g’_»cursive -(1, -®lStmts -); - -291 - gcg - = -cg --> -»compu‹ -( -known -, known); - -292 - gcg - = -cg --> -fÜû_fš™e_bounds -(); - -295  - gi - = 1; i <ð -mš -( -effÜt -, -cg --> -d•th -()); i++) - -296 - gcg - = -cg --> -liáOv”h—d -( -i -); - -299 - gcg --> -hoi¡Gu¬d -(); - -303 -CG_ouutR•r -* - gsR•r - = -cg --> -´štR•r -( -ocg -, 1, -¡d -:: -veùÜ -( -Ï¡_Ëv– -)); - -304 -d–‘e - - gcg -; - -305 - gcg - = -NULL -; - -306 - g´ojeùed_nIS -. -þ—r -(); - -307 - gŒªsfÜm©iÚs -. -þ—r -(); - -308 - gÃw_IS -. -þ—r -(); - -310  - gsR•r -; - -314 -CG_ouutR•r -* -MMG’”©eCode -( -CG_ouutBužd” -* -ocg -, -R–Tu¶e - & -T -, -S‘Tu¶e - & -Þd_IS -, - -315 cÚ¡ -Tu¶e -< -CG_ouutR•r - *> & -¡mt_cÚ‹Á -, -R–©iÚ - & -known -, - -316 -Tu¶e -< -IÁTu¶e - >& -smtNÚS¶™Lev–s_ -, - -317 -¡d -:: -veùÜ -< std:: -·œ -<, std:: -¡ršg -> > -syncs_ -, - -318 cÚ¡ -Tu¶e -< Tu¶e< -¡d -:: -¡ršg -> >& -loÝIdxNames_ -, - -319  -effÜt -) { - -320  - g¡mts - = -T -. -size -(); - -321 ià( - g¡mts - == 0) - -322  -ocg --> -C»©eComm’t -(1, "No statements found!"); - -323 ià(! - gknown -. -is_nuÎ -()) - -324 - gknown -. -sim¶ify -(); - -328 - gsmtNÚS¶™Lev–s - = -smtNÚS¶™Lev–s_ -; - -329 - gsyncs - = -syncs_ -; - -330 - gloÝIdxNames - = -loÝIdxNames_ -; - -336  - gmaxStmt - = 1; - -337 - gÏ¡_Ëv– - = 0; - -338  - g¡mt - = 1; stmˆ<ð -¡mts -; stmt++) { - -339  - gÞd_dim - = -T -[ -¡mt -]. -n_out -(); - -340 ià( - gÞd_dim - > - gÏ¡_Ëv– -) - -341 - gÏ¡_Ëv– - = -Þd_dim -; - -343  - gi - = 1; i <ð -Þd_IS -[ -¡mt -]. -n_£t -(); i++) - -344 - gT -[ -¡mt -]. -Çme_šput_v¬ -( -i -, -Þd_IS -[¡mt]. -£t_v¬ -(i)-> -Çme -()); - -345  - gi - = 1; i <ð -Þd_dim -; i++) - -346 - gT -[ -¡mt -]. -Çme_ouut_v¬ -( -i -, -¡d -:: -¡ršg -("t")+ -to_¡ršg -(i)); - -347 - gT -[ -¡mt -]. -£tup_Çmes -(); - -349 -R–©iÚ - - gR - = -Rªge -( -Re¡riù_Domaš -( -cÝy -( -T -[ -¡mt -]), cÝy( -Þd_IS -[stmt]))); - -350 - gR -. -sim¶ify -(); - -351  - gR -. -is_uµ”_bound_§tisfŸbË -()) { - -352 - gÃw_IS -. -»®loÿ‹ -( -maxStmt -); - -353 - gŒªsfÜm©iÚs -. -»®loÿ‹ -( -maxStmt -); - -354 - g¡©em’tInfo -. -»®loÿ‹ -( -maxStmt -); - -357 - gsmtNÚS¶™Lev–s -. -»®loÿ‹ -( -maxStmt -); - -361 -DNF - * - gdnf - = -R -. -qu”y_DNF -(); - -362 -DNF_I‹¿tÜ - -c -( -dnf -); - -363 -R–©iÚ - - gR2 - = R–©iÚ( -R -, * -c -); - -364 - gR2 -. -sim¶ify -(); - -365 ià( - gR2 -. -is_šexaù -()) - -366 -throw - -codeg’_”rÜ -("unknown constraint in†oop bounds"); - -367 ià( - gknown -. -is_nuÎ -()) { - -368 - gÃw_IS -[ -maxStmt -] = -R2 -; - -369 - gŒªsfÜm©iÚs -[ -maxStmt -] = -T -[ -¡mt -]; - -370 - g¡©em’tInfo -[ -maxStmt -] = -¡mt_cÚ‹Á -[ -¡mt -]; - -371 - gmaxStmt -++; - -374 -R–©iÚ - - gR2_ex‹nded - = -cÝy -( -R2 -); - -375 -R–©iÚ - - gknown_ex‹nded - = -cÝy -( -known -); - -376 ià( - gR2 -. -n_£t -(è> - gknown -.n_set()) - -377 - gknown_ex‹nded - = -Ex‹nd_S‘ -( -known_ex‹nded -, -R2 -. -n_£t -()- -known -.n_set()); - -378 ià( - gR2 -. -n_£t -(è< - gknown -.n_set()) - -379 - gR2_ex‹nded - = -Ex‹nd_S‘ -( -R2_ex‹nded -, -known -. -n_£t -()- -R2 -.n_set()); - -380 ià( -IÁ”£ùiÚ -( -R2_ex‹nded -, -known_ex‹nded -). -is_uµ”_bound_§tisfŸbË -()) { - -381 - gÃw_IS -[ -maxStmt -] = -R2 -; - -382 - gŒªsfÜm©iÚs -[ -maxStmt -] = -T -[ -¡mt -]; - -383 - g¡©em’tInfo -[ -maxStmt -] = -¡mt_cÚ‹Á -[ -¡mt -]; - -384 - gmaxStmt -++; - -387 - gc -. -Ãxt -(); - -388 ià(! - gc -. -live -()) - -390 if( - gcode_g’_debug -) { - -391 -årštf -( -DebugFže -, "splitting iteration space for disjoint form\n"); - -392 -årštf -( -DebugFže -, "Original iteration space: \n"); - -393 - gR -. -´št_w™h_subs -( -DebugFže -); - -394 -årštf -( -DebugFže -, "First conjunct: \n"); - -395 - gR2 -. -´št_w™h_subs -( -DebugFže -); - -397 -R–©iÚ - -»mašd” -( -R -, * -c -); - -398 - gc -. -Ãxt -(); - -399  - gc -. -live -()) { - -400 - g»mašd” - = -UniÚ -( -»mašd” -, -R–©iÚ -( -R -, * -c -)); - -401 - gc -. -Ãxt -(); - -403 - gR - = -Difã»nû -( -»mašd” -, -cÝy -( -R2 -)); - -404 - gR -. -sim¶ify -(); - -405 if( - gcode_g’_debug -) { - -406 -årštf -( -DebugFže -, "Remaining iteration space: \n"); - -407 - gR -. -´št_w™h_subs -( -DebugFže -); - -413 - g¡mts - = -maxStmt --1; - -414 if( - g¡mts - == 0) - -415  -ocg --> -C»©eComm’t -(1, "No…oints in‡ny ofhe iteration spaces!"); - -418  - g¡mt - = 1; stmˆ<ð -¡mts -; stmt++) { - -419  - gÞd_dim - = -Ãw_IS -[ -¡mt -]. -n_£t -(); - -420 ià( - gÞd_dim - < - gÏ¡_Ëv– -) { - -421 - gÃw_IS -[ -¡mt -] = -Ex‹nd_S‘ -( -Ãw_IS -[¡mt], -Ï¡_Ëv– -- -Þd_dim -); - -422 -F_And - * - gf_roÙ - = -Ãw_IS -[ -¡mt -]. -ªd_w™h_ªd -(); - -423  - gi - = -Þd_dim -+1; i <ð -Ï¡_Ëv– -; i++) { - -424 -EQ_HªdË - - gh - = -f_roÙ --> -add_EQ -(); - -425 - gh -. -upd©e_cÛf -( -Ãw_IS -[ -¡mt -]. -£t_v¬ -( -i -), 1); - -426 - gh -. -upd©e_cÚ¡ -( -posInfš™y -); - -432 if( - gknown -. -is_nuÎ -()) { - -433 - gknown - = -R–©iÚ -:: -True -( -Ï¡_Ëv– -); - -435 - gknown - = -Ex‹nd_S‘ -( -known -, -Ï¡_Ëv– --known. -n_£t -()); - -436  - gi - = 1; i <ð -Ï¡_Ëv– -; i++) - -437 - gknown -. -Çme_£t_v¬ -( -i -, -¡d -:: -¡ršg -("t")+ -to_¡ršg -(i)); - -438 - gknown -. -£tup_Çmes -(); - -441 - g´ojeùed_nIS -. -þ—r -(); - -442 - g´ojeùed_nIS -. -»®loÿ‹ -( -Ï¡_Ëv– -); - -443  - gi - = 1; i <ð -Ï¡_Ëv– -; i++ ) { - -444 - g´ojeùed_nIS -[ -i -]. -»®loÿ‹ -( -¡mts -); - -446  - g¡mt - = 1; stmˆ<ð -¡mts -; stmt++) { - -447 ià( - gÏ¡_Ëv– - > 0) - -448 - g´ojeùed_nIS -[ -Ï¡_Ëv– -][ -¡mt -] = -Ãw_IS -[stmt]; - -449  - gi - = -Ï¡_Ëv– --1; i >= 1; i--) { - -450 - g´ojeùed_nIS -[ -i -][ -¡mt -] = -Projeù -( -cÝy -( -´ojeùed_nIS -[i+1][¡mt]), i+1, -S‘_V¬ -); - -451 - g´ojeùed_nIS -[ -i -][ -¡mt -]. -sim¶ify -(); - -456 -IÁTu¶e - -®lStmts -( -¡mts -); - -457  - gi - = 1; i <ð -¡mts -; i++) - -458 - g®lStmts -[ -i -] = 1; - -459 -CG_»suÉ - * - gcg - = -g’_»cursive -(1, -®lStmts -); - -462 - gcg - = -cg --> -»compu‹ -( -known -, known); - -463 - gcg - = -cg --> -fÜû_fš™e_bounds -(); - -466  - gi - = 1; i <ð -mš -( -effÜt -, -cg --> -d•th -()); i++) - -467 - gcg - = -cg --> -liáOv”h—d -( -i -); - -470 - gcg --> -hoi¡Gu¬d -(); - -474 -CG_ouutR•r -* - gsR•r - = -cg --> -´štR•r -( -ocg -, 1, -¡d -:: -veùÜ -( -Ï¡_Ëv– - )); - -475 -d–‘e - - gcg -; - -476 - gcg - = -NULL -; - -477 - g´ojeùed_nIS -. -þ—r -(); - -478 - gŒªsfÜm©iÚs -. -þ—r -(); - -479 - gÃw_IS -. -þ—r -(); - -481  - gsR•r -; - -484 -CG_»suÉ - * - $g’_»cursive -( -Ëv– -, -IÁTu¶e - & -isAùive -) { - -485  -¡mts - = -isAùive -. - `size -(); - -487 -S‘ -<> -aùive -; - -488  -s -; - -489  -s - = 1; s <ð -¡mts -; s++) - -490 if( -isAùive -[ -s -]è -aùive -. - `š£¹ -(s); - -492 - `as£¹ - ( -aùive -. - `size -() >= 1); - -493 if( -Ëv– - > -Ï¡_Ëv– -è -Ãw - - `CG_Ëaf -( -isAùive -); - -495 ià( -aùive -. - `size -() == 1) - -496  -Ãw - - `CG_loÝ -( -isAùive -, -Ëv– -, - `g’_»cursive -(level+1,isActive)); - -498 -boÞ - -cÚ¡ªtLev– - = -Œue -; - -500  -‹¡_»l_size -; - -501 -cÛf_t - -¡¬t -, -fšish -; - -502 -fšish - = -( -posInfš™y --1); - -503 -¡¬t - = -posInfš™y -; - -504 -Tu¶e -< -cÛf_t -> - `wh’ -( -¡mts -); - -505  -s -=1; s<= -¡mts -; s++èià( -isAùive -[s]) { - -506 -cÛf_t - -lb -, -ub -; - -507 -‹¡_»l_size - = -´ojeùed_nIS -[ -Ëv– -][ -s -]. - `n_£t -(); - -508 -´ojeùed_nIS -[ -Ëv– -][ -s -]. - `sšgË_cÚjunù -() - -509 -> - `qu”y_v¬ŸbË_bounds -( - -510 -´ojeùed_nIS -[ -Ëv– -][ -s -]. - `£t_v¬ -(level), - -511 -lb -, -ub -); - -512 if( -code_g’_debug -) { - -513 - `årštf -( -DebugFže -, "IS%d: " -cÛf_fmt - " <ðt%d <ð" cÛf_fmˆ"\n", -s -, - -514 -lb -, -Ëv– -, -ub -); - -515 -´ojeùed_nIS -[ -Ëv– -][ -s -]. - `´efix_´št -( -DebugFže -); - -517 ià( -lb - !ð -ub -) { - -518 -cÚ¡ªtLev– - = -çl£ -; - -522 - `£t_max -( -fšish -, -lb -); - -523 - `£t_mš -( -¡¬t -, -lb -); - -524 -wh’ -[ -s -] = -lb -; - -529 ià( -cÚ¡ªtLev– - && -fšish -- -¡¬t - <ð -¡mts -) { - -530 -IÁTu¶e - - `ÃwAùive -( -isAùive -. - `size -()); - -531  -i -=1; i<= -¡mts -; i++) - -532 -ÃwAùive -[ -i -] = -isAùive -[i] && -wh’ -[i] =ð -¡¬t -; - -533 -CG_»suÉ - * -r - = -Ãw - - `CG_loÝ -( -isAùive -, -Ëv– -, - -534 - `g’_»cursive -( -Ëv– -+1, -ÃwAùive -)); - -535  -cÛf_t - -time - = -¡¬t -+1;im<ð -fšish -;ime++) { - -536  -couÁ - = 0; - -537  -i -=1; i<= -¡mts -; i++) { - -538 -ÃwAùive -[ -i -] = -isAùive -[i] && -wh’ -[i] =ð -time -; - -539 ià( -ÃwAùive -[ -i -]è -couÁ -++; - -541 ià( -couÁ -) { - -542 -R–©iÚ - - `‹¡_»l -( -‹¡_»l_size -); - -543 -GEQ_HªdË - -g - = -‹¡_»l -. - `ªd_w™h_GEQ -(); - -544 -g -. - `upd©e_cÛf -( -‹¡_»l -. - `£t_v¬ -( -Ëv– -),-1); - -545 -g -. - `upd©e_cÚ¡ -( -time --1); - -547 -r - = -Ãw - - `CG_¥l™ -( -isAùive -, -Ëv– -, -‹¡_»l -,r, - -548 -Ãw - - `CG_loÝ -( -isAùive -, -Ëv– -, - -549 - `g’_»cursive -( -Ëv– -+1, -ÃwAùive -))); - -552  -r -; - -560 -R–©iÚ - -huÎ - = - `HuÎ -( -´ojeùed_nIS -[ -Ëv– -], -isAùive -,1); - -562 -R–©iÚ - -huÎ - = - `HuÎ -( -´ojeùed_nIS -[ -Ëv– -], -isAùive -,0); - -565 if( -code_g’_debug -) { - -566 - `årštf -( -DebugFže -, "HuÎ (Ëv– %dèis:\n", -Ëv– -); - -567 -huÎ -. - `´efix_´št -( -DebugFže -); - -571 -IÁTu¶e - - `fœ¡Chunk -( -isAùive -); - -572 -IÁTu¶e - - `£cÚdChunk -( -isAùive -); - -579 -boÞ - -checkFÜS¶™s - = -Œue -; - -580  -s - = 1; s <ð -isAùive -. - `size -(); s++){ - -581 ià( -isAùive -[ -s -]) { - -582 if( -s - < -smtNÚS¶™Lev–s -. - `size -(è&& smtNÚS¶™Lev–s[s]. - `šdex -( -Ëv– --2) != 0){ - -583 -checkFÜS¶™s - = -çl£ -; - -590  -s - = 1; -checkFÜS¶™s - && s <ð -isAùive -. - `size -(); s++) - -591 ià( -isAùive -[ -s -]) { - -592 -R–©iÚ - -gi¡ - = - `Gi¡ -( - `cÝy -( -´ojeùed_nIS -[ -Ëv– -][ -s -]),cÝy( -huÎ -),1); - -593 ià( -gi¡ -. - `is_obvious_utÞogy -()) ; - -594 -gi¡ -. - `sim¶ify -(); - -595 -CÚjunù - * -s_cÚj - = -gi¡ -. - `sšgË_cÚjunù -(); - -596  -GEQ_I‹¿tÜ - - `G -( -s_cÚj -); -G -; G++) { - -597 -R–©iÚ - - `‹¡_»l -( -gi¡ -. - `n_£t -()); - -598 -‹¡_»l -. - `ªd_w™h_GEQ -(* -G -); - -599 -V¬ŸbË_ID - -v - = - `£t_v¬ -( -Ëv– -); - -600 -cÛf_t - -sign - = (* -G -). - `g‘_cÛf -( -v -); - -601 if( -sign - > 0è -‹¡_»l - = - `Com¶em’t -(test_rel); - -602 if( -code_g’_debug -) { - -603 - `årštf -( -DebugFže -, "CÚsid”šg s¶™ from stmˆ%d:\n", -s -); - -604 -‹¡_»l -. - `´efix_´št -( -DebugFže -); - -607 -fœ¡Chunk -[ -s -] = -sign - <= 0; - -608 -£cÚdChunk -[ -s -] = -sign - > 0; - -609  -numb”Fœ¡ - = -sign - <= 0; - -610  -numb”SecÚd - = -sign - > 0; - -612  -s2 - = 1; s2 <ð -isAùive -. - `size -(); s2++) - -613 ià( -isAùive -[ -s2 -] && s2 !ð -s -) { - -614 if( -code_g’_debug -) - -615 - `årštf -( -DebugFže -,"CÚsid” stmˆ%d\n", -s2 -); - -616 -boÞ - -t - = - `IÁ”£ùiÚ -( - `cÝy -( -´ojeùed_nIS -[ -Ëv– -][ -s2 -]), - -617 - `cÝy -( -‹¡_»l -)). - `is_uµ”_bound_§tisfŸbË -(); - -618 -boÞ - -f - = - `Difã»nû -( - `cÝy -( -´ojeùed_nIS -[ -Ëv– -][ -s2 -]), - -619 - `cÝy -( -‹¡_»l -)). - `is_uµ”_bound_§tisfŸbË -(); - -620 - `as£¹ -( -t - || -f -); - -621 if( -code_g’_debug - && -t -&& -f -) - -622 - `årštf -( -DebugFže -, "SÏshe ¡mˆ%d\n", -s2 -); - -623 ià( -t -&& -f -è -ÃxtGEQ -; - -624 if( -code_g’_debug -) { - -625 ià( -t -) - -626 - `årštf -( -DebugFže -, "ŒufÜ stmˆ%d\n", -s2 -); - -628 - `årštf -( -DebugFže -, "çl£ fÜ stmˆ%d\n", -s2 -); - -630 ià( -t -è -numb”Fœ¡ -++; - -631 -numb”SecÚd -++; - -632 -fœ¡Chunk -[ -s2 -] = -t -; - -633 -£cÚdChunk -[ -s2 -] = ! -t -; - -636 - `as£¹ -( -numb”Fœ¡ -+ -numb”SecÚd ->1 && "Can't handle wildcard in iteration space"); - -637 if( -code_g’_debug -) - -638 - `årštf -( -DebugFže -, "%drue, %d false\n", - -639 -numb”Fœ¡ -, - -640 -numb”SecÚd -); - -641 ià( -numb”Fœ¡ - && -numb”SecÚd -) { - -643  -Ãw - - `CG_¥l™ -( -isAùive -, -Ëv– -, -‹¡_»l -, - -644 - `g’_»cursive -( -Ëv– -, -fœ¡Chunk -), - -645 - `g’_»cursive -( -Ëv– -, -£cÚdChunk -)); - -647 -ÃxtGEQ -: ; - -653  -Ãw - - `CG_loÝ -( -isAùive -, -Ëv– -, - `g’_»cursive -(level+1,isActive)); - -654 - } -} - - @output_repr.cc - -16  - ~ - -17  - ~ - -18  - ~ - -19  - ~ - -20  - ~ - -21  - ~<¡ack -> - -22  - ~ - -24 -Çme¥aû - - gomega - { - -26 -Tu¶e - > -´ojeùed_nIS -; - -27  - gv¬_sub¡™utiÚ_th»shÞd - = 100; - -29  -uµ”BoundFÜLev– -; - -30  -low”BoundFÜLev– -; - -31 -boÞ - -fžlInBounds -; - -37 -Çme¥aû - - gomega - { - -39 - g¡d -:: -·œ -< -EQ_HªdË -, > -fšd_sim¶e¡_assignm’t -(cÚ¡ -R–©iÚ - & -R_ -, -V¬ŸbË_ID - -v -, cÚ¡ -¡d -:: -veùÜ -< -CG_ouutR•r - *> & -assigÃd_Ú_the_æy -); - -42 - gÇme¥aû - { - -47  -g‘_¡ride -(cÚ¡ -CÚ¡¿št_HªdË - & -h -, -V¬ŸbË_ID - & -wc -, -cÛf_t - & -¡• -){ - -48 - gwc - = 0; - -49  -CÚ¡r_V¬s_I‹r - -i -( -h -, -Œue -); - gi -; i++) { - -50 -as£¹ -( -wc - == 0); - -51 - gwc - = (* -i -). -v¬ -; - -52 - g¡• - = ((* -i -). -cÛf -); - -58 -CG_ouutR•r -* -ouutId’t -( -CG_ouutBužd” -* -ocg -, cÚ¡ -R–©iÚ - & -R_ -, -V¬ŸbË_ID - -v -, cÚ¡ -¡d -:: -veùÜ - & -assigÃd_Ú_the_æy -) { - -59 -R–©iÚ - & -R - = -cÚ¡_ÿ¡ -( -R_ -); - -61  - gv --> -kšd -()) { - -62  - gS‘_V¬ -: { - -63  -pos - = -v --> -g‘_pos™iÚ -(); - -64 ià( - gassigÃd_Ú_the_æy -[ -pos --1] !ð -NULL -) - -65  -assigÃd_Ú_the_æy -[ -pos --1]-> -þÚe -(); - -67  - gocg --> -C»©eId’t -( -v --> -Çme -()); - -70  - gGlob®_V¬ -: { - -71 ià( -v --> -g‘_glob®_v¬ -()-> -¬™y -() == 0) - -72  -ocg --> -C»©eId’t -( -v --> -Çme -()); - -76  - g¬™y - = -v --> -g‘_glob®_v¬ -()-> -¬™y -(); - -78 - gTu¶e -< - gCG_ouutR•r - *> - g¬gLi¡ -; - -82  - gi - = 1; i <ð -¬™y -; i++) - -83 - g¬gLi¡ -. -­³nd -( -ocg --> -C»©eId’t -( -R -. -£t_v¬ -( -i -)-> -Çme -())); - -84 -CG_ouutR•r - * - gÿÎ - = -ocg --> -C»©eInvoke -( -v --> -g‘_glob®_v¬ -()-> -ba£_Çme -(), -¬gLi¡ -); - -85  - gÿÎ -; - -90 -throw - -¡d -:: -šv®id_¬gum’t -("wrong variableype"); - -101 - g¡d -:: -·œ -< -CG_ouutR•r - *, - gboÞ -> -ouutAssignm’t -( -CG_ouutBužd” - * -ocg -, cÚ¡ -R–©iÚ - & -R_ -, -V¬ŸbË_ID - -v -, R–©iÚ & -’fÜûd -, CG_ouutR•¸*& -if_»´ -, cÚ¡ -¡d -:: -veùÜ - & -assigÃd_Ú_the_æy -) { - -102 -R–©iÚ - & -R - = -cÚ¡_ÿ¡ -( -R_ -); - -104 -CÚjunù - * - gc - = -R -. -qu”y_DNF -()-> -sšgË_cÚjunù -(); - -107  -EQ_I‹¿tÜ - -ei -( -c -); - gei -;ƒi++) - -108 ià(!(* - gei -). -has_wždÿrds -(è&& -abs -((* -ei -). -g‘_cÛf -( -v -)) > 1) { - -109 -R–©iÚ - -r -( -R -. -n_£t -()); - -110 -F_And - * - gf_su³r_roÙ - = -r -. -add_ªd -(); - -111 -F_Exi¡s - * - gã - = -f_su³r_roÙ --> -add_exi¡s -(); - -112 -V¬ŸbË_ID - - ge - = -ã --> -deþ¬e -(); - -113 -F_And - * - gf_roÙ - = -ã --> -add_ªd -(); - -114 -EQ_HªdË - - gh - = -f_roÙ --> -add_EQ -(); - -115  -CÚ¡r_V¬s_I‹r - -cvi -(* -ei -); - gcvi -; cvi++) - -116 (* - gcvi -). - gv¬ --> -kšd -()) { - -117  - gIÅut_V¬ -: { - -118 ià((* -cvi -). -v¬ - =ð -v -) - -119 -h -. -upd©e_cÛf -( -e -, (* -cvi -). -cÛf -); - -121 - gh -. -upd©e_cÛf -( -r -. -£t_v¬ -((* -cvi -). -v¬ --> -g‘_pos™iÚ -()), (*cvi). -cÛf -); - -124  - gGlob®_V¬ -: { - -125 -Glob®_V¬_ID - -g - = (* -cvi -). -v¬ --> -g‘_glob®_v¬ -(); - -126 -V¬ŸbË_ID - - gv2 -; - -127 ià( - gg --> -¬™y -() == 0) - -128 -v2 - = -r -. -g‘_loÿl -( -g -); - -130 - gv2 - = -r -. -g‘_loÿl -( -g -, (* -cvi -). -v¬ --> -funùiÚ_of -()); - -131 - gh -. -upd©e_cÛf -( -v2 -, (* -cvi -). -cÛf -); - -135 -as£¹ -(0); - -137 - gh -. -upd©e_cÚ¡ -((* -ei -). -g‘_cÚ¡ -()); - -139 - gr -. -cÝy_Çmes -( -R -); - -140 - gr -. -£tup_Çmes -(); - -143 ià(! -Gi¡ -( -r -, -cÝy -( -’fÜûd -), 1). -is_obvious_utÞogy -()) { - -144 -cÛf_t - - gcÛf - = (* -ei -). -g‘_cÛf -( -v -); - -145 -cÛf_t - - gsign - = -(( -cÛf ->0)?1:-1); - -146 - gcÛf - = -abs -( -cÛf -); - -148 -CG_ouutR•r - * - g‹rm - = -NULL -; - -149  -CÚ¡r_V¬s_I‹r - -cvi -(* -ei -); - gcvi -; cvi++) - -150 ià((* - gcvi -). - gv¬ - !ð -v -) { - -151 -CG_ouutR•r - * -v¬R•r - = -ouutId’t -( -ocg -, -R -, (* -cvi -). -v¬ -, -assigÃd_Ú_the_æy -); - -152 -cÛf_t - - gt - = -sign -*(* -cvi -). -cÛf -; - -153 ià( - gt - == 1) - -154 -‹rm - = -ocg --> -C»©ePlus -Ñ”m, -v¬R•r -); - -155 ià( - gt - == -1) - -156 -‹rm - = -ocg --> -C»©eMšus -Ñ”m, -v¬R•r -); - -157 ià( - gt - > 0) - -158 - g‹rm - = -ocg --> -C»©ePlus -( -‹rm -, ocg-> -C»©eTimes -(ocg-> -C»©eIÁ -( -t -), -v¬R•r -)); - -159 ià( - gt - < 0) - -160 - g‹rm - = -ocg --> -C»©eMšus -( -‹rm -, ocg-> -C»©eTimes -(ocg-> -C»©eIÁ -(- -t -), -v¬R•r -)); - -162 -cÛf_t - - gt - = -sign -*(* -ei -). -g‘_cÚ¡ -(); - -163 ià( - gt - > 0) - -164 - g‹rm - = -ocg --> -C»©ePlus -( -‹rm -, ocg-> -C»©eIÁ -( -t -)); - -165 ià( - gt - < 0) - -166 - g‹rm - = -ocg --> -C»©eMšus -( -‹rm -, ocg-> -C»©eIÁ -(- -t -)); - -168 - g‹rm - = -ocg --> -C»©eIÁeg”Mod -( -‹rm -, ocg-> -C»©eIÁ -( -cÛf -)); - -169 - g‹rm - = -ocg --> -C»©eEQ -( -‹rm -, ocg-> -C»©eIÁ -(0)); - -171 - gif_»´ - = -ocg --> -C»©eAnd -( -if_»´ -, -‹rm -); - -174 - g’fÜûd -. -ªd_w™h_EQ -(* -ei -); - -175 - g’fÜûd -. -sim¶ify -(); - -179 - g¡d -:: -·œ -< -EQ_HªdË -, > - ga - = -fšd_sim¶e¡_assignm’t -( -R -, -v -, -assigÃd_Ú_the_æy -); - -182 ià( - ga -. - g£cÚd - < - gINT_MAX -) { - -183 -EQ_HªdË - - geq - = -a -. -fœ¡ -; - -184 -CG_ouutR•r - * - grÝ_»´ - = -NULL -; - -186 -cÛf_t - - gdivid” - = -eq -. -g‘_cÛf -( -v -); - -187  - gsign - = 1; - -188 ià( - gdivid” - < 0) { - -189 - gdivid” - = - -divid” -; - -190 - gsign - = -1; - -193  -CÚ¡r_V¬s_I‹r - -cvi -( -eq -); - gcvi -; cvi++) - -194 ià((* - gcvi -). - gv¬ - !ð -v -) { - -195 -CG_ouutR•r - * -v¬_»´ - = -ouutId’t -( -ocg -, -R -, (* -cvi -). -v¬ -, -assigÃd_Ú_the_æy -); - -196 -cÛf_t - - gcÛf - = (* -cvi -). -cÛf -; - -197 ià(- -sign - * - gcÛf - == -1) - -198 -rÝ_»´ - = -ocg --> -C»©eMšus -ÔÝ_»´, -v¬_»´ -); - -199 ià(- -sign - * - gcÛf - < -1) - -200 - grÝ_»´ - = -ocg --> -C»©eMšus -( -rÝ_»´ -, ocg-> -C»©eTimes -(ocg-> -C»©eIÁ -( -sign - * -cÛf -), -v¬_»´ -)); - -201 ià(- -sign - * - gcÛf - == 1) - -202 -rÝ_»´ - = -ocg --> -C»©ePlus -ÔÝ_»´, -v¬_»´ -); - -204 - grÝ_»´ - = -ocg --> -C»©ePlus -( -rÝ_»´ -, ocg-> -C»©eTimes -(ocg-> -C»©eIÁ -(- -sign - * -cÛf -), -v¬_»´ -)); - -207 -cÛf_t - - gc_‹rm - = -( -eq -. -g‘_cÚ¡ -(è* -sign -); - -209 ià( - gc_‹rm - > 0) - -210 - grÝ_»´ - = -ocg --> -C»©ePlus -( -rÝ_»´ -, ocg-> -C»©eIÁ -( -c_‹rm -)); - -211 ià( - gc_‹rm - < 0) - -212 - grÝ_»´ - = -ocg --> -C»©eMšus -( -rÝ_»´ -, ocg-> -C»©eIÁ -(- -c_‹rm -)); - -213 ià( - grÝ_»´ - =ð -NULL -) - -214 -rÝ_»´ - = -ocg --> -C»©eIÁ -(0); - -216 ià( - gdivid” - != 1) - -217 -rÝ_»´ - = -ocg --> -C»©eIÁeg”Divide -ÔÝ_»´, ocg-> -C»©eIÁ -( -divid” -)); - -219 - g’fÜûd -. -ªd_w™h_EQ -( -eq -); - -220 - g’fÜûd -. -sim¶ify -(); - -222 ià( - ga -. - g£cÚd - > - gv¬_sub¡™utiÚ_th»shÞd -) - -223  - g¡d -:: -make_·œ -( -rÝ_»´ -, -Œue -); - -225  - g¡d -:: -make_·œ -( -rÝ_»´ -, -çl£ -); - -228  - g¡d -:: -make_·œ -( -¡©ic_ÿ¡ -< -CG_ouutR•r - *>( -NULL -), -çl£ -); - -237 - gTu¶e -< - gCG_ouutR•r -*> -ouutSub¡™utiÚ -( -CG_ouutBužd” -* -ocg -, cÚ¡ -R–©iÚ - & -R_ -, cÚ¡ -¡d -:: -veùÜ -< -CG_ouutR•r - *> & -assigÃd_Ú_the_æy -) { - -238 -R–©iÚ - & -R - = -cÚ¡_ÿ¡ -( -R_ -); - -240 cÚ¡  - gn - = -R -. -n_out -(); - -241 - gTu¶e -< - gCG_ouutR•r -*> - goR•rLi¡ -; - -244  - gi - = 1; i <ð -n -; i++) { - -245 -R–©iÚ - -m­pšg -( -n -, 1); - -246 -F_And - * - gf_roÙ - = -m­pšg -. -add_ªd -(); - -247 -EQ_HªdË - - gh - = -f_roÙ --> -add_EQ -(); - -248 - gh -. -upd©e_cÛf -( -m­pšg -. -ouut_v¬ -(1), 1); - -249 - gh -. -upd©e_cÛf -( -m­pšg -. -šput_v¬ -( -i -), -1); - -251 -R–©iÚ - - gS - = -Compos™iÚ -( -m­pšg -, -cÝy -( -R -)); - -253 - g¡d -:: -·œ -< -EQ_HªdË -, > - ga - = -fšd_sim¶e¡_assignm’t -( -S -, S. -ouut_v¬ -(1), -assigÃd_Ú_the_æy -); - -255 ià( - ga -. - g£cÚd - < - gINT_MAX -) { - -256  - ga -. - g£cÚd - > 0) { - -257 -EQ_HªdË - - geq - = -a -. -fœ¡ -; - -258 - g¡d -:: -£t -<> -ÿndid©es -; - -259  -CÚ¡r_V¬s_I‹r - -cvi -( -eq -); - gcvi -; cvi++) - -260 ià((* - gcvi -). - gv¬ --> -kšd -(è=ð -IÅut_V¬ -) - -261 -ÿndid©es -. -š£¹ -((* -cvi -). -v¬ --> -g‘_pos™iÚ -()); - -263 -boÞ - - gchªged - = -çl£ -; - -264  - g¡d -:: -£t -<>:: -™”©Ü - -j - = -ÿndid©es -. -begš -(); - gj - !ðÿndid©es. -’d -(); j++) { - -265 -R–©iÚ - - gS2 - = -Projeù -( -cÝy -( -S -), * -j -, -IÅut_V¬ -); - -266 - g¡d -:: -·œ -< -EQ_HªdË -, > - ga2 - = -fšd_sim¶e¡_assignm’t -( -S2 -, S2. -ouut_v¬ -(1), -assigÃd_Ú_the_æy -); - -267 ià( - ga2 -. - g£cÚd - <ð -a -. -£cÚd -) { - -268 -S - = -S2 -; - -269 - ga - = -a2 -; - -270 - gchªged - = -Œue -; - -274 ià(! - gchªged -) - -279 ià( - ga -. - g£cÚd - < - gINT_MAX -) { - -280 -CG_ouutR•r - * - g»´ - = -NULL -; - -281 -EQ_HªdË - - geq - = -a -. -fœ¡ -; - -282 -V¬ŸbË_ID - - gv - = -S -. -ouut_v¬ -(1); - -284  - gj - = 1; j <ð -S -. -n_šp -(); j++) - -285 - gS -. -Çme_šput_v¬ -( -j -, -R -. -šput_v¬ -(j)-> -Çme -()); - -286 - gS -. -£tup_Çmes -(); - -288  - gd - = -eq -. -g‘_cÛf -( -v -); - -289 -as£¹ -( -d - != 0); - -290  - gsign - = ( -d ->0)?-1:1; - -291 - gd - = - -sign - * -d -; - -292  -CÚ¡r_V¬s_I‹r - -cvi -( -eq -); - gcvi -; cvi++) - -293 ià((* - gcvi -). - gv¬ - !ð -v -) { - -294  -cÛf - = -sign - * (* -cvi -).coef; - -295 -CG_ouutR•r - * - gÝ - = -ouutId’t -( -ocg -, -S -, (* -cvi -). -v¬ -, -assigÃd_Ú_the_æy -); - -296 ià( - gcÛf - > 1) - -297 - gÝ - = -ocg --> -C»©eTimes -(ocg-> -C»©eIÁ -( -cÛf -), -Ý -); - -298 ià( - gcÛf - < -1) - -299 - gÝ - = -ocg --> -C»©eTimes -(ocg-> -C»©eIÁ -(- -cÛf -), -Ý -); - -300 ià( - gcÛf - > 0) - -301 - g»´ - = -ocg --> -C»©ePlus -( -»´ -, -Ý -); - -302 ià( - gcÛf - < 0) - -303 - g»´ - = -ocg --> -C»©eMšus -( -»´ -, -Ý -); - -306  - gc - = -sign - * -eq -. -g‘_cÚ¡ -(); - -307 ià( - gc - > 0) - -308 - g»´ - = -ocg --> -C»©ePlus -( -»´ -, ocg-> -C»©eIÁ -( -c -)); - -309 ià( - gc - < 0) - -310 - g»´ - = -ocg --> -C»©eMšus -( -»´ -, ocg-> -C»©eIÁ -(- -c -)); - -311 ià( - g»´ - =ð -NULL -) - -312 -»´ - = -ocg --> -C»©eIÁ -(0); - -314 ià( - gd - != 1) - -315 -»´ - = -ocg --> -C»©eIÁeg”Divide -Ô•r, ocg-> -C»©eIÁ -( -d -)); - -317 - goR•rLi¡ -. -­³nd -( -»´ -); - -320 - goR•rLi¡ -. -­³nd -( -NULL -); - -323  - goR•rLi¡ -; - -326 - gÇme¥aû - { - -328 -R–©iÚ - -ü—‹_¡ride_Ú_bound -( -n -, cÚ¡ -¡d -:: -m­ -< -V¬ŸbË_ID -, -cÛf_t -> & -lb -, cÛf_ˆ -¡ride -) { - -329 -R–©iÚ - -»suÉ -( -n -); - -330 -F_And - * - gf_roÙ - = -»suÉ -. -add_ªd -(); - -331 -EQ_HªdË - - gh - = -f_roÙ --> -add_¡ride -( -¡ride -); - -333  - g¡d -:: -m­ -< -V¬ŸbË_ID -, - gcÛf_t ->:: -cÚ¡_™”©Ü - -i - = -lb -. -begš -(); - gi - !ðlb. -’d -(); i++) { - -334 ià( - gi --> - gfœ¡ - =ð -NULL -) - -335 -h -. -upd©e_cÚ¡ -( -i --> -£cÚd -); - -337  - gi --> - gfœ¡ --> -kšd -()) { - -338  - gIÅut_V¬ -: { - -339  -pos - = -i --> -fœ¡ --> -g‘_pos™iÚ -(); - -340 - gh -. -upd©e_cÛf -( -»suÉ -. -£t_v¬ -( -pos -), -i --> -£cÚd -); - -343  - gGlob®_V¬ -: { - -344 -Glob®_V¬_ID - -g - = -i --> -fœ¡ --> -g‘_glob®_v¬ -(); - -345 -V¬ŸbË_ID - - gv -; - -346 ià( - gg --> -¬™y -() == 0) - -347 -v - = -»suÉ -. -g‘_loÿl -( -g -); - -349 - gv - = -»suÉ -. -g‘_loÿl -( -g -, -i --> -fœ¡ --> -funùiÚ_of -()); - -350 - gh -. -upd©e_cÛf -( -v -, -i --> -£cÚd -); - -354 -as£¹ -(0); - -359  - g»suÉ -; - -368 -R–©iÚ - -g»©e¡_commÚ_¡• -(cÚ¡ -Tu¶e - & -I -, cÚ¡ Tu¶e<> & -aùive -,  -Ëv– -, cÚ¡ R–©iÚ & -known -) { - -369 -as£¹ -( -I -. -size -(è=ð -aùive -.size()); - -370  - gn - = 0; - -372 - g¡d -:: -veùÜ -< -R–©iÚ -> -I1 -, - gI2 -; - -373  - gi - = 1; i <ð -I -. -size -(); i++) - -374 ià( - gaùive -[ -i -]) { - -375 ià( - gn - == 0) - -376 -n - = -I -[ -i -]. -n_£t -(); - -378 -R–©iÚ - - gr1 -; - -379 ià( - gknown -. -is_nuÎ -()) - -380 - gr1 - = -cÝy -( -I -[ -i -]); - -382 - gr1 - = -IÁ”£ùiÚ -( -cÝy -( -I -[ -i -]), cÝy( -known -)); - -383 - gr1 -. -sim¶ify -(); - -385 - gI1 -. -push_back -( -r1 -); - -386 -R–©iÚ - - gr2 - = -Gi¡ -( -cÝy -( -I -[ -i -]), cÝy( -known -)); - -387 -as£¹ -( -r2 -. -is_uµ”_bound_§tisfŸbË -()); - -388 ià( - gr2 -. -is_obvious_utÞogy -()) - -389  - gR–©iÚ -:: -True -( -n -); - -390 - gI2 -. -push_back -( -r2 -); - -393 - g¡d -:: -veùÜ -< -boÞ -> -is_exaù -( -I2 -. -size -(), -Œue -); - -394 - g¡d -:: -veùÜ -< -cÛf_t -> -¡• -( -I2 -. -size -(), 0); - -395 - g¡d -:: -veùÜ -< -cÛf_t -> -messy_¡• -( -I2 -. -size -(), 0); - -396 -V¬ŸbË_ID - - gt_cÞ - = -£t_v¬ -( -Ëv– -); - -397 - g¡d -:: -m­ -< -V¬ŸbË_ID -, - gcÛf_t -> - glb -; - -400  -size_t - - gi - = 0; i < - gI2 -. -size -(); i++) { - -401 -CÚjunù - * - gc - = -I2 -[ -i -]. -qu”y_DNF -()-> -sšgË_cÚjunù -(); - -403 -boÞ - - gis_deg’”©ed - = -çl£ -; - -404  -EQ_I‹¿tÜ - - ge - = -c --> -EQs -();ƒ;ƒ++) { - -405 -cÛf_t - - gcÛf - = -abs -((* -e -). -g‘_cÛf -( -t_cÞ -)); - -406 ià( - gcÛf - !ð0 && !(* -e -). -has_wždÿrds -()) { - -407 -is_deg’”©ed - = -Œue -; - -411 ià( - gis_deg’”©ed -) - -414  -EQ_I‹¿tÜ - - ge - = -c --> -EQs -();ƒ;ƒ++) { - -415 ià((* - ge -). -has_wždÿrds -()) { - -416 -cÛf_t - - gcÛf - = -abs -((* -e -). -g‘_cÛf -( -t_cÞ -)); - -417 ià( - gcÛf - == 0) - -419 ià( - gcÛf - != 1) { - -420 -is_exaù -[ -i -] = -çl£ -; - -424 -cÛf_t - - gthis_¡• - = -abs -( -CÚ¡r_V¬s_I‹r -(* -e -, -Œue -). -cu¼_cÛf -()); - -425 -as£¹ -( -this_¡• - != 1); - -427 ià( - glb -. -size -() != 0) { - -428 -R–©iÚ - -‹¡ - = -ü—‹_¡ride_Ú_bound -( -n -, -lb -, -this_¡• -); - -429 ià( -Gi¡ -( -‹¡ -, -cÝy -( -I1 -[ -i -])). -is_obvious_utÞogy -()) { - -430 ià( - g¡• -[ -i -] == 0) - -431 -¡• -[ -i -] = -this_¡• -; - -433 - g¡• -[ -i -] = -lcm -( -¡• -[i], -this_¡• -); - -436 - gis_exaù -[ -i -] = -çl£ -; - -440 -CÚjunù - * - gc - = -I2 -[ -i -]. -qu”y_DNF -()-> -sšgË_cÚjunù -(); - -441  -GEQ_I‹¿tÜ - - gge - = -c --> -GEQs -(); ge; ge++) { - -442 ià((* - gge -). -has_wždÿrds -(è|| (*ge). -g‘_cÛf -( -t_cÞ -) != 1) - -445 - g¡d -:: -m­ -< -V¬ŸbË_ID -, - gcÛf_t -> - gcur_lb -; - -446  -CÚ¡r_V¬s_I‹r - -cv -(* -ge -); - gcv -; cv++) - -447 - gcur_lb -[ -cv -. -cu¼_v¬ -()] = cv. -cu¼_cÛf -(); - -448 - gcur_lb -[ -NULL -] = (* -ge -). -g‘_cÚ¡ -(); - -450 -R–©iÚ - - g‹¡ - = -ü—‹_¡ride_Ú_bound -( -n -, -cur_lb -, -this_¡• -); - -451 ià( -Gi¡ -( -‹¡ -, -cÝy -( -I1 -[ -i -])). -is_obvious_utÞogy -()) { - -452 ià( - g¡• -[ -i -] == 0) - -453 -¡• -[ -i -] = -this_¡• -; - -455 - g¡• -[ -i -] = -lcm -( -¡• -[i], -this_¡• -); - -457 - glb - = -cur_lb -; - -463 ià( - glb -. -size -() == 0) { - -464 -¡d -:: -m­ -< -V¬ŸbË_ID -, -cÛf_t -> -cur_lb -; - -465  - gwžd_couÁ - = 0; - -466  -CÚ¡r_V¬s_I‹r - -cv -(* -e -); - gcv -; cv++) - -467 ià( - gcv -. -cu¼_v¬ -()-> -kšd -(è=ð -Wždÿrd_V¬ -) - -468 -wžd_couÁ -++; - -470 - gcur_lb -[ -cv -. -cu¼_v¬ -()] = cv. -cu¼_cÛf -(); - -471 - gcur_lb -[ -NULL -] = (* -e -). -g‘_cÚ¡ -(); - -473 ià( - gwžd_couÁ - == 1) { - -474 -lb - = -cur_lb -; - -475 ià( - g¡• -[ -i -] == 0) - -476 -¡• -[ -i -] = -this_¡• -; - -478 - g¡• -[ -i -] = -lcm -( -¡• -[i], -this_¡• -); - -482 ià( - glb -. -size -() == 0) - -483 -is_exaù -[ -i -] = -çl£ -; - -490 -cÛf_t - - gglob®_¡• - = 0; - -491  -size_t - - gi - = 0; i < - gis_exaù -. -size -(); i++) - -492 ià( - gis_exaù -[ -i -]) - -493 - gglob®_¡• - = -gcd -( -glob®_¡• -, -¡• -[ -i -]); - -494 ià( - gglob®_¡• - == 1) - -495  -R–©iÚ -:: -True -( -n -); - -498  -size_t - - gi - = 0; i < - gI2 -. -size -(); i++) - -499 ià(! - gis_exaù -[ -i -]) { - -500 -CÚjunù - * - gc - = -I2 -[ -i -]. -qu”y_DNF -()-> -sšgË_cÚjunù -(); - -501  -EQ_I‹¿tÜ - - ge - = -c --> -EQs -();ƒ;ƒ++) { - -502 -cÛf_t - - gcÛf - = -abs -((* -e -). -g‘_cÛf -( -t_cÞ -)); - -503 ià( - gcÛf - =ð0 || -cÛf - == 1) - -507 -cÛf_t - - gthis_¡• - = -abs -( -CÚ¡r_V¬s_I‹r -(* -e -, -Œue -). -cu¼_cÛf -()); - -508 - gthis_¡• - /ð -gcd -( -this_¡• -, -cÛf -); - -509 - gthis_¡• - = -gcd -( -glob®_¡• -, -this_¡• -); - -510 ià( - gthis_¡• - == 1) - -513 ià( - glb -. -size -() != 0) { - -514 -R–©iÚ - -‹¡ - = -ü—‹_¡ride_Ú_bound -( -n -, -lb -, -this_¡• -); - -515 ià( -Gi¡ -( -‹¡ -, -cÝy -( -I1 -[ -i -])). -is_obvious_utÞogy -()) { - -516 ià( - g¡• -[ -i -] == 0) - -517 -¡• -[ -i -] = -this_¡• -; - -519 - g¡• -[ -i -] = -lcm -( -¡• -[i], -this_¡• -); - -524 -CÚjunù - * - gc - = -I2 -[ -i -]. -qu”y_DNF -()-> -sšgË_cÚjunù -(); - -525  -GEQ_I‹¿tÜ - - gge - = -c --> -GEQs -(); ge; ge++) { - -526 ià((* - gge -). -has_wždÿrds -(è|| (*ge). -g‘_cÛf -( -t_cÞ -) != 1) - -529 - g¡d -:: -m­ -< -V¬ŸbË_ID -, - gcÛf_t -> - gcur_lb -; - -531  -CÚ¡r_V¬s_I‹r - -cv -(* -ge -); - gcv -; cv++) - -532 - gcur_lb -[ -cv -. -cu¼_v¬ -()] = cv. -cu¼_cÛf -(); - -534 - gcur_lb -[ -NULL -] = (* -ge -). -g‘_cÚ¡ -(); - -536 -R–©iÚ - - g‹¡ - = -ü—‹_¡ride_Ú_bound -( -n -, -cur_lb -, -this_¡• -); - -537 ià( -Gi¡ -( -‹¡ -, -cÝy -( -I1 -[ -i -])). -is_obvious_utÞogy -()) { - -538 ià( - g¡• -[ -i -] == 0) - -539 -¡• -[ -i -] = -this_¡• -; - -541 - g¡• -[ -i -] = -lcm -( -¡• -[i], -this_¡• -); - -543 - glb - = -cur_lb -; - -552  -size_t - - gi - = 0; i < - gis_exaù -. -size -(); i++) - -553 ià(! - gis_exaù -[ -i -]) - -554 - gglob®_¡• - = -gcd -( -glob®_¡• -, -¡• -[ -i -]); - -555 ià( - gglob®_¡• - =ð1 || -glob®_¡• - == 0) - -556  -R–©iÚ -:: -True -( -n -); - -558 -R–©iÚ - - g»suÉ - = -ü—‹_¡ride_Ú_bound -( -n -, -lb -, -glob®_¡• -); - -561  -size_t - - gi - = 0; i < - gI1 -. -size -(); i++) - -562 ià( - g¡• -[ -i -] == 0) { - -563 ià(! -Gi¡ -( -cÝy -( -»suÉ -), cÝy( -I1 -[ -i -])). -is_obvious_utÞogy -()) - -564  -R–©iÚ -:: -True -( -n -); - -567  - g»suÉ -; - -574 -CG_ouutR•r -* -ouutS‹m’t -( -CG_ouutBužd” - * -ocg -, CG_ouutR•¸* -¡mt -,  -šd’t -, cÚ¡ -R–©iÚ - & -m­pšg_ -, cÚ¡ R–©iÚ & -known_ -, cÚ¡ -¡d -:: -veùÜ - & -assigÃd_Ú_the_æy -) { - -575 -R–©iÚ - -m­pšg - = -cÝy -( -m­pšg_ -); - -576 -R–©iÚ - - gknown - = -cÝy -( -known_ -); - -577 - gTu¶e -< - g¡d -:: -¡ršg -> -loÝ_v¬s -; - -579  - gi - = 1; i <ð -m­pšg -. -n_šp -(); i++) - -580 - gloÝ_v¬s -. -­³nd -( -m­pšg -. -šput_v¬ -( -i -)-> -Çme -()); - -583 ià( - gknown -. -n_£t -(è> - gm­pšg -. -n_out -()) { - -584 -R–©iÚ - -r -( -known -. -n_£t -(), -m­pšg -. -n_out -()); - -585 -F_And - * - gf_roÙ - = -r -. -add_ªd -(); - -586  - gi - = 1; i <ð -m­pšg -. -n_out -(); i++) { - -587 -EQ_HªdË - - gh - = -f_roÙ --> -add_EQ -(); - -588 - gh -. -upd©e_cÛf -( -r -. -šput_v¬ -( -i -), 1); - -589 - gh -. -upd©e_cÛf -( -r -. -ouut_v¬ -( -i -), -1); - -591 - gknown - = -Rªge -( -Re¡riù_Domaš -( -r -, -known -)); - -592 - gknown -. -sim¶ify -(); - -596 -R–©iÚ - -k -( -known -. -n_£t -()); - -597 -F_And - * - gf_roÙ - = -k -. -add_ªd -(); - -598 -CÚjunù - * - gc - = -known -. -qu”y_DNF -()-> -sšgË_cÚjunù -(); - -599  -EQ_I‹¿tÜ - - ge - = -c --> -EQs -();ƒ;ƒ++) { - -600 ià(!(* - ge -). -has_wždÿrds -()) - -601 - gf_roÙ --> -add_EQ -(* -e -); - -603 - gk -. -sim¶ify -(); - -606 -R–©iÚ - - gInv_m­pšg - = -Re¡riù_Domaš -( -Inv”£ -( -m­pšg -), -k -); - -607 - gTu¶e -< - gCG_ouutR•r -*> - gsLi¡ - = -ouutSub¡™utiÚ -( -ocg -, -Inv_m­pšg -, -assigÃd_Ú_the_æy -); - -609  - gocg --> -C»©ePÏûHÞd” -( -šd’t -, -¡mt -, -sLi¡ -, -loÝ_v¬s -); - -614 -boÞ - -fšdFloÜIÃqu®™y -( -R–©iÚ - & -r -, -V¬ŸbË_ID - -v -, -GEQ_HªdË - & -h -, V¬ŸbË_ID -exþuded -) { - -615 -CÚjunù - * - gc - = -r -. -sšgË_cÚjunù -(); - -617 - g¡d -:: -£t -< -V¬ŸbË_ID -> -v¬_checked -; - -618 - g¡d -:: -¡ack -< -V¬ŸbË_ID -> -v¬_checkšg -; - -619 - gv¬_checkšg -. -push -( -v -); - -621 ! - gv¬_checkšg -. -em±y -()) { - -622 -V¬ŸbË_ID - - gv2 - = -v¬_checkšg -. -tÝ -(); - -623 - gv¬_checkšg -. -pÝ -(); - -625 -boÞ - - gis_æoÜ - = -çl£ -; - -626  -GEQ_I‹¿tÜ - -gi -( -c -); - ggi -; gi++) { - -627 ià( - gexþuded - !ð -NULL - && (* -gi -). -g‘_cÛf -( -exþuded -) != 0) - -630 -cÛf_t - - ga - = (* -gi -). -g‘_cÛf -( -v2 -); - -631 ià( - ga - < 0) { - -632  -GEQ_I‹¿tÜ - -gi2 -( -c -); - ggi2 -; gi2++) { - -633 -cÛf_t - - gb - = (* -gi2 -). -g‘_cÛf -( -v2 -); - -634 ià( - gb - =ð- -a - && (* -gi -). -g‘_cÚ¡ -()+(* -gi2 -).get_const() < -a) { - -635 -boÞ - -m©ch - = -Œue -; - -636  -CÚ¡r_V¬s_I‹r - -cvi -(* -gi -); - gcvi -; cvi++) - -637 ià((* - ggi2 -). -g‘_cÛf -((* -cvi -). -v¬ -è!ð-(*cvi). -cÛf -) { - -638 -m©ch - = -çl£ -; - -641 ià(! - gm©ch -) - -643  -CÚ¡r_V¬s_I‹r - -cvi -(* -gi2 -); - gcvi -; cvi++) - -644 ià((* - ggi -). -g‘_cÛf -((* -cvi -). -v¬ -è!ð-(*cvi). -cÛf -) { - -645 -m©ch - = -çl£ -; - -648 ià( - gm©ch -) { - -649 - gv¬_checked -. -š£¹ -( -v2 -); - -650 - gis_æoÜ - = -Œue -; - -651 ià( - gv - =ð -v2 -) - -652 -h - = * -gi -; - -654  -CÚ¡r_V¬s_I‹r - -cvi -(* -gi -); - gcvi -; cvi++) - -655 ià(((* - gcvi -). - gv¬ --> -kšd -(è=ð -Exi¡s_V¬ - || (* -cvi -). -v¬ -->kšd(è=ð -Wždÿrd_V¬ -) && - -656 -v¬_checked -. -fšd -((* -cvi -). -v¬ -è=ðv¬_checked. -’d -()) - -657 -v¬_checkšg -. -push -((* -cvi -). -v¬ -); - -663 ià( - gis_æoÜ -) - -667 ià(! - gis_æoÜ -) - -668  - gçl£ -; - -670  - gŒue -; - -680 -CG_ouutR•r -* -ouut_as_gu¬d -( -CG_ouutBužd” -* -ocg -, cÚ¡ -R–©iÚ - & -gu¬ds_š -, -CÚ¡¿št_HªdË - -e -, -boÞ - -is_equ®™y -, cÚ¡ -¡d -:: -veùÜ - & -assigÃd_Ú_the_æy -) { - -681 -R–©iÚ - & -gu¬ds - = -cÚ¡_ÿ¡ -( -gu¬ds_š -); - -682 ià( - ge -. -has_wždÿrds -()) - -683 -throw - - g¡d -:: -šv®id_¬gum’t -("constraint must‚ot have wildcard"); - -685 -V¬ŸbË_ID - - gv - = (* -CÚ¡r_V¬s_I‹r -( -e -)). -v¬ -; - -687 -cÛf_t - - g§ved_cÛf - = (( -e -). -g‘_cÛf -( -v -)); - -688  - gsign - = -§ved_cÛf - < 0 ? -1 : 1; - -690 ( - ge -). -upd©e_cÛf_duršg_sim¶ify -( -v -, - -§ved_cÛf -+ -sign -); - -691 -CG_ouutR•r -* - grÝ - = -ouutEasyBoundAsR•r -( -ocg -, -gu¬ds -, -e -, -v -, -çl£ -, 0, -assigÃd_Ú_the_æy -); - -692 ( - ge -). -upd©e_cÛf_duršg_sim¶ify -( -v -, -§ved_cÛf -- -sign -); - -694 -CG_ouutR•r -* - glÝ - = -ouutId’t -( -ocg -, -gu¬ds -, -v -, -assigÃd_Ú_the_æy -); - -695 ià( -abs -( -§ved_cÛf -) != 1) - -696 -lÝ - = -ocg --> -C»©eTimes -(ocg-> -C»©eIÁ -( -abs -( -§ved_cÛf -)),†op); - -699 ià( - gis_equ®™y -) { - -700  - gocg --> -C»©eEQ -( -lÝ -, -rÝ -); - -703 ià( - g§ved_cÛf - < 0) - -704  - gocg --> -C»©eLE -( -lÝ -, -rÝ -); - -706  - gocg --> -C»©eGE -( -lÝ -, -rÝ -); - -715 -CG_ouutR•r - * -ouut_EQ_¡rides -( -CG_ouutBužd” -* -ocg -, cÚ¡ -R–©iÚ - & -gu¬ds_š -, cÚ¡ -¡d -:: -veùÜ - & -assigÃd_Ú_the_æy -) { - -716 -R–©iÚ - -gu¬ds - = -cÚ¡_ÿ¡ -( -gu¬ds_š -); - -717 -CÚjunù - * - gc - = -gu¬ds -. -sšgË_cÚjunù -(); - -719 -CG_ouutR•r - * - geqR•r - = -NULL -; - -721  -EQ_I‹¿tÜ - -ei -( -c --> -EQs -()); - gei -;ƒi++) { - -722 -V¬ŸbË_ID - - gwc - = -NULL -; - -723  -CÚ¡r_V¬s_I‹r - -cvi -((* -ei -), -Œue -); - gcvi -; cvi++) { - -724 ià( - gwc - !ð -NULL -) - -725 -throw - -codeg’_”rÜ -("Can't generateƒquality condition with multiple wildcards"); - -727 - gwc - = (* -cvi -). -v¬ -; - -729 ià( - gwc - =ð -NULL -) - -732 -cÛf_t - - g¡• - = (* -ei -). -g‘_cÛf -( -wc -); - -734 (* - gei -). -upd©e_cÛf_duršg_sim¶ify -( -wc -, 1- -¡• -); - -735 -CG_ouutR•r -* - glÝ - = -ouutEasyBoundAsR•r -( -ocg -, -gu¬ds -, (* -ei -), -wc -, -çl£ -, 0, -assigÃd_Ú_the_æy -); - -736 (* - gei -). -upd©e_cÛf_duršg_sim¶ify -( -wc -, -¡• --1); - -738 -CG_ouutR•r -* - grÝ - = -ocg --> -C»©eIÁ -( -abs -( -¡• -)); - -739 -CG_ouutR•r -* - gštMod - = -ocg --> -C»©eIÁeg”Mod -( -lÝ -, -rÝ -); - -740 -CG_ouutR•r -* - geqNode - = -ocg --> -C»©eEQ -( -štMod -, ocg-> -C»©eIÁ -(0)); - -742 - geqR•r - = -ocg --> -C»©eAnd -( -eqR•r -, -eqNode -); - -745  - geqR•r -; - -759 -CG_ouutR•r - * -ouut_GEQ_¡rides -( -CG_ouutBužd” -* -ocg -, cÚ¡ -R–©iÚ - & -gu¬ds_š -, cÚ¡ -¡d -:: -veùÜ - & -assigÃd_Ú_the_æy -) { - -760 -R–©iÚ - -gu¬ds - = -cÚ¡_ÿ¡ -( -gu¬ds_š -); - -761 -CÚjunù - * - gc - = -gu¬ds -. -sšgË_cÚjunù -(); - -763 -CG_ouutR•r -* - ggeqR•r - = -NULL -; - -765 - g¡d -:: -£t -< -V¬ŸbË_ID -> -nÚ_Üphª_wždÿrd -; - -766  -GEQ_I‹¿tÜ - -gi -( -c -); - ggi -; gi++) { - -767  - gnum_wžd - = 0; - -768 -V¬ŸbË_ID - - gfœ¡_Úe -; - -769  -CÚ¡r_V¬s_I‹r - -cvi -(* -gi -, -Œue -); - gcvi -; cvi++) { - -770 - gnum_wžd -++; - -771 ià( - gnum_wžd - == 1) - -772 -fœ¡_Úe - = (* -cvi -). -v¬ -; - -774 - gnÚ_Üphª_wždÿrd -. -š£¹ -((* -cvi -). -v¬ -); - -776 ià( - gnum_wžd - > 1) - -777 - gnÚ_Üphª_wždÿrd -. -š£¹ -( -fœ¡_Úe -); - -780  - gi - = 1; i <ð(*( -c --> -v¬ŸbËs -())). -size -(); i++) { - -781 -V¬ŸbË_ID - - gwc - = (*( -c --> -v¬ŸbËs -()))[ -i -]; - -782 ià( - gwc --> -kšd -(è=ð -Wždÿrd_V¬ - && -nÚ_Üphª_wždÿrd -. -fšd -( -wc -è=ðnÚ_Üphª_wždÿrd. -’d -()) { - -783 -Tu¶e -< -GEQ_HªdË -> -low” -, -uµ” -; - -784  -GEQ_I‹¿tÜ - -gi -( -c -); - ggi -; gi++) { - -785 if((* - ggi -). -g‘_cÛf -( -wc -) > 0) - -786 - glow” -. -­³nd -(* -gi -); - -787 if((* - ggi -). -g‘_cÛf -( -wc -) < 0) - -788 - guµ” -. -­³nd -(* -gi -); - -793  - gTu¶e_I‹¿tÜ -< - gGEQ_HªdË -> -low -( -low” -); - glow -;†ow++) { - -794  - gTu¶e_I‹¿tÜ -< - gGEQ_HªdË -> -up -( -uµ” -); - gup -; up++) { - -795 -cÛf_t - - glow_cÛf - = (* -low -). -g‘_cÛf -( -wc -); - -796 -cÛf_t - - gup_cÛf - = (* -up -). -g‘_cÛf -( -wc -); - -798 (* - glow -). -upd©e_cÛf_duršg_sim¶ify -( -wc -, 1- -low_cÛf -); - -799 -CG_ouutR•r -* - glowEx´ - = -ouutEasyBoundAsR•r -( -ocg -, -gu¬ds -, * -low -, -wc -, -çl£ -, 0, -assigÃd_Ú_the_æy -); - -800 (* - glow -). -upd©e_cÛf_duršg_sim¶ify -( -wc -, -low_cÛf --1); - -802 (* - gup -). -upd©e_cÛf_duršg_sim¶ify -( -wc -, -1- -up_cÛf -); - -803 -CG_ouutR•r -* - gupEx´ - = -ouutEasyBoundAsR•r -( -ocg -, -gu¬ds -, * -up -, -wc -, -çl£ -, 0, -assigÃd_Ú_the_æy -); - -804 (* - gup -). -upd©e_cÛf_duršg_sim¶ify -( -wc -, -up_cÛf -+1); - -806 -CG_ouutR•r -* - gštDiv - = -ocg --> -C»©eIÁeg”Divide -( -upEx´ -, ocg-> -C»©eIÁ -(- -up_cÛf -)); - -807 -CG_ouutR•r -* - grÝ - = -ocg --> -C»©eTimes -(ocg-> -C»©eIÁ -( -low_cÛf -), -štDiv -); - -808 -CG_ouutR•r -* - ggeqNode - = -ocg --> -C»©eLE -( -lowEx´ -, -rÝ -); - -810 - ggeqR•r - = -ocg --> -C»©eAnd -( -geqR•r -, -geqNode -); - -816 ià( - gnÚ_Üphª_wždÿrd -. -size -() > 0) { - -826 -throw - -codeg’_”rÜ -("Can't generate multiple wildcard GEQ guards„ight‚ow"); - -829  - ggeqR•r -; - -836 -CG_ouutR•r - * -ouutGu¬d -( -CG_ouutBužd” -* -ocg -, cÚ¡ -R–©iÚ - & -gu¬ds_š -, cÚ¡ -¡d -:: -veùÜ - & -assigÃd_Ú_the_æy -) { - -837 -R–©iÚ - & -gu¬ds - = -cÚ¡_ÿ¡ -( -gu¬ds_š -); - -838 ià( - ggu¬ds -. -is_nuÎ -(è|| gu¬ds. -is_obvious_utÞogy -()) - -839  - gNULL -; - -841 -CG_ouutR•r -* - gnodeR•r - = -NULL -; - -843 -CG_ouutR•r - * - geqSŒideR•r - = -ouut_EQ_¡rides -( -ocg -, -gu¬ds -, -assigÃd_Ú_the_æy -); - -844 - gnodeR•r - = -ocg --> -C»©eAnd -( -nodeR•r -, -eqSŒideR•r -); - -846 -CG_ouutR•r - * - ggeqSŒideR•r - = -ouut_GEQ_¡rides -( -ocg -, -gu¬ds -, -assigÃd_Ú_the_æy -); - -847 - gnodeR•r - = -ocg --> -C»©eAnd -( -nodeR•r -, -geqSŒideR•r -); - -849 -CÚjunù - * - gc - = -gu¬ds -. -sšgË_cÚjunù -(); - -850  -EQ_I‹¿tÜ - -ei -( -c --> -EQs -()); - gei -;ƒi++) - -851 ià(!(* - gei -). -has_wždÿrds -()) { - -852 -CG_ouutR•r - * - geqR•r - = -ouut_as_gu¬d -( -ocg -, -gu¬ds -, (* -ei -), -Œue -, -assigÃd_Ú_the_æy -); - -853 - gnodeR•r - = -ocg --> -C»©eAnd -( -nodeR•r -, -eqR•r -); - -855  -GEQ_I‹¿tÜ - -gi -( -c --> -GEQs -()); - ggi -; gi++) - -856 ià(!(* - ggi -). -has_wždÿrds -()) { - -857 -CG_ouutR•r - * - ggeqR•r - = -ouut_as_gu¬d -( -ocg -, -gu¬ds -, (* -gi -), -çl£ -, -assigÃd_Ú_the_æy -); - -858 - gnodeR•r - = -ocg --> -C»©eAnd -( -nodeR•r -, -geqR•r -); - -861  - gnodeR•r -; - -869 -CG_ouutR•r - * -ouutLBasR•r -( -CG_ouutBužd” -* -ocg -, cÚ¡ -GEQ_HªdË - & -g -, - -870 -R–©iÚ - & -bounds -, -V¬ŸbË_ID - -v -, - -871 -cÛf_t - -¡ride -, cÚ¡ -EQ_HªdË - & -¡rideEQ -, - -872 -R–©iÚ - -known -, cÚ¡ -¡d -:: -veùÜ -< -CG_ouutR•r - *> & -assigÃd_Ú_the_æy -) { - -873 #ià! -defšed - -NDEBUG - - -874 -cÛf_t - -v_cÛf -; - -875 -as£¹ -(( -v_cÛf - = -g -. -g‘_cÛf -( -v -)) > 0); - -878 - g¡d -:: -¡ršg - -s -; - -879 -CG_ouutR•r - * - glbR•r -; - -880 ià( - g¡ride - == 1) { - -881 -lbR•r - = -ouutEasyBoundAsR•r -( -ocg -, -bounds -, -g -, -v -, -çl£ -, 1, -assigÃd_Ú_the_æy -); - -884 ià(! -boundH™sSŒide -( -g -, -v -, -¡rideEQ -, -¡ride -, -known -)) { - -885 - gbounds -. -£tup_Çmes -(); - -887 -CG_¡ršgBužd” - - goscg -; - -888 - g¡d -:: -¡ršg - -c - = -G‘SŒšg -( -ouutEasyBoundAsR•r -(& -oscg -, -bounds -, -¡rideEQ -, -v -, -Œue -, 0, -assigÃd_Ú_the_æy -)); - -889 -CG_ouutR•r - * - gcR•r - = -NULL -; - -890 ià( - gc - !ð -¡d -:: -¡ršg -("0")) - -891 -cR•r - = -ouutEasyBoundAsR•r -( -ocg -, -bounds -, -¡rideEQ -, -v -, -Œue -, 0, -assigÃd_Ú_the_æy -); - -892 - g¡d -:: -¡ršg - -Lov”M - = -G‘SŒšg -( -ouutEasyBoundAsR•r -(& -oscg -, -bounds -, -g -, -v -, -çl£ -, 1, -assigÃd_Ú_the_æy -)); - -893 -CG_ouutR•r - * - gLov”MR•r - = -NULL -; - -894 ià( - gLov”M - !ð -¡d -:: -¡ršg -("0")) - -895 -Lov”MR•r - = -ouutEasyBoundAsR•r -( -ocg -, -bounds -, -g -, -v -, -çl£ -, 1, -assigÃd_Ú_the_æy -); - -897 ià( - gcode_g’_debug - > 2) { - -898 -årštf -( -DebugFže -,"::: Lov”M i %s\n", -Lov”M -. -c_¡r -()); - -899 -årštf -( -DebugFže -,"::: c i %s\n", -c -. -c_¡r -()); - -902  - gcom¶ex™y1 - = 0, - gcom¶ex™y2 - = 0; - -903  -size_t - - gi - = 0; i < - gc -. -Ëngth -(); i++) - -904 ià( - gc -[ -i -] =ð'+' || -c -[i] == '-' || c[i] == '*' || c[i] == '/') - -905 -com¶ex™y1 -++; - -906 ià( - gc -[ -i -] == ',') - -907 -com¶ex™y1 - += 2; - -908  -size_t - - gi - = 0; i < - gLov”M -. -Ëngth -(); i++) - -909 ià( - gLov”M -[ -i -] =ð'+' || -Lov”M -[i] == '-' || LoverM[i] == '*' || LoverM[i] == '/') - -910 -com¶ex™y2 -++; - -911 ià( - gLov”M -[ -i -] == ',') - -912 -com¶ex™y2 - += 2; - -914 ià( - gcom¶ex™y1 - < - gcom¶ex™y2 -) { - -915 -CG_ouutR•r - * - gidUp - = -Lov”MR•r -; - -916 -CG_ouutR•r - * - gc1R•r - = -ocg --> -C»©eCÝy -( -cR•r -); - -917 - gidUp - = -ocg --> -C»©eMšus -( -idUp -, -c1R•r -); - -918 - gidUp - = -ocg --> -C»©ePlus -( -idUp -, ocg-> -C»©eIÁ -( -¡ride --1)); - -919 -CG_ouutR•r - * - gidLow - = -ocg --> -C»©eIÁ -( -¡ride -); - -920 - glbR•r - = -ocg --> -C»©eTimes -(ocg-> -C»©eIÁ -( -¡ride -), - -921 -ocg --> -C»©eIÁeg”Divide -( -idUp -, -idLow -)); - -922 - glbR•r - = -ocg --> -C»©ePlus -( -lbR•r -, -cR•r -); - -925 -CG_ouutR•r - * - gLov”M1R•r - = -ocg --> -C»©eCÝy -( -Lov”MR•r -); - -926 -CG_ouutR•r - * - gimUp - = -ocg --> -C»©eMšus -( -cR•r -, -Lov”M1R•r -); - -927 -CG_ouutR•r - * - gimLow - = -ocg --> -C»©eIÁ -( -¡ride -); - -928 -CG_ouutR•r - * - gštMod - = -ocg --> -C»©eIÁeg”Mod -( -imUp -, -imLow -); - -929 - glbR•r - = -ocg --> -C»©ePlus -( -Lov”MR•r -, -štMod -); - -934 - gbounds -. -£tup_Çmes -(); - -935 - glbR•r - = -ouutEasyBoundAsR•r -( -ocg -, -bounds -, -g -, -v -, -çl£ -, 0, -assigÃd_Ú_the_æy -); - -939  - glbR•r -; - -946 -CG_ouutR•r - * -ouutUBasR•r -( -CG_ouutBužd” -* -ocg -, cÚ¡ -GEQ_HªdË - & -g -, - -947 -R–©iÚ - & -bounds -, - -948 -V¬ŸbË_ID - -v -, - -949 -cÛf_t - , - -950 cÚ¡ -EQ_HªdË - & , - -951 cÚ¡ -¡d -:: -veùÜ -< -CG_ouutR•r - *> & -assigÃd_Ú_the_æy -) { - -952 -as£¹ -( -g -. -g‘_cÛf -( -v -) < 0); - -953 -CG_ouutR•r -* - gupR•r - = -ouutEasyBoundAsR•r -( -ocg -, -bounds -, -g -, -v -, -çl£ -, 0, -assigÃd_Ú_the_æy -); - -954  - gupR•r -; - -966 -CG_ouutR•r -* -ouutEasyBoundAsR•r -( -CG_ouutBužd” -* -ocg -, -R–©iÚ - & -bounds -, - -967 cÚ¡ -CÚ¡¿št_HªdË - & -g -, -V¬ŸbË_ID - -v -, - -968 -boÞ - -ignÜeWC -, - -969  -ûžšg -, - -970 cÚ¡ -¡d -:: -veùÜ -< -CG_ouutR•r - *> & -assigÃd_Ú_the_æy -) { - -974 -CG_ouutR•r -* -—syBoundR•r - = -NULL -; - -976 -cÛf_t - - gv_cÛf - = -g -. -g‘_cÛf -( -v -); - -977  - gv_sign - = -v_cÛf - > 0 ? 1 : -1; - -978 - gv_cÛf - *ð -v_sign -; - -979 -as£¹ -( -v_cÛf - > 0); - -982  - gsign_adj - = - -v_sign -; - -987  -CÚ¡r_V¬s_I‹r - -c2 -( -g -, -çl£ -); - gc2 -; c2++) { - -988 ià((* - gc2 -). - gv¬ - !ð -v - && (! -ignÜeWC - || (* -c2 -). -v¬ --> -kšd -()!= -Wždÿrd_V¬ -)) { - -990 -cÛf_t - -cf - = (* -c2 -). -cÛf -* -sign_adj -; - -991 -as£¹ -( -cf - != 0); - -993 -CG_ouutR•r - * - gv¬Name -; - -994 ià((* - gc2 -). - gv¬ --> -kšd -(è=ð -Wždÿrd_V¬ -) { - -995 -GEQ_HªdË - -h -; - -996 ià(! -fšdFloÜIÃqu®™y -( -bounds -, (* -c2 -). -v¬ -, -h -, -v -)) { - -997 ià( - g—syBoundR•r - !ð -NULL -) { - -998 -—syBoundR•r --> -þ—r -(); - -999 -d–‘e - - g—syBoundR•r -; - -1001  - gNULL -; - -1003 - gv¬Name - = -ouutEasyBoundAsR•r -( -ocg -, -bounds -, -h -, (* -c2 -). -v¬ -, -çl£ -, 0, -assigÃd_Ú_the_æy -); - -1006 - gv¬Name - = -ouutId’t -( -ocg -, -bounds -, (* -c2 -). -v¬ -, -assigÃd_Ú_the_æy -); - -1008 -CG_ouutR•r - * - gcfR•r - = -NULL -; - -1010 ià( - gcf - > 1) { - -1011 - gcfR•r - = -ocg --> -C»©eIÁ -( -cf -); - -1012 -CG_ouutR•r -* - grbR•r - = -ocg --> -C»©eTimes -( -cfR•r -, -v¬Name -); - -1013 - g—syBoundR•r - = -ocg --> -C»©ePlus -( -—syBoundR•r -, -rbR•r -); - -1015 ià( - gcf - < -1) { - -1016 - gcfR•r - = -ocg --> -C»©eIÁ -(- -cf -); - -1017 -CG_ouutR•r -* - grbR•r - = -ocg --> -C»©eTimes -( -cfR•r -, -v¬Name -); - -1018 - g—syBoundR•r - = -ocg --> -C»©eMšus -( -—syBoundR•r -, -rbR•r -); - -1020 ià( - gcf - == 1) { - -1021 -—syBoundR•r - = -ocg --> -C»©ePlus -ÓasyBoundR•r, -v¬Name -); - -1023 ià( - gcf - == -1) { - -1024 -—syBoundR•r - = -ocg --> -C»©eMšus -ÓasyBoundR•r, -v¬Name -); - -1029 ià( - gg -. -g‘_cÚ¡ -()) { - -1030 -cÛf_t - - gcf - = -g -. -g‘_cÚ¡ -()* -sign_adj -; - -1031 -as£¹ -( -cf - != 0); - -1032 ià( - gcf - > 0) { - -1033 - g—syBoundR•r - = -ocg --> -C»©ePlus -( -—syBoundR•r -, ocg-> -C»©eIÁ -( -cf -)); - -1036 - g—syBoundR•r - = -ocg --> -C»©eMšus -( -—syBoundR•r -, ocg-> -C»©eIÁ -(- -cf -)); - -1040 if( - g—syBoundR•r - =ð -NULL -) { - -1041 -—syBoundR•r - = -ocg --> -C»©eIÁ -(0); - -1045 ià( - gv_cÛf - > 1) { - -1046 -as£¹ -( -ûžšg - >= 0); - -1047 ià( - gûžšg -) { - -1048 - g—syBoundR•r -ð -ocg --> -C»©ePlus -( -—syBoundR•r -, ocg-> -C»©eIÁ -( -v_cÛf --1)); - -1050 - g—syBoundR•r - = -ocg --> -C»©eIÁeg”Divide -( -—syBoundR•r -, ocg-> -C»©eIÁ -( -v_cÛf -)); - -1053  - g—syBoundR•r -; - -1062 - g¡d -:: -·œ -< -CG_ouutR•r - *, - gboÞ -> -ouutBounds -( -CG_ouutBužd” -* -ocg -, cÚ¡ -R–©iÚ - & -bounds -, -V¬ŸbË_ID - -v -,  -šd’t -, R–©iÚ & -’fÜûd -, cÚ¡ -¡d -:: -veùÜ - & -assigÃd_Ú_the_æy -) { - -1063 -R–©iÚ - -b - = -cÝy -( -bounds -); - -1064 -CÚjunù - * - gc - = -b -. -qu”y_DNF -()-> -sšgË_cÚjunù -(); - -1068 -R–©iÚ - - gr1 - = R–©iÚ:: -True -( -b -. -n_£t -()), - gr2 - = Relation::True(b.n_set()); - -1069  -EQ_I‹¿tÜ - -ei -( -c -); - gei -;ƒi++) { - -1070 ià((* - gei -). -g‘_cÛf -( -v -è!ð0 && (* -ei -). -has_wždÿrds -()) { - -1071 -cÛf_t - -sign -; - -1072 ià((* - gei -). -g‘_cÛf -( -v -) > 0) - -1073 - gsign - = 1; - -1075 - gsign - = -1; - -1077 -cÛf_t - - g¡ride - = 0; - -1078  -CÚ¡r_V¬s_I‹r - -cvi -(* -ei -, -Œue -); - gcvi -; cvi++) - -1079 ià((* - gcvi -). - gv¬ --> -kšd -(è=ð -Wždÿrd_V¬ -) { - -1080 -¡ride - = -abs -((* -cvi -). -cÛf -); - -1085 -boÞ - - gfound_m©ch - = -çl£ -; - -1086 ià( -abs -((* -ei -). -g‘_cÛf -( -v -)) != 1) { - -1087 -cÛf_t - -d - = -¡ride - / -gcd -( -abs -((* -ei -). -g‘_cÛf -( -v -)), stride); - -1088 -R–©iÚ - - gr3 - = R–©iÚ:: -True -( -b -. -n_£t -()); - -1089 - gr3 -. -ªd_w™h_EQ -(* -ei -); - -1091  -GEQ_I‹¿tÜ - -gi -( -c -); - ggi -; gi++) { - -1092 ià((* - ggi -). -g‘_cÛf -( -v -è=ð1 && !(* -gi -). -has_wždÿrds -()) { - -1093 -R–©iÚ - -r4 -( -b -. -n_£t -()); - -1094 -F_And - * - gf_roÙ - = -r4 -. -add_ªd -(); - -1095 -SŒide_HªdË - - gh - = -f_roÙ --> -add_¡ride -( -d -); - -1097  -CÚ¡r_V¬s_I‹r - -cvi -(* -gi -); - gcvi -; cvi++) - -1098 (* - gcvi -). - gv¬ --> -kšd -()) { - -1099  - gIÅut_V¬ -: { - -1100  -pos - = (* -cvi -). -v¬ --> -g‘_pos™iÚ -(); - -1101 - gh -. -upd©e_cÛf -( -r4 -. -£t_v¬ -( -pos -), (* -cvi -). -cÛf -); - -1104  - gGlob®_V¬ -: { - -1105 -Glob®_V¬_ID - -g - = (* -cvi -). -v¬ --> -g‘_glob®_v¬ -(); - -1106 -V¬ŸbË_ID - - gv -; - -1107 ià( - gg --> -¬™y -() == 0) - -1108 -v - = -r4 -. -g‘_loÿl -( -g -); - -1110 - gv - = -r4 -. -g‘_loÿl -( -g -, (* -cvi -). -v¬ --> -funùiÚ_of -()); - -1111 - gh -. -upd©e_cÛf -( -v -, (* -cvi -). -cÛf -); - -1115 -årštf -( -DebugFže -, "can't deal withhe variableype in†ower bound\n"); - -1116  - g¡d -:: -make_·œ -( -¡©ic_ÿ¡ -< -CG_ouutR•r - *>( -NULL -), -çl£ -); - -1118 - gh -. -upd©e_cÚ¡ -((* -gi -). -g‘_cÚ¡ -()); - -1120 -R–©iÚ - - gr5 - = -Gi¡ -( -cÝy -( -r3 -), -IÁ”£ùiÚ -(cÝy( -r4 -), cÝy( -’fÜûd -))); - -1123 ià( - gr5 -. -is_obvious_utÞogy -()) { - -1124 - gr1 - = -IÁ”£ùiÚ -( -r1 -, -r4 -); - -1125 - gfound_m©ch - = -Œue -; - -1132  -GEQ_I‹¿tÜ - -gi -( -c -); - ggi -; gi++) { - -1133 ià((* - ggi -). -g‘_cÛf -( -v -è=ð -abs -((* -ei -).g‘_cÛf(v)è&& !(* -gi -). -has_wždÿrds -()) { - -1134 -R–©iÚ - -r -( -b -. -n_£t -()); - -1135 -SŒide_HªdË - - gh - = -r -. -add_ªd -()-> -add_¡ride -( -¡ride -); - -1137  -CÚ¡r_V¬s_I‹r - -cvi -(* -gi -); - gcvi -; cvi++) - -1138 (* - gcvi -). - gv¬ --> -kšd -()) { - -1139  - gIÅut_V¬ -: { - -1140  -pos - = (* -cvi -). -v¬ --> -g‘_pos™iÚ -(); - -1141 ià((* - gcvi -). - gv¬ - !ð -v -) { - -1142  -t1 - = -št_mod -((* -cvi -). -cÛf -, -¡ride -); - -1143 ià( - gt1 - != 0) { - -1144 -cÛf_t - -t2 - = -’fÜûd -. -qu”y_v¬ŸbË_mod -ÓnfÜûd. -£t_v¬ -( -pos -), -¡ride -); - -1145 ià( - gt2 - !ð -posInfš™y -) - -1146 -h -. -upd©e_cÚ¡ -( -t1 -* -t2 -); - -1148 - gh -. -upd©e_cÛf -( -r -. -£t_v¬ -( -pos -), -t1 -); - -1152 - gh -. -upd©e_cÛf -( -r -. -£t_v¬ -( -pos -), (* -cvi -). -cÛf -); - -1155  - gGlob®_V¬ -: { - -1156 -Glob®_V¬_ID - -g - = (* -cvi -). -v¬ --> -g‘_glob®_v¬ -(); - -1157 -V¬ŸbË_ID - - gv -; - -1158 ià( - gg --> -¬™y -() == 0) - -1159 -v - = -’fÜûd -. -g‘_loÿl -( -g -); - -1161 - gv - = -’fÜûd -. -g‘_loÿl -( -g -, (* -cvi -). -v¬ --> -funùiÚ_of -()); - -1162 -cÛf_t - - gt - = -’fÜûd -. -qu”y_v¬ŸbË_mod -( -v -, -¡ride -); - -1163 ià( - gt - !ð -posInfš™y -) - -1164 -h -. -upd©e_cÚ¡ -( -t -*(* -cvi -). -cÛf -); - -1166 -V¬ŸbË_ID - - gv2 -; - -1167 ià( - gg --> -¬™y -() == 0) - -1168 -v2 - = -r -. -g‘_loÿl -( -g -); - -1170 - gv2 - = -r -. -g‘_loÿl -( -g -, (* -cvi -). -v¬ --> -funùiÚ_of -()); - -1171 - gh -. -upd©e_cÛf -( -v2 -, (* -cvi -). -cÛf -); - -1176 -årštf -( -DebugFže -, "can't deal withhe variableype in†ower bound\n"); - -1177  - g¡d -:: -make_·œ -( -¡©ic_ÿ¡ -< -CG_ouutR•r - *>( -NULL -), -çl£ -); - -1179 - gh -. -upd©e_cÚ¡ -((* -gi -). -g‘_cÚ¡ -()); - -1181 -boÞ - - gt - = -Œue -; - -1183 -CÚjunù - * - gc2 - = -r -. -qu”y_DNF -()-> -sšgË_cÚjunù -(); - -1184 -EQ_HªdË - - gh2 -; - -1185  -EQ_I‹¿tÜ - -ei2 -( -c2 -); - gei2 -;ƒi2++) { - -1186 - gh2 - = * -ei2 -; - -1190  - gsign -; - -1191 ià( - gh2 -. -g‘_cÛf -( -v -è=ð(* -ei -).get_coef(v)) - -1192 -sign - = 1; - -1194 - gsign - = -1; - -1196 - gt - = -št_mod -( -h2 -. -g‘_cÚ¡ -(è- -sign - * (* -ei -).g‘_cÚ¡(), -¡ride -) == 0; - -1198 ià( - gt - !ð -çl£ -) - -1199  -CÚ¡r_V¬s_I‹r - -cvi -( -h2 -); - gcvi -; cvi++) - -1200 ià((* - gcvi -). - gv¬ --> -kšd -(è!ð -Wždÿrd_V¬ - && - -1201 -št_mod -((* -cvi -). -cÛf - - -sign - * (* -ei -). -g‘_cÛf -((*cvi). -v¬ -), -¡ride -) != 0) { - -1202 -t - = -çl£ -; - -1206 ià( - gt - !ð -çl£ -) - -1207  -CÚ¡r_V¬s_I‹r - -cvi -(* -ei -); - gcvi -; cvi++) - -1208 ià((* - gcvi -). - gv¬ --> -kšd -(è!ð -Wždÿrd_V¬ - && - -1209 -št_mod -((* -cvi -). -cÛf - - -sign - * -h2 -. -g‘_cÛf -((*cvi). -v¬ -), -¡ride -) != 0) { - -1210 -t - = -çl£ -; - -1216 ià( - gt -) { - -1218 -F_And - * - gf_roÙ - = -r1 -. -ªd_w™h_ªd -(); - -1219 -SŒide_HªdË - - gh - = -f_roÙ --> -add_¡ride -( -¡ride -); - -1220  -CÚ¡r_V¬s_I‹r - -cvi -(* -gi -); - gcvi -; cvi++) - -1221 (* - gcvi -). - gv¬ --> -kšd -()) { - -1222  - gIÅut_V¬ -: { - -1223 -h -. -upd©e_cÛf -( -r1 -. -£t_v¬ -((* -cvi -). -v¬ --> -g‘_pos™iÚ -()), (*cvi). -cÛf -); - -1226  - gGlob®_V¬ -: { - -1227 -Glob®_V¬_ID - -g - = (* -cvi -). -v¬ --> -g‘_glob®_v¬ -(); - -1228 -V¬ŸbË_ID - - gv -; - -1229 ià( - gg --> -¬™y -() == 0) - -1230 -v - = -r1 -. -g‘_loÿl -( -g -); - -1232 - gv - = -r1 -. -g‘_loÿl -( -g -, (* -cvi -). -v¬ --> -funùiÚ_of -()); - -1233 - gh -. -upd©e_cÛf -( -v -, (* -cvi -). -cÛf -); - -1237 -årštf -( -DebugFže -, "can't deal withhe variableype in†ower bound\n"); - -1238  - g¡d -:: -make_·œ -( -¡©ic_ÿ¡ -< -CG_ouutR•r - *>( -NULL -), -çl£ -); - -1240 - gh -. -upd©e_cÚ¡ -((* -gi -). -g‘_cÚ¡ -()); - -1242 - gfound_m©ch - = -Œue -; - -1249 ià(! - gfound_m©ch -) - -1250 - gr1 -. -ªd_w™h_EQ -(* -ei -); - -1252 ià((* - gei -). -g‘_cÛf -( -v -) == 0) { - -1253 -R–©iÚ - -r3 - = R–©iÚ:: -True -( -b -. -n_£t -()); - -1254 - gr3 -. -ªd_w™h_EQ -(* -ei -); - -1255 -R–©iÚ - - gr4 - = -Gi¡ -( -r3 -, -cÝy -( -’fÜûd -)); - -1256 ià(! - gr4 -. -is_obvious_utÞogy -()) - -1257 - gr2 -. -ªd_w™h_EQ -(* -ei -); - -1260 - gr2 -. -ªd_w™h_EQ -(* -ei -); - -1265 - g¡d -:: -m­ -< -V¬ŸbË_ID -, - gV¬ŸbË_ID -> - gexi¡s_m­pšg -; - -1266 -F_Exi¡s - * - gã - = -r2 -. -ªd_w™h_ªd -()-> -add_exi¡s -(); - -1267 -F_And - * - gf_roÙ - = -ã --> -add_ªd -(); - -1268  -GEQ_I‹¿tÜ - -gi -( -c -); - ggi -; gi++) { - -1269 -GEQ_HªdË - - gh - = -f_roÙ --> -add_GEQ -(); - -1270  -CÚ¡r_V¬s_I‹r - -cvi -(* -gi -); - gcvi -; cvi++) { - -1271 -V¬ŸbË_ID - - gv - = -cvi -. -cu¼_v¬ -(); - -1272  - gv --> -kšd -()) { - -1273  - gIÅut_V¬ -: { - -1274  -pos - = -v --> -g‘_pos™iÚ -(); - -1275 - gh -. -upd©e_cÛf -( -r2 -. -£t_v¬ -( -pos -), -cvi -. -cu¼_cÛf -()); - -1278  - gExi¡s_V¬ -: - -1279  -Wždÿrd_V¬ -: { - -1280 -¡d -:: -m­ -< -V¬ŸbË_ID -, - gV¬ŸbË_ID ->:: -™”©Ü - -p - = -exi¡s_m­pšg -. -fšd -( -v -); - -1281 -V¬ŸbË_ID - - ge -; - -1282 ià( - gp - =ð -exi¡s_m­pšg -. -’d -()) { - -1283 -e - = -ã --> -deþ¬e -(); - -1284 - gexi¡s_m­pšg -[ -v -] = -e -; - -1287 - ge - = (* -p -). -£cÚd -; - -1288 - gh -. -upd©e_cÛf -( -e -, -cvi -. -cu¼_cÛf -()); - -1291  - gGlob®_V¬ -: { - -1292 -Glob®_V¬_ID - -g - = -v --> -g‘_glob®_v¬ -(); - -1293 -V¬ŸbË_ID - - gv2 -; - -1294 ià( - gg --> -¬™y -() == 0) - -1295 -v2 - = -r2 -. -g‘_loÿl -( -g -); - -1297 - gv2 - = -r2 -. -g‘_loÿl -( -g -, -v --> -funùiÚ_of -()); - -1298 - gh -. -upd©e_cÛf -( -v2 -, -cvi -. -cu¼_cÛf -()); - -1302 -as£¹ -(0); - -1305 - gh -. -upd©e_cÚ¡ -((* -gi -). -g‘_cÚ¡ -()); - -1311 - gr1 -. -sim¶ify -(); - -1312 - gr2 -. -sim¶ify -(); - -1313 -R–©iÚ - - gb2 - = -IÁ”£ùiÚ -( -r1 -, -r2 -); - -1314 - gb2 -. -sim¶ify -(); - -1315  - gi - = 1; i <ð -b -. -n_£t -(); i++) - -1316 - gb2 -. -Çme_£t_v¬ -( -i -, -b -. -£t_v¬ -(i)-> -Çme -()); - -1317 - gb2 -. -£tup_Çmes -(); - -1318 - gb - = -b2 -; - -1319 - gc - = -b -. -qu”y_DNF -()-> -sšgË_cÚjunù -(); - -1324 -EQ_HªdË - - g¡rideEQ -; - -1325 -boÞ - - gfoundSŒide - = -çl£ -; - -1326 -boÞ - - gfoundSim¶eSŒide - = -çl£ -; - -1327 -cÛf_t - - g¡• - = 1; - -1328  - gnum_¡ride - = 0; - -1330  -EQ_I‹¿tÜ - -ei -( -c -); - gei -;ƒi++) { - -1331 ià((* - gei -). -g‘_cÛf -( -v -è!ð0 && (* -ei -). -has_wždÿrds -()) { - -1332 -num_¡ride -++; - -1334 ià( -abs -((* -ei -). -g‘_cÛf -( -v -)) != 1) - -1337 -boÞ - - gt - = -Œue -; - -1338 -cÛf_t - - gd - = 1; - -1339  -CÚ¡r_V¬s_I‹r - -cvi -(* -ei -); - gcvi -; cvi++) - -1340 ià((* - gcvi -). - gv¬ --> -kšd -(è=ð -Wždÿrd_V¬ -) { - -1341 -as£¹ -( -d -==1); - -1342 - gd - = -abs -((* -cvi -). -cÛf -); - -1344 ià((* - gcvi -). - gv¬ --> -kšd -(è=ð -IÅut_V¬ -) { - -1345 ià((* -cvi -). -v¬ - !ð -v -) - -1346 -t - = -çl£ -; - -1349 - gt - = -çl£ -; - -1351 ià( - gd - > - g¡• -) { - -1352 - g¡• - = -d -; - -1353 - gfoundSim¶eSŒide - = -t -; - -1354 - g¡rideEQ - = * -ei -; - -1355 - gfoundSŒide - = -Œue -; - -1362 ià(!( - gnum_¡ride - =ð0 || ( -num_¡ride - =ð1 && -foundSŒide -))) - -1363  -¡d -:: -make_·œ -( -¡©ic_ÿ¡ -< -CG_ouutR•r - *>( -NULL -), -çl£ -); - -1366  - glow”_bounds - = 0, - guµ”_bounds - = 0; - -1367 - gTu¶e -< - gCG_ouutR•r - *> - glbLi¡ -; - -1368 - gTu¶e -< - gCG_ouutR•r - *> - gubLi¡ -; - -1369 -cÛf_t - - gcÚ¡_lb - = -ÃgInfš™y -, - gcÚ¡_ub - = -posInfš™y -; - -1370  -GEQ_I‹¿tÜ - -g -( -c -); - gg -; g++) { - -1371 -cÛf_t - - gcÛf - = (* -g -). -g‘_cÛf -( -v -); - -1372 ià( - gcÛf - == 0) - -1374 ià( - gcÛf - > 0) { - -1375 - glow”_bounds -++; - -1376 ià((* - gg -). -is_cÚ¡ -( -v -è&& ! - gfoundSŒide -) { - -1378 -cÛf_t - - gL -, - gm -; - -1379 - gL - = -((* -g -). -g‘_cÚ¡ -()); - -1381 - gm - = (* -g -). -g‘_cÛf -( -v -); - -1382 -cÛf_t - - gsb - = (è( -ûž -(((è -L -è/ -m -)); - -1383 -£t_max -( -cÚ¡_lb -, -sb -); - -1385 ià((* - gg -). -is_cÚ¡ -( -v -è&& - gfoundSim¶eSŒide -) { - -1388 -cÛf_t - - gL -, - gm -, - gs -, - gc -; - -1389 - gL - = -((* -g -). -g‘_cÚ¡ -()); - -1390 - gm - = (* -g -). -g‘_cÛf -( -v -); - -1391 - gs - = -¡• -; - -1392 - gc - = -¡rideEQ -. -g‘_cÚ¡ -(); - -1393 -cÛf_t - - gsb - = ( -s - * (è( -ûž -Ð(è( -L - - ( -c - * -m -)) /(s*m))))+ c; - -1394 -£t_max -( -cÚ¡_lb -, -sb -); - -1397 - glbLi¡ -. -­³nd -( -ouutLBasR•r -( -ocg -, * -g -, -b -, -v -, -¡• -, -¡rideEQ -, -’fÜûd -, -assigÃd_Ú_the_æy -)); - -1400 - guµ”_bounds -++; - -1401 ià((* - gg -). -is_cÚ¡ -( -v -)) { - -1403 -£t_mš -( -cÚ¡_ub -,-(* -g -). -g‘_cÚ¡ -()/(*g). -g‘_cÛf -( -v -)); - -1406 - gubLi¡ -. -­³nd -( -ouutUBasR•r -( -ocg -, * -g -, -b -, -v -, -¡• -, -¡rideEQ -, -assigÃd_Ú_the_æy -)); - -1410 -CG_ouutR•r - * - glbR•r - = -NULL -; - -1411 -CG_ouutR•r - * - gubR•r - = -NULL -; - -1412 ià( - gcÚ¡_lb - !ð -ÃgInfš™y -) - -1413 -lbLi¡ -. -­³nd -( -ocg --> -C»©eIÁ -( -cÚ¡_lb -)); - -1414 ià( - glbLi¡ -. -size -() > 1) - -1415 - glbR•r - = -ocg --> -C»©eInvoke -("max", -lbLi¡ -); - -1416 ià( - glbLi¡ -. -size -() == 1) - -1417 -lbR•r - = -lbLi¡ -[1]; - -1420 if( - gfžlInBounds - && - glbLi¡ -. -size -(è=ð1 && -cÚ¡_lb - !ð -ÃgInfš™y -) - -1421 -low”BoundFÜLev– - = -cÚ¡_lb -; - -1424 ià( - gcÚ¡_ub - !ð -posInfš™y -) - -1425 -ubLi¡ -. -­³nd -( -ocg --> -C»©eIÁ -( -cÚ¡_ub -)); - -1426 ià( - gubLi¡ -. -size -() > 1) - -1427 - gubR•r - = -ocg --> -C»©eInvoke -("mš", -ubLi¡ -); - -1428 ià( - gubLi¡ -. -size -() == 1) - -1429 -ubR•r - = -ubLi¡ -[1]; - -1432 if( - gfžlInBounds - && - gcÚ¡_ub - !ð -posInfš™y -) - -1433 -uµ”BoundFÜLev– - = -cÚ¡_ub -; - -1436 ià( - guµ”_bounds - =ð0 || -low”_bounds - == 0) { - -1437  -¡d -:: -make_·œ -( -¡©ic_ÿ¡ -< -CG_ouutR•r - *>( -NULL -), -çl£ -); - -1441 -F_Exi¡s - * - gã - = -’fÜûd -. -ªd_w™h_ªd -()-> -add_exi¡s -(); - -1442 -F_And - * - gf_roÙ - = -ã --> -add_ªd -(); - -1443 - g¡d -:: -m­ -< -V¬ŸbË_ID -, - gV¬ŸbË_ID -> - gexi¡s_m­pšg -; - -1444 - g¡d -:: -¡ack -< -¡d -:: -·œ -< -GEQ_HªdË -, - gV¬ŸbË_ID -> > - gæoÜ_geq_¡ack -; - -1445 - g¡d -:: -£t -< -V¬ŸbË_ID -> -æoÜ_v¬_£t -; - -1447 ià( - gfoundSŒide -) { - -1448 -EQ_HªdË - - gh - = -f_roÙ --> -add_EQ -(); - -1449  -CÚ¡r_V¬s_I‹r - -cvi -( -¡rideEQ -); - gcvi -; cvi++) - -1450 (* - gcvi -). - gv¬ --> -kšd -()) { - -1451  - gIÅut_V¬ -: { - -1452  -pos - = (* -cvi -). -v¬ --> -g‘_pos™iÚ -(); - -1453 - gh -. -upd©e_cÛf -( -’fÜûd -. -£t_v¬ -( -pos -), (* -cvi -). -cÛf -); - -1456  - gExi¡s_V¬ -: - -1457  -Wždÿrd_V¬ -: { - -1458 -¡d -:: -m­ -< -V¬ŸbË_ID -, - gV¬ŸbË_ID ->:: -™”©Ü - -p - = -exi¡s_m­pšg -. -fšd -((* -cvi -). -v¬ -); - -1459 -V¬ŸbË_ID - - ge -; - -1460 ià( - gp - =ð -exi¡s_m­pšg -. -’d -()) { - -1461 -e - = -ã --> -deþ¬e -(); - -1462 - gexi¡s_m­pšg -[(* -cvi -). -v¬ -] = -e -; - -1465 - ge - = (* -p -). -£cÚd -; - -1466 - gh -. -upd©e_cÛf -( -e -, (* -cvi -). -cÛf -); - -1469  - gGlob®_V¬ -: { - -1470 -Glob®_V¬_ID - -g - = (* -cvi -). -v¬ --> -g‘_glob®_v¬ -(); - -1471 -V¬ŸbË_ID - - ge -; - -1472 ià( - gg --> -¬™y -() == 0) - -1473 -e - = -’fÜûd -. -g‘_loÿl -( -g -); - -1475 - ge - = -’fÜûd -. -g‘_loÿl -( -g -, (* -cvi -). -v¬ --> -funùiÚ_of -()); - -1476 - gh -. -upd©e_cÛf -( -e -, (* -cvi -). -cÛf -); - -1480 -as£¹ -(0); - -1482 - gh -. -upd©e_cÚ¡ -( -¡rideEQ -. -g‘_cÚ¡ -()); - -1485  -GEQ_I‹¿tÜ - -gi -( -c -); - ggi -; gi++) - -1486 ià((* - ggi -). -g‘_cÛf -( -v -) != 0) { - -1487 -GEQ_HªdË - -h - = -f_roÙ --> -add_GEQ -(); - -1488  -CÚ¡r_V¬s_I‹r - -cvi -(* -gi -); - gcvi -; cvi++) - -1489 (* - gcvi -). - gv¬ --> -kšd -()) { - -1490  - gIÅut_V¬ -: { - -1491  -pos - = (* -cvi -). -v¬ --> -g‘_pos™iÚ -(); - -1492 - gh -. -upd©e_cÛf -( -’fÜûd -. -£t_v¬ -( -pos -), (* -cvi -). -cÛf -); - -1495  - gExi¡s_V¬ -: - -1496  -Wždÿrd_V¬ -: { - -1497 -¡d -:: -m­ -< -V¬ŸbË_ID -, - gV¬ŸbË_ID ->:: -™”©Ü - -p - = -exi¡s_m­pšg -. -fšd -((* -cvi -). -v¬ -); - -1498 -V¬ŸbË_ID - - ge -; - -1499 ià( - gp - =ð -exi¡s_m­pšg -. -’d -()) { - -1500 -e - = -ã --> -deþ¬e -(); - -1501 - gexi¡s_m­pšg -[(* -cvi -). -v¬ -] = -e -; - -1504 - ge - = (* -p -). -£cÚd -; - -1505 - gh -. -upd©e_cÛf -( -e -, (* -cvi -). -cÛf -); - -1507 ià( - gæoÜ_v¬_£t -. -fšd -((* -cvi -). -v¬ -è=ð -æoÜ_v¬_£t -. -’d -()) { - -1508 -GEQ_HªdË - -h2 -; - -1509 -fšdFloÜIÃqu®™y -( -b -, (* -cvi -). -v¬ -, -h2 -, -v -); - -1510 - gæoÜ_geq_¡ack -. -push -( -¡d -:: -make_·œ -( -h2 -, (* -cvi -). -v¬ -)); - -1511 - gæoÜ_v¬_£t -. -š£¹ -((* -cvi -). -v¬ -); - -1515  - gGlob®_V¬ -: { - -1516 -Glob®_V¬_ID - -g - = (* -cvi -). -v¬ --> -g‘_glob®_v¬ -(); - -1517 -V¬ŸbË_ID - - ge -; - -1518 ià( - gg --> -¬™y -() == 0) - -1519 -e - = -’fÜûd -. -g‘_loÿl -( -g -); - -1521 - ge - = -’fÜûd -. -g‘_loÿl -( -g -, (* -cvi -). -v¬ --> -funùiÚ_of -()); - -1522 - gh -. -upd©e_cÛf -( -e -, (* -cvi -). -cÛf -); - -1526 -as£¹ -(0); - -1528 - gh -. -upd©e_cÚ¡ -((* -gi -). -g‘_cÚ¡ -()); - -1532 ! - gæoÜ_geq_¡ack -. -em±y -()) { - -1533 - g¡d -:: -·œ -< -GEQ_HªdË -, - gV¬ŸbË_ID -> - gp - = -æoÜ_geq_¡ack -. -tÝ -(); - -1534 - gæoÜ_geq_¡ack -. -pÝ -(); - -1536 -GEQ_HªdË - - gh1 - = -f_roÙ --> -add_GEQ -(); - -1537 -GEQ_HªdË - - gh2 - = -f_roÙ --> -add_GEQ -(); - -1538  -CÚ¡r_V¬s_I‹r - -cvi -( -p -. -fœ¡ -); - gcvi -; cvi++) { - -1539 (* - gcvi -). - gv¬ --> -kšd -()) { - -1540  - gIÅut_V¬ -: { - -1541  -pos - = (* -cvi -). -v¬ --> -g‘_pos™iÚ -(); - -1542 - gh1 -. -upd©e_cÛf -( -’fÜûd -. -šput_v¬ -( -pos -), (* -cvi -). -cÛf -); - -1543 - gh2 -. -upd©e_cÛf -( -’fÜûd -. -šput_v¬ -( -pos -), -(* -cvi -). -cÛf -); - -1546  - gExi¡s_V¬ -: - -1547  -Wždÿrd_V¬ -: { - -1548 -¡d -:: -m­ -< -V¬ŸbË_ID -, - gV¬ŸbË_ID ->:: -™”©Ü - -p2 - = -exi¡s_m­pšg -. -fšd -((* -cvi -). -v¬ -); - -1549 -V¬ŸbË_ID - - ge -; - -1550 ià( - gp2 - =ð -exi¡s_m­pšg -. -’d -()) { - -1551 -e - = -ã --> -deþ¬e -(); - -1552 - gexi¡s_m­pšg -[(* -cvi -). -v¬ -] = -e -; - -1555 - ge - = (* -p2 -). -£cÚd -; - -1556 - gh1 -. -upd©e_cÛf -( -e -, (* -cvi -). -cÛf -); - -1557 - gh2 -. -upd©e_cÛf -( -e -, -(* -cvi -). -cÛf -); - -1559 ià( - gæoÜ_v¬_£t -. -fšd -((* -cvi -). -v¬ -è=ð -æoÜ_v¬_£t -. -’d -()) { - -1560 -GEQ_HªdË - -h3 -; - -1561 -fšdFloÜIÃqu®™y -( -b -, (* -cvi -). -v¬ -, -h3 -, -v -); - -1562 - gæoÜ_geq_¡ack -. -push -( -¡d -:: -make_·œ -( -h3 -, (* -cvi -). -v¬ -)); - -1563 - gæoÜ_v¬_£t -. -š£¹ -((* -cvi -). -v¬ -); - -1567  - gGlob®_V¬ -: { - -1568 -Glob®_V¬_ID - -g - = (* -cvi -). -v¬ --> -g‘_glob®_v¬ -(); - -1569 -V¬ŸbË_ID - - ge -; - -1570 ià( - gg --> -¬™y -() == 0) - -1571 -e - = -’fÜûd -. -g‘_loÿl -( -g -); - -1573 - ge - = -’fÜûd -. -g‘_loÿl -( -g -, (* -cvi -). -v¬ --> -funùiÚ_of -()); - -1574 - gh1 -. -upd©e_cÛf -( -e -, (* -cvi -). -cÛf -); - -1575 - gh2 -. -upd©e_cÛf -( -e -, -(* -cvi -). -cÛf -); - -1579 -as£¹ -(0); - -1582 - gh1 -. -upd©e_cÚ¡ -( -p -. -fœ¡ -. -g‘_cÚ¡ -()); - -1583 - gh2 -. -upd©e_cÚ¡ -(- -p -. -fœ¡ -. -g‘_cÚ¡ -()); - -1584 - gh2 -. -upd©e_cÚ¡ -(- -p -. -fœ¡ -. -g‘_cÛf -Õ. -£cÚd -)-1); - -1586 - g’fÜûd -. -sim¶ify -(); - -1588 -CG_ouutR•r - * - g¡R•r - = -NULL -; - -1589 ià( - g¡• - != 1) - -1590 -¡R•r - = -ocg --> -C»©eIÁ -( -abs -( -¡• -)); - -1591 -CG_ouutR•r - * - gšdexR•r - = -ouutId’t -( -ocg -, -b -, -v -, -assigÃd_Ú_the_æy -); - -1592 -CG_ouutR•r - * - gù¾R•r - = -ocg --> -C»©eInduùive -( -šdexR•r -, -lbR•r -, -ubR•r -, -¡R•r -); - -1594  - g¡d -:: -make_·œ -( -ù¾R•r -, -Œue -); - -1599 -R–©iÚ - -´ojeù_Úto_Ëv–s -(R–©iÚ -R -,  -Ï¡_Ëv– -, -boÞ - -wždÿrds -) { - -1600 -as£¹ -( -Ï¡_Ëv– - >ð0 && -R -. -is_£t -(è&&†a¡_Ëv– <ðR. -n_£t -()); - -1601 ià( - gÏ¡_Ëv– - =ð -R -. -n_£t -())  R; - -1603  - gÜig_v¬s - = -R -. -n_£t -(); - -1604  - gnum_´ojeùed - = -Üig_v¬s - - -Ï¡_Ëv– -; - -1605 - gR - = -Ex‹nd_S‘ -( -R -, -num_´ojeùed - - -1607 -M­pšg - - gm1 - = M­pšg:: -Id’t™y -( -R -. -n_£t -()); - -1609  - gi -= -Ï¡_Ëv– -+1; i <ð -Üig_v¬s -; i++) { - -1610 - gm1 -. -£t_m­ -( -S‘_V¬ -, -i -, -Exi¡s_V¬ -, i); - -1611 - gm1 -. -£t_m­ -( -S‘_V¬ -, -i -+ -num_´ojeùed -, Set_Var, i); - -1614 -M­R–1 -( -R -, -m1 -, -Comb_Id -); - -1615 - gR -. -fš®ize -(); - -1616 - gR -. -sim¶ify -(); - -1617 ià(! - gwždÿrds -) - -1618 - gR - = -Aµroxim©e -( -R -,1); - -1619 -as£¹ -( -R -. -is_£t -()); - -1620  - gR -; - -1627 -boÞ - -boundH™sSŒide -(cÚ¡ -GEQ_HªdË - & -g -, -V¬ŸbË_ID - -v -, - -1628 cÚ¡ -EQ_HªdË - & -¡rideEQ -, - -1629 -cÛf_t - , - -1630 -R–©iÚ - -known -) { - -1635 -cÛf_t - - gm - = -g -. -g‘_cÛf -( -v -); - -1636 -R–©iÚ - -‹¡ -( -known -. -n_£t -()); - -1637 -F_Exi¡s - * - ge - = -‹¡ -. -add_exi¡s -(); - -1638 -V¬ŸbË_ID - - g®pha - = -e --> -deþ¬e -(); - -1639 -F_And - * - ga - = -e --> -add_ªd -(); - -1640 -EQ_HªdË - - gh - = -a --> -add_EQ -(); - -1641  -CÚ¡r_V¬s_I‹r - -I -( -g -, -çl£ -); - gI -; I++) - -1642 if((* - gI -). - gv¬ - !ð -v -) { - -1643 if((* -I -). -v¬ --> -kšd -(è!ð -Glob®_V¬ -) - -1644 -h -. -upd©e_cÛf -((* -I -). -v¬ -, (*I). -cÛf -); - -1646 - gh -. -upd©e_cÛf -( -‹¡ -. -g‘_loÿl -((* -I -). -v¬ --> -g‘_glob®_v¬ -()), (*I). -cÛf -); - -1649 - gh -. -upd©e_cÚ¡ -( -g -. -g‘_cÚ¡ -()); - -1650 - gh -. -upd©e_cÛf -( -®pha -, -m -); - -1651 ià(!( -Gi¡ -( -‹¡ -, -cÝy -( -known -)). -is_obvious_utÞogy -())) - -1652  - gçl£ -; - -1654 -R–©iÚ - - gboundR– - = -known -; - -1655 - gboundR– -. -ªd_w™h_EQ -( -g -); - -1656 -R–©iÚ - -¡rideR– -( -known -. -n_£t -()); - -1657 - g¡rideR– -. -ªd_w™h_EQ -( -¡rideEQ -); - -1658  -Gi¡ -( -¡rideR– -, -boundR– -). -is_obvious_utÞogy -(); - -1663 -boÞ - -isSim¶eSŒide -(cÚ¡ -EQ_HªdË - & -g -, -V¬ŸbË_ID - -v -) { - -1664 -EQ_HªdË - - ggg - = -g -; - -1666 -boÞ - - gis_sim¶e -= -Œue -; - -1667  -CÚ¡r_V¬s_I‹r - -cvi -( -gg -, -çl£ -); - gcvi - && - gis_sim¶e -; cvi++) - -1668 - gis_sim¶e - = ((* -cvi -). -cÛf - =ð0 || (*cvi). -v¬ - =ð -v - - -1669 || (* -cvi -). -v¬ --> -kšd -(è=ð -Wždÿrd_V¬ -); - -1670  - gis_sim¶e -; - -1674  -couÁSŒides -( -CÚjunù - * -c -, -V¬ŸbË_ID - -v -, -EQ_HªdË - & -¡rideEQ -, - -1675 -boÞ - & -sim¶e -) { - -1676  - g¡rides -=0; - -1677  -EQ_I‹¿tÜ - -G -( -c -); - gG -; G++) - -1678  -CÚ¡r_V¬s_I‹r - -I -(* -G -, -Œue -); - gI -; I++) - -1679 ià(((* - gI -). - gcÛf - !ð0è&& (* -G -). -g‘_cÛf -( -v -) != 0) { - -1680 -¡rides -++; - -1681 - gsim¶e - = -isSim¶eSŒide -(* -G -, -v -); - -1682 - g¡rideEQ - = * -G -; - -1685  - g¡rides -; - -1688 - gÇme¥aû - { - -1690 -boÞ - -hasEQ -( -R–©iÚ - -r -,  -Ëv– -) { - -1691 - gr -. -sim¶ify -(); - -1692 -V¬ŸbË_ID - - gv - = -£t_v¬ -( -Ëv– -); - -1693 -CÚjunù - * - gs_cÚj - = -r -. -sšgË_cÚjunù -(); - -1694  -EQ_I‹¿tÜ - -G -( -s_cÚj -); - gG -; G++) - -1695 ià((* - gG -). -g‘_cÛf -( -v -)) - -1696  - gŒue -; - -1697  - gçl£ -; - -1702  -R–©iÚ - -pickEQ -(R–©iÚ -r -,  -Ëv– -) { - -1703 - gr -. -sim¶ify -(); - -1704 -V¬ŸbË_ID - - gv - = -£t_v¬ -( -Ëv– -); - -1705 -CÚjunù - * - gs_cÚj - = -r -. -sšgË_cÚjunù -(); - -1706  -EQ_I‹¿tÜ - -E -( -s_cÚj -); - gE -; E++) - -1707 ià((* - gE -). -g‘_cÛf -( -v -)) { - -1708 -R–©iÚ - -‹¡_»l -( -r -. -n_£t -()); - -1709 - g‹¡_»l -. -ªd_w™h_EQ -(* -E -); - -1710  - g‹¡_»l -; - -1712 -as£¹ -(0); - -1713  - gr -; - -1717 -R–©iÚ - -pickBound -(R–©iÚ -r -,  -Ëv– -,  -UB -) { - -1718 - gr -. -sim¶ify -(); - -1719 -V¬ŸbË_ID - - gv - = -£t_v¬ -( -Ëv– -); - -1720 -CÚjunù - * - gs_cÚj - = -r -. -sšgË_cÚjunù -(); - -1721  -GEQ_I‹¿tÜ - -G -( -s_cÚj -); - gG -; G++) { - -1722 ià(( - gUB - && (* - gG -). -g‘_cÛf -( -v -) < 0) - -1723 || (! - gUB - && (* - gG -). -g‘_cÛf -( -v -) > 0) ) { - -1724 -R–©iÚ - -‹¡_»l -( -r -. -n_£t -()); - -1725 - g‹¡_»l -. -ªd_w™h_GEQ -(* -G -); - -1726  - g‹¡_»l -; - -1729  -EQ_I‹¿tÜ - -E -( -s_cÚj -); - gE -; E++) { - -1730 ià((* - gE -). -g‘_cÛf -( -v -)) { - -1731 -R–©iÚ - -‹¡_»l -( -r -. -n_£t -()); - -1732 - g‹¡_»l -. -ªd_w™h_GEQ -(* -E -); - -1733 ià(( - gUB - && (* - gE -). -g‘_cÛf -( -v -) > 0) - -1734 || (! - gUB - && (* - gE -). -g‘_cÛf -( -v -) < 0) ) - -1735 - g‹¡_»l - = -Com¶em’t -( -‹¡_»l -); - -1736  - g‹¡_»l -; - -1739 -as£¹ -(0); - -1740  - gr -; - -1745 -R–©iÚ - -pickOv”h—d -(R–©iÚ -r -,  -liáTo -) { - -1746 - gr -. -sim¶ify -(); - -1747 -CÚjunù - * - gs_cÚj - = -r -. -sšgË_cÚjunù -(); - -1748  -GEQ_I‹¿tÜ - -G -( -s_cÚj -); - gG -; G++) { - -1749 -R–©iÚ - -‹¡_»l -( -r -. -n_£t -()); - -1750 - g‹¡_»l -. -ªd_w™h_GEQ -(* -G -); - -1751 -V¬ŸbË_ID - - gv -; - -1752 -cÛf_t - - gpos - = -1; - -1753 -cÛf_t - - gc -= 0; - -1754  -CÚ¡r_V¬s_I‹r - -cvi -(* -G -, -çl£ -); - gcvi -; cvi++) - -1755 ià((* - gcvi -). - gcÛf - && (*cvi). - gv¬ --> -kšd -(è=ð -IÅut_V¬ - - -1756 && (* -cvi -). -v¬ --> -g‘_pos™iÚ -(è> -pos -) { - -1757 -v - = (* -cvi -). -v¬ -; - -1758 - gpos - = (* -cvi -). -v¬ --> -g‘_pos™iÚ -(); - -1759 - gc - = (* -cvi -). -cÛf -; - -1762 -årštf -( -DebugFže -,"Coef = %d, constraint = %s\n", - -1763 -c -,(cÚ¡ *) -‹¡_»l -. -´št_fÜmuÏ_to_¡ršg -()); - -1765  - g‹¡_»l -; - -1767  -EQ_I‹¿tÜ - -E -( -s_cÚj -); - gE -; E++) { - -1768 -as£¹ -( -liáTo - >= 1); - -1769  - gpos - = -max -((* -E -). -max_tu¶e_pos -(), -max_fs_¬™y -(*E)+1); - -1773 ià((* - gE -). -has_wždÿrds -(è&& - gpos - < - gliáTo -) { - -1774 -R–©iÚ - -‹¡_»l -( -r -. -n_£t -()); - -1775 - g‹¡_»l -. -ªd_w™h_EQ -(* -E -); - -1776  - g‹¡_»l -; - -1778 ià(!(* - gE -). -has_wždÿrds -(è&& - gpos - <ð -liáTo -) { - -1779 -R–©iÚ - -‹¡_»l -( -r -. -n_£t -()); - -1780 - g‹¡_»l -. -ªd_w™h_EQ -(* -E -); - -1781 - g‹¡_»l -. -sim¶ify -(); - -1782 - g‹¡_»l - = -EQs_to_GEQs -( -‹¡_»l -, -Œue -); - -1783  -pickOv”h—d -( -‹¡_»l -, -liáTo -); - -1786 ià( - gcode_g’_debug ->1) { - -1787 -årštf -( -DebugFže -,"Could‚ot find overhead:\n"); - -1788 - gr -. -´efix_´št -( -DebugFže -); - -1790  - gR–©iÚ -:: -True -( -r -. -n_£t -()); - -1795 -boÞ - -hasBound -( -R–©iÚ - -r -,  -Ëv– -,  -UB -) { - -1796 - gr -. -sim¶ify -(); - -1797 -V¬ŸbË_ID - - gv - = -£t_v¬ -( -Ëv– -); - -1798 -CÚjunù - * - gs_cÚj - = -r -. -sšgË_cÚjunù -(); - -1799  -GEQ_I‹¿tÜ - -G -( -s_cÚj -); - gG -; G++) { - -1800 ià( - gUB - && (* - gG -). -g‘_cÛf -( -v -è< 0è - gŒue -; - -1801 ià(! - gUB - && (* - gG -). -g‘_cÛf -( -v -è> 0è - gŒue -; - -1803  -EQ_I‹¿tÜ - -E -( -s_cÚj -); - gE -; E++) { - -1804 ià((* - gE -). -g‘_cÛf -( -v -)è - gŒue -; - -1806  - gçl£ -; - -1809 -boÞ - -fšd_ªy_cÚ¡¿št -( -s -,  -Ëv– -, -R–©iÚ - & -kr -,  -dœeùiÚ -, - -1810 -R–©iÚ - & -S -, -boÞ - -­´ox -) { - -1816 -R–©iÚ - - gI - = -´ojeùed_nIS -[ -Ëv– -][ -s -]; - -1817 - gI - = -Gi¡ -( -I -, -cÝy -( -kr -)); - -1818 if( - g­´ox -è - gI - = -Aµroxim©e -( -I -); - -1819 ià( -hasBound -( -I -, -Ëv– -, -dœeùiÚ -)) { - -1820 -R–©iÚ - - gpickäom -; - -1821 if( -has_nÚ¡ride_EQ -( -I -, -Ëv– -)) - -1822 - gpickäom - = -pickEQ -( -I -, -Ëv– -); - -1824 - gpickäom - = -pickBound -( -I -, -Ëv– -, -dœeùiÚ -); - -1825 - gS - = -pickOv”h—d -( -pickäom -, -Ëv– -); - -1826 if( - gS -. -is_obvious_utÞogy -()èS = -R–©iÚ -:: -NuÎ -(); - -1827  ! - gS -. -is_nuÎ -(); - -1829  - gçl£ -; - -1833 -boÞ - -has_nÚ¡ride_EQ -( -R–©iÚ - -r -,  -Ëv– -) { - -1834 - gr -. -sim¶ify -(); - -1835 -V¬ŸbË_ID - - gv - = -£t_v¬ -( -Ëv– -); - -1836 -CÚjunù - * - gs_cÚj - = -r -. -sšgË_cÚjunù -(); - -1837  -EQ_I‹¿tÜ - -G -( -s_cÚj -); - gG -; G++) - -1838 ià((* - gG -). -g‘_cÛf -( -v -è&& !(*G). -has_wždÿrds -()) - -1839  - gŒue -; - -1840  - gçl£ -; - -1844 -R–©iÚ - -mšMaxOv”h—d -(R–©iÚ -r -,  -Ëv– -) { - -1845 - gr -. -fš®ize -(); - -1846 - gr -. -sim¶ify -(); - -1847 -CÚjunù - * - gs_cÚj - = -r -. -sšgË_cÚjunù -(); - -1848 -GEQ_HªdË - - gLBs -[50], - gUBs -[50]; - -1849  - gnumLBs - = 0; - -1850  - gnumUBs - = 0; - -1851 -V¬ŸbË_ID - - gv - = -£t_v¬ -( -Ëv– -); - -1852  -GEQ_I‹¿tÜ - -G -( -s_cÚj -); - gG -; G++èià((*G). -g‘_cÛf -( -v -)) { - -1853 -GEQ_HªdË - - gg - = * -G -; - -1854 ià( - gg -. -g‘_cÛf -( -v -è> 0è - gLBs -[ -numLBs -++] = -g -; - -1855 - gUBs -[ -numUBs -++] = -g -; - -1857 ià( - gnumLBs - <ð1 && -numUBs - <= 1) { - -1858  -R–©iÚ -:: -True -( -r -. -n_£t -()); - -1860 -R–©iÚ - -r1 -( -r -. -n_£t -()); - -1861 -R–©iÚ - -r2 -( -r -. -n_£t -()); - -1862 ià( - gnumLBs - > 1) { - -1864 - gr1 -. -ªd_w™h_GEQ -( -LBs -[0]); - -1865 - gr2 -. -ªd_w™h_GEQ -( -LBs -[1]); - -1866 - gr1 - = -´ojeù_Úto_Ëv–s -( -Difã»nû -( -r1 -, -r2 -), -Ëv– --1,0); - -1870 - gr1 -. -ªd_w™h_GEQ -( -UBs -[0]); - -1871 - gr2 -. -ªd_w™h_GEQ -( -UBs -[1]); - -1872 - gr1 - = -´ojeù_Úto_Ëv–s -( -Difã»nû -( -r1 -, -r2 -), -Ëv– --1,0); - -1875 -årštf -( -DebugFže -,"Te¡šg %s\n",(cÚ¡ *) -r1 -. -´št_fÜmuÏ_to_¡ršg -()); - -1876 -årštf -( -DebugFže -,"wžÈ»moved ov”h—d oÀbound oàt%d: %s\n", -Ëv– -, - -1877 (cÚ¡ *) -r -. -´št_fÜmuÏ_to_¡ršg -()); - -1880  -pickOv”h—d -( -r1 -, -1); - -1883 - g¡d -:: -·œ -< -EQ_HªdË -, > -fšd_sim¶e¡_assignm’t -(cÚ¡ -R–©iÚ - & -R_ -, -V¬ŸbË_ID - -v -, cÚ¡ -¡d -:: -veùÜ -< -CG_ouutR•r - *> & -assigÃd_Ú_the_æy -) { - -1884 -R–©iÚ - & -R - = -cÚ¡_ÿ¡ -( -R_ -); - -1885 -CÚjunù - * - gc - = -R -. -sšgË_cÚjunù -(); - -1887  - gmš_co¡ - = -INT_MAX -; - -1888 -EQ_HªdË - - geq -; - -1889  -EQ_I‹¿tÜ - -ei -( -c --> -EQs -()); - gei -;ƒi++) - -1890 ià(!(* - gei -). -has_wždÿrds -(è&& (*ei). -g‘_cÛf -( -v -) != 0) { - -1891  -co¡ - = 0; - -1893 ià( -abs -((* -ei -). -g‘_cÛf -( -v -)) != 1) - -1894 -co¡ - += 4; - -1896  - gnum_v¬ - = 0; - -1897  -CÚ¡r_V¬s_I‹r - -cvi -(* -ei -); - gcvi -; cvi++) - -1898 ià((* - gcvi -). - gv¬ - !ð -v -) { - -1899 -num_v¬ -++; - -1900 ià((* - gcvi -). - gv¬ --> -kšd -(è=ð -Glob®_V¬ - && (* -cvi -). -v¬ --> -g‘_glob®_v¬ -()-> -¬™y -() > 0) { - -1901 -co¡ - += 10; - -1903 ià( -abs -((* -cvi -). -cÛf -) != 1) - -1904 -co¡ - += 2; - -1905 ià((* - gcvi -). - gv¬ --> -kšd -(è=ð -IÅut_V¬ - && -assigÃd_Ú_the_æy -[(* -cvi -). -v¬ --> -g‘_pos™iÚ -()-1] !ð -NULL -) { - -1906 -co¡ - += 5; - -1909 ià((* - gei -). -g‘_cÚ¡ -() != 0) - -1910 -num_v¬ -++; - -1911 ià( - gnum_v¬ - > 1) - -1912 - gco¡ - +ð -num_v¬ - - 1; - -1914 ià( - gco¡ - < - gmš_co¡ -) { - -1915 - gmš_co¡ - = -co¡ -; - -1916 - geq - = * -ei -; - -1920  - g¡d -:: -make_·œ -( -eq -, -mš_co¡ -); - -1923  -max_fs_¬™y -(cÚ¡ -CÚ¡¿št_HªdË - & -c -) { - -1924  - gmax_¬™y -=0; - -1925  -CÚ¡r_V¬s_I‹r - -cv -( -c -); - gcv -; cv++) - -1926 if((* - gcv -). - gv¬ --> -kšd -(è=ð -Glob®_V¬ -) - -1927 -max_¬™y - = -max -(max_¬™y,(* -cv -). -v¬ --> -g‘_glob®_v¬ -()-> -¬™y -()); - -1928  - gmax_¬™y -; - - @/usr/include/math.h - -25 #iâdef -_MATH_H - - -26  - #_MATH_H - 1 - - ) - -28  - ~<ã©u»s.h -> - -30 - g__BEGIN_DECLS - - -34  - ~ - -35 #ifdeà -__USE_ISOC99 - - -36  - ~ - -37  - ~ - -40  - ~ - -43  - ~ - -47  - ~ - -54  - #__MATHCALL -( -funùiÚ -, -suffix -, -¬gs -) \ - -55 - `__MATHDECL - ( -_MdoubË_ -, -funùiÚ -, -suffix -, -¬gs -) - - ) - -56  - #__MATHDECL -( -ty³ -, -funùiÚ -, -suffix -, -¬gs -) \ - -57 - `__MATHDECL_1 -( -ty³ -, -funùiÚ -, -suffix -, -¬gs -); \ - -58 - `__MATHDECL_1 -( -ty³ -, - `__CONCAT -( -__ -, -funùiÚ -), -suffix -, -¬gs -) - - ) - -59  - #__MATHCALLX -( -funùiÚ -, -suffix -, -¬gs -, -©Œib -) \ - -60 - `__MATHDECLX - ( -_MdoubË_ -, -funùiÚ -, -suffix -, -¬gs -, -©Œib -) - - ) - -61  - #__MATHDECLX -( -ty³ -, -funùiÚ -, -suffix -, -¬gs -, -©Œib -) \ - -62 - `__MATHDECL_1 -( -ty³ -, -funùiÚ -, -suffix -, -¬gs -è - `__©Œibu‹__ - ( -©Œib -); \ - -63 - `__MATHDECL_1 -( -ty³ -, - `__CONCAT -( -__ -, -funùiÚ -), -suffix -, -¬gs -è - `__©Œibu‹__ - ( -©Œib -) - - ) - -64  - #__MATHDECL_1 -( -ty³ -, -funùiÚ -, -suffix -, -¬gs -) \ - -65 -ty³ - - `__MATH_PRECNAME -( -funùiÚ -, -suffix -è -¬gs - -__THROW - - - ) - -67  - #_MdoubË_ -  - - ) - -68  - #__MATH_PRECNAME -( -Çme -, -r -è - `__CONCAT -Òame,r) - - ) - -69  - #_MdoubË_BEGIN_NAMESPACE - -__BEGIN_NAMESPACE_STD - - - ) - -70  - #_MdoubË_END_NAMESPACE - -__END_NAMESPACE_STD - - - ) - -71  - ~ - -72 #undeà -_MdoubË_ - - -73 #undeà -_MdoubË_BEGIN_NAMESPACE - - -74 #undeà -_MdoubË_END_NAMESPACE - - -75 #undeà -__MATH_PRECNAME - - -77 #ià -defšed - -__USE_MISC - || defšed -__USE_ISOC99 - - -83 #iâdeà -_Mæßt_ - - -84  - #_Mæßt_ -  - - ) - -86  - #_MdoubË_ - -_Mæßt_ - - - ) - -87 #ifdeà -__STDC__ - - -88  - #__MATH_PRECNAME -( -Çme -, -r -èÇme## -f -## - ) -r - -90  - #__MATH_PRECNAME -( -Çme -, -r -èÇm -f - - ) -r - -92  - #_MdoubË_BEGIN_NAMESPACE - -__BEGIN_NAMESPACE_C99 - - - ) - -93  - #_MdoubË_END_NAMESPACE - -__END_NAMESPACE_C99 - - - ) - -94  - ~ - -95 #undeà -_MdoubË_ - - -96 #undeà -_MdoubË_BEGIN_NAMESPACE - - -97 #undeà -_MdoubË_END_NAMESPACE - - -98 #undeà -__MATH_PRECNAME - - -100 #ià( -__STDC__ - - 0 || -__GNUC__ - - 0) \ - -101 && (! -defšed - -__NO_LONG_DOUBLE_MATH - \ - -102 || -defšed - -__LDBL_COMPAT - \ - -103 || ! -defšed - -_LIBC -) - -104 #ifdeà -__LDBL_COMPAT - - -106 #ifdeà -__USE_ISOC99 - - -107  - $__Ædbl_Ãx‰ow¬df - ( -__x -,  -__y -) - -108 -__THROW - - `__©Œibu‹__ - (( -__cÚ¡__ -)); - -109 #ifdeà -__REDIRECT_NTH - - -110  - `__REDIRECT_NTH - ( -Ãx‰ow¬df -, ( -__x -,  -__y -), - -111 -__Ædbl_Ãx‰ow¬df -) - -112 - `__©Œibu‹__ - (( -__cÚ¡__ -)); - -113  - `__REDIRECT_NTH - ( -Ãx‰ow¬d -, ( -__x -,  -__y -), - -114 -Ãxá” -è - `__©Œibu‹__ - (( -__cÚ¡__ -)); - -115  - `__REDIRECT_NTH - ( -Ãx‰ow¬dl -, - -116 ( -__x -,  -__y -), - -117 -Ãxá” -è - `__©Œibu‹__ - (( -__cÚ¡__ -)); - -122 #ià -defšed - -__LDBL_COMPAT - || defšed -__NO_LONG_DOUBLE_MATH - - -124 #undeà -__MATHDECL_1 - - -125  - #__MATHDECL_2 -( -ty³ -, -funùiÚ -, -suffix -, -¬gs -, -®Ÿs -) \ - -126 -ty³ - - `__REDIRECT_NTH -( - `__MATH_PRECNAME -( -funùiÚ -, -suffix -), \ - -127 -¬gs -, -®Ÿs -) - - ) - -128  - #__MATHDECL_1 -( -ty³ -, -funùiÚ -, -suffix -, -¬gs -) \ - -129 - `__MATHDECL_2 -( -ty³ -, -funùiÚ -, -suffix -, -¬gs -, - `__CONCAT -(funùiÚ,suffix)) - - ) - -134 #iâdeà -_MlÚg_doubË_ - - -135  - #_MlÚg_doubË_ -  - - ) - -137  - #_MdoubË_ - -_MlÚg_doubË_ - - - ) - -138 #ifdeà -__STDC__ - - -139  - #__MATH_PRECNAME -( -Çme -, -r -èÇme## -l -## - ) -r - -141  - #__MATH_PRECNAME -( -Çme -, -r -èÇm -l - - ) -r - -143  - #_MdoubË_BEGIN_NAMESPACE - -__BEGIN_NAMESPACE_C99 - - - ) - -144  - #_MdoubË_END_NAMESPACE - -__END_NAMESPACE_C99 - - - ) - -145  - ~ - -146 #undeà -_MdoubË_ - - -147 #undeà -_MdoubË_BEGIN_NAMESPACE - - -148 #undeà -_MdoubË_END_NAMESPACE - - -149 #undeà -__MATH_PRECNAME - - -154 #undeà -__MATHDECL_1 - - -155 #undeà -__MATHDECL - - -156 #undeà -__MATHCALL - - -159 #ià -defšed - -__USE_MISC - || defšed -__USE_XOPEN - - -161  -signgam -; - -166 #ifdeà -__USE_ISOC99 - - -204 -FP_NAN -, - -205  - #FP_NAN - -FP_NAN - - - ) - -206 -FP_INFINITE -, - -207  - #FP_INFINITE - -FP_INFINITE - - - ) - -208 -FP_ZERO -, - -209  - #FP_ZERO - -FP_ZERO - - - ) - -210 -FP_SUBNORMAL -, - -211  - #FP_SUBNORMAL - -FP_SUBNORMAL - - - ) - -212 -FP_NORMAL - - -213  - #FP_NORMAL - -FP_NORMAL - - - ) - -217 #ifdeà -__NO_LONG_DOUBLE_MATH - - -218  - #åþassify -( -x -) \ - -219 ( ( -x -è=ð (è? - `__åþassifyf - (xè: - `__åþassify - (x)) - - ) - -221  - #åþassify -( -x -) \ - -222 ( ( -x -) ==  () \ - -223 ? - `__åþassifyf - ( -x -) \ - -224 :  ( -x -) ==  () \ - -225 ? - `__åþassify - ( -x -è: - `__åþassifyl - (x)) - - ) - -229 #ifdeà -__NO_LONG_DOUBLE_MATH - - -230  - #signb™ -( -x -) \ - -231 ( ( -x -è=ð (è? - `__signb™f - (xè: - `__signb™ - (x)) - - ) - -233  - #signb™ -( -x -) \ - -234 ( ( -x -) ==  () \ - -235 ? - `__signb™f - ( -x -) \ - -236 :  ( -x -) ==  () \ - -237 ? - `__signb™ - ( -x -è: - `__signb™l - (x)) - - ) - -241 #ifdeà -__NO_LONG_DOUBLE_MATH - - -242  - #isfš™e -( -x -) \ - -243 ( ( -x -è=ð (è? - `__fš™ef - (xè: - `__fš™e - (x)) - - ) - -245  - #isfš™e -( -x -) \ - -246 ( ( -x -) ==  () \ - -247 ? - `__fš™ef - ( -x -) \ - -248 :  ( -x -) ==  () \ - -249 ? - `__fš™e - ( -x -è: - `__fš™– - (x)) - - ) - -253  - #i¢Üm® -( -x -è( - `åþassify - (xè=ð -FP_NORMAL -) - - ) - -257 #ifdeà -__NO_LONG_DOUBLE_MATH - - -258  - #i¢ª -( -x -) \ - -259 ( ( -x -è=ð (è? - `__i¢ªf - (xè: - `__i¢ª - (x)) - - ) - -261  - #i¢ª -( -x -) \ - -262 ( ( -x -) ==  () \ - -263 ? - `__i¢ªf - ( -x -) \ - -264 :  ( -x -) ==  () \ - -265 ? - `__i¢ª - ( -x -è: - `__i¢ªl - (x)) - - ) - -269 #ifdeà -__NO_LONG_DOUBLE_MATH - - -270  - #isšf -( -x -) \ - -271 ( ( -x -è=ð (è? - `__isšff - (xè: - `__isšf - (x)) - - ) - -273  - #isšf -( -x -) \ - -274 ( ( -x -) ==  () \ - -275 ? - `__isšff - ( -x -) \ - -276 :  ( -x -) ==  () \ - -277 ? - `__isšf - ( -x -è: - `__isšæ - (x)) - - ) - -281  - #MATH_ERRNO - 1 - - ) - -282  - #MATH_ERREXCEPT - 2 - - ) - -287 #iâdeà -__FAST_MATH__ - - -288  - #m©h_”rhªdlšg - ( -MATH_ERRNO - | -MATH_ERREXCEPT -) - - ) - -293 #ifdef -__USE_MISC - - -297 -_IEEE_ - = -1, - -298 -_SVID_ -, - -299 -_XOPEN_ -, - -300 -_POSIX_ -, - -301 -_ISOC_ - - -302 } - t_LIB_VERSION_TYPE -; - -307 -_LIB_VERSION_TYPE - -_LIB_VERSION -; - -311 #ifdeà -__USE_SVID - - -317 #ifdeà -__ýlu¥lus - - -318  -__exû±iÚ - - -320  -exû±iÚ - - -323  -ty³ -; - -324 * -Çme -; - -325  -¬g1 -; - -326  -¬g2 -; - -327  -»tv® -; - -328 - } -}; - -330 #ifdeà -__ýlu¥lus - - -331  - $m©h”r - ( -__exû±iÚ - * -__exc -è - `throw - (); - -333  - `m©h”r - ( -exû±iÚ - * -__exc -); - -336  - #X_TLOSS - 1.41484755040568800000e+16 - - ) - -339  - #DOMAIN - 1 - - ) - -340  - #SING - 2 - - ) - -341  - #OVERFLOW - 3 - - ) - -342  - #UNDERFLOW - 4 - - ) - -343  - #TLOSS - 5 - - ) - -344  - #PLOSS - 6 - - ) - -347  - #HUGE - 3.40282347e+38F - - ) - -351 #ifdeà -__USE_XOPEN - - -353  - #MAXFLOAT - 3.40282347e+38F - - ) - -360 #ià -defšed - -__USE_BSD - || defšed -__USE_XOPEN - - -361  - #M_E - 2.7182818284590452354 - - ) - -362  - #M_LOG2E - 1.4426950408889634074 - - ) - -363  - #M_LOG10E - 0.43429448190325182765 - - ) - -364  - #M_LN2 - 0.69314718055994530942 - - ) - -365  - #M_LN10 - 2.30258509299404568402 - - ) - -366  - #M_PI - 3.14159265358979323846 - - ) - -367  - #M_PI_2 - 1.57079632679489661923 - - ) - -368  - #M_PI_4 - 0.78539816339744830962 - - ) - -369  - #M_1_PI - 0.31830988618379067154 - - ) - -370  - #M_2_PI - 0.63661977236758134308 - - ) - -371  - #M_2_SQRTPI - 1.12837916709551257390 - - ) - -372  - #M_SQRT2 - 1.41421356237309504880 - - ) - -373  - #M_SQRT1_2 - 0.70710678118654752440 - - ) - -379 #ifdeà -__USE_GNU - - -380  - #M_El - 2.7182818284590452353602874713526625L - - ) - -381  - #M_LOG2El - 1.4426950408889634073599246810018921L - - ) - -382  - #M_LOG10El - 0.4342944819032518276511289189166051L - - ) - -383  - #M_LN2l - 0.6931471805599453094172321214581766L - - ) - -384  - #M_LN10l - 2.3025850929940456840179914546843642L - - ) - -385  - #M_PIl - 3.1415926535897932384626433832795029L - - ) - -386  - #M_PI_2l - 1.5707963267948966192313216916397514L - - ) - -387  - #M_PI_4l - 0.7853981633974483096156608458198757L - - ) - -388  - #M_1_PIl - 0.3183098861837906715377675267450287L - - ) - -389  - #M_2_PIl - 0.6366197723675813430755350534900574L - - ) - -390  - #M_2_SQRTPIl - 1.1283791670955125738961589031215452L - - ) - -391  - #M_SQRT2l - 1.4142135623730950488016887242096981L - - ) - -392  - #M_SQRT1_2l - 0.7071067811865475244008443621048490L - - ) - -399 #ià -defšed - -__STRICT_ANSI__ - && !defšed -__NO_MATH_INLINES - - -400  - #__NO_MATH_INLINES - 1 - - ) - -403 #ià -defšed - -__USE_ISOC99 - && - `__GNUC_PREREQ -(2,97) - -410  - #isg»©” -( -x -, -y -è - `__bužtš_isg»©” -(x, y) - - ) - -411  - #isg»©”equ® -( -x -, -y -è - `__bužtš_isg»©”equ® -(x, y) - - ) - -412  - #i¦ess -( -x -, -y -è - `__bužtš_i¦ess -(x, y) - - ) - -413  - #i¦es£qu® -( -x -, -y -è - `__bužtš_i¦es£qu® -(x, y) - - ) - -414  - #i¦essg»©” -( -x -, -y -è - `__bužtš_i¦essg»©” -(x, y) - - ) - -415  - #isunÜd”ed -( -u -, -v -è - `__bužtš_isunÜd”ed -(u, v) - - ) - -419 #ifdeà -__USE_EXTERN_INLINES - - -420  - ~ - -423 #ifdeà -__USE_ISOC99 - - -427 #iâdeà -isg»©” - - -428  - #isg»©” -( -x -, -y -) \ - -429 ( -__ex‹nsiÚ__ - \ - -430 ({ - `__ty³of__ -( -x -è -__x - = (x); __ty³of__( -y -è -__y - = (y); \ - -431 ! - `isunÜd”ed - ( -__x -, -__y -è&& __x > __y; - } -})) - - ) - -435 #iâdeà -isg»©”equ® - - -436  - #isg»©”equ® -( -x -, -y -) \ - -437 ( -__ex‹nsiÚ__ - \ - -438 ({ - `__ty³of__ -( -x -è -__x - = (x); __ty³of__( -y -è -__y - = (y); \ - -439 ! - `isunÜd”ed - ( -__x -, -__y -è&& __x >ð__y; })) - - ) - -443 #iâdeà -i¦ess - - -444  - #i¦ess -( -x -, -y -) \ - -445 ( -__ex‹nsiÚ__ - \ - -446 ({ - `__ty³of__ -( -x -è -__x - = (x); __ty³of__( -y -è -__y - = (y); \ - -447 ! - `isunÜd”ed - ( -__x -, -__y -è&& __x < __y; })) - - ) - -451 #iâdeà -i¦es£qu® - - -452  - #i¦es£qu® -( -x -, -y -) \ - -453 ( -__ex‹nsiÚ__ - \ - -454 ({ - `__ty³of__ -( -x -è -__x - = (x); __ty³of__( -y -è -__y - = (y); \ - -455 ! - `isunÜd”ed - ( -__x -, -__y -è&& __x <ð__y; })) - - ) - -459 #iâdeà -i¦essg»©” - - -460  - #i¦essg»©” -( -x -, -y -) \ - -461 ( -__ex‹nsiÚ__ - \ - -462 ({ - `__ty³of__ -( -x -è -__x - = (x); __ty³of__( -y -è -__y - = (y); \ - -463 ! - `isunÜd”ed - ( -__x -, -__y -è&& (__x < __y || __y < __x); })) - - ) - -467 #iâdeà -isunÜd”ed - - -468  - #isunÜd”ed -( -u -, -v -) \ - -469 ( -__ex‹nsiÚ__ - \ - -470 ({ - `__ty³of__ -( -u -è -__u - = (u); __ty³of__( -v -è -__v - = (v); \ - -471 - `åþassify - ( -__u -è=ð -FP_NAN - || fpþassify ( -__v -è=ðFP_NAN; })) - - ) - -476 - g__END_DECLS - - - @/usr/include/stdio.h - -24 #iâdeà -_STDIO_H - - -26 #ià! -defšed - -__Ãed_FILE - && !defšed -__Ãed___FILE - - -27  - #_STDIO_H - 1 - - ) - -28  - ~<ã©u»s.h -> - -30 - g__BEGIN_DECLS - - -32  - #__Ãed_size_t - - - ) - -33  - #__Ãed_NULL - - - ) - -34  - ~<¡ddef.h -> - -36  - ~ - -37  - #__Ãed_FILE - - - ) - -38  - #__Ãed___FILE - - - ) - -42 #ià! -defšed - -__FILE_defšed - && defšed -__Ãed_FILE - - -45  - g_IO_FILE -; - -47 -__BEGIN_NAMESPACE_STD - - -49  -_IO_FILE - - tFILE -; - -50 - g__END_NAMESPACE_STD - - -51 #ià -defšed - -__USE_LARGEFILE64 - || defšed -__USE_SVID - || defšed -__USE_POSIX - \ - -52 || -defšed - - g__USE_BSD - || defšed - g__USE_ISOC99 - || defšed - g__USE_XOPEN - \ - -53 || -defšed - -__USE_POSIX2 - - -54 - $__USING_NAMESPACE_STD -( -FILE -) - -57  - #__FILE_defšed - 1 - - ) - -59 #undeà -__Ãed_FILE - - -62 #ià! -defšed - -____FILE_defšed - && defšed -__Ãed___FILE - - -65  -_IO_FILE - - t__FILE -; - -67  - #____FILE_defšed - 1 - - ) - -69 #undeà -__Ãed___FILE - - -72 #ifdef -_STDIO_H - - -73  - #_STDIO_USES_IOSTREAM - - - ) - -75  - ~ - -77 #ifdeà -__USE_XOPEN - - -78 #ifdeà -__GNUC__ - - -79 #iâdeà -_VA_LIST_DEFINED - - -80  -_G_va_li¡ - - tva_li¡ -; - -81  - #_VA_LIST_DEFINED - - - ) - -84  - ~<¡d¬g.h -> - -89 -__BEGIN_NAMESPACE_STD - - -90 #iâdeà -__USE_FILE_OFFSET64 - - -91  -_G_åos_t - - tåos_t -; - -93  -_G_åos64_t - - tåos_t -; - -95 -__END_NAMESPACE_STD - - -96 #ifdeà -__USE_LARGEFILE64 - - -97  -_G_åos64_t - - tåos64_t -; - -101  - #_IOFBF - 0 - - ) - -102  - #_IOLBF - 1 - - ) - -103  - #_IONBF - 2 - - ) - -107 #iâdeà -BUFSIZ - - -108  - #BUFSIZ - -_IO_BUFSIZ - - - ) - -114 #iâdeà -EOF - - -115  - #EOF - (-1) - - ) - -121  - #SEEK_SET - 0 - - ) - -122  - #SEEK_CUR - 1 - - ) - -123  - #SEEK_END - 2 - - ) - -126 #ià -defšed - -__USE_SVID - || defšed -__USE_XOPEN - - -128  - #P_tmpdœ - "/tmp" - - ) - -141  - ~ - -145  -_IO_FILE - * -¡dš -; - -146  -_IO_FILE - * -¡dout -; - -147  -_IO_FILE - * -¡d”r -; - -149  - #¡dš - -¡dš - - - ) - -150  - #¡dout - -¡dout - - - ) - -151  - #¡d”r - -¡d”r - - - ) - -153 -__BEGIN_NAMESPACE_STD - - -155  - $»move - ( -__cÚ¡ - * -__fž’ame -è -__THROW -; - -157  - $»Çme - ( -__cÚ¡ - * -__Þd -, __cÚ¡ * -__Ãw -è -__THROW -; - -158 -__END_NAMESPACE_STD - - -160 #ifdeà -__USE_ATFILE - - -162  - $»Çm—t - ( -__Þdfd -, -__cÚ¡ - * -__Þd -,  -__Ãwfd -, - -163 -__cÚ¡ - * -__Ãw -è -__THROW -; - -166 -__BEGIN_NAMESPACE_STD - - -171 #iâdeà -__USE_FILE_OFFSET64 - - -172 -FILE - * - $tmpfže - (è -__wur -; - -174 #ifdeà -__REDIRECT - - -175 -FILE - * - `__REDIRECT - ( -tmpfže -, (), -tmpfže64 -è -__wur -; - -177  - #tmpfže - -tmpfže64 - - - ) - -181 #ifdeà -__USE_LARGEFILE64 - - -182 -FILE - * - $tmpfže64 - (è -__wur -; - -186 * - $tm²am - (* -__s -è -__THROW - -__wur -; - -187 -__END_NAMESPACE_STD - - -189 #ifdeà -__USE_MISC - - -192 * - $tm²am_r - (* -__s -è -__THROW - -__wur -; - -196 #ià -defšed - -__USE_SVID - || defšed -__USE_XOPEN - - -204 * - $‹m²am - ( -__cÚ¡ - * -__dœ -, __cÚ¡ * -__pfx -) - -205 -__THROW - -__©Œibu‹_m®loc__ - -__wur -; - -209 -__BEGIN_NAMESPACE_STD - - -214  - `fþo£ - ( -FILE - * -__¡»am -); - -219  - `fæush - ( -FILE - * -__¡»am -); - -220 -__END_NAMESPACE_STD - - -222 #ifdeà -__USE_MISC - - -229  - `fæush_uÆocked - ( -FILE - * -__¡»am -); - -232 #ifdeà -__USE_GNU - - -239  - `fþo£®l - (); - -243 -__BEGIN_NAMESPACE_STD - - -244 #iâdeà -__USE_FILE_OFFSET64 - - -249 -FILE - * - $fÝ’ - ( -__cÚ¡ - * -__»¡riù - -__fž’ame -, - -250 -__cÚ¡ - * -__»¡riù - -__modes -è -__wur -; - -255 -FILE - * - $äeÝ’ - ( -__cÚ¡ - * -__»¡riù - -__fž’ame -, - -256 -__cÚ¡ - * -__»¡riù - -__modes -, - -257 -FILE - * -__»¡riù - -__¡»am -è -__wur -; - -259 #ifdeà -__REDIRECT - - -260 -FILE - * - `__REDIRECT - ( -fÝ’ -, ( -__cÚ¡ - * -__»¡riù - -__fž’ame -, - -261 -__cÚ¡ - * -__»¡riù - -__modes -), -fÝ’64 -) - -262 -__wur -; - -263 -FILE - * - `__REDIRECT - ( -äeÝ’ -, ( -__cÚ¡ - * -__»¡riù - -__fž’ame -, - -264 -__cÚ¡ - * -__»¡riù - -__modes -, - -265 -FILE - * -__»¡riù - -__¡»am -), -äeÝ’64 -) - -266 -__wur -; - -268  - #fÝ’ - -fÝ’64 - - - ) - -269  - #äeÝ’ - -äeÝ’64 - - - ) - -272 -__END_NAMESPACE_STD - - -273 #ifdeà -__USE_LARGEFILE64 - - -274 -FILE - * - $fÝ’64 - ( -__cÚ¡ - * -__»¡riù - -__fž’ame -, - -275 -__cÚ¡ - * -__»¡riù - -__modes -è -__wur -; - -276 -FILE - * - $äeÝ’64 - ( -__cÚ¡ - * -__»¡riù - -__fž’ame -, - -277 -__cÚ¡ - * -__»¡riù - -__modes -, - -278 -FILE - * -__»¡riù - -__¡»am -è -__wur -; - -281 #ifdef -__USE_POSIX - - -283 -FILE - * - $fdÝ’ - ( -__fd -, -__cÚ¡ - * -__modes -è -__THROW - -__wur -; - -286 #ifdef -__USE_GNU - - -289 -FILE - * - $fÝ’cook› - (* -__»¡riù - -__magic_cook› -, - -290 -__cÚ¡ - * -__»¡riù - -__modes -, - -291 -_IO_cook›_io_funùiÚs_t - -__io_funcs -è -__THROW - -__wur -; - -294 #ifdeà -__USE_XOPEN2K8 - - -296 -FILE - * - $fmemÝ’ - (* -__s -, -size_t - -__Ën -, -__cÚ¡ - * -__modes -) - -297 -__THROW - -__wur -; - -302 -FILE - * - $Ý’_mem¡»am - (** -__buæoc -, -size_t - * -__siz–oc -è -__THROW - -__wur -; - -306 -__BEGIN_NAMESPACE_STD - - -309  - $£tbuf - ( -FILE - * -__»¡riù - -__¡»am -, *__»¡riù -__buf -è -__THROW -; - -313  - $£tvbuf - ( -FILE - * -__»¡riù - -__¡»am -, *__»¡riù -__buf -, - -314  -__modes -, -size_t - -__n -è -__THROW -; - -315 -__END_NAMESPACE_STD - - -317 #ifdef -__USE_BSD - - -320  - $£tbufãr - ( -FILE - * -__»¡riù - -__¡»am -, *__»¡riù -__buf -, - -321 -size_t - -__size -è -__THROW -; - -324  - $£Žšebuf - ( -FILE - * -__¡»am -è -__THROW -; - -328 -__BEGIN_NAMESPACE_STD - - -333  - `årštf - ( -FILE - * -__»¡riù - -__¡»am -, - -334 -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...); - -339  - `´štf - ( -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...); - -341  - $¥rštf - (* -__»¡riù - -__s -, - -342 -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...è -__THROW -; - -348  - `vårštf - ( -FILE - * -__»¡riù - -__s -, -__cÚ¡ - *__»¡riù -__fÜm© -, - -349 -_G_va_li¡ - -__¬g -); - -354  - `v´štf - ( -__cÚ¡ - * -__»¡riù - -__fÜm© -, -_G_va_li¡ - -__¬g -); - -356  - $v¥rštf - (* -__»¡riù - -__s -, -__cÚ¡ - *__»¡riù -__fÜm© -, - -357 -_G_va_li¡ - -__¬g -è -__THROW -; - -358 -__END_NAMESPACE_STD - - -360 #ià -defšed - -__USE_BSD - || defšed -__USE_ISOC99 - || defšed -__USE_UNIX98 - - -361 -__BEGIN_NAMESPACE_C99 - - -363  - $¢´štf - (* -__»¡riù - -__s -, -size_t - -__maxËn -, - -364 -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...) - -365 -__THROW - - `__©Œibu‹__ - (( - `__fÜm©__ - ( -__´štf__ -, 3, 4))); - -367  - $v¢´štf - (* -__»¡riù - -__s -, -size_t - -__maxËn -, - -368 -__cÚ¡ - * -__»¡riù - -__fÜm© -, -_G_va_li¡ - -__¬g -) - -369 -__THROW - - `__©Œibu‹__ - (( - `__fÜm©__ - ( -__´štf__ -, 3, 0))); - -370 -__END_NAMESPACE_C99 - - -373 #ifdeà -__USE_GNU - - -376  - $va¥rštf - (** -__»¡riù - -__±r -, -__cÚ¡ - *__»¡riù -__f -, - -377 -_G_va_li¡ - -__¬g -) - -378 -__THROW - - `__©Œibu‹__ - (( - $__fÜm©__ - ( -__´štf__ -, 2, 0))è -__wur -; - -379  - $__a¥rštf - (** -__»¡riù - -__±r -, - -380 -__cÚ¡ - * -__»¡riù - -__fmt -, ...) - -381 -__THROW - - `__©Œibu‹__ - (( - $__fÜm©__ - ( -__´štf__ -, 2, 3))è -__wur -; - -382  - $a¥rštf - (** -__»¡riù - -__±r -, - -383 -__cÚ¡ - * -__»¡riù - -__fmt -, ...) - -384 -__THROW - - `__©Œibu‹__ - (( - $__fÜm©__ - ( -__´štf__ -, 2, 3))è -__wur -; - -387 #ifdeà -__USE_XOPEN2K8 - - -394  - $vd´štf - ( -__fd -, -__cÚ¡ - * -__»¡riù - -__fmt -, - -395 -_G_va_li¡ - -__¬g -) - -396 - `__©Œibu‹__ - (( - `__fÜm©__ - ( -__´štf__ -, 2, 0))); - -397  - $d´štf - ( -__fd -, -__cÚ¡ - * -__»¡riù - -__fmt -, ...) - -398 - `__©Œibu‹__ - (( - `__fÜm©__ - ( -__´štf__ -, 2, 3))); - -402 -__BEGIN_NAMESPACE_STD - - -407  - $fsÿnf - ( -FILE - * -__»¡riù - -__¡»am -, - -408 -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...è -__wur -; - -413  - $sÿnf - ( -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...è -__wur -; - -415  - $ssÿnf - ( -__cÚ¡ - * -__»¡riù - -__s -, - -416 -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...è -__THROW -; - -418 #ià -defšed - -__USE_ISOC99 - && !defšed -__USE_GNU - \ - -419 && (! -defšed - -__LDBL_COMPAT - || !defšed -__REDIRECT -) \ - -420 && ( -defšed - -__STRICT_ANSI__ - || defšed -__USE_XOPEN2K -) - -421 #ifdeà -__REDIRECT - - -425  - `__REDIRECT - ( -fsÿnf -, ( -FILE - * -__»¡riù - -__¡»am -, - -426 -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...), - -427 -__isoc99_fsÿnf -è -__wur -; - -428  - `__REDIRECT - ( -sÿnf -, ( -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...), - -429 -__isoc99_sÿnf -è -__wur -; - -430  - `__REDIRECT - ( -ssÿnf -, ( -__cÚ¡ - * -__»¡riù - -__s -, - -431 -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...), - -432 -__isoc99_ssÿnf -è -__THROW -; - -434  - $__isoc99_fsÿnf - ( -FILE - * -__»¡riù - -__¡»am -, - -435 -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...è -__wur -; - -436  - $__isoc99_sÿnf - ( -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...è -__wur -; - -437  - $__isoc99_ssÿnf - ( -__cÚ¡ - * -__»¡riù - -__s -, - -438 -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...è -__THROW -; - -439  - #fsÿnf - -__isoc99_fsÿnf - - - ) - -440  - #sÿnf - -__isoc99_sÿnf - - - ) - -441  - #ssÿnf - -__isoc99_ssÿnf - - - ) - -445 -__END_NAMESPACE_STD - - -447 #ifdef -__USE_ISOC99 - - -448 -__BEGIN_NAMESPACE_C99 - - -453  - $vfsÿnf - ( -FILE - * -__»¡riù - -__s -, -__cÚ¡ - *__»¡riù -__fÜm© -, - -454 -_G_va_li¡ - -__¬g -) - -455 - `__©Œibu‹__ - (( - $__fÜm©__ - ( -__sÿnf__ -, 2, 0))è -__wur -; - -461  - $vsÿnf - ( -__cÚ¡ - * -__»¡riù - -__fÜm© -, -_G_va_li¡ - -__¬g -) - -462 - `__©Œibu‹__ - (( - $__fÜm©__ - ( -__sÿnf__ -, 1, 0))è -__wur -; - -465  - $vssÿnf - ( -__cÚ¡ - * -__»¡riù - -__s -, - -466 -__cÚ¡ - * -__»¡riù - -__fÜm© -, -_G_va_li¡ - -__¬g -) - -467 -__THROW - - `__©Œibu‹__ - (( - `__fÜm©__ - ( -__sÿnf__ -, 2, 0))); - -469 #ià! -defšed - -__USE_GNU - \ - -470 && (! -defšed - -__LDBL_COMPAT - || !defšed -__REDIRECT -) \ - -471 && ( -defšed - -__STRICT_ANSI__ - || defšed -__USE_XOPEN2K -) - -472 #ifdeà -__REDIRECT - - -476  - `__REDIRECT - ( -vfsÿnf -, - -477 ( -FILE - * -__»¡riù - -__s -, - -478 -__cÚ¡ - * -__»¡riù - -__fÜm© -, -_G_va_li¡ - -__¬g -), - -479 -__isoc99_vfsÿnf -) - -480 - `__©Œibu‹__ - (( - $__fÜm©__ - ( -__sÿnf__ -, 2, 0))è -__wur -; - -481  - `__REDIRECT - ( -vsÿnf -, ( -__cÚ¡ - * -__»¡riù - -__fÜm© -, - -482 -_G_va_li¡ - -__¬g -), -__isoc99_vsÿnf -) - -483 - `__©Œibu‹__ - (( - $__fÜm©__ - ( -__sÿnf__ -, 1, 0))è -__wur -; - -484  - `__REDIRECT - ( -vssÿnf -, - -485 ( -__cÚ¡ - * -__»¡riù - -__s -, - -486 -__cÚ¡ - * -__»¡riù - -__fÜm© -, -_G_va_li¡ - -__¬g -), - -487 -__isoc99_vssÿnf -) - -488 -__THROW - - `__©Œibu‹__ - (( - `__fÜm©__ - ( -__sÿnf__ -, 2, 0))); - -490  - $__isoc99_vfsÿnf - ( -FILE - * -__»¡riù - -__s -, - -491 -__cÚ¡ - * -__»¡riù - -__fÜm© -, - -492 -_G_va_li¡ - -__¬g -è -__wur -; - -493  - $__isoc99_vsÿnf - ( -__cÚ¡ - * -__»¡riù - -__fÜm© -, - -494 -_G_va_li¡ - -__¬g -è -__wur -; - -495  - $__isoc99_vssÿnf - ( -__cÚ¡ - * -__»¡riù - -__s -, - -496 -__cÚ¡ - * -__»¡riù - -__fÜm© -, - -497 -_G_va_li¡ - -__¬g -è -__THROW -; - -498  - #vfsÿnf - -__isoc99_vfsÿnf - - - ) - -499  - #vsÿnf - -__isoc99_vsÿnf - - - ) - -500  - #vssÿnf - -__isoc99_vssÿnf - - - ) - -504 -__END_NAMESPACE_C99 - - -508 -__BEGIN_NAMESPACE_STD - - -513  - `fg‘c - ( -FILE - * -__¡»am -); - -514  - `g‘c - ( -FILE - * -__¡»am -); - -520  - `g‘ch¬ - (); - -521 -__END_NAMESPACE_STD - - -525  - #g‘c -( -_å -è - `_IO_g‘c - (_å) - - ) - -527 #ià -defšed - -__USE_POSIX - || defšed -__USE_MISC - - -532  - `g‘c_uÆocked - ( -FILE - * -__¡»am -); - -533  - `g‘ch¬_uÆocked - (); - -536 #ifdeà -__USE_MISC - - -543  - `fg‘c_uÆocked - ( -FILE - * -__¡»am -); - -547 -__BEGIN_NAMESPACE_STD - - -555  - `åutc - ( -__c -, -FILE - * -__¡»am -); - -556  - `putc - ( -__c -, -FILE - * -__¡»am -); - -562  - `putch¬ - ( -__c -); - -563 -__END_NAMESPACE_STD - - -567  - #putc -( -_ch -, -_å -è - `_IO_putc - (_ch, _å) - - ) - -569 #ifdeà -__USE_MISC - - -576  - `åutc_uÆocked - ( -__c -, -FILE - * -__¡»am -); - -579 #ià -defšed - -__USE_POSIX - || defšed -__USE_MISC - - -584  - `putc_uÆocked - ( -__c -, -FILE - * -__¡»am -); - -585  - `putch¬_uÆocked - ( -__c -); - -589 #ià -defšed - -__USE_SVID - || defšed -__USE_MISC - \ - -590 || ( -defšed - -__USE_XOPEN - && !defšed -__USE_XOPEN2K -) - -592  - `g‘w - ( -FILE - * -__¡»am -); - -595  - `putw - ( -__w -, -FILE - * -__¡»am -); - -599 -__BEGIN_NAMESPACE_STD - - -604 * - $fg‘s - (* -__»¡riù - -__s -,  -__n -, -FILE - *__»¡riù -__¡»am -) - -605 -__wur -; - -612 * - $g‘s - (* -__s -è -__wur -; - -613 -__END_NAMESPACE_STD - - -615 #ifdeà -__USE_GNU - - -622 * - $fg‘s_uÆocked - (* -__»¡riù - -__s -,  -__n -, - -623 -FILE - * -__»¡riù - -__¡»am -è -__wur -; - -627 #ifdef -__USE_XOPEN2K8 - - -638 -_IO_ssize_t - - $__g‘d–im - (** -__»¡riù - -__lš•Œ -, - -639 -size_t - * -__»¡riù - -__n -,  -__d–im™” -, - -640 -FILE - * -__»¡riù - -__¡»am -è -__wur -; - -641 -_IO_ssize_t - - $g‘d–im - (** -__»¡riù - -__lš•Œ -, - -642 -size_t - * -__»¡riù - -__n -,  -__d–im™” -, - -643 -FILE - * -__»¡riù - -__¡»am -è -__wur -; - -651 -_IO_ssize_t - - $g‘lše - (** -__»¡riù - -__lš•Œ -, - -652 -size_t - * -__»¡riù - -__n -, - -653 -FILE - * -__»¡riù - -__¡»am -è -__wur -; - -657 -__BEGIN_NAMESPACE_STD - - -662  - `åuts - ( -__cÚ¡ - * -__»¡riù - -__s -, -FILE - *__»¡riù -__¡»am -); - -668  - `puts - ( -__cÚ¡ - * -__s -); - -675  - `ung‘c - ( -__c -, -FILE - * -__¡»am -); - -682 -size_t - - $ä—d - (* -__»¡riù - -__±r -, -size_t - -__size -, - -683 -size_t - -__n -, -FILE - * -__»¡riù - -__¡»am -è -__wur -; - -688 -size_t - - `fwr™e - ( -__cÚ¡ - * -__»¡riù - -__±r -, size_ˆ -__size -, - -689 -size_t - -__n -, -FILE - * -__»¡riù - -__s -); - -690 -__END_NAMESPACE_STD - - -692 #ifdeà -__USE_GNU - - -699  - `åuts_uÆocked - ( -__cÚ¡ - * -__»¡riù - -__s -, - -700 -FILE - * -__»¡riù - -__¡»am -); - -703 #ifdeà -__USE_MISC - - -710 -size_t - - $ä—d_uÆocked - (* -__»¡riù - -__±r -, -size_t - -__size -, - -711 -size_t - -__n -, -FILE - * -__»¡riù - -__¡»am -è -__wur -; - -712 -size_t - - `fwr™e_uÆocked - ( -__cÚ¡ - * -__»¡riù - -__±r -, size_ˆ -__size -, - -713 -size_t - -__n -, -FILE - * -__»¡riù - -__¡»am -); - -717 -__BEGIN_NAMESPACE_STD - - -722  - `f£ek - ( -FILE - * -__¡»am -,  -__off -,  -__wh’û -); - -727  - $á–l - ( -FILE - * -__¡»am -è -__wur -; - -732  - `»wšd - ( -FILE - * -__¡»am -); - -733 -__END_NAMESPACE_STD - - -740 #ià -defšed - -__USE_LARGEFILE - || defšed -__USE_XOPEN2K - - -741 #iâdeà -__USE_FILE_OFFSET64 - - -746  - `f£eko - ( -FILE - * -__¡»am -, -__off_t - -__off -,  -__wh’û -); - -751 -__off_t - - $á–lo - ( -FILE - * -__¡»am -è -__wur -; - -753 #ifdeà -__REDIRECT - - -754  - `__REDIRECT - ( -f£eko -, - -755 ( -FILE - * -__¡»am -, -__off64_t - -__off -,  -__wh’û -), - -756 -f£eko64 -); - -757 -__off64_t - - `__REDIRECT - ( -á–lo -, ( -FILE - * -__¡»am -), -á–lo64 -); - -759  - #f£eko - -f£eko64 - - - ) - -760  - #á–lo - -á–lo64 - - - ) - -765 -__BEGIN_NAMESPACE_STD - - -766 #iâdeà -__USE_FILE_OFFSET64 - - -771  - `fg‘pos - ( -FILE - * -__»¡riù - -__¡»am -, -åos_t - *__»¡riù -__pos -); - -776  - `f£os - ( -FILE - * -__¡»am -, -__cÚ¡ - -åos_t - * -__pos -); - -778 #ifdeà -__REDIRECT - - -779  - `__REDIRECT - ( -fg‘pos -, ( -FILE - * -__»¡riù - -__¡»am -, - -780 -åos_t - * -__»¡riù - -__pos -), -fg‘pos64 -); - -781  - `__REDIRECT - ( -f£os -, - -782 ( -FILE - * -__¡»am -, -__cÚ¡ - -åos_t - * -__pos -), -f£os64 -); - -784  - #fg‘pos - -fg‘pos64 - - - ) - -785  - #f£os - -f£os64 - - - ) - -788 -__END_NAMESPACE_STD - - -790 #ifdeà -__USE_LARGEFILE64 - - -791  - `f£eko64 - ( -FILE - * -__¡»am -, -__off64_t - -__off -,  -__wh’û -); - -792 -__off64_t - - $á–lo64 - ( -FILE - * -__¡»am -è -__wur -; - -793  - `fg‘pos64 - ( -FILE - * -__»¡riù - -__¡»am -, -åos64_t - *__»¡riù -__pos -); - -794  - `f£os64 - ( -FILE - * -__¡»am -, -__cÚ¡ - -åos64_t - * -__pos -); - -797 -__BEGIN_NAMESPACE_STD - - -799  - $þ—»¼ - ( -FILE - * -__¡»am -è -__THROW -; - -801  - $ãof - ( -FILE - * -__¡»am -è -__THROW - -__wur -; - -803  - $ã¼Ü - ( -FILE - * -__¡»am -è -__THROW - -__wur -; - -804 -__END_NAMESPACE_STD - - -806 #ifdeà -__USE_MISC - - -808  - $þ—»¼_uÆocked - ( -FILE - * -__¡»am -è -__THROW -; - -809  - $ãof_uÆocked - ( -FILE - * -__¡»am -è -__THROW - -__wur -; - -810  - $ã¼Ü_uÆocked - ( -FILE - * -__¡»am -è -__THROW - -__wur -; - -814 -__BEGIN_NAMESPACE_STD - - -819  - `³¼Ü - ( -__cÚ¡ - * -__s -); - -820 -__END_NAMESPACE_STD - - -826  - ~ - -829 #ifdef -__USE_POSIX - - -831  - $fž’o - ( -FILE - * -__¡»am -è -__THROW - -__wur -; - -834 #ifdeà -__USE_MISC - - -836  - $fž’o_uÆocked - ( -FILE - * -__¡»am -è -__THROW - -__wur -; - -840 #ià( -defšed - -__USE_POSIX2 - || defšed -__USE_SVID - || defšed -__USE_BSD - || \ - -841 -defšed - -__USE_MISC -) - -846 -FILE - * - $pÝ’ - ( -__cÚ¡ - * -__commªd -, __cÚ¡ * -__modes -è -__wur -; - -852  - `pþo£ - ( -FILE - * -__¡»am -); - -856 #ifdef -__USE_POSIX - - -858 * - $ù”mid - (* -__s -è -__THROW -; - -862 #ifdeà -__USE_XOPEN - - -864 * - `cu£rid - (* -__s -); - -868 #ifdef -__USE_GNU - - -869  -ob¡ack -; - -872  - $ob¡ack_´štf - ( -ob¡ack - * -__»¡riù - -__ob¡ack -, - -873 -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...) - -874 -__THROW - - `__©Œibu‹__ - (( - `__fÜm©__ - ( -__´štf__ -, 2, 3))); - -875  - $ob¡ack_v´štf - ( -ob¡ack - * -__»¡riù - -__ob¡ack -, - -876 -__cÚ¡ - * -__»¡riù - -__fÜm© -, - -877 -_G_va_li¡ - -__¬gs -) - -878 -__THROW - - `__©Œibu‹__ - (( - `__fÜm©__ - ( -__´štf__ -, 2, 0))); - -882 #ià -defšed - -__USE_POSIX - || defšed -__USE_MISC - - -886  - $æockfže - ( -FILE - * -__¡»am -è -__THROW -; - -890  - $árylockfže - ( -FILE - * -__¡»am -è -__THROW - -__wur -; - -893  - $fuÆockfže - ( -FILE - * -__¡»am -è -__THROW -; - -896 #ià -defšed - -__USE_XOPEN - && !defšed -__USE_XOPEN2K - && !defšed -__USE_GNU - - -900  - #__Ãed_g‘Ýt - - - ) - -901  - ~ - -906 #ifdeà -__USE_EXTERN_INLINES - - -907  - ~ - -909 #ià -__USE_FORTIFY_LEVEL - > 0 && -defšed - -__ex‹º_®ways_šlše - - -910  - ~ - -912 #ifdeà -__LDBL_COMPAT - - -913  - ~ - -916 -__END_DECLS - - - @/usr/include/string.h - -23 #iâdef -_STRING_H - - -24  - #_STRING_H - 1 - - ) - -26  - ~<ã©u»s.h -> - -28 - g__BEGIN_DECLS - - -31  - #__Ãed_size_t - - - ) - -32  - #__Ãed_NULL - - - ) - -33  - ~<¡ddef.h -> - -36 #ià -defšed - -__ýlu¥lus - && -__GNUC_PREREQ - (4, 4) - -37  - #__CORRECT_ISO_CPP_STRING_H_PROTO - - - ) - -41 -__BEGIN_NAMESPACE_STD - - -43 * - $memýy - (* -__»¡riù - -__de¡ -, - -44 -__cÚ¡ - * -__»¡riù - -__¤c -, -size_t - -__n -) - -45 -__THROW - - `__nÚnuÎ - ((1, 2)); - -48 * - $memmove - (* -__de¡ -, -__cÚ¡ - * -__¤c -, -size_t - -__n -) - -49 -__THROW - - `__nÚnuÎ - ((1, 2)); - -50 -__END_NAMESPACE_STD - - -55 #ià -defšed - -__USE_SVID - || defšed -__USE_BSD - || defšed -__USE_XOPEN - - -56 * - $memcýy - (* -__»¡riù - -__de¡ -, -__cÚ¡ - *__»¡riù -__¤c -, - -57  -__c -, -size_t - -__n -) - -58 -__THROW - - `__nÚnuÎ - ((1, 2)); - -62 -__BEGIN_NAMESPACE_STD - - -64 * - $mem£t - (* -__s -,  -__c -, -size_t - -__n -è -__THROW - - `__nÚnuÎ - ((1)); - -67  - $memcmp - ( -__cÚ¡ - * -__s1 -, __cÚ¡ * -__s2 -, -size_t - -__n -) - -68 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1, 2)); - -71 #ifdeà -__CORRECT_ISO_CPP_STRING_H_PROTO - - -74 * - `memchr - (* -__s -,  -__c -, -size_t - -__n -) - -75 -__THROW - - `__asm - ("memchr"è -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)); - -76 -__cÚ¡ - * - `memchr - (__cÚ¡ * -__s -,  -__c -, -size_t - -__n -) - -77 -__THROW - - `__asm - ("memchr"è -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)); - -79 #ifdeà -__OPTIMIZE__ - - -80 -__ex‹º_®ways_šlše - * - -81 - `memchr - (* -__s -,  -__c -, -size_t - -__n -è -__THROW - - -83  - `__bužtš_memchr - ( -__s -, -__c -, -__n -); - -86 -__ex‹º_®ways_šlše - -__cÚ¡ - * - -87 - `memchr - ( -__cÚ¡ - * -__s -,  -__c -, -size_t - -__n -è -__THROW - - -89  - `__bužtš_memchr - ( -__s -, -__c -, -__n -); - -92 - } -} - -94 * - $memchr - ( -__cÚ¡ - * -__s -,  -__c -, -size_t - -__n -) - -95 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)); - -97 -__END_NAMESPACE_STD - - -99 #ifdeà -__USE_GNU - - -102 #ifdeà -__CORRECT_ISO_CPP_STRING_H_PROTO - - -103 "C++" * - $¿wmemchr - (* -__s -,  -__c -) - -104 -__THROW - - `__asm - ("¿wmemchr"è -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)); - -105 "C++" -__cÚ¡ - * - $¿wmemchr - ( -__cÚ¡ - * -__s -,  -__c -) - -106 -__THROW - - `__asm - ("¿wmemchr"è -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)); - -108 * - $¿wmemchr - ( -__cÚ¡ - * -__s -,  -__c -) - -109 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)); - -113 #ifdeà -__CORRECT_ISO_CPP_STRING_H_PROTO - - -114 "C++" * - $memrchr - (* -__s -,  -__c -, -size_t - -__n -) - -115 -__THROW - - `__asm - ("memrchr"è -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)); - -116 "C++" -__cÚ¡ - * - $memrchr - ( -__cÚ¡ - * -__s -,  -__c -, -size_t - -__n -) - -117 -__THROW - - `__asm - ("memrchr"è -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)); - -119 * - $memrchr - ( -__cÚ¡ - * -__s -,  -__c -, -size_t - -__n -) - -120 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)); - -125 -__BEGIN_NAMESPACE_STD - - -127 * - $¡rýy - (* -__»¡riù - -__de¡ -, -__cÚ¡ - *__»¡riù -__¤c -) - -128 -__THROW - - `__nÚnuÎ - ((1, 2)); - -130 * - $¡ºýy - (* -__»¡riù - -__de¡ -, - -131 -__cÚ¡ - * -__»¡riù - -__¤c -, -size_t - -__n -) - -132 -__THROW - - `__nÚnuÎ - ((1, 2)); - -135 * - $¡rÿt - (* -__»¡riù - -__de¡ -, -__cÚ¡ - *__»¡riù -__¤c -) - -136 -__THROW - - `__nÚnuÎ - ((1, 2)); - -138 * - $¡ºÿt - (* -__»¡riù - -__de¡ -, -__cÚ¡ - *__»¡riù -__¤c -, - -139 -size_t - -__n -è -__THROW - - `__nÚnuÎ - ((1, 2)); - -142  - $¡rcmp - ( -__cÚ¡ - * -__s1 -, __cÚ¡ * -__s2 -) - -143 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1, 2)); - -145  - $¡ºcmp - ( -__cÚ¡ - * -__s1 -, __cÚ¡ * -__s2 -, -size_t - -__n -) - -146 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1, 2)); - -149  - $¡rcÞl - ( -__cÚ¡ - * -__s1 -, __cÚ¡ * -__s2 -) - -150 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1, 2)); - -152 -size_t - - $¡rxäm - (* -__»¡riù - -__de¡ -, - -153 -__cÚ¡ - * -__»¡riù - -__¤c -, -size_t - -__n -) - -154 -__THROW - - `__nÚnuÎ - ((2)); - -155 -__END_NAMESPACE_STD - - -157 #ifdeà -__USE_XOPEN2K8 - - -161  - ~ - -164  - $¡rcÞl_l - ( -__cÚ¡ - * -__s1 -, __cÚ¡ * -__s2 -, -__loÿË_t - -__l -) - -165 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1, 2, 3)); - -167 -size_t - - $¡rxäm_l - (* -__de¡ -, -__cÚ¡ - * -__¤c -, -size_t - -__n -, - -168 -__loÿË_t - -__l -è -__THROW - - `__nÚnuÎ - ((2, 4)); - -171 #ià -defšed - -__USE_SVID - || defšed -__USE_BSD - || defšed -__USE_XOPEN_EXTENDED - - -173 * - $¡rdup - ( -__cÚ¡ - * -__s -) - -174 -__THROW - -__©Œibu‹_m®loc__ - - `__nÚnuÎ - ((1)); - -180 #ià -defšed - -__USE_XOPEN2K8 - - -181 * - $¡ºdup - ( -__cÚ¡ - * -__¡ršg -, -size_t - -__n -) - -182 -__THROW - -__©Œibu‹_m®loc__ - - `__nÚnuÎ - ((1)); - -185 #ià -defšed - -__USE_GNU - && defšed -__GNUC__ - - -187  - #¡rdu· -( -s -) \ - -188 ( -__ex‹nsiÚ__ - \ - -190 -__cÚ¡ - * -__Þd - = ( -s -); \ - -191 -size_t - -__Ën - = - `¡¾’ - ( -__Þd -) + 1; \ - -192 * -__Ãw - = (*è - `__bužtš_®loÿ - ( -__Ën -); \ - -193 (*è - `memýy - ( -__Ãw -, -__Þd -, -__Ën -); \ - -194 - } -})) - - ) - -197  - #¡ºdu· -( -s -, -n -) \ - -198 ( -__ex‹nsiÚ__ - \ - -200 -__cÚ¡ - * -__Þd - = ( -s -); \ - -201 -size_t - -__Ën - = - `¡ºËn - ( -__Þd -, ( -n -)); \ - -202 * -__Ãw - = (*è - `__bužtš_®loÿ - ( -__Ën - + 1); \ - -203 -__Ãw -[ -__Ën -] = '\0'; \ - -204 (*è - `memýy - ( -__Ãw -, -__Þd -, -__Ën -); \ - -205 })) - - ) - -208 - g__BEGIN_NAMESPACE_STD - - -210 #ifdeà -__CORRECT_ISO_CPP_STRING_H_PROTO - - -213 * -¡rchr - (* -__s -,  -__c -) - -214 -__THROW - -__asm - ("¡rchr"è -__©Œibu‹_pu»__ - -__nÚnuÎ - ((1)); - -215 -__cÚ¡ - * -¡rchr - (__cÚ¡ * -__s -,  -__c -) - -216 -__THROW - -__asm - ("¡rchr"è -__©Œibu‹_pu»__ - -__nÚnuÎ - ((1)); - -218 #ifdeà -__OPTIMIZE__ - - -219 -__ex‹º_®ways_šlše - * - -220 -¡rchr - (* -__s -,  -__c -è - g__THROW - - -222  -__bužtš_¡rchr - ( -__s -, -__c -); - -225 -__ex‹º_®ways_šlše - -__cÚ¡ - * - -226 -¡rchr - ( -__cÚ¡ - * -__s -,  -__c -è - g__THROW - - -228  -__bužtš_¡rchr - ( -__s -, -__c -); - -233 * - $¡rchr - ( -__cÚ¡ - * -__s -,  -__c -) - -234 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)); - -237 #ifdeà -__CORRECT_ISO_CPP_STRING_H_PROTO - - -240 * - `¡¼chr - (* -__s -,  -__c -) - -241 -__THROW - - `__asm - ("¡¼chr"è -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)); - -242 -__cÚ¡ - * - `¡¼chr - (__cÚ¡ * -__s -,  -__c -) - -243 -__THROW - - `__asm - ("¡¼chr"è -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)); - -245 #ifdeà -__OPTIMIZE__ - - -246 -__ex‹º_®ways_šlše - * - -247 - `¡¼chr - (* -__s -,  -__c -è -__THROW - - -249  - `__bužtš_¡¼chr - ( -__s -, -__c -); - -252 -__ex‹º_®ways_šlše - -__cÚ¡ - * - -253 - `¡¼chr - ( -__cÚ¡ - * -__s -,  -__c -è -__THROW - - -255  - `__bužtš_¡¼chr - ( -__s -, -__c -); - -258 - } -} - -260 * - $¡¼chr - ( -__cÚ¡ - * -__s -,  -__c -) - -261 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)); - -263 -__END_NAMESPACE_STD - - -265 #ifdeà -__USE_GNU - - -268 #ifdeà -__CORRECT_ISO_CPP_STRING_H_PROTO - - -269 "C++" * - $¡rchºul - (* -__s -,  -__c -) - -270 -__THROW - - `__asm - ("¡rchºul"è -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)); - -271 "C++" -__cÚ¡ - * - $¡rchºul - ( -__cÚ¡ - * -__s -,  -__c -) - -272 -__THROW - - `__asm - ("¡rchºul"è -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)); - -274 * - $¡rchºul - ( -__cÚ¡ - * -__s -,  -__c -) - -275 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)); - -279 -__BEGIN_NAMESPACE_STD - - -282 -size_t - - $¡rc¥n - ( -__cÚ¡ - * -__s -, __cÚ¡ * -__»jeù -) - -283 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1, 2)); - -286 -size_t - - $¡r¥n - ( -__cÚ¡ - * -__s -, __cÚ¡ * -__acû± -) - -287 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1, 2)); - -289 #ifdeà -__CORRECT_ISO_CPP_STRING_H_PROTO - - -292 * - `¡½brk - (* -__s -, -__cÚ¡ - * -__acû± -) - -293 -__THROW - - `__asm - ("¡½brk"è -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1, 2)); - -294 -__cÚ¡ - * - `¡½brk - (__cÚ¡ * -__s -, __cÚ¡ * -__acû± -) - -295 -__THROW - - `__asm - ("¡½brk"è -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1, 2)); - -297 #ifdeà -__OPTIMIZE__ - - -298 -__ex‹º_®ways_šlše - * - -299 - `¡½brk - (* -__s -, -__cÚ¡ - * -__acû± -è -__THROW - - -301  - `__bužtš_¡½brk - ( -__s -, -__acû± -); - -304 -__ex‹º_®ways_šlše - -__cÚ¡ - * - -305 - `¡½brk - ( -__cÚ¡ - * -__s -, __cÚ¡ * -__acû± -è -__THROW - - -307  - `__bužtš_¡½brk - ( -__s -, -__acû± -); - -310 - } -} - -312 * - $¡½brk - ( -__cÚ¡ - * -__s -, __cÚ¡ * -__acû± -) - -313 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1, 2)); - -316 #ifdeà -__CORRECT_ISO_CPP_STRING_H_PROTO - - -319 * - `¡r¡r - (* -__hay¡ack -, -__cÚ¡ - * -__ÃedË -) - -320 -__THROW - - `__asm - ("¡r¡r"è -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1, 2)); - -321 -__cÚ¡ - * - `¡r¡r - (__cÚ¡ * -__hay¡ack -, - -322 -__cÚ¡ - * -__ÃedË -) - -323 -__THROW - - `__asm - ("¡r¡r"è -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1, 2)); - -325 #ifdeà -__OPTIMIZE__ - - -326 -__ex‹º_®ways_šlše - * - -327 - `¡r¡r - (* -__hay¡ack -, -__cÚ¡ - * -__ÃedË -è -__THROW - - -329  - `__bužtš_¡r¡r - ( -__hay¡ack -, -__ÃedË -); - -332 -__ex‹º_®ways_šlše - -__cÚ¡ - * - -333 - `¡r¡r - ( -__cÚ¡ - * -__hay¡ack -, __cÚ¡ * -__ÃedË -è -__THROW - - -335  - `__bužtš_¡r¡r - ( -__hay¡ack -, -__ÃedË -); - -338 - } -} - -340 * - $¡r¡r - ( -__cÚ¡ - * -__hay¡ack -, __cÚ¡ * -__ÃedË -) - -341 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1, 2)); - -346 * - $¡¹ok - (* -__»¡riù - -__s -, -__cÚ¡ - *__»¡riù -__d–im -) - -347 -__THROW - - `__nÚnuÎ - ((2)); - -348 -__END_NAMESPACE_STD - - -352 * - $__¡¹ok_r - (* -__»¡riù - -__s -, - -353 -__cÚ¡ - * -__»¡riù - -__d–im -, - -354 ** -__»¡riù - -__§ve_±r -) - -355 -__THROW - - `__nÚnuÎ - ((2, 3)); - -356 #ià -defšed - -__USE_POSIX - || defšed -__USE_MISC - - -357 * - $¡¹ok_r - (* -__»¡riù - -__s -, -__cÚ¡ - *__»¡riù -__d–im -, - -358 ** -__»¡riù - -__§ve_±r -) - -359 -__THROW - - `__nÚnuÎ - ((2, 3)); - -362 #ifdeà -__USE_GNU - - -364 #ifdeà -__CORRECT_ISO_CPP_STRING_H_PROTO - - -365 "C++" * - $¡rÿ£¡r - (* -__hay¡ack -, -__cÚ¡ - * -__ÃedË -) - -366 -__THROW - - `__asm - ("¡rÿ£¡r"è -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1, 2)); - -367 "C++" -__cÚ¡ - * - $¡rÿ£¡r - ( -__cÚ¡ - * -__hay¡ack -, - -368 -__cÚ¡ - * -__ÃedË -) - -369 -__THROW - - `__asm - ("¡rÿ£¡r"è -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1, 2)); - -371 * - $¡rÿ£¡r - ( -__cÚ¡ - * -__hay¡ack -, __cÚ¡ * -__ÃedË -) - -372 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1, 2)); - -376 #ifdeà -__USE_GNU - - -380 * - $memmem - ( -__cÚ¡ - * -__hay¡ack -, -size_t - -__hay¡ackËn -, - -381 -__cÚ¡ - * -__ÃedË -, -size_t - -__ÃedËËn -) - -382 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1, 3)); - -386 * - $__mempýy - (* -__»¡riù - -__de¡ -, - -387 -__cÚ¡ - * -__»¡riù - -__¤c -, -size_t - -__n -) - -388 -__THROW - - `__nÚnuÎ - ((1, 2)); - -389 * - $mempýy - (* -__»¡riù - -__de¡ -, - -390 -__cÚ¡ - * -__»¡riù - -__¤c -, -size_t - -__n -) - -391 -__THROW - - `__nÚnuÎ - ((1, 2)); - -395 -__BEGIN_NAMESPACE_STD - - -397 -size_t - - $¡¾’ - ( -__cÚ¡ - * -__s -) - -398 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)); - -399 -__END_NAMESPACE_STD - - -401 #ifdef -__USE_XOPEN2K8 - - -404 -size_t - - $¡ºËn - ( -__cÚ¡ - * -__¡ršg -, -size_t - -__maxËn -) - -405 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)); - -409 -__BEGIN_NAMESPACE_STD - - -411 * - $¡»¼Ü - ( -__”ºum -è -__THROW -; - -412 -__END_NAMESPACE_STD - - -413 #ià -defšed - -__USE_XOPEN2K - || defšed -__USE_MISC - - -421 #ià -defšed - -__USE_XOPEN2K - && !defšed -__USE_GNU - - -424 #ifdeà -__REDIRECT_NTH - - -425  - `__REDIRECT_NTH - ( -¡»¼Ü_r -, - -426 ( -__”ºum -, * -__buf -, -size_t - -__buæ’ -), - -427 -__xpg_¡»¼Ü_r -è - `__nÚnuÎ - ((2)); - -429  - $__xpg_¡»¼Ü_r - ( -__”ºum -, * -__buf -, -size_t - -__buæ’ -) - -430 -__THROW - - `__nÚnuÎ - ((2)); - -431  - #¡»¼Ü_r - -__xpg_¡»¼Ü_r - - - ) - -436 * - $¡»¼Ü_r - ( -__”ºum -, * -__buf -, -size_t - -__buæ’ -) - -437 -__THROW - - `__nÚnuÎ - ((2)); - -441 #ifdeà -__USE_XOPEN2K8 - - -443 * - $¡»¼Ü_l - ( -__”ºum -, -__loÿË_t - -__l -è -__THROW -; - -449  - $__bz”o - (* -__s -, -size_t - -__n -è -__THROW - - `__nÚnuÎ - ((1)); - -451 #ifdeà -__USE_BSD - - -453  - $bcÝy - ( -__cÚ¡ - * -__¤c -, * -__de¡ -, -size_t - -__n -) - -454 -__THROW - - `__nÚnuÎ - ((1, 2)); - -457  - $bz”o - (* -__s -, -size_t - -__n -è -__THROW - - `__nÚnuÎ - ((1)); - -460  - $bcmp - ( -__cÚ¡ - * -__s1 -, __cÚ¡ * -__s2 -, -size_t - -__n -) - -461 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1, 2)); - -464 #ifdeà -__CORRECT_ISO_CPP_STRING_H_PROTO - - -467 * - `šdex - (* -__s -,  -__c -) - -468 -__THROW - - `__asm - ("šdex"è -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)); - -469 -__cÚ¡ - * - `šdex - (__cÚ¡ * -__s -,  -__c -) - -470 -__THROW - - `__asm - ("šdex"è -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)); - -472 #ià -defšed - -__OPTIMIZE__ - && !defšed -__CORRECT_ISO_CPP_STRINGS_H_PROTO - - -473 -__ex‹º_®ways_šlše - * - -474 - `šdex - (* -__s -,  -__c -è -__THROW - - -476  - `__bužtš_šdex - ( -__s -, -__c -); - -479 -__ex‹º_®ways_šlše - -__cÚ¡ - * - -480 - `šdex - ( -__cÚ¡ - * -__s -,  -__c -è -__THROW - - -482  - `__bužtš_šdex - ( -__s -, -__c -); - -485 - } -} - -487 * - $šdex - ( -__cÚ¡ - * -__s -,  -__c -) - -488 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)); - -492 #ifdeà -__CORRECT_ISO_CPP_STRING_H_PROTO - - -495 * - `ršdex - (* -__s -,  -__c -) - -496 -__THROW - - `__asm - ("ršdex"è -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)); - -497 -__cÚ¡ - * - `ršdex - (__cÚ¡ * -__s -,  -__c -) - -498 -__THROW - - `__asm - ("ršdex"è -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)); - -500 #ià -defšed - -__OPTIMIZE__ - && !defšed -__CORRECT_ISO_CPP_STRINGS_H_PROTO - - -501 -__ex‹º_®ways_šlše - * - -502 - `ršdex - (* -__s -,  -__c -è -__THROW - - -504  - `__bužtš_ršdex - ( -__s -, -__c -); - -507 -__ex‹º_®ways_šlše - -__cÚ¡ - * - -508 - `ršdex - ( -__cÚ¡ - * -__s -,  -__c -è -__THROW - - -510  - `__bužtš_ršdex - ( -__s -, -__c -); - -513 - } -} - -515 * - $ršdex - ( -__cÚ¡ - * -__s -,  -__c -) - -516 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)); - -521  - $ffs - ( -__i -è -__THROW - - `__©Œibu‹__ - (( -__cÚ¡__ -)); - -525 #ifdef -__USE_GNU - - -526  - $ff¦ - ( -__l -è -__THROW - - `__©Œibu‹__ - (( -__cÚ¡__ -)); - -527 #ifdeà -__GNUC__ - - -528 -__ex‹nsiÚ__ -  - $ff¦l - ( -__Î -) - -529 -__THROW - - `__©Œibu‹__ - (( -__cÚ¡__ -)); - -534  - $¡rÿ£cmp - ( -__cÚ¡ - * -__s1 -, __cÚ¡ * -__s2 -) - -535 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1, 2)); - -538  - $¡ºÿ£cmp - ( -__cÚ¡ - * -__s1 -, __cÚ¡ * -__s2 -, -size_t - -__n -) - -539 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1, 2)); - -542 #ifdef -__USE_GNU - - -545  - $¡rÿ£cmp_l - ( -__cÚ¡ - * -__s1 -, __cÚ¡ * -__s2 -, - -546 -__loÿË_t - -__loc -) - -547 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1, 2, 3)); - -549  - $¡ºÿ£cmp_l - ( -__cÚ¡ - * -__s1 -, __cÚ¡ * -__s2 -, - -550 -size_t - -__n -, -__loÿË_t - -__loc -) - -551 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1, 2, 4)); - -554 #ifdef -__USE_BSD - - -557 * - $¡r£p - (** -__»¡riù - -__¡ršgp -, - -558 -__cÚ¡ - * -__»¡riù - -__d–im -) - -559 -__THROW - - `__nÚnuÎ - ((1, 2)); - -562 #ifdef -__USE_XOPEN2K8 - - -564 * - $¡rsigÇl - ( -__sig -è -__THROW -; - -567 * - $__¡pýy - (* -__»¡riù - -__de¡ -, -__cÚ¡ - *__»¡riù -__¤c -) - -568 -__THROW - - `__nÚnuÎ - ((1, 2)); - -569 * - $¡pýy - (* -__»¡riù - -__de¡ -, -__cÚ¡ - *__»¡riù -__¤c -) - -570 -__THROW - - `__nÚnuÎ - ((1, 2)); - -574 * - $__¡²ýy - (* -__»¡riù - -__de¡ -, - -575 -__cÚ¡ - * -__»¡riù - -__¤c -, -size_t - -__n -) - -576 -__THROW - - `__nÚnuÎ - ((1, 2)); - -577 * - $¡²ýy - (* -__»¡riù - -__de¡ -, - -578 -__cÚ¡ - * -__»¡riù - -__¤c -, -size_t - -__n -) - -579 -__THROW - - `__nÚnuÎ - ((1, 2)); - -582 #ifdef -__USE_GNU - - -584  - $¡rv”scmp - ( -__cÚ¡ - * -__s1 -, __cÚ¡ * -__s2 -) - -585 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1, 2)); - -588 * - $¡räy - (* -__¡ršg -è -__THROW - - `__nÚnuÎ - ((1)); - -591 * - $memäob - (* -__s -, -size_t - -__n -è -__THROW - - `__nÚnuÎ - ((1)); - -593 #iâdeà -ba£Çme - - -598 #ifdeà -__CORRECT_ISO_CPP_STRING_H_PROTO - - -599 "C++" * - $ba£Çme - (* -__fž’ame -) - -600 -__THROW - - `__asm - ("ba£Çme"è - `__nÚnuÎ - ((1)); - -601 "C++" -__cÚ¡ - * - $ba£Çme - ( -__cÚ¡ - * -__fž’ame -) - -602 -__THROW - - `__asm - ("ba£Çme"è - `__nÚnuÎ - ((1)); - -604 * - $ba£Çme - ( -__cÚ¡ - * -__fž’ame -è -__THROW - - `__nÚnuÎ - ((1)); - -610 #ià -defšed - -__GNUC__ - && __GNUC__ >= 2 - -611 #ià -defšed - -__OPTIMIZE__ - && !defšed -__OPTIMIZE_SIZE__ - \ - -612 && ! -defšed - -__NO_INLINE__ - && !defšed -__ýlu¥lus - - -632  - ~ - -635  - ~ - -638 #ià -__USE_FORTIFY_LEVEL - > 0 && -defšed - -__ex‹º_®ways_šlše - - -640  - ~ - -644 -__END_DECLS - - - @/usr/include/bits/huge_val.h - -22 #iâdeà -_MATH_H - - -28 #ià -__GNUC_PREREQ -(3,3) - -29  - #HUGE_VAL - ( - `__bužtš_huge_v® -()) - - ) - -30 #–ià -__GNUC_PREREQ -(2,96) - -31  - #HUGE_VAL - ( -__ex‹nsiÚ__ - 0x1.0 -p2047 -) - - ) - -32 #–ià -defšed - -__GNUC__ - - -34  - #HUGE_VAL - \ - -35 ( -__ex‹nsiÚ__ - \ - -36 ((uniÚ {  -__l - - `__©Œibu‹__ -(( - `__mode__ -( -__DI__ -)));  -__d -; }) \ - -37 { -__l -: 0x7ff0000000000000ULL }). -__d -) - - ) - -41  - ~<’dŸn.h -> - -43 uniÚ {  - m__c -[8];  - m__d -; } - t__huge_v®_t -; - -45 #ià -__BYTE_ORDER - =ð -__BIG_ENDIAN - - -46  - #__HUGE_VAL_by‹s - { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } - - ) - -48 #ià -__BYTE_ORDER - =ð -__LITTLE_ENDIAN - - -49  - #__HUGE_VAL_by‹s - { 0, 0, 0, 0, 0, 0, 0xf0, 0x7à} - - ) - -52  -__huge_v®_t - - g__huge_v® - = { -__HUGE_VAL_by‹s - }; - -53  - #HUGE_VAL - ( -__huge_v® -. -__d -) - - ) - - @/usr/include/bits/huge_valf.h - -22 #iâdeà -_MATH_H - - -28 #ià -__GNUC_PREREQ -(3,3) - -29  - #HUGE_VALF - ( - `__bužtš_huge_v®f -()) - - ) - -30 #–ià -__GNUC_PREREQ -(2,96) - -31  - #HUGE_VALF - ( -__ex‹nsiÚ__ - 0x1.0 -p255f -) - - ) - -32 #–ià -defšed - -__GNUC__ - - -34  - #HUGE_VALF - \ - -35 ( -__ex‹nsiÚ__ - \ - -36 ((uniÚ {  -__l - - `__©Œibu‹__ -(( - `__mode__ -( -__SI__ -)));  -__d -; }) \ - -37 { -__l -: 0x7f800000UL }). -__d -) - - ) - -41 uniÚ {  - m__c -[4];  - m__f -; } - t__huge_v®f_t -; - -43 #ià -__BYTE_ORDER - =ð -__BIG_ENDIAN - - -44  - #__HUGE_VALF_by‹s - { 0x7f, 0x80, 0, 0 } - - ) - -46 #ià -__BYTE_ORDER - =ð -__LITTLE_ENDIAN - - -47  - #__HUGE_VALF_by‹s - { 0, 0, 0x80, 0x7à} - - ) - -50  -__huge_v®f_t - - g__huge_v®f - = { -__HUGE_VALF_by‹s - }; - -51  - #HUGE_VALF - ( -__huge_v®f -. -__f -) - - ) - - @/usr/include/bits/huge_vall.h - -21 #iâdeà -_MATH_H - - -25 #ià -__GNUC_PREREQ -(3,3) - -26  - #HUGE_VALL - ( - `__bužtš_huge_v®l -()) - - ) - -28  - #HUGE_VALL - ((è -HUGE_VAL -) - - ) - - @/usr/include/bits/inf.h - -20 #iâdeà -_MATH_H - - -26 #ià -__GNUC_PREREQ -(3,3) - -27  - #INFINITY - ( - `__bužtš_šff -()) - - ) - -29  - #INFINITY - -HUGE_VALF - - - ) - - @/usr/include/bits/mathcalls.h - -46 #iâdeà -_MATH_H - - -53 -_MdoubË_BEGIN_NAMESPACE - - -55 -__MATHCALL - ( -acos -,, ( -_MdoubË_ - -__x -)); - -57 -__MATHCALL - ( -asš -,, ( -_MdoubË_ - -__x -)); - -59 -__MATHCALL - ( -©ª -,, ( -_MdoubË_ - -__x -)); - -61 -__MATHCALL - ( -©ª2 -,, ( -_MdoubË_ - -__y -, _MdoubË_ -__x -)); - -64 -__MATHCALL - ( -cos -,, ( -_MdoubË_ - -__x -)); - -66 -__MATHCALL - ( -sš -,, ( -_MdoubË_ - -__x -)); - -68 -__MATHCALL - ( -n -,, ( -_MdoubË_ - -__x -)); - -73 -__MATHCALL - ( -cosh -,, ( -_MdoubË_ - -__x -)); - -75 -__MATHCALL - ( -sšh -,, ( -_MdoubË_ - -__x -)); - -77 -__MATHCALL - ( -nh -,, ( -_MdoubË_ - -__x -)); - -78 - g_MdoubË_END_NAMESPACE - - -80 #ifdeà -__USE_GNU - - -82 -__MATHDECL - (, -sšcos -,, - -83 ( -_MdoubË_ - -__x -, _MdoubË_ * -__sšx -, _MdoubË_ * -__cosx -)); - -86 #ià -defšed - -__USE_MISC - || defšed -__USE_XOPEN_EXTENDED - || defšed -__USE_ISOC99 - - -87 -__BEGIN_NAMESPACE_C99 - - -89 -__MATHCALL - ( -acosh -,, ( -_MdoubË_ - -__x -)); - -91 -__MATHCALL - ( -asšh -,, ( -_MdoubË_ - -__x -)); - -93 -__MATHCALL - ( -©ªh -,, ( -_MdoubË_ - -__x -)); - -94 - g__END_NAMESPACE_C99 - - -99 -_MdoubË_BEGIN_NAMESPACE - - -101 -__MATHCALL - ( -exp -,, ( -_MdoubË_ - -__x -)); - -104 -__MATHCALL - ( -äexp -,, ( -_MdoubË_ - -__x -, * -__expÚ’t -)); - -107 -__MATHCALL - ( -ldexp -,, ( -_MdoubË_ - -__x -,  -__expÚ’t -)); - -110 -__MATHCALL - ( -log -,, ( -_MdoubË_ - -__x -)); - -113 -__MATHCALL - ( -log10 -,, ( -_MdoubË_ - -__x -)); - -116 -__MATHCALL - ( -modf -,, ( -_MdoubË_ - -__x -, _MdoubË_ * -__Œ -)); - -117 - g_MdoubË_END_NAMESPACE - - -119 #ifdeà -__USE_GNU - - -121 -__MATHCALL - ( -exp10 -,, ( -_MdoubË_ - -__x -)); - -123 -__MATHCALL - ( -pow10 -,, ( -_MdoubË_ - -__x -)); - -126 #ià -defšed - -__USE_MISC - || defšed -__USE_XOPEN_EXTENDED - || defšed -__USE_ISOC99 - - -127 -__BEGIN_NAMESPACE_C99 - - -129 -__MATHCALL - ( -expm1 -,, ( -_MdoubË_ - -__x -)); - -132 -__MATHCALL - ( -log1p -,, ( -_MdoubË_ - -__x -)); - -135 -__MATHCALL - ( -logb -,, ( -_MdoubË_ - -__x -)); - -136 - g__END_NAMESPACE_C99 - - -139 #ifdeà -__USE_ISOC99 - - -140 -__BEGIN_NAMESPACE_C99 - - -142 -__MATHCALL - ( -exp2 -,, ( -_MdoubË_ - -__x -)); - -145 -__MATHCALL - ( -log2 -,, ( -_MdoubË_ - -__x -)); - -146 - g__END_NAMESPACE_C99 - - -152 -_MdoubË_BEGIN_NAMESPACE - - -154 -__MATHCALL - ( -pow -,, ( -_MdoubË_ - -__x -, _MdoubË_ -__y -)); - -157 -__MATHCALL - ( -sq¹ -,, ( -_MdoubË_ - -__x -)); - -158 - g_MdoubË_END_NAMESPACE - - -160 #ià -defšed - -__USE_MISC - || defšed -__USE_XOPEN - || defšed -__USE_ISOC99 - - -161 -__BEGIN_NAMESPACE_C99 - - -163 -__MATHCALL - ( -hypÙ -,, ( -_MdoubË_ - -__x -, _MdoubË_ -__y -)); - -164 - g__END_NAMESPACE_C99 - - -167 #ià -defšed - -__USE_MISC - || defšed -__USE_XOPEN_EXTENDED - || defšed -__USE_ISOC99 - - -168 -__BEGIN_NAMESPACE_C99 - - -170 -__MATHCALL - ( -cb¹ -,, ( -_MdoubË_ - -__x -)); - -171 - g__END_NAMESPACE_C99 - - -177 -_MdoubË_BEGIN_NAMESPACE - - -179 -__MATHCALLX - ( -ûž -,, ( -_MdoubË_ - -__x -), ( -__cÚ¡__ -)); - -182 -__MATHCALLX - ( -çbs -,, ( -_MdoubË_ - -__x -), ( -__cÚ¡__ -)); - -185 -__MATHCALLX - ( -æoÜ -,, ( -_MdoubË_ - -__x -), ( -__cÚ¡__ -)); - -188 -__MATHCALL - ( -fmod -,, ( -_MdoubË_ - -__x -, _MdoubË_ -__y -)); - -193 -__MATHDECL_1 - (, -__isšf -,, ( -_MdoubË_ - -__v®ue -)è -__©Œibu‹__ - (( -__cÚ¡__ -)); - -196 -__MATHDECL_1 - (, -__fš™e -,, ( -_MdoubË_ - -__v®ue -)è -__©Œibu‹__ - (( -__cÚ¡__ -)); - -197 - g_MdoubË_END_NAMESPACE - - -199 #ifdeà -__USE_MISC - - -202 -__MATHDECL_1 - (, -isšf -,, ( -_MdoubË_ - -__v®ue -)è -__©Œibu‹__ - (( -__cÚ¡__ -)); - -205 -__MATHDECL_1 - (, -fš™e -,, ( -_MdoubË_ - -__v®ue -)è -__©Œibu‹__ - (( -__cÚ¡__ -)); - -208 -__MATHCALL - ( -d»m -,, ( -_MdoubË_ - -__x -, _MdoubË_ -__y -)); - -212 -__MATHCALL - ( -signifiÿnd -,, ( -_MdoubË_ - -__x -)); - -215 #ià -defšed - -__USE_MISC - || defšed -__USE_ISOC99 - - -216 -__BEGIN_NAMESPACE_C99 - - -218 -__MATHCALLX - ( -cÝysign -,, ( -_MdoubË_ - -__x -, _MdoubË_ -__y -), ( -__cÚ¡__ -)); - -219 - g__END_NAMESPACE_C99 - - -222 #ifdeà -__USE_ISOC99 - - -223 -__BEGIN_NAMESPACE_C99 - - -225 -__MATHCALLX - ( -Çn -,, ( -__cÚ¡ - * -__gb -), ( -__cÚ¡__ -)); - -226 - g__END_NAMESPACE_C99 - - -231 -__MATHDECL_1 - (, -__i¢ª -,, ( -_MdoubË_ - -__v®ue -)è -__©Œibu‹__ - (( -__cÚ¡__ -)); - -233 #ià -defšed - -__USE_MISC - || defšed -__USE_XOPEN - - -235 -__MATHDECL_1 - (, -i¢ª -,, ( -_MdoubË_ - -__v®ue -)è -__©Œibu‹__ - (( -__cÚ¡__ -)); - -238 -__MATHCALL - ( -j0 -,, ( -_MdoubË_ -)); - -239 -__MATHCALL - ( -j1 -,, ( -_MdoubË_ -)); - -240 -__MATHCALL - ( -jn -,, (, -_MdoubË_ -)); - -241 -__MATHCALL - ( -y0 -,, ( -_MdoubË_ -)); - -242 -__MATHCALL - ( -y1 -,, ( -_MdoubË_ -)); - -243 -__MATHCALL - ( -yn -,, (, -_MdoubË_ -)); - -247 #ià -defšed - -__USE_MISC - || defšed -__USE_XOPEN - || defšed -__USE_ISOC99 - - -248 -__BEGIN_NAMESPACE_C99 - - -250 -__MATHCALL - ( -”f -,, ( -_MdoubË_ -)); - -251 -__MATHCALL - ( -”fc -,, ( -_MdoubË_ -)); - -252 -__MATHCALL - ( -lgamma -,, ( -_MdoubË_ -)); - -253 - g__END_NAMESPACE_C99 - - -256 #ifdeà -__USE_ISOC99 - - -257 -__BEGIN_NAMESPACE_C99 - - -259 -__MATHCALL - ( -tgamma -,, ( -_MdoubË_ -)); - -260 - g__END_NAMESPACE_C99 - - -263 #ià -defšed - -__USE_MISC - || defšed -__USE_XOPEN - - -265 -__MATHCALL - ( -gamma -,, ( -_MdoubË_ -)); - -268 #ifdeà -__USE_MISC - - -272 -__MATHCALL - ( -lgamma -, -_r -, ( -_MdoubË_ -, * -__signgamp -)); - -276 #ià -defšed - -__USE_MISC - || defšed -__USE_XOPEN_EXTENDED - || defšed -__USE_ISOC99 - - -277 -__BEGIN_NAMESPACE_C99 - - -280 -__MATHCALL - ( -ršt -,, ( -_MdoubË_ - -__x -)); - -283 -__MATHCALLX - ( -Ãxá” -,, ( -_MdoubË_ - -__x -, _MdoubË_ -__y -), ( -__cÚ¡__ -)); - -284 #ià -defšed - -__USE_ISOC99 - && !defšed -__LDBL_COMPAT - - -285 -__MATHCALLX - ( -Ãx‰ow¬d -,, ( -_MdoubË_ - -__x -,  -__y -), ( -__cÚ¡__ -)); - -289 -__MATHCALL - ( -»mašd” -,, ( -_MdoubË_ - -__x -, _MdoubË_ -__y -)); - -291 #ià -defšed - -__USE_MISC - || defšed -__USE_ISOC99 - - -293 -__MATHCALL - ( -sÿlbn -,, ( -_MdoubË_ - -__x -,  -__n -)); - -297 -__MATHDECL - (, -žogb -,, ( -_MdoubË_ - -__x -)); - -300 #ifdeà -__USE_ISOC99 - - -302 -__MATHCALL - ( -sÿlbÊ -,, ( -_MdoubË_ - -__x -,  -__n -)); - -306 -__MATHCALL - ( -ìbyšt -,, ( -_MdoubË_ - -__x -)); - -310 -__MATHCALLX - ( -round -,, ( -_MdoubË_ - -__x -), ( -__cÚ¡__ -)); - -314 -__MATHCALLX - ( -Œunc -,, ( -_MdoubË_ - -__x -), ( -__cÚ¡__ -)); - -319 -__MATHCALL - ( -»mquo -,, ( -_MdoubË_ - -__x -, _MdoubË_ -__y -, * -__quo -)); - -326 -__MATHDECL - (, -Ìšt -,, ( -_MdoubË_ - -__x -)); - -327 -__MATHDECL - (, -Îršt -,, ( -_MdoubË_ - -__x -)); - -331 -__MATHDECL - (, -Ìound -,, ( -_MdoubË_ - -__x -)); - -332 -__MATHDECL - (, -Îround -,, ( -_MdoubË_ - -__x -)); - -336 -__MATHCALL - ( -fdim -,, ( -_MdoubË_ - -__x -, _MdoubË_ -__y -)); - -339 -__MATHCALL - ( -fmax -,, ( -_MdoubË_ - -__x -, _MdoubË_ -__y -)); - -342 -__MATHCALL - ( -fmš -,, ( -_MdoubË_ - -__x -, _MdoubË_ -__y -)); - -346 -__MATHDECL_1 - (, -__åþassify -,, ( -_MdoubË_ - -__v®ue -)) - -347 -__©Œibu‹__ - (( -__cÚ¡__ -)); - -350 -__MATHDECL_1 - (, -__signb™ -,, ( -_MdoubË_ - -__v®ue -)) - -351 -__©Œibu‹__ - (( -__cÚ¡__ -)); - -355 -__MATHCALL - ( -fma -,, ( -_MdoubË_ - -__x -, _MdoubË_ -__y -, _MdoubË_ -__z -)); - -358 #ià -defšed - -__USE_MISC - || defšed -__USE_XOPEN_EXTENDED - || defšed -__USE_ISOC99 - - -359 - g__END_NAMESPACE_C99 - - -362 #ià -defšed - -__USE_MISC - || defšed -__USE_XOPEN_EXTENDED - - -364 -__MATHCALL - ( -sÿlb -,, ( -_MdoubË_ - -__x -, _MdoubË_ -__n -)); - - @/usr/include/bits/mathdef.h - -19 #ià! -defšed - -_MATH_H - && !defšed -_COMPLEX_H - - -23 #ià -defšed - -__USE_ISOC99 - && defšed -_MATH_H - && !defšed -_MATH_H_MATHDEF - - -24  - #_MATH_H_MATHDEF - 1 - - ) - -26  - ~ - -28 #ià -__WORDSIZE - =ð64 || ( -defšed - -__FLT_EVAL_METHOD__ - && __FLT_EVAL_METHOD__ == 0) - -31  - tæßt_t -; - -32  - tdoubË_t -; - -38  - tæßt_t -; - -40  - tdoubË_t -; - -45  - #FP_ILOGB0 - (-2147483647 - 1) - - ) - -46  - #FP_ILOGBNAN - (-2147483647 - 1) - - ) - - @/usr/include/bits/mathinline.h - -21 #iâdeà -_MATH_H - - -25  - ~ - -27 #iâdeà -__ex‹º_šlše - - -28  - #__MATH_INLINE - -__šlše - - - ) - -30  - #__MATH_INLINE - -__ex‹º_šlše - - - ) - -34 #ià -defšed - -__USE_ISOC99 - && defšed -__GNUC__ - && __GNUC__ >= 2 - -37 -__MATH_INLINE -  - -38 -__NTH - ( - $__signb™f - ( -__x -)) - -40 #ià -__WORDSIZE - == 32 - -41 -__ex‹nsiÚ__ - uniÚ {  -__f -;  -__i -; } -__u - = { __f: -__x - }; - -42  -__u -. -__i - < 0; - -44  -__m -; - -45 - `__asm - ("pmovmskb %1, %0" : "ô" ( -__m -è: "x" ( -__x -)); - -46  -__m - & 0x8; - -48 - } -} - -49 -__MATH_INLINE -  - -50 -__NTH - ( - $__signb™ - ( -__x -)) - -52 #ià -__WORDSIZE - == 32 - -53 -__ex‹nsiÚ__ - uniÚ {  -__d -;  -__i -[2]; } -__u - = { __d: -__x - }; - -54  -__u -. -__i -[1] < 0; - -56  -__m -; - -57 - `__asm - ("pmovmskb %1, %0" : "ô" ( -__m -è: "x" ( -__x -)); - -58  -__m - & 0x80; - -60 - } -} - -61 -__MATH_INLINE -  - -62 -__NTH - ( - $__signb™l - ( -__x -)) - -64 -__ex‹nsiÚ__ - uniÚ {  -__l -;  -__i -[3]; } -__u - = { __l: -__x - }; - -65  ( -__u -. -__i -[2] & 0x8000) != 0; - -66 - } -} - - @/usr/include/bits/nan.h - -20 #iâdeà -_MATH_H - - -27 #ià -__GNUC_PREREQ -(3,3) - -29  - #NAN - ( - `__bužtš_Çnf - ("")) - - ) - -31 #–ià -defšed - -__GNUC__ - - -33  - #NAN - \ - -34 ( -__ex‹nsiÚ__ - \ - -35 ((uniÚ {  -__l - - `__©Œibu‹__ - (( - `__mode__ - ( -__SI__ -)));  -__d -; }) \ - -36 { -__l -: 0x7fc00000UL }). -__d -) - - ) - -40  - ~<’dŸn.h -> - -42 #ià -__BYTE_ORDER - =ð -__BIG_ENDIAN - - -43  - #__Çn_by‹s - { 0x7f, 0xc0, 0, 0 } - - ) - -45 #ià -__BYTE_ORDER - =ð -__LITTLE_ENDIAN - - -46  - #__Çn_by‹s - { 0, 0, 0xc0, 0x7à} - - ) - -49 uniÚ {  - m__c -[4];  - m__d -; } -__Çn_uniÚ - - -50 - g__©Œibu‹_u£d__ - = { -__Çn_by‹s - }; - -51  - #NAN - ( -__Çn_uniÚ -. -__d -) - - ) - - @/usr/include/bits/stdio-ldbl.h - -20 #iâdeà -_STDIO_H - - -24 -__BEGIN_NAMESPACE_STD - - -25 - $__LDBL_REDIR_DECL - ( -årštf -) - -26 - $__LDBL_REDIR_DECL - ( -´štf -) - -27 - $__LDBL_REDIR_DECL - ( -¥rštf -) - -28 - $__LDBL_REDIR_DECL - ( -vårštf -) - -29 - $__LDBL_REDIR_DECL - ( -v´štf -) - -30 - $__LDBL_REDIR_DECL - ( -v¥rštf -) - -31 #ià -defšed - -__USE_ISOC99 - && !defšed -__USE_GNU - \ - -32 && ! -defšed - -__REDIRECT - \ - -33 && ( -defšed - -__STRICT_ANSI__ - || defšed -__USE_XOPEN2K -) - -34 - $__LDBL_REDIR1_DECL - ( -fsÿnf -, -__Ædbl___isoc99_fsÿnf -) - -35 - $__LDBL_REDIR1_DECL - ( -sÿnf -, -__Ædbl___isoc99_sÿnf -) - -36 - $__LDBL_REDIR1_DECL - ( -ssÿnf -, -__Ædbl___isoc99_ssÿnf -) - -38 - $__LDBL_REDIR_DECL - ( -fsÿnf -) - -39 - $__LDBL_REDIR_DECL - ( -sÿnf -) - -40 - $__LDBL_REDIR_DECL - ( -ssÿnf -) - -42 -__END_NAMESPACE_STD - - -44 #ià -defšed - -__USE_BSD - || defšed -__USE_ISOC99 - || defšed -__USE_UNIX98 - - -45 -__BEGIN_NAMESPACE_C99 - - -46 - $__LDBL_REDIR_DECL - ( -¢´štf -) - -47 - $__LDBL_REDIR_DECL - ( -v¢´štf -) - -48 -__END_NAMESPACE_C99 - - -51 #ifdef -__USE_ISOC99 - - -52 -__BEGIN_NAMESPACE_C99 - - -53 #ià! -defšed - -__USE_GNU - && !defšed -__REDIRECT - \ - -54 && ( -defšed - -__STRICT_ANSI__ - || defšed -__USE_XOPEN2K -) - -55 - $__LDBL_REDIR1_DECL - ( -vfsÿnf -, -__Ædbl___isoc99_vfsÿnf -) - -56 - $__LDBL_REDIR1_DECL - ( -vsÿnf -, -__Ædbl___isoc99_vsÿnf -) - -57 - $__LDBL_REDIR1_DECL - ( -vssÿnf -, -__Ædbl___isoc99_vssÿnf -) - -59 - $__LDBL_REDIR_DECL - ( -vfsÿnf -) - -60 - $__LDBL_REDIR_DECL - ( -vssÿnf -) - -61 - $__LDBL_REDIR_DECL - ( -vsÿnf -) - -63 -__END_NAMESPACE_C99 - - -66 #ifdeà -__USE_GNU - - -67 - $__LDBL_REDIR_DECL - ( -vd´štf -) - -68 - $__LDBL_REDIR_DECL - ( -d´štf -) - -69 - $__LDBL_REDIR_DECL - ( -va¥rštf -) - -70 - $__LDBL_REDIR_DECL - ( -__a¥rštf -) - -71 - $__LDBL_REDIR_DECL - ( -a¥rštf -) - -72 - $__LDBL_REDIR_DECL - ( -ob¡ack_´štf -) - -73 - $__LDBL_REDIR_DECL - ( -ob¡ack_v´štf -) - -76 #ià -__USE_FORTIFY_LEVEL - > 0 && -defšed - -__ex‹º_®ways_šlše - - -77 - $__LDBL_REDIR_DECL - ( -__¥rštf_chk -) - -78 - $__LDBL_REDIR_DECL - ( -__v¥rštf_chk -) - -79 #ià -defšed - -__USE_BSD - || defšed -__USE_ISOC99 - || defšed -__USE_UNIX98 - - -80 - $__LDBL_REDIR_DECL - ( -__¢´štf_chk -) - -81 - $__LDBL_REDIR_DECL - ( -__v¢´štf_chk -) - -83 #ià -__USE_FORTIFY_LEVEL - > 1 - -84 - $__LDBL_REDIR_DECL - ( -__årštf_chk -) - -85 - $__LDBL_REDIR_DECL - ( -__´štf_chk -) - -86 - $__LDBL_REDIR_DECL - ( -__vårštf_chk -) - -87 - $__LDBL_REDIR_DECL - ( -__v´štf_chk -) - -88 #ifdeà -__USE_GNU - - -89 - $__LDBL_REDIR_DECL - ( -__a¥rštf_chk -) - -90 - $__LDBL_REDIR_DECL - ( -__va¥rštf_chk -) - -91 - $__LDBL_REDIR_DECL - ( -__d´štf_chk -) - -92 - $__LDBL_REDIR_DECL - ( -__vd´štf_chk -) - -93 - $__LDBL_REDIR_DECL - ( -__ob¡ack_´štf_chk -) - -94 - $__LDBL_REDIR_DECL - ( -__ob¡ack_v´štf_chk -) - - @/usr/include/bits/stdio.h - -20 #iâdeà -_STDIO_H - - -24 #iâdeà -__ex‹º_šlše - - -25  - #__STDIO_INLINE - -šlše - - - ) - -27  - #__STDIO_INLINE - -__ex‹º_šlše - - - ) - -31 #ifdeà -__USE_EXTERN_INLINES - - -34 #ià!( -__USE_FORTIFY_LEVEL - > 0 && -defšed - -__ex‹º_®ways_šlše -) - -36 -__STDIO_INLINE -  - -37 - $v´štf - ( -__cÚ¡ - * -__»¡riù - -__fmt -, -_G_va_li¡ - -__¬g -) - -39  - `vårštf - ( -¡dout -, -__fmt -, -__¬g -); - -40 - } -} - -44 -__STDIO_INLINE -  - -45 - $g‘ch¬ - () - -47  - `_IO_g‘c - ( -¡dš -); - -48 - } -} - -51 #ifdeà -__USE_MISC - - -53 -__STDIO_INLINE -  - -54 - $fg‘c_uÆocked - ( -FILE - * -__å -) - -56  - `_IO_g‘c_uÆocked - ( -__å -); - -57 - } -} - -61 #ià -defšed - -__USE_POSIX - || defšed -__USE_MISC - - -63 -__STDIO_INLINE -  - -64 - $g‘c_uÆocked - ( -FILE - * -__å -) - -66  - `_IO_g‘c_uÆocked - ( -__å -); - -67 - } -} - -70 -__STDIO_INLINE -  - -71 - $g‘ch¬_uÆocked - () - -73  - `_IO_g‘c_uÆocked - ( -¡dš -); - -74 - } -} - -79 -__STDIO_INLINE -  - -80 - $putch¬ - ( -__c -) - -82  - `_IO_putc - ( -__c -, -¡dout -); - -83 - } -} - -86 #ifdeà -__USE_MISC - - -88 -__STDIO_INLINE -  - -89 - $åutc_uÆocked - ( -__c -, -FILE - * -__¡»am -) - -91  - `_IO_putc_uÆocked - ( -__c -, -__¡»am -); - -92 - } -} - -96 #ià -defšed - -__USE_POSIX - || defšed -__USE_MISC - - -98 -__STDIO_INLINE -  - -99 - $putc_uÆocked - ( -__c -, -FILE - * -__¡»am -) - -101  - `_IO_putc_uÆocked - ( -__c -, -__¡»am -); - -102 - } -} - -105 -__STDIO_INLINE -  - -106 - $putch¬_uÆocked - ( -__c -) - -108  - `_IO_putc_uÆocked - ( -__c -, -¡dout -); - -109 - } -} - -113 #ifdef -__USE_GNU - - -115 -__STDIO_INLINE - -_IO_ssize_t - - -116 - $g‘lše - (** -__lš•Œ -, -size_t - * -__n -, -FILE - * -__¡»am -) - -118  - `__g‘d–im - ( -__lš•Œ -, -__n -, '\n', -__¡»am -); - -119 - } -} - -123 #ifdeà -__USE_MISC - - -125 -__STDIO_INLINE -  - -126 -__NTH - ( - $ãof_uÆocked - ( -FILE - * -__¡»am -)) - -128  - `_IO_ãof_uÆocked - ( -__¡»am -); - -129 - } -} - -132 -__STDIO_INLINE -  - -133 -__NTH - ( - $ã¼Ü_uÆocked - ( -FILE - * -__¡»am -)) - -135  - `_IO_ã¼Ü_uÆocked - ( -__¡»am -); - -136 - } -} - -142 #ià -defšed - -__USE_MISC - && defšed -__GNUC__ - && defšed -__OPTIMIZE__ - \ - -143 && ! -defšed - - g__ýlu¥lus - - -145  - #ä—d_uÆocked -( -±r -, -size -, -n -, -¡»am -) \ - -146 ( - `__ex‹nsiÚ__ - (( - `__bužtš_cÚ¡ªt_p - ( -size -è&& __bužtš_cÚ¡ªt_°( -n -) \ - -147 && ( -size_t -è( -size -è* (size_tè( -n -) <= 8 \ - -148 && ( -size_t -è( -size -) != 0) \ - -149 ? ({ * -__±r - = (*è( -±r -); \ - -150 -FILE - * -__¡»am - = ( -¡»am -); \ - -151 -size_t - -__út -; \ - -152  -__út - = ( -size_t -è( -size -è* (size_tè( -n -); \ - -153 -__út - > 0; --__cnt) \ - -155  -__c - = - `_IO_g‘c_uÆocked - ( -__¡»am -); \ - -156 ià( -__c - =ð -EOF -) \ - -158 * -__±r -++ = -__c -; \ - -160 (( -size_t -è( -size -è* (size_tè( -n -è- -__út -) \ - -161 / ( -size_t -è( -size -); }) \ - -162 : ((( - `__bužtš_cÚ¡ªt_p - ( -size -è&& ( -size_t -) (size) == 0) \ - -163 || ( - `__bužtš_cÚ¡ªt_p - ( -n -è&& ( -size_t -) (n) == 0)) \ - -165 ? ((è( -±r -), (è( -¡»am -), (è( -size -), \ - -166 (è( -n -), ( -size_t -) 0) \ - -167 : - `ä—d_uÆocked - ( -±r -, -size -, -n -, -¡»am -)))) - - ) - -169  - #fwr™e_uÆocked -( -±r -, -size -, -n -, -¡»am -) \ - -170 ( - `__ex‹nsiÚ__ - (( - `__bužtš_cÚ¡ªt_p - ( -size -è&& __bužtš_cÚ¡ªt_°( -n -) \ - -171 && ( -size_t -è( -size -è* (size_tè( -n -) <= 8 \ - -172 && ( -size_t -è( -size -) != 0) \ - -173 ? ({ cÚ¡ * -__±r - = (cÚ¡ *è( -±r -); \ - -174 -FILE - * -__¡»am - = ( -¡»am -); \ - -175 -size_t - -__út -; \ - -176  -__út - = ( -size_t -è( -size -è* (size_tè( -n -); \ - -177 -__út - > 0; --__cnt) \ - -178 ià( - `_IO_putc_uÆocked - (* -__±r -++, -__¡»am -è=ð -EOF -) \ - -180 (( -size_t -è( -size -è* (size_tè( -n -è- -__út -) \ - -181 / ( -size_t -è( -size -); }) \ - -182 : ((( - `__bužtš_cÚ¡ªt_p - ( -size -è&& ( -size_t -) (size) == 0) \ - -183 || ( - `__bužtš_cÚ¡ªt_p - ( -n -è&& ( -size_t -) (n) == 0)) \ - -185 ? ((è( -±r -), (è( -¡»am -), (è( -size -), \ - -186 (è( -n -), ( -size_t -) 0) \ - -187 : - `fwr™e_uÆocked - ( -±r -, -size -, -n -, -¡»am -)))) - - ) - -191 #undeà -__STDIO_INLINE - - - @/usr/include/bits/stdio2.h - -20 #iâdeà -_STDIO_H - - -24  - $__¥rštf_chk - (* -__»¡riù - -__s -,  -__æag -, -size_t - -__¦’ -, - -25 -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...è -__THROW -; - -26  - $__v¥rštf_chk - (* -__»¡riù - -__s -,  -__æag -, -size_t - -__¦’ -, - -27 -__cÚ¡ - * -__»¡riù - -__fÜm© -, - -28 -_G_va_li¡ - -__­ -è -__THROW -; - -30 #ifdeà -__va_¬g_·ck - - -31 -__ex‹º_®ways_šlše -  - -32 - `__NTH - ( - $¥rštf - (* -__»¡riù - -__s -, -__cÚ¡ - *__»¡riù -__fmt -, ...)) - -34  - `__bužtš___¥rštf_chk - ( -__s -, -__USE_FORTIFY_LEVEL - - 1, - -35 - `__bos - ( -__s -), -__fmt -, - `__va_¬g_·ck - ()); - -36 - } -} - -37 #–ià! -defšed - -__ýlu¥lus - - -38  - #¥rštf -( -¡r -, ...) \ - -39 - `__bužtš___¥rštf_chk - ( -¡r -, -__USE_FORTIFY_LEVEL - - 1, - `__bos - (str), \ - -40 -__VA_ARGS__ -) - - ) - -43 -__ex‹º_®ways_šlše -  - -44 -__NTH - ( - $v¥rštf - (* -__»¡riù - -__s -, -__cÚ¡ - *__»¡riù -__fmt -, - -45 -_G_va_li¡ - -__­ -)) - -47  - `__bužtš___v¥rštf_chk - ( -__s -, -__USE_FORTIFY_LEVEL - - 1, - -48 - `__bos - ( -__s -), -__fmt -, -__­ -); - -49 - } -} - -51 #ià -defšed - -__USE_BSD - || defšed -__USE_ISOC99 - || defšed -__USE_UNIX98 - - -53  - $__¢´štf_chk - (* -__»¡riù - -__s -, -size_t - -__n -,  -__æag -, - -54 -size_t - -__¦’ -, -__cÚ¡ - * -__»¡riù - -__fÜm© -, - -55 ...è -__THROW -; - -56  - $__v¢´štf_chk - (* -__»¡riù - -__s -, -size_t - -__n -,  -__æag -, - -57 -size_t - -__¦’ -, -__cÚ¡ - * -__»¡riù - -__fÜm© -, - -58 -_G_va_li¡ - -__­ -è -__THROW -; - -60 #ifdeà -__va_¬g_·ck - - -61 -__ex‹º_®ways_šlše -  - -62 - `__NTH - ( - $¢´štf - (* -__»¡riù - -__s -, -size_t - -__n -, - -63 -__cÚ¡ - * -__»¡riù - -__fmt -, ...)) - -65  - `__bužtš___¢´štf_chk - ( -__s -, -__n -, -__USE_FORTIFY_LEVEL - - 1, - -66 - `__bos - ( -__s -), -__fmt -, - `__va_¬g_·ck - ()); - -67 - } -} - -68 #–ià! -defšed - -__ýlu¥lus - - -69  - #¢´štf -( -¡r -, -Ën -, ...) \ - -70 - `__bužtš___¢´štf_chk - ( -¡r -, -Ën -, -__USE_FORTIFY_LEVEL - - 1, - `__bos - (str), \ - -71 -__VA_ARGS__ -) - - ) - -74 -__ex‹º_®ways_šlše -  - -75 -__NTH - ( - $v¢´štf - (* -__»¡riù - -__s -, -size_t - -__n -, - -76 -__cÚ¡ - * -__»¡riù - -__fmt -, -_G_va_li¡ - -__­ -)) - -78  - `__bužtš___v¢´štf_chk - ( -__s -, -__n -, -__USE_FORTIFY_LEVEL - - 1, - -79 - `__bos - ( -__s -), -__fmt -, -__­ -); - -80 - } -} - -84 #ià -__USE_FORTIFY_LEVEL - > 1 - -86  -__årštf_chk - ( -FILE - * -__»¡riù - -__¡»am -,  -__æag -, - -87 -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...); - -88  -__´štf_chk - ( -__æag -, -__cÚ¡ - * -__»¡riù - -__fÜm© -, ...); - -89  -__vårštf_chk - ( -FILE - * -__»¡riù - -__¡»am -,  -__æag -, - -90 -__cÚ¡ - * -__»¡riù - -__fÜm© -, -_G_va_li¡ - -__­ -); - -91  -__v´štf_chk - ( -__æag -, -__cÚ¡ - * -__»¡riù - -__fÜm© -, - -92 -_G_va_li¡ - -__­ -); - -94 #ifdeà -__va_¬g_·ck - - -95 -__ex‹º_®ways_šlše -  - -96 - $årštf - ( -FILE - * -__»¡riù - -__¡»am -, -__cÚ¡ - *__»¡riù -__fmt -, ...) - -98  - `__årštf_chk - ( -__¡»am -, -__USE_FORTIFY_LEVEL - - 1, -__fmt -, - -99 - `__va_¬g_·ck - ()); - -100 - } -} - -102 -__ex‹º_®ways_šlše -  - -103 - $´štf - ( -__cÚ¡ - * -__»¡riù - -__fmt -, ...) - -105  - `__´štf_chk - ( -__USE_FORTIFY_LEVEL - - 1, -__fmt -, - `__va_¬g_·ck - ()); - -106 - } -} - -107 #–ià! -defšed - -__ýlu¥lus - - -108  - #´štf -(...) \ - -109 - `__´štf_chk - ( -__USE_FORTIFY_LEVEL - - 1, -__VA_ARGS__ -) - - ) - -110  - #årštf -( -¡»am -, ...) \ - -111 - `__årštf_chk - ( -¡»am -, -__USE_FORTIFY_LEVEL - - 1, -__VA_ARGS__ -) - - ) - -114 -__ex‹º_®ways_šlše -  - -115 - $v´štf - ( -__cÚ¡ - * -__»¡riù - -__fmt -, -_G_va_li¡ - -__­ -) - -117 #ifdeà -__USE_EXTERN_INLINES - - -118  - `__vårštf_chk - ( -¡dout -, -__USE_FORTIFY_LEVEL - - 1, -__fmt -, -__­ -); - -120  - `__v´štf_chk - ( -__USE_FORTIFY_LEVEL - - 1, -__fmt -, -__­ -); - -122 - } -} - -124 -__ex‹º_®ways_šlše -  - -125 - $vårštf - ( -FILE - * -__»¡riù - -__¡»am -, - -126 -__cÚ¡ - * -__»¡riù - -__fmt -, -_G_va_li¡ - -__­ -) - -128  - `__vårštf_chk - ( -__¡»am -, -__USE_FORTIFY_LEVEL - - 1, -__fmt -, -__­ -); - -129 - } -} - -131 #ifdeà -__USE_GNU - - -133  - $__a¥rštf_chk - (** -__»¡riù - -__±r -,  -__æag -, - -134 -__cÚ¡ - * -__»¡riù - -__fmt -, ...) - -135 -__THROW - - `__©Œibu‹__ - (( - $__fÜm©__ - ( -__´štf__ -, 3, 4))è -__wur -; - -136  - $__va¥rštf_chk - (** -__»¡riù - -__±r -,  -__æag -, - -137 -__cÚ¡ - * -__»¡riù - -__fmt -, -_G_va_li¡ - -__¬g -) - -138 -__THROW - - `__©Œibu‹__ - (( - $__fÜm©__ - ( -__´štf__ -, 3, 0))è -__wur -; - -139  - $__d´štf_chk - ( -__fd -,  -__æag -, -__cÚ¡ - * -__»¡riù - -__fmt -, - -140 ...è - `__©Œibu‹__ - (( - `__fÜm©__ - ( -__´štf__ -, 3, 4))); - -141  - $__vd´štf_chk - ( -__fd -,  -__æag -, - -142 -__cÚ¡ - * -__»¡riù - -__fmt -, -_G_va_li¡ - -__¬g -) - -143 - `__©Œibu‹__ - (( - `__fÜm©__ - ( -__´štf__ -, 3, 0))); - -144  - $__ob¡ack_´štf_chk - ( -ob¡ack - * -__»¡riù - -__ob¡ack -, - -145  -__æag -, -__cÚ¡ - * -__»¡riù - -__fÜm© -, - -147 -__THROW - - `__©Œibu‹__ - (( - `__fÜm©__ - ( -__´štf__ -, 3, 4))); - -148  - $__ob¡ack_v´štf_chk - ( -ob¡ack - * -__»¡riù - -__ob¡ack -, - -149  -__æag -, - -150 -__cÚ¡ - * -__»¡riù - -__fÜm© -, - -151 -_G_va_li¡ - -__¬gs -) - -152 -__THROW - - `__©Œibu‹__ - (( - `__fÜm©__ - ( -__´štf__ -, 3, 0))); - -154 #ifdeà -__va_¬g_·ck - - -155 -__ex‹º_®ways_šlše -  - -156 - `__NTH - ( - $a¥rštf - (** -__»¡riù - -__±r -, -__cÚ¡ - *__»¡riù -__fmt -, ...)) - -158  - `__a¥rštf_chk - ( -__±r -, -__USE_FORTIFY_LEVEL - - 1, -__fmt -, - -159 - `__va_¬g_·ck - ()); - -160 - } -} - -162 -__ex‹º_®ways_šlše -  - -163 -__NTH - ( - $__a¥rštf - (** -__»¡riù - -__±r -, -__cÚ¡ - *__»¡riù -__fmt -, - -166  - `__a¥rštf_chk - ( -__±r -, -__USE_FORTIFY_LEVEL - - 1, -__fmt -, - -167 - `__va_¬g_·ck - ()); - -168 - } -} - -170 -__ex‹º_®ways_šlše -  - -171 - $d´štf - ( -__fd -, -__cÚ¡ - * -__»¡riù - -__fmt -, ...) - -173  - `__d´štf_chk - ( -__fd -, -__USE_FORTIFY_LEVEL - - 1, -__fmt -, - -174 - `__va_¬g_·ck - ()); - -175 - } -} - -177 -__ex‹º_®ways_šlše -  - -178 -__NTH - ( - $ob¡ack_´štf - ( -ob¡ack - * -__»¡riù - -__ob¡ack -, - -179 -__cÚ¡ - * -__»¡riù - -__fmt -, ...)) - -181  - `__ob¡ack_´štf_chk - ( -__ob¡ack -, -__USE_FORTIFY_LEVEL - - 1, -__fmt -, - -182 - `__va_¬g_·ck - ()); - -183 - } -} - -184 #–ià! -defšed - -__ýlu¥lus - - -185  - #a¥rštf -( -±r -, ...) \ - -186 - `__a¥rštf_chk - ( -±r -, -__USE_FORTIFY_LEVEL - - 1, -__VA_ARGS__ -) - - ) - -187  - #__a¥rštf -( -±r -, ...) \ - -188 - `__a¥rštf_chk - ( -±r -, -__USE_FORTIFY_LEVEL - - 1, -__VA_ARGS__ -) - - ) - -189  - #d´štf -( -fd -, ...) \ - -190 - `__d´štf_chk - ( -fd -, -__USE_FORTIFY_LEVEL - - 1, -__VA_ARGS__ -) - - ) - -191  - #ob¡ack_´štf -( -ob¡ack -, ...) \ - -192 - `__ob¡ack_´štf_chk - ( -ob¡ack -, -__USE_FORTIFY_LEVEL - - 1, -__VA_ARGS__ -) - - ) - -195 -__ex‹º_®ways_šlše -  - -196 -__NTH - ( - $va¥rštf - (** -__»¡riù - -__±r -, -__cÚ¡ - *__»¡riù -__fmt -, - -197 -_G_va_li¡ - -__­ -)) - -199  - `__va¥rštf_chk - ( -__±r -, -__USE_FORTIFY_LEVEL - - 1, -__fmt -, -__­ -); - -200 - } -} - -202 -__ex‹º_®ways_šlše -  - -203 - $vd´štf - ( -__fd -, -__cÚ¡ - * -__»¡riù - -__fmt -, -_G_va_li¡ - -__­ -) - -205  - `__vd´štf_chk - ( -__fd -, -__USE_FORTIFY_LEVEL - - 1, -__fmt -, -__­ -); - -206 - } -} - -208 -__ex‹º_®ways_šlše -  - -209 -__NTH - ( - $ob¡ack_v´štf - ( -ob¡ack - * -__»¡riù - -__ob¡ack -, - -210 -__cÚ¡ - * -__»¡riù - -__fmt -, -_G_va_li¡ - -__­ -)) - -212  - `__ob¡ack_v´štf_chk - ( -__ob¡ack -, -__USE_FORTIFY_LEVEL - - 1, -__fmt -, - -213 -__­ -); - -214 - } -} - -220 * - $__g‘s_chk - (* -__¡r -, -size_t -è -__wur -; - -221 * - `__REDIRECT - ( -__g‘s_w¬n -, (* -__¡r -), -g‘s -) - -222 -__wur - - `__w¬Ç‰r - ("please use fgets or getline instead, gets can't " - -225 -__ex‹º_®ways_šlše - -__wur - * - -226 - $g‘s - (* -__¡r -) - -228 ià( - `__bos - ( -__¡r -è!ð( -size_t -) -1) - -229  - `__g‘s_chk - ( -__¡r -, - `__bos - (__str)); - -230  - `__g‘s_w¬n - ( -__¡r -); - -231 - } -} - -233 * - $__fg‘s_chk - (* -__»¡riù - -__s -, -size_t - -__size -,  -__n -, - -234 -FILE - * -__»¡riù - -__¡»am -è -__wur -; - -235 * - `__REDIRECT - ( -__fg‘s_®Ÿs -, - -236 (* -__»¡riù - -__s -,  -__n -, - -237 -FILE - * -__»¡riù - -__¡»am -), -fg‘s -è -__wur -; - -238 * - `__REDIRECT - ( -__fg‘s_chk_w¬n -, - -239 (* -__»¡riù - -__s -, -size_t - -__size -,  -__n -, - -240 -FILE - * -__»¡riù - -__¡»am -), -__fg‘s_chk -) - -241 -__wur - - `__w¬Ç‰r - ("fgets called with bigger sizehan†ength " - -244 -__ex‹º_®ways_šlše - -__wur - * - -245 - $fg‘s - (* -__»¡riù - -__s -,  -__n -, -FILE - *__»¡riù -__¡»am -) - -247 ià( - `__bos - ( -__s -è!ð( -size_t -) -1) - -249 ià(! - `__bužtš_cÚ¡ªt_p - ( -__n -) || __n <= 0) - -250  - `__fg‘s_chk - ( -__s -, - `__bos - (__s), -__n -, -__¡»am -); - -252 ià(( -size_t -è -__n - > - `__bos - ( -__s -)) - -253  - `__fg‘s_chk_w¬n - ( -__s -, - `__bos - (__s), -__n -, -__¡»am -); - -255  - `__fg‘s_®Ÿs - ( -__s -, -__n -, -__¡»am -); - -256 - } -} - -258 -size_t - - $__ä—d_chk - (* -__»¡riù - -__±r -, -size_t - -__±¾’ -, - -259 -size_t - -__size -, size_ˆ -__n -, - -260 -FILE - * -__»¡riù - -__¡»am -è -__wur -; - -261 -size_t - - `__REDIRECT - ( -__ä—d_®Ÿs -, - -262 (* -__»¡riù - -__±r -, -size_t - -__size -, - -263 -size_t - -__n -, -FILE - * -__»¡riù - -__¡»am -), - -264 -ä—d -è -__wur -; - -265 -size_t - - `__REDIRECT - ( -__ä—d_chk_w¬n -, - -266 (* -__»¡riù - -__±r -, -size_t - -__±¾’ -, - -267 -size_t - -__size -, size_ˆ -__n -, - -268 -FILE - * -__»¡riù - -__¡»am -), - -269 -__ä—d_chk -) - -270 -__wur - - `__w¬Ç‰r - ("fread called with bigger size *‚membhan†ength " - -273 -__ex‹º_®ways_šlše - -__wur - -size_t - - -274 - $ä—d - (* -__»¡riù - -__±r -, -size_t - -__size -, size_ˆ -__n -, - -275 -FILE - * -__»¡riù - -__¡»am -) - -277 ià( - `__bos0 - ( -__±r -è!ð( -size_t -) -1) - -279 ià(! - `__bužtš_cÚ¡ªt_p - ( -__size -) - -280 || ! - `__bužtš_cÚ¡ªt_p - ( -__n -) - -281 || ( -__size - | -__n -è>ð((( -size_t -) 1) << (8 *  (size_t) / 2))) - -282  - `__ä—d_chk - ( -__±r -, - `__bos0 - (__±r), -__size -, -__n -, -__¡»am -); - -284 ià( -__size - * -__n - > - `__bos0 - ( -__±r -)) - -285  - `__ä—d_chk_w¬n - ( -__±r -, - `__bos0 - (__±r), -__size -, -__n -, -__¡»am -); - -287  - `__ä—d_®Ÿs - ( -__±r -, -__size -, -__n -, -__¡»am -); - -288 - } -} - -290 #ifdeà -__USE_GNU - - -291 * - $__fg‘s_uÆocked_chk - (* -__»¡riù - -__s -, -size_t - -__size -, - -292  -__n -, -FILE - * -__»¡riù - -__¡»am -è -__wur -; - -293 * - `__REDIRECT - ( -__fg‘s_uÆocked_®Ÿs -, - -294 (* -__»¡riù - -__s -,  -__n -, - -295 -FILE - * -__»¡riù - -__¡»am -), -fg‘s_uÆocked -è -__wur -; - -296 * - `__REDIRECT - ( -__fg‘s_uÆocked_chk_w¬n -, - -297 (* -__»¡riù - -__s -, -size_t - -__size -,  -__n -, - -298 -FILE - * -__»¡riù - -__¡»am -), -__fg‘s_uÆocked_chk -) - -299 -__wur - - `__w¬Ç‰r - ("fgets_unlocked called with bigger sizehan†ength " - -302 -__ex‹º_®ways_šlše - -__wur - * - -303 - $fg‘s_uÆocked - (* -__»¡riù - -__s -,  -__n -, -FILE - *__»¡riù -__¡»am -) - -305 ià( - `__bos - ( -__s -è!ð( -size_t -) -1) - -307 ià(! - `__bužtš_cÚ¡ªt_p - ( -__n -) || __n <= 0) - -308  - `__fg‘s_uÆocked_chk - ( -__s -, - `__bos - (__s), -__n -, -__¡»am -); - -310 ià(( -size_t -è -__n - > - `__bos - ( -__s -)) - -311  - `__fg‘s_uÆocked_chk_w¬n - ( -__s -, - `__bos - (__s), -__n -, -__¡»am -); - -313  - `__fg‘s_uÆocked_®Ÿs - ( -__s -, -__n -, -__¡»am -); - -314 - } -} - -317 #ifdeà -__USE_MISC - - -318 #undeà -ä—d_uÆocked - - -319 -size_t - - $__ä—d_uÆocked_chk - (* -__»¡riù - -__±r -, -size_t - -__±¾’ -, - -320 -size_t - -__size -, size_ˆ -__n -, - -321 -FILE - * -__»¡riù - -__¡»am -è -__wur -; - -322 -size_t - - `__REDIRECT - ( -__ä—d_uÆocked_®Ÿs -, - -323 (* -__»¡riù - -__±r -, -size_t - -__size -, - -324 -size_t - -__n -, -FILE - * -__»¡riù - -__¡»am -), - -325 -ä—d_uÆocked -è -__wur -; - -326 -size_t - - `__REDIRECT - ( -__ä—d_uÆocked_chk_w¬n -, - -327 (* -__»¡riù - -__±r -, -size_t - -__±¾’ -, - -328 -size_t - -__size -, size_ˆ -__n -, - -329 -FILE - * -__»¡riù - -__¡»am -), - -330 -__ä—d_uÆocked_chk -) - -331 -__wur - - `__w¬Ç‰r - ("fread_unlocked called with bigger size *‚membhan " - -334 -__ex‹º_®ways_šlše - -__wur - -size_t - - -335 - $ä—d_uÆocked - (* -__»¡riù - -__±r -, -size_t - -__size -, size_ˆ -__n -, - -336 -FILE - * -__»¡riù - -__¡»am -) - -338 ià( - `__bos0 - ( -__±r -è!ð( -size_t -) -1) - -340 ià(! - `__bužtš_cÚ¡ªt_p - ( -__size -) - -341 || ! - `__bužtš_cÚ¡ªt_p - ( -__n -) - -342 || ( -__size - | -__n -è>ð((( -size_t -) 1) << (8 *  (size_t) / 2))) - -343  - `__ä—d_uÆocked_chk - ( -__±r -, - `__bos0 - (__±r), -__size -, -__n -, - -344 -__¡»am -); - -346 ià( -__size - * -__n - > - `__bos0 - ( -__±r -)) - -347  - `__ä—d_uÆocked_chk_w¬n - ( -__±r -, - `__bos0 - (__±r), -__size -, -__n -, - -348 -__¡»am -); - -351 #ifdeà -__USE_EXTERN_INLINES - - -352 ià( - `__bužtš_cÚ¡ªt_p - ( -__size -) - -353 && - `__bužtš_cÚ¡ªt_p - ( -__n -) - -354 && ( -__size - | -__n -è< ((( -size_t -) 1) << (8 *  (size_t) / 2)) - -355 && -__size - * -__n - <= 8) - -357 -size_t - -__út - = -__size - * -__n -; - -358 * -__ýŒ - = (*è -__±r -; - -359 ià( -__út - == 0) - -362 ; -__út - > 0; --__cnt) - -364  -__c - = - `_IO_g‘c_uÆocked - ( -__¡»am -); - -365 ià( -__c - =ð -EOF -) - -367 * -__ýŒ -++ = -__c -; - -369  ( -__ýŒ - - (*è -__±r -è/ -__size -; - -372  - `__ä—d_uÆocked_®Ÿs - ( -__±r -, -__size -, -__n -, -__¡»am -); - -373 - } -} - - @/usr/include/bits/stdio_lim.h - -19 #ià! -defšed - -_STDIO_H - && !defšed -__Ãed_FOPEN_MAX - && !defšed -__Ãed_IOV_MAX - - -23 #ifdeà -_STDIO_H - - -24  - #L_tm²am - 20 - - ) - -25  - #TMP_MAX - 238328 - - ) - -26  - #FILENAME_MAX - 4096 - - ) - -28 #ifdeà -__USE_POSIX - - -29  - #L_ù”mid - 9 - - ) - -30 #ià! -defšed - -__USE_XOPEN2K - || defšed -__USE_GNU - - -31  - #L_cu£rid - 9 - - ) - -36 #ià -defšed - -__Ãed_FOPEN_MAX - || defšed -_STDIO_H - - -37 #undeà -FOPEN_MAX - - -38  - #FOPEN_MAX - 16 - - ) - -41 #ià -defšed - -__Ãed_IOV_MAX - && !defšed -IOV_MAX - - -42  - #IOV_MAX - 1024 - - ) - - @/usr/include/bits/string.h - -20 #iâdeà -_STRING_H - - -26  - #_STRING_ARCH_uÇligÃd - 1 - - ) - - @/usr/include/bits/string2.h - -21 #iâdeà -_STRING_H - - -25 #ià! -defšed - -__NO_STRING_INLINES - && !defšed -__BOUNDED_POINTERS__ - - -42 #iâdeà -__STRING_INLINE - - -43 #ifdeà -__ýlu¥lus - - -44  - #__STRING_INLINE - -šlše - - - ) - -46  - #__STRING_INLINE - -__ex‹º_šlše - - - ) - -50 #ià -_STRING_ARCH_uÇligÃd - - -52  - ~<’dŸn.h -> - -53  - ~ - -55 #ià -__BYTE_ORDER - =ð -__LITTLE_ENDIAN - - -56  - #__STRING2_SMALL_GET16 -( -¤c -, -idx -) \ - -57 ((( -__cÚ¡ - *è(__cÚ¡ *è( -¤c -))[ -idx - + 1] << 8 \ - -58 | (( -__cÚ¡ - *è(__cÚ¡ *è( -¤c -))[ -idx -]) - - ) - -59  - #__STRING2_SMALL_GET32 -( -¤c -, -idx -) \ - -60 ((((( -__cÚ¡ - *è(__cÚ¡ *è( -¤c -))[ -idx - + 3] << 8 \ - -61 | (( -__cÚ¡ - *è(__cÚ¡ *è( -¤c -))[ -idx - + 2]) << 8 \ - -62 | (( -__cÚ¡ - *è(__cÚ¡ *è( -¤c -))[ -idx - + 1]) << 8 \ - -63 | (( -__cÚ¡ - *è(__cÚ¡ *è( -¤c -))[ -idx -]) - - ) - -65  - #__STRING2_SMALL_GET16 -( -¤c -, -idx -) \ - -66 ((( -__cÚ¡ - *è(__cÚ¡ *è( -¤c -))[ -idx -] << 8 \ - -67 | (( -__cÚ¡ - *è(__cÚ¡ *è( -¤c -))[ -idx - + 1]) - - ) - -68  - #__STRING2_SMALL_GET32 -( -¤c -, -idx -) \ - -69 ((((( -__cÚ¡ - *è(__cÚ¡ *è( -¤c -))[ -idx -] << 8 \ - -70 | (( -__cÚ¡ - *è(__cÚ¡ *è( -¤c -))[ -idx - + 1]) << 8 \ - -71 | (( -__cÚ¡ - *è(__cÚ¡ *è( -¤c -))[ -idx - + 2]) << 8 \ - -72 | (( -__cÚ¡ - *è(__cÚ¡ *è( -¤c -))[ -idx - + 3]) - - ) - -77  - #__STRING2_COPY_TYPE -( -N -) \ - -78 ¡ruù {  -__¬r -[ -N -]; } \ - -79 - t__©Œibu‹__ - (( - t__·cked__ -)è - t__STRING2_COPY_ARR -## - tN - - - ) - -80 - t__STRING2_COPY_TYPE - (2); - -81 -__STRING2_COPY_TYPE - (3); - -82 -__STRING2_COPY_TYPE - (4); - -83 -__STRING2_COPY_TYPE - (5); - -84 -__STRING2_COPY_TYPE - (6); - -85 -__STRING2_COPY_TYPE - (7); - -86 -__STRING2_COPY_TYPE - (8); - -87 #undeà -__STRING2_COPY_TYPE - - -93  - #__¡ršg2_1b±r_p -( -__x -) \ - -94 (( -size_t -)(cÚ¡ *)(( -__x -è+ 1è- (size_t)(cÚ¡ *)(__xè=ð1) - - ) - -97 #ià! -defšed - -_HAVE_STRING_ARCH_mem£t - - -98 #ià! -__GNUC_PREREQ - (3, 0) - -99 #ià -_STRING_ARCH_uÇligÃd - - -100  - #mem£t -( -s -, -c -, -n -) \ - -101 ( - `__ex‹nsiÚ__ - ( - `__bužtš_cÚ¡ªt_p - ( -n -) && (n) <= 16 \ - -102 ? (( -n -) == 1 \ - -103 ? - `__mem£t_1 - ( -s -, -c -) \ - -104 : - `__mem£t_gc - ( -s -, -c -, -n -)) \ - -105 : ( - `__bužtš_cÚ¡ªt_p - ( -c -) && (c) == '\0' \ - -106 ? ({ * -__s - = ( -s -); - `__bz”o - (__s, -n -); __s; }) \ - -107 : - `mem£t - ( -s -, -c -, -n -)))) - - ) - -109  - #__mem£t_1 -( -s -, -c -è({ * -__s - = (s); \ - -110 *(( -__ušt8_t - *è -__s -èð(__ušt8_tè -c -; __s; }) - - ) - -112  - #__mem£t_gc -( -s -, -c -, -n -) \ - -113 ({ * -__s - = ( -s -); \ - -115  -__ui -; \ - -116  -__usi -; \ - -117  -__uc -; \ - -118 } * -__u - = -__s -; \ - -119 -__ušt8_t - -__c - = (__ušt8_tè( -c -); \ - -122 (è( -n -)) \ - -125 -__u --> -__ui - = -__c - * 0x01010101; \ - -126 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 4); \ - -128 -__u --> -__ui - = -__c - * 0x01010101; \ - -129 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 4); \ - -131 -__u --> -__ui - = -__c - * 0x01010101; \ - -132 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 4); \ - -134 -__u --> -__usi - = (è -__c - * 0x0101; \ - -135 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 2); \ - -136 -__u --> -__uc - = (è -__c -; \ - -140 -__u --> -__ui - = -__c - * 0x01010101; \ - -141 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 4); \ - -143 -__u --> -__ui - = -__c - * 0x01010101; \ - -144 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 4); \ - -146 -__u --> -__ui - = -__c - * 0x01010101; \ - -147 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 4); \ - -149 -__u --> -__usi - = (è -__c - * 0x0101; \ - -153 -__u --> -__ui - = -__c - * 0x01010101; \ - -154 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 4); \ - -156 -__u --> -__ui - = -__c - * 0x01010101; \ - -157 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 4); \ - -159 -__u --> -__ui - = -__c - * 0x01010101; \ - -160 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 4); \ - -162 -__u --> -__uc - = (è -__c -; \ - -166 -__u --> -__ui - = -__c - * 0x01010101; \ - -167 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 4); \ - -169 -__u --> -__ui - = -__c - * 0x01010101; \ - -170 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 4); \ - -172 -__u --> -__ui - = -__c - * 0x01010101; \ - -173 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 4); \ - -175 -__u --> -__ui - = -__c - * 0x01010101; \ - -180 -__s -; }) - - ) - -182  - #mem£t -( -s -, -c -, -n -) \ - -183 ( - `__ex‹nsiÚ__ - ( - `__bužtš_cÚ¡ªt_p - ( -c -) && (c) == '\0' \ - -184 ? ({ * -__s - = ( -s -); - `__bz”o - (__s, -n -); __s; }) \ - -185 : - `mem£t - ( -s -, -c -, -n -))) - - ) - -194 #ià -__GNUC_PREREQ - (2, 91) - -195  - #__bz”o -( -s -, -n -è - `__bužtš_mem£t - (s, '\0',‚) - - ) - -203 #ifdeà -__USE_GNU - - -204 #ià! -defšed - -_HAVE_STRING_ARCH_mempýy - || defšed -_FORCE_INLINES - - -205 #iâdeà -_HAVE_STRING_ARCH_mempýy - - -206 #ià -__GNUC_PREREQ - (3, 4) - -207  - #__mempýy -( -de¡ -, -¤c -, -n -è - `__bužtš_mempýy - (de¡, src,‚) - - ) - -208 #–ià -__GNUC_PREREQ - (3, 0) - -209  - #__mempýy -( -de¡ -, -¤c -, -n -) \ - -210 ( - `__ex‹nsiÚ__ - ( - `__bužtš_cÚ¡ªt_p - ( -¤c -è&& __bužtš_cÚ¡ªt_°( -n -) \ - -211 && - `__¡ršg2_1b±r_p - ( -¤c -è&& -n - <= 8 \ - -212 ? - `__bužtš_memýy - ( -de¡ -, -¤c -, -n -) + (n) \ - -213 : - `__mempýy - ( -de¡ -, -¤c -, -n -))) - - ) - -215  - #__mempýy -( -de¡ -, -¤c -, -n -) \ - -216 ( - `__ex‹nsiÚ__ - ( - `__bužtš_cÚ¡ªt_p - ( -¤c -è&& __bužtš_cÚ¡ªt_°( -n -) \ - -217 && - `__¡ršg2_1b±r_p - ( -¤c -è&& -n - <= 8 \ - -218 ? - `__mempýy_sm®l - ( -de¡ -, - `__mempýy_¬gs - ( -¤c -), -n -) \ - -219 : - `__mempýy - ( -de¡ -, -¤c -, -n -))) - - ) - -223  - #mempýy -( -de¡ -, -¤c -, -n -è - `__mempýy - (de¡, src,‚) - - ) - -226 #ià! -__GNUC_PREREQ - (3, 0è|| -defšed - -_FORCE_INLINES - - -227 #ià -_STRING_ARCH_uÇligÃd - - -228 #iâdeà -_FORCE_INLINES - - -229  - #__mempýy_¬gs -( -¤c -) \ - -230 (( -__cÚ¡ - *è( -¤c -))[0], ((__const *) (src))[2], \ - -231 (( -__cÚ¡ - *è( -¤c -))[4], ((__const *) (src))[6], \ - -232 -__ex‹nsiÚ__ - - `__STRING2_SMALL_GET16 - ( -¤c -, 0), \ - -233 -__ex‹nsiÚ__ - - `__STRING2_SMALL_GET16 - ( -¤c -, 4), \ - -234 -__ex‹nsiÚ__ - - `__STRING2_SMALL_GET32 - ( -¤c -, 0), \ - -235 -__ex‹nsiÚ__ - - `__STRING2_SMALL_GET32 - ( -¤c -, 4) - - ) - -237 -__STRING_INLINE - * -__mempýy_sm®l - (*, , , , , - -238 -__ušt16_t -, __ušt16_t, -__ušt32_t -, - -239 -__ušt32_t -, -size_t -); - -240 -__STRING_INLINE - * - -241 - $__mempýy_sm®l - (* -__de¡1 -, - -242  -__¤c0_1 -,  -__¤c2_1 -,  -__¤c4_1 -,  -__¤c6_1 -, - -243 -__ušt16_t - -__¤c0_2 -, __ušt16_ˆ -__¤c4_2 -, - -244 -__ušt32_t - -__¤c0_4 -, __ušt32_ˆ -__¤c4_4 -, - -245 -size_t - -__¤þ’ -) - -248 -__ušt32_t - -__ui -; - -249 -__ušt16_t - -__usi -; - -250  -__uc -; - -251  -__c -; - -252 } * -__u - = -__de¡1 -; - -253 (è -__¤þ’ -) - -256 -__u --> -__c - = -__¤c0_1 -; - -257 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 1); - -260 -__u --> -__usi - = -__¤c0_2 -; - -261 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 2); - -264 -__u --> -__usi - = -__¤c0_2 -; - -265 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 2); - -266 -__u --> -__c - = -__¤c2_1 -; - -267 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 1); - -270 -__u --> -__ui - = -__¤c0_4 -; - -271 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 4); - -274 -__u --> -__ui - = -__¤c0_4 -; - -275 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 4); - -276 -__u --> -__c - = -__¤c4_1 -; - -277 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 1); - -280 -__u --> -__ui - = -__¤c0_4 -; - -281 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 4); - -282 -__u --> -__usi - = -__¤c4_2 -; - -283 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 2); - -286 -__u --> -__ui - = -__¤c0_4 -; - -287 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 4); - -288 -__u --> -__usi - = -__¤c4_2 -; - -289 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 2); - -290 -__u --> -__c - = -__¤c6_1 -; - -291 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 1); - -294 -__u --> -__ui - = -__¤c0_4 -; - -295 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 4); - -296 -__u --> -__ui - = -__¤c4_4 -; - -297 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 4); - -300  (*è -__u -; - -301 - } -} - -303 #iâdeà -_FORCE_INLINES - - -304  - #__mempýy_¬gs -( -¤c -) \ - -305 (( -__cÚ¡ - *è( -¤c -))[0], \ - -306 - `__ex‹nsiÚ__ - (( -__STRING2_COPY_ARR2 -) \ - -307 { { (( -__cÚ¡ - *è( -¤c -))[0], ((__const *) (src))[1] } }), \ - -308 - `__ex‹nsiÚ__ - (( -__STRING2_COPY_ARR3 -) \ - -309 { { (( -__cÚ¡ - *è( -¤c -))[0], ((__const *) (src))[1], \ - -310 (( -__cÚ¡ - *è( -¤c -))[2] } }), \ - -311 - `__ex‹nsiÚ__ - (( -__STRING2_COPY_ARR4 -) \ - -312 { { (( -__cÚ¡ - *è( -¤c -))[0], ((__const *) (src))[1], \ - -313 (( -__cÚ¡ - *è( -¤c -))[2], ((__const *) (src))[3] } }), \ - -314 - `__ex‹nsiÚ__ - (( -__STRING2_COPY_ARR5 -) \ - -315 { { (( -__cÚ¡ - *è( -¤c -))[0], ((__const *) (src))[1], \ - -316 (( -__cÚ¡ - *è( -¤c -))[2], ((__const *) (src))[3], \ - -317 (( -__cÚ¡ - *è( -¤c -))[4] } }), \ - -318 - `__ex‹nsiÚ__ - (( -__STRING2_COPY_ARR6 -) \ - -319 { { (( -__cÚ¡ - *è( -¤c -))[0], ((__const *) (src))[1], \ - -320 (( -__cÚ¡ - *è( -¤c -))[2], ((__const *) (src))[3], \ - -321 (( -__cÚ¡ - *è( -¤c -))[4], ((__const *) (src))[5] } }), \ - -322 - `__ex‹nsiÚ__ - (( -__STRING2_COPY_ARR7 -) \ - -323 { { (( -__cÚ¡ - *è( -¤c -))[0], ((__const *) (src))[1], \ - -324 (( -__cÚ¡ - *è( -¤c -))[2], ((__const *) (src))[3], \ - -325 (( -__cÚ¡ - *è( -¤c -))[4], ((__const *) (src))[5], \ - -326 (( -__cÚ¡ - *è( -¤c -))[6] } }), \ - -327 - `__ex‹nsiÚ__ - (( -__STRING2_COPY_ARR8 -) \ - -328 { { (( -__cÚ¡ - *è( -¤c -))[0], ((__const *) (src))[1], \ - -329 (( -__cÚ¡ - *è( -¤c -))[2], ((__const *) (src))[3], \ - -330 (( -__cÚ¡ - *è( -¤c -))[4], ((__const *) (src))[5], \ - -331 (( -__cÚ¡ - *è( -¤c -))[6], ((__cÚ¡ *è(¤c))[7] } }) - - ) - -333 -__STRING_INLINE - * -__mempýy_sm®l - (*, , -__STRING2_COPY_ARR2 -, - -334 -__STRING2_COPY_ARR3 -, - -335 -__STRING2_COPY_ARR4 -, - -336 -__STRING2_COPY_ARR5 -, - -337 -__STRING2_COPY_ARR6 -, - -338 -__STRING2_COPY_ARR7 -, - -339 -__STRING2_COPY_ARR8 -, -size_t -); - -340 -__STRING_INLINE - * - -341 - $__mempýy_sm®l - (* -__de¡ -,  -__¤c1 -, - -342 -__STRING2_COPY_ARR2 - -__¤c2 -, -__STRING2_COPY_ARR3 - -__¤c3 -, - -343 -__STRING2_COPY_ARR4 - -__¤c4 -, -__STRING2_COPY_ARR5 - -__¤c5 -, - -344 -__STRING2_COPY_ARR6 - -__¤c6 -, -__STRING2_COPY_ARR7 - -__¤c7 -, - -345 -__STRING2_COPY_ARR8 - -__¤c8 -, -size_t - -__¤þ’ -) - -348  -__c -; - -349 -__STRING2_COPY_ARR2 - -__sÿ2 -; - -350 -__STRING2_COPY_ARR3 - -__sÿ3 -; - -351 -__STRING2_COPY_ARR4 - -__sÿ4 -; - -352 -__STRING2_COPY_ARR5 - -__sÿ5 -; - -353 -__STRING2_COPY_ARR6 - -__sÿ6 -; - -354 -__STRING2_COPY_ARR7 - -__sÿ7 -; - -355 -__STRING2_COPY_ARR8 - -__sÿ8 -; - -356 } * -__u - = -__de¡ -; - -357 (è -__¤þ’ -) - -360 -__u --> -__c - = -__¤c1 -; - -363 -__ex‹nsiÚ__ - -__u --> -__sÿ2 - = -__¤c2 -; - -366 -__ex‹nsiÚ__ - -__u --> -__sÿ3 - = -__¤c3 -; - -369 -__ex‹nsiÚ__ - -__u --> -__sÿ4 - = -__¤c4 -; - -372 -__ex‹nsiÚ__ - -__u --> -__sÿ5 - = -__¤c5 -; - -375 -__ex‹nsiÚ__ - -__u --> -__sÿ6 - = -__¤c6 -; - -378 -__ex‹nsiÚ__ - -__u --> -__sÿ7 - = -__¤c7 -; - -381 -__ex‹nsiÚ__ - -__u --> -__sÿ8 - = -__¤c8 -; - -384  - `__ex‹nsiÚ__ - ((*è -__u - + -__¤þ’ -); - -385 - } -} - -393 #iâdeà -_HAVE_STRING_ARCH_¡rchr - - -394 * -__¿wmemchr - (cÚ¡ * -__s -,  -__c -); - -395 #ià -__GNUC_PREREQ - (3, 2) - -396  - #¡rchr -( -s -, -c -) \ - -397 ( - `__ex‹nsiÚ__ - ( - `__bužtš_cÚ¡ªt_p - ( -c -è&& !__bužtš_cÚ¡ªt_°( -s -) \ - -398 && ( -c -) == '\0' \ - -399 ? (*è - `__¿wmemchr - ( -s -, -c -) \ - -400 : - `__bužtš_¡rchr - ( -s -, -c -))) - - ) - -402  - #¡rchr -( -s -, -c -) \ - -403 ( - `__ex‹nsiÚ__ - ( - `__bužtš_cÚ¡ªt_p - ( -c -) && (c) == '\0' \ - -404 ? (*è - `__¿wmemchr - ( -s -, -c -) \ - -405 : - `¡rchr - ( -s -, -c -))) - - ) - -411 #ià(! -defšed - -_HAVE_STRING_ARCH_¡rýy - && ! -__GNUC_PREREQ - (3, 0)) \ - -412 || -defšed - - g_FORCE_INLINES - - -413 #ià! -defšed - -_HAVE_STRING_ARCH_¡rýy - && ! -__GNUC_PREREQ - (3, 0) - -414  - #¡rýy -( -de¡ -, -¤c -) \ - -415 ( - `__ex‹nsiÚ__ - ( - `__bužtš_cÚ¡ªt_p - ( -¤c -) \ - -416 ? ( - `__¡ršg2_1b±r_p - ( -¤c -è&& - `¡¾’ - (src) + 1 <= 8 \ - -417 ? - `__¡rýy_sm®l - ( -de¡ -, - `__¡rýy_¬gs - ( -¤c -), \ - -418 - `¡¾’ - ( -¤c -) + 1) \ - -419 : (*è - `memýy - ( -de¡ -, -¤c -, - `¡¾’ - (src) + 1)) \ - -420 : - `¡rýy - ( -de¡ -, -¤c -))) - - ) - -423 #ià -_STRING_ARCH_uÇligÃd - - -424 #iâdeà -_FORCE_INLINES - - -425  - #__¡rýy_¬gs -( -¤c -) \ - -426 -__ex‹nsiÚ__ - - `__STRING2_SMALL_GET16 - ( -¤c -, 0), \ - -427 -__ex‹nsiÚ__ - - `__STRING2_SMALL_GET16 - ( -¤c -, 4), \ - -428 -__ex‹nsiÚ__ - - `__STRING2_SMALL_GET32 - ( -¤c -, 0), \ - -429 -__ex‹nsiÚ__ - - `__STRING2_SMALL_GET32 - ( -¤c -, 4) - - ) - -431 -__STRING_INLINE - * -__¡rýy_sm®l - (*, -__ušt16_t -, __uint16_t, - -432 -__ušt32_t -, __ušt32_t, -size_t -); - -433 -__STRING_INLINE - * - -434 - $__¡rýy_sm®l - (* -__de¡ -, - -435 -__ušt16_t - -__¤c0_2 -, __ušt16_ˆ -__¤c4_2 -, - -436 -__ušt32_t - -__¤c0_4 -, __ušt32_ˆ -__¤c4_4 -, - -437 -size_t - -__¤þ’ -) - -440 -__ušt32_t - -__ui -; - -441 -__ušt16_t - -__usi -; - -442  -__uc -; - -443 } * -__u - = (*è -__de¡ -; - -444 (è -__¤þ’ -) - -447 -__u --> -__uc - = '\0'; - -450 -__u --> -__usi - = -__¤c0_2 -; - -453 -__u --> -__usi - = -__¤c0_2 -; - -454 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 2); - -455 -__u --> -__uc - = '\0'; - -458 -__u --> -__ui - = -__¤c0_4 -; - -461 -__u --> -__ui - = -__¤c0_4 -; - -462 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 4); - -463 -__u --> -__uc - = '\0'; - -466 -__u --> -__ui - = -__¤c0_4 -; - -467 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 4); - -468 -__u --> -__usi - = -__¤c4_2 -; - -471 -__u --> -__ui - = -__¤c0_4 -; - -472 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 4); - -473 -__u --> -__usi - = -__¤c4_2 -; - -474 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 2); - -475 -__u --> -__uc - = '\0'; - -478 -__u --> -__ui - = -__¤c0_4 -; - -479 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 4); - -480 -__u --> -__ui - = -__¤c4_4 -; - -483  -__de¡ -; - -484 - } -} - -486 #iâdeà -_FORCE_INLINES - - -487  - #__¡rýy_¬gs -( -¤c -) \ - -488 - `__ex‹nsiÚ__ - (( -__STRING2_COPY_ARR2 -) \ - -489 { { (( -__cÚ¡ - *è( -¤c -))[0], '\0' } }), \ - -490 - `__ex‹nsiÚ__ - (( -__STRING2_COPY_ARR3 -) \ - -491 { { (( -__cÚ¡ - *è( -¤c -))[0], ((__const *) (src))[1], \ - -493 - `__ex‹nsiÚ__ - (( -__STRING2_COPY_ARR4 -) \ - -494 { { (( -__cÚ¡ - *è( -¤c -))[0], ((__const *) (src))[1], \ - -495 (( -__cÚ¡ - *è( -¤c -))[2], '\0' } }), \ - -496 - `__ex‹nsiÚ__ - (( -__STRING2_COPY_ARR5 -) \ - -497 { { (( -__cÚ¡ - *è( -¤c -))[0], ((__const *) (src))[1], \ - -498 (( -__cÚ¡ - *è( -¤c -))[2], ((__const *) (src))[3], \ - -500 - `__ex‹nsiÚ__ - (( -__STRING2_COPY_ARR6 -) \ - -501 { { (( -__cÚ¡ - *è( -¤c -))[0], ((__const *) (src))[1], \ - -502 (( -__cÚ¡ - *è( -¤c -))[2], ((__const *) (src))[3], \ - -503 (( -__cÚ¡ - *è( -¤c -))[4], '\0' } }), \ - -504 - `__ex‹nsiÚ__ - (( -__STRING2_COPY_ARR7 -) \ - -505 { { (( -__cÚ¡ - *è( -¤c -))[0], ((__const *) (src))[1], \ - -506 (( -__cÚ¡ - *è( -¤c -))[2], ((__const *) (src))[3], \ - -507 (( -__cÚ¡ - *è( -¤c -))[4], ((__const *) (src))[5], \ - -509 - `__ex‹nsiÚ__ - (( -__STRING2_COPY_ARR8 -) \ - -510 { { (( -__cÚ¡ - *è( -¤c -))[0], ((__const *) (src))[1], \ - -511 (( -__cÚ¡ - *è( -¤c -))[2], ((__const *) (src))[3], \ - -512 (( -__cÚ¡ - *è( -¤c -))[4], ((__const *) (src))[5], \ - -513 (( -__cÚ¡ - *è( -¤c -))[6], '\0' } }) - - ) - -515 -__STRING_INLINE - * -__¡rýy_sm®l - (*, -__STRING2_COPY_ARR2 -, - -516 -__STRING2_COPY_ARR3 -, - -517 -__STRING2_COPY_ARR4 -, - -518 -__STRING2_COPY_ARR5 -, - -519 -__STRING2_COPY_ARR6 -, - -520 -__STRING2_COPY_ARR7 -, - -521 -__STRING2_COPY_ARR8 -, -size_t -); - -522 -__STRING_INLINE - * - -523 - $__¡rýy_sm®l - (* -__de¡ -, - -524 -__STRING2_COPY_ARR2 - -__¤c2 -, -__STRING2_COPY_ARR3 - -__¤c3 -, - -525 -__STRING2_COPY_ARR4 - -__¤c4 -, -__STRING2_COPY_ARR5 - -__¤c5 -, - -526 -__STRING2_COPY_ARR6 - -__¤c6 -, -__STRING2_COPY_ARR7 - -__¤c7 -, - -527 -__STRING2_COPY_ARR8 - -__¤c8 -, -size_t - -__¤þ’ -) - -530  -__c -; - -531 -__STRING2_COPY_ARR2 - -__sÿ2 -; - -532 -__STRING2_COPY_ARR3 - -__sÿ3 -; - -533 -__STRING2_COPY_ARR4 - -__sÿ4 -; - -534 -__STRING2_COPY_ARR5 - -__sÿ5 -; - -535 -__STRING2_COPY_ARR6 - -__sÿ6 -; - -536 -__STRING2_COPY_ARR7 - -__sÿ7 -; - -537 -__STRING2_COPY_ARR8 - -__sÿ8 -; - -538 } * -__u - = (*è -__de¡ -; - -539 (è -__¤þ’ -) - -542 -__u --> -__c - = '\0'; - -545 -__ex‹nsiÚ__ - -__u --> -__sÿ2 - = -__¤c2 -; - -548 -__ex‹nsiÚ__ - -__u --> -__sÿ3 - = -__¤c3 -; - -551 -__ex‹nsiÚ__ - -__u --> -__sÿ4 - = -__¤c4 -; - -554 -__ex‹nsiÚ__ - -__u --> -__sÿ5 - = -__¤c5 -; - -557 -__ex‹nsiÚ__ - -__u --> -__sÿ6 - = -__¤c6 -; - -560 -__ex‹nsiÚ__ - -__u --> -__sÿ7 - = -__¤c7 -; - -563 -__ex‹nsiÚ__ - -__u --> -__sÿ8 - = -__¤c8 -; - -566  -__de¡ -; - -567 - } -} - -573 #ifdeà -__USE_GNU - - -574 #ià! -defšed - -_HAVE_STRING_ARCH_¡pýy - || defšed -_FORCE_INLINES - - -575 #iâdeà -_HAVE_STRING_ARCH_¡pýy - - -576 #ià -__GNUC_PREREQ - (3, 4) - -577  - #__¡pýy -( -de¡ -, -¤c -è - `__bužtš_¡pýy - (de¡, src) - - ) - -578 #–ià -__GNUC_PREREQ - (3, 0) - -579  - #__¡pýy -( -de¡ -, -¤c -) \ - -580 ( - `__ex‹nsiÚ__ - ( - `__bužtš_cÚ¡ªt_p - ( -¤c -) \ - -581 ? ( - `__¡ršg2_1b±r_p - ( -¤c -è&& - `¡¾’ - (src) + 1 <= 8 \ - -582 ? - `__bužtš_¡rýy - ( -de¡ -, -¤c -è+ - `¡¾’ - (src) \ - -583 : ((*è( -__mempýy -è( -de¡ -, -¤c -, - `¡¾’ - (src) + 1) \ - -585 : - `__¡pýy - ( -de¡ -, -¤c -))) - - ) - -587  - #__¡pýy -( -de¡ -, -¤c -) \ - -588 ( - `__ex‹nsiÚ__ - ( - `__bužtš_cÚ¡ªt_p - ( -¤c -) \ - -589 ? ( - `__¡ršg2_1b±r_p - ( -¤c -è&& - `¡¾’ - (src) + 1 <= 8 \ - -590 ? - `__¡pýy_sm®l - ( -de¡ -, - `__¡pýy_¬gs - ( -¤c -), \ - -591 - `¡¾’ - ( -¤c -) + 1) \ - -592 : ((*è( -__mempýy -è( -de¡ -, -¤c -, - `¡¾’ - (src) + 1) \ - -594 : - `__¡pýy - ( -de¡ -, -¤c -))) - - ) - -598  - #¡pýy -( -de¡ -, -¤c -è - `__¡pýy - (de¡, src) - - ) - -601 #ià! -__GNUC_PREREQ - (3, 0è|| -defšed - -_FORCE_INLINES - - -602 #ià -_STRING_ARCH_uÇligÃd - - -603 #iâdeà -_FORCE_INLINES - - -604  - #__¡pýy_¬gs -( -¤c -) \ - -605 -__ex‹nsiÚ__ - - `__STRING2_SMALL_GET16 - ( -¤c -, 0), \ - -606 -__ex‹nsiÚ__ - - `__STRING2_SMALL_GET16 - ( -¤c -, 4), \ - -607 -__ex‹nsiÚ__ - - `__STRING2_SMALL_GET32 - ( -¤c -, 0), \ - -608 -__ex‹nsiÚ__ - - `__STRING2_SMALL_GET32 - ( -¤c -, 4) - - ) - -610 -__STRING_INLINE - * -__¡pýy_sm®l - (*, -__ušt16_t -, __uint16_t, - -611 -__ušt32_t -, __ušt32_t, -size_t -); - -612 -__STRING_INLINE - * - -613 - $__¡pýy_sm®l - (* -__de¡ -, - -614 -__ušt16_t - -__¤c0_2 -, __ušt16_ˆ -__¤c4_2 -, - -615 -__ušt32_t - -__¤c0_4 -, __ušt32_ˆ -__¤c4_4 -, - -616 -size_t - -__¤þ’ -) - -619  -__ui -; - -620  -__usi -; - -621  -__uc -; - -622  -__c -; - -623 } * -__u - = (*è -__de¡ -; - -624 (è -__¤þ’ -) - -627 -__u --> -__uc - = '\0'; - -630 -__u --> -__usi - = -__¤c0_2 -; - -631 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 1); - -634 -__u --> -__usi - = -__¤c0_2 -; - -635 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 2); - -636 -__u --> -__uc - = '\0'; - -639 -__u --> -__ui - = -__¤c0_4 -; - -640 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 3); - -643 -__u --> -__ui - = -__¤c0_4 -; - -644 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 4); - -645 -__u --> -__uc - = '\0'; - -648 -__u --> -__ui - = -__¤c0_4 -; - -649 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 4); - -650 -__u --> -__usi - = -__¤c4_2 -; - -651 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 1); - -654 -__u --> -__ui - = -__¤c0_4 -; - -655 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 4); - -656 -__u --> -__usi - = -__¤c4_2 -; - -657 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 2); - -658 -__u --> -__uc - = '\0'; - -661 -__u --> -__ui - = -__¤c0_4 -; - -662 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 4); - -663 -__u --> -__ui - = -__¤c4_4 -; - -664 -__u - = - `__ex‹nsiÚ__ - ((*) __u + 3); - -667  & -__u --> -__c -; - -668 - } -} - -670 #iâdeà -_FORCE_INLINES - - -671  - #__¡pýy_¬gs -( -¤c -) \ - -672 - `__ex‹nsiÚ__ - (( -__STRING2_COPY_ARR2 -) \ - -673 { { (( -__cÚ¡ - *è( -¤c -))[0], '\0' } }), \ - -674 - `__ex‹nsiÚ__ - (( -__STRING2_COPY_ARR3 -) \ - -675 { { (( -__cÚ¡ - *è( -¤c -))[0], ((__const *) (src))[1], \ - -677 - `__ex‹nsiÚ__ - (( -__STRING2_COPY_ARR4 -) \ - -678 { { (( -__cÚ¡ - *è( -¤c -))[0], ((__const *) (src))[1], \ - -679 (( -__cÚ¡ - *è( -¤c -))[2], '\0' } }), \ - -680 - `__ex‹nsiÚ__ - (( -__STRING2_COPY_ARR5 -) \ - -681 { { (( -__cÚ¡ - *è( -¤c -))[0], ((__const *) (src))[1], \ - -682 (( -__cÚ¡ - *è( -¤c -))[2], ((__const *) (src))[3], \ - -684 - `__ex‹nsiÚ__ - (( -__STRING2_COPY_ARR6 -) \ - -685 { { (( -__cÚ¡ - *è( -¤c -))[0], ((__const *) (src))[1], \ - -686 (( -__cÚ¡ - *è( -¤c -))[2], ((__const *) (src))[3], \ - -687 (( -__cÚ¡ - *è( -¤c -))[4], '\0' } }), \ - -688 - `__ex‹nsiÚ__ - (( -__STRING2_COPY_ARR7 -) \ - -689 { { (( -__cÚ¡ - *è( -¤c -))[0], ((__const *) (src))[1], \ - -690 (( -__cÚ¡ - *è( -¤c -))[2], ((__const *) (src))[3], \ - -691 (( -__cÚ¡ - *è( -¤c -))[4], ((__const *) (src))[5], \ - -693 - `__ex‹nsiÚ__ - (( -__STRING2_COPY_ARR8 -) \ - -694 { { (( -__cÚ¡ - *è( -¤c -))[0], ((__const *) (src))[1], \ - -695 (( -__cÚ¡ - *è( -¤c -))[2], ((__const *) (src))[3], \ - -696 (( -__cÚ¡ - *è( -¤c -))[4], ((__const *) (src))[5], \ - -697 (( -__cÚ¡ - *è( -¤c -))[6], '\0' } }) - - ) - -699 -__STRING_INLINE - * -__¡pýy_sm®l - (*, -__STRING2_COPY_ARR2 -, - -700 -__STRING2_COPY_ARR3 -, - -701 -__STRING2_COPY_ARR4 -, - -702 -__STRING2_COPY_ARR5 -, - -703 -__STRING2_COPY_ARR6 -, - -704 -__STRING2_COPY_ARR7 -, - -705 -__STRING2_COPY_ARR8 -, -size_t -); - -706 -__STRING_INLINE - * - -707 - $__¡pýy_sm®l - (* -__de¡ -, - -708 -__STRING2_COPY_ARR2 - -__¤c2 -, -__STRING2_COPY_ARR3 - -__¤c3 -, - -709 -__STRING2_COPY_ARR4 - -__¤c4 -, -__STRING2_COPY_ARR5 - -__¤c5 -, - -710 -__STRING2_COPY_ARR6 - -__¤c6 -, -__STRING2_COPY_ARR7 - -__¤c7 -, - -711 -__STRING2_COPY_ARR8 - -__¤c8 -, -size_t - -__¤þ’ -) - -714  -__c -; - -715 -__STRING2_COPY_ARR2 - -__sÿ2 -; - -716 -__STRING2_COPY_ARR3 - -__sÿ3 -; - -717 -__STRING2_COPY_ARR4 - -__sÿ4 -; - -718 -__STRING2_COPY_ARR5 - -__sÿ5 -; - -719 -__STRING2_COPY_ARR6 - -__sÿ6 -; - -720 -__STRING2_COPY_ARR7 - -__sÿ7 -; - -721 -__STRING2_COPY_ARR8 - -__sÿ8 -; - -722 } * -__u - = (*è -__de¡ -; - -723 (è -__¤þ’ -) - -726 -__u --> -__c - = '\0'; - -729 -__ex‹nsiÚ__ - -__u --> -__sÿ2 - = -__¤c2 -; - -732 -__ex‹nsiÚ__ - -__u --> -__sÿ3 - = -__¤c3 -; - -735 -__ex‹nsiÚ__ - -__u --> -__sÿ4 - = -__¤c4 -; - -738 -__ex‹nsiÚ__ - -__u --> -__sÿ5 - = -__¤c5 -; - -741 -__ex‹nsiÚ__ - -__u --> -__sÿ6 - = -__¤c6 -; - -744 -__ex‹nsiÚ__ - -__u --> -__sÿ7 - = -__¤c7 -; - -747 -__ex‹nsiÚ__ - -__u --> -__sÿ8 - = -__¤c8 -; - -750  -__de¡ - + -__¤þ’ - - 1; - -751 - } -} - -759 #iâdeà -_HAVE_STRING_ARCH_¡ºýy - - -760 #ià -__GNUC_PREREQ - (3, 2) - -761  - #¡ºýy -( -de¡ -, -¤c -, -n -è - `__bužtš_¡ºýy - (de¡, src,‚) - - ) - -763  - #¡ºýy -( -de¡ -, -¤c -, -n -) \ - -764 ( - `__ex‹nsiÚ__ - ( - `__bužtš_cÚ¡ªt_p - ( -¤c -è&& __bužtš_cÚ¡ªt_°( -n -) \ - -765 ? ( - `¡¾’ - ( -¤c -è+ 1 >ð(( -size_t -è( -n -)) \ - -766 ? (*è - `memýy - ( -de¡ -, -¤c -, -n -) \ - -767 : - `¡ºýy - ( -de¡ -, -¤c -, -n -)) \ - -768 : - `¡ºýy - ( -de¡ -, -¤c -, -n -))) - - ) - -774 #iâdeà -_HAVE_STRING_ARCH_¡ºÿt - - -775 #ifdeà -_USE_STRING_ARCH_¡rchr - - -776  - #¡ºÿt -( -de¡ -, -¤c -, -n -) \ - -777 ( - `__ex‹nsiÚ__ - ({ * -__de¡ - = ( -de¡ -); \ - -778 - `__bužtš_cÚ¡ªt_p - ( -¤c -è&& __bužtš_cÚ¡ªt_°( -n -) \ - -779 ? ( - `¡¾’ - ( -¤c -è< (( -size_t -è( -n -)) \ - -780 ? - `¡rÿt - ( -__de¡ -, -¤c -) \ - -781 : (*((*è - `__mempýy - ( - `¡rchr - ( -__de¡ -, '\0'), \ - -782 -¤c -, -n -)èð'\0', -__de¡ -)) \ - -783 : - `¡ºÿt - ( -de¡ -, -¤c -, -n -); })) - - ) - -784 #–ià -__GNUC_PREREQ - (3, 2) - -785  - #¡ºÿt -( -de¡ -, -¤c -, -n -è - `__bužtš_¡ºÿt - (de¡, src,‚) - - ) - -787  - #¡ºÿt -( -de¡ -, -¤c -, -n -) \ - -788 ( - `__ex‹nsiÚ__ - ( - `__bužtš_cÚ¡ªt_p - ( -¤c -è&& __bužtš_cÚ¡ªt_°( -n -) \ - -789 ? ( - `¡¾’ - ( -¤c -è< (( -size_t -è( -n -)) \ - -790 ? - `¡rÿt - ( -de¡ -, -¤c -) \ - -791 : - `¡ºÿt - ( -de¡ -, -¤c -, -n -)) \ - -792 : - `¡ºÿt - ( -de¡ -, -¤c -, -n -))) - - ) - -798 #iâdeà -_HAVE_STRING_ARCH_¡rcmp - - -799 #ià -__GNUC_PREREQ - (3, 2) - -800  - #¡rcmp -( -s1 -, -s2 -) \ - -801 -__ex‹nsiÚ__ - \ - -802 ({ -size_t - -__s1_Ën -, -__s2_Ën -; \ - -803 ( - `__bužtš_cÚ¡ªt_p - ( -s1 -è&& __bužtš_cÚ¡ªt_°( -s2 -) \ - -804 && ( -__s1_Ën - = - `¡¾’ - ( -s1 -), -__s2_Ën - = sŒËÀ( -s2 -), \ - -805 (! - `__¡ršg2_1b±r_p - ( -s1 -è|| -__s1_Ën - >= 4) \ - -806 && (! - `__¡ršg2_1b±r_p - ( -s2 -è|| -__s2_Ën - >= 4)) \ - -807 ? - `__bužtš_¡rcmp - ( -s1 -, -s2 -) \ - -808 : ( - `__bužtš_cÚ¡ªt_p - ( -s1 -è&& - `__¡ršg2_1b±r_p - (s1) \ - -809 && ( -__s1_Ën - = - `¡¾’ - ( -s1 -), __s1_len < 4) \ - -810 ? ( - `__bužtš_cÚ¡ªt_p - ( -s2 -è&& - `__¡ršg2_1b±r_p - (s2) \ - -811 ? - `__bužtš_¡rcmp - ( -s1 -, -s2 -) \ - -812 : - `__¡rcmp_cg - ( -s1 -, -s2 -, -__s1_Ën -)) \ - -813 : ( - `__bužtš_cÚ¡ªt_p - ( -s2 -è&& - `__¡ršg2_1b±r_p - (s2) \ - -814 && ( -__s2_Ën - = - `¡¾’ - ( -s2 -), __s2_len < 4) \ - -815 ? ( - `__bužtš_cÚ¡ªt_p - ( -s1 -è&& - `__¡ršg2_1b±r_p - (s1) \ - -816 ? - `__bužtš_¡rcmp - ( -s1 -, -s2 -) \ - -817 : - `__¡rcmp_gc - ( -s1 -, -s2 -, -__s2_Ën -)) \ - -818 : - `__bužtš_¡rcmp - ( -s1 -, -s2 -)))); }) - - ) - -820  - #¡rcmp -( -s1 -, -s2 -) \ - -821 -__ex‹nsiÚ__ - \ - -822 ({ -size_t - -__s1_Ën -, -__s2_Ën -; \ - -823 ( - `__bužtš_cÚ¡ªt_p - ( -s1 -è&& __bužtš_cÚ¡ªt_°( -s2 -) \ - -824 && ( -__s1_Ën - = - `¡¾’ - ( -s1 -), -__s2_Ën - = sŒËÀ( -s2 -), \ - -825 (! - `__¡ršg2_1b±r_p - ( -s1 -è|| -__s1_Ën - >= 4) \ - -826 && (! - `__¡ršg2_1b±r_p - ( -s2 -è|| -__s2_Ën - >= 4)) \ - -827 ? - `memcmp - (( -__cÚ¡ - *è( -s1 -), (__cÚ¡ *è( -s2 -), \ - -828 ( -__s1_Ën - < -__s2_Ën - ? __s1_len : __s2_len) + 1) \ - -829 : ( - `__bužtš_cÚ¡ªt_p - ( -s1 -è&& - `__¡ršg2_1b±r_p - (s1) \ - -830 && ( -__s1_Ën - = - `¡¾’ - ( -s1 -), __s1_len < 4) \ - -831 ? ( - `__bužtš_cÚ¡ªt_p - ( -s2 -è&& - `__¡ršg2_1b±r_p - (s2) \ - -832 ? - `__¡rcmp_cc - ( -s1 -, -s2 -, -__s1_Ën -) \ - -833 : - `__¡rcmp_cg - ( -s1 -, -s2 -, -__s1_Ën -)) \ - -834 : ( - `__bužtš_cÚ¡ªt_p - ( -s2 -è&& - `__¡ršg2_1b±r_p - (s2) \ - -835 && ( -__s2_Ën - = - `¡¾’ - ( -s2 -), __s2_len < 4) \ - -836 ? ( - `__bužtš_cÚ¡ªt_p - ( -s1 -è&& - `__¡ršg2_1b±r_p - (s1) \ - -837 ? - `__¡rcmp_cc - ( -s1 -, -s2 -, -__s2_Ën -) \ - -838 : - `__¡rcmp_gc - ( -s1 -, -s2 -, -__s2_Ën -)) \ - -839 : - `¡rcmp - ( -s1 -, -s2 -)))); }) - - ) - -842  - #__¡rcmp_cc -( -s1 -, -s2 -, -l -) \ - -843 ( - `__ex‹nsiÚ__ - ({  -__»suÉ - = \ - -844 ((( -__cÚ¡ - *è(__cÚ¡ *è( -s1 -))[0] \ - -845 - (( -__cÚ¡ - *è(__cÚ¡ *)( -s2 -))[0]);\ - -846 ià( -l - > 0 && -__»suÉ - == 0) \ - -848 -__»suÉ - = ((( -__cÚ¡ - *) \ - -849 ( -__cÚ¡ - *è( -s1 -))[1] \ - -850 - (( -__cÚ¡ - *) \ - -851 ( -__cÚ¡ - *è( -s2 -))[1]); \ - -852 ià( -l - > 1 && -__»suÉ - == 0) \ - -854 -__»suÉ - = \ - -855 ((( -__cÚ¡ - *) \ - -856 ( -__cÚ¡ - *è( -s1 -))[2] \ - -857 - (( -__cÚ¡ - *) \ - -858 ( -__cÚ¡ - *è( -s2 -))[2]); \ - -859 ià( -l - > 2 && -__»suÉ - == 0) \ - -860 -__»suÉ - = \ - -861 ((( -__cÚ¡ - *) \ - -862 ( -__cÚ¡ - *è( -s1 -))[3] \ - -863 - (( -__cÚ¡ - *) \ - -864 ( -__cÚ¡ - *è( -s2 -))[3]); \ - -867 -__»suÉ -; })) - - ) - -869  - #__¡rcmp_cg -( -s1 -, -s2 -, -l1 -) \ - -870 ( - `__ex‹nsiÚ__ - ({ -__cÚ¡ - * -__s2 - = \ - -871 ( -__cÚ¡ - *è(__cÚ¡ *è( -s2 -); \ - -872  -__»suÉ - = \ - -873 ((( -__cÚ¡ - *è(__cÚ¡ *è( -s1 -))[0] \ - -874 - -__s2 -[0]); \ - -875 ià( -l1 - > 0 && -__»suÉ - == 0) \ - -877 -__»suÉ - = ((( -__cÚ¡ - *) \ - -878 ( -__cÚ¡ - *è( -s1 -))[1] - -__s2 -[1]); \ - -879 ià( -l1 - > 1 && -__»suÉ - == 0) \ - -881 -__»suÉ - = ((( -__cÚ¡ - *) \ - -882 ( -__cÚ¡ - *è( -s1 -))[2] - -__s2 -[2]);\ - -883 ià( -l1 - > 2 && -__»suÉ - == 0) \ - -884 -__»suÉ - = ((( -__cÚ¡ - *) \ - -885 ( -__cÚ¡ - *è( -s1 -))[3] \ - -886 - -__s2 -[3]); \ - -889 -__»suÉ -; })) - - ) - -891  - #__¡rcmp_gc -( -s1 -, -s2 -, -l2 -) \ - -892 ( - `__ex‹nsiÚ__ - ({ -__cÚ¡ - * -__s1 - = \ - -893 ( -__cÚ¡ - *è(__cÚ¡ *è( -s1 -); \ - -894  -__»suÉ - = \ - -895 -__s1 -[0] - (( -__cÚ¡ - *) \ - -896 ( -__cÚ¡ - *è( -s2 -))[0]; \ - -897 ià( -l2 - > 0 && -__»suÉ - == 0) \ - -899 -__»suÉ - = ( -__s1 -[1] \ - -900 - (( -__cÚ¡ - *) \ - -901 ( -__cÚ¡ - *è( -s2 -))[1]); \ - -902 ià( -l2 - > 1 && -__»suÉ - == 0) \ - -904 -__»suÉ - = \ - -905 ( -__s1 -[2] - (( -__cÚ¡ - *) \ - -906 ( -__cÚ¡ - *è( -s2 -))[2]); \ - -907 ià( -l2 - > 2 && -__»suÉ - == 0) \ - -908 -__»suÉ - = \ - -909 ( -__s1 -[3] \ - -910 - (( -__cÚ¡ - *) \ - -911 ( -__cÚ¡ - *è( -s2 -))[3]); \ - -914 -__»suÉ -; })) - - ) - -919 #iâdeà -_HAVE_STRING_ARCH_¡ºcmp - - -920  - #¡ºcmp -( -s1 -, -s2 -, -n -) \ - -921 ( - `__ex‹nsiÚ__ - ( - `__bužtš_cÚ¡ªt_p - ( -n -) \ - -922 && (( - `__bužtš_cÚ¡ªt_p - ( -s1 -) \ - -923 && - `¡¾’ - ( -s1 -è< (( -size_t -è( -n -))) \ - -924 || ( - `__bužtš_cÚ¡ªt_p - ( -s2 -) \ - -925 && - `¡¾’ - ( -s2 -è< (( -size_t -è( -n -)))) \ - -926 ? - `¡rcmp - ( -s1 -, -s2 -è: - `¡ºcmp - (s1, s2, -n -))) - - ) - -932 #ià! -defšed - -_HAVE_STRING_ARCH_¡rc¥n - || defšed -_FORCE_INLINES - - -933 #iâdeà -_HAVE_STRING_ARCH_¡rc¥n - - -934 #ià -__GNUC_PREREQ - (3, 2) - -935  - #¡rc¥n -( -s -, -»jeù -) \ - -936 -__ex‹nsiÚ__ - \ - -937 ({  -__r0 -, -__r1 -, -__r2 -; \ - -938 ( - `__bužtš_cÚ¡ªt_p - ( -»jeù -è&& - `__¡ršg2_1b±r_p - (reject) \ - -939 ? (( - `__bužtš_cÚ¡ªt_p - ( -s -è&& - `__¡ršg2_1b±r_p - (s)) \ - -940 ? - `__bužtš_¡rc¥n - ( -s -, -»jeù -) \ - -941 : (( -__r0 - = (( -__cÚ¡ - *è( -»jeù -))[0], __r0 == '\0') \ - -942 ? - `¡¾’ - ( -s -) \ - -943 : (( -__r1 - = (( -__cÚ¡ - *è( -»jeù -))[1], __r1 == '\0') \ - -944 ? - `__¡rc¥n_c1 - ( -s -, -__r0 -) \ - -945 : (( -__r2 - = (( -__cÚ¡ - *è( -»jeù -))[2], __r2 == '\0') \ - -946 ? - `__¡rc¥n_c2 - ( -s -, -__r0 -, -__r1 -) \ - -947 : ((( -__cÚ¡ - *è( -»jeù -))[3] == '\0' \ - -948 ? - `__¡rc¥n_c3 - ( -s -, -__r0 -, -__r1 -, -__r2 -) \ - -949 : - `__bužtš_¡rc¥n - ( -s -, -»jeù -)))))) \ - -950 : - `__bužtš_¡rc¥n - ( -s -, -»jeù -)); }) - - ) - -952  - #¡rc¥n -( -s -, -»jeù -) \ - -953 -__ex‹nsiÚ__ - \ - -954 ({  -__r0 -, -__r1 -, -__r2 -; \ - -955 ( - `__bužtš_cÚ¡ªt_p - ( -»jeù -è&& - `__¡ršg2_1b±r_p - (reject) \ - -956 ? (( -__r0 - = (( -__cÚ¡ - *è( -»jeù -))[0], __r0 == '\0') \ - -957 ? - `¡¾’ - ( -s -) \ - -958 : (( -__r1 - = (( -__cÚ¡ - *è( -»jeù -))[1], __r1 == '\0') \ - -959 ? - `__¡rc¥n_c1 - ( -s -, -__r0 -) \ - -960 : (( -__r2 - = (( -__cÚ¡ - *è( -»jeù -))[2], __r2 == '\0') \ - -961 ? - `__¡rc¥n_c2 - ( -s -, -__r0 -, -__r1 -) \ - -962 : ((( -__cÚ¡ - *è( -»jeù -))[3] == '\0' \ - -963 ? - `__¡rc¥n_c3 - ( -s -, -__r0 -, -__r1 -, -__r2 -) \ - -964 : - `¡rc¥n - ( -s -, -»jeù -))))) \ - -965 : - `¡rc¥n - ( -s -, -»jeù -)); }) - - ) - -969 -__STRING_INLINE - -size_t - -__¡rc¥n_c1 - ( -__cÚ¡ - * -__s -,  -__»jeù -); - -970 -__STRING_INLINE - -size_t - - -971 - $__¡rc¥n_c1 - ( -__cÚ¡ - * -__s -,  -__»jeù -) - -973  -size_t - -__»suÉ - = 0; - -974  -__s -[ -__»suÉ -] !ð'\0' && __s[__»suÉ] !ð -__»jeù -) - -975 ++ -__»suÉ -; - -976  -__»suÉ -; - -977 - } -} - -979 -__STRING_INLINE - -size_t - -__¡rc¥n_c2 - ( -__cÚ¡ - * -__s -,  -__»jeù1 -, - -980  -__»jeù2 -); - -981 -__STRING_INLINE - -size_t - - -982 - $__¡rc¥n_c2 - ( -__cÚ¡ - * -__s -,  -__»jeù1 -,  -__»jeù2 -) - -984  -size_t - -__»suÉ - = 0; - -985  -__s -[ -__»suÉ -] !ð'\0' && __s[__»suÉ] !ð -__»jeù1 - - -986 && -__s -[ -__»suÉ -] !ð -__»jeù2 -) - -987 ++ -__»suÉ -; - -988  -__»suÉ -; - -989 - } -} - -991 -__STRING_INLINE - -size_t - -__¡rc¥n_c3 - ( -__cÚ¡ - * -__s -,  -__»jeù1 -, - -992  -__»jeù2 -,  -__»jeù3 -); - -993 -__STRING_INLINE - -size_t - - -994 - $__¡rc¥n_c3 - ( -__cÚ¡ - * -__s -,  -__»jeù1 -,  -__»jeù2 -, - -995  -__»jeù3 -) - -997  -size_t - -__»suÉ - = 0; - -998  -__s -[ -__»suÉ -] !ð'\0' && __s[__»suÉ] !ð -__»jeù1 - - -999 && -__s -[ -__»suÉ -] !ð -__»jeù2 - && __s[__»suÉ] !ð -__»jeù3 -) - -1000 ++ -__»suÉ -; - -1001  -__»suÉ -; - -1002 - } -} - -1008 #ià! -defšed - -_HAVE_STRING_ARCH_¡r¥n - || defšed -_FORCE_INLINES - - -1009 #iâdeà -_HAVE_STRING_ARCH_¡r¥n - - -1010 #ià -__GNUC_PREREQ - (3, 2) - -1011  - #¡r¥n -( -s -, -acû± -) \ - -1012 -__ex‹nsiÚ__ - \ - -1013 ({  -__a0 -, -__a1 -, -__a2 -; \ - -1014 ( - `__bužtš_cÚ¡ªt_p - ( -acû± -è&& - `__¡ršg2_1b±r_p - (accept) \ - -1015 ? (( - `__bužtš_cÚ¡ªt_p - ( -s -è&& - `__¡ršg2_1b±r_p - (s)) \ - -1016 ? - `__bužtš_¡r¥n - ( -s -, -acû± -) \ - -1017 : (( -__a0 - = (( -__cÚ¡ - *è( -acû± -))[0], __a0 == '\0') \ - -1018 ? ((è( -s -), 0) \ - -1019 : (( -__a1 - = (( -__cÚ¡ - *è( -acû± -))[1], __a1 == '\0') \ - -1020 ? - `__¡r¥n_c1 - ( -s -, -__a0 -) \ - -1021 : (( -__a2 - = (( -__cÚ¡ - *è( -acû± -))[2], __a2 == '\0') \ - -1022 ? - `__¡r¥n_c2 - ( -s -, -__a0 -, -__a1 -) \ - -1023 : ((( -__cÚ¡ - *è( -acû± -))[3] == '\0' \ - -1024 ? - `__¡r¥n_c3 - ( -s -, -__a0 -, -__a1 -, -__a2 -) \ - -1025 : - `__bužtš_¡r¥n - ( -s -, -acû± -)))))) \ - -1026 : - `__bužtš_¡r¥n - ( -s -, -acû± -)); }) - - ) - -1028  - #¡r¥n -( -s -, -acû± -) \ - -1029 -__ex‹nsiÚ__ - \ - -1030 ({  -__a0 -, -__a1 -, -__a2 -; \ - -1031 ( - `__bužtš_cÚ¡ªt_p - ( -acû± -è&& - `__¡ršg2_1b±r_p - (accept) \ - -1032 ? (( -__a0 - = (( -__cÚ¡ - *è( -acû± -))[0], __a0 == '\0') \ - -1033 ? ((è( -s -), 0) \ - -1034 : (( -__a1 - = (( -__cÚ¡ - *è( -acû± -))[1], __a1 == '\0') \ - -1035 ? - `__¡r¥n_c1 - ( -s -, -__a0 -) \ - -1036 : (( -__a2 - = (( -__cÚ¡ - *è( -acû± -))[2], __a2 == '\0') \ - -1037 ? - `__¡r¥n_c2 - ( -s -, -__a0 -, -__a1 -) \ - -1038 : ((( -__cÚ¡ - *è( -acû± -))[3] == '\0' \ - -1039 ? - `__¡r¥n_c3 - ( -s -, -__a0 -, -__a1 -, -__a2 -) \ - -1040 : - `¡r¥n - ( -s -, -acû± -))))) \ - -1041 : - `¡r¥n - ( -s -, -acû± -)); }) - - ) - -1045 -__STRING_INLINE - -size_t - -__¡r¥n_c1 - ( -__cÚ¡ - * -__s -,  -__acû± -); - -1046 -__STRING_INLINE - -size_t - - -1047 - $__¡r¥n_c1 - ( -__cÚ¡ - * -__s -,  -__acû± -) - -1049  -size_t - -__»suÉ - = 0; - -1051  -__s -[ -__»suÉ -] =ð -__acû± -) - -1052 ++ -__»suÉ -; - -1053  -__»suÉ -; - -1054 - } -} - -1056 -__STRING_INLINE - -size_t - -__¡r¥n_c2 - ( -__cÚ¡ - * -__s -,  -__acû±1 -, - -1057  -__acû±2 -); - -1058 -__STRING_INLINE - -size_t - - -1059 - $__¡r¥n_c2 - ( -__cÚ¡ - * -__s -,  -__acû±1 -,  -__acû±2 -) - -1061  -size_t - -__»suÉ - = 0; - -1063  -__s -[ -__»suÉ -] =ð -__acû±1 - || __s[__»suÉ] =ð -__acû±2 -) - -1064 ++ -__»suÉ -; - -1065  -__»suÉ -; - -1066 - } -} - -1068 -__STRING_INLINE - -size_t - -__¡r¥n_c3 - ( -__cÚ¡ - * -__s -,  -__acû±1 -, - -1069  -__acû±2 -,  -__acû±3 -); - -1070 -__STRING_INLINE - -size_t - - -1071 - $__¡r¥n_c3 - ( -__cÚ¡ - * -__s -,  -__acû±1 -,  -__acû±2 -,  -__acû±3 -) - -1073  -size_t - -__»suÉ - = 0; - -1075  -__s -[ -__»suÉ -] =ð -__acû±1 - || __s[__»suÉ] =ð -__acû±2 - - -1076 || -__s -[ -__»suÉ -] =ð -__acû±3 -) - -1077 ++ -__»suÉ -; - -1078  -__»suÉ -; - -1079 - } -} - -1084 #ià! -defšed - -_HAVE_STRING_ARCH_¡½brk - || defšed -_FORCE_INLINES - - -1085 #iâdeà -_HAVE_STRING_ARCH_¡½brk - - -1086 #ià -__GNUC_PREREQ - (3, 2) - -1087  - #¡½brk -( -s -, -acû± -) \ - -1088 -__ex‹nsiÚ__ - \ - -1089 ({  -__a0 -, -__a1 -, -__a2 -; \ - -1090 ( - `__bužtš_cÚ¡ªt_p - ( -acû± -è&& - `__¡ršg2_1b±r_p - (accept) \ - -1091 ? (( - `__bužtš_cÚ¡ªt_p - ( -s -è&& - `__¡ršg2_1b±r_p - (s)) \ - -1092 ? - `__bužtš_¡½brk - ( -s -, -acû± -) \ - -1093 : (( -__a0 - = (( -__cÚ¡ - *è( -acû± -))[0], __a0 == '\0') \ - -1094 ? ((è( -s -), (*è -NULL -) \ - -1095 : (( -__a1 - = (( -__cÚ¡ - *è( -acû± -))[1], __a1 == '\0') \ - -1096 ? - `__bužtš_¡rchr - ( -s -, -__a0 -) \ - -1097 : (( -__a2 - = (( -__cÚ¡ - *è( -acû± -))[2], __a2 == '\0') \ - -1098 ? - `__¡½brk_c2 - ( -s -, -__a0 -, -__a1 -) \ - -1099 : ((( -__cÚ¡ - *è( -acû± -))[3] == '\0' \ - -1100 ? - `__¡½brk_c3 - ( -s -, -__a0 -, -__a1 -, -__a2 -) \ - -1101 : - `__bužtš_¡½brk - ( -s -, -acû± -)))))) \ - -1102 : - `__bužtš_¡½brk - ( -s -, -acû± -)); }) - - ) - -1104  - #¡½brk -( -s -, -acû± -) \ - -1105 -__ex‹nsiÚ__ - \ - -1106 ({  -__a0 -, -__a1 -, -__a2 -; \ - -1107 ( - `__bužtš_cÚ¡ªt_p - ( -acû± -è&& - `__¡ršg2_1b±r_p - (accept) \ - -1108 ? (( -__a0 - = (( -__cÚ¡ - *è( -acû± -))[0], __a0 == '\0') \ - -1109 ? ((è( -s -), (*è -NULL -) \ - -1110 : (( -__a1 - = (( -__cÚ¡ - *è( -acû± -))[1], __a1 == '\0') \ - -1111 ? - `¡rchr - ( -s -, -__a0 -) \ - -1112 : (( -__a2 - = (( -__cÚ¡ - *è( -acû± -))[2], __a2 == '\0') \ - -1113 ? - `__¡½brk_c2 - ( -s -, -__a0 -, -__a1 -) \ - -1114 : ((( -__cÚ¡ - *è( -acû± -))[3] == '\0' \ - -1115 ? - `__¡½brk_c3 - ( -s -, -__a0 -, -__a1 -, -__a2 -) \ - -1116 : - `¡½brk - ( -s -, -acû± -))))) \ - -1117 : - `¡½brk - ( -s -, -acû± -)); }) - - ) - -1121 -__STRING_INLINE - * -__¡½brk_c2 - ( -__cÚ¡ - * -__s -,  -__acû±1 -, - -1122  -__acû±2 -); - -1123 -__STRING_INLINE - * - -1124 - $__¡½brk_c2 - ( -__cÚ¡ - * -__s -,  -__acû±1 -,  -__acû±2 -) - -1127 * -__s - !ð'\0' && *__ !ð -__acû±1 - && *__ !ð -__acû±2 -) - -1128 ++ -__s -; - -1129  * -__s - =ð'\0' ? -NULL - : (*è( -size_t -) __s; - -1130 - } -} - -1132 -__STRING_INLINE - * -__¡½brk_c3 - ( -__cÚ¡ - * -__s -,  -__acû±1 -, - -1133  -__acû±2 -,  -__acû±3 -); - -1134 -__STRING_INLINE - * - -1135 - $__¡½brk_c3 - ( -__cÚ¡ - * -__s -,  -__acû±1 -,  -__acû±2 -, - -1136  -__acû±3 -) - -1139 * -__s - !ð'\0' && *__ !ð -__acû±1 - && *__ !ð -__acû±2 - - -1140 && * -__s - !ð -__acû±3 -) - -1141 ++ -__s -; - -1142  * -__s - =ð'\0' ? -NULL - : (*è( -size_t -) __s; - -1143 - } -} - -1149 #ià! -defšed - -_HAVE_STRING_ARCH_¡r¡r - && ! -__GNUC_PREREQ - (2, 97) - -1150  - #¡r¡r -( -hay¡ack -, -ÃedË -) \ - -1151 ( - `__ex‹nsiÚ__ - ( - `__bužtš_cÚ¡ªt_p - ( -ÃedË -è&& - `__¡ršg2_1b±r_p - (needle) \ - -1152 ? ((( -__cÚ¡ - *è( -ÃedË -))[0] == '\0' \ - -1153 ? (*è( -size_t -è( -hay¡ack -) \ - -1154 : ((( -__cÚ¡ - *è( -ÃedË -))[1] == '\0' \ - -1155 ? - `¡rchr - ( -hay¡ack -, \ - -1156 (( -__cÚ¡ - *è( -ÃedË -))[0]) \ - -1157 : - `¡r¡r - ( -hay¡ack -, -ÃedË -))) \ - -1158 : - `¡r¡r - ( -hay¡ack -, -ÃedË -))) - - ) - -1162 #ià! -defšed - -_HAVE_STRING_ARCH_¡¹ok_r - || defšed -_FORCE_INLINES - - -1163 #iâdeà -_HAVE_STRING_ARCH_¡¹ok_r - - -1164  - #__¡¹ok_r -( -s -, -£p -, -Ãx -) \ - -1165 ( - `__ex‹nsiÚ__ - ( - `__bužtš_cÚ¡ªt_p - ( -£p -è&& - `__¡ršg2_1b±r_p - (sep) \ - -1166 && (( -__cÚ¡ - *è( -£p -))[0] != '\0' \ - -1167 && (( -__cÚ¡ - *è( -£p -))[1] == '\0' \ - -1168 ? - `__¡¹ok_r_1c - ( -s -, (( -__cÚ¡ - *è( -£p -))[0], -Ãx -) \ - -1169 : - `__¡¹ok_r - ( -s -, -£p -, -Ãx -))) - - ) - -1172 -__STRING_INLINE - * -__¡¹ok_r_1c - (* -__s -,  -__£p -, ** -__Ãx -); - -1173 -__STRING_INLINE - * - -1174 - $__¡¹ok_r_1c - (* -__s -,  -__£p -, ** -__Ãx -) - -1176 * -__»suÉ -; - -1177 ià( -__s - =ð -NULL -) - -1178 -__s - = * -__Ãx -; - -1179 * -__s - =ð -__£p -) - -1180 ++ -__s -; - -1181 -__»suÉ - = -NULL -; - -1182 ià(* -__s - != '\0') - -1184 -__»suÉ - = -__s -++; - -1185 * -__s - != '\0') - -1186 ià(* -__s -++ =ð -__£p -) - -1188 -__s -[-1] = '\0'; - -1192 * -__Ãx - = -__s -; - -1193  -__»suÉ -; - -1194 - } -} - -1195 #ià -defšed - -__USE_POSIX - || defšed -__USE_MISC - - -1196  - #¡¹ok_r -( -s -, -£p -, -Ãx -è - `__¡¹ok_r - (s, s•,‚ex) - - ) - -1201 #ià! -defšed - -_HAVE_STRING_ARCH_¡r£p - || defšed -_FORCE_INLINES - - -1202 #iâdeà -_HAVE_STRING_ARCH_¡r£p - - -1204 * -__¡r£p_g - (** -__¡ršgp -, -__cÚ¡ - * -__d–im -); - -1205  - #__¡r£p -( -s -, -»jeù -) \ - -1206 -__ex‹nsiÚ__ - \ - -1207 ({  -__r0 -, -__r1 -, -__r2 -; \ - -1208 ( - `__bužtš_cÚ¡ªt_p - ( -»jeù -è&& - `__¡ršg2_1b±r_p - (reject) \ - -1209 && ( -__r0 - = (( -__cÚ¡ - *è( -»jeù -))[0], \ - -1210 (( -__cÚ¡ - *è( -»jeù -))[0] != '\0') \ - -1211 ? (( -__r1 - = (( -__cÚ¡ - *è( -»jeù -))[1], \ - -1212 (( -__cÚ¡ - *è( -»jeù -))[1] == '\0') \ - -1213 ? - `__¡r£p_1c - ( -s -, -__r0 -) \ - -1214 : (( -__r2 - = (( -__cÚ¡ - *è( -»jeù -))[2], __r2 == '\0') \ - -1215 ? - `__¡r£p_2c - ( -s -, -__r0 -, -__r1 -) \ - -1216 : ((( -__cÚ¡ - *è( -»jeù -))[3] == '\0' \ - -1217 ? - `__¡r£p_3c - ( -s -, -__r0 -, -__r1 -, -__r2 -) \ - -1218 : - `__¡r£p_g - ( -s -, -»jeù -)))) \ - -1219 : - `__¡r£p_g - ( -s -, -»jeù -)); }) - - ) - -1222 -__STRING_INLINE - * -__¡r£p_1c - (** -__s -,  -__»jeù -); - -1223 -__STRING_INLINE - * - -1224 - $__¡r£p_1c - (** -__s -,  -__»jeù -) - -1226 * -__»tv® - = * -__s -; - -1227 ià( -__»tv® - !ð -NULL - && (* -__s - = - `¡rchr - (__»tv®, -__»jeù -)) != NULL) - -1228 *(* -__s -)++ = '\0'; - -1229  -__»tv® -; - -1230 - } -} - -1232 -__STRING_INLINE - * -__¡r£p_2c - (** -__s -,  -__»jeù1 -,  -__»jeù2 -); - -1233 -__STRING_INLINE - * - -1234 - $__¡r£p_2c - (** -__s -,  -__»jeù1 -,  -__»jeù2 -) - -1236 * -__»tv® - = * -__s -; - -1237 ià( -__»tv® - !ð -NULL -) - -1239 * -__ý - = -__»tv® -; - -1242 ià(* -__ý - == '\0') - -1244 -__ý - = -NULL -; - -1247 ià(* -__ý - =ð -__»jeù1 - || *__ý =ð -__»jeù2 -) - -1249 * -__ý -++ = '\0'; - -1252 ++ -__ý -; - -1254 * -__s - = -__ý -; - -1256  -__»tv® -; - -1257 - } -} - -1259 -__STRING_INLINE - * -__¡r£p_3c - (** -__s -,  -__»jeù1 -,  -__»jeù2 -, - -1260  -__»jeù3 -); - -1261 -__STRING_INLINE - * - -1262 - $__¡r£p_3c - (** -__s -,  -__»jeù1 -,  -__»jeù2 -,  -__»jeù3 -) - -1264 * -__»tv® - = * -__s -; - -1265 ià( -__»tv® - !ð -NULL -) - -1267 * -__ý - = -__»tv® -; - -1270 ià(* -__ý - == '\0') - -1272 -__ý - = -NULL -; - -1275 ià(* -__ý - =ð -__»jeù1 - || *__ý =ð -__»jeù2 - || *__ý =ð -__»jeù3 -) - -1277 * -__ý -++ = '\0'; - -1280 ++ -__ý -; - -1282 * -__s - = -__ý -; - -1284  -__»tv® -; - -1285 - } -} - -1286 #ifdeà -__USE_BSD - - -1287  - #¡r£p -( -s -, -»jeù -è - `__¡r£p - (s,„ejeù) - - ) - -1294 #ifdeà -__USE_MISC - - -1296 #ià! -defšed - -_HAVE_STRING_ARCH_¡rdup - || !defšed -_HAVE_STRING_ARCH_¡ºdup - - -1297  - #__Ãed_m®loc_ªd_ÿÎoc - - - ) - -1298  - ~<¡dlib.h -> - -1301 #iâdeà -_HAVE_STRING_ARCH_¡rdup - - -1303 * - $__¡rdup - ( -__cÚ¡ - * -__¡ršg -è -__THROW - -__©Œibu‹_m®loc__ -; - -1304  - #__¡rdup -( -s -) \ - -1305 ( - `__ex‹nsiÚ__ - ( - `__bužtš_cÚ¡ªt_p - ( -s -è&& - `__¡ršg2_1b±r_p - (s) \ - -1306 ? ((( -__cÚ¡ - *è( -s -))[0] == '\0' \ - -1307 ? (*è - `ÿÎoc - (( -size_t -) 1, (size_t) 1) \ - -1308 : ({ -size_t - -__Ën - = - `¡¾’ - ( -s -) + 1; \ - -1309 * -__»tv® - = (*è - `m®loc - ( -__Ën -); \ - -1310 ià( -__»tv® - !ð -NULL -) \ - -1311 -__»tv® - = (*è - `memýy - (__»tv®, -s -, -__Ën -); \ - -1312 -__»tv® -; - } -})) \ - -1313 : - `__¡rdup - ( -s -))) - - ) - -1315 #ià -defšed - -__USE_SVID - || defšed -__USE_BSD - || defšed -__USE_XOPEN_EXTENDED - - -1316  - #¡rdup -( -s -è - `__¡rdup - (s) - - ) - -1320 #iâdeà -_HAVE_STRING_ARCH_¡ºdup - - -1322 * - $__¡ºdup - ( -__cÚ¡ - * -__¡ršg -, -size_t - -__n -) - -1323 -__THROW - -__©Œibu‹_m®loc__ -; - -1324  - #__¡ºdup -( -s -, -n -) \ - -1325 ( - `__ex‹nsiÚ__ - ( - `__bužtš_cÚ¡ªt_p - ( -s -è&& - `__¡ršg2_1b±r_p - (s) \ - -1326 ? ((( -__cÚ¡ - *è( -s -))[0] == '\0' \ - -1327 ? (*è - `ÿÎoc - (( -size_t -) 1, (size_t) 1) \ - -1328 : ({ -size_t - -__Ën - = - `¡¾’ - ( -s -) + 1; \ - -1329 -size_t - -__n - = ( -n -); \ - -1330 * -__»tv® -; \ - -1331 ià( -__n - < -__Ën -) \ - -1332 -__Ën - = -__n - + 1; \ - -1333 -__»tv® - = (*è - `m®loc - ( -__Ën -); \ - -1334 ià( -__»tv® - !ð -NULL -) \ - -1336 -__»tv® -[ -__Ën - - 1] = '\0'; \ - -1337 -__»tv® - = (*è - `memýy - (__»tv®, -s -, \ - -1338 -__Ën - - 1); \ - -1340 -__»tv® -; - } -})) \ - -1341 : - `__¡ºdup - ( -s -, -n -))) - - ) - -1343 #ifdeà -__USE_GNU - - -1344  - #¡ºdup -( -s -, -n -è - `__¡ºdup - (s,‚) - - ) - -1350 #iâdeà -_FORCE_INLINES - - -1351 #undeà -__STRING_INLINE - - - @/usr/include/bits/string3.h - -19 #iâdeà -_STRING_H - - -23 -__w¬ndeþ - ( -__w¬n_mem£t_z”o_Ën -, - -26 #iâdeà -__ýlu¥lus - - -30 #undeà -memýy - - -31 #undeà -memmove - - -32 #undeà -mem£t - - -33 #undeà -¡rÿt - - -34 #undeà -¡rýy - - -35 #undeà -¡ºÿt - - -36 #undeà -¡ºýy - - -37 #ifdeà -__USE_GNU - - -38 #undeà -mempýy - - -39 #undeà -¡pýy - - -41 #ifdeà -__USE_BSD - - -42 #undeà -bcÝy - - -43 #undeà -bz”o - - -48 -__ex‹º_®ways_šlše - * - -49 -__NTH - ( - $memýy - (* -__»¡riù - -__de¡ -, -__cÚ¡ - *__»¡riù -__¤c -, - -50 -size_t - -__Ën -)) - -52  - `__bužtš___memýy_chk - ( -__de¡ -, -__¤c -, -__Ën -, - `__bos0 - (__dest)); - -53 - } -} - -55 -__ex‹º_®ways_šlše - * - -56 -__NTH - ( - $memmove - (* -__»¡riù - -__de¡ -, -__cÚ¡ - *__»¡riù -__¤c -, - -57 -size_t - -__Ën -)) - -59  - `__bužtš___memmove_chk - ( -__de¡ -, -__¤c -, -__Ën -, - `__bos0 - (__dest)); - -60 - } -} - -62 #ifdeà -__USE_GNU - - -63 -__ex‹º_®ways_šlše - * - -64 -__NTH - ( - $mempýy - (* -__»¡riù - -__de¡ -, -__cÚ¡ - *__»¡riù -__¤c -, - -65 -size_t - -__Ën -)) - -67  - `__bužtš___mempýy_chk - ( -__de¡ -, -__¤c -, -__Ën -, - `__bos0 - (__dest)); - -68 - } -} - -77 -__ex‹º_®ways_šlše - * - -78 -__NTH - ( - $mem£t - (* -__de¡ -,  -__ch -, -size_t - -__Ën -)) - -80 ià( - `__bužtš_cÚ¡ªt_p - ( -__Ën -) && __len == 0 - -81 && (! - `__bužtš_cÚ¡ªt_p - ( -__ch -) || __ch != 0)) - -83 - `__w¬n_mem£t_z”o_Ën - (); - -84  -__de¡ -; - -86  - `__bužtš___mem£t_chk - ( -__de¡ -, -__ch -, -__Ën -, - `__bos0 - (__dest)); - -87 - } -} - -89 #ifdeà -__USE_BSD - - -90 -__ex‹º_®ways_šlše -  - -91 -__NTH - ( - $bcÝy - ( -__cÚ¡ - * -__»¡riù - -__¤c -, *__»¡riù -__de¡ -, - -92 -size_t - -__Ën -)) - -94 (è - `__bužtš___memmove_chk - ( -__de¡ -, -__¤c -, -__Ën -, - `__bos0 - (__dest)); - -95 - } -} - -97 -__ex‹º_®ways_šlše -  - -98 -__NTH - ( - $bz”o - (* -__de¡ -, -size_t - -__Ën -)) - -100 (è - `__bužtš___mem£t_chk - ( -__de¡ -, '\0', -__Ën -, - `__bos0 - (__dest)); - -101 - } -} - -104 -__ex‹º_®ways_šlše - * - -105 -__NTH - ( - $¡rýy - (* -__»¡riù - -__de¡ -, -__cÚ¡ - *__»¡riù -__¤c -)) - -107  - `__bužtš___¡rýy_chk - ( -__de¡ -, -__¤c -, - `__bos - (__dest)); - -108 - } -} - -110 #ifdeà -__USE_GNU - - -111 -__ex‹º_®ways_šlše - * - -112 -__NTH - ( - $¡pýy - (* -__»¡riù - -__de¡ -, -__cÚ¡ - *__»¡riù -__¤c -)) - -114  - `__bužtš___¡pýy_chk - ( -__de¡ -, -__¤c -, - `__bos - (__dest)); - -115 - } -} - -119 -__ex‹º_®ways_šlše - * - -120 -__NTH - ( - $¡ºýy - (* -__»¡riù - -__de¡ -, -__cÚ¡ - *__»¡riù -__¤c -, - -121 -size_t - -__Ën -)) - -123  - `__bužtš___¡ºýy_chk - ( -__de¡ -, -__¤c -, -__Ën -, - `__bos - (__dest)); - -124 - } -} - -127 * - $__¡²ýy_chk - (* -__de¡ -, -__cÚ¡ - * -__¤c -, -size_t - -__n -, - -128 -size_t - -__de¡Ën -è -__THROW -; - -129 * - `__REDIRECT_NTH - ( -__¡²ýy_®Ÿs -, (* -__de¡ -, - -130 -__cÚ¡ - * -__¤c -, - -131 -size_t - -__n -), -¡²ýy -); - -133 -__ex‹º_®ways_šlše - * - -134 - `__NTH - ( - $¡²ýy - (* -__de¡ -, -__cÚ¡ - * -__¤c -, -size_t - -__n -)) - -136 ià( - `__bos - ( -__de¡ -è!ð( -size_t -) -1 - -137 && (! - `__bužtš_cÚ¡ªt_p - ( -__n -è|| __À<ð - `__bos - ( -__de¡ -))) - -138  - `__¡²ýy_chk - ( -__de¡ -, -__¤c -, -__n -, - `__bos - (__dest)); - -139  - `__¡²ýy_®Ÿs - ( -__de¡ -, -__¤c -, -__n -); - -140 - } -} - -143 -__ex‹º_®ways_šlše - * - -144 -__NTH - ( - $¡rÿt - (* -__»¡riù - -__de¡ -, -__cÚ¡ - *__»¡riù -__¤c -)) - -146  - `__bužtš___¡rÿt_chk - ( -__de¡ -, -__¤c -, - `__bos - (__dest)); - -147 - } -} - -150 -__ex‹º_®ways_šlše - * - -151 -__NTH - ( - $¡ºÿt - (* -__»¡riù - -__de¡ -, -__cÚ¡ - *__»¡riù -__¤c -, - -152 -size_t - -__Ën -)) - -154  - `__bužtš___¡ºÿt_chk - ( -__de¡ -, -__¤c -, -__Ën -, - `__bos - (__dest)); - -155 - } -} - - @/usr/include/bits/sys_errlist.h - -20 #iâdeà -_STDIO_H - - -26 #ifdeà -__USE_BSD - - -27  -sys_ü -; - -28 -__cÚ¡ - *__cÚ¡ -sys_”¾i¡ -[]; - -30 #ifdeà -__USE_GNU - - -31  -_sys_ü -; - -32 -__cÚ¡ - *__cÚ¡ -_sys_”¾i¡ -[]; - - @/usr/include/bits/types.h - -24 #iâdef -_BITS_TYPES_H - - -25  - #_BITS_TYPES_H - 1 - - ) - -27  - ~<ã©u»s.h -> - -28  - ~ - -31  - t__u_ch¬ -; - -32  - t__u_shÜt -; - -33  - t__u_št -; - -34  - t__u_lÚg -; - -37 sigÃd  - t__št8_t -; - -38  - t__ušt8_t -; - -39 sigÃd  - t__št16_t -; - -40  - t__ušt16_t -; - -41 sigÃd  - t__št32_t -; - -42  - t__ušt32_t -; - -43 #ià -__WORDSIZE - == 64 - -44 sigÃd  - t__št64_t -; - -45  - t__ušt64_t -; - -46 #–ià -defšed - -__GLIBC_HAVE_LONG_LONG - - -47 -__ex‹nsiÚ__ - sigÃd  - t__št64_t -; - -48 -__ex‹nsiÚ__ -  - t__ušt64_t -; - -52 #ià -__WORDSIZE - == 64 - -53  - t__quad_t -; - -54  - t__u_quad_t -; - -55 #–ià -defšed - -__GLIBC_HAVE_LONG_LONG - - -56 -__ex‹nsiÚ__ -  - t__quad_t -; - -57 -__ex‹nsiÚ__ -  - t__u_quad_t -; - -61  - m__v® -[2]; - -62 } - t__quad_t -; - -65 -__u_lÚg - - m__v® -[2]; - -66 } - t__u_quad_t -; - -99  - #__S16_TYPE -  - - ) - -100  - #__U16_TYPE -  - - ) - -101  - #__S32_TYPE -  - - ) - -102  - #__U32_TYPE -  - - ) - -103  - #__SLONGWORD_TYPE -  - - ) - -104  - #__ULONGWORD_TYPE -  - - ) - -105 #ià -__WORDSIZE - == 32 - -106  - #__SQUAD_TYPE - -__quad_t - - - ) - -107  - #__UQUAD_TYPE - -__u_quad_t - - - ) - -108  - #__SWORD_TYPE -  - - ) - -109  - #__UWORD_TYPE -  - - ) - -110  - #__SLONG32_TYPE -  - - ) - -111  - #__ULONG32_TYPE -  - - ) - -112  - #__S64_TYPE - -__quad_t - - - ) - -113  - #__U64_TYPE - -__u_quad_t - - - ) - -116  - #__STD_TYPE - -__ex‹nsiÚ__ -  - - ) - -117 #–ià -__WORDSIZE - == 64 - -118  - t__SQUAD_TYPE -  - - ) - -119  - t__UQUAD_TYPE -  - - ) - -120  - t__SWORD_TYPE -  - - ) - -121  - t__UWORD_TYPE -  - - ) - -122  - t__SLONG32_TYPE -  - - ) - -123  - t__ULONG32_TYPE -  - - ) - -124  - t__S64_TYPE -  - - ) - -125  - t__U64_TYPE -  - - ) - -127  - t__STD_TYPE -  - - ) - -131  - ~ - -134 -__STD_TYPE - - t__DEV_T_TYPE - - t__dev_t -; - -135 -__STD_TYPE - -__UID_T_TYPE - - g__uid_t -; - -136 -__STD_TYPE - -__GID_T_TYPE - - g__gid_t -; - -137 -__STD_TYPE - -__INO_T_TYPE - - g__šo_t -; - -138 -__STD_TYPE - -__INO64_T_TYPE - - g__šo64_t -; - -139 -__STD_TYPE - -__MODE_T_TYPE - - g__mode_t -; - -140 -__STD_TYPE - -__NLINK_T_TYPE - - g__Æšk_t -; - -141 -__STD_TYPE - -__OFF_T_TYPE - - g__off_t -; - -142 -__STD_TYPE - -__OFF64_T_TYPE - - g__off64_t -; - -143 -__STD_TYPE - -__PID_T_TYPE - - g__pid_t -; - -144 -__STD_TYPE - -__FSID_T_TYPE - - g__fsid_t -; - -145 -__STD_TYPE - -__CLOCK_T_TYPE - - g__þock_t -; - -146 -__STD_TYPE - -__RLIM_T_TYPE - - g__¾im_t -; - -147 -__STD_TYPE - -__RLIM64_T_TYPE - - g__¾im64_t -; - -148 -__STD_TYPE - -__ID_T_TYPE - - g__id_t -; - -149 -__STD_TYPE - -__TIME_T_TYPE - - g__time_t -; - -150 -__STD_TYPE - -__USECONDS_T_TYPE - - g__u£cÚds_t -; - -151 -__STD_TYPE - -__SUSECONDS_T_TYPE - - g__su£cÚds_t -; - -153 -__STD_TYPE - -__DADDR_T_TYPE - - g__daddr_t -; - -154 -__STD_TYPE - -__SWBLK_T_TYPE - - g__swblk_t -; - -155 -__STD_TYPE - -__KEY_T_TYPE - - g__key_t -; - -158 -__STD_TYPE - -__CLOCKID_T_TYPE - - g__þockid_t -; - -161 -__STD_TYPE - -__TIMER_T_TYPE - - g__tim”_t -; - -164 -__STD_TYPE - -__BLKSIZE_T_TYPE - - g__blksize_t -; - -169 -__STD_TYPE - -__BLKCNT_T_TYPE - - g__blkút_t -; - -170 -__STD_TYPE - -__BLKCNT64_T_TYPE - - g__blkút64_t -; - -173 -__STD_TYPE - -__FSBLKCNT_T_TYPE - - g__fsblkút_t -; - -174 -__STD_TYPE - -__FSBLKCNT64_T_TYPE - - g__fsblkút64_t -; - -177 -__STD_TYPE - -__FSFILCNT_T_TYPE - - g__fsfžút_t -; - -178 -__STD_TYPE - -__FSFILCNT64_T_TYPE - - g__fsfžút64_t -; - -180 -__STD_TYPE - -__SSIZE_T_TYPE - - g__ssize_t -; - -184  -__off64_t - - t__loff_t -; - -185  -__quad_t - * - t__qaddr_t -; - -186 * - t__ÿddr_t -; - -189 -__STD_TYPE - -__SWORD_TYPE - - g__šŒ_t -; - -192 -__STD_TYPE - -__U32_TYPE - - g__sockËn_t -; - -195 #undeà -__STD_TYPE - - - @/usr/include/features.h - -19 #iâdef -_FEATURES_H - - -20  - #_FEATURES_H - 1 - - ) - -95 #undeà -__USE_ISOC99 - - -96 #undeà -__USE_ISOC95 - - -97 #undeà -__USE_POSIX - - -98 #undeà -__USE_POSIX2 - - -99 #undeà -__USE_POSIX199309 - - -100 #undeà -__USE_POSIX199506 - - -101 #undeà -__USE_XOPEN - - -102 #undeà -__USE_XOPEN_EXTENDED - - -103 #undeà -__USE_UNIX98 - - -104 #undeà -__USE_XOPEN2K - - -105 #undeà -__USE_XOPEN2K8 - - -106 #undeà -__USE_LARGEFILE - - -107 #undeà -__USE_LARGEFILE64 - - -108 #undeà -__USE_FILE_OFFSET64 - - -109 #undeà -__USE_BSD - - -110 #undeà -__USE_SVID - - -111 #undeà -__USE_MISC - - -112 #undeà -__USE_ATFILE - - -113 #undeà -__USE_GNU - - -114 #undeà -__USE_REENTRANT - - -115 #undeà -__USE_FORTIFY_LEVEL - - -116 #undeà -__FAVOR_BSD - - -117 #undeà -__KERNEL_STRICT_NAMES - - -121 #iâdeà -_LOOSE_KERNEL_NAMES - - -122  - #__KERNEL_STRICT_NAMES - - - ) - -126  - #__USE_ANSI - 1 - - ) - -135 #ià -defšed - -__GNUC__ - && defšed -__GNUC_MINOR__ - - -136  - #__GNUC_PREREQ -( -maj -, -mš -) \ - -137 (( -__GNUC__ - << 16è+ -__GNUC_MINOR__ - >ð(( -maj -è<< 16è+ ( -mš -)) - - ) - -139  - #__GNUC_PREREQ -( -maj -, -mš -è0 - - ) - -144 #ià -defšed - -_BSD_SOURCE - && \ - -145 !( -defšed - - g_POSIX_SOURCE - || defšed - g_POSIX_C_SOURCE - || \ - -146 -defšed - - g_XOPEN_SOURCE - || defšed - g_XOPEN_SOURCE_EXTENDED - || \ - -147 -defšed - - g_GNU_SOURCE - || defšed - g_SVID_SOURCE -) - -148  - #__FAVOR_BSD - 1 - - ) - -152 #ifdeà -_GNU_SOURCE - - -153 #undeà -_ISOC99_SOURCE - - -154  - #_ISOC99_SOURCE - 1 - - ) - -155 #undeà -_POSIX_SOURCE - - -156  - #_POSIX_SOURCE - 1 - - ) - -157 #undeà -_POSIX_C_SOURCE - - -158  - #_POSIX_C_SOURCE - 200809L - - ) - -159 #undeà -_XOPEN_SOURCE - - -160  - #_XOPEN_SOURCE - 700 - - ) - -161 #undeà -_XOPEN_SOURCE_EXTENDED - - -162  - #_XOPEN_SOURCE_EXTENDED - 1 - - ) - -163 #undeà -_LARGEFILE64_SOURCE - - -164  - #_LARGEFILE64_SOURCE - 1 - - ) - -165 #undeà -_BSD_SOURCE - - -166  - #_BSD_SOURCE - 1 - - ) - -167 #undeà -_SVID_SOURCE - - -168  - #_SVID_SOURCE - 1 - - ) - -169 #undeà -_ATFILE_SOURCE - - -170  - #_ATFILE_SOURCE - 1 - - ) - -175 #ià(! -defšed - -__STRICT_ANSI__ - && !defšed -_ISOC99_SOURCE - && \ - -176 ! -defšed - - g_POSIX_SOURCE - && !defšed - g_POSIX_C_SOURCE - && \ - -177 ! -defšed - - g_XOPEN_SOURCE - && !defšed - g_XOPEN_SOURCE_EXTENDED - && \ - -178 ! -defšed - - g_BSD_SOURCE - && !defšed - g_SVID_SOURCE -) - -179  - #_BSD_SOURCE - 1 - - ) - -180  - #_SVID_SOURCE - 1 - - ) - -187 #ià( -defšed - -_ISOC99_SOURCE - || defšed -_ISOC9X_SOURCE - \ - -188 || ( -defšed - - g__STDC_VERSION__ - && __STDC_VERSION__ >= 199901L)) - -189  - #__USE_ISOC99 - 1 - - ) - -193 #ià( -defšed - -_ISOC99_SOURCE - || defšed -_ISOC9X_SOURCE - \ - -194 || ( -defšed - -__STDC_VERSION__ - && __STDC_VERSION__ >= 199409L)) - -195  - #__USE_ISOC95 - 1 - - ) - -200 #ià((! -defšed - -__STRICT_ANSI__ - || ( -_XOPEN_SOURCE - - 0) >= 500) && \ - -201 ! -defšed - -_POSIX_SOURCE - && !defšed -_POSIX_C_SOURCE -) - -202  - #_POSIX_SOURCE - 1 - - ) - -203 #ià -defšed - -_XOPEN_SOURCE - && (_XOPEN_SOURCE - 0) < 500 - -204  - #_POSIX_C_SOURCE - 2 - - ) - -205 #–ià -defšed - -_XOPEN_SOURCE - && (_XOPEN_SOURCE - 0) < 600 - -206  - #_POSIX_C_SOURCE - 199506L - - ) - -207 #–ià -defšed - -_XOPEN_SOURCE - && (_XOPEN_SOURCE - 0) < 700 - -208  - #_POSIX_C_SOURCE - 200112L - - ) - -210  - #_POSIX_C_SOURCE - 200809L - - ) - -212  - #__USE_POSIX_IMPLICITLY - 1 - - ) - -215 #ià -defšed - -_POSIX_SOURCE - || -_POSIX_C_SOURCE - >ð1 || defšed -_XOPEN_SOURCE - - -216  - #__USE_POSIX - 1 - - ) - -219 #ià -defšed - -_POSIX_C_SOURCE - && _POSIX_C_SOURCE >ð2 || defšed -_XOPEN_SOURCE - - -220  - #__USE_POSIX2 - 1 - - ) - -223 #ià( -_POSIX_C_SOURCE - - 0) >= 199309L - -224  - #__USE_POSIX199309 - 1 - - ) - -227 #ià( -_POSIX_C_SOURCE - - 0) >= 199506L - -228  - #__USE_POSIX199506 - 1 - - ) - -231 #ià( -_POSIX_C_SOURCE - - 0) >= 200112L - -232  - #__USE_XOPEN2K - 1 - - ) - -233 #undeà -__USE_ISOC99 - - -234  - #__USE_ISOC99 - 1 - - ) - -237 #ià( -_POSIX_C_SOURCE - - 0) >= 200809L - -238  - #__USE_XOPEN2K8 - 1 - - ) - -239 #undeà -_ATFILE_SOURCE - - -240  - #_ATFILE_SOURCE - 1 - - ) - -243 #ifdef -_XOPEN_SOURCE - - -244  - #__USE_XOPEN - 1 - - ) - -245 #ià( -_XOPEN_SOURCE - - 0) >= 500 - -246  - #__USE_XOPEN_EXTENDED - 1 - - ) - -247  - #__USE_UNIX98 - 1 - - ) - -248 #undeà -_LARGEFILE_SOURCE - - -249  - #_LARGEFILE_SOURCE - 1 - - ) - -250 #ià( -_XOPEN_SOURCE - - 0) >= 600 - -251 #ià( -_XOPEN_SOURCE - - 0) >= 700 - -252  - #__USE_XOPEN2K8 - 1 - - ) - -254  - #__USE_XOPEN2K - 1 - - ) - -255 #undeà -__USE_ISOC99 - - -256  - #__USE_ISOC99 - 1 - - ) - -259 #ifdeà -_XOPEN_SOURCE_EXTENDED - - -260  - #__USE_XOPEN_EXTENDED - 1 - - ) - -265 #ifdeà -_LARGEFILE_SOURCE - - -266  - #__USE_LARGEFILE - 1 - - ) - -269 #ifdeà -_LARGEFILE64_SOURCE - - -270  - #__USE_LARGEFILE64 - 1 - - ) - -273 #ià -defšed - -_FILE_OFFSET_BITS - && _FILE_OFFSET_BITS == 64 - -274  - #__USE_FILE_OFFSET64 - 1 - - ) - -277 #ià -defšed - -_BSD_SOURCE - || defšed -_SVID_SOURCE - - -278  - #__USE_MISC - 1 - - ) - -281 #ifdef -_BSD_SOURCE - - -282  - #__USE_BSD - 1 - - ) - -285 #ifdef -_SVID_SOURCE - - -286  - #__USE_SVID - 1 - - ) - -289 #ifdef -_ATFILE_SOURCE - - -290  - #__USE_ATFILE - 1 - - ) - -293 #ifdef -_GNU_SOURCE - - -294  - #__USE_GNU - 1 - - ) - -297 #ià -defšed - -_REENTRANT - || defšed -_THREAD_SAFE - - -298  - #__USE_REENTRANT - 1 - - ) - -301 #ià -defšed - -_FORTIFY_SOURCE - && _FORTIFY_SOURCE > 0 \ - -302 && -__GNUC_PREREQ - (4, 1è&& -defšed - - g__OPTIMIZE__ - && __OPTIMIZE__ > 0 - -303 #ià -_FORTIFY_SOURCE - > 1 - -304  - #__USE_FORTIFY_LEVEL - 2 - - ) - -306  - #__USE_FORTIFY_LEVEL - 1 - - ) - -309  - #__USE_FORTIFY_LEVEL - 0 - - ) - -313  - ~ - -316  - #__STDC_ISO_10646__ - 200009L - - ) - -324 #undeà -__GNU_LIBRARY__ - - -325  - #__GNU_LIBRARY__ - 6 - - ) - -329  - #__GLIBC__ - 2 - - ) - -330  - #__GLIBC_MINOR__ - 11 - - ) - -332  - #__GLIBC_PREREQ -( -maj -, -mš -) \ - -333 (( -__GLIBC__ - << 16è+ -__GLIBC_MINOR__ - >ð(( -maj -è<< 16è+ ( -mš -)) - - ) - -336 #ià -defšed - -__GNUC__ - \ - -337 || ( -defšed - - g__PGI - && defšed - g__i386__ - ) \ - -338 || ( -defšed - - g__INTEL_COMPILER - && (defšed - g__i386__ - || defšed - g__Ÿ64__ -)) \ - -339 || ( -defšed - - g__STDC_VERSION__ - && __STDC_VERSION__ >= 199901L) - -340  - #__GLIBC_HAVE_LONG_LONG - 1 - - ) - -344 #iâdeà -__ASSEMBLER__ - - -345 #iâdeà -_SYS_CDEFS_H - - -346  - ~ - -351 #ià -defšed - -__USE_FILE_OFFSET64 - && !defšed -__REDIRECT - - -352  - #__USE_LARGEFILE - 1 - - ) - -353  - #__USE_LARGEFILE64 - 1 - - ) - -359 #ià -__GNUC_PREREQ - (2, 7è&& -defšed - -__OPTIMIZE__ - \ - -360 && ! -defšed - - g__OPTIMIZE_SIZE__ - && !defšed - g__NO_INLINE__ - \ - -361 && -defšed - - g__ex‹º_šlše - - -362  - #__USE_EXTERN_INLINES - 1 - - ) - -367 #ià -__GNUC_PREREQ - (2, 7è&& -defšed - -__OPTIMIZE__ - \ - -368 && ( -defšed - - g_LIBC - || !defšed - g__OPTIMIZE_SIZE__ -è&& !defšed - g__NO_INLINE__ - \ - -369 && -defšed - - g__ex‹º_šlše - - -370  - #__USE_EXTERN_INLINES_IN_LIBC - 1 - - ) - -378  - ~ - - @/usr/include/getopt.h - -21 #iâdeà -_GETOPT_H - - -23 #iâdeà -__Ãed_g‘Ýt - - -24  - #_GETOPT_H - 1 - - ) - -34 #ià! -defšed - -__GNU_LIBRARY__ - - -35  - ~<ùy³.h -> - -38 #iâdeà -__THROW - - -39 #iâdeà -__GNUC_PREREQ - - -40  - #__GNUC_PREREQ -( -maj -, -mš -è(0) - - ) - -42 #ià -defšed - -__ýlu¥lus - && -__GNUC_PREREQ - (2,8) - -43  - #__THROW - - `throw - () - - ) - -45  - #__THROW - - - ) - -49 #ifdef -__ýlu¥lus - - -59 * -Ýrg -; - -73  -Ýtšd -; - -78  -Ý‹¼ -; - -82  -ÝtÝt -; - -84 #iâdeà -__Ãed_g‘Ýt - - -106  - sÝtiÚ - - -108 cÚ¡ * - gÇme -; - -111  - ghas_¬g -; - -112 * - gæag -; - -113  - gv® -; - -118  - #no_¬gum’t - 0 - - ) - -119  - #»quœed_¬gum’t - 1 - - ) - -120  - #ÝtiÚ®_¬gum’t - 2 - - ) - -148 #ifdeà -__GNU_LIBRARY__ - - -152  -g‘Ýt - ( -___¬gc -, *cÚ¡ * -___¬gv -, cÚ¡ * -__shÜtÝts -) - -153 -__THROW -; - -155 #ià -defšed - -__Ãed_g‘Ýt - && defšed -__USE_POSIX2 - \ - -156 && ! -defšed - - g__USE_POSIX_IMPLICITLY - && !defšed - g__USE_GNU - - -160 #ifdeà -__REDIRECT - - -161  -__REDIRECT - ( -g‘Ýt -, ( -___¬gc -, *cÚ¡ * -___¬gv -, - -162 cÚ¡ * -__shÜtÝts -), - -163 -__posix_g‘Ýt -è -__THROW -; - -165  -__posix_g‘Ýt - ( -___¬gc -, *cÚ¡ * -___¬gv -, - -166 cÚ¡ * -__shÜtÝts -è -__THROW -; - -167  - #g‘Ýt - -__posix_g‘Ýt - - - ) - -171  -g‘Ýt - (); - -174 #iâdeà -__Ãed_g‘Ýt - - -175  -g‘Ýt_lÚg - ( -___¬gc -, *cÚ¡ * -___¬gv -, - -176 cÚ¡ * -__shÜtÝts -, - -177 cÚ¡  -ÝtiÚ - * -__lÚgÝts -, * -__lÚgšd -) - -178 -__THROW -; - -179  -g‘Ýt_lÚg_Úly - ( -___¬gc -, *cÚ¡ * -___¬gv -, - -180 cÚ¡ * -__shÜtÝts -, - -181 cÚ¡  -ÝtiÚ - * -__lÚgÝts -, * -__lÚgšd -) - -182 -__THROW -; - -186 #ifdef -__ýlu¥lus - - -191 #undeà -__Ãed_g‘Ýt - - - @/usr/include/libio.h - -29 #iâdeà -_IO_STDIO_H - - -30  - #_IO_STDIO_H - - - ) - -32  - ~<_G_cÚfig.h -> - -34  - #_IO_pos_t - -_G_åos_t - - - ) - -35  - #_IO_åos_t - -_G_åos_t - - - ) - -36  - #_IO_åos64_t - -_G_åos64_t - - - ) - -37  - #_IO_size_t - -_G_size_t - - - ) - -38  - #_IO_ssize_t - -_G_ssize_t - - - ) - -39  - #_IO_off_t - -_G_off_t - - - ) - -40  - #_IO_off64_t - -_G_off64_t - - - ) - -41  - #_IO_pid_t - -_G_pid_t - - - ) - -42  - #_IO_uid_t - -_G_uid_t - - - ) - -43  - #_IO_icÚv_t - -_G_icÚv_t - - - ) - -44  - #_IO_HAVE_SYS_WAIT - -_G_HAVE_SYS_WAIT - - - ) - -45  - #_IO_HAVE_ST_BLKSIZE - -_G_HAVE_ST_BLKSIZE - - - ) - -46  - #_IO_BUFSIZ - -_G_BUFSIZ - - - ) - -47  - #_IO_va_li¡ - -_G_va_li¡ - - - ) - -48  - #_IO_wšt_t - -_G_wšt_t - - - ) - -50 #ifdeà -_G_NEED_STDARG_H - - -52  - #__Ãed___va_li¡ - - - ) - -53  - ~<¡d¬g.h -> - -54 #ifdeà -__GNUC_VA_LIST - - -55 #undeà -_IO_va_li¡ - - -56  - #_IO_va_li¡ - -__gnuc_va_li¡ - - - ) - -60 #iâdeà -__P - - -61 #ià -_G_HAVE_SYS_CDEFS - - -62  - ~ - -64 #ifdeà -__STDC__ - - -65  - #__P -( -p -è - ) -p - -66  - #__PMT -( -p -è - ) -p - -68  - #__P -( -p -è() - - ) - -69  - #__PMT -( -p -è() - - ) - -75 #iâdeà -_PARAMS - - -76  - #_PARAMS -( -´Ùos -è - `__P -ÕrÙos) - - ) - -79 #iâdeà -__STDC__ - - -81 cÚ¡ - - ) - -84  - #_IO_UNIFIED_JUMPTABLES - 1 - - ) - -85 #iâdeà -_G_HAVE_PRINTF_FP - - -86  - #_IO_USE_DTOA - 1 - - ) - -89 #iâdeà -EOF - - -90  - #EOF - (-1) - - ) - -92 #iâdeà -NULL - - -93 #ià -defšed - -__GNUG__ - && \ - -94 ( - g__GNUC__ - > 2 || (__GNUC__ =ð2 && -__GNUC_MINOR__ - >= 8)) - -95  - #NULL - ( -__nuÎ -) - - ) - -97 #ià! -defšed -( -__ýlu¥lus -) - -98  - #NULL - ((*)0) - - ) - -100  - #NULL - (0) - - ) - -105  - #_IOS_INPUT - 1 - - ) - -106  - #_IOS_OUTPUT - 2 - - ) - -107  - #_IOS_ATEND - 4 - - ) - -108  - #_IOS_APPEND - 8 - - ) - -109  - #_IOS_TRUNC - 16 - - ) - -110  - #_IOS_NOCREATE - 32 - - ) - -111  - #_IOS_NOREPLACE - 64 - - ) - -112  - #_IOS_BIN - 128 - - ) - -120  - #_IO_MAGIC - 0xFBAD0000 - - ) - -121  - #_OLD_STDIO_MAGIC - 0xFABC0000 - - ) - -122  - #_IO_MAGIC_MASK - 0xFFFF0000 - - ) - -123  - #_IO_USER_BUF - 1 - - ) - -124  - #_IO_UNBUFFERED - 2 - - ) - -125  - #_IO_NO_READS - 4 - - ) - -126  - #_IO_NO_WRITES - 8 - - ) - -127  - #_IO_EOF_SEEN - 0x10 - - ) - -128  - #_IO_ERR_SEEN - 0x20 - - ) - -129  - #_IO_DELETE_DONT_CLOSE - 0x40 - - ) - -130  - #_IO_LINKED - 0x80 - - ) - -131  - #_IO_IN_BACKUP - 0x100 - - ) - -132  - #_IO_LINE_BUF - 0x200 - - ) - -133  - #_IO_TIED_PUT_GET - 0x400 - - ) - -134  - #_IO_CURRENTLY_PUTTING - 0x800 - - ) - -135  - #_IO_IS_APPENDING - 0x1000 - - ) - -136  - #_IO_IS_FILEBUF - 0x2000 - - ) - -137  - #_IO_BAD_SEEN - 0x4000 - - ) - -138  - #_IO_USER_LOCK - 0x8000 - - ) - -140  - #_IO_FLAGS2_MMAP - 1 - - ) - -141  - #_IO_FLAGS2_NOTCANCEL - 2 - - ) - -142 #ifdeà -_LIBC - - -143  - #_IO_FLAGS2_FORTIFY - 4 - - ) - -145  - #_IO_FLAGS2_USER_WBUF - 8 - - ) - -146 #ifdeà -_LIBC - - -147  - #_IO_FLAGS2_SCANF_STD - 16 - - ) - -151  - #_IO_SKIPWS - 01 - - ) - -152  - #_IO_LEFT - 02 - - ) - -153  - #_IO_RIGHT - 04 - - ) - -154  - #_IO_INTERNAL - 010 - - ) - -155  - #_IO_DEC - 020 - - ) - -156  - #_IO_OCT - 040 - - ) - -157  - #_IO_HEX - 0100 - - ) - -158  - #_IO_SHOWBASE - 0200 - - ) - -159  - #_IO_SHOWPOINT - 0400 - - ) - -160  - #_IO_UPPERCASE - 01000 - - ) - -161  - #_IO_SHOWPOS - 02000 - - ) - -162  - #_IO_SCIENTIFIC - 04000 - - ) - -163  - #_IO_FIXED - 010000 - - ) - -164  - #_IO_UNITBUF - 020000 - - ) - -165  - #_IO_STDIO - 040000 - - ) - -166  - #_IO_DONT_CLOSE - 0100000 - - ) - -167  - #_IO_BOOLALPHA - 0200000 - - ) - -170  -_IO_jump_t -;  - g_IO_FILE -; - -173 #ifdeà -_IO_MTSAFE_IO - - -174 #ià -defšed - -__GLIBC__ - && __GLIBC__ >= 2 - -175  - ~ - -180  - t_IO_lock_t -; - -186  - s_IO_m¬k” - { - -187  -_IO_m¬k” - * - m_Ãxt -; - -188  -_IO_FILE - * - m_sbuf -; - -192  - m_pos -; - -194  -£t_¡»ampos -( -¡»ampos - -¥ -è{ - m_¥os - = sp; } - -195  -£t_off£t -( -off£t -è{ - m_pos - = off£t; - m_¥os - = ( -¡»ampos -)(-2); } - -196 - mpublic -: - -197 -¡»amm¬k” -( -¡»ambuf - * -sb -); - -198 ~ -¡»amm¬k” -(); - -199  -§všg -(è{  - m_¥os - == -2; } - -200  -d– -( -¡»amm¬k” -&); - -201  -d– -(); - -206 - e__codecvt_»suÉ - - -208 - m__codecvt_ok -, - -209 - m__codecvt_·¹Ÿl -, - -210 - m__codecvt_”rÜ -, - -211 - m__codecvt_nocÚv - - -214 #ià -defšed - -_LIBC - || defšed -_GLIBCPP_USE_WCHAR_T - - -217  - s_IO_codecvt - - -219 (* - m__codecvt_de¡r -è( - m_IO_codecvt - *); - -220 -__codecvt_»suÉ - (* -__codecvt_do_out -è( - m_IO_codecvt - *, - -221 - m__mb¡©e_t - *, - -222 cÚ¡ - mwch¬_t - *, - -223 cÚ¡ - mwch¬_t - *, - -224 cÚ¡ - mwch¬_t - **, *, - -226 -__codecvt_»suÉ - (* -__codecvt_do_unshiá -è( - m_IO_codecvt - *, - -227 - m__mb¡©e_t - *, *, - -229 -__codecvt_»suÉ - (* -__codecvt_do_š -è( - m_IO_codecvt - *, - -230 - m__mb¡©e_t - *, - -232 cÚ¡ **, - mwch¬_t - *, - -233 - mwch¬_t - *, wchar_t **); - -234 (* - m__codecvt_do_’codšg -è( - m_IO_codecvt - *); - -235 (* - m__codecvt_do_®ways_nocÚv -è( - m_IO_codecvt - *); - -236 (* - m__codecvt_do_Ëngth -è( - m_IO_codecvt - *, - m__mb¡©e_t - *, - -237 cÚ¡ *, cÚ¡ *, - m_IO_size_t -); - -238 (* - m__codecvt_do_max_Ëngth -è( - m_IO_codecvt - *); - -240 -_IO_icÚv_t - - m__cd_š -; - -241 -_IO_icÚv_t - - m__cd_out -; - -245  - s_IO_wide_d©a - - -247 -wch¬_t - * - m_IO_»ad_±r -; - -248 -wch¬_t - * - m_IO_»ad_’d -; - -249 -wch¬_t - * - m_IO_»ad_ba£ -; - -250 -wch¬_t - * - m_IO_wr™e_ba£ -; - -251 -wch¬_t - * - m_IO_wr™e_±r -; - -252 -wch¬_t - * - m_IO_wr™e_’d -; - -253 -wch¬_t - * - m_IO_buf_ba£ -; - -254 -wch¬_t - * - m_IO_buf_’d -; - -256 -wch¬_t - * - m_IO_§ve_ba£ -; - -257 -wch¬_t - * - m_IO_backup_ba£ -; - -259 -wch¬_t - * - m_IO_§ve_’d -; - -261 -__mb¡©e_t - - m_IO_¡©e -; - -262 -__mb¡©e_t - - m_IO_Ï¡_¡©e -; - -263  -_IO_codecvt - - m_codecvt -; - -265 -wch¬_t - - m_shÜtbuf -[1]; - -267 cÚ¡  -_IO_jump_t - * - m_wide_vbË -; - -271  - s_IO_FILE - { - -272  - m_æags -; - -273  - #_IO_fže_æags - -_æags - - - ) - -277 * - m_IO_»ad_±r -; - -278 * - m_IO_»ad_’d -; - -279 * - m_IO_»ad_ba£ -; - -280 * - m_IO_wr™e_ba£ -; - -281 * - m_IO_wr™e_±r -; - -282 * - m_IO_wr™e_’d -; - -283 * - m_IO_buf_ba£ -; - -284 * - m_IO_buf_’d -; - -286 * - m_IO_§ve_ba£ -; - -287 * - m_IO_backup_ba£ -; - -288 * - m_IO_§ve_’d -; - -290  -_IO_m¬k” - * - m_m¬k”s -; - -292  -_IO_FILE - * - m_chaš -; - -294  - m_fž’o -; - -296  - m_blksize -; - -298  - m_æags2 -; - -300 -_IO_off_t - - m_Þd_off£t -; - -302  - #__HAVE_COLUMN - - - ) - -304  - m_cur_cÞumn -; - -305 sigÃd  - m_vbË_off£t -; - -306  - m_shÜtbuf -[1]; - -310 -_IO_lock_t - * - m_lock -; - -311 #ifdeà -_IO_USE_OLD_IO_FILE - - -314  - s_IO_FILE_com¶‘e - - -316  -_IO_FILE - - m_fže -; - -318 #ià -defšed - -_G_IO_IO_FILE_VERSION - && _G_IO_IO_FILE_VERSION == 0x20001 - -319 -_IO_off64_t - - m_off£t -; - -320 #ià -defšed - -_LIBC - || defšed -_GLIBCPP_USE_WCHAR_T - - -322  -_IO_codecvt - * - m_codecvt -; - -323  -_IO_wide_d©a - * - m_wide_d©a -; - -324  -_IO_FILE - * - m_ä“»s_li¡ -; - -325 * - m_ä“»s_buf -; - -326 -size_t - - m_ä“»s_size -; - -328 * - m__·d1 -; - -329 * - m__·d2 -; - -330 * - m__·d3 -; - -331 * - m__·d4 -; - -332 -size_t - - m__·d5 -; - -334  - m_mode -; - -336  - m_unu£d2 -[15 *  (è- 4 *  (*è-  ( -size_t -)]; - -340 #iâdeà -__ýlu¥lus - - -341  -_IO_FILE - - t_IO_FILE -; - -344  - g_IO_FILE_¶us -; - -346  -_IO_FILE_¶us - -_IO_2_1_¡dš_ -; - -347  -_IO_FILE_¶us - -_IO_2_1_¡dout_ -; - -348  -_IO_FILE_¶us - -_IO_2_1_¡d”r_ -; - -349 #iâdeà -_LIBC - - -350  - #_IO_¡dš - (( -_IO_FILE -*)(& -_IO_2_1_¡dš_ -)) - - ) - -351  - #_IO_¡dout - (( -_IO_FILE -*)(& -_IO_2_1_¡dout_ -)) - - ) - -352  - #_IO_¡d”r - (( -_IO_FILE -*)(& -_IO_2_1_¡d”r_ -)) - - ) - -354 -_IO_FILE - * -_IO_¡dš - -©Œibu‹_hidd’ -; - -355 -_IO_FILE - * -_IO_¡dout - -©Œibu‹_hidd’ -; - -356 -_IO_FILE - * -_IO_¡d”r - -©Œibu‹_hidd’ -; - -364  -__ssize_t - - t__io_»ad_â - (* - t__cook› -, * - t__buf -, - tsize_t - - t__nby‹s -); - -372  -__ssize_t - - t__io_wr™e_â - (* - t__cook› -, - t__cÚ¡ - * - t__buf -, - -373 - tsize_t - - t__n -); - -381  - t__io_£ek_â - (* - t__cook› -, - t_IO_off64_t - * - t__pos -,  - t__w -); - -384  - t__io_þo£_â - (* - t__cook› -); - -387 #ifdeà -_GNU_SOURCE - - -389  -__io_»ad_â - - tcook›_»ad_funùiÚ_t -; - -390  -__io_wr™e_â - - tcook›_wr™e_funùiÚ_t -; - -391  -__io_£ek_â - - tcook›_£ek_funùiÚ_t -; - -392  -__io_þo£_â - - tcook›_þo£_funùiÚ_t -; - -397 -__io_»ad_â - * - m»ad -; - -398 -__io_wr™e_â - * - mwr™e -; - -399 -__io_£ek_â - * - m£ek -; - -400 -__io_þo£_â - * - mþo£ -; - -401 } - t_IO_cook›_io_funùiÚs_t -; - -402  -_IO_cook›_io_funùiÚs_t - - tcook›_io_funùiÚs_t -; - -404  - g_IO_cook›_fže -; - -407  -_IO_cook›_š™ - ( -_IO_cook›_fže - * -__cfže -,  -__»ad_wr™e -, - -408 * -__cook› -, -_IO_cook›_io_funùiÚs_t - -__âs -); - -412 #ifdeà -__ýlu¥lus - - -416  -__und”æow - ( -_IO_FILE - *); - -417  -__uæow - ( -_IO_FILE - *); - -418  -__ov”æow - ( -_IO_FILE - *, ); - -419 #ià -defšed - -_LIBC - || defšed -_GLIBCPP_USE_WCHAR_T - - -420 -_IO_wšt_t - -__wund”æow - ( -_IO_FILE - *); - -421 -_IO_wšt_t - -__wuæow - ( -_IO_FILE - *); - -422 -_IO_wšt_t - -__wov”æow - ( -_IO_FILE - *, _IO_wint_t); - -425 #ià -__GNUC__ - >= 3 - -426  - #_IO_BE -( -ex´ -, -»s -è - `__bužtš_ex³ù - (Óx´),„es) - - ) - -428  - #_IO_BE -( -ex´ -, -»s -èÓx´) - - ) - -431  - #_IO_g‘c_uÆocked -( -_å -) \ - -432 ( - `_IO_BE - (( -_å -)-> -_IO_»ad_±r - >ð(_å)-> -_IO_»ad_’d -, 0) \ - -433 ? - `__uæow - ( -_å -è: *(*è(_å)-> -_IO_»ad_±r -++) - - ) - -434  - #_IO_³ekc_uÆocked -( -_å -) \ - -435 ( - `_IO_BE - (( -_å -)-> -_IO_»ad_±r - >ð(_å)-> -_IO_»ad_’d -, 0) \ - -436 && - `__und”æow - ( -_å -è=ð -EOF - ? EOF \ - -437 : *(*è( -_å -)-> -_IO_»ad_±r -) - - ) - -438  - #_IO_putc_uÆocked -( -_ch -, -_å -) \ - -439 ( - `_IO_BE - (( -_å -)-> -_IO_wr™e_±r - >ð(_å)-> -_IO_wr™e_’d -, 0) \ - -440 ? - `__ov”æow - ( -_å -, (è( -_ch -)) \ - -441 : (è(*( -_å -)-> -_IO_wr™e_±r -++ = ( -_ch -))) - - ) - -443 #ià -defšed - -_LIBC - || defšed -_GLIBCPP_USE_WCHAR_T - - -444  - #_IO_g‘wc_uÆocked -( -_å -) \ - -445 ( - `_IO_BE - (( -_å -)-> -_wide_d©a - =ð -NULL - \ - -446 || (( -_å -)-> -_wide_d©a --> -_IO_»ad_±r - \ - -447 >ð( -_å -)-> -_wide_d©a --> -_IO_»ad_’d -), 0) \ - -448 ? - `__wuæow - ( -_å -è: ( -_IO_wšt_t -è*(_å)-> -_wide_d©a --> -_IO_»ad_±r -++) - - ) - -449  - #_IO_putwc_uÆocked -( -_wch -, -_å -) \ - -450 ( - `_IO_BE - (( -_å -)-> -_wide_d©a - =ð -NULL - \ - -451 || (( -_å -)-> -_wide_d©a --> -_IO_wr™e_±r - \ - -452 >ð( -_å -)-> -_wide_d©a --> -_IO_wr™e_’d -), 0) \ - -453 ? - `__wov”æow - ( -_å -, -_wch -) \ - -454 : ( -_IO_wšt_t -è(*( -_å -)-> -_wide_d©a --> -_IO_wr™e_±r -++ = ( -_wch -))) - - ) - -457  - #_IO_ãof_uÆocked -( -__å -è(((__å)-> -_æags - & -_IO_EOF_SEEN -è!ð0) - - ) - -458  - #_IO_ã¼Ü_uÆocked -( -__å -è(((__å)-> -_æags - & -_IO_ERR_SEEN -è!ð0) - - ) - -460  -_IO_g‘c - ( -_IO_FILE - * -__å -); - -461  -_IO_putc - ( -__c -, -_IO_FILE - * -__å -); - -462  -_IO_ãof - ( -_IO_FILE - * -__å -è -__THROW -; - -463  -_IO_ã¼Ü - ( -_IO_FILE - * -__å -è -__THROW -; - -465  -_IO_³ekc_locked - ( -_IO_FILE - * -__å -); - -468  - #_IO_PENDING_OUTPUT_COUNT -( -_å -) \ - -469 (( -_å -)-> -_IO_wr™e_±r - - (_å)-> -_IO_wr™e_ba£ -) - - ) - -471  -_IO_æockfže - ( -_IO_FILE - *è -__THROW -; - -472  -_IO_fuÆockfže - ( -_IO_FILE - *è -__THROW -; - -473  -_IO_árylockfže - ( -_IO_FILE - *è -__THROW -; - -475 #ifdeà -_IO_MTSAFE_IO - - -476  - #_IO_³ekc -( -_å -è - `_IO_³ekc_locked - (_å) - - ) - -477  - #_IO_æockfže -( -_å -) \ - -478 ià((( -_å -)-> -_æags - & -_IO_USER_LOCK -è=ð0è - `_IO_æockfže - (_å) - - ) - -479  - #_IO_fuÆockfže -( -_å -) \ - -480 ià((( -_å -)-> -_æags - & -_IO_USER_LOCK -è=ð0è - `_IO_fuÆockfže - (_å) - - ) - -482  - #_IO_³ekc -( -_å -è - `_IO_³ekc_uÆocked - (_å) - - ) - -483  - #_IO_æockfže -( -_å -è - - ) - -484  - #_IO_fuÆockfže -( -_å -è - - ) - -485  - #_IO_árylockfže -( -_å -è - - ) - -486  - #_IO_þ—nup_»giÚ_¡¬t -( -_fù -, -_å -è - - ) - -487  - #_IO_þ—nup_»giÚ_’d -( -_Do™ -è - - ) - -490  -_IO_vfsÿnf - ( -_IO_FILE - * -__»¡riù -, const * __restrict, - -491 -_IO_va_li¡ -, * -__»¡riù -); - -492  -_IO_vårštf - ( -_IO_FILE - * -__»¡riù -, const *__restrict, - -493 -_IO_va_li¡ -); - -494 -_IO_ssize_t - -_IO_·dn - ( -_IO_FILE - *, , _IO_ssize_t); - -495 -_IO_size_t - -_IO_sg‘n - ( -_IO_FILE - *, *, _IO_size_t); - -497 -_IO_off64_t - -_IO_£ekoff - ( -_IO_FILE - *, _IO_off64_t, , ); - -498 -_IO_off64_t - -_IO_£ekpos - ( -_IO_FILE - *, _IO_off64_t, ); - -500  -_IO_ä“_backup_¬— - ( -_IO_FILE - *è -__THROW -; - -502 #ià -defšed - -_LIBC - || defšed -_GLIBCPP_USE_WCHAR_T - - -503 -_IO_wšt_t - -_IO_g‘wc - ( -_IO_FILE - * -__å -); - -504 -_IO_wšt_t - -_IO_putwc - ( -wch¬_t - -__wc -, -_IO_FILE - * -__å -); - -505  -_IO_fwide - ( -_IO_FILE - * -__å -,  -__mode -è -__THROW -; - -506 #ià -__GNUC__ - >= 2 - -509 #ià -defšed - -_LIBC - && defšed -SHARED - - -510  - ~ - -511 #ià -SHLIB_COMPAT - ( -libc -, -GLIBC_2_0 -, -GLIBC_2_1 -) - -512  - #_IO_fwide_maybe_šcom·tibË - \ - -513 ( - `__bužtš_ex³ù - (& -_IO_¡dš_u£d - =ð -NULL -, 0)) - - ) - -514 cÚ¡  -_IO_¡dš_u£d -; - -515 -w—k_ex‹º - ( -_IO_¡dš_u£d -); - -518 #iâdeà -_IO_fwide_maybe_šcom·tibË - - -519  - #_IO_fwide_maybe_šcom·tibË - (0) - - ) - -523  - #_IO_fwide -( -__å -, -__mode -) \ - -524 ({  -__»suÉ - = ( -__mode -); \ - -525 ià( -__»suÉ - < 0 && ! -_IO_fwide_maybe_šcom·tibË -) \ - -527 ià(( -__å -)-> -_mode - == 0) \ - -529 ( -__å -)-> -_mode - = -1; \ - -530 -__»suÉ - = ( -__å -)-> -_mode -; \ - -532 ià( - `__bužtš_cÚ¡ªt_p - ( -__mode -) && (__mode) == 0) \ - -533 -__»suÉ - = -_IO_fwide_maybe_šcom·tibË - ? -1 : ( -__å -)-> -_mode -; \ - -535 -__»suÉ - = - `_IO_fwide - ( -__å -, __result); \ - -536 -__»suÉ -; }) - - ) - -539  -_IO_vfwsÿnf - ( -_IO_FILE - * -__»¡riù -, cÚ¡ -wch¬_t - * __restrict, - -540 -_IO_va_li¡ -, * -__»¡riù -); - -541  -_IO_vfw´štf - ( -_IO_FILE - * -__»¡riù -, cÚ¡ -wch¬_t - *__restrict, - -542 -_IO_va_li¡ -); - -543 -_IO_ssize_t - -_IO_w·dn - ( -_IO_FILE - *, -wšt_t -, _IO_ssize_t); - -544  -_IO_ä“_wbackup_¬— - ( -_IO_FILE - *è -__THROW -; - -547 #ifdeà -__LDBL_COMPAT - - -548  - ~ - -551 #ifdeà -__ýlu¥lus - - - @/usr/include/xlocale.h - -21 #iâdeà -_XLOCALE_H - - -22  - #_XLOCALE_H - 1 - - ) - -28  - s__loÿË_¡ruù - - -31  -loÿË_d©a - * - m__loÿËs -[13]; - -34 cÚ¡ * - m__ùy³_b -; - -35 cÚ¡ * - m__ùy³_tÞow” -; - -36 cÚ¡ * - m__ùy³_touµ” -; - -39 cÚ¡ * - m__Çmes -[13]; - -40 } * - t__loÿË_t -; - -43  -__loÿË_t - - tloÿË_t -; - - @/usr/include/_G_config.h - -4 #iâdeà -_G_cÚfig_h - - -5  - #_G_cÚfig_h - 1 - - ) - -9  - ~ - -10  - #__Ãed_size_t - - - ) - -11 #ià -defšed - -_LIBC - || defšed -_GLIBCPP_USE_WCHAR_T - - -12  - #__Ãed_wch¬_t - - - ) - -14  - #__Ãed_NULL - - - ) - -15  - ~<¡ddef.h -> - -16  - #__Ãed_mb¡©e_t - - - ) - -17 #ià -defšed - -_LIBC - || defšed -_GLIBCPP_USE_WCHAR_T - - -18  - #__Ãed_wšt_t - - - ) - -20  - ~ - -21  - #_G_size_t - -size_t - - - ) - -24 -__off_t - - m__pos -; - -25 -__mb¡©e_t - - m__¡©e -; - -26 } - t_G_åos_t -; - -29 -__off64_t - - m__pos -; - -30 -__mb¡©e_t - - m__¡©e -; - -31 } - t_G_åos64_t -; - -32  - #_G_ssize_t - -__ssize_t - - - ) - -33  - #_G_off_t - -__off_t - - - ) - -34  - #_G_off64_t - -__off64_t - - - ) - -35  - #_G_pid_t - -__pid_t - - - ) - -36  - #_G_uid_t - -__uid_t - - - ) - -37  - #_G_wch¬_t - -wch¬_t - - - ) - -38  - #_G_wšt_t - -wšt_t - - - ) - -39  - #_G_¡©64 - -¡©64 - - - ) - -40 #ià -defšed - -_LIBC - || defšed -_GLIBCPP_USE_WCHAR_T - - -41  - ~ - -44  -__gcÚv_šfo - - m__cd -; - -47  -__gcÚv_šfo - - m__cd -; - -48  -__gcÚv_¡•_d©a - - m__d©a -; - -49 } - m__combšed -; - -50 } - t_G_icÚv_t -; - -53  - t_G_št16_t - - t__©Œibu‹__ - (( - t__mode__ - ( - t__HI__ -))); - -54  - t_G_št32_t - - t__©Œibu‹__ - (( - t__mode__ - ( - t__SI__ -))); - -55  - t_G_ušt16_t - - t__©Œibu‹__ - (( - t__mode__ - ( - t__HI__ -))); - -56  - t_G_ušt32_t - - t__©Œibu‹__ - (( - t__mode__ - ( - t__SI__ -))); - -58  - #_G_HAVE_BOOL - 1 - - ) - -62  - #_G_HAVE_ATEXIT - 1 - - ) - -63  - #_G_HAVE_SYS_CDEFS - 1 - - ) - -64  - #_G_HAVE_SYS_WAIT - 1 - - ) - -65  - #_G_NEED_STDARG_H - 1 - - ) - -66  - #_G_va_li¡ - -__gnuc_va_li¡ - - - ) - -68  - #_G_HAVE_PRINTF_FP - 1 - - ) - -69  - #_G_HAVE_MMAP - 1 - - ) - -70  - #_G_HAVE_MREMAP - 1 - - ) - -71  - #_G_HAVE_LONG_DOUBLE_IO - 1 - - ) - -72  - #_G_HAVE_IO_FILE_OPEN - 1 - - ) - -73  - #_G_HAVE_IO_GETLINE_INFO - 1 - - ) - -75  - #_G_IO_IO_FILE_VERSION - 0x20001 - - ) - -77  - #_G_OPEN64 - -__Ý’64 - - - ) - -78  - #_G_LSEEK64 - -__l£ek64 - - - ) - -79  - #_G_MMAP64 - -__mm­64 - - - ) - -80  - #_G_FSTAT64 -( -fd -, -buf -è - `__fx¡©64 - ( -_STAT_VER -, fd, buf) - - ) - -83  - #_G_HAVE_ST_BLKSIZE - - `defšed - ( -_STATBUF_ST_BLKSIZE -) - - ) - -85  - #_G_BUFSIZ - 8192 - - ) - -88  - #_G_NAMES_HAVE_UNDERSCORE - 0 - - ) - -89  - #_G_VTABLE_LABEL_HAS_LENGTH - 1 - - ) - -90  - #_G_USING_THUNKS - 1 - - ) - -91  - #_G_VTABLE_LABEL_PREFIX - "__vt_" - - ) - -92  - #_G_VTABLE_LABEL_PREFIX_ID - -__vt_ - - - ) - -95 #ià -defšed - -__ýlu¥lus - || defšed -__STDC__ - - -96  - #_G_ARGS -( -ARGLIST -è - ) -ARGLIST - -98  - #_G_ARGS -( -ARGLIST -è() - - ) - - @/usr/include/bits/libio-ldbl.h - -20 #iâdeà -_IO_STDIO_H - - -24 - $__LDBL_REDIR_DECL - ( -_IO_vfsÿnf -) - -25 - `__LDBL_REDIR_DECL - ( -_IO_vårštf -) - - @/usr/include/bits/predefs.h - -19 #iâdeà -_FEATURES_H - - -23 #iâdeà -_PREDEFS_H - - -24  - #_PREDEFS_H - - - ) - -27  - #__STDC_IEC_559__ - 1 - - ) - -28  - #__STDC_IEC_559_COMPLEX__ - 1 - - ) - - @/usr/include/bits/stdio-lock.h - -20 #iâdeà -_BITS_STDIO_LOCK_H - - -21  - #_BITS_STDIO_LOCK_H - 1 - - ) - -23  - ~ - -24  - ~ - -28  - #_IO_lock_šex³nsive - 1 - - ) - -30 ¡ruù {  - mlock -;  - mút -; * - mowÃr -; } - t_IO_lock_t -; - -32  - #_IO_lock_š™Ÿliz” - { -LLL_LOCK_INITIALIZER -, 0, -NULL - } - - ) - -34  - #_IO_lock_š™ -( -_Çme -) \ - -35 (( -_Çme -èð( -_IO_lock_t -è -_IO_lock_š™Ÿliz” - , 0) - - ) - -37  - #_IO_lock_fši -( -_Çme -) \ - -38 ((è0) - - ) - -40  - #_IO_lock_lock -( -_Çme -) \ - -42 * -__£lf - = -THREAD_SELF -; \ - -43 ià(( -_Çme -). -owÃr - !ð -__£lf -) \ - -45 - `Îl_lock - (( -_Çme -). -lock -, -LLL_PRIVATE -); \ - -46 ( -_Çme -). -owÃr - = -__£lf -; \ - -48 ++( -_Çme -). -út -; \ - -49 } 0) - - ) - -51  - #_IO_lock_Œylock -( -_Çme -) \ - -53  -__»suÉ - = 0; \ - -54 * -__£lf - = -THREAD_SELF -; \ - -55 ià(( -_Çme -). -owÃr - !ð -__£lf -) \ - -57 ià( - `Îl_Œylock - (( -_Çme -). -lock -) == 0) \ - -59 ( -_Çme -). -owÃr - = -__£lf -; \ - -60 ( -_Çme -). -út - = 1; \ - -63 -__»suÉ - = -EBUSY -; \ - -66 ++( -_Çme -). -út -; \ - -67 -__»suÉ -; \ - -68 }) - - ) - -70  - #_IO_lock_uÆock -( -_Çme -) \ - -72 ià(--( -_Çme -). -út - == 0) \ - -74 ( -_Çme -). -owÃr - = -NULL -; \ - -75 - `Îl_uÆock - (( -_Çme -). -lock -, -LLL_PRIVATE -); \ - -77 } 0) - - ) - -81  - #_IO_þ—nup_»giÚ_¡¬t -( -_fù -, -_å -) \ - -82 - `__libc_þ—nup_»giÚ_¡¬t - ((( -_å -)-> -_æags - & -_IO_USER_LOCK -è=ð0, -_fù -, _å) - - ) - -83  - #_IO_þ—nup_»giÚ_¡¬t_nßrg -( -_fù -) \ - -84 - `__libc_þ—nup_»giÚ_¡¬t - (1, -_fù -, -NULL -) - - ) - -85  - #_IO_þ—nup_»giÚ_’d -( -_do™ -) \ - -86 - `__libc_þ—nup_»giÚ_’d - ( -_do™ -) - - ) - -88 #ià -defšed - -_LIBC - && !defšed -NOT_IN_libc - - -90 #ifdeà -__EXCEPTIONS - - -91  - #_IO_acquœe_lock -( -_å -) \ - -93 -_IO_FILE - * -_IO_acquœe_lock_fže - \ - -94 - `__©Œibu‹__ -(( - `þ—nup - ( -_IO_acquœe_lock_fù -))) \ - -95 ð( -_å -); \ - -96 - `_IO_æockfže - ( -_IO_acquœe_lock_fže -); - - ) - -97  - #_IO_acquœe_lock_þ—r_æags2 -( -_å -) \ - -99 -_IO_FILE - * -_IO_acquœe_lock_fže - \ - -100 - `__©Œibu‹__ -(( - `þ—nup - ( -_IO_acquœe_lock_þ—r_æags2_fù -))) \ - -101 ð( -_å -); \ - -102 - `_IO_æockfže - ( -_IO_acquœe_lock_fže -); - - ) - -104  - #_IO_acquœe_lock -( -_å -è -_IO_acquœe_lock_Ãeds_exû±iÚs_’abËd - - - ) - -105  - #_IO_acquœe_lock_þ—r_æags2 -( -_å -è - `_IO_acquœe_lock - (_å) - - ) - -107  - #_IO_»Ëa£_lock -( -_å -è; } 0) - - ) - - @/usr/include/bits/typesizes.h - -20 #iâdeà -_BITS_TYPES_H - - -24 #iâdef -_BITS_TYPESIZES_H - - -25  - #_BITS_TYPESIZES_H - 1 - - ) - -30  - #__DEV_T_TYPE - -__UQUAD_TYPE - - - ) - -31  - #__UID_T_TYPE - -__U32_TYPE - - - ) - -32  - #__GID_T_TYPE - -__U32_TYPE - - - ) - -33  - #__INO_T_TYPE - -__ULONGWORD_TYPE - - - ) - -34  - #__INO64_T_TYPE - -__UQUAD_TYPE - - - ) - -35  - #__MODE_T_TYPE - -__U32_TYPE - - - ) - -36  - #__NLINK_T_TYPE - -__UWORD_TYPE - - - ) - -37  - #__OFF_T_TYPE - -__SLONGWORD_TYPE - - - ) - -38  - #__OFF64_T_TYPE - -__SQUAD_TYPE - - - ) - -39  - #__PID_T_TYPE - -__S32_TYPE - - - ) - -40  - #__RLIM_T_TYPE - -__ULONGWORD_TYPE - - - ) - -41  - #__RLIM64_T_TYPE - -__UQUAD_TYPE - - - ) - -42  - #__BLKCNT_T_TYPE - -__SLONGWORD_TYPE - - - ) - -43  - #__BLKCNT64_T_TYPE - -__SQUAD_TYPE - - - ) - -44  - #__FSBLKCNT_T_TYPE - -__ULONGWORD_TYPE - - - ) - -45  - #__FSBLKCNT64_T_TYPE - -__UQUAD_TYPE - - - ) - -46  - #__FSFILCNT_T_TYPE - -__ULONGWORD_TYPE - - - ) - -47  - #__FSFILCNT64_T_TYPE - -__UQUAD_TYPE - - - ) - -48  - #__ID_T_TYPE - -__U32_TYPE - - - ) - -49  - #__CLOCK_T_TYPE - -__SLONGWORD_TYPE - - - ) - -50  - #__TIME_T_TYPE - -__SLONGWORD_TYPE - - - ) - -51  - #__USECONDS_T_TYPE - -__U32_TYPE - - - ) - -52  - #__SUSECONDS_T_TYPE - -__SLONGWORD_TYPE - - - ) - -53  - #__DADDR_T_TYPE - -__S32_TYPE - - - ) - -54  - #__SWBLK_T_TYPE - -__SLONGWORD_TYPE - - - ) - -55  - #__KEY_T_TYPE - -__S32_TYPE - - - ) - -56  - #__CLOCKID_T_TYPE - -__S32_TYPE - - - ) - -57  - #__TIMER_T_TYPE - * - - ) - -58  - #__BLKSIZE_T_TYPE - -__SLONGWORD_TYPE - - - ) - -59  - #__FSID_T_TYPE - sŒuù {  -__v® -[2]; } - - ) - -60  - #__SSIZE_T_TYPE - -__SWORD_TYPE - - - ) - -63  - #__FD_SETSIZE - 1024 - - ) - - @/usr/include/bits/wordsize.h - -3 #ià -defšed - -__x86_64__ - - -4  - #__WORDSIZE - 64 - - ) - -5  - #__WORDSIZE_COMPAT32 - 1 - - ) - -7  - #__WORDSIZE - 32 - - ) - - @/usr/include/ctype.h - -24 #iâdef -_CTYPE_H - - -25  - #_CTYPE_H - 1 - - ) - -27  - ~<ã©u»s.h -> - -28  - ~ - -30 - g__BEGIN_DECLS - - -32 #iâdeà -_ISb™ - - -41  - ~<’dŸn.h -> - -42 #ià -__BYTE_ORDER - =ð -__BIG_ENDIAN - - -43  - #_ISb™ -( -b™ -è(1 << (b™)) - - ) - -45  - #_ISb™ -( -b™ -è((b™è< 8 ? ((1 << (b™)è<< 8è: ((1 << (b™)è>> 8)) - - ) - -50 - m_ISuµ” - = -_ISb™ - (0), - -51 - m_ISlow” - = -_ISb™ - (1), - -52 - m_IS®pha - = -_ISb™ - (2), - -53 - m_ISdig™ - = -_ISb™ - (3), - -54 - m_ISxdig™ - = -_ISb™ - (4), - -55 - m_IS¥aû - = -_ISb™ - (5), - -56 - m_IS´št - = -_ISb™ - (6), - -57 - m_ISg¿ph - = -_ISb™ - (7), - -58 - m_ISbÏnk - = -_ISb™ - (8), - -59 - m_ISúŒl - = -_ISb™ - (9), - -60 - m_ISpunù - = -_ISb™ - (10), - -61 - m_IS®num - = -_ISb™ - (11) - -81 -__cÚ¡ - ** - $__ùy³_b_loc - () - -82 -__THROW - - `__©Œibu‹__ - (( -__cÚ¡ -)); - -83 -__cÚ¡ - -__št32_t - ** - $__ùy³_tÞow”_loc - () - -84 -__THROW - - `__©Œibu‹__ - (( -__cÚ¡ -)); - -85 -__cÚ¡ - -__št32_t - ** - $__ùy³_touµ”_loc - () - -86 -__THROW - - `__©Œibu‹__ - (( -__cÚ¡ -)); - -88  - #__isùy³ -( -c -, -ty³ -) \ - -89 ((* - `__ùy³_b_loc - ())[(è( -c -)] & (è -ty³ -) - - ) - -91  - #__i§scii -( -c -è(((cè& ~0x7fè=ð0è - - ) - -92  - #__tßscii -( -c -è((cè& 0x7fè - - ) - -94  - #__exùy³ -( -Çme -è  - `Çme - (è -__THROW - - - ) - -96 -__BEGIN_NAMESPACE_STD - - -102 - `__exùy³ - ( -i§Êum -); - -103 - `__exùy³ - ( -i§Íha -); - -104 - `__exùy³ - ( -isúŒl -); - -105 - `__exùy³ - ( -isdig™ -); - -106 - `__exùy³ - ( -i¦ow” -); - -107 - `__exùy³ - ( -isg¿ph -); - -108 - `__exùy³ - ( -i¥ršt -); - -109 - `__exùy³ - ( -i¥unù -); - -110 - `__exùy³ - ( -is¥aû -); - -111 - `__exùy³ - ( -isuµ” -); - -112 - `__exùy³ - ( -isxdig™ -); - -116  - $tÞow” - ( -__c -è -__THROW -; - -119  - $touµ” - ( -__c -è -__THROW -; - -121 -__END_NAMESPACE_STD - - -125 #ifdef -__USE_ISOC99 - - -126 -__BEGIN_NAMESPACE_C99 - - -128 - `__exùy³ - ( -isbÏnk -); - -130 -__END_NAMESPACE_C99 - - -133 #ifdeà -__USE_GNU - - -135  - $isùy³ - ( -__c -,  -__mask -è -__THROW -; - -138 #ià -defšed - -__USE_SVID - || defšed -__USE_MISC - || defšed -__USE_XOPEN - - -142  - $i§scii - ( -__c -è -__THROW -; - -146  - $tßscii - ( -__c -è -__THROW -; - -150 - `__exùy³ - ( -_touµ” -); - -151 - `__exùy³ - ( -_tÞow” -); - -155  - #__tobody -( -c -, -f -, -a -, -¬gs -) \ - -156 ( -__ex‹nsiÚ__ - \ - -157 ({  -__»s -; \ - -158 ià( ( -c -) > 1) \ - -160 ià( - `__bužtš_cÚ¡ªt_p - ( -c -)) \ - -162  -__c - = ( -c -); \ - -163 -__»s - = -__c - < -128 || __ø> 255 ? __ø: ( -a -)[__c]; \ - -166 -__»s - = -f - -¬gs -; \ - -169 -__»s - = ( -a -)[(è( -c -)]; \ - -170 -__»s -; - } -})) - - ) - -172 #ià! -defšed - -__NO_CTYPE - && !defšed -__ýlu¥lus - - -173  - #i§Êum -( -c -è - `__isùy³ -((c), -_IS®num -) - - ) - -174  - #i§Íha -( -c -è - `__isùy³ -((c), -_IS®pha -) - - ) - -175  - #isúŒl -( -c -è - `__isùy³ -((c), -_ISúŒl -) - - ) - -176  - #isdig™ -( -c -è - `__isùy³ -((c), -_ISdig™ -) - - ) - -177  - #i¦ow” -( -c -è - `__isùy³ -((c), -_ISlow” -) - - ) - -178  - #isg¿ph -( -c -è - `__isùy³ -((c), -_ISg¿ph -) - - ) - -179  - #i¥ršt -( -c -è - `__isùy³ -((c), -_IS´št -) - - ) - -180  - #i¥unù -( -c -è - `__isùy³ -((c), -_ISpunù -) - - ) - -181  - #is¥aû -( -c -è - `__isùy³ -((c), -_IS¥aû -) - - ) - -182  - #isuµ” -( -c -è - `__isùy³ -((c), -_ISuµ” -) - - ) - -183  - #isxdig™ -( -c -è - `__isùy³ -((c), -_ISxdig™ -) - - ) - -185 #ifdeà -__USE_ISOC99 - - -186  - #isbÏnk -( -c -è - `__isùy³ -((c), -_ISbÏnk -) - - ) - -189 #ifdeà -__USE_EXTERN_INLINES - - -190 -__ex‹º_šlše -  - -191 -__NTH - ( - $tÞow” - ( -__c -)) - -193  -__c - >ð-128 && __ø< 256 ? (* - `__ùy³_tÞow”_loc - ())[__c] : __c; - -194 - } -} - -196 -__ex‹º_šlše -  - -197 -__NTH - ( - $touµ” - ( -__c -)) - -199  -__c - >ð-128 && __ø< 256 ? (* - `__ùy³_touµ”_loc - ())[__c] : __c; - -200 - } -} - -203 #ià -__GNUC__ - >ð2 && -defšed - -__OPTIMIZE__ - && !defšed -__ýlu¥lus - - -204  - #tÞow” -( -c -è - `__tobody - (c, -tÞow” -, * - `__ùy³_tÞow”_loc - (), (c)) - - ) - -205  - #touµ” -( -c -è - `__tobody - (c, -touµ” -, * - `__ùy³_touµ”_loc - (), (c)) - - ) - -208 #ià -defšed - -__USE_SVID - || defšed -__USE_MISC - || defšed -__USE_XOPEN - - -209  - #i§scii -( -c -è - `__i§scii - (c) - - ) - -210  - #tßscii -( -c -è - `__tßscii - (c) - - ) - -212  - #_tÞow” -( -c -è((è(* - `__ùy³_tÞow”_loc - ())[(è(c)]) - - ) - -213  - #_touµ” -( -c -è((è(* - `__ùy³_touµ”_loc - ())[(è(c)]) - - ) - -219 #ifdeà -__USE_XOPEN2K8 - - -233  - ~ - -237  - #__isùy³_l -( -c -, -ty³ -, -loÿË -) \ - -238 (( -loÿË -)-> -__ùy³_b -[(è( -c -)] & (è -ty³ -) - - ) - -240  - #__exùy³_l -( -Çme -) \ - -241  - `Çme - (, -__loÿË_t -è -__THROW - - - ) - -247 -__exùy³_l - ( -i§Êum_l -); - -248 -__exùy³_l - ( -i§Íha_l -); - -249 -__exùy³_l - ( -isúŒl_l -); - -250 -__exùy³_l - ( -isdig™_l -); - -251 -__exùy³_l - ( -i¦ow”_l -); - -252 -__exùy³_l - ( -isg¿ph_l -); - -253 -__exùy³_l - ( -i¥ršt_l -); - -254 -__exùy³_l - ( -i¥unù_l -); - -255 -__exùy³_l - ( -is¥aû_l -); - -256 -__exùy³_l - ( -isuµ”_l -); - -257 -__exùy³_l - ( -isxdig™_l -); - -259 -__exùy³_l - ( -isbÏnk_l -); - -263  - $__tÞow”_l - ( -__c -, -__loÿË_t - -__l -è -__THROW -; - -264  - $tÞow”_l - ( -__c -, -__loÿË_t - -__l -è -__THROW -; - -267  - $__touµ”_l - ( -__c -, -__loÿË_t - -__l -è -__THROW -; - -268  - $touµ”_l - ( -__c -, -__loÿË_t - -__l -è -__THROW -; - -270 #ià -__GNUC__ - >ð2 && -defšed - -__OPTIMIZE__ - && !defšed -__ýlu¥lus - - -271  - #__tÞow”_l -( -c -, -loÿË -) \ - -272 - `__tobody - ( -c -, -__tÞow”_l -, ( -loÿË -)-> -__ùy³_tÞow” -, (c,†oÿË)) - - ) - -273  - #__touµ”_l -( -c -, -loÿË -) \ - -274 - `__tobody - ( -c -, -__touµ”_l -, ( -loÿË -)-> -__ùy³_touµ” -, (c,†oÿË)) - - ) - -275  - #tÞow”_l -( -c -, -loÿË -è - `__tÞow”_l - ((c), (loÿË)) - - ) - -276  - #touµ”_l -( -c -, -loÿË -è - `__touµ”_l - ((c), (loÿË)) - - ) - -280 #iâdeà -__NO_CTYPE - - -281  - #__i§Êum_l -( -c -, -l -è - `__isùy³_l -((c), -_IS®num -, (l)) - - ) - -282  - #__i§Íha_l -( -c -, -l -è - `__isùy³_l -((c), -_IS®pha -, (l)) - - ) - -283  - #__isúŒl_l -( -c -, -l -è - `__isùy³_l -((c), -_ISúŒl -, (l)) - - ) - -284  - #__isdig™_l -( -c -, -l -è - `__isùy³_l -((c), -_ISdig™ -, (l)) - - ) - -285  - #__i¦ow”_l -( -c -, -l -è - `__isùy³_l -((c), -_ISlow” -, (l)) - - ) - -286  - #__isg¿ph_l -( -c -, -l -è - `__isùy³_l -((c), -_ISg¿ph -, (l)) - - ) - -287  - #__i¥ršt_l -( -c -, -l -è - `__isùy³_l -((c), -_IS´št -, (l)) - - ) - -288  - #__i¥unù_l -( -c -, -l -è - `__isùy³_l -((c), -_ISpunù -, (l)) - - ) - -289  - #__is¥aû_l -( -c -, -l -è - `__isùy³_l -((c), -_IS¥aû -, (l)) - - ) - -290  - #__isuµ”_l -( -c -, -l -è - `__isùy³_l -((c), -_ISuµ” -, (l)) - - ) - -291  - #__isxdig™_l -( -c -, -l -è - `__isùy³_l -((c), -_ISxdig™ -, (l)) - - ) - -293  - #__isbÏnk_l -( -c -, -l -è - `__isùy³_l -((c), -_ISbÏnk -, (l)) - - ) - -295 #ià -defšed - -__USE_SVID - || defšed -__USE_MISC - - -296  - #__i§scii_l -( -c -, -l -è(Ö), - `__i§scii - (c)) - - ) - -297  - #__tßscii_l -( -c -, -l -è(Ö), - `__tßscii - (c)) - - ) - -300  - #i§Êum_l -( -c -, -l -è - `__i§Êum_l - ((c), (l)) - - ) - -301  - #i§Íha_l -( -c -, -l -è - `__i§Íha_l - ((c), (l)) - - ) - -302  - #isúŒl_l -( -c -, -l -è - `__isúŒl_l - ((c), (l)) - - ) - -303  - #isdig™_l -( -c -, -l -è - `__isdig™_l - ((c), (l)) - - ) - -304  - #i¦ow”_l -( -c -, -l -è - `__i¦ow”_l - ((c), (l)) - - ) - -305  - #isg¿ph_l -( -c -, -l -è - `__isg¿ph_l - ((c), (l)) - - ) - -306  - #i¥ršt_l -( -c -, -l -è - `__i¥ršt_l - ((c), (l)) - - ) - -307  - #i¥unù_l -( -c -, -l -è - `__i¥unù_l - ((c), (l)) - - ) - -308  - #is¥aû_l -( -c -, -l -è - `__is¥aû_l - ((c), (l)) - - ) - -309  - #isuµ”_l -( -c -, -l -è - `__isuµ”_l - ((c), (l)) - - ) - -310  - #isxdig™_l -( -c -, -l -è - `__isxdig™_l - ((c), (l)) - - ) - -312  - #isbÏnk_l -( -c -, -l -è - `__isbÏnk_l - ((c), (l)) - - ) - -314 #ià -defšed - -__USE_SVID - || defšed -__USE_MISC - - -315  - #i§scii_l -( -c -, -l -è - `__i§scii_l - ((c), (l)) - - ) - -316  - #tßscii_l -( -c -, -l -è - `__tßscii_l - ((c), (l)) - - ) - -323 -__END_DECLS - - - @/usr/include/endian.h - -19 #iâdef -_ENDIAN_H - - -20  - #_ENDIAN_H - 1 - - ) - -22  - ~<ã©u»s.h -> - -32  - #__LITTLE_ENDIAN - 1234 - - ) - -33  - #__BIG_ENDIAN - 4321 - - ) - -34  - #__PDP_ENDIAN - 3412 - - ) - -37  - ~ - -41 #iâdeà -__FLOAT_WORD_ORDER - - -42  - #__FLOAT_WORD_ORDER - -__BYTE_ORDER - - - ) - -45 #ifdef -__USE_BSD - - -46  - #LITTLE_ENDIAN - -__LITTLE_ENDIAN - - - ) - -47  - #BIG_ENDIAN - -__BIG_ENDIAN - - - ) - -48  - #PDP_ENDIAN - -__PDP_ENDIAN - - - ) - -49  - #BYTE_ORDER - -__BYTE_ORDER - - - ) - -52 #ià -__BYTE_ORDER - =ð -__LITTLE_ENDIAN - - -53  - #__LONG_LONG_PAIR -( -HI -, -LO -èLO, - ) -HI - -54 #–ià -__BYTE_ORDER - =ð -__BIG_ENDIAN - - -55  - #__LONG_LONG_PAIR -( -HI -, -LO -èHI, - ) -LO - -59 #ifdeà -__USE_BSD - - -61  - ~ - -63 #ià -__BYTE_ORDER - =ð -__LITTLE_ENDIAN - - -64  - #htobe16 -( -x -è - `__bsw­_16 - (x) - - ) - -65  - #htÞe16 -( -x -è(x) - - ) - -66  - #be16toh -( -x -è - `__bsw­_16 - (x) - - ) - -67  - #Ë16toh -( -x -è(x) - - ) - -69  - #htobe32 -( -x -è - `__bsw­_32 - (x) - - ) - -70  - #htÞe32 -( -x -è(x) - - ) - -71  - #be32toh -( -x -è - `__bsw­_32 - (x) - - ) - -72  - #Ë32toh -( -x -è(x) - - ) - -74  - #htobe64 -( -x -è - `__bsw­_64 - (x) - - ) - -75  - #htÞe64 -( -x -è(x) - - ) - -76  - #be64toh -( -x -è - `__bsw­_64 - (x) - - ) - -77  - #Ë64toh -( -x -è(x) - - ) - -79  - #htobe16 -( -x -è(x) - - ) - -80  - #htÞe16 -( -x -è - `__bsw­_16 - (x) - - ) - -81  - #be16toh -( -x -è(x) - - ) - -82  - #Ë16toh -( -x -è - `__bsw­_16 - (x) - - ) - -84  - #htobe32 -( -x -è(x) - - ) - -85  - #htÞe32 -( -x -è - `__bsw­_32 - (x) - - ) - -86  - #be32toh -( -x -è(x) - - ) - -87  - #Ë32toh -( -x -è - `__bsw­_32 - (x) - - ) - -89  - #htobe64 -( -x -è(x) - - ) - -90  - #htÞe64 -( -x -è - `__bsw­_64 - (x) - - ) - -91  - #be64toh -( -x -è(x) - - ) - -92  - #Ë64toh -( -x -è - `__bsw­_64 - (x) - - ) - - @/usr/include/gnu/stubs.h - -4  - ~ - -6 #ià -__WORDSIZE - == 32 - -7  - ~ - -8 #–ià -__WORDSIZE - == 64 - -9  - ~ - - @/usr/include/stdlib.h - -23 #iâdef -_STDLIB_H - - -25  - ~<ã©u»s.h -> - -28  - #__Ãed_size_t - - - ) - -29 #iâdeà -__Ãed_m®loc_ªd_ÿÎoc - - -30  - #__Ãed_wch¬_t - - - ) - -31  - #__Ãed_NULL - - - ) - -33  - ~<¡ddef.h -> - -35 - g__BEGIN_DECLS - - -37 #iâdeà -__Ãed_m®loc_ªd_ÿÎoc - - -38  - #_STDLIB_H - 1 - - ) - -40 #ià -defšed - -__USE_XOPEN - && !defšed -_SYS_WAIT_H - - -42  - ~ - -43  - ~ - -45 #ifdeà -__USE_BSD - - -50 #ià -defšed - -__GNUC__ - && !defšed -__ýlu¥lus - - -51  - #__WAIT_INT -( -¡©us -) \ - -52 ( - `__ex‹nsiÚ__ - (((uniÚ { - `__ty³of -( -¡©us -è -__š -;  -__i -; }) \ - -53 { . -__š - = ( -¡©us -è}). -__i -)) - - ) - -55  - #__WAIT_INT -( -¡©us -è(*(*è&(¡©us)) - - ) - -63 #ià! -defšed - -__GNUC__ - || __GNUC__ < 2 || defšed -__ýlu¥lus - - -64  - #__WAIT_STATUS - * - - ) - -65  - #__WAIT_STATUS_DEFN - * - - ) - -70  -wa™ - * - m__u±r -; - -71 * - m__Œ -; - -72 } - t__WAIT_STATUS - - t__©Œibu‹__ - (( - t__Œª¥¬’t_uniÚ__ -)); - -73  - #__WAIT_STATUS_DEFN - * - - ) - -78  - #__WAIT_INT -( -¡©us -è(¡©us) - - ) - -79  - #__WAIT_STATUS - * - - ) - -80  - #__WAIT_STATUS_DEFN - * - - ) - -85  - #WEXITSTATUS -( -¡©us -è - `__WEXITSTATUS - ( - `__WAIT_INT - (¡©us)) - - ) - -86  - #WTERMSIG -( -¡©us -è - `__WTERMSIG - ( - `__WAIT_INT - (¡©us)) - - ) - -87  - #WSTOPSIG -( -¡©us -è - `__WSTOPSIG - ( - `__WAIT_INT - (¡©us)) - - ) - -88  - #WIFEXITED -( -¡©us -è - `__WIFEXITED - ( - `__WAIT_INT - (¡©us)) - - ) - -89  - #WIFSIGNALED -( -¡©us -è - `__WIFSIGNALED - ( - `__WAIT_INT - (¡©us)) - - ) - -90  - #WIFSTOPPED -( -¡©us -è - `__WIFSTOPPED - ( - `__WAIT_INT - (¡©us)) - - ) - -91 #ifdeà -__WIFCONTINUED - - -92  - #WIFCONTINUED -( -¡©us -è - `__WIFCONTINUED - ( - `__WAIT_INT - (¡©us)) - - ) - -96 -__BEGIN_NAMESPACE_STD - - -100  - mquÙ -; - -101  - m»m -; - -102 } - tdiv_t -; - -105 #iâdeà -__ldiv_t_defšed - - -108  - mquÙ -; - -109  - m»m -; - -110 } - tldiv_t -; - -111  - #__ldiv_t_defšed - 1 - - ) - -113 - g__END_NAMESPACE_STD - - -115 #ià -defšed - -__USE_ISOC99 - && !defšed -__Îdiv_t_defšed - - -116 -__BEGIN_NAMESPACE_C99 - - -118 -__ex‹nsiÚ__ - struct - -120  - mquÙ -; - -121  - m»m -; - -122 } - tÎdiv_t -; - -123  - #__Îdiv_t_defšed - 1 - - ) - -124 - g__END_NAMESPACE_C99 - - -129  - #RAND_MAX - 2147483647 - - ) - -134  - #EXIT_FAILURE - 1 - - ) - -135  - #EXIT_SUCCESS - 0 - - ) - -139  - #MB_CUR_MAX - ( - `__ùy³_g‘_mb_cur_max - ()) - - ) - -140 -size_t - - $__ùy³_g‘_mb_cur_max - (è -__THROW - -__wur -; - -143 -__BEGIN_NAMESPACE_STD - - -145  - $©of - ( -__cÚ¡ - * -__ÅŒ -) - -146 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)è -__wur -; - -148  - $©oi - ( -__cÚ¡ - * -__ÅŒ -) - -149 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)è -__wur -; - -151  - $©Þ - ( -__cÚ¡ - * -__ÅŒ -) - -152 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)è -__wur -; - -153 -__END_NAMESPACE_STD - - -155 #ià -defšed - -__USE_ISOC99 - || (defšed -__GLIBC_HAVE_LONG_LONG - && defšed -__USE_MISC -) - -156 -__BEGIN_NAMESPACE_C99 - - -158 -__ex‹nsiÚ__ -  - $©Þl - ( -__cÚ¡ - * -__ÅŒ -) - -159 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)è -__wur -; - -160 -__END_NAMESPACE_C99 - - -163 -__BEGIN_NAMESPACE_STD - - -165  - $¡¹od - ( -__cÚ¡ - * -__»¡riù - -__ÅŒ -, - -166 ** -__»¡riù - -__’d±r -) - -167 -__THROW - - `__nÚnuÎ - ((1)è -__wur -; - -168 -__END_NAMESPACE_STD - - -170 #ifdef -__USE_ISOC99 - - -171 -__BEGIN_NAMESPACE_C99 - - -173  - $¡¹of - ( -__cÚ¡ - * -__»¡riù - -__ÅŒ -, - -174 ** -__»¡riù - -__’d±r -è -__THROW - - `__nÚnuÎ - ((1)è -__wur -; - -176  - $¡¹Þd - ( -__cÚ¡ - * -__»¡riù - -__ÅŒ -, - -177 ** -__»¡riù - -__’d±r -) - -178 -__THROW - - `__nÚnuÎ - ((1)è -__wur -; - -179 -__END_NAMESPACE_C99 - - -182 -__BEGIN_NAMESPACE_STD - - -184  - $¡¹Þ - ( -__cÚ¡ - * -__»¡riù - -__ÅŒ -, - -185 ** -__»¡riù - -__’d±r -,  -__ba£ -) - -186 -__THROW - - `__nÚnuÎ - ((1)è -__wur -; - -188  - $¡¹oul - ( -__cÚ¡ - * -__»¡riù - -__ÅŒ -, - -189 ** -__»¡riù - -__’d±r -,  -__ba£ -) - -190 -__THROW - - `__nÚnuÎ - ((1)è -__wur -; - -191 -__END_NAMESPACE_STD - - -193 #ià -defšed - -__GLIBC_HAVE_LONG_LONG - && defšed -__USE_BSD - - -195 -__ex‹nsiÚ__ - - -196  - $¡¹oq - ( -__cÚ¡ - * -__»¡riù - -__ÅŒ -, - -197 ** -__»¡riù - -__’d±r -,  -__ba£ -) - -198 -__THROW - - `__nÚnuÎ - ((1)è -__wur -; - -200 -__ex‹nsiÚ__ - - -201  - $¡¹ouq - ( -__cÚ¡ - * -__»¡riù - -__ÅŒ -, - -202 ** -__»¡riù - -__’d±r -,  -__ba£ -) - -203 -__THROW - - `__nÚnuÎ - ((1)è -__wur -; - -206 #ià -defšed - -__USE_ISOC99 - || (defšed -__GLIBC_HAVE_LONG_LONG - && defšed -__USE_MISC -) - -207 -__BEGIN_NAMESPACE_C99 - - -209 -__ex‹nsiÚ__ - - -210  - $¡¹Þl - ( -__cÚ¡ - * -__»¡riù - -__ÅŒ -, - -211 ** -__»¡riù - -__’d±r -,  -__ba£ -) - -212 -__THROW - - `__nÚnuÎ - ((1)è -__wur -; - -214 -__ex‹nsiÚ__ - - -215  - $¡¹ouÎ - ( -__cÚ¡ - * -__»¡riù - -__ÅŒ -, - -216 ** -__»¡riù - -__’d±r -,  -__ba£ -) - -217 -__THROW - - `__nÚnuÎ - ((1)è -__wur -; - -218 -__END_NAMESPACE_C99 - - -222 #ifdeà -__USE_GNU - - -236  - ~ - -240  - $¡¹Þ_l - ( -__cÚ¡ - * -__»¡riù - -__ÅŒ -, - -241 ** -__»¡riù - -__’d±r -,  -__ba£ -, - -242 -__loÿË_t - -__loc -è -__THROW - - `__nÚnuÎ - ((1, 4)è -__wur -; - -244  - $¡¹oul_l - ( -__cÚ¡ - * -__»¡riù - -__ÅŒ -, - -245 ** -__»¡riù - -__’d±r -, - -246  -__ba£ -, -__loÿË_t - -__loc -) - -247 -__THROW - - `__nÚnuÎ - ((1, 4)è -__wur -; - -249 -__ex‹nsiÚ__ - - -250  - $¡¹Þl_l - ( -__cÚ¡ - * -__»¡riù - -__ÅŒ -, - -251 ** -__»¡riù - -__’d±r -,  -__ba£ -, - -252 -__loÿË_t - -__loc -) - -253 -__THROW - - `__nÚnuÎ - ((1, 4)è -__wur -; - -255 -__ex‹nsiÚ__ - - -256  - $¡¹ouÎ_l - ( -__cÚ¡ - * -__»¡riù - -__ÅŒ -, - -257 ** -__»¡riù - -__’d±r -, - -258  -__ba£ -, -__loÿË_t - -__loc -) - -259 -__THROW - - `__nÚnuÎ - ((1, 4)è -__wur -; - -261  - $¡¹od_l - ( -__cÚ¡ - * -__»¡riù - -__ÅŒ -, - -262 ** -__»¡riù - -__’d±r -, -__loÿË_t - -__loc -) - -263 -__THROW - - `__nÚnuÎ - ((1, 3)è -__wur -; - -265  - $¡¹of_l - ( -__cÚ¡ - * -__»¡riù - -__ÅŒ -, - -266 ** -__»¡riù - -__’d±r -, -__loÿË_t - -__loc -) - -267 -__THROW - - `__nÚnuÎ - ((1, 3)è -__wur -; - -269  - $¡¹Þd_l - ( -__cÚ¡ - * -__»¡riù - -__ÅŒ -, - -270 ** -__»¡riù - -__’d±r -, - -271 -__loÿË_t - -__loc -) - -272 -__THROW - - `__nÚnuÎ - ((1, 3)è -__wur -; - -276 #ifdeà -__USE_EXTERN_INLINES - - -277 -__BEGIN_NAMESPACE_STD - - -278 -__ex‹º_šlše -  - -279 - `__NTH - ( - $©of - ( -__cÚ¡ - * -__ÅŒ -)) - -281  - `¡¹od - ( -__ÅŒ -, (**è -NULL -); - -282 - } -} - -283 -__ex‹º_šlše -  - -284 -__NTH - ( - $©oi - ( -__cÚ¡ - * -__ÅŒ -)) - -286  (è - `¡¹Þ - ( -__ÅŒ -, (**è -NULL -, 10); - -287 - } -} - -288 -__ex‹º_šlše -  - -289 -__NTH - ( - $©Þ - ( -__cÚ¡ - * -__ÅŒ -)) - -291  - `¡¹Þ - ( -__ÅŒ -, (**è -NULL -, 10); - -292 - } -} - -293 - g__END_NAMESPACE_STD - - -295 #ià -defšed - -__USE_MISC - || defšed -__USE_ISOC99 - - -296 -__BEGIN_NAMESPACE_C99 - - -297 -__ex‹nsiÚ__ - -__ex‹º_šlše -  - -298 -__NTH - ( - $©Þl - ( -__cÚ¡ - * -__ÅŒ -)) - -300  - `¡¹Þl - ( -__ÅŒ -, (**è -NULL -, 10); - -301 - } -} - -302 - g__END_NAMESPACE_C99 - - -307 #ià -defšed - -__USE_SVID - || defšed -__USE_XOPEN_EXTENDED - - -311 * - $l64a - ( -__n -è -__THROW - -__wur -; - -314  - $a64l - ( -__cÚ¡ - * -__s -) - -315 -__THROW - -__©Œibu‹_pu»__ - - `__nÚnuÎ - ((1)è -__wur -; - -319 #ià -defšed - -__USE_SVID - || defšed -__USE_XOPEN_EXTENDED - || defšed -__USE_BSD - - -320  - ~ - -327  - $¿ndom - (è -__THROW -; - -330  - $¤ªdom - ( -__£ed -è -__THROW -; - -336 * - $š™¡©e - ( -__£ed -, * -__¡©ebuf -, - -337 -size_t - -__¡©–’ -è -__THROW - - `__nÚnuÎ - ((2)); - -341 * - $£t¡©e - (* -__¡©ebuf -è -__THROW - - `__nÚnuÎ - ((1)); - -344 #ifdeà -__USE_MISC - - -349  - s¿ndom_d©a - - -351 -št32_t - * -åŒ -; - -352 -št32_t - * -½Œ -; - -353 -št32_t - * -¡©e -; - -354  -¿nd_ty³ -; - -355  -¿nd_deg -; - -356  -¿nd_£p -; - -357 -št32_t - * -’d_±r -; - -360  - $¿ndom_r - ( -¿ndom_d©a - * -__»¡riù - -__buf -, - -361 -št32_t - * -__»¡riù - -__»suÉ -è -__THROW - - `__nÚnuÎ - ((1, 2)); - -363  - $¤ªdom_r - ( -__£ed -,  -¿ndom_d©a - * -__buf -) - -364 -__THROW - - `__nÚnuÎ - ((2)); - -366  - $š™¡©e_r - ( -__£ed -, * -__»¡riù - -__¡©ebuf -, - -367 -size_t - -__¡©–’ -, - -368  -¿ndom_d©a - * -__»¡riù - -__buf -) - -369 -__THROW - - `__nÚnuÎ - ((2, 4)); - -371  - $£t¡©e_r - (* -__»¡riù - -__¡©ebuf -, - -372  -¿ndom_d©a - * -__»¡riù - -__buf -) - -373 -__THROW - - `__nÚnuÎ - ((1, 2)); - -378 -__BEGIN_NAMESPACE_STD - - -380  - $¿nd - (è -__THROW -; - -382  - $¤ªd - ( -__£ed -è -__THROW -; - -383 -__END_NAMESPACE_STD - - -385 #ifdeà -__USE_POSIX - - -387  - $¿nd_r - (* -__£ed -è -__THROW -; - -391 #ià -defšed - -__USE_SVID - || defšed -__USE_XOPEN - - -395  - $d¿nd48 - (è -__THROW -; - -396  - $”ªd48 - ( -__xsubi -[3]è -__THROW - - `__nÚnuÎ - ((1)); - -399  - $̪d48 - (è -__THROW -; - -400  - $Īd48 - ( -__xsubi -[3]) - -401 -__THROW - - `__nÚnuÎ - ((1)); - -404  - $m¿nd48 - (è -__THROW -; - -405  - $j¿nd48 - ( -__xsubi -[3]) - -406 -__THROW - - `__nÚnuÎ - ((1)); - -409  - $¤ªd48 - ( -__£edv® -è -__THROW -; - -410 * - $£ed48 - ( -__£ed16v -[3]) - -411 -__THROW - - `__nÚnuÎ - ((1)); - -412  - $lcÚg48 - ( -__·¿m -[7]è -__THROW - - `__nÚnuÎ - ((1)); - -414 #ifdeà -__USE_MISC - - -418  - sd¿nd48_d©a - - -420  -__x -[3]; - -421  -__Þd_x -[3]; - -422  -__c -; - -423  -__š™ -; - -424  -__a -; - -428  - $d¿nd48_r - ( -d¿nd48_d©a - * -__»¡riù - -__bufãr -, - -429 * -__»¡riù - -__»suÉ -è -__THROW - - `__nÚnuÎ - ((1, 2)); - -430  - $”ªd48_r - ( -__xsubi -[3], - -431  -d¿nd48_d©a - * -__»¡riù - -__bufãr -, - -432 * -__»¡riù - -__»suÉ -è -__THROW - - `__nÚnuÎ - ((1, 2)); - -435  - $̪d48_r - ( -d¿nd48_d©a - * -__»¡riù - -__bufãr -, - -436 * -__»¡riù - -__»suÉ -) - -437 -__THROW - - `__nÚnuÎ - ((1, 2)); - -438  - $Īd48_r - ( -__xsubi -[3], - -439  -d¿nd48_d©a - * -__»¡riù - -__bufãr -, - -440 * -__»¡riù - -__»suÉ -) - -441 -__THROW - - `__nÚnuÎ - ((1, 2)); - -444  - $m¿nd48_r - ( -d¿nd48_d©a - * -__»¡riù - -__bufãr -, - -445 * -__»¡riù - -__»suÉ -) - -446 -__THROW - - `__nÚnuÎ - ((1, 2)); - -447  - $j¿nd48_r - ( -__xsubi -[3], - -448  -d¿nd48_d©a - * -__»¡riù - -__bufãr -, - -449 * -__»¡riù - -__»suÉ -) - -450 -__THROW - - `__nÚnuÎ - ((1, 2)); - -453  - $¤ªd48_r - ( -__£edv® -,  -d¿nd48_d©a - * -__bufãr -) - -454 -__THROW - - `__nÚnuÎ - ((2)); - -456  - $£ed48_r - ( -__£ed16v -[3], - -457  -d¿nd48_d©a - * -__bufãr -è -__THROW - - `__nÚnuÎ - ((1, 2)); - -459  - $lcÚg48_r - ( -__·¿m -[7], - -460  -d¿nd48_d©a - * -__bufãr -) - -461 -__THROW - - `__nÚnuÎ - ((1, 2)); - -467 #iâdeà -__m®loc_ªd_ÿÎoc_defšed - - -468  - #__m®loc_ªd_ÿÎoc_defšed - - - ) - -469 -__BEGIN_NAMESPACE_STD - - -471 * - $m®loc - ( -size_t - -__size -è -__THROW - -__©Œibu‹_m®loc__ - -__wur -; - -473 * - $ÿÎoc - ( -size_t - -__nmemb -, size_ˆ -__size -) - -474 -__THROW - -__©Œibu‹_m®loc__ - -__wur -; - -475 -__END_NAMESPACE_STD - - -478 #iâdeà -__Ãed_m®loc_ªd_ÿÎoc - - -479 -__BEGIN_NAMESPACE_STD - - -485 * - $»®loc - (* -__±r -, -size_t - -__size -) - -486 -__THROW - -__©Œibu‹_w¬n_unu£d_»suÉ__ -; - -488  - $ä“ - (* -__±r -è -__THROW -; - -489 -__END_NAMESPACE_STD - - -491 #ifdef -__USE_MISC - - -493  - $cä“ - (* -__±r -è -__THROW -; - -496 #ià -defšed - -__USE_GNU - || defšed -__USE_BSD - || defšed -__USE_MISC - - -497  - ~<®loÿ.h -> - -500 #ià -defšed - -__USE_BSD - || defšed -__USE_XOPEN_EXTENDED - - -502 * - $v®loc - ( -size_t - -__size -è -__THROW - -__©Œibu‹_m®loc__ - -__wur -; - -505 #ifdeà -__USE_XOPEN2K - - -507  - $posix_mem®ign - (** -__mem±r -, -size_t - -__®ignm’t -, size_ˆ -__size -) - -508 -__THROW - - `__nÚnuÎ - ((1)è -__wur -; - -511 -__BEGIN_NAMESPACE_STD - - -513  - $abÜt - (è -__THROW - - `__©Œibu‹__ - (( -__nÜ‘uº__ -)); - -517  - `©ex™ - ((* -__func -è()è -__THROW - - `__nÚnuÎ - ((1)); - -519 #ifdeà -__USE_GNU - - -523 #ifdeà -__ýlu¥lus - - -524 "C++"  - `©_quick_ex™ - ((* -__func -) ()) - -525 -__THROW - - `__asm - ("©_quick_ex™"è - `__nÚnuÎ - ((1)); - -527  - `©_quick_ex™ - ((* -__func -è()è -__THROW - - `__nÚnuÎ - ((1)); - -530 -__END_NAMESPACE_STD - - -532 #ifdef -__USE_MISC - - -535  - `Ú_ex™ - ((* -__func -è( -__¡©us -, * -__¬g -), *__arg) - -536 -__THROW - - `__nÚnuÎ - ((1)); - -539 -__BEGIN_NAMESPACE_STD - - -543  - $ex™ - ( -__¡©us -è -__THROW - - `__©Œibu‹__ - (( -__nÜ‘uº__ -)); - -545 #ifdeà -__USE_GNU - - -551  - $quick_ex™ - ( -__¡©us -è -__THROW - - `__©Œibu‹__ - (( -__nÜ‘uº__ -)); - -553 -__END_NAMESPACE_STD - - -555 #ifdeà -__USE_ISOC99 - - -556 -__BEGIN_NAMESPACE_C99 - - -559  - $_Ex™ - ( -__¡©us -è -__THROW - - `__©Œibu‹__ - (( -__nÜ‘uº__ -)); - -560 -__END_NAMESPACE_C99 - - -564 -__BEGIN_NAMESPACE_STD - - -566 * - $g‘’v - ( -__cÚ¡ - * -__Çme -è -__THROW - - `__nÚnuÎ - ((1)è -__wur -; - -567 -__END_NAMESPACE_STD - - -571 * - $__£cu»_g‘’v - ( -__cÚ¡ - * -__Çme -) - -572 -__THROW - - `__nÚnuÎ - ((1)è -__wur -; - -574 #ià -defšed - -__USE_SVID - || defšed -__USE_XOPEN - - -578  - $pu‹nv - (* -__¡ršg -è -__THROW - - `__nÚnuÎ - ((1)); - -581 #ià -defšed - -__USE_BSD - || defšed -__USE_XOPEN2K - - -584  - $£‹nv - ( -__cÚ¡ - * -__Çme -, __cÚ¡ * -__v®ue -,  -__»¶aû -) - -585 -__THROW - - `__nÚnuÎ - ((2)); - -588  - $un£‹nv - ( -__cÚ¡ - * -__Çme -è -__THROW -; - -591 #ifdef -__USE_MISC - - -595  - $þ—»nv - (è -__THROW -; - -599 #ià -defšed - -__USE_MISC - || defšed -__USE_XOPEN_EXTENDED - - -604 * - $mk‹mp - (* -__‹m¶©e -è -__THROW - - `__nÚnuÎ - ((1)è -__wur -; - -614 #iâdeà -__USE_FILE_OFFSET64 - - -615  - $mk¡emp - (* -__‹m¶©e -è - `__nÚnuÎ - ((1)è -__wur -; - -617 #ifdeà -__REDIRECT - - -618  - `__REDIRECT - ( -mk¡emp -, (* -__‹m¶©e -), -mk¡emp64 -) - -619 - `__nÚnuÎ - ((1)è -__wur -; - -621  - #mk¡emp - -mk¡emp64 - - - ) - -624 #ifdeà -__USE_LARGEFILE64 - - -625  - $mk¡emp64 - (* -__‹m¶©e -è - `__nÚnuÎ - ((1)è -__wur -; - -629 #ifdeà -__USE_MISC - - -636 #iâdeà -__USE_FILE_OFFSET64 - - -637  - $mk¡emps - (* -__‹m¶©e -,  -__suffixËn -è - `__nÚnuÎ - ((1)è -__wur -; - -639 #ifdeà -__REDIRECT - - -640  - `__REDIRECT - ( -mk¡emps -, (* -__‹m¶©e -,  -__suffixËn -), - -641 -mk¡emps64 -è - `__nÚnuÎ - ((1)è -__wur -; - -643  - #mk¡emps - -mk¡emps64 - - - ) - -646 #ifdeà -__USE_LARGEFILE64 - - -647  - $mk¡emps64 - (* -__‹m¶©e -,  -__suffixËn -) - -648 - `__nÚnuÎ - ((1)è -__wur -; - -652 #ià -defšed - -__USE_BSD - || defšed -__USE_XOPEN2K8 - - -658 * - $mkd‹mp - (* -__‹m¶©e -è -__THROW - - `__nÚnuÎ - ((1)è -__wur -; - -661 #ifdeà -__USE_GNU - - -668 #iâdeà -__USE_FILE_OFFSET64 - - -669  - $mko¡emp - (* -__‹m¶©e -,  -__æags -è - `__nÚnuÎ - ((1)è -__wur -; - -671 #ifdeà -__REDIRECT - - -672  - `__REDIRECT - ( -mko¡emp -, (* -__‹m¶©e -,  -__æags -), -mko¡emp64 -) - -673 - `__nÚnuÎ - ((1)è -__wur -; - -675  - #mko¡emp - -mko¡emp64 - - - ) - -678 #ifdeà -__USE_LARGEFILE64 - - -679  - $mko¡emp64 - (* -__‹m¶©e -,  -__æags -è - `__nÚnuÎ - ((1)è -__wur -; - -688 #iâdeà -__USE_FILE_OFFSET64 - - -689  - $mko¡emps - (* -__‹m¶©e -,  -__suffixËn -,  -__æags -) - -690 - `__nÚnuÎ - ((1)è -__wur -; - -692 #ifdeà -__REDIRECT - - -693  - `__REDIRECT - ( -mko¡emps -, (* -__‹m¶©e -,  -__suffixËn -, - -694  -__æags -), -mko¡emps64 -) - -695 - `__nÚnuÎ - ((1)è -__wur -; - -697  - #mko¡emps - -mko¡emps64 - - - ) - -700 #ifdeà -__USE_LARGEFILE64 - - -701  - $mko¡emps64 - (* -__‹m¶©e -,  -__suffixËn -,  -__æags -) - -702 - `__nÚnuÎ - ((1)è -__wur -; - -707 -__BEGIN_NAMESPACE_STD - - -712  - $sy¡em - ( -__cÚ¡ - * -__commªd -è -__wur -; - -713 -__END_NAMESPACE_STD - - -716 #ifdef -__USE_GNU - - -719 * - $ÿnÚiÿlize_fže_Çme - ( -__cÚ¡ - * -__Çme -) - -720 -__THROW - - `__nÚnuÎ - ((1)è -__wur -; - -723 #ià -defšed - -__USE_BSD - || defšed -__USE_XOPEN_EXTENDED - - -729 * - $»®·th - ( -__cÚ¡ - * -__»¡riù - -__Çme -, - -730 * -__»¡riù - -__»sÞved -è -__THROW - -__wur -; - -735 #iâdeà -__COMPAR_FN_T - - -736  - #__COMPAR_FN_T - - - ) - -737 (* - t__com·r_â_t -è( - t__cÚ¡ - *, __const *); - -739 #ifdef -__USE_GNU - - -740  -__com·r_â_t - - tcom·risÚ_â_t -; - -743 #ifdeà -__USE_GNU - - -744 (* - t__com·r_d_â_t -è( - t__cÚ¡ - *, __const *, *); - -747 -__BEGIN_NAMESPACE_STD - - -750 * - $b£¬ch - ( -__cÚ¡ - * -__key -, __cÚ¡ * -__ba£ -, - -751 -size_t - -__nmemb -, size_ˆ -__size -, -__com·r_â_t - -__com·r -) - -752 - `__nÚnuÎ - ((1, 2, 5)è -__wur -; - -756  - $qsÜt - (* -__ba£ -, -size_t - -__nmemb -, size_ˆ -__size -, - -757 -__com·r_â_t - -__com·r -è - `__nÚnuÎ - ((1, 4)); - -758 #ifdeà -__USE_GNU - - -759  - $qsÜt_r - (* -__ba£ -, -size_t - -__nmemb -, size_ˆ -__size -, - -760 -__com·r_d_â_t - -__com·r -, * -__¬g -) - -761 - `__nÚnuÎ - ((1, 4)); - -766  - $abs - ( -__x -è -__THROW - - `__©Œibu‹__ - (( -__cÚ¡__ -)è -__wur -; - -767  - $Ïbs - ( -__x -è -__THROW - - `__©Œibu‹__ - (( -__cÚ¡__ -)è -__wur -; - -768 -__END_NAMESPACE_STD - - -770 #ifdeà -__USE_ISOC99 - - -771 -__ex‹nsiÚ__ -  - $Îabs - ( -__x -) - -772 -__THROW - - `__©Œibu‹__ - (( -__cÚ¡__ -)è -__wur -; - -776 -__BEGIN_NAMESPACE_STD - - -780 -div_t - - $div - ( -__num” -,  -__d’om -) - -781 -__THROW - - `__©Œibu‹__ - (( -__cÚ¡__ -)è -__wur -; - -782 -ldiv_t - - $ldiv - ( -__num” -,  -__d’om -) - -783 -__THROW - - `__©Œibu‹__ - (( -__cÚ¡__ -)è -__wur -; - -784 -__END_NAMESPACE_STD - - -786 #ifdeà -__USE_ISOC99 - - -787 -__BEGIN_NAMESPACE_C99 - - -788 -__ex‹nsiÚ__ - -Îdiv_t - - $Îdiv - ( -__num” -, - -789  -__d’om -) - -790 -__THROW - - `__©Œibu‹__ - (( -__cÚ¡__ -)è -__wur -; - -791 -__END_NAMESPACE_C99 - - -795 #ià -defšed - -__USE_SVID - || defšed -__USE_XOPEN_EXTENDED - - -802 * - $ecvt - ( -__v®ue -,  -__ndig™ -, * -__»¡riù - -__deýt -, - -803 * -__»¡riù - -__sign -è -__THROW - - `__nÚnuÎ - ((3, 4)è -__wur -; - -808 * - $fcvt - ( -__v®ue -,  -__ndig™ -, * -__»¡riù - -__deýt -, - -809 * -__»¡riù - -__sign -è -__THROW - - `__nÚnuÎ - ((3, 4)è -__wur -; - -814 * - $gcvt - ( -__v®ue -,  -__ndig™ -, * -__buf -) - -815 -__THROW - - `__nÚnuÎ - ((3)è -__wur -; - -818 #ifdeà -__USE_MISC - - -820 * - $qecvt - ( -__v®ue -,  -__ndig™ -, - -821 * -__»¡riù - -__deýt -, *__»¡riù -__sign -) - -822 -__THROW - - `__nÚnuÎ - ((3, 4)è -__wur -; - -823 * - $qfcvt - ( -__v®ue -,  -__ndig™ -, - -824 * -__»¡riù - -__deýt -, *__»¡riù -__sign -) - -825 -__THROW - - `__nÚnuÎ - ((3, 4)è -__wur -; - -826 * - $qgcvt - ( -__v®ue -,  -__ndig™ -, * -__buf -) - -827 -__THROW - - `__nÚnuÎ - ((3)è -__wur -; - -832  - $ecvt_r - ( -__v®ue -,  -__ndig™ -, * -__»¡riù - -__deýt -, - -833 * -__»¡riù - -__sign -, *__»¡riù -__buf -, - -834 -size_t - -__Ën -è -__THROW - - `__nÚnuÎ - ((3, 4, 5)); - -835  - $fcvt_r - ( -__v®ue -,  -__ndig™ -, * -__»¡riù - -__deýt -, - -836 * -__»¡riù - -__sign -, *__»¡riù -__buf -, - -837 -size_t - -__Ën -è -__THROW - - `__nÚnuÎ - ((3, 4, 5)); - -839  - $qecvt_r - ( -__v®ue -,  -__ndig™ -, - -840 * -__»¡riù - -__deýt -, *__»¡riù -__sign -, - -841 * -__»¡riù - -__buf -, -size_t - -__Ën -) - -842 -__THROW - - `__nÚnuÎ - ((3, 4, 5)); - -843  - $qfcvt_r - ( -__v®ue -,  -__ndig™ -, - -844 * -__»¡riù - -__deýt -, *__»¡riù -__sign -, - -845 * -__»¡riù - -__buf -, -size_t - -__Ën -) - -846 -__THROW - - `__nÚnuÎ - ((3, 4, 5)); - -851 -__BEGIN_NAMESPACE_STD - - -854  - $mbËn - ( -__cÚ¡ - * -__s -, -size_t - -__n -è -__THROW - -__wur -; - -857  - $mbtowc - ( -wch¬_t - * -__»¡riù - -__pwc -, - -858 -__cÚ¡ - * -__»¡riù - -__s -, -size_t - -__n -è -__THROW - -__wur -; - -861  - $wùomb - (* -__s -, -wch¬_t - -__wch¬ -è -__THROW - -__wur -; - -865 -size_t - - $mb¡owcs - ( -wch¬_t - * -__»¡riù - -__pwcs -, - -866 -__cÚ¡ - * -__»¡riù - -__s -, -size_t - -__n -è -__THROW -; - -868 -size_t - - $wc¡ombs - (* -__»¡riù - -__s -, - -869 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__pwcs -, -size_t - -__n -) - -870 -__THROW -; - -871 -__END_NAMESPACE_STD - - -874 #ifdeà -__USE_SVID - - -879  - $½m©ch - ( -__cÚ¡ - * -__»¥Ú£ -è -__THROW - - `__nÚnuÎ - ((1)è -__wur -; - -883 #ifdeà -__USE_XOPEN_EXTENDED - - -890  - $g‘subÝt - (** -__»¡riù - -__ÝtiÚp -, - -891 * -__cÚ¡ - * -__»¡riù - -__tok’s -, - -892 ** -__»¡riù - -__v®u• -) - -893 -__THROW - - `__nÚnuÎ - ((1, 2, 3)è -__wur -; - -897 #ifdeà -__USE_XOPEN - - -899  - $£tkey - ( -__cÚ¡ - * -__key -è -__THROW - - `__nÚnuÎ - ((1)); - -905 #ifdeà -__USE_XOPEN2K - - -907  - $posix_Ý’± - ( -__oæag -è -__wur -; - -910 #ifdeà -__USE_XOPEN - - -915  - $g¿Á± - ( -__fd -è -__THROW -; - -919  - $uÆock± - ( -__fd -è -__THROW -; - -924 * - $±¢ame - ( -__fd -è -__THROW - -__wur -; - -927 #ifdeà -__USE_GNU - - -931  - $±¢ame_r - ( -__fd -, * -__buf -, -size_t - -__buæ’ -) - -932 -__THROW - - `__nÚnuÎ - ((2)); - -935  - `g‘± - (); - -938 #ifdeà -__USE_BSD - - -942  - $g‘lßdavg - ( -__lßdavg -[],  -__ÃËm -) - -943 -__THROW - - `__nÚnuÎ - ((1)); - -948 #ià -__USE_FORTIFY_LEVEL - > 0 && -defšed - -__ex‹º_®ways_šlše - - -949  - ~ - -951 #ifdeà -__LDBL_COMPAT - - -952  - ~ - -956 #undeà -__Ãed_m®loc_ªd_ÿÎoc - - -958 -__END_DECLS - - - @/usr/include/sys/cdefs.h - -20 #iâdef -_SYS_CDEFS_H - - -21  - #_SYS_CDEFS_H - 1 - - ) - -24 #iâdeà -_FEATURES_H - - -25  - ~<ã©u»s.h -> - -31 #ià -defšed - -__GNUC__ - && !defšed -__STDC__ - - -36 #undeà -__P - - -37 #undeà -__PMT - - -39 #ifdeà -__GNUC__ - - -46 #ià! -defšed - -__ýlu¥lus - && -__GNUC_PREREQ - (3, 3) - -47  - #__THROW - - `__©Œibu‹__ - (( -__nÙhrow__ -)) - - ) - -48  - #__NTH -( -fù -è - `__©Œibu‹__ - (( -__nÙhrow__ -)è - ) -fct - -50 #ià -defšed - -__ýlu¥lus - && -__GNUC_PREREQ - (2,8) - -51  - #__THROW - - `throw - () - - ) - -52  - #__NTH -( -fù -èfù - `throw - () - - ) - -54  - #__THROW - - - ) - -55  - #__NTH -( -fù -è - ) -fct - -61  - #__šlše - - - ) - -63  - #__THROW - - - ) - -64  - #__NTH -( -fù -è - ) -fct - -66  - #__cÚ¡ - cÚ¡ - - ) - -67  - #__sigÃd - sigÃd - - ) - -68  - #__vÞ©že - vÞ©že - - ) - -74  - #__P -( -¬gs -è - ) -args - -75  - #__PMT -( -¬gs -è - ) -args - -80  - #__CONCAT -( -x -, -y -èx ## - ) -y - -81  - #__STRING -( -x -è#x - - ) - -84  - #__±r_t - * - - ) - -85  - #__lÚg_doubË_t -  - - ) - -89 #ifdef -__ýlu¥lus - - -90  - #__BEGIN_DECLS - "C" { - - ) - -91  - #__END_DECLS - } - - ) - -93  - #__BEGIN_DECLS - - - ) - -94  - #__END_DECLS - - - ) - -103 #ià -defšed - -__ýlu¥lus - && defšed -_GLIBCPP_USE_NAMESPACES - - -104  - #__BEGIN_NAMESPACE_STD - -Çme¥aû - -¡d - { - - ) - -105  - #__END_NAMESPACE_STD - } - - ) - -106  - #__USING_NAMESPACE_STD -( -Çme -è -usšg - -¡d -::Çme; - - ) - -107  - #__BEGIN_NAMESPACE_C99 - -Çme¥aû - -__c99 - { - - ) - -108  - #__END_NAMESPACE_C99 - } - - ) - -109  - #__USING_NAMESPACE_C99 -( -Çme -è -usšg - -__c99 -::Çme; - - ) - -114  - #__BEGIN_NAMESPACE_STD - - - ) - -115  - #__END_NAMESPACE_STD - - - ) - -116  - #__USING_NAMESPACE_STD -( -Çme -) - - ) - -117  - #__BEGIN_NAMESPACE_C99 - - - ) - -118  - #__END_NAMESPACE_C99 - - - ) - -119  - #__USING_NAMESPACE_C99 -( -Çme -) - - ) - -124 #iâdeà -__BOUNDED_POINTERS__ - - -125  - #__bounded - - - ) - -126  - #__unbounded - - - ) - -127  - #__±rv®ue - - - ) - -132  - #__bos -( -±r -è - `__bužtš_objeù_size - (±r, -__USE_FORTIFY_LEVEL - > 1) - - ) - -133  - #__bos0 -( -±r -è - `__bužtš_objeù_size - (±r, 0) - - ) - -135 #ià -__GNUC_PREREQ - (4,3) - -136  - #__w¬ndeþ -( -Çme -, -msg -) \ - -137  - `Çme - (è - `__©Œibu‹__ -(( - `__w¬nšg__ - ( -msg -))) - - ) - -138  - #__w¬Ç‰r -( -msg -è - `__©Œibu‹__ -(( - `__w¬nšg__ - (msg))) - - ) - -139  - #__”rÜdeþ -( -Çme -, -msg -) \ - -140  - `Çme - (è - `__©Œibu‹__ -(( - `__”rÜ__ - ( -msg -))) - - ) - -142  - #__w¬ndeþ -( -Çme -, -msg -è  - `Çme - () - - ) - -143  - #__w¬Ç‰r -( -msg -) - - ) - -144  - #__”rÜdeþ -( -Çme -, -msg -è  - `Çme - () - - ) - -148 #ià -__GNUC_PREREQ - (2,97) - -150  - #__æex¬r - [] - - ) - -152 #ifdeà -__GNUC__ - - -153  - #__æex¬r - [0] - - ) - -155 #ià -defšed - -__STDC_VERSION__ - && __STDC_VERSION__ >= 199901L - -156  - #__æex¬r - [] - - ) - -159  - #__æex¬r - [1] - - ) - -175 #ià -defšed - -__GNUC__ - && __GNUC__ >= 2 - -177  - #__REDIRECT -( -Çme -, -´Ùo -, -®Ÿs -èÇm´ÙØ - `__asm__ - ( - `__ASMNAME - (#®Ÿs)) - - ) - -178 #ifdeà -__ýlu¥lus - - -179  - #__REDIRECT_NTH -( -Çme -, -´Ùo -, -®Ÿs -) \ - -180 -Çme - -´Ùo - -__THROW - - `__asm__ - ( - `__ASMNAME - (#®Ÿs)) - - ) - -182  - #__REDIRECT_NTH -( -Çme -, -´Ùo -, -®Ÿs -) \ - -183 -Çme - -´Ùo - - `__asm__ - ( - `__ASMNAME - (#®Ÿs)è -__THROW - - - ) - -185  - #__ASMNAME -( -úame -è - `__ASMNAME2 - ( -__USER_LABEL_PREFIX__ -, cÇme) - - ) - -186  - #__ASMNAME2 -( -´efix -, -úame -è - `__STRING - (´efixè - ) -cname - -199 #ià! -defšed - -__GNUC__ - || __GNUC__ < 2 - -200  - #__©Œibu‹__ -( -xyz -è - - ) - -206 #ià -__GNUC_PREREQ - (2,96) - -207  - #__©Œibu‹_m®loc__ - - `__©Œibu‹__ - (( -__m®loc__ -)) - - ) - -209  - #__©Œibu‹_m®loc__ - - - ) - -215 #ià -__GNUC_PREREQ - (2,96) - -216  - #__©Œibu‹_pu»__ - - `__©Œibu‹__ - (( -__pu»__ -)) - - ) - -218  - #__©Œibu‹_pu»__ - - - ) - -224 #ià -__GNUC_PREREQ - (3,1) - -225  - #__©Œibu‹_u£d__ - - `__©Œibu‹__ - (( -__u£d__ -)) - - ) - -226  - #__©Œibu‹_nošlše__ - - `__©Œibu‹__ - (( -__nošlše__ -)) - - ) - -228  - #__©Œibu‹_u£d__ - - `__©Œibu‹__ - (( -__unu£d__ -)) - - ) - -229  - #__©Œibu‹_nošlše__ - - - ) - -233 #ià -__GNUC_PREREQ - (3,2) - -234  - #__©Œibu‹_d•»ÿ‹d__ - - `__©Œibu‹__ - (( -__d•»ÿ‹d__ -)) - - ) - -236  - #__©Œibu‹_d•»ÿ‹d__ - - - ) - -245 #ià -__GNUC_PREREQ - (2,8) - -246  - #__©Œibu‹_fÜm©_¬g__ -( -x -è - `__©Œibu‹__ - (( - `__fÜm©_¬g__ - (x))) - - ) - -248  - #__©Œibu‹_fÜm©_¬g__ -( -x -è - - ) - -255 #ià -__GNUC_PREREQ - (2,97) - -256  - #__©Œibu‹_fÜm©_¡rfmÚ__ -( -a -, -b -) \ - -257 - `__©Œibu‹__ - (( - `__fÜm©__ - ( -__¡rfmÚ__ -, -a -, -b -))) - - ) - -259  - #__©Œibu‹_fÜm©_¡rfmÚ__ -( -a -, -b -è - - ) - -264 #ià -__GNUC_PREREQ - (3,3) - -265  - #__nÚnuÎ -( -·¿ms -è - `__©Œibu‹__ - (( -__nÚnuÎ__ -…¬ams)) - - ) - -267  - #__nÚnuÎ -( -·¿ms -) - - ) - -272 #ià -__GNUC_PREREQ - (3,4) - -273  - #__©Œibu‹_w¬n_unu£d_»suÉ__ - \ - -274 - `__©Œibu‹__ - (( -__w¬n_unu£d_»suÉ__ -)) - - ) - -275 #ià -__USE_FORTIFY_LEVEL - > 0 - -276  - #__wur - -__©Œibu‹_w¬n_unu£d_»suÉ__ - - - ) - -279  - #__©Œibu‹_w¬n_unu£d_»suÉ__ - - - ) - -281 #iâdeà -__wur - - -282  - #__wur - - - ) - -286 #ià -__GNUC_PREREQ - (3,2) - -287  - #__®ways_šlše - -__šlše - - `__©Œibu‹__ - (( -__®ways_šlše__ -)) - - ) - -289  - #__®ways_šlše - -__šlše - - - ) - -294 #ià! -defšed - -__ýlu¥lus - || -__GNUC_PREREQ - (4,3) - -295 #ià -defšed - -__GNUC_STDC_INLINE__ - || defšed -__ýlu¥lus - - -296  - #__ex‹º_šlše - -__šlše - - `__©Œibu‹__ - (( -__gnu_šlše__ -)) - - ) - -297 #ià -__GNUC_PREREQ - (4,3) - -298  - #__ex‹º_®ways_šlše - \ - -299 -__®ways_šlše - - `__©Œibu‹__ - (( -__gnu_šlše__ -, -__¬tificŸl__ -)) - - ) - -301  - #__ex‹º_®ways_šlše - \ - -302 -__®ways_šlše - - `__©Œibu‹__ - (( -__gnu_šlše__ -)) - - ) - -305  - #__ex‹º_šlše - -__šlše - - - ) - -306 #ià -__GNUC_PREREQ - (4,3) - -307  - #__ex‹º_®ways_šlše - \ - -308 -__®ways_šlše - - `__©Œibu‹__ - (( -__¬tificŸl__ -)) - - ) - -310  - #__ex‹º_®ways_šlše - -__®ways_šlše - - - ) - -317 #ià -__GNUC_PREREQ - (4,3) - -318  - #__va_¬g_·ck -(è - `__bužtš_va_¬g_·ck - () - - ) - -319  - #__va_¬g_·ck_Ën -(è - `__bužtš_va_¬g_·ck_Ën - () - - ) - -326 #ià! -__GNUC_PREREQ - (2,8) - -327  - #__ex‹nsiÚ__ - - - ) - -331 #ià! -__GNUC_PREREQ - (2,92) - -332  - #__»¡riù - - - ) - -338 #ià -__GNUC_PREREQ - (3,1è&& ! -defšed - -__GNUG__ - - -339  - #__»¡riù_¬r - -__»¡riù - - - ) - -341 #ifdeà -__GNUC__ - - -342  - #__»¡riù_¬r - - - ) - -344 #ià -defšed - -__STDC_VERSION__ - && __STDC_VERSION__ >= 199901L - -345  - #__»¡riù_¬r - -»¡riù - - - ) - -348  - #__»¡riù_¬r - - - ) - -353  - ~ - -355 #ià -defšed - -__LONG_DOUBLE_MATH_OPTIONAL - && defšed -__NO_LONG_DOUBLE_MATH - - -356  - #__LDBL_COMPAT - 1 - - ) - -357 #ifdeà -__REDIRECT - - -358  - #__LDBL_REDIR1 -( -Çme -, -´Ùo -, -®Ÿs -è - `__REDIRECT - (Çme,…rÙo,‡lŸs) - - ) - -359  - #__LDBL_REDIR -( -Çme -, -´Ùo -) \ - -360 - `__LDBL_REDIR1 - ( -Çme -, -´Ùo -, -__Ædbl_ -##Çme) - - ) - -361  - #__LDBL_REDIR1_NTH -( -Çme -, -´Ùo -, -®Ÿs -è - `__REDIRECT_NTH - (Çme,…rÙo,‡lŸs) - - ) - -362  - #__LDBL_REDIR_NTH -( -Çme -, -´Ùo -) \ - -363 - `__LDBL_REDIR1_NTH - ( -Çme -, -´Ùo -, -__Ædbl_ -##Çme) - - ) - -364  - #__LDBL_REDIR1_DECL -( -Çme -, -®Ÿs -) \ - -365 - `__ty³of - ( -Çme -èÇm - `__asm - ( - `__ASMNAME - (#®Ÿs)); - - ) - -366  - #__LDBL_REDIR_DECL -( -Çme -) \ - -367 - `__ty³of - ( -Çme -èÇm - `__asm - ( - `__ASMNAME - ("__Ædbl_" #Çme)); - - ) - -368  - #__REDIRECT_LDBL -( -Çme -, -´Ùo -, -®Ÿs -) \ - -369 - `__LDBL_REDIR1 - ( -Çme -, -´Ùo -, -__Ædbl_ -## -®Ÿs -) - - ) - -370  - #__REDIRECT_NTH_LDBL -( -Çme -, -´Ùo -, -®Ÿs -) \ - -371 - `__LDBL_REDIR1_NTH - ( -Çme -, -´Ùo -, -__Ædbl_ -## -®Ÿs -) - - ) - -374 #ià! -defšed - -__LDBL_COMPAT - || !defšed -__REDIRECT - - -375  - #__LDBL_REDIR1 -( -Çme -, -´Ùo -, -®Ÿs -èÇm - ) -proto - -376  - #__LDBL_REDIR -( -Çme -, -´Ùo -èÇm - ) -proto - -377  - #__LDBL_REDIR1_NTH -( -Çme -, -´Ùo -, -®Ÿs -èÇm´ÙØ -__THROW - - - ) - -378  - #__LDBL_REDIR_NTH -( -Çme -, -´Ùo -èÇm´ÙØ -__THROW - - - ) - -379  - #__LDBL_REDIR_DECL -( -Çme -) - - ) - -380 #ifdeà -__REDIRECT - - -381  - #__REDIRECT_LDBL -( -Çme -, -´Ùo -, -®Ÿs -è - `__REDIRECT - (Çme,…rÙo,‡lŸs) - - ) - -382  - #__REDIRECT_NTH_LDBL -( -Çme -, -´Ùo -, -®Ÿs -) \ - -383 - `__REDIRECT_NTH - ( -Çme -, -´Ùo -, -®Ÿs -) - - ) - - @/usr/include/alloca.h - -19 #iâdef -_ALLOCA_H - - -20  - #_ALLOCA_H - 1 - - ) - -22  - ~<ã©u»s.h -> - -24  - #__Ãed_size_t - - - ) - -25  - ~<¡ddef.h -> - -27 - g__BEGIN_DECLS - - -30 #undeà -®loÿ - - -33 * - $®loÿ - ( -size_t - -__size -è -__THROW -; - -35 #ifdef -__GNUC__ - - -36  - #®loÿ -( -size -è - `__bužtš_®loÿ - (size) - - ) - -39 -__END_DECLS - - - @/usr/include/bits/byteswap.h - -21 #ià! -defšed - -_BYTESWAP_H - && !defšed -_NETINET_IN_H - && !defšed -_ENDIAN_H - - -25 #iâdeà -_BITS_BYTESWAP_H - - -26  - #_BITS_BYTESWAP_H - 1 - - ) - -28  - ~ - -31  - #__bsw­_cÚ¡ªt_16 -( -x -) \ - -32 (((( -x -è>> 8è& 0xffè| (((xè& 0xffè<< 8)) - - ) - -34 #ià -defšed - -__GNUC__ - && __GNUC__ >= 2 - -35  - #__bsw­_16 -( -x -) \ - -36 ( -__ex‹nsiÚ__ - \ - -37 ({  -__v -, -__x - = ( -x -); \ - -38 ià( - `__bužtš_cÚ¡ªt_p - ( -__x -)) \ - -39 -__v - = - `__bsw­_cÚ¡ªt_16 - ( -__x -); \ - -41 - `__asm__ - ("rorw $8, %w0" \ - -42 : "ô" ( -__v -) \ - -43 : "0" ( -__x -) \ - -45 -__v -; })) - - ) - -48  - #__bsw­_16 -( -x -) \ - -49 ( -__ex‹nsiÚ__ - \ - -50 ({  -__x - = ( -x -); - `__bsw­_cÚ¡ªt_16 - (__x); })) - - ) - -55  - #__bsw­_cÚ¡ªt_32 -( -x -) \ - -56 (((( -x -) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ - -57 ((( -x -è& 0x0000ff00è<< 8è| (((xè& 0x000000ffè<< 24)) - - ) - -59 #ià -defšed - -__GNUC__ - && __GNUC__ >= 2 - -60 #ià -__WORDSIZE - =ð64 || ( -defšed - -__i486__ - || defšed -__³Áium__ - \ - -61 || -defšed - - g__³Áium´o__ - || defšed - g__³Áium4__ - \ - -62 || -defšed - - g__k8__ - || defšed - g__©hlÚ__ - \ - -63 || -defšed - - g__k6__ - || defšed - g__nocÚa__ - \ - -64 || -defšed - - g__cÜe2__ - || defšed - g__geode__ - \ - -65 || -defšed - - g__amdçm10__ -) - -68  - #__bsw­_32 -( -x -) \ - -69 ( -__ex‹nsiÚ__ - \ - -70 ({  -__v -, -__x - = ( -x -); \ - -71 ià( - `__bužtš_cÚ¡ªt_p - ( -__x -)) \ - -72 -__v - = - `__bsw­_cÚ¡ªt_32 - ( -__x -); \ - -74 - `__asm__ - ("bsw­ %0" : "ô" ( -__v -è: "0" ( -__x -)); \ - -75 -__v -; })) - - ) - -77  - #__bsw­_32 -( -x -) \ - -78 ( -__ex‹nsiÚ__ - \ - -79 ({  -__v -, -__x - = ( -x -); \ - -80 ià( - `__bužtš_cÚ¡ªt_p - ( -__x -)) \ - -81 -__v - = - `__bsw­_cÚ¡ªt_32 - ( -__x -); \ - -83 - `__asm__ - ("rorw $8, %w0;" \ - -86 : "ô" ( -__v -) \ - -87 : "0" ( -__x -) \ - -89 -__v -; })) - - ) - -92  - #__bsw­_32 -( -x -) \ - -93 ( -__ex‹nsiÚ__ - \ - -94 ({  -__x - = ( -x -); - `__bsw­_cÚ¡ªt_32 - (__x); })) - - ) - -98 #ià -defšed - -__GNUC__ - && __GNUC__ >= 2 - -100  - #__bsw­_cÚ¡ªt_64 -( -x -) \ - -101 (((( -x -) & 0xff00000000000000ull) >> 56) \ - -102 | ((( -x -) & 0x00ff000000000000ull) >> 40) \ - -103 | ((( -x -) & 0x0000ff0000000000ull) >> 24) \ - -104 | ((( -x -) & 0x000000ff00000000ull) >> 8) \ - -105 | ((( -x -) & 0x00000000ff000000ull) << 8) \ - -106 | ((( -x -) & 0x0000000000ff0000ull) << 24) \ - -107 | ((( -x -) & 0x000000000000ff00ull) << 40) \ - -108 | ((( -x -è& 0x00000000000000ffuÎè<< 56)) - - ) - -110 #ià -__WORDSIZE - == 64 - -111  - #__bsw­_64 -( -x -) \ - -112 ( -__ex‹nsiÚ__ - \ - -113 ({  -__v -, -__x - = ( -x -); \ - -114 ià( - `__bužtš_cÚ¡ªt_p - ( -__x -)) \ - -115 -__v - = - `__bsw­_cÚ¡ªt_64 - ( -__x -); \ - -117 - `__asm__ - ("bsw­ %q0" : "ô" ( -__v -è: "0" ( -__x -)); \ - -118 -__v -; })) - - ) - -120  - #__bsw­_64 -( -x -) \ - -121 ( -__ex‹nsiÚ__ - \ - -122 ({ uniÚ { -__ex‹nsiÚ__ -  -__Î -; \ - -123  -__l -[2]; } -__w -, -__r -; \ - -124 ià( - `__bužtš_cÚ¡ªt_p - ( -x -)) \ - -125 -__r -. -__Î - = - `__bsw­_cÚ¡ªt_64 - ( -x -); \ - -128 -__w -. -__Î - = ( -x -); \ - -129 -__r -. -__l -[0] = - `__bsw­_32 - ( -__w -.__l[1]); \ - -130 -__r -. -__l -[1] = - `__bsw­_32 - ( -__w -.__l[0]); \ - -132 -__r -. -__Î -; })) - - ) - - @/usr/include/bits/endian.h - -3 #iâdeà -_ENDIAN_H - - -7  - #__BYTE_ORDER - -__LITTLE_ENDIAN - - - ) - - @/usr/include/bits/libc-lock.h - -20 #iâdeà -_BITS_LIBC_LOCK_H - - -21  - #_BITS_LIBC_LOCK_H - 1 - - ) - -23  - ~<±h»ad.h -> - -24  - #__Ãed_NULL - - - ) - -25  - ~<¡ddef.h -> - -34 #ifdeà -_LIBC - - -35  - ~ - -36  - ~<Žs.h -> - -37  - ~<±h»ad-funùiÚs.h -> - -38  - ~<”ºo.h -> - -39  - ~ - -43 #ià -defšed - -_LIBC - || defšed -_IO_MTSAFE_IO - - -44 #ià( -defšed - -NOT_IN_libc - && !defšed -IS_IN_lib±h»ad -è|| !defšed -_LIBC - - -45  -±h»ad_mu‹x_t - - t__libc_lock_t -; - -46 ¡ruù { -±h»ad_mu‹x_t - - mmu‹x -; } - t__libc_lock_»cursive_t -; - -48  - t__libc_lock_t -; - -49 ¡ruù {  - mlock -;  - mút -; * - mowÃr -; } - t__libc_lock_»cursive_t -; - -51 ¡ruù { -±h»ad_mu‹x_t - - mmu‹x -; } - t__¹ld_lock_»cursive_t -; - -52 #ifdeà -__USE_UNIX98 - - -53  -±h»ad_rwlock_t - - t__libc_rwlock_t -; - -55  -__libc_rwlock_Ýaque__ - - t__libc_rwlock_t -; - -58  -__libc_lock_Ýaque__ - - t__libc_lock_t -; - -59  -__libc_lock_»cursive_Ýaque__ - - t__libc_lock_»cursive_t -; - -60  -__libc_rwlock_Ýaque__ - - t__libc_rwlock_t -; - -64  -±h»ad_key_t - - t__libc_key_t -; - -73  - #__libc_lock_defše -( -CLASS -, -NAME -) \ - -74 -CLASS - -__libc_lock_t - -NAME -; - - ) - -75  - #__libc_rwlock_defše -( -CLASS -, -NAME -) \ - -76 -CLASS - -__libc_rwlock_t - -NAME -; - - ) - -77  - #__libc_lock_defše_»cursive -( -CLASS -, -NAME -) \ - -78 -CLASS - -__libc_lock_»cursive_t - -NAME -; - - ) - -79  - #__¹ld_lock_defše_»cursive -( -CLASS -, -NAME -) \ - -80 -CLASS - -__¹ld_lock_»cursive_t - -NAME -; - - ) - -91 #ià -defšed - -_LIBC - && (!defšed -NOT_IN_libc - || defšed -IS_IN_lib±h»ad -) - -92 #ià -LLL_LOCK_INITIALIZER - == 0 - -93  - #__libc_lock_defše_š™Ÿlized -( -CLASS -, -NAME -) \ - -94 -CLASS - -__libc_lock_t - -NAME -; - - ) - -96  - #__libc_lock_defše_š™Ÿlized -( -CLASS -, -NAME -) \ - -97 -CLASS - -__libc_lock_t - -NAME - = -LLL_LOCK_INITIALIZER -; - - ) - -100 #ià -__LT_SPINLOCK_INIT - == 0 - -101  - #__libc_lock_defše_š™Ÿlized -( -CLASS -, -NAME -) \ - -102 -CLASS - -__libc_lock_t - -NAME -; - - ) - -104  - #__libc_lock_defše_š™Ÿlized -( -CLASS -, -NAME -) \ - -105 -CLASS - -__libc_lock_t - -NAME - = -PTHREAD_MUTEX_INITIALIZER -; - - ) - -109  - #__libc_rwlock_defše_š™Ÿlized -( -CLASS -, -NAME -) \ - -110 -CLASS - -__libc_rwlock_t - -NAME - = -PTHREAD_RWLOCK_INITIALIZER -; - - ) - -114 #ià -defšed - -_LIBC - && (!defšed -NOT_IN_libc - || defšed -IS_IN_lib±h»ad -) - -115 #ià -LLL_LOCK_INITIALIZER - == 0 - -116  - #__libc_lock_defše_š™Ÿlized_»cursive -( -CLASS -, -NAME -) \ - -117 -CLASS - -__libc_lock_»cursive_t - -NAME -; - - ) - -119  - #__libc_lock_defše_š™Ÿlized_»cursive -( -CLASS -, -NAME -) \ - -120 -CLASS - -__libc_lock_»cursive_t - -NAME - = -_LIBC_LOCK_RECURSIVE_INITIALIZER -; - - ) - -122  - #_LIBC_LOCK_RECURSIVE_INITIALIZER - \ - -123 { -LLL_LOCK_INITIALIZER -, 0, -NULL - } - - ) - -125  - #__libc_lock_defše_š™Ÿlized_»cursive -( -CLASS -, -NAME -) \ - -126 -CLASS - -__libc_lock_»cursive_t - -NAME - = -_LIBC_LOCK_RECURSIVE_INITIALIZER -; - - ) - -127  - #_LIBC_LOCK_RECURSIVE_INITIALIZER - \ - -128 { -PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP -} - - ) - -131  - #__¹ld_lock_defše_š™Ÿlized_»cursive -( -CLASS -, -NAME -) \ - -132 -CLASS - -__¹ld_lock_»cursive_t - -NAME - = -_RTLD_LOCK_RECURSIVE_INITIALIZER -; - - ) - -133  - #_RTLD_LOCK_RECURSIVE_INITIALIZER - \ - -134 { -PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP -} - - ) - -136  - #__¹ld_lock_š™Ÿlize -( -NAME -) \ - -137 (è(( -NAME -èð( -__¹ld_lock_»cursive_t -è -_RTLD_LOCK_RECURSIVE_INITIALIZER -) - - ) - -144 #ifdeà -__PIC__ - - -145  - #__libc_maybe_ÿÎ -( -FUNC -, -ARGS -, -ELSE -) \ - -146 ( - `__ex‹nsiÚ__ - ({ - `__ty³of - ( -FUNC -è* -_â - = (FUNC); \ - -147 -_â - !ð -NULL - ? (*_âè -ARGS - : -ELSE -; })) - - ) - -149  - #__libc_maybe_ÿÎ -( -FUNC -, -ARGS -, -ELSE -) \ - -150 ( -FUNC - !ð -NULL - ? FUNC -ARGS - : -ELSE -) - - ) - -154 #ià -defšed - -SHARED - && !defšed -NOT_IN_libc - - -155  - #PTFAVAIL -( -NAME -è -__libc_±h»ad_funùiÚs_š™ - - - ) - -156  - #__libc_±f_ÿÎ -( -FUNC -, -ARGS -, -ELSE -) \ - -157 ( -__libc_±h»ad_funùiÚs_š™ - ? - `PTHFCT_CALL - ( -±r_ -## -FUNC -, -ARGS -è: -ELSE -) - - ) - -158  - #__libc_±f_ÿÎ_®ways -( -FUNC -, -ARGS -) \ - -159 - `PTHFCT_CALL - ( -±r_ -## -FUNC -, -ARGS -) - - ) - -161  - #PTFAVAIL -( -NAME -è(NAME !ð -NULL -) - - ) - -162  - #__libc_±f_ÿÎ -( -FUNC -, -ARGS -, -ELSE -) \ - -163 - `__libc_maybe_ÿÎ - ( -FUNC -, -ARGS -, -ELSE -) - - ) - -164  - #__libc_±f_ÿÎ_®ways -( -FUNC -, -ARGS -) \ - -165 -FUNC - -ARGS - - - ) - -171 #ià -defšed - -_LIBC - && (!defšed -NOT_IN_libc - || defšed -IS_IN_lib±h»ad -) - -172  - #__libc_lock_š™ -( -NAME -è((NAMEèð -LLL_LOCK_INITIALIZER -, 0) - - ) - -174  - #__libc_lock_š™ -( -NAME -) \ - -175 - `__libc_maybe_ÿÎ - ( -__±h»ad_mu‹x_š™ -, (&( -NAME -), -NULL -), 0) - - ) - -177 #ià -defšed - -SHARED - && !defšed -NOT_IN_libc - - -180  - #__libc_rwlock_š™ -( -NAME -) \ - -181 ( - `__bužtš_mem£t - (&( -NAME -), '\0',  (NAME)), 0) - - ) - -183  - #__libc_rwlock_š™ -( -NAME -) \ - -184 - `__libc_maybe_ÿÎ - ( -__±h»ad_rwlock_š™ -, (&( -NAME -), -NULL -), 0) - - ) - -188 #ià -defšed - -_LIBC - && (!defšed -NOT_IN_libc - || defšed -IS_IN_lib±h»ad -) - -189  - #__libc_lock_š™_»cursive -( -NAME -) \ - -190 (( -NAME -èð( -__libc_lock_»cursive_t -è -_LIBC_LOCK_RECURSIVE_INITIALIZER -, 0) - - ) - -192  - #__libc_lock_š™_»cursive -( -NAME -) \ - -194 ià( -__±h»ad_mu‹x_š™ - !ð -NULL -) \ - -196 -±h»ad_mu‹x©Œ_t - -__©Œ -; \ - -197 - `__±h»ad_mu‹x©Œ_š™ - (& -__©Œ -); \ - -198 - `__±h»ad_mu‹x©Œ_£‰y³ - (& -__©Œ -, -PTHREAD_MUTEX_RECURSIVE_NP -); \ - -199 - `__±h»ad_mu‹x_š™ - (&( -NAME -). -mu‹x -, & -__©Œ -); \ - -200 - `__±h»ad_mu‹x©Œ_de¡roy - (& -__©Œ -); \ - -202 } 0) - - ) - -205  - #__¹ld_lock_š™_»cursive -( -NAME -) \ - -207 ià( -__±h»ad_mu‹x_š™ - !ð -NULL -) \ - -209 -±h»ad_mu‹x©Œ_t - -__©Œ -; \ - -210 - `__±h»ad_mu‹x©Œ_š™ - (& -__©Œ -); \ - -211 - `__±h»ad_mu‹x©Œ_£‰y³ - (& -__©Œ -, -PTHREAD_MUTEX_RECURSIVE_NP -); \ - -212 - `__±h»ad_mu‹x_š™ - (&( -NAME -). -mu‹x -, & -__©Œ -); \ - -213 - `__±h»ad_mu‹x©Œ_de¡roy - (& -__©Œ -); \ - -215 } 0) - - ) - -220 #ià -defšed - -_LIBC - && (!defšed -NOT_IN_libc - || defšed -IS_IN_lib±h»ad -) - -221  - #__libc_lock_fši -( -NAME -è((è0) - - ) - -223  - #__libc_lock_fši -( -NAME -) \ - -224 - `__libc_maybe_ÿÎ - ( -__±h»ad_mu‹x_de¡roy -, (&( -NAME -)), 0) - - ) - -226 #ià -defšed - -SHARED - && !defšed -NOT_IN_libc - - -227  - #__libc_rwlock_fši -( -NAME -è((è0) - - ) - -229  - #__libc_rwlock_fši -( -NAME -) \ - -230 - `__libc_maybe_ÿÎ - ( -__±h»ad_rwlock_de¡roy -, (&( -NAME -)), 0) - - ) - -234 #ià -defšed - -_LIBC - && (!defšed -NOT_IN_libc - || defšed -IS_IN_lib±h»ad -) - -235  - #__libc_lock_fši_»cursive -( -NAME -è((è0) - - ) - -237  - #__libc_lock_fši_»cursive -( -NAME -) \ - -238 - `__libc_maybe_ÿÎ - ( -__±h»ad_mu‹x_de¡roy -, (&( -NAME -)), 0) - - ) - -242 #ià -defšed - -_LIBC - && (!defšed -NOT_IN_libc - || defšed -IS_IN_lib±h»ad -) - -243 #ià -__OPTION_EGLIBC_BIG_MACROS - != 1 - -247  -__libc_lock_lock_â - ( -__libc_lock_t - *); - -248 -libc_hidd’_´Ùo - ( -__libc_lock_lock_â -); - -250 #ià -__OPTION_EGLIBC_BIG_MACROS - - -251  - #__libc_lock_lock -( -NAME -) \ - -252 ({ - `Îl_lock - ( -NAME -, -LLL_PRIVATE -); 0; }) - - ) - -254  - #__libc_lock_lock -( -NAME -) \ - -255 - `__libc_lock_lock_â - (&( -NAME -)) - - ) - -258  - #__libc_lock_lock -( -NAME -) \ - -259 - `__libc_maybe_ÿÎ - ( -__±h»ad_mu‹x_lock -, (&( -NAME -)), 0) - - ) - -261  - #__libc_rwlock_rdlock -( -NAME -) \ - -262 - `__libc_±f_ÿÎ - ( -__±h»ad_rwlock_rdlock -, (&( -NAME -)), 0) - - ) - -263  - #__libc_rwlock_w¾ock -( -NAME -) \ - -264 - `__libc_±f_ÿÎ - ( -__±h»ad_rwlock_w¾ock -, (&( -NAME -)), 0) - - ) - -267 #ià -defšed - -_LIBC - && (!defšed -NOT_IN_libc - || defšed -IS_IN_lib±h»ad -) - -268 #ià -__OPTION_EGLIBC_BIG_MACROS - != 1 - -272  -__libc_lock_lock_»cursive_â - ( -__libc_lock_»cursive_t - *); - -273 -libc_hidd’_´Ùo - ( -__libc_lock_lock_»cursive_â -); - -275 #ià -__OPTION_EGLIBC_BIG_MACROS - - -276  - #__libc_lock_lock_»cursive -( -NAME -) \ - -278 * -£lf - = -THREAD_SELF -; \ - -279 ià(( -NAME -). -owÃr - !ð -£lf -) \ - -281 - `Îl_lock - (( -NAME -). -lock -, -LLL_PRIVATE -); \ - -282 ( -NAME -). -owÃr - = -£lf -; \ - -284 ++( -NAME -). -út -; \ - -285 } 0) - - ) - -287  - #__libc_lock_lock_»cursive -( -NAME -) \ - -288 - `__libc_lock_lock_»cursive_â - (&( -NAME -)) - - ) - -291  - #__libc_lock_lock_»cursive -( -NAME -) \ - -292 - `__libc_maybe_ÿÎ - ( -__±h»ad_mu‹x_lock -, (&( -NAME -). -mu‹x -), 0) - - ) - -296 #ià -defšed - -_LIBC - && (!defšed -NOT_IN_libc - || defšed -IS_IN_lib±h»ad -) - -297 #ià -__OPTION_EGLIBC_BIG_MACROS - != 1 - -301  -__libc_lock_Œylock_â - ( -__libc_lock_t - *); - -302 -libc_hidd’_´Ùo - ( -__libc_lock_Œylock_â -); - -304 #ià -__OPTION_EGLIBC_BIG_MACROS - - -305  - #__libc_lock_Œylock -( -NAME -) \ - -306 - `Îl_Œylock - ( -NAME -) - - ) - -308  - #__libc_lock_Œylock -( -NAME -) \ - -309 - `__libc_lock_Œylock_â - (&( -NAME -)) - - ) - -312  - #__libc_lock_Œylock -( -NAME -) \ - -313 - `__libc_maybe_ÿÎ - ( -__±h»ad_mu‹x_Œylock -, (&( -NAME -)), 0) - - ) - -315  - #__libc_rwlock_Œyrdlock -( -NAME -) \ - -316 - `__libc_maybe_ÿÎ - ( -__±h»ad_rwlock_Œyrdlock -, (&( -NAME -)), 0) - - ) - -317  - #__libc_rwlock_Œyw¾ock -( -NAME -) \ - -318 - `__libc_maybe_ÿÎ - ( -__±h»ad_rwlock_Œyw¾ock -, (&( -NAME -)), 0) - - ) - -321 #ià -defšed - -_LIBC - && (!defšed -NOT_IN_libc - || defšed -IS_IN_lib±h»ad -) - -322 #ià -__OPTION_EGLIBC_BIG_MACROS - != 1 - -326  -__libc_lock_Œylock_»cursive_â - ( -__libc_lock_»cursive_t - *); - -327 -libc_hidd’_´Ùo - ( -__libc_lock_Œylock_»cursive_â -); - -329 #ià -__OPTION_EGLIBC_BIG_MACROS - - -330  - #__libc_lock_Œylock_»cursive -( -NAME -) \ - -332  -»suÉ - = 0; \ - -333 * -£lf - = -THREAD_SELF -; \ - -334 ià(( -NAME -). -owÃr - !ð -£lf -) \ - -336 ià( - `Îl_Œylock - (( -NAME -). -lock -) == 0) \ - -338 ( -NAME -). -owÃr - = -£lf -; \ - -339 ( -NAME -). -út - = 1; \ - -342 -»suÉ - = -EBUSY -; \ - -345 ++( -NAME -). -út -; \ - -346 -»suÉ -; \ - -347 }) - - ) - -349  - #__libc_lock_Œylock_»cursive -( -NAME -) \ - -350 - `__libc_lock_Œylock_»cursive_â - (&( -NAME -)) - - ) - -353  - #__libc_lock_Œylock_»cursive -( -NAME -) \ - -354 - `__libc_maybe_ÿÎ - ( -__±h»ad_mu‹x_Œylock -, (&( -NAME -)), 0) - - ) - -357  - #__¹ld_lock_Œylock_»cursive -( -NAME -) \ - -358 - `__libc_maybe_ÿÎ - ( -__±h»ad_mu‹x_Œylock -, (&( -NAME -). -mu‹x -), 0) - - ) - -361 #ià -defšed - -_LIBC - && (!defšed -NOT_IN_libc - || defšed -IS_IN_lib±h»ad -) - -362 #ià -__OPTION_EGLIBC_BIG_MACROS - != 1 - -366  -__libc_lock_uÆock_â - ( -__libc_lock_t - *); - -367 -libc_hidd’_´Ùo - ( -__libc_lock_uÆock_â -); - -369 #ià -__OPTION_EGLIBC_BIG_MACROS - - -370  - #__libc_lock_uÆock -( -NAME -) \ - -371 - `Îl_uÆock - ( -NAME -, -LLL_PRIVATE -) - - ) - -373  - #__libc_lock_uÆock -( -NAME -) \ - -374 - `__libc_lock_uÆock_â - (&( -NAME -)) - - ) - -377  - #__libc_lock_uÆock -( -NAME -) \ - -378 - `__libc_maybe_ÿÎ - ( -__±h»ad_mu‹x_uÆock -, (&( -NAME -)), 0) - - ) - -380  - #__libc_rwlock_uÆock -( -NAME -) \ - -381 - `__libc_±f_ÿÎ - ( -__±h»ad_rwlock_uÆock -, (&( -NAME -)), 0) - - ) - -384 #ià -defšed - -_LIBC - && (!defšed -NOT_IN_libc - || defšed -IS_IN_lib±h»ad -) - -385 #ià -__OPTION_EGLIBC_BIG_MACROS - != 1 - -389  -__libc_lock_uÆock_»cursive_â - ( -__libc_lock_»cursive_t - *); - -390 -libc_hidd’_´Ùo - ( -__libc_lock_uÆock_»cursive_â -); - -392 #ià -__OPTION_EGLIBC_BIG_MACROS - - -394  - #__libc_lock_uÆock_»cursive -( -NAME -) \ - -396 ià(--( -NAME -). -út - == 0) \ - -398 ( -NAME -). -owÃr - = -NULL -; \ - -399 - `Îl_uÆock - (( -NAME -). -lock -, -LLL_PRIVATE -); \ - -401 } 0) - - ) - -403  - #__libc_lock_uÆock_»cursive -( -NAME -) \ - -404 - `__libc_lock_uÆock_»cursive_â - (&( -NAME -)) - - ) - -407  - #__libc_lock_uÆock_»cursive -( -NAME -) \ - -408 - `__libc_maybe_ÿÎ - ( -__±h»ad_mu‹x_uÆock -, (&( -NAME -)), 0) - - ) - -411 #ià -defšed - -_LIBC - && defšed -SHARED - - -412  - #__¹ld_lock_deçuÉ_lock_»cursive -( -lock -) \ - -413 ++(( -±h»ad_mu‹x_t - *)( -lock -))-> -__d©a -. -__couÁ -; - - ) - -415  - #__¹ld_lock_deçuÉ_uÆock_»cursive -( -lock -) \ - -416 --(( -±h»ad_mu‹x_t - *)( -lock -))-> -__d©a -. -__couÁ -; - - ) - -418  - #__¹ld_lock_lock_»cursive -( -NAME -) \ - -419 - `GL -( -dl_¹ld_lock_»cursive -è(&( -NAME -). -mu‹x -) - - ) - -421  - #__¹ld_lock_uÆock_»cursive -( -NAME -) \ - -422 - `GL -( -dl_¹ld_uÆock_»cursive -è(&( -NAME -). -mu‹x -) - - ) - -424  - #__¹ld_lock_lock_»cursive -( -NAME -) \ - -425 - `__libc_maybe_ÿÎ - ( -__±h»ad_mu‹x_lock -, (&( -NAME -). -mu‹x -), 0) - - ) - -427  - #__¹ld_lock_uÆock_»cursive -( -NAME -) \ - -428 - `__libc_maybe_ÿÎ - ( -__±h»ad_mu‹x_uÆock -, (&( -NAME -). -mu‹x -), 0) - - ) - -432 #ià -PTHREAD_ONCE_INIT - == 0 - -435  - #__libc_Úû_defše -( -CLASS -, -NAME -) \ - -436 -CLASS - -±h»ad_Úû_t - -NAME - - - ) - -438  - #__libc_Úû_defše -( -CLASS -, -NAME -) \ - -439 -CLASS - -±h»ad_Úû_t - -NAME - = -PTHREAD_ONCE_INIT - - - ) - -443  - #__libc_Úû -( -ONCE_CONTROL -, -INIT_FUNCTION -) \ - -445 ià( - `PTFAVAIL - ( -__±h»ad_Úû -)) \ - -446 - `__libc_±f_ÿÎ_®ways - ( -__±h»ad_Úû -, (&( -ONCE_CONTROL -), \ - -447 -INIT_FUNCTION -)); \ - -448 ià(( -ONCE_CONTROL -è=ð -PTHREAD_ONCE_INIT -) { \ - -449 - `INIT_FUNCTION - (); \ - -450 ( -ONCE_CONTROL -) |= 2; \ - -452 } 0) - - ) - -459  -_±h»ad_þ—nup_push - ( -_±h»ad_þ—nup_bufãr - * -bufãr -, - -460 (* -routše -è(*), * -¬g -); - -461  - `_±h»ad_þ—nup_pÝ - ( -_±h»ad_þ—nup_bufãr - * -bufãr -, - -462  -execu‹ -); - -463  - `_±h»ad_þ—nup_push_deãr - ( -_±h»ad_þ—nup_bufãr - * -bufãr -, - -464 (* -routše -è(*), * -¬g -); - -465  - `_±h»ad_þ—nup_pÝ_»¡Üe - ( -_±h»ad_þ—nup_bufãr - * -bufãr -, - -466  -execu‹ -); - -469  - #__libc_þ—nup_»giÚ_¡¬t -( -DOIT -, -FCT -, -ARG -) \ - -470 {  -_±h»ad_þ—nup_bufãr - -_bufãr -; \ - -471  -_avaž -; \ - -472 ià( -DOIT -) { \ - -473 -_avaž - = - `PTFAVAIL - ( -_±h»ad_þ—nup_push_deãr -); \ - -474 ià( -_avaž -) { \ - -475 - `__libc_±f_ÿÎ_®ways - ( -_±h»ad_þ—nup_push_deãr -, (& -_bufãr -, -FCT -, \ - -476 -ARG -)); \ - -478 -_bufãr -. -__routše - = ( -FCT -); \ - -479 -_bufãr -. -__¬g - = ( -ARG -); \ - -482 -_avaž - = 0; \ - -483 } - - ) - -486  - #__libc_þ—nup_»giÚ_’d -( -DOIT -) \ - -487 ià( -_avaž -) { \ - -488 - `__libc_±f_ÿÎ_®ways - ( -_±h»ad_þ—nup_pÝ_»¡Üe -, (& -_bufãr -, -DOIT -));\ - -489 } ià( -DOIT -) \ - -490 -_bufãr -. - `__routše - (_bufãr. -__¬g -); \ - -491 - } - - ) -} - -494  - #__libc_þ—nup_’d -( -DOIT -) \ - -495 ià( -_avaž -) { \ - -496 - `__libc_±f_ÿÎ_®ways - ( -_±h»ad_þ—nup_pÝ_»¡Üe -, (& -_bufãr -, -DOIT -));\ - -497 } ià( -DOIT -) \ - -498 -_bufãr -. - `__routše - (_bufãr. -__¬g -) - - ) - -502 -__ex‹º_šlše -  - -503 - $__libc_þ—nup_routše - ( -__±h»ad_þ—nup_äame - * -f -) - -505 ià( -f --> -__do_™ -) - -506 -f --> - `__ÿnûl_routše - (f-> -__ÿnûl_¬g -); - -507 - } -} - -509  - #__libc_þ—nup_push -( -fù -, -¬g -) \ - -511  -__±h»ad_þ—nup_äame - -__þäame - \ - -512 - `__©Œibu‹__ - (( - `__þ—nup__ - ( -__libc_þ—nup_routše -))) \ - -513 ð{ . -__ÿnûl_routše - = ( -fù -), . -__ÿnûl_¬g - = ( -¬g -), \ - -514 . -__do_™ - = 1 }; - - ) - -516  - #__libc_þ—nup_pÝ -( -execu‹ -) \ - -517 -__þäame -. -__do_™ - = ( -execu‹ -); \ - -518 } 0) - - ) - -522  - #__libc_key_ü—‹ -( -KEY -, -DESTRUCTOR -) \ - -523 - `__libc_±f_ÿÎ - ( -__±h»ad_key_ü—‹ -, ( -KEY -, -DESTRUCTOR -), 1) - - ) - -526  - #__libc_g‘¥ecific -( -KEY -) \ - -527 - `__libc_±f_ÿÎ - ( -__±h»ad_g‘¥ecific -, ( -KEY -), -NULL -) - - ) - -530  - #__libc_£t¥ecific -( -KEY -, -VALUE -) \ - -531 - `__libc_±f_ÿÎ - ( -__±h»ad_£t¥ecific -, ( -KEY -, -VALUE -), 0) - - ) - -537  - #__libc_©fÜk -( -PREPARE -, -PARENT -, -CHILD -) \ - -538 - `__»gi¡”_©fÜk - ( -PREPARE -, -PARENT -, -CHILD -, -NULL -) - - ) - -539  -__»gi¡”_©fÜk - ((* -__´•¬e -) (), - -540 (* -__·»Á -) (), - -541 (* -__chžd -) (), - -542 * -__dso_hªdË -); - -547  - `__±h»ad_mu‹x_š™ - ( -±h»ad_mu‹x_t - * -__mu‹x -, - -548 -__cÚ¡ - -±h»ad_mu‹x©Œ_t - * -__mu‹x_©Œ -); - -550  - `__±h»ad_mu‹x_de¡roy - ( -±h»ad_mu‹x_t - * -__mu‹x -); - -552  - `__±h»ad_mu‹x_Œylock - ( -±h»ad_mu‹x_t - * -__mu‹x -); - -554  - `__±h»ad_mu‹x_lock - ( -±h»ad_mu‹x_t - * -__mu‹x -); - -556  - `__±h»ad_mu‹x_uÆock - ( -±h»ad_mu‹x_t - * -__mu‹x -); - -558  - `__±h»ad_mu‹x©Œ_š™ - ( -±h»ad_mu‹x©Œ_t - * -__©Œ -); - -560  - `__±h»ad_mu‹x©Œ_de¡roy - ( -±h»ad_mu‹x©Œ_t - * -__©Œ -); - -562  - `__±h»ad_mu‹x©Œ_£‰y³ - ( -±h»ad_mu‹x©Œ_t - * -__©Œ -, - -563  -__kšd -); - -565 #ifdeà -__USE_UNIX98 - - -566  - `__±h»ad_rwlock_š™ - ( -±h»ad_rwlock_t - * -__rwlock -, - -567 -__cÚ¡ - -±h»ad_rwlock©Œ_t - * -__©Œ -); - -569  - `__±h»ad_rwlock_de¡roy - ( -±h»ad_rwlock_t - * -__rwlock -); - -571  - `__±h»ad_rwlock_rdlock - ( -±h»ad_rwlock_t - * -__rwlock -); - -573  - `__±h»ad_rwlock_Œyrdlock - ( -±h»ad_rwlock_t - * -__rwlock -); - -575  - `__±h»ad_rwlock_w¾ock - ( -±h»ad_rwlock_t - * -__rwlock -); - -577  - `__±h»ad_rwlock_Œyw¾ock - ( -±h»ad_rwlock_t - * -__rwlock -); - -579  - `__±h»ad_rwlock_uÆock - ( -±h»ad_rwlock_t - * -__rwlock -); - -582  - `__±h»ad_key_ü—‹ - ( -±h»ad_key_t - * -__key -, - -583 (* -__de¡r_funùiÚ -) (*)); - -585  - `__±h»ad_£t¥ecific - ( -±h»ad_key_t - -__key -, - -586 -__cÚ¡ - * -__poš‹r -); - -588 * - `__±h»ad_g‘¥ecific - ( -±h»ad_key_t - -__key -); - -590  - `__±h»ad_Úû - ( -±h»ad_Úû_t - * -__Úû_cÚŒÞ -, - -591 (* -__š™_routše -) ()); - -593  - `__±h»ad_©fÜk - ((* -__´•¬e -) (), - -594 (* -__·»Á -) (), - -595 (* -__chžd -) ()); - -601 #iâdeà -__NO_WEAK_PTHREAD_ALIASES - - -602 #ifdeà -w—k_ex‹º - - -603 #ià -_LIBC - - -604  - ~ - -606  - #BP_SYM -( -sym -è - ) -sym - -608 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_mu‹x_š™ -)) - -609 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_mu‹x_de¡roy -)) - -610 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_mu‹x_lock -)) - -611 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_mu‹x_Œylock -)) - -612 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_mu‹x_uÆock -)) - -613 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_mu‹x©Œ_š™ -)) - -614 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_mu‹x©Œ_de¡roy -)) - -615 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_mu‹x©Œ_£‰y³ -)) - -616 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_rwlock_š™ -)) - -617 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_rwlock_de¡roy -)) - -618 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_rwlock_rdlock -)) - -619 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_rwlock_Œyrdlock -)) - -620 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_rwlock_w¾ock -)) - -621 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_rwlock_Œyw¾ock -)) - -622 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_rwlock_uÆock -)) - -623 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_key_ü—‹ -)) - -624 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_£t¥ecific -)) - -625 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_g‘¥ecific -)) - -626 - `w—k_ex‹º - ( - $BP_SYM - ( -__±h»ad_Úû -)) - -627 - $w—k_ex‹º - ( -__±h»ad_š™Ÿlize -) - -628 - $w—k_ex‹º - ( -__±h»ad_©fÜk -) - -629 - `w—k_ex‹º - ( - $BP_SYM - ( -_±h»ad_þ—nup_push_deãr -)) - -630 - `w—k_ex‹º - ( - $BP_SYM - ( -_±h»ad_þ—nup_pÝ_»¡Üe -)) - -631 - `w—k_ex‹º - ( - $BP_SYM - ( -±h»ad_£tÿnûl¡©e -)) - -633 #´agm¨ -w—k - -__±h»ad_mu‹x_š™ - - -634 #´agm¨ -w—k - -__±h»ad_mu‹x_de¡roy - - -635 #´agm¨ -w—k - -__±h»ad_mu‹x_lock - - -636 #´agm¨ -w—k - -__±h»ad_mu‹x_Œylock - - -637 #´agm¨ -w—k - -__±h»ad_mu‹x_uÆock - - -638 #´agm¨ -w—k - -__±h»ad_mu‹x©Œ_š™ - - -639 #´agm¨ -w—k - -__±h»ad_mu‹x©Œ_de¡roy - - -640 #´agm¨ -w—k - -__±h»ad_mu‹x©Œ_£‰y³ - - -641 #´agm¨ -w—k - -__±h»ad_rwlock_de¡roy - - -642 #´agm¨ -w—k - -__±h»ad_rwlock_rdlock - - -643 #´agm¨ -w—k - -__±h»ad_rwlock_Œyrdlock - - -644 #´agm¨ -w—k - -__±h»ad_rwlock_w¾ock - - -645 #´agm¨ -w—k - -__±h»ad_rwlock_Œyw¾ock - - -646 #´agm¨ -w—k - -__±h»ad_rwlock_uÆock - - -647 #´agm¨ -w—k - -__±h»ad_key_ü—‹ - - -648 #´agm¨ -w—k - -__±h»ad_£t¥ecific - - -649 #´agm¨ -w—k - -__±h»ad_g‘¥ecific - - -650 #´agm¨ -w—k - -__±h»ad_Úû - - -651 #´agm¨ -w—k - -__±h»ad_š™Ÿlize - - -652 #´agm¨ -w—k - -__±h»ad_©fÜk - - -653 #´agm¨ -w—k - -_±h»ad_þ—nup_push_deãr - - -654 #´agm¨ -w—k - -_±h»ad_þ—nup_pÝ_»¡Üe - - -655 #´agm¨ -w—k - -±h»ad_£tÿnûl¡©e - - - @/usr/include/bits/stdlib-ldbl.h - -20 #iâdeà -_STDLIB_H - - -24 #ifdef -__USE_ISOC99 - - -25 -__BEGIN_NAMESPACE_C99 - - -26 - $__LDBL_REDIR1_DECL - ( -¡¹Þd -, -¡¹od -) - -27 -__END_NAMESPACE_C99 - - -30 #ifdeà -__USE_GNU - - -31 - $__LDBL_REDIR1_DECL - ( -¡¹Þd_l -, -¡¹od_l -) - -34 #ià -defšed - -__USE_SVID - || defšed -__USE_XOPEN_EXTENDED - - -35 #ifdeà -__USE_MISC - - -36 - $__LDBL_REDIR1_DECL - ( -qecvt -, -ecvt -) - -37 - $__LDBL_REDIR1_DECL - ( -qfcvt -, -fcvt -) - -38 - $__LDBL_REDIR1_DECL - ( -qgcvt -, -gcvt -) - -39 - $__LDBL_REDIR1_DECL - ( -qecvt_r -, -ecvt_r -) - -40 - $__LDBL_REDIR1_DECL - ( -qfcvt_r -, -fcvt_r -) - - @/usr/include/bits/stdlib.h - -20 #iâdeà -_STDLIB_H - - -24 * - $__»®·th_chk - ( -__cÚ¡ - * -__»¡riù - -__Çme -, - -25 * -__»¡riù - -__»sÞved -, - -26 -size_t - -__»sÞvedËn -è -__THROW - -__wur -; - -27 * - `__REDIRECT_NTH - ( -__»®·th_®Ÿs -, - -28 ( -__cÚ¡ - * -__»¡riù - -__Çme -, - -29 * -__»¡riù - -__»sÞved -), -»®·th -è -__wur -; - -30 * - `__REDIRECT_NTH - ( -__»®·th_chk_w¬n -, - -31 ( -__cÚ¡ - * -__»¡riù - -__Çme -, - -32 * -__»¡riù - -__»sÞved -, - -33 -size_t - -__»sÞvedËn -), -__»®·th_chk -è -__wur - - -34 - `__w¬Ç‰r - ("second‡rgument of„ealpath must beƒither NULL or‡t " - -37 -__ex‹º_®ways_šlše - -__wur - * - -38 - `__NTH - ( - $»®·th - ( -__cÚ¡ - * -__»¡riù - -__Çme -, *__»¡riù -__»sÞved -)) - -40 ià( - `__bos - ( -__»sÞved -è!ð( -size_t -) -1) - -42 #ià -defšed - -_LIBC_LIMITS_H_ - && defšed -PATH_MAX - - -43 ià( - `__bos - ( -__»sÞved -è< -PATH_MAX -) - -44  - `__»®·th_chk_w¬n - ( -__Çme -, -__»sÞved -, - `__bos - (__resolved)); - -46  - `__»®·th_chk - ( -__Çme -, -__»sÞved -, - `__bos - (__resolved)); - -49  - `__»®·th_®Ÿs - ( -__Çme -, -__»sÞved -); - -50 - } -} - -53  - $__±¢ame_r_chk - ( -__fd -, * -__buf -, -size_t - -__buæ’ -, - -54 -size_t - -__Ä—l -è -__THROW - - `__nÚnuÎ - ((2)); - -55  - `__REDIRECT_NTH - ( -__±¢ame_r_®Ÿs -, ( -__fd -, * -__buf -, - -56 -size_t - -__buæ’ -), -±¢ame_r -) - -57 - `__nÚnuÎ - ((2)); - -58  - `__REDIRECT_NTH - ( -__±¢ame_r_chk_w¬n -, - -59 ( -__fd -, * -__buf -, -size_t - -__buæ’ -, - -60 -size_t - -__Ä—l -), -__±¢ame_r_chk -) - -61 - `__nÚnuÎ - ((2)è - `__w¬Ç‰r - ("ptsname_r called with buflen biggerhan " - -64 -__ex‹º_®ways_šlše -  - -65 - `__NTH - ( - $±¢ame_r - ( -__fd -, * -__buf -, -size_t - -__buæ’ -)) - -67 ià( - `__bos - ( -__buf -è!ð( -size_t -) -1) - -69 ià(! - `__bužtš_cÚ¡ªt_p - ( -__buæ’ -)) - -70  - `__±¢ame_r_chk - ( -__fd -, -__buf -, -__buæ’ -, - `__bos - (__buf)); - -71 ià( -__buæ’ - > - `__bos - ( -__buf -)) - -72  - `__±¢ame_r_chk_w¬n - ( -__fd -, -__buf -, -__buæ’ -, - `__bos - (__buf)); - -74  - `__±¢ame_r_®Ÿs - ( -__fd -, -__buf -, -__buæ’ -); - -75 - } -} - -78  - $__wùomb_chk - (* -__s -, -wch¬_t - -__wch¬ -, -size_t - -__buæ’ -) - -79 -__THROW - -__wur -; - -80  - `__REDIRECT_NTH - ( -__wùomb_®Ÿs -, (* -__s -, -wch¬_t - -__wch¬ -), - -81 -wùomb -è -__wur -; - -83 -__ex‹º_®ways_šlše - -__wur -  - -84 - `__NTH - ( - $wùomb - (* -__s -, -wch¬_t - -__wch¬ -)) - -89  - #__STDLIB_MB_LEN_MAX - 16 - - ) - -90 #ià -defšed - -MB_LEN_MAX - && MB_LEN_MAX !ð -__STDLIB_MB_LEN_MAX - - -93 ià( - `__bos - ( -__s -è!ð( -size_t -è-1 && -__STDLIB_MB_LEN_MAX - > __bos (__s)) - -94  - `__wùomb_chk - ( -__s -, -__wch¬ -, - `__bos - (__s)); - -95  - `__wùomb_®Ÿs - ( -__s -, -__wch¬ -); - -96 - } -} - -99 -size_t - - $__mb¡owcs_chk - ( -wch¬_t - * -__»¡riù - -__d¡ -, - -100 -__cÚ¡ - * -__»¡riù - -__¤c -, - -101 -size_t - -__Ën -, size_ˆ -__d¡Ën -è -__THROW -; - -102 -size_t - - `__REDIRECT_NTH - ( -__mb¡owcs_®Ÿs -, - -103 ( -wch¬_t - * -__»¡riù - -__d¡ -, - -104 -__cÚ¡ - * -__»¡riù - -__¤c -, - -105 -size_t - -__Ën -), -mb¡owcs -); - -106 -size_t - - `__REDIRECT_NTH - ( -__mb¡owcs_chk_w¬n -, - -107 ( -wch¬_t - * -__»¡riù - -__d¡ -, - -108 -__cÚ¡ - * -__»¡riù - -__¤c -, - -109 -size_t - -__Ën -, size_ˆ -__d¡Ën -), -__mb¡owcs_chk -) - -110 - `__w¬Ç‰r - ("mbstowcs called with dst buffer smallerhan†en " - -113 -__ex‹º_®ways_šlše - -size_t - - -114 - `__NTH - ( - $mb¡owcs - ( -wch¬_t - * -__»¡riù - -__d¡ -, -__cÚ¡ - *__»¡riù -__¤c -, - -115 -size_t - -__Ën -)) - -117 ià( - `__bos - ( -__d¡ -è!ð( -size_t -) -1) - -119 ià(! - `__bužtš_cÚ¡ªt_p - ( -__Ën -)) - -120  - `__mb¡owcs_chk - ( -__d¡ -, -__¤c -, -__Ën -, - -121 - `__bos - ( -__d¡ -è/  ( -wch¬_t -)); - -123 ià( -__Ën - > - `__bos - ( -__d¡ -è/  ( -wch¬_t -)) - -124  - `__mb¡owcs_chk_w¬n - ( -__d¡ -, -__¤c -, -__Ën -, - -125 - `__bos - ( -__d¡ -è/  ( -wch¬_t -)); - -127  - `__mb¡owcs_®Ÿs - ( -__d¡ -, -__¤c -, -__Ën -); - -128 - } -} - -131 -size_t - - $__wc¡ombs_chk - (* -__»¡riù - -__d¡ -, - -132 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, - -133 -size_t - -__Ën -, size_ˆ -__d¡Ën -è -__THROW -; - -134 -size_t - - `__REDIRECT_NTH - ( -__wc¡ombs_®Ÿs -, - -135 (* -__»¡riù - -__d¡ -, - -136 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, - -137 -size_t - -__Ën -), -wc¡ombs -); - -138 -size_t - - `__REDIRECT_NTH - ( -__wc¡ombs_chk_w¬n -, - -139 (* -__»¡riù - -__d¡ -, - -140 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, - -141 -size_t - -__Ën -, size_ˆ -__d¡Ën -), -__wc¡ombs_chk -) - -142 - `__w¬Ç‰r - ("wcstombs called with dst buffer smallerhan†en"); - -144 -__ex‹º_®ways_šlše - -size_t - - -145 - `__NTH - ( - $wc¡ombs - (* -__»¡riù - -__d¡ -, -__cÚ¡ - -wch¬_t - *__»¡riù -__¤c -, - -146 -size_t - -__Ën -)) - -148 ià( - `__bos - ( -__d¡ -è!ð( -size_t -) -1) - -150 ià(! - `__bužtš_cÚ¡ªt_p - ( -__Ën -)) - -151  - `__wc¡ombs_chk - ( -__d¡ -, -__¤c -, -__Ën -, - `__bos - (__dst)); - -152 ià( -__Ën - > - `__bos - ( -__d¡ -)) - -153  - `__wc¡ombs_chk_w¬n - ( -__d¡ -, -__¤c -, -__Ën -, - `__bos - (__dst)); - -155  - `__wc¡ombs_®Ÿs - ( -__d¡ -, -__¤c -, -__Ën -); - -156 - } -} - - @/usr/include/bits/waitflags.h - -20 #ià! -defšed - -_SYS_WAIT_H - && !defšed -_STDLIB_H - - -26  - #WNOHANG - 1 - - ) - -27  - #WUNTRACED - 2 - - ) - -30  - #WSTOPPED - 2 - - ) - -31  - #WEXITED - 4 - - ) - -32  - #WCONTINUED - 8 - - ) - -33  - #WNOWAIT - 0x01000000 - - ) - -35  - #__WNOTHREAD - 0x20000000 - - ) - -37  - #__WALL - 0x40000000 - - ) - -38  - #__WCLONE - 0x80000000 - - ) - - @/usr/include/bits/waitstatus.h - -20 #ià! -defšed - -_SYS_WAIT_H - && !defšed -_STDLIB_H - - -29  - #__WEXITSTATUS -( -¡©us -è(((¡©usè& 0xff00è>> 8) - - ) - -32  - #__WTERMSIG -( -¡©us -è((¡©usè& 0x7f) - - ) - -35  - #__WSTOPSIG -( -¡©us -è - `__WEXITSTATUS -(¡©us) - - ) - -38  - #__WIFEXITED -( -¡©us -è( - `__WTERMSIG -(¡©usè=ð0) - - ) - -41  - #__WIFSIGNALED -( -¡©us -) \ - -42 (((sigÃd è((( -¡©us -è& 0x7fè+ 1è>> 1è> 0) - - ) - -45  - #__WIFSTOPPED -( -¡©us -è(((¡©usè& 0xffè=ð0x7f) - - ) - -49 #ifdeà -WCONTINUED - - -50  - #__WIFCONTINUED -( -¡©us -è((¡©usè=ð -__W_CONTINUED -) - - ) - -54  - #__WCOREDUMP -( -¡©us -è((¡©usè& -__WCOREFLAG -) - - ) - -57  - #__W_EXITCODE -( -»t -, -sig -è(Ô‘è<< 8 | (sig)) - - ) - -58  - #__W_STOPCODE -( -sig -è((sigè<< 8 | 0x7f) - - ) - -59  - #__W_CONTINUED - 0xffff - - ) - -60  - #__WCOREFLAG - 0x80 - - ) - -63 #ifdef -__USE_BSD - - -65  - ~<’dŸn.h -> - -67  - uwa™ - - -69  - mw_¡©us -; - -72 #if -__BYTE_ORDER - =ð -__LITTLE_ENDIAN - - -73  - m__w_‹rmsig -:7; - -74  - m__w_cÜedump -:1; - -75  - m__w_»tcode -:8; - -78 #if -__BYTE_ORDER - =ð -__BIG_ENDIAN - - -80  - m__w_»tcode -:8; - -81  - m__w_cÜedump -:1; - -82  - m__w_‹rmsig -:7; - -84 } - m__wa™_‹rmš©ed -; - -87 #if -__BYTE_ORDER - =ð -__LITTLE_ENDIAN - - -88  - m__w_¡Ýv® -:8; - -89  - m__w_¡Ýsig -:8; - -92 #if -__BYTE_ORDER - =ð -__BIG_ENDIAN - - -94  - m__w_¡Ýsig -:8; - -95  - m__w_¡Ýv® -:8; - -97 } - m__wa™_¡Ý³d -; - -100  - #w_‹rmsig - -__wa™_‹rmš©ed -. -__w_‹rmsig - - - ) - -101  - #w_cÜedump - -__wa™_‹rmš©ed -. -__w_cÜedump - - - ) - -102  - #w_»tcode - -__wa™_‹rmš©ed -. -__w_»tcode - - - ) - -103  - #w_¡Ýsig - -__wa™_¡Ý³d -. -__w_¡Ýsig - - - ) - -104  - #w_¡Ýv® - -__wa™_¡Ý³d -. -__w_¡Ýv® - - - ) - - @/usr/include/gconv.h - -23 #iâdeà -_GCONV_H - - -24  - #_GCONV_H - 1 - - ) - -26  - ~<ã©u»s.h -> - -27  - #__Ãed_mb¡©e_t - - - ) - -28  - #__Ãed_wšt_t - - - ) - -29  - ~ - -30  - #__Ãed_size_t - - - ) - -31  - #__Ãed_wch¬_t - - - ) - -32  - ~<¡ddef.h -> - -35  - #__UNKNOWN_10646_CHAR - (( -wch¬_t -è0xfffd) - - ) - -40 - m__GCONV_OK - = 0, - -41 - m__GCONV_NOCONV -, - -42 - m__GCONV_NODB -, - -43 - m__GCONV_NOMEM -, - -45 - m__GCONV_EMPTY_INPUT -, - -46 - m__GCONV_FULL_OUTPUT -, - -47 - m__GCONV_ILLEGAL_INPUT -, - -48 - m__GCONV_INCOMPLETE_INPUT -, - -50 - m__GCONV_ILLEGAL_DESCRIPTOR -, - -51 - m__GCONV_INTERNAL_ERROR - - -58 - m__GCONV_IS_LAST - = 0x0001, - -59 - m__GCONV_IGNORE_ERRORS - = 0x0002 - -64  - g__gcÚv_¡• -; - -65  - g__gcÚv_¡•_d©a -; - -66  - g__gcÚv_lßded_objeù -; - -67  - g__gcÚv_Œªs_d©a -; - -71 (* - t__gcÚv_fù -è( - t__gcÚv_¡• - *,  - t__gcÚv_¡•_d©a - *, - -72 - t__cÚ¡ - **, __const *, - -73 **, - tsize_t - *, , ); - -76  - $wšt_t - (* - t__gcÚv_btowc_fù -è( - t__gcÚv_¡• - *, ); - -79 (* - t__gcÚv_š™_fù -è( - t__gcÚv_¡• - *); - -80 (* - t__gcÚv_’d_fù -è( - t__gcÚv_¡• - *); - -84 (* - t__gcÚv_Œªs_fù -è( - t__gcÚv_¡• - *, - -85  - t__gcÚv_¡•_d©a - *, *, - -86 - t__cÚ¡ - *, - -87 - t__cÚ¡ - **, - -88 - t__cÚ¡ - *, **, - -89 - tsize_t - *); - -92 (* - t__gcÚv_Œªs_cÚ‹xt_fù -è(*, - t__cÚ¡ - *, - -93 - t__cÚ¡ - *, - -97 (* - t__gcÚv_Œªs_qu”y_fù -è( - t__cÚ¡ - *, __const ***, - -98 - tsize_t - *); - -101 (* - t__gcÚv_Œªs_š™_fù -) (**, const *); - -102 (* - t__gcÚv_Œªs_’d_fù -) (*); - -104  - s__gcÚv_Œªs_d©a - - -107 -__gcÚv_Œªs_fù - -__Œªs_fù -; - -108 -__gcÚv_Œªs_cÚ‹xt_fù - -__Œªs_cÚ‹xt_fù -; - -109 -__gcÚv_Œªs_’d_fù - -__Œªs_’d_fù -; - -110 * -__d©a -; - -111  -__gcÚv_Œªs_d©a - * -__Ãxt -; - -116  - s__gcÚv_¡• - - -118  -__gcÚv_lßded_objeù - * -__shlib_hªdË -; - -119 -__cÚ¡ - * -__modÇme -; - -121  -__couÁ” -; - -123 * -__äom_Çme -; - -124 * -__to_Çme -; - -126 -__gcÚv_fù - -__fù -; - -127 -__gcÚv_btowc_fù - -__btowc_fù -; - -128 -__gcÚv_š™_fù - -__š™_fù -; - -129 -__gcÚv_’d_fù - -__’d_fù -; - -133  -__mš_Ãeded_äom -; - -134  -__max_Ãeded_äom -; - -135  -__mš_Ãeded_to -; - -136  -__max_Ãeded_to -; - -139  -__¡©eful -; - -141 * -__d©a -; - -146  - s__gcÚv_¡•_d©a - - -148 * -__outbuf -; - -149 * -__outbuãnd -; - -153  -__æags -; - -157  -__švoÿtiÚ_couÁ” -; - -161  -__š‹º®_u£ -; - -163 -__mb¡©e_t - * -__¡©• -; - -164 -__mb¡©e_t - -__¡©e -; - -168  -__gcÚv_Œªs_d©a - * -__Œªs -; - -173  - s__gcÚv_šfo - - -175 -size_t - -__n¡•s -; - -176  -__gcÚv_¡• - * -__¡•s -; - -177 -__ex‹nsiÚ__ -  -__gcÚv_¡•_d©a - -__d©a - -__æex¬r -; - -178 } * - t__gcÚv_t -; - - @/usr/include/gnu/stubs-32.h - -6 #ifdeà -_LIBC - - -7 #”rÜ -AµliÿtiÚs - -may - -nÙ - -defše - -the - -maüo - -_LIBC - - -10  - #__¡ub___k”Ãl_co¦ - - - ) - -11  - #__¡ub___k”Ãl_sšl - - - ) - -12  - #__¡ub___k”Ãl_Æ - - - ) - -13  - #__¡ub_chæags - - - ) - -14  - #__¡ub_ç‰ach - - - ) - -15  - #__¡ub_fchæags - - - ) - -16  - #__¡ub_fd‘ach - - - ) - -17  - #__¡ub_g‰y - - - ) - -18  - #__¡ub_lchmod - - - ) - -19  - #__¡ub_»voke - - - ) - -20  - #__¡ub_£Žogš - - - ) - -21  - #__¡ub_sig»tuº - - - ) - -22  - #__¡ub_s¡k - - - ) - -23  - #__¡ub_¡ty - - - ) - - @/usr/include/gnu/stubs-64.h - -6 #ifdeà -_LIBC - - -7 #”rÜ -AµliÿtiÚs - -may - -nÙ - -defše - -the - -maüo - -_LIBC - - -10  - #__¡ub_bdæush - - - ) - -11  - #__¡ub_chæags - - - ) - -12  - #__¡ub_ç‰ach - - - ) - -13  - #__¡ub_fchæags - - - ) - -14  - #__¡ub_fd‘ach - - - ) - -15  - #__¡ub_g‘msg - - - ) - -16  - #__¡ub_g‰y - - - ) - -17  - #__¡ub_lchmod - - - ) - -18  - #__¡ub_putmsg - - - ) - -19  - #__¡ub_»voke - - - ) - -20  - #__¡ub_£Žogš - - - ) - -21  - #__¡ub_sig»tuº - - - ) - -22  - #__¡ub_s¡k - - - ) - -23  - #__¡ub_¡ty - - - ) - - @/usr/include/sys/types.h - -24 #iâdef -_SYS_TYPES_H - - -25  - #_SYS_TYPES_H - 1 - - ) - -27  - ~<ã©u»s.h -> - -29 - g__BEGIN_DECLS - - -31  - ~ - -33 #ifdef -__USE_BSD - - -34 #iâdeà -__u_ch¬_defšed - - -35  -__u_ch¬ - - tu_ch¬ -; - -36  -__u_shÜt - - tu_shÜt -; - -37  -__u_št - - tu_št -; - -38  -__u_lÚg - - tu_lÚg -; - -39  -__quad_t - - tquad_t -; - -40  -__u_quad_t - - tu_quad_t -; - -41  -__fsid_t - - tfsid_t -; - -42  - #__u_ch¬_defšed - - - ) - -46  -__loff_t - - tloff_t -; - -48 #iâdeà -__šo_t_defšed - - -49 #iâdeà -__USE_FILE_OFFSET64 - - -50  -__šo_t - - tšo_t -; - -52  -__šo64_t - - tšo_t -; - -54  - #__šo_t_defšed - - - ) - -56 #ià -defšed - -__USE_LARGEFILE64 - && !defšed -__šo64_t_defšed - - -57  -__šo64_t - - tšo64_t -; - -58  - #__šo64_t_defšed - - - ) - -61 #iâdeà -__dev_t_defšed - - -62  -__dev_t - - tdev_t -; - -63  - #__dev_t_defšed - - - ) - -66 #iâdeà -__gid_t_defšed - - -67  -__gid_t - - tgid_t -; - -68  - #__gid_t_defšed - - - ) - -71 #iâdeà -__mode_t_defšed - - -72  -__mode_t - - tmode_t -; - -73  - #__mode_t_defšed - - - ) - -76 #iâdeà -__Æšk_t_defšed - - -77  -__Æšk_t - - tÆšk_t -; - -78  - #__Æšk_t_defšed - - - ) - -81 #iâdeà -__uid_t_defšed - - -82  -__uid_t - - tuid_t -; - -83  - #__uid_t_defšed - - - ) - -86 #iâdeà -__off_t_defšed - - -87 #iâdeà -__USE_FILE_OFFSET64 - - -88  -__off_t - - toff_t -; - -90  -__off64_t - - toff_t -; - -92  - #__off_t_defšed - - - ) - -94 #ià -defšed - -__USE_LARGEFILE64 - && !defšed -__off64_t_defšed - - -95  -__off64_t - - toff64_t -; - -96  - #__off64_t_defšed - - - ) - -99 #iâdeà -__pid_t_defšed - - -100  -__pid_t - - tpid_t -; - -101  - #__pid_t_defšed - - - ) - -104 #ià( -defšed - -__USE_SVID - || defšed -__USE_XOPEN -è&& !defšed -__id_t_defšed - - -105  -__id_t - - tid_t -; - -106  - #__id_t_defšed - - - ) - -109 #iâdeà -__ssize_t_defšed - - -110  -__ssize_t - - tssize_t -; - -111  - #__ssize_t_defšed - - - ) - -114 #ifdef -__USE_BSD - - -115 #iâdeà -__daddr_t_defšed - - -116  -__daddr_t - - tdaddr_t -; - -117  -__ÿddr_t - - tÿddr_t -; - -118  - #__daddr_t_defšed - - - ) - -122 #ià( -defšed - -__USE_SVID - || defšed -__USE_XOPEN -è&& !defšed -__key_t_defšed - - -123  -__key_t - - tkey_t -; - -124  - #__key_t_defšed - - - ) - -127 #ifdeà -__USE_XOPEN - - -128  - #__Ãed_þock_t - - - ) - -130  - #__Ãed_time_t - - - ) - -131  - #__Ãed_tim”_t - - - ) - -132  - #__Ãed_þockid_t - - - ) - -133  - ~ - -135 #ifdeà -__USE_XOPEN - - -136 #iâdeà -__u£cÚds_t_defšed - - -137  -__u£cÚds_t - - tu£cÚds_t -; - -138  - #__u£cÚds_t_defšed - - - ) - -140 #iâdeà -__su£cÚds_t_defšed - - -141  -__su£cÚds_t - - tsu£cÚds_t -; - -142  - #__su£cÚds_t_defšed - - - ) - -146  - #__Ãed_size_t - - - ) - -147  - ~<¡ddef.h -> - -149 #ifdeà -__USE_MISC - - -151  - tulÚg -; - -152  - tushÜt -; - -153  - tušt -; - -158 #ià! -__GNUC_PREREQ - (2, 7) - -161 #iâdeà -__št8_t_defšed - - -162  - #__št8_t_defšed - - - ) - -163  - tšt8_t -; - -164  - tšt16_t -; - -165  - tšt32_t -; - -166 #ià -__WORDSIZE - == 64 - -167  - tšt64_t -; - -168 #–ià -__GLIBC_HAVE_LONG_LONG - - -169 -__ex‹nsiÚ__ -  - tšt64_t -; - -174  - tu_št8_t -; - -175  - tu_št16_t -; - -176  - tu_št32_t -; - -177 #ià -__WORDSIZE - == 64 - -178  - tu_št64_t -; - -179 #–ià -__GLIBC_HAVE_LONG_LONG - - -180 -__ex‹nsiÚ__ -  - tu_št64_t -; - -183  - t»gi¡”_t -; - -188  - #__štN_t -( -N -, -MODE -) \ - -189 ## - tN -## - t_t - - t__©Œibu‹__ - (( - t__mode__ - ( - tMODE -))) - - ) - -190  - t__u_štN_t -( - tN -, - tMODE -) \ - -191  - tu_št -## - tN -## - t_t - - t__©Œibu‹__ - (( - t__mode__ - ( - tMODE -))) - - ) - -193 #iâdeà - t__št8_t_defšed - - -194  - t__št8_t_defšed - - - ) - -195 - t__štN_t - (8, - t__QI__ -); - -196 -__štN_t - (16, -__HI__ -); - -197 -__štN_t - (32, -__SI__ -); - -198 -__štN_t - (64, -__DI__ -); - -201 -__u_štN_t - (8, -__QI__ -); - -202 -__u_štN_t - (16, -__HI__ -); - -203 -__u_štN_t - (32, -__SI__ -); - -204 -__u_štN_t - (64, -__DI__ -); - -206  - t»gi¡”_t - - t__©Œibu‹__ - (( - t__mode__ - ( - t__wÜd__ -))); - -212  - #__BIT_TYPES_DEFINED__ - 1 - - ) - -215 #ifdef -__USE_BSD - - -217  - ~<’dŸn.h -> - -220  - ~ - -223  - ~ - -227 #ià -defšed - -__USE_UNIX98 - && !defšed -__blksize_t_defšed - - -228  -__blksize_t - - tblksize_t -; - -229  - #__blksize_t_defšed - - - ) - -233 #iâdeà -__USE_FILE_OFFSET64 - - -234 #iâdeà -__blkút_t_defšed - - -235  -__blkút_t - - tblkút_t -; - -236  - #__blkút_t_defšed - - - ) - -238 #iâdeà -__fsblkút_t_defšed - - -239  -__fsblkút_t - - tfsblkút_t -; - -240  - #__fsblkút_t_defšed - - - ) - -242 #iâdeà -__fsfžút_t_defšed - - -243  -__fsfžút_t - - tfsfžút_t -; - -244  - #__fsfžút_t_defšed - - - ) - -247 #iâdeà -__blkút_t_defšed - - -248  -__blkút64_t - - tblkút_t -; - -249  - #__blkút_t_defšed - - - ) - -251 #iâdeà -__fsblkút_t_defšed - - -252  -__fsblkút64_t - - tfsblkút_t -; - -253  - #__fsblkút_t_defšed - - - ) - -255 #iâdeà -__fsfžút_t_defšed - - -256  -__fsfžút64_t - - tfsfžút_t -; - -257  - #__fsfžút_t_defšed - - - ) - -261 #ifdeà -__USE_LARGEFILE64 - - -262  -__blkút64_t - - tblkút64_t -; - -263  -__fsblkút64_t - - tfsblkút64_t -; - -264  -__fsfžút64_t - - tfsfžút64_t -; - -269 #ià -defšed - -__USE_POSIX199506 - || defšed -__USE_UNIX98 - - -270  - ~ - -273 - g__END_DECLS - - - @/usr/include/wchar.h - -24 #iâdeà -_WCHAR_H - - -26 #ià! -defšed - -__Ãed_mb¡©e_t - && !defšed -__Ãed_wšt_t - - -27  - #_WCHAR_H - 1 - - ) - -28  - ~<ã©u»s.h -> - -31 #ifdeà -_WCHAR_H - - -33  - #__Ãed___FILE - - - ) - -34 #ià -defšed - -__USE_UNIX98 - || defšed -__USE_XOPEN2K - - -35  - #__Ãed_FILE - - - ) - -37  - ~<¡dio.h -> - -39  - #__Ãed___va_li¡ - - - ) - -40  - ~<¡d¬g.h -> - -42  - ~ - -45  - #__Ãed_size_t - - - ) - -46  - #__Ãed_wch¬_t - - - ) - -47  - #__Ãed_NULL - - - ) - -49 #ià -defšed - -_WCHAR_H - || defšed -__Ãed_wšt_t - || !defšed -__WINT_TYPE__ - - -50 #undeà -__Ãed_wšt_t - - -51  - #__Ãed_wšt_t - - - ) - -52  - ~<¡ddef.h -> - -55 #ià -defšed - -__ýlu¥lus - && -__GNUC_PREREQ - (4, 4) - -56  - #__CORRECT_ISO_CPP_WCHAR_H_PROTO - - - ) - -61 #iâdeà -_WINT_T - - -66  - #_WINT_T - - - ) - -67  - twšt_t -; - -71 #ià -defšed - -__ýlu¥lus - && defšed -_GLIBCPP_USE_NAMESPACES - \ - -72 && -defšed - -__WINT_TYPE__ - - -73 -__BEGIN_NAMESPACE_STD - - -74  -__WINT_TYPE__ - - twšt_t -; - -75 - g__END_NAMESPACE_STD - - -80 #ià( -defšed - -_WCHAR_H - || defšed -__Ãed_mb¡©e_t -è&& !defšed -__mb¡©e_t_defšed - - -81  - #__mb¡©e_t_defšed - 1 - - ) - -85  - m__couÁ -; - -88 #ifdeà -__WINT_TYPE__ - - -89 -__WINT_TYPE__ - - m__wch -; - -91 -wšt_t - - m__wch -; - -93  - m__wchb -[4]; - -94 } - m__v®ue -; - -95 } - t__mb¡©e_t -; - -97 #undeà -__Ãed_mb¡©e_t - - -102 #ifdeà -_WCHAR_H - - -104 -__BEGIN_NAMESPACE_C99 - - -106  -__mb¡©e_t - - tmb¡©e_t -; - -107 - g__END_NAMESPACE_C99 - - -108 #ifdeà -__USE_GNU - - -109 - $__USING_NAMESPACE_C99 -( -mb¡©e_t -) - -112 #iâdeà -WCHAR_MIN - - -114  - #WCHAR_MIN - -__WCHAR_MIN - - - ) - -115  - #WCHAR_MAX - -__WCHAR_MAX - - - ) - -118 #iâdeà -WEOF - - -119  - #WEOF - (0xffffffffu) - - ) - -124 #ià -defšed - -__USE_XOPEN - && !defšed -__USE_UNIX98 - - -125  - ~ - -129 -__BEGIN_DECLS - - -131 -__BEGIN_NAMESPACE_STD - - -134  -tm -; - -135 -__END_NAMESPACE_STD - - -139 - $__USING_NAMESPACE_STD -( -tm -) - -142 -__BEGIN_NAMESPACE_STD - - -144 -wch¬_t - * - $wcsýy - ( -wch¬_t - * -__»¡riù - -__de¡ -, - -145 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -è -__THROW -; - -147 -wch¬_t - * - $wc¢ýy - ( -wch¬_t - * -__»¡riù - -__de¡ -, - -148 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, -size_t - -__n -) - -149 -__THROW -; - -152 -wch¬_t - * - $wcsÿt - ( -wch¬_t - * -__»¡riù - -__de¡ -, - -153 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -è -__THROW -; - -155 -wch¬_t - * - $wc¢ÿt - ( -wch¬_t - * -__»¡riù - -__de¡ -, - -156 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, -size_t - -__n -) - -157 -__THROW -; - -160  - $wcscmp - ( -__cÚ¡ - -wch¬_t - * -__s1 -, __cÚ¡ wch¬_ˆ* -__s2 -) - -161 -__THROW - -__©Œibu‹_pu»__ -; - -163  - $wc¢cmp - ( -__cÚ¡ - -wch¬_t - * -__s1 -, __cÚ¡ wch¬_ˆ* -__s2 -, -size_t - -__n -) - -164 -__THROW - -__©Œibu‹_pu»__ -; - -165 -__END_NAMESPACE_STD - - -167 #ifdeà -__USE_XOPEN2K8 - - -169  - $wcsÿ£cmp - ( -__cÚ¡ - -wch¬_t - * -__s1 -, __cÚ¡ wch¬_ˆ* -__s2 -è -__THROW -; - -172  - $wc¢ÿ£cmp - ( -__cÚ¡ - -wch¬_t - * -__s1 -, __cÚ¡ wch¬_ˆ* -__s2 -, - -173 -size_t - -__n -è -__THROW -; - -177  - ~ - -179  - $wcsÿ£cmp_l - ( -__cÚ¡ - -wch¬_t - * -__s1 -, __cÚ¡ wch¬_ˆ* -__s2 -, - -180 -__loÿË_t - -__loc -è -__THROW -; - -182  - $wc¢ÿ£cmp_l - ( -__cÚ¡ - -wch¬_t - * -__s1 -, __cÚ¡ wch¬_ˆ* -__s2 -, - -183 -size_t - -__n -, -__loÿË_t - -__loc -è -__THROW -; - -186 -__BEGIN_NAMESPACE_STD - - -189  - $wcscÞl - ( -__cÚ¡ - -wch¬_t - * -__s1 -, __cÚ¡ wch¬_ˆ* -__s2 -è -__THROW -; - -193 -size_t - - $wcsxäm - ( -wch¬_t - * -__»¡riù - -__s1 -, - -194 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s2 -, -size_t - -__n -è -__THROW -; - -195 -__END_NAMESPACE_STD - - -197 #ifdeà -__USE_XOPEN2K8 - - -203  - $wcscÞl_l - ( -__cÚ¡ - -wch¬_t - * -__s1 -, __cÚ¡ wch¬_ˆ* -__s2 -, - -204 -__loÿË_t - -__loc -è -__THROW -; - -209 -size_t - - $wcsxäm_l - ( -wch¬_t - * -__s1 -, -__cÚ¡ - wch¬_ˆ* -__s2 -, - -210 -size_t - -__n -, -__loÿË_t - -__loc -è -__THROW -; - -213 -wch¬_t - * - $wcsdup - ( -__cÚ¡ - -wch¬_t - * -__s -è -__THROW - -__©Œibu‹_m®loc__ -; - -216 -__BEGIN_NAMESPACE_STD - - -218 #ifdeà -__CORRECT_ISO_CPP_WCHAR_H_PROTO - - -219 "C++" -wch¬_t - * - $wcschr - ( -wch¬_t - * -__wcs -, wch¬_ˆ -__wc -) - -220 -__THROW - - `__asm - ("wcschr"è -__©Œibu‹_pu»__ -; - -221 "C++" -__cÚ¡ - -wch¬_t - * - $wcschr - ( -__cÚ¡ - -wch¬_t - * -__wcs -, wch¬_ˆ -__wc -) - -222 -__THROW - - `__asm - ("wcschr"è -__©Œibu‹_pu»__ -; - -224 -wch¬_t - * - $wcschr - ( -__cÚ¡ - -wch¬_t - * -__wcs -, wch¬_ˆ -__wc -) - -225 -__THROW - -__©Œibu‹_pu»__ -; - -228 #ifdeà -__CORRECT_ISO_CPP_WCHAR_H_PROTO - - -229 "C++" -wch¬_t - * - $wc¤chr - ( -wch¬_t - * -__wcs -, wch¬_ˆ -__wc -) - -230 -__THROW - - `__asm - ("wc¤chr"è -__©Œibu‹_pu»__ -; - -231 "C++" -__cÚ¡ - -wch¬_t - * - $wc¤chr - ( -__cÚ¡ - -wch¬_t - * -__wcs -, wch¬_ˆ -__wc -) - -232 -__THROW - - `__asm - ("wc¤chr"è -__©Œibu‹_pu»__ -; - -234 -wch¬_t - * - $wc¤chr - ( -__cÚ¡ - -wch¬_t - * -__wcs -, wch¬_ˆ -__wc -) - -235 -__THROW - -__©Œibu‹_pu»__ -; - -237 -__END_NAMESPACE_STD - - -239 #ifdeà -__USE_GNU - - -242 -wch¬_t - * - $wcschºul - ( -__cÚ¡ - -wch¬_t - * -__s -, wch¬_ˆ -__wc -) - -243 -__THROW - -__©Œibu‹_pu»__ -; - -246 -__BEGIN_NAMESPACE_STD - - -249 -size_t - - $wcsc¥n - ( -__cÚ¡ - -wch¬_t - * -__wcs -, __cÚ¡ wch¬_ˆ* -__»jeù -) - -250 -__THROW - -__©Œibu‹_pu»__ -; - -253 -size_t - - $wcs¥n - ( -__cÚ¡ - -wch¬_t - * -__wcs -, __cÚ¡ wch¬_ˆ* -__acû± -) - -254 -__THROW - -__©Œibu‹_pu»__ -; - -256 #ifdeà -__CORRECT_ISO_CPP_WCHAR_H_PROTO - - -257 "C++" -wch¬_t - * - $wc¥brk - ( -wch¬_t - * -__wcs -, -__cÚ¡ - wch¬_ˆ* -__acû± -) - -258 -__THROW - - `__asm - ("wc¥brk"è -__©Œibu‹_pu»__ -; - -259 "C++" -__cÚ¡ - -wch¬_t - * - $wc¥brk - ( -__cÚ¡ - -wch¬_t - * -__wcs -, - -260 -__cÚ¡ - -wch¬_t - * -__acû± -) - -261 -__THROW - - `__asm - ("wc¥brk"è -__©Œibu‹_pu»__ -; - -263 -wch¬_t - * - $wc¥brk - ( -__cÚ¡ - -wch¬_t - * -__wcs -, __cÚ¡ wch¬_ˆ* -__acû± -) - -264 -__THROW - -__©Œibu‹_pu»__ -; - -267 #ifdeà -__CORRECT_ISO_CPP_WCHAR_H_PROTO - - -268 "C++" -wch¬_t - * - $wcs¡r - ( -wch¬_t - * -__hay¡ack -, -__cÚ¡ - wch¬_ˆ* -__ÃedË -) - -269 -__THROW - - `__asm - ("wcs¡r"è -__©Œibu‹_pu»__ -; - -270 "C++" -__cÚ¡ - -wch¬_t - * - $wcs¡r - ( -__cÚ¡ - -wch¬_t - * -__hay¡ack -, - -271 -__cÚ¡ - -wch¬_t - * -__ÃedË -) - -272 -__THROW - - `__asm - ("wcs¡r"è -__©Œibu‹_pu»__ -; - -274 -wch¬_t - * - $wcs¡r - ( -__cÚ¡ - -wch¬_t - * -__hay¡ack -, __cÚ¡ wch¬_ˆ* -__ÃedË -) - -275 -__THROW - -__©Œibu‹_pu»__ -; - -279 -wch¬_t - * - $wc¡ok - ( -wch¬_t - * -__»¡riù - -__s -, - -280 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__d–im -, - -281 -wch¬_t - ** -__»¡riù - -__±r -è -__THROW -; - -284 -size_t - - $wc¦’ - ( -__cÚ¡ - -wch¬_t - * -__s -è -__THROW - -__©Œibu‹_pu»__ -; - -285 -__END_NAMESPACE_STD - - -287 #ifdeà -__USE_XOPEN - - -289 #ifdeà -__CORRECT_ISO_CPP_WCHAR_H_PROTO - - -290 "C++" -wch¬_t - * - $wcswcs - ( -wch¬_t - * -__hay¡ack -, -__cÚ¡ - wch¬_ˆ* -__ÃedË -) - -291 -__THROW - - `__asm - ("wcswcs"è -__©Œibu‹_pu»__ -; - -292 "C++" -__cÚ¡ - -wch¬_t - * - $wcswcs - ( -__cÚ¡ - -wch¬_t - * -__hay¡ack -, - -293 -__cÚ¡ - -wch¬_t - * -__ÃedË -) - -294 -__THROW - - `__asm - ("wcswcs"è -__©Œibu‹_pu»__ -; - -296 -wch¬_t - * - $wcswcs - ( -__cÚ¡ - -wch¬_t - * -__hay¡ack -, __cÚ¡ wch¬_ˆ* -__ÃedË -) - -297 -__THROW - -__©Œibu‹_pu»__ -; - -301 #ifdeà -__USE_XOPEN2K8 - - -303 -size_t - - $wc¢Ën - ( -__cÚ¡ - -wch¬_t - * -__s -, -size_t - -__maxËn -) - -304 -__THROW - -__©Œibu‹_pu»__ -; - -308 -__BEGIN_NAMESPACE_STD - - -310 #ifdeà -__CORRECT_ISO_CPP_WCHAR_H_PROTO - - -311 "C++" -wch¬_t - * - $wmemchr - ( -wch¬_t - * -__s -, wch¬_ˆ -__c -, -size_t - -__n -) - -312 -__THROW - - `__asm - ("wmemchr"è -__©Œibu‹_pu»__ -; - -313 "C++" -__cÚ¡ - -wch¬_t - * - $wmemchr - ( -__cÚ¡ - -wch¬_t - * -__s -, wch¬_ˆ -__c -, - -314 -size_t - -__n -) - -315 -__THROW - - `__asm - ("wmemchr"è -__©Œibu‹_pu»__ -; - -317 -wch¬_t - * - $wmemchr - ( -__cÚ¡ - -wch¬_t - * -__s -, wch¬_ˆ -__c -, -size_t - -__n -) - -318 -__THROW - -__©Œibu‹_pu»__ -; - -322  - $wmemcmp - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s1 -, - -323 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s2 -, -size_t - -__n -) - -324 -__THROW - -__©Œibu‹_pu»__ -; - -327 -wch¬_t - * - $wmemýy - ( -wch¬_t - * -__»¡riù - -__s1 -, - -328 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s2 -, -size_t - -__n -è -__THROW -; - -332 -wch¬_t - * - $wmemmove - ( -wch¬_t - * -__s1 -, -__cÚ¡ - wch¬_ˆ* -__s2 -, -size_t - -__n -) - -333 -__THROW -; - -336 -wch¬_t - * - $wmem£t - ( -wch¬_t - * -__s -, wch¬_ˆ -__c -, -size_t - -__n -è -__THROW -; - -337 -__END_NAMESPACE_STD - - -339 #ifdeà -__USE_GNU - - -342 -wch¬_t - * - $wmempýy - ( -wch¬_t - * -__»¡riù - -__s1 -, - -343 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s2 -, -size_t - -__n -) - -344 -__THROW -; - -348 -__BEGIN_NAMESPACE_STD - - -351 -wšt_t - - $btowc - ( -__c -è -__THROW -; - -355  - $wùob - ( -wšt_t - -__c -è -__THROW -; - -359  - $mbsš™ - ( -__cÚ¡ - -mb¡©e_t - * -__ps -è -__THROW - -__©Œibu‹_pu»__ -; - -363 -size_t - - $mb¹owc - ( -wch¬_t - * -__»¡riù - -__pwc -, - -364 -__cÚ¡ - * -__»¡riù - -__s -, -size_t - -__n -, - -365 -mb¡©e_t - * -__p -è -__THROW -; - -368 -size_t - - $wütomb - (* -__»¡riù - -__s -, -wch¬_t - -__wc -, - -369 -mb¡©e_t - * -__»¡riù - -__ps -è -__THROW -; - -372 -size_t - - $__mb¾’ - ( -__cÚ¡ - * -__»¡riù - -__s -, -size_t - -__n -, - -373 -mb¡©e_t - * -__»¡riù - -__ps -è -__THROW -; - -374 -size_t - - $mb¾’ - ( -__cÚ¡ - * -__»¡riù - -__s -, -size_t - -__n -, - -375 -mb¡©e_t - * -__»¡riù - -__ps -è -__THROW -; - -376 -__END_NAMESPACE_STD - - -378 #ifdeà -__USE_EXTERN_INLINES - - -384 -wšt_t - - $__btowc_®Ÿs - ( -__c -è - `__asm - ("btowc"); - -385 -__ex‹º_šlše - -wšt_t - - -386 - `__NTH - ( - $btowc - ( -__c -)) - -387 {  ( - `__bužtš_cÚ¡ªt_p - ( -__c -) && __c >= '\0' && __c <= '\x7f' - -388 ? ( -wšt_t -è -__c - : - `__btowc_®Ÿs - (__c)); - } -} - -390  - $__wùob_®Ÿs - ( -wšt_t - -__c -è - `__asm - ("wctob"); - -391 -__ex‹º_šlše -  - -392 - `__NTH - ( - $wùob - ( -wšt_t - -__wc -)) - -393 {  ( - `__bužtš_cÚ¡ªt_p - ( -__wc -è&& __wø>ð -L -'\0' && __wc <= L'\x7f' - -394 ? (è -__wc - : - `__wùob_®Ÿs - (__wc)); - } -} - -396 -__ex‹º_šlše - -size_t - - -397 -__NTH - ( - $mb¾’ - ( -__cÚ¡ - * -__»¡riù - -__s -, -size_t - -__n -, - -398 -mb¡©e_t - * -__»¡riù - -__ps -)) - -399 {  ( -__ps - !ð -NULL - - -400 ? - `mb¹owc - ( -NULL -, -__s -, -__n -, -__ps -è: - `__mb¾’ - (__s, __n, NULL)); - } -} - -403 -__BEGIN_NAMESPACE_STD - - -406 -size_t - - $mb¤towcs - ( -wch¬_t - * -__»¡riù - -__d¡ -, - -407 -__cÚ¡ - ** -__»¡riù - -__¤c -, -size_t - -__Ën -, - -408 -mb¡©e_t - * -__»¡riù - -__ps -è -__THROW -; - -412 -size_t - - $wc¤tombs - (* -__»¡riù - -__d¡ -, - -413 -__cÚ¡ - -wch¬_t - ** -__»¡riù - -__¤c -, -size_t - -__Ën -, - -414 -mb¡©e_t - * -__»¡riù - -__ps -è -__THROW -; - -415 -__END_NAMESPACE_STD - - -418 #ifdef -__USE_XOPEN2K8 - - -421 -size_t - - $mb¢¹owcs - ( -wch¬_t - * -__»¡riù - -__d¡ -, - -422 -__cÚ¡ - ** -__»¡riù - -__¤c -, -size_t - -__nmc -, - -423 -size_t - -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -è -__THROW -; - -427 -size_t - - $wc¢¹ombs - (* -__»¡riù - -__d¡ -, - -428 -__cÚ¡ - -wch¬_t - ** -__»¡riù - -__¤c -, - -429 -size_t - -__nwc -, size_ˆ -__Ën -, - -430 -mb¡©e_t - * -__»¡riù - -__ps -è -__THROW -; - -435 #ifdeà -__USE_XOPEN - - -437  - $wcwidth - ( -wch¬_t - -__c -è -__THROW -; - -441  - $wcswidth - ( -__cÚ¡ - -wch¬_t - * -__s -, -size_t - -__n -è -__THROW -; - -445 -__BEGIN_NAMESPACE_STD - - -448  - $wc¡od - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -449 -wch¬_t - ** -__»¡riù - -__’d±r -è -__THROW -; - -450 -__END_NAMESPACE_STD - - -452 #ifdeà -__USE_ISOC99 - - -453 -__BEGIN_NAMESPACE_C99 - - -455  - $wc¡of - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -456 -wch¬_t - ** -__»¡riù - -__’d±r -è -__THROW -; - -457  - $wc¡Þd - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -458 -wch¬_t - ** -__»¡riù - -__’d±r -è -__THROW -; - -459 -__END_NAMESPACE_C99 - - -463 -__BEGIN_NAMESPACE_STD - - -466  - $wc¡Þ - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -467 -wch¬_t - ** -__»¡riù - -__’d±r -,  -__ba£ -è -__THROW -; - -471  - $wc¡oul - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -472 -wch¬_t - ** -__»¡riù - -__’d±r -,  -__ba£ -) - -473 -__THROW -; - -474 -__END_NAMESPACE_STD - - -476 #ià -defšed - -__USE_ISOC99 - || (defšed -__GNUC__ - && defšed -__USE_GNU -) - -477 -__BEGIN_NAMESPACE_C99 - - -480 -__ex‹nsiÚ__ - - -481  - $wc¡Þl - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -482 -wch¬_t - ** -__»¡riù - -__’d±r -,  -__ba£ -) - -483 -__THROW -; - -487 -__ex‹nsiÚ__ - - -488  - $wc¡ouÎ - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -489 -wch¬_t - ** -__»¡riù - -__’d±r -, - -490  -__ba£ -è -__THROW -; - -491 -__END_NAMESPACE_C99 - - -494 #ià -defšed - -__GNUC__ - && defšed -__USE_GNU - - -497 -__ex‹nsiÚ__ - - -498  - $wc¡oq - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -499 -wch¬_t - ** -__»¡riù - -__’d±r -,  -__ba£ -) - -500 -__THROW -; - -504 -__ex‹nsiÚ__ - - -505  - $wc¡ouq - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -506 -wch¬_t - ** -__»¡riù - -__’d±r -, - -507  -__ba£ -è -__THROW -; - -510 #ifdeà -__USE_GNU - - -524  - ~ - -528  - $wc¡Þ_l - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -529 -wch¬_t - ** -__»¡riù - -__’d±r -,  -__ba£ -, - -530 -__loÿË_t - -__loc -è -__THROW -; - -532  - $wc¡oul_l - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -533 -wch¬_t - ** -__»¡riù - -__’d±r -, - -534  -__ba£ -, -__loÿË_t - -__loc -è -__THROW -; - -536 -__ex‹nsiÚ__ - - -537  - $wc¡Þl_l - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -538 -wch¬_t - ** -__»¡riù - -__’d±r -, - -539  -__ba£ -, -__loÿË_t - -__loc -è -__THROW -; - -541 -__ex‹nsiÚ__ - - -542  - $wc¡ouÎ_l - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -543 -wch¬_t - ** -__»¡riù - -__’d±r -, - -544  -__ba£ -, -__loÿË_t - -__loc -) - -545 -__THROW -; - -547  - $wc¡od_l - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -548 -wch¬_t - ** -__»¡riù - -__’d±r -, -__loÿË_t - -__loc -) - -549 -__THROW -; - -551  - $wc¡of_l - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -552 -wch¬_t - ** -__»¡riù - -__’d±r -, -__loÿË_t - -__loc -) - -553 -__THROW -; - -555  - $wc¡Þd_l - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ÅŒ -, - -556 -wch¬_t - ** -__»¡riù - -__’d±r -, - -557 -__loÿË_t - -__loc -è -__THROW -; - -561 #ifdef -__USE_XOPEN2K8 - - -564 -wch¬_t - * - $wýýy - ( -wch¬_t - * -__de¡ -, -__cÚ¡ - wch¬_ˆ* -__¤c -è -__THROW -; - -568 -wch¬_t - * - $wýnýy - ( -wch¬_t - * -__de¡ -, -__cÚ¡ - wch¬_ˆ* -__¤c -, -size_t - -__n -) - -569 -__THROW -; - -575 #ifdef -__USE_XOPEN2K8 - - -578 -__FILE - * - $Ý’_wmem¡»am - ( -wch¬_t - ** -__buæoc -, -size_t - * -__siz–oc -è -__THROW -; - -581 #ià -defšed - -__USE_ISOC95 - || defšed -__USE_UNIX98 - - -582 -__BEGIN_NAMESPACE_STD - - -585  - $fwide - ( -__FILE - * -__å -,  -__mode -è -__THROW -; - -592  - `fw´štf - ( -__FILE - * -__»¡riù - -__¡»am -, - -593 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...) - -599  - `w´štf - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...) - -602  - $sw´štf - ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__n -, - -603 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...) - -604 -__THROW - ; - -610  - `vfw´štf - ( -__FILE - * -__»¡riù - -__s -, - -611 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -612 -__gnuc_va_li¡ - -__¬g -) - -618  - `vw´štf - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -619 -__gnuc_va_li¡ - -__¬g -) - -623  - $vsw´štf - ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__n -, - -624 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -625 -__gnuc_va_li¡ - -__¬g -) - -626 -__THROW - ; - -633  - `fwsÿnf - ( -__FILE - * -__»¡riù - -__¡»am -, - -634 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...) - -640  - `wsÿnf - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...) - -643  - $swsÿnf - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s -, - -644 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...) - -645 -__THROW - ; - -647 #ià -defšed - -__USE_ISOC99 - && !defšed -__USE_GNU - \ - -648 && (! -defšed - -__LDBL_COMPAT - || !defšed -__REDIRECT -) \ - -649 && ( -defšed - -__STRICT_ANSI__ - || defšed -__USE_XOPEN2K -) - -650 #ifdeà -__REDIRECT - - -654  - `__REDIRECT - ( -fwsÿnf -, ( -__FILE - * -__»¡riù - -__¡»am -, - -655 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...), - -656 -__isoc99_fwsÿnf -) - -658  - `__REDIRECT - ( -wsÿnf -, ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...), - -659 -__isoc99_wsÿnf -) - -661  - `__REDIRECT - ( -swsÿnf -, ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s -, - -662 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...), - -663 -__isoc99_swsÿnf -) - -664 -__THROW - ; - -666  - `__isoc99_fwsÿnf - ( -__FILE - * -__»¡riù - -__¡»am -, - -667 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...); - -668  - `__isoc99_wsÿnf - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...); - -669  - $__isoc99_swsÿnf - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s -, - -670 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...) - -671 -__THROW -; - -672  - #fwsÿnf - -__isoc99_fwsÿnf - - - ) - -673  - #wsÿnf - -__isoc99_wsÿnf - - - ) - -674  - #swsÿnf - -__isoc99_swsÿnf - - - ) - -678 -__END_NAMESPACE_STD - - -681 #ifdeà -__USE_ISOC99 - - -682 -__BEGIN_NAMESPACE_C99 - - -687  - `vfwsÿnf - ( -__FILE - * -__»¡riù - -__s -, - -688 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -689 -__gnuc_va_li¡ - -__¬g -) - -695  - `vwsÿnf - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -696 -__gnuc_va_li¡ - -__¬g -) - -699  - $vswsÿnf - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s -, - -700 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -701 -__gnuc_va_li¡ - -__¬g -) - -702 -__THROW - ; - -704 #ià! -defšed - -__USE_GNU - \ - -705 && (! -defšed - -__LDBL_COMPAT - || !defšed -__REDIRECT -) \ - -706 && ( -defšed - -__STRICT_ANSI__ - || defšed -__USE_XOPEN2K -) - -707 #ifdeà -__REDIRECT - - -708  - `__REDIRECT - ( -vfwsÿnf -, ( -__FILE - * -__»¡riù - -__s -, - -709 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -710 -__gnuc_va_li¡ - -__¬g -), -__isoc99_vfwsÿnf -) - -712  - `__REDIRECT - ( -vwsÿnf -, ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -713 -__gnuc_va_li¡ - -__¬g -), -__isoc99_vwsÿnf -) - -715  - `__REDIRECT - ( -vswsÿnf -, ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s -, - -716 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -717 -__gnuc_va_li¡ - -__¬g -), -__isoc99_vswsÿnf -) - -718 -__THROW - ; - -720  - `__isoc99_vfwsÿnf - ( -__FILE - * -__»¡riù - -__s -, - -721 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -722 -__gnuc_va_li¡ - -__¬g -); - -723  - `__isoc99_vwsÿnf - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -724 -__gnuc_va_li¡ - -__¬g -); - -725  - $__isoc99_vswsÿnf - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s -, - -726 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -727 -__gnuc_va_li¡ - -__¬g -è -__THROW -; - -728  - #vfwsÿnf - -__isoc99_vfwsÿnf - - - ) - -729  - #vwsÿnf - -__isoc99_vwsÿnf - - - ) - -730  - #vswsÿnf - -__isoc99_vswsÿnf - - - ) - -734 -__END_NAMESPACE_C99 - - -738 -__BEGIN_NAMESPACE_STD - - -743 -wšt_t - - `fg‘wc - ( -__FILE - * -__¡»am -); - -744 -wšt_t - - `g‘wc - ( -__FILE - * -__¡»am -); - -750 -wšt_t - - `g‘wch¬ - (); - -757 -wšt_t - - `åutwc - ( -wch¬_t - -__wc -, -__FILE - * -__¡»am -); - -758 -wšt_t - - `putwc - ( -wch¬_t - -__wc -, -__FILE - * -__¡»am -); - -764 -wšt_t - - `putwch¬ - ( -wch¬_t - -__wc -); - -772 -wch¬_t - * - `fg‘ws - (wch¬_ˆ* -__»¡riù - -__ws -,  -__n -, - -773 -__FILE - * -__»¡riù - -__¡»am -); - -779  - `åutws - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ws -, - -780 -__FILE - * -__»¡riù - -__¡»am -); - -787 -wšt_t - - `ung‘wc - (wšt_ˆ -__wc -, -__FILE - * -__¡»am -); - -788 -__END_NAMESPACE_STD - - -791 #ifdeà -__USE_GNU - - -799 -wšt_t - - `g‘wc_uÆocked - ( -__FILE - * -__¡»am -); - -800 -wšt_t - - `g‘wch¬_uÆocked - (); - -808 -wšt_t - - `fg‘wc_uÆocked - ( -__FILE - * -__¡»am -); - -816 -wšt_t - - `åutwc_uÆocked - ( -wch¬_t - -__wc -, -__FILE - * -__¡»am -); - -825 -wšt_t - - `putwc_uÆocked - ( -wch¬_t - -__wc -, -__FILE - * -__¡»am -); - -826 -wšt_t - - `putwch¬_uÆocked - ( -wch¬_t - -__wc -); - -835 -wch¬_t - * - `fg‘ws_uÆocked - (wch¬_ˆ* -__»¡riù - -__ws -,  -__n -, - -836 -__FILE - * -__»¡riù - -__¡»am -); - -844  - `åutws_uÆocked - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__ws -, - -845 -__FILE - * -__»¡riù - -__¡»am -); - -849 -__BEGIN_NAMESPACE_C99 - - -853 -size_t - - $wcsáime - ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__maxsize -, - -854 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -855 -__cÚ¡ -  -tm - * -__»¡riù - -__ -è -__THROW -; - -856 -__END_NAMESPACE_C99 - - -858 #ifdeà -__USE_GNU - - -859  - ~ - -863 -size_t - - $wcsáime_l - ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__maxsize -, - -864 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -865 -__cÚ¡ -  -tm - * -__»¡riù - -__ -, - -866 -__loÿË_t - -__loc -è -__THROW -; - -875 #ià -defšed - -__USE_UNIX98 - && !defšed -__USE_GNU - - -876  - #__Ãed_iswxxx - - - ) - -877  - ~ - -881 #ià -__USE_FORTIFY_LEVEL - > 0 && -defšed - -__ex‹º_®ways_šlše - - -882  - ~ - -885 #ifdeà -__LDBL_COMPAT - - -886  - ~ - -889 -__END_DECLS - - -897 #undeà -__Ãed_mb¡©e_t - - -898 #undeà -__Ãed_wšt_t - - - @/usr/include/bits/pthreadtypes.h - -20 #iâdeà -_BITS_PTHREADTYPES_H - - -21  - #_BITS_PTHREADTYPES_H - 1 - - ) - -23  - ~ - -25 #ià -__WORDSIZE - == 64 - -26  - #__SIZEOF_PTHREAD_ATTR_T - 56 - - ) - -27  - #__SIZEOF_PTHREAD_MUTEX_T - 40 - - ) - -28  - #__SIZEOF_PTHREAD_MUTEXATTR_T - 4 - - ) - -29  - #__SIZEOF_PTHREAD_COND_T - 48 - - ) - -30  - #__SIZEOF_PTHREAD_CONDATTR_T - 4 - - ) - -31  - #__SIZEOF_PTHREAD_RWLOCK_T - 56 - - ) - -32  - #__SIZEOF_PTHREAD_RWLOCKATTR_T - 8 - - ) - -33  - #__SIZEOF_PTHREAD_BARRIER_T - 32 - - ) - -34  - #__SIZEOF_PTHREAD_BARRIERATTR_T - 4 - - ) - -36  - #__SIZEOF_PTHREAD_ATTR_T - 36 - - ) - -37  - #__SIZEOF_PTHREAD_MUTEX_T - 24 - - ) - -38  - #__SIZEOF_PTHREAD_MUTEXATTR_T - 4 - - ) - -39  - #__SIZEOF_PTHREAD_COND_T - 48 - - ) - -40  - #__SIZEOF_PTHREAD_CONDATTR_T - 4 - - ) - -41  - #__SIZEOF_PTHREAD_RWLOCK_T - 32 - - ) - -42  - #__SIZEOF_PTHREAD_RWLOCKATTR_T - 8 - - ) - -43  - #__SIZEOF_PTHREAD_BARRIER_T - 20 - - ) - -44  - #__SIZEOF_PTHREAD_BARRIERATTR_T - 4 - - ) - -50  - t±h»ad_t -; - -55  - m__size -[ -__SIZEOF_PTHREAD_ATTR_T -]; - -56  - m__®ign -; - -57 } - t±h»ad_©Œ_t -; - -60 #ià -__WORDSIZE - == 64 - -61  - s__±h»ad_š‹º®_li¡ - - -63  -__±h»ad_š‹º®_li¡ - * - m__´ev -; - -64  -__±h»ad_š‹º®_li¡ - * - m__Ãxt -; - -65 } - t__±h»ad_li¡_t -; - -67  - s__±h»ad_š‹º®_¦i¡ - - -69  -__±h»ad_š‹º®_¦i¡ - * - m__Ãxt -; - -70 } - t__±h»ad_¦i¡_t -; - -78  - s__±h»ad_mu‹x_s - - -80  - m__lock -; - -81  - m__couÁ -; - -82  - m__owÃr -; - -83 #ià -__WORDSIZE - == 64 - -84  - m__nu£rs -; - -88  - m__kšd -; - -89 #ià -__WORDSIZE - == 64 - -90  - m__¥šs -; - -91 -__±h»ad_li¡_t - - m__li¡ -; - -92  - #__PTHREAD_MUTEX_HAVE_PREV - 1 - - ) - -94  - m__nu£rs -; - -95 -__ex‹nsiÚ__ - union - -97  - m__¥šs -; - -98 -__±h»ad_¦i¡_t - - m__li¡ -; - -101 } - m__d©a -; - -102  - m__size -[ -__SIZEOF_PTHREAD_MUTEX_T -]; - -103  - m__®ign -; - -104 } - t±h»ad_mu‹x_t -; - -108  - m__size -[ -__SIZEOF_PTHREAD_MUTEXATTR_T -]; - -109  - m__®ign -; - -110 } - t±h»ad_mu‹x©Œ_t -; - -119  - m__lock -; - -120  - m__fu‹x -; - -121 -__ex‹nsiÚ__ -  - m__tÙ®_£q -; - -122 -__ex‹nsiÚ__ -  - m__wakeup_£q -; - -123 -__ex‹nsiÚ__ -  - m__wok’_£q -; - -124 * - m__mu‹x -; - -125  - m__nwa™”s -; - -126  - m__brßdÿ¡_£q -; - -127 } - m__d©a -; - -128  - m__size -[ -__SIZEOF_PTHREAD_COND_T -]; - -129 -__ex‹nsiÚ__ -  - m__®ign -; - -130 } - t±h»ad_cÚd_t -; - -134  - m__size -[ -__SIZEOF_PTHREAD_CONDATTR_T -]; - -135  - m__®ign -; - -136 } - t±h»ad_cÚd©Œ_t -; - -140  - t±h»ad_key_t -; - -144  - t±h»ad_Úû_t -; - -147 #ià -defšed - -__USE_UNIX98 - || defšed -__USE_XOPEN2K - - -152 #ià -__WORDSIZE - == 64 - -155  - m__lock -; - -156  - m__Ä_»ad”s -; - -157  - m__»ad”s_wakeup -; - -158  - m__wr™”_wakeup -; - -159  - m__Ä_»ad”s_queued -; - -160  - m__Ä_wr™”s_queued -; - -161  - m__wr™” -; - -162  - m__sh¬ed -; - -163  - m__·d1 -; - -164  - m__·d2 -; - -167  - m__æags -; - -168 } - m__d©a -; - -172  - m__lock -; - -173  - m__Ä_»ad”s -; - -174  - m__»ad”s_wakeup -; - -175  - m__wr™”_wakeup -; - -176  - m__Ä_»ad”s_queued -; - -177  - m__Ä_wr™”s_queued -; - -180  - m__æags -; - -181  - m__sh¬ed -; - -182  - m__·d1 -; - -183  - m__·d2 -; - -184  - m__wr™” -; - -185 } - m__d©a -; - -187  - m__size -[ -__SIZEOF_PTHREAD_RWLOCK_T -]; - -188  - m__®ign -; - -189 } - t±h»ad_rwlock_t -; - -193  - m__size -[ -__SIZEOF_PTHREAD_RWLOCKATTR_T -]; - -194  - m__®ign -; - -195 } - t±h»ad_rwlock©Œ_t -; - -199 #ifdeà -__USE_XOPEN2K - - -201 vÞ©ž - t±h»ad_¥šlock_t -; - -208  - m__size -[ -__SIZEOF_PTHREAD_BARRIER_T -]; - -209  - m__®ign -; - -210 } - t±h»ad_b¬r›r_t -; - -214  - m__size -[ -__SIZEOF_PTHREAD_BARRIERATTR_T -]; - -215  - m__®ign -; - -216 } - t±h»ad_b¬r›¿‰r_t -; - -220 #ià -__WORDSIZE - == 32 - -222  - #__þ—nup_fù_©Œibu‹ - - `__©Œibu‹__ - (( - `__»g·rm__ - (1))) - - ) - - @/usr/include/bits/wchar-ldbl.h - -20 #iâdeà -_WCHAR_H - - -24 #ià -defšed - -__USE_ISOC95 - || defšed -__USE_UNIX98 - - -25 -__BEGIN_NAMESPACE_C99 - - -26 -__LDBL_REDIR_DECL - ( -fw´štf -); - -27 -__LDBL_REDIR_DECL - ( -w´štf -); - -28 -__LDBL_REDIR_DECL - ( -sw´štf -); - -29 -__LDBL_REDIR_DECL - ( -vfw´štf -); - -30 -__LDBL_REDIR_DECL - ( -vw´štf -); - -31 -__LDBL_REDIR_DECL - ( -vsw´štf -); - -32 #ià -defšed - -__USE_ISOC99 - && !defšed -__USE_GNU - \ - -33 && ! -defšed - - g__REDIRECT - \ - -34 && ( -defšed - - g__STRICT_ANSI__ - || defšed - g__USE_XOPEN2K -) - -35 - $__LDBL_REDIR1_DECL - ( -fwsÿnf -, -__Ædbl___isoc99_fwsÿnf -) - -36 - $__LDBL_REDIR1_DECL - ( -wsÿnf -, -__Ædbl___isoc99_wsÿnf -) - -37 - $__LDBL_REDIR1_DECL - ( -swsÿnf -, -__Ædbl___isoc99_swsÿnf -) - -39 - `__LDBL_REDIR_DECL - ( -fwsÿnf -); - -40 - `__LDBL_REDIR_DECL - ( -wsÿnf -); - -41 - `__LDBL_REDIR_DECL - ( -swsÿnf -); - -43 -__END_NAMESPACE_C99 - - -46 #ifdeà -__USE_ISOC99 - - -47 -__BEGIN_NAMESPACE_C99 - - -48 - `__LDBL_REDIR1_DECL - ( -wc¡Þd -, -wc¡od -); - -49 #ià! -defšed - -__USE_GNU - && !defšed -__REDIRECT - \ - -50 && ( -defšed - -__STRICT_ANSI__ - || defšed -__USE_XOPEN2K -) - -51 - $__LDBL_REDIR1_DECL - ( -vfwsÿnf -, -__Ædbl___isoc99_vfwsÿnf -) - -52 - $__LDBL_REDIR1_DECL - ( -vwsÿnf -, -__Ædbl___isoc99_vwsÿnf -) - -53 - $__LDBL_REDIR1_DECL - ( -vswsÿnf -, -__Ædbl___isoc99_vswsÿnf -) - -55 - `__LDBL_REDIR_DECL - ( -vfwsÿnf -); - -56 - `__LDBL_REDIR_DECL - ( -vwsÿnf -); - -57 - `__LDBL_REDIR_DECL - ( -vswsÿnf -); - -59 -__END_NAMESPACE_C99 - - -62 #ifdeà -__USE_GNU - - -63 - `__LDBL_REDIR1_DECL - ( -wc¡Þd_l -, -wc¡od_l -); - -66 #ià -__USE_FORTIFY_LEVEL - > 0 && -defšed - -__ex‹º_®ways_šlše - - -67 - $__LDBL_REDIR_DECL - ( -__sw´štf_chk -) - -68 - $__LDBL_REDIR_DECL - ( -__vsw´štf_chk -) - -69 #ià -__USE_FORTIFY_LEVEL - > 1 - -70 - $__LDBL_REDIR_DECL - ( -__fw´štf_chk -) - -71 - $__LDBL_REDIR_DECL - ( -__w´štf_chk -) - -72 - $__LDBL_REDIR_DECL - ( -__vfw´štf_chk -) - -73 - $__LDBL_REDIR_DECL - ( -__vw´štf_chk -) - - @/usr/include/bits/wchar.h - -20 #iâdeà -_BITS_WCHAR_H - - -21  - #_BITS_WCHAR_H - 1 - - ) - -24 #ifdeà -__WCHAR_MAX__ - - -25  - #__WCHAR_MAX - -__WCHAR_MAX__ - - - ) - -27  - #__WCHAR_MAX - (2147483647) - - ) - -32 #ifdeà -__WCHAR_UNSIGNED__ - - -33  - #__WCHAR_MIN - -L -'\0' - - ) - -37 #–ià -L -'\0' - 1 > 0 - -38  - #__WCHAR_MIN - -L -'\0' - - ) - -40  - #__WCHAR_MIN - (- -__WCHAR_MAX - - 1) - - ) - - @/usr/include/bits/wchar2.h - -20 #iâdeà -_WCHAR_H - - -25 -wch¬_t - * - $__wmemýy_chk - ( -wch¬_t - * -__»¡riù - -__s1 -, - -26 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s2 -, -size_t - -__n -, - -27 -size_t - -__ns1 -è -__THROW -; - -28 -wch¬_t - * - `__REDIRECT_NTH - ( -__wmemýy_®Ÿs -, - -29 ( -wch¬_t - * -__»¡riù - -__s1 -, - -30 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s2 -, -size_t - -__n -), - -31 -wmemýy -); - -32 -wch¬_t - * - `__REDIRECT_NTH - ( -__wmemýy_chk_w¬n -, - -33 ( -wch¬_t - * -__»¡riù - -__s1 -, - -34 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s2 -, -size_t - -__n -, - -35 -size_t - -__ns1 -), -__wmemýy_chk -) - -36 - `__w¬Ç‰r - ("wmemcpy called with†ength biggerhan size of destination " - -39 -__ex‹º_®ways_šlše - -wch¬_t - * - -40 - `__NTH - ( - $wmemýy - ( -wch¬_t - * -__»¡riù - -__s1 -, -__cÚ¡ - wch¬_ˆ*__»¡riù -__s2 -, - -41 -size_t - -__n -)) - -43 ià( - `__bos0 - ( -__s1 -è!ð( -size_t -) -1) - -45 ià(! - `__bužtš_cÚ¡ªt_p - ( -__n -)) - -46  - `__wmemýy_chk - ( -__s1 -, -__s2 -, -__n -, - -47 - `__bos0 - ( -__s1 -è/  ( -wch¬_t -)); - -49 ià( -__n - > - `__bos0 - ( -__s1 -è/  ( -wch¬_t -)) - -50  - `__wmemýy_chk_w¬n - ( -__s1 -, -__s2 -, -__n -, - -51 - `__bos0 - ( -__s1 -è/  ( -wch¬_t -)); - -53  - `__wmemýy_®Ÿs - ( -__s1 -, -__s2 -, -__n -); - -54 - } -} - -57 -wch¬_t - * - $__wmemmove_chk - ( -wch¬_t - * -__s1 -, -__cÚ¡ - wch¬_ˆ* -__s2 -, - -58 -size_t - -__n -, size_ˆ -__ns1 -è -__THROW -; - -59 -wch¬_t - * - `__REDIRECT_NTH - ( -__wmemmove_®Ÿs -, (wch¬_ˆ* -__s1 -, - -60 -__cÚ¡ - -wch¬_t - * -__s2 -, - -61 -size_t - -__n -), -wmemmove -); - -62 -wch¬_t - * - `__REDIRECT_NTH - ( -__wmemmove_chk_w¬n -, - -63 ( -wch¬_t - * -__»¡riù - -__s1 -, - -64 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s2 -, -size_t - -__n -, - -65 -size_t - -__ns1 -), -__wmemmove_chk -) - -66 - `__w¬Ç‰r - ("wmemmove called with†ength biggerhan size of destination " - -69 -__ex‹º_®ways_šlše - -wch¬_t - * - -70 - `__NTH - ( - $wmemmove - ( -wch¬_t - * -__»¡riù - -__s1 -, -__cÚ¡ - wch¬_ˆ*__»¡riù -__s2 -, - -71 -size_t - -__n -)) - -73 ià( - `__bos0 - ( -__s1 -è!ð( -size_t -) -1) - -75 ià(! - `__bužtš_cÚ¡ªt_p - ( -__n -)) - -76  - `__wmemmove_chk - ( -__s1 -, -__s2 -, -__n -, - -77 - `__bos0 - ( -__s1 -è/  ( -wch¬_t -)); - -79 ià( -__n - > - `__bos0 - ( -__s1 -è/  ( -wch¬_t -)) - -80  - `__wmemmove_chk_w¬n - ( -__s1 -, -__s2 -, -__n -, - -81 - `__bos0 - ( -__s1 -è/  ( -wch¬_t -)); - -83  - `__wmemmove_®Ÿs - ( -__s1 -, -__s2 -, -__n -); - -84 - } -} - -87 #ifdeà -__USE_GNU - - -88 -wch¬_t - * - $__wmempýy_chk - ( -wch¬_t - * -__»¡riù - -__s1 -, - -89 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s2 -, -size_t - -__n -, - -90 -size_t - -__ns1 -è -__THROW -; - -91 -wch¬_t - * - `__REDIRECT_NTH - ( -__wmempýy_®Ÿs -, - -92 ( -wch¬_t - * -__»¡riù - -__s1 -, - -93 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s2 -, - -94 -size_t - -__n -), -wmempýy -); - -95 -wch¬_t - * - `__REDIRECT_NTH - ( -__wmempýy_chk_w¬n -, - -96 ( -wch¬_t - * -__»¡riù - -__s1 -, - -97 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__s2 -, -size_t - -__n -, - -98 -size_t - -__ns1 -), -__wmempýy_chk -) - -99 - `__w¬Ç‰r - ("wmempcpy called with†ength biggerhan size of destination " - -102 -__ex‹º_®ways_šlše - -wch¬_t - * - -103 - `__NTH - ( - $wmempýy - ( -wch¬_t - * -__»¡riù - -__s1 -, -__cÚ¡ - wch¬_ˆ*__»¡riù -__s2 -, - -104 -size_t - -__n -)) - -106 ià( - `__bos0 - ( -__s1 -è!ð( -size_t -) -1) - -108 ià(! - `__bužtš_cÚ¡ªt_p - ( -__n -)) - -109  - `__wmempýy_chk - ( -__s1 -, -__s2 -, -__n -, - -110 - `__bos0 - ( -__s1 -è/  ( -wch¬_t -)); - -112 ià( -__n - > - `__bos0 - ( -__s1 -è/  ( -wch¬_t -)) - -113  - `__wmempýy_chk_w¬n - ( -__s1 -, -__s2 -, -__n -, - -114 - `__bos0 - ( -__s1 -è/  ( -wch¬_t -)); - -116  - `__wmempýy_®Ÿs - ( -__s1 -, -__s2 -, -__n -); - -117 - } -} - -121 -wch¬_t - * - $__wmem£t_chk - ( -wch¬_t - * -__s -, wch¬_ˆ -__c -, -size_t - -__n -, - -122 -size_t - -__ns -è -__THROW -; - -123 -wch¬_t - * - `__REDIRECT_NTH - ( -__wmem£t_®Ÿs -, (wch¬_ˆ* -__s -, wch¬_ˆ -__c -, - -124 -size_t - -__n -), -wmem£t -); - -125 -wch¬_t - * - `__REDIRECT_NTH - ( -__wmem£t_chk_w¬n -, - -126 ( -wch¬_t - * -__s -, wch¬_ˆ -__c -, -size_t - -__n -, - -127 -size_t - -__ns -), -__wmem£t_chk -) - -128 - `__w¬Ç‰r - ("wmemset called with†ength biggerhan size of destination " - -131 -__ex‹º_®ways_šlše - -wch¬_t - * - -132 - `__NTH - ( - $wmem£t - ( -wch¬_t - * -__»¡riù - -__s -, wch¬_ˆ -__c -, -size_t - -__n -)) - -134 ià( - `__bos0 - ( -__s -è!ð( -size_t -) -1) - -136 ià(! - `__bužtš_cÚ¡ªt_p - ( -__n -)) - -137  - `__wmem£t_chk - ( -__s -, -__c -, -__n -, - `__bos0 - (__sè/  ( -wch¬_t -)); - -139 ià( -__n - > - `__bos0 - ( -__s -è/  ( -wch¬_t -)) - -140  - `__wmem£t_chk_w¬n - ( -__s -, -__c -, -__n -, - -141 - `__bos0 - ( -__s -è/  ( -wch¬_t -)); - -143  - `__wmem£t_®Ÿs - ( -__s -, -__c -, -__n -); - -144 - } -} - -147 -wch¬_t - * - $__wcsýy_chk - ( -wch¬_t - * -__»¡riù - -__de¡ -, - -148 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, - -149 -size_t - -__n -è -__THROW -; - -150 -wch¬_t - * - `__REDIRECT_NTH - ( -__wcsýy_®Ÿs -, - -151 ( -wch¬_t - * -__»¡riù - -__de¡ -, - -152 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -), -wcsýy -); - -154 -__ex‹º_®ways_šlše - -wch¬_t - * - -155 - `__NTH - ( - $wcsýy - ( -wch¬_t - * -__de¡ -, -__cÚ¡ - wch¬_ˆ* -__¤c -)) - -157 ià( - `__bos - ( -__de¡ -è!ð( -size_t -) -1) - -158  - `__wcsýy_chk - ( -__de¡ -, -__¤c -, - `__bos - (__de¡è/  ( -wch¬_t -)); - -159  - `__wcsýy_®Ÿs - ( -__de¡ -, -__¤c -); - -160 - } -} - -163 -wch¬_t - * - $__wýýy_chk - ( -wch¬_t - * -__de¡ -, -__cÚ¡ - wch¬_ˆ* -__¤c -, - -164 -size_t - -__de¡Ën -è -__THROW -; - -165 -wch¬_t - * - `__REDIRECT_NTH - ( -__wýýy_®Ÿs -, (wch¬_ˆ* -__de¡ -, - -166 -__cÚ¡ - -wch¬_t - * -__¤c -), - -167 -wýýy -); - -169 -__ex‹º_®ways_šlše - -wch¬_t - * - -170 - `__NTH - ( - $wýýy - ( -wch¬_t - * -__de¡ -, -__cÚ¡ - wch¬_ˆ* -__¤c -)) - -172 ià( - `__bos - ( -__de¡ -è!ð( -size_t -) -1) - -173  - `__wýýy_chk - ( -__de¡ -, -__¤c -, - `__bos - (__de¡è/  ( -wch¬_t -)); - -174  - `__wýýy_®Ÿs - ( -__de¡ -, -__¤c -); - -175 - } -} - -178 -wch¬_t - * - $__wc¢ýy_chk - ( -wch¬_t - * -__»¡riù - -__de¡ -, - -179 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, -size_t - -__n -, - -180 -size_t - -__de¡Ën -è -__THROW -; - -181 -wch¬_t - * - `__REDIRECT_NTH - ( -__wc¢ýy_®Ÿs -, - -182 ( -wch¬_t - * -__»¡riù - -__de¡ -, - -183 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, - -184 -size_t - -__n -), -wc¢ýy -); - -185 -wch¬_t - * - `__REDIRECT_NTH - ( -__wc¢ýy_chk_w¬n -, - -186 ( -wch¬_t - * -__»¡riù - -__de¡ -, - -187 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, - -188 -size_t - -__n -, size_ˆ -__de¡Ën -), -__wc¢ýy_chk -) - -189 - `__w¬Ç‰r - ("wcsncpy called with†ength biggerhan size of destination " - -192 -__ex‹º_®ways_šlše - -wch¬_t - * - -193 - `__NTH - ( - $wc¢ýy - ( -wch¬_t - * -__de¡ -, -__cÚ¡ - wch¬_ˆ* -__¤c -, -size_t - -__n -)) - -195 ià( - `__bos - ( -__de¡ -è!ð( -size_t -) -1) - -197 ià(! - `__bužtš_cÚ¡ªt_p - ( -__n -)) - -198  - `__wc¢ýy_chk - ( -__de¡ -, -__¤c -, -__n -, - -199 - `__bos - ( -__de¡ -è/  ( -wch¬_t -)); - -200 ià( -__n - > - `__bos - ( -__de¡ -è/  ( -wch¬_t -)) - -201  - `__wc¢ýy_chk_w¬n - ( -__de¡ -, -__¤c -, -__n -, - -202 - `__bos - ( -__de¡ -è/  ( -wch¬_t -)); - -204  - `__wc¢ýy_®Ÿs - ( -__de¡ -, -__¤c -, -__n -); - -205 - } -} - -208 -wch¬_t - * - $__wýnýy_chk - ( -wch¬_t - * -__»¡riù - -__de¡ -, - -209 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, -size_t - -__n -, - -210 -size_t - -__de¡Ën -è -__THROW -; - -211 -wch¬_t - * - `__REDIRECT_NTH - ( -__wýnýy_®Ÿs -, - -212 ( -wch¬_t - * -__»¡riù - -__de¡ -, - -213 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, - -214 -size_t - -__n -), -wýnýy -); - -215 -wch¬_t - * - `__REDIRECT_NTH - ( -__wýnýy_chk_w¬n -, - -216 ( -wch¬_t - * -__»¡riù - -__de¡ -, - -217 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, - -218 -size_t - -__n -, size_ˆ -__de¡Ën -), -__wýnýy_chk -) - -219 - `__w¬Ç‰r - ("wcpncpy called with†ength biggerhan size of destination " - -222 -__ex‹º_®ways_šlše - -wch¬_t - * - -223 - `__NTH - ( - $wýnýy - ( -wch¬_t - * -__de¡ -, -__cÚ¡ - wch¬_ˆ* -__¤c -, -size_t - -__n -)) - -225 ià( - `__bos - ( -__de¡ -è!ð( -size_t -) -1) - -227 ià(! - `__bužtš_cÚ¡ªt_p - ( -__n -)) - -228  - `__wýnýy_chk - ( -__de¡ -, -__¤c -, -__n -, - -229 - `__bos - ( -__de¡ -è/  ( -wch¬_t -)); - -230 ià( -__n - > - `__bos - ( -__de¡ -è/  ( -wch¬_t -)) - -231  - `__wýnýy_chk_w¬n - ( -__de¡ -, -__¤c -, -__n -, - -232 - `__bos - ( -__de¡ -è/  ( -wch¬_t -)); - -234  - `__wýnýy_®Ÿs - ( -__de¡ -, -__¤c -, -__n -); - -235 - } -} - -238 -wch¬_t - * - $__wcsÿt_chk - ( -wch¬_t - * -__»¡riù - -__de¡ -, - -239 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, - -240 -size_t - -__de¡Ën -è -__THROW -; - -241 -wch¬_t - * - `__REDIRECT_NTH - ( -__wcsÿt_®Ÿs -, - -242 ( -wch¬_t - * -__»¡riù - -__de¡ -, - -243 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -), -wcsÿt -); - -245 -__ex‹º_®ways_šlše - -wch¬_t - * - -246 - `__NTH - ( - $wcsÿt - ( -wch¬_t - * -__de¡ -, -__cÚ¡ - wch¬_ˆ* -__¤c -)) - -248 ià( - `__bos - ( -__de¡ -è!ð( -size_t -) -1) - -249  - `__wcsÿt_chk - ( -__de¡ -, -__¤c -, - `__bos - (__de¡è/  ( -wch¬_t -)); - -250  - `__wcsÿt_®Ÿs - ( -__de¡ -, -__¤c -); - -251 - } -} - -254 -wch¬_t - * - $__wc¢ÿt_chk - ( -wch¬_t - * -__»¡riù - -__de¡ -, - -255 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, - -256 -size_t - -__n -, size_ˆ -__de¡Ën -è -__THROW -; - -257 -wch¬_t - * - `__REDIRECT_NTH - ( -__wc¢ÿt_®Ÿs -, - -258 ( -wch¬_t - * -__»¡riù - -__de¡ -, - -259 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__¤c -, - -260 -size_t - -__n -), -wc¢ÿt -); - -262 -__ex‹º_®ways_šlše - -wch¬_t - * - -263 - `__NTH - ( - $wc¢ÿt - ( -wch¬_t - * -__de¡ -, -__cÚ¡ - wch¬_ˆ* -__¤c -, -size_t - -__n -)) - -265 ià( - `__bos - ( -__de¡ -è!ð( -size_t -) -1) - -266  - `__wc¢ÿt_chk - ( -__de¡ -, -__¤c -, -__n -, - -267 - `__bos - ( -__de¡ -è/  ( -wch¬_t -)); - -268  - `__wc¢ÿt_®Ÿs - ( -__de¡ -, -__¤c -, -__n -); - -269 - } -} - -272  - $__sw´štf_chk - ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__n -, - -273  -__æag -, -size_t - -__s_Ën -, - -274 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...) - -275 -__THROW - ; - -277  - `__REDIRECT_NTH_LDBL - ( -__sw´štf_®Ÿs -, - -278 ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__n -, - -279 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fmt -, ...), - -280 -sw´štf -); - -282 #ifdeà -__va_¬g_·ck - - -283 -__ex‹º_®ways_šlše -  - -284 - `__NTH - ( - $sw´štf - ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__n -, - -285 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fmt -, ...)) - -287 ià( - `__bos - ( -__s -è!ð( -size_t -è-1 || -__USE_FORTIFY_LEVEL - > 1) - -288  - `__sw´štf_chk - ( -__s -, -__n -, -__USE_FORTIFY_LEVEL - - 1, - -289 - `__bos - ( -__s -è/  ( -wch¬_t -), - -290 -__fmt -, - `__va_¬g_·ck - ()); - -291  - `__sw´štf_®Ÿs - ( -__s -, -__n -, -__fmt -, - `__va_¬g_·ck - ()); - -292 - } -} - -293 #–ià! -defšed - -__ýlu¥lus - - -295  - #sw´štf -( -s -, -n -, ...) \ - -296 ( - `__bos - ( -s -è!ð( -size_t -è-1 || -__USE_FORTIFY_LEVEL - > 1 \ - -297 ? - `__sw´štf_chk - ( -s -, -n -, -__USE_FORTIFY_LEVEL - - 1, \ - -298 - `__bos - ( -s -è/  ( -wch¬_t -), -__VA_ARGS__ -) \ - -299 : - `sw´štf - ( -s -, -n -, -__VA_ARGS__ -)) - - ) - -302  - $__vsw´štf_chk - ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__n -, - -303  -__æag -, -size_t - -__s_Ën -, - -304 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -305 -__gnuc_va_li¡ - -__¬g -) - -306 -__THROW - ; - -308  - `__REDIRECT_NTH_LDBL - ( -__vsw´štf_®Ÿs -, - -309 ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__n -, - -310 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fmt -, - -311 -__gnuc_va_li¡ - -__­ -), -vsw´štf -); - -313 -__ex‹º_®ways_šlše -  - -314 - `__NTH - ( - $vsw´štf - ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__n -, - -315 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fmt -, -__gnuc_va_li¡ - -__­ -)) - -317 ià( - `__bos - ( -__s -è!ð( -size_t -è-1 || -__USE_FORTIFY_LEVEL - > 1) - -318  - `__vsw´štf_chk - ( -__s -, -__n -, -__USE_FORTIFY_LEVEL - - 1, - -319 - `__bos - ( -__s -è/  ( -wch¬_t -), -__fmt -, -__­ -); - -320  - `__vsw´štf_®Ÿs - ( -__s -, -__n -, -__fmt -, -__­ -); - -321 - } -} - -324 #ià -__USE_FORTIFY_LEVEL - > 1 - -326  -__fw´štf_chk - ( -__FILE - * -__»¡riù - -__¡»am -,  -__æag -, - -327 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, ...); - -328  -__w´štf_chk - ( -__æag -, -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -330  -__vfw´štf_chk - ( -__FILE - * -__»¡riù - -__¡»am -,  -__æag -, - -331 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -332 -__gnuc_va_li¡ - -__­ -); - -333  -__vw´štf_chk - ( -__æag -, -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fÜm© -, - -334 -__gnuc_va_li¡ - -__­ -); - -336 #ifdeà -__va_¬g_·ck - - -337 -__ex‹º_®ways_šlše -  - -338 - $w´štf - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fmt -, ...) - -340  - `__w´štf_chk - ( -__USE_FORTIFY_LEVEL - - 1, -__fmt -, - `__va_¬g_·ck - ()); - -341 - } -} - -343 -__ex‹º_®ways_šlše -  - -344 - $fw´štf - ( -__FILE - * -__»¡riù - -__¡»am -, -__cÚ¡ - -wch¬_t - *__»¡riù -__fmt -, ...) - -346  - `__fw´štf_chk - ( -__¡»am -, -__USE_FORTIFY_LEVEL - - 1, -__fmt -, - -347 - `__va_¬g_·ck - ()); - -348 - } -} - -349 #–ià! -defšed - -__ýlu¥lus - - -350  - #w´štf -(...) \ - -351 - `__w´štf_chk - ( -__USE_FORTIFY_LEVEL - - 1, -__VA_ARGS__ -) - - ) - -352  - #fw´štf -( -¡»am -, ...) \ - -353 - `__fw´štf_chk - ( -¡»am -, -__USE_FORTIFY_LEVEL - - 1, -__VA_ARGS__ -) - - ) - -356 -__ex‹º_®ways_šlše -  - -357 - $vw´štf - ( -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fmt -, -__gnuc_va_li¡ - -__­ -) - -359  - `__vw´štf_chk - ( -__USE_FORTIFY_LEVEL - - 1, -__fmt -, -__­ -); - -360 - } -} - -362 -__ex‹º_®ways_šlše -  - -363 - $vfw´štf - ( -__FILE - * -__»¡riù - -__¡»am -, - -364 -__cÚ¡ - -wch¬_t - * -__»¡riù - -__fmt -, -__gnuc_va_li¡ - -__­ -) - -366  - `__vfw´štf_chk - ( -__¡»am -, -__USE_FORTIFY_LEVEL - - 1, -__fmt -, -__­ -); - -367 - } -} - -371 -wch¬_t - * - $__fg‘ws_chk - ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__size -,  -__n -, - -372 -__FILE - * -__»¡riù - -__¡»am -è -__wur -; - -373 -wch¬_t - * - `__REDIRECT - ( -__fg‘ws_®Ÿs -, - -374 ( -wch¬_t - * -__»¡riù - -__s -,  -__n -, - -375 -__FILE - * -__»¡riù - -__¡»am -), -fg‘ws -è -__wur -; - -376 -wch¬_t - * - `__REDIRECT - ( -__fg‘ws_chk_w¬n -, - -377 ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__size -,  -__n -, - -378 -__FILE - * -__»¡riù - -__¡»am -), -__fg‘ws_chk -) - -379 -__wur - - `__w¬Ç‰r - ("fgetws called with bigger sizehan†ength " - -382 -__ex‹º_®ways_šlše - -__wur - -wch¬_t - * - -383 - $fg‘ws - ( -wch¬_t - * -__»¡riù - -__s -,  -__n -, -__FILE - *__»¡riù -__¡»am -) - -385 ià( - `__bos - ( -__s -è!ð( -size_t -) -1) - -387 ià(! - `__bužtš_cÚ¡ªt_p - ( -__n -) || __n <= 0) - -388  - `__fg‘ws_chk - ( -__s -, - `__bos - (__sè/  ( -wch¬_t -), - -389 -__n -, -__¡»am -); - -391 ià(( -size_t -è -__n - > - `__bos - ( -__s -è/  ( -wch¬_t -)) - -392  - `__fg‘ws_chk_w¬n - ( -__s -, - `__bos - (__sè/  ( -wch¬_t -), - -393 -__n -, -__¡»am -); - -395  - `__fg‘ws_®Ÿs - ( -__s -, -__n -, -__¡»am -); - -396 - } -} - -398 #ifdeà -__USE_GNU - - -399 -wch¬_t - * - $__fg‘ws_uÆocked_chk - ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__size -, - -400  -__n -, -__FILE - * -__»¡riù - -__¡»am -) - -401 -__wur -; - -402 -wch¬_t - * - `__REDIRECT - ( -__fg‘ws_uÆocked_®Ÿs -, - -403 ( -wch¬_t - * -__»¡riù - -__s -,  -__n -, - -404 -__FILE - * -__»¡riù - -__¡»am -), -fg‘ws_uÆocked -) - -405 -__wur -; - -406 -wch¬_t - * - `__REDIRECT - ( -__fg‘ws_uÆocked_chk_w¬n -, - -407 ( -wch¬_t - * -__»¡riù - -__s -, -size_t - -__size -,  -__n -, - -408 -__FILE - * -__»¡riù - -__¡»am -), - -409 -__fg‘ws_uÆocked_chk -) - -410 -__wur - - `__w¬Ç‰r - ("fgetws_unlocked called with bigger sizehan†ength " - -413 -__ex‹º_®ways_šlše - -__wur - -wch¬_t - * - -414 - $fg‘ws_uÆocked - ( -wch¬_t - * -__»¡riù - -__s -,  -__n -, -__FILE - *__»¡riù -__¡»am -) - -416 ià( - `__bos - ( -__s -è!ð( -size_t -) -1) - -418 ià(! - `__bužtš_cÚ¡ªt_p - ( -__n -) || __n <= 0) - -419  - `__fg‘ws_uÆocked_chk - ( -__s -, - `__bos - (__sè/  ( -wch¬_t -), - -420 -__n -, -__¡»am -); - -422 ià(( -size_t -è -__n - > - `__bos - ( -__s -è/  ( -wch¬_t -)) - -423  - `__fg‘ws_uÆocked_chk_w¬n - ( -__s -, - `__bos - (__sè/  ( -wch¬_t -), - -424 -__n -, -__¡»am -); - -426  - `__fg‘ws_uÆocked_®Ÿs - ( -__s -, -__n -, -__¡»am -); - -427 - } -} - -431 -size_t - - $__wütomb_chk - (* -__s -, -wch¬_t - -__wch¬ -, -mb¡©e_t - * -__p -, - -432 -size_t - -__buæ’ -è -__THROW - -__wur -; - -433 -size_t - - `__REDIRECT_NTH - ( -__wütomb_®Ÿs -, - -434 (* -__»¡riù - -__s -, -wch¬_t - -__wch¬ -, - -435 -mb¡©e_t - * -__»¡riù - -__ps -), -wütomb -è -__wur -; - -437 -__ex‹º_®ways_šlše - -__wur - -size_t - - -438 - `__NTH - ( - $wütomb - (* -__s -, -wch¬_t - -__wch¬ -, -mb¡©e_t - * -__ps -)) - -443  - #__WCHAR_MB_LEN_MAX - 16 - - ) - -444 #ià -defšed - -MB_LEN_MAX - && MB_LEN_MAX !ð -__WCHAR_MB_LEN_MAX - - -447 ià( - `__bos - ( -__s -è!ð( -size_t -è-1 && -__WCHAR_MB_LEN_MAX - > __bos (__s)) - -448  - `__wütomb_chk - ( -__s -, -__wch¬ -, -__ps -, - `__bos - (__s)); - -449  - `__wütomb_®Ÿs - ( -__s -, -__wch¬ -, -__ps -); - -450 - } -} - -453 -size_t - - $__mb¤towcs_chk - ( -wch¬_t - * -__»¡riù - -__d¡ -, - -454 -__cÚ¡ - ** -__»¡riù - -__¤c -, - -455 -size_t - -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -, - -456 -size_t - -__d¡Ën -è -__THROW -; - -457 -size_t - - `__REDIRECT_NTH - ( -__mb¤towcs_®Ÿs -, - -458 ( -wch¬_t - * -__»¡riù - -__d¡ -, - -459 -__cÚ¡ - ** -__»¡riù - -__¤c -, - -460 -size_t - -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -), - -461 -mb¤towcs -); - -462 -size_t - - `__REDIRECT_NTH - ( -__mb¤towcs_chk_w¬n -, - -463 ( -wch¬_t - * -__»¡riù - -__d¡ -, - -464 -__cÚ¡ - ** -__»¡riù - -__¤c -, - -465 -size_t - -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -, - -466 -size_t - -__d¡Ën -), -__mb¤towcs_chk -) - -467 - `__w¬Ç‰r - ("mbsrtowcs called with dst buffer smallerhan†en " - -470 -__ex‹º_®ways_šlše - -size_t - - -471 - `__NTH - ( - $mb¤towcs - ( -wch¬_t - * -__»¡riù - -__d¡ -, -__cÚ¡ - **__»¡riù -__¤c -, - -472 -size_t - -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -)) - -474 ià( - `__bos - ( -__d¡ -è!ð( -size_t -) -1) - -476 ià(! - `__bužtš_cÚ¡ªt_p - ( -__Ën -)) - -477  - `__mb¤towcs_chk - ( -__d¡ -, -__¤c -, -__Ën -, -__ps -, - -478 - `__bos - ( -__d¡ -è/  ( -wch¬_t -)); - -480 ià( -__Ën - > - `__bos - ( -__d¡ -è/  ( -wch¬_t -)) - -481  - `__mb¤towcs_chk_w¬n - ( -__d¡ -, -__¤c -, -__Ën -, -__ps -, - -482 - `__bos - ( -__d¡ -è/  ( -wch¬_t -)); - -484  - `__mb¤towcs_®Ÿs - ( -__d¡ -, -__¤c -, -__Ën -, -__ps -); - -485 - } -} - -488 -size_t - - $__wc¤tombs_chk - (* -__»¡riù - -__d¡ -, - -489 -__cÚ¡ - -wch¬_t - ** -__»¡riù - -__¤c -, - -490 -size_t - -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -, - -491 -size_t - -__d¡Ën -è -__THROW -; - -492 -size_t - - `__REDIRECT_NTH - ( -__wc¤tombs_®Ÿs -, - -493 (* -__»¡riù - -__d¡ -, - -494 -__cÚ¡ - -wch¬_t - ** -__»¡riù - -__¤c -, - -495 -size_t - -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -), - -496 -wc¤tombs -); - -497 -size_t - - `__REDIRECT_NTH - ( -__wc¤tombs_chk_w¬n -, - -498 (* -__»¡riù - -__d¡ -, - -499 -__cÚ¡ - -wch¬_t - ** -__»¡riù - -__¤c -, - -500 -size_t - -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -, - -501 -size_t - -__d¡Ën -), -__wc¤tombs_chk -) - -502 - `__w¬Ç‰r - ("wcsrtombs called with dst buffer smallerhan†en"); - -504 -__ex‹º_®ways_šlše - -size_t - - -505 - `__NTH - ( - $wc¤tombs - (* -__»¡riù - -__d¡ -, -__cÚ¡ - -wch¬_t - **__»¡riù -__¤c -, - -506 -size_t - -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -)) - -508 ià( - `__bos - ( -__d¡ -è!ð( -size_t -) -1) - -510 ià(! - `__bužtš_cÚ¡ªt_p - ( -__Ën -)) - -511  - `__wc¤tombs_chk - ( -__d¡ -, -__¤c -, -__Ën -, -__ps -, - `__bos - (__dst)); - -513 ià( -__Ën - > - `__bos - ( -__d¡ -)) - -514  - `__wc¤tombs_chk_w¬n - ( -__d¡ -, -__¤c -, -__Ën -, -__ps -, - `__bos - (__dst)); - -516  - `__wc¤tombs_®Ÿs - ( -__d¡ -, -__¤c -, -__Ën -, -__ps -); - -517 - } -} - -520 #ifdeà -__USE_GNU - - -521 -size_t - - $__mb¢¹owcs_chk - ( -wch¬_t - * -__»¡riù - -__d¡ -, - -522 -__cÚ¡ - ** -__»¡riù - -__¤c -, -size_t - -__nmc -, - -523 -size_t - -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -, - -524 -size_t - -__d¡Ën -è -__THROW -; - -525 -size_t - - `__REDIRECT_NTH - ( -__mb¢¹owcs_®Ÿs -, - -526 ( -wch¬_t - * -__»¡riù - -__d¡ -, - -527 -__cÚ¡ - ** -__»¡riù - -__¤c -, -size_t - -__nmc -, - -528 -size_t - -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -), - -529 -mb¢¹owcs -); - -530 -size_t - - `__REDIRECT_NTH - ( -__mb¢¹owcs_chk_w¬n -, - -531 ( -wch¬_t - * -__»¡riù - -__d¡ -, - -532 -__cÚ¡ - ** -__»¡riù - -__¤c -, -size_t - -__nmc -, - -533 -size_t - -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -, - -534 -size_t - -__d¡Ën -), -__mb¢¹owcs_chk -) - -535 - `__w¬Ç‰r - ("mbsnrtowcs called with dst buffer smallerhan†en " - -538 -__ex‹º_®ways_šlše - -size_t - - -539 - `__NTH - ( - $mb¢¹owcs - ( -wch¬_t - * -__»¡riù - -__d¡ -, -__cÚ¡ - **__»¡riù -__¤c -, - -540 -size_t - -__nmc -, size_ˆ -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -)) - -542 ià( - `__bos - ( -__d¡ -è!ð( -size_t -) -1) - -544 ià(! - `__bužtš_cÚ¡ªt_p - ( -__Ën -)) - -545  - `__mb¢¹owcs_chk - ( -__d¡ -, -__¤c -, -__nmc -, -__Ën -, -__ps -, - -546 - `__bos - ( -__d¡ -è/  ( -wch¬_t -)); - -548 ià( -__Ën - > - `__bos - ( -__d¡ -è/  ( -wch¬_t -)) - -549  - `__mb¢¹owcs_chk_w¬n - ( -__d¡ -, -__¤c -, -__nmc -, -__Ën -, -__ps -, - -550 - `__bos - ( -__d¡ -è/  ( -wch¬_t -)); - -552  - `__mb¢¹owcs_®Ÿs - ( -__d¡ -, -__¤c -, -__nmc -, -__Ën -, -__ps -); - -553 - } -} - -556 -size_t - - $__wc¢¹ombs_chk - (* -__»¡riù - -__d¡ -, - -557 -__cÚ¡ - -wch¬_t - ** -__»¡riù - -__¤c -, - -558 -size_t - -__nwc -, size_ˆ -__Ën -, - -559 -mb¡©e_t - * -__»¡riù - -__ps -, -size_t - -__d¡Ën -) - -560 -__THROW -; - -561 -size_t - - `__REDIRECT_NTH - ( -__wc¢¹ombs_®Ÿs -, - -562 (* -__»¡riù - -__d¡ -, - -563 -__cÚ¡ - -wch¬_t - ** -__»¡riù - -__¤c -, - -564 -size_t - -__nwc -, size_ˆ -__Ën -, - -565 -mb¡©e_t - * -__»¡riù - -__ps -), -wc¢¹ombs -); - -566 -size_t - - `__REDIRECT_NTH - ( -__wc¢¹ombs_chk_w¬n -, - -567 (* -__»¡riù - -__d¡ -, - -568 -__cÚ¡ - -wch¬_t - ** -__»¡riù - -__¤c -, - -569 -size_t - -__nwc -, size_ˆ -__Ën -, - -570 -mb¡©e_t - * -__»¡riù - -__ps -, - -571 -size_t - -__d¡Ën -), -__wc¢¹ombs_chk -) - -572 - `__w¬Ç‰r - ("wcsnrtombs called with dst buffer smallerhan†en"); - -574 -__ex‹º_®ways_šlše - -size_t - - -575 - `__NTH - ( - $wc¢¹ombs - (* -__»¡riù - -__d¡ -, -__cÚ¡ - -wch¬_t - **__»¡riù -__¤c -, - -576 -size_t - -__nwc -, size_ˆ -__Ën -, -mb¡©e_t - * -__»¡riù - -__ps -)) - -578 ià( - `__bos - ( -__d¡ -è!ð( -size_t -) -1) - -580 ià(! - `__bužtš_cÚ¡ªt_p - ( -__Ën -)) - -581  - `__wc¢¹ombs_chk - ( -__d¡ -, -__¤c -, -__nwc -, -__Ën -, -__ps -, - -582 - `__bos - ( -__d¡ -)); - -584 ià( -__Ën - > - `__bos - ( -__d¡ -)) - -585  - `__wc¢¹ombs_chk_w¬n - ( -__d¡ -, -__¤c -, -__nwc -, -__Ën -, -__ps -, - -586 - `__bos - ( -__d¡ -)); - -588  - `__wc¢¹ombs_®Ÿs - ( -__d¡ -, -__¤c -, -__nwc -, -__Ën -, -__ps -); - -589 - } -} - - @/usr/include/errno.h - -23 #iâdef -_ERRNO_H - - -27 #iâdef -__Ãed_Em©h - - -28  - #_ERRNO_H - 1 - - ) - -29  - ~<ã©u»s.h -> - -32 - g__BEGIN_DECLS - - -36  - ~ - -37 #undeà -__Ãed_Em©h - - -39 #ifdef -_ERRNO_H - - -46 #iâdef -”ºo - - -47  -”ºo -; - -50 #ifdeà -__USE_GNU - - -55 * -´og¿m_švoÿtiÚ_Çme -, * -´og¿m_švoÿtiÚ_shÜt_Çme -; - -59 - g__END_DECLS - - -67 #ià -defšed - -__USE_GNU - || defšed -__Ãed_”rÜ_t - - -68 #iâdeà -__”rÜ_t_defšed - - -69  - t”rÜ_t -; - -70  - #__”rÜ_t_defšed - 1 - - ) - -72 #undeà -__Ãed_”rÜ_t - - - @/usr/include/gnu/option-groups.h - -10 #iâdeà -__GNU_OPTION_GROUPS_H - - -11  - #__GNU_OPTION_GROUPS_H - - - ) - -13  - #__OPTION_EGLIBC_ADVANCED_INET6 - 1 - - ) - -14  - #__OPTION_EGLIBC_BACKTRACE - 1 - - ) - -15  - #__OPTION_EGLIBC_BIG_MACROS - 1 - - ) - -16  - #__OPTION_EGLIBC_BSD - 1 - - ) - -17  - #__OPTION_EGLIBC_CATGETS - 1 - - ) - -18  - #__OPTION_EGLIBC_CHARSETS - 1 - - ) - -19  - #__OPTION_EGLIBC_CXX_TESTS - 1 - - ) - -20  - #__OPTION_EGLIBC_DB_ALIASES - 1 - - ) - -21  - #__OPTION_EGLIBC_ENVZ - 1 - - ) - -22  - #__OPTION_EGLIBC_FCVT - 1 - - ) - -23  - #__OPTION_EGLIBC_FMTMSG - 1 - - ) - -24  - #__OPTION_EGLIBC_FSTAB - 1 - - ) - -25  - #__OPTION_EGLIBC_FTRAVERSE - 1 - - ) - -26  - #__OPTION_EGLIBC_GETLOGIN - 1 - - ) - -27  - #__OPTION_EGLIBC_INET - 1 - - ) - -28  - #__OPTION_EGLIBC_LIBM - 1 - - ) - -29  - #__OPTION_EGLIBC_LOCALES - 1 - - ) - -30  - #__OPTION_EGLIBC_LOCALE_CODE - 1 - - ) - -31  - #__OPTION_EGLIBC_MEMUSAGE - 1 - - ) - -32  - #__OPTION_EGLIBC_NIS - 1 - - ) - -33  - #__OPTION_EGLIBC_NSSWITCH - 1 - - ) - -34  - #__OPTION_EGLIBC_RCMD - 1 - - ) - -35  - #__OPTION_EGLIBC_SPAWN - 1 - - ) - -36  - #__OPTION_EGLIBC_STREAMS - 1 - - ) - -37  - #__OPTION_EGLIBC_SUNRPC - 1 - - ) - -38  - #__OPTION_EGLIBC_UTMP - 1 - - ) - -39  - #__OPTION_EGLIBC_UTMPX - 1 - - ) - -40  - #__OPTION_EGLIBC_WORDEXP - 1 - - ) - -41  - #__OPTION_POSIX_C_LANG_WIDE_CHAR - 1 - - ) - -42  - #__OPTION_POSIX_REGEXP - 1 - - ) - -43  - #__OPTION_POSIX_REGEXP_GLIBC - 1 - - ) - -44  - #__OPTION_POSIX_WIDE_CHAR_DEVICE_IO - 1 - - ) - - @/usr/include/pthread.h - -20 #iâdeà -_PTHREAD_H - - -21  - #_PTHREAD_H - 1 - - ) - -23  - ~<ã©u»s.h -> - -24  - ~<’dŸn.h -> - -25  - ~ - -26  - ~ - -28  - #__Ãed_sig£t_t - - - ) - -29  - ~ - -30  - ~ - -31  - ~ - -32  - ~ - -38 - mPTHREAD_CREATE_JOINABLE -, - -39  - #PTHREAD_CREATE_JOINABLE - -PTHREAD_CREATE_JOINABLE - - - ) - -40 - mPTHREAD_CREATE_DETACHED - - -41  - #PTHREAD_CREATE_DETACHED - -PTHREAD_CREATE_DETACHED - - - ) - -48 - mPTHREAD_MUTEX_TIMED_NP -, - -49 - mPTHREAD_MUTEX_RECURSIVE_NP -, - -50 - mPTHREAD_MUTEX_ERRORCHECK_NP -, - -51 - mPTHREAD_MUTEX_ADAPTIVE_NP - - -52 #ifdeà -__USE_UNIX98 - - -54 - mPTHREAD_MUTEX_NORMAL - = -PTHREAD_MUTEX_TIMED_NP -, - -55 - mPTHREAD_MUTEX_RECURSIVE - = -PTHREAD_MUTEX_RECURSIVE_NP -, - -56 - mPTHREAD_MUTEX_ERRORCHECK - = -PTHREAD_MUTEX_ERRORCHECK_NP -, - -57 - mPTHREAD_MUTEX_DEFAULT - = -PTHREAD_MUTEX_NORMAL - - -59 #ifdeà -__USE_GNU - - -61 , - mPTHREAD_MUTEX_FAST_NP - = -PTHREAD_MUTEX_TIMED_NP - - -66 #ifdeà -__USE_XOPEN2K - - -70 - mPTHREAD_MUTEX_STALLED -, - -71 - mPTHREAD_MUTEX_STALLED_NP - = -PTHREAD_MUTEX_STALLED -, - -72 - mPTHREAD_MUTEX_ROBUST -, - -73 - mPTHREAD_MUTEX_ROBUST_NP - = -PTHREAD_MUTEX_ROBUST - - -78 #ifdeà -__USE_UNIX98 - - -82 - mPTHREAD_PRIO_NONE -, - -83 - mPTHREAD_PRIO_INHERIT -, - -84 - mPTHREAD_PRIO_PROTECT - - -90 #ià -__WORDSIZE - == 64 - -91  - #PTHREAD_MUTEX_INITIALIZER - \ - -92 { { 0, 0, 0, 0, 0, 0, { 0, 0 } } } - - ) - -93 #ifdeà -__USE_GNU - - -94  - #PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP - \ - -95 { { 0, 0, 0, 0, -PTHREAD_MUTEX_RECURSIVE_NP -, 0, { 0, 0 } } } - - ) - -96  - #PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP - \ - -97 { { 0, 0, 0, 0, -PTHREAD_MUTEX_ERRORCHECK_NP -, 0, { 0, 0 } } } - - ) - -98  - #PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP - \ - -99 { { 0, 0, 0, 0, -PTHREAD_MUTEX_ADAPTIVE_NP -, 0, { 0, 0 } } } - - ) - -102  - #PTHREAD_MUTEX_INITIALIZER - \ - -103 { { 0, 0, 0, 0, 0, { 0 } } } - - ) - -104 #ifdeà -__USE_GNU - - -105  - #PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP - \ - -106 { { 0, 0, 0, -PTHREAD_MUTEX_RECURSIVE_NP -, 0, { 0 } } } - - ) - -107  - #PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP - \ - -108 { { 0, 0, 0, -PTHREAD_MUTEX_ERRORCHECK_NP -, 0, { 0 } } } - - ) - -109  - #PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP - \ - -110 { { 0, 0, 0, -PTHREAD_MUTEX_ADAPTIVE_NP -, 0, { 0 } } } - - ) - -116 #ià -defšed - -__USE_UNIX98 - || defšed -__USE_XOPEN2K - - -119 - mPTHREAD_RWLOCK_PREFER_READER_NP -, - -120 - mPTHREAD_RWLOCK_PREFER_WRITER_NP -, - -121 - mPTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP -, - -122 - mPTHREAD_RWLOCK_DEFAULT_NP - = -PTHREAD_RWLOCK_PREFER_READER_NP - - -126  - #PTHREAD_RWLOCK_INITIALIZER - \ - -127 { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } - - ) - -128 #ifdeà -__USE_GNU - - -129 #ià -__WORDSIZE - == 64 - -130  - #PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP - \ - -132 -PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP - } } - - ) - -134 #ià -__BYTE_ORDER - =ð -__LITTLE_ENDIAN - - -135  - #PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP - \ - -136 { { 0, 0, 0, 0, 0, 0, -PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP -, \ - -137 0, 0, 0, 0 } } - - ) - -139  - #PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP - \ - -140 { { 0, 0, 0, 0, 0, 0, 0, 0, 0, -PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP -,\ - -141 0 } } - - ) - -151 - mPTHREAD_INHERIT_SCHED -, - -152  - #PTHREAD_INHERIT_SCHED - -PTHREAD_INHERIT_SCHED - - - ) - -153 - mPTHREAD_EXPLICIT_SCHED - - -154  - #PTHREAD_EXPLICIT_SCHED - -PTHREAD_EXPLICIT_SCHED - - - ) - -161 - mPTHREAD_SCOPE_SYSTEM -, - -162  - #PTHREAD_SCOPE_SYSTEM - -PTHREAD_SCOPE_SYSTEM - - - ) - -163 - mPTHREAD_SCOPE_PROCESS - - -164  - #PTHREAD_SCOPE_PROCESS - -PTHREAD_SCOPE_PROCESS - - - ) - -171 - mPTHREAD_PROCESS_PRIVATE -, - -172  - #PTHREAD_PROCESS_PRIVATE - -PTHREAD_PROCESS_PRIVATE - - - ) - -173 - mPTHREAD_PROCESS_SHARED - - -174  - #PTHREAD_PROCESS_SHARED - -PTHREAD_PROCESS_SHARED - - - ) - -180  - #PTHREAD_COND_INITIALIZER - { { 0, 0, 0, 0, 0, (*è0, 0, 0 } } - - ) - -184  - s_±h»ad_þ—nup_bufãr - - -186 (* - m__routše -) (*); - -187 * - m__¬g -; - -188  - m__ÿnûÉy³ -; - -189  -_±h»ad_þ—nup_bufãr - * - m__´ev -; - -195 - mPTHREAD_CANCEL_ENABLE -, - -196  - #PTHREAD_CANCEL_ENABLE - -PTHREAD_CANCEL_ENABLE - - - ) - -197 - mPTHREAD_CANCEL_DISABLE - - -198  - #PTHREAD_CANCEL_DISABLE - -PTHREAD_CANCEL_DISABLE - - - ) - -202 - mPTHREAD_CANCEL_DEFERRED -, - -203  - #PTHREAD_CANCEL_DEFERRED - -PTHREAD_CANCEL_DEFERRED - - - ) - -204 - mPTHREAD_CANCEL_ASYNCHRONOUS - - -205  - #PTHREAD_CANCEL_ASYNCHRONOUS - -PTHREAD_CANCEL_ASYNCHRONOUS - - - ) - -207  - #PTHREAD_CANCELED - ((*è-1) - - ) - -211  - #PTHREAD_ONCE_INIT - 0 - - ) - -214 #ifdeà -__USE_XOPEN2K - - -218  - #PTHREAD_BARRIER_SERIAL_THREAD - -1 - - ) - -222 -__BEGIN_DECLS - - -227  -±h»ad_ü—‹ - ( -±h»ad_t - * -__»¡riù - -__Ãwth»ad -, - -228 -__cÚ¡ - -±h»ad_©Œ_t - * -__»¡riù - -__©Œ -, - -229 *(* -__¡¬t_routše -) (*), - -230 * -__»¡riù - -__¬g -è -__THROW - -__nÚnuÎ - ((1, 3)); - -236  - $±h»ad_ex™ - (* -__»tv® -è - `__©Œibu‹__ - (( -__nÜ‘uº__ -)); - -244  - `±h»ad_još - ( -±h»ad_t - -__th -, ** -__th»ad_»tuº -); - -246 #ifdeà -__USE_GNU - - -249  - $±h»ad_Œyjoš_Å - ( -±h»ad_t - -__th -, ** -__th»ad_»tuº -è -__THROW -; - -257  - `±h»ad_timedjoš_Å - ( -±h»ad_t - -__th -, ** -__th»ad_»tuº -, - -258 -__cÚ¡ -  -time¥ec - * -__ab¡ime -); - -265  - $±h»ad_d‘ach - ( -±h»ad_t - -__th -è -__THROW -; - -269 -±h»ad_t - - $±h»ad_£lf - (è -__THROW - - `__©Œibu‹__ - (( -__cÚ¡__ -)); - -272  - $±h»ad_equ® - ( -±h»ad_t - -__th»ad1 -,…th»ad_ˆ -__th»ad2 -è -__THROW -; - -280  - $±h»ad_©Œ_š™ - ( -±h»ad_©Œ_t - * -__©Œ -è -__THROW - - `__nÚnuÎ - ((1)); - -283  - $±h»ad_©Œ_de¡roy - ( -±h»ad_©Œ_t - * -__©Œ -) - -284 -__THROW - - `__nÚnuÎ - ((1)); - -287  - $±h»ad_©Œ_g‘d‘ach¡©e - ( -__cÚ¡ - -±h»ad_©Œ_t - * -__©Œ -, - -288 * -__d‘ach¡©e -) - -289 -__THROW - - `__nÚnuÎ - ((1, 2)); - -292  - $±h»ad_©Œ_£td‘ach¡©e - ( -±h»ad_©Œ_t - * -__©Œ -, - -293  -__d‘ach¡©e -) - -294 -__THROW - - `__nÚnuÎ - ((1)); - -298  - $±h»ad_©Œ_g‘gu¬dsize - ( -__cÚ¡ - -±h»ad_©Œ_t - * -__©Œ -, - -299 -size_t - * -__gu¬dsize -) - -300 -__THROW - - `__nÚnuÎ - ((1, 2)); - -303  - $±h»ad_©Œ_£tgu¬dsize - ( -±h»ad_©Œ_t - * -__©Œ -, - -304 -size_t - -__gu¬dsize -) - -305 -__THROW - - `__nÚnuÎ - ((1)); - -309  - $±h»ad_©Œ_g‘sched·¿m - ( -__cÚ¡ - -±h»ad_©Œ_t - * -__»¡riù - - -310 -__©Œ -, - -311  -sched_·¿m - * -__»¡riù - -__·¿m -) - -312 -__THROW - - `__nÚnuÎ - ((1, 2)); - -315  - $±h»ad_©Œ_£tsched·¿m - ( -±h»ad_©Œ_t - * -__»¡riù - -__©Œ -, - -316 -__cÚ¡ -  -sched_·¿m - * -__»¡riù - - -317 -__·¿m -è -__THROW - - `__nÚnuÎ - ((1, 2)); - -320  - $±h»ad_©Œ_g‘schedpÞicy - ( -__cÚ¡ - -±h»ad_©Œ_t - * -__»¡riù - - -321 -__©Œ -, * -__»¡riù - -__pÞicy -) - -322 -__THROW - - `__nÚnuÎ - ((1, 2)); - -325  - $±h»ad_©Œ_£tschedpÞicy - ( -±h»ad_©Œ_t - * -__©Œ -,  -__pÞicy -) - -326 -__THROW - - `__nÚnuÎ - ((1)); - -329  - $±h»ad_©Œ_g‘šh”™sched - ( -__cÚ¡ - -±h»ad_©Œ_t - * -__»¡riù - - -330 -__©Œ -, * -__»¡riù - -__šh”™ -) - -331 -__THROW - - `__nÚnuÎ - ((1, 2)); - -334  - $±h»ad_©Œ_£tšh”™sched - ( -±h»ad_©Œ_t - * -__©Œ -, - -335  -__šh”™ -) - -336 -__THROW - - `__nÚnuÎ - ((1)); - -340  - $±h»ad_©Œ_g‘scÝe - ( -__cÚ¡ - -±h»ad_©Œ_t - * -__»¡riù - -__©Œ -, - -341 * -__»¡riù - -__scÝe -) - -342 -__THROW - - `__nÚnuÎ - ((1, 2)); - -345  - $±h»ad_©Œ_£tscÝe - ( -±h»ad_©Œ_t - * -__©Œ -,  -__scÝe -) - -346 -__THROW - - `__nÚnuÎ - ((1)); - -349  - $±h»ad_©Œ_g‘¡ackaddr - ( -__cÚ¡ - -±h»ad_©Œ_t - * -__»¡riù - - -350 -__©Œ -, ** -__»¡riù - -__¡ackaddr -) - -351 -__THROW - - `__nÚnuÎ - ((1, 2)è -__©Œibu‹_d•»ÿ‹d__ -; - -357  - $±h»ad_©Œ_£t¡ackaddr - ( -±h»ad_©Œ_t - * -__©Œ -, - -358 * -__¡ackaddr -) - -359 -__THROW - - `__nÚnuÎ - ((1)è -__©Œibu‹_d•»ÿ‹d__ -; - -362  - $±h»ad_©Œ_g‘¡acksize - ( -__cÚ¡ - -±h»ad_©Œ_t - * -__»¡riù - - -363 -__©Œ -, -size_t - * -__»¡riù - -__¡acksize -) - -364 -__THROW - - `__nÚnuÎ - ((1, 2)); - -369  - $±h»ad_©Œ_£t¡acksize - ( -±h»ad_©Œ_t - * -__©Œ -, - -370 -size_t - -__¡acksize -) - -371 -__THROW - - `__nÚnuÎ - ((1)); - -373 #ifdeà -__USE_XOPEN2K - - -375  - $±h»ad_©Œ_g‘¡ack - ( -__cÚ¡ - -±h»ad_©Œ_t - * -__»¡riù - -__©Œ -, - -376 ** -__»¡riù - -__¡ackaddr -, - -377 -size_t - * -__»¡riù - -__¡acksize -) - -378 -__THROW - - `__nÚnuÎ - ((1, 2, 3)); - -383  - $±h»ad_©Œ_£t¡ack - ( -±h»ad_©Œ_t - * -__©Œ -, * -__¡ackaddr -, - -384 -size_t - -__¡acksize -è -__THROW - - `__nÚnuÎ - ((1)); - -387 #ifdeà -__USE_GNU - - -390  - $±h»ad_©Œ_£ffš™y_Å - ( -±h»ad_©Œ_t - * -__©Œ -, - -391 -size_t - -__ýu£tsize -, - -392 -__cÚ¡ - -ýu_£t_t - * -__ýu£t -) - -393 -__THROW - - `__nÚnuÎ - ((1, 3)); - -397  - $±h»ad_©Œ_g‘affš™y_Å - ( -__cÚ¡ - -±h»ad_©Œ_t - * -__©Œ -, - -398 -size_t - -__ýu£tsize -, - -399 -ýu_£t_t - * -__ýu£t -) - -400 -__THROW - - `__nÚnuÎ - ((1, 3)); - -406  - $±h»ad_g‘©Œ_Å - ( -±h»ad_t - -__th -, -±h»ad_©Œ_t - * -__©Œ -) - -407 -__THROW - - `__nÚnuÎ - ((2)); - -415  - $±h»ad_£tsched·¿m - ( -±h»ad_t - -__rg‘_th»ad -,  -__pÞicy -, - -416 -__cÚ¡ -  -sched_·¿m - * -__·¿m -) - -417 -__THROW - - `__nÚnuÎ - ((3)); - -420  - $±h»ad_g‘sched·¿m - ( -±h»ad_t - -__rg‘_th»ad -, - -421 * -__»¡riù - -__pÞicy -, - -422  -sched_·¿m - * -__»¡riù - -__·¿m -) - -423 -__THROW - - `__nÚnuÎ - ((2, 3)); - -426  - $±h»ad_£tsched´io - ( -±h»ad_t - -__rg‘_th»ad -,  -__´io -) - -427 -__THROW -; - -430 #ifdeà -__USE_UNIX98 - - -432  - $±h»ad_g‘cÚcu¼’cy - (è -__THROW -; - -435  - $±h»ad_£tcÚcu¼’cy - ( -__Ëv– -è -__THROW -; - -438 #ifdeà -__USE_GNU - - -443  - $±h»ad_y›ld - (è -__THROW -; - -448  - $±h»ad_£ffš™y_Å - ( -±h»ad_t - -__th -, -size_t - -__ýu£tsize -, - -449 -__cÚ¡ - -ýu_£t_t - * -__ýu£t -) - -450 -__THROW - - `__nÚnuÎ - ((3)); - -453  - $±h»ad_g‘affš™y_Å - ( -±h»ad_t - -__th -, -size_t - -__ýu£tsize -, - -454 -ýu_£t_t - * -__ýu£t -) - -455 -__THROW - - `__nÚnuÎ - ((3)); - -468  - `±h»ad_Úû - ( -±h»ad_Úû_t - * -__Úû_cÚŒÞ -, - -469 (* -__š™_routše -è()è - `__nÚnuÎ - ((1, 2)); - -480  - `±h»ad_£tÿnûl¡©e - ( -__¡©e -, * -__Þd¡©e -); - -484  - `±h»ad_£tÿnûÉy³ - ( -__ty³ -, * -__Þdty³ -); - -487  - `±h»ad_ÿnûl - ( -±h»ad_t - -__th -); - -492  - `±h»ad_‹¡ÿnûl - (); - -501 -__jmp_buf - -__ÿnûl_jmp_buf -; - -502  -__mask_was_§ved -; - -503 } -__ÿnûl_jmp_buf -[1]; - -504 * -__·d -[4]; - -505 } - t__±h»ad_unwšd_buf_t - - t__©Œibu‹__ - (( - t__®igÃd__ -)); - -508 #iâdeà -__þ—nup_fù_©Œibu‹ - - -509  - #__þ—nup_fù_©Œibu‹ - - - ) - -514  - s__±h»ad_þ—nup_äame - - -516 (* -__ÿnûl_routše -) (*); - -517 * -__ÿnûl_¬g -; - -518  -__do_™ -; - -519  -__ÿnûl_ty³ -; - -522 #ià -defšed - -__GNUC__ - && defšed -__EXCEPTIONS - - -523 #ifdeà -__ýlu¥lus - - -525 þas  - c__±h»ad_þ—nup_þass - - -527 (* -__ÿnûl_routše -) (*); - -528 * -__ÿnûl_¬g -; - -529  -__do_™ -; - -530  -__ÿnûl_ty³ -; - -532 -public -: - -533 - `__±h»ad_þ—nup_þass - ((* -__fù -è(*), * -__¬g -) - -534 : - `__ÿnûl_routše - ( -__fù -), - `__ÿnûl_¬g - ( -__¬g -), - $__do_™ - (1) { } - -535 ~ - $__±h»ad_þ—nup_þass - (è{ ià( -__do_™ -è - `__ÿnûl_routše - ( -__ÿnûl_¬g -); - } -} - -536  - $__£tdo™ - ( -__Ãwv® -è{ -__do_™ - = __Ãwv®; - } -} - -537  - $__deãr - (è{ - `±h»ad_£tÿnûÉy³ - ( -PTHREAD_CANCEL_DEFERRED -, - -538 & -__ÿnûl_ty³ -); - } -} - -539  - $__»¡Üe - (ècÚ¡ { - `±h»ad_£tÿnûÉy³ - ( -__ÿnûl_ty³ -, 0); - } -} - -549  - #±h»ad_þ—nup_push -( -routše -, -¬g -) \ - -551 -__±h»ad_þ—nup_þass - - `__þäame - ( -routše -, -¬g -) - - ) - -555  - #±h»ad_þ—nup_pÝ -( -execu‹ -) \ - -556 -__þäame -. - `__£tdo™ - ( -execu‹ -); \ - -557 } 0) - - ) - -559 #ifdeà -__USE_GNU - - -563  - #±h»ad_þ—nup_push_deãr_Å -( -routše -, -¬g -) \ - -565 -__±h»ad_þ—nup_þass - - `__þäame - ( -routše -, -¬g -); \ - -566 -__þäame -. - `__deãr - () - - ) - -571  - #±h»ad_þ—nup_pÝ_»¡Üe_Å -( -execu‹ -) \ - -572 -__þäame -. - `__»¡Üe - (); \ - -573 -__þäame -. - `__£tdo™ - ( -execu‹ -); \ - -574 } 0) - - ) - -581 -__ex‹º_šlše -  - -582 - $__±h»ad_þ—nup_routše - ( -__±h»ad_þ—nup_äame - * -__äame -) - -584 ià( -__äame --> -__do_™ -) - -585 -__äame --> - `__ÿnûl_routše - (__äame-> -__ÿnûl_¬g -); - -586 - } -} - -595  - #±h»ad_þ—nup_push -( -routše -, -¬g -) \ - -597  -__±h»ad_þ—nup_äame - -__þäame - \ - -598 - `__©Œibu‹__ - (( - `__þ—nup__ - ( -__±h»ad_þ—nup_routše -))) \ - -599 ð{ . -__ÿnûl_routše - = ( -routše -), . -__ÿnûl_¬g - = ( -¬g -), \ - -600 . -__do_™ - = 1 }; - - ) - -604  - #±h»ad_þ—nup_pÝ -( -execu‹ -) \ - -605 -__þäame -. -__do_™ - = ( -execu‹ -); \ - -606 } 0) - - ) - -608 #ifdeà -__USE_GNU - - -612  - #±h»ad_þ—nup_push_deãr_Å -( -routše -, -¬g -) \ - -614  -__±h»ad_þ—nup_äame - -__þäame - \ - -615 - `__©Œibu‹__ - (( - `__þ—nup__ - ( -__±h»ad_þ—nup_routše -))) \ - -616 ð{ . -__ÿnûl_routše - = ( -routše -), . -__ÿnûl_¬g - = ( -¬g -), \ - -617 . -__do_™ - = 1 }; \ - -618 (è - `±h»ad_£tÿnûÉy³ - ( -PTHREAD_CANCEL_DEFERRED -, \ - -619 & -__þäame -. -__ÿnûl_ty³ -) - - ) - -624  - #±h»ad_þ—nup_pÝ_»¡Üe_Å -( -execu‹ -) \ - -625 (è - `±h»ad_£tÿnûÉy³ - ( -__þäame -. -__ÿnûl_ty³ -, -NULL -); \ - -626 -__þäame -. -__do_™ - = ( -execu‹ -); \ - -627 } 0) - - ) - -638  - #±h»ad_þ—nup_push -( -routše -, -¬g -) \ - -640 -__±h»ad_unwšd_buf_t - -__ÿnûl_buf -; \ - -641 (* -__ÿnûl_routše -è(*èð( -routše -); \ - -642 * -__ÿnûl_¬g - = ( -¬g -); \ - -643  -nÙ_fœ¡_ÿÎ - = - `__sig£tjmp - (( -__jmp_buf_g - *) (*) \ - -644 -__ÿnûl_buf -. -__ÿnûl_jmp_buf -, 0); \ - -645 ià( - `__bužtš_ex³ù - ( -nÙ_fœ¡_ÿÎ -, 0)) \ - -647 - `__ÿnûl_routše - ( -__ÿnûl_¬g -); \ - -648 - `__±h»ad_unwšd_Ãxt - (& -__ÿnûl_buf -); \ - -652 - `__±h»ad_»gi¡”_ÿnûl - (& -__ÿnûl_buf -); \ - -653 dØ{ - - ) - -654  -__±h»ad_»gi¡”_ÿnûl - ( -__±h»ad_unwšd_buf_t - * -__buf -) - -655 -__þ—nup_fù_©Œibu‹ -; - -659  - #±h»ad_þ—nup_pÝ -( -execu‹ -) \ - -662 - `__±h»ad_uÄegi¡”_ÿnûl - (& -__ÿnûl_buf -); \ - -663 ià( -execu‹ -) \ - -664 - `__ÿnûl_routše - ( -__ÿnûl_¬g -); \ - -665 } 0) - - ) - -666  - $__±h»ad_uÄegi¡”_ÿnûl - ( -__±h»ad_unwšd_buf_t - * -__buf -) - -667 -__þ—nup_fù_©Œibu‹ -; - -669 #ifdeà -__USE_GNU - - -673  - #±h»ad_þ—nup_push_deãr_Å -( -routše -, -¬g -) \ - -675 -__±h»ad_unwšd_buf_t - -__ÿnûl_buf -; \ - -676 (* -__ÿnûl_routše -è(*èð( -routše -); \ - -677 * -__ÿnûl_¬g - = ( -¬g -); \ - -678  -nÙ_fœ¡_ÿÎ - = - `__sig£tjmp - (( -__jmp_buf_g - *) (*) \ - -679 -__ÿnûl_buf -. -__ÿnûl_jmp_buf -, 0); \ - -680 ià( - `__bužtš_ex³ù - ( -nÙ_fœ¡_ÿÎ -, 0)) \ - -682 - `__ÿnûl_routše - ( -__ÿnûl_¬g -); \ - -683 - `__±h»ad_unwšd_Ãxt - (& -__ÿnûl_buf -); \ - -687 - `__±h»ad_»gi¡”_ÿnûl_deãr - (& -__ÿnûl_buf -); \ - -688 dØ{ - - ) - -689  - `__±h»ad_»gi¡”_ÿnûl_deãr - ( -__±h»ad_unwšd_buf_t - * -__buf -) - -690 -__þ—nup_fù_©Œibu‹ -; - -695  - #±h»ad_þ—nup_pÝ_»¡Üe_Å -( -execu‹ -) \ - -698 - `__±h»ad_uÄegi¡”_ÿnûl_»¡Üe - (& -__ÿnûl_buf -); \ - -699 ià( -execu‹ -) \ - -700 - `__ÿnûl_routše - ( -__ÿnûl_¬g -); \ - -701 - } -} 0) - - ) - -702  - $__±h»ad_uÄegi¡”_ÿnûl_»¡Üe - ( -__±h»ad_unwšd_buf_t - * -__buf -) - -703 -__þ—nup_fù_©Œibu‹ -; - -707  - $__±h»ad_unwšd_Ãxt - ( -__±h»ad_unwšd_buf_t - * -__buf -) - -708 -__þ—nup_fù_©Œibu‹ - - `__©Œibu‹__ - (( -__nÜ‘uº__ -)) - -709 #iâdeà -SHARED - - -710 - `__©Œibu‹__ - (( -__w—k__ -)) - -716  -__jmp_buf_g -; - -717  - $__sig£tjmp - ( -__jmp_buf_g - * -__’v -,  -__§vemask -è -__THROW -; - -723  - $±h»ad_mu‹x_š™ - ( -±h»ad_mu‹x_t - * -__mu‹x -, - -724 -__cÚ¡ - -±h»ad_mu‹x©Œ_t - * -__mu‹x©Œ -) - -725 -__THROW - - `__nÚnuÎ - ((1)); - -728  - $±h»ad_mu‹x_de¡roy - ( -±h»ad_mu‹x_t - * -__mu‹x -) - -729 -__THROW - - `__nÚnuÎ - ((1)); - -732  - $±h»ad_mu‹x_Œylock - ( -±h»ad_mu‹x_t - * -__mu‹x -) - -733 -__THROW - - `__nÚnuÎ - ((1)); - -736  - $±h»ad_mu‹x_lock - ( -±h»ad_mu‹x_t - * -__mu‹x -) - -737 -__THROW - - `__nÚnuÎ - ((1)); - -739 #ifdeà -__USE_XOPEN2K - - -741  - $±h»ad_mu‹x_timedlock - ( -±h»ad_mu‹x_t - * -__»¡riù - -__mu‹x -, - -742 -__cÚ¡ -  -time¥ec - * -__»¡riù - - -743 -__ab¡ime -è -__THROW - - `__nÚnuÎ - ((1, 2)); - -747  - $±h»ad_mu‹x_uÆock - ( -±h»ad_mu‹x_t - * -__mu‹x -) - -748 -__THROW - - `__nÚnuÎ - ((1)); - -751 #ifdeà -__USE_UNIX98 - - -753  - $±h»ad_mu‹x_g‘´ioûžšg - ( -__cÚ¡ - -±h»ad_mu‹x_t - * - -754 -__»¡riù - -__mu‹x -, - -755 * -__»¡riù - -__´ioûžšg -) - -756 -__THROW - - `__nÚnuÎ - ((1, 2)); - -760  - $±h»ad_mu‹x_£rioûžšg - ( -±h»ad_mu‹x_t - * -__»¡riù - -__mu‹x -, - -761  -__´ioûžšg -, - -762 * -__»¡riù - -__Þd_ûžšg -) - -763 -__THROW - - `__nÚnuÎ - ((1, 3)); - -767 #ifdeà -__USE_XOPEN2K8 - - -769  - $±h»ad_mu‹x_cÚsi¡’t_Å - ( -±h»ad_mu‹x_t - * -__mu‹x -) - -770 -__THROW - - `__nÚnuÎ - ((1)); - -771 #ifdeà -__USE_GNU - - -772  - $±h»ad_mu‹x_cÚsi¡’t_Å - ( -±h»ad_mu‹x_t - * -__mu‹x -) - -773 -__THROW - - `__nÚnuÎ - ((1)); - -782  - $±h»ad_mu‹x©Œ_š™ - ( -±h»ad_mu‹x©Œ_t - * -__©Œ -) - -783 -__THROW - - `__nÚnuÎ - ((1)); - -786  - $±h»ad_mu‹x©Œ_de¡roy - ( -±h»ad_mu‹x©Œ_t - * -__©Œ -) - -787 -__THROW - - `__nÚnuÎ - ((1)); - -790  - $±h»ad_mu‹x©Œ_g‘psh¬ed - ( -__cÚ¡ - -±h»ad_mu‹x©Œ_t - * - -791 -__»¡riù - -__©Œ -, - -792 * -__»¡riù - -__psh¬ed -) - -793 -__THROW - - `__nÚnuÎ - ((1, 2)); - -796  - $±h»ad_mu‹x©Œ_£sh¬ed - ( -±h»ad_mu‹x©Œ_t - * -__©Œ -, - -797  -__psh¬ed -) - -798 -__THROW - - `__nÚnuÎ - ((1)); - -800 #ifdeà -__USE_UNIX98 - - -802  - $±h»ad_mu‹x©Œ_g‘ty³ - ( -__cÚ¡ - -±h»ad_mu‹x©Œ_t - * -__»¡riù - - -803 -__©Œ -, * -__»¡riù - -__kšd -) - -804 -__THROW - - `__nÚnuÎ - ((1, 2)); - -809  - $±h»ad_mu‹x©Œ_£‰y³ - ( -±h»ad_mu‹x©Œ_t - * -__©Œ -,  -__kšd -) - -810 -__THROW - - `__nÚnuÎ - ((1)); - -813  - $±h»ad_mu‹x©Œ_g‘´ÙocÞ - ( -__cÚ¡ - -±h»ad_mu‹x©Œ_t - * - -814 -__»¡riù - -__©Œ -, - -815 * -__»¡riù - -__´ÙocÞ -) - -816 -__THROW - - `__nÚnuÎ - ((1, 2)); - -820  - $±h»ad_mu‹x©Œ_£rÙocÞ - ( -±h»ad_mu‹x©Œ_t - * -__©Œ -, - -821  -__´ÙocÞ -) - -822 -__THROW - - `__nÚnuÎ - ((1)); - -825  - $±h»ad_mu‹x©Œ_g‘´ioûžšg - ( -__cÚ¡ - -±h»ad_mu‹x©Œ_t - * - -826 -__»¡riù - -__©Œ -, - -827 * -__»¡riù - -__´ioûžšg -) - -828 -__THROW - - `__nÚnuÎ - ((1, 2)); - -831  - $±h»ad_mu‹x©Œ_£rioûžšg - ( -±h»ad_mu‹x©Œ_t - * -__©Œ -, - -832  -__´ioûžšg -) - -833 -__THROW - - `__nÚnuÎ - ((1)); - -836 #ifdeà -__USE_XOPEN2K - - -838  - $±h»ad_mu‹x©Œ_g‘robu¡ - ( -__cÚ¡ - -±h»ad_mu‹x©Œ_t - * -__©Œ -, - -839 * -__robu¡Ãss -) - -840 -__THROW - - `__nÚnuÎ - ((1, 2)); - -841 #ifdeà -__USE_GNU - - -842  - $±h»ad_mu‹x©Œ_g‘robu¡_Å - ( -__cÚ¡ - -±h»ad_mu‹x©Œ_t - * -__©Œ -, - -843 * -__robu¡Ãss -) - -844 -__THROW - - `__nÚnuÎ - ((1, 2)); - -848  - $±h»ad_mu‹x©Œ_£Œobu¡ - ( -±h»ad_mu‹x©Œ_t - * -__©Œ -, - -849  -__robu¡Ãss -) - -850 -__THROW - - `__nÚnuÎ - ((1)); - -851 #ifdeà -__USE_GNU - - -852  - $±h»ad_mu‹x©Œ_£Œobu¡_Å - ( -±h»ad_mu‹x©Œ_t - * -__©Œ -, - -853  -__robu¡Ãss -) - -854 -__THROW - - `__nÚnuÎ - ((1)); - -859 #ià -defšed - -__USE_UNIX98 - || defšed -__USE_XOPEN2K - - -864  - $±h»ad_rwlock_š™ - ( -±h»ad_rwlock_t - * -__»¡riù - -__rwlock -, - -865 -__cÚ¡ - -±h»ad_rwlock©Œ_t - * -__»¡riù - - -866 -__©Œ -è -__THROW - - `__nÚnuÎ - ((1)); - -869  - $±h»ad_rwlock_de¡roy - ( -±h»ad_rwlock_t - * -__rwlock -) - -870 -__THROW - - `__nÚnuÎ - ((1)); - -873  - $±h»ad_rwlock_rdlock - ( -±h»ad_rwlock_t - * -__rwlock -) - -874 -__THROW - - `__nÚnuÎ - ((1)); - -877  - $±h»ad_rwlock_Œyrdlock - ( -±h»ad_rwlock_t - * -__rwlock -) - -878 -__THROW - - `__nÚnuÎ - ((1)); - -880 #ifdeà -__USE_XOPEN2K - - -882  - $±h»ad_rwlock_timedrdlock - ( -±h»ad_rwlock_t - * -__»¡riù - -__rwlock -, - -883 -__cÚ¡ -  -time¥ec - * -__»¡riù - - -884 -__ab¡ime -è -__THROW - - `__nÚnuÎ - ((1, 2)); - -888  - $±h»ad_rwlock_w¾ock - ( -±h»ad_rwlock_t - * -__rwlock -) - -889 -__THROW - - `__nÚnuÎ - ((1)); - -892  - $±h»ad_rwlock_Œyw¾ock - ( -±h»ad_rwlock_t - * -__rwlock -) - -893 -__THROW - - `__nÚnuÎ - ((1)); - -895 #ifdeà -__USE_XOPEN2K - - -897  - $±h»ad_rwlock_timedw¾ock - ( -±h»ad_rwlock_t - * -__»¡riù - -__rwlock -, - -898 -__cÚ¡ -  -time¥ec - * -__»¡riù - - -899 -__ab¡ime -è -__THROW - - `__nÚnuÎ - ((1, 2)); - -903  - $±h»ad_rwlock_uÆock - ( -±h»ad_rwlock_t - * -__rwlock -) - -904 -__THROW - - `__nÚnuÎ - ((1)); - -910  - $±h»ad_rwlock©Œ_š™ - ( -±h»ad_rwlock©Œ_t - * -__©Œ -) - -911 -__THROW - - `__nÚnuÎ - ((1)); - -914  - $±h»ad_rwlock©Œ_de¡roy - ( -±h»ad_rwlock©Œ_t - * -__©Œ -) - -915 -__THROW - - `__nÚnuÎ - ((1)); - -918  - $±h»ad_rwlock©Œ_g‘psh¬ed - ( -__cÚ¡ - -±h»ad_rwlock©Œ_t - * - -919 -__»¡riù - -__©Œ -, - -920 * -__»¡riù - -__psh¬ed -) - -921 -__THROW - - `__nÚnuÎ - ((1, 2)); - -924  - $±h»ad_rwlock©Œ_£sh¬ed - ( -±h»ad_rwlock©Œ_t - * -__©Œ -, - -925  -__psh¬ed -) - -926 -__THROW - - `__nÚnuÎ - ((1)); - -929  - $±h»ad_rwlock©Œ_g‘kšd_Å - ( -__cÚ¡ - -±h»ad_rwlock©Œ_t - * - -930 -__»¡riù - -__©Œ -, - -931 * -__»¡riù - -__´ef -) - -932 -__THROW - - `__nÚnuÎ - ((1, 2)); - -935  - $±h»ad_rwlock©Œ_£tkšd_Å - ( -±h»ad_rwlock©Œ_t - * -__©Œ -, - -936  -__´ef -è -__THROW - - `__nÚnuÎ - ((1)); - -944  - $±h»ad_cÚd_š™ - ( -±h»ad_cÚd_t - * -__»¡riù - -__cÚd -, - -945 -__cÚ¡ - -±h»ad_cÚd©Œ_t - * -__»¡riù - - -946 -__cÚd_©Œ -è -__THROW - - `__nÚnuÎ - ((1)); - -949  - $±h»ad_cÚd_de¡roy - ( -±h»ad_cÚd_t - * -__cÚd -) - -950 -__THROW - - `__nÚnuÎ - ((1)); - -953  - $±h»ad_cÚd_sigÇl - ( -±h»ad_cÚd_t - * -__cÚd -) - -954 -__THROW - - `__nÚnuÎ - ((1)); - -957  - $±h»ad_cÚd_brßdÿ¡ - ( -±h»ad_cÚd_t - * -__cÚd -) - -958 -__THROW - - `__nÚnuÎ - ((1)); - -965  - $±h»ad_cÚd_wa™ - ( -±h»ad_cÚd_t - * -__»¡riù - -__cÚd -, - -966 -±h»ad_mu‹x_t - * -__»¡riù - -__mu‹x -) - -967 - `__nÚnuÎ - ((1, 2)); - -976  - $±h»ad_cÚd_timedwa™ - ( -±h»ad_cÚd_t - * -__»¡riù - -__cÚd -, - -977 -±h»ad_mu‹x_t - * -__»¡riù - -__mu‹x -, - -978 -__cÚ¡ -  -time¥ec - * -__»¡riù - - -979 -__ab¡ime -è - `__nÚnuÎ - ((1, 2, 3)); - -984  - $±h»ad_cÚd©Œ_š™ - ( -±h»ad_cÚd©Œ_t - * -__©Œ -) - -985 -__THROW - - `__nÚnuÎ - ((1)); - -988  - $±h»ad_cÚd©Œ_de¡roy - ( -±h»ad_cÚd©Œ_t - * -__©Œ -) - -989 -__THROW - - `__nÚnuÎ - ((1)); - -992  - $±h»ad_cÚd©Œ_g‘psh¬ed - ( -__cÚ¡ - -±h»ad_cÚd©Œ_t - * - -993 -__»¡riù - -__©Œ -, - -994 * -__»¡riù - -__psh¬ed -) - -995 -__THROW - - `__nÚnuÎ - ((1, 2)); - -998  - $±h»ad_cÚd©Œ_£sh¬ed - ( -±h»ad_cÚd©Œ_t - * -__©Œ -, - -999  -__psh¬ed -è -__THROW - - `__nÚnuÎ - ((1)); - -1001 #ifdeà -__USE_XOPEN2K - - -1003  - $±h»ad_cÚd©Œ_g‘þock - ( -__cÚ¡ - -±h»ad_cÚd©Œ_t - * - -1004 -__»¡riù - -__©Œ -, - -1005 -__þockid_t - * -__»¡riù - -__þock_id -) - -1006 -__THROW - - `__nÚnuÎ - ((1, 2)); - -1009  - $±h»ad_cÚd©Œ_£tþock - ( -±h»ad_cÚd©Œ_t - * -__©Œ -, - -1010 -__þockid_t - -__þock_id -) - -1011 -__THROW - - `__nÚnuÎ - ((1)); - -1015 #ifdeà -__USE_XOPEN2K - - -1020  - $±h»ad_¥š_š™ - ( -±h»ad_¥šlock_t - * -__lock -,  -__psh¬ed -) - -1021 -__THROW - - `__nÚnuÎ - ((1)); - -1024  - $±h»ad_¥š_de¡roy - ( -±h»ad_¥šlock_t - * -__lock -) - -1025 -__THROW - - `__nÚnuÎ - ((1)); - -1028  - $±h»ad_¥š_lock - ( -±h»ad_¥šlock_t - * -__lock -) - -1029 -__THROW - - `__nÚnuÎ - ((1)); - -1032  - $±h»ad_¥š_Œylock - ( -±h»ad_¥šlock_t - * -__lock -) - -1033 -__THROW - - `__nÚnuÎ - ((1)); - -1036  - $±h»ad_¥š_uÆock - ( -±h»ad_¥šlock_t - * -__lock -) - -1037 -__THROW - - `__nÚnuÎ - ((1)); - -1044  - $±h»ad_b¬r›r_š™ - ( -±h»ad_b¬r›r_t - * -__»¡riù - -__b¬r›r -, - -1045 -__cÚ¡ - -±h»ad_b¬r›¿‰r_t - * -__»¡riù - - -1046 -__©Œ -,  -__couÁ -) - -1047 -__THROW - - `__nÚnuÎ - ((1)); - -1050  - $±h»ad_b¬r›r_de¡roy - ( -±h»ad_b¬r›r_t - * -__b¬r›r -) - -1051 -__THROW - - `__nÚnuÎ - ((1)); - -1054  - $±h»ad_b¬r›r_wa™ - ( -±h»ad_b¬r›r_t - * -__b¬r›r -) - -1055 -__THROW - - `__nÚnuÎ - ((1)); - -1059  - $±h»ad_b¬r›¿‰r_š™ - ( -±h»ad_b¬r›¿‰r_t - * -__©Œ -) - -1060 -__THROW - - `__nÚnuÎ - ((1)); - -1063  - $±h»ad_b¬r›¿‰r_de¡roy - ( -±h»ad_b¬r›¿‰r_t - * -__©Œ -) - -1064 -__THROW - - `__nÚnuÎ - ((1)); - -1067  - $±h»ad_b¬r›¿‰r_g‘psh¬ed - ( -__cÚ¡ - -±h»ad_b¬r›¿‰r_t - * - -1068 -__»¡riù - -__©Œ -, - -1069 * -__»¡riù - -__psh¬ed -) - -1070 -__THROW - - `__nÚnuÎ - ((1, 2)); - -1073  - $±h»ad_b¬r›¿‰r_£sh¬ed - ( -±h»ad_b¬r›¿‰r_t - * -__©Œ -, - -1074  -__psh¬ed -) - -1075 -__THROW - - `__nÚnuÎ - ((1)); - -1087  - `±h»ad_key_ü—‹ - ( -±h»ad_key_t - * -__key -, - -1088 (* -__de¡r_funùiÚ -) (*)) - -1089 -__THROW - - `__nÚnuÎ - ((1)); - -1092  - $±h»ad_key_d–‘e - ( -±h»ad_key_t - -__key -è -__THROW -; - -1095 * - $±h»ad_g‘¥ecific - ( -±h»ad_key_t - -__key -è -__THROW -; - -1098  - $±h»ad_£t¥ecific - ( -±h»ad_key_t - -__key -, - -1099 -__cÚ¡ - * -__poš‹r -è -__THROW - ; - -1102 #ifdeà -__USE_XOPEN2K - - -1104  - $±h»ad_g‘ýuþockid - ( -±h»ad_t - -__th»ad_id -, - -1105 -__þockid_t - * -__þock_id -) - -1106 -__THROW - - `__nÚnuÎ - ((2)); - -1121  - `±h»ad_©fÜk - ((* -__´•¬e -) (), - -1122 (* -__·»Á -) (), - -1123 (* -__chžd -è()è -__THROW -; - -1126 #ifdeà -__USE_EXTERN_INLINES - - -1128 -__ex‹º_šlše -  - -1129 - `__NTH - ( - $±h»ad_equ® - ( -±h»ad_t - -__th»ad1 -,…th»ad_ˆ -__th»ad2 -)) - -1131  -__th»ad1 - =ð -__th»ad2 -; - -1132 - } -} - -1135 - g__END_DECLS - - - @/usr/include/sys/select.h - -22 #iâdeà -_SYS_SELECT_H - - -23  - #_SYS_SELECT_H - 1 - - ) - -25  - ~<ã©u»s.h -> - -28  - ~ - -31  - ~ - -34  - ~ - -36 #iâdeà -__sig£t_t_defšed - - -37  - #__sig£t_t_defšed - - - ) - -38  -__sig£t_t - - tsig£t_t -; - -42  - #__Ãed_time_t - - - ) - -43  - #__Ãed_time¥ec - - - ) - -44  - ~ - -45  - #__Ãed_timev® - - - ) - -46  - ~ - -48 #iâdeà -__su£cÚds_t_defšed - - -49  -__su£cÚds_t - - tsu£cÚds_t -; - -50  - #__su£cÚds_t_defšed - - - ) - -55  - t__fd_mask -; - -58 #undeà -__NFDBITS - - -59 #undeà -__FDELT - - -60 #undeà -__FDMASK - - -62  - #__NFDBITS - (8 * (è ( -__fd_mask -)) - - ) - -63  - #__FDELT -( -d -è((dè/ -__NFDBITS -) - - ) - -64  - #__FDMASK -( -d -è(( -__fd_mask -è1 << ((dè% -__NFDBITS -)) - - ) - -71 #ifdeà -__USE_XOPEN - - -72 -__fd_mask - - mfds_b™s -[ -__FD_SETSIZE - / -__NFDBITS -]; - -73  - #__FDS_BITS -( -£t -è((£t)-> -fds_b™s -) - - ) - -75 -__fd_mask - - m__fds_b™s -[ -__FD_SETSIZE - / -__NFDBITS -]; - -76  - #__FDS_BITS -( -£t -è((£t)-> -__fds_b™s -) - - ) - -78 } - tfd_£t -; - -81  - #FD_SETSIZE - -__FD_SETSIZE - - - ) - -83 #ifdeà -__USE_MISC - - -85  -__fd_mask - - tfd_mask -; - -88  - #NFDBITS - -__NFDBITS - - - ) - -93  - #FD_SET -( -fd -, -fd£ -è - `__FD_SET - (fd, fd£) - - ) - -94  - #FD_CLR -( -fd -, -fd£ -è - `__FD_CLR - (fd, fd£) - - ) - -95  - #FD_ISSET -( -fd -, -fd£ -è - `__FD_ISSET - (fd, fd£) - - ) - -96  - #FD_ZERO -( -fd£ -è - `__FD_ZERO - (fd£) - - ) - -99 -__BEGIN_DECLS - - -109  -£Ëù - ( -__nfds -, -fd_£t - * -__»¡riù - -__»adfds -, - -110 -fd_£t - * -__»¡riù - -__wr™efds -, - -111 -fd_£t - * -__»¡riù - -__exû±fds -, - -112  -timev® - * -__»¡riù - -__timeout -); - -114 #ifdeà -__USE_XOPEN2K - - -121  -p£Ëù - ( -__nfds -, -fd_£t - * -__»¡riù - -__»adfds -, - -122 -fd_£t - * -__»¡riù - -__wr™efds -, - -123 -fd_£t - * -__»¡riù - -__exû±fds -, - -124 cÚ¡  -time¥ec - * -__»¡riù - -__timeout -, - -125 cÚ¡ -__sig£t_t - * -__»¡riù - -__sigmask -); - -128 - g__END_DECLS - - - @/usr/include/sys/sysmacros.h - -21 #iâdeà -_SYS_SYSMACROS_H - - -22  - #_SYS_SYSMACROS_H - 1 - - ) - -24  - ~<ã©u»s.h -> - -29 #ifdeà -__GLIBC_HAVE_LONG_LONG - - -30 -__ex‹nsiÚ__ - - -31  - $gnu_dev_majÜ - ( -__dev -) - -32 -__THROW -; - -33 -__ex‹nsiÚ__ - - -34  - $gnu_dev_mšÜ - ( -__dev -) - -35 -__THROW -; - -36 -__ex‹nsiÚ__ - - -37  - $gnu_dev_makedev - ( -__majÜ -, - -38  -__mšÜ -) - -39 -__THROW -; - -41 #ià -defšed - -__GNUC__ - && __GNUC__ >ð2 && defšed -__USE_EXTERN_INLINES - - -42 -__ex‹nsiÚ__ - -__ex‹º_šlše -  - -43 - `__NTH - ( - $gnu_dev_majÜ - ( -__dev -)) - -45  (( -__dev - >> 8) & 0xfff) | (() (__dev >> 32) & ~0xfff); - -46 - } -} - -48 -__ex‹nsiÚ__ - -__ex‹º_šlše -  - -49 -__NTH - ( - $gnu_dev_mšÜ - ( -__dev -)) - -51  ( -__dev - & 0xff) | (() (__dev >> 12) & ~0xff); - -52 - } -} - -54 -__ex‹nsiÚ__ - -__ex‹º_šlše -  - -55 -__NTH - ( - $gnu_dev_makedev - ( -__majÜ -,  -__mšÜ -)) - -57  (( -__mšÜ - & 0xffè| (( -__majÜ - & 0xfff) << 8) - -58 | (((è( -__mšÜ - & ~0xff)) << 12) - -59 | (((è( -__majÜ - & ~0xfff)) << 32)); - -60 - } -} - -65  - #majÜ -( -dev -è - `gnu_dev_majÜ - (dev) - - ) - -66  - #mšÜ -( -dev -è - `gnu_dev_mšÜ - (dev) - - ) - -67  - #makedev -( -maj -, -mš -è - `gnu_dev_makedev - (maj, mš) - - ) - - @/usr/include/time.h - -23 #iâdef -_TIME_H - - -25 #ià(! -defšed - -__Ãed_time_t - && !defšed -__Ãed_þock_t - && \ - -26 ! -defšed - - g__Ãed_time¥ec -) - -27  - #_TIME_H - 1 - - ) - -28  - ~<ã©u»s.h -> - -30 - g__BEGIN_DECLS - - -34 #ifdef -_TIME_H - - -36  - #__Ãed_size_t - - - ) - -37  - #__Ãed_NULL - - - ) - -38  - ~<¡ddef.h -> - -42  - ~ - -45 #ià! -defšed - -__STRICT_ANSI__ - && !defšed -__USE_XOPEN2K - - -46 #iâdeà -CLK_TCK - - -47  - #CLK_TCK - -CLOCKS_PER_SEC - - - ) - -53 #ià! -defšed - -__þock_t_defšed - && (defšed -_TIME_H - || defšed -__Ãed_þock_t -) - -54  - #__þock_t_defšed - 1 - - ) - -56  - ~ - -58 -__BEGIN_NAMESPACE_STD - - -60  -__þock_t - - tþock_t -; - -61 - g__END_NAMESPACE_STD - - -62 #ià -defšed - -__USE_XOPEN - || defšed -__USE_POSIX - || defšed -__USE_MISC - - -63 - $__USING_NAMESPACE_STD -( -þock_t -) - -67 #undeà -__Ãed_þock_t - - -69 #ià! -defšed - -__time_t_defšed - && (defšed -_TIME_H - || defšed -__Ãed_time_t -) - -70  - #__time_t_defšed - 1 - - ) - -72  - ~ - -74 -__BEGIN_NAMESPACE_STD - - -76  -__time_t - - ttime_t -; - -77 -__END_NAMESPACE_STD - - -78 #ià -defšed - -__USE_POSIX - || defšed -__USE_MISC - || defšed -__USE_SVID - - -79 - $__USING_NAMESPACE_STD -( -time_t -) - -83 #undeà -__Ãed_time_t - - -85 #ià! -defšed - -__þockid_t_defšed - && \ - -86 (( -defšed - -_TIME_H - && defšed -__USE_POSIX199309 -è|| defšed -__Ãed_þockid_t -) - -87  - #__þockid_t_defšed - 1 - - ) - -89  - ~ - -92  -__þockid_t - - tþockid_t -; - -95 #undeà -__þockid_time_t - - -97 #ià! -defšed - -__tim”_t_defšed - && \ - -98 (( -defšed - -_TIME_H - && defšed -__USE_POSIX199309 -è|| defšed -__Ãed_tim”_t -) - -99  - #__tim”_t_defšed - 1 - - ) - -101  - ~ - -104  -__tim”_t - - ttim”_t -; - -107 #undeà -__Ãed_tim”_t - - -110 #ià! -defšed - -__time¥ec_defšed - && \ - -111 (( -defšed - -_TIME_H - && \ - -112 ( -defšed - -__USE_POSIX199309 - || defšed -__USE_MISC -)) || \ - -113 -defšed - -__Ãed_time¥ec -) - -114  - #__time¥ec_defšed - 1 - - ) - -116  - ~ - -120  - stime¥ec - - -122 -__time_t - -tv_£c -; - -123  -tv_n£c -; - -127 #undeà -__Ãed_time¥ec - - -130 #ifdef -_TIME_H - - -131 -__BEGIN_NAMESPACE_STD - - -133  - stm - - -135  -tm_£c -; - -136  -tm_mš -; - -137  -tm_hour -; - -138  -tm_mday -; - -139  -tm_mÚ -; - -140  -tm_y—r -; - -141  -tm_wday -; - -142  -tm_yday -; - -143  -tm_isd¡ -; - -145 #ifdef -__USE_BSD - - -146  -tm_gmtoff -; - -147 -__cÚ¡ - * -tm_zÚe -; - -149  -__tm_gmtoff -; - -150 -__cÚ¡ - * -__tm_zÚe -; - -153 -__END_NAMESPACE_STD - - -154 #ià -defšed - -__USE_XOPEN - || defšed -__USE_POSIX - || defšed -__USE_MISC - - -155 - $__USING_NAMESPACE_STD -( -tm -) - -159 #ifdeà -__USE_POSIX199309 - - -161  - s™im”¥ec - - -163  -time¥ec - -™_š‹rv® -; - -164  -time¥ec - -™_v®ue -; - -168  -sigev’t -; - -172 #ifdeà -__USE_XOPEN2K - - -173 #iâdeà -__pid_t_defšed - - -174  -__pid_t - - tpid_t -; - -175  - #__pid_t_defšed - - - ) - -180 -__BEGIN_NAMESPACE_STD - - -183 -þock_t - - $þock - (è -__THROW -; - -186 -time_t - - $time - ( -time_t - * -__tim” -è -__THROW -; - -189  - $difáime - ( -time_t - -__time1 -,ime_ˆ -__time0 -) - -190 -__THROW - - `__©Œibu‹__ - (( -__cÚ¡__ -)); - -193 -time_t - - $mktime - ( -tm - * -__ -è -__THROW -; - -199 -size_t - - $¡ráime - (* -__»¡riù - -__s -, -size_t - -__maxsize -, - -200 -__cÚ¡ - * -__»¡riù - -__fÜm© -, - -201 -__cÚ¡ -  -tm - * -__»¡riù - -__ -è -__THROW -; - -202 -__END_NAMESPACE_STD - - -204 #ifdeà -__USE_XOPEN - - -207 * - $¡½time - ( -__cÚ¡ - * -__»¡riù - -__s -, - -208 -__cÚ¡ - * -__»¡riù - -__fmt -,  -tm - * -__ -) - -209 -__THROW -; - -212 #ifdeà -__USE_XOPEN2K8 - - -215  - ~ - -217 -size_t - - $¡ráime_l - (* -__»¡riù - -__s -, -size_t - -__maxsize -, - -218 -__cÚ¡ - * -__»¡riù - -__fÜm© -, - -219 -__cÚ¡ -  -tm - * -__»¡riù - -__ -, - -220 -__loÿË_t - -__loc -è -__THROW -; - -223 #ifdeà -__USE_GNU - - -224 * - $¡½time_l - ( -__cÚ¡ - * -__»¡riù - -__s -, - -225 -__cÚ¡ - * -__»¡riù - -__fmt -,  -tm - * -__ -, - -226 -__loÿË_t - -__loc -è -__THROW -; - -230 -__BEGIN_NAMESPACE_STD - - -233  -tm - * - $gmtime - ( -__cÚ¡ - -time_t - * -__tim” -è -__THROW -; - -237  -tm - * - $loÿÉime - ( -__cÚ¡ - -time_t - * -__tim” -è -__THROW -; - -238 -__END_NAMESPACE_STD - - -240 #ià -defšed - -__USE_POSIX - || defšed -__USE_MISC - - -243  -tm - * - $gmtime_r - ( -__cÚ¡ - -time_t - * -__»¡riù - -__tim” -, - -244  -tm - * -__»¡riù - -__ -è -__THROW -; - -248  -tm - * - $loÿÉime_r - ( -__cÚ¡ - -time_t - * -__»¡riù - -__tim” -, - -249  -tm - * -__»¡riù - -__ -è -__THROW -; - -252 -__BEGIN_NAMESPACE_STD - - -255 * - $asùime - ( -__cÚ¡ -  -tm - * -__ -è -__THROW -; - -258 * - $ùime - ( -__cÚ¡ - -time_t - * -__tim” -è -__THROW -; - -259 -__END_NAMESPACE_STD - - -261 #ià -defšed - -__USE_POSIX - || defšed -__USE_MISC - - -266 * - $asùime_r - ( -__cÚ¡ -  -tm - * -__»¡riù - -__ -, - -267 * -__»¡riù - -__buf -è -__THROW -; - -270 * - $ùime_r - ( -__cÚ¡ - -time_t - * -__»¡riù - -__tim” -, - -271 * -__»¡riù - -__buf -è -__THROW -; - -276 * -__tzÇme -[2]; - -277  -__daylight -; - -278  -__timezÚe -; - -281 #ifdef -__USE_POSIX - - -283 * -tzÇme -[2]; - -287  - $tz£t - (è -__THROW -; - -290 #ià -defšed - -__USE_SVID - || defšed -__USE_XOPEN - - -291  -daylight -; - -292  -timezÚe -; - -295 #ifdeà -__USE_SVID - - -298  - $¡ime - ( -__cÚ¡ - -time_t - * -__wh’ -è -__THROW -; - -304  - #__i¦—p -( -y—r -) \ - -305 (( -y—r -è% 4 =ð0 && ((y—rè% 100 !ð0 || (y—rè% 400 =ð0)) - - ) - -308 #ifdeà -__USE_MISC - - -313 -time_t - - $timegm - ( -tm - * -__ -è -__THROW -; - -316 -time_t - - $tim–oÿl - ( -tm - * -__ -è -__THROW -; - -319  - $dysize - ( -__y—r -è -__THROW - - `__©Œibu‹__ - (( -__cÚ¡__ -)); - -323 #ifdeà -__USE_POSIX199309 - - -328  - `Çno¦“p - ( -__cÚ¡ -  -time¥ec - * -__»que¡ed_time -, - -329  -time¥ec - * -__»maššg -); - -333  - $þock_g‘»s - ( -þockid_t - -__þock_id -,  -time¥ec - * -__»s -è -__THROW -; - -336  - $þock_g‘time - ( -þockid_t - -__þock_id -,  -time¥ec - * -__ -è -__THROW -; - -339  - $þock_£‰ime - ( -þockid_t - -__þock_id -, -__cÚ¡ -  -time¥ec - * -__ -) - -340 -__THROW -; - -342 #ifdeà -__USE_XOPEN2K - - -347  - `þock_Çno¦“p - ( -þockid_t - -__þock_id -,  -__æags -, - -348 -__cÚ¡ -  -time¥ec - * -__»q -, - -349  -time¥ec - * -__»m -); - -352  - $þock_g‘ýuþockid - ( -pid_t - -__pid -, -þockid_t - * -__þock_id -è -__THROW -; - -357  - $tim”_ü—‹ - ( -þockid_t - -__þock_id -, - -358  -sigev’t - * -__»¡riù - -__evp -, - -359 -tim”_t - * -__»¡riù - -__tim”id -è -__THROW -; - -362  - $tim”_d–‘e - ( -tim”_t - -__tim”id -è -__THROW -; - -365  - $tim”_£‰ime - ( -tim”_t - -__tim”id -,  -__æags -, - -366 -__cÚ¡ -  -™im”¥ec - * -__»¡riù - -__v®ue -, - -367  -™im”¥ec - * -__»¡riù - -__ov®ue -è -__THROW -; - -370  - $tim”_g‘time - ( -tim”_t - -__tim”id -,  -™im”¥ec - * -__v®ue -) - -371 -__THROW -; - -374  - $tim”_g‘ov”run - ( -tim”_t - -__tim”id -è -__THROW -; - -378 #ifdeà -__USE_XOPEN_EXTENDED - - -390  -g‘d©e_”r -; - -399  -tm - * - `g‘d©e - ( -__cÚ¡ - * -__¡ršg -); - -402 #ifdeà -__USE_GNU - - -413  - `g‘d©e_r - ( -__cÚ¡ - * -__»¡riù - -__¡ršg -, - -414  -tm - * -__»¡riù - -__»sbuå -); - -417 -__END_DECLS - - - @/usr/include/wctype.h - -24 #iâdeà -_WCTYPE_H - - -26  - ~<ã©u»s.h -> - -27  - ~ - -29 #iâdeà -__Ãed_iswxxx - - -30  - #_WCTYPE_H - 1 - - ) - -33  - #__Ãed_wšt_t - - - ) - -34  - ~<¡ddef.h -> - -38 #iâdeà -WEOF - - -39  - #WEOF - (0xffffffffu) - - ) - -42 #undeà -__Ãed_iswxxx - - -47 #iâdeà -__iswxxx_defšed - - -48  - #__iswxxx_defšed - 1 - - ) - -50 -__BEGIN_NAMESPACE_C99 - - -53  - twùy³_t -; - -54 - g__END_NAMESPACE_C99 - - -56 #iâdeà -_ISwb™ - - -61  - ~<’dŸn.h -> - -62 #ià -__BYTE_ORDER - =ð -__BIG_ENDIAN - - -63  - #_ISwb™ -( -b™ -è(1 << (b™)) - - ) - -65  - #_ISwb™ -( -b™ -) \ - -66 (( -b™ -) < 8 ? () ((1UL << (bit)) << 24) \ - -67 : (( -b™ -) < 16 ? () ((1UL << (bit)) << 8) \ - -68 : (( -b™ -) < 24 ? () ((1UL << (bit)) >> 8) \ - -69 : (è((1UL << ( -b™ -)è>> 24)))) - - ) - -74 - m__ISwuµ” - = 0, - -75 - m__ISwlow” - = 1, - -76 - m__ISw®pha - = 2, - -77 - m__ISwdig™ - = 3, - -78 - m__ISwxdig™ - = 4, - -79 - m__ISw¥aû - = 5, - -80 - m__ISw´št - = 6, - -81 - m__ISwg¿ph - = 7, - -82 - m__ISwbÏnk - = 8, - -83 - m__ISwúŒl - = 9, - -84 - m__ISwpunù - = 10, - -85 - m__ISw®num - = 11, - -87 - m_ISwuµ” - = -_ISwb™ - ( -__ISwuµ” -), - -88 - m_ISwlow” - = -_ISwb™ - ( -__ISwlow” -), - -89 - m_ISw®pha - = -_ISwb™ - ( -__ISw®pha -), - -90 - m_ISwdig™ - = -_ISwb™ - ( -__ISwdig™ -), - -91 - m_ISwxdig™ - = -_ISwb™ - ( -__ISwxdig™ -), - -92 - m_ISw¥aû - = -_ISwb™ - ( -__ISw¥aû -), - -93 - m_ISw´št - = -_ISwb™ - ( -__ISw´št -), - -94 - m_ISwg¿ph - = -_ISwb™ - ( -__ISwg¿ph -), - -95 - m_ISwbÏnk - = -_ISwb™ - ( -__ISwbÏnk -), - -96 - m_ISwúŒl - = -_ISwb™ - ( -__ISwúŒl -), - -97 - m_ISwpunù - = -_ISwb™ - ( -__ISwpunù -), - -98 - m_ISw®num - = -_ISwb™ - ( -__ISw®num -) - -103 -__BEGIN_DECLS - - -105 -__BEGIN_NAMESPACE_C99 - - -112  - $isw®num - ( -wšt_t - -__wc -è -__THROW -; - -118  - $isw®pha - ( -wšt_t - -__wc -è -__THROW -; - -121  - $iswúŒl - ( -wšt_t - -__wc -è -__THROW -; - -125  - $iswdig™ - ( -wšt_t - -__wc -è -__THROW -; - -129  - $iswg¿ph - ( -wšt_t - -__wc -è -__THROW -; - -134  - $iswlow” - ( -wšt_t - -__wc -è -__THROW -; - -137  - $isw´št - ( -wšt_t - -__wc -è -__THROW -; - -142  - $iswpunù - ( -wšt_t - -__wc -è -__THROW -; - -147  - $isw¥aû - ( -wšt_t - -__wc -è -__THROW -; - -152  - $iswuµ” - ( -wšt_t - -__wc -è -__THROW -; - -157  - $iswxdig™ - ( -wšt_t - -__wc -è -__THROW -; - -162 #ifdeà -__USE_ISOC99 - - -163  - $iswbÏnk - ( -wšt_t - -__wc -è -__THROW -; - -172 -wùy³_t - - $wùy³ - ( -__cÚ¡ - * -__´Ý”ty -è -__THROW -; - -176  - $iswùy³ - ( -wšt_t - -__wc -, -wùy³_t - -__desc -è -__THROW -; - -177 -__END_NAMESPACE_C99 - - -184 -__BEGIN_NAMESPACE_C99 - - -187  -__cÚ¡ - - t__št32_t - * - twù¿ns_t -; - -188 -__END_NAMESPACE_C99 - - -189 #ifdeà -__USE_GNU - - -190 - $__USING_NAMESPACE_C99 -( -wù¿ns_t -) - -193 -__BEGIN_NAMESPACE_C99 - - -195 -wšt_t - - $towlow” - ( -wšt_t - -__wc -è -__THROW -; - -198 -wšt_t - - $towuµ” - ( -wšt_t - -__wc -è -__THROW -; - -199 -__END_NAMESPACE_C99 - - -201 -__END_DECLS - - -208 #ifdeà -_WCTYPE_H - - -214 -__BEGIN_DECLS - - -216 -__BEGIN_NAMESPACE_C99 - - -219 -wù¿ns_t - - $wù¿ns - ( -__cÚ¡ - * -__´Ý”ty -è -__THROW -; - -222 -wšt_t - - $towù¿ns - ( -wšt_t - -__wc -, -wù¿ns_t - -__desc -è -__THROW -; - -223 -__END_NAMESPACE_C99 - - -225 #ifdeà -__USE_XOPEN2K8 - - -227  - ~ - -231  - $isw®num_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -237  - $isw®pha_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -240  - $iswúŒl_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -244  - $iswdig™_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -248  - $iswg¿ph_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -253  - $iswlow”_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -256  - $isw´št_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -261  - $iswpunù_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -266  - $isw¥aû_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -271  - $iswuµ”_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -276  - $iswxdig™_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -281  - $iswbÏnk_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -285 -wùy³_t - - $wùy³_l - ( -__cÚ¡ - * -__´Ý”ty -, -__loÿË_t - -__loÿË -) - -286 -__THROW -; - -290  - $iswùy³_l - ( -wšt_t - -__wc -, -wùy³_t - -__desc -, -__loÿË_t - -__loÿË -) - -291 -__THROW -; - -299 -wšt_t - - $towlow”_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -302 -wšt_t - - $towuµ”_l - ( -wšt_t - -__wc -, -__loÿË_t - -__loÿË -è -__THROW -; - -306 -wù¿ns_t - - $wù¿ns_l - ( -__cÚ¡ - * -__´Ý”ty -, -__loÿË_t - -__loÿË -) - -307 -__THROW -; - -310 -wšt_t - - $towù¿ns_l - ( -wšt_t - -__wc -, -wù¿ns_t - -__desc -, - -311 -__loÿË_t - -__loÿË -è -__THROW -; - -315 -__END_DECLS - - - @/usr/include/bits/errno.h - -20 #ifdeà -_ERRNO_H - - -22 #undeà -EDOM - - -23 #undeà -EILSEQ - - -24 #undeà -ERANGE - - -25  - ~ - -28  - #ENOTSUP - -EOPNOTSUPP - - - ) - -31 #iâdeà -ECANCELED - - -32  - #ECANCELED - 125 - - ) - -36 #iâdeà -EOWNERDEAD - - -37  - #EOWNERDEAD - 130 - - ) - -38  - #ENOTRECOVERABLE - 131 - - ) - -41 #iâdeà -__ASSEMBLER__ - - -43 * - $__”ºo_loÿtiÚ - (è -__THROW - - `__©Œibu‹__ - (( -__cÚ¡__ -)); - -45 #ià! -defšed - -_LIBC - || defšed -_LIBC_REENTRANT - - -47  - #”ºo - (* - `__”ºo_loÿtiÚ - ()) - - ) - -52 #ià! -defšed - -_ERRNO_H - && defšed -__Ãed_Em©h - - -56  - #EDOM - 33 - - ) - -57  - #EILSEQ - 84 - - ) - -58  - #ERANGE - 34 - - ) - - @/usr/include/bits/select.h - -19 #iâdeà -_SYS_SELECT_H - - -23  - ~ - -26 #ià -defšed - -__GNUC__ - && __GNUC__ >= 2 - -28 #ià -__WORDSIZE - == 64 - -29  - #__FD_ZERO_STOS - "¡osq" - - ) - -31  - #__FD_ZERO_STOS - "¡o¦" - - ) - -34  - #__FD_ZERO -( -fd¥ -) \ - -36  -__d0 -, -__d1 -; \ - -37 -__asm__ - - `__vÞ©že__ - ("þd;„•; " -__FD_ZERO_STOS - \ - -38 : "=c" ( -__d0 -), "=D" ( -__d1 -) \ - -39 : "a" (0), "0" ( ( -fd_£t -) \ - -40 /  ( -__fd_mask -)), \ - -41 "1" (& - `__FDS_BITS - ( -fd¥ -)[0]) \ - -43 } 0) - - ) - -49  - #__FD_ZERO -( -£t -) \ - -51  -__i -; \ - -52 -fd_£t - * -__¬r - = ( -£t -); \ - -53  -__i - = 0; __˜<  ( -fd_£t -è/  ( -__fd_mask -); ++__i) \ - -54 - `__FDS_BITS - ( -__¬r -)[ -__i -] = 0; \ - -55 } 0) - - ) - -59  - #__FD_SET -( -d -, -£t -è( - `__FDS_BITS - (£t)[ - `__FDELT - (d)] |ð - `__FDMASK - (d)) - - ) - -60  - #__FD_CLR -( -d -, -£t -è( - `__FDS_BITS - (£t)[ - `__FDELT - (d)] &ð~ - `__FDMASK - (d)) - - ) - -61  - #__FD_ISSET -( -d -, -£t -) \ - -62 (( - `__FDS_BITS - ( -£t -)[ - `__FDELT - ( -d -)] & - `__FDMASK - (d)è!ð0) - - ) - - @/usr/include/bits/setjmp.h - -20 #iâdeà -_BITS_SETJMP_H - - -21  - #_BITS_SETJMP_H - 1 - - ) - -23 #ià! -defšed - -_SETJMP_H - && !defšed -_PTHREAD_H - - -27  - ~ - -29 #iâdeà -_ASM - - -31 #ià -__WORDSIZE - == 64 - -32  - t__jmp_buf -[8]; - -34  - t__jmp_buf -[6]; - - @/usr/include/bits/sigset.h - -21 #iâdef -_SIGSET_H_ty³s - - -22  - #_SIGSET_H_ty³s - 1 - - ) - -24  - t__sig_©omic_t -; - -28  - #_SIGSET_NWORDS - (1024 / (8 *  ())) - - ) - -31  - m__v® -[ -_SIGSET_NWORDS -]; - -32 } - t__sig£t_t -; - -43 #ià! -defšed - -_SIGSET_H_âs - && defšed -_SIGNAL_H - - -44  - #_SIGSET_H_âs - 1 - - ) - -46 #iâdeà -_EXTERN_INLINE - - -47  - #_EXTERN_INLINE - -__ex‹º_šlše - - - ) - -51  - #__sigmask -( -sig -) \ - -52 (((è1è<< ((( -sig -è- 1è% (8 *  ()))) - - ) - -55  - #__sigwÜd -( -sig -è(((sigè- 1è/ (8 *  ())) - - ) - -57 #ià -defšed - -__GNUC__ - && __GNUC__ >= 2 - -58  - #__sigem±y£t -( -£t -) \ - -59 ( - `__ex‹nsiÚ__ - ({  -__út - = -_SIGSET_NWORDS -; \ - -60 -sig£t_t - * -__£t - = ( -£t -); \ - -61 -- -__út - >ð0è -__£t --> -__v® -[__cnt] = 0; \ - -62 0; })) - - ) - -63  - #__sigfžl£t -( -£t -) \ - -64 ( - `__ex‹nsiÚ__ - ({  -__út - = -_SIGSET_NWORDS -; \ - -65 -sig£t_t - * -__£t - = ( -£t -); \ - -66 -- -__út - >ð0è -__£t --> -__v® -[__cnt] = ~0UL; \ - -67 0; })) - - ) - -69 #ifdeà -__USE_GNU - - -73  - #__sigi£m±y£t -( -£t -) \ - -74 ( - `__ex‹nsiÚ__ - ({  -__út - = -_SIGSET_NWORDS -; \ - -75 cÚ¡ -sig£t_t - * -__£t - = ( -£t -); \ - -76  -__»t - = -__£t --> -__v® -[-- -__út -]; \ - -77 ! -__»t - && -- -__út - >= 0) \ - -78 -__»t - = -__£t --> -__v® -[ -__út -]; \ - -79 -__»t - =ð0; })) - - ) - -80  - #__sigªd£t -( -de¡ -, -Ëá -, -right -) \ - -81 ( - `__ex‹nsiÚ__ - ({  -__út - = -_SIGSET_NWORDS -; \ - -82 -sig£t_t - * -__de¡ - = ( -de¡ -); \ - -83 cÚ¡ -sig£t_t - * -__Ëá - = ( -Ëá -); \ - -84 cÚ¡ -sig£t_t - * -__right - = ( -right -); \ - -85 -- -__út - >= 0) \ - -86 -__de¡ --> -__v® -[ -__út -] = ( -__Ëá -->__val[__cnt] \ - -87 & -__right --> -__v® -[ -__út -]); \ - -88 0; })) - - ) - -89  - #__sigÜ£t -( -de¡ -, -Ëá -, -right -) \ - -90 ( - `__ex‹nsiÚ__ - ({  -__út - = -_SIGSET_NWORDS -; \ - -91 -sig£t_t - * -__de¡ - = ( -de¡ -); \ - -92 cÚ¡ -sig£t_t - * -__Ëá - = ( -Ëá -); \ - -93 cÚ¡ -sig£t_t - * -__right - = ( -right -); \ - -94 -- -__út - >= 0) \ - -95 -__de¡ --> -__v® -[ -__út -] = ( -__Ëá -->__val[__cnt] \ - -96 | -__right --> -__v® -[ -__út -]); \ - -97 0; })) - - ) - -104  -__sigismemb” - ( -__cÚ¡ - -__sig£t_t - *, ); - -105  -__sigadd£t - ( -__sig£t_t - *, ); - -106  -__sigd–£t - ( -__sig£t_t - *, ); - -108 #ifdeà -__USE_EXTERN_INLINES - - -109  - #__SIGSETFN -( -NAME -, -BODY -, -CONST -) \ - -110 -_EXTERN_INLINE - \ - -111 - `NAME - ( -CONST - -__sig£t_t - * -__£t -,  -__sig -) \ - -113  -__mask - = - `__sigmask - ( -__sig -); \ - -114  -__wÜd - = - `__sigwÜd - ( -__sig -); \ - -115  -BODY -; \ - -116 } - - ) - -118 -__SIGSETFN - ( -__sigismemb” -, ( -__£t --> -__v® -[ -__wÜd -] & -__mask -è? 1 : 0, -__cÚ¡ -) - -119 -__SIGSETFN - ( -__sigadd£t -, (( -__£t --> -__v® -[ -__wÜd -] |ð -__mask -), 0), ) - -120 -__SIGSETFN - ( -__sigd–£t -, (( -__£t --> -__v® -[ -__wÜd -] &ð~ -__mask -), 0), ) - -122 #undeà -__SIGSETFN - - - @/usr/include/bits/time.h - -24 #iâdeà -__Ãed_timev® - - -25 #iâdeà -_BITS_TIME_H - - -26  - #_BITS_TIME_H - 1 - - ) - -34  - #CLOCKS_PER_SEC - 1000000l - - ) - -36 #ià! -defšed - -__STRICT_ANSI__ - && !defšed -__USE_XOPEN2K - - -39  - ~ - -40  -__syscÚf - (); - -41  - #CLK_TCK - (( -__þock_t -è - `__syscÚf - (2)è - - ) - -44 #ifdeà -__USE_POSIX199309 - - -46  - #CLOCK_REALTIME - 0 - - ) - -48  - #CLOCK_MONOTONIC - 1 - - ) - -50  - #CLOCK_PROCESS_CPUTIME_ID - 2 - - ) - -52  - #CLOCK_THREAD_CPUTIME_ID - 3 - - ) - -55  - #TIMER_ABSTIME - 1 - - ) - -61 #ifdeà -__Ãed_timev® - - -62 #undeà -__Ãed_timev® - - -63 #iâdeà -_STRUCT_TIMEVAL - - -64  - #_STRUCT_TIMEVAL - 1 - - ) - -65  - ~ - -69  - stimev® - - -71 -__time_t - - mtv_£c -; - -72 -__su£cÚds_t - - mtv_u£c -; - - @/usr/include/sched.h - -20 #iâdef -_SCHED_H - - -21  - #_SCHED_H - 1 - - ) - -23  - ~<ã©u»s.h -> - -26  - ~ - -28  - #__Ãed_size_t - - - ) - -29  - ~<¡ddef.h -> - -31  - #__Ãed_time¥ec - - - ) - -32  - ~ - -35  - ~ - -37  - #sched_´iÜ™y - -__sched_´iÜ™y - - - ) - -40 -__BEGIN_DECLS - - -43  - $sched_£¬am - ( -__pid_t - -__pid -, -__cÚ¡ -  -sched_·¿m - * -__·¿m -) - -44 -__THROW -; - -47  - $sched_g‘·¿m - ( -__pid_t - -__pid -,  -sched_·¿m - * -__·¿m -è -__THROW -; - -50  - $sched_£tscheduËr - ( -__pid_t - -__pid -,  -__pÞicy -, - -51 -__cÚ¡ -  -sched_·¿m - * -__·¿m -è -__THROW -; - -54  - $sched_g‘scheduËr - ( -__pid_t - -__pid -è -__THROW -; - -57  - $sched_y›ld - (è -__THROW -; - -60  - $sched_g‘_´iÜ™y_max - ( -__®gÜ™hm -è -__THROW -; - -63  - $sched_g‘_´iÜ™y_mš - ( -__®gÜ™hm -è -__THROW -; - -66  - $sched_¼_g‘_š‹rv® - ( -__pid_t - -__pid -,  -time¥ec - * -__t -è -__THROW -; - -69 #ifdeà -__USE_GNU - - -71  - #CPU_SETSIZE - -__CPU_SETSIZE - - - ) - -72  - #CPU_SET -( -ýu -, -ýu£ -è - `__CPU_SET_S - (ýu,  ( -ýu_£t_t -), cpu£) - - ) - -73  - #CPU_CLR -( -ýu -, -ýu£ -è - `__CPU_CLR_S - (ýu,  ( -ýu_£t_t -), cpu£) - - ) - -74  - #CPU_ISSET -( -ýu -, -ýu£ -è - `__CPU_ISSET_S - (ýu,  ( -ýu_£t_t -), \ - -75 -ýu£ -) - - ) - -76  - #CPU_ZERO -( -ýu£ -è - `__CPU_ZERO_S - ( ( -ýu_£t_t -), cpu£) - - ) - -77  - #CPU_COUNT -( -ýu£ -è - `__CPU_COUNT_S - ( ( -ýu_£t_t -), cpu£) - - ) - -79  - #CPU_SET_S -( -ýu -, -£tsize -, -ýu£ -è - `__CPU_SET_S - (ýu, s‘size, cpu£) - - ) - -80  - #CPU_CLR_S -( -ýu -, -£tsize -, -ýu£ -è - `__CPU_CLR_S - (ýu, s‘size, cpu£) - - ) - -81  - #CPU_ISSET_S -( -ýu -, -£tsize -, -ýu£ -è - `__CPU_ISSET_S - (cpu, setsize, \ - -82 -ýu£ -) - - ) - -83  - #CPU_ZERO_S -( -£tsize -, -ýu£ -è - `__CPU_ZERO_S - (£tsize, cpu£) - - ) - -84  - #CPU_COUNT_S -( -£tsize -, -ýu£ -è - `__CPU_COUNT_S - (£tsize, cpu£) - - ) - -86  - #CPU_EQUAL -( -ýu£1 -, -ýu£2 -) \ - -87 - `__CPU_EQUAL_S - ( ( -ýu_£t_t -), -ýu£1 -, -ýu£2 -) - - ) - -88  - #CPU_EQUAL_S -( -£tsize -, -ýu£1 -, -ýu£2 -) \ - -89 - `__CPU_EQUAL_S - ( -£tsize -, -ýu£1 -, -ýu£2 -) - - ) - -91  - #CPU_AND -( -de¡£t -, -¤c£t1 -, -¤c£t2 -) \ - -92 - `__CPU_OP_S - ( ( -ýu_£t_t -), -de¡£t -, -¤c£t1 -, -¤c£t2 -, &) - - ) - -93  - #CPU_OR -( -de¡£t -, -¤c£t1 -, -¤c£t2 -) \ - -94 - `__CPU_OP_S - ( ( -ýu_£t_t -), -de¡£t -, -¤c£t1 -, -¤c£t2 -, |) - - ) - -95  - #CPU_XOR -( -de¡£t -, -¤c£t1 -, -¤c£t2 -) \ - -96 - `__CPU_OP_S - ( ( -ýu_£t_t -), -de¡£t -, -¤c£t1 -, -¤c£t2 -, ^) - - ) - -97  - #CPU_AND_S -( -£tsize -, -de¡£t -, -¤c£t1 -, -¤c£t2 -) \ - -98 - `__CPU_OP_S - ( -£tsize -, -de¡£t -, -¤c£t1 -, -¤c£t2 -, &) - - ) - -99  - #CPU_OR_S -( -£tsize -, -de¡£t -, -¤c£t1 -, -¤c£t2 -) \ - -100 - `__CPU_OP_S - ( -£tsize -, -de¡£t -, -¤c£t1 -, -¤c£t2 -, |) - - ) - -101  - #CPU_XOR_S -( -£tsize -, -de¡£t -, -¤c£t1 -, -¤c£t2 -) \ - -102 - `__CPU_OP_S - ( -£tsize -, -de¡£t -, -¤c£t1 -, -¤c£t2 -, ^) - - ) - -104  - #CPU_ALLOC_SIZE -( -couÁ -è - `__CPU_ALLOC_SIZE - (couÁ) - - ) - -105  - #CPU_ALLOC -( -couÁ -è - `__CPU_ALLOC - (couÁ) - - ) - -106  - #CPU_FREE -( -ýu£t -è - `__CPU_FREE - (ýu£t) - - ) - -110  - $sched_£ffš™y - ( -__pid_t - -__pid -, -size_t - -__ýu£tsize -, - -111 -__cÚ¡ - -ýu_£t_t - * -__ýu£t -è -__THROW -; - -114  - $sched_g‘affš™y - ( -__pid_t - -__pid -, -size_t - -__ýu£tsize -, - -115 -ýu_£t_t - * -__ýu£t -è -__THROW -; - -118 -__END_DECLS - - - @/usr/include/signal.h - -23 #iâdef -_SIGNAL_H - - -25 #ià! -defšed - -__Ãed_sig_©omic_t - && !defšed -__Ãed_sig£t_t - - -26  - #_SIGNAL_H - - - ) - -29  - ~<ã©u»s.h -> - -31 - g__BEGIN_DECLS - - -33  - ~ - -37 #ià -defšed - -__Ãed_sig_©omic_t - || defšed -_SIGNAL_H - - -38 #iâdeà -__sig_©omic_t_defšed - - -39  - #__sig_©omic_t_defšed - - - ) - -40 -__BEGIN_NAMESPACE_STD - - -41  -__sig_©omic_t - - tsig_©omic_t -; - -42 - g__END_NAMESPACE_STD - - -44 #undeà -__Ãed_sig_©omic_t - - -47 #ià -defšed - -__Ãed_sig£t_t - || (defšed -_SIGNAL_H - && defšed -__USE_POSIX -) - -48 #iâdeà -__sig£t_t_defšed - - -49  - #__sig£t_t_defšed - - - ) - -50  -__sig£t_t - - tsig£t_t -; - -52 #undeà -__Ãed_sig£t_t - - -55 #ifdeà -_SIGNAL_H - - -57  - ~ - -58  - ~ - -60 #ià -defšed - -__USE_XOPEN - || defšed -__USE_XOPEN2K - - -61 #iâdeà -__pid_t_defšed - - -62  -__pid_t - - tpid_t -; - -63  - #__pid_t_defšed - - - ) - -65 #ifdeà -__USE_XOPEN - - -67 #iâdeà -__uid_t_defšed - - -68  -__uid_t - - tuid_t -; - -69  - #__uid_t_defšed - - - ) - -73 #ifdeà -__USE_POSIX199309 - - -75  - #__Ãed_time¥ec - - - ) - -76  - ~ - -79  - ~ - -84 (* - t__sighªdËr_t -) (); - -89 -__sighªdËr_t - - $__sysv_sigÇl - ( -__sig -, -__sighªdËr_t - -__hªdËr -) - -90 -__THROW -; - -91 #ifdeà -__USE_GNU - - -92 -__sighªdËr_t - - $sysv_sigÇl - ( -__sig -, -__sighªdËr_t - -__hªdËr -) - -93 -__THROW -; - -99 -__BEGIN_NAMESPACE_STD - - -100 #ifdeà -__USE_BSD - - -101 -__sighªdËr_t - - $sigÇl - ( -__sig -, -__sighªdËr_t - -__hªdËr -) - -102 -__THROW -; - -105 #ifdeà -__REDIRECT_NTH - - -106 -__sighªdËr_t - - `__REDIRECT_NTH - ( -sigÇl -, - -107 ( -__sig -, -__sighªdËr_t - -__hªdËr -), - -108 -__sysv_sigÇl -); - -110  - #sigÇl - -__sysv_sigÇl - - - ) - -113 -__END_NAMESPACE_STD - - -115 #ifdeà -__USE_XOPEN - - -118 -__sighªdËr_t - - $bsd_sigÇl - ( -__sig -, -__sighªdËr_t - -__hªdËr -) - -119 -__THROW -; - -125 #ifdeà -__USE_POSIX - - -126  - $kžl - ( -__pid_t - -__pid -,  -__sig -è -__THROW -; - -129 #ià -defšed - -__USE_BSD - || defšed -__USE_XOPEN_EXTENDED - - -133  - $kžÍg - ( -__pid_t - -__pg½ -,  -__sig -è -__THROW -; - -136 -__BEGIN_NAMESPACE_STD - - -138  - $¿i£ - ( -__sig -è -__THROW -; - -139 -__END_NAMESPACE_STD - - -141 #ifdeà -__USE_SVID - - -143 -__sighªdËr_t - - $ssigÇl - ( -__sig -, -__sighªdËr_t - -__hªdËr -) - -144 -__THROW -; - -145  - $gsigÇl - ( -__sig -è -__THROW -; - -148 #ià -defšed - -__USE_MISC - || defšed -__USE_XOPEN2K - - -150  - `psigÇl - ( -__sig -, -__cÚ¡ - * -__s -); - -153 #ifdeà -__USE_XOPEN2K - - -155  - `psigšfo - ( -__cÚ¡ - -sigšfo_t - * -__pšfo -, __cÚ¡ * -__s -); - -168  - `__sig·u£ - ( -__sig_Ü_mask -,  -__is_sig -); - -170 #ifdeà -__FAVOR_BSD - - -173  - $sig·u£ - ( -__mask -è -__THROW - -__©Œibu‹_d•»ÿ‹d__ -; - -175 #ifdeà -__USE_XOPEN - - -176 #ifdeà -__GNUC__ - - -177  - $sig·u£ - ( -__sig -è - `__asm__ - ("__xpg_sigpause"); - -180  - #sig·u£ -( -sig -è - `__sig·u£ - ((sig), 1) - - ) - -186 #ifdeà -__USE_BSD - - -193  - #sigmask -( -sig -è - `__sigmask -(sig) - - ) - -196  - $sigblock - ( -__mask -è -__THROW - -__©Œibu‹_d•»ÿ‹d__ -; - -199  - $sig£tmask - ( -__mask -è -__THROW - -__©Œibu‹_d•»ÿ‹d__ -; - -202  - $sigg‘mask - (è -__THROW - -__©Œibu‹_d•»ÿ‹d__ -; - -206 #ifdeà -__USE_MISC - - -207  - #NSIG - -_NSIG - - - ) - -210 #ifdeà -__USE_GNU - - -211  -__sighªdËr_t - - tsighªdËr_t -; - -215 #ifdeà -__USE_BSD - - -216  -__sighªdËr_t - - tsig_t -; - -219 #ifdeà -__USE_POSIX - - -222  - $sigem±y£t - ( -sig£t_t - * -__£t -è -__THROW - - `__nÚnuÎ - ((1)); - -225  - $sigfžl£t - ( -sig£t_t - * -__£t -è -__THROW - - `__nÚnuÎ - ((1)); - -228  - $sigadd£t - ( -sig£t_t - * -__£t -,  -__signo -è -__THROW - - `__nÚnuÎ - ((1)); - -231  - $sigd–£t - ( -sig£t_t - * -__£t -,  -__signo -è -__THROW - - `__nÚnuÎ - ((1)); - -234  - $sigismemb” - ( -__cÚ¡ - -sig£t_t - * -__£t -,  -__signo -) - -235 -__THROW - - `__nÚnuÎ - ((1)); - -237 #ifdeà -__USE_GNU - - -239  - $sigi£m±y£t - ( -__cÚ¡ - -sig£t_t - * -__£t -è -__THROW - - `__nÚnuÎ - ((1)); - -242  - $sigªd£t - ( -sig£t_t - * -__£t -, -__cÚ¡ - sig£t_ˆ* -__Ëá -, - -243 -__cÚ¡ - -sig£t_t - * -__right -è -__THROW - - `__nÚnuÎ - ((1, 2, 3)); - -246  - $sigÜ£t - ( -sig£t_t - * -__£t -, -__cÚ¡ - sig£t_ˆ* -__Ëá -, - -247 -__cÚ¡ - -sig£t_t - * -__right -è -__THROW - - `__nÚnuÎ - ((1, 2, 3)); - -252  - ~ - -255  - $sig´ocmask - ( -__how -, -__cÚ¡ - -sig£t_t - * -__»¡riù - -__£t -, - -256 -sig£t_t - * -__»¡riù - -__o£t -è -__THROW -; - -263  - $sigsu¥’d - ( -__cÚ¡ - -sig£t_t - * -__£t -è - `__nÚnuÎ - ((1)); - -266  - $sigaùiÚ - ( -__sig -, -__cÚ¡ -  -sigaùiÚ - * -__»¡riù - -__aù -, - -267  -sigaùiÚ - * -__»¡riù - -__ßù -è -__THROW -; - -270  - $sig³ndšg - ( -sig£t_t - * -__£t -è -__THROW - - `__nÚnuÎ - ((1)); - -277  - $sigwa™ - ( -__cÚ¡ - -sig£t_t - * -__»¡riù - -__£t -, *__»¡riù -__sig -) - -278 - `__nÚnuÎ - ((1, 2)); - -280 #ifdeà -__USE_POSIX199309 - - -285  - $sigwa™šfo - ( -__cÚ¡ - -sig£t_t - * -__»¡riù - -__£t -, - -286 -sigšfo_t - * -__»¡riù - -__šfo -è - `__nÚnuÎ - ((1)); - -293  - $sigtimedwa™ - ( -__cÚ¡ - -sig£t_t - * -__»¡riù - -__£t -, - -294 -sigšfo_t - * -__»¡riù - -__šfo -, - -295 -__cÚ¡ -  -time¥ec - * -__»¡riù - -__timeout -) - -296 - `__nÚnuÎ - ((1)); - -300  - $sigqueue - ( -__pid_t - -__pid -,  -__sig -, -__cÚ¡ -  -sigv® - -__v® -) - -301 -__THROW -; - -306 #ifdeà -__USE_BSD - - -310 -__cÚ¡ - *__cÚ¡ -_sys_sigli¡ -[ -_NSIG -]; - -311 -__cÚ¡ - *__cÚ¡ -sys_sigli¡ -[ -_NSIG -]; - -314  - ssigvec - - -316 -__sighªdËr_t - -sv_hªdËr -; - -317  -sv_mask -; - -319  -sv_æags -; - -320  - #sv_Ú¡ack - -sv_æags - - - ) - -324  - #SV_ONSTACK - (1 << 0) - - ) - -325  - #SV_INTERRUPT - (1 << 1) - - ) - -326  - #SV_RESETHAND - (1 << 2) - - ) - -334  - $sigvec - ( -__sig -, -__cÚ¡ -  -sigvec - * -__vec -, - -335  -sigvec - * -__ovec -è -__THROW -; - -339  - ~ - -342  - $sig»tuº - ( -sigcÚ‹xt - * -__sý -è -__THROW -; - -347 #ià -defšed - -__USE_BSD - || defšed -__USE_XOPEN_EXTENDED - - -348  - #__Ãed_size_t - - - ) - -349  - ~<¡ddef.h -> - -354  - $sigš‹¼u± - ( -__sig -,  -__š‹¼u± -è -__THROW -; - -356  - ~ - -357 #ifdeà -__USE_XOPEN - - -359  - ~ - -365  - $sig¡ack - ( -sig¡ack - * -__ss -, sig¡ack * -__oss -) - -366 -__THROW - -__©Œibu‹_d•»ÿ‹d__ -; - -370  - $sig®t¡ack - ( -__cÚ¡ -  -sig®t¡ack - * -__»¡riù - -__ss -, - -371  -sig®t¡ack - * -__»¡riù - -__oss -è -__THROW -; - -375 #ifdeà -__USE_XOPEN_EXTENDED - - -379  - $sighÞd - ( -__sig -è -__THROW -; - -382  - $sig»l£ - ( -__sig -è -__THROW -; - -385  - $sigignÜe - ( -__sig -è -__THROW -; - -388 -__sighªdËr_t - - $sig£t - ( -__sig -, -__sighªdËr_t - -__di¥ -è -__THROW -; - -391 #ià -defšed - -__USE_POSIX199506 - || defšed -__USE_UNIX98 - - -394  - ~ - -395  - ~ - -402  - $__libc_cu¼’t_sig¹mš - (è -__THROW -; - -404  - $__libc_cu¼’t_sig¹max - (è -__THROW -; - -408 -__END_DECLS - - - @/usr/include/bits/sched.h - -22 #iâdeà -__Ãed_sched·¿m - - -24 #iâdeà -_SCHED_H - - -30  - #SCHED_OTHER - 0 - - ) - -31  - #SCHED_FIFO - 1 - - ) - -32  - #SCHED_RR - 2 - - ) - -33 #ifdeà -__USE_GNU - - -34  - #SCHED_BATCH - 3 - - ) - -37 #ifdeà -__USE_MISC - - -39  - #CSIGNAL - 0x000000fà - - ) - -40  - #CLONE_VM - 0x00000100 - - ) - -41  - #CLONE_FS - 0x00000200 - - ) - -42  - #CLONE_FILES - 0x00000400 - - ) - -43  - #CLONE_SIGHAND - 0x00000800 - - ) - -44  - #CLONE_PTRACE - 0x00002000 - - ) - -45  - #CLONE_VFORK - 0x00004000 - - ) - -47  - #CLONE_PARENT - 0x00008000 - - ) - -49  - #CLONE_THREAD - 0x00010000 - - ) - -50  - #CLONE_NEWNS - 0x00020000 - - ) - -51  - #CLONE_SYSVSEM - 0x00040000 - - ) - -52  - #CLONE_SETTLS - 0x00080000 - - ) - -53  - #CLONE_PARENT_SETTID - 0x00100000 - - ) - -55  - #CLONE_CHILD_CLEARTID - 0x00200000 - - ) - -57  - #CLONE_DETACHED - 0x00400000 - - ) - -58  - #CLONE_UNTRACED - 0x00800000 - - ) - -60  - #CLONE_CHILD_SETTID - 0x01000000 - - ) - -62  - #CLONE_NEWUTS - 0x04000000 - - ) - -63  - #CLONE_NEWIPC - 0x08000000 - - ) - -64  - #CLONE_NEWUSER - 0x10000000 - - ) - -65  - #CLONE_NEWPID - 0x20000000 - - ) - -66  - #CLONE_NEWNET - 0x40000000 - - ) - -67  - #CLONE_IO - 0x80000000 - - ) - -71  - ssched_·¿m - - -73  - m__sched_´iÜ™y -; - -76 - g__BEGIN_DECLS - - -78 #ifdeà -__USE_MISC - - -80  -þÚe - ((* -__â -è(* -__¬g -), * -__chžd_¡ack -, - -81  -__æags -, * -__¬g -, ...è -__THROW -; - -84  - $unsh¬e - ( -__æags -è -__THROW -; - -87  - $sched_g‘ýu - (è -__THROW -; - -90 -__END_DECLS - - -94 #ià! -defšed - -__defšed_sched·¿m - \ - -95 && ( -defšed - -__Ãed_sched·¿m - || defšed -_SCHED_H -) - -96  - #__defšed_sched·¿m - 1 - - ) - -98  - s__sched_·¿m - - -100  -__sched_´iÜ™y -; - -102 #undeà -__Ãed_sched·¿m - - -106 #ià -defšed - -_SCHED_H - && !defšed -__ýu_£t_t_defšed - - -107  - #__ýu_£t_t_defšed - - - ) - -109  - #__CPU_SETSIZE - 1024 - - ) - -110  - #__NCPUBITS - (8 *  ( -__ýu_mask -)) - - ) - -113  - t__ýu_mask -; - -116  - #__CPUELT -( -ýu -è((ýuè/ -__NCPUBITS -) - - ) - -117  - #__CPUMASK -( -ýu -è(( -__ýu_mask -è1 << ((ýuè% -__NCPUBITS -)) - - ) - -122 -__ýu_mask - -__b™s -[ -__CPU_SETSIZE - / -__NCPUBITS -]; - -123 } - týu_£t_t -; - -126 #ià - `__GNUC_PREREQ - (2, 91) - -127  - #__CPU_ZERO_S -( -£tsize -, -ýu£ -) \ - -128 dØ - `__bužtš_mem£t - ( -ýu£ -, '\0', -£tsize -); 0) - - ) - -130  - #__CPU_ZERO_S -( -£tsize -, -ýu£ -) \ - -132 -size_t - -__i -; \ - -133 -size_t - -__imax - = ( -£tsize -è/  ( -__ýu_mask -); \ - -134 -__ýu_mask - * -__b™s - = ( -ýu£ -)->__bits; \ - -135  -__i - = 0; __˜< -__imax -; ++__i) \ - -136 -__b™s -[ -__i -] = 0; \ - -137 - } -} 0) - - ) - -139  - #__CPU_SET_S -( -ýu -, -£tsize -, -ýu£ -) \ - -140 ( -__ex‹nsiÚ__ - \ - -141 ({ -size_t - -__ýu - = ( -ýu -); \ - -142 -__ýu - < 8 * ( -£tsize -) \ - -143 ? ((( -__ýu_mask - *è(( -ýu£ -)-> -__b™s -))[ - `__CPUELT - ( -__ýu -)] \ - -144 |ð - `__CPUMASK - ( -__ýu -)) \ - -145 : 0; })) - - ) - -146  - #__CPU_CLR_S -( -ýu -, -£tsize -, -ýu£ -) \ - -147 ( -__ex‹nsiÚ__ - \ - -148 ({ -size_t - -__ýu - = ( -ýu -); \ - -149 -__ýu - < 8 * ( -£tsize -) \ - -150 ? ((( -__ýu_mask - *è(( -ýu£ -)-> -__b™s -))[ - `__CPUELT - ( -__ýu -)] \ - -151 &ð~ - `__CPUMASK - ( -__ýu -)) \ - -152 : 0; })) - - ) - -153  - #__CPU_ISSET_S -( -ýu -, -£tsize -, -ýu£ -) \ - -154 ( -__ex‹nsiÚ__ - \ - -155 ({ -size_t - -__ýu - = ( -ýu -); \ - -156 -__ýu - < 8 * ( -£tsize -) \ - -157 ? (((( -__cÚ¡ - -__ýu_mask - *è(( -ýu£ -)-> -__b™s -))[ - `__CPUELT - ( -__ýu -)] \ - -158 & - `__CPUMASK - ( -__ýu -))) != 0 \ - -159 : 0; })) - - ) - -161  - #__CPU_COUNT_S -( -£tsize -, -ýu£ -) \ - -162 - `__sched_ýucouÁ - ( -£tsize -, -ýu£ -) - - ) - -164 #ià -__GNUC_PREREQ - (2, 91) - -165  - #__CPU_EQUAL_S -( -£tsize -, -ýu£1 -, -ýu£2 -) \ - -166 ( - `__bužtš_memcmp - ( -ýu£1 -, -ýu£2 -, -£tsize -è=ð0) - - ) - -168  - #__CPU_EQUAL_S -( -£tsize -, -ýu£1 -, -ýu£2 -) \ - -169 ( -__ex‹nsiÚ__ - \ - -170 ({ -__cÚ¡ - -__ýu_mask - * -__¬r1 - = ( -ýu£1 -)-> -__b™s -; \ - -171 -__cÚ¡ - -__ýu_mask - * -__¬r2 - = ( -ýu£2 -)-> -__b™s -; \ - -172 -size_t - -__imax - = ( -£tsize -è/  ( -__ýu_mask -); \ - -173 -size_t - -__i -; \ - -174  -__i - = 0; __˜< -__imax -; ++__i) \ - -175 ià( -__b™s -[ -__i -] != __bits[__i]) \ - -177 -__i - =ð -__imax -; })) - - ) - -180  - #__CPU_OP_S -( -£tsize -, -de¡£t -, -¤c£t1 -, -¤c£t2 -, -Ý -) \ - -181 ( -__ex‹nsiÚ__ - \ - -182 ({ -ýu_£t_t - * -__de¡ - = ( -de¡£t -); \ - -183 -__cÚ¡ - -__ýu_mask - * -__¬r1 - = ( -¤c£t1 -)-> -__b™s -; \ - -184 -__cÚ¡ - -__ýu_mask - * -__¬r2 - = ( -¤c£t2 -)-> -__b™s -; \ - -185 -size_t - -__imax - = ( -£tsize -è/  ( -__ýu_mask -); \ - -186 -size_t - -__i -; \ - -187  -__i - = 0; __˜< -__imax -; ++__i) \ - -188 (( -__ýu_mask - *è -__de¡ --> -__b™s -)[ -__i -] = -__¬r1 -[__i] -Ý - -__¬r2 -[__i]; \ - -189 -__de¡ -; })) - - ) - -191  - #__CPU_ALLOC_SIZE -( -couÁ -) \ - -192 (((( -couÁ -è+ -__NCPUBITS - - 1è/ __NCPUBITSè*  ( -__ýu_mask -)) - - ) - -193  - #__CPU_ALLOC -( -couÁ -è - `__sched_ýu®loc - (couÁ) - - ) - -194  - #__CPU_FREE -( -ýu£t -è - `__sched_ýuä“ - (ýu£t) - - ) - -196 -__BEGIN_DECLS - - -198  - $__sched_ýucouÁ - ( -size_t - -__£tsize -, cÚ¡ -ýu_£t_t - * -__£ -) - -199 -__THROW -; - -200 -ýu_£t_t - * - $__sched_ýu®loc - ( -size_t - -__couÁ -è -__THROW - -__wur -; - -201  - $__sched_ýuä“ - ( -ýu_£t_t - * -__£t -è -__THROW -; - -203 -__END_DECLS - - - @/usr/include/bits/sigaction.h - -20 #iâdeà -_SIGNAL_H - - -25  - ssigaùiÚ - - -28 #ifdeà -__USE_POSIX199309 - - -32 -__sighªdËr_t - - m§_hªdËr -; - -34 (* - m§_sigaùiÚ -è(, - msigšfo_t - *, *); - -36 - m__sigaùiÚ_hªdËr -; - -37  - #§_hªdËr - -__sigaùiÚ_hªdËr -. -§_hªdËr - - - ) - -38  - #§_sigaùiÚ - -__sigaùiÚ_hªdËr -. -§_sigaùiÚ - - - ) - -40 -__sighªdËr_t - - m§_hªdËr -; - -44 -__sig£t_t - - m§_mask -; - -47  - m§_æags -; - -50 (* - m§_»¡Ü” -) (); - -54  - #SA_NOCLDSTOP - 1 - - ) - -55  - #SA_NOCLDWAIT - 2 - - ) - -56  - #SA_SIGINFO - 4 - - ) - -58 #ià -defšed - -__USE_UNIX98 - || defšed -__USE_MISC - - -59  - #SA_ONSTACK - 0x08000000 - - ) - -60  - #SA_RESTART - 0x10000000 - - ) - -61  - #SA_NODEFER - 0x40000000 - - ) - -63  - #SA_RESETHAND - 0x80000000 - - ) - -65 #ifdeà -__USE_MISC - - -66  - #SA_INTERRUPT - 0x20000000 - - ) - -69  - #SA_NOMASK - -SA_NODEFER - - - ) - -70  - #SA_ONESHOT - -SA_RESETHAND - - - ) - -71  - #SA_STACK - -SA_ONSTACK - - - ) - -75  - #SIG_BLOCK - 0 - - ) - -76  - #SIG_UNBLOCK - 1 - - ) - -77  - #SIG_SETMASK - 2 - - ) - - @/usr/include/bits/sigcontext.h - -19 #iâdeà -_BITS_SIGCONTEXT_H - - -20  - #_BITS_SIGCONTEXT_H - 1 - - ) - -22 #ià! -defšed - -_SIGNAL_H - && !defšed -_SYS_UCONTEXT_H - - -26  - ~ - -28  - s_å»g - - -30  - msignifiÿnd -[4]; - -31  - mexpÚ’t -; - -34  - s_åx»g - - -36  - msignifiÿnd -[4]; - -37  - mexpÚ’t -; - -38  - m·ddšg -[3]; - -41  - s_xmm»g - - -43 -__ušt32_t - - m–em’t -[4]; - -48 #ià -__WORDSIZE - == 32 - -50  - s_å¡©e - - -53 -__ušt32_t - - mcw -; - -54 -__ušt32_t - - msw -; - -55 -__ušt32_t - - mg -; - -56 -__ušt32_t - - moff -; - -57 -__ušt32_t - - mcs£l -; - -58 -__ušt32_t - - md©aoff -; - -59 -__ušt32_t - - md©a£l -; - -60  -_å»g - - m_¡ -[8]; - -61  - m¡©us -; - -62  - mmagic -; - -65 -__ušt32_t - - m_fx¤_’v -[6]; - -66 -__ušt32_t - - mmxc¤ -; - -67 -__ušt32_t - - m»£rved -; - -68  -_åx»g - - m_fx¤_¡ -[8]; - -69  -_xmm»g - - m_xmm -[8]; - -70 -__ušt32_t - - m·ddšg -[56]; - -73 #iâdeà -sigcÚ‹xt_¡ruù - - -78  - #sigcÚ‹xt_¡ruù - -sigcÚ‹xt - - - ) - -81  - ssigcÚ‹xt - - -83  - mgs -, - m__gsh -; - -84  - mfs -, - m__fsh -; - -85  - mes -, - m__esh -; - -86  - mds -, - m__dsh -; - -87  - medi -; - -88  - mesi -; - -89  - mebp -; - -90  - me¥ -; - -91  - mebx -; - -92  - medx -; - -93  - mecx -; - -94  - m—x -; - -95  - mŒ­no -; - -96  - m”r -; - -97  - me -; - -98  - mcs -, - m__csh -; - -99  - meæags -; - -100  - me¥_©_sigÇl -; - -101  - mss -, - m__ssh -; - -102  -_å¡©e - * - må¡©e -; - -103  - mÞdmask -; - -104  - mü2 -; - -109  - s_å¡©e - - -112 -__ušt16_t - - mcwd -; - -113 -__ušt16_t - - mswd -; - -114 -__ušt16_t - - máw -; - -115 -__ušt16_t - - mfÝ -; - -116 -__ušt64_t - - mr -; - -117 -__ušt64_t - - mrdp -; - -118 -__ušt32_t - - mmxc¤ -; - -119 -__ušt32_t - - mmxü_mask -; - -120  -_åx»g - - m_¡ -[8]; - -121  -_xmm»g - - m_xmm -[16]; - -122 -__ušt32_t - - m·ddšg -[24]; - -125  - ssigcÚ‹xt - - -127  - mr8 -; - -128  - mr9 -; - -129  - mr10 -; - -130  - mr11 -; - -131  - mr12 -; - -132  - mr13 -; - -133  - mr14 -; - -134  - mr15 -; - -135  - mrdi -; - -136  - mrsi -; - -137  - mrbp -; - -138  - mrbx -; - -139  - mrdx -; - -140  - m¿x -; - -141  - mrcx -; - -142  - mr¥ -; - -143  - mr -; - -144  - meæags -; - -145  - mcs -; - -146  - mgs -; - -147  - mfs -; - -148  - m__·d0 -; - -149  - m”r -; - -150  - mŒ­no -; - -151  - mÞdmask -; - -152  - mü2 -; - -153  -_å¡©e - * - må¡©e -; - -154  - m__»£rved1 - [8]; - - @/usr/include/bits/siginfo.h - -20 #ià! -defšed - -_SIGNAL_H - && !defšed -__Ãed_sigšfo_t - \ - -21 && ! -defšed - - g__Ãed_sigev’t_t - - -25  - ~ - -27 #ià(! -defšed - -__have_sigv®_t - \ - -28 && ( -defšed - - g_SIGNAL_H - || defšed - g__Ãed_sigšfo_t - \ - -29 || -defšed - - g__Ãed_sigev’t_t -)) - -30  - #__have_sigv®_t - 1 - - ) - -33  - usigv® - - -35  - msiv®_št -; - -36 * - msiv®_±r -; - -37 } - tsigv®_t -; - -40 #ià(! -defšed - -__have_sigšfo_t - \ - -41 && ( -defšed - - g_SIGNAL_H - || defšed - g__Ãed_sigšfo_t -)) - -42  - #__have_sigšfo_t - 1 - - ) - -44  - #__SI_MAX_SIZE - 128 - - ) - -45 #ià -__WORDSIZE - == 64 - -46  - #__SI_PAD_SIZE - (( -__SI_MAX_SIZE - /  ()è- 4) - - ) - -48  - #__SI_PAD_SIZE - (( -__SI_MAX_SIZE - /  ()è- 3) - - ) - -51  - ssigšfo - - -53  - msi_signo -; - -54  - msi_”ºo -; - -56  - msi_code -; - -60  - m_·d -[ -__SI_PAD_SIZE -]; - -65 -__pid_t - - msi_pid -; - -66 -__uid_t - - msi_uid -; - -67 } - m_kžl -; - -72  - msi_tid -; - -73  - msi_ov”run -; - -74 -sigv®_t - - msi_sigv® -; - -75 } - m_tim” -; - -80 -__pid_t - - msi_pid -; - -81 -__uid_t - - msi_uid -; - -82 -sigv®_t - - msi_sigv® -; - -83 } - m_¹ -; - -88 -__pid_t - - msi_pid -; - -89 -__uid_t - - msi_uid -; - -90  - msi_¡©us -; - -91 -__þock_t - - msi_utime -; - -92 -__þock_t - - msi_¡ime -; - -93 } - m_sigchld -; - -98 * - msi_addr -; - -99 } - m_sigçuÉ -; - -104  - msi_bªd -; - -105  - msi_fd -; - -106 } - m_sigpÞl -; - -107 } - m_sif›lds -; - -108 } - tsigšfo_t -; - -112  - #si_pid - -_sif›lds -. -_kžl -. -si_pid - - - ) - -113  - #si_uid - -_sif›lds -. -_kžl -. -si_uid - - - ) - -114  - #si_tim”id - -_sif›lds -. -_tim” -. -si_tid - - - ) - -115  - #si_ov”run - -_sif›lds -. -_tim” -. -si_ov”run - - - ) - -116  - #si_¡©us - -_sif›lds -. -_sigchld -. -si_¡©us - - - ) - -117  - #si_utime - -_sif›lds -. -_sigchld -. -si_utime - - - ) - -118  - #si_¡ime - -_sif›lds -. -_sigchld -. -si_¡ime - - - ) - -119  - #si_v®ue - -_sif›lds -. -_¹ -. -si_sigv® - - - ) - -120  - #si_št - -_sif›lds -. -_¹ -. -si_sigv® -. -siv®_št - - - ) - -121  - #si_±r - -_sif›lds -. -_¹ -. -si_sigv® -. -siv®_±r - - - ) - -122  - #si_addr - -_sif›lds -. -_sigçuÉ -. -si_addr - - - ) - -123  - #si_bªd - -_sif›lds -. -_sigpÞl -. -si_bªd - - - ) - -124  - #si_fd - -_sif›lds -. -_sigpÞl -. -si_fd - - - ) - -131 - mSI_ASYNCNL - = -60, - -132  - #SI_ASYNCNL - -SI_ASYNCNL - - - ) - -133 - mSI_TKILL - = -6, - -134  - #SI_TKILL - -SI_TKILL - - - ) - -135 - mSI_SIGIO -, - -136  - #SI_SIGIO - -SI_SIGIO - - - ) - -137 - mSI_ASYNCIO -, - -138  - #SI_ASYNCIO - -SI_ASYNCIO - - - ) - -139 - mSI_MESGQ -, - -140  - #SI_MESGQ - -SI_MESGQ - - - ) - -141 - mSI_TIMER -, - -142  - #SI_TIMER - -SI_TIMER - - - ) - -143 - mSI_QUEUE -, - -144  - #SI_QUEUE - -SI_QUEUE - - - ) - -145 - mSI_USER -, - -146  - #SI_USER - -SI_USER - - - ) - -147 - mSI_KERNEL - = 0x80 - -148  - #SI_KERNEL - -SI_KERNEL - - - ) - -155 - mILL_ILLOPC - = 1, - -156  - #ILL_ILLOPC - -ILL_ILLOPC - - - ) - -157 - mILL_ILLOPN -, - -158  - #ILL_ILLOPN - -ILL_ILLOPN - - - ) - -159 - mILL_ILLADR -, - -160  - #ILL_ILLADR - -ILL_ILLADR - - - ) - -161 - mILL_ILLTRP -, - -162  - #ILL_ILLTRP - -ILL_ILLTRP - - - ) - -163 - mILL_PRVOPC -, - -164  - #ILL_PRVOPC - -ILL_PRVOPC - - - ) - -165 - mILL_PRVREG -, - -166  - #ILL_PRVREG - -ILL_PRVREG - - - ) - -167 - mILL_COPROC -, - -168  - #ILL_COPROC - -ILL_COPROC - - - ) - -169 - mILL_BADSTK - - -170  - #ILL_BADSTK - -ILL_BADSTK - - - ) - -176 - mFPE_INTDIV - = 1, - -177  - #FPE_INTDIV - -FPE_INTDIV - - - ) - -178 - mFPE_INTOVF -, - -179  - #FPE_INTOVF - -FPE_INTOVF - - - ) - -180 - mFPE_FLTDIV -, - -181  - #FPE_FLTDIV - -FPE_FLTDIV - - - ) - -182 - mFPE_FLTOVF -, - -183  - #FPE_FLTOVF - -FPE_FLTOVF - - - ) - -184 - mFPE_FLTUND -, - -185  - #FPE_FLTUND - -FPE_FLTUND - - - ) - -186 - mFPE_FLTRES -, - -187  - #FPE_FLTRES - -FPE_FLTRES - - - ) - -188 - mFPE_FLTINV -, - -189  - #FPE_FLTINV - -FPE_FLTINV - - - ) - -190 - mFPE_FLTSUB - - -191  - #FPE_FLTSUB - -FPE_FLTSUB - - - ) - -197 - mSEGV_MAPERR - = 1, - -198  - #SEGV_MAPERR - -SEGV_MAPERR - - - ) - -199 - mSEGV_ACCERR - - -200  - #SEGV_ACCERR - -SEGV_ACCERR - - - ) - -206 - mBUS_ADRALN - = 1, - -207  - #BUS_ADRALN - -BUS_ADRALN - - - ) - -208 - mBUS_ADRERR -, - -209  - #BUS_ADRERR - -BUS_ADRERR - - - ) - -210 - mBUS_OBJERR - - -211  - #BUS_OBJERR - -BUS_OBJERR - - - ) - -217 - mTRAP_BRKPT - = 1, - -218  - #TRAP_BRKPT - -TRAP_BRKPT - - - ) - -219 - mTRAP_TRACE - - -220  - #TRAP_TRACE - -TRAP_TRACE - - - ) - -226 - mCLD_EXITED - = 1, - -227  - #CLD_EXITED - -CLD_EXITED - - - ) - -228 - mCLD_KILLED -, - -229  - #CLD_KILLED - -CLD_KILLED - - - ) - -230 - mCLD_DUMPED -, - -231  - #CLD_DUMPED - -CLD_DUMPED - - - ) - -232 - mCLD_TRAPPED -, - -233  - #CLD_TRAPPED - -CLD_TRAPPED - - - ) - -234 - mCLD_STOPPED -, - -235  - #CLD_STOPPED - -CLD_STOPPED - - - ) - -236 - mCLD_CONTINUED - - -237  - #CLD_CONTINUED - -CLD_CONTINUED - - - ) - -243 - mPOLL_IN - = 1, - -244  - #POLL_IN - -POLL_IN - - - ) - -245 - mPOLL_OUT -, - -246  - #POLL_OUT - -POLL_OUT - - - ) - -247 - mPOLL_MSG -, - -248  - #POLL_MSG - -POLL_MSG - - - ) - -249 - mPOLL_ERR -, - -250  - #POLL_ERR - -POLL_ERR - - - ) - -251 - mPOLL_PRI -, - -252  - #POLL_PRI - -POLL_PRI - - - ) - -253 - mPOLL_HUP - - -254  - #POLL_HUP - -POLL_HUP - - - ) - -257 #undeà -__Ãed_sigšfo_t - - -261 #ià( -defšed - -_SIGNAL_H - || defšed -__Ãed_sigev’t_t -) \ - -262 && ! -defšed - - g__have_sigev’t_t - - -263  - #__have_sigev’t_t - 1 - - ) - -266  - #__SIGEV_MAX_SIZE - 64 - - ) - -267 #ià -__WORDSIZE - == 64 - -268  - #__SIGEV_PAD_SIZE - (( -__SIGEV_MAX_SIZE - /  ()è- 4) - - ) - -270  - #__SIGEV_PAD_SIZE - (( -__SIGEV_MAX_SIZE - /  ()è- 3) - - ) - -273  - ssigev’t - - -275 -sigv®_t - - msigev_v®ue -; - -276  - msigev_signo -; - -277  - msigev_nÙify -; - -281  - m_·d -[ -__SIGEV_PAD_SIZE -]; - -285 -__pid_t - - m_tid -; - -289 (* - m_funùiÚ -è( - msigv®_t -); - -290 * - m_©Œibu‹ -; - -291 } - m_sigev_th»ad -; - -292 } - m_sigev_un -; - -293 } - tsigev’t_t -; - -296  - #sigev_nÙify_funùiÚ - -_sigev_un -. -_sigev_th»ad -. -_funùiÚ - - - ) - -297  - #sigev_nÙify_©Œibu‹s - -_sigev_un -. -_sigev_th»ad -. -_©Œibu‹ - - - ) - -302 - mSIGEV_SIGNAL - = 0, - -303  - #SIGEV_SIGNAL - -SIGEV_SIGNAL - - - ) - -304 - mSIGEV_NONE -, - -305  - #SIGEV_NONE - -SIGEV_NONE - - - ) - -306 - mSIGEV_THREAD -, - -307  - #SIGEV_THREAD - -SIGEV_THREAD - - - ) - -309 - mSIGEV_THREAD_ID - = 4 - -310  - #SIGEV_THREAD_ID - -SIGEV_THREAD_ID - - - ) - - @/usr/include/bits/signum.h - -20 #ifdef -_SIGNAL_H - - -23  - #SIG_ERR - (( -__sighªdËr_t -è-1è - - ) - -24  - #SIG_DFL - (( -__sighªdËr_t -è0è - - ) - -25  - #SIG_IGN - (( -__sighªdËr_t -è1è - - ) - -27 #ifdeà -__USE_UNIX98 - - -28  - #SIG_HOLD - (( -__sighªdËr_t -è2è - - ) - -33  - #SIGHUP - 1 - - ) - -34  - #SIGINT - 2 - - ) - -35  - #SIGQUIT - 3 - - ) - -36  - #SIGILL - 4 - - ) - -37  - #SIGTRAP - 5 - - ) - -38  - #SIGABRT - 6 - - ) - -39  - #SIGIOT - 6 - - ) - -40  - #SIGBUS - 7 - - ) - -41  - #SIGFPE - 8 - - ) - -42  - #SIGKILL - 9 - - ) - -43  - #SIGUSR1 - 10 - - ) - -44  - #SIGSEGV - 11 - - ) - -45  - #SIGUSR2 - 12 - - ) - -46  - #SIGPIPE - 13 - - ) - -47  - #SIGALRM - 14 - - ) - -48  - #SIGTERM - 15 - - ) - -49  - #SIGSTKFLT - 16 - - ) - -50  - #SIGCLD - -SIGCHLD - - - ) - -51  - #SIGCHLD - 17 - - ) - -52  - #SIGCONT - 18 - - ) - -53  - #SIGSTOP - 19 - - ) - -54  - #SIGTSTP - 20 - - ) - -55  - #SIGTTIN - 21 - - ) - -56  - #SIGTTOU - 22 - - ) - -57  - #SIGURG - 23 - - ) - -58  - #SIGXCPU - 24 - - ) - -59  - #SIGXFSZ - 25 - - ) - -60  - #SIGVTALRM - 26 - - ) - -61  - #SIGPROF - 27 - - ) - -62  - #SIGWINCH - 28 - - ) - -63  - #SIGPOLL - -SIGIO - - - ) - -64  - #SIGIO - 29 - - ) - -65  - #SIGPWR - 30 - - ) - -66  - #SIGSYS - 31 - - ) - -67  - #SIGUNUSED - 31 - - ) - -69  - #_NSIG - 65 - - ) - -72  - #SIGRTMIN - ( - `__libc_cu¼’t_sig¹mš - ()) - - ) - -73  - #SIGRTMAX - ( - `__libc_cu¼’t_sig¹max - ()) - - ) - -77  - #__SIGRTMIN - 32 - - ) - -78  - #__SIGRTMAX - ( -_NSIG - - 1) - - ) - - @/usr/include/bits/sigstack.h - -20 #iâdeà -_SIGNAL_H - - -26  - ssig¡ack - - -28 * - mss_¥ -; - -29  - mss_Ú¡ack -; - -36 - mSS_ONSTACK - = 1, - -37  - #SS_ONSTACK - -SS_ONSTACK - - - ) - -38 - mSS_DISABLE - - -39  - #SS_DISABLE - -SS_DISABLE - - - ) - -43  - #MINSIGSTKSZ - 2048 - - ) - -46  - #SIGSTKSZ - 8192 - - ) - -50  - ssig®t¡ack - - -52 * - mss_¥ -; - -53  - mss_æags -; - -54 -size_t - - mss_size -; - -55 } - t¡ack_t -; - - @/usr/include/bits/sigthread.h - -20 #iâdeà -_BITS_SIGTHREAD_H - - -21  - #_BITS_SIGTHREAD_H - 1 - - ) - -23 #ià! -defšed - -_SIGNAL_H - && !defšed -_PTHREAD_H - - -31  - $±h»ad_sigmask - ( -__how -, - -32 -__cÚ¡ - -__sig£t_t - * -__»¡riù - -__Ãwmask -, - -33 -__sig£t_t - * -__»¡riù - -__Þdmask -) -__THROW -; - -36  - $±h»ad_kžl - ( -±h»ad_t - -__th»adid -,  -__signo -è -__THROW -; - -38 #ifdeà -__USE_GNU - - -40  - $±h»ad_sigqueue - ( -±h»ad_t - -__th»adid -,  -__signo -, - -41 cÚ¡  -sigv® - -__v®ue -è -__THROW -; - - @/usr/include/linux/errno.h - -1 #iâdeà -_LINUX_ERRNO_H - - -2  - #_LINUX_ERRNO_H - - - ) - -4  - ~ - - @/usr/include/sys/ucontext.h - -19 #iâdeà -_SYS_UCONTEXT_H - - -20  - #_SYS_UCONTEXT_H - 1 - - ) - -22  - ~<ã©u»s.h -> - -23  - ~ - -24  - ~ - -28  - ~ - -30 #ià -__WORDSIZE - == 64 - -33  - tg»g_t -; - -36  - #NGREG - 23 - - ) - -39  -g»g_t - - tg»g£t_t -[ -NGREG -]; - -41 #ifdeà -__USE_GNU - - -45 - mREG_R8 - = 0, - -46  - #REG_R8 - -REG_R8 - - - ) - -47 - mREG_R9 -, - -48  - #REG_R9 - -REG_R9 - - - ) - -49 - mREG_R10 -, - -50  - #REG_R10 - -REG_R10 - - - ) - -51 - mREG_R11 -, - -52  - #REG_R11 - -REG_R11 - - - ) - -53 - mREG_R12 -, - -54  - #REG_R12 - -REG_R12 - - - ) - -55 - mREG_R13 -, - -56  - #REG_R13 - -REG_R13 - - - ) - -57 - mREG_R14 -, - -58  - #REG_R14 - -REG_R14 - - - ) - -59 - mREG_R15 -, - -60  - #REG_R15 - -REG_R15 - - - ) - -61 - mREG_RDI -, - -62  - #REG_RDI - -REG_RDI - - - ) - -63 - mREG_RSI -, - -64  - #REG_RSI - -REG_RSI - - - ) - -65 - mREG_RBP -, - -66  - #REG_RBP - -REG_RBP - - - ) - -67 - mREG_RBX -, - -68  - #REG_RBX - -REG_RBX - - - ) - -69 - mREG_RDX -, - -70  - #REG_RDX - -REG_RDX - - - ) - -71 - mREG_RAX -, - -72  - #REG_RAX - -REG_RAX - - - ) - -73 - mREG_RCX -, - -74  - #REG_RCX - -REG_RCX - - - ) - -75 - mREG_RSP -, - -76  - #REG_RSP - -REG_RSP - - - ) - -77 - mREG_RIP -, - -78  - #REG_RIP - -REG_RIP - - - ) - -79 - mREG_EFL -, - -80  - #REG_EFL - -REG_EFL - - - ) - -81 - mREG_CSGSFS -, - -82  - #REG_CSGSFS - -REG_CSGSFS - - - ) - -83 - mREG_ERR -, - -84  - #REG_ERR - -REG_ERR - - - ) - -85 - mREG_TRAPNO -, - -86  - #REG_TRAPNO - -REG_TRAPNO - - - ) - -87 - mREG_OLDMASK -, - -88  - #REG_OLDMASK - -REG_OLDMASK - - - ) - -89 - mREG_CR2 - - -90  - #REG_CR2 - -REG_CR2 - - - ) - -94  - s_libc_åx»g - - -96  - msignifiÿnd -[4]; - -97  - mexpÚ’t -; - -98  - m·ddšg -[3]; - -101  - s_libc_xmm»g - - -103 -__ušt32_t - - m–em’t -[4]; - -106  - s_libc_å¡©e - - -109 -__ušt16_t - - mcwd -; - -110 -__ušt16_t - - mswd -; - -111 -__ušt16_t - - máw -; - -112 -__ušt16_t - - mfÝ -; - -113 -__ušt64_t - - mr -; - -114 -__ušt64_t - - mrdp -; - -115 -__ušt32_t - - mmxc¤ -; - -116 -__ušt32_t - - mmxü_mask -; - -117  -_libc_åx»g - - m_¡ -[8]; - -118  -_libc_xmm»g - - m_xmm -[16]; - -119 -__ušt32_t - - m·ddšg -[24]; - -123  -_libc_å¡©e - * - tå»g£t_t -; - -128 -g»g£t_t - - mg»gs -; - -130 -å»g£t_t - - må»gs -; - -131  - m__»£rved1 - [8]; - -132 } - tmcÚ‹xt_t -; - -135  - sucÚ‹xt - - -137  - muc_æags -; - -138  -ucÚ‹xt - * - muc_lšk -; - -139 -¡ack_t - - muc_¡ack -; - -140 -mcÚ‹xt_t - - muc_mcÚ‹xt -; - -141 -__sig£t_t - - muc_sigmask -; - -142  -_libc_å¡©e - - m__å»gs_mem -; - -143 } - tucÚ‹xt_t -; - -148  - tg»g_t -; - -151  - #NGREG - 19 - - ) - -154  -g»g_t - - tg»g£t_t -[ -NGREG -]; - -156 #ifdeà -__USE_GNU - - -160 - mREG_GS - = 0, - -161  - #REG_GS - -REG_GS - - - ) - -162 - mREG_FS -, - -163  - #REG_FS - -REG_FS - - - ) - -164 - mREG_ES -, - -165  - #REG_ES - -REG_ES - - - ) - -166 - mREG_DS -, - -167  - #REG_DS - -REG_DS - - - ) - -168 - mREG_EDI -, - -169  - #REG_EDI - -REG_EDI - - - ) - -170 - mREG_ESI -, - -171  - #REG_ESI - -REG_ESI - - - ) - -172 - mREG_EBP -, - -173  - #REG_EBP - -REG_EBP - - - ) - -174 - mREG_ESP -, - -175  - #REG_ESP - -REG_ESP - - - ) - -176 - mREG_EBX -, - -177  - #REG_EBX - -REG_EBX - - - ) - -178 - mREG_EDX -, - -179  - #REG_EDX - -REG_EDX - - - ) - -180 - mREG_ECX -, - -181  - #REG_ECX - -REG_ECX - - - ) - -182 - mREG_EAX -, - -183  - #REG_EAX - -REG_EAX - - - ) - -184 - mREG_TRAPNO -, - -185  - #REG_TRAPNO - -REG_TRAPNO - - - ) - -186 - mREG_ERR -, - -187  - #REG_ERR - -REG_ERR - - - ) - -188 - mREG_EIP -, - -189  - #REG_EIP - -REG_EIP - - - ) - -190 - mREG_CS -, - -191  - #REG_CS - -REG_CS - - - ) - -192 - mREG_EFL -, - -193  - #REG_EFL - -REG_EFL - - - ) - -194 - mREG_UESP -, - -195  - #REG_UESP - -REG_UESP - - - ) - -196 - mREG_SS - - -197  - #REG_SS - -REG_SS - - - ) - -202  - s_libc_å»g - - -204  - msignifiÿnd -[4]; - -205  - mexpÚ’t -; - -208  - s_libc_å¡©e - - -210  - mcw -; - -211  - msw -; - -212  - mg -; - -213  - moff -; - -214  - mcs£l -; - -215  - md©aoff -; - -216  - md©a£l -; - -217  -_libc_å»g - - m_¡ -[8]; - -218  - m¡©us -; - -222  -_libc_å¡©e - * - tå»g£t_t -; - -227 -g»g£t_t - - mg»gs -; - -230 -å»g£t_t - - må»gs -; - -231  - mÞdmask -; - -232  - mü2 -; - -233 } - tmcÚ‹xt_t -; - -236  - sucÚ‹xt - - -238  - muc_æags -; - -239  -ucÚ‹xt - * - muc_lšk -; - -240 -¡ack_t - - muc_¡ack -; - -241 -mcÚ‹xt_t - - muc_mcÚ‹xt -; - -242 -__sig£t_t - - muc_sigmask -; - -243  -_libc_å¡©e - - m__å»gs_mem -; - -244 } - tucÚ‹xt_t -; - - @/usr/include/asm/errno.h - -1  - ~ - - @/usr/include/asm-generic/errno.h - -1 #iâdeà -_ASM_GENERIC_ERRNO_H - - -2  - #_ASM_GENERIC_ERRNO_H - - - ) - -4  - ~ - -6  - #EDEADLK - 35 - - ) - -7  - #ENAMETOOLONG - 36 - - ) - -8  - #ENOLCK - 37 - - ) - -9  - #ENOSYS - 38 - - ) - -10  - #ENOTEMPTY - 39 - - ) - -11  - #ELOOP - 40 - - ) - -12  - #EWOULDBLOCK - -EAGAIN - - - ) - -13  - #ENOMSG - 42 - - ) - -14  - #EIDRM - 43 - - ) - -15  - #ECHRNG - 44 - - ) - -16  - #EL2NSYNC - 45 - - ) - -17  - #EL3HLT - 46 - - ) - -18  - #EL3RST - 47 - - ) - -19  - #ELNRNG - 48 - - ) - -20  - #EUNATCH - 49 - - ) - -21  - #ENOCSI - 50 - - ) - -22  - #EL2HLT - 51 - - ) - -23  - #EBADE - 52 - - ) - -24  - #EBADR - 53 - - ) - -25  - #EXFULL - 54 - - ) - -26  - #ENOANO - 55 - - ) - -27  - #EBADRQC - 56 - - ) - -28  - #EBADSLT - 57 - - ) - -30  - #EDEADLOCK - -EDEADLK - - - ) - -32  - #EBFONT - 59 - - ) - -33  - #ENOSTR - 60 - - ) - -34  - #ENODATA - 61 - - ) - -35  - #ETIME - 62 - - ) - -36  - #ENOSR - 63 - - ) - -37  - #ENONET - 64 - - ) - -38  - #ENOPKG - 65 - - ) - -39  - #EREMOTE - 66 - - ) - -40  - #ENOLINK - 67 - - ) - -41  - #EADV - 68 - - ) - -42  - #ESRMNT - 69 - - ) - -43  - #ECOMM - 70 - - ) - -44  - #EPROTO - 71 - - ) - -45  - #EMULTIHOP - 72 - - ) - -46  - #EDOTDOT - 73 - - ) - -47  - #EBADMSG - 74 - - ) - -48  - #EOVERFLOW - 75 - - ) - -49  - #ENOTUNIQ - 76 - - ) - -50  - #EBADFD - 77 - - ) - -51  - #EREMCHG - 78 - - ) - -52  - #ELIBACC - 79 - - ) - -53  - #ELIBBAD - 80 - - ) - -54  - #ELIBSCN - 81 - - ) - -55  - #ELIBMAX - 82 - - ) - -56  - #ELIBEXEC - 83 - - ) - -57  - #EILSEQ - 84 - - ) - -58  - #ERESTART - 85 - - ) - -59  - #ESTRPIPE - 86 - - ) - -60  - #EUSERS - 87 - - ) - -61  - #ENOTSOCK - 88 - - ) - -62  - #EDESTADDRREQ - 89 - - ) - -63  - #EMSGSIZE - 90 - - ) - -64  - #EPROTOTYPE - 91 - - ) - -65  - #ENOPROTOOPT - 92 - - ) - -66  - #EPROTONOSUPPORT - 93 - - ) - -67  - #ESOCKTNOSUPPORT - 94 - - ) - -68  - #EOPNOTSUPP - 95 - - ) - -69  - #EPFNOSUPPORT - 96 - - ) - -70  - #EAFNOSUPPORT - 97 - - ) - -71  - #EADDRINUSE - 98 - - ) - -72  - #EADDRNOTAVAIL - 99 - - ) - -73  - #ENETDOWN - 100 - - ) - -74  - #ENETUNREACH - 101 - - ) - -75  - #ENETRESET - 102 - - ) - -76  - #ECONNABORTED - 103 - - ) - -77  - #ECONNRESET - 104 - - ) - -78  - #ENOBUFS - 105 - - ) - -79  - #EISCONN - 106 - - ) - -80  - #ENOTCONN - 107 - - ) - -81  - #ESHUTDOWN - 108 - - ) - -82  - #ETOOMANYREFS - 109 - - ) - -83  - #ETIMEDOUT - 110 - - ) - -84  - #ECONNREFUSED - 111 - - ) - -85  - #EHOSTDOWN - 112 - - ) - -86  - #EHOSTUNREACH - 113 - - ) - -87  - #EALREADY - 114 - - ) - -88  - #EINPROGRESS - 115 - - ) - -89  - #ESTALE - 116 - - ) - -90  - #EUCLEAN - 117 - - ) - -91  - #ENOTNAM - 118 - - ) - -92  - #ENAVAIL - 119 - - ) - -93  - #EISNAM - 120 - - ) - -94  - #EREMOTEIO - 121 - - ) - -95  - #EDQUOT - 122 - - ) - -97  - #ENOMEDIUM - 123 - - ) - -98  - #EMEDIUMTYPE - 124 - - ) - -99  - #ECANCELED - 125 - - ) - -100  - #ENOKEY - 126 - - ) - -101  - #EKEYEXPIRED - 127 - - ) - -102  - #EKEYREVOKED - 128 - - ) - -103  - #EKEYREJECTED - 129 - - ) - -106  - #EOWNERDEAD - 130 - - ) - -107  - #ENOTRECOVERABLE - 131 - - ) - -109  - #ERFKILL - 132 - - ) - - @/usr/include/asm-generic/errno-base.h - -1 #iâdeà -_ASM_GENERIC_ERRNO_BASE_H - - -2  - #_ASM_GENERIC_ERRNO_BASE_H - - - ) - -4  - #EPERM - 1 - - ) - -5  - #ENOENT - 2 - - ) - -6  - #ESRCH - 3 - - ) - -7  - #EINTR - 4 - - ) - -8  - #EIO - 5 - - ) - -9  - #ENXIO - 6 - - ) - -10  - #E2BIG - 7 - - ) - -11  - #ENOEXEC - 8 - - ) - -12  - #EBADF - 9 - - ) - -13  - #ECHILD - 10 - - ) - -14  - #EAGAIN - 11 - - ) - -15  - #ENOMEM - 12 - - ) - -16  - #EACCES - 13 - - ) - -17  - #EFAULT - 14 - - ) - -18  - #ENOTBLK - 15 - - ) - -19  - #EBUSY - 16 - - ) - -20  - #EEXIST - 17 - - ) - -21  - #EXDEV - 18 - - ) - -22  - #ENODEV - 19 - - ) - -23  - #ENOTDIR - 20 - - ) - -24  - #EISDIR - 21 - - ) - -25  - #EINVAL - 22 - - ) - -26  - #ENFILE - 23 - - ) - -27  - #EMFILE - 24 - - ) - -28  - #ENOTTY - 25 - - ) - -29  - #ETXTBSY - 26 - - ) - -30  - #EFBIG - 27 - - ) - -31  - #ENOSPC - 28 - - ) - -32  - #ESPIPE - 29 - - ) - -33  - #EROFS - 30 - - ) - -34  - #EMLINK - 31 - - ) - -35  - #EPIPE - 32 - - ) - -36  - #EDOM - 33 - - ) - -37  - #ERANGE - 34 - - ) - - @ -1 -. -1 -/usr/include -87 -2228 -CG.cc -CG_roseBuilder.cc -CG_roseRepr.cc -CG_stringBuilder.cc -CG_stringRepr.cc -CG_suifBuilder.cc -CG_suifRepr.cc -code_gen.cc -output_repr.cc -/usr/include/math.h -/usr/include/stdio.h -/usr/include/string.h -/usr/include/bits/huge_val.h -/usr/include/bits/huge_valf.h -/usr/include/bits/huge_vall.h -/usr/include/bits/inf.h -/usr/include/bits/mathcalls.h -/usr/include/bits/mathdef.h -/usr/include/bits/mathinline.h -/usr/include/bits/nan.h -/usr/include/bits/stdio-ldbl.h -/usr/include/bits/stdio.h -/usr/include/bits/stdio2.h -/usr/include/bits/stdio_lim.h -/usr/include/bits/string.h -/usr/include/bits/string2.h -/usr/include/bits/string3.h -/usr/include/bits/sys_errlist.h -/usr/include/bits/types.h -/usr/include/features.h -/usr/include/getopt.h -/usr/include/libio.h -/usr/include/xlocale.h -/usr/include/_G_config.h -/usr/include/bits/libio-ldbl.h -/usr/include/bits/predefs.h -/usr/include/bits/stdio-lock.h -/usr/include/bits/typesizes.h -/usr/include/bits/wordsize.h -/usr/include/ctype.h -/usr/include/endian.h -/usr/include/gnu/stubs.h -/usr/include/stdlib.h -/usr/include/sys/cdefs.h -/usr/include/alloca.h -/usr/include/bits/byteswap.h -/usr/include/bits/endian.h -/usr/include/bits/libc-lock.h -/usr/include/bits/stdlib-ldbl.h -/usr/include/bits/stdlib.h -/usr/include/bits/waitflags.h -/usr/include/bits/waitstatus.h -/usr/include/gconv.h -/usr/include/gnu/stubs-32.h -/usr/include/gnu/stubs-64.h -/usr/include/sys/types.h -/usr/include/wchar.h -/usr/include/bits/pthreadtypes.h -/usr/include/bits/wchar-ldbl.h -/usr/include/bits/wchar.h -/usr/include/bits/wchar2.h -/usr/include/errno.h -/usr/include/gnu/option-groups.h -/usr/include/pthread.h -/usr/include/sys/select.h -/usr/include/sys/sysmacros.h -/usr/include/time.h -/usr/include/wctype.h -/usr/include/bits/errno.h -/usr/include/bits/select.h -/usr/include/bits/setjmp.h -/usr/include/bits/sigset.h -/usr/include/bits/time.h -/usr/include/sched.h -/usr/include/signal.h -/usr/include/bits/sched.h -/usr/include/bits/sigaction.h -/usr/include/bits/sigcontext.h -/usr/include/bits/siginfo.h -/usr/include/bits/signum.h -/usr/include/bits/sigstack.h -/usr/include/bits/sigthread.h -/usr/include/linux/errno.h -/usr/include/sys/ucontext.h -/usr/include/asm/errno.h -/usr/include/asm-generic/errno.h -/usr/include/asm-generic/errno-base.h diff --git a/omega/code_gen/src/output_repr.cc b/omega/code_gen/src/output_repr.cc deleted file mode 100644 index 955cc14..0000000 --- a/omega/code_gen/src/output_repr.cc +++ /dev/null @@ -1,1931 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 University of Maryland - Copyright (C) 2008 University of Southern California - Copyright (C) 2009-2010 University of Utah - All Rights Reserved. - - Purpose: - utility functions for outputing CG_outputReprs - - Notes: - - History: - 07/30/10 collect various code outputing into one place, by Chun Chen -*****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include - -namespace omega { - -extern Tuple > projected_nIS; -int var_substitution_threshold = 100; -//protonu. -extern int upperBoundForLevel; -extern int lowerBoundForLevel; -extern bool fillInBounds; -//end--protonu. - -} - - -namespace omega { - -std::pair find_simplest_assignment(const Relation &R_, Variable_ID v, const std::vector &assigned_on_the_fly); - - -namespace { - - - - -void get_stride(const Constraint_Handle &h, Variable_ID &wc, coef_t &step){ - wc = 0; - for(Constr_Vars_Iter i(h,true); i; i++) { - assert(wc == 0); - wc = (*i).var; - step = ((*i).coef); - } -} - -} - -CG_outputRepr* outputIdent(CG_outputBuilder* ocg, const Relation &R_, Variable_ID v, const std::vector &assigned_on_the_fly) { - Relation &R = const_cast(R_); - - switch (v->kind()) { - case Set_Var: { - int pos = v->get_position(); - if (assigned_on_the_fly[pos-1] != NULL) - return assigned_on_the_fly[pos-1]->clone(); - else - return ocg->CreateIdent(v->name()); - break; - } - case Global_Var: { - if (v->get_global_var()->arity() == 0) - return ocg->CreateIdent(v->name()); - else { - /* This should be improved to take into account the possible elimination - of the set variables. */ - int arity = v->get_global_var()->arity(); - //assert(arity <= last_level); - Tuple argList; - // Relation R = Relation::True(arity); - - // name_codegen_vars(R); // easy way to make sure the names are correct. - for(int i = 1; i <= arity; i++) - argList.append(ocg->CreateIdent(R.set_var(i)->name())); - CG_outputRepr *call = ocg->CreateInvoke(v->get_global_var()->base_name(), argList); - return call; - } - break; - } - default: - throw std::invalid_argument("wrong variable type"); - } -} - - -//---------------------------------------------------------------------------- -// Translate equality constraints to if-condition and assignment. -// return.first is right-hand-side of assignment, return.second -// is true if assignment is required. -// -- by chun 07/29/2010 -// ---------------------------------------------------------------------------- -std::pair outputAssignment(CG_outputBuilder *ocg, const Relation &R_, Variable_ID v, Relation &enforced, CG_outputRepr *&if_repr, const std::vector &assigned_on_the_fly) { - Relation &R = const_cast(R_); - - Conjunct *c = R.query_DNF()->single_conjunct(); - - // check whether to generate if-conditions from equality constraints - for (EQ_Iterator ei(c); ei; ei++) - if (!(*ei).has_wildcards() && abs((*ei).get_coef(v)) > 1) { - Relation r(R.n_set()); - F_And *f_super_root = r.add_and(); - F_Exists *fe = f_super_root->add_exists(); - Variable_ID e = fe->declare(); - F_And *f_root = fe->add_and(); - EQ_Handle h = f_root->add_EQ(); - for (Constr_Vars_Iter cvi(*ei); cvi; cvi++) - switch ((*cvi).var->kind()) { - case Input_Var: { - if ((*cvi).var == v) - h.update_coef(e, (*cvi).coef); - else - h.update_coef(r.set_var((*cvi).var->get_position()), (*cvi).coef); - break; - } - case Global_Var: { - Global_Var_ID g = (*cvi).var->get_global_var(); - Variable_ID v2; - if (g->arity() == 0) - v2 = r.get_local(g); - else - v2 = r.get_local(g, (*cvi).var->function_of()); - h.update_coef(v2, (*cvi).coef); - break; - } - default: - assert(0); - } - h.update_const((*ei).get_const()); - - r.copy_names(R); - r.setup_names(); - - // need if-condition to make sure this loop variable has integer value - if (!Gist(r, copy(enforced), 1).is_obvious_tautology()) { - coef_t coef = (*ei).get_coef(v); - coef_t sign = -((coef>0)?1:-1); - coef = abs(coef); - - CG_outputRepr *term = NULL; - for (Constr_Vars_Iter cvi(*ei); cvi; cvi++) - if ((*cvi).var != v) { - CG_outputRepr *varRepr = outputIdent(ocg, R, (*cvi).var, assigned_on_the_fly); - coef_t t = sign*(*cvi).coef; - if (t == 1) - term = ocg->CreatePlus(term, varRepr); - else if (t == -1) - term = ocg->CreateMinus(term, varRepr); - else if (t > 0) - term = ocg->CreatePlus(term, ocg->CreateTimes(ocg->CreateInt(t), varRepr)); - else if (t < 0) - term = ocg->CreateMinus(term, ocg->CreateTimes(ocg->CreateInt(-t), varRepr)); - } - coef_t t = sign*(*ei).get_const(); - if (t > 0) - term = ocg->CreatePlus(term, ocg->CreateInt(t)); - else if (t < 0) - term = ocg->CreateMinus(term, ocg->CreateInt(-t)); - - term = ocg->CreateIntegerMod(term, ocg->CreateInt(coef)); - term = ocg->CreateEQ(term, ocg->CreateInt(0)); - - if_repr = ocg->CreateAnd(if_repr, term); - } - - enforced.and_with_EQ(*ei); - enforced.simplify(); - } - - // find the simplest assignment - std::pair a = find_simplest_assignment(R, v, assigned_on_the_fly); - - // now generate assignment - if (a.second < INT_MAX) { - EQ_Handle eq = a.first; - CG_outputRepr *rop_repr = NULL; - - coef_t divider = eq.get_coef(v); - int sign = 1; - if (divider < 0) { - divider = -divider; - sign = -1; - } - - for (Constr_Vars_Iter cvi(eq); cvi; cvi++) - if ((*cvi).var != v) { - CG_outputRepr *var_repr = outputIdent(ocg, R, (*cvi).var, assigned_on_the_fly); - coef_t coef = (*cvi).coef; - if (-sign * coef == -1) - rop_repr = ocg->CreateMinus(rop_repr, var_repr); - else if (-sign * coef < -1) - rop_repr = ocg->CreateMinus(rop_repr, ocg->CreateTimes(ocg->CreateInt(sign * coef), var_repr)); - else if (-sign * coef == 1) - rop_repr = ocg->CreatePlus(rop_repr, var_repr); - else // -sign * coef > 1 - rop_repr = ocg->CreatePlus(rop_repr, ocg->CreateTimes(ocg->CreateInt(-sign * coef), var_repr)); - } - - coef_t c_term = -(eq.get_const() * sign); - - if (c_term > 0) - rop_repr = ocg->CreatePlus(rop_repr, ocg->CreateInt(c_term)); - else if (c_term < 0) - rop_repr = ocg->CreateMinus(rop_repr, ocg->CreateInt(-c_term)); - else if (rop_repr == NULL) - rop_repr = ocg->CreateInt(0); - - if (divider != 1) - rop_repr = ocg->CreateIntegerDivide(rop_repr, ocg->CreateInt(divider)); - - enforced.and_with_EQ(eq); - enforced.simplify(); - - if (a.second > var_substitution_threshold) - return std::make_pair(rop_repr, true); - else - return std::make_pair(rop_repr, false); - } - else - return std::make_pair(static_cast(NULL), false); -} - - -//---------------------------------------------------------------------------- -// Don't use Substitutions class since it can't handle integer -// division. Instead, use relation mapping to a single output -// variable to get substitution. -- by chun, 07/19/2007 -//---------------------------------------------------------------------------- -Tuple outputSubstitution(CG_outputBuilder* ocg, const Relation &R_, const std::vector &assigned_on_the_fly) { - Relation &R = const_cast(R_); - - const int n = R.n_out(); - Tuple oReprList; - - // Find substitution for each output variable - for (int i = 1; i <= n; i++) { - Relation mapping(n, 1); - F_And *f_root = mapping.add_and(); - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.output_var(1), 1); - h.update_coef(mapping.input_var(i), -1); - - Relation S = Composition(mapping, copy(R)); - - std::pair a = find_simplest_assignment(S, S.output_var(1), assigned_on_the_fly); - - if (a.second < INT_MAX) { - while (a.second > 0) { - EQ_Handle eq = a.first; - std::set candidates; - for (Constr_Vars_Iter cvi(eq); cvi; cvi++) - if ((*cvi).var->kind() == Input_Var) - candidates.insert((*cvi).var->get_position()); - - bool changed = false; - for (std::set::iterator j = candidates.begin(); j != candidates.end(); j++) { - Relation S2 = Project(copy(S), *j, Input_Var); - std::pair a2 = find_simplest_assignment(S2, S2.output_var(1), assigned_on_the_fly); - if (a2.second <= a.second) { - S = S2; - a = a2; - changed = true; - break; - } - } - if (!changed) - break; - } - } - - if (a.second < INT_MAX) { - CG_outputRepr *repr = NULL; - EQ_Handle eq = a.first; - Variable_ID v = S.output_var(1); - - for (int j = 1; j <= S.n_inp(); j++) - S.name_input_var(j, R.input_var(j)->name()); - S.setup_names(); - - int d = eq.get_coef(v); - assert(d != 0); - int sign = (d>0)?-1:1; - d = -sign * d; - for (Constr_Vars_Iter cvi(eq); cvi; cvi++) - if ((*cvi).var != v) { - int coef = sign * (*cvi).coef; - CG_outputRepr *op = outputIdent(ocg, S, (*cvi).var, assigned_on_the_fly); - if (coef > 1) - op = ocg->CreateTimes(ocg->CreateInt(coef), op); - else if (coef < -1) - op = ocg->CreateTimes(ocg->CreateInt(-coef), op); - if (coef > 0) - repr = ocg->CreatePlus(repr, op); - else if (coef < 0) - repr = ocg->CreateMinus(repr, op); - } - - int c = sign * eq.get_const(); - if (c > 0) - repr = ocg->CreatePlus(repr, ocg->CreateInt(c)); - else if (c < 0) - repr = ocg->CreateMinus(repr, ocg->CreateInt(-c)); - else if (repr == NULL) - repr = ocg->CreateInt(0); - - if (d != 1) - repr = ocg->CreateIntegerDivide(repr, ocg->CreateInt(d)); - - oReprList.append(repr); - } - else - oReprList.append(NULL); - } - - return oReprList; -} - -namespace { - -Relation create_stride_on_bound(int n, const std::map &lb, coef_t stride) { - Relation result(n); - F_And *f_root = result.add_and(); - EQ_Handle h = f_root->add_stride(stride); - - for (std::map::const_iterator i = lb.begin(); i != lb.end(); i++) { - if (i->first == NULL) - h.update_const(i->second); - else { - switch(i->first->kind()) { - case Input_Var: { - int pos = i->first->get_position(); - h.update_coef(result.set_var(pos), i->second); - break; - } - case Global_Var: { - Global_Var_ID g = i->first->get_global_var(); - Variable_ID v; - if (g->arity() == 0) - v = result.get_local(g); - else - v = result.get_local(g, i->first->function_of()); - h.update_coef(v, i->second); - break; - } - default: - assert(0); - } - } - } - - return result; -} - -} - -//---------------------------------------------------------------------------- -// Find the most restrictive common stride constraint for a set of -// relations. -- by chun, 05/20/09 -// ---------------------------------------------------------------------------- -Relation greatest_common_step(const Tuple &I, const Tuple &active, int level, const Relation &known) { - assert(I.size() == active.size()); - int n = 0; - - std::vector I1, I2; - for (int i = 1; i <= I.size(); i++) - if (active[i]) { - if (n == 0) - n = I[i].n_set(); - - Relation r1; - if (known.is_null()) - r1 = copy(I[i]); - else { - r1 = Intersection(copy(I[i]), copy(known)); - r1.simplify(); - } - I1.push_back(r1); - Relation r2 = Gist(copy(I[i]), copy(known)); - assert(r2.is_upper_bound_satisfiable()); - if (r2.is_obvious_tautology()) - return Relation::True(n); - I2.push_back(r2); - } - - std::vector is_exact(I2.size(), true); - std::vector step(I2.size(), 0); - std::vector messy_step(I2.size(), 0); - Variable_ID t_col = set_var(level); - std::map lb; - - // first check all clean strides: t_col = ... (mod step) - for (size_t i = 0; i < I2.size(); i++) { - Conjunct *c = I2[i].query_DNF()->single_conjunct(); - - bool is_degenerated = false; - for (EQ_Iterator e = c->EQs(); e; e++) { - coef_t coef = abs((*e).get_coef(t_col)); - if (coef != 0 && !(*e).has_wildcards()) { - is_degenerated = true; - break; - } - } - if (is_degenerated) - continue; - - for (EQ_Iterator e = c->EQs(); e; e++) { - if ((*e).has_wildcards()) { - coef_t coef = abs((*e).get_coef(t_col)); - if (coef == 0) - continue; - if (coef != 1) { - is_exact[i] = false; - continue; - } - - coef_t this_step = abs(Constr_Vars_Iter(*e, true).curr_coef()); - assert(this_step != 1); - - if (lb.size() != 0) { - Relation test = create_stride_on_bound(n, lb, this_step); - if (Gist(test, copy(I1[i])).is_obvious_tautology()) { - if (step[i] == 0) - step[i] = this_step; - else - step[i] = lcm(step[i], this_step); - } - else - is_exact[i] = false; - } - else { - // try to find a lower bound that hits on stride - Conjunct *c = I2[i].query_DNF()->single_conjunct(); - for (GEQ_Iterator ge = c->GEQs(); ge; ge++) { - if ((*ge).has_wildcards() || (*ge).get_coef(t_col) != 1) - continue; - - std::map cur_lb; - for (Constr_Vars_Iter cv(*ge); cv; cv++) - cur_lb[cv.curr_var()] = cv.curr_coef(); - cur_lb[NULL] = (*ge).get_const(); - - Relation test = create_stride_on_bound(n, cur_lb, this_step); - if (Gist(test, copy(I1[i])).is_obvious_tautology()) { - if (step[i] == 0) - step[i] = this_step; - else - step[i] = lcm(step[i], this_step); - - lb = cur_lb; - break; - } - } - - // no clean lower bound, thus we use this modular constraint as is - if (lb.size() == 0) { - std::map cur_lb; - int wild_count = 0; - for (Constr_Vars_Iter cv(*e); cv; cv++) - if (cv.curr_var()->kind() == Wildcard_Var) - wild_count++; - else - cur_lb[cv.curr_var()] = cv.curr_coef(); - cur_lb[NULL] = (*e).get_const(); - - if (wild_count == 1) { - lb = cur_lb; - if (step[i] == 0) - step[i] = this_step; - else - step[i] = lcm(step[i], this_step); - } - } - - if (lb.size() == 0) - is_exact[i] = false; - } - } - } - } - - // aggregate all exact steps - coef_t global_step = 0; - for (size_t i = 0; i < is_exact.size(); i++) - if (is_exact[i]) - global_step = gcd(global_step, step[i]); - if (global_step == 1) - return Relation::True(n); - - // now check all messy strides: a*t_col = ... (mod step) - for (size_t i = 0; i < I2.size(); i++) - if (!is_exact[i]) { - Conjunct *c = I2[i].query_DNF()->single_conjunct(); - for (EQ_Iterator e = c->EQs(); e; e++) { - coef_t coef = abs((*e).get_coef(t_col)); - if (coef == 0 || coef == 1) - continue; - - // make a guess for messy stride condition -- by chun 07/27/2007 - coef_t this_step = abs(Constr_Vars_Iter(*e, true).curr_coef()); - this_step /= gcd(this_step, coef); - this_step = gcd(global_step, this_step); - if (this_step == 1) - continue; - - if (lb.size() != 0) { - Relation test = create_stride_on_bound(n, lb, this_step); - if (Gist(test, copy(I1[i])).is_obvious_tautology()) { - if (step[i] == 0) - step[i] = this_step; - else - step[i] = lcm(step[i], this_step); - } - } - else { - // try to find a lower bound that hits on stride - Conjunct *c = I2[i].query_DNF()->single_conjunct(); - for (GEQ_Iterator ge = c->GEQs(); ge; ge++) { - if ((*ge).has_wildcards() || (*ge).get_coef(t_col) != 1) - continue; - - std::map cur_lb; - - for (Constr_Vars_Iter cv(*ge); cv; cv++) - cur_lb[cv.curr_var()] = cv.curr_coef(); - - cur_lb[NULL] = (*ge).get_const(); - - Relation test = create_stride_on_bound(n, cur_lb, this_step); - if (Gist(test, copy(I1[i])).is_obvious_tautology()) { - if (step[i] == 0) - step[i] = this_step; - else - step[i] = lcm(step[i], this_step); - - lb = cur_lb; - break; - } - } - } - } - } - - // aggregate all non-exact steps - for (size_t i = 0; i < is_exact.size(); i++) - if (!is_exact[i]) - global_step = gcd(global_step, step[i]); - if (global_step == 1 || global_step == 0) - return Relation::True(n); - - Relation result = create_stride_on_bound(n, lb, global_step); - - // check for statements that haven't been factored into global step - for (size_t i = 0; i < I1.size(); i++) - if (step[i] == 0) { - if (!Gist(copy(result), copy(I1[i])).is_obvious_tautology()) - return Relation::True(n); - } - - return result; -} - - -//----------------------------------------------------------------------------- -// Substitute variables in a statement according to mapping function. -//----------------------------------------------------------------------------- -CG_outputRepr* outputStatement(CG_outputBuilder *ocg, CG_outputRepr *stmt, int indent, const Relation &mapping_, const Relation &known_, const std::vector &assigned_on_the_fly) { - Relation mapping = copy(mapping_); - Relation known = copy(known_); - Tuple loop_vars; - - for (int i = 1; i <= mapping.n_inp(); i++) - loop_vars.append(mapping.input_var(i)->name()); - - // discard non-existant variables from iteration spaces -- by chun 12/31/2008 - if (known.n_set() > mapping.n_out()) { - Relation r(known.n_set(), mapping.n_out()); - F_And *f_root = r.add_and(); - for (int i = 1; i <= mapping.n_out(); i++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(r.input_var(i), 1); - h.update_coef(r.output_var(i), -1); - } - known = Range(Restrict_Domain(r, known)); - known.simplify(); - } - - // remove modular constraints from known to simplify mapping process -- by chun 11/10/2008 - Relation k(known.n_set()); - F_And *f_root = k.add_and(); - Conjunct *c = known.query_DNF()->single_conjunct(); - for (EQ_Iterator e = c->EQs(); e; e++) { - if (!(*e).has_wildcards()) - f_root->add_EQ(*e); - } - k.simplify(); - - // get variable substituion list - Relation Inv_mapping = Restrict_Domain(Inverse(mapping), k); - Tuple sList = outputSubstitution(ocg, Inv_mapping, assigned_on_the_fly); - - return ocg->CreatePlaceHolder(indent, stmt, sList, loop_vars); -} - - -// find floor definition for variable such as m-3 <= 4v <= m -bool findFloorInequality(Relation &r, Variable_ID v, GEQ_Handle &h, Variable_ID excluded) { - Conjunct *c = r.single_conjunct(); - - std::set var_checked; - std::stack var_checking; - var_checking.push(v); - - while (!var_checking.empty()) { - Variable_ID v2 = var_checking.top(); - var_checking.pop(); - - bool is_floor = false; - for (GEQ_Iterator gi(c); gi; gi++) { - if (excluded != NULL && (*gi).get_coef(excluded) != 0) - continue; - - coef_t a = (*gi).get_coef(v2); - if (a < 0) { - for (GEQ_Iterator gi2(c); gi2; gi2++) { - coef_t b = (*gi2).get_coef(v2); - if (b == -a && (*gi).get_const()+(*gi2).get_const() < -a) { - bool match = true; - for (Constr_Vars_Iter cvi(*gi); cvi; cvi++) - if ((*gi2).get_coef((*cvi).var) != -(*cvi).coef) { - match = false; - break; - } - if (!match) - continue; - for (Constr_Vars_Iter cvi(*gi2); cvi; cvi++) - if ((*gi).get_coef((*cvi).var) != -(*cvi).coef) { - match = false; - break; - } - if (match) { - var_checked.insert(v2); - is_floor = true; - if (v == v2) - h = *gi; - - for (Constr_Vars_Iter cvi(*gi); cvi; cvi++) - if (((*cvi).var->kind() == Exists_Var || (*cvi).var->kind() == Wildcard_Var) && - var_checked.find((*cvi).var) == var_checked.end()) - var_checking.push((*cvi).var); - - break; - } - } - } - if (is_floor) - break; - } - } - if (!is_floor) - return false; - } - return true; -} - - - - -//----------------------------------------------------------------------------- -// Output a reqular equality or inequality to conditions. -// e.g. (i=5*j) -//----------------------------------------------------------------------------- -CG_outputRepr* output_as_guard(CG_outputBuilder* ocg, const Relation &guards_in, Constraint_Handle e, bool is_equality, const std::vector &assigned_on_the_fly) { - Relation &guards = const_cast(guards_in); - if (e.has_wildcards()) - throw std::invalid_argument("constraint must not have wildcard"); - - Variable_ID v = (*Constr_Vars_Iter(e)).var; - - coef_t saved_coef = ((e).get_coef(v)); - int sign = saved_coef < 0 ? -1 : 1; - - (e).update_coef_during_simplify(v, -saved_coef+sign); - CG_outputRepr* rop = outputEasyBoundAsRepr(ocg, guards, e, v, false, 0, assigned_on_the_fly); - (e).update_coef_during_simplify(v,saved_coef-sign); - - CG_outputRepr* lop = outputIdent(ocg, guards, v, assigned_on_the_fly); - if (abs(saved_coef) != 1) - lop = ocg->CreateTimes(ocg->CreateInt(abs(saved_coef)), lop); - - - if (is_equality) { - return ocg->CreateEQ(lop, rop); - } - else { - if (saved_coef < 0) - return ocg->CreateLE(lop, rop); - else - return ocg->CreateGE(lop, rop); - } -} - - -//----------------------------------------------------------------------------- -// Output stride conditions from equalities. -// e.g. (exists alpha: i = 5*alpha) -//----------------------------------------------------------------------------- -CG_outputRepr *output_EQ_strides(CG_outputBuilder* ocg, const Relation &guards_in, const std::vector &assigned_on_the_fly) { - Relation guards = const_cast(guards_in); - Conjunct *c = guards.single_conjunct(); - - CG_outputRepr *eqRepr = NULL; - - for (EQ_Iterator ei(c->EQs()); ei; ei++) { - Variable_ID wc = NULL; - for (Constr_Vars_Iter cvi((*ei), true); cvi; cvi++) { - if (wc != NULL) - throw codegen_error("Can't generate equality condition with multiple wildcards"); - else - wc = (*cvi).var; - } - if (wc == NULL) - continue; - - coef_t step = (*ei).get_coef(wc); - - (*ei).update_coef_during_simplify(wc, 1-step); - CG_outputRepr* lop = outputEasyBoundAsRepr(ocg, guards, (*ei), wc, false, 0, assigned_on_the_fly); - (*ei).update_coef_during_simplify(wc, step-1); - - CG_outputRepr* rop = ocg->CreateInt(abs(step)); - CG_outputRepr* intMod = ocg->CreateIntegerMod(lop, rop); - CG_outputRepr* eqNode = ocg->CreateEQ(intMod, ocg->CreateInt(0)); - - eqRepr = ocg->CreateAnd(eqRepr, eqNode); - } - - return eqRepr; -} - - - -//----------------------------------------------------------------------------- -// Output hole conditions created by inequalities involving wildcards. -// e.g. (exists alpha: 4*alpha <= i <= 5*alpha) -// Collect wildcards -// For each whildcard -// collect lower and upper bounds in which wildcard appears -// For each lower bound -// create constraint with each upper bound -//----------------------------------------------------------------------------- -CG_outputRepr *output_GEQ_strides(CG_outputBuilder* ocg, const Relation &guards_in, const std::vector &assigned_on_the_fly) { - Relation guards = const_cast(guards_in); - Conjunct *c = guards.single_conjunct(); - - CG_outputRepr* geqRepr = NULL; - - std::set non_orphan_wildcard; - for (GEQ_Iterator gi(c); gi; gi++) { - int num_wild = 0; - Variable_ID first_one; - for (Constr_Vars_Iter cvi(*gi, true); cvi; cvi++) { - num_wild++; - if (num_wild == 1) - first_one = (*cvi).var; - else - non_orphan_wildcard.insert((*cvi).var); - } - if (num_wild > 1) - non_orphan_wildcard.insert(first_one); - } - - for (int i = 1; i <= (*(c->variables())).size(); i++) { - Variable_ID wc = (*(c->variables()))[i]; - if (wc->kind() == Wildcard_Var && non_orphan_wildcard.find(wc) == non_orphan_wildcard.end()) { - Tuple lower, upper; - for (GEQ_Iterator gi(c); gi; gi++) { - if((*gi).get_coef(wc) > 0) - lower.append(*gi); - else if((*gi).get_coef(wc) < 0) - upper.append(*gi); - } - - // low: c*alpha - x >= 0 - // up: -d*alpha + y >= 0 - for (Tuple_Iterator low(lower); low; low++) { - for (Tuple_Iterator up(upper); up; up++) { - coef_t low_coef = (*low).get_coef(wc); - coef_t up_coef = (*up).get_coef(wc); - - (*low).update_coef_during_simplify(wc, 1-low_coef); - CG_outputRepr* lowExpr = outputEasyBoundAsRepr(ocg, guards, *low, wc, false, 0, assigned_on_the_fly); - (*low).update_coef_during_simplify(wc, low_coef-1); - - (*up).update_coef_during_simplify(wc, -1-up_coef); - CG_outputRepr* upExpr = outputEasyBoundAsRepr(ocg, guards, *up, wc, false, 0, assigned_on_the_fly); - (*up).update_coef_during_simplify(wc, up_coef+1); - - CG_outputRepr* intDiv = ocg->CreateIntegerDivide(upExpr, ocg->CreateInt(-up_coef)); - CG_outputRepr* rop = ocg->CreateTimes(ocg->CreateInt(low_coef), intDiv); - CG_outputRepr* geqNode = ocg->CreateLE(lowExpr, rop); - - geqRepr = ocg->CreateAnd(geqRepr, geqNode); - } - } - } - } - - if (non_orphan_wildcard.size() > 0) { - // e.g. c*alpha - x >= 0 (*) - // -d*alpha + y >= 0 (*) - // e1*alpha + f1*beta + g1 >= 0 (**) - // e2*alpha + f2*beta + g2 >= 0 (**) - // ... - // TODO: should generate a testing loop for alpha using its lower and - // upper bounds from (*) constraints and do the same if-condition test - // for beta from each pair of opposite (**) constraints as above, - // and exit the loop when if-condition satisfied. - throw codegen_error("Can't generate multiple wildcard GEQ guards right now"); - } - - return geqRepr; -} - - -//----------------------------------------------------------------------------- -// Translate all constraints in a relation to guard conditions. -//----------------------------------------------------------------------------- -CG_outputRepr *outputGuard(CG_outputBuilder* ocg, const Relation &guards_in, const std::vector &assigned_on_the_fly) { - Relation &guards = const_cast(guards_in); - if (guards.is_null() || guards.is_obvious_tautology()) - return NULL; - - CG_outputRepr* nodeRepr = NULL; - - CG_outputRepr *eqStrideRepr = output_EQ_strides(ocg, guards, assigned_on_the_fly); - nodeRepr = ocg->CreateAnd(nodeRepr, eqStrideRepr); - - CG_outputRepr *geqStrideRepr = output_GEQ_strides(ocg, guards, assigned_on_the_fly); - nodeRepr = ocg->CreateAnd(nodeRepr, geqStrideRepr); - - Conjunct *c = guards.single_conjunct(); - for(EQ_Iterator ei(c->EQs()); ei; ei++) - if (!(*ei).has_wildcards()) { - CG_outputRepr *eqRepr = output_as_guard(ocg, guards, (*ei), true, assigned_on_the_fly); - nodeRepr = ocg->CreateAnd(nodeRepr, eqRepr); - } - for(GEQ_Iterator gi(c->GEQs()); gi; gi++) - if (!(*gi).has_wildcards()) { - CG_outputRepr *geqRepr = output_as_guard(ocg, guards, (*gi), false, assigned_on_the_fly); - nodeRepr = ocg->CreateAnd(nodeRepr, geqRepr); - } - - return nodeRepr; -} - - -//----------------------------------------------------------------------------- -// one is 1 for LB -// this function is overloaded should replace the original one -//----------------------------------------------------------------------------- -CG_outputRepr *outputLBasRepr(CG_outputBuilder* ocg, const GEQ_Handle &g, - Relation &bounds, Variable_ID v, - coef_t stride, const EQ_Handle &strideEQ, - Relation known, const std::vector &assigned_on_the_fly) { -#if ! defined NDEBUG - coef_t v_coef; - assert((v_coef = g.get_coef(v)) > 0); -#endif - - std::string s; - CG_outputRepr *lbRepr; - if (stride == 1) { - lbRepr = outputEasyBoundAsRepr(ocg, bounds, g, v, false, 1, assigned_on_the_fly); - } - else { - if (!boundHitsStride(g,v,strideEQ,stride,known)) { - bounds.setup_names(); // boundsHitsStride resets variable names - - CG_stringBuilder oscg; - std::string c = GetString(outputEasyBoundAsRepr(&oscg, bounds, strideEQ, v, true, 0, assigned_on_the_fly)); - CG_outputRepr *cRepr = NULL; - if (c != std::string("0")) - cRepr = outputEasyBoundAsRepr(ocg, bounds, strideEQ, v, true, 0, assigned_on_the_fly); - std::string LoverM = GetString(outputEasyBoundAsRepr(&oscg, bounds, g, v, false, 1, assigned_on_the_fly)); - CG_outputRepr *LoverMRepr = NULL; - if (LoverM != std::string("0")) - LoverMRepr = outputEasyBoundAsRepr(ocg, bounds, g, v, false, 1, assigned_on_the_fly); - - if (code_gen_debug > 2) { - fprintf(DebugFile,"::: LoverM is %s\n", LoverM.c_str()); - fprintf(DebugFile,"::: c is %s\n", c.c_str()); - } - - int complexity1 = 0, complexity2 = 0; - for (size_t i = 0; i < c.length(); i++) - if (c[i] == '+' || c[i] == '-' || c[i] == '*' || c[i] == '/') - complexity1++; - else if (c[i] == ',') - complexity1 += 2; - for (size_t i = 0; i < LoverM.length(); i++) - if (LoverM[i] == '+' || LoverM[i] == '-' || LoverM[i] == '*' || LoverM[i] == '/') - complexity2++; - else if (LoverM[i] == ',') - complexity2 += 2; - - if (complexity1 < complexity2) { - CG_outputRepr *idUp = LoverMRepr; - CG_outputRepr *c1Repr = ocg->CreateCopy(cRepr); - idUp = ocg->CreateMinus(idUp, c1Repr); - idUp = ocg->CreatePlus(idUp, ocg->CreateInt(stride-1)); - CG_outputRepr *idLow = ocg->CreateInt(stride); - lbRepr = ocg->CreateTimes(ocg->CreateInt(stride), - ocg->CreateIntegerDivide(idUp, idLow)); - lbRepr = ocg->CreatePlus(lbRepr, cRepr); - } - else { - CG_outputRepr *LoverM1Repr = ocg->CreateCopy(LoverMRepr); - CG_outputRepr *imUp = ocg->CreateMinus(cRepr, LoverM1Repr); - CG_outputRepr *imLow = ocg->CreateInt(stride); - CG_outputRepr *intMod = ocg->CreateIntegerMod(imUp, imLow); - lbRepr = ocg->CreatePlus(LoverMRepr, intMod); - } - } - else { - // boundsHitsStride resets variable names - bounds.setup_names(); - lbRepr = outputEasyBoundAsRepr(ocg, bounds, g, v, false, 0, assigned_on_the_fly); - } - } - - return lbRepr; -} - -//----------------------------------------------------------------------------- -// one is -1 for UB -// this function is overloaded should replace the original one -//----------------------------------------------------------------------------- -CG_outputRepr *outputUBasRepr(CG_outputBuilder* ocg, const GEQ_Handle &g, - Relation & bounds, - Variable_ID v, - coef_t /*stride*/, // currently unused - const EQ_Handle &/*strideEQ*/, //currently unused - const std::vector &assigned_on_the_fly) { - assert(g.get_coef(v) < 0); - CG_outputRepr* upRepr = outputEasyBoundAsRepr(ocg, bounds, g, v, false, 0, assigned_on_the_fly); - return upRepr; -} - -//----------------------------------------------------------------------------- -// Print the expression for the variable given as v. Works for both -// GEQ's and EQ's, but produces intDiv (not intMod) when v has a nonunit -// coefficient. So it is OK for loop bounds, but for checking stride -// constraints, you want to make sure the coef of v is 1, and insert the -// intMod yourself. -// -// original name is outputEasyBound -//----------------------------------------------------------------------------- -CG_outputRepr* outputEasyBoundAsRepr(CG_outputBuilder* ocg, Relation &bounds, - const Constraint_Handle &g, Variable_ID v, - bool ignoreWC, - int ceiling, - const std::vector &assigned_on_the_fly) { - // assert ignoreWC => g is EQ - // rewrite constraint as foo (== or <= or >=) v, return foo as string - - CG_outputRepr* easyBoundRepr = NULL; - - coef_t v_coef = g.get_coef(v); - int v_sign = v_coef > 0 ? 1 : -1; - v_coef *= v_sign; - assert(v_coef > 0); - // foo is (-constraint)/v_sign/v_coef - - int sign_adj = -v_sign; - - //---------------------------------------------------------------------- - // the following generates +- cf*varName - //---------------------------------------------------------------------- - for(Constr_Vars_Iter c2(g, false); c2; c2++) { - if ((*c2).var != v && (!ignoreWC || (*c2).var->kind()!=Wildcard_Var)) { - - coef_t cf = (*c2).coef*sign_adj; - assert(cf != 0); - - CG_outputRepr *varName; - if ((*c2).var->kind() == Wildcard_Var) { - GEQ_Handle h; - if (!findFloorInequality(bounds, (*c2).var, h, v)) { - if (easyBoundRepr != NULL) { - easyBoundRepr->clear(); - delete easyBoundRepr; - } - return NULL; - } - varName = outputEasyBoundAsRepr(ocg, bounds, h, (*c2).var, false, 0, assigned_on_the_fly); - } - else { - varName = outputIdent(ocg, bounds, (*c2).var, assigned_on_the_fly); - } - CG_outputRepr *cfRepr = NULL; - - if (cf > 1) { - cfRepr = ocg->CreateInt(cf); - CG_outputRepr* rbRepr = ocg->CreateTimes(cfRepr, varName); - easyBoundRepr = ocg->CreatePlus(easyBoundRepr, rbRepr); - } - else if (cf < -1) { - cfRepr = ocg->CreateInt(-cf); - CG_outputRepr* rbRepr = ocg->CreateTimes(cfRepr, varName); - easyBoundRepr = ocg->CreateMinus(easyBoundRepr, rbRepr); - } - else if (cf == 1) { - easyBoundRepr = ocg->CreatePlus(easyBoundRepr, varName); - } - else if (cf == -1) { - easyBoundRepr = ocg->CreateMinus(easyBoundRepr, varName); - } - } - } - - if (g.get_const()) { - coef_t cf = g.get_const()*sign_adj; - assert(cf != 0); - if (cf > 0) { - easyBoundRepr = ocg->CreatePlus(easyBoundRepr, ocg->CreateInt(cf)); - } - else { - easyBoundRepr = ocg->CreateMinus(easyBoundRepr, ocg->CreateInt(-cf)); - } - } - else { - if(easyBoundRepr == NULL) { - easyBoundRepr = ocg->CreateInt(0); - } - } - - if (v_coef > 1) { - assert(ceiling >= 0); - if (ceiling) { - easyBoundRepr= ocg->CreatePlus(easyBoundRepr, ocg->CreateInt(v_coef-1)); - } - easyBoundRepr = ocg->CreateIntegerDivide(easyBoundRepr, ocg->CreateInt(v_coef)); - } - - return easyBoundRepr; -} - - -//---------------------------------------------------------------------------- -// Translate inequality constraints to loop or assignment. -// if return.second is true, return.first is loop structure, -// otherwise it is assignment. -// ---------------------------------------------------------------------------- -std::pair outputBounds(CG_outputBuilder* ocg, const Relation &bounds, Variable_ID v, int indent, Relation &enforced, const std::vector &assigned_on_the_fly) { - Relation b = copy(bounds); - Conjunct *c = b.query_DNF()->single_conjunct(); - - // Elaborate stride simplification which is complementary to gist function - // since we further target the specific loop variable. -- by chun 08/07/2008 - Relation r1 = Relation::True(b.n_set()), r2 = Relation::True(b.n_set()); - for (EQ_Iterator ei(c); ei; ei++) { - if ((*ei).get_coef(v) != 0 && (*ei).has_wildcards()) { // stride condition found - coef_t sign; - if ((*ei).get_coef(v) > 0) - sign = 1; - else - sign = -1; - - coef_t stride = 0; - for (Constr_Vars_Iter cvi(*ei, true); cvi; cvi++) - if ((*cvi).var->kind() == Wildcard_Var) { - stride = abs((*cvi).coef); - break; - } - - // check if stride hits lower bound - bool found_match = false; - if (abs((*ei).get_coef(v)) != 1) { // expensive matching for non-clean stride condition - coef_t d = stride / gcd(abs((*ei).get_coef(v)), stride); - Relation r3 = Relation::True(b.n_set()); - r3.and_with_EQ(*ei); - - for (GEQ_Iterator gi(c); gi; gi++) { - if ((*gi).get_coef(v) == 1 && !(*gi).has_wildcards()) { - Relation r4(b.n_set()); - F_And *f_root = r4.add_and(); - Stride_Handle h = f_root->add_stride(d); - - for (Constr_Vars_Iter cvi(*gi); cvi; cvi++) - switch ((*cvi).var->kind()) { - case Input_Var: { - int pos = (*cvi).var->get_position(); - h.update_coef(r4.set_var(pos), (*cvi).coef); - break; - } - case Global_Var: { - Global_Var_ID g = (*cvi).var->get_global_var(); - Variable_ID v; - if (g->arity() == 0) - v = r4.get_local(g); - else - v = r4.get_local(g, (*cvi).var->function_of()); - h.update_coef(v, (*cvi).coef); - break; - } - default: - fprintf(DebugFile, "can't deal with the variable type in lower bound\n"); - return std::make_pair(static_cast(NULL), false); - } - h.update_const((*gi).get_const()); - - Relation r5 = Gist(copy(r3), Intersection(copy(r4), copy(enforced))); - - // replace original stride condition with striding from this lower bound - if (r5.is_obvious_tautology()) { - r1 = Intersection(r1, r4); - found_match = true; - break; - } - } - } - } - else { - for (GEQ_Iterator gi(c); gi; gi++) { - if ((*gi).get_coef(v) == abs((*ei).get_coef(v)) && !(*gi).has_wildcards()) { // potential matching lower bound found - Relation r(b.n_set()); - Stride_Handle h = r.add_and()->add_stride(stride); - - for (Constr_Vars_Iter cvi(*gi); cvi; cvi++) - switch ((*cvi).var->kind()) { - case Input_Var: { - int pos = (*cvi).var->get_position(); - if ((*cvi).var != v) { - int t1 = int_mod((*cvi).coef, stride); - if (t1 != 0) { - coef_t t2 = enforced.query_variable_mod(enforced.set_var(pos), stride); - if (t2 != posInfinity) - h.update_const(t1*t2); - else - h.update_coef(r.set_var(pos), t1); - } - } - else - h.update_coef(r.set_var(pos), (*cvi).coef); - break; - } - case Global_Var: { - Global_Var_ID g = (*cvi).var->get_global_var(); - Variable_ID v; - if (g->arity() == 0) - v = enforced.get_local(g); - else - v = enforced.get_local(g, (*cvi).var->function_of()); - coef_t t = enforced.query_variable_mod(v, stride); - if (t != posInfinity) - h.update_const(t*(*cvi).coef); - else { - Variable_ID v2; - if (g->arity() == 0) - v2 = r.get_local(g); - else - v2 = r.get_local(g, (*cvi).var->function_of()); - h.update_coef(v2, (*cvi).coef); - } - break; - } - default: - fprintf(DebugFile, "can't deal with the variable type in lower bound\n"); - return std::make_pair(static_cast(NULL), false); - } - h.update_const((*gi).get_const()); - - bool t = true; - { - Conjunct *c2 = r.query_DNF()->single_conjunct(); - EQ_Handle h2; - for (EQ_Iterator ei2(c2); ei2; ei2++) { - h2 = *ei2; - break; - } - - int sign; - if (h2.get_coef(v) == (*ei).get_coef(v)) - sign = 1; - else - sign = -1; - - t = int_mod(h2.get_const() - sign * (*ei).get_const(), stride) == 0; - - if (t != false) - for (Constr_Vars_Iter cvi(h2); cvi; cvi++) - if ((*cvi).var->kind() != Wildcard_Var && - int_mod((*cvi).coef - sign * (*ei).get_coef((*cvi).var), stride) != 0) { - t = false; - break; - } - - if (t != false) - for (Constr_Vars_Iter cvi(*ei); cvi; cvi++) - if ((*cvi).var->kind() != Wildcard_Var && - int_mod((*cvi).coef - sign * h2.get_coef((*cvi).var), stride) != 0) { - t = false; - break; - } - - } - - if (t) { - // replace original stride condition with striding from this lower bound - F_And *f_root = r1.and_with_and(); - Stride_Handle h = f_root->add_stride(stride); - for (Constr_Vars_Iter cvi(*gi); cvi; cvi++) - switch ((*cvi).var->kind()) { - case Input_Var: { - h.update_coef(r1.set_var((*cvi).var->get_position()), (*cvi).coef); - break; - } - case Global_Var: { - Global_Var_ID g = (*cvi).var->get_global_var(); - Variable_ID v; - if (g->arity() == 0) - v = r1.get_local(g); - else - v = r1.get_local(g, (*cvi).var->function_of()); - h.update_coef(v, (*cvi).coef); - break; - } - default: - fprintf(DebugFile, "can't deal with the variable type in lower bound\n"); - return std::make_pair(static_cast(NULL), false); - } - h.update_const((*gi).get_const()); - - found_match = true; - break; - } - } - } - } - - if (!found_match) - r1.and_with_EQ(*ei); - } - else if ((*ei).get_coef(v) == 0) { - Relation r3 = Relation::True(b.n_set()); - r3.and_with_EQ(*ei); - Relation r4 = Gist(r3, copy(enforced)); - if (!r4.is_obvious_tautology()) - r2.and_with_EQ(*ei); - } - else - r2.and_with_EQ(*ei); - } - - // restore remaining inequalities - { - std::map exists_mapping; - F_Exists *fe = r2.and_with_and()->add_exists(); - F_And *f_root = fe->add_and(); - for (GEQ_Iterator gi(c); gi; gi++) { - GEQ_Handle h = f_root->add_GEQ(); - for (Constr_Vars_Iter cvi(*gi); cvi; cvi++) { - Variable_ID v = cvi.curr_var(); - switch (v->kind()) { - case Input_Var: { - int pos = v->get_position(); - h.update_coef(r2.set_var(pos), cvi.curr_coef()); - break; - } - case Exists_Var: - case Wildcard_Var: { - std::map::iterator p = exists_mapping.find(v); - Variable_ID e; - if (p == exists_mapping.end()) { - e = fe->declare(); - exists_mapping[v] = e; - } - else - e = (*p).second; - h.update_coef(e, cvi.curr_coef()); - break; - } - case Global_Var: { - Global_Var_ID g = v->get_global_var(); - Variable_ID v2; - if (g->arity() == 0) - v2 = r2.get_local(g); - else - v2 = r2.get_local(g, v->function_of()); - h.update_coef(v2, cvi.curr_coef()); - break; - } - default: - assert(0); - } - } - h.update_const((*gi).get_const()); - } - } - - // overwrite original bounds - { - r1.simplify(); - r2.simplify(); - Relation b2 = Intersection(r1, r2); - b2.simplify(); - for (int i = 1; i <= b.n_set(); i++) - b2.name_set_var(i, b.set_var(i)->name()); - b2.setup_names(); - b = b2; - c = b.query_DNF()->single_conjunct(); - } - - - // get loop strides - EQ_Handle strideEQ; - bool foundStride = false; // stride that can be translated to loop - bool foundSimpleStride = false; // stride that starts from const value - coef_t step = 1; - int num_stride = 0; - - for (EQ_Iterator ei(c); ei; ei++) { - if ((*ei).get_coef(v) != 0 && (*ei).has_wildcards()) { - num_stride++; - - if (abs((*ei).get_coef(v)) != 1) - continue; - - bool t = true; - coef_t d = 1; - for (Constr_Vars_Iter cvi(*ei); cvi; cvi++) - if ((*cvi).var->kind() == Wildcard_Var) { - assert(d==1); - d = abs((*cvi).coef); - } - else if ((*cvi).var->kind() == Input_Var) { - if ((*cvi).var != v) - t = false; - } - else - t = false; - - if (d > step) { - step = d; - foundSimpleStride = t; - strideEQ = *ei; - foundStride = true; - } - } - } - - // More than one stride or complex stride found, we should move all - // but strideEQ to body's guard condition. alas, not implemented. - if (!(num_stride == 0 || (num_stride == 1 && foundStride))) - return std::make_pair(static_cast(NULL), false); - - // get loop bounds - int lower_bounds = 0, upper_bounds = 0; - Tuple lbList; - Tuple ubList; - coef_t const_lb = negInfinity, const_ub = posInfinity; - for (GEQ_Iterator g(c); g; g++) { - coef_t coef = (*g).get_coef(v); - if (coef == 0) - continue; - else if (coef > 0) { // lower bound - lower_bounds++; - if ((*g).is_const(v) && !foundStride) { - //no variables but v in constr - coef_t L,m; - L = -((*g).get_const()); - - m = (*g).get_coef(v); - coef_t sb = (int) (ceil(((float) L) /m)); - set_max(const_lb, sb); - } - else if ((*g).is_const(v) && foundSimpleStride) { - // no variables but v in constr - //make LB fit the stride constraint - coef_t L,m,s,c; - L = -((*g).get_const()); - m = (*g).get_coef(v); - s = step; - c = strideEQ.get_const(); - coef_t sb = (s * (int) (ceil( (float) (L - (c * m)) /(s*m))))+ c; - set_max(const_lb, sb); - } - else - lbList.append(outputLBasRepr(ocg, *g, b, v, step, strideEQ, enforced, assigned_on_the_fly)); - } - else { // upper bound - upper_bounds++; - if ((*g).is_const(v)) { - // no variables but v in constraint - set_min(const_ub,-(*g).get_const()/(*g).get_coef(v)); - } - else - ubList.append(outputUBasRepr(ocg, *g, b, v, step, strideEQ, assigned_on_the_fly)); - } - } - - CG_outputRepr *lbRepr = NULL; - CG_outputRepr *ubRepr = NULL; - if (const_lb != negInfinity) - lbList.append(ocg->CreateInt(const_lb)); - if (lbList.size() > 1) - lbRepr = ocg->CreateInvoke("max", lbList); - else if (lbList.size() == 1) - lbRepr = lbList[1]; - - //protonu - if(fillInBounds && lbList.size() == 1 && const_lb != negInfinity) - lowerBoundForLevel = const_lb; - //end-protonu - - if (const_ub != posInfinity) - ubList.append(ocg->CreateInt(const_ub)); - if (ubList.size() > 1) - ubRepr = ocg->CreateInvoke("min", ubList); - else if (ubList.size() == 1) - ubRepr = ubList[1]; - - //protonu - if(fillInBounds && const_ub != posInfinity) - upperBoundForLevel = const_ub; - //end-protonu - - if (upper_bounds == 0 || lower_bounds == 0) { - return std::make_pair(static_cast(NULL), false); - } - else { - // bookkeeping catched constraints in new_knwon - F_Exists *fe = enforced.and_with_and()->add_exists(); - F_And *f_root = fe->add_and(); - std::map exists_mapping; - std::stack > floor_geq_stack; - std::set floor_var_set; - - if (foundStride) { - EQ_Handle h = f_root->add_EQ(); - for (Constr_Vars_Iter cvi(strideEQ); cvi; cvi++) - switch ((*cvi).var->kind()) { - case Input_Var: { - int pos = (*cvi).var->get_position(); - h.update_coef(enforced.set_var(pos), (*cvi).coef); - break; - } - case Exists_Var: - case Wildcard_Var: { - std::map::iterator p = exists_mapping.find((*cvi).var); - Variable_ID e; - if (p == exists_mapping.end()) { - e = fe->declare(); - exists_mapping[(*cvi).var] = e; - } - else - e = (*p).second; - h.update_coef(e, (*cvi).coef); - break; - } - case Global_Var: { - Global_Var_ID g = (*cvi).var->get_global_var(); - Variable_ID e; - if (g->arity() == 0) - e = enforced.get_local(g); - else - e = enforced.get_local(g, (*cvi).var->function_of()); - h.update_coef(e, (*cvi).coef); - break; - } - default: - assert(0); - } - h.update_const(strideEQ.get_const()); - } - - for (GEQ_Iterator gi(c); gi; gi++) - if ((*gi).get_coef(v) != 0) { - GEQ_Handle h = f_root->add_GEQ(); - for (Constr_Vars_Iter cvi(*gi); cvi; cvi++) - switch ((*cvi).var->kind()) { - case Input_Var: { - int pos = (*cvi).var->get_position(); - h.update_coef(enforced.set_var(pos), (*cvi).coef); - break; - } - case Exists_Var: - case Wildcard_Var: { - std::map::iterator p = exists_mapping.find((*cvi).var); - Variable_ID e; - if (p == exists_mapping.end()) { - e = fe->declare(); - exists_mapping[(*cvi).var] = e; - } - else - e = (*p).second; - h.update_coef(e, (*cvi).coef); - - if (floor_var_set.find((*cvi).var) == floor_var_set.end()) { - GEQ_Handle h2; - findFloorInequality(b, (*cvi).var, h2, v); - floor_geq_stack.push(std::make_pair(h2, (*cvi).var)); - floor_var_set.insert((*cvi).var); - } - break; - } - case Global_Var: { - Global_Var_ID g = (*cvi).var->get_global_var(); - Variable_ID e; - if (g->arity() == 0) - e = enforced.get_local(g); - else - e = enforced.get_local(g, (*cvi).var->function_of()); - h.update_coef(e, (*cvi).coef); - break; - } - default: - assert(0); - } - h.update_const((*gi).get_const()); - } - - // add floor definition involving variables appeared in bounds - while (!floor_geq_stack.empty()) { - std::pair p = floor_geq_stack.top(); - floor_geq_stack.pop(); - - GEQ_Handle h1 = f_root->add_GEQ(); - GEQ_Handle h2 = f_root->add_GEQ(); - for (Constr_Vars_Iter cvi(p.first); cvi; cvi++) { - switch ((*cvi).var->kind()) { - case Input_Var: { - int pos = (*cvi).var->get_position(); - h1.update_coef(enforced.input_var(pos), (*cvi).coef); - h2.update_coef(enforced.input_var(pos), -(*cvi).coef); - break; - } - case Exists_Var: - case Wildcard_Var: { - std::map::iterator p2 = exists_mapping.find((*cvi).var); - Variable_ID e; - if (p2 == exists_mapping.end()) { - e = fe->declare(); - exists_mapping[(*cvi).var] = e; - } - else - e = (*p2).second; - h1.update_coef(e, (*cvi).coef); - h2.update_coef(e, -(*cvi).coef); - - if (floor_var_set.find((*cvi).var) == floor_var_set.end()) { - GEQ_Handle h3; - findFloorInequality(b, (*cvi).var, h3, v); - floor_geq_stack.push(std::make_pair(h3, (*cvi).var)); - floor_var_set.insert((*cvi).var); - } - break; - } - case Global_Var: { - Global_Var_ID g = (*cvi).var->get_global_var(); - Variable_ID e; - if (g->arity() == 0) - e = enforced.get_local(g); - else - e = enforced.get_local(g, (*cvi).var->function_of()); - h1.update_coef(e, (*cvi).coef); - h2.update_coef(e, -(*cvi).coef); - break; - } - default: - assert(0); - } - } - h1.update_const(p.first.get_const()); - h2.update_const(-p.first.get_const()); - h2.update_const(-p.first.get_coef(p.second)-1); - } - enforced.simplify(); - - CG_outputRepr *stRepr = NULL; - if (step != 1) - stRepr = ocg->CreateInt(abs(step)); - CG_outputRepr *indexRepr = outputIdent(ocg, b, v, assigned_on_the_fly); - CG_outputRepr *ctrlRepr = ocg->CreateInductive(indexRepr, lbRepr, ubRepr, stRepr); - - return std::make_pair(ctrlRepr, true); - } -} - - -Relation project_onto_levels(Relation R, int last_level, bool wildcards) { - assert(last_level >= 0 && R.is_set() && last_level <= R.n_set()); - if (last_level == R.n_set()) return R; - - int orig_vars = R.n_set(); - int num_projected = orig_vars - last_level; - R = Extend_Set(R,num_projected - ); // Project out vars numbered > last_level - Mapping m1 = Mapping::Identity(R.n_set()); // now orig_vars+num_proj - - for(int i=last_level+1; i <= orig_vars; i++) { - m1.set_map(Set_Var, i, Exists_Var, i); - m1.set_map(Set_Var, i+num_projected, Set_Var, i); - } - - MapRel1(R, m1, Comb_Id); - R.finalize(); - R.simplify(); - if (!wildcards) - R = Approximate(R,1); - assert(R.is_set()); - return R; -} - - -// Check if the lower bound already enforces the stride by -// (Where m is coef of v in g and L is the bound on m*v): -// Check if m divides L evenly and Check if this l.bound on v implies strideEQ -bool boundHitsStride(const GEQ_Handle &g, Variable_ID v, - const EQ_Handle &strideEQ, - coef_t /*stride*/, // currently unused - Relation known) { -/* m = coef of v in g; - L = bound on v part of g; -*/ - // Check if m divides L evenly - coef_t m = g.get_coef(v); - Relation test(known.n_set()); - F_Exists *e = test.add_exists(); // g is "L >= mv" - Variable_ID alpha = e->declare(); // want: "l = m alpha" - F_And *a = e->add_and(); - EQ_Handle h = a->add_EQ(); - for(Constr_Vars_Iter I(g,false); I; I++) - if((*I).var != v) { - if((*I).var->kind() != Global_Var) - h.update_coef((*I).var, (*I).coef); - else - h.update_coef(test.get_local((*I).var->get_global_var()), (*I).coef); - } - - h.update_const(g.get_const()); - h.update_coef(alpha,m); // set alpha's coef to m - if (!(Gist(test,copy(known)).is_obvious_tautology())) - return false; - // Check if this lower bound on v implies the strideEQ - Relation boundRel = known; // want: "known and l = m v" - boundRel.and_with_EQ(g); // add in l = mv - Relation strideRel(known.n_set()); - strideRel.and_with_EQ(strideEQ); - return Gist(strideRel, boundRel).is_obvious_tautology(); -} - - -// // Return true if there are no variables in g except wildcards & v -bool isSimpleStride(const EQ_Handle &g, Variable_ID v) { - EQ_Handle gg = g; // should not be necessary, but iterators are - // a bit brain-dammaged - bool is_simple=true; - for(Constr_Vars_Iter cvi(gg, false); cvi && is_simple; cvi++) - is_simple = ((*cvi).coef == 0 || (*cvi).var == v - || (*cvi).var->kind() == Wildcard_Var); - return is_simple; -} - - -int countStrides(Conjunct *c, Variable_ID v, EQ_Handle &strideEQ, - bool &simple) { - int strides=0; - for(EQ_Iterator G(c); G; G++) - for(Constr_Vars_Iter I(*G, true); I; I++) - if (((*I).coef != 0) && (*G).get_coef(v) != 0) { - strides++; - simple = isSimpleStride(*G,v); - strideEQ = *G; - break; - } - return strides; -} - -namespace { - -bool hasEQ(Relation r, int level) { - r.simplify(); - Variable_ID v = set_var(level); - Conjunct *s_conj = r.single_conjunct(); - for(EQ_Iterator G(s_conj); G; G++) - if ((*G).get_coef(v)) - return true; - return false; -} - - - -static Relation pickEQ(Relation r, int level) { - r.simplify(); - Variable_ID v = set_var(level); - Conjunct *s_conj = r.single_conjunct(); - for(EQ_Iterator E(s_conj); E; E++) - if ((*E).get_coef(v)) { - Relation test_rel(r.n_set()); - test_rel.and_with_EQ(*E); - return test_rel; - } - assert(0); - return r; -} - -/* pickBound will return an EQ as a GEQ if it finds one */ -Relation pickBound(Relation r, int level, int UB) { - r.simplify(); - Variable_ID v = set_var(level); - Conjunct *s_conj = r.single_conjunct(); - for(GEQ_Iterator G(s_conj); G; G++) { - if ((UB && (*G).get_coef(v) < 0) - || (!UB && (*G).get_coef(v) > 0) ) { - Relation test_rel(r.n_set()); - test_rel.and_with_GEQ(*G); - return test_rel; - } - } - for(EQ_Iterator E(s_conj); E; E++) { - if ((*E).get_coef(v)) { - Relation test_rel(r.n_set()); - test_rel.and_with_GEQ(*E); - if ((UB && (*E).get_coef(v) > 0) - || (!UB && (*E).get_coef(v) < 0) ) - test_rel = Complement(test_rel); - return test_rel; - } - } - assert(0); - return r; -} - -} - -Relation pickOverhead(Relation r, int liftTo) { - r.simplify(); - Conjunct *s_conj = r.single_conjunct(); - for(GEQ_Iterator G(s_conj); G; G++) { - Relation test_rel(r.n_set()); - test_rel.and_with_GEQ(*G); - Variable_ID v; - coef_t pos = -1; - coef_t c= 0; - for(Constr_Vars_Iter cvi(*G, false); cvi; cvi++) - if ((*cvi).coef && (*cvi).var->kind() == Input_Var - && (*cvi).var->get_position() > pos) { - v = (*cvi).var; - pos = (*cvi).var->get_position(); - c = (*cvi).coef; - } -#if 0 - fprintf(DebugFile,"Coef = %d, constraint = %s\n", - c,(const char *)test_rel.print_formula_to_string()); -#endif - return test_rel; - } - for(EQ_Iterator E(s_conj); E; E++) { - assert(liftTo >= 1); - int pos = max((*E).max_tuple_pos(),max_fs_arity(*E)+1); - -/* Pick stride constraints only when the variables with stride are outer - loop variables */ - if ((*E).has_wildcards() && pos < liftTo) { - Relation test_rel(r.n_set()); - test_rel.and_with_EQ(*E); - return test_rel; - } - else if (!(*E).has_wildcards() && pos <= liftTo) { - Relation test_rel(r.n_set()); - test_rel.and_with_EQ(*E); - test_rel.simplify(); - test_rel = EQs_to_GEQs(test_rel,true); - return pickOverhead(test_rel,liftTo); - } - } - if (code_gen_debug>1) { - fprintf(DebugFile,"Could not find overhead:\n"); - r.prefix_print(DebugFile); - } - return Relation::True(r.n_set()); -} - - - -bool hasBound(Relation r, int level, int UB) { - r.simplify(); - Variable_ID v = set_var(level); - Conjunct *s_conj = r.single_conjunct(); - for(GEQ_Iterator G(s_conj); G; G++) { - if (UB && (*G).get_coef(v) < 0) return true; - if (!UB && (*G).get_coef(v) > 0) return true; - } - for(EQ_Iterator E(s_conj); E; E++) { - if ((*E).get_coef(v)) return true; - } - return false; -} - -bool find_any_constraint(int s, int level, Relation &kr, int direction, - Relation &S, bool approx) { - /* If we don't intersect I with restrictions, the combination - of S and restrictions can be unsatisfiable, which means that - the new split node gets pruned away and we still don't have - finite bounds -> infinite recursion. */ - - Relation I = projected_nIS[level][s]; - I = Gist(I,copy(kr)); - if(approx) I = Approximate(I); - if (hasBound(I,level,direction)) { - Relation pickfrom; - if(has_nonstride_EQ(I,level)) - pickfrom = pickEQ(I,level); - else - pickfrom = pickBound(I,level,direction); - S = pickOverhead(pickfrom,level); - if(S.is_obvious_tautology()) S = Relation::Null(); - return !S.is_null(); - } - return false; -} - - -bool has_nonstride_EQ(Relation r, int level) { - r.simplify(); - Variable_ID v = set_var(level); - Conjunct *s_conj = r.single_conjunct(); - for(EQ_Iterator G(s_conj); G; G++) - if ((*G).get_coef(v) && !(*G).has_wildcards()) - return true; - return false; -} - - -Relation minMaxOverhead(Relation r, int level) { - r.finalize(); - r.simplify(); - Conjunct *s_conj = r.single_conjunct(); - GEQ_Handle LBs[50],UBs[50]; - int numLBs = 0; - int numUBs = 0; - Variable_ID v = set_var(level); - for(GEQ_Iterator G(s_conj); G; G++) if ((*G).get_coef(v)) { - GEQ_Handle g = *G; - if (g.get_coef(v) > 0) LBs[numLBs++] = g; - else UBs[numUBs++] = g; - } - if (numLBs <= 1 && numUBs <= 1) { - return Relation::True(r.n_set()); - } - Relation r1(r.n_set()); - Relation r2(r.n_set()); - if (numLBs > 1) { - // remove a max in lower bound - r1.and_with_GEQ(LBs[0]); - r2.and_with_GEQ(LBs[1]); - r1 = project_onto_levels(Difference(r1,r2),level-1,0); - } - else { - // remove a min in upper bound - r1.and_with_GEQ(UBs[0]); - r2.and_with_GEQ(UBs[1]); - r1 = project_onto_levels(Difference(r1,r2),level-1,0); - } -#if 0 - fprintf(DebugFile,"Testing %s\n",(const char *)r1.print_formula_to_string()); - fprintf(DebugFile,"will removed overhead on bounds of t%d: %s\n",level, - (const char *)r.print_formula_to_string()); -#endif - - return pickOverhead(r1, -1); -} - -std::pair find_simplest_assignment(const Relation &R_, Variable_ID v, const std::vector &assigned_on_the_fly) { - Relation &R = const_cast(R_); - Conjunct *c = R.single_conjunct(); - - int min_cost = INT_MAX; - EQ_Handle eq; - for (EQ_Iterator ei(c->EQs()); ei; ei++) - if (!(*ei).has_wildcards() && (*ei).get_coef(v) != 0) { - int cost = 0; - - if (abs((*ei).get_coef(v)) != 1) - cost += 4; // divide cost - - int num_var = 0; - for (Constr_Vars_Iter cvi(*ei); cvi; cvi++) - if ((*cvi).var != v) { - num_var++; - if ((*cvi).var->kind() == Global_Var && (*cvi).var->get_global_var()->arity() > 0) { - cost += 10; // function cost - } - if (abs((*cvi).coef) != 1) - cost += 2; // multiply cost - if ((*cvi).var->kind() == Input_Var && assigned_on_the_fly[(*cvi).var->get_position()-1] != NULL) { - cost += 5; // substituted variable cost - } - } - if ((*ei).get_const() != 0) - num_var++; - if (num_var > 1) - cost += num_var - 1; // addition cost - - if (cost < min_cost) { - min_cost = cost; - eq = *ei; - } - } - - return std::make_pair(eq, min_cost); -} - -int max_fs_arity(const Constraint_Handle &c) { - int max_arity=0; - for(Constr_Vars_Iter cv(c); cv; cv++) - if((*cv).var->kind() == Global_Var) - max_arity = max(max_arity,(*cv).var->get_global_var()->arity()); - return max_arity; -} - -} diff --git a/omega/code_gen/src/rose_attributes.cc b/omega/code_gen/src/rose_attributes.cc deleted file mode 100644 index bb9681c..0000000 --- a/omega/code_gen/src/rose_attributes.cc +++ /dev/null @@ -1,183 +0,0 @@ -#include - -namespace omega { - -CodeInsertionAttribute* getOrCreateCodeInsertionAttribute(SgNode* node) { - CodeInsertionAttribute* attr; - if(node->attributeExists("code_insertion")) - return static_cast(node->getAttribute("code_insertion")); - attr = new CodeInsertionAttribute(); - node->setAttribute("code_insertion", attr); - return attr; -} - -void postProcessRoseCodeInsertion(SgProject* proj) { - //generatePDF(*proj); - CodeInsertionVisitor visitor = CodeInsertionVisitor(); - visitor.initialize(); - visitor.traverseInputFiles(proj); - visitor.insertCode(); -} - -// Swap a code insertion from one node (sn) to another (dn) -// -- note that this function does not currently remove the insertion from the sn node -void moveCodeInsertion(SgNode* sn, CodeInsertion* ci, SgNode* dn) { - CodeInsertionAttribute* new_attr; - // TODO in the near future: replace the above statement with 'new_attr = getOrCreateCodeInsertionAttribute(...)' - CodeInsertionAttribute* old_attr = static_cast(sn->getAttribute("code_insertion")); - if(dn->attributeExists("code_insertion")) { - new_attr = static_cast(dn->getAttribute("code_insertion")); - } - else { - new_attr = new CodeInsertionAttribute(); - dn->setAttribute("code_insertion", new_attr); - } - new_attr->add(ci); -} - -// A function that copies a specific attribute from one node to another -// this function exists to get around a ROSE limitation that does not -// copy attributes -void copyAttribute(std::string attr_name, SgNode* s, SgNode* d) { - if(s->attributeExists(attr_name)) { - d->setAttribute(attr_name,s->getAttribute(attr_name)); - } -} - -// TODO: find all existng attributes and iterate over them instead of doing them -// individually -void copyAttributes(SgNode* s, SgNode* d) { - copyAttribute("code_insertion", s, d); - //...any other attributes... -} - -void CodeInsertionVisitor::initialize() { - this->loop_level = 0; - this->ci_marks = std::vector(); -} - -void CodeInsertionVisitor::markStmt(SgStatement* stmt, CodeInsertion* ci) { - // this check prevents multiple copies of stmts - // -- may be changed in the future - if(!ci->marked) { - CodeInsertionMark* pos = new CodeInsertionMark(); - pos->stmt = stmt; - pos->ci = ci; - this->ci_marks.push_back(pos); - ci->marked = true; - } -} - -// increase loop_level as the visitor descends -void CodeInsertionVisitor::preOrderVisit(SgNode* n) { - if (isSgForStatement(n)) { - this->loop_level++; - } -} - -void CodeInsertionVisitor::postOrderVisit(SgNode* n) { - if(isSgForStatement(n)) { - this->loop_level--; - } - if(isSgStatement(n)) { - if(n->attributeExists("code_insertion")) { - CodeInsertionAttribute *attr = static_cast(n->getAttribute("code_insertion")); - for(CodeInsertionPtrListItr itr = attr->begin(); itr != attr->end(); ++itr) { - CodeInsertion *insertion = *itr; - // check loop level -- if it is equivelent, mark statement for insertion - // -- else, move attribute up to parent - if(insertion->loop_level != this->loop_level) { - moveCodeInsertion(n, insertion, n->get_parent()); - } - else { - this->markStmt(isSgStatement(n), insertion); - } - } - } - } -} - -// final stage of algorithm that inserts marked statements -void CodeInsertionVisitor::insertCode() { - for(std::vector::iterator itr = this->ci_marks.begin(); itr != this->ci_marks.end(); ++itr) { - CodeInsertionMark* mark = *itr; - SgScopeStatement* scope = static_cast(mark->stmt->get_parent()); - SageInterface::insertStatementBefore(mark->stmt, mark->ci->getStatement(scope)); - } -} - -SgStatement* PragmaInsertion::getStatement(SgScopeStatement* scopeStmt) { - SgStatement* stmt = SageBuilder::buildPragmaDeclaration(this->name); - return stmt; -} - -//SgStatement* MMPrefetchInsertion::getStatement(SgScopeStatement* scopeStmt) { -// const SgName& name = SgName("_mm_prefetch"); -// SgType* rtype = SageBuilder::buildVoidType(); -// SgExpression* arr_arg = SageBuilder::buildVarRefExp(this->arrName); -// SgExpression* hint_arg = SageBuilder::buildShortVal(this->cacheHint); -// SgExprListExp* args = SageBuilder::buildExprListExp(arr_arg,hint_arg); -// SgStatement* stmt = SageBuilder::buildFunctionCallStmt(name, rtype, args, scopeStmt); -// return stmt; -//} - -SgStatement* MMPrefetchInsertion::getStatement(SgScopeStatement* scopeStmt) { - const SgName fname = SgName("_mm_prefetch"); - SgType* rtype = SageBuilder::buildVoidType(); - SgExpression* arr_arg = this->buildArrArg(scopeStmt); - SgExpression* hint_arg = SageBuilder::buildShortVal(this->cacheHint); - SgExprListExp* args = SageBuilder::buildExprListExp(arr_arg, hint_arg); - return SageBuilder::buildFunctionCallStmt(fname, rtype, args, scopeStmt); -} - -SgExpression* MMPrefetchInsertion::buildArrArg(SgScopeStatement* scopeStmt) { - // if there are no index arguments given, just return a variable reference - if(this->indexCount == 0) { - const SgName aname = SgName(this->arrName); - return SageBuilder::buildVarRefExp(aname, scopeStmt); - } - std::vector argList = std::vector(); - // foreach dimension - for(int i = 0; i < this->indexCount; i++) { - argList.push_back(this->makeIndexExp(i, scopeStmt)); - } - return SageBuilder::buildExprListExp(argList); -} - -SgExpression* MMPrefetchInsertion::makeIndexExp(int dim, SgScopeStatement* scopeStmt) { - //(i + offset) or (offset) or (i) - std::string* indexer = this->indecies.at(dim); - int offset = this->offsets.at(dim); - if(indexer == NULL) { - return SageBuilder::buildIntVal(offset); - } - else { - const SgName name = SgName(*indexer); - SgVarRefExp* iref = SageBuilder::buildVarRefExp(name, scopeStmt); - if(offset == 0) { - return iref; - } - else { - return SageBuilder::buildAddOp(iref, SageBuilder::buildIntVal(offset)); - } - } -} - -void MMPrefetchInsertion::initialize(const std::string& arrName, int hint) { - this->arrName = std::string(arrName); - this->cacheHint = hint; - this->indecies = std::vector(); - this->offsets = std::vector(); - this->indexCount = 0; -} -void MMPrefetchInsertion::addDim(int offset) { - this->offsets.push_back(offset); - this->indecies.push_back(NULL); - this->indexCount++; -} -void MMPrefetchInsertion::addDim(int offset, const std::string& indexer) { - this->offsets.push_back(offset); - this->indecies.push_back(new std::string(indexer)); - this->indexCount++; -} -} diff --git a/omega/code_gen/src/tags b/omega/code_gen/src/tags deleted file mode 100644 index a69c38b..0000000 --- a/omega/code_gen/src/tags +++ /dev/null @@ -1,158 +0,0 @@ -!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ -!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ -!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/ -!_TAG_PROGRAM_NAME Exuberant Ctags // -!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/ -!_TAG_PROGRAM_VERSION 5.8 // -CG_split CG.cc /^CG_split::CG_split(IntTuple &active, int lvl, const Relation &cond_, CG_result *T, CG_result *F) { $/;" f class:omega::CG_split -CG_stringRepr CG_stringRepr.cc /^CG_stringRepr::CG_stringRepr() {$/;" f class:omega::CG_stringRepr -CG_stringRepr CG_stringRepr.cc /^CG_stringRepr::CG_stringRepr(const std::string& _s) : s(_s) {$/;" f class:omega::CG_stringRepr -CG_suifRepr CG_suifRepr.cc /^CG_suifRepr::CG_suifRepr(): tnl_(NULL), op_() {$/;" f class:omega::CG_suifRepr -CG_suifRepr CG_suifRepr.cc /^CG_suifRepr::CG_suifRepr(operand op): tnl_(NULL), op_(op) {$/;" f class:omega::CG_suifRepr -CG_suifRepr CG_suifRepr.cc /^CG_suifRepr::CG_suifRepr(tree_node_list *tnl): tnl_(tnl),op_() {$/;" f class:omega::CG_suifRepr -CreateAnd CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateAnd(CG_outputRepr* lop, CG_outputRepr* rop) const {$/;" f class:omega::CG_stringBuilder -CreateAnd CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateAnd(CG_outputRepr *lop,$/;" f class:omega::CG_suifBuilder -CreateAssignment CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateAssignment(int indent, $/;" f class:omega::CG_stringBuilder -CreateAssignment CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateAssignment(int, CG_outputRepr *lhs,$/;" f class:omega::CG_suifBuilder -CreateComment CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateComment(int indent, const std::string &commentText) const {$/;" f class:omega::CG_stringBuilder -CreateComment CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateComment(int, const std::string &commentText) const {$/;" f class:omega::CG_suifBuilder -CreateEQ CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateEQ(CG_outputRepr* lop, CG_outputRepr* rop) const {$/;" f class:omega::CG_stringBuilder -CreateEQ CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateEQ(CG_outputRepr *lop,$/;" f class:omega::CG_suifBuilder -CreateGE CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateGE(CG_outputRepr* lop, CG_outputRepr* rop) const {$/;" f class:omega::CG_stringBuilder -CreateGE CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateGE(CG_outputRepr *lop,$/;" f class:omega::CG_suifBuilder -CreateIdent CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateIdent(const std::string &_s) const {$/;" f class:omega::CG_stringBuilder -CreateIdent CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateIdent(const std::string &_s) const {$/;" f class:omega::CG_suifBuilder -CreateIf CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateIf(int indent, CG_outputRepr* guardList,$/;" f class:omega::CG_stringBuilder -CreateIf CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateIf(int, CG_outputRepr *guardList,$/;" f class:omega::CG_suifBuilder -CreateInductive CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateInductive(CG_outputRepr* index,$/;" f class:omega::CG_stringBuilder -CreateInductive CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateInductive(CG_outputRepr *index,$/;" f class:omega::CG_suifBuilder -CreateInt CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateInt(int _i) const {$/;" f class:omega::CG_stringBuilder -CreateInt CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateInt(int _i) const {$/;" f class:omega::CG_suifBuilder -CreateIntegerCeil CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateIntegerCeil(CG_outputRepr* lop, CG_outputRepr* rop) const {$/;" f class:omega::CG_stringBuilder -CreateIntegerDivide CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateIntegerDivide(CG_outputRepr* lop, CG_outputRepr* rop) const {$/;" f class:omega::CG_stringBuilder -CreateIntegerDivide CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateIntegerDivide(CG_outputRepr *lop,$/;" f class:omega::CG_suifBuilder -CreateIntegerMod CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateIntegerMod(CG_outputRepr* lop, CG_outputRepr* rop) const {$/;" f class:omega::CG_stringBuilder -CreateIntegerMod CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateIntegerMod(CG_outputRepr *lop,$/;" f class:omega::CG_suifBuilder -CreateInvoke CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateInvoke(const std::string &fname,$/;" f class:omega::CG_stringBuilder -CreateInvoke CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateInvoke(const std::string &fname,$/;" f class:omega::CG_suifBuilder -CreateLE CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateLE(CG_outputRepr* lop, CG_outputRepr* rop) const {$/;" f class:omega::CG_stringBuilder -CreateLE CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateLE(CG_outputRepr *lop,$/;" f class:omega::CG_suifBuilder -CreateLoop CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateLoop(int indent, CG_outputRepr* control,$/;" f class:omega::CG_stringBuilder -CreateLoop CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateLoop(int, CG_outputRepr *control,$/;" f class:omega::CG_suifBuilder -CreateMinus CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateMinus(CG_outputRepr* lop, CG_outputRepr* rop) const {$/;" f class:omega::CG_stringBuilder -CreateMinus CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateMinus(CG_outputRepr *lop,$/;" f class:omega::CG_suifBuilder -CreatePlaceHolder CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreatePlaceHolder(int indent, CG_outputRepr *stmt,$/;" f class:omega::CG_stringBuilder -CreatePlaceHolder CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreatePlaceHolder (int, CG_outputRepr *stmt,$/;" f class:omega::CG_suifBuilder -CreatePlus CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreatePlus(CG_outputRepr* lop, CG_outputRepr* rop) const {$/;" f class:omega::CG_stringBuilder -CreatePlus CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreatePlus(CG_outputRepr *lop,$/;" f class:omega::CG_suifBuilder -CreateTimes CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateTimes(CG_outputRepr* lop, CG_outputRepr* rop) const {$/;" f class:omega::CG_stringBuilder -CreateTimes CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateTimes(CG_outputRepr *lop,$/;" f class:omega::CG_suifBuilder -Dump CG_stringRepr.cc /^void CG_stringRepr::Dump() const {$/;" f class:omega::CG_stringRepr -Dump CG_suifRepr.cc /^void CG_suifRepr::Dump() const {$/;" f class:omega::CG_suifRepr -DumpToFile CG_stringRepr.cc /^void CG_stringRepr::DumpToFile(FILE *fp) const {$/;" f class:omega::CG_stringRepr -DumpToFile CG_suifRepr.cc /^void CG_suifRepr::DumpToFile(FILE *fp) const {$/;" f class:omega::CG_suifRepr -GetCode CG_suifRepr.cc /^tree_node_list* CG_suifRepr::GetCode() const {$/;" f class:omega::CG_suifRepr -GetExpression CG_suifRepr.cc /^operand CG_suifRepr::GetExpression() const {$/;" f class:omega::CG_suifRepr -GetIndentSpaces CG_stringBuilder.cc /^std::string GetIndentSpaces(int indent) {$/;" f namespace:omega -GetString CG_stringBuilder.cc /^std::string GetString(CG_outputRepr* repr) {$/;" f namespace:omega -GetString CG_stringRepr.cc /^std::string CG_stringRepr::GetString() const { $/;" f class:omega::CG_stringRepr -JunkStaticInit code_gen.cc /^class JunkStaticInit{ public: JunkStaticInit(){ checkLoopLevel=0; fillInBounds=false;} };$/;" c namespace:omega file: -JunkStaticInit code_gen.cc /^class JunkStaticInit{ public: JunkStaticInit(){ checkLoopLevel=0; fillInBounds=false;} };$/;" f class:omega::JunkStaticInit -MMGenerateCode code_gen.cc /^CG_outputRepr* MMGenerateCode(CG_outputBuilder* ocg, RelTuple &T, SetTuple &old_IS, $/;" f namespace:omega -MMGenerateCode code_gen.cc /^CG_outputRepr* MMGenerateCode(CG_outputBuilder* ocg, RelTuple &T, SetTuple &old_IS, const Tuple &stmt_content, Relation &known, int effort) {$/;" f namespace:omega -MMGenerateCode code_gen.cc /^std::string MMGenerateCode(RelTuple &T, SetTuple &old_IS, Relation &known, int effort) {$/;" f namespace:omega -SafeguardString CG_stringBuilder.cc /^static std::string SafeguardString(const std::string &s, char op) {$/;" f namespace:omega -StmtListAppend CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::StmtListAppend(CG_outputRepr* list1, CG_outputRepr* list2) const {$/;" f class:omega::CG_stringBuilder -StmtListAppend CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::StmtListAppend(CG_outputRepr *list1, $/;" f class:omega::CG_suifBuilder -boundHitsStride output_repr.cc /^bool boundHitsStride(const GEQ_Handle &g, Variable_ID v,$/;" f namespace:omega -checkLoopLevel code_gen.cc /^int checkLoopLevel;$/;" m namespace:omega file: -clear CG_suifRepr.cc /^void CG_suifRepr::clear() {$/;" f class:omega::CG_suifRepr -clone CG_stringRepr.cc /^CG_outputRepr* CG_stringRepr::clone() {$/;" f class:omega::CG_stringRepr -clone CG_suifRepr.cc /^CG_outputRepr* CG_suifRepr::clone() {$/;" f class:omega::CG_suifRepr -code_gen_debug code_gen.cc /^int code_gen_debug=0;$/;" m namespace:omega file: -countStrides output_repr.cc /^int countStrides(Conjunct *c, Variable_ID v, EQ_Handle &strideEQ, $/;" f namespace:omega -create_stride_on_bound output_repr.cc /^Relation create_stride_on_bound(int n, const std::map &lb, coef_t stride) {$/;" f namespace:omega::__anon2 -exit_code_gen CG_suifBuilder.cc /^void exit_code_gen(void) {$/;" f namespace:omega -extract_function_symbols code_gen.cc /^RelTuple extract_function_symbols(SetTuple &sets) {$/;" f namespace:omega -fillInBounds code_gen.cc /^bool fillInBounds;$/;" m namespace:omega file: -filter_function_symbols code_gen.cc /^SetTuple filter_function_symbols(SetTuple &sets, bool keep_fs){$/;" f namespace:omega -findFloorInequality output_repr.cc /^bool findFloorInequality(Relation &r, Variable_ID v, GEQ_Handle &h, Variable_ID excluded) {$/;" f namespace:omega -findOverhead CG.cc /^Relation CG_leaf::findOverhead(int liftTo) {$/;" f class:omega::CG_leaf -findOverhead CG.cc /^Relation CG_loop::findOverhead(int liftTo) {$/;" f class:omega::CG_loop -findOverhead CG.cc /^Relation CG_split::findOverhead(int liftTo) {$/;" f class:omega::CG_split -find_any_constraint output_repr.cc /^bool find_any_constraint(int s, int level, Relation &kr, int direction,$/;" f namespace:omega -find_simplest_assignment output_repr.cc /^std::pair find_simplest_assignment(const Relation &R_, Variable_ID v, const std::vector &assigned_on_the_fly) {$/;" f namespace:omega -force_finite_bounds CG.cc /^CG_result * CG_loop::force_finite_bounds() {$/;" f class:omega::CG_loop -force_finite_bounds CG.cc /^CG_result * CG_split::force_finite_bounds() {$/;" f class:omega::CG_split -gen_recursive code_gen.cc /^CG_result *gen_recursive(int level, IntTuple &isActive) {$/;" f namespace:omega -get_stride output_repr.cc /^void get_stride(const Constraint_Handle &h, Variable_ID &wc, coef_t &step){$/;" f namespace:omega::__anon1 -greatest_common_step output_repr.cc /^Relation greatest_common_step(const Tuple &I, const Tuple &active, int level, const Relation &known) {$/;" f namespace:omega -hasBound output_repr.cc /^bool hasBound(Relation r, int level, int UB) {$/;" f namespace:omega -hasEQ output_repr.cc /^bool hasEQ(Relation r, int level) {$/;" f namespace:omega::__anon3 -has_nonstride_EQ output_repr.cc /^bool has_nonstride_EQ(Relation r, int level) {$/;" f namespace:omega -hoistGuard CG.cc /^Relation CG_leaf::hoistGuard() {$/;" f class:omega::CG_leaf -hoistGuard CG.cc /^Relation CG_loop::hoistGuard() {$/;" f class:omega::CG_loop -hoistGuard CG.cc /^Relation CG_split::hoistGuard() {$/;" f class:omega::CG_split -init_code_gen CG_suifBuilder.cc /^void init_code_gen(int&, char* []) {$/;" f namespace:omega -isSimpleStride output_repr.cc /^bool isSimpleStride(const EQ_Handle &g, Variable_ID v) {$/;" f namespace:omega -junkInitInstance__ code_gen.cc /^static JunkStaticInit junkInitInstance__;$/;" m namespace:omega file: -k_ocg_comment CG_suifBuilder.cc /^char *k_ocg_comment;$/;" m namespace:omega file: -last_level code_gen.cc /^int last_level;\/\/ Should not be global, but it is.$/;" m namespace:omega file: -libcode_gen_suif_string CG_suifBuilder.cc /^const char *libcode_gen_suif_string = "";$/;" m namespace:omega file: -libcode_gen_ver_string CG_suifBuilder.cc /^const char *libcode_gen_ver_string = "";$/;" m namespace:omega file: -libcode_gen_who_string CG_suifBuilder.cc /^const char *libcode_gen_who_string = "";$/;" m namespace:omega file: -liftOverhead CG.cc /^CG_result * CG_loop::liftOverhead(int depth) {$/;" f class:omega::CG_loop -liftOverhead CG.cc /^CG_result * CG_split::liftOverhead(int depth) {$/;" f class:omega::CG_split -loopIdxNames code_gen.cc /^Tuple< Tuple > loopIdxNames;\/\/per stmt$/;" m namespace:omega file: -lowerBoundForLevel code_gen.cc /^int lowerBoundForLevel;$/;" m namespace:omega file: -max_fs_arity output_repr.cc /^int max_fs_arity(const Constraint_Handle &c) {$/;" f namespace:omega -minMaxOverhead output_repr.cc /^Relation minMaxOverhead(Relation r, int level) {$/;" f namespace:omega -new_IS code_gen.cc /^SetTuple new_IS;$/;" m namespace:omega file: -omega CG.cc /^namespace omega {$/;" n file: -omega CG_stringBuilder.cc /^namespace omega {$/;" n file: -omega CG_stringRepr.cc /^namespace omega {$/;" n file: -omega CG_suifBuilder.cc /^namespace omega {$/;" n file: -omega CG_suifRepr.cc /^namespace omega {$/;" n file: -omega code_gen.cc /^namespace omega {$/;" n file: -omega output_repr.cc /^namespace omega {$/;" n file: -outputAssignment output_repr.cc /^std::pair outputAssignment(CG_outputBuilder *ocg, const Relation &R_, Variable_ID v, Relation &enforced, CG_outputRepr *&if_repr, const std::vector &assigned_on_the_fly) {$/;" f namespace:omega -outputBounds output_repr.cc /^std::pair outputBounds(CG_outputBuilder* ocg, const Relation &bounds, Variable_ID v, int indent, Relation &enforced, const std::vector &assigned_on_the_fly) {$/;" f namespace:omega -outputEasyBoundAsRepr output_repr.cc /^CG_outputRepr* outputEasyBoundAsRepr(CG_outputBuilder* ocg, Relation &bounds,$/;" f namespace:omega -outputGuard output_repr.cc /^CG_outputRepr *outputGuard(CG_outputBuilder* ocg, const Relation &guards_in, const std::vector &assigned_on_the_fly) {$/;" f namespace:omega -outputIdent output_repr.cc /^CG_outputRepr* outputIdent(CG_outputBuilder* ocg, const Relation &R_, Variable_ID v, const std::vector &assigned_on_the_fly) {$/;" f namespace:omega -outputLBasRepr output_repr.cc /^CG_outputRepr *outputLBasRepr(CG_outputBuilder* ocg, const GEQ_Handle &g, $/;" f namespace:omega -outputStatement output_repr.cc /^CG_outputRepr* outputStatement(CG_outputBuilder *ocg, CG_outputRepr *stmt, int indent, const Relation &mapping_, const Relation &known_, const std::vector &assigned_on_the_fly) {$/;" f namespace:omega -outputSubstitution output_repr.cc /^Tuple outputSubstitution(CG_outputBuilder* ocg, const Relation &R_, const std::vector &assigned_on_the_fly) {$/;" f namespace:omega -outputUBasRepr output_repr.cc /^CG_outputRepr *outputUBasRepr(CG_outputBuilder* ocg, const GEQ_Handle &g, $/;" f namespace:omega -output_EQ_strides output_repr.cc /^CG_outputRepr *output_EQ_strides(CG_outputBuilder* ocg, const Relation &guards_in, const std::vector &assigned_on_the_fly) {$/;" f namespace:omega -output_GEQ_strides output_repr.cc /^CG_outputRepr *output_GEQ_strides(CG_outputBuilder* ocg, const Relation &guards_in, const std::vector &assigned_on_the_fly) {$/;" f namespace:omega -output_as_guard output_repr.cc /^CG_outputRepr* output_as_guard(CG_outputBuilder* ocg, const Relation &guards_in, Constraint_Handle e, bool is_equality, const std::vector &assigned_on_the_fly) {$/;" f namespace:omega -pickBound output_repr.cc /^Relation pickBound(Relation r, int level, int UB) {$/;" f namespace:omega::__anon3 -pickEQ output_repr.cc /^static Relation pickEQ(Relation r, int level) {$/;" f namespace:omega::__anon3 -pickOverhead output_repr.cc /^Relation pickOverhead(Relation r, int liftTo) {$/;" f namespace:omega -print CG.cc /^std::string CG_result::print(int indent) {$/;" f class:omega::CG_result -printRepr CG.cc /^CG_outputRepr* CG_leaf::printRepr(CG_outputBuilder* ocg, int indent, const std::vector &assigned_on_the_fly) {$/;" f class:omega::CG_leaf -printRepr CG.cc /^CG_outputRepr* CG_loop::printRepr(CG_outputBuilder* ocg, int indent, const std::vector &assigned_on_the_fly) {$/;" f class:omega::CG_loop -printRepr CG.cc /^CG_outputRepr* CG_split::printRepr(CG_outputBuilder* ocg, int indent, const std::vector &assigned_on_the_fly) {$/;" f class:omega::CG_split -printStructure CG.cc /^std::string CG_leaf::printStructure(int) {$/;" f class:omega::CG_leaf -printStructure CG.cc /^std::string CG_loop::printStructure(int indent) {$/;" f class:omega::CG_loop -printStructure CG.cc /^std::string CG_split::printStructure(int indent) {$/;" f class:omega::CG_split -project_onto_levels output_repr.cc /^Relation project_onto_levels(Relation R, int last_level, bool wildcards) {$/;" f namespace:omega -projected_nIS code_gen.cc /^SetTupleTuple projected_nIS;$/;" m namespace:omega file: -recompute CG.cc /^CG_result * CG_loop::recompute(const Relation &k, const Relation &r) {$/;" f class:omega::CG_loop -recompute CG.cc /^CG_result * CG_split::recompute(const Relation &k, const Relation &r) {$/;" f class:omega::CG_split -recompute CG.cc /^CG_result* CG_leaf::recompute(const Relation &k, const Relation &r) {$/;" f class:omega::CG_leaf -removeGuard CG.cc /^void CG_leaf::removeGuard() {$/;" f class:omega::CG_leaf -smtNonSplitLevels code_gen.cc /^Tuple< IntTuple > smtNonSplitLevels;$/;" m namespace:omega file: -statementInfo code_gen.cc /^Tuple statementInfo;$/;" m namespace:omega file: -stmtForLoopCheck code_gen.cc /^int stmtForLoopCheck;$/;" m namespace:omega file: -strip_function_symbols code_gen.cc /^RelTuple strip_function_symbols(SetTuple &sets) {$/;" f namespace:omega -substitute CG_suifBuilder.cc /^bool substitute(instruction *in, var_sym *sym, operand expr, base_symtab *st) {$/;" f namespace:omega -substitute CG_suifBuilder.cc /^bool substitute(tree_node *tn, var_sym *sym, operand expr, base_symtab *st) {$/;" f namespace:omega -substitute CG_suifBuilder.cc /^bool substitute(tree_node_list *tnl, var_sym *sym, operand expr,$/;" f namespace:omega -syncs code_gen.cc /^std::vector< std::pair > syncs;$/;" m namespace:omega file: -transformations code_gen.cc /^RelTuple transformations;$/;" m namespace:omega file: -upperBoundForLevel code_gen.cc /^int upperBoundForLevel;$/;" m namespace:omega file: -var_substitution_threshold output_repr.cc /^int var_substitution_threshold = 4;$/;" m namespace:omega file: -~CG_stringRepr CG_stringRepr.cc /^CG_stringRepr::~CG_stringRepr() {$/;" f class:omega::CG_stringRepr -~CG_suifRepr CG_suifRepr.cc /^CG_suifRepr::~CG_suifRepr() {$/;" f class:omega::CG_suifRepr diff --git a/omega/compile b/omega/compile deleted file mode 100755 index 531136b..0000000 --- a/omega/compile +++ /dev/null @@ -1,347 +0,0 @@ -#! /bin/sh -# Wrapper for compilers which do not understand '-c -o'. - -scriptversion=2012-10-14.11; # UTC - -# Copyright (C) 1999-2013 Free Software Foundation, Inc. -# Written by Tom Tromey . -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -nl=' -' - -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent tools from complaining about whitespace usage. -IFS=" "" $nl" - -file_conv= - -# func_file_conv build_file lazy -# Convert a $build file to $host form and store it in $file -# Currently only supports Windows hosts. If the determined conversion -# type is listed in (the comma separated) LAZY, no conversion will -# take place. -func_file_conv () -{ - file=$1 - case $file in - / | /[!/]*) # absolute file, and not a UNC file - if test -z "$file_conv"; then - # lazily determine how to convert abs files - case `uname -s` in - MINGW*) - file_conv=mingw - ;; - CYGWIN*) - file_conv=cygwin - ;; - *) - file_conv=wine - ;; - esac - fi - case $file_conv/,$2, in - *,$file_conv,*) - ;; - mingw/*) - file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` - ;; - cygwin/*) - file=`cygpath -m "$file" || echo "$file"` - ;; - wine/*) - file=`winepath -w "$file" || echo "$file"` - ;; - esac - ;; - esac -} - -# func_cl_dashL linkdir -# Make cl look for libraries in LINKDIR -func_cl_dashL () -{ - func_file_conv "$1" - if test -z "$lib_path"; then - lib_path=$file - else - lib_path="$lib_path;$file" - fi - linker_opts="$linker_opts -LIBPATH:$file" -} - -# func_cl_dashl library -# Do a library search-path lookup for cl -func_cl_dashl () -{ - lib=$1 - found=no - save_IFS=$IFS - IFS=';' - for dir in $lib_path $LIB - do - IFS=$save_IFS - if $shared && test -f "$dir/$lib.dll.lib"; then - found=yes - lib=$dir/$lib.dll.lib - break - fi - if test -f "$dir/$lib.lib"; then - found=yes - lib=$dir/$lib.lib - break - fi - if test -f "$dir/lib$lib.a"; then - found=yes - lib=$dir/lib$lib.a - break - fi - done - IFS=$save_IFS - - if test "$found" != yes; then - lib=$lib.lib - fi -} - -# func_cl_wrapper cl arg... -# Adjust compile command to suit cl -func_cl_wrapper () -{ - # Assume a capable shell - lib_path= - shared=: - linker_opts= - for arg - do - if test -n "$eat"; then - eat= - else - case $1 in - -o) - # configure might choose to run compile as 'compile cc -o foo foo.c'. - eat=1 - case $2 in - *.o | *.[oO][bB][jJ]) - func_file_conv "$2" - set x "$@" -Fo"$file" - shift - ;; - *) - func_file_conv "$2" - set x "$@" -Fe"$file" - shift - ;; - esac - ;; - -I) - eat=1 - func_file_conv "$2" mingw - set x "$@" -I"$file" - shift - ;; - -I*) - func_file_conv "${1#-I}" mingw - set x "$@" -I"$file" - shift - ;; - -l) - eat=1 - func_cl_dashl "$2" - set x "$@" "$lib" - shift - ;; - -l*) - func_cl_dashl "${1#-l}" - set x "$@" "$lib" - shift - ;; - -L) - eat=1 - func_cl_dashL "$2" - ;; - -L*) - func_cl_dashL "${1#-L}" - ;; - -static) - shared=false - ;; - -Wl,*) - arg=${1#-Wl,} - save_ifs="$IFS"; IFS=',' - for flag in $arg; do - IFS="$save_ifs" - linker_opts="$linker_opts $flag" - done - IFS="$save_ifs" - ;; - -Xlinker) - eat=1 - linker_opts="$linker_opts $2" - ;; - -*) - set x "$@" "$1" - shift - ;; - *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) - func_file_conv "$1" - set x "$@" -Tp"$file" - shift - ;; - *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) - func_file_conv "$1" mingw - set x "$@" "$file" - shift - ;; - *) - set x "$@" "$1" - shift - ;; - esac - fi - shift - done - if test -n "$linker_opts"; then - linker_opts="-link$linker_opts" - fi - exec "$@" $linker_opts - exit 1 -} - -eat= - -case $1 in - '') - echo "$0: No command. Try '$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: compile [--help] [--version] PROGRAM [ARGS] - -Wrapper for compilers which do not understand '-c -o'. -Remove '-o dest.o' from ARGS, run PROGRAM with the remaining -arguments, and rename the output as expected. - -If you are trying to build a whole package this is not the -right script to run: please start by reading the file 'INSTALL'. - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "compile $scriptversion" - exit $? - ;; - cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) - func_cl_wrapper "$@" # Doesn't return... - ;; -esac - -ofile= -cfile= - -for arg -do - if test -n "$eat"; then - eat= - else - case $1 in - -o) - # configure might choose to run compile as 'compile cc -o foo foo.c'. - # So we strip '-o arg' only if arg is an object. - eat=1 - case $2 in - *.o | *.obj) - ofile=$2 - ;; - *) - set x "$@" -o "$2" - shift - ;; - esac - ;; - *.c) - cfile=$1 - set x "$@" "$1" - shift - ;; - *) - set x "$@" "$1" - shift - ;; - esac - fi - shift -done - -if test -z "$ofile" || test -z "$cfile"; then - # If no '-o' option was seen then we might have been invoked from a - # pattern rule where we don't need one. That is ok -- this is a - # normal compilation that the losing compiler can handle. If no - # '.c' file was seen then we are probably linking. That is also - # ok. - exec "$@" -fi - -# Name of file we expect compiler to create. -cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` - -# Create the lock directory. -# Note: use '[/\\:.-]' here to ensure that we don't use the same name -# that we are using for the .o file. Also, base the name on the expected -# object file name, since that is what matters with a parallel build. -lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d -while true; do - if mkdir "$lockdir" >/dev/null 2>&1; then - break - fi - sleep 1 -done -# FIXME: race condition here if user kills between mkdir and trap. -trap "rmdir '$lockdir'; exit 1" 1 2 15 - -# Run the compile. -"$@" -ret=$? - -if test -f "$cofile"; then - test "$cofile" = "$ofile" || mv "$cofile" "$ofile" -elif test -f "${cofile}bj"; then - test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" -fi - -rmdir "$lockdir" -exit $ret - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/omega/configure b/omega/configure deleted file mode 100755 index 20a4dfd..0000000 --- a/omega/configure +++ /dev/null @@ -1,6643 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for omega 0.1.0. -# -# -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. -# -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -# Use a proper internal environment variable to ensure we don't fall - # into an infinite loop, continuously re-executing ourselves. - if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then - _as_can_reexec=no; export _as_can_reexec; - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 - fi - # We don't want this to propagate to other subprocesses. - { _as_can_reexec=; unset _as_can_reexec;} -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1 -test -x / || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : - break 2 -fi -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - export CONFIG_SHELL - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a shell if you do have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # If we had to re-execute with $CONFIG_SHELL, we're ensured to have - # already done that, so ensure we don't try to do so again and fall - # in an infinite loop. This has already happened in practice. - _as_can_reexec=no; export _as_can_reexec - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -test -n "$DJDIR" || exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= - -# Identity of this package. -PACKAGE_NAME='omega' -PACKAGE_TARNAME='omega' -PACKAGE_VERSION='0.1.0' -PACKAGE_STRING='omega 0.1.0' -PACKAGE_BUGREPORT='' -PACKAGE_URL='' - -ac_subst_vars='am__EXEEXT_FALSE -am__EXEEXT_TRUE -LTLIBOBJS -LIBOBJS -BOOSTHOME -ROSEHOME -YFLAGS -YACC -RANLIB -am__fastdepCXX_FALSE -am__fastdepCXX_TRUE -CXXDEPMODE -ac_ct_CXX -CXXFLAGS -CXX -LEXLIB -LEX_OUTPUT_ROOT -LEX -am__fastdepCC_FALSE -am__fastdepCC_TRUE -CCDEPMODE -am__nodep -AMDEPBACKSLASH -AMDEP_FALSE -AMDEP_TRUE -am__quote -am__include -DEPDIR -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -ac_ct_AR -AR -CCLD -AM_BACKSLASH -AM_DEFAULT_VERBOSITY -AM_DEFAULT_V -AM_V -am__untar -am__tar -AMTAR -am__leading_dot -SET_MAKE -AWK -mkdir_p -MKDIR_P -INSTALL_STRIP_PROGRAM -STRIP -install_sh -MAKEINFO -AUTOHEADER -AUTOMAKE -AUTOCONF -ACLOCAL -VERSION -PACKAGE -CYGPATH_W -am__isrc -INSTALL_DATA -INSTALL_SCRIPT -INSTALL_PROGRAM -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_URL -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -enable_silent_rules -enable_dependency_tracking -with_rose -with_boost -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CXX -CXXFLAGS -CCC -YACC -YFLAGS' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *=) ac_optarg= ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures omega 0.1.0 to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/omega] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -Program names: - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM run sed PROGRAM on installed program names -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of omega 0.1.0:";; - esac - cat <<\_ACEOF - -Optional Features: - --disable-option-checking ignore unrecognized --enable/--with options - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-silent-rules less verbose build output (undo: "make V=1") - --disable-silent-rules verbose build output (undo: "make V=0") - --enable-dependency-tracking - do not reject slow dependency extractors - --disable-dependency-tracking - speeds up one-time build - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - - --with-rose set rose home - - - --with-boost set boost home - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CXX C++ compiler command - CXXFLAGS C++ compiler flags - YACC The `Yet Another Compiler Compiler' implementation to use. - Defaults to the first program found out of: `bison -y', `byacc', - `yacc'. - YFLAGS The list of arguments that will be passed by default to $YACC. - This script will default YFLAGS to the empty string to avoid a - default value of `-d' given by some make applications. - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to the package provider. -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -omega configure 0.1.0 -generated by GNU Autoconf 2.69 - -Copyright (C) 2012 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - -# ac_fn_cxx_try_compile LINENO -# ---------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_compile -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by omega $as_me 0.1.0, which was -generated by GNU Autoconf 2.69. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" - done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; - 2) - as_fn_append ac_configure_args1 " '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - as_fn_append ac_configure_args " '$ac_arg'" - ;; - esac - done -done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - $as_echo "## ---------------- ## -## Cache variables. ## -## ---------------- ##" - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - $as_echo "## ----------------- ## -## Output variables. ## -## ----------------- ##" - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## -## File substitutions. ## -## ------------------- ##" - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - $as_echo "## ----------- ## -## confdefs.h. ## -## ----------- ##" - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -$as_echo "/* confdefs.h */" > confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac -elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site -else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site -fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" -do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -ac_aux_dir= -for ac_dir in . "$srcdir"/.; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in . \"$srcdir\"/." "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -am__api_version='1.14' - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - fi - done - done - ;; -esac - - done -IFS=$as_save_IFS - -rm -rf conftest.one conftest.two conftest.dir - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 -$as_echo_n "checking whether build environment is sane... " >&6; } -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' -' -case `pwd` in - *[\\\"\#\$\&\'\`$am_lf]*) - as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; -esac -case $srcdir in - *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; -esac - -# Do 'set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - am_has_slept=no - for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - as_fn_error $? "ls -t appears to fail. Make sure there is not a broken - alias in your environment" "$LINENO" 5 - fi - if test "$2" = conftest.file || test $am_try -eq 2; then - break - fi - # Just in case. - sleep 1 - am_has_slept=yes - done - test "$2" = conftest.file - ) -then - # Ok. - : -else - as_fn_error $? "newly created file is older than distributed files! -Check your system clock" "$LINENO" 5 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -# If we didn't sleep, we still need to ensure time stamps of config.status and -# generated files are strictly newer. -am_sleep_pid= -if grep 'slept: no' conftest.file >/dev/null 2>&1; then - ( sleep 1 ) & - am_sleep_pid=$! -fi - -rm -f conftest.file - -test "$program_prefix" != NONE && - program_transform_name="s&^&$program_prefix&;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s&\$&$program_suffix&;$program_transform_name" -# Double any \ or $. -# By default was `s,x,x', remove it if useless. -ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` - -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` - -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac -fi -# Use eval to expand $SHELL -if eval "$MISSING --is-lightweight"; then - am_missing_run="$MISSING " -else - am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} -fi - -if test x"${install_sh}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; - *) - install_sh="\${SHELL} $am_aux_dir/install-sh" - esac -fi - -# Installed binaries are usually stripped using 'strip' when the user -# run "make install-strip". However 'strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the 'STRIP' environment variable to overrule this program. -if test "$cross_compiling" != no; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 -$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } -if test -z "$MKDIR_P"; then - if ${ac_cv_path_mkdir+:} false; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in mkdir gmkdir; do - for ac_exec_ext in '' $ac_executable_extensions; do - as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ - 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext - break 3;; - esac - done - done - done -IFS=$as_save_IFS - -fi - - test -d ./--version && rmdir ./--version - if test "${ac_cv_path_mkdir+set}" = set; then - MKDIR_P="$ac_cv_path_mkdir -p" - else - # As a last resort, use the slow shell script. Don't cache a - # value for MKDIR_P within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - MKDIR_P="$ac_install_sh -d" - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 -$as_echo "$MKDIR_P" >&6; } - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AWK" && break -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } -set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - SET_MAKE= -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - -rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null - -# Check whether --enable-silent-rules was given. -if test "${enable_silent_rules+set}" = set; then : - enableval=$enable_silent_rules; -fi - -case $enable_silent_rules in # ((( - yes) AM_DEFAULT_VERBOSITY=0;; - no) AM_DEFAULT_VERBOSITY=1;; - *) AM_DEFAULT_VERBOSITY=1;; -esac -am_make=${MAKE-make} -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 -$as_echo_n "checking whether $am_make supports nested variables... " >&6; } -if ${am_cv_make_support_nested_variables+:} false; then : - $as_echo_n "(cached) " >&6 -else - if $as_echo 'TRUE=$(BAR$(V)) -BAR0=false -BAR1=true -V=1 -am__doit: - @$(TRUE) -.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then - am_cv_make_support_nested_variables=yes -else - am_cv_make_support_nested_variables=no -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 -$as_echo "$am_cv_make_support_nested_variables" >&6; } -if test $am_cv_make_support_nested_variables = yes; then - AM_V='$(V)' - AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' -else - AM_V=$AM_DEFAULT_VERBOSITY - AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY -fi -AM_BACKSLASH='\' - -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - am__isrc=' -I$(srcdir)' - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 - fi -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi - - -# Define the identity of the package. - PACKAGE='omega' - VERSION='0.1.0' - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF - -# Some tools Automake needs. - -ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} - - -AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} - - -AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} - - -AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} - - -MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - -# For better backward compatibility. To be removed once Automake 1.9.x -# dies out for good. For more background, see: -# -# -mkdir_p='$(MKDIR_P)' - -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -# Always define AMTAR for backward compatibility. Yes, it's still used -# in the wild :-( We should find a proper way to deprecate it ... -AMTAR='$${TAR-tar}' - - -# We'll loop over all known methods to create a tar archive until one works. -_am_tools='gnutar pax cpio none' - -am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' - - - - - - -# POSIX will say in a future version that running "rm -f" with no argument -# is OK; and we want to be able to make that assumption in our Makefile -# recipes. So use an aggressive probe to check that the usage we want is -# actually supported "in the wild" to an acceptable degree. -# See automake bug#10828. -# To make any issue more visible, cause the running configure to be aborted -# by default if the 'rm' program in use doesn't match our expectations; the -# user can still override this though. -if rm -f && rm -fr && rm -rf; then : OK; else - cat >&2 <<'END' -Oops! - -Your 'rm' program seems unable to run without file operands specified -on the command line, even when the '-f' option is present. This is contrary -to the behaviour of most rm programs out there, and not conforming with -the upcoming POSIX standard: - -Please tell bug-automake@gnu.org about your system, including the value -of your $PATH and any error possibly output before this message. This -can help us improve future automake versions. - -END - if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then - echo 'Configuration will proceed anyway, since you have set the' >&2 - echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 - echo >&2 - else - cat >&2 <<'END' -Aborting the configuration process, to ensure you take notice of the issue. - -You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . - -If you want to complete the configuration process using your problematic -'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM -to "yes", and re-run configure. - -END - as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 - fi -fi - -### Use the C++ compiler for linking (C is default) ### -CCLD="$""(CXX)" - - -$as_echo "#define OMEGA_VERSION \"0.1.0\"" >>confdefs.h - - -DEPDIR="${am__leading_dot}deps" - -ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf - -# Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : - enableval=$enable_dependency_tracking; -fi - -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' - am__nodep='_no' -fi - if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 -$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } -if ${am_cv_prog_cc_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF - # Make sure it works both with $CC and with simple cc. - # Following AC_PROG_CC_C_O, we do the test twice because some - # compilers refuse to overwrite an existing .o file with -o, - # though they will create one. - am_cv_prog_cc_c_o=yes - for am_i in 1 2; do - if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 - ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } \ - && test -f conftest2.$ac_objext; then - : OK - else - am_cv_prog_cc_c_o=no - break - fi - done - rm -f core conftest* - unset am_i -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 -$as_echo "$am_cv_prog_cc_c_o" >&6; } -if test "$am_cv_prog_cc_c_o" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -depcc="$CC" am_compiler_list= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - - -if test -n "$ac_tool_prefix"; then - for ac_prog in ar lib "link -lib" - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AR="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AR" && break - done -fi -if test -z "$AR"; then - ac_ct_AR=$AR - for ac_prog in ar lib "link -lib" -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_AR="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -$as_echo "$ac_ct_AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_AR" && break -done - - if test "x$ac_ct_AR" = x; then - AR="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AR=$ac_ct_AR - fi -fi - -: ${AR=ar} - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5 -$as_echo_n "checking the archiver ($AR) interface... " >&6; } -if ${am_cv_ar_interface+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - am_cv_ar_interface=ar - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int some_variable = 0; -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 - (eval $am_ar_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test "$ac_status" -eq 0; then - am_cv_ar_interface=ar - else - am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 - (eval $am_ar_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test "$ac_status" -eq 0; then - am_cv_ar_interface=lib - else - am_cv_ar_interface=unknown - fi - fi - rm -f conftest.lib libconftest.a - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5 -$as_echo "$am_cv_ar_interface" >&6; } - -case $am_cv_ar_interface in -ar) - ;; -lib) - # Microsoft lib, so override with the ar-lib wrapper script. - # FIXME: It is wrong to rewrite AR. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__AR in this case, - # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something - # similar. - AR="$am_aux_dir/ar-lib $AR" - ;; -unknown) - as_fn_error $? "could not determine $AR interface" "$LINENO" 5 - ;; -esac - -for ac_prog in flex lex -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_LEX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$LEX"; then - ac_cv_prog_LEX="$LEX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_LEX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -LEX=$ac_cv_prog_LEX -if test -n "$LEX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LEX" >&5 -$as_echo "$LEX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$LEX" && break -done -test -n "$LEX" || LEX=":" - -if test "x$LEX" != "x:"; then - cat >conftest.l <<_ACEOF -%% -a { ECHO; } -b { REJECT; } -c { yymore (); } -d { yyless (1); } -e { /* IRIX 6.5 flex 2.5.4 underquotes its yyless argument. */ - yyless ((input () != 0)); } -f { unput (yytext[0]); } -. { BEGIN INITIAL; } -%% -#ifdef YYTEXT_POINTER -extern char *yytext; -#endif -int -main (void) -{ - return ! yylex () + ! yywrap (); -} -_ACEOF -{ { ac_try="$LEX conftest.l" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$LEX conftest.l") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking lex output file root" >&5 -$as_echo_n "checking lex output file root... " >&6; } -if ${ac_cv_prog_lex_root+:} false; then : - $as_echo_n "(cached) " >&6 -else - -if test -f lex.yy.c; then - ac_cv_prog_lex_root=lex.yy -elif test -f lexyy.c; then - ac_cv_prog_lex_root=lexyy -else - as_fn_error $? "cannot find output from $LEX; giving up" "$LINENO" 5 -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_root" >&5 -$as_echo "$ac_cv_prog_lex_root" >&6; } -LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root - -if test -z "${LEXLIB+set}"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex library" >&5 -$as_echo_n "checking lex library... " >&6; } -if ${ac_cv_lib_lex+:} false; then : - $as_echo_n "(cached) " >&6 -else - - ac_save_LIBS=$LIBS - ac_cv_lib_lex='none needed' - for ac_lib in '' -lfl -ll; do - LIBS="$ac_lib $ac_save_LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -`cat $LEX_OUTPUT_ROOT.c` -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_lex=$ac_lib -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - test "$ac_cv_lib_lex" != 'none needed' && break - done - LIBS=$ac_save_LIBS - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lex" >&5 -$as_echo "$ac_cv_lib_lex" >&6; } - test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether yytext is a pointer" >&5 -$as_echo_n "checking whether yytext is a pointer... " >&6; } -if ${ac_cv_prog_lex_yytext_pointer+:} false; then : - $as_echo_n "(cached) " >&6 -else - # POSIX says lex can declare yytext either as a pointer or an array; the -# default is implementation-dependent. Figure out which it is, since -# not all implementations provide the %pointer and %array declarations. -ac_cv_prog_lex_yytext_pointer=no -ac_save_LIBS=$LIBS -LIBS="$LEXLIB $ac_save_LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #define YYTEXT_POINTER 1 -`cat $LEX_OUTPUT_ROOT.c` -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_prog_lex_yytext_pointer=yes -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_save_LIBS - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_yytext_pointer" >&5 -$as_echo "$ac_cv_prog_lex_yytext_pointer" >&6; } -if test $ac_cv_prog_lex_yytext_pointer = yes; then - -$as_echo "#define YYTEXT_POINTER 1" >>confdefs.h - -fi -rm -f conftest.l $LEX_OUTPUT_ROOT.c - -fi -if test "$LEX" = :; then - LEX=${am_missing_run}flex -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 -$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } -if ${am_cv_prog_cc_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF - # Make sure it works both with $CC and with simple cc. - # Following AC_PROG_CC_C_O, we do the test twice because some - # compilers refuse to overwrite an existing .o file with -o, - # though they will create one. - am_cv_prog_cc_c_o=yes - for am_i in 1 2; do - if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 - ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } \ - && test -f conftest2.$ac_objext; then - : OK - else - am_cv_prog_cc_c_o=no - break - fi - done - rm -f core conftest* - unset am_i -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 -$as_echo "$am_cv_prog_cc_c_o" >&6; } -if test "$am_cv_prog_cc_c_o" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -depcc="$CC" am_compiler_list= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -$as_echo "$CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CXX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -$as_echo "$ac_ct_CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CXX" && break -done - - if test "x$ac_ct_CXX" = x; then - CXX="g++" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CXX=$ac_ct_CXX - fi -fi - - fi -fi -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 -$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } -if ${ac_cv_cxx_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GXX=yes -else - GXX= -fi -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -$as_echo_n "checking whether $CXX accepts -g... " >&6; } -if ${ac_cv_prog_cxx_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_cxx_werror_flag=$ac_cxx_werror_flag - ac_cxx_werror_flag=yes - ac_cv_prog_cxx_g=no - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_g=yes -else - CXXFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - -else - ac_cxx_werror_flag=$ac_save_cxx_werror_flag - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_cxx_werror_flag=$ac_save_cxx_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -$as_echo "$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -depcc="$CXX" am_compiler_list= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CXX_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CXX_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CXX_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CXX_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } -CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then - am__fastdepCXX_TRUE= - am__fastdepCXX_FALSE='#' -else - am__fastdepCXX_TRUE='#' - am__fastdepCXX_FALSE= -fi - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -for ac_prog in 'bison -y' byacc -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_YACC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$YACC"; then - ac_cv_prog_YACC="$YACC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_YACC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -YACC=$ac_cv_prog_YACC -if test -n "$YACC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5 -$as_echo "$YACC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$YACC" && break -done -test -n "$YACC" || YACC="yacc" - - - -# Check whether --with-rose was given. -if test "${with_rose+set}" = set; then : - withval=$with_rose; - ROSEHOME=$withval - - -$as_echo "#define BUILD_ROSE /**/" >>confdefs.h - - -else - - ROSEHOME="${ROSEHOME}" - -fi - - - -# Check whether --with-boost was given. -if test "${with_boost+set}" = set; then : - withval=$with_boost; - BOOSTHOME=$withval - -else - - BOOSTHOME="${BOOSTHOME}" - -fi - - -ac_config_headers="$ac_config_headers include/config.h" - -ac_config_files="$ac_config_files omega_lib/obj/Makefile omega_calc/obj/Makefile code_gen/obj/Makefile" - - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -U= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 -$as_echo_n "checking that generated files are newer than configure... " >&6; } - if test -n "$am_sleep_pid"; then - # Hide warnings about reused PIDs. - wait $am_sleep_pid 2>/dev/null - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 -$as_echo "done" >&6; } - if test -n "$EXEEXT"; then - am__EXEEXT_TRUE= - am__EXEEXT_FALSE='#' -else - am__EXEEXT_TRUE='#' - am__EXEEXT_FALSE= -fi - -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - as_fn_error $? "conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi - -: "${CONFIG_STATUS=./config.status}" -ac_write_fail=0 -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by omega $as_me 0.1.0, which was -generated by GNU Autoconf 2.69. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac - -case $ac_config_headers in *" -"*) set x $ac_config_headers; shift; ac_config_headers=$*;; -esac - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" -config_headers="$ac_config_headers" -config_commands="$ac_config_commands" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration commands: -$config_commands - -Report bugs to the package provider." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" -ac_cs_version="\\ -omega config.status 0.1.0 -configured by $0, generated by GNU Autoconf 2.69, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2012 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -INSTALL='$INSTALL' -MKDIR_P='$MKDIR_P' -AWK='$AWK' -test -n "\$AWK" || AWK=awk -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=?*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append CONFIG_HEADERS " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h) - # Conflict between --help and --header - as_fn_error $? "ambiguous option: \`$1' -Try \`$0 --help' for more information.";; - --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -if \$ac_cs_recheck; then - set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' - export CONFIG_SHELL - exec "\$@" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - $as_echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# -# INIT-COMMANDS -# -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;; - "omega_lib/obj/Makefile") CONFIG_FILES="$CONFIG_FILES omega_lib/obj/Makefile" ;; - "omega_calc/obj/Makefile") CONFIG_FILES="$CONFIG_FILES omega_calc/obj/Makefile" ;; - "code_gen/obj/Makefile") CONFIG_FILES="$CONFIG_FILES code_gen/obj/Makefile" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= ac_tmp= - trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\)..*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\)..*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove sole $(srcdir), -# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - -# Set up the scripts for CONFIG_HEADERS section. -# No need to generate them if there are no CONFIG_HEADERS. -# This happens for instance with `./config.status Makefile'. -if test -n "$CONFIG_HEADERS"; then -cat >"$ac_tmp/defines.awk" <<\_ACAWK || -BEGIN { -_ACEOF - -# Transform confdefs.h into an awk script `defines.awk', embedded as -# here-document in config.status, that substitutes the proper values into -# config.h.in to produce config.h. - -# Create a delimiter string that does not exist in confdefs.h, to ease -# handling of long lines. -ac_delim='%!_!# ' -for ac_last_try in false false :; do - ac_tt=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_tt"; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -# For the awk script, D is an array of macro values keyed by name, -# likewise P contains macro parameters if any. Preserve backslash -# newline sequences. - -ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* -sed -n ' -s/.\{148\}/&'"$ac_delim"'/g -t rset -:rset -s/^[ ]*#[ ]*define[ ][ ]*/ / -t def -d -:def -s/\\$// -t bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3"/p -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p -d -:bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3\\\\\\n"\\/p -t cont -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p -t cont -d -:cont -n -s/.\{148\}/&'"$ac_delim"'/g -t clear -:clear -s/\\$// -t bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/"/p -d -:bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p -b cont -' >$CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - for (key in D) D_is_set[key] = 1 - FS = "" -} -/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { - line = \$ 0 - split(line, arg, " ") - if (arg[1] == "#") { - defundef = arg[2] - mac1 = arg[3] - } else { - defundef = substr(arg[1], 2) - mac1 = arg[2] - } - split(mac1, mac2, "(") #) - macro = mac2[1] - prefix = substr(line, 1, index(line, defundef) - 1) - if (D_is_set[macro]) { - # Preserve the white space surrounding the "#". - print prefix "define", macro P[macro] D[macro] - next - } else { - # Replace #undef with comments. This is necessary, for example, - # in the case of _POSIX_SOURCE, which is predefined and required - # on some systems where configure will not decide to define it. - if (defundef == "undef") { - print "/*", prefix defundef, macro, "*/" - next - } - } -} -{ print } -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 -fi # test -n "$CONFIG_HEADERS" - - -eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$ac_tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; - esac - ac_MKDIR_P=$MKDIR_P - case $MKDIR_P in - [\\/$]* | ?:[\\/]* ) ;; - */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; - esac -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -s&@INSTALL@&$ac_INSTALL&;t t -s&@MKDIR_P@&$ac_MKDIR_P&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} - - rm -f "$ac_tmp/stdin" - case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; - :H) - # - # CONFIG_HEADER - # - if test x"$ac_file" != x-; then - { - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" - } >"$ac_tmp/config.h" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} - else - rm -f "$ac_file" - mv "$ac_tmp/config.h" "$ac_file" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - fi - else - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error $? "could not create -" "$LINENO" 5 - fi -# Compute "$ac_file"'s index in $config_headers. -_am_arg="$ac_file" -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $_am_arg | $_am_arg:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || -$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$_am_arg" : 'X\(//\)[^/]' \| \ - X"$_am_arg" : 'X\(//\)$' \| \ - X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$_am_arg" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'`/stamp-h$_am_stamp_count - ;; - - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} - ;; - esac - - - case $ac_file$ac_mode in - "depfiles":C) test x"$AMDEP_TRUE" != x"" || { - # Older Autoconf quotes --file arguments for eval, but not when files - # are listed without --file. Let's play safe and only enable the eval - # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac - shift - for mf - do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done - done -} - ;; - - esac -done # for ac_tag - - -as_fn_exit 0 -_ACEOF -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit 1 -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - - - diff --git a/omega/configure.ac b/omega/configure.ac deleted file mode 100644 index 1605f98..0000000 --- a/omega/configure.ac +++ /dev/null @@ -1,39 +0,0 @@ -### note: I have no idea what version of omega this is. -### If it's not 0.1.0, feel free to change it -AC_INIT([omega],[0.1.0]) -AC_CONFIG_AUX_DIR([.]) -AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects]) - -### Use the C++ compiler for linking (C is default) ### -AC_SUBST([CCLD],["$""(CXX)"]) -AC_DEFINE([OMEGA_VERSION],["0.1.0"],[Omega version]) - -m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) -AM_PROG_LEX -AC_PROG_CC -AC_PROG_CXX -AC_PROG_RANLIB -AC_PROG_YACC - -AC_ARG_WITH([rose],[ - AS_HELP_STRING([--with-rose],[set rose home]) - ],[ - AC_SUBST([ROSEHOME], [$withval]) - AC_DEFINE([BUILD_ROSE],[],[Use Rose]) - ],[ - AC_SUBST([ROSEHOME], ["${ROSEHOME}"])]) - -AC_ARG_WITH([boost],[ - AS_HELP_STRING([--with-boost],[set boost home])],[ - AC_SUBST([BOOSTHOME], [$withval])],[ - AC_SUBST([BOOSTHOME], ["${BOOSTHOME}"])]) - -AC_CONFIG_HEADERS([include/config.h]) -AC_CONFIG_FILES([ - omega_lib/obj/Makefile - omega_calc/obj/Makefile - code_gen/obj/Makefile]) - -AC_OUTPUT - - diff --git a/omega/depcomp b/omega/depcomp deleted file mode 100755 index 04701da..0000000 --- a/omega/depcomp +++ /dev/null @@ -1,530 +0,0 @@ -#! /bin/sh -# depcomp - compile a program generating dependencies as side-effects - -scriptversion=2005-07-09.11 - -# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Alexandre Oliva . - -case $1 in - '') - echo "$0: No command. Try \`$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: depcomp [--help] [--version] PROGRAM [ARGS] - -Run PROGRAMS ARGS to compile a file, generating dependencies -as side-effects. - -Environment variables: - depmode Dependency tracking mode. - source Source file read by `PROGRAMS ARGS'. - object Object file output by `PROGRAMS ARGS'. - DEPDIR directory where to store dependencies. - depfile Dependency file to output. - tmpdepfile Temporary file to use when outputing dependencies. - libtool Whether libtool is used (yes/no). - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "depcomp $scriptversion" - exit $? - ;; -esac - -if test -z "$depmode" || test -z "$source" || test -z "$object"; then - echo "depcomp: Variables source, object and depmode must be set" 1>&2 - exit 1 -fi - -# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. -depfile=${depfile-`echo "$object" | - sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} -tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} - -rm -f "$tmpdepfile" - -# Some modes work just like other modes, but use different flags. We -# parameterize here, but still list the modes in the big case below, -# to make depend.m4 easier to write. Note that we *cannot* use a case -# here, because this file can only contain one case statement. -if test "$depmode" = hp; then - # HP compiler uses -M and no extra arg. - gccflag=-M - depmode=gcc -fi - -if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout -fi - -case "$depmode" in -gcc3) -## gcc 3 implements dependency tracking that does exactly what -## we want. Yay! Note: for some reason libtool 1.4 doesn't like -## it if -MD -MP comes after the -MF stuff. Hmm. - "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - mv "$tmpdepfile" "$depfile" - ;; - -gcc) -## There are various ways to get dependency output from gcc. Here's -## why we pick this rather obscure method: -## - Don't want to use -MD because we'd like the dependencies to end -## up in a subdir. Having to rename by hand is ugly. -## (We might end up doing this anyway to support other compilers.) -## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). -## - Using -M directly means running the compiler twice (even worse -## than renaming). - if test -z "$gccflag"; then - gccflag=-MD, - fi - "$@" -Wp,"$gccflag$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz -## The second -e expression handles DOS-style file names with drive letters. - sed -e 's/^[^:]*: / /' \ - -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the `deleted header file' problem. -## The problem is that when a header file which appears in a .P file -## is deleted, the dependency causes make to die (because there is -## typically no way to rebuild the header). We avoid this by adding -## dummy dependencies for each header file. Too bad gcc doesn't do -## this for us directly. - tr ' ' ' -' < "$tmpdepfile" | -## Some versions of gcc put a space before the `:'. On the theory -## that the space means something, we add a space to the output as -## well. -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -sgi) - if test "$libtool" = yes; then - "$@" "-Wp,-MDupdate,$tmpdepfile" - else - "$@" -MDupdate "$tmpdepfile" - fi - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - - if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files - echo "$object : \\" > "$depfile" - - # Clip off the initial element (the dependent). Don't try to be - # clever and replace this with sed code, as IRIX sed won't handle - # lines with more than a fixed number of characters (4096 in - # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; - # the IRIX cc adds comments like `#:fec' to the end of the - # dependency line. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ - tr ' -' ' ' >> $depfile - echo >> $depfile - - # The second pass generates a dummy entry for each header file. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> $depfile - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -aix) - # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. In older versions, this file always lives in the - # current directory. Also, the AIX compiler puts `$object:' at the - # start of each line; $object doesn't have directory information. - # Version 6 uses the directory in both cases. - stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` - tmpdepfile="$stripped.u" - if test "$libtool" = yes; then - "$@" -Wc,-M - else - "$@" -M - fi - stat=$? - - if test -f "$tmpdepfile"; then : - else - stripped=`echo "$stripped" | sed 's,^.*/,,'` - tmpdepfile="$stripped.u" - fi - - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - - if test -f "$tmpdepfile"; then - outname="$stripped.o" - # Each line is of the form `foo.o: dependent.h'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" - sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -icc) - # Intel's C compiler understands `-MD -MF file'. However on - # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c - # ICC 7.0 will fill foo.d with something like - # foo.o: sub/foo.c - # foo.o: sub/foo.h - # which is wrong. We want: - # sub/foo.o: sub/foo.c - # sub/foo.o: sub/foo.h - # sub/foo.c: - # sub/foo.h: - # ICC 7.1 will output - # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using \ : - # foo.o: sub/foo.c ... \ - # sub/foo.h ... \ - # ... - - "$@" -MD -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each line is of the form `foo.o: dependent.h', - # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | - sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -tru64) - # The Tru64 compiler uses -MD to generate dependencies as a side - # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in `foo.d' instead, so we check for that too. - # Subdirectories are respected. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - - if test "$libtool" = yes; then - # With Tru64 cc, shared objects can also be used to make a - # static library. This mecanism is used in libtool 1.4 series to - # handle both shared and static libraries in a single compilation. - # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. - # - # With libtool 1.5 this exception was removed, and libtool now - # generates 2 separate objects for the 2 libraries. These two - # compilations output dependencies in in $dir.libs/$base.o.d and - # in $dir$base.o.d. We have to check for both files, because - # one of the two compilations can be disabled. We should prefer - # $dir$base.o.d over $dir.libs/$base.o.d because the latter is - # automatically cleaned when .libs/ is deleted, while ignoring - # the former would cause a distcleancheck panic. - tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 - tmpdepfile2=$dir$base.o.d # libtool 1.5 - tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 - tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 - "$@" -Wc,-MD - else - tmpdepfile1=$dir$base.o.d - tmpdepfile2=$dir$base.d - tmpdepfile3=$dir$base.d - tmpdepfile4=$dir$base.d - "$@" -MD - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a tab and a space in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -#nosideeffect) - # This comment above is used by automake to tell side-effect - # dependency tracking mechanisms from slower ones. - -dashmstdout) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - test -z "$dashmflag" && dashmflag=-M - # Require at least two characters before searching for `:' - # in the target name. This is to cope with DOS-style filenames: - # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. - "$@" $dashmflag | - sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - tr ' ' ' -' < "$tmpdepfile" | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -dashXmstdout) - # This case only exists to satisfy depend.m4. It is never actually - # run, as this mode is specially recognized in the preamble. - exit 1 - ;; - -makedepend) - "$@" || exit $? - # Remove any Libtool call - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - # X makedepend - shift - cleared=no - for arg in "$@"; do - case $cleared in - no) - set ""; shift - cleared=yes ;; - esac - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift ;; - # Strip any option that makedepend may not understand. Remove - # the object too, otherwise makedepend will parse it as a source file. - -*|$object) - ;; - *) - set fnord "$@" "$arg"; shift ;; - esac - done - obj_suffix="`echo $object | sed 's/^.*\././'`" - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - sed '1,2d' "$tmpdepfile" | tr ' ' ' -' | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" "$tmpdepfile".bak - ;; - -cpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - "$@" -E | - sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | - sed '$ s: \\$::' > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - cat < "$tmpdepfile" >> "$depfile" - sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvisualcpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - "$@" || exit $? - IFS=" " - for arg - do - case "$arg" in - "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") - set fnord "$@" - shift - shift - ;; - *) - set fnord "$@" "$arg" - shift - shift - ;; - esac - done - "$@" -E | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" - echo " " >> "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -none) - exec "$@" - ;; - -*) - echo "Unknown depmode $depmode" 1>&2 - exit 1 - ;; -esac - -exit 0 - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/omega/doc/calculator.pdf b/omega/doc/calculator.pdf deleted file mode 100755 index 5c307ab..0000000 Binary files a/omega/doc/calculator.pdf and /dev/null differ diff --git a/omega/doc/interface.pdf b/omega/doc/interface.pdf deleted file mode 100755 index 7f918ae..0000000 Binary files a/omega/doc/interface.pdf and /dev/null differ diff --git a/omega/examples/basics b/omega/examples/basics deleted file mode 100644 index 9f0728d..0000000 --- a/omega/examples/basics +++ /dev/null @@ -1,30 +0,0 @@ -# -# Some examples from the documentation for the Omega Calculator -# This is the input for figures 2 and 3. -# - -R := { [i] -> [i'] : 1 <= i,i' <= 10 && i' = i+1 }; -R; -inverse R; -domain R; -range R; -R compose R; -R+; # closure of R = R union (R compose R) union (R compose R ... -complement R; -S := {[i] : 5 <= i <= 25}; -S; -R(S); # apply R to S -R \ S; # restrict domain of R to S -R / S; # restrict range of R to S -(R\S) union (R/S); -(R\S) intersection (R/S); -(R/S) - (R\S); -S*S; # cross product -D := S - {[9:16:2]} - {[17:19]}; -D; -T := { [i] : 1 <= i <= 11 & exists (a : i = 2a) }; -T; -Hull T; -Hull D; -codegen D; -codegen {[i,j] : 1 <= i+j,j <= 10}; diff --git a/omega/examples/basics.out b/omega/examples/basics.out deleted file mode 100644 index 6f8f2bb..0000000 --- a/omega/examples/basics.out +++ /dev/null @@ -1,76 +0,0 @@ ->>> # ->>> # Some examples from the documentation for the Omega Calculator ->>> # This is the input for figures 2 and 3. ->>> # ->>> ->>> R := { [i] -> [i'] : 1 <= i,i' <= 10 && i' = i+1 }; ->>> R; -{[i] -> [i+1] : 1 <= i <= 9} ->>> inverse R; -{[i] -> [i-1] : 2 <= i <= 10} ->>> domain R; -{[i]: 1 <= i <= 9} ->>> range R; -{[i]: 2 <= i <= 10} ->>> R compose R; -{[i] -> [i+2] : 1 <= i <= 8} ->>> R+; -{[i] -> [i'] : 1 <= i < i' <= 10} ->>> # closure of R = R union (R compose R) union (R compose R ... ->>> complement R; -{[i] -> [i'] : i <= 0} union - {[i] -> [i'] : 10 <= i} union - {[i] -> [i'] : 1, i' <= i <= 9} union - {[i] -> [i'] : 1 <= i <= 9, i'-2} ->>> S := {[i] : 5 <= i <= 25}; ->>> S; -{[i]: 5 <= i <= 25} ->>> R(S); -{[i]: 6 <= i <= 10} ->>> # apply R to S ->>> R \ S; -{[i] -> [i+1] : 5 <= i <= 9} ->>> # restrict domain of R to S ->>> R / S; -{[i] -> [i+1] : 4 <= i <= 9} ->>> # restrict range of R to S ->>> (R\S) union (R/S); -{[i] -> [i+1] : 4 <= i <= 9} ->>> (R\S) intersection (R/S); -{[i] -> [i+1] : 5 <= i <= 9} ->>> (R/S) - (R\S); -{[4] -> [5] } ->>> S*S; -{[i] -> [i'] : 5 <= i <= 25 && 5 <= i' <= 25} ->>> # cross product ->>> D := S - {[9:16:2]} - {[17:19]}; ->>> D; -{[i]: 5 <= i <= 8} union - {[i]: exists ( alpha : 2alpha = i && 10 <= i <= 16)} union - {[i]: 20 <= i <= 25} ->>> T := { [i] : 1 <= i <= 11 & exists (a : i = 2a) }; ->>> T; -{[i]: exists ( alpha : 2alpha = i && 2 <= i <= 10)} ->>> Hull T; -{[i]: exists ( alpha : 2alpha = i && 2 <= i <= 10)} ->>> Hull D; -{[i]: 5 <= i <= 25} ->>> codegen D; -for(t1 = 5; t1 <= 8; t1++) { - s0(t1); -} -for(t1 = 10; t1 <= 16; t1 += 2) { - s0(t1); -} -for(t1 = 20; t1 <= 25; t1++) { - s0(t1); -} - ->>> codegen {[i,j] : 1 <= i+j,j <= 10}; -for(t1 = -9; t1 <= 9; t1++) { - for(t2 = max(1,-t1+1); t2 <= min(-t1+10,10); t2++) { - s0(t1,t2); - } -} - ->>> diff --git a/omega/examples/c_code/Makefile b/omega/examples/c_code/Makefile deleted file mode 100644 index 5d4dd61..0000000 --- a/omega/examples/c_code/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -CC = g++ -INC_DIR = -I../../include -LIB_DIR = -L../../lib - -all: example library_example - - -example : example.o ../../lib/libomega.a - ${CC} -g $(LIB_DIR) example.o -lomega -o example - -example.o : example.c - ${CC} -Wall -g $(INC_DIR) -c example.c - -library_example : library_example.o ../../lib/libomega.a - ${CC} -g $(LIB_DIR) library_example.o -lomega -o library_example - -library_example.o : library_example.c - ${CC} -Wall -g $(INC_DIR) -c library_example.c - -clean: - @rm -fr *.o example library_example diff --git a/omega/examples/c_code/PT-example.c b/omega/examples/c_code/PT-example.c deleted file mode 100644 index c2560e7..0000000 --- a/omega/examples/c_code/PT-example.c +++ /dev/null @@ -1,12 +0,0 @@ -#if defined DONT_INCLUDE_TEMPLATE_CODE - -/* DONT BOTHER COMPILING THIS FILE UNLESS WE ARE USING G++ >= 260 - AND -fno-implicit-templates AND -DDONT_INCLUDE_TEMPLATE_CODE */ - -#undef DONT_INCLUDE_TEMPLATE_CODE - -#include - -// If we needed other templates, we would put them here - -#endif diff --git a/omega/examples/c_code/example.c b/omega/examples/c_code/example.c deleted file mode 100644 index 8bd84b3..0000000 --- a/omega/examples/c_code/example.c +++ /dev/null @@ -1,89 +0,0 @@ -#include - -// THIS NEEDS TO BE A LOT SIMPLER - I'M CUTTING IT DOWN - -// R := { [i,j] -> [i', j'] : -// 1 <= i, i' <= n && 1 <= j <= L(i) && 1 <= j' <= m && -// j = j' && i < i' } -// -// S := { [x,y] : 1 <= x <= n && y <= x + 5 && x is divisible by 17 && -// there exists z such that y <= z <= x && -// ( z is divisible by 8 || z+5x is divisible by 12 ) } - -using namespace omega; -int main() { - Relation S(2); - S.name_set_var(1, "x"); - S.name_set_var(2, "y"); - - assert( S.is_set()); - - Free_Var_Decl n("n"); - - -/* Relation R(2,2); */ -/* assert(!R.is_set()); */ - -/* Free_Var_Decl m("m"); */ -/* Free_Var_Decl l("L", 1); */ - -/* Variable_ID local_n = R.get_local(&n); */ -/* Variable_ID local_m = R.get_local(&m); */ -/* Variable_ID l_in = R.get_local(&l, Input_Tuple); */ -/* Variable_ID l_out = R.get_local(&l, Output_Tuple); */ - -/* Variable_ID in1 = R.input_var(1); */ -/* Variable_ID in2 = R.input_var(2); */ -/* Variable_ID out1 = R.output_var(1); */ -/* Variable_ID out2 = R.output_var(2); */ - - Variable_ID x = S.set_var(1); - Variable_ID y = S.set_var(2); - - F_And *S_root = S.add_and(); - - GEQ_Handle xmin = S_root->add_GEQ(); // x-1 >= 0 - xmin.update_coef(x, 1); - xmin.update_const(-1); - GEQ_Handle xmax = S_root->add_GEQ(); // n-x >= 0 - xmax.update_coef(x, -1); - xmax.update_coef(S.get_local(&n), 1); - GEQ_Handle ymax = S_root->add_GEQ(); // x+5-y >= 0 - ymax.update_coef(x, 1); - ymax.update_coef(y, -1); - ymax.update_const(5); - - // x is divisible by 17 - S_root->add_stride(17).update_coef(x,1); - - F_Exists *e = S_root->add_exists(); - - Variable_ID z = e->declare("z"); // exists z - F_And *z_stuff = e->add_and(); - - GEQ_Handle zmin = z_stuff->add_GEQ(); // z-y >= 0 - zmin.update_coef(z,1); - zmin.update_coef(y,-1); - GEQ_Handle zmax = z_stuff->add_GEQ(); // x-z >= 0 - zmax.update_coef(x,1); - zmax.update_coef(z,-1); - - F_Or *o = z_stuff->add_or(); - Stride_Handle z8 = o->add_and()->add_stride(8); - z8.update_coef(z,1); // z divisible by 8 - - Stride_Handle z12 = o->add_and()->add_stride(12); - z12.update_coef(z,1); - z12.update_coef(x,5); // z+5x divisible by 12 - - - S.print(); - S.finalize(); - S.prefix_print(); - S.is_upper_bound_satisfiable(); - S.print(); - S.prefix_print(); - - return 0; -} - diff --git a/omega/examples/c_code/library_example.c b/omega/examples/c_code/library_example.c deleted file mode 100644 index 06f6570..0000000 --- a/omega/examples/c_code/library_example.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - IF THESE EXAMPLES CHANGE, CHANGE construction.tex CORRESPONDINGLY - - S1 := { [t] : 1 <= t <= n } - - S2 := { [x] : (0 <= x <= 100 and - exists y : (2n <= y <= x and y is odd)) - or x = 17 } - - R := { [i,j] -> [i',j'] : 1 <= i <= i' <= n and not (F(i) = F(i')) - and 1 <= j, j' <= m } -*/ - -//BEGIN PART 1 -#include -using namespace omega; -int main() { - Relation S1(1), S2(1), R(2,2); - S1.name_set_var(1, "t"); - S2.name_set_var(1, "x"); - - assert(!R.is_set()); - assert(S1.is_set()); - assert(S2.is_set()); - - Free_Var_Decl n("n"); - Free_Var_Decl m("m"); - Free_Var_Decl f("F", 1); - - Variable_ID S1s_n = S1.get_local(&n); - Variable_ID S2s_n = S2.get_local(&n); - - Variable_ID Rs_n = R.get_local(&n); - Variable_ID Rs_m = R.get_local(&m); - Variable_ID Rs_f_in = R.get_local(&f, Input_Tuple); - Variable_ID Rs_f_out = R.get_local(&f, Output_Tuple); - - R.name_input_var(1, "i"); - R.name_input_var(2, "j"); - R.name_output_var(1, "i'"); - R.name_output_var(2, "j'"); - Variable_ID i = R.input_var(1); - Variable_ID j = R.input_var(2); - Variable_ID i2 = R.output_var(1); - Variable_ID j2 = R.output_var(2); - - Variable_ID t = S1.set_var(1); - Variable_ID x = S2.set_var(1); -//END PART 1 -//BEGIN PART 2 - F_And *S1_root = S1.add_and(); - - GEQ_Handle tmin = S1_root->add_GEQ(); // t-1 >= 0 - tmin.update_coef(t, 10); - tmin.update_coef(t, -9); // t now has coef. 1 - tmin.update_const(-1); - GEQ_Handle tmax = S1_root->add_GEQ(); // n-t >= 0 - tmax.update_coef(S1s_n,1); - tmax.update_coef(t, -1); - - - F_Or *S2_root = S2.add_or(); - F_And *part1 = S2_root->add_and(); - - GEQ_Handle xmin = part1->add_GEQ(); - xmin.update_coef(x,1); - GEQ_Handle xmax = part1->add_GEQ(); - xmax.update_coef(x,-1); - xmax.update_const(100); - - F_Exists *exists_y = part1->add_exists(); - Variable_ID y = exists_y->declare("y"); - - F_And *y_stuff = exists_y->add_and(); - GEQ_Handle ymin = y_stuff->add_GEQ(); - ymin.update_coef(y,1); - ymin.update_coef(S2s_n,-2); - GEQ_Handle ymax = y_stuff->add_GEQ(); - ymax.update_coef(x,1); - ymax.update_coef(y,-1); - Stride_Handle y_even = y_stuff->add_stride(2); - y_even.update_coef(y,1); - y_even.update_const(1); - - F_And *part2 = S2_root->add_and(); - - EQ_Handle xvalue = part2->add_EQ(); - xvalue.update_coef(x,1); - xvalue.update_const(-17); -//END PART 2 -//BEGIN PART 3 - F_And *R_root = R.add_and(); - - GEQ_Handle imin = R_root->add_GEQ(); - imin.update_coef(i,1); - imin.update_const(-1); - GEQ_Handle imax = R_root->add_GEQ(); - imax.update_coef(i2,1); - imax.update_coef(i,-1); - GEQ_Handle i2max = R_root->add_GEQ(); - i2max.update_coef(Rs_n,1); - i2max.update_coef(i2,-1); - - EQ_Handle f_eq = R_root->add_not()->add_and()->add_EQ(); - f_eq.update_coef(Rs_f_in,-1); - f_eq.update_coef(Rs_f_out,1); // F(In) - F(Out) = 0 - - GEQ_Handle jmin = R_root->add_GEQ(); - jmin.update_coef(j,1); - jmin.update_const(-1); - GEQ_Handle jmax = R_root->add_GEQ(); - jmax.update_coef(Rs_m,1); - jmax.update_coef(j,-1); - - GEQ_Handle j2min = R_root->add_GEQ(); - j2min.update_coef(j2,1); - j2min.update_const(-1); - GEQ_Handle j2max = R_root->add_GEQ(); - j2max.update_coef(Rs_m,1); - j2max.update_coef(j2,-1); -//END PART 3 -//BEGIN PART 4 - S1.print_with_subs(stdout); - assert(S1.is_upper_bound_satisfiable()); - assert(!S1.is_tautology()); - S1.print_with_subs(stdout); // same as above print - printf("\n"); - - S2.print(); - assert(S2.is_upper_bound_satisfiable()); - assert(!S2.is_tautology()); - S2.print(); // different from above - printf("\n"); - - assert(R.is_upper_bound_satisfiable()); - assert(!R.is_tautology()); - R.print_with_subs(stdout); - - coef_t lb, ub; - bool coupled; - R.query_difference(i2, i, lb, ub, coupled); - assert(lb == 1); // i < i2: i2 - i1 > 0 - assert(ub == posInfinity); - - for(DNF_Iterator di(R.query_DNF()); di; di++) { - printf("In next conjunct,\n"); - for(EQ_Iterator ei = (*di)->EQs(); ei; ei++) { - printf(" In next equality constraint,\n"); - for(Constr_Vars_Iter cvi(*ei); cvi; cvi++) - printf(" Variable %s has coefficient "coef_fmt"\n", - (*cvi).var->char_name(), - (*cvi).coef); - } - for(GEQ_Iterator gi = (*di)->GEQs(); gi; gi++) { - printf(" In next inequality constraint,\n"); - for(Constr_Vars_Iter cvi(*gi); cvi; cvi++) - printf(" Variable %s has coefficient "coef_fmt"\n", - (*cvi).var->char_name(), - (*cvi).coef); - int c = (*gi).get_const(); - if (c != 0) - printf(" Constant %d\n", c); - } - - printf("\n"); - } -//END PART 4 -//BEGIN PART 5 - Relation S1_or_S2 = Union(copy(S1), copy(S2)); - - // NOTE! THE FOLLOWING KILLS S1 AND S2 - Relation S1_and_S2 = Intersection(S1, S2); - - S1_or_S2.is_upper_bound_satisfiable(); - S1_and_S2.is_upper_bound_satisfiable(); - - S1_or_S2.print(); - printf("\n"); - - S1_and_S2.print(); - printf("\n"); - - Relation R_R = Composition(copy(R), R); - R_R.query_difference(i2, i, lb, ub, coupled); - assert(lb == 2); - assert(ub == posInfinity); - - return 0; -} -//END PART 5 diff --git a/omega/examples/code_gen b/omega/examples/code_gen deleted file mode 100644 index b3a0b4e..0000000 --- a/omega/examples/code_gen +++ /dev/null @@ -1,60 +0,0 @@ -# Example taken from http://www.cloog.org -# - -r0:={[i,j]:i>=1 && j<=7 && j>=i-1}; -r1:={[i,j]:2<=i<=6 && 0<=j<=4}; - -# CLooG optimized for size -## -## for (i=1;i<=8;i++) { -## for (j=i-1;j<=7;j++) { -## S0(i,j); -## } -## if ((i>=2)&&(i<=6)) { -## for (j=0;j<=4;j++) { -## S1(i,j); -## } -## } -## } -## -## Since CLooG might not preserve the lexcicographical order other than -## the default code generation strategy (custom -f or -l values). Its -## generated code might not be correct should there exist reorder-preventing -## dependence among statements. -## - -# no overhead removal, minimal code size -codegen 0 r0,r1; - -# remove one-deep loop nest (innermost loop) overhead -codegen 1 r0,r1; - -# CLooG optimized for control -## -## for (t2=0;t2<=7;t2++) { -## S0(1,t2); -## } -## for (t1=2;t1<=6;t1++) { -## for (t2=0;t2<=t1-2;t2++) { -## S1(t1,t2); -## } -## for (t2=t1-1;t2<=4;t2++) { -## S0(t1,t2); -## S1(t1,t2); -## } -## for (t2=5;t2<=7;t2++) { -## S0(t1,t2); -## } -## } -## for (t1=7;t1<=8;t1++) { -## for (t2=t1-1;t2<=7;t2++) { -## S0(t1,t2); -## } -## } -## -## This is CLooG's default code generation strategy. It guarantees -## the lexicographical order as shown in input iteration spaces. -## - -# minimal control overhead, removing overhead from 2-deep loop nest -codegen 2 r0,r1; diff --git a/omega/examples/code_gen.out b/omega/examples/code_gen.out deleted file mode 100644 index 16e1b21..0000000 --- a/omega/examples/code_gen.out +++ /dev/null @@ -1,33 +0,0 @@ -# Omega Calculator [v1.1, Nov 96]: -# # -# # Example of code generation from Omega Calculator documentation -# # -# -# T10:={[i] -> [0,i,0,0]}; -# -# T20:={[i,j] -> [1,j,0,i]}; -# -# T30:={[i] -> [1,i-1,1,0]}; -# -# -# Symbolic n; -# -# IS10 := {[i]: 2 <= i <= n}; -# -# IS20 := {[i,j]: 2 <= i <= n && 1 <= j <= i-1}; -# -# IS30 := IS10; -# -# -# codegen T10:IS10,T20:IS20,T30:IS30; -for(t2 = 2; t2 <= n; t2++) { - s1(t2); -} -for(t2 = 1; t2 <= n-1; t2++) { - for(t4 = t2+1; t4 <= n; t4++) { - s2(t4,t2); - } - s3(t2+1); -} - -# diff --git a/omega/examples/experiments/gemm/codegen.input b/omega/examples/experiments/gemm/codegen.input deleted file mode 100755 index cf1554b..0000000 --- a/omega/examples/experiments/gemm/codegen.input +++ /dev/null @@ -1,14 +0,0 @@ -symbolic n, over1, over2; -s0:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta,tau : 2tau = 1+t10 && 2alpha = 1+t8 && t2 = 1+512beta && t4 = 1+128gamma && t6 = 1+8delta && t1 = 0 && t3 = 0 && t5 = 1 && t7 = 2 && t9 = 1 && t11 = 0 && t13 = 0 && 1, t12-511 <= t2 <= t12 <= n && 1, t10-6 <= t6 <= t10 && 1, t8-126 <= t4 <= t8 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && over2+t10 <= n && over1+t8 <= n) }; -s1:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9] : exists ( alpha,beta : t4 = 1+128beta && t2 = 1+512alpha && t1 = 0 && t3 = 0 && t5 = 0 && t7 = 0 && t9 = 0 && 1, t8-127 <= t4 <= t8 <= n && 1, t2 <= t6 <= n, t2+511 && 0 <= over2 <= 1 && 0 <= over1 <= 1) }; -s2:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11] : exists ( alpha,beta,gamma : t6 = 1+8gamma && t4 = 1+128alpha && t2 = 1+512beta && t5 = 1 && t9 = 0 && t11 = 0 && t1 = 0 && 1+t7 = 0 && t3 = 0 && 1, t10-511 <= t2 <= t10 <= n && 1, t8-7 <= t6 <= t8 <= n && 0 <= over2 <= 1 && 0 <= over1 <= 1 && 1 <= t4 <= n) }; -s3:= { [t1,t2,t3,t4,t5,t6,t7] : exists ( alpha,beta,gamma : t6 = 1+8gamma && t4 = 1+128alpha && t2 = 1+512beta && t5 = 1 && t1 = 0 && t7 = 0 && t3 = 0 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && 1 <= t2 <= n && 1 <= t4 <= n && 1 <= t6 <= n) }; -s4:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma : t6 = 1+8beta && t4 = 1+128gamma && t2 = 1+512alpha && n = t8 && over1 = 1 && t5 = 1 && t9 = 0 && t11 = 0 && t13 = 0 && t1 = 0 && t7 = 4 && t3 = 0 && 1, t12-511 <= t2 <= t12 <= t8 <= t4+127 && 1, t10-7 <= t6 <= t10 <= t8 && 0 <= over2 <= 1 && t4 <= t8) }; -s5:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta,tau : 2tau = 1+t10 && 2alpha = 1+t8 && t2 = 1+512beta && t4 = 1+128gamma && t6 = 1+8delta && t1 = 0 && t3 = 0 && t5 = 1 && t7 = 2 && t9 = 1 && t11 = 0 && t13 = 1 && 1, t12-511 <= t2 <= t12 <= n && 1, t10-6 <= t6 <= t10 && 1, t8-126 <= t4 <= t8 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && over2+t10 <= n && over1+t8 <= n) }; -s6:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9] : exists ( alpha,beta,gamma,delta : t6 = 1+8delta && 2alpha = 1+t8 && t2 = 1+512beta && t4 = 1+128gamma && 1+t9 = 0 && t7 = 2 && t1 = 0 && t3 = 0 && t5 = 1 && 1, t8-126 <= t4 <= t8 && 0 <= over1 <= 1 && 0 <= over2 <= 1 && 1 <= t2 <= n && 1 <= t6 <= n && over1+t8 <= n) }; -s7:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta : t6 = 1+8beta && 2alpha = t8+t4 && t2 = 1+512delta && 1+128gamma = t4 && t10 = n && over2 = 1 && t5 = 1 && t7 = 2 && t11 = 0 && t13 = 0 && t1 = 0 && t9 = 2 && t3 = 0 && 1, t12-511 <= t2 <= t12 <= n <= t6+7 && 1, t8-126 <= t4 <= t8 && 0 <= over1 <= 1 && t6 <= n && over1+t8 <= n) }; -s8:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta : t6 = 1+8beta && 2alpha = t8+t4 && t2 = 1+512delta && 1+128gamma = t4 && t10 = n && over2 = 1 && t5 = 1 && t7 = 2 && t11 = 0 && t13 = 1 && t1 = 0 && t9 = 2 && t3 = 0 && 1, t12-511 <= t2 <= t12 <= n <= t6+7 && 1, t8-126 <= t4 <= t8 && 0 <= over1 <= 1 && t6 <= n && over1+t8 <= n) }; -s9:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta,tau : 2delta = 1+t10 && 2alpha = 1+t8 && t2 = 1+512beta && t4 = 1+128gamma && t6+8tau = 1 && t13 = 2 && t9 = 1 && t11 = 0 && t1 = 0 && t3 = 0 && t5 = 1 && t7 = 2 && 1, t12-511 <= t2 <= t12 <= n && 1, t10-6 <= t6 <= t10 && 1, t8-126 <= t4 <= t8 && 0 <= over1 <= 1 && 0 <= over2 <= 1 && over2+t10 <= n && over1+t8 <= n) }; - -codegen 1 s0,s1,s2,s3,s4,s5,s6,s7,s8,s9; - diff --git a/omega/examples/experiments/gemm/gemm.out b/omega/examples/experiments/gemm/gemm.out deleted file mode 100644 index dfd0156..0000000 --- a/omega/examples/experiments/gemm/gemm.out +++ /dev/null @@ -1,58 +0,0 @@ ->>> symbolic n, over1, over2; ->>> s0:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta,tau : 2tau = 1+t10 && 2alpha = 1+t8 && t2 = 1+512beta && t4 = 1+128gamma && t6 = 1+8delta && t1 = 0 && t3 = 0 && t5 = 1 && t7 = 2 && t9 = 1 && t11 = 0 && t13 = 0 && 1, t12-511 <= t2 <= t12 <= n && 1, t10-6 <= t6 <= t10 && 1, t8-126 <= t4 <= t8 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && over2+t10 <= n && over1+t8 <= n) }; ->>> s1:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9] : exists ( alpha,beta : t4 = 1+128beta && t2 = 1+512alpha && t1 = 0 && t3 = 0 && t5 = 0 && t7 = 0 && t9 = 0 && 1, t8-127 <= t4 <= t8 <= n && 1, t2 <= t6 <= n, t2+511 && 0 <= over2 <= 1 && 0 <= over1 <= 1) }; ->>> s2:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11] : exists ( alpha,beta,gamma : t6 = 1+8gamma && t4 = 1+128alpha && t2 = 1+512beta && t5 = 1 && t9 = 0 && t11 = 0 && t1 = 0 && 1+t7 = 0 && t3 = 0 && 1, t10-511 <= t2 <= t10 <= n && 1, t8-7 <= t6 <= t8 <= n && 0 <= over2 <= 1 && 0 <= over1 <= 1 && 1 <= t4 <= n) }; ->>> s3:= { [t1,t2,t3,t4,t5,t6,t7] : exists ( alpha,beta,gamma : t6 = 1+8gamma && t4 = 1+128alpha && t2 = 1+512beta && t5 = 1 && t1 = 0 && t7 = 0 && t3 = 0 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && 1 <= t2 <= n && 1 <= t4 <= n && 1 <= t6 <= n) }; ->>> s4:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma : t6 = 1+8beta && t4 = 1+128gamma && t2 = 1+512alpha && n = t8 && over1 = 1 && t5 = 1 && t9 = 0 && t11 = 0 && t13 = 0 && t1 = 0 && t7 = 4 && t3 = 0 && 1, t12-511 <= t2 <= t12 <= t8 <= t4+127 && 1, t10-7 <= t6 <= t10 <= t8 && 0 <= over2 <= 1 && t4 <= t8) }; ->>> s5:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta,tau : 2tau = 1+t10 && 2alpha = 1+t8 && t2 = 1+512beta && t4 = 1+128gamma && t6 = 1+8delta && t1 = 0 && t3 = 0 && t5 = 1 && t7 = 2 && t9 = 1 && t11 = 0 && t13 = 1 && 1, t12-511 <= t2 <= t12 <= n && 1, t10-6 <= t6 <= t10 && 1, t8-126 <= t4 <= t8 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && over2+t10 <= n && over1+t8 <= n) }; ->>> s6:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9] : exists ( alpha,beta,gamma,delta : t6 = 1+8delta && 2alpha = 1+t8 && t2 = 1+512beta && t4 = 1+128gamma && 1+t9 = 0 && t7 = 2 && t1 = 0 && t3 = 0 && t5 = 1 && 1, t8-126 <= t4 <= t8 && 0 <= over1 <= 1 && 0 <= over2 <= 1 && 1 <= t2 <= n && 1 <= t6 <= n && over1+t8 <= n) }; ->>> s7:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta : t6 = 1+8beta && 2alpha = t8+t4 && t2 = 1+512delta && 1+128gamma = t4 && t10 = n && over2 = 1 && t5 = 1 && t7 = 2 && t11 = 0 && t13 = 0 && t1 = 0 && t9 = 2 && t3 = 0 && 1, t12-511 <= t2 <= t12 <= n <= t6+7 && 1, t8-126 <= t4 <= t8 && 0 <= over1 <= 1 && t6 <= n && over1+t8 <= n) }; ->>> s8:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta : t6 = 1+8beta && 2alpha = t8+t4 && t2 = 1+512delta && 1+128gamma = t4 && t10 = n && over2 = 1 && t5 = 1 && t7 = 2 && t11 = 0 && t13 = 1 && t1 = 0 && t9 = 2 && t3 = 0 && 1, t12-511 <= t2 <= t12 <= n <= t6+7 && 1, t8-126 <= t4 <= t8 && 0 <= over1 <= 1 && t6 <= n && over1+t8 <= n) }; ->>> s9:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta,tau : 2delta = 1+t10 && 2alpha = 1+t8 && t2 = 1+512beta && t4 = 1+128gamma && t6+8tau = 1 && t13 = 2 && t9 = 1 && t11 = 0 && t1 = 0 && t3 = 0 && t5 = 1 && t7 = 2 && 1, t12-511 <= t2 <= t12 <= n && 1, t10-6 <= t6 <= t10 && 1, t8-126 <= t4 <= t8 && 0 <= over1 <= 1 && 0 <= over2 <= 1 && over2+t10 <= n && over1+t8 <= n) }; ->>> ->>> codegen 1 s0,s1,s2,s3,s4,s5,s6,s7,s8,s9; -if (over1 >= 0 && over2 >= 0 && over2 <= 1 && over1 <= 1) { - for(t2 = 1; t2 <= n; t2 += 512) { - for(t4 = 1; t4 <= n; t4 += 128) { - for(t6 = t2; t6 <= min(n,t2+511); t6++) { - for(t8 = t4; t8 <= min(t4+127,n); t8++) { - s1(0,t2,0,t4,0,t6,0,t8,0); - } - } - for(t6 = 1; t6 <= n; t6 += 8) { - for(t8 = t6; t8 <= min(n,t6+7); t8++) { - for(t10 = t2; t10 <= min(t2+511,n); t10++) { - s2(0,t2,0,t4,1,t6,-1,t8,0,t10,0); - } - } - s3(0,t2,0,t4,1,t6,0); - for(t8 = t4; t8 <= min(-over1+n,t4+126); t8 += 2) { - s6(0,t2,0,t4,1,t6,2,t8,-1); - for(t10 = t6; t10 <= min(t6+6,-over2+n); t10 += 2) { - for(t12 = t2; t12 <= min(n,t2+511); t12++) { - s0(0,t2,0,t4,1,t6,2,t8,1,t10,0,t12,0); - s5(0,t2,0,t4,1,t6,2,t8,1,t10,0,t12,1); - s9(0,t2,0,t4,1,t6,2,t8,1,t10,0,t12,2); - } - } - if (over2 >= 1 && t6 >= n-7) { - for(t12 = t2; t12 <= min(n,t2+511); t12++) { - s7(0,t2,0,t4,1,t6,2,t8,2,n,0,t12,0); - s8(0,t2,0,t4,1,t6,2,t8,2,n,0,t12,1); - } - } - } - if (t4 >= n-127 && over1 >= 1) { - for(t10 = t6; t10 <= min(n,t6+7); t10++) { - for(t12 = t2; t12 <= min(n,t2+511); t12++) { - s4(0,t2,0,t4,1,t6,4,n,0,t10,0,t12,0); - } - } - } - } - } - } -} - ->>> ->>> diff --git a/omega/examples/experiments/gemv/codegen.input b/omega/examples/experiments/gemv/codegen.input deleted file mode 100755 index 4152560..0000000 --- a/omega/examples/experiments/gemv/codegen.input +++ /dev/null @@ -1,14 +0,0 @@ -symbolic n, over1, over2; - -s0:= { [t1,t2,t3,t4,t5] : exists ( alpha,beta : t2 = 1+4beta && t4 = 1+4alpha && t1 = 1 && t3 = 1 && t5 = 0 && 0 <= over2 <= 3 && 0 <= over1 <= 3 && 1 <= t4 && 1 <= t2 && over1+t2 <= n && over2+t4 <= n) }; -s1:= { [t1] : 1+t1 = 0 && 0 <= over2 <= 3 && 0 <= over1 <= 3 && 1 <= n }; -s2:= { [t1,t2,t3,t4,t5] : t1 = 2 && t3 = 0 && t5 = 0 && 1 <= t2 <= n && 1 <= t4 <= n && 0 <= over2 <= 3 && over1 <= 3 && n < over1+t2 }; -s3:= { [t1,t2,t3,t4,t5] : exists ( alpha,beta : t2 = 1+4beta && t4 = 1+4alpha && t1 = 1 && t3 = 1 && t5 = 1 && 0 <= over2 <= 3 && 0 <= over1 <= 3 && 1 <= t4 && 1 <= t2 && over1+t2 <= n && over2+t4 <= n) }; -s4:= { [t1,t2,t3] : exists ( alpha : t2 = 1+4alpha && 1+t3 = 0 && t1 = 1 && 0 <= over1 <= 3 && 0 <= over2 <= 3 && over1+t2 <= n && 1 <= t2) }; -s5:= { [t1,t2,t3,t4,t5] : exists ( alpha : t2 = 1+4alpha && t5 = 0 && t1 = 1 && t3 = 2 && 0 <= over1 <= 3 && 1 <= t4 <= n && over2 <= 3 && 1 <= t2 && over1+t2 <= n && n < over2+t4) }; -s6:= { [t1,t2,t3,t4,t5] : exists ( alpha : t2 = 1+4alpha && t5 = 1 && t1 = 1 && t3 = 2 && 0 <= over1 <= 3 && 1 <= t4 <= n && over2 <= 3 && 1 <= t2 && over1+t2 <= n && n < over2+t4) }; -s7:= { [t1,t2,t3,t4,t5] : exists ( alpha,beta : t2 = 1+4beta && t4 = 1+4alpha && t5 = 2 && t1 = 1 && t3 = 1 && 0 <= over1 <= 3 && 0 <= over2 <= 3 && 1 <= t4 && 1 <= t2 && over1+t2 <= n && over2+t4 <= n) }; - -codegen s0,s1,s2,s3,s4,s5,s6,s7; - - diff --git a/omega/examples/experiments/gemv/gemv.out b/omega/examples/experiments/gemv/gemv.out deleted file mode 100644 index b9dd445..0000000 --- a/omega/examples/experiments/gemv/gemv.out +++ /dev/null @@ -1,40 +0,0 @@ ->>> symbolic n, over1, over2; ->>> ->>> s0:= { [t1,t2,t3,t4,t5] : exists ( alpha,beta : t2 = 1+4beta && t4 = 1+4alpha && t1 = 1 && t3 = 1 && t5 = 0 && 0 <= over2 <= 3 && 0 <= over1 <= 3 && 1 <= t4 && 1 <= t2 && over1+t2 <= n && over2+t4 <= n) }; ->>> s1:= { [t1] : 1+t1 = 0 && 0 <= over2 <= 3 && 0 <= over1 <= 3 && 1 <= n }; ->>> s2:= { [t1,t2,t3,t4,t5] : t1 = 2 && t3 = 0 && t5 = 0 && 1 <= t2 <= n && 1 <= t4 <= n && 0 <= over2 <= 3 && over1 <= 3 && n < over1+t2 }; ->>> s3:= { [t1,t2,t3,t4,t5] : exists ( alpha,beta : t2 = 1+4beta && t4 = 1+4alpha && t1 = 1 && t3 = 1 && t5 = 1 && 0 <= over2 <= 3 && 0 <= over1 <= 3 && 1 <= t4 && 1 <= t2 && over1+t2 <= n && over2+t4 <= n) }; ->>> s4:= { [t1,t2,t3] : exists ( alpha : t2 = 1+4alpha && 1+t3 = 0 && t1 = 1 && 0 <= over1 <= 3 && 0 <= over2 <= 3 && over1+t2 <= n && 1 <= t2) }; ->>> s5:= { [t1,t2,t3,t4,t5] : exists ( alpha : t2 = 1+4alpha && t5 = 0 && t1 = 1 && t3 = 2 && 0 <= over1 <= 3 && 1 <= t4 <= n && over2 <= 3 && 1 <= t2 && over1+t2 <= n && n < over2+t4) }; ->>> s6:= { [t1,t2,t3,t4,t5] : exists ( alpha : t2 = 1+4alpha && t5 = 1 && t1 = 1 && t3 = 2 && 0 <= over1 <= 3 && 1 <= t4 <= n && over2 <= 3 && 1 <= t2 && over1+t2 <= n && n < over2+t4) }; ->>> s7:= { [t1,t2,t3,t4,t5] : exists ( alpha,beta : t2 = 1+4beta && t4 = 1+4alpha && t5 = 2 && t1 = 1 && t3 = 1 && 0 <= over1 <= 3 && 0 <= over2 <= 3 && 1 <= t4 && 1 <= t2 && over1+t2 <= n && over2+t4 <= n) }; ->>> ->>> codegen s0,s1,s2,s3,s4,s5,s6,s7; -if (over2 >= 0 && over1 <= 3 && over2 <= 3) { - if (over1 >= 0) { - if (n >= 1) { - s1(-1); - } - for(t2 = 1; t2 <= n-over1; t2 += 4) { - s4(1,t2,-1); - for(t4 = 1; t4 <= n-over2; t4 += 4) { - s0(1,t2,1,t4,0); - s3(1,t2,1,t4,1); - s7(1,t2,1,t4,2); - } - for(t4 = max(1,n-over2+1); t4 <= n; t4++) { - s5(1,t2,2,t4,0); - s6(1,t2,2,t4,1); - } - } - } - for(t2 = max(1,n-over1+1); t2 <= n; t2++) { - for(t4 = 1; t4 <= n; t4++) { - s2(2,t2,0,t4,0); - } - } -} - ->>> ->>> ->>> diff --git a/omega/examples/experiments/lu/codegen.input b/omega/examples/experiments/lu/codegen.input deleted file mode 100755 index 0505f2d..0000000 --- a/omega/examples/experiments/lu/codegen.input +++ /dev/null @@ -1,33 +0,0 @@ -symbolic n, over1, over2, over3; - -s0:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : 1=2 }; -s1:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2sigma = t12 && t2 = 1+t6+256alpha && 2beta = 1+t10 && t4 = 1+256gamma && t6 = 1+64delta && t8 = 2+8tau && t15 = 1 && t9 = 2 && t11 = 1 && t13 = 0 && t1 = 0 && t3 = 0 && t5 = 0 && t7 = 1 && t12-62, t14+2 <= t2 <= t8 <= t12 <= t8+6 && t2-1, t10-254 <= t6 <= t10 && 1, t14-255 <= t4 <= t14 && 0 <= over2 <= 1 && 0 <= over3 <= 1 && 0 <= over1 <= 1 && over3+t12 <= n && over2+t10 <= n) }; -s2:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9] : exists ( alpha : t2 = 2+64alpha && 1+t4 = t6 && t7 = 0 && t9 = 0 && t1 = 0 && t3 = 2 && t5 = 0 && 2, t6-63 <= t2 <= t6 <= t8 <= n && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1) }; -s3:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9] : exists ( alpha : t2 = 2+64alpha && t5 = 1 && t7 = 0 && t9 = 0 && t1 = 0 && t3 = 2 && t2-1 <= t4 < t6 <= t2+63, n && t4 < t8 <= n && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && 2 <= t2) }; -s4:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2tau = t12 && 2alpha = t10 && t6 = 1+256beta && t2 = 2+64gamma && t4 = 2+256delta && t8+8sigma = 2 && t1 = 0 && 1+t3 = 0 && 1+t5 = 0 && t7 = 0 && t9 = 0 && t11 = 1 && t13 = 0 && t15 = 0 && 1, t14-255 <= t6 <= t14 < t4 <= t10 <= t4+254, t2-4 && t2, t12-6 <= t8 <= t12 <= t2+62 && 0 <= over1 <= 1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && over1+t12 <= n) }; -s5:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11] : exists ( alpha,beta : t2 = 2+64beta && t4 = 2+256alpha && 1+t3 = 0 && t7 = 0 && t9 = 0 && t11 = 1 && t1 = 0 && t5 = 1 && 2, t6-255 <= t4 <= t10 < t6 <= t2-2 && t8-63 <= t2 <= t8 <= n && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1) }; -s6:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11] : exists ( alpha,beta,gamma : t4 = 2+256gamma && t6 = 1+256alpha && t2 = 2+64beta && t1 = 0 && 1+t3 = 0 && 1+t5 = 0 && 1+t7 = 0 && t9 = 0 && t11 = 0 && 1, t8-255 <= t6 <= t8 < t4 <= t10 <= t2-2, t4+255 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && t2 <= n) }; -s7:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta : t8 = 2+8delta && t4 = 2+256alpha && t6 = 1+256beta && t2 = 2+64gamma && 1+t5 = 0 && t7 = 0 && t11 = 0 && t13 = 0 && t1 = 0 && 2+t9 = 0 && 1+t3 = 0 && t4+64, t10-63 <= t2 <= t8 <= t10 <= t8+7, n && 1, t12-255 <= t6 <= t12 <= t4-1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1) }; -s8:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta : t8 = 2+8delta && t4 = 2+256alpha && t6 = 1+256beta && 2+t10 = t2 && t2 = 2+64gamma && t7 = 0 && t11 = 0 && t13 = 0 && t15 = 1 && t1 = 0 && t9 = 1 && 1+t3 = 0 && 1+t5 = 0 && t4+64, t12-63 <= t2 <= t8 <= t12 <= t8+7, n && 1, t14-255 <= t6 <= t14 <= t4-1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && t2 <= t4+256) }; -s9:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2sigma = t12 && 2alpha = t10 && t6 = 1+256beta && t2 = 2+64gamma && t4 = 2+256delta && t8 = 2+8tau && t1 = 0 && 1+t3 = 0 && 1+t5 = 0 && t7 = 0 && t9 = 0 && t11 = 1 && t13 = 0 && t15 = 1 && 1, t14-255 <= t6 <= t14 < t4 <= t10 <= t4+254, t2-4 && t2, t12-6 <= t8 <= t12 && 0 <= over1 <= 1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && t8 <= t2+56 && over1+t12 <= n) }; -s10:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11] : exists ( alpha,beta,gamma,delta,tau : t8 = 2+8tau && 2alpha = t10 && t6 = 1+256beta && t2 = 2+64gamma && t4 = 2+256delta && t7 = 0 && t9 = 0 && t1 = 0 && 1+t11 = 0 && 1+t3 = 0 && 1+t5 = 0 && t6+1, t10-254 <= t4 <= t10 <= t2-4 && t8-56 <= t2 <= t8 <= n && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && 1 <= t6) }; -s11:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau : t8 = 2+8beta && 2gamma = t10 && t6 = 1+256delta && t2 = 2+64tau && t4 = 2+256alpha && n = t12 && over1 = 1 && t7 = 0 && t9 = 0 && t13 = 0 && t15 = 0 && t1 = 0 && t11 = 2 && 1+t3 = 0 && 1+t5 = 0 && 1, t14-255 <= t6 <= t14 < t4 <= t10 <= t2-4, t4+254 && t12-63 <= t2 <= t8 <= t12 <= t8+7 && 0 <= over2 <= 1 && 0 <= over3 <= 1) }; -s12:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau : t8 = 2+8beta && 2gamma = t10 && t6 = 1+256delta && t2 = 2+64tau && t4 = 2+256alpha && n = t12 && over1 = 1 && t7 = 0 && t9 = 0 && t13 = 0 && t15 = 1 && t1 = 0 && t11 = 2 && 1+t3 = 0 && 1+t5 = 0 && 1, t14-255 <= t6 <= t14 < t4 <= t10 <= t4+254, t2-4 && t8-56 <= t2 <= t8 <= t12 <= t8+7 && 0 <= over2 <= 1 && 0 <= over3 <= 1) }; -s13:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2sigma = t12 && 2alpha = t10 && t6 = 1+256beta && t2 = 2+64gamma && t4 = 2+256delta && t8 = 2+8tau && t7 = 0 && t9 = 0 && t11 = 1 && t13 = 0 && t1 = 0 && t15 = 2 && 1+t3 = 0 && 1+t5 = 0 && 1, t14-255 <= t6 <= t14 < t4 <= t10 <= t4+254, t2-4 && t2, t12-6 <= t8 <= t12 <= t2+62 && 0 <= over1 <= 1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && over1+t12 <= n) }; -s14:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9] : exists ( alpha,beta : t2 = 2+64beta && t4 = 2+256alpha && t1 = 0 && 1+t3 = 0 && t5 = 0 && t7 = 0 && t9 = 0 && 2, t8-255 <= t4 <= t6 < t8 <= t2-2 && 0 <= over1 <= 1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && t2 <= n) }; -s15:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11] : exists ( alpha,beta,gamma : t2 = 1+t6+256gamma && t6 = 1+64alpha && t4 = 1+256beta && t1 = 0 && t3 = 0 && t5 = 0 && t7 = 0 && t9 = 0 && t11 = 0 && 1, t8-255 <= t4 <= t8 <= t2-2 && t2-1, t10-255 <= t6 <= t10 <= n && 0 <= over1 <= 1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && t2 <= n) }; -s16:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta : t8 = 2+8delta && t2 = 1+t6+256alpha && t6 = 1+64beta && t4 = 1+256gamma && t5 = 0 && t7 = 1 && t11 = 0 && t13 = 0 && t1 = 0 && 1+t9 = 0 && t3 = 0 && t12+2, t10-63 <= t2 <= t8 <= t10 <= t8+7, n && 1, t12-255 <= t4 <= t12 && 0 <= over1 <= 1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && t2-1 <= t6 <= n) }; -s17:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9] : exists ( alpha,beta,gamma,delta : t8 = 2+8delta && t2 = 1+t6+256alpha && t6 = 1+64beta && t4 = 1+256gamma && t5 = 0 && t7 = 1 && t1 = 0 && t9 = 0 && t3 = 0 && t8-56, t4+65 <= t2 <= t8 <= n && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && t2-1 <= t6 <= n && 1 <= t4) }; -s18:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta : t8 = 2+8beta && t2 = 1+t6+256gamma && t6 = 1+64delta && t4 = 1+256alpha && n = t10 && over2 = 1 && t5 = 0 && t7 = 1 && t11 = 0 && t13 = 0 && t15 = 1 && t1 = 0 && t9 = 3 && t3 = 0 && t14+2, t12-63 <= t2 <= t8 <= t12 <= t8+7, t10 && 1, t14-255 <= t4 <= t14 && t10-255 <= t6 <= t10 && 0 <= over1 <= 1 && 0 <= over3 <= 1) }; -s19:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : 1=2 }; -s20:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2sigma = t12 && t2 = 1+t6+256alpha && 2beta = 1+t10 && t4 = 1+256gamma && t6 = 1+64delta && t8 = 2+8tau && t15 = 3 && t9 = 2 && t11 = 1 && t13 = 0 && t1 = 0 && t3 = 0 && t5 = 0 && t7 = 1 && 1, t14-255 <= t4 <= t14 <= t2-2 && t2, t12-6 <= t8 <= t12 && t2-1, t10-254 <= t6 <= t10 && 0 <= over2 <= 1 && 0 <= over3 <= 1 && 0 <= over1 <= 1 && t8 <= t2+56 && over2+t10 <= n && over3+t12 <= n) }; -s21:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11] : exists ( alpha,beta,gamma,delta,tau : t8 = 2+8tau && t2 = 1+t6+256alpha && t6 = 1+64beta && t4 = 1+256gamma && 2delta = t10+t6 && 1+t11 = 0 && t7 = 1 && t9 = 2 && t1 = 0 && t3 = 0 && t5 = 0 && t8-56, t4+65 <= t2 <= t8 <= n && t2-1, t10-254 <= t6 <= t10 && 0 <= over2 <= 1 && 0 <= over3 <= 1 && 0 <= over1 <= 1 && 1 <= t4 && over2+t10 <= n) }; -s22:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta : t8 = 2+8beta && 2delta = 1+t10 && t4 = 1+256alpha && t2 = 1+t6 && n = t12 && t6 = 1+64gamma && over3 = 1 && t7 = 1 && t9 = 2 && t13 = 0 && t15 = 1 && t1 = 0 && t11 = 3 && t3 = 0 && t5 = 0 && 1, t14-255 <= t4 <= t14 < t6 < t8 <= t12 <= t8+7, t6+64 && 0 <= over1 <= 1 && 0 <= over2 <= 1 && t6 <= t10 && over2+t10 <= t12) }; -s23:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta : t8 = 2+8beta && 2delta = 1+t10 && t4 = 1+256alpha && t2 = 1+t6 && t12 = n && t6 = 1+64gamma && over3 = 1 && t7 = 1 && t9 = 2 && t13 = 0 && t15 = 3 && t1 = 0 && t11 = 3 && t3 = 0 && t5 = 0 && 1, t14-255 <= t4 <= t14 < t6 < t8 <= n <= t8+7 && 0 <= over1 <= 1 && 0 <= over2 <= 1 && t8-57 <= t6 <= t10 && over2+t10 <= n) }; -s24:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : 1=2 }; -s25:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2sigma = t12 && t2 = 1+t6+256alpha && 2beta = 1+t10 && t4 = 1+256gamma && t6 = 1+64delta && t8 = 2+8tau && t15 = 5 && t9 = 2 && t11 = 1 && t13 = 0 && t1 = 0 && t3 = 0 && t5 = 0 && t7 = 1 && t12-62, t14+2 <= t2 <= t8 <= t12 <= t8+6 && t2-1, t10-254 <= t6 <= t10 && 1, t14-255 <= t4 <= t14 && 0 <= over2 <= 1 && 0 <= over3 <= 1 && 0 <= over1 <= 1 && over2+t10 <= n && over3+t12 <= n) }; -s26:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : 1=2 }; -s27:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2sigma = t12 && t2 = 1+t6+256alpha && 2beta = 1+t10 && t4 = 1+256gamma && t6 = 1+64delta && t8 = 2+8tau && t15 = 7 && t9 = 2 && t11 = 1 && t13 = 0 && t1 = 0 && t3 = 0 && t5 = 0 && t7 = 1 && 1, t14-255 <= t4 <= t14 <= t2-2 && t12-6, t2 <= t8 <= t12 && t2-1, t10-254 <= t6 <= t10 && 0 <= over2 <= 1 && 0 <= over3 <= 1 && 0 <= over1 <= 1 && t8 <= t2+56 && over2+t10 <= n && over3+t12 <= n) }; - -codegen 1 s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20,s21,s22,s23,s24,s25,s26,s27; - diff --git a/omega/examples/experiments/lu/lu.out b/omega/examples/experiments/lu/lu.out deleted file mode 100644 index 443a4db..0000000 --- a/omega/examples/experiments/lu/lu.out +++ /dev/null @@ -1,141 +0,0 @@ ->>> symbolic n, over1, over2, over3; ->>> ->>> s0:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : 1=2 }; ->>> s1:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2sigma = t12 && t2 = 1+t6+256alpha && 2beta = 1+t10 && t4 = 1+256gamma && t6 = 1+64delta && t8 = 2+8tau && t15 = 1 && t9 = 2 && t11 = 1 && t13 = 0 && t1 = 0 && t3 = 0 && t5 = 0 && t7 = 1 && t12-62, t14+2 <= t2 <= t8 <= t12 <= t8+6 && t2-1, t10-254 <= t6 <= t10 && 1, t14-255 <= t4 <= t14 && 0 <= over2 <= 1 && 0 <= over3 <= 1 && 0 <= over1 <= 1 && over3+t12 <= n && over2+t10 <= n) }; ->>> s2:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9] : exists ( alpha : t2 = 2+64alpha && 1+t4 = t6 && t7 = 0 && t9 = 0 && t1 = 0 && t3 = 2 && t5 = 0 && 2, t6-63 <= t2 <= t6 <= t8 <= n && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1) }; ->>> s3:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9] : exists ( alpha : t2 = 2+64alpha && t5 = 1 && t7 = 0 && t9 = 0 && t1 = 0 && t3 = 2 && t2-1 <= t4 < t6 <= t2+63, n && t4 < t8 <= n && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && 2 <= t2) }; ->>> s4:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2tau = t12 && 2alpha = t10 && t6 = 1+256beta && t2 = 2+64gamma && t4 = 2+256delta && t8+8sigma = 2 && t1 = 0 && 1+t3 = 0 && 1+t5 = 0 && t7 = 0 && t9 = 0 && t11 = 1 && t13 = 0 && t15 = 0 && 1, t14-255 <= t6 <= t14 < t4 <= t10 <= t4+254, t2-4 && t2, t12-6 <= t8 <= t12 <= t2+62 && 0 <= over1 <= 1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && over1+t12 <= n) }; ->>> s5:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11] : exists ( alpha,beta : t2 = 2+64beta && t4 = 2+256alpha && 1+t3 = 0 && t7 = 0 && t9 = 0 && t11 = 1 && t1 = 0 && t5 = 1 && 2, t6-255 <= t4 <= t10 < t6 <= t2-2 && t8-63 <= t2 <= t8 <= n && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1) }; ->>> s6:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11] : exists ( alpha,beta,gamma : t4 = 2+256gamma && t6 = 1+256alpha && t2 = 2+64beta && t1 = 0 && 1+t3 = 0 && 1+t5 = 0 && 1+t7 = 0 && t9 = 0 && t11 = 0 && 1, t8-255 <= t6 <= t8 < t4 <= t10 <= t2-2, t4+255 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && t2 <= n) }; ->>> s7:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta : t8 = 2+8delta && t4 = 2+256alpha && t6 = 1+256beta && t2 = 2+64gamma && 1+t5 = 0 && t7 = 0 && t11 = 0 && t13 = 0 && t1 = 0 && 2+t9 = 0 && 1+t3 = 0 && t4+64, t10-63 <= t2 <= t8 <= t10 <= t8+7, n && 1, t12-255 <= t6 <= t12 <= t4-1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1) }; ->>> s8:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta : t8 = 2+8delta && t4 = 2+256alpha && t6 = 1+256beta && 2+t10 = t2 && t2 = 2+64gamma && t7 = 0 && t11 = 0 && t13 = 0 && t15 = 1 && t1 = 0 && t9 = 1 && 1+t3 = 0 && 1+t5 = 0 && t4+64, t12-63 <= t2 <= t8 <= t12 <= t8+7, n && 1, t14-255 <= t6 <= t14 <= t4-1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && t2 <= t4+256) }; ->>> s9:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2sigma = t12 && 2alpha = t10 && t6 = 1+256beta && t2 = 2+64gamma && t4 = 2+256delta && t8 = 2+8tau && t1 = 0 && 1+t3 = 0 && 1+t5 = 0 && t7 = 0 && t9 = 0 && t11 = 1 && t13 = 0 && t15 = 1 && 1, t14-255 <= t6 <= t14 < t4 <= t10 <= t4+254, t2-4 && t2, t12-6 <= t8 <= t12 && 0 <= over1 <= 1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && t8 <= t2+56 && over1+t12 <= n) }; ->>> s10:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11] : exists ( alpha,beta,gamma,delta,tau : t8 = 2+8tau && 2alpha = t10 && t6 = 1+256beta && t2 = 2+64gamma && t4 = 2+256delta && t7 = 0 && t9 = 0 && t1 = 0 && 1+t11 = 0 && 1+t3 = 0 && 1+t5 = 0 && t6+1, t10-254 <= t4 <= t10 <= t2-4 && t8-56 <= t2 <= t8 <= n && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && 1 <= t6) }; ->>> s11:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau : t8 = 2+8beta && 2gamma = t10 && t6 = 1+256delta && t2 = 2+64tau && t4 = 2+256alpha && n = t12 && over1 = 1 && t7 = 0 && t9 = 0 && t13 = 0 && t15 = 0 && t1 = 0 && t11 = 2 && 1+t3 = 0 && 1+t5 = 0 && 1, t14-255 <= t6 <= t14 < t4 <= t10 <= t2-4, t4+254 && t12-63 <= t2 <= t8 <= t12 <= t8+7 && 0 <= over2 <= 1 && 0 <= over3 <= 1) }; ->>> s12:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau : t8 = 2+8beta && 2gamma = t10 && t6 = 1+256delta && t2 = 2+64tau && t4 = 2+256alpha && n = t12 && over1 = 1 && t7 = 0 && t9 = 0 && t13 = 0 && t15 = 1 && t1 = 0 && t11 = 2 && 1+t3 = 0 && 1+t5 = 0 && 1, t14-255 <= t6 <= t14 < t4 <= t10 <= t4+254, t2-4 && t8-56 <= t2 <= t8 <= t12 <= t8+7 && 0 <= over2 <= 1 && 0 <= over3 <= 1) }; ->>> s13:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2sigma = t12 && 2alpha = t10 && t6 = 1+256beta && t2 = 2+64gamma && t4 = 2+256delta && t8 = 2+8tau && t7 = 0 && t9 = 0 && t11 = 1 && t13 = 0 && t1 = 0 && t15 = 2 && 1+t3 = 0 && 1+t5 = 0 && 1, t14-255 <= t6 <= t14 < t4 <= t10 <= t4+254, t2-4 && t2, t12-6 <= t8 <= t12 <= t2+62 && 0 <= over1 <= 1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && over1+t12 <= n) }; ->>> s14:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9] : exists ( alpha,beta : t2 = 2+64beta && t4 = 2+256alpha && t1 = 0 && 1+t3 = 0 && t5 = 0 && t7 = 0 && t9 = 0 && 2, t8-255 <= t4 <= t6 < t8 <= t2-2 && 0 <= over1 <= 1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && t2 <= n) }; ->>> s15:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11] : exists ( alpha,beta,gamma : t2 = 1+t6+256gamma && t6 = 1+64alpha && t4 = 1+256beta && t1 = 0 && t3 = 0 && t5 = 0 && t7 = 0 && t9 = 0 && t11 = 0 && 1, t8-255 <= t4 <= t8 <= t2-2 && t2-1, t10-255 <= t6 <= t10 <= n && 0 <= over1 <= 1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && t2 <= n) }; ->>> s16:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta : t8 = 2+8delta && t2 = 1+t6+256alpha && t6 = 1+64beta && t4 = 1+256gamma && t5 = 0 && t7 = 1 && t11 = 0 && t13 = 0 && t1 = 0 && 1+t9 = 0 && t3 = 0 && t12+2, t10-63 <= t2 <= t8 <= t10 <= t8+7, n && 1, t12-255 <= t4 <= t12 && 0 <= over1 <= 1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && t2-1 <= t6 <= n) }; ->>> s17:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9] : exists ( alpha,beta,gamma,delta : t8 = 2+8delta && t2 = 1+t6+256alpha && t6 = 1+64beta && t4 = 1+256gamma && t5 = 0 && t7 = 1 && t1 = 0 && t9 = 0 && t3 = 0 && t8-56, t4+65 <= t2 <= t8 <= n && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && t2-1 <= t6 <= n && 1 <= t4) }; ->>> s18:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta : t8 = 2+8beta && t2 = 1+t6+256gamma && t6 = 1+64delta && t4 = 1+256alpha && n = t10 && over2 = 1 && t5 = 0 && t7 = 1 && t11 = 0 && t13 = 0 && t15 = 1 && t1 = 0 && t9 = 3 && t3 = 0 && t14+2, t12-63 <= t2 <= t8 <= t12 <= t8+7, t10 && 1, t14-255 <= t4 <= t14 && t10-255 <= t6 <= t10 && 0 <= over1 <= 1 && 0 <= over3 <= 1) }; ->>> s19:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : 1=2 }; ->>> s20:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2sigma = t12 && t2 = 1+t6+256alpha && 2beta = 1+t10 && t4 = 1+256gamma && t6 = 1+64delta && t8 = 2+8tau && t15 = 3 && t9 = 2 && t11 = 1 && t13 = 0 && t1 = 0 && t3 = 0 && t5 = 0 && t7 = 1 && 1, t14-255 <= t4 <= t14 <= t2-2 && t2, t12-6 <= t8 <= t12 && t2-1, t10-254 <= t6 <= t10 && 0 <= over2 <= 1 && 0 <= over3 <= 1 && 0 <= over1 <= 1 && t8 <= t2+56 && over2+t10 <= n && over3+t12 <= n) }; ->>> s21:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11] : exists ( alpha,beta,gamma,delta,tau : t8 = 2+8tau && t2 = 1+t6+256alpha && t6 = 1+64beta && t4 = 1+256gamma && 2delta = t10+t6 && 1+t11 = 0 && t7 = 1 && t9 = 2 && t1 = 0 && t3 = 0 && t5 = 0 && t8-56, t4+65 <= t2 <= t8 <= n && t2-1, t10-254 <= t6 <= t10 && 0 <= over2 <= 1 && 0 <= over3 <= 1 && 0 <= over1 <= 1 && 1 <= t4 && over2+t10 <= n) }; ->>> s22:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta : t8 = 2+8beta && 2delta = 1+t10 && t4 = 1+256alpha && t2 = 1+t6 && n = t12 && t6 = 1+64gamma && over3 = 1 && t7 = 1 && t9 = 2 && t13 = 0 && t15 = 1 && t1 = 0 && t11 = 3 && t3 = 0 && t5 = 0 && 1, t14-255 <= t4 <= t14 < t6 < t8 <= t12 <= t8+7, t6+64 && 0 <= over1 <= 1 && 0 <= over2 <= 1 && t6 <= t10 && over2+t10 <= t12) }; ->>> s23:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta : t8 = 2+8beta && 2delta = 1+t10 && t4 = 1+256alpha && t2 = 1+t6 && t12 = n && t6 = 1+64gamma && over3 = 1 && t7 = 1 && t9 = 2 && t13 = 0 && t15 = 3 && t1 = 0 && t11 = 3 && t3 = 0 && t5 = 0 && 1, t14-255 <= t4 <= t14 < t6 < t8 <= n <= t8+7 && 0 <= over1 <= 1 && 0 <= over2 <= 1 && t8-57 <= t6 <= t10 && over2+t10 <= n) }; ->>> s24:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : 1=2 }; ->>> s25:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2sigma = t12 && t2 = 1+t6+256alpha && 2beta = 1+t10 && t4 = 1+256gamma && t6 = 1+64delta && t8 = 2+8tau && t15 = 5 && t9 = 2 && t11 = 1 && t13 = 0 && t1 = 0 && t3 = 0 && t5 = 0 && t7 = 1 && t12-62, t14+2 <= t2 <= t8 <= t12 <= t8+6 && t2-1, t10-254 <= t6 <= t10 && 1, t14-255 <= t4 <= t14 && 0 <= over2 <= 1 && 0 <= over3 <= 1 && 0 <= over1 <= 1 && over2+t10 <= n && over3+t12 <= n) }; ->>> s26:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : 1=2 }; ->>> s27:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2sigma = t12 && t2 = 1+t6+256alpha && 2beta = 1+t10 && t4 = 1+256gamma && t6 = 1+64delta && t8 = 2+8tau && t15 = 7 && t9 = 2 && t11 = 1 && t13 = 0 && t1 = 0 && t3 = 0 && t5 = 0 && t7 = 1 && 1, t14-255 <= t4 <= t14 <= t2-2 && t12-6, t2 <= t8 <= t12 && t2-1, t10-254 <= t6 <= t10 && 0 <= over2 <= 1 && 0 <= over3 <= 1 && 0 <= over1 <= 1 && t8 <= t2+56 && over2+t10 <= n && over3+t12 <= n) }; ->>> ->>> codegen 1 s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20,s21,s22,s23,s24,s25,s26,s27; -if (over1 >= 0 && over1 <= 1 && over3 <= 1 && over3 >= 0 && over2 >= 0 && over2 <= 1) { - for(t2 = 2; t2 <= n; t2 += 64) { - for(t4 = 2; t4 <= t2-64; t4 += 256) { - for(t6 = 1; t6 <= t4-1; t6 += 256) { - for(t8 = t6; t8 <= min(t6+255,t4-1); t8++) { - for(t10 = t4; t10 <= min(t2-2,t4+255); t10++) { - s6(0,t2,-1,t4,-1,t6,-1,t8,0,t10,0); - } - } - for(t8 = t2; t8 <= min(n,t2+56); t8 += 8) { - for(t10 = t8; t10 <= min(t8+7,n); t10++) { - for(t12 = t6; t12 <= min(t6+255,t4-1); t12++) { - s7(0,t2,-1,t4,-1,t6,0,t8,-2,t10,0,t12,0); - } - } - for(t10 = t4; t10 <= min(t2-4,t4+254); t10 += 2) { - s10(0,t2,-1,t4,-1,t6,0,t8,0,t10,-1); - for(t12 = t8; t12 <= min(-over1+n,t8+6); t12 += 2) { - for(t14 = t6; t14 <= min(t4-1,t6+255); t14++) { - s4(0,t2,-1,t4,-1,t6,0,t8,0,t10,1,t12,0,t14,0); - s9(0,t2,-1,t4,-1,t6,0,t8,0,t10,1,t12,0,t14,1); - s13(0,t2,-1,t4,-1,t6,0,t8,0,t10,1,t12,0,t14,2); - } - } - if (t8 >= n-7 && over1 >= 1) { - for(t14 = t6; t14 <= min(t4-1,t6+255); t14++) { - s11(0,t2,-1,t4,-1,t6,0,t8,0,t10,2,n,0,t14,0); - s12(0,t2,-1,t4,-1,t6,0,t8,0,t10,2,n,0,t14,1); - } - } - } - if (t4 >= t2-256) { - for(t12 = t8; t12 <= min(t8+7,n); t12++) { - for(t14 = t6; t14 <= min(t6+255,t4-1); t14++) { - s8(0,t2,-1,t4,-1,t6,0,t8,1,t2-2,0,t12,0,t14,1); - } - } - } - } - } - for(t6 = t4; t6 <= min(t4+254,t2-3); t6++) { - for(t8 = t6+1; t8 <= min(t2-2,t4+255); t8++) { - s14(0,t2,-1,t4,0,t6,0,t8,0); - } - } - for(t6 = t4+1; t6 <= min(t2-2,t4+255); t6++) { - for(t8 = t2; t8 <= min(n,t2+63); t8++) { - for(t10 = t4; t10 <= t6-1; t10++) { - s5(0,t2,-1,t4,1,t6,0,t8,0,t10,1); - } - } - } - } - for(t4 = 1; t4 <= t2-65; t4 += 256) { - for(t6 = t2-1; t6 <= n; t6 += 256) { - for(t8 = t4; t8 <= min(t4+255,t2-2); t8++) { - for(t10 = t6; t10 <= min(n,t6+255); t10++) { - s15(0,t2,0,t4,0,t6,0,t8,0,t10,0); - } - } - for(t8 = t2; t8 <= min(t2+56,n); t8 += 8) { - for(t10 = t8; t10 <= min(n,t8+7); t10++) { - for(t12 = t4; t12 <= min(t4+255,t2-2); t12++) { - s16(0,t2,0,t4,0,t6,1,t8,-1,t10,0,t12,0); - } - } - s17(0,t2,0,t4,0,t6,1,t8,0); - for(t10 = t6; t10 <= min(n-over2,t6+254); t10 += 2) { - s21(0,t2,0,t4,0,t6,1,t8,2,t10,-1); - for(t12 = t8; t12 <= min(t8+6,n-over3); t12 += 2) { - for(t14 = t4; t14 <= min(t2-2,t4+255); t14++) { - s1(0,t2,0,t4,0,t6,1,t8,2,t10,1,t12,0,t14,1); - s20(0,t2,0,t4,0,t6,1,t8,2,t10,1,t12,0,t14,3); - s25(0,t2,0,t4,0,t6,1,t8,2,t10,1,t12,0,t14,5); - s27(0,t2,0,t4,0,t6,1,t8,2,t10,1,t12,0,t14,7); - } - } - if (over3 >= 1 && t8 >= n-7) { - for(t14 = t4; t14 <= min(t6-1,t4+255); t14++) { - s22(0,t2,0,t4,0,t6,1,t8,2,t10,3,n,0,t14,1); - s23(0,t2,0,t4,0,t6,1,t8,2,t10,3,n,0,t14,3); - } - } - } - if (t6 >= n-255 && over2 >= 1) { - for(t12 = t8; t12 <= min(t8+7,n); t12++) { - for(t14 = t4; t14 <= min(t2-2,t4+255); t14++) { - s18(0,t2,0,t4,0,t6,1,t8,3,n,0,t12,0,t14,1); - } - } - } - } - } - } - for(t4 = t2-1; t4 <= min(t2+62,n-1); t4++) { - for(t8 = t4+1; t8 <= n; t8++) { - s2(0,t2,2,t4,0,t4+1,0,t8,0); - } - for(t6 = t4+1; t6 <= min(n,t2+63); t6++) { - for(t8 = t4+1; t8 <= n; t8++) { - s3(0,t2,2,t4,1,t6,0,t8,0); - } - } - } - } -} - ->>> ->>> diff --git a/omega/examples/experiments/qr/codegen.input b/omega/examples/experiments/qr/codegen.input deleted file mode 100755 index 01f8496..0000000 --- a/omega/examples/experiments/qr/codegen.input +++ /dev/null @@ -1,17 +0,0 @@ -symbolic M, N; - -s1:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : 1+In_3 = 0 && In_4 = 1+In_6 && In_2 = In_6 && In_7 = 0 && In_1 = 0 && In_5 = 0 && 0 <= In_6 < N }; -s2:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_3 = 0 && 1+In_2 = In_4 && In_7 = 0 && In_1 = 0 && In_5 = 0 && 1 <= In_4 <= In_6+1, N && In_6 < M }; -s3:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_3 = 0 && In_4 = 1+In_6 && In_2 = In_6 && In_7 = 0 && In_1 = 0 && In_5 = 1 && 0 <= In_6 < N }; -s4:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_3 = 0 && 1+In_2 = In_4 && In_7 = 0 && In_1 = 0 && In_5 = 2 && 1 <= In_4 <= In_6+1, N && In_6 < M }; -s5:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_3 = 1 && In_4 = 1+In_6 && In_2 = In_6 && In_7 = 0 && In_1 = 0 && In_5 = 0 && 0 <= In_6 < N }; -s6:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_1 = 0 && In_3 = 4 && In_5 = 0 && In_7 = 0 && In_6 = In_2 && 0 <= In_2 <= In_4-2 && In_4 < N }; -s7:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_1 = 0 && In_3 = 4 && In_5 = 3 && In_7 = 0 && 0 <= In_2 <= In_6 < M && In_2+2 <= In_4 < N }; -s8:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_1 = 0 && In_3 = 4 && In_5 = 2 && In_7 = 0 && In_6 = M && In_2+2 <= In_4 <= N && 0 <= In_2 }; -s9:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_1 = 0 && In_3 = 4 && In_5 = 3 && In_7 = 1 && 0 <= In_2 <= In_6 < M && In_2+2 <= In_4 <= N }; -s10:= {[In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_3 = 2 && In_4 = N && In_6 = M && In_5 = 0 && In_7 = 0 && In_1 = 0 && 0 <= In_2 < N }; -s11:= {[In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_5 = 0 && In_3 = 3 && In_7 = 0 && In_1 = 0 && In_6 = In_2 && In_4 = 1+In_2 && 0 <= In_2 <= N-2 }; -s12:= {[In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_5 = 3 && In_3 = 3 && In_7 = 0 && In_1 = 0 && In_4 = 1+In_2 && 0 <= In_2 <= In_6 < M && In_2 <= N-2 }; - - -codegen s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12; diff --git a/omega/examples/experiments/qr/qr.out b/omega/examples/experiments/qr/qr.out deleted file mode 100644 index e09cc75..0000000 --- a/omega/examples/experiments/qr/qr.out +++ /dev/null @@ -1,54 +0,0 @@ ->>> symbolic M, N; ->>> ->>> s1:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : 1+In_3 = 0 && In_4 = 1+In_6 && In_2 = In_6 && In_7 = 0 && In_1 = 0 && In_5 = 0 && 0 <= In_6 < N }; ->>> s2:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_3 = 0 && 1+In_2 = In_4 && In_7 = 0 && In_1 = 0 && In_5 = 0 && 1 <= In_4 <= In_6+1, N && In_6 < M }; ->>> s3:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_3 = 0 && In_4 = 1+In_6 && In_2 = In_6 && In_7 = 0 && In_1 = 0 && In_5 = 1 && 0 <= In_6 < N }; ->>> s4:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_3 = 0 && 1+In_2 = In_4 && In_7 = 0 && In_1 = 0 && In_5 = 2 && 1 <= In_4 <= In_6+1, N && In_6 < M }; ->>> s5:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_3 = 1 && In_4 = 1+In_6 && In_2 = In_6 && In_7 = 0 && In_1 = 0 && In_5 = 0 && 0 <= In_6 < N }; ->>> s6:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_1 = 0 && In_3 = 4 && In_5 = 0 && In_7 = 0 && In_6 = In_2 && 0 <= In_2 <= In_4-2 && In_4 < N }; ->>> s7:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_1 = 0 && In_3 = 4 && In_5 = 3 && In_7 = 0 && 0 <= In_2 <= In_6 < M && In_2+2 <= In_4 < N }; ->>> s8:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_1 = 0 && In_3 = 4 && In_5 = 2 && In_7 = 0 && In_6 = M && In_2+2 <= In_4 <= N && 0 <= In_2 }; ->>> s9:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_1 = 0 && In_3 = 4 && In_5 = 3 && In_7 = 1 && 0 <= In_2 <= In_6 < M && In_2+2 <= In_4 <= N }; ->>> s10:= {[In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_3 = 2 && In_4 = N && In_6 = M && In_5 = 0 && In_7 = 0 && In_1 = 0 && 0 <= In_2 < N }; ->>> s11:= {[In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_5 = 0 && In_3 = 3 && In_7 = 0 && In_1 = 0 && In_6 = In_2 && In_4 = 1+In_2 && 0 <= In_2 <= N-2 }; ->>> s12:= {[In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_5 = 3 && In_3 = 3 && In_7 = 0 && In_1 = 0 && In_4 = 1+In_2 && 0 <= In_2 <= In_6 < M && In_2 <= N-2 }; ->>> ->>> ->>> codegen s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12; -for(t2 = 0; t2 <= N-1; t2++) { - s0(0,t2,-1,t2+1,0,t2,0); - for(t6 = t2+1-1; t6 <= M-1; t6++) { - s1(0,t2,0,t2+1,0,t6,0); - } - s2(0,t2,0,t2+1,1,t2,0); - for(t6 = t2+1-1; t6 <= M-1; t6++) { - s3(0,t2,0,t2+1,2,t6,0); - } - s4(0,t2,1,t2+1,0,t2,0); - s9(0,t2,2,N,0,M,0); - if (N >= t2+2) { - s10(0,t2,3,t2+1,0,t2+1-1,0); - for(t6 = t2; t6 <= M-1; t6++) { - s11(0,t2,3,t2+1,3,t6,0); - } - } - for(t4 = t2+2; t4 <= N; t4++) { - if (N >= t4+1) { - s5(0,t2,4,t4,0,t2,0); - } - s7(0,t2,4,t4,2,M,0); - if (N >= t4+1) { - for(t6 = t2; t6 <= M-1; t6++) { - s6(0,t2,4,t4,3,t6,0); - s8(0,t2,4,t4,3,t6,1); - } - } - else { - for(t6 = t2; t6 <= M-1; t6++) { - s8(0,t2,4,t4,3,t6,1); - } - } - } -} - ->>> diff --git a/omega/examples/experiments/swim/swim-codegen.input b/omega/examples/experiments/swim/swim-codegen.input deleted file mode 100755 index 4e558bc..0000000 --- a/omega/examples/experiments/swim/swim-codegen.input +++ /dev/null @@ -1,53 +0,0 @@ -symbolic N3,M,N; - - -s0:= {[t,i,j] : 0 <= j <= N-1 && 0 <= i <= M-1 && 0 <= t <= N3-1 }; -t0:={[t,i,j] -> [0,t,0,i,0,j,0]}; -s1:= {[t,j] : 0 <= j <= N-1 && 0 <= t <= N3-1}; -t1:={[t,j] -> [0,t,1,j,0,0,0]}; -s2:= {[t,i] : 0 <= i <= M-1 && 0 <= t <= N3-1}; -t2:={[t,i] -> [0,t,2,i,0,0,0]}; -s3:= {[t] : 0 <= t <= N3-1 }; -t3:={[t] -> [0,t,3,0,0,0,0]}; -s4:= {[t,i,j] : 0 <= j <= N-1 && i=M-1 && 0 <= t <= N3-1 }; -t4:={[t,i,j] -> [0,t,4,i,0,j,0] }; -s5:= {[t,j] : 0 <= j <= N-1 && 0 <= t <= N3-1 }; -t5:={[t,j] -> [0,t,8,j,0,0,0]}; -s6:= {[t,i] : 0 <= i <= M-1 && 0 <= t <= N3-1 }; -t6:={[t,i] -> [0,t,9,i,0,0,0]}; -s7:= {[t] : 0 <= t <= N3-1 }; -t7:={[t] -> [0,t,10,0,0,0,0]}; -s8:= {[t,i,j] : 0 <= j <= N-1 && M-2 <= i <= M-1 && 0 <= t <= N3-1 }; -t8:= {[t,i,j] -> [0,t,12,i,0,j,0]}; -s9:= {[t,j] : 0 <= j <= N-1 && 0 <= t <= N3-1 }; -t9:={[t,j] -> [0,t,15,j,0,0,0]}; -s10:= {[t,i] : 0 <= i <= M-1 && 0 <= t <= N3-1 }; -t10:={[t,i] -> [0,t,16,i,3,0,0]}; -s11:= {[t] : 0 <= t <= N3-1 }; -t11:={[t] -> [0,t,17,0,0,0,0]}; -s12:= {[t,i,j] : 0 <= j <= N-1 && 0 <= i <= 1 && 0 <= t <= N3-1 }; -t12:= {[t,i,j] -> [0,t,11,i,0,j,0]}; -s13:= {[t,i,j] : N-2 <= j <= N-1 && 2 <= i <= M-3 && 0 <= t <= N3-1 }; -t13:= {[t,i,j] -> [0,t,14,i,0,j,0]}; -s14:= {[t,i,j] : 0 <= j <= 1 && 2 <= i <= M-3 && 0 <= t <= N3-1 }; -t14:= {[t,i,j] -> [0,t,13,i,0,j,0]}; -s15:= {[t,i,j] : 2 <= j <= N-3 && 2 <= i <= M-3 && 0 <= t <= N3-1 }; -t15:={[t,i,j] -> [0,t,0,i+3,0,j+2,2]}; - -s16:= {[t,i,j] : 0 <= j <= N-1 && i=0 && 0 <= t <= N3-1 }; -t16:={[t,i,j] -> [0,t,5,i,0,j,0] }; - -s17:= {[t,i,j] : j =N-1 && 1<= i <=M-2 && 0 <= t <= N3-1 }; -t17:={[t,i,j] -> [0,t,6,i,0,j,0] }; - -s18:= {[t,i,j] : j =0 && 1<= i <=M-2 && 0 <= t <= N3-1}; -t18:={[t,i,j] -> [0,t,7,i,0,j,0] }; - -s19:= {[t,i,j] :1 <= j <= N-2 && 1 <= i <= M-2 && 0 <= t <= N3-1 }; -t19:={[t,i,j] -> [0,t,0,i+2,0,j+1,1]}; - - - -codegen 2 t0:s0,t1:s1,t2:s2,t3:s3,t4:s4,t5:s5,t6:s6,t7:s7,t8:s8,t9:s9,t10:s10,t11:s11,t12:s12,t13:s13,t14:s14,t15:s15,t16:s16,t17:s17,t18:s18,t19:s19; -#codegen 2 s0,t1:s1,t2:s2,t3:s3,t4:s4,t5:s5,t6:s6,t7:s7,t8:s8,t9:s9,t10:s10,t11:s11,t12:s12,t13:s13,t14:s14,t15:s15,t16:s16,t17:s17,t18:s18,t19:s19; - diff --git a/omega/examples/experiments/swim/swim.out b/omega/examples/experiments/swim/swim.out deleted file mode 100644 index 6adffdb..0000000 --- a/omega/examples/experiments/swim/swim.out +++ /dev/null @@ -1,176 +0,0 @@ ->>> symbolic N3,M,N; ->>> ->>> ->>> s0:= {[t,i,j] : 0 <= j <= N-1 && 0 <= i <= M-1 && 0 <= t <= N3-1 }; ->>> t0:={[t,i,j] -> [0,t,0,i,0,j,0]}; ->>> s1:= {[t,j] : 0 <= j <= N-1 && 0 <= t <= N3-1}; ->>> ->>> t1:={[t,j] -> [0,t,1,j,0,0,0]}; ->>> s2:= {[t,i] : 0 <= i <= M-1 && 0 <= t <= N3-1}; ->>> t2:={[t,i] -> [0,t,2,i,0,0,0]}; ->>> ->>> s3:= {[t] : 0 <= t <= N3-1 }; ->>> ->>> t3:={[t] -> [0,t,3,0,0,0,0]}; ->>> ->>> s4:= {[t,i,j] : 0 <= j <= N-1 && i=M-1 && 0 <= t <= N3-1 }; ->>> t4:={[t,i,j] -> [0,t,4,i,0,j,0] }; ->>> s5:= {[t,j] : 0 <= j <= N-1 && 0 <= t <= N3-1 }; ->>> ->>> t5:={[t,j] -> [0,t,8,j,0,0,0]}; ->>> ->>> s6:= {[t,i] : 0 <= i <= M-1 && 0 <= t <= N3-1 }; ->>> ->>> t6:={[t,i] -> [0,t,9,i,0,0,0]}; ->>> ->>> s7:= {[t] : 0 <= t <= N3-1 }; ->>> ->>> t7:={[t] -> [0,t,10,0,0,0,0]}; ->>> ->>> s8:= {[t,i,j] : 0 <= j <= N-1 && M-2 <= i <= M-1 && 0 <= t <= N3-1 }; ->>> t8:= {[t,i,j] -> [0,t,12,i,0,j,0]}; ->>> s9:= {[t,j] : 0 <= j <= N-1 && 0 <= t <= N3-1 }; ->>> ->>> t9:={[t,j] -> [0,t,15,j,0,0,0]}; ->>> s10:= {[t,i] : 0 <= i <= M-1 && 0 <= t <= N3-1 }; ->>> t10:={[t,i] -> [0,t,16,i,3,0,0]}; ->>> ->>> s11:= {[t] : 0 <= t <= N3-1 }; ->>> ->>> t11:={[t] -> [0,t,17,0,0,0,0]}; ->>> ->>> s12:= {[t,i,j] : 0 <= j <= N-1 && 0 <= i <= 1 && 0 <= t <= N3-1 }; ->>> t12:= {[t,i,j] -> [0,t,11,i,0,j,0]}; ->>> s13:= {[t,i,j] : N-2 <= j <= N-1 && 2 <= i <= M-3 && 0 <= t <= N3-1 }; ->>> t13:= {[t,i,j] -> [0,t,14,i,0,j,0]}; ->>> s14:= {[t,i,j] : 0 <= j <= 1 && 2 <= i <= M-3 && 0 <= t <= N3-1 }; ->>> t14:= {[t,i,j] -> [0,t,13,i,0,j,0]}; ->>> s15:= {[t,i,j] : 2 <= j <= N-3 && 2 <= i <= M-3 && 0 <= t <= N3-1 }; ->>> t15:={[t,i,j] -> [0,t,0,i+3,0,j+2,2]}; ->>> ->>> s16:= {[t,i,j] : 0 <= j <= N-1 && i=0 && 0 <= t <= N3-1 }; ->>> t16:={[t,i,j] -> [0,t,5,i,0,j,0] }; ->>> ->>> s17:= {[t,i,j] : j =N-1 && 1<= i <=M-2 && 0 <= t <= N3-1 }; ->>> t17:={[t,i,j] -> [0,t,6,i,0,j,0] }; ->>> ->>> s18:= {[t,i,j] : j =0 && 1<= i <=M-2 && 0 <= t <= N3-1}; ->>> t18:={[t,i,j] -> [0,t,7,i,0,j,0] }; ->>> ->>> s19:= {[t,i,j] :1 <= j <= N-2 && 1 <= i <= M-2 && 0 <= t <= N3-1 }; ->>> t19:={[t,i,j] -> [0,t,0,i+2,0,j+1,1]}; ->>> ->>> ->>> ->>> codegen 2 t0:s0,t1:s1,t2:s2,t3:s3,t4:s4,t5:s5,t6:s6,t7:s7,t8:s8,t9:s9,t10:s10,t11:s11,t12:s12,t13:s13,t14:s14,t15:s15,t16:s16,t17:s17,t18:s18,t19:s19; -for(t2 = 0; t2 <= N3-1; t2++) { - if (N >= 1) { - for(t4 = 0; t4 <= min(2,M-1); t4++) { - for(t6 = 0; t6 <= N-1; t6++) { - s0(t2,t4,t6); - } - } - for(t4 = 3; t4 <= min(M-1,4); t4++) { - for(t6 = 0; t6 <= min(1,N-1); t6++) { - s0(t2,t4,t6); - } - for(t6 = 2; t6 <= min(3,N-1); t6++) { - s0(t2,t4,t6); - s19(t2,t4-2,t6-1); - } - for(t6 = 4; t6 <= N-1; t6++) { - s0(t2,t4,t6); - s19(t2,t4-2,t6-1); - } - } - for(t4 = 5; t4 <= M-1; t4++) { - for(t6 = 0; t6 <= min(1,N-1); t6++) { - s0(t2,t4,t6); - } - for(t6 = 2; t6 <= min(N-1,3); t6++) { - s0(t2,t4,t6); - s19(t2,t4-2,t6-1); - } - for(t6 = 4; t6 <= N-1; t6++) { - s0(t2,t4,t6); - s19(t2,t4-2,t6-1); - s15(t2,t4-3,t6-2); - } - } - } - if (M >= 3) { - if (M >= 5) { - for(t6 = 2; t6 <= min(N-1,3); t6++) { - s19(t2,M-2,t6-1); - } - for(t6 = 4; t6 <= N-1; t6++) { - s19(t2,M-2,t6-1); - s15(t2,M-3,t6-2); - } - } - else { - for(t6 = 2; t6 <= N-1; t6++) { - s19(t2,M-2,t6-1); - } - } - } - for(t4 = 0; t4 <= N-1; t4++) { - s1(t2,t4); - } - for(t4 = 0; t4 <= M-1; t4++) { - s2(t2,t4); - } - s3(t2); - for(t6 = 0; t6 <= N-1; t6++) { - s4(t2,M-1,t6); - } - for(t6 = 0; t6 <= N-1; t6++) { - s16(t2,0,t6); - } - for(t4 = 1; t4 <= M-2; t4++) { - s17(t2,t4,N-1); - } - for(t4 = 1; t4 <= M-2; t4++) { - s18(t2,t4,0); - } - for(t4 = 0; t4 <= N-1; t4++) { - s5(t2,t4); - } - for(t4 = 0; t4 <= M-1; t4++) { - s6(t2,t4); - } - s7(t2); - if (N >= 1) { - for(t4 = 0; t4 <= 1; t4++) { - for(t6 = 0; t6 <= N-1; t6++) { - s12(t2,t4,t6); - } - } - for(t4 = M-2; t4 <= M-1; t4++) { - for(t6 = 0; t6 <= N-1; t6++) { - s8(t2,t4,t6); - } - } - } - for(t4 = 2; t4 <= M-3; t4++) { - for(t6 = 0; t6 <= 1; t6++) { - s14(t2,t4,t6); - } - } - for(t4 = 2; t4 <= M-3; t4++) { - for(t6 = N-2; t6 <= N-1; t6++) { - s13(t2,t4,t6); - } - } - for(t4 = 0; t4 <= N-1; t4++) { - s9(t2,t4); - } - for(t4 = 0; t4 <= M-1; t4++) { - s10(t2,t4); - } - s11(t2); -} - ->>> #codegen 2 s0,t1:s1,t2:s2,t3:s3,t4:s4,t5:s5,t6:s6,t7:s7,t8:s8,t9:s9,t10:s10,t11:s11,t12:s12,t13:s13,t14:s14,t15:s15,t16:s16,t17:s17,t18:s18,t19:s19; ->>> ->>> diff --git a/omega/examples/floor_bound b/omega/examples/floor_bound deleted file mode 100644 index 3cb0d57..0000000 --- a/omega/examples/floor_bound +++ /dev/null @@ -1,46 +0,0 @@ -# -# Test floor/ceiling variable definitions in loop bounds -# Notes: -# intFloor, intCeil are strict mathematical definition, -# intMod(a,b) always has input b>0 and returns [0,b). -# - -symbolic m, n; - -# loop is strided -# -is := {[i]: exists (alpha: i = 4alpha && m <= 3i <= n)}; -codegen is; - -# only one single floor/ceiling variable in bound -# -is := {[i]: exists (lb: m-4 < 4*lb <= m && lb <= i <= n)}; -codegen is; - -# the floor/ceiling variable in bound has coefficient -# -is := {[i]: exists (lb: m-4 < 4*lb <= m && 4*lb <= i <= n)}; -codegen is; - -# mutiple floor/ceiling variables in bound -# -is := {[i]:exists (alpha,beta: m-4<4alpha<=m && m-3<3beta<=m && - 4alpha+3*beta<=i<=n )}; -codegen is; - -# non-tight floor/ceiling definition -# -is := {[i]: exists (ub: n-2 < 3*ub <= n && m <= i <= 5*ub)}; -codegen is; - -# chain floor/ceiling definitions -# -is := {[i]: exists (alpha, beta: beta-4<4alpha<=beta && - m-8<8beta<=m && 4alpha<=i<=n )}; -codegen is; - -# one complicated case -# -is := {[i]: exists (alpha, beta: beta-4<4alpha<=beta && - m-7<8beta<=m && 4alpha<=i<=n )}; -codegen is; diff --git a/omega/examples/floor_bound.out b/omega/examples/floor_bound.out deleted file mode 100644 index 2d59f65..0000000 --- a/omega/examples/floor_bound.out +++ /dev/null @@ -1,76 +0,0 @@ ->>> # ->>> # Test floor/ceiling variable definitions in loop bounds ->>> # ->>> ->>> symbolic m, n; ->>> ->>> # loop is strided ->>> # ->>> is := {[i]: exists (alpha: i = 4alpha && m <= 3i <= n)}; ->>> codegen is; -for(t1 = 4*intDiv(intDiv(m+2,3)+3,4); t1 <= intDiv(n,3); t1 += 4) { - s1(t1); -} - ->>> ->>> # only one single floor/ceiling variable in bound ->>> # ->>> is := {[i]: exists (lb: m-4 < 4*lb <= m && lb <= i <= n)}; ->>> codegen is; -for(t1 = intDiv(m-3+3,4); t1 <= n; t1++) { - s1(t1); -} - ->>> ->>> # the floor/ceiling variable in bound has coefficient ->>> # ->>> is := {[i]: exists (lb: m-4 < 4*lb <= m && 4*lb <= i <= n)}; ->>> codegen is; -for(t1 = 4*intDiv(m,4); t1 <= n; t1++) { - s1(t1); -} - ->>> ->>> # mutiple floor/ceiling variables in bound ->>> # ->>> is := {[i]:exists (alpha,beta: m-4<4alpha<=m && m-3<3beta<=m && ->>> 4alpha+3*beta<=i<=n )}; ->>> codegen is; -for(t1 = 3*intDiv(m,3)+4*intDiv(m,4); t1 <= n; t1++) { - s1(t1); -} - ->>> ->>> # non-tight floor/ceiling definition ->>> # ->>> is := {[i]: exists (ub: n-2 < 3*ub <= n && m <= i <= 5*ub)}; ->>> codegen is; -if (n-1 <= 3*intDiv(n,3)) { - for(t1 = m; t1 <= 5*intDiv(n,3); t1++) { - s1(t1); - } -} - ->>> ->>> # chain floor/ceiling definitions ->>> # ->>> is := {[i]: exists (alpha, beta: beta-4<4alpha<=beta && ->>> m-8<8beta<=m && 4alpha<=i<=n )}; ->>> codegen is; -for(t1 = 4*intDiv(m,32); t1 <= n; t1++) { - s1(t1); -} - ->>> ->>> # one complicated case ->>> # ->>> is := {[i]: exists (alpha, beta: beta-4<4alpha<=beta && ->>> m-7<8beta<=m && 4alpha<=i<=n )}; ->>> codegen is; -if (m-6 <= 8*intDiv(m,8)) { - for(t1 = 4*intDiv(m,32); t1 <= n; t1++) { - s1(t1); - } -} - - diff --git a/omega/examples/gist b/omega/examples/gist deleted file mode 100644 index 5919b88..0000000 --- a/omega/examples/gist +++ /dev/null @@ -1,60 +0,0 @@ -# -# Test gist function and code generation for modular equations -# - -symbolic n; - -# basic gist function -# -R:={[t1,t2]: exists (aa : 2aa = t1 && 2 <= t1 && t1 <= 8)}; -known := {[t1,t2]: 1 <= t1 <= 9}; -gist R given known; - - -# test modulo equations by coprime numbers -# -is := { [i,j] : 1 <= i <= n && i <= j <= n && exists (alpha, beta: i= 1+4*alpha && j = i+3*beta) }; -is; -known := { [i,j] : 1 <= i <= n && exists (alpha: i = 1+4*alpha) }; -gist is given known; - -codegen is; - -# test modulo equations by numbers in multiple -# -is := { [i,j] : 1 <= i <= n && i <= j <= n && exists (alpha, beta: i= 1+4*alpha && j = i+8*beta) }; -is; -known := { [i,j] : 1 <= i <= n && exists (alpha: i = 1+4*alpha) }; -gist is given known; - -codegen is; - -is := { [i,j] : 1 <= i <= n && i <= j <= n && exists (alpha, beta: i= 1+256*alpha && j = i+8*beta) }; -is; -known := { [i,j] : 1 <= i <= n && exists (alpha: i = 1+256*alpha) }; -gist is given known; - -codegen is; - -# test modulo equations by gcd != 1 -# -is := { [i,j] : 1 <= i <= n && i <= j <= n && exists (alpha, beta: i= 1+4*alpha && j = i+1+6*beta) }; -is; -known := { [i,j] : 1 <= i <= n && exists (alpha: i = 1+4*alpha) }; -gist is given known; -codegen is; - -is := { [i,j] : 1 <= i <= n && i <= j <= n && exists (alpha, beta: i= 1+6*alpha && j = i+4*beta) }; -is; -known := { [i,j] : 1 <= i <= n && exists (alpha: i = 1+6*alpha) }; -gist is given known; -codegen is; - -# gist won't simpilfy to the result we want, but the code generation -# takes care of it -# -is := { [i,j] : 1 <= i <= n && i <= j <= n && exists (alpha, beta: i= 1+12*alpha && j = i+8*beta) }; -is; -known := { [i,j] : 1 <= i <= n && exists (alpha: i = 1+12*alpha) }; -gist is given known; -codegen is; diff --git a/omega/examples/gist.out b/omega/examples/gist.out deleted file mode 100644 index 44fa8f7..0000000 --- a/omega/examples/gist.out +++ /dev/null @@ -1,110 +0,0 @@ ->>> # ->>> # Test gist function and code generation for modular equations ->>> # ->>> ->>> symbolic n; ->>> ->>> # basic gist function ->>> # ->>> R:={[t1,t2]: exists (aa : 2aa = t1 && 2 <= t1 && t1 <= 8)}; ->>> known := {[t1,t2]: 1 <= t1 <= 9}; ->>> gist R given known; -{[t1,t2]: exists ( alpha : 2alpha = t1)} ->>> ->>> ->>> # test modulo equations by coprime numbers ->>> # ->>> is := { [i,j] : 1 <= i <= n && i <= j <= n && exists (alpha, beta: i= 1+4*alpha && j = i+3*beta) }; ->>> is; -{[i,j]: exists ( alpha : 3+i = 4j+12alpha && 1 <= i <= j <= n)} ->>> known := { [i,j] : 1 <= i <= n && exists (alpha: i = 1+4*alpha) }; ->>> gist is given known; -{[i,j]: exists ( alpha : j = i+3alpha && i <= j <= n)} ->>> ->>> codegen is; -for(t1 = 1; t1 <= n; t1 += 4) { - for(t2 = t1; t2 <= n; t2 += 3) { - s0(t1,t2); - } -} - ->>> ->>> # test modulo equations by numbers in multiple ->>> # ->>> is := { [i,j] : 1 <= i <= n && i <= j <= n && exists (alpha, beta: i= 1+4*alpha && j = i+8*beta) }; ->>> is; -{[i,j]: exists ( alpha,beta : j = i+8alpha && i = 1+4beta && 1 <= i <= j <= n)} ->>> known := { [i,j] : 1 <= i <= n && exists (alpha: i = 1+4*alpha) }; ->>> gist is given known; -{[i,j]: exists ( alpha : j = i+8alpha && i <= j <= n)} ->>> ->>> codegen is; -for(t1 = 1; t1 <= n; t1 += 4) { - for(t2 = t1; t2 <= n; t2 += 8) { - s0(t1,t2); - } -} - ->>> ->>> is := { [i,j] : 1 <= i <= n && i <= j <= n && exists (alpha, beta: i= 1+256*alpha && j = i+8*beta) }; ->>> is; -{[i,j]: exists ( alpha,beta : j = 1+8alpha && i = 1+256beta && 1 <= i <= j <= n)} ->>> known := { [i,j] : 1 <= i <= n && exists (alpha: i = 1+256*alpha) }; ->>> gist is given known; -{[i,j]: exists ( alpha : j = 1+8alpha && i <= j <= n)} ->>> ->>> codegen is; -for(t1 = 1; t1 <= n; t1 += 256) { - for(t2 = t1; t2 <= n; t2 += 8) { - s0(t1,t2); - } -} - ->>> ->>> # test modulo equations by gcd != 1 ->>> # ->>> is := { [i,j] : 1 <= i <= n && i <= j <= n && exists (alpha, beta: i= 1+4*alpha && j = i+1+6*beta) }; ->>> is; -{[i,j]: exists ( alpha,beta : i+2j = 5+12alpha && i = 1+4beta && 1 <= i < j <= n)} ->>> known := { [i,j] : 1 <= i <= n && exists (alpha: i = 1+4*alpha) }; ->>> gist is given known; -{[i,j]: exists ( alpha : i+2j = 5+12alpha && i < j <= n)} ->>> codegen is; -for(t1 = 1; t1 <= n-1; t1 += 4) { - for(t2 = t1+1; t2 <= n; t2 += 6) { - s0(t1,t2); - } -} - ->>> ->>> is := { [i,j] : 1 <= i <= n && i <= j <= n && exists (alpha, beta: i= 1+6*alpha && j = i+4*beta) }; ->>> is; -{[i,j]: exists ( alpha,beta : 3j = 2+i+12alpha && i = 1+6beta && 1 <= i <= j <= n)} ->>> known := { [i,j] : 1 <= i <= n && exists (alpha: i = 1+6*alpha) }; ->>> gist is given known; -{[i,j]: exists ( alpha : i+j = 2+4alpha && i <= j <= n)} ->>> codegen is; -for(t1 = 1; t1 <= n; t1 += 6) { - for(t2 = t1; t2 <= n; t2 += 4) { - s0(t1,t2); - } -} - ->>> ->>> # gist won't simpilfy to the result we want, but the code generation ->>> # takes care of it ->>> # ->>> is := { [i,j] : 1 <= i <= n && i <= j <= n && exists (alpha, beta: i= 1+12*alpha && j = i+8*beta) }; ->>> is; -{[i,j]: exists ( alpha,beta : 3j = 2+i+24alpha && i = 1+12beta && 1 <= i <= j <= n)} ->>> known := { [i,j] : 1 <= i <= n && exists (alpha: i = 1+12*alpha) }; ->>> gist is given known; -{[i,j]: exists ( alpha : 2+i = 3j+8alpha && i <= j <= n)} ->>> codegen is; -for(t1 = 1; t1 <= n; t1 += 12) { - for(t2 = t1; t2 <= n; t2 += 8) { - s0(t1,t2); - } -} - ->>> diff --git a/omega/examples/hpf b/omega/examples/hpf deleted file mode 100644 index 8d6eca8..0000000 --- a/omega/examples/hpf +++ /dev/null @@ -1,49 +0,0 @@ -# Example taken from -# @INPROCEEDINGS{delft, -# author = {Corinne Ancourt and Fabien Coelho and Fran\c{c}ois Irigoin -# and Ronan Keryell}, -# title = {A Linear Algebra Framework for Static HPF Code Distribution}, -# booktitle = {Proceedings of the Fourth International Workshop -# on Compilers for Parallel Computers}, -# year = 1993, -# month = dec, -# pages = {117-132}, -# publisher = {Delft University of Technology} -# } -# -# Generate local code for this HPF code fragment -# !HPF$ template T(0:150,0:150) -# !HPF$ align Y(I,J) with T(3*I,3*J) -A := { [i,j] -> [3i,3j] }; -# !HPF$ processors P(0:3, 0:3) -# !HPF$ distribute -# !HPF$ T(cyclic(4), cyclic(4)) onto P -D := { [t1,t2] -> [p1,p2,c1,c2,o1,o2] : - t1 = 16c1+4p1+o1 - && t2 = 16c2+4p2+o2 - && 0 <= p1,p2 <= 3 - && 0 <= o1,o2 <= 3 }; -# -# do I = 0, 14 -# Y(I,I) = 1.0 -# enddo -# -I := { [i] : 0 <= i <= 14 }; -Y := { [i] -> [i,i] }; -R := D(A(Y(I))); -R; - -symbolic P1,P2; -selectLocal := {[P1,P2,c1,c2,o1,o2] -> [c1,c2,o1,o2]}; -# We want to iteration the chunk and offset values -# of Y touched by this statement. -# the code given in the above paper is: -# do u3 = 0, 2 -# do u4 = 0, 2 -# do u5 = max(max(0,intDiv(2+4*p1+16*u3,3)),intDiv(2+4*p2+16*u4),3), -# min(min(14,intDiv(3+4*p1+16*u3,3)),intDiv(3+4*p2+16*u4,3)) -# u6 = intDiv(3*u5-4*p1-16*u3,3) -# s1[u3,u4,u5,u6] -# -# We generate: -codegen selectLocal(R); diff --git a/omega/examples/hpf.out b/omega/examples/hpf.out deleted file mode 100644 index 3ee21e7..0000000 --- a/omega/examples/hpf.out +++ /dev/null @@ -1,59 +0,0 @@ ->>> # Example taken from ->>> # @INPROCEEDINGS{delft, ->>> # author = {Corinne Ancourt and Fabien Coelho and Fran\c{c}ois Irigoin ->>> # and Ronan Keryell}, ->>> # title = {A Linear Algebra Framework for Static HPF Code Distribution}, ->>> # booktitle = {Proceedings of the Fourth International Workshop ->>> # on Compilers for Parallel Computers}, ->>> # year = 1993, ->>> # month = dec, ->>> # pages = {117-132}, ->>> # publisher = {Delft University of Technology} ->>> # } ->>> # ->>> # Generate local code for this HPF code fragment ->>> # !HPF$ template T(0:150,0:150) ->>> # !HPF$ align Y(I,J) with T(3*I,3*J) ->>> A := { [i,j] -> [3i,3j] }; ->>> # !HPF$ processors P(0:3, 0:3) ->>> # !HPF$ distribute ->>> # !HPF$ T(cyclic(4), cyclic(4)) onto P ->>> D := { [t1,t2] -> [p1,p2,c1,c2,o1,o2] : ->>> t1 = 16c1+4p1+o1 ->>> && t2 = 16c2+4p2+o2 ->>> && 0 <= p1,p2 <= 3 ->>> && 0 <= o1,o2 <= 3 }; ->>> # ->>> # do I = 0, 14 ->>> # Y(I,I) = 1.0 ->>> # enddo ->>> # ->>> I := { [i] : 0 <= i <= 14 }; ->>> Y := { [i] -> [i,i] }; ->>> R := D(A(Y(I))); ->>> R; -{[p1,p1,c1,c1,o1,o1]: exists ( alpha : p1+o1+c1 = 3alpha && 0 <= p1 <= 3, -c1+4 && 0 <= o1 <= 3 && 0 <= c1 <= 2)} ->>> ->>> symbolic P1,P2; ->>> selectLocal := {[P1,P2,c1,c2,o1,o2] -> [c1,c2,o1,o2]}; ->>> # We want to iteration the chunk and offset values ->>> # of Y touched by this statement. ->>> # the code given in the above paper is: ->>> # do u3 = 0, 2 ->>> # do u4 = 0, 2 ->>> # do u5 = max(max(0,intDiv(2+4*p1+16*u3,3)),intDiv(2+4*p2+16*u4),3), ->>> # min(min(14,intDiv(3+4*p1+16*u3,3)),intDiv(3+4*p2+16*u4,3)) ->>> # u6 = intDiv(3*u5-4*p1-16*u3,3) ->>> # s1[u3,u4,u5,u6] ->>> # ->>> # We generate: ->>> codegen selectLocal(R); -if (P1 == P2 && P1 >= 0 && P1 <= 3) { - for(t1 = 0; t1 <= min(-P1+4,2); t1++) { - for(t3 = intMod(-P1-t1,3); t3 <= 3; t3 += 3) { - s0(t1,t1,t3,t3); - } - } -} - ->>> diff --git a/omega/examples/hull b/omega/examples/hull deleted file mode 100644 index dbb4d3c..0000000 --- a/omega/examples/hull +++ /dev/null @@ -1,102 +0,0 @@ -# compare new SimpleHull with legacy hull methods - -symbolic m,n; - -r1 := {[i,j]: i>=0 && j>=0 && i+j<=1}; -r2 := {[i,j]: j>=0 && i<=1 && j<=i}; - -ConvexHull (r1 union r2); -DecoupledConvexHull (r1 union r2); -RectHull (r1 union r2); -SimpleHull (r1 union r2); -QuickHull (r1 union r2); -Hull (r1 union r2); - -r1 := {[i]:i<=n && n>=7}; -r2 := {[i]:i<=n-2 && n>=6}; - -ConvexHull (r1 union r2); -DecoupledConvexHull (r1 union r2); -RectHull (r1 union r2); -SimpleHull (r1 union r2); -QuickHull (r1 union r2); -Hull (r1 union r2); - -r1 := {[i,j]:0<=i,j<=2}; -r2 := {[i,j]:0<=i && 1<=j && i+j<=4}; - -ConvexHull (r1 union r2); -DecoupledConvexHull (r1 union r2); -RectHull (r1 union r2); -SimpleHull (r1 union r2); -QuickHull (r1 union r2); -Hull (r1 union r2); - -r1 := {[i,j]: 1<=i<=n && j=0}; -r2 := {[i,j]: 2<=i<=n+1 && j=1}; - -ConvexHull (r1 union r2); -DecoupledConvexHull (r1 union r2); -RectHull (r1 union r2); -SimpleHull (r1 union r2); -QuickHull (r1 union r2); -Hull (r1 union r2); - -r1 := {[i,j,k]: 1<=i<=n && j=0 && k=17i}; -r2 := {[i,j,k]: 2<=i<=n+5 && j=1 && k=17i+10}; - -ConvexHull (r1 union r2); -DecoupledConvexHull (r1 union r2); -RectHull (r1 union r2); -SimpleHull (r1 union r2); -QuickHull (r1 union r2); -Hull (r1 union r2); - -r1:={[x,y]:y<=x && y>=0 && y<=2-x}; -r2:={[x,y]:y>=0 && x<=2 && 2y<=x}; - -ConvexHull (r1 union r2); -DecoupledConvexHull (r1 union r2); -RectHull (r1 union r2); -SimpleHull (r1 union r2); -QuickHull (r1 union r2); -Hull (r1 union r2); - -r1 := {[i,j]: 0<=i<=1000 && 500<=j<=600}; -r2 := {[i,j]: 500<=i<=600 && 0<=j<=1000}; - -ConvexHull (r1 union r2); -DecoupledConvexHull (r1 union r2); -RectHull (r1 union r2); -SimpleHull (r1 union r2); -QuickHull (r1 union r2); -Hull (r1 union r2); - -r1:= {[t1,t2,t3,t4,t5] : 1+t4 = t3 && 32t1+1 <= t3 <= 499, 32t1+32 && 16t2+1 <= t5 <= 499, 16t2+16 && 0 <= t1 && 0 <= t2}; -r2:= {[t1,t2,t3,t4,t5] : t4 = t3 && 16t2 <= t5 <= 498, 16t2+15 && 32t1+1 <= t3 <= 499, 32t1+32 && 0 <= t1 && 0 <= t2 }; - -ConvexHull (r1 union r2); -DecoupledConvexHull (r1 union r2); -RectHull (r1 union r2); -SimpleHull (r1 union r2); -QuickHull (r1 union r2); -Hull (r1 union r2); - -r1:={[i]:i<=n && n<=100 && i>=m-10}; -r2:={[i]:i<=2n && n<=200 && i>=m}; - -ConvexHull (r1 union r2); -DecoupledConvexHull (r1 union r2); -RectHull (r1 union r2); -SimpleHull (r1 union r2); -QuickHull (r1 union r2); -Hull (r1 union r2); - -r:= {[1,1]} union {[2,2]} union {[3,3]} union {[4,4]}; - -ConvexHull r; -DecoupledConvexHull r; -RectHull r; -SimpleHull r; -QuickHull r; -Hull r; diff --git a/omega/examples/hull.out b/omega/examples/hull.out deleted file mode 100644 index 8d53f57..0000000 --- a/omega/examples/hull.out +++ /dev/null @@ -1,40 +0,0 @@ ->>> # test new hull calculation method RectHull ->>> ->>> symbolic m,n; ->>> ->>> r1 := {[i,j]: i>=0 && j>=0 && i+j<=1}; ->>> r2 := {[i,j]: j>=0 && i<=1 && j<=i}; ->>> ->>> ConvexHull (r1 union r2); -{[i,j]: 0 <= i <= 1 && 0 <= j <= 1} ->>> RectHull (r1 union r2); -{[i,j]: 0 <= i <= 1 && 0 <= j <= 1} ->>> QuickHull (r1 union r2); -{[i,j]: 0 <= j} ->>> Hull (r1 union r2); -{[i,j]: 0 <= i <= 1 && 0 <= j <= 1} ->>> ->>> r1 := {[i]:i<=n && n>=7}; ->>> r2 := {[i]:i<=n-2 && n>=6}; ->>> ->>> ConvexHull (r1 union r2); -{[i]: i <= 3n-14, n && 6 <= n} ->>> RectHull (r1 union r2); -{[i]: i <= n && 6 <= n} ->>> QuickHull (r1 union r2); -{[i]: i <= n && 6 <= n} ->>> Hull (r1 union r2); -{[i]: i <= n, 3n-14 && 6 <= n} ->>> ->>> r1 := {[i,j]:0<=i,j<=2}; ->>> r2 := {[i,j]:0<=i && 1<=j && i+j<=4}; ->>> ->>> ConvexHull (r1 union r2); -{[i,j]: 0 <= i <= j+2, -j+4 && 0 <= j} ->>> RectHull (r1 union r2); -{[i,j]: 0 <= i <= -j+4, 3 && 0 <= j} ->>> QuickHull (r1 union r2); -{[i,j]: 0 <= i && 0 <= j} ->>> Hull (r1 union r2); -{[i,j]: 0 <= i <= -j+4, j+2 && 0 <= j} - diff --git a/omega/examples/if_then b/omega/examples/if_then deleted file mode 100755 index 9f159c7..0000000 --- a/omega/examples/if_then +++ /dev/null @@ -1,19 +0,0 @@ -# test if-then-else generation - -symbolic n,m; -r0:={[i,j]:1<=i,j<=n && m>1 && m1 && m>=n }; -r2:={[i,j]:1<=i,j<=n && m<=1}; -codegen 0 r0,r1,r2; - -r0:={[i]:1<=i<=100 && n> 1}; -r1:={[i,j]:1<=i,j<=100 && n>1}; -r2:={[i,j]:1<=i,j<=100}; -codegen 0 r0,r1,r2; -codegen 1 r0,r1,r2; -codegen 2 r0,r1,r2; - -r0:={[i,j]:1<=i,j<=100 && exists (alpha: i=4alpha)}; -r1:={[i,j]:10<=i,j<=100 && exists (alpha: i=4alpha+2)}; -codegen 0 r0,r1; -codegen 1 r0,r1; diff --git a/omega/examples/interface b/omega/examples/interface deleted file mode 100644 index 48cac6d..0000000 --- a/omega/examples/interface +++ /dev/null @@ -1,15 +0,0 @@ -# These are the examples from the documentation for the -# C++ interface to the Omega Library. -# -symbolic n, m, F(1); - -S1 := { [t] : 1 <= t <= n }; -S2 := { [x] : (0 <= x <= 100 and - exists (y : 2n <= y <= x and exists (z : y = 2*z+1))) - or x = 17 }; - -R := { [i,j] -> [i',j'] : 1 <= i <= i' <= n and not (F(In) = F(Out)) - and 1 <= j, j' <= m }; -S1; -S2; -R; diff --git a/omega/examples/interface.out b/omega/examples/interface.out deleted file mode 100644 index 8b5290f..0000000 --- a/omega/examples/interface.out +++ /dev/null @@ -1,36 +0,0 @@ -# Omega Calculator [v1.1, Oct 96]: -# # -# # These are the examples from the documentation for the -# # C++ interface to the Omega Library. -# # -# -# symbolic n, m, F(1); -# -# -# S1 := { [t] : 1 <= t <= n }; -# -# S2 := { [x] : (0 <= x <= 100 and -# exists (y : 2n <= y <= x and exists (z : y = 2*z+1))) -# or x = 17 }; -# -# R := { [i,j] -> [i',j'] : 1 <= i <= i' <= n and not (F(In) = F(Out)) -# and 1 <= j, j' <= m }; -# -# -# S1; - -{[t]: 1 <= t <= n} - -# -# S2; - -{[x]: 0, 2n+1 <= x <= 100} union - {[x]: x = 17} - -# -# R; - -{[i,j] -> [i',j'] : 1 <= i < i' <= n && 1 <= j <= m && 1 <= j' <= m && F(i) < F(i')} union - {[i,j] -> [i',j'] : 1 <= i < i' <= n && 1 <= j <= m && 1 <= j' <= m && F(i') < F(i)} - -# diff --git a/omega/examples/lu b/omega/examples/lu deleted file mode 100644 index 800d8a0..0000000 --- a/omega/examples/lu +++ /dev/null @@ -1,41 +0,0 @@ -# Perform imperfect loop interchange of LU decomposition -# to get jki form and then block the k and i loops -# -#for k = 1 to n do -# for i = k+1 to n do -# a(i,k) = a(i,k) / a(k,k) -# for j = k+1 to n do -# a(i,j) = a(i,j) - a(k,j)*a(i,k) -# endfor -# endfor -#endfor -# -# - -symbolic n; - -IS10 := {[k,i] : 1 <= k <= n && k+1 <= i <= n}; -IS20 := {[k,i,j] : 1 <= k <= n && k+1 <= i <= n && k+1 <= j <= n}; - -T10 := {[k,i] -> [t1,t2,k,k,i]: -exists (alpha,beta: t1 = 64beta+1 && k-1 = alpha + 64 beta && - alpha >= 0 && alpha <= 63) -&& exists (gamma,delta: t2 = 64delta && i = gamma +64delta && - gamma >= 0 && gamma <= 63)}; - -T20 := {[k,i,j] -> [t1,t2,j,k,i]: -exists (alpha,beta: t1 = 64beta+1 && k-1 = alpha + 64 beta && - alpha >= 0 && alpha <= 63) -&& exists (gamma,delta: t2 = 64delta && i = gamma +64delta && - gamma >= 0 && gamma <= 63)}; - -T10; -T20; - -# Generate code with different ammounts of overhead remove -# The more overhead we remove, the more code duplication may occur -codegen 0 T10:IS10,T20:IS20; -codegen 1 T10:IS10,T20:IS20; -codegen 2 T10:IS10,T20:IS20; -codegen 3 T10:IS10,T20:IS20; - diff --git a/omega/examples/lu.out b/omega/examples/lu.out deleted file mode 100644 index eecaa51..0000000 --- a/omega/examples/lu.out +++ /dev/null @@ -1,117 +0,0 @@ ->>> # Perform imperfect loop interchange of LU decomposition ->>> # to get jki form and then block the k and i loops ->>> # ->>> #for k = 1 to n do ->>> # for i = k+1 to n do ->>> # a(i,k) = a(i,k) / a(k,k) ->>> # for j = k+1 to n do ->>> # a(i,j) = a(i,j) - a(k,j)*a(i,k) ->>> # endfor ->>> # endfor ->>> #endfor ->>> # ->>> # ->>> ->>> symbolic n; ->>> ->>> IS10 := {[k,i] : 1 <= k <= n && k+1 <= i <= n}; ->>> IS20 := {[k,i,j] : 1 <= k <= n && k+1 <= i <= n && k+1 <= j <= n}; ->>> ->>> T10 := {[k,i] -> [t1,t2,k,k,i]: ->>> exists (alpha,beta: t1 = 64beta+1 && k-1 = alpha + 64 beta && ->>> alpha >= 0 && alpha <= 63) ->>> && exists (gamma,delta: t2 = 64delta && i = gamma +64delta && ->>> gamma >= 0 && gamma <= 63)}; ->>> ->>> T20 := {[k,i,j] -> [t1,t2,j,k,i]: ->>> exists (alpha,beta: t1 = 64beta+1 && k-1 = alpha + 64 beta && ->>> alpha >= 0 && alpha <= 63) ->>> && exists (gamma,delta: t2 = 64delta && i = gamma +64delta && ->>> gamma >= 0 && gamma <= 63)}; ->>> ->>> T10; -{[k,i] -> [t1,t2,k,k,i] : exists ( alpha,beta : t1 = 1+64alpha && t2 = 64beta && k-63 <= t1 <= k && i-63 <= t2 <= i)} ->>> T20; -{[k,i,j] -> [t1,t2,j,k,i] : exists ( alpha,beta : t1 = 1+64alpha && t2 = 64beta && k-63 <= t1 <= k && i-63 <= t2 <= i)} ->>> ->>> # Generate code with different ammounts of overhead remove ->>> # The more overhead we remove, the more code duplication may occur ->>> codegen 0 T10:IS10,T20:IS20; -for(t1 = 1; t1 <= n-1; t1 += 64) { - for(t2 = t1-1; t2 <= n; t2 += 64) { - for(t3 = t1; t3 <= n; t3++) { - for(t4 = t1; t4 <= min(t3-1,t2+62,t1+63); t4++) { - for(t5 = max(t2,t4+1); t5 <= min(n,t2+63); t5++) { - s1(t4,t5,t3); - } - } - if (t1 >= t3-63) { - for(t5 = max(t3+1,t2); t5 <= min(n,t2+63); t5++) { - s0(t3,t5); - } - } - } - } -} - ->>> codegen 1 T10:IS10,T20:IS20; -for(t1 = 1; t1 <= n-1; t1 += 64) { - for(t2 = t1-1; t2 <= n; t2 += 64) { - for(t3 = t1; t3 <= n; t3++) { - for(t4 = t1; t4 <= min(t3-1,t2+62,t1+63); t4++) { - for(t5 = max(t2,t4+1); t5 <= min(n,t2+63); t5++) { - s1(t4,t5,t3); - } - } - if (t1 >= t3-63) { - for(t5 = max(t3+1,t2); t5 <= min(n,t2+63); t5++) { - s0(t3,t5); - } - } - } - } -} - ->>> codegen 2 T10:IS10,T20:IS20; -for(t1 = 1; t1 <= n-1; t1 += 64) { - for(t2 = t1-1; t2 <= n; t2 += 64) { - for(t3 = t1; t3 <= n; t3++) { - for(t4 = t1; t4 <= min(t3-1,t2+62,t1+63); t4++) { - for(t5 = max(t2,t4+1); t5 <= min(n,t2+63); t5++) { - s1(t4,t5,t3); - } - } - if (t1 >= t3-63) { - for(t5 = max(t3+1,t2); t5 <= min(n,t2+63); t5++) { - s0(t3,t5); - } - } - } - } -} - ->>> codegen 3 T10:IS10,T20:IS20; -for(t1 = 1; t1 <= n-1; t1 += 64) { - for(t2 = t1-1; t2 <= n; t2 += 64) { - for(t3 = t1; t3 <= min(t1+63,n); t3++) { - for(t4 = t1; t4 <= min(t2+62,t3-1); t4++) { - for(t5 = max(t2,t4+1); t5 <= min(t2+63,n); t5++) { - s1(t4,t5,t3); - } - } - for(t5 = max(t2,t3+1); t5 <= min(n,t2+63); t5++) { - s0(t3,t5); - } - } - for(t3 = t1+64; t3 <= n; t3++) { - for(t4 = t1; t4 <= min(t2+62,t1+63); t4++) { - for(t5 = max(t2,t4+1); t5 <= min(t2+63,n); t5++) { - s1(t4,t5,t3); - } - } - } - } -} - ->>> ->>> diff --git a/omega/examples/old_test/affineClosure b/omega/examples/old_test/affineClosure deleted file mode 100644 index 1039856..0000000 --- a/omega/examples/old_test/affineClosure +++ /dev/null @@ -1,19 +0,0 @@ - -symbolic n; -symbolic c; - -R := {[i,j] : 1 <= i <= 10 && 1 <= j <= n}; -R; -ac := approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : - 0 <= lambda0, lambda1,lambda2,lambda3,lambda4 - && c = lambda0-lambda1+ 10 lambda2 - lambda3 - && i = lambda1-lambda2 - && j = lambda3-lambda4 - && n = lambda4)}; -ac; - -#ac intersection {[i,j] : i = 1 && c = -1} ; -#ac intersection {[i,j] : i = -1 && c = 10} ; -#ac intersection {[i,j] : j = 1 && c = -1 } ; -#ac intersection {[i,j] : j = -1 && n = 1} ; - diff --git a/omega/examples/old_test/affineClosure.oc-rt b/omega/examples/old_test/affineClosure.oc-rt deleted file mode 100644 index fbf8bf9..0000000 --- a/omega/examples/old_test/affineClosure.oc-rt +++ /dev/null @@ -1,32 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# -# symbolic n; -# -# symbolic c; -# -# -# R := {[i,j] : 1 <= i <= 10 && 1 <= j <= n}; -# -# R; - -{[i,j]: 1 <= i <= 10 && 1 <= j <= n} - -# -# ac := approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : -# 0 <= lambda0, lambda1,lambda2,lambda3,lambda4 -# && c = lambda0-lambda1+ 10 lambda2 - lambda3 -# && i = lambda1-lambda2 -# && j = lambda3-lambda4 -# && n = lambda4)}; -# -# ac; - -{[i,j]: 0 <= n && 0 <= n+c+i+j && 0 <= n+c+10i+j && 0 <= n+j} - -# -# -# #ac intersection {[i,j] : i = 1 && c = -1} ; -# #ac intersection {[i,j] : i = -1 && c = 10} ; -# #ac intersection {[i,j] : j = 1 && c = -1 } ; -# #ac intersection {[i,j] : j = -1 && n = 1} ; -# diff --git a/omega/examples/old_test/affineClosure2 b/omega/examples/old_test/affineClosure2 deleted file mode 100644 index 35ae0e1..0000000 --- a/omega/examples/old_test/affineClosure2 +++ /dev/null @@ -1,55 +0,0 @@ -symbolic n; -symbolic c; -# # Omega Calculator [v1.00, Mar 96]: -# # -# # -# # -# # R := {[i,j] : 1 <= i <= 10 && 1 <= j <= n}; -# # -# # R; -# -# {[i,j]: 1 <= i <= 10 && 1 <= j <= n} -# -# # -# # ac := approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : -# # 0 <= lambda0, lambda1,lambda2,lambda3,lambda4 -# # && c = lambda0-lambda1+ 10 lambda2 - lambda3 -# # && i = lambda1-lambda2 -# # && j = lambda3-lambda4 -# # && n = lambda4)}; -# # -# # ac; -# -# {[i,j]: 0 <= n && 0 <= n+c+i+j && 0 <= n+c+10i+j && 0 <= n+j} -# -# # -# # -# # #ac intersection {[i,j] : i = 1 && c = -1} ; -# # #ac intersection {[i,j] : i = -1 && c = 10} ; -# # #ac intersection {[i,j] : j = 1 && c = -1 } ; -# # #ac intersection {[i,j] : j = -1 && n = 1} ; -# # - -approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : - 0 <= lambda0,lambda1,lambda2,lambda3,lambda4 - && n = lambda1+lambda2+lambda3+lambda4 - && i = lambda2+10lambda3 - && j = lambda2+lambda3+lambda4 - && c = lambda0+lambda2+lambda3 - && c = 1 - )}; -approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : - 0 <= lambda1,lambda2,lambda3,lambda4 - && n = lambda1+lambda2+lambda3+lambda4 - && i = lambda2+10lambda3 - && j = lambda2+lambda3+lambda4 - && c = lambda2+lambda3 - && c = 1 - )}; -approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : - 0 <= lambda1,lambda2,lambda3,lambda4 - && n = lambda1+lambda2+lambda3+lambda4 - && i = lambda2+10lambda3 - && j = lambda2+lambda3+lambda4 - && c = lambda2+lambda3 - )}; diff --git a/omega/examples/old_test/affineClosure2.oc-rt b/omega/examples/old_test/affineClosure2.oc-rt deleted file mode 100644 index b4c1fd7..0000000 --- a/omega/examples/old_test/affineClosure2.oc-rt +++ /dev/null @@ -1,70 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic n; -# -# symbolic c; -# -# # # Omega Calculator [v1.00, Mar 96]: -# # # -# # # -# # # -# # # R := {[i,j] : 1 <= i <= 10 && 1 <= j <= n}; -# # # -# # # R; -# # -# # {[i,j]: 1 <= i <= 10 && 1 <= j <= n} -# # -# # # -# # # ac := approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : -# # # 0 <= lambda0, lambda1,lambda2,lambda3,lambda4 -# # # && c = lambda0-lambda1+ 10 lambda2 - lambda3 -# # # && i = lambda1-lambda2 -# # # && j = lambda3-lambda4 -# # # && n = lambda4)}; -# # # -# # # ac; -# # -# # {[i,j]: 0 <= n && 0 <= n+c+i+j && 0 <= n+c+10i+j && 0 <= n+j} -# # -# # # -# # # -# # # #ac intersection {[i,j] : i = 1 && c = -1} ; -# # # #ac intersection {[i,j] : i = -1 && c = 10} ; -# # # #ac intersection {[i,j] : j = 1 && c = -1 } ; -# # # #ac intersection {[i,j] : j = -1 && n = 1} ; -# # # -# -# approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : -# 0 <= lambda0,lambda1,lambda2,lambda3,lambda4 -# && n = lambda1+lambda2+lambda3+lambda4 -# && i = lambda2+10lambda3 -# && j = lambda2+lambda3+lambda4 -# && c = lambda0+lambda2+lambda3 -# && c = 1 -# )}; - -{[i,j]: c = 1 && 0 <= i <= 10j, 10 && j <= n} - -# -# approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : -# 0 <= lambda1,lambda2,lambda3,lambda4 -# && n = lambda1+lambda2+lambda3+lambda4 -# && i = lambda2+10lambda3 -# && j = lambda2+lambda3+lambda4 -# && c = lambda2+lambda3 -# && c = 1 -# )}; - -{[i,j]: c = 1 && 1 <= i <= 10 && 1 <= j <= n} - -# -# approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : -# 0 <= lambda1,lambda2,lambda3,lambda4 -# && n = lambda1+lambda2+lambda3+lambda4 -# && i = lambda2+10lambda3 -# && j = lambda2+lambda3+lambda4 -# && c = lambda2+lambda3 -# )}; - -{[i,j]: c <= i <= 10c && c <= j <= n} - -# diff --git a/omega/examples/old_test/beatrice2 b/omega/examples/old_test/beatrice2 deleted file mode 100644 index 7b425fd..0000000 --- a/omega/examples/old_test/beatrice2 +++ /dev/null @@ -1,51 +0,0 @@ -# do i = 1, np { -# do j = 1, i { -# ij = ia(i) + j -# a = 1. / (i + j) -# do k = 1, i { -# maxl = k -# if (k == i) then -# maxl = j -# endif -# do l = 1, maxl { -# kl = ia(k) + l -# b = 1. / (k + l) -# val = a + b -# if (i == j) then -# val = val * .5 -# endif -# if (k == l) then -# val = val * .5 -# endif -# x(ij,kl) = val -# x(kl,ij) = val -# } -# } -# } -# } -#! -# -# -# As far as I remember it was the dependence test between X(IJ,KL) and X(IJ,KL). -# -# Pips discovered the following precondition: -# - -{[d1,d2,d3,d4] : exists ( NP, - I,J,K,L,IJ,KJ,MAXL, - I',J',K',L',IJ',KJ',MAXL' : - I' = I+d1 && - J' = J+d2 && - K' = K+d3 && - L' = L+d4 - && 1<=L && 1<=J && MAXL<=K && I<=NP && NP<=40 && 10<=NP - && 10+8K+MAXL<=NP+8I+J && 38K+MAXL<=38I+J - && J+K<=I+MAXL && L<=MAXL - && 1 <= J,K <= I <= NP && 1 <=L <= MAXL - - && 1<=L' && 1<=J' && MAXL'<=K' && I'<=NP && NP<=40 && 10<=NP - && 10+8K'+MAXL'<=NP+8I'+J' && 38K'+MAXL'<=38I'+J' - && J'+K'<=I'+MAXL' && L'<=MAXL' - && 1 <= J',K' <= I' <= NP && 1 <=L' <= MAXL' - )}; - diff --git a/omega/examples/old_test/beatrice2.oc-rt b/omega/examples/old_test/beatrice2.oc-rt deleted file mode 100644 index 7952859..0000000 --- a/omega/examples/old_test/beatrice2.oc-rt +++ /dev/null @@ -1,56 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# # do i = 1, np { -# # do j = 1, i { -# # ij = ia(i) + j -# # a = 1. / (i + j) -# # do k = 1, i { -# # maxl = k -# # if (k == i) then -# # maxl = j -# # endif -# # do l = 1, maxl { -# # kl = ia(k) + l -# # b = 1. / (k + l) -# # val = a + b -# # if (i == j) then -# # val = val * .5 -# # endif -# # if (k == l) then -# # val = val * .5 -# # endif -# # x(ij,kl) = val -# # x(kl,ij) = val -# # } -# # } -# # } -# # } -# #! -# # -# # -# # As far as I remember it was the dependence test between X(IJ,KL) and X(IJ,KL). -# # -# # Pips discovered the following precondition: -# # -# -# {[d1,d2,d3,d4] : exists ( NP, -# I,J,K,L,IJ,KJ,MAXL, -# I',J',K',L',IJ',KJ',MAXL' : -# I' = I+d1 && -# J' = J+d2 && -# K' = K+d3 && -# L' = L+d4 -# && 1<=L && 1<=J && MAXL<=K && I<=NP && NP<=40 && 10<=NP -# && 10+8K+MAXL<=NP+8I+J && 38K+MAXL<=38I+J -# && J+K<=I+MAXL && L<=MAXL -# && 1 <= J,K <= I <= NP && 1 <=L <= MAXL -# -# && 1<=L' && 1<=J' && MAXL'<=K' && I'<=NP && NP<=40 && 10<=NP -# && 10+8K'+MAXL'<=NP+8I'+J' && 38K'+MAXL'<=38I'+J' -# && J'+K'<=I'+MAXL' && L'<=MAXL' -# && 1 <= J',K' <= I' <= NP && 1 <=L' <= MAXL' -# )}; - -{[d1,d2,d3,d4]: d2-39, -39, d4-39, d3-39 <= d1 <= d3+39, d2+39, d4+39, 39 && d4-39, -39 <= d3 <= 39, d4+39 && -39 <= d2 <= 39 && 39d4 <= 1521+38d1+d2 && d3 <= 39+d1+d4 && d2 <= 1521+d1+38d3+d4 && 38d1+d2 <= 1521+39d4 && 38d1+d2 <= 1521+38d3+d4 && d2 <= 1521+d1+39d4 && d1+38d3+d4 <= 1521+d2 && d1+d4 <= 39+d3 && 38d3+d4 <= 1521+38d1+d2 && d1+39d4 <= 1521+d2} - -# -# diff --git a/omega/examples/old_test/blume1.w b/omega/examples/old_test/blume1.w deleted file mode 100644 index 14d7329..0000000 --- a/omega/examples/old_test/blume1.w +++ /dev/null @@ -1,6 +0,0 @@ -symbolic n, line5expr(2); - -$$ -\{ [i,j] -> [i',j'] \mid line5expr(In) = line5expr(Out) && 2 <= j <= 1 && 1 <= i <= n && 2 <= j' <= 1 && 1 <= i' <= n \}; -$$ - diff --git a/omega/examples/old_test/blume1.w.oc-rt b/omega/examples/old_test/blume1.w.oc-rt deleted file mode 100644 index 68d6aad..0000000 --- a/omega/examples/old_test/blume1.w.oc-rt +++ /dev/null @@ -1,12 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# Symbolic n, line5expr(2); -# -# -# $$ -# \{ [i,j] -> [i',j'] \mid line5expr(In) = line5expr(Out) && 2 <= j <= 1 && 1 <= i <= n && 2 <= j' <= 1 && 1 <= i' <= n \}; - -{[i,j] -> [i',j'] : FALSE } - -# -# $$ -# diff --git a/omega/examples/old_test/cfft2d1 b/omega/examples/old_test/cfft2d1 deleted file mode 100644 index 8b59f29..0000000 --- a/omega/examples/old_test/cfft2d1 +++ /dev/null @@ -1,21 +0,0 @@ -# -# A (memory-based!) data dependence relation from a greatly simplified -# cfft2d1.t that was causing us trouble. -# - -symbolic line22(1), im_1(2); - -flow := { [iii_w,jj_w] -> [iii_r,jj_r] : - im_1(In) = im_1(Out) - && 1 <= jj_w - && jj_w <= line22(In) - && 1 <= iii_w - && iii_w <= 200 - && 1 <= jj_r - && jj_r <= line22(Out) - && 1 <= iii_r - && iii_r <= 200 }; - -zero_plus := { [i1,j1] -> [i2,j2] : i1 = i2 && j1 < j2 }; - -flow intersection zero_plus; diff --git a/omega/examples/old_test/cfft2d1.oc-rt b/omega/examples/old_test/cfft2d1.oc-rt deleted file mode 100644 index 8f8dd27..0000000 --- a/omega/examples/old_test/cfft2d1.oc-rt +++ /dev/null @@ -1,29 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# # -# # A (memory-based!) data dependence relation from a greatly simplified -# # cfft2d1.t that was causing us trouble. -# # -# -# Symbolic line22(1), im_1(2); -# -# -# flow := { [iii_w,jj_w] -> [iii_r,jj_r] : -# im_1(In) = im_1(Out) -# && 1 <= jj_w -# && jj_w <= line22(In) -# && 1 <= iii_w -# && iii_w <= 200 -# && 1 <= jj_r -# && jj_r <= line22(Out) -# && 1 <= iii_r -# && iii_r <= 200 }; -# -# -# zero_plus := { [i1,j1] -> [i2,j2] : i1 = i2 && j1 < j2 }; -# -# -# flow intersection zero_plus; - -{[In_1,In_2] -> [Out_1,Out_2] : im_1(In_1,In_2) = im_1(Out_1,Out_2) && Out_1 = In_1 && 1 <= In_2 < Out_2 <= line22(In_1) && 1 <= In_1 <= 200} - -# diff --git a/omega/examples/old_test/chosol b/omega/examples/old_test/chosol deleted file mode 100644 index 134172c..0000000 --- a/omega/examples/old_test/chosol +++ /dev/null @@ -1,11 +0,0 @@ -T10:={[i] -> [0,i,0,0]}; -T20:={[i,j] -> [1,j,0,i]}; -T30:={[i] -> [1,i-1,1,0]}; - -symbolic n; -IS10 := {[i]: 2 <= i <= n}; -IS20 := {[i,j]: 2 <= i <= n && 1 <= j <= i-1}; -IS30 := IS10; - -codegen T10:IS10,T20:IS20,T30:IS30; -codegen 2 T10:IS10,T20:IS20,T30:IS30; diff --git a/omega/examples/old_test/chosol.oc-rt b/omega/examples/old_test/chosol.oc-rt deleted file mode 100644 index 8fa3b38..0000000 --- a/omega/examples/old_test/chosol.oc-rt +++ /dev/null @@ -1,32 +0,0 @@ ->>> T10:={[i] -> [0,i,0,0]}; ->>> T20:={[i,j] -> [1,j,0,i]}; ->>> T30:={[i] -> [1,i-1,1,0]}; ->>> ->>> Symbolic n; ->>> IS10 := {[i]: 2 <= i <= n}; ->>> IS20 := {[i,j]: 2 <= i <= n && 1 <= j <= i-1}; ->>> IS30 := IS10; ->>> ->>> codegen T10:IS10,T20:IS20,T30:IS30; -for(t2 = 2; t2 <= n; t2++) { - s1(t2); -} -for(t2 = 1; t2 <= n-1; t2++) { - for(t4 = t2+1; t4 <= n; t4++) { - s2(t4,t2); - } - s3(t2+1); -} - ->>> codegen 2 T10:IS10,T20:IS20,T30:IS30; -for(t2 = 2; t2 <= n; t2++) { - s1(t2); -} -for(t2 = 1; t2 <= n-1; t2++) { - for(t4 = t2+1; t4 <= n; t4++) { - s2(t4,t2); - } - s3(t2+1); -} - - diff --git a/omega/examples/old_test/closure1 b/omega/examples/old_test/closure1 deleted file mode 100644 index 0e4c541..0000000 --- a/omega/examples/old_test/closure1 +++ /dev/null @@ -1,8 +0,0 @@ -({[i] -> [i+2]} union {[i] -> [i+3]})+; -R := ({[i] -> [i'] : i'=i+3} union {[i] -> [i'] : i'=i+5} union {[i] -> [i'] : i'=i+7})+; -R; -notR := {[i] -> [i'] : i' >= i+3} - R; -notR; -{[i] -> [i'] : i' >= i+3} - notR; - - diff --git a/omega/examples/old_test/closure1.oc-rt b/omega/examples/old_test/closure1.oc-rt deleted file mode 100644 index 93ecda0..0000000 --- a/omega/examples/old_test/closure1.oc-rt +++ /dev/null @@ -1,31 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# ({[i] -> [i+2]} union {[i] -> [i+3]})+; - -{[i] -> [Out_1] : Exists ( alpha : 2alpha = i+Out_1 && i <= Out_1-2)} union - {[i] -> [Out_1] : Exists ( alpha : i < Out_1+2alpha && Out_1+3alpha <= i)} - -# -# R := ({[i] -> [i'] : i'=i+3} union {[i] -> [i'] : i'=i+5} union {[i] -> [i'] : i'=i+7})+; -# -# R; - -{[i] -> [i'] : Exists ( alpha : i+3alpha = i' && i <= i'-3)} union - {[i] -> [i'] : Exists ( alpha : i < i'+3alpha && 2i'+7alpha <= 2i)} union - {[i] -> [i'] : Exists ( alpha : i'+3alpha < i && 2i <= 2i'+5alpha)} - -# -# notR := {[i] -> [i'] : i' >= i+3} - R; -# -# notR; - -{[i] -> [i+4] } - -# -# {[i] -> [i'] : i' >= i+3} - notR; - -{[i] -> [i+3] } union - {[i] -> [i'] : i <= i'-5} - -# -# -# diff --git a/omega/examples/old_test/closure2 b/omega/examples/old_test/closure2 deleted file mode 100644 index 1cfcefd..0000000 --- a/omega/examples/old_test/closure2 +++ /dev/null @@ -1,4 +0,0 @@ -R := {[i,j] -> [i+3,j]} union {[i,j] -> [i+2,j-1]} union {[i,j] -> [i+1,j+1]}; -R+; -R+ compose R; -R - (R+ compose R); diff --git a/omega/examples/old_test/closure2.oc-rt b/omega/examples/old_test/closure2.oc-rt deleted file mode 100644 index e10a428..0000000 --- a/omega/examples/old_test/closure2.oc-rt +++ /dev/null @@ -1,22 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# R := {[i,j] -> [i+3,j]} union {[i,j] -> [i+2,j-1]} union {[i,j] -> [i+1,j+1]}; -# -# R+; - -{[i,j] -> [Out_1,j'] : Out_1+2j' = i+2j && j' < j} union - {[i,j] -> [Out_1,j'] : Exists ( alpha : i+j' = j+Out_1+3alpha && 3+i+2j <= Out_1+2j' && i+j' <= j+Out_1)} - -# -# R+ compose R; - -{[i,j] -> [Out_1,j'] : Out_1+2j' = i+2j && j' <= j-2} union - {[i,j] -> [Out_1,j'] : Exists ( alpha : i+j' = j+Out_1+3alpha && 3+i+2j <= Out_1+2j' && 3+i+j' <= j+Out_1)} union - {[i,j] -> [Out_1,j'] : Exists ( alpha : i+j' = j+Out_1+3alpha && 6+i+2j <= Out_1+2j' && i+j' <= j+Out_1)} - -# -# R - (R+ compose R); - -{[i,j] -> [i+2,j-1] } union - {[i,j] -> [i+1,j+1] } - -# diff --git a/omega/examples/old_test/closure3 b/omega/examples/old_test/closure3 deleted file mode 100644 index 4fdc022..0000000 --- a/omega/examples/old_test/closure3 +++ /dev/null @@ -1,10 +0,0 @@ -symbolic n,m; -d11 := {[i,j] -> [i,2i+j] : 1 <= i <= n && 1 <= j,2i+j <= m}; -d12 := {[i,j] -> [i,j+4] : 1 <= i <= n && 1 <= j,j+4 <= m}; -d := d11 union d12; -d+; -d+ compose d; -d11 - (d+ compose d); -gist d11 - (d+ compose d) given d11; -d12 - (d+ compose d); -gist d12 - (d+ compose d) given d12; diff --git a/omega/examples/old_test/closure3.oc-rt b/omega/examples/old_test/closure3.oc-rt deleted file mode 100644 index 4d99b34..0000000 --- a/omega/examples/old_test/closure3.oc-rt +++ /dev/null @@ -1,48 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic n,m; -# -# d11 := {[i,j] -> [i,2i+j] : 1 <= i <= n && 1 <= j,2i+j <= m}; -# -# d12 := {[i,j] -> [i,j+4] : 1 <= i <= n && 1 <= j,j+4 <= m}; -# -# d := d11 union d12; -# -# d+; - -{[1,j] -> [1,j+2] : j+2 <= m <= 4 && 1 <= n && 1 <= j} union - {[i,j] -> [i,Out_2] : Exists ( alpha : Out_2 = j+4alpha && Out_2+4 <= m <= 2i && 1 <= j <= Out_2-4 && i <= n)} union - {[i,j] -> [i,Out_2] : Exists ( alpha : Out_2 = 2i+j+4alpha && 1 <= i <= n && Out_2 <= m && 1 <= j && 5 <= m && 2i+j <= Out_2)} union - {[i,j] -> [i,Out_2] : Exists ( alpha,beta : Out_2 = j+4alpha && 1 <= i <= n && Out_2 <= m && 2i+4beta < Out_2 && 1 <= j && Out_2 <= m+2i+4beta && 4i+j <= Out_2)} union - {[i,j] -> [i,Out_2] : Exists ( alpha : Out_2 = j+4alpha && 1 <= i <= n && 1 <= j <= Out_2-4 && Out_2 <= m && 2i < m)} - -# -# d+ compose d; - -{[i,j] -> [i,Out_2] : Exists ( alpha : Out_2 = j+4alpha && Out_2+4 <= m <= 2i && 1 <= j <= Out_2-8 && i <= n)} union - {[i,j] -> [i,Out_2] : Exists ( alpha : Out_2 = j+4alpha && 1 <= i <= n && Out_2 <= m && 1 <= j && 4i+j <= Out_2)} union - {[i,j] -> [i,Out_2] : Exists ( alpha : Out_2 = 2i+j+4alpha && 1 <= i <= n && Out_2 <= m && 4+2i+j <= Out_2 && 1 <= j)} union - {[i,j] -> [i,Out_2] : Exists ( alpha : Out_2 = j+4alpha && 1 <= i <= n && 1 <= j <= Out_2-8 && Out_2 <= m && 2i < m)} - -# -# d11 - (d+ compose d); - -{[i,j] -> [i,2i+j] : 1 <= i <= 3, n && 1 <= j && 2i+j <= m} union - {[i,j] -> [i,2i+j] : Exists ( alpha : 2alpha = 1+i && 5 <= i <= n && 2i+j <= m && 1 <= j)} - -# -# gist d11 - (d+ compose d) given d11; - -{[i,j] -> [i',Out_2] : i' <= 3} union - {[i,j] -> [i',Out_2] : Exists ( alpha : 0 = 1+i'+2alpha && 5 <= i)} - -# -# d12 - (d+ compose d); - -{[i,j] -> [i,j+4] : 2 <= i <= n && 1 <= j <= m-4} - -# -# gist d12 - (d+ compose d) given d12; - -{[i,j] -> [i',Out_2] : 2 <= i'} - -# diff --git a/omega/examples/old_test/closure4 b/omega/examples/old_test/closure4 deleted file mode 100644 index e5adb13..0000000 --- a/omega/examples/old_test/closure4 +++ /dev/null @@ -1,8 +0,0 @@ -symbolic n,m; -R1 := {[x,y] -> [x,y+1] : 1 <= x,y <= 10}; -R2 := {[x,y] -> [x+1,y] : 1 <= x <= 20 && 5 <= y <= 15}; -R12 := R1 union R2; -R12c := R12+; -R12c; -(R12c compose R12c) - R12c; -(R12c compose R12) - R12c; diff --git a/omega/examples/old_test/closure4.oc-rt b/omega/examples/old_test/closure4.oc-rt deleted file mode 100644 index d208cce..0000000 --- a/omega/examples/old_test/closure4.oc-rt +++ /dev/null @@ -1,28 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic n,m; -# -# R1 := {[x,y] -> [x,y+1] : 1 <= x,y <= 10}; -# -# R2 := {[x,y] -> [x+1,y] : 1 <= x <= 20 && 5 <= y <= 15}; -# -# R12 := R1 union R2; -# -# R12c := R12+; -# -# R12c; - -{[x,y] -> [x,y'] : 1 <= y < y' <= 11 && 1 <= x <= 10} union - {[x,y] -> [x',y] : 1 <= x < x' <= 21 && 5 <= y <= 15} union - {[x,y] -> [x',y'] : 1 <= x < x' <= 21 && 1 <= y < y' <= 11 && x <= 10 && 5 <= y'} - -# -# (R12c compose R12c) - R12c; - -{[x,y] -> [x',y'] : FALSE } - -# -# (R12c compose R12) - R12c; - -{[x,y] -> [x',y'] : FALSE } - -# diff --git a/omega/examples/old_test/closure5 b/omega/examples/old_test/closure5 deleted file mode 100644 index 2792806..0000000 --- a/omega/examples/old_test/closure5 +++ /dev/null @@ -1,6 +0,0 @@ -symbolic n,m; -d11 := {[i,j] -> [i,2i+j] : 1 <= i <= n && 1 <= j,2i+j <= m}; -d12 := {[i,j] -> [i,j+4] : 1 <= i <= n && 1 <= j,j+4 <= m}; -d := d11 union d12; -e := d - (d+ compose d); -gist e given d; diff --git a/omega/examples/old_test/closure5.oc-rt b/omega/examples/old_test/closure5.oc-rt deleted file mode 100644 index 62ade41..0000000 --- a/omega/examples/old_test/closure5.oc-rt +++ /dev/null @@ -1,18 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic n,m; -# -# d11 := {[i,j] -> [i,2i+j] : 1 <= i <= n && 1 <= j,2i+j <= m}; -# -# d12 := {[i,j] -> [i,j+4] : 1 <= i <= n && 1 <= j,j+4 <= m}; -# -# d := d11 union d12; -# -# e := d - (d+ compose d); -# -# gist e given d; - -{[i,j] -> [i,2i+j] : 1 <= i <= 3, n && 1 <= j && 2i+j <= m} union - {[i,j] -> [i,2i+j] : Exists ( alpha : 2alpha = 1+i && 5 <= i <= n && 2i+j <= m && 1 <= j)} union - {[i,j] -> [i,j+4] : 2 <= i <= n && 1 <= j <= m-4} - -# diff --git a/omega/examples/old_test/closure6 b/omega/examples/old_test/closure6 deleted file mode 100644 index 777fbba..0000000 --- a/omega/examples/old_test/closure6 +++ /dev/null @@ -1,13 +0,0 @@ - -T1 := {[k,i,j] -> [k',i,j] : 1 <= k < k' < j <= i <= 1024}; - -T2 := {[k,i,i] -> [i,i',j'] : 1 <= k < i < j' <= i' <= 1024}; - -T3 := {[k,i,j] -> [j,i',i] : 1 <= k < j < i <= i' <= 1024}; - -T := T1 union T2 union T3; - -B := {[k,i,j]: 1 <= k < j <= i <= 1024}; - -T + within B; - diff --git a/omega/examples/old_test/closure6.oc-rt b/omega/examples/old_test/closure6.oc-rt deleted file mode 100644 index 0eefdaa..0000000 --- a/omega/examples/old_test/closure6.oc-rt +++ /dev/null @@ -1,29 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# -# T1 := {[k,i,j] -> [k',i,j] : 1 <= k < k' < j <= i <= 1024}; -# -# -# T2 := {[k,i,i] -> [i,i',j'] : 1 <= k < i < j' <= i' <= 1024}; -# -# -# T3 := {[k,i,j] -> [j,i',i] : 1 <= k < j < i <= i' <= 1024}; -# -# -# T := T1 union T2 union T3; -# -# -# B := {[k,i,j]: 1 <= k < j <= i <= 1024}; -# -# -# T + within B; - -{[k,i,j] -> [j',i,j] : 1 <= k < j' < j <= i <= 1024} union - {[k,i,j] -> [j',i',Out_3] : 1 <= k < j < i < j' < Out_3 <= i' <= 1024} union - {[k,i,i] -> [j',i',Out_3] : 1 <= k < i < j' < Out_3 <= i' <= 1024} union - {[k,i,i] -> [i,i',Out_3] : 1 <= k < i < Out_3 <= i' <= 1024} union - {[k,i,j] -> [j,i',i] : 1 <= k < j < i <= i' <= 1024} union - {[k,i,j] -> [j',i',i] : 1 <= k < j < j' < i <= i' <= 1024} union - {[k,i,j] -> [i,i',Out_3] : 1 <= k < j < i < Out_3 <= i' <= 1024} - -# -# diff --git a/omega/examples/old_test/closure7 b/omega/examples/old_test/closure7 deleted file mode 100644 index 6ba2e1d..0000000 --- a/omega/examples/old_test/closure7 +++ /dev/null @@ -1,12 +0,0 @@ - -R := {[t,s] -> [t+1,s] } union - {[t,s] -> [t,s] } union - {[t,s] -> [t,s+1] }; - -R; -R+; - -S := {[t,s] -> [t+1,s] } union {[t,s] -> [t,s+1] }; - -S; -S+; diff --git a/omega/examples/old_test/closure7.oc-rt b/omega/examples/old_test/closure7.oc-rt deleted file mode 100644 index 0de9745..0000000 --- a/omega/examples/old_test/closure7.oc-rt +++ /dev/null @@ -1,36 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# -# R := {[t,s] -> [t+1,s] } union -# {[t,s] -> [t,s] } union -# {[t,s] -> [t,s+1] }; -# -# -# R; - -{[t,s] -> [t+1,s] } union - {[t,s] -> [t,s] } union - {[t,s] -> [t,s+1] } - -# -# R+; - -{[t,s] -> [t,s'] : s <= s'} union - {[t,s] -> [t',s'] : t < t' && s <= s'} - -# -# -# S := {[t,s] -> [t+1,s] } union {[t,s] -> [t,s+1] }; -# -# -# S; - -{[t,s] -> [t+1,s] } union - {[t,s] -> [t,s+1] } - -# -# S+; - -{[t,s] -> [t,s'] : s < s'} union - {[t,s] -> [t',s'] : t < t' && s <= s'} - -# diff --git a/omega/examples/old_test/closure8 b/omega/examples/old_test/closure8 deleted file mode 100644 index b1f9b9b..0000000 --- a/omega/examples/old_test/closure8 +++ /dev/null @@ -1 +0,0 @@ -{[i] -> [i]}+; diff --git a/omega/examples/old_test/closure8.oc-rt b/omega/examples/old_test/closure8.oc-rt deleted file mode 100644 index 90d5282..0000000 --- a/omega/examples/old_test/closure8.oc-rt +++ /dev/null @@ -1,6 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# {[i] -> [i]}+; - -{[i] -> [i] } - -# diff --git a/omega/examples/old_test/collard b/omega/examples/old_test/collard deleted file mode 100644 index 0fb4ee4..0000000 --- a/omega/examples/old_test/collard +++ /dev/null @@ -1,16 +0,0 @@ -symbolic n; - -I1 := {[i,j] : 1 <= i < j <= n}; -I2 := {[i,j,K] : 1 <= i < j,K <= n}; -I3 := {[i] : 1 <= i <= n}; -I4 := {[i,j] : 1 <= j < i <= n}; -I5 := {[i] : 1 <= i <= n}; - -T1 := {[i,j] -> [1,i,0,n-i,n-j]}; -T2 := {[i,j,k] -> [1,i,1,n-j,k]}; -T3 := {[i] -> [0,0,0,0,i]}; -T4 := {[i,j] -> [2,j,1,i,j]}; -T5 := {[i] -> [2,i,0,0,0]}; - - -codegen T1:I1,T2:I2,T3:I3,T4:I4,T5:I5; diff --git a/omega/examples/old_test/collard.oc-rt b/omega/examples/old_test/collard.oc-rt deleted file mode 100644 index 9d2c8c0..0000000 --- a/omega/examples/old_test/collard.oc-rt +++ /dev/null @@ -1,49 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic n; -# -# -# I1 := {[i,j] : 1 <= i < j <= n}; -# -# I2 := {[i,j,K] : 1 <= i < j,K <= n}; -# -# I3 := {[i] : 1 <= i <= n}; -# -# I4 := {[i,j] : 1 <= j < i <= n}; -# -# I5 := {[i] : 1 <= i <= n}; -# -# -# T1 := {[i,j] -> [1,i,0,n-i,n-j]}; -# -# T2 := {[i,j,k] -> [1,i,1,n-j,k]}; -# -# T3 := {[i] -> [0,0,0,0,i]}; -# -# T4 := {[i,j] -> [2,j,1,i,j]}; -# -# T5 := {[i] -> [2,i,0,0,0]}; -# -# -# -# codegen T1:I1,T2:I2,T3:I3,T4:I4,T5:I5; -for(t5 = 1; t5 <= n; t5++) { - s3(t5); -} -for(t2 = 1; t2 <= n-1; t2++) { - for(t5 = 0; t5 <= n-t2-1; t5++) { - s1(t2,n-t5); - } - for(t4 = 0; t4 <= n-t2-1; t4++) { - for(t5 = t2+1; t5 <= n; t5++) { - s2(t2,n-t4,t5); - } - } -} -for(t2 = 1; t2 <= n; t2++) { - s5(t2); - for(t4 = t2+1; t4 <= n; t4++) { - s4(t4,t2); - } -} - -# diff --git a/omega/examples/old_test/cover b/omega/examples/old_test/cover deleted file mode 100644 index 2cfdacf..0000000 --- a/omega/examples/old_test/cover +++ /dev/null @@ -1,6 +0,0 @@ -symbolic p(2), n, m; -R := { [ir,jr] : 1 <= ir <= n && 1 <= jr <= m }; -W1 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(Set) >= 0 }; -W2 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(Set) < 0 }; -Exposed := R intersection complement ( W1 union W2 ); -Exposed; diff --git a/omega/examples/old_test/cover.oc-rt b/omega/examples/old_test/cover.oc-rt deleted file mode 100644 index 1d25c6e..0000000 --- a/omega/examples/old_test/cover.oc-rt +++ /dev/null @@ -1,16 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic p(2), n, m; -# -# R := { [ir,jr] : 1 <= ir <= n && 1 <= jr <= m }; -# -# W1 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(Set) >= 0 }; -# -# W2 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(Set) < 0 }; -# -# Exposed := R intersection complement ( W1 union W2 ); -# -# Exposed; - -{[In_1,In_2] : FALSE } - -# diff --git a/omega/examples/old_test/dagstuhl1 b/omega/examples/old_test/dagstuhl1 deleted file mode 100644 index 56f1a4e..0000000 --- a/omega/examples/old_test/dagstuhl1 +++ /dev/null @@ -1,7 +0,0 @@ -T := {[i,j] -> [i+10j]}; -I := {[0:9,0:9]}; -# Version 1.0.0 incorrectly generates references to i and j -codegen T:I; - -# Version 1.0.0 doesn't generate an assignment for t2 -codegen {[p,i,j] : 0 <= i,j <= 9 && p = i+10j}; diff --git a/omega/examples/old_test/dagstuhl1.oc-rt b/omega/examples/old_test/dagstuhl1.oc-rt deleted file mode 100644 index 7c3f019..0000000 --- a/omega/examples/old_test/dagstuhl1.oc-rt +++ /dev/null @@ -1,23 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# T := {[i,j] -> [i+10j]}; -# -# I := {[0:9,0:9]}; -# -# # Version 1.0.0 incorrectly generates references to i and j -# codegen T:I; -for(t1 = 0; t1 <= 99; t1++) { - s1(intDiv(t1+-10*j,1),intDiv(t1-i,10)); -} - -# -# -# # Version 1.0.0 doesn't generate an assignment for t2 -# codegen {[p,i,j] : 0 <= i,j <= 9 && p = i+10j}; -for(t1 = 0; t1 <= 99; t1++) { - for(t2 = intMod(t1,10); t2 <= 9; t2 += 10) { - t3=intDiv((-t2+t1+9),10); - s1(t2+10*t3,t2,t3); - } -} - -# diff --git a/omega/examples/old_test/dagstuhl2 b/omega/examples/old_test/dagstuhl2 deleted file mode 100644 index 4cc3758..0000000 --- a/omega/examples/old_test/dagstuhl2 +++ /dev/null @@ -1,6 +0,0 @@ -{[i,j] : - 2i+6j>=9 - && 5i-3j >= 0 - && 2i-10j >= -15 - && -2i+6j >= 3 - && -2i-6j >= -17}; diff --git a/omega/examples/old_test/dagstuhl2.oc-rt b/omega/examples/old_test/dagstuhl2.oc-rt deleted file mode 100644 index 2cf1f8c..0000000 --- a/omega/examples/old_test/dagstuhl2.oc-rt +++ /dev/null @@ -1,11 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# {[i,j] : -# 2i+6j>=9 -# && 5i-3j >= 0 -# && 2i-10j >= -15 -# && -2i+6j >= 3 -# && -2i-6j >= -17}; - -{[i,j] : FALSE } - -# diff --git a/omega/examples/old_test/dagstuhl3 b/omega/examples/old_test/dagstuhl3 deleted file mode 100644 index c63fdf8..0000000 --- a/omega/examples/old_test/dagstuhl3 +++ /dev/null @@ -1,4 +0,0 @@ -# In verify, we now prefer to eliminate wildcards last -# This gives us an improved chance of finding equality -# constraints on wildcards. -{[i,j] : 0 <= i,j <= 4 && exists(a:i=j+5a)}; diff --git a/omega/examples/old_test/dagstuhl3.oc-rt b/omega/examples/old_test/dagstuhl3.oc-rt deleted file mode 100644 index 6dbb128..0000000 --- a/omega/examples/old_test/dagstuhl3.oc-rt +++ /dev/null @@ -1,9 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# # In verify, we now prefer to eliminate wildcards last -# # This gives us an improved chance of finding equality -# # constraints on wildcards. -# {[i,j] : 0 <= i,j <= 4 && exists(a:i=j+5a)}; - -{[i,i]: 0 <= i <= 4} - -# diff --git a/omega/examples/old_test/davew1 b/omega/examples/old_test/davew1 deleted file mode 100644 index 2d8d907..0000000 --- a/omega/examples/old_test/davew1 +++ /dev/null @@ -1,25 +0,0 @@ -# -# A one point, we couldn't handling this analysis of value-based dependences. -# Now we can :-) -# - -Pos := {[In_1,In_2] -> [i,j] : 1 <= i,j <= 100 && - In_1 = 1+2j+i && 2i+In_2 = 1 }; - -ko := {[In_1,In_2] -> [i,j] : 1+In_1+2j = 4i && In_2+i+2j = 0 && - 1 <= i <= 100 && 1 <= j <= 100}; - -kf := {[i,j] -> [i',j'] : 1 <= i,i',j,j' <= 100 && i < i' && - 4i = 2+2j+2j'+i' && 2i' = 1+2j+i }; - -k := ko join kf; - -k intersection Pos; -example (k intersection Pos); -Pos; -Pos - (ko join kf); -Pos - k; -answer := Pos - k; -answer; -answer intersection {[7,-7] -> [4,1]}; -gist answer given Pos; diff --git a/omega/examples/old_test/davew1.oc-rt b/omega/examples/old_test/davew1.oc-rt deleted file mode 100644 index bc9844c..0000000 --- a/omega/examples/old_test/davew1.oc-rt +++ /dev/null @@ -1,67 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# # -# # A one point, we couldn't handling this analysis of value-based dependences. -# # Now we can :-) -# # -# -# Pos := {[In_1,In_2] -> [i,j] : 1 <= i,j <= 100 && -# In_1 = 1+2j+i && 2i+In_2 = 1 }; -# -# -# ko := {[In_1,In_2] -> [i,j] : 1+In_1+2j = 4i && In_2+i+2j = 0 && -# 1 <= i <= 100 && 1 <= j <= 100}; -# -# -# kf := {[i,j] -> [i',j'] : 1 <= i,i',j,j' <= 100 && i < i' && -# 4i = 2+2j+2j'+i' && 2i' = 1+2j+i }; -# -# -# k := ko join kf; -# -# -# k intersection Pos; - -{[In_1,In_2] -> [i,j] : Exists ( alpha : In_2+2i = 1 && 2In_1+In_2 = 3+4j && In_2 = 5+8j+20alpha && -199 <= In_2 <= -2j-5 && 1 <= j)} - -# -# example (k intersection Pos); - -{[7,-7] -> [4,1] } - -# -# Pos; - -{[In_1,In_2] -> [i,j] : In_1 = 1+i+2j && In_2+2i = 1 && 1 <= i <= 100 && 1 <= j <= 100} - -# -# Pos - (ko join kf); - -{[In_1,In_2] -> [i,j] : In_1 = 1+i+2j && In_2+2i = 1 && 1 <= i <= j+2, 100 && 1 <= j <= 100} union - {[In_1,In_2] -> [i,j] : Exists ( alpha : In_1 = 1+i+2j && In_2+2i = 1 && j+3 <= i <= 100 && 5+10alpha <= 3i+2j && 3i+2j <= 13+10alpha && 1 <= j)} - -# -# Pos - k; - -{[In_1,In_2] -> [i,j] : 1+i+2j = In_1 && 2In_1+In_2 = 3+4j && 2j+2 <= In_1 <= 3j+3, 2j+101 && 1 <= j <= 100} union - {[In_1,In_2] -> [i,j] : Exists ( alpha : 1+i+2j = In_1 && 2In_1+In_2 = 3+4j && 3j+4 <= In_1 <= 2j+101 && 8+4j+10alpha <= 3In_1 && 3In_1 <= 16+4j+10alpha && 1 <= j)} - -# -# answer := Pos - k; -# -# answer; - -{[In_1,In_2] -> [i,j] : 1+i+2j = In_1 && 2In_1+In_2 = 3+4j && 2j+2 <= In_1 <= 3j+3, 2j+101 && 1 <= j <= 100} union - {[In_1,In_2] -> [i,j] : Exists ( alpha : 1+i+2j = In_1 && 2In_1+In_2 = 3+4j && 3j+4 <= In_1 <= 2j+101 && 8+4j+10alpha <= 3In_1 && 3In_1 <= 16+4j+10alpha && 1 <= j)} - -# -# answer intersection {[7,-7] -> [4,1]}; - -{[In_1,In_2] -> [i,j] : FALSE } - -# -# gist answer given Pos; - -{[In_1,In_2] -> [i,j] : i <= j+2} union - {[In_1,In_2] -> [i,j] : Exists ( alpha : j <= i-3 && 3i+2j <= 13+10alpha && 5+10alpha <= 3i+2j)} - -# diff --git a/omega/examples/old_test/ddtest b/omega/examples/old_test/ddtest deleted file mode 100644 index 27b1ff3..0000000 --- a/omega/examples/old_test/ddtest +++ /dev/null @@ -1,97 +0,0 @@ -symbolic p(2), n, m1, m2, low; - -R := { [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 }; - -f1i := { [iw,jw] -> [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 && - 1 <= iw <= n && 1 <= jw <= m2 && - jw = jr && - iw = ir }; -f1f := { [iw,jw] -> [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 && - 1 <= iw <= n && 1 <= jw <= m2 && - jw = jr && - iw < ir }; - -f3i := { [iw,jw] -> [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 && - 1 <= iw <= n && 1 < low <= jw <= m1 && - jw-1 = jr && - iw = ir }; -f3f := { [iw,jw] -> [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 && - 1 <= iw <= n && 1 < low <= jw <= m1 && - jw-1 = jr && - iw < ir }; - -o31i := { [iw3,jw3] -> [iw1,jw1] : 1 <= iw1 <= n && 1 <= jw1 <= m2 && - 1 <= iw3 <= n && 1 < low <= jw3 <= m1 && - jw1 = jw3-1 && - iw1 = iw3 }; - -o13f := { [iw1,jw1] -> [iw3,jw3] : 1 <= iw1 <= n && 1 <= jw1 <= m2 && - 1 <= iw3 <= n && 1 < low <= jw3 <= m1 && - jw1 = jw3-1 && - iw1 < iw3 }; - -o31f := { [iw3,jw3] -> [iw1,jw1] : 1 <= iw1 <= n && 1 <= jw1 <= m2 && - 1 <= iw3 <= n && 1 < low <= jw3 <= m1 && - jw1 = jw3-1 && - iw3 < iw1 }; - -o11f := { [iw1a,jw1a] -> [iw1b,jw1b] : 1 <=iw1a<= n && 1 <=jw1a<= m2 && - 1 <=iw1b<= n && 1 <=jw1b<= m2 && - jw1a = jw1b && - iw1a < iw1b }; -o33f := { [iw3a,jw3a] -> [iw3b,jw3b] : 1 <=iw3a<= n && 1 < low <=jw3a<= m1 && - 1 <=iw3b<= n && 1 < low <=jw3b<= m1 && - jw3a-1 = jw3b-1 && - iw3a < iw3b }; - - -# FIRST GROUP - 1i and 2i (NO POSSIBLE OUTPUT DEPS. BETWEEN) -v1i := f1i; -v1i; - -Exposed12i := R intersection complement domain f1i; -Exposed12i; - -# SECOND GROUP - 3i -v3i := f3i / Exposed12i; # / is restrictRange -v3i; - -Exposed3i := R intersection complement domain f3i; -Exposed3i; - -# THIRD GROUP - 1,2,3f (THERE ARE POSSIBLE OUTPUT DEPS BETWEEN THEM) - -v1f := ( f1f / Exposed3i ) - intersection complement ( f3i compose o13f ) - intersection complement ( f3f compose o13f ) - intersection complement ( f1i compose o11f ) - intersection complement ( f1f compose o11f ); -v1f; - -# WE SHOULD BE ABLE TO DO v1f WITH SOME VALUE-BASED FLOW DD'S - -v1f_val := ( f1f / Exposed3i ) - intersection complement ( v3i compose o13f ) - intersection complement ( f3f compose o13f ) - intersection complement ( v1i compose o11f ) - intersection complement ( f1f compose o11f ); -v1f_val; - -# -# The effects of loop-independent flow have been taken out already, -# so this should work. But it does not. Probably I am stupyd. -# - -v1f_clever := ( f1f / Exposed3i ) - intersection complement ( f3f compose o13f ) - intersection complement ( f1f compose o11f ); -v1f_clever; - -# -# NOW CHECK FOR EQUIVALENCES - THESE SHOULD BE TRUE -# - -v1f subset v1f_val; -v1f_val subset v1f; -# v1f subset v1f_clever; -# v1f_clever subset v1f; diff --git a/omega/examples/old_test/ddtest.oc-rt b/omega/examples/old_test/ddtest.oc-rt deleted file mode 100644 index 1c3e009..0000000 --- a/omega/examples/old_test/ddtest.oc-rt +++ /dev/null @@ -1,152 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic p(2), n, m1, m2, low; -# -# -# R := { [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 }; -# -# -# f1i := { [iw,jw] -> [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 && -# 1 <= iw <= n && 1 <= jw <= m2 && -# jw = jr && -# iw = ir }; -# -# f1f := { [iw,jw] -> [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 && -# 1 <= iw <= n && 1 <= jw <= m2 && -# jw = jr && -# iw < ir }; -# -# -# f3i := { [iw,jw] -> [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 && -# 1 <= iw <= n && 1 < low <= jw <= m1 && -# jw-1 = jr && -# iw = ir }; -# -# f3f := { [iw,jw] -> [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 && -# 1 <= iw <= n && 1 < low <= jw <= m1 && -# jw-1 = jr && -# iw < ir }; -# -# -# o31i := { [iw3,jw3] -> [iw1,jw1] : 1 <= iw1 <= n && 1 <= jw1 <= m2 && -# 1 <= iw3 <= n && 1 < low <= jw3 <= m1 && -# jw1 = jw3-1 && -# iw1 = iw3 }; -# -# -# o13f := { [iw1,jw1] -> [iw3,jw3] : 1 <= iw1 <= n && 1 <= jw1 <= m2 && -# 1 <= iw3 <= n && 1 < low <= jw3 <= m1 && -# jw1 = jw3-1 && -# iw1 < iw3 }; -# -# -# o31f := { [iw3,jw3] -> [iw1,jw1] : 1 <= iw1 <= n && 1 <= jw1 <= m2 && -# 1 <= iw3 <= n && 1 < low <= jw3 <= m1 && -# jw1 = jw3-1 && -# iw3 < iw1 }; -# -# -# o11f := { [iw1a,jw1a] -> [iw1b,jw1b] : 1 <=iw1a<= n && 1 <=jw1a<= m2 && -# 1 <=iw1b<= n && 1 <=jw1b<= m2 && -# jw1a = jw1b && -# iw1a < iw1b }; -# -# o33f := { [iw3a,jw3a] -> [iw3b,jw3b] : 1 <=iw3a<= n && 1 < low <=jw3a<= m1 && -# 1 <=iw3b<= n && 1 < low <=jw3b<= m1 && -# jw3a-1 = jw3b-1 && -# iw3a < iw3b }; -# -# -# -# # FIRST GROUP - 1i and 2i (NO POSSIBLE OUTPUT DEPS. BETWEEN) -# v1i := f1i; -# -# v1i; - -{[iw,jw] -> [iw,jw] : 1 <= jw <= m1, m2 && 1 <= iw <= n} - -# -# -# Exposed12i := R intersection complement domain f1i; -# -# Exposed12i; - -{[In_1,In_2]: 1, m2+1 <= In_2 <= m1 && 1 <= In_1 <= n} - -# -# -# # SECOND GROUP - 3i -# v3i := f3i / Exposed12i; -# # / is restrictRange -# v3i; - -{[iw,jw] -> [iw,jw-1] : 2 <= low <= jw <= m1 && 1 <= iw <= n && m2 <= jw-2} - -# -# -# Exposed3i := R intersection complement domain f3i; -# -# Exposed3i; - -{[In_1,In_2]: 1 <= In_1 <= n && 1 <= In_2 <= m1 && low <= 1} union - {[In_1,In_2]: 1 <= In_2 <= m1, low-1 && 1 <= In_1 <= n} - -# -# -# # THIRD GROUP - 1,2,3f (THERE ARE POSSIBLE OUTPUT DEPS BETWEEN THEM) -# -# v1f := ( f1f / Exposed3i ) -# intersection complement ( f3i compose o13f ) -# intersection complement ( f3f compose o13f ) -# intersection complement ( f1i compose o11f ) -# intersection complement ( f1f compose o11f ); -# -# v1f; - -{[iw1a,jw1a] -> [ir,jr] : FALSE } - -# -# -# # WE SHOULD BE ABLE TO DO v1f WITH SOME VALUE-BASED FLOW DD'S -# -# v1f_val := ( f1f / Exposed3i ) -# intersection complement ( v3i compose o13f ) -# intersection complement ( f3f compose o13f ) -# intersection complement ( v1i compose o11f ) -# intersection complement ( f1f compose o11f ); -# -# v1f_val; - -{[iw1a,jw1a] -> [ir,jr] : FALSE } - -# -# -# # -# # The effects of loop-independent flow have been taken out already, -# # so this should work. But it does not. Probably I am stupyd. -# # -# -# v1f_clever := ( f1f / Exposed3i ) -# intersection complement ( f3f compose o13f ) -# intersection complement ( f1f compose o11f ); -# -# v1f_clever; - -{[iw1a,jw1a] -> [iw1a+1,jw1a] : 1 <= jw1a <= m2, m1 && 1 <= iw1a < n && low <= 1} union - {[iw1a,jw1a] -> [iw1a+1,jw1a] : 1 <= jw1a <= m2, m1, low-1 && 1 <= iw1a < n} - -# -# -# # -# # NOW CHECK FOR EQUIVALENCES - THESE SHOULD BE TRUE -# # -# -# v1f subset v1f_val; - -True -# -# v1f_val subset v1f; - -True -# -# # v1f subset v1f_clever; -# # v1f_clever subset v1f; diff --git a/omega/examples/old_test/emit b/omega/examples/old_test/emit deleted file mode 100644 index 3b33a98..0000000 --- a/omega/examples/old_test/emit +++ /dev/null @@ -1,38 +0,0 @@ -# -# A problem that arises during the analysis of emit.t -# We are trying to find the dependences to the read 58: rhs(i) -# There are memory-based deps from the write 58: rhs(j) -# and the write 50: rhs(i0+k) -# Due to some screwy stuff, we do not realize that the first is -# a partial cover for the second, and do the real kill test. -# -# line_49_expr is nwall(l) -# - -symbolic matdim_E, i0_1(1), line_49_expr(1); - -is_58 := { [i,j] : i+1 <= j <= matdim_E && 1 <= i <= matdim_E }; -is_50 := { [l,k] : 1 <= k <= line_49_expr(Set) && 1 <= l <= 5 }; - -plus_plus := { [i,j] -> [i',j'] : i < i' && j < j' }; -plus_zero := { [i,j] -> [i',j'] : i < i' && j = j' }; -plus_star := { [i,j] -> [i',j'] : i < i' }; - -mo_50_50 := (is_50 * is_50) intersection plus_star - intersection { [l1,k1]->[l2,k2] : i0_1(In)+k1 = i0_1(Out)+k2 }; -mo_50_58 := (is_50 * is_58) - intersection { [l,k] -> [i,j] : i0_1(In)+k = j }; -mo_58_58 := (is_58 * is_58) intersection plus_zero - intersection { [i,j] -> [i',j'] : j = j' }; - -mf_58_58 := (is_58 * is_58) intersection plus_plus - intersection { [iw,jw] -> [ir,jr] : jw = ir }; -mf_50_58 := (is_50 * is_58) - intersection { [l,k] -> [i,j] : i0_1(In)+k = i }; - -vf_58_58 := mf_58_58 - (mf_58_58 compose mo_58_58); -vf_58_58; - -vf_50_58 := mf_50_58 intersection ( complement (mf_58_58 compose mo_50_58) ) - intersection ( complement (mf_50_58 compose mo_50_50) ); -vf_50_58; diff --git a/omega/examples/old_test/emit.oc-rt b/omega/examples/old_test/emit.oc-rt deleted file mode 100644 index 1bf7d6c..0000000 --- a/omega/examples/old_test/emit.oc-rt +++ /dev/null @@ -1,61 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# # -# # A problem that arises during the analysis of emit.t -# # We are trying to find the dependences to the read 58: rhs(i) -# # There are memory-based deps from the write 58: rhs(j) -# # and the write 50: rhs(i0+k) -# # Due to some screwy stuff, we do not realize that the first is -# # a partial cover for the second, and do the real kill test. -# # -# # line_49_expr is nwall(l) -# # -# -# Symbolic matdim_E, i0_1(1), line_49_expr(1); -# -# -# is_58 := { [i,j] : i+1 <= j <= matdim_E && 1 <= i <= matdim_E }; -# -# is_50 := { [l,k] : 1 <= k <= line_49_expr(Set) && 1 <= l <= 5 }; -# -# -# plus_plus := { [i,j] -> [i',j'] : i < i' && j < j' }; -# -# plus_zero := { [i,j] -> [i',j'] : i < i' && j = j' }; -# -# plus_star := { [i,j] -> [i',j'] : i < i' }; -# -# -# mo_50_50 := (is_50 * is_50) intersection plus_star -# intersection { [l1,k1]->[l2,k2] : i0_1(In)+k1 = i0_1(Out)+k2 }; -# -# mo_50_58 := (is_50 * is_58) -# intersection { [l,k] -> [i,j] : i0_1(In)+k = j }; -# -# mo_58_58 := (is_58 * is_58) intersection plus_zero -# intersection { [i,j] -> [i',j'] : j = j' }; -# -# -# mf_58_58 := (is_58 * is_58) intersection plus_plus -# intersection { [iw,jw] -> [ir,jr] : jw = ir }; -# -# mf_50_58 := (is_50 * is_58) -# intersection { [l,k] -> [i,j] : i0_1(In)+k = i }; -# -# -# vf_58_58 := mf_58_58 - (mf_58_58 compose mo_58_58); -# -# vf_58_58; - -{[i,i+1] -> [i+1,Out_2] : 1 <= i <= Out_2-2 && Out_2 <= matdim_E} - -# -# -# vf_50_58 := mf_50_58 intersection ( complement (mf_58_58 compose mo_50_58) ) -# intersection ( complement (mf_50_58 compose mo_50_50) ); -# -# vf_50_58; - -{[In_1,-i0_1(In_1)+1] -> [1,j] : -line_49_expr(In_1)+1 <= i0_1(In_1) <= 0 && 1 <= In_1 <= 4 && 2 <= j <= matdim_E && UNKNOWN} union - {[In_1,-i0_1(In_1)+1] -> [1,j] : In_1 = 5 && -line_49_expr(In_1)+1 <= i0_1(In_1) <= 0 && 2 <= j <= matdim_E} - -# diff --git a/omega/examples/old_test/example1 b/omega/examples/old_test/example1 deleted file mode 100644 index 0721b20..0000000 --- a/omega/examples/old_test/example1 +++ /dev/null @@ -1,4 +0,0 @@ -foo := {[In_1,In_2] -> [i,j] : exists ( alpha : In_2+2i = 1 && 2In_1+In_2 = 3+4j && In_2+20alpha = 5+8j && -199 <= In_2 <= -2j-5 && 1 <= j)}; -example foo; - - diff --git a/omega/examples/old_test/example1.oc-rt b/omega/examples/old_test/example1.oc-rt deleted file mode 100644 index 89b2e0a..0000000 --- a/omega/examples/old_test/example1.oc-rt +++ /dev/null @@ -1,10 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# foo := {[In_1,In_2] -> [i,j] : Exists ( alpha : In_2+2i = 1 && 2In_1+In_2 = 3+4j && In_2+20alpha = 5+8j && -199 <= In_2 <= -2j-5 && 1 <= j)}; -# -# example foo; - -{[7,-7] -> [4,1] } - -# -# -# diff --git a/omega/examples/old_test/farkas b/omega/examples/old_test/farkas deleted file mode 100644 index ce754fc..0000000 --- a/omega/examples/old_test/farkas +++ /dev/null @@ -1,8 +0,0 @@ - -symbolic n; -symbolic c; - -R := {[i,j] : 1 <= i <= 10 && 1 <= j <= n}; - -ac := farkas R; -ac; diff --git a/omega/examples/old_test/farkas.oc-rt b/omega/examples/old_test/farkas.oc-rt deleted file mode 100644 index cd52e5e..0000000 --- a/omega/examples/old_test/farkas.oc-rt +++ /dev/null @@ -1,17 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# -# symbolic n; -# -# symbolic c; -# -# -# R := {[i,j] : 1 <= i <= 10 && 1 <= j <= n}; -# -# -# ac := farkas R; -# -# ac; - -{[i,j]: 0 <= constantTerm+n+i+j && 0 <= constantTerm+n+10i+j && 0 <= n+j && 0 <= n} - -# diff --git a/omega/examples/old_test/farkas2 b/omega/examples/old_test/farkas2 deleted file mode 100644 index 2781423..0000000 --- a/omega/examples/old_test/farkas2 +++ /dev/null @@ -1,6 +0,0 @@ - -R := {[1:10,1:10]} union {[5:15,11:20]}; -R; -f := farkas R; -f; -Hull R; diff --git a/omega/examples/old_test/farkas2.oc-rt b/omega/examples/old_test/farkas2.oc-rt deleted file mode 100644 index 22d43cc..0000000 --- a/omega/examples/old_test/farkas2.oc-rt +++ /dev/null @@ -1,22 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# -# R := {[1:10,1:10]} union {[5:15,11:20]}; -# -# R; - -{[In_1,In_2]: 1 <= In_1 <= 10 && 1 <= In_2 <= 10} union - {[In_1,In_2]: 5 <= In_1 <= 15 && 11 <= In_2 <= 20} - -# -# f := farkas R; -# -# f; - -{[In_1,In_2]: 0 <= constantTerm+10In_1+In_2 && 0 <= constantTerm+In_1+10In_2 && 0 <= constantTerm+15In_1+20In_2 && 0 <= constantTerm+In_1+In_2 && 0 <= constantTerm+15In_1+11In_2 && 0 <= constantTerm+5In_1+20In_2} - -# -# Hull R; - -{[In_1,In_2]: 1, 2In_1-19 <= In_2 <= 20 && 1 <= In_1 <= 15 && 2In_2 <= 15+5In_1} - -# diff --git a/omega/examples/old_test/farkas3 b/omega/examples/old_test/farkas3 deleted file mode 100644 index 8adec2e..0000000 --- a/omega/examples/old_test/farkas3 +++ /dev/null @@ -1,3 +0,0 @@ - -R := {[1:10,1:10,1:10,1:10]}; -AffineHull R; diff --git a/omega/examples/old_test/farkas3.oc-rt b/omega/examples/old_test/farkas3.oc-rt deleted file mode 100644 index 095cb54..0000000 --- a/omega/examples/old_test/farkas3.oc-rt +++ /dev/null @@ -1,9 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# -# R := {[1:10,1:10,1:10,1:10]}; -# -# AffineHull R; - -{[In_1,In_2,In_3,In_4]} - -# diff --git a/omega/examples/old_test/fc1 b/omega/examples/old_test/fc1 deleted file mode 100644 index 66a9e90..0000000 --- a/omega/examples/old_test/fc1 +++ /dev/null @@ -1,23 +0,0 @@ -symbolic n; - -I1 := {[i,j] : 1 <= i < j <= n}; -I2 := {[i,j,k] : 1 <= i < j,k <= n}; -I3 := {[i] : 1 <= i <= n}; -I4 := {[i,j] : 1 <= j < i <= n}; -I5 := {[i] : 1 <= i <= n}; - -T1 := {[i,j] -> [i-1,0,n-i,n-j]}; -T2 := {[i,j,k] -> [i-1,1,n-i,n-j]}; -T3 := {[i] -> [0,0,0,i]}; -T4 := {[i,j] -> [j+n-1,0,i,j]}; -T5 := {[i] -> [i+n-2,1,0,0]}; - -T1(I1); -T2(I2); -T3(I3); -T4(I4); -T5(I5); -codegen T1:I1,T2:I2; -codegen T1:I1,T2:I2,T3:I3,T4:I4,T5:I5; -codegen 2 T1:I1,T2:I2,T3:I3,T4:I4,T5:I5; - diff --git a/omega/examples/old_test/fc1.oc-rt b/omega/examples/old_test/fc1.oc-rt deleted file mode 100644 index 8075f2d..0000000 --- a/omega/examples/old_test/fc1.oc-rt +++ /dev/null @@ -1,89 +0,0 @@ ->>> symbolic n; ->>> ->>> I1 := {[i,j] : 1 <= i < j <= n}; ->>> I2 := {[i,j,k] : 1 <= i < j,k <= n}; ->>> I3 := {[i] : 1 <= i <= n}; ->>> I4 := {[i,j] : 1 <= j < i <= n}; ->>> I5 := {[i] : 1 <= i <= n}; ->>> ->>> T1 := {[i,j] -> [i-1,0,n-i,n-j]}; ->>> T2 := {[i,j,k] -> [i-1,1,n-i,n-j]}; ->>> T3 := {[i] -> [0,0,0,i]}; ->>> T4 := {[i,j] -> [j+n-1,0,i,j]}; ->>> T5 := {[i] -> [i+n-2,1,0,0]}; ->>> ->>> T1(I1); -{[In_1,0,n-In_1-1,In_4]: 0 <= In_1 && 2+In_1+In_4 <= n && 0 <= In_4} ->>> T2(I2); -{[In_1,1,n-In_1-1,In_4]: 0 <= In_1 && 2+In_1+In_4 <= n && 0 <= In_4} ->>> T3(I3); -{[0,0,0,i]: 1 <= i <= n} ->>> T4(I4); -{[In_1,0,i,In_1-n+1]: i <= n <= In_1 && 2+In_1 <= n+i} ->>> T5(I5); -{[In_1,1,0,0]: n-1 <= In_1 <= 2n-2} ->>> codegen T1:I1,T2:I2; -for(t1 = 0; t1 <= n-2; t1++) { - for(t4 = 0; t4 <= -t1+n-2; t4++) { - s1(t1+1,n-t4); - } - for(t4 = 0; t4 <= -t1+n-2; t4++) { - s2(t1+1,n-t4,N/A); - } -} - ->>> codegen T1:I1,T2:I2,T3:I3,T4:I4,T5:I5; -for(t1 = 0; t1 <= 2*n-2; t1++) { - if (t1 <= 0) { - for(t4 = 1; t4 <= n; t4++) { - s3(t4); - } - } - for(t4 = 0; t4 <= -t1+n-2; t4++) { - s1(t1+1,n-t4); - } - if (t1 >= n) { - for(t3 = -n+t1+2; t3 <= n; t3++) { - s4(t3,t1-n+1); - } - } - for(t4 = 0; t4 <= -t1+n-2; t4++) { - s2(t1+1,n-t4,N/A); - } - if (t1 >= n-1) { - s5(-n+t1+2); - } -} - ->>> codegen 2 T1:I1,T2:I2,T3:I3,T4:I4,T5:I5; -for(t4 = 1; t4 <= n; t4++) { - s3(t4); -} -for(t4 = 0; t4 <= n-2; t4++) { - s1(1,-t4+n); -} -for(t4 = 0; t4 <= n-2; t4++) { - s2(1,-t4+n,N/A); -} -if (n == 1) { - s5(-n+2); -} -for(t1 = 1; t1 <= n-2; t1++) { - for(t4 = 0; t4 <= -t1+n-2; t4++) { - s1(t1+1,n-t4); - } - for(t4 = 0; t4 <= -t1+n-2; t4++) { - s2(t1+1,n-t4,N/A); - } -} -if (n >= 2) { - s5(1); -} -for(t1 = max(n,1); t1 <= 2*n-2; t1++) { - for(t3 = t1-n+2; t3 <= n; t3++) { - s4(t3,t1-n+1); - } - s5(-n+t1+2); -} - - diff --git a/omega/examples/old_test/fc2 b/omega/examples/old_test/fc2 deleted file mode 100644 index b195d72..0000000 --- a/omega/examples/old_test/fc2 +++ /dev/null @@ -1,29 +0,0 @@ -symbolic n; - -I1 := {[i,j] : 1 <= i < j <= n}; -I2 := {[i,j,k] : 1 <= i < j,k <= n}; -I3 := {[i] : 1 <= i <= n}; -I4 := {[i,j] : 1 <= j < i <= n}; -I5 := {[i] : 1 <= i <= n}; - -T1 := {[i,j] -> [i-1,0,n-i,n-j]}; -T2 := {[i,j,k] -> [i-1,1,n-i,n-j]}; -T3 := {[i] -> [0,0,0,i]}; -T4 := {[i,j] -> [j+n-1,0,i,j]}; -T5 := {[i] -> [i+n-2,1,0,0]}; - -first := {[i,*,*,*] -> [i]}; - -first(T1(I1)); -first(T2(I2)); -first(T3(I3)); -first(T4(I4)); -first(T5(I5)); -T1(I1); -T2(I2); -T3(I3); -T4(I4); -T5(I5); -codegen T1:I1,T2:I2; -codegen T1:I1,T2:I2,T3:I3,T4:I4,T5:I5; - diff --git a/omega/examples/old_test/fc2.oc-rt b/omega/examples/old_test/fc2.oc-rt deleted file mode 100644 index 742929e..0000000 --- a/omega/examples/old_test/fc2.oc-rt +++ /dev/null @@ -1,115 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic n; -# -# -# I1 := {[i,j] : 1 <= i < j <= n}; -# -# I2 := {[i,j,k] : 1 <= i < j,k <= n}; -# -# I3 := {[i] : 1 <= i <= n}; -# -# I4 := {[i,j] : 1 <= j < i <= n}; -# -# I5 := {[i] : 1 <= i <= n}; -# -# -# T1 := {[i,j] -> [i-1,0,n-i,n-j]}; -# -# T2 := {[i,j,k] -> [i-1,1,n-i,n-j]}; -# -# T3 := {[i] -> [0,0,0,i]}; -# -# T4 := {[i,j] -> [j+n-1,0,i,j]}; -# -# T5 := {[i] -> [i+n-2,1,0,0]}; -# -# -# first := {[i,*,*,*] -> [i]}; -# -# -# first(T1(I1)); - -{[i]: 0 <= i <= n-2} - -# -# first(T2(I2)); - -{[i]: 0 <= i <= n-2} - -# -# first(T3(I3)); - -{[0]: 1 <= n} - -# -# first(T4(I4)); - -{[i]: n <= i <= 2n-2} - -# -# first(T5(I5)); - -{[i]: n-1 <= i <= 2n-2} - -# -# T1(I1); - -{[In_1,0,n-In_1-1,In_4]: 0 <= In_1 && 2+In_1+In_4 <= n && 0 <= In_4} - -# -# T2(I2); - -{[In_1,1,n-In_1-1,In_4]: 0 <= In_1 && 2+In_1+In_4 <= n && 0 <= In_4} - -# -# T3(I3); - -{[0,0,0,i]: 1 <= i <= n} - -# -# T4(I4); - -{[In_1,0,i,In_1-n+1]: i <= n <= In_1 && 2+In_1 <= n+i} - -# -# T5(I5); - -{[In_1,1,0,0]: n-1 <= In_1 <= 2n-2} - -# -# codegen T1:I1,T2:I2; -for(t1 = 0; t1 <= n-2; t1++) { - for(t4 = 0; t4 <= -t1+n-2; t4++) { - s1(t1+1,n-t4); - } - for(t4 = 0; t4 <= -t1+n-2; t4++) { - s2(t1+1,n-t4); - } -} - -# -# codegen T1:I1,T2:I2,T3:I3,T4:I4,T5:I5; -for(t1 = 0; t1 <= 2*n-2; t1++) { - if (t1 <= 0) { - for(t4 = 1; t4 <= n; t4++) { - s3(t4); - } - } - for(t4 = 0; t4 <= -t1+n-2; t4++) { - s1(t1+1,n-t4); - } - if (t1 >= n) { - for(t3 = t1-n+2; t3 <= n; t3++) { - s4(t3,t1-n+1); - } - } - for(t4 = 0; t4 <= -t1+n-2; t4++) { - s2(t1+1,n-t4); - } - if (t1 >= n-1) { - s5(t1-n+2); - } -} - -# -# diff --git a/omega/examples/old_test/foo b/omega/examples/old_test/foo deleted file mode 100644 index 1a5ef46..0000000 --- a/omega/examples/old_test/foo +++ /dev/null @@ -1,13 +0,0 @@ - -R := {[t,s] -> [t+2,s+2] : t <= s} union - {[t,s] -> [t+4,s+4] : t <= s} union - {[t,s] -> [t+3,s+3] : t <= s} union - {[t,s] -> [t',s-t+t'] : t <= s, t'-5} union - {[t,s] -> [t+1,s+1] : t <= s} union - {[t,s] -> [t',s-t+t'] : t <= s-1, t'-2}; -R; -difference R; -Hull difference R; - -Hull R; - diff --git a/omega/examples/old_test/foo.oc-rt b/omega/examples/old_test/foo.oc-rt deleted file mode 100644 index 3f7f5a9..0000000 --- a/omega/examples/old_test/foo.oc-rt +++ /dev/null @@ -1,37 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# -# R := {[t,s] -> [t+2,s+2] : t <= s} union -# {[t,s] -> [t+4,s+4] : t <= s} union -# {[t,s] -> [t+3,s+3] : t <= s} union -# {[t,s] -> [t',s-t+t'] : t <= s, t'-5} union -# {[t,s] -> [t+1,s+1] : t <= s} union -# {[t,s] -> [t',s-t+t'] : t <= s-1, t'-2}; -# -# R; - -{[t,s] -> [t+2,s+2] : t <= s} union - {[t,s] -> [t+4,s+4] : t <= s} union - {[t,s] -> [t+3,s+3] : t <= s} union - {[t,s] -> [t',s-t+t'] : t <= s, t'-5} union - {[t,s] -> [t+1,s+1] : t <= s} union - {[t,s] -> [t',s-t+t'] : t <= s-1, t'-2} - -# -# difference R; - -{[1,1]} union - {[In_1,In_1]: 2 <= In_1} - -# -# hull difference R; - -{[In_1,In_1]: 1 <= In_1} - -# -# -# Hull R; - -{[t,s] -> [t',s-t+t'] : t <= s, t'-1} - -# -# diff --git a/omega/examples/old_test/foo2 b/omega/examples/old_test/foo2 deleted file mode 100644 index 69a63da..0000000 --- a/omega/examples/old_test/foo2 +++ /dev/null @@ -1,3 +0,0 @@ -Hull( {[1,1]} union - {[In_1,In_1]: 2 <= In_1}); - diff --git a/omega/examples/old_test/foo2.oc-rt b/omega/examples/old_test/foo2.oc-rt deleted file mode 100644 index c8f0209..0000000 --- a/omega/examples/old_test/foo2.oc-rt +++ /dev/null @@ -1,8 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# hull( {[1,1]} union -# {[In_1,In_1]: 2 <= In_1}); - -{[In_1,In_1]: 1 <= In_1} - -# -# diff --git a/omega/examples/old_test/foo6 b/omega/examples/old_test/foo6 deleted file mode 100644 index 0b702cd..0000000 --- a/omega/examples/old_test/foo6 +++ /dev/null @@ -1 +0,0 @@ -approximate {[i,j] : exists (a,b : a,b >= 0 && i = -201a-3b && j = 103a+200b)}; diff --git a/omega/examples/old_test/foo6.oc-rt b/omega/examples/old_test/foo6.oc-rt deleted file mode 100644 index aeb1b67..0000000 --- a/omega/examples/old_test/foo6.oc-rt +++ /dev/null @@ -1,6 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# approximate {[i,j] : exists (a,b : a,b >= 0 && i = -201a-3b && j = 103a+200b)}; - -{[i,j]: 200i+3j <= 0 && 0 <= 103i+201j} - -# diff --git a/omega/examples/old_test/forall b/omega/examples/old_test/forall deleted file mode 100644 index 8b1de0a..0000000 --- a/omega/examples/old_test/forall +++ /dev/null @@ -1,21 +0,0 @@ -symbolic n,m,B; -{ [max_diff] : - forall (m : - (not exists (z1,z2 : 0<=z1= minX)) && - exists (x1,x2 : 0<=x1= minY)) && - exists (y1,y2 : 0<=y1= minX)) && - exists (x1,x2 : 0<=x1= minY)) && - exists (y1,y2 : 0<=y1= minX)) && -# exists (x1,x2 : 0<=x1= minY)) && -# exists (y1,y2 : 0<=y1= minX)) && -# exists (x1,x2 : 0<=x1= minY)) && -# exists (y1,y2 : 0<=y1 [i,k,1,0]}; -T2 := {[k,i,j] -> [i,j,0,k]}; -T1(I1); -T2(I2); -codegen T1:I1,T2:I2; -codegen 2 T1:I1,T2:I2; diff --git a/omega/examples/old_test/ge.oc-rt b/omega/examples/old_test/ge.oc-rt deleted file mode 100644 index 1006fe5..0000000 --- a/omega/examples/old_test/ge.oc-rt +++ /dev/null @@ -1,38 +0,0 @@ ->>> symbolic n; ->>> I1 := {[k,i] : 1 <= k < i <= n }; ->>> I2 := {[k,i,j] : 1 <= k < i,j <= n }; ->>> T1 := {[k,i] -> [i,k,1,0]}; ->>> T2 := {[k,i,j] -> [i,j,0,k]}; ->>> T1(I1); -{[i,k,1,0]: 1 <= k < i <= n} ->>> T2(I2); -{[i,j,0,k]: 1 <= k < i,j <= n} ->>> codegen T1:I1,T2:I2; -for(t1 = 2; t1 <= n; t1++) { - for(t2 = 1; t2 <= n; t2++) { - for(t4 = 1; t4 <= min(t1-1,t2-1); t4++) { - s2(t4,t1,t2); - } - if (t2 <= t1-1) { - s1(t2,t1); - } - } -} - ->>> codegen 2 T1:I1,T2:I2; -for(t1 = 2; t1 <= n; t1++) { - s1(1,t1); - for(t2 = 2; t2 <= t1-1; t2++) { - for(t4 = 1; t4 <= t2-1; t4++) { - s2(t4,t1,t2); - } - s1(t2,t1); - } - for(t2 = t1; t2 <= n; t2++) { - for(t4 = 1; t4 <= t1-1; t4++) { - s2(t4,t1,t2); - } - } -} - - diff --git a/omega/examples/old_test/givens2 b/omega/examples/old_test/givens2 deleted file mode 100644 index 0c6f634..0000000 --- a/omega/examples/old_test/givens2 +++ /dev/null @@ -1,15 +0,0 @@ -# -# an example from a slightly defective dependence relation for givens2.t -# - -symbolic n, line6exp(2) ; - -{ [i,j,k] -> [i',j',k'] : - 1 <= i <= n && - 1 <= i' <= n && - i+1 <= j <= n && - i'+1 <= j' <= n && - i <= k <= n && - i' <= k' <= n and - ( 1 <= line6exp(i,j) or line6exp(i,j) <= -1 ) and - ( 1 <= line6exp(i',j') or line6exp(i',j') <= -1 ) }; diff --git a/omega/examples/old_test/givens2.oc-rt b/omega/examples/old_test/givens2.oc-rt deleted file mode 100644 index 9dfac42..0000000 --- a/omega/examples/old_test/givens2.oc-rt +++ /dev/null @@ -1,38 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# # -# # an example from a slightly defective dependence relation for givens2.t -# # -# -# Symbolic n, line6exp(2) ; -# -# -# { [i,j,k] -> [i',j',k'] : -# 1 <= i <= n && -# 1 <= i' <= n && -# i+1 <= j <= n && -# i'+1 <= j' <= n && -# i <= k <= n && -# i' <= k' <= n and -# ( 1 <= line6exp(i,j) or line6exp(i,j) <= -1 ) and -# ( 1 <= line6exp(i',j') or line6exp(i',j') <= -1 ) }; - -{[i,j,k] -> [i,j,k'] : 1 <= i <= k', j-1, k && j <= n && k <= n && k' <= n && 1 <= line6exp(i,j)} union - {[i,j,k] -> [i,j,k'] : 1 <= i <= k', j-1, k && line6exp(i,j) <= -1 && j <= n && k <= n && k' <= n} union - {[i,j,k] -> [i',j',k'] : 1 <= i' < i < j <= n && i <= k <= n && i' < j' <= n && i' <= k' <= n && 1 <= line6exp(i,j) && 1 <= line6exp(i',j')} union - {[i,j,k] -> [i',j',k'] : 1 <= i < i' < j' <= n && i < j <= n && i <= k <= n && i' <= k' <= n && 1 <= line6exp(i,j) && 1 <= line6exp(i',j')} union - {[i,j,k] -> [i',j',k'] : i' = i && 1 <= i < j' < j <= n && i <= k,k' <= n && 1 <= line6exp(i,j) && 1 <= line6exp(i',j')} union - {[i,j,k] -> [i',j',k'] : i' = i && 1 <= i < j < j' <= n && i <= k,k' <= n && 1 <= line6exp(i,j) && 1 <= line6exp(i',j')} union - {[i,j,k] -> [i',j',k'] : 1 <= i' < i < j <= n && i <= k <= n && i' < j' <= n && i' <= k' <= n && line6exp(i,j) <= -1 && 1 <= line6exp(i',j')} union - {[i,j,k] -> [i',j',k'] : 1 <= i < i' < j' <= n && i < j <= n && i <= k <= n && i' <= k' <= n && line6exp(i,j) <= -1 && 1 <= line6exp(i',j')} union - {[i,j,k] -> [i',j',k'] : i' = i && 1 <= i < j' < j <= n && i <= k,k' <= n && line6exp(i,j) <= -1 && 1 <= line6exp(i',j')} union - {[i,j,k] -> [i',j',k'] : i' = i && 1 <= i < j < j' <= n && i <= k,k' <= n && line6exp(i,j) <= -1 && 1 <= line6exp(i',j')} union - {[i,j,k] -> [i',j',k'] : 1 <= i' < i < j <= n && i <= k <= n && i' < j' <= n && i' <= k' <= n && line6exp(i',j') <= -1 && 1 <= line6exp(i,j)} union - {[i,j,k] -> [i',j',k'] : 1 <= i < i' < j' <= n && i < j <= n && i <= k <= n && i' <= k' <= n && line6exp(i',j') <= -1 && 1 <= line6exp(i,j)} union - {[i,j,k] -> [i',j',k'] : i' = i && 1 <= i < j' < j <= n && i <= k,k' <= n && line6exp(i',j') <= -1 && 1 <= line6exp(i,j)} union - {[i,j,k] -> [i',j',k'] : i' = i && 1 <= i < j < j' <= n && i <= k,k' <= n && line6exp(i',j') <= -1 && 1 <= line6exp(i,j)} union - {[i,j,k] -> [i',j',k'] : 1 <= i' < i < j <= n && i <= k <= n && i' < j' <= n && i' <= k' <= n && line6exp(i,j) <= -1 && line6exp(i',j') <= -1} union - {[i,j,k] -> [i',j',k'] : 1 <= i < i' < j' <= n && i < j <= n && i <= k <= n && i' <= k' <= n && line6exp(i,j) <= -1 && line6exp(i',j') <= -1} union - {[i,j,k] -> [i',j',k'] : i' = i && 1 <= i < j' < j <= n && i <= k,k' <= n && line6exp(i',j') <= -1 && line6exp(i,j) <= -1} union - {[i,j,k] -> [i',j',k'] : i' = i && 1 <= i < j < j' <= n && i <= k,k' <= n && line6exp(i',j') <= -1 && line6exp(i,j) <= -1} - -# diff --git a/omega/examples/old_test/guard1 b/omega/examples/old_test/guard1 deleted file mode 100644 index 0496d3b..0000000 --- a/omega/examples/old_test/guard1 +++ /dev/null @@ -1,11 +0,0 @@ -symbolic n,m; -incomingKnown := { [i1,i2] : exists ( alpha : i1+3alpha = 1+i2 ) && - i1 = n && i2 = m}; - - -codegen incomingKnown; -incomingKnown := { [i1,i2] : exists ( alpha : i1+2alpha = 1+i2 ) && - i1 = n && i2 = m}; - - -codegen incomingKnown; diff --git a/omega/examples/old_test/guard1.oc-rt b/omega/examples/old_test/guard1.oc-rt deleted file mode 100644 index db4b780..0000000 --- a/omega/examples/old_test/guard1.oc-rt +++ /dev/null @@ -1,25 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic n,m; -# -# incomingKnown := { [i1,i2] : Exists ( alpha : i1+3alpha = 1+i2 ) && -# i1 = n && i2 = m}; -# -# -# -# codegen incomingKnown; -if (intMod(-n+m+1,3) == 0) { - s1(n,m); -} - -# -# incomingKnown := { [i1,i2] : Exists ( alpha : i1+2alpha = 1+i2 ) && -# i1 = n && i2 = m}; -# -# -# -# codegen incomingKnown; -if (intMod(n+m+1,2) == 0) { - s1(n,m); -} - -# diff --git a/omega/examples/old_test/hull1 b/omega/examples/old_test/hull1 deleted file mode 100644 index afb18a2..0000000 --- a/omega/examples/old_test/hull1 +++ /dev/null @@ -1,4 +0,0 @@ -R := {[1:10,1:10]} union {[-10:-1,-10:-1]} union - {[x,y] : -10 <= x,y <= 10 && -10 <= x-y <= 10}; -R; -Hull R; diff --git a/omega/examples/old_test/hull1.oc-rt b/omega/examples/old_test/hull1.oc-rt deleted file mode 100644 index f8973fa..0000000 --- a/omega/examples/old_test/hull1.oc-rt +++ /dev/null @@ -1,14 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# R := {[1:10,1:10]} union {[-10:-1,-10:-1]} union -# {[x,y] : -10 <= x,y <= 10 && -10 <= x-y <= 10}; -# -# R; - -{[x,y]: -10, y-10 <= x <= 10, y+10 && -10 <= y <= 10} - -# -# Hull R; - -{[x,y]: -10, y-10 <= x <= 10, y+10 && -10 <= y <= 10} - -# diff --git a/omega/examples/old_test/hull2 b/omega/examples/old_test/hull2 deleted file mode 100644 index 69214f8..0000000 --- a/omega/examples/old_test/hull2 +++ /dev/null @@ -1,3 +0,0 @@ -R := {[1,1]} union {[3,3]}; -R; -Hull R; diff --git a/omega/examples/old_test/hull2.oc-rt b/omega/examples/old_test/hull2.oc-rt deleted file mode 100644 index f5e2e94..0000000 --- a/omega/examples/old_test/hull2.oc-rt +++ /dev/null @@ -1,14 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# R := {[1,1]} union {[3,3]}; -# -# R; - -{[1,1]} union - {[3,3]} - -# -# hull R; - -{[In_1,In_1]: 1 <= In_1 <= 3} - -# diff --git a/omega/examples/old_test/hull3 b/omega/examples/old_test/hull3 deleted file mode 100644 index 22e0324..0000000 --- a/omega/examples/old_test/hull3 +++ /dev/null @@ -1,17 +0,0 @@ - -symbolic n; - -s1:={[t1, 0, 0]:1 <= t1 && 64 * t1 <= n}; - -s2 := {[t1, t2, 0]: 1 <= t1 && 64 * t1 <= n && t2 = t1}; - -s3 := {[t1, 0, t3]: 1 <= t1 && 64 * t1 <= n && t3 = t1}; - -s := (s1 union s2 union s3); - -s; -h := Hull s; - -h; - -h - s; diff --git a/omega/examples/old_test/hull3.oc-rt b/omega/examples/old_test/hull3.oc-rt deleted file mode 100644 index c094288..0000000 --- a/omega/examples/old_test/hull3.oc-rt +++ /dev/null @@ -1,40 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# -# symbolic n; -# -# -# s1:={[t1, 0, 0]:1 <= t1 && 64 * t1 <= n}; -# -# -# s2 := {[t1, t2, 0]: 1 <= t1 && 64 * t1 <= n && t2 = t1}; -# -# -# s3 := {[t1, 0, t3]: 1 <= t1 && 64 * t1 <= n && t3 = t1}; -# -# -# s := (s1 union s2 union s3); -# -# -# s; - -{[t1,0,0]: 1 <= t1 && 64t1 <= n} union - {[t1,t1,0]: 1 <= t1 && 64t1 <= n} union - {[t1,0,t1]: 1 <= t1 && 64t1 <= n} - -# -# h := hull s; -# -# -# h; - -{[t1,t2,t3]: 0 <= t3 && 0 <= t2 && 64t1 <= n && 1 <= t1 && t2+t3 <= t1} - -# -# -# h - s; - -{[t1,t2,t3]: 1 <= t3 && 1 <= t2 && 64t1 <= n && t2+t3 <= t1} union - {[t1,t2,0]: 1 <= t2 < t1 && 64t1 <= n} union - {[t1,0,t3]: 1 <= t3 < t1 && 64t1 <= n} - -# diff --git a/omega/examples/old_test/ip1 b/omega/examples/old_test/ip1 deleted file mode 100644 index b8cd8c4..0000000 --- a/omega/examples/old_test/ip1 +++ /dev/null @@ -1,13 +0,0 @@ -time {[a,b,c,d,e,f] : - a+b+2c+2d+e+2f >= 1 - && a - 3b - 2f >= 1 - && 3a-b >= 1 - && a-c >= 1 - && -b-3c+2e-2f >= 1 - && -a-2e>=1 - && b-2d-f >= 1 - && 4a+b-e >= 1 - && a-c+e >= 1 - && a >= 1 - }; - diff --git a/omega/examples/old_test/ip1.oc-rt b/omega/examples/old_test/ip1.oc-rt deleted file mode 100644 index 6646b8f..0000000 --- a/omega/examples/old_test/ip1.oc-rt +++ /dev/null @@ -1,15 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# time {[a,b,c,d,e,f] : -# a+b+2c+2d+e+2f >= 1 -# && a - 3b - 2f >= 1 -# && 3a-b >= 1 -# && a-c >= 1 -# && -b-3c+2e-2f >= 1 -# && -a-2e>=1 -# && b-2d-f >= 1 -# && 4a+b-e >= 1 -# && a-c+e >= 1 -# && a >= 1 -'time' requires getrusage, but the omega calclator was compiled with OMIT_GETRUSAGE set! -# }; -# diff --git a/omega/examples/old_test/ip2 b/omega/examples/old_test/ip2 deleted file mode 100644 index cfef018..0000000 --- a/omega/examples/old_test/ip2 +++ /dev/null @@ -1,11 +0,0 @@ -time {[a,b,c,d,e,f] : - a+b+2c+2d+e+2f >= 1 - && 2a-3b-2f >= 1 - && 3a-2b >= 1 - && a-3c >= 1 - && -b-3c+2e-2f>=1 - && -a-2e >= 1 - && b-2d-3f >= 1 - && 3a+b-e >= 1 - }; - diff --git a/omega/examples/old_test/ip2.oc-rt b/omega/examples/old_test/ip2.oc-rt deleted file mode 100644 index 74cda4f..0000000 --- a/omega/examples/old_test/ip2.oc-rt +++ /dev/null @@ -1,13 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# time {[a,b,c,d,e,f] : -# a+b+2c+2d+e+2f >= 1 -# && 2a-3b-2f >= 1 -# && 3a-2b >= 1 -# && a-3c >= 1 -# && -b-3c+2e-2f>=1 -# && -a-2e >= 1 -# && b-2d-3f >= 1 -# && 3a+b-e >= 1 -'time' requires getrusage, but the omega calclator was compiled with OMIT_GETRUSAGE set! -# }; -# diff --git a/omega/examples/old_test/ip3 b/omega/examples/old_test/ip3 deleted file mode 100644 index 7fc0ec1..0000000 --- a/omega/examples/old_test/ip3 +++ /dev/null @@ -1,18 +0,0 @@ -approximate {[a,b,c,d,e,f] : ( - a+b+2c+2d+e+2f >= 1 - && 2a-3b-2f >= 1 - && 3a-2b >= 1 - && a-3c >= 1 - && -b-3c+2e-2f>=1 - && -a-2e >= 1 - && b-2d-3f >= 1 - && 3a+b-e >= 1 - - && a = 0 - && b = -1 - && c = -1 - && e = -2 - && d = 11 - ) - }; - diff --git a/omega/examples/old_test/ip3.oc-rt b/omega/examples/old_test/ip3.oc-rt deleted file mode 100644 index 645e3f8..0000000 --- a/omega/examples/old_test/ip3.oc-rt +++ /dev/null @@ -1,23 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# approximate {[a,b,c,d,e,f] : ( -# a+b+2c+2d+e+2f >= 1 -# && 2a-3b-2f >= 1 -# && 3a-2b >= 1 -# && a-3c >= 1 -# && -b-3c+2e-2f>=1 -# && -a-2e >= 1 -# && b-2d-3f >= 1 -# && 3a+b-e >= 1 -# -# && a = 0 -# && b = -1 -# && c = -1 -# && e = -2 -# && d = 11 -# ) -# }; - -{[0,-1,-1,11,-2,-8]} - -# -# diff --git a/omega/examples/old_test/iter1 b/omega/examples/old_test/iter1 deleted file mode 100644 index 86ece54..0000000 --- a/omega/examples/old_test/iter1 +++ /dev/null @@ -1,2 +0,0 @@ -R := { [i] : i < 10 && i > 1}; -codegen R; diff --git a/omega/examples/old_test/iter1.oc-rt b/omega/examples/old_test/iter1.oc-rt deleted file mode 100644 index 172ced0..0000000 --- a/omega/examples/old_test/iter1.oc-rt +++ /dev/null @@ -1,9 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# R := { [i] : i < 10 && i > 1}; -# -# codegen R; -for(t1 = 2; t1 <= 9; t1++) { - s1(t1); -} - -# diff --git a/omega/examples/old_test/iter2 b/omega/examples/old_test/iter2 deleted file mode 100644 index e3ccff1..0000000 --- a/omega/examples/old_test/iter2 +++ /dev/null @@ -1,2 +0,0 @@ -R := { [i,j] : i <= 10 && i >= 1 && j <=100 && j >= 10}; -codegen R; diff --git a/omega/examples/old_test/iter2.oc-rt b/omega/examples/old_test/iter2.oc-rt deleted file mode 100644 index 0597426..0000000 --- a/omega/examples/old_test/iter2.oc-rt +++ /dev/null @@ -1,11 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# R := { [i,j] : i <= 10 && i >= 1 && j <=100 && j >= 10}; -# -# codegen R; -for(t1 = 1; t1 <= 10; t1++) { - for(t2 = 10; t2 <= 100; t2++) { - s1(t1,t2); - } -} - -# diff --git a/omega/examples/old_test/iter3 b/omega/examples/old_test/iter3 deleted file mode 100644 index 604574b..0000000 --- a/omega/examples/old_test/iter3 +++ /dev/null @@ -1,2 +0,0 @@ -R := { [i,j] : i < 10 && i > 1 && j < 10 && j > i}; -codegen R; diff --git a/omega/examples/old_test/iter3.oc-rt b/omega/examples/old_test/iter3.oc-rt deleted file mode 100644 index d1288b5..0000000 --- a/omega/examples/old_test/iter3.oc-rt +++ /dev/null @@ -1,11 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# R := { [i,j] : i < 10 && i > 1 && j < 10 && j > i}; -# -# codegen R; -for(t1 = 2; t1 <= 8; t1++) { - for(t2 = t1+1; t2 <= 9; t2++) { - s1(t1,t2); - } -} - -# diff --git a/omega/examples/old_test/iter4 b/omega/examples/old_test/iter4 deleted file mode 100644 index 2660d33..0000000 --- a/omega/examples/old_test/iter4 +++ /dev/null @@ -1,2 +0,0 @@ -R := { [i,j] : i < 10 && i > 1 && j <=2i && j > i}; -codegen R; diff --git a/omega/examples/old_test/iter4.oc-rt b/omega/examples/old_test/iter4.oc-rt deleted file mode 100644 index 182cb09..0000000 --- a/omega/examples/old_test/iter4.oc-rt +++ /dev/null @@ -1,11 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# R := { [i,j] : i < 10 && i > 1 && j <=2i && j > i}; -# -# codegen R; -for(t1 = 2; t1 <= 9; t1++) { - for(t2 = t1+1; t2 <= 2*t1; t2++) { - s1(t1,t2); - } -} - -# diff --git a/omega/examples/old_test/iter5 b/omega/examples/old_test/iter5 deleted file mode 100644 index b2a973b..0000000 --- a/omega/examples/old_test/iter5 +++ /dev/null @@ -1,2 +0,0 @@ -R := { [i,j] : i < 10 && i > 1 && j <=2i && j > i && j <= 16}; -codegen R; diff --git a/omega/examples/old_test/iter5.oc-rt b/omega/examples/old_test/iter5.oc-rt deleted file mode 100644 index 8b567d5..0000000 --- a/omega/examples/old_test/iter5.oc-rt +++ /dev/null @@ -1,11 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# R := { [i,j] : i < 10 && i > 1 && j <=2i && j > i && j <= 16}; -# -# codegen R; -for(t1 = 2; t1 <= 9; t1++) { - for(t2 = t1+1; t2 <= min(2*t1,16); t2++) { - s1(t1,t2); - } -} - -# diff --git a/omega/examples/old_test/iter6 b/omega/examples/old_test/iter6 deleted file mode 100644 index b093c0b..0000000 --- a/omega/examples/old_test/iter6 +++ /dev/null @@ -1,6 +0,0 @@ -Y := { [i,j] : 1 <= i <= 5 and 12 <= j <= 17}; -codegen Y; - -X := { [i,j] : 17i-153 = 12j+17 and 1 <= i <= 100 and 1 <= j <= 100 and i < j}; -codegen X; - diff --git a/omega/examples/old_test/iter6.oc-rt b/omega/examples/old_test/iter6.oc-rt deleted file mode 100644 index 74f06da..0000000 --- a/omega/examples/old_test/iter6.oc-rt +++ /dev/null @@ -1,22 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# Y := { [i,j] : 1 <= i <= 5 and 12 <= j <= 17}; -# -# codegen Y; -for(t1 = 1; t1 <= 5; t1++) { - for(t2 = 12; t2 <= 17; t2++) { - s1(t1,t2); - } -} - -# -# -# X := { [i,j] : 17i-153 = 12j+17 and 1 <= i <= 100 and 1 <= j <= 100 and i < j}; -# -# codegen X; -for(t1 = 46; t1 <= 70; t1 += 12) { - t2=intDiv((17*t1+11),12); - s1(t1,intDiv(17*t1+-170,12)); -} - -# -# diff --git a/omega/examples/old_test/iter7 b/omega/examples/old_test/iter7 deleted file mode 100644 index 3364dd7..0000000 --- a/omega/examples/old_test/iter7 +++ /dev/null @@ -1,3 +0,0 @@ -R := {[i,j] : 3i+2j=15 && 1<=i<=j<=100}; -R; -codegen R; diff --git a/omega/examples/old_test/iter7.oc-rt b/omega/examples/old_test/iter7.oc-rt deleted file mode 100644 index 52b7860..0000000 --- a/omega/examples/old_test/iter7.oc-rt +++ /dev/null @@ -1,15 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# R := {[i,j] : 3i+2j=15 && 1<=i<=j<=100}; -# -# R; - -{[i,j]: 3i+2j = 15 && 3 <= j <= 6} - -# -# codegen R; -for(t1 = 1; t1 <= 3; t1 += 2) { - t2=intDiv((-3*t1+15+1),2); - s1(t1,intDiv(-3*t1+15,2)); -} - -# diff --git a/omega/examples/old_test/iter8 b/omega/examples/old_test/iter8 deleted file mode 100644 index 65682bb..0000000 --- a/omega/examples/old_test/iter8 +++ /dev/null @@ -1,12 +0,0 @@ -symbolic exprVar1; -symbolic exprVar2; -symbolic exprVar3; - -ispace := {[In_1] : exists ( alpha : In_1+8alpha = 1+exprVar2 && exprVar3 = -0 && 1 <= exprVar1 < In_1 <= 16 && exprVar2 < In_1)}; - -known := {[In1] : exists ( alpha : exprVar3 = 0 && exprVar2 <= 8alpha +15 -&& alpha <= 0 && 1 <= exprVar1 && exprVar1+8alpha <= exprVar2)}; - -codegen ispace given known; - diff --git a/omega/examples/old_test/iter8.oc-rt b/omega/examples/old_test/iter8.oc-rt deleted file mode 100644 index ede80cb..0000000 --- a/omega/examples/old_test/iter8.oc-rt +++ /dev/null @@ -1,23 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic exprVar1; -# -# symbolic exprVar2; -# -# symbolic exprVar3; -# -# -# ispace := {[In_1] : Exists ( alpha : In_1+8alpha = 1+exprVar2 && exprVar3 = -# 0 && 1 <= exprVar1 < In_1 <= 16 && exprVar2 < In_1)}; -# -# -# known := {[In1] : Exists ( alpha : exprVar3 = 0 && exprVar2 <= 8alpha +15 -# && alpha <= 0 && 1 <= exprVar1 && exprVar1+8alpha <= exprVar2)}; -# -# -# codegen ispace given known; -for(t1 = max(exprVar2+1,exprVar1+1+intMod(((exprVar2+1)-exprVar1+1),8)); t1 <= 16; t1 += 8) { - s1(t1); -} - -# -# diff --git a/omega/examples/old_test/iter9 b/omega/examples/old_test/iter9 deleted file mode 100644 index 42724f5..0000000 --- a/omega/examples/old_test/iter9 +++ /dev/null @@ -1,40 +0,0 @@ - -symbolic exprVar1; -symbolic exprVar2; - -ispace0 := {[In_1] : exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 -&& alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; - -ispace1 := {[In_1] : exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 -&& alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; - -ispace2 := {[In_1] : exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 -&& alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; - -ispace3 := {[In_1] : exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 -&& alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; - -ispace4 := {[In_1] : exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 -&& alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; - -ispace5 := {[In_1] : exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 -&& alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)} union - {[In_1] : exists ( alpha : 1+exprVar1 = In_1+8alpha && exprVar2 = 0 && 1, -exprVar1+1 <= In_1 <= 15)}; - -known := { [In_1] : exprVar2 = 0 && exprVar1 <= 15} union - {[In_1] : exprVar2 = 0 && exprVar1 <= 14} union - {[In_1] : exprVar2 = 0 && exprVar1 <= 15}; - - -k := Hull known; - -gist ispace0 given k; -gist ispace1 given k; -gist ispace2 given k; -gist ispace3 given k; -gist ispace4 given k; -gist ispace5 given k; - -codegen ispace0, ispace1, ispace2, ispace3, ispace4, ispace5 given k; - diff --git a/omega/examples/old_test/iter9.oc-rt b/omega/examples/old_test/iter9.oc-rt deleted file mode 100644 index 93b1c48..0000000 --- a/omega/examples/old_test/iter9.oc-rt +++ /dev/null @@ -1,121 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# -# symbolic exprVar1; -# -# symbolic exprVar2; -# -# -# ispace0 := {[In_1] : Exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 -# && alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; -# -# -# ispace1 := {[In_1] : Exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 -# && alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; -# -# -# ispace2 := {[In_1] : Exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 -# && alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; -# -# -# ispace3 := {[In_1] : Exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 -# && alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; -# -# -# ispace4 := {[In_1] : Exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 -# && alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; -# -# -# ispace5 := {[In_1] : Exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 -# && alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)} union -# {[In_1] : Exists ( alpha : 1+exprVar1 = In_1+8alpha && exprVar2 = 0 && 1, -# exprVar1+1 <= In_1 <= 15)}; -# -# -# known := { [In_1] : exprVar2 = 0 && exprVar1 <= 15} union -# {[In_1] : exprVar2 = 0 && exprVar1 <= 14} union -# {[In_1] : exprVar2 = 0 && exprVar1 <= 15}; -# -# -# -# k := Hull known; -# -# -# gist ispace0 given k; - -{[In_1]: Exists ( alpha : exprVar1 <= 8alpha+15 && 1 <= In_1 && In_1+8alpha <= exprVar1)} - -# -# gist ispace1 given k; - -{[In_1]: Exists ( alpha : exprVar1 <= 8alpha+15 && 1 <= In_1 && In_1+8alpha <= exprVar1)} - -# -# gist ispace2 given k; - -{[In_1]: Exists ( alpha : exprVar1 <= 8alpha+15 && 1 <= In_1 && In_1+8alpha <= exprVar1)} - -# -# gist ispace3 given k; - -{[In_1]: Exists ( alpha : exprVar1 <= 8alpha+15 && 1 <= In_1 && In_1+8alpha <= exprVar1)} - -# -# gist ispace4 given k; - -{[In_1]: Exists ( alpha : exprVar1 <= 8alpha+15 && 1 <= In_1 && In_1+8alpha <= exprVar1)} - -# -# gist ispace5 given k; - -{[In_1]: Exists ( alpha : exprVar1 <= 8alpha+15 && 1 <= In_1 && In_1+8alpha <= exprVar1)} union - {[In_1]: Exists ( alpha : In_1+8alpha = 1+exprVar1 && 1, exprVar1+1 <= In_1 <= 15)} - -# -# -# codegen ispace0, ispace1, ispace2, ispace3, ispace4, ispace5 given k; -for(t1 = 1; t1 <= 8; t1++) { - if (exprVar1-15 <= 8*intDiv(exprVar1-t1,8) && exprVar1-15 <= 8*intDiv(exprVar1-t1,8)) { - s1(t1); - } - if (exprVar1-15 <= 8*intDiv(exprVar1-t1,8) && exprVar1-15 <= 8*intDiv(exprVar1-t1,8)) { - s2(t1); - } - if (exprVar1-15 <= 8*intDiv(exprVar1-t1,8) && exprVar1-15 <= 8*intDiv(exprVar1-t1,8)) { - s3(t1); - } - if (exprVar1-15 <= 8*intDiv(exprVar1-t1,8) && exprVar1-15 <= 8*intDiv(exprVar1-t1,8)) { - s4(t1); - } - if (exprVar1-15 <= 8*intDiv(exprVar1-t1,8) && exprVar1-15 <= 8*intDiv(exprVar1-t1,8)) { - s5(t1); - } - if (exprVar1-15 <= 8*intDiv(exprVar1-t1,8) && exprVar1-15 <= 8*intDiv(exprVar1-t1,8)) { - s6(t1); - } -} -for(t1 = 9; t1 <= 15; t1++) { - if (exprVar1-15 <= 8*intDiv(-t1+exprVar1,8)) { - s1(t1); - } - if (exprVar1-15 <= 8*intDiv(-t1+exprVar1,8)) { - s2(t1); - } - if (exprVar1-15 <= 8*intDiv(-t1+exprVar1,8)) { - s3(t1); - } - if (exprVar1-15 <= 8*intDiv(-t1+exprVar1,8)) { - s4(t1); - } - if (exprVar1-15 <= 8*intDiv(-t1+exprVar1,8)) { - s5(t1); - } - if (exprVar1-15 <= 8*intDiv(-t1+exprVar1,8)) { - s6(t1); - } - if (intMod(-t1+exprVar1+1,8) == 0) { - s6(t1); - } -} - -# -# diff --git a/omega/examples/old_test/lefur00 b/omega/examples/old_test/lefur00 deleted file mode 100644 index 061f78c..0000000 --- a/omega/examples/old_test/lefur00 +++ /dev/null @@ -1,15 +0,0 @@ -R := { [i, j, k, l] : - 0 <= i <= 19 && - 0 <= j <= 19 && - 1 <= k <= 1000 && - -k + l >= 0 && - 2 k - l + 1 >= 0 && - -200 i + k + l >= 0 && - 200 i - k - l + 199 >= 0 && - -200 j - k + 2 l >= 0 && - 200 j + k -2 l + 199 >= 0 -} ; - - -codegen R; - diff --git a/omega/examples/old_test/lefur00.oc-rt b/omega/examples/old_test/lefur00.oc-rt deleted file mode 100644 index 3b3736f..0000000 --- a/omega/examples/old_test/lefur00.oc-rt +++ /dev/null @@ -1,28 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# R := { [i, j, k, l] : -# 0 <= i <= 19 && -# 0 <= j <= 19 && -# 1 <= k <= 1000 && -# -k + l >= 0 && -# 2 k - l + 1 >= 0 && -# -200 i + k + l >= 0 && -# 200 i - k - l + 199 >= 0 && -# -200 j - k + 2 l >= 0 && -# 200 j + k -2 l + 199 >= 0 -# } ; -# -# -# -# codegen R; -for(t1 = 0; t1 <= 15; t1++) { - for(t2 = max(2*t1-15,intDiv(t1-1+1,2)); t2 <= min(t1+1,15); t2++) { - for(t3 = max(intDiv(200*t1-1+2,3),intDiv(200*t2-2+2,3),intDiv(-200*t2+400*t1-199+2,3),1); t3 <= min(100*t1+99,intDiv(-200*t2+400*t1+398,3),1000); t3++) { - for(t4 = max(t3,200*t1-t3,intDiv(200*t2+t3+1,2)); t4 <= min(2*t3+1,intDiv(200*t2+t3+199,2),200*t1-t3+199); t4++) { - s1(t1,t2,t3,t4); - } - } - } -} - -# -# diff --git a/omega/examples/old_test/lefur01 b/omega/examples/old_test/lefur01 deleted file mode 100644 index 495c4f3..0000000 --- a/omega/examples/old_test/lefur01 +++ /dev/null @@ -1,14 +0,0 @@ -R := { [i, j, k, l] : - 0 <= i <= 19 && - 0 <= j <= 19 && - 1 <= k <= 1000 && - -k + l >= 0 && - 2 k - l + 1 >= 0 && - -200 i + k + l >= 0 && - 200 i - k - l + 199 >= 0 && - -200 j - k + 2 l >= 0 && - 200 j + k -2 l + 199 >= 0 -} ; - -codegen R; -codegen 2 R; diff --git a/omega/examples/old_test/lefur01.oc-rt b/omega/examples/old_test/lefur01.oc-rt deleted file mode 100644 index 4437f93..0000000 --- a/omega/examples/old_test/lefur01.oc-rt +++ /dev/null @@ -1,103 +0,0 @@ ->>> R := { [i, j, k, l] : ->>> 0 <= i <= 19 && ->>> 0 <= j <= 19 && ->>> 1 <= k <= 1000 && ->>> -k + l >= 0 && ->>> 2 k - l + 1 >= 0 && ->>> -200 i + k + l >= 0 && ->>> 200 i - k - l + 199 >= 0 && ->>> -200 j - k + 2 l >= 0 && ->>> 200 j + k -2 l + 199 >= 0 ->>> } ; ->>> ->>> codegen R; -for(t1 = 0; t1 <= 15; t1++) { - for(t2 = max(2*t1-15,intDiv(t1-1+1,2)); t2 <= min(t1+1,15); t2++) { - for(t3 = max(intDiv(200*t1-1+2,3),intDiv(200*t2-2+2,3),intDiv(400*t1-200*t2-199+2,3),1); t3 <= min(100*t1+99,intDiv(400*t1-200*t2+398,3),1000); t3++) { - for(t4 = max(t3,-t3+200*t1,intDiv(t3+200*t2+1,2)); t4 <= min(2*t3+1,-t3+200*t1+199,intDiv(t3+200*t2+199,2)); t4++) { - s1(t1,t2,t3,t4); - } - } - } -} - ->>> codegen 2 R; -for(t1 = 0; t1 <= 15; t1++) { - for(t2 = max(2*t1-15,intDiv(t1-1+1,2)); t2 <= min(t1+1,15); t2++) { - if (t2 <= t1-1) { - for(t3 = intDiv(-200*t2+400*t1-199+2,3); t3 <= min(100*t1-1,intDiv(-200*t2+400*t1-2,3)); t3++) { - for(t4 = 200*t1-t3; t4 <= intDiv(t3+200*t2+199,2); t4++) { - s1(t1,t2,t3,t4); - } - } - } - for(t3 = max(intDiv(200*t1-1+2,3),intDiv(200*t2-2+2,3)); t3 <= min(100*t1-1,intDiv(200*t2+195,3),intDiv(400*t1-200*t2+398,3),1000); t3++) { - for(t4 = intDiv(t3+200*t2+1,2); t4 <= 2*t3+1; t4++) { - s1(t1,t2,t3,t4); - } - } - for(t3 = max(intDiv(200*t2+196+2,3),intDiv(-200*t2+400*t1-1+2,3)); t3 <= min(100*t1-1,intDiv(-200*t2+400*t1+198,3),1000); t3++) { - for(t4 = intDiv(200*t2+t3+1,2); t4 <= intDiv(200*t2+t3+199,2); t4++) { - s1(t1,t2,t3,t4); - } - } - if (t2 <= t1) { - for(t3 = intDiv(-200*t2+400*t1+199+2,3); t3 <= min(intDiv(-200*t2+400*t1+398,3),100*t1-1,1000); t3++) { - for(t4 = intDiv(200*t2+t3+1,2); t4 <= -t3+200*t1+199; t4++) { - s1(t1,t2,t3,t4); - } - } - } - if (t2 == 1 && t1 == 1) { - for(t3 = 100; t3 <= 132; t3++) { - for(t4 = intDiv(t3+200+1,2); t4 <= 2*t3+1; t4++) { - s1(1,1,t3,t4); - } - } - } - if (2*t2 == t1+1 && t2 >= 2) { - for(t3 = 200*t2-100; t3 <= 200*t2-68; t3++) { - for(t4 = intDiv(200*t2+t3+1,2); t4 <= intDiv(200*t2+t3+199,2); t4++) { - s1(t1,intDiv(t1+1,2),t3,t4); - } - } - } - if (2*t2 >= t1+1) { - for(t3 = max(intDiv(200*t2-2+2,3),intDiv(-200*t2+400*t1+199+2,3),100*t1); t3 <= min(intDiv(-200*t2+400*t1+398,3),1000); t3++) { - for(t4 = intDiv(t3+200*t2+1,2); t4 <= 200*t1-t3+199; t4++) { - s1(t1,t2,t3,t4); - } - } - } - if (t2 == 0 && t1 <= 0) { - for(t3 = 1; t3 <= 65; t3++) { - for(t4 = t3; t4 <= 2*t3+1; t4++) { - s1(0,0,t3,t4); - } - } - } - if (t2 == 0) { - for(t3 = max(100*t1,66); t3 <= intDiv(200*t1+198,3); t3++) { - for(t4 = t3; t4 <= intDiv(t3+199,2); t4++) { - s1(t1,0,t3,t4); - } - } - } - if (2*t2 <= t1) { - for(t3 = max(100*t1,intDiv(200*t1+199+2,3)); t3 <= min(200*t2+199,intDiv(400*t1-200*t2+200,3),1000); t3++) { - for(t4 = t3; t4 <= intDiv(t3+200*t2+199,2); t4++) { - s1(t1,t2,t3,t4); - } - } - } - if (2*t2 == t1 && t2 <= 4) { - for(t3 = 200*t2+67; t3 <= 200*t2+99; t3++) { - for(t4 = t3; t4 <= -t3+400*t2+199; t4++) { - s1(t1,intDiv(t1,2),t3,t4); - } - } - } - } -} - - diff --git a/omega/examples/old_test/lefur03 b/omega/examples/old_test/lefur03 deleted file mode 100644 index c237eca..0000000 --- a/omega/examples/old_test/lefur03 +++ /dev/null @@ -1,16 +0,0 @@ -# From Fabien Coelho - -R := { [i,j,k,l,m,n] : - 0 <= i <= 3 && - 0 <= j <= 3 && - 0 <= k <= 3 && - 0 <= l <= 3 && - 1 <= m <= 1000 && - -1 <= 3 m - 1000 k <= 998 && - m <= n <= 2 m + 1 && - 0 <= m + n - 1000 i <= 999 && - 0 <= 2 n - m - 1000 j <= 999 && - 2 <= n + 2 m - 1000 l <= 1001 -} ; - -codegen R; diff --git a/omega/examples/old_test/lefur03-3 b/omega/examples/old_test/lefur03-3 deleted file mode 100644 index 1c576a1..0000000 --- a/omega/examples/old_test/lefur03-3 +++ /dev/null @@ -1,20 +0,0 @@ -# From Fabien Coelho - -R := { [i,j,k,l,m,n] : - 0 <= i <= 3 && - 0 <= j <= 3 && - 0 <= k <= 3 && - 0 <= l <= 3 && - 1 <= m <= 1000 && - -1 <= 3 m - 1000 k <= 998 && - m <= n <= 2 m + 1 && - 0 <= m + n - 1000 i <= 999 && - 0 <= 2 n - m - 1000 j <= 999 && - 2 <= n + 2 m - 1000 l <= 1001 -} ; - -codegen R; -codegen R; -codegen R; -codegen R; -codegen R; diff --git a/omega/examples/old_test/lefur03-3.oc-rt b/omega/examples/old_test/lefur03-3.oc-rt deleted file mode 100644 index a1aa81a..0000000 --- a/omega/examples/old_test/lefur03-3.oc-rt +++ /dev/null @@ -1,107 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# # From Fabien Coelho -# -# R := { [i,j,k,l,m,n] : -# 0 <= i <= 3 && -# 0 <= j <= 3 && -# 0 <= k <= 3 && -# 0 <= l <= 3 && -# 1 <= m <= 1000 && -# -1 <= 3 m - 1000 k <= 998 && -# m <= n <= 2 m + 1 && -# 0 <= m + n - 1000 i <= 999 && -# 0 <= 2 n - m - 1000 j <= 999 && -# 2 <= n + 2 m - 1000 l <= 1001 -# } ; -# -# -# codegen R; -for(t1 = 0; t1 <= 3; t1++) { - for(t2 = max(2*t1-3,0); t2 <= min(t1+1,3); t2++) { - for(t3 = t1; t3 <= min(2*t1-t2+1,3*t2+2,3); t3++) { - for(t4 = max(intDiv(t3+3*t1-3+2,3),intDiv(5*t3+3*t2-6+5,6),intDiv(4*t2-3+2,3),0); t4 <= min(intDiv(-t2+5*t1+4,3),intDiv(5*t3+3*t2+7,6),3); t4++) { - if (t1 <= t4+1) { - for(t5 = max(intDiv(1000*t3-1+2,3),250*t4+1,intDiv(-1000*t2+2000*t1-999+2,3),intDiv(1000*t2-2+2,3),-200*t2+400*t4-199); t5 <= min(intDiv(1000*t4+1001,3),-200*t2+400*t4+400,intDiv(1000*t3+998,3),500*t1+499,1000); t5++) { - for(t6 = max(t5,intDiv(t5+1000*t2+1,2),-2*t5+1000*t4+2,-t5+1000*t1); t6 <= min(-2*t5+1000*t4+1001,2*t5+1,intDiv(t5+1000*t2+999,2),-t5+1000*t1+999); t6++) { - s1(t1,t2,t3,t4,t5,t6); - } - } - } - } - } - } -} - -# -# codegen R; -for(t1 = 0; t1 <= 3; t1++) { - for(t2 = max(2*t1-3,0); t2 <= min(t1+1,3); t2++) { - for(t3 = t1; t3 <= min(2*t1-t2+1,3*t2+2,3); t3++) { - for(t4 = max(intDiv(t3+3*t1-3+2,3),intDiv(5*t3+3*t2-6+5,6),intDiv(4*t2-3+2,3),0); t4 <= min(intDiv(-t2+5*t1+4,3),intDiv(5*t3+3*t2+7,6),3); t4++) { - if (t1 <= t4+1) { - for(t5 = max(intDiv(1000*t3-1+2,3),250*t4+1,intDiv(-1000*t2+2000*t1-999+2,3),intDiv(1000*t2-2+2,3),-200*t2+400*t4-199); t5 <= min(intDiv(1000*t4+1001,3),-200*t2+400*t4+400,intDiv(1000*t3+998,3),500*t1+499,1000); t5++) { - for(t6 = max(t5,intDiv(t5+1000*t2+1,2),-2*t5+1000*t4+2,-t5+1000*t1); t6 <= min(-2*t5+1000*t4+1001,2*t5+1,intDiv(t5+1000*t2+999,2),-t5+1000*t1+999); t6++) { - s1(t1,t2,t3,t4,t5,t6); - } - } - } - } - } - } -} - -# -# codegen R; -for(t1 = 0; t1 <= 3; t1++) { - for(t2 = max(2*t1-3,0); t2 <= min(t1+1,3); t2++) { - for(t3 = t1; t3 <= min(2*t1-t2+1,3*t2+2,3); t3++) { - for(t4 = max(intDiv(t3+3*t1-3+2,3),intDiv(5*t3+3*t2-6+5,6),intDiv(4*t2-3+2,3),0); t4 <= min(intDiv(-t2+5*t1+4,3),intDiv(5*t3+3*t2+7,6),3); t4++) { - if (t1 <= t4+1) { - for(t5 = max(intDiv(1000*t3-1+2,3),250*t4+1,intDiv(-1000*t2+2000*t1-999+2,3),intDiv(1000*t2-2+2,3),-200*t2+400*t4-199); t5 <= min(intDiv(1000*t4+1001,3),-200*t2+400*t4+400,intDiv(1000*t3+998,3),500*t1+499,1000); t5++) { - for(t6 = max(t5,intDiv(t5+1000*t2+1,2),-2*t5+1000*t4+2,-t5+1000*t1); t6 <= min(-2*t5+1000*t4+1001,2*t5+1,intDiv(t5+1000*t2+999,2),-t5+1000*t1+999); t6++) { - s1(t1,t2,t3,t4,t5,t6); - } - } - } - } - } - } -} - -# -# codegen R; -for(t1 = 0; t1 <= 3; t1++) { - for(t2 = max(2*t1-3,0); t2 <= min(t1+1,3); t2++) { - for(t3 = t1; t3 <= min(2*t1-t2+1,3*t2+2,3); t3++) { - for(t4 = max(intDiv(t3+3*t1-3+2,3),intDiv(5*t3+3*t2-6+5,6),intDiv(4*t2-3+2,3),0); t4 <= min(intDiv(-t2+5*t1+4,3),intDiv(5*t3+3*t2+7,6),3); t4++) { - if (t1 <= t4+1) { - for(t5 = max(intDiv(1000*t3-1+2,3),250*t4+1,intDiv(-1000*t2+2000*t1-999+2,3),intDiv(1000*t2-2+2,3),-200*t2+400*t4-199); t5 <= min(intDiv(1000*t4+1001,3),-200*t2+400*t4+400,intDiv(1000*t3+998,3),500*t1+499,1000); t5++) { - for(t6 = max(t5,intDiv(t5+1000*t2+1,2),-2*t5+1000*t4+2,-t5+1000*t1); t6 <= min(-2*t5+1000*t4+1001,2*t5+1,intDiv(t5+1000*t2+999,2),-t5+1000*t1+999); t6++) { - s1(t1,t2,t3,t4,t5,t6); - } - } - } - } - } - } -} - -# -# codegen R; -for(t1 = 0; t1 <= 3; t1++) { - for(t2 = max(2*t1-3,0); t2 <= min(t1+1,3); t2++) { - for(t3 = t1; t3 <= min(2*t1-t2+1,3*t2+2,3); t3++) { - for(t4 = max(intDiv(t3+3*t1-3+2,3),intDiv(5*t3+3*t2-6+5,6),intDiv(4*t2-3+2,3),0); t4 <= min(intDiv(-t2+5*t1+4,3),intDiv(5*t3+3*t2+7,6),3); t4++) { - if (t1 <= t4+1) { - for(t5 = max(intDiv(1000*t3-1+2,3),250*t4+1,intDiv(-1000*t2+2000*t1-999+2,3),intDiv(1000*t2-2+2,3),-200*t2+400*t4-199); t5 <= min(intDiv(1000*t4+1001,3),-200*t2+400*t4+400,intDiv(1000*t3+998,3),500*t1+499,1000); t5++) { - for(t6 = max(t5,intDiv(t5+1000*t2+1,2),-2*t5+1000*t4+2,-t5+1000*t1); t6 <= min(-2*t5+1000*t4+1001,2*t5+1,intDiv(t5+1000*t2+999,2),-t5+1000*t1+999); t6++) { - s1(t1,t2,t3,t4,t5,t6); - } - } - } - } - } - } -} - -# diff --git a/omega/examples/old_test/lefur03.c b/omega/examples/old_test/lefur03.c deleted file mode 100644 index 7df0865..0000000 --- a/omega/examples/old_test/lefur03.c +++ /dev/null @@ -1,36 +0,0 @@ - -#include -#include "basic/util.h" - -template int max(int, int); -template int min(int, int); - -void Exit(int foo) { - exit(foo); - } - -int main() { - -int t1,t2,t3,t4,t5,t6; - - - - - -for(t1 = 0; t1 <= 3; t1++) { - for(t2 = max(2*t1-3,0); t2 <= min(t1+1,3); t2++) { - for(t3 = t1; t3 <= min(-t2+2*t1+1,3*t2+2,3); t3++) { - for(t4 = max(max(int_div(5*t3+3*t2-6+5,6),int_div(5*t1-t2-4+2,3)),max(t2,0)); t4 <= min(int_div(5*t3+3*t2+7,6),int_div(5*t1-t2+4,3),3); t4++) { - for(t5 = max(max(max(int_div(1000*t2-2+2,3),250*t4+1),max(int_div(2000*t1-1000*t2-999+2,3),400*t4-200*t2-199)),int_div(1000*t3-1+2,3)); - t5 <= min(min(min(400*t4-200*t2+400,500*t1+499),min(int_div(1000*t3+998,3),int_div(1000*t4+1001,3))),1000); t5++) { - for(t6 = max(max(int_div(t5+1000*t2+1,2),t5),max(1000*t1-t5,-2*t5+1000*t4+2)); t6 <= min(min(int_div(t5+1000*t2+999,2),2*t5+1),min(1000*t1-t5+999,-2*t5+1000*t4+1001)); t6++) { - printf("%d,%d,%d,%d,%d,%d\n", - t1,t2,t3,t4,t5,t6); - } - } - } - } - } - } -} - diff --git a/omega/examples/old_test/lefur03.oc-rt b/omega/examples/old_test/lefur03.oc-rt deleted file mode 100644 index 3fbb8cb..0000000 --- a/omega/examples/old_test/lefur03.oc-rt +++ /dev/null @@ -1,35 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# # From Fabien Coelho -# -# R := { [i,j,k,l,m,n] : -# 0 <= i <= 3 && -# 0 <= j <= 3 && -# 0 <= k <= 3 && -# 0 <= l <= 3 && -# 1 <= m <= 1000 && -# -1 <= 3 m - 1000 k <= 998 && -# m <= n <= 2 m + 1 && -# 0 <= m + n - 1000 i <= 999 && -# 0 <= 2 n - m - 1000 j <= 999 && -# 2 <= n + 2 m - 1000 l <= 1001 -# } ; -# -# -# codegen R; -for(t1 = 0; t1 <= 3; t1++) { - for(t2 = max(2*t1-3,0); t2 <= min(t1+1,3); t2++) { - for(t3 = t1; t3 <= min(2*t1-t2+1,3*t2+2,3); t3++) { - for(t4 = max(intDiv(t3+3*t1-3+2,3),intDiv(5*t3+3*t2-6+5,6),intDiv(4*t2-3+2,3),0); t4 <= min(intDiv(-t2+5*t1+4,3),intDiv(5*t3+3*t2+7,6),3); t4++) { - if (t1 <= t4+1) { - for(t5 = max(intDiv(1000*t3-1+2,3),250*t4+1,intDiv(-1000*t2+2000*t1-999+2,3),intDiv(1000*t2-2+2,3),-200*t2+400*t4-199); t5 <= min(intDiv(1000*t4+1001,3),-200*t2+400*t4+400,intDiv(1000*t3+998,3),500*t1+499,1000); t5++) { - for(t6 = max(t5,intDiv(t5+1000*t2+1,2),-2*t5+1000*t4+2,-t5+1000*t1); t6 <= min(-2*t5+1000*t4+1001,2*t5+1,intDiv(t5+1000*t2+999,2),-t5+1000*t1+999); t6++) { - s1(t1,t2,t3,t4,t5,t6); - } - } - } - } - } - } -} - -# diff --git a/omega/examples/old_test/lefur04 b/omega/examples/old_test/lefur04 deleted file mode 100644 index 4a9e0c4..0000000 --- a/omega/examples/old_test/lefur04 +++ /dev/null @@ -1,19 +0,0 @@ -# From Fabien Coelho - -R := { [i, j, k, l, m, n, o, p] : - 0 <= i <= 3 && - 0 <= j <= 3 && - 0 <= k <= 3 && - 0 <= l <= 3 && - 0 <= m <= 3 && - 0 <= n <= 3 && - 1 <= o <= 1000 && o <= p <= 2 o +1 && - 0 <= -1000 i + o + p <= 999 && - 0 <= -1000 j - o + 2p <= 999 && - -1 <= -1000 k + 3 o <= 998 && - 2 <= -1000 l + 2 o + p <= 1001 && - 0 <= -1000 m + o <= 999 && - 3 <= -1000 n + 2 p<= 1002 -} ; - -codegen R; diff --git a/omega/examples/old_test/lefur04.oc-rt b/omega/examples/old_test/lefur04.oc-rt deleted file mode 100644 index b449d8c..0000000 --- a/omega/examples/old_test/lefur04.oc-rt +++ /dev/null @@ -1,42 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# # From Fabien Coelho -# -# R := { [i, j, k, l, m, n, o, p] : -# 0 <= i <= 3 && -# 0 <= j <= 3 && -# 0 <= k <= 3 && -# 0 <= l <= 3 && -# 0 <= m <= 3 && -# 0 <= n <= 3 && -# 1 <= o <= 1000 && o <= p <= 2 o +1 && -# 0 <= -1000 i + o + p <= 999 && -# 0 <= -1000 j - o + 2p <= 999 && -# -1 <= -1000 k + 3 o <= 998 && -# 2 <= -1000 l + 2 o + p <= 1001 && -# 0 <= -1000 m + o <= 999 && -# 3 <= -1000 n + 2 p<= 1002 -# } ; -# -# -# codegen R; -for(t1 = 0; t1 <= 3; t1++) { - for(t2 = max(2*t1-3,0); t2 <= min(intDiv(3*t1+2,2),3); t2++) { - for(t3 = t1; t3 <= min(-t2+2*t1+1,intDiv(3*t1+2,2),3); t3++) { - for(t4 = max(intDiv(2*t3-2+2,3),intDiv(-t2+5*t1-4+2,3),intDiv(3*t2+5*t3-6+5,6),intDiv(4*t2-3+2,3)); t4 <= min(intDiv(t2+5,2),intDiv(4*t3+3,3),intDiv(-t2+5*t1+4,3),3); t4++) { - for(t5 = max(intDiv(t2-2+2,3),intDiv(t3-2+2,3)); t5 <= intDiv(t3,3); t5++) { - for(t6 = max(intDiv(6*t4-4*t3-6+2,3),intDiv(2*t3-3+2,3),2*t4-4,intDiv(4*t2-3+2,3),intDiv(t3+3*t2-3+2,3),0); t6 <= min(intDiv(6*t4-4*t3+5,3),t2+1,t4); t6++) { - if (t4 >= t1-1) { - for(t7 = max(intDiv(2000*t1-1000*t2-999+2,3),1000*t1-500*t6-501,250*t4+1,400*t4-200*t2-199,intDiv(1000*t3-1+2,3),intDiv(1000*t2-2+2,3)); t7 <= min(1000*t1-500*t6+997,intDiv(1000*t4+1001,3),400*t4-200*t2+400,500*t1+499,500*t6+501,intDiv(1000*t3+998,3),1000); t7++) { - for(t8 = max(1000*t1-t7,500*t6+2,1000*t4-2*t7+2,t7,intDiv(t7+1000*t2+1,2)); t8 <= min(1000*t1-t7+999,500*t6+501,1000*t4-2*t7+1001,2*t7+1,intDiv(t7+1000*t2+999,2)); t8++) { - s1(t1,t2,t3,t4,t5,t6,t7,t8); - } - } - } - } - } - } - } - } -} - -# diff --git a/omega/examples/old_test/lefur05 b/omega/examples/old_test/lefur05 deleted file mode 100644 index 436ac54..0000000 --- a/omega/examples/old_test/lefur05 +++ /dev/null @@ -1,49 +0,0 @@ -# From Fabien Coelho - -R := { [i, j, k, l, m, n, o, p] : - 0 <= i <= 3 && - 0 <= j <= 3 && - 0 <= k <= 3 && - 0 <= l <= 3 && - 0 <= m <= 3 && - 0 <= n <= 3 && - 1 <= o <= 1000 && o <= p <= 2 o +1 && - 0 <= -1000 i + o + p <= 999 && - 0 <= -1000 j - o + 2p <= 999 && - -1 <= -1000 k + 3 o <= 998 && - 2 <= -1000 l + 2 o + p <= 1001 && - 0 <= -1000 m + o <= 999 && - 3 <= -1000 n + 2 p<= 1002 -} ; - -R; - -R7 := { [i, j, k, l, m, n, o, p] - -> [i, j, k, l, m, n, o ]}(R); -R7; -approximate R7; -R6 := { [i, j, k, l, m, n, o] - -> [i, j, k, l, m, n ]}(R7); -R6; -approximate R6; -R5 := { [i, j, k, l, m, n] - -> [i, j, k, l, m ]}(R6); -R5; -approximate R5; -R4 := { [i, j, k, l, m] - -> [i, j, k, l ]}(R5); -R4; -approximate R4; -R3 := { [i, j, k, l] - -> [i, j, k ]}(R4); -R3; -approximate R3; -R2 := { [i, j, k] - -> [i, j ]}(R3); -R2; -approximate R2; -R1 := { [i, j] - -> [i]}(R2); -R1; -approximate R1; - diff --git a/omega/examples/old_test/lefur05.oc-rt b/omega/examples/old_test/lefur05.oc-rt deleted file mode 100644 index 6d5e45e..0000000 --- a/omega/examples/old_test/lefur05.oc-rt +++ /dev/null @@ -1,118 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# # From Fabien Coelho -# -# R := { [i, j, k, l, m, n, o, p] : -# 0 <= i <= 3 && -# 0 <= j <= 3 && -# 0 <= k <= 3 && -# 0 <= l <= 3 && -# 0 <= m <= 3 && -# 0 <= n <= 3 && -# 1 <= o <= 1000 && o <= p <= 2 o +1 && -# 0 <= -1000 i + o + p <= 999 && -# 0 <= -1000 j - o + 2p <= 999 && -# -1 <= -1000 k + 3 o <= 998 && -# 2 <= -1000 l + 2 o + p <= 1001 && -# 0 <= -1000 m + o <= 999 && -# 3 <= -1000 n + 2 p<= 1002 -# } ; -# -# -# R; - -{[i,j,k,l,m,n,o,p]: 1000m <= o <= p <= 500n+501, 2o+1 && o <= 1000m+999, 1000 && 1000i <= o+p && o+p <= 999+1000i && 1000j+o <= 2p && 2p <= 999+1000j+o && 1000k <= 1+3o && 3o <= 998+1000k && 2+500n <= p && 0 <= n && 2+1000l <= 2o+p && 2o+p <= 1001+1000l} - -# -# -# R7 := { [i, j, k, l, m, n, o, p] -# -> [i, j, k, l, m, n, o ]}(R); -# -# R7; - -{[i,j,k,l,m,n,o]: 1000m, 250n+1 <= o <= 1000m+999, 1000, 500n+501, 1000j+999, 500i+499 && 200j+o <= 400+400l && 1000j+o <= 1002+1000n && 1000i <= 1+3o && 1000j+3o <= 1998+2000i && 1000k <= 1+3o && 3o <= 998+1000k && 1000j <= 2+3o && 2000i <= 999+1000j+3o && 0 <= n && 1000i <= 501+500n+o && 250n+o <= 499+500l && 1000n <= 995+1000j+o && 500n+o <= 997+1000i && 3o <= 1001+1000l && 500l <= 249+250n+o && 400l <= 199+200j+o && 1000l <= 997+1000i+o} - -# -# approximate R7; - -{[i,j,k,l,m,n,o]: 1000m, 250n+1 <= o <= 1000m+999, 1000, 500n+501, 1000j+999, 500i+499 && 200j+o <= 400+400l && 1000j+o <= 1002+1000n && 1000i <= 1+3o && 1000j+3o <= 1998+2000i && 1000k <= 1+3o && 3o <= 998+1000k && 1000j <= 2+3o && 2000i <= 999+1000j+3o && 0 <= n && 1000i <= 501+500n+o && 250n+o <= 499+500l && 1000n <= 995+1000j+o && 500n+o <= 997+1000i && 3o <= 1001+1000l && 500l <= 249+250n+o && 400l <= 199+200j+o && 1000l <= 997+1000i+o} - -# -# R6 := { [i, j, k, l, m, n, o] -# -> [i, j, k, l, m, n ]}(R7); -# -# R6; - -{[i,j,k,l,m,n]: Exists ( alpha : 0, 2l-4 <= n <= 3, j+1, l, 2j+1 && 3m <= k <= 3, 3m+2 && 2i-3 <= j <= 3m+2 && 2k <= 2+3i && 1000i <= 1+3alpha && 1000j+3alpha <= 1998+2000i && 4j <= 3+3n && 1000k <= 1+3alpha && 3alpha <= 998+1000k && 1000j <= 2+3alpha && 2000i <= 999+1000j+3alpha && 4k+3n <= 5+6l && 6i <= 5+2l+3n && 3alpha <= 1001+1000l && 3j+5k <= 6+6l && 4l <= 7+2j+5n && 2l <= 2+3i && 2k <= 3+3n)} - -# -# approximate R6; - -{[i,j,k,l,m,n]: 2l-4, 0 <= n <= 3, j+1, l, 2j+1 && 3m, i <= k <= 3m+2, 3 && 2i-3 <= j <= 3m+2 && 2k <= 2+3i && j+k <= 1+2i && 4j <= 3+3n && 2l <= 2+3i && 2k <= 3+3n && 4l <= 7+2j+5n && 4k+3n <= 5+6l && 6i <= 5+2l+3n && 3j+5k <= 6+6l} - -# -# R5 := { [i, j, k, l, m, n] -# -> [i, j, k, l, m ]}(R6); -# -# R5; - -{[i,j,k,l,m]: Exists ( alpha,beta : 2i-3, 0 <= j <= 3m+2 && 3m <= k <= 3, 3m+2 && l <= 3 && 2k <= 2+3i && 2k <= 3+3alpha && 1000i <= 1+3beta && 1000j+3beta <= 1998+2000i && 4j <= 3+3alpha && 1000k <= 1+3beta && 3beta <= 998+1000k && 1000j <= 2+3beta && 2000i <= 999+1000j+3beta && 4k+3alpha <= 5+6l && 6i <= 5+2l+3alpha && 6i <= 5+5l && 3beta <= 1001+1000l && 4j <= 3+3l && 2k <= 2+3l && 3j+5k <= 6+6l && 4l <= 7+2j+5alpha && 2l <= 2+3i)} - -# -# approximate R5; - -{[i,j,k,l,m]: i, 3m <= k <= 3m+2, 3 && 0, 2i-3 <= j <= 3m+2 && l <= 3 && 2k <= 2+3i && 2l <= 2+3i && 2k <= 2+3l && j+k <= 1+2i && 3j+5k <= 6+6l && 6i <= 5+5l && 4j <= 3+3l} - -# -# R4 := { [i, j, k, l, m] -# -> [i, j, k, l ]}(R5); -# -# R4; - -{[i,j,k,l]: Exists ( alpha,beta,gamma : 2i-3, 0 <= j <= 3alpha+2 && 3alpha <= k <= 3, 3alpha+2 && l <= 3 && 2k <= 2+3i && 2k <= 3+3beta && 1000i <= 1+3gamma && 1000j+3gamma <= 1998+2000i && 4j <= 3+3beta && 1000k <= 1+3gamma && 3gamma <= 998+1000k && 1000j <= 2+3gamma && 2000i <= 999+1000j+3gamma && 4k+3beta <= 5+6l && 6i <= 5+2l+3beta && 6i <= 5+5l && 3gamma <= 1001+1000l && 4j <= 3+3l && 2k <= 2+3l && 3j+5k <= 6+6l && 4l <= 7+2j+5beta && 2l <= 2+3i)} - -# -# approximate R4; - -{[i,j,k,l]: i <= k <= 3 && l <= 3 && 2k <= 2+3i && 2l <= 2+3i && 6i <= 5+5l && j+k <= 1+2i && 3j+5k <= 6+6l && 4j <= 3+3l && 2i <= 3+j && 2k <= 2+3l && 0 <= j} - -# -# R3 := { [i, j, k, l] -# -> [i, j, k ]}(R4); -# -# R3; - -{[i,j,k]: Exists ( alpha,beta,gamma,delta : 2i-3, 0 <= j <= 3beta+2 && 3beta <= k <= 3, 3beta+2 && alpha <= 3 && 2k <= 2+3i && 2k <= 3+3gamma && 1000i <= 1+3delta && 1000j+3delta <= 1998+2000i && 4j <= 3+3gamma && 1000k <= 1+3delta && 3delta <= 998+1000k && 1000j <= 2+3delta && 2000i <= 999+1000j+3delta && 4k+3gamma <= 5+6alpha && 6i <= 5+2alpha+3gamma && 6i <= 5+5alpha && 3delta <= 1001+1000alpha && 4j <= 3+3alpha && 2k <= 2+3alpha && 3j+5k <= 6+6alpha && 4alpha <= 7+2j+5gamma && 2alpha <= 2+3i)} - -# -# approximate R3; - -{[i,j,k]: 0, 2i-3 <= j <= 3 && i <= k <= 3 && 2k <= 2+3i && j+k <= 1+2i} - -# -# R2 := { [i, j, k] -# -> [i, j ]}(R3); -# -# R2; - -{[i,j]: Exists ( alpha,beta,gamma,delta,tau : 2i-3, 0 <= j <= 3tau+2 && 3tau <= alpha <= 3, 3tau+2 && delta <= 3 && 2alpha <= 2+3i && 2alpha <= 3+3beta && 1000i <= 1+3gamma && 1000j+3gamma <= 1998+2000i && 4j <= 3+3beta && 1000alpha <= 1+3gamma && 3gamma <= 998+1000alpha && 1000j <= 2+3gamma && 2000i <= 999+1000j+3gamma && 4alpha+3beta <= 5+6delta && 6i <= 5+3beta+2delta && 6i <= 5+5delta && 3gamma <= 1001+1000delta && 4j <= 3+3delta && 2alpha <= 2+3delta && 3j+5alpha <= 6+6delta && 4delta <= 7+2j+5beta && 2delta <= 2+3i)} - -# -# approximate R2; - -{[i,j]: 0, 2i-3 <= j <= i+1, 3} - -# -# R1 := { [i, j] -# -> [i]}(R2); -# -# R1; - -{[i]: Exists ( alpha,beta,gamma,delta,tau,sigma : 2i-3, 0 <= alpha <= 3beta+2 && 3beta <= gamma <= 3, 3beta+2 && sigma <= 3 && 2gamma <= 2+3i && 2gamma <= 3+3delta && 1000i <= 1+3tau && 1000alpha+3tau <= 1998+2000i && 4alpha <= 3+3delta && 1000gamma <= 1+3tau && 3tau <= 998+1000gamma && 1000alpha <= 2+3tau && 2000i <= 999+1000alpha+3tau && 4gamma+3delta <= 5+6sigma && 6i <= 5+3delta+2sigma && 6i <= 5+5sigma && 3tau <= 1001+1000sigma && 4alpha <= 3+3sigma && 2gamma <= 2+3sigma && 3alpha+5gamma <= 6+6sigma && 4sigma <= 7+2alpha+5delta && 2sigma <= 2+3i)} - -# -# approximate R1; - -{[i]: -1 <= i <= 3} - -# -# diff --git a/omega/examples/old_test/lift1 b/omega/examples/old_test/lift1 deleted file mode 100644 index fb3ada1..0000000 --- a/omega/examples/old_test/lift1 +++ /dev/null @@ -1,16 +0,0 @@ -I1 := { [i,j,k,l,m] : 1 <= i <= 60 && 1 <= j,k,l,m <= 100 }; -I2 := { [i,j,k,l,m] : 1 <= i,j,k,l,m <= 100 }; - -codegen 0 I1,I2; - -#default -codegen 1 I1,I2; - -codegen 2 I1,I2; - -codegen 3 I1,I2; - -codegen 4 I1,I2; - -codegen 5 I1,I2; - diff --git a/omega/examples/old_test/lift1.oc-rt b/omega/examples/old_test/lift1.oc-rt deleted file mode 100644 index 683ac07..0000000 --- a/omega/examples/old_test/lift1.oc-rt +++ /dev/null @@ -1,147 +0,0 @@ ->>> I1 := { [i,j,k,l,m] : 1 <= i <= 60 && 1 <= j,k,l,m <= 100 }; ->>> I2 := { [i,j,k,l,m] : 1 <= i,j,k,l,m <= 100 }; ->>> ->>> codegen 0 I1,I2; -for(t1 = 1; t1 <= 100; t1++) { - for(t2 = 1; t2 <= 100; t2++) { - for(t3 = 1; t3 <= 100; t3++) { - for(t4 = 1; t4 <= 100; t4++) { - for(t5 = 1; t5 <= 100; t5++) { - s2(t1,t2,t3,t4,t5); - if (t1 <= 60) { - s1(t1,t2,t3,t4,t5); - } - } - } - } - } -} - ->>> ->>> #default ->>> codegen 1 I1,I2; -for(t1 = 1; t1 <= 100; t1++) { - for(t2 = 1; t2 <= 100; t2++) { - for(t3 = 1; t3 <= 100; t3++) { - for(t4 = 1; t4 <= 100; t4++) { - if (t1 <= 60) { - for(t5 = 1; t5 <= 100; t5++) { - s1(t1,t2,t3,t4,t5); - s2(t1,t2,t3,t4,t5); - } - } - if (t1 >= 61) { - for(t5 = 1; t5 <= 100; t5++) { - s2(t1,t2,t3,t4,t5); - } - } - } - } - } -} - ->>> ->>> codegen 2 I1,I2; -for(t1 = 1; t1 <= 100; t1++) { - for(t2 = 1; t2 <= 100; t2++) { - for(t3 = 1; t3 <= 100; t3++) { - if (t1 <= 60) { - for(t4 = 1; t4 <= 100; t4++) { - for(t5 = 1; t5 <= 100; t5++) { - s1(t1,t2,t3,t4,t5); - s2(t1,t2,t3,t4,t5); - } - } - } - if (t1 >= 61) { - for(t4 = 1; t4 <= 100; t4++) { - for(t5 = 1; t5 <= 100; t5++) { - s2(t1,t2,t3,t4,t5); - } - } - } - } - } -} - ->>> ->>> codegen 3 I1,I2; -for(t1 = 1; t1 <= 100; t1++) { - for(t2 = 1; t2 <= 100; t2++) { - if (t1 <= 60) { - for(t3 = 1; t3 <= 100; t3++) { - for(t4 = 1; t4 <= 100; t4++) { - for(t5 = 1; t5 <= 100; t5++) { - s1(t1,t2,t3,t4,t5); - s2(t1,t2,t3,t4,t5); - } - } - } - } - if (t1 >= 61) { - for(t3 = 1; t3 <= 100; t3++) { - for(t4 = 1; t4 <= 100; t4++) { - for(t5 = 1; t5 <= 100; t5++) { - s2(t1,t2,t3,t4,t5); - } - } - } - } - } -} - ->>> ->>> codegen 4 I1,I2; -for(t1 = 1; t1 <= 100; t1++) { - if (t1 <= 60) { - for(t2 = 1; t2 <= 100; t2++) { - for(t3 = 1; t3 <= 100; t3++) { - for(t4 = 1; t4 <= 100; t4++) { - for(t5 = 1; t5 <= 100; t5++) { - s1(t1,t2,t3,t4,t5); - s2(t1,t2,t3,t4,t5); - } - } - } - } - } - if (t1 >= 61) { - for(t2 = 1; t2 <= 100; t2++) { - for(t3 = 1; t3 <= 100; t3++) { - for(t4 = 1; t4 <= 100; t4++) { - for(t5 = 1; t5 <= 100; t5++) { - s2(t1,t2,t3,t4,t5); - } - } - } - } - } -} - ->>> ->>> codegen 5 I1,I2; -for(t1 = 1; t1 <= 60; t1++) { - for(t2 = 1; t2 <= 100; t2++) { - for(t3 = 1; t3 <= 100; t3++) { - for(t4 = 1; t4 <= 100; t4++) { - for(t5 = 1; t5 <= 100; t5++) { - s1(t1,t2,t3,t4,t5); - s2(t1,t2,t3,t4,t5); - } - } - } - } -} -for(t1 = 61; t1 <= 100; t1++) { - for(t2 = 1; t2 <= 100; t2++) { - for(t3 = 1; t3 <= 100; t3++) { - for(t4 = 1; t4 <= 100; t4++) { - for(t5 = 1; t5 <= 100; t5++) { - s2(t1,t2,t3,t4,t5); - } - } - } - } -} - - diff --git a/omega/examples/old_test/lift2 b/omega/examples/old_test/lift2 deleted file mode 100644 index fada83e..0000000 --- a/omega/examples/old_test/lift2 +++ /dev/null @@ -1,16 +0,0 @@ -I1 := { [i,j,k,l,m] : 5 <= i <= 60 && 1 <= j,k,l,m <= 100 }; -I2 := { [i,j,k,l,m] : 1 <= i,j,k,l,m <= 100 }; - -codegen 0 I1,I2; - -#default -codegen 1 I1,I2; - -codegen 2 I1,I2; - -codegen 3 I1,I2; - -codegen 4 I1,I2; - -codegen 5 I1,I2; - diff --git a/omega/examples/old_test/lift2.oc-rt b/omega/examples/old_test/lift2.oc-rt deleted file mode 100644 index 41e1fa8..0000000 --- a/omega/examples/old_test/lift2.oc-rt +++ /dev/null @@ -1,190 +0,0 @@ ->>> I1 := { [i,j,k,l,m] : 5 <= i <= 60 && 1 <= j,k,l,m <= 100 }; ->>> I2 := { [i,j,k,l,m] : 1 <= i,j,k,l,m <= 100 }; ->>> ->>> codegen 0 I1,I2; -for(t1 = 1; t1 <= 100; t1++) { - for(t2 = 1; t2 <= 100; t2++) { - for(t3 = 1; t3 <= 100; t3++) { - for(t4 = 1; t4 <= 100; t4++) { - for(t5 = 1; t5 <= 100; t5++) { - s2(t1,t2,t3,t4,t5); - if (t1 >= 5 && t1 <= 60) { - s1(t1,t2,t3,t4,t5); - } - } - } - } - } -} - ->>> ->>> #default ->>> codegen 1 I1,I2; -for(t1 = 1; t1 <= 100; t1++) { - for(t2 = 1; t2 <= 100; t2++) { - for(t3 = 1; t3 <= 100; t3++) { - for(t4 = 1; t4 <= 100; t4++) { - if (t1 <= 4) { - for(t5 = 1; t5 <= 100; t5++) { - s2(t1,t2,t3,t4,t5); - } - } - if (t1 >= 5 && t1 <= 60) { - for(t5 = 1; t5 <= 100; t5++) { - s1(t1,t2,t3,t4,t5); - s2(t1,t2,t3,t4,t5); - } - } - if (t1 >= 61) { - for(t5 = 1; t5 <= 100; t5++) { - s2(t1,t2,t3,t4,t5); - } - } - } - } - } -} - ->>> ->>> codegen 2 I1,I2; -for(t1 = 1; t1 <= 100; t1++) { - for(t2 = 1; t2 <= 100; t2++) { - for(t3 = 1; t3 <= 100; t3++) { - if (t1 <= 4) { - for(t4 = 1; t4 <= 100; t4++) { - for(t5 = 1; t5 <= 100; t5++) { - s2(t1,t2,t3,t4,t5); - } - } - } - if (t1 >= 5 && t1 <= 60) { - for(t4 = 1; t4 <= 100; t4++) { - for(t5 = 1; t5 <= 100; t5++) { - s1(t1,t2,t3,t4,t5); - s2(t1,t2,t3,t4,t5); - } - } - } - if (t1 >= 61) { - for(t4 = 1; t4 <= 100; t4++) { - for(t5 = 1; t5 <= 100; t5++) { - s2(t1,t2,t3,t4,t5); - } - } - } - } - } -} - ->>> ->>> codegen 3 I1,I2; -for(t1 = 1; t1 <= 100; t1++) { - for(t2 = 1; t2 <= 100; t2++) { - if (t1 <= 4) { - for(t3 = 1; t3 <= 100; t3++) { - for(t4 = 1; t4 <= 100; t4++) { - for(t5 = 1; t5 <= 100; t5++) { - s2(t1,t2,t3,t4,t5); - } - } - } - } - if (t1 >= 5 && t1 <= 60) { - for(t3 = 1; t3 <= 100; t3++) { - for(t4 = 1; t4 <= 100; t4++) { - for(t5 = 1; t5 <= 100; t5++) { - s1(t1,t2,t3,t4,t5); - s2(t1,t2,t3,t4,t5); - } - } - } - } - if (t1 >= 61) { - for(t3 = 1; t3 <= 100; t3++) { - for(t4 = 1; t4 <= 100; t4++) { - for(t5 = 1; t5 <= 100; t5++) { - s2(t1,t2,t3,t4,t5); - } - } - } - } - } -} - ->>> ->>> codegen 4 I1,I2; -for(t1 = 1; t1 <= 100; t1++) { - if (t1 <= 4) { - for(t2 = 1; t2 <= 100; t2++) { - for(t3 = 1; t3 <= 100; t3++) { - for(t4 = 1; t4 <= 100; t4++) { - for(t5 = 1; t5 <= 100; t5++) { - s2(t1,t2,t3,t4,t5); - } - } - } - } - } - if (t1 >= 5 && t1 <= 60) { - for(t2 = 1; t2 <= 100; t2++) { - for(t3 = 1; t3 <= 100; t3++) { - for(t4 = 1; t4 <= 100; t4++) { - for(t5 = 1; t5 <= 100; t5++) { - s1(t1,t2,t3,t4,t5); - s2(t1,t2,t3,t4,t5); - } - } - } - } - } - if (t1 >= 61) { - for(t2 = 1; t2 <= 100; t2++) { - for(t3 = 1; t3 <= 100; t3++) { - for(t4 = 1; t4 <= 100; t4++) { - for(t5 = 1; t5 <= 100; t5++) { - s2(t1,t2,t3,t4,t5); - } - } - } - } - } -} - ->>> ->>> codegen 5 I1,I2; -for(t1 = 1; t1 <= 4; t1++) { - for(t2 = 1; t2 <= 100; t2++) { - for(t3 = 1; t3 <= 100; t3++) { - for(t4 = 1; t4 <= 100; t4++) { - for(t5 = 1; t5 <= 100; t5++) { - s2(t1,t2,t3,t4,t5); - } - } - } - } -} -for(t1 = 5; t1 <= 60; t1++) { - for(t2 = 1; t2 <= 100; t2++) { - for(t3 = 1; t3 <= 100; t3++) { - for(t4 = 1; t4 <= 100; t4++) { - for(t5 = 1; t5 <= 100; t5++) { - s1(t1,t2,t3,t4,t5); - s2(t1,t2,t3,t4,t5); - } - } - } - } -} -for(t1 = 61; t1 <= 100; t1++) { - for(t2 = 1; t2 <= 100; t2++) { - for(t3 = 1; t3 <= 100; t3++) { - for(t4 = 1; t4 <= 100; t4++) { - for(t5 = 1; t5 <= 100; t5++) { - s2(t1,t2,t3,t4,t5); - } - } - } - } -} - - diff --git a/omega/examples/old_test/long_input b/omega/examples/old_test/long_input deleted file mode 100644 index 6112756..0000000 --- a/omega/examples/old_test/long_input +++ /dev/null @@ -1,2 +0,0 @@ -{ [i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c] -> [j] : 1 <= i < j <= 20 }; -{ [j] -> [i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v] : 1 <= i < j <= 20 }; diff --git a/omega/examples/old_test/long_input.oc-rt b/omega/examples/old_test/long_input.oc-rt deleted file mode 100644 index 281d321..0000000 --- a/omega/examples/old_test/long_input.oc-rt +++ /dev/null @@ -1,11 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# { [i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c] -> [j] : 1 <= i < j <= 20 }; - -{[i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c] -> [j] : 1 <= i < j <= 20} - -# -# { [j] -> [i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v] : 1 <= i < j <= 20 }; - -{[j] -> [i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v] : 1 <= i < j <= 20} - -# diff --git a/omega/examples/old_test/lu_ijk b/omega/examples/old_test/lu_ijk deleted file mode 100644 index 5f60bfa..0000000 --- a/omega/examples/old_test/lu_ijk +++ /dev/null @@ -1,17 +0,0 @@ -symbolic n,lb,ub; -I5 := {[k,j] : 1 <= k < j <= n}; -I7 := {[k,j,i] : 1 <= k < j,i <= n}; -T5 := {[k,j] -> [k,j,1,0]}; -T7 := {[k,j,i] -> [i,j,0,k]}; -D57 := {[k,j] -> [k,j,i] : 1 <= k < j,i <= n}; -D75 := {[k,j,k+1] -> [k+1,j] : 1 <= k <= j-2 && j <= n} union - {[k,k+1,k+1] -> [k+1,j'] : 1 <= k <= j'-2 && j' <= n}; -D77 := {[k,j,i] -> [k+1,j,i] : 1 <= k <= i-2, j-2 && j <= n && i <= n} - union - {[k,k+1,i] -> [k+1,j',i] : 1 <= k <= i-2, j'-2 && j' <= n && i <= n}; -difference ( (inverse T5) join D57 join T7 ); -difference ( (inverse T7) join D75 join T5 ); -difference ( (inverse T7) join D77 join T7 ); -codegen T5:I5,T7:I7; -codegen 2 T5:I5,T7:I7; -codegen 3 T5:I5,T7:I7; diff --git a/omega/examples/old_test/lu_ijk.oc-rt b/omega/examples/old_test/lu_ijk.oc-rt deleted file mode 100644 index d067dff..0000000 --- a/omega/examples/old_test/lu_ijk.oc-rt +++ /dev/null @@ -1,81 +0,0 @@ ->>> symbolic n,lb,ub; ->>> I5 := {[k,j] : 1 <= k < j <= n}; ->>> I7 := {[k,j,i] : 1 <= k < j,i <= n}; ->>> T5 := {[k,j] -> [k,j,1,0]}; ->>> T7 := {[k,j,i] -> [i,j,0,k]}; ->>> D57 := {[k,j] -> [k,j,i] : 1 <= k < j,i <= n}; ->>> D75 := {[k,j,k+1] -> [k+1,j] : 1 <= k <= j-2 && j <= n} union ->>> {[k,k+1,k+1] -> [k+1,j'] : 1 <= k <= j'-2 && j' <= n}; ->>> D77 := {[k,j,i] -> [k+1,j,i] : 1 <= k <= i-2, j-2 && j <= n && i <= n} ->>> union ->>> {[k,k+1,i] -> [k+1,j',i] : 1 <= k <= i-2, j'-2 && j' <= n && i <= n}; ->>> difference ( (inverse T5) join D57 join T7 ); -{[In_1,0,-1,In_4]: 1 <= In_4 && In_1+In_4 <= n && 1 <= In_1} ->>> difference ( (inverse T7) join D75 join T5 ); -{[0,0,1,In_4]: -n+2 <= In_4 <= -1} union - {[0,In_2,1,In_4]: In_4 <= -1 && 1 <= In_2 && In_2 < n+In_4} ->>> difference ( (inverse T7) join D77 join T7 ); -{[0,0,0,1]: 3 <= n} union - {[0,In_2,0,1]: 1 <= In_2 <= n-2} ->>> codegen T5:I5,T7:I7; -if (n >= 2) { - for(t1 = 1; t1 <= n; t1++) { - for(t2 = 2; t2 <= n; t2++) { - for(t4 = 1; t4 <= min(t2-1,t1-1); t4++) { - s2(t4,t2,t1); - } - if (t1 <= t2-1) { - s1(t1,t2); - } - } - } -} - ->>> codegen 2 T5:I5,T7:I7; -if (n >= 2) { - for(t1 = 1; t1 <= n; t1++) { - if (t1 <= 1) { - for(t2 = 2; t2 <= n; t2++) { - s1(1,t2); - } - } - for(t2 = 2; t2 <= t1; t2++) { - for(t4 = 1; t4 <= t2-1; t4++) { - s2(t4,t2,t1); - } - } - if (t1 >= 2) { - for(t2 = t1+1; t2 <= n; t2++) { - for(t4 = 1; t4 <= t1-1; t4++) { - s2(t4,t2,t1); - } - s1(t1,t2); - } - } - } -} - ->>> codegen 3 T5:I5,T7:I7; -for(t2 = 2; t2 <= n; t2++) { - s1(1,t2); -} -for(t1 = 2; t1 <= n-1; t1++) { - for(t2 = 2; t2 <= t1; t2++) { - for(t4 = 1; t4 <= t2-1; t4++) { - s2(t4,t2,t1); - } - } - for(t2 = t1+1; t2 <= n; t2++) { - for(t4 = 1; t4 <= t1-1; t4++) { - s2(t4,t2,t1); - } - s1(t1,t2); - } -} -for(t2 = 2; t2 <= n; t2++) { - for(t4 = 1; t4 <= t2-1; t4++) { - s2(t4,t2,n); - } -} - - diff --git a/omega/examples/old_test/lu_spmd b/omega/examples/old_test/lu_spmd deleted file mode 100644 index 6587ef0..0000000 --- a/omega/examples/old_test/lu_spmd +++ /dev/null @@ -1,19 +0,0 @@ -symbolic n,lb,ub; -I1 := {[k,i] : 1 <= k < i <= n && lb <= k <= ub}; -I2 := {[k,i,j] : 1 <= k <= i,j <= n && lb <= j <= ub}; -p := {[k,i] : 1, lb <= k <= ub < n && k < i <= n}; -w := {[k,i,j,k,i] : 1 <= k <= i,j <= n && k < lb = j <= ub}; - -T1 := {[k,i] -> [k,i,0,0,0,0,0,0]}; -T2 := {[k,i,j] -> [k,i,1,j,0,0,0,0]}; -Tp := {[k,i] -> [k,i,0,0,1,0,0,0]}; -Tw := {[k,i,j,t1,t2] -> [k,i,1,j,-1,t1,t2,0]}; - -known := {[*,*,*,*,*,*,*,*] : 1 <= lb && ub <= n}; -known2 := {[*,*,*,*,*,*,*,*] : 1 <= lb <= ub <= n}; - -codegen 0 T1:I1,T2:I2,Tp:p,Tw:w given known; -codegen 1 T1:I1,T2:I2,Tp:p,Tw:w given known; -# codegen 2 T1:I1,T2:I2,Tp:p,Tw:w given known; -# codegen 1 T1:I1,T2:I2,Tp:p,Tw:w given known2; -# codegen 2 T1:I1,T2:I2,Tp:p,Tw:w given known2; diff --git a/omega/examples/old_test/lu_spmd.oc-rt b/omega/examples/old_test/lu_spmd.oc-rt deleted file mode 100644 index f221d8e..0000000 --- a/omega/examples/old_test/lu_spmd.oc-rt +++ /dev/null @@ -1,58 +0,0 @@ ->>> symbolic n,lb,ub; ->>> I1 := {[k,i] : 1 <= k < i <= n && lb <= k <= ub}; ->>> I2 := {[k,i,j] : 1 <= k <= i,j <= n && lb <= j <= ub}; ->>> p := {[k,i] : 1, lb <= k <= ub < n && k < i <= n}; ->>> w := {[k,i,j,k,i] : 1 <= k <= i,j <= n && k < lb = j <= ub}; ->>> ->>> T1 := {[k,i] -> [k,i,0,0,0,0,0,0]}; ->>> T2 := {[k,i,j] -> [k,i,1,j,0,0,0,0]}; ->>> Tp := {[k,i] -> [k,i,0,0,1,0,0,0]}; ->>> Tw := {[k,i,j,t1,t2] -> [k,i,1,j,-1,t1,t2,0]}; ->>> ->>> known := {[*,*,*,*,*,*,*,*] : 1 <= lb && ub <= n}; ->>> known2 := {[*,*,*,*,*,*,*,*] : 1 <= lb <= ub <= n}; ->>> ->>> codegen 0 T1:I1,T2:I2,Tp:p,Tw:w given known; -if (lb <= ub) { - for(t1 = 1; t1 <= ub; t1++) { - for(t2 = t1; t2 <= n; t2++) { - if (t1 >= lb && t2 >= t1+1) { - s1(t1,t2); - } - if (ub <= n-1 && t2 >= t1+1 && t1 >= lb) { - s3(t1,t2); - } - for(t4 = max(lb,t1); t4 <= ub; t4++) { - if (t4 >= t1+1 && t4 <= lb) { - s4(t1,t2,t4,t1,t2); - } - s2(t1,t2,t4); - } - } - } -} - ->>> codegen 1 T1:I1,T2:I2,Tp:p,Tw:w given known; -if (lb <= ub) { - for(t1 = 1; t1 <= ub; t1++) { - for(t2 = t1; t2 <= n; t2++) { - if (t1 >= lb && t2 >= t1+1) { - s1(t1,t2); - } - if (ub <= n-1 && t2 >= t1+1 && t1 >= lb) { - s3(t1,t2); - } - for(t4 = max(lb,t1); t4 <= ub; t4++) { - if (t4 >= t1+1 && t4 <= lb) { - s4(t1,t2,t4,t1,t2); - } - s2(t1,t2,t4); - } - } - } -} - ->>> # codegen 2 T1:I1,T2:I2,Tp:p,Tw:w given known; ->>> # codegen 1 T1:I1,T2:I2,Tp:p,Tw:w given known2; ->>> # codegen 2 T1:I1,T2:I2,Tp:p,Tw:w given known2; - diff --git a/omega/examples/old_test/m1 b/omega/examples/old_test/m1 deleted file mode 100644 index 1ff50d1..0000000 --- a/omega/examples/old_test/m1 +++ /dev/null @@ -1,6 +0,0 @@ -T1:={[i,j]->[i,j,0]}; -T2:={[i,j]->[i,j,1]}; -R1:={[1:9,1:9]}; -R2:={[5,1:9]}; -codegen T1:R1,T2:R2; -codegen 2 T1:R1,T2:R2; diff --git a/omega/examples/old_test/m1.oc-rt b/omega/examples/old_test/m1.oc-rt deleted file mode 100644 index ad2c49c..0000000 --- a/omega/examples/old_test/m1.oc-rt +++ /dev/null @@ -1,41 +0,0 @@ ->>> T1:={[i,j]->[i,j,0]}; ->>> T2:={[i,j]->[i,j,1]}; ->>> R1:={[1:9,1:9]}; ->>> R2:={[5,1:9]}; ->>> codegen T1:R1,T2:R2; -for(t1 = 1; t1 <= 9; t1++) { - if (t1 <= 4) { - for(t2 = 1; t2 <= 9; t2++) { - s1(t1,t2); - } - } - if (t1 == 5) { - for(t2 = 1; t2 <= 9; t2++) { - s1(5,t2); - s2(5,t2); - } - } - if (t1 >= 6) { - for(t2 = 1; t2 <= 9; t2++) { - s1(t1,t2); - } - } -} - ->>> codegen 2 T1:R1,T2:R2; -for(t1 = 1; t1 <= 4; t1++) { - for(t2 = 1; t2 <= 9; t2++) { - s1(t1,t2); - } -} -for(t2 = 1; t2 <= 9; t2++) { - s1(5,t2); - s2(5,t2); -} -for(t1 = 6; t1 <= 9; t1++) { - for(t2 = 1; t2 <= 9; t2++) { - s1(t1,t2); - } -} - - diff --git a/omega/examples/old_test/m10 b/omega/examples/old_test/m10 deleted file mode 100644 index 01fa540..0000000 --- a/omega/examples/old_test/m10 +++ /dev/null @@ -1,5 +0,0 @@ -IS:={[i,j]: 1 <= i,j <= 9}; -T1:={[i,j]->[4j,i,0]}; -T2:={[i,j]->[2j,i,1]}; -codegen T1:IS,T2:IS; -codegen 2 T1:IS,T2:IS; diff --git a/omega/examples/old_test/m10.oc-rt b/omega/examples/old_test/m10.oc-rt deleted file mode 100644 index c782e1d..0000000 --- a/omega/examples/old_test/m10.oc-rt +++ /dev/null @@ -1,47 +0,0 @@ ->>> IS:={[i,j]: 1 <= i,j <= 9}; ->>> T1:={[i,j]->[4j,i,0]}; ->>> T2:={[i,j]->[2j,i,1]}; ->>> codegen T1:IS,T2:IS; -for(t1 = 2; t1 <= 36; t1 += 2) { - if (intMod(t1,4) == 0 && t1 <= 16) { - for(t2 = 1; t2 <= 9; t2++) { - s1(t2,intDiv(t1,4)); - s2(t2,intDiv(t1,2)); - } - } - if (intMod(t1,4) == 0 && t1 >= 20) { - for(t2 = 1; t2 <= 9; t2++) { - s1(t2,intDiv(t1,4)); - } - } - if (intMod(t1-2,4) == 0 && t1 <= 18) { - for(t2 = 1; t2 <= 9; t2++) { - s2(t2,intDiv(t1,2)); - } - } -} - ->>> codegen 2 T1:IS,T2:IS; -for(t1 = 2; t1 <= 16; t1 += 2) { - if (intMod(t1,4) == 0) { - for(t2 = 1; t2 <= 9; t2++) { - s1(t2,intDiv(t1,4)); - s2(t2,intDiv(t1,2)); - } - } - if (intMod(t1-2,4) == 0) { - for(t2 = 1; t2 <= 9; t2++) { - s2(t2,intDiv(t1,2)); - } - } -} -for(t2 = 1; t2 <= 9; t2++) { - s2(t2,9); -} -for(t1 = 20; t1 <= 36; t1 += 4) { - for(t2 = 1; t2 <= 9; t2++) { - s1(t2,intDiv(t1,4)); - } -} - - diff --git a/omega/examples/old_test/m11 b/omega/examples/old_test/m11 deleted file mode 100644 index 1367ff8..0000000 --- a/omega/examples/old_test/m11 +++ /dev/null @@ -1,10 +0,0 @@ -symbolic m; -I := {[p1,p2,c2,a1,a2,b1,b2] : - 1 <= p1 <= 4 && 1 <= p2 <= 2 && 17p1<=16+2m - && 1<=2c2+p2 <= 6 - && 0 <= 10c2+5p2-a2 <= 4 - && 0 <= 17p1-2a1 <= 16 && a1 <= 30 && a2-m+a1 <= 1 - && 17 <= 2b1-2a1+17p1 <= 18 - && b2 = 5 + a2-5p2-5c2}; -I; -codegen I; diff --git a/omega/examples/old_test/m11.oc-rt b/omega/examples/old_test/m11.oc-rt deleted file mode 100644 index 4218a2e..0000000 --- a/omega/examples/old_test/m11.oc-rt +++ /dev/null @@ -1,32 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic m; -# -# I := {[p1,p2,c2,a1,a2,b1,b2] : -# 1 <= p1 <= 4 && 1 <= p2 <= 2 && 17p1<=16+2m -# && 1<=2c2+p2 <= 6 -# && 0 <= 10c2+5p2-a2 <= 4 -# && 0 <= 17p1-2a1 <= 16 && a1 <= 30 && a2-m+a1 <= 1 -# && 17 <= 2b1-2a1+17p1 <= 18 -# && b2 = 5 + a2-5p2-5c2}; -# -# I; - -{[p1,p2,c2,a1,a2,b1,a2-5p2-5c2+5]: 1, -2c2+1 <= p2 <= 2, -2c2+6 && a1 <= 30 && 1 <= p1 && 17p1+2b1 <= 18+2a1 && 17+2a1 <= 17p1+2b1 && a2 <= 5p2+10c2 && 5p2+10c2 <= 4+a2 && 2a1 <= 17p1 && 17p1 <= 16+2a1 && a1+a2 <= 1+m} - -# -# codegen I; -for(t1 = 1; t1 <= min(intDiv(2*m+16,17),4); t1++) { - for(t2 = 1; t2 <= min(intDiv(2*m-17*t1+26,10),2); t2++) { - for(t3 = 0; t3 <= min(intDiv(2*m-10*t2-17*t1+26,20),2); t3++) { - for(t4 = intDiv(17*t1-16+1,2); t4 <= min(intDiv(17*t1,2),m-5*t2-10*t3+5,30); t4++) { - for(t5 = 5*t2+10*t3-4; t5 <= min(m-t4+1,5*t2+10*t3); t5++) { - for(t6 = intDiv(-17*t1+2*t4+17+1,2); t6 <= intDiv(-17*t1+2*t4+18,2); t6++) { - s1(t1,t2,t3,t4,t5,t6,t5+-5*t2+-5*t3+5); - } - } - } - } - } -} - -# diff --git a/omega/examples/old_test/m12 b/omega/examples/old_test/m12 deleted file mode 100644 index 2f1101f..0000000 --- a/omega/examples/old_test/m12 +++ /dev/null @@ -1,8 +0,0 @@ -symbolic n,m; -I1 := {[1,1:n,1:m,0]}; -I2 := {[2,1:n,0,0]}; -I3 := {[3,1:m,1,1:n]}; -I4 := {[3,1:m,2,1:n]}; -I5 := {[4,1:m,0,0]}; -codegen I1; -codegen I1,I1,I2,I2,I3,I3,I4,I4,I5,I5; diff --git a/omega/examples/old_test/m12.oc-rt b/omega/examples/old_test/m12.oc-rt deleted file mode 100644 index ab5953b..0000000 --- a/omega/examples/old_test/m12.oc-rt +++ /dev/null @@ -1,54 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic n,m; -# -# I1 := {[1,1:n,1:m,0]}; -# -# I2 := {[2,1:n,0,0]}; -# -# I3 := {[3,1:m,1,1:n]}; -# -# I4 := {[3,1:m,2,1:n]}; -# -# I5 := {[4,1:m,0,0]}; -# -# codegen I1; -if (m >= 1) { - for(t2 = 1; t2 <= n; t2++) { - for(t3 = 1; t3 <= m; t3++) { - s1(1,t2,t3,0); - } - } -} - -# -# codegen I1,I1,I2,I2,I3,I3,I4,I4,I5,I5; -if (m >= 1) { - for(t2 = 1; t2 <= n; t2++) { - for(t3 = 1; t3 <= m; t3++) { - s1(1,t2,t3,0); - s2(1,t2,t3,0); - } - } -} -for(t2 = 1; t2 <= n; t2++) { - s3(2,t2,0,0); - s4(2,t2,0,0); -} -if (n >= 1) { - for(t2 = 1; t2 <= m; t2++) { - for(t4 = 1; t4 <= n; t4++) { - s5(3,t2,1,t4); - s6(3,t2,1,t4); - } - for(t4 = 1; t4 <= n; t4++) { - s7(3,t2,2,t4); - s8(3,t2,2,t4); - } - } -} -for(t2 = 1; t2 <= m; t2++) { - s9(4,t2,0,0); - s10(4,t2,0,0); -} - -# diff --git a/omega/examples/old_test/m2 b/omega/examples/old_test/m2 deleted file mode 100644 index be93f8e..0000000 --- a/omega/examples/old_test/m2 +++ /dev/null @@ -1,4 +0,0 @@ -R1:={[i,j]: 2 <= i,j <= 9}; -R2:={[i,j]: 5 <= i <= 9 & 1 <= j <= 9}; -codegen R1,R2; -codegen 2 R1,R2; diff --git a/omega/examples/old_test/m2.oc-rt b/omega/examples/old_test/m2.oc-rt deleted file mode 100644 index cdd76dd..0000000 --- a/omega/examples/old_test/m2.oc-rt +++ /dev/null @@ -1,35 +0,0 @@ ->>> R1:={[i,j]: 2 <= i,j <= 9}; ->>> R2:={[i,j]: 5 <= i <= 9 & 1 <= j <= 9}; ->>> codegen R1,R2; -for(t1 = 2; t1 <= 9; t1++) { - if (t1 >= 5) { - s2(t1,1); - } - if (t1 <= 4) { - for(t2 = 2; t2 <= 9; t2++) { - s1(t1,t2); - } - } - if (t1 >= 5) { - for(t2 = 2; t2 <= 9; t2++) { - s1(t1,t2); - s2(t1,t2); - } - } -} - ->>> codegen 2 R1,R2; -for(t1 = 2; t1 <= 4; t1++) { - for(t2 = 2; t2 <= 9; t2++) { - s1(t1,t2); - } -} -for(t1 = 5; t1 <= 9; t1++) { - s2(t1,1); - for(t2 = 2; t2 <= 9; t2++) { - s1(t1,t2); - s2(t1,t2); - } -} - - diff --git a/omega/examples/old_test/m3 b/omega/examples/old_test/m3 deleted file mode 100644 index e160e8c..0000000 --- a/omega/examples/old_test/m3 +++ /dev/null @@ -1,2 +0,0 @@ -I := {[i,j] : 1 <= i+j,j <= 10}; -codegen I; diff --git a/omega/examples/old_test/m3.oc-rt b/omega/examples/old_test/m3.oc-rt deleted file mode 100644 index b466eb9..0000000 --- a/omega/examples/old_test/m3.oc-rt +++ /dev/null @@ -1,11 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# I := {[i,j] : 1 <= i+j,j <= 10}; -# -# codegen I; -for(t1 = -9; t1 <= 9; t1++) { - for(t2 = max(-t1+1,1); t2 <= min(-t1+10,10); t2++) { - s1(t1,t2); - } -} - -# diff --git a/omega/examples/old_test/m4 b/omega/examples/old_test/m4 deleted file mode 100644 index d25f961..0000000 --- a/omega/examples/old_test/m4 +++ /dev/null @@ -1,11 +0,0 @@ -T1:={[i,j]->[j,i,0]}; -T2:={[i,j]->[j,i,1]}; -IS:={[i,j]: 1 <= i,j <= 9}; - -newIS1 := T1 \ IS; -newIS1; -newIS2 := T2 \ IS; -newIS2; - -codegen T1:IS,T2:IS; -codegen 2 T1:IS,T2:IS; diff --git a/omega/examples/old_test/m4.oc-rt b/omega/examples/old_test/m4.oc-rt deleted file mode 100644 index d710dce..0000000 --- a/omega/examples/old_test/m4.oc-rt +++ /dev/null @@ -1,28 +0,0 @@ ->>> T1:={[i,j]->[j,i,0]}; ->>> T2:={[i,j]->[j,i,1]}; ->>> IS:={[i,j]: 1 <= i,j <= 9}; ->>> ->>> newIS1 := T1 \ IS; ->>> newIS1; -{[i,j] -> [j,i,0] : 1 <= i <= 9 && 1 <= j <= 9} ->>> newIS2 := T2 \ IS; ->>> newIS2; -{[i,j] -> [j,i,1] : 1 <= i <= 9 && 1 <= j <= 9} ->>> ->>> codegen T1:IS,T2:IS; -for(t1 = 1; t1 <= 9; t1++) { - for(t2 = 1; t2 <= 9; t2++) { - s1(t2,t1); - s2(t2,t1); - } -} - ->>> codegen 2 T1:IS,T2:IS; -for(t1 = 1; t1 <= 9; t1++) { - for(t2 = 1; t2 <= 9; t2++) { - s1(t2,t1); - s2(t2,t1); - } -} - - diff --git a/omega/examples/old_test/m7 b/omega/examples/old_test/m7 deleted file mode 100644 index 62c0c64..0000000 --- a/omega/examples/old_test/m7 +++ /dev/null @@ -1,6 +0,0 @@ -T1:={[i,j]->[j,i,0]}; -T2:={[i,j]->[j,i,1]}; -R2:={[i,j]: 1 <= i,j <= 9}; -R3:={[i,j]: 1 <= i,j <= 9 && exists (alpha: j = 2alpha)}; -codegen T1:R2,T2:R3; -codegen 2 T1:R2,T2:R3; diff --git a/omega/examples/old_test/m7.oc-rt b/omega/examples/old_test/m7.oc-rt deleted file mode 100644 index a98c8a7..0000000 --- a/omega/examples/old_test/m7.oc-rt +++ /dev/null @@ -1,35 +0,0 @@ ->>> T1:={[i,j]->[j,i,0]}; ->>> T2:={[i,j]->[j,i,1]}; ->>> R2:={[i,j]: 1 <= i,j <= 9}; ->>> R3:={[i,j]: 1 <= i,j <= 9 && exists (alpha: j = 2alpha)}; ->>> codegen T1:R2,T2:R3; -for(t1 = 1; t1 <= 9; t1++) { - if (intMod(-t1,2) == 0) { - for(t2 = 1; t2 <= 9; t2++) { - s1(t2,t1); - s2(t2,t1); - } - } - if (intMod(-t1-1,2) == 0) { - for(t2 = 1; t2 <= 9; t2++) { - s1(t2,t1); - } - } -} - ->>> codegen 2 T1:R2,T2:R3; -for(t1 = 1; t1 <= 9; t1++) { - if (intMod(-t1,2) == 0) { - for(t2 = 1; t2 <= 9; t2++) { - s1(t2,t1); - s2(t2,t1); - } - } - if (intMod(-t1-1,2) == 0) { - for(t2 = 1; t2 <= 9; t2++) { - s1(t2,t1); - } - } -} - - diff --git a/omega/examples/old_test/m8 b/omega/examples/old_test/m8 deleted file mode 100644 index eb6938b..0000000 --- a/omega/examples/old_test/m8 +++ /dev/null @@ -1,6 +0,0 @@ -T1:={[i,j]->[j,i,0]}; -T2:={[i,j]->[j,i,1]}; -R2:={[i,j]: 1 <= i,j <= 9 && exists (alpha: j = 4alpha)}; -R3:={[i,j]: 1 <= i,j <= 9 && exists (alpha: j = 2alpha)}; -codegen T1:R2,T2:R3; -codegen 2 T1:R2,T2:R3; diff --git a/omega/examples/old_test/m8.oc-rt b/omega/examples/old_test/m8.oc-rt deleted file mode 100644 index 670052b..0000000 --- a/omega/examples/old_test/m8.oc-rt +++ /dev/null @@ -1,35 +0,0 @@ ->>> T1:={[i,j]->[j,i,0]}; ->>> T2:={[i,j]->[j,i,1]}; ->>> R2:={[i,j]: 1 <= i,j <= 9 && exists (alpha: j = 4alpha)}; ->>> R3:={[i,j]: 1 <= i,j <= 9 && exists (alpha: j = 2alpha)}; ->>> codegen T1:R2,T2:R3; -for(t1 = 2; t1 <= 8; t1 += 2) { - if (intMod(t1,4) == 0) { - for(t2 = 1; t2 <= 9; t2++) { - s1(t2,t1); - s2(t2,t1); - } - } - if (intMod(t1-2,4) == 0) { - for(t2 = 1; t2 <= 9; t2++) { - s2(t2,t1); - } - } -} - ->>> codegen 2 T1:R2,T2:R3; -for(t1 = 2; t1 <= 8; t1 += 2) { - if (intMod(t1,4) == 0) { - for(t2 = 1; t2 <= 9; t2++) { - s1(t2,t1); - s2(t2,t1); - } - } - if (intMod(t1-2,4) == 0) { - for(t2 = 1; t2 <= 9; t2++) { - s2(t2,t1); - } - } -} - - diff --git a/omega/examples/old_test/m9 b/omega/examples/old_test/m9 deleted file mode 100644 index fb59381..0000000 --- a/omega/examples/old_test/m9 +++ /dev/null @@ -1,5 +0,0 @@ -IS:={[i,j]: 1 <= i,j <= 9}; -T1:={[i,j]->[2j,i,0]}; -T2:={[i,j]->[2j,i,1]}; -codegen T1:IS,T2:IS; -codegen 2 T1:IS,T2:IS; diff --git a/omega/examples/old_test/m9.oc-rt b/omega/examples/old_test/m9.oc-rt deleted file mode 100644 index c331a0c..0000000 --- a/omega/examples/old_test/m9.oc-rt +++ /dev/null @@ -1,20 +0,0 @@ ->>> IS:={[i,j]: 1 <= i,j <= 9}; ->>> T1:={[i,j]->[2j,i,0]}; ->>> T2:={[i,j]->[2j,i,1]}; ->>> codegen T1:IS,T2:IS; -for(t1 = 2; t1 <= 18; t1 += 2) { - for(t2 = 1; t2 <= 9; t2++) { - s1(t2,intDiv(t1,2)); - s2(t2,intDiv(t1,2)); - } -} - ->>> codegen 2 T1:IS,T2:IS; -for(t1 = 2; t1 <= 18; t1 += 2) { - for(t2 = 1; t2 <= 9; t2++) { - s1(t2,intDiv(t1,2)); - s2(t2,intDiv(t1,2)); - } -} - - diff --git a/omega/examples/old_test/maximize b/omega/examples/old_test/maximize deleted file mode 100644 index be13c89..0000000 --- a/omega/examples/old_test/maximize +++ /dev/null @@ -1,7 +0,0 @@ -symbolic n, f(1); - -R0 := {[x] : 1 <= x <= n}; -R1 := {[x] : 1 <= x <= n && f(x) >= 0}; -maximize R0; -maximize R1; -R1 intersection maximize R0; diff --git a/omega/examples/old_test/maximize.oc-rt b/omega/examples/old_test/maximize.oc-rt deleted file mode 100644 index 4f1826e..0000000 --- a/omega/examples/old_test/maximize.oc-rt +++ /dev/null @@ -1,24 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic n, f(1); -# -# -# R0 := {[x] : 1 <= x <= n}; -# -# R1 := {[x] : 1 <= x <= n && f(x) >= 0}; -# -# maximize R0; - -{[n]: 1 <= n} - -# -# maximize R1; - -{[x]: 1 <= x < n && 0 <= f(x) && UNKNOWN} union - {[x]: n = x && 0 <= f(x) && 1 <= x} - -# -# R1 intersection maximize R0; - -{[x]: n = x && 1 <= x && 0 <= f(x)} - -# diff --git a/omega/examples/old_test/olda b/omega/examples/old_test/olda deleted file mode 100644 index 095388b..0000000 --- a/omega/examples/old_test/olda +++ /dev/null @@ -1,9 +0,0 @@ -T10:={[mp,mq,mi] -> [mi,mq,mp,0]}; -T20:={[mp,mq,mi] -> [mi,mp,mq,1]}; - -symbolic np,morb; -IS10 := {[mp,mq,mi]: 1 <= mp <= np && 1 <= mq <= mp && 1 <= mi <= morb}; -IS20 := IS10; - -codegen T10:IS10,T20:IS20; -codegen 2 T10:IS10,T20:IS20; diff --git a/omega/examples/old_test/olda.oc-rt b/omega/examples/old_test/olda.oc-rt deleted file mode 100644 index 52e3406..0000000 --- a/omega/examples/old_test/olda.oc-rt +++ /dev/null @@ -1,52 +0,0 @@ ->>> T10:={[mp,mq,mi] -> [mi,mq,mp,0]}; ->>> T20:={[mp,mq,mi] -> [mi,mp,mq,1]}; ->>> ->>> Symbolic np,morb; ->>> IS10 := {[mp,mq,mi]: 1 <= mp <= np && 1 <= mq <= mp && 1 <= mi <= morb}; ->>> IS20 := IS10; ->>> ->>> codegen T10:IS10,T20:IS20; -if (np >= 1) { - for(t1 = 1; t1 <= morb; t1++) { - for(t2 = 1; t2 <= np; t2++) { - for(t3 = 1; t3 <= t2-1; t3++) { - s2(t2,t3,t1); - } - s1(t2,t2,t1); - s2(t2,t2,t1); - for(t3 = t2+1; t3 <= np; t3++) { - s1(t3,t2,t1); - } - } - } -} - ->>> codegen 2 T10:IS10,T20:IS20; -if (np >= 1) { - for(t1 = 1; t1 <= morb; t1++) { - s1(1,1,t1); - s2(1,1,t1); - for(t3 = 2; t3 <= np; t3++) { - s1(t3,1,t1); - } - for(t2 = 2; t2 <= np-1; t2++) { - for(t3 = 1; t3 <= t2-1; t3++) { - s2(t2,t3,t1); - } - s1(t2,t2,t1); - s2(t2,t2,t1); - for(t3 = t2+1; t3 <= np; t3++) { - s1(t3,t2,t1); - } - } - for(t3 = 1; t3 <= np-1; t3++) { - s2(np,t3,t1); - } - if (np >= 2) { - s1(np,np,t1); - s2(np,np,t1); - } - } -} - - diff --git a/omega/examples/old_test/p.delft b/omega/examples/old_test/p.delft deleted file mode 100644 index 27840a2..0000000 --- a/omega/examples/old_test/p.delft +++ /dev/null @@ -1,22 +0,0 @@ -# Generate local code for this HPF code fragment -# !HPF$ template T(0:150,0:150) -# !HPF$ align X(I,J) with T(3*I,3*J) -A := { [i,j] -> [3i,3j] }; -# !HPF$ processors P(0:3, 0:3) -# !HPF$ distribute -# !HPF$ T(cyclic(4), cyclic(4)) onto P -D := { [t1,t2] -> [p1,p2,c1,c2,l1,l2] : - t1 = 16c1+4p1+l1 - && t2 = 16c2+4p2+l2 - && 0 <= p1,p2 <= 3 - && 0 <= l1,l2 <= 3 }; -# do I = 0, 14 -# Y(I,I) = 1.0 -# enddo -I := { [i] : 0 <= i <= 14 }; -X := { [i] -> [i,i] }; -R := D(A(X(I))); -R; -symbolic P1,P2; -selectLocal := {[P1,P2,c1,c2,l1,l2] -> [c1,c2,l1,l2]}; -codegen selectLocal(R); diff --git a/omega/examples/old_test/p.delft.oc-rt b/omega/examples/old_test/p.delft.oc-rt deleted file mode 100644 index d59a886..0000000 --- a/omega/examples/old_test/p.delft.oc-rt +++ /dev/null @@ -1,43 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# # Generate local code for this HPF code fragment -# # !HPF$ template T(0:150,0:150) -# # !HPF$ align X(I,J) with T(3*I,3*J) -# A := { [i,j] -> [3i,3j] }; -# -# # !HPF$ processors P(0:3, 0:3) -# # !HPF$ distribute -# # !HPF$ T(cyclic(4), cyclic(4)) onto P -# D := { [t1,t2] -> [p1,p2,c1,c2,l1,l2] : -# t1 = 16c1+4p1+l1 -# && t2 = 16c2+4p2+l2 -# && 0 <= p1,p2 <= 3 -# && 0 <= l1,l2 <= 3 }; -# -# # do I = 0, 14 -# # Y(I,I) = 1.0 -# # enddo -# I := { [i] : 0 <= i <= 14 }; -# -# X := { [i] -> [i,i] }; -# -# R := D(A(X(I))); -# -# R; - -{[p1,p1,c1,c1,l1,l1]: Exists ( alpha : p1+l1+c1 = 3alpha && 0 <= p1 <= -4c1+10, 3 && 0 <= l1 <= 3 && 0 <= c1)} - -# -# symbolic P1,P2; -# -# selectLocal := {[P1,P2,c1,c2,l1,l2] -> [c1,c2,l1,l2]}; -# -# codegen selectLocal(R); -if (P1 == P2 && P1 >= 0 && P1 <= 3) { - for(t1 = 0; t1 <= min(-P1+4,2); t1++) { - for(t3 = intMod((-P1-t1),3); t3 <= 3; t3 += 3) { - s1(t1,t1,t3,t3); - } - } -} - -# diff --git a/omega/examples/old_test/p.delft2 b/omega/examples/old_test/p.delft2 deleted file mode 100644 index 32e5da0..0000000 --- a/omega/examples/old_test/p.delft2 +++ /dev/null @@ -1,24 +0,0 @@ -# Compute Sends and receives for the following HPF fragment - -I := { [i,j] : 1 <= i <= 14 && 0 <= j <= 14 }; -X := { [i,j] -> [3i,3j] }; -Y := { [i,j] -> [i',3j] : 3i-1 <= i'<= 3i}; -A := { [i,j] -> [3i,3j] }; -D := { [t1,t2] -> [p1,p2,c1,c2,l1,l2] : - t1 = 16c1+4p1+l1 - && t2 = 16c2+4p2+l2 - && 0 <= p1,p2 <= 3 - && 0 <= l1,l2 <= 3 }; -P := { [p1,p2,c1,c2,l1,l2] -> [p1,p2]}; -C := { [p1,p2,c1,c2,l1,l2] -> [p1,p2,c1,c2]}; -own := P(D(A(X))) \I; -own; -need := D(A(Y)) \I; -need; -different := {[p1,p2] -> [q1,q2,c1,c2,l1,l2] : p1 != q1 || p2 != q2}; -ship := (need compose (inverse own) ) intersection different; -symbolic P1,P2; -P := {[P1,P2]}; -S := range (ship \ P); -S; -codegen S; diff --git a/omega/examples/old_test/p.delft2.oc-rt b/omega/examples/old_test/p.delft2.oc-rt deleted file mode 100644 index 3ee662e..0000000 --- a/omega/examples/old_test/p.delft2.oc-rt +++ /dev/null @@ -1,80 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# # Compute Sends and receives for the following HPF fragment -# -# I := { [i,j] : 1 <= i <= 14 && 0 <= j <= 14 }; -# -# X := { [i,j] -> [3i,3j] }; -# -# Y := { [i,j] -> [i',3j] : 3i-1 <= i'<= 3i}; -# -# A := { [i,j] -> [3i,3j] }; -# -# D := { [t1,t2] -> [p1,p2,c1,c2,l1,l2] : -# t1 = 16c1+4p1+l1 -# && t2 = 16c2+4p2+l2 -# && 0 <= p1,p2 <= 3 -# && 0 <= l1,l2 <= 3 }; -# -# P := { [p1,p2,c1,c2,l1,l2] -> [p1,p2]}; -# -# C := { [p1,p2,c1,c2,l1,l2] -> [p1,p2,c1,c2]}; -# -# own := P(D(A(X))) \I; -# -# own; - -{[i,j] -> [p1,p2] : Exists ( alpha,beta : 1 <= i <= 14 && 0 <= j <= 14 && 0 <= p1 <= 3 && 0 <= p2 <= 3 && 4p1+16alpha <= 9i && 4p2+16beta <= 9j && 9i <= 3+4p1+16alpha && 9j <= 3+4p2+16beta)} - -# -# need := D(A(Y)) \I; -# -# need; - -{[i,j] -> [p1,p2,c1,c2,l1,9j-4p2-16c2] : Exists ( alpha : p1+c1+l1 = 3alpha && 1 <= i <= 14 && 0 <= j <= 14 && 0 <= p1 <= 3 && 0 <= p2 <= 3 && 0 <= l1 <= 3 && 4p2+16c2 <= 9j && 9j <= 3+4p2+16c2 && 9i <= 3+4p1+16c1+l1 && 4p1+16c1+l1 <= 9i)} - -# -# different := {[p1,p2] -> [q1,q2,c1,c2,l1,l2] : p1 != q1 || p2 != q2}; -# -# ship := (need compose (inverse own) ) intersection different; -# -# symbolic P1,P2; -# -# P := {[P1,P2]}; -# -# S := range (ship \ P); -# -# S; - -{[3,P2,c1,c2,l1,l2]: Exists ( alpha,beta,gamma : 4P2+l2 = 2c2+9beta && l1+c1 = 3alpha && 0 <= P1 <= -4c1+27 && 0 <= P2 <= 3 && -16c1-6 <= l1 <= 3 && 0 <= l2 <= 3 && 0 <= c2 && 4P2+l2+16c2 <= 126 && 9gamma <= 15+l1+16c1 && 16+4P1+16c1 <= 9gamma)} union - {[In_1,P2,c1,c2,l1,l2]: Exists ( alpha,beta,gamma : 4P2+l2 = 2c2+9beta && In_1+c1+l1 = 3alpha && 0 <= In_1 < P1 <= -4c1+31, 3 && 0 <= P2 <= 3 && 0 <= l2 <= 3 && l1 <= 3 && 6 <= 4In_1+16c1+l1 && 4P1+16c1 <= 9gamma && 0 <= 4P2+l2+16c2 && 4P2+l2+16c2 <= 126 && 9gamma <= 3+4In_1+16c1+l1)} - -# -# codegen S; -if (P1 >= 1 && P2 >= 0 && P1 <= 3 && P2 <= 3) { - for(t3 = intDiv(-P1+2+3,4); t3 <= 7; t3++) { - for(t4 = 0; t4 <= 7; t4++) { - for(t5 = 1+intMod(((-P1-t3+1)-1),3); t5 <= 3; t5 += 3) { - if (intMod(4*P1-2*t3+t5-1,9) == 0) { - for(t6 = intMod((-4*P2+2*t4),9); t6 <= 3; t6 += 9) { - s1(P1-1,P2,t3,t4,t5,t6); - } - } - } - } - } -} -if (P1 == 0 && P2 >= 0 && P2 <= 3) { - for(t3 = 0; t3 <= 6; t3++) { - for(t4 = 0; t4 <= 7; t4++) { - for(t5 = 1+intMod((-t3-1),3); t5 <= 3; t5 += 3) { - if (4*t5 == -t3+12) { - for(t6 = intMod((-4*P2+2*t4),9); t6 <= 3; t6 += 9) { - s1(3,P2,-4*t5+12,t4,t5,t6); - } - } - } - } - } -} - -# diff --git a/omega/examples/old_test/p.delft3 b/omega/examples/old_test/p.delft3 deleted file mode 100644 index b2321f1..0000000 --- a/omega/examples/old_test/p.delft3 +++ /dev/null @@ -1,20 +0,0 @@ -Hull {[p1,p2] -> [p1-1,p2,Out_3,Out_4] : -exists ( alpha,gamma : -1 <= p1 <= 3 -&& 0 <= p2 <= 3 -&& -2Out_4+1 <= alpha <= -2Out_4+14 -&& -2Out_3+1 <= gamma <= -2Out_3+14 -&& 4p1 <= 2Out_3+9gamma -&& 4p2 <= 2Out_4+9alpha -&& 2Out_3+9gamma <= 2+4p1 -&& 2Out_4+9alpha <= 3+4p2)}; - -Hull {[0,p2] -> [3,p2,Out_3,Out_4] : -exists (alpha,gamma : -Out_3+4alpha = 0 -&& 0 <= p2 <= 3 -&& 0 <= Out_3 <= 4 -&& -2Out_4+1 <= gamma <= -2Out_4+14 -&& 4p2 <= 2Out_4+9gamma -&& 2Out_4+9gamma <= 3+4p2)}; - diff --git a/omega/examples/old_test/p.delft3.oc-rt b/omega/examples/old_test/p.delft3.oc-rt deleted file mode 100644 index 6f85d83..0000000 --- a/omega/examples/old_test/p.delft3.oc-rt +++ /dev/null @@ -1,29 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# hull {[p1,p2] -> [p1-1,p2,Out_3,Out_4] : -# Exists ( alpha,gamma : -# 1 <= p1 <= 3 -# && 0 <= p2 <= 3 -# && -2Out_4+1 <= alpha <= -2Out_4+14 -# && -2Out_3+1 <= gamma <= -2Out_3+14 -# && 4p1 <= 2Out_3+9gamma -# && 4p2 <= 2Out_4+9alpha -# && 2Out_3+9gamma <= 2+4p1 -# && 2Out_4+9alpha <= 3+4p2)}; - -{[p1,p2] -> [p1-1,p2,Out_3,Out_4] : 1, -4Out_3+2 <= p1 <= 3 && 0, -4Out_4+2 <= p2 <= 3 && Out_3 <= 7 && Out_4 <= 7} - -# -# -# hull {[0,p2] -> [3,p2,Out_3,Out_4] : -# Exists (alpha,gamma : -# Out_3+4alpha = 0 -# && 0 <= p2 <= 3 -# && 0 <= Out_3 <= 4 -# && -2Out_4+1 <= gamma <= -2Out_4+14 -# && 4p2 <= 2Out_4+9gamma -# && 2Out_4+9gamma <= 3+4p2)}; - -{[0,p2] -> [3,p2,Out_3,Out_4] : 0, -4Out_4+2 <= p2 <= 3 && 0 <= Out_3 <= 4 && Out_4 <= 7} - -# -# diff --git a/omega/examples/old_test/p.subset b/omega/examples/old_test/p.subset deleted file mode 100644 index 3c8894c..0000000 --- a/omega/examples/old_test/p.subset +++ /dev/null @@ -1,3 +0,0 @@ -{ [i] -> [j] : 1 <= i <= 9 } subset { [i] -> [j] : 1 <= i <= 11 }; - -{ [i] -> [j] : 1 <= i <= 9 } subset { [i] -> [j] : 1 <= i <= 7 }; diff --git a/omega/examples/old_test/p.subset.oc-rt b/omega/examples/old_test/p.subset.oc-rt deleted file mode 100644 index b35b90f..0000000 --- a/omega/examples/old_test/p.subset.oc-rt +++ /dev/null @@ -1,10 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# { [i] -> [j] : 1 <= i <= 9 } subset { [i] -> [j] : 1 <= i <= 11 }; - -True -# -# -# { [i] -> [j] : 1 <= i <= 9 } subset { [i] -> [j] : 1 <= i <= 7 }; - -False -# diff --git a/omega/examples/old_test/p1 b/omega/examples/old_test/p1 deleted file mode 100644 index 0f29643..0000000 --- a/omega/examples/old_test/p1 +++ /dev/null @@ -1 +0,0 @@ -{ [i] -> [j] : 1 <= i < j <= 20 }; diff --git a/omega/examples/old_test/p1.oc-rt b/omega/examples/old_test/p1.oc-rt deleted file mode 100644 index 3151bd6..0000000 --- a/omega/examples/old_test/p1.oc-rt +++ /dev/null @@ -1,6 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# { [i] -> [j] : 1 <= i < j <= 20 }; - -{[i] -> [j] : 1 <= i < j <= 20} - -# diff --git a/omega/examples/old_test/p10 b/omega/examples/old_test/p10 deleted file mode 100644 index c802845..0000000 --- a/omega/examples/old_test/p10 +++ /dev/null @@ -1 +0,0 @@ -{[i,j,k,l,m] -> [i,i,i,i,i] : 1 <= i <= 100 }; diff --git a/omega/examples/old_test/p10.oc-rt b/omega/examples/old_test/p10.oc-rt deleted file mode 100644 index e10a453..0000000 --- a/omega/examples/old_test/p10.oc-rt +++ /dev/null @@ -1,6 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# {[i,j,k,l,m] -> [i,i,i,i,i] : 1 <= i <= 100 }; - -{[i,j,k,l,m] -> [i,i,i,i,i] : 1 <= i <= 100} - -# diff --git a/omega/examples/old_test/p11 b/omega/examples/old_test/p11 deleted file mode 100644 index 1871c82..0000000 --- a/omega/examples/old_test/p11 +++ /dev/null @@ -1,10 +0,0 @@ -{[i] : 1 <= i <= 10 - && ! i = 3 - && ! i = 2 - && ! i = 4 - && ! i = 7 - && ! i = 6 - && ! i = 8 -}; - - diff --git a/omega/examples/old_test/p11.oc-rt b/omega/examples/old_test/p11.oc-rt deleted file mode 100644 index 04641f2..0000000 --- a/omega/examples/old_test/p11.oc-rt +++ /dev/null @@ -1,17 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# {[i] : 1 <= i <= 10 -# && ! i = 3 -# && ! i = 2 -# && ! i = 4 -# && ! i = 7 -# && ! i = 6 -# && ! i = 8 -# }; - -{[1]} union - {[5]} union - {[i]: 9 <= i <= 10} - -# -# -# diff --git a/omega/examples/old_test/p12 b/omega/examples/old_test/p12 deleted file mode 100644 index ffe4b1d..0000000 --- a/omega/examples/old_test/p12 +++ /dev/null @@ -1,7 +0,0 @@ -symbolic n,m; -T := { [i,j] -> [i-1,j] : 1 <= i <= n && 0 <= j <= m } union - { [i,j] -> [i,j-1] : 0 <= i <= n && 1 <= j <= m }; -T; -T+; -Inverse ( (Inverse T)+); -T@; diff --git a/omega/examples/old_test/p12.oc-rt b/omega/examples/old_test/p12.oc-rt deleted file mode 100644 index 51df294..0000000 --- a/omega/examples/old_test/p12.oc-rt +++ /dev/null @@ -1,33 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic n,m; -# -# T := { [i,j] -> [i-1,j] : 1 <= i <= n && 0 <= j <= m } union -# { [i,j] -> [i,j-1] : 0 <= i <= n && 1 <= j <= m }; -# -# T; - -{[i,j] -> [i-1,j] : 1 <= i <= n && 0 <= j <= m} union - {[i,j] -> [i,j-1] : 0 <= i <= n && 1 <= j <= m} - -# -# T+; - -{[i,0] -> [i',0] : m = 0 && 0 <= i' < i <= n} union - {[0,j] -> [0,j'] : n = 0 && 0 <= j' < j <= m} union - {[i,j] -> [i',j'] : 0 <= i' < i <= n && 0 <= j' <= j <= m && 1 <= m} union - {[i,j] -> [i,j'] : 0 <= j' < j <= m && 0 <= i <= n && 1 <= n} - -# -# Inverse ( (Inverse T)+); - -{[i,0] -> [i',0] : m = 0 && 0 <= i' < i <= n} union - {[0,j] -> [0,j'] : n = 0 && 0 <= j' < j <= m} union - {[i,j] -> [i',j'] : 0 <= i' < i <= n && 0 <= j' <= j <= m && 1 <= m} union - {[i,j] -> [i,j'] : 0 <= j' < j <= m && 0 <= i <= n && 1 <= n} - -# -# T@; - -{[In_1,In_2] -> [Out_1,Out_2] : Out_1 <= In_1 && Out_2 <= In_2 && In_2 <= m+Out_2 && In_1 <= n+Out_1} - -# diff --git a/omega/examples/old_test/p13 b/omega/examples/old_test/p13 deleted file mode 100644 index 28ca23c..0000000 --- a/omega/examples/old_test/p13 +++ /dev/null @@ -1,3 +0,0 @@ -T := { [d1, -1] : d1 > 0 }; -T; -farkas T; diff --git a/omega/examples/old_test/p13.oc-rt b/omega/examples/old_test/p13.oc-rt deleted file mode 100644 index b52c4d6..0000000 --- a/omega/examples/old_test/p13.oc-rt +++ /dev/null @@ -1,13 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# T := { [d1, -1] : d1 > 0 }; -# -# T; - -{[d1,-1]: 1 <= d1} - -# -# farkas T; - -{[d1,In_2]: 0 <= d1 && In_2 <= constantTerm+d1} - -# diff --git a/omega/examples/old_test/p2 b/omega/examples/old_test/p2 deleted file mode 100644 index b880627..0000000 --- a/omega/examples/old_test/p2 +++ /dev/null @@ -1 +0,0 @@ -{ [i,j] -> [i+1,j+1] : 1 <= i <= 9 && 5 <= j <= 25 }; diff --git a/omega/examples/old_test/p2.oc-rt b/omega/examples/old_test/p2.oc-rt deleted file mode 100644 index 0d4f77c..0000000 --- a/omega/examples/old_test/p2.oc-rt +++ /dev/null @@ -1,6 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# { [i,j] -> [i+1,j+1] : 1 <= i <= 9 && 5 <= j <= 25 }; - -{[i,j] -> [i+1,j+1] : 1 <= i <= 9 && 5 <= j <= 25} - -# diff --git a/omega/examples/old_test/p3 b/omega/examples/old_test/p3 deleted file mode 100644 index 226a619..0000000 --- a/omega/examples/old_test/p3 +++ /dev/null @@ -1,2 +0,0 @@ -symbolic n; -{ [i] -> [i+1] : 1 <= i <= n }+; diff --git a/omega/examples/old_test/p3.oc-rt b/omega/examples/old_test/p3.oc-rt deleted file mode 100644 index 03c8ebb..0000000 --- a/omega/examples/old_test/p3.oc-rt +++ /dev/null @@ -1,8 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic n; -# -# { [i] -> [i+1] : 1 <= i <= n }+; - -{[i] -> [Out_1] : 1 <= i < Out_1 <= n+1} - -# diff --git a/omega/examples/old_test/p4 b/omega/examples/old_test/p4 deleted file mode 100644 index 2fcd2aa..0000000 --- a/omega/examples/old_test/p4 +++ /dev/null @@ -1,5 +0,0 @@ -inverse { [i] -> [i+1] : 1 <= i <= 9 }; -domain { [i] -> [i+1] : 1 <= i <= 9 }; -range { [i] -> [i+1] : 1 <= i <= 9 }; -{ [i] -> [i+1] : 1 <= i <= 9 } compose { [i] -> [i+1] : 1 <= i <= 9 }; - diff --git a/omega/examples/old_test/p4.oc-rt b/omega/examples/old_test/p4.oc-rt deleted file mode 100644 index 020d1d2..0000000 --- a/omega/examples/old_test/p4.oc-rt +++ /dev/null @@ -1,22 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# inverse { [i] -> [i+1] : 1 <= i <= 9 }; - -{[In_1] -> [In_1-1] : 2 <= In_1 <= 10} - -# -# domain { [i] -> [i+1] : 1 <= i <= 9 }; - -{[i]: 1 <= i <= 9} - -# -# range { [i] -> [i+1] : 1 <= i <= 9 }; - -{[In_1]: 2 <= In_1 <= 10} - -# -# { [i] -> [i+1] : 1 <= i <= 9 } compose { [i] -> [i+1] : 1 <= i <= 9 }; - -{[i] -> [i+2] : 1 <= i <= 8} - -# -# diff --git a/omega/examples/old_test/p5 b/omega/examples/old_test/p5 deleted file mode 100644 index ae7b242..0000000 --- a/omega/examples/old_test/p5 +++ /dev/null @@ -1,8 +0,0 @@ -symbolic n; -{[iw] -> [ir] : - 1 <= iw, ir <= 2n and iw=ir - and ! exists ( ik,jk : 1 <= ik <= 2n && 1 <= jk < n and - iw <= ik = ir and 2jk = ir ) - and ! exists ( ik,jk : 1 <= ik <= 2n && 1 <= jk < n and - iw <= ik = ir and 2jk+1 = ir ) - }; diff --git a/omega/examples/old_test/p5.oc-rt b/omega/examples/old_test/p5.oc-rt deleted file mode 100644 index ef73886..0000000 --- a/omega/examples/old_test/p5.oc-rt +++ /dev/null @@ -1,16 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic n; -# -# {[iw] -> [ir] : -# 1 <= iw, ir <= 2n and iw=ir -# and ! exists ( ik,jk : 1 <= ik <= 2n && 1 <= jk < n and -# iw <= ik = ir and 2jk = ir ) -# and ! exists ( ik,jk : 1 <= ik <= 2n && 1 <= jk < n and -# iw <= ik = ir and 2jk+1 = ir ) -# }; - -{[iw] -> [iw] : n = 1 && 1 <= iw <= 2} union - {[2n] -> [2n] : 2 <= n} union - {[1] -> [1] : 2 <= n} - -# diff --git a/omega/examples/old_test/p6 b/omega/examples/old_test/p6 deleted file mode 100644 index f09634a..0000000 --- a/omega/examples/old_test/p6 +++ /dev/null @@ -1,25 +0,0 @@ -R := { [i] -> [i'] : 1 <= i,i' <= 10 && i' = i+1 }; -R; -inverse R; -domain R; -range R; -R compose R; -R+; # closure of R = R union (R compose R) union (R compose R ... -complement R; -S := {[i] : 5 <= i <= 25}; -S; -R(S); # apply R to S -R \ S; # restrict domain of R to S -R / S; # restrict range of R to S -(R\S) union (R/S); -(R\S) intersection (R/S); -(R/S) - (R\S); -S*S; # cross product -D := S - {[9:16:2]} - {[17:19]}; -D; -T := { [i] : 1 <= i <= 11 & exists (a : i = 2a) }; -T; -Hull T; -Hull D; -codegen D; -codegen {[i,j] : 1 <= i+j,j <= 10}; diff --git a/omega/examples/old_test/p6.oc-rt b/omega/examples/old_test/p6.oc-rt deleted file mode 100644 index 109e029..0000000 --- a/omega/examples/old_test/p6.oc-rt +++ /dev/null @@ -1,129 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# R := { [i] -> [i'] : 1 <= i,i' <= 10 && i' = i+1 }; -# -# R; - -{[i] -> [i+1] : 1 <= i <= 9} - -# -# inverse R; - -{[i] -> [i-1] : 2 <= i <= 10} - -# -# domain R; - -{[i]: 1 <= i <= 9} - -# -# range R; - -{[i]: 2 <= i <= 10} - -# -# R compose R; - -{[i] -> [i+2] : 1 <= i <= 8} - -# -# R+; - -{[i] -> [i'] : 1 <= i < i' <= 10} - -# # closure of R = R union (R compose R) union (R compose R ... -# complement R; - -{[i] -> [i'] : i <= 0} union - {[i] -> [i'] : 10 <= i} union - {[i] -> [i'] : 1 <= i <= 9, i'-2} union - {[i] -> [i'] : 1, i' <= i <= 9} - -# -# S := {[i] : 5 <= i <= 25}; -# -# S; - -{[i]: 5 <= i <= 25} - -# -# R(S); - -{[i]: 6 <= i <= 10} - -# # apply R to S -# R \ S; - -{[i] -> [i+1] : 5 <= i <= 9} - -# # restrict domain of R to S -# R / S; - -{[i] -> [i+1] : 4 <= i <= 9} - -# # restrict range of R to S -# (R\S) union (R/S); - -{[i] -> [i+1] : 4 <= i <= 9} - -# -# (R\S) intersection (R/S); - -{[i] -> [i+1] : 5 <= i <= 9} - -# -# (R/S) - (R\S); - -{[4] -> [5] } - -# -# S*S; - -{[i] -> [i'] : 5 <= i <= 25 && 5 <= i' <= 25} - -# # cross product -# D := S - {[9:16:2]} - {[17:19]}; -# -# D; - -{[i]: 5 <= i <= 8} union - {[i]: Exists ( alpha : 2alpha = i && 10 <= i <= 16)} union - {[i]: 20 <= i <= 25} - -# -# T := { [i] : 1 <= i <= 11 & exists (a : i = 2a) }; -# -# T; - -{[i]: Exists ( alpha : 2alpha = i && 2 <= i <= 10)} - -# -# Hull T; - -{[i]: 2 <= i <= 10} - -# -# Hull D; - -{[i]: 5 <= i <= 25} - -# -# codegen D; -for(t1 = 5; t1 <= 8; t1++) { - s1(t1); -} -for(t1 = 10; t1 <= 16; t1 += 2) { - s1(t1); -} -for(t1 = 20; t1 <= 25; t1++) { - s1(t1); -} - -# -# codegen {[i,j] : 1 <= i+j,j <= 10}; -for(t1 = -9; t1 <= 9; t1++) { - for(t2 = max(-t1+1,1); t2 <= min(-t1+10,10); t2++) { - s1(t1,t2); - } -} - -# diff --git a/omega/examples/old_test/p7 b/omega/examples/old_test/p7 deleted file mode 100644 index d892912..0000000 --- a/omega/examples/old_test/p7 +++ /dev/null @@ -1 +0,0 @@ -{ [i] -> [j] : 1 <= i,j <= 10 and i != j}; diff --git a/omega/examples/old_test/p7.oc-rt b/omega/examples/old_test/p7.oc-rt deleted file mode 100644 index af7cf5f..0000000 --- a/omega/examples/old_test/p7.oc-rt +++ /dev/null @@ -1,7 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# { [i] -> [j] : 1 <= i,j <= 10 and i != j}; - -{[i] -> [j] : 1 <= j < i <= 10} union - {[i] -> [j] : 1 <= i < j <= 10} - -# diff --git a/omega/examples/old_test/p8 b/omega/examples/old_test/p8 deleted file mode 100644 index d6031ad..0000000 --- a/omega/examples/old_test/p8 +++ /dev/null @@ -1,6 +0,0 @@ -R1 := {[i] -> [j] : i < j}; -R2 := {[x] -> [y] : x < y}; -inverse R2; -R1 union R2; -R2(R1); - diff --git a/omega/examples/old_test/p8.oc-rt b/omega/examples/old_test/p8.oc-rt deleted file mode 100644 index b9d569a..0000000 --- a/omega/examples/old_test/p8.oc-rt +++ /dev/null @@ -1,21 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# R1 := {[i] -> [j] : i < j}; -# -# R2 := {[x] -> [y] : x < y}; -# -# inverse R2; - -{[y] -> [x] : x < y} - -# -# R1 union R2; - -{[In_1] -> [Out_1] : In_1 < Out_1} - -# -# R2(R1); - -{[i] -> [y] : i <= y-2} - -# -# diff --git a/omega/examples/old_test/p9 b/omega/examples/old_test/p9 deleted file mode 100644 index 8f38d36..0000000 --- a/omega/examples/old_test/p9 +++ /dev/null @@ -1,7 +0,0 @@ -symbolic lot_E; -{[k_w,l_w] -> [k_r,l_r] : -1 <= k_r <= 12 and -1 <= l_r <= lot_E and -2k_r+96l_r = 12+2k_w+96l_w and -1 <= k_w <= 3 and -1 <= l_w <= lot_E}; diff --git a/omega/examples/old_test/p9.oc-rt b/omega/examples/old_test/p9.oc-rt deleted file mode 100644 index b3e1f55..0000000 --- a/omega/examples/old_test/p9.oc-rt +++ /dev/null @@ -1,13 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic lot_E; -# -# {[k_w,l_w] -> [k_r,l_r] : -# 1 <= k_r <= 12 and -# 1 <= l_r <= lot_E and -# 2k_r+96l_r = 12+2k_w+96l_w and -# 1 <= k_w <= 3 and -# 1 <= l_w <= lot_E}; - -{[k_w,l_w] -> [k_w+6,l_w] : 1 <= k_w <= 3 && 1 <= l_w <= lot_E} - -# diff --git a/omega/examples/old_test/pufs1 b/omega/examples/old_test/pufs1 deleted file mode 100644 index 908c84f..0000000 --- a/omega/examples/old_test/pufs1 +++ /dev/null @@ -1,2 +0,0 @@ -symbolic n(1); -{ [i] -> [j] : 1 <= i <= j <= 100 && n(i) != n(j)}; diff --git a/omega/examples/old_test/pufs1.oc-rt b/omega/examples/old_test/pufs1.oc-rt deleted file mode 100644 index 0a7312f..0000000 --- a/omega/examples/old_test/pufs1.oc-rt +++ /dev/null @@ -1,9 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic n(1); -# -# { [i] -> [j] : 1 <= i <= j <= 100 && n(i) != n(j)}; - -{[i] -> [j] : 1 <= i < j <= 100 && n(j) < n(i)} union - {[i] -> [j] : 1 <= i < j <= 100 && n(i) < n(j)} - -# diff --git a/omega/examples/old_test/pufs2 b/omega/examples/old_test/pufs2 deleted file mode 100644 index 391c9d4..0000000 --- a/omega/examples/old_test/pufs2 +++ /dev/null @@ -1,9 +0,0 @@ -symbolic n(1); -R := { [i] -> [j] : 1 <= i = j <= 100 && n(i) <= n(j)}; -S := { [i] -> [j] : 1 <= i <= j <= 100 && n(i) = n(j)}; - -R; -S; -R intersection S; -R union S; -R intersection complement S; diff --git a/omega/examples/old_test/pufs2.oc-rt b/omega/examples/old_test/pufs2.oc-rt deleted file mode 100644 index b71d651..0000000 --- a/omega/examples/old_test/pufs2.oc-rt +++ /dev/null @@ -1,35 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic n(1); -# -# R := { [i] -> [j] : 1 <= i = j <= 100 && n(i) <= n(j)}; -# -# S := { [i] -> [j] : 1 <= i <= j <= 100 && n(i) = n(j)}; -# -# -# R; - -{[i] -> [i] : 1 <= i <= 100} - -# -# S; - -{[i] -> [i] : 1 <= i <= 100} union - {[i] -> [j] : n(j) = n(i) && 1 <= i < j <= 100} - -# -# R intersection S; - -{[i] -> [i] : 1 <= i <= 100} - -# -# R union S; - -{[i] -> [j] : n(j) = n(i) && 1 <= i < j <= 100} union - {[i] -> [i] : 1 <= i <= 100} - -# -# R intersection complement S; - -{[i] -> [j] : FALSE } - -# diff --git a/omega/examples/old_test/pufs3 b/omega/examples/old_test/pufs3 deleted file mode 100644 index 0a1af56..0000000 --- a/omega/examples/old_test/pufs3 +++ /dev/null @@ -1,8 +0,0 @@ -symbolic n(1); -R := { [i] -> [j] : 1 <= i = j <= 100 && n(i) <= n(j)}; -S := { [i] -> [j] : 1 <= i <= j <= 100 && n(i) = n(j)}; - -R intersection complement S; -inverse R; -inverse S; -inverse S intersection complement inverse R; diff --git a/omega/examples/old_test/pufs3.oc-rt b/omega/examples/old_test/pufs3.oc-rt deleted file mode 100644 index 55f851c..0000000 --- a/omega/examples/old_test/pufs3.oc-rt +++ /dev/null @@ -1,29 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic n(1); -# -# R := { [i] -> [j] : 1 <= i = j <= 100 && n(i) <= n(j)}; -# -# S := { [i] -> [j] : 1 <= i <= j <= 100 && n(i) = n(j)}; -# -# -# R intersection complement S; - -{[i] -> [j] : FALSE } - -# -# inverse R; - -{[j] -> [j] : 1 <= j <= 100} - -# -# inverse S; - -{[j] -> [j] : 1 <= j <= 100} union - {[j] -> [i] : n(j) = n(i) && 1 <= i < j <= 100} - -# -# inverse S intersection complement inverse R; - -{[j] -> [i] : n(j) = n(i) && 1 <= i < j <= 100} - -# diff --git a/omega/examples/old_test/pufs4 b/omega/examples/old_test/pufs4 deleted file mode 100644 index 57e868e..0000000 --- a/omega/examples/old_test/pufs4 +++ /dev/null @@ -1,16 +0,0 @@ -# Calculate exposed reads for this code fragment -# for i := 1 to n do -# for j := 1 to m do -# if p(i,j) >= 0 then a(i,j) = 1 -# else a(i,j) = 0 -# .... a(i,j) -# - -symbolic p(2), n, m; -R := { [ir,jr] : 1 <= ir <= n && 1 <= jr <= m }; -W1 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(iw,jw) >= 0 }; -W2 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(iw,jw) < 0 }; - -Exposed := R-W1-W2; - -Exposed; diff --git a/omega/examples/old_test/pufs4.oc-rt b/omega/examples/old_test/pufs4.oc-rt deleted file mode 100644 index 2c32c83..0000000 --- a/omega/examples/old_test/pufs4.oc-rt +++ /dev/null @@ -1,26 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# # Calculate exposed reads for this code fragment -# # for i := 1 to n do -# # for j := 1 to m do -# # if p(i,j) >= 0 then a(i,j) = 1 -# # else a(i,j) = 0 -# # .... a(i,j) -# # -# -# symbolic p(2), n, m; -# -# R := { [ir,jr] : 1 <= ir <= n && 1 <= jr <= m }; -# -# W1 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(iw,jw) >= 0 }; -# -# W2 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(iw,jw) < 0 }; -# -# -# Exposed := R-W1-W2; -# -# -# Exposed; - -{[iw,jw] : FALSE } - -# diff --git a/omega/examples/old_test/pufs5 b/omega/examples/old_test/pufs5 deleted file mode 100644 index 19249af..0000000 --- a/omega/examples/old_test/pufs5 +++ /dev/null @@ -1,22 +0,0 @@ -symbolic n(1); -S := { [i] -> [j] : 1 <= i < j <= 100 && n(j) >= 0}; -R := domain S; -S; -R; -upper_bound R; -lower_bound R; - -R - {[1:50]}; -{[1:50]} - R; -{[1:50]} - upper_bound R; -{[1:50]} - lower_bound R; - -R union {[10:30]} union {[25:100]} union {[1:10]}; -upper_bound (R union {[10:30]} union {[25:100]} union {[1:10]}); -lower_bound (R union {[10:30]} union {[25:100]} union {[1:10]}); - -{[101:200]} - R; -{[1:200]} - R; -{[1:200]} - R - {[10:30]} - {[25:100]}; -{[1:200]} - (R union {[10:30]} union {[25:100]} union {[1:10]}); -{[1:200]} - R - {[10:30]} - {[25:100]} - {[1:10]}; diff --git a/omega/examples/old_test/pufs5.oc-rt b/omega/examples/old_test/pufs5.oc-rt deleted file mode 100644 index 614a9fb..0000000 --- a/omega/examples/old_test/pufs5.oc-rt +++ /dev/null @@ -1,98 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic n(1); -# -# S := { [i] -> [j] : 1 <= i < j <= 100 && n(j) >= 0}; -# -# R := domain S; -# -# S; - -{[i] -> [j] : 1 <= i < j <= 100 && 0 <= n(j)} - -# -# R; - -{[i]: 1 <= i <= 99 && UNKNOWN} - -# -# upper_bound R; - -{[i]: 1 <= i <= 99} - -# -# lower_bound R; - -{[i] : FALSE } - -# -# -# R - {[1:50]}; - -{[i]: 51 <= i <= 99 && UNKNOWN} - -# -# {[1:50]} - R; - -{[i]: 1 <= i <= 50 && UNKNOWN} - -# -# {[1:50]} - upper_bound R; - -{[i] : FALSE } - -# -# {[1:50]} - lower_bound R; - -{[i]: 1 <= i <= 50} - -# -# -# R union {[10:30]} union {[25:100]} union {[1:10]}; - -{[i]: 1 <= i <= 99 && UNKNOWN} union - {[i]: 10 <= i <= 30} union - {[i]: 25 <= i <= 100} union - {[i]: 1 <= i <= 10} - -# -# upper_bound (R union {[10:30]} union {[25:100]} union {[1:10]}); - -{[i]: 1 <= i <= 99} union - {[i]: 25 <= i <= 100} - -# -# lower_bound (R union {[10:30]} union {[25:100]} union {[1:10]}); - -{[i]: 10 <= i <= 30} union - {[i]: 25 <= i <= 100} union - {[i]: 1 <= i <= 10} - -# -# -# {[101:200]} - R; - -{[i]: 101 <= i <= 200} - -# -# {[1:200]} - R; - -{[i]: 1 <= i <= 99 && UNKNOWN} union - {[i]: 100 <= i <= 200} - -# -# {[1:200]} - R - {[10:30]} - {[25:100]}; - -{[i]: 1 <= i <= 9 && UNKNOWN} union - {[i]: 101 <= i <= 200} - -# -# {[1:200]} - (R union {[10:30]} union {[25:100]} union {[1:10]}); - -{[i]: 101 <= i <= 200} - -# -# {[1:200]} - R - {[10:30]} - {[25:100]} - {[1:10]}; - -{[i]: 101 <= i <= 200} - -# diff --git a/omega/examples/old_test/pufs6 b/omega/examples/old_test/pufs6 deleted file mode 100644 index e24aa12..0000000 --- a/omega/examples/old_test/pufs6 +++ /dev/null @@ -1,19 +0,0 @@ -symbolic n, f(1), f_last, f_first; - -True := { [] : 1 = 1 }; - -old_R1 := { [x] -> [] : (1 <= x <= n and f(x) > 0)}; -old_R2 := { [x] -> [] : (1 <= x <= n and f(x) <=0)}; -True - range old_R1 - range old_R2; - -R1 := { [x] -> [] : (3 <= x <= n-1 and f(x) > 0) - or (1 <= n and f_last > 0) - or (1 <= n and f_first > 0) }; -R2 := { [x] -> [] : (3 <= x <= n-1 and f(x) <=0) - or (1 <= n and f_last <=0) - or (1 <= n and f_first <=0) }; -True - range R1 - range R2; - -R1a := { [x] -> [] : (1 <= x <= n and (f(x) > 0 or f_first > 0 or f_last > 0)) }; -R2a := { [x] -> [] : (1 <= x <= n and (f(x) <=0 or f_first <=0 or f_last <=0)) }; -True - range R1a - range R2a; diff --git a/omega/examples/old_test/pufs6.oc-rt b/omega/examples/old_test/pufs6.oc-rt deleted file mode 100644 index d782cfc..0000000 --- a/omega/examples/old_test/pufs6.oc-rt +++ /dev/null @@ -1,42 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# Symbolic n, f(1), f_last, f_first; -# -# -# True := { [] : 1 = 1 }; -# -# -# old_R1 := { [x] -> [] : (1 <= x <= n and f(x) > 0)}; -# -# old_R2 := { [x] -> [] : (1 <= x <= n and f(x) <=0)}; -# -# True - range old_R1 - range old_R2; - -{ 1 <= n && UNKNOWN} union - { n <= 0} - -# -# -# R1 := { [x] -> [] : (3 <= x <= n-1 and f(x) > 0) -# or (1 <= n and f_last > 0) -# or (1 <= n and f_first > 0) }; -# -# R2 := { [x] -> [] : (3 <= x <= n-1 and f(x) <=0) -# or (1 <= n and f_last <=0) -# or (1 <= n and f_first <=0) }; -# -# True - range R1 - range R2; - -{ n <= 0} - -# -# -# R1a := { [x] -> [] : (1 <= x <= n and (f(x) > 0 or f_first > 0 or f_last > 0)) }; -# -# R2a := { [x] -> [] : (1 <= x <= n and (f(x) <=0 or f_first <=0 or f_last <=0)) }; -# -# True - range R1a - range R2a; - -{ f_last <= 0 && n <= 0} union - { n <= 0 && 1 <= f_last} - -# diff --git a/omega/examples/old_test/pufs7 b/omega/examples/old_test/pufs7 deleted file mode 100644 index 33905bf..0000000 --- a/omega/examples/old_test/pufs7 +++ /dev/null @@ -1,6 +0,0 @@ -symbolic n(1),m; -{[i] : n(i) >= 0} union {[i] : n(i) <=0}; - -{[i] : n(i) >= 1 && 1 <= i <= m} - union {[i] : n(i) <1 && 1 <= i <= m}; - diff --git a/omega/examples/old_test/pufs7.oc-rt b/omega/examples/old_test/pufs7.oc-rt deleted file mode 100644 index 84a8b93..0000000 --- a/omega/examples/old_test/pufs7.oc-rt +++ /dev/null @@ -1,18 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic n(1),m; -# -# {[i] : n(i) >= 0} union {[i] : n(i) <=0}; - -{[i]: 0 <= n(i)} union - {[i]: n(i) <= 0} - -# -# -# {[i] : n(i) >= 1 && 1 <= i <= m} -# union {[i] : n(i) <1 && 1 <= i <= m}; - -{[i]: 1 <= i <= m && 1 <= n(i)} union - {[i]: 1 <= i <= m && n(i) <= 0} - -# -# diff --git a/omega/examples/old_test/reach1 b/omega/examples/old_test/reach1 deleted file mode 100644 index 268868f..0000000 --- a/omega/examples/old_test/reach1 +++ /dev/null @@ -1,5 +0,0 @@ - -reachable (a,b,c) - { a->b:{[1]->[2]}, - b->c:{[2]->[3]}, - a:{[1]}}; diff --git a/omega/examples/old_test/reach1.oc-rt b/omega/examples/old_test/reach1.oc-rt deleted file mode 100644 index 8333ede..0000000 --- a/omega/examples/old_test/reach1.oc-rt +++ /dev/null @@ -1,9 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# -# reachable (a,b,c) -# { a->b:{[1]->[2]}, -# b->c:{[2]->[3]}, -# a:{[1]}}; -Node b: {[2]} -Node c: {[3]} -# diff --git a/omega/examples/old_test/reach2 b/omega/examples/old_test/reach2 deleted file mode 100644 index 1a692a0..0000000 --- a/omega/examples/old_test/reach2 +++ /dev/null @@ -1,29 +0,0 @@ - -a2b:={[1]->[2]}; - -b2c1:={[i]->[i]}; -b2c2:={[i]->[j]}; - -a2a:={[i]->[i]}; -b2b:={[i]->[i]}; -c2c:={[i]->[i]}; - - - -reachable (a,b,c){ a->b:a2b, b->c:b2c1, a->a:a2a, b->b:b2b, c->c:c2c, - a:{[1]}}; - -reachable (a,b,c) { a->b:a2b, b->c:b2c2, a->a:a2a, b->b:b2b, c->c:c2c, - a:{[1]}}; - -b2c3:={[i]->[i+1]}; -b2b2:={[i]->[i+1]}; - -reachable (a,b,c){ a->b:a2b, b->c:b2c3, a->a:a2a, b->b:b2b2, c->c:c2c, - a:{[1]}}; - -b2c3:={[i]->[i]}; - -reachable (a,b,c){ a->b:a2b, b->c:b2c3, a->a:a2a, b->b:b2b2, c->c:c2c, - a:{[1]}}; - diff --git a/omega/examples/old_test/reach2.oc-rt b/omega/examples/old_test/reach2.oc-rt deleted file mode 100644 index 8a8a904..0000000 --- a/omega/examples/old_test/reach2.oc-rt +++ /dev/null @@ -1,61 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# -# a2b:={[1]->[2]}; -# -# -# b2c1:={[i]->[i]}; -# -# b2c2:={[i]->[j]}; -# -# -# a2a:={[i]->[i]}; -# -# b2b:={[i]->[i]}; -# -# c2c:={[i]->[i]}; -# -# -# -# -# reachable (a,b,c){ a->b:a2b, b->c:b2c1, a->a:a2a, b->b:b2b, c->c:c2c, -# a:{[1]}}; -Node a: {[1]} -Node b: {[2]} -Node c: {[2]} -# -# -# reachable (a,b,c) { a->b:a2b, b->c:b2c2, a->a:a2a, b->b:b2b, c->c:c2c, -# a:{[1]}}; -Node a: {[1]} -Node b: {[2]} -Node c: {[In_1]} -# -# -# b2c3:={[i]->[i+1]}; -# -# b2b2:={[i]->[i+1]}; -# -# -# reachable (a,b,c){ a->b:a2b, b->c:b2c3, a->a:a2a, b->b:b2b2, c->c:c2c, -# a:{[1]}}; -Node a: {[1]} -Node b: {[2]} union - {[In_1]: 4 <= In_1} union - {[3]} -Node c: {[i]: 4 <= i} union - {[3]} -# -# -# b2c3:={[i]->[i]}; -# -# -# reachable (a,b,c){ a->b:a2b, b->c:b2c3, a->a:a2a, b->b:b2b2, c->c:c2c, -# a:{[1]}}; -Node a: {[1]} -Node b: {[2]} union - {[In_1]: 4 <= In_1} union - {[3]} -Node c: {[i]: 3 <= i} union - {[2]} -# -# diff --git a/omega/examples/old_test/reach3 b/omega/examples/old_test/reach3 deleted file mode 100644 index 39c954d..0000000 --- a/omega/examples/old_test/reach3 +++ /dev/null @@ -1,18 +0,0 @@ - -a2b:={[1]->[2]}; -a2a:={[i]->[i]}; -b2b2:={[i]->[i+1]}; -b2c3:={[i]->[i]}; -c2c:={[i]->[i]}; - -reachable of a in (a,b,c) { - a->b:a2b, b->c:b2c3, a->a:a2a, b->b:b2b2, c->c:c2c, - a:{[1]} - }; -reachable of b in (a,b,c) { - a->b:a2b, b->c:b2c3, a->a:a2a, a:{[1]}, b->b:b2b2, c->c:c2c - }; -cr := reachable of c in (a,b,c) { - a:{[1]},a->b:a2b, b->c:b2c3, a->a:a2a, - b->b:b2b2, c->c:c2c }; -cr; diff --git a/omega/examples/old_test/reach3.oc-rt b/omega/examples/old_test/reach3.oc-rt deleted file mode 100644 index 3418061..0000000 --- a/omega/examples/old_test/reach3.oc-rt +++ /dev/null @@ -1,40 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# -# a2b:={[1]->[2]}; -# -# a2a:={[i]->[i]}; -# -# b2b2:={[i]->[i+1]}; -# -# b2c3:={[i]->[i]}; -# -# c2c:={[i]->[i]}; -# -# -# reachable of a in (a,b,c) { -# a->b:a2b, b->c:b2c3, a->a:a2a, b->b:b2b2, c->c:c2c, -# a:{[1]} -# }; - -{[1]} - -# -# reachable of b in (a,b,c) { -# a->b:a2b, b->c:b2c3, a->a:a2a, a:{[1]}, b->b:b2b2, c->c:c2c -# }; - -{[2]} union - {[In_1]: 4 <= In_1} union - {[3]} - -# -# cr := reachable of c in (a,b,c) { -# a:{[1]},a->b:a2b, b->c:b2c3, a->a:a2a, -# b->b:b2b2, c->c:c2c }; -# -# cr; - -{[i]: 3 <= i} union - {[2]} - -# diff --git a/omega/examples/old_test/red1 b/omega/examples/old_test/red1 deleted file mode 100644 index 1a479b3..0000000 --- a/omega/examples/old_test/red1 +++ /dev/null @@ -1,3 +0,0 @@ -R1 := {[i,j,k] : 17i=12j+170}; -R2 := {[i,j,k] : k >= 0}; -gist R1 given R2; diff --git a/omega/examples/old_test/red1.oc-rt b/omega/examples/old_test/red1.oc-rt deleted file mode 100644 index 32cbb97..0000000 --- a/omega/examples/old_test/red1.oc-rt +++ /dev/null @@ -1,10 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# R1 := {[i,j,k] : 17i=12j+170}; -# -# R2 := {[i,j,k] : k >= 0}; -# -# gist R1 given R2; - -{[i,j,k]: 17i = 170+12j} - -# diff --git a/omega/examples/old_test/saman b/omega/examples/old_test/saman deleted file mode 100644 index bf44452..0000000 --- a/omega/examples/old_test/saman +++ /dev/null @@ -1,20 +0,0 @@ -# Passing array sections through array reshaping -# procedure foo() -# real a(1:5,1:64,1:64,1:5) -# for i = 1 to 64 do -# for j = 1 to 64 do -# bar(a(1,i,j,1)) -# ... -# procedure bar(x(*)) -# x(1:5) = ... -# -# Question which element of a are effected by the call to bar? -# -symbolic i,j; -R := {[i1,i2,i3,i4] -> [o1] : - (i1-1) + (i2-i)*5 + (i3-j)*5*64 + (i4-1)*5*64*64 - = o1-1 - && 1 <= i1,i4 <= 5 - && 1 <= i,j,i2,i3 <= 64}; -R; -(inverse R)({[1:5]}); diff --git a/omega/examples/old_test/saman.oc-rt b/omega/examples/old_test/saman.oc-rt deleted file mode 100644 index d75d4df..0000000 --- a/omega/examples/old_test/saman.oc-rt +++ /dev/null @@ -1,31 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# # Passing array sections through array reshaping -# # procedure foo() -# # real a(1:5,1:64,1:64,1:5) -# # for i = 1 to 64 do -# # for j = 1 to 64 do -# # bar(a(1,i,j,1)) -# # ... -# # procedure bar(x(*)) -# # x(1:5) = ... -# # -# # Question which element of a are effected by the call to bar? -# # -# symbolic i,j; -# -# R := {[i1,i2,i3,i4] -> [o1] : -# (i1-1) + (i2-i)*5 + (i3-j)*5*64 + (i4-1)*5*64*64 -# = o1-1 -# && 1 <= i1,i4 <= 5 -# && 1 <= i,j,i2,i3 <= 64}; -# -# R; - -{[i1,i2,i3,i4] -> [i1-320j-5i+5i2+320i3+20480i4-20480] : 1 <= j <= 64 && 1 <= i <= 64 && 1 <= i1 <= 5 && 1 <= i2 <= 64 && 1 <= i3 <= 64 && 1 <= i4 <= 5} - -# -# (inverse R)({[1:5]}); - -{[i1,i,j,1]: 1 <= i <= 64 && 1 <= j <= 64 && 1 <= i1 <= 5} - -# diff --git a/omega/examples/old_test/sample1 b/omega/examples/old_test/sample1 deleted file mode 100644 index fb292b3..0000000 --- a/omega/examples/old_test/sample1 +++ /dev/null @@ -1,14 +0,0 @@ -example { [i] -> [j] : 1 <= i < j <= 20 }; - -example { [i,j] -> [i+1,j+1] : 1 <= i <= 9 && 5 <= j <= 25 }; - -example (inverse { [i] -> [i+1] : 1 <= i <= 9 }); - -example (domain { [i] -> [i+1] : 1 <= i <= 9 }); - -example (range { [i] -> [i+1] : 1 <= i <= 9 }); - -example ({[i] -> [i+1] : 1 <= i <= 9 } compose { [i] -> [i+1] : 1 <= i <= 9 }); - - - diff --git a/omega/examples/old_test/sample1.oc-rt b/omega/examples/old_test/sample1.oc-rt deleted file mode 100644 index bb19b15..0000000 --- a/omega/examples/old_test/sample1.oc-rt +++ /dev/null @@ -1,39 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# example { [i] -> [j] : 1 <= i < j <= 20 }; - -{[19] -> [20] } - -# -# -# example { [i,j] -> [i+1,j+1] : 1 <= i <= 9 && 5 <= j <= 25 }; - -{[1,5] -> [2,6] } - -# -# -# example (inverse { [i] -> [i+1] : 1 <= i <= 9 }); - -{[2] -> [1] } - -# -# -# example (domain { [i] -> [i+1] : 1 <= i <= 9 }); - -{[1]} - -# -# -# example (range { [i] -> [i+1] : 1 <= i <= 9 }); - -{[2]} - -# -# -# example ({[i] -> [i+1] : 1 <= i <= 9 } compose { [i] -> [i+1] : 1 <= i <= 9 }); - -{[1] -> [3] } - -# -# -# -# diff --git a/omega/examples/old_test/sample2 b/omega/examples/old_test/sample2 deleted file mode 100644 index 1ca6b19..0000000 --- a/omega/examples/old_test/sample2 +++ /dev/null @@ -1,11 +0,0 @@ -symbolic n,m; - -example { [i] -> [j] : 1 <= i <= 20 }; - -example {[i] : 1 <= i <= n}; - -example {[i] : m <= i <= n}; - -example {[i] : exists ( alpha : i <= 2alpha)}; - -example {[i] : exists ( alpha : i = 2alpha)}; diff --git a/omega/examples/old_test/sample2.oc-rt b/omega/examples/old_test/sample2.oc-rt deleted file mode 100644 index e18d650..0000000 --- a/omega/examples/old_test/sample2.oc-rt +++ /dev/null @@ -1,33 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# Symbolic n,m; -# -# -# example { [i] -> [j] : 1 <= i <= 20 }; - -{[1] -> [42] } - -# -# -# example {[i] : 1 <= i <= n}; - -{[1]: n = 1} - -# -# -# example {[i] : m <= i <= n}; - -{[42]: m = 42 && n = 42} - -# -# -# example {[i] : exists ( alpha : i <= 2alpha)}; - -{[42]} - -# -# -# example {[i] : exists ( alpha : i = 2alpha)}; - -{[0]} - -# diff --git a/omega/examples/old_test/sample3 b/omega/examples/old_test/sample3 deleted file mode 100644 index 44a481d..0000000 --- a/omega/examples/old_test/sample3 +++ /dev/null @@ -1,11 +0,0 @@ -symbolic n,m; - -sym_example {[i] : 1 <= i <= n}; - -sym_example {[i] : m <= i <= n}; - -sym_example {[i] : m <= i <= n && exists (alpha : i = 2alpha)}; -example {[i] : m <= i <= n && exists (alpha : i = 2alpha)}; -example {[i] : m < i <= n && exists (alpha : i = 2alpha)}; -example {[i] : m < i < n}; - diff --git a/omega/examples/old_test/sample3.oc-rt b/omega/examples/old_test/sample3.oc-rt deleted file mode 100644 index a486bdd..0000000 --- a/omega/examples/old_test/sample3.oc-rt +++ /dev/null @@ -1,37 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# Symbolic n,m; -# -# -# sym_example {[i] : 1 <= i <= n}; - -{[1]: 1 <= n} - -# -# -# sym_example {[i] : m <= i <= n}; - -{[m]: m <= n} - -# -# -# sym_example {[i] : m <= i <= n && exists (alpha : i = 2alpha)}; - -{[0]: m <= 0 && 0 <= n} - -# -# example {[i] : m <= i <= n && exists (alpha : i = 2alpha)}; - -{[42]: m = 42 && n = 42} - -# -# example {[i] : m < i <= n && exists (alpha : i = 2alpha)}; - -{[44]: m = 42 && n = 44} - -# -# example {[i] : m < i < n}; - -{[43]: m = 42 && n = 44} - -# -# diff --git a/omega/examples/old_test/stodghil b/omega/examples/old_test/stodghil deleted file mode 100644 index 99e9430..0000000 --- a/omega/examples/old_test/stodghil +++ /dev/null @@ -1,21 +0,0 @@ -symbolic n; - -S := {[k_w,j_w,l_w]->[k_r,j_r,l_r] : ((1 <= k_w) and (k_w <= n) and ((k_w + 1) <= j_w) -and (j_w <= n) -and ((k_w + 1) <= l_w) and (l_w <= j_w) and (1 <= k_r) -and (k_r <= n) and ((k_r + 1) <= j_r) and (j_r <= n) -and ((k_r + 1) <= l_r) and (l_r <= j_r) and ((k_w < k_r) or ((k_w = k_r) -and (j_w < j_r)) or ((k_w = k_r) and (j_w = j_r) and (l_w < l_r))) -and (j_w = j_r) and (l_w = l_r) -and !exists(k_1 : ((1 <= k_1) and (k_1 <= n) and (k_w < k_1) and ((k_1 < k_r) or (k_1 = k_r)) -and (k_1 = j_r) and (k_1 = l_r))) -and !exists(k_2,i_2 : ((1 <= k_2) and (k_2 <= n) and ((k_2 + 1) <= i_2) and (i_2 <= n) and (k_w < k_2) and ((k_2 < k_r) or (k_2 = k_r)) and (i_2 = j_r) and (k_2 = l_r))) -and !exists(k_3,j_3,l_3 : ((1 <= k_3) and (k_3 <= n) and ((k_3 + 1) <= j_3) - and (j_3 <= n) and ((k_3 + 1) <= l_3) and (l_3 <= j_3) -and ((k_w < k_3) or ((k_w = k_3) and (j_w < j_3)) or ((k_w = k_3) -and (j_w = j_3) and (l_w < l_3))) -and ((k_3 < k_r) or ((k_3 = k_r) and (j_3 < j_r)) or ((k_3 = k_r) -and (j_3 = j_r) and (l_3 < l_r))) and (j_3 = j_r) and (l_3 = l_r)) -))}; - -S; diff --git a/omega/examples/old_test/stodghil.oc-rt b/omega/examples/old_test/stodghil.oc-rt deleted file mode 100644 index 0d554d2..0000000 --- a/omega/examples/old_test/stodghil.oc-rt +++ /dev/null @@ -1,28 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic n; -# -# -# S := {[k_w,j_w,l_w]->[k_r,j_r,l_r] : ((1 <= k_w) and (k_w <= n) and ((k_w + 1) <= j_w) -# and (j_w <= n) -# and ((k_w + 1) <= l_w) and (l_w <= j_w) and (1 <= k_r) -# and (k_r <= n) and ((k_r + 1) <= j_r) and (j_r <= n) -# and ((k_r + 1) <= l_r) and (l_r <= j_r) and ((k_w < k_r) or ((k_w = k_r) -# and (j_w < j_r)) or ((k_w = k_r) and (j_w = j_r) and (l_w < l_r))) -# and (j_w = j_r) and (l_w = l_r) -# and !exists(k_1 : ((1 <= k_1) and (k_1 <= n) and (k_w < k_1) and ((k_1 < k_r) or (k_1 = k_r)) -# and (k_1 = j_r) and (k_1 = l_r))) -# and !exists(k_2,i_2 : ((1 <= k_2) and (k_2 <= n) and ((k_2 + 1) <= i_2) and (i_2 <= n) and (k_w < k_2) and ((k_2 < k_r) or (k_2 = k_r)) and (i_2 = j_r) and (k_2 = l_r))) -# and !exists(k_3,j_3,l_3 : ((1 <= k_3) and (k_3 <= n) and ((k_3 + 1) <= j_3) -# and (j_3 <= n) and ((k_3 + 1) <= l_3) and (l_3 <= j_3) -# and ((k_w < k_3) or ((k_w = k_3) and (j_w < j_3)) or ((k_w = k_3) -# and (j_w = j_3) and (l_w < l_3))) -# and ((k_3 < k_r) or ((k_3 = k_r) and (j_3 < j_r)) or ((k_3 = k_r) -# and (j_3 = j_r) and (l_3 < l_r))) and (j_3 = j_r) and (l_3 = l_r)) -# ))}; -# -# -# S; - -{[k_w,j_w,l_w] -> [k_w+1,j_w,l_w] : k_w+2 <= l_w <= j_w <= n && 1 <= k_w} - -# diff --git a/omega/examples/old_test/stride1 b/omega/examples/old_test/stride1 deleted file mode 100644 index fc2b727..0000000 --- a/omega/examples/old_test/stride1 +++ /dev/null @@ -1,2 +0,0 @@ -R := { [i] : i < 10 && i > 1 && exists ( alpha : i = 3alpha) }; -codegen R; diff --git a/omega/examples/old_test/stride1.oc-rt b/omega/examples/old_test/stride1.oc-rt deleted file mode 100644 index a577449..0000000 --- a/omega/examples/old_test/stride1.oc-rt +++ /dev/null @@ -1,9 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# R := { [i] : i < 10 && i > 1 && exists ( alpha : i = 3alpha) }; -# -# codegen R; -for(t1 = 3; t1 <= 9; t1 += 3) { - s1(t1); -} - -# diff --git a/omega/examples/old_test/stride2 b/omega/examples/old_test/stride2 deleted file mode 100644 index 37a355f..0000000 --- a/omega/examples/old_test/stride2 +++ /dev/null @@ -1,4 +0,0 @@ -symbolic n; -new_IS := {[t1,t2] : exists (alpha : t1 = 32alpha && - t2 - 31,0 <= t1 <= t2 <= n)}; -codegen new_IS; diff --git a/omega/examples/old_test/stride2.oc-rt b/omega/examples/old_test/stride2.oc-rt deleted file mode 100644 index ee8fb75..0000000 --- a/omega/examples/old_test/stride2.oc-rt +++ /dev/null @@ -1,14 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# Sym n; -# -# new_IS := {[t1,t2] : exists (alpha : t1 = 32alpha && -# t2 - 31,0 <= t1 <= t2 <= n)}; -# -# codegen new_IS; -for(t1 = 0; t1 <= n; t1 += 32) { - for(t2 = t1; t2 <= min(n,t1+31); t2++) { - s1(t1,t2); - } -} - -# diff --git a/omega/examples/old_test/stride3 b/omega/examples/old_test/stride3 deleted file mode 100644 index 859e9b8..0000000 --- a/omega/examples/old_test/stride3 +++ /dev/null @@ -1,4 +0,0 @@ -symbolic n; -new_IS := {[t1,t2] : exists (alpha : t1 = 32alpha+3 && - t2 - 31,0 <= t1 <= t2 <= n)}; -codegen new_IS; diff --git a/omega/examples/old_test/stride3.oc-rt b/omega/examples/old_test/stride3.oc-rt deleted file mode 100644 index 7ba925f..0000000 --- a/omega/examples/old_test/stride3.oc-rt +++ /dev/null @@ -1,14 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# Sym n; -# -# new_IS := {[t1,t2] : exists (alpha : t1 = 32alpha+3 && -# t2 - 31,0 <= t1 <= t2 <= n)}; -# -# codegen new_IS; -for(t1 = 3; t1 <= n; t1 += 32) { - for(t2 = t1; t2 <= min(n,t1+31); t2++) { - s1(t1,t2); - } -} - -# diff --git a/omega/examples/old_test/stride4 b/omega/examples/old_test/stride4 deleted file mode 100644 index 21781a2..0000000 --- a/omega/examples/old_test/stride4 +++ /dev/null @@ -1,4 +0,0 @@ -symbolic n; -new_IS := {[i] : exists (alpha : i = 5alpha-2 && - i >= 17 && i <= 100)}; -codegen new_IS; diff --git a/omega/examples/old_test/stride4.oc-rt b/omega/examples/old_test/stride4.oc-rt deleted file mode 100644 index 3905486..0000000 --- a/omega/examples/old_test/stride4.oc-rt +++ /dev/null @@ -1,12 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# Sym n; -# -# new_IS := {[i] : exists (alpha : i = 5alpha-2 && -# i >= 17 && i <= 100)}; -# -# codegen new_IS; -for(t1 = 18; t1 <= 98; t1 += 5) { - s1(t1); -} - -# diff --git a/omega/examples/old_test/stride5 b/omega/examples/old_test/stride5 deleted file mode 100644 index 9c4f1b0..0000000 --- a/omega/examples/old_test/stride5 +++ /dev/null @@ -1,4 +0,0 @@ -symbolic n; -R := {[i,j]: i >= 1 && i <= 101 && exists (alpha : i = 2 alpha) && - j >= i+2n && j <=401 && exists (alpha : j = 2 alpha)}; -codegen R; diff --git a/omega/examples/old_test/stride5.oc-rt b/omega/examples/old_test/stride5.oc-rt deleted file mode 100644 index 85e9551..0000000 --- a/omega/examples/old_test/stride5.oc-rt +++ /dev/null @@ -1,14 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# Sym n; -# -# R := {[i,j]: i >= 1 && i <= 101 && exists (alpha : i = 2 alpha) && -# j >= i+2n && j <=401 && exists (alpha : j = 2 alpha)}; -# -# codegen R; -for(t1 = 2; t1 <= min(-2*n+400,100); t1 += 2) { - for(t2 = 2*n+t1; t2 <= 400; t2 += 2) { - s1(t1,t2); - } -} - -# diff --git a/omega/examples/old_test/stride6 b/omega/examples/old_test/stride6 deleted file mode 100644 index 364e24c..0000000 --- a/omega/examples/old_test/stride6 +++ /dev/null @@ -1,10 +0,0 @@ -symbolic n; -R := {[i,j]: i >= 1 && i <= 101 && - j >= i && j <=401 && exists (alpha : j = 2 alpha)}; -codegen R; -S := {[i,j]: i >= 1 && i <= 101 && exists (alpha : i = 2 alpha) && - j >= i && j <=401 && exists (alpha : j = 2 alpha)}; -codegen S; -T := {[i,j]: i >= 1 && i <= 101 && exists (alpha : i = 2 alpha) && - j >= i && j <=401 && exists (alpha : 2j = 4 alpha)}; -codegen T; diff --git a/omega/examples/old_test/stride6.oc-rt b/omega/examples/old_test/stride6.oc-rt deleted file mode 100644 index eeb242f..0000000 --- a/omega/examples/old_test/stride6.oc-rt +++ /dev/null @@ -1,36 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# Sym n; -# -# R := {[i,j]: i >= 1 && i <= 101 && -# j >= i && j <=401 && exists (alpha : j = 2 alpha)}; -# -# codegen R; -for(t1 = 1; t1 <= 101; t1++) { - for(t2 = 2*intDiv(t1+1,2); t2 <= 400; t2 += 2) { - s1(t1,t2); - } -} - -# -# S := {[i,j]: i >= 1 && i <= 101 && exists (alpha : i = 2 alpha) && -# j >= i && j <=401 && exists (alpha : j = 2 alpha)}; -# -# codegen S; -for(t1 = 2; t1 <= 100; t1 += 2) { - for(t2 = t1; t2 <= 400; t2 += 2) { - s1(t1,t2); - } -} - -# -# T := {[i,j]: i >= 1 && i <= 101 && exists (alpha : i = 2 alpha) && -# j >= i && j <=401 && exists (alpha : 2j = 4 alpha)}; -# -# codegen T; -for(t1 = 2; t1 <= 100; t1 += 2) { - for(t2 = t1; t2 <= 400; t2 += 2) { - s1(t1,t2); - } -} - -# diff --git a/omega/examples/old_test/stride7 b/omega/examples/old_test/stride7 deleted file mode 100644 index 4bfe1cd..0000000 --- a/omega/examples/old_test/stride7 +++ /dev/null @@ -1,6 +0,0 @@ -IS:={[i,j]: 1 <= i,j <= 9}; -T1:={[i,j]->[4j,i,0]}; -T2:={[i,j]->[j,i,1]}; -codegen T1:IS,T2:IS; -codegen 2 T1:IS,T2:IS; - diff --git a/omega/examples/old_test/stride7.oc-rt b/omega/examples/old_test/stride7.oc-rt deleted file mode 100644 index 60ac1d4..0000000 --- a/omega/examples/old_test/stride7.oc-rt +++ /dev/null @@ -1,47 +0,0 @@ ->>> IS:={[i,j]: 1 <= i,j <= 9}; ->>> T1:={[i,j]->[4j,i,0]}; ->>> T2:={[i,j]->[j,i,1]}; ->>> codegen T1:IS,T2:IS; -for(t1 = 1; t1 <= 36; t1++) { - if (intMod(t1,4) == 0 && t1 <= 8) { - for(t2 = 1; t2 <= 9; t2++) { - s1(t2,intDiv(t1,4)); - s2(t2,t1); - } - } - if (intMod(t1,4) == 0 && t1 >= 12) { - for(t2 = 1; t2 <= 9; t2++) { - s1(t2,intDiv(t1,4)); - } - } - if (t1-3 <= 4*intDiv(t1-1,4) && t1 <= 9) { - for(t2 = 1; t2 <= 9; t2++) { - s2(t2,t1); - } - } -} - ->>> codegen 2 T1:IS,T2:IS; -for(t1 = 1; t1 <= 8; t1++) { - if (intMod(t1,4) == 0) { - for(t2 = 1; t2 <= 9; t2++) { - s1(t2,intDiv(t1,4)); - s2(t2,t1); - } - } - if (t1-3 <= 4*intDiv(t1-1,4)) { - for(t2 = 1; t2 <= 9; t2++) { - s2(t2,t1); - } - } -} -for(t2 = 1; t2 <= 9; t2++) { - s2(t2,9); -} -for(t1 = 12; t1 <= 36; t1 += 4) { - for(t2 = 1; t2 <= 9; t2++) { - s1(t2,intDiv(t1,4)); - } -} - - diff --git a/omega/examples/old_test/subsets1 b/omega/examples/old_test/subsets1 deleted file mode 100644 index 1b3721d..0000000 --- a/omega/examples/old_test/subsets1 +++ /dev/null @@ -1,20 +0,0 @@ -R := {[x]:x > 1 }; -R; -R2 := subsetof R; -R2; - -R - R2; -R subset R2; -R2 - R; -R2 subset R; - -S := {[x]: x > 0}; -S - R; -R subset S; -S - R2; -R2 subset S; - -S2 := {[x]: x > -1}; -S3 := subsetof S2; -S3 - S; -S subset S3; diff --git a/omega/examples/old_test/subsets1.oc-rt b/omega/examples/old_test/subsets1.oc-rt deleted file mode 100644 index 345639f..0000000 --- a/omega/examples/old_test/subsets1.oc-rt +++ /dev/null @@ -1,70 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# R := {[x]:x > 1 }; -# -# R; - -{[x]: 2 <= x} - -# -# R2 := subsetof R; -# -# R2; - -{[x]: 2 <= x && UNKNOWN} - -# -# -# R - R2; - -{[x]: 2 <= x && UNKNOWN} - -# -# R subset R2; - -False -# -# R2 - R; - -{[x] : FALSE } - -# -# R2 subset R; - -True -# -# -# S := {[x]: x > 0}; -# -# S - R; - -{[1]} - -# -# R subset S; - -True -# -# S - R2; - -{[x]: 2 <= x && UNKNOWN} union - {[1]} - -# -# R2 subset S; - -True -# -# -# S2 := {[x]: x > -1}; -# -# S3 := subsetof S2; -# -# S3 - S; - -{[0]: UNKNOWN} - -# -# S subset S3; - -False -# diff --git a/omega/examples/old_test/subsets2 b/omega/examples/old_test/subsets2 deleted file mode 100644 index 4d4a98a..0000000 --- a/omega/examples/old_test/subsets2 +++ /dev/null @@ -1,5 +0,0 @@ -(subsetof {[1:10]}) - subsetof {[1:10]}; - -{[1:10]} - subsetof {[1:10]}; - -(subsetof {[1:10]}) - {[1:10]}; diff --git a/omega/examples/old_test/subsets2.oc-rt b/omega/examples/old_test/subsets2.oc-rt deleted file mode 100644 index 0bbb1c7..0000000 --- a/omega/examples/old_test/subsets2.oc-rt +++ /dev/null @@ -1,18 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# (subsetof {[1:10]}) - subsetof {[1:10]}; - -{[In_1]: 1 <= In_1 <= 10 && UNKNOWN} - -# -# -# {[1:10]} - subsetof {[1:10]}; - -{[In_1]: 1 <= In_1 <= 10 && UNKNOWN} - -# -# -# (subsetof {[1:10]}) - {[1:10]}; - -{[In_1] : FALSE } - -# diff --git a/omega/examples/old_test/tex1 b/omega/examples/old_test/tex1 deleted file mode 100644 index ca84924..0000000 --- a/omega/examples/old_test/tex1 +++ /dev/null @@ -1,49 +0,0 @@ -# -# Extract from omega4 -# removed "eqnarray" commands, associated &'s, and overbrace commands -# added declaration of n -# added semicolon -# -# It would be nice not to have to do the following: -# removed \ in front of variable names -# - -$$ -symbolic n; -R := \{\ [ii] \rightarrow [ki] \mid -1 \leq ii \leq 2n - \ \land \ 1 \leq ki \leq 2n -\land ii = ki -\land ii = ki\\ -\t \land - \ \neg (\ \exists [ji, jj] \st -(1 \leq ji \leq 2n \land 1 \leq jj \leq n\!-\!1) -\land (ii \leq ji \land ji \leq ki) \land (2jj = ki)\ )\\ -\t -\land \ -\neg (\ \exists [ji, jj] \st -(1 \leq ji \leq 2n \land 1 \leq jj \leq n\!-\!1) -\land (ii \leq ji \land ji \leq ki) \land (2jj\!+\!1 = ki)\ ) -\ \} -; - -R; -$$ -# S := \{\ [\ii] \rightarrow [\ki] \mid -# 1 \leq \ii \leq 2\n -# \ \land \ 1 \leq \ki \leq 2\n -# \land \ii = \ki -# \land \ii = \ki\\ -# \t \land -# \ \neg (\ \exists [\ji, \jj] \st -# (1 \leq \ji \leq 2\n \land 1 \leq \jj \leq \n\!-\!1) -# \land (\ii \leq \ji \land \ji \leq \ki) \land (2\jj = \ki)\ )\\ -# \t -# \land \ -# \neg (\ \exists [\ji, \jj] \st -# (1 \leq \ji \leq 2\n \land 1 \leq \jj \leq \n\!-\!1) -# \land (\ii \leq \ji \land \ji \leq \ki) \land (2\jj\!+\!1 = \ki)\ ) -# \ \} -# ; -# -# S; diff --git a/omega/examples/old_test/tex1.oc-rt b/omega/examples/old_test/tex1.oc-rt deleted file mode 100644 index fd138d0..0000000 --- a/omega/examples/old_test/tex1.oc-rt +++ /dev/null @@ -1,58 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# # -# # Extract from omega4 -# # removed "eqnarray" commands, associated &'s, and overbrace commands -# # added declaration of n -# # added semicolon -# # -# # It would be nice not to have to do the following: -# # removed \ in front of variable names -# # -# -# $$ -# symbolic n; -# -# R := \{\ [ii] \rightarrow [ki] \mid -# 1 \leq ii \leq 2n -# \ \land \ 1 \leq ki \leq 2n -# \land ii = ki -# \land ii = ki\\ -# \t \land -# \ \neg (\ \exists [ji, jj] \st -# (1 \leq ji \leq 2n \land 1 \leq jj \leq n\!-\!1) -# \land (ii \leq ji \land ji \leq ki) \land (2jj = ki)\ )\\ -# \t -# \land \ -# \neg (\ \exists [ji, jj] \st -# (1 \leq ji \leq 2n \land 1 \leq jj \leq n\!-\!1) -# \land (ii \leq ji \land ji \leq ki) \land (2jj\!+\!1 = ki)\ ) -# \ \} -# ; -# -# -# R; - -{[ii] -> [ii] : n = 1 && 1 <= ii <= 2} union - {[2n] -> [2n] : 2 <= n} union - {[1] -> [1] : 2 <= n} - -# -# $$ -# # S := \{\ [\ii] \rightarrow [\ki] \mid -# # 1 \leq \ii \leq 2\n -# # \ \land \ 1 \leq \ki \leq 2\n -# # \land \ii = \ki -# # \land \ii = \ki\\ -# # \t \land -# # \ \neg (\ \exists [\ji, \jj] \st -# # (1 \leq \ji \leq 2\n \land 1 \leq \jj \leq \n\!-\!1) -# # \land (\ii \leq \ji \land \ji \leq \ki) \land (2\jj = \ki)\ )\\ -# # \t -# # \land \ -# # \neg (\ \exists [\ji, \jj] \st -# # (1 \leq \ji \leq 2\n \land 1 \leq \jj \leq \n\!-\!1) -# # \land (\ii \leq \ji \land \ji \leq \ki) \land (2\jj\!+\!1 = \ki)\ ) -# # \ \} -# # ; -# # -# # S; diff --git a/omega/examples/old_test/tricky b/omega/examples/old_test/tricky deleted file mode 100644 index d12077c..0000000 --- a/omega/examples/old_test/tricky +++ /dev/null @@ -1,11 +0,0 @@ -symbolic N,M,k; -{ [i,j] -> [] : 0 <= i <= M and 0 <= j <= N and 2i+j = k - and not ( exists [i2,j2] : - 0 <= i2 <= M and 0 <= j2 <= N - and 2i2+j2 = k - and i < i2 ) }; -{ [i,j] -> [] : 0 <= i <= M and 0 <= j <= N and 2i+j = k - and not ( i < M && 2i-2 <= k && - N-k <= 2M - && ( N-k < k or N <= 2k && (exists a : k = 2 a) - ))}; diff --git a/omega/examples/old_test/tricky.oc-rt b/omega/examples/old_test/tricky.oc-rt deleted file mode 100644 index 8282b7f..0000000 --- a/omega/examples/old_test/tricky.oc-rt +++ /dev/null @@ -1,25 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic N,M,k; -# -# { [i,j] -> [] : 0 <= i <= M and 0 <= j <= N and 2i+j = k -# and NOT( exists [i2,j2] : -# 0 <= i2 <= M and 0 <= j2 <= N -# and 2i2+j2 = k -# and i < i2 ) }; - -{[i,k-2i] -> : 2i <= k <= 2i+1 && 0 <= i <= M && k <= N+2i} union - {[M,k-2M] -> : 2+2M <= k && k <= N+2M && 0 <= M} - -# -# { [i,j] -> [] : 0 <= i <= M and 0 <= j <= N and 2i+j = k -# and NOT( i < M && 2i-2 <= k && -# N-k <= 2M -# && ( N-k < k or N <= 2k && (exists a : k = 2 a) -# ))}; - -{[i,k-2i] -> : 0 <= i <= M && 2M+k < N && 2i <= k} union - {[M,k-2M] -> : N <= 2M+k && k <= N+2M && 2M <= k} union - {[i,k-2i] -> : 2k < N && N <= 2M+k && 0 <= i && 2i <= k} union - {[i,k-2i] -> : Exists ( alpha : N = 2k && 2i = 1+k+2alpha && 2i+1 <= k <= 2M-1 && 0 <= i)} - -# diff --git a/omega/examples/old_test/ts1d-check-sblock b/omega/examples/old_test/ts1d-check-sblock deleted file mode 100644 index 01757ea..0000000 --- a/omega/examples/old_test/ts1d-check-sblock +++ /dev/null @@ -1,155 +0,0 @@ -# This is the file facts.prew, which is prepended to the .prew files -# for the particular code generation we want, defines things like the -# iteration space and dependences. Known facts are inserted by the -# Makefile. -# -# If you're looking at a .w file instead of facts.prew, then you should -# remember to edit the original .prew files, not the .w files. -# -# This facts.prew file describes the program -# -# for(i = 0; i <= N-1; i++) { -# cur[i]=... -# } -# for(t = 0; t < T; t++) { -# for(i = 0; i <= N-1; i++) { -# old[i]=cur[i]; -# } -# for(i = 1; i <= N-2; i++) { -# cur[i] = (old[i-1]+old[i]+old[i]+old[i+1])*0.25; -# } -# } - - - -# first, the spaces and memory maps - -symbolic T, N; - -IS_INIT := { [1,i,1,0,0] : 0<=i<=N-1 }; -MM_INIT := { [1,i,1,0,0] -> [0,i] : 0<=i<=N-1 }; - -IS_COPY := { [2,t,0,i,1] : 0<=t [t+1,i] : 0<=t [t+1,i] : 0<=t [x',t',y',i',z'] : - (x'>x) or - (x'=x and t'>t) or - (x'=x and t'=t and y'>y) or - (x'=x and t'=t and y'=y and i'>i) or - (x'=x and t'=t and y'=y and i'=i and z'>z) }; -FWD7 := {[x,t,y,i,z,a,b] -> [x',t',y',i',z',a',b'] : - (x'>x) or - (x'=x and t'>t) or - (x'=x and t'=t and y'>y) or - (x'=x and t'=t and y'=y and i'>i) or - (x'=x and t'=t and y'=y and i'=i and z'>z) or - (x'=x and t'=t and y'=y and i'=i and z'=z and a'>a) or - (x'=x and t'=t and y'=y and i'=i and z'=z and a'=a and b'>b) }; -BWD5 := inverse FWD5; -BWD7 := inverse FWD7; -EQi := {[x,t,y,i,z] -> [x',t',y',i',z'] : i'=i }; - -# output deps - -OAA := (IS_COPY * IS_COPY) intersection FWD5 intersection EQi; -OCC := (IS_CALC * IS_CALC) intersection FWD5 intersection EQi; - -# combined flow/anti deps - -FAC := (IS_COPY * IS_CALC) intersection FWD5 intersection {[2,t,0,i,1] -> [2,t',1,i',1] : (i'-1<=i<=i'+1)}; -FCA := (IS_CALC * IS_COPY) intersection FWD5 intersection {[2,t,1,i,1] -> [2,t',0,i',1] : (i-1<=i'<=i+1)}; - -# total memory deps in the "core" - -COREMEMDEPS := OAA union OCC union FAC union FCA; - - - -# data flow for original code: - -DF_12p1 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,0,0,i,1] : 0 [2,t,0,0,1] }; -DF_12p3 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,t,0,i,1] : i=N-1 && N>1 }; -DF_32 := ( IS_CALC * IS_COPY ) intersection {[2,t,1,i,1] -> [2,t+1,0,i,1]}; - -DF_23a := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i+1,1] }; -DF_23b := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i,1] }; -DF_23c := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i-1,1] }; - - -# data flow for array expanded code, -# after forward substitution of "old[i] = cur[i]" - -DF1Ia := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; -DF1Ib := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t>0 && i=0 } restrictDomain IS_INIT restrictRange IS_CALC; -DF1C := { [2,t,1,i,1] -> [2,t+1,1,i+1,1] } restrictDomain IS_CALC restrictRange IS_CALC; -DF2I := { [1,i,1,0,0] -> [2,t,1,i,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; -DF2C := { [2,t,1,i,1] -> [2,t+1,1,i+0,1] } restrictDomain IS_CALC restrictRange IS_CALC; -DF3Ia := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; -DF3Ib := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t>0 && i=N-1 } restrictDomain IS_INIT restrictRange IS_CALC; -DF3C := { [2,t,1,i,1] -> [2,t+1,1,i-1,1] } restrictDomain IS_CALC restrictRange IS_CALC; - -# total data flow - -COREDATAFLOW := DF1C union DF2C union DF3C; - - -# arity expansion relations -ex_0_5v := { [] -> [a,b,c,d,e] }; -ex_0_7v := { [] -> [a,b,c,d,e,f,g] }; -ex_3_5 := { [a,b,c] -> [a,b,c,0,0] }; -ex_3_7 := { [a,b,c] -> [a,b,c,0,0,0,0] }; -ex_5_7 := { [a,b,c,d,e] -> [a,b,c,d,e,0,0] }; - -ex_5_3 := { [a,b,c,0,0] -> [a,b,c] }; -ex_7_3 := { [a,b,c,0,0,0,0] -> [a,b,c] }; -ex_7_5 := { [a,b,c,d,e,0,0] -> [a,b,c,d,e] }; - - -# stuff used in skew and tskew - -# Here is the description of time skewing from the current draft of the paper. -IS_Trans := { [2,t,1,i,1] -> [2,tb,1,s,1,tt,1] : - 0<=tt<1000 && s=i+1*t && t=1000*tb+tt }; - -IS_Tinv := inverse IS_Trans; - -# We use it to transform the iteration spaces -TS_IS_CALC := IS_CALC join IS_Trans; -# for some reason OC refuses do to this "join" but will do the reverse: -# TS_IS_INIT := ex_7_5 join IS_INIT; -TS_IS_INIT := IS_INIT join (inverse ex_7_5); - -# Now we can update the data flow relations to correspond to the new I.S.'s -TS_DF1Ia := ex_7_5 join DF1Ia join IS_Trans; -TS_DF1Ib := ex_7_5 join DF1Ib join IS_Trans; -TS_DF1C := IS_Tinv join DF1C join IS_Trans; -TS_DF2I := ex_7_5 join DF2I join IS_Trans; -TS_DF2C := IS_Tinv join DF2C join IS_Trans; -TS_DF3Ia := ex_7_5 join DF3Ia join IS_Trans; -TS_DF3Ib := ex_7_5 join DF3Ib join IS_Trans; -TS_DF3C := IS_Tinv join DF3C join IS_Trans; - - -KNOWN := { [] : T >= 0 and N >= 4 }; - -IS_INIT_EXP := { [1,t,1,i,0] : (0=t && 0<=i<=N-1) || - (1=t && 0=i) || - (1=t && N-1=i) }; - -TSKEW := { [2, t, 1, i, 1] -> [2, tb, t+i, tt, 0] : - 1000*tb+tt = t and 0 <= tt < 1000 }; - -codegen - IS_INIT_EXP, TSKEW : IS_CALC -given (KNOWN join ex_0_5v); - diff --git a/omega/examples/old_test/ts1d-check-sblock.oc-rt b/omega/examples/old_test/ts1d-check-sblock.oc-rt deleted file mode 100644 index 492fa30..0000000 --- a/omega/examples/old_test/ts1d-check-sblock.oc-rt +++ /dev/null @@ -1,227 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# # This is the file facts.prew, which is prepended to the .prew files -# # for the particular code generation we want, defines things like the -# # iteration space and dependences. Known facts are inserted by the -# # Makefile. -# # -# # If you're looking at a .w file instead of facts.prew, then you should -# # remember to edit the original .prew files, not the .w files. -# # -# # This facts.prew file describes the program -# # -# # for(i = 0; i <= N-1; i++) { -# # cur[i]=... -# # } -# # for(t = 0; t < T; t++) { -# # for(i = 0; i <= N-1; i++) { -# # old[i]=cur[i]; -# # } -# # for(i = 1; i <= N-2; i++) { -# # cur[i] = (old[i-1]+old[i]+old[i]+old[i+1])*0.25; -# # } -# # } -# -# -# -# # first, the spaces and memory maps -# -# symbolic T, N; -# -# -# IS_INIT := { [1,i,1,0,0] : 0<=i<=N-1 }; -# -# MM_INIT := { [1,i,1,0,0] -> [0,i] : 0<=i<=N-1 }; -# -# -# IS_COPY := { [2,t,0,i,1] : 0<=t [t+1,i] : 0<=t [t+1,i] : 0<=t [x',t',y',i',z'] : -# (x'>x) or -# (x'=x and t'>t) or -# (x'=x and t'=t and y'>y) or -# (x'=x and t'=t and y'=y and i'>i) or -# (x'=x and t'=t and y'=y and i'=i and z'>z) }; -# -# FWD7 := {[x,t,y,i,z,a,b] -> [x',t',y',i',z',a',b'] : -# (x'>x) or -# (x'=x and t'>t) or -# (x'=x and t'=t and y'>y) or -# (x'=x and t'=t and y'=y and i'>i) or -# (x'=x and t'=t and y'=y and i'=i and z'>z) or -# (x'=x and t'=t and y'=y and i'=i and z'=z and a'>a) or -# (x'=x and t'=t and y'=y and i'=i and z'=z and a'=a and b'>b) }; -# -# BWD5 := inverse FWD5; -# -# BWD7 := inverse FWD7; -# -# EQi := {[x,t,y,i,z] -> [x',t',y',i',z'] : i'=i }; -# -# -# # output deps -# -# OAA := (IS_COPY * IS_COPY) intersection FWD5 intersection EQi; -# -# OCC := (IS_CALC * IS_CALC) intersection FWD5 intersection EQi; -# -# -# # combined flow/anti deps -# -# FAC := (IS_COPY * IS_CALC) intersection FWD5 intersection {[2,t,0,i,1] -> [2,t',1,i',1] : (i'-1<=i<=i'+1)}; -# -# FCA := (IS_CALC * IS_COPY) intersection FWD5 intersection {[2,t,1,i,1] -> [2,t',0,i',1] : (i-1<=i'<=i+1)}; -# -# -# # total memory deps in the "core" -# -# COREMEMDEPS := OAA union OCC union FAC union FCA; -# -# -# -# -# # data flow for original code: -# -# DF_12p1 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,0,0,i,1] : 0 [2,t,0,0,1] }; -# -# DF_12p3 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,t,0,i,1] : i=N-1 && N>1 }; -# -# DF_32 := ( IS_CALC * IS_COPY ) intersection {[2,t,1,i,1] -> [2,t+1,0,i,1]}; -# -# -# DF_23a := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i+1,1] }; -# -# DF_23b := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i,1] }; -# -# DF_23c := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i-1,1] }; -# -# -# -# # data flow for array expanded code, -# # after forward substitution of "old[i] = cur[i]" -# -# DF1Ia := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; -# -# DF1Ib := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t>0 && i=0 } restrictDomain IS_INIT restrictRange IS_CALC; -# -# DF1C := { [2,t,1,i,1] -> [2,t+1,1,i+1,1] } restrictDomain IS_CALC restrictRange IS_CALC; -# -# DF2I := { [1,i,1,0,0] -> [2,t,1,i,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; -# -# DF2C := { [2,t,1,i,1] -> [2,t+1,1,i+0,1] } restrictDomain IS_CALC restrictRange IS_CALC; -# -# DF3Ia := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; -# -# DF3Ib := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t>0 && i=N-1 } restrictDomain IS_INIT restrictRange IS_CALC; -# -# DF3C := { [2,t,1,i,1] -> [2,t+1,1,i-1,1] } restrictDomain IS_CALC restrictRange IS_CALC; -# -# -# # total data flow -# -# COREDATAFLOW := DF1C union DF2C union DF3C; -# -# -# -# # arity expansion relations -# ex_0_5v := { [] -> [a,b,c,d,e] }; -# -# ex_0_7v := { [] -> [a,b,c,d,e,f,g] }; -# -# ex_3_5 := { [a,b,c] -> [a,b,c,0,0] }; -# -# ex_3_7 := { [a,b,c] -> [a,b,c,0,0,0,0] }; -# -# ex_5_7 := { [a,b,c,d,e] -> [a,b,c,d,e,0,0] }; -# -# -# ex_5_3 := { [a,b,c,0,0] -> [a,b,c] }; -# -# ex_7_3 := { [a,b,c,0,0,0,0] -> [a,b,c] }; -# -# ex_7_5 := { [a,b,c,d,e,0,0] -> [a,b,c,d,e] }; -# -# -# -# # stuff used in skew and tskew -# -# # Here is the description of time skewing from the current draft of the paper. -# IS_Trans := { [2,t,1,i,1] -> [2,tb,1,s,1,tt,1] : -# 0<=tt<1000 && s=i+1*t && t=1000*tb+tt }; -# -# -# IS_Tinv := inverse IS_Trans; -# -# -# # We use it to transform the iteration spaces -# TS_IS_CALC := IS_CALC join IS_Trans; -# -# # for some reason OC refuses do to this "join" but will do the reverse: -# # TS_IS_INIT := ex_7_5 join IS_INIT; -# TS_IS_INIT := IS_INIT join (inverse ex_7_5); -# -# -# # Now we can update the data flow relations to correspond to the new I.S.'s -# TS_DF1Ia := ex_7_5 join DF1Ia join IS_Trans; -# -# TS_DF1Ib := ex_7_5 join DF1Ib join IS_Trans; -# -# TS_DF1C := IS_Tinv join DF1C join IS_Trans; -# -# TS_DF2I := ex_7_5 join DF2I join IS_Trans; -# -# TS_DF2C := IS_Tinv join DF2C join IS_Trans; -# -# TS_DF3Ia := ex_7_5 join DF3Ia join IS_Trans; -# -# TS_DF3Ib := ex_7_5 join DF3Ib join IS_Trans; -# -# TS_DF3C := IS_Tinv join DF3C join IS_Trans; -# -# -# -# KNOWN := { [] : T >= 0 and N >= 4 }; -# -# -# IS_INIT_EXP := { [1,t,1,i,0] : (0=t && 0<=i<=N-1) || -# (1=t && 0=i) || -# (1=t && N-1=i) }; -# -# -# TSKEW := { [2, t, 1, i, 1] -> [2, tb, t+i, tt, 0] : -# 1000*tb+tt = t and 0 <= tt < 1000 }; -# -# -# codegen -# IS_INIT_EXP, TSKEW : IS_CALC -# given (KNOWN join ex_0_5v); -for(t4 = 0; t4 <= N-1; t4++) { - s1(1,0,1,t4,0); -} -s1(1,1,1,0,0); -s1(1,1,1,N-1,0); -for(t2 = 0; t2 <= intDiv(T-1,1000); t2++) { - for(t3 = 1000*t2+1; t3 <= min(N+1000*t2+997,N+T-3); t3++) { - for(t4 = max(-N+t3-1000*t2+2,0); t4 <= min(T-1000*t2-1,t3-1000*t2-1,999); t4++) { - s2(2,t4+1000*t2,1,t3-t4+-1000*t2,1); - } - } -} - -# -# diff --git a/omega/examples/old_test/ts1d-check0 b/omega/examples/old_test/ts1d-check0 deleted file mode 100644 index 9db25df..0000000 --- a/omega/examples/old_test/ts1d-check0 +++ /dev/null @@ -1,176 +0,0 @@ -# This is the file facts.prew, which is prepended to the .prew files -# for the particular code generation we want, defines things like the -# iteration space and dependences. Known facts are inserted by the -# Makefile. -# -# If you're looking at a .w file instead of facts.prew, then you should -# remember to edit the original .prew files, not the .w files. -# -# This facts.prew file describes the program -# -# for(i = 0; i <= N-1; i++) { -# cur[i]=... -# } -# for(t = 0; t < T; t++) { -# for(i = 0; i <= N-1; i++) { -# old[i]=cur[i]; -# } -# for(i = 1; i <= N-2; i++) { -# cur[i] = (old[i-1]+old[i]+old[i]+old[i+1])*0.25; -# } -# } - - - -# first, the spaces and memory maps - -symbolic T, N; - -IS_INIT := { [1,i,1,0,0] : 0<=i<=N-1 }; -MM_INIT := { [1,i,1,0,0] -> [0,i] : 0<=i<=N-1 }; - -IS_COPY := { [2,t,0,i,1] : 0<=t [t+1,i] : 0<=t [t+1,i] : 0<=t [x',t',y',i',z'] : - (x'>x) or - (x'=x and t'>t) or - (x'=x and t'=t and y'>y) or - (x'=x and t'=t and y'=y and i'>i) or - (x'=x and t'=t and y'=y and i'=i and z'>z) }; -FWD7 := {[x,t,y,i,z,a,b] -> [x',t',y',i',z',a',b'] : - (x'>x) or - (x'=x and t'>t) or - (x'=x and t'=t and y'>y) or - (x'=x and t'=t and y'=y and i'>i) or - (x'=x and t'=t and y'=y and i'=i and z'>z) or - (x'=x and t'=t and y'=y and i'=i and z'=z and a'>a) or - (x'=x and t'=t and y'=y and i'=i and z'=z and a'=a and b'>b) }; -BWD5 := inverse FWD5; -BWD7 := inverse FWD7; -EQi := {[x,t,y,i,z] -> [x',t',y',i',z'] : i'=i }; - -# output deps - -OAA := (IS_COPY * IS_COPY) intersection FWD5 intersection EQi; -OCC := (IS_CALC * IS_CALC) intersection FWD5 intersection EQi; - -# combined flow/anti deps - -FAC := (IS_COPY * IS_CALC) intersection FWD5 intersection {[2,t,0,i,1] -> [2,t',1,i',1] : (i'-1<=i<=i'+1)}; -FCA := (IS_CALC * IS_COPY) intersection FWD5 intersection {[2,t,1,i,1] -> [2,t',0,i',1] : (i-1<=i'<=i+1)}; - -# total memory deps in the "core" - -COREMEMDEPS := OAA union OCC union FAC union FCA; - - - -# data flow for original code: - -DF_12p1 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,0,0,i,1] : 0 [2,t,0,0,1] }; -DF_12p3 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,t,0,i,1] : i=N-1 && N>1 }; -DF_32 := ( IS_CALC * IS_COPY ) intersection {[2,t,1,i,1] -> [2,t+1,0,i,1]}; - -DF_23a := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i+1,1] }; -DF_23b := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i,1] }; -DF_23c := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i-1,1] }; - - -# data flow for array expanded code, -# after forward substitution of "old[i] = cur[i]" - -DF1Ia := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; -DF1Ib := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t>0 && i=0 } restrictDomain IS_INIT restrictRange IS_CALC; -DF1C := { [2,t,1,i,1] -> [2,t+1,1,i+1,1] } restrictDomain IS_CALC restrictRange IS_CALC; -DF2I := { [1,i,1,0,0] -> [2,t,1,i,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; -DF2C := { [2,t,1,i,1] -> [2,t+1,1,i+0,1] } restrictDomain IS_CALC restrictRange IS_CALC; -DF3Ia := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; -DF3Ib := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t>0 && i=N-1 } restrictDomain IS_INIT restrictRange IS_CALC; -DF3C := { [2,t,1,i,1] -> [2,t+1,1,i-1,1] } restrictDomain IS_CALC restrictRange IS_CALC; - -# total data flow - -COREDATAFLOW := DF1C union DF2C union DF3C; - - -# arity expansion relations -ex_0_5v := { [] -> [a,b,c,d,e] }; -ex_0_7v := { [] -> [a,b,c,d,e,f,g] }; -ex_3_5 := { [a,b,c] -> [a,b,c,0,0] }; -ex_3_7 := { [a,b,c] -> [a,b,c,0,0,0,0] }; -ex_5_7 := { [a,b,c,d,e] -> [a,b,c,d,e,0,0] }; - -ex_5_3 := { [a,b,c,0,0] -> [a,b,c] }; -ex_7_3 := { [a,b,c,0,0,0,0] -> [a,b,c] }; -ex_7_5 := { [a,b,c,d,e,0,0] -> [a,b,c,d,e] }; - - -# stuff used in skew and tskew - -# Here is the description of time skewing from the current draft of the paper. -IS_Trans := { [2,t,1,i,1] -> [2,tb,1,s,1,tt,1] : - 0<=tt<1000 && s=i+1*t && t=1000*tb+tt }; - -IS_Tinv := inverse IS_Trans; - -# We use it to transform the iteration spaces -TS_IS_CALC := IS_CALC join IS_Trans; -# for some reason OC refuses do to this "join" but will do the reverse: -# TS_IS_INIT := ex_7_5 join IS_INIT; -TS_IS_INIT := IS_INIT join (inverse ex_7_5); - -# Now we can update the data flow relations to correspond to the new I.S.'s -TS_DF1Ia := ex_7_5 join DF1Ia join IS_Trans; -TS_DF1Ib := ex_7_5 join DF1Ib join IS_Trans; -TS_DF1C := IS_Tinv join DF1C join IS_Trans; -TS_DF2I := ex_7_5 join DF2I join IS_Trans; -TS_DF2C := IS_Tinv join DF2C join IS_Trans; -TS_DF3Ia := ex_7_5 join DF3Ia join IS_Trans; -TS_DF3Ib := ex_7_5 join DF3Ib join IS_Trans; -TS_DF3C := IS_Tinv join DF3C join IS_Trans; - - -KNOWN := { [] : T >= 0 and N >= 4 }; - -# Lets try to build up the equivalent of the time skewing transformation, -# IS_Trans := { [2,t,1,i,1] -> [2,tb,1,x,1,y,1] : -# 1000*tb<=t-1<=1000*(tb+1)-1 && y=t-1000*tb && x=y+i }; -# for both statements together, right from the diagram in the new TOPLAS stuff. - -# original code without mmap -# - -# First, look at it as a wider space - -WIDEN := { [2, t, s, i , 1] -> [2, 2t+s, 0, i, 1] : 0<=s<=1 }; -TSKEW := { [2, t, 0, i , 1] -> [2, tb, t+i, tt, 1] : - 1000*tb+tt = t and 0 <= tt < 1000 }; - -TSKEW_2LOOPS := WIDEN join TSKEW; -# print this for the paper - -# I think this should work but it blows up codegen: -# codegen -# IS_INIT, TSKEW_2LOOPS : IS_COPY, TSKEW_2LOOPS : IS_CALC -# given (KNOWN join ex_0_5v); - -# So we fake it as follows, -# relying on the fact that neither "t" nor "s" is used in any statement - -WIDEN0 := { [2, t, 0, i , 1] -> [2, 2t, 0, i, 1] }; -WIDEN1 := { [2, t, 1, i , 1] -> [2, 2t+1, 0, i, 1] }; - -codegen - IS_INIT, TSKEW : (IS_COPY join WIDEN0) , TSKEW : (IS_CALC join WIDEN1) -given (KNOWN join ex_0_5v); - diff --git a/omega/examples/old_test/ts1d-check0.oc-rt b/omega/examples/old_test/ts1d-check0.oc-rt deleted file mode 100644 index a258f26..0000000 --- a/omega/examples/old_test/ts1d-check0.oc-rt +++ /dev/null @@ -1,260 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# # This is the file facts.prew, which is prepended to the .prew files -# # for the particular code generation we want, defines things like the -# # iteration space and dependences. Known facts are inserted by the -# # Makefile. -# # -# # If you're looking at a .w file instead of facts.prew, then you should -# # remember to edit the original .prew files, not the .w files. -# # -# # This facts.prew file describes the program -# # -# # for(i = 0; i <= N-1; i++) { -# # cur[i]=... -# # } -# # for(t = 0; t < T; t++) { -# # for(i = 0; i <= N-1; i++) { -# # old[i]=cur[i]; -# # } -# # for(i = 1; i <= N-2; i++) { -# # cur[i] = (old[i-1]+old[i]+old[i]+old[i+1])*0.25; -# # } -# # } -# -# -# -# # first, the spaces and memory maps -# -# symbolic T, N; -# -# -# IS_INIT := { [1,i,1,0,0] : 0<=i<=N-1 }; -# -# MM_INIT := { [1,i,1,0,0] -> [0,i] : 0<=i<=N-1 }; -# -# -# IS_COPY := { [2,t,0,i,1] : 0<=t [t+1,i] : 0<=t [t+1,i] : 0<=t [x',t',y',i',z'] : -# (x'>x) or -# (x'=x and t'>t) or -# (x'=x and t'=t and y'>y) or -# (x'=x and t'=t and y'=y and i'>i) or -# (x'=x and t'=t and y'=y and i'=i and z'>z) }; -# -# FWD7 := {[x,t,y,i,z,a,b] -> [x',t',y',i',z',a',b'] : -# (x'>x) or -# (x'=x and t'>t) or -# (x'=x and t'=t and y'>y) or -# (x'=x and t'=t and y'=y and i'>i) or -# (x'=x and t'=t and y'=y and i'=i and z'>z) or -# (x'=x and t'=t and y'=y and i'=i and z'=z and a'>a) or -# (x'=x and t'=t and y'=y and i'=i and z'=z and a'=a and b'>b) }; -# -# BWD5 := inverse FWD5; -# -# BWD7 := inverse FWD7; -# -# EQi := {[x,t,y,i,z] -> [x',t',y',i',z'] : i'=i }; -# -# -# # output deps -# -# OAA := (IS_COPY * IS_COPY) intersection FWD5 intersection EQi; -# -# OCC := (IS_CALC * IS_CALC) intersection FWD5 intersection EQi; -# -# -# # combined flow/anti deps -# -# FAC := (IS_COPY * IS_CALC) intersection FWD5 intersection {[2,t,0,i,1] -> [2,t',1,i',1] : (i'-1<=i<=i'+1)}; -# -# FCA := (IS_CALC * IS_COPY) intersection FWD5 intersection {[2,t,1,i,1] -> [2,t',0,i',1] : (i-1<=i'<=i+1)}; -# -# -# # total memory deps in the "core" -# -# COREMEMDEPS := OAA union OCC union FAC union FCA; -# -# -# -# -# # data flow for original code: -# -# DF_12p1 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,0,0,i,1] : 0 [2,t,0,0,1] }; -# -# DF_12p3 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,t,0,i,1] : i=N-1 && N>1 }; -# -# DF_32 := ( IS_CALC * IS_COPY ) intersection {[2,t,1,i,1] -> [2,t+1,0,i,1]}; -# -# -# DF_23a := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i+1,1] }; -# -# DF_23b := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i,1] }; -# -# DF_23c := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i-1,1] }; -# -# -# -# # data flow for array expanded code, -# # after forward substitution of "old[i] = cur[i]" -# -# DF1Ia := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; -# -# DF1Ib := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t>0 && i=0 } restrictDomain IS_INIT restrictRange IS_CALC; -# -# DF1C := { [2,t,1,i,1] -> [2,t+1,1,i+1,1] } restrictDomain IS_CALC restrictRange IS_CALC; -# -# DF2I := { [1,i,1,0,0] -> [2,t,1,i,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; -# -# DF2C := { [2,t,1,i,1] -> [2,t+1,1,i+0,1] } restrictDomain IS_CALC restrictRange IS_CALC; -# -# DF3Ia := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; -# -# DF3Ib := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t>0 && i=N-1 } restrictDomain IS_INIT restrictRange IS_CALC; -# -# DF3C := { [2,t,1,i,1] -> [2,t+1,1,i-1,1] } restrictDomain IS_CALC restrictRange IS_CALC; -# -# -# # total data flow -# -# COREDATAFLOW := DF1C union DF2C union DF3C; -# -# -# -# # arity expansion relations -# ex_0_5v := { [] -> [a,b,c,d,e] }; -# -# ex_0_7v := { [] -> [a,b,c,d,e,f,g] }; -# -# ex_3_5 := { [a,b,c] -> [a,b,c,0,0] }; -# -# ex_3_7 := { [a,b,c] -> [a,b,c,0,0,0,0] }; -# -# ex_5_7 := { [a,b,c,d,e] -> [a,b,c,d,e,0,0] }; -# -# -# ex_5_3 := { [a,b,c,0,0] -> [a,b,c] }; -# -# ex_7_3 := { [a,b,c,0,0,0,0] -> [a,b,c] }; -# -# ex_7_5 := { [a,b,c,d,e,0,0] -> [a,b,c,d,e] }; -# -# -# -# # stuff used in skew and tskew -# -# # Here is the description of time skewing from the current draft of the paper. -# IS_Trans := { [2,t,1,i,1] -> [2,tb,1,s,1,tt,1] : -# 0<=tt<1000 && s=i+1*t && t=1000*tb+tt }; -# -# -# IS_Tinv := inverse IS_Trans; -# -# -# # We use it to transform the iteration spaces -# TS_IS_CALC := IS_CALC join IS_Trans; -# -# # for some reason OC refuses do to this "join" but will do the reverse: -# # TS_IS_INIT := ex_7_5 join IS_INIT; -# TS_IS_INIT := IS_INIT join (inverse ex_7_5); -# -# -# # Now we can update the data flow relations to correspond to the new I.S.'s -# TS_DF1Ia := ex_7_5 join DF1Ia join IS_Trans; -# -# TS_DF1Ib := ex_7_5 join DF1Ib join IS_Trans; -# -# TS_DF1C := IS_Tinv join DF1C join IS_Trans; -# -# TS_DF2I := ex_7_5 join DF2I join IS_Trans; -# -# TS_DF2C := IS_Tinv join DF2C join IS_Trans; -# -# TS_DF3Ia := ex_7_5 join DF3Ia join IS_Trans; -# -# TS_DF3Ib := ex_7_5 join DF3Ib join IS_Trans; -# -# TS_DF3C := IS_Tinv join DF3C join IS_Trans; -# -# -# -# KNOWN := { [] : T >= 0 and N >= 4 }; -# -# -# # Lets try to build up the equivalent of the time skewing transformation, -# # IS_Trans := { [2,t,1,i,1] -> [2,tb,1,x,1,y,1] : -# # 1000*tb<=t-1<=1000*(tb+1)-1 && y=t-1000*tb && x=y+i }; -# # for both statements together, right from the diagram in the new TOPLAS stuff. -# -# # original code without mmap -# # -# -# # First, look at it as a wider space -# -# WIDEN := { [2, t, s, i , 1] -> [2, 2t+s, 0, i, 1] : 0<=s<=1 }; -# -# TSKEW := { [2, t, 0, i , 1] -> [2, tb, t+i, tt, 1] : -# 1000*tb+tt = t and 0 <= tt < 1000 }; -# -# -# TSKEW_2LOOPS := WIDEN join TSKEW; -# -# # print this for the paper -# -# # I think this should work but it blows up codegen: -# # codegen -# # IS_INIT, TSKEW_2LOOPS : IS_COPY, TSKEW_2LOOPS : IS_CALC -# # given (KNOWN join ex_0_5v); -# -# # So we fake it as follows, -# # relying on the fact that neither "t" nor "s" is used in any statement -# -# WIDEN0 := { [2, t, 0, i , 1] -> [2, 2t, 0, i, 1] }; -# -# WIDEN1 := { [2, t, 1, i , 1] -> [2, 2t+1, 0, i, 1] }; -# -# -# codegen -# IS_INIT, TSKEW : (IS_COPY join WIDEN0) , TSKEW : (IS_CALC join WIDEN1) -# given (KNOWN join ex_0_5v); -for(t2 = 0; t2 <= N-1; t2++) { - s1(1,t2,1,0,0); -} -for(t2 = 0; t2 <= intDiv(T-1,500); t2++) { - for(t3 = 1000*t2; t3 <= min(1000*t2+N+997,N+2*T-3); t3++) { - if (intMod(-N+t3+1,2) == 0 && 1000*t2 <= -N+t3+1) { - s2(2,t3-N+1,0,N-1,1); - } - for(t4 = max(-1000*t2-N+t3+2,0); t4 <= min(-1000*t2+2*T-1,-1000*t2+t3-1,999); t4++) { - if (intMod(t4,2) == 0) { - s2(2,t4+1000*t2,0,t3-t4+-1000*t2,1); - } - if (intMod(t4+1,2) == 0) { - s3(2,t4+1000*t2,0,t3-t4+-1000*t2,1); - } - } - if (intMod(t3,2) == 0 && 2*T >= t3+2 && 1000*t2 >= t3-998) { - s2(2,t3,0,0,1); - } - } -} - -# -# diff --git a/omega/examples/old_test/ts1d-mp-i_ts-m_b b/omega/examples/old_test/ts1d-mp-i_ts-m_b deleted file mode 100644 index f288263..0000000 --- a/omega/examples/old_test/ts1d-mp-i_ts-m_b +++ /dev/null @@ -1,289 +0,0 @@ -# This is the file facts.prew, which is prepended to the .prew files -# for the particular code generation we want, defines things like the -# iteration space and dependences. Known facts are inserted by the -# Makefile. -# -# If you're looking at a .w file instead of facts.prew, then you should -# remember to edit the original .prew files, not the .w files. -# -# This facts.prew file describes the program -# -# for(i = 0; i <= N-1; i++) { -# cur[i]=... -# } -# for(t = 0; t < T; t++) { -# for(i = 0; i <= N-1; i++) { -# old[i]=cur[i]; -# } -# for(i = 1; i <= N-2; i++) { -# cur[i] = (old[i-1]+old[i]+old[i]+old[i+1])*0.25; -# } -# } - - - -# first, the spaces and memory maps - -symbolic T, N; - -IS_INIT := { [1,i,1,0,0] : 0<=i<=N-1 }; -MM_INIT := { [1,i,1,0,0] -> [0,i] : 0<=i<=N-1 }; - -IS_COPY := { [2,t,0,i,1] : 0<=t [t+1,i] : 0<=t [t+1,i] : 0<=t [x',t',y',i',z'] : - (x'>x) or - (x'=x and t'>t) or - (x'=x and t'=t and y'>y) or - (x'=x and t'=t and y'=y and i'>i) or - (x'=x and t'=t and y'=y and i'=i and z'>z) }; -FWD7 := {[x,t,y,i,z,a,b] -> [x',t',y',i',z',a',b'] : - (x'>x) or - (x'=x and t'>t) or - (x'=x and t'=t and y'>y) or - (x'=x and t'=t and y'=y and i'>i) or - (x'=x and t'=t and y'=y and i'=i and z'>z) or - (x'=x and t'=t and y'=y and i'=i and z'=z and a'>a) or - (x'=x and t'=t and y'=y and i'=i and z'=z and a'=a and b'>b) }; -BWD5 := inverse FWD5; -BWD7 := inverse FWD7; -EQi := {[x,t,y,i,z] -> [x',t',y',i',z'] : i'=i }; - -# output deps - -OAA := (IS_COPY * IS_COPY) intersection FWD5 intersection EQi; -OCC := (IS_CALC * IS_CALC) intersection FWD5 intersection EQi; - -# combined flow/anti deps - -FAC := (IS_COPY * IS_CALC) intersection FWD5 intersection {[2,t,0,i,1] -> [2,t',1,i',1] : (i'-1<=i<=i'+1)}; -FCA := (IS_CALC * IS_COPY) intersection FWD5 intersection {[2,t,1,i,1] -> [2,t',0,i',1] : (i-1<=i'<=i+1)}; - -# total memory deps in the "core" - -COREMEMDEPS := OAA union OCC union FAC union FCA; - - - -# data flow for original code: - -DF_12p1 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,0,0,i,1] : 0 [2,t,0,0,1] }; -DF_12p3 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,t,0,i,1] : i=N-1 && N>1 }; -DF_32 := ( IS_CALC * IS_COPY ) intersection {[2,t,1,i,1] -> [2,t+1,0,i,1]}; - -DF_23a := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i+1,1] }; -DF_23b := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i,1] }; -DF_23c := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i-1,1] }; - - -# data flow for array expanded code, -# after forward substitution of "old[i] = cur[i]" - -DF1Ia := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; -DF1Ib := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t>0 && i=0 } restrictDomain IS_INIT restrictRange IS_CALC; -DF1C := { [2,t,1,i,1] -> [2,t+1,1,i+1,1] } restrictDomain IS_CALC restrictRange IS_CALC; -DF2I := { [1,i,1,0,0] -> [2,t,1,i,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; -DF2C := { [2,t,1,i,1] -> [2,t+1,1,i+0,1] } restrictDomain IS_CALC restrictRange IS_CALC; -DF3Ia := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; -DF3Ib := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t>0 && i=N-1 } restrictDomain IS_INIT restrictRange IS_CALC; -DF3C := { [2,t,1,i,1] -> [2,t+1,1,i-1,1] } restrictDomain IS_CALC restrictRange IS_CALC; - -# total data flow - -COREDATAFLOW := DF1C union DF2C union DF3C; - - -# arity expansion relations -ex_0_5v := { [] -> [a,b,c,d,e] }; -ex_0_7v := { [] -> [a,b,c,d,e,f,g] }; -ex_3_5 := { [a,b,c] -> [a,b,c,0,0] }; -ex_3_7 := { [a,b,c] -> [a,b,c,0,0,0,0] }; -ex_5_7 := { [a,b,c,d,e] -> [a,b,c,d,e,0,0] }; - -ex_5_3 := { [a,b,c,0,0] -> [a,b,c] }; -ex_7_3 := { [a,b,c,0,0,0,0] -> [a,b,c] }; -ex_7_5 := { [a,b,c,d,e,0,0] -> [a,b,c,d,e] }; - - -# stuff used in skew and tskew - -# Here is the description of time skewing from the current draft of the paper. -IS_Trans := { [2,t,1,i,1] -> [2,tb,1,s,1,tt,1] : - 0<=tt<500 && s=i+1*t && t=500*tb+tt }; - -IS_Tinv := inverse IS_Trans; - -# We use it to transform the iteration spaces -TS_IS_CALC := IS_CALC join IS_Trans; -# for some reason OC refuses do to this "join" but will do the reverse: -# TS_IS_INIT := ex_7_5 join IS_INIT; -TS_IS_INIT := IS_INIT join (inverse ex_7_5); - -# Now we can update the data flow relations to correspond to the new I.S.'s -TS_DF1Ia := ex_7_5 join DF1Ia join IS_Trans; -TS_DF1Ib := ex_7_5 join DF1Ib join IS_Trans; -TS_DF1C := IS_Tinv join DF1C join IS_Trans; -TS_DF2I := ex_7_5 join DF2I join IS_Trans; -TS_DF2C := IS_Tinv join DF2C join IS_Trans; -TS_DF3Ia := ex_7_5 join DF3Ia join IS_Trans; -TS_DF3Ib := ex_7_5 join DF3Ib join IS_Trans; -TS_DF3C := IS_Tinv join DF3C join IS_Trans; - - -KNOWN := { [] : T >= 0 and N >= 4 }; - -# -# multiprocessor version -# time skewed iteration space -# blocked memory mapping -# - -# -# First of all, if 500 is much less than 4000, -# there's a problem with the constraints below. -# To keep send and recv. slices from "crashing", 4000>=2BS+2 (safe approx?) -# - -assertUnsatisfiable( { [] : 4000 < 2 * 500 + 2 } ); - -# this transformation has no existentially quantified variables; -# basically, it factors out the common stuff below, -# but the quantified variables are left in the output, so we can get them -# everything after the 000 is not needed in final xform - -# -# DANGER WILL ROBINSON! -# the .c file depends on the fact that t4 is always the processor number -# - -MP_TSKEW_ALL := { [2, t, 1, i, 1] -> - [2, tb, slice, proc, t+i, tt, 000, t, i, lproc, t0, i0, ie]: -## -## define time block and tt -## - 500*tb+tt = t and 0 <= tt < 500 -## -## define "logical proc", then "wrap" onto physical later: -## "logical proc" (lproc) = (t-i) div sigma -## - and 4000*lproc <= t-i < 4000*(lproc+1) -## -## for uniproc. test, just do proc = -lproc (for multi, proc = lproc % 8) -## - and proc = -lproc -## -## t0,i0 = first iteration in a block; -## t0,ie = maximum "i" in t0 of this block) -## - and t0=500*tb - and t0-ie=4000*lproc - and i0+4000-1=ie -}; - -# -# We need to send things "down" (to same time block of next proc.) -# and "right" (to next time block of next proc.) -# The "+2" is for the things to send right (not mentioned in IPDPS paper). -# - -MP_TSKEW_SEND_SL := MP_TSKEW_ALL join - { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> - [2, tb, 1, proc, t_p_i, tt, 0] : -## define send slice... - (t+i) <= (t0+(500-2) + i0+(500-1) + 2) -}; - -MP_TSKEW_SEND_ME := MP_TSKEW_ALL join - { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> - [2, tb, 2, proc, t_p_i, tt, 0] : -## in the send slice - (t+i) <= (t0+(500-2) + i0+(500-1) + 2) -## and near the (t-i) border: - and (t-i) >= ((t0-i0)-1) -}; - -MP_TSKEW_COMP_SL := MP_TSKEW_ALL join - { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> - [2, tb, 3, proc, t_p_i, tt, 0] : -## define computation slice... -## not send - (t+i) > (t0+(500-2) + i0+(500-1) + 2) -## and not recv - and (t+i) <= (t0+ie) -}; - - - -# Receive the iterations that we sent, -# but after the calculation, -# and on the neighbor (lower) processor - -MP_TSKEW_R_FROM_ME := MP_TSKEW_SEND_ME join - { [2, tb, 2, proc, t_p_i, tt, 0] -> - [2, tb, 4, proc-1, t_p_i, tt, 0] }; - - -MP_TSKEW_RECV_SL := MP_TSKEW_ALL join - { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> - [2, tb, 5, proc, t_p_i, tt, 0] : -## define recv slice... - (t+i) > (t0+ie) -}; - - - - -## stuff to gather each processor's final results... - -IS_GATHER := IS_CALC intersection { [2,t,1,i,1] : t=T-1 }; - -GATHER_EXPANDER := MP_TSKEW_ALL join - { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> - [3, tb, 7, proc, t_p_i, tt, 0] }; - -## stuff to initialize things right in the first place - -### NOTE THAT t4 (processor #) is used in a loop in initialization - -IS_INIT_EXP := { [1,t,i,0,0] : (-1=t && 0<=i<=N-1) || - (0<=t [0,i] : 0<=i<=N-1 }; -# -# -# IS_COPY := { [2,t,0,i,1] : 0<=t [t+1,i] : 0<=t [t+1,i] : 0<=t [x',t',y',i',z'] : -# (x'>x) or -# (x'=x and t'>t) or -# (x'=x and t'=t and y'>y) or -# (x'=x and t'=t and y'=y and i'>i) or -# (x'=x and t'=t and y'=y and i'=i and z'>z) }; -# -# FWD7 := {[x,t,y,i,z,a,b] -> [x',t',y',i',z',a',b'] : -# (x'>x) or -# (x'=x and t'>t) or -# (x'=x and t'=t and y'>y) or -# (x'=x and t'=t and y'=y and i'>i) or -# (x'=x and t'=t and y'=y and i'=i and z'>z) or -# (x'=x and t'=t and y'=y and i'=i and z'=z and a'>a) or -# (x'=x and t'=t and y'=y and i'=i and z'=z and a'=a and b'>b) }; -# -# BWD5 := inverse FWD5; -# -# BWD7 := inverse FWD7; -# -# EQi := {[x,t,y,i,z] -> [x',t',y',i',z'] : i'=i }; -# -# -# # output deps -# -# OAA := (IS_COPY * IS_COPY) intersection FWD5 intersection EQi; -# -# OCC := (IS_CALC * IS_CALC) intersection FWD5 intersection EQi; -# -# -# # combined flow/anti deps -# -# FAC := (IS_COPY * IS_CALC) intersection FWD5 intersection {[2,t,0,i,1] -> [2,t',1,i',1] : (i'-1<=i<=i'+1)}; -# -# FCA := (IS_CALC * IS_COPY) intersection FWD5 intersection {[2,t,1,i,1] -> [2,t',0,i',1] : (i-1<=i'<=i+1)}; -# -# -# # total memory deps in the "core" -# -# COREMEMDEPS := OAA union OCC union FAC union FCA; -# -# -# -# -# # data flow for original code: -# -# DF_12p1 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,0,0,i,1] : 0 [2,t,0,0,1] }; -# -# DF_12p3 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,t,0,i,1] : i=N-1 && N>1 }; -# -# DF_32 := ( IS_CALC * IS_COPY ) intersection {[2,t,1,i,1] -> [2,t+1,0,i,1]}; -# -# -# DF_23a := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i+1,1] }; -# -# DF_23b := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i,1] }; -# -# DF_23c := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i-1,1] }; -# -# -# -# # data flow for array expanded code, -# # after forward substitution of "old[i] = cur[i]" -# -# DF1Ia := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; -# -# DF1Ib := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t>0 && i=0 } restrictDomain IS_INIT restrictRange IS_CALC; -# -# DF1C := { [2,t,1,i,1] -> [2,t+1,1,i+1,1] } restrictDomain IS_CALC restrictRange IS_CALC; -# -# DF2I := { [1,i,1,0,0] -> [2,t,1,i,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; -# -# DF2C := { [2,t,1,i,1] -> [2,t+1,1,i+0,1] } restrictDomain IS_CALC restrictRange IS_CALC; -# -# DF3Ia := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; -# -# DF3Ib := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t>0 && i=N-1 } restrictDomain IS_INIT restrictRange IS_CALC; -# -# DF3C := { [2,t,1,i,1] -> [2,t+1,1,i-1,1] } restrictDomain IS_CALC restrictRange IS_CALC; -# -# -# # total data flow -# -# COREDATAFLOW := DF1C union DF2C union DF3C; -# -# -# -# # arity expansion relations -# ex_0_5v := { [] -> [a,b,c,d,e] }; -# -# ex_0_7v := { [] -> [a,b,c,d,e,f,g] }; -# -# ex_3_5 := { [a,b,c] -> [a,b,c,0,0] }; -# -# ex_3_7 := { [a,b,c] -> [a,b,c,0,0,0,0] }; -# -# ex_5_7 := { [a,b,c,d,e] -> [a,b,c,d,e,0,0] }; -# -# -# ex_5_3 := { [a,b,c,0,0] -> [a,b,c] }; -# -# ex_7_3 := { [a,b,c,0,0,0,0] -> [a,b,c] }; -# -# ex_7_5 := { [a,b,c,d,e,0,0] -> [a,b,c,d,e] }; -# -# -# -# # stuff used in skew and tskew -# -# # Here is the description of time skewing from the current draft of the paper. -# IS_Trans := { [2,t,1,i,1] -> [2,tb,1,s,1,tt,1] : -# 0<=tt<500 && s=i+1*t && t=500*tb+tt }; -# -# -# IS_Tinv := inverse IS_Trans; -# -# -# # We use it to transform the iteration spaces -# TS_IS_CALC := IS_CALC join IS_Trans; -# -# # for some reason OC refuses do to this "join" but will do the reverse: -# # TS_IS_INIT := ex_7_5 join IS_INIT; -# TS_IS_INIT := IS_INIT join (inverse ex_7_5); -# -# -# # Now we can update the data flow relations to correspond to the new I.S.'s -# TS_DF1Ia := ex_7_5 join DF1Ia join IS_Trans; -# -# TS_DF1Ib := ex_7_5 join DF1Ib join IS_Trans; -# -# TS_DF1C := IS_Tinv join DF1C join IS_Trans; -# -# TS_DF2I := ex_7_5 join DF2I join IS_Trans; -# -# TS_DF2C := IS_Tinv join DF2C join IS_Trans; -# -# TS_DF3Ia := ex_7_5 join DF3Ia join IS_Trans; -# -# TS_DF3Ib := ex_7_5 join DF3Ib join IS_Trans; -# -# TS_DF3C := IS_Tinv join DF3C join IS_Trans; -# -# -# -# KNOWN := { [] : T >= 0 and N >= 4 }; -# -# -# # -# # multiprocessor version -# # time skewed iteration space -# # blocked memory mapping -# # -# -# # -# # First of all, if 500 is much less than 4000, -# # there's a problem with the constraints below. -# # To keep send and recv. slices from "crashing", 4000>=2BS+2 (safe approx?) -# # -# -# assertUnsatisfiable( { [] : 4000 < 2 * 500 + 2 } ); - -{ FALSE } - -# -# -# # this transformation has no existentially quantified variables; -# # basically, it factors out the common stuff below, -# # but the quantified variables are left in the output, so we can get them -# # everything after the 000 is not needed in final xform -# -# # -# # DANGER WILL ROBINSON! -# # the .c file depends on the fact that t4 is always the processor number -# # -# -# MP_TSKEW_ALL := { [2, t, 1, i, 1] -> -# [2, tb, slice, proc, t+i, tt, 000, t, i, lproc, t0, i0, ie]: -# ## -# ## define time block and tt -# ## -# 500*tb+tt = t and 0 <= tt < 500 -# ## -# ## define "logical proc", then "wrap" onto physical later: -# ## "logical proc" (lproc) = (t-i) div sigma -# ## -# and 4000*lproc <= t-i < 4000*(lproc+1) -# ## -# ## for uniproc. test, just do proc = -lproc (for multi, proc = lproc % 8) -# ## -# and proc = -lproc -# ## -# ## t0,i0 = first iteration in a block; -# ## t0,ie = maximum "i" in t0 of this block) -# ## -# and t0=500*tb -# and t0-ie=4000*lproc -# and i0+4000-1=ie -# }; -# -# -# # -# # We need to send things "down" (to same time block of next proc.) -# # and "right" (to next time block of next proc.) -# # The "+2" is for the things to send right (not mentioned in IPDPS paper). -# # -# -# MP_TSKEW_SEND_SL := MP_TSKEW_ALL join -# { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> -# [2, tb, 1, proc, t_p_i, tt, 0] : -# ## define send slice... -# (t+i) <= (t0+(500-2) + i0+(500-1) + 2) -# }; -# -# -# MP_TSKEW_SEND_ME := MP_TSKEW_ALL join -# { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> -# [2, tb, 2, proc, t_p_i, tt, 0] : -# ## in the send slice -# (t+i) <= (t0+(500-2) + i0+(500-1) + 2) -# ## and near the (t-i) border: -# and (t-i) >= ((t0-i0)-1) -# }; -# -# -# MP_TSKEW_COMP_SL := MP_TSKEW_ALL join -# { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> -# [2, tb, 3, proc, t_p_i, tt, 0] : -# ## define computation slice... -# ## not send -# (t+i) > (t0+(500-2) + i0+(500-1) + 2) -# ## and not recv -# and (t+i) <= (t0+ie) -# }; -# -# -# -# -# # Receive the iterations that we sent, -# # but after the calculation, -# # and on the neighbor (lower) processor -# -# MP_TSKEW_R_FROM_ME := MP_TSKEW_SEND_ME join -# { [2, tb, 2, proc, t_p_i, tt, 0] -> -# [2, tb, 4, proc-1, t_p_i, tt, 0] }; -# -# -# -# MP_TSKEW_RECV_SL := MP_TSKEW_ALL join -# { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> -# [2, tb, 5, proc, t_p_i, tt, 0] : -# ## define recv slice... -# (t+i) > (t0+ie) -# }; -# -# -# -# -# -# ## stuff to gather each processor's final results... -# -# IS_GATHER := IS_CALC intersection { [2,t,1,i,1] : t=T-1 }; -# -# -# GATHER_EXPANDER := MP_TSKEW_ALL join -# { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> -# [3, tb, 7, proc, t_p_i, tt, 0] }; -# -# -# ## stuff to initialize things right in the first place -# -# ### NOTE THAT t4 (processor #) is used in a loop in initialization -# -# IS_INIT_EXP := { [1,t,i,0,0] : (-1=t && 0<=i<=N-1) || -# (0<=t= 1) { - for(t2 = intDiv(T-500+499,500); t2 <= intDiv(T-1,500); t2++) { - for(t4 = intDiv(-T+2+3999,4000); t4 <= intDiv(N-T+3998,4000); t4++) { - for(t5 = max(4000*t4+2*T-4001,T); t5 <= min(4000*t4+2*T-2,N+T-3); t5++) { - s7(2,T-1,1,t5-T+1,1); - } - } - } -} - -# -# diff --git a/omega/examples/old_test/ts1d-orig0 b/omega/examples/old_test/ts1d-orig0 deleted file mode 100644 index 48e5a10..0000000 --- a/omega/examples/old_test/ts1d-orig0 +++ /dev/null @@ -1,151 +0,0 @@ -# This is the file facts.prew, which is prepended to the .prew files -# for the particular code generation we want, defines things like the -# iteration space and dependences. Known facts are inserted by the -# Makefile. -# -# If you're looking at a .w file instead of facts.prew, then you should -# remember to edit the original .prew files, not the .w files. -# -# This facts.prew file describes the program -# -# for(i = 0; i <= N-1; i++) { -# cur[i]=... -# } -# for(t = 0; t < T; t++) { -# for(i = 0; i <= N-1; i++) { -# old[i]=cur[i]; -# } -# for(i = 1; i <= N-2; i++) { -# cur[i] = (old[i-1]+old[i]+old[i]+old[i+1])*0.25; -# } -# } - - - -# first, the spaces and memory maps - -symbolic T, N; - -IS_INIT := { [1,i,1,0,0] : 0<=i<=N-1 }; -MM_INIT := { [1,i,1,0,0] -> [0,i] : 0<=i<=N-1 }; - -IS_COPY := { [2,t,0,i,1] : 0<=t [t+1,i] : 0<=t [t+1,i] : 0<=t [x',t',y',i',z'] : - (x'>x) or - (x'=x and t'>t) or - (x'=x and t'=t and y'>y) or - (x'=x and t'=t and y'=y and i'>i) or - (x'=x and t'=t and y'=y and i'=i and z'>z) }; -FWD7 := {[x,t,y,i,z,a,b] -> [x',t',y',i',z',a',b'] : - (x'>x) or - (x'=x and t'>t) or - (x'=x and t'=t and y'>y) or - (x'=x and t'=t and y'=y and i'>i) or - (x'=x and t'=t and y'=y and i'=i and z'>z) or - (x'=x and t'=t and y'=y and i'=i and z'=z and a'>a) or - (x'=x and t'=t and y'=y and i'=i and z'=z and a'=a and b'>b) }; -BWD5 := inverse FWD5; -BWD7 := inverse FWD7; -EQi := {[x,t,y,i,z] -> [x',t',y',i',z'] : i'=i }; - -# output deps - -OAA := (IS_COPY * IS_COPY) intersection FWD5 intersection EQi; -OCC := (IS_CALC * IS_CALC) intersection FWD5 intersection EQi; - -# combined flow/anti deps - -FAC := (IS_COPY * IS_CALC) intersection FWD5 intersection {[2,t,0,i,1] -> [2,t',1,i',1] : (i'-1<=i<=i'+1)}; -FCA := (IS_CALC * IS_COPY) intersection FWD5 intersection {[2,t,1,i,1] -> [2,t',0,i',1] : (i-1<=i'<=i+1)}; - -# total memory deps in the "core" - -COREMEMDEPS := OAA union OCC union FAC union FCA; - - - -# data flow for original code: - -DF_12p1 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,0,0,i,1] : 0 [2,t,0,0,1] }; -DF_12p3 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,t,0,i,1] : i=N-1 && N>1 }; -DF_32 := ( IS_CALC * IS_COPY ) intersection {[2,t,1,i,1] -> [2,t+1,0,i,1]}; - -DF_23a := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i+1,1] }; -DF_23b := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i,1] }; -DF_23c := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i-1,1] }; - - -# data flow for array expanded code, -# after forward substitution of "old[i] = cur[i]" - -DF1Ia := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; -DF1Ib := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t>0 && i=0 } restrictDomain IS_INIT restrictRange IS_CALC; -DF1C := { [2,t,1,i,1] -> [2,t+1,1,i+1,1] } restrictDomain IS_CALC restrictRange IS_CALC; -DF2I := { [1,i,1,0,0] -> [2,t,1,i,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; -DF2C := { [2,t,1,i,1] -> [2,t+1,1,i+0,1] } restrictDomain IS_CALC restrictRange IS_CALC; -DF3Ia := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; -DF3Ib := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t>0 && i=N-1 } restrictDomain IS_INIT restrictRange IS_CALC; -DF3C := { [2,t,1,i,1] -> [2,t+1,1,i-1,1] } restrictDomain IS_CALC restrictRange IS_CALC; - -# total data flow - -COREDATAFLOW := DF1C union DF2C union DF3C; - - -# arity expansion relations -ex_0_5v := { [] -> [a,b,c,d,e] }; -ex_0_7v := { [] -> [a,b,c,d,e,f,g] }; -ex_3_5 := { [a,b,c] -> [a,b,c,0,0] }; -ex_3_7 := { [a,b,c] -> [a,b,c,0,0,0,0] }; -ex_5_7 := { [a,b,c,d,e] -> [a,b,c,d,e,0,0] }; - -ex_5_3 := { [a,b,c,0,0] -> [a,b,c] }; -ex_7_3 := { [a,b,c,0,0,0,0] -> [a,b,c] }; -ex_7_5 := { [a,b,c,d,e,0,0] -> [a,b,c,d,e] }; - - -# stuff used in skew and tskew - -# Here is the description of time skewing from the current draft of the paper. -IS_Trans := { [2,t,1,i,1] -> [2,tb,1,s,1,tt,1] : - 0<=tt<1000 && s=i+1*t && t=1000*tb+tt }; - -IS_Tinv := inverse IS_Trans; - -# We use it to transform the iteration spaces -TS_IS_CALC := IS_CALC join IS_Trans; -# for some reason OC refuses do to this "join" but will do the reverse: -# TS_IS_INIT := ex_7_5 join IS_INIT; -TS_IS_INIT := IS_INIT join (inverse ex_7_5); - -# Now we can update the data flow relations to correspond to the new I.S.'s -TS_DF1Ia := ex_7_5 join DF1Ia join IS_Trans; -TS_DF1Ib := ex_7_5 join DF1Ib join IS_Trans; -TS_DF1C := IS_Tinv join DF1C join IS_Trans; -TS_DF2I := ex_7_5 join DF2I join IS_Trans; -TS_DF2C := IS_Tinv join DF2C join IS_Trans; -TS_DF3Ia := ex_7_5 join DF3Ia join IS_Trans; -TS_DF3Ib := ex_7_5 join DF3Ib join IS_Trans; -TS_DF3C := IS_Tinv join DF3C join IS_Trans; - - -KNOWN := { [] : T >= 0 and N >= 4 }; - -# original code without mmap -# - -codegen - IS_INIT, IS_COPY, IS_CALC -given (KNOWN join ex_0_5v); - diff --git a/omega/examples/old_test/ts1d-orig0.oc-rt b/omega/examples/old_test/ts1d-orig0.oc-rt deleted file mode 100644 index 775af7e..0000000 --- a/omega/examples/old_test/ts1d-orig0.oc-rt +++ /dev/null @@ -1,220 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# # This is the file facts.prew, which is prepended to the .prew files -# # for the particular code generation we want, defines things like the -# # iteration space and dependences. Known facts are inserted by the -# # Makefile. -# # -# # If you're looking at a .w file instead of facts.prew, then you should -# # remember to edit the original .prew files, not the .w files. -# # -# # This facts.prew file describes the program -# # -# # for(i = 0; i <= N-1; i++) { -# # cur[i]=... -# # } -# # for(t = 0; t < T; t++) { -# # for(i = 0; i <= N-1; i++) { -# # old[i]=cur[i]; -# # } -# # for(i = 1; i <= N-2; i++) { -# # cur[i] = (old[i-1]+old[i]+old[i]+old[i+1])*0.25; -# # } -# # } -# -# -# -# # first, the spaces and memory maps -# -# symbolic T, N; -# -# -# IS_INIT := { [1,i,1,0,0] : 0<=i<=N-1 }; -# -# MM_INIT := { [1,i,1,0,0] -> [0,i] : 0<=i<=N-1 }; -# -# -# IS_COPY := { [2,t,0,i,1] : 0<=t [t+1,i] : 0<=t [t+1,i] : 0<=t [x',t',y',i',z'] : -# (x'>x) or -# (x'=x and t'>t) or -# (x'=x and t'=t and y'>y) or -# (x'=x and t'=t and y'=y and i'>i) or -# (x'=x and t'=t and y'=y and i'=i and z'>z) }; -# -# FWD7 := {[x,t,y,i,z,a,b] -> [x',t',y',i',z',a',b'] : -# (x'>x) or -# (x'=x and t'>t) or -# (x'=x and t'=t and y'>y) or -# (x'=x and t'=t and y'=y and i'>i) or -# (x'=x and t'=t and y'=y and i'=i and z'>z) or -# (x'=x and t'=t and y'=y and i'=i and z'=z and a'>a) or -# (x'=x and t'=t and y'=y and i'=i and z'=z and a'=a and b'>b) }; -# -# BWD5 := inverse FWD5; -# -# BWD7 := inverse FWD7; -# -# EQi := {[x,t,y,i,z] -> [x',t',y',i',z'] : i'=i }; -# -# -# # output deps -# -# OAA := (IS_COPY * IS_COPY) intersection FWD5 intersection EQi; -# -# OCC := (IS_CALC * IS_CALC) intersection FWD5 intersection EQi; -# -# -# # combined flow/anti deps -# -# FAC := (IS_COPY * IS_CALC) intersection FWD5 intersection {[2,t,0,i,1] -> [2,t',1,i',1] : (i'-1<=i<=i'+1)}; -# -# FCA := (IS_CALC * IS_COPY) intersection FWD5 intersection {[2,t,1,i,1] -> [2,t',0,i',1] : (i-1<=i'<=i+1)}; -# -# -# # total memory deps in the "core" -# -# COREMEMDEPS := OAA union OCC union FAC union FCA; -# -# -# -# -# # data flow for original code: -# -# DF_12p1 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,0,0,i,1] : 0 [2,t,0,0,1] }; -# -# DF_12p3 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,t,0,i,1] : i=N-1 && N>1 }; -# -# DF_32 := ( IS_CALC * IS_COPY ) intersection {[2,t,1,i,1] -> [2,t+1,0,i,1]}; -# -# -# DF_23a := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i+1,1] }; -# -# DF_23b := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i,1] }; -# -# DF_23c := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i-1,1] }; -# -# -# -# # data flow for array expanded code, -# # after forward substitution of "old[i] = cur[i]" -# -# DF1Ia := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; -# -# DF1Ib := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t>0 && i=0 } restrictDomain IS_INIT restrictRange IS_CALC; -# -# DF1C := { [2,t,1,i,1] -> [2,t+1,1,i+1,1] } restrictDomain IS_CALC restrictRange IS_CALC; -# -# DF2I := { [1,i,1,0,0] -> [2,t,1,i,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; -# -# DF2C := { [2,t,1,i,1] -> [2,t+1,1,i+0,1] } restrictDomain IS_CALC restrictRange IS_CALC; -# -# DF3Ia := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; -# -# DF3Ib := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t>0 && i=N-1 } restrictDomain IS_INIT restrictRange IS_CALC; -# -# DF3C := { [2,t,1,i,1] -> [2,t+1,1,i-1,1] } restrictDomain IS_CALC restrictRange IS_CALC; -# -# -# # total data flow -# -# COREDATAFLOW := DF1C union DF2C union DF3C; -# -# -# -# # arity expansion relations -# ex_0_5v := { [] -> [a,b,c,d,e] }; -# -# ex_0_7v := { [] -> [a,b,c,d,e,f,g] }; -# -# ex_3_5 := { [a,b,c] -> [a,b,c,0,0] }; -# -# ex_3_7 := { [a,b,c] -> [a,b,c,0,0,0,0] }; -# -# ex_5_7 := { [a,b,c,d,e] -> [a,b,c,d,e,0,0] }; -# -# -# ex_5_3 := { [a,b,c,0,0] -> [a,b,c] }; -# -# ex_7_3 := { [a,b,c,0,0,0,0] -> [a,b,c] }; -# -# ex_7_5 := { [a,b,c,d,e,0,0] -> [a,b,c,d,e] }; -# -# -# -# # stuff used in skew and tskew -# -# # Here is the description of time skewing from the current draft of the paper. -# IS_Trans := { [2,t,1,i,1] -> [2,tb,1,s,1,tt,1] : -# 0<=tt<1000 && s=i+1*t && t=1000*tb+tt }; -# -# -# IS_Tinv := inverse IS_Trans; -# -# -# # We use it to transform the iteration spaces -# TS_IS_CALC := IS_CALC join IS_Trans; -# -# # for some reason OC refuses do to this "join" but will do the reverse: -# # TS_IS_INIT := ex_7_5 join IS_INIT; -# TS_IS_INIT := IS_INIT join (inverse ex_7_5); -# -# -# # Now we can update the data flow relations to correspond to the new I.S.'s -# TS_DF1Ia := ex_7_5 join DF1Ia join IS_Trans; -# -# TS_DF1Ib := ex_7_5 join DF1Ib join IS_Trans; -# -# TS_DF1C := IS_Tinv join DF1C join IS_Trans; -# -# TS_DF2I := ex_7_5 join DF2I join IS_Trans; -# -# TS_DF2C := IS_Tinv join DF2C join IS_Trans; -# -# TS_DF3Ia := ex_7_5 join DF3Ia join IS_Trans; -# -# TS_DF3Ib := ex_7_5 join DF3Ib join IS_Trans; -# -# TS_DF3C := IS_Tinv join DF3C join IS_Trans; -# -# -# -# KNOWN := { [] : T >= 0 and N >= 4 }; -# -# -# # original code without mmap -# # -# -# codegen -# IS_INIT, IS_COPY, IS_CALC -# given (KNOWN join ex_0_5v); -for(t2 = 0; t2 <= N-1; t2++) { - s1(1,t2,1,0,0); -} -for(t2 = 0; t2 <= T-1; t2++) { - for(t4 = 0; t4 <= N-1; t4++) { - s2(2,t2,0,t4,1); - } - for(t4 = 1; t4 <= N-2; t4++) { - s3(2,t2,1,t4,1); - } -} - -# -# diff --git a/omega/examples/old_test/tseng b/omega/examples/old_test/tseng deleted file mode 100644 index 2ae39f8..0000000 --- a/omega/examples/old_test/tseng +++ /dev/null @@ -1,16 +0,0 @@ -symbolic n; -symbolic LV,UV; -D := {[ i,i+1] -> [i+1,k] : 1 <= i && i+1 < k <= n}; -local := {[i1,k1] -> [i2,k2] : LV <= k1,k2 <= UV }; -sameP := {[i1,k1] -> [i2,k2] : k1=k2 || LV <= k1,k2 <= UV }; -myIter := {[i,k] : LV <= k <= UV}; -lexPos := {[i1,k1] -> [i2,k2] : i1 = i2 && k1 < k2 || i1 < i2}; - -post := D restrictDomain myIter; -wait := D restrictRange myIter; -enforcedTime := sameP intersection lexPos; -enforcedTime; -enforced := enforcedTime compose D union D compose enforcedTime union enforcedTime; -enforced; -post - enforced; -wait - enforced; diff --git a/omega/examples/old_test/tseng.oc-rt b/omega/examples/old_test/tseng.oc-rt deleted file mode 100644 index 53ff139..0000000 --- a/omega/examples/old_test/tseng.oc-rt +++ /dev/null @@ -1,54 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic n; -# -# symbolic LV,UV; -# -# D := {[ i,i+1] -> [i+1,k] : 1 <= i && i+1 < k <= n}; -# -# local := {[i1,k1] -> [i2,k2] : LV <= k1,k2 <= UV }; -# -# sameP := {[i1,k1] -> [i2,k2] : k1=k2 || LV <= k1,k2 <= UV }; -# -# myIter := {[i,k] : LV <= k <= UV}; -# -# lexPos := {[i1,k1] -> [i2,k2] : i1 = i2 && k1 < k2 || i1 < i2}; -# -# -# post := D restrictDomain myIter; -# -# wait := D restrictRange myIter; -# -# enforcedTime := sameP intersection lexPos; -# -# enforcedTime; - -{[i1,k1] -> [i1,k2] : LV <= k1 < k2 <= UV} union - {[i1,k1] -> [i2,k1] : i1 < i2} union - {[i1,k1] -> [i2,k2] : LV <= k1,k2 <= UV && i1 < i2} - -# -# enforced := enforcedTime compose D union D compose enforcedTime union enforcedTime; -# -# enforced; - -{[i1,i1+1] -> [i2,k2] : 1 <= i1 <= n-2, UV-2, i2-2 && LV <= k2 <= UV && LV <= n} union - {[i1,k1] -> [i2,k2] : k1 = 1+i1 && 1 <= i1 <= i2-2, k2-2 && k2 <= n} union - {[i1,i1+1] -> [i1+1,k2] : 1 <= i1 <= n-2, k2-3 && LV < k2 <= UV && LV <= n} union - {[i1,k1] -> [i2,k2] : 2, LV, i1+2 <= i2 < k2 <= n && LV <= k1 <= UV && i2 <= UV} union - {[i1,k1] -> [k1,k2] : 2, i1+2 <= k1 < k2 <= n} union - {[i1,k1] -> [i1+1,k2] : LV <= k1 <= i1 <= k2-2, UV-1 && k2 <= n && 1 <= i1} union - {[i1,k1] -> [i2,k2] : LV <= k1,k2 <= UV && i1 < i2} union - {[i1,k1] -> [i2,k1] : i1 < i2} union - {[i1,k1] -> [i1,k2] : LV <= k1 < k2 <= UV} - -# -# post - enforced; - -{[In_1,In_1+1] -> [In_1+1,Out_2] : 1, LV-1 <= In_1 < UV < Out_2 <= n} - -# -# wait - enforced; - -{[In_1,In_1+1] -> [In_1+1,LV] : In_1+2 <= LV <= n, UV && 1 <= In_1} - -# diff --git a/omega/examples/old_test/verlind1 b/omega/examples/old_test/verlind1 deleted file mode 100644 index 181b1c5..0000000 --- a/omega/examples/old_test/verlind1 +++ /dev/null @@ -1,44 +0,0 @@ - without_simplify; - - R3 := {[x] -> [y] : (y = x) | (y = 3x)}; - - Rf := {[x] -> [y] : x <= y <= 3x}; - - R3; - - Rf; - - s12 := {[x] : 1 <= x <= 2}; - s12; - - sd3 := R3(s12); - sd3; - - sc3 := Rf(s12); - sc3; - - sc3 intersection sd3; - - # I think this is faulty - sc3 - sd3; - - # This is OK - sd3 - sc3; - - complement sc3; - complement sd3; - - sc3; - - sc3 intersection (complement sd3); - - # alternative description of sd3; - sd3' := {[y] : 1 <= y <= 3 | y = 6}; - sd3'; - sc3 - sd3'; - - # sd3 wrt sd3'; - - sd3 - sd3'; - - sd3' - sd3; diff --git a/omega/examples/old_test/verlind1.oc-rt b/omega/examples/old_test/verlind1.oc-rt deleted file mode 100644 index 050b199..0000000 --- a/omega/examples/old_test/verlind1.oc-rt +++ /dev/null @@ -1,120 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# R3 := {[x] -> [y] : (y = x) | (y = 3x)}; -# -# -# Rf := {[x] -> [y] : x <= y <= 3x}; -# -# -# R3; - -{[x] -> [x] } union - {[x] -> [3x] } - -# -# -# Rf; - -{[x] -> [y] : x <= y <= 3x} - -# -# -# s12 := {[x] : 1 <= x <= 2}; -# -# s12; - -{[x]: 1 <= x <= 2} - -# -# -# sd3 := R3(s12); -# -# sd3; - -{[y]: 1 <= y <= 2} union - {[y]: Exists ( alpha : y = 3alpha && 3 <= y <= 6)} - -# -# -# sc3 := Rf(s12); -# -# sc3; - -{[y]: 1 <= y <= 6} - -# -# -# sc3 intersection sd3; - -{[y]: 1 <= y <= 2} union - {[y]: Exists ( alpha : y = 3alpha && 3 <= y <= 6)} - -# -# -# # I think this is faulty -# sc3 - sd3; - -{[y]: 4 <= y <= 5} - -# -# -# # This is OK -# sd3 - sc3; - -{[y] : FALSE } - -# -# -# complement sc3; - -{[y]: y <= 0} union - {[y]: 7 <= y} - -# -# complement sd3; - -{[y]: y <= 0} union - {[y]: 7 <= y} union - {[y]: 4 <= y <= 5} - -# -# -# sc3; - -{[y]: 1 <= y <= 6} - -# -# -# sc3 intersection (complement sd3); - -{[y]: 4 <= y <= 5} - -# -# -# # alternative description of sd3; -# sd3' := {[y] : 1 <= y <= 3 | y = 6}; -# -# sd3'; - -{[y]: 1 <= y <= 3} union - {[6]} - -# -# sc3 - sd3'; - -{[y]: 4 <= y <= 5} - -# -# -# # sd3 wrt sd3'; -# -# sd3 - sd3'; - -{[y] : FALSE } - -# -# -# sd3' - sd3; - -{[y] : FALSE } - -# diff --git a/omega/examples/old_test/verlind1a b/omega/examples/old_test/verlind1a deleted file mode 100644 index e43ec19..0000000 --- a/omega/examples/old_test/verlind1a +++ /dev/null @@ -1,3 +0,0 @@ -R := { [i] : 1 <= i <= 6 & exists (alpha : 3 alpha + 1 <= i <= 3 alpha + 2) - & not (1 <= i <= 2) }; -R; diff --git a/omega/examples/old_test/verlind1a.oc-rt b/omega/examples/old_test/verlind1a.oc-rt deleted file mode 100644 index 11e2d1e..0000000 --- a/omega/examples/old_test/verlind1a.oc-rt +++ /dev/null @@ -1,9 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# R := { [i] : 1 <= i <= 6 & Exists (alpha : 3 alpha + 1 <= i <= 3 alpha + 2) -# & not (1 <= i <= 2) }; -# -# R; - -{[i]: 4 <= i <= 5} - -# diff --git a/omega/examples/old_test/wak1 b/omega/examples/old_test/wak1 deleted file mode 100644 index 5e9e315..0000000 --- a/omega/examples/old_test/wak1 +++ /dev/null @@ -1,13 +0,0 @@ -symbolic a1,a2,a3,b1,b2,b3; - -IS1 := {[i] : a1 <= i <= b1 }; -IS2 := {[i] : a2 <= i <= b2 }; -IS3 := {[i] : a3 <= i <= b3 }; - -T1 := {[i] -> [i,0]}; -T2 := {[i] -> [i,1]}; -T3 := {[i] -> [i,2]}; - -codegen 0 T1:IS1,T2:IS2,T3:IS3; - -codegen T1:IS1,T2:IS2,T3:IS3; diff --git a/omega/examples/old_test/wak1.oc-rt b/omega/examples/old_test/wak1.oc-rt deleted file mode 100644 index e8bdf0e..0000000 --- a/omega/examples/old_test/wak1.oc-rt +++ /dev/null @@ -1,87 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# -# Symbolic a1,a2,a3,b1,b2,b3; -# -# -# IS1 := {[i] : a1 <= i <= b1 }; -# -# IS2 := {[i] : a2 <= i <= b2 }; -# -# IS3 := {[i] : a3 <= i <= b3 }; -# -# -# T1 := {[i] -> [i,0]}; -# -# T2 := {[i] -> [i,1]}; -# -# T3 := {[i] -> [i,2]}; -# -# -# codegen T1:IS1,T2:IS2,T3:IS3; -for(t1 = a3; t1 <= min(b3,a1-1,a2-1); t1++) { - s3(t1); -} -for(t1 = a2; t1 <= min(b2,a1-1,a3-1,b3); t1++) { - s2(t1); -} -for(t1 = max(a2,a3); t1 <= min(a1-1,b2,b3); t1++) { - s2(t1); - s3(t1); -} -for(t1 = max(a2,b3+1); t1 <= min(b2,a1-1); t1++) { - s2(t1); -} -for(t1 = max(a3,a2,b2+1); t1 <= min(b3,a1-1); t1++) { - s3(t1); -} -for(t1 = a1; t1 <= min(b1,a3-1,b3,a2-1); t1++) { - s1(t1); -} -for(t1 = max(a1,a3); t1 <= min(b1,a2-1,b3); t1++) { - s1(t1); - s3(t1); -} -for(t1 = max(a1,b3+1); t1 <= min(b1,a2-1); t1++) { - s1(t1); -} -for(t1 = max(a1,a2); t1 <= min(b1,b2,a3-1); t1++) { - s1(t1); - s2(t1); -} -for(t1 = max(a1,a2,a3); t1 <= min(b1,b2,b3); t1++) { - s1(t1); - s2(t1); - s3(t1); -} -for(t1 = max(a1,a2,a3,b3+1); t1 <= min(b1,b2); t1++) { - s1(t1); - s2(t1); -} -for(t1 = max(a1,b2+1,a2); t1 <= min(b1,a3-1); t1++) { - s1(t1); -} -for(t1 = max(a1,a2,b2+1,a3); t1 <= min(b1,b3); t1++) { - s1(t1); - s3(t1); -} -for(t1 = max(a1,b3+1,a3,a2,b2+1); t1 <= b1; t1++) { - s1(t1); -} -for(t1 = max(a3,a1,b1+1); t1 <= min(b3,b2,a2-1); t1++) { - s3(t1); -} -for(t1 = max(a2,a1,b1+1); t1 <= min(b2,a3-1); t1++) { - s2(t1); -} -for(t1 = max(a1,b1+1,a2,a3); t1 <= min(b2,b3); t1++) { - s2(t1); - s3(t1); -} -for(t1 = max(a2,a1,b1+1,b3+1,a3); t1 <= b2; t1++) { - s2(t1); -} -for(t1 = max(a3,a1,b1+1,b2+1); t1 <= b3; t1++) { - s3(t1); -} - -# diff --git a/omega/examples/old_test/wak2 b/omega/examples/old_test/wak2 deleted file mode 100644 index 927fc2f..0000000 --- a/omega/examples/old_test/wak2 +++ /dev/null @@ -1,10 +0,0 @@ -symbolic a1,a2,b1,b2,c1,c2,d1,d2; - -IS1 := {[i,j] : a1 <= i <= b1 && c1 <= j <= d1}; -IS2 := {[i,j] : a2 <= i <= b2 && c2 <= j <= d2}; - -T1 := {[i,j] -> [i,j,0]}; -T2 := {[i,j] -> [i,j,1]}; - -codegen T1:IS1,T2:IS2; -codegen 2 T1:IS1,T2:IS2; diff --git a/omega/examples/old_test/wak2.oc-rt b/omega/examples/old_test/wak2.oc-rt deleted file mode 100644 index 6dc6270..0000000 --- a/omega/examples/old_test/wak2.oc-rt +++ /dev/null @@ -1,307 +0,0 @@ ->>> Symbolic a1,a2,b1,b2,c1,c2,d1,d2; ->>> ->>> IS1 := {[i,j] : a1 <= i <= b1 && c1 <= j <= d1}; ->>> IS2 := {[i,j] : a2 <= i <= b2 && c2 <= j <= d2}; ->>> ->>> T1 := {[i,j] -> [i,j,0]}; ->>> T2 := {[i,j] -> [i,j,1]}; ->>> ->>> codegen T1:IS1,T2:IS2; -if (d2 >= c2) { - for(t1 = a2; t1 <= min(a1-1,b2); t1++) { - for(t2 = c2; t2 <= d2; t2++) { - s2(t1,t2); - } - } -} -for(t1 = a1; t1 <= b1; t1++) { - if (t1 >= a2 && t1 <= b2) { - for(t2 = c2; t2 <= min(c1-1,d2); t2++) { - s2(t1,t2); - } - } - if (t1 <= a2-1) { - for(t2 = c1; t2 <= d1; t2++) { - s1(t1,t2); - } - } - if (t1 >= a2 && t1 <= b2) { - for(t2 = c1; t2 <= min(d1,c2-1,d2); t2++) { - s1(t1,t2); - } - } - if (t1 <= b2 && t1 >= a2) { - for(t2 = max(c2,c1); t2 <= min(d2,d1); t2++) { - s1(t1,t2); - s2(t1,t2); - } - } - if (t1 >= a2 && t1 <= b2) { - for(t2 = max(d2+1,c1); t2 <= d1; t2++) { - s1(t1,t2); - } - } - if (t1 >= a2 && t1 >= b2+1) { - for(t2 = c1; t2 <= d1; t2++) { - s1(t1,t2); - } - } - if (t1 >= a2 && t1 <= b2) { - for(t2 = max(c2,d1+1,c1); t2 <= d2; t2++) { - s2(t1,t2); - } - } -} -if (d2 >= c2) { - for(t1 = max(a1,a2,b1+1); t1 <= b2; t1++) { - for(t2 = c2; t2 <= d2; t2++) { - s2(t1,t2); - } - } -} - ->>> codegen 2 T1:IS1,T2:IS2; -if (d2 >= c2) { - for(t1 = a2; t1 <= min(a1-1,b2); t1++) { - for(t2 = c2; t2 <= d2; t2++) { - s2(t1,t2); - } - } -} -if (d1 >= c1) { - for(t1 = a1; t1 <= min(a2-1,b1); t1++) { - for(t2 = c1; t2 <= d1; t2++) { - s1(t1,t2); - } - } -} -if (d1 >= c1 && c1 >= d2+2 && c2 <= d2) { - for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { - for(t2 = c2; t2 <= d2; t2++) { - s2(t1,t2); - } - for(t2 = c1; t2 <= d1; t2++) { - s1(t1,t2); - } - } -} -if (d2 >= c2 && d2 <= c1-2 && d1 <= c1-1) { - for(t1 = max(a1,a2); t1 <= min(b2,b1); t1++) { - for(t2 = c2; t2 <= d2; t2++) { - s2(t1,t2); - } - } -} -if (c1 >= c2+1 && d1 <= d2-1 && d1 >= c1) { - for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { - for(t2 = c2; t2 <= c1-1; t2++) { - s2(t1,t2); - } - for(t2 = c1; t2 <= d1; t2++) { - s1(t1,t2); - s2(t1,t2); - } - for(t2 = d1+1; t2 <= d2; t2++) { - s2(t1,t2); - } - } -} -if (c1 >= c2+1 && c1 <= d2 && d1 >= d2+1) { - for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { - for(t2 = c2; t2 <= c1-1; t2++) { - s2(t1,t2); - } - for(t2 = c1; t2 <= d2; t2++) { - s1(t1,t2); - s2(t1,t2); - } - for(t2 = d2+1; t2 <= d1; t2++) { - s1(t1,t2); - } - } -} -if (d1 == d2 && d1 >= c1 && c1 >= c2+1) { - for(t1 = max(a2,a1); t1 <= min(b2,b1); t1++) { - for(t2 = c2; t2 <= c1-1; t2++) { - s2(t1,t2); - } - for(t2 = c1; t2 <= d2; t2++) { - s1(t1,t2); - s2(t1,t2); - } - } -} -if (d2 == c1-1 && d2 <= d1-1 && d2 >= c2) { - for(t1 = max(a2,a1); t1 <= min(b2,b1); t1++) { - for(t2 = c2; t2 <= c1-1; t2++) { - s2(t1,t2); - } - for(t2 = c1; t2 <= d1; t2++) { - s1(t1,t2); - } - } -} -if (c2 <= c1-1 && d2 >= c1 && d1 <= c1-1) { - for(t1 = max(a1,a2); t1 <= min(b2,b1); t1++) { - for(t2 = c2; t2 <= c1-1; t2++) { - s2(t1,t2); - } - for(t2 = c1; t2 <= d2; t2++) { - s2(t1,t2); - } - } -} -if (d2 == c1-1 && d2 >= d1 && d2 >= c2) { - for(t1 = max(a1,a2); t1 <= min(b1,b2); t1++) { - for(t2 = c2; t2 <= d2; t2++) { - s2(t1,t2); - } - } -} -if (d1 >= c1 && c1 >= c2+1 && d2 <= c2-1) { - for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { - for(t2 = c1; t2 <= d1; t2++) { - s1(t1,t2); - } - } -} -if (c1 <= c2-1 && d1 >= c2 && d1 <= d2-1) { - for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { - for(t2 = c1; t2 <= c2-1; t2++) { - s1(t1,t2); - } - for(t2 = c2; t2 <= d1; t2++) { - s1(t1,t2); - s2(t1,t2); - } - for(t2 = d1+1; t2 <= d2; t2++) { - s2(t1,t2); - } - } -} -if (c1 <= c2-1 && d1 >= d2+1 && c2 <= d2) { - for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { - for(t2 = c1; t2 <= c2-1; t2++) { - s1(t1,t2); - } - for(t2 = c2; t2 <= d2; t2++) { - s1(t1,t2); - s2(t1,t2); - } - for(t2 = d2+1; t2 <= d1; t2++) { - s1(t1,t2); - } - } -} -if (d1 == d2 && d1 >= c2 && c1 <= c2-1) { - for(t1 = max(a2,a1); t1 <= min(b2,b1); t1++) { - for(t2 = c1; t2 <= c2-1; t2++) { - s1(t1,t2); - } - for(t2 = c2; t2 <= d2; t2++) { - s1(t1,t2); - s2(t1,t2); - } - } -} -if (c2 <= d2 && d1 >= c1 && d1 <= c2-1) { - for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { - for(t2 = c1; t2 <= d1; t2++) { - s1(t1,t2); - } - for(t2 = c2; t2 <= d2; t2++) { - s2(t1,t2); - } - } -} -if (d1 >= c1 && d2 <= c2-1 && d1 <= d2-1) { - for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { - for(t2 = c1; t2 <= d1; t2++) { - s1(t1,t2); - } - } -} -if (d2 >= c1 && d2 <= c2-1 && d1 >= d2+1) { - for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { - for(t2 = c1; t2 <= d2; t2++) { - s1(t1,t2); - } - for(t2 = d2+1; t2 <= d1; t2++) { - s1(t1,t2); - } - } -} -if (d1 == d2 && d1 <= c2-1 && d1 >= c1) { - for(t1 = max(a2,a1); t1 <= min(b2,b1); t1++) { - for(t2 = c1; t2 <= d1; t2++) { - s1(t1,t2); - } - } -} -if (d2 >= c2 && c2 >= c1+1 && d1 <= c1-1) { - for(t1 = max(a1,a2); t1 <= min(b2,b1); t1++) { - for(t2 = c2; t2 <= d2; t2++) { - s2(t1,t2); - } - } -} -if (c2 == c1 && c2 <= d1 && d1 <= d2-1) { - for(t1 = max(a2,a1); t1 <= min(b2,b1); t1++) { - for(t2 = c1; t2 <= d1; t2++) { - s1(t1,t2); - s2(t1,t2); - } - for(t2 = d1+1; t2 <= d2; t2++) { - s2(t1,t2); - } - } -} -if (c2 == c1 && d1 >= d2+1 && c2 <= d2) { - for(t1 = max(a2,a1); t1 <= min(b2,b1); t1++) { - for(t2 = c1; t2 <= d2; t2++) { - s1(t1,t2); - s2(t1,t2); - } - for(t2 = d2+1; t2 <= d1; t2++) { - s1(t1,t2); - } - } -} -if (c1 == c2 && d1 == d2 && d1 >= c1) { - for(t1 = max(a1,a2); t1 <= min(b2,b1); t1++) { - for(t2 = c1; t2 <= d2; t2++) { - s1(t1,t2); - s2(t1,t2); - } - } -} -if (c1 == c2 && c1 >= d1+1 && d2 >= c1) { - for(t1 = max(a1,a2); t1 <= min(b1,b2); t1++) { - for(t2 = c2; t2 <= d2; t2++) { - s2(t1,t2); - } - } -} -if (d1 >= c1 && c1 <= c2 && d2 <= c1-1) { - for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { - for(t2 = c1; t2 <= d1; t2++) { - s1(t1,t2); - } - } -} -if (d1 >= c1) { - for(t1 = max(b2+1,a1,a2); t1 <= b1; t1++) { - for(t2 = c1; t2 <= d1; t2++) { - s1(t1,t2); - } - } -} -if (d2 >= c2) { - for(t1 = max(a1,a2,b1+1); t1 <= b2; t1++) { - for(t2 = c2; t2 <= d2; t2++) { - s2(t1,t2); - } - } -} - - diff --git a/omega/examples/old_test/wak3 b/omega/examples/old_test/wak3 deleted file mode 100644 index 51ca234..0000000 --- a/omega/examples/old_test/wak3 +++ /dev/null @@ -1,12 +0,0 @@ -symbolic a,b; - -IS1 := {[i] : a <= i <= b }; -IS2 := {[i] : a+10 <= i <= b+10 }; -IS3 := {[i] : a+20 <= i <= b+20 }; - -T1 := {[i] -> [i,0]}; -T2 := {[i] -> [i,1]}; -T3 := {[i] -> [i,2]}; - -codegen T1:IS1,T2:IS2,T3:IS3; -codegen 2 T1:IS1,T2:IS2,T3:IS3; diff --git a/omega/examples/old_test/wak3.oc-rt b/omega/examples/old_test/wak3.oc-rt deleted file mode 100644 index 825c72f..0000000 --- a/omega/examples/old_test/wak3.oc-rt +++ /dev/null @@ -1,59 +0,0 @@ ->>> Symbolic a,b; ->>> ->>> IS1 := {[i] : a <= i <= b }; ->>> IS2 := {[i] : a+10 <= i <= b+10 }; ->>> IS3 := {[i] : a+20 <= i <= b+20 }; ->>> ->>> T1 := {[i] -> [i,0]}; ->>> T2 := {[i] -> [i,1]}; ->>> T3 := {[i] -> [i,2]}; ->>> ->>> codegen T1:IS1,T2:IS2,T3:IS3; -for(t1 = a; t1 <= min(b,a+9); t1++) { - s1(t1); -} -for(t1 = a+10; t1 <= min(b,a+19); t1++) { - s1(t1); - s2(t1); -} -for(t1 = a+20; t1 <= b; t1++) { - s1(t1); - s2(t1); - s3(t1); -} -for(t1 = max(a+10,b+1); t1 <= min(b+10,a+19); t1++) { - s2(t1); -} -for(t1 = max(a+20,b+1); t1 <= b+10; t1++) { - s2(t1); - s3(t1); -} -for(t1 = max(a+20,b+11); t1 <= b+20; t1++) { - s3(t1); -} - ->>> codegen 2 T1:IS1,T2:IS2,T3:IS3; -for(t1 = a; t1 <= min(b,a+9); t1++) { - s1(t1); -} -for(t1 = a+10; t1 <= min(b,a+19); t1++) { - s1(t1); - s2(t1); -} -for(t1 = a+20; t1 <= b; t1++) { - s1(t1); - s2(t1); - s3(t1); -} -for(t1 = max(a+10,b+1); t1 <= min(b+10,a+19); t1++) { - s2(t1); -} -for(t1 = max(a+20,b+1); t1 <= b+10; t1++) { - s2(t1); - s3(t1); -} -for(t1 = max(a+20,b+11); t1 <= b+20; t1++) { - s3(t1); -} - - diff --git a/omega/examples/old_test/wak4 b/omega/examples/old_test/wak4 deleted file mode 100644 index 48224b9..0000000 --- a/omega/examples/old_test/wak4 +++ /dev/null @@ -1,9 +0,0 @@ -symbolic a1,a2,a3,a4,a5,b1,b2,b3,b4,b5; -IS1 := {[i] : a1,a2,a3,a4,a5 <= i <= b1,b2,b3,b4,b5 }; -IS2 := {[i] : a1,a2,a3,a4,a5 <= i <= b1,b2,b3,b4,b5 }; - -T1 := {[i] -> [i,0]}; -T2 := {[i] -> [i,1]}; - -codegen T1:IS1,T2:IS2; -codegen 2 T1:IS1,T2:IS2; diff --git a/omega/examples/old_test/wak4.oc-rt b/omega/examples/old_test/wak4.oc-rt deleted file mode 100644 index 5f2cacd..0000000 --- a/omega/examples/old_test/wak4.oc-rt +++ /dev/null @@ -1,20 +0,0 @@ ->>> Symbolic a1,a2,a3,a4,a5,b1,b2,b3,b4,b5; ->>> IS1 := {[i] : a1,a2,a3,a4,a5 <= i <= b1,b2,b3,b4,b5 }; ->>> IS2 := {[i] : a1,a2,a3,a4,a5 <= i <= b1,b2,b3,b4,b5 }; ->>> ->>> T1 := {[i] -> [i,0]}; ->>> T2 := {[i] -> [i,1]}; ->>> ->>> codegen T1:IS1,T2:IS2; -for(t1 = max(a1,a2,a3,a4,a5); t1 <= min(b1,b2,b3,b4,b5); t1++) { - s1(t1); - s2(t1); -} - ->>> codegen 2 T1:IS1,T2:IS2; -for(t1 = max(a1,a2,a3,a4,a5); t1 <= min(b1,b2,b3,b4,b5); t1++) { - s1(t1); - s2(t1); -} - - diff --git a/omega/examples/old_test/wak5 b/omega/examples/old_test/wak5 deleted file mode 100644 index 1232b34..0000000 --- a/omega/examples/old_test/wak5 +++ /dev/null @@ -1,4 +0,0 @@ -S1 := {[1,In_2,0,In_4,In_5,In_6,In_7]: 2 <= In_4 <= 1024 && 2 <= In_2 <= 1024}; -S2 := {[1,In_2,0,In_4,In_5,In_6,In_7]: 1 <= In_4 < In_2 <= 1024}; - -Hull (S1 union S2); diff --git a/omega/examples/old_test/wak5.oc-rt b/omega/examples/old_test/wak5.oc-rt deleted file mode 100644 index 2d5830c..0000000 --- a/omega/examples/old_test/wak5.oc-rt +++ /dev/null @@ -1,11 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# S1 := {[1,In_2,0,In_4,In_5,In_6,In_7]: 2 <= In_4 <= 1024 && 2 <= In_2 <= 1024}; -# -# S2 := {[1,In_2,0,In_4,In_5,In_6,In_7]: 1 <= In_4 < In_2 <= 1024}; -# -# -# Hull (S1 union S2); - -{[1,In_2,0,In_4,In_5,In_6,In_7]: 1 <= In_4 <= 1024 && 2 <= In_2 <= 1024} - -# diff --git a/omega/examples/old_test/wak6 b/omega/examples/old_test/wak6 deleted file mode 100644 index c251ca6..0000000 --- a/omega/examples/old_test/wak6 +++ /dev/null @@ -1,14 +0,0 @@ -T1 := {[k,i,j] -> [k',i,j] : 1 <= k < k' < i <= 1024 && k'+1 <= j <= 1024}; -T2 := {[k,i,j] -> [j,i,j'] : 1 <= k < j < i <= 1024 && j < j' <= 1024}; -T3 := {[k,k+1,k+1] -> [k+1,i',j'] : 1 <= k <= i'-2, j'-2 && j' <= 1024 && i' <= 1024}; - -# The following expression evaluates to FALSE, which I believe is incorrect: - -T3+; - -# And the following cause assertion failures: - -(T2 union T3)+; -(T1 union T2)+; - -# This comes from Guassian Elimination. diff --git a/omega/examples/old_test/wak6.oc-rt b/omega/examples/old_test/wak6.oc-rt deleted file mode 100644 index 458f5e9..0000000 --- a/omega/examples/old_test/wak6.oc-rt +++ /dev/null @@ -1,36 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# T1 := {[k,i,j] -> [k',i,j] : 1 <= k < k' < i <= 1024 && k'+1 <= j <= 1024}; -# -# T2 := {[k,i,j] -> [j,i,j'] : 1 <= k < j < i <= 1024 && j < j' <= 1024}; -# -# T3 := {[k,k+1,k+1] -> [k+1,i',j'] : 1 <= k <= i'-2, j'-2 && j' <= 1024 && i' <= 1024}; -# -# -# # The following expression evaluates to FALSE, which I believe is incorrect: -# -# T3+; - -{[k,k+1,k+1] -> [Out_1,i,j] : 1 <= k < Out_1 < i <= 1024 && Out_1+1 <= j <= 1024} - -# -# -# # And the following cause assertion failures: -# -# (T2 union T3)+; - -{[k,k+1,k+1] -> [j',i',j''] : 1 <= k < j' < i' <= 1024 && j'+1 <= j'' <= 1024} union - {[k,i,i-1] -> [j',i',j''] : k+2 <= i <= j' < j'' <= 1024 && j' < i' <= 1024 && 1 <= k} union - {[k,i,j] -> [j',i',j''] : j+2 <= i <= j' < i' <= 1024 && 1 <= k < j && j' < j'' <= 1024} union - {[k,i,j] -> [j',i,j''] : 1 <= k < j < j' < i <= 1024 && j' < j'' <= 1024} union - {[k,i,j] -> [j,i,j''] : 1 <= k < j < i <= 1024 && j < j'' <= 1024} - -# -# (T1 union T2)+; - -{[k,i,j] -> [Out_1,i,j] : 1 <= k < Out_1 < i <= 1024 && Out_1+1 <= j <= 1024} union - {[k,i,j] -> [Out_1,i,j'] : 1 <= k < j < Out_1 < i <= 1024 && Out_1 < j' <= 1024} union - {[k,i,j] -> [j,i,j'] : 1 <= k < j < i <= 1024 && j < j' <= 1024} - -# -# -# # This comes from Guassian Elimination. diff --git a/omega/examples/old_test/wak7 b/omega/examples/old_test/wak7 deleted file mode 100644 index b122c5a..0000000 --- a/omega/examples/old_test/wak7 +++ /dev/null @@ -1,5 +0,0 @@ -R := {[k,k+1,k+1]: 1 <= k <= 1022} - union {[k,i,j]: 2 <= k < i <= 1024 && k < j <= 1024}; - -Hull R; - diff --git a/omega/examples/old_test/wak7.oc-rt b/omega/examples/old_test/wak7.oc-rt deleted file mode 100644 index 3ccdb0a..0000000 --- a/omega/examples/old_test/wak7.oc-rt +++ /dev/null @@ -1,11 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# R := {[k,k+1,k+1]: 1 <= k <= 1022} -# union {[k,i,j]: 2 <= k < i <= 1024 && k < j <= 1024}; -# -# -# Hull R; - -{[k,i,j]: k+1, 2 <= j <= 1024 && k < i <= 1024} - -# -# diff --git a/omega/examples/old_test/wak8 b/omega/examples/old_test/wak8 deleted file mode 100644 index f55c2b9..0000000 --- a/omega/examples/old_test/wak8 +++ /dev/null @@ -1,15 +0,0 @@ - T1 := {[i1,i2,i3] -> [o1,i2,o3] : 2 <= i2 <= 511 && o1 <= 256 -&& o3 <= 511 && 2 <= i3 && i1+o3 <= i3+o1 - && 255i3+o1 <= i1+255o3 && 1 <= i1}; - -T1; - - T2 := {[i1,i2,i3] -> [o1,i2,o3] : exists ( x: 2 <= i2 <= 511 - && 2 <= o3 <= 509 && o1 <= 256 - && 3+i1+o3 <= i3+o1 && 2o1+o3 <= 511+2x - && 2 <= i3 && i1+2o1+o3 <= i3+3x - && 255i3+511x <= i1+510o1+255o3 && 1 <= i1)}; - -T2; - - T1 compose T2; diff --git a/omega/examples/old_test/wak8.oc-rt b/omega/examples/old_test/wak8.oc-rt deleted file mode 100644 index 10ba68d..0000000 --- a/omega/examples/old_test/wak8.oc-rt +++ /dev/null @@ -1,30 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# T1 := {[i1,i2,i3] -> [o1,i2,o3] : 2 <= i2 <= 511 && o1 <= 256 -# && o3 <= 511 && 2 <= i3 && i1+o3 <= i3+o1 -# && 255i3+o1 <= i1+255o3 && 1 <= i1}; -# -# -# T1; - -{[i1,i2,i3] -> [o1,i2,o3] : 2 <= i2 <= 511 && o1 <= 256 && o3 <= 511 && 2 <= i3 && i1+o3 <= i3+o1 && 255i3+o1 <= i1+255o3 && 1 <= i1} - -# -# -# T2 := {[i1,i2,i3] -> [o1,i2,o3] : Exists ( x: 2 <= i2 <= 511 -# && 2 <= o3 <= 509 && o1 <= 256 -# && 3+i1+o3 <= i3+o1 && 2o1+o3 <= 511+2x -# && 2 <= i3 && i1+2o1+o3 <= i3+3x -# && 255i3+511x <= i1+510o1+255o3 && 1 <= i1)}; -# -# -# T2; - -{[i1,i2,i3] -> [o1,i2,o3] : Exists ( alpha : 2 <= i2 <= 511 && 2 <= o3 <= 509 && o1 <= 256 && 3+i1+o3 <= i3+o1 && 2o1+o3 <= 511+2alpha && 2 <= i3 && i1+2o1+o3 <= i3+3alpha && 255i3+511alpha <= i1+510o1+255o3 && 1 <= i1)} - -# -# -# T1 compose T2; - -{[i1,i2,i3] -> [o1,i2,o3] : Exists ( alpha,beta,gamma : 2 <= i2 <= 511 && 2 <= gamma <= 509 && o1 <= 256 && o3 <= 511 && o3+alpha <= o1+gamma && o1+255gamma <= 255o3+alpha && gamma+2alpha <= 511+2beta && 1 <= i1 && 255i3+511beta <= i1+255gamma+510alpha && i1+gamma+2alpha <= i3+3beta && 2 <= i3 && 3+i1+gamma <= i3+alpha)} - -# diff --git a/omega/examples/old_test/wielage b/omega/examples/old_test/wielage deleted file mode 100644 index f2e3911..0000000 --- a/omega/examples/old_test/wielage +++ /dev/null @@ -1,13 +0,0 @@ -{[k1,k2,k3] : -15+k1+2k2+3k3 = 0 - && k2+k3 <= 0 - && 0 <= 5+k2+k3 - && k3 <= 0 - && 0 <= 5+k3 - && k1+k2+k3 <= 0 - && 0 <= 5+k1+k2+k3 -}; - - -{[x] : exists (a,b : 0 <= x+4a <= 2 && 0 <= x+8b <= 6)}; - diff --git a/omega/examples/old_test/wielage.oc-rt b/omega/examples/old_test/wielage.oc-rt deleted file mode 100644 index 6c4b10a..0000000 --- a/omega/examples/old_test/wielage.oc-rt +++ /dev/null @@ -1,22 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# {[k1,k2,k3] : -# 15+k1+2k2+3k3 = 0 -# && k2+k3 <= 0 -# && 0 <= 5+k2+k3 -# && k3 <= 0 -# && 0 <= 5+k3 -# && k1+k2+k3 <= 0 -# && 0 <= 5+k1+k2+k3 -# }; - -{[0,0,-5]} - -# -# -# -# {[x] : exists (a,b : 0 <= x+4a <= 2 && 0 <= x+8b <= 6)}; - -{[x]: Exists ( alpha,beta : -4alpha <= x <= -4alpha+2, -8beta+6 && alpha <= 2beta)} - -# -# diff --git a/omega/examples/old_test/wild b/omega/examples/old_test/wild deleted file mode 100644 index 7c43e3c..0000000 --- a/omega/examples/old_test/wild +++ /dev/null @@ -1,13 +0,0 @@ -symbolic L,M; - -I := {[j,i] : 1 <= j <= 100 && j-L <= i <= j}; - -D := I*I intersection {[j1,i1] -> [j2,i2] : i1+j1 = i2+M}; -I; -D; -range D; -(range D) - (range D); -E := I - range D; -sample := {[-M+3,-M+3]: L = 0 && -97 <= M <= 2}; -sample intersection range D; -sample intersection E; diff --git a/omega/examples/old_test/wild.oc-rt b/omega/examples/old_test/wild.oc-rt deleted file mode 100644 index 811519b..0000000 --- a/omega/examples/old_test/wild.oc-rt +++ /dev/null @@ -1,43 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic L,M; -# -# -# I := {[j,i] : 1 <= j <= 100 && j-L <= i <= j}; -# -# -# D := I*I intersection {[j1,i1] -> [j2,i2] : i1+j1 = i2+M}; -# -# I; - -{[j,i]: 1, i <= j <= 100 && j <= L+i} - -# -# D; - -{[In_1,In_2] -> [Out_1,In_1-M+In_2] : 1, In_2 <= In_1 <= 100 && 1 <= Out_1 <= 100 && In_1 <= L+In_2 && M+Out_1 <= L+In_1+In_2 && In_1+In_2 <= M+Out_1} - -# -# range D; - -{[In_1,In_2]: Exists ( alpha : 1, In_2 <= In_1 <= 100 && M <= -In_2+200 && 2 <= M+L+In_2 && M+In_2 <= L+2alpha && 2alpha <= M+In_2 && In_1 <= L+In_2)} - -# -# (range D) - (range D); - -{[In_1,In_2] : FALSE } - -# -# E := I - range D; -# -# sample := {[-M+3,-M+3]: L = 0 && -97 <= M <= 2}; -# -# sample intersection range D; - -{[In_1,In_2] : FALSE } - -# -# sample intersection E; - -{[-M+3,-M+3]: L = 0 && -97 <= M <= 2} - -# diff --git a/omega/examples/old_test/wrap b/omega/examples/old_test/wrap deleted file mode 100644 index 895c51b..0000000 --- a/omega/examples/old_test/wrap +++ /dev/null @@ -1,12 +0,0 @@ -symbolic n; -I := {[i,j,k] : 1 <= i,j,k <= n}; -R1 := {[i,j,n] -> [i,j+1,1] : 1 <= i,j,j+1 <= n} - union {[i,j,k] -> [i,j,k'] : 1 <= i,j,k,k' <= n && k' = k+1}; -R1; -R1+; -R1+ within I; -R2 := {[i,n,n] -> [i+1,1,1] : 1 <= i,i+1 <= n} - union R1; -R2; -R2+; -R2+ within I; diff --git a/omega/examples/old_test/wrap.oc-rt b/omega/examples/old_test/wrap.oc-rt deleted file mode 100644 index 0729e41..0000000 --- a/omega/examples/old_test/wrap.oc-rt +++ /dev/null @@ -1,50 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic n; -# -# I := {[i,j,k] : 1 <= i,j,k <= n}; -# -# R1 := {[i,j,n] -> [i,j+1,1] : 1 <= i,j,j+1 <= n} -# union {[i,j,k] -> [i,j,k'] : 1 <= i,j,k,k' <= n && k' = k+1}; -# -# R1; - -{[i,j,n] -> [i,j+1,1] : 1 <= i <= n && 1 <= j < n} union - {[i,j,k] -> [i,j,k+1] : 1 <= i <= n && 1 <= j <= n && 1 <= k < n} - -# -# R1+; - -{[i,j,k] -> [i,j',k'] : 1 <= j < j' <= n && 1 <= i <= n && 1 <= k <= n && 1 <= k' <= n} union - {[i,j,k] -> [i,j,k'] : 1 <= k < k' <= n && 1 <= i <= n && 1 <= j <= n} - -# -# R1+ within I; - -{[i,j,k] -> [i,j',k'] : 1 <= j < j' <= n && 1 <= i <= n && 1 <= k <= n && 1 <= k' <= n} union - {[i,j,k] -> [i,j,k'] : 1 <= k < k' <= n && 1 <= i <= n && 1 <= j <= n} - -# -# R2 := {[i,n,n] -> [i+1,1,1] : 1 <= i,i+1 <= n} -# union R1; -# -# R2; - -{[i,n,n] -> [i+1,1,1] : 1 <= i < n} union - {[i,j,k] -> [i,j,k+1] : 1 <= i <= n && 1 <= j <= n && 1 <= k < n} union - {[i,j,n] -> [i,j+1,1] : 1 <= i <= n && 1 <= j < n} - -# -# R2+; - -{[i,j,k] -> [i',j',k'] : 1 <= i < i' <= n && 1 <= j <= n && 1 <= k <= n && 1 <= j' <= n && 1 <= k' <= n} union - {[i,j,k] -> [i,j',k'] : 1 <= j < j' <= n && 1 <= i <= n && 1 <= k <= n && 1 <= k' <= n} union - {[i,j,k] -> [i,j,k'] : 1 <= k < k' <= n && 1 <= i <= n && 1 <= j <= n} - -# -# R2+ within I; - -{[i,j,k] -> [i',j',k'] : 1 <= i < i' <= n && 1 <= j <= n && 1 <= k <= n && 1 <= j' <= n && 1 <= k' <= n} union - {[i,j,k] -> [i,j',k'] : 1 <= j < j' <= n && 1 <= i <= n && 1 <= k <= n && 1 <= k' <= n} union - {[i,j,k] -> [i,j,k'] : 1 <= k < k' <= n && 1 <= i <= n && 1 <= j <= n} - -# diff --git a/omega/examples/old_test/wrap0 b/omega/examples/old_test/wrap0 deleted file mode 100644 index ca914af..0000000 --- a/omega/examples/old_test/wrap0 +++ /dev/null @@ -1,7 +0,0 @@ -symbolic n; -I := {[i,j,k] : 1 <= i,j,k <= n}; -R1 := {[i,j,n] -> [i,j+1,1] : 1 <= i,j,j+1 <= n} - union {[i,j,k] -> [i,j,k'] : 1 <= i,j,k,k' <= n && k' = k+1}; -R1; -R1+ within I; -R1+; diff --git a/omega/examples/old_test/wrap0.oc-rt b/omega/examples/old_test/wrap0.oc-rt deleted file mode 100644 index d9c7d34..0000000 --- a/omega/examples/old_test/wrap0.oc-rt +++ /dev/null @@ -1,26 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic n; -# -# I := {[i,j,k] : 1 <= i,j,k <= n}; -# -# R1 := {[i,j,n] -> [i,j+1,1] : 1 <= i,j,j+1 <= n} -# union {[i,j,k] -> [i,j,k'] : 1 <= i,j,k,k' <= n && k' = k+1}; -# -# R1; - -{[i,j,n] -> [i,j+1,1] : 1 <= i <= n && 1 <= j < n} union - {[i,j,k] -> [i,j,k+1] : 1 <= i <= n && 1 <= j <= n && 1 <= k < n} - -# -# R1+ within I; - -{[i,j,k] -> [i,j',k'] : 1 <= j < j' <= n && 1 <= i <= n && 1 <= k <= n && 1 <= k' <= n} union - {[i,j,k] -> [i,j,k'] : 1 <= k < k' <= n && 1 <= i <= n && 1 <= j <= n} - -# -# R1+; - -{[i,j,k] -> [i,j',k'] : 1 <= j < j' <= n && 1 <= i <= n && 1 <= k <= n && 1 <= k' <= n} union - {[i,j,k] -> [i,j,k'] : 1 <= k < k' <= n && 1 <= i <= n && 1 <= j <= n} - -# diff --git a/omega/examples/old_test/wrap1 b/omega/examples/old_test/wrap1 deleted file mode 100644 index d862a5a..0000000 --- a/omega/examples/old_test/wrap1 +++ /dev/null @@ -1,8 +0,0 @@ -symbolic n; -I := {[i,j,k] : 1 <= i,j,k <= n}; -R1 := {[i,j,n] -> [i,j+1,1] : 1 <= i,j,j+1 <= n} - union {[i,j,k] -> [i,j,k'] : 1 <= i,j,k,k' <= n && k' = k+1}; -R2 := {[i,n,n] -> [i+1,1,1] : 1 <= i,i+1 <= n} - union R1; -R2; -R2+ within I; diff --git a/omega/examples/old_test/wrap1.oc-rt b/omega/examples/old_test/wrap1.oc-rt deleted file mode 100644 index 9e43201..0000000 --- a/omega/examples/old_test/wrap1.oc-rt +++ /dev/null @@ -1,25 +0,0 @@ -# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): -# symbolic n; -# -# I := {[i,j,k] : 1 <= i,j,k <= n}; -# -# R1 := {[i,j,n] -> [i,j+1,1] : 1 <= i,j,j+1 <= n} -# union {[i,j,k] -> [i,j,k'] : 1 <= i,j,k,k' <= n && k' = k+1}; -# -# R2 := {[i,n,n] -> [i+1,1,1] : 1 <= i,i+1 <= n} -# union R1; -# -# R2; - -{[i,n,n] -> [i+1,1,1] : 1 <= i < n} union - {[i,j,k] -> [i,j,k+1] : 1 <= i <= n && 1 <= j <= n && 1 <= k < n} union - {[i,j,n] -> [i,j+1,1] : 1 <= i <= n && 1 <= j < n} - -# -# R2+ within I; - -{[i,j,k] -> [i',j',k'] : 1 <= i < i' <= n && 1 <= j <= n && 1 <= k <= n && 1 <= j' <= n && 1 <= k' <= n} union - {[i,j,k] -> [i,j',k'] : 1 <= j < j' <= n && 1 <= i <= n && 1 <= k <= n && 1 <= k' <= n} union - {[i,j,k] -> [i,j,k'] : 1 <= k < k' <= n && 1 <= i <= n && 1 <= j <= n} - -# diff --git a/omega/examples/old_test/x b/omega/examples/old_test/x deleted file mode 100644 index 56c23ca..0000000 --- a/omega/examples/old_test/x +++ /dev/null @@ -1,9 +0,0 @@ -old_IS:= {[i,j]: 1 <= i <= 8 & 1 <= j <= 4}; -T1:={[i,j] -> [j-i+8,i,0]}; -T2:={[i,j] -> [i+j-1,i,1]}; -n1:= T1 \ old_IS; -n1; -n2:= T2 \ old_IS; -n2; -codegen T1:old_IS,T2:old_IS; -codegen 2 T1:old_IS,T2:old_IS; diff --git a/omega/examples/old_test/x.oc-rt b/omega/examples/old_test/x.oc-rt deleted file mode 100644 index fc77e1a..0000000 --- a/omega/examples/old_test/x.oc-rt +++ /dev/null @@ -1,84 +0,0 @@ ->>> old_IS:= {[i,j]: 1 <= i <= 8 & 1 <= j <= 4}; ->>> T1:={[i,j] -> [j-i+8,i,0]}; ->>> T2:={[i,j] -> [i+j-1,i,1]}; ->>> n1:= T1 \ old_IS; ->>> n1; -{[i,j] -> [j-i+8,i,0] : 1 <= i <= 8 && 1 <= j <= 4} ->>> n2:= T2 \ old_IS; ->>> n2; -{[i,j] -> [i+j-1,i,1] : 1 <= i <= 8 && 1 <= j <= 4} ->>> codegen T1:old_IS,T2:old_IS; -for(t1 = 1; t1 <= 11; t1++) { - for(t2 = max(t1-3,1); t2 <= min(t1,-t1+8); t2++) { - s2(t2,t1-t2+1); - } - for(t2 = max(-t1+9,1); t2 <= min(-t1+12,t1-4); t2++) { - s1(t2,t1+t2-8); - } - for(t2 = max(-t1+9,t1-3); t2 <= min(-t1+12,t1); t2++) { - s1(t2,t1+t2-8); - s2(t2,t1-t2+1); - } - for(t2 = max(-t1+9,t1+1); t2 <= min(-t1+12,8); t2++) { - s1(t2,t1+t2-8); - } - for(t2 = max(t1-3,-t1+13); t2 <= min(t1,8); t2++) { - s2(t2,t1-t2+1); - } -} - ->>> codegen 2 T1:old_IS,T2:old_IS; -for(t1 = 1; t1 <= 3; t1++) { - for(t2 = 1; t2 <= t1; t2++) { - s2(t2,t1-t2+1); - } - for(t2 = -t1+9; t2 <= 8; t2++) { - s1(t2,t1+t2-8); - } -} -for(t2 = 1; t2 <= 4; t2++) { - s2(t2,-t2+5); -} -for(t2 = 5; t2 <= 8; t2++) { - s1(t2,t2-4); -} -for(t2 = 2; t2 <= 3; t2++) { - s2(t2,-t2+6); -} -for(t2 = 4; t2 <= 5; t2++) { - s1(t2,t2-3); - s2(t2,-t2+6); -} -for(t2 = 6; t2 <= 7; t2++) { - s1(t2,t2-3); -} -for(t2 = 3; t2 <= 6; t2++) { - s1(t2,t2-2); - s2(t2,-t2+7); -} -for(t2 = 2; t2 <= 3; t2++) { - s1(t2,t2-1); -} -for(t2 = 4; t2 <= 5; t2++) { - s1(t2,t2-1); - s2(t2,-t2+8); -} -for(t2 = 6; t2 <= 7; t2++) { - s2(t2,-t2+8); -} -for(t2 = 1; t2 <= 4; t2++) { - s1(t2,t2); -} -for(t2 = 5; t2 <= 8; t2++) { - s2(t2,-t2+9); -} -for(t1 = 9; t1 <= 11; t1++) { - for(t2 = 1; t2 <= -t1+12; t2++) { - s1(t2,t1+t2-8); - } - for(t2 = t1-3; t2 <= 8; t2++) { - s2(t2,t1-t2+1); - } -} - - diff --git a/omega/examples/pufs b/omega/examples/pufs deleted file mode 100644 index fa20bc8..0000000 --- a/omega/examples/pufs +++ /dev/null @@ -1,20 +0,0 @@ -# -# Examples of relations using uninterpreted function symbols -# from Omega Calculator documentation -# - -symbolic p(2), n, m; -R := { [ir,jr] : 1 <= ir <= n && 1 <= jr <= m }; -W1 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(Set) >= 0 }; -W2 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(Set) < 0 }; -Exposed := R intersection complement ( W1 union W2 ); -Exposed; - -symbolic f(1); -R1 := { [i] -> [j] : 1 <= i = j <= 100 && f(In) <= f(Out)}; -R2 := { [i] -> [j] : 1 <= i <= j <= 100 && f(In) = f(Out)}; - -R1 intersection R2; -R1 union R2; -R1 intersection complement R2; -R1; diff --git a/omega/examples/pufs.out b/omega/examples/pufs.out deleted file mode 100644 index df65564..0000000 --- a/omega/examples/pufs.out +++ /dev/null @@ -1,50 +0,0 @@ -# Omega Calculator [v1.1, Nov 96]: -# # -# # Examples of relations using uninterpreted function symbols -# # from Omega Calculator documentation -# # -# -# symbolic p(2), n, m; -# -# R := { [ir,jr] : 1 <= ir <= n && 1 <= jr <= m }; -# -# W1 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(Set) >= 0 }; -# -# W2 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(Set) < 0 }; -# -# Exposed := R intersection complement ( W1 union W2 ); -# -# Exposed; - -{[In_1,In_2] : FALSE } - -# -# -# symbolic f(1); -# -# R1 := { [i] -> [j] : 1 <= i = j <= 100 && f(In) <= f(Out)}; -# -# R2 := { [i] -> [j] : 1 <= i <= j <= 100 && f(In) = f(Out)}; -# -# -# R1 intersection R2; - -{[i] -> [i] : 1 <= i <= 100} - -# -# R1 union R2; - -{[i] -> [j] : f(j) = f(i) && 1 <= i < j <= 100} union - {[i] -> [i] : 1 <= i <= 100} - -# -# R1 intersection complement R2; - -{[i] -> [j] : FALSE } - -# -# R1; - -{[i] -> [i] : 1 <= i <= 100} - -# diff --git a/omega/examples/substitution b/omega/examples/substitution deleted file mode 100644 index 9d841fe..0000000 --- a/omega/examples/substitution +++ /dev/null @@ -1,35 +0,0 @@ -# -# Test various variable substitution scenarios -# - -symbolic n; - -# unimodular transformation -# -is := { [i,j] : 0 <=i<= 4 && 0 <= j<= 6 }; -t := { [i,j] -> [i2,j2] : i2 = i+j && j2 = i+2*j }; -codegen t:is; - -# non-unimodular transformation -# -is := { [i,j] : 0 <=i<= 4 && 0 <= j<= 6 }; -t := { [i,j] -> [i2,j2] : i2 = 2*i+j && j2 = i+2*j }; -codegen t:is; - -# second loop level is degenerated -# -is := {[i,j]:1 <= j <= 100 && j = i+4}; -t := {[i,j]->[a,b]: a = i && b = j}; -codegen t:is; - -# global variable case 1 -# -is := { [i] : 19+n = i }; -t:= { [i] -> [j]: j = i }; -codegen t:is; - -# global variable case 2 -# -is := {[i]: i-16 <= n < i && exists (alpha: i = n+1+3*alpha) }; -t := {[i] -> [i] : exists ( alpha : i = 1+n+18alpha)}; -codegen t:is; diff --git a/omega/examples/substitution.out b/omega/examples/substitution.out deleted file mode 100644 index 3a08405..0000000 --- a/omega/examples/substitution.out +++ /dev/null @@ -1,60 +0,0 @@ ->>> # ->>> # Test various variable substitution scenarios ->>> # ->>> ->>> symbolic n; ->>> ->>> # unimodular transformation ->>> # ->>> is := { [i,j] : 0 <=i<= 4 && 0 <= j<= 6 }; ->>> t := { [i,j] -> [i2,j2] : i2 = i+j && j2 = i+2*j }; ->>> codegen t:is; -for(t1 = 0; t1 <= 10; t1++) { - for(t2 = max(t1,2*t1-4); t2 <= min(t1+6,2*t1); t2++) { - s1(2*t1-t2,t2-t1); - } -} - ->>> ->>> ->>> # non-unimodular transformation ->>> # ->>> is := { [i,j] : 0 <=i<= 4 && 0 <= j<= 6 }; ->>> t := { [i,j] -> [i2,j2] : i2 = 2*i+j && j2 = i+2*j }; ->>> codegen t:is; -for(t1 = 0; t1 <= 14; t1++) { - for(t2 = max(3*intDiv(intDiv(t1+1,2)--t1+2,3)+-t1,2*t1-12); t2 <= min(intDiv(t1+18,2),2*t1); t2 += 3) { - s1(intDiv(2*t1-t2,3),intDiv(2*t2-t1,3)); - } -} - ->>> ->>> ->>> # second loop level is degenerated ->>> # ->>> is := {[i,j]:1 <= j <= 100 && j = i+4}; ->>> t := {[i,j]->[a,b]: a = i && b = j}; ->>> codegen t:is; -for(t1 = -3; t1 <= 96; t1++) { - s1(t1,t1+4); -} - ->>> ->>> ->>> # global variable case 1 ->>> # ->>> is := { [i] : 19+n = i }; ->>> t:= { [i] -> [j]: j = i }; ->>> codegen t:is; -s1(n+19); - ->>> ->>> ->>> # global variable case 2 ->>> # ->>> is := {[i]: i-16 <= n < i && exists (alpha: i = n+1+3*alpha) }; ->>> t := {[i] -> [i] : Exists ( alpha : i = 1+n+18alpha)}; ->>> codegen t:is; -s1(n+1); - - diff --git a/omega/examples/syr2k b/omega/examples/syr2k deleted file mode 100644 index 29cdf4e..0000000 --- a/omega/examples/syr2k +++ /dev/null @@ -1,17 +0,0 @@ -# This example of code generation comes from -# "Access Normalization: Loop Restructuring for NUMA Compilers" -# by Wei Li and Keshav Pingali -# Cornell Tech. report TR 92-1278 - -symbolic n,b; - -IS10 := {[i,j,k] : 1 <= i <= j <= n && j <= i+2b-2 - && i-b+1,j-b+1,1 <= k <= i+b-1,j+b-1,n}; -T10 := {[i,j,k] -> [j-i+1,k-j,k]}; - -known := {[*,*,*] : 1 <= b <= n}; - -codegen T10:IS10; -codegen T10:IS10 given known; -codegen T10:IS10; -codegen T10:IS10 given known; diff --git a/omega/examples/syr2k.out b/omega/examples/syr2k.out deleted file mode 100644 index 345ad04..0000000 --- a/omega/examples/syr2k.out +++ /dev/null @@ -1,69 +0,0 @@ ->>> # This example of code generation comes from ->>> # "Access Normalization: Loop Restructuring for NUMA Compilers" ->>> # by Wei Li and Keshav Pingali ->>> # Cornell Tech. report TR 92-1278 ->>> Symbolic n,b; ->>> ->>> IS10 := {[i,j,k] : 1 <= i <= j <= n && j <= i+2b-2 ->>> && i-b+1,j-b+1,1 <= k <= i+b-1,j+b-1,n}; ->>> T10 :={[i,j,k] -> [j-i+1,k-j,k]}; ->>> ->>> known := {[*,*,*] : 1 <= b <= n}; ->>> ->>> codegen T10:IS10; -for(t1 = 1; t1 <= min(2*b-1,n); t1++) { - for(t2 = max(-b+1,-n+1); t2 <= min(b-t1,n-t1); t2++) { - for(t3 = max(t1+t2,1); t3 <= min(t2+n,n); t3++) { - s1(t3-t1-t2+1,t3-t2,t3); - } - } -} - ->>> codegen T10:IS10 given known; -for(t1 = 1; t1 <= min(n,2*b-1); t1++) { - for(t2 = -b+1; t2 <= b-t1; t2++) { - for(t3 = max(t1+t2,1); t3 <= min(n,n+t2); t3++) { - s1(t3-t1-t2+1,t3-t2,t3); - } - } -} - ->>> codegen 2 T10:IS10; -for(t1 = 1; t1 <= min(2*b-1,n); t1++) { - for(t2 = max(-b+1,-n+1); t2 <= -t1; t2++) { - for(t3 = 1; t3 <= t2+n; t3++) { - s1(t3-t1-t2+1,t3-t2,t3); - } - } - for(t2 = max(-t1+1,-b+1); t2 <= min(-t1+b,-1); t2++) { - for(t3 = t1+t2; t3 <= t2+n; t3++) { - s1(t3-t1-t2+1,t3-t2,t3); - } - } - for(t2 = 0; t2 <= min(-t1+n,-t1+b); t2++) { - for(t3 = t1+t2; t3 <= n; t3++) { - s1(t3-t1-t2+1,t3-t2,t3); - } - } -} - ->>> codegen 2 T10:IS10 given known; -for(t1 = 1; t1 <= min(n,2*b-1); t1++) { - for(t2 = -b+1; t2 <= -t1; t2++) { - for(t3 = 1; t3 <= t2+n; t3++) { - s1(t3-t1-t2+1,t3-t2,t3); - } - } - for(t2 = max(-t1+1,-b+1); t2 <= min(b-t1,0); t2++) { - for(t3 = t2+t1; t3 <= t2+n; t3++) { - s1(t3-t1-t2+1,t3-t2,t3); - } - } - for(t2 = 1; t2 <= b-t1; t2++) { - for(t3 = t1+t2; t3 <= n; t3++) { - s1(t3-t1-t2+1,t3-t2,t3); - } - } -} - - diff --git a/omega/examples/union b/omega/examples/union deleted file mode 100644 index d03fcba..0000000 --- a/omega/examples/union +++ /dev/null @@ -1,64 +0,0 @@ -# test ConvexRepresentation - -symbolic n; - -# -# result is convex, same behavior as PairwiseCheck -# -r1:={[i,j]: 0<=i,j<=100}; -r2:={[i,j]: i>=100 && j>=0 && i+j<=200}; -r3:={[i,j]: i>=0 && j>=100 && i+j<=200}; -PairwiseCheck (r1 union r2 union r3); -ConvexRepresentation (r1 union r2 union r3); - -r1:={[i]: 1<=i<=n && exists (alpha: i=2alpha)}; -r2:={[i]: 1<=i<=n && exists (alpha: i=2alpha+1)}; -PairwiseCheck (r1 union r2); -ConvexRepresentation (r1 union r2); - -# -# test neighboring regions merge -# -r1:={[i]: 1<=i<=9 && exists (alpha: i=2alpha+1)}; -r2:={[i]: 9<=i<=99 && exists (alpha: i=2alpha+1)}; -PairwiseCheck (r1 union r2); -ConvexRepresentation (r1 union r2); - -r1:={[i,j]:1<=i,j<=100}; -r2:={[i,j]:50<=i<=100 && 100<=j<=200}; -r3:={[i,j]:1<=i<=50 && 100<=j<=200}; -r4:={[i,j]: 1000<=i,j<=2000}; -PairwiseCheck (r1 union r2 union r3 union r4); -ConvexRepresentation (r1 union r2 union r3 union r4); - -# -# test stride condition merge, filling up holes -# -r1:={[i]:1<=i<=100 && exists (alpha: 1+7alpha<=i<=3+7alpha)}; -r2:={[i]:1<=i<=100 && exists (alpha: i=4+7alpha)}; -r3:={[i]:1<=i<=100 && exists (alpha: i=5+7alpha)}; -r4:={[i]:1<=i<=100 && exists (alpha: 6+7alpha<=i<=9+7alpha)}; -PairwiseCheck (r1 union r2 union r3); -ConvexRepresentation (r1 union r2 union r3); - -PairwiseCheck (r1 union r2 union r4); -ConvexRepresentation (r1 union r2 union r4); - -r1:={[i]:6<=i<=96 && exists (alpha: i=6alpha)}; -r2:={[i]:3<=i<=93 && exists (alpha: i=3+6alpha)}; -PairwiseCheck (r1 union r2); -ConvexRepresentation (r1 union r2); - -r1:={[i]:1<=i<=100 && exists (alpha: 1+15alpha<=i<=4+15alpha)}; -r2:={[i]:1<=i<=100 && exists (alpha: 6+15alpha<=i<=8+15alpha)}; -r3:={[i]:1<=i<=100 && exists (alpha: 11+15alpha<=i<=13+15alpha)}; -PairwiseCheck (r1 union r2 union r3); -ConvexRepresentation (r1 union r2 union r3); - -# -# additional test cases -# -r1:={[i]:0<=i<=100}; -r2:={[i]: 10<=i<=100 && exists (alpha: i=1+5alpha)}; -PairwiseCheck (r1 union r2); -ConvexRepresentation (r1 union r2); diff --git a/omega/examples/union.out b/omega/examples/union.out deleted file mode 100644 index bf42f02..0000000 --- a/omega/examples/union.out +++ /dev/null @@ -1,96 +0,0 @@ ->>> # test ConvexRepresentation ->>> ->>> symbolic n; ->>> ->>> # ->>> # result is convex, same behavior as PairwiseCheck ->>> # ->>> r1:={[i,j]: 0<=i,j<=100}; ->>> r2:={[i,j]: i>=100 && j>=0 && i+j<=200}; ->>> r3:={[i,j]: i>=0 && j>=100 && i+j<=200}; ->>> PairwiseCheck (r1 union r2 union r3); -{[i,j]: 0 <= i <= -j+200 && 0 <= j} ->>> ConvexRepresentation (r1 union r2 union r3); -{[i,j]: 0 <= i <= -j+200 && 0 <= j} ->>> ->>> r1:={[i]: 1<=i<=n && exists (alpha: i=2alpha)}; ->>> r2:={[i]: 1<=i<=n && exists (alpha: i=2alpha+1)}; ->>> PairwiseCheck (r1 union r2); -{[i]: 1 <= i <= n} ->>> ConvexRepresentation (r1 union r2); -{[i]: 1 <= i <= n} ->>> ->>> # ->>> # test neighboring regions merge ->>> # ->>> r1:={[i]: 1<=i<=9 && exists (alpha: i=2alpha+1)}; ->>> r2:={[i]: 9<=i<=99 && exists (alpha: i=2alpha+1)}; ->>> PairwiseCheck (r1 union r2); -{[i]: Exists ( alpha : 2alpha = 1+i && 1 <= i <= 9)} union - {[i]: Exists ( alpha : 2alpha = 1+i && 9 <= i <= 99)} ->>> ConvexRepresentation (r1 union r2); -{[i]: Exists ( alpha : 2alpha = 1+i && 1 <= i <= 99)} ->>> ->>> r1:={[i,j]:1<=i,j<=100}; ->>> r2:={[i,j]:50<=i<=100 && 100<=j<=200}; ->>> r3:={[i,j]:1<=i<=50 && 100<=j<=200}; ->>> r4:={[i,j]: 1000<=i,j<=2000}; ->>> PairwiseCheck (r1 union r2 union r3 union r4); -{[i,j]: 1 <= i <= 100 && 1 <= j <= 100} union - {[i,j]: 50 <= i <= 100 && 100 <= j <= 200} union - {[i,j]: 1 <= i <= 50 && 100 <= j <= 200} union - {[i,j]: 1000 <= i <= 2000 && 1000 <= j <= 2000} ->>> ConvexRepresentation (r1 union r2 union r3 union r4); -{[i,j]: 1 <= i <= 100 && 1 <= j <= 200} union - {[i,j]: 1000 <= i <= 2000 && 1000 <= j <= 2000} ->>> ->>> # ->>> # test stride condition merge, filling up holes ->>> # ->>> r1:={[i]:1<=i<=100 && exists (alpha: 1+7alpha<=i<=3+7alpha)}; ->>> r2:={[i]:1<=i<=100 && exists (alpha: i=4+7alpha)}; ->>> r3:={[i]:1<=i<=100 && exists (alpha: i=5+7alpha)}; ->>> r4:={[i]:1<=i<=100 && exists (alpha: 6+7alpha<=i<=9+7alpha)}; ->>> PairwiseCheck (r1 union r2 union r3); -{[i]: Exists ( alpha : 1, 7alpha+1 <= i <= 100, 7alpha+3)} union - {[i]: Exists ( alpha : 3+i = 7alpha && 4 <= i <= 95)} union - {[i]: Exists ( alpha : 2+i = 7alpha && 5 <= i <= 96)} ->>> ConvexRepresentation (r1 union r2 union r3); -{[i]: Exists ( alpha : 1, 7alpha+1 <= i <= 100, 7alpha+5)} ->>> ->>> PairwiseCheck (r1 union r2 union r4); -{[i]: Exists ( alpha : 1, 7alpha+1 <= i <= 100, 7alpha+3)} union - {[i]: Exists ( alpha : 3+i = 7alpha && 4 <= i <= 95)} union - {[i]: Exists ( alpha : 1, 7alpha+6 <= i <= 100, 7alpha+9)} ->>> ConvexRepresentation (r1 union r2 union r4); -{[i]: Exists ( alpha : 1, 7alpha+6 <= i <= 100, 7alpha+11)} ->>> ->>> r1:={[i]:6<=i<=96 && exists (alpha: i=6alpha)}; ->>> r2:={[i]:3<=i<=93 && exists (alpha: i=3+6alpha)}; ->>> PairwiseCheck (r1 union r2); -{[i]: Exists ( alpha : i = 6alpha && 6 <= i <= 96)} union - {[i]: Exists ( alpha : i = 3+6alpha && 3 <= i <= 93)} ->>> ConvexRepresentation (r1 union r2); -{[i]: Exists ( alpha : i = 3alpha && 3 <= i <= 96)} ->>> ->>> r1:={[i]:1<=i<=100 && exists (alpha: 1+15alpha<=i<=4+15alpha)}; ->>> r2:={[i]:1<=i<=100 && exists (alpha: 6+15alpha<=i<=8+15alpha)}; ->>> r3:={[i]:1<=i<=100 && exists (alpha: 11+15alpha<=i<=13+15alpha)}; ->>> PairwiseCheck (r1 union r2 union r3); -{[i]: Exists ( alpha : 1, 15alpha+1 <= i <= 100, 15alpha+4)} union - {[i]: Exists ( alpha : 1, 15alpha+6 <= i <= 100, 15alpha+8)} union - {[i]: Exists ( alpha : 1, 15alpha+11 <= i <= 100, 15alpha+13)} ->>> ConvexRepresentation (r1 union r2 union r3); -{[i]: Exists ( alpha : i = 4+15alpha && 4 <= i <= 94)} union - {[i]: Exists ( alpha : 1, 5alpha+1 <= i <= 100, 5alpha+3)} ->>> ->>> # ->>> # additional test cases ->>> # ->>> r1:={[i]:0<=i<=100}; ->>> r2:={[i]: 10<=i<=100 && exists (alpha: i=1+5alpha)}; ->>> PairwiseCheck (r1 union r2); -{[i]: 0 <= i <= 100} ->>> ConvexRepresentation (r1 union r2); -{[i]: 0 <= i <= 100} ->>> diff --git a/omega/include/basic b/omega/include/basic deleted file mode 120000 index 5f3270d..0000000 --- a/omega/include/basic +++ /dev/null @@ -1 +0,0 @@ -../basic/include/basic \ No newline at end of file diff --git a/omega/include/code_gen b/omega/include/code_gen deleted file mode 120000 index c46afac..0000000 --- a/omega/include/code_gen +++ /dev/null @@ -1 +0,0 @@ -../code_gen/include/code_gen/ \ No newline at end of file diff --git a/omega/include/codegen.h b/omega/include/codegen.h deleted file mode 120000 index 7ea5d1d..0000000 --- a/omega/include/codegen.h +++ /dev/null @@ -1 +0,0 @@ -code_gen/codegen.h \ No newline at end of file diff --git a/omega/include/config.h.in b/omega/include/config.h.in deleted file mode 100644 index fbabcd4..0000000 --- a/omega/include/config.h.in +++ /dev/null @@ -1,35 +0,0 @@ -/* include/config.h.in. Generated from configure.ac by autoheader. */ - -/* Use Rose */ -#undef BUILD_ROSE - -/* Omega version */ -#undef OMEGA_VERSION - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Version number of package */ -#undef VERSION - -/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a - `char[]'. */ -#undef YYTEXT_POINTER diff --git a/omega/include/omega b/omega/include/omega deleted file mode 120000 index 8f80c19..0000000 --- a/omega/include/omega +++ /dev/null @@ -1 +0,0 @@ -../omega_lib/include/omega \ No newline at end of file diff --git a/omega/include/omega.h b/omega/include/omega.h deleted file mode 120000 index 8be0f76..0000000 --- a/omega/include/omega.h +++ /dev/null @@ -1 +0,0 @@ -../omega_lib/include/omega.h \ No newline at end of file diff --git a/omega/install-sh b/omega/install-sh deleted file mode 100755 index 4d4a951..0000000 --- a/omega/install-sh +++ /dev/null @@ -1,323 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2005-05-14.22 - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -chmodcmd="$chmodprog 0755" -chowncmd= -chgrpcmd= -stripcmd= -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src= -dst= -dir_arg= -dstarg= -no_target_directory= - -usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: --c (ignored) --d create directories instead of installing files. --g GROUP $chgrpprog installed files to GROUP. --m MODE $chmodprog installed files to MODE. --o USER $chownprog installed files to USER. --s $stripprog installed files. --t DIRECTORY install into DIRECTORY. --T report an error if DSTFILE is a directory. ---help display this help and exit. ---version display version info and exit. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG -" - -while test -n "$1"; do - case $1 in - -c) shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - --help) echo "$usage"; exit $?;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -s) stripcmd=$stripprog - shift - continue;; - - -t) dstarg=$2 - shift - shift - continue;; - - -T) no_target_directory=true - shift - continue;; - - --version) echo "$0 $scriptversion"; exit $?;; - - *) # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - test -n "$dir_arg$dstarg" && break - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dstarg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dstarg" - shift # fnord - fi - shift # arg - dstarg=$arg - done - break;; - esac -done - -if test -z "$1"; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src ;; - esac - - if test -n "$dir_arg"; then - dst=$src - src= - - if test -d "$dst"; then - mkdircmd=: - chmodcmd= - else - mkdircmd=$mkdirprog - fi - else - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dstarg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dstarg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst ;; - esac - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dstarg: Is a directory" >&2 - exit 1 - fi - dst=$dst/`basename "$src"` - fi - fi - - # This sed command emulates the dirname command. - dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` - - # Make sure that the destination directory exists. - - # Skip lots of stat calls in the usual case. - if test ! -d "$dstdir"; then - defaultIFS=' - ' - IFS="${IFS-$defaultIFS}" - - oIFS=$IFS - # Some sh's can't handle IFS=/ for some reason. - IFS='%' - set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` - shift - IFS=$oIFS - - pathcomp= - - while test $# -ne 0 ; do - pathcomp=$pathcomp$1 - shift - if test ! -d "$pathcomp"; then - $mkdirprog "$pathcomp" - # mkdir can fail with a `File exist' error in case several - # install-sh are creating the directory concurrently. This - # is OK. - test -d "$pathcomp" || exit - fi - pathcomp=$pathcomp/ - done - fi - - if test -n "$dir_arg"; then - $doit $mkdircmd "$dst" \ - && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } - - else - dstfile=`basename "$dst"` - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - trap '(exit $?); exit' 1 2 13 15 - - # Copy the file name to the temp name. - $doit $cpprog "$src" "$dsttmp" && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && - - # Now rename the file to the real destination. - { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ - || { - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - if test -f "$dstdir/$dstfile"; then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ - || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ - || { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit 1 - } - else - : - fi - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - } - } - fi || { (exit 1); exit 1; } -done - -# The final little trick to "correctly" pass the exit status to the exit trap. -{ - (exit 0); exit 0 -} - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/omega/missing b/omega/missing deleted file mode 100755 index 894e786..0000000 --- a/omega/missing +++ /dev/null @@ -1,360 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. - -scriptversion=2005-06-08.21 - -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# Originally by Fran,cois Pinard , 1996. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -run=: - -# In the cases where this matters, `missing' is being run in the -# srcdir already. -if test -f configure.ac; then - configure_ac=configure.ac -else - configure_ac=configure.in -fi - -msg="missing on your system" - -case "$1" in ---run) - # Try to run requested program, and just exit if it succeeds. - run= - shift - "$@" && exit 0 - # Exit code 63 means version mismatch. This often happens - # when the user try to use an ancient version of a tool on - # a file that requires a minimum version. In this case we - # we should proceed has if the program had been absent, or - # if --run hadn't been passed. - if test $? = 63; then - run=: - msg="probably too old" - fi - ;; - - -h|--h|--he|--hel|--help) - echo "\ -$0 [OPTION]... PROGRAM [ARGUMENT]... - -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an -error status if there is no known handling for PROGRAM. - -Options: - -h, --help display this help and exit - -v, --version output version information and exit - --run try to run the given command, and emulate it if it fails - -Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' - automake touch all \`Makefile.in' files - bison create \`y.tab.[ch]', if possible, from existing .[ch] - flex create \`lex.yy.c', if possible, from existing .c - help2man touch the output file - lex create \`lex.yy.c', if possible, from existing .c - makeinfo touch the output file - tar try tar, gnutar, gtar, then tar without non-portable flags - yacc create \`y.tab.[ch]', if possible, from existing .[ch] - -Send bug reports to ." - exit $? - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing $scriptversion (GNU Automake)" - exit $? - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - -esac - -# Now exit if we have it, but it failed. Also exit now if we -# don't have it and --version was passed (most likely to detect -# the program). -case "$1" in - lex|yacc) - # Not GNU programs, they don't have --version. - ;; - - tar) - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - exit 1 - fi - ;; - - *) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - # Could not run --version or --help. This is probably someone - # running `$TOOL --version' or `$TOOL --help' to check whether - # $TOOL exists and not knowing $TOOL uses missing. - exit 1 - fi - ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case "$1" in - aclocal*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acinclude.m4' or \`${configure_ac}'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from - any GNU archive site." - touch aclocal.m4 - ;; - - autoconf) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`${configure_ac}'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU - archive site." - touch configure - ;; - - autoheader) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acconfig.h' or \`${configure_ac}'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them - from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` - test -z "$files" && files="config.h" - touch_files= - for f in $files; do - case "$f" in - *:*) touch_files="$touch_files "`echo "$f" | - sed -e 's/^[^:]*://' -e 's/:.*//'`;; - *) touch_files="$touch_files $f.in";; - esac - done - touch $touch_files - ;; - - automake*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. - You might want to install the \`Automake' and \`Perl' packages. - Grab them from any GNU archive site." - find . -type f -name Makefile.am -print | - sed 's/\.am$/.in/' | - while read f; do touch "$f"; done - ;; - - autom4te) - echo 1>&2 "\ -WARNING: \`$1' is needed, but is $msg. - You might have modified some files without having the - proper tools for further handling them. - You can get \`$1' as part of \`Autoconf' from any GNU - archive site." - - file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` - test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo "#! /bin/sh" - echo "# Created by GNU Automake missing as a replacement of" - echo "# $ $@" - echo "exit 0" - chmod +x $file - exit 1 - fi - ;; - - bison|yacc) - echo 1>&2 "\ -WARNING: \`$1' $msg. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package - in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." - rm -f y.tab.c y.tab.h - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if [ ! -f y.tab.h ]; then - echo >y.tab.h - fi - if [ ! -f y.tab.c ]; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex|flex) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.l' file. You may need the \`Flex' package - in order for those modifications to take effect. You can get - \`Flex' from any GNU archive site." - rm -f lex.yy.c - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if [ ! -f lex.yy.c ]; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - help2man) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a dependency of a manual page. You may need the - \`Help2man' package in order for those modifications to take - effect. You can get \`Help2man' from any GNU archive site." - - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` - fi - if [ -f "$file" ]; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit 1 - fi - ;; - - makeinfo) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file - indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." - # The file to touch is that specified with -o ... - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - # ... or it is the one specified with @setfilename ... - infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` - # ... or it is derived from the source name (dir/f.texi becomes f.info) - test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info - fi - # If the file does not exist, the user really needs makeinfo; - # let's fail without touching anything. - test -f $file || exit 1 - touch $file - ;; - - tar) - shift - - # We have already tried tar in the generic part. - # Look for gnutar/gtar before invocation to avoid ugly error - # messages. - if (gnutar --version > /dev/null 2>&1); then - gnutar "$@" && exit 0 - fi - if (gtar --version > /dev/null 2>&1); then - gtar "$@" && exit 0 - fi - firstarg="$1" - if shift; then - case "$firstarg" in - *o*) - firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - case "$firstarg" in - *h*) - firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - fi - - echo 1>&2 "\ -WARNING: I can't seem to be able to run \`tar' with the given arguments. - You may want to install GNU tar or Free paxutils, or check the - command line arguments." - exit 1 - ;; - - *) - echo 1>&2 "\ -WARNING: \`$1' is needed, and is $msg. - You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequisites for installing - this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." - exit 1 - ;; -esac - -exit 0 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/omega/omega_calc/doc/calculator.pdf b/omega/omega_calc/doc/calculator.pdf deleted file mode 100644 index 5c307ab..0000000 Binary files a/omega/omega_calc/doc/calculator.pdf and /dev/null differ diff --git a/omega/omega_calc/include/omega_calc/AST.h b/omega/omega_calc/include/omega_calc/AST.h deleted file mode 100644 index 58d74fb..0000000 --- a/omega/omega_calc/include/omega_calc/AST.h +++ /dev/null @@ -1,310 +0,0 @@ -#ifndef _AST_H -#define _AST_H - -#include -#include -#include -#include - -typedef enum {eq, lt, gt, geq, leq, neq} Rel_Op; - -class tupleDescriptor; - -class Variable_Ref { -public: - int anonymous; - omega::Const_String name; - omega::Const_String stripped_name; - omega::Variable_ID vid; - omega::Variable_ID id(omega::Rel_Body *R) { - if (vid) return vid; - if (arity == 0) - vid = R->get_local(g); - else - vid = R->get_local(g,of); - return vid; - } - omega::Variable_ID id(omega::Relation &R) { - if (vid) return vid; - if (arity == 0) - vid = R.get_local(g); - else - vid = R.get_local(g,of); - return vid; - } - omega::Free_Var_Decl *g; - int arity; - int pos; - omega::Argument_Tuple of; - Variable_Ref(char *s, int _arity, omega::Argument_Tuple _of); - Variable_Ref(char *s); - Variable_Ref(); - ~Variable_Ref(); -}; - -extern std::map functionOfInput; -extern std::map functionOfOutput; - -class Declaration_Site { -public: - Declaration_Site(); - Declaration_Site(std::set *v); - virtual Variable_Ref *extend(char *s); - virtual Variable_Ref *extend(char *s, omega::Argument_Tuple, int); - virtual ~Declaration_Site(); - - Variable_Ref *extend(); - void print() { - for (std::set::iterator i = declarations.begin(); ;) { - printf("%s", static_cast((*i)->name)); - i++; - if (i != declarations.end()) - printf(","); - else - break; - } - } - - Declaration_Site *previous; - std::set declarations; -}; - -class Global_Declaration_Site: public Declaration_Site { -public: - virtual Variable_Ref *extend(char *s); - virtual Variable_Ref *extend() { - return Declaration_Site::extend(); - } - virtual Variable_Ref *extend(char *s, omega::Argument_Tuple in_of, int in_arity) { - return Declaration_Site::extend(s,in_of,in_arity); - } - void extend_both_tuples(char *s, int arity); - virtual ~Global_Declaration_Site(); -}; - -extern Declaration_Site *current_Declaration_Site; - -inline void popScope() { - assert(current_Declaration_Site); - current_Declaration_Site = current_Declaration_Site->previous; -} - -Variable_Ref *lookupScalar(char *s); -Declaration_Site * defined (char *); - -class Exp { -public: - Exp(omega::coef_t c); - Exp(Variable_Ref *v); - friend Exp *multiply (omega::coef_t c, Exp *x); - friend Exp *multiply (Exp *x, Exp *y); - friend Exp *negate (Exp *x); - friend Exp *add (Exp *x, Exp *y); - friend Exp *subtract (Exp *x, Exp *y); - std::map coefs; - omega::coef_t constantTerm; -protected: - void addTerm(omega::coef_t coef, omega::Variable_ID v); -}; - - -typedef struct { - Exp *e; - int step; -} strideConstraint; - - -class AST; -class AST_constraints; - - -class Tuple_Part { -public: - Variable_Ref *from,*to; - Tuple_Part(Variable_Ref *f, Variable_Ref *t) - { from = f; to = t; } - Tuple_Part(Variable_Ref *f) - { from = f; to = 0; } - Tuple_Part() - { from = 0; to = 0; } -}; - - -class AST { -public: - virtual void install(omega::Formula *F) = 0; - virtual void print() = 0; - virtual ~AST() {} -}; - - -class AST_And: public AST { -public: - AST_And(AST *l, AST *r) { left = l; right = r; } - ~AST_And() { delete left; delete right; } - - virtual void install(omega::Formula *F); - - virtual void print() { - printf("("); - left->print(); - printf(" && "); - right->print(); - printf(")"); - } - - AST *left,*right; -}; - - -class AST_Or: public AST { -public: - AST_Or(AST *l, AST *r) { left = l; right = r; } - ~AST_Or() { delete left; delete right; } - - virtual void install(omega::Formula *F); - - virtual void print() { - printf("("); - left->print(); - printf(" || "); - right->print(); - printf(")"); - } - - - AST *left, *right; -}; - - -class AST_Not: public AST { -public: - AST_Not(AST *c) { child = c; } - ~AST_Not() { delete child; } - - virtual void install(omega::Formula *F); - - virtual void print() { - printf("(!"); - child->print(); - printf(")"); - } - - AST *child; -}; - - -class AST_declare: public AST { -public: - virtual void install(omega::Formula *F) = 0; - - virtual void print() { - printf("("); - declaredVariables->print(); - printf(" : "); - child->print(); - printf(")"); - } - - Declaration_Site *declaredVariables; - AST *child; -}; - - -class AST_exists: public AST_declare { -public: - AST_exists(Declaration_Site *dV, AST *c) {declaredVariables = dV, child = c;} - ~AST_exists() { delete child; delete declaredVariables; } - - virtual void install(omega::Formula *F); - - virtual void print() { - printf("exists "); - AST_declare::print(); - } -}; - - -class AST_forall: public AST_declare { -public: - AST_forall(Declaration_Site *dV, AST *c) {declaredVariables = dV, child = c; } - ~AST_forall() { delete child; delete declaredVariables; } - - virtual void install(omega::Formula *F); - - virtual void print() { - printf("forall "); - AST_declare::print(); - } -}; - - - -class AST_constraints: public AST { -public: - AST_constraints(std::set *f, Rel_Op r, AST_constraints *o); - AST_constraints(std::set *f, Rel_Op r, std::set *s); - AST_constraints(std::set *f); - ~AST_constraints(); - - virtual void install(omega::Formula *F); - - virtual void print(); - - AST_constraints *others; - std::set *first; - Rel_Op rel_op; -}; - -void install_stride(omega::F_And *F, strideConstraint *c); -void install_eq(omega::F_And *F, Exp *e1, Exp *e2); -void install_geq(omega::F_And *F, Exp *e1, Exp *e2); -void install_gt(omega::F_And *F, Exp *e1, Exp *e2); -void install_neq(omega::F_And *F, Exp *e1, Exp *e2); - - - -class tupleDescriptor { -public: - tupleDescriptor() { size = 0; } - void extend(); - void extend(Exp * e); - void extend(Exp * lb, Exp *ub); - void extend(Exp * lb, Exp *ub, omega::coef_t stride); - void extend(char * s, Exp *e); - void extend(char * s); - void extend(char * s, omega::Argument_Tuple, int); - - int size; - std::vector vars; - std::set eq_constraints; - std::set geq_constraints; - std::set stride_constraints; - ~tupleDescriptor() { - for (std::set::iterator i = eq_constraints.begin(); i != eq_constraints.end(); i++) - delete *i; - for (std::set::iterator i = geq_constraints.begin(); i != geq_constraints.end(); i++) - delete *i; - for (std::set::iterator i = stride_constraints.begin(); i != stride_constraints.end(); i++) { - delete (*i)->e; - delete *i; - } - } -}; - -extern Global_Declaration_Site *globalDecls; -extern Declaration_Site *relationDecl; -extern tupleDescriptor *currentTupleDescriptor; - -void resetGlobals(); - - -// Used to parse a list of paired relations for code generation commands -// class RelTuplePair { -// public: -// RelTuplePair() : ispaces(0), mappings(0) {} -// omega::Tuple ispaces; -// omega::Tuple mappings; -// }; - -#endif diff --git a/omega/omega_calc/include/omega_calc/PT-omega.c b/omega/omega_calc/include/omega_calc/PT-omega.c deleted file mode 100644 index ad6b979..0000000 --- a/omega/omega_calc/include/omega_calc/PT-omega.c +++ /dev/null @@ -1,81 +0,0 @@ -#undef DONT_INCLUDE_TEMPLATE_CODE - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -template int max(int, int); -template int min(int, int); -template unsigned int min(unsigned int, unsigned int); -template void set_max(int&,int); -template void set_min(int&,int); -template void swap(int&,int&); -template void swap(short&,short&); -template void swap(signed char&,signed char&); -template Relation copy(const Relation &); - -instantiate_Set(int); -instantiate_Set(Global_Var_ID); -instantiate_Set(Variable_ID); - -instantiate_List(int); -instantiate_List(exit_func); -instantiate_List(Formula *); -instantiate_List(Conjunct *); -instantiate_List(DNF *); -instantiate_List(Relation *); -instantiate_Simple_List(Relation); - -typedef Tuple RelationTuple; -instantiate_Tuple(bool); -instantiate_Tuple(int); -instantiate_Tuple(coef_t); -instantiate_Tuple(char *); -instantiate_Tuple(Const_String); -instantiate_Tuple(Conjunct *); -instantiate_Tuple(Relation); -instantiate_Tuple(RelationTuple); -instantiate_Tuple(Variable_ID); -instantiate_Tuple(Free_Var_Decl *); -instantiate_Tuple(std::string); -instantiate_Tuple(GEQ_Handle); - -instantiate_Section(Variable_ID); - -instantiate_Generator(Variable_Info); -instantiate_Generator(GEQ_Handle); -instantiate_Generator(EQ_Handle); -instantiate_Generator(Constraint_Handle); -instantiate_Generator(Sub_Handle); - -instantiate_Map(Variable_ID,int); -instantiate_Map(Global_Var_ID, Variable_ID); -instantiate_Map(GEQ_Handle,Variable_ID); -instantiate_Map(EQ_Handle,Variable_ID); -instantiate_Map(Variable_ID,Set); -instantiate_Map(Const_String, Relation *); - -instantiate_Dynamic_Array1(Coef_Var_Decl *); -instantiate_Dynamic_Array1(Relation); -instantiate_Dynamic_Array2(Relation); - - -/* Stuff required by calculator: */ -instantiate_Bag(Exp *); -instantiate_Bag(strideConstraint *); -instantiate_Bag(Variable_Ref *); -instantiate_Bag(char *); -instantiate_Map(Variable_Ref *, int); -instantiate_Map(Variable_Ref *, Variable_Ref *); -instantiate_Map(Const_String, Variable_Ref *); -instantiate_Set(Free_Var_Decl *); -instantiate_Tuple(Variable_Ref *); diff --git a/omega/omega_calc/include/omega_calc/myflex.h b/omega/omega_calc/include/omega_calc/myflex.h deleted file mode 100755 index d472e51..0000000 --- a/omega/omega_calc/include/omega_calc/myflex.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef _MYFLEX_H -#define _MYFLEX_H - -#ifndef yyFlexLexerOnce -#include -#endif -#include -#include -#include - -class myFlexLexer: public yyFlexLexer { -protected: - std::string cur_line; - int cur_pos; - std::vector history; - int first_history_pos; - int last_history_pos; - std::vector key_seqs; - -public: - myFlexLexer(std::istream *arg_yyin = NULL, std::ostream *arg_yyout = NULL); - ~myFlexLexer() {} -protected: - int LexerInput(char *buf, int max_size); -}; - -#endif diff --git a/omega/omega_calc/obj/FlexLexer.h b/omega/omega_calc/obj/FlexLexer.h deleted file mode 100755 index bad4ce0..0000000 --- a/omega/omega_calc/obj/FlexLexer.h +++ /dev/null @@ -1,206 +0,0 @@ -// -*-C++-*- -// FlexLexer.h -- define interfaces for lexical analyzer classes generated -// by flex - -// Copyright (c) 1993 The Regents of the University of California. -// All rights reserved. -// -// This code is derived from software contributed to Berkeley by -// Kent Williams and Tom Epperly. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: - -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. - -// Neither the name of the University nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. - -// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -// IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE. - -// This file defines FlexLexer, an abstract class which specifies the -// external interface provided to flex C++ lexer objects, and yyFlexLexer, -// which defines a particular lexer class. -// -// If you want to create multiple lexer classes, you use the -P flag -// to rename each yyFlexLexer to some other xxFlexLexer. You then -// include in your other sources once per lexer class: -// -// #undef yyFlexLexer -// #define yyFlexLexer xxFlexLexer -// #include -// -// #undef yyFlexLexer -// #define yyFlexLexer zzFlexLexer -// #include -// ... - -#ifndef __FLEX_LEXER_H -// Never included before - need to define base class. -#define __FLEX_LEXER_H - -#include -# ifndef FLEX_STD -# define FLEX_STD std:: -# endif - -extern "C++" { - -struct yy_buffer_state; -typedef int yy_state_type; - -class FlexLexer { -public: - virtual ~FlexLexer() { } - - const char* YYText() const { return yytext; } - int YYLeng() const { return yyleng; } - - virtual void - yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0; - virtual struct yy_buffer_state* - yy_create_buffer( FLEX_STD istream* s, int size ) = 0; - virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0; - virtual void yyrestart( FLEX_STD istream* s ) = 0; - - virtual int yylex() = 0; - - // Call yylex with new input/output sources. - int yylex( FLEX_STD istream* new_in, FLEX_STD ostream* new_out = 0 ) - { - switch_streams( new_in, new_out ); - return yylex(); - } - - // Switch to new input/output streams. A nil stream pointer - // indicates "keep the current one". - virtual void switch_streams( FLEX_STD istream* new_in = 0, - FLEX_STD ostream* new_out = 0 ) = 0; - - int lineno() const { return yylineno; } - - int debug() const { return yy_flex_debug; } - void set_debug( int flag ) { yy_flex_debug = flag; } - -protected: - char* yytext; - int yyleng; - int yylineno; // only maintained if you use %option yylineno - int yy_flex_debug; // only has effect with -d or "%option debug" -}; - -} -#endif // FLEXLEXER_H - -#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce) -// Either this is the first time through (yyFlexLexerOnce not defined), -// or this is a repeated include to define a different flavor of -// yyFlexLexer, as discussed in the flex manual. -#define yyFlexLexerOnce - -extern "C++" { - -class yyFlexLexer : public FlexLexer { -public: - // arg_yyin and arg_yyout default to the cin and cout, but we - // only make that assignment when initializing in yylex(). - yyFlexLexer( FLEX_STD istream* arg_yyin = 0, FLEX_STD ostream* arg_yyout = 0 ); - - virtual ~yyFlexLexer(); - - void yy_switch_to_buffer( struct yy_buffer_state* new_buffer ); - struct yy_buffer_state* yy_create_buffer( FLEX_STD istream* s, int size ); - void yy_delete_buffer( struct yy_buffer_state* b ); - void yyrestart( FLEX_STD istream* s ); - - void yypush_buffer_state( struct yy_buffer_state* new_buffer ); - void yypop_buffer_state(); - - virtual int yylex(); - virtual void switch_streams( FLEX_STD istream* new_in, FLEX_STD ostream* new_out = 0 ); - virtual int yywrap(); - -protected: - virtual int LexerInput( char* buf, int max_size ); - virtual void LexerOutput( const char* buf, int size ); - virtual void LexerError( const char* msg ); - - void yyunput( int c, char* buf_ptr ); - int yyinput(); - - void yy_load_buffer_state(); - void yy_init_buffer( struct yy_buffer_state* b, FLEX_STD istream* s ); - void yy_flush_buffer( struct yy_buffer_state* b ); - - int yy_start_stack_ptr; - int yy_start_stack_depth; - int* yy_start_stack; - - void yy_push_state( int new_state ); - void yy_pop_state(); - int yy_top_state(); - - yy_state_type yy_get_previous_state(); - yy_state_type yy_try_NUL_trans( yy_state_type current_state ); - int yy_get_next_buffer(); - - FLEX_STD istream* yyin; // input source for default LexerInput - FLEX_STD ostream* yyout; // output sink for default LexerOutput - - // yy_hold_char holds the character lost when yytext is formed. - char yy_hold_char; - - // Number of characters read into yy_ch_buf. - int yy_n_chars; - - // Points to current character in buffer. - char* yy_c_buf_p; - - int yy_init; // whether we need to initialize - int yy_start; // start state number - - // Flag which is used to allow yywrap()'s to do buffer switches - // instead of setting up a fresh yyin. A bit of a hack ... - int yy_did_buffer_switch_on_eof; - - - size_t yy_buffer_stack_top; /**< index of top of stack. */ - size_t yy_buffer_stack_max; /**< capacity of stack. */ - struct yy_buffer_state ** yy_buffer_stack; /**< Stack as an array. */ - void yyensure_buffer_stack(void); - - // The following are not always needed, but may be depending - // on use of certain flex features (like REJECT or yymore()). - - yy_state_type yy_last_accepting_state; - char* yy_last_accepting_cpos; - - yy_state_type* yy_state_buf; - yy_state_type* yy_state_ptr; - - char* yy_full_match; - int* yy_full_state; - int yy_full_lp; - - int yy_lp; - int yy_looking_for_trail_begin; - - int yy_more_flag; - int yy_more_len; - int yy_more_offset; - int yy_prev_more_offset; -}; - -} - -#endif // yyFlexLexer || ! yyFlexLexerOnce - diff --git a/omega/omega_calc/obj/Makefile.am b/omega/omega_calc/obj/Makefile.am deleted file mode 100644 index 4420f89..0000000 --- a/omega/omega_calc/obj/Makefile.am +++ /dev/null @@ -1,32 +0,0 @@ -noinst_PROGRAMS=oc - -SRCDIR=../src - - -build_date = "\"`date +%m/%d/%Y`\"" - -BUILT_SOURCES=$(SRCDIR)/lex.yy.cc $(SRCDIR)/parser.tab.cc -AM_YFLAGS=-d -t - -calc_includes =-I$(SRCDIR) -calc_includes+=-I../include -calc_includes+=-I../../omega_lib/include -I../../code_gen/include -calc_includes+=-I../../basic/include - -#calc_libs =../../omega_lib/obj/libomega.a -#calc_libs+=../../code_gen/obj/libcodegen.a -calc_libs =-lomega -lcodegen -calc_lib_paths =-L../../omega_lib/obj -L../../code_gen/obj -calc_lib_paths+=-L$(ROSEHOME)/lib -L$(BOOSTHOME)/lib - -oc_SOURCES=$(SRCDIR)/AST.cc $(SRCDIR)/myflex.cc $(SRCDIR)/lex.yy.cc $(SRCDIR)/parser.tab.cc -oc_LDADD=$(calc_libs) -oc_LDFLAGS=$(calc_lib_paths) -oc_CPPFLAGS=$(calc_includes) -DBUILD_CODEGEN -DOMEGA_BUILD_DATE=$(build_date) - -$(SRCDIR)/lex.yy.cc: $(SRCDIR)/parser.tab.cc $(SRCDIR)/parser.ll - flex++ -o $(SRCDIR)/lex.yy.cc $(SRCDIR)/parser.ll - -$(SRCDIR)/parser.tab.cc: - bison -t -d -o $(SRCDIR)/parser.tab.cc $(SRCDIR)/parser.yy - diff --git a/omega/omega_calc/obj/Makefile.in b/omega/omega_calc/obj/Makefile.in deleted file mode 100644 index b7a1e8a..0000000 --- a/omega/omega_calc/obj/Makefile.in +++ /dev/null @@ -1,631 +0,0 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -noinst_PROGRAMS = oc$(EXEEXT) -subdir = omega_calc/obj -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/include/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -PROGRAMS = $(noinst_PROGRAMS) -am__dirstamp = $(am__leading_dot)dirstamp -am_oc_OBJECTS = $(SRCDIR)/oc-AST.$(OBJEXT) \ - $(SRCDIR)/oc-myflex.$(OBJEXT) $(SRCDIR)/oc-lex.yy.$(OBJEXT) \ - $(SRCDIR)/oc-parser.tab.$(OBJEXT) -oc_OBJECTS = $(am_oc_OBJECTS) -am__DEPENDENCIES_1 = -oc_DEPENDENCIES = $(am__DEPENDENCIES_1) -oc_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(oc_LDFLAGS) $(LDFLAGS) \ - -o $@ -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -AM_V_CXX = $(am__v_CXX_@AM_V@) -am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) -am__v_CXX_0 = @echo " CXX " $@; -am__v_CXX_1 = -CXXLD = $(CXX) -CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ - -o $@ -AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) -am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) -am__v_CXXLD_0 = @echo " CXXLD " $@; -am__v_CXXLD_1 = -SOURCES = $(oc_SOURCES) -DIST_SOURCES = $(oc_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BOOSTHOME = @BOOSTHOME@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CCLD = @CCLD@ -CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EXEEXT = @EXEEXT@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -ROSEHOME = @ROSEHOME@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -YACC = @YACC@ -YFLAGS = @YFLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build_alias = @build_alias@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host_alias = @host_alias@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -SRCDIR = ../src -build_date = "\"`date +%m/%d/%Y`\"" -BUILT_SOURCES = $(SRCDIR)/lex.yy.cc $(SRCDIR)/parser.tab.cc -AM_YFLAGS = -d -t -calc_includes = -I$(SRCDIR) -I../include -I../../omega_lib/include \ - -I../../code_gen/include -I../../basic/include - -#calc_libs =../../omega_lib/obj/libomega.a -#calc_libs+=../../code_gen/obj/libcodegen.a -calc_libs = -lomega -lcodegen -calc_lib_paths = -L../../omega_lib/obj -L../../code_gen/obj \ - -L$(ROSEHOME)/lib -L$(BOOSTHOME)/lib -oc_SOURCES = $(SRCDIR)/AST.cc $(SRCDIR)/myflex.cc $(SRCDIR)/lex.yy.cc $(SRCDIR)/parser.tab.cc -oc_LDADD = $(calc_libs) -oc_LDFLAGS = $(calc_lib_paths) -oc_CPPFLAGS = $(calc_includes) -DBUILD_CODEGEN -DOMEGA_BUILD_DATE=$(build_date) -all: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) all-am - -.SUFFIXES: -.SUFFIXES: .cc .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign omega_calc/obj/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign omega_calc/obj/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -clean-noinstPROGRAMS: - -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) -$(SRCDIR)/$(am__dirstamp): - @$(MKDIR_P) $(SRCDIR) - @: > $(SRCDIR)/$(am__dirstamp) -$(SRCDIR)/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) $(SRCDIR)/$(DEPDIR) - @: > $(SRCDIR)/$(DEPDIR)/$(am__dirstamp) -$(SRCDIR)/oc-AST.$(OBJEXT): $(SRCDIR)/$(am__dirstamp) \ - $(SRCDIR)/$(DEPDIR)/$(am__dirstamp) -$(SRCDIR)/oc-myflex.$(OBJEXT): $(SRCDIR)/$(am__dirstamp) \ - $(SRCDIR)/$(DEPDIR)/$(am__dirstamp) -$(SRCDIR)/oc-lex.yy.$(OBJEXT): $(SRCDIR)/$(am__dirstamp) \ - $(SRCDIR)/$(DEPDIR)/$(am__dirstamp) -$(SRCDIR)/oc-parser.tab.$(OBJEXT): $(SRCDIR)/$(am__dirstamp) \ - $(SRCDIR)/$(DEPDIR)/$(am__dirstamp) - -oc$(EXEEXT): $(oc_OBJECTS) $(oc_DEPENDENCIES) $(EXTRA_oc_DEPENDENCIES) - @rm -f oc$(EXEEXT) - $(AM_V_CXXLD)$(oc_LINK) $(oc_OBJECTS) $(oc_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -rm -f $(SRCDIR)/*.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@$(SRCDIR)/$(DEPDIR)/oc-AST.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(SRCDIR)/$(DEPDIR)/oc-lex.yy.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(SRCDIR)/$(DEPDIR)/oc-myflex.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(SRCDIR)/$(DEPDIR)/oc-parser.tab.Po@am__quote@ - -.cc.o: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< - -.cc.obj: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -$(SRCDIR)/oc-AST.o: $(SRCDIR)/AST.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(oc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT $(SRCDIR)/oc-AST.o -MD -MP -MF $(SRCDIR)/$(DEPDIR)/oc-AST.Tpo -c -o $(SRCDIR)/oc-AST.o `test -f '$(SRCDIR)/AST.cc' || echo '$(srcdir)/'`$(SRCDIR)/AST.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(SRCDIR)/$(DEPDIR)/oc-AST.Tpo $(SRCDIR)/$(DEPDIR)/oc-AST.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(SRCDIR)/AST.cc' object='$(SRCDIR)/oc-AST.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(oc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o $(SRCDIR)/oc-AST.o `test -f '$(SRCDIR)/AST.cc' || echo '$(srcdir)/'`$(SRCDIR)/AST.cc - -$(SRCDIR)/oc-AST.obj: $(SRCDIR)/AST.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(oc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT $(SRCDIR)/oc-AST.obj -MD -MP -MF $(SRCDIR)/$(DEPDIR)/oc-AST.Tpo -c -o $(SRCDIR)/oc-AST.obj `if test -f '$(SRCDIR)/AST.cc'; then $(CYGPATH_W) '$(SRCDIR)/AST.cc'; else $(CYGPATH_W) '$(srcdir)/$(SRCDIR)/AST.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(SRCDIR)/$(DEPDIR)/oc-AST.Tpo $(SRCDIR)/$(DEPDIR)/oc-AST.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(SRCDIR)/AST.cc' object='$(SRCDIR)/oc-AST.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(oc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o $(SRCDIR)/oc-AST.obj `if test -f '$(SRCDIR)/AST.cc'; then $(CYGPATH_W) '$(SRCDIR)/AST.cc'; else $(CYGPATH_W) '$(srcdir)/$(SRCDIR)/AST.cc'; fi` - -$(SRCDIR)/oc-myflex.o: $(SRCDIR)/myflex.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(oc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT $(SRCDIR)/oc-myflex.o -MD -MP -MF $(SRCDIR)/$(DEPDIR)/oc-myflex.Tpo -c -o $(SRCDIR)/oc-myflex.o `test -f '$(SRCDIR)/myflex.cc' || echo '$(srcdir)/'`$(SRCDIR)/myflex.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(SRCDIR)/$(DEPDIR)/oc-myflex.Tpo $(SRCDIR)/$(DEPDIR)/oc-myflex.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(SRCDIR)/myflex.cc' object='$(SRCDIR)/oc-myflex.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(oc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o $(SRCDIR)/oc-myflex.o `test -f '$(SRCDIR)/myflex.cc' || echo '$(srcdir)/'`$(SRCDIR)/myflex.cc - -$(SRCDIR)/oc-myflex.obj: $(SRCDIR)/myflex.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(oc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT $(SRCDIR)/oc-myflex.obj -MD -MP -MF $(SRCDIR)/$(DEPDIR)/oc-myflex.Tpo -c -o $(SRCDIR)/oc-myflex.obj `if test -f '$(SRCDIR)/myflex.cc'; then $(CYGPATH_W) '$(SRCDIR)/myflex.cc'; else $(CYGPATH_W) '$(srcdir)/$(SRCDIR)/myflex.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(SRCDIR)/$(DEPDIR)/oc-myflex.Tpo $(SRCDIR)/$(DEPDIR)/oc-myflex.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(SRCDIR)/myflex.cc' object='$(SRCDIR)/oc-myflex.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(oc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o $(SRCDIR)/oc-myflex.obj `if test -f '$(SRCDIR)/myflex.cc'; then $(CYGPATH_W) '$(SRCDIR)/myflex.cc'; else $(CYGPATH_W) '$(srcdir)/$(SRCDIR)/myflex.cc'; fi` - -$(SRCDIR)/oc-lex.yy.o: $(SRCDIR)/lex.yy.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(oc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT $(SRCDIR)/oc-lex.yy.o -MD -MP -MF $(SRCDIR)/$(DEPDIR)/oc-lex.yy.Tpo -c -o $(SRCDIR)/oc-lex.yy.o `test -f '$(SRCDIR)/lex.yy.cc' || echo '$(srcdir)/'`$(SRCDIR)/lex.yy.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(SRCDIR)/$(DEPDIR)/oc-lex.yy.Tpo $(SRCDIR)/$(DEPDIR)/oc-lex.yy.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(SRCDIR)/lex.yy.cc' object='$(SRCDIR)/oc-lex.yy.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(oc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o $(SRCDIR)/oc-lex.yy.o `test -f '$(SRCDIR)/lex.yy.cc' || echo '$(srcdir)/'`$(SRCDIR)/lex.yy.cc - -$(SRCDIR)/oc-lex.yy.obj: $(SRCDIR)/lex.yy.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(oc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT $(SRCDIR)/oc-lex.yy.obj -MD -MP -MF $(SRCDIR)/$(DEPDIR)/oc-lex.yy.Tpo -c -o $(SRCDIR)/oc-lex.yy.obj `if test -f '$(SRCDIR)/lex.yy.cc'; then $(CYGPATH_W) '$(SRCDIR)/lex.yy.cc'; else $(CYGPATH_W) '$(srcdir)/$(SRCDIR)/lex.yy.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(SRCDIR)/$(DEPDIR)/oc-lex.yy.Tpo $(SRCDIR)/$(DEPDIR)/oc-lex.yy.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(SRCDIR)/lex.yy.cc' object='$(SRCDIR)/oc-lex.yy.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(oc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o $(SRCDIR)/oc-lex.yy.obj `if test -f '$(SRCDIR)/lex.yy.cc'; then $(CYGPATH_W) '$(SRCDIR)/lex.yy.cc'; else $(CYGPATH_W) '$(srcdir)/$(SRCDIR)/lex.yy.cc'; fi` - -$(SRCDIR)/oc-parser.tab.o: $(SRCDIR)/parser.tab.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(oc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT $(SRCDIR)/oc-parser.tab.o -MD -MP -MF $(SRCDIR)/$(DEPDIR)/oc-parser.tab.Tpo -c -o $(SRCDIR)/oc-parser.tab.o `test -f '$(SRCDIR)/parser.tab.cc' || echo '$(srcdir)/'`$(SRCDIR)/parser.tab.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(SRCDIR)/$(DEPDIR)/oc-parser.tab.Tpo $(SRCDIR)/$(DEPDIR)/oc-parser.tab.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(SRCDIR)/parser.tab.cc' object='$(SRCDIR)/oc-parser.tab.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(oc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o $(SRCDIR)/oc-parser.tab.o `test -f '$(SRCDIR)/parser.tab.cc' || echo '$(srcdir)/'`$(SRCDIR)/parser.tab.cc - -$(SRCDIR)/oc-parser.tab.obj: $(SRCDIR)/parser.tab.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(oc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT $(SRCDIR)/oc-parser.tab.obj -MD -MP -MF $(SRCDIR)/$(DEPDIR)/oc-parser.tab.Tpo -c -o $(SRCDIR)/oc-parser.tab.obj `if test -f '$(SRCDIR)/parser.tab.cc'; then $(CYGPATH_W) '$(SRCDIR)/parser.tab.cc'; else $(CYGPATH_W) '$(srcdir)/$(SRCDIR)/parser.tab.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(SRCDIR)/$(DEPDIR)/oc-parser.tab.Tpo $(SRCDIR)/$(DEPDIR)/oc-parser.tab.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(SRCDIR)/parser.tab.cc' object='$(SRCDIR)/oc-parser.tab.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(oc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o $(SRCDIR)/oc-parser.tab.obj `if test -f '$(SRCDIR)/parser.tab.cc'; then $(CYGPATH_W) '$(SRCDIR)/parser.tab.cc'; else $(CYGPATH_W) '$(srcdir)/$(SRCDIR)/parser.tab.cc'; fi` - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) check-am -all-am: Makefile $(PROGRAMS) -installdirs: -install: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -test -z "$(SRCDIR)/$(DEPDIR)/$(am__dirstamp)" || rm -f $(SRCDIR)/$(DEPDIR)/$(am__dirstamp) - -test -z "$(SRCDIR)/$(am__dirstamp)" || rm -f $(SRCDIR)/$(am__dirstamp) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -clean: clean-am - -clean-am: clean-generic clean-noinstPROGRAMS mostlyclean-am - -distclean: distclean-am - -rm -rf $(SRCDIR)/$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf $(SRCDIR)/$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: all check install install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-noinstPROGRAMS cscopelist-am ctags ctags-am distclean \ - distclean-compile distclean-generic distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ - uninstall-am - - -$(SRCDIR)/lex.yy.cc: $(SRCDIR)/parser.tab.cc $(SRCDIR)/parser.ll - flex++ -o $(SRCDIR)/lex.yy.cc $(SRCDIR)/parser.ll - -$(SRCDIR)/parser.tab.cc: - bison -t -d -o $(SRCDIR)/parser.tab.cc $(SRCDIR)/parser.yy - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/omega/omega_calc/obj/lex.yy.cc b/omega/omega_calc/obj/lex.yy.cc deleted file mode 100755 index 49a85e1..0000000 --- a/omega/omega_calc/obj/lex.yy.cc +++ /dev/null @@ -1,3966 +0,0 @@ - -#line 3 "lex.yy.cc" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - - /* The c++ scanner is a mess. The FlexLexer.h header file relies on the - * following macro. This is required in order to pass the c++-multiple-scanners - * test in the regression suite. We get reports that it breaks inheritance. - * We will address this in a future release of flex, or omit the C++ scanner - * altogether. - */ - #define yyFlexLexer yyFlexLexer - -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have . Non-C99 systems may or may not. */ - -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#include -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - -#endif /* ! C99 */ - -#endif /* ! FLEXINT_H */ - -/* begin standard C++ headers. */ -#include -#include -#include -#include -#include -/* end standard C++ headers. */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN (yy_start) = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START (((yy_start) - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else -#define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ -#endif - -/* The state buf must be large enough to hold one state per character in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -extern int yyleng; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - - /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires - * access to the local variable yy_act. Since yyless() is a macro, it would break - * existing scanners that call yyless() from OUTSIDE yylex. - * One obvious solution it to make yy_act a global. I tried that, and saw - * a 5% performance hit in a non-yylineno scanner, because yy_act is - * normally declared as a register variable-- so it is not worth it. - */ - #define YY_LESS_LINENO(n) \ - do { \ - int yyl;\ - for ( yyl = n; yyl < yyleng; ++yyl )\ - if ( yytext[yyl] == '\n' )\ - --yylineno;\ - }while(0) - -/* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, (yytext_ptr) ) - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state - { - - std::istream* yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - * - * Returns the top of the stack, or NULL. - */ -#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ - ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) - -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] - -void *yyalloc (yy_size_t ); -void *yyrealloc (void *,yy_size_t ); -void yyfree (void * ); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer( yyin, YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer( yyin, YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) - -/* Begin user sect3 */ -#define YY_SKIP_YYWRAP - -typedef unsigned char YY_CHAR; - -#define yytext_ptr yytext -#define YY_INTERACTIVE - -#include - -int yyFlexLexer::yywrap() { return 1; } - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - yyleng = (size_t) (yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; - -#define YY_NUM_RULES 147 -#define YY_END_OF_BUFFER 148 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static yyconst flex_int16_t yy_accept[2067] = - { 0, - 0, 0, 0, 0, 0, 0, 7, 7, 148, 146, - 5, 16, 117, 146, 6, 146, 109, 146, 46, 108, - 144, 146, 132, 134, 133, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 103, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 17, 110, 19, 15, - 146, 103, 30, 146, 5, 3, 3, 117, 146, 6, - 146, 109, 146, 46, 108, 144, 146, 132, 134, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 103, 136, 136, 136, 136, 136, 136, 136, 136, 136, - - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 17, 110, 19, 7, 5, 7, 7, 6, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 5, 130, 0, 145, 10, 111, 121, 144, - 120, 1, 124, 135, 127, 136, 0, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - - 136, 136, 122, 136, 136, 136, 136, 136, 114, 136, - 136, 136, 0, 136, 136, 136, 136, 136, 136, 112, - 9, 4, 13, 140, 14, 140, 140, 140, 140, 140, - 140, 140, 11, 140, 140, 12, 18, 20, 0, 0, - 5, 130, 0, 145, 0, 10, 111, 121, 144, 120, - 1, 124, 135, 136, 0, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 122, 136, 136, 136, 136, 136, 114, 136, 136, 136, - 0, 136, 136, 136, 136, 136, 136, 112, 7, 5, - - 7, 7, 7, 7, 7, 7, 7, 7, 1, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 113, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 118, 136, 136, 136, 136, 0, 136, 136, - - 28, 136, 136, 136, 136, 8, 0, 140, 140, 140, - 140, 140, 140, 129, 140, 140, 126, 140, 140, 140, - 140, 31, 2, 2, 0, 0, 0, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 113, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 118, - 136, 136, 136, 136, 0, 136, 136, 28, 136, 136, - 136, 136, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 0, 0, 0, 136, 136, 136, 136, 72, 136, 136, - 136, 136, 136, 136, 56, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 87, 136, 136, - 136, 47, 136, 136, 136, 136, 136, 136, 136, 32, - 136, 136, 136, 136, 49, 136, 136, 136, 0, 0, - 0, 25, 140, 23, 140, 140, 128, 140, 140, 125, - 116, 29, 119, 131, 140, 0, 0, 0, 136, 136, - 136, 136, 72, 136, 136, 136, 136, 136, 136, 56, - - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 87, 136, 136, 136, 47, 136, 136, 136, - 136, 136, 136, 136, 32, 136, 136, 136, 136, 49, - 136, 136, 136, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 137, 0, 0, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - - 136, 136, 136, 136, 136, 136, 136, 136, 88, 136, - 136, 136, 136, 136, 136, 51, 136, 136, 136, 136, - 136, 136, 136, 22, 136, 136, 136, 0, 0, 0, - 35, 140, 140, 45, 115, 140, 137, 0, 0, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 88, 136, 136, 136, 136, 136, 136, - 51, 136, 136, 136, 136, 136, 136, 136, 22, 136, - 136, 136, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 139, 138, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 48, - 136, 55, 73, 53, 136, 136, 136, 136, 136, 136, - 136, 136, 90, 136, 136, 136, 136, 136, 89, 136, - 141, 0, 0, 140, 140, 140, 139, 138, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 48, 136, 55, - - 73, 53, 136, 136, 136, 136, 136, 136, 136, 136, - 90, 136, 136, 136, 136, 136, 89, 136, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 91, 136, - 36, 136, 136, 136, 97, 136, 33, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - - 143, 142, 54, 52, 140, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 91, 136, 36, 136, 136, 136, 97, - 136, 33, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 62, 136, - - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 78, 77, 0, 136, 136, 136, 136, 136, 95, 136, - 136, 27, 136, 136, 136, 140, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 62, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 78, 77, 136, 136, 136, 136, 136, 95, 136, - 136, 27, 136, 136, 136, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - - 7, 7, 7, 7, 7, 136, 136, 67, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 71, 136, 136, - 136, 136, 136, 136, 136, 38, 136, 136, 136, 0, - 136, 136, 0, 136, 136, 0, 0, 136, 136, 136, - 136, 99, 136, 136, 136, 136, 136, 136, 136, 136, - 140, 136, 136, 67, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 71, 136, 136, 136, 136, 136, 136, - 136, 38, 136, 136, 136, 0, 136, 136, 0, 136, - 136, 136, 136, 136, 136, 99, 136, 136, 136, 136, - 136, 136, 136, 136, 7, 7, 7, 7, 7, 7, - - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 136, - 66, 136, 136, 64, 136, 136, 136, 68, 136, 136, - 63, 136, 136, 136, 98, 34, 0, 136, 136, 37, - 136, 136, 0, 0, 136, 136, 0, 0, 136, 136, - 0, 0, 136, 136, 136, 136, 0, 136, 136, 136, - 136, 94, 136, 136, 136, 136, 140, 136, 66, 136, - 136, 64, 136, 136, 136, 68, 136, 136, 63, 136, - - 136, 136, 98, 34, 0, 136, 136, 37, 136, 136, - 0, 0, 136, 136, 0, 0, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 94, 136, 136, 136, - 136, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 136, 70, - 136, 136, 136, 136, 136, 136, 21, 136, 136, 0, - 136, 136, 136, 93, 0, 0, 136, 136, 0, 0, - - 136, 136, 0, 0, 136, 136, 136, 136, 0, 136, - 136, 136, 136, 96, 50, 92, 136, 123, 136, 70, - 136, 136, 136, 136, 136, 136, 21, 136, 136, 0, - 136, 136, 136, 93, 0, 0, 136, 136, 0, 0, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 96, 50, 92, 136, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 136, 136, 136, 136, 136, 136, 136, - - 136, 136, 0, 136, 136, 24, 0, 0, 136, 136, - 0, 0, 136, 136, 0, 0, 136, 136, 136, 136, - 100, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 0, 136, 136, 24, 0, - 0, 136, 136, 0, 0, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 136, - 136, 136, 136, 136, 69, 136, 136, 136, 0, 136, - - 136, 0, 0, 136, 82, 0, 0, 136, 81, 0, - 0, 136, 136, 136, 136, 136, 105, 136, 136, 136, - 136, 136, 136, 136, 136, 69, 136, 136, 136, 0, - 136, 136, 0, 0, 136, 82, 0, 0, 136, 81, - 136, 136, 136, 136, 136, 105, 136, 136, 136, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 136, 136, 136, 136, 136, 136, 136, 136, 0, 136, - 136, 0, 80, 86, 0, 79, 85, 0, 0, 136, - - 136, 136, 136, 102, 136, 104, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 0, 136, 136, 0, 80, - 86, 0, 79, 85, 136, 136, 136, 136, 102, 136, - 104, 136, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 136, - 136, 136, 136, 136, 136, 136, 136, 0, 136, 74, - 84, 83, 0, 0, 136, 136, 136, 136, 101, 136, - 136, 136, 136, 136, 136, 136, 136, 136, 0, 136, - 74, 84, 83, 136, 136, 136, 136, 101, 136, 7, - - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 136, 136, 136, 136, 136, 136, 136, 136, 75, 76, - 0, 0, 136, 44, 136, 136, 26, 136, 136, 136, - 136, 136, 136, 136, 136, 75, 76, 136, 44, 136, - 136, 26, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 61, - 58, 136, 136, 60, 136, 136, 136, 0, 0, 136, - 136, 136, 61, 58, 136, 136, 60, 136, 136, 136, - 136, 136, 136, 7, 7, 7, 7, 7, 7, 7, - - 7, 7, 7, 7, 7, 7, 136, 136, 136, 136, - 136, 0, 42, 41, 136, 43, 136, 136, 136, 136, - 136, 41, 136, 43, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 136, 65, 59, 106, 136, 0, - 136, 136, 65, 59, 106, 136, 136, 7, 7, 7, - 7, 7, 7, 7, 57, 107, 39, 40, 57, 107, - 40, 7, 7, 7, 7, 0 - } ; - -static yyconst flex_int32_t yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 5, 6, 7, 8, 1, 9, 10, 11, - 12, 1, 1, 1, 13, 14, 15, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 17, 1, 18, - 19, 20, 1, 1, 21, 22, 23, 24, 22, 22, - 22, 25, 26, 22, 22, 27, 22, 22, 28, 29, - 30, 31, 32, 33, 34, 35, 22, 22, 22, 22, - 1, 36, 1, 1, 37, 1, 38, 39, 40, 41, - - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst flex_int32_t yy_meta[67] = - { 0, - 1, 1, 2, 3, 4, 1, 1, 1, 1, 5, - 6, 1, 1, 1, 1, 7, 1, 1, 1, 1, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 4, 7, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 4, 1, 4 - } ; - -static yyconst flex_int16_t yy_base[2080] = - { 0, - 0, 0, 64, 65, 130, 0, 196, 0, 3618, 3619, - 67, 3619, 3598, 3610, 3619, 3607, 3605, 3593, 3619, 3619, - 3596, 3592, 56, 3591, 3590, 66, 68, 70, 72, 253, - 74, 255, 257, 76, 78, 81, 3619, 3598, 261, 264, - 267, 259, 270, 272, 274, 276, 278, 285, 280, 287, - 289, 83, 323, 293, 295, 316, 3619, 3542, 3619, 3619, - 3598, 382, 3540, 3584, 93, 3619, 94, 83, 332, 3583, - 91, 95, 3582, 3581, 3580, 90, 88, 108, 97, 448, - 514, 3547, 3556, 3539, 3550, 67, 3537, 3552, 3547, 3550, - 3571, 580, 294, 272, 307, 3529, 291, 3543, 3537, 3535, - - 3534, 317, 3533, 3529, 3528, 316, 307, 3536, 241, 3535, - 3560, 331, 3559, 0, 362, 3559, 270, 0, 3569, 3567, - 3555, 0, 0, 3558, 3554, 322, 3553, 3552, 646, 712, - 3518, 3527, 3510, 3521, 318, 3508, 3523, 3518, 3521, 0, - 778, 320, 322, 315, 3501, 330, 3515, 3509, 3507, 3506, - 334, 3505, 3501, 3500, 337, 378, 3508, 337, 3507, 0, - 3487, 0, 387, 3619, 3545, 3619, 3619, 3619, 3619, 3534, - 3619, 3619, 3619, 3619, 3619, 3539, 367, 367, 373, 390, - 387, 393, 396, 398, 424, 441, 403, 459, 466, 3538, - 461, 482, 484, 409, 489, 463, 468, 486, 472, 494, - - 496, 545, 548, 527, 536, 542, 532, 551, 400, 554, - 558, 564, 3490, 623, 534, 560, 566, 614, 556, 3619, - 3543, 3619, 3619, 3534, 3619, 632, 487, 434, 530, 616, - 631, 603, 629, 626, 497, 3533, 3619, 3619, 3523, 3522, - 615, 3521, 671, 3520, 469, 3519, 3518, 3517, 401, 3516, - 3515, 3514, 3513, 392, 660, 0, 3489, 3480, 3490, 3480, - 3477, 3481, 3470, 3479, 3484, 3473, 3471, 844, 3480, 3467, - 3463, 3463, 440, 3477, 3473, 3465, 377, 3459, 3458, 429, - 371, 3466, 3451, 3449, 3458, 3451, 0, 3455, 3455, 573, - 676, 579, 3455, 3454, 3457, 3449, 3444, 3480, 0, 619, - - 0, 554, 0, 0, 0, 0, 3483, 0, 0, 0, - 0, 0, 3488, 653, 0, 3454, 3445, 3455, 3445, 3442, - 3446, 3435, 3444, 3449, 3438, 3436, 910, 3445, 3432, 3428, - 3428, 581, 3442, 3438, 3430, 590, 3424, 3423, 582, 636, - 3431, 3416, 3414, 3423, 3416, 0, 3420, 3420, 646, 3413, - 648, 3419, 3418, 3421, 3413, 3408, 0, 3413, 3405, 3420, - 688, 693, 695, 697, 725, 739, 727, 730, 743, 746, - 750, 732, 748, 764, 752, 794, 755, 758, 805, 734, - 810, 812, 817, 801, 814, 824, 827, 830, 819, 863, - 821, 867, 807, 879, 887, 892, 876, 3447, 881, 865, - - 924, 928, 884, 930, 932, 3619, 853, 3449, 59, 889, - 698, 836, 890, 717, 936, 704, 895, 893, 939, 940, - 941, 3448, 3619, 3452, 782, 761, 259, 3411, 580, 3404, - 3406, 3412, 3398, 3406, 3411, 3393, 3396, 3397, 0, 3392, - 3404, 3390, 3402, 3390, 3390, 3398, 3402, 3389, 3382, 3389, - 3398, 3378, 3392, 3391, 3390, 3380, 3388, 3383, 3382, 0, - 3380, 3382, 3385, 3367, 680, 3367, 3380, 916, 3379, 3368, - 3377, 3373, 3366, 3358, 3373, 3368, 767, 3361, 3363, 3369, - 3355, 3363, 3368, 3350, 3353, 3354, 0, 3349, 3361, 3347, - 3359, 3347, 3347, 3355, 3359, 3346, 3339, 3346, 3355, 3335, - - 3349, 3348, 3347, 3337, 3345, 3340, 3339, 0, 3337, 3339, - 3342, 3324, 3366, 3323, 3336, 917, 3335, 3324, 3333, 3329, - 3361, 3315, 3314, 947, 949, 954, 956, 873, 968, 958, - 976, 980, 982, 989, 991, 993, 998, 1000, 1005, 1002, - 1009, 1014, 1011, 1016, 1019, 1021, 1024, 1026, 1029, 1031, - 1033, 1050, 1052, 1054, 1060, 1064, 1067, 1071, 1073, 3619, - 1079, 1081, 1083, 1085, 1087, 1089, 1091, 1101, 3319, 3311, - 3326, 3356, 977, 3355, 753, 1012, 3354, 1057, 1044, 3353, - 3352, 3351, 3350, 3349, 960, 876, 1046, 1067, 3308, 3318, - 3315, 3298, 0, 3317, 3294, 3296, 3304, 3326, 3301, 0, - - 3297, 3293, 3301, 3302, 1065, 3287, 1080, 3298, 3290, 3285, - 3303, 3291, 0, 3288, 3283, 3282, 0, 3281, 3285, 3284, - 3291, 3290, 3286, 3275, 3309, 3286, 3272, 3284, 3273, 3284, - 3272, 3267, 847, 3309, 3263, 3262, 3267, 3277, 3274, 3257, - 0, 3276, 3253, 3255, 3263, 3285, 3260, 0, 3256, 3252, - 3260, 3261, 1066, 3246, 1087, 3257, 3249, 3244, 3262, 3250, - 0, 3247, 3242, 3241, 0, 3240, 3244, 3243, 3250, 3249, - 3245, 3234, 0, 3246, 3232, 3244, 3233, 3244, 3232, 3227, - 1006, 3619, 3269, 3268, 1120, 1123, 1128, 1131, 1133, 1139, - 1141, 1144, 1146, 1148, 1150, 1153, 1155, 1157, 1160, 1162, - - 1164, 1167, 1169, 1171, 1181, 1183, 1185, 1195, 1190, 1197, - 1202, 1205, 1210, 1215, 1217, 1221, 1224, 1226, 1235, 1237, - 1239, 1241, 1249, 1244, 1254, 1256, 1258, 3267, 3221, 3220, - 3265, 1172, 1165, 3264, 3263, 1222, 3253, 961, 1251, 3230, - 3246, 3209, 3216, 3213, 3221, 3220, 3240, 3206, 3221, 3201, - 3204, 3218, 3217, 3216, 3201, 3203, 3203, 3199, 3202, 3203, - 3195, 3194, 3200, 0, 3192, 3191, 3209, 3199, 3198, 3203, - 0, 3204, 3195, 3183, 3183, 3177, 3188, 3187, 0, 3198, - 3183, 3175, 0, 3220, 3219, 3188, 3204, 3167, 3174, 3171, - 3179, 3178, 3198, 3164, 3179, 3159, 3162, 3176, 3175, 3174, - - 3159, 3161, 3161, 3157, 3160, 3161, 3153, 3152, 3158, 0, - 3150, 3149, 3167, 3157, 3156, 3161, 0, 3162, 3153, 3141, - 3141, 3135, 3146, 3145, 0, 3156, 3141, 3133, 3619, 3619, - 1263, 1265, 1271, 1273, 1294, 1298, 1267, 1300, 1302, 1304, - 1310, 1323, 1314, 1317, 1320, 1325, 1327, 1330, 1332, 1334, - 1336, 1338, 1342, 1352, 1354, 1361, 1369, 1371, 1373, 1375, - 1377, 1379, 1381, 1383, 1388, 1391, 1394, 1396, 1399, 1401, - 3619, 3178, 3177, 1187, 1269, 1094, 3168, 3167, 972, 3128, - 1264, 3136, 1215, 3128, 3124, 3124, 3132, 3155, 3133, 1089, - 3137, 3126, 3126, 3133, 3125, 3142, 3130, 0, 3129, 0, - - 0, 0, 3128, 3127, 3129, 3104, 3103, 3108, 3125, 3123, - 3110, 3119, 3122, 3104, 3090, 3087, 0, 3062, 0, 0, - 1274, 3060, 1390, 3062, 1278, 3054, 3036, 3036, 3042, 3065, - 3043, 1332, 3043, 3018, 3018, 3025, 3017, 3034, 3022, 0, - 3021, 0, 0, 0, 3020, 3019, 3021, 2996, 2995, 3000, - 3017, 3015, 3002, 3010, 3013, 3003, 2996, 3008, 0, 2989, - 1407, 1412, 1417, 1419, 1428, 1430, 1432, 1437, 1434, 1439, - 1441, 1444, 1446, 1450, 1452, 1458, 1465, 1467, 1469, 1474, - 1477, 1480, 1486, 1488, 1490, 1495, 1500, 1502, 1504, 1507, - 1515, 1510, 1519, 1521, 1523, 1527, 1530, 1534, 1537, 1545, - - 3619, 3619, 3034, 3033, 1295, 2991, 2984, 2992, 1027, 32, - 352, 363, 449, 505, 573, 588, 648, 913, 925, 998, - 1068, 1077, 1108, 0, 1144, 0, 1161, 1167, 1172, 0, - 1230, 0, 1233, 1290, 1297, 1546, 1310, 1316, 1332, 1320, - 1345, 1357, 1344, 1362, 1383, 1372, 1373, 1404, 1506, 1407, - 1425, 1431, 1430, 1436, 1461, 1465, 1475, 1478, 1484, 1503, - 1506, 1502, 1524, 0, 1520, 0, 1521, 1523, 1515, 0, - 1528, 0, 1517, 1529, 1530, 1571, 1524, 1521, 1536, 1524, - 1534, 1545, 1530, 1535, 1551, 1583, 1585, 1587, 1590, 1592, - 1594, 1596, 1599, 1601, 1603, 1605, 1607, 1609, 1611, 1613, - - 1615, 1627, 1634, 1636, 1644, 1646, 1649, 1653, 1655, 1657, - 1659, 1663, 1589, 1667, 1669, 1671, 1679, 1695, 1681, 1686, - 1691, 1697, 1700, 1706, 1714, 1580, 1579, 1582, 1590, 1606, - 1600, 1612, 1618, 1643, 1636, 1639, 1671, 1676, 1654, 0, - 1664, 1684, 1672, 1678, 1691, 1680, 1692, 1685, 1695, 1679, - 1679, 1726, 1727, 1681, 1691, 1705, 1703, 1722, 0, 1695, - 1695, 0, 1691, 1692, 1695, 1702, 1705, 1706, 1714, 1710, - 1712, 1709, 1722, 1715, 1717, 1746, 1748, 1723, 0, 1724, - 1736, 1719, 1725, 1738, 1727, 1738, 1731, 1743, 1727, 1727, - 1773, 1774, 1750, 1729, 1739, 1753, 1750, 1769, 0, 1742, - - 1742, 0, 1738, 1739, 1742, 1793, 1797, 1799, 1801, 1806, - 1808, 1810, 1812, 1814, 1820, 1816, 1823, 1826, 1828, 1832, - 1838, 1840, 1844, 1848, 1857, 1852, 1861, 1863, 1868, 1758, - 1870, 1872, 1811, 1874, 1876, 1741, 1789, 1880, 1888, 1882, - 1897, 1891, 1901, 1905, 1913, 1917, 1920, 1922, 1924, 1926, - 1836, 1805, 1807, 0, 1820, 1825, 1848, 1849, 1890, 1878, - 1872, 1880, 1877, 0, 1889, 1882, 1902, 1885, 1882, 1888, - 1933, 0, 1905, 1903, 1899, 1932, 1899, 1917, 1937, 1904, - 1920, 1921, 1929, 1902, 1912, 1960, 1913, 1928, 1926, 1928, - 1925, 1924, 1929, 1936, 1944, 1935, 0, 1945, 1947, 1939, - - 1934, 1967, 1952, 1944, 1949, 1943, 0, 1947, 1940, 1960, - 1943, 1938, 1944, 1989, 0, 1961, 1958, 1954, 1965, 1955, - 1970, 1968, 1958, 1973, 1952, 1962, 1976, 1983, 1956, 1966, - 2014, 1967, 1983, 1981, 1981, 1976, 1972, 1977, 1983, 2020, - 2023, 2027, 2030, 2032, 2035, 2037, 2039, 2041, 2044, 2046, - 2048, 2050, 2052, 2057, 2054, 2059, 1992, 2061, 2063, 2068, - 2070, 2072, 1987, 2006, 2077, 2080, 2001, 2046, 2083, 2087, - 2061, 2096, 2092, 2095, 2097, 2100, 2060, 2105, 2107, 2109, - 2113, 2115, 2118, 2129, 2131, 2133, 2103, 2075, 0, 2082, - 2086, 0, 2092, 2084, 2099, 0, 2104, 2097, 0, 2106, - - 2092, 2112, 0, 0, 2132, 2110, 2118, 0, 2107, 2121, - 2144, 2146, 2115, 2116, 2148, 2149, 2120, 2122, 2112, 2114, - 2139, 2141, 2129, 2129, 2129, 2144, 0, 2143, 2144, 2147, - 2139, 2144, 0, 2143, 2146, 0, 2151, 2142, 2149, 0, - 2155, 2148, 0, 2157, 2144, 2164, 0, 0, 2160, 2161, - 2167, 0, 2154, 2166, 2156, 2171, 2160, 2160, 2160, 2175, - 2164, 2164, 2178, 2213, 2156, 2157, 2182, 2184, 2170, 2173, - 2173, 2173, 2188, 0, 2185, 2186, 2188, 2180, 2221, 2223, - 2225, 2227, 2229, 2231, 2233, 2235, 2237, 2239, 2241, 2215, - 2246, 2244, 2249, 2251, 2208, 2212, 2254, 2257, 2216, 2218, - - 2267, 2260, 2213, 2223, 2276, 2278, 2280, 2283, 2238, 2285, - 2292, 2296, 2299, 2301, 2303, 2305, 2307, 2286, 2268, 0, - 2269, 2265, 2271, 2273, 2285, 2287, 0, 2281, 2272, 2310, - 2293, 2277, 2282, 0, 2314, 2315, 2299, 2294, 2320, 2321, - 2305, 2300, 2313, 2297, 2287, 2295, 2314, 2309, 2304, 2304, - 0, 0, 0, 2303, 2306, 0, 2307, 2303, 2310, 2311, - 2323, 2326, 0, 2321, 2311, 2331, 2333, 2318, 2323, 0, - 2325, 2325, 2339, 2334, 2329, 2329, 2343, 2338, 2321, 2328, - 2353, 2336, 2325, 2332, 2346, 2352, 2347, 2342, 2342, 0, - 0, 0, 2341, 2385, 2387, 2389, 2391, 2394, 2396, 2399, - - 2401, 2403, 2348, 2405, 2407, 2409, 2370, 2377, 2416, 2419, - 2384, 2380, 2423, 2425, 2424, 2375, 2428, 2431, 2436, 2441, - 3619, 2443, 2453, 2448, 2455, 2461, 2402, 2405, 2406, 2397, - 2430, 2426, 2429, 2420, 2431, 2458, 2424, 2432, 0, 2462, - 2461, 2437, 2442, 2468, 2465, 2441, 2449, 2430, 2454, 2457, - 2434, 2451, 2456, 2463, 2458, 2455, 2469, 2470, 2469, 2453, - 2476, 2467, 2470, 2461, 2472, 2464, 2465, 2473, 0, 2484, - 2479, 2478, 2483, 2488, 2483, 2482, 2487, 2526, 2469, 2470, - 2494, 2497, 2473, 0, 2490, 2495, 2500, 2495, 2491, 2531, - 2533, 2535, 2537, 2539, 2541, 2543, 2546, 2548, 2507, 2550, - - 2553, 2516, 2523, 2556, 2558, 2524, 2529, 2562, 2564, 2520, - 2527, 2570, 2572, 2574, 2582, 2589, 2591, 2595, 2600, 2598, - 2521, 2530, 2544, 2555, 2546, 0, 2561, 2571, 2559, 2597, - 2568, 2580, 2601, 2606, 2568, 0, 2603, 2608, 2571, 0, - 2575, 2575, 2573, 2581, 2582, 0, 2588, 2593, 2590, 2580, - 2581, 2588, 2601, 2589, 0, 2600, 2609, 2597, 2606, 2607, - 2618, 2611, 2616, 2608, 0, 2614, 2619, 2611, 0, 2607, - 2614, 2615, 2614, 2611, 2618, 2618, 0, 2624, 2629, 2626, - 2663, 2665, 2667, 2669, 2671, 2674, 2676, 2678, 2645, 2680, - 2682, 2643, 3619, 2685, 2646, 3619, 2688, 2638, 2662, 2692, - - 2694, 2696, 2703, 2705, 2709, 2715, 2718, 2662, 2664, 2666, - 2666, 2686, 2695, 2688, 2692, 2716, 2699, 2683, 2720, 2721, - 0, 2724, 2725, 0, 2707, 2698, 2686, 2710, 0, 2699, - 0, 2708, 2706, 2707, 2698, 2695, 2711, 2721, 2716, 2720, - 2726, 2727, 2710, 2716, 0, 0, 2717, 0, 0, 2707, - 2731, 2733, 2724, 2712, 2737, 0, 2726, 0, 2735, 2769, - 2771, 2773, 2775, 2777, 2779, 2781, 2784, 2737, 2786, 2788, - 3619, 3619, 2751, 2750, 2793, 2795, 2797, 2802, 2799, 2804, - 2764, 2765, 2780, 2795, 2770, 2767, 2787, 2780, 2807, 2772, - 0, 2811, 2812, 2781, 2778, 2785, 2785, 0, 2776, 2787, - - 2788, 2803, 2818, 2792, 2789, 2810, 2803, 2794, 2796, 0, - 0, 0, 2803, 2803, 2804, 2801, 2808, 2807, 0, 2798, - 2851, 2854, 2857, 2859, 2861, 2863, 2865, 2868, 3619, 2870, - 2838, 2833, 2873, 2875, 2877, 2879, 2881, 2842, 2843, 2838, - 2838, 2846, 2852, 2860, 2862, 2881, 0, 2854, 0, 2868, - 2859, 0, 2859, 2860, 2856, 2857, 2867, 2873, 2881, 2883, - 0, 0, 2884, 2875, 2876, 0, 2887, 2878, 0, 2919, - 2921, 2923, 2925, 2927, 2929, 2931, 2933, 2893, 2890, 2937, - 2939, 2941, 0, 0, 2907, 2905, 0, 2903, 2907, 2918, - 2902, 2907, 2904, 0, 0, 2915, 2913, 0, 2911, 2915, - - 2926, 2914, 2911, 2912, 2918, 2915, 2965, 2967, 2972, 2976, - 2978, 2924, 3619, 2974, 2984, 2988, 2927, 2941, 2941, 2954, - 2951, 0, 2952, 0, 2950, 2954, 2953, 2963, 2957, 2958, - 0, 0, 2959, 0, 2999, 3001, 3003, 3009, 3011, 2959, - 3014, 2975, 0, 0, 0, 2986, 2973, 2979, 0, 0, - 0, 2989, 2976, 2978, 3025, 3027, 3619, 3029, 0, 0, - 0, 0, 0, 0, 0, 3619, 3070, 3074, 3078, 3084, - 3092, 3100, 3108, 3116, 3124, 3132, 3140, 3148, 3151 - } ; - -static yyconst flex_int16_t yy_def[2080] = - { 0, - 2066, 1, 1, 1, 2066, 5, 2066, 7, 2066, 2066, - 2066, 2066, 2066, 2067, 2066, 2066, 2066, 2066, 2066, 2066, - 2066, 2066, 2066, 2066, 2066, 2068, 2068, 2068, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2066, 2069, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2066, 2066, 2066, 2066, - 2066, 2070, 2066, 2071, 2071, 2066, 2066, 2071, 2072, 2071, - 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2073, - 2073, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 2071, 2074, 81, 81, 81, 81, 81, 81, 81, 81, - - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 2071, 2071, 2071, 2075, 2075, 2075, 2076, 2075, 2075, 2075, - 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2077, 2077, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 2075, - 2078, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 2075, - 2075, 2075, 2066, 2066, 2067, 2066, 2066, 2066, 2066, 2066, - 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2068, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2069, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - 2068, 2068, 2066, 2068, 2068, 2068, 2068, 2068, 2068, 2066, - 2066, 2066, 2066, 2079, 2066, 2079, 2079, 2079, 2079, 2079, - 2079, 2079, 2079, 2079, 2079, 2079, 2066, 2066, 2071, 2066, - 2071, 2071, 2072, 2071, 2067, 2071, 2071, 2066, 2071, 2071, - 2071, 2071, 2071, 2071, 2071, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 2074, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 2071, 81, 81, 81, 81, 81, 81, 2071, 2075, 2075, - - 2075, 2076, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, - 2075, 2075, 2075, 2075, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 2078, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 2075, - 130, 130, 130, 130, 130, 130, 2075, 2066, 2066, 2066, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2066, 2068, 2068, - - 2068, 2068, 2068, 2068, 2068, 2066, 2066, 2079, 2079, 2079, - 2079, 2079, 2079, 2079, 2079, 2079, 2079, 2079, 2079, 2079, - 2079, 2079, 2066, 2067, 2071, 2071, 2071, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 2071, 81, 81, 81, 81, 81, - 81, 81, 2075, 2075, 2075, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 2075, 130, 130, 130, 130, 130, 130, 130, - 2066, 2066, 2066, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2066, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2066, 2066, - 2066, 2079, 2079, 2079, 2079, 2079, 2079, 2079, 2079, 2079, - 2079, 2079, 2079, 2079, 2079, 2071, 2071, 2071, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 2071, 81, 81, 81, 81, 81, - 81, 81, 81, 2075, 2075, 2075, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 2075, 130, 130, 130, 130, 130, 130, 130, - 130, 2066, 2066, 2066, 2068, 2068, 2068, 2068, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2066, 2066, 2066, - 2079, 2079, 2079, 2079, 2079, 2079, 2071, 2071, 2071, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 2075, 2075, 2075, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 2066, 2066, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - 2066, 2066, 2066, 2079, 2079, 2079, 2071, 2071, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 2075, 2075, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - - 2066, 2066, 2079, 2079, 2079, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 2068, 2068, 2068, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - 2068, 2068, 2066, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2079, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 2075, 130, 130, 130, 130, 130, 130, 130, - - 130, 130, 130, 130, 130, 2068, 2068, 2068, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2066, - 2068, 2068, 2066, 2068, 2068, 2066, 2066, 2068, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - 2079, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 2071, 81, 81, 2071, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 130, 130, 130, 130, 130, 130, - - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 2075, 130, - 130, 2075, 130, 130, 2075, 2075, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2066, 2068, 2068, 2068, - 2068, 2068, 2066, 2066, 2068, 2068, 2066, 2066, 2068, 2068, - 2066, 2066, 2068, 2068, 2068, 2068, 2066, 2068, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2079, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - - 81, 81, 81, 81, 2071, 81, 81, 81, 81, 81, - 2071, 2071, 81, 81, 2071, 2071, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 2075, 130, - 130, 130, 130, 130, 2075, 2075, 130, 130, 2075, 2075, - 130, 130, 2075, 2075, 130, 130, 130, 130, 2075, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 2068, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2066, - 2068, 2068, 2068, 2068, 2066, 2066, 2068, 2068, 2066, 2066, - - 2068, 2068, 2066, 2066, 2068, 2068, 2068, 2068, 2066, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2079, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 2071, - 81, 81, 81, 81, 2071, 2071, 81, 81, 2071, 2071, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 2075, 130, 130, 130, 130, - 2075, 2075, 130, 130, 2075, 2075, 130, 130, 2075, 2075, - 130, 130, 130, 130, 2075, 130, 130, 130, 130, 130, - 130, 130, 130, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - - 2068, 2068, 2066, 2068, 2068, 2068, 2066, 2066, 2068, 2068, - 2066, 2066, 2068, 2068, 2066, 2066, 2068, 2068, 2068, 2068, - 2066, 2068, 2068, 2068, 2068, 2068, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 2071, 81, 81, 81, 2071, - 2071, 81, 81, 2071, 2071, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 81, 81, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 2075, 130, 130, 130, 2075, - 2075, 130, 130, 2075, 2075, 130, 130, 2075, 2075, 130, - 130, 130, 130, 2075, 130, 130, 130, 130, 130, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2066, 2068, - - 2068, 2066, 2066, 2068, 2068, 2066, 2066, 2068, 2068, 2066, - 2066, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 2071, - 81, 81, 2071, 2071, 81, 81, 2071, 2071, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 2075, 130, - 130, 2075, 2075, 130, 130, 2075, 2075, 130, 130, 2075, - 2075, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2066, 2068, - 2068, 2066, 2066, 2068, 2066, 2066, 2068, 2066, 2066, 2068, - - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 81, 81, 81, - 81, 81, 81, 81, 81, 2071, 81, 81, 2071, 2071, - 81, 2071, 2071, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 130, 130, 130, 130, 130, 130, 130, 130, - 2075, 130, 130, 2075, 2075, 130, 2075, 2075, 130, 2075, - 2075, 130, 130, 130, 130, 130, 130, 130, 130, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2066, 2068, 2068, - 2066, 2066, 2066, 2066, 2068, 2068, 2068, 2068, 2068, 2068, - 81, 81, 81, 81, 81, 81, 81, 81, 2071, 81, - 81, 2071, 2071, 81, 81, 81, 81, 81, 81, 130, - - 130, 130, 130, 130, 130, 130, 130, 2075, 130, 130, - 2075, 2075, 2075, 2075, 130, 130, 130, 130, 130, 130, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2066, 2068, - 2066, 2066, 2068, 2068, 2068, 2068, 2068, 81, 81, 81, - 81, 81, 81, 81, 81, 2071, 81, 81, 81, 81, - 81, 81, 130, 130, 130, 130, 130, 130, 130, 130, - 2075, 130, 2075, 2075, 130, 130, 130, 130, 130, 2068, - 2068, 2068, 2068, 2068, 2068, 2068, 2068, 2066, 2066, 2068, - 2068, 2068, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 130, 130, 130, 130, 130, 130, 130, - - 130, 2075, 2075, 130, 130, 130, 2068, 2068, 2068, 2068, - 2068, 2066, 2066, 2068, 2068, 2068, 81, 81, 81, 81, - 81, 81, 81, 81, 130, 130, 130, 130, 130, 2075, - 2075, 130, 130, 130, 2068, 2068, 2068, 2068, 2068, 2066, - 2068, 81, 81, 81, 81, 81, 81, 130, 130, 130, - 130, 130, 2075, 130, 2068, 2068, 2066, 2068, 81, 81, - 81, 130, 130, 2075, 130, 0, 2066, 2066, 2066, 2066, - 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066 - } ; - -static yyconst flex_int16_t yy_nxt[3686] = - { 0, - 10, 11, 12, 11, 13, 14, 15, 16, 17, 10, - 10, 10, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 27, 31, 27, 32, 33, - 34, 35, 27, 27, 36, 37, 38, 39, 27, 40, - 41, 42, 43, 44, 27, 45, 46, 27, 47, 48, - 49, 50, 51, 27, 52, 53, 54, 55, 27, 56, - 27, 27, 27, 57, 58, 59, 60, 60, 163, 407, - 163, 61, 61, 172, 173, 176, 177, 176, 177, 176, - 177, 176, 177, 176, 177, 176, 177, 176, 177, 1132, - 176, 177, 176, 177, 241, 163, 163, 163, 246, 62, - - 62, 242, 240, 247, 262, 249, 250, 240, 179, 240, - 240, 572, 240, 181, 240, 253, 240, 187, 263, 183, - 211, 180, 189, 188, 212, 251, 252, 240, 63, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 64, - 64, 64, 73, 74, 75, 76, 77, 78, 79, 25, - 80, 81, 82, 83, 84, 81, 85, 81, 86, 87, - 88, 89, 81, 81, 90, 91, 92, 93, 81, 94, - 95, 96, 97, 98, 81, 99, 100, 81, 101, 102, - 103, 104, 105, 81, 106, 107, 108, 109, 81, 110, - 81, 81, 81, 111, 112, 113, 114, 115, 12, 115, - - 116, 117, 118, 119, 120, 114, 114, 114, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 130, 134, 130, 135, 136, 137, 138, 130, 130, - 139, 140, 141, 142, 130, 143, 144, 145, 146, 147, - 130, 148, 149, 130, 150, 151, 152, 153, 154, 130, - 155, 156, 157, 158, 130, 159, 130, 130, 130, 160, - 161, 162, 176, 177, 176, 177, 176, 177, 176, 177, - 176, 177, 165, 176, 177, 303, 176, 177, 240, 176, - 177, 176, 177, 176, 177, 176, 177, 176, 177, 176, - 177, 295, 184, 296, 176, 177, 176, 177, 176, 177, - - 588, 194, 176, 177, 176, 177, 185, 200, 196, 272, - 182, 191, 197, 192, 186, 195, 193, 202, 198, 199, - 291, 201, 206, 273, 203, 176, 177, 204, 278, 205, - 207, 208, 176, 177, 165, 165, 213, 244, 216, 309, - 310, 209, 279, 210, 269, 217, 270, 218, 274, 271, - 240, 245, 275, 289, 284, 321, 333, 290, 276, 331, - 334, 219, 285, 300, 292, 300, 335, 337, 293, 322, - 328, 343, 329, 332, 348, 330, 176, 177, 349, 344, - 214, 338, 176, 177, 215, 222, 223, 354, 163, 355, - 163, 350, 358, 1133, 359, 298, 176, 177, 360, 176, - - 177, 254, 176, 177, 1134, 176, 177, 176, 177, 176, - 177, 240, 176, 177, 448, 361, 249, 225, 176, 177, - 240, 226, 449, 227, 228, 229, 363, 454, 230, 455, - 231, 232, 233, 176, 177, 351, 234, 235, 236, 352, - 362, 364, 369, 366, 407, 237, 365, 238, 239, 239, - 176, 177, 239, 239, 239, 239, 239, 254, 255, 239, - 239, 239, 239, 375, 239, 239, 239, 240, 176, 177, - 176, 177, 176, 177, 166, 176, 177, 176, 177, 367, - 443, 176, 177, 239, 452, 413, 368, 453, 424, 444, - 257, 176, 177, 176, 177, 176, 177, 407, 176, 177, - - 1135, 372, 378, 176, 177, 176, 177, 407, 370, 381, - 379, 239, 239, 239, 239, 239, 371, 382, 239, 239, - 239, 239, 239, 254, 255, 239, 239, 239, 239, 376, - 239, 239, 239, 240, 373, 380, 176, 177, 377, 374, - 407, 176, 177, 176, 177, 176, 177, 412, 383, 239, - 384, 176, 177, 422, 176, 177, 165, 176, 177, 303, - 176, 177, 1136, 176, 177, 176, 177, 176, 177, 176, - 177, 414, 389, 176, 177, 176, 177, 239, 239, 239, - 239, 239, 392, 401, 239, 239, 239, 239, 239, 254, - 239, 239, 239, 239, 239, 390, 239, 239, 239, 240, - - 385, 396, 391, 386, 387, 394, 388, 393, 395, 402, - 463, 403, 405, 407, 1137, 239, 241, 466, 163, 397, - 300, 491, 300, 176, 177, 590, 407, 496, 464, 1138, - 492, 467, 176, 177, 240, 497, 407, 500, 591, 407, - 501, 407, 407, 239, 239, 239, 299, 299, 419, 299, - 299, 299, 299, 299, 299, 313, 314, 299, 299, 299, - 299, 399, 299, 299, 299, 299, 404, 415, 416, 409, - 420, 421, 417, 165, 165, 400, 244, 410, 473, 240, - 474, 299, 418, 511, 475, 425, 514, 426, 316, 411, - 245, 427, 502, 625, 503, 240, 1139, 176, 177, 240, - - 515, 512, 176, 177, 176, 177, 176, 177, 407, 299, - 299, 299, 299, 299, 407, 299, 299, 299, 299, 299, - 299, 313, 314, 299, 299, 299, 299, 407, 299, 299, - 299, 299, 465, 524, 176, 177, 176, 177, 525, 176, - 177, 176, 177, 176, 177, 528, 527, 299, 176, 177, - 574, 526, 176, 177, 579, 176, 177, 176, 177, 176, - 177, 176, 177, 407, 176, 177, 529, 176, 177, 532, - 577, 543, 531, 176, 177, 299, 299, 299, 299, 299, - 240, 299, 299, 299, 299, 299, 299, 313, 299, 299, - 299, 299, 299, 530, 299, 299, 299, 299, 534, 533, - - 535, 240, 536, 176, 177, 537, 538, 540, 732, 541, - 176, 177, 638, 299, 176, 177, 176, 177, 587, 176, - 177, 176, 177, 176, 177, 639, 176, 177, 176, 177, - 176, 177, 586, 176, 177, 539, 176, 177, 547, 176, - 177, 299, 299, 299, 239, 239, 407, 542, 239, 239, - 239, 239, 239, 254, 239, 239, 239, 239, 239, 544, - 239, 239, 239, 240, 546, 549, 554, 545, 550, 552, - 548, 551, 176, 177, 176, 177, 176, 177, 569, 239, - 570, 575, 176, 177, 571, 176, 177, 737, 176, 177, - 176, 177, 781, 176, 177, 240, 176, 177, 782, 407, - - 407, 176, 177, 407, 553, 407, 562, 239, 239, 239, - 299, 299, 555, 299, 299, 299, 299, 299, 299, 313, - 299, 299, 299, 299, 299, 556, 299, 299, 299, 299, - 557, 558, 559, 176, 177, 566, 561, 176, 177, 176, - 177, 176, 177, 573, 576, 299, 407, 581, 580, 407, - 407, 407, 628, 676, 629, 677, 176, 177, 176, 177, - 563, 1140, 564, 176, 177, 176, 177, 176, 177, 565, - 407, 567, 877, 299, 299, 299, 568, 176, 177, 582, - 240, 578, 1141, 583, 585, 176, 177, 407, 686, 176, - 177, 176, 177, 584, 1006, 687, 1007, 685, 176, 177, - - 176, 177, 176, 177, 736, 689, 693, 176, 177, 176, - 177, 176, 177, 688, 176, 177, 731, 690, 176, 177, - 176, 177, 407, 176, 177, 176, 177, 692, 176, 177, - 176, 177, 691, 176, 177, 176, 177, 694, 176, 177, - 176, 177, 176, 177, 695, 697, 702, 1142, 698, 733, - 699, 827, 696, 700, 407, 703, 704, 828, 707, 176, - 177, 176, 177, 176, 177, 240, 701, 407, 705, 176, - 177, 1130, 708, 176, 177, 706, 176, 177, 1131, 709, - 176, 177, 176, 177, 735, 710, 240, 711, 176, 177, - 176, 177, 176, 177, 176, 177, 176, 177, 176, 177, - - 176, 177, 738, 713, 407, 715, 712, 734, 716, 714, - 176, 177, 757, 754, 800, 717, 755, 801, 1143, 803, - 719, 758, 1021, 739, 721, 1022, 723, 718, 804, 176, - 177, 1005, 176, 177, 1144, 720, 722, 176, 177, 724, - 176, 177, 176, 177, 1145, 725, 726, 832, 176, 177, - 176, 177, 727, 176, 177, 176, 177, 176, 177, 176, - 177, 831, 176, 177, 176, 177, 176, 177, 838, 176, - 177, 176, 177, 176, 177, 407, 176, 177, 176, 177, - 176, 177, 407, 834, 836, 1146, 837, 835, 833, 840, - 176, 177, 176, 177, 176, 177, 843, 407, 844, 176, - - 177, 845, 1147, 839, 176, 177, 176, 177, 1148, 842, - 841, 176, 177, 875, 176, 177, 847, 846, 848, 176, - 177, 850, 1149, 849, 176, 177, 176, 177, 874, 851, - 176, 177, 407, 176, 177, 176, 177, 1013, 852, 1014, - 853, 857, 1003, 854, 176, 177, 176, 177, 176, 177, - 176, 177, 855, 176, 177, 858, 860, 856, 176, 177, - 859, 861, 878, 176, 177, 176, 177, 176, 177, 1150, - 240, 862, 176, 177, 176, 177, 176, 177, 876, 407, - 176, 177, 176, 177, 1151, 961, 1009, 962, 1010, 866, - 868, 863, 864, 964, 1011, 965, 1046, 867, 1047, 865, - - 1053, 966, 1054, 176, 177, 407, 869, 176, 177, 176, - 177, 176, 177, 176, 177, 870, 968, 1004, 969, 176, - 177, 967, 963, 176, 177, 971, 176, 177, 974, 176, - 177, 1152, 176, 177, 176, 177, 176, 177, 1153, 176, - 177, 176, 177, 176, 177, 176, 177, 176, 177, 1126, - 973, 176, 177, 970, 978, 975, 976, 972, 1157, 977, - 983, 176, 177, 176, 177, 1061, 981, 979, 1062, 980, - 176, 177, 1158, 984, 1159, 982, 1160, 985, 176, 177, - 176, 177, 176, 177, 176, 177, 176, 177, 176, 177, - 176, 177, 176, 177, 1161, 986, 1162, 176, 177, 1163, - - 176, 177, 987, 176, 177, 176, 177, 988, 176, 177, - 176, 177, 1049, 1164, 1050, 992, 176, 177, 993, 1165, - 1051, 176, 177, 1166, 995, 996, 176, 177, 176, 177, - 1167, 991, 994, 989, 999, 990, 997, 176, 177, 176, - 177, 176, 177, 176, 177, 998, 176, 177, 176, 177, - 176, 177, 1168, 176, 177, 176, 177, 1000, 1086, 176, - 177, 176, 177, 1089, 1171, 1088, 1172, 176, 177, 1087, - 1090, 1092, 1173, 1093, 176, 177, 176, 177, 176, 177, - 1096, 1174, 1097, 176, 177, 1091, 176, 177, 1094, 176, - 177, 1095, 1098, 1175, 1099, 176, 177, 176, 177, 176, - - 177, 1101, 1176, 1104, 176, 177, 1177, 1100, 1102, 176, - 177, 176, 177, 176, 177, 1105, 176, 177, 1113, 176, - 177, 1106, 1103, 1178, 176, 177, 1179, 1107, 176, 177, - 176, 177, 176, 177, 1109, 1114, 176, 177, 1108, 176, - 177, 1180, 1115, 176, 177, 1111, 176, 177, 1112, 1113, - 1169, 1116, 1181, 1110, 176, 177, 1182, 1170, 1117, 1183, - 1184, 1185, 1186, 1119, 1187, 1188, 1154, 1189, 1190, 1122, - 1191, 1192, 1197, 1155, 1193, 1118, 1121, 1198, 1199, 1120, - 1200, 1125, 1156, 1201, 1202, 1203, 1204, 1205, 1124, 1123, - 407, 1194, 176, 177, 176, 177, 176, 177, 1195, 176, - - 177, 176, 177, 176, 177, 176, 177, 1196, 176, 177, - 176, 177, 176, 177, 176, 177, 176, 177, 176, 177, - 176, 177, 176, 177, 176, 177, 1236, 1216, 1252, 1217, - 1253, 1209, 1206, 1207, 1251, 1208, 176, 177, 1254, 1213, - 1237, 1210, 1211, 176, 177, 176, 177, 1255, 1212, 1256, - 1214, 1215, 1220, 176, 177, 176, 177, 1218, 176, 177, - 1257, 1219, 176, 177, 176, 177, 176, 177, 176, 177, - 1258, 1230, 176, 177, 1223, 1233, 176, 177, 176, 177, - 176, 177, 1221, 1259, 1222, 1260, 1225, 1261, 176, 177, - 176, 177, 1227, 1262, 1224, 176, 177, 1226, 1263, 1231, - - 176, 177, 1264, 1234, 176, 177, 176, 177, 1240, 176, - 177, 1228, 1265, 1232, 1229, 176, 177, 1235, 1243, 1239, - 1242, 1266, 1241, 176, 177, 1244, 1238, 1267, 1268, 1269, - 1270, 1245, 1271, 1272, 1273, 1274, 1275, 1246, 1276, 1279, - 1282, 1283, 1284, 1247, 1286, 1287, 1290, 1291, 1292, 1293, - 1294, 1295, 1288, 1296, 1297, 1298, 1285, 1248, 1289, 1299, - 1300, 1301, 1302, 1249, 1303, 1304, 1277, 1280, 1305, 1250, - 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, - 1278, 1281, 1316, 1317, 1318, 1319, 1322, 1325, 1327, 1328, - 1329, 1331, 1332, 1335, 1336, 1337, 1338, 1339, 1363, 1333, - - 1371, 1326, 176, 177, 1330, 1334, 176, 177, 176, 177, - 176, 177, 1364, 1320, 1323, 176, 177, 176, 177, 176, - 177, 176, 177, 176, 177, 176, 177, 1321, 1324, 176, - 177, 1340, 176, 177, 1346, 176, 177, 176, 177, 1372, - 1342, 176, 177, 1388, 1343, 1341, 407, 176, 177, 176, - 177, 1367, 1347, 176, 177, 1389, 1344, 176, 177, 1390, - 1349, 176, 177, 1391, 1345, 1368, 176, 177, 1348, 1357, - 176, 177, 176, 177, 1350, 1353, 1351, 176, 177, 176, - 177, 176, 177, 176, 177, 176, 177, 1387, 1352, 176, - 177, 176, 177, 1358, 1377, 1354, 1392, 176, 177, 1359, - - 176, 177, 1360, 1393, 1356, 1355, 176, 177, 1361, 1366, - 176, 177, 1394, 1370, 176, 177, 1395, 1373, 1362, 1374, - 1396, 1365, 176, 177, 1397, 1369, 176, 177, 1398, 176, - 177, 176, 177, 176, 177, 176, 177, 1399, 1400, 1401, - 1402, 1375, 1379, 1403, 1404, 1405, 1408, 1376, 1409, 1410, - 1413, 240, 1378, 1380, 1414, 1417, 240, 1418, 1419, 1382, - 1420, 1421, 1422, 1377, 1423, 1424, 1425, 1381, 1383, 1406, - 1427, 1386, 1411, 1428, 1385, 1407, 1384, 1415, 1429, 1430, - 1426, 1431, 1432, 1433, 1434, 1435, 1412, 1436, 1437, 1438, - 1439, 1416, 1440, 1441, 1442, 1443, 1444, 1445, 1446, 1447, - - 1448, 1449, 1452, 1453, 1454, 1455, 1457, 1458, 1459, 1461, - 1462, 1463, 1464, 1465, 1466, 1467, 1468, 1469, 1470, 1456, - 1471, 1472, 1460, 1474, 1475, 1450, 1476, 1477, 1478, 176, - 177, 1451, 176, 177, 1490, 1473, 176, 177, 1495, 176, - 177, 176, 177, 1496, 176, 177, 176, 177, 176, 177, - 176, 177, 1499, 176, 177, 176, 177, 176, 177, 176, - 177, 176, 177, 176, 177, 1479, 176, 177, 176, 177, - 176, 177, 176, 177, 1480, 1481, 1482, 176, 177, 176, - 177, 176, 177, 1500, 1484, 1485, 176, 177, 1483, 176, - 177, 1487, 176, 177, 1489, 1486, 176, 177, 1503, 1504, - - 1492, 176, 177, 1491, 176, 177, 176, 177, 1488, 176, - 177, 1509, 1494, 407, 176, 177, 176, 177, 176, 177, - 1519, 1493, 176, 177, 176, 177, 1497, 176, 177, 1520, - 1498, 1521, 1501, 1522, 1507, 1523, 1508, 1502, 176, 177, - 176, 177, 176, 177, 1524, 1525, 1526, 1527, 1528, 1529, - 1513, 240, 1531, 1505, 1510, 1532, 1506, 1511, 1533, 1514, - 1512, 1534, 1518, 240, 1537, 240, 1538, 240, 240, 1541, - 1515, 1516, 1542, 1543, 1530, 1544, 1545, 1546, 1547, 1548, - 1549, 1550, 1517, 1536, 1551, 1552, 1540, 1553, 1554, 1555, - 1556, 1557, 1558, 1559, 1560, 1535, 1561, 1562, 1563, 1539, - - 1564, 1565, 1566, 1567, 1568, 1569, 1570, 1571, 1572, 1573, - 1574, 1575, 1576, 1577, 1578, 1579, 1580, 1581, 1582, 1583, - 1584, 1585, 1586, 1587, 1588, 1589, 1590, 1591, 1592, 1593, - 176, 177, 176, 177, 176, 177, 176, 177, 176, 177, - 176, 177, 176, 177, 176, 177, 176, 177, 176, 177, - 176, 177, 1603, 176, 177, 176, 177, 1607, 176, 177, - 176, 177, 1608, 176, 177, 1611, 176, 177, 1612, 176, - 177, 1594, 1599, 1600, 1615, 1595, 176, 177, 1616, 1597, - 1621, 1598, 1596, 1604, 1601, 176, 177, 176, 177, 176, - 177, 1609, 176, 177, 176, 177, 407, 1602, 1605, 1606, - - 1610, 176, 177, 1614, 1613, 176, 177, 1617, 176, 177, - 176, 177, 176, 177, 176, 177, 176, 177, 1627, 1628, - 1629, 1630, 1622, 1631, 1632, 1633, 1634, 1618, 1635, 240, - 1637, 1638, 1639, 240, 240, 1623, 1642, 1643, 1620, 240, - 240, 1619, 1646, 1647, 1648, 1624, 1649, 1636, 1650, 1625, - 1651, 1652, 1653, 1654, 1655, 1656, 1657, 1658, 1659, 1626, - 1660, 1661, 1662, 1640, 1663, 1641, 1664, 1665, 1666, 1644, - 1667, 1645, 1668, 1669, 1670, 1671, 1672, 1673, 1674, 1675, - 1676, 1677, 1678, 1679, 1680, 1681, 1682, 1683, 1684, 1685, - 1686, 1687, 1688, 1689, 176, 177, 176, 177, 176, 177, - - 176, 177, 1699, 176, 177, 176, 177, 1702, 176, 177, - 176, 177, 176, 177, 176, 177, 176, 177, 176, 177, - 1703, 1706, 1690, 1707, 1691, 176, 177, 1710, 176, 177, - 1692, 1694, 176, 177, 176, 177, 1711, 176, 177, 1721, - 176, 177, 1722, 1695, 1696, 176, 177, 1723, 1698, 1693, - 176, 177, 176, 177, 1701, 1724, 1697, 176, 177, 1700, - 1705, 1704, 176, 177, 176, 177, 1709, 1725, 1708, 1713, - 176, 177, 1714, 1726, 1727, 1728, 1729, 240, 1731, 1732, - 240, 240, 1735, 1736, 240, 1718, 1739, 240, 1716, 1712, - 1740, 1741, 1742, 1743, 1717, 1744, 1745, 1746, 1719, 1733, - - 1747, 1748, 1715, 1749, 1734, 1737, 1750, 1751, 1738, 1720, - 1752, 1753, 1730, 1754, 1755, 1756, 1757, 1758, 1759, 1760, - 1761, 1762, 1763, 1764, 1765, 1766, 1767, 1768, 1769, 1770, - 1771, 1772, 1773, 1774, 1775, 1776, 1777, 1778, 1779, 1780, - 176, 177, 176, 177, 176, 177, 176, 177, 176, 177, - 176, 177, 176, 177, 1789, 176, 177, 176, 177, 176, - 177, 1792, 176, 177, 1793, 176, 177, 176, 177, 1795, - 1796, 176, 177, 176, 177, 1798, 1799, 1808, 1784, 176, - 177, 176, 177, 176, 177, 1783, 1809, 1781, 1787, 1782, - 1791, 176, 177, 1786, 1810, 1785, 1811, 1790, 176, 177, - - 176, 177, 1812, 1788, 176, 177, 1794, 176, 177, 176, - 177, 1813, 1797, 1814, 1815, 1817, 240, 1818, 1821, 1800, - 240, 1824, 240, 1801, 1825, 240, 1826, 240, 1827, 1802, - 1828, 1803, 1829, 1830, 1831, 1832, 1833, 1834, 1835, 1804, - 1805, 1806, 1836, 1807, 1816, 1837, 1819, 1820, 1822, 1823, - 1838, 1839, 1840, 1841, 1842, 1843, 1844, 1845, 1846, 1847, - 1848, 1849, 1850, 1851, 1852, 1853, 1854, 1855, 1856, 1857, - 1858, 1859, 176, 177, 176, 177, 176, 177, 176, 177, - 176, 177, 1868, 176, 177, 176, 177, 176, 177, 176, - 177, 176, 177, 1871, 176, 177, 1872, 176, 177, 1873, - - 1874, 176, 177, 176, 177, 176, 177, 1881, 1860, 1882, - 1861, 1865, 176, 177, 176, 177, 1864, 1869, 176, 177, - 1867, 1866, 1883, 1862, 176, 177, 1884, 176, 177, 1863, - 1875, 1885, 1886, 1887, 1888, 240, 1890, 1870, 1891, 240, - 240, 1878, 1876, 240, 240, 1894, 1895, 1896, 1897, 1898, - 1899, 1900, 1901, 1889, 1902, 1903, 1904, 1877, 1905, 1879, - 1880, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, - 1892, 1915, 1916, 1917, 1893, 1918, 1919, 1920, 176, 177, - 176, 177, 176, 177, 176, 177, 176, 177, 176, 177, - 176, 177, 1929, 176, 177, 176, 177, 176, 177, 1924, - - 1931, 1932, 176, 177, 176, 177, 176, 177, 176, 177, - 1923, 176, 177, 176, 177, 1938, 1939, 1940, 1927, 1941, - 1921, 1942, 1922, 1943, 1944, 1945, 240, 1947, 1925, 1928, - 240, 240, 1948, 1949, 1950, 1926, 1951, 1952, 1953, 1954, - 1955, 1930, 1956, 1957, 1933, 1958, 1935, 1959, 1960, 1961, - 1934, 1962, 1963, 1936, 1964, 1965, 1966, 1967, 1968, 1969, - 176, 177, 1946, 176, 177, 1937, 176, 177, 176, 177, - 176, 177, 176, 177, 176, 177, 1978, 176, 177, 176, - 177, 1979, 176, 177, 176, 177, 176, 177, 176, 177, - 176, 177, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, - - 240, 1970, 1991, 1976, 1971, 1977, 1992, 1993, 1975, 1994, - 1995, 1974, 1996, 1972, 1997, 1981, 1973, 1998, 1999, 2000, - 2001, 1980, 2002, 2003, 2004, 2005, 2006, 1982, 176, 177, - 176, 177, 176, 177, 176, 177, 176, 177, 176, 177, - 176, 177, 176, 177, 2012, 2013, 176, 177, 176, 177, - 176, 177, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, - 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032, 2007, 2033, - 2034, 2011, 2040, 2008, 176, 177, 176, 177, 2042, 2010, - 2009, 176, 177, 176, 177, 176, 177, 176, 177, 2043, - 2015, 2044, 2014, 176, 177, 2045, 2016, 176, 177, 2046, - - 2047, 2048, 2049, 2050, 2051, 2052, 2053, 2054, 176, 177, - 176, 177, 176, 177, 2057, 2036, 2035, 2038, 176, 177, - 176, 177, 2037, 176, 177, 2059, 2039, 2060, 2061, 2062, - 2063, 2064, 2041, 2065, 176, 177, 176, 177, 176, 177, - 1129, 1128, 1127, 407, 407, 1085, 1084, 1083, 1082, 2055, - 1081, 1080, 2056, 1079, 1078, 1077, 1076, 1075, 1074, 1073, - 1072, 1071, 1070, 1069, 1068, 1067, 1066, 1065, 1064, 2058, - 165, 165, 165, 165, 165, 165, 165, 165, 178, 178, - 178, 178, 190, 1063, 190, 190, 224, 224, 1060, 1059, - 1058, 224, 239, 1057, 1056, 239, 239, 239, 239, 239, - - 243, 243, 243, 243, 243, 243, 243, 243, 256, 1055, - 1052, 256, 256, 256, 256, 256, 268, 1048, 1045, 268, - 268, 268, 268, 268, 299, 1044, 299, 299, 299, 299, - 299, 299, 302, 302, 302, 302, 302, 302, 302, 302, - 315, 1043, 315, 315, 315, 315, 315, 315, 327, 1042, - 327, 327, 327, 327, 327, 327, 408, 408, 408, 1041, - 1040, 1039, 1038, 1037, 1036, 1035, 1034, 1033, 1032, 1031, - 1030, 1029, 1028, 1027, 1026, 1025, 1024, 1023, 1020, 1019, - 1018, 1017, 1016, 1015, 1012, 1008, 240, 240, 1002, 1001, - 960, 959, 958, 957, 956, 955, 954, 953, 952, 951, - - 950, 949, 948, 947, 946, 945, 944, 943, 942, 941, - 940, 939, 938, 937, 936, 935, 934, 933, 932, 931, - 930, 929, 928, 927, 926, 925, 924, 923, 922, 921, - 920, 919, 918, 917, 916, 915, 914, 913, 912, 911, - 910, 909, 908, 907, 906, 905, 904, 903, 902, 901, - 900, 899, 898, 897, 896, 895, 894, 893, 892, 891, - 890, 889, 888, 887, 886, 885, 884, 883, 882, 881, - 880, 879, 240, 407, 407, 407, 873, 872, 871, 830, - 829, 826, 825, 824, 823, 822, 821, 820, 819, 818, - 817, 816, 815, 814, 813, 812, 811, 810, 809, 808, - - 807, 806, 805, 802, 799, 798, 797, 796, 795, 794, - 793, 792, 791, 790, 789, 788, 787, 786, 785, 784, - 783, 780, 779, 778, 777, 776, 775, 774, 240, 773, - 772, 771, 770, 769, 768, 767, 766, 765, 764, 763, - 762, 761, 760, 759, 756, 753, 752, 751, 750, 749, - 748, 747, 746, 745, 744, 743, 742, 741, 740, 407, - 407, 407, 407, 407, 407, 407, 407, 730, 729, 728, - 684, 683, 682, 681, 680, 679, 678, 675, 674, 673, - 672, 671, 670, 669, 668, 667, 666, 665, 664, 663, - 662, 661, 660, 659, 658, 657, 656, 655, 654, 653, - - 652, 651, 650, 649, 648, 647, 646, 645, 644, 643, - 642, 641, 640, 637, 636, 635, 634, 633, 632, 631, - 630, 627, 626, 624, 623, 622, 621, 620, 619, 618, - 617, 616, 615, 614, 613, 612, 611, 610, 609, 608, - 607, 606, 605, 604, 603, 602, 601, 600, 599, 598, - 597, 596, 595, 594, 593, 592, 589, 166, 407, 407, - 560, 523, 522, 521, 520, 519, 518, 517, 516, 513, - 510, 509, 508, 507, 506, 505, 504, 499, 498, 495, - 494, 493, 490, 489, 488, 487, 486, 485, 484, 483, - 482, 481, 480, 479, 478, 477, 476, 313, 307, 240, - - 472, 471, 470, 469, 468, 462, 461, 460, 459, 458, - 457, 456, 451, 450, 447, 446, 445, 442, 441, 440, - 439, 438, 437, 436, 435, 434, 433, 432, 431, 430, - 429, 428, 240, 240, 240, 240, 423, 240, 240, 240, - 240, 423, 240, 407, 407, 406, 398, 176, 176, 170, - 166, 357, 356, 353, 347, 346, 345, 342, 341, 340, - 339, 336, 326, 325, 324, 323, 320, 319, 318, 317, - 312, 311, 308, 307, 306, 305, 304, 301, 240, 240, - 297, 294, 288, 287, 286, 283, 282, 281, 280, 277, - 240, 267, 266, 265, 264, 261, 260, 259, 258, 240, - - 240, 248, 240, 240, 220, 221, 220, 176, 175, 174, - 171, 170, 169, 168, 167, 166, 164, 2066, 9, 2066, - 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, - 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, - 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, - 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, - 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, - 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, - 2066, 2066, 2066, 2066, 2066 - } ; - -static yyconst flex_int16_t yy_chk[3686] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 3, 4, 11, 409, - 11, 3, 4, 23, 23, 26, 26, 27, 27, 28, - 28, 29, 29, 31, 31, 34, 34, 35, 35, 1010, - 36, 36, 52, 52, 65, 67, 65, 67, 71, 3, - - 4, 68, 68, 72, 86, 76, 77, 77, 26, 76, - 71, 409, 65, 29, 72, 79, 79, 34, 86, 31, - 52, 28, 36, 35, 52, 78, 78, 78, 3, 4, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 7, 7, 7, 7, - - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 30, 30, 32, 32, 33, 33, 42, 42, - 39, 39, 117, 40, 40, 117, 41, 41, 427, 43, - 43, 44, 44, 45, 45, 46, 46, 47, 47, 49, - 49, 109, 32, 109, 48, 48, 50, 50, 51, 51, - - 427, 40, 54, 54, 55, 55, 32, 43, 41, 94, - 30, 39, 41, 39, 33, 40, 39, 44, 41, 42, - 107, 43, 48, 94, 45, 56, 56, 46, 97, 47, - 48, 49, 53, 53, 69, 69, 53, 69, 54, 126, - 126, 50, 97, 51, 93, 55, 93, 55, 95, 93, - 112, 69, 95, 106, 102, 135, 144, 106, 95, 143, - 144, 56, 102, 115, 107, 115, 144, 146, 107, 135, - 142, 151, 142, 143, 155, 142, 178, 178, 155, 151, - 53, 146, 179, 179, 53, 62, 62, 158, 163, 158, - 163, 156, 177, 1011, 177, 112, 181, 181, 177, 180, - - 180, 254, 182, 182, 1012, 183, 183, 184, 184, 209, - 209, 254, 187, 187, 277, 179, 249, 62, 194, 194, - 249, 62, 277, 62, 62, 62, 181, 281, 62, 281, - 62, 62, 62, 185, 185, 156, 62, 62, 62, 156, - 180, 182, 187, 184, 228, 62, 183, 62, 80, 80, - 186, 186, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 194, 80, 80, 80, 80, 188, 188, - 191, 191, 196, 196, 245, 189, 189, 197, 197, 185, - 273, 199, 199, 80, 280, 228, 186, 280, 245, 273, - 80, 192, 192, 193, 193, 198, 198, 227, 195, 195, - - 1013, 191, 196, 200, 200, 201, 201, 235, 188, 199, - 197, 80, 80, 80, 81, 81, 189, 199, 81, 81, - 81, 81, 81, 81, 81, 81, 81, 81, 81, 195, - 81, 81, 81, 81, 192, 198, 204, 204, 195, 193, - 229, 207, 207, 215, 215, 205, 205, 227, 200, 81, - 201, 206, 206, 235, 202, 202, 302, 203, 203, 302, - 208, 208, 1014, 210, 210, 219, 219, 211, 211, 216, - 216, 229, 204, 212, 212, 217, 217, 81, 81, 81, - 92, 92, 207, 215, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 205, 92, 92, 92, 92, - - 202, 212, 206, 202, 203, 210, 203, 208, 211, 216, - 290, 217, 219, 232, 1015, 92, 241, 292, 241, 212, - 300, 332, 300, 218, 218, 429, 230, 336, 290, 1016, - 332, 292, 214, 214, 241, 336, 234, 339, 429, 233, - 339, 231, 226, 92, 92, 92, 129, 129, 232, 129, - 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, - 129, 214, 129, 129, 129, 129, 218, 230, 231, 226, - 233, 234, 231, 243, 243, 214, 243, 226, 314, 255, - 314, 129, 231, 349, 314, 255, 351, 255, 129, 226, - 243, 255, 340, 465, 340, 291, 1017, 361, 361, 465, - - 351, 349, 362, 362, 363, 363, 364, 364, 411, 129, - 129, 129, 130, 130, 416, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 414, 130, 130, - 130, 130, 291, 361, 365, 365, 367, 367, 362, 368, - 368, 372, 372, 380, 380, 364, 363, 130, 366, 366, - 411, 362, 369, 369, 416, 370, 370, 373, 373, 371, - 371, 375, 375, 575, 377, 377, 365, 378, 378, 368, - 414, 380, 367, 374, 374, 130, 130, 130, 141, 141, - 426, 141, 141, 141, 141, 141, 141, 141, 141, 141, - 141, 141, 141, 366, 141, 141, 141, 141, 370, 369, - - 371, 425, 373, 376, 376, 374, 375, 377, 575, 378, - 384, 384, 477, 141, 379, 379, 393, 393, 426, 381, - 381, 382, 382, 385, 385, 477, 383, 383, 389, 389, - 391, 391, 425, 386, 386, 376, 387, 387, 384, 388, - 388, 141, 141, 141, 268, 268, 412, 379, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, 268, 381, - 268, 268, 268, 268, 383, 386, 391, 382, 387, 389, - 385, 388, 390, 390, 400, 400, 392, 392, 407, 268, - 407, 412, 528, 528, 407, 397, 397, 586, 394, 394, - 399, 399, 633, 403, 403, 586, 395, 395, 633, 410, - - 413, 396, 396, 418, 390, 417, 400, 268, 268, 268, - 327, 327, 392, 327, 327, 327, 327, 327, 327, 327, - 327, 327, 327, 327, 327, 394, 327, 327, 327, 327, - 395, 396, 397, 401, 401, 403, 399, 402, 402, 404, - 404, 405, 405, 410, 413, 327, 415, 418, 417, 419, - 420, 421, 468, 516, 468, 516, 524, 524, 525, 525, - 401, 1018, 401, 526, 526, 527, 527, 530, 530, 402, - 585, 404, 738, 327, 327, 327, 405, 529, 529, 419, - 738, 415, 1019, 420, 421, 531, 531, 573, 525, 532, - 532, 533, 533, 420, 879, 526, 879, 524, 534, 534, - - 535, 535, 536, 536, 585, 529, 533, 537, 537, 538, - 538, 540, 540, 527, 539, 539, 573, 530, 541, 541, - 543, 543, 576, 542, 542, 544, 544, 532, 545, 545, - 546, 546, 531, 547, 547, 548, 548, 534, 549, 549, - 550, 550, 551, 551, 536, 538, 542, 1020, 539, 576, - 540, 681, 537, 540, 579, 542, 543, 681, 546, 552, - 552, 553, 553, 554, 554, 587, 541, 578, 544, 555, - 555, 1009, 547, 556, 556, 545, 557, 557, 1009, 549, - 558, 558, 559, 559, 579, 550, 588, 551, 561, 561, - 562, 562, 563, 563, 564, 564, 565, 565, 566, 566, - - 567, 567, 587, 554, 876, 556, 553, 578, 557, 555, - 568, 568, 607, 605, 653, 558, 605, 653, 1021, 655, - 561, 607, 890, 588, 563, 890, 565, 559, 655, 685, - 685, 876, 686, 686, 1022, 562, 564, 687, 687, 566, - 688, 688, 689, 689, 1023, 567, 568, 686, 690, 690, - 691, 691, 568, 692, 692, 693, 693, 694, 694, 695, - 695, 685, 696, 696, 697, 697, 698, 698, 692, 699, - 699, 700, 700, 701, 701, 733, 702, 702, 703, 703, - 704, 704, 732, 688, 690, 1025, 691, 689, 687, 694, - 705, 705, 706, 706, 707, 707, 697, 874, 698, 709, - - 709, 699, 1027, 693, 708, 708, 710, 710, 1028, 696, - 695, 711, 711, 733, 712, 712, 701, 700, 702, 713, - 713, 704, 1029, 703, 714, 714, 715, 715, 732, 705, - 716, 716, 736, 717, 717, 718, 718, 883, 706, 883, - 707, 712, 874, 708, 719, 719, 720, 720, 721, 721, - 722, 722, 710, 724, 724, 713, 715, 711, 723, 723, - 714, 717, 739, 725, 725, 726, 726, 727, 727, 1031, - 739, 718, 831, 831, 832, 832, 837, 837, 736, 875, - 833, 833, 834, 834, 1033, 831, 881, 831, 881, 722, - 725, 719, 720, 833, 881, 833, 921, 723, 921, 721, - - 925, 833, 925, 835, 835, 1005, 726, 836, 836, 838, - 838, 839, 839, 840, 840, 727, 835, 875, 835, 841, - 841, 834, 832, 843, 843, 837, 844, 844, 840, 845, - 845, 1034, 842, 842, 846, 846, 847, 847, 1035, 848, - 848, 849, 849, 850, 850, 851, 851, 852, 852, 1005, - 839, 853, 853, 836, 843, 841, 842, 838, 1037, 842, - 848, 854, 854, 855, 855, 932, 846, 844, 932, 845, - 856, 856, 1038, 849, 1039, 847, 1040, 851, 857, 857, - 858, 858, 859, 859, 860, 860, 861, 861, 862, 862, - 863, 863, 864, 864, 1041, 855, 1042, 865, 865, 1043, - - 866, 866, 856, 867, 867, 868, 868, 857, 869, 869, - 870, 870, 923, 1044, 923, 861, 961, 961, 862, 1045, - 923, 962, 962, 1046, 864, 865, 963, 963, 964, 964, - 1047, 860, 863, 858, 868, 859, 866, 965, 965, 966, - 966, 967, 967, 969, 969, 867, 968, 968, 970, 970, - 971, 971, 1048, 972, 972, 973, 973, 870, 961, 974, - 974, 975, 975, 964, 1050, 963, 1051, 976, 976, 962, - 964, 966, 1052, 967, 977, 977, 978, 978, 979, 979, - 970, 1053, 971, 980, 980, 965, 981, 981, 968, 982, - 982, 969, 972, 1054, 973, 983, 983, 984, 984, 985, - - 985, 975, 1055, 978, 986, 986, 1056, 974, 976, 987, - 987, 988, 988, 989, 989, 980, 990, 990, 991, 992, - 992, 982, 977, 1057, 991, 991, 1058, 983, 993, 993, - 994, 994, 995, 995, 986, 991, 996, 996, 984, 997, - 997, 1059, 991, 998, 998, 989, 999, 999, 990, 1036, - 1049, 991, 1060, 988, 1000, 1000, 1061, 1049, 992, 1062, - 1063, 1065, 1067, 994, 1068, 1069, 1036, 1071, 1073, 997, - 1074, 1075, 1077, 1036, 1076, 993, 996, 1078, 1079, 995, - 1080, 1000, 1036, 1081, 1082, 1083, 1084, 1085, 999, 998, - 1126, 1076, 1086, 1086, 1087, 1087, 1088, 1088, 1076, 1089, - - 1089, 1090, 1090, 1091, 1091, 1092, 1092, 1076, 1093, 1093, - 1094, 1094, 1095, 1095, 1096, 1096, 1097, 1097, 1098, 1098, - 1099, 1099, 1100, 1100, 1101, 1101, 1113, 1096, 1127, 1097, - 1128, 1089, 1086, 1087, 1126, 1088, 1102, 1102, 1129, 1093, - 1113, 1090, 1091, 1103, 1103, 1104, 1104, 1130, 1092, 1131, - 1094, 1095, 1101, 1105, 1105, 1106, 1106, 1098, 1107, 1107, - 1132, 1100, 1108, 1108, 1109, 1109, 1110, 1110, 1111, 1111, - 1133, 1111, 1112, 1112, 1104, 1112, 1114, 1114, 1115, 1115, - 1116, 1116, 1102, 1134, 1103, 1135, 1106, 1136, 1117, 1117, - 1119, 1119, 1108, 1137, 1105, 1120, 1120, 1107, 1138, 1111, - - 1121, 1121, 1139, 1112, 1118, 1118, 1122, 1122, 1116, 1123, - 1123, 1109, 1141, 1111, 1110, 1124, 1124, 1112, 1118, 1115, - 1117, 1142, 1116, 1125, 1125, 1118, 1114, 1143, 1144, 1145, - 1146, 1118, 1147, 1148, 1149, 1150, 1151, 1120, 1152, 1153, - 1154, 1155, 1156, 1121, 1157, 1158, 1160, 1161, 1163, 1164, - 1165, 1166, 1158, 1167, 1168, 1169, 1156, 1123, 1158, 1170, - 1171, 1172, 1173, 1124, 1174, 1175, 1152, 1153, 1176, 1125, - 1177, 1178, 1180, 1181, 1182, 1183, 1184, 1185, 1186, 1187, - 1152, 1153, 1188, 1189, 1190, 1191, 1192, 1193, 1194, 1195, - 1196, 1197, 1198, 1200, 1201, 1203, 1204, 1205, 1230, 1198, - - 1236, 1193, 1206, 1206, 1196, 1198, 1207, 1207, 1208, 1208, - 1209, 1209, 1230, 1191, 1192, 1210, 1210, 1211, 1211, 1212, - 1212, 1213, 1213, 1214, 1214, 1216, 1216, 1191, 1192, 1215, - 1215, 1206, 1217, 1217, 1213, 1218, 1218, 1219, 1219, 1237, - 1209, 1220, 1220, 1252, 1210, 1207, 1251, 1221, 1221, 1222, - 1222, 1233, 1214, 1223, 1223, 1253, 1211, 1224, 1224, 1255, - 1216, 1226, 1226, 1256, 1212, 1233, 1225, 1225, 1215, 1225, - 1227, 1227, 1228, 1228, 1217, 1221, 1219, 1229, 1229, 1231, - 1231, 1232, 1232, 1234, 1234, 1235, 1235, 1251, 1220, 1238, - 1238, 1240, 1240, 1225, 1242, 1222, 1257, 1239, 1239, 1225, - - 1242, 1242, 1227, 1258, 1224, 1223, 1241, 1241, 1228, 1232, - 1243, 1243, 1259, 1235, 1244, 1244, 1260, 1238, 1229, 1239, - 1261, 1231, 1245, 1245, 1262, 1234, 1246, 1246, 1263, 1247, - 1247, 1248, 1248, 1249, 1249, 1250, 1250, 1265, 1266, 1267, - 1268, 1240, 1244, 1269, 1270, 1271, 1273, 1241, 1274, 1275, - 1277, 1276, 1243, 1245, 1278, 1280, 1279, 1281, 1282, 1246, - 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1245, 1247, 1271, - 1290, 1250, 1276, 1291, 1249, 1271, 1248, 1279, 1292, 1293, - 1289, 1294, 1295, 1296, 1298, 1299, 1276, 1300, 1301, 1302, - 1303, 1279, 1304, 1305, 1306, 1308, 1309, 1310, 1311, 1312, - - 1313, 1314, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, - 1324, 1325, 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1319, - 1333, 1334, 1322, 1335, 1336, 1314, 1337, 1338, 1339, 1340, - 1340, 1314, 1341, 1341, 1357, 1334, 1342, 1342, 1363, 1343, - 1343, 1344, 1344, 1364, 1345, 1345, 1346, 1346, 1347, 1347, - 1348, 1348, 1367, 1349, 1349, 1350, 1350, 1351, 1351, 1352, - 1352, 1353, 1353, 1355, 1355, 1340, 1354, 1354, 1356, 1356, - 1358, 1358, 1359, 1359, 1342, 1343, 1345, 1360, 1360, 1361, - 1361, 1362, 1362, 1368, 1347, 1349, 1365, 1365, 1346, 1366, - 1366, 1352, 1369, 1369, 1354, 1350, 1370, 1370, 1371, 1372, - - 1359, 1373, 1373, 1358, 1374, 1374, 1375, 1375, 1353, 1376, - 1376, 1377, 1362, 1387, 1378, 1378, 1379, 1379, 1380, 1380, - 1388, 1361, 1381, 1381, 1382, 1382, 1365, 1383, 1383, 1390, - 1366, 1391, 1369, 1393, 1375, 1394, 1376, 1370, 1384, 1384, - 1385, 1385, 1386, 1386, 1395, 1397, 1398, 1400, 1401, 1402, - 1381, 1405, 1406, 1373, 1378, 1407, 1374, 1379, 1409, 1383, - 1380, 1410, 1387, 1411, 1413, 1412, 1414, 1415, 1416, 1417, - 1384, 1385, 1418, 1419, 1405, 1420, 1421, 1422, 1423, 1424, - 1425, 1426, 1386, 1412, 1428, 1429, 1416, 1430, 1431, 1432, - 1434, 1435, 1437, 1438, 1439, 1411, 1441, 1442, 1444, 1415, - - 1445, 1446, 1449, 1450, 1451, 1453, 1454, 1455, 1456, 1457, - 1458, 1459, 1460, 1461, 1462, 1463, 1464, 1465, 1466, 1467, - 1468, 1469, 1470, 1471, 1472, 1473, 1475, 1476, 1477, 1478, - 1479, 1479, 1480, 1480, 1481, 1481, 1482, 1482, 1483, 1483, - 1484, 1484, 1485, 1485, 1486, 1486, 1487, 1487, 1488, 1488, - 1489, 1489, 1490, 1492, 1492, 1491, 1491, 1495, 1493, 1493, - 1494, 1494, 1496, 1497, 1497, 1499, 1498, 1498, 1500, 1502, - 1502, 1479, 1485, 1486, 1503, 1481, 1501, 1501, 1504, 1483, - 1509, 1484, 1482, 1491, 1488, 1505, 1505, 1506, 1506, 1507, - 1507, 1497, 1508, 1508, 1510, 1510, 1518, 1489, 1492, 1493, - - 1498, 1511, 1511, 1502, 1501, 1512, 1512, 1505, 1513, 1513, - 1514, 1514, 1515, 1515, 1516, 1516, 1517, 1517, 1519, 1521, - 1522, 1523, 1510, 1524, 1525, 1526, 1528, 1506, 1529, 1530, - 1531, 1532, 1533, 1535, 1536, 1511, 1537, 1538, 1508, 1539, - 1540, 1507, 1541, 1542, 1543, 1512, 1544, 1530, 1545, 1513, - 1546, 1547, 1548, 1549, 1550, 1554, 1555, 1557, 1558, 1517, - 1559, 1560, 1561, 1535, 1562, 1536, 1564, 1565, 1566, 1539, - 1567, 1540, 1568, 1569, 1571, 1572, 1573, 1574, 1575, 1576, - 1577, 1578, 1579, 1580, 1581, 1582, 1583, 1584, 1585, 1586, - 1587, 1588, 1589, 1593, 1594, 1594, 1595, 1595, 1596, 1596, - - 1597, 1597, 1603, 1598, 1598, 1599, 1599, 1607, 1600, 1600, - 1601, 1601, 1602, 1602, 1604, 1604, 1605, 1605, 1606, 1606, - 1608, 1611, 1594, 1612, 1595, 1609, 1609, 1615, 1610, 1610, - 1596, 1598, 1613, 1613, 1614, 1614, 1616, 1617, 1617, 1627, - 1618, 1618, 1628, 1599, 1600, 1619, 1619, 1629, 1602, 1597, - 1620, 1620, 1622, 1622, 1605, 1630, 1601, 1624, 1624, 1604, - 1610, 1609, 1623, 1623, 1625, 1625, 1614, 1631, 1613, 1618, - 1626, 1626, 1619, 1632, 1633, 1634, 1635, 1636, 1637, 1638, - 1641, 1640, 1642, 1643, 1645, 1624, 1646, 1644, 1622, 1617, - 1647, 1648, 1649, 1650, 1623, 1651, 1652, 1653, 1625, 1640, - - 1654, 1655, 1620, 1656, 1641, 1644, 1657, 1658, 1645, 1626, - 1659, 1660, 1636, 1661, 1662, 1663, 1664, 1665, 1666, 1667, - 1668, 1670, 1671, 1672, 1673, 1674, 1675, 1676, 1677, 1678, - 1679, 1680, 1681, 1682, 1683, 1685, 1686, 1687, 1688, 1689, - 1690, 1690, 1691, 1691, 1692, 1692, 1693, 1693, 1694, 1694, - 1695, 1695, 1696, 1696, 1699, 1697, 1697, 1698, 1698, 1700, - 1700, 1702, 1701, 1701, 1703, 1704, 1704, 1705, 1705, 1706, - 1707, 1708, 1708, 1709, 1709, 1710, 1711, 1721, 1693, 1712, - 1712, 1713, 1713, 1714, 1714, 1692, 1722, 1690, 1697, 1691, - 1701, 1715, 1715, 1696, 1723, 1694, 1724, 1700, 1716, 1716, - - 1717, 1717, 1725, 1698, 1718, 1718, 1704, 1720, 1720, 1719, - 1719, 1727, 1708, 1728, 1729, 1731, 1730, 1732, 1735, 1712, - 1733, 1739, 1737, 1713, 1741, 1734, 1742, 1738, 1743, 1714, - 1744, 1715, 1745, 1747, 1748, 1749, 1750, 1751, 1752, 1716, - 1718, 1719, 1753, 1720, 1730, 1754, 1733, 1734, 1737, 1738, - 1756, 1757, 1758, 1759, 1760, 1761, 1762, 1763, 1764, 1766, - 1767, 1768, 1770, 1771, 1772, 1773, 1774, 1775, 1776, 1778, - 1779, 1780, 1781, 1781, 1782, 1782, 1783, 1783, 1784, 1784, - 1785, 1785, 1789, 1786, 1786, 1787, 1787, 1788, 1788, 1790, - 1790, 1791, 1791, 1792, 1794, 1794, 1795, 1797, 1797, 1798, - - 1799, 1800, 1800, 1801, 1801, 1802, 1802, 1808, 1781, 1809, - 1782, 1786, 1803, 1803, 1804, 1804, 1785, 1790, 1805, 1805, - 1788, 1787, 1810, 1783, 1806, 1806, 1811, 1807, 1807, 1784, - 1800, 1812, 1813, 1814, 1815, 1816, 1817, 1791, 1818, 1819, - 1820, 1803, 1801, 1822, 1823, 1825, 1826, 1827, 1828, 1830, - 1832, 1833, 1834, 1816, 1835, 1836, 1837, 1802, 1838, 1805, - 1807, 1839, 1840, 1841, 1842, 1843, 1844, 1847, 1850, 1851, - 1819, 1852, 1853, 1854, 1822, 1855, 1857, 1859, 1860, 1860, - 1861, 1861, 1862, 1862, 1863, 1863, 1864, 1864, 1865, 1865, - 1866, 1866, 1868, 1867, 1867, 1869, 1869, 1870, 1870, 1863, - - 1873, 1874, 1875, 1875, 1876, 1876, 1877, 1877, 1879, 1879, - 1862, 1878, 1878, 1880, 1880, 1881, 1882, 1883, 1866, 1884, - 1860, 1885, 1861, 1886, 1887, 1888, 1889, 1890, 1864, 1867, - 1892, 1893, 1894, 1895, 1896, 1865, 1897, 1899, 1900, 1901, - 1902, 1869, 1903, 1904, 1875, 1905, 1877, 1906, 1907, 1908, - 1876, 1909, 1913, 1878, 1914, 1915, 1916, 1917, 1918, 1920, - 1921, 1921, 1889, 1922, 1922, 1880, 1923, 1923, 1924, 1924, - 1925, 1925, 1926, 1926, 1927, 1927, 1931, 1928, 1928, 1930, - 1930, 1932, 1933, 1933, 1934, 1934, 1935, 1935, 1936, 1936, - 1937, 1937, 1938, 1939, 1940, 1941, 1942, 1943, 1944, 1945, - - 1946, 1921, 1948, 1927, 1922, 1928, 1950, 1951, 1926, 1953, - 1954, 1925, 1955, 1923, 1956, 1935, 1924, 1957, 1958, 1959, - 1960, 1933, 1963, 1964, 1965, 1967, 1968, 1936, 1970, 1970, - 1971, 1971, 1972, 1972, 1973, 1973, 1974, 1974, 1975, 1975, - 1976, 1976, 1977, 1977, 1978, 1979, 1980, 1980, 1981, 1981, - 1982, 1982, 1985, 1986, 1988, 1989, 1990, 1991, 1992, 1993, - 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, 1972, 2005, - 2006, 1977, 2012, 1973, 2007, 2007, 2008, 2008, 2017, 1976, - 1975, 2009, 2009, 2014, 2014, 2010, 2010, 2011, 2011, 2018, - 1981, 2019, 1980, 2015, 2015, 2020, 1982, 2016, 2016, 2021, - - 2023, 2025, 2026, 2027, 2028, 2029, 2030, 2033, 2035, 2035, - 2036, 2036, 2037, 2037, 2040, 2008, 2007, 2010, 2038, 2038, - 2039, 2039, 2009, 2041, 2041, 2042, 2011, 2046, 2047, 2048, - 2052, 2053, 2015, 2054, 2055, 2055, 2056, 2056, 2058, 2058, - 1008, 1007, 1006, 1004, 1003, 960, 958, 957, 956, 2035, - 955, 954, 2039, 953, 952, 951, 950, 949, 948, 947, - 946, 945, 941, 939, 938, 937, 936, 935, 934, 2041, - 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2068, 2068, - 2068, 2068, 2069, 933, 2069, 2069, 2070, 2070, 931, 930, - 929, 2070, 2071, 928, 927, 2071, 2071, 2071, 2071, 2071, - - 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2073, 926, - 924, 2073, 2073, 2073, 2073, 2073, 2074, 922, 918, 2074, - 2074, 2074, 2074, 2074, 2075, 916, 2075, 2075, 2075, 2075, - 2075, 2075, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, - 2077, 915, 2077, 2077, 2077, 2077, 2077, 2077, 2078, 914, - 2078, 2078, 2078, 2078, 2078, 2078, 2079, 2079, 2079, 913, - 912, 911, 910, 909, 908, 907, 906, 905, 904, 903, - 899, 897, 896, 895, 894, 893, 892, 891, 889, 888, - 887, 886, 885, 884, 882, 880, 878, 877, 873, 872, - 828, 827, 826, 824, 823, 822, 821, 820, 819, 818, - - 816, 815, 814, 813, 812, 811, 809, 808, 807, 806, - 805, 804, 803, 802, 801, 800, 799, 798, 797, 796, - 795, 794, 793, 792, 791, 790, 789, 788, 787, 786, - 785, 784, 782, 781, 780, 778, 777, 776, 775, 774, - 773, 772, 770, 769, 768, 767, 766, 765, 763, 762, - 761, 760, 759, 758, 757, 756, 755, 754, 753, 752, - 751, 750, 749, 748, 747, 746, 745, 744, 743, 742, - 741, 740, 737, 735, 734, 731, 730, 729, 728, 684, - 683, 680, 679, 678, 677, 676, 675, 674, 672, 671, - 670, 669, 668, 667, 666, 664, 663, 662, 660, 659, - - 658, 657, 656, 654, 652, 651, 650, 649, 647, 646, - 645, 644, 643, 642, 640, 639, 638, 637, 636, 635, - 634, 632, 631, 630, 629, 628, 627, 626, 625, 624, - 623, 622, 621, 620, 619, 618, 616, 615, 614, 612, - 611, 610, 609, 608, 606, 604, 603, 602, 601, 599, - 598, 597, 596, 595, 594, 592, 591, 590, 589, 584, - 583, 582, 581, 580, 577, 574, 572, 571, 570, 569, - 523, 522, 521, 520, 519, 518, 517, 515, 514, 513, - 512, 511, 510, 509, 507, 506, 505, 504, 503, 502, - 501, 500, 499, 498, 497, 496, 495, 494, 493, 492, - - 491, 490, 489, 488, 486, 485, 484, 483, 482, 481, - 480, 479, 478, 476, 475, 474, 473, 472, 471, 470, - 469, 467, 466, 464, 463, 462, 461, 459, 458, 457, - 456, 455, 454, 453, 452, 451, 450, 449, 448, 447, - 446, 445, 444, 443, 442, 441, 440, 438, 437, 436, - 435, 434, 433, 432, 431, 430, 428, 424, 422, 408, - 398, 360, 359, 358, 356, 355, 354, 353, 352, 350, - 348, 347, 345, 344, 343, 342, 341, 338, 337, 335, - 334, 333, 331, 330, 329, 328, 326, 325, 324, 323, - 322, 321, 320, 319, 318, 317, 316, 313, 307, 298, - - 297, 296, 295, 294, 293, 289, 288, 286, 285, 284, - 283, 282, 279, 278, 276, 275, 274, 272, 271, 270, - 269, 267, 266, 265, 264, 263, 262, 261, 260, 259, - 258, 257, 253, 252, 251, 250, 248, 247, 246, 244, - 242, 240, 239, 236, 224, 221, 213, 190, 176, 170, - 165, 161, 159, 157, 154, 153, 152, 150, 149, 148, - 147, 145, 139, 138, 137, 136, 134, 133, 132, 131, - 128, 127, 125, 124, 121, 120, 119, 116, 113, 111, - 110, 108, 105, 104, 103, 101, 100, 99, 98, 96, - 91, 90, 89, 88, 87, 85, 84, 83, 82, 75, - - 74, 73, 70, 64, 63, 61, 58, 38, 25, 24, - 22, 21, 18, 17, 16, 14, 13, 9, 2066, 2066, - 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, - 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, - 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, - 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, - 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, - 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, 2066, - 2066, 2066, 2066, 2066, 2066 - } ; - -/* Table of booleans, true if rule could match eol. */ -static yyconst flex_int32_t yy_rule_can_match_eol[148] = - { 0, -0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, }; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -#line 1 "../src/parser.ll" -/***************************************************************************** - Copyright (C) 1994-2000 the Omega Project Team - Copyright (C) 2005-2011 Chun Chen - All Rights Reserved. - - Purpose: - lex parser for calculator. - - Notes: - - History: - 02/04/11 migrate to flex c++ mode, Chun Chen -*****************************************************************************/ -#line 16 "../src/parser.ll" -#include -#include -#include -#include -#include -#include -#include -#include -#include "parser.tab.hh" -#include - -myFlexLexer mylexer; -bool is_interactive; -const char *PROMPT_STRING = ">>>"; - -#define BUFFER scanBuf += yytext -std::string scanBuf; -std::string err_msg; - -extern bool need_coef; - -void yyerror(const std::string &s); -void flushScanBuffer(); - - -#line 1974 "lex.yy.cc" - -#define INITIAL 0 -#define LATEX 1 -#define INCLUDE 2 -#define COMMENT 3 - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -#include -#endif - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); -#endif - -#ifndef YY_NO_INPUT - -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else -#define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ -#endif - -/* Copy whatever the last rule matched to the standard output. */ -#ifndef ECHO -#define ECHO LexerOutput( yytext, yyleng ) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ -\ - if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); - -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) LexerError( msg ) -#endif - -/* end tables serialization structures and prototypes */ - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL_IS_OURS 1 -#define YY_DECL int yyFlexLexer::yylex() -#endif /* !YY_DECL */ - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - YY_USER_ACTION - -/** The main scanner function which does all the work. - */ -YY_DECL -{ - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -#line 46 "../src/parser.ll" - - -#line 2085 "lex.yy.cc" - - if ( !(yy_init) ) - { - (yy_init) = 1; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ - - if ( ! yyin ) - yyin = & std::cin; - - if ( ! yyout ) - yyout = & std::cout; - - if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer( yyin, YY_BUF_SIZE ); - } - - yy_load_buffer_state( ); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); - - /* Support of yytext. */ - *yy_cp = (yy_hold_char); - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = (yy_start); -yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 2067 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 3619 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - - if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) - { - int yyl; - for ( yyl = 0; yyl < yyleng; ++yyl ) - if ( yytext[yyl] == '\n' ) - - yylineno++; -; - } - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; - -case 1: -YY_RULE_SETUP -#line 48 "../src/parser.ll" -{ BUFFER; BEGIN(INCLUDE); } - YY_BREAK -case 2: -YY_RULE_SETUP -#line 49 "../src/parser.ll" -{ - BUFFER; - scanBuf += "\n"; - flushScanBuffer(); - - if (is_interactive) { - std::cout << "file include disabled in interactive mode\n"; - } - else { - char *s = yytext; - while (*s != '>') s++; - *s = '\0'; - std::ifstream *ifs = new std::ifstream(yytext, std::ifstream::in); - if (!ifs->is_open()) { - fprintf(stderr, "Can't open file %s\n", yytext); - } - else { - yy_buffer_state *bs = mylexer.yy_create_buffer(ifs, 8092); - mylexer.yypush_buffer_state(bs); - } - } - BEGIN(INITIAL); -} - YY_BREAK -case 3: -/* rule 3 can match eol */ -YY_RULE_SETUP -#line 72 "../src/parser.ll" -{ - std::cout << "Error in include syntax\n"; - std::cout << "Use <> to include the file named fname\n"; - BEGIN(INITIAL); - if(is_interactive) { - std::cout << PROMPT_STRING << ' '; - std::cout.flush(); - } -} - YY_BREAK -case 4: -YY_RULE_SETUP -#line 86 "../src/parser.ll" -{ BUFFER; } - YY_BREAK -case 5: -YY_RULE_SETUP -#line 87 "../src/parser.ll" -{ BUFFER; } - YY_BREAK -case 6: -YY_RULE_SETUP -#line 88 "../src/parser.ll" -{ BUFFER; BEGIN(COMMENT); } - YY_BREAK -case 7: -YY_RULE_SETUP -#line 89 "../src/parser.ll" -{ BUFFER; } - YY_BREAK -case 8: -/* rule 8 can match eol */ -YY_RULE_SETUP -#line 90 "../src/parser.ll" -{ BUFFER; BEGIN(INITIAL); } - YY_BREAK -case 9: -YY_RULE_SETUP -#line 91 "../src/parser.ll" -{ BUFFER; BEGIN(INITIAL); } - YY_BREAK -case 10: -YY_RULE_SETUP -#line 92 "../src/parser.ll" -{ BUFFER; BEGIN(LATEX); } - YY_BREAK -case 11: -YY_RULE_SETUP -#line 93 "../src/parser.ll" -{ BUFFER; } - YY_BREAK -case 12: -YY_RULE_SETUP -#line 94 "../src/parser.ll" -{ BUFFER; } - YY_BREAK -case 13: -YY_RULE_SETUP -#line 95 "../src/parser.ll" -{ BUFFER; } - YY_BREAK -case 14: -YY_RULE_SETUP -#line 96 "../src/parser.ll" -{ BUFFER; } - YY_BREAK -case 15: -/* rule 15 can match eol */ -YY_RULE_SETUP -#line 97 "../src/parser.ll" -{ BUFFER; } - YY_BREAK -case 16: -/* rule 16 can match eol */ -YY_RULE_SETUP -#line 100 "../src/parser.ll" -{ - BUFFER; - BEGIN(INITIAL); - if(is_interactive) { - std::cout << PROMPT_STRING << ' '; - std::cout.flush(); - } -} - YY_BREAK -case 17: -YY_RULE_SETUP -#line 113 "../src/parser.ll" -{ BUFFER; return OPEN_BRACE; } - YY_BREAK -case 18: -YY_RULE_SETUP -#line 114 "../src/parser.ll" -{ BUFFER; return OPEN_BRACE; } - YY_BREAK -case 19: -YY_RULE_SETUP -#line 115 "../src/parser.ll" -{ BUFFER; return CLOSE_BRACE; } - YY_BREAK -case 20: -YY_RULE_SETUP -#line 116 "../src/parser.ll" -{ BUFFER; return CLOSE_BRACE; } - YY_BREAK -case 21: -YY_RULE_SETUP -#line 117 "../src/parser.ll" -{ BUFFER; return APPROX; } - YY_BREAK -case 22: -YY_RULE_SETUP -#line 118 "../src/parser.ll" -{ BUFFER; return UNION; } - YY_BREAK -case 23: -YY_RULE_SETUP -#line 119 "../src/parser.ll" -{ BUFFER; return UNION; } - YY_BREAK -case 24: -YY_RULE_SETUP -#line 120 "../src/parser.ll" -{ BUFFER; return INTERSECTION; } - YY_BREAK -case 25: -YY_RULE_SETUP -#line 121 "../src/parser.ll" -{ BUFFER; return INTERSECTION; } - YY_BREAK -case 26: -YY_RULE_SETUP -#line 122 "../src/parser.ll" -{ BUFFER; return NO_SIMPLIFY; } - YY_BREAK -case 27: -YY_RULE_SETUP -#line 123 "../src/parser.ll" -{ BUFFER; return SYMBOLIC; } - YY_BREAK -case 28: -YY_RULE_SETUP -#line 124 "../src/parser.ll" -{ BUFFER; return SYMBOLIC; } - YY_BREAK -case 29: -YY_RULE_SETUP -#line 125 "../src/parser.ll" -{ BUFFER; return VERTICAL_BAR; } - YY_BREAK -case 30: -YY_RULE_SETUP -#line 126 "../src/parser.ll" -{ BUFFER; return VERTICAL_BAR; } - YY_BREAK -case 31: -YY_RULE_SETUP -#line 127 "../src/parser.ll" -{ BUFFER; return SUCH_THAT; } - YY_BREAK -case 32: -YY_RULE_SETUP -#line 128 "../src/parser.ll" -{ BUFFER; return SUCH_THAT; } - YY_BREAK -case 33: -YY_RULE_SETUP -#line 129 "../src/parser.ll" -{ BUFFER; return INVERSE; } - YY_BREAK -case 34: -YY_RULE_SETUP -#line 130 "../src/parser.ll" -{ BUFFER; return COMPLEMENT; } - YY_BREAK -case 35: -YY_RULE_SETUP -#line 131 "../src/parser.ll" -{ BUFFER; return COMPOSE; } - YY_BREAK -case 36: -YY_RULE_SETUP -#line 132 "../src/parser.ll" -{ BUFFER; return COMPOSE; } - YY_BREAK -case 37: -YY_RULE_SETUP -#line 133 "../src/parser.ll" -{ BUFFER; return DIFFERENCE; } - YY_BREAK -case 38: -YY_RULE_SETUP -#line 134 "../src/parser.ll" -{ BUFFER; return DIFFERENCE_TO_RELATION; } - YY_BREAK -case 39: -YY_RULE_SETUP -#line 135 "../src/parser.ll" -{ BUFFER; return PROJECT_AWAY_SYMBOLS; } - YY_BREAK -case 40: -YY_RULE_SETUP -#line 136 "../src/parser.ll" -{ BUFFER; return PROJECT_AWAY_SYMBOLS; } - YY_BREAK -case 41: -YY_RULE_SETUP -#line 137 "../src/parser.ll" -{ BUFFER; return PROJECT_AWAY_SYMBOLS; } - YY_BREAK -case 42: -YY_RULE_SETUP -#line 138 "../src/parser.ll" -{ BUFFER; return PROJECT_ON_SYMBOLS; } - YY_BREAK -case 43: -YY_RULE_SETUP -#line 139 "../src/parser.ll" -{ BUFFER; return PROJECT_ON_SYMBOLS; } - YY_BREAK -case 44: -YY_RULE_SETUP -#line 140 "../src/parser.ll" -{ BUFFER; return PROJECT_ON_SYMBOLS; } - YY_BREAK -case 45: -YY_RULE_SETUP -#line 141 "../src/parser.ll" -{ BUFFER; return JOIN; } - YY_BREAK -case 46: -YY_RULE_SETUP -#line 142 "../src/parser.ll" -{ BUFFER; return JOIN; } - YY_BREAK -case 47: -YY_RULE_SETUP -#line 143 "../src/parser.ll" -{ BUFFER; return JOIN; } - YY_BREAK -case 48: -YY_RULE_SETUP -#line 144 "../src/parser.ll" -{ BUFFER; return DOMAIN; } - YY_BREAK -case 49: -YY_RULE_SETUP -#line 145 "../src/parser.ll" -{ BUFFER; return TIME; } - YY_BREAK -case 50: -YY_RULE_SETUP -#line 146 "../src/parser.ll" -{ BUFFER; return TIMECLOSURE; } - YY_BREAK -case 51: -YY_RULE_SETUP -#line 147 "../src/parser.ll" -{ BUFFER; return RANGE; } - YY_BREAK -case 52: -YY_RULE_SETUP -#line 148 "../src/parser.ll" -{ BUFFER; return FORALL; } - YY_BREAK -case 53: -YY_RULE_SETUP -#line 149 "../src/parser.ll" -{ BUFFER; return FORALL; } - YY_BREAK -case 54: -YY_RULE_SETUP -#line 150 "../src/parser.ll" -{ BUFFER; return EXISTS; } - YY_BREAK -case 55: -YY_RULE_SETUP -#line 151 "../src/parser.ll" -{ BUFFER; return EXISTS; } - YY_BREAK -case 56: -YY_RULE_SETUP -#line 153 "../src/parser.ll" -{ BUFFER; return VENN; } - YY_BREAK -case 57: -YY_RULE_SETUP -#line 154 "../src/parser.ll" -{ BUFFER; return CONVEX_REPRESENTATION; } - YY_BREAK -case 58: -YY_RULE_SETUP -#line 155 "../src/parser.ll" -{ BUFFER; return CONVEX_COMBINATION; } - YY_BREAK -case 59: -YY_RULE_SETUP -#line 156 "../src/parser.ll" -{ BUFFER; return POSITIVE_COMBINATION; } - YY_BREAK -case 60: -YY_RULE_SETUP -#line 157 "../src/parser.ll" -{ BUFFER; return LINEAR_COMBINATION; } - YY_BREAK -case 61: -YY_RULE_SETUP -#line 158 "../src/parser.ll" -{ BUFFER; return AFFINE_COMBINATION; } - YY_BREAK -case 62: -YY_RULE_SETUP -#line 159 "../src/parser.ll" -{ /*deprecated*/ BUFFER; return RECT_HULL; } - YY_BREAK -case 63: -YY_RULE_SETUP -#line 160 "../src/parser.ll" -{ BUFFER; return SIMPLE_HULL; } - YY_BREAK -case 64: -YY_RULE_SETUP -#line 161 "../src/parser.ll" -{ BUFFER; return CONVEX_HULL; } - YY_BREAK -case 65: -YY_RULE_SETUP -#line 162 "../src/parser.ll" -{ BUFFER; return DECOUPLED_CONVEX_HULL; } - YY_BREAK -case 66: -YY_RULE_SETUP -#line 163 "../src/parser.ll" -{ BUFFER; return AFFINE_HULL; } - YY_BREAK -case 67: -YY_RULE_SETUP -#line 164 "../src/parser.ll" -{ BUFFER; return CONIC_HULL; } - YY_BREAK -case 68: -YY_RULE_SETUP -#line 165 "../src/parser.ll" -{ BUFFER; return LINEAR_HULL; } - YY_BREAK -case 69: -YY_RULE_SETUP -#line 166 "../src/parser.ll" -{ /*deprecated*/ BUFFER; return PAIRWISE_CHECK; } - YY_BREAK -case 70: -YY_RULE_SETUP -#line 167 "../src/parser.ll" -{ /*deprecated*/ BUFFER; return CONVEX_CHECK; } - YY_BREAK -case 71: -YY_RULE_SETUP -#line 168 "../src/parser.ll" -{ /*deprecated*/ BUFFER; return QUICK_HULL; } - YY_BREAK -case 72: -YY_RULE_SETUP -#line 169 "../src/parser.ll" -{ BUFFER; return HULL; } - YY_BREAK -case 73: -YY_RULE_SETUP -#line 170 "../src/parser.ll" -{ BUFFER; return FARKAS; } - YY_BREAK -case 74: -YY_RULE_SETUP -#line 171 "../src/parser.ll" -{ BUFFER; return DECOUPLED_FARKAS; } - YY_BREAK -case 75: -YY_RULE_SETUP -#line 172 "../src/parser.ll" -{ BUFFER; return DECOUPLED_FARKAS; } - YY_BREAK -case 76: -YY_RULE_SETUP -#line 173 "../src/parser.ll" -{ BUFFER; return DECOUPLED_FARKAS; } - YY_BREAK -case 77: -YY_RULE_SETUP -#line 175 "../src/parser.ll" -{ BUFFER; return MINIMIZE; } - YY_BREAK -case 78: -YY_RULE_SETUP -#line 176 "../src/parser.ll" -{ BUFFER; return MAXIMIZE; } - YY_BREAK -case 79: -YY_RULE_SETUP -#line 177 "../src/parser.ll" -{ BUFFER; return MINIMIZE_RANGE; } - YY_BREAK -case 80: -YY_RULE_SETUP -#line 178 "../src/parser.ll" -{ BUFFER; return MAXIMIZE_RANGE; } - YY_BREAK -case 81: -YY_RULE_SETUP -#line 179 "../src/parser.ll" -{ BUFFER; return MINIMIZE_RANGE; } - YY_BREAK -case 82: -YY_RULE_SETUP -#line 180 "../src/parser.ll" -{ BUFFER; return MAXIMIZE_RANGE; } - YY_BREAK -case 83: -YY_RULE_SETUP -#line 181 "../src/parser.ll" -{ BUFFER; return MINIMIZE_DOMAIN; } - YY_BREAK -case 84: -YY_RULE_SETUP -#line 182 "../src/parser.ll" -{ BUFFER; return MAXIMIZE_DOMAIN; } - YY_BREAK -case 85: -YY_RULE_SETUP -#line 183 "../src/parser.ll" -{ BUFFER; return MINIMIZE_DOMAIN; } - YY_BREAK -case 86: -YY_RULE_SETUP -#line 184 "../src/parser.ll" -{ BUFFER; return MAXIMIZE_DOMAIN; } - YY_BREAK -case 87: -YY_RULE_SETUP -#line 185 "../src/parser.ll" -{ BUFFER; return GIST; } - YY_BREAK -case 88: -YY_RULE_SETUP -#line 186 "../src/parser.ll" -{ BUFFER; return GIVEN; } - YY_BREAK -case 89: -YY_RULE_SETUP -#line 187 "../src/parser.ll" -{ BUFFER; return WITHIN; } - YY_BREAK -case 90: -YY_RULE_SETUP -#line 188 "../src/parser.ll" -{ BUFFER; return SUBSET; } - YY_BREAK -case 91: -YY_RULE_SETUP -#line 189 "../src/parser.ll" -{ BUFFER; return CODEGEN; } - YY_BREAK -case 92: -YY_RULE_SETUP -#line 190 "../src/parser.ll" -{ BUFFER; return MAKE_UPPER_BOUND; } - YY_BREAK -case 93: -YY_RULE_SETUP -#line 191 "../src/parser.ll" -{ BUFFER; return MAKE_LOWER_BOUND; } - YY_BREAK -case 94: -YY_RULE_SETUP -#line 192 "../src/parser.ll" -{ BUFFER; return SUPERSETOF;} - YY_BREAK -case 95: -YY_RULE_SETUP -#line 193 "../src/parser.ll" -{ BUFFER; return SUBSETOF;} - YY_BREAK -case 96: -YY_RULE_SETUP -#line 194 "../src/parser.ll" -{ BUFFER; return SYM_SAMPLE;} - YY_BREAK -case 97: -YY_RULE_SETUP -#line 195 "../src/parser.ll" -{ BUFFER; return SAMPLE;} - YY_BREAK -case 98: -YY_RULE_SETUP -#line 196 "../src/parser.ll" -{ BUFFER; return CARRIED_BY;} - YY_BREAK -case 99: -YY_RULE_SETUP -#line 197 "../src/parser.ll" -{ BUFFER; return REACHABLE_FROM; } - YY_BREAK -case 100: -YY_RULE_SETUP -#line 198 "../src/parser.ll" -{ BUFFER; return REACHABLE_OF; } - YY_BREAK -case 101: -YY_RULE_SETUP -#line 199 "../src/parser.ll" -{ BUFFER; return RESTRICT_DOMAIN; } - YY_BREAK -case 102: -YY_RULE_SETUP -#line 200 "../src/parser.ll" -{ BUFFER; return RESTRICT_DOMAIN; } - YY_BREAK -case 103: -YY_RULE_SETUP -#line 201 "../src/parser.ll" -{ BUFFER; return RESTRICT_DOMAIN; } - YY_BREAK -case 104: -YY_RULE_SETUP -#line 202 "../src/parser.ll" -{ BUFFER; return RESTRICT_RANGE; } - YY_BREAK -case 105: -YY_RULE_SETUP -#line 203 "../src/parser.ll" -{ BUFFER; return RESTRICT_RANGE; } - YY_BREAK -case 106: -YY_RULE_SETUP -#line 204 "../src/parser.ll" -{ BUFFER; return ASSERT_UNSAT; } - YY_BREAK -case 107: -YY_RULE_SETUP -#line 205 "../src/parser.ll" -{ BUFFER; return ASSERT_UNSAT; } - YY_BREAK -case 108: -YY_RULE_SETUP -#line 207 "../src/parser.ll" -{ BUFFER; return RESTRICT_RANGE; } - YY_BREAK -case 109: -YY_RULE_SETUP -#line 208 "../src/parser.ll" -{ BUFFER; return AND; } - YY_BREAK -case 110: -YY_RULE_SETUP -#line 209 "../src/parser.ll" -{ BUFFER; return OR; } - YY_BREAK -case 111: -YY_RULE_SETUP -#line 210 "../src/parser.ll" -{ BUFFER; return AND; } - YY_BREAK -case 112: -YY_RULE_SETUP -#line 211 "../src/parser.ll" -{ BUFFER; return OR; } - YY_BREAK -case 113: -YY_RULE_SETUP -#line 212 "../src/parser.ll" -{ BUFFER; return AND; } - YY_BREAK -case 114: -YY_RULE_SETUP -#line 213 "../src/parser.ll" -{ BUFFER; return OR; } - YY_BREAK -case 115: -YY_RULE_SETUP -#line 214 "../src/parser.ll" -{ BUFFER; return AND; } - YY_BREAK -case 116: -YY_RULE_SETUP -#line 215 "../src/parser.ll" -{ BUFFER; return OR; } - YY_BREAK -case 117: -YY_RULE_SETUP -#line 216 "../src/parser.ll" -{ BUFFER; return NOT; } - YY_BREAK -case 118: -YY_RULE_SETUP -#line 217 "../src/parser.ll" -{ BUFFER; return NOT; } - YY_BREAK -case 119: -YY_RULE_SETUP -#line 218 "../src/parser.ll" -{ BUFFER; return NOT; } - YY_BREAK -case 120: -YY_RULE_SETUP -#line 219 "../src/parser.ll" -{ BUFFER; return IS_ASSIGNED; } - YY_BREAK -case 121: -YY_RULE_SETUP -#line 220 "../src/parser.ll" -{ BUFFER; return GOES_TO; } - YY_BREAK -case 122: -YY_RULE_SETUP -#line 221 "../src/parser.ll" -{ BUFFER; return IN; } - YY_BREAK -case 123: -YY_RULE_SETUP -#line 222 "../src/parser.ll" -{ BUFFER; return GOES_TO; } - YY_BREAK -case 124: -YY_RULE_SETUP -#line 223 "../src/parser.ll" -{ BUFFER; yylval.REL_OPERATOR = leq; return REL_OP; } - YY_BREAK -case 125: -YY_RULE_SETUP -#line 224 "../src/parser.ll" -{ BUFFER; yylval.REL_OPERATOR = leq; return REL_OP; } - YY_BREAK -case 126: -YY_RULE_SETUP -#line 225 "../src/parser.ll" -{ BUFFER; yylval.REL_OPERATOR = leq; return REL_OP; } - YY_BREAK -case 127: -YY_RULE_SETUP -#line 226 "../src/parser.ll" -{ BUFFER; yylval.REL_OPERATOR = geq; return REL_OP; } - YY_BREAK -case 128: -YY_RULE_SETUP -#line 227 "../src/parser.ll" -{ BUFFER; yylval.REL_OPERATOR = geq; return REL_OP; } - YY_BREAK -case 129: -YY_RULE_SETUP -#line 228 "../src/parser.ll" -{ BUFFER; yylval.REL_OPERATOR = geq; return REL_OP; } - YY_BREAK -case 130: -YY_RULE_SETUP -#line 229 "../src/parser.ll" -{ BUFFER; yylval.REL_OPERATOR = neq; return REL_OP; } - YY_BREAK -case 131: -YY_RULE_SETUP -#line 230 "../src/parser.ll" -{ BUFFER; yylval.REL_OPERATOR = neq; return REL_OP; } - YY_BREAK -case 132: -YY_RULE_SETUP -#line 231 "../src/parser.ll" -{ BUFFER; yylval.REL_OPERATOR = lt; return REL_OP; } - YY_BREAK -case 133: -YY_RULE_SETUP -#line 232 "../src/parser.ll" -{ BUFFER; yylval.REL_OPERATOR = gt; return REL_OP; } - YY_BREAK -case 134: -YY_RULE_SETUP -#line 233 "../src/parser.ll" -{ BUFFER; yylval.REL_OPERATOR = eq; return REL_OP; } - YY_BREAK -case 135: -YY_RULE_SETUP -#line 234 "../src/parser.ll" -{ BUFFER; yylval.REL_OPERATOR = eq; return REL_OP; } - YY_BREAK -case 136: -YY_RULE_SETUP -#line 236 "../src/parser.ll" -{ - BUFFER; - yylval.VAR_NAME = new char[yyleng+1]; - strcpy(yylval.VAR_NAME,yytext); - return VAR; -} - YY_BREAK -case 137: -YY_RULE_SETUP -#line 242 "../src/parser.ll" -{ - BUFFER; - yylval.VAR_NAME = new char[yyleng+1]; - strcpy(yylval.VAR_NAME,yytext); - yylval.VAR_NAME[yyleng-3] = 'i'; // lowercase - yylval.VAR_NAME[yyleng-2] = 'n'; - return VAR; -} - YY_BREAK -case 138: -YY_RULE_SETUP -#line 250 "../src/parser.ll" -{ - BUFFER; - yylval.VAR_NAME = new char[yyleng+1]; - strcpy(yylval.VAR_NAME,yytext); - yylval.VAR_NAME[yyleng-4] = 'i'; // Change to "in" - yylval.VAR_NAME[yyleng-3] = 'n'; // Be afraid - yylval.VAR_NAME[yyleng-2] = ')'; - yylval.VAR_NAME[yyleng-1] = '\0'; - return VAR; -} - YY_BREAK -case 139: -YY_RULE_SETUP -#line 260 "../src/parser.ll" -{ - BUFFER; - yylval.VAR_NAME = new char[yyleng+1]; - strcpy(yylval.VAR_NAME,yytext); - yylval.VAR_NAME[yyleng-4] = 'o'; // lowercase - yylval.VAR_NAME[yyleng-3] = 'u'; - yylval.VAR_NAME[yyleng-2] = 't'; - return VAR; -} - YY_BREAK -case 140: -YY_RULE_SETUP -#line 269 "../src/parser.ll" -{ - BUFFER; - yylval.VAR_NAME = new char[yyleng+1]; - strcpy(yylval.VAR_NAME,yytext); - return VAR; - } - YY_BREAK -case 141: -YY_RULE_SETUP -#line 275 "../src/parser.ll" -{ - BUFFER; - yylval.VAR_NAME = new char[yyleng+1]; - strcpy(yylval.VAR_NAME,yytext); - yylval.VAR_NAME[yyleng-3] = 'i'; // lowercase - yylval.VAR_NAME[yyleng-2] = 'n'; - return VAR; - } - YY_BREAK -case 142: -YY_RULE_SETUP -#line 283 "../src/parser.ll" -{ - BUFFER; - yylval.VAR_NAME = new char[yyleng+1]; - strcpy(yylval.VAR_NAME,yytext); - yylval.VAR_NAME[yyleng-4] = 'i'; // Change to "in" - yylval.VAR_NAME[yyleng-3] = 'n'; // Be afraid - yylval.VAR_NAME[yyleng-2] = ')'; - yylval.VAR_NAME[yyleng-1] = '\0'; - return VAR; - } - YY_BREAK -case 143: -YY_RULE_SETUP -#line 293 "../src/parser.ll" -{ - BUFFER; - yylval.VAR_NAME = new char[yyleng+1]; - strcpy(yylval.VAR_NAME,yytext); - yylval.VAR_NAME[yyleng-4] = 'o'; // lowercase - yylval.VAR_NAME[yyleng-3] = 'u'; - yylval.VAR_NAME[yyleng-2] = 't'; - return VAR; - } - YY_BREAK -case 144: -YY_RULE_SETUP -#line 303 "../src/parser.ll" -{ BUFFER; - if (need_coef) { - sscanf(yytext, coef_fmt, &yylval.COEF_VALUE); - return COEF; - } - else { - yylval.INT_VALUE = atoi(yytext); - return INT; - } -} - YY_BREAK -case 145: -/* rule 145 can match eol */ -YY_RULE_SETUP -#line 314 "../src/parser.ll" -{ BUFFER; - yytext[yyleng-1]='\0'; - yylval.STRING_VALUE = new std::string(yytext+1); - return STRING; -} - YY_BREAK -case YY_STATE_EOF(INITIAL): -case YY_STATE_EOF(LATEX): -case YY_STATE_EOF(INCLUDE): -case YY_STATE_EOF(COMMENT): -#line 321 "../src/parser.ll" -{ - mylexer.yypop_buffer_state(); - if (!YY_CURRENT_BUFFER) { - flushScanBuffer(); - return YY_NULL; - } -} - YY_BREAK -case 146: -YY_RULE_SETUP -#line 329 "../src/parser.ll" -{ BUFFER; return yytext[0]; } - YY_BREAK -case 147: -YY_RULE_SETUP -#line 332 "../src/parser.ll" -ECHO; - YY_BREAK -#line 3039 "lex.yy.cc" - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_END_OF_FILE: - { - (yy_did_buffer_switch_on_eof) = 0; - - if ( yywrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ -} /* end of yylex */ - -/* The contents of this function are C++ specific, so the () macro is not used. - */ -yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout ) -{ - yyin = arg_yyin; - yyout = arg_yyout; - yy_c_buf_p = 0; - yy_init = 0; - yy_start = 0; - yy_flex_debug = 0; - yylineno = 1; // this will only get updated if %option yylineno - - yy_did_buffer_switch_on_eof = 0; - - yy_looking_for_trail_begin = 0; - yy_more_flag = 0; - yy_more_len = 0; - yy_more_offset = yy_prev_more_offset = 0; - - yy_start_stack_ptr = yy_start_stack_depth = 0; - yy_start_stack = NULL; - - yy_buffer_stack = 0; - yy_buffer_stack_top = 0; - yy_buffer_stack_max = 0; - - yy_state_buf = 0; - -} - -/* The contents of this function are C++ specific, so the () macro is not used. - */ -yyFlexLexer::~yyFlexLexer() -{ - delete [] yy_state_buf; - yyfree(yy_start_stack ); - yy_delete_buffer( YY_CURRENT_BUFFER ); - yyfree(yy_buffer_stack ); -} - -/* The contents of this function are C++ specific, so the () macro is not used. - */ -void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out ) -{ - if ( new_in ) - { - yy_delete_buffer( YY_CURRENT_BUFFER ); - yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) ); - } - - if ( new_out ) - yyout = new_out; -} - -#ifdef YY_INTERACTIVE -int yyFlexLexer::LexerInput( char* buf, int /* max_size */ ) -#else -int yyFlexLexer::LexerInput( char* buf, int max_size ) -#endif -{ - if ( yyin->eof() || yyin->fail() ) - return 0; - -#ifdef YY_INTERACTIVE - yyin->get( buf[0] ); - - if ( yyin->eof() ) - return 0; - - if ( yyin->bad() ) - return -1; - - return 1; - -#else - (void) yyin->read( buf, max_size ); - - if ( yyin->bad() ) - return -1; - else - return yyin->gcount(); -#endif -} - -void yyFlexLexer::LexerOutput( const char* buf, int size ) -{ - (void) yyout->write( buf, size ); -} - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ -int yyFlexLexer::yy_get_next_buffer() -{ - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; - int ret_val; - - if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else - { - int num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; - - int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - - number_to_move - 1; - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), (size_t) num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ( (yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); - if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - } - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - - return ret_val; -} - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - - yy_state_type yyFlexLexer::yy_get_previous_state() -{ - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = (yy_start); - - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 2067 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; -} - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state ) -{ - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 2067 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 2066); - - return yy_is_jam ? 0 : yy_current_state; -} - - void yyFlexLexer::yyunput( int c, register char* yy_bp) -{ - register char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - if ( c == '\n' ){ - --yylineno; - } - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - - int yyFlexLexer::yyinput() -{ - int c; - - *(yy_c_buf_p) = (yy_hold_char); - - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - int offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart( yyin ); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap( ) ) - return EOF; - - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } - - c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve yytext */ - (yy_hold_char) = *++(yy_c_buf_p); - - if ( c == '\n' ) - - yylineno++; -; - - return c; -} - -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ - void yyFlexLexer::yyrestart( std::istream* input_file ) -{ - - if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer( yyin, YY_BUF_SIZE ); - } - - yy_init_buffer( YY_CURRENT_BUFFER, input_file ); - yy_load_buffer_state( ); -} - -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ - void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -{ - - /* TODO. We should be able to replace this entire function body - * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); - */ - yyensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( ); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - (yy_did_buffer_switch_on_eof) = 1; -} - - void yyFlexLexer::yy_load_buffer_state() -{ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); -} - -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ - YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size ) -{ - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer( b, file ); - - return b; -} - -/** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() - * - */ - void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b ) -{ - - if ( ! b ) - return; - - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yyfree((void *) b->yy_ch_buf ); - - yyfree((void *) b ); -} - -extern "C" int isatty (int ); - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a yyrestart() or at EOF. - */ - void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file ) - -{ - int oerrno = errno; - - yy_flush_buffer( b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - - b->yy_is_interactive = 0; - errno = oerrno; -} - -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ - void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b ) -{ - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( ); -} - -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ -void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer) -{ - if (new_buffer == NULL) - return; - - yyensure_buffer_stack(); - - /* This block is copied from yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; -} - -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ -void yyFlexLexer::yypop_buffer_state (void) -{ - if (!YY_CURRENT_BUFFER) - return; - - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } -} - -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -void yyFlexLexer::yyensure_buffer_stack(void) -{ - int num_to_alloc; - - if (!(yy_buffer_stack)) { - - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } -} - - void yyFlexLexer::yy_push_state( int new_state ) -{ - if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) ) - { - yy_size_t new_size; - - (yy_start_stack_depth) += YY_START_STACK_INCR; - new_size = (yy_start_stack_depth) * sizeof( int ); - - if ( ! (yy_start_stack) ) - (yy_start_stack) = (int *) yyalloc(new_size ); - - else - (yy_start_stack) = (int *) yyrealloc((void *) (yy_start_stack),new_size ); - - if ( ! (yy_start_stack) ) - YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); - } - - (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START; - - BEGIN(new_state); -} - - void yyFlexLexer::yy_pop_state() -{ - if ( --(yy_start_stack_ptr) < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN((yy_start_stack)[(yy_start_stack_ptr)]); -} - - int yyFlexLexer::yy_top_state() -{ - return (yy_start_stack)[(yy_start_stack_ptr) - 1]; -} - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -void yyFlexLexer::LexerError( yyconst char msg[] ) -{ - std::cerr << msg << std::endl; - exit( YY_EXIT_FAILURE ); -} - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - yytext[yyleng] = (yy_hold_char); \ - (yy_c_buf_p) = yytext + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - yyleng = yyless_macro_arg; \ - } \ - while ( 0 ) - -/* Accessor methods (get/set functions) to struct members. */ - -/* - * Internal utility routines. - */ - -#ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) -{ - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; -} -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) -{ - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; -} -#endif - -void *yyalloc (yy_size_t size ) -{ - return (void *) malloc( size ); -} - -void *yyrealloc (void * ptr, yy_size_t size ) -{ - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); -} - -void yyfree (void * ptr ) -{ - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ -} - -#define YYTABLES_NAME "yytables" - -#line 332 "../src/parser.ll" - - - -void flushScanBuffer() { - if (scanBuf.size() == 0) - return; - if (!is_interactive) { - size_t prev_pos = 0; - if (scanBuf[0] == '\n') - prev_pos = 1; - for (size_t pos = prev_pos; pos <= scanBuf.size(); pos++) { - if (pos == scanBuf.size() || scanBuf[pos] == '\n') { - std::cout << PROMPT_STRING << " " << scanBuf.substr(prev_pos, pos-prev_pos) << std::endl; - prev_pos = pos+1; - } - } - } - - scanBuf.clear(); -} - diff --git a/omega/omega_calc/obj/tile.script b/omega/omega_calc/obj/tile.script deleted file mode 100644 index 54980bb..0000000 --- a/omega/omega_calc/obj/tile.script +++ /dev/null @@ -1,5 +0,0 @@ -sym = n; -s1:={[In_1,In_2,In_3,In_4] : exists ( t2,t4,t6,t8,t2',t4',t6',t8' : ( exists ( alpha,beta : t2 = 16beta && t2' = 16alpha && t4' = t4 && t6' = 1+t6 && t8' = 1+t8 && t2' = t2+In_1 && t4' = t4+In_2 && t6' = t6+In_3 && t8' = t8+In_4 && 0, t8-15 <= t2 <= t8 <= t2'+14 && 0 <= t2' <= t8+1, n-1 && 0 <= t6 <= n-2 && 0 <= t4 < n && t2 < n) )) }; -s2:={[t8]: 0 < t8 < 8}; - -gist(s1,s2); diff --git a/omega/omega_calc/src/AST.cc b/omega/omega_calc/src/AST.cc deleted file mode 100644 index 1f885a6..0000000 --- a/omega/omega_calc/src/AST.cc +++ /dev/null @@ -1,467 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 the Omega Project Team - Copyright (C) 2009-2011 Chun Chen - All Rights Reserved. - - Purpose: - build relation from parsed input. - - Notes: - - History: -*****************************************************************************/ - -#include -#include - -using namespace omega; - -Global_Declaration_Site *globalDecls; -Declaration_Site *relationDecl = NULL; -tupleDescriptor *currentTupleDescriptor; -std::map functionOfInput; -std::map functionOfOutput; - -AST_constraints::AST_constraints(std::set *f, Rel_Op r, AST_constraints *o) { - others = o; - rel_op = r; - first = f; -} - -AST_constraints::AST_constraints(std::set *f, Rel_Op r, std::set *s) { - others = new AST_constraints(s); - rel_op = r; - first = f; -} - -AST_constraints::AST_constraints(std::set *f){ - others = 0; - first = f; -} - -AST_constraints::~AST_constraints() { - for (std::set::iterator i = first->begin(); i != first->end(); i++) - delete *i; - delete first; - delete others; -} - -void AST_constraints::print() { - for (std::set::iterator i = first->begin(); ;) { - printf(coef_fmt, (*i)->constantTerm); - for (std::map::iterator j = (*i)->coefs.begin(); j != (*i)->coefs.end(); j++) - printf("+"coef_fmt"%s", (*j).second, static_cast((*j).first->name)); - i++; - if (i != first->end()) - printf(", "); - else - break; - } -} - - -Exp::Exp(coef_t c) : coefs() { - constantTerm = c; -} - -Exp::Exp(Variable_Ref *v) : coefs() { - assert(v != 0); - constantTerm = 0; - coefs[v] = 1; -} - -Exp *negate (Exp *x) { - x->constantTerm = -x->constantTerm; - for (std::map::iterator i = x->coefs.begin(); i != x->coefs.end(); i++) - (*i).second = -(*i).second; - return x; -} - -Exp *add (Exp *x, Exp *y) { - x->constantTerm += y->constantTerm; - for (std::map::iterator i = y->coefs.begin(); i != y->coefs.end(); i++) - x->coefs[(*i).first] += (*i).second; - delete y; - return x; -} - -Exp *subtract (Exp *x, Exp *y) { - x->constantTerm -= y->constantTerm; - for (std::map::iterator i = y->coefs.begin(); i != y->coefs.end(); i++) - x->coefs[(*i).first] -= (*i).second; - delete y; - return x; -} - -Exp *multiply (coef_t c, Exp *x) { - x->constantTerm *= c; - for (std::map::iterator i = x->coefs.begin(); i != x->coefs.end(); i++) - (*i).second *= c; - return x; -} - -Exp *multiply (Exp *x, Exp *y) { - bool found_nonzero = false; - for (std::map::iterator i = x->coefs.begin(); i != x->coefs.end(); i++) - if ((*i).second != 0) - found_nonzero = true; - if (!found_nonzero) { - coef_t c = x->constantTerm; - delete x; - return multiply(c,y); - } - - found_nonzero = false; - for (std::map::iterator i = y->coefs.begin(); i != y->coefs.end(); i++) - if ((*i).second != 0) - found_nonzero = true; - if (!found_nonzero) { - coef_t c = y->constantTerm; - delete y; - return multiply(c,x); - } - - delete x; - delete y; - throw std::runtime_error("invalid exp multiply"); -} - - - -Declaration_Site *current_Declaration_Site = 0; - -Declaration_Site::Declaration_Site() { - previous = current_Declaration_Site; - current_Declaration_Site = this; -} - -Declaration_Site::Declaration_Site(std::set *v) { - previous = current_Declaration_Site; - current_Declaration_Site = this; - for (std::set::iterator i = v->begin(); i != v->end(); i++) - declarations.insert(new Variable_Ref(*i)); -} - -Declaration_Site::~Declaration_Site() { - for (std::set::iterator i = declarations.begin(); i != declarations.end(); i++) - delete *i; -} - -Variable_Ref::Variable_Ref(char *s, int _arity, Argument_Tuple _of) { - name = s; - arity = _arity; - of = _of; - anonymous = !strncmp("In_",s,3) || !strncmp("Out_",s,4); - char *t = s; - while (*t != '\0') t++; - t--; - while (*t == '\'') t--; - t++; - *t = '\0'; - stripped_name = s; - g = 0; -} - -Variable_Ref::Variable_Ref(char *s) { - name = s; - arity = 0; - anonymous = !strncmp("In_",s,3) || !strncmp("Out_",s,4); - char *t = s; - while (*t != '\0') t++; - t--; - while (*t == '\'') t--; - t++; - *t = '\0'; - stripped_name = s; - g = 0; -} - -Variable_Ref::Variable_Ref() { - name = "#anonymous"; - arity = 0; - anonymous = 1; - stripped_name = name; - g = 0; -} - -Variable_Ref::~Variable_Ref() { - assert(g == 0); -} - -Variable_Ref *lookupScalar(char *s) { - Declaration_Site *ds; - for(ds = current_Declaration_Site; ds; ds = ds->previous) - for (std::set::iterator i = ds->declarations.begin(); i != ds->declarations.end(); i++) - if ((*i)->name == static_cast(s)) - return (*i); - return NULL; -} - -Declaration_Site *defined(char *s) { - Declaration_Site *ds; - for(ds = current_Declaration_Site; ds; ds = ds->previous) - for (std::set::iterator i = ds->declarations.begin(); i != ds->declarations.end(); i++) - if ((*i)->name == static_cast(s)) - return ds; - return NULL; -} - - -void AST_Or::install(Formula *F) { - if (F->node_type() != Op_Or) - F = F->add_or(); - left->install(F); - right->install(F); -} - -void AST_And::install(Formula *F) { - if (F->node_type() != Op_And) F = F->add_and(); - left->install(F); - right->install(F); -} - -void AST_Not::install(Formula *F) { - child->install(F->add_not()); -} - -void AST_exists::install(Formula *F) { - F_Exists *G = F->add_exists(); - for (std::set::iterator i = declaredVariables->declarations.begin(); i != declaredVariables->declarations.end(); i++) - (*i)->vid = G->declare((*i)->stripped_name); - child->install(G); -} - -void AST_forall::install(Formula *F) { - F_Forall *G = F->add_forall(); - for (std::set::iterator i = declaredVariables->declarations.begin(); i != declaredVariables->declarations.end(); i++) - (*i)->vid = G->declare((*i)->stripped_name); - child->install(G); -} - -void AST_constraints::install(Formula *F) { - if (!others) return; - F_And *f = F->and_with(); - - for (std::set::iterator i = first->begin(); i != first->end(); i++) - for (std::set::iterator j = others->first->begin(); j != others->first->end(); j++) - switch (rel_op) { - case(lt) : install_gt(f, *j, *i); break; - case(gt) : install_gt(f, *i, *j); break; - case(leq) : install_geq(f, *j, *i); break; - case(geq) : install_geq(f, *i, *j); break; - case(eq) : install_eq(f, *i, *j); break; - case(neq) : install_neq(f, *i, *j); break; - default : assert(0); - } - others->install(f); -} - - -void install_neq(F_And *F, Exp *e1, Exp *e2) { - F_Or *or_ = F->add_or(); - F_And *and1 = or_->add_and(); - F_And *and2 = or_->add_and(); - install_gt(and1,e1,e2); - install_gt(and2,e2,e1); -}; - -void install_stride(F_And *F, strideConstraint *s) { - Stride_Handle c = F->add_stride(s->step); - c.update_const(s->e->constantTerm); - for (std::map::iterator i = s->e->coefs.begin(); i != s->e->coefs.end(); i++) - c.update_coef((*i).first->id(F->relation()), (*i).second); - c.finalize(); -} - -void install_eq(F_And *F, Exp *e1, Exp *e2) { - EQ_Handle c = F->add_EQ(); - c.update_const(e1->constantTerm); - if (e2) c.update_const(-e2->constantTerm); - for (std::map::iterator i = e1->coefs.begin(); i != e1->coefs.end(); i++) - c.update_coef((*i).first->id(F->relation()), (*i).second); - if (e2) - for (std::map::iterator i = e2->coefs.begin(); i != e2->coefs.end(); i++) - c.update_coef((*i).first->id(F->relation()), -(*i).second); - c.finalize(); -} - -void install_geq(F_And *F, Exp *e1, Exp *e2) { - GEQ_Handle c = F->add_GEQ(); - c.update_const(e1->constantTerm); - if (e2) c.update_const(-e2->constantTerm); - for (std::map::iterator i = e1->coefs.begin(); i != e1->coefs.end(); i++) - c.update_coef((*i).first->id(F->relation()), (*i).second); - if (e2) - for (std::map::iterator i = e2->coefs.begin(); i != e2->coefs.end(); i++) - c.update_coef((*i).first->id(F->relation()), -(*i).second); - c.finalize(); -} - -void install_gt(F_And *F, Exp *e1, Exp *e2) { - GEQ_Handle c = F->add_GEQ(); - c.update_const(-1); - c.update_const(e1->constantTerm); - if (e2) c.update_const(-e2->constantTerm); - for (std::map::iterator i = e1->coefs.begin(); i != e1->coefs.end(); i++) - c.update_coef((*i).first->id(F->relation()), (*i).second); - if (e2) - for (std::map::iterator i = e2->coefs.begin(); i != e2->coefs.end(); i++) - c.update_coef((*i).first->id(F->relation()), -(*i).second); - c.finalize(); -} - - -Global_Declaration_Site::~Global_Declaration_Site() { -/* // Take care of global variables - since we do that kludge */ -/* // of declaring globals twice if arity > 0, we must take care */ -/* // not to just delete each global once per declaration. */ - -/* // Actually, we can't free these, since Relations containing references to */ -/* // this may get freed later */ -/* foreach(v,Variable_Ref*,this->declarations,v->g=0); */ -/* //Set globals; */ -/* //foreach(v,Variable_Ref*,this->declarations,(globals.insert(v->g),v->g=0)); */ -/* //foreach(g,Free_Var_Decl*,globals,delete g); */ - - // Only delete global variables here. --chun 5/28/2008 - for (std::set::iterator i= declarations.begin(); i != declarations.end(); i++) { - if ((*i)->g != 0) { - if ((*i)->arity != 0) { // functional symbols - // only delete once from a pair of "(in)" and "(out)" variables - const char *name = static_cast((*i)->name); - const char *s = "(in)"; - bool match = true; - for (size_t p = strlen(name)-4, q = 0; p < strlen(name); p++, q++) - if (s[q] != name[p]) { - match = false; - break; - } - if (match) - delete (*i)->g; - } - else // not functions - delete (*i)->g; - - (*i)->g = 0; - } - } -} - -Variable_Ref * Global_Declaration_Site::extend(char *s) { - Variable_Ref *r = new Variable_Ref(s); - r->g = new Free_Var_Decl(r->stripped_name); - declarations.insert(r); - return r; -} - -void Global_Declaration_Site::extend_both_tuples(char *s, int arity) { - if (arity == 0) - extend(s); - else { - assert(arity > 0); - - char s1[strlen(s)+5], s2[strlen(s)+6]; - strcpy(s1,s); strcat(s1,"(in)"); - strcpy(s2,s); strcat(s2,"(out)"); - Const_String name = s; - - Variable_Ref *r1 = new Variable_Ref(s1, arity, Input_Tuple); - Variable_Ref *r2 = new Variable_Ref(s2, arity, Output_Tuple); - r1->g = r2->g = new Free_Var_Decl(s,arity); - - functionOfInput[name] = r1; - functionOfOutput[name] = r2; - - declarations.insert(r1); - declarations.insert(r2); - } -} - - -void resetGlobals() { - for (std::set::iterator i = globalDecls->declarations.begin(); i != globalDecls->declarations.end(); i++) - (*i)->vid = 0; -} - - -Variable_Ref *Declaration_Site::extend(char *s) { - Variable_Ref *r = new Variable_Ref(s); - declarations.insert(r); - return r; -} - -Variable_Ref *Declaration_Site::extend(char *s, Argument_Tuple of, int pos) { - Variable_Ref *r = new Variable_Ref(s); - declarations.insert(r); - r->of = of; - r->pos = pos; - return r; -} - -Variable_Ref * Declaration_Site::extend() { - Variable_Ref *r = new Variable_Ref(); - declarations.insert(r); - return r; -} - -void tupleDescriptor::extend(char *s) { - Variable_Ref *r = relationDecl->extend(s); - size++; - vars.push_back(r); - assert(size == vars.size()); -} - -void tupleDescriptor::extend(char *s, Argument_Tuple of, int pos) { - Variable_Ref *r = relationDecl->extend(s, of, pos); - size++; - vars.push_back(r); - assert(size == vars.size()); -} - -void tupleDescriptor::extend(Exp *e) { - Variable_Ref *r = relationDecl->extend(); - size++; - vars.push_back(r); - assert(size == vars.size()); - Exp *eq = subtract(e, new Exp(r)); - eq_constraints.insert(eq); -} - -void tupleDescriptor::extend(char *s, Exp *e) { - Variable_Ref *r = relationDecl->extend(s); - size++; - vars.push_back(r); - assert(size == vars.size()); - Exp *eq = subtract(e, new Exp(r)); - eq_constraints.insert(eq); -} - -void tupleDescriptor::extend() { - Variable_Ref *r = relationDecl->extend(); - size++; - vars.push_back(r); - assert(size == vars.size()); -} -void tupleDescriptor::extend(Exp *lb,Exp *ub) { - Variable_Ref *r = relationDecl->extend(); - size++; - vars.push_back(r); - assert(size == vars.size()); - Exp *lb_exp = subtract(new Exp(r), lb); - geq_constraints.insert(lb_exp); - Exp *ub_exp = subtract(ub, new Exp(r)); - geq_constraints.insert(ub_exp); -} -void tupleDescriptor::extend(Exp *lb,Exp *ub, coef_t stride) { - Variable_Ref *r = relationDecl->extend(); - size++; - vars.push_back(r); - Exp *lb_exp = subtract(new Exp(r), new Exp(*lb)); - geq_constraints.insert(lb_exp); - Exp *ub_exp = subtract(ub, new Exp(r)); - geq_constraints.insert(ub_exp); - strideConstraint *s = new strideConstraint; - s->e = subtract(lb, new Exp(r)); - s->step = stride; - stride_constraints.insert(s); -} diff --git a/omega/omega_calc/src/myflex.cc b/omega/omega_calc/src/myflex.cc deleted file mode 100755 index 89a2544..0000000 --- a/omega/omega_calc/src/myflex.cc +++ /dev/null @@ -1,421 +0,0 @@ -/***************************************************************************** - Copyright (C) 2011 Chun Chen - All Rights Reserved. - - Purpose: - support command line editing for calculator. - - Notes: - Since terminfo database is not queried for those nagging escape sequences, - current supported terminials are limited to xterm, linux, cygwin. - - History: - 02/06/11 created by Chun Chen -*****************************************************************************/ - -#include -#include -#include -#include - -#if defined __USE_POSIX -#include -#include -#include -#elif defined __WIN32 -#else -#endif - -#define HISTORY_SIZE 100 - -namespace { -enum {MY_KEY_EOF=0, MY_KEY_LEFT, MY_KEY_RIGHT, MY_KEY_UP, MY_KEY_DOWN, - MY_KEY_DEL, MY_KEY_HOME, MY_KEY_END, MY_KEY_PGUP, MY_KEY_PGDOWN, - MY_KEY_NUMPAD_HOME, MY_KEY_NUMPAD_END}; -} - -extern bool is_interactive; -extern const char * PROMPT_STRING; - -void move_cursor(int col, int n, int num_cols, const std::vector &key_seqs) { - if (n == 0) - return; - - int new_col = omega::int_mod(col + n, num_cols); - if (new_col == 0) - new_col = num_cols; - - for (int i = 0; i < new_col-col; i++) - std::cout.write(key_seqs[MY_KEY_RIGHT].c_str(), key_seqs[MY_KEY_RIGHT].length()); - for (int i = 0; i < col-new_col; i++) - std::cout.write(key_seqs[MY_KEY_LEFT].c_str(), key_seqs[MY_KEY_LEFT].length()); - - if (n < 0) - for (int i = 0; i < omega::abs(n) / num_cols + (new_col>col)?1:0; i++) - std::cout.write(key_seqs[MY_KEY_UP].c_str(), key_seqs[MY_KEY_UP].length()); - else - for (int i = 0; i < omega::abs(n) / num_cols + (new_col 0 && cur_line[len-1] == '\n') { - int n = omega::min(len-cur_pos, max_size); - for (int i = 0; i < n; i++) - buf[i] = cur_line[cur_pos+i]; - cur_pos = cur_pos + n; - if (cur_pos == len) { - // save history - if (len > 1) { - if (last_history_pos == -1) - last_history_pos = 0; - else { - last_history_pos = (last_history_pos+1)%HISTORY_SIZE; - if ((last_history_pos + 1)%HISTORY_SIZE == first_history_pos) - first_history_pos = (first_history_pos+1)%HISTORY_SIZE; - } - history[last_history_pos] = cur_line.substr(0, len-1); - cur_history_pos = (last_history_pos+1)%HISTORY_SIZE; - } - - // clear the working line - cur_pos = 0; - cur_line.clear(); - } - tcsetattr(STDIN_FILENO, TCSANOW, &old_settings); - return n; - } - - int count = read(STDIN_FILENO, keycodes, 255); - - // handle special key my way - int eaten = 0; - while (eaten < count) { - if (key_seqs[MY_KEY_EOF].length() > 0 && - static_cast(count - eaten) >= key_seqs[MY_KEY_EOF].length() && - strncmp(&keycodes[eaten], key_seqs[MY_KEY_EOF].c_str(), key_seqs[MY_KEY_EOF].length()) == 0) { - if (cur_line.length() == 0) { - tcsetattr(STDIN_FILENO, TCSANOW, &old_settings); - return 0; - } - - eaten += key_seqs[MY_KEY_EOF].length(); - } - else if (key_seqs[MY_KEY_LEFT].length() > 0 && - static_cast(count - eaten) >= key_seqs[MY_KEY_LEFT].length() && - strncmp(&keycodes[eaten], key_seqs[MY_KEY_LEFT].c_str(), key_seqs[MY_KEY_LEFT].length()) == 0) { - if (cur_pos > 0) { - int cur_col = (cur_pos + 1 + strlen(PROMPT_STRING) + 1) % num_cols; - if (cur_col == 0) - cur_col = num_cols; - - cur_pos--; - - move_cursor(cur_col, -1, num_cols, key_seqs); - } - eaten += key_seqs[MY_KEY_LEFT].length(); - } - else if (key_seqs[MY_KEY_RIGHT].length() > 0 && - static_cast(count - eaten) >= key_seqs[MY_KEY_RIGHT].length() && - strncmp(&keycodes[eaten], key_seqs[MY_KEY_RIGHT].c_str(), key_seqs[MY_KEY_RIGHT].length()) == 0) { - if (static_cast(cur_pos) < cur_line.length()) { - int cur_col = (cur_pos + 1 + strlen(PROMPT_STRING) + 1) % num_cols; - if (cur_col == 0) - cur_col = num_cols; - - cur_pos++; - - move_cursor(cur_col, 1, num_cols, key_seqs); - } - eaten += key_seqs[MY_KEY_RIGHT].length(); - } - else if (key_seqs[MY_KEY_UP].length() > 0 && - static_cast(count - eaten) >= key_seqs[MY_KEY_UP].length() && - strncmp(&keycodes[eaten], key_seqs[MY_KEY_UP].c_str(), key_seqs[MY_KEY_UP].length()) == 0) { - if (cur_history_pos >= 0 && cur_history_pos != first_history_pos) { - history[cur_history_pos] = cur_line; - cur_history_pos = omega::int_mod(cur_history_pos-1, HISTORY_SIZE); - - int cur_col = (cur_pos + 1 + strlen(PROMPT_STRING) + 1) % num_cols; - if (cur_col == 0) - cur_col = num_cols; - - move_cursor(cur_col, -cur_pos, num_cols, key_seqs); - - std::cout.write(history[cur_history_pos].c_str(), history[cur_history_pos].length()); - - cur_col = (history[cur_history_pos].length() + strlen(PROMPT_STRING) + 1) % num_cols; - if (cur_col == 0) { - std::cout.put(' '); - std::cout.put('\b'); - } - - if (cur_line.length() > history[cur_history_pos].length()) { - for (size_t i = 0; i < cur_line.length() - history[cur_history_pos].length(); i++) - std::cout.put(' '); - - cur_col = (cur_line.length() + strlen(PROMPT_STRING) + 1) % num_cols; - if (cur_col == 0) - cur_col = num_cols + 1; - else - cur_col++; - - move_cursor(cur_col, -(cur_line.length() - history[cur_history_pos].length()), num_cols, key_seqs); - } - cur_line = history[cur_history_pos]; - cur_pos = cur_line.length(); - } - - eaten += key_seqs[MY_KEY_UP].length(); - } - else if (key_seqs[MY_KEY_DOWN].length() > 0 && - static_cast(count - eaten) >= key_seqs[MY_KEY_DOWN].length() && - strncmp(&keycodes[eaten], key_seqs[MY_KEY_DOWN].c_str(), key_seqs[MY_KEY_DOWN].length()) == 0) { - if (cur_history_pos >= 0 && cur_history_pos != (last_history_pos+1)%HISTORY_SIZE) { - history[cur_history_pos] = cur_line; - cur_history_pos = (cur_history_pos+1)%HISTORY_SIZE; - - int cur_col = (cur_pos + 1 + strlen(PROMPT_STRING) + 1) % num_cols; - if (cur_col == 0) - cur_col = num_cols; - - move_cursor(cur_col, -cur_pos, num_cols, key_seqs); - - std::cout.write(history[cur_history_pos].c_str(), history[cur_history_pos].length()); - - cur_col = (history[cur_history_pos].length() + strlen(PROMPT_STRING) + 1) % num_cols; - if (cur_col == 0) { - std::cout.put(' '); - std::cout.put('\b'); - } - - if (cur_line.length() > history[cur_history_pos].length()) { - for (size_t i = 0; i < cur_line.length() - history[cur_history_pos].length(); i++) - std::cout.put(' '); - - cur_col = (cur_line.length() + strlen(PROMPT_STRING) + 1) % num_cols; - if (cur_col == 0) - cur_col = num_cols + 1; - else - cur_col++; - - move_cursor(cur_col, -(cur_line.length() - history[cur_history_pos].length()), num_cols, key_seqs); - } - cur_line = history[cur_history_pos]; - cur_pos = cur_line.length(); - } - - eaten += key_seqs[MY_KEY_DOWN].length(); - } - else if (key_seqs[MY_KEY_DEL].length() > 0 && - static_cast(count - eaten) >= key_seqs[MY_KEY_DEL].length() && - strncmp(&keycodes[eaten], key_seqs[MY_KEY_DEL].c_str(), key_seqs[MY_KEY_DEL].length()) == 0) { - if (static_cast(cur_pos) < cur_line.length()) { - cur_line.erase(cur_pos, 1); - std::cout.write(&(cur_line.c_str()[cur_pos]), cur_line.length()-cur_pos); - std::cout.put(' '); - - int cur_col = (cur_line.length() + 1 + strlen(PROMPT_STRING) + 1) % num_cols; - if (cur_col == 0) - cur_col = num_cols + 1; - else - cur_col++; - - move_cursor(cur_col, -(cur_line.length()-cur_pos+1), num_cols, key_seqs); - } - - eaten += key_seqs[MY_KEY_DEL].length(); - } - else if (key_seqs[MY_KEY_HOME].length() > 0 && - static_cast(count - eaten) >= key_seqs[MY_KEY_HOME].length() && - strncmp(&keycodes[eaten], key_seqs[MY_KEY_HOME].c_str(), key_seqs[MY_KEY_HOME].length()) == 0) { - int cur_col = (cur_pos + 1 + strlen(PROMPT_STRING) + 1) % num_cols; - if (cur_col == 0) - cur_col = num_cols; - - move_cursor(cur_col, -cur_pos, num_cols, key_seqs); - - cur_pos = 0; - eaten += key_seqs[MY_KEY_HOME].length(); - } - else if (key_seqs[MY_KEY_END].length() > 0 && - static_cast(count - eaten) >= key_seqs[MY_KEY_END].length() && - strncmp(&keycodes[eaten], key_seqs[MY_KEY_END].c_str(), key_seqs[MY_KEY_END].length()) == 0) { - int cur_col = (cur_pos + 1 + strlen(PROMPT_STRING) + 1) % num_cols; - if (cur_col == 0) - cur_col = num_cols; - - move_cursor(cur_col, cur_line.length()-cur_pos, num_cols, key_seqs); - - cur_pos = cur_line.length(); - eaten += key_seqs[MY_KEY_END].length(); - } - else if (key_seqs[MY_KEY_PGUP].length() > 0 && - static_cast(count - eaten) >= key_seqs[MY_KEY_PGUP].length() && - strncmp(&keycodes[eaten], key_seqs[MY_KEY_PGUP].c_str(), key_seqs[MY_KEY_PGUP].length()) == 0) { - eaten += key_seqs[MY_KEY_PGUP].length(); - } - else if (key_seqs[MY_KEY_PGDOWN].length() > 0 && - static_cast(count - eaten) >= key_seqs[MY_KEY_PGDOWN].length() && - strncmp(&keycodes[eaten], key_seqs[MY_KEY_PGDOWN].c_str(), key_seqs[MY_KEY_PGDOWN].length()) == 0) { - eaten += key_seqs[MY_KEY_PGDOWN].length(); - } - else if (key_seqs[MY_KEY_NUMPAD_HOME].length() > 0 && - static_cast(count - eaten) >= key_seqs[MY_KEY_NUMPAD_HOME].length() && - strncmp(&keycodes[eaten], key_seqs[MY_KEY_NUMPAD_HOME].c_str(), key_seqs[MY_KEY_NUMPAD_HOME].length()) == 0) { - eaten += key_seqs[MY_KEY_NUMPAD_HOME].length(); - } - else if (key_seqs[MY_KEY_NUMPAD_END].length() > 0 && - static_cast(count - eaten) >= key_seqs[MY_KEY_NUMPAD_END].length() && - strncmp(&keycodes[eaten], key_seqs[MY_KEY_NUMPAD_END].c_str(), key_seqs[MY_KEY_NUMPAD_END].length()) == 0) { - eaten += key_seqs[MY_KEY_NUMPAD_END].length(); - } - else if (keycodes[eaten] == '\x1B' && (count - eaten == 1 || keycodes[eaten+1] == '\x1B')) { // single ESC key - eaten++; - } - else if (keycodes[eaten] == '\x1B') { // unknown escape sequences - while (eaten+1 < count && keycodes[eaten+1] != '\x1B') - eaten++; - - keycodes[eaten] = '~'; - } - else if (keycodes[eaten] == '\x7F') { // backspace key - if (cur_pos > 0) { - int cur_col = (cur_pos + 1 + strlen(PROMPT_STRING) + 1) % num_cols; - if (cur_col == 0) - cur_col = num_cols; - - cur_pos--; - cur_line.erase(cur_pos, 1); - - move_cursor(cur_col, -1, num_cols, key_seqs); - - std::cout.write(&(cur_line.c_str()[cur_pos]), cur_line.length()-cur_pos); - std::cout.put(' '); - - cur_col = (cur_line.length() + 1 + strlen(PROMPT_STRING) + 1) % num_cols; - if (cur_col == 0) - cur_col = num_cols + 1; - else - cur_col++; - - move_cursor(cur_col, -(cur_line.length()-cur_pos+1), num_cols, key_seqs); - } - - eaten++; - } - else if (keycodes[eaten] == '\n'){ // return key - int cur_col = (cur_pos + 1 + strlen(PROMPT_STRING) + 1) % num_cols; - if (cur_col == 0) - cur_col = num_cols; - - move_cursor(cur_col, cur_line.length()-cur_pos, num_cols, key_seqs); - - std::cout.put(keycodes[eaten]); - cur_line.append(1, '\n'); - cur_pos = 0; - break; - } - else { // all other key - std::cout.put(keycodes[eaten]); - std::cout.write(&(cur_line.c_str()[cur_pos]), cur_line.length()-cur_pos); - - cur_line.insert(cur_pos, &keycodes[eaten], 1); - cur_pos++; - - int cur_col = (cur_line.length() + strlen(PROMPT_STRING) + 1) % num_cols; - if (cur_col == 0) { - // force cursor to move to the next line when the last printed char is at - // the right boundary of the terminal - std::cout.put(' '); - std::cout.put('\b'); - - cur_col = 1; - } - else - cur_col++; - - move_cursor(cur_col, -(cur_line.length()-cur_pos), num_cols, key_seqs); - - eaten++; - } - - std::cout.flush(); - } - } -#else - return yyFlexLexer::LexerInput(buf, max_size); -#endif -} diff --git a/omega/omega_calc/src/parser.l b/omega/omega_calc/src/parser.l deleted file mode 100644 index ac2b448..0000000 --- a/omega/omega_calc/src/parser.l +++ /dev/null @@ -1,350 +0,0 @@ -%{ -#include -#include -#include -#include -#include -#include - -using namespace omega; -#include "y.tab.h" - -#define BUFFER scanBuf += yytext -std::string scanBuf; -std::string err_msg; - -extern "C" int yywrap() {return 1;}; - - -#define MAX_INCLUDE_DEPTH 10 -YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; -int include_stack_ptr = 0; -int comment_caller; - -extern bool is_interactive; -extern const char *PROMPT_STRING; -extern bool need_coef; - -// void yyerror(const char *s); -void yyerror(const std::string &s); -void flushScanBuffer(); - -%} - -%s LATEX INCLUDE COMMENT -%option yylineno - -%% - -"<<" { BUFFER; BEGIN(INCLUDE); } -[^>\n ]+">>" { - BUFFER; - scanBuf += "\n"; - flushScanBuffer(); - - if (include_stack_ptr >= MAX_INCLUDE_DEPTH) { - fprintf(stderr, "File including nested too deeply, abort"); - exit(1); - } - - char *s = yytext; - while (*s != '>') s++; - *s = '\0'; - FILE *f = fopen(yytext, "r"); - if (!f) { - fprintf(stderr, "Can't open file %s\n", yytext); - } - else { - include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER; - yyin = f; - yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); - } - BEGIN(INITIAL); -} -[ \n] { - fprintf(stderr,"Error in include syntax\n"); - fprintf(stderr,"Use <> to include the file named fname\n"); - BEGIN(INITIAL); - if(is_interactive && include_stack_ptr == 0) - printf("%s ", PROMPT_STRING); -} - -\n { - BUFFER; - BEGIN(comment_caller); - if(is_interactive && include_stack_ptr == 0) - printf("%s ", PROMPT_STRING); -} - -\n { - BUFFER; - if(is_interactive && include_stack_ptr == 0) - printf("%s ", PROMPT_STRING); -} - -"\\ " { BUFFER; } -[ \t]+ { BUFFER; } -# { BUFFER; comment_caller = YY_START; BEGIN(COMMENT); } -.* { BUFFER; flushScanBuffer(); } -"\$\$" { BUFFER; BEGIN(INITIAL); } -"\$\$" { BUFFER; BEGIN(LATEX); } -"\\t" { BUFFER; } -"\\!" { BUFFER; } -"\\\\" { BUFFER; } - -"{" { BUFFER; return OPEN_BRACE; } -"\\{" { BUFFER; return OPEN_BRACE; } -"}" { BUFFER; return CLOSE_BRACE; } -"\\}" { BUFFER; return CLOSE_BRACE; } -"approximate" { BUFFER; return APPROX; } -"union" { BUFFER; return UNION; } -"\\cup" { BUFFER; return UNION; } -"intersection" { BUFFER; return INTERSECTION; } -"\\cap" { BUFFER; return INTERSECTION; } -"symbolic" { BUFFER; return SYMBOLIC; } -"sym" { BUFFER; return SYMBOLIC; } -"\\mid" { BUFFER; return VERTICAL_BAR; } -"|" { BUFFER; return VERTICAL_BAR; } -"\\st" { BUFFER; return SUCH_THAT; } -"s.t." { BUFFER; return SUCH_THAT; } -"inverse" { BUFFER; return INVERSE; } -"complement" { BUFFER; return COMPLEMENT; } -"\\circ" { BUFFER; return COMPOSE; } -"compose" { BUFFER; return COMPOSE; } -"difference" { BUFFER; return DIFFERENCE; } -"diffToRel" { BUFFER; return DIFFERENCE_TO_RELATION; } -"project away symbols" { BUFFER; return PROJECT_AWAY_SYMBOLS; } -"project_away_symbols" { BUFFER; return PROJECT_AWAY_SYMBOLS; } -"projectAwaySymbols" { BUFFER; return PROJECT_AWAY_SYMBOLS; } -"project on symbols" { BUFFER; return PROJECT_ON_SYMBOLS; } -"project_on_symbols" { BUFFER; return PROJECT_ON_SYMBOLS; } -"projectOnSymbols" { BUFFER; return PROJECT_ON_SYMBOLS; } -"\\join" { BUFFER; return JOIN; } -"\." { BUFFER; return JOIN; } -"join" { BUFFER; return JOIN; } -"domain" { BUFFER; return DOMAIN; } -"time" { BUFFER; return TIME; } -"timeclosure" { BUFFER; return TIMECLOSURE; } -"range" { BUFFER; return RANGE; } -"\\forall" { BUFFER; return FORALL; } -"forall" { BUFFER; return FORALL; } -"\\exists" { BUFFER; return EXISTS; } -"exists" { BUFFER; return EXISTS; } - -"Venn" { BUFFER; return VENN; } -"ConvexRepresentation" { BUFFER; return CONVEX_REPRESENTATION; } -"ConvexCombination" { BUFFER; return CONVEX_COMBINATION; } -"PositiveCombination" { BUFFER; return POSITIVE_COMBINATION; } -"LinearCombination" { BUFFER; return LINEAR_COMBINATION; } -"AffineCombination" { BUFFER; return AFFINE_COMBINATION; } -"RectHull" { BUFFER; return RECT_HULL; } -"ConvexHull" { BUFFER; return CONVEX_HULL; } -"DecoupledConvexHull" { BUFFER; return DECOUPLED_CONVEX_HULL; } -"AffineHull" { BUFFER; return AFFINE_HULL; } -"ConicHull" { BUFFER; return CONIC_HULL; } -"LinearHull" { BUFFER; return LINEAR_HULL; } -"PairwiseCheck" { /*deprecated*/ BUFFER; return PAIRWISE_CHECK; } -"ConvexCheck" { /*deprecated*/ BUFFER; return CONVEX_CHECK; } -"QuickHull" { /*deprecated*/ BUFFER; return QUICK_HULL; } -"hull" { BUFFER; return HULL; } - -"minimize" { BUFFER; return MINIMIZE; } -"maximize" { BUFFER; return MAXIMIZE; } -"minimize-range" { BUFFER; return MINIMIZE_RANGE; } -"maximize-range" { BUFFER; return MAXIMIZE_RANGE; } -"minimizerange" { BUFFER; return MINIMIZE_RANGE; } -"maximizerange" { BUFFER; return MAXIMIZE_RANGE; } -"minimize-domain" { BUFFER; return MINIMIZE_DOMAIN; } -"maximize-domain" { BUFFER; return MAXIMIZE_DOMAIN; } -"minimizedomain" { BUFFER; return MINIMIZE_DOMAIN; } -"maximizedomain" { BUFFER; return MAXIMIZE_DOMAIN; } -"gist" { BUFFER; return GIST; } -"given" { BUFFER; return GIVEN; } -"within" { BUFFER; return WITHIN; } -"subset" { BUFFER; return SUBSET; } -"codegen" { BUFFER; return CODEGEN; } -"farkas" { BUFFER; return FARKAS; } -"decoupledfarkas" { BUFFER; return DECOUPLED_FARKAS; } -"decoupled-farkas" { BUFFER; return DECOUPLED_FARKAS; } -"decoupled_farkas" { BUFFER; return DECOUPLED_FARKAS; } -"upper_bound" { BUFFER; return MAKE_UPPER_BOUND; } -"lower_bound" { BUFFER; return MAKE_LOWER_BOUND; } -"supersetof" { BUFFER; return SUPERSETOF;} -"subsetof" { BUFFER; return SUBSETOF;} -"sym_example" { BUFFER; return SYM_SAMPLE;} -"example" { BUFFER; return SAMPLE;} -"carried_by" { BUFFER; return CARRIED_BY;} -"reachable" { BUFFER; return REACHABLE_FROM; } -"reachable of" { BUFFER; return REACHABLE_OF; } -"restrict_domain" { BUFFER; return RESTRICT_DOMAIN; } -"restrictDomain" { BUFFER; return RESTRICT_DOMAIN; } -"\\" { yyerror("Can't use \\ for restrict_domain in Tex mode"); } -"\\" { BUFFER; return RESTRICT_DOMAIN; } -"restrict_range" { BUFFER; return RESTRICT_RANGE; } -"restrictRange" { BUFFER; return RESTRICT_RANGE; } -"assertUnsatisfiable" { BUFFER; return ASSERT_UNSAT; } -"assert_unsatisfiable" { BUFFER; return ASSERT_UNSAT; } - -"/" { BUFFER; return RESTRICT_RANGE; } -"&" { BUFFER; return AND; } -"|" { BUFFER; return OR; } -"&&" { BUFFER; return AND; } -"||" { BUFFER; return OR; } -"and" { BUFFER; return AND; } -"or" { BUFFER; return OR; } -"\\land" { BUFFER; return AND; } -"\\lor" { BUFFER; return OR; } -"!" { BUFFER; return NOT; } -"not" { BUFFER; return NOT; } -"\\neg" { BUFFER; return NOT; } -":=" { BUFFER; return IS_ASSIGNED; } -"->" { BUFFER; return GOES_TO; } -"in" { BUFFER; return IN; } -"\\rightarrow" { BUFFER; return GOES_TO; } -"<=" { BUFFER; yylval.REL_OPERATOR = leq; return REL_OP; } -"\\leq" { BUFFER; yylval.REL_OPERATOR = leq; return REL_OP; } -"\\le" { BUFFER; yylval.REL_OPERATOR = leq; return REL_OP; } -">=" { BUFFER; yylval.REL_OPERATOR = geq; return REL_OP; } -"\\geq" { BUFFER; yylval.REL_OPERATOR = geq; return REL_OP; } -"\\ge" { BUFFER; yylval.REL_OPERATOR = geq; return REL_OP; } -"!=" { BUFFER; yylval.REL_OPERATOR = neq; return REL_OP; } -"\\neq" { BUFFER; yylval.REL_OPERATOR = neq; return REL_OP; } -"<" { BUFFER; yylval.REL_OPERATOR = lt; return REL_OP; } -">" { BUFFER; yylval.REL_OPERATOR = gt; return REL_OP; } -"=" { BUFFER; yylval.REL_OPERATOR = eq; return REL_OP; } -"==" { BUFFER; yylval.REL_OPERATOR = eq; return REL_OP; } - -[A-Za-z][A-Za-z0-9_]*[\']* { - BUFFER; - if (yyleng > 19) yyerror("Identifier too long"); - yylval.VAR_NAME = new char[yyleng+1]; - strcpy(yylval.VAR_NAME,yytext); - return VAR; -} -[A-Za-z][A-Za-z0-9_]*"(in)" { - BUFFER; - if (yyleng > 19) yyerror("Identifier too long"); - yylval.VAR_NAME = new char[yyleng+1]; - strcpy(yylval.VAR_NAME,yytext); - yylval.VAR_NAME[yyleng-3] = 'i'; // lowercase - yylval.VAR_NAME[yyleng-2] = 'n'; - return VAR; -} -[A-Za-z][A-Za-z0-9_]*"(set)" { - BUFFER; - if (yyleng > 19) yyerror("Identifier too long"); - yylval.VAR_NAME = new char[yyleng+1]; - strcpy(yylval.VAR_NAME,yytext); - yylval.VAR_NAME[yyleng-4] = 'i'; // Change to "in" - yylval.VAR_NAME[yyleng-3] = 'n'; // Be afraid - yylval.VAR_NAME[yyleng-2] = ')'; - yylval.VAR_NAME[yyleng-1] = '\0'; - return VAR; -} -[A-Za-z][A-Za-z0-9_]*"(out)" { - BUFFER; - if (yyleng > 19) yyerror("Identifier too long"); - yylval.VAR_NAME = new char[yyleng+1]; - strcpy(yylval.VAR_NAME,yytext); - yylval.VAR_NAME[yyleng-4] = 'o'; // lowercase - yylval.VAR_NAME[yyleng-3] = 'u'; - yylval.VAR_NAME[yyleng-2] = 't'; - return VAR; -} -"\\"[A-Za-z][A-Za-z0-9_]* { - BUFFER; - if (yyleng > 19) yyerror("Identifier too long"); - yylval.VAR_NAME = new char[yyleng+1]; - strcpy(yylval.VAR_NAME,yytext); - return VAR; - } -"\\"[A-Za-z][A-Za-z0-9_]*"(in)" { - BUFFER; - if (yyleng > 19) yyerror("Identifier too long"); - yylval.VAR_NAME = new char[yyleng+1]; - strcpy(yylval.VAR_NAME,yytext); - yylval.VAR_NAME[yyleng-3] = 'i'; // lowercase - yylval.VAR_NAME[yyleng-2] = 'n'; - return VAR; - } -"\\"[A-Za-z][A-Za-z0-9_]*"(set)" { - BUFFER; - if (yyleng > 19) yyerror("Identifier too long"); - yylval.VAR_NAME = new char[yyleng+1]; - strcpy(yylval.VAR_NAME,yytext); - yylval.VAR_NAME[yyleng-4] = 'i'; // Change to "in" - yylval.VAR_NAME[yyleng-3] = 'n'; // Be afraid - yylval.VAR_NAME[yyleng-2] = ')'; - yylval.VAR_NAME[yyleng-1] = '\0'; - return VAR; - } -"\\"[A-Za-z][A-Za-z0-9_]*"(out)" { - BUFFER; - if (yyleng > 19) yyerror("Identifier too long"); - yylval.VAR_NAME = new char[yyleng+1]; - strcpy(yylval.VAR_NAME,yytext); - yylval.VAR_NAME[yyleng-4] = 'o'; // lowercase - yylval.VAR_NAME[yyleng-3] = 'u'; - yylval.VAR_NAME[yyleng-2] = 't'; - return VAR; - } - -[0-9]+ { BUFFER; - if (need_coef) { - sscanf(yytext, coef_fmt, &yylval.COEF_VALUE); - return COEF; - } - else { - yylval.INT_VALUE = atoi(yytext); - return INT; - } -} - -\"[^\"]*\" { BUFFER; - yytext[strlen(yytext)-1]='\0'; - yylval.STRING_VALUE = new std::string(yytext+1); - return STRING; -} - - -<> { - if (--include_stack_ptr < 0) { - flushScanBuffer(); - return yytext[0]; - } - yy_delete_buffer(YY_CURRENT_BUFFER); - yy_switch_to_buffer(include_stack[include_stack_ptr]); -} - -. { BUFFER; return yytext[0]; } - - -%% - -void yyerror(const std::string &s) { - std::stringstream ss; - if (is_interactive && include_stack_ptr == 0) - ss << s << "\n"; - else - ss << s << " at line " << yylineno << "\n"; - err_msg = ss.str(); -} - - -void flushScanBuffer() { - if (scanBuf.size() == 0) - return; - if (!is_interactive || include_stack_ptr > 0) { - size_t prev_pos = 0; - if (scanBuf[0] == '\n') - prev_pos = 1; - for (size_t pos = prev_pos; pos <= scanBuf.size(); pos++) { - if (pos == scanBuf.size() || scanBuf[pos] == '\n') { - std::cout << PROMPT_STRING << " " << scanBuf.substr(prev_pos, pos-prev_pos) << std::endl; - prev_pos = pos+1; - } - } - } - - scanBuf.clear(); -} diff --git a/omega/omega_calc/src/parser.ll b/omega/omega_calc/src/parser.ll deleted file mode 100755 index 86de3a4..0000000 --- a/omega/omega_calc/src/parser.ll +++ /dev/null @@ -1,350 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 the Omega Project Team - Copyright (C) 2005-2011 Chun Chen - All Rights Reserved. - - Purpose: - lex parser for calculator. - - Notes: - - History: - 02/04/11 migrate to flex c++ mode, Chun Chen -*****************************************************************************/ - -%{ -#include -#include -#include -#include -#include -#include -#include -#include -#include "parser.tab.hh" -#include - -myFlexLexer mylexer; -bool is_interactive; -const char *PROMPT_STRING = ">>>"; - -#define BUFFER scanBuf += yytext -std::string scanBuf; -std::string err_msg; - -extern bool need_coef; - -void yyerror(const std::string &s); -void flushScanBuffer(); - -%} - -%s LATEX INCLUDE COMMENT -%option yylineno -%option noyywrap - -%% - -"<<" { BUFFER; BEGIN(INCLUDE); } -[^>\n ]+">>" { - BUFFER; - scanBuf += "\n"; - flushScanBuffer(); - - if (is_interactive) { - std::cout << "file include disabled in interactive mode\n"; - } - else { - char *s = yytext; - while (*s != '>') s++; - *s = '\0'; - std::ifstream *ifs = new std::ifstream(yytext, std::ifstream::in); - if (!ifs->is_open()) { - fprintf(stderr, "Can't open file %s\n", yytext); - } - else { - yy_buffer_state *bs = mylexer.yy_create_buffer(ifs, 8092); - mylexer.yypush_buffer_state(bs); - } - } - BEGIN(INITIAL); -} -[ \n] { - std::cout << "Error in include syntax\n"; - std::cout << "Use <> to include the file named fname\n"; - BEGIN(INITIAL); - if(is_interactive) { - std::cout << PROMPT_STRING << ' '; - std::cout.flush(); - } -} - - - - - -"\\ " { BUFFER; } -[ \t]+ { BUFFER; } -# { BUFFER; BEGIN(COMMENT); } -.* { BUFFER; } -"\$\$\n" { BUFFER; BEGIN(INITIAL); } -"\$\$" { BUFFER; BEGIN(INITIAL); } -"\$\$" { BUFFER; BEGIN(LATEX); } -"\\n" { BUFFER; } -"\\t" { BUFFER; } -"\\!" { BUFFER; } -"\\\\" { BUFFER; } -"\n" { BUFFER; } - - -\n { - BUFFER; - BEGIN(INITIAL); - if(is_interactive) { - std::cout << PROMPT_STRING << ' '; - std::cout.flush(); - } -} - - - - - -"{" { BUFFER; return OPEN_BRACE; } -"\\{" { BUFFER; return OPEN_BRACE; } -"}" { BUFFER; return CLOSE_BRACE; } -"\\}" { BUFFER; return CLOSE_BRACE; } -"approximate" { BUFFER; return APPROX; } -"union" { BUFFER; return UNION; } -"\\cup" { BUFFER; return UNION; } -"intersection" { BUFFER; return INTERSECTION; } -"\\cap" { BUFFER; return INTERSECTION; } -"without_simplify" { BUFFER; return NO_SIMPLIFY; } -"symbolic" { BUFFER; return SYMBOLIC; } -"sym" { BUFFER; return SYMBOLIC; } -"\\mid" { BUFFER; return VERTICAL_BAR; } -"|" { BUFFER; return VERTICAL_BAR; } -"\\st" { BUFFER; return SUCH_THAT; } -"s.t." { BUFFER; return SUCH_THAT; } -"inverse" { BUFFER; return INVERSE; } -"complement" { BUFFER; return COMPLEMENT; } -"\\circ" { BUFFER; return COMPOSE; } -"compose" { BUFFER; return COMPOSE; } -"difference" { BUFFER; return DIFFERENCE; } -"diffToRel" { BUFFER; return DIFFERENCE_TO_RELATION; } -"project away symbols" { BUFFER; return PROJECT_AWAY_SYMBOLS; } -"project_away_symbols" { BUFFER; return PROJECT_AWAY_SYMBOLS; } -"projectAwaySymbols" { BUFFER; return PROJECT_AWAY_SYMBOLS; } -"project on symbols" { BUFFER; return PROJECT_ON_SYMBOLS; } -"project_on_symbols" { BUFFER; return PROJECT_ON_SYMBOLS; } -"projectOnSymbols" { BUFFER; return PROJECT_ON_SYMBOLS; } -"\\join" { BUFFER; return JOIN; } -"\." { BUFFER; return JOIN; } -"join" { BUFFER; return JOIN; } -"domain" { BUFFER; return DOMAIN; } -"time" { BUFFER; return TIME; } -"timeclosure" { BUFFER; return TIMECLOSURE; } -"range" { BUFFER; return RANGE; } -"\\forall" { BUFFER; return FORALL; } -"forall" { BUFFER; return FORALL; } -"\\exists" { BUFFER; return EXISTS; } -"exists" { BUFFER; return EXISTS; } - -"Venn" { BUFFER; return VENN; } -"ConvexRepresentation" { BUFFER; return CONVEX_REPRESENTATION; } -"ConvexCombination" { BUFFER; return CONVEX_COMBINATION; } -"PositiveCombination" { BUFFER; return POSITIVE_COMBINATION; } -"LinearCombination" { BUFFER; return LINEAR_COMBINATION; } -"AffineCombination" { BUFFER; return AFFINE_COMBINATION; } -"RectHull" { /*deprecated*/ BUFFER; return RECT_HULL; } -"SimpleHull" { BUFFER; return SIMPLE_HULL; } -"ConvexHull" { BUFFER; return CONVEX_HULL; } -"DecoupledConvexHull" { BUFFER; return DECOUPLED_CONVEX_HULL; } -"AffineHull" { BUFFER; return AFFINE_HULL; } -"ConicHull" { BUFFER; return CONIC_HULL; } -"LinearHull" { BUFFER; return LINEAR_HULL; } -"PairwiseCheck" { /*deprecated*/ BUFFER; return PAIRWISE_CHECK; } -"ConvexCheck" { /*deprecated*/ BUFFER; return CONVEX_CHECK; } -"QuickHull" { /*deprecated*/ BUFFER; return QUICK_HULL; } -"Hull" { BUFFER; return HULL; } -"farkas" { BUFFER; return FARKAS; } -"decoupledfarkas" { BUFFER; return DECOUPLED_FARKAS; } -"decoupled-farkas" { BUFFER; return DECOUPLED_FARKAS; } -"decoupled_farkas" { BUFFER; return DECOUPLED_FARKAS; } - -"minimize" { BUFFER; return MINIMIZE; } -"maximize" { BUFFER; return MAXIMIZE; } -"minimize-range" { BUFFER; return MINIMIZE_RANGE; } -"maximize-range" { BUFFER; return MAXIMIZE_RANGE; } -"minimizerange" { BUFFER; return MINIMIZE_RANGE; } -"maximizerange" { BUFFER; return MAXIMIZE_RANGE; } -"minimize-domain" { BUFFER; return MINIMIZE_DOMAIN; } -"maximize-domain" { BUFFER; return MAXIMIZE_DOMAIN; } -"minimizedomain" { BUFFER; return MINIMIZE_DOMAIN; } -"maximizedomain" { BUFFER; return MAXIMIZE_DOMAIN; } -"gist" { BUFFER; return GIST; } -"given" { BUFFER; return GIVEN; } -"within" { BUFFER; return WITHIN; } -"subset" { BUFFER; return SUBSET; } -"codegen" { BUFFER; return CODEGEN; } -"upper_bound" { BUFFER; return MAKE_UPPER_BOUND; } -"lower_bound" { BUFFER; return MAKE_LOWER_BOUND; } -"supersetof" { BUFFER; return SUPERSETOF;} -"subsetof" { BUFFER; return SUBSETOF;} -"sym_example" { BUFFER; return SYM_SAMPLE;} -"example" { BUFFER; return SAMPLE;} -"carried_by" { BUFFER; return CARRIED_BY;} -"reachable" { BUFFER; return REACHABLE_FROM; } -"reachable of" { BUFFER; return REACHABLE_OF; } -"restrict_domain" { BUFFER; return RESTRICT_DOMAIN; } -"restrictDomain" { BUFFER; return RESTRICT_DOMAIN; } -"\\" { BUFFER; return RESTRICT_DOMAIN; } -"restrict_range" { BUFFER; return RESTRICT_RANGE; } -"restrictRange" { BUFFER; return RESTRICT_RANGE; } -"assertUnsatisfiable" { BUFFER; return ASSERT_UNSAT; } -"assert_unsatisfiable" { BUFFER; return ASSERT_UNSAT; } - -"/" { BUFFER; return RESTRICT_RANGE; } -"&" { BUFFER; return AND; } -"|" { BUFFER; return OR; } -"&&" { BUFFER; return AND; } -"||" { BUFFER; return OR; } -"and" { BUFFER; return AND; } -"or" { BUFFER; return OR; } -"\\land" { BUFFER; return AND; } -"\\lor" { BUFFER; return OR; } -"!" { BUFFER; return NOT; } -"not" { BUFFER; return NOT; } -"\\neg" { BUFFER; return NOT; } -":=" { BUFFER; return IS_ASSIGNED; } -"->" { BUFFER; return GOES_TO; } -"in" { BUFFER; return IN; } -"\\rightarrow" { BUFFER; return GOES_TO; } -"<=" { BUFFER; yylval.REL_OPERATOR = leq; return REL_OP; } -"\\leq" { BUFFER; yylval.REL_OPERATOR = leq; return REL_OP; } -"\\le" { BUFFER; yylval.REL_OPERATOR = leq; return REL_OP; } -">=" { BUFFER; yylval.REL_OPERATOR = geq; return REL_OP; } -"\\geq" { BUFFER; yylval.REL_OPERATOR = geq; return REL_OP; } -"\\ge" { BUFFER; yylval.REL_OPERATOR = geq; return REL_OP; } -"!=" { BUFFER; yylval.REL_OPERATOR = neq; return REL_OP; } -"\\neq" { BUFFER; yylval.REL_OPERATOR = neq; return REL_OP; } -"<" { BUFFER; yylval.REL_OPERATOR = lt; return REL_OP; } -">" { BUFFER; yylval.REL_OPERATOR = gt; return REL_OP; } -"=" { BUFFER; yylval.REL_OPERATOR = eq; return REL_OP; } -"==" { BUFFER; yylval.REL_OPERATOR = eq; return REL_OP; } - -[A-Za-z_][A-Za-z0-9_]*[\']* { - BUFFER; - yylval.VAR_NAME = new char[yyleng+1]; - strcpy(yylval.VAR_NAME,yytext); - return VAR; -} -[A-Za-z][A-Za-z0-9_]*"(In)" { - BUFFER; - yylval.VAR_NAME = new char[yyleng+1]; - strcpy(yylval.VAR_NAME,yytext); - yylval.VAR_NAME[yyleng-3] = 'i'; // lowercase - yylval.VAR_NAME[yyleng-2] = 'n'; - return VAR; -} -[A-Za-z][A-Za-z0-9_]*"(Set)" { - BUFFER; - yylval.VAR_NAME = new char[yyleng+1]; - strcpy(yylval.VAR_NAME,yytext); - yylval.VAR_NAME[yyleng-4] = 'i'; // Change to "in" - yylval.VAR_NAME[yyleng-3] = 'n'; // Be afraid - yylval.VAR_NAME[yyleng-2] = ')'; - yylval.VAR_NAME[yyleng-1] = '\0'; - return VAR; -} -[A-Za-z][A-Za-z0-9_]*"(Out)" { - BUFFER; - yylval.VAR_NAME = new char[yyleng+1]; - strcpy(yylval.VAR_NAME,yytext); - yylval.VAR_NAME[yyleng-4] = 'o'; // lowercase - yylval.VAR_NAME[yyleng-3] = 'u'; - yylval.VAR_NAME[yyleng-2] = 't'; - return VAR; -} -"\\"[A-Za-z][A-Za-z0-9_]* { - BUFFER; - yylval.VAR_NAME = new char[yyleng+1]; - strcpy(yylval.VAR_NAME,yytext); - return VAR; - } -"\\"[A-Za-z][A-Za-z0-9_]*"(In)" { - BUFFER; - yylval.VAR_NAME = new char[yyleng+1]; - strcpy(yylval.VAR_NAME,yytext); - yylval.VAR_NAME[yyleng-3] = 'i'; // lowercase - yylval.VAR_NAME[yyleng-2] = 'n'; - return VAR; - } -"\\"[A-Za-z][A-Za-z0-9_]*"(Set)" { - BUFFER; - yylval.VAR_NAME = new char[yyleng+1]; - strcpy(yylval.VAR_NAME,yytext); - yylval.VAR_NAME[yyleng-4] = 'i'; // Change to "in" - yylval.VAR_NAME[yyleng-3] = 'n'; // Be afraid - yylval.VAR_NAME[yyleng-2] = ')'; - yylval.VAR_NAME[yyleng-1] = '\0'; - return VAR; - } -"\\"[A-Za-z][A-Za-z0-9_]*"(Out)" { - BUFFER; - yylval.VAR_NAME = new char[yyleng+1]; - strcpy(yylval.VAR_NAME,yytext); - yylval.VAR_NAME[yyleng-4] = 'o'; // lowercase - yylval.VAR_NAME[yyleng-3] = 'u'; - yylval.VAR_NAME[yyleng-2] = 't'; - return VAR; - } - -[0-9]+ { BUFFER; - if (need_coef) { - sscanf(yytext, coef_fmt, &yylval.COEF_VALUE); - return COEF; - } - else { - yylval.INT_VALUE = atoi(yytext); - return INT; - } -} - -\"[^\"]*\" { BUFFER; - yytext[yyleng-1]='\0'; - yylval.STRING_VALUE = new std::string(yytext+1); - return STRING; -} - - -<> { - mylexer.yypop_buffer_state(); - if (!YY_CURRENT_BUFFER) { - flushScanBuffer(); - return YY_NULL; - } -} - -. { BUFFER; return yytext[0]; } - - -%% - -void flushScanBuffer() { - if (scanBuf.size() == 0) - return; - if (!is_interactive) { - size_t prev_pos = 0; - if (scanBuf[0] == '\n') - prev_pos = 1; - for (size_t pos = prev_pos; pos <= scanBuf.size(); pos++) { - if (pos == scanBuf.size() || scanBuf[pos] == '\n') { - std::cout << PROMPT_STRING << " " << scanBuf.substr(prev_pos, pos-prev_pos) << std::endl; - prev_pos = pos+1; - } - } - } - - scanBuf.clear(); -} diff --git a/omega/omega_calc/src/parser.y b/omega/omega_calc/src/parser.y deleted file mode 100644 index 7369b94..0000000 --- a/omega/omega_calc/src/parser.y +++ /dev/null @@ -1,1925 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 University of Maryland. - Copyright (C) 2008 University of Southern California. - Copyright (C) 2009-2010 University of Utah. - All Rights Reserved. - - Purpose: - omega calculator yacc parser. - - Notes: - - History: -*****************************************************************************/ - -%{ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef WIN32 -#include -#define isatty _isatty -#define alloca _alloca -#endif -#ifndef WIN32 -#include -#include -#endif -#if !defined(OMIT_GETRUSAGE) -#include -#include -#include -#endif - -#if !defined(OMIT_GETRUSAGE) -#ifdef __sparc__ -extern "C" int getrusage (int, struct rusage*); -#endif - -using namespace omega; - -struct rusage start_time; -bool anyTimingDone = false; - -void start_clock( void ) { - getrusage(RUSAGE_SELF, &start_time); -} - -int clock_diff( void ) { - struct rusage current_time; - getrusage(RUSAGE_SELF, ¤t_time); - return (current_time.ru_utime.tv_sec -start_time.ru_utime.tv_sec)*1000000 + (current_time.ru_utime.tv_usec-start_time.ru_utime.tv_usec); -} -#endif - -int omega_calc_debug = 0; - -bool is_interactive; -const char *PROMPT_STRING = ">>>"; -extern std::string err_msg; -extern FILE *yyin; -bool need_coef; - -Map relationMap ((Relation *)0); -namespace { - int redundant_conj_level = 2; // default maximum 2 - int redundant_constr_level = 4; // default maximum 4 -} - -int argCount = 0; -int tuplePos = 0; -Argument_Tuple currentTuple = Input_Tuple; - -Relation LexForward(int n); -reachable_information *reachable_info; - -int yylex(); -void yyerror(const std::string &s); -void flushScanBuffer(); - -%} - -%union { - int INT_VALUE; - coef_t COEF_VALUE; - Rel_Op REL_OPERATOR; - char *VAR_NAME; - VarList *VAR_LIST; - Exp *EXP; - ExpList *EXP_LIST; - AST *ASTP; - Argument_Tuple ARGUMENT_TUPLE; - AST_constraints *ASTCP; - Declaration_Site * DECLARATION_SITE; - Relation * RELATION; - tupleDescriptor * TUPLE_DESCRIPTOR; - RelTuplePair * REL_TUPLE_PAIR; - Dynamic_Array2 * RELATION_ARRAY_2D; - Dynamic_Array1 * RELATION_ARRAY_1D; - Tuple *STRING_TUPLE; - std::string *STRING_VALUE; -} - -%token VAR -%token INT -%token COEF -%token STRING -%token OPEN_BRACE CLOSE_BRACE -%token SYMBOLIC -%token OR AND NOT -%token ST APPROX -%token IS_ASSIGNED -%token FORALL EXISTS -%token DOMAIN RANGE -%token DIFFERENCE DIFFERENCE_TO_RELATION -%token GIST GIVEN HULL WITHIN MAXIMIZE MINIMIZE -%token AFFINE_HULL VENN CONVEX_COMBINATION POSITIVE_COMBINATION LINEAR_COMBINATION AFFINE_COMBINATION CONVEX_HULL CONIC_HULL LINEAR_HULL QUICK_HULL PAIRWISE_CHECK CONVEX_CHECK CONVEX_REPRESENTATION RECT_HULL DECOUPLED_CONVEX_HULL -%token MAXIMIZE_RANGE MINIMIZE_RANGE -%token MAXIMIZE_DOMAIN MINIMIZE_DOMAIN -%token LEQ GEQ NEQ -%token GOES_TO -%token COMPOSE JOIN INVERSE COMPLEMENT IN CARRIED_BY TIME TIMECLOSURE -%token UNION INTERSECTION -%token VERTICAL_BAR SUCH_THAT -%token SUBSET CODEGEN DECOUPLED_FARKAS FARKAS -%token MAKE_UPPER_BOUND MAKE_LOWER_BOUND -%token REL_OP -%token RESTRICT_DOMAIN RESTRICT_RANGE -%token SUPERSETOF SUBSETOF SAMPLE SYM_SAMPLE -%token PROJECT_AWAY_SYMBOLS PROJECT_ON_SYMBOLS REACHABLE_FROM REACHABLE_OF -%token ASSERT_UNSAT -%token PARSE_EXPRESSION PARSE_FORMULA PARSE_RELATION - -%type effort -%type exp simpleExp -%type expList -%type varList -%type argumentList -%type formula optionalFormula -%type constraintChain -%type tupleDeclaration -%type varDecl varDeclOptBrackets -%type relation builtRelation context -%type reachable_of -%type relPairList -%type reachable - -%destructor {delete []$$;} VAR -%destructor {delete $$;} STRING -%destructor {delete $$;} relation builtRelation tupleDeclaration formula optionalFormula context reachable_of constraintChain varDecl varDeclOptBrackets relPairList reachable -%destructor {delete $$;} varList exp simpleExp -%destructor { - foreach(e, Exp *, *$$, delete e); - delete $$; - } expList; - -%nonassoc ASSERT_UNSAT -%left UNION p1 '+' '-' -%nonassoc SUPERSETOF SUBSETOF -%left p2 RESTRICT_DOMAIN RESTRICT_RANGE -%left INTERSECTION p3 '*' '@' -%left p4 -%left OR p5 -%left AND p6 -%left COMPOSE JOIN CARRIED_BY -%right NOT APPROX DOMAIN RANGE HULL PROJECT_AWAY_SYMBOLS PROJECT_ON_SYMBOLS DIFFERENCE DIFFERENCE_TO_RELATION INVERSE COMPLEMENT FARKAS SAMPLE SYM_SAMPLE MAKE_UPPER_BOUND MAKE_LOWER_BOUND p7 -%left p8 -%nonassoc GIVEN -%left p9 -%left '(' p10 - -%% - -inputSequence : /*empty*/ - | inputSequence { assert( current_Declaration_Site == globalDecls);} - inputItem -; - -inputItem : ';' /*empty*/ - | error ';' { - flushScanBuffer(); - std::cout << err_msg; - err_msg.clear(); - current_Declaration_Site = globalDecls; - need_coef = false; - std::cout << "...skipping to statement end..." << std::endl; - delete relationDecl; - relationDecl = NULL; - } - | SYMBOLIC globVarList ';' {flushScanBuffer();} - | VAR IS_ASSIGNED relation ';' { - flushScanBuffer(); - try { - $3->simplify(redundant_conj_level, redundant_constr_level); - Relation *r = relationMap((Const_String)$1); - if (r) delete r; - relationMap[(Const_String)$1] = $3; - } - catch (const std::exception &e) { - std::cout << e.what() << std::endl; - } - delete []$1; - } - | relation ';' { - flushScanBuffer(); - $1->simplify(redundant_conj_level, redundant_constr_level); - $1->print_with_subs(stdout); - delete $1; - } - | TIME relation ';' { -#if defined(OMIT_GETRUSAGE) - printf("'time' requires getrusage, but the omega calclator was compiled with OMIT_GETRUSAGE set!\n"); -#else - flushScanBuffer(); - printf("\n"); - int t; - Relation R; - bool SKIP_FULL_CHECK = getenv("OC_TIMING_SKIP_FULL_CHECK"); - ($2)->and_with_GEQ(); - start_clock(); - for (t=1;t<=100;t++) { - R = *$2; - R.finalize(); - } - int copyTime = clock_diff(); - start_clock(); - for (t=1;t<=100;t++) { - R = *$2; - R.finalize(); - R.simplify(); /* default simplification effort */ - } - int simplifyTime = clock_diff() -copyTime; - Relation R2; - if (!SKIP_FULL_CHECK) { - start_clock(); - for (t=1;t<=100;t++) { - R2 = *$2; - R2.finalize(); - R2.simplify(2,4); /* maximal simplification effort */ - } - } - int excessiveTime = clock_diff() - copyTime; - printf("Times (in microseconds): \n"); - printf("%5d us to copy original set of constraints\n",copyTime/100); - printf("%5d us to do the default amount of simplification, obtaining: \n\t", simplifyTime/100); - R.print_with_subs(stdout); - printf("\n"); - if (!SKIP_FULL_CHECK) { - printf("%5d us to do the maximum (i.e., excessive) amount of simplification, obtaining: \n\t", excessiveTime/100); - R2.print_with_subs(stdout); - printf("\n"); - } - if (!anyTimingDone) { - bool warn = false; -#ifndef SPEED - warn =true; -#endif -#ifndef NDEBUG - warn = true; -#endif - if (warn) { - printf("WARNING: The Omega calculator was compiled with options that force\n"); - printf("it to perform additional consistency and error checks\n"); - printf("that may slow it down substantially\n"); - printf("\n"); - } - printf("NOTE: These times relect the time of the current _implementation_\n"); - printf("of our algorithms. Performance bugs do exist. If you intend to publish or \n"); - printf("report on the performance on the Omega test, we respectfully but strongly \n"); - printf("request that send your test cases to us to allow us to determine if the \n"); - printf("times are appropriate, and if the way you are using the Omega library to \n"); - printf("solve your problem is the most effective way.\n"); - printf("\n"); - - printf("Also, please be aware that over the past two years, we have focused our \n"); - printf("efforts on the expressive power of the Omega library, sometimes at the\n"); - printf("expensive of raw speed. Our original implementation of the Omega test\n"); - printf("was substantially faster on the limited domain it handled.\n"); - printf("\n"); - printf(" Thanks, \n"); - printf(" the Omega Team \n"); - } - anyTimingDone = true; - delete $2; -#endif - } - | TIMECLOSURE relation ';' { -#if defined(OMIT_GETRUSAGE) - printf("'timeclosure' requires getrusage, but the omega calclator was compiled with OMIT_GETRUSAGE set!\n"); -#else - flushScanBuffer(); - try { - int t; - Relation R; - ($2)->and_with_GEQ(); - start_clock(); - for (t=1;t<=100;t++) { - R = *$2; - R.finalize(); - } - int copyTime = clock_diff(); - start_clock(); - for (t=1;t<=100;t++) { - R = *$2; - R.finalize(); - R.simplify(); - } - int simplifyTime = clock_diff() -copyTime; - Relation Rclosed; - start_clock(); - for (t=1;t<=100;t++) { - Rclosed = *$2; - Rclosed.finalize(); - Rclosed = TransitiveClosure(Rclosed, 1,Relation::Null()); - } - int closureTime = clock_diff() - copyTime; - Relation R2; - start_clock(); - for (t=1;t<=100;t++) { - R2 = *$2; - R2.finalize(); - R2.simplify(2,4); - } - int excessiveTime = clock_diff() - copyTime; - printf("Times (in microseconds): \n"); - printf("%5d us to copy original set of constraints\n",copyTime/100); - printf("%5d us to do the default amount of simplification, obtaining: \n\t", simplifyTime/100); - R.print_with_subs(stdout); - printf("\n"); - printf("%5d us to do the maximum (i.e., excessive) amount of simplification, obtaining: \n\t", excessiveTime/100); - R2.print_with_subs(stdout); - printf("%5d us to do the transitive closure, obtaining: \n\t", closureTime/100); - Rclosed.print_with_subs(stdout); - printf("\n"); - if (!anyTimingDone) { - bool warn = false; -#ifndef SPEED - warn =true; -#endif -#ifndef NDEBUG - warn = true; -#endif - if (warn) { - printf("WARNING: The Omega calculator was compiled with options that force\n"); - printf("it to perform additional consistency and error checks\n"); - printf("that may slow it down substantially\n"); - printf("\n"); - } - printf("NOTE: These times relect the time of the current _implementation_\n"); - printf("of our algorithms. Performance bugs do exist. If you intend to publish or \n"); - printf("report on the performance on the Omega test, we respectfully but strongly \n"); - printf("request that send your test cases to us to allow us to determine if the \n"); - printf("times are appropriate, and if the way you are using the Omega library to \n"); - printf("solve your problem is the most effective way.\n"); - printf("\n"); - - printf("Also, please be aware that over the past two years, we have focused our \n"); - printf("efforts on the expressive power of the Omega library, sometimes at the\n"); - printf("expensive of raw speed. Our original implementation of the Omega test\n"); - printf("was substantially faster on the limited domain it handled.\n"); - printf("\n"); - printf(" Thanks, \n"); - printf(" the Omega Team \n"); - } - anyTimingDone = true; - } - catch (const std::exception &e) { - std::cout << e.what() << std::endl; - } - delete $2; -#endif - } - | relation SUBSET relation ';' { - flushScanBuffer(); - try { - if (Must_Be_Subset(copy(*$1), copy(*$3))) - std::cout << "True" << std::endl; - else if (Might_Be_Subset(copy(*$1), copy(*$3))) - std::cout << "Possible" << std::endl; - else - std::cout << "False" << std::endl; - } - catch (const std::exception &e) { - std::cout << e.what() << std::endl; - } - delete $1; - delete $3; - } - | CODEGEN effort relPairList context';' { - flushScanBuffer(); - try { - std::string s = MMGenerateCode($3->mappings, $3->ispaces,*$4,$2); - std::cout << s << std::endl; - } - catch (const std::exception &e) { - std::cout << e.what() << std::endl; - } - delete $4; - delete $3; - } - | reachable ';' { - flushScanBuffer(); - Dynamic_Array1 &final = *$1; - bool any_sat = false; - int i,n_nodes = reachable_info->node_names.size(); - for(i = 1; i <= n_nodes; i++) - if(final[i].is_upper_bound_satisfiable()) { - any_sat = true; - std::cout << "Node %s: " << reachable_info->node_names[i]; - final[i].print_with_subs(stdout); - } - if(!any_sat) - std::cout << "No nodes reachable.\n"; - delete $1; - delete reachable_info; - } -; - - -effort : {$$ = 1;} - | INT {$$ = $1;} - | '-' INT {$$ = -$2;} -; - -context : {$$ = new Relation(); *$$ = Relation::Null();} - | GIVEN relation {$$ = $2; } -; - -relPairList : relPairList ',' relation ':' relation { - try { - $1->mappings.append(*$3); - $1->mappings[$1->mappings.size()].compress(); - $1->ispaces.append(*$5); - $1->ispaces[$1->ispaces.size()].compress(); - } - catch (const std::exception &e) { - delete $1; - delete $3; - delete $5; - yyerror(e.what()); - YYERROR; - } - delete $3; - delete $5; - $$ = $1; - } - | relPairList ',' relation { - try { - $1->mappings.append(Identity($3->n_set())); - $1->mappings[$1->mappings.size()].compress(); - $1->ispaces.append(*$3); - $1->ispaces[$1->ispaces.size()].compress(); - } - catch (const std::exception &e) { - delete $1; - delete $3; - yyerror(e.what()); - YYERROR; - } - delete $3; - $$ = $1; - } - | relation ':' relation { - RelTuplePair *rtp = new RelTuplePair; - try { - rtp->mappings.append(*$1); - rtp->mappings[rtp->mappings.size()].compress(); - rtp->ispaces.append(*$3); - rtp->ispaces[rtp->ispaces.size()].compress(); - } - catch (const std::exception &e) { - delete rtp; - delete $1; - delete $3; - yyerror(e.what()); - YYERROR; - } - delete $1; - delete $3; - $$ = rtp; - } - | relation { - RelTuplePair *rtp = new RelTuplePair; - try { - rtp->mappings.append(Identity($1->n_set())); - rtp->mappings[rtp->mappings.size()].compress(); - rtp->ispaces.append(*$1); - rtp->ispaces[rtp->ispaces.size()].compress(); - } - catch (const std::exception &e) { - delete rtp; - delete $1; - yyerror(e.what()); - YYERROR; - } - delete $1; - $$ = rtp; - } -; - -relation : OPEN_BRACE {need_coef = true; relationDecl = new Declaration_Site();} - builtRelation CLOSE_BRACE { - need_coef = false; - $$ = $3; - if (omega_calc_debug) { - fprintf(DebugFile,"Built relation:\n"); - $$->prefix_print(DebugFile); - } - current_Declaration_Site = globalDecls; - delete relationDecl; - relationDecl = NULL; - } - | VAR { - Const_String s = $1; - Relation *r = relationMap(s); - if (r == NULL) { - yyerror(std::string("relation ") + to_string($1) + std::string(" not declared")); - delete []$1; - YYERROR; - } - $$ = new Relation(*r); - delete []$1; - } - | '(' relation ')' {$$ = $2;} - | relation '+' %prec p9 { - $$ = new Relation(); - try { - *$$ = TransitiveClosure(*$1, 1, Relation::Null()); - } - catch (const std::exception &e) { - delete $$; - delete $1; - yyerror(e.what()); - YYERROR; - } - delete $1; - } - | relation '*' %prec p9 { - $$ = new Relation(); - try { - int vars = $1->n_inp(); - *$$ = Union(Identity(vars), TransitiveClosure(*$1, 1, Relation::Null())); - } - catch (const std::exception &e) { - delete $$; - delete $1; - yyerror(e.what()); - YYERROR; - } - delete $1; - } - | relation '+' WITHIN relation %prec p9 { - $$ = new Relation(); - try { - *$$= TransitiveClosure(*$1, 1, *$4); - } - catch (const std::exception &e) { - delete $$; - delete $1; - delete $4; - yyerror(e.what()); - YYERROR; - } - delete $1; - delete $4; - } - | relation '^' '@' %prec p8 { - $$ = new Relation(); - try { - *$$ = ApproxClosure(*$1); - } - catch (const std::exception &e) { - delete $$; - delete $1; - yyerror(e.what()); - YYERROR; - } - delete $1; - } - | relation '^' '+' %prec p8 { - $$ = new Relation(); - try { - *$$ = calculateTransitiveClosure(*$1); - } - catch (const std::exception &e) { - delete $$; - delete $1; - yyerror(e.what()); - YYERROR; - } - delete $1; - } - | MINIMIZE_RANGE relation %prec p8 { - $$ = new Relation(); - try { - Relation o(*$2); - Relation r(*$2); - r = Join(r,LexForward($2->n_out())); - *$$ = Difference(o,r); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | MAXIMIZE_RANGE relation %prec p8 { - $$ = new Relation(); - try { - Relation o(*$2); - Relation r(*$2); - r = Join(r,Inverse(LexForward($2->n_out()))); - *$$ = Difference(o,r); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | MINIMIZE_DOMAIN relation %prec p8 { - $$ = new Relation(); - try { - Relation o(*$2); - Relation r(*$2); - r = Join(LexForward($2->n_inp()),r); - *$$ = Difference(o,r); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | MAXIMIZE_DOMAIN relation %prec p8 { - $$ = new Relation(); - try { - Relation o(*$2); - Relation r(*$2); - r = Join(Inverse(LexForward($2->n_inp())),r); - *$$ = Difference(o,r); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | MAXIMIZE relation %prec p8 { - $$ = new Relation(); - try { - Relation c(*$2); - Relation r(*$2); - *$$ = Cross_Product(Relation(*$2),c); - *$$ = Difference(r,Domain(Intersection(*$$,LexForward($$->n_inp())))); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | MINIMIZE relation %prec p8 { - $$ = new Relation(); - try { - Relation c(*$2); - Relation r(*$2); - *$$ = Cross_Product(Relation(*$2),c); - *$$ = Difference(r,Range(Intersection(*$$,LexForward($$->n_inp())))); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | FARKAS relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Farkas(*$2, Basic_Farkas); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | DECOUPLED_FARKAS relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Farkas(*$2, Decoupled_Farkas); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | relation '@' %prec p9 { - $$ = new Relation(); - try { - *$$ = ConicClosure(*$1); - } - catch (const std::exception &e) { - delete $$; - delete $1; - yyerror(e.what()); - YYERROR; - } - delete $1; - } - | PROJECT_AWAY_SYMBOLS relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Project_Sym(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | PROJECT_ON_SYMBOLS relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Project_On_Sym(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | DIFFERENCE relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Deltas(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | DIFFERENCE_TO_RELATION relation %prec p8 { - $$ = new Relation(); - try { - *$$ = DeltasToRelation(*$2,$2->n_set(),$2->n_set()); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | DOMAIN relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Domain(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | VENN relation %prec p8 { - $$ = new Relation(); - try { - *$$ = VennDiagramForm(*$2,Relation::True(*$2)); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | VENN relation GIVEN relation %prec p8 { - $$ = new Relation(); - try { - *$$ = VennDiagramForm(*$2,*$4); - } - catch (const std::exception &e) { - delete $$; - delete $2; - delete $4; - yyerror(e.what()); - YYERROR; - } - delete $2; - delete $4; - } - | CONVEX_HULL relation %prec p8 { - $$ = new Relation(); - try { - *$$ = ConvexHull(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | DECOUPLED_CONVEX_HULL relation %prec p8 { - $$ = new Relation(); - try { - *$$ = DecoupledConvexHull(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | POSITIVE_COMBINATION relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Farkas(*$2,Positive_Combination_Farkas); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | LINEAR_COMBINATION relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Farkas(*$2,Linear_Combination_Farkas); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | AFFINE_COMBINATION relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Farkas(*$2,Affine_Combination_Farkas); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | CONVEX_COMBINATION relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Farkas(*$2,Convex_Combination_Farkas); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | PAIRWISE_CHECK relation %prec p8 { - $$ = new Relation(); - try { - *$$ = CheckForConvexRepresentation(CheckForConvexPairs(*$2)); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | CONVEX_CHECK relation %prec p8 { - $$ = new Relation(); - try { - *$$ = CheckForConvexRepresentation(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | CONVEX_REPRESENTATION relation %prec p8 { - $$ = new Relation(); - try { - *$$ = ConvexRepresentation(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | AFFINE_HULL relation %prec p8 { - $$ = new Relation(); - try { - *$$ = AffineHull(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | CONIC_HULL relation %prec p8 { - $$ = new Relation(); - try { - *$$ = ConicHull(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | LINEAR_HULL relation %prec p8 { - $$ = new Relation(); - try { - *$$ = LinearHull(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | QUICK_HULL relation %prec p8 { - $$ = new Relation(); - try { - *$$ = QuickHull(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | RECT_HULL relation %prec p8 { - $$ = new Relation(); - try { - *$$ = RectHull(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | HULL relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Hull(*$2,false,1,Relation::Null()); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | HULL relation GIVEN relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Hull(*$2,false,1,*$4); - } - catch (const std::exception &e) { - delete $$; - delete $2; - delete $4; - yyerror(e.what()); - YYERROR; - } - delete $2; - delete $4; - } - | APPROX relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Approximate(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | RANGE relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Range(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | INVERSE relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Inverse(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | COMPLEMENT relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Complement(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | GIST relation GIVEN relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Gist(*$2,*$4,1); - } - catch (const std::exception &e) { - delete $$; - delete $2; - delete $4; - yyerror(e.what()); - YYERROR; - } - delete $2; - delete $4; - } - | relation '(' relation ')' { - $$ = new Relation(); - try { - *$$ = Composition(*$1,*$3); - } - catch (const std::exception &e) { - delete $$; - delete $1; - delete $3; - yyerror(e.what()); - YYERROR; - } - delete $1; - delete $3; - } - | relation COMPOSE relation { - $$ = new Relation(); - try { - *$$ = Composition(*$1,*$3); - } - catch (const std::exception &e) { - delete $$; - delete $1; - delete $3; - yyerror(e.what()); - YYERROR; - } - delete $1; - delete $3; - } - | relation CARRIED_BY INT { - $$ = new Relation(); - try { - *$$ = After(*$1,$3,$3); - (*$$).prefix_print(stdout); - } - catch (const std::exception &e) { - delete $$; - delete $1; - yyerror(e.what()); - YYERROR; - } - delete $1; - } - | relation JOIN relation { - $$ = new Relation(); - try { - *$$ = Composition(*$3,*$1); - } - catch (const std::exception &e) { - delete $$; - delete $1; - delete $3; - yyerror(e.what()); - YYERROR; - } - delete $1; - delete $3; - } - | relation RESTRICT_RANGE relation { - $$ = new Relation(); - try { - *$$ = Restrict_Range(*$1,*$3); - } - catch (const std::exception &e) { - delete $$; - delete $1; - delete $3; - yyerror(e.what()); - YYERROR; - } - delete $1; - delete $3; - } - | relation RESTRICT_DOMAIN relation { - $$ = new Relation(); - try { - *$$ = Restrict_Domain(*$1,*$3); - } - catch (const std::exception &e) { - delete $$; - delete $1; - delete $3; - yyerror(e.what()); - YYERROR; - } - delete $1; - delete $3; - } - | relation INTERSECTION relation { - $$ = new Relation(); - try { - *$$ = Intersection(*$1,*$3); - } - catch (const std::exception &e) { - delete $$; - delete $1; - delete $3; - yyerror(e.what()); - YYERROR; - } - delete $1; - delete $3; - } - | relation '-' relation %prec INTERSECTION { - $$ = new Relation(); - try { - *$$ = Difference(*$1,*$3); - } - catch (const std::exception &e) { - delete $$; - delete $1; - delete $3; - yyerror(e.what()); - YYERROR; - } - delete $1; - delete $3; - } - | relation UNION relation { - $$ = new Relation(); - try { - *$$ = Union(*$1,*$3); - } - catch (const std::exception &e) { - delete $$; - delete $1; - delete $3; - yyerror(e.what()); - YYERROR; - } - delete $1; - delete $3; - } - | relation '*' relation { - $$ = new Relation(); - try { - *$$ = Cross_Product(*$1,*$3); - } - catch (const std::exception &e) { - delete $$; - delete $1; - delete $3; - yyerror(e.what()); - YYERROR; - } - delete $1; - delete $3; - } - | SUPERSETOF relation { - $$ = new Relation(); - try { - *$$ = Union(*$2, Relation::Unknown(*$2)); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | SUBSETOF relation { - $$ = new Relation(); - try { - *$$ = Intersection(*$2, Relation::Unknown(*$2)); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | MAKE_UPPER_BOUND relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Upper_Bound(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | MAKE_LOWER_BOUND relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Lower_Bound(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | SAMPLE relation { - $$ = new Relation(); - try { - *$$ = Sample_Solution(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | SYM_SAMPLE relation { - $$ = new Relation(); - try { - *$$ = Symbolic_Solution(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | reachable_of { $$ = $1; } - | ASSERT_UNSAT relation { - if (($2)->is_satisfiable()) { - fprintf(stderr,"assert_unsatisfiable failed on "); - ($2)->print_with_subs(stderr); - exit(1); - } - $$=$2; - } -; - -builtRelation : tupleDeclaration GOES_TO {currentTuple = Output_Tuple;} - tupleDeclaration {currentTuple = Input_Tuple;} optionalFormula { - Relation * r = new Relation($1->size,$4->size); - resetGlobals(); - F_And *f = r->add_and(); - for(int i=1;i<=$1->size;i++) { - $1->vars[i]->vid = r->input_var(i); - if (!$1->vars[i]->anonymous) - r->name_input_var(i,$1->vars[i]->stripped_name); - } - for(int i=1;i<=$4->size;i++) { - $4->vars[i]->vid = r->output_var(i); - if (!$4->vars[i]->anonymous) - r->name_output_var(i,$4->vars[i]->stripped_name); - } - r->setup_names(); - foreach(e,Exp*,$1->eq_constraints, install_eq(f,e,0)); - foreach(e,Exp*,$1->geq_constraints, install_geq(f,e,0)); - foreach(c,strideConstraint*,$1->stride_constraints, install_stride(f,c)); - foreach(e,Exp*,$4->eq_constraints, install_eq(f,e,0)); - foreach(e,Exp*,$4->geq_constraints, install_geq(f,e,0)); - foreach(c,strideConstraint*,$4->stride_constraints, install_stride(f,c)); - if ($6) $6->install(f); - delete $1; - delete $4; - delete $6; - $$ = r; - } - | tupleDeclaration optionalFormula { - Relation * r = new Relation($1->size); - resetGlobals(); - F_And *f = r->add_and(); - for(int i=1;i<=$1->size;i++) { - $1->vars[i]->vid = r->set_var(i); - if (!$1->vars[i]->anonymous) - r->name_set_var(i,$1->vars[i]->stripped_name); - } - r->setup_names(); - foreach(e,Exp*,$1->eq_constraints, install_eq(f,e,0)); - foreach(e,Exp*,$1->geq_constraints, install_geq(f,e,0)); - foreach(c,strideConstraint*,$1->stride_constraints, install_stride(f,c)); - if ($2) $2->install(f); - delete $1; - delete $2; - $$ = r; - } - | formula { - Relation * r = new Relation(0,0); - F_And *f = r->add_and(); - $1->install(f); - delete $1; - $$ = r; - } -; - -optionalFormula : formula_sep formula {$$ = $2;} - | {$$ = 0;} -; - -formula_sep : ':' - | VERTICAL_BAR - | SUCH_THAT -; - -tupleDeclaration : {currentTupleDescriptor = new tupleDescriptor; tuplePos = 1;} - '[' optionalTupleVarList ']' - {$$ = currentTupleDescriptor; tuplePos = 0;} -; - -optionalTupleVarList : /* empty */ - | tupleVar - | optionalTupleVarList ',' tupleVar -; - -tupleVar : VAR %prec p10 { - Declaration_Site *ds = defined($1); - if (!ds) - currentTupleDescriptor->extend($1,currentTuple,tuplePos); - else { - Variable_Ref *v = lookupScalar($1); - if (v == NULL) { - yyerror(std::string("cannot find declaration for variable ") + to_string($1)); - delete []$1; - YYERROR; - } - if (ds != globalDecls) - currentTupleDescriptor->extend($1, new Exp(v)); - else - currentTupleDescriptor->extend(new Exp(v)); - } - tuplePos++; - delete []$1; - } - | '*' {currentTupleDescriptor->extend(); tuplePos++;} - | exp %prec p1 { - currentTupleDescriptor->extend($1); - tuplePos++; - } - | exp ':' exp %prec p1 { - currentTupleDescriptor->extend($1,$3); - tuplePos++; - } - | exp ':' exp ':' COEF %prec p1 { - currentTupleDescriptor->extend($1,$3,$5); - tuplePos++; - } -; - -varList : varList ',' VAR {$$ = $1; $$->insert($3); $3 = NULL;} - | VAR {$$ = new VarList; $$->insert($1); $1 = NULL;} -; - -varDecl : varList { - $$ = current_Declaration_Site = new Declaration_Site($1); - foreach(s,char *, *$1, delete []s); - delete $1; - } -; - -varDeclOptBrackets : varDecl {$$ = $1;} - |'[' varDecl ']' {$$ = $2;} -; - -globVarList : globVarList ',' globVar - | globVar -; - -globVar : VAR '(' INT ')' {globalDecls->extend_both_tuples($1, $3); delete []$1;} - | VAR { - globalDecls->extend($1); - delete []$1; - } -; - -formula : formula AND formula {$$ = new AST_And($1,$3);} - | formula OR formula {$$ = new AST_Or($1,$3);} - | constraintChain {$$ = $1;} - | '(' formula ')' {$$ = $2;} - | NOT formula {$$ = new AST_Not($2);} - | start_exists varDeclOptBrackets exists_sep formula end_quant {$$ = new AST_exists($2,$4);} - | start_forall varDeclOptBrackets forall_sep formula end_quant {$$ = new AST_forall($2,$4);} -; - -start_exists : '(' EXISTS - | EXISTS '(' -; - -exists_sep : ':' - | VERTICAL_BAR - | SUCH_THAT -; - -start_forall : '(' FORALL - | FORALL '(' -; - -forall_sep : ':' -; - -end_quant : ')' {popScope();} -; - -expList : exp ',' expList {$$ = $3; $$->insert($1);} - | exp {$$ = new ExpList; $$->insert($1);} -; - -constraintChain : expList REL_OP expList {$$ = new AST_constraints($1,$2,$3);} - | expList REL_OP constraintChain {$$ = new AST_constraints($1,$2,$3);} -; - -simpleExp : VAR %prec p9 { - Variable_Ref *v = lookupScalar($1); - if (v == NULL) { - yyerror(std::string("cannot find declaration for variable ") + to_string($1)); - delete []$1; - YYERROR; - } - $$ = new Exp(v); - delete []$1; - } - | VAR '(' {argCount = 1;} argumentList ')' %prec p9 { - Variable_Ref *v; - if ($4 == Input_Tuple) - v = functionOfInput[$1]; - else - v = functionOfOutput[$1]; - if (v == NULL) { - yyerror(std::string("Function ") + to_string($1) + std::string(" not declared")); - delete []$1; - YYERROR; - } - $$ = new Exp(v); - delete []$1; - } - | '(' exp ')' { $$ = $2; } -; - -argumentList : argumentList ',' VAR { - Variable_Ref *v = lookupScalar($3); - if (v == NULL) { - yyerror(std::string("cannot find declaration for variable ") + to_string($1)); - delete []$3; - YYERROR; - } - if (v->pos != argCount || v->of != $1 || (v->of != Input_Tuple && v->of != Output_Tuple)) { - yyerror("arguments to function must be prefix of input or output tuple"); - delete []$3; - YYERROR; - } - $$ = v->of; - argCount++; - delete []$3; - } - | VAR { - Variable_Ref *v = lookupScalar($1); - if (v == NULL) { - yyerror(std::string("cannot find declaration for variable ") + to_string($1)); - delete []$1; - YYERROR; - } - if (v->pos != argCount || (v->of != Input_Tuple && v->of != Output_Tuple)) { - yyerror("arguments to function must be prefix of input or output tuple"); - delete []$1; - YYERROR; - } - $$ = v->of; - argCount++; - delete []$1; - } -; - -exp : COEF {$$ = new Exp($1);} - | COEF simpleExp %prec '*' {$$ = multiply($1,$2);} - | simpleExp {$$ = $1; } - | '-' exp %prec '*' {$$ = negate($2);} - | exp '+' exp {$$ = add($1,$3);} - | exp '-' exp {$$ = subtract($1,$3);} - | exp '*' exp {$$ = multiply($1,$3);} -; - - -reachable : REACHABLE_FROM nodeNameList nodeSpecificationList { - Dynamic_Array1 *final = Reachable_Nodes(reachable_info); - $$ = final; - } -; - -reachable_of : REACHABLE_OF VAR IN nodeNameList nodeSpecificationList { - Dynamic_Array1 *final = Reachable_Nodes(reachable_info); - int index = reachable_info->node_names.index(std::string($2)); - if (index == 0) { - yyerror(std::string("no such node ") + to_string($2)); - delete []$2; - delete final; - delete reachable_info; - YYERROR; - } - $$ = new Relation; - *$$ = (*final)[index]; - delete final; - delete reachable_info; - delete []$2; - } -; - -nodeNameList : '(' realNodeNameList ')' { - int sz = reachable_info->node_names.size(); - reachable_info->node_arity.reallocate(sz); - reachable_info->transitions.resize(sz+1,sz+1); - reachable_info->start_nodes.resize(sz+1); - } -; - -realNodeNameList : realNodeNameList ',' VAR { - reachable_info->node_names.append(std::string($3)); - delete []$3; - } - | VAR { - reachable_info = new reachable_information; - reachable_info->node_names.append(std::string($1)); - delete []$1; - } -; - - -nodeSpecificationList : OPEN_BRACE realNodeSpecificationList CLOSE_BRACE { - int i,j; - int n_nodes = reachable_info->node_names.size(); - Tuple &arity = reachable_info->node_arity; - Dynamic_Array2 &transitions = reachable_info->transitions; - - /* fixup unspecified transitions to be false */ - /* find arity */ - for(i = 1; i <= n_nodes; i++) arity[i] = -1; - for(i = 1; i <= n_nodes; i++) - for(j = 1; j <= n_nodes; j++) - if(! transitions[i][j].is_null()) { - int in_arity = transitions[i][j].n_inp(); - int out_arity = transitions[i][j].n_out(); - if(arity[i] < 0) arity[i] = in_arity; - if(arity[j] < 0) arity[j] = out_arity; - if(in_arity != arity[i] || out_arity != arity[j]) { - yyerror(std::string("arity mismatch in node transition: ") + to_string(reachable_info->node_names[i]) + std::string(" -> ") + to_string(reachable_info->node_names[j])); - delete reachable_info; - YYERROR; - } - } - for(i = 1; i <= n_nodes; i++) - if(arity[i] < 0) arity[i] = 0; - /* Fill in false relations */ - for(i = 1; i <= n_nodes; i++) - for(j = 1; j <= n_nodes; j++) - if(transitions[i][j].is_null()) - transitions[i][j] = Relation::False(arity[i],arity[j]); - - /* fixup unused start node positions */ - Dynamic_Array1 &nodes = reachable_info->start_nodes; - for(i = 1; i <= n_nodes; i++) - if(nodes[i].is_null()) - nodes[i] = Relation::False(arity[i]); - else - if(nodes[i].n_set() != arity[i]){ - yyerror(std::string("arity mismatch in start node ") + to_string(reachable_info->node_names[i])); - delete reachable_info; - YYERROR; - } - } -; - -realNodeSpecificationList : realNodeSpecificationList ',' VAR ':' relation { - int n_nodes = reachable_info->node_names.size(); - int index = reachable_info->node_names.index($3); - if (!(index > 0 && index <= n_nodes)) { - yyerror(std::string("no such node ")+to_string($3)); - delete $5; - delete []$3; - delete reachable_info; - YYERROR; - } - reachable_info->start_nodes[index] = *$5; - delete $5; - delete []$3; - } - | realNodeSpecificationList ',' VAR GOES_TO VAR ':' relation { - int n_nodes = reachable_info->node_names.size(); - int from_index = reachable_info->node_names.index($3); - if (!(from_index > 0 && from_index <= n_nodes)) { - yyerror(std::string("no such node ")+to_string($3)); - delete $7; - delete []$3; - delete []$5; - delete reachable_info; - YYERROR; - } - int to_index = reachable_info->node_names.index($5); - if (!(to_index > 0 && to_index <= n_nodes)) { - yyerror(std::string("no such node ")+to_string($5)); - delete $7; - delete []$3; - delete []$5; - delete reachable_info; - YYERROR; - } - reachable_info->transitions[from_index][to_index] = *$7; - delete $7; - delete []$3; - delete []$5; - } - | VAR GOES_TO VAR ':' relation { - int n_nodes = reachable_info->node_names.size(); - int from_index = reachable_info->node_names.index($1); - if (!(from_index > 0 && from_index <= n_nodes)) { - yyerror(std::string("no such node ")+to_string($1)); - delete $5; - delete []$1; - delete []$3; - delete reachable_info; - YYERROR; - } - int to_index = reachable_info->node_names.index($3); - if (!(to_index > 0 && to_index <= n_nodes)) { - yyerror(std::string("no such node ")+to_string($3)); - delete $5; - delete []$1; - delete []$3; - delete reachable_info; - YYERROR; - } - reachable_info->transitions[from_index][to_index] = *$5; - delete $5; - delete []$1; - delete []$3; - } - | VAR ':' relation { - int n_nodes = reachable_info->node_names.size(); - int index = reachable_info->node_names.index($1); - if (!(index > 0 && index <= n_nodes)) { - yyerror(std::string("no such node ")+to_string($1)); - delete $3; - delete []$1; - delete reachable_info; - YYERROR; - } - reachable_info->start_nodes[index] = *$3; - delete $3; - delete []$1; - } -; - -%% - - -void printUsage(FILE *outf, char **argv) { - fprintf(outf, "usage: %s {-R} {-D[facility][level]...} infile\n -R means skip redundant conjunct elimination\n -D sets debugging level as follows:\n a = all debugging flags\n g = code generation\n l = calculator\n c = omega core\n p = presburger functions\n r = relational operators\n t = transitive closure\n", argv[0]); -} - - -bool process_calc_debugging_flags(char *arg,int &j) { - char debug_type; - while((debug_type=arg[j]) != 0) { - j++; - int level; - if(isdigit(arg[j])) - level = (arg[j++]) - '0'; - else - if(arg[j] == 0 || isalpha(arg[j])) - level = 1; - else - return false; - if (level < 0 || level > 4) { - fprintf(stderr,"Debug level %c out of range: %d\n", debug_type, level); - return false; - } - switch(debug_type) { - case 'a': - omega_core_debug = relation_debug = hull_debug = - closure_presburger_debug = - farkas_debug = - pres_debug = omega_calc_debug = code_gen_debug = level; - break; - case 'g': - code_gen_debug = level; break; - case 'f': - farkas_debug = level; break; - case 'h': - hull_debug = level; break; - case 'c': - omega_core_debug = level; break; - case 'r': - relation_debug = level; break; - case 'p': - pres_debug = level; break; - case 't': - closure_presburger_debug = level; break; - case 'l': - omega_calc_debug = level; break; -#if defined STUDY_EVACUATIONS - case 'e': - evac_debug = level; break; -#endif - default: - fprintf(stderr, "Unknown debug type %c\n", debug_type); - return false; - } - } - return true; -} - - -int main(int argc, char **argv) { -#if YYDEBUG != 0 - yydebug = 1; -#endif - - /* process flags */ - char *fileName = 0; - for(int i=1; iadd_and(); - for(int j=1;jadd_EQ(); - e.update_coef(r.input_var(j),-1); - e.update_coef(r.output_var(j),1); - e.finalize(); - } - GEQ_Handle e = g->add_GEQ(); - e.update_coef(r.input_var(i),-1); - e.update_coef(r.output_var(i),1); - e.update_const(-1); - e.finalize(); - } - r.finalize(); - return r; -} diff --git a/omega/omega_calc/src/parser.yy b/omega/omega_calc/src/parser.yy deleted file mode 100755 index cad6e8e..0000000 --- a/omega/omega_calc/src/parser.yy +++ /dev/null @@ -1,1928 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 the Omega Project Team - Copyright (C) 2005-2011 Chun Chen - All Rights Reserved. - - Purpose: - yacc parser for calculator. - - Notes: - - History: - 02/04/11 work with flex c++ mode, Chun Chen -*****************************************************************************/ - -%{ -//#define YYDEBUG 1 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "parser.tab.hh" -#include -//#include - -#if defined __USE_POSIX -#include -#elif defined __WIN32 -#include -#endif - - -#ifndef WIN32 -#include -#include -#endif -#if !defined(OMIT_GETRUSAGE) -#include -#include -#include -#endif - -#if !defined(OMIT_GETRUSAGE) -#ifdef __sparc__ -extern "C" int getrusage (int, struct rusage*); -#endif - - - - -struct rusage start_time; -bool anyTimingDone = false; - -void start_clock( void ) { - getrusage(RUSAGE_SELF, &start_time); -} - -int clock_diff( void ) { - struct rusage current_time; - getrusage(RUSAGE_SELF, ¤t_time); - return (current_time.ru_utime.tv_sec -start_time.ru_utime.tv_sec)*1000000 + (current_time.ru_utime.tv_usec-start_time.ru_utime.tv_usec); -} -#endif - - -#ifdef BUILD_CODEGEN -#include -#endif - -extern myFlexLexer mylexer; -#define yylex mylexer.yylex - - - - -int omega_calc_debug = 0; - -extern bool is_interactive; -extern const char *PROMPT_STRING; -bool simplify = true; -using namespace omega; - -extern std::string err_msg; - -bool need_coef; - -namespace { - int redundant_conj_level = 2; // default maximum 2 - int redundant_constr_level = 4; // default maximum 4 -} - -std::map relationMap; -int argCount = 0; -int tuplePos = 0; -Argument_Tuple currentTuple = Input_Tuple; - -Relation LexForward(int n); -reachable_information *reachable_info; - -void yyerror(const std::string &s); -void flushScanBuffer(); - -%} - -%union { - int INT_VALUE; - omega::coef_t COEF_VALUE; - Rel_Op REL_OPERATOR; - char *VAR_NAME; - std::set *VAR_LIST; - Exp *EXP; - std::set *EXP_LIST; - AST *ASTP; - omega::Argument_Tuple ARGUMENT_TUPLE; - AST_constraints *ASTCP; - Declaration_Site *DECLARATION_SITE; - omega::Relation *RELATION; - tupleDescriptor *TUPLE_DESCRIPTOR; - std::pair, std::vector > *REL_TUPLE_PAIR; - omega::Dynamic_Array1 * RELATION_ARRAY_1D; - std::string *STRING_VALUE; -} - -%token VAR -%token INT -%token COEF -%token STRING -%token OPEN_BRACE CLOSE_BRACE -%token SYMBOLIC NO_SIMPLIFY -%token OR AND NOT -%token ST APPROX -%token IS_ASSIGNED -%token FORALL EXISTS -%token DOMAIN RANGE -%token DIFFERENCE DIFFERENCE_TO_RELATION -%token GIST GIVEN HULL WITHIN MAXIMIZE MINIMIZE -%token AFFINE_HULL VENN CONVEX_COMBINATION POSITIVE_COMBINATION LINEAR_COMBINATION AFFINE_COMBINATION CONVEX_HULL CONIC_HULL LINEAR_HULL QUICK_HULL PAIRWISE_CHECK CONVEX_CHECK CONVEX_REPRESENTATION RECT_HULL SIMPLE_HULL DECOUPLED_CONVEX_HULL -%token MAXIMIZE_RANGE MINIMIZE_RANGE -%token MAXIMIZE_DOMAIN MINIMIZE_DOMAIN -%token LEQ GEQ NEQ -%token GOES_TO -%token COMPOSE JOIN INVERSE COMPLEMENT IN CARRIED_BY TIME TIMECLOSURE -%token UNION INTERSECTION -%token VERTICAL_BAR SUCH_THAT -%token SUBSET CODEGEN DECOUPLED_FARKAS FARKAS -%token MAKE_UPPER_BOUND MAKE_LOWER_BOUND -%token REL_OP -%token RESTRICT_DOMAIN RESTRICT_RANGE -%token SUPERSETOF SUBSETOF SAMPLE SYM_SAMPLE -%token PROJECT_AWAY_SYMBOLS PROJECT_ON_SYMBOLS REACHABLE_FROM REACHABLE_OF -%token ASSERT_UNSAT -%token PARSE_EXPRESSION PARSE_FORMULA PARSE_RELATION - -%type exp simpleExp -%type expList -%type varList -%type argumentList -%type formula optionalFormula -%type constraintChain -%type tupleDeclaration -%type varDecl varDeclOptBrackets -%type relation builtRelation context -%type reachable_of -%type relPairList -%type reachable - -%destructor {delete []$$;} VAR -%destructor {delete $$;} STRING -%destructor {delete $$;} relation builtRelation tupleDeclaration formula optionalFormula context reachable_of constraintChain varDecl varDeclOptBrackets relPairList reachable -%destructor {delete $$;} exp simpleExp -%destructor { - for (std::set::iterator i = $$->begin(); i != $$->end(); i++) - delete *i; - delete $$; - } expList; -%destructor { - for (std::set::iterator i = $$->begin(); i != $$->end(); i++) - delete []*i; - delete $$; - } varList; - -%nonassoc ASSERT_UNSAT -%left UNION p1 '+' '-' -%nonassoc SUPERSETOF SUBSETOF -%left p2 RESTRICT_DOMAIN RESTRICT_RANGE -%left INTERSECTION p3 '*' '@' -%left p4 -%left OR p5 -%left AND p6 -%left COMPOSE JOIN CARRIED_BY -%right NOT APPROX DOMAIN RANGE HULL PROJECT_AWAY_SYMBOLS PROJECT_ON_SYMBOLS DIFFERENCE DIFFERENCE_TO_RELATION INVERSE COMPLEMENT FARKAS SAMPLE SYM_SAMPLE MAKE_UPPER_BOUND MAKE_LOWER_BOUND p7 -%left p8 -%nonassoc GIVEN -%left p9 -%left '(' p10 - -%% - -inputSequence : /*empty*/ - | inputSequence { assert( current_Declaration_Site == globalDecls);} - inputItem; -; - -inputItem : ';' /*empty*/ - | NO_SIMPLIFY ';'{ - simplify = false; - } - | error ';' { - flushScanBuffer(); - std::cout << err_msg; - err_msg.clear(); - current_Declaration_Site = globalDecls; - need_coef = false; - std::cout << "...skipping to statement end..." << std::endl; - delete relationDecl; - relationDecl = NULL; - } - | SYMBOLIC globVarList ';' {flushScanBuffer();} - | VAR IS_ASSIGNED relation ';' { - flushScanBuffer(); - try { - if(simplify) - $3->simplify(redundant_conj_level, redundant_constr_level); - else - $3->simplify(); - Relation *r = relationMap[std::string($1)]; - if (r != NULL) delete r; - relationMap[std::string($1)] = $3; - } - catch(const std::exception &e){ - std::cout << e.what() << std::endl; - } - - delete []$1; - } - | relation ';' { - flushScanBuffer(); - if(simplify) - $1->simplify(redundant_conj_level, redundant_constr_level); - else - $1->simplify(); - $1->print_with_subs(stdout); - delete $1; - } - | TIME relation ';' { -#if defined(OMIT_GETRUSAGE) - printf("'time' requires getrusage, but the omega calclator was compiled with OMIT_GETRUSAGE set!\n"); -#else - flushScanBuffer(); - printf("\n"); - int t; - Relation R; - bool SKIP_FULL_CHECK = getenv("OC_TIMING_SKIP_FULL_CHECK"); - ($2)->and_with_GEQ(); - start_clock(); - for (t=1;t<=100;t++) { - R = *$2; - R.finalize(); - } - int copyTime = clock_diff(); - start_clock(); - for (t=1;t<=100;t++) { - R = *$2; - R.finalize(); - R.simplify(); /* default simplification effort */ - } - int simplifyTime = clock_diff() -copyTime; - Relation R2; - if (!SKIP_FULL_CHECK) { - start_clock(); - for (t=1;t<=100;t++) { - R2 = *$2; - R2.finalize(); - R2.simplify(2,4); /* maximal simplification effort */ - } - } - int excessiveTime = clock_diff() - copyTime; - printf("Times (in microseconds): \n"); - printf("%5d us to copy original set of constraints\n",copyTime/100); - printf("%5d us to do the default amount of simplification, obtaining: \n\t", simplifyTime/100); - R.print_with_subs(stdout); - printf("\n"); - if (!SKIP_FULL_CHECK) { - printf("%5d us to do the maximum (i.e., excessive) amount of simplification, obtaining: \n\t", excessiveTime/100); - R2.print_with_subs(stdout); - printf("\n"); - } - if (!anyTimingDone) { - bool warn = false; -#ifndef SPEED - warn =true; -#endif -#ifndef NDEBUG - warn = true; -#endif - if (warn) { - printf("WARNING: The Omega calculator was compiled with options that force\n"); - printf("it to perform additional consistency and error checks\n"); - printf("that may slow it down substantially\n"); - printf("\n"); - } - printf("NOTE: These times relect the time of the current _implementation_\n"); - printf("of our algorithms. Performance bugs do exist. If you intend to publish or \n"); - printf("report on the performance on the Omega test, we respectfully but strongly \n"); - printf("request that send your test cases to us to allow us to determine if the \n"); - printf("times are appropriate, and if the way you are using the Omega library to \n"); - printf("solve your problem is the most effective way.\n"); - printf("\n"); - - printf("Also, please be aware that over the past two years, we have focused our \n"); - printf("efforts on the expressive power of the Omega library, sometimes at the\n"); - printf("expensive of raw speed. Our original implementation of the Omega test\n"); - printf("was substantially faster on the limited domain it handled.\n"); - printf("\n"); - printf(" Thanks, \n"); - printf(" the Omega Team \n"); - } - anyTimingDone = true; - delete $2; -#endif - } - | TIMECLOSURE relation ';' { -#if defined(OMIT_GETRUSAGE) - printf("'timeclosure' requires getrusage, but the omega calclator was compiled with OMIT_GETRUSAGE set!\n"); -#else - flushScanBuffer(); - try { - int t; - Relation R; - ($2)->and_with_GEQ(); - start_clock(); - for (t=1;t<=100;t++) { - R = *$2; - R.finalize(); - } - int copyTime = clock_diff(); - start_clock(); - for (t=1;t<=100;t++) { - R = *$2; - R.finalize(); - R.simplify(); - } - int simplifyTime = clock_diff() -copyTime; - Relation Rclosed; - start_clock(); - for (t=1;t<=100;t++) { - Rclosed = *$2; - Rclosed.finalize(); - Rclosed = TransitiveClosure(Rclosed, 1,Relation::Null()); - } - int closureTime = clock_diff() - copyTime; - Relation R2; - start_clock(); - for (t=1;t<=100;t++) { - R2 = *$2; - R2.finalize(); - R2.simplify(2,4); - } - int excessiveTime = clock_diff() - copyTime; - printf("Times (in microseconds): \n"); - printf("%5d us to copy original set of constraints\n",copyTime/100); - printf("%5d us to do the default amount of simplification, obtaining: \n\t", simplifyTime/100); - R.print_with_subs(stdout); - printf("\n"); - printf("%5d us to do the maximum (i.e., excessive) amount of simplification, obtaining: \n\t", excessiveTime/100); - R2.print_with_subs(stdout); - printf("%5d us to do the transitive closure, obtaining: \n\t", closureTime/100); - Rclosed.print_with_subs(stdout); - printf("\n"); - if (!anyTimingDone) { - bool warn = false; -#ifndef SPEED - warn =true; -#endif -#ifndef NDEBUG - warn = true; -#endif - if (warn) { - printf("WARNING: The Omega calculator was compiled with options that force\n"); - printf("it to perform additional consistency and error checks\n"); - printf("that may slow it down substantially\n"); - printf("\n"); - } - printf("NOTE: These times relect the time of the current _implementation_\n"); - printf("of our algorithms. Performance bugs do exist. If you intend to publish or \n"); - printf("report on the performance on the Omega test, we respectfully but strongly \n"); - printf("request that send your test cases to us to allow us to determine if the \n"); - printf("times are appropriate, and if the way you are using the Omega library to \n"); - printf("solve your problem is the most effective way.\n"); - printf("\n"); - - printf("Also, please be aware that over the past two years, we have focused our \n"); - printf("efforts on the expressive power of the Omega library, sometimes at the\n"); - printf("expensive of raw speed. Our original implementation of the Omega test\n"); - printf("was substantially faster on the limited domain it handled.\n"); - printf("\n"); - printf(" Thanks, \n"); - printf(" the Omega Team \n"); - } - anyTimingDone = true; - } - catch (const std::exception &e) { - std::cout << e.what() << std::endl; - } - delete $2; -#endif - } - | relation SUBSET relation ';' { - flushScanBuffer(); - try { - if (Must_Be_Subset(copy(*$1), copy(*$3))) - std::cout << "True" << std::endl; - else if (Might_Be_Subset(copy(*$1), copy(*$3))) - std::cout << "Possible" << std::endl; - else - std::cout << "False" << std::endl; - } - catch (const std::exception &e) { - std::cout << e.what() << std::endl; - } - delete $1; - delete $3; - } - | CODEGEN relPairList context';' { - flushScanBuffer(); -#ifdef BUILD_CODEGEN - try { - CodeGen cg($2->first, $2->second, *$3); - CG_result *cgr = cg.buildAST(); - if (cgr != NULL) { - std::string s = cgr->printString(); - std::cout << s << std::endl; - delete cgr; - } - else - std::cout << "/* empty */" << std::endl; - } - catch (const std::exception &e) { - std::cout << e.what() << std::endl; - } -#else - std::cout << "CodeGen package not built" << std::endl; -#endif - delete $3; - delete $2; - } - | CODEGEN INT relPairList context';' { - flushScanBuffer(); -#ifdef BUILD_CODEGEN - try { - CodeGen cg($3->first, $3->second, *$4); - CG_result *cgr = cg.buildAST($2); - if (cgr != NULL) { - std::string s = cgr->printString(); - std::cout << s << std::endl; - delete cgr; - } - else - std::cout << "/* empty */" << std::endl; - } - catch (const std::exception &e) { - std::cout << e.what() << std::endl; - } -#else - std::cout << "CodeGen package not built" << std::endl; -#endif - delete $4; - delete $3; - } - | reachable ';' { - flushScanBuffer(); - Dynamic_Array1 &final = *$1; - bool any_sat = false; - int i,n_nodes = reachable_info->node_names.size(); - for(i = 1; i <= n_nodes; i++) - if(final[i].is_upper_bound_satisfiable()) { - any_sat = true; - std::cout << "Node " << reachable_info->node_names[i] << ": "; - final[i].print_with_subs(stdout); - } - if(!any_sat) - std::cout << "No nodes reachable.\n"; - delete $1; - delete reachable_info; - } -; - - -context : {$$ = new Relation(); *$$ = Relation::Null();} - | GIVEN relation {$$ = $2; } -; - -relPairList : relPairList ',' relation ':' relation { - try { - $1->first.push_back(*$3); - $1->second.push_back(*$5); - } - catch (const std::exception &e) { - delete $1; - delete $3; - delete $5; - yyerror(e.what()); - YYERROR; - } - delete $3; - delete $5; - $$ = $1; - } - | relPairList ',' relation { - try { - $1->first.push_back(Identity($3->n_set())); - $1->second.push_back(*$3); - } - catch (const std::exception &e) { - delete $1; - delete $3; - yyerror(e.what()); - YYERROR; - } - delete $3; - $$ = $1; - } - | relation ':' relation { - std::pair, std::vector > *rtp = new std::pair, std::vector >(); - try { - rtp->first.push_back(*$1); - rtp->second.push_back(*$3); - } - catch (const std::exception &e) { - delete rtp; - delete $1; - delete $3; - yyerror(e.what()); - YYERROR; - } - delete $1; - delete $3; - $$ = rtp; - } - | relation { - std::pair, std::vector > *rtp = new std::pair, std::vector >(); - try { - rtp->first.push_back(Identity($1->n_set())); - rtp->second.push_back(*$1); - } - catch (const std::exception &e) { - delete rtp; - delete $1; - yyerror(e.what()); - YYERROR; - } - delete $1; - $$ = rtp; - } -; - -relation : OPEN_BRACE {need_coef = true; relationDecl = new Declaration_Site();} - builtRelation CLOSE_BRACE { - need_coef = false; - $$ = $3; - current_Declaration_Site = globalDecls; - delete relationDecl; - relationDecl = NULL; - } - | VAR { - Relation *r = relationMap[std::string($1)]; - if (r == NULL) { - yyerror(std::string("relation ") + to_string($1) + std::string(" not declared")); - delete []$1; - YYERROR; - } - $$ = new Relation(*r); - delete []$1; - } - | '(' relation ')' {$$ = $2;} - | relation '+' %prec p9 { - $$ = new Relation(); - try { - *$$ = TransitiveClosure(*$1, 1, Relation::Null()); - } - catch (const std::exception &e) { - delete $$; - delete $1; - yyerror(e.what()); - YYERROR; - } - delete $1; - } - | relation '*' %prec p9 { - $$ = new Relation(); - try { - int vars = $1->n_inp(); - *$$ = Union(Identity(vars), TransitiveClosure(*$1, 1, Relation::Null())); - } - catch (const std::exception &e) { - delete $$; - delete $1; - yyerror(e.what()); - YYERROR; - } - delete $1; - } - | relation '+' WITHIN relation %prec p9 { - $$ = new Relation(); - try { - *$$= TransitiveClosure(*$1, 1, *$4); - } - catch (const std::exception &e) { - delete $$; - delete $1; - delete $4; - yyerror(e.what()); - YYERROR; - } - delete $1; - delete $4; - } - | relation '^' '@' %prec p8 { - $$ = new Relation(); - try { - *$$ = ApproxClosure(*$1); - } - catch (const std::exception &e) { - delete $$; - delete $1; - yyerror(e.what()); - YYERROR; - } - delete $1; - } - | relation '^' '+' %prec p8 { - $$ = new Relation(); - try { - *$$ = calculateTransitiveClosure(*$1); - } - catch (const std::exception &e) { - delete $$; - delete $1; - yyerror(e.what()); - YYERROR; - } - delete $1; - } - | MINIMIZE_RANGE relation %prec p8 { - $$ = new Relation(); - try { - Relation o(*$2); - Relation r(*$2); - r = Join(r,LexForward($2->n_out())); - *$$ = Difference(o,r); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | MAXIMIZE_RANGE relation %prec p8 { - $$ = new Relation(); - try { - Relation o(*$2); - Relation r(*$2); - r = Join(r,Inverse(LexForward($2->n_out()))); - *$$ = Difference(o,r); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | MINIMIZE_DOMAIN relation %prec p8 { - $$ = new Relation(); - try { - Relation o(*$2); - Relation r(*$2); - r = Join(LexForward($2->n_inp()),r); - *$$ = Difference(o,r); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | MAXIMIZE_DOMAIN relation %prec p8 { - $$ = new Relation(); - try { - Relation o(*$2); - Relation r(*$2); - r = Join(Inverse(LexForward($2->n_inp())),r); - *$$ = Difference(o,r); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | MAXIMIZE relation %prec p8 { - $$ = new Relation(); - try { - Relation c(*$2); - Relation r(*$2); - *$$ = Cross_Product(Relation(*$2),c); - *$$ = Difference(r,Domain(Intersection(*$$,LexForward($$->n_inp())))); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | MINIMIZE relation %prec p8 { - $$ = new Relation(); - try { - Relation c(*$2); - Relation r(*$2); - *$$ = Cross_Product(Relation(*$2),c); - *$$ = Difference(r,Range(Intersection(*$$,LexForward($$->n_inp())))); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | FARKAS relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Farkas(*$2, Basic_Farkas); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | DECOUPLED_FARKAS relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Farkas(*$2, Decoupled_Farkas); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | relation '@' %prec p9 { - $$ = new Relation(); - try { - *$$ = ConicClosure(*$1); - } - catch (const std::exception &e) { - delete $$; - delete $1; - yyerror(e.what()); - YYERROR; - } - delete $1; - } - | PROJECT_AWAY_SYMBOLS relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Project_Sym(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | PROJECT_ON_SYMBOLS relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Project_On_Sym(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | DIFFERENCE relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Deltas(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | DIFFERENCE_TO_RELATION relation %prec p8 { - $$ = new Relation(); - try { - *$$ = DeltasToRelation(*$2,$2->n_set(),$2->n_set()); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | DOMAIN relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Domain(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | VENN relation %prec p8 { - $$ = new Relation(); - try { - *$$ = VennDiagramForm(*$2,Relation::True(*$2)); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | VENN relation GIVEN relation %prec p8 { - $$ = new Relation(); - try { - *$$ = VennDiagramForm(*$2,*$4); - } - catch (const std::exception &e) { - delete $$; - delete $2; - delete $4; - yyerror(e.what()); - YYERROR; - } - delete $2; - delete $4; - } - | CONVEX_HULL relation %prec p8 { - $$ = new Relation(); - try { - *$$ = ConvexHull(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | DECOUPLED_CONVEX_HULL relation %prec p8 { - $$ = new Relation(); - try { - *$$ = DecoupledConvexHull(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | POSITIVE_COMBINATION relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Farkas(*$2,Positive_Combination_Farkas); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | LINEAR_COMBINATION relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Farkas(*$2,Linear_Combination_Farkas); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | AFFINE_COMBINATION relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Farkas(*$2,Affine_Combination_Farkas); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | CONVEX_COMBINATION relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Farkas(*$2,Convex_Combination_Farkas); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | PAIRWISE_CHECK relation %prec p8 { - $$ = new Relation(); - try { - *$$ = CheckForConvexRepresentation(CheckForConvexPairs(*$2)); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | CONVEX_CHECK relation %prec p8 { - $$ = new Relation(); - try { - *$$ = CheckForConvexRepresentation(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | CONVEX_REPRESENTATION relation %prec p8 { - $$ = new Relation(); - try { - *$$ = ConvexRepresentation(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | AFFINE_HULL relation %prec p8 { - $$ = new Relation(); - try { - *$$ = AffineHull(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | CONIC_HULL relation %prec p8 { - $$ = new Relation(); - try { - *$$ = ConicHull(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | LINEAR_HULL relation %prec p8 { - $$ = new Relation(); - try { - *$$ = LinearHull(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | QUICK_HULL relation %prec p8 { - $$ = new Relation(); - try { - *$$ = QuickHull(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | RECT_HULL relation %prec p8 { - $$ = new Relation(); - try { - *$$ = RectHull(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | SIMPLE_HULL relation %prec p8 { - $$ = new Relation(); - try { - *$$ = SimpleHull(*$2, true, true); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | HULL relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Hull(*$2,true,1,Relation::Null()); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | HULL relation GIVEN relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Hull(*$2,true,1,*$4); - } - catch (const std::exception &e) { - delete $$; - delete $2; - delete $4; - yyerror(e.what()); - YYERROR; - } - delete $2; - delete $4; - } - | APPROX relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Approximate(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | RANGE relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Range(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | INVERSE relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Inverse(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | COMPLEMENT relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Complement(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | GIST relation GIVEN relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Gist(*$2,*$4,1); - } - catch (const std::exception &e) { - delete $$; - delete $2; - delete $4; - yyerror(e.what()); - YYERROR; - } - delete $2; - delete $4; - } - | relation '(' relation ')' { - $$ = new Relation(); - try { - *$$ = Composition(*$1,*$3); - } - catch (const std::exception &e) { - delete $$; - delete $1; - delete $3; - yyerror(e.what()); - YYERROR; - } - delete $1; - delete $3; - } - | relation COMPOSE relation { - $$ = new Relation(); - try { - *$$ = Composition(*$1,*$3); - } - catch (const std::exception &e) { - delete $$; - delete $1; - delete $3; - yyerror(e.what()); - YYERROR; - } - delete $1; - delete $3; - } - | relation CARRIED_BY INT { - $$ = new Relation(); - try { - *$$ = After(*$1,$3,$3); - (*$$).prefix_print(stdout); - } - catch (const std::exception &e) { - delete $$; - delete $1; - yyerror(e.what()); - YYERROR; - } - delete $1; - } - | relation JOIN relation { - $$ = new Relation(); - try { - *$$ = Composition(*$3,*$1); - } - catch (const std::exception &e) { - delete $$; - delete $1; - delete $3; - yyerror(e.what()); - YYERROR; - } - delete $1; - delete $3; - } - | relation RESTRICT_RANGE relation { - $$ = new Relation(); - try { - *$$ = Restrict_Range(*$1,*$3); - } - catch (const std::exception &e) { - delete $$; - delete $1; - delete $3; - yyerror(e.what()); - YYERROR; - } - delete $1; - delete $3; - } - | relation RESTRICT_DOMAIN relation { - $$ = new Relation(); - try { - *$$ = Restrict_Domain(*$1,*$3); - } - catch (const std::exception &e) { - delete $$; - delete $1; - delete $3; - yyerror(e.what()); - YYERROR; - } - delete $1; - delete $3; - } - | relation INTERSECTION relation { - $$ = new Relation(); - try { - *$$ = Intersection(*$1,*$3); - } - catch (const std::exception &e) { - delete $$; - delete $1; - delete $3; - yyerror(e.what()); - YYERROR; - } - delete $1; - delete $3; - } - | relation '-' relation %prec INTERSECTION { - $$ = new Relation(); - try { - *$$ = Difference(*$1,*$3); - } - catch (const std::exception &e) { - delete $$; - delete $1; - delete $3; - yyerror(e.what()); - YYERROR; - } - delete $1; - delete $3; - } - | relation UNION relation { - $$ = new Relation(); - try { - *$$ = Union(*$1,*$3); - } - catch (const std::exception &e) { - delete $$; - delete $1; - delete $3; - yyerror(e.what()); - YYERROR; - } - delete $1; - delete $3; - } - | relation '*' relation { - $$ = new Relation(); - try { - *$$ = Cross_Product(*$1,*$3); - } - catch (const std::exception &e) { - delete $$; - delete $1; - delete $3; - yyerror(e.what()); - YYERROR; - } - delete $1; - delete $3; - } - | SUPERSETOF relation { - $$ = new Relation(); - try { - *$$ = Union(*$2, Relation::Unknown(*$2)); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | SUBSETOF relation { - $$ = new Relation(); - try { - *$$ = Intersection(*$2, Relation::Unknown(*$2)); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | MAKE_UPPER_BOUND relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Upper_Bound(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | MAKE_LOWER_BOUND relation %prec p8 { - $$ = new Relation(); - try { - *$$ = Lower_Bound(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | SAMPLE relation { - $$ = new Relation(); - try { - *$$ = Sample_Solution(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | SYM_SAMPLE relation { - $$ = new Relation(); - try { - *$$ = Symbolic_Solution(*$2); - } - catch (const std::exception &e) { - delete $$; - delete $2; - yyerror(e.what()); - YYERROR; - } - delete $2; - } - | reachable_of { $$ = $1; } - | ASSERT_UNSAT relation { - if (($2)->is_satisfiable()) { - fprintf(stderr,"assert_unsatisfiable failed on "); - ($2)->print_with_subs(stderr); - exit(1); - } - $$=$2; - } -; - -builtRelation : tupleDeclaration GOES_TO {currentTuple = Output_Tuple;} - tupleDeclaration {currentTuple = Input_Tuple;} optionalFormula { - Relation * r = new Relation($1->size,$4->size); - resetGlobals(); - F_And *f = r->add_and(); - for(int i = 1; i <= $1->size; i++) { - $1->vars[i-1]->vid = r->input_var(i); - if (!$1->vars[i-1]->anonymous) - r->name_input_var(i, $1->vars[i-1]->stripped_name); - } - for(int i = 1; i <= $4->size; i++) { - $4->vars[i-1]->vid = r->output_var(i); - if (!$4->vars[i-1]->anonymous) - r->name_output_var(i, $4->vars[i-1]->stripped_name); - } - r->setup_names(); - for (std::set::iterator i = $1->eq_constraints.begin(); i != $1->eq_constraints.end(); i++) - install_eq(f, *i, 0); - for (std::set::iterator i = $1->geq_constraints.begin(); i != $1->geq_constraints.end(); i++) - install_geq(f, *i, 0); - for (std::set::iterator i = $1->stride_constraints.begin(); i != $1->stride_constraints.end(); i++) - install_stride(f, *i); - for (std::set::iterator i = $4->eq_constraints.begin(); i != $4->eq_constraints.end(); i++) - install_eq(f, *i, 0); - for (std::set::iterator i = $4->geq_constraints.begin(); i != $4->geq_constraints.end(); i++) - install_geq(f, *i, 0); - for (std::set::iterator i = $4->stride_constraints.begin(); i != $4->stride_constraints.end(); i++) - install_stride(f, *i); - if ($6) $6->install(f); - delete $1; - delete $4; - delete $6; - $$ = r; - } - | tupleDeclaration optionalFormula { - Relation * r = new Relation($1->size); - resetGlobals(); - F_And *f = r->add_and(); - for(int i = 1; i <= $1->size; i++) { - $1->vars[i-1]->vid = r->set_var(i); - if (!$1->vars[i-1]->anonymous) - r->name_set_var(i, $1->vars[i-1]->stripped_name); - } - r->setup_names(); - for (std::set::iterator i = $1->eq_constraints.begin(); i != $1->eq_constraints.end(); i++) - install_eq(f, *i, 0); - for (std::set::iterator i = $1->geq_constraints.begin(); i != $1->geq_constraints.end(); i++) - install_geq(f, *i, 0); - for (std::set::iterator i = $1->stride_constraints.begin(); i != $1->stride_constraints.end(); i++) - install_stride(f, *i); - if ($2) $2->install(f); - delete $1; - delete $2; - $$ = r; - } - | formula { - Relation * r = new Relation(0,0); - F_And *f = r->add_and(); - $1->install(f); - delete $1; - $$ = r; - } -; - -optionalFormula : formula_sep formula {$$ = $2;} - | {$$ = 0;} -; - -formula_sep : ':' - | VERTICAL_BAR - | SUCH_THAT -; - -tupleDeclaration : {currentTupleDescriptor = new tupleDescriptor; tuplePos = 1;} - '[' optionalTupleVarList ']' - {$$ = currentTupleDescriptor; tuplePos = 0;} -; - -optionalTupleVarList : /* empty */ - | tupleVar - | optionalTupleVarList ',' tupleVar -; - -tupleVar : VAR %prec p10 { - Declaration_Site *ds = defined($1); - if (!ds) - currentTupleDescriptor->extend($1,currentTuple,tuplePos); - else { - Variable_Ref *v = lookupScalar($1); - if (v == NULL) { - yyerror(std::string("cannot find declaration for variable ") + to_string($1)); - delete []$1; - YYERROR; - } - if (ds != globalDecls) - currentTupleDescriptor->extend($1, new Exp(v)); - else - currentTupleDescriptor->extend(new Exp(v)); - } - tuplePos++; - delete []$1; - } - | '*' {currentTupleDescriptor->extend(); tuplePos++;} - | exp %prec p1 { - currentTupleDescriptor->extend($1); - tuplePos++; - } - | exp ':' exp %prec p1 { - currentTupleDescriptor->extend($1,$3); - tuplePos++; - } - | exp ':' exp ':' COEF %prec p1 { - currentTupleDescriptor->extend($1,$3,$5); - tuplePos++; - } -; - -varList : varList ',' VAR {$$ = $1; $$->insert($3); $3 = NULL;} - | VAR {$$ = new std::set(); $$->insert($1); $1 = NULL;} -; - -varDecl : varList { - $$ = current_Declaration_Site = new Declaration_Site($1); - for (std::set::iterator i = $1->begin(); i != $1->end(); i++) - delete [](*i); - delete $1; - } -; - -varDeclOptBrackets : varDecl {$$ = $1;} - |'[' varDecl ']' {$$ = $2;} -; - -globVarList : globVarList ',' globVar - | globVar -; - -globVar : VAR '(' INT ')' {globalDecls->extend_both_tuples($1, $3); delete []$1;} - | VAR { - globalDecls->extend($1); - delete []$1; - } -; - -formula : formula AND formula {$$ = new AST_And($1,$3);} - | formula OR formula {$$ = new AST_Or($1,$3);} - | constraintChain {$$ = $1;} - | '(' formula ')' {$$ = $2;} - | NOT formula {$$ = new AST_Not($2);} - | start_exists varDeclOptBrackets exists_sep formula end_quant {$$ = new AST_exists($2,$4);} - | start_forall varDeclOptBrackets forall_sep formula end_quant {$$ = new AST_forall($2,$4);} -; - -start_exists : '(' EXISTS - | EXISTS '(' -; - -exists_sep : ':' - | VERTICAL_BAR - | SUCH_THAT -; - -start_forall : '(' FORALL - | FORALL '(' -; - -forall_sep : ':' -; - -end_quant : ')' {popScope();} -; - -expList : exp ',' expList {$$ = $3; $$->insert($1);} - | exp {$$ = new std::set(); $$->insert($1);} -; - -constraintChain : expList REL_OP expList {$$ = new AST_constraints($1,$2,$3);} - | expList REL_OP constraintChain {$$ = new AST_constraints($1,$2,$3);} -; - -simpleExp : VAR %prec p9 { - Variable_Ref *v = lookupScalar($1); - if (v == NULL) { - yyerror(std::string("cannot find declaration for variable ") + to_string($1)); - delete []$1; - YYERROR; - } - $$ = new Exp(v); - delete []$1; - } - | VAR '(' {argCount = 1;} argumentList ')' %prec p9 { - Variable_Ref *v; - if ($4 == Input_Tuple) - v = functionOfInput[$1]; - else - v = functionOfOutput[$1]; - if (v == NULL) { - yyerror(std::string("Function ") + to_string($1) + std::string(" not declared")); - delete []$1; - YYERROR; - } - $$ = new Exp(v); - delete []$1; - } - | '(' exp ')' { $$ = $2; } -; - -argumentList : argumentList ',' VAR { - Variable_Ref *v = lookupScalar($3); - if (v == NULL) { - yyerror(std::string("cannot find declaration for variable ") + to_string($1)); - delete []$3; - YYERROR; - } - if (v->pos != argCount || v->of != $1 || (v->of != Input_Tuple && v->of != Output_Tuple)) { - yyerror("arguments to function must be prefix of input or output tuple"); - delete []$3; - YYERROR; - } - $$ = v->of; - argCount++; - delete []$3; - } - | VAR { - Variable_Ref *v = lookupScalar($1); - if (v == NULL) { - yyerror(std::string("cannot find declaration for variable ") + to_string($1)); - delete []$1; - YYERROR; - } - if (v->pos != argCount || (v->of != Input_Tuple && v->of != Output_Tuple)) { - yyerror("arguments to function must be prefix of input or output tuple"); - delete []$1; - YYERROR; - } - $$ = v->of; - argCount++; - delete []$1; - } -; - -exp : COEF {$$ = new Exp($1);} - | COEF simpleExp %prec '*' {$$ = multiply($1,$2);} - | simpleExp {$$ = $1; } - | '-' exp %prec '*' {$$ = negate($2);} - | exp '+' exp {$$ = add($1,$3);} - | exp '-' exp {$$ = subtract($1,$3);} - | exp '*' exp { - try { - $$ = multiply($1,$3); - } - catch (const std::exception &e) { - yyerror(e.what()); - YYERROR; - } - } -; - - -reachable : REACHABLE_FROM nodeNameList nodeSpecificationList { - Dynamic_Array1 *final = Reachable_Nodes(reachable_info); - $$ = final; - } -; - -reachable_of : REACHABLE_OF VAR IN nodeNameList nodeSpecificationList { - Dynamic_Array1 *final = Reachable_Nodes(reachable_info); - int index = reachable_info->node_names.index(std::string($2)); - if (index == 0) { - yyerror(std::string("no such node ") + to_string($2)); - delete []$2; - delete final; - delete reachable_info; - YYERROR; - } - $$ = new Relation; - *$$ = (*final)[index]; - delete final; - delete reachable_info; - delete []$2; - } -; - -nodeNameList : '(' realNodeNameList ')' { - int sz = reachable_info->node_names.size(); - reachable_info->node_arity.reallocate(sz); - reachable_info->transitions.resize(sz+1,sz+1); - reachable_info->start_nodes.resize(sz+1); - } -; - -realNodeNameList : realNodeNameList ',' VAR { - reachable_info->node_names.append(std::string($3)); - delete []$3; - } - | VAR { - reachable_info = new reachable_information; - reachable_info->node_names.append(std::string($1)); - delete []$1; - } -; - - -nodeSpecificationList : OPEN_BRACE realNodeSpecificationList CLOSE_BRACE { - int i,j; - int n_nodes = reachable_info->node_names.size(); - Tuple &arity = reachable_info->node_arity; - Dynamic_Array2 &transitions = reachable_info->transitions; - - /* fixup unspecified transitions to be false */ - /* find arity */ - for(i = 1; i <= n_nodes; i++) arity[i] = -1; - for(i = 1; i <= n_nodes; i++) - for(j = 1; j <= n_nodes; j++) - if(! transitions[i][j].is_null()) { - int in_arity = transitions[i][j].n_inp(); - int out_arity = transitions[i][j].n_out(); - if(arity[i] < 0) arity[i] = in_arity; - if(arity[j] < 0) arity[j] = out_arity; - if(in_arity != arity[i] || out_arity != arity[j]) { - yyerror(std::string("arity mismatch in node transition: ") + to_string(reachable_info->node_names[i]) + std::string(" -> ") + to_string(reachable_info->node_names[j])); - delete reachable_info; - YYERROR; - } - } - for(i = 1; i <= n_nodes; i++) - if(arity[i] < 0) arity[i] = 0; - /* Fill in false relations */ - for(i = 1; i <= n_nodes; i++) - for(j = 1; j <= n_nodes; j++) - if(transitions[i][j].is_null()) - transitions[i][j] = Relation::False(arity[i],arity[j]); - - /* fixup unused start node positions */ - Dynamic_Array1 &nodes = reachable_info->start_nodes; - for(i = 1; i <= n_nodes; i++) - if(nodes[i].is_null()) - nodes[i] = Relation::False(arity[i]); - else - if(nodes[i].n_set() != arity[i]){ - yyerror(std::string("arity mismatch in start node ") + to_string(reachable_info->node_names[i])); - delete reachable_info; - YYERROR; - } - } -; - -realNodeSpecificationList : realNodeSpecificationList ',' VAR ':' relation { - int n_nodes = reachable_info->node_names.size(); - int index = reachable_info->node_names.index($3); - if (!(index > 0 && index <= n_nodes)) { - yyerror(std::string("no such node ")+to_string($3)); - delete $5; - delete []$3; - delete reachable_info; - YYERROR; - } - reachable_info->start_nodes[index] = *$5; - delete $5; - delete []$3; - } - | realNodeSpecificationList ',' VAR GOES_TO VAR ':' relation { - int n_nodes = reachable_info->node_names.size(); - int from_index = reachable_info->node_names.index($3); - if (!(from_index > 0 && from_index <= n_nodes)) { - yyerror(std::string("no such node ")+to_string($3)); - delete $7; - delete []$3; - delete []$5; - delete reachable_info; - YYERROR; - } - int to_index = reachable_info->node_names.index($5); - if (!(to_index > 0 && to_index <= n_nodes)) { - yyerror(std::string("no such node ")+to_string($5)); - delete $7; - delete []$3; - delete []$5; - delete reachable_info; - YYERROR; - } - reachable_info->transitions[from_index][to_index] = *$7; - delete $7; - delete []$3; - delete []$5; - } - | VAR GOES_TO VAR ':' relation { - int n_nodes = reachable_info->node_names.size(); - int from_index = reachable_info->node_names.index($1); - if (!(from_index > 0 && from_index <= n_nodes)) { - yyerror(std::string("no such node ")+to_string($1)); - delete $5; - delete []$1; - delete []$3; - delete reachable_info; - YYERROR; - } - int to_index = reachable_info->node_names.index($3); - if (!(to_index > 0 && to_index <= n_nodes)) { - yyerror(std::string("no such node ")+to_string($3)); - delete $5; - delete []$1; - delete []$3; - delete reachable_info; - YYERROR; - } - reachable_info->transitions[from_index][to_index] = *$5; - delete $5; - delete []$1; - delete []$3; - } - | VAR ':' relation { - int n_nodes = reachable_info->node_names.size(); - int index = reachable_info->node_names.index($1); - if (!(index > 0 && index <= n_nodes)) { - yyerror(std::string("no such node ")+to_string($1)); - delete $3; - delete []$1; - delete reachable_info; - YYERROR; - } - reachable_info->start_nodes[index] = *$3; - delete $3; - delete []$1; - } -; - -%% - -void yyerror(const std::string &s) { - std::stringstream ss; - if (is_interactive) - ss << s << "\n"; - else - ss << s << " at line " << mylexer.lineno() << "\n"; - err_msg = ss.str(); -} - - -int main(int argc, char **argv) { - if (argc > 2){ - fprintf(stderr, "Usage: %s [script_file]\n", argv[0]); - exit(1); - } - - if (argc == 2) { - std::ifstream *ifs = new std::ifstream; - ifs->open(argv[1], std::ifstream::in); - if (!ifs->is_open()) { - fprintf(stderr, "can't open input file %s\n", argv[1]); - exit(1); - } - yy_buffer_state *bs = mylexer.yy_create_buffer(ifs, 8092); - mylexer.yypush_buffer_state(bs); - } - - //yydebug = 1; - is_interactive = false; - if (argc == 1) { -#if defined __USE_POSIX - if (isatty((int)fileno(stdin))) - is_interactive = true; -#elif defined __WIN32 - if (_isatty(_fileno(stdin))) - is_interactive = true; -#endif - } - - if (is_interactive) { -#ifdef BUILD_CODEGEN - std::cout << "Omega+ and CodeGen+ "; -#else - std::cout << "Omega+ "; -#endif - std::cout << "v2.2.3 (built on " OMEGA_BUILD_DATE ")" << std::endl; - std::cout << "Copyright (C) 1994-2000 the Omega Project Team" << std::endl; - std::cout << "Copyright (C) 2005-2011 Chun Chen" << std::endl; - std::cout << "Copyright (C) 2011-2012 University of Utah" << std::endl; - std::cout << PROMPT_STRING << ' '; - std::cout.flush(); - } - - need_coef = false; - current_Declaration_Site = globalDecls = new Global_Declaration_Site(); - - if (yyparse() != 0) { - if (!is_interactive) - std::cout << "syntax error at the end of the file, missing ';'" << std::endl; - else - std::cout << std::endl; - delete relationDecl; - relationDecl = NULL; - } - else { - if (is_interactive) - std::cout << std::endl; - } - - for (std::map::iterator i = relationMap.begin(); i != relationMap.end(); i++) - delete (*i).second; - delete globalDecls; - - return 0; -} - -Relation LexForward(int n) { - Relation r(n,n); - F_Or *f = r.add_or(); - for (int i=1; i <= n; i++) { - F_And *g = f->add_and(); - for(int j=1;jadd_EQ(); - e.update_coef(r.input_var(j),-1); - e.update_coef(r.output_var(j),1); - e.finalize(); - } - GEQ_Handle e = g->add_GEQ(); - e.update_coef(r.input_var(i),-1); - e.update_coef(r.output_var(i),1); - e.update_const(-1); - e.finalize(); - } - r.finalize(); - return r; -} diff --git a/omega/omega_lib/doc/interface.pdf b/omega/omega_lib/doc/interface.pdf deleted file mode 100644 index 7f918ae..0000000 Binary files a/omega/omega_lib/doc/interface.pdf and /dev/null differ diff --git a/omega/omega_lib/include/omega.h b/omega/omega_lib/include/omega.h deleted file mode 100644 index 8aa2c08..0000000 --- a/omega/omega_lib/include/omega.h +++ /dev/null @@ -1,71 +0,0 @@ -/********************************************************************* - Old license information from the Omega Project, updated one can be - found in LICENSE file. - - Copyright (C) 1994-1996 by the Omega Project - All rights reserved. - - NOTICE: This software is provided ``as is'', without any - warranty, including any implied warranty for merchantability or - fitness for a particular purpose. Under no circumstances shall - the Omega Project or its agents be liable for any use of, misuse - of, or inability to use this software, including incidental and - consequential damages. - - License is hereby given to use, modify, and redistribute this - software, in whole or in part, for any purpose, commercial or - non-commercial, provided that the user agrees to the terms of this - copyright notice, including disclaimer of warranty, and provided - that this copyright notice, including disclaimer of warranty, is - preserved in the source code and documentation of anything derived - from this software. Any redistributor of this software or - anything derived from this software assumes responsibility for - ensuring that any parties to whom such a redistribution is made - are fully aware of the terms of this license and disclaimer. - - The Omega project can be contacted at omega@cs.umd.edu - or http://www.cs.umd.edu/projects/omega -*********************************************************************/ - -#ifndef Already_Included_Omega -#define Already_Included_Omega - -/* - * The presburger interface is divided into the following parts. - * These parts are all included together, but are in separate - * files to keep things organized a bit. - * - * In many files, you can include just some of the following, - * specifically: if you are building a presburger tree, just - * include "pres_tree.h"; if you are querying it, include - * "pres_dnf.d" and "pres_conj.h"; if you are doing relational - * operations, include "Relation.h" - * - * Most of the function definitions are in the .c files with - * the same name as the .h that declares them, except: - * the remap and push_exists functions are in pres_var.c - * the DNFize functions are in pres_dnf.c - * the functions involving printing are in pres_print.c - * the beautify functions are in pres_beaut.c - * the rearrange functions are in pres_rear.c - * the compression functions are in pres_cmpr.c - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#endif diff --git a/omega/omega_lib/include/omega/RelBody.h b/omega/omega_lib/include/omega/RelBody.h deleted file mode 100644 index 3c11702..0000000 --- a/omega/omega_lib/include/omega/RelBody.h +++ /dev/null @@ -1,165 +0,0 @@ -#if ! defined _RelBody_h -#define _RelBody_h 1 - -#include -#include - -namespace omega { - -typedef enum {under_construction, compressed, uncompressed} Rel_Body_Status; -typedef unsigned char Rel_Unknown_Uses; -const Rel_Unknown_Uses no_u = 1; -const Rel_Unknown_Uses and_u = 2; -const Rel_Unknown_Uses or_u = 4; - -// -// Relation body. -// Body and representative are separated to do reference counting. -// - -class Rel_Body : public Formula { -public: - bool is_null() const; - - inline Node_Type node_type() { return Op_Relation; } - - inline bool is_set() const { return number_output == 0; } - int n_inp() const; - int n_out() const; - int n_set() const; - - inline Variable_ID_Tuple *global_decls() { return &Symbolic; } - int max_ufs_arity(); - int max_shared_ufs_arity(); - int max_ufs_arity_of_set(); - int max_ufs_arity_of_in(); - int max_ufs_arity_of_out(); - - Variable_ID input_var(int nth); - Variable_ID output_var(int nth); - Variable_ID set_var(int nth); - Variable_ID get_local(const Variable_ID v); - Variable_ID get_local(const Global_Var_ID G); - Variable_ID get_local(const Global_Var_ID G, Argument_Tuple of); - bool has_local(const Global_Var_ID G); - bool has_local(const Global_Var_ID G, Argument_Tuple of); - void name_input_var(int, Const_String); - void name_output_var(int, Const_String); - void name_set_var(int, Const_String); - - F_And *and_with_and(); - EQ_Handle and_with_EQ(); - EQ_Handle and_with_EQ(const Constraint_Handle &c); - GEQ_Handle and_with_GEQ(); - GEQ_Handle and_with_GEQ(const Constraint_Handle &c); - - void print(); - void print(FILE *output_file) { print(output_file, true); } - void print(FILE *output_file, bool printSym); - std::string print_variables_to_string(bool printSym); - void print_with_subs(FILE *output_file, bool printSym, bool newline); - void print_with_subs(); - std::string print_with_subs_to_string(bool printSym, bool newline); - std::string print_outputs_with_subs_to_string(); - std::string print_outputs_with_subs_to_string(int i); - std::string print_formula_to_string(); - void prefix_print(); - void prefix_print(FILE *output_file, int debug = 1); - - bool is_satisfiable(); - bool is_lower_bound_satisfiable(); - bool is_upper_bound_satisfiable(); - bool is_obvious_tautology(); - bool is_definite_tautology(); - bool is_unknown(); - DNF* query_DNF(); - DNF* query_DNF(int rdt_conjs, int rdt_constrs); - void simplify(int rdt_conjs = 0, int rdt_constrs = 0); - void finalize(); - inline bool is_finalized() { return finalized; } - inline bool is_shared() { return ref_count > 1; } - - void query_difference(Variable_ID v1, Variable_ID v2, - coef_t &lowerBound, coef_t &upperBound, - bool &quaranteed); - void query_variable_bounds(Variable_ID, coef_t &lowerBound, coef_t &upperBound); - coef_t query_variable_mod(Variable_ID v, coef_t factor); - - Relation extract_dnf_by_carried_level(int level, int direction); - void make_level_carried_to(int level); - - // these are only public to allow the creation of "null_rel" - Rel_Body(); - ~Rel_Body(); - void setup_names(); - -private: - - // These are manipulated primarily as parts of Relations - friend class Relation; - friend_rel_ops; - - friend void remap_DNF_vars(Rel_Body *new_rel, Rel_Body *old_rel); - - Rel_Unknown_Uses unknown_uses(); - - inline bool is_simplified() const { return (simplified_DNF!=NULL && get_children().empty()); } - bool is_compressed(); - Conjunct *rm_first_conjunct(); - Conjunct *single_conjunct(); - bool has_single_conjunct(); - - void beautify(); - void rearrange(); - - friend class EQ_Handle; // these set up names for printing - friend class GEQ_Handle; // and check if simplified - friend class Constraint_Handle; // and update coefficients - - void compress(); - void uncompress(); - - void interpret_unknown_as_true(); - void interpret_unknown_as_false(); - - Rel_Body(int n_input, int n_output); - /* Rel_Body(Rel_Body *r); */ - Rel_Body(Rel_Body *r, Conjunct *c); - Rel_Body &operator=(Rel_Body &r); - Rel_Body *clone(); - - inline Formula *formula() { return children().front(); } - inline Formula *rm_formula() { return children().remove_front(); } - bool can_add_child(); - - void reverse_leading_dir_info(); - void invalidate_leading_info(int changed = -1) { Formula::invalidate_leading_info(changed); } - void enforce_leading_info(int guaranteed, int possible, int dir) { Formula::enforce_leading_info(guaranteed, possible, dir); } - // re-declare this so that Relation (a friend) can call it - - DNF* DNFize(); - void DNF_to_formula(); - - Conjunct *find_available_conjunct(); - F_And *find_available_And(); - - -/* === data === */ -private: - - int ref_count; - Rel_Body_Status status; - - int number_input, number_output; - Tuple In_Names, Out_Names; - Variable_ID_Tuple Symbolic; - - DNF* simplified_DNF; - short r_conjs; // are redundant conjuncts eliminated? - bool finalized; - bool _is_set; -}; - -} // namespace - -#endif diff --git a/omega/omega_lib/include/omega/Rel_map.h b/omega/omega_lib/include/omega/Rel_map.h deleted file mode 100644 index 5641cb3..0000000 --- a/omega/omega_lib/include/omega/Rel_map.h +++ /dev/null @@ -1,161 +0,0 @@ -#if ! defined _Rel_map_h -#define _Rel_map_h 1 - -#include -#include - -namespace omega { - -// -// Mapping for relations -// When a relation operation needs to re-arrange the variables, -// it describes the re-arragement with a mapping, and then calls -// align to re-arrange them. -// -// In a mapping, map_in (map_out/map_set) gives the new type and -// position of each of the old input (output/set) variables. -// For variables being mapped to Input, Output, or Set variables, -// the position is the new position in the tuple. -// For variables being mapped to Exists_Var, Forall_Var, or -// Wildcard_Var, the positions can be used to map multiple -// variables to the same quantified variable, by providing -// the same position. Each variable with a negative position -// is given a unique quantified variable that is NOT listed -// in the seen_exists_ids list. -// I'm not sure what the positions mean for Global_Vars - perhaps -// they are ignored? -// -// Currently, align seems to support only mapping to Set, Input, -// Output, and Exists vars. -// - -class Mapping { -public: - inline Mapping(int no_in, int no_out): n_input(no_in), n_output(no_out) {} - inline Mapping(int no_set): n_input(no_set), n_output(0){} - inline Mapping(const Mapping &m): n_input(m.n_input), n_output(m.n_output) { - int i; - for(i=1; i<=n_input; i++) map_in_kind[i] = m.map_in_kind[i]; - for(i=1; i<=n_input; i++) map_in_pos[i] = m.map_in_pos[i]; - for(i=1; i<=n_output;i++) map_out_kind[i] = m.map_out_kind[i]; - for(i=1; i<=n_output;i++) map_out_pos[i] = m.map_out_pos[i]; - } - - inline void set_map (Var_Kind in_kind, int pos, Var_Kind type, int map) { - if(in_kind==Input_Var) - set_map_in(pos,type,map); - else if(in_kind==Set_Var) - set_map_in(pos,type,map); - else if(in_kind==Output_Var) - set_map_out(pos,type,map); - else - assert(0); - } - - inline void set_map_in (int pos, Var_Kind type, int map) { - assert(pos>=1 && pos<=n_input); - map_in_kind[pos] = type; - map_in_pos[pos] = map; - } - inline void set_map_set (int pos, Var_Kind type, int map) { - assert(pos>=1 && pos<=n_input); - map_in_kind[pos] = type; - map_in_pos[pos] = map; - } - - inline void set_map_out(int pos, Var_Kind type, int map) { - assert(pos>=1 && pos<=n_output); - map_out_kind[pos] = type; - map_out_pos[pos] = map; - } - - inline Var_Kind get_map_in_kind(int pos) const { - assert(pos>=1 && pos<=n_input); - return map_in_kind[pos]; - } - - inline int get_map_in_pos(int pos) const { - assert(pos>=1 && pos<=n_input); - return map_in_pos[pos]; - } - - inline Var_Kind get_map_out_kind(int pos) const { - assert(pos>=1 && pos<=n_output); - return map_out_kind[pos]; - } - - inline int get_map_out_pos(int pos) const { - assert(pos>=1 && pos<=n_output); - return map_out_pos[pos]; - } - - inline int n_in() const { return n_input; } - inline int n_out() const { return n_output; } - - // If a tuple as a whole becomes the new Input or Output tuple, - // return the Tuple of they will become (Input, Output) - // Return Unknown_Tuple otherwise - - inline Argument_Tuple get_tuple_fate(Argument_Tuple t, int prefix = -1) const { - return t== Input_Tuple ? get_input_fate(prefix) : - (t==Output_Tuple ? get_output_fate(prefix) : Unknown_Tuple); } - - inline Argument_Tuple get_set_fate(int prefix = -1) const { - return get_input_fate(prefix); } - - inline Argument_Tuple get_input_fate(int prefix = -1) const { - if (prefix < 0) prefix = n_input; - assert(n_input >= prefix); - if (n_input < prefix) - return Unknown_Tuple; - Var_Kind vf = map_in_kind[1]; - for (int i = 1; i<=prefix; i++) - if (map_in_pos[i]!=i || map_in_kind[i]!=vf) - return Unknown_Tuple; - - return vf == Input_Var ? Input_Tuple - : vf == Set_Var ? Set_Tuple - : vf == Output_Var ? Output_Tuple - : Unknown_Tuple; - } - - inline Argument_Tuple get_output_fate(int prefix = -1) const { - if (prefix < 0) prefix = n_output; - assert(n_output >= prefix); - if (n_output < 1) - return Unknown_Tuple; - Var_Kind vf = map_out_kind[1]; - for (int i = 1; i<=prefix; i++) - if (map_out_pos[i]!=i || map_out_kind[i]!=vf) - return Unknown_Tuple; - return vf == Input_Var ? Input_Tuple - : vf == Set_Var ? Set_Tuple - : vf == Output_Var ? Output_Tuple - : Unknown_Tuple; - } - - inline static Mapping Identity(int inp, int outp) { - Mapping m(inp, outp); int i; - for(i=1; i<=m.n_input; i++) m.set_map(Input_Var, i, Input_Var, i); - for(i=1; i<=m.n_output;i++) m.set_map(Output_Var, i, Output_Var, i); - return m; - } - - inline static Mapping Identity(int setvars) { - Mapping m(setvars); int i; - for(i=1; i<=setvars; i++) m.set_map(Set_Var, i, Set_Var, i); - return m; - } - -private: - int n_input; - int n_output; - Var_Kind map_in_kind[maxVars]; - int map_in_pos[maxVars]; - Var_Kind map_out_kind[maxVars]; - int map_out_pos[maxVars]; -}; - -} // namespace - -#endif diff --git a/omega/omega_lib/include/omega/Relation.h b/omega/omega_lib/include/omega/Relation.h deleted file mode 100644 index b41bef5..0000000 --- a/omega/omega_lib/include/omega/Relation.h +++ /dev/null @@ -1,299 +0,0 @@ -#if ! defined _Relation_h -#define _Relation_h 1 - -#include -#include -#include -#include - -namespace omega { - -// -// Relation representative. -// Body and representative are separated to do reference counting. -// -class Relation { -public: - Relation(); - - Relation(int n_input, int n_output = 0); - Relation(const Relation &r); - Relation(const Relation &r, Conjunct *c); - Relation &operator=(const Relation &r); - Relation(Rel_Body &r, int foo); - - static Relation Null(); - static Relation Empty(const Relation &R); - static Relation True(const Relation &R); - static Relation True(int setvars); - static Relation True(int in, int out); - static Relation False(const Relation &R); - static Relation False(int setvars); - static Relation False(int in, int out); - static Relation Unknown(const Relation &R); - static Relation Unknown(int setvars); - static Relation Unknown(int in, int out); - - - bool is_null() const; - - ~Relation(); - - inline F_Forall *add_forall() - { return rel_body->add_forall(); } - inline F_Exists *add_exists() - { return rel_body->add_exists(); } - inline F_And *add_and() - { return rel_body->add_and(); } - inline F_And *and_with() - { return rel_body->and_with(); } - inline F_Or *add_or() - { return rel_body->add_or(); } - inline F_Not *add_not() - { return rel_body->add_not(); } - inline void finalize() - { rel_body->finalize(); } - inline bool is_finalized() const - { return rel_body->finalized; } - inline bool is_set() const - { return rel_body->is_set(); } - inline int n_inp() const - { return rel_body->n_inp(); } - inline int n_out() const - { return rel_body->n_out(); } - inline int n_set() const - { return rel_body->n_set(); } - - inline const Variable_ID_Tuple *global_decls() const - { return rel_body->global_decls(); } - inline int max_ufs_arity() const - { return rel_body->max_ufs_arity(); } - inline int max_ufs_arity_of_in() const - { return rel_body->max_ufs_arity_of_in(); } - inline int max_ufs_arity_of_set() const - { return rel_body->max_ufs_arity_of_set(); } - inline int max_ufs_arity_of_out() const - { return rel_body->max_ufs_arity_of_out(); } - inline int max_shared_ufs_arity() const - { return rel_body->max_shared_ufs_arity(); } - - inline Variable_ID input_var(int nth) - { return rel_body->input_var(nth); } - inline Variable_ID output_var(int nth) - { return rel_body->output_var(nth); } - inline Variable_ID set_var(int nth) - { return rel_body->set_var(nth); } - inline bool has_local(const Global_Var_ID G) - { return rel_body->has_local(G); } - inline bool has_local(const Global_Var_ID G, Argument_Tuple of) - { return rel_body->has_local(G, of); } - inline Variable_ID get_local(const Variable_ID v) - { return split()->get_local(v); } - inline Variable_ID get_local(const Global_Var_ID G) - { return split()->get_local(G); } - inline Variable_ID get_local(const Global_Var_ID G, Argument_Tuple of) - { return split()->get_local(G, of); } - - inline void name_input_var(int nth, Const_String S) - { split()->name_input_var(nth, S); } - inline void name_output_var(int nth, Const_String S) - { split()->name_output_var(nth, S); } - inline void name_set_var(int nth, Const_String S) - { split()->name_set_var(nth, S); } - - - inline F_And *and_with_and() - { return split()->and_with_and(); } - inline EQ_Handle and_with_EQ() - { return split()->and_with_EQ(); } - inline EQ_Handle and_with_EQ(const Constraint_Handle &c) - { return split()->and_with_EQ(c); } - inline GEQ_Handle and_with_GEQ() - { return split()->and_with_GEQ(); } - inline GEQ_Handle and_with_GEQ(const Constraint_Handle &c) - { return split()->and_with_GEQ(c); } - - inline void print() - { rel_body->print(); } - inline void print(FILE *output_file) - { rel_body->print(output_file); } - inline void print_with_subs() - { rel_body->print_with_subs(); } - inline void print_with_subs(FILE *output_file, bool printSym=false, - bool newline=true) - { rel_body->print_with_subs(output_file, printSym, newline); } - inline std::string print_with_subs_to_string(bool printSym=false, - bool newline=true) - { return rel_body->print_with_subs_to_string(printSym, newline); } - inline std::string print_outputs_with_subs_to_string() - { return rel_body->print_outputs_with_subs_to_string(); } - inline std::string print_outputs_with_subs_to_string(int i) - { return rel_body->print_outputs_with_subs_to_string(i); } - inline void prefix_print() - { rel_body->prefix_print(); } - inline void prefix_print(FILE *output_file, int debug = 1) - { rel_body->prefix_print(output_file, debug); } - inline std::string print_formula_to_string() { - return rel_body->print_formula_to_string(); - } - void dimensions(int & ndim_all, int &ndim_domain); - - inline bool is_lower_bound_satisfiable() - { return rel_body->is_lower_bound_satisfiable(); } - inline bool is_upper_bound_satisfiable() - { return rel_body->is_upper_bound_satisfiable(); } - inline bool is_satisfiable() - { return rel_body->is_satisfiable(); } - - inline bool is_tautology() - { return rel_body->is_obvious_tautology(); } // for compatibility - inline bool is_obvious_tautology() - { return rel_body->is_obvious_tautology(); } - inline bool is_definite_tautology() - { return rel_body->is_definite_tautology(); } - - // return x s.t. forall conjuncts c, c has >= x leading 0s - // for set, return -1 (pass this in, in case there are no conjuncts - inline int number_of_conjuncts() - { return rel_body->query_DNF()->length(); } - - // return x s.t. forall conjuncts c, c has >= x leading 0s - // for set, return -1 (pass this in, in case there are no conjuncts - inline int query_guaranteed_leading_0s() - { return rel_body->query_DNF()->query_guaranteed_leading_0s(this->is_set() ? -1 : 0); } - - // return x s.t. forall conjuncts c, c has <= x leading 0s - // if no conjuncts return min of input and output tuple sizes, or -1 if relation is a set - inline int query_possible_leading_0s() - { return rel_body->query_DNF()->query_possible_leading_0s( - this->is_set()? -1 : min(n_inp(),n_out())); } - - // return +-1 according to sign of leading dir, or 0 if we don't know - inline int query_leading_dir() - { return rel_body->query_DNF()->query_leading_dir(); } - - inline DNF* query_DNF() - { return rel_body->query_DNF(); } - inline DNF* query_DNF(int rdt_conjs, int rdt_constrs) - { return rel_body->query_DNF(rdt_conjs, rdt_constrs); } - inline void simplify(int rdt_conjs = 0, int rdt_constrs = 0) - { rel_body->simplify(rdt_conjs, rdt_constrs); } - inline bool is_simplified() - { return rel_body->is_simplified(); } - inline bool is_compressed() const - { return rel_body->is_compressed(); } - inline Conjunct *rm_first_conjunct() - { return rel_body->rm_first_conjunct(); } - inline Conjunct *single_conjunct() - { return rel_body->single_conjunct(); } - inline bool has_single_conjunct() - { return rel_body->has_single_conjunct(); } - - - void query_difference(Variable_ID v1, Variable_ID v2, coef_t &lowerBound, coef_t &upperBound, bool &guaranteed) { - rel_body->query_difference(v1, v2, lowerBound, upperBound, guaranteed); - } - void query_variable_bounds(Variable_ID v, coef_t &lowerBound, coef_t &upperBound) { - rel_body->query_variable_bounds(v,lowerBound,upperBound); - } - coef_t query_variable_mod(Variable_ID v, coef_t factor) { - assert(factor > 0); - return rel_body->query_variable_mod(v, factor); - } - int query_variable_mod(Variable_ID v, int factor) { - assert(sizeof(int) <= sizeof(coef_t)); - coef_t result = rel_body->query_variable_mod(v, static_cast(factor)); - if (result == posInfinity) - return INT_MAX; - else - return static_cast(result); - } - - - inline void make_level_carried_to(int level) - { - split()->make_level_carried_to(level); - } - - inline Relation extract_dnf_by_carried_level(int level, int direction) - { - return split()->extract_dnf_by_carried_level(level, direction); - } - - inline void compress() - { -#if defined(INCLUDE_COMPRESSION) - split()->compress(); -#endif - } - void uncompress() - { rel_body->uncompress(); } - - inline bool is_exact() const - { return !(rel_body->unknown_uses() & (and_u | or_u)) ; } - inline bool is_inexact() const - { return !is_exact(); } - inline bool is_unknown() const - { return rel_body->is_unknown(); } - inline Rel_Unknown_Uses unknown_uses() const - { return rel_body->unknown_uses(); } - - void setup_names() {rel_body->setup_names();} - void copy_names(const Relation &r) { - copy_names(*r.rel_body); - }; - void copy_names(Rel_Body &r); - -private: - // Functions that have to create sets from relations: - friend class Rel_Body; - friend_rel_ops; - - - Rel_Body *split(); - - DNF* simplified_DNF() { - simplify(); - return rel_body->simplified_DNF; - }; - - inline void invalidate_leading_info(int changed = -1) - { split()->invalidate_leading_info(changed); } - inline void enforce_leading_info(int guaranteed, int possible, int dir) - { - split()->enforce_leading_info(guaranteed, possible, dir); - } - - - void makeSet(); - void markAsSet(); - void markAsRelation(); - - friend bool operator==(const Relation &, const Relation &); - - void reverse_leading_dir_info() - { split()->reverse_leading_dir_info(); } - void interpret_unknown_as_true() - { split()->interpret_unknown_as_true(); } - void interpret_unknown_as_false() - { split()->interpret_unknown_as_false(); } - - - Rel_Body *rel_body; - - - friend Relation merge_rels(Tuple &R, const Tuple > > &mapping, const Tuple &inverse, Combine_Type ctype, int number_input, int number_output); -}; - -inline std::ostream & operator<<(std::ostream &o, Relation &R) -{ - return o << R.print_with_subs_to_string(); -} - -Relation copy(const Relation &r); - -} // namespace - -#include - -#endif diff --git a/omega/omega_lib/include/omega/Relations.h b/omega/omega_lib/include/omega/Relations.h deleted file mode 100644 index 4fd81e6..0000000 --- a/omega/omega_lib/include/omega/Relations.h +++ /dev/null @@ -1,88 +0,0 @@ -#if ! defined _Relations_h -#define _Relations_h 1 - -#include -#include - -namespace omega { - -// UPDATE friend_rel_ops IN pres_gen.h WHEN ADDING TO THIS LIST -// REMEMBER TO TAKE OUT DEFAULT ARGUMENTS IN THAT FILE - -/* The following allows us to avoid warnings about passing - temporaries as non-const references. This is useful but - has suddenly become illegal. */ -Relation consume_and_regurgitate(NOT_CONST Relation &R); - -// -// Operations over relations -// -Relation Union(NOT_CONST Relation &r1, NOT_CONST Relation &r2); -Relation Intersection(NOT_CONST Relation &r1, NOT_CONST Relation &r2); -Relation Extend_Domain(NOT_CONST Relation &R); -Relation Extend_Domain(NOT_CONST Relation &R, int more); -Relation Extend_Range(NOT_CONST Relation &R); -Relation Extend_Range(NOT_CONST Relation &R, int more); -Relation Extend_Set(NOT_CONST Relation &R); -Relation Extend_Set(NOT_CONST Relation &R, int more); -Relation Restrict_Domain(NOT_CONST Relation &r1, NOT_CONST Relation &r2); // Takes set as 2nd -Relation Restrict_Range(NOT_CONST Relation &r1, NOT_CONST Relation &r2); // Takes set as 2nd -Relation Domain(NOT_CONST Relation &r); // Returns set -Relation Range(NOT_CONST Relation &r); // Returns set -Relation Cross_Product(NOT_CONST Relation &A, NOT_CONST Relation &B); // Takes two sets -Relation Inverse(NOT_CONST Relation &r); -Relation After(NOT_CONST Relation &r, int carried_by, int new_output,int dir=1); -Relation Deltas(NOT_CONST Relation &R); // Returns set -Relation Deltas(NOT_CONST Relation &R, int eq_no); // Returns set -Relation DeltasToRelation(NOT_CONST Relation &R, int n_input, int n_output); -Relation Complement(NOT_CONST Relation &r); -Relation Project(NOT_CONST Relation &R, Global_Var_ID v); -Relation Project(NOT_CONST Relation &r, int pos, Var_Kind vkind); -Relation Project(NOT_CONST Relation &S, Variable_ID v); -Relation Project(NOT_CONST Relation &S, Sequence &s); -Relation Project_Sym(NOT_CONST Relation &R); -Relation Project_On_Sym(NOT_CONST Relation &R, - NOT_CONST Relation &context = Relation::Null()); -Relation GistSingleConjunct(NOT_CONST Relation &R, NOT_CONST Relation &R2, int effort=0); -Relation Gist(NOT_CONST Relation &R1, NOT_CONST Relation &R2, int effort=0); -Relation Difference(NOT_CONST Relation &r1, NOT_CONST Relation &r2); -Relation Approximate(NOT_CONST Relation &R, bool strides_allowed = false); -Relation Identity(int n_inp); -Relation Identity(NOT_CONST Relation &r); -bool Must_Be_Subset(NOT_CONST Relation &r1, NOT_CONST Relation &r2); -bool Might_Be_Subset(NOT_CONST Relation &r1, NOT_CONST Relation &r2); -// May is the same as might, just another name -bool May_Be_Subset(NOT_CONST Relation &r1, NOT_CONST Relation &r2); -bool Is_Obvious_Subset(NOT_CONST Relation &r1, NOT_CONST Relation &r2); -Relation Composition(NOT_CONST Relation &F, NOT_CONST Relation &G); -bool prepare_relations_for_composition(Relation &F, Relation &G); -Relation Join(NOT_CONST Relation &G, NOT_CONST Relation &F); -Relation EQs_to_GEQs(NOT_CONST Relation &, bool excludeStrides=false); -Relation Symbolic_Solution(NOT_CONST Relation &S); -Relation Symbolic_Solution(NOT_CONST Relation &S, Sequence &T); -Relation Sample_Solution(NOT_CONST Relation &S); -Relation Solution(NOT_CONST Relation &S, Sequence &T); -Relation Upper_Bound(NOT_CONST Relation &r); -Relation Lower_Bound(NOT_CONST Relation &r); - -Relation merge_rels(Tuple &R, const Tuple > > &mapping, const Tuple &inverse, Combine_Type ctype, int number_input = -1, int number_output = -1); - -// The followings might retire in the futrue!!! -void MapRel1(Relation &inputRel, - const Mapping &map, - Combine_Type ctype, - int number_input=-1, int number_output=-1, - bool invalidate_resulting_leading_info = true, - bool finalize = true); -Relation MapAndCombineRel2(Relation &R1, Relation &R2, - const Mapping &mapping1, const Mapping &mapping2, - Combine_Type ctype, - int number_input=-1, int number_output=-1); -void align(Rel_Body *originalr, Rel_Body *newr, F_Exists *fe, - Formula *f, const Mapping &mapping, bool &newrIsSet, - List &seen_exists, - Variable_ID_Tuple &seen_exists_ids); - -} // namespace - -#endif diff --git a/omega/omega_lib/include/omega/closure.h b/omega/omega_lib/include/omega/closure.h deleted file mode 100644 index 67088dd..0000000 --- a/omega/omega_lib/include/omega/closure.h +++ /dev/null @@ -1,31 +0,0 @@ -#if ! defined _closure_h -#define _closure_h - -#include - -namespace omega { - -Relation VennDiagramForm( - Tuple &Rs, - NOT_CONST Relation &Context_In); -Relation VennDiagramForm( - NOT_CONST Relation &R_In, - NOT_CONST Relation &Context_In = Relation::Null()); - -// Given a Relation R, returns a relation deltas -// that correspond to the ConicHull of the detlas of R -Relation ConicClosure (NOT_CONST Relation &R); - -Relation TransitiveClosure (NOT_CONST Relation &r, - int maxExpansion = 1, - NOT_CONST Relation &IterationSpace=Relation::Null()); - -/* Tomasz Klimek */ -Relation calculateTransitiveClosure(NOT_CONST Relation &r); - -/* Tomasz Klimek */ -Relation ApproxClosure(NOT_CONST Relation &r); - -} // namespace - -#endif diff --git a/omega/omega_lib/include/omega/evac.h b/omega/omega_lib/include/omega/evac.h deleted file mode 100644 index a561f8c..0000000 --- a/omega/omega_lib/include/omega/evac.h +++ /dev/null @@ -1,15 +0,0 @@ -#if defined STUDY_EVACUATIONS - -namespace omega { - -// study the evacuation from one side of C to the other for UFS's of -// arity up to max_arity -extern void study_evacuation(Conjunct *C, which_way dir, int max_arity); - -// study the evacuation from the joined C2's output and C1's input to -// either of the other possible tuples -extern void study_evacuation(Conjunct *C1, Conjunct *C2, int max_arity); - -} // namespace - -#endif diff --git a/omega/omega_lib/include/omega/farkas.h b/omega/omega_lib/include/omega/farkas.h deleted file mode 100644 index e77ed66..0000000 --- a/omega/omega_lib/include/omega/farkas.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef Already_Included_Affine_Closure -#define Already_Included_Affine_Closure - -#include - -namespace omega { - -enum Farkas_Type {Basic_Farkas, Decoupled_Farkas, - Linear_Combination_Farkas, Positive_Combination_Farkas, - Affine_Combination_Farkas, Convex_Combination_Farkas }; - -Relation Farkas(NOT_CONST Relation &R, Farkas_Type op, bool early_bailout = false); - -extern coef_t farkasDifficulty; -extern Global_Var_ID coefficient_of_constant_term; - -} // namespace - -#endif diff --git a/omega/omega_lib/include/omega/hull.h b/omega/omega_lib/include/omega/hull.h deleted file mode 100644 index 928d0c6..0000000 --- a/omega/omega_lib/include/omega/hull.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef Already_Included_Hull -#define Already_Included_Hull - -#include - -namespace omega { - -Relation SimpleHull(const Relation &R, bool allow_stride_constraint = false, bool allow_irregular_constraint = false); -Relation SimpleHull(const std::vector &Rs, bool allow_stride_constraint = false, bool allow_irregular_constraint = false); - - -// All of the following first call approximate on R to -// eliminate any wildcards and strides. - -// x in Convex Hull of R -// iff -// exist a_i, y_i s.t. -// x = Sum_i a_i y_i s.t. -// forall i, y_i in R -// forall i, a_i >=0 -// sum_i a_i = 1 -Relation ConvexHull(NOT_CONST Relation &R); - -// DecoupledConvexHull is the same as ConvexHull, -// except that it only finds constraints that involve -// both variables x&y if there is a constraint -// that involves both x&y in one of the conjuncts -// of R. -Relation DecoupledConvexHull(NOT_CONST Relation &R); - -// The affine hull just consists of equality constraints -// but is otherwise the tightest hull on R. -// x in Affine Hull of R -// iff -// exist a_i, y_i s.t. -// x = Sum_i a_i y_i s.t. -// forall i, y_i in R -// sum_i a_i = 1 -Relation AffineHull(NOT_CONST Relation &R); - -// x in Linear Hull of R -// iff -// exist a_i, y_i s.t. -// x = Sum_i a_i y_i s.t. -// forall i, y_i in R -Relation LinearHull(NOT_CONST Relation &R); - -// The conic hull is the tighest cone that contains R -// x in Conic Hull of R. -// iff -// exist a_i, y_i s.t. -// x = Sum_i a_i y_i s.t. -// forall i, y_i in R -// forall i, a_i >=0 -Relation ConicHull(NOT_CONST Relation &R); - -// RectHull includes readily-available constraints from relation -// that can be part of hull, plus rectangular bounds calculated -// from input/output/set variables' range. -Relation RectHull(NOT_CONST Relation &Rel); - -// A constraint is in the result of QuickHull only if it appears in one of -// the relations and is directly implied by a single constraint in each of -// the other relations. -Relation QuickHull(Relation &R); // deprecated -Relation QuickHull(Tuple &Rs); // deprecated - -Relation FastTightHull(NOT_CONST Relation &input_R, - NOT_CONST Relation &input_H); -Relation Hull(NOT_CONST Relation &R, - bool stridesAllowed = false, - int effort=1, - NOT_CONST Relation &knownHull = Relation::Null() - ); -Relation Hull(Tuple &Rs, - const std::vector &validMask, - int effort = 1, - bool stridesAllowed = false, - NOT_CONST Relation &knownHull = Relation::Null()); - -// If a union of several conjuncts is a convex, their union -// representaition can be simplified by their convex hull. -Relation ConvexRepresentation(NOT_CONST Relation &R); -Relation CheckForConvexPairs(NOT_CONST Relation &S); // deprecated -Relation CheckForConvexRepresentation(NOT_CONST Relation &R_In); // deprecated - -} - -#endif diff --git a/omega/omega_lib/include/omega/omega_core/debugging.h b/omega/omega_lib/include/omega/omega_core/debugging.h deleted file mode 100644 index e217ae9..0000000 --- a/omega/omega_lib/include/omega/omega_core/debugging.h +++ /dev/null @@ -1,30 +0,0 @@ -#if !defined(Already_included_debugging) -#define Already_included_debugging - -// Debugging flags. Can set any of these. - -#include -#include - -namespace omega { - - - -extern int omega_core_debug; -extern int pres_debug; -extern int relation_debug; -extern int closure_presburger_debug; -extern int hull_debug; -extern int farkas_debug; -extern int code_gen_debug; - -enum negation_control { any_negation, one_geq_or_eq, one_geq_or_stride }; -extern negation_control pres_legal_negations; - -#if defined STUDY_EVACUATIONS -extern int evac_debug; -#endif - -} // namespace - -#endif diff --git a/omega/omega_lib/include/omega/omega_core/oc.h b/omega/omega_lib/include/omega/omega_core/oc.h deleted file mode 100644 index e4f5444..0000000 --- a/omega/omega_lib/include/omega/omega_core/oc.h +++ /dev/null @@ -1,350 +0,0 @@ -#ifndef Already_Included_OC -#define Already_Included_OC 1 - -#include -#include -#include -#include -#include - -namespace omega { - -// Manu:: commented the line below -- fortran bug workaround -//#define maxVars 256 /* original 56, increased by chun */ -#define maxVars 100 - -extern int maxGEQs; -extern int maxEQs; - -// Manu:: commented the lines below -- fortran bug workaround -//const int maxmaxGEQs = 2048; // original 512, increaded by chun -//const int maxmaxEQs = 512; // original 256, increased by chun -const int maxmaxGEQs = 512; -const int maxmaxEQs = 256; - -/* #if ! defined maxmaxGEQs */ -/* #define maxmaxGEQs 2048 /\* original 512, increaded by chun *\/ */ -/* #endif */ -/* #if ! defined maxmaxEQs */ -/* #define maxmaxEQs 512 /\* original 256, increased by chun *\/ */ -/* #endif */ - - -#if 0 -#if ! defined Already_Included_Portable -typedef unsigned char bool; /* what a gross thing to do */ -#endif -#endif - -typedef int EqnKey; - -enum {EQ_BLACK = 0, EQ_RED = 1}; -enum {OC_SOLVE_UNKNOWN = 2, OC_SOLVE_SIMPLIFY = 3}; - -struct eqn { - EqnKey key; - coef_t touched; // see oc_simple.c - int color; - int essential; - int varCount; - coef_t coef[maxVars + 1]; -}; - -// typedef eqn * Eqn; -enum redType {notRed=0, redEQ, redGEQ, redLEQ, redStride}; -enum redCheck {noRed=0, redFalse, redConstraints}; -enum normalizeReturnType {normalize_false, normalize_uncoupled, - normalize_coupled}; - -extern char wildName[200][20]; - -extern FILE *outputFile; /* printProblem writes its output to this file */ -#define doTrace (trace && TRACE) -#define isRed(e) (desiredResult == OC_SOLVE_SIMPLIFY && (e)->color) -// #define eqnncpy(e1,e2,s) {int *p00,*q00,*r00; p00 = (int *)(e1); q00 = (int *)(e2); r00 = &p00[headerWords+1+s]; while(p00 < r00) *p00++ = *q00++; } -// #define eqncpy(e1,e2) eqnncpy(e1,e2,nVars) -// #define eqnnzero(e,s) {int *p00,*r00; p00 = (int *)(e); r00 = &p00[headerWords+1+(s)]; while(p00 < r00) *p00++ = 0;} -// #define eqnzero(e) eqnnzero(e,nVars) - -//void eqnncpy(eqn *dest, eqn *src, int); -//void eqnnzero(eqn *e, int); - -inline void eqnncpy(eqn *dest, eqn *src, int nVars) { - dest->key = src->key; - dest->touched = src->touched; - dest->color = src->color; - dest->essential = src->essential; - dest->varCount = src->varCount; - for (int i = 0; i <= nVars; i++) - dest->coef[i] = src->coef[i]; -} - - -inline void eqnnzero(eqn *e, int nVars) { - e->key = 0; - e->touched = 0; - e->color = EQ_BLACK; - e->essential = 0; - e->varCount = 0; - for (int i = 0; i <= nVars; i++) - e->coef[i] = 0; -} - -extern int mayBeRed; - -#ifdef SPEED -#define TRACE 0 -#define DBUG 0 -#define DEBUG 0 -#else -#define TRACE (omega_core_debug) -#define DBUG (omega_core_debug > 1) -#define DEBUG (omega_core_debug > 2) -#endif - - -class Memory { -public: - int length; - coef_t stride; - redType kind; - coef_t constantTerm; - coef_t coef[maxVars + 1]; - int var[maxVars + 1]; -}; - -/* #define headerWords ((4*sizeof(int) + sizeof(coef_t))/sizeof(int)) */ - -void check_number_EQs(int); -void check_number_GEQs(int); -extern eqn SUBs[]; -extern Memory redMemory[]; - -class Problem { -public: - short nVars, safeVars; - short nEQs, nGEQs,nSUBs,nMemories,allocEQs,allocGEQs; - short varsOfInterest; - bool variablesInitialized; - bool variablesFreed; - short var[maxVars+2]; - short forwardingAddress[maxVars+2]; - // int variableColor[maxVars+2]; - int hashVersion; - const char *(*get_var_name)(unsigned int var, void *args); - void *getVarNameArgs; - eqn *GEQs; - eqn *EQs; - bool isTemporary; - - Problem(int in_eqs=0, int in_geqs=0); - Problem(const Problem &); - ~Problem(); - Problem & operator=(const Problem &); - -/* Allocation parameters and functions */ - - static const int min_alloc,first_alloc_pad; - int padEQs(int oldalloc, int newreq) { - check_number_EQs(newreq); - return min((newreq < 2*oldalloc ? 2*oldalloc : 2*newreq),maxmaxEQs); - } - int padGEQs(int oldalloc, int newreq) { - check_number_GEQs(newreq); - return min((newreq < 2*oldalloc ? 2*oldalloc : 2*newreq),maxmaxGEQs); - } - int padEQs(int newreq) { - check_number_EQs(newreq); - return min(max(newreq+first_alloc_pad,min_alloc), maxmaxEQs); - } - int padGEQs(int newreq) { - check_number_GEQs(newreq); - return min(max(newreq+first_alloc_pad,min_alloc), maxmaxGEQs); - } - - - void zeroVariable(int i); - - void putVariablesInStandardOrder(); - void noteEssential(int onlyWildcards); - int findDifference(int e, int &v1, int &v2); - int chainKill(int color,int onlyWildcards); - - int newGEQ(); - int newEQ(); - int newSUB(){ - return nSUBs++; - } - - - void initializeProblem(); - void initializeVariables() const; - void printProblem(int debug = 1) const; - void printSub(int v) const; - std::string print_sub_to_string(int v) const; - void clearSubs(); - void printRedEquations() const; - int countRedEquations() const; - int countRedGEQs() const; - int countRedEQs() const; - int countRedSUBs() const; - void difficulty(int &numberNZs, coef_t &maxMinAbsCoef, coef_t &sumMinAbsCoef) const; - int prettyPrintProblem() const; - std::string prettyPrintProblemToString() const; - int prettyPrintRedEquations() const; - int simplifyProblem(int verify, int subs, int redundantElimination); - int simplifyProblem(); - int simplifyAndVerifyProblem(); - int simplifyApproximate(bool strides_allowed); - void coalesce(); - void partialElimination(); - void unprotectVariable(int var); - void negateGEQ(int); - void convertEQstoGEQs(bool excludeStrides); - void convertEQtoGEQs(int eq); - void nameWildcard(int i); - void useWildNames(); - void ordered_elimination(int symbolic); - int eliminateRedundant (bool expensive); - void eliminateRed(bool expensive); - void constrainVariableSign(int color, int var, int sign); - void constrainVariableValue(int color, int var, int value); - void query_difference(int v1, int v2, coef_t &lowerBound, coef_t &upperBound, bool &guaranteed); - int solve(int desiredResult); - std::string print_term_to_string(const eqn *e, int c) const; - void printTerm(const eqn * e, int c) const; - std::string printEqnToString(const eqn * e, int test, int extra) const; - void sprintEqn(char *str, const eqn * e, int is_geq,int extra) const; - void printEqn(const eqn * e, int is_geq, int extra) const; - void printEQ(const eqn *e) const {printEqn(e,0,0); } - std::string print_EQ_to_string(const eqn *e) const {return printEqnToString(e,0,0);} - std::string print_GEQ_to_string(const eqn *e) const {return printEqnToString(e,1,0);} - void printGEQ(const eqn *e) const {printEqn(e,1,0); } - void printGEQextra(const eqn *e) const {printEqn(e,1,1); } - void printSubstitution(int s) const; - void printVars(int debug = 1) const; - void swapVars(int i, int j); - void reverseProtectedVariables(); - redCheck redSimplifyProblem(int effort, int computeGist); - - // calculate value of variable mod integer from set of equations -- by chun 12/14/2006 - coef_t query_variable_mod(int v, coef_t factor, int color=EQ_BLACK, int nModularEQs=0, int nModularVars=0) const; - coef_t query_variable_mod(int v, coef_t factor, int color, int nModularEQs, int nModularVars, Tuple &working_on) const; // helper function - - int queryVariable(int i, coef_t *lowerBound, coef_t *upperBound); - int query_variable_bounds(int i, coef_t *l, coef_t *u); - void queryCoupledVariable(int i, coef_t *l, coef_t *u, int *couldBeZero, coef_t lowerBound, coef_t upperBound); - int queryVariableSigns(int i, int dd_lt, int dd_eq, int dd_gt, coef_t lowerBound, coef_t upperBound, bool *distKnown, coef_t *dist); - void addingEqualityConstraint(int e); - normalizeReturnType normalize(); - void normalize_ext(); - void cleanoutWildcards(); - void substitute(eqn *sub, int i, coef_t c); - void deleteVariable( int i); - void deleteBlack(); - int addNewProtectedWildcard(); - int addNewUnprotectedWildcard(); - int protectWildcard( int i); - void doMod( coef_t factor, int e, int j); - void freeEliminations( int fv); - int verifyProblem(); - void resurrectSubs(); - int solveEQ(); - int combineToTighten() ; - int quickKill(int onlyWildcards, bool desperate = false); - int expensiveEqualityCheck(); - int expensiveRedKill(); - int expensiveKill(); - int smoothWeirdEquations(); - void quickRedKill(int computeGist); - void chainUnprotect(); - void freeRedEliminations(); - void doElimination( int e, int i); - void analyzeElimination( - int &v, - int &darkConstraints, - int &darkShadowFeasible, - int &unit, - coef_t ¶llelSplinters, - coef_t &disjointSplinters, - coef_t &lbSplinters, - coef_t &ubSplinters, - int ¶llelLB); - int parallelSplinter(int e, int diff, int desiredResult); - int solveGEQ( int desiredResult); - void setInternals(); - void setExternals(); - int reduceProblem(); - void problem_merge(Problem &); - void deleteRed(); - void turnRedBlack(); - void checkGistInvariant() const; - void check() const; - coef_t checkSum() const; - void rememberRedConstraint(eqn *e, redType type, coef_t stride); - void recallRedMemories(); - void simplifyStrideConstraints(); - const char * orgVariable(int i) const { - return ((i == 0) ? // cfront likes this form better - "1" : - ((i < 0) ? - wildName[-i] : - (*get_var_name)(i,getVarNameArgs))); - }; - const char * variable(int i) const { - return orgVariable(var[i]) ; - }; - - void deleteGEQ(int e) { - if (DEBUG) { - fprintf(outputFile,"Deleting %d (last:%d): ",e,nGEQs-1); - printGEQ(&GEQs[e]); - fprintf(outputFile,"\n"); - }; - if (e < nGEQs-1) - eqnncpy (&GEQs[e], &GEQs[nGEQs - 1],(nVars)); - nGEQs--; - }; - void deleteEQ(int e) { - if (DEBUG) { - fprintf(outputFile,"Deleting %d (last:%d): ",e,nEQs-1); - printGEQ(&EQs[e]); - fprintf(outputFile,"\n"); - }; - if (e < nEQs-1) - eqnncpy (&EQs[e], &EQs[nEQs - 1],(nVars)); - nEQs--; - }; - -}; - - - -/* #define UNKNOWN 2 */ -/* #define SIMPLIFY 3 */ -/* #define _red 1 */ -/* #define black 0 */ - - -extern int print_in_code_gen_style; - - -void initializeOmega(void); - - -/* set extra to 0 for normal use */ -int singleVarGEQ(eqn *e); - -void setPrintLevel(int level); - -void printHeader(); - -void setOutputFile(FILE *file); - -extern void check_number_EQs(int nEQs); -extern void check_number_GEQs(int nGEQs); -extern void checkVars(int nVars); - -} // namespace - -#endif diff --git a/omega/omega_lib/include/omega/omega_core/oc_i.h b/omega/omega_lib/include/omega/omega_core/oc_i.h deleted file mode 100644 index 9533a40..0000000 --- a/omega/omega_lib/include/omega/omega_core/oc_i.h +++ /dev/null @@ -1,79 +0,0 @@ -#if !defined(Already_included_oc_i) -#define Already_included_oc_i - -#include -#include -#include -#include -#include -#include - -namespace omega { - -#define maxWildcards 18 - -extern int findingImplicitEqualities; -extern int firstCheckForRedundantEquations; -extern int use_ugly_names; -extern int doItAgain; -extern int newVar; -extern int conservative; -extern FILE *outputFile; /* printProblem writes its output to this file */ -extern int nextWildcard; -extern int trace; -extern int depth; -extern int packing[maxVars]; -extern int headerLevel; -extern int inApproximateMode; -extern int inStridesAllowedMode; -extern int addingOuterEqualities; -extern int outerColor; - -const int keyMult = 31; -const int hashTableSize =5*maxmaxGEQs; -const int maxKeys = 8*maxmaxGEQs; -extern int hashVersion; -extern eqn hashMaster[hashTableSize]; -extern int fastLookup[maxKeys*2]; -extern int nextKey; - -extern int reduceWithSubs; -extern int pleaseNoEqualitiesInSimplifiedProblems; - -#define noProblem ((Problem *) 0) - -extern Problem *originalProblem; -int checkIfSingleVar(eqn *e, int i); -/* Solve e = factor alpha for x_j and substitute */ - -void negateCoefficients(eqn * eqn, int nV); - -extern int omegaInitialized; -extern Problem full_answer, context,redProblem; - -#if defined BRAIN_DAMAGED_FREE -static inline void free(const Problem *p) -{ - free((char *)p); -} -#endif - -#if defined NDEBUG -#define CHECK_FOR_DUPLICATE_VARIABLE_NAMES -#else -#define CHECK_FOR_DUPLICATE_VARIABLE_NAMES \ - { \ - std::vector name(nVars); \ - for(int i=1; i<=nVars; i++) { \ - name[i-1] = variable(i); \ - assert(!name[i-1].empty()); \ - for(int j=1; j - -namespace omega { - -/* #define Assert(c,t) if(!(c)) PresErrAssert(t) */ -/* void PresErrAssert(const char *t); */ - -extern Rel_Body null_rel; - -extern int skip_finalization_check; -// extern int skip_set_checks; - -// Global input and output variable tuples. - -extern Global_Input_Output_Tuple input_vars; -extern Global_Input_Output_Tuple output_vars; -extern Global_Input_Output_Tuple &set_vars; - -} // namespace - -#if ! defined DONT_INCLUDE_TEMPLATE_CODE -// with g++258, everything will need to make Tuple, as a -// function taking it as an argument is a friend of lots of classes -#include -#endif - -#endif diff --git a/omega/omega_lib/include/omega/pres_cmpr.h b/omega/omega_lib/include/omega/pres_cmpr.h deleted file mode 100644 index fb3e6f0..0000000 --- a/omega/omega_lib/include/omega/pres_cmpr.h +++ /dev/null @@ -1,49 +0,0 @@ -#if ! defined _pres_cmpr_h -#define _pres_cmpr_h 1 - -#include - -namespace omega { - -// -// Compressed problem: rectangular non-0 cut from the big problem. -// -class Comp_Constraints { -public: - Comp_Constraints(eqn *constrs, int no_constrs, int no_vars); - void UncompressConstr(eqn *constrs, short &pn_constrs); - ~Comp_Constraints(); - bool no_constraints() const - { return n_constrs == 0; } - int n_constraints() const - { return n_constrs; } - -protected: - inline int coef_index(int e, int v) - {return e*(n_vars+1) + v;} - -private: - int n_constrs; - int n_vars; - coef_t *coefs; -}; - -class Comp_Problem { -public: - Comp_Problem(Problem *problem); - Problem *UncompressProblem(); - bool no_constraints() const - { return eqs.no_constraints() && geqs.no_constraints(); } - -private: -/* === data === */ - int _nVars, _safeVars; - const char *(*_get_var_name)(unsigned int var, void *args); - void *_getVarNameArgs; - Comp_Constraints eqs; - Comp_Constraints geqs; -}; - -} // namespace - -#endif diff --git a/omega/omega_lib/include/omega/pres_cnstr.h b/omega/omega_lib/include/omega/pres_cnstr.h deleted file mode 100644 index 7b2d98d..0000000 --- a/omega/omega_lib/include/omega/pres_cnstr.h +++ /dev/null @@ -1,192 +0,0 @@ -#if ! defined _pres_cnstr_h -#define _pres_cnstr_h 1 - -#include -#include - -namespace omega { - -// -// Constraint handles -// - - - -void copy_constraint(Constraint_Handle H, const Constraint_Handle initial); - -class Constraint_Handle { -public: - Constraint_Handle() {} - virtual ~Constraint_Handle() {} - - void update_coef(Variable_ID, coef_t delta); - void update_const(coef_t delta); - coef_t get_coef(Variable_ID v) const; - coef_t get_const() const; - bool has_wildcards() const; - int max_tuple_pos() const; - int min_tuple_pos() const; - bool is_const(Variable_ID v); - bool is_const_except_for_global(Variable_ID v); - - virtual std::string print_to_string() const; - virtual std::string print_term_to_string() const; - - Variable_ID get_local(const Global_Var_ID G); - Variable_ID get_local(const Global_Var_ID G, Argument_Tuple of); - // not sure that the second one can be used in a meaningful - // way if the conjunct is in multiple relations - - void finalize(); - void multiply(int multiplier); - Rel_Body *relation() const; - - -protected: - Conjunct *c; - eqn **eqns; - int e; - - friend class Constr_Vars_Iter; - friend class Constraint_Iterator; - - Constraint_Handle(Conjunct *, eqn **, int); - -#if defined PROTECTED_DOESNT_WORK - friend class EQ_Handle; - friend class GEQ_Handle; -#endif - - void update_coef_during_simplify(Variable_ID, coef_t delta); - void update_const_during_simplify(coef_t delta); - coef_t get_const_during_simplify() const; - coef_t get_coef_during_simplify(Variable_ID v) const; - - -public: - friend class Conjunct; // assert_leading_info updates coef's - // as does move_UFS_to_input - friend class DNF; // and DNF::make_level_carried_to - - friend void copy_constraint(Constraint_Handle H, - const Constraint_Handle initial); - // copy_constraint does updates and gets at c and e - -}; - -class GEQ_Handle : public Constraint_Handle { -public: - inline GEQ_Handle() {} - - virtual std::string print_to_string() const; - virtual std::string print_term_to_string() const; - bool operator==(const Constraint_Handle &that); - - void negate(); - -private: - friend class Conjunct; - friend class GEQ_Iterator; - - GEQ_Handle(Conjunct *, int); -}; - - -class EQ_Handle : public Constraint_Handle { -public: - inline EQ_Handle() {} - - virtual std::string print_to_string() const; - virtual std::string print_term_to_string() const; - bool operator==(const Constraint_Handle &that); - -private: - friend class Conjunct; - friend class EQ_Iterator; - - EQ_Handle(Conjunct *, int); -}; - - -// -// Conjuct iterators -- for querying resulting DNF. -// -class Constraint_Iterator : public Generator { -public: - Constraint_Iterator(Conjunct *); - int live() const; - void operator++(int); - void operator++(); - Constraint_Handle operator* (); - Constraint_Handle operator* () const; - -private: - Conjunct *c; - int current,last; - eqn **eqns; -}; - - -class EQ_Iterator : public Generator { -public: - EQ_Iterator(Conjunct *); - int live() const; - void operator++(int); - void operator++(); - EQ_Handle operator* (); - EQ_Handle operator* () const; - -private: - Conjunct *c; - int current, last; -}; - - -class GEQ_Iterator : public Generator { -public: - GEQ_Iterator(Conjunct *); - int live() const; - void operator++(int); - void operator++(); - GEQ_Handle operator* (); - GEQ_Handle operator* () const; - -private: - Conjunct *c; - int current, last; -}; - - -// -// Variables of constraint iterator. -// -struct Variable_Info { - Variable_ID var; - coef_t coef; - Variable_Info(Variable_ID _var, coef_t _coef) - { var = _var; coef = _coef; } -}; - -class Constr_Vars_Iter : public Generator { -public: - Constr_Vars_Iter(const Constraint_Handle &ch, bool _wild_only = false); - int live() const; - void operator++(int); - void operator++(); - Variable_Info operator*() const; - - Variable_ID curr_var() const; - coef_t curr_coef() const; - -private: - eqn **eqns; - int e; - Problem *prob; - Variable_ID_Tuple &vars; - bool wild_only; - int current; -}; - -} // namespace - -#endif diff --git a/omega/omega_lib/include/omega/pres_conj.h b/omega/omega_lib/include/omega/pres_conj.h deleted file mode 100644 index ea10a2c..0000000 --- a/omega/omega_lib/include/omega/pres_conj.h +++ /dev/null @@ -1,299 +0,0 @@ -#if ! defined _pres_conj_h -#define _pres_conj_h 1 - -#include -#include -#include -#include - -namespace omega { - -// -// Conjunct -// -// About variables in Conjunct: -// All varaibles appear in exactly one declaration. -// All variables used in Conjunct are referenced in mappedVars. -// Wildcard variables are referenced both in mappedVars and in myLocals, -// since they are declared in the conjunct. -// All other variables are declared at the levels above. -// Column number is: -// in forwardingAddress in Problem if variablesInitialized is set, -// equal to position of Variable_ID in mappedVars list otherwise. -// - -class Conjunct : public F_Declaration { -public: - Constraint_Iterator constraints(); - Variable_ID_Tuple *variables(); - EQ_Iterator EQs(); - GEQ_Iterator GEQs(); - inline int n_EQs() { return problem->nEQs; } - inline int n_GEQs() { return problem->nGEQs; } - - void promise_that_ub_solutions_exist(Relation &R); - - inline Node_Type node_type() {return Op_Conjunct;} - - inline int is_true() {return problem->nEQs==0 && problem->nGEQs==0 - && exact;} - - void query_difference(Variable_ID v1, Variable_ID v2, - coef_t &lowerBound, coef_t &upperBound, bool &guaranteed); - void query_variable_bounds(Variable_ID v, coef_t &lowerBound, coef_t &upperBound); - coef_t query_variable_mod(Variable_ID v, coef_t factor); - bool query_variable_used(Variable_ID v); - - int countNonzeros() const { - int numberNZs; - coef_t maxCoef, SumAbsCoef; - problem->difficulty(numberNZs,maxCoef,SumAbsCoef); - return numberNZs; - } - - void difficulty(int &numberNZs, coef_t &maxCoef, coef_t &SumAbsCoef) const { - problem->difficulty(numberNZs,maxCoef,SumAbsCoef); - } - - int query_guaranteed_leading_0s() { - count_leading_0s(); - return guaranteed_leading_0s; - } - - int query_possible_leading_0s() { - count_leading_0s(); - return possible_leading_0s; - } - - int query_leading_dir() { - count_leading_0s(); - return leading_dir; - } - - void calculate_dimensions(Relation &R, int &ndim_all, int &ndim_domain); - int max_ufs_arity_of_set(); - int max_ufs_arity_of_in(); - int max_ufs_arity_of_out(); - - int rank(); - - ~Conjunct(); - - bool is_unknown() const; - inline bool is_exact() const { return exact;} - inline bool is_inexact() const { return !exact;} - inline void make_inexact() { exact=false;} - - -#if ! defined NDEBUG - void assert_leading_info(); -#else - void assert_leading_info() {} -#endif - - - // PRINTING FUNCTIONS - void print(FILE *output_file); - void prefix_print(FILE *output_file, int debug = 1); - std::string print_to_string(int true_printed); - std::string print_EQ_to_string(eqn *e) { return problem->print_EQ_to_string(e); } - std::string print_GEQ_to_string(eqn *e) { return problem->print_GEQ_to_string(e); } - std::string print_EQ_to_string(int e) - { return problem->print_EQ_to_string(&(problem->EQs[e])); } - std::string print_GEQ_to_string(int e) - { return problem->print_GEQ_to_string(&(problem->GEQs[e])); } - std::string print_term_to_string(eqn *e) { return problem->print_term_to_string(e,1); } - std::string print_EQ_term_to_string(int e) - { return problem->print_term_to_string(&(problem->EQs[e]),1); } - std::string print_GEQ_term_to_string(int e) - { return problem->print_term_to_string(&(problem->GEQs[e]),1); } - std::string print_sub_to_string(int col) { return problem->print_sub_to_string(col); } - -private: - - inline void interpret_unknown_as_true() { exact=true;} - - friend Relation approx_closure(NOT_CONST Relation &r, int n); - - virtual Conjunct *really_conjunct(); - - - // create new constraints with all co-efficients 0 - // These are public in F_And, use them from there. - EQ_Handle add_stride(int step, int preserves_level = 0); - EQ_Handle add_EQ(int preserves_level = 0); - GEQ_Handle add_GEQ(int preserves_level = 0); - EQ_Handle add_EQ(const Constraint_Handle &c, int preserves_level = 0); - GEQ_Handle add_GEQ(const Constraint_Handle &c, int preserves_level = 0); - - friend class GEQ_Handle; - friend class EQ_Handle; - friend class Sub_Handle; - friend class Constraint_Handle; - friend class Constraint_Iterator; - friend class GEQ_Iterator; - friend class EQ_Iterator; - friend class Sub_Iterator; - friend class Constr_Vars_Iter; - - - // FUNCTIONS HAVING TO DO WITH BUILDING FORMULAS/DNFs - bool can_add_child(); - void remap(); - void beautify(); - DNF* DNFize(); - int priority(); - virtual Conjunct *find_available_conjunct(); - void finalize(); - - friend class DNF; - - - - // CREATING CONJUNCTS - Conjunct(); - Conjunct(Conjunct &); - Conjunct(Formula *, Rel_Body *); - - friend class Formula; // add_conjunct (a private function) creates Conjuncts - friend class F_Not; - friend class F_Or; - // class F_And; is a friend below - - - // VARIOUS FUNCTIONS TO CREATE / WORK WITH VARIABLES - Variable_ID declare(Const_String s); - Variable_ID declare(); - Variable_ID declare(Variable_ID v); - - friend const char *get_var_name(unsigned int, void *); - void push_exists(Variable_ID_Tuple &S); - int get_column(Variable_ID); - int find_column(Variable_ID); - int map_to_column(Variable_ID); - void combine_columns(); - void reorder(); - void reorder_for_print(bool reverseOrder=false, - int first_pass_input=0, - int first_pass_output=0, - bool sort=false); - - friend void remap_DNF_vars(Rel_Body *new_rel, Rel_Body *old_rel); - - void localize_var(Variable_ID D); - - - // this creates variables in conjuncts for us: - friend int new_WC(Conjunct *nc, Problem *np); - - - // UFS/LEADING ZEROS STUFF - - void move_UFS_to_input(); - - void count_leading_0s(); - void invalidate_leading_info(int changed = -1); - void enforce_leading_info(int guaranteed, int possible, int dir); - - void reverse_leading_dir_info(); - - - - // CONJUNCT SPECIFIC STUFF - - void rm_color_constrs(); - inline int N_protected() { return problem->safeVars; } - - - void ordered_elimination(int symLen) { problem->ordered_elimination(symLen);} - void convertEQstoGEQs(bool excludeStrides); - - int cost(); - - inline Formula* copy(Formula *parent, Rel_Body *reln) - { return copy_conj_diff_relation(parent,reln); } - Conjunct* copy_conj_diff_relation(Formula *parent, Rel_Body *reln); - inline Conjunct* copy_conj_same_relation() - { return copy_conj_diff_relation(&(parent()), relation()); } - friend void internal_copy_conjunct(Conjunct* to, Conjunct* fr); - friend void copy_constraint(Constraint_Handle H, - const Constraint_Handle initial); - -#if defined STUDY_EVACUATIONS - // The core function of "evac.c" does lots of work with conjuncts: - friend bool check_subseq_n(Conjunct *c, Sequence &evac_from, Sequence &evac_to, int n_from, int n_to, int max_arity, int n, bool allow_offset); - friend void assert_subbed_syms(Conjunct *c); - friend bool check_affine(Conjunct *d, Sequence &evac_from, Sequence &evac_to, int n_from, int n_to, int max_arity); - friend evac study(Conjunct *C, Sequence &evac_from, Sequence &evac_to, int n_from, int n_to, int max_arity); -#endif - - // The relational ops tend to do lots of demented things to Conjuncts: - friend class Rel_Body; - friend_rel_ops; - - // F_And sometimes absorbs conjuncts - friend class F_And; - - // Various DNFize functions also get a the problem: - - friend DNF* conj_and_not_dnf(Conjunct *pos_conj, DNF *neg_conjs, bool weak); - friend class F_Exists; - - // Substitutions are a wrapper around a low-level Problem operation - friend class Substitutions; - - // private functions to call problem functions - int simplifyProblem(); - int simplifyProblem(int verify, int subs, int redundantElimination); - int redSimplifyProblem(int effort, int computeGist); - - friend int simplify_conj(Conjunct* conj, int ver_sim, int elim_red, int color); - friend DNF* negate_conj(Conjunct* conj); - friend Conjunct* merge_conjs(Conjunct* conj1, Conjunct* conj2, - Merge_Action action, Rel_Body *body = 0); - friend void copy_conj_header(Conjunct* to, Conjunct* fr); - - - // === at last, the data === - - Variable_ID_Tuple mappedVars; - - int n_open_constraints; - bool cols_ordered; - bool simplified; - bool verified; - - int guaranteed_leading_0s; // -1 if unknown - int possible_leading_0s; // -1 if unknown - int leading_dir; // 0 if unknown, else +/- 1 - int leading_dir_valid_and_known(); - - bool exact; - - short r_constrs; // are redundant constraints eliminated? - Problem *problem; - - bool is_compressed(); - void compress(); - void uncompress(); - - friend class Comp_Problem; - Comp_Problem *comp_problem; -}; - - -/* === Misc. problem manipulation utilities === */ - -const int CantBeNegated = INT_MAX-10; -const int AvoidNegating = INT_MAX-11; - -void copy_column(Problem *tp, int to_col, - Problem *fp, int fr_col, - int start_EQ, int start_GEQ); -void zero_column(Problem *tp, int to_col, - int start_EQ, int start_GEQ, - int no_EQs, int no_GEQs); - -} // namespace - -#endif diff --git a/omega/omega_lib/include/omega/pres_decl.h b/omega/omega_lib/include/omega/pres_decl.h deleted file mode 100644 index 7fec0bc..0000000 --- a/omega/omega_lib/include/omega/pres_decl.h +++ /dev/null @@ -1,55 +0,0 @@ -#if ! defined _pres_decl_h -#define _pres_decl_h 1 - -#include -#include -#include - -namespace omega { - -// -// Base class for presburger formula nodes with variables -// - -class F_Declaration : public Formula { -public: - virtual Variable_ID declare(Const_String s)=0; - virtual Variable_ID declare()=0; - virtual Variable_ID declare(Variable_ID)=0; - virtual Section declare_tuple(int size); - - void finalize(); - - inline Variable_ID_Tuple &locals() {return myLocals;} - -protected: - F_Declaration(Formula *, Rel_Body *); - F_Declaration(Formula *, Rel_Body *, Variable_ID_Tuple &); - ~F_Declaration(); - - Variable_ID do_declare(Const_String s, Var_Kind var_kind); - - void prefix_print(FILE *output_file, int debug = 1); - void print(FILE *output_file); - - void setup_names(); - void setup_anonymous_wildcard_names(); - - Variable_ID_Tuple myLocals; - friend class F_Forall; // rearrange needs to access myLocals - friend class F_Or; // push_exists - -private: - virtual bool can_add_child(); - - int priority(); - - friend void align(Rel_Body *originalr, Rel_Body *newr, F_Exists *fe, - Formula *f, const Mapping &mapping, bool &newrIsSet, - List &seen_exists, - Variable_ID_Tuple &seen_exists_ids); -}; - -} // namespace - -#endif diff --git a/omega/omega_lib/include/omega/pres_dnf.h b/omega/omega_lib/include/omega/pres_dnf.h deleted file mode 100644 index 93d5942..0000000 --- a/omega/omega_lib/include/omega/pres_dnf.h +++ /dev/null @@ -1,87 +0,0 @@ -#if ! defined _pres_dnf_h -#define _pres_dnf_h 1 - -#include - -namespace omega { - -// -// Disjunctive Normal Form -- list of Conjuncts -// -class DNF { -public: - void print(FILE *out_file); - void prefix_print(FILE *out_file, int debug = 1, bool parent_names_setup=false); - - bool is_definitely_false() const; - bool is_definitely_true() const; - int length() const; - - Conjunct *single_conjunct() const; - bool has_single_conjunct() const; - Conjunct *rm_first_conjunct(); - void clear(); - int query_guaranteed_leading_0s(int what_to_return_for_empty_dnf); - int query_possible_leading_0s(int what_to_return_for_empty_dnf); - int query_leading_dir(); - -private: - // all DNFize functions need to access the dnf builders: - friend class F_And; - friend class F_Or; - friend class Conjunct; - friend DNF * negate_conj(Conjunct *); - - friend class Rel_Body; - friend_rel_ops; - - DNF(); - ~DNF(); - - DNF* copy(Rel_Body *); - - void simplify(); - void make_level_carried_to(int level); - void count_leading_0s(); - - void add_conjunct(Conjunct*); - void join_DNF(DNF*); - void rm_conjunct(Conjunct *c); - - void rm_redundant_conjs(int effort); - void rm_redundant_inexact_conjs(); - void DNF_to_formula(Formula* root); - - - friend void remap_DNF_vars(Rel_Body *new_rel, Rel_Body *old_rel); - void remap(); - - void setup_names(); - - void remove_inexact_conj(); - - // These may need to get at the conjList itself: - friend DNF* DNF_and_DNF(DNF*, DNF*); - friend DNF* DNF_and_conj(DNF*, Conjunct*); - friend DNF* conj_and_not_dnf(Conjunct *pos_conj, DNF *neg_conjs, bool weak); - - friend class DNF_Iterator; - - List conjList; -}; - -DNF* conj_and_not_dnf(Conjunct *pos_conj, DNF *neg_conjs, bool weak=false); - -// -// DNF iterator -// -class DNF_Iterator : public List_Iterator { -public: - DNF_Iterator(DNF*dnf) : List_Iterator(dnf->conjList) {} - DNF_Iterator() {} - void curr_set(Conjunct *c) { *(*this) = c; } -}; - -} // namespace - -#endif diff --git a/omega/omega_lib/include/omega/pres_form.h b/omega/omega_lib/include/omega/pres_form.h deleted file mode 100644 index ed3258e..0000000 --- a/omega/omega_lib/include/omega/pres_form.h +++ /dev/null @@ -1,112 +0,0 @@ -#if ! defined _pres_form_h -#define _pres_form_h 1 - -#include - -namespace omega { - -typedef enum {Op_Relation, Op_Not, Op_And, Op_Or, - Op_Conjunct, Op_Forall, Op_Exists} Node_Type; - - -// -// Presburger Formula base class -// - -class Formula { -public: - virtual Node_Type node_type()=0; - - F_Forall *add_forall(); - F_Exists *add_exists(); - virtual F_And *and_with(); - F_And *add_and(); - F_Or *add_or(); - F_Not *add_not(); - void add_unknown(); - - virtual void finalize(); - virtual void print(FILE *output_file); - - Rel_Body *relation() { return myRelation; } - -protected: - virtual ~Formula(); -private: - Formula(Formula *, Rel_Body *); - - // The relational operations need to work with formula trees - friend class Relation; - friend_rel_ops; - // as do the functions that build DNF's - friend class DNF; - // or other parts of the tree - friend class Conjunct; - friend class F_Declaration; - friend class F_Exists; - friend class F_Forall; - friend class F_Or; - friend class F_And; - friend class F_Not; - friend class Rel_Body; - - - // Operations needed for manipulation of formula trees: - - void remove_child(Formula *); - void replace_child(Formula *child, Formula *new_child); - virtual bool can_add_child(); - void add_child(Formula *); - - Conjunct *add_conjunct(); - virtual Conjunct *find_available_conjunct() = 0; - - virtual Formula *copy(Formula *parent, Rel_Body *reln); - F_Exists *add_exists(Variable_ID_Tuple &S); - virtual void push_exists(Variable_ID_Tuple &S); - - // Accessor functions for tree building - - List &children() {return myChildren;} - int n_children() const {return myChildren.length();} - const List &get_children() const {return myChildren;} - Formula &parent() {return *myParent;} - void set_parent(Formula *p) {myParent = p;} - - - virtual int priority(); - - void verify_tree(); // should be const, but iterators are used - - virtual void reverse_leading_dir_info(); - virtual void invalidate_leading_info(int changed = -1); - virtual void enforce_leading_info(int guaranteed, int possible, int dir); - - virtual void remap(); - virtual DNF* DNFize() = 0; - virtual void beautify(); - virtual void rearrange(); - virtual void setup_names(); - - virtual void print_separator(FILE *output_file); - virtual void combine_columns(); - virtual void prefix_print(FILE *output_file, int debug = 1); - void print_head(FILE *output_file); - - void set_relation(Rel_Body *r); - void set_parent(Formula *parent, Rel_Body *reln); - - void assert_not_finalized(); - - virtual Conjunct *really_conjunct(); // until we get RTTI - -private: - List myChildren; - Formula *myParent; - Rel_Body *myRelation; - -}; - -} // namespace - -#endif diff --git a/omega/omega_lib/include/omega/pres_gen.h b/omega/omega_lib/include/omega/pres_gen.h deleted file mode 100644 index ba6a793..0000000 --- a/omega/omega_lib/include/omega/pres_gen.h +++ /dev/null @@ -1,192 +0,0 @@ -#if ! defined _pres_gen_h -#define _pres_gen_h 1 - -#include -#include -#include -#include -#include -#include -#include - -namespace omega { - -// -// general presburger stuff thats needed everywhere -// - -/* The following allows us to avoid warnings about passing - temporaries as non-const references. This is useful but - has suddenly become illegal. */ - -#if !defined(LIE_ABOUT_CONST_TO_MAKE_ANSI_COMMITTEE_HAPPY) -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)) -#define LIE_ABOUT_CONST_TO_MAKE_ANSI_COMMITTEE_HAPPY 1 -#else -#define LIE_ABOUT_CONST_TO_MAKE_ANSI_COMMITTEE_HAPPY 0 -#endif -#endif - -#if LIE_ABOUT_CONST_TO_MAKE_ANSI_COMMITTEE_HAPPY -#define NOT_CONST const -#else -#define NOT_CONST -#endif - -// -// I/O and error processing and control flags (also in omega_core/debugging.h) -// - -extern FILE *DebugFile; -extern int pres_debug; - -extern int mega_total; -extern int use_ugly_names; - -extern negation_control pres_legal_negations; - - -// -// Lots of things refer to each other, -// so we forward declare these classes: -// - -class Var_Decl; -typedef enum {Input_Var, Set_Var = Input_Var, Output_Var, - Global_Var, Forall_Var, Exists_Var, Wildcard_Var} Var_Kind; -class Global_Var_Decl; -typedef enum {Unknown_Tuple = 0, Input_Tuple = 1, Output_Tuple = 2, - Set_Tuple = Input_Tuple } Argument_Tuple; - -class Constraint_Handle; -class EQ_Handle; -class GEQ_Handle; -typedef EQ_Handle Stride_Handle; - -class Formula; -class F_Declaration; -class F_Forall; -class F_Exists; -class F_And; -class F_Or; -class F_Not; -class Conjunct; -class Relation; -class Rel_Body; -class DNF; -class Mapping; -class Omega_Var; -class Coef_Var_Decl; - -typedef Var_Decl *Variable_ID; -typedef Global_Var_Decl *Global_Var_ID; - -typedef Tuple Variable_ID_Tuple; -typedef Sequence Variable_ID_Sequence; // use only for rvalues -typedef Tuple_Iterator Variable_ID_Tuple_Iterator; -typedef Tuple_Iterator Variable_ID_Iterator; - -typedef Variable_ID_Iterator Variable_Iterator; - -typedef enum {Comb_Id, Comb_And, Comb_Or, Comb_AndNot} Combine_Type; - - -// things that are (hopefully) used only privately -class Comp_Problem; -class Comp_Constraints; - -// this has to be here rather than in pres_conj.h because -// MergeConj has to be a friend of Constraint_Handle -typedef enum {MERGE_REGULAR, MERGE_COMPOSE, MERGE_GIST} Merge_Action; - - -// Conjunct can be exact or lower or upper bound. -// For lower bound conjunct, the upper bound is assumed to be true; -// For upper bound conjunct, the lower bound is assumed to be false - -typedef enum {EXACT_BOUND, UPPER_BOUND, LOWER_BOUND, UNSET_BOUND} Bound_Type; - - -#if defined STUDY_EVACUATIONS -typedef enum { in_to_out = 0, out_to_in = 1} which_way; - -enum evac { evac_trivial = 0, - evac_offset = 1, - evac_subseq = 2, - evac_offset_subseq = 3, -// evac_permutation = , - evac_affine = 4, - evac_nasty = 5 }; - -extern char *evac_names[]; - -#endif - -// the following list should be updated in sync with Relations.h - -#define friend_rel_ops \ -friend Relation Union(NOT_CONST Relation &r1, NOT_CONST Relation &r2); \ -friend Relation Intersection(NOT_CONST Relation &r1, NOT_CONST Relation &r2); \ -friend Relation After(NOT_CONST Relation &R, int carried_by, int new_output, int dir);\ -friend Relation Extend_Domain(NOT_CONST Relation &R); \ -friend Relation Extend_Domain(NOT_CONST Relation &R, int more); \ -friend Relation Extend_Range(NOT_CONST Relation &R); \ -friend Relation Extend_Range(NOT_CONST Relation &R, int more); \ -friend Relation Extend_Set(NOT_CONST Relation &R); \ -friend Relation Extend_Set(NOT_CONST Relation &R, int more); \ -friend Relation Restrict_Domain(NOT_CONST Relation &r1, NOT_CONST Relation &r2); \ -friend Relation Restrict_Range(NOT_CONST Relation &r1, NOT_CONST Relation &r2); \ -friend Relation Domain(NOT_CONST Relation &r); \ -friend Relation Range(NOT_CONST Relation &r); \ -friend Relation Cross_Product(NOT_CONST Relation &A, NOT_CONST Relation &B); \ -friend Relation Inverse(NOT_CONST Relation &r); \ -friend Relation Deltas(NOT_CONST Relation &R); \ -friend Relation Deltas(NOT_CONST Relation &R, int eq_no); \ -friend Relation DeltasToRelation(NOT_CONST Relation &R, int n_input, int n_output); \ -friend Relation Complement(NOT_CONST Relation &r); \ -friend Relation Project(NOT_CONST Relation &R, Global_Var_ID v); \ -friend Relation Project(NOT_CONST Relation &r, int pos, Var_Kind vkind); \ -friend Relation Project(NOT_CONST Relation &S, Sequence &s); \ -friend Relation Project_Sym(NOT_CONST Relation &R); \ -friend Relation Project_On_Sym(NOT_CONST Relation &R, NOT_CONST Relation &context); \ -friend Relation GistSingleConjunct(NOT_CONST Relation &R1, NOT_CONST Relation &R2, int effort); \ -friend Relation Gist(NOT_CONST Relation &R1, NOT_CONST Relation &R2, int effort); \ -friend Relation Difference(NOT_CONST Relation &r1, NOT_CONST Relation &r2); \ -friend Relation Approximate(NOT_CONST Relation &R, bool strides_allowed); \ -friend Relation Identity(int n_inp); \ -friend Relation Identity(NOT_CONST Relation &r); \ -friend bool do_subset_check(NOT_CONST Relation &r1, NOT_CONST Relation &r2); \ -friend bool Must_Be_Subset(NOT_CONST Relation &r1, NOT_CONST Relation &r2); \ -friend bool Might_Be_Subset(NOT_CONST Relation &r1, NOT_CONST Relation &r2); \ -friend bool May_Be_Subset(NOT_CONST Relation &r1, NOT_CONST Relation &r2); \ -friend bool Is_Obvious_Subset(NOT_CONST Relation &r1, NOT_CONST Relation &r2); \ -friend Relation Join(NOT_CONST Relation &G, NOT_CONST Relation &F); \ -friend Relation Composition(NOT_CONST Relation &F, NOT_CONST Relation &G); \ -friend bool can_do_exact_composition(NOT_CONST Relation &F, NOT_CONST Relation &G); \ -friend Relation EQs_to_GEQs(NOT_CONST Relation &, bool excludeStrides); \ -friend Relation Symbolic_Solution(NOT_CONST Relation &S); \ -friend Relation Symbolic_Solution(NOT_CONST Relation &S, Sequence &T); \ -friend Relation Sample_Solution(NOT_CONST Relation &S); \ -friend Relation Solution(NOT_CONST Relation &S, Sequence &T); \ -friend void MapRel1(Relation &inputRel, const Mapping &map, \ - Combine_Type ctype, int number_input, \ - int number_output, bool, bool); \ -friend Relation MapAndCombineRel2(Relation &R1, Relation &R2, \ - const Mapping &mapping1, \ - const Mapping &mapping2, \ - Combine_Type ctype, \ - int number_input, \ - int number_output); \ -friend void align(Rel_Body *, Rel_Body *, F_Exists *, \ - Formula *, const Mapping &, bool &, \ - List &, Variable_ID_Tuple &); \ -friend Relation Lower_Bound(NOT_CONST Relation &r); \ -friend Relation Upper_Bound(NOT_CONST Relation &r) - - -// REMEMBER - THE LAST LINE OF THE MACRO SHOULD NOT HAVE A ; -/* TransitiveClosure doesn't need to be in friend_rel_ops */ - -} // namespace - -#endif diff --git a/omega/omega_lib/include/omega/pres_logic.h b/omega/omega_lib/include/omega/pres_logic.h deleted file mode 100644 index 27c4553..0000000 --- a/omega/omega_lib/include/omega/pres_logic.h +++ /dev/null @@ -1,90 +0,0 @@ -#if ! defined _pres_logic_h -#define _pres_logic_h 1 - -#include - -namespace omega { -// -// Presburger formula classes for logical operations: and, or not -// - -class F_And : public Formula { -public: - inline Node_Type node_type() {return Op_And;} - - // "preserves level" should be 0 unless we know this will not - // change the "level" of the constraints - ie the number of - // leading corresponding in,out variables known to be equal - GEQ_Handle add_GEQ(int preserves_level = 0); - EQ_Handle add_EQ(int preserves_level = 0); - Stride_Handle add_stride(int step, int preserves_level = 0); - EQ_Handle add_EQ(const Constraint_Handle &c, int preserves_level = 0); - GEQ_Handle add_GEQ(const Constraint_Handle &c, int preserves_level = 0); - - F_And *and_with(); - void add_unknown(); - -private: - friend class Formula; // add_and() - F_And(Formula *p, Rel_Body *r); - -private: - Formula *copy(Formula *parent, Rel_Body *reln); - virtual Conjunct *find_available_conjunct(); - int priority(); - void print_separator(FILE *output_file); - void prefix_print(FILE *output_file, int debug = 1); - void beautify(); - DNF* DNFize(); - - Conjunct *pos_conj; -}; - - -class F_Or : public Formula { -public: - inline Node_Type node_type() {return Op_Or;} - -private: - friend class Formula; // add_or - F_Or(Formula *, Rel_Body *); - -private: - Formula *copy(Formula *parent, Rel_Body *reln); - - virtual Conjunct *find_available_conjunct(); - void print_separator(FILE *output_file); - void prefix_print(FILE *output_file, int debug = 1); - void beautify(); - int priority(); - DNF* DNFize(); - void push_exists(Variable_ID_Tuple &S); -}; - - -class F_Not : public Formula { -public: - inline Node_Type node_type() {return Op_Not;} - void finalize(); - -private: - friend class Formula; - F_Not(Formula *, Rel_Body *); - -private: - Formula *copy(Formula *parent, Rel_Body *reln); - - virtual Conjunct *find_available_conjunct(); - friend class F_Forall; - bool can_add_child(); - void beautify(); - void rearrange(); - int priority(); - DNF* DNFize(); - void print(FILE *output_file); - void prefix_print(FILE *output_file, int debug = 1); -}; - -} // namespace - -#endif diff --git a/omega/omega_lib/include/omega/pres_quant.h b/omega/omega_lib/include/omega/pres_quant.h deleted file mode 100644 index 98c30df..0000000 --- a/omega/omega_lib/include/omega/pres_quant.h +++ /dev/null @@ -1,63 +0,0 @@ -#if ! defined _pres_quant_h -#define _pres_quant_h 1 - -#include - -namespace omega { - -// -// Presburger formula nodes for quantifiers -// - -class F_Exists : public F_Declaration { -public: - inline Node_Type node_type() {return Op_Exists;} - Variable_ID declare(Const_String s); - Variable_ID declare(); - Variable_ID declare(Variable_ID v); - virtual void push_exists(Variable_ID_Tuple &S); - -protected: - friend class Formula; - - F_Exists(Formula *, Rel_Body *); - F_Exists(Formula *, Rel_Body *, Variable_ID_Tuple &); - -private: - Formula *copy(Formula *parent, Rel_Body *reln); - - virtual Conjunct *find_available_conjunct(); - void print(FILE *output_file); - void prefix_print(FILE *output_file, int debug = 1); - void beautify(); - void rearrange(); - DNF* DNFize(); -}; - - -class F_Forall : public F_Declaration { -public: - inline Node_Type node_type() {return Op_Forall;} - Variable_ID declare(Const_String s); - Variable_ID declare(); - Variable_ID declare(Variable_ID v); - -protected: - friend class Formula; - - F_Forall(Formula *, Rel_Body *); - -private: - Formula *copy(Formula *parent, Rel_Body *reln); - - virtual Conjunct *find_available_conjunct(); - void print(FILE *output_file); - void prefix_print(FILE *output_file, int debug = 1); - void beautify(); - void rearrange(); - DNF* DNFize(); -}; - -} // namespace - -#endif diff --git a/omega/omega_lib/include/omega/pres_subs.h b/omega/omega_lib/include/omega/pres_subs.h deleted file mode 100644 index 8a9ee92..0000000 --- a/omega/omega_lib/include/omega/pres_subs.h +++ /dev/null @@ -1,88 +0,0 @@ -#if !defined(pres_subs_h) -#define pres_subs_h - -/* Interface to omega core's substitutions. - - Creating an object of class Substitutions causes ordered elimination, - i.e. variables in the input and output tuples are substituted for by - functions of earlier variables. Could conceivablely create a more - flexible interface to orderedElimination if we developed a way to - specify the desired variable order. - - This is not an entirely consistent interface, since Sub_Handles - shouldn't really permit update_coef on SUBs. It is not a real - problem since subs are now no longer part of a conjunct, but it is - a slightly odd situation. - - Don't try to simplify r after performing orderedElimination. -*/ - - -#include -#include -#include -#include - -namespace omega { - -class Sub_Handle; -class Sub_Iterator; - -class Substitutions { -public: - Substitutions(Relation &input_R, Conjunct *input_c); - ~Substitutions(); - Sub_Handle get_sub(Variable_ID v); - bool substituted(Variable_ID v); - bool sub_involves(Variable_ID v, Var_Kind kind); -private: - friend class Sub_Iterator; - friend class Sub_Handle; - Relation *r; - Conjunct *c; - eqn *subs; - Variable_ID_Tuple subbed_vars; -}; - - -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - - -class Sub_Handle: public Constraint_Handle { -public: - inline Sub_Handle() {} - - virtual std::string print_to_string() const; - virtual std::string print_term_to_string() const; - Variable_ID variable() {return v;} - -private: - friend class Substitutions; - friend class Sub_Iterator; - Sub_Handle(Substitutions *, int, Variable_ID); -// Sub_Handle(Substitutions *, int); - - Variable_ID v; -}; - -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - - -class Sub_Iterator : public Generator { -public: - Sub_Iterator(Substitutions *input_s): s(input_s), current(0), - last(s->c->problem->nSUBs-1) {} - int live() const; - void operator++(int); - void operator++(); - Sub_Handle operator* (); - Sub_Handle operator* () const; - -private: - Substitutions *s; - int current, last; -}; - -} // namespace - -#endif diff --git a/omega/omega_lib/include/omega/pres_tree.h b/omega/omega_lib/include/omega/pres_tree.h deleted file mode 100644 index ad78ad0..0000000 --- a/omega/omega_lib/include/omega/pres_tree.h +++ /dev/null @@ -1,15 +0,0 @@ -#if ! defined _pres_tree_h -#define _pres_tree_h 1 - -// -// Header to include if you need all the classes to build -// a Presburger formula: -// variables, constraints, nodes for logical operations & quantifiers -// - -#include -#include -#include -#include - -#endif diff --git a/omega/omega_lib/include/omega/pres_var.h b/omega/omega_lib/include/omega/pres_var.h deleted file mode 100644 index bf60dcb..0000000 --- a/omega/omega_lib/include/omega/pres_var.h +++ /dev/null @@ -1,230 +0,0 @@ -#if ! defined _pres_var_h -#define _pres_var_h 1 - -#include -#include - -namespace omega { - -// -// Variable declaration. -// Variables are free or quantified. -// Free variables are classified as input, output and global. -// Quantified variables are classified as forall, exists and wildcard. -// All global variables are functions symbols of (possibly 0) arguments -// Local variables that correspond to >0-ary functions are identified -// as functions of a prefix of the input, output, or both tuples -// -// -// typedef enum {Input_Var, Output_Var, Set_Var, -// Global_Var, Forall_Var, Exists_Var, Wildcard_Var} Var_Kind; - -typedef enum {Free_Var, Coef_Var, Bomega_Var} Global_Kind; - -// NOW IN PRES_GEN.H, as its used as an argument and can't -// be forward declared: -// typedef enum {Unknown_Tuple = 0, Input_Tuple = 1, Output_Tuple = 2, -// Set_Tuple = Input_Tuple } Argument_Tuple; -// Only Input, Output, and Set can be passed to get_local, -// but the values 0 and 3 are also used internally. - - -class Var_Decl { -public: - inline Var_Kind kind() { return var_kind; } - int get_position(); - Global_Var_ID get_global_var(); - Argument_Tuple function_of(); // valid iff kind() == Global_var - - Const_String base_name; - void name_variable(char *newname); - - // The following should be used with care, as they are only valid - // after setup_names has been used on the relation containing this - // variable. - std::string name(); - const char* char_name(); - void set_kind(Var_Kind v) { var_kind = v; } - - // Operation to allow the remap field to be used for - // union-find operations on variables. - // Be sure to reset the remap fields afterward - void UF_union(Variable_ID v); - Variable_ID UF_owner(); - -private: - Var_Decl(Const_String name, Var_Kind vkind, int pos); - Var_Decl(Var_Kind vkind, int pos); - Var_Decl(Variable_ID v); - Var_Decl(Const_String name, Global_Var_ID v); - Var_Decl(Const_String name, Global_Var_ID v, Argument_Tuple function_of); - - friend class F_Declaration; // creates local variables - friend class Global_Var_Decl; // its constructors create Var_Decls. - - friend class Global_Input_Output_Tuple; - friend void copy_var_decls(Variable_ID_Tuple &new_vl, Variable_ID_Tuple &vl); - -private: - int instance; - void setup_name(); - - // these set up the names - friend class Rel_Body; -// friend class F_Declaration; already a friend - -private: - Variable_ID remap; // pointer to new copy of this node - - // lots of things need to get at "remap" - lots of relation ops, - // and functions that move UFS's around: - // dnf::make_level_carried_to and Conjunct::move_UFS_to_input() - // Also of course Conjunct::remap and push_exists - friend_rel_ops; - friend class DNF; - friend class Conjunct; - - // this prints remap to the debugging output - friend void print_var_addrs(std::string &s, Variable_ID v); - - friend void reset_remap_field(Variable_ID v); - friend void reset_remap_field(Sequence &S); - friend void reset_remap_field(Sequence &S, int var_no); - friend void reset_remap_field(Variable_ID_Tuple &S); - friend void reset_remap_field(Variable_ID_Tuple &S, int var_no); - -private: - - Var_Kind var_kind; - int position; // only for Input_Var, Output_Var - Global_Var_ID global_var; // only for Global_Var - Argument_Tuple of; // only for Global_Var -}; - -bool rm_variable(Variable_ID_Tuple &vl, Variable_ID v); -void reset_remap_field(Sequence &S); -void reset_remap_field(Sequence &S, int var_no); -void reset_remap_field(Variable_ID v); -void reset_remap_field(Variable_ID_Tuple &S); -void reset_remap_field(Variable_ID_Tuple &S, int var_no); - -class Global_Input_Output_Tuple: public Tuple { -public: - Global_Input_Output_Tuple(Var_Kind in_my_kind, int init=-1); - ~Global_Input_Output_Tuple(); - virtual Variable_ID &operator[](int index); - virtual const Variable_ID &operator[](int index) const; -private: - Var_Kind my_kind; - static const int initial_allocation; -}; - -extern Global_Input_Output_Tuple input_vars; -extern Global_Input_Output_Tuple output_vars; -// This allows the user to refer to set_vars to query sets, w/o knowing -// they are really inputs. -extern Global_Input_Output_Tuple &set_vars; - -Variable_ID input_var(int nth); -Variable_ID output_var(int nth); -Variable_ID set_var(int nth); - - - -// -// Global_Var_ID uniquely identifies global var-s through the whole program. -// Global_Var_Decl is an ADT with the following operations: -// - create global variable, -// - find the arity of the variable, (default = 0, for symbolic consts) -// - get the name of global variable, -// - tell if two variables are the same (if they are the same object) -// - -class Global_Var_Decl { -public: - Global_Var_Decl(Const_String baseName); - - virtual Const_String base_name() const - { - return loc_rep1.base_name; - } - - virtual void set_base_name(Const_String newName) - { - loc_rep1.base_name = newName; - loc_rep2.base_name = newName; - } - - virtual int arity() const - { - return 0; // default compatible with old symbolic constant stuff - } - - virtual Omega_Var *really_omega_var(); // until we get RTTI in C++ - virtual Coef_Var_Decl *really_coef_var(); // until we get RTTI in C++ - virtual Global_Kind kind() const; - -private: - - friend class Rel_Body; // Rel_Body::get_local calls this get_local - - Variable_ID get_local() - { - assert(arity() == 0); - return &loc_rep1; - } - Variable_ID get_local(Argument_Tuple of) - { - assert(arity() == 0 || of == Input_Tuple || of == Output_Tuple); - return ((arity() == 0 || of == Input_Tuple) ? &loc_rep1 : &loc_rep2); - } - - // local representative, there is just 1 for every 0-ary global variable - Var_Decl loc_rep1; // arity == 0, or arity > 0 and of == In - Var_Decl loc_rep2; // arity > 0 and of == Out - -public: -// friend class Rel_Body; // Rel_Body::setup_names sets instance - friend class Var_Decl; - int instance; -}; - - -class Coef_Var_Decl : public Global_Var_Decl { -public: - Coef_Var_Decl(int id, int var); - int stmt() const; - int var() const; - virtual Global_Kind kind() const; - virtual Coef_Var_Decl *really_coef_var(); // until we get RTTI in C++ - -private: - int i, v; -}; - - - -// -// Test subclass for Global_Var: named global variable -// -class Free_Var_Decl : public Global_Var_Decl { -public: - Free_Var_Decl(Const_String name); - Free_Var_Decl(Const_String name, int arity); - int arity() const; - virtual Global_Kind kind() const; - -private: - int _arity; -}; - - -/* === implementation functions === */ -void copy_var_decls(Variable_ID_Tuple &new_vl, Variable_ID_Tuple &vl); -void free_var_decls(Variable_ID_Tuple &vl); - -extern int wildCardInstanceNumber; - -} // namespace - -#endif diff --git a/omega/omega_lib/include/omega/reach.h b/omega/omega_lib/include/omega/reach.h deleted file mode 100644 index ff4bf79..0000000 --- a/omega/omega_lib/include/omega/reach.h +++ /dev/null @@ -1,23 +0,0 @@ -#if ! defined _reach_h -#define _reach_h 1 - -namespace omega { - -class reachable_information { -public: - Tuple node_names; - Tuple node_arity; - Dynamic_Array1 start_nodes; - Dynamic_Array2 transitions; -}; - - -Dynamic_Array1 * -Reachable_Nodes(reachable_information * reachable_info); - -Dynamic_Array1 * -I_Reachable_Nodes(reachable_information * reachable_info); - -} // namespace - -#endif diff --git a/omega/omega_lib/obj/Makefile.am b/omega/omega_lib/obj/Makefile.am deleted file mode 100644 index 455fc58..0000000 --- a/omega/omega_lib/obj/Makefile.am +++ /dev/null @@ -1,47 +0,0 @@ -noinst_LIBRARIES = libomega.a - -basic_src =../../basic/src/ConstString.cc -basic_src +=../../basic/src/Link.cc - -oc_src =../src/omega_core/oc.cc -oc_src +=../src/omega_core/oc_eq.cc -oc_src +=../src/omega_core/oc_exp_kill.cc -oc_src +=../src/omega_core/oc_global.cc -oc_src +=../src/omega_core/oc_print.cc -oc_src +=../src/omega_core/oc_problems.cc -oc_src +=../src/omega_core/oc_simple.cc -oc_src +=../src/omega_core/oc_solve.cc -oc_src +=../src/omega_core/oc_query.cc -oc_src +=../src/omega_core/oc_quick_kill.cc -oc_src +=../src/omega_core/oc_util.cc - -pres_src =../src/pres_beaut.cc -pres_src +=../src/pres_cnstr.cc -pres_src +=../src/pres_col.cc -pres_src +=../src/pres_conj.cc -pres_src +=../src/pres_decl.cc -pres_src +=../src/pres_dnf.cc -pres_src +=../src/pres_form.cc -pres_src +=../src/pres_gen.cc -pres_src +=../src/pres_logic.cc -pres_src +=../src/pres_print.cc -pres_src +=../src/pres_rear.cc -pres_src +=../src/pres_quant.cc -pres_src +=../src/pres_subs.cc -pres_src +=../src/pres_var.cc - -rel_src =../src/evac.cc -rel_src +=../src/farkas.cc -rel_src +=../src/hull_legacy.cc -rel_src +=../src/hull_simple.cc -rel_src +=../src/Relation.cc -rel_src +=../src/Relations.cc -rel_src +=../src/RelBody.cc -rel_src +=../src/RelVar.cc - -fancy_src =../src/closure.cc -fancy_src +=../src/reach.cc - - -libomega_a_SOURCES =$(basic_src) $(oc_src) $(pres_src) $(rel_src) $(fancy_src) -libomega_a_CPPFLAGS =-I../include -I../../basic/include diff --git a/omega/omega_lib/obj/Makefile.in b/omega/omega_lib/obj/Makefile.in deleted file mode 100644 index 0bc1d1f..0000000 --- a/omega/omega_lib/obj/Makefile.in +++ /dev/null @@ -1,1257 +0,0 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -subdir = omega_lib/obj -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/include/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -LIBRARIES = $(noinst_LIBRARIES) -ARFLAGS = cru -AM_V_AR = $(am__v_AR_@AM_V@) -am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) -am__v_AR_0 = @echo " AR " $@; -am__v_AR_1 = -libomega_a_AR = $(AR) $(ARFLAGS) -libomega_a_LIBADD = -am__dirstamp = $(am__leading_dot)dirstamp -am__objects_1 = ../../basic/src/libomega_a-ConstString.$(OBJEXT) \ - ../../basic/src/libomega_a-Link.$(OBJEXT) -am__objects_2 = ../src/omega_core/libomega_a-oc.$(OBJEXT) \ - ../src/omega_core/libomega_a-oc_eq.$(OBJEXT) \ - ../src/omega_core/libomega_a-oc_exp_kill.$(OBJEXT) \ - ../src/omega_core/libomega_a-oc_global.$(OBJEXT) \ - ../src/omega_core/libomega_a-oc_print.$(OBJEXT) \ - ../src/omega_core/libomega_a-oc_problems.$(OBJEXT) \ - ../src/omega_core/libomega_a-oc_simple.$(OBJEXT) \ - ../src/omega_core/libomega_a-oc_solve.$(OBJEXT) \ - ../src/omega_core/libomega_a-oc_query.$(OBJEXT) \ - ../src/omega_core/libomega_a-oc_quick_kill.$(OBJEXT) \ - ../src/omega_core/libomega_a-oc_util.$(OBJEXT) -am__objects_3 = ../src/libomega_a-pres_beaut.$(OBJEXT) \ - ../src/libomega_a-pres_cnstr.$(OBJEXT) \ - ../src/libomega_a-pres_col.$(OBJEXT) \ - ../src/libomega_a-pres_conj.$(OBJEXT) \ - ../src/libomega_a-pres_decl.$(OBJEXT) \ - ../src/libomega_a-pres_dnf.$(OBJEXT) \ - ../src/libomega_a-pres_form.$(OBJEXT) \ - ../src/libomega_a-pres_gen.$(OBJEXT) \ - ../src/libomega_a-pres_logic.$(OBJEXT) \ - ../src/libomega_a-pres_print.$(OBJEXT) \ - ../src/libomega_a-pres_rear.$(OBJEXT) \ - ../src/libomega_a-pres_quant.$(OBJEXT) \ - ../src/libomega_a-pres_subs.$(OBJEXT) \ - ../src/libomega_a-pres_var.$(OBJEXT) -am__objects_4 = ../src/libomega_a-evac.$(OBJEXT) \ - ../src/libomega_a-farkas.$(OBJEXT) \ - ../src/libomega_a-hull_legacy.$(OBJEXT) \ - ../src/libomega_a-hull_simple.$(OBJEXT) \ - ../src/libomega_a-Relation.$(OBJEXT) \ - ../src/libomega_a-Relations.$(OBJEXT) \ - ../src/libomega_a-RelBody.$(OBJEXT) \ - ../src/libomega_a-RelVar.$(OBJEXT) -am__objects_5 = ../src/libomega_a-closure.$(OBJEXT) \ - ../src/libomega_a-reach.$(OBJEXT) -am_libomega_a_OBJECTS = $(am__objects_1) $(am__objects_2) \ - $(am__objects_3) $(am__objects_4) $(am__objects_5) -libomega_a_OBJECTS = $(am_libomega_a_OBJECTS) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -AM_V_CXX = $(am__v_CXX_@AM_V@) -am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) -am__v_CXX_0 = @echo " CXX " $@; -am__v_CXX_1 = -CXXLD = $(CXX) -CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ - -o $@ -AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) -am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) -am__v_CXXLD_0 = @echo " CXXLD " $@; -am__v_CXXLD_1 = -SOURCES = $(libomega_a_SOURCES) -DIST_SOURCES = $(libomega_a_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BOOSTHOME = @BOOSTHOME@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CCLD = @CCLD@ -CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EXEEXT = @EXEEXT@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -ROSEHOME = @ROSEHOME@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -YACC = @YACC@ -YFLAGS = @YFLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build_alias = @build_alias@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host_alias = @host_alias@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -noinst_LIBRARIES = libomega.a -basic_src = ../../basic/src/ConstString.cc ../../basic/src/Link.cc -oc_src = ../src/omega_core/oc.cc ../src/omega_core/oc_eq.cc \ - ../src/omega_core/oc_exp_kill.cc \ - ../src/omega_core/oc_global.cc ../src/omega_core/oc_print.cc \ - ../src/omega_core/oc_problems.cc \ - ../src/omega_core/oc_simple.cc ../src/omega_core/oc_solve.cc \ - ../src/omega_core/oc_query.cc \ - ../src/omega_core/oc_quick_kill.cc \ - ../src/omega_core/oc_util.cc -pres_src = ../src/pres_beaut.cc ../src/pres_cnstr.cc \ - ../src/pres_col.cc ../src/pres_conj.cc ../src/pres_decl.cc \ - ../src/pres_dnf.cc ../src/pres_form.cc ../src/pres_gen.cc \ - ../src/pres_logic.cc ../src/pres_print.cc ../src/pres_rear.cc \ - ../src/pres_quant.cc ../src/pres_subs.cc ../src/pres_var.cc -rel_src = ../src/evac.cc ../src/farkas.cc ../src/hull_legacy.cc \ - ../src/hull_simple.cc ../src/Relation.cc ../src/Relations.cc \ - ../src/RelBody.cc ../src/RelVar.cc -fancy_src = ../src/closure.cc ../src/reach.cc -libomega_a_SOURCES = $(basic_src) $(oc_src) $(pres_src) $(rel_src) $(fancy_src) -libomega_a_CPPFLAGS = -I../include -I../../basic/include -all: all-am - -.SUFFIXES: -.SUFFIXES: .cc .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign omega_lib/obj/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign omega_lib/obj/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -../../basic/src/$(am__dirstamp): - @$(MKDIR_P) ../../basic/src - @: > ../../basic/src/$(am__dirstamp) -../../basic/src/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) ../../basic/src/$(DEPDIR) - @: > ../../basic/src/$(DEPDIR)/$(am__dirstamp) -../../basic/src/libomega_a-ConstString.$(OBJEXT): \ - ../../basic/src/$(am__dirstamp) \ - ../../basic/src/$(DEPDIR)/$(am__dirstamp) -../../basic/src/libomega_a-Link.$(OBJEXT): \ - ../../basic/src/$(am__dirstamp) \ - ../../basic/src/$(DEPDIR)/$(am__dirstamp) -../src/omega_core/$(am__dirstamp): - @$(MKDIR_P) ../src/omega_core - @: > ../src/omega_core/$(am__dirstamp) -../src/omega_core/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) ../src/omega_core/$(DEPDIR) - @: > ../src/omega_core/$(DEPDIR)/$(am__dirstamp) -../src/omega_core/libomega_a-oc.$(OBJEXT): \ - ../src/omega_core/$(am__dirstamp) \ - ../src/omega_core/$(DEPDIR)/$(am__dirstamp) -../src/omega_core/libomega_a-oc_eq.$(OBJEXT): \ - ../src/omega_core/$(am__dirstamp) \ - ../src/omega_core/$(DEPDIR)/$(am__dirstamp) -../src/omega_core/libomega_a-oc_exp_kill.$(OBJEXT): \ - ../src/omega_core/$(am__dirstamp) \ - ../src/omega_core/$(DEPDIR)/$(am__dirstamp) -../src/omega_core/libomega_a-oc_global.$(OBJEXT): \ - ../src/omega_core/$(am__dirstamp) \ - ../src/omega_core/$(DEPDIR)/$(am__dirstamp) -../src/omega_core/libomega_a-oc_print.$(OBJEXT): \ - ../src/omega_core/$(am__dirstamp) \ - ../src/omega_core/$(DEPDIR)/$(am__dirstamp) -../src/omega_core/libomega_a-oc_problems.$(OBJEXT): \ - ../src/omega_core/$(am__dirstamp) \ - ../src/omega_core/$(DEPDIR)/$(am__dirstamp) -../src/omega_core/libomega_a-oc_simple.$(OBJEXT): \ - ../src/omega_core/$(am__dirstamp) \ - ../src/omega_core/$(DEPDIR)/$(am__dirstamp) -../src/omega_core/libomega_a-oc_solve.$(OBJEXT): \ - ../src/omega_core/$(am__dirstamp) \ - ../src/omega_core/$(DEPDIR)/$(am__dirstamp) -../src/omega_core/libomega_a-oc_query.$(OBJEXT): \ - ../src/omega_core/$(am__dirstamp) \ - ../src/omega_core/$(DEPDIR)/$(am__dirstamp) -../src/omega_core/libomega_a-oc_quick_kill.$(OBJEXT): \ - ../src/omega_core/$(am__dirstamp) \ - ../src/omega_core/$(DEPDIR)/$(am__dirstamp) -../src/omega_core/libomega_a-oc_util.$(OBJEXT): \ - ../src/omega_core/$(am__dirstamp) \ - ../src/omega_core/$(DEPDIR)/$(am__dirstamp) -../src/$(am__dirstamp): - @$(MKDIR_P) ../src - @: > ../src/$(am__dirstamp) -../src/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) ../src/$(DEPDIR) - @: > ../src/$(DEPDIR)/$(am__dirstamp) -../src/libomega_a-pres_beaut.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libomega_a-pres_cnstr.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libomega_a-pres_col.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libomega_a-pres_conj.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libomega_a-pres_decl.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libomega_a-pres_dnf.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libomega_a-pres_form.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libomega_a-pres_gen.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libomega_a-pres_logic.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libomega_a-pres_print.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libomega_a-pres_rear.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libomega_a-pres_quant.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libomega_a-pres_subs.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libomega_a-pres_var.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libomega_a-evac.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libomega_a-farkas.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libomega_a-hull_legacy.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libomega_a-hull_simple.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libomega_a-Relation.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libomega_a-Relations.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libomega_a-RelBody.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libomega_a-RelVar.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libomega_a-closure.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) -../src/libomega_a-reach.$(OBJEXT): ../src/$(am__dirstamp) \ - ../src/$(DEPDIR)/$(am__dirstamp) - -libomega.a: $(libomega_a_OBJECTS) $(libomega_a_DEPENDENCIES) $(EXTRA_libomega_a_DEPENDENCIES) - $(AM_V_at)-rm -f libomega.a - $(AM_V_AR)$(libomega_a_AR) libomega.a $(libomega_a_OBJECTS) $(libomega_a_LIBADD) - $(AM_V_at)$(RANLIB) libomega.a - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -rm -f ../../basic/src/*.$(OBJEXT) - -rm -f ../src/*.$(OBJEXT) - -rm -f ../src/omega_core/*.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@../../basic/src/$(DEPDIR)/libomega_a-ConstString.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../../basic/src/$(DEPDIR)/libomega_a-Link.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libomega_a-RelBody.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libomega_a-RelVar.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libomega_a-Relation.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libomega_a-Relations.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libomega_a-closure.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libomega_a-evac.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libomega_a-farkas.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libomega_a-hull_legacy.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libomega_a-hull_simple.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libomega_a-pres_beaut.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libomega_a-pres_cnstr.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libomega_a-pres_col.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libomega_a-pres_conj.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libomega_a-pres_decl.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libomega_a-pres_dnf.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libomega_a-pres_form.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libomega_a-pres_gen.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libomega_a-pres_logic.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libomega_a-pres_print.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libomega_a-pres_quant.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libomega_a-pres_rear.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libomega_a-pres_subs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libomega_a-pres_var.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/$(DEPDIR)/libomega_a-reach.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/omega_core/$(DEPDIR)/libomega_a-oc.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/omega_core/$(DEPDIR)/libomega_a-oc_eq.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/omega_core/$(DEPDIR)/libomega_a-oc_exp_kill.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/omega_core/$(DEPDIR)/libomega_a-oc_global.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/omega_core/$(DEPDIR)/libomega_a-oc_print.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/omega_core/$(DEPDIR)/libomega_a-oc_problems.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/omega_core/$(DEPDIR)/libomega_a-oc_query.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/omega_core/$(DEPDIR)/libomega_a-oc_quick_kill.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/omega_core/$(DEPDIR)/libomega_a-oc_simple.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/omega_core/$(DEPDIR)/libomega_a-oc_solve.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@../src/omega_core/$(DEPDIR)/libomega_a-oc_util.Po@am__quote@ - -.cc.o: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< - -.cc.obj: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -../../basic/src/libomega_a-ConstString.o: ../../basic/src/ConstString.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../../basic/src/libomega_a-ConstString.o -MD -MP -MF ../../basic/src/$(DEPDIR)/libomega_a-ConstString.Tpo -c -o ../../basic/src/libomega_a-ConstString.o `test -f '../../basic/src/ConstString.cc' || echo '$(srcdir)/'`../../basic/src/ConstString.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../../basic/src/$(DEPDIR)/libomega_a-ConstString.Tpo ../../basic/src/$(DEPDIR)/libomega_a-ConstString.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../../basic/src/ConstString.cc' object='../../basic/src/libomega_a-ConstString.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../../basic/src/libomega_a-ConstString.o `test -f '../../basic/src/ConstString.cc' || echo '$(srcdir)/'`../../basic/src/ConstString.cc - -../../basic/src/libomega_a-ConstString.obj: ../../basic/src/ConstString.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../../basic/src/libomega_a-ConstString.obj -MD -MP -MF ../../basic/src/$(DEPDIR)/libomega_a-ConstString.Tpo -c -o ../../basic/src/libomega_a-ConstString.obj `if test -f '../../basic/src/ConstString.cc'; then $(CYGPATH_W) '../../basic/src/ConstString.cc'; else $(CYGPATH_W) '$(srcdir)/../../basic/src/ConstString.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../../basic/src/$(DEPDIR)/libomega_a-ConstString.Tpo ../../basic/src/$(DEPDIR)/libomega_a-ConstString.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../../basic/src/ConstString.cc' object='../../basic/src/libomega_a-ConstString.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../../basic/src/libomega_a-ConstString.obj `if test -f '../../basic/src/ConstString.cc'; then $(CYGPATH_W) '../../basic/src/ConstString.cc'; else $(CYGPATH_W) '$(srcdir)/../../basic/src/ConstString.cc'; fi` - -../../basic/src/libomega_a-Link.o: ../../basic/src/Link.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../../basic/src/libomega_a-Link.o -MD -MP -MF ../../basic/src/$(DEPDIR)/libomega_a-Link.Tpo -c -o ../../basic/src/libomega_a-Link.o `test -f '../../basic/src/Link.cc' || echo '$(srcdir)/'`../../basic/src/Link.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../../basic/src/$(DEPDIR)/libomega_a-Link.Tpo ../../basic/src/$(DEPDIR)/libomega_a-Link.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../../basic/src/Link.cc' object='../../basic/src/libomega_a-Link.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../../basic/src/libomega_a-Link.o `test -f '../../basic/src/Link.cc' || echo '$(srcdir)/'`../../basic/src/Link.cc - -../../basic/src/libomega_a-Link.obj: ../../basic/src/Link.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../../basic/src/libomega_a-Link.obj -MD -MP -MF ../../basic/src/$(DEPDIR)/libomega_a-Link.Tpo -c -o ../../basic/src/libomega_a-Link.obj `if test -f '../../basic/src/Link.cc'; then $(CYGPATH_W) '../../basic/src/Link.cc'; else $(CYGPATH_W) '$(srcdir)/../../basic/src/Link.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../../basic/src/$(DEPDIR)/libomega_a-Link.Tpo ../../basic/src/$(DEPDIR)/libomega_a-Link.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../../basic/src/Link.cc' object='../../basic/src/libomega_a-Link.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../../basic/src/libomega_a-Link.obj `if test -f '../../basic/src/Link.cc'; then $(CYGPATH_W) '../../basic/src/Link.cc'; else $(CYGPATH_W) '$(srcdir)/../../basic/src/Link.cc'; fi` - -../src/omega_core/libomega_a-oc.o: ../src/omega_core/oc.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/omega_core/libomega_a-oc.o -MD -MP -MF ../src/omega_core/$(DEPDIR)/libomega_a-oc.Tpo -c -o ../src/omega_core/libomega_a-oc.o `test -f '../src/omega_core/oc.cc' || echo '$(srcdir)/'`../src/omega_core/oc.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/omega_core/$(DEPDIR)/libomega_a-oc.Tpo ../src/omega_core/$(DEPDIR)/libomega_a-oc.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/omega_core/oc.cc' object='../src/omega_core/libomega_a-oc.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/omega_core/libomega_a-oc.o `test -f '../src/omega_core/oc.cc' || echo '$(srcdir)/'`../src/omega_core/oc.cc - -../src/omega_core/libomega_a-oc.obj: ../src/omega_core/oc.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/omega_core/libomega_a-oc.obj -MD -MP -MF ../src/omega_core/$(DEPDIR)/libomega_a-oc.Tpo -c -o ../src/omega_core/libomega_a-oc.obj `if test -f '../src/omega_core/oc.cc'; then $(CYGPATH_W) '../src/omega_core/oc.cc'; else $(CYGPATH_W) '$(srcdir)/../src/omega_core/oc.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/omega_core/$(DEPDIR)/libomega_a-oc.Tpo ../src/omega_core/$(DEPDIR)/libomega_a-oc.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/omega_core/oc.cc' object='../src/omega_core/libomega_a-oc.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/omega_core/libomega_a-oc.obj `if test -f '../src/omega_core/oc.cc'; then $(CYGPATH_W) '../src/omega_core/oc.cc'; else $(CYGPATH_W) '$(srcdir)/../src/omega_core/oc.cc'; fi` - -../src/omega_core/libomega_a-oc_eq.o: ../src/omega_core/oc_eq.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/omega_core/libomega_a-oc_eq.o -MD -MP -MF ../src/omega_core/$(DEPDIR)/libomega_a-oc_eq.Tpo -c -o ../src/omega_core/libomega_a-oc_eq.o `test -f '../src/omega_core/oc_eq.cc' || echo '$(srcdir)/'`../src/omega_core/oc_eq.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/omega_core/$(DEPDIR)/libomega_a-oc_eq.Tpo ../src/omega_core/$(DEPDIR)/libomega_a-oc_eq.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/omega_core/oc_eq.cc' object='../src/omega_core/libomega_a-oc_eq.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/omega_core/libomega_a-oc_eq.o `test -f '../src/omega_core/oc_eq.cc' || echo '$(srcdir)/'`../src/omega_core/oc_eq.cc - -../src/omega_core/libomega_a-oc_eq.obj: ../src/omega_core/oc_eq.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/omega_core/libomega_a-oc_eq.obj -MD -MP -MF ../src/omega_core/$(DEPDIR)/libomega_a-oc_eq.Tpo -c -o ../src/omega_core/libomega_a-oc_eq.obj `if test -f '../src/omega_core/oc_eq.cc'; then $(CYGPATH_W) '../src/omega_core/oc_eq.cc'; else $(CYGPATH_W) '$(srcdir)/../src/omega_core/oc_eq.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/omega_core/$(DEPDIR)/libomega_a-oc_eq.Tpo ../src/omega_core/$(DEPDIR)/libomega_a-oc_eq.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/omega_core/oc_eq.cc' object='../src/omega_core/libomega_a-oc_eq.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/omega_core/libomega_a-oc_eq.obj `if test -f '../src/omega_core/oc_eq.cc'; then $(CYGPATH_W) '../src/omega_core/oc_eq.cc'; else $(CYGPATH_W) '$(srcdir)/../src/omega_core/oc_eq.cc'; fi` - -../src/omega_core/libomega_a-oc_exp_kill.o: ../src/omega_core/oc_exp_kill.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/omega_core/libomega_a-oc_exp_kill.o -MD -MP -MF ../src/omega_core/$(DEPDIR)/libomega_a-oc_exp_kill.Tpo -c -o ../src/omega_core/libomega_a-oc_exp_kill.o `test -f '../src/omega_core/oc_exp_kill.cc' || echo '$(srcdir)/'`../src/omega_core/oc_exp_kill.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/omega_core/$(DEPDIR)/libomega_a-oc_exp_kill.Tpo ../src/omega_core/$(DEPDIR)/libomega_a-oc_exp_kill.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/omega_core/oc_exp_kill.cc' object='../src/omega_core/libomega_a-oc_exp_kill.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/omega_core/libomega_a-oc_exp_kill.o `test -f '../src/omega_core/oc_exp_kill.cc' || echo '$(srcdir)/'`../src/omega_core/oc_exp_kill.cc - -../src/omega_core/libomega_a-oc_exp_kill.obj: ../src/omega_core/oc_exp_kill.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/omega_core/libomega_a-oc_exp_kill.obj -MD -MP -MF ../src/omega_core/$(DEPDIR)/libomega_a-oc_exp_kill.Tpo -c -o ../src/omega_core/libomega_a-oc_exp_kill.obj `if test -f '../src/omega_core/oc_exp_kill.cc'; then $(CYGPATH_W) '../src/omega_core/oc_exp_kill.cc'; else $(CYGPATH_W) '$(srcdir)/../src/omega_core/oc_exp_kill.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/omega_core/$(DEPDIR)/libomega_a-oc_exp_kill.Tpo ../src/omega_core/$(DEPDIR)/libomega_a-oc_exp_kill.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/omega_core/oc_exp_kill.cc' object='../src/omega_core/libomega_a-oc_exp_kill.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/omega_core/libomega_a-oc_exp_kill.obj `if test -f '../src/omega_core/oc_exp_kill.cc'; then $(CYGPATH_W) '../src/omega_core/oc_exp_kill.cc'; else $(CYGPATH_W) '$(srcdir)/../src/omega_core/oc_exp_kill.cc'; fi` - -../src/omega_core/libomega_a-oc_global.o: ../src/omega_core/oc_global.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/omega_core/libomega_a-oc_global.o -MD -MP -MF ../src/omega_core/$(DEPDIR)/libomega_a-oc_global.Tpo -c -o ../src/omega_core/libomega_a-oc_global.o `test -f '../src/omega_core/oc_global.cc' || echo '$(srcdir)/'`../src/omega_core/oc_global.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/omega_core/$(DEPDIR)/libomega_a-oc_global.Tpo ../src/omega_core/$(DEPDIR)/libomega_a-oc_global.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/omega_core/oc_global.cc' object='../src/omega_core/libomega_a-oc_global.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/omega_core/libomega_a-oc_global.o `test -f '../src/omega_core/oc_global.cc' || echo '$(srcdir)/'`../src/omega_core/oc_global.cc - -../src/omega_core/libomega_a-oc_global.obj: ../src/omega_core/oc_global.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/omega_core/libomega_a-oc_global.obj -MD -MP -MF ../src/omega_core/$(DEPDIR)/libomega_a-oc_global.Tpo -c -o ../src/omega_core/libomega_a-oc_global.obj `if test -f '../src/omega_core/oc_global.cc'; then $(CYGPATH_W) '../src/omega_core/oc_global.cc'; else $(CYGPATH_W) '$(srcdir)/../src/omega_core/oc_global.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/omega_core/$(DEPDIR)/libomega_a-oc_global.Tpo ../src/omega_core/$(DEPDIR)/libomega_a-oc_global.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/omega_core/oc_global.cc' object='../src/omega_core/libomega_a-oc_global.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/omega_core/libomega_a-oc_global.obj `if test -f '../src/omega_core/oc_global.cc'; then $(CYGPATH_W) '../src/omega_core/oc_global.cc'; else $(CYGPATH_W) '$(srcdir)/../src/omega_core/oc_global.cc'; fi` - -../src/omega_core/libomega_a-oc_print.o: ../src/omega_core/oc_print.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/omega_core/libomega_a-oc_print.o -MD -MP -MF ../src/omega_core/$(DEPDIR)/libomega_a-oc_print.Tpo -c -o ../src/omega_core/libomega_a-oc_print.o `test -f '../src/omega_core/oc_print.cc' || echo '$(srcdir)/'`../src/omega_core/oc_print.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/omega_core/$(DEPDIR)/libomega_a-oc_print.Tpo ../src/omega_core/$(DEPDIR)/libomega_a-oc_print.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/omega_core/oc_print.cc' object='../src/omega_core/libomega_a-oc_print.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/omega_core/libomega_a-oc_print.o `test -f '../src/omega_core/oc_print.cc' || echo '$(srcdir)/'`../src/omega_core/oc_print.cc - -../src/omega_core/libomega_a-oc_print.obj: ../src/omega_core/oc_print.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/omega_core/libomega_a-oc_print.obj -MD -MP -MF ../src/omega_core/$(DEPDIR)/libomega_a-oc_print.Tpo -c -o ../src/omega_core/libomega_a-oc_print.obj `if test -f '../src/omega_core/oc_print.cc'; then $(CYGPATH_W) '../src/omega_core/oc_print.cc'; else $(CYGPATH_W) '$(srcdir)/../src/omega_core/oc_print.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/omega_core/$(DEPDIR)/libomega_a-oc_print.Tpo ../src/omega_core/$(DEPDIR)/libomega_a-oc_print.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/omega_core/oc_print.cc' object='../src/omega_core/libomega_a-oc_print.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/omega_core/libomega_a-oc_print.obj `if test -f '../src/omega_core/oc_print.cc'; then $(CYGPATH_W) '../src/omega_core/oc_print.cc'; else $(CYGPATH_W) '$(srcdir)/../src/omega_core/oc_print.cc'; fi` - -../src/omega_core/libomega_a-oc_problems.o: ../src/omega_core/oc_problems.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/omega_core/libomega_a-oc_problems.o -MD -MP -MF ../src/omega_core/$(DEPDIR)/libomega_a-oc_problems.Tpo -c -o ../src/omega_core/libomega_a-oc_problems.o `test -f '../src/omega_core/oc_problems.cc' || echo '$(srcdir)/'`../src/omega_core/oc_problems.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/omega_core/$(DEPDIR)/libomega_a-oc_problems.Tpo ../src/omega_core/$(DEPDIR)/libomega_a-oc_problems.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/omega_core/oc_problems.cc' object='../src/omega_core/libomega_a-oc_problems.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/omega_core/libomega_a-oc_problems.o `test -f '../src/omega_core/oc_problems.cc' || echo '$(srcdir)/'`../src/omega_core/oc_problems.cc - -../src/omega_core/libomega_a-oc_problems.obj: ../src/omega_core/oc_problems.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/omega_core/libomega_a-oc_problems.obj -MD -MP -MF ../src/omega_core/$(DEPDIR)/libomega_a-oc_problems.Tpo -c -o ../src/omega_core/libomega_a-oc_problems.obj `if test -f '../src/omega_core/oc_problems.cc'; then $(CYGPATH_W) '../src/omega_core/oc_problems.cc'; else $(CYGPATH_W) '$(srcdir)/../src/omega_core/oc_problems.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/omega_core/$(DEPDIR)/libomega_a-oc_problems.Tpo ../src/omega_core/$(DEPDIR)/libomega_a-oc_problems.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/omega_core/oc_problems.cc' object='../src/omega_core/libomega_a-oc_problems.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/omega_core/libomega_a-oc_problems.obj `if test -f '../src/omega_core/oc_problems.cc'; then $(CYGPATH_W) '../src/omega_core/oc_problems.cc'; else $(CYGPATH_W) '$(srcdir)/../src/omega_core/oc_problems.cc'; fi` - -../src/omega_core/libomega_a-oc_simple.o: ../src/omega_core/oc_simple.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/omega_core/libomega_a-oc_simple.o -MD -MP -MF ../src/omega_core/$(DEPDIR)/libomega_a-oc_simple.Tpo -c -o ../src/omega_core/libomega_a-oc_simple.o `test -f '../src/omega_core/oc_simple.cc' || echo '$(srcdir)/'`../src/omega_core/oc_simple.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/omega_core/$(DEPDIR)/libomega_a-oc_simple.Tpo ../src/omega_core/$(DEPDIR)/libomega_a-oc_simple.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/omega_core/oc_simple.cc' object='../src/omega_core/libomega_a-oc_simple.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/omega_core/libomega_a-oc_simple.o `test -f '../src/omega_core/oc_simple.cc' || echo '$(srcdir)/'`../src/omega_core/oc_simple.cc - -../src/omega_core/libomega_a-oc_simple.obj: ../src/omega_core/oc_simple.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/omega_core/libomega_a-oc_simple.obj -MD -MP -MF ../src/omega_core/$(DEPDIR)/libomega_a-oc_simple.Tpo -c -o ../src/omega_core/libomega_a-oc_simple.obj `if test -f '../src/omega_core/oc_simple.cc'; then $(CYGPATH_W) '../src/omega_core/oc_simple.cc'; else $(CYGPATH_W) '$(srcdir)/../src/omega_core/oc_simple.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/omega_core/$(DEPDIR)/libomega_a-oc_simple.Tpo ../src/omega_core/$(DEPDIR)/libomega_a-oc_simple.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/omega_core/oc_simple.cc' object='../src/omega_core/libomega_a-oc_simple.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/omega_core/libomega_a-oc_simple.obj `if test -f '../src/omega_core/oc_simple.cc'; then $(CYGPATH_W) '../src/omega_core/oc_simple.cc'; else $(CYGPATH_W) '$(srcdir)/../src/omega_core/oc_simple.cc'; fi` - -../src/omega_core/libomega_a-oc_solve.o: ../src/omega_core/oc_solve.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/omega_core/libomega_a-oc_solve.o -MD -MP -MF ../src/omega_core/$(DEPDIR)/libomega_a-oc_solve.Tpo -c -o ../src/omega_core/libomega_a-oc_solve.o `test -f '../src/omega_core/oc_solve.cc' || echo '$(srcdir)/'`../src/omega_core/oc_solve.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/omega_core/$(DEPDIR)/libomega_a-oc_solve.Tpo ../src/omega_core/$(DEPDIR)/libomega_a-oc_solve.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/omega_core/oc_solve.cc' object='../src/omega_core/libomega_a-oc_solve.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/omega_core/libomega_a-oc_solve.o `test -f '../src/omega_core/oc_solve.cc' || echo '$(srcdir)/'`../src/omega_core/oc_solve.cc - -../src/omega_core/libomega_a-oc_solve.obj: ../src/omega_core/oc_solve.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/omega_core/libomega_a-oc_solve.obj -MD -MP -MF ../src/omega_core/$(DEPDIR)/libomega_a-oc_solve.Tpo -c -o ../src/omega_core/libomega_a-oc_solve.obj `if test -f '../src/omega_core/oc_solve.cc'; then $(CYGPATH_W) '../src/omega_core/oc_solve.cc'; else $(CYGPATH_W) '$(srcdir)/../src/omega_core/oc_solve.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/omega_core/$(DEPDIR)/libomega_a-oc_solve.Tpo ../src/omega_core/$(DEPDIR)/libomega_a-oc_solve.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/omega_core/oc_solve.cc' object='../src/omega_core/libomega_a-oc_solve.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/omega_core/libomega_a-oc_solve.obj `if test -f '../src/omega_core/oc_solve.cc'; then $(CYGPATH_W) '../src/omega_core/oc_solve.cc'; else $(CYGPATH_W) '$(srcdir)/../src/omega_core/oc_solve.cc'; fi` - -../src/omega_core/libomega_a-oc_query.o: ../src/omega_core/oc_query.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/omega_core/libomega_a-oc_query.o -MD -MP -MF ../src/omega_core/$(DEPDIR)/libomega_a-oc_query.Tpo -c -o ../src/omega_core/libomega_a-oc_query.o `test -f '../src/omega_core/oc_query.cc' || echo '$(srcdir)/'`../src/omega_core/oc_query.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/omega_core/$(DEPDIR)/libomega_a-oc_query.Tpo ../src/omega_core/$(DEPDIR)/libomega_a-oc_query.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/omega_core/oc_query.cc' object='../src/omega_core/libomega_a-oc_query.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/omega_core/libomega_a-oc_query.o `test -f '../src/omega_core/oc_query.cc' || echo '$(srcdir)/'`../src/omega_core/oc_query.cc - -../src/omega_core/libomega_a-oc_query.obj: ../src/omega_core/oc_query.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/omega_core/libomega_a-oc_query.obj -MD -MP -MF ../src/omega_core/$(DEPDIR)/libomega_a-oc_query.Tpo -c -o ../src/omega_core/libomega_a-oc_query.obj `if test -f '../src/omega_core/oc_query.cc'; then $(CYGPATH_W) '../src/omega_core/oc_query.cc'; else $(CYGPATH_W) '$(srcdir)/../src/omega_core/oc_query.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/omega_core/$(DEPDIR)/libomega_a-oc_query.Tpo ../src/omega_core/$(DEPDIR)/libomega_a-oc_query.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/omega_core/oc_query.cc' object='../src/omega_core/libomega_a-oc_query.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/omega_core/libomega_a-oc_query.obj `if test -f '../src/omega_core/oc_query.cc'; then $(CYGPATH_W) '../src/omega_core/oc_query.cc'; else $(CYGPATH_W) '$(srcdir)/../src/omega_core/oc_query.cc'; fi` - -../src/omega_core/libomega_a-oc_quick_kill.o: ../src/omega_core/oc_quick_kill.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/omega_core/libomega_a-oc_quick_kill.o -MD -MP -MF ../src/omega_core/$(DEPDIR)/libomega_a-oc_quick_kill.Tpo -c -o ../src/omega_core/libomega_a-oc_quick_kill.o `test -f '../src/omega_core/oc_quick_kill.cc' || echo '$(srcdir)/'`../src/omega_core/oc_quick_kill.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/omega_core/$(DEPDIR)/libomega_a-oc_quick_kill.Tpo ../src/omega_core/$(DEPDIR)/libomega_a-oc_quick_kill.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/omega_core/oc_quick_kill.cc' object='../src/omega_core/libomega_a-oc_quick_kill.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/omega_core/libomega_a-oc_quick_kill.o `test -f '../src/omega_core/oc_quick_kill.cc' || echo '$(srcdir)/'`../src/omega_core/oc_quick_kill.cc - -../src/omega_core/libomega_a-oc_quick_kill.obj: ../src/omega_core/oc_quick_kill.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/omega_core/libomega_a-oc_quick_kill.obj -MD -MP -MF ../src/omega_core/$(DEPDIR)/libomega_a-oc_quick_kill.Tpo -c -o ../src/omega_core/libomega_a-oc_quick_kill.obj `if test -f '../src/omega_core/oc_quick_kill.cc'; then $(CYGPATH_W) '../src/omega_core/oc_quick_kill.cc'; else $(CYGPATH_W) '$(srcdir)/../src/omega_core/oc_quick_kill.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/omega_core/$(DEPDIR)/libomega_a-oc_quick_kill.Tpo ../src/omega_core/$(DEPDIR)/libomega_a-oc_quick_kill.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/omega_core/oc_quick_kill.cc' object='../src/omega_core/libomega_a-oc_quick_kill.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/omega_core/libomega_a-oc_quick_kill.obj `if test -f '../src/omega_core/oc_quick_kill.cc'; then $(CYGPATH_W) '../src/omega_core/oc_quick_kill.cc'; else $(CYGPATH_W) '$(srcdir)/../src/omega_core/oc_quick_kill.cc'; fi` - -../src/omega_core/libomega_a-oc_util.o: ../src/omega_core/oc_util.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/omega_core/libomega_a-oc_util.o -MD -MP -MF ../src/omega_core/$(DEPDIR)/libomega_a-oc_util.Tpo -c -o ../src/omega_core/libomega_a-oc_util.o `test -f '../src/omega_core/oc_util.cc' || echo '$(srcdir)/'`../src/omega_core/oc_util.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/omega_core/$(DEPDIR)/libomega_a-oc_util.Tpo ../src/omega_core/$(DEPDIR)/libomega_a-oc_util.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/omega_core/oc_util.cc' object='../src/omega_core/libomega_a-oc_util.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/omega_core/libomega_a-oc_util.o `test -f '../src/omega_core/oc_util.cc' || echo '$(srcdir)/'`../src/omega_core/oc_util.cc - -../src/omega_core/libomega_a-oc_util.obj: ../src/omega_core/oc_util.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/omega_core/libomega_a-oc_util.obj -MD -MP -MF ../src/omega_core/$(DEPDIR)/libomega_a-oc_util.Tpo -c -o ../src/omega_core/libomega_a-oc_util.obj `if test -f '../src/omega_core/oc_util.cc'; then $(CYGPATH_W) '../src/omega_core/oc_util.cc'; else $(CYGPATH_W) '$(srcdir)/../src/omega_core/oc_util.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/omega_core/$(DEPDIR)/libomega_a-oc_util.Tpo ../src/omega_core/$(DEPDIR)/libomega_a-oc_util.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/omega_core/oc_util.cc' object='../src/omega_core/libomega_a-oc_util.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/omega_core/libomega_a-oc_util.obj `if test -f '../src/omega_core/oc_util.cc'; then $(CYGPATH_W) '../src/omega_core/oc_util.cc'; else $(CYGPATH_W) '$(srcdir)/../src/omega_core/oc_util.cc'; fi` - -../src/libomega_a-pres_beaut.o: ../src/pres_beaut.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_beaut.o -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_beaut.Tpo -c -o ../src/libomega_a-pres_beaut.o `test -f '../src/pres_beaut.cc' || echo '$(srcdir)/'`../src/pres_beaut.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_beaut.Tpo ../src/$(DEPDIR)/libomega_a-pres_beaut.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_beaut.cc' object='../src/libomega_a-pres_beaut.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_beaut.o `test -f '../src/pres_beaut.cc' || echo '$(srcdir)/'`../src/pres_beaut.cc - -../src/libomega_a-pres_beaut.obj: ../src/pres_beaut.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_beaut.obj -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_beaut.Tpo -c -o ../src/libomega_a-pres_beaut.obj `if test -f '../src/pres_beaut.cc'; then $(CYGPATH_W) '../src/pres_beaut.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_beaut.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_beaut.Tpo ../src/$(DEPDIR)/libomega_a-pres_beaut.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_beaut.cc' object='../src/libomega_a-pres_beaut.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_beaut.obj `if test -f '../src/pres_beaut.cc'; then $(CYGPATH_W) '../src/pres_beaut.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_beaut.cc'; fi` - -../src/libomega_a-pres_cnstr.o: ../src/pres_cnstr.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_cnstr.o -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_cnstr.Tpo -c -o ../src/libomega_a-pres_cnstr.o `test -f '../src/pres_cnstr.cc' || echo '$(srcdir)/'`../src/pres_cnstr.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_cnstr.Tpo ../src/$(DEPDIR)/libomega_a-pres_cnstr.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_cnstr.cc' object='../src/libomega_a-pres_cnstr.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_cnstr.o `test -f '../src/pres_cnstr.cc' || echo '$(srcdir)/'`../src/pres_cnstr.cc - -../src/libomega_a-pres_cnstr.obj: ../src/pres_cnstr.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_cnstr.obj -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_cnstr.Tpo -c -o ../src/libomega_a-pres_cnstr.obj `if test -f '../src/pres_cnstr.cc'; then $(CYGPATH_W) '../src/pres_cnstr.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_cnstr.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_cnstr.Tpo ../src/$(DEPDIR)/libomega_a-pres_cnstr.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_cnstr.cc' object='../src/libomega_a-pres_cnstr.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_cnstr.obj `if test -f '../src/pres_cnstr.cc'; then $(CYGPATH_W) '../src/pres_cnstr.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_cnstr.cc'; fi` - -../src/libomega_a-pres_col.o: ../src/pres_col.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_col.o -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_col.Tpo -c -o ../src/libomega_a-pres_col.o `test -f '../src/pres_col.cc' || echo '$(srcdir)/'`../src/pres_col.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_col.Tpo ../src/$(DEPDIR)/libomega_a-pres_col.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_col.cc' object='../src/libomega_a-pres_col.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_col.o `test -f '../src/pres_col.cc' || echo '$(srcdir)/'`../src/pres_col.cc - -../src/libomega_a-pres_col.obj: ../src/pres_col.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_col.obj -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_col.Tpo -c -o ../src/libomega_a-pres_col.obj `if test -f '../src/pres_col.cc'; then $(CYGPATH_W) '../src/pres_col.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_col.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_col.Tpo ../src/$(DEPDIR)/libomega_a-pres_col.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_col.cc' object='../src/libomega_a-pres_col.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_col.obj `if test -f '../src/pres_col.cc'; then $(CYGPATH_W) '../src/pres_col.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_col.cc'; fi` - -../src/libomega_a-pres_conj.o: ../src/pres_conj.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_conj.o -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_conj.Tpo -c -o ../src/libomega_a-pres_conj.o `test -f '../src/pres_conj.cc' || echo '$(srcdir)/'`../src/pres_conj.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_conj.Tpo ../src/$(DEPDIR)/libomega_a-pres_conj.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_conj.cc' object='../src/libomega_a-pres_conj.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_conj.o `test -f '../src/pres_conj.cc' || echo '$(srcdir)/'`../src/pres_conj.cc - -../src/libomega_a-pres_conj.obj: ../src/pres_conj.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_conj.obj -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_conj.Tpo -c -o ../src/libomega_a-pres_conj.obj `if test -f '../src/pres_conj.cc'; then $(CYGPATH_W) '../src/pres_conj.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_conj.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_conj.Tpo ../src/$(DEPDIR)/libomega_a-pres_conj.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_conj.cc' object='../src/libomega_a-pres_conj.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_conj.obj `if test -f '../src/pres_conj.cc'; then $(CYGPATH_W) '../src/pres_conj.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_conj.cc'; fi` - -../src/libomega_a-pres_decl.o: ../src/pres_decl.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_decl.o -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_decl.Tpo -c -o ../src/libomega_a-pres_decl.o `test -f '../src/pres_decl.cc' || echo '$(srcdir)/'`../src/pres_decl.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_decl.Tpo ../src/$(DEPDIR)/libomega_a-pres_decl.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_decl.cc' object='../src/libomega_a-pres_decl.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_decl.o `test -f '../src/pres_decl.cc' || echo '$(srcdir)/'`../src/pres_decl.cc - -../src/libomega_a-pres_decl.obj: ../src/pres_decl.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_decl.obj -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_decl.Tpo -c -o ../src/libomega_a-pres_decl.obj `if test -f '../src/pres_decl.cc'; then $(CYGPATH_W) '../src/pres_decl.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_decl.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_decl.Tpo ../src/$(DEPDIR)/libomega_a-pres_decl.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_decl.cc' object='../src/libomega_a-pres_decl.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_decl.obj `if test -f '../src/pres_decl.cc'; then $(CYGPATH_W) '../src/pres_decl.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_decl.cc'; fi` - -../src/libomega_a-pres_dnf.o: ../src/pres_dnf.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_dnf.o -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_dnf.Tpo -c -o ../src/libomega_a-pres_dnf.o `test -f '../src/pres_dnf.cc' || echo '$(srcdir)/'`../src/pres_dnf.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_dnf.Tpo ../src/$(DEPDIR)/libomega_a-pres_dnf.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_dnf.cc' object='../src/libomega_a-pres_dnf.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_dnf.o `test -f '../src/pres_dnf.cc' || echo '$(srcdir)/'`../src/pres_dnf.cc - -../src/libomega_a-pres_dnf.obj: ../src/pres_dnf.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_dnf.obj -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_dnf.Tpo -c -o ../src/libomega_a-pres_dnf.obj `if test -f '../src/pres_dnf.cc'; then $(CYGPATH_W) '../src/pres_dnf.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_dnf.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_dnf.Tpo ../src/$(DEPDIR)/libomega_a-pres_dnf.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_dnf.cc' object='../src/libomega_a-pres_dnf.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_dnf.obj `if test -f '../src/pres_dnf.cc'; then $(CYGPATH_W) '../src/pres_dnf.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_dnf.cc'; fi` - -../src/libomega_a-pres_form.o: ../src/pres_form.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_form.o -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_form.Tpo -c -o ../src/libomega_a-pres_form.o `test -f '../src/pres_form.cc' || echo '$(srcdir)/'`../src/pres_form.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_form.Tpo ../src/$(DEPDIR)/libomega_a-pres_form.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_form.cc' object='../src/libomega_a-pres_form.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_form.o `test -f '../src/pres_form.cc' || echo '$(srcdir)/'`../src/pres_form.cc - -../src/libomega_a-pres_form.obj: ../src/pres_form.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_form.obj -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_form.Tpo -c -o ../src/libomega_a-pres_form.obj `if test -f '../src/pres_form.cc'; then $(CYGPATH_W) '../src/pres_form.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_form.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_form.Tpo ../src/$(DEPDIR)/libomega_a-pres_form.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_form.cc' object='../src/libomega_a-pres_form.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_form.obj `if test -f '../src/pres_form.cc'; then $(CYGPATH_W) '../src/pres_form.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_form.cc'; fi` - -../src/libomega_a-pres_gen.o: ../src/pres_gen.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_gen.o -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_gen.Tpo -c -o ../src/libomega_a-pres_gen.o `test -f '../src/pres_gen.cc' || echo '$(srcdir)/'`../src/pres_gen.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_gen.Tpo ../src/$(DEPDIR)/libomega_a-pres_gen.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_gen.cc' object='../src/libomega_a-pres_gen.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_gen.o `test -f '../src/pres_gen.cc' || echo '$(srcdir)/'`../src/pres_gen.cc - -../src/libomega_a-pres_gen.obj: ../src/pres_gen.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_gen.obj -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_gen.Tpo -c -o ../src/libomega_a-pres_gen.obj `if test -f '../src/pres_gen.cc'; then $(CYGPATH_W) '../src/pres_gen.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_gen.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_gen.Tpo ../src/$(DEPDIR)/libomega_a-pres_gen.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_gen.cc' object='../src/libomega_a-pres_gen.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_gen.obj `if test -f '../src/pres_gen.cc'; then $(CYGPATH_W) '../src/pres_gen.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_gen.cc'; fi` - -../src/libomega_a-pres_logic.o: ../src/pres_logic.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_logic.o -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_logic.Tpo -c -o ../src/libomega_a-pres_logic.o `test -f '../src/pres_logic.cc' || echo '$(srcdir)/'`../src/pres_logic.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_logic.Tpo ../src/$(DEPDIR)/libomega_a-pres_logic.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_logic.cc' object='../src/libomega_a-pres_logic.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_logic.o `test -f '../src/pres_logic.cc' || echo '$(srcdir)/'`../src/pres_logic.cc - -../src/libomega_a-pres_logic.obj: ../src/pres_logic.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_logic.obj -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_logic.Tpo -c -o ../src/libomega_a-pres_logic.obj `if test -f '../src/pres_logic.cc'; then $(CYGPATH_W) '../src/pres_logic.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_logic.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_logic.Tpo ../src/$(DEPDIR)/libomega_a-pres_logic.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_logic.cc' object='../src/libomega_a-pres_logic.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_logic.obj `if test -f '../src/pres_logic.cc'; then $(CYGPATH_W) '../src/pres_logic.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_logic.cc'; fi` - -../src/libomega_a-pres_print.o: ../src/pres_print.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_print.o -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_print.Tpo -c -o ../src/libomega_a-pres_print.o `test -f '../src/pres_print.cc' || echo '$(srcdir)/'`../src/pres_print.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_print.Tpo ../src/$(DEPDIR)/libomega_a-pres_print.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_print.cc' object='../src/libomega_a-pres_print.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_print.o `test -f '../src/pres_print.cc' || echo '$(srcdir)/'`../src/pres_print.cc - -../src/libomega_a-pres_print.obj: ../src/pres_print.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_print.obj -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_print.Tpo -c -o ../src/libomega_a-pres_print.obj `if test -f '../src/pres_print.cc'; then $(CYGPATH_W) '../src/pres_print.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_print.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_print.Tpo ../src/$(DEPDIR)/libomega_a-pres_print.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_print.cc' object='../src/libomega_a-pres_print.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_print.obj `if test -f '../src/pres_print.cc'; then $(CYGPATH_W) '../src/pres_print.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_print.cc'; fi` - -../src/libomega_a-pres_rear.o: ../src/pres_rear.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_rear.o -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_rear.Tpo -c -o ../src/libomega_a-pres_rear.o `test -f '../src/pres_rear.cc' || echo '$(srcdir)/'`../src/pres_rear.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_rear.Tpo ../src/$(DEPDIR)/libomega_a-pres_rear.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_rear.cc' object='../src/libomega_a-pres_rear.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_rear.o `test -f '../src/pres_rear.cc' || echo '$(srcdir)/'`../src/pres_rear.cc - -../src/libomega_a-pres_rear.obj: ../src/pres_rear.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_rear.obj -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_rear.Tpo -c -o ../src/libomega_a-pres_rear.obj `if test -f '../src/pres_rear.cc'; then $(CYGPATH_W) '../src/pres_rear.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_rear.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_rear.Tpo ../src/$(DEPDIR)/libomega_a-pres_rear.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_rear.cc' object='../src/libomega_a-pres_rear.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_rear.obj `if test -f '../src/pres_rear.cc'; then $(CYGPATH_W) '../src/pres_rear.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_rear.cc'; fi` - -../src/libomega_a-pres_quant.o: ../src/pres_quant.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_quant.o -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_quant.Tpo -c -o ../src/libomega_a-pres_quant.o `test -f '../src/pres_quant.cc' || echo '$(srcdir)/'`../src/pres_quant.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_quant.Tpo ../src/$(DEPDIR)/libomega_a-pres_quant.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_quant.cc' object='../src/libomega_a-pres_quant.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_quant.o `test -f '../src/pres_quant.cc' || echo '$(srcdir)/'`../src/pres_quant.cc - -../src/libomega_a-pres_quant.obj: ../src/pres_quant.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_quant.obj -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_quant.Tpo -c -o ../src/libomega_a-pres_quant.obj `if test -f '../src/pres_quant.cc'; then $(CYGPATH_W) '../src/pres_quant.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_quant.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_quant.Tpo ../src/$(DEPDIR)/libomega_a-pres_quant.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_quant.cc' object='../src/libomega_a-pres_quant.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_quant.obj `if test -f '../src/pres_quant.cc'; then $(CYGPATH_W) '../src/pres_quant.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_quant.cc'; fi` - -../src/libomega_a-pres_subs.o: ../src/pres_subs.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_subs.o -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_subs.Tpo -c -o ../src/libomega_a-pres_subs.o `test -f '../src/pres_subs.cc' || echo '$(srcdir)/'`../src/pres_subs.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_subs.Tpo ../src/$(DEPDIR)/libomega_a-pres_subs.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_subs.cc' object='../src/libomega_a-pres_subs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_subs.o `test -f '../src/pres_subs.cc' || echo '$(srcdir)/'`../src/pres_subs.cc - -../src/libomega_a-pres_subs.obj: ../src/pres_subs.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_subs.obj -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_subs.Tpo -c -o ../src/libomega_a-pres_subs.obj `if test -f '../src/pres_subs.cc'; then $(CYGPATH_W) '../src/pres_subs.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_subs.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_subs.Tpo ../src/$(DEPDIR)/libomega_a-pres_subs.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_subs.cc' object='../src/libomega_a-pres_subs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_subs.obj `if test -f '../src/pres_subs.cc'; then $(CYGPATH_W) '../src/pres_subs.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_subs.cc'; fi` - -../src/libomega_a-pres_var.o: ../src/pres_var.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_var.o -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_var.Tpo -c -o ../src/libomega_a-pres_var.o `test -f '../src/pres_var.cc' || echo '$(srcdir)/'`../src/pres_var.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_var.Tpo ../src/$(DEPDIR)/libomega_a-pres_var.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_var.cc' object='../src/libomega_a-pres_var.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_var.o `test -f '../src/pres_var.cc' || echo '$(srcdir)/'`../src/pres_var.cc - -../src/libomega_a-pres_var.obj: ../src/pres_var.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-pres_var.obj -MD -MP -MF ../src/$(DEPDIR)/libomega_a-pres_var.Tpo -c -o ../src/libomega_a-pres_var.obj `if test -f '../src/pres_var.cc'; then $(CYGPATH_W) '../src/pres_var.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_var.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-pres_var.Tpo ../src/$(DEPDIR)/libomega_a-pres_var.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/pres_var.cc' object='../src/libomega_a-pres_var.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-pres_var.obj `if test -f '../src/pres_var.cc'; then $(CYGPATH_W) '../src/pres_var.cc'; else $(CYGPATH_W) '$(srcdir)/../src/pres_var.cc'; fi` - -../src/libomega_a-evac.o: ../src/evac.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-evac.o -MD -MP -MF ../src/$(DEPDIR)/libomega_a-evac.Tpo -c -o ../src/libomega_a-evac.o `test -f '../src/evac.cc' || echo '$(srcdir)/'`../src/evac.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-evac.Tpo ../src/$(DEPDIR)/libomega_a-evac.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/evac.cc' object='../src/libomega_a-evac.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-evac.o `test -f '../src/evac.cc' || echo '$(srcdir)/'`../src/evac.cc - -../src/libomega_a-evac.obj: ../src/evac.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-evac.obj -MD -MP -MF ../src/$(DEPDIR)/libomega_a-evac.Tpo -c -o ../src/libomega_a-evac.obj `if test -f '../src/evac.cc'; then $(CYGPATH_W) '../src/evac.cc'; else $(CYGPATH_W) '$(srcdir)/../src/evac.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-evac.Tpo ../src/$(DEPDIR)/libomega_a-evac.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/evac.cc' object='../src/libomega_a-evac.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-evac.obj `if test -f '../src/evac.cc'; then $(CYGPATH_W) '../src/evac.cc'; else $(CYGPATH_W) '$(srcdir)/../src/evac.cc'; fi` - -../src/libomega_a-farkas.o: ../src/farkas.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-farkas.o -MD -MP -MF ../src/$(DEPDIR)/libomega_a-farkas.Tpo -c -o ../src/libomega_a-farkas.o `test -f '../src/farkas.cc' || echo '$(srcdir)/'`../src/farkas.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-farkas.Tpo ../src/$(DEPDIR)/libomega_a-farkas.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/farkas.cc' object='../src/libomega_a-farkas.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-farkas.o `test -f '../src/farkas.cc' || echo '$(srcdir)/'`../src/farkas.cc - -../src/libomega_a-farkas.obj: ../src/farkas.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-farkas.obj -MD -MP -MF ../src/$(DEPDIR)/libomega_a-farkas.Tpo -c -o ../src/libomega_a-farkas.obj `if test -f '../src/farkas.cc'; then $(CYGPATH_W) '../src/farkas.cc'; else $(CYGPATH_W) '$(srcdir)/../src/farkas.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-farkas.Tpo ../src/$(DEPDIR)/libomega_a-farkas.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/farkas.cc' object='../src/libomega_a-farkas.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-farkas.obj `if test -f '../src/farkas.cc'; then $(CYGPATH_W) '../src/farkas.cc'; else $(CYGPATH_W) '$(srcdir)/../src/farkas.cc'; fi` - -../src/libomega_a-hull_legacy.o: ../src/hull_legacy.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-hull_legacy.o -MD -MP -MF ../src/$(DEPDIR)/libomega_a-hull_legacy.Tpo -c -o ../src/libomega_a-hull_legacy.o `test -f '../src/hull_legacy.cc' || echo '$(srcdir)/'`../src/hull_legacy.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-hull_legacy.Tpo ../src/$(DEPDIR)/libomega_a-hull_legacy.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/hull_legacy.cc' object='../src/libomega_a-hull_legacy.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-hull_legacy.o `test -f '../src/hull_legacy.cc' || echo '$(srcdir)/'`../src/hull_legacy.cc - -../src/libomega_a-hull_legacy.obj: ../src/hull_legacy.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-hull_legacy.obj -MD -MP -MF ../src/$(DEPDIR)/libomega_a-hull_legacy.Tpo -c -o ../src/libomega_a-hull_legacy.obj `if test -f '../src/hull_legacy.cc'; then $(CYGPATH_W) '../src/hull_legacy.cc'; else $(CYGPATH_W) '$(srcdir)/../src/hull_legacy.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-hull_legacy.Tpo ../src/$(DEPDIR)/libomega_a-hull_legacy.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/hull_legacy.cc' object='../src/libomega_a-hull_legacy.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-hull_legacy.obj `if test -f '../src/hull_legacy.cc'; then $(CYGPATH_W) '../src/hull_legacy.cc'; else $(CYGPATH_W) '$(srcdir)/../src/hull_legacy.cc'; fi` - -../src/libomega_a-hull_simple.o: ../src/hull_simple.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-hull_simple.o -MD -MP -MF ../src/$(DEPDIR)/libomega_a-hull_simple.Tpo -c -o ../src/libomega_a-hull_simple.o `test -f '../src/hull_simple.cc' || echo '$(srcdir)/'`../src/hull_simple.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-hull_simple.Tpo ../src/$(DEPDIR)/libomega_a-hull_simple.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/hull_simple.cc' object='../src/libomega_a-hull_simple.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-hull_simple.o `test -f '../src/hull_simple.cc' || echo '$(srcdir)/'`../src/hull_simple.cc - -../src/libomega_a-hull_simple.obj: ../src/hull_simple.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-hull_simple.obj -MD -MP -MF ../src/$(DEPDIR)/libomega_a-hull_simple.Tpo -c -o ../src/libomega_a-hull_simple.obj `if test -f '../src/hull_simple.cc'; then $(CYGPATH_W) '../src/hull_simple.cc'; else $(CYGPATH_W) '$(srcdir)/../src/hull_simple.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-hull_simple.Tpo ../src/$(DEPDIR)/libomega_a-hull_simple.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/hull_simple.cc' object='../src/libomega_a-hull_simple.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-hull_simple.obj `if test -f '../src/hull_simple.cc'; then $(CYGPATH_W) '../src/hull_simple.cc'; else $(CYGPATH_W) '$(srcdir)/../src/hull_simple.cc'; fi` - -../src/libomega_a-Relation.o: ../src/Relation.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-Relation.o -MD -MP -MF ../src/$(DEPDIR)/libomega_a-Relation.Tpo -c -o ../src/libomega_a-Relation.o `test -f '../src/Relation.cc' || echo '$(srcdir)/'`../src/Relation.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-Relation.Tpo ../src/$(DEPDIR)/libomega_a-Relation.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/Relation.cc' object='../src/libomega_a-Relation.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-Relation.o `test -f '../src/Relation.cc' || echo '$(srcdir)/'`../src/Relation.cc - -../src/libomega_a-Relation.obj: ../src/Relation.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-Relation.obj -MD -MP -MF ../src/$(DEPDIR)/libomega_a-Relation.Tpo -c -o ../src/libomega_a-Relation.obj `if test -f '../src/Relation.cc'; then $(CYGPATH_W) '../src/Relation.cc'; else $(CYGPATH_W) '$(srcdir)/../src/Relation.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-Relation.Tpo ../src/$(DEPDIR)/libomega_a-Relation.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/Relation.cc' object='../src/libomega_a-Relation.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-Relation.obj `if test -f '../src/Relation.cc'; then $(CYGPATH_W) '../src/Relation.cc'; else $(CYGPATH_W) '$(srcdir)/../src/Relation.cc'; fi` - -../src/libomega_a-Relations.o: ../src/Relations.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-Relations.o -MD -MP -MF ../src/$(DEPDIR)/libomega_a-Relations.Tpo -c -o ../src/libomega_a-Relations.o `test -f '../src/Relations.cc' || echo '$(srcdir)/'`../src/Relations.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-Relations.Tpo ../src/$(DEPDIR)/libomega_a-Relations.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/Relations.cc' object='../src/libomega_a-Relations.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-Relations.o `test -f '../src/Relations.cc' || echo '$(srcdir)/'`../src/Relations.cc - -../src/libomega_a-Relations.obj: ../src/Relations.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-Relations.obj -MD -MP -MF ../src/$(DEPDIR)/libomega_a-Relations.Tpo -c -o ../src/libomega_a-Relations.obj `if test -f '../src/Relations.cc'; then $(CYGPATH_W) '../src/Relations.cc'; else $(CYGPATH_W) '$(srcdir)/../src/Relations.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-Relations.Tpo ../src/$(DEPDIR)/libomega_a-Relations.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/Relations.cc' object='../src/libomega_a-Relations.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-Relations.obj `if test -f '../src/Relations.cc'; then $(CYGPATH_W) '../src/Relations.cc'; else $(CYGPATH_W) '$(srcdir)/../src/Relations.cc'; fi` - -../src/libomega_a-RelBody.o: ../src/RelBody.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-RelBody.o -MD -MP -MF ../src/$(DEPDIR)/libomega_a-RelBody.Tpo -c -o ../src/libomega_a-RelBody.o `test -f '../src/RelBody.cc' || echo '$(srcdir)/'`../src/RelBody.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-RelBody.Tpo ../src/$(DEPDIR)/libomega_a-RelBody.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/RelBody.cc' object='../src/libomega_a-RelBody.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-RelBody.o `test -f '../src/RelBody.cc' || echo '$(srcdir)/'`../src/RelBody.cc - -../src/libomega_a-RelBody.obj: ../src/RelBody.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-RelBody.obj -MD -MP -MF ../src/$(DEPDIR)/libomega_a-RelBody.Tpo -c -o ../src/libomega_a-RelBody.obj `if test -f '../src/RelBody.cc'; then $(CYGPATH_W) '../src/RelBody.cc'; else $(CYGPATH_W) '$(srcdir)/../src/RelBody.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-RelBody.Tpo ../src/$(DEPDIR)/libomega_a-RelBody.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/RelBody.cc' object='../src/libomega_a-RelBody.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-RelBody.obj `if test -f '../src/RelBody.cc'; then $(CYGPATH_W) '../src/RelBody.cc'; else $(CYGPATH_W) '$(srcdir)/../src/RelBody.cc'; fi` - -../src/libomega_a-RelVar.o: ../src/RelVar.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-RelVar.o -MD -MP -MF ../src/$(DEPDIR)/libomega_a-RelVar.Tpo -c -o ../src/libomega_a-RelVar.o `test -f '../src/RelVar.cc' || echo '$(srcdir)/'`../src/RelVar.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-RelVar.Tpo ../src/$(DEPDIR)/libomega_a-RelVar.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/RelVar.cc' object='../src/libomega_a-RelVar.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-RelVar.o `test -f '../src/RelVar.cc' || echo '$(srcdir)/'`../src/RelVar.cc - -../src/libomega_a-RelVar.obj: ../src/RelVar.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-RelVar.obj -MD -MP -MF ../src/$(DEPDIR)/libomega_a-RelVar.Tpo -c -o ../src/libomega_a-RelVar.obj `if test -f '../src/RelVar.cc'; then $(CYGPATH_W) '../src/RelVar.cc'; else $(CYGPATH_W) '$(srcdir)/../src/RelVar.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-RelVar.Tpo ../src/$(DEPDIR)/libomega_a-RelVar.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/RelVar.cc' object='../src/libomega_a-RelVar.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-RelVar.obj `if test -f '../src/RelVar.cc'; then $(CYGPATH_W) '../src/RelVar.cc'; else $(CYGPATH_W) '$(srcdir)/../src/RelVar.cc'; fi` - -../src/libomega_a-closure.o: ../src/closure.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-closure.o -MD -MP -MF ../src/$(DEPDIR)/libomega_a-closure.Tpo -c -o ../src/libomega_a-closure.o `test -f '../src/closure.cc' || echo '$(srcdir)/'`../src/closure.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-closure.Tpo ../src/$(DEPDIR)/libomega_a-closure.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/closure.cc' object='../src/libomega_a-closure.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-closure.o `test -f '../src/closure.cc' || echo '$(srcdir)/'`../src/closure.cc - -../src/libomega_a-closure.obj: ../src/closure.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-closure.obj -MD -MP -MF ../src/$(DEPDIR)/libomega_a-closure.Tpo -c -o ../src/libomega_a-closure.obj `if test -f '../src/closure.cc'; then $(CYGPATH_W) '../src/closure.cc'; else $(CYGPATH_W) '$(srcdir)/../src/closure.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-closure.Tpo ../src/$(DEPDIR)/libomega_a-closure.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/closure.cc' object='../src/libomega_a-closure.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-closure.obj `if test -f '../src/closure.cc'; then $(CYGPATH_W) '../src/closure.cc'; else $(CYGPATH_W) '$(srcdir)/../src/closure.cc'; fi` - -../src/libomega_a-reach.o: ../src/reach.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-reach.o -MD -MP -MF ../src/$(DEPDIR)/libomega_a-reach.Tpo -c -o ../src/libomega_a-reach.o `test -f '../src/reach.cc' || echo '$(srcdir)/'`../src/reach.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-reach.Tpo ../src/$(DEPDIR)/libomega_a-reach.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/reach.cc' object='../src/libomega_a-reach.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-reach.o `test -f '../src/reach.cc' || echo '$(srcdir)/'`../src/reach.cc - -../src/libomega_a-reach.obj: ../src/reach.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ../src/libomega_a-reach.obj -MD -MP -MF ../src/$(DEPDIR)/libomega_a-reach.Tpo -c -o ../src/libomega_a-reach.obj `if test -f '../src/reach.cc'; then $(CYGPATH_W) '../src/reach.cc'; else $(CYGPATH_W) '$(srcdir)/../src/reach.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ../src/$(DEPDIR)/libomega_a-reach.Tpo ../src/$(DEPDIR)/libomega_a-reach.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/reach.cc' object='../src/libomega_a-reach.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libomega_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ../src/libomega_a-reach.obj `if test -f '../src/reach.cc'; then $(CYGPATH_W) '../src/reach.cc'; else $(CYGPATH_W) '$(srcdir)/../src/reach.cc'; fi` - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LIBRARIES) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -rm -f ../../basic/src/$(DEPDIR)/$(am__dirstamp) - -rm -f ../../basic/src/$(am__dirstamp) - -rm -f ../src/$(DEPDIR)/$(am__dirstamp) - -rm -f ../src/$(am__dirstamp) - -rm -f ../src/omega_core/$(DEPDIR)/$(am__dirstamp) - -rm -f ../src/omega_core/$(am__dirstamp) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ../../basic/src/$(DEPDIR) ../src/$(DEPDIR) ../src/omega_core/$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ../../basic/src/$(DEPDIR) ../src/$(DEPDIR) ../src/omega_core/$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-noinstLIBRARIES cscopelist-am ctags ctags-am distclean \ - distclean-compile distclean-generic distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ - uninstall-am - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/omega/omega_lib/src/RelBody.cc b/omega/omega_lib/src/RelBody.cc deleted file mode 100644 index 825b153..0000000 --- a/omega/omega_lib/src/RelBody.cc +++ /dev/null @@ -1,906 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 the Omega Project Team - Copyright (C) 2005-2011 Chun Chen - All Rights Reserved. - - Purpose: - class Rel_Body, internal Relation representation - - Notes: - - History: - 11/26/09 Remove unecessary mandatary checking for set or relation, - treat them uniformly for easy coding, by Chun Chen -*****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include - -namespace omega { - -Rel_Body null_rel; -bool Rel_Body::is_null() const { - return(this == &null_rel); -} - - -int Rel_Body::max_ufs_arity() { - int ma = 0, a; - for (Variable_ID_Iterator v(*global_decls()); v; v++) { - a = (*v)->get_global_var()->arity(); - if (a > ma) - ma = a; - } - return ma; -} - -int Rel_Body::max_ufs_arity_of_set() { - int ma = 0, a; - for (Variable_ID_Iterator v(*global_decls()); v; v++) - if ((*v)->function_of() == Set_Tuple) { - a = (*v)->get_global_var()->arity(); - if (a > ma) - ma = a; - } - return ma; -} - -int Rel_Body::max_ufs_arity_of_in() { - int ma = 0, a; - for (Variable_ID_Iterator v(*global_decls()); v; v++) - if ((*v)->function_of() == Input_Tuple) { - a = (*v)->get_global_var()->arity(); - if (a > ma) - ma = a; - } - return ma; -} - -int Rel_Body::max_ufs_arity_of_out() { - int ma = 0, a; - for (Variable_ID_Iterator v(*global_decls()); v; v++) - if ((*v)->function_of() == Output_Tuple) { - a = (*v)->get_global_var()->arity(); - if (a > ma) - ma = a; - } - return ma; -} - -int Rel_Body::max_shared_ufs_arity() { - int ma = 0, a; - for (Variable_ID_Iterator v(*global_decls()); v; v++) - for (Variable_ID_Iterator v2(*global_decls()); v2; v2++) - if (*v != *v2 - && (*v)->get_global_var() == (*v2)->get_global_var() - && (*v)->function_of() != (*v2)->function_of()) { - a = (*v)->get_global_var()->arity(); - if (a > ma) - ma = a; - } - return ma; -} - -// -// Input and output variables. -// -void Rel_Body::name_input_var(int nth, Const_String S) { - // assert(1 <= nth && nth <= number_input && (!is_set() || skip_set_checks > 0)); - if (is_null()) - throw std::invalid_argument("empty relation"); - if (nth < 1 || nth > number_input) - throw std::invalid_argument("invalid input var number"); - In_Names[nth] = S; -} - -void Rel_Body::name_output_var(int nth, Const_String S) { - // assert(1<= nth && nth <= number_output && (!is_set() || skip_set_checks > 0)); - if (is_null()) - throw std::invalid_argument("empty relation"); - if (nth < 1 || nth > number_output) - throw std::invalid_argument("invalid output var number"); - Out_Names[nth] = S; -} - -void Rel_Body::name_set_var(int nth, Const_String S) { - if (number_output != 0) - throw std::runtime_error("relation is not a set"); - name_input_var(nth, S); -} - -int Rel_Body::n_inp() const { - // assert(!is_null() && (!is_set()||skip_set_checks>0)); - if (is_null()) - return 0; - else - return number_input; -} - -int Rel_Body::n_out() const { - // assert(!is_null() && (!is_set()||skip_set_checks>0)); - if (is_null()) - return 0; - else - return number_output; -} - -int Rel_Body::n_set() const { - if (number_output != 0) - throw std::runtime_error("relation is not a set"); - return n_inp(); -} - -Variable_ID Rel_Body::input_var(int nth) { - // assert(!is_null()); - // assert(!is_set() || skip_set_checks>0); - // assert(1 <= nth && nth <= number_input); - if (is_null()) - throw std::invalid_argument("empty relation"); - if (nth < 1 || nth > number_input) - throw std::invalid_argument("invalid input var number"); - input_vars[nth]->base_name = In_Names[nth]; - return input_vars[nth]; -} - -Variable_ID Rel_Body::output_var(int nth) { - // assert(!is_null()); - // assert(!is_set() || skip_set_checks>0); - // assert(1<= nth && nth <= number_output); - if (is_null()) - throw std::invalid_argument("empty relation"); - if (nth < 1 || nth > number_output) - throw std::invalid_argument("invalid output var number"); - output_vars[nth]->base_name = Out_Names[nth]; - return output_vars[nth]; -} - -Variable_ID Rel_Body::set_var(int nth) { - if (number_output != 0) - throw std::runtime_error("relation is not a set"); - return input_var(nth); -} - -// -// Add the AND node to the relation. -// Useful for adding restraints. -// -F_And *Rel_Body::and_with_and() { - assert(!is_null()); - if (is_simplified()) - DNF_to_formula(); - relation()->finalized = false; - Formula *f = rm_formula(); - F_And *a = add_and(); - a->add_child(f); - return a; -} - -// -// Add constraint to relation at the upper level. -// -EQ_Handle Rel_Body::and_with_EQ() { - assert(!is_null()); - if (is_simplified()) - DNF_to_formula(); - assert(! is_shared()); // The relation has been split. - relation()->finalized = false; - return find_available_conjunct()->add_EQ(); -} - -EQ_Handle Rel_Body::and_with_EQ(const Constraint_Handle &initial) { - assert(!is_null()); - assert(initial.relation()->is_simplified()); - EQ_Handle H = and_with_EQ(); - copy_constraint(H, initial); - return H; -} - -GEQ_Handle Rel_Body::and_with_GEQ() { - assert(!is_null()); - if (is_simplified()) - DNF_to_formula(); - assert(! is_shared()); // The relation has been split. - relation()->finalized = false; // We are giving out a handle. - // We should evantually implement finalization - // of subtrees, so the existing formula cannot - // be modified. - return find_available_conjunct()->add_GEQ(); -} - -GEQ_Handle Rel_Body::and_with_GEQ(const Constraint_Handle &initial) { - assert(!is_null()); - assert(initial.relation()->is_simplified()); - GEQ_Handle H = and_with_GEQ(); - copy_constraint(H, initial); - return H; -} - - - -Conjunct *Rel_Body::find_available_conjunct() { - Conjunct *c; - assert(!is_null()); - - if (children().empty()) { - c = add_conjunct(); - } - else { - assert(children().length() == 1); - Formula *kid = children().front(); // RelBodies have only one child - c = kid->find_available_conjunct(); - if (c==NULL) { - remove_child(kid); - F_And *a = add_and(); - a->add_child(kid); - c = a->add_conjunct(); - } - } - return c; -} - -void Rel_Body::finalize() { - assert(!is_null()); - if (!is_finalized()) - assert(! is_shared()); // no other pointers into here - finalized = true; - if (! children().empty()) - children().front()->finalize(); // Can have at most one child -} - -// Null Rel_Body -// This is the only rel_body constructor that has ref_count initialized to 1; -// That's because it's used to construct the global Rel_Body "null_rel". -// Unfortunately because we don't know in what order global constructors will -// be called, we could create a global relation with the default relation -// constructor (which would set the null_rel ref count to 1), and *then* -// call Rel_Body::Rel_Body(), which would set it back to 0, leaving a relation -// that points to a rel_body with it's ref_count set to 0! So this is done as -// a special case, in which the ref_count is always 1. -Rel_Body::Rel_Body(): - Formula(0, this), - ref_count(1), - status(under_construction), - number_input(0), number_output(0), - In_Names(0), Out_Names(0), - simplified_DNF(NULL), - r_conjs(0), - finalized(true), - _is_set(false) { -} - - -Rel_Body::Rel_Body(int n_input, int n_output): - Formula(0, this), - ref_count(0), - status(under_construction), - number_input(n_input), number_output(n_output), - In_Names(n_input), Out_Names(n_output), - simplified_DNF(NULL), - r_conjs(0), - finalized(false) { - if (n_output == 0) - _is_set = true; - else - _is_set = false; - if(pres_debug) { - fprintf(DebugFile, "+++ Create Rel_Body::Rel_Body(%d, %d) = 0x%p +++\n", - n_input, n_output, this); - } - int i; - for(i=1; i<=number_input; i++) { - In_Names[i] = Const_String(); - } - for(i=1; i<=number_output; i++) { - Out_Names[i] = Const_String(); - } -} - -// Rel_Body::Rel_Body(Rel_Body *r): -// Formula(0, this), -// ref_count(0), -// status(r->status), -// number_input(r->number_input), number_output(r->number_output), -// In_Names(r->number_input), Out_Names(r->number_output), -// simplified_DNF(NULL), -// r_conjs(r->r_conjs), -// finalized(r->finalized), -// _is_set(r->_is_set) { -// if(pres_debug) { -// fprintf(DebugFile, "+++ Copy Rel_Body::Rel_Body(Rel_Body * 0x%p) = 0x%p +++\n", r, this); -// prefix_print(DebugFile); -// } - -// int i; -// for(i=1;i<=r->number_input;i++) In_Names[i] = r->In_Names[i]; -// for(i=1;i<=r->number_output;i++) Out_Names[i] = r->Out_Names[i]; -// copy_var_decls(Symbolic,r->Symbolic); - -// if(!r->children().empty() && r->simplified_DNF==NULL) { -// Formula *f = r->formula()->copy(this,this); -// f->remap(); -// children().append(f); -// } -// else if(r->children().empty() && r->simplified_DNF!=NULL) { -// simplified_DNF = r->simplified_DNF->copy(this); -// simplified_DNF->remap(); -// } -// else { // copy NULL relation -// } - -// reset_remap_field(r->Symbolic); -// } - -Rel_Body *Rel_Body::clone() { - Rel_Body *b = new Rel_Body(); - - b->ref_count = 0; - b->status = status; - b->number_input = number_input; - b->number_output = number_output; - b->r_conjs = r_conjs; - b->finalized = finalized; - b->_is_set = _is_set; - - b->In_Names = Tuple(number_input); - b->Out_Names = Tuple(number_output); - for(int i = 1; i <= number_input; i++) - b->In_Names[i] = In_Names[i]; - for(int i = 1; i <= number_output; i++) - b->Out_Names[i] = Out_Names[i]; - - copy_var_decls(b->Symbolic, Symbolic); - - if(!children().empty() && simplified_DNF==NULL) { - Formula *f = formula()->copy(b, b); - f->remap(); - b->children().append(f); - } - else if(children().empty() && simplified_DNF!=NULL) { - b->simplified_DNF = simplified_DNF->copy(b); - b->simplified_DNF->remap(); - } - else { // copy NULL relation - } - - reset_remap_field(Symbolic); - return b; -} - - -Rel_Body::Rel_Body(Rel_Body *r, Conjunct *c): - Formula(0, this), - ref_count(0), - status(uncompressed), - number_input(r->number_input), number_output(r->number_output), - In_Names(r->number_input), Out_Names(r->number_output), - r_conjs(0), - finalized(r->finalized), - _is_set(r->_is_set) { - if(pres_debug) { - fprintf(DebugFile, "+++ Copy Rel_Body::Rel_Body(Rel_Body * 0x%p, Conjunct * 0x%p) = 0x%p +++\n",r,c,this); - } - - int i; - for(i=1;i<=r->number_input;i++) In_Names[i] = r->In_Names[i]; - for(i=1;i<=r->number_output;i++) Out_Names[i] = r->Out_Names[i]; - copy_var_decls(Symbolic,r->Symbolic); - - // assert that r has as many variables as c requires, or that c is from r - assert(r == c->relation()); - assert(r->simplified_DNF != NULL); - simplified_DNF = new DNF; - simplified_DNF->add_conjunct(c->copy_conj_diff_relation(this,this)); - single_conjunct()->remap(); - - reset_remap_field(r->Symbolic); -} - -Rel_Body::~Rel_Body() { - if(pres_debug) { - fprintf(DebugFile, "+++ Destroy Rel_Body::~Rel_Body() 0x%p +++\n", this); - } - free_var_decls(Symbolic); - if(simplified_DNF != NULL) { - delete simplified_DNF; - } -} - -// -// Take a relation that has been simplified and convert it -// back to formula form. -// -void Rel_Body::DNF_to_formula() { - assert(!is_null()); - if (simplified_DNF != NULL) { - simplified_DNF->DNF_to_formula(this); - simplified_DNF = NULL; - status = under_construction; - } -} - -bool Rel_Body::can_add_child() { - assert(this != &null_rel); - return n_children() < 1; -} - - - -// ******************** -// Simplify functions -// ******************** - - -extern int s_rdt_constrs; - - -// -// Simplify a given relation. -// Store the resulting DNF in the relation, clean out the formula. -// -void Rel_Body::simplify(int rdt_conjs, int rdt_constrs) { - if(simplified_DNF == NULL) { - finalized = true; - if(children().empty()) { - simplified_DNF = new DNF; - } - else { - if(pres_debug) { - if(DebugFile==NULL) { - DebugFile = fopen("test.out", "w"); - if(DebugFile==NULL) - fprintf(stderr, "Can not open file test.out\n"); - } - } - - assert(children().length()==1); - if(pres_debug) { - fprintf(DebugFile, "=== %p Rel_Body::simplify(%d, %d) Input tree (%d) ===\n", this,rdt_conjs,rdt_constrs,r_conjs); - prefix_print(DebugFile); - } - verify_tree(); - - beautify(); - verify_tree(); - - rearrange(); - verify_tree(); - - beautify(); - verify_tree(); - - s_rdt_constrs = rdt_constrs; - if(pres_debug) { - fprintf(DebugFile, "\n=== In simplify, before DNFize ===\n"); - prefix_print(DebugFile); - } - DNFize(); - if(pres_debug) { - fprintf(DebugFile, "\n=== In simplify, after DNFize ===\n"); - prefix_print(DebugFile); - } - verify_tree(); - - - simplified_DNF->rm_redundant_inexact_conjs(); - verify_tree(); - - if (rdt_conjs > 0 && !simplified_DNF->is_definitely_false() && simplified_DNF->length() > 1) { - simplified_DNF->rm_redundant_conjs(rdt_conjs-1); - verify_tree(); - } - - if(pres_debug) { - fprintf(DebugFile, "\n=== Resulting Relation ===\n"); - prefix_print(DebugFile); - } - } - } - else { - /* Reprocess DNF to get rid of redundant stuff */ - - if (rdt_constrs < 0) return; - simplified_DNF->rm_redundant_inexact_conjs(); - - if (rdt_conjs > r_conjs) { - if(pres_debug) - fprintf(DebugFile,"=== Rel_Body::simplify() redundant CONJUNCTS ===\n"); - simplified_DNF->rm_redundant_conjs(rdt_conjs-1); - } - if (rdt_constrs > 0 ) { - if(pres_debug) - fprintf(DebugFile,"=== Rel_Body::simplify() redundant CONSTR-S ===\n"); - s_rdt_constrs = rdt_constrs; - simplified_DNF->simplify(); - } - } - - r_conjs = rdt_conjs; - - for(DNF_Iterator D(simplified_DNF); D.live(); D.next()) { - D.curr()->set_relation(this); - D.curr()->set_parent(this); - } -} - - -// ****************** -// Query functions -// ****************** - - -// -// Check if relation has a single conjunct formula and return this conjunct. -// -Conjunct *Rel_Body::single_conjunct() { - simplify(); - return simplified_DNF->single_conjunct(); -} - -bool Rel_Body::has_single_conjunct() { - simplify(); - return simplified_DNF->has_single_conjunct(); -} - -// -// Remove and return first conjunct -// -Conjunct *Rel_Body::rm_first_conjunct() { - simplify(); - return simplified_DNF->rm_first_conjunct(); -} - - -void Rel_Body::query_difference(Variable_ID v1, Variable_ID v2, coef_t &lowerBound, coef_t &upperBound, bool &guaranteed) { - simplify(); - - coef_t _lb, _ub; - int first = 1; - bool _g; - lowerBound = negInfinity; // default values if no DNF's - upperBound = posInfinity; - guaranteed = 0; - - for (DNF_Iterator D(simplified_DNF); D.live(); D.next()) { - (*D)->query_difference(v1, v2, _lb, _ub, _g); - if (first) { - lowerBound = _lb; - upperBound = _ub; - guaranteed = _g; - first = 0; - } - else { - guaranteed = guaranteed && _g; - lowerBound = min(lowerBound, _lb); - upperBound = max(upperBound, _ub); - } - } -} - - -void Rel_Body::query_variable_bounds(Variable_ID v, coef_t &lowerBound, coef_t &upperBound) { - simplify(); - - coef_t _lb, _ub; - int first = 1; - lowerBound = negInfinity; // default values if no DNF's - upperBound = posInfinity; - - for (DNF_Iterator D(simplified_DNF); D.live(); D.next()) { - (*D)->query_variable_bounds(v, _lb, _ub); - if (first) { - lowerBound = _lb; - upperBound = _ub; - first = 0; - } - else { - lowerBound = min(lowerBound, _lb); - upperBound = max(upperBound, _ub); - } - } -} - -coef_t Rel_Body::query_variable_mod(Variable_ID v, coef_t factor) { - simplify(); - - bool first = true; - coef_t result; - - for (DNF_Iterator D(simplified_DNF); D.live(); D.next()) { - coef_t t = (*D)->query_variable_mod(v, factor); - if (t == posInfinity) - return posInfinity; - - if (first) { - result = t; - first = false; - } - else { - if (result != t) - return posInfinity; - } - } - - return result; -} - - - -// -// Simplify formula if needed and return the resulting DNF. -// -DNF* Rel_Body::query_DNF() { - return(query_DNF(false,false)); -} - -DNF* Rel_Body::query_DNF(int rdt_conjs, int rdt_constrs) { - simplify(rdt_conjs, rdt_constrs); - return(simplified_DNF); -} - -// -// Other formula queries. -// - -// Interpret UNKNOWN as true, then check satisfiability -// i.e., check if the formula simplifies to FALSE, since the library -// will never say that if the *known* constraints are unsatisfiable by -// themselves. -bool Rel_Body::is_upper_bound_satisfiable() { - int tmp = s_rdt_constrs; - s_rdt_constrs = -1; - simplify(); - s_rdt_constrs = tmp; - return(!simplified_DNF->is_definitely_false()); -} - -// Interpret UNKNOWN as false, then check satisfiability -// i.e., check if there exist any exact conjuncts in the solution -bool Rel_Body::is_lower_bound_satisfiable() { - int tmp = s_rdt_constrs; - s_rdt_constrs = -1; - simplify(); - s_rdt_constrs = tmp; - for(DNF_Iterator d(simplified_DNF); d; d++) - if((*d)->is_exact()) return true; - return false; -} - -bool Rel_Body::is_satisfiable() { - assert(is_lower_bound_satisfiable() == is_upper_bound_satisfiable()); - return is_upper_bound_satisfiable(); -} - -// Check if we can easily determine if the formula evaluates to true. -bool Rel_Body::is_obvious_tautology() { - int tmp = s_rdt_constrs; - s_rdt_constrs = 0; - simplify(); - s_rdt_constrs = tmp; - return(simplified_DNF->is_definitely_true()); -} - -// Expensive check to determine if the formula evaluates to true. -bool Rel_Body::is_definite_tautology() { - if(is_obvious_tautology()) return true; - Relation l = Lower_Bound(Relation(*this,1)); - return !(Complement(l).is_upper_bound_satisfiable()); -} - -bool Rel_Body::is_unknown() { - simplify(); - return(has_single_conjunct() && single_conjunct()->is_unknown()); -} - -// -// Get accuracy status of the relation -// - -Rel_Unknown_Uses Rel_Body::unknown_uses() { - if (!is_simplified()) - simplify(); - - Rel_Unknown_Uses local_status=0; - int n_conj=0; - - for (DNF_Iterator c(simplified_DNF); c; c++) { - n_conj++; - if ((*c)->is_exact()) - local_status |= no_u; - else if ((*c)->is_unknown()) - local_status |= or_u; - else - local_status |= and_u; - } - - if (n_conj == 0) { - assert(local_status == 0); - local_status = no_u; - } - assert(local_status); -#if ! defined NDEBUG - Rel_Unknown_Uses impossible = (and_u | or_u); - assert( (local_status & impossible) != impossible); -#endif - - return local_status; -} - -void Rel_Body::interpret_unknown_as_false() { - simplify(); - simplified_DNF->remove_inexact_conj(); -} - -void Rel_Body::interpret_unknown_as_true() { - simplify(); - for(DNF_Iterator d(simplified_DNF); d; d++) - (*d)->interpret_unknown_as_true(); -} - - -void Rel_Body::reverse_leading_dir_info() { - if (is_simplified()) { - for (DNF_Iterator c(simplified_DNF); c; c++) - (*c)->reverse_leading_dir_info(); - } - else { - assert(!simplified_DNF); - assert(children().size() == 1); - children().front()->reverse_leading_dir_info(); - } -} - -// -// Rel_Body::DNFize just DNF-izes its child node and calls verify -// - -DNF* Rel_Body::DNFize() { -#if defined(INCLUDE_COMPRESSION) - assert(!this->is_compressed()); -#endif - if (! simplified_DNF) { - simplified_DNF = children().remove_front()->DNFize(); - - int mua = max_shared_ufs_arity(); - if (mua > 0) { - if (pres_debug) { - fprintf(DebugFile, "\n=== In DNFize, before LCDNF ===\n"); - prefix_print(DebugFile); - } - - simplified_DNF->make_level_carried_to(mua); - } - - if(pres_debug) { - fprintf(DebugFile, "\n=== In DNFize, before verify ===\n"); - prefix_print(DebugFile); - } - - simplified_DNF->simplify(); - } - - assert(children().length() == 0); - - return simplified_DNF; -} - -void Rel_Body::make_level_carried_to(int level) { - if (!simplified_DNF) { - DNFize(); - } - - assert(simplified_DNF && children().empty()); - - simplified_DNF->make_level_carried_to(level); -} - -// -// if direction==0, move all conjuncts with >= level leading 0's to return -// else move all conjuncts with level-1 0's followed by -// the appropriate signed difference to returned Relation -// - -Relation Rel_Body::extract_dnf_by_carried_level(int level, int direction) { - if (!simplified_DNF) { - DNFize(); - } - - assert(simplified_DNF && children().empty()); - - simplified_DNF->make_level_carried_to(level); - - Relation extracted(n_inp(), n_out()); - extracted.copy_names(*this); - assert(extracted.rel_body->children().empty()); - assert(extracted.rel_body->simplified_DNF == NULL); - extracted.rel_body->simplified_DNF = new DNF; - extracted.rel_body->Symbolic = Symbolic; - - DNF *remaining = new DNF; - Conjunct *curr; - - for (curr = simplified_DNF->rm_first_conjunct(); - curr; - curr = simplified_DNF->rm_first_conjunct()) { - assert(curr->guaranteed_leading_0s >= level || curr->guaranteed_leading_0s == curr->possible_leading_0s); - assert(curr->possible_leading_0s >= 0); - - curr->assert_leading_info(); - - if ((direction == 0 && curr->guaranteed_leading_0s >= level) || - (curr->guaranteed_leading_0s == level-1 && - curr->leading_dir_valid_and_known() && - curr->leading_dir * direction > 0)) { - extracted.rel_body->simplified_DNF->add_conjunct(curr); - } - else { - remaining->add_conjunct(curr); - } - } - delete simplified_DNF; - simplified_DNF = remaining; - -#if ! defined NDEBUG - for (DNF_Iterator rc(simplified_DNF); rc; rc++) - (*rc)->assert_leading_info(); - - for (DNF_Iterator ec(extracted.rel_body->simplified_DNF); ec; ec++) - (*ec)->assert_leading_info(); -#endif - - finalize(); - extracted.finalize(); - return extracted; -} - -//Compress/uncompress functions - -bool Rel_Body::is_compressed() { -#if defined(INCLUDE_COMPRESSION) - if(is_simplified()) { - for(DNF_Iterator p(simplified_DNF); p.live(); p.next()) { - if(p.curr()->is_compressed()) - return true; - } - } - return false; -#else - return true; // This allows is_compressed assertions to work -#endif -} - -void Rel_Body::compress() { -#if !defined(INCLUDE_COMPRESSION) - return; -#else - if (status == compressed) - return; - if (pres_debug) - fprintf(DebugFile,">>> Compressing relation %p\n",this); - simplify(); - for(DNF_Iterator p(simplified_DNF); p.live(); p.next()) { - p.curr()->compress(); - status = compressed; - } -#endif -} - -void Rel_Body::uncompress() { -#if !defined(INCLUDE_COMPRESSION) - return; -#else - if (pres_debug) - fprintf(DebugFile,"<<< Uncompressing relation %p\n",this); - assert(is_simplified()); - for(DNF_Iterator p(simplified_DNF); p.live(); p.next()) { - p.curr()->uncompress(); - status = uncompressed; - } -#endif -} - -} diff --git a/omega/omega_lib/src/RelVar.cc b/omega/omega_lib/src/RelVar.cc deleted file mode 100644 index d9b977c..0000000 --- a/omega/omega_lib/src/RelVar.cc +++ /dev/null @@ -1,71 +0,0 @@ -#include -#include - -namespace omega { - -Variable_ID Rel_Body::get_local(const Variable_ID v) { - Global_Var_ID g; - if (v->kind() == Global_Var) { - g = v->get_global_var(); - if (g->arity()) return get_local(g,v->function_of()); - return get_local(g); - } - if (is_set()) return set_var(v->get_position()); - if (v->kind() == Input_Var) return input_var(v->get_position()); - if (v->kind() == Output_Var) return output_var(v->get_position()); - assert(0 && "Can only get local for variable with global scope"); - exit(1); - return 0; -} - -// -// Find or declare global variable. -// If the VarID does not exist, it is created. Otherwise it's returned. -// Note that this version now works only for 0-ary functions. -// -Variable_ID Rel_Body::get_local(const Global_Var_ID G) { - assert(G->arity() == 0); - for(Variable_Iterator i(Symbolic); i; i++) - if ((*i)->get_global_var() == G) - return (*i); - - Variable_ID v = G->get_local(); - Symbolic.append(v); - return v; -} - - -Variable_ID Rel_Body::get_local(const Global_Var_ID G, Argument_Tuple of) { - assert(G->arity() == 0 || of == Input_Tuple || of == Output_Tuple); - - for(Variable_Iterator i = Symbolic; i; i++) - if ((*i)->get_global_var() == G && (G->arity() == 0 || - of == (*i)->function_of())) - return (*i); - - Variable_ID V = G->get_local(of); - Symbolic.append(V); - return V; -} - - -bool Rel_Body::has_local(const Global_Var_ID G) { - assert(G->arity() == 0); - for(Variable_Iterator i = Symbolic; i; i++) - if ((*i)->get_global_var() == G) - return true; - return false; -} - - -bool Rel_Body::has_local(const Global_Var_ID G, Argument_Tuple of) { - assert(G->arity() == 0 || of == Input_Tuple || of == Output_Tuple); - - for(Variable_Iterator i = Symbolic; i; i++) - if ((*i)->get_global_var() == G && (G->arity() == 0 || - of == (*i)->function_of())) - return true; - return false; -} - -} // namespace diff --git a/omega/omega_lib/src/Relation.cc b/omega/omega_lib/src/Relation.cc deleted file mode 100644 index 1cca43a..0000000 --- a/omega/omega_lib/src/Relation.cc +++ /dev/null @@ -1,279 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 the Omega Project Team - Copyright (C) 2005-2011 Chun Chen - All Rights Reserved. - - Purpose: - class Relation - - Notes: - - History: -*****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include - -namespace omega { - -// copy function for Relation, will be removed in the future -// in favor of correct C++ copy constructor and const paramater passing -Relation copy(const Relation &t) { - Relation r = t; - return r; -} - -// -// Create null relation. -// -Relation::Relation() : rel_body(&null_rel) { - rel_body->ref_count = 1; -} - -Relation Relation::Null() { - return Relation(); -} - -bool Relation::is_null() const { - return(rel_body == &null_rel); -} - - -// -// Create a relation. Its will be built later. -// -Relation::Relation(int n_input, int n_output) { - rel_body = new Rel_Body(n_input,n_output); - rel_body->ref_count = 1; -} - -Relation::Relation(Rel_Body &r, int) { - rel_body = &r; - r.ref_count++; -} - -Relation Relation::Empty(const Relation &R) { - if (R.is_set()) return Relation(R.n_set()); - else return Relation(R.n_inp(),R.n_out()); -} - -// -// Create relation which is FALSE or TRUE. -// - -Relation Relation::True(const Relation &R) { - if (R.is_set()) return True(R.n_set()); - else return True(R.n_inp(),R.n_out()); -} - -Relation Relation::False(const Relation &R) { - if (R.is_set()) return False(R.n_set()); - else return False(R.n_inp(),R.n_out()); -} - -Relation Relation::Unknown(const Relation &R) { - if (R.is_set()) return Unknown(R.n_set()); - else return Unknown(R.n_inp(), R.n_out()); -} - - -Relation Relation::True(int setvars) { - Relation R(setvars); - R.add_and(); - R.finalize(); - return R; -} - -Relation Relation::True (int in, int out) { - Relation R(in,out); - R.add_and(); - R.finalize(); - return R; -} - -Relation Relation::False (int setvars) { - Relation R(setvars); - R.add_or(); - R.finalize(); - return R; -} - -Relation Relation::False (int in, int out) { - Relation R(in,out); - R.add_or(); - R.finalize(); - return R; -} - - -Relation Relation::Unknown (int setvars) { - Relation R(setvars); - R.add_and(); - R.finalize(); - R.simplify(); - Conjunct * c= R.single_conjunct(); - c->make_inexact(); - return R; -} - -Relation Relation::Unknown (int in, int out) { - Relation R(in,out); - R.add_and(); - R.finalize(); - R.simplify(); - Conjunct * c= R.single_conjunct(); - c->make_inexact(); - return R; -} - - -// -// Copy a relation. -// -Relation::Relation(const Relation &r) { -#if defined(INCLUDE_COMPRESSION) - assert(!r.is_compressed()); -#endif - if (r.is_finalized()) { - rel_body = r.rel_body; - rel_body->ref_count++; - } else { - assert(! r.rel_body->is_shared()); - // rel_body = new Rel_Body(r.rel_body); - rel_body = r.rel_body->clone(); - rel_body->ref_count = 1; - } -} - -// -// Copy relation r and replace formula in it with conjunct c. -// Wayne (TM) function. -// -Relation::Relation(const Relation &r, Conjunct *c) { - rel_body = new Rel_Body(r.rel_body, c); - rel_body->ref_count = 1; -} - - -// -// Assign a relation r to this relation. -// -Relation &Relation::operator=(const Relation &r) { -#if defined(INCLUDE_COMPRESSION) - assert (!r.is_compressed()); -#endif - - /* === Destroy this === */ - assert(rel_body->ref_count >= 1); - if(rel_body!=&null_rel && --(rel_body->ref_count)==0) { - delete rel_body; - } - - /* === Copy r to this === */ - if (r.is_finalized()) { - rel_body = r.rel_body; - rel_body->ref_count++; - } else { - assert(! r.rel_body->is_shared()); - // rel_body = new Rel_Body(r.rel_body); - rel_body = r.rel_body->clone(); - rel_body->ref_count = 1; - } - return *this; -} - -void Relation::copy_names(Rel_Body &r) { - int t; - for(t = 1; t <= r.n_inp(); t++) - name_input_var(t,r.input_var(t)->base_name); - for(t = 1; t <= r.n_out(); t++) - name_output_var(t,r.output_var(t)->base_name); -} - - -// Like makeSet (see Relations.c), but won't invert the relation -- -// fails if it has output instead of input variables. Called in Relation -// functions just after a MapRel, so that we know there are no outputs anyway. - -void Relation::markAsSet() { - assert(!is_null()); - assert(is_set() || (n_inp() >= 0 && n_out() == 0)); - if (!is_set()) split(); // split if we'll modify this - rel_body->_is_set = true; - invalidate_leading_info(); -} - -void Relation::markAsRelation() { - assert(!is_null()); - if (is_set()) split(); // split if we'll modify this - rel_body->_is_set = false; -} - - -Relation::~Relation() { - assert(rel_body->ref_count >= 1); - assert(this->is_null() == (rel_body == &null_rel)); - if(rel_body!=&null_rel && --(rel_body->ref_count)==0) { - if (rel_body == &null_rel) abort(); - delete rel_body; - } -} - - - -// -// One of the representatives using the body wants to be changed. -// Create a separate body for this rep not to damage other reps. -// Return address of the body. Old rep point to new body. -// -Rel_Body *Relation::split() { - assert(rel_body != &null_rel && "Error: Attempt to modify a null relation"); - assert (rel_body->ref_count >= 1); - if(!(rel_body==&null_rel || rel_body->ref_count==1)) { - if(pres_debug) { - fprintf(DebugFile, "+++ SPLIT relation +++\n"); - } - // Rel_Body *new_body = new Rel_Body(rel_body); - Rel_Body *new_body = rel_body->clone(); - new_body->ref_count = 1; - rel_body->ref_count--; - rel_body = new_body; - if(pres_debug>=2) { - fprintf(DebugFile, " copying 0x%p to give 0x%p\n", this, rel_body); - } - } - return (rel_body); -} - - -void Relation::dimensions(int & ndim_all, int &ndim_domain) { - ndim_all = ndim_domain = 0; - int a,d; - simplify(2,2); - for (DNF_Iterator s(query_DNF()); s.live(); s.next()) { - s.curr()->calculate_dimensions(*this, a, d); - if (a > ndim_all) ndim_all = a; - if (d > ndim_domain) ndim_domain = d; - } -} - -// Make a set: assert that it had only input or output variables, make it -// it have only input, set a flag. Called from domain, range, and difference, -// as well as functions that require a set as input. -void Relation::makeSet() { - assert(!is_null()); - // Assert that it is a set... - assert((n_inp() == 0 && n_out() >= 0) || (n_inp() >= 0 && n_out() == 0)); - - if ((n_inp() == 0 && n_out() != 0) || !is_set()) split(); // split if we'll modify this - if (n_inp() == 0 && n_out() != 0) //Inverse the relation - Inverse(*this); // Modifies "this"; also returns this but we ignore it - rel_body->_is_set = true; -} - -} // namespace diff --git a/omega/omega_lib/src/Relations.cc b/omega/omega_lib/src/Relations.cc deleted file mode 100644 index d7dbe86..0000000 --- a/omega/omega_lib/src/Relations.cc +++ /dev/null @@ -1,2882 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 the Omega Project Team - Copyright (C) 2005-2011 Chun Chen - All Rights Reserved. - - Purpose: - Integer set and relation operations. - - Notes: - - History: - 04/22/09 merge_rels, Chun Chen -*****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if defined STUDY_EVACUATIONS -#include -#endif -#include - -namespace omega { - -#define CHECK_MAYBE_SUBSET 1 - -int relation_debug=0; - -namespace { - int leave_pufs_untouched = 0; - Variable_ID_Tuple exists_ids; - List exists_numbers; - F_And * and_below_exists; -} - -/* The following allows us to avoid warnings about passing - temporaries as non-const references. This is useful but - has suddenly become illegal. */ - -Relation consume_and_regurgitate(NOT_CONST Relation &R) { - if(!R.is_null()) - ((Relation &) R).finalize(); - Relation S = (Relation &) R; - (Relation &) R = Relation::Null(); - return S; -} - - -// -// r1 Union r2. -// align the input tuples (if any) for F and G -// align the output tuples (if any) for F and G -// match named variables in F and G -// formula is f | g -// -Relation Union(NOT_CONST Relation &input_r1, - NOT_CONST Relation &input_r2) { - Relation r1 = consume_and_regurgitate(input_r1); - Relation r2 = consume_and_regurgitate(input_r2); - if (r1.is_null()) - return r2; - else if (r2.is_null()) - return r1; - if (r1.n_inp() != r2.n_inp() || r1.n_out() != r2.n_out()) - throw std::invalid_argument("relation arity does not match"); - - // skip_set_checks++; - // assert(r1.n_inp() == r2.n_inp()); - // assert(r1.n_out() == r2.n_out()); - // assert(!r1.is_null() && !r2.is_null()); - int in = r1.n_inp(), out = r1.n_out(); - // skip_set_checks--; - - return MapAndCombineRel2(r1, r2, Mapping::Identity(in, out), - Mapping::Identity(in,out), Comb_Or); -} - - -// -// F intersection G -// align the input tuples (if any) for F and G -// align the output tuples (if any) for F and G -// match named variables in F and G -// formula is f & g -// -Relation Intersection(NOT_CONST Relation &input_r1, - NOT_CONST Relation &input_r2) { - Relation r1 = consume_and_regurgitate(input_r1); - Relation r2 = consume_and_regurgitate(input_r2); - if (r1.is_null()) - return r2; - else if (r2.is_null()) - return r1; - if (r1.n_inp() != r2.n_inp() || r1.n_out() != r2.n_out()) - throw std::invalid_argument("relation arity does not match"); - - // skip_set_checks++; - // assert(r1.n_inp() == r2.n_inp()); - // assert(r1.n_out() == r2.n_out()); - // assert(!r1.is_null() && !r2.is_null()); - int in = r1.n_inp(), out = r1.n_out(); - // skip_set_checks--; - - return MapAndCombineRel2(r1, r2, Mapping::Identity(in,out), - Mapping::Identity(in,out), Comb_And); -} - - -// -// F \ G (the relation F restricted to domain G) -// align the input tuples for F and G -// match named variables in F and G -// formula is f & g -// -Relation Restrict_Domain(NOT_CONST Relation &input_r1, - NOT_CONST Relation &input_r2) { - Relation r1 = consume_and_regurgitate(input_r1); - Relation r2 = consume_and_regurgitate(input_r2); - if (r1.is_null()) - return r1; - else if (r2.is_null()) - return r1; - if (r1.n_inp() != r2.n_set()) - throw std::invalid_argument("relation arity does not match"); - - // assert(!r1.is_null() && !r2.is_null()); - // skip_set_checks++; - // assert(r1.n_inp() == r2.n_set()); - // assert(r2.is_set()); - int in = r1.n_inp(), out = r1.n_out(); - // skip_set_checks--; - - int i; - Mapping m2(r2.n_set()); - for(i=1; i<=r2.n_set(); i++) m2.set_map_set(i, Input_Var,i); - - // skip_set_checks++; - assert(r2.query_guaranteed_leading_0s() == -1 && - r2.query_possible_leading_0s() == -1); - // skip_set_checks--; - - Relation result = MapAndCombineRel2(r1, r2, Mapping::Identity(in,out), - m2, Comb_And); - // FERD -- update leading 0's - the may close up? - //result.invalidate_leading_info(); // could do better - return result; -} - -// -// -// F / G (the relation F restricted to range G) -// align the output tuples for F and G -// match named variables in F and G -// formula is f & g -// -Relation Restrict_Range(NOT_CONST Relation &input_r1, - NOT_CONST Relation &input_r2) { - Relation r1 = consume_and_regurgitate(input_r1); - Relation r2 = consume_and_regurgitate(input_r2); - if (r1.is_null()) - return r1; - else if (r2.is_null()) - return r1; - if (r1.n_out() != r2.n_set()) - throw std::invalid_argument("relation arity does not match"); - - // skip_set_checks++; - // assert(r1.n_out() == r2.n_set()); - // assert(r2.is_set()); - // assert(!r1.is_null() && !r2.is_null()); - int in = r1.n_inp(), out = r1.n_out(); - // skip_set_checks--; - - int i; - Mapping m2(r2.n_set()); - for(i=1; i<=r2.n_set(); i++) m2.set_map_set(i, Output_Var,i); - - // skip_set_checks++; - assert(r2.query_guaranteed_leading_0s() == -1 && - r2.query_possible_leading_0s() == -1); - // skip_set_checks--; - - Relation result = MapAndCombineRel2(r1, r2, Mapping::Identity(in, out), - m2, Comb_And); - // FERD -- update leading 0's - the may close up? - // result.invalidate_leading_info(); // could do better - return result; -} - - -// -// Add input variable to relation. -// -Relation Extend_Domain(NOT_CONST Relation &S) { - Relation R = consume_and_regurgitate(S); - if (R.is_null()) - throw std::invalid_argument("cannot extend domain on null relation"); - - // assert(!R.is_null() && (skip_set_checks || !R.is_set())); - // assert(!R.is_null()); - Rel_Body *r = R.split(); - r->In_Names.append(Const_String()); - r->number_input++; - assert(!r->is_null()); - - if (r->number_input <= r->number_output) - R.invalidate_leading_info(r->number_input); - - return R; -} - -// -// Add more input variables to relation. -// -Relation Extend_Domain(NOT_CONST Relation &S, int more) { - Relation R = consume_and_regurgitate(S); - if (R.is_null()) - throw std::invalid_argument("cannot extend domain on null relation"); - - // assert(!R.is_null()); - R.split(); - for (int i=1; i<=more; i++) R = Extend_Domain(R); - return R; -} - - -// -// Add output variable to relation. -// -Relation Extend_Range(NOT_CONST Relation &S) { - Relation R = consume_and_regurgitate(S); - if (R.is_null()) - throw std::invalid_argument("cannot extend range on null relation"); - - // assert(!R.is_null() && !R.is_set()); - // assert(!R.is_null()); - Rel_Body *r = R.split(); - r->Out_Names.append(Const_String()); - r->number_output++; - assert(!r->is_null()); - - if (r->number_output <= r->number_input) - R.invalidate_leading_info(r->number_output); - - return R; -} - -// -// Add more output variables to relation. -// -Relation Extend_Range(NOT_CONST Relation &S, int more) { - Relation R = consume_and_regurgitate(S); - - // assert(!R.is_null()); - R.split(); - for (int i=1; i<=more; i++) R = Extend_Range(R); - return R; -} - - -// -// Add set variable to set. -// -Relation Extend_Set(NOT_CONST Relation &S) { - Relation R = consume_and_regurgitate(S); - if (R.is_null()) - throw std::invalid_argument("cannot extend set on null relation"); - if (R.n_out() > 0) - throw std::invalid_argument("relation must be a set"); - - // assert(!R.is_null() && R.is_set()); - Rel_Body *r = R.split(); - r->In_Names.append(Const_String()); - r->number_input++; - assert(!r->is_null()); - return R; -} - -// -// Add more variables to set -// -Relation Extend_Set(NOT_CONST Relation &S, int more) { - Relation R = consume_and_regurgitate(S); - R.split(); - for (int i=1; i<=more; i++) R = Extend_Set(R); - return R; -} - - - -// -// Domain and Range. -// Make output (input) variables wildcards and simplify. -// Move all UFS's to have have the remaining tuple as an argument, -// and maprel will move them to the set tuple -// RESET all leading 0's -// -Relation Domain(NOT_CONST Relation &S) { - Relation r = consume_and_regurgitate(S); - if (r.is_null()) - return r; - - // assert(!S.is_null()); - // assert(!r.is_set()); - // skip_set_checks++; - int i; - Mapping m1(r.n_inp(), r.n_out()); - for(i=1; i<=r.n_inp(); i++) m1.set_map_in (i, Set_Var,i); - for(i=1; i<=r.n_out(); i++) m1.set_map_out(i, Exists_Var,i); - // skip_set_checks--; - - int a = r.max_ufs_arity_of_out(); - if (a > 0) { - // UFS's must evacuate from the output tuple - Variable_ID_Tuple remapped; - - r.simplify(); - DNF *d = r.split()->DNFize(); - d->count_leading_0s(); - // Any conjucts with leading_0s == -1 must have >= "a" leading 0s - // What a gross way to do this. Ferd - - for (DNF_Iterator conj(d); conj; conj++) { -#if defined STUDY_EVACUATIONS - study_evacuation(*conj, out_to_in, a); -#endif - - int cL0 = (*conj)->guaranteed_leading_0s; - - for (Variable_ID_Iterator func((*conj)->mappedVars); func; func++) - if ((*func)->kind() == Global_Var) { - Global_Var_ID f = (*func)->get_global_var(); - if (f->arity() > 0 && (*func)->function_of()==Output_Tuple) { - if (cL0 >= f->arity()) { - (*func)->remap = r.get_local(f, Input_Tuple); - } - else { - (*func)->remap = (*conj)->declare(); - (*conj)->make_inexact(); - } - remapped.append(*func); - } - } - (*conj)->remap(); - reset_remap_field(remapped); - remapped.clear(); - - (*conj)->guaranteed_leading_0s = (*conj)->possible_leading_0s = -1; - (*conj)->leading_dir = 0; - } - } - - MapRel1(r, m1, Comb_Id); // this invalidates leading0s - assert(r.is_set() || m1.n_in() == 0); // MapRel can't tell to make a set - r.markAsSet(); // if there were no inputs. - - // skip_set_checks++; - assert(r.query_guaranteed_leading_0s() == -1 && r.query_possible_leading_0s() == -1); - // skip_set_checks--; - - return r; -} - - -Relation Range(NOT_CONST Relation &S) { - Relation r = consume_and_regurgitate(S); - if (r.is_null()) - return r; - - //assert(!r.is_null()); - // skip_set_checks++; - - int i; - Mapping m1(r.n_inp(), r.n_out()); - for(i=1; i<=r.n_inp(); i++) m1.set_map_in (i, Exists_Var,i); - for(i=1; i<=r.n_out(); i++) m1.set_map_out(i, Set_Var,i); - // skip_set_checks--; - - int a = r.max_ufs_arity_of_in(); - if (a > 0) { - // UFS's must evacuate from the input tuple - Variable_ID_Tuple remapped; - - r.simplify(); - DNF *d = r.split()->DNFize(); - d->count_leading_0s(); - // Any conjucts with leading_0s == -1 must have >= "a" leading 0s - // What a gross way to do this. Ferd - - for (DNF_Iterator conj(d); conj; conj++) { -#if defined STUDY_EVACUATIONS - study_evacuation(*conj, in_to_out, a); -#endif - - int cL0 = (*conj)->guaranteed_leading_0s; - for (Variable_ID_Iterator func((*conj)->mappedVars); func; func++) - if ((*func)->kind() == Global_Var) { - Global_Var_ID f = (*func)->get_global_var(); - if (f->arity() > 0 && (*func)->function_of()==Input_Tuple) { - if (cL0 >= f->arity()) { - (*func)->remap = r.get_local(f, Output_Tuple); - } - else { - (*func)->remap = (*conj)->declare(); - (*conj)->make_inexact(); - } - remapped.append(*func); - } - } - (*conj)->remap(); - reset_remap_field(remapped); - remapped.clear(); - - (*conj)->guaranteed_leading_0s = (*conj)->possible_leading_0s = -1; - (*conj)->leading_dir = 0; - } - } - - MapRel1(r, m1, Comb_Id); // this invalidates leading0s - assert(r.is_set() || m1.n_out() == 0); // MapRel can't tell to make a set - r.markAsSet(); // if there were no outputs. - - // skip_set_checks++; - assert(r.query_guaranteed_leading_0s() == -1 && r.query_possible_leading_0s() == -1); - // skip_set_checks--; - - return r; -} - - -// -// Cross Product. Give two sets, A and B, create a relation whose -// domain is A and whose range is B. -// -Relation Cross_Product(NOT_CONST Relation &input_A, - NOT_CONST Relation &input_B) { - Relation A = consume_and_regurgitate(input_A); - Relation B = consume_and_regurgitate(input_B); - if (A.is_null() || B.is_null()) - throw std::invalid_argument("null relation"); - if (!A.is_set() || !B.is_set()) - throw std::invalid_argument("cross product must be on two set"); - - // assert(A.is_set()); - // assert(B.is_set()); - - // skip_set_checks++; - assert(A.query_guaranteed_leading_0s() == -1 && - A.query_possible_leading_0s() == -1); - assert(B.query_guaranteed_leading_0s() == -1 && - B.query_possible_leading_0s() == -1); - // skip_set_checks--; - - Mapping mA(A.n_set()); - Mapping mB(B.n_set()); - int i; - for(i = 1; i <= B.n_set(); i++) mB.set_map_set(i, Output_Var,i); - for(i = 1; i <= A.n_set(); i++) mA.set_map_set(i, Input_Var,i); - return MapAndCombineRel2(A, B, mA, mB, Comb_And); -} - - -// -// inverse F -// reverse the input and output tuples -// -Relation Inverse(NOT_CONST Relation &S) { - Relation r = consume_and_regurgitate(S); - if (r.is_null()) - return r; - - // assert(!r.is_null()); - // assert(!r.is_set()); - int i; - - Mapping m1(r.n_inp(), r.n_out()); - for(i=1; i<=r.n_inp(); i++) m1.set_map_in (i, Output_Var,i); - for(i=1; i<=r.n_out(); i++) m1.set_map_out(i, Input_Var,i); - - MapRel1(r, m1, Comb_Id, -1, -1, false); - - r.reverse_leading_dir_info(); - - return r; -} - -Relation After(NOT_CONST Relation &input_S, - int carried_by, int new_output,int dir) { - Relation S = consume_and_regurgitate(input_S); - assert(!S.is_null()); - assert(!S.is_set()); - int i; - Relation r(*S.split(),42); - - int a = r.max_ufs_arity_of_out(); - int preserved_positions = min(carried_by-1,new_output); - if (a >= preserved_positions) { - // UFS's must evacuate from the output tuple - Variable_ID_Tuple remapped; - - r.simplify(); - DNF *d = r.split()->DNFize(); - d->count_leading_0s(); - // Any conjucts with leading_0s == -1 must have >= "a" leading 0s - // What a gross way to do this. Ferd - - for (DNF_Iterator conj(d); conj; conj++) { - int cL0 = (*conj)->guaranteed_leading_0s; - - for (Variable_ID_Iterator func((*conj)->mappedVars); func; func++) - if ((*func)->kind() == Global_Var) { - Global_Var_ID f = (*func)->get_global_var(); - if (f->arity() > preserved_positions - && (*func)->function_of()==Output_Tuple) { - if (cL0 >= f->arity()) { - (*func)->remap = r.get_local(f, Input_Tuple); - } - else { - (*func)->remap = (*conj)->declare(); - (*conj)->make_inexact(); - } - remapped.append(*func); - } - } - (*conj)->remap(); - reset_remap_field(remapped); - remapped.clear(); - - (*conj)->guaranteed_leading_0s = - (*conj)->possible_leading_0s = -1; - (*conj)->leading_dir = 0; - } - } - - Mapping m1(r.n_inp(), r.n_out()); - for(i=1; i<=r.n_inp(); i++) m1.set_map_in (i, Input_Var,i); - if (carried_by > new_output) { - int preserve = min(new_output,r.n_out()); - for(i=1; i<=preserve; i++) m1.set_map_out(i, Output_Var,i); - for(i=preserve+1; i<=r.n_out(); i++) m1.set_map_out(i, Exists_Var,-1); - MapRel1(r, m1, Comb_Id, -1, -1, true); - if (new_output > preserve) - r = Extend_Range(r,new_output-r.n_out()); - return r; - } - - for(i=1; iOut_Names.append(Const_String()); - body->number_output++; - assert(body->n_out() <= input_vars.size()); - - - GEQ_Handle h = and_below_exists->add_GEQ(0); - assert(carried_by < 128); - h.update_coef(exists_ids[1],-dir); - h.update_coef(r.output_var(carried_by),dir); - h.update_const(-1); - h.finalize(); - r.finalize(); - if (new_output > r.n_out()) - r = Extend_Range(r,new_output-r.n_out()); - return r; -} - -// -// Identity. -// -Relation Identity(int n_inp) { - Relation rr(n_inp, n_inp); - F_And *f = rr.add_and(); - for(int i=1; i<=n_inp; i++) { - EQ_Handle e = f->add_EQ(); - e.update_coef(rr.input_var(i), -1); - e.update_coef(rr.output_var(i), 1); - e.finalize(); - } - rr.finalize(); - assert(!rr.is_null()); - return rr; -} - -Relation Identity(NOT_CONST Relation &input_r) { - Relation r = consume_and_regurgitate(input_r); - return Restrict_Domain(Identity(r.n_set()),r); -} - -// -// Deltas(F) -// Return a set such that the ith variable is old Out_i - In_i -// Delta variables are created as input variables. -// Then input and output variables are projected out. -// -Relation Deltas(NOT_CONST Relation &S) { - Relation R = consume_and_regurgitate(S); - assert(!R.is_null()); - // skip_set_checks++; - assert(R.n_inp()==R.n_out()); - int in = R.n_inp(); - // skip_set_checks--; - return Deltas(R,in); -} - -Relation Deltas(NOT_CONST Relation &S, int eq_no) { - Relation R = consume_and_regurgitate(S); - // skip_set_checks++; - assert(!R.is_null()); - assert(eq_no<=R.n_inp()); - assert(eq_no<=R.n_out()); - // R.split(); - - int no_inp = R.n_inp(); - int no_out = R.n_out(); - - if(relation_debug) { - fprintf(DebugFile,"Computing Deltas:\n"); - R.prefix_print(DebugFile); - } - int a = R.max_ufs_arity(); - if (a > 0) { - Variable_ID_Tuple remapped; - - // UFS's must evacuate from all tuples - we need to go to DNF - // to enumerate the variables, I think... - R.simplify(); - if(relation_debug) { - fprintf(DebugFile,"Relation simplified:\n"); - R.prefix_print(DebugFile); - } - DNF *d = R.split()->DNFize(); - - for (DNF_Iterator conj(d); conj; conj++) { - for (Variable_ID_Iterator func((*conj)->mappedVars); func; func++) - if ((*func)->kind() == Global_Var) { - Global_Var_ID f = (*func)->get_global_var(); - if (f->arity() > 0) { - (*func)->remap = (*conj)->declare(); - (*conj)->make_inexact(); - remapped.append(*func); - } - } - (*conj)->remap(); - reset_remap_field(remapped); - remapped.clear(); - } - } - - R = Extend_Domain(R, eq_no); // add eq_no Delta vars - Mapping M(no_inp+eq_no, no_out); - int i; - for(i=1; i<=eq_no; i++) { // Set up Deltas equalities - EQ_Handle E = R.and_with_EQ(); - /* delta_i - w_i + r_i = 0 */ - E.update_coef(R.input_var(i), 1); - E.update_coef(R.output_var(i), -1); - E.update_coef(R.input_var(no_inp+i), 1); - E.finalize(); - M.set_map(Input_Var, no_inp+i, Set_Var, i); // Result will be a set - } - for(i=1; i<=no_inp; i++) { // project out input variables - M.set_map(Input_Var, i, Exists_Var, i); - } - for(i=1; i<=no_out; i++) { // project out output variables - M.set_map(Output_Var, i, Exists_Var, no_inp+i); - } - MapRel1(R, M, Comb_Id, eq_no, 0); - - if(relation_debug) { - fprintf(DebugFile,"Computing deltas:\n"); - R.prefix_print(DebugFile); - }; - R.finalize(); - assert(R.is_set()); // Should be since we map things to Set_Var - assert(R.n_set() == eq_no); - // skip_set_checks--; - return R; -} - - - - -Relation DeltasToRelation(NOT_CONST Relation &D, int n_inputs, int n_outputs) { - Relation R = consume_and_regurgitate(D); - - // skip_set_checks++; - assert(!R.is_null()); - R.markAsRelation(); - int common = R.n_inp(); - assert(common <= n_inputs); - assert(common <= n_outputs); - R.split(); - - if (R.max_ufs_arity() > 0) { - assert(R.max_ufs_arity() == 0 && - "'Deltas' not ready for UFS yet"); // FERD - fprintf(stderr, "'Deltas' not ready for UFS yet"); - exit(1); - } - - R = Extend_Domain(R, n_inputs); - R = Extend_Range(R, n_outputs); - Mapping M(common+n_inputs, n_outputs); - int i; - for(i=1; i<=common; i++) { // Set up Deltas equalities - EQ_Handle E = R.and_with_EQ(); - /* delta_i - w_i + r_i = 0 */ - E.update_coef(R.input_var(i), 1); - E.update_coef(R.output_var(i), -1); - E.update_coef(R.input_var(common+i), 1); - E.finalize(); - M.set_map(Input_Var, i, Exists_Var, i); // Result will be a set - } - for(i=1; i<=n_inputs; i++) { // project out input variables - M.set_map(Input_Var, common+i, Input_Var, i); - } - for(i=1; i<=n_outputs; i++) { // project out output variables - M.set_map(Output_Var, i, Output_Var, i); - } - MapRel1(R, M, Comb_Id, n_inputs, n_outputs); - - if(relation_debug) { - fprintf(DebugFile,"Computed DeltasToRelation:\n"); - R.prefix_print(DebugFile); - } - R.finalize(); - assert(!R.is_set()); - // skip_set_checks--; - return R; -} - - - -Relation Join(NOT_CONST Relation &G, NOT_CONST Relation &F) { - return Composition(F, G); -} - -bool prepare_relations_for_composition(Relation &r1,Relation &r2) { - assert(!r2.is_null() && !r1.is_null()); - - if(r2.is_set()) { - int a1 = r1.max_ufs_arity_of_in(), a2 = r2.max_ufs_arity_of_set(); - - if (a1 == 0 && a2 == 0) - return true; - else { - assert(0 && "Can't compose relation and set with function symbols"); - fprintf(stderr, "Can't compose relation and set with function symbols"); - exit(1); - return false; // make compiler shut up - } - } - - assert(r2.n_out() == r1.n_inp()); - - int zeros = max(r1.query_guaranteed_leading_0s(), - r2.query_guaranteed_leading_0s()); - return (zeros >= r1.max_ufs_arity_of_in() - && zeros >= r2.max_ufs_arity_of_out()); -} - -// -// Composition(F, G) = F o G, where F o G (x) = F(G(x)) -// That is, if F = { [i] -> [j] : ... } -// and G = { [x] -> [y] : ... } -// then Composition(F, G) = { [x] -> [j] : ... } -// -// align the output tuple for G and the input tuple for F, -// these become existensially quantified variables -// use the output tuple from F and the input tuple from G for the result -// match named variables in G and F -// formula is g & f -// -// If there are function symbols of arity > 0, we call special case -// code to handle them. This is not set up for the r2.is_set case yet. -// - -Relation Composition(NOT_CONST Relation &input_r1, NOT_CONST Relation &input_r2) { - Relation r1 = consume_and_regurgitate(input_r1); - Relation r2 = consume_and_regurgitate(input_r2); - assert(!r2.is_null() && !r1.is_null()); - - if(r2.is_set()) { - int a1 = r1.max_ufs_arity_of_in(), a2 = r2.max_ufs_arity_of_set(); - if (r2.n_set() != r1.n_inp()) { - fprintf(stderr,"Illegal composition/application, arities don't match\n"); - fprintf(stderr,"Trying to compute r1(r2)\n"); - fprintf(stderr,"arity of r2 must match input arity of r1\n"); - fprintf(stderr,"r1: "); - r1.print_with_subs(stderr); - fprintf(stderr,"r2: "); - r2.print_with_subs(stderr); - fprintf(stderr,"\n"); - assert(r2.n_set() == r1.n_inp()); - exit(1); - } - // skip_set_checks++; - int i; - if (a1 == 0 && a2 == 0) { - int x = r1.n_out(); - Mapping m1(r1.n_inp(), r1.n_out()); - for(i=1; i<=r1.n_out(); i++) m1.set_map_out(i, Set_Var,i); - for(i=1; i<=r1.n_inp(); i++) m1.set_map_in (i, Exists_Var,i); - Mapping m2(r2.n_set()); - for(i=1; i<=r2.n_set(); i++) m2.set_map_set(i, Exists_Var,i); - Relation R3 = MapAndCombineRel2(r2, r1, m2, m1, Comb_And); - // skip_set_checks--; - if (x == 0) - R3.markAsSet(); - return R3; - } - else { - assert(0 && - "Can't compose relation and set with function symbols"); - fprintf(stderr, - "Can't compose relation and set with function symbols"); - exit(1); - return Identity(0); // make compiler shut up - } - } - - if (r2.n_out() != r1.n_inp()) { - fprintf(stderr,"Illegal composition, arities don't match\n"); - fprintf(stderr,"Trying to compute r1 compose r2\n"); - fprintf(stderr,"Output arity of r2 must match input arity of r1\n"); - fprintf(stderr,"r1: "); - r1.print_with_subs(stderr); - fprintf(stderr,"r2: "); - r2.print_with_subs(stderr); - fprintf(stderr,"\n"); - assert(r2.n_out() == r1.n_inp()); - exit(1); - } - - int a1 = r1.max_ufs_arity_of_in(), a2 = r2.max_ufs_arity_of_out(); - - if (a1 == 0 && a2 == 0 && 0 /* FERD - leading 0's go wrong here */ ) { - // If no real UFS's, we can just use the general code: - int i; - Mapping m1(r1.n_inp(), r1.n_out()); - for(i=1; i<=r1.n_inp(); i++) m1.set_map_in (i, Exists_Var,i); - for(i=1; i<=r1.n_out(); i++) m1.set_map_out(i, Output_Var,i); - Mapping m2(r2.n_inp(), r2.n_out()); - for(i=1; i<=r2.n_inp(); i++) m2.set_map_in (i, Input_Var,i); - for(i=1; i<=r2.n_out(); i++) m2.set_map_out(i, Exists_Var,i); - - return MapAndCombineRel2(r2, r1, m2, m1, Comb_And); - } - else { - Relation result(r2.n_inp(), r1.n_out()); - int mid_size = r2.n_out(); - int i; - for(i =1; i<=r2.n_inp(); i++) - result.name_input_var(i,r2.input_var(i)->base_name); - for(i =1; i<=r1.n_out(); i++) - result.name_output_var(i,r1.output_var(i)->base_name); - - r1.simplify(); - r2.simplify(); - - Rel_Body *b1 = r1.split(), *b2 = r2.split(); - - if (b1 == b2) { - assert(0 && "Compose: not ready to handle b1 == b2 yet."); - fprintf(stderr, "Compose: not ready to handle b1 == b2 yet.\n"); - exit(1); - } - - DNF *d1 = b1->DNFize(); - DNF *d2 = b2->DNFize(); - - d1->count_leading_0s(); - d2->count_leading_0s(); - // Any conjucts with leading_0s == -1 must have >= max_arity leading 0s - // What a gross way to do this. Ferd - - F_Exists *exists = result.add_exists(); - Section middle_tuple = exists->declare_tuple(mid_size); - Map lost_functions((Variable_ID)0); - - F_Or *result_conjs = exists->add_or(); - - for (DNF_Iterator conj1(d1); conj1; conj1++) - for (DNF_Iterator conj2(d2); conj2; conj2++) { - // combine conj1 and conj2: - // conj2's in becomes result's in; conj1's out becomes out - // conj2's out and conj1's in get merged and exist. quant. - // conj2's f(in) and conj1's f(out) become f(in) and f(out) - // conj2's f(out) and conj1's f(in) get merged, evacuate: - // if conj1 has f.arity leading 0s, they become f(out), - // if conj2 has f.arity leading 0s, they become f(in) - // if neither has enough 0s, they become a wildcard - // and the result is inexact - // old wildcards stay wildcards - -#if defined STUDY_EVACUATIONS - study_evacuation(*conj1, *conj2, max(a1, a2)); -#endif - - Conjunct *copy1, *copy2; - copy2 = (*conj2)->copy_conj_same_relation(); - copy1 = (*conj1)->copy_conj_same_relation(); - - Variable_ID_Tuple remapped; - - int c1L0 = copy1->guaranteed_leading_0s; - int c2L0 = copy2->guaranteed_leading_0s; - - int inexact = 0; - - // get rid of conj2's f(out) - { - for (Variable_ID_Iterator func(copy2->mappedVars); func; func++) - if ((*func)->kind() == Global_Var) { - Global_Var_ID f = (*func)->get_global_var(); - if (f->arity() > 0 && (*func)->function_of()==Output_Tuple) { - if (c2L0 >= f->arity()) { - (*func)->remap = r2.get_local(f, Input_Tuple); - remapped.append(*func); - } - else if (c1L0 >= f->arity()) { - // f->remap = copy1->get_local(f, Output_Tuple); - // this should work with the current impl. - // SHOULD BE A NO-OP? - assert((*func)==r1.get_local(f,Output_Tuple)); - } - else { - Variable_ID f_quantified = lost_functions[f]; - if (!f_quantified) { - f_quantified = exists->declare(); - lost_functions[f] = f_quantified; - } - inexact = 1; - (*func)->remap = f_quantified; - remapped.append(*func); - } - } - } - } - - // remap copy2's out - for (i=1; i<=mid_size; i++) { - r2.output_var(i)->remap = middle_tuple[i]; - } - - // do remapping for conj2, then reset everything so - // we can go on with conj1 - - copy2->remap(); - reset_remap_field(remapped); - reset_remap_field(output_vars,mid_size); - - - remapped.clear(); - - // get rid of conj1's f(in) - { - for (Variable_ID_Iterator func(copy1->mappedVars); func; func++) - if ((*func)->kind() == Global_Var) { - Global_Var_ID f = (*func)->get_global_var(); - if (f->arity() > 0 && (*func)->function_of()==Input_Tuple) { - if (c1L0 >= f->arity()) { - (*func)->remap = r1.get_local(f,Output_Tuple); - remapped.append(*func); - } - else if (c2L0 >= f->arity()) { - // f->remap = copy2->get_local(f, Input_Tuple); - // this should work with the current impl. - // SHOULD BE A NO-OP? - assert((*func)==r2.get_local(f,Input_Tuple)); - } - else { - Variable_ID f_quantified = lost_functions[f]; - if (!f_quantified) { - f_quantified = exists->declare(); - lost_functions[f] = f_quantified; - } - inexact = 1; - (*func)->remap = f_quantified; - remapped.append(*func); - } - } - } - } - - // merge copy1's in with the already remapped copy2's out - for (i=1; i<=mid_size; i++) { - r1.input_var(i)->remap = middle_tuple[i]; - } - - copy1->remap(); - reset_remap_field(remapped); - reset_remap_field(input_vars,mid_size); - - Conjunct *conj3 = merge_conjs(copy1, copy2, MERGE_COMPOSE, exists->relation()); - result_conjs->add_child(conj3); - delete copy1; - delete copy2; - - // make sure all variables used in the conjunct - // are listed in the "result" relation - - for (Variable_ID_Iterator func(conj3->mappedVars); func; func++) - if ((*func)->kind() == Global_Var) { - Global_Var_ID f = (*func)->get_global_var(); - if (f->arity() > 0) - result.get_local(f, (*func)->function_of()); - else - result.get_local(f); - } - - if (inexact) - conj3->make_inexact(); - } - - // result.simplify(2, 4); // can't really do that now, will cause failure in chill - result.finalize(); - r1 = r2 = Relation(); - return result; - } -} - - - -bool Is_Obvious_Subset(NOT_CONST Relation &input_r1, NOT_CONST Relation &input_r2) { - Relation r1 = consume_and_regurgitate(input_r1); - Relation r2 = consume_and_regurgitate(input_r2); - - assert(!r1.is_null() && !r2.is_null()); - Rel_Body *rr1 = r1.split(); - Rel_Body *rr2 = r2.split(); - rr1->simplify(); - rr2->simplify(); - use_ugly_names++; - - remap_DNF_vars(rr2, rr1); - - for(DNF_Iterator pd1(rr1->query_DNF()); pd1.live(); pd1.next()) { - Conjunct *conj1 = pd1.curr(); - int found = false; - for(DNF_Iterator pd2(rr2->query_DNF()); pd2.live(); pd2.next()) { - Conjunct *conj2 = pd2.curr(); - if (!conj2->is_exact()) continue; - - Conjunct *cgist = merge_conjs(conj1, conj2, MERGE_GIST, conj2->relation()); -#ifndef NDEBUG - cgist->setup_names(); -#endif - if (cgist->redSimplifyProblem(2, 0) == noRed) { - delete cgist; - found = true; - break; - } - delete cgist; - } - if (! found) { - use_ugly_names--; - r1 = r2 = Relation(); - return false; - } - } - use_ugly_names--; - r1 = r2 = Relation(); - return true; -} /* Is_Obvious_Subset */ - - -bool do_subset_check(NOT_CONST Relation &input_r1, - NOT_CONST Relation &input_r2); - -// do_subset_check really implements Must_Be_Subset anyway (due to -// correct handling of inexactness in the negation code), but -// still take upper and lower bounds here -bool Must_Be_Subset(NOT_CONST Relation &r1, NOT_CONST Relation &r2) { - Relation s1 = Upper_Bound(consume_and_regurgitate(r1)); - Relation s2 = Lower_Bound(consume_and_regurgitate(r2)); - return do_subset_check(s1,s2); -} - -bool Might_Be_Subset(NOT_CONST Relation &r1, NOT_CONST Relation &r2) { - Relation s1 = Lower_Bound(consume_and_regurgitate(r1)); - Relation s2 = Upper_Bound(consume_and_regurgitate(r2)); - return do_subset_check(s1,s2); -} - -bool May_Be_Subset(NOT_CONST Relation &r1, NOT_CONST Relation &r2){ - return Might_Be_Subset(r1,r2); -} - - - - -// -// F Must_Be_Subset G -// Test that (f => g) === (~f | g) is a Tautology -// or that (f & ~g) is unsatisfiable: -// align the input tuples (if any) for F and G -// align the output tuples (if any) for F and G -// Special case: if r2 has a single conjunct then use HasRedQeuations. -// - -bool do_subset_check(NOT_CONST Relation &input_r1, - NOT_CONST Relation &input_r2) { - Relation r1 = consume_and_regurgitate(input_r1); - Relation r2 = consume_and_regurgitate(input_r2); - if (r1.is_null() || r2.is_null()) - throw std::invalid_argument("null relation"); - if (r1.n_inp() != r2.n_inp() || r1.n_out() != r2.n_out()) - throw std::invalid_argument("relation arity does not match"); - - // assert(!r1.is_null() && !r2.is_null()); - // skip_set_checks++; - // assert(r1.n_inp() == r2.n_inp()); - // assert(r1.n_out() == r2.n_out()); - // skip_set_checks--; - r1.simplify(1,0); - r2.simplify(2,2); - Rel_Body *rr1 = r1.split(); - - if(relation_debug) { - fprintf(DebugFile, "\n$$$ Must_Be_Subset IN $$$\n"); - } - - bool c = true; - - // Check each conjunct separately - for(DNF_Iterator pd(rr1->query_DNF()); c && pd.live(); ) { - Relation tmp(r1,pd.curr()); - pd.next(); -#ifndef CHECK_MAYBE_SUBSET - if (pd.live()) - c = !Difference(tmp,copy(r2)).is_upper_bound_satisfiable(); - else - c = !Difference(tmp,r2).is_upper_bound_satisfiable(); -#else - Relation d=Difference(copy(tmp), copy(r2)); - c=!d.is_upper_bound_satisfiable(); - if (!c && !d.is_exact()) { // negation-induced inexactness - static int OMEGA_WHINGE = -1; - if (OMEGA_WHINGE < 0) { - OMEGA_WHINGE = getenv("OMEGA_WHINGE") ? atoi(getenv("OMEGA_WHINGE")) : 0; - } - if (OMEGA_WHINGE) { - fprintf(DebugFile,"\n===== r1 is maybe a Must_Be_Subset of r2 ========\n"); - fprintf(DebugFile,"-------> r1:\n"); - tmp.print_with_subs(DebugFile); - fprintf(DebugFile,"-------> r2:\n"); - r2.print_with_subs(DebugFile); - fprintf(DebugFile,"-------> r1-r2:\n"); - d.print_with_subs(DebugFile); - } - } -#endif - } - - if(relation_debug) { - fprintf(DebugFile, "$$$ Must_Be_Subset OUT $$$\n"); - } - r1 = r2 = Relation(); - return c; -} - - -// -// F minus G -// -Relation Difference(NOT_CONST Relation &input_r1, - NOT_CONST Relation &input_r2) { - Relation r1 = consume_and_regurgitate(input_r1); - Relation r2 = consume_and_regurgitate(input_r2); - if (r1.is_null() || r2.is_null()) - return r1; - if (r1.n_inp() != r2.n_inp() || r1.n_out() != r2.n_out()) - throw std::invalid_argument("relation arity does not match"); - - //assert(!r1.is_null() && !r2.is_null()); - // skip_set_checks++; - // assert(r1.n_inp() == r2.n_inp()); - // assert(r1.n_out() == r2.n_out()); - - int i; - Mapping m1(r1.n_inp(), r1.n_out()); - for(i=1; i<=r1.n_inp(); i++) m1.set_map_in (i, Input_Var,i); - for(i=1; i<=r1.n_out(); i++) m1.set_map_out(i, Output_Var,i); - Mapping m2(r2.n_inp(), r2.n_out()); - for(i=1; i<=r2.n_inp(); i++) m2.set_map_in (i, Input_Var,i); - for(i=1; i<=r2.n_out(); i++) m2.set_map_out(i, Output_Var,i); - // skip_set_checks--; - - return MapAndCombineRel2(r1, r2, m1, m2, Comb_AndNot); -} - -// -// complement F -// not F -// -Relation Complement(NOT_CONST Relation &S) { - Relation r = consume_and_regurgitate(S); - if (r.is_null()) - return r; - - // assert(!r.is_null()); - // skip_set_checks++; - int i; - Mapping m(r.n_inp(), r.n_out()); - for(i=1; i<=r.n_inp(); i++) m.set_map_in (i, Input_Var,i); - for(i=1; i<=r.n_out(); i++) m.set_map_out(i, Output_Var,i); - // skip_set_checks--; - - MapRel1(r, m, Comb_AndNot, -1, -1, false); - return r; -} - - -// -// Compute (gist r1 given r2). -// Currently we assume that r2 has only one conjunct. -// r2 may have zero input and output OR may have # in/out vars equal to r1. -// -Relation GistSingleConjunct(NOT_CONST Relation &input_R1, - NOT_CONST Relation &input_R2, int effort) { - Relation R1 = consume_and_regurgitate(input_R1); - Relation R2 = consume_and_regurgitate(input_R2); - - // skip_set_checks++; - assert(!R1.is_null() && !R2.is_null()); - assert((R1.n_inp() == R2.n_inp() && R1.n_out() == R2.n_out()) || - (R2.n_inp() == 0 && R2.n_out() == 0)); - R1.simplify(); - R2.simplify(); - Rel_Body *r1 = R1.split(); - Rel_Body *r2 = R2.split(); - - if(relation_debug) { - fprintf(DebugFile, "\n### GIST computation start ### [\n"); - R1.prefix_print(DebugFile); - R2.prefix_print(DebugFile); - fprintf(DebugFile, "### ###\n"); - } - - -// The merged conjunct has to have the variables of either r1 or r2, but -// not both. Use r1's, since it'll be cheaper to remap r2's single conj. - remap_DNF_vars(r2, r1); - assert(r2->is_upper_bound_satisfiable() && "Gist: second operand is FALSE"); - // skip_set_checks--; - - Conjunct *known = r2->single_conjunct(); - assert(known != NULL && "Gist: second operand has more than 1 conjunct"); - - DNF *new_dnf = new DNF(); - for(DNF_Iterator pd(r1->simplified_DNF); pd.live(); pd.next()) { - Conjunct *conj = pd.curr(); - Conjunct *cgist = merge_conjs(known, conj, MERGE_GIST, conj->relation()); // Uses r1's vars - cgist->set_relation(r1); // Thinks it's part of r1 now, for var. purposes - if(simplify_conj(cgist, true, effort+1, EQ_RED)) { - /* Throw out black constraints, turn red constraints into black */ - cgist->rm_color_constrs(); - if(cgist->is_true()) { - delete new_dnf; - delete cgist; - // skip_set_checks++; - Relation retval = Relation::True(r1->n_inp(), r2->n_out()); - // retval.finalize(); - retval.simplify(); - if(R1.is_set() && R2.is_set()) retval.markAsSet(); - // skip_set_checks--; - return retval; - } - else { - // since modular equations might be changed, simplify again! - simplify_conj(cgist, true, effort+1, EQ_BLACK); - - new_dnf->add_conjunct(cgist); - } - } - } - delete r1->simplified_DNF; - r1->simplified_DNF = new_dnf; - assert(!r1->is_null()); - R1.finalize(); - if(relation_debug) { - fprintf(DebugFile, "] ### GIST computation end ###\n"); - R1.prefix_print(DebugFile); - fprintf(DebugFile, "### ###\n"); - } - return(R1); -} - - -// -// Compute gist r1 given r2. r2 can have multiple conjuncts, -// return result is always simplified. -// -Relation Gist(NOT_CONST Relation &input_R1, - NOT_CONST Relation &input_R2, int effort) { - Relation R1 = consume_and_regurgitate(input_R1); - Relation R2 = consume_and_regurgitate(input_R2); - if (R1.is_null()) - return R1; - // change the Gist semantics to allow r2 be null -- by chun 07/30/2007 - if (R2.is_null()) { - R1.simplify(); - return R1; - } - if (!(R1.n_inp() == 0 && R2.n_out() == 0) && - (R1.n_inp() != R2.n_inp() || R1.n_out() != R2.n_out())) - throw std::invalid_argument("relation arity does not match"); - - // skip_set_checks++; - // assert(!R1.is_null()); - // assert(R2.is_null() || - // (R1.n_inp() == R2.n_inp() && R1.n_out() == R2.n_out()) || - // (R2.n_inp() == 0 && R2.n_out() == 0)); - // skip_set_checks--; - R2.simplify(); - - if(relation_debug) { - fprintf(DebugFile, "\n### multi-GIST computation start ### [\n"); - R1.prefix_print(DebugFile); - R2.prefix_print(DebugFile); - fprintf(DebugFile, "### ###\n"); - } - - if (!R2.is_upper_bound_satisfiable()) - return Relation::True(R1); - if (R2.is_obvious_tautology()) { - R1.simplify(); - return R1; - } - R1.simplify(); - - if (!Intersection(copy(R1), copy(R2)).is_upper_bound_satisfiable()) - return Relation::False(R1); - - int nconj1=0; - for (DNF_Iterator di(R1.simplified_DNF()); di.live(); di.next()) - nconj1++; - int nconj2=0; - for (DNF_Iterator di2(R2.simplified_DNF()); di2.live(); di2.next()) - nconj2++; - - { - static int OMEGA_WHINGE = -1; - if (OMEGA_WHINGE < 0) { - OMEGA_WHINGE = getenv("OMEGA_WHINGE") ? atoi(getenv("OMEGA_WHINGE")) : 0; - } - if (OMEGA_WHINGE && (nconj1 + nconj2 > 50)) { - fprintf(DebugFile,"WOW!!!! - Gist (%d conjuncts, %d conjuncts)!!!\n", - nconj1,nconj2); - fprintf(DebugFile,"Base:\n"); - R1.prefix_print(DebugFile); - fprintf(DebugFile,"Context:\n"); - R2.prefix_print(DebugFile); - } - } - - if (nconj2==1) - return GistSingleConjunct(R1,R2, effort); - else { - R1.simplify(0,1); - R2.simplify(0,1); - Relation G = Relation::True(R1); - for (DNF_Iterator di2(R2.simplified_DNF()); di2.live(); di2.next()) { - Conjunct * c2 = di2.curr(); - Relation G2 = Relation::False(R1); - for (DNF_Iterator di1(R1.simplified_DNF()); di1.live(); di1.next()) { - Conjunct * c1 = di1.curr(); - Relation G1=GistSingleConjunct(Relation(R1,c1), Relation(R2,c2),effort); - - if (G1.is_obvious_tautology()) { - G2 = G1; - break; - } - else if (!G1.is_upper_bound_satisfiable() || !G1.is_exact()) { - if(relation_debug) { - fprintf(DebugFile, "gist A given B is unsatisfiable\n"); - fprintf(DebugFile, "A:\n"); - Relation(R1,c1).prefix_print(DebugFile); - fprintf(DebugFile, "B:\n"); - Relation(R2,c2).prefix_print(DebugFile); - fprintf(DebugFile, "\n"); - } - //G1 = Relation(R1,c1); - return R1; - } - else if(0 && G1.is_exact() && !Must_Be_Subset(Relation(R1,c1),copy(G1))) { - fprintf(DebugFile,"Unexpected non-Must_Be_Subset gist result!\n"); - fprintf(DebugFile,"base: \n"); - Relation(R1,c1).prefix_print(DebugFile); - fprintf(DebugFile,"context: \n"); - Relation(R2,c2).prefix_print(DebugFile); - fprintf(DebugFile,"result: \n"); - G1.prefix_print(DebugFile); - fprintf(DebugFile,"base not subseteq result: \n"); - assert(!G1.is_exact() || Must_Be_Subset(Relation(R1,c1),copy(G1))); - } - G2=Union(G2,G1); - } - G2.simplify(0,1); - G = Intersection(G,G2); - G.simplify(0,1); - if(relation_debug) { - fprintf(DebugFile, "result so far is:\n"); - G.prefix_print(DebugFile); - } - } - - if(relation_debug) { - fprintf(DebugFile, "\n### end multi-GIST computation ### ]\n"); - fprintf(DebugFile, "G is:\n"); - G.prefix_print(DebugFile); - fprintf(DebugFile, "### ###\n"); - } -#if ! defined NDEBUG - Relation S1 = Intersection(copy(R1), copy(R2)); - Relation S2 = Intersection(copy(G), copy(R2)); - - - if(relation_debug) { - fprintf(DebugFile, "\n---->[Checking validity of the GIST result\n"); - fprintf(DebugFile, "for G=gist R1 given R2:\n"); - fprintf(DebugFile, "R1 intersect R2 is:\n"); - S1.print_with_subs(DebugFile); - fprintf(DebugFile, "\nG intersect R2 is:\n"); - S2.print_with_subs(DebugFile); - fprintf(DebugFile, "---->]\n"); - } - assert (!S1.is_exact() || !S2.is_exact() || (Must_Be_Subset(copy(S1),copy(S2)) && Must_Be_Subset(copy(S2),copy(S1)))); -#endif - return G; - } -} - - -// Project away all input and output variables. -Relation Project_On_Sym(NOT_CONST Relation &S, - NOT_CONST Relation &input_context) { - Relation R = consume_and_regurgitate(S); - Relation context = consume_and_regurgitate(input_context); - int i; - - // skip_set_checks++; - leave_pufs_untouched++; - int in_arity = R.max_ufs_arity_of_in(); - int out_arity = R.max_ufs_arity_of_out(); - assert(!R.is_null()); - R.split(); - - int no_inp = R.n_inp(); - int no_out = R.n_out(); - Mapping M(no_inp, no_out); - - for(i=1; i<=no_inp; i++) { // project out input variables - M.set_map(Input_Var, i, Exists_Var, i); - } - for(i=1; i<=no_out; i++) { // project out output variables - M.set_map(Output_Var, i, Exists_Var, no_inp+i); - } - MapRel1(R, M, Comb_Id, 0, 0); - - R.finalize(); - if (in_arity) R = Extend_Domain(R,in_arity); - if (out_arity) R = Extend_Range(R,out_arity); - - int d = min(in_arity,out_arity); - if (d && !context.is_null()) { - int g = min(d,context.query_guaranteed_leading_0s()); - int p = min(d,context.query_possible_leading_0s()); - int dir = context.query_leading_dir(); - R.enforce_leading_info(g,p,dir); - } - - leave_pufs_untouched--; - // skip_set_checks--; - if(relation_debug) { - fprintf(DebugFile,"\nProjecting onto symbolic (%d,%d):\n",in_arity,out_arity); - R.prefix_print(DebugFile); - } - return R; -} - - -// -// Project out global variable g from relation r -// -Relation Project(NOT_CONST Relation &S, Global_Var_ID g) { - Relation R = consume_and_regurgitate(S); - assert(!R.is_null()); - - skip_finalization_check++; - - Rel_Body *r = R.split(); - r->DNF_to_formula(); - Formula *f = r->rm_formula(); - F_Exists *ex = r->add_exists(); - ex->add_child(f); - - if (g->arity() == 0) { - assert(R.has_local(g) && "Project: Relation doesn't contain variable to be projected"); - Variable_ID v = R.get_local(g); - - bool rmd = rm_variable(r->Symbolic,v); - assert(rmd && "Project: Variable to be projected doesn't exist"); - - v->remap = ex->declare(v->base_name); - f->remap(); - v->remap = v; - } - else { - assert((R.has_local(g, Input_Tuple) || R.has_local(g, Output_Tuple)) && "Project: Relation doesn't contain variable to be projected"); - - if (R.has_local(g, Input_Tuple)) { - Variable_ID v = R.get_local(g, Input_Tuple); - - bool rmd = rm_variable(r->Symbolic,v); - assert(rmd && "Project: Variable to be projected doesn't exist"); - - v->remap = ex->declare(v->base_name); - f->remap(); - v->remap = v; - } - if (R.has_local(g, Output_Tuple)) { - Variable_ID v = R.get_local(g, Output_Tuple); - - bool rmd = rm_variable(r->Symbolic,v); - assert(rmd && "Project: Variable to be projected doesn't exist"); - - v->remap = ex->declare(v->base_name); - f->remap(); - v->remap = v; - } - } - - skip_finalization_check--; - - R.finalize(); - return R; -} - - -// -// Project all symbolic variables from relation r -// -Relation Project_Sym(NOT_CONST Relation &S) { - Relation R = consume_and_regurgitate(S); - assert(!R.is_null()); - - Rel_Body *r = R.split(); - r->DNF_to_formula(); - - Formula *f = r->rm_formula(); - - skip_finalization_check++; - F_Exists *ex = r->add_exists(); - for(Variable_ID_Iterator R_Sym(r->Symbolic); R_Sym; R_Sym++) { - Variable_ID v = *R_Sym; - v->remap = ex->declare(v->base_name); - } - ex->add_child(f); - skip_finalization_check--; - - f->remap(); - - reset_remap_field(r->Symbolic); - r->Symbolic.clear(); - - R.finalize(); - return R; -} - -// -// Project specified variables, leaving those variables with no constraints. -// -Relation Project(NOT_CONST Relation &S, Sequence &s) { - // This is difficult to do with mappings. This cheats, since it is - // much easier and more straightforward. - - Relation R = consume_and_regurgitate(S); - assert(!R.is_null()); - - Rel_Body *r = R.split(); - r->DNF_to_formula(); - Formula *f = r->rm_formula(); - bool need_symbolic_clear = false; - - skip_finalization_check++; - F_Exists *ex = r->add_exists(); - for(int i = 1; i <= s.size(); i++) { - if (s[i]->kind() == Global_Var) - need_symbolic_clear = true; - s[i]->remap = ex->declare(s[i]->base_name); - } - ex->add_child(f); - skip_finalization_check--; - - f->remap(); - - reset_remap_field(s); - if (need_symbolic_clear) - r->Symbolic.clear(); - - R.finalize(); - return R; -} - -Relation Project(NOT_CONST Relation &S, int pos, Var_Kind vkind) { - Variable_ID v = 0; // shut the compiler up - switch (vkind) { - case Input_Var: - v = input_vars[pos]; - break; - case Output_Var: - v = output_vars[pos]; - break; - // case Set_Var: - // v = set_vars[pos]; - // break; - default: - assert(0); - } - - return Project(S, v); -} - -Relation Project(NOT_CONST Relation &S, Variable_ID v) { - Tuple s; - s.append(v); - return Project(S, s); -} - -// -// Variables in DNF of map_rel reference declarations of map_rel (or not). -// remap_DNF_vars makes them to reference declarations of ref_rel. -// Ref_rel can get new global variable declarations in the process. -// -void remap_DNF_vars(Rel_Body *map_rel, Rel_Body *ref_rel) { - // skip_set_checks++; - assert (map_rel->simplified_DNF); - assert (ref_rel->simplified_DNF); - - // skip_set_checks++; - - for(DNF_Iterator pd(map_rel->simplified_DNF); pd.live(); pd.next()) { - Conjunct *cc = pd.curr(); - Variable_ID_Tuple &mvars = cc->mappedVars; - for(Variable_Iterator mvarsIter=mvars; mvarsIter; mvarsIter++) { - Variable_ID v = *mvarsIter; - switch(v->kind()) { - case Input_Var: - assert(ref_rel->n_inp() >= v->get_position()); - break; - case Output_Var: - assert(ref_rel->n_out() >= v->get_position()); - break; - case Global_Var: - // The assignment is a noop, but tells ref_rel that the global may be - // used inside it, which is required. - *mvarsIter = ref_rel->get_local(v->get_global_var(),v->function_of()); - break; - case Wildcard_Var: - break; - default: - assert(0 && "bad variable kind"); - } - } - } - // skip_set_checks--; -} - - -Relation projectOntoJust(Relation R, Variable_ID v) { - // skip_set_checks++; - - int ivars = R.n_inp(), ovars = R.n_out(); - int ex_ivars= 0, ex_ovars = 0; - - assert(v->kind() == Input_Var || v->kind() == Output_Var); - if (v->kind() == Input_Var) { - ex_ivars = 1; - R = Extend_Domain(R,1); - } - else { - ex_ovars = 1; - R = Extend_Range(R,1); - } - - // Project everything except v - Mapping m(ivars+ex_ivars,ovars+ex_ovars); - int j; - for(j = 1; j <=ivars+ex_ivars; j++) m.set_map_in(j, Exists_Var, j); - for(j = 1; j <=ovars+ex_ovars; j++) m.set_map_out(j, Exists_Var, j+ivars+ex_ivars); - m.set_map(v->kind(), v->get_position(), v->kind(), v->get_position()); - - MapRel1(R, m, Comb_Id,-1,-1); - R.finalize(); - // skip_set_checks--; - return R; -} - -//static -//void copyEQtoGEQ(GEQ_Handle &g, const EQ_Handle &e, bool negate) { -//extern void copy_constraint(Constraint_Handle H, Constraint_Handle initial); -// copy_constraint(g, e); -//} - - -Relation EQs_to_GEQs(NOT_CONST Relation &S, bool excludeStrides) { - Relation R = consume_and_regurgitate(S); - assert(R.is_simplified()); - use_ugly_names++; - for (DNF_Iterator s(R.query_DNF()); s.live(); s.next()) - s.curr()->convertEQstoGEQs(excludeStrides); - use_ugly_names--; - return R; -} - - -// Tuple to find values for is input+output -Relation Symbolic_Solution(NOT_CONST Relation &R) { - Relation S = consume_and_regurgitate(R); - Tuple vee; - // skip_set_checks++; - int i; - for(i = 1; i <= S.n_inp(); i++) vee.append(input_var(i)); - for(i = 1; i <= S.n_out(); i++) vee.append(output_var(i)); - // skip_set_checks--; - - return Solution(S, vee); -} - - -// Tuple to find values for is given as arg, plus input and output -Relation Symbolic_Solution(NOT_CONST Relation &R, Sequence &for_these){ - Relation S = consume_and_regurgitate(R); - Tuple vee; - // skip_set_checks++; - int i; - for(Any_Iterator it(for_these); it; it++) - vee.append(*it); - for(i = 1; i <= S.n_inp(); i++) vee.append(input_var(i)); - for(i = 1; i <= S.n_out(); i++) vee.append(output_var(i)); - // skip_set_checks--; - - return Solution(S, vee); -} - - -// Tuple to find values for is input+output+global_decls -Relation Sample_Solution(NOT_CONST Relation &R) { - Relation S = consume_and_regurgitate(R); - - Tuple vee; - - // skip_set_checks++; - int i; - for(i = 1; i <= S.global_decls()->size(); i++) - vee.append((*S.global_decls())[i]); - for(i = 1; i <= S.n_inp(); i++) vee.append(input_var(i)); - for(i = 1; i <= S.n_out(); i++) vee.append(output_var(i)); - // skip_set_checks--; - - return Solution(S,vee); -} - - -// Tuple to find values is given as arg -Relation Solution(NOT_CONST Relation &S, Sequence &for_these ) { - Relation R = consume_and_regurgitate(S); - if (R.is_null()) - return R; - - //assert(!R.is_null()); - - if(!R.is_upper_bound_satisfiable()) { - return Relation::False(R); - } - - bool inexactAnswer=false; - if(R.is_inexact()) { - if(R.is_lower_bound_satisfiable()) - R = Lower_Bound(R); // a solution to LB is a solution to the relation - else { - // A solution to the UB may not be a solution to the relation: - // There may be a solution which satisfies all known constraints, but - // we have no way of knowing if it satisifies the unknown constraints. - inexactAnswer = true; - R = Upper_Bound(R); - } - } - - Sequence &vee = for_these; - for (DNF_Iterator di(R.query_DNF()); di; di++) { - Relation current(R, *di); - int i; - for(i = vee.size()-1; i >= 0; i--) { - bool some_constraints = false, one_stride = false; - - int current_var = vee.size()-i; - Section s(&vee,current_var+1,i); - - // Query variable in vee[current_var] - Relation projected = Project(copy(current), s); - - retry_solution: - assert(projected.has_single_conjunct()); - DNF_Iterator one = projected.query_DNF(); - - // Look for candidate EQ's - EQ_Handle stride; - EQ_Iterator ei(*one); - for(; ei; ei++) { - if((*ei).get_coef(vee[current_var]) != 0) { - if(!Constr_Vars_Iter(*ei,true).live()) { // no wildcards - some_constraints = true; - // Add this constraint to the current as an EQ - current.and_with_EQ(*ei); - break; - } - else { - one_stride = !one_stride && !some_constraints; - stride = *ei; - } - } - } - if(ei) - continue; // Found an EQ, skip to next variable - else if (one_stride && !some_constraints) { - // if unconstrained except for a stride, pick stride as value - Constr_Vars_Iter cvi(stride,true); - assert(cvi.live()); - cvi++; - if(!cvi) { // Just one existentially quantified variable - Relation current_copy = current; - EQ_Handle eh = current_copy.and_with_EQ(); - for(Constr_Vars_Iter si = stride; si; si++) - if((*si).var->kind() != Wildcard_Var){ - // pick "0" for wildcard, don't set its coef - eh.update_coef((*si).var, (*si).coef); - } - eh.update_const(stride.get_const()); - if(current_copy.is_upper_bound_satisfiable()){ - current = current_copy; - continue; // skip to next var - } - } - some_constraints = true; // count the stride as a constraint - } - - // Can we convert a GEQ? - GEQ_Iterator gi(*one); - for(; gi; gi++) { - if((*gi).get_coef(vee[current_var]) != 0) { - some_constraints = true; - if(!Constr_Vars_Iter(*gi,true).live()) { // no wildcards - Relation current_copy = current; - // Add this constraint to the current as an EQ & test - current_copy.and_with_EQ(*gi); - if (current_copy.is_upper_bound_satisfiable()) { - current = current_copy; - break; - } - } - } - } - if (gi) continue; // Turned a GEQ into EQ, skip to next - - // Remove wildcards, try try again - Relation approx = Approximate(copy(projected)); - assert(approx.has_single_conjunct()); - DNF_Iterator d2 = approx.query_DNF(); - - EQ_Iterator ei2(*d2); - for(; ei2; ei2++) { - if((*ei2).get_coef(vee[current_var]) != 0) { - some_constraints = true; - assert(!Constr_Vars_Iter(*ei2,true).live()); // no wildcards - Relation current_copy = current; - // Add this constraint to the current as an EQ & test - current_copy.and_with_EQ(*ei2); - if (current_copy.is_upper_bound_satisfiable()) { - current = current_copy; - break; - } - } - } - if(ei2) continue; // Found an EQ, skip to next variable - - GEQ_Iterator gi2(*d2); - for(; gi2; gi2++) { - if((*gi2).get_coef(vee[current_var]) != 0) { - some_constraints = true; - assert(!Constr_Vars_Iter(*gi2,true).live()); // no wildcards - Relation current_copy = current; - // Add this constraint to the current as an EQ & test - current_copy.and_with_EQ(*gi2); - if (current_copy.is_upper_bound_satisfiable()) { - current = current_copy; - break; - } - } - } - if(gi2) continue; - - if(!some_constraints) { // No constraints on this variable were found - EQ_Handle e = current.and_with_EQ(); - e.update_const(-42); // Be creative - e.update_coef(vee[current_var], 1); - continue; - } - else { // What to do? Find a wildcard to discard - Variable_ID wild = NULL; - - for (GEQ_Iterator gi(*one); gi; gi++) - if ((*gi).get_coef(vee[current_var]) != 0 && (*gi).has_wildcards()) { - Constr_Vars_Iter cvi(*gi, true); - wild = (*cvi).var; - break; - } - if (wild == NULL) - for (EQ_Iterator ei(*one); ei; ei++) - if ((*ei).get_coef(vee[current_var]) != 0 && (*ei).has_wildcards()) { - Constr_Vars_Iter cvi(*ei, true); - wild = (*cvi).var; - break; - } - - if (wild != NULL) { - // skip_set_checks++; - - Relation R2; - { - Tuple r(1); - r[1] = projected; - Tuple > > mapping(1); - mapping[1][wild] = std::make_pair(vee[current_var]->kind(), vee[current_var]->get_position()); - mapping[1][vee[current_var]] = std::make_pair(Exists_Var, 1); - Tuple inverse(1); - inverse[1] = false; - R2 = merge_rels(r, mapping, inverse, Comb_And); - } - - Variable_ID R2_v; - switch (vee[current_var]->kind()) { - // case Set_Var: - case Input_Var: { - int pos = vee[current_var]->get_position(); - R2_v = R2.input_var(pos); - break; - } - case Output_Var: { - int pos = vee[current_var]->get_position(); - R2_v = R2.output_var(pos); - break; - } - case Global_Var: { - Global_Var_ID g = vee[current_var]->get_global_var(); - if (g->arity() == 0) - R2_v = R2.get_local(g); - else - R2_v = R2.get_local(g, vee[current_var]->function_of()); - } - default: - assert(0); - } - - Relation S2; - { - Tuple vee; - vee.append(R2_v); - S2 = Solution(R2, vee); - } - - Variable_ID S2_v; - switch (vee[current_var]->kind()) { - // case Set_Var: - case Input_Var: { - int pos = vee[current_var]->get_position(); - S2_v = S2.input_var(pos); - break; - } - case Output_Var: { - int pos = vee[current_var]->get_position(); - S2_v = S2.output_var(pos); - break; - } - case Global_Var: { - Global_Var_ID g = vee[current_var]->get_global_var(); - if (g->arity() == 0) - S2_v = S2.get_local(g); - else - S2_v = S2.get_local(g, vee[current_var]->function_of()); - } - default: - assert(0); - } - - Relation R3; - { - Tuple r(2); - r[1] = projected; - r[2] = S2; - Tuple > > mapping(2); - mapping[1][wild] = std::make_pair(Exists_Var, 1); - mapping[2][S2_v] = std::make_pair(Exists_Var, 1); - Tuple inverse(2); - inverse[1] = inverse[2] = false; - R3 = merge_rels(r, mapping, inverse, Comb_And); - } - - // skip_set_checks--; - - if (R3.is_upper_bound_satisfiable()) { - projected = R3; - goto retry_solution; - } - } - } - - // If we get here, we failed to find a suitable constraint for - // this variable at this conjunct, look for another conjunct. - break; - } - - if (i < 0) { // solution found - if(inexactAnswer) - current.and_with_and()->add_unknown(); - current.finalize(); - return current; - } - } - - // No solution found for any conjunct, we bail out. - fprintf(stderr,"Couldn't find suitable constraint for variable\n"); - return Relation::Unknown(R); -} - - -Relation Approximate(NOT_CONST Relation &input_R, bool strides_allowed) { - Relation R = consume_and_regurgitate(input_R); - if (R.is_null()) - return R; - - // assert(!R.is_null()); - Rel_Body *r = R.split(); - - // approximate can be used to remove lambda variables from farkas, - // so be careful not to invoke simplification process for integers. - r->simplify(-1,-1); - - if (pres_debug) { - fprintf(DebugFile,"Computing approximation "); - if (strides_allowed) fprintf(DebugFile,"with strides allowed "); - fprintf(DebugFile,"[ \n"); - r->prefix_print(DebugFile); - } - - use_ugly_names++; - for (DNF_Iterator pd(r->simplified_DNF); pd.live(); ) { - Conjunct *C = pd.curr(); - pd.next(); - - for(int i = 0; i < C->problem->nGEQs; i++) - C->problem->GEQs[i].touched = 1; - - C->reorder(); - if(C->problem->simplifyApproximate(strides_allowed)==0) { - r->simplified_DNF->rm_conjunct(C); - delete C; - } - else { - C->simplifyProblem(1,0,1); - - free_var_decls(C->myLocals); C->myLocals.clear(); - - Problem *p = C->problem; - Variable_ID_Tuple new_mapped(0); // This is expanded by "append" - for (int i = 1; i <= p->safeVars; i++) { - // what is now in column i used to be in column p->var[i] - Variable_ID v = C->mappedVars[p->var[i]]; - assert (v->kind() != Wildcard_Var); - new_mapped.append(v); - } - assert(strides_allowed || C->problem->nVars == C->problem->safeVars); - C->mappedVars = new_mapped; - for (int i = p->safeVars+1; i <= p->nVars; i++) { - Variable_ID v = C->declare(); - C->mappedVars.append(v); - } - - - // reset var and forwarding address if desired. - p->variablesInitialized = 0; - for(int i = 1; i < C->problem->nVars; i++) - C->problem->var[i] = C->problem->forwardingAddress[i] = i; - } - } - - if (pres_debug) - fprintf(DebugFile,"] done Computing approximation\n"); - use_ugly_names--; - return R; -} - - -Relation Lower_Bound(NOT_CONST Relation &r) { - Relation s = consume_and_regurgitate(r); - s.interpret_unknown_as_false(); - return s; -} - - -Relation Upper_Bound(NOT_CONST Relation &r) { - Relation s = consume_and_regurgitate(r); - s.interpret_unknown_as_true(); - return s; -} - - -bool operator==(const Relation &, const Relation &) { - assert(0 && "You rilly, rilly don't want to do this.\n"); - abort(); - return false; -} - - -namespace { // supporting stuff for MapRel1 and MapAndCombine2 - // Determine if a mapping requires an f_exists node - bool has_existentials(const Mapping &m) { - for(int i=1;i<=m.n_in(); i++) - if (m.get_map_in_kind(i) == Exists_Var) return true; - for(int j=1;j<=m.n_out(); j++) - if (m.get_map_out_kind(j) == Exists_Var) return true; - return false; - } - - void get_relation_arity_from_one_mapping(const Mapping &m1, - int &in_req, int &out_req) { - int j, i; - in_req = 0; out_req = 0; - for(i = 1; i <= m1.n_in(); i++) { - j = m1.get_map_in_pos(i); - switch(m1.get_map_in_kind(i)) { - case Input_Var: in_req = max(in_req, j); break; - // case Set_Var: in_req = max(in_req, j); break; - case Output_Var: out_req = max(out_req, j); break; - default: break; - } - } - for(i = 1; i <= m1.n_out(); i++) { - j = m1.get_map_out_pos(i); - switch(m1.get_map_out_kind(i)) { - case Input_Var: in_req = max(in_req, j); break; - // case Set_Var: in_req = max(in_req, j); break; - case Output_Var: out_req = max(out_req, j); break; - default: break; - } - } - } - - // Scan mappings to see how many input and output variables they require. - void get_relation_arity_from_mappings(const Mapping &m1, - const Mapping &m2, - int &in_req, int &out_req) { - int inreq1, inreq2, outreq1, outreq2; - get_relation_arity_from_one_mapping(m1, inreq1, outreq1); - get_relation_arity_from_one_mapping(m2, inreq2, outreq2); - in_req = max(inreq1, inreq2); - out_req = max(outreq1, outreq2); - } -} - - -// -// Build lists of variables that need to be replaced in the given -// Formula. Declare globals in new relation. Then call -// map_vars to do the replacements. -// -// Obnoxiously many arguments here: -// Relation arguments contain declarations of symbolic and in/out vars. -// F_Exists argument is where needed existentially quant. vars can be decl. -// -// Mapping specifies how in/out vars are mapped -// Two lists are required to be able to map in/out variables from the first -// and second relations to the same existentially quantified variable. -// -void align(Rel_Body *originalr, Rel_Body *newr, F_Exists *fe, - Formula *f, const Mapping &mapping, bool &newrIsSet, - List &seen_exists, Variable_ID_Tuple &seen_exists_ids) { - int i, cur_ex = 0; // initialize cur_ex to shut up the compiler - - f->set_relation(newr); // Might not need to do this anymore, if bugs were fixed - int input_remapped = 0; - int output_remapped = 0; - int sym_remapped = 0; - // skip_set_checks++; - - Variable_ID new_var; - Const_String new_name; - int new_pos; - - // MAP old input variables by setting their remap fields - for(i = 1; i <= originalr->n_inp(); i++) { - Variable_ID this_var = originalr->input_var(i), New_E; - Const_String this_name = originalr->In_Names[i]; - - switch (mapping.get_map_in_kind(i)) { - case Input_Var: - // case Set_Var: - // if (mapping.get_map_in_kind(i) == Set_Var) - // newrIsSet = true; // Don't mark it just yet; we still need to - // // refer to its "input" vars internally - - // assert((newrIsSet && mapping.get_map_in_kind(i) == Set_Var) - // || ((!newrIsSet &&mapping.get_map_in_kind(i) == Input_Var))); - - new_pos = mapping.get_map_in_pos(i); - new_var = newr->input_var(new_pos); - if (this_var != new_var) { - input_remapped = 1; - this_var->remap = new_var; - } - new_name = newr->In_Names[new_pos]; - if (!this_name.null()) { // should we name this? - if (!new_name.null()) { // already named, anonymize - if (new_name != this_name) - newr->name_input_var(new_pos, Const_String()); - } - else - newr->name_input_var(new_pos, this_name); - } - break; - case Output_Var: - assert(!newr->is_set()); - input_remapped = 1; - new_pos = mapping.get_map_in_pos(i); - this_var->remap = new_var = newr->output_var(new_pos); - new_name = newr->Out_Names[new_pos]; - if (!this_name.null()) { - if (!new_name.null()) { // already named, anonymize - if (new_name != this_name) - newr->name_output_var(new_pos, Const_String()); - } - else - newr->name_output_var(new_pos, this_name); - } - break; - case Exists_Var: - input_remapped = 1; - // check if we have declared it, use that if so. - // create it if not. - if (mapping.get_map_in_pos(i) <= 0 || - (cur_ex = seen_exists.index(mapping.get_map_in_pos(i))) == 0){ - if (!this_name.null()) - New_E = fe->declare(this_name); - else - New_E = fe->declare(); - this_var->remap = New_E; - if (mapping.get_map_in_pos(i) > 0) { - seen_exists.append(mapping.get_map_in_pos(i)); - seen_exists_ids.append(New_E); - } - } - else { - this_var->remap = new_var = seen_exists_ids[cur_ex]; - if (!this_name.null()) { // Have we already assigned a name? - if (!new_var->base_name.null()) { - if (new_var->base_name != this_name) - new_var->base_name = Const_String(); - } - else { - new_var->base_name = this_name; - assert(!this_name.null()); - } - } - } - break; - default: - assert(0 && "Unsupported var type in MapRel2"); - break; - } - } - - // MAP old output variables. - for(i = 1; i <= originalr->n_out(); i++) { - Variable_ID this_var = originalr->output_var(i), New_E; - Const_String this_name = originalr->Out_Names[i]; - - switch (mapping.get_map_out_kind(i)) { - case Input_Var: - // case Set_Var: - // if (mapping.get_map_out_kind(i) == Set_Var) - // newrIsSet = true; // Don't mark it just yet; we still need to refer to its "input" vars internally - - // assert((newrIsSet && mapping.get_map_out_kind(i) == Set_Var) - // ||((!newrIsSet &&mapping.get_map_out_kind(i) == Input_Var))); - - output_remapped = 1; - new_pos = mapping.get_map_out_pos(i); - this_var->remap = new_var = newr->input_var(new_pos); - new_name = newr->In_Names[new_pos]; - if (!this_name.null()) { - if (!new_name.null()) { // already named, anonymize - if (new_name != this_name) - newr->name_input_var(new_pos, Const_String()); - } - else - newr->name_input_var(new_pos, this_name); - } - break; - case Output_Var: - assert(!newr->is_set()); - new_pos = mapping.get_map_out_pos(i); - new_var = newr->output_var(new_pos); - if (new_var != this_var) { - output_remapped = 1; - this_var->remap = new_var; - } - new_name = newr->Out_Names[new_pos]; - if (!this_name.null()) { - if (!new_name.null()) { // already named, anonymize - if (new_name != this_name) - newr->name_output_var(new_pos, Const_String()); - } - else - newr->name_output_var(new_pos, this_name); - } - break; - case Exists_Var: - // check if we have declared it, create it if not. - output_remapped = 1; - if (mapping.get_map_out_pos(i) <= 0 || - (cur_ex = seen_exists.index(mapping.get_map_out_pos(i))) == 0) { // Declare it. - New_E = fe->declare(this_name); - this_var->remap = New_E; - if (mapping.get_map_out_pos(i) > 0) { - seen_exists.append(mapping.get_map_out_pos(i)); - seen_exists_ids.append(New_E); - } - } - else { - this_var->remap = new_var = seen_exists_ids[cur_ex]; - if (!this_name.null()) { - if (!new_var->base_name.null()) { - if (new_var->base_name != this_name) - new_var->base_name = Const_String(); - } - else { - new_var->base_name = this_name; - } - } - } - break; - default: - assert(0 &&"Unsupported var type in MapRel2"); - break; - } - } - - Variable_ID_Tuple *oldSym = originalr->global_decls(); - for(i=1; i<=(*oldSym).size(); i++) { - Variable_ID v = (*oldSym)[i]; - assert(v->kind()==Global_Var); - if (v->get_global_var()->arity() > 0) { - Argument_Tuple new_of = v->function_of(); - if (!leave_pufs_untouched) - new_of = mapping.get_tuple_fate(new_of, v->get_global_var()->arity()); - if (new_of == Unknown_Tuple) { - // hopefully v is not really used - // if we get here, f should have been in DNF, - // now an OR node with conjuncts below - // we just need to check that no conjunct uses v -#if ! defined NDEBUG - if (f->node_type() == Op_Conjunct) { - assert(f->really_conjunct()->mappedVars.index(v)==0 - && "v unused"); - } -#if 0 - else { - // assert(f->node_type() == Op_Or); - for (List_Iterator conj(f->children()); conj; conj++) { - assert((*conj)->really_conjunct()->mappedVars.index(v)==0 - && "v unused"); - } - } -#endif -#endif - // since its not really used, don't bother adding it to - // the the global_vars list of the new relation - continue; - } - if (v->function_of() != new_of) { - Variable_ID new_v=newr->get_local(v->get_global_var(),new_of); - assert(v != new_v); - v->remap = new_v; - sym_remapped = 1; - } - else { - // add symbolic to symbolic list -#if ! defined NDEBUG - Variable_ID new_v = -#endif - newr->get_local(v->get_global_var(), v->function_of()); -#if ! defined NDEBUG - assert(v == new_v); -#endif - } - } - else { - // add symbolic to symbolic list -#if ! defined NDEBUG - Variable_ID new_v = -#endif - newr->get_local(v->get_global_var()); -#if ! defined NDEBUG - assert(v == new_v); -#endif - } - } - - if (sym_remapped || input_remapped || output_remapped) { - f->remap(); - - // If 2 vars mapped to same variable, combine them - //There's a column to combine only when there are two equal remap fields. - Tuple vt(0); - bool combine = false; - Tuple_Iterator t(input_vars); - for(i=1; !combine && i<=originalr->n_inp(); t++, i++) - if (vt.index((*t)->remap)) - combine = true; - else - vt.append((*t)->remap); - Tuple_Iterator t2(output_vars); - for(i=1; !combine && i <= originalr->n_out(); t2++, i++) - if (vt.index((*t2)->remap)) - combine = true; - else - vt.append((*t2)->remap); - if (combine) f->combine_columns(); - - if (sym_remapped) - reset_remap_field(originalr->Symbolic); - if (input_remapped) - reset_remap_field(input_vars,originalr->n_inp()); - if (output_remapped) - reset_remap_field(output_vars,originalr->n_out()); - } - - // skip_set_checks--; - -#ifndef NDEBUG - if (fe) - foreach(v,Variable_ID,fe->myLocals,assert(v == v->remap)); -#endif -} - - -// MapRel1, MapAndCombineRel2 can be replaced by merge_rels -void MapRel1(Relation &R, const Mapping &map, Combine_Type ctype, - int number_input, int number_output, - bool invalidate_resulting_leading_info, - bool finalize) { -#if defined(INCLUDE_COMPRESSION) - assert(!R.is_compressed()); -#endif - assert(!R.is_null()); - - Relation inputRel = R; - R = Relation(); - Rel_Body *inputRelBody = inputRel.split(); - - int in_req=0, out_req=0; - get_relation_arity_from_one_mapping(map, in_req, out_req); - - R = Relation(number_input == -1 ? in_req : number_input, - number_output == -1 ? out_req : number_output); - - Rel_Body *outputRelBody = R.split(); - - inputRelBody->DNF_to_formula(); - Formula *f1 = inputRelBody->rm_formula(); - - F_Exists *fe; - Formula *f; - if (has_existentials(map)) { - f = fe = outputRelBody->add_exists(); - } - else { - fe = NULL; - f = outputRelBody; - } - and_below_exists = NULL; - if (finalize) and_below_exists = NULL; - else f = and_below_exists = f->add_and(); - if(ctype == Comb_AndNot) { - f = f->add_not(); - } - f->add_child(f1); - - exists_ids.clear(); - exists_numbers.clear(); - - bool returnAsSet=false; - align(inputRelBody, outputRelBody, fe, f1, map, returnAsSet, - exists_numbers, exists_ids); - - if (returnAsSet || - (inputRelBody->is_set() && outputRelBody->n_out() == 0)) { - R.markAsSet(); - R.invalidate_leading_info(); // nonsensical for a set - } - - if (finalize) R.finalize(); - inputRel = Relation(); - if (invalidate_resulting_leading_info) - R.invalidate_leading_info(); -} - - -Relation MapAndCombineRel2(Relation &R1, Relation &R2, const Mapping &mapping1, - const Mapping &mapping2, Combine_Type ctype, - int number_input, int number_output) { -#if defined(INCLUDE_COMPRESSION) - assert(!R1.is_compressed()); - assert(!R2.is_compressed()); -#endif - assert(!R1.is_null() && !R2.is_null()); - Rel_Body *r1 = R1.split(); - Rel_Body *r2 = R2.split(); - - int in_req, out_req; // Create the new relation - get_relation_arity_from_mappings(mapping1, mapping2, in_req, out_req); - Relation R3(number_input == -1 ? in_req : number_input, - number_output == -1 ? out_req : number_output); - Rel_Body *r3 = R3.split(); // This is just to get the pointer, it's cheap - - /* permit the add_{exists,and} below, reset after they are done.*/ - skip_finalization_check++; - - F_Exists *fe = NULL; - Formula *f; - if (has_existentials(mapping1) || has_existentials(mapping2)) { - fe = r3->add_exists(); - f = fe; - } - else { - f = r3; - } - - r1->DNF_to_formula(); - Formula *f1 = r1->rm_formula(); - r2->DNF_to_formula(); - Formula *f2 = r2->rm_formula(); - - // align: change r1 vars to r3 vars in formula f1 via map mapping1, - // declaring needed exists vars in F_Exists *fe - // Also maps symbolic variables appropriately, sets relation ptrs in f1. - // In order to map variables of both relations to the same variables, - // we keep a list of new existentially quantified vars between calls. - // returnAsSet means mark r3 as set before return. Don't mark it yet, - // because internally we need to refer to "input_vars" of a set, and that - // would blow assertions. - - bool returnAsSet=false; - exists_ids.clear(); - exists_numbers.clear(); - align(r1, r3, fe, f1, mapping1, returnAsSet, exists_numbers, exists_ids); - // align: change r2 vars to r3 vars in formula f2 via map mapping2 - align(r2, r3, fe, f2, mapping2, returnAsSet, exists_numbers, exists_ids); - - switch (ctype) { - case Comb_Or: - if(f1->node_type() == Op_Or) { - f->add_child(f1); - f = f1; - } - else { - f = f->add_or(); - f->add_child(f1); - } - break; - case Comb_And: - case Comb_AndNot: - if(f1->node_type() == Op_And) { - f->add_child(f1); - f = f1; - } - else { - f = f->add_and(); - f->add_child(f1); - } - break; - default: - assert(0 && "Invalid combine type in MapAndCombineRel2"); - } - - Formula *c2; - if (ctype==Comb_AndNot) { - c2 = f->add_not(); - } - else { - c2 = f; - } - c2->add_child(f2); - - skip_finalization_check--; /* Set this back for return */ - R3.finalize(); - - if (returnAsSet || - (R1.is_set() && R2.is_set() && R3.n_inp() >= 0 && R3.n_out() == 0)){ - R3.markAsSet(); - R3.invalidate_leading_info(); - } - R1 = Relation(); - R2 = Relation(); - return R3; -} - - -// -// Scramble each relation's variables and merge these relations -// together. Support variable mapping to and from existentials. -// Unspecified variables in mapping are mapped to themselves by -// default. It intends to replace MapRel1 and MapAndCombineRel2 -// functions (the time saved by grafting formula tree might be -// neglegible when compared to the simplification cost). -// -Relation merge_rels(Tuple &R, const Tuple > > &mapping, const Tuple &inverse, Combine_Type ctype, int number_input, int number_output) { - const int m = R.size(); - assert(mapping.size() == m && inverse.size() == m); - // skip_set_checks++; - - // if new relation's arity is not given, calculate it on demand - if (number_input == -1) { - number_input = 0; - for (int i = 1; i <= m; i++) { - for (int j = R[i].n_inp(); j >= 1; j--) { - Variable_ID v = R[i].input_var(j); - std::map >::const_iterator p = mapping[i].find(v); - if (p == mapping[i].end()) { - number_input = j; - break; - } - } - - for (std::map >::const_iterator j = mapping[i].begin(); j != mapping[i].end(); j++) { - if ((*j).second.first == Input_Var || (*j).second.first == Set_Var) - number_input = max(number_input, (*j).second.second); - } - } - } - - if (number_output == -1) { - number_output = 0; - for (int i = 1; i <= m; i++) { - for (int j = R[i].n_out(); j >= 1; j--) { - Variable_ID v = R[i].output_var(j); - std::map >::const_iterator p = mapping[i].find(v); - if (p == mapping[i].end()) { - number_output = j; - break; - } - } - for (std::map >::const_iterator j = mapping[i].begin(); j != mapping[i].end(); j++) { - if ((*j).second.first == Output_Var) - number_output = max(number_output, (*j).second.second); - } - } - } - - Relation R2(number_input, number_output); - F_Exists *fe = R2.add_exists(); - Formula *f_root; - switch (ctype) { - case Comb_And: - f_root = fe->add_and(); - break; - case Comb_Or: - f_root = fe->add_or(); - break; - default: - assert(0); // unsupported merge type - } - - std::map seen_exists_by_num; - std::map seen_exists_by_id; - - for (int i = 1; i <= m; i++) { - F_Or *fo; - if (inverse[i]) - fo = f_root->add_not()->add_or(); - else - fo = f_root->add_or(); - - for (DNF_Iterator di(R[i].query_DNF()); di; di++) { - F_And *f = fo->add_and(); - - for (GEQ_Iterator gi(*di); gi; gi++) { - GEQ_Handle h = f->add_GEQ(); - for (Constr_Vars_Iter cvi(*gi); cvi; cvi++) { - Variable_ID v = cvi.curr_var(); - std::map >::const_iterator p = mapping[i].find(v); - if (p == mapping[i].end()) { - switch (v->kind()) { - // case Set_Var: - case Input_Var: { - int pos = v->get_position(); - h.update_coef(R2.input_var(pos), cvi.curr_coef()); - break; - } - case Output_Var: { - int pos = v->get_position(); - h.update_coef(R2.output_var(pos), cvi.curr_coef()); - break; - } - case Exists_Var: - case Wildcard_Var: { - std::map::iterator p2 = seen_exists_by_id.find(cvi.curr_var()); - Variable_ID e; - if (p2 == seen_exists_by_id.end()) { - e = fe->declare(); - seen_exists_by_id[cvi.curr_var()] = e; - } - else - e = (*p2).second; - h.update_coef(e, cvi.curr_coef()); - break; - } - case Global_Var: { - Global_Var_ID g = v->get_global_var(); - Variable_ID v2; - if (g->arity() == 0) - v2 = R2.get_local(g); - else - v2 = R2.get_local(g, v->function_of()); - h.update_coef(v2, cvi.curr_coef()); - break; - } - default: - assert(0); // shouldn't happen if input relations are simplified - } - } - else { - switch ((*p).second.first) { - // case Set_Var: - case Input_Var: { - int pos = (*p).second.second; - h.update_coef(R2.input_var(pos), cvi.curr_coef()); - break; - } - case Output_Var: { - int pos = (*p).second.second; - h.update_coef(R2.output_var(pos), cvi.curr_coef()); - break; - } - case Exists_Var: - case Wildcard_Var: { - int pos = (*p).second.second; - std::map::iterator p2 = seen_exists_by_num.find(pos); - Variable_ID e; - if (p2 == seen_exists_by_num.end()) { - e = fe->declare(); - seen_exists_by_num[pos] = e; - } - else - e = (*p2).second; - h.update_coef(e, cvi.curr_coef()); - break; - } - default: - assert(0); // mapped to unsupported variable type - } - } - } - h.update_const((*gi).get_const()); - } - - for (EQ_Iterator ei(*di); ei; ei++) { - EQ_Handle h = f->add_EQ(); - for (Constr_Vars_Iter cvi(*ei); cvi; cvi++) { - Variable_ID v = cvi.curr_var(); - std::map >::const_iterator p = mapping[i].find(v); - if (p == mapping[i].end()) { - switch (v->kind()) { - // case Set_Var: - case Input_Var: { - int pos = v->get_position(); - h.update_coef(R2.input_var(pos), cvi.curr_coef()); - break; - } - case Output_Var: { - int pos = v->get_position(); - h.update_coef(R2.output_var(pos), cvi.curr_coef()); - break; - } - case Exists_Var: - case Wildcard_Var: { - std::map::iterator p2 = seen_exists_by_id.find(v); - Variable_ID e; - if (p2 == seen_exists_by_id.end()) { - e = fe->declare(); - seen_exists_by_id[v] = e; - } - else - e = (*p2).second; - h.update_coef(e, cvi.curr_coef()); - break; - } - case Global_Var: { - Global_Var_ID g = v->get_global_var(); - Variable_ID v2; - if (g->arity() == 0) - v2 = R2.get_local(g); - else - v2 = R2.get_local(g, v->function_of()); - h.update_coef(v2, cvi.curr_coef()); - break; - } - default: - assert(0); // shouldn't happen if input relations are simplified - } - } - else { - switch ((*p).second.first) { - // case Set_Var: - case Input_Var: { - int pos = (*p).second.second; - h.update_coef(R2.input_var(pos), cvi.curr_coef()); - break; - } - case Output_Var: { - int pos = (*p).second.second; - h.update_coef(R2.output_var(pos), cvi.curr_coef()); - break; - } - case Exists_Var: - case Wildcard_Var: { - int pos = (*p).second.second; - std::map::iterator p2 = seen_exists_by_num.find(pos); - Variable_ID e; - if (p2 == seen_exists_by_num.end()) { - e = fe->declare(); - seen_exists_by_num[pos] = e; - } - else - e = (*p2).second; - h.update_coef(e, cvi.curr_coef()); - break; - } - default: - assert(0); // mapped to unsupported variable type - } - } - } - h.update_const((*ei).get_const()); - } - } - } - - // skip_set_checks--; - - if (number_output == 0) { - R2.markAsSet(); - // R2.invalidate_leading_info(); - } - - return R2; -} - -} // namespace diff --git a/omega/omega_lib/src/closure.cc b/omega/omega_lib/src/closure.cc deleted file mode 100644 index 416a3e7..0000000 --- a/omega/omega_lib/src/closure.cc +++ /dev/null @@ -1,2100 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 the Omega Project Team - Copyright (C) 2005-2011 Chun Chen - Copyright (C) 2009-2011 West Pomeranian University of Technology, Szczecin - All Rights Reserved. - - Purpose: - All calculations of closure are now here. - - Notes: - Related paper: - - "Transitive closure of infinite graphs and its applications", - Wayne Kelly, William Pugh, Evan Rosser and Tatiana Shpeisman, IJPP 1996. - - "Computing the Transitive Closure of a Union of Affine Integer Tuple - Relations", Anna Beletska, Denis Barthou, Wlodzimierz Bielecki and - Albert Cohen, COCOA 2009. - - "An Iterative Algorithm of Computing the Transitive Closure of a Union - of Parameterized Affine Integer Tuple Relations", Bielecki Wlodzimierz, - Klimek Tomasz, Palkowski Marek and Anna Beletska, COCOA 2010. - - History: - 12/27/09 move ConicClosure here, Chun Chen - 01/19/11 new closure algorithms, Klimek Tomzsz - 02/02/11 move VennDiagramFrom here, Chun Chen -*****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include - -namespace omega { - -void InvestigateClosure(Relation r, Relation r_closure, Relation bounds); -void print_given_bounds(const Relation & R1, NOT_CONST Relation& input_Bounds); -#define printConjunctClosure (closure_presburger_debug & 0x1) -#define detailedClosureDebug (closure_presburger_debug & 0x2) - - -#ifdef TC_STATS -extern int clock_diff(); -extern void start_clock(); -FILE *statsfile; -int singles, totals=0; -#endif - -int closure_presburger_debug = 0; - - -Relation VennDiagramForm(NOT_CONST Relation &Context_In, - Tuple &Rs, - int next, - bool anyPositives, - int weight) { - Relation Context = consume_and_regurgitate(Context_In); - if (hull_debug) { - fprintf(DebugFile,"[VennDiagramForm, next = %d, anyPositives = %d, weight = %d \n", next,anyPositives,weight); - fprintf(DebugFile,"context:\n"); - Context.prefix_print(DebugFile); - } - if (anyPositives && weight > 3) { - Context.simplify(); - if (!Context.is_upper_bound_satisfiable()) { - if (hull_debug) - fprintf(DebugFile,"] not satisfiable\n"); - return Context; - } - weight = 0; - } - if (next > Rs.size()) { - if (!anyPositives) { - if (hull_debug) - fprintf(DebugFile,"] no positives\n"); - return Relation::False(Context); - } - Context.simplify(); - if (hull_debug) { - fprintf(DebugFile,"] answer is:\n"); - Context.prefix_print(DebugFile); - } - return Context; - } - Relation Pos = VennDiagramForm(Intersection(copy(Context),copy(Rs[next])), - Rs, - next+1, - true, - weight+2); - Relation Neg = VennDiagramForm(Difference(Context,copy(Rs[next])), - Rs, - next+1, - anyPositives, - weight+1); - if (hull_debug) { - fprintf(DebugFile,"] VennDiagramForm\n"); - fprintf(DebugFile,"pos part:\n"); - Pos.prefix_print(DebugFile); - fprintf(DebugFile,"neg part:\n"); - Neg.prefix_print(DebugFile); - } - return Union(Pos,Neg); -} - - -Relation VennDiagramForm(Tuple &Rs, NOT_CONST Relation &Context_In) { - Relation Context = consume_and_regurgitate(Context_In); - if (Context.is_null()) Context = Relation::True(Rs[1]); - if (hull_debug) { - fprintf(DebugFile,"Starting computation of VennDiagramForm\n"); - fprintf(DebugFile,"Context:\n"); - Context.prefix_print(DebugFile); - for(int i = 1; i <= Rs.size(); i++) { - fprintf(DebugFile,"#%d:\n",i); - Rs[i].prefix_print(DebugFile); - } - } - return VennDiagramForm(Context,Rs,1,false,0); -} - -Relation VennDiagramForm(NOT_CONST Relation &R_In, NOT_CONST Relation &Context_In) { - Relation R = consume_and_regurgitate(R_In); - Relation Context = consume_and_regurgitate(Context_In); - Tuple Rs; - for (DNF_Iterator c(R.query_DNF()); c.live(); ) { - Rs.append(Relation(R,c.curr())); - c.next(); - } - return VennDiagramForm(Rs,Context); -} - - -Relation ConicClosure (NOT_CONST Relation &R) { - int n = R.n_inp(); - if (n != R.n_out()) - throw std::invalid_argument("conic closure must have the same input arity and output arity"); - - return DeltasToRelation(ConicHull(Deltas(R)), n, n); -} - - -bool is_lex_forward(Relation R) { - if(R.n_inp() != R.n_out()) { - fprintf(stderr, "relation has wrong inputs/outpts\n"); - exit(1); - } - Relation forw(R.n_inp(), R.n_out()); - F_Or * o = forw.add_or(); - for(int a = 1; a <= forw.n_inp(); a++) { - F_And * andd = o->add_and(); - GEQ_Handle g = andd->add_GEQ(); - g.update_coef(input_var(a), -1); - g.update_coef(output_var(a), 1); - g.update_const(1); - for(int b = 1; b < a; b++) { - EQ_Handle e = andd->add_EQ(); - e.update_coef(input_var(a),1); - e.update_coef(output_var(a),-1); - } - } - Relation test = Difference(R, forw); - return !test.is_upper_bound_satisfiable(); -} - - -static Relation compose_n(NOT_CONST Relation &input_r, int n) { - Relation r = consume_and_regurgitate(input_r); - if (n == 1) - return r; - else - return Composition(r, compose_n(copy(r), n-1)); -} /* compose_n */ - - - - -Relation approx_closure(NOT_CONST Relation &input_r, int n) { - Relation r = consume_and_regurgitate(input_r); - Relation r_closure; - - r_closure=r; - int i; - for(i=2; i<=n; i++) - r_closure=Union(r_closure,compose_n(copy(r), n)); - r_closure = Union(r_closure, Relation::Unknown(r_closure)); - - return r_closure; -} /* approx_closure */ - - -static bool is_closure_itself(NOT_CONST Relation &r) { - return Must_Be_Subset(Composition(copy(r),copy(r)),copy(r)); -} - - -/***** - * get a D form of the Relation (single conjunct). - * D = {[ i_1,i_2,...,i_m] -> [j_1, j_2, ..., j_m ] : - * (forall p, 1<= p <= m) L_p <= j_p - i_p <= U_p && - * j_p - i_p == M_p alpha_p}; - * Right now only wildcards that are in stride constraints are treated. - *****/ - -Relation get_D_form (Relation & R) { - Relation D(R.n_inp(), R.n_out()); - - R.make_level_carried_to(R.n_inp()); - assert(R.has_single_conjunct()); - int n_zero=0; - for (DNF_Iterator d(R.query_DNF()); d.live(); d.next()) - n_zero=d.curr()->query_guaranteed_leading_0s(); - - Relation Diff=Deltas(copy(R)); - - if (detailedClosureDebug) { - fprintf(DebugFile, "The relation projected onto differencies is:\n"); - Diff.print_with_subs(DebugFile); - } - - - /* now form D */ - - int i; - coef_t l,u; - F_And * N = D.add_and(); - GEQ_Handle g; - for (i=1; i<=Diff.n_set(); i++) { - Diff.query_variable_bounds(Diff.set_var(i), l,u); -/* if (i== n_zero+1 && l==negInfinity) - l=1; */ - if (l!=negInfinity) { - g=N->add_GEQ(); - g.update_coef(D.input_var(i),-1); - g.update_coef(D.output_var(i),1); - g.update_const(-l); - g.finalize(); - } - if (u!=posInfinity) { - g=N->add_GEQ(); - g.update_coef(D.input_var(i),1); - g.update_coef(D.output_var(i),-1); - g.update_const(u); - g.finalize(); - } - } - - /* add all stride constrains if they do exist */ - - Conjunct *c = Diff.single_conjunct(); - - if (c->locals().size()>0) {// there are local variables - // now go through all the equalities - - coef_t coef=0; - int pos=0; - for (EQ_Iterator eq = c->EQs(); eq.live(); eq.next()) { - // constraint is in stride form if it has 2 vars, - // one of which is wildcard. Count number if vars and wildcard vars - int nwild=0,nvar=0; - - for (Constr_Vars_Iter cvi(*eq, false); cvi; cvi++) { - if ((*cvi).var->kind() == Global_Var) - continue; - else if ((*cvi).var->kind() == Wildcard_Var) { - coef=(*cvi).coef; - nwild++; - } - else - pos=(*cvi).var->get_position(); - nvar++; - } - if (nvar==2 && nwild==1) { //stride constraint - EQ_Handle e=N->add_stride(coef); - e.update_coef(D.input_var(pos),-1); - e.update_coef(D.output_var(pos),1); - e.finalize(); - } - } - } // end search of stride constrains - - D.finalize(); - D.simplify(); - return D; -} /* end get_D_form */ - -/**** - * get relation A x A describing a region of domain and range: - * A=Hull(Domain(R), Range(R)) intersection IterationSpace - * returns cross product A x A - ***/ - -Relation form_region(const Relation &R, const Relation& IterationSpace) { - Relation H=Union(Domain(copy(R)), Range(copy(R))); - H.simplify(1,1); - H = EQs_to_GEQs(H); - H=Hull(H); - Relation A=Intersection(H, copy(IterationSpace)); - Relation A1=A; - return Cross_Product(A,A1); -} - -Relation form_region1(const Relation &R, const Relation& IterationSpace) { - Relation Dom=Intersection(Domain(copy(R)), copy(IterationSpace)); - Relation Ran=Intersection(Range(copy(R)), copy(IterationSpace)); - return Cross_Product(Dom,Ran); -} - - -/**** - * Check if we can use D instead of R - * i.e. D intersection (A cross A) is Must_Be_Subset of R - ***/ - -bool isD_OK(Relation &R, Relation &D, Relation &AxA) { - Relation B=Intersection(copy(D), copy(AxA)); - B.simplify(); - - if (detailedClosureDebug) { - fprintf(DebugFile, "Intersection of D and AxA is:\n"); - B.print_with_subs(DebugFile); - } - assert (Must_Be_Subset(copy(R),copy(B))); - - return Must_Be_Subset(B, copy(R)); -} - - - -/**** - * check if the constraint is a stride one. Here we say that an equality - * constraint is a stride constraint if it has exatly one wildcard. - * The function returns number of the wildcards in the constraint. - * So if we know that constraint is from the relation in D form, then - * it cannot have more than 1 wildcard variables, and the result of - * this functions can be treated as bool. - ***/ - -static int is_stride(const EQ_Handle &eq) { - int n=0; - - for (Constr_Vars_Iter cvi(eq,true); cvi; cvi++) - n++; - - return n; -} - - - -/***** - * check if the constraint is in the form i_k' - i_k comp_op c - * return v - the number of the var and the type of the comp_op: - * 1 - >, -1 - <, 0 - not in the right form - * if this is equality constraint in the right form any 1 or -1 can be - * returned - ******/ - -static coef_t is_constraint_in_D_form(Relation &r, const Constraint_Handle &h, int &v) { - v=-1; - coef_t c_out = 0; - for (int i = 1; i <= r.n_inp(); i++) { - coef_t c_in = h.get_coef(r.input_var(i)); - if (c_in) { - if (v!=-1) - return 0; - v=i; - c_out = h.get_coef(r.output_var(i)); - - // special case for modular constraint -- by chun 04/02/2009 - if (h.has_wildcards() && typeid(h) == typeid(EQ_Handle)) { - coef_t g = 0; - for (Constr_Vars_Iter cvi(h, true); cvi; cvi++) - g = gcd(g, abs(cvi.curr_coef())); - c_in = int_mod_hat(c_in, g); - c_out = int_mod_hat(c_out, g); - - if (g == 2) { - if (c_in * c_out == 1) { - c_out = -1; - } - else - return 0; - } - else if (c_in * c_out != -1) - return 0; - } - // other cases - else if (c_in * c_out != -1) - return 0; - } - } - return c_out; -} - - -/*** - * Check if relation is in the D form - * D = {[ i_1,i_2,...,i_m] -> [j_1, j_2, ..., j_m ] : - * (forall p, 1<= p <= m) L_p <= j_p - i_p <= U_p && - * j_p - i_p == M_p alpha_p}; - * Right now we do not check for multiple stride constraints for one var. - * Probably they cannot exist in simplified conjunct - * This function will be used in assertions - *****/ - -bool is_in_D_form(Relation & D) { - /* check that D has one conjunct */ - - if (! D.has_single_conjunct()) - return false; - - Conjunct * c=D.single_conjunct(); - - if (D.global_decls()->size() != 0) // there are symbolic vars - return false; - - if (D.n_inp() != D.n_out()) - return false; - - int n=D.n_inp(); - - Tuple bl(n), bu(n); - - for (int i=1; i<= n; i++) - bl[i]=bu[i]=0; - - int v; - coef_t res; - - for (EQ_Iterator eq = c->EQs(); eq.live(); eq.next()) { - if ((res=is_constraint_in_D_form(D,*eq,v))==0) - return false; - int n_wild=is_stride(*eq); - if (n_wild>=2) - return false; - if (n_wild==0) { // not stride constraint - if (bl[v] || bu[v]) - return false; - bl[v]=bu[v]=1; - } - } - - for (GEQ_Iterator geq = c->GEQs(); geq.live(); geq.next()) { - if ((res=is_constraint_in_D_form(D,*geq,v))==0) - return false; - if ((res>0 && bl[v]) || (res<0 && bu[v])) - return false; - if (res>0) - bl[v]=1; - else - bu[v]=1; - } - - return true; -} - - -#define get_D_plus_form(R) (get_D_closure(R,1)) -#define get_D_star_form(R) (get_D_closure(R,0)) - -/**** - * Get D+ or D* from the relation that is in D form - * To get D+ calculate: - * D+= {[i1, i2 .. i_m] -> {j1, j2, ..., j_m]: - * exists s s.t. s>=1 and - * (forall p, 1<= p <= m) L_p * s<= j_p - i_p <= U_p*s && - * j_p - i_p == M_p alpha_p}; - * To get D* calculate almost the same relation but s>=0. - * Parameter n is 1 for getting D+ and 0 for D* - ****/ - - -Relation get_D_closure(Relation & D, int n) { - assert (is_in_D_form(D)); - assert(n==0 || n==1); - - Conjunct *c=D.single_conjunct(); - - Relation R(D.n_inp(), D.n_out()); - - F_Exists * ex = R.add_exists(); - Variable_ID s = ex->declare("s"); - F_And * N = ex->add_and(); - - /* add s>=1 or s>=0 */ - - GEQ_Handle geq= N->add_GEQ(); - geq.update_coef(s,1); - geq.update_const(-n); - geq.finalize(); - - - /* copy and modify all the EQs */ - - for (EQ_Iterator j= c->EQs(); j.live(); j.next()) { - EQ_Handle eq=N->add_EQ(); - copy_constraint(eq, *j); - - // if it's stride constraint do not change it - - if (!is_stride(*j)) { - /* eq is j_k -i_k = c, replace c buy s*c */ - - eq.update_coef(s, (*j).get_const()); - eq.update_const(-(*j).get_const()); - } - eq.finalize(); - } - - /* copy and modify all the GEQs */ - - for (GEQ_Iterator gi= c->GEQs(); gi.live(); gi.next()) { - geq=N->add_GEQ(); - copy_constraint(geq, *gi); - - /* geq is j_k -i_k >=c or i_k-j_k >=c, replace c buy s*c */ - - geq.update_coef(s,(*gi).get_const()); - geq.update_const(-(*gi).get_const()); - geq.finalize(); - } - - R.finalize(); - - if (detailedClosureDebug) { - fprintf(DebugFile, "Simplified D%c is:\n", n==1?'+':'*'); - R.print_with_subs(DebugFile); - } - - return R; -} - - -/*** - * Check if we can easily calculate the D* (D* will be convex). - * We can calculate D* if all differences have both lower and upper - * bounds to be non -/+ infinity - ***/ - - -bool can_get_D_star_form(Relation &D) { - assert(is_in_D_form(D)); - Conjunct *c=D.single_conjunct(); - - int n=D.n_inp(); - Tuple bl(n), bu(n); - int i; - - for (i=1; i<=n; i++) - bl[i]=bu[i]=0; - - for (EQ_Iterator eq = c->EQs(); eq.live(); eq.next()) { - // do not check stride constraints - if (!is_stride(*eq)) { - for (i=1; i<=n; i++) { - if ((*eq).get_coef(D.input_var(i)) !=0 ) - bl[i]=bu[i]=1; - } - } - } - - - for (GEQ_Iterator geq = c->GEQs(); geq.live(); geq.next()) { - for (i=1; i<=n; i++) { - coef_t k; - if ((k=(*geq).get_coef(D.input_var(i))) != 0) { - if (k>0) - bu[i]=1; - else - bl[i]=1; - } - } - } - - for (i=1; i<=n; i++) - if (!bl[i] || !bu[i]) - return false; - - return true; -} - - - -/***** - * Check whether the relation intersect with identity or not - ****/ - -bool does_intersect_with_identity(Relation &R) { - assert (R.n_inp() == R.n_out()); - - Relation I=Identity(R.n_inp()); - Relation C=Intersection(I, copy(R)); - return C.is_upper_bound_satisfiable(); -} - -bool does_include_identity(Relation &R) { - Relation I=Identity(R.n_inp()); - return Must_Be_Subset(I, copy(R)); -} - -/***** - * Bill's closure: check if it is possible to calculate transitive closure - * of the relation using the Bill's algorithm. - * Return the transitive closure relation if it is possible and null relation - * otherwise - ****/ - -bool Bill_closure(Relation &R, Relation& IterationSpace, Relation & R_plus, Relation & R_star) { -#ifdef TC_STATS - fprintf(statsfile,"start bill closure\n"); -#endif - - if (does_include_identity(R)) - return false; - - if (detailedClosureDebug) { - fprintf(DebugFile, "\nApplying Bill's method to calculate transitive closure\n"); - } - - // get D and AxA - Relation D=get_D_form(R); - - - if (detailedClosureDebug) { - fprintf(DebugFile,"\n D form for the relation:\n"); - D.print_with_subs(DebugFile); - } - - Relation AxA=form_region1(R, IterationSpace); - - if (detailedClosureDebug) { - fprintf(DebugFile, "\n AxA for the relation:\n"); - AxA.print_with_subs(DebugFile); - } - - // compute R_+ - - R_plus=Intersection(get_D_plus_form(D), copy(AxA)); - - if (detailedClosureDebug) { - fprintf(DebugFile, "\nR_+= D+ intersection AxA is:\n"); - R_plus.print_with_subs(DebugFile); - } - - // compute R_* - R_star=Intersection(get_D_star_form(D), form_region(R,IterationSpace)); - - if (detailedClosureDebug) { - fprintf(DebugFile, "\nR_*= D* intersection AxA is:\n"); - R_star.print_with_subs(DebugFile); - } - -/* Check that R_+ is acyclic. - Given the way we constructed R_+, R_+=(R_+)+. - As a result it's enough to verify that R_+ intersection I = 0, - to prove that R_+ is acyclic. -*/ - - if (does_intersect_with_identity(R_plus)) { - if (detailedClosureDebug) { - fprintf(DebugFile,"R_+ is not acyclic.\n"); - } - return false; - } - - //Check R_+ - R is Must_Be_Subset of R o R_+ - - if (!Must_Be_Subset(Difference(copy(R_plus), copy(R)), Composition(copy(R), copy(R_plus)))) { -#if defined(TC_STATS) - fprintf(statsfile, "R_+ -R is not a Must_Be_Subset of R o R_+\n"); - fprintf(statsfile, "Bill Method is not applicable\n"); -#endif - return false; - } - if (detailedClosureDebug) { - fprintf(DebugFile, "R_+ -R is a Must_Be_Subset of R o R_+ - good\n"); - } - -// if we are here than all tests worked, and R_+ is transitive closure -// of R. - -#if defined(TC_STATS) - fprintf(statsfile,"\nAll three tests succeeded -- exact closure found\n"); - fprintf(statsfile, "Transitive closure is R_+\n"); -#endif -// assert(isD_OK(R,D,AxA)); - return true; -} - - -/********************************************************************** - * print the relation given the bounds on the iteration space - * If the bounds are unknown (Bounds is Null), then just print relation - * itself - ****/ - -void print_given_bounds( const Relation& R1, NOT_CONST Relation& input_Bounds) { - Relation & Bounds = (Relation &)input_Bounds; - Relation r; - if (Bounds.is_null()) - r=R1; - else - r = Gist(copy(R1),copy(Bounds),1); - r.print_with_subs(DebugFile); -} - -/********************************************************************** - * Investigate closure: - * checks if the copmuted approximation on the Transitive closure - * is upper and lower bound. If it's both - it's exact. - * This function doesn't return any value. It's just prints a lot - * of debug output - * INPUT: - * r - relation - * r_closure - approximation on r+. - * F - iteration space - **********************************************************************/ - -void InvestigateClosure(Relation r, Relation r_closure, Relation F) { - Relation r3; - bool LB_res, UB_res; - - if (!F.is_null()) - F=Cross_Product(copy(F),copy(F)); - - fprintf(DebugFile, "\n\n--->investigating the closure of the relation:\n"); - print_given_bounds(r,F); - - fprintf(DebugFile, "\nComputed closure is:\n"); - print_given_bounds(r_closure,F); - - r3=Composition(copy(r),copy(r_closure)); - r3.simplify(1,1); - - r3=Union(r3,Composition(copy(r_closure),copy(r))); - r3.simplify(1,1); - - r3=Union(r3,copy(r)); - r3.simplify(1,1); - - Relation remainder = Difference(copy(r3),copy(r_closure)); - - if (!F.is_null()) { - r3=Gist(r3,F,1); - } - r3.simplify(1,1); - - if (!F.is_null()) { - r_closure=Gist(r_closure,F,1); - } - r_closure.simplify(1,1); - - LB_res= Must_Be_Subset(copy(r_closure),copy(r3)); - - UB_res=Must_Be_Subset(copy(r3),copy(r_closure)); - - fprintf(DebugFile,"\nThe results of checking closure (gist) are:\n"); - fprintf(DebugFile,"LB - %s, UB - %s\n", LB_res?"YES":"NO", UB_res?"YES":"NO"); - - if (!UB_res) { - remainder.simplify(2,2); - fprintf(DebugFile,"Dependences not included include:\n"); - print_given_bounds(remainder,F); - } -} - - - -/**** - * Transitive closure of the relation containing single conjunct - ****/ - -bool ConjunctTransitiveClosure (NOT_CONST Relation & input_R, Relation & IterationSpace, Relation & R_plus, Relation & R_star) { - Relation R = consume_and_regurgitate(input_R); - assert(R.has_single_conjunct()); - - if (printConjunctClosure) { - fprintf(DebugFile,"\nTaking closure of the single conjunct: [\n"); - R.print_with_subs(DebugFile); - } -#ifdef TC_STATS - fprintf(statsfile,"start conjuncttransitiveclosure\n"); - singles++; -#endif - - if (is_closure_itself(copy(R))) { -#ifdef TC_STATS - fprintf(statsfile, "Relation is closure itself\n"); -#endif - int ndim_all, ndim_domain; - R.dimensions(ndim_all,ndim_domain); - if (ndim_all == ndim_domain +1) { - Relation ispace = Cross_Product(Domain(copy(R)),Range(copy(R))); - Relation R_zero = Intersection(copy(ispace),Identity(R.n_inp())); - R_star = Hull(Union(copy(R),R_zero),true,1,ispace); - R_plus=R; - if (printConjunctClosure) { - fprintf(DebugFile, "\n] For this relation R+=R\n"); - fprintf(DebugFile,"R*:\n"); - R_star.print_with_subs(DebugFile); - } - return true; - } - else { - R_star=R; - R_plus=R; - if (printConjunctClosure) { - fprintf(DebugFile, "\n] For this relation R+=R, not appropriate for R*\n"); - } - return false; - } - } - else { - bool done=false; - if (!IterationSpace.is_null()) { -// Bill's closure requires the information about Iteration Space. -// So if IterationSpace is NULL, i.e. unknown( e.g. when calling from parser, -// we do not do Bill's closure - - done = Bill_closure(R, IterationSpace, R_plus, R_star); -#ifdef TC_STATS - fprintf(statsfile,"Bill closure is %sapplicable\n",done?"":"not "); -#endif - if (printConjunctClosure) { - if (!done) - fprintf(DebugFile, "Bill's closure is not applicable\n"); - else { - fprintf(DebugFile, "Bill's closure is applicable\n"); - fprintf (DebugFile, " For R:\n"); - R.print_with_subs(DebugFile); - fprintf(DebugFile, "R+ is:\n"); - R_plus.print_with_subs(DebugFile); - fprintf(DebugFile, "R* is:\n"); - R_star.print_with_subs(DebugFile); - fprintf(DebugFile, "\n"); - InvestigateClosure(R, R_plus, IterationSpace); - } - } - } - if (done) { - if (printConjunctClosure) { - fprintf(DebugFile, "]\n"); - } - return true; - } - else { - // do and check approximate closure (several compositions) - R_plus = approx_closure(copy(R), 2); -#ifdef TC_STATS - fprintf(statsfile,"Approximating closure with 2 compositions\n"); -#endif - if (printConjunctClosure) { - fprintf(DebugFile, "Doing approximate closure\n"); - InvestigateClosure(R, R_plus, IterationSpace); - } - } //end else (!done after Bill Closure or Iteration space is NULL) - - if (printConjunctClosure) { - fprintf(DebugFile, "]\n"); - } - } - return false; -} - - -/********************************************************************* - * try to get conjunct transitive closure. - * it we can get it easy get it, return true. - * if not - return false - ********************************************************************/ - - -bool TryConjunctTransitiveClosure (NOT_CONST Relation & input_R, Relation & IterationSpace, Relation & R_plus) { - Relation R = consume_and_regurgitate(input_R); - assert(R.has_single_conjunct()); -#ifdef TC_STATS - fprintf(statsfile,"start tryconjuncttransitiveclosure\n"); - singles++; -#endif - - if (printConjunctClosure) { - fprintf(DebugFile,"\nTrying to take closure of the single conjunct: [\n"); - R.print_with_subs(DebugFile); - } - - if (is_closure_itself(copy(R))) { -#ifdef TC_STATS - fprintf(statsfile, "Relation is closure itself, leave alone (try)\n"); -#endif - if (printConjunctClosure) - fprintf(DebugFile, "\n ]The relation is closure itself. Leave it alone\n"); - return false; - } - else { - bool done; - assert(!IterationSpace.is_null()); - Relation R_star; - done = Bill_closure(R, IterationSpace, R_plus, R_star); -#ifdef TC_STATS - fprintf(statsfile, "Bill closure is %sapplicable (try)\n", done?"":"NOT "); -#endif - if (printConjunctClosure) { - if (!done) - fprintf(DebugFile, "]Bill's closure is not applicable\n"); - else { - fprintf(DebugFile, "]Bill's closure is applicable\n"); - fprintf (DebugFile, " For R:\n"); - R.print_with_subs(DebugFile); - fprintf(DebugFile, "R+ is:\n"); - R_plus.print_with_subs(DebugFile); - fprintf(DebugFile, "R* is:\n"); - R_star.print_with_subs(DebugFile); - fprintf(DebugFile, "\n"); - InvestigateClosure(R, R_plus, IterationSpace); - } - } - return done; - } - //return false; -} - - -bool Equal (const Relation & r1, const Relation & r2) { - bool res=Must_Be_Subset (copy(r1), copy(r2)); - if (!res) - return false; - return Must_Be_Subset (copy(r2),copy(r1)); -} - - -void appendClausesToList(Simple_List &L, Relation &R) { - R.make_level_carried_to(R.n_inp()); - R.simplify(2,2); - for(int depth = R.n_inp(); depth >= -1; depth--) - for (DNF_Iterator d(R.query_DNF()); d.live(); d.next()) - if (d.curr()->query_guaranteed_leading_0s() == depth) { - L.append(Relation(R, d.curr())); - } -} - -void printRelationList(Simple_List &L) { - for (Simple_List_Iterator li(L); li.live(); li.next()) { - li.curr().print_with_subs(DebugFile); - } -} - -/**** - * Transitive closure of the relation containing multiple conjuncts - * New (Bill's) version - ***/ - -Relation TransitiveClosure0(NOT_CONST Relation &input_r, int maxExpansion, NOT_CONST Relation & input_IterationSpace) { - Relation r = consume_and_regurgitate(input_r); - Relation IterationSpace = consume_and_regurgitate(input_IterationSpace); - - if (closure_presburger_debug) - fprintf(DebugFile, "\n\n[Transitive closure\n\n"); - - Relation result; - -#ifdef TC_STATS -#define TC_RUNS 1 - int in_conj = copy(r).query_DNF()->length(); - totals++; - fprintf(statsfile,"%d closure run\n", totals); - if(is_in_D_form(copy(r))) - fprintf(statsfile, "Relation initially in D form\n"); - else - fprintf(statsfile, "Relation initially NOT in D form\n"); - if(is_lex_forward(copy(r))) - fprintf(statsfile, "Relation is initially lex forw\n"); - else - fprintf(statsfile, "Relation is NOT initially lex forw\n"); - start_clock(); - for(int tc_loop = 1; tc_loop <= TC_RUNS; tc_loop++) { - singles = 0; -#endif - - assert(!r.is_null()); - assert(r.n_inp() == r.n_out()); - - if (r.max_ufs_arity() > 0) { - assert(r.max_ufs_arity() == 0 && "Can't take transitive closure with UFS yet."); - - fprintf(stderr, "Can't take transitive closure with UFS yet."); - exit(1); - } - - r.simplify(2,2); - if (!r.is_upper_bound_satisfiable()) { -#ifdef TC_STATS - int totalTime = clock_diff(); - fprintf(statsfile, "Relation is unsatisfiable\n"); - fprintf(statsfile, "input conj: %d output conj: %d #singe conj closures: %d time: %d\n", - in_conj, copy(result).query_DNF()->length(), - singles, - totalTime/TC_RUNS); -#endif - - - if (closure_presburger_debug) - fprintf(DebugFile, "]TC : relation is false\n"); - return r; - } - - IterationSpace = Hull(Union(Domain(copy(r)),Range(copy(r))), true, 1, IterationSpace); - - if (detailedClosureDebug) { - fprintf(DebugFile, "r is:\n"); - r.print_with_subs(DebugFile); - fprintf(DebugFile, "IS is:\n"); - IterationSpace.print_with_subs(DebugFile); - } - Relation dom = Domain(copy(r)); - dom.simplify(2,1); - Relation rng = Range(copy(r)); - rng.simplify(2,1); - Relation AC = ConicClosure(Restrict_Range(Restrict_Domain(copy(r),copy(rng)),copy(dom))); - Relation UB = Union(copy(r),Join(copy(r),Join(AC,copy(r)))); - UB.simplify(2,1); - - if (detailedClosureDebug) { - fprintf(DebugFile, "UB is:\n"); - UB.print_with_subs(DebugFile); - } - result = Relation::False(r); - Simple_List firstChoice,secondChoice; - - r.simplify(2,2); - - Relation test = Difference(copy(r),Composition(copy(r),copy(r))); - test.simplify(2,2); - if (r.number_of_conjuncts() > test.number_of_conjuncts()) { - Relation test2 = Union(copy(test),Composition(copy(test),copy(test))); - test2.simplify(2,2); - if (Must_Be_Subset(copy(r),copy(test2))) r = test; - else if (detailedClosureDebug) { - fprintf(DebugFile, "Transitive reduction not possible:\n"); - fprintf(DebugFile, "R is:\n"); - r.print_with_subs(DebugFile); - fprintf(DebugFile, "test2 is:\n"); - test2.print_with_subs(DebugFile); - } - } - - r.make_level_carried_to(r.n_inp()); - if (detailedClosureDebug) { - fprintf(DebugFile, "r is:\n"); - r.print_with_subs(DebugFile); - } - for(int depth = r.n_inp(); depth >= -1; depth--) - for (DNF_Iterator d(r.query_DNF()); d.live(); d.next()) - if (d.curr()->query_guaranteed_leading_0s() == depth) { - Relation C(r, d.curr()); - firstChoice.append(C); - } - - bool first_conj=true; - for (Simple_List_Iterator sli(firstChoice); sli; sli++) { - if (first_conj) - first_conj=false; - else { - Relation C_plus; - bool change=TryConjunctTransitiveClosure( - copy(sli.curr()), IterationSpace, C_plus); - if (change) - sli.curr()=C_plus; - } - } - - //compute closure - int maxClauses = 3+firstChoice.size()*(1+maxExpansion); - - int resultConjuncts = 0; - int numFails = 0; - bool resultInexact = false; - while (!firstChoice.empty() || !secondChoice.empty()) { - Relation R_plus, R_star; - - if (detailedClosureDebug) { - fprintf(DebugFile,"Main loop of TC:\n"); - if (!firstChoice.empty()) { - fprintf(DebugFile,"First choice:\n"); - printRelationList(firstChoice); - } - if (!secondChoice.empty()) { - fprintf(DebugFile,"Second choice:\n"); - printRelationList(secondChoice); - } - } - - Relation R; - if (!firstChoice.empty()) - R = firstChoice.remove_front(); - else R = secondChoice.remove_front(); - - if (detailedClosureDebug) { - fprintf(DebugFile, "Working with conjunct:\n"); - R.print_with_subs(DebugFile); - } - - bool known=ConjunctTransitiveClosure(copy(R),IterationSpace, R_plus, R_star); - - if (!known && numFails < firstChoice.size()) { - numFails++; - firstChoice.append(R); - if (detailedClosureDebug) { - fprintf(DebugFile, "\nTry another conjunct, R is not suitable\n"); - R.print_with_subs(DebugFile); - } - continue; - } - - - if (detailedClosureDebug) { - fprintf(DebugFile,"\nR+ is:\n"); - R_plus.print_with_subs(DebugFile); - if (known) { - fprintf(DebugFile, "Known R? is :\n"); - R_star.print_with_subs(DebugFile); - } - else - fprintf(DebugFile, "The R* for this relation is not calculated\n"); - } - - Relation R_z; - if (known) { - R_z=Difference(copy(R_star),copy(R_plus)); - known = R_z.is_upper_bound_satisfiable(); - if (known) { - int d = R.single_conjunct()->query_guaranteed_leading_0s(); - R_z.make_level_carried_to(min(R.n_inp(),d+1)); - if (R_z.query_DNF()->length() > 1) known = false; - if (detailedClosureDebug) { - fprintf(DebugFile, "\nForced R_Z to be level carried at level %d\n",min(R.n_inp(),d+1)); - } - } - if (detailedClosureDebug) { - if (known) { - fprintf(DebugFile, "\nDifference between R? and R+ is:\n"); - R_z.print_with_subs(DebugFile); - } - else - fprintf(DebugFile, "\nR_z is unusable\n"); - } - } - else R_z = Relation::False(r); - - if (!known) - numFails++; - else numFails = 0; - if (!known && numFails <= firstChoice.size()) { - firstChoice.append(R); - if (detailedClosureDebug) { - fprintf(DebugFile, "\nTry another conjunct, Rz is avaiable for R:\n"); - R.print_with_subs(DebugFile); - } - continue; - } - - //make N empty list - Relation N = Relation::False(r); - - //append R+ to T - result = Union(result, copy(R_plus)); - resultConjuncts++; - - int expansion = maxClauses - (resultConjuncts + 2*firstChoice.size() + secondChoice.size()); - if (expansion < 0) expansion = 0; - if (detailedClosureDebug) { - fprintf(DebugFile,"Max clauses = %d\n",maxClauses); - fprintf(DebugFile,"result conjuncts = %d\n",resultConjuncts); - fprintf(DebugFile,"firstChoice's = %d\n",firstChoice.size()); - fprintf(DebugFile,"secondChoice's = %d\n",secondChoice.size()); - fprintf(DebugFile,"Allowed expansion is %d\n",expansion); - } - - bool firstPart=true; - if (!known && expansion == 0) { - if (detailedClosureDebug) { - fprintf(DebugFile,"Expansion = 0, R? unknown, skipping composition\n"); - } - if (!resultInexact && detailedClosureDebug) fprintf(DebugFile,"RESULT BECOMES INEXACT 1\n"); - resultInexact = true; - } - else - for (Simple_List_Iterator s(firstChoice); - firstPart? - (s.live()?true: - (s = Simple_List_Iterator(secondChoice), - firstPart = false, - s.live())) - :s.live(); - s.next()) { - assert(s.live()); - Relation C=(s.curr()); - if (detailedClosureDebug) { - fprintf(DebugFile, "\nComposing chosen conjunct with C:\n"); - C.print_with_subs(DebugFile); - } - - if (!known) { - if (detailedClosureDebug) { - fprintf(DebugFile, "\nR? is unknown! No debug info here yet\n"); - } - Relation C1=Composition(copy(C), copy(R_plus)); - if (detailedClosureDebug) { - fprintf(DebugFile, "\nGenerating \n"); - C1.print_with_subs(DebugFile); - } - C1.simplify(); - Relation newStuff = - Difference( - Difference(copy(C1),copy(C)), - copy(R_plus)); - newStuff.simplify(); - if (detailedClosureDebug) { - fprintf(DebugFile, "New Stuff:\n"); - newStuff.print_with_subs(DebugFile); - } - bool C1_contains_new_stuff = newStuff.is_upper_bound_satisfiable(); - if (C1_contains_new_stuff) { - if (newStuff.has_single_conjunct()) - C1 = newStuff; - if (expansion) { - N = Union(N,copy(C1)); - expansion--; - } - else { - if (!resultInexact && detailedClosureDebug) fprintf(DebugFile,"RESULT BECOMES INEXACT 2\n"); - resultInexact = true; - break; - } - } - else C1 = Relation::False(C1); - - Relation C2(Composition(copy(R_plus),copy(C))); - if (detailedClosureDebug) { - fprintf(DebugFile, "\nGenerating \n"); - C2.print_with_subs(DebugFile); - } - newStuff = - Difference( - Difference( - Difference(copy(C2),copy(C)), - copy(C1)), - copy(R_plus)); - newStuff.simplify(); - if (detailedClosureDebug) { - fprintf(DebugFile, "New Stuff:\n"); - newStuff.print_with_subs(DebugFile); - } - if (newStuff.is_upper_bound_satisfiable()) { - if (newStuff.has_single_conjunct()) - C2 = newStuff; - if (expansion) { - N = Union(N,copy(C2)); - expansion--; - } - else { - if (!resultInexact && detailedClosureDebug) fprintf(DebugFile,"RESULT BECOMES INEXACT 3\n"); - resultInexact = true; - break; - } - } - else C2 = Relation::False(C2); - - if (C1_contains_new_stuff) { - Relation C3(Composition(copy(R_plus),copy(C1))); - if (detailedClosureDebug) { - fprintf(DebugFile, "\nGenerating \n"); - C3.print_with_subs(DebugFile); - } - newStuff = - Difference( - Difference( - Difference( - Difference(copy(C3),copy(C)), - copy(C1)), - copy(C2)), - copy(R_plus)); - newStuff.simplify(); - if (detailedClosureDebug) { - fprintf(DebugFile, "New Stuff:\n"); - newStuff.print_with_subs(DebugFile); - } - if (newStuff.is_upper_bound_satisfiable()) { - if (newStuff.has_single_conjunct()) - C3 = newStuff; - if (expansion) { - N = Union(N,C3); - expansion--; - } - else { - if (!resultInexact && detailedClosureDebug) fprintf(DebugFile,"RESULT BECOMES INEXACT 4\n"); - resultInexact = true; - break; - } - } - } - - } - else { - Relation C_Rz(Composition(copy(C),copy(R_z))); - if (detailedClosureDebug) { - fprintf(DebugFile, "C o Rz is:\n"); - C_Rz.print_with_subs(DebugFile); - } - - Relation Rz_C_Rz(Composition(copy(R_z),copy(C_Rz))); - if (detailedClosureDebug) { - fprintf(DebugFile, "\nRz o C o Rz is:\n"); - Rz_C_Rz.print_with_subs(DebugFile); - } - - if (Equal(C,Rz_C_Rz)) { -#if defined(TC_STATS) - fprintf(statsfile,"weak test selects C?\n"); -#endif - Relation tmp = Composition(C,copy(R_star)); - tmp.simplify(); - Relation tmp2 = Composition(copy(R_star),copy(tmp)); - tmp2.simplify(); - if (Must_Be_Subset(copy(tmp2),copy(tmp))) - *s = tmp; - else - *s = tmp2; - if (detailedClosureDebug) { - fprintf(DebugFile,"\nC is equal to Rz o C o Rz so R? o C o R? replaces C\n"); - fprintf(DebugFile, "R? o C o R? is:\n"); - (*s).print_with_subs(DebugFile); - } - } - else { -#if defined(TC_STATS) - fprintf(statsfile,"weak test fails\n"); -#endif - if (Equal(C, C_Rz)) { - *s=Composition(copy(C),copy(R_star)); - Relation p(Composition(copy(R_plus), copy(*s))); - p.simplify(); - if (detailedClosureDebug) { - fprintf(DebugFile, "\nC is equal to C o Rz, so C o Rz replaces C\n"); - fprintf (DebugFile, "C o R? is:\n"); - (*s).print_with_subs(DebugFile); - fprintf (DebugFile, "R+ o C o R? is added to list N. It's :\n"); - p.print_with_subs(DebugFile); - } - if (!Is_Obvious_Subset(copy(p),copy(R_plus)) - && !Is_Obvious_Subset(copy(p),copy(C))) { - if (expansion) { - p.simplify(2,2); - expansion--; - } - else { - if (!resultInexact && detailedClosureDebug) fprintf(DebugFile,"RESULT BECOMES INEXACT 5\n"); - resultInexact = true; - break; - } - } - } - else { - Relation Rz_C(Composition(copy(R_z),copy(C))); - - if (Equal(C,Rz_C)) { - *s=Composition(copy(R_star),copy(C)); - Relation Rstar_C_Rplus(Composition(copy(*s),copy(R_plus))); - Rstar_C_Rplus.simplify(); - if (detailedClosureDebug) { - fprintf(DebugFile, "\nC is equal to Rz o C , so R? o C replaces C\n"); - fprintf (DebugFile, "R? o C is:\n"); - (*s).print_with_subs(DebugFile); - fprintf (DebugFile, "R+ o C is added to list N. It's :\n"); - Rstar_C_Rplus.print_with_subs(DebugFile); - } - if (!Is_Obvious_Subset(copy(Rstar_C_Rplus),copy(R_plus)) - && !Is_Obvious_Subset(copy(Rstar_C_Rplus),copy(C))) { - if (expansion) - N = Union(N,Rstar_C_Rplus); - else { - if (!resultInexact && detailedClosureDebug) fprintf(DebugFile,"RESULT BECOMES INEXACT 6\n"); - resultInexact = true; - break; - } - } - } - else { - if (detailedClosureDebug) { - fprintf(DebugFile, "\nHave to handle it the hard way\n"); - } - Relation C1=Composition(copy(C), copy(R_plus)); - C1.simplify(); - if (!Is_Obvious_Subset(copy(C1),copy(R_plus)) - && !Is_Obvious_Subset(copy(C1),copy(C))) { - if (expansion) { - N = Union(N,copy(C1)); - expansion--; - } - else { - if (!resultInexact && detailedClosureDebug) fprintf(DebugFile,"RESULT BECOMES INEXACT 7\n"); - resultInexact = true; - break; - } - } - - Relation C2(Composition(copy(R_plus),copy(C))); - C2.simplify(); - if (!Is_Obvious_Subset(copy(C2),copy(R_plus)) - && !Is_Obvious_Subset(copy(C2),copy(C))) { - if (expansion) { - N = Union(N,C2); - expansion--; - } - else { - if (!resultInexact && detailedClosureDebug) { - fprintf(DebugFile,"RESULT BECOMES INEXACT 8\n"); - fprintf(DebugFile,"Have to discard:\n"); - C2.print_with_subs(DebugFile); - } - resultInexact = true; - break; - } - } - Relation C3(Composition(copy(R_plus),C1)); - C3.simplify(); - if (!Is_Obvious_Subset(copy(C3),copy(R_plus)) && !Is_Obvious_Subset(copy(C3),copy(C))) { - if (expansion) { - N = Union(N,C3); - expansion--; - } - else { - if (!resultInexact && detailedClosureDebug) - fprintf(DebugFile,"RESULT BECOMES INEXACT 9\n"); - resultInexact = true; - break; - } - } - } - } - } - } - } - - //now we processed the first conjunct. - if (detailedClosureDebug) { - N.simplify(2,2); - fprintf(DebugFile, "\nNew conjuncts:\n"); - N.print_with_subs(DebugFile); - } - - N.simplify(2,2); - appendClausesToList(secondChoice,N); - } - - //Did we do all conjuncts? If not, make T be inexact - result.copy_names(r); - - result.simplify(2,2); - - if (!result.is_exact()) { - result = Lower_Bound(result); - resultInexact = true; - } - if (resultInexact) { - Relation test(Composition(copy(result),copy(result))); - test.simplify(2,2); - if (detailedClosureDebug) { - fprintf(DebugFile, "\nResult is:\n"); - result.print_with_subs(DebugFile); - fprintf(DebugFile, "\nResult composed with itself is:\n"); - test.print_with_subs(DebugFile); - } - if (!Must_Be_Subset(test,copy(result))) { - result = Union(result,Intersection(UB, Relation::Unknown(result))); - } - } - -#ifdef TC_STATS - { - Relation rcopy = result; - Relation test2(Composition(copy(rcopy),copy(rcopy))); - test2.simplify(2,2); - test2.remove_disjunction_with_unknown(); - rcopy.remove_disjunction_with_unknown(); - if (detailedClosureDebug) { - fprintf(DebugFile, "\nResult is:\n"); - rcopy.print_with_subs(DebugFile); - fprintf(DebugFile, "\nResult composed with itself is:\n"); - test2.print_with_subs(DebugFile); - } - if (!Must_Be_Subset(test2,copy(rcopy))) { - fprintf(statsfile,"multi TC result is inexact\n"); - } - else - fprintf(statsfile,"TC result is exact%s\n", (resultInexact || !rcopy.is_exact())?" despite perceived inexactness":""); - } -#endif - -#ifdef TC_STATS - } - int totalTime = clock_diff(); - fprintf(statsfile, "input conj: %d output conj: %d #singe conj closures: %d time: %d\n", - in_conj, copy(result).query_DNF()->length(), - singles, - totalTime/TC_RUNS); -#endif - - if (closure_presburger_debug || detailedClosureDebug) { - if (detailedClosureDebug) { - fprintf(DebugFile, "\nThe transitive closure is :\n"); - result.print_with_subs(DebugFile); - } - fprintf(DebugFile, "\n\n] END Transitive closure\n\n"); - } - return result; -} - - -Relation TransitiveClosure(NOT_CONST Relation &input_r, - int maxExpansion, - NOT_CONST Relation & input_IterationSpace) { - Relation r = consume_and_regurgitate(input_r); - Relation IterationSpace = consume_and_regurgitate(input_IterationSpace); - if (r.is_null()) - return r; - if (r.n_out() == 0) - throw std::invalid_argument("transitive closure does not apply to set"); - if (r.n_inp() != r.n_out()) - throw std::invalid_argument("transitive closure must has the same input and output arity"); - - if (closure_presburger_debug) { - fprintf(DebugFile,"\nComputing Transitive closure of:\n"); - r.print_with_subs(DebugFile); - fprintf(DebugFile,"\nIteration space is:\n"); - IterationSpace.print_with_subs(DebugFile); - } - if (!r.is_upper_bound_satisfiable()) { - if (closure_presburger_debug) - fprintf(DebugFile, "]TC : relation is false\n"); - return r; - } - - Relation UB = DeltasToRelation(ConicHull(Project_Sym(Deltas(copy(r)))), - r.n_inp(),r.n_out()); - if (closure_presburger_debug) { - fprintf(DebugFile,"UB is:\n"); - UB.print_with_subs(DebugFile); - } - - Relation conditions = Restrict_Domain(copy(UB),Domain(copy(r))); - conditions.simplify(); - if (closure_presburger_debug) { - fprintf(DebugFile,"Forward reachable is:\n"); - conditions.print_with_subs(DebugFile); - } - conditions = Composition(Inverse(copy(UB)),conditions); - conditions.simplify(); - if (closure_presburger_debug) { - fprintf(DebugFile,"Backward/forward reachable is:\n"); - conditions.print_with_subs(DebugFile); - } - conditions = Range(conditions); - conditions.simplify(); - // conditions = Approximate(conditions); - // conditions.simplify(); - conditions = VennDiagramForm(conditions); - conditions.simplify(); - - if (closure_presburger_debug) { - fprintf(DebugFile,"Condition regions are:\n"); - conditions.print_with_subs(DebugFile); - } - - if (conditions.is_obvious_tautology()) { - return TransitiveClosure0(r, maxExpansion, IterationSpace); - } - else { - Relation answer = Relation::False(r); - answer.copy_names(r); - answer.setup_names(); - - for (DNF_Iterator c(conditions.query_DNF()); c.live(); c.next()) { - Relation tmp = Relation(conditions, c.curr()); - if (closure_presburger_debug) { - fprintf(DebugFile,"\nComputing Transitive closure:\n"); - fprintf(DebugFile,"\nRegion:\n"); - tmp.prefix_print(DebugFile); - } - - Relation tmp3 = Restrict_Domain(copy(r),tmp); - tmp3.simplify(2,2); - if (closure_presburger_debug) { - fprintf(DebugFile,"\nRelation:\n"); - tmp3.prefix_print(DebugFile); - } - - answer = Union(answer, TransitiveClosure0(tmp3, maxExpansion,copy(IterationSpace))); - } - return answer; - } -} - - -/* ********************************* */ -/* Function check if relation */ -/* belong to d-form or */ -/* uniform relaion class */ -/* ********************************* */ - -Relation is_DForm_or_Uniform(NOT_CONST Relation &r){ - - Relation s = consume_and_regurgitate(r); - Relation Rtmp, Rdelta, delta; - - delta = Deltas(copy(s)); - Rdelta = DeltasToRelation(copy(delta), s.n_inp(), s.n_out()); - Rtmp = DeltasToRelation(Project_Sym(delta), s.n_inp(), s.n_out()); - - Rtmp = Restrict_Domain(Rtmp, Domain(copy(Rdelta))); - Rtmp = Restrict_Range(Rtmp, Range(Rdelta)); - - Rdelta = copy(Rtmp); - - Rtmp = Restrict_Domain(Rtmp, Domain(copy(s))); - Rtmp = Restrict_Range(Rtmp, Range(copy(s))); - - if (Must_Be_Subset( copy(Rtmp), copy(s)) && \ - Must_Be_Subset(copy(s), copy(Rtmp))) { - Rtmp = Relation::Null(); - } - else { - Rtmp = Rdelta = Relation::Null(); - } - - return Rdelta; - } - - - - /* ********************************* */ - /* Get a conjunction for */ - /* a given number from set */ - /* of relations */ - /* ********************************* */ - -Relation getConjunctionNr(NOT_CONST Relation &r, int conjNr) { - - Relation s = consume_and_regurgitate(r); - int i = 1; - - for (DNF_Iterator c(s.query_DNF()); c; c++,i++) { - if ( i == conjNr ) { - return Relation(s, c.curr()); - } - } - - return Relation::False(s.n_inp(), s.n_out()); - - } - - -/* ********************************* */ -/* Get a common region for */ -/* a given set of relations */ -/* ********************************* */ - -Relation getCommonRegion( NOT_CONST Relation &r, const long* relTab, const long relCount) { - - Relation s = consume_and_regurgitate(r); - Relation commonRegion, Rcurr; - long i = 0; - - Rcurr = getConjunctionNr( copy(s), relTab[0]); - commonRegion = Union(Domain(copy(Rcurr)), Range(copy(Rcurr))); - - for( i=1; i < relCount; i++ ){ - Rcurr = getConjunctionNr( copy(s), relTab[i]); - commonRegion = Intersection( commonRegion, Union( Domain(copy(Rcurr)), Range(copy(Rcurr))) ); - } - - return commonRegion; - } - - -/* ********************************* */ -/* Get a set of relations */ -/* ********************************* */ - -Relation getRelationsSet( NOT_CONST Relation &r, const long* relTab, const long relCount) { - - Relation s = consume_and_regurgitate(r); - Relation R = Relation::False(s.n_inp(), s.n_out()); - long i = 0; - - for( i=0; i < relCount; i++ ){ - R = Union( R, getConjunctionNr( copy(s), relTab[i]) ); - } - - return R; - } - - -/* ********************************* */ -/* Get a set of relations */ -/* from a common region */ -/* ********************************* */ - -Relation relationsOnCommonRegion( NOT_CONST Relation &r, NOT_CONST Relation ®ion ) { - - Relation set = consume_and_regurgitate(r); - Relation reg = consume_and_regurgitate(region); - Relation R = Relation::True(set.n_inp(), set.n_out()); - - R = Restrict_Domain(R, copy(reg)); - R.simplify(2,1); - R = Restrict_Range(R, reg); - R.simplify(2,1); - - R = Intersection(R, set); - - return R; - - } - - -Relation compose_N(NOT_CONST Relation &input_r) { - Relation r = consume_and_regurgitate(input_r); - Relation powerR, powerR2; - - r = Union(r, Identity(r.n_inp())); - powerR = copy(r); - - for(;;){ - if (powerR.number_of_conjuncts() > 50) { - powerR = Relation::Null(); - return powerR; - } - - powerR2 = Composition(copy(powerR), copy(r)); - powerR2.simplify(2,1); - - if (Must_Be_Subset( copy(powerR2), copy(powerR))) { - powerR2 = Relation::Null(); - return powerR; - } - - powerR = Relation::Null(); - powerR = copy(powerR2); - powerR2 = Relation::Null(); - } -} - - -/****************************** */ -/* Check exactness of R+ */ -/* */ -/* Tomasz Klimek 05-06-2010 */ -/****************************** */ - -bool checkExactness(NOT_CONST Relation &r, NOT_CONST Relation &rplus){ - - -Relation s1 = consume_and_regurgitate(r); -Relation s2 = consume_and_regurgitate(rplus); -Relation R; - -R = Composition(copy(s1), copy(s2)); -R = Union(s1, R); - - if( Must_Be_Subset(copy(s2), copy(R)) && \ - Must_Be_Subset(copy(R), copy(s2))) { - R = Relation::Null(); - s1 = Relation::Null(); - return true; - } - - R = Relation::Null(); - s1 = Relation::Null(); - - return false; - -} - -/************************************** */ -/* Calculate approximation of R* */ -/* */ -/* Tomasz Klimek 05-06-2010 */ -/************************************** */ - - -Relation ApproxClosure(NOT_CONST Relation &r) { - - Relation s = consume_and_regurgitate(r); - Relation R = Relation::False(s.n_inp(), s.n_out()); - Relation tc = Identity(s.n_inp()); - Relation Rtmp; - - - for (DNF_Iterator c(s.query_DNF()); c; c++) { - Rtmp = Hull(Project_Sym(Deltas(Relation(s, c.curr()))), false, 1, Relation::Null()); - R = Union(R, TransitiveClosure(DeltasToRelation(Rtmp,s.n_inp(),s.n_out()), 1, Relation::Null())); - } - - for (DNF_Iterator c(R.query_DNF()); c; c++) { - Rtmp = Union(Identity(s.n_inp()), Relation(R, c.curr())); - tc = Composition(tc, Rtmp); - tc = Hull(tc, false, 1, Relation::Null()); - } - - tc = Restrict_Domain(tc,Domain(copy(s))); - tc.simplify(2,1); - tc = Restrict_Range(tc,Range(s)); - tc.simplify(2,1); - tc = Intersection(tc, Relation::Unknown(tc)); - - return tc; -} - - -/************************************** */ -/* Calculate R* on unbounded region */ -/* */ -/* Tomasz Klimek 05-06-2010 */ -/************************************** */ - -Relation ClosureOnUnboundedRegion(NOT_CONST Relation &r) { - - Relation s = consume_and_regurgitate(r); - Relation R = Relation::False(s.n_inp(), s.n_out()); - Relation tc = Identity(s.n_inp()); - Relation Rtmp,tcTmp; - - for (DNF_Iterator c(s.query_DNF()); c; c++) { - Rtmp = is_DForm_or_Uniform(Relation(s, c.curr())); - - if (!(Rtmp.is_null())) { - tcTmp = TransitiveClosure(Rtmp, 1, Relation::Null()); - - if (!(tcTmp.is_exact())){ - tcTmp = R = Relation::Null(); - /* fprintf(DebugFile,"\nTC is inexact!"); */ - return tcTmp; - } - } - else { - R = Relation::Null(); - /* fprintf(DebugFile,"\nR is not d-form relation!"); */ - return Relation::Null(); - } - - R = Union(R, tcTmp); - } - - for (DNF_Iterator c(R.query_DNF()); c; c++) { - Rtmp = Union(Identity(s.n_inp()), Relation(R, c.curr())); - tc = Composition(tc, Rtmp); - tc.simplify(2,1); - } - - tc = Difference(tc, Identity(s.n_inp())); - - return tc; - -} - - - - -/******************************* */ -/* Try to select sets of domain */ -/* and range */ -/* */ -/* Tomasz Klimek 05-06-2010 */ -/******************************* */ - -Relation SelectRegionForClosure(NOT_CONST Relation &r){ - - Relation s = consume_and_regurgitate(r); - Relation DR = Union(Domain(copy(s)),Range(copy(s))); - Relation region,tc,tcTmp; - - region = SimpleHull(copy(DR)); - region.simplify(2,1); - - tc = ClosureOnUnboundedRegion(copy(s)); - - if (tc.is_null()) { - return tc; - } - - tcTmp = Restrict_Domain(copy(tc),copy(region)); - tcTmp.simplify(2,1); - tcTmp = Restrict_Range(tcTmp,region); - tcTmp.simplify(2,1); - - if (checkExactness(copy(s), copy(tcTmp))) { - s = tc = Relation::Null(); - return tcTmp; - } - - tcTmp = Relation::Null(); - region = Hull(DR,false,1,Relation::Null()); - - tcTmp = Restrict_Domain(copy(tc),copy(region)); - tcTmp.simplify(2,1); - tcTmp = Restrict_Range(tcTmp,region); - tcTmp.simplify(2,1); - - if (checkExactness(copy(s), copy(tcTmp))) { - s = tc = Relation::Null(); - return tcTmp; - } - - tcTmp = Relation::Null(); - - tc = Restrict_Domain(tc,Domain(copy(s))); - tc.simplify(2,1); - tc = Restrict_Range(tc,Domain(copy(s))); - tc.simplify(2,1); - - if (checkExactness(copy(s), copy(tc))) { - s = Relation::Null(); - return tc; - } - - tc = Relation::Null(); - - return ApproxClosure(s); - -} - - - - -/************************************** */ -/* Calculate R* */ -/* */ -/* Tomasz Klimek 05-06-2010 */ -/************************************** */ - -Relation calculateTransitiveClosure(NOT_CONST Relation &r) { - - Relation s = consume_and_regurgitate(r); - Relation tc = Relation::False(s.n_inp(), s.n_out()); - long* relationsSet = NULL; - Relation commonRegion, regionTmp; - Relation inputRelations; - long i,j=-1; - long N,M; - Relation R; - - - commonRegion = SelectRegionForClosure(copy(s)); - - if (commonRegion.is_null()) { - return ApproxClosure(s); - } - - if (commonRegion.is_exact()) { - return commonRegion; - } - - commonRegion = Relation::Null(); - N = M = s.number_of_conjuncts(); - relationsSet = (long*)calloc(N,sizeof(long)); - - if (relationsSet == NULL) { - return Relation::False(s.n_inp(), s.n_out()); - } - - for (; N > 1;) { - for ( i=0; i j ) { - relationsSet[i] = relationsSet[i-1] + 1; - } - else if ( i == j ) { - relationsSet[i] += 1; - } - if ( relationsSet[i] <= M ) { - j = i; - } - else { - j = i - 1; - break; - } - } - - if ( j+1 == N) { - /* fprintf(DebugFile,"\n"); - for(i=0;i -#include -#include -#include -#include - -namespace omega { - -int evac_debug = 0; - -char *evac_names[] = { "trivial", - "offset", - "subseq", - "off_sub", -// "perm.", - "affine", - "nasty" }; - -int single_evacs[evac_nasty+1]; -int double_evacs[evac_nasty+1][evac_nasty+1]; - -/* - * We're going to try to describe the equalities among a set of variables - * We want to perform some substitutions to ensure that we don't miss - * v_1 = v_2 due to its expression as v_1 = v_3 && v_2 = v_3 - * We therefore try to substitute out all variables that we don't care - * about (e.g., v_3 in the above example). - */ - -static bool try_to_sub(Problem *p, int col) { - int e, i; - - if (!p->variablesInitialized) { - p->initializeVariables(); - } - - assert(col <= p->nVars); - assert(!inApproximateMode); - - for(e=0;enEQs;e++) - if (p->EQs[e].coef[col] == 1 || p->EQs[e].coef[col] == -1) { - int var = p->var[col]; - p->doElimination(e, col); - if (col != p->nVars + 1) - p->forwardingAddress[p->var[p->nVars+1]] = col; - assert(p->SUBs[p->nSUBs-1].key = var); - p->forwardingAddress[var] = -p->nSUBs; - break; - } - - if (e == p->nEQs) - return false; - - for (int c=0;c<=p->nVars;c++) { - assert(p->EQs[e].coef[c] == 0); - } - - p->nEQs--; - if (e < p->nEQs) eqnncpy(&p->EQs[e], &p->EQs[p->nEQs], p->nVars); - - for (i = 0; i < p->nSUBs; i++) { - assert(p->forwardingAddress[p->SUBs[i].key] == -i - 1); - } - - return true; -} - - -// should be static, but must be a friend -bool check_subseq_n(Conjunct *c, Sequence &evac_from, Sequence &evac_to, int n_from, int n_to, int max_arity, int n, bool allow_offset) { - // check each position v to see if from[v] == to[v+n] (+ offset) - - assert(max_arity + n <= n_to); - - for (int v = 1; v <= max_arity; v++){ - // first, get rid of possible interlopers: - int col; - Conjunct *d = c->copy_conj_same_relation(); - for (int tv = 1; tv <= n_to; tv++) - if (tv != v+n) - if ((col = d->find_column(evac_to[tv])) > 0) - try_to_sub(d->problem, col); - for (int fv = 1; fv <= n_from; fv++) - if (fv != v) - if ((col = d->find_column(evac_from[fv])) > 0) - try_to_sub(d->problem, col); - - int c_to = d->find_column(evac_to[v+n]); - int c_from = d->find_column(evac_from[v]); - assert(c_to > 0); - assert(c_from > 0); - assert(c_to != c_from); - - // now, just look for an equality c_to = c_from + offset - - bool found_needed_eq = false; - - for (int e = 0; e < d->problem->nEQs; e++) { - if (d->problem->EQs[e].coef[c_from] != 0) { - for (int k = allow_offset?1:0; k < d->problem->nVars; k++) - if (k!=c_to && k!=c_from && d->problem->EQs[e].coef[k]!=0) - break; // this EQ is not what we need - if (k == d->problem->nVars) { // this EQ is what we need - found_needed_eq = true; - break; - } - } - } - - delete d; - - if (!found_needed_eq) - return false; // no EQ did what we need - } - - return true; -} - -void assert_subbed_syms(Conjunct *c) { - int v, col; - - // where possible, symbolic constants must have been subbed out - for (v = 1; v <= c->relation()->global_decls()->length(); v++) - if ((col = c->find_column((*c->relation()->global_decls())[v]))>0) - assert(!try_to_sub(c->problem, col)); -} - - -static bool check_offset(Conjunct *c, Sequence &evac_from, Sequence &evac_to, int n_from, int n_to, int max_arity) { - assert_subbed_syms(c); - - return check_subseq_n(c,evac_from,evac_to,n_from,n_to,max_arity,0,true); -} - -static bool check_subseq(Conjunct *c, Sequence &evac_from, Sequence &evac_to, int n_from, int n_to, int max_arity) { - assert_subbed_syms(c); - - for (int i = 0; i <= n_to - max_arity; i++) - if (check_subseq_n(c,evac_from,evac_to,n_from,n_to,max_arity,i,false)) - return true; - - return false; -} - -static bool check_offset_subseq(Conjunct *c, Sequence &evac_from, Sequence &evac_to, int n_from, int n_to, int max_arity) { - assert_subbed_syms(c); - - for (int i = 0; i <= n_to - max_arity; i++) - if (check_subseq_n(c,evac_from,evac_to,n_from,n_to,max_arity,i,true)) - return true; - - return false; -} - -bool check_affine(Conjunct *d, Sequence &evac_from, Sequence &evac_to, int n_from, int n_to, int max_arity) { - int v, col; - Conjunct *c = d->copy_conj_same_relation(); - assert_subbed_syms(c); - - // try to find substitutions for all evac_to variables - for (v = 1; v <= max_arity; v++) - if ((col = c->find_column(evac_to[v])) > 0) - try_to_sub(c->problem, col); - - // any that didn't have substitutions, aren't affine - for (v = 1; v <= max_arity; v++) - if (c->find_column(evac_to[v]) >= 0) { - delete c; - return false; - } - - // FERD - disallow symbolic constants? - delete c; - return true; -} - - -evac study(Conjunct *C, Sequence &evac_from, Sequence &evac_to, int n_from, int n_to, int max_arity) { - assert(max_arity > 0); - assert(max_arity <= C->relation()->n_inp()); - assert(max_arity <= C->relation()->n_out()); - - assert((&evac_from == &input_vars && &evac_to == &output_vars) || - (&evac_from == &output_vars && &evac_to == &input_vars)); - - evac ret = evac_nasty; - - if (C->query_guaranteed_leading_0s() >= max_arity) - ret = evac_trivial; - else { - Conjunct *c = C->copy_conj_same_relation(); - assert(c->relation() == C->relation()); - - if (evac_debug >= 3) { - fprintf(DebugFile, "About to study %s evacuation for conjunct\n", - &evac_from == &input_vars ? "In-->Out" : "Out-->In"); - use_ugly_names++; - C->prefix_print(DebugFile); - use_ugly_names--; - } - - bool sat = simplify_conj(c, true, 4, black); - assert(sat); // else c is deleted - - int v, col; - - // Substitute out all possible symbolic constants - assert(c->problem->nSUBs == 0); - for (v = 1; v <= c->relation()->global_decls()->length(); v++) - if ((col = c->find_column((*c->relation()->global_decls())[v]))>0) - try_to_sub(c->problem, col); - - if (check_offset(c, evac_from, evac_to, n_from, n_to, max_arity)) - ret = evac_offset; - else if (check_subseq(c, evac_from, evac_to, n_from, n_to, max_arity)) - ret = evac_subseq; - else if (check_offset_subseq(c, evac_from, evac_to, n_from, n_to, max_arity)) - ret = evac_offset_subseq; - else if (check_affine(c, evac_from, evac_to, n_from, n_to, max_arity)) - ret = evac_affine; - - delete c; - } - - if (evac_debug >= 2) { - if ((evac_debug == 2 && ret != evac_trivial && ret != evac_nasty)) { - fprintf(DebugFile, "Studied %s evacuation for conjunct\n", - &evac_from == &input_vars ? "In-->Out" : "Out-->In"); - use_ugly_names++; - C->prefix_print(DebugFile); - use_ugly_names--; - } - - fprintf(DebugFile, "Saw evacuation type %s\n", evac_names[ret]); - } - - return ret; -} - - -void study_evacuation(Conjunct *C, which_way dir, int max_arity) { - if (evac_debug > 0) { - assert(max_arity >= 0); - - if (max_arity > 0) - if (dir == in_to_out) { - assert(max_arity <= C->relation()->n_inp()); - if (max_arity <= C->relation()->n_out()) - single_evacs[study(C, input_vars, output_vars, - C->relation()->n_inp(), - C->relation()->n_out(), - max_arity)]++; - } - else { - assert(max_arity <= C->relation()->n_out()); - if (max_arity <= C->relation()->n_inp()) - single_evacs[study(C, output_vars, input_vars, - C->relation()->n_out(), - C->relation()->n_inp(), - max_arity)]++; - } - } -} - -void study_evacuation(Conjunct *C1, Conjunct *C2, int max_arity) { - if (evac_debug > 0) { - assert(max_arity >= 0); - assert(max_arity <= C1->relation()->n_inp()); - assert(C2->relation()->n_out() == C1->relation()->n_inp()); - - if (max_arity > 0) - if (max_arity <= C1->relation()->n_out() && - max_arity <= C2->relation()->n_inp()) { - double_evacs[study(C1, input_vars, output_vars, - C1->relation()->n_inp(), - C1->relation()->n_out(), - max_arity)] - [study(C2, output_vars, input_vars, - C2->relation()->n_out(), - C2->relation()->n_inp(), - max_arity)]++; - } - else if (max_arity <= C1->relation()->n_out()) { - single_evacs[study(C1, input_vars, output_vars, - C1->relation()->n_inp(), - C1->relation()->n_out(), - max_arity)]++; - } - else if (max_arity <= C2->relation()->n_inp()) { - single_evacs[study(C2, output_vars, input_vars, - C2->relation()->n_out(), - C2->relation()->n_inp(), - max_arity)]++; - } - } -} - -class Evac_info_printer { -public: - ~Evac_info_printer(); -}; - -Evac_info_printer::~Evac_info_printer() { - if (evac_debug > 0) { - int i, j; - - fprintf(DebugFile, "\n"); - - fprintf(DebugFile, "SINGLE"); - for (i = 0; i <= evac_nasty; i++) - fprintf(DebugFile, "\t%s", evac_names[i]); - fprintf(DebugFile, "\n"); - - for (i = 0; i <= evac_nasty; i++) - fprintf(DebugFile, "\t%d", single_evacs[i]); - fprintf(DebugFile, "\n\n"); - - - fprintf(DebugFile, "DOUBLE"); - for (i = 0; i <= evac_nasty; i++) - fprintf(DebugFile, "\t%s", evac_names[i]); - fprintf(DebugFile, "\n"); - - for (i = 0; i <= evac_nasty; i++) { - fprintf(DebugFile, "%s\t", evac_names[i]); - for (j = 0; j <= evac_nasty; j++) - fprintf(DebugFile, "%d\t", double_evacs[i][j]); - fprintf(DebugFile, "\n"); - } - } -} - -static Evac_info_printer print_stats_at_exit; - -} // namespace - -#endif diff --git a/omega/omega_lib/src/farkas.cc b/omega/omega_lib/src/farkas.cc deleted file mode 100644 index 1b3ef87..0000000 --- a/omega/omega_lib/src/farkas.cc +++ /dev/null @@ -1,480 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 the Omega Project Team - Copyright (C) 2005-2011 Chun Chen - All Rights Reserved. - - Purpose: - convert to dual cone for manipulation. - - Notes: - - History: -*****************************************************************************/ - -#include -#include -#include -#include - -namespace omega { - -static Global_Var_Decl constant_term("constantTerm"); - -// class Constant_Term { -// public: -// Global_Var_Decl *p; - -// Constant_Term(); -// ~Constant_Term(); -// }; - -// namespace { -// Constant_Term constant_term; -// } - -// Constant_Term::Constant_Term() { -// p = new Global_Var_Decl("constantTerm"); -// } - -// Constant_Term::~Constant_Term() { -// delete p; -// } - -// Global_Var_ID coefficient_of_constant_term = constant_term.p; - -Global_Var_ID coefficient_of_constant_term = &constant_term; - -extern int inApproximateMode; - -int farkas_debug = 0; - -coef_t farkasDifficulty; - -//***************************************************************************** -// -// forall x1,..,xn s.t. a10 + a11 x1 + ... + a1n xn >= 0 and -// ... -// am0 + am1 x1 + ... + amn xn >= 0 -// -// b0 + b1 x1 + ... + bn xn >= 0 -// -// iff -// -// exists lambda_0,...,lambda_m >= 0 s.t. -// forall x1,..,xn -// lambda_0 + -// lambda_1 ( a10 + a11 x1 + ... + a1n xn) + -// ... -// lambda_m ( am0 + am1 x1 + ... + amn xn) = -// -// b0 + b1 x1 + ... + bn xn -// -// iff -// -// exists lambda_0,...,lambda_m >= 0 s.t. -// lambda_0 + sum_i ( lambda_i a_i0 ) = b_0 -// for j in 1..n -// sum_i ( a_ij lambda_i ) = b_j -// -// iff -// -// exists lambda0,...,lambda_m s.t. -// lambda1,...,lambda_m >= 0 -// lambda0 >= 0 -// lambda_0 = b_0 - sum_i ( lambda_i a_i0 ) -// for j in 1..n -// sum_i ( a_ij lambda_i ) = b_j -// iff -// -// exists lambda1,...,lambda_m s.t. -// lambda1,...,lambda_m >= 0 -// b_0 - sum_i ( lambda_i a_i0 ) >= 0 -// for j in 1..n -// sum_i ( a_ij lambda_i ) = b_j -// -// a_ij come from relation rel -// -// x_1,...,x_n are input and output variables from rel. -// -// b_0,...,b_m are input and output arrays of coef_vars -// -//***************************************************************************** - - -// Given a Relation/Set R -// Compute A,B,C such that -// Ax+By + C >= 0 is true for all x,y in R -// iff [A,B] : constantTerm=C is in AffineClosure(R) -// Note: constantTerm is a special global variable -// If constantTerm appears in the incoming relation -// then set it's coefficient to be 1 in the result - - -// # For example, given -// R := {[i,j] : 1 <= i <= 10 && 1 <= j <= n}; -// # the farkas closure of R is: -// # ac := approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : -// # 0 <= lambda1,lambda2,lambda3,lambda4 -// # && constantTerm - (-lambda1+ 10 lambda2 - lambda3) >= 0 -// # && i = lambda1-lambda2 -// # && j = lambda3-lambda4 -// # && n = lambda4)}; -// # -// # ac; -// -// {[i,j]: 0 <= n && 0 <= n+constantTerm+i+j -// && 0 <= n+constantTerm+10i+j && 0 <= n+j} -// -// The ConvexCombination of ac is: -//# -//# approximate {[i,j] : exists (lambda1,lambda2,lambda3,lambda4 : -//# 0 <= lambda1,lambda2,lambda3,lambda4 -//# && 1 = lambda2+lambda3 -//# && i = lambda2+10lambda3 -//# && j = lambda2+lambda3+lambda4 -//# && n = lambda1+lambda2+lambda3+lambda4 -//# )}; -// -//{[i,j]: 1 <= i <= 10 && 1 <= j <= n} -// - -static void handleVariable(Relation &farkas, Conjunct * conj, - F_And* and_node, - Map &gMap, - Map &eMap, - Variable_ID v) { - use_ugly_names++; - if (farkas_debug > 1) { - fprintf(DebugFile,"Building equality for %s\n", v->name().c_str()); - } - - EQ_Handle e = and_node->add_EQ(); - - for (GEQ_Iterator g = conj->GEQs(); g.live(); g.next()) - if (gMap(*g) != (Variable_ID) 0) { - coef_t c = (*g).get_coef(v); - if (c != 0) { - e.update_coef(gMap(*g), c); - } - } - - for (EQ_Iterator eq = conj->EQs(); eq.live(); eq.next()) - if (eMap(*eq) != (Variable_ID) 0) { - coef_t c = (*eq).get_coef(v); - if (c != 0) { - e.update_coef(eMap(*eq), c); - } - } - - if ((v)->kind() == Global_Var && - (v)->get_global_var() == coefficient_of_constant_term) - e.update_const(-1); - else - e.update_coef(farkas.get_local(v), -1); - - e.finalize(); - if (farkas_debug > 1) { - fprintf(DebugFile,"Constraint is %s\n", e.print_to_string().c_str()); - } - use_ugly_names--; -} - - -Relation Farkas(NOT_CONST Relation &input_R, Farkas_Type op, bool early_bailout) { - assert(!input_R.is_null()); - int saved_use_ugly_names = use_ugly_names; - - use_ugly_names++; - farkasDifficulty = 0; - - Relation R = consume_and_regurgitate(input_R); - - if (op == Basic_Farkas || op == Decoupled_Farkas) { - R.simplify(2, 4); - R = Approximate(R, false); - } - - Relation result = Relation::False(R); - - if (farkas_debug) { - fprintf(DebugFile,"Computing farka of: [\n"); - R.prefix_print(DebugFile); - } - - Variable_ID_Tuple vars; - for (Variable_ID_Iterator v(*R.global_decls()); v; v++) vars.append(*v); - if (R.is_set()) - for(int i=1; i <= R.n_set(); i++) vars.append(R.set_var(i)); - else { - int i; - for(i=1; i <= R.n_inp(); i++) vars.append(R.input_var(i)); - for(i=1; i <= R.n_out(); i++) vars.append(R.output_var(i)); - } - - Set empty; - Variable_ID_Tuple owners; - Map > connectedVariables(empty); - - if (op == Decoupled_Farkas) { - for (Variable_ID_Iterator v(*R.global_decls()); v; v++) - if ((*v)->kind() == Global_Var) { - Global_Var_ID g = (*v)->get_global_var(); - if (g->arity() > 0) { - if (R.is_set()) - for(int i=1; i <= g->arity(); i++) - (*v)->UF_union(R.set_var(i)); - else if ((*v)->function_of() == Input_Tuple) - for(int i=1; i <= g->arity(); i++) - (*v)->UF_union(R.input_var(i)); - else - for(int i=1; i <= g->arity(); i++) - (*v)->UF_union(R.output_var(i)); - } - } - - for (DNF_Iterator s(R.query_DNF()); s.live(); s.next()) { - for (Variable_ID_Iterator v1(*(*s)->variables()); v1; v1++) { - for (EQ_Iterator eq = (*s)->EQs(); eq.live(); eq.next()) - if ((*eq).get_coef(*v1)) - for (Variable_ID_Iterator v2(*(*s)->variables()); v2; v2++) - if ((*eq).get_coef(*v2)) - (*v1)->UF_union(*v2); - for (GEQ_Iterator g = (*s)->GEQs(); g.live(); g.next()) - if ((*g).get_coef(*v1)) - for (Variable_ID_Iterator v2(*(*s)->variables()); v2; v2++) - if ((*g).get_coef(*v2)) - (*v1)->UF_union(*v2); - } - } - for (Variable_ID_Iterator v3(vars); v3.live(); v3.next()) - connectedVariables[(*v3)->UF_owner()] |= *v3; - - foreach_map(v,Variable_ID,s,Set,connectedVariables, - owners.append(v); - if (farkas_debug) { - fprintf(DebugFile,"%s:",v->char_name()); - foreach(v2,Variable_ID,s, - fprintf(DebugFile," %s",v2->char_name()); - ); - fprintf(DebugFile,"\n"); - } - ); - } - - Variable_ID_Iterator varGroup(owners); - int lambda_cnt = 1; - - Relation partialResult; - bool firstGroup = true; - try { - while ((op == Decoupled_Farkas && varGroup.live()) - || (op != Decoupled_Farkas && firstGroup)) { - - if (farkas_debug && op == Decoupled_Farkas) { - fprintf(DebugFile,"[Computing decoupled farkas for:"); - foreach(v2,Variable_ID,connectedVariables(varGroup.curr()), - fprintf(DebugFile," %s",v2->char_name()); - ); - fprintf(DebugFile,"\n"); - } - firstGroup = false; - partialResult = Relation::True(R); - coef_t difficulty = 0; - for (DNF_Iterator s(R.query_DNF()); s.live(); s.next()) { - int nz; - coef_t m,sum; - (*s)->difficulty(nz,m,sum); - difficulty = max((coef_t) nz,2*nz+2*m+sum); - if (farkas_debug) { - fprintf(DebugFile,"Computing farka of conjunct: \n"); - (*s)->prefix_print(DebugFile); - fprintf(DebugFile,"Difficulty is " coef_fmt "(%d," coef_fmt "," coef_fmt ")\n", difficulty,nz,m,sum); - } - if (early_bailout && difficulty >= 500) { - farkasDifficulty = difficulty; - if (farkas_debug) { - fprintf(DebugFile,"Too ugly, returning dull result\n"); - } - use_ugly_names--; - if (op == Basic_Farkas || op == Decoupled_Farkas) - return Relation::False(partialResult); - else return Relation::True(partialResult); - } - Relation farkas = Relation::Empty(R); - farkas.copy_names(R); - F_Exists* exist = farkas.add_exists(); - F_And* and_node = exist->add_and(); - Map gMap((Variable_ID)0); - Map eMap((Variable_ID)0); - for (EQ_Iterator eq = (*s)->EQs(); eq.live(); eq.next()) { - if (op == Decoupled_Farkas) { - bool ShouldConsider = true; - for (Variable_ID_Iterator v(*(*s)->variables()); v; v++) { - if ((*eq).get_coef(*v) != 0 - && (*v)->UF_owner() != varGroup.curr()) { - ShouldConsider = false; - break; - } - } - if (!ShouldConsider) continue; - } - char s[10]; - sprintf(s, "lambda%d", lambda_cnt++); - eMap[*eq] = exist->declare(s); - assert(op == Basic_Farkas || op == Decoupled_Farkas - || (*eq).get_const() == 0); - } - for (GEQ_Iterator g = (*s)->GEQs(); g.live(); g.next()) { - if (op == Decoupled_Farkas) { - bool ShouldConsider = true; - for (Variable_ID_Iterator v(*(*s)->variables()); v; v++) { - if ((*g).get_coef(*v) != 0 - && (*v)->UF_owner() != varGroup.curr()) { - ShouldConsider = false; - break; - } - } - if (!ShouldConsider) continue; - } - char s[10]; - sprintf(s, "lambda%d", lambda_cnt++); - Variable_ID lambda = exist->declare(s); - GEQ_Handle positive; - switch(op) { - case Positive_Combination_Farkas: - case Convex_Combination_Farkas: - case Basic_Farkas: - case Decoupled_Farkas: - positive = and_node->add_GEQ(); - positive.update_coef(lambda, 1); - positive.finalize(); - break; - case Linear_Combination_Farkas: - case Affine_Combination_Farkas: - break; - } - gMap[*g] = lambda; - assert(op == Basic_Farkas || op == Decoupled_Farkas || (*g).get_const() == 0); - } - - for (Variable_ID_Iterator v(vars); v; v++) { - assert((*v)->kind() != Wildcard_Var); - if ((*v)->kind() == Global_Var - && (*v)->get_global_var() == coefficient_of_constant_term) { - assert(op != Basic_Farkas && op != Decoupled_Farkas); - if (op == Linear_Combination_Farkas) continue; - if (op == Positive_Combination_Farkas) continue; - } - if (op == Decoupled_Farkas && (*v)->UF_owner() != varGroup.curr()) { - EQ_Handle e = and_node->add_EQ(); - e.update_coef(farkas.get_local(*v),-1); - continue; - } - handleVariable(farkas, *s, and_node, gMap,eMap, *v); - } - - if (op == Basic_Farkas || op == Decoupled_Farkas) { - GEQ_Handle e = and_node->add_GEQ(); - e.update_coef(farkas.get_local(coefficient_of_constant_term),1); - for (GEQ_Iterator g = s.curr()->GEQs(); g.live(); g.next()) - if (gMap(*g) != (Variable_ID) 0) - e.update_coef( gMap(*g),-(*g).get_const()); - for (EQ_Iterator eq = s.curr()->EQs(); eq.live(); eq.next()) - if (eMap(*eq) != (Variable_ID) 0) - e.update_coef(eMap(*eq),-(*eq).get_const()); - e.finalize(); - } - - // lambda variables are not integers, so disable integer problem solving, - // we just mark it as simplified. - farkas.simplify(-1, -1); - - farkas.single_conjunct()->difficulty(nz,m,sum); - difficulty = max((coef_t) nz,2*nz+2*m+sum); - if (farkas_debug) { - fprintf(DebugFile,"farka has difficulty " coef_fmt "(%d," coef_fmt "," coef_fmt "):\n", difficulty,nz,m,sum); - farkas.prefix_print(DebugFile); - } - if (early_bailout && difficulty >= 500) { - farkasDifficulty = difficulty; - if (farkas_debug) { - fprintf(DebugFile,"Too ugly, returning dull result\n"); - } - use_ugly_names--; - if (op == Basic_Farkas || op == Decoupled_Farkas) - return Relation::False(partialResult); - else return Relation::True(partialResult); - } - farkas = Approximate(farkas); - if (farkas_debug) { - fprintf(DebugFile,"simplified:\n"); - farkas.prefix_print(DebugFile); - } - partialResult = Approximate(Intersection(partialResult,farkas)); - if (farkas_debug) { - fprintf(DebugFile,"combined:\n"); - partialResult.prefix_print(DebugFile); - } - if (partialResult.has_single_conjunct()) { - partialResult.single_conjunct()->difficulty(nz,m,sum); - difficulty = max((coef_t) nz,2*nz+2*m+sum); - } - else - difficulty = 1000; - if (early_bailout && difficulty >= 500) { - farkasDifficulty = difficulty; - if (farkas_debug) { - fprintf(DebugFile,"Too ugly, returning dull result\n"); - } - use_ugly_names--; - if (op == Basic_Farkas || op == Decoupled_Farkas) - return Relation::False(partialResult); - else return Relation::True(partialResult); - } - } - farkasDifficulty += difficulty; - - if (farkas_debug) { - fprintf(DebugFile,"] done computing farkas\n"); - partialResult.prefix_print(DebugFile); - } - - if (op == Decoupled_Farkas) { - result = Union(result,partialResult); - varGroup.next(); - } - } - } - catch (const std::overflow_error &e) { - // clear global variables - inApproximateMode = 0; - use_ugly_names = saved_use_ugly_names; - - if (early_bailout) { - if (farkasDifficulty < 1000) - farkasDifficulty = 1000; - // return dull result - if (op == Basic_Farkas || op == Decoupled_Farkas) - return Relation::False(partialResult); - else - return Relation::True(partialResult); - } - else - throw std::overflow_error("farkas too ugly"); - } - - if (1 || op == Decoupled_Farkas) { - foreach(v,Variable_ID,vars, reset_remap_field(v)); - } - use_ugly_names--; - if (op == Decoupled_Farkas) { - if (farkas_debug) { - fprintf(DebugFile,"] decoupled result:\n"); - result.prefix_print(DebugFile); - } - return result; - } - return partialResult; -} - -} // namespace diff --git a/omega/omega_lib/src/hull.cc b/omega/omega_lib/src/hull.cc deleted file mode 100644 index f1b0601..0000000 --- a/omega/omega_lib/src/hull.cc +++ /dev/null @@ -1,1489 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 University of Maryland - Copyright (C) 2008 University of Southern California - Copyright (C) 2009-2010 University of Utah - All Rights Reserved. - - Purpose: - Various hull calculations. - - Notes: - - History: - 06/15/09 ConvexRepresentation, Chun Chen - 11/25/09 RectHull, Chun Chen -*****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace omega { - -int hull_debug = 0; - -Relation ConvexHull(NOT_CONST Relation &R) { - Relation S = Approximate(consume_and_regurgitate(R)); - if (!S.is_upper_bound_satisfiable()) - return S; - if (S.has_single_conjunct()) - return S; - return Farkas(Farkas(S,Basic_Farkas), Convex_Combination_Farkas); -} - -Relation DecoupledConvexHull(NOT_CONST Relation &R) { - Relation S = Approximate(consume_and_regurgitate(R)); - if (!S.is_upper_bound_satisfiable()) - return S; - if (S.has_single_conjunct()) - return S; - return Farkas(Farkas(S,Decoupled_Farkas), Convex_Combination_Farkas); -} - -Relation AffineHull(NOT_CONST Relation &R) { - Relation S = Approximate(consume_and_regurgitate(R)); - if (!S.is_upper_bound_satisfiable()) - return S; - return Farkas(Farkas(S,Basic_Farkas), Affine_Combination_Farkas); -} - -Relation LinearHull(NOT_CONST Relation &R) { - Relation S = Approximate(consume_and_regurgitate(R)); - if (!S.is_upper_bound_satisfiable()) - return S; - return Farkas(Farkas(S,Basic_Farkas), Linear_Combination_Farkas); -} - -Relation ConicHull(NOT_CONST Relation &R) { - Relation S = Approximate(consume_and_regurgitate(R)); - if (!S.is_upper_bound_satisfiable()) - return S; - return Farkas(Farkas(S,Basic_Farkas), Positive_Combination_Farkas); -} - - -Relation FastTightHull(NOT_CONST Relation &input_R, NOT_CONST Relation &input_H) { - Relation R = Approximate(consume_and_regurgitate(input_R)); - Relation H = Approximate(consume_and_regurgitate(input_H)); - - if (hull_debug) { - fprintf(DebugFile,"[ Computing FastTightHull of:\n"); - R.prefix_print(DebugFile); - fprintf(DebugFile,"given known hull of:\n"); - H.prefix_print(DebugFile); - } - - if (!H.has_single_conjunct()) { - if (hull_debug) - fprintf(DebugFile, "] bailing out of FastTightHull, known hull not convex\n"); - return H; - } - - if (!H.is_obvious_tautology()) { - R = Gist(R,copy(H)); - R.simplify(1,0); - } - - if (R.has_single_conjunct()) { - R = Intersection(R,H); - if (hull_debug) { - fprintf(DebugFile, "] quick easy answer to FastTightHull\n"); - R.prefix_print(DebugFile); - } - return R; - } - if (R.has_local(coefficient_of_constant_term)) { - if (hull_debug) { - fprintf(DebugFile, "] Can't handle recursive application of Farkas lemma\n"); - } - return H; - } - - if (hull_debug) { - fprintf(DebugFile,"Gist of R given H is:\n"); - R.prefix_print(DebugFile); - } - - if (1) { - Set vars; - int conjuncts = 0; - for (DNF_Iterator s(R.query_DNF()); s.live(); s.next()) { - conjuncts++; - for (Variable_ID_Iterator v(*((*s)->variables())); v.live(); v++) { - bool found = false; - for (EQ_Iterator eq = (*s)->EQs(); eq.live(); eq.next()) - if ((*eq).get_coef(*v) != 0) { - if (!found) vars.insert(*v); - found = true; - break; - } - if (!found) - for (GEQ_Iterator geq = (*s)->GEQs(); geq.live(); geq.next()) - if ((*geq).get_coef(*v) != 0) { - if (!found) vars.insert(*v); - found = true; - break; - } - } - } - - - // We now know which variables appear in R - if (hull_debug) { - fprintf(DebugFile,"Variables we need a better hull on are: "); - foreach(v,Variable_ID,vars, - fprintf(DebugFile," %s",v->char_name())); - fprintf(DebugFile,"\n"); - } - Conjunct *c = H.single_conjunct(); - int total=0; - int copied = 0; - for (EQ_Iterator eq = c->EQs(); eq.live(); eq.next()) { - total++; - foreach(v,Variable_ID,vars, - if ((*eq).get_coef(v) != 0) { - R.and_with_EQ(*eq); - copied++; - break; // out of variable loop - } - ); - } - for (GEQ_Iterator geq = c->GEQs(); geq.live(); geq.next()) { - total++; - foreach(v,Variable_ID,vars, - if ((*geq).get_coef(v) != 0) { - R.and_with_GEQ(*geq); - copied++; - break; // out of variable loop - } - ); - } - if (copied < total) { - R = Approximate(R); - - if (hull_debug) { - fprintf(DebugFile,"Decomposed relation, copied only %d of %d constraints\n",copied,total); - fprintf(DebugFile,"Original R:\n"); - R.prefix_print(DebugFile); - fprintf(DebugFile,"Known hull:\n"); - H.prefix_print(DebugFile); - fprintf(DebugFile,"New R:\n"); - R.prefix_print(DebugFile); - } - } - } - - Relation F = Farkas(copy(R), Basic_Farkas, true); - if (hull_debug) - fprintf(DebugFile,"Farkas Difficulty = " coef_fmt "\n", farkasDifficulty); - if (farkasDifficulty > 260) { - if (hull_debug) { - fprintf(DebugFile, "] bailing out, farkas is way too complex\n"); - fprintf(DebugFile,"Farkas:\n"); - F.prefix_print(DebugFile); - } - return H; - } - else if (farkasDifficulty > 130) { - // Bail out - if (hull_debug) { - fprintf(DebugFile, coef_fmt " non-zeros in original farkas\n", farkasDifficulty); - } - Relation tmp = Farkas(R, Decoupled_Farkas, true); - - if (hull_debug) { - fprintf(DebugFile, coef_fmt " non-zeros in decoupled farkas\n", farkasDifficulty); - } - if (farkasDifficulty > 260) { - if (hull_debug) { - fprintf(DebugFile, "] bailing out, farkas is way too complex\n"); - fprintf(DebugFile,"Farkas:\n"); - F.prefix_print(DebugFile); - } - return H; - } - else { - if (farkasDifficulty > 130) - R = Intersection(H, Farkas(tmp, Affine_Combination_Farkas, true)); - else R = Intersection(H, - Intersection(Farkas(tmp, Convex_Combination_Farkas, true), - Farkas(F, Affine_Combination_Farkas, true))); - if (hull_debug) { - fprintf(DebugFile, "] bailing out, farkas is too complex, using affine hull\n"); - fprintf(DebugFile,"Farkas:\n"); - F.prefix_print(DebugFile); - fprintf(DebugFile,"Affine hull:\n"); - R.prefix_print(DebugFile); - } - return R; - } - } - - R = Intersection(H, Farkas(F, Convex_Combination_Farkas, true)); - if (hull_debug) { - fprintf(DebugFile, "] Result of FastTightHull:\n"); - R.prefix_print(DebugFile); - } - return R; -} - - - -namespace { - bool parallel(const GEQ_Handle &g1, const GEQ_Handle &g2) { - for(Constr_Vars_Iter cvi(g1, false); cvi; cvi++) { - coef_t c1 = (*cvi).coef; - coef_t c2 = g2.get_coef((*cvi).var); - if (c1 != c2) return false; - } - { - for(Constr_Vars_Iter cvi(g2, false); cvi; cvi++) { - coef_t c1 = g1.get_coef((*cvi).var); - coef_t c2 = (*cvi).coef; - if (c1 != c2) return false; - } - } - return true; - } - - - bool hull(const EQ_Handle &e, const GEQ_Handle &g, coef_t &hull) { - int sign = 0; - for(Constr_Vars_Iter cvi(e, false); cvi; cvi++) { - coef_t c1 = (*cvi).coef; - coef_t c2 = g.get_coef((*cvi).var); - if (sign == 0) sign = (c1*c2>=0?1:-1); - if (sign*c1 != c2) return false; - } - assert(sign != 0); - { - for(Constr_Vars_Iter cvi(g, false); cvi; cvi++) { - coef_t c1 = e.get_coef((*cvi).var); - coef_t c2 = (*cvi).coef; - if (sign*c1 != c2) return false; - } - } - hull = max(sign * e.get_const(), g.get_const()); - if (hull_debug) { - fprintf(DebugFile,"Hull of:\n %s\n", e.print_to_string().c_str()); - fprintf(DebugFile," %s\n", g.print_to_string().c_str()); - fprintf(DebugFile,"is " coef_fmt "\n\n",hull); - } - return true; - } - - bool eq(const EQ_Handle &e1, const EQ_Handle &e2) { - int sign = 0; - for(Constr_Vars_Iter cvi(e1, false); cvi; cvi++) { - coef_t c1 = (*cvi).coef; - coef_t c2 = e2.get_coef((*cvi).var); - if (sign == 0) sign = (c1*c2>=0?1:-1); - if (sign*c1 != c2) return false; - } - assert(sign != 0); - { - for(Constr_Vars_Iter cvi(e2, false); cvi; cvi++) { - coef_t c1 = e1.get_coef((*cvi).var); - coef_t c2 = (*cvi).coef; - if (sign*c1 != c2) return false; - } - } - return sign * e1.get_const() == e2.get_const(); - } -} - - -// This function is deprecated!!! -Relation QuickHull(Relation &R) { - Tuple Rs(1); - Rs[1] = R; - return QuickHull(Rs); -} - - -// This function is deprecated!!! -Relation QuickHull(Tuple &Rs) { - assert(!Rs.empty()); - - // if (Rs.size() == 1) return Rs[1]; - - Tuple l_Rs; - for (int i = 1; i <= Rs.size(); i++) - for (DNF_Iterator c(Rs[i].query_DNF()); c; c++) { - Relation r = Relation(Rs[i], c.curr()); - l_Rs.append(Approximate(r)); - } - - if (l_Rs.size() == 1) - return l_Rs[1]; - - Relation result = Relation::True(Rs[1]); - result.copy_names(Rs[1]); - - use_ugly_names++; - - if (hull_debug > 1) - for (int i = 1; i <= l_Rs.size(); i++) { - fprintf(DebugFile,"#%d \n",i); - l_Rs[i].prefix_print(DebugFile); - } - - -// Relation R = copy(Rs[1]); -// for (int i = 2; i <= Rs.size(); i++) -// R = Union(R,copy(Rs[i])); - -// #if 0 -// if (!R.is_set()) { -// if (R.n_inp() == R.n_out()) { -// Relation AC = DeltasToRelation(Hull(Deltas(copy(R), -// min(R.n_inp(),R.n_out()))), -// R.n_inp(),R.n_out()); -// Relation dH = Hull(Domain(copy(R)),false); -// Relation rH = Hull(Range(copy(R)),false); -// result = Intersection(AC,Cross_Product(dH,rH)); -// } -// else { -// Relation dH = Hull(Domain(copy(R)),false); -// Relation rH = Hull(Range(copy(R)),false); -// result = Cross_Product(dH,rH); -// assert(Must_Be_Subset(copy(R),copy(result))); -// } -// } - -// #endif - - Conjunct *first; - l_Rs[1] = EQs_to_GEQs(l_Rs[1]); - first = l_Rs[1].single_conjunct(); - for (GEQ_Iterator candidate(first->GEQs()); candidate.live(); candidate.next()) { - coef_t maxConstantTerm = (*candidate).get_const(); - bool found = true; - if (hull_debug > 1) { - fprintf(DebugFile,"searching for bound on:\n %s\n", (*candidate).print_to_string().c_str()); - } - for (int i = 2; i <= l_Rs.size(); i++) { - Conjunct *other = l_Rs[i].single_conjunct(); - bool found_for_i = false; - for (GEQ_Iterator target(other->GEQs()); target.live(); target.next()) { - if (hull_debug > 2) { - fprintf(DebugFile,"candidate:\n %s\n", (*candidate).print_to_string().c_str()); - fprintf(DebugFile,"target:\n %s\n", (*target).print_to_string().c_str()); - } - if (parallel(*candidate,*target)) { - if (hull_debug > 1) - fprintf(DebugFile,"Found bound:\n %s\n", (*target).print_to_string().c_str()); - maxConstantTerm = max(maxConstantTerm,(*target).get_const()); - found_for_i = true; - break; - } - } - if (!found_for_i) { - for (EQ_Iterator target_e(other->EQs()); target_e.live(); target_e.next()) { - coef_t h; - if (hull(*target_e,*candidate,h)) { - if (hull_debug > 1) - fprintf(DebugFile,"Found bound of " coef_fmt ":\n %s\n", h, (*target_e).print_to_string().c_str()); - maxConstantTerm = max(maxConstantTerm,h); - found_for_i = true; - break; - } - }; - if (!found_for_i) { - if (hull_debug > 1) { - fprintf(DebugFile,"No bound found in:\n"); - fprintf(DebugFile, "%s", l_Rs[i].print_with_subs_to_string().c_str()); - } - //if nothing found - found = false; - break; - } - } - } - - if (found) { - GEQ_Handle h = result.and_with_GEQ(); - copy_constraint(h,*candidate); - if (hull_debug > 1) - fprintf(DebugFile,"Setting constant term to " coef_fmt " in\n %s\n", maxConstantTerm, h.print_to_string().c_str()); - h.update_const(maxConstantTerm - (*candidate).get_const()); - if (hull_debug > 1) - fprintf(DebugFile,"Updated constraint is\n %s\n", h.print_to_string().c_str()); - } - } - - - for (EQ_Iterator candidate_eq(first->EQs()); candidate_eq.live(); candidate_eq.next()) { - bool found = true; - for (int i = 2; i <= l_Rs.size(); i++) { - Conjunct *C = l_Rs[i].single_conjunct(); - bool found_for_i = false; - - for (EQ_Iterator target(C->EQs()); target.live(); target.next()) { - if (eq(*candidate_eq,*target)) { - found_for_i = true; - break; - } - } - if (!found_for_i) { - //if nothing found - found = false; - break; - } - } - - if (found) { - EQ_Handle h = result.and_with_EQ(); - copy_constraint(h,*candidate_eq); - if (hull_debug > 1) - fprintf(DebugFile,"Adding eq constraint: %s\n", h.print_to_string().c_str()); - } - } - - use_ugly_names--; - if (hull_debug > 1) { - fprintf(DebugFile,"quick hull is of:"); - result.print_with_subs(DebugFile); - } - return result; -} - - -// Relation Hull2(Tuple &Rs, Tuple &active) { -// assert(Rs.size() == active.size() && Rs.size() > 0); - -// Tuple l_Rs; -// for (int i = 1; i <= Rs.size(); i++) -// if (active[i]) -// l_Rs.append(copy(Rs[i])); - -// if (l_Rs.size() == 0) -// return Relation::False(Rs[1]); - -// try { -// Relation r = l_Rs[1]; -// for (int i = 2; i <= l_Rs.size(); i++) { -// r = Union(r, copy(l_Rs[i])); -// r.simplify(); -// } - -// // Relation F = Farkas(r, Basic_Farkas, true); -// // if (farkasDifficulty >= 500) -// // throw std::overflow_error("loop convex hull too complicated."); -// // F = Farkas(F, Convex_Combination_Farkas, true); -// return Farkas(Farkas(r, Basic_Farkas, true), Convex_Combination_Farkas, true); -// } -// catch (std::overflow_error) { -// return QuickHull(l_Rs); -// } -// } - - -namespace { - void printRs(Tuple &Rs) { - fprintf(DebugFile,"Rs:\n"); - for (int i = 1; i <= Rs.size(); i++) - fprintf(DebugFile,"#%d : %s\n",i, - Rs[i].print_with_subs_to_string().c_str()); - } -} - -Relation BetterHull(Tuple &Rs, bool stridesAllowed, bool checkSubsets, - NOT_CONST Relation &input_knownHull = Relation::Null()) { - Relation knownHull = consume_and_regurgitate(input_knownHull); - static int OMEGA_WHINGE = -1; - if (OMEGA_WHINGE < 0) { - OMEGA_WHINGE = getenv("OMEGA_WHINGE") ? atoi(getenv("OMEGA_WHINGE")) : 0; - } - assert(!Rs.empty()); - if (Rs.size() == 1) { - if (stridesAllowed) return Rs[1]; - else return Approximate(Rs[1]); - } - - if (checkSubsets) { - Tuple live(Rs.size()); - if (hull_debug) { - fprintf(DebugFile,"Checking subsets in hull computation:\n"); - printRs(Rs); - } - int i; - for(i=1;i <=Rs.size(); i++) live[i] = true; - for(i=1;i <=Rs.size(); i++) - for(int j=1;j <=Rs.size(); j++) if (i != j && live[j]) { - if (hull_debug) fprintf(DebugFile,"checking %d Is_Obvious_Subset %d\n",i,j); - if (Is_Obvious_Subset(copy(Rs[i]),copy(Rs[j]))) { - if (hull_debug) fprintf(DebugFile,"yes...\n"); - live[i] = false; - break; - } - } - for(i=1;i <=Rs.size(); i++) if (!live[i]) { - if (i < Rs.size()) { - Rs[i] = Rs[Rs.size()]; - live[i] = live[Rs.size()]; - } - Rs[Rs.size()] = Relation(); - Rs.delete_last(); - i--; - } - } - Relation hull; - if (hull_debug) { - fprintf(DebugFile,"Better Hull:\n"); - printRs(Rs); - fprintf(DebugFile,"known hull: %s\n", knownHull.print_with_subs_to_string().c_str()); - } - if (knownHull.is_null()) hull = QuickHull(Rs); - else hull = Intersection(QuickHull(Rs),knownHull); - // for (int i = 1; i <= Rs.size(); i++) - // hull = RectHull(Union(hull, copy(Rs[i]))); - // hull = Intersection(hull, knownHull); - hull.simplify(); - if (hull_debug) { - fprintf(DebugFile,"quick hull: %s\n", hull.print_with_subs_to_string().c_str()); - } - - Relation orig = Relation::False(Rs[1]); - int i; - for (i = 1; i <= Rs.size(); i++) - orig = Union(orig,copy(Rs[i])); - - orig.simplify(); - - for (i = 1; i <= Rs.size(); i++) { - if (!hull.is_obvious_tautology()) Rs[i] = Gist(Rs[i],copy(hull)); - Rs[i].simplify(); - if (Rs[i].is_obvious_tautology()) return hull; - if (Rs[i].has_single_conjunct()) { - Rs[i] = EQs_to_GEQs(Rs[i]); - if (hull_debug) { - fprintf(DebugFile,"Checking for hull constraints in:\n %s\n", Rs[i].print_with_subs_to_string().c_str()); - } - Conjunct *c = Rs[i].single_conjunct(); - for (GEQ_Iterator g(c->GEQs()); g.live(); g.next()) { - Relation tmp = Relation::True(Rs[i]); - tmp.and_with_GEQ(*g); - if (!Difference(copy(orig),tmp).is_upper_bound_satisfiable()) - hull.and_with_GEQ(*g); - } - for (EQ_Iterator e(c->EQs()); e.live(); e.next()) { - Relation tmp = Relation::True(Rs[i]); - tmp.and_with_EQ(*e); - if (!Difference(copy(orig),tmp).is_upper_bound_satisfiable()) - hull.and_with_EQ(*e); - } - } - } - - hull = FastTightHull(orig,hull); - assert(hull.has_single_conjunct()); - - if (stridesAllowed) return hull; - else return Approximate(hull); - -} - - - -Relation Hull(NOT_CONST Relation &S, - bool stridesAllowed, - int effort, - NOT_CONST Relation &knownHull) { - Relation R = consume_and_regurgitate(S); - R.simplify(1,0); - if (!R.is_upper_bound_satisfiable()) return R; - Tuple Rs; - for (DNF_Iterator c(R.query_DNF()); c.live(); ) { - Rs.append(Relation(R,c.curr())); - c.next(); - } - if (effort == 1) - return BetterHull(Rs,stridesAllowed,false,knownHull); - else - return QuickHull(Rs); -} - - - -Relation Hull(Tuple &Rs, - Tuple &validMask, - int effort, - bool stridesAllowed, - NOT_CONST Relation &knownHull) { - // Use relation of index i only when validMask[i] != 0 - Tuple Rs2; - for(int i = 1; i <= Rs.size(); i++) { - if (validMask[i]) { - Rs[i].simplify(); - for (DNF_Iterator c(Rs[i].query_DNF()); c.live(); ) { - Rs2.append(Relation(Rs[i],c.curr())); - c.next(); - } - } - } - assert(effort == 0 || effort == 1); - if (effort == 1) - return BetterHull(Rs2,stridesAllowed,true,knownHull); - else - return QuickHull(Rs2); -} - - -// This function is deprecated!!! -Relation CheckForConvexRepresentation(NOT_CONST Relation &R_In) { - Relation R = consume_and_regurgitate(R_In); - Relation h = Hull(copy(R)); - if (!Difference(copy(h),copy(R)).is_upper_bound_satisfiable()) - return h; - else - return R; -} - -// This function is deprecated!!! -Relation CheckForConvexPairs(NOT_CONST Relation &S) { - Relation R = consume_and_regurgitate(S); - Relation hull = FastTightHull(copy(R),Relation::True(R)); - R.simplify(1,0); - if (!R.is_upper_bound_satisfiable() || R.number_of_conjuncts() < 2) return R; - Tuple Rs; - for (DNF_Iterator c(R.query_DNF()); c.live(); ) { - Rs.append(Relation(R,c.curr())); - c.next(); - } - - bool *dead = new bool[Rs.size()+1]; - int i; - for(i = 1; i<=Rs.size();i++) dead[i] = false; - - for(i = 1; i<=Rs.size();i++) - if (!dead[i]) - for(int j = i+1; j<=Rs.size();j++) if (!dead[j]) { - if (hull_debug) { - fprintf(DebugFile,"Comparing #%d and %d\n",i,j); - } - Relation U = Union(copy(Rs[i]),copy(Rs[j])); - Relation H_ij = FastTightHull(copy(U),copy(hull)); - if (!Difference(copy(H_ij),U).is_upper_bound_satisfiable()) { - Rs[i] = H_ij; - dead[j] = true; - if (hull_debug) { - fprintf(DebugFile,"Combined them\n"); - } - } - } - i = 1; - while(i<=Rs.size() && dead[i]) i++; - assert(i<=Rs.size()); - R = Rs[i]; - i++; - for(; i<=Rs.size();i++) - if (!dead[i]) - R = Union(R,Rs[i]); - delete []dead; - return R; -} - -// -// Supporting functions for ConvexRepresentation -// -namespace { -struct Interval { - std::list >::iterator pos; - coef_t lb; - coef_t ub; - bool change; - coef_t modulo; - Interval(std::list >::iterator pos_, coef_t lb_, coef_t ub_): - pos(pos_), lb(lb_), ub(ub_) {} - friend bool operator<(const Interval &a, const Interval &b); -}; - -bool operator<(const Interval &a, const Interval &b) { - return a.lb < b.lb; -} - -struct Modulo_Interval { - coef_t modulo; - coef_t start; - coef_t size; - Modulo_Interval(coef_t modulo_, coef_t start_, coef_t size_): - modulo(modulo_), start(start_), size(size_) {} - friend bool operator<(const Interval &a, const Interval &b); -}; - -bool operator<(const Modulo_Interval &a, const Modulo_Interval &b) { - if (a.modulo == b.modulo) { - if (a.start == b.start) - return a.size < b.size; - else - return a.start < b.start; - } - else - return a.modulo < b.modulo; -} - -void merge_intervals(std::list &intervals, coef_t modulo, std::list > &Rs, std::list >::iterator orig) { - // normalize intervals - for (std::list::iterator i = intervals.begin(); i != intervals.end(); i++) { - (*i).modulo = modulo; - (*i).change = false; - if ((*i).ub - (*i).lb + 1>= modulo) { - (*i).lb = 0; - (*i).ub = modulo - 1; - } - else if ((*i).ub < 0 || (*i).lb >= modulo) { - coef_t range = (*i).ub - (*i).lb; - (*i).lb = int_mod((*i).lb, modulo); - (*i).ub = (*i).lb + range; - } - } - - intervals.sort(); - - // merge neighboring intervals - std::list::iterator p = intervals.begin(); - while (p != intervals.end()) { - std::list::iterator q = p; - q++; - while (q != intervals.end()) { - if ((*p).ub + 1 >= (*q).lb) { - Relation hull = ConvexHull(Union(copy((*(*p).pos).first), copy((*(*q).pos).first))); - Relation remainder = Difference(Difference(copy(hull), copy((*(*p).pos).first)), copy((*(*q).pos).first)); - if (!remainder.is_upper_bound_satisfiable()) { - if ((*q).pos == orig) - std::swap((*p).pos, (*q).pos); - (*(*p).pos).first = hull; - (*p).ub = max((*p).ub, (*q).ub); - (*p).change = true; - Rs.erase((*q).pos); - q = intervals.erase(q); - } - else - break; - } - else - break; - } - - bool p_moved = false; - q = p; - q++; - while (q != intervals.end()) { - if ((*q).ub >= modulo && int_mod((*q).ub, modulo) + 1 >= (*p).lb) { - Relation hull = ConvexHull(Union(copy((*(*p).pos).first), copy((*(*q).pos).first))); - Relation remainder = Difference(Difference(copy(hull), copy((*(*p).pos).first)), copy((*(*q).pos).first)); - if (!remainder.is_upper_bound_satisfiable()) { - if ((*p).pos == orig) - std::swap((*p).pos, (*q).pos); - (*(*q).pos).first = hull; - coef_t t = (*p).ub - int_mod((*q).ub, modulo); - if (t > 0) - (*q).ub = (*q).ub + t; - (*q).change = true; - Rs.erase((*p).pos); - p = intervals.erase(p); - p_moved = true; - break; - } - else - q++; - } - else - q++; - } - - if (!p_moved) - p++; - } - - // merge by reducing the strengh of modulo - std::list modulo_intervals; - coef_t max_distance = modulo/2; - for (std::list::iterator p = intervals.begin(); p != intervals.end(); p++) { - if ((*p).lb >= max_distance) - break; - - coef_t size = (*p).ub - (*p).lb; - - std::list::iterator q = p; - q++; - while (q != intervals.end()) { - coef_t distance = (*q).lb - (*p).lb; - if (distance > max_distance) - break; - - if ((*q).ub - (*q).lb != size || int_mod(modulo, distance) != 0) { - q++; - continue; - } - - int num_reduced = 0; - coef_t looking_for = int_mod((*p).lb, distance); - for (std::list::iterator k = intervals.begin(); k != intervals.end(); k++) { - if ((*k).lb == looking_for && (*k).ub - (*k).lb == size) { - num_reduced++; - looking_for += distance; - if (looking_for >= modulo) - break; - } - else if ((*k).lb <= looking_for && (*k).ub >= looking_for + size) { - looking_for += distance; - if (looking_for >= modulo) - break; - } - else if ((*k).lb > looking_for) - break; - } - - if (looking_for >= modulo && num_reduced > 1) - modulo_intervals.push_back(Modulo_Interval(distance, int_mod((*p).lb, distance), size)); - - q++; - } - } - - modulo_intervals.sort(); - - // remove redundant reduced-strength intervals - std::list::iterator p2 = modulo_intervals.begin(); - while (p2 != modulo_intervals.end()) { - std::list::iterator q2 = p2; - q2++; - while (q2 != modulo_intervals.end()) { - if ((*p2).modulo == (*q2).modulo && (*p2).start == (*q2).start) - q2 = modulo_intervals.erase(q2); - else if (int_mod((*q2).modulo, (*p2).modulo) == 0 && - (*p2).start == int_mod((*q2).start, (*p2).modulo) && - (*p2).size >= (*q2).size) - q2 = modulo_intervals.erase(q2); - else - q2++; - } - p2++; - } - - // replace original intervals with new reduced-strength ones - for (std::list::iterator i = modulo_intervals.begin(); i != modulo_intervals.end(); i++) { - std::vector candidates; - int num_replaced = 0; - for (std::list::iterator j = intervals.begin(); j != intervals.end(); j++) - if (int_mod((*j).modulo, (*i).modulo) == 0 && - (*j).ub - (*j).lb >= (*i).size && - (int_mod((*j).lb, (*i).modulo) == (*i).start || - int_mod((*j).ub, (*i).modulo) == (*i).start + (*i).size)) { - candidates.push_back(&((*(*j).pos).first)); - if (int_mod((*j).lb, (*i).modulo) == (*i).start && - (*j).ub - (*j).lb == (*i).size) - num_replaced++; - } - if (num_replaced <= 1) - continue; - - Relation R = copy(*candidates[0]); - for (size_t k = 1; k < candidates.size(); k++) - R = Union(R, copy(*candidates[k])); - Relation hull = ConvexHull(copy(R)); - Relation remainder = Difference(copy(hull), copy(R)); - if (!remainder.is_upper_bound_satisfiable()) { - std::list::iterator replaced_one = intervals.end(); - for (std::list::iterator j = intervals.begin(); j != intervals.end();) - if (int_mod((*j).modulo, (*i).modulo) == 0 && - (*j).ub - (*j).lb >= (*i).size && - (int_mod((*j).lb, (*i).modulo) == (*i).start || - int_mod((*j).ub, (*i).modulo) == (*i).start + (*i).size)) { - if (int_mod((*j).lb, (*i).modulo) == (*i).start && - (*j).ub - (*j).lb == (*i).size) { - if (replaced_one == intervals.end()) { - (*(*j).pos).first = hull; - (*j).lb = int_mod((*j).lb, (*i).modulo); - (*j).ub = int_mod((*j).ub, (*i).modulo); - (*j).modulo = (*i).modulo; - (*j).change = true; - replaced_one = j; - j++; - } - else { - if ((*j).pos == orig) { - std::swap((*replaced_one).pos, (*j).pos); - (*(*replaced_one).pos).first = (*(*j).pos).first; - } - Rs.erase((*j).pos); - j = intervals.erase(j); - } - } - else { - if (int_mod((*j).lb, (*i).modulo) == (*i).start) - (*j).lb = (*j).lb + (*i).size + 1; - else - (*j).ub = (*j).ub - (*i).size - 1; - (*j).change = true; - j++; - } - } - else - j++; - } - } -} -} // namespace - - -// -// Simplify a union of sets/relations to a minimal (may not be -// optimal) number of convex regions. It intends to replace -// CheckForConvexRepresentation and CheckForConvexPairs functions. -// -Relation ConvexRepresentation(NOT_CONST Relation &R) { - Relation l_R = copy(R); - if (!l_R.is_upper_bound_satisfiable() || l_R.number_of_conjuncts() < 2) - return R; - - // separate each conjunct into smooth convex region and holes - std::list > Rs; // pair(smooth region, hole condition) - for (DNF_Iterator c(l_R.query_DNF()); c.live(); c++) { - Relation r1 = Relation(l_R, c.curr()); - Relation r2 = Approximate(copy(r1)); - r1 = Gist(r1, copy(r2)); - Rs.push_back(std::make_pair(r2, r1)); - } - - try { - bool change = true; - while (change) { - change = false; - - std::list >::iterator i = Rs.begin(); - while (i != Rs.end()) { - // find regions with identical hole conditions to merge - { - std::list >::iterator j = i; - j++; - while (j != Rs.end()) { - if (!Difference(copy((*i).second), copy((*j).second)).is_upper_bound_satisfiable() && - !Difference(copy((*j).second), copy((*i).second)).is_upper_bound_satisfiable()) { - if (Must_Be_Subset(copy((*j).first), copy((*i).first))) { - j = Rs.erase(j); - } - else if (Must_Be_Subset(copy((*i).first), copy((*j).first))) { - (*i).first = (*j).first; - j = Rs.erase(j); - change = true; - } - else { - Relation r; - bool already_use_recthull = false; - try { - // chun's debug - // throw std::runtime_error("dfdf"); - - r = ConvexHull(Union(copy((*i).first), copy((*j).first))); - } - catch (const std::overflow_error &e) { - r = RectHull(Union(copy((*i).first), copy((*j).first))); - already_use_recthull = true; - } - retry_recthull: - Relation r2 = Difference(Difference(copy(r), copy((*i).first)), copy((*j).first)); - if (!r2.is_upper_bound_satisfiable()) { // convex hull is tight - (*i).first = r; - j = Rs.erase(j); - change = true; - } - else { - if (!already_use_recthull) { - r = RectHull(Union(copy((*i).first), copy((*j).first))); - already_use_recthull = true; - goto retry_recthull; - } - else - j++; - } - } - } - else - j++; - } - } - - // find identical smooth regions as candidates for hole merge - std::list >::iterator> s; - for (std::list >::iterator j = Rs.begin(); j != Rs.end(); j++) - if (j != i) { - if (!Intersection(Difference(copy((*i).first), copy((*j).first)), copy((*j).second)).is_upper_bound_satisfiable() && - !Intersection(Difference(copy((*j).first), copy((*i).first)), copy((*i).second)).is_upper_bound_satisfiable()) - s.push_back(j); - } - - if (s.size() != 0) { - // convert hole condition c1*x1+c2*x2+... = c*alpha+d to a pair of inequalities - (*i).second = EQs_to_GEQs((*i).second, false); - - // find potential wildcards that can be used for hole conditions - std::set nonsingle_wild; - for (EQ_Iterator ei((*i).second.single_conjunct()); ei; ei++) - if ((*ei).has_wildcards()) - for (Constr_Vars_Iter cvi(*ei, true); cvi; cvi++) - nonsingle_wild.insert(cvi.curr_var()); - for (GEQ_Iterator gei((*i).second.single_conjunct()); gei; gei++) - if ((*gei).has_wildcards()) { - Constr_Vars_Iter cvi(*gei, true); - Constr_Vars_Iter cvi2 = cvi; - cvi2++; - if (cvi2) { - nonsingle_wild.insert(cvi.curr_var()); - for (; cvi2; cvi2++) - nonsingle_wild.insert(cvi2.curr_var()); - } - } - - // find hole condition in c*alpha+d1<=c1*x1+c2*x2+...<=c*alpha+d2 format - for (GEQ_Iterator gei((*i).second.single_conjunct()); gei; gei++) - if ((*gei).has_wildcards()) { - coef_t c; - Variable_ID v; - { - Constr_Vars_Iter cvi(*gei, true); - v = cvi.curr_var(); - c = cvi.curr_coef(); - if (c < 0 || nonsingle_wild.find(v) != nonsingle_wild.end()) - continue; - } - - coef_t lb = posInfinity; - for (GEQ_Iterator gei2((*i).second.single_conjunct()); gei2; gei2++) { - if (!(*gei2 == *gei) && (*gei2).get_coef(v) != 0) { - if (lb != posInfinity) { - nonsingle_wild.insert(v); - break; - } - - bool match = true; - for (Constr_Vars_Iter cvi2(*gei); cvi2; cvi2++) - if (cvi2.curr_coef() != -((*gei2).get_coef(cvi2.curr_var()))) { - match = false; - break; - } - if (match) - for (Constr_Vars_Iter cvi2(*gei2); cvi2; cvi2++) - if (cvi2.curr_coef() != -((*gei).get_coef(cvi2.curr_var()))) { - match = false; - break; - } - if (!match) { - nonsingle_wild.insert(v); - break; - } - - lb = -(*gei2).get_const(); - } - } - - if (nonsingle_wild.find(v) != nonsingle_wild.end()) - continue; - - Relation stride_cond = Relation::True((*i).second); - F_Exists *f_exists = stride_cond.and_with_and()->add_exists(); - Variable_ID e = f_exists->declare(); - F_And *f_root = f_exists->add_and(); - GEQ_Handle h1 = f_root->add_GEQ(); - GEQ_Handle h2 = f_root->add_GEQ(); - for (Constr_Vars_Iter cvi2(*gei); cvi2; cvi2++) { - Variable_ID v = cvi2.curr_var(); - switch (v->kind()) { - case Wildcard_Var: - h1.update_coef(e, cvi2.curr_coef()); - h2.update_coef(e, -cvi2.curr_coef()); - break; - case Global_Var: { - Global_Var_ID g = v->get_global_var(); - Variable_ID v2; - if (g->arity() == 0) - v2 = stride_cond.get_local(g); - else - v2 = stride_cond.get_local(g, v->function_of()); - h1.update_coef(v2, cvi2.curr_coef()); - h2.update_coef(v2, -cvi2.curr_coef()); - break; - } - default: - h1.update_coef(v, cvi2.curr_coef()); - h2.update_coef(v, -cvi2.curr_coef()); - } - } - h1.update_const((*gei).get_const()); - h2.update_const(-lb); - - stride_cond.simplify(); - Relation other_cond = Gist(copy((*i).second), copy(stride_cond)); - - // find regions with potential mergeable stride condition with this one - std::list intervals; - intervals.push_back(Interval(i, lb, (*gei).get_const())); - - for (std::list >::iterator>::iterator j = s.begin(); j != s.end(); j++) - if (Must_Be_Subset(copy((**j).second), copy(other_cond))) { - Relation stride_cond2 = Gist(copy((**j).second), copy(other_cond)); - - // interval can be removed - if (stride_cond2.is_obvious_tautology()) { - intervals.push_back(Interval(*j, 0, c-1)); - continue; - } - - stride_cond2 = EQs_to_GEQs(stride_cond2, false); - coef_t lb, ub; - GEQ_Iterator gei2(stride_cond2.single_conjunct()); - coef_t sign = 0; - for (Constr_Vars_Iter cvi(*gei2, true); cvi; cvi++) - if (sign != 0) { - sign = 0; - break; - } - else if (cvi.curr_coef() == c) - sign = 1; - else if (cvi.curr_coef() == -c) - sign = -1; - else { - sign = 0; - break; - } - if (sign == 0) - continue; - - bool match = true; - for (Constr_Vars_Iter cvi(*gei2); cvi; cvi++) { - Variable_ID v = cvi.curr_var(); - if (v->kind() == Wildcard_Var) - continue; - else if (v->kind() == Global_Var) { - Global_Var_ID g = v->get_global_var(); - if (g->arity() == 0) - v = (*i).second.get_local(g); - else - v = (*i).second.get_local(g, v->function_of()); - } - - if (cvi.curr_coef() != sign * (*gei).get_coef(v)) { - match = false; - break; - } - } - if (!match) - continue; - - for (Constr_Vars_Iter cvi(*gei); cvi; cvi++) { - Variable_ID v = cvi.curr_var(); - if (v->kind() == Wildcard_Var) - continue; - else if (v->kind() == Global_Var) { - Global_Var_ID g = v->get_global_var(); - if (g->arity() == 0) - v = stride_cond2.get_local(g); - else - v = stride_cond2.get_local(g, v->function_of()); - } - - if (cvi.curr_coef() != sign * (*gei2).get_coef(v)) { - match = false; - break; - } - } - if (!match) - continue; - if (sign > 0) - ub = (*gei2).get_const(); - else - lb = -(*gei2).get_const(); - - gei2++; - if (!gei2) - continue; - - coef_t sign2 = 0; - for (Constr_Vars_Iter cvi(*gei2, true); cvi; cvi++) - if (sign2 != 0) { - sign2 = 0; - break; - } - else if (cvi.curr_coef() == c) - sign2 = 1; - else if (cvi.curr_coef() == -c) - sign2 = -1; - else { - sign2 = 0; - break; - } - if (sign2 != -sign) - continue; - - for (Constr_Vars_Iter cvi(*gei2); cvi; cvi++) { - Variable_ID v = cvi.curr_var(); - if (v->kind() == Wildcard_Var) - continue; - else if (v->kind() == Global_Var) { - Global_Var_ID g = v->get_global_var(); - if (g->arity() == 0) - v = (*i).second.get_local(g); - else - v = (*i).second.get_local(g, v->function_of()); - } - - if (cvi.curr_coef() != sign2 * (*gei).get_coef(v)) { - match = false; - break; - } - } - if (!match) - continue; - - for (Constr_Vars_Iter cvi(*gei); cvi; cvi++) { - Variable_ID v = cvi.curr_var(); - if (v->kind() == Wildcard_Var) - continue; - else if (v->kind() == Global_Var) { - Global_Var_ID g = v->get_global_var(); - if (g->arity() == 0) - v = stride_cond2.get_local(g); - else - v = stride_cond2.get_local(g, v->function_of()); - } - - if (cvi.curr_coef() != sign2 * (*gei2).get_coef(v)) { - match = false; - break; - } - } - if (!match) - continue; - if (sign2 > 0) - ub = (*gei2).get_const(); - else - lb = -(*gei2).get_const(); - - gei2++; - if (gei2) - continue; - - intervals.push_back(Interval(*j, lb, ub)); - } - - merge_intervals(intervals, c, Rs, i); - - // make current region the last one being updated - bool invalid = false; - for (std::list::iterator ii = intervals.begin(); ii != intervals.end(); ii++) - if ((*ii).change && (*ii).pos == i) { - invalid = true; - intervals.push_back(*ii); - intervals.erase(ii); - break; - } - - // update hole condition for each region - for (std::list::iterator ii = intervals.begin(); ii != intervals.end(); ii++) - if ((*ii).change) { - change = true; - - if ((*ii).ub - (*ii).lb + 1 >= (*ii).modulo) - (*(*ii).pos).second = copy(other_cond); - else { - Relation stride_cond = Relation::True((*i).second); - F_Exists *f_exists = stride_cond.and_with_and()->add_exists(); - Variable_ID e = f_exists->declare(); - F_And *f_root = f_exists->add_and(); - GEQ_Handle h1 = f_root->add_GEQ(); - GEQ_Handle h2 = f_root->add_GEQ(); - for (Constr_Vars_Iter cvi2(*gei); cvi2; cvi2++) { - Variable_ID v = cvi2.curr_var(); - switch (v->kind()) { - case Wildcard_Var: - h1.update_coef(e, (*ii).modulo); - h2.update_coef(e, -(*ii).modulo); - break; - case Global_Var: { - Global_Var_ID g = v->get_global_var(); - Variable_ID v2; - if (g->arity() == 0) - v2 = stride_cond.get_local(g); - else - v2 = stride_cond.get_local(g, v->function_of()); - h1.update_coef(v2, cvi2.curr_coef()); - h2.update_coef(v2, -cvi2.curr_coef()); - break; - } - default: - h1.update_coef(v, cvi2.curr_coef()); - h2.update_coef(v, -cvi2.curr_coef()); - } - } - h1.update_const((*ii).ub); - h2.update_const(-(*ii).lb); - - (*(*ii).pos).second = Intersection(copy(other_cond), stride_cond); - (*(*ii).pos).second.simplify(); - } - } - - if (invalid) - break; - } - } - i++; - } - } - } - catch (const presburger_error &e) { - throw e; - } - - Relation R2 = Relation::False(l_R); - for (std::list >::iterator i = Rs.begin(); i != Rs.end(); i++) - R2 = Union(R2, Intersection((*i).first, (*i).second)); - R2.simplify(0, 1); - - return R2; -} - - -// -// Use gist and value range to calculate a quick rectangular hull. It -// intends to replace all hull calculations (QuickHull, BetterHull, -// FastTightHull) beyond the method of ConvexHull (dual -// representations). In the future, it will support max(...)-like -// upper bound. So RectHull complements ConvexHull in two ways: first -// for relations that ConvexHull gets too complicated, second for -// relations where different conjuncts have different symbolic upper -// bounds. -// -Relation RectHull(NOT_CONST Relation &Rel) { - Relation R = Approximate(consume_and_regurgitate(Rel)); - if (!R.is_upper_bound_satisfiable()) - return R; - if (R.has_single_conjunct()) - return R; - - std::vector input_names(R.n_inp()); - for (int i = 1; i <= R.n_inp(); i++) - input_names[i-1] = R.input_var(i)->name(); - std::vector output_names(R.n_out()); - for (int i = 1; i <= R.n_out(); i++) - output_names[i-1] = R.output_var(i)->name(); - - DNF_Iterator c(R.query_DNF()); - Relation r = Relation(R, c.curr()); - c++; - std::vector > bounds1(R.n_inp()); - std::vector > bounds2(R.n_out()); - { - Relation t = Project_Sym(copy(r)); - t.simplify(); - for (int i = 1; i <= R.n_inp(); i++) { - Tuple v; - for (int j = 1; j <= R.n_inp(); j++) - if (j != i) - v.append(r.input_var(j)); - for (int j = 1; j <= R.n_out(); j++) - v.append(r.output_var(j)); - Relation t2 = Project(copy(t), v); - t2.query_variable_bounds(t2.input_var(i), bounds1[i-1].first, bounds1[i-1].second); - } - for (int i = 1; i <= R.n_out(); i++) { - Tuple v; - for (int j = 1; j <= R.n_out(); j++) - if (j != i) - v.append(r.output_var(j)); - for (int j = 1; j <= R.n_inp(); j++) - v.append(r.input_var(j)); - Relation t2 = Project(copy(t), v); - t2.query_variable_bounds(t2.output_var(i), bounds2[i-1].first, bounds2[i-1].second); - } - } - - while (c.live()) { - Relation r2 = Relation(R, c.curr()); - c++; - Relation x = Gist(copy(r), Gist(copy(r), copy(r2), 1), 1); - if (Difference(copy(r2), copy(x)).is_upper_bound_satisfiable()) - x = Relation::True(R); - Relation y = Gist(copy(r2), Gist(copy(r2), copy(r), 1), 1); - if (Difference(copy(r), copy(y)).is_upper_bound_satisfiable()) - y = Relation::True(R); - r = Intersection(x, y); - - { - Relation t = Project_Sym(copy(r2)); - t.simplify(); - for (int i = 1; i <= R.n_inp(); i++) { - Tuple v; - for (int j = 1; j <= R.n_inp(); j++) - if (j != i) - v.append(r2.input_var(j)); - for (int j = 1; j <= R.n_out(); j++) - v.append(r2.output_var(j)); - Relation t2 = Project(copy(t), v); - coef_t lbound, ubound; - t2.query_variable_bounds(t2.input_var(i), lbound, ubound); - bounds1[i-1].first = min(bounds1[i-1].first, lbound); - bounds1[i-1].second = max(bounds1[i-1].second, ubound); - } - for (int i = 1; i <= R.n_out(); i++) { - Tuple v; - for (int j = 1; j <= R.n_out(); j++) - if (j != i) - v.append(r2.output_var(j)); - for (int j = 1; j <= R.n_inp(); j++) - v.append(r2.input_var(j)); - Relation t2 = Project(copy(t), v); - coef_t lbound, ubound; - t2.query_variable_bounds(t2.output_var(i), lbound, ubound); - bounds2[i-1].first = min(bounds2[i-1].first, lbound); - bounds2[i-1].second = max(bounds2[i-1].second, ubound); - } - } - - Relation r3(R.n_inp(), R.n_out()); - F_And *f_root = r3.add_and(); - for (int i = 1; i <= R.n_inp(); i++) { - if (bounds1[i-1].first != -posInfinity) { - GEQ_Handle h = f_root->add_GEQ(); - h.update_coef(r3.input_var(i), 1); - h.update_const(-bounds1[i-1].first); - } - if (bounds1[i-1].second != posInfinity) { - GEQ_Handle h = f_root->add_GEQ(); - h.update_coef(r3.input_var(i), -1); - h.update_const(bounds1[i-1].second); - } - } - for (int i = 1; i <= R.n_out(); i++) { - if (bounds2[i-1].first != -posInfinity) { - GEQ_Handle h = f_root->add_GEQ(); - h.update_coef(r3.output_var(i), 1); - h.update_const(-bounds2[i-1].first); - } - if (bounds2[i-1].second != posInfinity) { - GEQ_Handle h = f_root->add_GEQ(); - h.update_coef(r3.output_var(i), -1); - h.update_const(bounds2[i-1].second); - } - } - r = Intersection(r, r3); - r.simplify(); - } - - for (int i = 1; i <= r.n_inp(); i++) - r.name_input_var(i, input_names[i-1]); - for (int i = 1; i <= r.n_out(); i++) - r.name_output_var(i, output_names[i-1]); - r.setup_names(); - return r; -} - -} // namespace diff --git a/omega/omega_lib/src/hull_legacy.cc b/omega/omega_lib/src/hull_legacy.cc deleted file mode 100755 index a59d34f..0000000 --- a/omega/omega_lib/src/hull_legacy.cc +++ /dev/null @@ -1,1484 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 the Omega Project Team - Copyright (C) 2005-2011 Chun Chen - All Rights Reserved. - - Purpose: - Legacy hull calculations' implementation. - - Notes: - - History: - 06/15/09 ConvexRepresentation, Chun Chen - 11/25/09 RectHull, Chun Chen -*****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace omega { - -int hull_debug = 0; - -Relation ConvexHull(NOT_CONST Relation &R) { - Relation S = Approximate(consume_and_regurgitate(R)); - if (!S.is_upper_bound_satisfiable()) - return S; - if (S.has_single_conjunct()) - return S; - return Farkas(Farkas(S,Basic_Farkas), Convex_Combination_Farkas); -} - -Relation DecoupledConvexHull(NOT_CONST Relation &R) { - Relation S = Approximate(consume_and_regurgitate(R)); - if (!S.is_upper_bound_satisfiable()) - return S; - if (S.has_single_conjunct()) - return S; - return Farkas(Farkas(S,Decoupled_Farkas), Convex_Combination_Farkas); -} - -Relation AffineHull(NOT_CONST Relation &R) { - Relation S = Approximate(consume_and_regurgitate(R)); - if (!S.is_upper_bound_satisfiable()) - return S; - return Farkas(Farkas(S,Basic_Farkas), Affine_Combination_Farkas); -} - -Relation LinearHull(NOT_CONST Relation &R) { - Relation S = Approximate(consume_and_regurgitate(R)); - if (!S.is_upper_bound_satisfiable()) - return S; - return Farkas(Farkas(S,Basic_Farkas), Linear_Combination_Farkas); -} - -Relation ConicHull(NOT_CONST Relation &R) { - Relation S = Approximate(consume_and_regurgitate(R)); - if (!S.is_upper_bound_satisfiable()) - return S; - return Farkas(Farkas(S,Basic_Farkas), Positive_Combination_Farkas); -} - - -Relation FastTightHull(NOT_CONST Relation &input_R, NOT_CONST Relation &input_H) { - Relation R = Approximate(consume_and_regurgitate(input_R)); - Relation H = Approximate(consume_and_regurgitate(input_H)); - - if (hull_debug) { - fprintf(DebugFile,"[ Computing FastTightHull of:\n"); - R.prefix_print(DebugFile); - fprintf(DebugFile,"given known hull of:\n"); - H.prefix_print(DebugFile); - } - - if (!H.has_single_conjunct()) { - if (hull_debug) - fprintf(DebugFile, "] bailing out of FastTightHull, known hull not convex\n"); - return H; - } - - if (!H.is_obvious_tautology()) { - R = Gist(R,copy(H)); - R.simplify(1,0); - } - - if (R.has_single_conjunct()) { - R = Intersection(R,H); - if (hull_debug) { - fprintf(DebugFile, "] quick easy answer to FastTightHull\n"); - R.prefix_print(DebugFile); - } - return R; - } - if (R.has_local(coefficient_of_constant_term)) { - if (hull_debug) { - fprintf(DebugFile, "] Can't handle recursive application of Farkas lemma\n"); - } - return H; - } - - if (hull_debug) { - fprintf(DebugFile,"Gist of R given H is:\n"); - R.prefix_print(DebugFile); - } - - if (1) { - Set vars; - int conjuncts = 0; - for (DNF_Iterator s(R.query_DNF()); s.live(); s.next()) { - conjuncts++; - for (Variable_ID_Iterator v(*((*s)->variables())); v.live(); v++) { - bool found = false; - for (EQ_Iterator eq = (*s)->EQs(); eq.live(); eq.next()) - if ((*eq).get_coef(*v) != 0) { - if (!found) vars.insert(*v); - found = true; - break; - } - if (!found) - for (GEQ_Iterator geq = (*s)->GEQs(); geq.live(); geq.next()) - if ((*geq).get_coef(*v) != 0) { - if (!found) vars.insert(*v); - found = true; - break; - } - } - } - - - // We now know which variables appear in R - if (hull_debug) { - fprintf(DebugFile,"Variables we need a better hull on are: "); - foreach(v,Variable_ID,vars, - fprintf(DebugFile," %s",v->char_name())); - fprintf(DebugFile,"\n"); - } - Conjunct *c = H.single_conjunct(); - int total=0; - int copied = 0; - for (EQ_Iterator eq = c->EQs(); eq.live(); eq.next()) { - total++; - foreach(v,Variable_ID,vars, - if ((*eq).get_coef(v) != 0) { - R.and_with_EQ(*eq); - copied++; - break; // out of variable loop - } - ); - } - for (GEQ_Iterator geq = c->GEQs(); geq.live(); geq.next()) { - total++; - foreach(v,Variable_ID,vars, - if ((*geq).get_coef(v) != 0) { - R.and_with_GEQ(*geq); - copied++; - break; // out of variable loop - } - ); - } - if (copied < total) { - R = Approximate(R); - - if (hull_debug) { - fprintf(DebugFile,"Decomposed relation, copied only %d of %d constraints\n",copied,total); - fprintf(DebugFile,"Original R:\n"); - R.prefix_print(DebugFile); - fprintf(DebugFile,"Known hull:\n"); - H.prefix_print(DebugFile); - fprintf(DebugFile,"New R:\n"); - R.prefix_print(DebugFile); - } - } - } - - Relation F = Farkas(copy(R), Basic_Farkas, true); - if (hull_debug) - fprintf(DebugFile,"Farkas Difficulty = " coef_fmt "\n", farkasDifficulty); - if (farkasDifficulty > 260) { - if (hull_debug) { - fprintf(DebugFile, "] bailing out, farkas is way too complex\n"); - fprintf(DebugFile,"Farkas:\n"); - F.prefix_print(DebugFile); - } - return H; - } - else if (farkasDifficulty > 130) { - // Bail out - if (hull_debug) { - fprintf(DebugFile, coef_fmt " non-zeros in original farkas\n", farkasDifficulty); - } - Relation tmp = Farkas(R, Decoupled_Farkas, true); - - if (hull_debug) { - fprintf(DebugFile, coef_fmt " non-zeros in decoupled farkas\n", farkasDifficulty); - } - if (farkasDifficulty > 260) { - if (hull_debug) { - fprintf(DebugFile, "] bailing out, farkas is way too complex\n"); - fprintf(DebugFile,"Farkas:\n"); - F.prefix_print(DebugFile); - } - return H; - } - else { - if (farkasDifficulty > 130) - R = Intersection(H, Farkas(tmp, Affine_Combination_Farkas, true)); - else R = Intersection(H, - Intersection(Farkas(tmp, Convex_Combination_Farkas, true), - Farkas(F, Affine_Combination_Farkas, true))); - if (hull_debug) { - fprintf(DebugFile, "] bailing out, farkas is too complex, using affine hull\n"); - fprintf(DebugFile,"Farkas:\n"); - F.prefix_print(DebugFile); - fprintf(DebugFile,"Affine hull:\n"); - R.prefix_print(DebugFile); - } - return R; - } - } - - R = Intersection(H, Farkas(F, Convex_Combination_Farkas, true)); - if (hull_debug) { - fprintf(DebugFile, "] Result of FastTightHull:\n"); - R.prefix_print(DebugFile); - } - return R; -} - - - -namespace { - bool parallel(const GEQ_Handle &g1, const GEQ_Handle &g2) { - for(Constr_Vars_Iter cvi(g1, false); cvi; cvi++) { - coef_t c1 = (*cvi).coef; - coef_t c2 = g2.get_coef((*cvi).var); - if (c1 != c2) return false; - } - { - for(Constr_Vars_Iter cvi(g2, false); cvi; cvi++) { - coef_t c1 = g1.get_coef((*cvi).var); - coef_t c2 = (*cvi).coef; - if (c1 != c2) return false; - } - } - return true; - } - - - bool hull(const EQ_Handle &e, const GEQ_Handle &g, coef_t &hull) { - int sign = 0; - for(Constr_Vars_Iter cvi(e, false); cvi; cvi++) { - coef_t c1 = (*cvi).coef; - coef_t c2 = g.get_coef((*cvi).var); - if (sign == 0) sign = (c1*c2>=0?1:-1); - if (sign*c1 != c2) return false; - } - assert(sign != 0); - { - for(Constr_Vars_Iter cvi(g, false); cvi; cvi++) { - coef_t c1 = e.get_coef((*cvi).var); - coef_t c2 = (*cvi).coef; - if (sign*c1 != c2) return false; - } - } - hull = max(sign * e.get_const(), g.get_const()); - if (hull_debug) { - fprintf(DebugFile,"Hull of:\n %s\n", e.print_to_string().c_str()); - fprintf(DebugFile," %s\n", g.print_to_string().c_str()); - fprintf(DebugFile,"is " coef_fmt "\n\n",hull); - } - return true; - } - - bool eq(const EQ_Handle &e1, const EQ_Handle &e2) { - int sign = 0; - for(Constr_Vars_Iter cvi(e1, false); cvi; cvi++) { - coef_t c1 = (*cvi).coef; - coef_t c2 = e2.get_coef((*cvi).var); - if (sign == 0) sign = (c1*c2>=0?1:-1); - if (sign*c1 != c2) return false; - } - assert(sign != 0); - { - for(Constr_Vars_Iter cvi(e2, false); cvi; cvi++) { - coef_t c1 = e1.get_coef((*cvi).var); - coef_t c2 = (*cvi).coef; - if (sign*c1 != c2) return false; - } - } - return sign * e1.get_const() == e2.get_const(); - } -} - - -// This function is deprecated!!! -Relation QuickHull(Relation &R) { - Tuple Rs(1); - Rs[1] = R; - return QuickHull(Rs); -} - - -// This function is deprecated!!! -Relation QuickHull(Tuple &Rs) { - assert(!Rs.empty()); - - // if (Rs.size() == 1) return Rs[1]; - - Tuple l_Rs; - for (int i = 1; i <= Rs.size(); i++) - for (DNF_Iterator c(Rs[i].query_DNF()); c; c++) { - Relation r = Relation(Rs[i], c.curr()); - l_Rs.append(Approximate(r)); - } - - if (l_Rs.size() == 1) - return l_Rs[1]; - - Relation result = Relation::True(Rs[1]); - result.copy_names(Rs[1]); - - use_ugly_names++; - - if (hull_debug > 1) - for (int i = 1; i <= l_Rs.size(); i++) { - fprintf(DebugFile,"#%d \n",i); - l_Rs[i].prefix_print(DebugFile); - } - - -// Relation R = copy(Rs[1]); -// for (int i = 2; i <= Rs.size(); i++) -// R = Union(R,copy(Rs[i])); - -// #if 0 -// if (!R.is_set()) { -// if (R.n_inp() == R.n_out()) { -// Relation AC = DeltasToRelation(Hull(Deltas(copy(R), -// min(R.n_inp(),R.n_out()))), -// R.n_inp(),R.n_out()); -// Relation dH = Hull(Domain(copy(R)),false); -// Relation rH = Hull(Range(copy(R)),false); -// result = Intersection(AC,Cross_Product(dH,rH)); -// } -// else { -// Relation dH = Hull(Domain(copy(R)),false); -// Relation rH = Hull(Range(copy(R)),false); -// result = Cross_Product(dH,rH); -// assert(Must_Be_Subset(copy(R),copy(result))); -// } -// } - -// #endif - - Conjunct *first; - l_Rs[1] = EQs_to_GEQs(l_Rs[1]); - first = l_Rs[1].single_conjunct(); - for (GEQ_Iterator candidate(first->GEQs()); candidate.live(); candidate.next()) { - coef_t maxConstantTerm = (*candidate).get_const(); - bool found = true; - if (hull_debug > 1) { - fprintf(DebugFile,"searching for bound on:\n %s\n", (*candidate).print_to_string().c_str()); - } - for (int i = 2; i <= l_Rs.size(); i++) { - Conjunct *other = l_Rs[i].single_conjunct(); - bool found_for_i = false; - for (GEQ_Iterator target(other->GEQs()); target.live(); target.next()) { - if (hull_debug > 2) { - fprintf(DebugFile,"candidate:\n %s\n", (*candidate).print_to_string().c_str()); - fprintf(DebugFile,"target:\n %s\n", (*target).print_to_string().c_str()); - } - if (parallel(*candidate,*target)) { - if (hull_debug > 1) - fprintf(DebugFile,"Found bound:\n %s\n", (*target).print_to_string().c_str()); - maxConstantTerm = max(maxConstantTerm,(*target).get_const()); - found_for_i = true; - break; - } - } - if (!found_for_i) { - for (EQ_Iterator target_e(other->EQs()); target_e.live(); target_e.next()) { - coef_t h; - if (hull(*target_e,*candidate,h)) { - if (hull_debug > 1) - fprintf(DebugFile,"Found bound of " coef_fmt ":\n %s\n", h, (*target_e).print_to_string().c_str()); - maxConstantTerm = max(maxConstantTerm,h); - found_for_i = true; - break; - } - }; - if (!found_for_i) { - if (hull_debug > 1) { - fprintf(DebugFile,"No bound found in:\n"); - fprintf(DebugFile, "%s", l_Rs[i].print_with_subs_to_string().c_str()); - } - //if nothing found - found = false; - break; - } - } - } - - if (found) { - GEQ_Handle h = result.and_with_GEQ(); - copy_constraint(h,*candidate); - if (hull_debug > 1) - fprintf(DebugFile,"Setting constant term to " coef_fmt " in\n %s\n", maxConstantTerm, h.print_to_string().c_str()); - h.update_const(maxConstantTerm - (*candidate).get_const()); - if (hull_debug > 1) - fprintf(DebugFile,"Updated constraint is\n %s\n", h.print_to_string().c_str()); - } - } - - - for (EQ_Iterator candidate_eq(first->EQs()); candidate_eq.live(); candidate_eq.next()) { - bool found = true; - for (int i = 2; i <= l_Rs.size(); i++) { - Conjunct *C = l_Rs[i].single_conjunct(); - bool found_for_i = false; - - for (EQ_Iterator target(C->EQs()); target.live(); target.next()) { - if (eq(*candidate_eq,*target)) { - found_for_i = true; - break; - } - } - if (!found_for_i) { - //if nothing found - found = false; - break; - } - } - - if (found) { - EQ_Handle h = result.and_with_EQ(); - copy_constraint(h,*candidate_eq); - if (hull_debug > 1) - fprintf(DebugFile,"Adding eq constraint: %s\n", h.print_to_string().c_str()); - } - } - - use_ugly_names--; - if (hull_debug > 1) { - fprintf(DebugFile,"quick hull is of:"); - result.print_with_subs(DebugFile); - } - return result; -} - - -// Relation Hull2(Tuple &Rs, Tuple &active) { -// assert(Rs.size() == active.size() && Rs.size() > 0); - -// Tuple l_Rs; -// for (int i = 1; i <= Rs.size(); i++) -// if (active[i]) -// l_Rs.append(copy(Rs[i])); - -// if (l_Rs.size() == 0) -// return Relation::False(Rs[1]); - -// try { -// Relation r = l_Rs[1]; -// for (int i = 2; i <= l_Rs.size(); i++) { -// r = Union(r, copy(l_Rs[i])); -// r.simplify(); -// } - -// // Relation F = Farkas(r, Basic_Farkas, true); -// // if (farkasDifficulty >= 500) -// // throw std::overflow_error("loop convex hull too complicated."); -// // F = Farkas(F, Convex_Combination_Farkas, true); -// return Farkas(Farkas(r, Basic_Farkas, true), Convex_Combination_Farkas, true); -// } -// catch (std::overflow_error) { -// return QuickHull(l_Rs); -// } -// } - - -namespace { - void printRs(Tuple &Rs) { - fprintf(DebugFile,"Rs:\n"); - for (int i = 1; i <= Rs.size(); i++) - fprintf(DebugFile,"#%d : %s\n",i, - Rs[i].print_with_subs_to_string().c_str()); - } -} - -Relation BetterHull(Tuple &Rs, bool stridesAllowed, bool checkSubsets, - NOT_CONST Relation &input_knownHull = Relation::Null()) { - Relation knownHull = consume_and_regurgitate(input_knownHull); - static int OMEGA_WHINGE = -1; - if (OMEGA_WHINGE < 0) { - OMEGA_WHINGE = getenv("OMEGA_WHINGE") ? atoi(getenv("OMEGA_WHINGE")) : 0; - } - assert(!Rs.empty()); - if (Rs.size() == 1) { - if (stridesAllowed) return Rs[1]; - else return Approximate(Rs[1]); - } - - if (checkSubsets) { - Tuple live(Rs.size()); - if (hull_debug) { - fprintf(DebugFile,"Checking subsets in hull computation:\n"); - printRs(Rs); - } - int i; - for(i=1;i <=Rs.size(); i++) live[i] = true; - for(i=1;i <=Rs.size(); i++) - for(int j=1;j <=Rs.size(); j++) if (i != j && live[j]) { - if (hull_debug) fprintf(DebugFile,"checking %d Is_Obvious_Subset %d\n",i,j); - if (Is_Obvious_Subset(copy(Rs[i]),copy(Rs[j]))) { - if (hull_debug) fprintf(DebugFile,"yes...\n"); - live[i] = false; - break; - } - } - for(i=1;i <=Rs.size(); i++) if (!live[i]) { - if (i < Rs.size()) { - Rs[i] = Rs[Rs.size()]; - live[i] = live[Rs.size()]; - } - Rs[Rs.size()] = Relation(); - Rs.delete_last(); - i--; - } - } - Relation hull; - if (hull_debug) { - fprintf(DebugFile,"Better Hull:\n"); - printRs(Rs); - fprintf(DebugFile,"known hull: %s\n", knownHull.print_with_subs_to_string().c_str()); - } - if (knownHull.is_null()) hull = QuickHull(Rs); - else hull = Intersection(QuickHull(Rs),knownHull); - // for (int i = 1; i <= Rs.size(); i++) - // hull = RectHull(Union(hull, copy(Rs[i]))); - // hull = Intersection(hull, knownHull); - hull.simplify(); - if (hull_debug) { - fprintf(DebugFile,"quick hull: %s\n", hull.print_with_subs_to_string().c_str()); - } - - Relation orig = Relation::False(Rs[1]); - int i; - for (i = 1; i <= Rs.size(); i++) - orig = Union(orig,copy(Rs[i])); - - orig.simplify(); - - for (i = 1; i <= Rs.size(); i++) { - if (!hull.is_obvious_tautology()) Rs[i] = Gist(Rs[i],copy(hull)); - Rs[i].simplify(); - if (Rs[i].is_obvious_tautology()) return hull; - if (Rs[i].has_single_conjunct()) { - Rs[i] = EQs_to_GEQs(Rs[i]); - if (hull_debug) { - fprintf(DebugFile,"Checking for hull constraints in:\n %s\n", Rs[i].print_with_subs_to_string().c_str()); - } - Conjunct *c = Rs[i].single_conjunct(); - for (GEQ_Iterator g(c->GEQs()); g.live(); g.next()) { - Relation tmp = Relation::True(Rs[i]); - tmp.and_with_GEQ(*g); - if (!Difference(copy(orig),tmp).is_upper_bound_satisfiable()) - hull.and_with_GEQ(*g); - } - for (EQ_Iterator e(c->EQs()); e.live(); e.next()) { - Relation tmp = Relation::True(Rs[i]); - tmp.and_with_EQ(*e); - if (!Difference(copy(orig),tmp).is_upper_bound_satisfiable()) - hull.and_with_EQ(*e); - } - } - } - - hull = FastTightHull(orig,hull); - assert(hull.has_single_conjunct()); - - if (stridesAllowed) return hull; - else return Approximate(hull); - -} - - - -Relation Hull(NOT_CONST Relation &S, - bool stridesAllowed, - int effort, - NOT_CONST Relation &knownHull) { - Relation R = consume_and_regurgitate(S); - R.simplify(1,0); - if (!R.is_upper_bound_satisfiable()) return R; - Tuple Rs; - for (DNF_Iterator c(R.query_DNF()); c.live(); ) { - Rs.append(Relation(R,c.curr())); - c.next(); - } - if (effort == 1) - return BetterHull(Rs,stridesAllowed,false,knownHull); - else - return QuickHull(Rs); -} - - - -Relation Hull(Tuple &Rs, - const std::vector &validMask, - int effort, - bool stridesAllowed, - NOT_CONST Relation &knownHull) { - // Use relation of index i only when validMask[i] != 0 - Tuple Rs2; - for(int i = 1; i <= Rs.size(); i++) { - if (validMask[i-1]) { - Rs[i].simplify(); - for (DNF_Iterator c(Rs[i].query_DNF()); c.live(); ) { - Rs2.append(Relation(Rs[i],c.curr())); - c.next(); - } - } - } - assert(effort == 0 || effort == 1); - if (effort == 1) - return BetterHull(Rs2,stridesAllowed,true,knownHull); - else - return QuickHull(Rs2); -} - - -// This function is deprecated!!! -Relation CheckForConvexRepresentation(NOT_CONST Relation &R_In) { - Relation R = consume_and_regurgitate(R_In); - Relation h = Hull(copy(R)); - if (!Difference(copy(h),copy(R)).is_upper_bound_satisfiable()) - return h; - else - return R; -} - -// This function is deprecated!!! -Relation CheckForConvexPairs(NOT_CONST Relation &S) { - Relation R = consume_and_regurgitate(S); - Relation hull = FastTightHull(copy(R),Relation::True(R)); - R.simplify(1,0); - if (!R.is_upper_bound_satisfiable() || R.number_of_conjuncts() < 2) return R; - Tuple Rs; - for (DNF_Iterator c(R.query_DNF()); c.live(); ) { - Rs.append(Relation(R,c.curr())); - c.next(); - } - - bool *dead = new bool[Rs.size()+1]; - int i; - for(i = 1; i<=Rs.size();i++) dead[i] = false; - - for(i = 1; i<=Rs.size();i++) - if (!dead[i]) - for(int j = i+1; j<=Rs.size();j++) if (!dead[j]) { - if (hull_debug) { - fprintf(DebugFile,"Comparing #%d and %d\n",i,j); - } - Relation U = Union(copy(Rs[i]),copy(Rs[j])); - Relation H_ij = FastTightHull(copy(U),copy(hull)); - if (!Difference(copy(H_ij),U).is_upper_bound_satisfiable()) { - Rs[i] = H_ij; - dead[j] = true; - if (hull_debug) { - fprintf(DebugFile,"Combined them\n"); - } - } - } - i = 1; - while(i<=Rs.size() && dead[i]) i++; - assert(i<=Rs.size()); - R = Rs[i]; - i++; - for(; i<=Rs.size();i++) - if (!dead[i]) - R = Union(R,Rs[i]); - delete []dead; - return R; -} - -// -// Supporting functions for ConvexRepresentation -// -namespace { -struct Interval { - std::list >::iterator pos; - coef_t lb; - coef_t ub; - bool change; - coef_t modulo; - Interval(std::list >::iterator pos_, coef_t lb_, coef_t ub_): - pos(pos_), lb(lb_), ub(ub_) {} - friend bool operator<(const Interval &a, const Interval &b); -}; - -bool operator<(const Interval &a, const Interval &b) { - return a.lb < b.lb; -} - -struct Modulo_Interval { - coef_t modulo; - coef_t start; - coef_t size; - Modulo_Interval(coef_t modulo_, coef_t start_, coef_t size_): - modulo(modulo_), start(start_), size(size_) {} - friend bool operator<(const Interval &a, const Interval &b); -}; - -bool operator<(const Modulo_Interval &a, const Modulo_Interval &b) { - if (a.modulo == b.modulo) { - if (a.start == b.start) - return a.size < b.size; - else - return a.start < b.start; - } - else - return a.modulo < b.modulo; -} - -void merge_intervals(std::list &intervals, coef_t modulo, std::list > &Rs, std::list >::iterator orig) { - // normalize intervals - for (std::list::iterator i = intervals.begin(); i != intervals.end(); i++) { - (*i).modulo = modulo; - (*i).change = false; - if ((*i).ub - (*i).lb + 1>= modulo) { - (*i).lb = 0; - (*i).ub = modulo - 1; - } - else if ((*i).ub < 0 || (*i).lb >= modulo) { - coef_t range = (*i).ub - (*i).lb; - (*i).lb = int_mod((*i).lb, modulo); - (*i).ub = (*i).lb + range; - } - } - - intervals.sort(); - - // merge neighboring intervals - std::list::iterator p = intervals.begin(); - while (p != intervals.end()) { - std::list::iterator q = p; - q++; - while (q != intervals.end()) { - if ((*p).ub + 1 >= (*q).lb) { - Relation hull = ConvexHull(Union(copy((*(*p).pos).first), copy((*(*q).pos).first))); - Relation remainder = Difference(Difference(copy(hull), copy((*(*p).pos).first)), copy((*(*q).pos).first)); - if (!remainder.is_upper_bound_satisfiable()) { - if ((*q).pos == orig) - std::swap((*p).pos, (*q).pos); - (*(*p).pos).first = hull; - (*p).ub = max((*p).ub, (*q).ub); - (*p).change = true; - Rs.erase((*q).pos); - q = intervals.erase(q); - } - else - break; - } - else - break; - } - - bool p_moved = false; - q = p; - q++; - while (q != intervals.end()) { - if ((*q).ub >= modulo && int_mod((*q).ub, modulo) + 1 >= (*p).lb) { - Relation hull = ConvexHull(Union(copy((*(*p).pos).first), copy((*(*q).pos).first))); - Relation remainder = Difference(Difference(copy(hull), copy((*(*p).pos).first)), copy((*(*q).pos).first)); - if (!remainder.is_upper_bound_satisfiable()) { - if ((*p).pos == orig) - std::swap((*p).pos, (*q).pos); - (*(*q).pos).first = hull; - coef_t t = (*p).ub - int_mod((*q).ub, modulo); - if (t > 0) - (*q).ub = (*q).ub + t; - (*q).change = true; - Rs.erase((*p).pos); - p = intervals.erase(p); - p_moved = true; - break; - } - else - q++; - } - else - q++; - } - - if (!p_moved) - p++; - } - - // merge by reducing the strengh of modulo - std::list modulo_intervals; - coef_t max_distance = modulo/2; - for (std::list::iterator p = intervals.begin(); p != intervals.end(); p++) { - if ((*p).lb >= max_distance) - break; - - coef_t size = (*p).ub - (*p).lb; - - std::list::iterator q = p; - q++; - while (q != intervals.end()) { - coef_t distance = (*q).lb - (*p).lb; - if (distance > max_distance) - break; - - if ((*q).ub - (*q).lb != size || int_mod(modulo, distance) != 0) { - q++; - continue; - } - - int num_reduced = 0; - coef_t looking_for = int_mod((*p).lb, distance); - for (std::list::iterator k = intervals.begin(); k != intervals.end(); k++) { - if ((*k).lb == looking_for && (*k).ub - (*k).lb == size) { - num_reduced++; - looking_for += distance; - if (looking_for >= modulo) - break; - } - else if ((*k).lb <= looking_for && (*k).ub >= looking_for + size) { - looking_for += distance; - if (looking_for >= modulo) - break; - } - else if ((*k).lb > looking_for) - break; - } - - if (looking_for >= modulo && num_reduced > 1) - modulo_intervals.push_back(Modulo_Interval(distance, int_mod((*p).lb, distance), size)); - - q++; - } - } - - modulo_intervals.sort(); - - // remove redundant reduced-strength intervals - std::list::iterator p2 = modulo_intervals.begin(); - while (p2 != modulo_intervals.end()) { - std::list::iterator q2 = p2; - q2++; - while (q2 != modulo_intervals.end()) { - if ((*p2).modulo == (*q2).modulo && (*p2).start == (*q2).start) - q2 = modulo_intervals.erase(q2); - else if (int_mod((*q2).modulo, (*p2).modulo) == 0 && - (*p2).start == int_mod((*q2).start, (*p2).modulo) && - (*p2).size >= (*q2).size) - q2 = modulo_intervals.erase(q2); - else - q2++; - } - p2++; - } - - // replace original intervals with new reduced-strength ones - for (std::list::iterator i = modulo_intervals.begin(); i != modulo_intervals.end(); i++) { - std::vector candidates; - int num_replaced = 0; - for (std::list::iterator j = intervals.begin(); j != intervals.end(); j++) - if (int_mod((*j).modulo, (*i).modulo) == 0 && - (*j).ub - (*j).lb >= (*i).size && - (int_mod((*j).lb, (*i).modulo) == (*i).start || - int_mod((*j).ub, (*i).modulo) == (*i).start + (*i).size)) { - candidates.push_back(&((*(*j).pos).first)); - if (int_mod((*j).lb, (*i).modulo) == (*i).start && - (*j).ub - (*j).lb == (*i).size) - num_replaced++; - } - if (num_replaced <= 1) - continue; - - Relation R = copy(*candidates[0]); - for (size_t k = 1; k < candidates.size(); k++) - R = Union(R, copy(*candidates[k])); - Relation hull = ConvexHull(copy(R)); - Relation remainder = Difference(copy(hull), copy(R)); - if (!remainder.is_upper_bound_satisfiable()) { - std::list::iterator replaced_one = intervals.end(); - for (std::list::iterator j = intervals.begin(); j != intervals.end();) - if (int_mod((*j).modulo, (*i).modulo) == 0 && - (*j).ub - (*j).lb >= (*i).size && - (int_mod((*j).lb, (*i).modulo) == (*i).start || - int_mod((*j).ub, (*i).modulo) == (*i).start + (*i).size)) { - if (int_mod((*j).lb, (*i).modulo) == (*i).start && - (*j).ub - (*j).lb == (*i).size) { - if (replaced_one == intervals.end()) { - (*(*j).pos).first = hull; - (*j).lb = int_mod((*j).lb, (*i).modulo); - (*j).ub = int_mod((*j).ub, (*i).modulo); - (*j).modulo = (*i).modulo; - (*j).change = true; - replaced_one = j; - j++; - } - else { - if ((*j).pos == orig) { - std::swap((*replaced_one).pos, (*j).pos); - (*(*replaced_one).pos).first = (*(*j).pos).first; - } - Rs.erase((*j).pos); - j = intervals.erase(j); - } - } - else { - if (int_mod((*j).lb, (*i).modulo) == (*i).start) - (*j).lb = (*j).lb + (*i).size + 1; - else - (*j).ub = (*j).ub - (*i).size - 1; - (*j).change = true; - j++; - } - } - else - j++; - } - } -} -} // namespace - - -// -// Simplify a union of sets/relations to a minimal (may not be -// optimal) number of convex regions. It intends to replace -// CheckForConvexRepresentation and CheckForConvexPairs functions. -// -Relation ConvexRepresentation(NOT_CONST Relation &R) { - Relation l_R = copy(R); - if (!l_R.is_upper_bound_satisfiable() || l_R.number_of_conjuncts() < 2) - return R; - - // separate each conjunct into smooth convex region and holes - std::list > Rs; // pair(smooth region, hole condition) - for (DNF_Iterator c(l_R.query_DNF()); c.live(); c++) { - Relation r1 = Relation(l_R, c.curr()); - Relation r2 = Approximate(copy(r1)); - r1 = Gist(r1, copy(r2)); - Rs.push_back(std::make_pair(r2, r1)); - } - - try { - bool change = true; - while (change) { - change = false; - - std::list >::iterator i = Rs.begin(); - while (i != Rs.end()) { - // find regions with identical hole conditions to merge - { - std::list >::iterator j = i; - j++; - while (j != Rs.end()) { - if (!Difference(copy((*i).second), copy((*j).second)).is_upper_bound_satisfiable() && - !Difference(copy((*j).second), copy((*i).second)).is_upper_bound_satisfiable()) { - if (Must_Be_Subset(copy((*j).first), copy((*i).first))) { - j = Rs.erase(j); - } - else if (Must_Be_Subset(copy((*i).first), copy((*j).first))) { - (*i).first = (*j).first; - j = Rs.erase(j); - change = true; - } - else { - Relation r; - bool already_use_recthull = false; - try { - r = ConvexHull(Union(copy((*i).first), copy((*j).first))); - } - catch (const std::overflow_error &e) { - r = SimpleHull(Union(copy((*i).first), copy((*j).first))); - already_use_recthull = true; - } - retry_recthull: - Relation r2 = Difference(Difference(copy(r), copy((*i).first)), copy((*j).first)); - if (!r2.is_upper_bound_satisfiable()) { // convex hull is tight - (*i).first = r; - j = Rs.erase(j); - change = true; - } - else { - if (!already_use_recthull) { - r = SimpleHull(Union(copy((*i).first), copy((*j).first))); - already_use_recthull = true; - goto retry_recthull; - } - else - j++; - } - } - } - else - j++; - } - } - - // find identical smooth regions as candidates for hole merge - std::list >::iterator> s; - for (std::list >::iterator j = Rs.begin(); j != Rs.end(); j++) - if (j != i) { - if (!Intersection(Difference(copy((*i).first), copy((*j).first)), copy((*j).second)).is_upper_bound_satisfiable() && - !Intersection(Difference(copy((*j).first), copy((*i).first)), copy((*i).second)).is_upper_bound_satisfiable()) - s.push_back(j); - } - - if (s.size() != 0) { - // convert hole condition c1*x1+c2*x2+... = c*alpha+d to a pair of inequalities - (*i).second = EQs_to_GEQs((*i).second, false); - - // find potential wildcards that can be used for hole conditions - std::set nonsingle_wild; - for (EQ_Iterator ei((*i).second.single_conjunct()); ei; ei++) - if ((*ei).has_wildcards()) - for (Constr_Vars_Iter cvi(*ei, true); cvi; cvi++) - nonsingle_wild.insert(cvi.curr_var()); - for (GEQ_Iterator gei((*i).second.single_conjunct()); gei; gei++) - if ((*gei).has_wildcards()) { - Constr_Vars_Iter cvi(*gei, true); - Constr_Vars_Iter cvi2 = cvi; - cvi2++; - if (cvi2) { - nonsingle_wild.insert(cvi.curr_var()); - for (; cvi2; cvi2++) - nonsingle_wild.insert(cvi2.curr_var()); - } - } - - // find hole condition in c*alpha+d1<=c1*x1+c2*x2+...<=c*alpha+d2 format - for (GEQ_Iterator gei((*i).second.single_conjunct()); gei; gei++) - if ((*gei).has_wildcards()) { - coef_t c; - Variable_ID v; - { - Constr_Vars_Iter cvi(*gei, true); - v = cvi.curr_var(); - c = cvi.curr_coef(); - if (c < 0 || nonsingle_wild.find(v) != nonsingle_wild.end()) - continue; - } - - coef_t lb = posInfinity; - for (GEQ_Iterator gei2((*i).second.single_conjunct()); gei2; gei2++) { - if (!(*gei2 == *gei) && (*gei2).get_coef(v) != 0) { - if (lb != posInfinity) { - nonsingle_wild.insert(v); - break; - } - - bool match = true; - for (Constr_Vars_Iter cvi2(*gei); cvi2; cvi2++) - if (cvi2.curr_coef() != -((*gei2).get_coef(cvi2.curr_var()))) { - match = false; - break; - } - if (match) - for (Constr_Vars_Iter cvi2(*gei2); cvi2; cvi2++) - if (cvi2.curr_coef() != -((*gei).get_coef(cvi2.curr_var()))) { - match = false; - break; - } - if (!match) { - nonsingle_wild.insert(v); - break; - } - - lb = -(*gei2).get_const(); - } - } - - if (nonsingle_wild.find(v) != nonsingle_wild.end()) - continue; - - Relation stride_cond = Relation::True((*i).second); - F_Exists *f_exists = stride_cond.and_with_and()->add_exists(); - Variable_ID e = f_exists->declare(); - F_And *f_root = f_exists->add_and(); - GEQ_Handle h1 = f_root->add_GEQ(); - GEQ_Handle h2 = f_root->add_GEQ(); - for (Constr_Vars_Iter cvi2(*gei); cvi2; cvi2++) { - Variable_ID v = cvi2.curr_var(); - switch (v->kind()) { - case Wildcard_Var: - h1.update_coef(e, cvi2.curr_coef()); - h2.update_coef(e, -cvi2.curr_coef()); - break; - case Global_Var: { - Global_Var_ID g = v->get_global_var(); - Variable_ID v2; - if (g->arity() == 0) - v2 = stride_cond.get_local(g); - else - v2 = stride_cond.get_local(g, v->function_of()); - h1.update_coef(v2, cvi2.curr_coef()); - h2.update_coef(v2, -cvi2.curr_coef()); - break; - } - default: - h1.update_coef(v, cvi2.curr_coef()); - h2.update_coef(v, -cvi2.curr_coef()); - } - } - h1.update_const((*gei).get_const()); - h2.update_const(-lb); - - stride_cond.simplify(); - Relation other_cond = Gist(copy((*i).second), copy(stride_cond)); - - // find regions with potential mergeable stride condition with this one - std::list intervals; - intervals.push_back(Interval(i, lb, (*gei).get_const())); - - for (std::list >::iterator>::iterator j = s.begin(); j != s.end(); j++) - if (Must_Be_Subset(copy((**j).second), copy(other_cond))) { - Relation stride_cond2 = Gist(copy((**j).second), copy(other_cond)); - - // interval can be removed - if (stride_cond2.is_obvious_tautology()) { - intervals.push_back(Interval(*j, 0, c-1)); - continue; - } - - stride_cond2 = EQs_to_GEQs(stride_cond2, false); - coef_t lb, ub; - GEQ_Iterator gei2(stride_cond2.single_conjunct()); - coef_t sign = 0; - for (Constr_Vars_Iter cvi(*gei2, true); cvi; cvi++) - if (sign != 0) { - sign = 0; - break; - } - else if (cvi.curr_coef() == c) - sign = 1; - else if (cvi.curr_coef() == -c) - sign = -1; - else { - sign = 0; - break; - } - if (sign == 0) - continue; - - bool match = true; - for (Constr_Vars_Iter cvi(*gei2); cvi; cvi++) { - Variable_ID v = cvi.curr_var(); - if (v->kind() == Wildcard_Var) - continue; - else if (v->kind() == Global_Var) { - Global_Var_ID g = v->get_global_var(); - if (g->arity() == 0) - v = (*i).second.get_local(g); - else - v = (*i).second.get_local(g, v->function_of()); - } - - if (cvi.curr_coef() != sign * (*gei).get_coef(v)) { - match = false; - break; - } - } - if (!match) - continue; - - for (Constr_Vars_Iter cvi(*gei); cvi; cvi++) { - Variable_ID v = cvi.curr_var(); - if (v->kind() == Wildcard_Var) - continue; - else if (v->kind() == Global_Var) { - Global_Var_ID g = v->get_global_var(); - if (g->arity() == 0) - v = stride_cond2.get_local(g); - else - v = stride_cond2.get_local(g, v->function_of()); - } - - if (cvi.curr_coef() != sign * (*gei2).get_coef(v)) { - match = false; - break; - } - } - if (!match) - continue; - if (sign > 0) - ub = (*gei2).get_const(); - else - lb = -(*gei2).get_const(); - - gei2++; - if (!gei2) - continue; - - coef_t sign2 = 0; - for (Constr_Vars_Iter cvi(*gei2, true); cvi; cvi++) - if (sign2 != 0) { - sign2 = 0; - break; - } - else if (cvi.curr_coef() == c) - sign2 = 1; - else if (cvi.curr_coef() == -c) - sign2 = -1; - else { - sign2 = 0; - break; - } - if (sign2 != -sign) - continue; - - for (Constr_Vars_Iter cvi(*gei2); cvi; cvi++) { - Variable_ID v = cvi.curr_var(); - if (v->kind() == Wildcard_Var) - continue; - else if (v->kind() == Global_Var) { - Global_Var_ID g = v->get_global_var(); - if (g->arity() == 0) - v = (*i).second.get_local(g); - else - v = (*i).second.get_local(g, v->function_of()); - } - - if (cvi.curr_coef() != sign2 * (*gei).get_coef(v)) { - match = false; - break; - } - } - if (!match) - continue; - - for (Constr_Vars_Iter cvi(*gei); cvi; cvi++) { - Variable_ID v = cvi.curr_var(); - if (v->kind() == Wildcard_Var) - continue; - else if (v->kind() == Global_Var) { - Global_Var_ID g = v->get_global_var(); - if (g->arity() == 0) - v = stride_cond2.get_local(g); - else - v = stride_cond2.get_local(g, v->function_of()); - } - - if (cvi.curr_coef() != sign2 * (*gei2).get_coef(v)) { - match = false; - break; - } - } - if (!match) - continue; - if (sign2 > 0) - ub = (*gei2).get_const(); - else - lb = -(*gei2).get_const(); - - gei2++; - if (gei2) - continue; - - intervals.push_back(Interval(*j, lb, ub)); - } - - merge_intervals(intervals, c, Rs, i); - - // make current region the last one being updated - bool invalid = false; - for (std::list::iterator ii = intervals.begin(); ii != intervals.end(); ii++) - if ((*ii).change && (*ii).pos == i) { - invalid = true; - intervals.push_back(*ii); - intervals.erase(ii); - break; - } - - // update hole condition for each region - for (std::list::iterator ii = intervals.begin(); ii != intervals.end(); ii++) - if ((*ii).change) { - change = true; - - if ((*ii).ub - (*ii).lb + 1 >= (*ii).modulo) - (*(*ii).pos).second = copy(other_cond); - else { - Relation stride_cond = Relation::True((*i).second); - F_Exists *f_exists = stride_cond.and_with_and()->add_exists(); - Variable_ID e = f_exists->declare(); - F_And *f_root = f_exists->add_and(); - GEQ_Handle h1 = f_root->add_GEQ(); - GEQ_Handle h2 = f_root->add_GEQ(); - for (Constr_Vars_Iter cvi2(*gei); cvi2; cvi2++) { - Variable_ID v = cvi2.curr_var(); - switch (v->kind()) { - case Wildcard_Var: - h1.update_coef(e, (*ii).modulo); - h2.update_coef(e, -(*ii).modulo); - break; - case Global_Var: { - Global_Var_ID g = v->get_global_var(); - Variable_ID v2; - if (g->arity() == 0) - v2 = stride_cond.get_local(g); - else - v2 = stride_cond.get_local(g, v->function_of()); - h1.update_coef(v2, cvi2.curr_coef()); - h2.update_coef(v2, -cvi2.curr_coef()); - break; - } - default: - h1.update_coef(v, cvi2.curr_coef()); - h2.update_coef(v, -cvi2.curr_coef()); - } - } - h1.update_const((*ii).ub); - h2.update_const(-(*ii).lb); - - (*(*ii).pos).second = Intersection(copy(other_cond), stride_cond); - (*(*ii).pos).second.simplify(); - } - } - - if (invalid) - break; - } - } - i++; - } - } - } - catch (const presburger_error &e) { - throw e; - } - - Relation R2 = Relation::False(l_R); - for (std::list >::iterator i = Rs.begin(); i != Rs.end(); i++) - R2 = Union(R2, Intersection((*i).first, (*i).second)); - R2.simplify(0, 1); - - return R2; -} - -// -// Use gist and value range to calculate a quick rectangular hull. It -// intends to replace all hull calculations (QuickHull, BetterHull, -// FastTightHull) beyond the method of ConvexHull (dual -// representations). In the future, it will support max(...)-like -// upper bound. So RectHull complements ConvexHull in two ways: first -// for relations that ConvexHull gets too complicated, second for -// relations where different conjuncts have different symbolic upper -// bounds. -// -Relation RectHull(NOT_CONST Relation &Rel) { - Relation R = Approximate(consume_and_regurgitate(Rel)); - if (!R.is_upper_bound_satisfiable()) - return R; - if (R.has_single_conjunct()) - return R; - - std::vector input_names(R.n_inp()); - for (int i = 1; i <= R.n_inp(); i++) - input_names[i-1] = R.input_var(i)->name(); - std::vector output_names(R.n_out()); - for (int i = 1; i <= R.n_out(); i++) - output_names[i-1] = R.output_var(i)->name(); - - DNF_Iterator c(R.query_DNF()); - Relation r = Relation(R, c.curr()); - c++; - std::vector > bounds1(R.n_inp()); - std::vector > bounds2(R.n_out()); - { - Relation t = Project_Sym(copy(r)); - t.simplify(); - for (int i = 1; i <= R.n_inp(); i++) { - Tuple v; - for (int j = 1; j <= R.n_inp(); j++) - if (j != i) - v.append(r.input_var(j)); - for (int j = 1; j <= R.n_out(); j++) - v.append(r.output_var(j)); - Relation t2 = Project(copy(t), v); - t2.query_variable_bounds(t2.input_var(i), bounds1[i-1].first, bounds1[i-1].second); - } - for (int i = 1; i <= R.n_out(); i++) { - Tuple v; - for (int j = 1; j <= R.n_out(); j++) - if (j != i) - v.append(r.output_var(j)); - for (int j = 1; j <= R.n_inp(); j++) - v.append(r.input_var(j)); - Relation t2 = Project(copy(t), v); - t2.query_variable_bounds(t2.output_var(i), bounds2[i-1].first, bounds2[i-1].second); - } - } - - while (c.live()) { - Relation r2 = Relation(R, c.curr()); - c++; - Relation x = Gist(copy(r), Gist(copy(r), copy(r2), 1), 1); - if (Difference(copy(r2), copy(x)).is_upper_bound_satisfiable()) - x = Relation::True(R); - Relation y = Gist(copy(r2), Gist(copy(r2), copy(r), 1), 1); - if (Difference(copy(r), copy(y)).is_upper_bound_satisfiable()) - y = Relation::True(R); - r = Intersection(x, y); - - { - Relation t = Project_Sym(copy(r2)); - t.simplify(); - for (int i = 1; i <= R.n_inp(); i++) { - Tuple v; - for (int j = 1; j <= R.n_inp(); j++) - if (j != i) - v.append(r2.input_var(j)); - for (int j = 1; j <= R.n_out(); j++) - v.append(r2.output_var(j)); - Relation t2 = Project(copy(t), v); - coef_t lbound, ubound; - t2.query_variable_bounds(t2.input_var(i), lbound, ubound); - bounds1[i-1].first = min(bounds1[i-1].first, lbound); - bounds1[i-1].second = max(bounds1[i-1].second, ubound); - } - for (int i = 1; i <= R.n_out(); i++) { - Tuple v; - for (int j = 1; j <= R.n_out(); j++) - if (j != i) - v.append(r2.output_var(j)); - for (int j = 1; j <= R.n_inp(); j++) - v.append(r2.input_var(j)); - Relation t2 = Project(copy(t), v); - coef_t lbound, ubound; - t2.query_variable_bounds(t2.output_var(i), lbound, ubound); - bounds2[i-1].first = min(bounds2[i-1].first, lbound); - bounds2[i-1].second = max(bounds2[i-1].second, ubound); - } - } - - Relation r3(R.n_inp(), R.n_out()); - F_And *f_root = r3.add_and(); - for (int i = 1; i <= R.n_inp(); i++) { - if (bounds1[i-1].first != -posInfinity) { - GEQ_Handle h = f_root->add_GEQ(); - h.update_coef(r3.input_var(i), 1); - h.update_const(-bounds1[i-1].first); - } - if (bounds1[i-1].second != posInfinity) { - GEQ_Handle h = f_root->add_GEQ(); - h.update_coef(r3.input_var(i), -1); - h.update_const(bounds1[i-1].second); - } - } - for (int i = 1; i <= R.n_out(); i++) { - if (bounds2[i-1].first != -posInfinity) { - GEQ_Handle h = f_root->add_GEQ(); - h.update_coef(r3.output_var(i), 1); - h.update_const(-bounds2[i-1].first); - } - if (bounds2[i-1].second != posInfinity) { - GEQ_Handle h = f_root->add_GEQ(); - h.update_coef(r3.output_var(i), -1); - h.update_const(bounds2[i-1].second); - } - } - r = Intersection(r, r3); - r.simplify(); - } - - for (int i = 1; i <= r.n_inp(); i++) - r.name_input_var(i, input_names[i-1]); - for (int i = 1; i <= r.n_out(); i++) - r.name_output_var(i, output_names[i-1]); - r.setup_names(); - return r; -} - -} - diff --git a/omega/omega_lib/src/hull_simple.cc b/omega/omega_lib/src/hull_simple.cc deleted file mode 100755 index 93d8ad3..0000000 --- a/omega/omega_lib/src/hull_simple.cc +++ /dev/null @@ -1,1013 +0,0 @@ -/***************************************************************************** - Copyright (C) 2011 Chun Chen - All Rights Reserved. - - Purpose: - Hull approximation including lattice and irregular constraints that - involves wildcards. - - Notes: - - History: - 03/12/11 Created by Chun Chen - *****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace omega { - -Relation SimpleHull(const Relation &R, bool allow_stride_constraint, - bool allow_irregular_constraint) { - std::vector Rs; - Rs.push_back(R); - return SimpleHull(Rs, allow_stride_constraint, allow_irregular_constraint); -} - -Relation SimpleHull(const std::vector &Rs, - bool allow_stride_constraint, bool allow_irregular_constraint) { - // check for sanity of parameters - if (Rs.size() == 0) - return Relation::False(0); - int num_dim = -1; - int first_non_null; - for (int i = 0; i < Rs.size(); i++) { - if (Rs[i].is_null()) - continue; - - if (num_dim == -1) { - num_dim = Rs[i].n_inp(); - first_non_null = i; - } - - if (Rs[i].n_inp() != num_dim) - throw std::invalid_argument( - "relations for hull must have same dimension"); - if (Rs[i].n_out() != 0) - throw std::invalid_argument( - "hull calculation must be set relation"); - } - - // convert to a list of relations each with a single conjunct - std::vector l_Rs; - for (int i = 0; i < Rs.size(); i++) { - if (Rs[i].is_null()) - continue; - - Relation r = copy(Rs[i]); - - //r.simplify(2, 4); - r.simplify(); - DNF_Iterator c(r.query_DNF()); - int top = l_Rs.size(); - while (c.live()) { - Relation r2 = Relation(r, c.curr()); - - // quick elimination of redundant conjuncts - bool already_included = false; - for (int j = 0; j < top; j++) - if (Must_Be_Subset(copy(r2), copy(l_Rs[j]))) { - already_included = true; - break; - } else if (Must_Be_Subset(copy(l_Rs[j]), copy(r2))) { - l_Rs.erase(l_Rs.begin() + j); - top--; - break; - } - - if (!already_included) - l_Rs.push_back(r2); - c++; - } - } - - // shortcut for simple case - if (l_Rs.size() == 0) { - if (num_dim == -1) - return Relation::False(0); - else { - Relation r = Relation::False(num_dim); - r.copy_names(Rs[first_non_null]); - r.setup_names(); - return r; - } - } else if (l_Rs.size() == 1) { - if (allow_stride_constraint && allow_irregular_constraint) { - l_Rs[0].copy_names(Rs[first_non_null]); - l_Rs[0].setup_names(); - return l_Rs[0]; - } else if (!allow_stride_constraint && !allow_irregular_constraint) { - l_Rs[0] = Approximate(l_Rs[0]); - l_Rs[0].copy_names(Rs[first_non_null]); - l_Rs[0].setup_names(); - return l_Rs[0]; - } - } - - Relation hull = Relation::True(num_dim); - - // lattice union approximation - if (allow_stride_constraint) { - std::vector > > > strides( - l_Rs.size()); - for (int i = 0; i < l_Rs.size(); i++) - for (EQ_Iterator e = l_Rs[i].single_conjunct()->EQs(); e; e++) - if ((*e).has_wildcards()) { - int num_wildcard = 0; - BoolSet<> affected(num_dim); - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) { - if (cvi.curr_var()->kind() == Wildcard_Var) - num_wildcard++; - else if (cvi.curr_var()->kind() == Input_Var) - affected.set(cvi.curr_var()->get_position() - 1); - } - if (num_wildcard == 1) - strides[i].push_back(std::make_pair(*e, affected)); - } - - for (int i = 0; i < strides[0].size(); i++) { - coef_t c = - abs( - strides[0][i].first.get_coef( - Constr_Vars_Iter(strides[0][i].first, true).curr_var())); - coef_t old_c = c; - bool is_stride = true; - for (int j = 1; j < l_Rs.size(); j++) { - std::list candidates; - for (int k = 0; k < strides[j].size(); k++) - if (!(strides[0][i].second & strides[j][k].second).empty()) { - coef_t t = gcd(c, - abs( - strides[j][k].first.get_coef( - Constr_Vars_Iter( - strides[j][k].first, - true).curr_var()))); - if (t != 1) { - std::list::iterator p = candidates.begin(); - while (p != candidates.end() && *p > t) - ++p; - if (p == candidates.end() || *p != t) - candidates.insert(p, t); - - t = gcd(t, abs(strides[0][i].first.get_const())); - t = gcd(t, abs(strides[j][k].first.get_const())); - if (t != 1) { - std::list::iterator p = - candidates.begin(); - while (p != candidates.end() && *p > t) - ++p; - if (p == candidates.end() || *p != t) - candidates.insert(p, t); - } - } - } - - bool found_matched_stride = false; - for (std::list::iterator k = candidates.begin(); - k != candidates.end(); k++) { - Relation r = Relation::True(num_dim); - EQ_Handle h = r.and_with_EQ(strides[0][i].first); - h.update_coef(Constr_Vars_Iter(h, true).curr_var(), - -old_c + *k); - r.simplify(); - if (Must_Be_Subset(copy(l_Rs[j]), copy(r))) { - c = *k; - found_matched_stride = true; - break; - } - } - - if (!found_matched_stride) { - is_stride = false; - break; - } - } - - if (is_stride) { - Relation r = Relation::True(num_dim); - EQ_Handle h = r.and_with_EQ(strides[0][i].first); - h.update_coef(Constr_Vars_Iter(h, true).curr_var(), -old_c + c); - r.simplify(); - hull = Intersection(hull, r); - } - } - } - - // consider some special wildcard constraints - if (allow_irregular_constraint) { - std::vector< - std::vector< - std::pair > > > ranges( - l_Rs.size()); - for (int i = 0; i < l_Rs.size(); i++) { - std::vector > > geqs_ub; - std::vector > > geqs_lb; - for (GEQ_Iterator e = l_Rs[i].single_conjunct()->GEQs(); e; e++) - if ((*e).has_wildcards()) { - int num_wildcard = 0; - std::map formula; - int direction; - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) { - Variable_ID v = cvi.curr_var(); - switch (v->kind()) { - case Wildcard_Var: - num_wildcard++; - if (cvi.curr_coef() > 0) - direction = true; - else - direction = false; - break; - case Input_Var: - case Global_Var: - formula[cvi.curr_var()] = cvi.curr_coef(); - break; - default: - assert(false); - } - } - if (num_wildcard == 1) { - if (direction) { - for (std::map::iterator j = - formula.begin(); j != formula.end(); j++) - j->second = -j->second; - geqs_ub.push_back(std::make_pair(*e, formula)); - } else - geqs_lb.push_back(std::make_pair(*e, formula)); - } - } - for (int j = 0; j < geqs_lb.size(); j++) { - Variable_ID v = - Constr_Vars_Iter(geqs_lb[j].first, true).curr_var(); - for (int k = 0; k < geqs_ub.size(); k++) - if (v == Constr_Vars_Iter(geqs_ub[k].first, true).curr_var() - && geqs_lb[j].second == geqs_ub[k].second) - ranges[i].push_back( - std::make_pair(v, geqs_lb[j].second)); - } - } - - // find compatible wildcard match - // TODO: evaluate to find the best match, also avoid mapping two wildcards - // in a single conjunct to one variable (incorrect) - std::vector > all_match; - for (int i = 0; i < ranges[0].size(); i++) { - std::vector match(l_Rs.size(), -1); - match[0] = i; - for (int j = 1; j < l_Rs.size(); j++) { - for (int k = 0; k < ranges[j].size(); k++) - if (ranges[0][i].second == ranges[j][k].second) { - match[j] = k; - break; - } - if (match[j] == -1) - break; - } - if (match[l_Rs.size() - 1] != -1) - all_match.push_back(match); - } - - // map compatible wildcards to input variables - std::vector ll_Rs(l_Rs.size()); - for (int i = 0; i < l_Rs.size(); i++) { - Relation r(num_dim + all_match.size()); - F_Exists *f_exists = r.add_and()->add_exists(); - F_And *f_root = f_exists->add_and(); - std::map wc_map; - for (int j = 0; j < all_match.size(); j++) - wc_map[ranges[i][all_match[j][i]].first] = r.set_var(j + 1); - - for (EQ_Iterator e(l_Rs[i].single_conjunct()->EQs()); e; e++) - if (!(*e).has_wildcards()) { - EQ_Handle h = f_root->add_EQ(); - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) - switch (cvi.curr_var()->kind()) { - case Input_Var: { - h.update_coef( - r.set_var( - cvi.curr_var()->get_position() - + all_match.size()), - cvi.curr_coef()); - break; - } - case Global_Var: { - Global_Var_ID g = cvi.curr_var()->get_global_var(); - Variable_ID v; - if (g->arity() == 0) - v = r.get_local(g); - else - v = r.get_local(g, - cvi.curr_var()->function_of()); - h.update_coef(v, cvi.curr_coef()); - break; - } - default: - assert(false); - } - h.update_const((*e).get_const()); - } - - for (GEQ_Iterator e(l_Rs[i].single_conjunct()->GEQs()); e; e++) { - GEQ_Handle h = f_root->add_GEQ(); - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) - switch (cvi.curr_var()->kind()) { - case Input_Var: { - h.update_coef( - r.set_var( - cvi.curr_var()->get_position() - + all_match.size()), - cvi.curr_coef()); - break; - } - case Global_Var: { - Global_Var_ID g = cvi.curr_var()->get_global_var(); - Variable_ID v; - if (g->arity() == 0) - v = r.get_local(g); - else - v = r.get_local(g, cvi.curr_var()->function_of()); - h.update_coef(v, cvi.curr_coef()); - break; - } - case Wildcard_Var: { - std::map::iterator p = - wc_map.find(cvi.curr_var()); - Variable_ID v; - if (p == wc_map.end()) { - v = f_exists->declare(); - wc_map[cvi.curr_var()] = v; - } else - v = p->second; - h.update_coef(v, cvi.curr_coef()); - break; - } - default: - assert(false); - } - h.update_const((*e).get_const()); - } - - r.simplify(); - ll_Rs[i] = r; - } - - // now use SimpleHull on regular bounds only - Relation result = SimpleHull(ll_Rs, false, false); - - // convert imaginary input variables back to wildcards - Relation mapping(num_dim + all_match.size(), num_dim); - F_And *f_root = mapping.add_and(); - for (int i = 0; i < num_dim; i++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.input_var(all_match.size() + i + 1), 1); - h.update_coef(mapping.output_var(i + 1), -1); - } - result = Range(Restrict_Domain(mapping, result)); - - hull = Intersection(hull, result); - hull.simplify(); - hull.copy_names(Rs[first_non_null]); - hull.setup_names(); - return hull; - } - - // check regular bounds - if (l_Rs.size() == 1) { - hull = Intersection(hull, Approximate(copy(l_Rs[0]))); - } else { - for (int i = 0; i < l_Rs.size(); i++) { - l_Rs[i] = Approximate(l_Rs[i]); - l_Rs[i].simplify(2, 4); - } - - // check global variables - // TODO: global variable function_of() is not considered for now - std::map globals; - for (int i = 0; i < l_Rs.size(); i++) - for (Constraint_Iterator e( - l_Rs[i].single_conjunct()->constraints()); e; e++) - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) - if (cvi.curr_var()->kind() == Global_Var) - globals[cvi.curr_var()->get_global_var()] = -1; - - if (globals.size() > 0) { - int count = 1; - for (std::map::iterator i = globals.begin(); - i != globals.end(); i++) - i->second = count++; - - std::vector ll_Rs(l_Rs.size()); - for (int i = 0; i < l_Rs.size(); i++) { - Relation r(num_dim + globals.size()); - F_And *f_root = r.add_and(); - for (EQ_Iterator e(l_Rs[i].single_conjunct()->EQs()); e; e++) { - EQ_Handle h = f_root->add_EQ(); - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) - switch (cvi.curr_var()->kind()) { - case Input_Var: { - h.update_coef( - r.set_var( - cvi.curr_var()->get_position() - + globals.size()), - cvi.curr_coef()); - break; - } - case Global_Var: { - h.update_coef( - r.set_var( - globals[cvi.curr_var()->get_global_var()]), - cvi.curr_coef()); - break; - } - default: - assert(false); - } - h.update_const((*e).get_const()); - } - for (GEQ_Iterator e(l_Rs[i].single_conjunct()->GEQs()); e; - e++) { - GEQ_Handle h = f_root->add_GEQ(); - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) - switch (cvi.curr_var()->kind()) { - case Input_Var: { - h.update_coef( - r.set_var( - cvi.curr_var()->get_position() - + globals.size()), - cvi.curr_coef()); - break; - } - case Global_Var: { - h.update_coef( - r.set_var( - globals[cvi.curr_var()->get_global_var()]), - cvi.curr_coef()); - break; - } - default: - assert(false); - } - h.update_const((*e).get_const()); - } - - ll_Rs[i] = r; - } - - Relation result = SimpleHull(ll_Rs, false, false); - - std::map globals_reverse; - for (std::map::iterator i = globals.begin(); - i != globals.end(); i++) - globals_reverse[i->second] = i->first; - - Relation r(num_dim); - F_And *f_root = r.add_and(); - for (EQ_Iterator e(result.single_conjunct()->EQs()); e; e++) { - EQ_Handle h = f_root->add_EQ(); - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) - switch (cvi.curr_var()->kind()) { - case Input_Var: { - int pos = cvi.curr_var()->get_position(); - if (pos > globals_reverse.size()) - h.update_coef( - r.set_var(pos - globals_reverse.size()), - cvi.curr_coef()); - else { - Global_Var_ID g = globals_reverse[pos]; - h.update_coef(r.get_local(g), cvi.curr_coef()); - } - break; - } - default: - assert(false); - } - h.update_const((*e).get_const()); - } - for (GEQ_Iterator e(result.single_conjunct()->GEQs()); e; e++) { - GEQ_Handle h = f_root->add_GEQ(); - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) - switch (cvi.curr_var()->kind()) { - case Input_Var: { - int pos = cvi.curr_var()->get_position(); - if (pos > globals_reverse.size()) - h.update_coef( - r.set_var(pos - globals_reverse.size()), - cvi.curr_coef()); - else { - Global_Var_ID g = globals_reverse[pos]; - h.update_coef(r.get_local(g), cvi.curr_coef()); - } - break; - } - default: - assert(false); - } - h.update_const((*e).get_const()); - } - - hull = Intersection(hull, r); - hull.simplify(); - hull.copy_names(Rs[first_non_null]); - hull.setup_names(); - return hull; - } else { - std::vector > projected(num_dim + 1, - std::vector(l_Rs.size())); - for (int i = 0; i < l_Rs.size(); i++) { - projected[num_dim][i] = copy(l_Rs[i]); - for (int j = num_dim - 1; j >= 0; j--) { - projected[j][i] = Project(copy(projected[j + 1][i]), - projected[j + 1][i].input_var(j + 1)); - projected[j][i].simplify(2, 4); - } - } - - std::vector has_lb(num_dim, false); - std::vector has_ub(num_dim, false); - for (int i = 0; i < num_dim; i++) { - bool skip_lb = false; - bool skip_ub = false; - std::vector bound(l_Rs.size()); - for (int j = 0; j < l_Rs.size(); j++) { - bound[j] = Gist(copy(projected[i + 1][j]), - copy(projected[i][j]), 1); - bound[j] = Approximate(bound[j]); - bound[j] = EQs_to_GEQs(bound[j]); - - bool has_lb_not_in_hull = false; - bool has_ub_not_in_hull = false; - for (GEQ_Iterator e = bound[j].single_conjunct()->GEQs(); e; - e++) { - coef_t coef = (*e).get_coef(bound[j].input_var(i + 1)); - if (!skip_lb && coef > 0) { - Relation r = Relation::True(bound[j].n_inp()); - r.and_with_GEQ(*e); - r.simplify(); - - if (j != 0 && l_Rs.size() > 2 - && Must_Be_Subset(copy(hull), copy(r))) - continue; - - bool belong_to_hull = true; - for (int k = 0; k < l_Rs.size(); k++) - if (k != j - && !Must_Be_Subset(copy(l_Rs[k]), - copy(r))) { - belong_to_hull = false; - break; - } - if (belong_to_hull) { - hull.and_with_GEQ(*e); - has_lb[i] = true; - } else - has_lb_not_in_hull = true; - } else if (!skip_ub && coef < 0) { - Relation r = Relation::True(bound[j].n_inp()); - r.and_with_GEQ(*e); - r.simplify(); - - if (j != 0 && l_Rs.size() > 2 - && Must_Be_Subset(copy(hull), copy(r))) - continue; - - bool belong_to_hull = true; - for (int k = 0; k < l_Rs.size(); k++) - if (k != j - && !Must_Be_Subset(copy(l_Rs[k]), - copy(r))) { - belong_to_hull = false; - break; - } - if (belong_to_hull) { - hull.and_with_GEQ(*e); - has_ub[i] = true; - } else - has_ub_not_in_hull = true; - } - } - - if (!has_lb_not_in_hull) - skip_lb = true; - if (!has_ub_not_in_hull) - skip_ub = true; - if (skip_lb && skip_ub) - break; - } - - // no ready lower bound, approximate it - bool got_rect_lb = false; - if (!skip_lb) { - for (int j = 0; j < l_Rs.size(); j++) { - std::set > S; - for (GEQ_Iterator e = - bound[j].single_conjunct()->GEQs(); e; e++) { - coef_t coef = (*e).get_coef( - bound[j].input_var(i + 1)); - if (coef > 0) { - BoolSet<> s(i); - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) - if ((*cvi).var->kind() == Input_Var - && (*cvi).var->get_position() - 1 - != i) { - if (((*cvi).coef > 0 - && has_ub[(*cvi).var->get_position() - - 1]) - || ((*cvi).coef < 0 - && has_lb[(*cvi).var->get_position() - - 1])) - s.set( - (*cvi).var->get_position() - - 1); - else { - for (GEQ_Iterator e2 = - bound[j].single_conjunct()->GEQs(); - e2; e2++) - if (e2 != e - && (((*cvi).coef > 0 - && (*e2).get_coef( - (*cvi).var) - < 0) - || ((*cvi).coef - < 0 - && (*e2).get_coef( - (*cvi).var) - > 0))) { - s.set( - (*cvi).var->get_position() - - 1); - break; - } - } - } - - if (s.num_elem() > 0) - S.insert(s); - } - } - - if (S.size() > 0) { - BoolSet<> s(i); - for (std::set >::iterator k = S.begin(); - k != S.end(); k++) - s |= *k; - for (int k = 0; k < i; k++) - if (s.get(k)) { - BoolSet<> t(i); - t.set(k); - S.insert(t); - } - - for (std::set >::iterator k = S.begin(); - k != S.end(); k++) { - - bool do_again = false; - std::set vars; - int round_trip = 0; - do { - Relation r = copy(projected[i + 1][j]); - - if (!do_again) { - for (int kk = 0; kk < i; kk++) - if ((*k).get(kk)) { - r = Project(r, - r.input_var(kk + 1)); - vars.insert(kk + 1); - } - } else { - for (std::set::iterator vars_it = - vars.begin(); - vars_it != vars.end(); - vars_it++) - if (*vars_it < i + 1) - r = Project(r, - r.input_var(*vars_it)); - } - - r.simplify(2, 4); - Relation r2 = Project(copy(r), - r.input_var(i + 1)); - Relation b = Gist(copy(r), copy(r2), 1); - // Relation c = Project(copy(r),r.input_var(4) ); - - // c.simplify(2,4); - // Relation d = Project(copy(c), r.input_var(i+1)); - // Relation e = Gist(copy(c), copy(d), 1); - - b = Approximate(b); - b = EQs_to_GEQs(b); - - for (GEQ_Iterator e = - b.single_conjunct()->GEQs(); e; - e++) { - coef_t coef = (*e).get_coef( - b.input_var(i + 1)); - if (coef > 0) { - Relation r = Relation::True( - b.n_inp()); - r.and_with_GEQ(*e); - r.simplify(); - - if (Must_Be_Subset(copy(hull), - copy(r))) - continue; - - bool belong_to_hull = true; - for (int k = 0; k < l_Rs.size(); - k++) - if (k != j - && !Must_Be_Subset( - copy(l_Rs[k]), - copy(r))) { - belong_to_hull = false; - break; - } - if (belong_to_hull) { - hull.and_with_GEQ(*e); - got_rect_lb = true; - } - } - } - do_again = false; - if (!got_rect_lb) { - bool found = false; - for (GEQ_Iterator e = - b.single_conjunct()->GEQs(); e; - e++) { - coef_t coef = (*e).get_coef( - b.input_var(i + 1)); - - if (coef > 0) { - for (Constr_Vars_Iter cvi(*e); - cvi; cvi++) - if ((*cvi).var->kind() - == Input_Var - && (*cvi).var->get_position() - - 1 != i) { - - if (((*cvi).coef > 0 - && has_ub[(*cvi).var->get_position() - - 1]) - || ((*cvi).coef - < 0 - && has_lb[(*cvi).var->get_position() - - 1])) { - vars.insert( - (*cvi).var->get_position()); - found = true; - } else { - for (GEQ_Iterator e2 = - b.single_conjunct()->GEQs(); - e2; e2++) - if (e2 != e - && (((*cvi).coef - > 0 - && (*e2).get_coef( - (*cvi).var) - < 0) - || ((*cvi).coef - < 0 - && (*e2).get_coef( - (*cvi).var) - > 0))) { - vars.insert( - (*cvi).var->get_position()); - found = - true; - break; - } - } - - } - - } - if (found) - break; - - } - if (found && (round_trip < i)) - do_again = true; - - } - round_trip++; - } while (do_again); - } - - if (got_rect_lb) - break; - } - } - } - - // no ready upper bound, approximate it - bool got_rect_ub = false; - if (!skip_ub) { - for (int j = 0; j < l_Rs.size(); j++) { - std::set > S; - for (GEQ_Iterator e = - bound[j].single_conjunct()->GEQs(); e; e++) { - coef_t coef = (*e).get_coef( - bound[j].input_var(i + 1)); - if (coef < 0) { - BoolSet<> s(i); - for (Constr_Vars_Iter cvi(*e); cvi; cvi++) - if ((*cvi).var->kind() == Input_Var - && (*cvi).var->get_position() - 1 - != i) { - if (((*cvi).coef > 0 - && has_ub[(*cvi).var->get_position() - - 1]) - || ((*cvi).coef < 0 - && has_lb[(*cvi).var->get_position() - - 1])) - s.set( - (*cvi).var->get_position() - - 1); - else { - for (GEQ_Iterator e2 = - bound[j].single_conjunct()->GEQs(); - e2; e2++) - if (e2 != e - && (((*cvi).coef > 0 - && (*e2).get_coef( - (*cvi).var) - < 0) - || ((*cvi).coef - < 0 - && (*e2).get_coef( - (*cvi).var) - > 0))) { - s.set( - (*cvi).var->get_position() - - 1); - break; - } - } - } - - if (s.num_elem() > 0) - S.insert(s); - } - } - - if (S.size() > 0) { - BoolSet<> s(i); - for (std::set >::iterator k = S.begin(); - k != S.end(); k++) - s |= *k; - for (int k = 0; k < i; k++) - if (s.get(k)) { - BoolSet<> t(i); - t.set(k); - S.insert(t); - } - - for (std::set >::iterator k = S.begin(); - k != S.end(); k++) { - - bool do_again = false; - std::set vars; - int round_trip = 0; - do { - - Relation r = copy(projected[i + 1][j]); - - if (!do_again) { - for (int kk = 0; kk < i; kk++) - if ((*k).get(kk)) { - r = Project(r, - r.input_var(kk + 1)); - vars.insert(kk + 1); - } - } else { - for (std::set::iterator vars_it = - vars.begin(); - vars_it != vars.end(); - vars_it++) - if (*vars_it < i + 1) - r = Project(r, - r.input_var(*vars_it)); - } - - r.simplify(2, 4); - Relation r2 = Project(copy(r), - r.input_var(i + 1)); - // r2.simplify(2,4); - Relation b = Gist(r, r2, 1); - b = Approximate(b); - b = EQs_to_GEQs(b); - - for (GEQ_Iterator e = - b.single_conjunct()->GEQs(); e; - e++) { - coef_t coef = (*e).get_coef( - b.input_var(i + 1)); - if (coef < 0) { - Relation r = Relation::True( - b.n_inp()); - r.and_with_GEQ(*e); - r.simplify(); - - if (Must_Be_Subset(copy(hull), - copy(r))) - continue; - - bool belong_to_hull = true; - for (int k = 0; k < l_Rs.size(); - k++) - if (k != j - && !Must_Be_Subset( - copy(l_Rs[k]), - copy(r))) { - belong_to_hull = false; - break; - } - if (belong_to_hull) { - hull.and_with_GEQ(*e); - got_rect_ub = true; - } - } - } - do_again = false; - if (!got_rect_ub) { - bool found = false; - for (GEQ_Iterator e = - b.single_conjunct()->GEQs(); e; - e++) { - coef_t coef = (*e).get_coef( - b.input_var(i + 1)); - if (coef < 0) { - for (Constr_Vars_Iter cvi(*e); - cvi; cvi++) - if ((*cvi).var->kind() - == Input_Var - && (*cvi).var->get_position() - - 1 != i) { - - if (((*cvi).coef > 0 - && has_ub[(*cvi).var->get_position() - - 1]) - || ((*cvi).coef - < 0 - && has_lb[(*cvi).var->get_position() - - 1])) { - vars.insert( - (*cvi).var->get_position()); - found = true; - } else { - for (GEQ_Iterator e2 = - b.single_conjunct()->GEQs(); - e2; e2++) - if (e2 != e - && (((*cvi).coef - > 0 - && (*e2).get_coef( - (*cvi).var) - < 0) - || ((*cvi).coef - < 0 - && (*e2).get_coef( - (*cvi).var) - > 0))) { - vars.insert( - (*cvi).var->get_position()); - found = - true; - break; - } - } - - } - } - if (found) - break; - } - if (found && (round_trip < i)) - do_again = true; - - } - round_trip++; - } while (do_again); - } - - if (got_rect_ub) - break; - } - } - } - } - } - } - - hull.simplify(); - hull.copy_names(Rs[first_non_null]); - hull.setup_names(); - return hull; -} - -} - diff --git a/omega/omega_lib/src/omega_core/oc.cc b/omega/omega_lib/src/omega_core/oc.cc deleted file mode 100644 index 0dc9b49..0000000 --- a/omega/omega_lib/src/omega_core/oc.cc +++ /dev/null @@ -1,754 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 the Omega Project Team - Copyright (C) 2005-2011 Chun Chen - All Rights Reserved. - - Purpose: - Simplify a problem. - - Notes: - - History: - 12/10/06 Improved gist function, by Chun Chen. -*****************************************************************************/ - -#include - -namespace omega { - -eqn SUBs[maxVars+1]; -Memory redMemory[maxVars+1]; - -int Problem::reduceProblem() { - int result; - checkVars(nVars+1); - assert(omegaInitialized); - if (nVars > nEQs + 3 * safeVars) - freeEliminations(safeVars); - - check(); - if (!mayBeRed && nSUBs == 0 && safeVars == 0) { - result = solve(OC_SOLVE_UNKNOWN); - nGEQs = 0; - nEQs = 0; - nSUBs = 0; - nMemories = 0; - if (!result) { - int e = newEQ(); - assert(e == 0); - eqnnzero(&EQs[0], nVars); - EQs[0].color = EQ_BLACK; - EQs[0].coef[0] = 1; - } - check(); - return result; - } - return solve(OC_SOLVE_SIMPLIFY); -} - - -int Problem::simplifyProblem(int verify, int subs, int redundantElimination) { - checkVars(nVars+1); - assert(omegaInitialized); - setInternals(); - check(); - if (!reduceProblem()) goto returnFalse; - if (verify) { - addingOuterEqualities++; - int r = verifyProblem(); - addingOuterEqualities--; - if (!r) goto returnFalse; - if (nEQs) { // found some equality constraints during verification - int numRed = 0; - if (mayBeRed) - for (int e = nGEQs - 1; e >= 0; e--) if (GEQs[e].color == EQ_RED) numRed++; - if (mayBeRed && nVars == safeVars && numRed == 1) - nEQs = 0; // discard them - else if (!reduceProblem()) { - assert(0 && "Added equality constraint to verified problem generates false"); - } - } - } - if (redundantElimination) { - if (redundantElimination > 1) { - if (!expensiveEqualityCheck()) goto returnFalse; - } - if (!quickKill(0)) goto returnFalse; - if (redundantElimination > 1) { - if (!expensiveKill()) goto returnFalse; - } - } - resurrectSubs(); - if (redundantElimination) - simplifyStrideConstraints(); - if (redundantElimination > 2 && safeVars < nVars) { - if (!quickKill(0)) goto returnFalse; - return simplifyProblem(verify, subs, redundantElimination-2); - } - setExternals(); - assert(nMemories == 0); - return (1); - -returnFalse: - nGEQs = 0; - nEQs = 0; - resurrectSubs(); - nGEQs = 0; - nEQs = 0; - int neweq = newEQ(); - assert(neweq == 0); - eqnnzero(&EQs[neweq], nVars); - EQs[neweq].color = EQ_BLACK; - EQs[neweq].coef[0] = 1; - nMemories = 0; - return 0; -} - -int Problem::simplifyApproximate(bool strides_allowed) { - int result; - checkVars(nVars+1); - assert(inApproximateMode == 0); - - inApproximateMode = 1; - inStridesAllowedMode = strides_allowed; - if (TRACE) - fprintf(outputFile, "Entering Approximate Mode [\n"); - - assert(omegaInitialized); - result = simplifyProblem(0,0,0); - - while (result && !strides_allowed && nVars > safeVars) { - int e; - for (e = nGEQs - 1; e >= 0; e--) - if (GEQs[e].coef[nVars]) deleteGEQ(e); - for (e = nEQs - 1; e >= 0; e--) - if (EQs[e].coef[nVars]) deleteEQ(e); - nVars--; - result = simplifyProblem(0,0,0); - } - - if (TRACE) - fprintf(outputFile, "] Leaving Approximate Mode\n"); - - assert(inApproximateMode == 1); - inApproximateMode=0; - inStridesAllowedMode = 0; - - assert(nMemories == 0); - return (result); -} - - - - -/* - * Return 1 if red equations constrain the set of possible - * solutions. We assume that there are solutions to the black - * equations by themselves, so if there is no solution to the combined - * problem, we return 1. - */ - -#ifdef GIST_CHECK -Problem full_answer, context; -Problem redProblem; -#endif - -redCheck Problem::redSimplifyProblem(int effort, int computeGist) { - int result; - int e; - - checkVars(nVars+1); - assert(mayBeRed >= 0); - mayBeRed++; - - assert(omegaInitialized); - if (TRACE) { - fprintf(outputFile, "Checking for red equations:\n"); - printProblem(); - } - setInternals(); - -#ifdef GIST_CHECK - int r1,r2; - if (TRACE) - fprintf(outputFile,"Set-up for gist invariant checking[\n"); - redProblem = *this; - redProblem.check(); - full_answer = *this; - full_answer.check(); - full_answer.turnRedBlack(); - full_answer.check(); - r1 = full_answer.simplifyProblem(1,0,1); - full_answer.check(); - if (DBUG) fprintf(outputFile,"Simplifying context [\n"); - context = *this; - context.check(); - context.deleteRed(); - context.check(); - r2 = context.simplifyProblem(1,0,1); - context.check(); - if (DBUG) fprintf(outputFile,"] Simplifying context\n"); - - if (!r2 && TRACE) fprintf(outputFile, "WARNING: Gist context is false!\n"); - if (TRACE) - fprintf(outputFile,"] Set-up for gist invariant checking done\n"); -#endif - - // Save known integer modular equations, -- by chun 12/10/2006 - eqn ModularEQs[nEQs]; - int nModularEQs = 0; - int old_nVars = nVars; - for (int e = 0; e < nEQs; e++) - if (EQs[e].color != EQ_RED) - for (int i = safeVars+1; i <= nVars; i++) - if (EQs[e].coef[i] != 0) { - eqnncpy(&(ModularEQs[nModularEQs++]), &(EQs[e]), nVars); - break; - } - - - if (solveEQ() == false) { - if (TRACE) - fprintf(outputFile, "Gist is FALSE\n"); - if (computeGist) { - nMemories = 0; - nGEQs = 0; - nEQs = 0; - resurrectSubs(); - nGEQs = 0; - nEQs = 0; - int neweq = newEQ(); - assert(neweq == 0); - eqnnzero(&EQs[neweq], nVars); - EQs[neweq].color = EQ_RED; - EQs[neweq].coef[0] = 1; - } - mayBeRed--; - return redFalse; - } - - if (!computeGist && nMemories) - return redConstraints; - if (normalize() == normalize_false) { - if (TRACE) - fprintf(outputFile, "Gist is FALSE\n"); - if (computeGist) { - nGEQs = 0; - nEQs = 0; - resurrectSubs(); - nMemories = 0; - nGEQs = 0; - nEQs = 0; - int neweq = newEQ(); - assert(neweq == 0); - eqnnzero(&EQs[neweq], nVars); - EQs[neweq].color = EQ_RED; - EQs[neweq].coef[0] = 1; - } - mayBeRed--; - return redFalse; - } - - result = 0; - for (e = nGEQs - 1; e >= 0; e--) if (GEQs[e].color == EQ_RED) result = 1; - for (e = nEQs - 1; e >= 0; e--) if (EQs[e].color == EQ_RED) result = 1; - if (nMemories) result = 1; - if (!result) { - if (computeGist) { - nGEQs = 0; - nEQs = 0; - resurrectSubs(); - nGEQs = 0; - nMemories = 0; - nEQs = 0; - } - mayBeRed--; - return noRed; - } - - result = simplifyProblem(effort?1:0,1,0); -#ifdef GIST_CHECK - if (!r1 && TRACE && result) - fprintf(outputFile, "Gist is False but not detected\n"); -#endif - if (!result) { - if (TRACE) - fprintf(outputFile, "Gist is FALSE\n"); - if (computeGist) { - nGEQs = 0; - nEQs = 0; - resurrectSubs(); - nGEQs = 0; - nEQs = 0; - int neweq = newEQ(); - assert(neweq == 0); - nMemories = 0; - eqnnzero(&EQs[neweq], nVars); - EQs[neweq].color = EQ_RED; - EQs[neweq].coef[0] = 1; - } - mayBeRed--; - return redFalse; - } - - freeRedEliminations(); - - result = 0; - for (e = nGEQs - 1; e >= 0; e--) if (GEQs[e].color == EQ_RED) result = 1; - for (e = nEQs - 1; e >= 0; e--) if (EQs[e].color == EQ_RED) result = 1; - if (nMemories) result = 1; - if (!result) { - if (computeGist) { - nGEQs = 0; - nEQs = 0; - resurrectSubs(); - nGEQs = 0; - nMemories = 0; - nEQs = 0; - } - mayBeRed--; - return noRed; - } - - if (effort && (computeGist || !nMemories)) { - if (TRACE) - fprintf(outputFile, "*** Doing potentially expensive elimination tests for red equations [\n"); - quickRedKill(computeGist); - checkGistInvariant(); - result = nMemories; - for (e = nGEQs - 1; e >= 0; e--) if (GEQs[e].color == EQ_RED) result++; - for (e = nEQs - 1; e >= 0; e--) if (EQs[e].color == EQ_RED) result++; - if (result && effort > 1 && (computeGist || !nMemories)) { - expensiveRedKill(); - result = nMemories; - for (e = nGEQs-1; e >= 0; e--) if (GEQs[e].color == EQ_RED) result++; - for (e = nEQs-1; e >= 0; e--) if (EQs[e].color == EQ_RED) result++; - } - - if (!result) { - if (TRACE) - fprintf(outputFile, "]******************** Redudant Red Equations eliminated!!\n"); - if (computeGist) { - nGEQs = 0; - nEQs = 0; - resurrectSubs(); - nGEQs = 0; - nMemories = 0; - nEQs = 0; - } - mayBeRed--; - return noRed; - } - - if (TRACE) fprintf(outputFile, "]******************** Red Equations remain\n"); - if (DEBUG) printProblem(); - } - - if (computeGist) { - resurrectSubs(); - cleanoutWildcards(); - - - // Restore saved modular equations into EQs without affecting the problem - if (nEQs+nModularEQs > allocEQs) { - allocEQs = padEQs(allocEQs, nEQs+nModularEQs); - eqn *new_eqs = new eqn[allocEQs]; - for (int e = 0; e < nEQs; e++) - eqnncpy(&(new_eqs[e]), &(EQs[e]), nVars); - delete[] EQs; - EQs= new_eqs; - } - - for (int e = 0; e < nModularEQs; e++) { - eqnncpy(&(EQs[nEQs+e]), &(ModularEQs[e]), old_nVars); - EQs[nEQs+e].color = EQ_RED; - Tuple t(safeVars); - for (int i = 1; i <= safeVars; i++) - t[i] = ModularEQs[e].coef[var[i]]; - for (int i = 1; i <= safeVars; i++) - EQs[nEQs+e].coef[i] = t[i]; - } - - - // Now simplify modular equations using Chinese remainder theorem -- by chun 12/10/2006 - for (int e = 0; e < nEQs; e++) - if (EQs[e].color == EQ_RED) { - int wild_pos = -1; - for (int i = safeVars+1; i <= nVars; i++) - if (EQs[e].coef[i] != 0) { - wild_pos = i; - break; - } - - if (wild_pos == -1) - continue; - - for (int e2 = e+1; e2 < nEQs+nModularEQs; e2++) - if (EQs[e2].color == EQ_RED) { - int wild_pos2 = -1; - for (int i = safeVars+1; i <= ((e20?1:-1)*g4; - } - } - } - - deleteBlack(); - } - - setExternals(); - mayBeRed--; - assert(nMemories == 0); - return redConstraints; -} - - -void Problem::convertEQstoGEQs(bool excludeStrides) { - int i; - int e; - if (DBUG) - fprintf(outputFile, "Converting all EQs to GEQs\n"); - simplifyProblem(0,0,0); - for(e=0;e working_on(safeVars); - for (int i = 1; i <= safeVars; i++) - working_on[i] = false; - - return query_variable_mod(v, factor, color, nModularEQs, nModularVars, working_on); -} - -coef_t Problem::query_variable_mod(int v, coef_t factor, int color, int nModularEQs, int nModularVars, Tuple &working_on) const { - working_on[v] = true; - - for (int e = 0; e < nEQs+nModularEQs; e++) - if (EQs[e].color == color) { - coef_t coef = int_mod_hat(EQs[e].coef[v], factor); - if (abs(coef) != 1) - continue; - - bool wild_factored = true; - for (int i = safeVars+1; i <= ((echeck(); - p2->check(); - p1->resurrectSubs(); - p2->resurrectSubs(); - p1->check(); - p2->check(); - p1->putVariablesInStandardOrder(); - p2->putVariablesInStandardOrder(); - p1->check(); - p2->check(); - p1->ordered_elimination(0); - p2->ordered_elimination(0); - p1->check(); - p2->check(); - r1 = p1->simplifyProblem(1,1,0); - r2 = p2->simplifyProblem(1,1,0); - p1->check(); - p2->check(); - - if (!r1 || !r2) { - if (r1 == r2) return apparentlyEqual; - return NotEqual; - } - if (p1->nVars != p2->nVars - || p1->nGEQs != p2->nGEQs - || p1->nSUBs != p2->nSUBs - || p1->checkSum() != p2->checkSum()) { - r1 = p1->simplifyProblem(0,1,1); - r2 = p2->simplifyProblem(0,1,1); - assert(r1 && r2); - p1->check(); - p2->check(); - if (p1->nVars != p2->nVars - || p1->nGEQs != p2->nGEQs - || p1->nSUBs != p2->nSUBs - || p1->checkSum() != p2->checkSum()) { - r1 = p1->simplifyProblem(0,1,2); - r2 = p2->simplifyProblem(0,1,2); - p1->check(); - p2->check(); - assert(r1 && r2); - if (p1->nVars != p2->nVars - || p1->nGEQs != p2->nGEQs - || p1->nSUBs != p2->nSUBs - || p1->checkSum() != p2->checkSum()) { - p1->check(); - p2->check(); - p1->resurrectSubs(); - p2->resurrectSubs(); - p1->check(); - p2->check(); - p1->putVariablesInStandardOrder(); - p2->putVariablesInStandardOrder(); - p1->check(); - p2->check(); - p1->ordered_elimination(0); - p2->ordered_elimination(0); - p1->check(); - p2->check(); - r1 = p1->simplifyProblem(1,1,0); - r2 = p2->simplifyProblem(1,1,0); - p1->check(); - p2->check(); - } - } - } - - if (p1->nVars != p2->nVars - || p1->nSUBs != p2->nSUBs - || p1->nGEQs != p2->nGEQs - || p1->nSUBs != p2->nSUBs) return NotEqual; - if (p1->checkSum() != p2->checkSum()) return mightNotBeEqual; - return apparentlyEqual; -} -#endif - -void Problem::checkGistInvariant() const { -#ifdef GIST_CHECK - Problem new_answer; - int r; - - check(); - fullAnswer.check(); - context.check(); - - if (safeVars < nVars) { - if (DBUG) { - fprintf(outputFile,"Can't check gist invariant due to wildcards\n"); - printProblem(); - } - return; - } - if (DBUG) { - fprintf(outputFile,"Checking gist invariant on: [\n"); - printProblem(); - } - - new_answer = *this; - new_answer->resurrectSubs(); - new_answer->cleanoutWildcards(); - if (DEBUG) { - fprintf(outputFile,"which is: \n"); - printProblem(); - } - deleteBlack(&new_answer); - turnRedBlack(&new_answer); - if (DEBUG) { - fprintf(outputFile,"Black version of answer: \n"); - printProblem(&new_answer); - } - problem_merge(&new_answer,&context); - - r = checkEquiv(&full_answer,&new_answer); - if (r != apparentlyEqual) { - fprintf(outputFile,"GIST INVARIANT REQUIRES MANUAL CHECK:[\n"); - fprintf(outputFile,"Original problem:\n"); - printProblem(&redProblem); - - fprintf(outputFile,"Context:\n"); - printProblem(&context); - - fprintf(outputFile,"Computed gist:\n"); - printProblem(); - - fprintf(outputFile,"Combined answer:\n"); - printProblem(&full_answer); - - fprintf(outputFile,"Context && red constraints:\n"); - printProblem(&new_answer); - fprintf(outputFile,"]\n"); - } - - if (DBUG) { - fprintf(outputFile,"] Done checking gist invariant on\n"); - } -#endif -} - -} // namespace diff --git a/omega/omega_lib/src/omega_core/oc_eq.cc b/omega/omega_lib/src/omega_core/oc_eq.cc deleted file mode 100644 index dc595ea..0000000 --- a/omega/omega_lib/src/omega_core/oc_eq.cc +++ /dev/null @@ -1,653 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 the Omega Project Team - Copyright (C) 2005-2011 Chun Chen - All Rights Reserved. - - Purpose: - Solve equalities. - - Notes: - - History: - *****************************************************************************/ - -#include - -namespace omega { - -void Problem::simplifyStrideConstraints() { - int e, e2, i; - if (DBUG) - fprintf(outputFile, "Checking for stride constraints\n"); - for (i = safeVars + 1; i <= nVars; i++) { - if (DBUG) - fprintf(outputFile, "checking %s\n", variable(i)); - for (e = 0; e < nGEQs; e++) - if (GEQs[e].coef[i]) - break; - if (e >= nGEQs) { - if (DBUG) - fprintf(outputFile, "%s passed GEQ test\n", variable(i)); - e2 = -1; - for (e = 0; e < nEQs; e++) - if (EQs[e].coef[i]) { - if (e2 == -1) - e2 = e; - else { - e2 = -1; - break; - } - } - if (e2 >= 0) { - if (DBUG) { - fprintf(outputFile, "Found stride constraint: "); - printEQ(&EQs[e2]); - fprintf(outputFile, "\n"); - } - /* Is a stride constraint */ - coef_t g = abs(EQs[e2].coef[i]); - assert(g>0); - int j; - for (j = 0; j <= nVars; j++) - if (i != j) - EQs[e2].coef[j] = int_mod_hat(EQs[e2].coef[j], g); - } - } - } -} - -void Problem::doMod(coef_t factor, int e, int j) { - /* Solve e = factor alpha for x_j and substitute */ - int k; - eqn eq; - coef_t nFactor; - - int alpha; - - // if (j > safeVars) alpha = j; - // else - if (EQs[e].color) { - rememberRedConstraint(&EQs[e], redEQ, 0); - EQs[e].color = EQ_BLACK; - } - alpha = addNewUnprotectedWildcard(); - eqnncpy(&eq, &EQs[e], nVars); - newVar = alpha; - - if (DEBUG) { - fprintf(outputFile, "doing moding: "); - fprintf(outputFile, "Solve "); - printTerm(&eq, 1); - fprintf(outputFile, " = " coef_fmt " %s for %s and substitute\n", - factor, variable(alpha), variable(j)); - } - for (k = nVars; k >= 0; k--) - eq.coef[k] = int_mod_hat(eq.coef[k], factor); - nFactor = eq.coef[j]; - assert(nFactor == 1 || nFactor == -1); - eq.coef[alpha] = factor / nFactor; - if (DEBUG) { - fprintf(outputFile, "adjusted: "); - fprintf(outputFile, "Solve "); - printTerm(&eq, 1); - fprintf(outputFile, " = 0 for %s and substitute\n", variable(j)); - } - - eq.coef[j] = 0; - substitute(&eq, j, nFactor); - newVar = -1; - deleteVariable(j); - for (k = nVars; k >= 0; k--) { - assert(EQs[e].coef[k] % factor == 0); - EQs[e].coef[k] = EQs[e].coef[k] / factor; - } - if (DEBUG) { - fprintf(outputFile, "Mod-ing and normalizing produces:\n"); - printProblem(); - } -} - -void Problem::substitute(eqn *sub, int i, coef_t c) { - int e, j; - coef_t k; - int recordSubstitution = (i <= safeVars && var[i] >= 0); - - redType clr; - if (sub->color) - clr = redEQ; - else - clr = notRed; - - assert(c == 1 || c == -1); - - if (DBUG || doTrace) { - if (sub->color) - fprintf(outputFile, "RED SUBSTITUTION\n"); - fprintf(outputFile, "substituting using %s := ", variable(i)); - printTerm(sub, -c); - fprintf(outputFile, "\n"); - printVars(); - } -#ifndef NDEBUG - if (i > safeVars && clr) { - bool unsafeSub = false; - for (e = nEQs - 1; e >= 0; e--) - if (!(EQs[e].color || !EQs[e].coef[i])) - unsafeSub = true; - for (e = nGEQs - 1; e >= 0; e--) - if (!(GEQs[e].color || !GEQs[e].coef[i])) - unsafeSub = true; - for (e = nSUBs - 1; e >= 0; e--) - if (SUBs[e].coef[i]) - unsafeSub = true; - if (unsafeSub) { - fprintf(outputFile, "UNSAFE RED SUBSTITUTION\n"); - fprintf(outputFile, "substituting using %s := ", variable(i)); - printTerm(sub, -c); - fprintf(outputFile, "\n"); - printProblem(); - assert(0 && "UNSAFE RED SUBSTITUTION"); - } - } -#endif - - for (e = nEQs - 1; e >= 0; e--) { - eqn *eq; - eq = &(EQs[e]); - k = eq->coef[i]; - if (k != 0) { - k = check_mul(k, c); // Should be k = k/c, but same effect since abs(c) == 1 - eq->coef[i] = 0; - for (j = nVars; j >= 0; j--) { - eq->coef[j] -= check_mul(sub->coef[j], k); - } - } - if (DEBUG) { - printEQ(eq); - fprintf(outputFile, "\n"); - } - } - for (e = nGEQs - 1; e >= 0; e--) { - int zero; - eqn *eq; - eq = &(GEQs[e]); - k = eq->coef[i]; - if (k != 0) { - k = check_mul(k, c); // Should be k = k/c, but same effect since abs(c) == 1 - eq->touched = true; - eq->coef[i] = 0; - zero = 1; - for (j = nVars; j >= 0; j--) { - eq->coef[j] -= check_mul(sub->coef[j], k); - if (j > 0 && eq->coef[j]) - zero = 0; - } - if (zero && clr != notRed && !eq->color) { - coef_t z = int_div(eq->coef[0], abs(k)); - if (DBUG || doTrace) { - fprintf(outputFile, - "Black inequality matches red substitution\n"); - if (z < 0) - fprintf(outputFile, "System is infeasible\n"); - else if (z > 0) - fprintf(outputFile, "Black inequality is redundant\n"); - else { - fprintf(outputFile, - "Black constraint partially implies red equality\n"); - if (k < 0) { - fprintf(outputFile, "Black constraints tell us "); - assert(sub->coef[i] == 0); - sub->coef[i] = c; - printTerm(sub, 1); - sub->coef[i] = 0; - fprintf(outputFile, "<= 0\n"); - } else { - fprintf(outputFile, "Black constraints tell us "); - assert(sub->coef[i] == 0); - sub->coef[i] = c; - printTerm(sub, 1); - sub->coef[i] = 0; - fprintf(outputFile, " >= 0\n"); - } - } - } - if (z == 0) { - if (k < 0) { - if (clr == redEQ) - clr = redGEQ; - else if (clr == redLEQ) - clr = notRed; - } else { - if (clr == redEQ) - clr = redLEQ; - else if (clr == redGEQ) - clr = notRed; - } - } - - } - } - if (DEBUG) { - printGEQ(eq); - fprintf(outputFile, "\n"); - } - } - if (i <= safeVars && clr) { - assert(sub->coef[i] == 0); - sub->coef[i] = c; - rememberRedConstraint(sub, clr, 0); - sub->coef[i] = 0; - } - - if (recordSubstitution) { - int s = nSUBs++; - int kk; - eqn *eq = &(SUBs[s]); - for (kk = nVars; kk >= 0; kk--) - eq->coef[kk] = check_mul(-c, (sub->coef[kk])); - eq->key = var[i]; - if (DEBUG) { - fprintf(outputFile, "Recording substition as: "); - printSubstitution(s); - fprintf(outputFile, "\n"); - } - } - if (DEBUG) { - fprintf(outputFile, "Ready to update subs\n"); - if (sub->color) - fprintf(outputFile, "RED SUBSTITUTION\n"); - fprintf(outputFile, "substituting using %s := ", variable(i)); - printTerm(sub, -c); - fprintf(outputFile, "\n"); - printVars(); - } - - for (e = nSUBs - 1; e >= 0; e--) { - eqn *eq = &(SUBs[e]); - k = eq->coef[i]; - if (k != 0) { - k = check_mul(k, c); // Should be k = k/c, but same effect since abs(c) == 1 - eq->coef[i] = 0; - for (j = nVars; j >= 0; j--) { - eq->coef[j] -= check_mul(sub->coef[j], k); - } - } - if (DEBUG) { - fprintf(outputFile, "updated sub (" coef_fmt "): ", c); - printSubstitution(e); - fprintf(outputFile, "\n"); - } - } - - if (DEBUG) { - fprintf(outputFile, "---\n\n"); - printProblem(); - fprintf(outputFile, "===\n\n"); - } -} - - -void Problem::doElimination(int e, int i) { - if (DBUG || doTrace) - fprintf(outputFile, "eliminating variable %s\n", variable(i)); - - eqn sub; - eqnncpy(&sub, &EQs[e], nVars); - coef_t c = sub.coef[i]; - sub.coef[i] = 0; - - if (c == 1 || c == -1) { - substitute(&sub, i, c); - } else { - coef_t a = abs(c); - if (TRACE) - fprintf(outputFile, - "performing non-exact elimination, c = " coef_fmt "\n", c); - if (DBUG) - printProblem(); - assert(inApproximateMode); - - for (int e2 = nEQs - 1; e2 >= 0; e2--) { - eqn *eq = &(EQs[e2]); - coef_t k = eq->coef[i]; - if (k != 0) { - coef_t l = lcm(abs(k), a); - coef_t scale1 = l / abs(k); - for (int j = nVars; j >= 0; j--) - eq->coef[j] = check_mul(eq->coef[j], scale1); - eq->coef[i] = 0; - coef_t scale2 = l / c; - if (k < 0) - scale2 = -scale2; - for (int j = nVars; j >= 0; j--) - eq->coef[j] -= check_mul(sub.coef[j], scale2); - eq->color |= sub.color; - } - } - for (int e2 = nGEQs - 1; e2 >= 0; e2--) { - eqn *eq = &(GEQs[e2]); - coef_t k = eq->coef[i]; - if (k != 0) { - coef_t l = lcm(abs(k), a); - coef_t scale1 = l / abs(k); - for (int j = nVars; j >= 0; j--) - eq->coef[j] = check_mul(eq->coef[j], scale1); - eq->coef[i] = 0; - coef_t scale2 = l / c; - if (k < 0) - scale2 = -scale2; - for (int j = nVars; j >= 0; j--) - eq->coef[j] -= check_mul(sub.coef[j], scale2); - eq->color |= sub.color; - eq->touched = 1; - } - } - for (int e2 = nSUBs - 1; e2 >= 0; e2--) - if (SUBs[e2].coef[i]) { - eqn *eq = &(EQs[e2]); - assert(0); - // We can't handle this since we can't multiply - // the coefficient of the left-hand side - assert(!sub.color); - for (int j = nVars; j >= 0; j--) - eq->coef[j] = check_mul(eq->coef[j], a); - coef_t k = eq->coef[i]; - eq->coef[i] = 0; - for (int j = nVars; j >= 0; j--) - eq->coef[j] -= check_mul(sub.coef[j], k / c); - } - } - deleteVariable(i); -} - -int Problem::solveEQ() { - check(); - - // Reorder equations according to complexity. - { - int delay[nEQs]; - - for (int e = 0; e < nEQs; e++) { - delay[e] = 0; - if (EQs[e].color) - delay[e] += 8; - int nonunitWildCards = 0; - int unitWildCards = 0; - for (int i = nVars; i > safeVars; i--) - if (EQs[e].coef[i]) { - if (EQs[e].coef[i] == 1 || EQs[e].coef[i] == -1) - unitWildCards++; - else - nonunitWildCards++; - } - int unit = 0; - int nonUnit = 0; - for (int i = safeVars; i > 0; i--) - if (EQs[e].coef[i]) { - if (EQs[e].coef[i] == 1 || EQs[e].coef[i] == -1) - unit++; - else - nonUnit++; - } - if (unitWildCards == 1 && nonunitWildCards == 0) - delay[e] += 0; - else if (unitWildCards >= 1 && nonunitWildCards == 0) - delay[e] += 1; - else if (inApproximateMode && nonunitWildCards > 0) - delay[e] += 2; - else if (unit == 1 && nonUnit == 0 && nonunitWildCards == 0) - delay[e] += 3; - else if (unit > 1 && nonUnit == 0 && nonunitWildCards == 0) - delay[e] += 4; - else if (unit >= 1 && nonunitWildCards <= 1) - delay[e] += 5; - else - delay[e] += 6; - } - - for (int e = 0; e < nEQs; e++) { - int e2, slowest; - slowest = e; - for (e2 = e + 1; e2 < nEQs; e2++) - if (delay[e2] > delay[slowest]) - slowest = e2; - if (slowest != e) { - int tmp = delay[slowest]; - delay[slowest] = delay[e]; - delay[e] = tmp; - eqn eq; - eqnncpy(&eq, &EQs[slowest], nVars); - eqnncpy(&EQs[slowest], &EQs[e], nVars); - eqnncpy(&EQs[e], &eq, nVars); - } - } - } - - // Eliminate all equations. - while (nEQs != 0) { - int e = nEQs - 1; - eqn *eq = &(EQs[e]); - coef_t g, g2; - - assert(mayBeRed || !eq->color); - - check(); - - // get gcd of coefficients of all unprotected variables - g2 = 0; - for (int i = nVars; i > safeVars; i--) - if (eq->coef[i] != 0) { - g2 = gcd(abs(eq->coef[i]), g2); - if (g2 == 1) - break; - } - - // get gcd of coefficients of all variables - g = g2; - if (g != 1) - for (int i = safeVars; i >= 1; i--) - if (eq->coef[i] != 0) { - g = gcd(abs(eq->coef[i]), g); - if (g == 1) - break; - } - - // approximate mode bypass integer modular test; in Farkas(), - // existential variable lambda's are rational numbers. - if (inApproximateMode && g2 != 0) - g = gcd(abs(eq->coef[0]), g); - - // simple test to see if the equation is satisfiable - if (g == 0) { - if (eq->coef[0] != 0) { - return (false); - } else { - nEQs--; - continue; - } - } else if (abs(eq->coef[0]) % g != 0) { - return (false); - } - - // set gcd of all coefficients to 1 - if (g != 1) { - for (int i = nVars; i >= 0; i--) - eq->coef[i] /= g; - g2 = g2 / g; - } - - // exact elimination of unit coefficient variable - if (g2 != 0) { // for constraint with unprotected variable - int i; - for (i = nVars; i > safeVars; i--) - if (abs(eq->coef[i]) == 1) - break; - if (i > safeVars) { - nEQs--; - doElimination(e, i); - continue; - } - } else { // for constraint without unprotected variable - - // pick the unit coefficient variable with complex inequalites - // to eliminate, this will make inequalities tighter. e.g. - // {[t4,t6,t10]:exists (alpha: 0<=t6<=3 && t10=4alpha+t6 && - // 64t4<=t10<=64t4+15)} - int unit_var; - int cost = -1; - - for (int i = safeVars; i > 0; i--) - - if (abs(eq->coef[i]) == 1) { - int cur_cost = 0; - for (int j = 0; j < nGEQs; j++) - if (GEQs[j].coef[i] != 0) { - for (int k = safeVars; k > 0; k--) - if (GEQs[j].coef[k] != 0) { - if (abs(GEQs[j].coef[k]) != 1){ - - cur_cost += 3; - - } - else - cur_cost += 1; - } - } - - if (cur_cost > cost) { - cost = cur_cost; - unit_var = i; - } - - } - - if (cost != -1) { - nEQs--; - doElimination(e, unit_var); - continue; - } - - - } - - // check if there is an unprotected variable as wildcard - if (g2 > 0) { - int pos = 0; - coef_t g3; - for (int k = nVars; k > safeVars; k--) - if (eq->coef[k] != 0) { - int e2; - for (e2 = e - 1; e2 >= 0; e2--) - if (EQs[e2].coef[k]) - break; - if (e2 >= 0) - continue; - for (e2 = nGEQs - 1; e2 >= 0; e2--) - if (GEQs[e2].coef[k]) - break; - if (e2 >= 0) - continue; - for (e2 = nSUBs - 1; e2 >= 0; e2--) - if (SUBs[e2].coef[k]) - break; - if (e2 >= 0) - continue; - - if (pos == 0) { - g3 = abs(eq->coef[k]); - pos = k; - } else { - if (abs(eq->coef[k]) < g3) { - g3 = abs(eq->coef[k]); - pos = k; - } - } - } - - if (pos != 0) { - bool change = false; - for (int k2 = nVars; k2 >= 0; k2--) - if (k2 != pos && eq->coef[k2] != 0) { - coef_t t = int_mod_hat(eq->coef[k2], g3); - if (t != eq->coef[k2]) { - eq->coef[k2] = t; - change = true; - } - } - - // strength reduced, try this equation again - if (change) { - // nameWildcard(pos); - continue; - } - } - } - - // insert new stride constraint - if (g2 > 1 && !(inApproximateMode && !inStridesAllowedMode)) { - int newvar = addNewProtectedWildcard(); - int neweq = newEQ(); - assert(neweq == e+1); - // we were working on highest-numbered EQ - eqnnzero(&EQs[neweq], nVars); - eqnncpy(&EQs[neweq], eq, safeVars); - - for (int k = nVars; k >= 0; k--) { - EQs[neweq].coef[k] = int_mod_hat(EQs[neweq].coef[k], g2); - } - if (EQs[e].color) - rememberRedConstraint(&EQs[neweq], redStride, g2); - EQs[neweq].coef[newvar] = g2; - EQs[neweq].color = EQ_BLACK; - continue; - } - - // inexact elimination of unprotected variable - if (g2 > 0 && inApproximateMode) { - int pos = 0; - for (int k = nVars; k > safeVars; k--) - if (eq->coef[k] != 0) { - pos = k; - break; - } - assert(pos > safeVars); - - // special handling for wildcard used in breaking down - // diophantine equation - if (abs(eq->coef[pos]) > 1) { - int e2; - for (e2 = nSUBs - 1; e2 >= 0; e2--) - if (SUBs[e2].coef[pos]) - break; - if (e2 >= 0) { - protectWildcard(pos); - continue; - } - } - - nEQs--; - doElimination(e, pos); - continue; - } - - // now solve linear diophantine equation using least remainder - // algorithm - { - coef_t factor = (posInfinity); // was MAXINT - int pos = 0; - for (int k = nVars; k > (g2 > 0 ? safeVars : 0); k--) - if (eq->coef[k] != 0 && factor > abs(eq->coef[k]) + 1) { - factor = abs(eq->coef[k]) + 1; - pos = k; - } - assert(pos > (g2>0?safeVars:0)); - doMod(factor, e, pos); - continue; - } - } - - assert(nEQs == 0); - return (OC_SOLVE_UNKNOWN); -} - -} // namespace diff --git a/omega/omega_lib/src/omega_core/oc_exp_kill.cc b/omega/omega_lib/src/omega_core/oc_exp_kill.cc deleted file mode 100644 index bf3ba19..0000000 --- a/omega/omega_lib/src/omega_core/oc_exp_kill.cc +++ /dev/null @@ -1,297 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 the Omega Project Team - Copyright (C) 2005-2011 Chun Chen - All Rights Reserved. - - Purpose: - Expensive inequality elimination. - - Notes: - - History: - 03/31/09 Use BoolSet, Chun Chen -*****************************************************************************/ - -#include -#include -#include - -namespace omega { - -int Problem::expensiveKill() { - int e; - if (TRACE) fprintf(outputFile,"Performing expensive kill tests: [\n"); - if (DBUG) printProblem(); - Problem tmpProblem; - int oldTrace = trace; - int constraintsRemoved = 0; - - trace = 0; - conservative++; - - for (e = nGEQs - 1; e >= 0; e--) - if (!GEQs[e].essential) { - if (DBUG) { - fprintf(outputFile, "checking equation %d to see if it is redundant: ", e); - printGEQ(&(GEQs[e])); - fprintf(outputFile, "\n"); - } - tmpProblem = *this; - tmpProblem.negateGEQ(e); - tmpProblem.varsOfInterest = 0; - tmpProblem.nSUBs = 0; - tmpProblem.nMemories = 0; - tmpProblem.safeVars = 0; - tmpProblem.variablesFreed = 0; - tmpProblem.isTemporary = true; - - if (!tmpProblem.solve(false)) { - if (DBUG) - fprintf(outputFile, "redundant!\n"); - constraintsRemoved++; - deleteGEQ(e); - } - } - - if (constraintsRemoved) { - if (TRACE) fprintf(outputFile,"%d Constraints removed!!\n",constraintsRemoved); - } - - trace = oldTrace; - conservative--; - if (TRACE) fprintf(outputFile,"] expensive kill tests done\n"); - return 1; -} - -int Problem::expensiveRedKill() { - int e; - if (TRACE) fprintf(outputFile,"Performing expensive red kill tests: [\n"); - Problem tmpProblem; - int oldTrace = trace; - int constraintsRemoved = 0; - - trace = 0; - conservative++; - - for (e = nGEQs - 1; e >= 0; e--) - if (!GEQs[e].essential && GEQs[e].color) { - if (DEBUG) { - fprintf(outputFile, "checking equation %d to see if it is redundant: ", e); - printGEQ(&(GEQs[e])); - fprintf(outputFile, "\n"); - } - tmpProblem = *this; - tmpProblem.negateGEQ(e); - tmpProblem.varsOfInterest = 0; - tmpProblem.nSUBs = 0; - tmpProblem.nMemories = 0; - tmpProblem.safeVars = 0; - tmpProblem.variablesFreed = 0; - tmpProblem.isTemporary = true; - tmpProblem.turnRedBlack(); - if (!tmpProblem.solve(false)) { - constraintsRemoved++; - deleteGEQ(e); - } - } - - if (constraintsRemoved) { - if (TRACE) fprintf(outputFile,"%d Constraints removed!!\n",constraintsRemoved); - } - - trace = oldTrace; - conservative--; - if (TRACE) fprintf(outputFile,"] expensive red kill tests done\n"); - return 1; -} - - -int Problem::expensiveEqualityCheck() { - int e; - return 1; - if (TRACE) fprintf(outputFile,"Performing expensive equality tests: [\n"); - Problem tmpProblem; - int oldTrace = trace; - int equalitiesFound = 0; - - trace = 0; - conservative++; - - for (e = nGEQs - 1; e >= 0; e--) { - if (DEBUG) { - fprintf(outputFile, "checking equation %d to see if it is an equality: ", e); - printGEQ(&(GEQs[e])); - fprintf(outputFile, "\n"); - } - tmpProblem = *this; - tmpProblem.GEQs[e].coef[0]--; - tmpProblem.varsOfInterest = 0; - tmpProblem.nSUBs = 0; - tmpProblem.nMemories = 0; - tmpProblem.safeVars = 0; - tmpProblem.variablesFreed = 0; - tmpProblem.isTemporary = true; - if (!tmpProblem.solve(false)) { - int neweq = newEQ(); - eqnncpy(&EQs[neweq], &GEQs[e], nVars); - equalitiesFound++; - addingEqualityConstraint(neweq); - } - } - if (equalitiesFound) { - if (TRACE) fprintf(outputFile,"%d Equalities found!!\n",equalitiesFound); - } - - trace = oldTrace; - conservative--; - if (equalitiesFound) { - if (!solveEQ()) return 0; - if (!normalize()) return 0; - } - if (TRACE) fprintf(outputFile,"] expensive equality tests done\n"); - return 1; -} - - -void Problem::quickRedKill(int computeGist) { - if (DBUG) { - fprintf(outputFile, "in quickRedKill: [\n"); - printProblem(); - } - - noteEssential(0); - int moreToDo = chainKill(1,0); - -#ifdef NDEBUG - if (!moreToDo) { - if (DBUG) fprintf(outputFile, "] quickRedKill\n"); - return; - } -#endif - - int isDead[nGEQs]; - int deadCount = 0; - std::vector > P(nGEQs, BoolSet<>(nVars)), Z(nGEQs, BoolSet<>(nVars)), N(nGEQs, BoolSet<>(nVars)); - BoolSet<> PP, PZ, PN; /* possible Positives, possible zeros & possible negatives */ - BoolSet<> MZ; /* must zeros */ - - int equationsToKill = 0; - for (int e = nGEQs - 1; e >= 0; e--) { - isDead[e] = 0; - if (GEQs[e].color && !GEQs[e].essential) equationsToKill++; - if (GEQs[e].color && GEQs[e].essential && !computeGist) - if (!moreToDo) { - if (DBUG) fprintf(outputFile, "] quickRedKill\n"); - return; - } - for (int i = nVars; i >= 1; i--) { - if (GEQs[e].coef[i] > 0) - P[e].set(i-1); - else if (GEQs[e].coef[i] < 0) - N[e].set(i-1); - else - Z[e].set(i-1); - } - } - - if (!equationsToKill) - if (!moreToDo) { - if (DBUG) fprintf(outputFile, "] quickRedKill\n"); - return; - } - - for (int e = nGEQs - 1; e > 0; e--) - if (!isDead[e]) - for (int e2 = e - 1; e2 >= 0; e2--) - if (!isDead[e2]) { - coef_t a = 0; - int i, j; - for (i = nVars; i > 1; i--) { - for (j = i - 1; j > 0; j--) { - a = (GEQs[e].coef[i] * GEQs[e2].coef[j] - GEQs[e2].coef[i] * GEQs[e].coef[j]); - if (a != 0) - goto foundPair; - } - } - continue; - - foundPair: - if (DEBUG) { - fprintf(outputFile, "found two equations to combine, i = %s, ", variable(i)); - fprintf(outputFile, "j = %s, alpha = " coef_fmt "\n", variable(j), a); - printGEQ(&(GEQs[e])); - fprintf(outputFile, "\n"); - printGEQ(&(GEQs[e2])); - fprintf(outputFile, "\n"); - } - - MZ = (Z[e] & Z[e2]); - PZ = MZ | (P[e] & N[e2]) | (N[e] & P[e2]); - PP = P[e] | P[e2]; - PN = N[e] | N[e2]; - - for (int e3 = nGEQs - 1; e3 >= 0; e3--) - if (e3 != e && e3 != e2 && GEQs[e3].color && !GEQs[e3].essential) { - coef_t alpha1, alpha2, alpha3; - - if (!PZ.imply(Z[e3]) || MZ.imply(~Z[e3])) continue; - if (!PP.imply(P[e3]) || !PN.imply(N[e3])) continue; - - if (a > 0) { - alpha1 = GEQs[e2].coef[j] * GEQs[e3].coef[i] - GEQs[e2].coef[i] * GEQs[e3].coef[j]; - alpha2 = -(GEQs[e].coef[j] * GEQs[e3].coef[i] - GEQs[e].coef[i] * GEQs[e3].coef[j]); - alpha3 = a; - } - else { - alpha1 = -(GEQs[e2].coef[j] * GEQs[e3].coef[i] - GEQs[e2].coef[i] * GEQs[e3].coef[j]); - alpha2 = -(-(GEQs[e].coef[j] * GEQs[e3].coef[i] - GEQs[e].coef[i] * GEQs[e3].coef[j])); - alpha3 = -a; - } - - if (alpha1 > 0 && alpha2 > 0) { - if (DEBUG) { - fprintf(outputFile, "alpha1 = " coef_fmt ", alpha2 = " coef_fmt "; comparing against: ", alpha1, alpha2); - printGEQ(&(GEQs[e3])); - fprintf(outputFile, "\n"); - } - coef_t c; - int k; - for (k = nVars; k >= 0; k--) { - c = alpha1 * GEQs[e].coef[k] + alpha2 * GEQs[e2].coef[k]; - if (DEBUG) { - if (k>0) - fprintf(outputFile, " %s: " coef_fmt ", " coef_fmt "\n", variable(k), c, alpha3 * GEQs[e3].coef[k]); - else fprintf(outputFile, " constant: " coef_fmt ", " coef_fmt "\n", c, alpha3 * GEQs[e3].coef[k]); - } - if (c != alpha3 * GEQs[e3].coef[k]) - break; - } - if (k < 0 || (k == 0 && c < alpha3 * (GEQs[e3].coef[k]+1))) { - if (DEBUG) { - deadCount++; - fprintf(outputFile, "red equation#%d is dead (%d dead so far, %d remain)\n", e3, deadCount, nGEQs - deadCount); - printGEQ(&(GEQs[e])); - fprintf(outputFile, "\n"); - printGEQ(&(GEQs[e2])); - fprintf(outputFile, "\n"); - printGEQ(&(GEQs[e3])); - fprintf(outputFile, "\n"); - assert(moreToDo); - } - isDead[e3] = 1; - } - } - } - } - - for (int e = nGEQs - 1; e >= 0; e--) - if (isDead[e]) - deleteGEQ(e); - - if (DBUG) { - fprintf(outputFile,"] quickRedKill\n"); - printProblem(); - } -} - -} // namespace diff --git a/omega/omega_lib/src/omega_core/oc_global.cc b/omega/omega_lib/src/omega_core/oc_global.cc deleted file mode 100644 index 17d8a0c..0000000 --- a/omega/omega_lib/src/omega_core/oc_global.cc +++ /dev/null @@ -1,45 +0,0 @@ -#include - -namespace omega { - -const int Problem::min_alloc = 10; -const int Problem::first_alloc_pad = 5; - -int omega_core_debug = 0; // 3: full debugging info - -int maxEQs = 100; // original 35, increased by chun -int maxGEQs = 200; // original 70, increased by chun - -int newVar = -1; -int findingImplicitEqualities = 0; -int firstCheckForRedundantEquations = 0; -int doItAgain; -int conservative = 0; -FILE *outputFile = stderr; /* printProblem writes its output to this file */ -char wildName[200][20]; -int nextWildcard = 0; -int trace = 1; -int depth = 0; -int headerLevel; -int inApproximateMode = 0; -int inStridesAllowedMode = 0; -int addingOuterEqualities = 0; -int outerColor = 0; -int reduceWithSubs = 1; -int pleaseNoEqualitiesInSimplifiedProblems = 0; -Problem *originalProblem = noProblem; -int omegaInitialized = 0; -int mayBeRed = 0; - - -// Hash table is used to hash all inequalties for all problems. It -// persists across problems for quick problem merging in case. When -// the table is filled to 1/3 full, it is flushed and the filling -// process starts all over again. -int packing[maxVars]; -int hashVersion = 0; -eqn hashMaster[hashTableSize]; -int fastLookup[maxKeys*2]; -int nextKey; - -} // namespace diff --git a/omega/omega_lib/src/omega_core/oc_print.cc b/omega/omega_lib/src/omega_core/oc_print.cc deleted file mode 100644 index 7934713..0000000 --- a/omega/omega_lib/src/omega_core/oc_print.cc +++ /dev/null @@ -1,686 +0,0 @@ -#include - -namespace omega { - -int print_in_code_gen_style = 0; - -void Problem::initializeVariables() const { - Problem *p = (Problem *)this; - int i; - assert(!p->variablesInitialized); - for (i = p->nVars; i >= 0; i--) - p->forwardingAddress[i] = p->var[i] = i; - p->variablesInitialized = 1; -} - - -std::string Problem::print_term_to_string(const eqn *e, int c) const { - std::string s=""; - int i; - int first; - int n = nVars; - int wentFirst = -1; - first = 1; - for (i = 1; i <= n; i++) - if (c * e->coef[i] > 0) { - first = 0; - wentFirst = i; - - if (c * e->coef[i] == 1) - s+= variable(i); - else { - s += to_string(c * e->coef[i]); - if (print_in_code_gen_style) s += "*"; - s += variable(i); - } - break; - } - for (i = 1; i <= n; i++) - if (i != wentFirst && c * e->coef[i] != 0) { - if (!first && c * e->coef[i] > 0) - s += "+"; - - first = 0; - - if (c * e->coef[i] == 1) - s += variable(i); - else if (c * e->coef[i] == -1) { - s += "-"; s += variable(i); - } - else { - s += to_string(c * e->coef[i]); - if (print_in_code_gen_style) s += "*"; - s += variable(i); - } - } - if (!first && c * e->coef[0] > 0) - s += "+"; - if (first || c * e->coef[0] != 0) - s += to_string(c * e->coef[0]); - return s; -} - - -void Problem::printTerm(const eqn * e, int c) const { - std::string s = print_term_to_string(e, c); - fprintf(outputFile, "%s", s.c_str()); -} - - -void Problem::printSub(int v) const { - std::string s = print_sub_to_string(v); - fprintf(outputFile, "%s", s.c_str()); -} - - -std::string Problem::print_sub_to_string(int v) const { - std::string s; - - if (v > 0) - s = variable(v); - else - s = print_term_to_string(&SUBs[-v-1], 1); - return s; -} - - -void Problem::clearSubs() { - nSUBs = 0; - nMemories = 0; -} - - -void Problem::printEqn(const eqn *e, int test, int extra) const { - char buf[maxVars * 12 + 180]; // original buf[maxVars * 12 + 80] - - sprintEqn(buf, e, test, extra); - fprintf(outputFile, "%s", buf); -} - - -std::string Problem::printEqnToString(const eqn *e, int test, int extra) const { - char buf[maxVars * 12 + 180]; // original buf[maxVars * 12 + 80] - sprintEqn(buf, e, test, extra); - return std::string(buf); -} - - -void Problem::sprintEqn(char *str, const eqn *e, int test, int extra) const { - int i; - int first; - int n = nVars + extra; - int isLT; - - isLT = test && e->coef[0] == -1; - if (isLT) - isLT = 1; -#if 0 - if (test) { - if (DEBUG && e->touched) { - sprintf(str, "!"); - while (*str) - str++; - } - else if (DBUG && !e->touched && e->key != 0) { - sprintf(str, "%d: ", e->key); - while (*str) - str++; - } - } -#endif - if (e->color) { - sprintf(str, "["); - while (*str) - str++; - } - first = 1; - for (i = isLT; i <= n; i++) - if (e->coef[i] < 0) { - if (!first) { - sprintf(str, "+"); - while (*str) - str++; - } - else - first = 0; - if (i == 0) { - sprintf(str, coef_fmt, -e->coef[i]); - while (*str) - str++; - } - else if (e->coef[i] == -1) { - sprintf(str, "%s", variable(i)); - while (*str) - str++; - } - else { - if (print_in_code_gen_style) - sprintf(str, coef_fmt "*%s", -e->coef[i], variable(i)); - else sprintf(str, coef_fmt "%s", -e->coef[i], variable(i)); - while (*str) - str++; - } - } - if (first) { - if (isLT) { - sprintf(str, "1"); - isLT = 0; - } - else - sprintf(str, "0"); - while (*str) - str++; - } - if (test == 0) { - if (print_in_code_gen_style) sprintf(str, " == "); - else sprintf(str, " = "); - while (*str) - str++; - } - else { - if (isLT) - sprintf(str, " < "); - else - sprintf(str, " <= "); - while (*str) - str++; - } - - first = 1; - for (i = 0; i <= n; i++) - if (e->coef[i] > 0) { - if (!first) { - sprintf(str, "+"); - while (*str) - str++; - } - else - first = 0; - if (i == 0) { - sprintf(str, coef_fmt , e->coef[i]); - while (*str) - str++; - } - else if (e->coef[i] == 1) { - sprintf(str, "%s", variable(i)); - while (*str) - str++; - } - else { - if (print_in_code_gen_style) - sprintf(str, coef_fmt "*%s", e->coef[i], variable(i)); - else - sprintf(str, coef_fmt "%s", e->coef[i], variable(i)); - while (*str) - str++; - } - } - if (first) { - sprintf(str, "0"); - while (*str) - str++; - } - if (e->color) { - sprintf(str, "]"); - while (*str) - str++; - } -} - - -void Problem::printSubstitution(int s) const { - const eqn * eq = &(SUBs[s]); - assert(eq->key > 0); - fprintf(outputFile, "%s := ", orgVariable(eq->key)); - printTerm(eq, 1); -} - - -void Problem::printVars(int /*debug*/) const { - int i; - fprintf(outputFile, "variables = "); - if (safeVars > 0) - fprintf(outputFile, "("); - for (i = 1; i <= nVars; i++) { - fprintf(outputFile, "%s", variable(i)); - if (i == safeVars) - fprintf(outputFile, ")"); - if (i < nVars) - fprintf(outputFile, ", "); - } - fprintf(outputFile, "\n"); - /* - fprintf(outputFile, "forward addresses = "); - if (safeVars > 0) - fprintf(outputFile, "("); - for (i = 1; i <= nVars; i++) - { - int v = forwardingAddress[i]; - if (v > 0) fprintf(outputFile, "%s", variable(i)); - else fprintf(outputFile, "*"); - if (i == safeVars) - fprintf(outputFile, ")"); - if (i < nVars) - fprintf(outputFile, ", "); - }; - fprintf(outputFile, "\n"); - */ -} - - -void printHeader() { - int i; - for(i=0; i= "); - break; - case redEQ: - fprintf(outputFile,"Red: 0 == "); - break; - case redStride: - fprintf(outputFile,"Red stride " coef_fmt ": ", redMemory[e].stride); - break; - } - fprintf(outputFile," " coef_fmt, redMemory[e].constantTerm); - for(i=0;i< redMemory[e].length; i++) - if(redMemory[e].coef[i] >= 0) - fprintf(outputFile,"+" coef_fmt "%s", redMemory[e].coef[i], orgVariable(redMemory[e].var[i])); - else - fprintf(outputFile,"-" coef_fmt "%s", -redMemory[e].coef[i], orgVariable(redMemory[e].var[i])); - fprintf(outputFile, "\n"); - } - fflush(outputFile); - - CHECK_FOR_DUPLICATE_VARIABLE_NAMES; -} - - -void Problem::printRedEquations() const { - int e; - - if (!variablesInitialized) - initializeVariables(); - printVars(1); - for (e = 0; e < nEQs; e++) { - if (EQs[e].color == EQ_RED) { - printEQ(&EQs[e]); - fprintf(outputFile, "\n"); - } - } - for (e = 0; e < nGEQs; e++) { - if (GEQs[e].color == EQ_RED) { - printGEQ(&GEQs[e]); - fprintf(outputFile, "\n"); - } - } - for (e = 0; e < nSUBs; e++) { - if (SUBs[e].color) { - printSubstitution(e); - fprintf(outputFile, "\n"); - } - } - fflush(outputFile); -} - - -int Problem::prettyPrintProblem() const { - std::string s = prettyPrintProblemToString(); - fprintf(outputFile, "%s", s.c_str()); - fflush(outputFile); - return 0; -} - - -std::string Problem::prettyPrintProblemToString() const { - std::string s=""; - int e; - int v; - int live[maxmaxGEQs]; - int v1, v2, v3; - int t, change; - int stuffPrinted = 0; - const char *connector = " && "; - - typedef enum { - none, le, lt - } partialOrderType; - - partialOrderType po[maxVars][maxVars]; - int poE[maxVars][maxVars]; - int lastLinks[maxVars]; - int firstLinks[maxVars]; - int chainLength[maxVars]; - int chain[maxVars]; - int varCount[maxVars]; - int i, m, multiprint; - - - if (!variablesInitialized) - initializeVariables(); - - if (nVars > 0) { - for (e = 0; e < nEQs; e++) { - if (stuffPrinted) - s += connector; - stuffPrinted = 1; - s += print_EQ_to_string(&EQs[e]); - } - - for (e = 0; e < nGEQs; e++) { - live[e] = true; - varCount[e] = 0; - for (v = 1; v <= nVars; v++) - if (GEQs[e].coef[v]) varCount[e]++; - } - - if (!print_in_code_gen_style) - while (1) { - for (v = 1; v <= nVars; v++) { - lastLinks[v] = firstLinks[v] = 0; - chainLength[v] = 0; - for (v2 = 1; v2 <= nVars; v2++) - po[v][v2] = none; - } - - for (e = 0; e < nGEQs; e++) - if (live[e] && varCount[e] <= 2) { - for (v = 1; v <= nVars; v++) { - if (GEQs[e].coef[v] == 1) - firstLinks[v]++; - else if (GEQs[e].coef[v] == -1) - lastLinks[v]++; - } - - v1 = nVars; - while (v1 > 0 && GEQs[e].coef[v1] == 0) - v1--; - v2 = v1 - 1; - while (v2 > 0 && GEQs[e].coef[v2] == 0) - v2--; - v3 = v2 - 1; - while (v3 > 0 && GEQs[e].coef[v3] == 0) - v3--; - - if (GEQs[e].coef[0] > 0 || GEQs[e].coef[0] < -1 - || v2 <= 0 || v3 > 0 - || GEQs[e].coef[v1] * GEQs[e].coef[v2] != -1) { - /* Not a partial order relation */ - - } - else { - if (GEQs[e].coef[v1] == 1) { - v3 = v2; - v2 = v1; - v1 = v3; - } - /* relation is v1 <= v2 or v1 < v2 */ - po[v1][v2] = ((GEQs[e].coef[0] == 0) ? le : lt); - poE[v1][v2] = e; - } - } - for (v = 1; v <= nVars; v++) - chainLength[v] = lastLinks[v]; - - /* - * printf("\n\nPartial order:\n"); printf(" "); for (v1 = 1; v1 <= nVars; v1++) - * printf("%7s",variable(v1)); printf("\n"); for (v1 = 1; v1 <= nVars; v1++) { printf("%6s: - * ",variable(v1)); for (v2 = 1; v2 <= nVars; v2++) switch (po[v1][v2]) { case none: printf(" "); - * break; case le: printf(" <= "); break; case lt: printf(" < "); break; } printf("\n"); } - */ - - - /* Just in case nVars <= 0 */ - change = false; - for (t = 0; t < nVars; t++) { - change = false; - for (v1 = 1; v1 <= nVars; v1++) - for (v2 = 1; v2 <= nVars; v2++) - if (po[v1][v2] != none && - chainLength[v1] <= chainLength[v2]) { - chainLength[v1] = chainLength[v2] + 1; - change = true; - } - } - - if (change) { - /* caught in cycle */ - -#if 0 - printf("\n\nPartial order:\n"); printf(" "); - for (v1 = 1; v1 <= nVars; v1++) printf("%7s",variable(v1)); printf("\n"); - for (v1 = 1; v1 <= nVars; v1++) { - printf("%6s: ",variable(v1)); - for (v2 = 1; v2 <= nVars; v2++) switch (po[v1][v2]) { - case none: printf(" "); break; - case le: printf(" <= "); break; - case lt: printf(" < "); break; - } - printf("\n"); - } - - printProblem(1); -#endif - break; - } - - for (v1 = 1; v1 <= nVars; v1++) - if (chainLength[v1] == 0) - firstLinks[v1] = 0; - - v = 1; - for (v1 = 2; v1 <= nVars; v1++) - if (chainLength[v1] + firstLinks[v1] > chainLength[v] + firstLinks[v]) - v = v1; - - if (chainLength[v] + firstLinks[v] == 0) - break; - - if (stuffPrinted) - s += connector; - stuffPrinted = 1; - /* chain starts at v */ - /* print firstLinks */ - { - coef_t tmp; - int first; - first = 1; - for (e = 0; e < nGEQs; e++) - if (live[e] && GEQs[e].coef[v] == 1 && varCount[e] <= 2) { - if (!first) - s += ", "; - tmp = GEQs[e].coef[v]; - ((Problem *)this)-> - GEQs[e].coef[v] = 0; - s += print_term_to_string(&GEQs[e], -1); - ((Problem *)this)-> - GEQs[e].coef[v] = tmp; - live[e] = false; - first = 0; - } - if (!first) - s += " <= "; - } - - - /* find chain */ - chain[0] = v; - m = 1; - while (1) { - /* print chain */ - for (v2 = 1; v2 <= nVars; v2++) - if (po[v][v2] && chainLength[v] == 1 + chainLength[v2]) - break; - if (v2 > nVars) - break; - chain[m++] = v2; - v = v2; - } - - s += variable(chain[0]); - - multiprint = 0; - for (i = 1; i < m; i++) { - v = chain[i - 1]; - v2 = chain[i]; - if (po[v][v2] == le) - s += " <= "; - else - s += " < "; - s += variable(v2); - live[poE[v][v2]] = false; - if (!multiprint && i < m - 1) - for (v3 = 1; v3 <= nVars; v3++) { - if (v == v3 || v2 == v3) - continue; - if (po[v][v2] != po[v][v3]) - continue; - if (po[v2][chain[i + 1]] != po[v3][chain[i + 1]]) - continue; - s += ","; s += variable(v3); - live[poE[v][v3]] = false; - live[poE[v3][chain[i + 1]]] = false; - multiprint = 1; - } - else - multiprint = 0; - } - - v = chain[m - 1]; - /* print lastLinks */ - { - coef_t tmp; - int first; - first = 1; - for (e = 0; e < nGEQs; e++) - if (live[e] && GEQs[e].coef[v] == -1 && varCount[e] <= 2) { - if (!first) - s += ", "; - else - s += " <= "; - tmp = GEQs[e].coef[v]; - ((Problem *)this)-> - GEQs[e].coef[v] = 0; - s += print_term_to_string(&GEQs[e], 1); - ((Problem *)this)-> - GEQs[e].coef[v] = tmp; - live[e] = false; - first = 0; - } - } - } - - - for (e = 0; e < nGEQs; e++) - if (live[e]) { - if (stuffPrinted) - s += connector; - stuffPrinted = 1; - s += print_GEQ_to_string(&GEQs[e]); - } - - for (e = 0; e < nSUBs; e++) { - const eqn * eq = &SUBs[e]; - if (stuffPrinted) - s += connector; - stuffPrinted = 1; - if (eq->key > 0) { - s += orgVariable(eq->key); s += " := "; - } - else { - s += "#"; s += to_string(eq->key); s += " := "; - } - s += print_term_to_string(eq, 1); - } - } - return s; -} - - -int Problem::prettyPrintRedEquations() const { - int e, stuffPrinted = 0; - const char *connector = " && "; - - if (!variablesInitialized) - initializeVariables(); - - for (e = 0; e < nEQs; e++) { - if (EQs[e].color == EQ_RED) { - if (stuffPrinted) - fprintf(outputFile, "%s", connector); - stuffPrinted = 1; - ((Problem *)this)-> - EQs[e].color = EQ_BLACK; - printEQ(&EQs[e]); - ((Problem *)this)-> - EQs[e].color = EQ_RED; - } - } - for (e = 0; e < nGEQs; e++) { - if (GEQs[e].color == EQ_RED) { - if (stuffPrinted) - fprintf(outputFile, "%s", connector); - stuffPrinted = 1; - ((Problem *)this)-> - GEQs[e].color = EQ_BLACK; - printGEQ(&GEQs[e]); - ((Problem *)this)-> - GEQs[e].color = EQ_RED; - } - } - for (e = 0; e < nSUBs; e++) { - if (SUBs[e].color) { - if (stuffPrinted) - fprintf(outputFile, "%s", connector); - stuffPrinted = 1; - printSubstitution(e); - } - } - fflush(outputFile); - - return 0; -} - -} diff --git a/omega/omega_lib/src/omega_core/oc_problems.cc b/omega/omega_lib/src/omega_core/oc_problems.cc deleted file mode 100644 index 8b6e04c..0000000 --- a/omega/omega_lib/src/omega_core/oc_problems.cc +++ /dev/null @@ -1,198 +0,0 @@ -#include -#include - -namespace omega { - -Problem::~Problem() { - delete[] EQs; - delete[] GEQs; -} - - -void check_number_EQs(int n) { - if (n < 0) { - fprintf(stderr,"ERROR: nEQs < 0??\n"); - exit(1); - } - - if (n > maxmaxEQs) { - // clear global variables - inApproximateMode = 0; - outerColor = 0; - - throw presburger_error("\nERROR:\n" - "An attempt was made to set the number of available equality constraints to " + to_string(n) + ".\n" - "The maximum number of equality constraints in a conjunction is " + to_string(maxmaxEQs) + ".\n" - "This limit can be changed by redefining maxmaxEQs in oc.h and recompiling.\n\n"); - - // fprintf(stderr, "\nERROR:\n"); - // fprintf(stderr, "An attempt was made to set the number of available equality constraints to %d.\n", n); - // fprintf(stderr, "The maximum number of equality constraints in a conjunction is %d.\n", maxmaxEQs); - // fprintf(stderr, "This limit can be changed by redefining maxmaxEQs in oc.h and recompiling.\n\n"); - // exit(2); - } -} - -void check_number_GEQs(int n) { - if (n < 0) { - fprintf(stderr,"ERROR: nGEQs < 0??\n"); - exit(1); - } - - if (n > maxmaxGEQs) { - // clear global variables - inApproximateMode = 0; - outerColor = 0; - - throw presburger_error("\nERROR:\n" - "An attempt was made to set the number of available inequality constraints to " + to_string(n) +".\n" - "The maximum number of inequality constraints in a conjunction is " + to_string(maxmaxGEQs) +".\n" - "This limit can be changed by redefining maxmaxGEQs in oc.h and recompiling.\n\n"); - - // fprintf(stderr, "\nERROR:\n"); - // fprintf(stderr, "An attempt was made to set the number of available inequality constraints to %d.\n", n); - // fprintf(stderr, "The maximum number of inequality constraints in a conjunction is %d.\n", maxmaxGEQs); - // fprintf(stderr, "This limit can be changed by redefining maxmaxGEQs in oc.h and recompiling.\n\n"); - // exit(2); - } -} - - -void check_number_EQs_GEQs(int e, int g) { - check_number_EQs(e); - check_number_GEQs(g); -} - - -Problem::Problem(int in_eqs, int in_geqs) { - check_number_EQs_GEQs(in_eqs, in_geqs); - allocEQs = padEQs(in_eqs); - allocGEQs = padGEQs(in_geqs); - assert(allocEQs > 0 && allocGEQs > 0); - EQs = new eqn[allocEQs]; - GEQs = new eqn[allocGEQs]; - nVars = 0; - hashVersion = omega::hashVersion; - variablesInitialized = 0; - variablesFreed = 0; - varsOfInterest = 0; - safeVars = 0; - nEQs = 0; - nGEQs = 0; - nSUBs = 0; - nMemories = 0; - isTemporary = false; -} - -Problem::Problem(const Problem & p2) { - allocEQs = padEQs(p2.nEQs); // Don't over-allocate; p2 might have too many! - allocGEQs = padGEQs(p2.nGEQs); - assert(allocEQs > 0 && allocGEQs > 0); - EQs = new eqn[allocEQs]; - GEQs = new eqn[allocGEQs]; - int e, i; - nVars = p2.nVars; - hashVersion = p2.hashVersion; - variablesInitialized = p2.variablesInitialized; - variablesFreed = p2.variablesFreed; - varsOfInterest = p2.varsOfInterest; - safeVars = p2.safeVars; - nEQs = p2.nEQs; - isTemporary = p2.isTemporary; - //nSUBs = 0; - for (e = p2.nEQs - 1; e >= 0; e--) - eqnncpy(&(EQs[e]), &(p2.EQs[e]), p2.nVars); - nGEQs = p2.nGEQs; - for (e = p2.nGEQs - 1; e >= 0; e--) - eqnncpy(&(GEQs[e]), &(p2.GEQs[e]), p2.nVars); - for (i = 0; i <= p2.nVars; i++) - var[i] = p2.var[i]; - for (i = 0; i <= maxVars; i++) - forwardingAddress[i] = p2.forwardingAddress[i]; - //nMemories = 0; - get_var_name = p2.get_var_name; - getVarNameArgs = p2.getVarNameArgs; -} - -Problem & Problem::operator=(const Problem & p2) { - if (this != &p2) { - if(allocEQs < p2.nEQs) { - delete[] EQs; - allocEQs = padEQs(p2.nEQs); - EQs = new eqn[allocEQs]; - } - if(allocGEQs < p2.nGEQs) { - delete[] GEQs; - allocGEQs = padGEQs(p2.nGEQs); - GEQs = new eqn[allocGEQs]; - } - int e, i; - nVars = p2.nVars; - hashVersion = p2.hashVersion; - variablesInitialized = p2.variablesInitialized; - variablesFreed = p2.variablesFreed; - varsOfInterest = p2.varsOfInterest; - safeVars = p2.safeVars; - nEQs = p2.nEQs; - isTemporary = p2.isTemporary; - //nSUBs = 0; - for (e = p2.nEQs - 1; e >= 0; e--) - eqnncpy(&(EQs[e]), &(p2.EQs[e]), p2.nVars); - nGEQs = p2.nGEQs; - for (e = p2.nGEQs - 1; e >= 0; e--) - eqnncpy(&(GEQs[e]), &(p2.GEQs[e]), p2.nVars); - for (i = 0; i <= p2.nVars; i++) - var[i] = p2.var[i]; - for (i = 0; i <= maxVars; i++) - forwardingAddress[i] = p2.forwardingAddress[i]; - //nMemories = 0; - get_var_name = p2.get_var_name; - getVarNameArgs = p2.getVarNameArgs; - } - return *this; -} - - -void Problem::zeroVariable(int i) { - int e; - for (e = nGEQs - 1; e >= 0; e--) GEQs[e].coef[i] = 0; - for (e = nEQs - 1; e >= 0; e--) EQs[e].coef[i] = 0; - for (e = nSUBs - 1; e >= 0; e--) SUBs[e].coef[i] = 0; -} - -/* Functions for allocating EQ's and GEQ's */ - -int Problem::newGEQ() { - if (++nGEQs > allocGEQs) { - check_number_GEQs(nGEQs); - allocGEQs = padGEQs(allocGEQs, nGEQs); - assert(allocGEQs >= nGEQs); - eqn *new_geqs = new eqn[allocGEQs]; - for (int e = nGEQs - 2; e >= 0; e--) - eqnncpy(&(new_geqs[e]), &(GEQs[e]), nVars); - delete[] GEQs; - GEQs = new_geqs; - } -// problem->GEQs[nGEQs-1].color = black; -// eqnnzero(&problem->GEQs[nGEQs-1],problem->nVars); - return nGEQs-1; -} - -int Problem::newEQ() { - if (++nEQs > allocEQs) { - check_number_EQs(nEQs); - allocEQs = padEQs(allocEQs, nEQs); - assert(allocEQs >= nEQs); - eqn *new_eqs = new eqn[allocEQs]; - for (int e = nEQs - 2; e >= 0; e--) - eqnncpy(&(new_eqs[e]), &(EQs[e]), nVars); - delete[] EQs; - EQs = new_eqs; - } -// Could do this here, but some calls to newEQ do a copy instead of a zero; -// problem->EQs[nEQs-1].color = black; -// eqnnzero(&problem->EQs[nEQs-1],problem->nVars); - return nEQs-1; -} - -} // namespace diff --git a/omega/omega_lib/src/omega_core/oc_query.cc b/omega/omega_lib/src/omega_core/oc_query.cc deleted file mode 100644 index 528b297..0000000 --- a/omega/omega_lib/src/omega_core/oc_query.cc +++ /dev/null @@ -1,478 +0,0 @@ -#include - -namespace omega { - -void Problem::unprotectVariable( int v) { - int e, j, i; - coef_t t; - i = forwardingAddress[v]; - if (i < 0) { - i = -1 - i; - nSUBs--; - if (i < nSUBs) { - eqnncpy(&SUBs[i], &SUBs[nSUBs], nVars); - forwardingAddress[SUBs[i].key] = -i - 1; - } - } - else { - int bringToLife[maxVars]; - int comingBack = 0; - int e2; - for (e = nSUBs - 1; e >= 0; e--) - if ((bringToLife[e] = (SUBs[e].coef[i] != 0))) - comingBack++; - - for (e2 = nSUBs - 1; e2 >= 0; e2--) - if (bringToLife[e2]) { - - nVars++; - safeVars++; - if (safeVars < nVars) { - for (e = nGEQs - 1; e >= 0; e--) { - GEQs[e].coef[nVars] = GEQs[e].coef[safeVars]; - GEQs[e].coef[safeVars] = 0; - } - for (e = nEQs - 1; e >= 0; e--) { - EQs[e].coef[nVars] = EQs[e].coef[safeVars]; - EQs[e].coef[safeVars] = 0; - } - for (e = nSUBs - 1; e >= 0; e--) { - SUBs[e].coef[nVars] = SUBs[e].coef[safeVars]; - SUBs[e].coef[safeVars] = 0; - } - var[nVars] = var[safeVars]; - forwardingAddress[var[nVars]] = nVars; - } - else { - for (e = nGEQs - 1; e >= 0; e--) { - GEQs[e].coef[safeVars] = 0; - } - for (e = nEQs - 1; e >= 0; e--) { - EQs[e].coef[safeVars] = 0; - } - for (e = nSUBs - 1; e >= 0; e--) { - SUBs[e].coef[safeVars] = 0; - } - } - - var[safeVars] = SUBs[e2].key; - forwardingAddress[SUBs[e2].key] = safeVars; - - int neweq = newEQ(); - eqnncpy(&(EQs[neweq]), &(SUBs[e2]), nVars); - EQs[neweq].coef[safeVars] = -1; - if (e2 < nSUBs - 1) - eqnncpy(&(SUBs[e2]), &(SUBs[nSUBs - 1]), nVars); - nSUBs--; - } - - if (i < safeVars) { - j = safeVars; - for (e = nSUBs - 1; e >= 0; e--) { - t = SUBs[e].coef[j]; - SUBs[e].coef[j] = SUBs[e].coef[i]; - SUBs[e].coef[i] = t; - } - for (e = nGEQs - 1; e >= 0; e--) - if (GEQs[e].coef[j] != GEQs[e].coef[i]) { - GEQs[e].touched = true; - t = GEQs[e].coef[j]; - GEQs[e].coef[j] = GEQs[e].coef[i]; - GEQs[e].coef[i] = t; - } - for (e = nEQs - 1; e >= 0; e--) { - t = EQs[e].coef[j]; - EQs[e].coef[j] = EQs[e].coef[i]; - EQs[e].coef[i] = t; - } - { - short t; - t = var[j]; - var[j] = var[i]; - var[i] = t; - } - forwardingAddress[var[i]] = i; - forwardingAddress[var[j]] = j; - } - safeVars--; - } - chainUnprotect(); -} - -void Problem::constrainVariableSign( int color, int i, int sign) { - int nV = nVars; - int e, k, j; - - k = forwardingAddress[i]; - if (k < 0) { - k = -1 - k; - - if (sign != 0) { - e = newGEQ(); - eqnncpy(&GEQs[e], &SUBs[k], nVars); - for (j = 0; j <= nV; j++) - GEQs[e].coef[j] *= sign; - GEQs[e].coef[0]--; - GEQs[e].touched = 1; - GEQs[e].color = color; - } - else { - e = newEQ(); - eqnncpy(&EQs[e], &SUBs[k], nVars); - EQs[e].color = color; - } - } - else if (sign != 0) { - e = newGEQ(); - eqnnzero(&GEQs[e], nVars); - GEQs[e].coef[k] = sign; - GEQs[e].coef[0] = -1; - GEQs[e].touched = 1; - GEQs[e].color = color; - } - else { - e = newEQ(); - eqnnzero(&EQs[e], nVars); - EQs[e].coef[k] = 1; - EQs[e].color = color; - } - /* - unprotectVariable(i); - return (simplifyProblem(0,1,0)); - */ -} - -void Problem::constrainVariableValue( int color, int i, int value) { - int e, k; - - k = forwardingAddress[i]; - if (k < 0) { - k = -1 - k; - - e = newEQ(); - eqnncpy(&EQs[e], &SUBs[k], nVars); - EQs[e].coef[0] -= value; - - } - else { - e = newEQ(); - eqnnzero(&EQs[e], nVars); - EQs[e].coef[k] = 1; - EQs[e].coef[0] = -value; - } - EQs[e].color = color; -} - -// Analyze v1-v2 -void Problem:: query_difference(int v1, int v2, coef_t &lowerBound, coef_t &upperBound, bool &guaranteed) { - int nV = nVars; - int e,i,e2; - - coef_t lb1,ub1; - coef_t lb2,ub2; - assert(nSUBs == 0); - lowerBound = negInfinity; - lb1 = lb2 = negInfinity; - upperBound = posInfinity; - ub1 = ub2 = posInfinity; - guaranteed = true; - for (e = nEQs - 1; e >= 0; e--) { - if (EQs[e].coef[v1] == 0 && EQs[e].coef[v2] == 0) - continue; - for(i=nV;i>0;i--) - if (EQs[e].coef[i] && i!=v1 && i != v2) { - break; - } - if (i != 0) { - if (i > safeVars) { - // check to see if this variable appears anywhere else - for(e2 = nEQs-1; e2>=0;e2--) if (e != e2 && EQs[e2].coef[i]) break; - if (e2 < 0) - for(e2 = nGEQs-1; e2>=0;e2--) if (e != e2 && GEQs[e2].coef[i]) break; - if (e2 < 0) - for(e2 = nSUBs-1; e2>=0;e2--) if (e != e2 && SUBs[e2].coef[i]) break; - if (e2 >= 0) guaranteed = false; - } - else guaranteed = false; - continue; - } - if (EQs[e].coef[v1]*EQs[e].coef[v2] == -1) { - // found exact difference - coef_t d = - EQs[e].coef[v1] * EQs[e].coef[0]; - set_max(lowerBound, d); - set_min(upperBound, d); - guaranteed =true; - return; - } - else if (EQs[e].coef[v1] == 0) - lb2 = ub2 = -EQs[e].coef[0]/ EQs[e].coef[v2]; - else if (EQs[e].coef[v2] == 0) - lb1 = ub1 = -EQs[e].coef[0]/ EQs[e].coef[v1]; - else guaranteed = false; - } - - bool isDead[maxmaxGEQs]; - - for (e = nGEQs - 1; e >= 0; e--) isDead[e] = false; - int tryAgain = 1; - while (tryAgain) { - tryAgain = 0; - for (i = nVars; i > 0;i--) - if (i!= v1 && i != v2) { - for (e = nGEQs - 1; e >= 0; e--) - if (!isDead[e] && GEQs[e].coef[i]) - break; - if (e < 0) - e2 = e; - else if (GEQs[e].coef[i] > 0) { - for (e2 = e - 1; e2 >= 0; e2--) - if (!isDead[e2] && GEQs[e2].coef[i] < 0) - break; - } - else { - for (e2 = e - 1; e2 >= 0; e2--) - if (!isDead[e2] && GEQs[e2].coef[i] > 0) - break; - } - if (e2 < 0) { - int e3; - for (e3 = nSUBs - 1; e3 >= 0; e3--) - if (SUBs[e3].coef[i]) - break; - if (e3 >= 0) - continue; - for (e3 = nEQs - 1; e3 >= 0; e3--) - if (EQs[e3].coef[i]) - break; - if (e3 >= 0) - continue; - if (e >= 0) { - isDead[e] = true; - for (e--; e >= 0; e--) - if (GEQs[e].coef[i]) isDead[e] = true; - } - } - } - } - - for (e = nGEQs - 1; e >= 0; e--) - if (!isDead[e]) { - if (GEQs[e].coef[v1] == 0 && GEQs[e].coef[v2] == 0) - continue; - for(i=nV;i>0;i--) - if (GEQs[e].coef[i] && i!=v1 && i != v2) - break; - if (i != 0) { - guaranteed = false; - continue; - } - if (GEQs[e].coef[v1]*GEQs[e].coef[v2] == -1) { - // found relative difference - if (GEQs[e].coef[v1] == 1) { - // v1 - v2 + c >= 0 - set_max(lowerBound, - GEQs[e].coef[0]); - } - else { - // v2 - v1 + c >= 0 - // c >= v1-v2 - set_min(upperBound, GEQs[e].coef[0]); - } - } - else if (GEQs[e].coef[v1] == 0 && GEQs[e].coef[v2] > 0) - lb2 = -GEQs[e].coef[0]/ GEQs[e].coef[v2]; - else if (GEQs[e].coef[v1] == 0 && GEQs[e].coef[v2] < 0) - ub2 = -GEQs[e].coef[0]/ GEQs[e].coef[v2]; - else if (GEQs[e].coef[v2] == 0 && GEQs[e].coef[v1] > 0) - lb1 = -GEQs[e].coef[0]/ GEQs[e].coef[v1]; - else if (GEQs[e].coef[v2] == 0 && GEQs[e].coef[v1] < 0) - ub1 = -GEQs[e].coef[0]/ GEQs[e].coef[v1]; - else guaranteed = false; - } - - // ub1-lb2 >= v1-v2 >= lb1-ub2 - - if (negInfinity < lb2 && ub1 < posInfinity) set_min(upperBound, ub1-lb2); - if (negInfinity < lb1 && ub2 < posInfinity) set_max(lowerBound, lb1-ub2); - if (lowerBound >= upperBound) guaranteed = 1; -} - - -int Problem::queryVariable(int i, coef_t *lowerBound, coef_t *upperBound) { - int nV = nVars; - int e, j; - int isSimple; - int coupled = false; - for(j=1;j<=safeVars;j++) - if (var[j] > 0) - assert(forwardingAddress[var[j]] == j); - - assert(i > 0); - i = forwardingAddress[i]; - assert(i != 0); - - (*lowerBound) = negInfinity; - (*upperBound) = posInfinity; - - if (i < 0) { - int easy = true; - i = -i - 1; - for (j = 1; j <= nV; j++) - if (SUBs[i].coef[j] != 0) - easy = false; - if (easy) { - *upperBound = *lowerBound = SUBs[i].coef[0]; - return (false); - } - return (true); - } - - for (e = nSUBs - 1; e >= 0; e--) - if (SUBs[e].coef[i] != 0) - coupled = true; - - for (e = nEQs - 1; e >= 0; e--) - if (EQs[e].coef[i] != 0) { - isSimple = true; - for (j = 1; j <= nV; j++) - if (i != j && EQs[e].coef[j] != 0) { - isSimple = false; - coupled = true; - break; - } - if (!isSimple) - continue; - else { - *lowerBound = *upperBound = -EQs[e].coef[i] * EQs[e].coef[0]; - return (false); - } - } - for (e = nGEQs - 1; e >= 0; e--) - if (GEQs[e].coef[i] != 0) { - if (GEQs[e].key == i) { - set_max(*lowerBound, -GEQs[e].coef[0]); - } - else if (GEQs[e].key == -i) { - set_min(*upperBound, GEQs[e].coef[0]); - } - else - coupled = true; - } - return (coupled); -} - -int Problem::query_variable_bounds(int i, coef_t *l, coef_t *u) { - int coupled; - *l = negInfinity; - *u = posInfinity; - coupled = queryVariable(i, l, u); - if (!coupled || (nVars == 1 && forwardingAddress[i] == 1)) - return 0; - if (abs(forwardingAddress[i]) == 1 && nVars + nSUBs == 2 && nEQs + nSUBs == 1) { - int couldBeZero; - queryCoupledVariable(i, l, u, &couldBeZero, negInfinity, posInfinity); - return 0; - } - return 1; -} - -void Problem::queryCoupledVariable(int i, coef_t *l, coef_t *u, int *couldBeZero, coef_t lowerBound, coef_t upperBound) { - int e; - coef_t b1, b2; - const eqn *eqn; - coef_t sign; - int v; - - if (abs(forwardingAddress[i]) != 1 || nVars + nSUBs != 2 || nEQs + nSUBs != 1) { - fprintf(outputFile, "queryCoupledVariablecalled with bad parameters\n"); - printProblem(); - exit(2); - } - - if (forwardingAddress[i] == -1) { - eqn = &SUBs[0]; - sign = 1; - v = 1; - } - else { - eqn = &EQs[0]; - sign = -eqn->coef[1]; - v = 2; - } - - /* Variable i is defined in terms of variable v */ - - for (e = nGEQs - 1; e >= 0; e--) - if (GEQs[e].coef[v] != 0) { - if (GEQs[e].coef[v] == 1) { - set_max(lowerBound, -GEQs[e].coef[0]); - } - else { - set_min(upperBound, GEQs[e].coef[0]); - } - } - /* lowerBound and upperBound are bounds on the value of v */ - - if (lowerBound > upperBound) { - *l = posInfinity; - *u = negInfinity; - *couldBeZero = 0; - return; - } - if (lowerBound == negInfinity) { - if (eqn->coef[v] > 0) - b1 = sign * negInfinity; - else - b1 = -sign * negInfinity; - } - else - b1 = sign * (eqn->coef[0] + eqn->coef[v] * lowerBound); - if (upperBound == posInfinity) { - if (eqn->coef[v] > 0) - b2 = sign * posInfinity; - else - b2 = -sign * posInfinity; - } - else - b2 = sign * (eqn->coef[0] + eqn->coef[v] * upperBound); - - /* b1 and b2 are bounds on the value of i (don't know which is upper bound) */ - if (b1 <= b2) { - set_max(*l, b1); - set_min(*u, b2); - } - else { - set_max(*l, b2); - set_min(*u, b1); - } - *couldBeZero = *l <= 0 && 0 <= *u && int_mod(eqn->coef[0], abs(eqn->coef[v])) == 0; -} - - -int Problem::queryVariableSigns(int i, int dd_lt, int dd_eq, int dd_gt, coef_t lowerBound, coef_t upperBound, bool *distKnown, coef_t *dist) { - int result; - coef_t l, u; - int couldBeZero; - - l = negInfinity; - u = posInfinity; - - queryVariable(i, &l, &u); - queryCoupledVariable(i, &l, &u, &couldBeZero, lowerBound, upperBound); - result = 0; - if (l < 0) - result |= dd_gt; - if (u > 0) - result |= dd_lt; - if (couldBeZero) - result |= dd_eq; - if (l == u) { - *distKnown = 1; - *dist = l; - } - else { - *distKnown = 0; - } - return (result); -} - -} // namespace diff --git a/omega/omega_lib/src/omega_core/oc_quick_kill.cc b/omega/omega_lib/src/omega_core/oc_quick_kill.cc deleted file mode 100644 index e49aee7..0000000 --- a/omega/omega_lib/src/omega_core/oc_quick_kill.cc +++ /dev/null @@ -1,775 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 the Omega Project Team - Copyright (C) 2005-2011 Chun Chen - All Rights Reserved. - - Purpose: - Quick inequality elimination. - - Notes: - - History: - 03/31/09 Use BoolSet, Chun Chen -*****************************************************************************/ - -#include -#include -#include -#include - -namespace omega { - -int Problem::combineToTighten() { - int effort = min(12+5*(nVars-safeVars),23); - - if (DBUG) { - fprintf(outputFile, "\nin combineToTighten (%d,%d):\n",effort,nGEQs); - printProblem(); - fprintf(outputFile, "\n"); - } - if (nGEQs > effort) { - if (TRACE) { - fprintf(outputFile, "too complicated to tighten\n"); - } - return 1; - } - - for(int e = 1; e < nGEQs; e++) { - for(int e2 = 0; e2 < e; e2++) { - coef_t g = 0; - - bool has_wildcard = false; - bool has_wildcard2 = false; - for (int i = nVars; i > safeVars; i--) { - coef_t a = GEQs[e].coef[i]; - coef_t b = GEQs[e2].coef[i]; - g = gcd(g, abs(a+b)); - if (a != 0) - has_wildcard = true; - if (b != 0) - has_wildcard2 = true; - } - - coef_t c, c2; - if ((has_wildcard && !has_wildcard2) || (!has_wildcard && has_wildcard2)) - c = 0; - else - c = -1; - for (int i = safeVars; i >= 1; i--) { - coef_t a = GEQs[e].coef[i]; - coef_t b = GEQs[e2].coef[i]; - if (a != 0 || b != 0) { - g = gcd(g, abs(a+b)); - - if (c < 0) { - if (g == 1) - break; - } - else if ((a>0 && b<0) || (a<0 && b>0)) { - if (c == 0) { - try { - coef_t prod = lcm(abs(a), abs(b)); - c = prod/abs(a); - c2 = prod/abs(b); - } - catch (std::overflow_error) { - c = -1; - } - } - else { - if (c*a+c2*b != 0) - c = -1; - } - } - else { - c = -1; - } - } - } - - bool done_unit_combine = false; - if (g > 1 && (GEQs[e].coef[0] + GEQs[e2].coef[0]) % g != 0) { - int e3 = newGEQ(); - for(int i = nVars; i >= 1; i--) { - GEQs[e3].coef[i] = (GEQs[e].coef[i] + GEQs[e2].coef[i])/g; - } - GEQs[e3].coef[0] = int_div(GEQs[e].coef[0] + GEQs[e2].coef[0], g); - GEQs[e3].color = GEQs[e].color || GEQs[e2].color; - GEQs[e3].touched = 1; - if (DBUG) { - fprintf(outputFile, "Combined "); - printGEQ(&GEQs[e]); - fprintf(outputFile,"\n and "); - printGEQ(&GEQs[e2]); - fprintf(outputFile,"\n to get #%d: ",e3); - printGEQ(&GEQs[e3]); - fprintf(outputFile,"\n\n"); - } - - done_unit_combine = true; - if (nGEQs > effort+5 || nGEQs > maxmaxGEQs-10) goto doneCombining; - } - - if (c > 0 && !(c == 1 && c2 == 1 && done_unit_combine)) { - bool still_has_wildcard = false; - coef_t p[nVars-safeVars]; - for (int i = nVars; i > safeVars; i--) { - p[i-safeVars-1] = c * GEQs[e].coef[i] + c2 * GEQs[e2].coef[i]; - if (p[i-safeVars-1] != 0) - still_has_wildcard = true; - } - if (still_has_wildcard) { - int e3 = newGEQ(); - for(int i = nVars; i > safeVars; i--) - GEQs[e3].coef[i] = p[i-safeVars-1]; - for (int i = safeVars; i > 0; i--) - GEQs[e3].coef[i] = 0; - GEQs[e3].coef[0] = c * GEQs[e].coef[0] + c2 * GEQs[e2].coef[0]; - GEQs[e3].color = GEQs[e].color || GEQs[e2].color; - GEQs[e3].touched = 1; - if (DBUG) { - fprintf(outputFile, "Additionally combined "); - printGEQ(&GEQs[e]); - fprintf(outputFile,"\n and "); - printGEQ(&GEQs[e2]); - fprintf(outputFile,"\n to get #%d: ",e3); - printGEQ(&GEQs[e3]); - fprintf(outputFile,"\n\n"); - } - - if (nGEQs > effort+5 || nGEQs > maxmaxGEQs-10) goto doneCombining; - } - } - } - } - -doneCombining: - if (normalize() == normalize_false) return 0; - while (nEQs) { - if (!solveEQ()) return 0; - if (normalize() == normalize_false) return 0; - } - return 1; -} - - -void Problem::noteEssential(int onlyWildcards) { - for (int e = nGEQs - 1; e >= 0; e--) { - GEQs[e].essential = 0; - GEQs[e].varCount = 0; - } - if (onlyWildcards) { - for (int e = nGEQs - 1; e >= 0; e--) { - GEQs[e].essential = 1; - for (int i = nVars; i > safeVars; i--) - if (GEQs[e].coef[i] < -1 || GEQs[e].coef[i] > 1) { - GEQs[e].essential = 0; - break; - } - } - } - for (int i = nVars; i >= 1; i--) { - int onlyLB = -1; - int onlyUB = -1; - for (int e = nGEQs - 1; e >= 0; e--) - if (GEQs[e].coef[i] > 0) { - GEQs[e].varCount ++; - if (onlyLB == -1) onlyLB = e; - else onlyLB = -2; - } - else if (GEQs[e].coef[i] < 0) { - GEQs[e].varCount ++; - if (onlyUB == -1) onlyUB = e; - else onlyUB = -2; - } - if (onlyUB >= 0) { - if (DBUG) { - fprintf(outputFile,"only UB: "); - printGEQ(&GEQs[onlyUB]); - fprintf(outputFile,"\n"); - } - GEQs[onlyUB].essential = 1; - } - if (onlyLB >= 0) { - if (DBUG) { - fprintf(outputFile,"only LB: "); - printGEQ(&GEQs[onlyLB]); - fprintf(outputFile,"\n"); - } - GEQs[onlyLB].essential = 1; - } - } - for (int e = nGEQs - 1; e >= 0; e--) - if (!GEQs[e].essential && GEQs[e].varCount > 1) { - int i1,i2,i3; - for (i1 = nVars; i1 >= 1; i1--) if (GEQs[e].coef[i1]) break; - for (i2 = i1-1; i2 >= 1; i2--) if (GEQs[e].coef[i2]) break; - for (i3 = i2-1; i3 >= 1; i3--) if (GEQs[e].coef[i3]) break; - assert(i2 >= 1); - int e2; - for (e2 = nGEQs - 1; e2 >= 0; e2--) - if (e!=e2) { - coef_t crossProduct; - crossProduct = GEQs[e].coef[i1]*GEQs[e2].coef[i1]; - crossProduct += GEQs[e].coef[i2]*GEQs[e2].coef[i2]; - for (int i = i3; i >= 1; i--) - if (GEQs[e2].coef[i]) - crossProduct += GEQs[e].coef[i]*GEQs[e2].coef[i]; - if (crossProduct > 0) { - if (DBUG) fprintf(outputFile,"Cross product of %d and %d is " coef_fmt "\n", e, e2, crossProduct); - break; - } - } - if (e2 < 0) GEQs[e].essential = 1; - } - if (DBUG) { - fprintf(outputFile,"Computed essential equations\n"); - fprintf(outputFile,"essential equations:\n"); - for (int e = 0; e < nGEQs; e++) - if (GEQs[e].essential) { - printGEQ(&GEQs[e]); - fprintf(outputFile,"\n"); - } - fprintf(outputFile,"potentially redundant equations:\n"); - for (int e = 0; e < nGEQs; e++) - if (!GEQs[e].essential) { - printGEQ(&GEQs[e]); - fprintf(outputFile,"\n"); - } - } -} - - -int Problem::findDifference(int e, int &v1, int &v2) { - // if 1 returned, eqn E is of form v1 -coef >= v2 - for(v1=1;v1<=nVars;v1++) - if (GEQs[e].coef[v1]) break; - for(v2=v1+1;v2<=nVars;v2++) - if (GEQs[e].coef[v2]) break; - if (v2 > nVars) { - if (GEQs[e].coef[v1] == -1) { - v2 = v1; - v1 = 0; - return 1; - } - if (GEQs[e].coef[v1] == 1) { - v2 = 0; - return 1; - } - return 0; - } - if (GEQs[e].coef[v1] * GEQs[e].coef[v2] != -1) return 0; - if (GEQs[e].coef[v1] < 0) std::swap(v1,v2); - return 1; -} - - -namespace { - struct succListStruct { - int num; - int notEssential; - int var[maxVars]; - coef_t diff[maxVars]; - int eqn[maxVars]; - }; -} - - -int Problem::chainKill(int color, int onlyWildcards) { - int v1,v2,e; - int essentialPred[maxVars]; - int redundant[maxmaxGEQs]; - int inChain[maxVars]; - int goodStartingPoint[maxVars]; - int tryToEliminate[maxmaxGEQs]; - int triedDoubleKill = 0; - - succListStruct succ[maxVars]; - -restart: - - int anyToKill = 0; - int anyKilled = 0; - int canHandle = 0; - - for(v1=0;v1<=nVars;v1++) { - succ[v1].num = 0; - succ[v1].notEssential = 0; - goodStartingPoint[v1] = 0; - inChain[v1] = -1; - essentialPred[v1] = 0; - } - - int essentialEquations = 0; - for (e = 0; e < nGEQs; e++) { - redundant[e] = 0; - tryToEliminate[e] = !GEQs[e].essential; - if (GEQs[e].essential) essentialEquations++; - if (color && !GEQs[e].color) tryToEliminate[e] = 0; - } - if (essentialEquations == nGEQs) return 0; - if (2*essentialEquations < nVars) return 1; - - for (e = 0; e < nGEQs; e++) - if (tryToEliminate[e] && GEQs[e].varCount <= 2 && findDifference(e,v1,v2)) { - assert(v1 == 0 || GEQs[e].coef[v1] == 1); - assert(v2 == 0 || GEQs[e].coef[v2] == -1); - succ[v2].notEssential++; - int s = succ[v2].num++; - succ[v2].eqn[s] = e; - succ[v2].var[s] = v1; - succ[v2].diff[s] = -GEQs[e].coef[0]; - goodStartingPoint[v2] = 1; - anyToKill++; - canHandle++; - } - if (!anyToKill) { - return canHandle < nGEQs; - } - for (e = 0; e < nGEQs; e++) - if (!tryToEliminate[e] && GEQs[e].varCount <= 2 && findDifference(e,v1,v2)) { - assert(v1 == 0 || GEQs[e].coef[v1] == 1); - assert(v2 == 0 || GEQs[e].coef[v2] == -1); - int s = succ[v2].num++; - essentialPred[v1]++; - succ[v2].eqn[s] = e; - succ[v2].var[s] = v1; - succ[v2].diff[s] = -GEQs[e].coef[0]; - canHandle++; - } - - - if (DBUG) { - int s; - fprintf(outputFile,"In chainkill: [\n"); - for(v1 = 0;v1<=nVars;v1++) { - fprintf(outputFile,"#%d <= %s: ",essentialPred[v1],variable(v1)); - for(s=0;s= succ[v1].diff[s1a]) { - if (DBUG) { - fprintf(outputFile,"quick double kill: "); - printGEQ(&GEQs[succ[v1].eqn[s1a]]); - fprintf(outputFile,"\n"); - } - redundant[succ[v1].eqn[s1a]] = 1; - anyKilled++; - anyToKill--; - goto nextVictim; - } - } - nextVictim: v1 = v1; - } - if (anyKilled) { - for (e = nGEQs-1; e >= 0;e--) - if (redundant[e]) { - if (DBUG) { - fprintf(outputFile,"Deleting "); - printGEQ(&GEQs[e]); - fprintf(outputFile,"\n"); - } - deleteGEQ(e); - } - - if (!anyToKill) return canHandle < nGEQs; - noteEssential(onlyWildcards); - triedDoubleKill = 1; - goto restart; - } - - for(v1 = 0;v1<=nVars;v1++) - if (succ[v1].num == succ[v1].notEssential && succ[v1].notEssential > 0) { - succ[v1].notEssential--; - essentialPred[succ[v1].var[succ[v1].notEssential]]++; - } - - while (1) { - int chainLength; - int chain[maxVars]; - coef_t distance[maxVars]; - // pick a place to start - for(v1 = 0;v1<=nVars;v1++) - if (essentialPred[v1] == 0 && succ[v1].num > succ[v1].notEssential) - break; - if (v1 > nVars) - for(v1 = 0;v1<=nVars;v1++) - if (goodStartingPoint[v1] && succ[v1].num > succ[v1].notEssential) - break; - if (v1 > nVars) break; - - chainLength = 1; - chain[0] = v1; - distance[0] = 0; - inChain[v1] = 0; - int s; - - while (succ[v1].num > succ[v1].notEssential) { - s = succ[v1].num-1; - if (inChain[succ[v1].var[s]] >= 0) { - // Found cycle, don't do anything with them yet - break; - } - succ[v1].num = s; - - distance[chainLength]= distance[chainLength-1] + succ[v1].diff[s]; - v1 = chain[chainLength] = succ[v1].var[s]; - essentialPred[v1]--; - assert(essentialPred[v1] >= 0); - inChain[v1] = chainLength; - chainLength++; - } - - - int c; - if (DBUG) { - fprintf(outputFile,"Found chain: \n"); - for (c = 0; c < chainLength; c++) - fprintf(outputFile,"%s:" coef_fmt " ",variable(chain[c]), distance[c]); - fprintf(outputFile,"\n"); - } - - - for (c = 0; c < chainLength; c++) { - v1 = chain[c]; - for(s=0;s c+1) { - if (DBUG) - fprintf(outputFile,"%s + " coef_fmt " <= %s is in chain\n", variable(v1), distance[inChain[succ[v1].var[s]]]- distance[c], variable(succ[v1].var[s])); - if ( distance[inChain[succ[v1].var[s]]]- distance[c] >= succ[v1].diff[s]) { - if (DBUG) - fprintf(outputFile,"%s + " coef_fmt " <= %s is redundant\n", variable(v1),succ[v1].diff[s], variable(succ[v1].var[s])); - redundant[succ[v1].eqn[s]] = 1; - } - } - } - } - for (c = 0; c < chainLength; c++) - inChain[chain[c]] = -1; - } - - for (e = nGEQs-1; e >= 0;e--) - if (redundant[e]) { - if (DBUG) { - fprintf(outputFile,"Deleting "); - printGEQ(&GEQs[e]); - fprintf(outputFile,"\n"); - } - deleteGEQ(e); - anyKilled = 1; - } - - if (anyKilled) noteEssential(onlyWildcards); - - if (anyKilled && DBUG) { - fprintf(outputFile,"\nResult:\n"); - printProblem(); - } - if (DBUG) { - fprintf(outputFile,"] end chainkill\n"); - printProblem(); - } - return canHandle < nGEQs; -} - - -namespace { - struct varCountStruct { - int e; - int safeVarCount; - int wildVarCount; - varCountStruct(int e_, int count1_, int count2_) { - e = e_; - safeVarCount = count1_; - wildVarCount = count2_; } - }; - bool operator<(const varCountStruct &a, const varCountStruct &b) { - if (a.wildVarCount < b.wildVarCount) - return true; - else if (a.wildVarCount > b.wildVarCount) - return false; - else - return a.safeVarCount < b.safeVarCount; - } -} - - -// -// Deduct redundant inequalities by combination of any two inequalities. -// Return value: 0 (no solution), -// 1 (nothing killed), -// 2 (some inequality killed). -// -int Problem::quickKill(int onlyWildcards, bool desperate) { - if (!onlyWildcards && !combineToTighten()) - return 0; - noteEssential(onlyWildcards); - int moreToDo = chainKill(0, onlyWildcards); - -#ifdef NDEBUG - if (!moreToDo) return 1; -#endif - - - if (!desperate && nGEQs > 256) { // original 60, increased by chun - if (TRACE) { - fprintf(outputFile, "%d inequalities are too complicated to quick kill\n", nGEQs); - } - return 1; - } - - if (DBUG) { - fprintf(outputFile, "in eliminate Redudant:\n"); - printProblem(); - } - - int isDead[nGEQs]; - std::vector killOrder; - std::vector > P(nGEQs, BoolSet<>(nVars)), Z(nGEQs, BoolSet<>(nVars)), N(nGEQs, BoolSet<>(nVars)); - BoolSet<> PP, PZ, PN; // possible Positives, possible zeros & possible negatives - - for (int e = nGEQs - 1; e >= 0; e--) { - isDead[e] = 0; - int safeVarCount = 0; - int wildVarCount = 0; - for (int i = nVars; i >= 1; i--) { - if (GEQs[e].coef[i] == 0) - Z[e].set(i-1); - else { - if (i > safeVars) - wildVarCount++; - else - safeVarCount++; - if (GEQs[e].coef[i] < 0) - N[e].set(i-1); - else - P[e].set(i-1); - } - } - - if (!GEQs[e].essential || wildVarCount > 0) - killOrder.push_back(varCountStruct(e, safeVarCount, wildVarCount)); - } - - sort(killOrder.begin(), killOrder.end()); - - if (DEBUG) { - fprintf(outputFile,"Prefered kill order:\n"); - for (int e3I = killOrder.size()-1; e3I >= 0; e3I--) { - fprintf(outputFile,"%2d: ",nGEQs-1-e3I); - printGEQ(&GEQs[killOrder[e3I].e]); - fprintf(outputFile,"\n"); - } - } - - int e3U = killOrder.size()-1; - while (e3U >= 0) { - // each round of elimination is for inequalities of same complexity and rounds are at descending complexity order - int e3L = e3U-1; - for(; e3L >= 0; e3L--) - if (killOrder[e3L].safeVarCount+killOrder[e3L].wildVarCount != killOrder[e3U].safeVarCount + killOrder[e3U].wildVarCount) - break; - - // check if e3 can be eliminated from combination of e1 and e2 - for (int e1 = 0; e1 < nGEQs; e1++) - if (!isDead[e1]) - for (int e2 = e1+1; e2 < nGEQs; e2++) - if (!isDead[e2]) { - coef_t alpha = 0; - int p, q; - for (p = nVars; p > 1; p--) - for (q = p - 1; q > 0; q--) { - try { - alpha = check_mul(GEQs[e1].coef[p], GEQs[e2].coef[q]) - check_mul(GEQs[e2].coef[p], GEQs[e1].coef[q]); - } - catch (std::overflow_error) { - continue; - } - if (alpha != 0) - goto foundPQ; - } - continue; - - foundPQ: - PZ = (Z[e1] & Z[e2]) | (P[e1] & N[e2]) | (N[e1] & P[e2]); - PP = P[e1] | P[e2]; - PN = N[e1] | N[e2]; - if (DEBUG) { - fprintf(outputFile,"Considering combination of "); - printGEQ(&(GEQs[e1])); - fprintf(outputFile," and "); - printGEQ(&(GEQs[e2])); - fprintf(outputFile,"\n"); - } - - for (int e3I = e3U; e3I > e3L; e3I--) { - int e3 = killOrder[e3I].e; - if (!isDead[e3] && e3 != e1 && e3 != e2) - try { - coef_t alpha1, alpha2, alpha3; - - if (!PZ.imply(Z[e3])) - goto nextE3; - - alpha1 = check_mul(GEQs[e2].coef[q], GEQs[e3].coef[p]) - check_mul(GEQs[e2].coef[p], GEQs[e3].coef[q]); - alpha2 = -(check_mul(GEQs[e1].coef[q], GEQs[e3].coef[p]) - check_mul(GEQs[e1].coef[p], GEQs[e3].coef[q])); - alpha3 = alpha; - - if (alpha1 < 0) { - alpha1 = -alpha1; - alpha2 = -alpha2; - alpha3 = -alpha3; - } - if (alpha1 == 0 || alpha2 <= 0) - goto nextE3; - - { - coef_t g = gcd(gcd(alpha1, alpha2), abs(alpha3)); - alpha1 /= g; - alpha2 /= g; - alpha3 /= g; - } - - if (DEBUG) { - fprintf(outputFile, coef_fmt "e1 + " coef_fmt "e2 = " coef_fmt "e3: ",alpha1,alpha2,alpha3); - printGEQ(&(GEQs[e3])); - fprintf(outputFile,"\n"); - } - - if (alpha3 > 0) { // trying to prove e3 is redundant - if (!GEQs[e3].color && (GEQs[e1].color || GEQs[e2].color)) { - goto nextE3; - } - if (!PP.imply(P[e3]) | !PN.imply(N[e3])) - goto nextE3; - - // verify alpha1*v1+alpha2*v2 = alpha3*v3 - for (int k = nVars; k >= 1; k--) - if (check_mul(alpha3, GEQs[e3].coef[k]) != check_mul(alpha1, GEQs[e1].coef[k]) + check_mul(alpha2, GEQs[e2].coef[k])) - goto nextE3; - - coef_t c = check_mul(alpha1, GEQs[e1].coef[0]) + check_mul(alpha2, GEQs[e2].coef[0]); - if (c < check_mul(alpha3, (GEQs[e3].coef[0] + 1))) { - if (DBUG) { - fprintf(outputFile, "found redundant inequality\n"); - fprintf(outputFile, "alpha1, alpha2, alpha3 = " coef_fmt "," coef_fmt "," coef_fmt "\n", alpha1, alpha2, alpha3); - printGEQ(&(GEQs[e1])); - fprintf(outputFile, "\n"); - printGEQ(&(GEQs[e2])); - fprintf(outputFile, "\n=> "); - printGEQ(&(GEQs[e3])); - fprintf(outputFile, "\n\n"); - assert(moreToDo); - } - - isDead[e3] = 1; - } - } - else { // trying to prove e3 <= 0 or e3 = 0 - if (!PN.imply(P[e3]) | !PP.imply(N[e3])) - goto nextE3; - - // verify alpha1*v1+alpha2*v2 = alpha3*v3 - for (int k = nVars; k >= 1; k--) - if (check_mul(alpha3, GEQs[e3].coef[k]) != check_mul(alpha1, GEQs[e1].coef[k]) + check_mul(alpha2, GEQs[e2].coef[k])) - goto nextE3; - - if (DEBUG) { - fprintf(outputFile,"All but constant term checked\n"); - } - coef_t c = check_mul(alpha1, GEQs[e1].coef[0]) + check_mul(alpha2, GEQs[e2].coef[0]); - if (DEBUG) { - fprintf(outputFile,"All but constant term checked\n"); - fprintf(outputFile,"Constant term is " coef_fmt " vs " coef_fmt "\n", - alpha3*GEQs[e3].coef[0], - alpha3*(GEQs[e3].coef[0]-1)); - } - if (c < check_mul(alpha3, (GEQs[e3].coef[0]))) { - // we just proved e3 < 0, so no solutions exist - if (DBUG) { - fprintf(outputFile, "found implied over tight inequality\n"); - fprintf(outputFile, "alpha1, alpha2, alpha3 = " coef_fmt "," coef_fmt "," coef_fmt "\n", alpha1, alpha2, -alpha3); - printGEQ(&(GEQs[e1])); - fprintf(outputFile, "\n"); - printGEQ(&(GEQs[e2])); - fprintf(outputFile, "\n=> not "); - printGEQ(&(GEQs[e3])); - fprintf(outputFile, "\n\n"); - } - return 0; - } - else if (!GEQs[e3].color && (GEQs[e1].color || GEQs[e2].color)) { - goto nextE3; - } - else if (c < check_mul(alpha3, (GEQs[e3].coef[0] - 1))) { - // we just proved e3 <= 0, so e3 = 0 - if (DBUG) { - fprintf(outputFile, "found implied tight inequality\n"); - fprintf(outputFile, "alpha1, alpha2, alpha3 = " coef_fmt "," coef_fmt "," coef_fmt "\n", alpha1, alpha2, -alpha3); - printGEQ(&(GEQs[e1])); - fprintf(outputFile, "\n"); - printGEQ(&(GEQs[e2])); - fprintf(outputFile, "\n=> inverse "); - printGEQ(&(GEQs[e3])); - fprintf(outputFile, "\n\n"); - } - int neweq = newEQ(); - eqnncpy(&EQs[neweq], &GEQs[e3], nVars); - addingEqualityConstraint(neweq); - isDead[e3] = 1; - } - } - nextE3:; - } - catch (std::overflow_error) { - continue; - } - } - } - - e3U = e3L; - } - - bool anything_killed = false; - for (int e = nGEQs - 1; e >= 0; e--) { - if (isDead[e]) { - anything_killed = true; - deleteGEQ(e); - } - } - - if (DBUG) { - fprintf(outputFile,"\nResult:\n"); - printProblem(); - } - - if (anything_killed) - return 2; - else - return 1; -} - -} // namespace diff --git a/omega/omega_lib/src/omega_core/oc_simple.cc b/omega/omega_lib/src/omega_core/oc_simple.cc deleted file mode 100644 index ebbf407..0000000 --- a/omega/omega_lib/src/omega_core/oc_simple.cc +++ /dev/null @@ -1,1373 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 the Omega Project Team - Copyright (C) 2005-2011 Chun Chen - All Rights Reserved. - - Purpose: - Support functions for solving a problem. - - Notes: - - History: - 10/13/08 Complete back substitution process, Chun Chen. - 05/28/09 Extend normalize process to handle redundancy involving - wilddcards, Chun Chen -*****************************************************************************/ - -#include -#include -#include -#include - -namespace omega { - -int checkIfSingleVar(eqn* e, int i) { - for (; i > 0; i--) - if (e->coef[i]) { - i--; - break; - } - for (; i > 0; i--) - if (e->coef[i]) - break; - return (i == 0); -} - - -int singleVarGEQ(eqn* e) { - return !e->touched && e->key != 0 && -maxVars <= e->key && e->key <= maxVars; -} - - -void checkVars(int nVars) { - if (nVars > maxVars) { - fprintf(stderr, "\nERROR:\n"); - fprintf(stderr, "An attempt was made to create a conjunction with %d variables.\n", nVars); - fprintf(stderr, "The current limit on variables in a single conjunction is %d.\n", maxVars); - fprintf(stderr, "This limit can be changed by changing the #define of maxVars in oc.h.\n\n"); - exit(2); - } -} - - -void Problem::difficulty(int &numberNZs, coef_t &maxMinAbsCoef, coef_t &sumMinAbsCoef) const { - numberNZs=0; - maxMinAbsCoef=0; - sumMinAbsCoef=0; - for (int e = 0; e < nGEQs; e++) { - coef_t maxCoef = 0; - for(int i = 1;i <= nVars;i++) - if (GEQs[e].coef[i]!=0) { - coef_t a = abs(GEQs[e].coef[i]); - maxCoef = max(maxCoef,a); - numberNZs++; - } - coef_t nextCoef = 0; - for(int i = 1;i <= nVars;i++) - if (GEQs[e].coef[i]!=0) { - coef_t a = abs(GEQs[e].coef[i]); - if (a < maxCoef) nextCoef = max(nextCoef,a); - else if (a == maxCoef) maxCoef = 0x7fffffff; - } - maxMinAbsCoef = max(maxMinAbsCoef,nextCoef); - sumMinAbsCoef += nextCoef; - } - - for (int e = 0; e < nEQs; e++) { - coef_t maxCoef = 0; - for(int i = 1;i <= nVars;i++) - if (EQs[e].coef[i]!=0) { - coef_t a = abs(EQs[e].coef[i]); - maxCoef = max(maxCoef,a); - numberNZs++; - } - coef_t nextCoef = 0; - for(int i = 1;i <= nVars;i++) - if (EQs[e].coef[i]!=0) { - coef_t a = abs(EQs[e].coef[i]); - if (a < maxCoef) nextCoef = max(nextCoef,a); - else if (a == maxCoef) maxCoef = 0x7fffffff; - } - maxMinAbsCoef = max(maxMinAbsCoef,nextCoef); - sumMinAbsCoef += nextCoef; - } -} - -int Problem::countRedGEQs() const { - int result = 0; - for (int e = 0; e < nGEQs; e++) - if (GEQs[e].color == EQ_RED) result++; - return result; -} - -int Problem::countRedEQs() const { - int result = 0; - for (int e = 0; e < nEQs; e++) - if (EQs[e].color == EQ_RED) result++; - return result; -} - -int Problem::countRedEquations() const { - int result = 0; - for (int e = 0; e < nEQs; e++) - if (EQs[e].color == EQ_RED) { - int i; - for (i = nVars; i > 0; i--) if (EQs[e].coef[i]) break; - if (i == 0 && EQs[e].coef[0] != 0) return 0; - else result+=2; - } - for (int e = 0; e < nGEQs; e++) - if (GEQs[e].color == EQ_RED) result+=1; - for (int e = 0; e < nMemories; e++) - switch(redMemory[e].kind ) { - case redEQ: - case redStride: - e++; - case redLEQ: - case redGEQ: - e++; - case notRed: - ; /* avoid warning about notRed not handled */ - } - return result; -} - -void Problem::deleteBlack() { - int RedVar[maxVars]; - for(int i = safeVars+1;i <= nVars;i++) RedVar[i] = 0; - - assert(nSUBs == 0); - - for (int e = nEQs-1; e >= 0; e--) - if (EQs[e].color != EQ_RED) { - eqnncpy(&EQs[e],&EQs[nEQs-1], nVars); - nEQs--; - } - else - for(int i = safeVars+1;i <= nVars;i++) - if (EQs[e].coef[i]) RedVar[i] = 1; - - for (int e = nGEQs-1; e >= 0; e--) - if (GEQs[e].color != EQ_RED) { - eqnncpy(&GEQs[e],&GEQs[nGEQs-1], nVars); - nGEQs--; - } - else - for(int i = safeVars+1;i <= nVars;i++) - if (GEQs[e].coef[i]) RedVar[i] = 1; - - assert(nSUBs == 0); - - for(int i = nVars; i > safeVars;i--) { - if (!RedVar[i]) deleteVariable(i); - } -} - - -void Problem::deleteRed() { - int BlackVar[maxVars]; - for(int i = safeVars+1;i <= nVars;i++) BlackVar[i] = 0; - - assert(nSUBs == 0); - for (int e = nEQs-1; e >=0; e--) - if (EQs[e].color) { - eqnncpy(&EQs[e],&EQs[nEQs-1], nVars); - nEQs--; - } - else - for(int i = safeVars+1;i <= nVars;i++) - if (EQs[e].coef[i]) BlackVar[i] = 1; - - for (int e = nGEQs-1; e >=0; e--) - if (GEQs[e].color) { - eqnncpy(&GEQs[e],&GEQs[nGEQs-1], nVars); - nGEQs--; - } - else - for(int i = safeVars+1;i <= nVars;i++) - if (GEQs[e].coef[i]) BlackVar[i] = 1; - - assert(nSUBs == 0); - - for(int i = nVars; i> safeVars;i--) { - if (!BlackVar[i]) deleteVariable(i); - } -} - - -void Problem::turnRedBlack() { - for (int e = nEQs-1; e >= 0; e--) EQs[e].color = 0; - for (int e = nGEQs-1; e >= 0; e--) GEQs[e].color = 0; -} - - -void Problem::useWildNames() { - for(int i = safeVars+1; i <= nVars; i++) nameWildcard(i); -} - - -void negateCoefficients(eqn* eqn, int nVars) { - for (int i = nVars; i >= 0; i--) - eqn-> coef[i] = -eqn->coef[i]; - eqn->touched = true; -} - - -void Problem::negateGEQ(int e) { - negateCoefficients(&GEQs[e],nVars); - GEQs[e].coef[0]--; -} - - -void Problem:: deleteVariable(int i) { - if (i < safeVars) { - int j = safeVars; - for (int e = nGEQs - 1; e >= 0; e--) { - GEQs[e].touched = true; - GEQs[e].coef[i] = GEQs[e].coef[j]; - GEQs[e].coef[j] = GEQs[e].coef[nVars]; - } - for (int e = nEQs - 1; e >= 0; e--) { - EQs[e].coef[i] = EQs[e].coef[j]; - EQs[e].coef[j] = EQs[e].coef[nVars]; - } - for (int e = nSUBs - 1; e >= 0; e--) { - SUBs[e].coef[i] = SUBs[e].coef[j]; - SUBs[e].coef[j] = SUBs[e].coef[nVars]; - } - var[i] = var[j]; - var[j] = var[nVars]; - } - else if (i < nVars) { - for (int e = nGEQs - 1; e >= 0; e--) - if (GEQs[e].coef[nVars]) { - GEQs[e].coef[i] = GEQs[e].coef[nVars]; - GEQs[e].touched = true; - } - for (int e = nEQs - 1; e >= 0; e--) - EQs[e].coef[i] = EQs[e].coef[nVars]; - for (int e = nSUBs - 1; e >= 0; e--) - SUBs[e].coef[i] = SUBs[e].coef[nVars]; - var[i] = var[nVars]; - } - if (i <= safeVars) - safeVars--; - nVars--; -} - - -void Problem::setInternals() { - if (!variablesInitialized) { - initializeVariables(); - } - - var[0] = 0; - nextWildcard = 0; - for(int i = 1;i <= nVars;i++) - if (var[i] < 0) - var[i] = --nextWildcard; - - assert(nextWildcard >= -maxWildcards); - - CHECK_FOR_DUPLICATE_VARIABLE_NAMES; - - int v = nSUBs; - for(int i = 1;i <= safeVars;i++) if (var[i] > 0) v++; - varsOfInterest = v; - - if (nextKey * 3 > maxKeys) { - omega::hashVersion++; - nextKey = maxVars + 1; - for (int e = nGEQs - 1; e >= 0; e--) - GEQs[e].touched = true; - for (int i = 0; i < hashTableSize; i++) - hashMaster[i].touched = -1; - hashVersion = omega::hashVersion; - } - else if (hashVersion != omega::hashVersion) { - for (int e = nGEQs - 1; e >= 0; e--) - GEQs[e].touched = true; - hashVersion = omega::hashVersion; - } -} - - -void Problem::setExternals() { - for (int i = 1; i <= safeVars; i++) - forwardingAddress[var[i]] = i; - for (int i = 0; i < nSUBs; i++) - forwardingAddress[SUBs[i].key] = -i - 1; -} - - -void setOutputFile(FILE * file) { - /* sets the file to which printProblem should send its output to "file" */ - - outputFile = file; -} - - -void setPrintLevel(int level) { - /* Sets the nber of points printed before constraints in printProblem */ - headerLevel = level; -} - - -void Problem::putVariablesInStandardOrder() { - for(int i = 1;i <= safeVars;i++) { - int b = i; - for(int j=i+1;j<=safeVars;j++) { - if (var[b] < var[j]) b = j; - } - if (b != i) swapVars(i,b); - } -} - - -void Problem::nameWildcard(int i) { - int j; - do { - --nextWildcard; - if (nextWildcard < -maxWildcards) - nextWildcard = -1; - var[i] = nextWildcard; - for(j = nVars; j > 0;j--) if (i!=j && var[j] == nextWildcard) break; - } while (j != 0); -} - - -int Problem::protectWildcard(int i) { - assert (i > safeVars); - if (i != safeVars+1) swapVars(i,safeVars+1); - safeVars++; - nameWildcard(safeVars); - return safeVars; -} - - -int Problem::addNewProtectedWildcard() { - int i = ++safeVars; - nVars++; - if (nVars != i) { - for (int e = nGEQs - 1; e >= 0; e--) { - if (GEQs[e].coef[i] != 0) - GEQs[e].touched = true; - GEQs[e].coef[nVars] = GEQs[e].coef[i]; - } - for (int e = nEQs - 1; e >= 0; e--) { - EQs[e].coef[nVars] = EQs[e].coef[i]; - } - for (int e = nSUBs - 1; e >= 0; e--) { - SUBs[e].coef[nVars] = SUBs[e].coef[i]; - } - var[nVars] = var[i]; - } - for (int e = nGEQs - 1; e >= 0; e--) - GEQs[e].coef[i] = 0; - for (int e = nEQs - 1; e >= 0; e--) - EQs[e].coef[i] = 0; - for (int e = nSUBs - 1; e >= 0; e--) - SUBs[e].coef[i] = 0; - nameWildcard(i); - return (i); -} - - -int Problem::addNewUnprotectedWildcard() { - int i = ++nVars; - for (int e = nGEQs - 1; e >= 0; e--) GEQs[e].coef[i] = 0; - for (int e = nEQs - 1; e >= 0; e--) EQs[e].coef[i] = 0; - for (int e = nSUBs - 1; e >= 0; e--) SUBs[e].coef[i] = 0; - nameWildcard(i); - return i; -} - - -void Problem::cleanoutWildcards() { - bool renormalize = false; - - // substituting wildcard equality - for (int e = nEQs-1; e >= 0; e--) { - for (int i = nVars; i >= safeVars+1; i--) - if (EQs[e].coef[i] != 0) { - coef_t c = EQs[e].coef[i]; - coef_t a = abs(c); - - bool preserveThisConstraint = true; - for (int e2 = nEQs-1; e2 >= 0; e2--) - if (e2 != e && EQs[e2].coef[i] != 0 && EQs[e2].color >= EQs[e].color) { - preserveThisConstraint = preserveThisConstraint && (gcd(a,abs(EQs[e2].coef[i])) != 1); - coef_t k = lcm(a, abs(EQs[e2].coef[i])); - coef_t coef1 = (EQs[e2].coef[i]>0?1:-1) * k / c; - coef_t coef2 = k / abs(EQs[e2].coef[i]); - for (int j = nVars; j >= 0; j--) - EQs[e2].coef[j] = EQs[e2].coef[j] * coef2 - EQs[e].coef[j] * coef1; - - coef_t g = 0; - for (int j = nVars; j >= 0; j--) { - g = gcd(abs(EQs[e2].coef[j]), g); - if (g == 1) - break; - } - if (g != 0 && g != 1) - for (int j = nVars; j >= 0; j--) - EQs[e2].coef[j] /= g; - } - - for (int e2 = nGEQs-1; e2 >= 0; e2--) - if (GEQs[e2].coef[i] != 0 && GEQs[e2].color >= EQs[e].color) { - coef_t k = lcm(a, abs(GEQs[e2].coef[i])); - coef_t coef1 = (GEQs[e2].coef[i]>0?1:-1) * k / c; - coef_t coef2 = k / abs(GEQs[e2].coef[i]); - for (int j = nVars; j >= 0; j--) - GEQs[e2].coef[j] = GEQs[e2].coef[j] * coef2 - EQs[e].coef[j] * coef1; - - GEQs[e2].touched = 1; - renormalize = true; - } - - for (int e2 = nSUBs-1; e2 >= 0; e2--) - if (SUBs[e2].coef[i] != 0 && SUBs[e2].color >= EQs[e].color) { - coef_t k = lcm(a, abs(SUBs[e2].coef[i])); - coef_t coef1 = (SUBs[e2].coef[i]>0?1:-1) * k / c; - coef_t coef2 = k / abs(SUBs[e2].coef[i]); - for (int j = nVars; j >= 0; j--) - SUBs[e2].coef[j] = SUBs[e2].coef[j] * coef2 - EQs[e].coef[j] * coef1; - - coef_t g = 0; - for (int j = nVars; j >= 0; j--) { - g = gcd(abs(SUBs[e2].coef[j]), g); - if (g == 1) - break; - } - if (g != 0 && g != 1) - for (int j = nVars; j >= 0; j--) - SUBs[e2].coef[j] /= g; - } - - // remove redundent wildcard equality - if (!preserveThisConstraint) { - if (e < nEQs-1) - eqnncpy (&EQs[e], &EQs[nEQs-1], nVars); - nEQs--; - deleteVariable(i); - } - - break; - } - } - - // remove multi-wildcard equality in approximation mode - if (inApproximateMode) - for (int e = nEQs-1; e >= 0; e--) - for (int i = nVars; i >= safeVars+1; i--) - if (EQs[e].coef[i] != 0) { - int j = i-1; - for (; j >= safeVars+1; j--) - if (EQs[e].coef[j] != 0) - break; - - if (j != safeVars) { - if (e < nEQs-1) - eqnncpy (&EQs[e], &EQs[nEQs-1], nVars); - nEQs--; - } - - break; - } - - if (renormalize) - normalize(); -} - - -void Problem:: check() const { -#ifndef NDEBUG - int v = nSUBs; - checkVars(nVars+1); - for(int i = 1; i <= safeVars; i++) if (var[i] > 0) v++; - assert(v == varsOfInterest); - for(int e = 0; e < nGEQs; e++) assert(GEQs[e].touched || GEQs[e].key != 0); - if(!mayBeRed) { - for(int e = 0; e < nEQs; e++) assert(!EQs[e].color); - for(int e = 0; e < nGEQs; e++) assert(!GEQs[e].color); - } - else - for(int i = safeVars+1; i <= nVars; i++) { - int isBlack = 0; - int isRed = 0; - for(int e = 0; e < nEQs; e++) - if (EQs[e].coef[i]) { - if (EQs[e].color) isRed = 1; - else isBlack = 1; - } - for(int e = 0; e < nGEQs; e++) - if (GEQs[e].coef[i]) { - if (GEQs[e].color) isRed = 1; - else isBlack = 1; - } - if (isBlack && isRed && 0) { - fprintf(outputFile,"Mixed Red and Black variable:\n"); - printProblem(); - } - } -#endif -} - - -void Problem::rememberRedConstraint(eqn *e, redType type, coef_t stride) { - // Check if this is really a stride constraint - if (type == redEQ && newVar == nVars && e->coef[newVar]) { - type = redStride; - stride = e->coef[newVar]; - } - // else for(int i = safeVars+1; i <= nVars; i++) assert(!e->coef[i]); // outdated -- by chun 10/30/2008 - - assert(type != notRed); - assert(type == redStride || stride == 0); - - if (TRACE) { - fprintf(outputFile,"being asked to remember red constraint:\n"); - switch(type) { - case notRed: fprintf(outputFile,"notRed: "); - break; - case redGEQ: fprintf(outputFile,"Red: 0 <= "); - break; - case redLEQ: fprintf(outputFile,"Red: 0 >= "); - break; - case redEQ: fprintf(outputFile,"Red: 0 == "); - break; - case redStride: fprintf(outputFile,"Red stride " coef_fmt ": ",stride); - break; - } - printTerm(e,1); - fprintf(outputFile,"\n"); - printProblem(); - fprintf(outputFile,"----\n"); - } - - // Convert redLEQ to redGEQ - eqn mem; - eqnncpy(&mem,e, nVars); - e = &mem; - if (type == redLEQ) { - for(int i = 0; i <= safeVars; i++) - e->coef[i] = -e->coef[i]; - type = redGEQ; - } - - // Prepare coefficient array for red constraint - bool has_wildcard = false; - coef_t coef[varsOfInterest-nextWildcard+1]; - for (int i = 0; i <= varsOfInterest-nextWildcard; i++) - coef[i] = 0; - for (int i = 0; i <= safeVars; i++) { - if (var[i] < 0) { - if (e->coef[i] != 0) { - coef[varsOfInterest-var[i]] = e->coef[i]; - has_wildcard = true; - } - } - else - coef[var[i]] = e->coef[i]; - } - - // Sophisticated back substituion for wildcards, use Gaussian elimination - // as a fallback if no simple equations available. -- by chun 10/13/2008 - if (has_wildcard) { - // Find substitutions involving wildcard - coef_t *repl_subs[nSUBs]; - int num_wild_in_repl_subs[nSUBs]; - int num_repl_subs = 0; - for (int i = 0; i < nSUBs; i++) { - int t = 0; - for (int j = 1; j <= safeVars; j++) { - if (var[j] < 0 && SUBs[i].coef[j] != 0) - t++; - } - if (t > 0) { - repl_subs[num_repl_subs] = new coef_t[varsOfInterest-nextWildcard+1]; - for (int j = 0; j <= varsOfInterest-nextWildcard; j++) - repl_subs[num_repl_subs][j] = 0; - - for (int k = 0; k <= safeVars; k++) - repl_subs[num_repl_subs][(var[k]<0)?varsOfInterest-var[k]:var[k]] = SUBs[i].coef[k]; - repl_subs[num_repl_subs][SUBs[i].key] = -1; - num_wild_in_repl_subs[num_repl_subs] = t; - num_repl_subs++; - } - } - - int wild_solved[-nextWildcard+1]; - bool has_unsolved = false; - for (int i = 1; i <= -nextWildcard; i++) { - int minimum_wild = 0; - int pos; - for (int j = 0; j < num_repl_subs; j++) - if (repl_subs[j][varsOfInterest+i] != 0 && (minimum_wild == 0 || num_wild_in_repl_subs[j] < minimum_wild)) { - minimum_wild = num_wild_in_repl_subs[j]; - pos = j; - } - - if (minimum_wild == 0) { - wild_solved[i] = -1; - if (coef[varsOfInterest+i] != 0) { - fprintf(outputFile,"No feasible back substitutions available\n"); - printProblem(); - exit(1); - } - } - else if (minimum_wild == 1) - wild_solved[i] = pos; - else { - wild_solved[i] = -1; - if (coef[varsOfInterest+i] != 0) - has_unsolved = true; - } - } - - // Gaussian elimination - while (has_unsolved) { - for (int i = 0; i < num_repl_subs; i++) - if (num_wild_in_repl_subs[i] > 1) { - for (int j = 1; j <= -nextWildcard; j++) { - if (repl_subs[i][varsOfInterest+j] != 0 && wild_solved[j] >= 0) { - int s = wild_solved[j]; - coef_t l = lcm(abs(repl_subs[i][varsOfInterest+j]), abs(repl_subs[s][varsOfInterest+j])); - coef_t scale_1 = l/abs(repl_subs[i][varsOfInterest+j]); - coef_t scale_2 = l/abs(repl_subs[s][varsOfInterest+j]); - int sign = ((repl_subs[i][varsOfInterest+j]>0)?1:-1) * ((repl_subs[s][varsOfInterest+j]>0)?1:-1); - for (int k = 0; k <= varsOfInterest-nextWildcard; k++) - repl_subs[i][k] = scale_1*repl_subs[i][k] - sign*scale_2*repl_subs[s][k]; - num_wild_in_repl_subs[i]--; - } - } - - if (num_wild_in_repl_subs[i] == 1) { - for (int j = 1; j <= -nextWildcard; j++) - if (repl_subs[i][varsOfInterest+j] != 0) { - assert(wild_solved[j]==-1); - wild_solved[j] = i; - break; - } - } - else if (num_wild_in_repl_subs[i] > 1) { - int pos = 0; - for (int j = 1; j <= -nextWildcard; j++) - if (repl_subs[i][varsOfInterest+j] != 0) { - pos = j; - break; - } - assert(pos > 0); - - for (int j = i+1; j < num_repl_subs; j++) - if (repl_subs[j][varsOfInterest+pos] != 0) { - coef_t l = lcm(abs(repl_subs[i][varsOfInterest+pos]), abs(repl_subs[j][varsOfInterest+pos])); - coef_t scale_1 = l/abs(repl_subs[i][varsOfInterest+pos]); - coef_t scale_2 = l/abs(repl_subs[j][varsOfInterest+pos]); - int sign = ((repl_subs[i][varsOfInterest+pos]>0)?1:-1) * ((repl_subs[j][varsOfInterest+pos]>0)?1:-1); - for (int k = 0; k <= varsOfInterest-nextWildcard; k++) - repl_subs[j][k] = scale_2*repl_subs[j][k] - sign*scale_1*repl_subs[i][k]; - - num_wild_in_repl_subs[j] = 0; - int first_wild = 0; - for (int k = 1; k <= -nextWildcard; k++) - if (repl_subs[j][varsOfInterest+k] != 0) { - num_wild_in_repl_subs[j]++; - first_wild = k; - } - - if (num_wild_in_repl_subs[j] == 1) { - if (wild_solved[first_wild] < 0) - wild_solved[first_wild] = j; - } - } - } - } - - has_unsolved = false; - for (int i = 1; i <= -nextWildcard; i++) - if (coef[varsOfInterest+i] != 0 && wild_solved[i] < 0) { - has_unsolved = true; - break; - } - } - - // Substitute all widecards in the red constraint - for (int i = 1; i <= -nextWildcard; i++) { - if (coef[varsOfInterest+i] != 0) { - int s = wild_solved[i]; - assert(s >= 0); - - coef_t l = lcm(abs(coef[varsOfInterest+i]), abs(repl_subs[s][varsOfInterest+i])); - coef_t scale_1 = l/abs(coef[varsOfInterest+i]); - coef_t scale_2 = l/abs(repl_subs[s][varsOfInterest+i]); - int sign = ((coef[varsOfInterest+i]>0)?1:-1) * ((repl_subs[s][varsOfInterest+i]>0)?1:-1); - for (int j = 0; j <= varsOfInterest-nextWildcard; j++) - coef[j] = scale_1*coef[j] - sign*scale_2*repl_subs[s][j]; - - if (scale_1 != 1) - stride *= scale_1; - } - } - - for (int i = 0; i < num_repl_subs; i++) - delete []repl_subs[i]; - } - - // Ready to insert into redMemory - int m = nMemories++; - redMemory[m].length = 0; - redMemory[m].kind = type; - redMemory[m].constantTerm = coef[0]; - for(int i = 1; i <= varsOfInterest; i++) - if (coef[i]) { - int j = redMemory[m].length++; - redMemory[m].coef[j] = coef[i]; - redMemory[m].var[j] = i; - } - if (type == redStride) redMemory[m].stride = stride; - if (DBUG) { - fprintf(outputFile,"Red constraint remembered\n"); - printProblem(); - } -} - -void Problem::recallRedMemories() { - if (nMemories) { - if (TRACE) { - fprintf(outputFile,"Recalling red memories\n"); - printProblem(); - } - - eqn* e = 0; - for(int m = 0; m < nMemories; m++) { - switch(redMemory[m].kind) { - case redGEQ: - { - int temporary_eqn = newGEQ(); - e = &GEQs[temporary_eqn]; - eqnnzero(e, nVars); - e->touched = 1; - break; - } - case redEQ: - { - int temporary_eqn = newEQ(); - e = &EQs[temporary_eqn]; - eqnnzero(e, nVars); - break; - } - case redStride: - { - int temporary_eqn = newEQ(); - e = &EQs[temporary_eqn]; - eqnnzero(e, nVars); - int i = addNewUnprotectedWildcard(); - e->coef[i] = -redMemory[m].stride; - break; - } - default: - assert(0); - } - e->color = EQ_RED; - e->coef[0] = redMemory[m].constantTerm; - for(int i = 0; i < redMemory[m].length; i++) { - int v = redMemory[m].var[i]; - assert(var[forwardingAddress[v]] == v); - e->coef[forwardingAddress[v]] = redMemory[m].coef[i]; - } - } - - nMemories = 0; - if (TRACE) { - fprintf(outputFile,"Red memories recalled\n"); - printProblem(); - } - } -} - -void Problem::swapVars(int i, int j) { - if (DEBUG) { - use_ugly_names++; - fprintf(outputFile, "Swapping %d and %d\n", i, j); - printProblem(); - use_ugly_names--; - } - std::swap(var[i], var[j]); - for (int e = nGEQs - 1; e >= 0; e--) - if (GEQs[e].coef[i] != GEQs[e].coef[j]) { - GEQs[e].touched = true; - coef_t t = GEQs[e].coef[i]; - GEQs[e].coef[i] = GEQs[e].coef[j]; - GEQs[e].coef[j] = t; - } - for (int e = nEQs - 1; e >= 0; e--) - if (EQs[e].coef[i] != EQs[e].coef[j]) { - coef_t t = EQs[e].coef[i]; - EQs[e].coef[i] = EQs[e].coef[j]; - EQs[e].coef[j] = t; - } - for (int e = nSUBs - 1; e >= 0; e--) - if (SUBs[e].coef[i] != SUBs[e].coef[j]) { - coef_t t = SUBs[e].coef[i]; - SUBs[e].coef[i] = SUBs[e].coef[j]; - SUBs[e].coef[j] = t; - } - if (DEBUG) { - use_ugly_names++; - fprintf(outputFile, "Swapping complete \n"); - printProblem(); - fprintf(outputFile, "\n"); - use_ugly_names--; - } -} - -void Problem::addingEqualityConstraint(int e) { - if (addingOuterEqualities && originalProblem != noProblem && - originalProblem != this && !conservative) { - int e2 = originalProblem->newEQ(); - if (TRACE) - fprintf(outputFile, "adding equality constraint %d to outer problem\n", e2); - eqnnzero(&originalProblem->EQs[e2], originalProblem->nVars); - for (int i = nVars; i >= 1; i--) { - int j; - for (j = originalProblem->nVars; j >= 1; j--) - if (originalProblem->var[j] == var[i]) - break; - if (j <= 0 || (outerColor && j > originalProblem->safeVars)) { - if (DBUG) - fprintf(outputFile, "retracting\n"); - originalProblem->nEQs--; - return; - } - originalProblem->EQs[e2].coef[j] = EQs[e].coef[i]; - } - originalProblem->EQs[e2].coef[0] = EQs[e].coef[0]; - - originalProblem->EQs[e2].color = outerColor; - if (DBUG) - originalProblem->printProblem(); - } -} - - -// Initialize hash codes for inequalities, remove obvious redundancy. -// Case 1: -// a1*x1+a2*x2+...>=c (1) -// a1*x2+a2*x2+...>=c' (2) -// if c>=c' then (2) is redundant, and vice versa. -// -// case 2: -// a1*x1+a2*x2+...>=c (1) -// a1*x1+a2*x2+...<=c' (2) -// if c=c' then add equality of (1) or (2), -// if c>c' then no solution. -// -// Finally it calls extended normalize process which handles -// wildcards in redundacy removal. -normalizeReturnType Problem::normalize() { - int i, j; - bool coupledSubscripts = false; - - check(); - - for (int e = 0; e < nGEQs; e++) { - if (!GEQs[e].touched) { - if (!singleVarGEQ(&GEQs[e])) - coupledSubscripts = true; - } - else { // normalize e - coef_t g; - int topVar; - int i0; - coef_t hashCode; - - { - int *p = &packing[0]; - for (int k = 1; k <= nVars; k++) - if (GEQs[e].coef[k]) { - *(p++) = k; - } - topVar = (p - &packing[0]) - 1; - } - - if (topVar == -1) { - if (GEQs[e].coef[0] < 0) { - // e has no solution - return (normalize_false); - } - deleteGEQ(e); - e--; - continue; - } - else if (topVar == 0) { - int singleVar = packing[0]; - g = GEQs[e].coef[singleVar]; - if (g > 0) { - GEQs[e].coef[singleVar] = 1; - GEQs[e].key = singleVar; - } - else { - g = -g; - GEQs[e].coef[singleVar] = -1; - GEQs[e].key = -singleVar; - } - if (g > 1) - GEQs[e].coef[0] = int_div(GEQs[e].coef[0], g); - } - else { - coupledSubscripts = true; - i0 = topVar; - i = packing[i0--]; - g = GEQs[e].coef[i]; - hashCode = g * (i + 3); - if (g < 0) - g = -g; - for (; i0 >= 0; i0--) { - coef_t x; - i = packing[i0]; - x = GEQs[e].coef[i]; - hashCode = hashCode * keyMult * (i + 3) + x; - if (x < 0) - x = -x; - if (x == 1) { - g = 1; - i0--; - break; - } - else - g = gcd(x, g); - } - for (; i0 >= 0; i0--) { - coef_t x; - i = packing[i0]; - x = GEQs[e].coef[i]; - hashCode = hashCode * keyMult * (i + 3) + x; - } - if (g > 1) { - GEQs[e].coef[0] = int_div(GEQs[e].coef[0], g); - i0 = topVar; - i = packing[i0--]; - GEQs[e].coef[i] = GEQs[e].coef[i] / g; - hashCode = GEQs[e].coef[i] * (i + 3); - for (; i0 >= 0; i0--) { - i = packing[i0]; - GEQs[e].coef[i] = GEQs[e].coef[i] / g; - hashCode = hashCode * keyMult * (i + 3) + GEQs[e].coef[i]; - } - } - - { - coef_t g2 = abs(hashCode); // get e's hash code - j = static_cast(g2 % static_cast(hashTableSize)); - assert (g2 % (coef_t) hashTableSize == j); - while (1) { - eqn *proto = &(hashMaster[j]); - if (proto->touched == g2) { - if (proto->coef[0] == topVar) { - if (hashCode >= 0) - for (i0 = topVar; i0 >= 0; i0--) { - i = packing[i0]; - if (GEQs[e].coef[i] != proto->coef[i]) - break; - } - else - for (i0 = topVar; i0 >= 0; i0--) { - i = packing[i0]; - if (GEQs[e].coef[i] != -proto->coef[i]) - break; - } - - if (i0 < 0) { - if (hashCode >= 0) - GEQs[e].key = proto->key; - else - GEQs[e].key = -proto->key; - break; - } - } - } - else if (proto->touched < 0) { //insert e into the empty entry in hash table - eqnnzero(proto, nVars); - if (hashCode >= 0) - for (i0 = topVar; i0 >= 0; i0--) { - i = packing[i0]; - proto->coef[i] = GEQs[e].coef[i]; - } - else - for (i0 = topVar; i0 >= 0; i0--) { - i = packing[i0]; - proto->coef[i] = -GEQs[e].coef[i]; - } - proto->coef[0] = topVar; - proto->touched = g2; - proto->key = nextKey++; - - if (proto->key > maxKeys) { - fprintf(outputFile, "too many hash keys generated \n"); - fflush(outputFile); - exit(2); - } - if (hashCode >= 0) - GEQs[e].key = proto->key; - else - GEQs[e].key = -proto->key; - break; - } - j = (j + 1) % hashTableSize; - } - } - } - } - - GEQs[e].touched = false; - - { - int eKey = GEQs[e].key; - int e2; - if (e > 0) { - e2 = fastLookup[maxKeys - eKey]; - if (e2 >= 0 && e2 < e && GEQs[e2].key == -eKey) { - // confirm it is indeed a match -- by chun 10/29/2008 - int k; - for (k = nVars; k >= 1; k--) - if (GEQs[e2].coef[k] != -GEQs[e].coef[k]) - break; - - if (k == 0) { - if (GEQs[e2].coef[0] < -GEQs[e].coef[0]) { - // there is no solution from e and e2 - return (normalize_false); - } - else if (GEQs[e2].coef[0] == -GEQs[e].coef[0]) { - // reduce e and e2 to an equation - int neweq = newEQ(); - eqnncpy(&EQs[neweq], &GEQs[e], nVars); - EQs[neweq].color = GEQs[e].color || GEQs[e2].color; - addingEqualityConstraint(neweq); - } - } - } - - e2 = fastLookup[maxKeys + eKey]; - if (e2 >= 0 && e2 < e && GEQs[e2].key == eKey) { - // confirm it is indeed a match -- by chun 10/29/2008 - int k; - for (k = nVars; k >= 1; k--) - if (GEQs[e2].coef[k] != GEQs[e].coef[k]) - break; - - if (k == 0) { - if (GEQs[e2].coef[0] > GEQs[e].coef[0] || - (GEQs[e2].coef[0] == GEQs[e].coef[0] && GEQs[e2].color)) { - // e2 is redundant - GEQs[e2].coef[0] = GEQs[e].coef[0]; - GEQs[e2].color = GEQs[e].color; - deleteGEQ(e); - e--; - continue; - } - else { - // e is redundant - deleteGEQ(e); - e--; - continue; - } - } - } - } - fastLookup[maxKeys + eKey] = e; - } - } - - // bypass entended normalization for temporary problem - if (!isTemporary && !inApproximateMode) - normalize_ext(); - - return coupledSubscripts ? normalize_coupled : normalize_uncoupled; -} - -// -// Extended normalize process, remove redundancy involving wildcards. -// e.g. -// exists alpha, beta: -// v1+8*alpha<=v2<=15+8*alpha (1) -// v1+8*beta<=v2<=15+8*beta (2) -// if there are no other inequalities involving alpha or beta, -// then either (1) or (2) is redundant. Such case can't be simplified -// by fourier-motzkin algorithm due to special meanings of existentials. -// -void Problem::normalize_ext() { - std::vector > disjoint_wildcards(nVars-safeVars, BoolSet<>(nVars-safeVars)); - std::vector > wildcards_in_inequality(nVars-safeVars, BoolSet<>(nGEQs)); - for (int i = 0; i < nVars-safeVars; i++) { - disjoint_wildcards[i].set(i); - } - - // create disjoint wildcard sets according to inequalities - for (int e = 0; e < nGEQs; e++) { - std::vector >::iterator first_set = disjoint_wildcards.end(); - for (int i = 0; i < nVars-safeVars; i++) - if (GEQs[e].coef[i+safeVars+1] != 0) { - wildcards_in_inequality[i].set(e); - - std::vector >::iterator cur_set = disjoint_wildcards.end(); - for (std::vector >::iterator j = disjoint_wildcards.begin(); j != disjoint_wildcards.end(); j++) - if ((*j).get(i)) { - cur_set = j; - break; - } - assert(cur_set!=disjoint_wildcards.end()); - if (first_set == disjoint_wildcards.end()) - first_set = cur_set; - else if (first_set != cur_set) { - *first_set |= *cur_set; - disjoint_wildcards.erase(cur_set); - } - } - } - - // do not consider wildcards appearing in equalities - for (int e = 0; e < nEQs; e++) - for (int i = 0; i < nVars-safeVars; i++) - if (EQs[e].coef[i+safeVars+1] != 0) { - for (std::vector >::iterator j = disjoint_wildcards.begin(); j != disjoint_wildcards.end(); j++) - if ((*j).get(i)) { - disjoint_wildcards.erase(j); - break; - } - } - - // create disjoint inequality sets - std::vector > disjoint_inequalities(disjoint_wildcards.size()); - for (size_t i = 0; i < disjoint_wildcards.size(); i++) - for (int j = 0; j < nVars-safeVars; j++) - if (disjoint_wildcards[i].get(j)) - disjoint_inequalities[i] |= wildcards_in_inequality[j]; - - // hash the inequality again, this time separate wildcard variables from - // regular variables - coef_t hash_safe[nGEQs]; - coef_t hash_wild[nGEQs]; - for (int e = 0; e < nGEQs; e++) { - coef_t hashCode = 0; - for (int i = 1; i <= safeVars; i++) - if (GEQs[e].coef[i] != 0) - hashCode = hashCode * keyMult * (i+3) + GEQs[e].coef[i]; - hash_safe[e] = hashCode; - - hashCode = 0; - for (int i = safeVars+1; i <= nVars; i++) - if (GEQs[e].coef[i] != 0) - hashCode = hashCode * keyMult + GEQs[e].coef[i]; - hash_wild[e] = hashCode; - } - - // sort hash keys for each disjoint set - std::vector > > > disjoint_hash(disjoint_inequalities.size()); - for (size_t i = 0; i < disjoint_inequalities.size(); i++) - for (int e = 0; e < nGEQs; e++) - if (disjoint_inequalities[i].get(e)) { - std::vector > >::iterator j = disjoint_hash[i].begin(); - for (; j != disjoint_hash[i].end(); j++) - if ((hash_safe[e] > (*j).second.first) || - (hash_safe[e] == (*j).second.first && hash_wild[e] > (*j).second.second)) - break; - disjoint_hash[i].insert(j, std::make_pair(e, std::make_pair(hash_safe[e], hash_wild[e]))); - } - - // test wildcard equivalance - std::vector is_dead(nGEQs, false); - for (size_t i = 0; i < disjoint_wildcards.size(); i++) { - if (disjoint_inequalities[i].num_elem() == 0) - continue; - - for (size_t j = i+1; j < disjoint_wildcards.size(); j++) { - if (disjoint_wildcards[i].num_elem() != disjoint_wildcards[j].num_elem() || - disjoint_hash[i].size() != disjoint_hash[j].size()) - continue; - - bool match = true; - for (size_t k = 0; k < disjoint_hash[i].size(); k++) { - if (disjoint_hash[i][k].second != disjoint_hash[j][k].second) { - match = false; - break; - } - } - if (!match) - continue; - - // confirm same coefficients for regular variables - for (size_t k = 0; k < disjoint_hash[i].size(); k++) { - for (int p = 1; p <= safeVars; p++) - if (GEQs[disjoint_hash[i][k].first].coef[p] != GEQs[disjoint_hash[j][k].first].coef[p]) { - match = false; - break; - } - if (!match) - break; - } - if (!match) - continue; - - // now try combinatory wildcard matching - std::vector wild_map(nVars-safeVars, -1); - for (size_t k = 0; k < disjoint_hash[i].size(); k++) { - int e1 = disjoint_hash[i][k].first; - int e2 = disjoint_hash[j][k].first; - - for (int p = 0; p < nVars-safeVars; p++) - if (GEQs[e1].coef[p+safeVars+1] != 0) { - if (wild_map[p] == -1) { - for (int q = 0; q < nVars-safeVars; q++) - if (wild_map[q] == -1 && - GEQs[e2].coef[q+safeVars+1] == GEQs[e1].coef[p+safeVars+1]) { - wild_map[p] = q; - wild_map[q] = p; - break; - } - if (wild_map[p] == -1) { - match = false; - break; - } - } - else if (GEQs[e2].coef[wild_map[p]+safeVars+1] != GEQs[e1].coef[p+safeVars+1]) { - match = false; - break; - } - } - if (!match) - break; - - for (int p = 0; p < nVars-safeVars; p++) - if (GEQs[e2].coef[p+safeVars+1] != 0 && - (wild_map[p] == -1 || GEQs[e2].coef[p+safeVars+1] != GEQs[e1].coef[wild_map[p]+safeVars+1])) { - match = false; - break; - } - if (!match) - break; - } - if (!match) - continue; - - // check constants - int dir = 0; - for (size_t k = 0; k < disjoint_hash[i].size(); k++) { - if (GEQs[disjoint_hash[i][k].first].coef[0] > GEQs[disjoint_hash[j][k].first].coef[0]) { - if (dir == 0) - dir = 1; - else if (dir == -1) { - match = false; - break; - } - } - else if (GEQs[disjoint_hash[i][k].first].coef[0] < GEQs[disjoint_hash[j][k].first].coef[0]) { - if (dir == 0) - dir = -1; - else if (dir == 1) { - match = false; - break; - } - } - } - if (!match) - continue; - - // check redness - int red_dir = 0; - for (size_t k = 0; k < disjoint_hash[i].size(); k++) { - if (GEQs[disjoint_hash[i][k].first].color > GEQs[disjoint_hash[j][k].first].color) { - if (red_dir == 0) - red_dir = 1; - else if (red_dir == -1) { - match = false; - break; - } - } - else if (GEQs[disjoint_hash[i][k].first].color < GEQs[disjoint_hash[j][k].first].color) { - if (red_dir == 0) - red_dir = -1; - else if (red_dir == 1) { - match = false; - break; - } - } - } - if (!match) - continue; - - // remove redundant inequalities - if (dir == 1 || (dir == 0 && red_dir == 1)) { - for (size_t k = 0; k < disjoint_hash[i].size(); k++) { - GEQs[disjoint_hash[i][k].first].coef[0] = GEQs[disjoint_hash[j][k].first].coef[0]; - GEQs[disjoint_hash[i][k].first].color = GEQs[disjoint_hash[j][k].first].color; - is_dead[disjoint_hash[j][k].first] = true; - } - } - else { - for (size_t k = 0; k < disjoint_hash[i].size(); k++) { - is_dead[disjoint_hash[j][k].first] = true; - } - } - } - } - - // eliminate dead inequalities - for (int e = nGEQs-1; e >= 0; e--) - if (is_dead[e]) { - deleteGEQ(e); - } -} - - -void initializeOmega(void) { - if (omegaInitialized) - return; - -// assert(sizeof(eqn)==sizeof(int)*(headerWords)+sizeof(coef_t)*(1+maxVars)); - nextWildcard = 0; - nextKey = maxVars + 1; - for (int i = 0; i < hashTableSize; i++) - hashMaster[i].touched = -1; - - sprintf(wildName[1], "__alpha"); - sprintf(wildName[2], "__beta"); - sprintf(wildName[3], "__gamma"); - sprintf(wildName[4], "__delta"); - sprintf(wildName[5], "__tau"); - sprintf(wildName[6], "__sigma"); - sprintf(wildName[7], "__chi"); - sprintf(wildName[8], "__omega"); - sprintf(wildName[9], "__pi"); - sprintf(wildName[10], "__ni"); - sprintf(wildName[11], "__Alpha"); - sprintf(wildName[12], "__Beta"); - sprintf(wildName[13], "__Gamma"); - sprintf(wildName[14], "__Delta"); - sprintf(wildName[15], "__Tau"); - sprintf(wildName[16], "__Sigma"); - sprintf(wildName[17], "__Chi"); - sprintf(wildName[18], "__Omega"); - sprintf(wildName[19], "__Pi"); - - omegaInitialized = 1; -} - -// -// This is experimental (I would say, clinical) fact: -// If the code below is removed then simplifyProblem cycles. -// -class brainDammage { -public: - brainDammage(); -}; - -brainDammage::brainDammage() { - initializeOmega(); -} - -static brainDammage Podgorny; - -} // namespace diff --git a/omega/omega_lib/src/omega_core/oc_solve.cc b/omega/omega_lib/src/omega_core/oc_solve.cc deleted file mode 100644 index c25b6d0..0000000 --- a/omega/omega_lib/src/omega_core/oc_solve.cc +++ /dev/null @@ -1,1378 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 the Omega Project Team - Copyright (C) 2005-2011 Chun Chen - All Rights Reserved. - - Purpose: - Solve ineqalities. - - Notes: - - History: -*****************************************************************************/ - -#include - -namespace omega { - -static int solveDepth = 0; -#define maxDead maxmaxGEQs - -int Problem::solve(int desiredResult) { - assert(omegaInitialized); - int result; - - checkVars(nVars+1); - assert(nVars >= safeVars); - if (desiredResult != OC_SOLVE_SIMPLIFY) - safeVars = 0; - - solveDepth++; - if (solveDepth > 50) { - fprintf(outputFile, "Solve depth = %d, inApprox = %d, aborting\n", solveDepth, inApproximateMode); - printProblem(); - fflush(outputFile); - - if (solveDepth > 60) - exit(2); - } - - check(); - do { - doItAgain = 0; - check(); - if (solveEQ() == false) { - solveDepth--; - return (false); - } - check(); - if (!nGEQs) { - result = true; - nVars = safeVars; - break; - } - else - result = solveGEQ(desiredResult); - check(); - } - while (doItAgain && desiredResult == OC_SOLVE_SIMPLIFY); - solveDepth--; - - return (result); -} - - -// Supporting functions of solveGEQ -int Problem::smoothWeirdEquations() { - int e1, e2, e3, p, q, k; - coef_t alpha, alpha1, alpha2, alpha3; - coef_t c; - int v; - int result = 0; - - for (e1 = nGEQs - 1; e1 >= 0; e1--) - if (!GEQs[e1].color) { - coef_t g = 999999; - for (v = nVars; v >= 1; v--) - if (GEQs[e1].coef[v] != 0 && abs(GEQs[e1].coef[v]) < g) - g = abs(GEQs[e1].coef[v]); - if (g > 20) { - e3 = newGEQ(); /* Create a scratch GEQ,not part of the prob.*/ - nGEQs--; - for (v = nVars; v >= 1; v--) - GEQs[e3].coef[v] = int_div(6 * GEQs[e1].coef[v] + g / 2, g); - GEQs[e3].color = EQ_BLACK; - GEQs[e3].touched = 1; - GEQs[e3].coef[0] = 9997; - if (DBUG) { - fprintf(outputFile, "Checking to see if we can derive: "); - printGEQ(&GEQs[e3]); - fprintf(outputFile, "\n from: "); - printGEQ(&GEQs[e1]); - fprintf(outputFile, "\n"); - } - - - for (e2 = nGEQs - 1; e2 >= 0; e2--) - if (e1 != e2 && !GEQs[e2].color) { - for (p = nVars; p > 1; p--) { - for (q = p - 1; q > 0; q--) { - alpha = check_mul(GEQs[e1].coef[p], GEQs[e2].coef[q]) - check_mul(GEQs[e2].coef[p], GEQs[e1].coef[q]); - if (alpha != 0) - goto foundPQ; - } - } - continue; - - foundPQ: - - alpha1 = check_mul(GEQs[e2].coef[q], GEQs[e3].coef[p]) - check_mul(GEQs[e2].coef[p], GEQs[e3].coef[q]); - alpha2 = -(check_mul(GEQs[e1].coef[q], GEQs[e3].coef[p]) - check_mul(GEQs[e1].coef[p], GEQs[e3].coef[q])); - alpha3 = alpha; - - if (alpha1 * alpha2 <= 0) - continue; - if (alpha1 < 0) { - alpha1 = -alpha1; - alpha2 = -alpha2; - alpha3 = -alpha3; - } - if (alpha3 > 0) { - /* Trying to prove e3 is redundant */ - - /* verify alpha1*v1+alpha2*v2 = alpha3*v3 */ - for (k = nVars; k >= 1; k--) - if (check_mul(alpha3, GEQs[e3].coef[k]) - != check_mul(alpha1, GEQs[e1].coef[k]) + check_mul(alpha2, GEQs[e2].coef[k])) - goto nextE2; - - c = check_mul(alpha1, GEQs[e1].coef[0]) + check_mul(alpha2, GEQs[e2].coef[0]); - if (c < check_mul(alpha3, (GEQs[e3].coef[0] + 1))) - GEQs[e3].coef[0] = int_div(c, alpha3); - - } - nextE2:; - } - if (GEQs[e3].coef[0] < 9997) { - result++; -#if !defined NDEBUG - int e4 = -#endif - newGEQ(); -#if !defined NDEBUG - assert(e3 == e4); -#endif - if (DBUG) { - fprintf(outputFile, "Smoothing wierd equations; adding:\n"); - printGEQ(&GEQs[e3]); - fprintf(outputFile, "\nto:\n"); - printProblem(); - fprintf(outputFile, "\n\n"); - } - } - } - } - return (result); -} - - -void Problem::analyzeElimination( - int &v, - int &darkConstraints, - int &darkShadowFeasible, - int &unit, - coef_t ¶llelSplinters, - coef_t &disjointSplinters, - coef_t &lbSplinters, - coef_t &ubSplinters, - int ¶llelLB) { - - parallelSplinters = (posInfinity); // was MAXINT - disjointSplinters = 0; - lbSplinters = 0; - ubSplinters = 0; - - darkConstraints = 0; - darkShadowFeasible = 1; - coef_t maxUBc = 0; - coef_t maxLBc = 0; - int e,e2; - unit = 0; - int exact = 1; - - for (e = nGEQs - 1; e >= 0; e--) { - coef_t c = GEQs[e].coef[v]; - - if (c < 0) { - coef_t Lc, Uc, g, diff, grey; - - set_max(maxUBc, -c); - Uc = -c; - for (e2 = nGEQs - 1; e2 >= 0; e2--) - if (GEQs[e2].coef[v] > 0) { - Lc = GEQs[e2].coef[v]; - g = 0; - grey = (Lc - 1) * (Uc - 1); - - for (int j = nVars; j >= 1; j--) { - coef_t diff = check_mul(Lc, GEQs[e].coef[j]) + check_mul(Uc, GEQs[e2].coef[j]); - if (diff < 0) diff = -diff; - g = gcd(g, diff); - if (g == 1) - break; - } - diff = check_mul(Lc, GEQs[e].coef[0]) + check_mul(Uc, GEQs[e2].coef[0]); - if (g == 0) { - if (diff < 0) { - /* Real shadow must be true */ - /* otherwise we would have found it during */ - /* check for opposing constraints */ - fprintf(outputFile, "Found conflicting constraints "); - printGEQ(&GEQs[e]); - fprintf(outputFile," and "); - printGEQ(&GEQs[e2]); - fprintf(outputFile,"\nin\n"); - printProblem(); - assert(diff >= 0); - } - if (diff < grey) { - darkShadowFeasible = 0; - if (parallelSplinters > diff+1) { - parallelSplinters = diff + 1; - parallelLB = e2; - } - } - else {/* dark shadow is true, don't need to worry about this constraint pair */ - } - } - else { - coef_t splinters= int_div(diff, g) - int_div(diff - grey, g); - if (splinters) exact = 0; - disjointSplinters += splinters; - if (g > 1) unit++; - darkConstraints++; - } - } - } - else if (c > 0) { - set_max(maxLBc, c); - } /* else - darkConstraints++; */ - } - - if (darkShadowFeasible) { - disjointSplinters++; - ubSplinters++; - lbSplinters++; - } - else disjointSplinters = (posInfinity); // was MAXINT - - - if (!darkShadowFeasible || !exact) - for (e = nGEQs - 1; e >= 0; e--) { - coef_t c = GEQs[e].coef[v]; - if (c < -1) { - c = -c; - ubSplinters += 1+(check_mul(c, maxLBc) - c - maxLBc) / maxLBc; - } - else if (c > 1) { - lbSplinters += 1+ (check_mul(c, maxUBc) - c - maxUBc) / maxUBc; - } - } - - if (DEBUG) { - fprintf(outputFile,"analyzing elimination of %s(%d)\n",variable(v),v); - if (darkShadowFeasible) - fprintf(outputFile," # dark constraints = %d\n", darkConstraints); - else - fprintf(outputFile," dark shadow obviously unfeasible\n"); - - fprintf(outputFile," " coef_fmt " LB splinters\n", lbSplinters); - fprintf(outputFile," " coef_fmt " UB splinters\n", ubSplinters); - if (disjointSplinters != (posInfinity)) - fprintf(outputFile," " coef_fmt " disjoint splinters\n", disjointSplinters); - if (parallelSplinters != (posInfinity)) - fprintf(outputFile," " coef_fmt " parallel splinters\n", parallelSplinters); - fprintf(outputFile, "\n"); - fprintf(outputFile," %3d unit score \n", unit); - } -} - - -void Problem::partialElimination() { - if (DBUG) { - fprintf(outputFile, "Performing Partial elimination\n"); - printProblem(); - } - int fv; - if (0) - fv = 0; - else - fv = safeVars; - bool somethingHappened = false; - for (int i = nVars; i > fv; i--) { - bool isDead[maxmaxGEQs]; - int e; - for (e = nGEQs-1; e >= 0; e--) isDead[e] = false; - int deadEqns[maxDead]; - int numDead = 0; - for (int e1 = nGEQs-1; e1 >= 0; e1--) - if (abs(GEQs[e1].coef[i]) == 1) { - bool isGood = true; - for (int e2 = nGEQs-1; e2 >= 0; e2--) - if (check_mul(GEQs[e2].coef[i], GEQs[e1].coef[i]) < 0) - if (GEQs[e1].key != -GEQs[e2].key) { - coef_t Uc = abs(GEQs[e2].coef[i]); - for (int k = nVars; k > fv; k--) - if (GEQs[e2].coef[k] + check_mul(GEQs[e1].coef[k], Uc) != 0) - isGood = false; - } - if (isGood) { - somethingHappened = true; - for (int e2 = nGEQs-1; e2 >= 0; e2--) - if (check_mul(GEQs[e2].coef[i], GEQs[e1].coef[i]) < 0) { - if (GEQs[e1].key != -GEQs[e2].key) { - coef_t Uc = abs(GEQs[e2].coef[i]); - int new_eqn; - if (numDead == 0) { - new_eqn = newGEQ(); - } - else { - new_eqn = deadEqns[--numDead]; - } - isDead[new_eqn] = false; - if (DBUG) { - fprintf(outputFile,"Eliminating constraint on %s\n", variable(i)); - fprintf(outputFile, "e1 = %d, e2 = %d, gen = %d\n", e1, e2, new_eqn); - printGEQ(&(GEQs[e1])); - fprintf(outputFile, "\n"); - printGEQ(&(GEQs[e2])); - fprintf(outputFile, "\n"); - } - - for (int k = nVars; k >= 0; k--) - GEQs[new_eqn].coef[k] = GEQs[e2].coef[k] + check_mul(GEQs[e1].coef[k], Uc); - GEQs[new_eqn].touched = true; - GEQs[new_eqn].color = GEQs[e2].color | GEQs[e1].color; - if (DBUG) { - fprintf(outputFile, "give "); - printGEQ(&(GEQs[new_eqn])); - fprintf(outputFile, "\n"); - } - assert(GEQs[new_eqn].coef[i] == 0); - } - } - deadEqns[numDead++] = e1; - isDead[e1] = true; - if (DEBUG) - fprintf(outputFile, "Killed %d\n", e1); - } - } - for (e = nGEQs - 1; e >= 0; e--) - if (isDead[e]) { - deleteGEQ(e); - } - } - if (somethingHappened && DBUG) { - fprintf(outputFile, "Result of Partial elimination\n"); - printProblem(); - } -} - - -int Problem:: solveGEQ(int desiredResult) { - int i, j, k, e; - int fv; - int result; - int coupledSubscripts; - int eliminateAgain; - int smoothed = 0; - int triedEliminatingRedundant = 0; - j = 0; - - if (desiredResult != OC_SOLVE_SIMPLIFY) { - nSUBs = 0; - nMemories = 0; - safeVars = 0; - varsOfInterest = 0; - } - -solveGEQstart: - while (1) { - assert(desiredResult == OC_SOLVE_SIMPLIFY || nSUBs == 0); - check_number_GEQs(nGEQs); - - if (DEBUG) { - fprintf(outputFile, "\nSolveGEQ(%d,%d):\n", desiredResult, pleaseNoEqualitiesInSimplifiedProblems); - printProblem(); - fprintf(outputFile, "\n"); - } - -#ifndef NDEBUG - for(e=0;e= 0; e--) { - coef_t a = GEQs[e].coef[1]; - coef_t c = GEQs[e].coef[0]; - /* our equation is ax + c >= 0, or ax >= -c, or c >= -ax */ - if (a == 0) { - if (c < 0) { - if (TRACE) - fprintf(outputFile, "equations have no solution (G)\n"); - return (false); - } - } - else if (a > 0) { - if (a != 1) - c = int_div(c, a); - if (lowerBound < -c || (lowerBound == -c && !isRed(&GEQs[e]))) { - lowerBound = -c; - lColor = GEQs[e].color; - } - } - else { - if (a != -1) - c = int_div(c, -a); - if (upperBound > c || (upperBound == c && !isRed(&GEQs[e]))) { - upperBound = c; - uColor = GEQs[e].color; - } - } - } - if (DEBUG) - fprintf(outputFile, "upper bound = " coef_fmt "\n", upperBound); - if (DEBUG) - fprintf(outputFile, "lower bound = " coef_fmt "\n", lowerBound); - if (lowerBound > upperBound) { - if (TRACE) - fprintf(outputFile, "equations have no solution (H)\n"); - return (false); - } - if (desiredResult == OC_SOLVE_SIMPLIFY) { - nGEQs = 0; - if (safeVars == 1) { - if (lowerBound == upperBound && !uColor && !lColor) { - int e = newEQ(); - assert(e == 0); - EQs[e].coef[0] = -lowerBound; - EQs[e].coef[1] = 1; - EQs[e].color = lColor | uColor; - return (solve(desiredResult)); - } - else { - if (lowerBound > negInfinity) { - int e = newGEQ(); - assert(e == 0); - GEQs[e].coef[0] = -lowerBound; - GEQs[e].coef[1] = 1; - GEQs[e].key = 1; - GEQs[e].color = lColor; - GEQs[e].touched = 0; - } - if (upperBound < posInfinity) { - int e = newGEQ(); - GEQs[e].coef[0] = upperBound; - GEQs[e].coef[1] = -1; - GEQs[e].key = -1; - GEQs[e].color = uColor; - GEQs[e].touched = 0; - } - } - } - else - nVars = 0; - return (true); - } - if (originalProblem != noProblem && !lColor && !uColor && !conservative && lowerBound == upperBound) { - int e = newEQ(); - assert(e == 0); - EQs[e].coef[0] = -lowerBound; - EQs[e].coef[1] = 1; - EQs[e].color = EQ_BLACK; - addingEqualityConstraint(0); - } - return (true); - } - - if (!variablesFreed) { - variablesFreed = 1; - if (desiredResult != OC_SOLVE_SIMPLIFY) - freeEliminations(0); - else - freeEliminations(safeVars); - if (nVars == 1) - continue; - } - - - switch (normalize()) { - case normalize_false: - return (false); - break; - case normalize_coupled: - coupledSubscripts = true; - break; - case normalize_uncoupled: - coupledSubscripts = false; - break; - default: - coupledSubscripts = false; - assert(0 && "impossible case in SolveGEQ"); - } - - - if ((doTrace && desiredResult == OC_SOLVE_SIMPLIFY) || DBUG) { - fprintf(outputFile, "\nafter normalization:\n"); - printProblem(); - fprintf(outputFile, "\n"); - for(e=0;e 0) - return (solve(desiredResult)); - - if (!coupledSubscripts) { - if (safeVars == 0) - nGEQs = 0; - else - for (e = nGEQs - 1; e >= 0; e--) - if (GEQs[e].key > safeVars || -safeVars > GEQs[e].key) - deleteGEQ(e); - nVars = safeVars; - return (true); - } - - if (desiredResult != OC_SOLVE_SIMPLIFY) - fv = 0; - else - fv = safeVars; - - if (nVars == 0 || nGEQs == 0) { - nGEQs = 0; - if (desiredResult == OC_SOLVE_SIMPLIFY) - nVars = safeVars; - return (true); - } - if (desiredResult == OC_SOLVE_SIMPLIFY && nVars == safeVars) { - return (true); - } - - - if (nGEQs+6 > maxGEQs || nGEQs > 2 * nVars * nVars + 4 * nVars + 10) { - if (TRACE) - fprintf(outputFile, "TOO MANY EQUATIONS; %d equations, %d variables, ELIMINATING REDUNDANT ONES\n", nGEQs, nVars); - if (!quickKill(0,true)) - return 0; - if (nEQs > 0) - return (solve(desiredResult)); - if (TRACE) - fprintf(outputFile, "END ELIMINATION OF REDUNDANT EQUATIONS\n"); - if (DBUG) printProblem(); - } - - - { - int darkConstraints, darkShadowFeasible, unit, parallelLB; - coef_t parallelSplinters, disjointSplinters, lbSplinters, ubSplinters, splinters; - coef_t bestScore, score; - int bestVar; - int exact; - int Ue,Le; - - if (desiredResult != OC_SOLVE_SIMPLIFY) fv = 0; - else fv = safeVars; - - if (DEBUG) { - fprintf(outputFile,"Considering elimination possibilities[ \n"); - printProblem(); - } - - analyzeGEQstart: - try { - bestScore = posInfinity; - bestVar = -1; - for (i = nVars; i != fv; i--) { - analyzeElimination(i, darkConstraints, darkShadowFeasible, unit, parallelSplinters, disjointSplinters, lbSplinters, ubSplinters, parallelLB); - - score = min(min(parallelSplinters,disjointSplinters), - min(lbSplinters,ubSplinters)); - exact = score == 1; - score = 10000*(score-1) + darkConstraints; - if (score >= posInfinity) // too big the score - score = posInfinity - 1; - score -= 3*unit; - - if (score < bestScore) { - bestScore = score; - bestVar = i; - if (i > 4 && score < nGEQs) break; - } - } - assert(bestVar>=0); - exact = bestScore < 10000; - i = bestVar; - assert(i<=nVars); - analyzeElimination(i, darkConstraints, darkShadowFeasible, unit, parallelSplinters, disjointSplinters, lbSplinters, ubSplinters, parallelLB); - if (DEBUG) { - fprintf(outputFile,"] Choose to eliminate %s \n",variable(i)); - } - splinters = lbSplinters; - if (splinters <= parallelSplinters) - parallelSplinters = posInfinity; - else splinters = parallelSplinters; - if (disjointSplinters == 1) splinters = 1; - exact = splinters == 1; - if (inApproximateMode) exact = 1; - } - catch (std::overflow_error) { - int result = quickKill(0, true); - if (result == 0) - return 0; - else if (result == 1) - return true; - else { - if (nEQs > 0) - return (solve(desiredResult)); - triedEliminatingRedundant = 1; - goto analyzeGEQstart; - } - } - - if (!triedEliminatingRedundant && darkConstraints > maxGEQs) { - if (TRACE) - fprintf(outputFile, "Elimination will create TOO MANY EQUATIONS; %d equations, %d variables, %d new constraints, ELIMINATING REDUNDANT ONES\n", nGEQs, nVars,darkConstraints); - if (!quickKill(0)) - return 0; - if (nEQs > 0) - return (solve(desiredResult)); - if (TRACE) - fprintf(outputFile, "END ELIMINATION OF REDUNDANT EQUATIONS\n"); - if (DBUG) printProblem(); - - triedEliminatingRedundant = 1; - eliminateAgain = 1; - continue; - } - - if (!exact && !triedEliminatingRedundant && - safeVars > 0 && desiredResult == OC_SOLVE_SIMPLIFY) { - if (TRACE) - fprintf(outputFile, "Trying to produce exact elimination by finding redundant constraints [\n"); - if (!quickKill(1)) return 0; - if (TRACE) - fprintf(outputFile, "]\n"); - triedEliminatingRedundant = 1; - eliminateAgain = 1; - continue; - } - triedEliminatingRedundant = 0; - - if (desiredResult == OC_SOLVE_SIMPLIFY && !exact) { - partialElimination(); - switch (normalize()) { - case normalize_false: - return (false); - break; - case normalize_coupled: - case normalize_uncoupled: - break; - } - if (nEQs) return solveEQ(); - if (DBUG) fprintf(outputFile,"Stopping short due to non-exact elimination\n"); - return (true); - } - - if ( desiredResult == OC_SOLVE_SIMPLIFY && darkConstraints > maxGEQs) { - if (DBUG) fprintf(outputFile,"Stopping short due to overflow of GEQs: %d\n", darkConstraints); - return (true); - } - - if ((doTrace && desiredResult == OC_SOLVE_SIMPLIFY) || DBUG) { - fprintf(outputFile, "going to eliminate %s, (%d)\n", variable(i), i); - if (DEBUG) - printProblem(); - fprintf(outputFile, "score = " coef_fmt "/" coef_fmt "\n", bestScore,splinters); - } - - if (!exact && desiredResult == OC_SOLVE_SIMPLIFY && parallelSplinters == splinters) { - return parallelSplinter(parallelLB, parallelSplinters, desiredResult); - } - - // smoothed = 0; // what a bug!!! -- by chun 6/10/2008 - - if (i != nVars) { - j = nVars; - swapVars(i,j); - - i = j; - } - else if (DEBUG) { - printVars(); - fprintf(outputFile, "No swap needed before eliminating %s(%d/%d)\n",variable(i),i,nVars); - for(j=1;j<=i;j++) fprintf(outputFile,"var #%d = %s(%x)\n",j,variable(j),var[j]); - printProblem(); - } - nVars--; - - if (exact) { - if (nVars == 1) { - coef_t upperBound = posInfinity; - coef_t lowerBound = negInfinity; - int ub_color = 0; - int lb_color = 0; - coef_t constantTerm, coefficient; - int topEqn = nGEQs - 1; - coef_t Lc; - for (Le = topEqn; Le >= 0; Le--) - if ((Lc = GEQs[Le].coef[i]) == 0) { - if (GEQs[Le].coef[1] == 1) { - constantTerm = -GEQs[Le].coef[0]; - if (constantTerm > lowerBound || (constantTerm == lowerBound && !isRed(&GEQs[Le]))) { - lowerBound = constantTerm; - lb_color = GEQs[Le].color; - } - if (DEBUG) { - if (GEQs[Le].color == EQ_BLACK) - fprintf(outputFile, " :::=> %s >= " coef_fmt "\n", variable(1), constantTerm); - else - fprintf(outputFile, " :::=> [%s >= " coef_fmt "]\n", variable(1), constantTerm); - } - } - else { - constantTerm = GEQs[Le].coef[0]; - if (constantTerm < upperBound || (constantTerm == upperBound && !isRed(&GEQs[Le]))) { - upperBound = constantTerm; - ub_color = GEQs[Le].color; - } - if (DEBUG) { - if (GEQs[Le].color == EQ_BLACK) - fprintf(outputFile, " :::=> %s <= " coef_fmt "\n", variable(1), constantTerm); - else - fprintf(outputFile, " :::=> [%s <= " coef_fmt "]\n", variable(1), constantTerm); - } - } - } - else if (Lc > 0) { - for (Ue = topEqn; Ue >= 0; Ue--) - if (GEQs[Ue].coef[i] < 0) { - if (GEQs[Le].key != -GEQs[Ue].key) { - coef_t Uc = -GEQs[Ue].coef[i]; - coefficient = check_mul(GEQs[Ue].coef[1], Lc) + check_mul(GEQs[Le].coef[1], Uc); - constantTerm = check_mul(GEQs[Ue].coef[0], Lc) + check_mul(GEQs[Le].coef[0], Uc); - if (DEBUG) { - printGEQextra(&(GEQs[Ue])); - fprintf(outputFile, "\n"); - printGEQextra(&(GEQs[Le])); - fprintf(outputFile, "\n"); - } - if (coefficient > 0) { - constantTerm = -(int_div(constantTerm, coefficient)); - /* assert(black == 0) */ - if (constantTerm > lowerBound || - (constantTerm == lowerBound && - (desiredResult != OC_SOLVE_SIMPLIFY || (GEQs[Ue].color == EQ_BLACK && GEQs[Le].color == EQ_BLACK)))) { - lowerBound = constantTerm; - lb_color = GEQs[Ue].color || GEQs[Le].color; - } - if (DEBUG) { - if (GEQs[Ue].color || GEQs[Le].color) - fprintf(outputFile, " ::=> [%s >= " coef_fmt "]\n", variable(1), constantTerm); - else - fprintf(outputFile, " ::=> %s >= " coef_fmt "\n", variable(1), constantTerm); - } - } - else if (coefficient < 0) { - constantTerm = (int_div(constantTerm, -coefficient)); - if (constantTerm < upperBound || - (constantTerm == upperBound && GEQs[Ue].color == EQ_BLACK && GEQs[Le].color == EQ_BLACK)) { - upperBound = constantTerm; - ub_color = GEQs[Ue].color || GEQs[Le].color; - } - if (DEBUG) { - if (GEQs[Ue].color || GEQs[Le].color) - fprintf(outputFile, " ::=> [%s <= " coef_fmt "]\n", variable(1), constantTerm); - else - fprintf(outputFile, " ::=> %s <= " coef_fmt "\n", variable(1), constantTerm); - } - } - } - } - } - nGEQs = 0; - if (DEBUG) - fprintf(outputFile, " therefore, %c" coef_fmt " <= %c%s%c <= " coef_fmt "%c\n", lb_color ? '[' : ' ', lowerBound, (lb_color && !ub_color) ? ']' : ' ', variable(1), (!lb_color && ub_color) ? '[' : ' ', upperBound, ub_color ? ']' : ' '); - if (lowerBound > upperBound) - return (false); - - if (upperBound == lowerBound) { - int e = newEQ(); - assert(e == 0); - EQs[e].coef[1] = -1; - EQs[e].coef[0] = upperBound; - EQs[e].color = ub_color | lb_color; - addingEqualityConstraint(0); - } - else if (safeVars == 1) { - if (upperBound != posInfinity) { - int e = newGEQ(); - assert(e == 0); - GEQs[e].coef[1] = -1; - GEQs[e].coef[0] = upperBound; - GEQs[e].color = ub_color; - GEQs[e].key = -1; - GEQs[e].touched = 0; - } - if (lowerBound != negInfinity) { - int e = newGEQ(); - GEQs[e].coef[1] = 1; - GEQs[e].coef[0] = -lowerBound; - GEQs[e].color = lb_color; - GEQs[e].key = 1; - GEQs[e].touched = 0; - } - } - if (safeVars == 0) - nVars = 0; - return (true); - } - eliminateAgain = 1; - - { - int deadEqns[maxDead]; - int numDead = 0; - int topEqn = nGEQs - 1; - int lowerBoundCount = 0; - for (Le = topEqn; Le >= 0; Le--) - if (GEQs[Le].coef[i] > 0) - lowerBoundCount++; - if (DEBUG) - fprintf(outputFile, "lower bound count = %d\n", lowerBoundCount); - if (lowerBoundCount == 0) { - if (desiredResult != OC_SOLVE_SIMPLIFY) fv = 0; - else fv = safeVars; - nVars++; - freeEliminations(fv); - continue; - } - for (Le = topEqn; Le >= 0; Le--) - if (GEQs[Le].coef[i] > 0) { - coef_t Lc = GEQs[Le].coef[i]; - for (Ue = topEqn; Ue >= 0; Ue--) - if (GEQs[Ue].coef[i] < 0) { - if (GEQs[Le].key != -GEQs[Ue].key) { - coef_t Uc = -GEQs[Ue].coef[i]; - int e2; - if (numDead == 0) { - /*( Big kludge warning ) */ - /* this code is still using location nVars+1 */ - /* but newGEQ, if it reallocates, only copies*/ - /* locations up to nVars. This fixes that. */ - nVars++; - e2 = newGEQ(); - nVars--; - } - else { - e2 = deadEqns[--numDead]; - } - if (DEBUG) - fprintf(outputFile, "Le = %d, Ue = %d, gen = %d\n", Le, Ue, e2); - if (DEBUG) { - printGEQextra(&(GEQs[Le])); - fprintf(outputFile, "\n"); - printGEQextra(&(GEQs[Ue])); - fprintf(outputFile, "\n"); - } - eliminateAgain = 0; - coef_t g = gcd(Lc,Uc); - coef_t Lc_over_g = Lc/g; - coef_t Uc_over_g = Uc/g; - - for (k = nVars; k >= 0; k--) - GEQs[e2].coef[k] = - check_mul(GEQs[Ue].coef[k], Lc_over_g) + check_mul(GEQs[Le].coef[k], Uc_over_g); - - GEQs[e2].coef[nVars + 1] = 0; - GEQs[e2].touched = true; - GEQs[e2].color = GEQs[Ue].color | GEQs[Le].color; - - if (DEBUG) { - printGEQ(&(GEQs[e2])); - fprintf(outputFile, "\n"); - } - } - if (lowerBoundCount == 1) { - deadEqns[numDead++] = Ue; - if (DEBUG) - fprintf(outputFile, "Killed %d\n", Ue); - } - } - lowerBoundCount--; - deadEqns[numDead++] = Le; - if (DEBUG) - fprintf(outputFile, "Killed %d\n", Le); - } - - { - int isDead[maxmaxGEQs]; - for (e = nGEQs - 1; e >= 0; e--) - isDead[e] = false; - while (numDead > 0) { - e = deadEqns[--numDead]; - isDead[e] = true; - } - for (e = nGEQs - 1; e >= 0; e--) - if (isDead[e]) { - nVars++; - deleteGEQ(e); - nVars--; - } - } - continue; - } - } - else { - Problem *rS, *iS; - - rS = new Problem; - iS = new Problem; - - iS->nVars = rS->nVars = nVars; // do this immed.; in case of reallocation, we - // need to know how much to copy - rS->get_var_name = get_var_name; - rS->getVarNameArgs = getVarNameArgs; - iS->get_var_name = get_var_name; - iS->getVarNameArgs = getVarNameArgs; - - for (e = 0; e < nGEQs; e++) - if (GEQs[e].coef[i] == 0) { - int re2 = rS->newGEQ(); - int ie2 = iS->newGEQ(); - eqnncpy(&(rS->GEQs[re2]), &GEQs[e], nVars); - eqnncpy(&(iS->GEQs[ie2]), &GEQs[e], nVars); - if (DEBUG) { - int t; - fprintf(outputFile, "Copying (%d, " coef_fmt "): ", i, GEQs[e].coef[i]); - printGEQextra(&GEQs[e]); - fprintf(outputFile, "\n"); - for (t = 0; t <= nVars + 1; t++) - fprintf(outputFile, coef_fmt " ", GEQs[e].coef[t]); - fprintf(outputFile, "\n"); - } - } - for (Le = nGEQs - 1; Le >= 0; Le--) - if (GEQs[Le].coef[i] > 0) { - coef_t Lc = GEQs[Le].coef[i]; - for (Ue = nGEQs - 1; Ue >= 0; Ue--) - if (GEQs[Ue].coef[i] < 0) - if (GEQs[Le].key != -GEQs[Ue].key) { - coef_t Uc = -GEQs[Ue].coef[i]; - coef_t g = gcd(Lc,Uc); - coef_t Lc_over_g = Lc/g; - coef_t Uc_over_g = Uc/g; - int re2 = rS->newGEQ(); - int ie2 = iS->newGEQ(); - rS->GEQs[re2].touched = iS->GEQs[ie2].touched = true; - if (DEBUG) { - fprintf(outputFile, "---\n"); - fprintf(outputFile, "Le(Lc) = %d(" coef_fmt "), Ue(Uc) = %d(" coef_fmt "), gen = %d\n", Le, Lc, Ue, Uc, ie2); - printGEQextra(&GEQs[Le]); - fprintf(outputFile, "\n"); - printGEQextra(&GEQs[Ue]); - fprintf(outputFile, "\n"); - } - - if (Uc == Lc) { - for (k = nVars; k >= 0; k--) - iS->GEQs[ie2].coef[k] = rS->GEQs[re2].coef[k] = - GEQs[Ue].coef[k] + GEQs[Le].coef[k]; - iS->GEQs[ie2].coef[0] -= (Uc - 1); - } - else { - for (k = nVars; k >= 0; k--) - iS->GEQs[ie2].coef[k] = rS->GEQs[re2].coef[k] = - check_mul(GEQs[Ue].coef[k], Lc_over_g) + check_mul(GEQs[Le].coef[k], Uc_over_g); - iS->GEQs[ie2].coef[0] -= check_mul(Uc_over_g-1, Lc_over_g-1); - } - - iS->GEQs[ie2].color = rS->GEQs[re2].color - = GEQs[Ue].color || GEQs[Le].color; - - if (DEBUG) { - printGEQ(&(rS->GEQs[re2])); - fprintf(outputFile, "\n"); - } - // ie2 = iS->newGEQ(); - // re2 = rS->newGEQ(); - } - - } - iS->variablesInitialized = rS->variablesInitialized = 1; - iS->nEQs = rS->nEQs = 0; - assert(desiredResult != OC_SOLVE_SIMPLIFY); - assert(nSUBs == 0); - iS->nSUBs = rS->nSUBs = nSUBs; - iS->safeVars = rS->safeVars = safeVars; - int t; - for (t = nVars; t >= 0; t--) - rS->var[t] = var[t]; - for (t = nVars; t >= 0; t--) - iS->var[t] = var[t]; - nVars++; - if (desiredResult != true) { - int t = trace; - if (TRACE) - fprintf(outputFile, "\nreal solution(%d):\n", depth); - depth++; - trace = 0; - if (originalProblem == noProblem) { - originalProblem = this; - result = rS->solveGEQ(false); - originalProblem = noProblem; - } - else - result = rS->solveGEQ(false); - trace = t; - depth--; - if (result == false) { - delete rS; - delete iS; - return (result); - } - - if (nEQs > 0) { - /* An equality constraint must have been found */ - delete rS; - delete iS; - return (solve(desiredResult)); - } - } - if (desiredResult != false) { - if (darkShadowFeasible) { - if (TRACE) - fprintf(outputFile, "\ninteger solution(%d):\n", depth); - depth++; - conservative++; - result = iS->solveGEQ(desiredResult); - conservative--; - depth--; - if (result != false) { - delete rS; - delete iS; - return (result); - } - } - if (TRACE) - fprintf(outputFile, "have to do exact analysis\n"); - - { - coef_t worstLowerBoundConstant=1; - int lowerBounds = 0; - int lowerBound[maxmaxGEQs]; - int smallest; - int t; - conservative++; - for (e = 0; e < nGEQs; e++) - if (GEQs[e].coef[i] < -1) { - set_max(worstLowerBoundConstant, - -GEQs[e].coef[i]); - } - else if (GEQs[e].coef[i] > 1) - lowerBound[lowerBounds++] = e; - /* sort array */ - for (j = 0; j < lowerBounds; j++) { - smallest = j; - for (k = j + 1; k < lowerBounds; k++) - if (GEQs[lowerBound[smallest]].coef[i] > GEQs[lowerBound[k]].coef[i]) - smallest = k; - t = lowerBound[smallest]; - lowerBound[smallest] = lowerBound[j]; - lowerBound[j] = t; - } - if (DEBUG) { - fprintf(outputFile, "lower bound coeeficients = "); - for (j = 0; j < lowerBounds; j++) - fprintf(outputFile, " " coef_fmt, GEQs[lowerBound[j]].coef[i]); - fprintf(outputFile, "\n"); - } - - - for (j = 0; j < lowerBounds; j++) { - coef_t maxIncr; - coef_t c; - e = lowerBound[j]; - maxIncr = (check_mul(GEQs[e].coef[i]-1, worstLowerBoundConstant-1) - 1) / worstLowerBoundConstant; - - /* maxIncr += 2; */ - if ((doTrace && desiredResult == OC_SOLVE_SIMPLIFY) || DBUG) { - fprintf(outputFile, "for equation "); - printGEQ(&GEQs[e]); - fprintf(outputFile, "\ntry decrements from 0 to " coef_fmt "\n", maxIncr); - printProblem(); - } - if (maxIncr > 50) { - if (!smoothed && smoothWeirdEquations()) { - conservative--; - delete rS; - delete iS; - smoothed = 1; - goto solveGEQstart; - } - } - int neweq = newEQ(); - assert(neweq == 0); - eqnncpy(&EQs[neweq], &GEQs[e], nVars); - /* - * if (GEQs[e].color) fprintf(outputFile,"warning: adding black equality constraint - * based on red inequality\n"); - */ - EQs[neweq].color = EQ_BLACK; - eqnnzero(&GEQs[e], nVars); - GEQs[e].touched = true; - for (c = maxIncr; c >= 0; c--) { - if (DBUG) - fprintf(outputFile, "trying next decrement of " coef_fmt "\n", maxIncr - c); - if (DBUG) - printProblem(); - *rS = *this; - if (DEBUG) - rS->printProblem(); - result = rS->solve(desiredResult); - if (result == true) { - delete rS; - delete iS; - conservative--; - return (true); - } - EQs[0].coef[0]--; - } - if (j + 1 < lowerBounds) { - nEQs = 0; - eqnncpy(&GEQs[e], &EQs[0], nVars); - GEQs[e].touched = 1; - GEQs[e].color = EQ_BLACK; - *rS = *this; - if (DEBUG) - fprintf(outputFile, "exhausted lower bound, checking if still feasible "); - result = rS->solve(false); - if (result == false) - break; - } - } - if ((doTrace && desiredResult == OC_SOLVE_SIMPLIFY) || DBUG) - fprintf(outputFile, "fall-off the end\n"); - delete rS; - delete iS; - - conservative--; - return (false); - } - } - delete rS; - delete iS; - } - return (OC_SOLVE_UNKNOWN); - } - } - while (eliminateAgain); - } -} - - -int Problem::parallelSplinter(int e, int diff, int desiredResult) { - Problem *tmpProblem; - int i; - if (DBUG) { - fprintf(outputFile, "Using parallel splintering\n"); - printProblem(); - } - tmpProblem = new Problem; - int neweq = newEQ(); - assert(neweq == 0); - eqnncpy(&EQs[0], &GEQs[e], nVars); - for (i = 0; i <= diff; i++) { - *tmpProblem = * this; - tmpProblem->isTemporary = true; - if (DBUG) { - fprintf(outputFile, "Splinter # %i\n", i); - printProblem(); - } - if (tmpProblem->solve(desiredResult)) { - delete tmpProblem; - return true; - } - EQs[0].coef[0]--; - } - delete tmpProblem; - return false; -} - - -int Problem::verifyProblem() { - int result; - int e; - int areRed; - check(); - Problem tmpProblem(*this); - tmpProblem.varsOfInterest = 0; - tmpProblem.safeVars = 0; - tmpProblem.nSUBs = 0; - tmpProblem.nMemories = 0; - tmpProblem.isTemporary = true; - areRed = 0; - if (mayBeRed) { - for(e=0; e fv; i--) { - for (e = nGEQs - 1; e >= 0; e--) - if (GEQs[e].coef[i]) - break; - if (e < 0) - e2 = e; - else if (GEQs[e].coef[i] > 0) { - for (e2 = e - 1; e2 >= 0; e2--) - if (GEQs[e2].coef[i] < 0) - break; - } - else { - for (e2 = e - 1; e2 >= 0; e2--) - if (GEQs[e2].coef[i] > 0) - break; - } - if (e2 < 0) { - int e3; - for (e3 = nSUBs - 1; e3 >= 0; e3--) - if (SUBs[e3].coef[i]) - break; - if (e3 >= 0) - continue; - for (e3 = nEQs - 1; e3 >= 0; e3--) - if (EQs[e3].coef[i]) - break; - if (e3 >= 0) - continue; - if (DBUG) - fprintf(outputFile, "a free elimination of %s (%d)\n", variable(i),e); - if (e >= 0) { - deleteGEQ(e); - for (e--; e >= 0; e--) - if (GEQs[e].coef[i]) { - deleteGEQ(e); - } - tryAgain = (i < nVars); - } - deleteVariable(i); - } - } - } - - if (DEBUG) { - fprintf(outputFile, "\nafter free eliminations:\n"); - printProblem(); - fprintf(outputFile, "\n"); - } -} - - -void Problem::freeRedEliminations() { - int tryAgain = 1; - int i, e, e2; - int isRedVar[maxVars]; - int isDeadVar[maxVars]; - int isDeadGEQ[maxmaxGEQs]; - for (i = nVars; i > 0; i--) { - isRedVar[i] = 0; - isDeadVar[i] = 0; - } - for (e = nGEQs - 1; e >= 0; e--) { - isDeadGEQ[e] = 0; - if (GEQs[e].color) - for (i = nVars; i > 0; i--) - if (GEQs[e].coef[i] != 0) - isRedVar[i] = 1; - } - - while (tryAgain) { - tryAgain = 0; - for (i = nVars; i > 0; i--) - if (!isRedVar[i] && !isDeadVar[i]) { - for (e = nGEQs - 1; e >= 0; e--) - if (!isDeadGEQ[e] && GEQs[e].coef[i]) - break; - if (e < 0) - e2 = e; - else if (GEQs[e].coef[i] > 0) { - for (e2 = e - 1; e2 >= 0; e2--) - if (!isDeadGEQ[e2] && GEQs[e2].coef[i] < 0) - break; - } - else { - for (e2 = e - 1; e2 >= 0; e2--) - if (!isDeadGEQ[e2] && GEQs[e2].coef[i] > 0) - break; - } - if (e2 < 0) { - int e3; - for (e3 = nSUBs - 1; e3 >= 0; e3--) - if (SUBs[e3].coef[i]) - break; - if (e3 >= 0) - continue; - for (e3 = nEQs - 1; e3 >= 0; e3--) - if (EQs[e3].coef[i]) - break; - if (e3 >= 0) - continue; - if (DBUG) - fprintf(outputFile, "a free red elimination of %s\n", variable(i)); - for (; e >= 0; e--) - if (GEQs[e].coef[i]) - isDeadGEQ[e] = 1; - tryAgain = 1; - isDeadVar[i] = 1; - } - } - } - - for (e = nGEQs - 1; e >= 0; e--) - if (isDeadGEQ[e]) - deleteGEQ(e); - - for (i = nVars; i > safeVars; i--) - if (isDeadVar[i]) - deleteVariable(i); - - - if (DEBUG) { - fprintf(outputFile, "\nafter free red eliminations:\n"); - printProblem(); - fprintf(outputFile, "\n"); - } -} - -} // namespace diff --git a/omega/omega_lib/src/omega_core/oc_util.cc b/omega/omega_lib/src/omega_core/oc_util.cc deleted file mode 100644 index a7d21be..0000000 --- a/omega/omega_lib/src/omega_core/oc_util.cc +++ /dev/null @@ -1,327 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 the Omega Project Team - Copyright (C) 2005-2011 Chun Chen - All Rights Reserved. - - Purpose: - - Notes: - - History: -*****************************************************************************/ - -#include -#include - -namespace omega { - -void Problem:: problem_merge(Problem &p2) { - int newLocation[maxVars]; - int i,e2; - - resurrectSubs(); - p2.resurrectSubs(); - setExternals(); - p2.setExternals(); - - assert(safeVars == p2.safeVars); - if(DBUG) { - fprintf(outputFile,"Merging:\n"); - printProblem(); - fprintf(outputFile,"and\n"); - p2.printProblem(); - } - for(i=1; i<= p2.safeVars; i++) { - assert(p2.var[i] > 0) ; - newLocation[i] = forwardingAddress[p2.var[i]]; - } - for(; i<= p2.nVars; i++) { - int j = ++(nVars); - newLocation[i] = j; - zeroVariable(j); - var[j] = -1; - } - newLocation[0] = 0; - - for (e2 = p2.nEQs - 1; e2 >= 0; e2--) { - int e1 = newEQ(); - eqnnzero(&(EQs[e1]), nVars); - for(i=0;i<=p2.nVars;i++) - EQs[e1].coef[newLocation[i]] = p2.EQs[e2].coef[i]; - } - for (e2 = p2.nGEQs - 1; e2 >= 0; e2--) { - int e1 = newGEQ(); - eqnnzero(&(GEQs[e1]), nVars); - GEQs[e1].touched = 1; - for(i=0;i<=p2.nVars;i++) - GEQs[e1].coef[newLocation[i]] = p2.GEQs[e2].coef[i]; - } - int w = -1; - for (i = 1; i <= nVars; i++) - if (var[i] < 0) var[i] = w--; - if(DBUG) { - fprintf(outputFile,"to get:\n"); - printProblem(); - } -} - - - -void Problem::chainUnprotect() { - int i, e; - int unprotect[maxVars]; - int any = 0; - for (i = 1; i <= safeVars; i++) { - unprotect[i] = (var[i] < 0); - for (e = nSUBs - 1; e >= 0; e--) - if (SUBs[e].coef[i]) - unprotect[i] = 0; - } - for (i = 1; i <= safeVars; i++) if (unprotect[i]) any=1; - if (!any) return; - - if (DBUG) { - fprintf(outputFile, "Doing chain reaction unprotection\n"); - printProblem(); - for (i = 1; i <= safeVars; i++) - if (unprotect[i]) - fprintf(outputFile, "unprotecting %s\n", variable(i)); - } - for (i = 1; i <= safeVars; i++) - if (unprotect[i]) { - /* wild card */ - if (i < safeVars) { - int j = safeVars; - std::swap(var[i], var[j]); - for (e = nGEQs - 1; e >= 0; e--) { - GEQs[e].touched = 1; - std::swap(GEQs[e].coef[i], GEQs[e].coef[j]); - } - for (e = nEQs - 1; e >= 0; e--) - std::swap(EQs[e].coef[i], EQs[e].coef[j]); - for (e = nSUBs - 1; e >= 0; e--) - std::swap(SUBs[e].coef[i], SUBs[e].coef[j]); - std::swap(unprotect[i], unprotect[j]); - i--; - } - safeVars--; - } - if (DBUG) { - fprintf(outputFile, "After chain reactions\n"); - printProblem(); - } -} - -void Problem::resurrectSubs() { - if (nSUBs > 0 && !pleaseNoEqualitiesInSimplifiedProblems) { - int i, e, n, m,mbr; - mbr = 0; - for (e = nGEQs - 1; e >= 0; e--) if (GEQs[e].color) mbr=1; - for (e = nEQs - 1; e >= 0; e--) if (EQs[e].color) mbr=1; - if (nMemories) mbr = 1; - - assert(!mbr || mayBeRed); - - if (DBUG) { - fprintf(outputFile, "problem reduced, bringing variables back to life\n"); - if(mbr && !mayBeRed) fprintf(outputFile, "Red equations we don't expect\n"); - printProblem(); - } - if (DBUG && nEQs > 0) - fprintf(outputFile,"This is wierd: problem has equalities\n"); - - for (i = 1; i <= safeVars; i++) - if (var[i] < 0) { - /* wild card */ - if (i < safeVars) { - int j = safeVars; - std::swap(var[i], var[j]); - for (e = nGEQs - 1; e >= 0; e--) { - GEQs[e].touched = 1; - std::swap(GEQs[e].coef[i], GEQs[e].coef[j]); - } - for (e = nEQs - 1; e >= 0; e--) - std::swap(EQs[e].coef[i], EQs[e].coef[j]); - for (e = nSUBs - 1; e >= 0; e--) - std::swap(SUBs[e].coef[i], SUBs[e].coef[j]); - i--; - } - safeVars--; - } - - m = nSUBs; - n = nVars; - if (n < safeVars + m) - n = safeVars + m; - for (e = nGEQs - 1; e >= 0; e--) { - if (singleVarGEQ(&GEQs[e])) { - i = abs(GEQs[e].key); - if (i >= safeVars + 1) - GEQs[e].key += (GEQs[e].key > 0 ? m : -m); - } - else { - GEQs[e].touched = true; - GEQs[e].key = 0; - } - } - for (i = nVars; i >= safeVars + 1; i--) { - var[i + m] = var[i]; - for (e = nGEQs - 1; e >= 0; e--) - GEQs[e].coef[i + m] = GEQs[e].coef[i]; - for (e = nEQs - 1; e >= 0; e--) - EQs[e].coef[i + m] = EQs[e].coef[i]; - for (e = nSUBs - 1; e >= 0; e--) - SUBs[e].coef[i + m] = SUBs[e].coef[i]; - } - for (i = safeVars + m; i >= safeVars + 1; i--) { - for (e = nGEQs - 1; e >= 0; e--) GEQs[e].coef[i] = 0; - for (e = nEQs - 1; e >= 0; e--) EQs[e].coef[i] = 0; - for (e = nSUBs - 1; e >= 0; e--) SUBs[e].coef[i] = 0; - } - nVars += m; - safeVars += m; - for (e = nSUBs - 1; e >= 0; e--) - var[safeVars -m + 1 + e] = SUBs[e].key; - for (i = 1; i <= safeVars; i++) - forwardingAddress[var[i]] = i; - if (DBUG) { - fprintf(outputFile,"Ready to wake substitutions\n"); - printProblem(); - } - for (e = nSUBs - 1; e >= 0; e--) { - int neweq = newEQ(); - eqnncpy(&(EQs[neweq]), &(SUBs[e]), nVars); - EQs[neweq].coef[safeVars -m + 1 + e] = -1; - EQs[neweq].color = EQ_BLACK; - if (DBUG) { - fprintf(outputFile, "brought back: "); - printEQ(&EQs[neweq]); - fprintf(outputFile, "\n"); - } - } - nSUBs = 0; - - if (DBUG) { - fprintf(outputFile, "variables brought back to life\n"); - printProblem(); - } - } - - coalesce(); - recallRedMemories(); - cleanoutWildcards(); -} - - -void Problem::reverseProtectedVariables() { - int v1,v2,e,i; - coef_t t; - for (v1 = 1; v1 <= safeVars; v1++) { - v2 = safeVars+1-v1; - if (v2>=v1) break; - for(e=0;esymbolic;i--) - for(e=0;ei;j--) if (EQs[e].coef[j]) break; - if (i==j) { - doElimination(e, i); - isDead[e] = 1; - break; - } - } - - for(e=nEQs-1;e>=0;e--) - if (isDead[e]) { - nEQs--; - if (e < nEQs) eqnncpy(&EQs[e], &EQs[nEQs], nVars); - } - - for (i = 1; i <= safeVars; i++) - forwardingAddress[var[i]] = i; - for (i = 0; i < nSUBs; i++) - forwardingAddress[SUBs[i].key] = -i - 1; -} - - -coef_t Problem::checkSum() const { - coef_t cs; - int e; - cs = 0; - for(e=0;e= 0; e--) - if (isDead[e]) { - deleteGEQ(e); - } - if (DEBUG && foundSomething) { - fprintf(outputFile, "Coalesced GEQs into %d EQ's:\n", foundSomething); - printProblem(); - } -} - -} // namespace diff --git a/omega/omega_lib/src/pres_beaut.cc b/omega/omega_lib/src/pres_beaut.cc deleted file mode 100644 index c23962a..0000000 --- a/omega/omega_lib/src/pres_beaut.cc +++ /dev/null @@ -1,235 +0,0 @@ -#include -#include -#include -#include - -///////////////////////// -// // -// Beautify functions // -// // -///////////////////////// - - -namespace omega { - -// -// f & true = f -// f | false = f -// f1 & f2 & ... & fn = Conjunct(f1,f2,...,fn) -// - -void Rel_Body::beautify() { - assert(children().length()==1); - set_parent(NULL,this); - - skip_finalization_check++; - formula()->beautify(); - Formula *child = formula(); - if(child->node_type()==Op_And && child->children().empty()) { - remove_child(child); - delete child; - add_conjunct(); - } - skip_finalization_check--; - - if(pres_debug) { - fprintf(DebugFile, "\n=== Beautified TREE ===\n"); - prefix_print(DebugFile); - } - assert(children().length()==1); -} - -void Formula::beautify() { - // copy list of children, as they may be removed as we work - List kiddies = myChildren; - - for(List_Iterator c(kiddies); c; c++) - (*c)->beautify(); -} - -void F_Exists::beautify() { - Formula::beautify(); - assert(children().length()==1); - - if(myLocals.empty()) { - // exists( : ***) - parent().remove_child(this); - parent().add_child(children().remove_front()); - delete this; - } - else if (children()[1]->node_type() == Op_And && children()[1]->children().empty()) { - // exists(*** : TRUE) --chun 6/4/2008 - parent().remove_child(this); - parent().add_child(children().remove_front()); - delete this; - } - else { - Formula *child = children().front(); - if(child->node_type() == Op_Conjunct || child->node_type() == Op_Exists) { - child->push_exists(myLocals); - parent().remove_child(this); - parent().add_child(child); - children().remove_front(); - delete this; - } - } -} - -void F_Forall::beautify() { - Formula::beautify(); - assert(children().length()==1); - - if(myLocals.empty()) { - parent().remove_child(this); - parent().add_child(children().remove_front()); - delete this; - } -} - - -// -// The Pix-free versions of beautify for And and Or are a bit -// less efficient than the previous code, as we keep moving -// things from one list to another, but they do not depend on -// knowing that a Pix is valid after the list is updated, and -// they can always be optimized later if necessary. -// - -void F_Or::beautify() { - Formula::beautify(); - - List uglies, beauties; - uglies.join(children()); assert(children().empty()); -#if ! defined NDEBUG - foreach(c,Formula*,uglies,c->set_parent(0)); -#endif - - while(!uglies.empty()) { - Formula *f = uglies.remove_front(); - if(f->node_type()==Op_And && f->children().empty() ) { - // smth | true = true - foreach(c,Formula*,uglies,delete c); - foreach(c,Formula*,beauties,delete c); - parent().remove_child(this); - parent().add_and(); - delete f; - delete this; - return; - } - else if(f->node_type()==Op_Or) { - // OR(f[1-m], OR(c[1-n])) = OR(f[1-m], c[1-n]) -#if ! defined NDEBUG - foreach(c,Formula*,f->children(),c->set_parent(0)); -#endif - uglies.join(f->children()); - delete f; - } - else - beauties.prepend(f); - } - - if(beauties.length()==1) { - beauties.front()->set_parent(&parent()); - parent().remove_child(this); - parent().add_child(beauties.remove_front()); - delete this; - } - else { - foreach(c,Formula*,beauties,(c->set_parent(this), - c->set_relation(relation()))); - assert(children().empty()); - children().join(beauties); - } -} - -void F_And::beautify() { - Formula::beautify(); - - Conjunct *conj = NULL; - - List uglies, beauties; - uglies.join(children()); assert(children().empty()); -#if ! defined NDEBUG - foreach(c,Formula*,uglies,c->set_parent(0)); -#endif - - while(!uglies.empty()) { - Formula *f = uglies.remove_front(); - if (f->node_type() == Op_Conjunct) { - if(conj==NULL) - conj = f->really_conjunct(); - else { - Conjunct *conj1 = merge_conjs(conj, f->really_conjunct(), MERGE_REGULAR); - delete f; - delete conj; - conj = conj1; - } - } - else if(f->node_type()==Op_Or && f->children().empty()) { - // smth & false = false - foreach(c,Formula*,uglies,delete c); - foreach(c,Formula*,beauties,delete c); - parent().remove_child(this); - parent().add_or(); - delete f; - delete conj; - delete this; - return; - } - else if(f->node_type()==Op_And) { - // AND(f[1-m], AND(c[1-n])) = AND(f[1-m], c[1-n]) -#if ! defined NDEBUG - foreach(c,Formula*,f->children(),c->set_parent(0)); -#endif - uglies.join(f->children()); - delete f; - } - else - beauties.prepend(f); - } - - if(conj!=NULL) - beauties.prepend(conj); - - if(beauties.length()==1) { - beauties.front()->set_parent(&parent()); - parent().remove_child(this); - parent().add_child(beauties.remove_front()); - delete this; - } - else { - foreach(c,Formula*,beauties,(c->set_parent(this), - c->set_relation(relation()))); - assert(children().empty()); - children().join(beauties); - } -} - -void F_Not::beautify() { - Formula::beautify(); - assert(children().length()==1); - Formula *child = children().front(); - - if(child->node_type()==Op_And && child->children().empty()) { - // Not TRUE = FALSE - parent().remove_child(this); - parent().add_or(); - delete this; - } - else if (child->node_type()==Op_Or && child->children().empty()) { - // Not FALSE = TRUE - parent().remove_child(this); - parent().add_and(); - delete this; - } -} - -void Conjunct::beautify() { - if(is_true()) { - parent().remove_child(this); - parent().add_and(); - delete this; - } -} - -} // namespace diff --git a/omega/omega_lib/src/pres_cnstr.cc b/omega/omega_lib/src/pres_cnstr.cc deleted file mode 100644 index a8ebd15..0000000 --- a/omega/omega_lib/src/pres_cnstr.cc +++ /dev/null @@ -1,450 +0,0 @@ -#include -#include -#include -#include - -namespace omega { - -Constraint_Handle::Constraint_Handle(Conjunct *_c, eqn **_eqns, int _e): - c(_c), eqns(_eqns), e(_e) { -} - -GEQ_Handle::GEQ_Handle(Conjunct *_c, int _e): - Constraint_Handle(_c,&(_c->problem->GEQs),_e) { -} - -bool Constraint_Handle::is_const(Variable_ID v) { - bool is_const=true; - for(Constr_Vars_Iter cvi(*this, false); cvi && is_const; cvi++) - is_const = ((*cvi).coef == 0 || ((*cvi).var == v && (*cvi).coef !=0)); - return is_const; -} - -bool Constraint_Handle::is_const_except_for_global(Variable_ID v){ - bool is_const=true; - for(Constr_Vars_Iter cvi(*this, false); cvi && is_const; cvi++) - if((*cvi).var->kind() != Global_Var) - is_const = ((*cvi).coef == 0 || ((*cvi).var == v && (*cvi).coef !=0)); - return is_const; -} - -bool EQ_Handle::operator==(const Constraint_Handle &that) { - Constraint_Handle &e1=*this; - const Constraint_Handle &e2=that; - int sign = 0; - for(Constr_Vars_Iter cvi(e1, false); cvi; cvi++) { - coef_t c1 = (*cvi).coef; - coef_t c2 = e2.get_coef((*cvi).var); - if (sign == 0) sign = (c1*c2>=0?1:-1); - if (sign*c1 != c2) return false; - } - assert(sign != 0); - { - for(Constr_Vars_Iter cvi(e2, false); cvi; cvi++) { - coef_t c1 = e1.get_coef((*cvi).var); - coef_t c2 = (*cvi).coef; - if (sign*c1 != c2) return false; - } - } - return sign * e1.get_const() == e2.get_const(); -} - -bool GEQ_Handle::operator==(const Constraint_Handle &that) { - Constraint_Handle &e1=*this; - const Constraint_Handle &e2=that; - for(Constr_Vars_Iter cvi(e1, false); cvi; cvi++) { - coef_t c1 = (*cvi).coef; - coef_t c2 = e2.get_coef((*cvi).var); - if (c1 != c2) return false; - } - { - for(Constr_Vars_Iter cvi(e2, false); cvi; cvi++) { - coef_t c1 = e1.get_coef((*cvi).var); - coef_t c2 = (*cvi).coef; - if (c1 != c2) return false; - } - } - return e1.get_const() == e2.get_const(); -} - - - - -void GEQ_Handle::negate() { - assert(! this->relation()->is_simplified()); - int i; - for(i=1; i<=c->problem->nVars; i++) { - (*eqns)[e].coef[i] = -(*eqns)[e].coef[i]; - } - (*eqns)[e].coef[0] = -(*eqns)[e].coef[0]-1; -} - -bool Constraint_Handle::has_wildcards() const { - Constr_Vars_Iter C(*this, true); - if (C.live()) { - assert(C.curr_var()->kind() == Wildcard_Var); - assert(C.curr_coef() != 0); - return 1; - } - return 0; -} - -int Constraint_Handle::max_tuple_pos() const { - int m = 0; - for( Constr_Vars_Iter C(*this, false); C.live() ; C.next()) { - switch (C.curr_var()->kind()) { - case Input_Var: - case Output_Var: { - int pos = C.curr_var()->get_position(); - if (m < pos) m = pos; - break; - } - default: - ; - } - } - return m; -} - -int Constraint_Handle::min_tuple_pos() const { - int m = 0; - for( Constr_Vars_Iter C(*this, false); C.live() ; C.next()) { - switch (C.curr_var()->kind()) { - case Input_Var: - case Output_Var: { - int pos = C.curr_var()->get_position(); - if (m == 0 || m > pos) m = pos; - break; - } - default: - ; - } - } - return m; -} - - -EQ_Handle::EQ_Handle(Conjunct *_c, int _e): Constraint_Handle(_c,&(_c->problem->EQs),_e) { -} - -// -// Update functions. -// -void Constraint_Handle::update_coef(Variable_ID D, coef_t I) { - assert(! this->relation()->is_simplified()); - assert(D != 0); - // The next two assertions are somewhat high-cost. -#if !defined(NDEBUG) - // skip_set_checks++; - assert((D->kind() != Input_Var || D->get_position() <= this->relation()->n_inp())); - assert((D->kind() != Output_Var || D->get_position() <= this->relation()->n_out())); - // skip_set_checks--; -#endif - int col = c->get_column(D); - (*eqns)[e].coef[col] += I; -} - -void Constraint_Handle::update_const(coef_t I) { - assert(! this->relation()->is_simplified()); - (*eqns)[e].coef[0] += I; -} - - -// update a coefficient of a variable that already exists in mappedvars - -void Constraint_Handle::update_coef_during_simplify(Variable_ID D, coef_t I) { - assert(D != 0); - int col = c->get_column(D); - (*eqns)[e].coef[col] += I; -} - -void Constraint_Handle::update_const_during_simplify(coef_t I) { - (*eqns)[e].coef[0] += I; -} - -// -// Get functions. -// - -coef_t Constraint_Handle::get_coef(Variable_ID v) const { - assert(this->relation()->is_simplified()); - assert(v != 0); - int col = c->find_column(v); - if(col == 0) { - return 0; - } - else { - return (*eqns)[e].coef[col]; - } -} - -coef_t Constraint_Handle::get_coef_during_simplify(Variable_ID v) const { - assert(v != 0); - int col = c->find_column(v); - if(col == 0) { - return 0; - } - else { - return (*eqns)[e].coef[col]; - } -} - -coef_t Constraint_Handle::get_const() const { - assert(this->relation()->is_simplified()); - return((*eqns)[e].coef[0]); -} - -coef_t Constraint_Handle::get_const_during_simplify() const { - return((*eqns)[e].coef[0]); -} - -Variable_ID Constraint_Handle::get_local(const Global_Var_ID G) { - return relation()->get_local(G); -} - -Variable_ID Constraint_Handle::get_local(const Global_Var_ID G, Argument_Tuple of) { - return relation()->get_local(G, of); -} - -void Constraint_Handle::finalize() { - c->n_open_constraints--; -} - -void Constraint_Handle::multiply(int multiplier) { - int i; - assert(! this->relation()->is_simplified()); - for(i=1; i<=c->problem->nVars; i++) { - (*eqns)[e].coef[i] = (*eqns)[e].coef[i] * multiplier; - } - (*eqns)[e].coef[0] = (*eqns)[e].coef[0] * multiplier; -} - -Rel_Body *Constraint_Handle::relation() const { - return c->relation(); -} - - -// -// Variables of constraint iterator. -// -Constr_Vars_Iter::Constr_Vars_Iter(const Constraint_Handle &ch, bool _wild_only): eqns(ch.eqns), e(ch.e), prob(ch.c->problem), vars(ch.c->mappedVars), wild_only(_wild_only) { - assert(vars.size() == prob->nVars); - for(current=1; current<=prob->nVars; current++) { - if((*eqns)[e].coef[current]!=0 && - (!wild_only || vars[current]->kind()==Wildcard_Var)) - return; - } -} - -int Constr_Vars_Iter::live() const { - return (current<=prob->nVars); -} - - -void Constr_Vars_Iter::operator++() { this->operator++(0); } - -void Constr_Vars_Iter::operator++(int) { - for(current++ ; current <=prob->nVars; current++) - if((*eqns)[e].coef[current]!=0 && - (!wild_only || vars[current]->kind()==Wildcard_Var)) - return; -} - - -Variable_ID Constr_Vars_Iter::curr_var() const { - assert(current <= prob->nVars); - return vars[current]; -} - -coef_t Constr_Vars_Iter::curr_coef() const { - assert(current <= prob->nVars); - return (*eqns)[e].coef[current]; -} - -Variable_Info Constr_Vars_Iter::operator*() const { - assert(current <= prob->nVars); - return Variable_Info(vars[current],(*eqns)[e].coef[current]); -} - -// -// Constraint iterator. -// -Constraint_Iterator Conjunct::constraints() { - return Constraint_Iterator(this); -} - -Constraint_Iterator::Constraint_Iterator(Conjunct *_c): c(_c), current(0), - last(c->problem->nGEQs-1), eqns(&(c->problem->GEQs)) { - if(!this->live()) (*this)++; // switch to EQ's if no GEQs -} - -int Constraint_Iterator::live() const { - return current <=last; -} - -void Constraint_Iterator::operator++() { - this->operator++(0); -} - -void Constraint_Iterator::operator++(int) { - if(++current > last) - if(eqns == &(c->problem->GEQs)) { // Switch to EQs - eqns = &(c->problem->EQs); - current = 0; - last = c->problem->nEQs-1; - } -} - -Constraint_Handle Constraint_Iterator::operator*() { - assert((c && eqns && current <= last) && "Constraint_Iterator::operator*: bad call"); - return Constraint_Handle(c,eqns,current); -} - -Constraint_Handle Constraint_Iterator::operator*() const { - assert((c && eqns && current <= last) && "Constraint_Iterator::operator*: bad call"); - return Constraint_Handle(c,eqns,current); -} - - -// -// EQ iterator. -// -EQ_Iterator Conjunct::EQs() { - return EQ_Iterator(this); -} - -EQ_Iterator::EQ_Iterator(Conjunct *_c) : c(_c) { - last = c->problem->nEQs-1; - current = 0; -} - -int EQ_Iterator::live() const { - return current <= last; -} - -void EQ_Iterator::operator++() { - this->operator++(0); -} - -void EQ_Iterator::operator++(int) { - current++; -} - -EQ_Handle EQ_Iterator::operator*() { - assert((c && current <= last) && "EQ_Iterator::operator*: bad call"); - return EQ_Handle(c,current); -} - -EQ_Handle EQ_Iterator::operator*() const { - assert((c && current <= last) && "EQ_Iterator::operator*: bad call"); - return EQ_Handle(c,current); -} - - -// -// GEQ iterator. -// -GEQ_Iterator Conjunct::GEQs() { - return GEQ_Iterator(this); -} - -GEQ_Iterator::GEQ_Iterator(Conjunct *_c) : c(_c) { - last = c->problem->nGEQs-1; - current = 0; -} - -int GEQ_Iterator::live() const { - return current <= last; -} - -void GEQ_Iterator::operator++() { - this->operator++(0); -} - -void GEQ_Iterator::operator++(int) { - current++; -} - - -GEQ_Handle GEQ_Iterator::operator*() { - assert((c && current <= last) && "GEQ_Iterator::operator*: bad call"); - return GEQ_Handle(c,current); -} - -GEQ_Handle GEQ_Iterator::operator*() const { - assert((c && current <= last) && "GEQ_Iterator::operator*: bad call"); - return GEQ_Handle(c,current); -} - - -void copy_constraint(Constraint_Handle H, const Constraint_Handle initial) { - // skip_set_checks++; -// assert(H.relation()->n_inp() == initial.relation()->n_inp()); -// assert(H.relation()->n_out() == initial.relation()->n_out()); - - H.update_const_during_simplify(initial.get_const_during_simplify()); - if (H.relation() == initial.relation()) { - for( Constr_Vars_Iter C(initial, false); C.live() ; C.next()) { - assert(C.curr_var()->kind()!= Forall_Var && - C.curr_var()->kind()!= Exists_Var); - if (C.curr_var()->kind()!= Wildcard_Var) - H.update_coef_during_simplify(C.curr_var(), C.curr_coef()); - else - // Must add a new wildcard, - // since they can't be used outside local Conjunct - H.update_coef_during_simplify(H.c->declare(), C.curr_coef()); - } - } - else { - Rel_Body *this_rel = H.relation(); - for( Constr_Vars_Iter C(initial, false); C.live() ; C.next()) { - switch (C.curr_var()->kind()) { - case Forall_Var: - case Exists_Var: - assert(0 && "Can't copy quantified constraints across relations"); - break; - case Wildcard_Var: - // for each wildcard var we see, create a new wildcard - // will lead to lots of wildcards, but Wayne likes it - // that way - { - H.update_coef_during_simplify(H.c->declare(), C.curr_coef()); - break; - } - case Input_Var: //use variable_ID of corresponding position - { - int pos = C.curr_var()->get_position(); - assert(this_rel->n_inp() >= pos); - Variable_ID V = this_rel->input_var(pos); - H.update_coef_during_simplify(V, C.curr_coef()); - break; - } - case Output_Var: //use variable_ID of corresponding position - { - int pos = C.curr_var()->get_position(); - assert(this_rel->n_out() >= pos); - Variable_ID V = this_rel->output_var(pos); - H.update_coef_during_simplify(V, C.curr_coef()); - break; - } - - case Global_Var: // get this Global's Var_ID in this relation - { - Variable_ID V; - Global_Var_ID G = C.curr_var()->get_global_var(); - if (G->arity() == 0) - V = this_rel->get_local(G); - else - V = this_rel->get_local(G,C.curr_var()->function_of()); - H.update_coef_during_simplify(V, C.curr_coef()); - break; - } - default: - assert(0 && "copy_constraint: variable of impossible type"); - } - } - } - // skip_set_checks--; -} - -} // namespace diff --git a/omega/omega_lib/src/pres_col.cc b/omega/omega_lib/src/pres_col.cc deleted file mode 100644 index 1569116..0000000 --- a/omega/omega_lib/src/pres_col.cc +++ /dev/null @@ -1,104 +0,0 @@ -#include -#include -#include - -namespace omega { - -// -// Copy column fr_col of problem fp -// to column to_col of problem tp. -// Displacement for constraints in tp are start_EQ and start_GEQ. -// -void copy_column(Problem *tp, int to_col, - Problem *fp, int fr_col, - int start_EQ, int start_GEQ) { - checkVars(to_col); - assert(start_EQ + fp->nEQs <= tp->allocEQs); - assert(start_GEQ + fp->nGEQs <= tp->allocGEQs); - - int i; - for(i=0; inEQs; i++) { - tp->EQs[i+start_EQ].coef[to_col] = fp->EQs[i].coef[fr_col]; - } - for(i=0; inGEQs; i++) { - tp->GEQs[i+start_GEQ].coef[to_col] = fp->GEQs[i].coef[fr_col]; - } -} - -// -// Zero column to_col of problem tp. -// Displacement for constraints in to_conj are start_EQ and start_GEQ. -// Number of constraints to zero are no_EQ and no_GEQ. -// -void zero_column(Problem *tp, int to_col, - int start_EQ, int start_GEQ, - int no_EQs, int no_GEQs) { - assert(start_EQ + no_EQs <= tp->allocEQs); - assert(start_GEQ + no_GEQs <= tp->allocGEQs); - - int i; - for(i=0; iEQs[i+start_EQ].coef[to_col] = 0; - } - for(i=0; iGEQs[i+start_GEQ].coef[to_col] = 0; - } -} - -// -// return column for D in conjunct -// -int Conjunct::get_column(Variable_ID D) { - int col = find_column(D); - if (col == 0) // if it does not already have a column assigned - col = map_to_column(D); - assert(col > 0); // Not substituted - return col; -} - -// -// Find column in conjunct. -// -int Conjunct::find_column(Variable_ID D) { - assert(D != 0); - int column = mappedVars.index(D); - - // If it has been through the omega core (variablesInitialized), - // and it exists in the problem, check to see if it has been forwarded. - // This will likely only be the case if substitutions have been done; - // that won't arise in user code, only in print_with_subs and the - // Substitutions class. - if (problem->variablesInitialized && column > 0) { - assert(problem->forwardingAddress[column] != 0); - column = problem->forwardingAddress[column]; - } - assert (column <= problem->nVars); - return column; -} - -// -// Create new column in conjunct. -// -int Conjunct::map_to_column(Variable_ID D) { - assert(D != 0); - // This heavy-duty assertion says that if you are trying to use a global - // var's local representative in a relation, that you have first told the - // relation that you are using it here. PUFS requires that we know - // all the function symbols that might be used in a relation. - // If one wanted to be less strict, one could just tell the relation - // that the global variable was being used. - assert(D->kind() != Global_Var || - (relation()->has_local(D->get_global_var(), D->function_of()) - && "Attempt to update global var without a local variable ID")); - - cols_ordered = false; // extremely important - checkVars(problem->nVars+2); - int col = ++problem->nVars; - mappedVars.append(D); - problem->forwardingAddress[col] = col; - problem->var[col] = col; - zero_column(problem, col, 0, 0, problem->nEQs, problem->nGEQs); - return col; -} - -} // namespace diff --git a/omega/omega_lib/src/pres_conj.cc b/omega/omega_lib/src/pres_conj.cc deleted file mode 100644 index f3f458d..0000000 --- a/omega/omega_lib/src/pres_conj.cc +++ /dev/null @@ -1,1460 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 the Omega Project Team - Copyright (C) 2005-2011 Chun Chen - All Rights Reserved. - - Purpose: - class Conjunct. - - Notes: - - History: -*****************************************************************************/ - -#include -#include -#include -#include -#include -#include - -namespace omega { - -int NR_CONJUNCTS, MAX_CONJUNCTS; - -/* - * Make a new wildcard variable, return WC number. - * Should be static to this file, but must be a friend of conjunct. - */ -int new_WC(Conjunct *nc, Problem *) { - Variable_ID wc = nc->declare(); - int wc_no = nc->map_to_column(wc); - return(wc_no); -} - - -const char* get_var_name(unsigned int col, void * void_conj) { -#if defined PRINT_COLUMN_NUMBERS - static char scum[512]; -#endif - Conjunct *c = (Conjunct *) void_conj; - if (col == 0) - return 0; - Variable_ID v = c->mappedVars[col]; - assert(v!=0); -#if defined PRINT_COLUMN_NUMBERS - strcpy(scum, v->char_name()); - sprintf(scum + strlen(scum), "(%d)", col); - return scum; -#endif - return v->char_name(); -} - -void Conjunct::promise_that_ub_solutions_exist(Relation &R) { -#ifndef NDEBUG - Relation verify=Relation(R, this); - assert(verify.is_upper_bound_satisfiable()); -#endif - verified = true; -} - - -int Conjunct::max_ufs_arity_of_set() { - int ma = 0, a; - for (Variable_ID_Iterator v(mappedVars); v; v++) - if ((*v)->kind() == Global_Var && (*v)->function_of() == Set_Tuple - && query_variable_used(*v)) { - a = (*v)->get_global_var()->arity(); - if (a > ma) - ma = a; - } - return ma; -} - - -int Conjunct::max_ufs_arity_of_in() { - int ma = 0, a; - for (Variable_ID_Iterator v(mappedVars); v; v++) - if ((*v)->kind() == Global_Var && (*v)->function_of() == Input_Tuple - && query_variable_used(*v)) { - a = (*v)->get_global_var()->arity(); - if (a > ma) - ma = a; - } - return ma; -} - - -int Conjunct::max_ufs_arity_of_out() { - int ma = 0, a; - for (Variable_ID_Iterator v(mappedVars); v; v++) - if ((*v)->kind() == Global_Var && (*v)->function_of() == Output_Tuple - && query_variable_used(*v)) { - a = (*v)->get_global_var()->arity(); - if (a > ma) - ma = a; - } - return ma; -} - - -bool Conjunct::is_unknown() const { - assert(problem || comp_problem); - return !exact && ((problem && problem->nEQs==0 && problem->nGEQs==0) || - (comp_problem && comp_problem->no_constraints())); -} - - -/* - * Remove black constraints from the problem. - * Make all the remaining red constraints black. - */ -void Conjunct::rm_color_constrs() { - int geqs = 0, eqs = 0; - - possible_leading_0s = -1; - guaranteed_leading_0s = -1; - leading_dir = 0; - - for(int i=0; inGEQs; i++) { - if(problem->GEQs[i].color) { - if(geqs!=i) - eqnncpy(&problem->GEQs[geqs], &problem->GEQs[i], problem->nVars); - problem->GEQs[geqs].color = EQ_BLACK; - geqs++; - } - } - problem->nGEQs = geqs; - - for(int i=0; inEQs; i++) { - if(problem->EQs[i].color) { - if(eqs!=i) - eqnncpy(&problem->EQs[eqs], &problem->EQs[i], problem->nVars); - problem->EQs[eqs].color = EQ_BLACK; - eqs++; - } - } - problem->nEQs = eqs; -} - - - -// -// Conjunct constructors. -// -Conjunct::Conjunct() : - F_Declaration(NULL, NULL), - mappedVars(0), - n_open_constraints(0), - cols_ordered(false), - simplified(false), - verified(false), - guaranteed_leading_0s(-1), - possible_leading_0s(-1), - leading_dir(0), - exact(true), - r_constrs(0) { - NR_CONJUNCTS++; - if (NR_CONJUNCTS>MAX_CONJUNCTS) MAX_CONJUNCTS = NR_CONJUNCTS; - problem = new Problem; - comp_problem = NULL; - problem->get_var_name = get_var_name; - problem->getVarNameArgs = (void *) this; -} - - -Conjunct::Conjunct(Formula *f, Rel_Body *r) : - F_Declaration(f,r), - mappedVars(0), - n_open_constraints(0), - cols_ordered(false), - simplified(false), - verified(false), - guaranteed_leading_0s(-1), - possible_leading_0s(-1), - leading_dir(0), - exact(true), - r_constrs(0) { - NR_CONJUNCTS++; - if (NR_CONJUNCTS>MAX_CONJUNCTS) MAX_CONJUNCTS = NR_CONJUNCTS; - problem = new Problem; - comp_problem = NULL; - problem->get_var_name = get_var_name; - problem->getVarNameArgs = (void *) this ; -} - -void internal_copy_conjunct(Conjunct* to, Conjunct* fr); - -// -// Copy Conjunct. -// -Conjunct* Conjunct::copy_conj_diff_relation(Formula *parent, Rel_Body *rel_body) { - Conjunct *new_conj; - if(problem && comp_problem==NULL) { - new_conj = new Conjunct(parent, rel_body); - internal_copy_conjunct(new_conj, this); - } - else if (problem==NULL && comp_problem) { - /* copy compressed conjunct */ - assert(0 && "copy compressed conjunct"); - new_conj = 0; - } - else { - assert(0 && "problem == NULL"); - new_conj = 0; - } - return new_conj; -} - - -void internal_copy_conjunct(Conjunct* to, Conjunct* fr) { - copy_conj_header(to, fr); - - // - // We repeat part of what is done by copy_conj_header(to, fr) by - // calling Problem::operator=(const Problem &). - // copy_conj_header should go away, but there is some code that still needs - // it in negate_conj. - // - to->r_constrs = fr->r_constrs; - to->simplified = fr->simplified; - to->verified = fr->verified; - to->guaranteed_leading_0s = fr->guaranteed_leading_0s; - to->possible_leading_0s = fr->possible_leading_0s; - to->leading_dir = fr->leading_dir; - // the following duplicates some work of the "copy_conj_header" brain damage - *to->problem = *fr->problem; - to->problem->getVarNameArgs = (void *)to; // important -} - - -// -// Copy Conjunct variable declarations -// and problem parameters but not problem itself. -// -void copy_conj_header(Conjunct* to, Conjunct* fr) { - free_var_decls(to->myLocals); to->myLocals.clear(); - - copy_var_decls(to->myLocals, fr->myLocals); - to->mappedVars = fr->mappedVars; - to->remap(); - reset_remap_field(fr->myLocals); - - to->cols_ordered = fr->cols_ordered; - to->r_constrs = fr->r_constrs; - to->simplified = fr->simplified; - to->verified = fr->verified; - to->guaranteed_leading_0s = fr->guaranteed_leading_0s; - to->possible_leading_0s = fr->possible_leading_0s; - to->leading_dir = fr->leading_dir; - to->n_open_constraints = fr->n_open_constraints; - to->exact=fr->exact; - - Problem *fp = fr->problem; - Problem *tp = to->problem; - tp->nVars = fp->nVars; - tp->safeVars = fp->safeVars; - tp->variablesInitialized = fp->variablesInitialized; - tp->variablesFreed = fp->variablesFreed; - for(int i=1; i<=maxVars; i++) { // only need nVars of var - tp->forwardingAddress[i] = fp->forwardingAddress[i]; - tp->var[i] = fp->var[i]; - } - to->problem->get_var_name = get_var_name; - to->problem->getVarNameArgs = (void *)to ; -} - - -void Conjunct::reverse_leading_dir_info() { - leading_dir *= -1; -} - - -void Conjunct::enforce_leading_info(int guaranteed, int possible, int dir) { - skip_finalization_check++; - guaranteed_leading_0s = guaranteed; - - int d = min(relation()->n_inp(),relation()->n_out()); - - assert(0 <= guaranteed); - assert(guaranteed <= possible); - assert(possible <= d); - - for(int i = 1; i <= guaranteed; i++) { - EQ_Handle e = add_EQ(); - e.update_coef_during_simplify(input_var(i), -1); - e.update_coef_during_simplify(output_var(i), 1); - e.finalize(); - } - - - if (guaranteed == possible && guaranteed >= 0 && possible+1 <= d && dir) { - GEQ_Handle g = add_GEQ(); - if (dir > 0) { - g.update_coef_during_simplify(input_var(possible+1), -1); - g.update_coef_during_simplify(output_var(possible+1), 1); - } - else { - g.update_coef_during_simplify(input_var(possible+1), 1); - g.update_coef_during_simplify(output_var(possible+1), -1); - } - g.update_const_during_simplify(-1); - g.finalize(); - possible_leading_0s = possible; - leading_dir = dir; - } - else { - possible_leading_0s = d; - leading_dir = 0; - } - - skip_finalization_check--; -#if ! defined NDEBUG - assert_leading_info(); -#endif -} - - -void Conjunct::invalidate_leading_info(int changed) { - if (changed == -1) { - guaranteed_leading_0s = possible_leading_0s = -1; - leading_dir = 0; - } - else { - int d = min(relation()->n_inp(), relation()->n_out()); - assert(1 <= changed && changed <= d); - if (possible_leading_0s == changed -1) { - possible_leading_0s = d; - } - guaranteed_leading_0s = min(guaranteed_leading_0s,changed-1); - } -#if ! defined NDEBUG - assert_leading_info(); -#endif -} - - -int Conjunct::leading_dir_valid_and_known() { - if (relation()->is_set()) { - return 0; - } - // if we know leading dir, we can rule out extra possible 0's - assert(leading_dir == 0 || - possible_leading_0s == guaranteed_leading_0s); - - return (possible_leading_0s == guaranteed_leading_0s && - possible_leading_0s >= 0 && - possible_leading_0s < min(relation()->n_inp(),relation()->n_out()) - && leading_dir); -} - - -#if ! defined NDEBUG -void Conjunct::assert_leading_info() { - if (relation()->is_set()) { - return; - } - - int d = min(relation()->n_inp(), relation()->n_out()); - - if ( guaranteed_leading_0s == -1 - && guaranteed_leading_0s == possible_leading_0s) - assert(leading_dir == 0); - - if(leading_dir != 0 && - possible_leading_0s != guaranteed_leading_0s) { - use_ugly_names++; - prefix_print(DebugFile); - use_ugly_names--; - } - - assert(leading_dir == 0 || possible_leading_0s == guaranteed_leading_0s); - - assert(possible_leading_0s <= d && guaranteed_leading_0s <= d); - - assert(possible_leading_0s == -1 || guaranteed_leading_0s <= possible_leading_0s); - - // check that there must be "guaranteed_leading_0s" 0s - int carried_level; - for (carried_level = 1; carried_level <= guaranteed_leading_0s; carried_level++) { - Variable_ID in = input_var(carried_level), - out = output_var(carried_level); - coef_t lb, ub; - bool guar; - query_difference(out, in, lb, ub, guar); - if (lb != 0 && ub != 0) { - // probably "query_difference" is just approximate - // add the negation of leading_dir and assert that - // the result is unsatisfiable; - // add in > out (in-out-1>=0) and assert unsatisfiable. - - Conjunct *test = copy_conj_same_relation(); - test->problem->turnRedBlack(); - skip_finalization_check++; - - GEQ_Handle g = test->add_GEQ(); - g.update_coef_during_simplify(in, -1); - g.update_coef_during_simplify(out, 1); - g.update_const_during_simplify(-1); - g.finalize(); - assert(!simplify_conj(test, true, 0, 0)); - // test was deleted by simplify_conj, as it was FALSE - - test = copy_conj_same_relation(); - test->problem->turnRedBlack(); - g = test->add_GEQ(); - g.update_coef_during_simplify(in, 1); - g.update_coef_during_simplify(out, -1); - g.update_const_during_simplify(-1); - g.finalize(); - assert(!simplify_conj(test, true, 0, 0)); - // test was deleted by simplify_conj, as it was FALSE - - skip_finalization_check--; - } - } - - carried_level = possible_leading_0s+1; - - // check that there can't be another - if (guaranteed_leading_0s == possible_leading_0s - && possible_leading_0s >= 0 && - carried_level <= min(relation()->n_inp(), relation()->n_out())) { - Variable_ID in = input_var(carried_level), - out = output_var(carried_level); - coef_t lb, ub; - bool guar; - query_difference(out, in, lb, ub, guar); - if (lb <= 0 && ub >= 0) { - // probably "query_difference" is just approximate - // add a 0 and see if its satisfiable - - Conjunct *test = copy_conj_same_relation(); - test->problem->turnRedBlack(); - skip_finalization_check++; - - EQ_Handle e = test->add_EQ(); - e.update_coef_during_simplify(in, -1); - e.update_coef_during_simplify(out, 1); - e.finalize(); - assert(!simplify_conj(test, true, 0, 0)); - // test was deleted by simplify_conj, as it was FALSE - - skip_finalization_check--; - } - } - - // check leading direction info - if (leading_dir_valid_and_known()) { - Variable_ID in = input_var(guaranteed_leading_0s+1), - out = output_var(guaranteed_leading_0s+1); - coef_t lb, ub; - bool guar; - query_difference(out, in, lb, ub, guar); - if ((leading_dir < 0 && ub >= 0) || - (leading_dir > 0 && lb <= 0)) { - // probably "query_difference" is just approximate - // add the negation of leading_dir and assert that - // the result is unsatisfiable; - // eg for leading_dir = +1 (in must be < out), - // add in >= out (in-out>=0) and assert unsatisfiable. - - Conjunct *test = copy_conj_same_relation(); - test->problem->turnRedBlack(); - skip_finalization_check++; - - GEQ_Handle g = test->add_GEQ(); - g.update_coef_during_simplify(in, leading_dir); - g.update_coef_during_simplify(out, -leading_dir); - g.finalize(); - - assert(!simplify_conj(test, true, 0, 0)); - // test was deleted by simplify_conj, as it was FALSE - - skip_finalization_check--; - } - } -} -#endif - - -Variable_ID Conjunct::declare(Const_String s) { - return do_declare(s, Wildcard_Var); -} - -Variable_ID Conjunct::declare() { - return do_declare(Const_String(), Wildcard_Var); -} - -Variable_ID Conjunct::declare(Variable_ID v) { - return do_declare(v->base_name, Wildcard_Var); -} - -Conjunct* Conjunct::really_conjunct() { - return this; -} - - -Variable_ID_Tuple* Conjunct::variables() { - return &mappedVars; -} - -Stride_Handle Conjunct::add_stride(int step, int preserves_level) { - assert_not_finalized(); - Variable_ID wild = declare(); - int c; - c = problem->newEQ(); - simplified = false; - verified = false; - if (! preserves_level) { - if (leading_dir == 0) - possible_leading_0s = -1; - // otherwise we must still have leading_dir, and thus no more 0's - } - problem->EQs[c].color = EQ_BLACK; - eqnnzero(&problem->EQs[c],problem->nVars); - n_open_constraints++; - EQ_Handle h = EQ_Handle(this, c); - h.update_coef(wild,step); - return h; -} - -// This should only be used to copy constraints from simplified relations, -// i.e. there are no quantified variables in c except wildcards. -EQ_Handle Conjunct::add_EQ(const Constraint_Handle &c, int /*preserves_level, currently unused*/) { - EQ_Handle e = add_EQ(); - copy_constraint(e,c); - return e; -} - - -EQ_Handle Conjunct::add_EQ(int preserves_level) { - assert_not_finalized(); - int c; - c = problem->newEQ(); - simplified = false; - verified = false; - if (!preserves_level) { - if (leading_dir == 0) - possible_leading_0s = -1; - // otherwise we must still have leading_dir, and thus no more 0's - } - problem->EQs[c].color = EQ_BLACK; - eqnnzero(&problem->EQs[c],problem->nVars); - n_open_constraints++; - return EQ_Handle(this, c); -} - - -// This should only be used to copy constraints from simplified relations, -// i.e. there are no quantified variables in c except wildcards. -GEQ_Handle Conjunct::add_GEQ(const Constraint_Handle &c, int /*preserves_level, currently unused */) { - GEQ_Handle g = add_GEQ(); - copy_constraint(g,c); - return g; -} - - -GEQ_Handle Conjunct::add_GEQ(int preserves_level) { - assert_not_finalized(); - int c; - c = problem->newGEQ(); - simplified = false; - verified = false; - if (!preserves_level) { - if (leading_dir == 0) - possible_leading_0s = -1; - // otherwise we must still have leading_dir, and thus no more 0's - } - problem->GEQs[c].color = EQ_BLACK; - eqnnzero(&problem->GEQs[c],problem->nVars); - n_open_constraints++; - return GEQ_Handle(this, c); -} - - -Conjunct *Conjunct::find_available_conjunct() { - return this; -} - - -bool Conjunct::can_add_child() { - return false; -} - - -void Conjunct::combine_columns() { - int nvars = mappedVars.size(),i,j,k; - - for(i=1; i<=nvars; i++) - for(j=i+1; j<=nvars; j++) { - // If they are the same, copy into the higher numbered column. - // That way we won't have problems with already-merged columns later - assert(i != j); - if(mappedVars[i] == mappedVars[j]) { - if (pres_debug) - fprintf(DebugFile, "combine_col:Actually combined %d,%d\n", - j,i); - for(k=0; knEQs; k++) - problem->EQs[k].coef[j] += problem->EQs[k].coef[i]; - for(k=0; knGEQs; k++) - problem->GEQs[k].coef[j] += problem->GEQs[k].coef[i]; - zero_column(problem, i, 0, 0, problem->nEQs, problem->nGEQs); - // Create a wildcard w/no constraints. temporary measure, - // so we don't have to shuffle columns - Variable_ID zero_var = declare(); - mappedVars[i] = zero_var; - break; - } - } -} - - -void Conjunct::finalize() { -// Debugging version of finalize; copy the conjunct and free the old one, -// so that purify will catch accesses to finalized constraints -// assert(n_open_constraints == 0); -// Conjunct *C = this->copy(); -// parent().replace_child(this, C); -// delete this; -} - -Conjunct::~Conjunct() { - NR_CONJUNCTS--; - delete problem; - delete comp_problem; -} - - -// -// Cost = # of terms in DNF when negated -// or CantBeNegated if too bad (i.e. bad wildcards) -// or AvoidNegating if it would be inexact -// -// Also check pres_legal_negations -- -// If set to any_negation, just return the number -// If set to one_geq_or_stride, return CantBeNegated if c > 1 -// If set to one_geq_or_eq, return CantBeNegated if not a single geq or eq -// - -int Conjunct::cost() { - int c; - int i; - int wc_no; - int wc_j = 0; // initialize to shut up the compiler - - // cost 1 per GEQ, and if 1 GEQ has wildcards, +2 for each of them - - c = problem->nGEQs; - for(i=0; inGEQs; i++) { - wc_no = 0; - for(int j=1; j<=problem->nVars; j++) if(problem->GEQs[i].coef[j]!=0) { - Variable_ID v = mappedVars[j]; - if(v->kind()==Wildcard_Var) { - wc_no++; - c+=2; - wc_j = j; - } - } - if (wc_no > 1) return CantBeNegated; - } - - for(i=0; inEQs; i++) { - wc_no = 0; - for(int j=1; j<=problem->nVars; j++) if(problem->EQs[i].coef[j]!=0) { - Variable_ID v = mappedVars[j]; - if(v->kind()==Wildcard_Var) { - wc_no++; - wc_j = j; - } - } - - if (wc_no == 0) // no wildcards - c+=2; - else if (wc_no == 1) { // one wildcard - maybe we can negate it - int i2; - for(i2=0; i2nEQs; i2++) - if(i != i2 && problem->EQs[i2].coef[wc_j]!=0) break; - if (i2 >= problem->nEQs) // Stride constraint - c++; - else // We are not ready to handle this - return CantBeNegated; - } - else // Multiple wildcards - return CantBeNegated; - } - if (!exact) return AvoidNegating; - - if (pres_legal_negations == any_negation) { - return c; - } - else { - // single GEQ ok either way as long as no wildcards - // (we might be able to handle wildcards, but I haven't thought about it) - if (problem->nEQs==0 && problem->nGEQs<=1) { - if (c>1) { // the GEQ had a wildcard -- I'm not ready to go here. - if (pres_debug > 0) { - fprintf(DebugFile, - "Refusing to negate a GEQ with wildcard(s)" - " under restricted_negation; " - "It may be possible to fix this.\n"); - } - return CantBeNegated; - } - return c; - } - else if (problem->nEQs==1 && problem->nGEQs==0) { - assert(c == 1 || c == 2); - - if (pres_legal_negations == one_geq_or_stride) { - if (c == 1) - return c; // stride constraint is ok - else { - if (pres_debug > 0) { - fprintf(DebugFile, "Refusing to negate a non-stride EQ under current pres_legal_negations.\n"); - } - return CantBeNegated; - } - } - else { - assert(pres_legal_negations == one_geq_or_eq); - return c; - } - } - else { - if (pres_debug > 0) { - fprintf(DebugFile, "Refusing to negate multiple constraints under current pres_legal_negations.\n"); - } - return CantBeNegated; - } - } -} - - -// -// Merge CONJ1 & CONJ2 -> CONJ. -// Action: MERGE_REGULAR or MERGE_COMPOSE: regular merge. -// MERGE_GIST make constraints from conj2 red, i.e. -// Gist Conj2 given Conj1 (T.S. comment). -// Reorder columns as we go. -// Merge the columns for identical variables. -// We assume we know nothing about the ordering of conj1, conj2. -// -// Does not consume its arguments -// -// Optional 4th argument gives the relation for the result - if -// null, conj1 and conj2 must have the same relation, which will -// be used for the result -// -// The only members of conj1 and conj2 that are used are: problem, -// mappedVars and declare(), and the leading_0s/leading_dir members -// and exact. -// -// NOTE: variables that are shared between conjuncts are necessarily -// declared above, not here; so we can simply create columns for the -// locals of each conj after doing the protected vars. -// -Conjunct* merge_conjs(Conjunct* conj1, Conjunct* conj2, - Merge_Action action, Rel_Body *body) { - // body must be set unless both conjuncts are from the same relation - assert(body || conj1->relation() == conj2->relation()); - - if (body == conj1->relation() && body == conj2->relation()) - body = 0; // we test this later to see if there is a new body - - Conjunct *conj3 = new Conjunct(NULL, body ? body : conj2->relation()); - Problem *p1 = conj1->problem; - Problem *p2 = conj2->problem; - Problem *p3 = conj3->problem; - int i; - - if (action != MERGE_COMPOSE) { - conj1->assert_leading_info(); - conj2->assert_leading_info(); - } - - if(pres_debug>=2) { - use_ugly_names++; - fprintf(DebugFile, ">>> Merge conjuncts: Merging%s:\n", - (action == MERGE_GIST ? " for gist" : - (action == MERGE_COMPOSE ? " for composition" : ""))); - conj1->prefix_print(DebugFile); - conj2->prefix_print(DebugFile); - fprintf(DebugFile, "\n"); - use_ugly_names--; - } - - - - switch(action) { - case MERGE_REGULAR: - case MERGE_COMPOSE: - conj3->exact=conj1->exact && conj2->exact; - break; - case MERGE_GIST: - conj3->exact=conj2->exact; - break; - } - - if (action == MERGE_COMPOSE) { - conj3->guaranteed_leading_0s=min(conj1->guaranteed_leading_0s, - conj2->guaranteed_leading_0s); - conj3->possible_leading_0s=min((unsigned int) conj1->possible_leading_0s, - (unsigned int) conj2->possible_leading_0s); - - assert( conj3->guaranteed_leading_0s <= conj3->possible_leading_0s); - - // investigate leading_dir - not well tested code - if (conj1->guaranteed_leading_0s<0 || conj2->guaranteed_leading_0s<0) { - conj3->leading_dir = 0; - } - else if (conj1->guaranteed_leading_0s == conj2->guaranteed_leading_0s) - if (conj1->leading_dir == conj2->leading_dir) - conj3->leading_dir = conj1->leading_dir; - else - conj3->leading_dir = 0; - else if (conj1->guaranteed_leading_0s < conj2->guaranteed_leading_0s) { - conj3->leading_dir = conj1->leading_dir; - } - else { // (conj1->guaranteed_leading_0s > conj2->guaranteed_leading_0s) - conj3->leading_dir = conj2->leading_dir; - } - - if (conj3->leading_dir == 0) - conj3->possible_leading_0s = min(conj3->relation()->n_inp(), - conj3->relation()->n_out()); - - assert(conj3->guaranteed_leading_0s <= conj3->possible_leading_0s); - assert(conj3->guaranteed_leading_0s == conj3->possible_leading_0s - || !conj3->leading_dir); - } - else if (!body) { // if body is set, who knows what leading 0's mean? - assert(action == MERGE_REGULAR || action == MERGE_GIST); - - int feasable = 1; - - int redAndBlackGuarLeadingZeros = max(conj1->guaranteed_leading_0s, - conj2->guaranteed_leading_0s); - if (action == MERGE_REGULAR) - conj3->guaranteed_leading_0s= redAndBlackGuarLeadingZeros; - else conj3->guaranteed_leading_0s=conj1->guaranteed_leading_0s; - - conj3->possible_leading_0s=min((unsigned)conj1->possible_leading_0s, - (unsigned)conj2->possible_leading_0s); - if (conj3->possible_leading_0s < redAndBlackGuarLeadingZeros) - feasable = 0; - else if (conj3->guaranteed_leading_0s == -1 - || conj3->possible_leading_0s > redAndBlackGuarLeadingZeros) - conj3->leading_dir = 0; - else { - if (conj1->guaranteed_leading_0s == conj2->guaranteed_leading_0s) - if (!conj1->leading_dir_valid_and_known()) - conj3->leading_dir = conj2->leading_dir; - else if (!conj2->leading_dir_valid_and_known()) - conj3->leading_dir = conj1->leading_dir; - else if (conj1->leading_dir * conj2->leading_dir > 0) - conj3->leading_dir = conj1->leading_dir; // 1,2 same dir - else - feasable = 0; // 1 and 2 go in opposite directions - else if (conj3->possible_leading_0s != conj3->guaranteed_leading_0s) - conj3->leading_dir = 0; - else if (conj1->guaranteed_leading_0sguaranteed_leading_0s) { - assert(!conj1->leading_dir_valid_and_known()); - conj3->leading_dir = conj2->leading_dir; - } - else { - assert(!conj2->leading_dir_valid_and_known()); - conj3->leading_dir = conj1->leading_dir; - } - } - - if (!feasable) { - if(pres_debug>=2) - fprintf(DebugFile, ">>> Merge conjuncts: quick check proves FALSE.\n"); - - // return 0 = 1 - - int e = p3->newEQ(); - p3->EQs[e].color = EQ_BLACK; - p3->EQs[e].touched = 1; - p3->EQs[e].key = 0; - p3->EQs[e].coef[0] = 1; - - // Make sure these don't blow later assertions - conj3->possible_leading_0s = conj3->guaranteed_leading_0s = -1; - conj3->leading_dir = 0; - - return conj3; - } - } - else { // provided "body" argument but not composing, leading 0s meaningless - conj3->guaranteed_leading_0s = conj3->possible_leading_0s = -1; - conj3->leading_dir = 0; - } - - // initialize omega stuff - - for(i=0; inGEQs+p2->nGEQs; i++) { - int e = p3->newGEQ(); - assert(e == i); - p3->GEQs[e].color = EQ_BLACK; - p3->GEQs[e].touched = 1; - p3->GEQs[e].key = 0; - } - for(i=0; inEQs+p2->nEQs; i++) { - int e = p3->newEQ(); - assert(e == i); - p3->EQs[e].color = EQ_BLACK; - p3->EQs[e].touched = 1; - p3->EQs[e].key = 0; - } - - assert(p3->nGEQs == p1->nGEQs + p2->nGEQs); - assert(p3->nEQs == p1->nEQs + p2->nEQs); - - // flag constraints from second constraint as red, if necessary - if (action == MERGE_GIST) { - for(i=0; inEQs; i++) { - p3->EQs[i+p1->nEQs].color = EQ_RED; - } - for(i=0; inGEQs; i++) { - p3->GEQs[i+p1->nGEQs].color = EQ_RED; - } - } - - // copy constant column - copy_column(p3, 0, p1, 0, 0, 0); - copy_column(p3, 0, p2, 0, p1->nEQs, p1->nGEQs); - - // copy protected variables column from conj1 - int new_col = 1; - Variable_Iterator VI(conj1->mappedVars); - for(i=1; VI; VI++, i++) { - Variable_ID v = *VI; - if(v->kind() != Wildcard_Var) { - conj3->mappedVars.append(v); - int fr_ix = i; - copy_column(p3, new_col, p1, fr_ix, 0, 0); - zero_column(p3, new_col, p1->nEQs, p1->nGEQs, - p2->nEQs, p2->nGEQs); - new_col++; - } - } - - // copy protected variables column from conj2, - // checking if conj3 already has this variable from conj1 - for(i=1; i <= conj2->mappedVars.size(); i++) { - Variable_ID v = conj2->mappedVars[i]; - if(v->kind() != Wildcard_Var) { - int to_ix = conj3->mappedVars.index(v); - int fr_ix = i; - if(to_ix > 0) { - // use old column - copy_column(p3, to_ix, p2, fr_ix, p1->nEQs, p1->nGEQs); - } - else { - // create new column - conj3->mappedVars.append(v); - zero_column(p3, new_col, 0, 0, p1->nEQs, p1->nGEQs); - copy_column(p3, new_col, p2, fr_ix, p1->nEQs, p1->nGEQs); - new_col++; - } - } - } - - p3->safeVars = new_col-1; - - // copy wildcards from conj1 - for(i=1; i <= conj1->mappedVars.size(); i++) { - Variable_ID v = conj1->mappedVars[i]; - if(v->kind() == Wildcard_Var) { - Variable_ID nv = conj3->declare(v); - conj3->mappedVars.append(nv); - int fr_ix = i; - copy_column(p3, new_col, p1, fr_ix, 0, 0); - zero_column(p3, new_col, p1->nEQs, p1->nGEQs, - p2->nEQs, p2->nGEQs); - new_col++; - } - } - - // copy wildcards from conj2 - for(i=1; i <= conj2->mappedVars.size(); i++) { - Variable_ID v = conj2->mappedVars[i]; - if(v->kind() == Wildcard_Var) { - Variable_ID nv = conj3->declare(v); - conj3->mappedVars.append(nv); - int fr_ix = i; - zero_column(p3, new_col, 0, 0, p1->nEQs, p1->nGEQs); - copy_column(p3, new_col, p2, fr_ix, p1->nEQs, p1->nGEQs); - new_col++; - } - } - - p3->nVars = new_col-1; - checkVars(p3->nVars); - p3->variablesInitialized = 1; - for(i=1; i<=p3->nVars; i++) - p3->var[i] = p3->forwardingAddress[i] = i; - - conj3->cols_ordered = true; - conj3->simplified = false; - conj3->verified = false; - - if(pres_debug>=2) { - use_ugly_names++; - fprintf(DebugFile, ">>> Merge conjuncts: result is:\n"); - conj3->prefix_print(DebugFile); - fprintf(DebugFile, "\n"); - use_ugly_names--; - } - - conj3->assert_leading_info(); - - return conj3; -} - - - - -// -// Reorder variables by swapping. -// cols_ordered is just a hint that thorough check needs to be done. -// Sets _safeVars. -// -void Conjunct::reorder() { - if(!cols_ordered) { - int var_no = mappedVars.size(); - int first_wild = 1; - int last_prot = var_no; - while(first_wild < last_prot) { - for(; first_wild<=var_no && mappedVars[first_wild]->kind()!=Wildcard_Var; - first_wild++) ; - for(; last_prot>=1 && mappedVars[last_prot]->kind()==Wildcard_Var; - last_prot--) ; - if(first_wild < last_prot) { - problem->swapVars(first_wild, last_prot); - problem->variablesInitialized = false; - Var_Decl *t = mappedVars[first_wild]; - mappedVars[first_wild] = mappedVars[last_prot]; - mappedVars[last_prot] = t; - if(pres_debug) { - fprintf(DebugFile, "<<>>: swapped var-s %d and %d\n", first_wild, last_prot); - } - } - } - - int safe_vars; - for(safe_vars=0; - safe_varskind()!=Wildcard_Var; - safe_vars++) ; - -#if ! defined NDEBUG - for(int s = safe_vars ; skind() == Wildcard_Var); - } -#endif - - problem->safeVars = safe_vars; - cols_ordered = true; - } -} - - - -// Wherever possible, move function symbols to input tuple. -// This ensures that if in == out, red F(in) = x is redundant -// with black F(out) = x - -void Conjunct::move_UFS_to_input() { - if (guaranteed_leading_0s > 0) { - std::set already_done; - int remapped = 0; - skip_finalization_check++; - Rel_Body *body = relation(); - - assert(body); - - for (Variable_ID_Iterator func(*body->global_decls()); func; func++) { - Global_Var_ID f = (*func)->get_global_var(); - if (f->arity() <= guaranteed_leading_0s) - if (already_done.find(f) == already_done.end() && - body->has_local(f, Input_Tuple) && - body->has_local(f, Output_Tuple)) { - already_done.insert(f); - - // equatE f(in) = f(out) - Variable_ID f_in = body->get_local(f, Input_Tuple); - Variable_ID f_out = body->get_local(f, Output_Tuple); - if (f_in != f_out) { - EQ_Handle e = add_EQ(1); - - e.update_coef_during_simplify(f_in, -1); - e.update_coef_during_simplify(f_out, 1); - - f_out->remap = f_in; - remapped = 1; - } - } - } - - if (remapped) { - remap(); - combine_columns(); - reset_remap_field(*body->global_decls()); - remapped = 0; - } - - skip_finalization_check--; - } -} - - - - - -// -// Simplify CONJ. -// Return TRUE if there are solutions, FALSE -- no solutions. -// -int simplify_conj(Conjunct* conj, int ver_sim, int simplificationEffort, int color) { - if (conj->verified - && simplificationEffort <= conj->r_constrs - && (conj->simplified || simplificationEffort < 0) - && !color) { - if(pres_debug) { - fprintf(DebugFile, "$$$ Redundant simplify_conj ignored (%d,%d,%d)\n",ver_sim,simplificationEffort,color); - conj->prefix_print(DebugFile); - } - return 1; - } - - if (simplificationEffort < 0) simplificationEffort = 0; - conj->move_UFS_to_input(); - conj->reorder(); - - Problem *p = conj->problem; - - use_ugly_names++; - - int i; - for(i=0; inGEQs; i++) { - p->GEQs[i].touched = 1; - } - for(i=0; inEQs; i++) { - p->EQs[i].touched = 1; - } - - if(pres_debug) { - fprintf(DebugFile, "$$$ simplify_conj (%d,%d,%d)[\n",ver_sim,simplificationEffort,color); - conj->prefix_print(DebugFile); - } - - assert(conj->cols_ordered); - - int ret_code; - assert(p == conj->problem); - if(!color) { - ret_code = conj->simplifyProblem(ver_sim && ! conj->verified,0,simplificationEffort); - } - else { - ret_code = conj->redSimplifyProblem(simplificationEffort,1); - ret_code = (ret_code==redFalse ? 0 : 1); - } - assert(p->nSUBs==0); - - if(ret_code == 0) { - if(pres_debug) - fprintf(DebugFile, "] $$$ simplify_conj : false\n\n"); - delete conj; - use_ugly_names--; - return(false); - } - - - // - // mappedVars is mapping from columns to Variable_IDs. - // Recompute mappedVars for problem returned from ip.c - // - Variable_ID_Tuple new_mapped(0); // This is expanded by "append" - for (i=1; i<=p->safeVars; i++) { - // what is now in column i used to be in column p->var[i] - Variable_ID v = conj->mappedVars[p->var[i]]; - assert(v->kind() != Wildcard_Var); - new_mapped.append(v); - } - - /* Redeclare all wildcards that weren't eliminated. */ - free_var_decls(conj->myLocals); conj->myLocals.clear(); - - conj->mappedVars = new_mapped; - for (i = p->safeVars+1; i<=p->nVars; i++) { - Variable_ID v = conj->declare(); - conj->mappedVars.append(v); - } - - // reset var and forwarding address if desired. - p->variablesInitialized = 1; - for(i=1; i<=conj->problem->nVars; i++) - conj->problem->var[i] = conj->problem->forwardingAddress[i] = i; - - if(pres_debug) { - fprintf(DebugFile, "] $$$ simplify_conj\n"); - conj->prefix_print(DebugFile); - fprintf(DebugFile, "\n"); - } - - - use_ugly_names--; - conj->simplified = true; - conj->setup_anonymous_wildcard_names(); - - return(true); -} - - -int Conjunct::rank() { - Conjunct *C = this->copy_conj_same_relation(); - C->reorder(); - C->ordered_elimination(C->relation()->global_decls()->size()); - int C_rank = 0; - for(Variable_Iterator vi = C->mappedVars; vi; vi++) - if(C->find_column(*vi) > 0) C_rank++; - delete C; - return C_rank; - -} - - -void Conjunct::query_difference(Variable_ID v1, Variable_ID v2, coef_t &lowerBound, coef_t &upperBound, bool &guaranteed) { - int c1 = get_column(v1); - int c2 = get_column(v2); - assert(c1 && c2); - problem->query_difference(c1, c2, lowerBound, upperBound, guaranteed); -} - - -void Conjunct::query_variable_bounds(Variable_ID v, coef_t &lowerBound, coef_t &upperBound) { - int c = get_column(v); - assert (c); - problem->query_variable_bounds(c, &lowerBound, &upperBound); -} - -coef_t Conjunct::query_variable_mod(Variable_ID v, coef_t factor) { - int c = get_column(v); - assert(c); - return problem->query_variable_mod(c, factor); -} - -bool Conjunct::query_variable_used(Variable_ID v) { - for (GEQ_Iterator g = GEQs(); g.live(); g.next()) { - if ((*g).get_coef(v)) return true; - } - for (EQ_Iterator e = EQs(); e.live(); e.next()) { - if ((*e).get_coef(v)) return true; - } - return false; -} - - -int Conjunct::simplifyProblem(int verify, int subs, int redundantElimination) { - if (verified) verify = 0; - int result = problem->simplifyProblem(verify, subs, redundantElimination); - if (result == false && !exact) - exact=true; - assert(!(verified && verify && result == false)); - if (verify && result) verified = true; - else if (!result) verified = false; - return result; -} - - -// not as confident about this one as the previous: -int Conjunct::redSimplifyProblem(int effort, int computeGist) { - redCheck result = problem->redSimplifyProblem(effort, computeGist); - if (result == redFalse && !exact) - exact=true; - return result; -} - - -// -// Add given list of wildcards S to this Conjunct. -// Clears argument. (That's very important, otherwise those var_id's get freed) -// Push_exists takes responsibility for reusing or deleting Var_ID's; -// here we reuse them. Must also empty out the Tuple when finished (joins). -void Conjunct::push_exists(Variable_ID_Tuple &S) { - for(Tuple_Iterator VI(S); VI; VI++) { - (*VI)->var_kind = Wildcard_Var; - } - myLocals.join(S); // Sets S to be empty. - cols_ordered = false; - simplified = false; -} - - -Conjunct *Formula::add_conjunct() { - assert_not_finalized(); - assert(can_add_child()); - Conjunct *f = new Conjunct(this, myRelation); - myChildren.append(f); - return f; -} - -// Compress/uncompress functions - -bool Conjunct::is_compressed() { - if(problem!=NULL && comp_problem==NULL) { - return false; - } - else if(problem==NULL && comp_problem!=NULL) { - return true; - } - else { - assert(0 && "Conjunct::is_compressed: bad conjunct"); - return false; - } -} - - -void Conjunct::compress() { - if(!is_compressed()) { // compress - comp_problem = new Comp_Problem(problem); - delete problem; - problem = NULL; - } -} - - -void Conjunct::uncompress() { - if(is_compressed()) { - problem = comp_problem->UncompressProblem(); - delete comp_problem; - comp_problem = NULL; - } -} - - -Comp_Problem::Comp_Problem(Problem *problem) : - _nVars(problem->nVars), - _safeVars(problem->safeVars), - _get_var_name(problem->get_var_name), - _getVarNameArgs(problem->getVarNameArgs), - eqs(&problem->EQs[0],problem->nEQs,problem->nVars), - geqs(&problem->GEQs[0],problem->nGEQs,problem->nVars) { -} - -Comp_Constraints::Comp_Constraints(eqn *constrs, int no_constrs, int no_vars) : - n_constrs(no_constrs), - n_vars(no_vars) { - coefs = new coef_t[(n_vars+1)*n_constrs]; - int e, v; - for(e=0; eget_var_name = get_var_name; - p->getVarNameArgs = _getVarNameArgs; - p->nVars = _nVars; - p->safeVars = _safeVars; - for(int i=1; i<=p->nVars; i++) { - p->forwardingAddress[i] = i; - p->var[i] = i; - } - eqs.UncompressConstr(&p->EQs[0], p->nEQs); - geqs.UncompressConstr(&p->GEQs[0], p->nGEQs); - return p; -} - -void Comp_Constraints::UncompressConstr(eqn *constrs, short &pn_constrs) { - int e, v; - for(e=0; econvertEQstoGEQs(excludeStrides); -} - - -void Conjunct::calculate_dimensions(Relation &R, int &ndim_all, int &ndim_domain) { - - Conjunct * c = this; - Relation rc=Relation(R, c); - - if(relation_debug) { - fprintf(DebugFile,"{{{\nIn Conjunct::calculate_dimensions:\n"); - rc.prefix_print(DebugFile); - } - - rc=Approximate(rc); - Relation rd=rc; - - if(relation_debug) { - fprintf(DebugFile,"Conjunct::calculate_dimensions: Approximated as:\n"); - rc.prefix_print(DebugFile); - } - - // skip_set_checks++; - - Conjunct * rc_conj=rc.single_conjunct(); - ndim_all=rc.n_inp()+rc.n_out(); - ndim_all-=rc_conj->n_EQs(); - - rc = Project_On_Sym(rc); - rc.simplify(); - - if(relation_debug) { - fprintf(DebugFile, "Conjunct::calculate_dimensions: after project_on_sym\n"); - rc.prefix_print(DebugFile); - } - - int n_eq_sym = 1000; - for (DNF_Iterator s(rc.query_DNF()); s.live(); s.next()) - n_eq_sym = min(n_eq_sym, s.curr()->n_EQs()); - ndim_all+=n_eq_sym; - // skip_set_checks--; - - if (R.is_set()) - ndim_domain = ndim_all; - else { - /* get dimensions for the domain (broadcasting) */ - - rd=Domain(rd); - rd.simplify(); - - if(relation_debug) { - fprintf(DebugFile,"Domain is:\n"); - rd.prefix_print(DebugFile); - } - - rc_conj=rd.single_conjunct(); - ndim_domain=rd.n_set()-rc_conj->n_EQs()+n_eq_sym; - } - - if(relation_debug) { - fprintf(DebugFile,"n_eq_sym=%d \n",n_eq_sym); - fprintf(DebugFile,"Dimensions: all=%d domain=%d\n}}}\n", ndim_all,ndim_domain); - } -} - -} // namespace diff --git a/omega/omega_lib/src/pres_decl.cc b/omega/omega_lib/src/pres_decl.cc deleted file mode 100644 index f5ac312..0000000 --- a/omega/omega_lib/src/pres_decl.cc +++ /dev/null @@ -1,71 +0,0 @@ -#include -#include - -namespace omega { - -// -// Declare functions. -// -Variable_ID F_Declaration::do_declare(Const_String s, Var_Kind var_type) { - Variable_ID v; - assert(var_type != Global_Var); - if(!s.null()) { - v = new Var_Decl(s, var_type, 0); - } - else { - v = new Var_Decl(var_type, 0); - } - myLocals.append(v); - return v; -} - -Variable_ID F_Declaration::declare(Const_String) { - assert(0); // must be declared in forall, exists, or conjunct - return(NULL); -} - -Section F_Declaration::declare_tuple(int n) { - int first = myLocals.size()+1; - - for (int i=1 ; i<=n; i++) - declare(); - - return Section(&myLocals, first, n); -} - - -void F_Declaration::finalize() { - assert(n_children() == 1); - Formula::finalize(); -} - -bool F_Declaration::can_add_child() { - return n_children() < 1; -} - - -F_Declaration::F_Declaration(Formula *p, Rel_Body *r): - Formula(p,r), myLocals(0) { -} - -F_Declaration::F_Declaration(Formula *p, Rel_Body *r, Variable_ID_Tuple &S): - Formula(p,r), myLocals(S) { -} - -// -// Destruct declarative node. -// Delete variableID's themselves if they are not global. -// -F_Declaration::~F_Declaration() { - free_var_decls(myLocals); -} - -//Setup names for printing -void F_Declaration::setup_anonymous_wildcard_names() { - for(Tuple_Iterator VI(myLocals); VI; VI++) { - Variable_ID v = *VI; - if (v->base_name.null()) v->instance = wildCardInstanceNumber++; - } -} - -} // namespace diff --git a/omega/omega_lib/src/pres_dnf.cc b/omega/omega_lib/src/pres_dnf.cc deleted file mode 100644 index c9fd7e6..0000000 --- a/omega/omega_lib/src/pres_dnf.cc +++ /dev/null @@ -1,1416 +0,0 @@ -/***************************************************************************** - Copyright (C) 1994-2000 the Omega Project Team - Copyright (C) 2005-2011 Chun Chen - All Rights Reserved. - - Purpose: - Functions for disjunctive normal form. - - Notes: - - History: -*****************************************************************************/ - -#include -#include -#include -#include /* all DNFize functions are here */ -#include -#include - -namespace omega { - -void DNF::remap() { - for(DNF_Iterator DI(this); DI.live(); DI.next()) { - Conjunct *C = DI.curr(); - C->remap(); - } -} - - -// -// DNF1 & DNF2 -> DNF. -// Free arguments. -// -DNF* DNF_and_DNF(DNF* dnf1, DNF* dnf2) { - DNF* new_dnf = new DNF; - for(DNF_Iterator p(dnf2); p.live(); p.next()) { - new_dnf->join_DNF(DNF_and_conj(dnf1, p.curr())); - } - delete dnf1; - delete dnf2; - if(new_dnf->length() > 1) { - new_dnf->simplify(); - } - - if(pres_debug) { - fprintf(DebugFile, "+++ DNF_and_DNF OUT +++\n"); - new_dnf->prefix_print(DebugFile); - } - return(new_dnf); -} - - -/* - * Remove redundant conjuncts from given DNF. - * If (C1 => C2), remove C1. - * C1 => C2 is TRUE: when problem where C1 is Black and C2 is Red - * Blk Red : has no red constraints. - * It means that C1 is a subset of C2 and therefore C1 is redundant. - * - * Exception: C1 => UNKNOWN - leave them as they are - */ -void DNF::rm_redundant_conjs(int effort) { - if(is_definitely_false() || has_single_conjunct()) - return; - - use_ugly_names++; - // skip_set_checks++; - - int count = 0; - for(DNF_Iterator p(this); p.live(); p.next()) count++; - - if(pres_debug) { - int i = 0; - fprintf(DebugFile, "@@@ rm_redundant_conjs IN @@@[\n"); - prefix_print(DebugFile); - for(DNF_Iterator p(this); p.live(); p.next()) - fprintf(DebugFile, "#%d = %p\n", ++i, p.curr()); - } - - DNF_Iterator pdnext; - DNF_Iterator pdel(this); - for(; pdel.live(); pdel=pdnext) { - pdnext = pdel; - pdnext.next(); - Conjunct *cdel = pdel.curr(); - int del_min_leading_zeros = cdel->query_guaranteed_leading_0s(); - int del_max_leading_zeros = cdel->query_possible_leading_0s(); - - for(DNF_Iterator p(this); p.live(); p.next()) { - Conjunct *c = p.curr(); - if(c != cdel) { - int c_min_leading_zeros = cdel->query_guaranteed_leading_0s(); - int c_max_leading_zeros = cdel->query_possible_leading_0s(); - if(pres_debug) - fprintf(DebugFile, "@@@ rm_redundant_conjs @%p => @%p[\n", cdel, c); - - if (c->is_inexact() && cdel->is_exact()) { - if (pres_debug) - fprintf(DebugFile, "]@@@ rm_redundant_conjs @@@ Exact Conj => Inexact Conj is not tested\n"); - } - else if (del_min_leading_zeros >=0 && c_min_leading_zeros >= 0 - && c_max_leading_zeros >= 0 && del_max_leading_zeros >=0 - && (del_min_leading_zeros > c_max_leading_zeros - || c_min_leading_zeros > del_max_leading_zeros)) { - if (1 || pres_debug) - fprintf(DebugFile, "]@@@ not redundant due to leading zero info\n"); - } - else { - Conjunct *cgist = merge_conjs(cdel, c, MERGE_GIST); - - if (!cgist->redSimplifyProblem(effort,0)) { - if(pres_debug) { - fprintf(DebugFile, "]@@@ rm_redundant_conjs @@@ IMPLICATION TRUE @%p\n", cdel); - cdel->prefix_print (DebugFile); - fprintf(DebugFile, "=>\n"); - c->prefix_print (DebugFile); - } - rm_conjunct(cdel); - delete cdel; - delete cgist; - break; - } - else { - if(pres_debug) { - fprintf(DebugFile, "]@@@ rm_redundant_conjs @@@ IMPLICATION FALSE @%p\n", cdel); - if(pres_debug > 1) - cgist->prefix_print(DebugFile); - } - delete cgist; - } - } - } - } - } - - if(pres_debug) { - fprintf(DebugFile, "]@@@ rm_redundant_conjs OUT @@@\n"); - prefix_print(DebugFile); - } - // skip_set_checks--; - use_ugly_names--; -} - - -/* Remove inexact conjuncts from given DNF if it contains UNKNOWN - * conjunct - */ - -void DNF::rm_redundant_inexact_conjs() { - if (is_definitely_false() || has_single_conjunct()) - return; - - bool has_unknown=false; - bool has_inexact=false; - - Conjunct * c_unknown = 0; // make compiler shut up - for (DNF_Iterator p(this); p.live(); p.next()) { - assert (p.curr()->problem!=NULL); - if (p.curr()->is_inexact()) { - if (p.curr()->is_unknown()) { - has_unknown=true; - c_unknown = p.curr(); - } - else - has_inexact=true; - } - } - - if (! has_unknown || ! has_inexact) - return; - - use_ugly_names++; - // skip_set_checks++; - - DNF_Iterator pdnext; - DNF_Iterator pdel(this); - - for (; pdel.live(); pdel=pdnext) { - pdnext = pdel; - pdnext.next(); - Conjunct * cdel=pdel.curr(); - if (cdel->is_inexact() && cdel!=c_unknown) { - rm_conjunct(cdel); - delete cdel; - } - } - - use_ugly_names--; - // skip_set_checks--; -} - - - -// -// DNF properties. -// -bool DNF::is_definitely_false() const { - return(conjList.empty()); -} - -bool DNF::is_definitely_true() const { - return(has_single_conjunct() && single_conjunct()->is_true()); -} - -int DNF::length() const { - return conjList.length(); -} - -Conjunct *DNF::single_conjunct() const { - assert(conjList.length()==1); - return(conjList.front()); -} - -bool DNF::has_single_conjunct() const { - return (conjList.length()==1); -} - -Conjunct *DNF::rm_first_conjunct() { - if(conjList.empty()) { - return NULL; - } - else { - return conjList.remove_front(); - } -} - - -// -// Convert DNF to Formula and add it root. -// Free this DNF. -// -void DNF::DNF_to_formula(Formula* root) { - Formula *new_or; - if (conjList.length()!=1) { - skip_finalization_check++; - new_or = root->add_or(); - skip_finalization_check--; - } - else { - new_or = root; - } - while(!conjList.empty()) { - Conjunct *conj = conjList.remove_front(); - new_or->add_child(conj); - } - delete this; -} - - -// -// DNF functions. -// -DNF::DNF() : conjList() { -} - -DNF::~DNF() { - // for(DNF_Iterator p(this); p.live(); p.next()) { - // if(p.curr() != NULL) - // delete p.curr(); - // } - for(List_Iterator i(conjList); i.live(); i.next()) - delete *i; -} - -// -// Copy DNF -// -DNF* DNF::copy(Rel_Body *rel_body) { - DNF *new_dnf = new DNF; - for(DNF_Iterator pd(this); pd.live(); pd.next()) { - Conjunct *conj = pd.curr(); - if(conj) - new_dnf->add_conjunct(conj->copy_conj_diff_relation(rel_body,rel_body)); - } - return(new_dnf); -} - -// -// Add Conjunct to DNF -// -void DNF::add_conjunct(Conjunct* conj) { - conjList.append(conj); -} - -// -// Add DNF to DNF. -// The second DNF is reused. -// -void DNF::join_DNF(DNF* dnf) { - conjList.join(dnf->conjList); - delete dnf; -} - -// -// Remove conjunct from DNF. -// Conjunct itself is not deleted. -// -void DNF::rm_conjunct(Conjunct *c) { - if(conjList.front() == c) { - conjList.remove_front(); - } - else { - List_Iterator p, pp; - for(p=List_Iterator (conjList); p; p++) { - if((*p)==c) { - conjList.del_after(pp); - return; - } - pp = p; - } - assert(0 && "DNF::rm_conjunct: no such conjunct"); - } -} - - -// remove (but don't delete) all conjuncts - -void DNF::clear() { - conjList.clear(); -} - - -// -// DNF & CONJ -> new DNF. -// Don't touch arguments. -// -DNF* DNF_and_conj(DNF* dnf, Conjunct* conj) { - DNF* new_dnf = new DNF; - for(DNF_Iterator p(dnf); p.live(); p.next()) { - Conjunct* new_conj = merge_conjs(p.curr(), conj, MERGE_REGULAR); - new_dnf->add_conjunct(new_conj); - } - if(new_dnf->length() > 1) { - new_dnf->simplify(); - } - return(new_dnf); -} - -// -// Compute C0 and not (C1 or C2 or ... CN). -// Reuse/delete its arguments. -// -DNF* conj_and_not_dnf(Conjunct *positive_conjunct, DNF *neg_conjs, bool weak) { - DNF *ret_dnf = new DNF; - int recursive = 0; - use_ugly_names++; - - if(pres_debug) { - fprintf(DebugFile, "conj_and_not_dnf [\n"); - fprintf(DebugFile, "positive_conjunct:\n"); - positive_conjunct->prefix_print(DebugFile); - fprintf(DebugFile, "neg_conjs:\n"); - neg_conjs->prefix_print(DebugFile); - fprintf(DebugFile, "\n\n"); - } - - if (simplify_conj(positive_conjunct, true, false, EQ_BLACK) == false) { - positive_conjunct = NULL; - goto ReturnDNF; - } - - /* Compute gists of negative conjuncts given positive conjunct */ - - - int c0_updated; - c0_updated = true; - while(c0_updated) { - c0_updated = false; - for(DNF_Iterator p(neg_conjs); p.live(); p.next()) { - Conjunct *neg_conj = p.curr(); - if(neg_conj==NULL) continue; - if (!positive_conjunct->is_exact() - && !neg_conj->is_exact()) { - // C1 and unknown & ~(C2 and unknown) = C1 and unknown - delete neg_conj; - p.curr_set(NULL); - continue; - } - Conjunct *cgist = merge_conjs(positive_conjunct, neg_conj, MERGE_GIST); - if(simplify_conj(cgist, false, true, EQ_RED) == false) { - // C1 & ~FALSE = C1 - delete neg_conj; - p.curr_set(NULL); - } - else { - cgist->rm_color_constrs(); - if(cgist->is_true()) { - // C1 & ~TRUE = FALSE - delete cgist; - goto ReturnDNF; - } - else { - if(cgist->cost()==1) { // single inequality - DNF *neg_dnf = negate_conj(cgist); - delete cgist; - Conjunct *conj = - merge_conjs(positive_conjunct, neg_dnf->single_conjunct(), MERGE_REGULAR); - delete positive_conjunct; - delete neg_dnf; - positive_conjunct = conj; - delete neg_conj; - p.curr_set(NULL); - if(!simplify_conj(positive_conjunct, false, false, EQ_BLACK)) { - positive_conjunct = NULL; - goto ReturnDNF; - } - c0_updated = true; - } - else { - delete neg_conj; - p.curr_set(cgist); - } - } - } - } - } - - if(pres_debug) { - fprintf(DebugFile, "--- conj_and_not_dnf positive_conjunct NEW:\n"); - positive_conjunct->prefix_print(DebugFile); - fprintf(DebugFile, "--- conj_and_not_dnf neg_conjs GISTS:\n"); - neg_conjs->prefix_print(DebugFile); - fprintf(DebugFile, "--- conj_and_not_dnf ---\n\n"); - } - - /* Find minimal negative conjunct */ - { - Conjunct *min_conj = NULL; - int min_cost = INT_MAX; - DNF_Iterator min_p; - int live_count = 0; - for(DNF_Iterator q(neg_conjs); q.live(); q.next()) { - Conjunct *neg_conj = q.curr(); - if(neg_conj!=NULL) { - live_count++; - if(neg_conj->cost() < min_cost) { - min_conj = neg_conj; - min_cost = neg_conj->cost(); - min_p = q; - } - } - } - - /* Negate minimal conjunct, AND result with positive conjunct */ - if(weak || min_conj==NULL) { - ret_dnf->add_conjunct(positive_conjunct); - positive_conjunct = NULL; - } - else if (min_cost == CantBeNegated) { - static int OMEGA_WHINGE = -1; - if (OMEGA_WHINGE < 0) { - OMEGA_WHINGE = getenv("OMEGA_WHINGE") ? atoi(getenv("OMEGA_WHINGE")) : 0; - } - if (OMEGA_WHINGE) { - fprintf(stderr, "Ignoring negative clause that can't be negated and generating inexact result\n"); - if (!pres_debug) fprintf(DebugFile, "Ignoring negative clause that can't be negated and generating inexact result\n"); - } - - positive_conjunct->make_inexact(); - ret_dnf->add_conjunct(positive_conjunct); - positive_conjunct = NULL; - if(pres_debug) - fprintf(DebugFile, "Ignoring negative clause that can't be negated and generating inexact upper bound\n"); - } - else { - DNF *neg_dnf = negate_conj(min_conj); - delete min_conj; - min_p.curr_set(NULL); - DNF *new_pos = DNF_and_conj(neg_dnf, positive_conjunct); - delete neg_dnf; - delete positive_conjunct; - positive_conjunct = NULL; - // new_dnf->rm_redundant_conjs(2); - if(live_count>1) { - recursive = 1; - for(DNF_Iterator pd(new_pos); pd.live(); pd.next()) { - Conjunct *conj = pd.curr(); - ret_dnf->join_DNF(conj_and_not_dnf(conj, neg_conjs->copy(conj->relation()))); - pd.curr_set(NULL); - } - delete new_pos; - } - else { - ret_dnf->join_DNF(new_pos); - } - } - } - -ReturnDNF:; - delete positive_conjunct; - delete neg_conjs; - - //if (recursive) ret_dnf->rm_redundant_conjs(1); - - if(pres_debug) { - fprintf(DebugFile, "] conj_and_not_dnf RETURN:\n"); - ret_dnf->prefix_print(DebugFile); - fprintf(DebugFile, "\n\n"); - } - use_ugly_names--; - return ret_dnf; -} - -/* first some functions for manipulating oc "problems" */ - -static void EqnnZero(eqn *e, int s) { -// memset((char*)e, 0, (headerWords+1+s)*sizeof(int)); - e->key = 0; - e->touched = 0; - e->color = EQ_BLACK; - e->essential = 0; - e->varCount = 0; - for (int i = 0; i <= s; i++) - e->coef[i] = 0; -} - -/* - * Make a new black equation in a given problem - */ -static int NewEquation(Problem *p) { - int e = p->newEQ(); - EqnnZero(&p->EQs[e], p->nVars); - return e; -} - -/* - * Make a new black inequality in a given problem - */ -static int NewInequality(Problem *p) { - int g = p->newGEQ(); - EqnnZero(&p->GEQs[g], p->nVars); - return g; -} - -// -// ~CONJ -> DNF -// -DNF* negate_conj(Conjunct* conj) { - if(pres_debug) { - fprintf(DebugFile, "%%%%%% negate_conj IN %%%%%%\n"); - conj->prefix_print(DebugFile); - fprintf(DebugFile, "\n"); - } - - DNF* new_dnf = new DNF; - Problem *p = conj->problem; - int i, j,k; - - if (!conj->is_exact()) new_dnf->add_conjunct(conj->copy_conj_same_relation()); - - Conjunct* true_part = new Conjunct(NULL, conj->relation()); - Problem *tp = true_part->problem; - copy_conj_header(true_part, conj); - true_part->invalidate_leading_info(); - int *wildCard = new int[p->nGEQs]; - int *handleIt = new int[p->nVars+1]; - for(j=1; j<=p->nVars; j++) handleIt[j] = false; - - for(i=0; inGEQs; i++) { - wildCard[i] = 0; - for(j=1; j<=p->nVars; j++) { - Variable_ID v = conj->mappedVars[j]; - if(v->kind()==Wildcard_Var && p->GEQs[i].coef[j]!=0) { - assert(wildCard[i] == 0); - handleIt[j] = true; - if (p->GEQs[i].coef[j] > 0) wildCard[i] = j; - else wildCard[i] = -j; - } - } - } - - for(i=0; inGEQs; i++) if (wildCard[i] == 0) { - /* ~(ax + by + c >= 0) = (-ax -by -c-1 >= 0) */ - Conjunct* new_conj = true_part->copy_conj_same_relation(); - Problem *np = new_conj->problem; - new_conj->exact=true; - int n_e = NewInequality(np); - int t_e = NewInequality(tp); - np->GEQs[n_e].coef[0] = -p->GEQs[i].coef[0]-1; - tp->GEQs[t_e].coef[0] = p->GEQs[i].coef[0]; - for(j=1; j<=p->nVars; j++) { - Variable_ID v = conj->mappedVars[j]; - if(v->kind()==Wildcard_Var && p->GEQs[i].coef[j]!=0) { - assert(0 && "negate_conj: wildcard in inequality"); - } - np->GEQs[n_e].coef[j] = -p->GEQs[i].coef[j]; - tp->GEQs[t_e].coef[j] = p->GEQs[i].coef[j]; - - } - assert(j-1 == p->nVars); - assert(j-1 == conj->mappedVars.size()); - new_dnf->add_conjunct(new_conj); - } - - - for(i=0; inEQs; i++) { - int wc_no = 0; - int wc_j = 0; // make complier shut up - for(j=1; j<=p->nVars; j++) { - Variable_ID v = conj->mappedVars[j]; - if(v->kind()==Wildcard_Var && p->EQs[i].coef[j]!=0) { - wc_no++; - wc_j = j; - } - } - - if(wc_no!=0) { -#if ! defined NDEBUG - int i2; - assert(!handleIt[wc_j]); - for(i2=0; i2nEQs; i2++) - if(i != i2 && p->EQs[i2].coef[wc_j] != 0) break; - assert(i2 >= p->nEQs); -#endif - assert(wc_no == 1 && "negate_conj: more than 1 wildcard in equality"); - - // === Negating equality with a wildcard for K>0 === - // ~(exists v st expr + K v + C = 0) = - // (exists v st 1 <= - expr - K v - C <= K-1) - - Conjunct *nc = true_part->copy_conj_same_relation(); - Problem *np = nc->problem; - nc->exact=true; - - // -K alpha = expr <==> K alpha = expr - if(p->EQs[i].coef[wc_j]<0) - p->EQs[i].coef[wc_j] = -p->EQs[i].coef[wc_j]; - - if(p->EQs[i].coef[wc_j]==2) { - // ~(exists v st expr +2v +C = 0) = - // (exists v st -expr -2v -C = 1) - // That is (expr +2v +C+1 = 0) - int e = NewEquation(np); - np->EQs[e].coef[0] = p->EQs[i].coef[0] +1; - for(j=1; j<=p->nVars; j++) { - np->EQs[e].coef[j] = p->EQs[i].coef[j]; - } - } - else { - // -expr -Kv -C-1 >= 0 - int e = NewInequality(np); - np->GEQs[e].coef[0] = -p->EQs[i].coef[0] -1; - for(j=1; j<=p->nVars; j++) { - np->GEQs[e].coef[j] = -p->EQs[i].coef[j]; - } - - // +expr +Kv +C+K-1 >= 0 - e = NewInequality(np); - np->GEQs[e].coef[0] = p->EQs[i].coef[0] +p->EQs[i].coef[wc_j] -1; - for(j=1; j<=p->nVars; j++) { - np->GEQs[e].coef[j] = p->EQs[i].coef[j]; - } - } - - new_dnf->add_conjunct(nc); - - } - else { - /* ~(ax + by + c = 0) = (-ax -by -c-1 >= 0) Or (ax + by + c -1 >= 0) */ - Conjunct *nc1 = true_part->copy_conj_same_relation(); - Conjunct *nc2 = true_part->copy_conj_same_relation(); - Problem* np1 = nc1->problem; - Problem* np2 = nc2->problem; - nc1->invalidate_leading_info(); - nc2->invalidate_leading_info(); - nc1->exact=true; - nc2->exact=true; - int n_e1 = NewInequality(np1); - int n_e2 = NewInequality(np2); - np1->GEQs[n_e1].coef[0] = -p->EQs[i].coef[0]-1; - np2->GEQs[n_e2].coef[0] = p->EQs[i].coef[0]-1; - for(j=1; j<=p->nVars; j++) { - coef_t coef = p->EQs[i].coef[j]; - np1->GEQs[n_e1].coef[j] = -coef; - np2->GEQs[n_e2].coef[j] = coef; - } - new_dnf->add_conjunct(nc1); - new_dnf->add_conjunct(nc2); - } - { - int e = NewEquation(tp); - tp->EQs[e].coef[0] = p->EQs[i].coef[0]; - for(j=1; j<=p->nVars; j++) - tp->EQs[e].coef[j] = p->EQs[i].coef[j]; - } - } - - for(j=1; j<=p->nVars; j++) - if (handleIt[j]) { - for(i=0; inGEQs; i++) - if (wildCard[i] == j) - for(k=0; knGEQs; k++) if (wildCard[k] == -j){ - // E_i <= c_i alpha - // c_k alpha <= E_k - // c_k E_i <= c_i c_k alpha <= c_i E_k - // c_k E_i <= c_i c_k floor (c_i E_k / c_i c_k) - // negating: - // c_k E_i > c_i c_k floor (c_i E_k / c_i c_k) - // c_k E_i > c_i c_k beta > c_i E_k - c_i c_k - // c_k E_i - 1 >= c_i c_k beta >= c_i E_k - c_i c_k + 1 - Conjunct* new_conj = true_part->copy_conj_same_relation(); - Problem *np = new_conj->problem; - coef_t c_k = - p->GEQs[k].coef[j]; - coef_t c_i = p->GEQs[i].coef[j]; - assert(c_k > 0); - assert(c_i > 0); - new_conj->exact=true; - int n_e = NewInequality(np); - // c_k E_i - 1 >= c_i c_k beta - int v; - for(v=0; v<=p->nVars; v++) { - np->GEQs[n_e].coef[v] = - c_k * p->GEQs[i].coef[v]; - } - np->GEQs[n_e].coef[j] = -c_i * c_k; - np->GEQs[n_e].coef[0]--; - - n_e = NewInequality(np); - // c_i c_k beta >= c_i E_k - c_i c_k + 1 - // c_i c_k beta + c_i c_k -1 >= c_i E_k - for(v=0; v<=p->nVars; v++) { - np->GEQs[n_e].coef[v] = - c_i * p->GEQs[k].coef[v]; - } - np->GEQs[n_e].coef[j] = c_i * c_k; - np->GEQs[n_e].coef[0] += c_i * c_k -1; - - new_dnf->add_conjunct(new_conj); - } - } - - if(pres_debug) { - fprintf(DebugFile, "%%%%%% negate_conj OUT %%%%%%\n"); - new_dnf->prefix_print(DebugFile); - } - delete true_part; - delete[] wildCard; - delete[] handleIt; - return(new_dnf); -} - - - - -/////////////////////////////////////////////////////// -// DNFize formula -- this is the real simplification // -// It also destroys the formula it simplifies // -/////////////////////////////////////////////////////// - - - -// -// Try to separate positive and negative clauses below the AND, -// letting us use the techniques described in Pugh & Wonnacott: -// "An Exact Method for Value-Based Dependence Analysis" -// - - -DNF* F_And::DNFize() { - Conjunct *positive_conjunct = NULL; - DNF *neg_conjs = new DNF; - List pos_dnfs; - List_Iterator pos_dnf_i; - DNF *new_dnf = new DNF; - int JustReturnDNF = 0; - - use_ugly_names++; - - if(pres_debug) { - fprintf(DebugFile, "\nF_And:: DNFize [\n"); - prefix_print(DebugFile); - } - - if(children().empty()) { - Conjunct * c=new Conjunct(NULL, relation()); - new_dnf->add_conjunct(c); - } - else { - while(!children().empty()) { - Formula* carg = children().remove_front(); - if(carg->node_type()==Op_Not) { - // DNF1 & ~DNF2 -> DNF - DNF *dnf = carg->children().remove_front()->DNFize(); - delete carg; - neg_conjs->join_DNF(dnf); // negative conjunct - } - else { - // DNF1 & DNF2 -> DNF - DNF *dnf = carg->DNFize(); - int dl = dnf->length(); - if(dl==0) { - // DNF & false -> false - delete this; - JustReturnDNF = 1; - break; - } - else if(dl==1) { - // positive conjunct - Conjunct *conj = dnf->rm_first_conjunct(); - delete dnf; - if(positive_conjunct==NULL) { - positive_conjunct = conj; - } - else { - Conjunct *new_conj = merge_conjs(positive_conjunct, conj, MERGE_REGULAR); - delete conj; - delete positive_conjunct; - positive_conjunct = new_conj; - } - } - else { - // positive DNF - pos_dnfs.append(dnf); - } - } - } - - if (!JustReturnDNF) { - Rel_Body * my_relation = relation(); - delete this; - - // If we have a positive_conjunct, it can serve as the 1st arg to - // conj_and_not_dnf. Otherwise, if pos_dnfs has one DNF, - // use each conjunct there for this purpose. - // Only pass "true" here if there is nothing else to try, - // as long as TRY_TO_AVOID_TRUE_AND_NOT_DNF is set. - // - // Perhaps we should even try to and multiple DNF's? - - if (!positive_conjunct && pos_dnfs.length() == 1) { - if(pres_debug) { - fprintf(DebugFile, "--- F_AND::DNFize() Single pos_dnf:\n"); - pos_dnfs[1]->prefix_print(DebugFile); - fprintf(DebugFile, "--- F_AND::DNFize() vs neg_conjs:\n"); - neg_conjs->prefix_print(DebugFile); - } - - DNF *real_neg_conjs = new DNF; - for (DNF_Iterator nc(neg_conjs); nc; nc++) { - if (simplify_conj((*nc), true, false, EQ_BLACK) != false) - real_neg_conjs->add_conjunct(*nc); - (*nc) = 0; - } - delete neg_conjs; - neg_conjs = real_neg_conjs; - - for(DNF_Iterator pc(pos_dnfs[1]); pc; pc++) { - new_dnf->join_DNF(conj_and_not_dnf((*pc), neg_conjs->copy((*pc)->relation()))); - (*pc) = 0; - } - } - else if(positive_conjunct==NULL && neg_conjs->is_definitely_false()) { - pos_dnf_i = List_Iterator(pos_dnfs); - delete new_dnf; - new_dnf = *pos_dnf_i; - *pos_dnf_i = NULL; - pos_dnf_i++; - for ( ; pos_dnf_i; pos_dnf_i++) { - DNF *pos_dnf = *pos_dnf_i; - new_dnf = DNF_and_DNF(new_dnf, pos_dnf); - *pos_dnf_i = NULL; - } - } - else { - if(positive_conjunct==NULL) { - static int OMEGA_WHINGE = -1; - if (OMEGA_WHINGE < 0) { - OMEGA_WHINGE = getenv("OMEGA_WHINGE") ? atoi(getenv("OMEGA_WHINGE")) : 0; - } - - if (pres_debug || OMEGA_WHINGE) { - fprintf(DebugFile, "Uh-oh: F_AND::DNFize() resorting to TRUE and not DNF\n"); - fprintf(DebugFile, "--- F_AND::DNFize() neg_conjs\n"); - neg_conjs->prefix_print(DebugFile); - fprintf(DebugFile, "--- F_AND::DNFize() pos_dnfs:\n"); - for (pos_dnf_i=List_Iterator(pos_dnfs); pos_dnf_i; pos_dnf_i++) { - (*pos_dnf_i)->prefix_print(DebugFile); - fprintf(DebugFile,"---- --\n"); - } - } - if (OMEGA_WHINGE) { - fprintf(stderr, "Uh-oh: F_AND::DNFize() resorting to TRUE and not DNF\n"); - fprintf(stderr, "--- F_AND::DNFize() neg_conjs\n"); - neg_conjs->prefix_print(stderr); - fprintf(stderr, "--- F_AND::DNFize() pos_dnfs:\n"); - for (pos_dnf_i=List_Iterator(pos_dnfs); pos_dnf_i; pos_dnf_i++) { - (*pos_dnf_i)->prefix_print(stderr); - fprintf(stderr,"---- --\n"); - } - } - positive_conjunct = new Conjunct(NULL, my_relation); - } - - if(!neg_conjs->is_definitely_false()) { - new_dnf->join_DNF(conj_and_not_dnf(positive_conjunct, neg_conjs)); - neg_conjs = NULL; - } - else { - new_dnf->add_conjunct(positive_conjunct); - } - positive_conjunct = NULL; - - // - // AND it with positive DNFs - // - if(pres_debug) { - fprintf(DebugFile, "--- F_AND::DNFize() pos_dnfs:\n"); - for (pos_dnf_i=List_Iterator(pos_dnfs); pos_dnf_i; pos_dnf_i++) - (*pos_dnf_i)->prefix_print(DebugFile); - } - for (pos_dnf_i = List_Iterator(pos_dnfs); pos_dnf_i; pos_dnf_i++) { - DNF *pos_dnf = *pos_dnf_i; - new_dnf = DNF_and_DNF(new_dnf, pos_dnf); - *pos_dnf_i = NULL; - } - } - } - } - - delete positive_conjunct; - delete neg_conjs; - for (pos_dnf_i = List_Iterator(pos_dnfs); pos_dnf_i; pos_dnf_i++) - delete *pos_dnf_i; - - if(pres_debug) { - fprintf(DebugFile, "] F_AND::DNFize() OUT \n"); - new_dnf->prefix_print(DebugFile); - } - - use_ugly_names--; - - return new_dnf; -} - -// -// ~ dnf = true ^ ~ dnf, so just call conj_and_not_dnf -// - -DNF* F_Not::DNFize() { - Conjunct *positive_conjunct = new Conjunct(NULL, relation()); - DNF *neg_conjs = children().remove_front()->DNFize(); - delete this; - DNF *new_dnf = conj_and_not_dnf(positive_conjunct, neg_conjs); - - if(pres_debug) { - fprintf(DebugFile, "=== F_NOT::DNFize() OUT ===\n"); - new_dnf->prefix_print(DebugFile); - } - return new_dnf; -} - - -// -// or is almost in DNF already: -// - -DNF* F_Or::DNFize() { - DNF* new_dnf = new DNF; - bool empty_or=true; - - while(!children().empty()) { - DNF* c_dnf = children().remove_front()->DNFize(); - new_dnf->join_DNF(c_dnf); - empty_or=false; - } - - - delete this; - - if(pres_debug) { - fprintf(DebugFile, "=== F_OR::DNFize() OUT ===\n"); - new_dnf->prefix_print(DebugFile); - } - return(new_dnf); -} - - -// -// exists x : (c1 v c2 v ...) --> (exists x : c1) v (exists x : c2) v ... -// - -DNF* F_Exists::DNFize() { - DNF *dnf = children().remove_front()->DNFize(); - - for (DNF_Iterator pd(dnf); pd.live(); pd.next()) { - Conjunct *conj = pd.curr(); - - // can simply call localize_vars for DNF with a single conjunct - Variable_ID_Tuple locals_copy(myLocals.size()); - copy_var_decls(locals_copy, myLocals); - conj->push_exists(locals_copy); - conj->remap(); - reset_remap_field(myLocals); - - conj->r_constrs = 0; - conj->simplified = false; // who knows - conj->cols_ordered = false; - } - delete this; - - if(pres_debug) { - fprintf(DebugFile, "=== F_EXISTS::DNFize() OUT ===\n"); - dnf->prefix_print(DebugFile); - } - return(dnf); -} - - -// -// Single conjunct is already in DNF. -// - -DNF* Conjunct::DNFize() { - assert(!is_compressed()); - DNF *results = new DNF; - - if (is_true()) { - simplified = true; - verified = true; - results->add_conjunct(this); - } - else { - results->add_conjunct(this); - } - - return results; -} - - -// -// Foralls should have been removed before we get to DNFize -// - -DNF* F_Forall::DNFize() { - assert(0); - return(NULL); -} - -void DNF::count_leading_0s() { - if (conjList.empty()) - return; - - for (DNF_Iterator conj(this); conj; conj++) { - (*conj)->count_leading_0s(); - } -} - - -// return x s.t. forall conjuncts c, c has >= x leading 0s -// if set, always returns -1; arg tells you if it's a set or relation. - -int DNF::query_guaranteed_leading_0s(int what_to_return_for_empty_dnf) { - count_leading_0s(); - int result = what_to_return_for_empty_dnf; // if set, -1; if rel, 0 - bool first = true; - - for (DNF_Iterator conj(this); conj; conj++) { - int tmp = (*conj)->query_guaranteed_leading_0s(); - assert(tmp >= 0 || ((*conj)->relation()->is_set() && tmp == -1)); - if (first || tmp < result) result = tmp; - first = false; - } - - return result; -} - -// return x s.t. forall conjuncts c, c has <= x leading 0s -// if no conjuncts, return the argument - -int DNF::query_possible_leading_0s(int n_input_and_output) { - count_leading_0s(); - int result = n_input_and_output; - bool first = true; - - for (DNF_Iterator conj(this); conj; conj++) { - int tmp = (*conj)->query_possible_leading_0s(); - assert(tmp >= 0 || (tmp == -1 && (*conj)->relation()->is_set())); - if (first || tmp > result) result = tmp; - first = false; - } - - return result; -} - - -// return 0 if we don't know, or +-1 if we do - -int DNF::query_leading_dir() { - count_leading_0s(); - int result = 0; - bool first = true; - - for (DNF_Iterator conj(this); conj; conj++) { - int glz = (*conj)->query_guaranteed_leading_0s(); - int plz = (*conj)->query_possible_leading_0s(); - int rlz = 0; // shut the compiler up - if (glz != plz) - return 0; - - if (first) { - rlz = glz; - result = (*conj)->query_leading_dir(); - first = false; - } - else - if (glz != rlz || result != (*conj)->query_leading_dir()) - return 0; - } - - return result; -} - -void Conjunct::count_leading_0s() { - Rel_Body *body = relation(); - int max_depth = min(body->n_inp(), body->n_out()); - if(body->is_set()) { - assert(guaranteed_leading_0s == -1 && possible_leading_0s == -1); -// guaranteed_leading_0s = possible_leading_0s = -1; - leading_dir = 0; - return; - } - - -#if ! defined NDEBUG - assert_leading_info(); -#endif - if (guaranteed_leading_0s < 0) { - int L; - for (L=1; L <= max_depth; L++) { - Variable_ID in = body->input_var(L), out = body->output_var(L); - coef_t min, max; - bool guaranteed; - - query_difference(out, in, min, max, guaranteed); - if (min < 0 || max > 0) { - if (min > 0 || max < 0) { // we know guaranteed & possible - guaranteed_leading_0s = possible_leading_0s = L-1; - if (min > 0) // We know its 0,..,0,+ - leading_dir = 1; - else // We know its 0,..,0,- - leading_dir = -1; - return; - } - break; - } - } - guaranteed_leading_0s = L-1; - for ( ; L <= max_depth; L++) { - Variable_ID in = body->input_var(L), - out = body->output_var(L); - coef_t min, max; - bool guaranteed; - - query_difference(out, in, min, max, guaranteed); - - if (min > 0 || max < 0) break; - } - possible_leading_0s = L-1; - } -#if ! defined NDEBUG - assert_leading_info(); -#endif -} - -// -// add level-carried DNF form out to level "level" -// - - -void DNF::make_level_carried_to(int level) { - count_leading_0s(); - Rel_Body *body = 0; // make compiler shut up - if (length() > 0 && !(body = conjList.front()->relation())->is_set()) { - // LCDNF makes no sense otherwise - Relation tmp; -#ifndef NDEBUG - tmp = Relation(*body,42); -#endif - - DNF *newstuff = new DNF; - int shared_depth = min(body->n_inp(), body->n_out()); - int split_to = level >= 0 ? min(shared_depth,level) : shared_depth; - - skip_finalization_check++; - EQ_Handle e; - - for (DNF_Iterator conj(this); conj; conj++) { - assert(body = (*conj)->relation()); - int leading_eqs; - - bool is_guaranteed = (*conj)->verified; - - for (leading_eqs=1; leading_eqs <= split_to; leading_eqs++) { - Variable_ID in = body->input_var(leading_eqs), - out = body->output_var(leading_eqs); - coef_t min, max; - bool guaranteed; - - if (leading_eqs > (*conj)->possible_leading_0s && - (*conj)->leading_dir_valid_and_known()) { - leading_eqs--; - break; - } - - if (leading_eqs > (*conj)->guaranteed_leading_0s) { - (*conj)->query_difference(out, in, min, max, guaranteed); - if (min > 0 || max < 0) guaranteed = true; -// fprintf(DebugFile,"Make level carried, %d <= diff%d <= %d (%d):\n", -// min,leading_eqs,max,guaranteed); -// use_ugly_names++; -// (*conj)->prefix_print(DebugFile); -// use_ugly_names--; - if (!guaranteed) is_guaranteed = false; - bool generateLTClause = min < 0; - bool generateGTClause = max > 0; - bool retainEQClause = (leading_eqs <= (*conj)->possible_leading_0s && - min <= 0 && max >= 0); - if (!(generateLTClause || generateGTClause || retainEQClause)) { - // conjunct is infeasible - if (pres_debug) { - fprintf(DebugFile, "Conjunct discovered to be infeasible during make_level_carried_to(%d):\n", level); - (*conj)->prefix_print(DebugFile); - } -#if ! defined NDEBUG - Conjunct *cpy = (*conj)->copy_conj_same_relation(); - assert(!simplify_conj(cpy, true, 32767, 0)); -#endif - } - - if (generateLTClause) { - Conjunct *lt; - if (!generateGTClause && !retainEQClause) - lt = *conj; - else - lt = (*conj)->copy_conj_same_relation(); - if (max >= 0) { - GEQ_Handle l = lt->add_GEQ(); // out in-out-1>=0 - l.update_coef_during_simplify(in, 1); - l.update_coef_during_simplify(out, -1); - l.update_const_during_simplify(-1); - } - lt->guaranteed_leading_0s - = lt->possible_leading_0s = leading_eqs-1; - lt->leading_dir = -1; - if (is_guaranteed) { - /* - fprintf(DebugFile,"Promising solutions to: %d <= diff%d <= %d (%d):\n", - min,leading_eqs,max,guaranteed); - use_ugly_names++; - lt->prefix_print(DebugFile); - use_ugly_names--; - */ - lt->promise_that_ub_solutions_exist(tmp); - } - else if (0) { - fprintf(DebugFile,"Can't guaranteed solutions to:\n"); - use_ugly_names++; - lt->prefix_print(DebugFile); - use_ugly_names--; - } - if (generateGTClause || retainEQClause) - newstuff->add_conjunct(lt); - } - - if (generateGTClause) { - Conjunct *gt; - if (retainEQClause) gt = (*conj)->copy_conj_same_relation(); - else gt = *conj; - if (min <= 0) { - GEQ_Handle g = gt->add_GEQ(); // out>in ==> out-in-1>=0 - g.update_coef_during_simplify(in, -1); - g.update_coef_during_simplify(out, 1); - g.update_const_during_simplify(-1); - } - gt->guaranteed_leading_0s = - gt->possible_leading_0s = leading_eqs-1; - gt->leading_dir = 1; - if (is_guaranteed) { - /* - fprintf(DebugFile,"Promising solutions to: %d <= diff%d <= %d (%d):\n", - min,leading_eqs,max,guaranteed); - use_ugly_names++; - gt->prefix_print(DebugFile); - use_ugly_names--; - */ - gt->promise_that_ub_solutions_exist(tmp); - } - else if (0) { - fprintf(DebugFile,"Can't guaranteed solutions to:\n"); - use_ugly_names++; - gt->prefix_print(DebugFile); - use_ugly_names--; - } - if (retainEQClause) newstuff->add_conjunct(gt); - } - - if (retainEQClause) { - assert(min <= 0 && 0 <= max); - - if (min < 0 || max > 0) { - e = (*conj)->add_EQ(1); - e.update_coef_during_simplify(in, -1); - e.update_coef_during_simplify(out, 1); - } - - assert((*conj)->guaranteed_leading_0s == -1 - || leading_eqs > (*conj)->guaranteed_leading_0s); - assert((*conj)->possible_leading_0s == -1 - || leading_eqs <= (*conj)->possible_leading_0s); - - (*conj)->guaranteed_leading_0s = leading_eqs; - } - else break; - } - - { - Set already_done; - int remapped = 0; - - assert((*conj)->guaranteed_leading_0s == -1 - || leading_eqs <= (*conj)->guaranteed_leading_0s); - - for (Variable_ID_Iterator func(*body->global_decls()); func; func++) { - Global_Var_ID f = (*func)->get_global_var(); - if (!already_done.contains(f) && - body->has_local(f, Input_Tuple) && - body->has_local(f, Output_Tuple) && - f->arity() == leading_eqs) { - already_done.insert(f); - - // add f(in) = f(out), project one away - e = (*conj)->add_EQ(1); - Variable_ID f_in =body->get_local(f,Input_Tuple); - Variable_ID f_out =body->get_local(f,Output_Tuple); - - e.update_coef_during_simplify(f_in, -1); - e.update_coef_during_simplify(f_out, 1); - - f_out->remap = f_in; - remapped = 1; - is_guaranteed = false; - } - } - - if (remapped) { - (*conj)->remap(); - (*conj)->combine_columns(); - reset_remap_field(*body->global_decls()); - remapped = 0; - } - } - } - if (is_guaranteed) - (*conj)->promise_that_ub_solutions_exist(tmp); - else if (0) { - fprintf(DebugFile,"Can't guaranteed solutions to:\n"); - use_ugly_names++; - (*conj)->prefix_print(DebugFile); - use_ugly_names--; - } - } - - skip_finalization_check--; - join_DNF(newstuff); - } - -#if ! defined NDEBUG - for (DNF_Iterator c(this); c; c++) - (*c)->assert_leading_info(); -#endif - - simplify(); -} - -void DNF::remove_inexact_conj() { - bool found_inexact=false; - - do { - bool first=true; - found_inexact=false; - DNF_Iterator c_prev; - for (DNF_Iterator c(this); c; c++) { - if (!(*c)->is_exact()) { // remove it from the list - found_inexact=true; - delete (*c); - if (first) - conjList.del_front(); - else - conjList.del_after(c_prev); - break; - } - else { - first=false; - c_prev=c; - } - } - } - while (found_inexact); -} - - -int s_rdt_constrs; - -// -// Simplify all conjuncts in a DNF -// -void DNF::simplify() { - for (DNF_Iterator pd(this); pd.live(); ) { - Conjunct *conj = pd.curr(); - pd.next(); - if(s_rdt_constrs >= 0 && !simplify_conj(conj, true, s_rdt_constrs, EQ_BLACK)) { - rm_conjunct(conj); - } - } -} - -} // namespace diff --git a/omega/omega_lib/src/pres_form.cc b/omega/omega_lib/src/pres_form.cc deleted file mode 100644 index 82b710b..0000000 --- a/omega/omega_lib/src/pres_form.cc +++ /dev/null @@ -1,147 +0,0 @@ -#include -#include -#include -#include -#include - -namespace omega { - -// -// Children and parents. -// -void Formula::remove_child(Formula *kid) { - assert(&kid->parent() == this); - if (myChildren.front() == kid) - myChildren.del_front(); - else { - List_Iterator j,k; - for(j=List_Iterator(myChildren); *j != kid && j; k=j, j++) - ; - - if (k) - myChildren.del_after(k); - else - assert(0 && "Child to be removed not found in child list"); - } -} - - -void Formula::add_child(Formula *kid) { - assert(can_add_child()); - myChildren.append(kid); - kid->myParent = this; - kid->myRelation = this->relation(); -} - -void Formula::replace_child(Formula *child, Formula* new_child) { - assert(&child->parent() == this); - for(List_Iterator LI(myChildren); LI; LI++) - if(*LI == child) { - *LI = new_child; - new_child->myParent = this; - new_child->myRelation = this->relation(); - break; - } -} - -void Formula::set_parent(Formula *parent, Rel_Body *reln) { - myParent = parent; - myRelation = reln; - for(List_Iterator c(myChildren); c; c++) - (*c)->set_parent(this,reln); -} - -// -// Function that sets myRelation pointers in a tree. -// -void Formula::set_relation(Rel_Body *r) { - myRelation = r; - for(List_Iterator FI(myChildren); FI; FI++) - (*FI)->set_relation(r); -} - - -// -// Function that descends to conjuncts to merge columns -// -void Formula::combine_columns() { - foreach(child,Formula *,myChildren,child->combine_columns()); -} - - -void Formula::finalize() { - for(List_Iterator c(children()); c; c++) - (*c)->finalize(); -} - -bool Formula::can_add_child() { - return true; -} - - - -Conjunct *Formula::really_conjunct() { - assert(0 && "really_conjunct() called on something that wasn't"); - return NULL; -} - -Formula::Formula(Formula *p, Rel_Body *r): myParent(p), myRelation(r) { -} - - -void Formula::verify_tree() { // should be const -#if ! defined NDEBUG - Any_Iterator c = myChildren.any_iterator(); - for (; c; c++) { - assert((*c)->myParent==this); - assert((*c)->myRelation==this->myRelation); - (*c)->verify_tree(); - } -#endif -} - -Formula *Formula::copy(Formula *, Rel_Body *) { - assert(0); - return NULL; -} - -Formula::~Formula() { - for(List_Iterator c(myChildren); c; c++) { - delete *c; - } - myChildren.clear(); -} - -void Formula::assert_not_finalized() { - if (!skip_finalization_check) { - assert(! relation()->is_finalized()); - assert(! relation()->is_shared()); - } -} - -void Formula::reverse_leading_dir_info() { - for(List_Iterator c(myChildren); c; c++) - (*c)->reverse_leading_dir_info(); -} - -void Formula::invalidate_leading_info(int changed) { - for(List_Iterator c(myChildren); c; c++) - (*c)->invalidate_leading_info(changed); -} - -void Formula::enforce_leading_info(int guaranteed, int possible, int dir) { - for(List_Iterator c(myChildren); c; c++) - (*c)->enforce_leading_info(guaranteed, possible, dir); -} - -// -// Push_exists functions. -// Push exists takes responsibility for the Variable_ID's in the Tuple. -// It should: -// * Re-use them, or -// * Delete them. -void Formula::push_exists(Variable_ID_Tuple &) { - assert(0); -} - -} // namespace diff --git a/omega/omega_lib/src/pres_gen.cc b/omega/omega_lib/src/pres_gen.cc deleted file mode 100644 index 0f05d40..0000000 --- a/omega/omega_lib/src/pres_gen.cc +++ /dev/null @@ -1,45 +0,0 @@ -#include - -namespace omega { - -int skip_finalization_check=0; -// int skip_set_checks=0; - -int pres_debug=0 ; -FILE *DebugFile=stderr; // This is the default; it's best to set it yourself. - -negation_control pres_legal_negations = any_negation; - -// -// I/O utility functions. -// -// void PresErrAssert(const char *t) { -// fprintf(stdout, "\nERROR: %s\n", t); -// if(pres_debug) { -// fprintf(DebugFile, "\nERROR: %s\n", t); -// } -// exit(1); -// } - - - -// -// Needed for gprof -// -#if defined PROFILE_MALLOCS -void* operator new(size_t n) { - void *result = malloc (n < 1 ? 1 : n); - if (result) - return result; - else { - write(2,"Virtual memory exceeded in new\n",32); - return 0; - } -} - -void operator delete (void* f) { - if (f) free(f); -} -#endif - -} // namespace diff --git a/omega/omega_lib/src/pres_logic.cc b/omega/omega_lib/src/pres_logic.cc deleted file mode 100644 index 8ee90f1..0000000 --- a/omega/omega_lib/src/pres_logic.cc +++ /dev/null @@ -1,226 +0,0 @@ -#include -#include -#include -#include - -namespace omega { - -GEQ_Handle F_And::add_GEQ(int preserves_level) { - assert_not_finalized(); - if (pos_conj == NULL || pos_conj->problem->nGEQs >= maxGEQs) { - pos_conj = NULL; - for(List_Iterator c(children()); c; c++) { - if ((*c)->node_type()==Op_Conjunct && - ((*c)->really_conjunct())->problem->nGEQs < maxGEQs) { - pos_conj = (*c)->really_conjunct(); - break; - } - } - if(!pos_conj) pos_conj = add_conjunct();// FERD -- set level if preserved? - } - return pos_conj->add_GEQ(preserves_level); -} - - -EQ_Handle F_And::add_EQ(int preserves_level) { - assert_not_finalized(); - if (pos_conj == NULL || pos_conj->problem->nEQs >= maxEQs) { - pos_conj = NULL; - for(List_Iterator c(children()); c; c++) { - if ((*c)->node_type()==Op_Conjunct && - ((*c)->really_conjunct())->problem->nEQs < maxEQs) { - pos_conj = (*c)->really_conjunct(); - break; - } - } - if(!pos_conj) pos_conj = add_conjunct();//FERD-set level info if preserved? - } - return pos_conj->add_EQ(preserves_level); -} - -Stride_Handle F_And::add_stride(int step, int preserves_level) { - assert_not_finalized(); - if (pos_conj == NULL || pos_conj->problem->nEQs >= maxEQs) { - pos_conj = NULL; - for(List_Iterator c(children()); c; c++) { - if ((*c)->node_type()==Op_Conjunct && - ((*c)->really_conjunct())->problem->nEQs < maxEQs) { - pos_conj = (*c)->really_conjunct(); - break; - } - } - if(!pos_conj) pos_conj = add_conjunct(); // FERD -set level if preserved? - } - return pos_conj->add_stride(step, preserves_level); -} - -GEQ_Handle F_And::add_GEQ(const Constraint_Handle &constraint, int preserves_level) { - assert_not_finalized(); - if (pos_conj == NULL || pos_conj->problem->nGEQs >= maxGEQs) { - pos_conj = NULL; - for(List_Iterator c(children()); c; c++) { - if ((*c)->node_type()==Op_Conjunct && - ((*c)->really_conjunct())->problem->nGEQs < maxGEQs) { - pos_conj = (*c)->really_conjunct(); - break; - } - } - if(!pos_conj) pos_conj = add_conjunct();// FERD -- set level if preserved? - } - return pos_conj->add_GEQ(constraint, preserves_level); -} - - -EQ_Handle F_And::add_EQ(const Constraint_Handle &constraint, int preserves_level) { - assert_not_finalized(); - if (pos_conj == NULL || pos_conj->problem->nEQs >= maxEQs) { - pos_conj = NULL; - for(List_Iterator c(children()); c; c++) { - if ((*c)->node_type()==Op_Conjunct && - ((*c)->really_conjunct())->problem->nEQs < maxEQs) { - pos_conj = (*c)->really_conjunct(); - break; - } - } - if(!pos_conj) pos_conj = add_conjunct();//FERD-set level info if preserved? - } - return pos_conj->add_EQ(constraint,preserves_level); -} - - -void F_And::add_unknown() { - assert_not_finalized(); - if (pos_conj == NULL) { - for (List_Iterator c(children()); c; c++) { - if ((*c)->node_type()==Op_Conjunct) { - pos_conj = (*c)->really_conjunct(); - break; - } - } - if(!pos_conj) pos_conj = add_conjunct(); // FERD - set level if preseved? - } - pos_conj->make_inexact(); -} - -Conjunct *F_Or::find_available_conjunct() { - return 0; -} - -Conjunct *F_Not::find_available_conjunct() { - return 0; -} - -Conjunct *F_And::find_available_conjunct() { - for(List_Iterator child(children()); child; child++) { - Conjunct *c = (*child)->find_available_conjunct(); - if (c) return c; - } - return 0; -} - - -void F_Not::finalize() { - assert(n_children() == 1); - Formula::finalize(); -} - -bool F_Not::can_add_child() { - return n_children() < 1; -} - -F_And *F_And::and_with() { - assert_not_finalized(); - assert(can_add_child()); - return this; -} - -F_And::F_And(Formula *p, Rel_Body *r): Formula(p,r), pos_conj(NULL) { -} - -F_Or::F_Or(Formula *p, Rel_Body *r): Formula(p,r){ -} - -F_Not::F_Not(Formula *p, Rel_Body *r): Formula(p,r){ -} - -Formula *F_And::copy(Formula *parent, Rel_Body *reln) { - F_And *f = new F_And(parent, reln); - for(List_Iterator c(children()); c; c++) - f->children().append((*c)->copy(f,reln)); - return f; -} - -Formula *F_Or::copy(Formula *parent, Rel_Body *reln) { - F_Or *f = new F_Or(parent, reln); - for(List_Iterator c(children()); c; c++) - f->children().append((*c)->copy(f,reln)); - return f; -} - -Formula *F_Not::copy(Formula *parent, Rel_Body *reln) { - F_Not *f = new F_Not(parent, reln); - for(List_Iterator c(children()); c; c++) - f->children().append((*c)->copy(f,reln)); - return f; -} - -// -// Create F_Exists nodes below this F_Or. -// Copy list S to each of the created nodes. -// Push_exists takes responsibility for reusing or deleting Var_ID's; -// here we delete them. Must also empty out the Tuple when finished. -void F_Or::push_exists(Variable_ID_Tuple &S) { - List mc; - mc.join(children()); - - while(!mc.empty()) { - Formula *f = mc.remove_front(); - F_Exists *e = add_exists(); - - copy_var_decls(e->myLocals, S); - f->remap(); - reset_remap_field(S); - - e->add_child(f); - } - // Since these are not reused, they have to be deleted - for(Tuple_Iterator VI(S); VI; VI++) { - assert((*VI)->kind() == Exists_Var); - delete *VI; - } - S.clear(); -} - -void F_Exists::push_exists(Variable_ID_Tuple &S) { - myLocals.join(S); -} - -F_Not *Formula::add_not() { - assert_not_finalized(); - assert(can_add_child()); - F_Not *f = new F_Not(this, myRelation); - myChildren.append(f); - return f; -} - -F_And *Formula::add_and() { - assert_not_finalized(); - assert(can_add_child()); - F_And *f = new F_And(this, myRelation); - myChildren.append(f); - return f; -} - -F_And *Formula::and_with() { - return add_and(); -} - -F_Or *Formula::add_or() { - assert_not_finalized(); - assert(can_add_child()); - F_Or *f = new F_Or(this, myRelation); - myChildren.append(f); - return f; -} - -} // namespace diff --git a/omega/omega_lib/src/pres_print.cc b/omega/omega_lib/src/pres_print.cc deleted file mode 100644 index 4f2cd0d..0000000 --- a/omega/omega_lib/src/pres_print.cc +++ /dev/null @@ -1,908 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -namespace omega { - -//////////////////////////////////////// -// // -// Print functions. // -// // -//////////////////////////////////////// - -void Conjunct::reorder_for_print(bool reverseOrder, int first_pass_input, int first_pass_output, bool sort) { - Conjunct *C2 = copy_conj_same_relation(); - Variable_ID_Tuple newpos(0),wcvars(0),gvars(0); - -// We reorder the original Variable_ID's into the newpos list; later, we -// copy from their original column (using find_column) to the new one. - int n = mappedVars.size(); - int i; - // there may be more inp/outp vars than maxVars; must do dynamically - // skip_set_checks++; - Tuple input_used(myRelation->n_inp()); - Tuple output_used(myRelation->n_out()); - for(i=1; i<=myRelation->n_inp();i++) input_used[i] = false; - for(i=1; i<=myRelation->n_out();i++) output_used[i] = false; - for(i=1; i<=n;i++) { - if (mappedVars[i]->kind() == Input_Var) - input_used[mappedVars[i]->get_position()] = true; - else if (mappedVars[i]->kind() == Output_Var) - output_used[mappedVars[i]->get_position()] = true; - else if(mappedVars[i]->kind() == Global_Var) - gvars.append(mappedVars[i]); - } - - - if(sort) - for(i=1; i<=gvars.size();i++) - for(int j=1; j <= gvars.size(); j++) - if(gvars[j]->get_global_var()->base_name() - < gvars[j+1]->get_global_var()->base_name()) { - Variable_ID t = gvars[j]; gvars[j] = gvars[j+1]; gvars[j+1] = t; - } - - newpos.join(gvars); - - if(!reverseOrder) { - for(i=1; i<=min(myRelation->n_inp(),first_pass_input);i++) - if (input_used[i]) newpos.append(input_vars[i]); - for(i=1; i<=min(myRelation->n_out(),first_pass_output);i++) - if (output_used[i]) newpos.append(output_vars[i]); - for(i=max(1,first_pass_input+1); i<=myRelation->n_inp();i++) - if (input_used[i]) newpos.append(input_vars[i]); - for(i=max(1,first_pass_output+1); i<=myRelation->n_out();i++) - if (output_used[i]) newpos.append(output_vars[i]); - } - else { - for(i=1; i<=min(myRelation->n_out(),first_pass_output);i++) - if (output_used[i]) newpos.append(output_vars[i]); - for(i=1; i<=min(myRelation->n_inp(),first_pass_input);i++) - if (input_used[i]) newpos.append(input_vars[i]); - for(i=max(1,first_pass_output+1); i<=myRelation->n_out();i++) - if (output_used[i]) newpos.append(output_vars[i]); - for(i=max(1,first_pass_input+1); i<=myRelation->n_inp();i++) - if (input_used[i]) newpos.append(input_vars[i]); - } - - - for(i=1; i<=n;i++) - if (mappedVars[i]->kind() == Wildcard_Var) - wcvars.append(mappedVars[i]); - - if(sort) - for(i=1; i<=gvars.size();i++) - for(int j=1; j <= gvars.size(); j++) - if(gvars[j]->name() < gvars[j+1]->name()) { - Variable_ID t = gvars[j]; gvars[j] = gvars[j+1]; gvars[j+1] = t; - } - - newpos.join(wcvars); - - assert(problem->nVars == newpos.size()); // i.e. no other variable types - - // Copy coef columns into new order. Constant column is unchanged. - for(int e=0; enGEQs; e++) problem->GEQs[e].touched = 1; - - for(i=1; i<=problem->nVars; i++) { - int col = find_column(newpos[i]); // Find column in original conj. - assert(col != 0); - copy_column(problem, i, // Copy it from orig. column in the copy. - C2->problem, col, 0, 0); - problem->var[i] = i; - } - for(i=1; i<=problem->nVars; i++) - problem->forwardingAddress[i] = i; - - mappedVars = newpos; - delete C2; - // skip_set_checks--; -} - -void Rel_Body::print_with_subs(FILE *output_file, bool printSym, bool newline) { - std::string s = this->print_with_subs_to_string(printSym, newline); - fprintf(output_file, "%s", s.c_str()); -} - -void Rel_Body::print_with_subs() { - this->print_with_subs(stdout, 0, 1); -} - -static std::string tryToPrintVarToStringWithDiv(Conjunct *C, Variable_ID v) { - std::string s; - bool seen = false; -// This assumes that there is one EQ involving v, that v cannot be -// substituted and hence has a non-unit coefficient. - for(EQ_Iterator e(C); e; e++) { - if ((*e).get_coef(v) != 0) { - assert(!seen); // This asserts just one EQ with v - coef_t v_coef = (*e).get_coef(v); - int v_sign = v_coef > 0 ? 1 : -1; - v_coef *= v_sign; - int sign_adj = -v_sign; - - s += "intDiv("; - bool first=true; - for(Constr_Vars_Iter i(*e,false); i; i++) { - if ((*i).var != v && (*i).coef != 0) { - coef_t this_coef = sign_adj*(*i).coef; - if(!first && this_coef > 0) - s+= "+"; - if (this_coef == 1) - s += (*i).var->name(); - else if (this_coef == -1) { - s += "-"; s += (*i).var->name(); - } - else { - s += to_string(this_coef) + "*" + (*i).var->name(); - } - first = false; - } - } - coef_t the_const = (*e).get_const()* sign_adj; - if (the_const > 0 && !first) - s+= "+"; - if (the_const != 0) - s += to_string(the_const); - s += "," + to_string(v_coef) + ")"; - seen = true; - } - } - return s; -} - - -// This function prints the output tuple of a relation with each one as a -// function of the input variables. -// This will fail or look goofy if the outputs are not affine functions of -// the inputs. -// BIG WARNING: Call this only from the codegen stuff, since it assumes things -// about coefficients -std::string Rel_Body::print_outputs_with_subs_to_string() { - // Rel_Body S(this),Q(this); - Rel_Body *S = this->clone(); - Rel_Body *Q = this->clone(); - S->setup_names(); - Conjunct *C = S->single_conjunct(); - Conjunct *D = Q->single_conjunct(); // ordered_elimination futzes with conj - std::string s; // = "["; - C->reorder_for_print(); - C->ordered_elimination(S->global_decls()->length()); - // Print output names with substitutions in them - for(int i=1; i<=S->n_out(); i++) { - std::string t; - int col = C->find_column(output_vars[i]); - if (col != 0) - t = C->print_sub_to_string(col); - if (col == 0 || t == output_vars[i]->name()) // no sub found - // Assume you can't get a unit coefficient on v, must use div - t = tryToPrintVarToStringWithDiv(D, output_vars[i]); - s += t; - if (i < S->n_out()) s += ","; - } - // s += "] "; - delete S; - delete Q; - return s; -} - -std::string Rel_Body::print_outputs_with_subs_to_string(int i) { - // Rel_Body S(this),Q(this); - Rel_Body *S = this->clone(); - Rel_Body *Q = this->clone(); - S->setup_names(); - Conjunct *C = S->single_conjunct(); - Conjunct *D = Q->single_conjunct(); // ordered_elimination futzes with conj - std::string s; - C->reorder_for_print(); - C->ordered_elimination(S->global_decls()->length()); - // Print output names with substitutions in them - { - std::string t; - int col = C->find_column(output_vars[i]); - if (col != 0) - t = C->print_sub_to_string(col); - if (col == 0 || t == output_vars[i]->name()) // no sub found? - t = tryToPrintVarToStringWithDiv(D, output_vars[i]); - // should check for failure - s += t; - } - delete S; - delete Q; - return s; -} - -std::string Rel_Body::print_with_subs_to_string(bool printSym, bool newline) { - std::string s=""; - - if (pres_debug) { - fprintf(DebugFile,"print_with_subs_to_string:\n"); - prefix_print(DebugFile); - } - - int anythingPrinted = 0; - - if (this->is_null()) { - s = "NULL Rel_Body\n"; - return s; - } - - // Rel_Body R(this); - Rel_Body *R = this->clone(); - bool firstRelation = true; - - for(DNF_Iterator DI(R->query_DNF()); DI.live(); DI.next()) { - Rel_Body S(R, DI.curr()); - Conjunct *C = S.single_conjunct(); - if(!simplify_conj(C, true, 4, EQ_BLACK)) continue; - - S.setup_names(); - - if(! firstRelation) { - s += " union"; - if (newline) s += "\n "; - } - else - firstRelation = false; - - anythingPrinted = 1; - - C->reorder_for_print(false,C->max_ufs_arity_of_in(), - C->max_ufs_arity_of_out()); - C->ordered_elimination(S.Symbolic.length() - +C->max_ufs_arity_of_in() - +C->max_ufs_arity_of_out()); -// assert(C->problem->variablesInitialized); - - if (pres_debug) S.prefix_print(DebugFile); - - /* Do actual printing of Conjunct C as a relation */ - s += "{"; - - if (!Symbolic.empty()) { - if (printSym) s += "Sym=["; - for (Variable_ID_Iterator Sym_I = S.Symbolic; Sym_I;) - { - if (printSym) - s += (*Sym_I)->name(); - Sym_I++; - if (printSym && Sym_I) s+= ","; - } - if (printSym) s += "] "; - } - - int i, col; - - if (S.number_input != 0) { - s += "["; - // Print input names with substitutions in them - for(i=1; i<=S.number_input; i++) { - col = C->find_column(input_vars[i]); - if (col != 0) - s += C->problem->print_sub_to_string(col); - else - s += input_vars[i]->name(); - if (ifind_column(output_vars[i]); - if (col != 0) - s += C->problem->print_sub_to_string(col); - else - s += output_vars[i]->name(); - if (i < S.number_output) s += ","; - } - s += "] "; - } - - if (C->is_unknown()) { - if (S.number_input != 0 || S.number_output != 0) - s += ":"; - s += " UNKNOWN"; - } - else { - // Empty conj means TRUE, so don't print colon - if (C->problem->nEQs != 0 || C->problem->nGEQs != 0) { - C->problem->clearSubs(); - if (S.number_input != 0 || S.number_output != 0) - s += ":"; - s += " "; - s += C->print_to_string(false); - } - else { - if (S.number_input == 0 && S.number_output == 0) - s += " TRUE "; - } - } - - s += "}"; - } - - if (!anythingPrinted) { - R->setup_names(); - s = "{"; - s += R->print_variables_to_string(printSym); - if (R->number_input != 0 || R->number_output != 0) - s += " :"; - s += " FALSE }"; - if (newline) s += "\n"; - - delete R; - return s; - } - - if (newline) s += "\n"; - - delete R; - return s; -} - - -void print_var_addrs(std::string &s, Variable_ID v) { - if(pres_debug>=2) { - char ss[20]; - sprintf(ss, "(%p,%p)", v, v->remap); - s += ss; - } -} - -std::string Rel_Body::print_variables_to_string(bool printSym) { - std::string s=""; - - if (! Symbolic.empty()) { - if (printSym) s += " Sym=["; - for (Variable_ID_Iterator Sym_I(Symbolic); Sym_I; ) { - if (printSym) s += (*Sym_I)->name(); - print_var_addrs(s, *Sym_I); - Sym_I++; - if (printSym && Sym_I) s += ","; - } - if (printSym) s += "] "; - } - int i; - - if (number_input) { - s += "["; - for (i=1;i<=number_input;i++) { - s += input_vars[i]->name(); - print_var_addrs(s, input_vars[i]); - if(i < number_input) s += ","; - } - s += "] "; - } - - if (number_output) { - s += "-> ["; - for (i=1;i<=number_output;i++) { - s += output_vars[i]->name(); - print_var_addrs(s, output_vars[i]); - if(i < number_output) s += ","; - } - s += "] "; - } - - return s; -} - - -int F_Declaration::priority() { - return 3; -} - -int Formula::priority () { - return 0; -} - -int F_Or::priority() { - return 0; -} - -int F_And::priority() { - return 1; -} - -int Conjunct::priority() { - return 1; -} - -int F_Not::priority() { - return 2; -} - - -// -// print() functions -// -void Formula::print(FILE *output_file) { - if(myChildren.empty()) { - if(node_type()==Op_Relation || node_type()==Op_Or) - fprintf(output_file, "FALSE"); - else if(node_type()==Op_And) - fprintf(output_file, "TRUE"); - else { - assert(0); - } - } - - for(List_Iterator c(myChildren); c;) { - if (node_type() == Op_Exists || node_type() == Op_Forall - || (*c)->priority() < priority()) - fprintf(output_file, "( "); - (*c)->print(output_file); - if (node_type() == Op_Exists || node_type() == Op_Forall - || (*c)->priority() < priority()) - fprintf(output_file, " )"); - c++; - if(c.live()) - print_separator(output_file); - } -} - -std::string Rel_Body::print_formula_to_string() { - std::string s; - setup_names(); - for(DNF_Iterator DI(query_DNF()); DI.live();) { - - s += (*DI)->print_to_string(1); - DI.next(); - if (DI.live()) s += " && "; - if (pres_debug) fprintf(DebugFile,"Partial print to string: %s\n", - s.c_str()); - } - return s; -} - -void Rel_Body::print(FILE *output_file, bool printSym) { - if (this->is_null()) { - fprintf(output_file, "NULL Rel_Body\n"); - return; - } - - setup_names(); - - fprintf(output_file, "{"); - - std::string s = print_variables_to_string(printSym); - fprintf(output_file, "%s", s.c_str()); - - fprintf(output_file, ": "); - - if(simplified_DNF==NULL) { - Formula::print(output_file); - } - else { - assert(children().empty()); - simplified_DNF->print(output_file); - } - - fprintf(output_file, " }\n"); -} - -void Rel_Body::print() { - this->print(stdout); -} - -void F_Not::print(FILE *output_file) { - fprintf(output_file, " not "); - Formula::print(output_file); -} - -void F_And::print_separator(FILE *output_file) { - fprintf(output_file, " and "); -} - -void Conjunct::print(FILE *output_file) { - std::string s = print_to_string(true); - fprintf(output_file, "%s", s.c_str()); -} - -std::string Conjunct::print_to_string(int true_printed) { - std::string s=""; - - int num = myLocals.size(); - if(num) { - s += "exists ( "; - int i; - for (i = 1; i <= num; i++) { - Variable_ID v = myLocals[i]; - s += v->char_name(); - if(i < num) s += ","; - } - if (true_printed || !(is_true())) s += " : "; - } - - if(is_true()) { - s += true_printed ? "TRUE" : ""; - } - else { - if (is_unknown()) - s += "UNKNOWN"; - else { - s += problem->prettyPrintProblemToString(); - if (!exact) - s += " && UNKNOWN"; - } - } - - - if (num) s += ")"; - return s; -} - -void F_Or::print_separator(FILE *output_file) { - fprintf(output_file, " or "); -} - -void F_Declaration::print(FILE *output_file) { - std::string s=""; - for(Variable_ID_Iterator VI(myLocals); VI; ) { - s += (*VI)->name(); - VI++; - if(VI) s += ","; - } - fprintf(output_file, "( %s : ", s.c_str()); - Formula::print(output_file); - fprintf(output_file, ")"); -} - -void F_Forall::print(FILE *output_file) { - fprintf(output_file, "forall "); - F_Declaration::print(output_file); -} - -void F_Exists::print(FILE *output_file) { - fprintf(output_file, "exists "); - F_Declaration::print(output_file); -} - -void Formula::print_separator(FILE *) { - assert(0); // should never be called, it's only for derived classes -} - -// -// Setup names in formula. -// - -typedef Set g_set; -void Rel_Body::setup_names() { - int i; - - - if (use_ugly_names) return; - - if (pres_debug>=2) - fprintf(DebugFile,"Setting up names for 0x%p\n", this); - - for(i=1; i<=number_input; i++) { - input_vars[i]->base_name = In_Names[i]; - } - for(i=1; i<=number_output; i++) { - output_vars[i]->base_name = Out_Names[i]; - } - - g_set gbls; - - wildCardInstanceNumber = 0; - - for(i=1; i<= Symbolic.size(); i++) { - gbls.insert(Symbolic[i]->get_global_var()); - } - - foreach(g,Global_Var_ID,gbls, - g->instance = g->base_name()++); - - for(i=1; i<=number_input; i++) { - if (!input_vars[i]->base_name.null()) - input_vars[i]->instance = input_vars[i]->base_name++; - } - for(i=1; i<=number_output; i++) { - if (!output_vars[i]->base_name.null()) - output_vars[i]->instance = output_vars[i]->base_name++; - } - - if (simplified_DNF != NULL) // It is simplified - simplified_DNF->setup_names(); - else // not simplified - Formula::setup_names(); - - for(i=1; i<=number_output; i++) { - if (!output_vars[i]->base_name.null()) - output_vars[i]->base_name--; - } - for(i=1; i<=number_input; i++) { - if (!input_vars[i]->base_name.null()) - input_vars[i]->base_name--; - } - foreach(g,Global_Var_ID,gbls, g->base_name()--); -} - -void Formula::setup_names() { - if (pres_debug>=2) - fprintf(DebugFile,"Setting up names for formula 0x%p\n", this); - - for(List_Iterator c(myChildren); c; c++) - (*c)->setup_names(); -} - -void DNF::setup_names() { - if (pres_debug>=2) - fprintf(DebugFile,"Setting up names for DNF 0x%p\n", this); - - for(DNF_Iterator DI(this); DI.live(); DI.next()) - DI.curr()->setup_names(); -} - - -void F_Declaration::setup_names() { - if (pres_debug>=2) - fprintf(DebugFile,"Setting up names for Declaration 0x%p\n", this); - - // Allow re-use of wc names in other scopes - int savedWildCardInstanceNumber = wildCardInstanceNumber; - - for(Tuple_Iterator VI(myLocals); VI; VI++) { - Variable_ID v = *VI; - if (!v->base_name.null()) v->instance = v->base_name++; - else v->instance = wildCardInstanceNumber++; - } - - for(List_Iterator c(children()); c; c++) - (*c)->setup_names(); - - for(Tuple_Iterator VI2(myLocals); VI2; VI2++) { - Variable_ID v = *VI2; - if (!v->base_name.null()) v->base_name--; - } - wildCardInstanceNumber = savedWildCardInstanceNumber; -} - - -// -// Prefix_print functions. -// Print Formula Tree, used in debugging. -// -static int level = 0; - -void Formula::prefix_print(FILE *output_file, int debug) { - for(List_Iterator c(children()); c; c++) - (*c)->prefix_print(output_file, debug); - level--; -} - - -void Rel_Body::prefix_print() { - this->prefix_print(stdout, 1); -} - -void Rel_Body::prefix_print(FILE *output_file, int debug) { - int old_use_ugly_names = use_ugly_names; - use_ugly_names = 0; - - setup_names(); - - level = 0; - if(pres_debug>=2) fprintf(output_file, "(@%p)", this); - fprintf(output_file, is_set() ? "SET: " : "RELATION: "); - std::string s = print_variables_to_string(true); - fprintf(output_file, "%s\n", s.c_str()); - - if(simplified_DNF==NULL) { - Formula::prefix_print(output_file, debug); - } else { - assert(children().empty()); - simplified_DNF->prefix_print(output_file, debug, true); - } - fprintf(output_file, "\n"); - use_ugly_names = old_use_ugly_names; -} - - -void F_Forall::prefix_print(FILE *output_file, int debug) { - Formula::print_head(output_file); - fprintf(output_file, "forall ["); - F_Declaration::prefix_print(output_file, debug); - for (Variable_ID_Iterator VI(myLocals); VI; VI++) - assert((*VI)->kind() == Forall_Var); - -} - -void F_Exists::prefix_print(FILE *output_file, int debug) { - Formula::print_head(output_file); - if(pres_debug>=2) fprintf(output_file, "(@%p)", this); - fprintf(output_file, "exists ["); - F_Declaration::prefix_print(output_file, debug); - for (Variable_ID_Iterator VI(myLocals); VI; VI++) - assert((*VI)->kind() == Exists_Var); -} - -void F_Declaration::prefix_print(FILE *output_file, int debug) { - std::string s = ""; - for (Variable_ID_Iterator VI(myLocals); VI; ) { - s += (*VI)->name(); - print_var_addrs(s, *VI); - VI++; - if(VI) s += ","; - } - s += "]\n"; - fprintf(output_file, "%s", s.c_str()); - Formula::prefix_print(output_file, debug); -} - -void F_Or::prefix_print(FILE *output_file, int debug) { - Formula::print_head(output_file); - fprintf(output_file, "or\n"); - Formula::prefix_print(output_file, debug); -} - -void F_And::prefix_print(FILE *output_file, int debug) { - Formula::print_head(output_file); - fprintf(output_file, "and\n"); - Formula::prefix_print(output_file, debug); -} - -void F_Not::prefix_print(FILE *output_file, int debug) { - Formula::print_head(output_file); - fprintf(output_file, "not\n"); - Formula::prefix_print(output_file, debug); -} - -void Conjunct::prefix_print(FILE *output_file, int debug) { - static char dir_glyphs[] = { '-', '?', '+' }; - - if (debug) { - Formula::print_head(output_file); - if(pres_debug>=2) fprintf(output_file, "(@%p)", this); - fprintf(output_file, "%s CONJUNCT, ", exact ? "EXACT" : "INEXACT"); - if (simplified) fprintf(output_file, "simplified, "); - if (verified) fprintf(output_file, "verified, "); - if (possible_leading_0s != -1 && guaranteed_leading_0s != -1) - assert (guaranteed_leading_0s <= possible_leading_0s); - if (guaranteed_leading_0s != -1 && guaranteed_leading_0s == possible_leading_0s) - fprintf(output_file,"# leading 0's = %d,", possible_leading_0s); - else if (possible_leading_0s != -1 || guaranteed_leading_0s != -1) { - if (guaranteed_leading_0s != -1) - fprintf(output_file,"%d <= ",guaranteed_leading_0s); - fprintf(output_file,"#O's"); - if (possible_leading_0s != -1) - fprintf(output_file," <= %d",possible_leading_0s); - fprintf(output_file,", "); - } - if (dir_glyphs[leading_dir+1] != '?') - fprintf(output_file," first = %c, ", dir_glyphs[leading_dir+1]); - fprintf(output_file,"myLocals=["); - std::string s=""; - for (Variable_ID_Iterator VI(myLocals); VI; ) { - assert( (*VI)->kind() == Wildcard_Var); - s += (*VI)->name(); - print_var_addrs(s, *VI); - VI++; - if(VI) s += ","; - } - s += "] mappedVars=["; - for(Variable_ID_Iterator MVI(mappedVars); MVI; ) { - s += (*MVI)->name(); - print_var_addrs(s, *MVI); - MVI++; - if(MVI) s += ","; - } - fprintf(output_file, "%s]\n", s.c_str()); - } - else - level++; - - setOutputFile(output_file); - setPrintLevel(level+1); - problem->printProblem(debug); - setPrintLevel(0); - Formula::prefix_print(output_file, debug); -} - -void Formula::print_head(FILE *output_file) { - level++; - int i; - for(i=0; iprint(out_file); - p.next(); - if(p.live()) - fprintf(out_file, " or "); - } -} - -void DNF::prefix_print(FILE *out_file, int debug, bool parent_names_setup) { - wildCardInstanceNumber = 0; - Variable_ID_Tuple all_vars; - if(!use_ugly_names && !parent_names_setup) { - // We need to manually set up all of the input,output, and symbolic - // variables, since during simplification, a dnf's conjuncts may not - // be listed as part of a relation, or perhaps as part of different - // relations (?) (grr). - for(DNF_Iterator p0(this); p0.live(); p0.next()) { - for(Variable_Iterator vi((*p0)->mappedVars); vi; vi++) - if((*vi)->kind() != Wildcard_Var && all_vars.index(*vi) == 0) - all_vars.append(*vi); - (*p0)->setup_names(); - } - foreach(v,Variable_ID,all_vars, - if (!v->base_name.null()) v->instance = v->base_name++; - else v->instance = wildCardInstanceNumber++; - ); - } - - int i = 1; - level = 0; - for(DNF_Iterator p(this); p.live(); p.next(), i++) { - fprintf(out_file, "#%d ", i); - if(*p == NULL) - fprintf(out_file, "(NULL)\n"); - else - (*p)->prefix_print(out_file, debug); - } - - foreach(v,Variable_ID,all_vars,if (!v->base_name.null()) v->base_name--); - - fprintf(out_file, "\n"); -} - -std::string Constraint_Handle::print_to_string() const { - assert(0); - return "FOO"; -} - -std::string EQ_Handle::print_to_string() const { - relation()->setup_names(); - std::string s = c->print_EQ_to_string(e); - return s; -} - -std::string GEQ_Handle::print_to_string() const { - relation()->setup_names(); - std::string s = c->print_GEQ_to_string(e); - return s; -} - -std::string Constraint_Handle::print_term_to_string() const { - assert(0); - return "FOO"; -} - -std::string EQ_Handle::print_term_to_string() const { - relation()->setup_names(); - std::string s = c->print_EQ_term_to_string(e); - return s; -} - -std::string GEQ_Handle::print_term_to_string() const { - relation()->setup_names(); - std::string s = c->print_GEQ_term_to_string(e); - return s; -} - -} diff --git a/omega/omega_lib/src/pres_quant.cc b/omega/omega_lib/src/pres_quant.cc deleted file mode 100644 index 5483bad..0000000 --- a/omega/omega_lib/src/pres_quant.cc +++ /dev/null @@ -1,95 +0,0 @@ -#include -#include - -namespace omega { - -F_Forall::F_Forall(Formula *p, Rel_Body *r): F_Declaration(p,r) { -} - -F_Exists::F_Exists(Formula *p, Rel_Body *r): F_Declaration(p,r) { -} - -F_Exists::F_Exists(Formula *p, Rel_Body *r, Variable_ID_Tuple &S): F_Declaration(p,r,S) { -} - - -Formula *F_Forall::copy(Formula *parent, Rel_Body *reln) { - F_Forall *f = new F_Forall(parent, reln); - copy_var_decls(f->myLocals, myLocals); - for(List_Iterator c(children()); c; c++) - f->children().append((*c)->copy(f,reln)); - reset_remap_field(myLocals); - return f; -} - -Formula *F_Exists::copy(Formula *parent, Rel_Body *reln) { - F_Exists *f = new F_Exists(parent, reln); - copy_var_decls(f->myLocals, myLocals); - for(List_Iterator c(children()); c; c++) - f->children().append((*c)->copy(f,reln)); - reset_remap_field(myLocals); - return f; -} - -Variable_ID F_Forall::declare(Const_String s) { - return do_declare(s, Forall_Var); -} - -Variable_ID F_Forall::declare() { - return do_declare(Const_String(), Forall_Var); -} - -Variable_ID F_Forall::declare(Variable_ID v) { - return do_declare(v->base_name, Forall_Var); -} - - -Variable_ID F_Exists::declare(Const_String s) { - return do_declare(s, Exists_Var); -} - -Variable_ID F_Exists::declare() { - return do_declare(Const_String(), Exists_Var); -} - -Variable_ID F_Exists::declare(Variable_ID v) { - return do_declare(v->base_name, Exists_Var); -} - -Conjunct *F_Forall::find_available_conjunct() { - return 0; -} - -Conjunct *F_Exists::find_available_conjunct() { - assert(children().length() == 1 || children().length() == 0); - if (children().length() == 0) - return 0; - else - return children().front()->find_available_conjunct(); -} - -F_Exists *Formula::add_exists() { - assert_not_finalized(); - assert(can_add_child()); - F_Exists *f = new F_Exists(this, myRelation); - myChildren.append(f); - return f; -} - -F_Exists *Formula::add_exists(Variable_ID_Tuple &S) { - assert_not_finalized(); - assert(can_add_child()); - F_Exists *f = new F_Exists(this, myRelation, S); - myChildren.append(f); - return f; -} - -F_Forall *Formula::add_forall() { - assert_not_finalized(); - assert(can_add_child()); - F_Forall *f = new F_Forall(this, myRelation); - myChildren.append(f); - return f; -} - -} // namespace diff --git a/omega/omega_lib/src/pres_rear.cc b/omega/omega_lib/src/pres_rear.cc deleted file mode 100644 index 508959d..0000000 --- a/omega/omega_lib/src/pres_rear.cc +++ /dev/null @@ -1,131 +0,0 @@ -#include -#include -#include -#include - -namespace omega { - -///////////////////////// -// // -// Rearrange functions // -// // -///////////////////////// - -// -// Rules: -// ~ (f1 | f2 | ... | fn) = ~f1 & ~f2 & ... & fn -// ~ ~ f = f -// Forall v: f = ~ (Exists v: ~ f) -// Exists v: (f1 | ... | fn) = (Exists v: f1) | ... | (Exists v: fn) -// - -void Rel_Body::rearrange() { - assert(children().length()==1); - - skip_finalization_check++; - formula()->rearrange(); - skip_finalization_check--; - - if(pres_debug) { - fprintf(DebugFile, "\n=== Rearranged TREE ===\n"); - prefix_print(DebugFile); - } -} - -void Formula::rearrange() { - // copy list of children, as they may be removed as we work - List kiddies = myChildren; - - for(List_Iterator c(kiddies); c; c++) - (*c)->rearrange(); -} - -// -// Push nots down the tree until quantifier or conjunct, rearrange kids -// -void F_Not::rearrange() { - Formula *child = children().front(); - Formula *new_child, *f; - - switch(child->node_type()) { - case Op_Or: - parent().remove_child(this); - new_child = parent().add_and(); - while(!child->children().empty()) { - f = child->children().remove_front(); - F_Not *new_not = new_child->add_not(); - new_not->add_child(f); - } - delete this; - break; -//case Op_And: -// parent().remove_child(this); -// new_child = parent().add_or(); -// while(!child->myChildren.empty()) { -// f = child->myChildren.remove_front(); -// F_Not *new_not = new_child->add_not(); -// new_not->add_child(f); -// } -// delete this; -// break; - case Op_Not: - parent().remove_child(this); - f = child->children().remove_front(); - parent().add_child(f); - delete this; - f->rearrange(); - return; - default: - new_child = child; - break; - } - - new_child->rearrange(); -} - -// -// Convert a universal quantifier to "not exists not". -// Forall v: f = ~ (Exists v: ~ f) -// -void F_Forall::rearrange() { - Formula &p = parent(); - p.remove_child(this); - - F_Not *topnot = p.add_not(); - F_Exists *exist = topnot->add_exists(); - for (Variable_ID_Iterator VI(myLocals); VI; VI++) - (*VI)->set_kind(Exists_Var); - exist->myLocals.join(myLocals); - - F_Not *botnot = exist->add_not(); - Formula *f = children().remove_front(); - botnot->add_child(f); - - delete this; - - botnot->rearrange(); -} - -// -// Exists v: (f1 | ... | fn) = (Exists v: f1) | ... | (Exists v: fn) -// -void F_Exists::rearrange() { - Formula* child = children().front(); - switch(child->node_type()) { - case Op_Or: - case Op_Conjunct: - case Op_Exists: - child->push_exists(myLocals); - parent().remove_child(this); - parent().add_child(child); - children().remove_front(); - delete this; - break; - default: - break; - } - - child->rearrange(); -} - -} // namespace diff --git a/omega/omega_lib/src/pres_subs.cc b/omega/omega_lib/src/pres_subs.cc deleted file mode 100644 index 9854b09..0000000 --- a/omega/omega_lib/src/pres_subs.cc +++ /dev/null @@ -1,131 +0,0 @@ -#include - -namespace omega { - -Substitutions::Substitutions(Relation &input_R, Conjunct *input_c) { - int i; - r = new Relation(input_R,input_c); - c = r->single_conjunct(); - c->reorder_for_print(); - c->ordered_elimination(r->global_decls()->length()); - int num_subs = c->problem->nSUBs; - subs = new eqn[num_subs]; - for(i = 0; i < num_subs; i++) - subs[i] = SUBs[i]; - subbed_vars.reallocate(num_subs); - /* Go through and categorize variables as: - 1) substituted, 2) not substituted, 3) wildcard - Safevars number of variables were not able to be substituted. - nVars number of total variables, including wildcards. - nSUBs is the number of substitutions. - nSUBs + nVars == the number of variables that went in. - Then reset var and forwardingAddress arrays in the problem, - so that they will correctly refer to the reconstructed - mappedVars. */ - Variable_ID_Tuple unsubbed_vars(c->problem->safeVars); - for(i = 1; i <= c->mappedVars.size(); i++) - if(c->mappedVars[i]->kind() != Wildcard_Var) { - int addr = c->problem->forwardingAddress[i]; - assert(addr == c->find_column(c->mappedVars[i]) && addr != 0); - if(addr < 0) { - assert(-addr <= subbed_vars.size()); - subbed_vars[-addr] = c->mappedVars[i]; - } - else { - assert(addr <= unsubbed_vars.size()); - unsubbed_vars[addr] = c->mappedVars[i]; - } - } - else { - // Here we don't redeclare wildcards, just re-use them. - unsubbed_vars.append(c->mappedVars[i]); - } - assert(unsubbed_vars.size() + subbed_vars.size() == c->mappedVars.size()); - c->mappedVars = unsubbed_vars; /* These are the variables that remain */ - - for(int col = 1; col <= c->problem->nVars; col++) { - c->problem->var[col] = col; - c->problem->forwardingAddress[col] = col; - } -} - -Substitutions::~Substitutions() { - delete [] subs; - delete r; -} - -bool Substitutions::substituted(Variable_ID v) { - return (subbed_vars.index(v) > 0); -} - -Sub_Handle Substitutions::get_sub(Variable_ID v) { - assert(substituted(v) && "No substitution for variable"); - return Sub_Handle(this,subbed_vars.index(v)-1,v); -} - -bool Substitutions::sub_involves(Variable_ID v, Var_Kind kind) { - assert(substituted(v)); - for(Constr_Vars_Iter i = get_sub(v); i; i++) - if ((*i).var->kind() == kind) - return true; - return false; -} - - -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - - -int Sub_Iterator::live() const { - return current <= last; -} - -void Sub_Iterator::operator++() { this->operator++(0); } - -void Sub_Iterator::operator++(int) { - current++; -} - -Sub_Handle Sub_Iterator::operator*() { - assert(s && current <= last && "Sub_Iterator::operator*: bad call"); - return Sub_Handle(s,current,s->subbed_vars[current+1]); -} - -Sub_Handle Sub_Iterator::operator*() const { - assert(s && current <= last && "Sub_Iterator::operator*: bad call"); - return Sub_Handle(s,current,s->subbed_vars[current+1]); -} - - -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - - - -Sub_Handle::Sub_Handle(Substitutions *_s, int _e, Variable_ID _v) : -Constraint_Handle(_s->c,&(_s->subs),_e), v(_v) {} - -std::string Sub_Handle::print_to_string() const { - relation()->setup_names(); - return v->name() + " = " + this->print_term_to_string(); -} - -std::string Sub_Handle::print_term_to_string() const { - /* The horrible truth is that print_term_to_string is a member - function of Conjunct, (and then Problem below it) but uses - nothing from there but the names, so you can pass it a pointer to - an equation that isn't even part of the conjunct. */ - relation()->setup_names(); - return c->print_term_to_string(&((*eqns)[e])); -} - - -/* - String Sub_Handle::print_to_string() const { - return c->problem->print_EQ_to_string(&((*eqns)[e])); - } - - String Sub_Handle::print_term_to_string() const { - return c->print_term_to_string(&(*eqns[e])); - } -*/ - -} // namespace diff --git a/omega/omega_lib/src/pres_var.cc b/omega/omega_lib/src/pres_var.cc deleted file mode 100644 index 0ec406f..0000000 --- a/omega/omega_lib/src/pres_var.cc +++ /dev/null @@ -1,459 +0,0 @@ -#include -#include -#include -#include - -namespace omega { - -int wildCardInstanceNumber; - -const int Global_Input_Output_Tuple::initial_allocation = 10; - -// Declare named Variable -Var_Decl::Var_Decl(Const_String name, Var_Kind vkind, int pos): - base_name(name), - instance(999), - remap(this), - var_kind(vkind), - position(pos), - global_var(NULL), - of((Argument_Tuple) 0) { - assert(((vkind==Input_Var || vkind==Output_Var) && pos>0) || pos==0); -} - -// Declare unnamed variable -Var_Decl::Var_Decl(Var_Kind vkind, int pos): - instance(999), - remap(this), - var_kind(vkind), - position(pos), - global_var(NULL), - of((Argument_Tuple) 0) { - assert(((vkind==Input_Var || vkind==Output_Var) && pos>0) || pos==0); -} - -// Copy variable declaration -Var_Decl::Var_Decl(Variable_ID v): - base_name(v->base_name), - instance(v->instance), - remap(this), - var_kind(v->var_kind), - position(v->position), - global_var(v->global_var), - of(v->of) { -} - -Var_Decl::Var_Decl(Const_String name, Global_Var_ID v): - base_name(name), - instance(999), - remap(this), - var_kind(Global_Var), - position(0), - global_var(v), - of((Argument_Tuple) 0) { - assert(v->arity() == 0); -} - -Var_Decl::Var_Decl(Const_String name, Global_Var_ID v, Argument_Tuple function_of): - base_name(name), - instance(999), - remap(this), - var_kind(Global_Var), - position(0), - global_var(v), - of(function_of) { -} - -int Var_Decl::get_position() { - assert((var_kind == Input_Var || var_kind == Output_Var) && "Var_Decl::get_position: bad var_kind"); - return(position); -} - -Global_Var_ID Var_Decl::get_global_var() { - assert(var_kind == Global_Var && "Var_Decl::get_global_var: bad var_kind"); - return(global_var); -} - -Argument_Tuple Var_Decl::function_of() { - assert(var_kind == Global_Var); - return(of); -} - - -Omega_Var *Global_Var_Decl::really_omega_var() { - assert(0); - return(NULL); -} - -Coef_Var_Decl *Global_Var_Decl::really_coef_var() { - assert(0); - return(NULL); -} - -// -// Variable name. -// - -const int N_greek_letters = 19; - -char greek_letters[19][10] = { - "alpha" , "beta" , "gamma" , "delta" , "tau" , "sigma" , "chi" , - "omega" , "pi" , "ni" , "Alpha" , "Beta" , "Gamma" , "Delta" , - "Tau" , "Sigma" , "Chi" , "Omega" , "Pi" -}; - -const int numBuffers = 50; -const int bufferSize = 90; -char nameBuffers[numBuffers][bufferSize]; -int nextBuffer = 0; - -int use_ugly_names = 0; - -const char *Var_Decl::char_name() { - char *s = nameBuffers[nextBuffer++]; - char *start = s; - if (nextBuffer >= numBuffers) nextBuffer = 0; - int primes; - - if (use_ugly_names) - primes = 0; - else - primes = instance; - - switch(var_kind) { - case Input_Var: - if (!use_ugly_names && !base_name.null()) - sprintf(s,"%s",(const char *)base_name); - else { - primes = 0; - sprintf(s,"In_%d",position); - } - break; - case Output_Var: - if (!use_ugly_names && !base_name.null()) - sprintf(s,"%s",(const char *)base_name); - else { - primes = 0; - sprintf(s,"Out_%d",position); - } - break; - case Global_Var: - assert(!base_name.null()); - if (use_ugly_names) - sprintf(s,"%s@%p",(const char *)base_name, this); - else { - sprintf(s,"%s",(const char *)base_name); - primes = get_global_var()->instance; - } - break; - default: - if (use_ugly_names) { - if (!base_name.null()) - sprintf(s,"%s@%p",(const char *)base_name, this); - else - sprintf(s,"?@%p", this); - } - else if (!base_name.null()) sprintf(s,"%s",(const char *)base_name); - else { - assert(instance < 999); - sprintf(s,"%s", - greek_letters[instance % N_greek_letters]); - primes = instance/N_greek_letters; - } - break; - } - - while (*s) s++; - int i; - assert(primes < 999); - for(i=1; i<= primes; i++) *s++ = '\''; - *s = '\0'; - if (var_kind == Global_Var) { - int a = get_global_var()->arity(); - if (a) { - if (use_ugly_names) { - static const char *arg_names[4] = { "???", "In", "Out", "In == Out" }; - sprintf(s, "(%s[1#%d])", arg_names[function_of()], a); - } - else { - int f_of = function_of(); - assert(f_of == Input_Tuple || f_of == Output_Tuple); - *s++ = '('; - for(i = 1;i<=a;i++) { - if (f_of == Input_Tuple) - sprintf(s,"%s",(const char *)input_vars[i]->char_name()); - else - sprintf(s,"%s",(const char *)output_vars[i]->char_name()); - while (*s) s++; - if (ikind()==Global_Var) { - new_vl[p] = v; - v->remap = v; - } - else { - new_vl[p] = new Var_Decl(vl[p]); - v->remap = new_vl[p]; - } - } -} - -// -// Name a variable. -// -void Var_Decl::name_variable(char *newname) { - base_name = newname; -} - - -static Const_String coef_var_name(int i, int v) { - char s[100]; - sprintf(s, "c_%d_%d", i, v); - return Const_String(s); -} - - -// -// Global variables stuff. -// -Global_Var_Decl::Global_Var_Decl(Const_String baseName): - loc_rep1(baseName, this, Input_Tuple), - loc_rep2(baseName, this, Output_Tuple) { -} - -Global_Kind Global_Var_Decl::kind() const { - assert(0); - return Coef_Var; -} - -Coef_Var_Decl::Coef_Var_Decl(int id, int var): - Global_Var_Decl(coef_var_name(id, var)) { - i = id; - v = var; -} - -Coef_Var_Decl *Coef_Var_Decl::really_coef_var() { - return this; -} - -int Coef_Var_Decl::stmt() const { - return i; -} - -int Coef_Var_Decl::var() const { - return v; -} - -Global_Kind Coef_Var_Decl::kind() const { - return Coef_Var; -} - -Free_Var_Decl::Free_Var_Decl(Const_String name): - Global_Var_Decl(name), _arity(0) { -} - -Free_Var_Decl::Free_Var_Decl(Const_String name, int arity): - Global_Var_Decl(name), _arity(arity) { -} - -int Free_Var_Decl::arity() const { - return _arity; -} - -Global_Kind Free_Var_Decl::kind() const { - return Free_Var; -} - - -// -// Delete variable from variable list. Does not preserve order -// -bool rm_variable(Variable_ID_Tuple &vl, Variable_ID v) { - int n = vl.size(); - int i; - for(i = 1; in) return 0; - vl[i] = vl[n]; - vl.delete_last(); - return 1; -} - - -// -// Destroy variable declarations. -// -void free_var_decls(Variable_ID_Tuple &c) { - for(Variable_ID_Iterator p = c; p; p++) { - Variable_ID v = *p; - if(v->kind()!=Global_Var) { - delete v; - } - } -} - - -Variable_ID input_var(int nth) { - assert(1 <= nth && nth <= input_vars.size()); - return input_vars[nth]; -} - -Variable_ID output_var(int nth) { - assert(1<= nth && nth <= output_vars.size()); - return output_vars[nth]; -} - -Variable_ID set_var(int nth) { - assert(1 <= nth && set_vars.size()); - return input_vars[nth]; -} - - -// -// Remap mappedVars in all conjuncts of formula. -// Uses the remap field of the Var_Decl. -// -void Formula::remap() { - for(List_Iterator c(children()); c; c++) - (*c)->remap(); -} - -void Conjunct::remap() { - for(Variable_Iterator VI(mappedVars); VI; VI++) { - Variable_ID v = *VI; - *VI = v->remap; - } - cols_ordered = false; -} - -// Function to reset the remap field of a Variable_ID -void reset_remap_field(Variable_ID v) { - v->remap = v; -} - -// Function to reset the remap fields of a Variable_ID_Seq -void reset_remap_field(Sequence &T) { - for(Any_Iterator VI(T.any_iterator()); VI; VI++) { - Variable_ID v = *VI; - v->remap = v; - } -} - -// Function to reset the remap fields of a Variable_ID_Tuple, -// more efficiently -void reset_remap_field(Variable_ID_Tuple &T) { - for(Variable_Iterator VI(T); VI; VI++) { - Variable_ID v = *VI; - v->remap = v; - } -} - -void reset_remap_field(Sequence &T, int var_no) { - int i=1; - for(Any_Iterator VI(T.any_iterator()); i <= var_no && VI; VI++) { - Variable_ID v = *VI; - v->remap = v; - i++; - } -} - -void reset_remap_field(Variable_ID_Tuple &T, int var_no) { - int i=1; - for(Variable_Iterator VI(T); i <= var_no && VI; VI++) { - Variable_ID v = *VI; - v->remap = v; - i++; - } -} - - -// Global input and output variable tuples. -// These Tuples must be initialized as more in/out vars are needed. -//Variable_ID_Tuple input_vars(0); -//Variable_ID_Tuple output_vars(0); -//Variable_ID_Tuple& set_vars = input_vars; -Global_Input_Output_Tuple input_vars(Input_Var); -Global_Input_Output_Tuple output_vars(Output_Var); -Global_Input_Output_Tuple &set_vars = input_vars; - -//////////////////////////////////////// -// // -// Variable and Declaration functions // -// // -//////////////////////////////////////// - -// -// Constructors and properties. -// - - -// Allocate ten variables initially. Most applications won't require more. -Global_Input_Output_Tuple::Global_Input_Output_Tuple(Var_Kind in_my_kind, int init): - my_kind(in_my_kind) { - for (int i=1; i<=(init == -1? initial_allocation: max(0,init)); i++) - this->append(new Var_Decl(Const_String(), my_kind, i)); -} - -Global_Input_Output_Tuple::~Global_Input_Output_Tuple() { - for (int i=1; i<=size(); i++) - delete data[i-1]; -} - -Variable_ID & Global_Input_Output_Tuple::operator[](int index) { - assert(index > 0); - while(size() < index) - this->append(new Var_Decl(Const_String(), my_kind, size()+1)); - return data[index-1]; -} - -const Variable_ID & Global_Input_Output_Tuple::operator[](int index) const { - assert(index > 0); - Global_Input_Output_Tuple *unconst_this = (Global_Input_Output_Tuple *) this; - while(size() < index) - unconst_this->append(new Var_Decl(Const_String(), my_kind, size()+1)); - return data[index-1]; -} - -Variable_ID Var_Decl::UF_owner() { - Variable_ID v = this; - while (v->remap != v) v = v->remap; - return v; -} - -void Var_Decl::UF_union(Variable_ID b) { - Variable_ID a = this; - while (a->remap != a) { - Variable_ID tmp = a->remap; - a->remap = tmp->remap; - a = tmp; - } - while (b->remap != a) { - Variable_ID tmp = b->remap; - b->remap = a; - b = tmp; - } -} - -} // namespace diff --git a/omega/omega_lib/src/reach.cc b/omega/omega_lib/src/reach.cc deleted file mode 100644 index bde785c..0000000 --- a/omega/omega_lib/src/reach.cc +++ /dev/null @@ -1,211 +0,0 @@ -#include -#include -#include -#include - -namespace omega { - -typedef Dynamic_Array1 Rel_Array1; -typedef Dynamic_Array2 Rel_Array2; - -// This is from parallelism.c, modified - -static void closure_rel(Rel_Array2 &trans, int i, int k, int j) { - Relation tik; - - if (trans[k][k].is_upper_bound_satisfiable()) { - Relation tkk = TransitiveClosure(copy(trans[k][k])); - tkk.simplify(2,4); - tik = Composition(tkk, copy(trans[i][k])); - tik.simplify(2,4); - tik = Union(copy(trans[i][k]), tik); - tik.simplify(2,4); - } - else { - tik = trans[i][k]; - } - Relation fresh; - Relation tkj = trans[k][j]; - fresh = Composition(tkj, tik); - fresh.simplify(2,4); - trans[i][j] = Union(trans[i][j], fresh); - trans[i][j].simplify(2,4); - -#if 0 - fprintf(DebugFile, "%d -> %d -> %d\n", i, k, j); - trans[i][j].print_with_subs(DebugFile); -#endif -} - - -static void close_rels(Rel_Array2 &trans,int n_nodes) { - for (int k=1; k<=n_nodes; k++) - for (int i=1; i<=n_nodes; i++) - if (trans[i][k].is_upper_bound_satisfiable()) - for (int j=1; j<=n_nodes; j++) - if (trans[k][j].is_upper_bound_satisfiable()) - closure_rel(trans, i, k, j); -} - - -void dump_rels(Rel_Array2 &a, reachable_information *reachable_info) { - int i,j; - int n_nodes = reachable_info->node_names.size(); - for(i = 1; i <= n_nodes; i++) - for(j = 1; j <= n_nodes; j++) { - fprintf(stderr,"t[%s][%s] = ", - (reachable_info->node_names[i]).c_str(), - (reachable_info->node_names[j]).c_str()); - a[i][j].print_with_subs(stderr); - } -} - - -void dump_sets(Rel_Array1 &a, reachable_information *reachable_info) { - int i; - int n_nodes = reachable_info->node_names.size(); - for(i = 1; i <= n_nodes; i++) { - fprintf(stderr,"r[%s] = ", (reachable_info->node_names[i]).c_str()); - a[i].print_with_subs(stderr); - } -} - - - -Rel_Array1 *Reachable_Nodes(reachable_information *reachable_info) { - Tuple &node_names = reachable_info->node_names; - Tuple &arity = reachable_info->node_arity; - Rel_Array2 &transitions = reachable_info->transitions; - Rel_Array1 &start_nodes = reachable_info->start_nodes; - - int n_nodes = node_names.size(),i,j; - -#define DUMP_INITIAL 1 -#define DUMP_CLOSED 1 - - if(DUMP_INITIAL && relation_debug){ - fprintf(stderr,"Initially:\n"); - dump_rels(transitions, reachable_info); - } - - close_rels(transitions,n_nodes); - - if(DUMP_CLOSED && relation_debug) { - fprintf(stderr,"Closed:\n"); - dump_rels(transitions, reachable_info); - } - - Rel_Array1 *finalp = - new Rel_Array1("node"); - Rel_Array1 &final = *finalp; - final.resize(n_nodes+1); - for (i=1; i<=n_nodes; i++) - final[i] = Relation::False(arity[i]); - - for(i = 1; i <= n_nodes; i++) - for(j = 1; j <= n_nodes; j++) - if(start_nodes[i].is_upper_bound_satisfiable()) - final[j] = Union(final[j], - Composition(copy(transitions[i][j]), - copy(start_nodes[i]))); - return finalp; -} - -static void compute_initially_reachable(Rel_Array1 &r, - Rel_Array1 &start_nodes, - Rel_Array2 &, - Rel_Array2 &closed, - Rel_Array1 &end_nodes, - int n_nodes, Tuple &arity){ - for(int n = 1; n <= n_nodes; n++) - r[n] = Relation::False(arity[n]); - - for(int i = 1; i <= n_nodes; i++) - for(int j = 1; j <= n_nodes; j++) - r[i] = Union(r[i], - Range(Restrict_Domain( - Restrict_Range(copy(closed[j][i]), - copy(end_nodes[i])), - copy(start_nodes[j])))); -} - - -static bool iterate(Rel_Array1 &r, Rel_Array2 &, Rel_Array2 &closed, - Rel_Array1 &, int n_nodes) { - bool changed; - - changed = false; - for(int j = 1; j <= n_nodes; j++) { - for(int i = 1; i <= n_nodes; i++) { - /* look for additional steps from interesting states */ - Relation new_rj = Range(Restrict_Domain(copy(closed[i][j]), - copy(r[i]))); - if(!Must_Be_Subset(copy(new_rj),copy(r[j]))) { - r[j] = Union(r[j],new_rj); - r[j].simplify(2,2); - changed = true; - } - } - } - return changed; -} - - - - -Rel_Array1 *I_Reachable_Nodes(reachable_information *reachable_info) { - bool changed; - - Tuple &node_names = reachable_info->node_names; - int n_nodes = node_names.size(); - Tuple &arity = reachable_info->node_arity; - Rel_Array2 &transitions = reachable_info->transitions; - Rel_Array1 &start_nodes = reachable_info->start_nodes; - Rel_Array2 closed("node number","node number"); - closed.resize(n_nodes+1,n_nodes+1); // abuse of dynamic arrays - Rel_Array1 *rp = new Rel_Array1("node number"); - Rel_Array1 &r = *rp; - r.resize(n_nodes+1); // abuse of dynamic arrays - - int i,j; - - Rel_Array1 end_nodes("Hi!"); - end_nodes.resize(n_nodes+1); // for future use - for(int n = 1; n <= n_nodes; n++) end_nodes[n] = Relation::True(arity[n]); - - for(j = 1; j <= n_nodes; j++) { - closed[j][j] = TransitiveClosure(copy(transitions[j][j])); - for(i = 1; i <= n_nodes; i++) - if (i != j) - closed[i][j] = transitions[i][j]; - } - - compute_initially_reachable(r,start_nodes,transitions,closed,end_nodes, - n_nodes,arity); - -#define DUMP_INITIAL 1 -#define DUMP_CLOSED 1 - - if(DUMP_INITIAL && relation_debug > 1) { - fprintf(stderr,"Closed:\n"); - dump_rels(closed, reachable_info); - } - if(DUMP_INITIAL && relation_debug) { - fprintf(stderr,"start nodes:\n"); - dump_sets(start_nodes, reachable_info); - fprintf(stderr,"Initially reachable:\n"); - dump_sets(r, reachable_info); - } - - changed = true; - int iterations = 0, max_iterations = 1000; - while(changed && iterations < max_iterations) { - changed = iterate(r,transitions,closed,start_nodes,n_nodes); - iterations++; - } - if(relation_debug) - fprintf(stdout,"[Iterations to convergence: %d]\n",iterations); - return rp; -} - -} // namespace diff --git a/omegalib/CMakeLists.txt b/omegalib/CMakeLists.txt new file mode 100644 index 0000000..f8872b1 --- /dev/null +++ b/omegalib/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 2.8) +project(omegalib) + +if(NOT DEFINED ROSEHOME) + message( FATAL_ERROR "ROSEHOME is not set, try use -DROSEHOME" ) +endif() +if (NOT DEFINED BOOSTHOME) + message( FATAL_ERROR "BOOSTHOME is not set, try use -DBOOSTHOME" ) +endif() + +set(OMEGAROOT ${PROJECT_SOURCE_DIR}) + +add_subdirectory(omega_lib) +add_subdirectory(code_gen) +add_subdirectory(omega_calc) diff --git a/omegalib/LICENSE b/omegalib/LICENSE new file mode 100644 index 0000000..f0fbe69 --- /dev/null +++ b/omegalib/LICENSE @@ -0,0 +1,705 @@ +Omega+ and CodeGen+ +Copyright (C) 2005-2011 Chun Chen +All rights reserved. + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + +============================================================================== + +The Omega Project +Copyright (C) 1994-2000 by the Omega Project +All rights reserved. + +NOTICE: This software is provided ``as is'', without any +warranty, including any implied warranty for merchantability or +fitness for a particular purpose. Under no circumstances shall +the Omega Project or its agents be liable for any use of, misuse +of, or inability to use this software, including incidental and +consequential damages. + +License is hereby given to use, modify, and redistribute this +software, in whole or in part, for any purpose, commercial or +non-commercial, provided that the user agrees to the terms of this +copyright notice, including disclaimer of warranty, and provided +that this copyright notice, including disclaimer of warranty, is +preserved in the source code and documentation of anything derived +from this software. Any redistributor of this software or +anything derived from this software assumes responsibility for +ensuring that any parties to whom such a redistribution is made +are fully aware of the terms of this license and disclaimer. + +The Omega project can be contacted at omega@cs.umd.edu +or http://www.cs.umd.edu/projects/omega diff --git a/omegalib/basic/include/basic/Bag.c b/omegalib/basic/include/basic/Bag.c new file mode 100644 index 0000000..c3084c1 --- /dev/null +++ b/omegalib/basic/include/basic/Bag.c @@ -0,0 +1,329 @@ +/**************************************************************** + * * + * Collection constructors, desctructors, assignments * + * * + ****************************************************************/ + +#include + +namespace omega { + +template Bag::Bag() { + contents = new List_Element ; + contents->tail = 0; + } +template Bag::~Bag() { + delete contents; + } + +template Ordered_Bag::Ordered_Bag() {} + +template Set::Set() {} + +template Bag::Bag(const Bag &L) { + contents = new List_Element(*L.contents); + } + +template Bag & Bag::operator=(const Bag &L) { + if (this != &L) { + delete contents; + contents = new List_Element(*L.contents); + } + return *this; + } + + + +template Set::Set(T e) { + assert(this->contents); + this->contents->tail = new List_Element(e, 0); + } + + +/**************************************************************** + * * + * Misc. simple Collection operations * + * * + ****************************************************************/ + +template bool Bag::empty() const { + return contents->tail == 0; + } + +template Iterator *Bag::new_iterator() + { + return new List_Element_Iterator(contents->tail); + } + + +template void Bag::clear() { + if (contents->tail) delete contents->tail; + contents->tail = 0; + } + +template int Bag::size() const { + int i = 0; + List_Element * p = contents->tail; + while (p) { + p = p->tail; + i++; + }; + return i; + } + + +/**************************************************************** + * * + * Collection/Element operations (e.g. insert, contains) * + * * + ****************************************************************/ + +template void Bag::remove(T e) { + List_Element * p = contents; + while (p->tail && p->tail->head != e) p = p->tail; + if (p->tail && p->tail->head == e) { + List_Element * q = p->tail; + p->tail = q->tail; + q->tail = 0; + delete q; + } + } + +template T Bag::extract() { + List_Element * p = contents->tail; + T e = p->head; + contents->tail = p->tail; + p->tail = 0; + delete p; + return e; + } + + +template void Bag::insert(T e) { + List_Element * q = new List_Element(e,contents->tail); + contents->tail = q; + } + +template void Ordered_Bag::insert(T e) { + List_Element * p = this->contents; + while (p->tail && p->tail->head < e) p = p->tail; + if (!p->tail || p->tail->head != e) { + List_Element * q = new List_Element(e,p->tail); + p->tail = q; + } + } + + +template bool Bag::contains(T e) const { + List_Element * p = contents; + while (p->tail && p->tail->head != e) p = p->tail; + return (p->tail && p->tail->head == e); + } + +template bool Ordered_Bag::contains(T e) const { + List_Element * p = this->contents; + while (p->tail && p->tail->head < e) p = p->tail; + return (p->tail && p->tail->head == e); + } + + +template bool Set::contains (const Set& b) const { + List_Element * p = this->contents; + List_Element * q = b.contents; + do { + /* consume matched elements in p and q */ + p = p->tail; + q = q->tail; + if (!q) return 1; /* no more elements to match */ + if (!p) return 0; /* nothing left in p to match with */ + if (q->head < p->head) { + /* nothing smaller than + p->head left in p, so q->head + can't be matched */ + return 0; + }; + while (p && p->head < q->head) { + /* toss away some elements from p */ + p = p->tail; + } + if (!p || q->head < p->head) return 0; + } while (q); + + return 1; + } + + + +/**************************************************************** + * * + * Collection/Collection operations (e.g. |=) * + * * + ****************************************************************/ + +template void Bag::operator |= (const Bag & b) { + assert(this != &b); + List_Element * q = b.contents->tail; + + while (q) { + List_Element * r = new List_Element(q->head,contents->tail); + contents->tail = r; + q = q->tail; + } + } + +template void Ordered_Bag::operator |= (const Ordered_Bag & b) { + if (this == &b) return; + List_Element * p = this->contents; + List_Element * q = b.contents->tail; + + while (q) { + while (p->tail && p->tail->head < q->head) p = p->tail; + List_Element * r = new List_Element(q->head,p->tail); + p->tail = r; + q = q->tail; + } + } + +template void Ordered_Bag::operator |= (const Bag & b) { + Ordered_Bag tmp; + for (List_Element *p = b.contents; p; p=p->tail) { + tmp.insert(p->head); + } + *this |= tmp; +} + +template void Set::operator |= (const Set & b) { + if (this == &b) return; + List_Element * p = this->contents; + List_Element * q = b.contents->tail; + + while (q) { + while (p->tail && p->tail->head < q->head) p = p->tail; + if (!p->tail || p->tail->head != q->head) { + List_Element * r = new List_Element(q->head,p->tail); + p->tail = r; + } + q = q->tail; + } + } + +template void Set::operator |= (const Ordered_Bag & b) { + Set tmp; + for (List_Element *p = b.contents; p; p=p->tail) { + tmp.insert(p->head); + } + *this |= tmp; +} + +template void Set::operator |= (const Bag & b) { + Set tmp; + for (List_Element *p = b.contents; p; p=p->tail) { + tmp.insert(p->head); + } + *this |= tmp; +} + + + +// delete items also in b +template void Set::operator -= (const Set & b) { + if (this == &b) { + this->clear(); + return; + } + List_Element * p = this->contents; + List_Element * q = b.contents->tail; + + while (q) { + while (p->tail && p->tail->head < q->head) p = p->tail; + if (p->tail && p->tail->head == q->head) { + List_Element * r = p->tail; + p->tail = r->tail; + r->tail = 0; + delete r; + } + q = q->tail; + } + } + + +// delete items not in b +template void Set::operator &= (const Set & b) + { + if (this == &b) return; + List_Element * p = this->contents; + List_Element * q = b.contents->tail; + + while (q) { + while (p->tail && p->tail->head < q->head) { + List_Element * r = p->tail; + p->tail = r->tail; + r->tail = 0; + delete r; + }; + if (p->tail && p->tail->head == q->head) { + /* allow p->tail->head into the result */ + p = p->tail; + } + /* q->head has matched anything it is going to match */ + q = q->tail; + } + if (p->tail) { + delete p->tail; + p->tail = 0; + }; + + } + + +template bool Set::operator & (const Set& b) const { + List_Element * p = this->contents; + List_Element * q = b.contents; + do { + p = p->tail; + q = q->tail; + while (p && q && p->head != q->head) { + while (p && p->head < q->head) p = p->tail; + while (p && q && q->head < p->head) q = q->tail; + }; + if (p && q && p->head == q->head) return 1; + } while (p && q); + + return 0; + } + + +template bool Ordered_Bag::operator == (const Ordered_Bag& b) const { + List_Element * p = this->contents; + List_Element * q = b.contents; + while (1) { + p = p->tail; + q = q->tail; + if (!p && !q) return 1; + if (!p || !q) return 0; + if (p->head != q->head) return 0; + }; + + } + +template bool Ordered_Bag::operator != (const Ordered_Bag& b) const { + return !(*this == b); + } + +template bool Ordered_Bag::operator < (const Ordered_Bag& b) const { + List_Element * p = this->contents; + List_Element * q = b.contents; + while (1) { + p = p->tail; + q = q->tail; + if (!p && !q) return 0; + if (!p) return 1; + if (!q) return 0; + if (p->head < q->head) return 1; + if (q->head < p->head) return 0; + }; + + return 1; + } + +} // namespace diff --git a/omegalib/basic/include/basic/Bag.h b/omegalib/basic/include/basic/Bag.h new file mode 100644 index 0000000..42285d0 --- /dev/null +++ b/omegalib/basic/include/basic/Bag.h @@ -0,0 +1,78 @@ +#if ! defined _Bag_h +#define _Bag_h 1 + +#include +#include +#include +#include + +namespace omega { + +template class Bag : public Collection { +public: +virtual ~Bag(); + Bag(); + Bag(const Bag&); + Bag & operator=(const Bag&); +virtual void operator |= (const Bag & b); // add elements in b + Iterator *new_iterator(); + bool empty() const; + void remove(T); +virtual void insert(T); + void clear(); +virtual bool contains(T) const; + int size() const; + T extract(); +// protected: breaks g++ 261 + List_Element* contents; +}; + + +template class Ordered_Bag : public Bag { +public: + Ordered_Bag(); +// virtual ~Ordered_Bag(); + Ordered_Bag(const Ordered_Bag& B) : Bag(B) {} + void insert(T); +virtual void operator |= (const Ordered_Bag & b); // add elements in b + void operator |= (const Bag & b); + bool contains(T) const; + bool operator == (const Ordered_Bag&) const; + bool operator != (const Ordered_Bag&) const; + bool operator < (const Ordered_Bag&) const; +}; + +template class Set : public Ordered_Bag { +public: + Set(); +// virtual ~Set(); + Set(T); + Set(const Set& S) : Ordered_Bag(S) {} + + bool contains (const Set& b) const; + bool contains (T t) const { return Ordered_Bag::contains(t); } + // the above makes "standard" C++ happy + +virtual void operator |= (const Set & b); // add elements in b + void operator |= (const Ordered_Bag & b); + void operator |= (const Bag & b); + + void operator -= (const Set & b); // delete items also in b + void operator &= (const Set & b); // delete items not in b + bool operator & (const Set &) const; // check for elements in common +}; + +} // namespace + +#if ! defined DONT_INCLUDE_TEMPLATE_CODE +#include +#endif + +#define instantiate_Bag(T) template class Bag; \ + instantiate_List_Element(T); +#define instantiate_Ordered_Bag(T) template class Ordered_Bag; \ + instantiate_Bag(T) +#define instantiate_Set(T) template class Set; \ + instantiate_Ordered_Bag(T) + +#endif diff --git a/omegalib/basic/include/basic/BoolSet.h b/omegalib/basic/include/basic/BoolSet.h new file mode 100644 index 0000000..9fcfd41 --- /dev/null +++ b/omegalib/basic/include/basic/BoolSet.h @@ -0,0 +1,283 @@ +/***************************************************************************** + Copyright (C) 2009 University of Utah + All Rights Reserved. + + Purpose: + Class of set of bools where each element is indexed by a small integer. + + Notes: + Set operands of binary operations can be of different sizes, missing + elements are treated as false. + + History: + 03/30/2009 Created by Chun Chen. +*****************************************************************************/ + +#ifndef BOOLSET_H +#define BOOLSET_H + +#include +#include +#include + +namespace omega { + +template +class BoolSet { +protected: + unsigned int size_; + std::vector set_; +public: + BoolSet(unsigned int size = 0); + ~BoolSet() {} + + void set(unsigned int); + void unset(unsigned int); + bool get(unsigned int) const; + unsigned int size() const {return size_;} + unsigned int num_elem() const; + bool imply(const BoolSet &) const; + bool empty() const; + + BoolSet &operator|=(const BoolSet &); + BoolSet &operator&=(const BoolSet &); + BoolSet &operator-=(const BoolSet &); + + template friend BoolSet operator|(const BoolSet &, const BoolSet &); // union + template friend BoolSet operator&(const BoolSet &, const BoolSet &); // intersection + template friend BoolSet operator-(const BoolSet &, const BoolSet &); // difference + template friend BoolSet operator~(const BoolSet &); // complement + template friend bool operator==(const BoolSet &, const BoolSet &); + template friend bool operator!=(const BoolSet &, const BoolSet &); + template friend std::ostream& operator<<(std::ostream &, const BoolSet &); +}; + + +template +BoolSet::BoolSet(unsigned int size) { + assert(size >= 0); + size_ = size; + unsigned int n = size / (sizeof(T)*8); + unsigned int r = size % (sizeof(T)*8); + if (r != 0) + n++; + set_ = std::vector(n, static_cast(0)); +} + + +template +void BoolSet::set(unsigned int i) { + assert(i < size_ && i >= 0); + unsigned int n = i / (sizeof(T)*8); + unsigned int r = i % (sizeof(T)*8); + + T t = static_cast(1) << r; + set_[n] |= t; +} + + +template +void BoolSet::unset(unsigned int i) { + assert(i < size_ && i >= 0); + unsigned int n = i / (sizeof(T)*8); + unsigned int r = i % (sizeof(T)*8); + + T t = static_cast(1) << r; + t = ~t; + set_[n] &= t; +} + + +template +bool BoolSet::get(unsigned int i) const { + assert(i < size_ && i >= 0); + unsigned int n = i / (sizeof(T)*8); + unsigned int r = i % (sizeof(T)*8); + + T t = static_cast(1) << r; + t = set_[n] & t; + if (t) + return true; + else + return false; +} + + +template +unsigned int BoolSet::num_elem() const { + unsigned int n = size_; + unsigned int c = 0; + unsigned int p = 0; + while (n != 0) { + unsigned int m; + if (n >= sizeof(T)*8) { + m = sizeof(T)*8; + n -= sizeof(T)*8; + } + else { + m = n; + n = 0; + } + + T v = set_[p++]; + if (v != static_cast(0)) { + for (unsigned int i = 0; i < m; i++) { + if (v & static_cast(1)) + c++; + v >>= 1; + } + } + } + + return c; +} + + +template +bool BoolSet::imply(const BoolSet &b) const { + if (size_ >= b.size_) { + for (unsigned int i = 0; i < b.set_.size(); i++) + if ((set_[i] & b.set_[i]) != b.set_[i]) + return false; + } + else { + for (unsigned int i = 0; i < set_.size(); i++) + if ((set_[i] & b.set_[i]) != b.set_[i]) + return false; + for (unsigned int i = set_.size(); i < b.set_.size(); i++) + if (b.set_[i] != static_cast(0)) + return false; + } + + return true; +} + + +template +bool BoolSet::empty() const { + for (int i = 0; i < set_.size(); i++) + if (set_[i] != static_cast(0)) + return false; + + return true; +} + + +template +BoolSet operator|(const BoolSet &a, const BoolSet &b) { + if (a.size_ >= b.size_) { + BoolSet c = a; + for (unsigned int i = 0; i < b.set_.size(); i++) + c.set_[i] |= b.set_[i]; + return c; + } + else { + BoolSet c = b; + for (unsigned int i = 0; i < a.set_.size(); i++) + c.set_[i] |= a.set_[i]; + return c; + } +} + + +template +BoolSet operator&(const BoolSet &a, const BoolSet &b) { + if (a.size_ >= b.size_) { + BoolSet c = a; + for (unsigned int i = 0; i < b.set_.size(); i++) + c.set_[i] &= b.set_[i]; + for (unsigned int i = b.set_.size(); i < a.set_.size(); i++) + c.set_[i] = static_cast(0); + return c; + } + else { + BoolSet c = b; + for (unsigned int i = 0; i < a.set_.size(); i++) + c.set_[i] &= a.set_[i]; + for (unsigned int i = a.set_.size(); i < b.set_.size(); i++) + c.set_[i] = static_cast(0); + return c; + } +} + + +template +BoolSet operator-(const BoolSet &a, const BoolSet &b) { + BoolSet c(a.size_); + + int sz = a.set_.size(); + if (sz > b.set_.size()) + sz = b.set_.size(); + for (int i = 0; i < sz; i++) + c.set_[i] = a.set_[i] ^ (a.set_[i] & b.set_[i]); + for (int i = sz; i < a.set_.size(); i++) + c.set_[i] = a.set_[i]; + + return c; +} + + +template +BoolSet operator~(const BoolSet &b) { + unsigned int r = b.size_ % (sizeof(T)*8); + BoolSet a(b.size_); + for (unsigned int i = 0; i < b.set_.size(); i++) + a.set_[i] = ~b.set_[i]; + + if (r != 0) { + T t = static_cast(1); + for (unsigned int i = 1; i < r; i++) + t = (t << 1) | static_cast(1); + a.set_[a.set_.size()-1] &= t; + } + return a; +} + + +template +bool operator==(const BoolSet &a, const BoolSet &b) { + return (a.size_ == b.size_) && (a.set_ == b.set_); +} + + +template +bool operator!=(const BoolSet &a, const BoolSet &b) { + return !(a == b); +} + + + +template +BoolSet & BoolSet::operator|=(const BoolSet &b) { + *this = *this | b; + return *this; +} + + +template +BoolSet & BoolSet::operator&=(const BoolSet &b) { + *this = *this & b; + return *this; +} + + +template +BoolSet & BoolSet::operator-=(const BoolSet &b) { + *this = *this - b; + return *this; +} + + +template +std::ostream& operator<<(std::ostream &os, const BoolSet &b) { + for (int i = b.size()-1; i >= 0; i--) + if (b.get(i)) + os << '1'; + else + os << '0'; + return os; +} + +} // namespace + +#endif diff --git a/omegalib/basic/include/basic/Collection.h b/omegalib/basic/include/basic/Collection.h new file mode 100644 index 0000000..c7e4eef --- /dev/null +++ b/omegalib/basic/include/basic/Collection.h @@ -0,0 +1,47 @@ +#if !defined Already_Included_Collection +#define Already_Included_Collection + +namespace omega { + +template class Iterator; +template class Any_Iterator; + + +/* + * protocol for any kind of collection + */ + +template class Collection { +public: + virtual Iterator *new_iterator() = 0; + virtual Any_Iterator any_iterator() { return Any_Iterator(new_iterator()); } + + virtual int size() const = 0; +}; + + +/* + * protocol for collections whose elements are ordered + * by the way they are entered into the collection, and + * whose elements can be accessed by "index" + * + * note that the implementation need not be a linked list + */ + +template class Sequence : public Collection { +public: + virtual const T &operator[](int) const = 0; + virtual T &operator[](int) = 0; + + virtual int index(const T &) const = 0; // Y in X --> X[X.index(Y)] == Y +}; + +} // namespace + +#define instantiate_Collection(T) template class Collection; \ + instantiate_Any_Iterator(T) +#define instantiate_Sequence(T) template class Sequence; \ + instantiate_Collection(T) + +#endif + diff --git a/omegalib/basic/include/basic/Collections.h b/omegalib/basic/include/basic/Collections.h new file mode 100644 index 0000000..1e68031 --- /dev/null +++ b/omegalib/basic/include/basic/Collections.h @@ -0,0 +1,12 @@ +#if !defined Already_Included_Collections +#define Already_Included_Collections + +#include +#include +#include +#include +#include +#include + +#endif + diff --git a/omegalib/basic/include/basic/ConstString.h b/omegalib/basic/include/basic/ConstString.h new file mode 100644 index 0000000..5149e55 --- /dev/null +++ b/omegalib/basic/include/basic/ConstString.h @@ -0,0 +1,58 @@ +#if ! defined _Const_String_h +#define _Const_String_h 1 + +#include + +namespace omega { + +// should be inside Const_String, but I can't get it to +// compile the hashTable when it is: hashTable can't be +// global, but if it and its size are static to Const_String, +// the compiler still doesn't seem to like the definition, +// or the declaration either for that matter. + +class ConstStringRep { +public: + const char *name; + int count; + ConstStringRep *nextInBucket; + ConstStringRep(const char *t); +}; + +class Const_String { +private: + ConstStringRep *rep; + void buildRep(const char *t); + +public: + Const_String(); + Const_String(const char* t); + Const_String(const std::string &s); + Const_String(const Const_String & t) {rep = t.rep;} + + operator int() const; + int null() const; + + operator const char*() const; + operator std::string() const; + int operator++(int); + int operator++(); + int operator--(int); + int operator--(); + friend int operator==(const Const_String &x, const Const_String &y); + friend int operator!=(const Const_String &x, const Const_String &y); + friend int operator<(const Const_String &x, const Const_String &y); + friend int operator >(const Const_String &x, const Const_String &y); + +}; + +#if defined SCREWED_UP_CASTING_RULES +static int operator==(const Const_String &x, const char *y) +{ return x == (Const_String) y; } +static int operator!=(const Const_String &x, const char *y) +{ return x != (Const_String) y; } +#endif + +} // namespace + +#endif diff --git a/omegalib/basic/include/basic/Dynamic_Array.c b/omegalib/basic/include/basic/Dynamic_Array.c new file mode 100644 index 0000000..0300fd8 --- /dev/null +++ b/omegalib/basic/include/basic/Dynamic_Array.c @@ -0,0 +1,219 @@ +#include +#include + +namespace omega { + +template void Dynamic_Array::do_constr() + { +// #if ! defined SHUT_UP_ABOUT_STATEMENT_WITH_NO_EFFECT_IN_DYNAMIC_ARRAY_CREATION +// assert(d > 0); +// #endif + bounds = 0; + elements = 0; + partial = false; + } + + +template void Dynamic_Array1::do_construct(int d0) + { + this->bounds = new int[1]; + this->bounds[0] = d0; + this->elements = new T [d0]; + this->partial = false; + } + +template void Dynamic_Array2::do_construct(int d0, int d1) + { + this->bounds = new int[2]; + this->bounds[0] = d0; + this->bounds[1] = d1; + this->elements = new T [d0 * d1]; + this->partial = false; + } + +template void Dynamic_Array3::do_construct(int d0,int d1,int d2) + { + this->bounds = new int[3]; + this->bounds[0] = d0; + this->bounds[1] = d1; + this->bounds[2] = d2; + this->elements = new T [d0 * d1 * d2]; + this->partial = false; + } + +template void Dynamic_Array4::do_construct(int d0,int d1,int d2,int d3) + { + this->bounds = new int[4]; + this->bounds[0] = d0; + this->bounds[1] = d1; + this->bounds[2] = d2; + this->bounds[3] = d3; + this->elements = new T [d0 * d1 * d2 * d3]; + this->partial = false; + } + +template Dynamic_Array::Dynamic_Array() + { + do_constr(); + } + +template Dynamic_Array1::Dynamic_Array1(const char *) + { + this->do_constr(); + } + +template Dynamic_Array2::Dynamic_Array2(const char *,const char *) + { + this->do_constr(); + } + +template Dynamic_Array3::Dynamic_Array3(const char *,const char *,const char *) + { + this->do_constr(); + } + +template Dynamic_Array4::Dynamic_Array4(const char *,const char *,const char *,const char *) + { + this->do_constr(); + } + +template Dynamic_Array1::Dynamic_Array1(int d0) + { + do_construct(d0); + } + +template Dynamic_Array2::Dynamic_Array2(int d0, int d1) + { + do_construct(d0, d1); + } + +template Dynamic_Array3::Dynamic_Array3(int d0,int d1,int d2) + { + do_construct(d0, d1, d2); + } + +template Dynamic_Array4::Dynamic_Array4(int d0,int d1,int d2,int d3) + { + do_construct(d0, d1, d2, d3); + } + + +template void Dynamic_Array::do_destruct() + { + if (! partial) + { + delete [] bounds; + delete [] elements; + } + } + + +template Dynamic_Array::~Dynamic_Array() + { + do_destruct(); + } + + +template void Dynamic_Array1::resize(int d0) + { + assert(!this->partial); + this->do_destruct(); + if (d0 == 0) + this->do_constr(); + else + do_construct(d0); + } + +template void Dynamic_Array2::resize(int d0, int d1) + { + assert(!this->partial); + this->do_destruct(); + if (d0 == 0 && d1 == 0) + this->do_constr(); + else + do_construct(d0, d1); + } + +template void Dynamic_Array3::resize(int d0, int d1, int d2) + { + assert(!this->partial); + this->do_destruct(); + if (d0 == 0 && d1 == 0 && d2 == 0) + this->do_constr(); + else + do_construct(d0, d1, d2); + } + +template void Dynamic_Array4::resize(int d0, int d1, int d2, int d3) + { + assert(!this->partial); + this->do_destruct(); + if (d0 == 0 && d1 == 0 && d2 == 0 && d3 == 0) + this->do_constr(); + else + do_construct(d0, d1, d2, d3); + } + + +template T& Dynamic_Array1::operator[](int d0) + { +#if !defined (NDEBUG) + assert(this->elements != 0 && "Trying to dereference undefined array"); + assert(0 <= d0 && d0 < this->bounds[0] && "Array subscript out of bounds"); +#endif + + return this->elements[d0]; + } + +template Dynamic_Array1 Dynamic_Array2::operator[](int d0) + { +#if !defined (NDEBUG) + assert(this->elements != 0 && "Trying to dereference undefined array"); + assert(0 <= d0 && d0 < this->bounds[0] && "Array subscript out of bounds"); +#endif + + Dynamic_Array1 result; + result.bounds = this->bounds+1; + result.elements = this->elements + this->bounds[1] * d0; + result.partial = true; + return result; + } + +template Dynamic_Array2 Dynamic_Array3::operator[](int d0) + { +#if !defined (NDEBUG) + assert(this->elements != 0 && "Trying to dereference undefined array"); + assert(0 <= d0 && d0 < this->bounds[0] && "Array subscript out of bounds"); +#endif + Dynamic_Array2 result; + result.bounds = this->bounds+1; + result.elements = this->elements + this->bounds[1] * this->bounds[2] * d0; + result.partial = true; + return result; + } + +template Dynamic_Array3 Dynamic_Array4::operator[](int d0) + { +#if !defined (NDEBUG) + assert(this->elements != 0 && "Trying to dereference undefined array"); + assert(0 <= d0 && d0 < this->bounds[0] && "Array subscript out of bounds"); +#endif + + Dynamic_Array3 result; + result.bounds = this->bounds+1; + result.elements = this->elements + this->bounds[1] * this->bounds[2] * this->bounds[3] * d0; + result.partial = true; + return result; + } + + +template + Dynamic_Array::Dynamic_Array(Dynamic_Array &D) + { + assert(D.elements != 0 && "Trying to copy an undefined array"); + partial = true; + bounds = D.bounds; + elements = D.elements; + } + +} // namespace diff --git a/omegalib/basic/include/basic/Dynamic_Array.h b/omegalib/basic/include/basic/Dynamic_Array.h new file mode 100644 index 0000000..c0bdf12 --- /dev/null +++ b/omegalib/basic/include/basic/Dynamic_Array.h @@ -0,0 +1,103 @@ +#ifndef Already_Included_Dynamic_Array +#define Already_Included_Dynamic_Array + +namespace omega { + +template class Dynamic_Array2; +template class Dynamic_Array3; +template class Dynamic_Array4; + +template class Dynamic_Array + { + public: + Dynamic_Array(Dynamic_Array &D); + ~Dynamic_Array(); + + protected: + Dynamic_Array(); + bool partial; + int *bounds; + T *elements; + + void do_constr(); + void do_destruct(); + }; + + +template class Dynamic_Array1 : public Dynamic_Array + { + public: + Dynamic_Array1(const char *s0 = 0); + Dynamic_Array1(int d0); + void resize(int d0); + T& operator[](int d); + + friend class Dynamic_Array2; + + private: + void do_construct(int d0); + }; + + +template class Dynamic_Array2 : public Dynamic_Array + { + public: + Dynamic_Array2(const char *s0 = 0, const char *s1 = 0); + Dynamic_Array2(int d0, int d1); + void resize(int d0, int d1); + Dynamic_Array1 operator[](int d); + + friend class Dynamic_Array3; + + private: + void do_construct(int d0, int d1); + }; + + +template class Dynamic_Array3 : public Dynamic_Array + { + public: + Dynamic_Array3(const char *s0 = 0, const char *s1 = 0, const char *s2 = 0); + Dynamic_Array3(int d0, int d1, int d2); + void resize(int d0, int d1, int d2); + Dynamic_Array2 operator[](int d); + + friend class Dynamic_Array4; + + private: + void do_construct(int d0, int d1, int d2); + }; + +template class Dynamic_Array4 : public Dynamic_Array + { + public: + Dynamic_Array4(const char *s0 = 0, const char *s1 = 0, const char *s2 = 0, const char *s3 = 0); + Dynamic_Array4(int d0, int d1, int d2, int d3); + void resize(int d0, int d1, int d2, int d3); + Dynamic_Array3 operator[](int d); + + private: + void do_construct(int d0, int d1, int d2, int d3); + }; + +} // namespace + +#if ! defined DONT_INCLUDE_TEMPLATE_CODE +#include +#endif + +#define instantiate_Dynamic_Array1(T) template class Dynamic_Array1; \ + template class Dynamic_Array; + +#define instantiate_Dynamic_Array2(T) template class Dynamic_Array2; \ + template class Dynamic_Array; \ + instantiate_Dynamic_Array1(T); + +#define instantiate_Dynamic_Array3(T) template class Dynamic_Array3; \ + template class Dynamic_Array; \ + instantiate_Dynamic_Array2(T); + +#define instantiate_Dynamic_Array4(T) template class Dynamic_Array4; \ + template class Dynamic_Array; \ + instantiate_Dynamic_Array3(T); +#endif diff --git a/omegalib/basic/include/basic/Iterator.h b/omegalib/basic/include/basic/Iterator.h new file mode 100644 index 0000000..8975d9e --- /dev/null +++ b/omegalib/basic/include/basic/Iterator.h @@ -0,0 +1,131 @@ +/* + * Base classes for iterators, generators + * + * These don't really work yet for constant collections. + * I'm not sure how to make that happen. + */ + +#if ! defined _Iterator_h +#define _Iterator_h 1 + +#include + +namespace omega { + +#define foreach(x,T,S,A) do {for (omega::Any_Iterator __P_##x = (S).any_iterator();__P_##x;__P_##x++) {T & x = *__P_##x; A;}} while (0) + +#define foreachSeparated(x,T,S,A,B) do {for (omega::Any_Iterator __P_##x = (S).any_iterator();__P_##x;) {T & x = *__P_##x; A; __P_##x++; if (__P_##x) B;}} while (0) + +/* + * Abstract base class Iterator + * Supports two styles of iteration: + * + * for ( ... initialize i (typically i = collection) ... ; i ; i++ ) + * operate_on(*i) + * + * or + * + * for ( ... initialize i ... ; i.live() ; i.next() ) + * operate_on(i.curr()) + * + * >>> IF THE COLLECTION IS CHANGED, THE ITERATOR IS NO LONGER VALID <<< + * + * For collections that are not "Sequence"s, the order in + * which the elements are returned may not be consistent. + */ + +template class Iterator { +public: + virtual const T & operator*() const = 0; + virtual T & operator*() = 0; + + virtual void operator++(int) = 0; + virtual void operator++() = 0; + + virtual bool live() const = 0; + operator bool() const { return live(); } + + const T & curr() const { return *(*this); } + T & curr() { return *(*this); } + void next() { (*this)++; } + + virtual Iterator *new_copy() const = 0; + virtual ~Iterator() {} +}; + + +// A generator is like an iterator but it gives out values, +// which may or may not exist in some writable collection + +template class Generator { +public: + virtual T operator*() const = 0; + + virtual void operator++(int) = 0; + virtual void operator++() = 0; + + virtual int live() const = 0; + operator int() const { return live(); } + + const T curr() const { return *(*this); } + T curr() { return *(*this); } + void next() { (*this)++; } +}; + + + +// Delegate to any kind of iterator (on the heap) +// If created via a reference, become a copy of the iterator +// If created via a pointer, manipulate that pointer and free *p when this dies +// +// Mostly useful for Collection::iterator +// Iterator::Iterator(Collection) + + +template class Any_Iterator : public Iterator { +public: + Any_Iterator(Collection &c); + Any_Iterator(const Iterator &i); // copy of i + + virtual ~Any_Iterator() { delete me; } + + Any_Iterator &operator=(const Any_Iterator &rhs) + { delete me; me = rhs.me->new_copy(); return *this; } + + const T & operator*() const { return *(*me); } + T & operator*() { return *(*me); } + void operator++(int) { (*me)++; } + void operator++() { ++(*me); } + bool live() const { return (*me).live(); } + + Iterator *new_copy() const { return new Any_Iterator((*me).new_copy()); } + +private: + Any_Iterator(Iterator *p) // take over *p, *p MUST BE ON THE HEAP + { me = p; } + friend class Collection; +#if 0 + // Couldn't make this work with g++258 + friend Any_Iterator Collection::any_iterator(); +#endif + Iterator *me; +}; + +template inline Any_Iterator::Any_Iterator(Collection &c) + { + me = c.new_iterator(); + } + +template inline Any_Iterator::Any_Iterator(const Iterator &i) + { + me = i.new_copy(); + } + +} // namespace + +#define instantiate_Iterator(T) template class Iterator; +#define instantiate_Generator(T) template class Generator; +#define instantiate_Any_Iterator(T) template class Any_Iterator; \ + instantiate_Iterator(T) + +#endif diff --git a/omegalib/basic/include/basic/Link.h b/omegalib/basic/include/basic/Link.h new file mode 100644 index 0000000..ede7a2b --- /dev/null +++ b/omegalib/basic/include/basic/Link.h @@ -0,0 +1,98 @@ +#if ! defined _Link_h +#define _Link_h 1 + +#include +#include + +namespace omega { + +// By default, if ndebug is not set, do not do free list + +#if ! defined ListElementFreeList +#if ! defined NDEBUG || defined ASSERTIONS_ANYWAY +#define ListElementFreeList 0 +#else +#define ListElementFreeList 1 +#endif +#endif + +/* + List_Element: one item in a list and the pointer to the next. + Each such object should be pointed to by either exactly one + other List_Element or by some other pointer(s), exactly one + of which will delete the List_Element. + ListElements should ONLY be allocated on the heap. + */ + +#if ListElementFreeList + // g++ 2.5.8 does not allow static data in template classes, so... + extern void *kludgy_List_Element_new(size_t size); + extern void kludgy_List_Element_delete(void *ptr, size_t size); +#endif + +template class List_Element { +public: +#if ListElementFreeList + void *operator new(size_t size) + { + return kludgy_List_Element_new(size); + } + void operator delete(void *ptr, size_t size) + { + kludgy_List_Element_delete(ptr, size); + } +#endif + + T head; + List_Element *tail; + + List_Element() { + tail = 0; + } + List_Element(T h, List_Element * t) { + head = h; + tail = t; + } + List_Element(const List_Element & L) { + head = L.head; + if (L.tail) tail = new List_Element(*L.tail); + else tail = 0; + } + List_Element & operator=(const List_Element &L) { + if (this != &L) { + head = L.head; + if (tail) delete tail; + if (L.tail) tail = new List_Element(*L.tail); + else tail = 0; + } + return *this; + } + virtual ~List_Element() { // virtual ensures 2nd arg of delete is right + delete tail; + } +}; + + + +template class List_Element_Iterator : public Iterator { +public: + List_Element_Iterator(List_Element* j) { i = j; } + virtual const T & operator*() const { return i->head; } + virtual T & operator*() { return i->head; } + virtual void operator++(int) { i = i->tail; } + virtual void operator++() { i = i->tail; } + virtual bool live() const { return i != 0; } + Iterator * new_copy() const { return new List_Element_Iterator(i);} + +protected: + List_Element *i; +}; + +} // namespace + +#define instantiate_Only_List_Element(T) template class List_Element; \ + template class List_Element_Iterator; +#define instantiate_List_Element(T) instantiate_Only_List_Element(T)\ + instantiate_Collection(T) + +#endif diff --git a/omegalib/basic/include/basic/List.c b/omegalib/basic/include/basic/List.c new file mode 100644 index 0000000..f05e0de --- /dev/null +++ b/omegalib/basic/include/basic/List.c @@ -0,0 +1,149 @@ +#include + +namespace omega { + +template List_Iterator::List_Iterator(List &l) +: List_Element_Iterator(l.contents) {} + +template List_Iterator::List_Iterator(const List &l) +: List_Element_Iterator(l.contents) {} + +template List_Iterator::List_Iterator() +: List_Element_Iterator(0) {} + +template Iterator *List::new_iterator() +{ + return new List_Iterator(*this); +} + +template const T &List::operator[](int i) const +{ + assert(i > 0 && "Subscript out of bounds"); + List_Iterator p(*this); + + while(--i > 0 && p) + p++; + + if (p) + return *p; + else + return *((T *)0); +} + +template T &List::operator[](int i) +{ + assert(i > 0 && "Subscript out of bounds"); + List_Iterator p(*this); + + while(--i > 0 && p) + p++; + + if (p) + return *p; + else + return *((T *)0); +} + +template int List::index(const T &item) const +{ + List_Iterator p(*this); + int i = 1; + + while(p && *p != item) + { + p++; + i++; + } + + if (p) + return i; + else + return 0; +} + +template int List::size() const + { + int i = 0; + List_Element * p = contents; + while (p) + { + p = p->tail; + i++; + } + return i; + } + +template T &List::front() const + { + return contents->head; + } + +template T List::remove_front() + { + List_Element *frunt = contents; + contents = contents->tail; + T fruntT = frunt->head; + frunt->tail = 0; + delete frunt; + return fruntT; + } + +template void List::prepend(const T &item) + { + contents = new List_Element(item, contents); + } + + +template void List::append(const T &item) + { + *(end()) = new List_Element(item, 0); + } + +template void List::ins_after(List_Iterator i, + const T &item) + { +#if ! defined NDEBUG + for (List_Element *e = contents; e != &(i.element()); e=e->tail) + { + assert(e); + } +#endif + i.element().tail = new List_Element(item, i.element().tail); + } + +template void List::del_front() + { + List_Element *e = contents; + contents = contents->tail; + e->tail = 0; + delete e; + } + +template void List::del_after(List_Iterator i) + { +#if ! defined NDEBUG + for (List_Element *e0 = contents; e0 != &(i.element()); e0=e0->tail) + { + assert(e0); + } +#endif + List_Element *e = i.element().tail; + i.element().tail = e->tail; + e->tail = 0; + delete e; + } + +template void List::clear() + { + delete contents; + contents = 0; + } + +template void List::join(List &consumed) + { + List_Element *e = consumed.contents; + consumed.contents = 0; + *(end()) = e; + } + +} // namespace diff --git a/omegalib/basic/include/basic/List.h b/omegalib/basic/include/basic/List.h new file mode 100644 index 0000000..c6fc062 --- /dev/null +++ b/omegalib/basic/include/basic/List.h @@ -0,0 +1,95 @@ +#if ! defined _List_h +#define _List_h 1 + +/* + * Linked lists with an interface like a bit of libg++'s SLList class + */ + + +#if 0 +#include /* List requires assert which needs Exit which */ +#endif /* needs List! just include assert in List.c */ +#include // for NULL +#include +#include +#include + +namespace omega { + +template class List_Iterator; + +// +// indexing of Lists starts at 1, index == 0 means not there +// + +template class List : public Sequence { +public: + List(const List &l) + { contents = l.contents ? new List_Element(*l.contents) : 0; } + List() { contents = 0; } + virtual ~List() { delete contents; } + + Iterator *new_iterator(); + const T &operator[](int) const; + T &operator[](int); + + int index(const T &) const; + + int size() const; + int length() const { return size(); } + bool empty() const { return size() == 0; } + + T &front() const; + +// insertion/deletion on a list invalidates any iterators +// that are on/after the element added/removed + + T remove_front(); + + void prepend(const T &item); + void append(const T &item); + void ins_after(List_Iterator i, const T &item); + + void del_front(); + void del_after(List_Iterator i); + void clear(); + + void join(List &consumed); + +private: + friend class List_Iterator; + List_Element **end() + { + List_Element **e = &contents; + while (*e) + e = &((*e)->tail); + return e; + } + + List_Element *contents; +}; + + +template class List_Iterator : public List_Element_Iterator { +public: + List_Iterator(List &l); + List_Iterator(const List &l); + List_Iterator(); +private: + List_Element &element() { return *List_Element_Iterator::i; } ; + friend class List; +}; + +} // namespace + +#if ! defined DONT_INCLUDE_TEMPLATE_CODE +#include +#endif + +#define instantiate_List(T) template class List; \ + template class List_Iterator; \ + instantiate_Only_List_Element(T) \ + instantiate_Sequence(T) + + +#endif diff --git a/omegalib/basic/include/basic/Map.c b/omegalib/basic/include/basic/Map.c new file mode 100644 index 0000000..69cc3f7 --- /dev/null +++ b/omegalib/basic/include/basic/Map.c @@ -0,0 +1,63 @@ +namespace omega { + +template MapElement:: MapElement(const MapElement& M) { + if (M.tail) tail = new MapElement(*M.tail); + else tail = 0; + k = M.k; + v = M.v; + } + +template MapElement & + MapElement:: operator=(const MapElement& M) { + if (this != &M) { + if (tail) delete tail; + if (M.tail) tail = new MapElement(*M.tail); + else tail = 0; + k = M.k; + v = M.v; + } + return *this; + } + + + + +#if ! defined linux +template Map ::Map(const V &default_value) +#else +template Map ::Map(V default_value) +#endif + : _default_value(default_value) + { + contents = 0; + } + +template Map ::~Map() + { + delete contents; + } + +template V Map::operator()(K k) const { + MapElement * P = contents; + while (P) { + if (P->k == k) return P->v; + P = P->tail; + }; + return _default_value; + } + +template V & Map::operator[](K k) { + MapElement * P = contents; + while (P) { + if (P->k == k) return P->v; + P = P->tail; + }; + P = new MapElement ; + P->k = k; + P->v = _default_value; + P->tail = contents; + contents = P; + return P->v; + } + +} // namespace diff --git a/omegalib/basic/include/basic/Map.h b/omegalib/basic/include/basic/Map.h new file mode 100644 index 0000000..f94a10c --- /dev/null +++ b/omegalib/basic/include/basic/Map.h @@ -0,0 +1,68 @@ +#if ! defined _Map_h +#define _Map_h 1 + +#include +#include // for NULL + +namespace omega { + +#define foreach_map(k,K,v,V,M,A) {for (omega::MapElementIterator __M_##k = (M).iterator();__M_##k;__M_##k++) {K & k = *__M_##k; V & v = __M_##k.value(); A;}} + +template class MapElement { +public: + K k; + V v; + MapElement *tail; + MapElement(const MapElement&); + MapElement() {} + MapElement & operator=(const MapElement&); + ~MapElement() { delete tail; } +}; + +template class MapElementIterator { +public: + MapElementIterator(MapElement* j) { i = j;} + virtual const K & operator*() const { return i->k; } + virtual K & operator*() { return i->k;} + virtual const V & value() const { return i->v; } + virtual V & value() { return i->v; } + virtual void operator++(int) { i = i->tail; } + virtual void operator++() { i = i->tail; } + virtual bool live() const { return i != NULL; } + operator bool() const { return live(); } +protected: +MapElement *i; +}; + +template class Map { +public: +#if ! defined linux + Map(const V &default_value); +#else + // work around for '386 g++ on Linux + Map(V default_value); +#endif + ~Map(); + MapElementIterator iterator() + {return MapElementIterator(contents);} + int empty() const {return contents == NULL;} + V operator()(K) const; + V& operator[](K); +private: + MapElement * contents; + V _default_value; +}; + +} // namespace + +#if ! defined DONT_INCLUDE_TEMPLATE_CODE +#include +#endif + +#define instantiate_Map(T1,T2) template class Map; \ + template class MapElement; \ + template class MapElementIterator; +#define instantiate_MapElement(T1,T2) instantiate_Map(T1,T2) +#define instantiate_MapElementIterator(T1,T2) instantiate_Map(T1,T2) + +#endif diff --git a/omegalib/basic/include/basic/Section.c b/omegalib/basic/include/basic/Section.c new file mode 100644 index 0000000..754e002 --- /dev/null +++ b/omegalib/basic/include/basic/Section.c @@ -0,0 +1,79 @@ +#include + +namespace omega { + +template Section::Section(Sequence *s, int start, int length) + { + assert(s->size() >= start-1 + length); + it = s; + _start = start; + _length = length; + } + +template Iterator *Section::new_iterator() + { + return new Section_Iterator(*this); + } + +template const T &Section::operator[](int i) const + { + assert(1 <= i && i <= size()); + return (*it)[i+(_start-1)]; + } + +template T &Section::operator[](int i) + { + assert(1 <= i && i <= size()); + return (*it)[i+(_start-1)]; + } + +template int Section::index(const T &var) const + { + int i; + for (i=1; i<=size(); i++) + if ((*this)[i] == var) + return i; + return 0; + } + +template int Section::size() const + { + return _length; + } + + +template Section_Iterator::Section_Iterator(Section &sec) + { + it = sec.it->new_iterator(); + for (int i = 1; i < sec._start; i++) + (*it)++; + remaining = sec.size(); + } + + +template Section_Iterator::Section_Iterator(const Section_Iterator &si) : it(si.it), remaining(si.remaining) {} + + +template void Section_Iterator::operator++() + { this->operator++(0); } + +template void Section_Iterator::operator++(int) + { + if (remaining > 0) + { + (*it)++; + remaining--; + } + } + +template bool Section_Iterator::live() const + { + return (remaining > 0); + } + +template Iterator *Section_Iterator::new_copy() const + { + return new Section_Iterator(*this); + } + +} // namespace diff --git a/omegalib/basic/include/basic/Section.h b/omegalib/basic/include/basic/Section.h new file mode 100644 index 0000000..60821d1 --- /dev/null +++ b/omegalib/basic/include/basic/Section.h @@ -0,0 +1,63 @@ +#if ! defined _Section_h +#define _Section_h 1 +/* + Section of an existing collection viewed as a collection + */ + +#include + +namespace omega { + +template class Section_Iterator; + +template class Section : public Sequence { +public: + Section(Sequence *, int start, int length); + + Iterator *new_iterator(); + + const T &operator[](int) const; + T &operator[](int); + + int index(const T &) const; + int size() const; + + friend class Section_Iterator; + +private: + Sequence *it; + int _start, _length; +}; + +template class Section_Iterator : public Iterator { +public: + Section_Iterator(Section &sec); + virtual ~Section_Iterator() { delete it; } + + const T & operator*() const { return *(*it); } + T & operator*() { return *(*it); } + + void operator++(int); + void operator++(); + + bool live() const; + Iterator *new_copy() const; + +private: + Section_Iterator(const Section_Iterator &si); + Iterator *it; + int remaining; +}; + +} // namespace + +#if ! defined DONT_INCLUDE_TEMPLATE_CODE +#include +#endif + +#define instantiate_Section(T) template class Section; \ + template class Section_Iterator; \ + instantiate_Sequence(T) +#define instantiate_Section_Iterator(T) instantiate_Section(T) + +#endif diff --git a/omegalib/basic/include/basic/SimpleList.c b/omegalib/basic/include/basic/SimpleList.c new file mode 100644 index 0000000..da7de9b --- /dev/null +++ b/omegalib/basic/include/basic/SimpleList.c @@ -0,0 +1,105 @@ +namespace omega { + +template Simple_List_Iterator::Simple_List_Iterator(Simple_List &l) +: List_Element_Iterator(l.contents) {} + +template Simple_List_Iterator::Simple_List_Iterator(const Simple_List &l) +: List_Element_Iterator(l.contents) {} + +template Simple_List_Iterator::Simple_List_Iterator() +: List_Element_Iterator(0) {} + +template Iterator *Simple_List::new_iterator() +{ + return new Simple_List_Iterator(*this); +} + +template const T &Simple_List::operator[](int i) const +{ + Simple_List_Iterator p(*this); + + while(--i > 0 && p) + p++; + + if (p) + return *p; + else + return *((T *)0); +} + +template T &Simple_List::operator[](int i) +{ + Simple_List_Iterator p(*this); + + while(--i > 0 && p) + p++; + + if (p) + return *p; + else + return *((T *)0); +} + + +template int Simple_List::size() const + { + int i = 0; + List_Element * p = contents; + while (p) + { + p = p->tail; + i++; + } + return i; + } + +template T &Simple_List::front() const + { + return contents->head; + } + +template T Simple_List::remove_front() + { + List_Element *frunt = contents; + contents = contents->tail; + T fruntT = frunt->head; + frunt->tail = 0; + delete frunt; + return fruntT; + } + +template void Simple_List::prepend(const T &item) + { + contents = new List_Element(item, contents); + } + + +template void Simple_List::append(const T &item) + { + *(end()) = new List_Element(item, 0); + } + + +template void Simple_List::del_front() + { + List_Element *e = contents; + contents = contents->tail; + e->tail = 0; + delete e; + } + + +template void Simple_List::clear() + { + delete contents; + contents = 0; + } + +template void Simple_List::join(Simple_List &consumed) + { + List_Element *e = consumed.contents; + consumed.contents = 0; + *(end()) = e; + } + +} // namespace diff --git a/omegalib/basic/include/basic/SimpleList.h b/omegalib/basic/include/basic/SimpleList.h new file mode 100644 index 0000000..a08b307 --- /dev/null +++ b/omegalib/basic/include/basic/SimpleList.h @@ -0,0 +1,93 @@ +#if ! defined _Simple_List_h +#define _Simple_List_h 1 + +/* + * Linked lists with an interface like a bit of libg++'s SLSimple_List class + */ + +#include +#include +#include +#include + +namespace omega { + +#define Simple_List Omega_Simple_List +#define Simple_List_Iterator Omega_Simple_List_Iterator + +template class Simple_List_Iterator; + +// A TEMPORARY HACK - ERROR IF YOU TRY TO USE "INDEX" - FERD + +template class Simple_List : public Sequence { +public: + Simple_List(const Simple_List &l) + { contents = l.contents ? new List_Element(*l.contents) : 0; } + Simple_List() { contents = 0; } + virtual ~Simple_List() { delete contents; } + + Iterator *new_iterator(); + const T &operator[](int) const; + T &operator[](int); + + + int size() const; + int length() const { return size(); } + int empty() const { return size() == 0; } + + T &front() const; + +// insertion/deletion on a list invalidates any iterators +// that are on/after the element added/removed + + T remove_front(); + + void prepend(const T &item); + void append(const T &item); + + void del_front(); + void clear(); + + void join(Simple_List &consumed); + + int index(const T &) const { + assert(0&&"ILLEGAL SimpleList operation\n"); + return -1; + } + +private: + friend class Simple_List_Iterator; + List_Element **end() + { + List_Element **e = &contents; + while (*e) + e = &((*e)->tail); + return e; + } + + List_Element *contents; +}; + + +template class Simple_List_Iterator : public List_Element_Iterator { +public: + Simple_List_Iterator(Simple_List &l); + Simple_List_Iterator(const Simple_List &l); + Simple_List_Iterator(); +private: + List_Element &element() { return *this->i; } ; + friend class Simple_List; +}; + +} // namespace + +#if ! defined DONT_INCLUDE_TEMPLATE_CODE +#include +#endif + +#define instantiate_Simple_List(T) template class Simple_List; \ + template class Simple_List_Iterator; \ + instantiate_Only_List_Element(T) \ + instantiate_Sequence(T) + +#endif diff --git a/omegalib/basic/include/basic/Tuple.c b/omegalib/basic/include/basic/Tuple.c new file mode 100644 index 0000000..ce99e82 --- /dev/null +++ b/omegalib/basic/include/basic/Tuple.c @@ -0,0 +1,254 @@ +/* class Tuple */ + +// THESE FIRST TWO REALLY SHOULD BE INLINE BUT IT BREAKS CFRONT: + +namespace omega { + +template T &Tuple::operator[](int index) + { + assert(1 <= index && index <= sz); return data[index-1]; + } + +template const T &Tuple::operator[](int index) const + { + assert(1 <= index && index <= sz); return data[index-1]; + } + + +template Tuple::~Tuple() + { + if (data) + delete [] data; + } + +template Tuple::Tuple() : sz(0), alloc_sz(0), + prealloc_min(20),prealloc_pad(5), data(0) +{ + // nothing needs be done + } + +template Tuple::Tuple(int size) : sz(size), + prealloc_min(20),prealloc_pad(5) +{ + if (sz > 0) + { + alloc_sz = prealloc_size(sz); + data = new T[alloc_sz]; + assert(alloc_sz >= sz); + //Need some handling for out of memory. + assert (data!=0); + } + else { + alloc_sz = 0; + data = 0; + } +} + + +template Tuple::Tuple(const Tuple& t) + : sz(t.sz), alloc_sz(t.alloc_sz), prealloc_min(20),prealloc_pad(5) +{ + if (sz > 0) { + data = new T[alloc_sz]; + assert (data!=0); + assert (alloc_sz >= sz); + for (int i=0; i Tuple& Tuple::operator=(const Tuple& t) +{ + if (this != &t) { // Delete this + if (data) + delete [] data; + sz = t.sz; + alloc_sz = t.alloc_sz; + assert(alloc_sz >= sz); + if (sz > 0) { // Copy old + data = new T[alloc_sz]; + assert (data!=0); + for (int i=0; i void Tuple::reallocate(const int req_size) +{ + if (alloc_sz >= req_size) { // if (sz >= req_size), does this. + sz = req_size; + return; + } + alloc_sz = prealloc_size(req_size); + T* tmp_data = new T[alloc_sz]; + for(int i=0;i= req_size); +} + +template void Tuple::delete_last() +{ +assert(sz > 0); +sz --; +} + +template void Tuple::append(const T &v) +{ + // Check if reallocation is necessary. + if (sz == 0) { // Empty Tuple + assert(alloc_sz >= 0); // May be nonzero for cleared tuple + + if(alloc_sz == 0) { // If it's > 1 no allocation is necessary + alloc_sz = prealloc_size(1); + data = new T[alloc_sz]; + } + assert (alloc_sz > 0 && data != 0); + } else { + if(sz == alloc_sz) { // Requires new allocation + alloc_sz = realloc_size(alloc_sz); + T * data_tmp = new T[alloc_sz]; + assert (data_tmp!=0); + assert (alloc_sz > sz); + for (int i=0; i= sz); + data[sz++] = v; +} + +template void Tuple::append(const Tuple& t) { + int old_sz = sz; + reallocate(t.size()+size()); + assert(alloc_sz >= sz); + for(int i=0; i void Tuple::join(Tuple& t) { + int old_sz = sz; + reallocate(t.size()+size()); + assert(alloc_sz >= sz); + for(int i=0; i void Tuple::clear() { if (sz) delete [] data; data = 0; alloc_sz = 0; sz = 0; } + +template int Tuple::empty() const { return (sz == 0); } + +template Iterator *Tuple::new_iterator() +{ + return new Tuple_Iterator(*this); +} + +template int Tuple::index(const T & var) const +/* returns index or 0 if var isn't in the tuple */ +{ + int i; + for (i=0; i bool Tuple::operator == (const Tuple& b) const +{ + int i; + if (sz != b.size()) return false; + for (i=0; i Tuple_Iterator::Tuple_Iterator(const Tuple &tpl) : +current(tpl.data), lastptr(tpl.data+tpl.sz-1), firstptr(tpl.data), sz(tpl.sz) +{ +} + +template Tuple_Iterator::Tuple_Iterator(T * cr, T *frst, T * lst, + int insz) + : current(cr), lastptr(lst), firstptr(frst), sz(insz) +{ +} + +template const T & Tuple_Iterator::operator*() const +{ + assert (current<=lastptr && current>=firstptr); + return *current; +} + +template T & Tuple_Iterator::operator*() +{ + assert (current<=lastptr && current >=firstptr); + return *current; +} + +template void Tuple_Iterator::operator++(int) +{ + current++; +} + +template void Tuple_Iterator::operator++() +{ + current++; +} + +template void Tuple_Iterator::operator--(int) +{ + current--; +} + +template void Tuple_Iterator::operator--() +{ + current--; +} + +template void Tuple_Iterator::set_to_last() +{ + current = lastptr; +} + +template void Tuple_Iterator::set_to_first() +{ + current = firstptr; +} + +template void Tuple_Iterator::set_position(const int req_pos) +{ + assert(req_pos <= sz && 1 <= req_pos); + current = firstptr + (req_pos - 1); +} + + +template bool Tuple_Iterator::live() const +{ + return (current !=0 && current<=lastptr && current >= firstptr); +} + +template Iterator *Tuple_Iterator::new_copy() const { + return new Tuple_Iterator(current, firstptr, lastptr, sz); +} + +} // namespace diff --git a/omegalib/basic/include/basic/Tuple.h b/omegalib/basic/include/basic/Tuple.h new file mode 100644 index 0000000..28e83bd --- /dev/null +++ b/omegalib/basic/include/basic/Tuple.h @@ -0,0 +1,90 @@ +#if !defined _Already_defined_tuple +#define _Already_defined_tuple + +#include + +#include +#include +#include + +namespace omega { + +template class Tuple_Iterator; + +// TUPLES ARE INDEXED STARTING AT 1 +// index\(i\) == 0 MEANS i IS NOT IN THE TUPLE + +template class Tuple : public Sequence { +public: + Tuple(); + Tuple(int size); + Tuple (const Tuple& tpl); + virtual ~Tuple(); + Tuple& operator=(const Tuple& tpl); + int size() const { return sz; } + int length() const { return sz; } + bool operator==(const Tuple &b) const; + void reallocate(const int); + void delete_last(); + void append(const Tuple &v); + void append(const T &v); + void join(Tuple &v); + void clear(); + int empty() const; + + Iterator *new_iterator(); + + virtual T &operator[](int index); + virtual const T &operator[](int index) const; + + int index(const T &) const; + + friend class Tuple_Iterator; + +private: + int prealloc_size(const int req_size) + { return max(req_size+prealloc_pad,prealloc_min); } + int realloc_size(const int oldsize) { return 2*oldsize; } + + + int sz, alloc_sz; // Number of elements, size of allocated array + int prealloc_min,prealloc_pad; // These should be static, but that + // causes portability prob. for initialization + +protected: + T * data; +}; + +template class Tuple_Iterator : public Iterator { +public: + Tuple_Iterator(const Tuple &tpl); + const T & operator*() const; + T & operator*(); + void set_position(const int req_pos); + void operator++(int); + void operator++(); + void operator--(int); + void operator--(); + void set_to_last(); + void set_to_first(); +// void set_position(const int req_pos); Don't do this, compiler bug + bool live() const; + Iterator *new_copy() const; + +private: + Tuple_Iterator(T * cr, T * frst, T *lst, int insz); + T * current, * lastptr, *firstptr; + int sz; +}; + +} // namespace + +#if ! defined DONT_INCLUDE_TEMPLATE_CODE +#include +#endif + +#define instantiate_Tuple(T) template class Tuple; \ + template class Tuple_Iterator; \ + instantiate_Sequence(T) + +#endif diff --git a/omegalib/basic/include/basic/boolset-test.cc b/omegalib/basic/include/basic/boolset-test.cc new file mode 100755 index 0000000..5b68220 --- /dev/null +++ b/omegalib/basic/include/basic/boolset-test.cc @@ -0,0 +1,72 @@ +#include "boolset.h" +#include + +using namespace omega; + +void foo(const BoolSet<> &B) { + for (BoolSet<>::const_iterator i = B.begin(); i != B.end(); i++) + std::cout << *i << ' '; + std::cout << std::endl; +} + +int main() { + BoolSet<> A(13); + + A.set(2); + std::cout << A << std::endl; + + A.set_all(); + std::cout << A << std::endl; + + A.unset_all(); + std::cout << A << std::endl; + + A.set(2); + A.set(4); + + BoolSet<> B(13); + B.set(2); + + std::cout << "A: " << A << std::endl; + std::cout << "B: " << B << std::endl; + + std::cout << A.imply(B) << std::endl; + std::cout << B.imply(A) << std::endl; + + B.set(10); + std::cout << (A|B) << std::endl; + std::cout << (A&B) << std::endl; + + BoolSet<> C(3); + C.set(0); + std::cout << (A|C) << std::endl; + std::cout << ~(A|C) << std::endl; + + B = BoolSet<>(23); + std::cout << "test iterator\n"; + B.set(12); + B.set(11); + B.set(0); + std::cout << B << std::endl; + for (BoolSet<>::const_iterator i = B.begin(); i != B.end(); i++) { + std::cout << *i << ' '; + if (*i == 11) + B.unset(*i); + } + std::cout << std::endl; + std::cout << B << std::endl; + std::cout << std::endl; + foo(B); + + std::cout << ~BoolSet<>(5) << std::endl; + + std::cout << "------\n"; + B.dump(); + std::cout << std::endl << *(B.begin()+1) << std::endl; + + for (BoolSet<>::iterator i = B.begin(); i != B.end(); i++) + for (BoolSet<>::iterator j = i; j != B.end(); j++) + if (j == i) + std::cout << "ehh-"; + +} diff --git a/omegalib/basic/include/basic/boolset.h b/omegalib/basic/include/basic/boolset.h new file mode 100755 index 0000000..dc9ef83 --- /dev/null +++ b/omegalib/basic/include/basic/boolset.h @@ -0,0 +1,637 @@ +/***************************************************************************** + Copyright (C) 2009-2011 Chun Chen + All Rights Reserved. + + Purpose: + BoolSet class, used as a set of integers from 0..n-1 where n is a very + small integer. + + Notes: + Set operands of binary operations can be of different sizes, missing + elements are treated as false. + + History: + 03/30/09 Created by Chun Chen. + 03/26/11 iterator added, -chun +*****************************************************************************/ + +#ifndef _BOOLSET_H +#define _BOOLSET_H + +#include +#include +#include +#include +#include + +namespace omega { + +template +class BoolSet { +protected: + unsigned int size_; + std::vector set_; + +public: + BoolSet(unsigned int size = 0); + ~BoolSet() {} + + void set(unsigned int); + void unset(unsigned int); + void set_all(); + void unset_all(); + bool get(unsigned int) const; + unsigned int size() const {return size_;} + unsigned int num_elem() const; + bool imply(const BoolSet &) const; + bool empty() const; + void dump() const; + + BoolSet &operator|=(const BoolSet &); + BoolSet &operator&=(const BoolSet &); + BoolSet &operator-=(const BoolSet &); + + template friend BoolSet operator|(const BoolSet &, const BoolSet &); // union + template friend BoolSet operator&(const BoolSet &, const BoolSet &); // intersection + template friend BoolSet operator-(const BoolSet &, const BoolSet &); // difference + template friend BoolSet operator~(const BoolSet &); // complement + template friend bool operator==(const BoolSet &, const BoolSet &); + template friend bool operator!=(const BoolSet &, const BoolSet &); + template friend std::ostream& operator<<(std::ostream &, const BoolSet &); + template friend bool operator<(const BoolSet &, const BoolSet &); + +// iterator related +public: + class iterator; + class const_iterator; + iterator begin(); + iterator end(); + const_iterator begin() const; + const_iterator end() const; +}; + + +template +BoolSet::BoolSet(unsigned int size) { + assert(size >= 0); + size_ = size; + unsigned int n = size / (sizeof(T)*8); + unsigned int r = size % (sizeof(T)*8); + if (r != 0) + n++; + set_ = std::vector(n, static_cast(0)); +} + + +template +void BoolSet::set(unsigned int i) { + assert(i < size_ && i >= 0); + unsigned int n = i / (sizeof(T)*8); + unsigned int r = i % (sizeof(T)*8); + + T t = static_cast(1) << r; + set_[n] |= t; +} + + +template +void BoolSet::unset(unsigned int i) { + assert(i < size_ && i >= 0); + unsigned int n = i / (sizeof(T)*8); + unsigned int r = i % (sizeof(T)*8); + + T t = static_cast(1) << r; + t = ~t; + set_[n] &= t; +} + + +template +void BoolSet::set_all() { + unsigned int r = size_ % (sizeof(T)*8); + if (r == 0) { + for (unsigned int i = 0; i < set_.size(); i++) + set_[i] = ~static_cast(0); + } + else { + for (unsigned int i = 0; i < set_.size()-1; i++) + set_[i] = ~static_cast(0); + set_[set_.size()-1] = static_cast(0); + T t = static_cast(1); + for (unsigned int i = 0; i < r; i++) { + set_[set_.size()-1] |= t; + t = t<<1; + } + } +} + + +template +void BoolSet::unset_all() { + for (unsigned int i = 0; i < set_.size(); i++) + set_[i] = static_cast(0); +} + + +template +bool BoolSet::get(unsigned int i) const { + assert(i < size_ && i >= 0); + unsigned int n = i / (sizeof(T)*8); + unsigned int r = i % (sizeof(T)*8); + + T t = static_cast(1) << r; + t = set_[n] & t; + if (t) + return true; + else + return false; +} + + +template +unsigned int BoolSet::num_elem() const { + unsigned int n = size_; + unsigned int c = 0; + unsigned int p = 0; + while (n != 0) { + unsigned int m; + if (n >= sizeof(T)*8) { + m = sizeof(T)*8; + n -= sizeof(T)*8; + } + else { + m = n; + n = 0; + } + + T v = set_[p++]; + if (v != static_cast(0)) { + for (unsigned int i = 0; i < m; i++) { + if (v & static_cast(1)) + c++; + v >>= 1; + } + } + } + + return c; +} + + +template +bool BoolSet::imply(const BoolSet &b) const { + if (size_ >= b.size_) { + for (unsigned int i = 0; i < b.set_.size(); i++) + if ((set_[i] & b.set_[i]) != b.set_[i]) + return false; + } + else { + for (unsigned int i = 0; i < set_.size(); i++) + if ((set_[i] & b.set_[i]) != b.set_[i]) + return false; + for (unsigned int i = set_.size(); i < b.set_.size(); i++) + if (b.set_[i] != static_cast(0)) + return false; + } + + return true; +} + + +template +bool BoolSet::empty() const { + for (int i = 0; i < set_.size(); i++) + if (set_[i] != static_cast(0)) + return false; + + return true; +} + + +template +void BoolSet::dump() const { + int j = 1; + for (unsigned int i = 0; i < size(); i++) { + if (get(i)) + std::cout << '1'; + else + std::cout << '0'; + if (j%10 == 0 && i != size() - 1) { + std::cout << ' '; + j = 1; + } + else + j++; + } + std::cout << std::endl; + std::cout.flush(); +} + + +template +BoolSet operator|(const BoolSet &a, const BoolSet &b) { + if (a.size_ >= b.size_) { + BoolSet c = a; + for (unsigned int i = 0; i < b.set_.size(); i++) + c.set_[i] |= b.set_[i]; + return c; + } + else { + BoolSet c = b; + for (unsigned int i = 0; i < a.set_.size(); i++) + c.set_[i] |= a.set_[i]; + return c; + } +} + + +template +BoolSet operator&(const BoolSet &a, const BoolSet &b) { + if (a.size_ >= b.size_) { + BoolSet c = a; + for (unsigned int i = 0; i < b.set_.size(); i++) + c.set_[i] &= b.set_[i]; + for (unsigned int i = b.set_.size(); i < a.set_.size(); i++) + c.set_[i] = static_cast(0); + return c; + } + else { + BoolSet c = b; + for (unsigned int i = 0; i < a.set_.size(); i++) + c.set_[i] &= a.set_[i]; + for (unsigned int i = a.set_.size(); i < b.set_.size(); i++) + c.set_[i] = static_cast(0); + return c; + } +} + + +template +BoolSet operator-(const BoolSet &a, const BoolSet &b) { + BoolSet c(a.size_); + + int sz = a.set_.size(); + if (sz > b.set_.size()) + sz = b.set_.size(); + for (int i = 0; i < sz; i++) + c.set_[i] = a.set_[i] ^ (a.set_[i] & b.set_[i]); + for (int i = sz; i < a.set_.size(); i++) + c.set_[i] = a.set_[i]; + + return c; +} + + +template +BoolSet operator~(const BoolSet &b) { + unsigned int r = b.size_ % (sizeof(T)*8); + BoolSet a(b.size_); + for (unsigned int i = 0; i < b.set_.size(); i++) + a.set_[i] = ~b.set_[i]; + + if (r != 0) { + T t = static_cast(1); + for (unsigned int i = 1; i < r; i++) + t = (t << 1) | static_cast(1); + a.set_[a.set_.size()-1] &= t; + } + return a; +} + + +template +bool operator==(const BoolSet &a, const BoolSet &b) { + return (a.size_ == b.size_) && (a.set_ == b.set_); +} + + +template +bool operator!=(const BoolSet &a, const BoolSet &b) { + return !(a == b); +} + + + +template +BoolSet & BoolSet::operator|=(const BoolSet &b) { + *this = *this | b; + return *this; +} + + +template +BoolSet & BoolSet::operator&=(const BoolSet &b) { + *this = *this & b; + return *this; +} + + +template +BoolSet & BoolSet::operator-=(const BoolSet &b) { + *this = *this - b; + return *this; +} + + +template +std::ostream& operator<<(std::ostream &os, const BoolSet &b) { + os << '{'; + for (typename BoolSet::const_iterator i = b.begin(); i != b.end(); i++) { + os << *i; + if (i+1 != b.end()) + os << ','; + } + os << '}'; + + return os; +} + + +template +bool operator<(const BoolSet &a, const BoolSet &b) { + unsigned int t1, t2; + t1 = a.num_elem(); + t2 = b.num_elem(); + if (t1 < t2) + return true; + else if (t1 > t2) + return false; + else { + t1 = a.size(); + t2 = b.size(); + if (t1 < t2) + return true; + else if (t1 > t2) + return false; + else + for (unsigned int i = 0; i < a.set_.size(); i++) + if (a.set_[i] < b.set_[i]) + return true; + } + return false; +} + + +// +// iterator for BoolSet +// + +template +typename BoolSet::iterator BoolSet::begin() { + typename BoolSet::iterator it(this, 0); + if (size_ == 0) + return it; + else if (set_[0] & static_cast(1)) + return it; + else + return ++it; +} + + +template +typename BoolSet::iterator BoolSet::end() { + return typename BoolSet::iterator(this, size_); +} + + +template +typename BoolSet::const_iterator BoolSet::begin() const { + typename BoolSet::const_iterator it(this, 0); + if (size_ == 0) + return it; + else if (set_[0] & static_cast(1)) + return it; + else + return ++it; +} + + +template +typename BoolSet::const_iterator BoolSet::end() const { + return typename BoolSet::const_iterator(this, size_); +} + + +template +class BoolSet::iterator: public std::iterator { +protected: + BoolSet *s_; + unsigned int pos_; + +protected: + iterator(BoolSet *s, unsigned int pos) { s_ = s; pos_ = pos; } + +public: + ~iterator() {} + + typename BoolSet::iterator &operator++(); + typename BoolSet::iterator operator++(int); + typename BoolSet::iterator operator+(int) const; + unsigned int operator*() const; + bool operator==(const BoolSet::iterator &) const; + bool operator!=(const BoolSet::iterator &) const; + operator typename BoolSet::const_iterator(); + + friend class BoolSet; +}; + + +template +typename BoolSet::iterator &BoolSet::iterator::operator++() { + assert(pos_ < s_->size_); + + pos_++; + unsigned int n = pos_ / (sizeof(T)*8); + unsigned int r = pos_ % (sizeof(T)*8); + while (pos_ < s_->size_) { + if (s_->set_[n] == static_cast(0)) { + pos_ += sizeof(T)*8-r; + n++; + r = 0; + if (pos_ >= s_->size_) + break; + } + + if (r == 0) { + while (pos_ < s_->size_) { + if (s_->set_[n] == static_cast(0)) { + pos_ += sizeof(T)*8; + n++; + } + else + break; + } + if (pos_ >= s_->size_) + break; + } + + for (unsigned int i = r; i < sizeof(T)*8; i++) + if (s_->set_[n] & static_cast(1) << i) { + pos_ = pos_+i-r; + return *this; + } + + pos_ += sizeof(T)*8-r; + n++; + r = 0; + } + + pos_ = s_->size_; + return *this; +} + + +template +typename BoolSet::iterator BoolSet::iterator::operator++(int) { + typename BoolSet::iterator it(*this); + ++(*this); + return it; +} + + +template +typename BoolSet::iterator BoolSet::iterator::operator+(int n) const { + assert(n >= 0); + typename BoolSet::iterator it(*this); + while (n > 0) { + ++it; + --n; + } + return it; +} + + +template +unsigned int BoolSet::iterator::operator*() const { + assert(pos_ < s_->size_); + return pos_; +} + + +template +bool BoolSet::iterator::operator==(const BoolSet::iterator &other) const { + return s_ == other.s_ && pos_ == other.pos_; +} + + +template +bool BoolSet::iterator::operator!=(const BoolSet::iterator &other) const { + return !((*this) == other); +} + + +template +BoolSet::iterator::operator typename BoolSet::const_iterator() { + return BoolSet::const_iterator(s_, pos_); +} + + +template +class BoolSet::const_iterator: public std::iterator { +protected: + const BoolSet *s_; + unsigned int pos_; + +protected: + const_iterator(const BoolSet *s, unsigned int pos) { s_ = s; pos_ = pos; } + +public: + ~const_iterator() {} + + typename BoolSet::const_iterator &operator++(); + typename BoolSet::const_iterator operator++(int); + typename BoolSet::const_iterator operator+(int) const; + unsigned int operator*() const; + bool operator==(const BoolSet::const_iterator &) const; + bool operator!=(const BoolSet::const_iterator &) const; + + friend class BoolSet; +}; + + +template +typename BoolSet::const_iterator &BoolSet::const_iterator::operator++() { + assert(pos_ < s_->size_); + + pos_++; + unsigned int n = pos_ / (sizeof(T)*8); + unsigned int r = pos_ % (sizeof(T)*8); + while (pos_ < s_->size_) { + if (s_->set_[n] == static_cast(0)) { + pos_ += sizeof(T)*8-r; + n++; + r = 0; + if (pos_ >= s_->size_) + break; + } + + if (r == 0) { + while (pos_ < s_->size_) { + if (s_->set_[n] == static_cast(0)) { + pos_ += sizeof(T)*8; + n++; + } + else + break; + } + if (pos_ >= s_->size_) + break; + } + + for (unsigned int i = r; i < sizeof(T)*8; i++) + if (s_->set_[n] & static_cast(1) << i) { + pos_ = pos_+i-r; + return *this; + } + + pos_ += sizeof(T)*8-r; + n++; + r = 0; + } + + pos_ = s_->size_; + return *this; +} + + +template +typename BoolSet::const_iterator BoolSet::const_iterator::operator++(int) { + typename BoolSet::const_iterator it(*this); + ++(*this); + return it; +} + + +template +typename BoolSet::const_iterator BoolSet::const_iterator::operator+(int n) const { + assert(n >= 0); + typename BoolSet::const_iterator it(*this); + while (n > 0) { + ++it; + --n; + } + return it; +} + + +template +unsigned int BoolSet::const_iterator::operator*() const { + assert(pos_ < s_->size_); + return pos_; +} + + +template +bool BoolSet::const_iterator::operator==(const BoolSet::const_iterator &other) const { + return s_ == other.s_ && pos_ == other.pos_; +} + + +template +bool BoolSet::const_iterator::operator!=(const BoolSet::const_iterator &other) const { + return !((*this) == other); +} + +} + +#endif diff --git a/omegalib/basic/include/basic/omega_error.h b/omegalib/basic/include/basic/omega_error.h new file mode 100644 index 0000000..e342efb --- /dev/null +++ b/omegalib/basic/include/basic/omega_error.h @@ -0,0 +1,14 @@ +#ifndef OMEGA_ERROR_H +#define OMEGA_ERROR_H + +namespace omega { + +struct presburger_error: public std::runtime_error { + presburger_error(const std::string &msg): std::runtime_error("presburger error: " + msg) {} +}; + + + +} +#endif + diff --git a/omegalib/basic/include/basic/util.h b/omegalib/basic/include/basic/util.h new file mode 100644 index 0000000..4e807cd --- /dev/null +++ b/omegalib/basic/include/basic/util.h @@ -0,0 +1,263 @@ +#if ! defined Already_Included_Util +#define Already_Included_Util + +#include +#include +#include +#include +#include +#include + +namespace omega { + +#define LONG_LONG_COEF 1 + +#if LONG_LONG_COEF +#if defined BOGUS_LONG_DOUBLE_COEF +typedef long double coef_t; // type of coefficients +#define coef_fmt "%llf" +#define posInfinity (1e+24) +#define negInfinity (-1e+24) +#else +#ifdef WIN32 +typedef _int64 coef_t; // type of coefficients +#else +typedef long long coef_t; +#endif +#define coef_fmt "%lld" +#define posInfinity (0x7ffffffffffffffLL) +#define negInfinity (-0x7ffffffffffffffLL) +#endif +#else +typedef int coef_t; // type of coefficients +#define coef_fmt "%d" +#define posInfinity (0x7ffffff) +#define negInfinity (-0x7ffffff) +#endif + + +template inline const T& max(const T &x, const T &y) { + if (x >= y) return x; else return y; +} + + +template inline const T& max(const T &x, const T &y, const T &z) { + return max(x, max(y, z)); +} + +template inline const T& min(const T &x, const T &y) { + if (x <= y) return x; else return y; +} + +template inline const T& min(const T &x, const T &y, const T &z) { + return min(x, min(y, z)); +} + +template inline void set_max(T &m, const T &x) { + if (m < x) m = x; +} + +template inline void set_min(T &m, const T &x) { + if (m > x) m = x; +} + +/* template inline void swap(T &i, T &j) { */ +/* T tmp; */ +/* tmp = i; */ +/* i = j; */ +/* j = tmp; */ +/* } */ + +/* template inline T copy(const T &t) { return t; } */ + + +/* inline coef_t check_pos_mul(coef_t x, coef_t y) { */ +/* if (y >= 48051280 && y < posInfinity) */ +/* fprintf(stderr, "%d %d\n", x, y); */ +/* /\* #if !defined NDEBUG *\/ */ +/* /\* if (x != 0) *\/ */ +/* /\* assert(((MAXINT)/4) / x > y); *\/ */ +/* /\* #elif defined STILL_CHECK_MULT *\/ */ +/* /\* if (x != 0 && !(((MAXINT)/4) / x > y)) { *\/ */ +/* /\* assert(0&&"Integer overflow during multiplication (util.h)"); *\/ */ +/* /\* } *\/ */ +/* /\* #endif *\/ */ +/* #if !defined NDEBUG */ +/* if (x != 0 && y != 0) */ +/* assert(x*y > 0); */ +/* #elif defined STILL_CHECK_MULT */ +/* if (x != 0 && y != 0 && x*y < 0) */ +/* assert(0&&"Integer overflow during multiplication (util.h)"); */ +/* #endif */ +/* return x * y; */ +/* } */ + + +/* inline int */ +/* check_pos_mul(int x, int y) { */ +/* #if !defined NDEBUG */ +/* if (x != 0) */ +/* assert(((posInfinity)/4) / x > y); */ +/* #elif defined STILL_CHECK_MULT */ +/* if (x != 0 && !(((posInfinity)/4) / x > y)) { */ +/* assert(0&&"Integer overflow during multiplication (util.h)"); */ +/* } */ +/* #endif */ +/* return x * y; */ +/* } */ + +/* inline LONGLONG */ +/* check_pos_mul(LONGLONG x, LONGLONG y) { */ +/* #if !defined NDEBUG */ +/* if (x != 0) */ +/* assert(((posInfinity)/4) / x > y); */ +/* #elif defined STILL_CHECK_MULT */ +/* if (x != 0 && !(((posInfinity)/4) / x > y)) { */ +/* assert(0&&"Integer overflow during multiplication (util.h)"); */ +/* } */ +/* #endif */ +/* return x * y; */ +/* } */ + +/* inline LONGLONG abs(LONGLONG c) { return (c>=0?c:(-c)); } */ + +template inline T check_mul(const T &x, const T &y) { +#if defined NDEBUG && ! defined STILL_CHECK_MULT + return x*y; +#else + if (x == 0 || y == 0) + return 0; + + T z = x*y; + int sign_x = (x>0)?1:-1; + int sign_y = (y>0)?1:-1; + int sign_z = (z>0)?1:-1; + + if (sign_x * sign_y != sign_z) + throw std::overflow_error("coefficient multiply overflow"); + + return z; + + /* if (x > 0) { */ + /* if (y > 0) { */ + /* assert(x*y > 0); */ + /* } */ + /* else */ + /* assert(x*y < 0); */ + /* } */ + /* else { */ + /* if (y > 0) */ + /* assert(x*y < 0); */ + /* else */ + /* assert(x*y > 0); */ + /* } */ + /* return x*y; */ +#endif +} + +template inline T abs(const T &v) { + return (v >= static_cast(0))?v:-v; +} + +template inline T int_div(const T &a, const T &b) { + T result; + assert(b > 0); + if (a>0) result = a/b; + else result = -((-a+b-1)/b); + return result; +} + +template inline T int_mod(const T &a, const T &b) { + return a-b*int_div(a,b); +} + +template inline T int_mod_hat(const T &a, const T &b) { + T r; + assert(b > 0); + r = a-b*int_div(a,b); + if (r > -(r-b)) r -= b; + return r; +} + +template inline T gcd(T b, T a) {/* First argument is non-negative */ + assert(a >= 0); + assert(b >= 0); + if (b == 1) + return (1); + while (b != 0) { + T t = b; + b = a % b; + a = t; + } + return (a); +} + +template inline T lcm(T b, T a) { /* First argument is non-negative */ + assert(a >= 0); + assert(b >= 0); + return check_mul(a/gcd(a,b), b); +} + +template T square_root(const T &n, T precision = 1) { + T guess = 1; + + while (true) { + T next_guess = 0.5*(guess+n/guess); + if (abs(next_guess-guess) <= precision) + return next_guess; + else + guess = next_guess; + } +} + +template T factor(const T &n) { + assert(n >= 0); + if (n == 1) return 1; + + static int prime[30] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113}; + + if (n <= 113*113) { + for (int i = 0; i < 30; i++) + if (n % static_cast(prime[i]) == 0) + return static_cast(prime[i]); + + return n; + } + + T i = 1; + T k = 2; + T x = static_cast(rand())%n; + T y = x; + while(i < square_root(n, 1)) { + i++; + x = (x*x-1) % n; + T d = gcd(abs(y-x), n); + if(d != 1 && d != n) + return factor(d); + if(i == k) { + y = x; + k *= 2; + } + } + return n; +} + +/* #define implies(A,B) (A==(A&B)) */ + +template std::string to_string(const T &t) { + std::ostringstream ss; + ss << t; + return ss.str(); +} + +template T from_string(const std::string &s) { + std::istringstream ss(s); + ss.exceptions(std::ios::failbit); + T t; + ss >> t; + return t; +} + +} // namespace + +#endif diff --git a/omegalib/basic/src/ConstString.cc b/omegalib/basic/src/ConstString.cc new file mode 100644 index 0000000..7d2ec1e --- /dev/null +++ b/omegalib/basic/src/ConstString.cc @@ -0,0 +1,134 @@ +#include +#include +#include +#include +#include +#include + +/* static const int CS_HashTable_Size = 1000; */ +/* static ConstStringRep *hashTable[CS_HashTable_Size] = {0}; */ + +namespace omega { + +const int CS_HashTable_Size = 1000; +class CS_HashTable { +public: + ConstStringRep *p[CS_HashTable_Size]; + CS_HashTable(); + ~CS_HashTable(); +}; + +namespace { + CS_HashTable hashTable; +} + +CS_HashTable::CS_HashTable() { + for (int i = 0; i < CS_HashTable_Size; i++) + p[i] = NULL; + } + +CS_HashTable::~CS_HashTable() { + for (int i = 0; i < CS_HashTable_Size; i++) { + ConstStringRep *t = p[i]; + while (t != NULL) { + ConstStringRep *tt = t->nextInBucket; + delete []t->name; + delete t; + t = tt; + } + } +} + +Const_String::Const_String() { + rep = 0; +} + +void Const_String::buildRep(const char* t) { + int hash = 0; + const char *s = t; + while (*s != '\0') + hash = hash*33 + *s++; + int hashBucket = hash % CS_HashTable_Size; + if (hashBucket < 0) hashBucket += CS_HashTable_Size; + assert(0 <= hashBucket && hashBucket < CS_HashTable_Size); + ConstStringRep **q = &(hashTable.p[hashBucket]); + ConstStringRep *p = *q; + while (p != 0) { + if (strcmp(p->name,t) == 0) break; + q = &p->nextInBucket; + p = *q; + } + if (p!= 0) rep = p; + else { + rep = new ConstStringRep(t); + *q = rep; + } +} + +Const_String::Const_String(const char * t) { + buildRep(t); +} + +Const_String::Const_String(const std::string &s) { + buildRep(s.c_str()); +} + +Const_String::operator const char*() const { + if (!rep) return 0; + return rep->name; +} + +Const_String::operator std::string() const { + if (!rep) return std::string(""); + return std::string(rep->name); +} + +int Const_String::operator++(int) { + return rep->count++; +} + +int Const_String::operator++() { + return ++rep->count; +} + +int Const_String:: operator--(int) { + return rep->count--; +} + +int Const_String:: operator--() { + return --rep->count; +} + +int operator ==(const Const_String &x, const Const_String &y) { + return x.rep == y.rep; +} + +int operator !=(const Const_String &x, const Const_String &y) { + return x.rep != y.rep; +} + +int operator <(const Const_String &x, const Const_String &y) { + return (strcmp(x.rep->name,y.rep->name) < 0); +} + +int operator >(const Const_String &x, const Const_String &y) { + return (strcmp(x.rep->name,y.rep->name) > 0); +} + +Const_String:: operator int() const { + return rep != 0; +} + +int Const_String::null() const { + return rep == 0; +} + +ConstStringRep:: ConstStringRep(const char *t) { + count = 0; + nextInBucket = 0; + char *s = new char[1+strlen(t)]; + strcpy(s,t); + name = s; +} + +} // namespace diff --git a/omegalib/basic/src/Link.cc b/omegalib/basic/src/Link.cc new file mode 100644 index 0000000..50b9441 --- /dev/null +++ b/omegalib/basic/src/Link.cc @@ -0,0 +1,41 @@ +#include + +namespace omega { + +#if ListElementFreeList + static List_Element *_kludgy_List_Element_free_list_pointer; +// we rely on the fact that that is initialized to 0 before any +// constructor-based initialization that could call List_Element::new. + + void *kludgy_List_Element_new(size_t size) + { + void *mem; + if (size == sizeof(List_Element) && + _kludgy_List_Element_free_list_pointer) + { + List_Element *it = _kludgy_List_Element_free_list_pointer; + _kludgy_List_Element_free_list_pointer = it->tail; + mem = it; + } + else + mem = ::operator new(size); + + return mem; + } + + void kludgy_List_Element_delete(void *ptr, size_t size) + { + if (ptr) + if (size == sizeof(List_Element)) + { + List_Element *it = (List_Element *) ptr; + it->tail = _kludgy_List_Element_free_list_pointer; + _kludgy_List_Element_free_list_pointer = it; + } + else + ::operator delete(ptr); + } + +#endif + +} // namespace diff --git a/omegalib/code_gen/CMakeLists.txt b/omegalib/code_gen/CMakeLists.txt new file mode 100644 index 0000000..8e5a9a9 --- /dev/null +++ b/omegalib/code_gen/CMakeLists.txt @@ -0,0 +1,26 @@ +set(CG_SRC + src/codegen.cc + src/CG.cc + src/CG_stringBuilder.cc + src/CG_utils.cc + + src/rose_attributes.cc + src/CG_roseBuilder.cc + src/CG_roseRepr.cc + ) + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-write-strings") + +include_directories( + include + ${OMEGAROOT}/basic/include + ${OMEGAROOT}/omega_lib/include + ${ROSEHOME}/include/rose + ${BOOSTHOME}/include + ) + +add_library(codegen + ${CG_SRC} + ) + +add_dependencies(codegen omega) diff --git a/omegalib/code_gen/include/code_gen/CG.h b/omegalib/code_gen/include/code_gen/CG.h new file mode 100644 index 0000000..4054d82 --- /dev/null +++ b/omegalib/code_gen/include/code_gen/CG.h @@ -0,0 +1,118 @@ +#ifndef _CG_H +#define _CG_H + +#include +#include +#include +#include + +namespace omega { + +class CodeGen; + +struct CG_result { + CodeGen *codegen_; + BoolSet<> active_; + + CG_result() { codegen_ = NULL; } + virtual ~CG_result() { /* not responsible for codegen_ */ } + + virtual CG_result *recompute(const BoolSet<> &parent_active, const Relation &known, const Relation &restriction) = 0; + virtual int populateDepth() = 0; + virtual std::pair liftOverhead(int depth, bool propagate_up) = 0; + virtual Relation hoistGuard() = 0; + virtual void removeGuard(const Relation &guard) = 0; + virtual CG_outputRepr *printRepr(int indent, CG_outputBuilder *ocg, const std::vector &stmts, const std::vector > &assigned_on_the_fly) const = 0; + CG_outputRepr *printRepr(CG_outputBuilder *ocg, const std::vector &stmts) const; + std::string printString() const; + int num_level() const; + virtual CG_result *clone() const = 0; + virtual void dump(int indent) const {} + void dump() { dump(0); } +}; + + +struct CG_split: public CG_result { + std::vector restrictions_; + std::vector clauses_; + + CG_split(CodeGen *codegen, const BoolSet<> &active, const std::vector &restrictions, const std::vector &clauses) { + codegen_ = codegen; + active_ = active; + restrictions_ = restrictions; + clauses_ = clauses; + } + ~CG_split() { + for (int i = 0; i < clauses_.size(); i++) + delete clauses_[i]; + } + + CG_result *recompute(const BoolSet<> &parent_active, const Relation &known, const Relation &restriction); + int populateDepth(); + std::pair liftOverhead(int depth, bool propagate_up); + Relation hoistGuard(); + void removeGuard(const Relation &guard); + CG_outputRepr *printRepr(int indent, CG_outputBuilder *ocg, const std::vector &stmts, const std::vector > &assigned_on_the_fly) const; + CG_result *clone() const; + void dump(int indent) const; + +private: + std::vector findNextLevel() const; +}; + + +struct CG_loop: public CG_result { + int level_; + CG_result *body_; + + Relation known_; + Relation restriction_; + Relation bounds_; + Relation guard_; + bool needLoop_; + int depth_; + + CG_loop(CodeGen *codegen, const BoolSet<> &active, int level, CG_result *body) { + codegen_ = codegen; + active_ = active; + level_ = level; + body_ = body; + } + ~CG_loop() { delete body_; } + + CG_result *recompute(const BoolSet<> &parent_active, const Relation &known, const Relation &restriction); + int populateDepth(); + std::pair liftOverhead(int depth, bool propagate_up); + Relation hoistGuard(); + void removeGuard(const Relation &guard); + CG_outputRepr *printRepr(int indent, CG_outputBuilder *ocg, const std::vector &stmts, const std::vector > &assigned_on_the_fly) const; + CG_outputRepr *printRepr(bool do_print_guard, int indent, CG_outputBuilder *ocg, const std::vector &stmts, const std::vector > &assigned_on_the_fly) const; + CG_result *clone() const; + void dump(int indent) const; +}; + + + +struct CG_leaf: public CG_result { + Relation known_; + std::map guards_; + + CG_leaf(CodeGen *codegen, const BoolSet<> &active) { + codegen_ = codegen; + active_ = active; + } + ~CG_leaf() {} + + CG_result *recompute(const BoolSet<> &parent_active, const Relation &known, const Relation &restriction); + int populateDepth() { return 0; } + std::pair liftOverhead(int depth, bool propagate_up); + Relation hoistGuard(); + void removeGuard(const Relation &guard); + CG_outputRepr *printRepr(int indent, CG_outputBuilder *ocg, const std::vector &stmts, const std::vector > &assigned_on_the_fly) const; + CG_result *clone() const; + void dump(int indent) const; +}; + +} + +#endif diff --git a/omegalib/code_gen/include/code_gen/CG_outputBuilder.h b/omegalib/code_gen/include/code_gen/CG_outputBuilder.h new file mode 100644 index 0000000..2203235 --- /dev/null +++ b/omegalib/code_gen/include/code_gen/CG_outputBuilder.h @@ -0,0 +1,177 @@ +/***************************************************************************** + Copyright (C) 1994-2000 the Omega Project Team + Copyright (C) 2005-2011 Chun Chen + All Rights Reserved. + + Purpose: + abstract base class of comiler IR code builder + + Notes: + All "CG_outputRepr *" parameters are consumed inside the the function + unless explicitly stated otherwise, i.e., not valid after the call. + Parameter "indent" normally not used except it is used in unstructured + string output for correct indentation. + + History: + 04/17/96 created - Lei Zhou + 05/02/08 clarify integer floor/mod/ceil definitions, -chen + 05/31/08 use virtual clone to implement CreateCopy, -chun + 08/05/10 clarify NULL parameter allowance, -chun +*****************************************************************************/ + +#ifndef _CG_OUTPUTBUILDER_H +#define _CG_OUTPUTBUILDER_H + +#include + +#include +#include + +namespace omega { + +class CG_outputBuilder { +public: + CG_outputBuilder() {} + virtual ~CG_outputBuilder() {} + + //--------------------------------------------------------------------------- + // substitute variables in stmt + //--------------------------------------------------------------------------- + virtual CG_outputRepr *CreateSubstitutedStmt(int indent, CG_outputRepr *stmt, + const std::vector &vars, + std::vector &subs) const = 0; + + //--------------------------------------------------------------------------- + // assignment stmt generation + //--------------------------------------------------------------------------- + virtual CG_outputRepr *CreateAssignment(int indent, CG_outputRepr *lhs, + CG_outputRepr *rhs) const = 0; + + //--------------------------------------------------------------------------- + // function invocation generation + //--------------------------------------------------------------------------- + virtual CG_outputRepr *CreateInvoke(const std::string &funcName, + std::vector &argList) const = 0; + + //--------------------------------------------------------------------------- + // comment generation + //--------------------------------------------------------------------------- + virtual CG_outputRepr *CreateComment(int indent, + const std::string &commentText) const = 0; + + //--------------------------------------------------------------------------- + // Attribute generation + //--------------------------------------------------------------------------- + virtual CG_outputRepr* CreateAttribute(CG_outputRepr *control, + const std::string &commentText) const = 0; + //--------------------------------------------------------------------------- + // Pragma Attribute + // -------------------------------------------------------------------------- + virtual CG_outputRepr* CreatePragmaAttribute(CG_outputRepr *scopeStmt, int looplevel, const std::string &pragmaText) const = 0; + + //--------------------------------------------------------------------------- + // Prefetch Attribute + //--------------------------------------------------------------------------- + virtual CG_outputRepr* CreatePrefetchAttribute(CG_outputRepr *scopeStmt, int looplevel, const std::string &arrName, int hint) const = 0; + + //--------------------------------------------------------------------------- + // generate if stmt, true/false stmt can be NULL but not the condition + //--------------------------------------------------------------------------- + virtual CG_outputRepr *CreateIf(int indent, CG_outputRepr *guardCondition, + CG_outputRepr *true_stmtList, + CG_outputRepr *false_stmtList) const = 0; + + //--------------------------------------------------------------------------- + // generate loop inductive variable (loop control structure) + //--------------------------------------------------------------------------- + virtual CG_outputRepr *CreateInductive(CG_outputRepr *index, + CG_outputRepr *lower, + CG_outputRepr *upper, + CG_outputRepr *step) const = 0; + + //--------------------------------------------------------------------------- + // generate loop stmt from loop control and loop body, NULL parameter allowed + //--------------------------------------------------------------------------- + virtual CG_outputRepr *CreateLoop(int indent, CG_outputRepr *control, + CG_outputRepr *stmtList) const = 0; + + //--------------------------------------------------------------------------- + // copy operation, NULL parameter allowed. this function makes pointer + // handling uniform regardless NULL status + //--------------------------------------------------------------------------- + virtual CG_outputRepr *CreateCopy(CG_outputRepr *original) const { + if (original == NULL) + return NULL; + else + return original->clone(); + } + + //--------------------------------------------------------------------------- + // basic integer number creation + //--------------------------------------------------------------------------- + virtual CG_outputRepr *CreateInt(int num) const = 0; + virtual bool isInteger(CG_outputRepr *op) const = 0; + + + //--------------------------------------------------------------------------- + // basic identity/variable creation + //--------------------------------------------------------------------------- + virtual CG_outputRepr *CreateIdent(const std::string &varName) const = 0; + + //--------------------------------------------------------------------------- + // binary arithmetic operations, NULL parameter means 0, + // Note: + // integer division truncation method undefined, only use when lop is known + // to be multiple of rop, otherwise use integer floor instead + //--------------------------------------------------------------------------- + virtual CG_outputRepr *CreatePlus(CG_outputRepr *lop, CG_outputRepr *rop) const = 0; + virtual CG_outputRepr *CreateMinus(CG_outputRepr *lop, CG_outputRepr *rop) const = 0; + virtual CG_outputRepr *CreateTimes(CG_outputRepr *lop, CG_outputRepr *rop) const = 0; + virtual CG_outputRepr *CreateDivide(CG_outputRepr *lop, CG_outputRepr *rop) const { + return CreateIntegerFloor(lop, rop); + } + + //--------------------------------------------------------------------------- + // integer arithmetic functions, NULL parameter means 0, second parameter + // must be postive (i.e. b > 0 below), otherwise function undefined + // Note: + // ceil(a, b) = -floor(-a, b) or floor(a+b-1, b) or floor(a-1, b)+1 + // mod(a, b) = a-b*floor(a, b) + // where result must lie in range [0,b) + // floor(a, b) = a/b if a >= 0 + // (a-b+1)/b if a < 0 + // where native '/' operator behaves as 5/2 = 2, (-5)/2 = -2 + //--------------------------------------------------------------------------- + virtual CG_outputRepr *CreateIntegerFloor(CG_outputRepr *lop, CG_outputRepr *rop) const = 0; + virtual CG_outputRepr *CreateIntegerMod(CG_outputRepr *lop, CG_outputRepr *rop) const { + CG_outputRepr *lop2 = CreateCopy(lop); + CG_outputRepr *rop2 = CreateCopy(rop); + return CreateMinus(lop2, CreateTimes(rop2, CreateIntegerFloor(lop, rop))); + } + virtual CG_outputRepr *CreateIntegerCeil(CG_outputRepr *lop, CG_outputRepr *rop) const { + return CreateMinus(NULL, CreateIntegerFloor(CreateMinus(NULL, lop), rop)); + } + + //--------------------------------------------------------------------------- + // binary logical operation, NULL parameter means TRUE + //--------------------------------------------------------------------------- + virtual CG_outputRepr *CreateAnd(CG_outputRepr *lop, CG_outputRepr *rop) const = 0; + + //--------------------------------------------------------------------------- + // binary condition operations + //--------------------------------------------------------------------------- + virtual CG_outputRepr *CreateGE(CG_outputRepr *lop, CG_outputRepr *rop) const { + return CreateLE(rop, lop); + } + virtual CG_outputRepr *CreateLE(CG_outputRepr *lop, CG_outputRepr *rop) const = 0; + virtual CG_outputRepr *CreateEQ(CG_outputRepr *lop, CG_outputRepr *rop) const = 0; + + //--------------------------------------------------------------------------- + // join stmts together, NULL parameter allowed + //--------------------------------------------------------------------------- + virtual CG_outputRepr *StmtListAppend(CG_outputRepr *list1, CG_outputRepr *list2) const = 0; +}; + +} + +#endif diff --git a/omegalib/code_gen/include/code_gen/CG_outputRepr.h b/omegalib/code_gen/include/code_gen/CG_outputRepr.h new file mode 100644 index 0000000..92f3d9f --- /dev/null +++ b/omegalib/code_gen/include/code_gen/CG_outputRepr.h @@ -0,0 +1,31 @@ +/***************************************************************************** + Copyright (C) 1994-2000 the Omega Project Team + Copyright (C) 2005-2011 Chun Chen + All Rights Reserved. + + Purpose: + abstract base class of compiler IR code wrapper + + Notes: + + History: + 04/17/96 - Lei Zhou - created +*****************************************************************************/ + +#ifndef _CG_OUTPUTREPR_H +#define _CG_OUTPUTREPR_H + +namespace omega { + +class CG_outputRepr { +public: + CG_outputRepr() {} + virtual ~CG_outputRepr() { /* shallow delete */ } + virtual CG_outputRepr *clone() const = 0; + virtual void clear() { /* delete actual IR code wrapped inside */ } + virtual void dump() const {} +}; + +} + +#endif diff --git a/omegalib/code_gen/include/code_gen/CG_roseBuilder.h b/omegalib/code_gen/include/code_gen/CG_roseBuilder.h new file mode 100644 index 0000000..93b708e --- /dev/null +++ b/omegalib/code_gen/include/code_gen/CG_roseBuilder.h @@ -0,0 +1,164 @@ +#ifndef CG_roseBuilder_h +#define CG_roseBuilder_h + +#include +#include +#include +#include +#include + +namespace omega { + +class CG_roseBuilder : public CG_outputBuilder { +public: + CG_roseBuilder(int isFortran, SgGlobal* global, SgGlobal* global_scope, SgSymbolTable* symtab1, SgSymbolTable* symtab2, SgNode* root); + ~CG_roseBuilder(); + + //--------------------------------------------------------------------------- + // place holder generation + //--------------------------------------------------------------------------- + // CG_outputRepr* CreatePlaceHolder(int indent, CG_outputRepr *stmt, + // Tuple &funcList, + // Tuple &loop_vars) const; + + + //--------------------------------------------------------------------------- + // substitute variables in stmt + //--------------------------------------------------------------------------- + + + + CG_outputRepr *CreateSubstitutedStmt(int indent, CG_outputRepr *stmt, + const std::vector &vars, + std::vector &subs) const; + + + + //--------------------------------------------------------------------------- + // assignment generation + //--------------------------------------------------------------------------- + CG_outputRepr* CreateAssignment(int indent, CG_outputRepr* lhs, + CG_outputRepr* rhs) const; + + //--------------------------------------------------------------------------- + // function invocation generation + //--------------------------------------------------------------------------- + CG_outputRepr* CreateInvoke(const std::string &funcName, + std::vector &argList) const; + + //--------------------------------------------------------------------------- + // comment generation + //--------------------------------------------------------------------------- + CG_outputRepr* CreateComment(int indent, const std::string &commentText) const; + //--------------------------------------------------------------------------- + // Attribute generation + //--------------------------------------------------------------------------- + CG_outputRepr* CreateAttribute(CG_outputRepr *control, + const std::string &commentText) const; + //--------------------------------------------------------------------------- + // Pragma Attribute + //--------------------------------------------------------------------------- + CG_outputRepr* CreatePragmaAttribute(CG_outputRepr *scopeStmt, int looplevel, + const std::string &pragmaText) const; + + //--------------------------------------------------------------------------- + // Prefetch Attribute + //--------------------------------------------------------------------------- + CG_outputRepr* CreatePrefetchAttribute(CG_outputRepr *scopeStmt, int looplevel, + const std::string &arrName, int hint) const; + + //--------------------------------------------------------------------------- + // if stmt gen operations + //--------------------------------------------------------------------------- + CG_outputRepr* CreateIf(int indent, CG_outputRepr* guardCondition, + CG_outputRepr* true_stmtList, CG_outputRepr* false_stmtList) const; + + //--------------------------------------------------------------------------- + // inductive variable generation, to be used in CreateLoop as control + //--------------------------------------------------------------------------- + CG_outputRepr* CreateInductive(CG_outputRepr* index, + CG_outputRepr* lower, + CG_outputRepr* upper, + CG_outputRepr* step) const; + + //--------------------------------------------------------------------------- + // loop stmt generation + //--------------------------------------------------------------------------- + CG_outputRepr* CreateLoop(int indent, CG_outputRepr* control, + CG_outputRepr* stmtList) const; + + //--------------------------------------------------------------------------- + // basic operations + //--------------------------------------------------------------------------- + CG_outputRepr* CreateInt(int num ) const; + bool isInteger(CG_outputRepr *op) const; + CG_outputRepr* CreateIdent(const std::string &varName) const; + + //--------------------------------------------------------------------------- + // binary arithmetic operations + //--------------------------------------------------------------------------- + CG_outputRepr* CreatePlus(CG_outputRepr* lop, CG_outputRepr* rop) const; + CG_outputRepr* CreateMinus(CG_outputRepr* lop, CG_outputRepr* rop) const; + CG_outputRepr* CreateTimes(CG_outputRepr* lop, CG_outputRepr* rop) const; + CG_outputRepr* CreateIntegerFloor(CG_outputRepr* lop, CG_outputRepr* rop) const; + CG_outputRepr* CreateIntegerMod(CG_outputRepr* lop, CG_outputRepr* rop) const; + + //--------------------------------------------------------------------------- + // binary logical operations + //--------------------------------------------------------------------------- + CG_outputRepr* CreateAnd(CG_outputRepr* lop, CG_outputRepr* rop) const; + + //--------------------------------------------------------------------------- + // binary relational operations + //--------------------------------------------------------------------------- + // CG_outputRepr* CreateGE(CG_outputRepr*, CG_outputRepr*) const; + CG_outputRepr* CreateLE(CG_outputRepr* lop, CG_outputRepr* rop) const; + CG_outputRepr* CreateEQ(CG_outputRepr* lop, CG_outputRepr* rop) const; + + //--------------------------------------------------------------------------- + // stmt list gen operations + //--------------------------------------------------------------------------- + // CG_outputRepr* + // CreateStmtList(CG_outputRepr *singleton = NULL) const; + // CG_outputRepr* + // StmtListInsertLast(CG_outputRepr* list, CG_outputRepr* node) const; + CG_outputRepr* + StmtListAppend(CG_outputRepr* list1, CG_outputRepr* list2) const; + + //CG_outputRepr* CreateDim3(const char* varName, int arg1, int arg2) const; + CG_outputRepr* CreateDim3(const char* varName, CG_outputRepr* arg1, CG_outputRepr* arg2, CG_outputRepr* arg3 = NULL) const; + + // Manu:: added for fortran support + bool isInputFortran() const; + + //--------------------------------------------------------------------------- + // kernel generation + //--------------------------------------------------------------------------- + // CG_outputRepr* CreateKernel(immed_list* iml) const; + + //--------------------------------------------------------------------------- + // Add a modifier to a type (for things like __global__) + //--------------------------------------------------------------------------- + //type_node* ModifyType(type_node* base, const char* modifier) const; + + +private: + SgSymbolTable *symtab_; + SgSymbolTable *symtab2_; + SgNode* root_; + SgGlobal* global_; + SgGlobal* global_scope; + int isFortran; // Manu:: added for fortran support +}; + +extern char *k_ocg_comment; + //bool substitute(SgExpression *in, SgVariableSymbol *sym, SgExpression *expr, SgNode* root, SgExpression* parent); + //bool substitute(SgStatement *tn, SgVariableSymbol *sym, SgExpression* expr, SgNode* root, SgSymbolTable* symtab); +std::vectorsubstitute(SgNode *tnl, const SgVariableSymbol *sym, SgExpression *expr,SgNode* root) ; + + + + +} // namespace + +#endif diff --git a/omegalib/code_gen/include/code_gen/CG_roseRepr.h b/omegalib/code_gen/include/code_gen/CG_roseRepr.h new file mode 100644 index 0000000..4861db7 --- /dev/null +++ b/omegalib/code_gen/include/code_gen/CG_roseRepr.h @@ -0,0 +1,47 @@ +#ifndef CG_roseRepr_h +#define CG_roseRepr_h + +#include +#include "rose.h" + +namespace omega { + +class CG_roseRepr : public CG_outputRepr { + friend class CG_roseBuilder; +public: + CG_roseRepr(); + CG_roseRepr(SgNode *tnl); + CG_roseRepr(SgExpression *exp); + CG_roseRepr(SgStatementPtrList* stmtlist); + + ~CG_roseRepr(); + CG_outputRepr *clone() const; + void clear(); + + SgNode* GetCode() const; + SgStatementPtrList* GetList() const; + SgExpression *GetExpression() const; + + + + + //--------------------------------------------------------------------------- + // Dump operations + //--------------------------------------------------------------------------- + void Dump() const; + //void DumpToFile(FILE *fp = stderr) const; +private: + // only one of _tnl and _op would be active at any time, depending on + // whether it is building a statement list or an expression tree + SgNode *tnl_; + SgExpression *op_; + SgStatementPtrList *list_; + void DumpFileHelper(SgNode* node, FILE* fp) const; + //operand op_; +}; + + + +} // namespace + +#endif diff --git a/omegalib/code_gen/include/code_gen/CG_stringBuilder.h b/omegalib/code_gen/include/code_gen/CG_stringBuilder.h new file mode 100644 index 0000000..09d3503 --- /dev/null +++ b/omegalib/code_gen/include/code_gen/CG_stringBuilder.h @@ -0,0 +1,44 @@ +#ifndef _CG_STRINGBUILDER_H +#define _CG_STRINGBUILDER_H + +#include +#include + +namespace omega { + +class CG_stringBuilder: public CG_outputBuilder { +public: + CG_stringBuilder() {} + ~CG_stringBuilder() {} + bool isInteger(CG_outputRepr *op) const; + CG_stringRepr *CreateSubstitutedStmt(int indent, CG_outputRepr *stmt, const std::vector &vars, std::vector &subs) const; + CG_stringRepr *CreateAssignment(int indent, CG_outputRepr *lhs, CG_outputRepr *rhs) const; + CG_stringRepr *CreateInvoke(const std::string &funcName, std::vector &argList) const; + CG_stringRepr *CreateComment(int indent, const std::string &commentText) const; + CG_stringRepr* CreateAttribute(CG_outputRepr *control, + const std::string &commentText) const; + CG_outputRepr *CreatePragmaAttribute(CG_outputRepr *scopeStmt, int looplevel, const std::string &pragmaText) const; + CG_outputRepr *CreatePrefetchAttribute(CG_outputRepr *scopeStmt, int looplevel, const std::string &arrName, int hint) const; + CG_stringRepr *CreateIf(int indent, CG_outputRepr *guardCondition, CG_outputRepr *true_stmtList, CG_outputRepr *false_stmtList) const; + CG_stringRepr *CreateInductive(CG_outputRepr *index, CG_outputRepr *lower, CG_outputRepr *upper, CG_outputRepr *step) const; + CG_stringRepr *CreateLoop(int indent, CG_outputRepr *control, CG_outputRepr *stmtList) const; + CG_stringRepr *CreateInt(int num) const; + CG_stringRepr *CreateIdent(const std::string &varName) const; + CG_stringRepr *CreatePlus(CG_outputRepr *lop, CG_outputRepr *rop) const; + CG_stringRepr *CreateMinus(CG_outputRepr *lop, CG_outputRepr *rop) const; + CG_stringRepr *CreateTimes(CG_outputRepr *lop, CG_outputRepr *rop) const; + CG_stringRepr *CreateDivide(CG_outputRepr *lop, CG_outputRepr *rop) const; + CG_stringRepr *CreateIntegerFloor(CG_outputRepr *lop, CG_outputRepr *rop) const; + CG_stringRepr *CreateIntegerMod(CG_outputRepr *lop, CG_outputRepr *rop) const; + CG_stringRepr *CreateIntegerCeil(CG_outputRepr *lop, CG_outputRepr *rop) const; + CG_stringRepr *CreateAnd(CG_outputRepr *lop, CG_outputRepr *rop) const; + CG_stringRepr *CreateGE(CG_outputRepr *lop, CG_outputRepr *rop) const; + CG_stringRepr *CreateLE(CG_outputRepr *lop, CG_outputRepr *rop) const; + CG_stringRepr *CreateEQ(CG_outputRepr *lop, CG_outputRepr *rop) const; + CG_stringRepr *StmtListAppend(CG_outputRepr *list1, CG_outputRepr *list2) const; +}; + + +} + +#endif diff --git a/omegalib/code_gen/include/code_gen/CG_stringRepr.h b/omegalib/code_gen/include/code_gen/CG_stringRepr.h new file mode 100644 index 0000000..a6df85d --- /dev/null +++ b/omegalib/code_gen/include/code_gen/CG_stringRepr.h @@ -0,0 +1,43 @@ +/***************************************************************************** + Copyright (C) 1994-2000 the Omega Project Team + Copyright (C) 2005-2011 Chun Chen + All Rights Reserved. + + Purpose: + pseudo string code wrapper + + Notes: + + History: + 04/17/96 - Lei Zhou - created +*****************************************************************************/ + +#ifndef _CG_STRINGREPR_H +#define _CG_STRINGREPR_H + +#include +#include +#include + +namespace omega { + +class CG_stringRepr: public CG_outputRepr { +private: + std::string s_; + +public: + CG_stringRepr() {} + CG_stringRepr(const std::string &s) { s_ = s; } + ~CG_stringRepr() {} + CG_outputRepr *clone() const { return new CG_stringRepr(s_); } + void dump() const { std::cout << s_ << std::endl; } + + //--------------------------------------------------------------------------- + // basic operation + //--------------------------------------------------------------------------- + std::string GetString() const { return s_; } +}; + +} + +#endif diff --git a/omegalib/code_gen/include/code_gen/CG_suifBuilder.h b/omegalib/code_gen/include/code_gen/CG_suifBuilder.h new file mode 100644 index 0000000..9f57e3d --- /dev/null +++ b/omegalib/code_gen/include/code_gen/CG_suifBuilder.h @@ -0,0 +1,88 @@ +#ifndef CG_suifBuilder_h +#define CG_suifBuilder_h + +#include +#include +#include +#include + +namespace omega { + + +class CG_suifBuilder: public CG_outputBuilder { +public: + //CG_suifBuilder(proc_symtab *symtab) {symtab_ = symtab;} + CG_suifBuilder(proc_symtab *symtab); + //protonu--initializing code_gen stuff for cuda + //this looks like a flaw in my design + //end--protonu + ~CG_suifBuilder() {} + + CG_outputRepr* CreatePlaceHolder(int indent, CG_outputRepr *stmt, + Tuple &funcList, + Tuple &loop_vars) const; + CG_outputRepr* CreateAssignment(int indent, CG_outputRepr* lhs, + CG_outputRepr* rhs) const; + CG_outputRepr* CreateInvoke(const std::string &fname, + Tuple &argList) const; + CG_outputRepr* CreateComment(int indent, const std::string &commentText) const; + CG_outputRepr* CreateAttribute(CG_outputRepr *control, + const std::string &commentText) const; + + CG_outputRepr* CreateIf(int indent, CG_outputRepr* guardCondition, + CG_outputRepr* true_stmtList, CG_outputRepr* false_stmtList) const; + CG_outputRepr* CreateInductive(CG_outputRepr* index, + CG_outputRepr* lower, + CG_outputRepr* upper, + CG_outputRepr* step) const; + CG_outputRepr* CreateLoop(int indent, CG_outputRepr* control, + CG_outputRepr* stmtList) const; + CG_outputRepr* CreateInt(int) const; + CG_outputRepr* CreateIdent(const std::string &idStr) const; + CG_outputRepr* CreatePlus(CG_outputRepr*, CG_outputRepr*) const; + CG_outputRepr* CreateMinus(CG_outputRepr*, CG_outputRepr*) const; + CG_outputRepr* CreateTimes(CG_outputRepr*, CG_outputRepr*) const; + CG_outputRepr* CreateIntegerDivide(CG_outputRepr*, CG_outputRepr*) const; + CG_outputRepr* CreateIntegerMod(CG_outputRepr*, CG_outputRepr*) const; + CG_outputRepr* CreateAnd(CG_outputRepr*, CG_outputRepr*) const; + CG_outputRepr* CreateGE(CG_outputRepr*, CG_outputRepr*) const; + CG_outputRepr* CreateLE(CG_outputRepr*, CG_outputRepr*) const; + CG_outputRepr* CreateEQ(CG_outputRepr*, CG_outputRepr*) const; + CG_outputRepr* StmtListAppend(CG_outputRepr* list1, CG_outputRepr* list2) const; + //--------------------------------------------------------------------------- + // pragma generation + //--------------------------------------------------------------------------- + virtual CG_outputRepr* CreatePragma(int indent, const std::string &pragmaText) const; + + //--------------------------------------------------------------------------- + // dim3 generation + //--------------------------------------------------------------------------- + virtual CG_outputRepr* CreateDim3(immed varName, immed arg1, immed arg2) const; + virtual CG_outputRepr* CreateDim3(immed varName, immed arg1, immed arg2, immed arg3) const; + + + //--------------------------------------------------------------------------- + // kernel generation + //--------------------------------------------------------------------------- + virtual CG_outputRepr* CreateKernel(immed_list* iml) const; + + //--------------------------------------------------------------------------- + // Add a modifier to a type (for things like __global__) + //--------------------------------------------------------------------------- + type_node* ModifyType(type_node* base, const char* modifier) const; +private: + proc_symtab *symtab_; +}; + +extern char *k_ocg_comment; + +bool substitute(instruction *in, var_sym *sym, operand expr, + base_symtab *st=NULL); +bool substitute(tree_node *tn, var_sym *sym, operand expr, + base_symtab *st=NULL); +bool substitute(tree_node_list *tnl, var_sym *sym, operand expr, + base_symtab *st = NULL); + +} + +#endif diff --git a/omegalib/code_gen/include/code_gen/CG_suifRepr.h b/omegalib/code_gen/include/code_gen/CG_suifRepr.h new file mode 100644 index 0000000..ce7c6cd --- /dev/null +++ b/omegalib/code_gen/include/code_gen/CG_suifRepr.h @@ -0,0 +1,36 @@ +#ifndef CG_suifRepr_h +#define CG_suifRepr_h + +#include +#include + +namespace omega { + +class CG_suifRepr : public CG_outputRepr { + friend class CG_suifBuilder; +public: + CG_suifRepr(); + CG_suifRepr(tree_node_list *tnl); + CG_suifRepr(operand op); + virtual ~CG_suifRepr(); + virtual CG_outputRepr *clone(); + virtual void clear(); + + tree_node_list* GetCode() const; + operand GetExpression() const; + + //--------------------------------------------------------------------------- + // Dump operations + //--------------------------------------------------------------------------- + virtual void Dump() const; + virtual void DumpToFile(FILE *fp = stderr) const; +private: + // only one of _tnl and _op would be active at any time, depending on + // whether it is building a statement list or an expression tree + tree_node_list *tnl_; + operand op_; +}; + +} // namespace + +#endif diff --git a/omegalib/code_gen/include/code_gen/CG_utils.h b/omegalib/code_gen/include/code_gen/CG_utils.h new file mode 100755 index 0000000..9e44cb1 --- /dev/null +++ b/omegalib/code_gen/include/code_gen/CG_utils.h @@ -0,0 +1,45 @@ +#ifndef _CG_UTILS_H +#define _CG_UTILS_H + +#include +#include +#include +#include +#include +#include + +namespace omega { + +class CG_loop; + +CG_outputRepr *output_inequality_repr(CG_outputBuilder *ocg, const GEQ_Handle &inequality, Variable_ID v, const Relation &R, const std::vector > &assigned_on_the_fly, std::set excluded_floor_vars = std::set()); +CG_outputRepr *output_substitution_repr(CG_outputBuilder *ocg, const EQ_Handle &equality, Variable_ID v, bool apply_v_coef, const Relation &R, const std::vector > &assigned_on_the_fly); +CG_outputRepr *output_upper_bound_repr(CG_outputBuilder *ocg, const GEQ_Handle &inequality, Variable_ID v, const Relation &R, const std::vector > &assigned_on_the_fly); +CG_outputRepr *output_lower_bound_repr(CG_outputBuilder *ocg, const GEQ_Handle &inequality, Variable_ID v, const EQ_Handle &stride_eq, Variable_ID wc, const Relation &R, const Relation &known, const std::vector > &assigned_on_the_fly); + +CG_outputRepr *output_ident(CG_outputBuilder *ocg, const Relation &R, Variable_ID v, const std::vector > &assigned_on_the_fly); +std::pair > output_assignment(CG_outputBuilder *ocg, const Relation &R, int level, const Relation &known, const std::vector > &assigned_on_the_fly); +CG_outputRepr *output_loop(CG_outputBuilder *ocg, const Relation &R, int level, const Relation &known, const std::vector > &assigned_on_the_fly); +CG_outputRepr *output_guard(CG_outputBuilder *ocg, const Relation &R, const std::vector > &assigned_on_the_fly); +std::vector output_substitutions(CG_outputBuilder *ocg, const Relation &R, const std::vector > &assigned_on_the_fly); + +bool bound_must_hit_stride(const GEQ_Handle &inequality, Variable_ID v, const EQ_Handle &stride_eq, Variable_ID wc, const Relation &bounds, const Relation &known); +std::pair find_simplest_assignment(const Relation &R, Variable_ID v, const std::vector > &assigned_on_the_fly = std::vector >()); +std::pair find_floor_definition(const Relation &R, Variable_ID v, std::set excluded_floor_vars = std::set()); +std::pair find_simplest_stride(const Relation &R, Variable_ID v); +Variable_ID replicate_floor_definition(const Relation &R, const Variable_ID floor_var, Relation &r, F_Exists *f_exists, F_And *f_root, std::map &exists_mapping); + +Relation pick_one_guard(const Relation &R, int level = 0); +CG_outputRepr *leaf_print_repr(BoolSet<> active, const std::map &guards, + CG_outputRepr *guard_repr, const Relation &known, + int indent, CG_outputBuilder *ocg, const std::vector &remap, + const std::vector &xforms, const std::vector &stmts, + const std::vector > &assigned_on_the_fly); +CG_outputRepr *loop_print_repr(const std::vector &loops, int start, int end, + const Relation &guard, CG_outputRepr *guard_repr, + int indent, CG_outputBuilder *ocg, const std::vector &stmts, + const std::vector > &assigned_on_the_fly); + +} + +#endif diff --git a/omegalib/code_gen/include/code_gen/code_gen.h b/omegalib/code_gen/include/code_gen/code_gen.h new file mode 100644 index 0000000..abfab7c --- /dev/null +++ b/omegalib/code_gen/include/code_gen/code_gen.h @@ -0,0 +1,47 @@ +#if !defined(Already_Included_code_gen) +#define Already_Included_code_gen + +#include +#include +#include +#include +#include + +namespace omega { + +typedef Tuple IntTuple; +typedef Tuple SetTuple; +typedef Tuple SetTupleTuple; +typedef Tuple RelTuple; +typedef Tuple RelTupleTuple; + +CG_outputRepr *MMGenerateCode(CG_outputBuilder* ocg, + Tuple &T, Tuple &old_IS, + const Tuple &stmt_content, + Relation &known, int effort=1); +std::string MMGenerateCode(Tuple &T, Tuple &old_IS, Relation &known, + int effort=1); + +//protonu-adding a new variant to keep Gabe's code happy +CG_outputRepr* MMGenerateCode(CG_outputBuilder* ocg, RelTuple &T, SetTuple &old_IS, + const Tuple &stmt_content, Relation &known, + Tuple< IntTuple >& smtNonSplitLevels_, + std::vector< std::pair > syncs_, + const Tuple< Tuple >& loopIdxNames_, + int effort=1); +//end-protonu + +struct Polyhedra { + int last_level; + Tuple transformations; + Relation known; + + Tuple remap; // after initial iteration space's disjoint set splitting, the new statement number maps to old statement number + Tuple > projected_nIS; + + Polyhedra(const Tuple &T, const Tuple &old_IS, const Relation &known = Relation::Null()); + ~Polyhedra() {} +}; + +} +#endif diff --git a/omegalib/code_gen/include/code_gen/codegen.h b/omegalib/code_gen/include/code_gen/codegen.h new file mode 100755 index 0000000..469653d --- /dev/null +++ b/omegalib/code_gen/include/code_gen/codegen.h @@ -0,0 +1,44 @@ +#ifndef _CODEGEN_H +#define _CODEGEN_H + +#include +#include +#include +#include +#include + +namespace omega { + +class CodeGen { +public: + static const std::string loop_var_name_prefix; + static const int var_substitution_threshold; + +protected: + std::vector > projected_IS_; // projected_IS_[level-1][new stmt#] + std::vector xforms_; // transformations[original stmt#] + Relation known_; // no need to generate code for constraints satisfied in known + std::vector remap_; // map new stmt# to original stmt# + +public: + CodeGen(const std::vector &xforms, const std::vector &IS, const Relation &known = Relation::Null(), + std::vector< std::vector > smtNonSplitLevels_ = std::vector< std::vector >(), + std::vector< std::vector > loopIdxNames_ = std::vector< std::vector >(), + std::vector< std::pair > syncs_ = std::vector< std::pair >() + ); + ~CodeGen() {} + + CG_result *buildAST(int effort = 1); + int num_level() const { return projected_IS_.size(); } + +private: + CG_result *buildAST(int level, const BoolSet<> &active, bool split_on_const, const Relation &restriction); + + friend class CG_result; + friend class CG_split; + friend class CG_loop; + friend class CG_leaf; +}; + +} +#endif diff --git a/omegalib/code_gen/include/code_gen/codegen_error.h b/omegalib/code_gen/include/code_gen/codegen_error.h new file mode 100755 index 0000000..06ecc2b --- /dev/null +++ b/omegalib/code_gen/include/code_gen/codegen_error.h @@ -0,0 +1,15 @@ +#ifndef _CODEGEN_ERROR_H +#define _CODEGEN_ERROR_H + +#include + +namespace omega { + +struct codegen_error: public std::runtime_error { + codegen_error(const std::string &msg): std::runtime_error("codegen error: " + msg) {} +}; + + +} +#endif + diff --git a/omegalib/code_gen/include/code_gen/cscope.out b/omegalib/code_gen/include/code_gen/cscope.out new file mode 100644 index 0000000..23b9ff6 --- /dev/null +++ b/omegalib/code_gen/include/code_gen/cscope.out @@ -0,0 +1,42592 @@ +cscope 15 $HOME/chill-latest/omega/code_gen/include/code_gen 0000237072 + @CG.h + +1 #ià! +defšed +( +AÌ—dy_šþuded_cg +) + +2  + #AÌ—dy_šþuded_cg + + + ) + +4  + ~ + +5  + ~ + +6  + ~ + +7  + ~ + +8  + ~ + +10 +Çme¥aû + + gomega + { + +12  + gTu¶e +<> + tIÁTu¶e +; + +13  + gTu¶e +< + tR–©iÚ +> + tS‘Tu¶e +; + +14  + gTu¶e +< + tS‘Tu¶e +> + tS‘Tu¶eTu¶e +; + +15  + gTu¶e +< + tR–©iÚ +> + tR–Tu¶e +; + +17 þas  + cCG_»suÉ + { + +18 + gpublic +: + +19 +Tu¶e +<> +isAùive +; + +20  + gËv– +; + +21 +R–©iÚ + + g»¡riùiÚs +; + +22 +R–©iÚ + + gknown +; + +24 + gpublic +: + +25 +CG_»suÉ +() {} + +26 +vœtu® + ~ +CG_»suÉ +() {} + +28 +vœtu® + +CG_»suÉ + * +þÚe +() = 0; + +29 +vœtu® +  +d•th +() = 0; + +30 +vœtu® + +boÞ + +isNuÎ +(è{  + gçl£ +;}; + +31 +vœtu® + +CG_»suÉ + * +liáOv”h—d +( +d•th +) = 0; + +32 +vœtu® + +R–©iÚ + +fšdOv”h—d +( +liáTo +) = 0; + +33 +vœtu® + +CG_»suÉ + * +fÜû_fš™e_bounds +() = 0; + +34 +vœtu® + +R–©iÚ + +hoi¡Gu¬d +() = 0; + +35 +vœtu® +  +»moveGu¬d +() = 0; + +36 +vœtu® + +CG_»suÉ + * +»compu‹ +(cÚ¡ +R–©iÚ + & +k +, cÚ¡ R–©iÚ & +r +) = 0; + +38 +vœtu® + +CG_ouutR•r + * +´štR•r +( +CG_ouutBužd” +* +ocg +,  +šd’t +, cÚ¡ +¡d +:: +veùÜ + & +assigÃd_Ú_the_æy +) = 0; + +39 +vœtu® + + g¡d +:: +¡ršg + +´štSŒuùu» +( +šd’t +) = 0; + +40 +vœtu® + + g¡d +:: +¡ršg + +´št +( +šd’t +); + +44 þas  + cCG_nuÎ + : +public + +CG_»suÉ + { + +45 +public +: + +46 +CG_»suÉ + * +þÚe +() { + +47  +Ãw + +CG_nuÎ +; + +49 + g¡d +:: +¡ršg + +´štSŒuùu» +() { + +52 +CG_ouutR•r + * +´štR•r +( +CG_ouutBužd” +*, , cÚ¡ +¡d +:: +veùÜ + &) + +53 {  ( +CG_ouutR•r + *)0; }; + +55  +d•th +() {  0; } + +56 +boÞ + +isNuÎ +(è{  + gŒue +;}; + +57 +CG_»suÉ + * +»compu‹ +(cÚ¡ +R–©iÚ + &, const Relation &) { + +58  + gthis +; + +60 +CG_»suÉ + * +liáOv”h—d +() { + +61  + gthis +; + +63 +R–©iÚ + +fšdOv”h—d +() { + +64  + gR–©iÚ +:: +True +(1); + +66 +CG_»suÉ + * +fÜû_fš™e_bounds +(è{  + gthis +; }; + +67 +R–©iÚ + +hoi¡Gu¬d +(è{  + gR–©iÚ +:: +True +(1); } + +68  +»moveGu¬d +() { } + +73 þas  + cCG_¥l™ + : +public + +CG_»suÉ + { + +74 +public +: + +75 +CG_»suÉ + * +ŒueCÏu£ +,* + gçl£CÏu£ +; + +76 +R–©iÚ + + gcÚd™iÚ +; + +77 +R–©iÚ + + ggu¬d +; + +79 + gpublic +: + +80 +CG_¥l™ +( +IÁTu¶e + & +aùive +,  +lvl +, cÚ¡ +R–©iÚ + & +cÚd_ +, +CG_»suÉ + * +T +, CG_»suÉ * +F +); + +81 ~ +CG_¥l™ +(è{ +d–‘e + + gŒueCÏu£ +; d–‘ + gçl£CÏu£ +; } + +83 +CG_»suÉ + * +þÚe +() { + +84 +R–©iÚ + + gc + = +cÚd™iÚ +; + +85  +Ãw + +CG_¥l™ +( +isAùive +, +Ëv– +, +c +, + +86 +ŒueCÏu£ +-> +þÚe +(), +çl£CÏu£ +->clone()); + +88  +d•th +() + +89 {  +max +( +ŒueCÏu£ +-> +d•th +(), +çl£CÏu£ +->depth()); } + +90 + g¡d +:: +¡ršg + +´štSŒuùu» +( +šd’t +); + +91 +CG_ouutR•r + * +´štR•r +( +CG_ouutBužd” +* +ocg +,  +šd’t +, cÚ¡ +¡d +:: +veùÜ + & +assigÃd_Ú_the_æy +); + +93 +CG_»suÉ + * +liáOv”h—d +( +d•th +); + +94 +CG_»suÉ + * +fÜû_fš™e_bounds +(); + +95 +R–©iÚ + +fšdOv”h—d +( +liáTo +); + +96 +CG_»suÉ + * +»compu‹ +(cÚ¡ +R–©iÚ + & +k +, cÚ¡ R–©iÚ & +r +); + +97 +R–©iÚ + +hoi¡Gu¬d +(); + +98  +»moveGu¬d +(è{ + ggu¬d + = +R–©iÚ +:: +True +( +cÚd™iÚ +. +n_£t +()); } + +104 þas  + cCG_Ëaf + : +public + +CG_»suÉ + { + +105 +public +: + +106 +S‘Tu¶e + +gu¬d +; + +108 + gpublic +: + +109 +CG_Ëaf +( +IÁTu¶e + & +aùive +) { + +110 +isAùive + = +aùive +; + +111 + ggu¬d +. +»®loÿ‹ +( +isAùive +. +size +()); + +113 ~ +CG_Ëaf +() {} + +115 +CG_»suÉ + * +þÚe +() { + +116  +Ãw + +CG_Ëaf +( +isAùive +); + +118 +CG_»suÉ + * +liáOv”h—d +() { + +119  + gthis +; + +121 +CG_»suÉ + * +fÜû_fš™e_bounds +() { + +122  + gthis +; + +124 +R–©iÚ + +fšdOv”h—d +( +liáTo +); + +125 + g¡d +:: +¡ršg + +´štSŒuùu» +( +šd’t +); + +126 +CG_ouutR•r + * +´štR•r +( +CG_ouutBužd” +* +ocg +,  +šd’t +, cÚ¡ +¡d +:: +veùÜ + & +assigÃd_Ú_the_æy +); + +127  +d•th +() {  0; } + +128 +CG_»suÉ + * +»compu‹ +(cÚ¡ +R–©iÚ + & +k +, cÚ¡ R–©iÚ & +r +); + +129 +R–©iÚ + +hoi¡Gu¬d +(); + +130  +»moveGu¬d +(); + +133 þas  + cCG_loÝ + : +public + +CG_»suÉ + { + +134 +public +: + +135 +R–©iÚ + +bounds +; + +136 +R–©iÚ + + ggu¬d +; + +137 +boÞ + + gÃedLoÝ +; + +138 +CG_»suÉ + * + gbody +; + +140 + gpublic +: + +141 +CG_loÝ +( +IÁTu¶e + & +aùive +,  +lvl +, +CG_»suÉ + * +b +) { + +142 + gisAùive + = +aùive +; + +143 + gËv– + = +lvl +; + +144 + gbody + = +b +; + +146 ~ +CG_loÝ +(è{ +d–‘e + + gbody +; } + +148 +CG_»suÉ + * +þÚe +() { + +149  +Ãw + +CG_loÝ +( +isAùive +, +Ëv– +, +body +-> +þÚe +()); + +151 +R–©iÚ + +fšdOv”h—d +( +liáTo +); + +152 +CG_»suÉ + * +fÜû_fš™e_bounds +(); + +153 +CG_»suÉ + * +liáOv”h—d +( +d•th +); + +154 + g¡d +:: +¡ršg + +´štSŒuùu» +( +šd’t +); + +155 +CG_ouutR•r + * +´štR•r +( +CG_ouutBužd” +* +ocg +,  +šd’t +, cÚ¡ +¡d +:: +veùÜ + & +assigÃd_Ú_the_æy +); + +156  +d•th +(è{  ( + gÃedLoÝ +?1:0)+ +body +->depth(); } + +157 +CG_»suÉ + * +»compu‹ +(cÚ¡ +R–©iÚ + & +k +, cÚ¡ R–©iÚ & +r +); + +158 +R–©iÚ + +hoi¡Gu¬d +(); + +159  +»moveGu¬d +(è{ + ggu¬d + = +R–©iÚ +:: +True +( +bounds +. +n_£t +()); } + + @CG_outputBuilder.h + +21 #iâdeà +CG_ouutBužd”_h + + +22  + #CG_ouutBužd”_h + + + ) + +24  + ~ + +25  + ~ + +26  + ~<¡ršg +> + +28 +Çme¥aû + + gomega + { + +30 þas  + cCG_ouutBužd” + { + +31 + gpublic +: + +32 +CG_ouutBužd” +() {} + +33 +vœtu® + ~ +CG_ouutBužd” +() {} + +38 +vœtu® + +CG_ouutR•r +* +C»©ePÏûHÞd” +( +šd’t +, CG_ouutR•¸* +¡mt +, + +39 +Tu¶e +< +CG_ouutR•r +*> & +funcLi¡ +, + +40 +Tu¶e +< +¡d +:: +¡ršg +> & +loÝ_v¬s +) const = 0; + +45 +vœtu® + +CG_ouutR•r +* +C»©eAssignm’t +( +šd’t +, CG_ouutR•r* +lhs +, + +46 +CG_ouutR•r +* +rhs +) const = 0; + +51 +vœtu® + +CG_ouutR•r +* +C»©eInvoke +(cÚ¡ +¡d +:: +¡ršg + & +âame +, + +52 +Tu¶e +< +CG_ouutR•r +*> & +¬gLi¡ +) const = 0; + +57 +vœtu® + +CG_ouutR•r +* +C»©eComm’t +( +šd’t +, + +58 cÚ¡ +¡d +:: +¡ršg + & +comm’tText +) const = 0; + +63 +vœtu® + +CG_ouutR•r +* +C»©eIf +( +šd’t +, CG_ouutR•r* +gu¬dCÚd™iÚ +, + +64 +CG_ouutR•r +* +Œue_¡mtLi¡ +, + +65 +CG_ouutR•r +* +çl£_¡mtLi¡ +) const = 0; + +70 +vœtu® + +CG_ouutR•r +* +C»©eInduùive +(CG_ouutR•r* +šdex +, + +71 +CG_ouutR•r +* +low” +, + +72 +CG_ouutR•r +* +uµ” +, + +73 +CG_ouutR•r +* +¡• +) const = 0; + +78 +vœtu® + +CG_ouutR•r +* +C»©eLoÝ +( +šd’t +, CG_ouutR•r* +cÚŒÞ +, + +79 +CG_ouutR•r +* +¡mtLi¡ +) const = 0; + +84 +vœtu® + +CG_ouutR•r +* +C»©eCÝy +(CG_ouutR•r* +Üigš® +) const { + +85 ià( + gÜigš® + =ð +NULL +) + +86  +NULL +; + +88  + gÜigš® +-> +þÚe +(); + +94 +vœtu® + +CG_ouutR•r +* +C»©eIÁ +() const = 0; + +95 +vœtu® + +CG_ouutR•r +* +C»©eId’t +(cÚ¡ +¡d +:: +¡ršg + & +idSŒ +) const = 0; + +100 +vœtu® + +CG_ouutR•r +* +C»©ePlus +(CG_outputRepr*, CG_outputRepr*) const = 0; + +101 +vœtu® + +CG_ouutR•r +* +C»©eMšus +(CG_outputRepr*, CG_outputRepr*) const = 0; + +102 +vœtu® + +CG_ouutR•r +* +C»©eTimes +(CG_outputRepr*, CG_outputRepr*) const = 0; + +117 +vœtu® + +CG_ouutR•r +* +C»©eIÁeg”Divide +(CG_outputRepr*, CG_outputRepr*) const = 0; + +118 +vœtu® + +CG_ouutR•r +* +C»©eIÁeg”Mod +(CG_ouutR•¸* +lÝ +, CG_ouutR•¸* +rÝ +) const { + +119 +CG_ouutR•r + * + glÝ2 + = +C»©eCÝy +( +lÝ +); + +120 +CG_ouutR•r + * + grÝ2 + = +C»©eCÝy +( +rÝ +); + +121  +C»©eMšus +( +lÝ2 +, +C»©eTimes +( +rÝ2 +, +C»©eIÁeg”Divide +( +lÝ +, +rÝ +))); + +123 +vœtu® + +CG_ouutR•r +* +C»©eIÁeg”Cež +(CG_ouutR•r* +lÝ +, CG_ouutR•r* +rÝ +) const { + +124  +C»©eMšus +( +NULL +, +C»©eIÁeg”Divide +(C»©eMšus(NULL, +lÝ +), +rÝ +)); + +130 +vœtu® + +CG_ouutR•r +* +C»©eAnd +(CG_outputRepr*, CG_outputRepr*) const = 0; + +135 +vœtu® + +CG_ouutR•r +* +C»©eGE +(CG_outputRepr*, CG_outputRepr*) const = 0; + +136 +vœtu® + +CG_ouutR•r +* +C»©eLE +(CG_outputRepr*, CG_outputRepr*) const = 0; + +137 +vœtu® + +CG_ouutR•r +* +C»©eEQ +(CG_outputRepr*, CG_outputRepr*) const = 0; + +142 +vœtu® + +CG_ouutR•r +* +StmtLi¡Aµ’d +(CG_ouutR•r* +li¡1 +, CG_ouutR•r* +li¡2 +) const = 0; + + @CG_outputRepr.h + +16 #iâdeà +CG_ouutR•r_h + + +17  + #CG_ouutR•r_h + + + ) + +19  + ~<¡dio.h +> + +20  + ~ + +21  + ~<¡ršg +> + +23 +Çme¥aû + + gomega + { + +25 þas  + cCG_ouutR•r + { + +26 + gpublic +: + +27 +vœtu® + ~ +CG_ouutR•r +() {}; + +28 +vœtu® + +CG_ouutR•r + * +þÚe +() = 0; + +29 +vœtu® +  +þ—r +() {}; + +34 +vœtu® +  +Dump +() const = 0; + +35 +vœtu® +  +DumpToFže +( +FILE + * +å + = +¡d”r +) const = 0; + + @CG_stringBuilder.h + +1 #iâdeà +CG_¡ršgBužd”_h + + +2  + #CG_¡ršgBužd”_h + + + ) + +4  + ~ + +5  + ~ + +7 +Çme¥aû + + gomega + { + +9 þas  + cCG_¡ršgBužd” +: +public + +CG_ouutBužd” + { + +10 +public +: + +11 +CG_¡ršgBužd” +() {} + +12 ~ +CG_¡ršgBužd” +() {} + +14 +CG_ouutR•r +* +C»©ePÏûHÞd” +( +šd’t +, CG_ouutR•¸* +¡mt +, + +15 +Tu¶e +< +CG_ouutR•r +*> & +funcLi¡ +, + +16 +Tu¶e +< +¡d +:: +¡ršg +> & +loÝ_v¬s +) const; + +18 +CG_ouutR•r +* +C»©eAssignm’t +( +šd’t +, CG_ouutR•r* +lhs +, + +19 +CG_ouutR•r +* +rhs +) const; + +20 +CG_ouutR•r +* +C»©eInvoke +(cÚ¡ +¡d +:: +¡ršg + & +âame +, + +21 +Tu¶e +< +CG_ouutR•r +*> & +¬gLi¡ +) const; + +22 +CG_ouutR•r +* +C»©eComm’t +( +šd’t +, cÚ¡ +¡d +:: +¡ršg + & +comm’tText +) const; + +23 +CG_ouutR•r +* +C»©eIf +( +šd’t +, CG_ouutR•r* +gu¬dCÚd™iÚ +, + +24 +CG_ouutR•r +* +Œue_¡mtLi¡ +, CG_ouutR•r* +çl£_¡mtLi¡ +) const; + +25 +CG_ouutR•r +* +C»©eInduùive +(CG_ouutR•r* +šdex +, + +26 +CG_ouutR•r +* +low” +, + +27 +CG_ouutR•r +* +uµ” +, + +28 +CG_ouutR•r +* +¡• +) const; + +29 +CG_ouutR•r +* +C»©eLoÝ +( +šd’t +, CG_ouutR•r* +cÚŒÞ +, + +30 +CG_ouutR•r +* +¡mtLi¡ +) const; + +31 +CG_ouutR•r +* +C»©eIÁ +() const; + +32 +CG_ouutR•r +* +C»©eId’t +(cÚ¡ +¡d +:: +¡ršg + & +idSŒ +) const; + +33 +CG_ouutR•r +* +C»©ePlus +(CG_outputRepr*, CG_outputRepr*) const; + +34 +CG_ouutR•r +* +C»©eMšus +(CG_outputRepr*, CG_outputRepr*) const; + +35 +CG_ouutR•r +* +C»©eTimes +(CG_outputRepr*, CG_outputRepr*) const; + +36 +CG_ouutR•r +* +C»©eIÁeg”Divide +(CG_outputRepr*, CG_outputRepr*) const; + +37 +CG_ouutR•r +* +C»©eIÁeg”Mod +(CG_outputRepr*, CG_outputRepr*) const; + +38 +CG_ouutR•r +* +C»©eIÁeg”Cež +(CG_outputRepr*, CG_outputRepr*) const; + +39 +CG_ouutR•r +* +C»©eAnd +(CG_outputRepr*, CG_outputRepr*) const; + +40 +CG_ouutR•r +* +C»©eGE +(CG_outputRepr*, CG_outputRepr*) const; + +41 +CG_ouutR•r +* +C»©eLE +(CG_outputRepr*, CG_outputRepr*) const; + +42 +CG_ouutR•r +* +C»©eEQ +(CG_outputRepr*, CG_outputRepr*) const; + +43 +CG_ouutR•r +* +StmtLi¡Aµ’d +(CG_ouutR•r* +li¡1 +, CG_ouutR•r* +li¡2 +) const; + +46 + g¡d +:: +¡ršg + +G‘SŒšg +( +CG_ouutR•r +* +»´ +); + +47 + g¡d +:: +¡ršg + +G‘Ind’tS·ûs +( +šd’t +); + + @CG_stringRepr.h + +1 #iâdeà +CG_¡ršgR•r_h + + +2  + #CG_¡ršgR•r_h + + + ) + +4  + ~<¡dio.h +> + +5  + ~ + +6  + ~<¡ršg +> + +8 +Çme¥aû + + gomega + { + +10 þas  + cCG_¡ršgR•r + : +public + +CG_ouutR•r + { + +11 +public +: + +12 +CG_¡ršgR•r +(); + +13 +CG_¡ršgR•r +(cÚ¡ +¡d +:: +¡ršg +& +_s +); + +14 + gvœtu® + ~ +CG_¡ršgR•r +(); + +15 +vœtu® + +CG_ouutR•r + * +þÚe +(); + +20 + g¡d +:: +¡ršg + +G‘SŒšg +() const; + +25 +vœtu® +  +Dump +() const; + +26 +vœtu® +  +DumpToFže +( +FILE + * +å + = +¡d”r +) const; + +27 + g´iv©e +: + +28 +¡d +:: +¡ršg + +s +; + + @CG_suifBuilder.h + +1 #iâdeà +CG_suifBužd”_h + + +2  + #CG_suifBužd”_h + + + ) + +4  + ~ + +5  + ~ + +6  + ~ + +7  + ~<¡ršg +> + +9 +Çme¥aû + + gomega + { + +11 þas  + cCG_suifBužd” +: +public + +CG_ouutBužd” + { + +12 +public +: + +13 +CG_suifBužd” +( +´oc_symb + * +symb +è{ +symb_ + = symtab;} + +14 ~ +CG_suifBužd” +() {} + +16 +CG_ouutR•r +* +C»©ePÏûHÞd” +( +šd’t +, CG_ouutR•¸* +¡mt +, + +17 +Tu¶e +< +CG_ouutR•r +*> & +funcLi¡ +, + +18 +Tu¶e +< +¡d +:: +¡ršg +> & +loÝ_v¬s +) const; + +19 +CG_ouutR•r +* +C»©eAssignm’t +( +šd’t +, CG_ouutR•r* +lhs +, + +20 +CG_ouutR•r +* +rhs +) const; + +21 +CG_ouutR•r +* +C»©eInvoke +(cÚ¡ +¡d +:: +¡ršg + & +âame +, + +22 +Tu¶e +< +CG_ouutR•r +*> & +¬gLi¡ +) const; + +23 +CG_ouutR•r +* +C»©eComm’t +( +šd’t +, cÚ¡ +¡d +:: +¡ršg + & +comm’tText +) const; + +24 +CG_ouutR•r +* +C»©eIf +( +šd’t +, CG_ouutR•r* +gu¬dCÚd™iÚ +, + +25 +CG_ouutR•r +* +Œue_¡mtLi¡ +, CG_ouutR•r* +çl£_¡mtLi¡ +) const; + +26 +CG_ouutR•r +* +C»©eInduùive +(CG_ouutR•r* +šdex +, + +27 +CG_ouutR•r +* +low” +, + +28 +CG_ouutR•r +* +uµ” +, + +29 +CG_ouutR•r +* +¡• +) const; + +30 +CG_ouutR•r +* +C»©eLoÝ +( +šd’t +, CG_ouutR•r* +cÚŒÞ +, + +31 +CG_ouutR•r +* +¡mtLi¡ +) const; + +32 +CG_ouutR•r +* +C»©eIÁ +() const; + +33 +CG_ouutR•r +* +C»©eId’t +(cÚ¡ +¡d +:: +¡ršg + & +idSŒ +) const; + +34 +CG_ouutR•r +* +C»©ePlus +(CG_outputRepr*, CG_outputRepr*) const; + +35 +CG_ouutR•r +* +C»©eMšus +(CG_outputRepr*, CG_outputRepr*) const; + +36 +CG_ouutR•r +* +C»©eTimes +(CG_outputRepr*, CG_outputRepr*) const; + +37 +CG_ouutR•r +* +C»©eIÁeg”Divide +(CG_outputRepr*, CG_outputRepr*) const; + +38 +CG_ouutR•r +* +C»©eIÁeg”Mod +(CG_outputRepr*, CG_outputRepr*) const; + +39 +CG_ouutR•r +* +C»©eAnd +(CG_outputRepr*, CG_outputRepr*) const; + +40 +CG_ouutR•r +* +C»©eGE +(CG_outputRepr*, CG_outputRepr*) const; + +41 +CG_ouutR•r +* +C»©eLE +(CG_outputRepr*, CG_outputRepr*) const; + +42 +CG_ouutR•r +* +C»©eEQ +(CG_outputRepr*, CG_outputRepr*) const; + +43 +CG_ouutR•r +* +StmtLi¡Aµ’d +(CG_ouutR•r* +li¡1 +, CG_ouutR•r* +li¡2 +) const; + +47 +vœtu® + +CG_ouutR•r +* +C»©eP¿gma +( +šd’t +, cÚ¡ +¡d +:: +¡ršg + & +´agmaText +) const; + +52 +vœtu® + +CG_ouutR•r +* +C»©eDim3 +( +immed + +v¬Name +, immed +¬g1 +, immed +¬g2 +) const; + +53 +vœtu® + +CG_ouutR•r +* +C»©eDim3 +( +immed + +v¬Name +, immed +¬g1 +, immed +¬g2 +, immed +¬g3 +) const; + +59 +vœtu® + +CG_ouutR•r +* +C»©eK”Ãl +( +immed_li¡ +* +iml +) const; + +64 +ty³_node +* +ModifyTy³ +Ñy³_node* +ba£ +, cÚ¡ * +modif›r +) const; + +65 + g´iv©e +: + +66 +´oc_symb + * +symb_ +; + +69 * +k_ocg_comm’t +; + +71 +boÞ + +sub¡™u‹ +( +š¡ruùiÚ + * +š +, +v¬_sym + * +sym +, +Ý”ªd + +ex´ +, + +72 +ba£_symb + * +¡ += +NULL +); + +73 +boÞ + +sub¡™u‹ +( +Œ“_node + * +Š +, +v¬_sym + * +sym +, +Ý”ªd + +ex´ +, + +74 +ba£_symb + * +¡ += +NULL +); + +75 +boÞ + +sub¡™u‹ +( +Œ“_node_li¡ + * +Šl +, +v¬_sym + * +sym +, +Ý”ªd + +ex´ +, + +76 +ba£_symb + * +¡ + = +NULL +); + + @CG_suifRepr.h + +1 #iâdeà +CG_suifR•r_h + + +2  + #CG_suifR•r_h + + + ) + +4  + ~ + +5  + ~ + +7 +Çme¥aû + + gomega + { + +9 þas  + cCG_suifR•r + : +public + +CG_ouutR•r + { + +10 +ä›nd + +þass + +CG_suifBužd” +; + +11 + gpublic +: + +12 +CG_suifR•r +(); + +13 +CG_suifR•r +( +Œ“_node_li¡ + * +Šl +); + +14 +CG_suifR•r +( +Ý”ªd + +Ý +); + +15 + gvœtu® + ~ +CG_suifR•r +(); + +16 +vœtu® + +CG_ouutR•r + * +þÚe +(); + +17 +vœtu® +  +þ—r +(); + +19 +Œ“_node_li¡ +* +G‘Code +() const; + +20 +Ý”ªd + +G‘Ex´essiÚ +() const; + +25 +vœtu® +  +Dump +() const; + +26 +vœtu® +  +DumpToFže +( +FILE + * +å + = +¡d”r +) const; + +27 + g´iv©e +: + +30 +Œ“_node_li¡ + * +Šl_ +; + +31 +Ý”ªd + + gÝ_ +; + + @code_gen.h + +1 #ià! +defšed +( +AÌ—dy_Inþuded_code_g’ +) + +2  + #AÌ—dy_Inþuded_code_g’ + + + ) + +4  + ~ + +5  + ~ + +6  + ~ + +7  + ~ + +8  + ~ + +10 +Çme¥aû + + gomega + { + +12  + gTu¶e +<> + tIÁTu¶e +; + +13  + gTu¶e +< + tR–©iÚ +> + tS‘Tu¶e +; + +14  + gTu¶e +< + tS‘Tu¶e +> + tS‘Tu¶eTu¶e +; + +15  + gTu¶e +< + tR–©iÚ +> + tR–Tu¶e +; + +16  + gTu¶e +< + tR–Tu¶e +> + tR–Tu¶eTu¶e +; + +18 +CG_ouutR•r + * +MMG’”©eCode +( +CG_ouutBužd” +* +ocg +, + +19 +Tu¶e +< +R–©iÚ +> & +T +, Tu¶e & +Þd_IS +, + +20 cÚ¡ +Tu¶e +< +CG_ouutR•r + *> & +¡mt_cÚ‹Á +, + +21 +R–©iÚ + & +known +,  +effÜt +=1); + +22 + g¡d +:: +¡ršg + +MMG’”©eCode +( +Tu¶e +< +R–©iÚ +> & +T +, Tu¶e & +Þd_IS +, R–©iÚ & +known +, + +23  +effÜt +=1); + +27  + sPÞyhed¿ + { + +28  + gÏ¡_Ëv– +; + +29 + gTu¶e +< + gR–©iÚ +> + gŒªsfÜm©iÚs +; + +30 +R–©iÚ + + gknown +; + +32 + gTu¶e +<> + g»m­ +; + +33 + gTu¶e + > + g´ojeùed_nIS +; + +35 +PÞyhed¿ +(cÚ¡ +Tu¶e +< +R–©iÚ +> & +T +, cÚ¡ Tu¶e & +Þd_IS +, cÚ¡ R–©iÚ & +known + = R–©iÚ:: +NuÎ +()); + +36 ~ +PÞyhed¿ +() {} + + @output_repr.h + +1 #iâdeà +OUTPUT_REPR_H + + +2  + #OUTPUT_REPR_H + + + ) + +4  + ~ + +5  + ~ + +6  + ~ + +7  + ~ + +8  + ~<£t +> + +10 +Çme¥aû + + gomega + { + +11  +Ï¡_Ëv– +; + +13 +CG_ouutR•r +* +ouutId’t +( +CG_ouutBužd” +* +ocg +, cÚ¡ +R–©iÚ + & +R +, +V¬ŸbË_ID + +v +, cÚ¡ +¡d +:: +veùÜ + & +assigÃd_Ú_the_æy +); + +14 + g¡d +:: +·œ +< +CG_ouutR•r + *, + gboÞ +> +ouutAssignm’t +( +CG_ouutBužd” + * +ocg +, cÚ¡ +R–©iÚ + & +R_ +, +V¬ŸbË_ID + +v +, R–©iÚ & +’fÜûd +, CG_ouutR•¸*& +if_»´ +, cÚ¡ +¡d +:: +veùÜ + & +assigÃd_Ú_the_æy +); + +15 + g¡d +:: +·œ +< +CG_ouutR•r + *, + gboÞ +> +ouutBounds +( +CG_ouutBužd” +* +ocg +, cÚ¡ +R–©iÚ + & +bounds +, +V¬ŸbË_ID + +v +,  +šd’t +, R–©iÚ & +’fÜûd +, cÚ¡ +¡d +:: +veùÜ + & +assigÃd_Ú_the_æy +); + +16 + gTu¶e +< + gCG_ouutR•r +*> +ouutSub¡™utiÚ +( +CG_ouutBužd” +* +ocg +, cÚ¡ +R–©iÚ + & +R +, cÚ¡ +¡d +:: +veùÜ +< +CG_ouutR•r + *> & +assigÃd_Ú_the_æy +); + +17 +CG_ouutR•r +* +ouutS‹m’t +( +CG_ouutBužd” +* +ocg +, CG_ouutR•¸* +¡mt +,  +šd’t +, cÚ¡ +R–©iÚ + & +m­pšg +, cÚ¡ R–©iÚ & +known +, cÚ¡ +¡d +:: +veùÜ + & +assigÃd_Ú_the_æy +); + +18 +CG_ouutR•r +* +ouutGu¬d +( +CG_ouutBužd” +* +ocg +, cÚ¡ +R–©iÚ + & +gu¬ds_š +, cÚ¡ +¡d +:: +veùÜ + & +assigÃd_Ú_the_æy +); + +19 +CG_ouutR•r +* +ouut_as_gu¬d +( +CG_ouutBužd” +* +ocg +, cÚ¡ +R–©iÚ + & +gu¬ds_š +, +CÚ¡¿št_HªdË + +e +, +boÞ + +is_equ®™y +, cÚ¡ +¡d +:: +veùÜ + & +assigÃd_Ú_the_æy +); + +20 +CG_ouutR•r +* +ouut_EQ_¡rides +( +CG_ouutBužd” +* +ocg +, cÚ¡ +R–©iÚ + & +gu¬ds_š +, cÚ¡ +¡d +:: +veùÜ + & +assigÃd_Ú_the_æy +); + +21 +CG_ouutR•r +* +ouut_GEQ_¡rides +( +CG_ouutBužd” +* +ocg +, cÚ¡ +R–©iÚ + & +gu¬ds_š +, cÚ¡ +¡d +:: +veùÜ + & +assigÃd_Ú_the_æy +); + +22 +CG_ouutR•r + * +ouutLBasR•r +( +CG_ouutBužd” +* +ocg +, cÚ¡ +GEQ_HªdË + & +g +, +R–©iÚ + & +bounds +, +V¬ŸbË_ID + +v +, +cÛf_t + +¡ride +, cÚ¡ +EQ_HªdË + & +¡rideEQ +, R–©iÚ +known +, cÚ¡ +¡d +:: +veùÜ + & +assigÃd_Ú_the_æy +); + +23 +CG_ouutR•r + * +ouutUBasR•r +( +CG_ouutBužd” +* +ocg +, cÚ¡ +GEQ_HªdË + & +g +, +R–©iÚ + & +bounds +, +V¬ŸbË_ID + +v +, + +24 +cÛf_t + , + +25 cÚ¡ +EQ_HªdË + & , + +26 cÚ¡ +¡d +:: +veùÜ +< +CG_ouutR•r + *> & +assigÃd_Ú_the_æy + = std::veùÜ( +Ï¡_Ëv– +, +¡©ic_ÿ¡ +( +NULL +))); + +27 +CG_ouutR•r +* +ouutEasyBoundAsR•r +( +CG_ouutBužd” +* +ocg +, +R–©iÚ + & +bounds +, cÚ¡ +CÚ¡¿št_HªdË + & +g +, +V¬ŸbË_ID + +v +, +boÞ + +ignÜeWC +,  +ûžšg +, cÚ¡ +¡d +:: +veùÜ + & +assigÃd_Ú_the_æy +); + +30 +boÞ + +boundH™sSŒide +(cÚ¡ +GEQ_HªdË + & +g +, +V¬ŸbË_ID + +v +, cÚ¡ +EQ_HªdË + & +¡rideEQ +, +cÛf_t + , +R–©iÚ + +known +); + +31 +R–©iÚ + +g»©e¡_commÚ_¡• +(cÚ¡ +Tu¶e + & +I +, cÚ¡ Tu¶e<> & +aùive +,  +Ëv– +, cÚ¡ R–©iÚ & +known + = R–©iÚ:: +NuÎ +()); + +32 +boÞ + +fšdFloÜIÃqu®™y +( +R–©iÚ + & +r +, +V¬ŸbË_ID + +v +, +GEQ_HªdË + & +h +, V¬ŸbË_ID +exþuded +); + +33 +R–©iÚ + +´ojeù_Úto_Ëv–s +(R–©iÚ +R +,  +Ï¡_Ëv– +, +boÞ + +wždÿrds +); + +34 +boÞ + +isSim¶eSŒide +(cÚ¡ +EQ_HªdË + & +g +, +V¬ŸbË_ID + +v +); + +35  +couÁSŒides +( +CÚjunù + * +c +, +V¬ŸbË_ID + +v +, +EQ_HªdË + & +¡rideEQ +, +boÞ + & +sim¶e +); + +36 +boÞ + +hasBound +( +R–©iÚ + +r +,  +Ëv– +,  +UB +); + +37 +boÞ + +fšd_ªy_cÚ¡¿št +( +s +,  +Ëv– +, +R–©iÚ + & +kr +,  +dœeùiÚ +, R–©iÚ & +S +, boÞ +­´ox +); + +38 +boÞ + +has_nÚ¡ride_EQ +( +R–©iÚ + +r +,  +Ëv– +); + +39 +R–©iÚ + +pickOv”h—d +(R–©iÚ +r +,  +liáTo +); + +40 +R–©iÚ + +mšMaxOv”h—d +(R–©iÚ +r +,  +Ëv– +); + +41  +max_fs_¬™y +(cÚ¡ +CÚ¡¿št_HªdË + & +c +); + + @/usr/include/stdio.h + +24 #iâdeà +_STDIO_H + + +26 #ià! +defšed + +__Ãed_FILE + && !defšed +__Ãed___FILE + + +27  + #_STDIO_H + 1 + + ) + +28  + ~<ã©u»s.h +> + +30 + g__BEGIN_DECLS + + +32  + #__Ãed_size_t + + + ) + +33  + #__Ãed_NULL + + + ) + +34  + ~<¡ddef.h +> + +36  + ~ + +37  + #__Ãed_FILE + + + ) + +38  + #__Ãed___FILE + + + ) + +42 #ià! +defšed + +__FILE_defšed + && defšed +__Ãed_FILE + + +45  + g_IO_FILE +; + +47 +__BEGIN_NAMESPACE_STD + + +49  +_IO_FILE + + tFILE +; + +50 + g__END_NAMESPACE_STD + + +51 #ià +defšed + +__USE_LARGEFILE64 + || defšed +__USE_SVID + || defšed +__USE_POSIX + \ + +52 || +defšed + + g__USE_BSD + || defšed + g__USE_ISOC99 + || defšed + g__USE_XOPEN + \ + +53 || +defšed + +__USE_POSIX2 + + +54 + $__USING_NAMESPACE_STD +( +FILE +) + +57  + #__FILE_defšed + 1 + + ) + +59 #undeà +__Ãed_FILE + + +62 #ià! +defšed + +____FILE_defšed + && defšed +__Ãed___FILE + + +65  +_IO_FILE + + t__FILE +; + +67  + #____FILE_defšed + 1 + + ) + +69 #undeà +__Ãed___FILE + + +72 #ifdef +_STDIO_H + + +73  + #_STDIO_USES_IOSTREAM + + + ) + +75  + ~ + +77 #ifdeà +__USE_XOPEN + + +78 #ifdeà +__GNUC__ + + +79 #iâdeà +_VA_LIST_DEFINED + + +80  +_G_va_li¡ + + tva_li¡ +; + +81  + #_VA_LIST_DEFINED + + + ) + +84  + ~<¡d¬g.h +> + +89 +__BEGIN_NAMESPACE_STD + + +90 #iâdeà +__USE_FILE_OFFSET64 + + +91  +_G_åos_t + + tåos_t +; + +93  +_G_åos64_t + + tåos_t +; + +95 +__END_NAMESPACE_STD + + +96 #ifdeà +__USE_LARGEFILE64 + + +97  +_G_åos64_t + + tåos64_t +; + +101  + #_IOFBF + 0 + + ) + +102  + #_IOLBF + 1 + + ) + +103  + #_IONBF + 2 + + ) + +107 #iâdeà +BUFSIZ + + +108  + #BUFSIZ + +_IO_BUFSIZ + + + ) + +114 #iâdeà +EOF + + +115  + #EOF + (-1) + + ) + +121  + #SEEK_SET + 0 + + ) + +122  + #SEEK_CUR + 1 + + ) + +123  + #SEEK_END + 2 + + ) + +126 #ià +defšed + +__USE_SVID + || defšed +__USE_XOPEN + + +128  + #P_tmpdœ + "/tmp" + + ) + +141  + ~ + +145  +_IO_FILE + * +¡dš +; + +146  +_IO_FILE + * +¡dout +; + +147  +_IO_FILE + * +¡d”r +; + +149  + #¡dš + +¡dš + + + ) + +150  + #¡dout + +¡dout + + + ) + +151  + #¡d”r + +¡d”r + + + ) + +153 +__BEGIN_NAMESPACE_STD + + +155  + $»move + ( +__cÚ¡ + * +__fž’ame +è +__THROW +; + +157  + $»Çme + ( +__cÚ¡ + * +__Þd +, __cÚ¡ * +__Ãw +è +__THROW +; + +158 +__END_NAMESPACE_STD + + +160 #ifdeà +__USE_ATFILE + + +162  + $»Çm—t + ( +__Þdfd +, +__cÚ¡ + * +__Þd +,  +__Ãwfd +, + +163 +__cÚ¡ + * +__Ãw +è +__THROW +; + +166 +__BEGIN_NAMESPACE_STD + + +171 #iâdeà +__USE_FILE_OFFSET64 + + +172 +FILE + * + $tmpfže + (è +__wur +; + +174 #ifdeà +__REDIRECT + + +175 +FILE + * + `__REDIRECT + ( +tmpfže +, (), +tmpfže64 +è +__wur +; + +177  + #tmpfže + +tmpfže64 + + + ) + +181 #ifdeà +__USE_LARGEFILE64 + + +182 +FILE + * + $tmpfže64 + (è +__wur +; + +186 * + $tm²am + (* +__s +è +__THROW + +__wur +; + +187 +__END_NAMESPACE_STD + + +189 #ifdeà +__USE_MISC + + +192 * + $tm²am_r + (* +__s +è +__THROW + +__wur +; + +196 #ià +defšed + +__USE_SVID + || defšed +__USE_XOPEN + + +204 * + $‹m²am + ( +__cÚ¡ + * +__dœ +, __cÚ¡ * +__pfx +) + +205 +__THROW + +__©Œibu‹_m®loc__ + +__wur +; + +209 +__BEGIN_NAMESPACE_STD + + +214  + `fþo£ + ( +FILE + * +__¡»am +); + +219  + `fæush + ( +FILE + * +__¡»am +); + +220 +__END_NAMESPACE_STD + + +222 #ifdeà +__USE_MISC + + +229  + `fæush_uÆocked + ( +FILE + * +__¡»am +); + +232 #ifdeà +__USE_GNU + + +239  + `fþo£®l + (); + +243 +__BEGIN_NAMESPACE_STD + + +244 #iâdeà +__USE_FILE_OFFSET64 + + +249 +FILE + * + $fÝ’ + ( +__cÚ¡ + * +__»¡riù + +__fž’ame +, + +250 +__cÚ¡ + * +__»¡riù + +__modes +è +__wur +; + +255 +FILE + * + $äeÝ’ + ( +__cÚ¡ + * +__»¡riù + +__fž’ame +, + +256 +__cÚ¡ + * +__»¡riù + +__modes +, + +257 +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +259 #ifdeà +__REDIRECT + + +260 +FILE + * + `__REDIRECT + ( +fÝ’ +, ( +__cÚ¡ + * +__»¡riù + +__fž’ame +, + +261 +__cÚ¡ + * +__»¡riù + +__modes +), +fÝ’64 +) + +262 +__wur +; + +263 +FILE + * + `__REDIRECT + ( +äeÝ’ +, ( +__cÚ¡ + * +__»¡riù + +__fž’ame +, + +264 +__cÚ¡ + * +__»¡riù + +__modes +, + +265 +FILE + * +__»¡riù + +__¡»am +), +äeÝ’64 +) + +266 +__wur +; + +268  + #fÝ’ + +fÝ’64 + + + ) + +269  + #äeÝ’ + +äeÝ’64 + + + ) + +272 +__END_NAMESPACE_STD + + +273 #ifdeà +__USE_LARGEFILE64 + + +274 +FILE + * + $fÝ’64 + ( +__cÚ¡ + * +__»¡riù + +__fž’ame +, + +275 +__cÚ¡ + * +__»¡riù + +__modes +è +__wur +; + +276 +FILE + * + $äeÝ’64 + ( +__cÚ¡ + * +__»¡riù + +__fž’ame +, + +277 +__cÚ¡ + * +__»¡riù + +__modes +, + +278 +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +281 #ifdef +__USE_POSIX + + +283 +FILE + * + $fdÝ’ + ( +__fd +, +__cÚ¡ + * +__modes +è +__THROW + +__wur +; + +286 #ifdef +__USE_GNU + + +289 +FILE + * + $fÝ’cook› + (* +__»¡riù + +__magic_cook› +, + +290 +__cÚ¡ + * +__»¡riù + +__modes +, + +291 +_IO_cook›_io_funùiÚs_t + +__io_funcs +è +__THROW + +__wur +; + +294 #ifdeà +__USE_XOPEN2K8 + + +296 +FILE + * + $fmemÝ’ + (* +__s +, +size_t + +__Ën +, +__cÚ¡ + * +__modes +) + +297 +__THROW + +__wur +; + +302 +FILE + * + $Ý’_mem¡»am + (** +__buæoc +, +size_t + * +__siz–oc +è +__THROW + +__wur +; + +306 +__BEGIN_NAMESPACE_STD + + +309  + $£tbuf + ( +FILE + * +__»¡riù + +__¡»am +, *__»¡riù +__buf +è +__THROW +; + +313  + $£tvbuf + ( +FILE + * +__»¡riù + +__¡»am +, *__»¡riù +__buf +, + +314  +__modes +, +size_t + +__n +è +__THROW +; + +315 +__END_NAMESPACE_STD + + +317 #ifdef +__USE_BSD + + +320  + $£tbufãr + ( +FILE + * +__»¡riù + +__¡»am +, *__»¡riù +__buf +, + +321 +size_t + +__size +è +__THROW +; + +324  + $£Žšebuf + ( +FILE + * +__¡»am +è +__THROW +; + +328 +__BEGIN_NAMESPACE_STD + + +333  + `årštf + ( +FILE + * +__»¡riù + +__¡»am +, + +334 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...); + +339  + `´štf + ( +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...); + +341  + $¥rštf + (* +__»¡riù + +__s +, + +342 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...è +__THROW +; + +348  + `vårštf + ( +FILE + * +__»¡riù + +__s +, +__cÚ¡ + *__»¡riù +__fÜm© +, + +349 +_G_va_li¡ + +__¬g +); + +354  + `v´štf + ( +__cÚ¡ + * +__»¡riù + +__fÜm© +, +_G_va_li¡ + +__¬g +); + +356  + $v¥rštf + (* +__»¡riù + +__s +, +__cÚ¡ + *__»¡riù +__fÜm© +, + +357 +_G_va_li¡ + +__¬g +è +__THROW +; + +358 +__END_NAMESPACE_STD + + +360 #ià +defšed + +__USE_BSD + || defšed +__USE_ISOC99 + || defšed +__USE_UNIX98 + + +361 +__BEGIN_NAMESPACE_C99 + + +363  + $¢´štf + (* +__»¡riù + +__s +, +size_t + +__maxËn +, + +364 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...) + +365 +__THROW + + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__´štf__ +, 3, 4))); + +367  + $v¢´štf + (* +__»¡riù + +__s +, +size_t + +__maxËn +, + +368 +__cÚ¡ + * +__»¡riù + +__fÜm© +, +_G_va_li¡ + +__¬g +) + +369 +__THROW + + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__´štf__ +, 3, 0))); + +370 +__END_NAMESPACE_C99 + + +373 #ifdeà +__USE_GNU + + +376  + $va¥rštf + (** +__»¡riù + +__±r +, +__cÚ¡ + *__»¡riù +__f +, + +377 +_G_va_li¡ + +__¬g +) + +378 +__THROW + + `__©Œibu‹__ + (( + $__fÜm©__ + ( +__´štf__ +, 2, 0))è +__wur +; + +379  + $__a¥rštf + (** +__»¡riù + +__±r +, + +380 +__cÚ¡ + * +__»¡riù + +__fmt +, ...) + +381 +__THROW + + `__©Œibu‹__ + (( + $__fÜm©__ + ( +__´štf__ +, 2, 3))è +__wur +; + +382  + $a¥rštf + (** +__»¡riù + +__±r +, + +383 +__cÚ¡ + * +__»¡riù + +__fmt +, ...) + +384 +__THROW + + `__©Œibu‹__ + (( + $__fÜm©__ + ( +__´štf__ +, 2, 3))è +__wur +; + +387 #ifdeà +__USE_XOPEN2K8 + + +394  + $vd´štf + ( +__fd +, +__cÚ¡ + * +__»¡riù + +__fmt +, + +395 +_G_va_li¡ + +__¬g +) + +396 + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__´štf__ +, 2, 0))); + +397  + $d´štf + ( +__fd +, +__cÚ¡ + * +__»¡riù + +__fmt +, ...) + +398 + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__´štf__ +, 2, 3))); + +402 +__BEGIN_NAMESPACE_STD + + +407  + $fsÿnf + ( +FILE + * +__»¡riù + +__¡»am +, + +408 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...è +__wur +; + +413  + $sÿnf + ( +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...è +__wur +; + +415  + $ssÿnf + ( +__cÚ¡ + * +__»¡riù + +__s +, + +416 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...è +__THROW +; + +418 #ià +defšed + +__USE_ISOC99 + && !defšed +__USE_GNU + \ + +419 && (! +defšed + +__LDBL_COMPAT + || !defšed +__REDIRECT +) \ + +420 && ( +defšed + +__STRICT_ANSI__ + || defšed +__USE_XOPEN2K +) + +421 #ifdeà +__REDIRECT + + +425  + `__REDIRECT + ( +fsÿnf +, ( +FILE + * +__»¡riù + +__¡»am +, + +426 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...), + +427 +__isoc99_fsÿnf +è +__wur +; + +428  + `__REDIRECT + ( +sÿnf +, ( +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...), + +429 +__isoc99_sÿnf +è +__wur +; + +430  + `__REDIRECT + ( +ssÿnf +, ( +__cÚ¡ + * +__»¡riù + +__s +, + +431 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...), + +432 +__isoc99_ssÿnf +è +__THROW +; + +434  + $__isoc99_fsÿnf + ( +FILE + * +__»¡riù + +__¡»am +, + +435 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...è +__wur +; + +436  + $__isoc99_sÿnf + ( +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...è +__wur +; + +437  + $__isoc99_ssÿnf + ( +__cÚ¡ + * +__»¡riù + +__s +, + +438 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...è +__THROW +; + +439  + #fsÿnf + +__isoc99_fsÿnf + + + ) + +440  + #sÿnf + +__isoc99_sÿnf + + + ) + +441  + #ssÿnf + +__isoc99_ssÿnf + + + ) + +445 +__END_NAMESPACE_STD + + +447 #ifdef +__USE_ISOC99 + + +448 +__BEGIN_NAMESPACE_C99 + + +453  + $vfsÿnf + ( +FILE + * +__»¡riù + +__s +, +__cÚ¡ + *__»¡riù +__fÜm© +, + +454 +_G_va_li¡ + +__¬g +) + +455 + `__©Œibu‹__ + (( + $__fÜm©__ + ( +__sÿnf__ +, 2, 0))è +__wur +; + +461  + $vsÿnf + ( +__cÚ¡ + * +__»¡riù + +__fÜm© +, +_G_va_li¡ + +__¬g +) + +462 + `__©Œibu‹__ + (( + $__fÜm©__ + ( +__sÿnf__ +, 1, 0))è +__wur +; + +465  + $vssÿnf + ( +__cÚ¡ + * +__»¡riù + +__s +, + +466 +__cÚ¡ + * +__»¡riù + +__fÜm© +, +_G_va_li¡ + +__¬g +) + +467 +__THROW + + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__sÿnf__ +, 2, 0))); + +469 #ià! +defšed + +__USE_GNU + \ + +470 && (! +defšed + +__LDBL_COMPAT + || !defšed +__REDIRECT +) \ + +471 && ( +defšed + +__STRICT_ANSI__ + || defšed +__USE_XOPEN2K +) + +472 #ifdeà +__REDIRECT + + +476  + `__REDIRECT + ( +vfsÿnf +, + +477 ( +FILE + * +__»¡riù + +__s +, + +478 +__cÚ¡ + * +__»¡riù + +__fÜm© +, +_G_va_li¡ + +__¬g +), + +479 +__isoc99_vfsÿnf +) + +480 + `__©Œibu‹__ + (( + $__fÜm©__ + ( +__sÿnf__ +, 2, 0))è +__wur +; + +481  + `__REDIRECT + ( +vsÿnf +, ( +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +482 +_G_va_li¡ + +__¬g +), +__isoc99_vsÿnf +) + +483 + `__©Œibu‹__ + (( + $__fÜm©__ + ( +__sÿnf__ +, 1, 0))è +__wur +; + +484  + `__REDIRECT + ( +vssÿnf +, + +485 ( +__cÚ¡ + * +__»¡riù + +__s +, + +486 +__cÚ¡ + * +__»¡riù + +__fÜm© +, +_G_va_li¡ + +__¬g +), + +487 +__isoc99_vssÿnf +) + +488 +__THROW + + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__sÿnf__ +, 2, 0))); + +490  + $__isoc99_vfsÿnf + ( +FILE + * +__»¡riù + +__s +, + +491 +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +492 +_G_va_li¡ + +__¬g +è +__wur +; + +493  + $__isoc99_vsÿnf + ( +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +494 +_G_va_li¡ + +__¬g +è +__wur +; + +495  + $__isoc99_vssÿnf + ( +__cÚ¡ + * +__»¡riù + +__s +, + +496 +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +497 +_G_va_li¡ + +__¬g +è +__THROW +; + +498  + #vfsÿnf + +__isoc99_vfsÿnf + + + ) + +499  + #vsÿnf + +__isoc99_vsÿnf + + + ) + +500  + #vssÿnf + +__isoc99_vssÿnf + + + ) + +504 +__END_NAMESPACE_C99 + + +508 +__BEGIN_NAMESPACE_STD + + +513  + `fg‘c + ( +FILE + * +__¡»am +); + +514  + `g‘c + ( +FILE + * +__¡»am +); + +520  + `g‘ch¬ + (); + +521 +__END_NAMESPACE_STD + + +525  + #g‘c +( +_å +è + `_IO_g‘c + (_å) + + ) + +527 #ià +defšed + +__USE_POSIX + || defšed +__USE_MISC + + +532  + `g‘c_uÆocked + ( +FILE + * +__¡»am +); + +533  + `g‘ch¬_uÆocked + (); + +536 #ifdeà +__USE_MISC + + +543  + `fg‘c_uÆocked + ( +FILE + * +__¡»am +); + +547 +__BEGIN_NAMESPACE_STD + + +555  + `åutc + ( +__c +, +FILE + * +__¡»am +); + +556  + `putc + ( +__c +, +FILE + * +__¡»am +); + +562  + `putch¬ + ( +__c +); + +563 +__END_NAMESPACE_STD + + +567  + #putc +( +_ch +, +_å +è + `_IO_putc + (_ch, _å) + + ) + +569 #ifdeà +__USE_MISC + + +576  + `åutc_uÆocked + ( +__c +, +FILE + * +__¡»am +); + +579 #ià +defšed + +__USE_POSIX + || defšed +__USE_MISC + + +584  + `putc_uÆocked + ( +__c +, +FILE + * +__¡»am +); + +585  + `putch¬_uÆocked + ( +__c +); + +589 #ià +defšed + +__USE_SVID + || defšed +__USE_MISC + \ + +590 || ( +defšed + +__USE_XOPEN + && !defšed +__USE_XOPEN2K +) + +592  + `g‘w + ( +FILE + * +__¡»am +); + +595  + `putw + ( +__w +, +FILE + * +__¡»am +); + +599 +__BEGIN_NAMESPACE_STD + + +604 * + $fg‘s + (* +__»¡riù + +__s +,  +__n +, +FILE + *__»¡riù +__¡»am +) + +605 +__wur +; + +612 * + $g‘s + (* +__s +è +__wur +; + +613 +__END_NAMESPACE_STD + + +615 #ifdeà +__USE_GNU + + +622 * + $fg‘s_uÆocked + (* +__»¡riù + +__s +,  +__n +, + +623 +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +627 #ifdef +__USE_XOPEN2K8 + + +638 +_IO_ssize_t + + $__g‘d–im + (** +__»¡riù + +__lš•Œ +, + +639 +size_t + * +__»¡riù + +__n +,  +__d–im™” +, + +640 +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +641 +_IO_ssize_t + + $g‘d–im + (** +__»¡riù + +__lš•Œ +, + +642 +size_t + * +__»¡riù + +__n +,  +__d–im™” +, + +643 +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +651 +_IO_ssize_t + + $g‘lše + (** +__»¡riù + +__lš•Œ +, + +652 +size_t + * +__»¡riù + +__n +, + +653 +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +657 +__BEGIN_NAMESPACE_STD + + +662  + `åuts + ( +__cÚ¡ + * +__»¡riù + +__s +, +FILE + *__»¡riù +__¡»am +); + +668  + `puts + ( +__cÚ¡ + * +__s +); + +675  + `ung‘c + ( +__c +, +FILE + * +__¡»am +); + +682 +size_t + + $ä—d + (* +__»¡riù + +__±r +, +size_t + +__size +, + +683 +size_t + +__n +, +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +688 +size_t + + `fwr™e + ( +__cÚ¡ + * +__»¡riù + +__±r +, size_ˆ +__size +, + +689 +size_t + +__n +, +FILE + * +__»¡riù + +__s +); + +690 +__END_NAMESPACE_STD + + +692 #ifdeà +__USE_GNU + + +699  + `åuts_uÆocked + ( +__cÚ¡ + * +__»¡riù + +__s +, + +700 +FILE + * +__»¡riù + +__¡»am +); + +703 #ifdeà +__USE_MISC + + +710 +size_t + + $ä—d_uÆocked + (* +__»¡riù + +__±r +, +size_t + +__size +, + +711 +size_t + +__n +, +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +712 +size_t + + `fwr™e_uÆocked + ( +__cÚ¡ + * +__»¡riù + +__±r +, size_ˆ +__size +, + +713 +size_t + +__n +, +FILE + * +__»¡riù + +__¡»am +); + +717 +__BEGIN_NAMESPACE_STD + + +722  + `f£ek + ( +FILE + * +__¡»am +,  +__off +,  +__wh’û +); + +727  + $á–l + ( +FILE + * +__¡»am +è +__wur +; + +732  + `»wšd + ( +FILE + * +__¡»am +); + +733 +__END_NAMESPACE_STD + + +740 #ià +defšed + +__USE_LARGEFILE + || defšed +__USE_XOPEN2K + + +741 #iâdeà +__USE_FILE_OFFSET64 + + +746  + `f£eko + ( +FILE + * +__¡»am +, +__off_t + +__off +,  +__wh’û +); + +751 +__off_t + + $á–lo + ( +FILE + * +__¡»am +è +__wur +; + +753 #ifdeà +__REDIRECT + + +754  + `__REDIRECT + ( +f£eko +, + +755 ( +FILE + * +__¡»am +, +__off64_t + +__off +,  +__wh’û +), + +756 +f£eko64 +); + +757 +__off64_t + + `__REDIRECT + ( +á–lo +, ( +FILE + * +__¡»am +), +á–lo64 +); + +759  + #f£eko + +f£eko64 + + + ) + +760  + #á–lo + +á–lo64 + + + ) + +765 +__BEGIN_NAMESPACE_STD + + +766 #iâdeà +__USE_FILE_OFFSET64 + + +771  + `fg‘pos + ( +FILE + * +__»¡riù + +__¡»am +, +åos_t + *__»¡riù +__pos +); + +776  + `f£os + ( +FILE + * +__¡»am +, +__cÚ¡ + +åos_t + * +__pos +); + +778 #ifdeà +__REDIRECT + + +779  + `__REDIRECT + ( +fg‘pos +, ( +FILE + * +__»¡riù + +__¡»am +, + +780 +åos_t + * +__»¡riù + +__pos +), +fg‘pos64 +); + +781  + `__REDIRECT + ( +f£os +, + +782 ( +FILE + * +__¡»am +, +__cÚ¡ + +åos_t + * +__pos +), +f£os64 +); + +784  + #fg‘pos + +fg‘pos64 + + + ) + +785  + #f£os + +f£os64 + + + ) + +788 +__END_NAMESPACE_STD + + +790 #ifdeà +__USE_LARGEFILE64 + + +791  + `f£eko64 + ( +FILE + * +__¡»am +, +__off64_t + +__off +,  +__wh’û +); + +792 +__off64_t + + $á–lo64 + ( +FILE + * +__¡»am +è +__wur +; + +793  + `fg‘pos64 + ( +FILE + * +__»¡riù + +__¡»am +, +åos64_t + *__»¡riù +__pos +); + +794  + `f£os64 + ( +FILE + * +__¡»am +, +__cÚ¡ + +åos64_t + * +__pos +); + +797 +__BEGIN_NAMESPACE_STD + + +799  + $þ—»¼ + ( +FILE + * +__¡»am +è +__THROW +; + +801  + $ãof + ( +FILE + * +__¡»am +è +__THROW + +__wur +; + +803  + $ã¼Ü + ( +FILE + * +__¡»am +è +__THROW + +__wur +; + +804 +__END_NAMESPACE_STD + + +806 #ifdeà +__USE_MISC + + +808  + $þ—»¼_uÆocked + ( +FILE + * +__¡»am +è +__THROW +; + +809  + $ãof_uÆocked + ( +FILE + * +__¡»am +è +__THROW + +__wur +; + +810  + $ã¼Ü_uÆocked + ( +FILE + * +__¡»am +è +__THROW + +__wur +; + +814 +__BEGIN_NAMESPACE_STD + + +819  + `³¼Ü + ( +__cÚ¡ + * +__s +); + +820 +__END_NAMESPACE_STD + + +826  + ~ + +829 #ifdef +__USE_POSIX + + +831  + $fž’o + ( +FILE + * +__¡»am +è +__THROW + +__wur +; + +834 #ifdeà +__USE_MISC + + +836  + $fž’o_uÆocked + ( +FILE + * +__¡»am +è +__THROW + +__wur +; + +840 #ià( +defšed + +__USE_POSIX2 + || defšed +__USE_SVID + || defšed +__USE_BSD + || \ + +841 +defšed + +__USE_MISC +) + +846 +FILE + * + $pÝ’ + ( +__cÚ¡ + * +__commªd +, __cÚ¡ * +__modes +è +__wur +; + +852  + `pþo£ + ( +FILE + * +__¡»am +); + +856 #ifdef +__USE_POSIX + + +858 * + $ù”mid + (* +__s +è +__THROW +; + +862 #ifdeà +__USE_XOPEN + + +864 * + `cu£rid + (* +__s +); + +868 #ifdef +__USE_GNU + + +869  +ob¡ack +; + +872  + $ob¡ack_´štf + ( +ob¡ack + * +__»¡riù + +__ob¡ack +, + +873 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...) + +874 +__THROW + + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__´štf__ +, 2, 3))); + +875  + $ob¡ack_v´štf + ( +ob¡ack + * +__»¡riù + +__ob¡ack +, + +876 +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +877 +_G_va_li¡ + +__¬gs +) + +878 +__THROW + + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__´štf__ +, 2, 0))); + +882 #ià +defšed + +__USE_POSIX + || defšed +__USE_MISC + + +886  + $æockfže + ( +FILE + * +__¡»am +è +__THROW +; + +890  + $árylockfže + ( +FILE + * +__¡»am +è +__THROW + +__wur +; + +893  + $fuÆockfže + ( +FILE + * +__¡»am +è +__THROW +; + +896 #ià +defšed + +__USE_XOPEN + && !defšed +__USE_XOPEN2K + && !defšed +__USE_GNU + + +900  + #__Ãed_g‘Ýt + + + ) + +901  + ~ + +906 #ifdeà +__USE_EXTERN_INLINES + + +907  + ~ + +909 #ià +__USE_FORTIFY_LEVEL + > 0 && +defšed + +__ex‹º_®ways_šlše + + +910  + ~ + +912 #ifdeà +__LDBL_COMPAT + + +913  + ~ + +916 +__END_DECLS + + + @/usr/include/bits/stdio-ldbl.h + +20 #iâdeà +_STDIO_H + + +24 +__BEGIN_NAMESPACE_STD + + +25 + $__LDBL_REDIR_DECL + ( +årštf +) + +26 + $__LDBL_REDIR_DECL + ( +´štf +) + +27 + $__LDBL_REDIR_DECL + ( +¥rštf +) + +28 + $__LDBL_REDIR_DECL + ( +vårštf +) + +29 + $__LDBL_REDIR_DECL + ( +v´štf +) + +30 + $__LDBL_REDIR_DECL + ( +v¥rštf +) + +31 #ià +defšed + +__USE_ISOC99 + && !defšed +__USE_GNU + \ + +32 && ! +defšed + +__REDIRECT + \ + +33 && ( +defšed + +__STRICT_ANSI__ + || defšed +__USE_XOPEN2K +) + +34 + $__LDBL_REDIR1_DECL + ( +fsÿnf +, +__Ædbl___isoc99_fsÿnf +) + +35 + $__LDBL_REDIR1_DECL + ( +sÿnf +, +__Ædbl___isoc99_sÿnf +) + +36 + $__LDBL_REDIR1_DECL + ( +ssÿnf +, +__Ædbl___isoc99_ssÿnf +) + +38 + $__LDBL_REDIR_DECL + ( +fsÿnf +) + +39 + $__LDBL_REDIR_DECL + ( +sÿnf +) + +40 + $__LDBL_REDIR_DECL + ( +ssÿnf +) + +42 +__END_NAMESPACE_STD + + +44 #ià +defšed + +__USE_BSD + || defšed +__USE_ISOC99 + || defšed +__USE_UNIX98 + + +45 +__BEGIN_NAMESPACE_C99 + + +46 + $__LDBL_REDIR_DECL + ( +¢´štf +) + +47 + $__LDBL_REDIR_DECL + ( +v¢´štf +) + +48 +__END_NAMESPACE_C99 + + +51 #ifdef +__USE_ISOC99 + + +52 +__BEGIN_NAMESPACE_C99 + + +53 #ià! +defšed + +__USE_GNU + && !defšed +__REDIRECT + \ + +54 && ( +defšed + +__STRICT_ANSI__ + || defšed +__USE_XOPEN2K +) + +55 + $__LDBL_REDIR1_DECL + ( +vfsÿnf +, +__Ædbl___isoc99_vfsÿnf +) + +56 + $__LDBL_REDIR1_DECL + ( +vsÿnf +, +__Ædbl___isoc99_vsÿnf +) + +57 + $__LDBL_REDIR1_DECL + ( +vssÿnf +, +__Ædbl___isoc99_vssÿnf +) + +59 + $__LDBL_REDIR_DECL + ( +vfsÿnf +) + +60 + $__LDBL_REDIR_DECL + ( +vssÿnf +) + +61 + $__LDBL_REDIR_DECL + ( +vsÿnf +) + +63 +__END_NAMESPACE_C99 + + +66 #ifdeà +__USE_GNU + + +67 + $__LDBL_REDIR_DECL + ( +vd´štf +) + +68 + $__LDBL_REDIR_DECL + ( +d´štf +) + +69 + $__LDBL_REDIR_DECL + ( +va¥rštf +) + +70 + $__LDBL_REDIR_DECL + ( +__a¥rštf +) + +71 + $__LDBL_REDIR_DECL + ( +a¥rštf +) + +72 + $__LDBL_REDIR_DECL + ( +ob¡ack_´štf +) + +73 + $__LDBL_REDIR_DECL + ( +ob¡ack_v´štf +) + +76 #ià +__USE_FORTIFY_LEVEL + > 0 && +defšed + +__ex‹º_®ways_šlše + + +77 + $__LDBL_REDIR_DECL + ( +__¥rštf_chk +) + +78 + $__LDBL_REDIR_DECL + ( +__v¥rštf_chk +) + +79 #ià +defšed + +__USE_BSD + || defšed +__USE_ISOC99 + || defšed +__USE_UNIX98 + + +80 + $__LDBL_REDIR_DECL + ( +__¢´štf_chk +) + +81 + $__LDBL_REDIR_DECL + ( +__v¢´štf_chk +) + +83 #ià +__USE_FORTIFY_LEVEL + > 1 + +84 + $__LDBL_REDIR_DECL + ( +__årštf_chk +) + +85 + $__LDBL_REDIR_DECL + ( +__´štf_chk +) + +86 + $__LDBL_REDIR_DECL + ( +__vårštf_chk +) + +87 + $__LDBL_REDIR_DECL + ( +__v´štf_chk +) + +88 #ifdeà +__USE_GNU + + +89 + $__LDBL_REDIR_DECL + ( +__a¥rštf_chk +) + +90 + $__LDBL_REDIR_DECL + ( +__va¥rštf_chk +) + +91 + $__LDBL_REDIR_DECL + ( +__d´štf_chk +) + +92 + $__LDBL_REDIR_DECL + ( +__vd´štf_chk +) + +93 + $__LDBL_REDIR_DECL + ( +__ob¡ack_´štf_chk +) + +94 + $__LDBL_REDIR_DECL + ( +__ob¡ack_v´štf_chk +) + + @/usr/include/bits/stdio.h + +20 #iâdeà +_STDIO_H + + +24 #iâdeà +__ex‹º_šlše + + +25  + #__STDIO_INLINE + +šlše + + + ) + +27  + #__STDIO_INLINE + +__ex‹º_šlše + + + ) + +31 #ifdeà +__USE_EXTERN_INLINES + + +34 #ià!( +__USE_FORTIFY_LEVEL + > 0 && +defšed + +__ex‹º_®ways_šlše +) + +36 +__STDIO_INLINE +  + +37 + $v´štf + ( +__cÚ¡ + * +__»¡riù + +__fmt +, +_G_va_li¡ + +__¬g +) + +39  + `vårštf + ( +¡dout +, +__fmt +, +__¬g +); + +40 + } +} + +44 +__STDIO_INLINE +  + +45 + $g‘ch¬ + () + +47  + `_IO_g‘c + ( +¡dš +); + +48 + } +} + +51 #ifdeà +__USE_MISC + + +53 +__STDIO_INLINE +  + +54 + $fg‘c_uÆocked + ( +FILE + * +__å +) + +56  + `_IO_g‘c_uÆocked + ( +__å +); + +57 + } +} + +61 #ià +defšed + +__USE_POSIX + || defšed +__USE_MISC + + +63 +__STDIO_INLINE +  + +64 + $g‘c_uÆocked + ( +FILE + * +__å +) + +66  + `_IO_g‘c_uÆocked + ( +__å +); + +67 + } +} + +70 +__STDIO_INLINE +  + +71 + $g‘ch¬_uÆocked + () + +73  + `_IO_g‘c_uÆocked + ( +¡dš +); + +74 + } +} + +79 +__STDIO_INLINE +  + +80 + $putch¬ + ( +__c +) + +82  + `_IO_putc + ( +__c +, +¡dout +); + +83 + } +} + +86 #ifdeà +__USE_MISC + + +88 +__STDIO_INLINE +  + +89 + $åutc_uÆocked + ( +__c +, +FILE + * +__¡»am +) + +91  + `_IO_putc_uÆocked + ( +__c +, +__¡»am +); + +92 + } +} + +96 #ià +defšed + +__USE_POSIX + || defšed +__USE_MISC + + +98 +__STDIO_INLINE +  + +99 + $putc_uÆocked + ( +__c +, +FILE + * +__¡»am +) + +101  + `_IO_putc_uÆocked + ( +__c +, +__¡»am +); + +102 + } +} + +105 +__STDIO_INLINE +  + +106 + $putch¬_uÆocked + ( +__c +) + +108  + `_IO_putc_uÆocked + ( +__c +, +¡dout +); + +109 + } +} + +113 #ifdef +__USE_GNU + + +115 +__STDIO_INLINE + +_IO_ssize_t + + +116 + $g‘lše + (** +__lš•Œ +, +size_t + * +__n +, +FILE + * +__¡»am +) + +118  + `__g‘d–im + ( +__lš•Œ +, +__n +, '\n', +__¡»am +); + +119 + } +} + +123 #ifdeà +__USE_MISC + + +125 +__STDIO_INLINE +  + +126 +__NTH + ( + $ãof_uÆocked + ( +FILE + * +__¡»am +)) + +128  + `_IO_ãof_uÆocked + ( +__¡»am +); + +129 + } +} + +132 +__STDIO_INLINE +  + +133 +__NTH + ( + $ã¼Ü_uÆocked + ( +FILE + * +__¡»am +)) + +135  + `_IO_ã¼Ü_uÆocked + ( +__¡»am +); + +136 + } +} + +142 #ià +defšed + +__USE_MISC + && defšed +__GNUC__ + && defšed +__OPTIMIZE__ + \ + +143 && ! +defšed + + g__ýlu¥lus + + +145  + #ä—d_uÆocked +( +±r +, +size +, +n +, +¡»am +) \ + +146 ( + `__ex‹nsiÚ__ + (( + `__bužtš_cÚ¡ªt_p + ( +size +è&& __bužtš_cÚ¡ªt_°( +n +) \ + +147 && ( +size_t +è( +size +è* (size_tè( +n +) <= 8 \ + +148 && ( +size_t +è( +size +) != 0) \ + +149 ? ({ * +__±r + = (*è( +±r +); \ + +150 +FILE + * +__¡»am + = ( +¡»am +); \ + +151 +size_t + +__út +; \ + +152  +__út + = ( +size_t +è( +size +è* (size_tè( +n +); \ + +153 +__út + > 0; --__cnt) \ + +155  +__c + = + `_IO_g‘c_uÆocked + ( +__¡»am +); \ + +156 ià( +__c + =ð +EOF +) \ + +158 * +__±r +++ = +__c +; \ + +160 (( +size_t +è( +size +è* (size_tè( +n +è- +__út +) \ + +161 / ( +size_t +è( +size +); }) \ + +162 : ((( + `__bužtš_cÚ¡ªt_p + ( +size +è&& ( +size_t +) (size) == 0) \ + +163 || ( + `__bužtš_cÚ¡ªt_p + ( +n +è&& ( +size_t +) (n) == 0)) \ + +165 ? ((è( +±r +), (è( +¡»am +), (è( +size +), \ + +166 (è( +n +), ( +size_t +) 0) \ + +167 : + `ä—d_uÆocked + ( +±r +, +size +, +n +, +¡»am +)))) + + ) + +169  + #fwr™e_uÆocked +( +±r +, +size +, +n +, +¡»am +) \ + +170 ( + `__ex‹nsiÚ__ + (( + `__bužtš_cÚ¡ªt_p + ( +size +è&& __bužtš_cÚ¡ªt_°( +n +) \ + +171 && ( +size_t +è( +size +è* (size_tè( +n +) <= 8 \ + +172 && ( +size_t +è( +size +) != 0) \ + +173 ? ({ cÚ¡ * +__±r + = (cÚ¡ *è( +±r +); \ + +174 +FILE + * +__¡»am + = ( +¡»am +); \ + +175 +size_t + +__út +; \ + +176  +__út + = ( +size_t +è( +size +è* (size_tè( +n +); \ + +177 +__út + > 0; --__cnt) \ + +178 ià( + `_IO_putc_uÆocked + (* +__±r +++, +__¡»am +è=ð +EOF +) \ + +180 (( +size_t +è( +size +è* (size_tè( +n +è- +__út +) \ + +181 / ( +size_t +è( +size +); }) \ + +182 : ((( + `__bužtš_cÚ¡ªt_p + ( +size +è&& ( +size_t +) (size) == 0) \ + +183 || ( + `__bužtš_cÚ¡ªt_p + ( +n +è&& ( +size_t +) (n) == 0)) \ + +185 ? ((è( +±r +), (è( +¡»am +), (è( +size +), \ + +186 (è( +n +), ( +size_t +) 0) \ + +187 : + `fwr™e_uÆocked + ( +±r +, +size +, +n +, +¡»am +)))) + + ) + +191 #undeà +__STDIO_INLINE + + + @/usr/include/bits/stdio2.h + +20 #iâdeà +_STDIO_H + + +24  + $__¥rštf_chk + (* +__»¡riù + +__s +,  +__æag +, +size_t + +__¦’ +, + +25 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...è +__THROW +; + +26  + $__v¥rštf_chk + (* +__»¡riù + +__s +,  +__æag +, +size_t + +__¦’ +, + +27 +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +28 +_G_va_li¡ + +__­ +è +__THROW +; + +30 #ifdeà +__va_¬g_·ck + + +31 +__ex‹º_®ways_šlše +  + +32 + `__NTH + ( + $¥rštf + (* +__»¡riù + +__s +, +__cÚ¡ + *__»¡riù +__fmt +, ...)) + +34  + `__bužtš___¥rštf_chk + ( +__s +, +__USE_FORTIFY_LEVEL + - 1, + +35 + `__bos + ( +__s +), +__fmt +, + `__va_¬g_·ck + ()); + +36 + } +} + +37 #–ià! +defšed + +__ýlu¥lus + + +38  + #¥rštf +( +¡r +, ...) \ + +39 + `__bužtš___¥rštf_chk + ( +¡r +, +__USE_FORTIFY_LEVEL + - 1, + `__bos + (str), \ + +40 +__VA_ARGS__ +) + + ) + +43 +__ex‹º_®ways_šlše +  + +44 +__NTH + ( + $v¥rštf + (* +__»¡riù + +__s +, +__cÚ¡ + *__»¡riù +__fmt +, + +45 +_G_va_li¡ + +__­ +)) + +47  + `__bužtš___v¥rštf_chk + ( +__s +, +__USE_FORTIFY_LEVEL + - 1, + +48 + `__bos + ( +__s +), +__fmt +, +__­ +); + +49 + } +} + +51 #ià +defšed + +__USE_BSD + || defšed +__USE_ISOC99 + || defšed +__USE_UNIX98 + + +53  + $__¢´štf_chk + (* +__»¡riù + +__s +, +size_t + +__n +,  +__æag +, + +54 +size_t + +__¦’ +, +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +55 ...è +__THROW +; + +56  + $__v¢´štf_chk + (* +__»¡riù + +__s +, +size_t + +__n +,  +__æag +, + +57 +size_t + +__¦’ +, +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +58 +_G_va_li¡ + +__­ +è +__THROW +; + +60 #ifdeà +__va_¬g_·ck + + +61 +__ex‹º_®ways_šlše +  + +62 + `__NTH + ( + $¢´štf + (* +__»¡riù + +__s +, +size_t + +__n +, + +63 +__cÚ¡ + * +__»¡riù + +__fmt +, ...)) + +65  + `__bužtš___¢´štf_chk + ( +__s +, +__n +, +__USE_FORTIFY_LEVEL + - 1, + +66 + `__bos + ( +__s +), +__fmt +, + `__va_¬g_·ck + ()); + +67 + } +} + +68 #–ià! +defšed + +__ýlu¥lus + + +69  + #¢´štf +( +¡r +, +Ën +, ...) \ + +70 + `__bužtš___¢´štf_chk + ( +¡r +, +Ën +, +__USE_FORTIFY_LEVEL + - 1, + `__bos + (str), \ + +71 +__VA_ARGS__ +) + + ) + +74 +__ex‹º_®ways_šlše +  + +75 +__NTH + ( + $v¢´štf + (* +__»¡riù + +__s +, +size_t + +__n +, + +76 +__cÚ¡ + * +__»¡riù + +__fmt +, +_G_va_li¡ + +__­ +)) + +78  + `__bužtš___v¢´štf_chk + ( +__s +, +__n +, +__USE_FORTIFY_LEVEL + - 1, + +79 + `__bos + ( +__s +), +__fmt +, +__­ +); + +80 + } +} + +84 #ià +__USE_FORTIFY_LEVEL + > 1 + +86  +__årštf_chk + ( +FILE + * +__»¡riù + +__¡»am +,  +__æag +, + +87 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...); + +88  +__´štf_chk + ( +__æag +, +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...); + +89  +__vårštf_chk + ( +FILE + * +__»¡riù + +__¡»am +,  +__æag +, + +90 +__cÚ¡ + * +__»¡riù + +__fÜm© +, +_G_va_li¡ + +__­ +); + +91  +__v´štf_chk + ( +__æag +, +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +92 +_G_va_li¡ + +__­ +); + +94 #ifdeà +__va_¬g_·ck + + +95 +__ex‹º_®ways_šlše +  + +96 + $årštf + ( +FILE + * +__»¡riù + +__¡»am +, +__cÚ¡ + *__»¡riù +__fmt +, ...) + +98  + `__årštf_chk + ( +__¡»am +, +__USE_FORTIFY_LEVEL + - 1, +__fmt +, + +99 + `__va_¬g_·ck + ()); + +100 + } +} + +102 +__ex‹º_®ways_šlše +  + +103 + $´štf + ( +__cÚ¡ + * +__»¡riù + +__fmt +, ...) + +105  + `__´štf_chk + ( +__USE_FORTIFY_LEVEL + - 1, +__fmt +, + `__va_¬g_·ck + ()); + +106 + } +} + +107 #–ià! +defšed + +__ýlu¥lus + + +108  + #´štf +(...) \ + +109 + `__´štf_chk + ( +__USE_FORTIFY_LEVEL + - 1, +__VA_ARGS__ +) + + ) + +110  + #årštf +( +¡»am +, ...) \ + +111 + `__årštf_chk + ( +¡»am +, +__USE_FORTIFY_LEVEL + - 1, +__VA_ARGS__ +) + + ) + +114 +__ex‹º_®ways_šlše +  + +115 + $v´štf + ( +__cÚ¡ + * +__»¡riù + +__fmt +, +_G_va_li¡ + +__­ +) + +117 #ifdeà +__USE_EXTERN_INLINES + + +118  + `__vårštf_chk + ( +¡dout +, +__USE_FORTIFY_LEVEL + - 1, +__fmt +, +__­ +); + +120  + `__v´štf_chk + ( +__USE_FORTIFY_LEVEL + - 1, +__fmt +, +__­ +); + +122 + } +} + +124 +__ex‹º_®ways_šlše +  + +125 + $vårštf + ( +FILE + * +__»¡riù + +__¡»am +, + +126 +__cÚ¡ + * +__»¡riù + +__fmt +, +_G_va_li¡ + +__­ +) + +128  + `__vårštf_chk + ( +__¡»am +, +__USE_FORTIFY_LEVEL + - 1, +__fmt +, +__­ +); + +129 + } +} + +131 #ifdeà +__USE_GNU + + +133  + $__a¥rštf_chk + (** +__»¡riù + +__±r +,  +__æag +, + +134 +__cÚ¡ + * +__»¡riù + +__fmt +, ...) + +135 +__THROW + + `__©Œibu‹__ + (( + $__fÜm©__ + ( +__´štf__ +, 3, 4))è +__wur +; + +136  + $__va¥rštf_chk + (** +__»¡riù + +__±r +,  +__æag +, + +137 +__cÚ¡ + * +__»¡riù + +__fmt +, +_G_va_li¡ + +__¬g +) + +138 +__THROW + + `__©Œibu‹__ + (( + $__fÜm©__ + ( +__´štf__ +, 3, 0))è +__wur +; + +139  + $__d´štf_chk + ( +__fd +,  +__æag +, +__cÚ¡ + * +__»¡riù + +__fmt +, + +140 ...è + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__´štf__ +, 3, 4))); + +141  + $__vd´štf_chk + ( +__fd +,  +__æag +, + +142 +__cÚ¡ + * +__»¡riù + +__fmt +, +_G_va_li¡ + +__¬g +) + +143 + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__´štf__ +, 3, 0))); + +144  + $__ob¡ack_´štf_chk + ( +ob¡ack + * +__»¡riù + +__ob¡ack +, + +145  +__æag +, +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +147 +__THROW + + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__´štf__ +, 3, 4))); + +148  + $__ob¡ack_v´štf_chk + ( +ob¡ack + * +__»¡riù + +__ob¡ack +, + +149  +__æag +, + +150 +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +151 +_G_va_li¡ + +__¬gs +) + +152 +__THROW + + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__´štf__ +, 3, 0))); + +154 #ifdeà +__va_¬g_·ck + + +155 +__ex‹º_®ways_šlše +  + +156 + `__NTH + ( + $a¥rštf + (** +__»¡riù + +__±r +, +__cÚ¡ + *__»¡riù +__fmt +, ...)) + +158  + `__a¥rštf_chk + ( +__±r +, +__USE_FORTIFY_LEVEL + - 1, +__fmt +, + +159 + `__va_¬g_·ck + ()); + +160 + } +} + +162 +__ex‹º_®ways_šlše +  + +163 +__NTH + ( + $__a¥rštf + (** +__»¡riù + +__±r +, +__cÚ¡ + *__»¡riù +__fmt +, + +166  + `__a¥rštf_chk + ( +__±r +, +__USE_FORTIFY_LEVEL + - 1, +__fmt +, + +167 + `__va_¬g_·ck + ()); + +168 + } +} + +170 +__ex‹º_®ways_šlše +  + +171 + $d´štf + ( +__fd +, +__cÚ¡ + * +__»¡riù + +__fmt +, ...) + +173  + `__d´štf_chk + ( +__fd +, +__USE_FORTIFY_LEVEL + - 1, +__fmt +, + +174 + `__va_¬g_·ck + ()); + +175 + } +} + +177 +__ex‹º_®ways_šlše +  + +178 +__NTH + ( + $ob¡ack_´štf + ( +ob¡ack + * +__»¡riù + +__ob¡ack +, + +179 +__cÚ¡ + * +__»¡riù + +__fmt +, ...)) + +181  + `__ob¡ack_´štf_chk + ( +__ob¡ack +, +__USE_FORTIFY_LEVEL + - 1, +__fmt +, + +182 + `__va_¬g_·ck + ()); + +183 + } +} + +184 #–ià! +defšed + +__ýlu¥lus + + +185  + #a¥rštf +( +±r +, ...) \ + +186 + `__a¥rštf_chk + ( +±r +, +__USE_FORTIFY_LEVEL + - 1, +__VA_ARGS__ +) + + ) + +187  + #__a¥rštf +( +±r +, ...) \ + +188 + `__a¥rštf_chk + ( +±r +, +__USE_FORTIFY_LEVEL + - 1, +__VA_ARGS__ +) + + ) + +189  + #d´štf +( +fd +, ...) \ + +190 + `__d´štf_chk + ( +fd +, +__USE_FORTIFY_LEVEL + - 1, +__VA_ARGS__ +) + + ) + +191  + #ob¡ack_´štf +( +ob¡ack +, ...) \ + +192 + `__ob¡ack_´štf_chk + ( +ob¡ack +, +__USE_FORTIFY_LEVEL + - 1, +__VA_ARGS__ +) + + ) + +195 +__ex‹º_®ways_šlše +  + +196 +__NTH + ( + $va¥rštf + (** +__»¡riù + +__±r +, +__cÚ¡ + *__»¡riù +__fmt +, + +197 +_G_va_li¡ + +__­ +)) + +199  + `__va¥rštf_chk + ( +__±r +, +__USE_FORTIFY_LEVEL + - 1, +__fmt +, +__­ +); + +200 + } +} + +202 +__ex‹º_®ways_šlše +  + +203 + $vd´štf + ( +__fd +, +__cÚ¡ + * +__»¡riù + +__fmt +, +_G_va_li¡ + +__­ +) + +205  + `__vd´štf_chk + ( +__fd +, +__USE_FORTIFY_LEVEL + - 1, +__fmt +, +__­ +); + +206 + } +} + +208 +__ex‹º_®ways_šlše +  + +209 +__NTH + ( + $ob¡ack_v´štf + ( +ob¡ack + * +__»¡riù + +__ob¡ack +, + +210 +__cÚ¡ + * +__»¡riù + +__fmt +, +_G_va_li¡ + +__­ +)) + +212  + `__ob¡ack_v´štf_chk + ( +__ob¡ack +, +__USE_FORTIFY_LEVEL + - 1, +__fmt +, + +213 +__­ +); + +214 + } +} + +220 * + $__g‘s_chk + (* +__¡r +, +size_t +è +__wur +; + +221 * + `__REDIRECT + ( +__g‘s_w¬n +, (* +__¡r +), +g‘s +) + +222 +__wur + + `__w¬Ç‰r + ("please use fgets or getline instead, gets can't " + +225 +__ex‹º_®ways_šlše + +__wur + * + +226 + $g‘s + (* +__¡r +) + +228 ià( + `__bos + ( +__¡r +è!ð( +size_t +) -1) + +229  + `__g‘s_chk + ( +__¡r +, + `__bos + (__str)); + +230  + `__g‘s_w¬n + ( +__¡r +); + +231 + } +} + +233 * + $__fg‘s_chk + (* +__»¡riù + +__s +, +size_t + +__size +,  +__n +, + +234 +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +235 * + `__REDIRECT + ( +__fg‘s_®Ÿs +, + +236 (* +__»¡riù + +__s +,  +__n +, + +237 +FILE + * +__»¡riù + +__¡»am +), +fg‘s +è +__wur +; + +238 * + `__REDIRECT + ( +__fg‘s_chk_w¬n +, + +239 (* +__»¡riù + +__s +, +size_t + +__size +,  +__n +, + +240 +FILE + * +__»¡riù + +__¡»am +), +__fg‘s_chk +) + +241 +__wur + + `__w¬Ç‰r + ("fgets called with bigger sizehan†ength " + +244 +__ex‹º_®ways_šlše + +__wur + * + +245 + $fg‘s + (* +__»¡riù + +__s +,  +__n +, +FILE + *__»¡riù +__¡»am +) + +247 ià( + `__bos + ( +__s +è!ð( +size_t +) -1) + +249 ià(! + `__bužtš_cÚ¡ªt_p + ( +__n +) || __n <= 0) + +250  + `__fg‘s_chk + ( +__s +, + `__bos + (__s), +__n +, +__¡»am +); + +252 ià(( +size_t +è +__n + > + `__bos + ( +__s +)) + +253  + `__fg‘s_chk_w¬n + ( +__s +, + `__bos + (__s), +__n +, +__¡»am +); + +255  + `__fg‘s_®Ÿs + ( +__s +, +__n +, +__¡»am +); + +256 + } +} + +258 +size_t + + $__ä—d_chk + (* +__»¡riù + +__±r +, +size_t + +__±¾’ +, + +259 +size_t + +__size +, size_ˆ +__n +, + +260 +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +261 +size_t + + `__REDIRECT + ( +__ä—d_®Ÿs +, + +262 (* +__»¡riù + +__±r +, +size_t + +__size +, + +263 +size_t + +__n +, +FILE + * +__»¡riù + +__¡»am +), + +264 +ä—d +è +__wur +; + +265 +size_t + + `__REDIRECT + ( +__ä—d_chk_w¬n +, + +266 (* +__»¡riù + +__±r +, +size_t + +__±¾’ +, + +267 +size_t + +__size +, size_ˆ +__n +, + +268 +FILE + * +__»¡riù + +__¡»am +), + +269 +__ä—d_chk +) + +270 +__wur + + `__w¬Ç‰r + ("fread called with bigger size *‚membhan†ength " + +273 +__ex‹º_®ways_šlše + +__wur + +size_t + + +274 + $ä—d + (* +__»¡riù + +__±r +, +size_t + +__size +, size_ˆ +__n +, + +275 +FILE + * +__»¡riù + +__¡»am +) + +277 ià( + `__bos0 + ( +__±r +è!ð( +size_t +) -1) + +279 ià(! + `__bužtš_cÚ¡ªt_p + ( +__size +) + +280 || ! + `__bužtš_cÚ¡ªt_p + ( +__n +) + +281 || ( +__size + | +__n +è>ð((( +size_t +) 1) << (8 *  (size_t) / 2))) + +282  + `__ä—d_chk + ( +__±r +, + `__bos0 + (__±r), +__size +, +__n +, +__¡»am +); + +284 ià( +__size + * +__n + > + `__bos0 + ( +__±r +)) + +285  + `__ä—d_chk_w¬n + ( +__±r +, + `__bos0 + (__±r), +__size +, +__n +, +__¡»am +); + +287  + `__ä—d_®Ÿs + ( +__±r +, +__size +, +__n +, +__¡»am +); + +288 + } +} + +290 #ifdeà +__USE_GNU + + +291 * + $__fg‘s_uÆocked_chk + (* +__»¡riù + +__s +, +size_t + +__size +, + +292  +__n +, +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +293 * + `__REDIRECT + ( +__fg‘s_uÆocked_®Ÿs +, + +294 (* +__»¡riù + +__s +,  +__n +, + +295 +FILE + * +__»¡riù + +__¡»am +), +fg‘s_uÆocked +è +__wur +; + +296 * + `__REDIRECT + ( +__fg‘s_uÆocked_chk_w¬n +, + +297 (* +__»¡riù + +__s +, +size_t + +__size +,  +__n +, + +298 +FILE + * +__»¡riù + +__¡»am +), +__fg‘s_uÆocked_chk +) + +299 +__wur + + `__w¬Ç‰r + ("fgets_unlocked called with bigger sizehan†ength " + +302 +__ex‹º_®ways_šlše + +__wur + * + +303 + $fg‘s_uÆocked + (* +__»¡riù + +__s +,  +__n +, +FILE + *__»¡riù +__¡»am +) + +305 ià( + `__bos + ( +__s +è!ð( +size_t +) -1) + +307 ià(! + `__bužtš_cÚ¡ªt_p + ( +__n +) || __n <= 0) + +308  + `__fg‘s_uÆocked_chk + ( +__s +, + `__bos + (__s), +__n +, +__¡»am +); + +310 ià(( +size_t +è +__n + > + `__bos + ( +__s +)) + +311  + `__fg‘s_uÆocked_chk_w¬n + ( +__s +, + `__bos + (__s), +__n +, +__¡»am +); + +313  + `__fg‘s_uÆocked_®Ÿs + ( +__s +, +__n +, +__¡»am +); + +314 + } +} + +317 #ifdeà +__USE_MISC + + +318 #undeà +ä—d_uÆocked + + +319 +size_t + + $__ä—d_uÆocked_chk + (* +__»¡riù + +__±r +, +size_t + +__±¾’ +, + +320 +size_t + +__size +, size_ˆ +__n +, + +321 +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +322 +size_t + + `__REDIRECT + ( +__ä—d_uÆocked_®Ÿs +, + +323 (* +__»¡riù + +__±r +, +size_t + +__size +, + +324 +size_t + +__n +, +FILE + * +__»¡riù + +__¡»am +), + +325 +ä—d_uÆocked +è +__wur +; + +326 +size_t + + `__REDIRECT + ( +__ä—d_uÆocked_chk_w¬n +, + +327 (* +__»¡riù + +__±r +, +size_t + +__±¾’ +, + +328 +size_t + +__size +, size_ˆ +__n +, + +329 +FILE + * +__»¡riù + +__¡»am +), + +330 +__ä—d_uÆocked_chk +) + +331 +__wur + + `__w¬Ç‰r + ("fread_unlocked called with bigger size *‚membhan " + +334 +__ex‹º_®ways_šlše + +__wur + +size_t + + +335 + $ä—d_uÆocked + (* +__»¡riù + +__±r +, +size_t + +__size +, size_ˆ +__n +, + +336 +FILE + * +__»¡riù + +__¡»am +) + +338 ià( + `__bos0 + ( +__±r +è!ð( +size_t +) -1) + +340 ià(! + `__bužtš_cÚ¡ªt_p + ( +__size +) + +341 || ! + `__bužtš_cÚ¡ªt_p + ( +__n +) + +342 || ( +__size + | +__n +è>ð((( +size_t +) 1) << (8 *  (size_t) / 2))) + +343  + `__ä—d_uÆocked_chk + ( +__±r +, + `__bos0 + (__±r), +__size +, +__n +, + +344 +__¡»am +); + +346 ià( +__size + * +__n + > + `__bos0 + ( +__±r +)) + +347  + `__ä—d_uÆocked_chk_w¬n + ( +__±r +, + `__bos0 + (__±r), +__size +, +__n +, + +348 +__¡»am +); + +351 #ifdeà +__USE_EXTERN_INLINES + + +352 ià( + `__bužtš_cÚ¡ªt_p + ( +__size +) + +353 && + `__bužtš_cÚ¡ªt_p + ( +__n +) + +354 && ( +__size + | +__n +è< ((( +size_t +) 1) << (8 *  (size_t) / 2)) + +355 && +__size + * +__n + <= 8) + +357 +size_t + +__út + = +__size + * +__n +; + +358 * +__ýŒ + = (*è +__±r +; + +359 ià( +__út + == 0) + +362 ; +__út + > 0; --__cnt) + +364  +__c + = + `_IO_g‘c_uÆocked + ( +__¡»am +); + +365 ià( +__c + =ð +EOF +) + +367 * +__ýŒ +++ = +__c +; + +369  ( +__ýŒ + - (*è +__±r +è/ +__size +; + +372  + `__ä—d_uÆocked_®Ÿs + ( +__±r +, +__size +, +__n +, +__¡»am +); + +373 + } +} + + @/usr/include/bits/stdio_lim.h + +19 #ià! +defšed + +_STDIO_H + && !defšed +__Ãed_FOPEN_MAX + && !defšed +__Ãed_IOV_MAX + + +23 #ifdeà +_STDIO_H + + +24  + #L_tm²am + 20 + + ) + +25  + #TMP_MAX + 238328 + + ) + +26  + #FILENAME_MAX + 4096 + + ) + +28 #ifdeà +__USE_POSIX + + +29  + #L_ù”mid + 9 + + ) + +30 #ià! +defšed + +__USE_XOPEN2K + || defšed +__USE_GNU + + +31  + #L_cu£rid + 9 + + ) + +36 #ià +defšed + +__Ãed_FOPEN_MAX + || defšed +_STDIO_H + + +37 #undeà +FOPEN_MAX + + +38  + #FOPEN_MAX + 16 + + ) + +41 #ià +defšed + +__Ãed_IOV_MAX + && !defšed +IOV_MAX + + +42  + #IOV_MAX + 1024 + + ) + + @/usr/include/bits/sys_errlist.h + +20 #iâdeà +_STDIO_H + + +26 #ifdeà +__USE_BSD + + +27  +sys_ü +; + +28 +__cÚ¡ + *__cÚ¡ +sys_”¾i¡ +[]; + +30 #ifdeà +__USE_GNU + + +31  +_sys_ü +; + +32 +__cÚ¡ + *__cÚ¡ +_sys_”¾i¡ +[]; + + @/usr/include/bits/types.h + +24 #iâdef +_BITS_TYPES_H + + +25  + #_BITS_TYPES_H + 1 + + ) + +27  + ~<ã©u»s.h +> + +28  + ~ + +31  + t__u_ch¬ +; + +32  + t__u_shÜt +; + +33  + t__u_št +; + +34  + t__u_lÚg +; + +37 sigÃd  + t__št8_t +; + +38  + t__ušt8_t +; + +39 sigÃd  + t__št16_t +; + +40  + t__ušt16_t +; + +41 sigÃd  + t__št32_t +; + +42  + t__ušt32_t +; + +43 #ià +__WORDSIZE + == 64 + +44 sigÃd  + t__št64_t +; + +45  + t__ušt64_t +; + +46 #–ià +defšed + +__GLIBC_HAVE_LONG_LONG + + +47 +__ex‹nsiÚ__ + sigÃd  + t__št64_t +; + +48 +__ex‹nsiÚ__ +  + t__ušt64_t +; + +52 #ià +__WORDSIZE + == 64 + +53  + t__quad_t +; + +54  + t__u_quad_t +; + +55 #–ià +defšed + +__GLIBC_HAVE_LONG_LONG + + +56 +__ex‹nsiÚ__ +  + t__quad_t +; + +57 +__ex‹nsiÚ__ +  + t__u_quad_t +; + +61  + m__v® +[2]; + +62 } + t__quad_t +; + +65 +__u_lÚg + + m__v® +[2]; + +66 } + t__u_quad_t +; + +99  + #__S16_TYPE +  + + ) + +100  + #__U16_TYPE +  + + ) + +101  + #__S32_TYPE +  + + ) + +102  + #__U32_TYPE +  + + ) + +103  + #__SLONGWORD_TYPE +  + + ) + +104  + #__ULONGWORD_TYPE +  + + ) + +105 #ià +__WORDSIZE + == 32 + +106  + #__SQUAD_TYPE + +__quad_t + + + ) + +107  + #__UQUAD_TYPE + +__u_quad_t + + + ) + +108  + #__SWORD_TYPE +  + + ) + +109  + #__UWORD_TYPE +  + + ) + +110  + #__SLONG32_TYPE +  + + ) + +111  + #__ULONG32_TYPE +  + + ) + +112  + #__S64_TYPE + +__quad_t + + + ) + +113  + #__U64_TYPE + +__u_quad_t + + + ) + +116  + #__STD_TYPE + +__ex‹nsiÚ__ +  + + ) + +117 #–ià +__WORDSIZE + == 64 + +118  + t__SQUAD_TYPE +  + + ) + +119  + t__UQUAD_TYPE +  + + ) + +120  + t__SWORD_TYPE +  + + ) + +121  + t__UWORD_TYPE +  + + ) + +122  + t__SLONG32_TYPE +  + + ) + +123  + t__ULONG32_TYPE +  + + ) + +124  + t__S64_TYPE +  + + ) + +125  + t__U64_TYPE +  + + ) + +127  + t__STD_TYPE +  + + ) + +131  + ~ + +134 +__STD_TYPE + + t__DEV_T_TYPE + + t__dev_t +; + +135 +__STD_TYPE + +__UID_T_TYPE + + g__uid_t +; + +136 +__STD_TYPE + +__GID_T_TYPE + + g__gid_t +; + +137 +__STD_TYPE + +__INO_T_TYPE + + g__šo_t +; + +138 +__STD_TYPE + +__INO64_T_TYPE + + g__šo64_t +; + +139 +__STD_TYPE + +__MODE_T_TYPE + + g__mode_t +; + +140 +__STD_TYPE + +__NLINK_T_TYPE + + g__Æšk_t +; + +141 +__STD_TYPE + +__OFF_T_TYPE + + g__off_t +; + +142 +__STD_TYPE + +__OFF64_T_TYPE + + g__off64_t +; + +143 +__STD_TYPE + +__PID_T_TYPE + + g__pid_t +; + +144 +__STD_TYPE + +__FSID_T_TYPE + + g__fsid_t +; + +145 +__STD_TYPE + +__CLOCK_T_TYPE + + g__þock_t +; + +146 +__STD_TYPE + +__RLIM_T_TYPE + + g__¾im_t +; + +147 +__STD_TYPE + +__RLIM64_T_TYPE + + g__¾im64_t +; + +148 +__STD_TYPE + +__ID_T_TYPE + + g__id_t +; + +149 +__STD_TYPE + +__TIME_T_TYPE + + g__time_t +; + +150 +__STD_TYPE + +__USECONDS_T_TYPE + + g__u£cÚds_t +; + +151 +__STD_TYPE + +__SUSECONDS_T_TYPE + + g__su£cÚds_t +; + +153 +__STD_TYPE + +__DADDR_T_TYPE + + g__daddr_t +; + +154 +__STD_TYPE + +__SWBLK_T_TYPE + + g__swblk_t +; + +155 +__STD_TYPE + +__KEY_T_TYPE + + g__key_t +; + +158 +__STD_TYPE + +__CLOCKID_T_TYPE + + g__þockid_t +; + +161 +__STD_TYPE + +__TIMER_T_TYPE + + g__tim”_t +; + +164 +__STD_TYPE + +__BLKSIZE_T_TYPE + + g__blksize_t +; + +169 +__STD_TYPE + +__BLKCNT_T_TYPE + + g__blkút_t +; + +170 +__STD_TYPE + +__BLKCNT64_T_TYPE + + g__blkút64_t +; + +173 +__STD_TYPE + +__FSBLKCNT_T_TYPE + + g__fsblkút_t +; + +174 +__STD_TYPE + +__FSBLKCNT64_T_TYPE + + g__fsblkút64_t +; + +177 +__STD_TYPE + +__FSFILCNT_T_TYPE + + g__fsfžút_t +; + +178 +__STD_TYPE + +__FSFILCNT64_T_TYPE + + g__fsfžút64_t +; + +180 +__STD_TYPE + +__SSIZE_T_TYPE + + g__ssize_t +; + +184  +__off64_t + + t__loff_t +; + +185  +__quad_t + * + t__qaddr_t +; + +186 * + t__ÿddr_t +; + +189 +__STD_TYPE + +__SWORD_TYPE + + g__šŒ_t +; + +192 +__STD_TYPE + +__U32_TYPE + + g__sockËn_t +; + +195 #undeà +__STD_TYPE + + + @/usr/include/features.h + +19 #iâdef +_FEATURES_H + + +20  + #_FEATURES_H + 1 + + ) + +95 #undeà +__USE_ISOC99 + + +96 #undeà +__USE_ISOC95 + + +97 #undeà +__USE_POSIX + + +98 #undeà +__USE_POSIX2 + + +99 #undeà +__USE_POSIX199309 + + +100 #undeà +__USE_POSIX199506 + + +101 #undeà +__USE_XOPEN + + +102 #undeà +__USE_XOPEN_EXTENDED + + +103 #undeà +__USE_UNIX98 + + +104 #undeà +__USE_XOPEN2K + + +105 #undeà +__USE_XOPEN2K8 + + +106 #undeà +__USE_LARGEFILE + + +107 #undeà +__USE_LARGEFILE64 + + +108 #undeà +__USE_FILE_OFFSET64 + + +109 #undeà +__USE_BSD + + +110 #undeà +__USE_SVID + + +111 #undeà +__USE_MISC + + +112 #undeà +__USE_ATFILE + + +113 #undeà +__USE_GNU + + +114 #undeà +__USE_REENTRANT + + +115 #undeà +__USE_FORTIFY_LEVEL + + +116 #undeà +__FAVOR_BSD + + +117 #undeà +__KERNEL_STRICT_NAMES + + +121 #iâdeà +_LOOSE_KERNEL_NAMES + + +122  + #__KERNEL_STRICT_NAMES + + + ) + +126  + #__USE_ANSI + 1 + + ) + +135 #ià +defšed + +__GNUC__ + && defšed +__GNUC_MINOR__ + + +136  + #__GNUC_PREREQ +( +maj +, +mš +) \ + +137 (( +__GNUC__ + << 16è+ +__GNUC_MINOR__ + >ð(( +maj +è<< 16è+ ( +mš +)) + + ) + +139  + #__GNUC_PREREQ +( +maj +, +mš +è0 + + ) + +144 #ià +defšed + +_BSD_SOURCE + && \ + +145 !( +defšed + + g_POSIX_SOURCE + || defšed + g_POSIX_C_SOURCE + || \ + +146 +defšed + + g_XOPEN_SOURCE + || defšed + g_XOPEN_SOURCE_EXTENDED + || \ + +147 +defšed + + g_GNU_SOURCE + || defšed + g_SVID_SOURCE +) + +148  + #__FAVOR_BSD + 1 + + ) + +152 #ifdeà +_GNU_SOURCE + + +153 #undeà +_ISOC99_SOURCE + + +154  + #_ISOC99_SOURCE + 1 + + ) + +155 #undeà +_POSIX_SOURCE + + +156  + #_POSIX_SOURCE + 1 + + ) + +157 #undeà +_POSIX_C_SOURCE + + +158  + #_POSIX_C_SOURCE + 200809L + + ) + +159 #undeà +_XOPEN_SOURCE + + +160  + #_XOPEN_SOURCE + 700 + + ) + +161 #undeà +_XOPEN_SOURCE_EXTENDED + + +162  + #_XOPEN_SOURCE_EXTENDED + 1 + + ) + +163 #undeà +_LARGEFILE64_SOURCE + + +164  + #_LARGEFILE64_SOURCE + 1 + + ) + +165 #undeà +_BSD_SOURCE + + +166  + #_BSD_SOURCE + 1 + + ) + +167 #undeà +_SVID_SOURCE + + +168  + #_SVID_SOURCE + 1 + + ) + +169 #undeà +_ATFILE_SOURCE + + +170  + #_ATFILE_SOURCE + 1 + + ) + +175 #ià(! +defšed + +__STRICT_ANSI__ + && !defšed +_ISOC99_SOURCE + && \ + +176 ! +defšed + + g_POSIX_SOURCE + && !defšed + g_POSIX_C_SOURCE + && \ + +177 ! +defšed + + g_XOPEN_SOURCE + && !defšed + g_XOPEN_SOURCE_EXTENDED + && \ + +178 ! +defšed + + g_BSD_SOURCE + && !defšed + g_SVID_SOURCE +) + +179  + #_BSD_SOURCE + 1 + + ) + +180  + #_SVID_SOURCE + 1 + + ) + +187 #ià( +defšed + +_ISOC99_SOURCE + || defšed +_ISOC9X_SOURCE + \ + +188 || ( +defšed + + g__STDC_VERSION__ + && __STDC_VERSION__ >= 199901L)) + +189  + #__USE_ISOC99 + 1 + + ) + +193 #ià( +defšed + +_ISOC99_SOURCE + || defšed +_ISOC9X_SOURCE + \ + +194 || ( +defšed + +__STDC_VERSION__ + && __STDC_VERSION__ >= 199409L)) + +195  + #__USE_ISOC95 + 1 + + ) + +200 #ià((! +defšed + +__STRICT_ANSI__ + || ( +_XOPEN_SOURCE + - 0) >= 500) && \ + +201 ! +defšed + +_POSIX_SOURCE + && !defšed +_POSIX_C_SOURCE +) + +202  + #_POSIX_SOURCE + 1 + + ) + +203 #ià +defšed + +_XOPEN_SOURCE + && (_XOPEN_SOURCE - 0) < 500 + +204  + #_POSIX_C_SOURCE + 2 + + ) + +205 #–ià +defšed + +_XOPEN_SOURCE + && (_XOPEN_SOURCE - 0) < 600 + +206  + #_POSIX_C_SOURCE + 199506L + + ) + +207 #–ià +defšed + +_XOPEN_SOURCE + && (_XOPEN_SOURCE - 0) < 700 + +208  + #_POSIX_C_SOURCE + 200112L + + ) + +210  + #_POSIX_C_SOURCE + 200809L + + ) + +212  + #__USE_POSIX_IMPLICITLY + 1 + + ) + +215 #ià +defšed + +_POSIX_SOURCE + || +_POSIX_C_SOURCE + >ð1 || defšed +_XOPEN_SOURCE + + +216  + #__USE_POSIX + 1 + + ) + +219 #ià +defšed + +_POSIX_C_SOURCE + && _POSIX_C_SOURCE >ð2 || defšed +_XOPEN_SOURCE + + +220  + #__USE_POSIX2 + 1 + + ) + +223 #ià( +_POSIX_C_SOURCE + - 0) >= 199309L + +224  + #__USE_POSIX199309 + 1 + + ) + +227 #ià( +_POSIX_C_SOURCE + - 0) >= 199506L + +228  + #__USE_POSIX199506 + 1 + + ) + +231 #ià( +_POSIX_C_SOURCE + - 0) >= 200112L + +232  + #__USE_XOPEN2K + 1 + + ) + +233 #undeà +__USE_ISOC99 + + +234  + #__USE_ISOC99 + 1 + + ) + +237 #ià( +_POSIX_C_SOURCE + - 0) >= 200809L + +238  + #__USE_XOPEN2K8 + 1 + + ) + +239 #undeà +_ATFILE_SOURCE + + +240  + #_ATFILE_SOURCE + 1 + + ) + +243 #ifdef +_XOPEN_SOURCE + + +244  + #__USE_XOPEN + 1 + + ) + +245 #ià( +_XOPEN_SOURCE + - 0) >= 500 + +246  + #__USE_XOPEN_EXTENDED + 1 + + ) + +247  + #__USE_UNIX98 + 1 + + ) + +248 #undeà +_LARGEFILE_SOURCE + + +249  + #_LARGEFILE_SOURCE + 1 + + ) + +250 #ià( +_XOPEN_SOURCE + - 0) >= 600 + +251 #ià( +_XOPEN_SOURCE + - 0) >= 700 + +252  + #__USE_XOPEN2K8 + 1 + + ) + +254  + #__USE_XOPEN2K + 1 + + ) + +255 #undeà +__USE_ISOC99 + + +256  + #__USE_ISOC99 + 1 + + ) + +259 #ifdeà +_XOPEN_SOURCE_EXTENDED + + +260  + #__USE_XOPEN_EXTENDED + 1 + + ) + +265 #ifdeà +_LARGEFILE_SOURCE + + +266  + #__USE_LARGEFILE + 1 + + ) + +269 #ifdeà +_LARGEFILE64_SOURCE + + +270  + #__USE_LARGEFILE64 + 1 + + ) + +273 #ià +defšed + +_FILE_OFFSET_BITS + && _FILE_OFFSET_BITS == 64 + +274  + #__USE_FILE_OFFSET64 + 1 + + ) + +277 #ià +defšed + +_BSD_SOURCE + || defšed +_SVID_SOURCE + + +278  + #__USE_MISC + 1 + + ) + +281 #ifdef +_BSD_SOURCE + + +282  + #__USE_BSD + 1 + + ) + +285 #ifdef +_SVID_SOURCE + + +286  + #__USE_SVID + 1 + + ) + +289 #ifdef +_ATFILE_SOURCE + + +290  + #__USE_ATFILE + 1 + + ) + +293 #ifdef +_GNU_SOURCE + + +294  + #__USE_GNU + 1 + + ) + +297 #ià +defšed + +_REENTRANT + || defšed +_THREAD_SAFE + + +298  + #__USE_REENTRANT + 1 + + ) + +301 #ià +defšed + +_FORTIFY_SOURCE + && _FORTIFY_SOURCE > 0 \ + +302 && +__GNUC_PREREQ + (4, 1è&& +defšed + + g__OPTIMIZE__ + && __OPTIMIZE__ > 0 + +303 #ià +_FORTIFY_SOURCE + > 1 + +304  + #__USE_FORTIFY_LEVEL + 2 + + ) + +306  + #__USE_FORTIFY_LEVEL + 1 + + ) + +309  + #__USE_FORTIFY_LEVEL + 0 + + ) + +313  + ~ + +316  + #__STDC_ISO_10646__ + 200009L + + ) + +324 #undeà +__GNU_LIBRARY__ + + +325  + #__GNU_LIBRARY__ + 6 + + ) + +329  + #__GLIBC__ + 2 + + ) + +330  + #__GLIBC_MINOR__ + 11 + + ) + +332  + #__GLIBC_PREREQ +( +maj +, +mš +) \ + +333 (( +__GLIBC__ + << 16è+ +__GLIBC_MINOR__ + >ð(( +maj +è<< 16è+ ( +mš +)) + + ) + +336 #ià +defšed + +__GNUC__ + \ + +337 || ( +defšed + + g__PGI + && defšed + g__i386__ + ) \ + +338 || ( +defšed + + g__INTEL_COMPILER + && (defšed + g__i386__ + || defšed + g__Ÿ64__ +)) \ + +339 || ( +defšed + + g__STDC_VERSION__ + && __STDC_VERSION__ >= 199901L) + +340  + #__GLIBC_HAVE_LONG_LONG + 1 + + ) + +344 #iâdeà +__ASSEMBLER__ + + +345 #iâdeà +_SYS_CDEFS_H + + +346  + ~ + +351 #ià +defšed + +__USE_FILE_OFFSET64 + && !defšed +__REDIRECT + + +352  + #__USE_LARGEFILE + 1 + + ) + +353  + #__USE_LARGEFILE64 + 1 + + ) + +359 #ià +__GNUC_PREREQ + (2, 7è&& +defšed + +__OPTIMIZE__ + \ + +360 && ! +defšed + + g__OPTIMIZE_SIZE__ + && !defšed + g__NO_INLINE__ + \ + +361 && +defšed + + g__ex‹º_šlše + + +362  + #__USE_EXTERN_INLINES + 1 + + ) + +367 #ià +__GNUC_PREREQ + (2, 7è&& +defšed + +__OPTIMIZE__ + \ + +368 && ( +defšed + + g_LIBC + || !defšed + g__OPTIMIZE_SIZE__ +è&& !defšed + g__NO_INLINE__ + \ + +369 && +defšed + + g__ex‹º_šlše + + +370  + #__USE_EXTERN_INLINES_IN_LIBC + 1 + + ) + +378  + ~ + + @/usr/include/getopt.h + +21 #iâdeà +_GETOPT_H + + +23 #iâdeà +__Ãed_g‘Ýt + + +24  + #_GETOPT_H + 1 + + ) + +34 #ià! +defšed + +__GNU_LIBRARY__ + + +35  + ~<ùy³.h +> + +38 #iâdeà +__THROW + + +39 #iâdeà +__GNUC_PREREQ + + +40  + #__GNUC_PREREQ +( +maj +, +mš +è(0) + + ) + +42 #ià +defšed + +__ýlu¥lus + && +__GNUC_PREREQ + (2,8) + +43  + #__THROW + + `throw + () + + ) + +45  + #__THROW + + + ) + +49 #ifdef +__ýlu¥lus + + +59 * +Ýrg +; + +73  +Ýtšd +; + +78  +Ý‹¼ +; + +82  +ÝtÝt +; + +84 #iâdeà +__Ãed_g‘Ýt + + +106  + sÝtiÚ + + +108 cÚ¡ * + gÇme +; + +111  + ghas_¬g +; + +112 * + gæag +; + +113  + gv® +; + +118  + #no_¬gum’t + 0 + + ) + +119  + #»quœed_¬gum’t + 1 + + ) + +120  + #ÝtiÚ®_¬gum’t + 2 + + ) + +148 #ifdeà +__GNU_LIBRARY__ + + +152  +g‘Ýt + ( +___¬gc +, *cÚ¡ * +___¬gv +, cÚ¡ * +__shÜtÝts +) + +153 +__THROW +; + +155 #ià +defšed + +__Ãed_g‘Ýt + && defšed +__USE_POSIX2 + \ + +156 && ! +defšed + + g__USE_POSIX_IMPLICITLY + && !defšed + g__USE_GNU + + +160 #ifdeà +__REDIRECT + + +161  +__REDIRECT + ( +g‘Ýt +, ( +___¬gc +, *cÚ¡ * +___¬gv +, + +162 cÚ¡ * +__shÜtÝts +), + +163 +__posix_g‘Ýt +è +__THROW +; + +165  +__posix_g‘Ýt + ( +___¬gc +, *cÚ¡ * +___¬gv +, + +166 cÚ¡ * +__shÜtÝts +è +__THROW +; + +167  + #g‘Ýt + +__posix_g‘Ýt + + + ) + +171  +g‘Ýt + (); + +174 #iâdeà +__Ãed_g‘Ýt + + +175  +g‘Ýt_lÚg + ( +___¬gc +, *cÚ¡ * +___¬gv +, + +176 cÚ¡ * +__shÜtÝts +, + +177 cÚ¡  +ÝtiÚ + * +__lÚgÝts +, * +__lÚgšd +) + +178 +__THROW +; + +179  +g‘Ýt_lÚg_Úly + ( +___¬gc +, *cÚ¡ * +___¬gv +, + +180 cÚ¡ * +__shÜtÝts +, + +181 cÚ¡  +ÝtiÚ + * +__lÚgÝts +, * +__lÚgšd +) + +182 +__THROW +; + +186 #ifdef +__ýlu¥lus + + +191 #undeà +__Ãed_g‘Ýt + + + @/usr/include/libio.h + +29 #iâdeà +_IO_STDIO_H + + +30  + #_IO_STDIO_H + + + ) + +32  + ~<_G_cÚfig.h +> + +34  + #_IO_pos_t + +_G_åos_t + + + ) + +35  + #_IO_åos_t + +_G_åos_t + + + ) + +36  + #_IO_åos64_t + +_G_åos64_t + + + ) + +37  + #_IO_size_t + +_G_size_t + + + ) + +38  + #_IO_ssize_t + +_G_ssize_t + + + ) + +39  + #_IO_off_t + +_G_off_t + + + ) + +40  + #_IO_off64_t + +_G_off64_t + + + ) + +41  + #_IO_pid_t + +_G_pid_t + + + ) + +42  + #_IO_uid_t + +_G_uid_t + + + ) + +43  + #_IO_icÚv_t + +_G_icÚv_t + + + ) + +44  + #_IO_HAVE_SYS_WAIT + +_G_HAVE_SYS_WAIT + + + ) + +45  + #_IO_HAVE_ST_BLKSIZE + +_G_HAVE_ST_BLKSIZE + + + ) + +46  + #_IO_BUFSIZ + +_G_BUFSIZ + + + ) + +47  + #_IO_va_li¡ + +_G_va_li¡ + + + ) + +48  + #_IO_wšt_t + +_G_wšt_t + + + ) + +50 #ifdeà +_G_NEED_STDARG_H + + +52  + #__Ãed___va_li¡ + + + ) + +53  + ~<¡d¬g.h +> + +54 #ifdeà +__GNUC_VA_LIST + + +55 #undeà +_IO_va_li¡ + + +56  + #_IO_va_li¡ + +__gnuc_va_li¡ + + + ) + +60 #iâdeà +__P + + +61 #ià +_G_HAVE_SYS_CDEFS + + +62  + ~ + +64 #ifdeà +__STDC__ + + +65  + #__P +( +p +è + ) +p + +66  + #__PMT +( +p +è + ) +p + +68  + #__P +( +p +è() + + ) + +69  + #__PMT +( +p +è() + + ) + +75 #iâdeà +_PARAMS + + +76  + #_PARAMS +( +´Ùos +è + `__P +ÕrÙos) + + ) + +79 #iâdeà +__STDC__ + + +81 cÚ¡ + + ) + +84  + #_IO_UNIFIED_JUMPTABLES + 1 + + ) + +85 #iâdeà +_G_HAVE_PRINTF_FP + + +86  + #_IO_USE_DTOA + 1 + + ) + +89 #iâdeà +EOF + + +90  + #EOF + (-1) + + ) + +92 #iâdeà +NULL + + +93 #ià +defšed + +__GNUG__ + && \ + +94 ( + g__GNUC__ + > 2 || (__GNUC__ =ð2 && +__GNUC_MINOR__ + >= 8)) + +95  + #NULL + ( +__nuÎ +) + + ) + +97 #ià! +defšed +( +__ýlu¥lus +) + +98  + #NULL + ((*)0) + + ) + +100  + #NULL + (0) + + ) + +105  + #_IOS_INPUT + 1 + + ) + +106  + #_IOS_OUTPUT + 2 + + ) + +107  + #_IOS_ATEND + 4 + + ) + +108  + #_IOS_APPEND + 8 + + ) + +109  + #_IOS_TRUNC + 16 + + ) + +110  + #_IOS_NOCREATE + 32 + + ) + +111  + #_IOS_NOREPLACE + 64 + + ) + +112  + #_IOS_BIN + 128 + + ) + +120  + #_IO_MAGIC + 0xFBAD0000 + + ) + +121  + #_OLD_STDIO_MAGIC + 0xFABC0000 + + ) + +122  + #_IO_MAGIC_MASK + 0xFFFF0000 + + ) + +123  + #_IO_USER_BUF + 1 + + ) + +124  + #_IO_UNBUFFERED + 2 + + ) + +125  + #_IO_NO_READS + 4 + + ) + +126  + #_IO_NO_WRITES + 8 + + ) + +127  + #_IO_EOF_SEEN + 0x10 + + ) + +128  + #_IO_ERR_SEEN + 0x20 + + ) + +129  + #_IO_DELETE_DONT_CLOSE + 0x40 + + ) + +130  + #_IO_LINKED + 0x80 + + ) + +131  + #_IO_IN_BACKUP + 0x100 + + ) + +132  + #_IO_LINE_BUF + 0x200 + + ) + +133  + #_IO_TIED_PUT_GET + 0x400 + + ) + +134  + #_IO_CURRENTLY_PUTTING + 0x800 + + ) + +135  + #_IO_IS_APPENDING + 0x1000 + + ) + +136  + #_IO_IS_FILEBUF + 0x2000 + + ) + +137  + #_IO_BAD_SEEN + 0x4000 + + ) + +138  + #_IO_USER_LOCK + 0x8000 + + ) + +140  + #_IO_FLAGS2_MMAP + 1 + + ) + +141  + #_IO_FLAGS2_NOTCANCEL + 2 + + ) + +142 #ifdeà +_LIBC + + +143  + #_IO_FLAGS2_FORTIFY + 4 + + ) + +145  + #_IO_FLAGS2_USER_WBUF + 8 + + ) + +146 #ifdeà +_LIBC + + +147  + #_IO_FLAGS2_SCANF_STD + 16 + + ) + +151  + #_IO_SKIPWS + 01 + + ) + +152  + #_IO_LEFT + 02 + + ) + +153  + #_IO_RIGHT + 04 + + ) + +154  + #_IO_INTERNAL + 010 + + ) + +155  + #_IO_DEC + 020 + + ) + +156  + #_IO_OCT + 040 + + ) + +157  + #_IO_HEX + 0100 + + ) + +158  + #_IO_SHOWBASE + 0200 + + ) + +159  + #_IO_SHOWPOINT + 0400 + + ) + +160  + #_IO_UPPERCASE + 01000 + + ) + +161  + #_IO_SHOWPOS + 02000 + + ) + +162  + #_IO_SCIENTIFIC + 04000 + + ) + +163  + #_IO_FIXED + 010000 + + ) + +164  + #_IO_UNITBUF + 020000 + + ) + +165  + #_IO_STDIO + 040000 + + ) + +166  + #_IO_DONT_CLOSE + 0100000 + + ) + +167  + #_IO_BOOLALPHA + 0200000 + + ) + +170  +_IO_jump_t +;  + g_IO_FILE +; + +173 #ifdeà +_IO_MTSAFE_IO + + +174 #ià +defšed + +__GLIBC__ + && __GLIBC__ >= 2 + +175  + ~ + +180  + t_IO_lock_t +; + +186  + s_IO_m¬k” + { + +187  +_IO_m¬k” + * + m_Ãxt +; + +188  +_IO_FILE + * + m_sbuf +; + +192  + m_pos +; + +194  +£t_¡»ampos +( +¡»ampos + +¥ +è{ + m_¥os + = sp; } + +195  +£t_off£t +( +off£t +è{ + m_pos + = off£t; + m_¥os + = ( +¡»ampos +)(-2); } + +196 + mpublic +: + +197 +¡»amm¬k” +( +¡»ambuf + * +sb +); + +198 ~ +¡»amm¬k” +(); + +199  +§všg +(è{  + m_¥os + == -2; } + +200  +d– +( +¡»amm¬k” +&); + +201  +d– +(); + +206 + e__codecvt_»suÉ + + +208 + m__codecvt_ok +, + +209 + m__codecvt_·¹Ÿl +, + +210 + m__codecvt_”rÜ +, + +211 + m__codecvt_nocÚv + + +214 #ià +defšed + +_LIBC + || defšed +_GLIBCPP_USE_WCHAR_T + + +217  + s_IO_codecvt + + +219 (* + m__codecvt_de¡r +è( + m_IO_codecvt + *); + +220 +__codecvt_»suÉ + (* +__codecvt_do_out +è( + m_IO_codecvt + *, + +221 + m__mb¡©e_t + *, + +222 cÚ¡ + mwch¬_t + *, + +223 cÚ¡ + mwch¬_t + *, + +224 cÚ¡ + mwch¬_t + **, *, + +226 +__codecvt_»suÉ + (* +__codecvt_do_unshiá +è( + m_IO_codecvt + *, + +227 + m__mb¡©e_t + *, *, + +229 +__codecvt_»suÉ + (* +__codecvt_do_š +è( + m_IO_codecvt + *, + +230 + m__mb¡©e_t + *, + +232 cÚ¡ **, + mwch¬_t + *, + +233 + mwch¬_t + *, wchar_t **); + +234 (* + m__codecvt_do_’codšg +è( + m_IO_codecvt + *); + +235 (* + m__codecvt_do_®ways_nocÚv +è( + m_IO_codecvt + *); + +236 (* + m__codecvt_do_Ëngth +è( + m_IO_codecvt + *, + m__mb¡©e_t + *, + +237 cÚ¡ *, cÚ¡ *, + m_IO_size_t +); + +238 (* + m__codecvt_do_max_Ëngth +è( + m_IO_codecvt + *); + +240 +_IO_icÚv_t + + m__cd_š +; + +241 +_IO_icÚv_t + + m__cd_out +; + +245  + s_IO_wide_d©a + + +247 +wch¬_t + * + m_IO_»ad_±r +; + +248 +wch¬_t + * + m_IO_»ad_’d +; + +249 +wch¬_t + * + m_IO_»ad_ba£ +; + +250 +wch¬_t + * + m_IO_wr™e_ba£ +; + +251 +wch¬_t + * + m_IO_wr™e_±r +; + +252 +wch¬_t + * + m_IO_wr™e_’d +; + +253 +wch¬_t + * + m_IO_buf_ba£ +; + +254 +wch¬_t + * + m_IO_buf_’d +; + +256 +wch¬_t + * + m_IO_§ve_ba£ +; + +257 +wch¬_t + * + m_IO_backup_ba£ +; + +259 +wch¬_t + * + m_IO_§ve_’d +; + +261 +__mb¡©e_t + + m_IO_¡©e +; + +262 +__mb¡©e_t + + m_IO_Ï¡_¡©e +; + +263  +_IO_codecvt + + m_codecvt +; + +265 +wch¬_t + + m_shÜtbuf +[1]; + +267 cÚ¡  +_IO_jump_t + * + m_wide_vbË +; + +271  + s_IO_FILE + { + +272  + m_æags +; + +273  + #_IO_fže_æags + +_æags + + + ) + +277 * + m_IO_»ad_±r +; + +278 * + m_IO_»ad_’d +; + +279 * + m_IO_»ad_ba£ +; + +280 * + m_IO_wr™e_ba£ +; + +281 * + m_IO_wr™e_±r +; + +282 * + m_IO_wr™e_’d +; + +283 * + m_IO_buf_ba£ +; + +284 * + m_IO_buf_’d +; + +286 * + m_IO_§ve_ba£ +; + +287 * + m_IO_backup_ba£ +; + +288 * + m_IO_§ve_’d +; + +290  +_IO_m¬k” + * + m_m¬k”s +; + +292  +_IO_FILE + * + m_chaš +; + +294  + m_fž’o +; + +296  + m_blksize +; + +298  + m_æags2 +; + +300 +_IO_off_t + + m_Þd_off£t +; + +302  + #__HAVE_COLUMN + + + ) + +304  + m_cur_cÞumn +; + +305 sigÃd  + m_vbË_off£t +; + +306  + m_shÜtbuf +[1]; + +310 +_IO_lock_t + * + m_lock +; + +311 #ifdeà +_IO_USE_OLD_IO_FILE + + +314  + s_IO_FILE_com¶‘e + + +316  +_IO_FILE + + m_fže +; + +318 #ià +defšed + +_G_IO_IO_FILE_VERSION + && _G_IO_IO_FILE_VERSION == 0x20001 + +319 +_IO_off64_t + + m_off£t +; + +320 #ià +defšed + +_LIBC + || defšed +_GLIBCPP_USE_WCHAR_T + + +322  +_IO_codecvt + * + m_codecvt +; + +323  +_IO_wide_d©a + * + m_wide_d©a +; + +324  +_IO_FILE + * + m_ä“»s_li¡ +; + +325 * + m_ä“»s_buf +; + +326 +size_t + + m_ä“»s_size +; + +328 * + m__·d1 +; + +329 * + m__·d2 +; + +330 * + m__·d3 +; + +331 * + m__·d4 +; + +332 +size_t + + m__·d5 +; + +334  + m_mode +; + +336  + m_unu£d2 +[15 *  (è- 4 *  (*è-  ( +size_t +)]; + +340 #iâdeà +__ýlu¥lus + + +341  +_IO_FILE + + t_IO_FILE +; + +344  + g_IO_FILE_¶us +; + +346  +_IO_FILE_¶us + +_IO_2_1_¡dš_ +; + +347  +_IO_FILE_¶us + +_IO_2_1_¡dout_ +; + +348  +_IO_FILE_¶us + +_IO_2_1_¡d”r_ +; + +349 #iâdeà +_LIBC + + +350  + #_IO_¡dš + (( +_IO_FILE +*)(& +_IO_2_1_¡dš_ +)) + + ) + +351  + #_IO_¡dout + (( +_IO_FILE +*)(& +_IO_2_1_¡dout_ +)) + + ) + +352  + #_IO_¡d”r + (( +_IO_FILE +*)(& +_IO_2_1_¡d”r_ +)) + + ) + +354 +_IO_FILE + * +_IO_¡dš + +©Œibu‹_hidd’ +; + +355 +_IO_FILE + * +_IO_¡dout + +©Œibu‹_hidd’ +; + +356 +_IO_FILE + * +_IO_¡d”r + +©Œibu‹_hidd’ +; + +364  +__ssize_t + + t__io_»ad_â + (* + t__cook› +, * + t__buf +, + tsize_t + + t__nby‹s +); + +372  +__ssize_t + + t__io_wr™e_â + (* + t__cook› +, + t__cÚ¡ + * + t__buf +, + +373 + tsize_t + + t__n +); + +381  + t__io_£ek_â + (* + t__cook› +, + t_IO_off64_t + * + t__pos +,  + t__w +); + +384  + t__io_þo£_â + (* + t__cook› +); + +387 #ifdeà +_GNU_SOURCE + + +389  +__io_»ad_â + + tcook›_»ad_funùiÚ_t +; + +390  +__io_wr™e_â + + tcook›_wr™e_funùiÚ_t +; + +391  +__io_£ek_â + + tcook›_£ek_funùiÚ_t +; + +392  +__io_þo£_â + + tcook›_þo£_funùiÚ_t +; + +397 +__io_»ad_â + * + m»ad +; + +398 +__io_wr™e_â + * + mwr™e +; + +399 +__io_£ek_â + * + m£ek +; + +400 +__io_þo£_â + * + mþo£ +; + +401 } + t_IO_cook›_io_funùiÚs_t +; + +402  +_IO_cook›_io_funùiÚs_t + + tcook›_io_funùiÚs_t +; + +404  + g_IO_cook›_fže +; + +407  +_IO_cook›_š™ + ( +_IO_cook›_fže + * +__cfže +,  +__»ad_wr™e +, + +408 * +__cook› +, +_IO_cook›_io_funùiÚs_t + +__âs +); + +412 #ifdeà +__ýlu¥lus + + +416  +__und”æow + ( +_IO_FILE + *); + +417  +__uæow + ( +_IO_FILE + *); + +418  +__ov”æow + ( +_IO_FILE + *, ); + +419 #ià +defšed + +_LIBC + || defšed +_GLIBCPP_USE_WCHAR_T + + +420 +_IO_wšt_t + +__wund”æow + ( +_IO_FILE + *); + +421 +_IO_wšt_t + +__wuæow + ( +_IO_FILE + *); + +422 +_IO_wšt_t + +__wov”æow + ( +_IO_FILE + *, _IO_wint_t); + +425 #ià +__GNUC__ + >= 3 + +426  + #_IO_BE +( +ex´ +, +»s +è + `__bužtš_ex³ù + (Óx´),„es) + + ) + +428  + #_IO_BE +( +ex´ +, +»s +èÓx´) + + ) + +431  + #_IO_g‘c_uÆocked +( +_å +) \ + +432 ( + `_IO_BE + (( +_å +)-> +_IO_»ad_±r + >ð(_å)-> +_IO_»ad_’d +, 0) \ + +433 ? + `__uæow + ( +_å +è: *(*è(_å)-> +_IO_»ad_±r +++) + + ) + +434  + #_IO_³ekc_uÆocked +( +_å +) \ + +435 ( + `_IO_BE + (( +_å +)-> +_IO_»ad_±r + >ð(_å)-> +_IO_»ad_’d +, 0) \ + +436 && + `__und”æow + ( +_å +è=ð +EOF + ? EOF \ + +437 : *(*è( +_å +)-> +_IO_»ad_±r +) + + ) + +438  + #_IO_putc_uÆocked +( +_ch +, +_å +) \ + +439 ( + `_IO_BE + (( +_å +)-> +_IO_wr™e_±r + >ð(_å)-> +_IO_wr™e_’d +, 0) \ + +440 ? + `__ov”æow + ( +_å +, (è( +_ch +)) \ + +441 : (è(*( +_å +)-> +_IO_wr™e_±r +++ = ( +_ch +))) + + ) + +443 #ià +defšed + +_LIBC + || defšed +_GLIBCPP_USE_WCHAR_T + + +444  + #_IO_g‘wc_uÆocked +( +_å +) \ + +445 ( + `_IO_BE + (( +_å +)-> +_wide_d©a + =ð +NULL + \ + +446 || (( +_å +)-> +_wide_d©a +-> +_IO_»ad_±r + \ + +447 >ð( +_å +)-> +_wide_d©a +-> +_IO_»ad_’d +), 0) \ + +448 ? + `__wuæow + ( +_å +è: ( +_IO_wšt_t +è*(_å)-> +_wide_d©a +-> +_IO_»ad_±r +++) + + ) + +449  + #_IO_putwc_uÆocked +( +_wch +, +_å +) \ + +450 ( + `_IO_BE + (( +_å +)-> +_wide_d©a + =ð +NULL + \ + +451 || (( +_å +)-> +_wide_d©a +-> +_IO_wr™e_±r + \ + +452 >ð( +_å +)-> +_wide_d©a +-> +_IO_wr™e_’d +), 0) \ + +453 ? + `__wov”æow + ( +_å +, +_wch +) \ + +454 : ( +_IO_wšt_t +è(*( +_å +)-> +_wide_d©a +-> +_IO_wr™e_±r +++ = ( +_wch +))) + + ) + +457  + #_IO_ãof_uÆocked +( +__å +è(((__å)-> +_æags + & +_IO_EOF_SEEN +è!ð0) + + ) + +458  + #_IO_ã¼Ü_uÆocked +( +__å +è(((__å)-> +_æags + & +_IO_ERR_SEEN +è!ð0) + + ) + +460  +_IO_g‘c + ( +_IO_FILE + * +__å +); + +461  +_IO_putc + ( +__c +, +_IO_FILE + * +__å +); + +462  +_IO_ãof + ( +_IO_FILE + * +__å +è +__THROW +; + +463  +_IO_ã¼Ü + ( +_IO_FILE + * +__å +è +__THROW +; + +465  +_IO_³ekc_locked + ( +_IO_FILE + * +__å +); + +468  + #_IO_PENDING_OUTPUT_COUNT +( +_å +) \ + +469 (( +_å +)-> +_IO_wr™e_±r + - (_å)-> +_IO_wr™e_ba£ +) + + ) + +471  +_IO_æockfže + ( +_IO_FILE + *è +__THROW +; + +472  +_IO_fuÆockfže + ( +_IO_FILE + *è +__THROW +; + +473  +_IO_árylockfže + ( +_IO_FILE + *è +__THROW +; + +475 #ifdeà +_IO_MTSAFE_IO + + +476  + #_IO_³ekc +( +_å +è + `_IO_³ekc_locked + (_å) + + ) + +477  + #_IO_æockfže +( +_å +) \ + +478 ià((( +_å +)-> +_æags + & +_IO_USER_LOCK +è=ð0è + `_IO_æockfže + (_å) + + ) + +479  + #_IO_fuÆockfže +( +_å +) \ + +480 ià((( +_å +)-> +_æags + & +_IO_USER_LOCK +è=ð0è + `_IO_fuÆockfže + (_å) + + ) + +482  + #_IO_³ekc +( +_å +è + `_IO_³ekc_uÆocked + (_å) + + ) + +483  + #_IO_æockfže +( +_å +è + + ) + +484  + #_IO_fuÆockfže +( +_å +è + + ) + +485  + #_IO_árylockfže +( +_å +è + + ) + +486  + #_IO_þ—nup_»giÚ_¡¬t +( +_fù +, +_å +è + + ) + +487  + #_IO_þ—nup_»giÚ_’d +( +_Do™ +è + + ) + +490  +_IO_vfsÿnf + ( +_IO_FILE + * +__»¡riù +, const * __restrict, + +491 +_IO_va_li¡ +, * +__»¡riù +); + +492  +_IO_vårštf + ( +_IO_FILE + * +__»¡riù +, const *__restrict, + +493 +_IO_va_li¡ +); + +494 +_IO_ssize_t + +_IO_·dn + ( +_IO_FILE + *, , _IO_ssize_t); + +495 +_IO_size_t + +_IO_sg‘n + ( +_IO_FILE + *, *, _IO_size_t); + +497 +_IO_off64_t + +_IO_£ekoff + ( +_IO_FILE + *, _IO_off64_t, , ); + +498 +_IO_off64_t + +_IO_£ekpos + ( +_IO_FILE + *, _IO_off64_t, ); + +500  +_IO_ä“_backup_¬— + ( +_IO_FILE + *è +__THROW +; + +502 #ià +defšed + +_LIBC + || defšed +_GLIBCPP_USE_WCHAR_T + + +503 +_IO_wšt_t + +_IO_g‘wc + ( +_IO_FILE + * +__å +); + +504 +_IO_wšt_t + +_IO_putwc + ( +wch¬_t + +__wc +, +_IO_FILE + * +__å +); + +505  +_IO_fwide + ( +_IO_FILE + * +__å +,  +__mode +è +__THROW +; + +506 #ià +__GNUC__ + >= 2 + +509 #ià +defšed + +_LIBC + && defšed +SHARED + + +510  + ~ + +511 #ià +SHLIB_COMPAT + ( +libc +, +GLIBC_2_0 +, +GLIBC_2_1 +) + +512  + #_IO_fwide_maybe_šcom·tibË + \ + +513 ( + `__bužtš_ex³ù + (& +_IO_¡dš_u£d + =ð +NULL +, 0)) + + ) + +514 cÚ¡  +_IO_¡dš_u£d +; + +515 +w—k_ex‹º + ( +_IO_¡dš_u£d +); + +518 #iâdeà +_IO_fwide_maybe_šcom·tibË + + +519  + #_IO_fwide_maybe_šcom·tibË + (0) + + ) + +523  + #_IO_fwide +( +__å +, +__mode +) \ + +524 ({  +__»suÉ + = ( +__mode +); \ + +525 ià( +__»suÉ + < 0 && ! +_IO_fwide_maybe_šcom·tibË +) \ + +527 ià(( +__å +)-> +_mode + == 0) \ + +529 ( +__å +)-> +_mode + = -1; \ + +530 +__»suÉ + = ( +__å +)-> +_mode +; \ + +532 ià( + `__bužtš_cÚ¡ªt_p + ( +__mode +) && (__mode) == 0) \ + +533 +__»suÉ + = +_IO_fwide_maybe_šcom·tibË + ? -1 : ( +__å +)-> +_mode +; \ + +535 +__»suÉ + = + `_IO_fwide + ( +__å +, __result); \ + +536 +__»suÉ +; }) + + ) + +539  +_IO_vfwsÿnf + ( +_IO_FILE + * +__»¡riù +, cÚ¡ +wch¬_t + * __restrict, + +540 +_IO_va_li¡ +, * +__»¡riù +); + +541  +_IO_vfw´štf + ( +_IO_FILE + * +__»¡riù +, cÚ¡ +wch¬_t + *__restrict, + +542 +_IO_va_li¡ +); + +543 +_IO_ssize_t + +_IO_w·dn + ( +_IO_FILE + *, +wšt_t +, _IO_ssize_t); + +544  +_IO_ä“_wbackup_¬— + ( +_IO_FILE + *è +__THROW +; + +547 #ifdeà +__LDBL_COMPAT + + +548  + ~ + +551 #ifdeà +__ýlu¥lus + + + @/usr/include/_G_config.h + +4 #iâdeà +_G_cÚfig_h + + +5  + #_G_cÚfig_h + 1 + + ) + +9  + ~ + +10  + #__Ãed_size_t + + + ) + +11 #ià +defšed + +_LIBC + || defšed +_GLIBCPP_USE_WCHAR_T + + +12  + #__Ãed_wch¬_t + + + ) + +14  + #__Ãed_NULL + + + ) + +15  + ~<¡ddef.h +> + +16  + #__Ãed_mb¡©e_t + + + ) + +17 #ià +defšed + +_LIBC + || defšed +_GLIBCPP_USE_WCHAR_T + + +18  + #__Ãed_wšt_t + + + ) + +20  + ~ + +21  + #_G_size_t + +size_t + + + ) + +24 +__off_t + + m__pos +; + +25 +__mb¡©e_t + + m__¡©e +; + +26 } + t_G_åos_t +; + +29 +__off64_t + + m__pos +; + +30 +__mb¡©e_t + + m__¡©e +; + +31 } + t_G_åos64_t +; + +32  + #_G_ssize_t + +__ssize_t + + + ) + +33  + #_G_off_t + +__off_t + + + ) + +34  + #_G_off64_t + +__off64_t + + + ) + +35  + #_G_pid_t + +__pid_t + + + ) + +36  + #_G_uid_t + +__uid_t + + + ) + +37  + #_G_wch¬_t + +wch¬_t + + + ) + +38  + #_G_wšt_t + +wšt_t + + + ) + +39  + #_G_¡©64 + +¡©64 + + + ) + +40 #ià +defšed + +_LIBC + || defšed +_GLIBCPP_USE_WCHAR_T + + +41  + ~ + +44  +__gcÚv_šfo + + m__cd +; + +47  +__gcÚv_šfo + + m__cd +; + +48  +__gcÚv_¡•_d©a + + m__d©a +; + +49 } + m__combšed +; + +50 } + t_G_icÚv_t +; + +53  + t_G_št16_t + + t__©Œibu‹__ + (( + t__mode__ + ( + t__HI__ +))); + +54  + t_G_št32_t + + t__©Œibu‹__ + (( + t__mode__ + ( + t__SI__ +))); + +55  + t_G_ušt16_t + + t__©Œibu‹__ + (( + t__mode__ + ( + t__HI__ +))); + +56  + t_G_ušt32_t + + t__©Œibu‹__ + (( + t__mode__ + ( + t__SI__ +))); + +58  + #_G_HAVE_BOOL + 1 + + ) + +62  + #_G_HAVE_ATEXIT + 1 + + ) + +63  + #_G_HAVE_SYS_CDEFS + 1 + + ) + +64  + #_G_HAVE_SYS_WAIT + 1 + + ) + +65  + #_G_NEED_STDARG_H + 1 + + ) + +66  + #_G_va_li¡ + +__gnuc_va_li¡ + + + ) + +68  + #_G_HAVE_PRINTF_FP + 1 + + ) + +69  + #_G_HAVE_MMAP + 1 + + ) + +70  + #_G_HAVE_MREMAP + 1 + + ) + +71  + #_G_HAVE_LONG_DOUBLE_IO + 1 + + ) + +72  + #_G_HAVE_IO_FILE_OPEN + 1 + + ) + +73  + #_G_HAVE_IO_GETLINE_INFO + 1 + + ) + +75  + #_G_IO_IO_FILE_VERSION + 0x20001 + + ) + +77  + #_G_OPEN64 + +__Ý’64 + + + ) + +78  + #_G_LSEEK64 + +__l£ek64 + + + ) + +79  + #_G_MMAP64 + +__mm­64 + + + ) + +80  + #_G_FSTAT64 +( +fd +, +buf +è + `__fx¡©64 + ( +_STAT_VER +, fd, buf) + + ) + +83  + #_G_HAVE_ST_BLKSIZE + + `defšed + ( +_STATBUF_ST_BLKSIZE +) + + ) + +85  + #_G_BUFSIZ + 8192 + + ) + +88  + #_G_NAMES_HAVE_UNDERSCORE + 0 + + ) + +89  + #_G_VTABLE_LABEL_HAS_LENGTH + 1 + + ) + +90  + #_G_USING_THUNKS + 1 + + ) + +91  + #_G_VTABLE_LABEL_PREFIX + "__vt_" + + ) + +92  + #_G_VTABLE_LABEL_PREFIX_ID + +__vt_ + + + ) + +95 #ià +defšed + +__ýlu¥lus + || defšed +__STDC__ + + +96  + #_G_ARGS +( +ARGLIST +è + ) +ARGLIST + +98  + #_G_ARGS +( +ARGLIST +è() + + ) + + @/usr/include/bits/libio-ldbl.h + +20 #iâdeà +_IO_STDIO_H + + +24 + $__LDBL_REDIR_DECL + ( +_IO_vfsÿnf +) + +25 + `__LDBL_REDIR_DECL + ( +_IO_vårštf +) + + @/usr/include/bits/predefs.h + +19 #iâdeà +_FEATURES_H + + +23 #iâdeà +_PREDEFS_H + + +24  + #_PREDEFS_H + + + ) + +27  + #__STDC_IEC_559__ + 1 + + ) + +28  + #__STDC_IEC_559_COMPLEX__ + 1 + + ) + + @/usr/include/bits/stdio-lock.h + +20 #iâdeà +_BITS_STDIO_LOCK_H + + +21  + #_BITS_STDIO_LOCK_H + 1 + + ) + +23  + ~ + +24  + ~ + +28  + #_IO_lock_šex³nsive + 1 + + ) + +30 ¡ruù {  + mlock +;  + mút +; * + mowÃr +; } + t_IO_lock_t +; + +32  + #_IO_lock_š™Ÿliz” + { +LLL_LOCK_INITIALIZER +, 0, +NULL + } + + ) + +34  + #_IO_lock_š™ +( +_Çme +) \ + +35 (( +_Çme +èð( +_IO_lock_t +è +_IO_lock_š™Ÿliz” + , 0) + + ) + +37  + #_IO_lock_fši +( +_Çme +) \ + +38 ((è0) + + ) + +40  + #_IO_lock_lock +( +_Çme +) \ + +42 * +__£lf + = +THREAD_SELF +; \ + +43 ià(( +_Çme +). +owÃr + !ð +__£lf +) \ + +45 + `Îl_lock + (( +_Çme +). +lock +, +LLL_PRIVATE +); \ + +46 ( +_Çme +). +owÃr + = +__£lf +; \ + +48 ++( +_Çme +). +út +; \ + +49 } 0) + + ) + +51  + #_IO_lock_Œylock +( +_Çme +) \ + +53  +__»suÉ + = 0; \ + +54 * +__£lf + = +THREAD_SELF +; \ + +55 ià(( +_Çme +). +owÃr + !ð +__£lf +) \ + +57 ià( + `Îl_Œylock + (( +_Çme +). +lock +) == 0) \ + +59 ( +_Çme +). +owÃr + = +__£lf +; \ + +60 ( +_Çme +). +út + = 1; \ + +63 +__»suÉ + = +EBUSY +; \ + +66 ++( +_Çme +). +út +; \ + +67 +__»suÉ +; \ + +68 }) + + ) + +70  + #_IO_lock_uÆock +( +_Çme +) \ + +72 ià(--( +_Çme +). +út + == 0) \ + +74 ( +_Çme +). +owÃr + = +NULL +; \ + +75 + `Îl_uÆock + (( +_Çme +). +lock +, +LLL_PRIVATE +); \ + +77 } 0) + + ) + +81  + #_IO_þ—nup_»giÚ_¡¬t +( +_fù +, +_å +) \ + +82 + `__libc_þ—nup_»giÚ_¡¬t + ((( +_å +)-> +_æags + & +_IO_USER_LOCK +è=ð0, +_fù +, _å) + + ) + +83  + #_IO_þ—nup_»giÚ_¡¬t_nßrg +( +_fù +) \ + +84 + `__libc_þ—nup_»giÚ_¡¬t + (1, +_fù +, +NULL +) + + ) + +85  + #_IO_þ—nup_»giÚ_’d +( +_do™ +) \ + +86 + `__libc_þ—nup_»giÚ_’d + ( +_do™ +) + + ) + +88 #ià +defšed + +_LIBC + && !defšed +NOT_IN_libc + + +90 #ifdeà +__EXCEPTIONS + + +91  + #_IO_acquœe_lock +( +_å +) \ + +93 +_IO_FILE + * +_IO_acquœe_lock_fže + \ + +94 + `__©Œibu‹__ +(( + `þ—nup + ( +_IO_acquœe_lock_fù +))) \ + +95 ð( +_å +); \ + +96 + `_IO_æockfže + ( +_IO_acquœe_lock_fže +); + + ) + +97  + #_IO_acquœe_lock_þ—r_æags2 +( +_å +) \ + +99 +_IO_FILE + * +_IO_acquœe_lock_fže + \ + +100 + `__©Œibu‹__ +(( + `þ—nup + ( +_IO_acquœe_lock_þ—r_æags2_fù +))) \ + +101 ð( +_å +); \ + +102 + `_IO_æockfže + ( +_IO_acquœe_lock_fže +); + + ) + +104  + #_IO_acquœe_lock +( +_å +è +_IO_acquœe_lock_Ãeds_exû±iÚs_’abËd + + + ) + +105  + #_IO_acquœe_lock_þ—r_æags2 +( +_å +è + `_IO_acquœe_lock + (_å) + + ) + +107  + #_IO_»Ëa£_lock +( +_å +è; } 0) + + ) + + @/usr/include/bits/typesizes.h + +20 #iâdeà +_BITS_TYPES_H + + +24 #iâdef +_BITS_TYPESIZES_H + + +25  + #_BITS_TYPESIZES_H + 1 + + ) + +30  + #__DEV_T_TYPE + +__UQUAD_TYPE + + + ) + +31  + #__UID_T_TYPE + +__U32_TYPE + + + ) + +32  + #__GID_T_TYPE + +__U32_TYPE + + + ) + +33  + #__INO_T_TYPE + +__ULONGWORD_TYPE + + + ) + +34  + #__INO64_T_TYPE + +__UQUAD_TYPE + + + ) + +35  + #__MODE_T_TYPE + +__U32_TYPE + + + ) + +36  + #__NLINK_T_TYPE + +__UWORD_TYPE + + + ) + +37  + #__OFF_T_TYPE + +__SLONGWORD_TYPE + + + ) + +38  + #__OFF64_T_TYPE + +__SQUAD_TYPE + + + ) + +39  + #__PID_T_TYPE + +__S32_TYPE + + + ) + +40  + #__RLIM_T_TYPE + +__ULONGWORD_TYPE + + + ) + +41  + #__RLIM64_T_TYPE + +__UQUAD_TYPE + + + ) + +42  + #__BLKCNT_T_TYPE + +__SLONGWORD_TYPE + + + ) + +43  + #__BLKCNT64_T_TYPE + +__SQUAD_TYPE + + + ) + +44  + #__FSBLKCNT_T_TYPE + +__ULONGWORD_TYPE + + + ) + +45  + #__FSBLKCNT64_T_TYPE + +__UQUAD_TYPE + + + ) + +46  + #__FSFILCNT_T_TYPE + +__ULONGWORD_TYPE + + + ) + +47  + #__FSFILCNT64_T_TYPE + +__UQUAD_TYPE + + + ) + +48  + #__ID_T_TYPE + +__U32_TYPE + + + ) + +49  + #__CLOCK_T_TYPE + +__SLONGWORD_TYPE + + + ) + +50  + #__TIME_T_TYPE + +__SLONGWORD_TYPE + + + ) + +51  + #__USECONDS_T_TYPE + +__U32_TYPE + + + ) + +52  + #__SUSECONDS_T_TYPE + +__SLONGWORD_TYPE + + + ) + +53  + #__DADDR_T_TYPE + +__S32_TYPE + + + ) + +54  + #__SWBLK_T_TYPE + +__SLONGWORD_TYPE + + + ) + +55  + #__KEY_T_TYPE + +__S32_TYPE + + + ) + +56  + #__CLOCKID_T_TYPE + +__S32_TYPE + + + ) + +57  + #__TIMER_T_TYPE + * + + ) + +58  + #__BLKSIZE_T_TYPE + +__SLONGWORD_TYPE + + + ) + +59  + #__FSID_T_TYPE + sŒuù {  +__v® +[2]; } + + ) + +60  + #__SSIZE_T_TYPE + +__SWORD_TYPE + + + ) + +63  + #__FD_SETSIZE + 1024 + + ) + + @/usr/include/bits/wordsize.h + +3 #ià +defšed + +__x86_64__ + + +4  + #__WORDSIZE + 64 + + ) + +5  + #__WORDSIZE_COMPAT32 + 1 + + ) + +7  + #__WORDSIZE + 32 + + ) + + @/usr/include/ctype.h + +24 #iâdef +_CTYPE_H + + +25  + #_CTYPE_H + 1 + + ) + +27  + ~<ã©u»s.h +> + +28  + ~ + +30 + g__BEGIN_DECLS + + +32 #iâdeà +_ISb™ + + +41  + ~<’dŸn.h +> + +42 #ià +__BYTE_ORDER + =ð +__BIG_ENDIAN + + +43  + #_ISb™ +( +b™ +è(1 << (b™)) + + ) + +45  + #_ISb™ +( +b™ +è((b™è< 8 ? ((1 << (b™)è<< 8è: ((1 << (b™)è>> 8)) + + ) + +50 + m_ISuµ” + = +_ISb™ + (0), + +51 + m_ISlow” + = +_ISb™ + (1), + +52 + m_IS®pha + = +_ISb™ + (2), + +53 + m_ISdig™ + = +_ISb™ + (3), + +54 + m_ISxdig™ + = +_ISb™ + (4), + +55 + m_IS¥aû + = +_ISb™ + (5), + +56 + m_IS´št + = +_ISb™ + (6), + +57 + m_ISg¿ph + = +_ISb™ + (7), + +58 + m_ISbÏnk + = +_ISb™ + (8), + +59 + m_ISúŒl + = +_ISb™ + (9), + +60 + m_ISpunù + = +_ISb™ + (10), + +61 + m_IS®num + = +_ISb™ + (11) + +81 +__cÚ¡ + ** + $__ùy³_b_loc + () + +82 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡ +)); + +83 +__cÚ¡ + +__št32_t + ** + $__ùy³_tÞow”_loc + () + +84 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡ +)); + +85 +__cÚ¡ + +__št32_t + ** + $__ùy³_touµ”_loc + () + +86 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡ +)); + +88  + #__isùy³ +( +c +, +ty³ +) \ + +89 ((* + `__ùy³_b_loc + ())[(è( +c +)] & (è +ty³ +) + + ) + +91  + #__i§scii +( +c +è(((cè& ~0x7fè=ð0è + + ) + +92  + #__tßscii +( +c +è((cè& 0x7fè + + ) + +94  + #__exùy³ +( +Çme +è  + `Çme + (è +__THROW + + + ) + +96 +__BEGIN_NAMESPACE_STD + + +102 + `__exùy³ + ( +i§Êum +); + +103 + `__exùy³ + ( +i§Íha +); + +104 + `__exùy³ + ( +isúŒl +); + +105 + `__exùy³ + ( +isdig™ +); + +106 + `__exùy³ + ( +i¦ow” +); + +107 + `__exùy³ + ( +isg¿ph +); + +108 + `__exùy³ + ( +i¥ršt +); + +109 + `__exùy³ + ( +i¥unù +); + +110 + `__exùy³ + ( +is¥aû +); + +111 + `__exùy³ + ( +isuµ” +); + +112 + `__exùy³ + ( +isxdig™ +); + +116  + $tÞow” + ( +__c +è +__THROW +; + +119  + $touµ” + ( +__c +è +__THROW +; + +121 +__END_NAMESPACE_STD + + +125 #ifdef +__USE_ISOC99 + + +126 +__BEGIN_NAMESPACE_C99 + + +128 + `__exùy³ + ( +isbÏnk +); + +130 +__END_NAMESPACE_C99 + + +133 #ifdeà +__USE_GNU + + +135  + $isùy³ + ( +__c +,  +__mask +è +__THROW +; + +138 #ià +defšed + +__USE_SVID + || defšed +__USE_MISC + || defšed +__USE_XOPEN + + +142  + $i§scii + ( +__c +è +__THROW +; + +146  + $tßscii + ( +__c +è +__THROW +; + +150 + `__exùy³ + ( +_touµ” +); + +151 + `__exùy³ + ( +_tÞow” +); + +155  + #__tobody +( +c +, +f +, +a +, +¬gs +) \ + +156 ( +__ex‹nsiÚ__ + \ + +157 ({  +__»s +; \ + +158 ià( ( +c +) > 1) \ + +160 ià( + `__bužtš_cÚ¡ªt_p + ( +c +)) \ + +162  +__c + = ( +c +); \ + +163 +__»s + = +__c + < -128 || __ø> 255 ? __ø: ( +a +)[__c]; \ + +166 +__»s + = +f + +¬gs +; \ + +169 +__»s + = ( +a +)[(è( +c +)]; \ + +170 +__»s +; + } +})) + + ) + +172 #ià! +defšed + +__NO_CTYPE + && !defšed +__ýlu¥lus + + +173  + #i§Êum +( +c +è + `__isùy³ +((c), +_IS®num +) + + ) + +174  + #i§Íha +( +c +è + `__isùy³ +((c), +_IS®pha +) + + ) + +175  + #isúŒl +( +c +è + `__isùy³ +((c), +_ISúŒl +) + + ) + +176  + #isdig™ +( +c +è + `__isùy³ +((c), +_ISdig™ +) + + ) + +177  + #i¦ow” +( +c +è + `__isùy³ +((c), +_ISlow” +) + + ) + +178  + #isg¿ph +( +c +è + `__isùy³ +((c), +_ISg¿ph +) + + ) + +179  + #i¥ršt +( +c +è + `__isùy³ +((c), +_IS´št +) + + ) + +180  + #i¥unù +( +c +è + `__isùy³ +((c), +_ISpunù +) + + ) + +181  + #is¥aû +( +c +è + `__isùy³ +((c), +_IS¥aû +) + + ) + +182  + #isuµ” +( +c +è + `__isùy³ +((c), +_ISuµ” +) + + ) + +183  + #isxdig™ +( +c +è + `__isùy³ +((c), +_ISxdig™ +) + + ) + +185 #ifdeà +__USE_ISOC99 + + +186  + #isbÏnk +( +c +è + `__isùy³ +((c), +_ISbÏnk +) + + ) + +189 #ifdeà +__USE_EXTERN_INLINES + + +190 +__ex‹º_šlše +  + +191 +__NTH + ( + $tÞow” + ( +__c +)) + +193  +__c + >ð-128 && __ø< 256 ? (* + `__ùy³_tÞow”_loc + ())[__c] : __c; + +194 + } +} + +196 +__ex‹º_šlše +  + +197 +__NTH + ( + $touµ” + ( +__c +)) + +199  +__c + >ð-128 && __ø< 256 ? (* + `__ùy³_touµ”_loc + ())[__c] : __c; + +200 + } +} + +203 #ià +__GNUC__ + >ð2 && +defšed + +__OPTIMIZE__ + && !defšed +__ýlu¥lus + + +204  + #tÞow” +( +c +è + `__tobody + (c, +tÞow” +, * + `__ùy³_tÞow”_loc + (), (c)) + + ) + +205  + #touµ” +( +c +è + `__tobody + (c, +touµ” +, * + `__ùy³_touµ”_loc + (), (c)) + + ) + +208 #ià +defšed + +__USE_SVID + || defšed +__USE_MISC + || defšed +__USE_XOPEN + + +209  + #i§scii +( +c +è + `__i§scii + (c) + + ) + +210  + #tßscii +( +c +è + `__tßscii + (c) + + ) + +212  + #_tÞow” +( +c +è((è(* + `__ùy³_tÞow”_loc + ())[(è(c)]) + + ) + +213  + #_touµ” +( +c +è((è(* + `__ùy³_touµ”_loc + ())[(è(c)]) + + ) + +219 #ifdeà +__USE_XOPEN2K8 + + +233  + ~ + +237  + #__isùy³_l +( +c +, +ty³ +, +loÿË +) \ + +238 (( +loÿË +)-> +__ùy³_b +[(è( +c +)] & (è +ty³ +) + + ) + +240  + #__exùy³_l +( +Çme +) \ + +241  + `Çme + (, +__loÿË_t +è +__THROW + + + ) + +247 +__exùy³_l + ( +i§Êum_l +); + +248 +__exùy³_l + ( +i§Íha_l +); + +249 +__exùy³_l + ( +isúŒl_l +); + +250 +__exùy³_l + ( +isdig™_l +); + +251 +__exùy³_l + ( +i¦ow”_l +); + +252 +__exùy³_l + ( +isg¿ph_l +); + +253 +__exùy³_l + ( +i¥ršt_l +); + +254 +__exùy³_l + ( +i¥unù_l +); + +255 +__exùy³_l + ( +is¥aû_l +); + +256 +__exùy³_l + ( +isuµ”_l +); + +257 +__exùy³_l + ( +isxdig™_l +); + +259 +__exùy³_l + ( +isbÏnk_l +); + +263  + $__tÞow”_l + ( +__c +, +__loÿË_t + +__l +è +__THROW +; + +264  + $tÞow”_l + ( +__c +, +__loÿË_t + +__l +è +__THROW +; + +267  + $__touµ”_l + ( +__c +, +__loÿË_t + +__l +è +__THROW +; + +268  + $touµ”_l + ( +__c +, +__loÿË_t + +__l +è +__THROW +; + +270 #ià +__GNUC__ + >ð2 && +defšed + +__OPTIMIZE__ + && !defšed +__ýlu¥lus + + +271  + #__tÞow”_l +( +c +, +loÿË +) \ + +272 + `__tobody + ( +c +, +__tÞow”_l +, ( +loÿË +)-> +__ùy³_tÞow” +, (c,†oÿË)) + + ) + +273  + #__touµ”_l +( +c +, +loÿË +) \ + +274 + `__tobody + ( +c +, +__touµ”_l +, ( +loÿË +)-> +__ùy³_touµ” +, (c,†oÿË)) + + ) + +275  + #tÞow”_l +( +c +, +loÿË +è + `__tÞow”_l + ((c), (loÿË)) + + ) + +276  + #touµ”_l +( +c +, +loÿË +è + `__touµ”_l + ((c), (loÿË)) + + ) + +280 #iâdeà +__NO_CTYPE + + +281  + #__i§Êum_l +( +c +, +l +è + `__isùy³_l +((c), +_IS®num +, (l)) + + ) + +282  + #__i§Íha_l +( +c +, +l +è + `__isùy³_l +((c), +_IS®pha +, (l)) + + ) + +283  + #__isúŒl_l +( +c +, +l +è + `__isùy³_l +((c), +_ISúŒl +, (l)) + + ) + +284  + #__isdig™_l +( +c +, +l +è + `__isùy³_l +((c), +_ISdig™ +, (l)) + + ) + +285  + #__i¦ow”_l +( +c +, +l +è + `__isùy³_l +((c), +_ISlow” +, (l)) + + ) + +286  + #__isg¿ph_l +( +c +, +l +è + `__isùy³_l +((c), +_ISg¿ph +, (l)) + + ) + +287  + #__i¥ršt_l +( +c +, +l +è + `__isùy³_l +((c), +_IS´št +, (l)) + + ) + +288  + #__i¥unù_l +( +c +, +l +è + `__isùy³_l +((c), +_ISpunù +, (l)) + + ) + +289  + #__is¥aû_l +( +c +, +l +è + `__isùy³_l +((c), +_IS¥aû +, (l)) + + ) + +290  + #__isuµ”_l +( +c +, +l +è + `__isùy³_l +((c), +_ISuµ” +, (l)) + + ) + +291  + #__isxdig™_l +( +c +, +l +è + `__isùy³_l +((c), +_ISxdig™ +, (l)) + + ) + +293  + #__isbÏnk_l +( +c +, +l +è + `__isùy³_l +((c), +_ISbÏnk +, (l)) + + ) + +295 #ià +defšed + +__USE_SVID + || defšed +__USE_MISC + + +296  + #__i§scii_l +( +c +, +l +è(Ö), + `__i§scii + (c)) + + ) + +297  + #__tßscii_l +( +c +, +l +è(Ö), + `__tßscii + (c)) + + ) + +300  + #i§Êum_l +( +c +, +l +è + `__i§Êum_l + ((c), (l)) + + ) + +301  + #i§Íha_l +( +c +, +l +è + `__i§Íha_l + ((c), (l)) + + ) + +302  + #isúŒl_l +( +c +, +l +è + `__isúŒl_l + ((c), (l)) + + ) + +303  + #isdig™_l +( +c +, +l +è + `__isdig™_l + ((c), (l)) + + ) + +304  + #i¦ow”_l +( +c +, +l +è + `__i¦ow”_l + ((c), (l)) + + ) + +305  + #isg¿ph_l +( +c +, +l +è + `__isg¿ph_l + ((c), (l)) + + ) + +306  + #i¥ršt_l +( +c +, +l +è + `__i¥ršt_l + ((c), (l)) + + ) + +307  + #i¥unù_l +( +c +, +l +è + `__i¥unù_l + ((c), (l)) + + ) + +308  + #is¥aû_l +( +c +, +l +è + `__is¥aû_l + ((c), (l)) + + ) + +309  + #isuµ”_l +( +c +, +l +è + `__isuµ”_l + ((c), (l)) + + ) + +310  + #isxdig™_l +( +c +, +l +è + `__isxdig™_l + ((c), (l)) + + ) + +312  + #isbÏnk_l +( +c +, +l +è + `__isbÏnk_l + ((c), (l)) + + ) + +314 #ià +defšed + +__USE_SVID + || defšed +__USE_MISC + + +315  + #i§scii_l +( +c +, +l +è + `__i§scii_l + ((c), (l)) + + ) + +316  + #tßscii_l +( +c +, +l +è + `__tßscii_l + ((c), (l)) + + ) + +323 +__END_DECLS + + + @/usr/include/gnu/stubs.h + +4  + ~ + +6 #ià +__WORDSIZE + == 32 + +7  + ~ + +8 #–ià +__WORDSIZE + == 64 + +9  + ~ + + @/usr/include/sys/cdefs.h + +20 #iâdef +_SYS_CDEFS_H + + +21  + #_SYS_CDEFS_H + 1 + + ) + +24 #iâdeà +_FEATURES_H + + +25  + ~<ã©u»s.h +> + +31 #ià +defšed + +__GNUC__ + && !defšed +__STDC__ + + +36 #undeà +__P + + +37 #undeà +__PMT + + +39 #ifdeà +__GNUC__ + + +46 #ià! +defšed + +__ýlu¥lus + && +__GNUC_PREREQ + (3, 3) + +47  + #__THROW + + `__©Œibu‹__ + (( +__nÙhrow__ +)) + + ) + +48  + #__NTH +( +fù +è + `__©Œibu‹__ + (( +__nÙhrow__ +)è + ) +fct + +50 #ià +defšed + +__ýlu¥lus + && +__GNUC_PREREQ + (2,8) + +51  + #__THROW + + `throw + () + + ) + +52  + #__NTH +( +fù +èfù + `throw + () + + ) + +54  + #__THROW + + + ) + +55  + #__NTH +( +fù +è + ) +fct + +61  + #__šlše + + + ) + +63  + #__THROW + + + ) + +64  + #__NTH +( +fù +è + ) +fct + +66  + #__cÚ¡ + cÚ¡ + + ) + +67  + #__sigÃd + sigÃd + + ) + +68  + #__vÞ©že + vÞ©že + + ) + +74  + #__P +( +¬gs +è + ) +args + +75  + #__PMT +( +¬gs +è + ) +args + +80  + #__CONCAT +( +x +, +y +èx ## + ) +y + +81  + #__STRING +( +x +è#x + + ) + +84  + #__±r_t + * + + ) + +85  + #__lÚg_doubË_t +  + + ) + +89 #ifdef +__ýlu¥lus + + +90  + #__BEGIN_DECLS + "C" { + + ) + +91  + #__END_DECLS + } + + ) + +93  + #__BEGIN_DECLS + + + ) + +94  + #__END_DECLS + + + ) + +103 #ià +defšed + +__ýlu¥lus + && defšed +_GLIBCPP_USE_NAMESPACES + + +104  + #__BEGIN_NAMESPACE_STD + +Çme¥aû + +¡d + { + + ) + +105  + #__END_NAMESPACE_STD + } + + ) + +106  + #__USING_NAMESPACE_STD +( +Çme +è +usšg + +¡d +::Çme; + + ) + +107  + #__BEGIN_NAMESPACE_C99 + +Çme¥aû + +__c99 + { + + ) + +108  + #__END_NAMESPACE_C99 + } + + ) + +109  + #__USING_NAMESPACE_C99 +( +Çme +è +usšg + +__c99 +::Çme; + + ) + +114  + #__BEGIN_NAMESPACE_STD + + + ) + +115  + #__END_NAMESPACE_STD + + + ) + +116  + #__USING_NAMESPACE_STD +( +Çme +) + + ) + +117  + #__BEGIN_NAMESPACE_C99 + + + ) + +118  + #__END_NAMESPACE_C99 + + + ) + +119  + #__USING_NAMESPACE_C99 +( +Çme +) + + ) + +124 #iâdeà +__BOUNDED_POINTERS__ + + +125  + #__bounded + + + ) + +126  + #__unbounded + + + ) + +127  + #__±rv®ue + + + ) + +132  + #__bos +( +±r +è + `__bužtš_objeù_size + (±r, +__USE_FORTIFY_LEVEL + > 1) + + ) + +133  + #__bos0 +( +±r +è + `__bužtš_objeù_size + (±r, 0) + + ) + +135 #ià +__GNUC_PREREQ + (4,3) + +136  + #__w¬ndeþ +( +Çme +, +msg +) \ + +137  + `Çme + (è + `__©Œibu‹__ +(( + `__w¬nšg__ + ( +msg +))) + + ) + +138  + #__w¬Ç‰r +( +msg +è + `__©Œibu‹__ +(( + `__w¬nšg__ + (msg))) + + ) + +139  + #__”rÜdeþ +( +Çme +, +msg +) \ + +140  + `Çme + (è + `__©Œibu‹__ +(( + `__”rÜ__ + ( +msg +))) + + ) + +142  + #__w¬ndeþ +( +Çme +, +msg +è  + `Çme + () + + ) + +143  + #__w¬Ç‰r +( +msg +) + + ) + +144  + #__”rÜdeþ +( +Çme +, +msg +è  + `Çme + () + + ) + +148 #ià +__GNUC_PREREQ + (2,97) + +150  + #__æex¬r + [] + + ) + +152 #ifdeà +__GNUC__ + + +153  + #__æex¬r + [0] + + ) + +155 #ià +defšed + +__STDC_VERSION__ + && __STDC_VERSION__ >= 199901L + +156  + #__æex¬r + [] + + ) + +159  + #__æex¬r + [1] + + ) + +175 #ià +defšed + +__GNUC__ + && __GNUC__ >= 2 + +177  + #__REDIRECT +( +Çme +, +´Ùo +, +®Ÿs +èÇm´ÙØ + `__asm__ + ( + `__ASMNAME + (#®Ÿs)) + + ) + +178 #ifdeà +__ýlu¥lus + + +179  + #__REDIRECT_NTH +( +Çme +, +´Ùo +, +®Ÿs +) \ + +180 +Çme + +´Ùo + +__THROW + + `__asm__ + ( + `__ASMNAME + (#®Ÿs)) + + ) + +182  + #__REDIRECT_NTH +( +Çme +, +´Ùo +, +®Ÿs +) \ + +183 +Çme + +´Ùo + + `__asm__ + ( + `__ASMNAME + (#®Ÿs)è +__THROW + + + ) + +185  + #__ASMNAME +( +úame +è + `__ASMNAME2 + ( +__USER_LABEL_PREFIX__ +, cÇme) + + ) + +186  + #__ASMNAME2 +( +´efix +, +úame +è + `__STRING + (´efixè + ) +cname + +199 #ià! +defšed + +__GNUC__ + || __GNUC__ < 2 + +200  + #__©Œibu‹__ +( +xyz +è + + ) + +206 #ià +__GNUC_PREREQ + (2,96) + +207  + #__©Œibu‹_m®loc__ + + `__©Œibu‹__ + (( +__m®loc__ +)) + + ) + +209  + #__©Œibu‹_m®loc__ + + + ) + +215 #ià +__GNUC_PREREQ + (2,96) + +216  + #__©Œibu‹_pu»__ + + `__©Œibu‹__ + (( +__pu»__ +)) + + ) + +218  + #__©Œibu‹_pu»__ + + + ) + +224 #ià +__GNUC_PREREQ + (3,1) + +225  + #__©Œibu‹_u£d__ + + `__©Œibu‹__ + (( +__u£d__ +)) + + ) + +226  + #__©Œibu‹_nošlše__ + + `__©Œibu‹__ + (( +__nošlše__ +)) + + ) + +228  + #__©Œibu‹_u£d__ + + `__©Œibu‹__ + (( +__unu£d__ +)) + + ) + +229  + #__©Œibu‹_nošlše__ + + + ) + +233 #ià +__GNUC_PREREQ + (3,2) + +234  + #__©Œibu‹_d•»ÿ‹d__ + + `__©Œibu‹__ + (( +__d•»ÿ‹d__ +)) + + ) + +236  + #__©Œibu‹_d•»ÿ‹d__ + + + ) + +245 #ià +__GNUC_PREREQ + (2,8) + +246  + #__©Œibu‹_fÜm©_¬g__ +( +x +è + `__©Œibu‹__ + (( + `__fÜm©_¬g__ + (x))) + + ) + +248  + #__©Œibu‹_fÜm©_¬g__ +( +x +è + + ) + +255 #ià +__GNUC_PREREQ + (2,97) + +256  + #__©Œibu‹_fÜm©_¡rfmÚ__ +( +a +, +b +) \ + +257 + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__¡rfmÚ__ +, +a +, +b +))) + + ) + +259  + #__©Œibu‹_fÜm©_¡rfmÚ__ +( +a +, +b +è + + ) + +264 #ià +__GNUC_PREREQ + (3,3) + +265  + #__nÚnuÎ +( +·¿ms +è + `__©Œibu‹__ + (( +__nÚnuÎ__ +…¬ams)) + + ) + +267  + #__nÚnuÎ +( +·¿ms +) + + ) + +272 #ià +__GNUC_PREREQ + (3,4) + +273  + #__©Œibu‹_w¬n_unu£d_»suÉ__ + \ + +274 + `__©Œibu‹__ + (( +__w¬n_unu£d_»suÉ__ +)) + + ) + +275 #ià +__USE_FORTIFY_LEVEL + > 0 + +276  + #__wur + +__©Œibu‹_w¬n_unu£d_»suÉ__ + + + ) + +279  + #__©Œibu‹_w¬n_unu£d_»suÉ__ + + + ) + +281 #iâdeà +__wur + + +282  + #__wur + + + ) + +286 #ià +__GNUC_PREREQ + (3,2) + +287  + #__®ways_šlše + +__šlše + + `__©Œibu‹__ + (( +__®ways_šlše__ +)) + + ) + +289  + #__®ways_šlše + +__šlše + + + ) + +294 #ià! +defšed + +__ýlu¥lus + || +__GNUC_PREREQ + (4,3) + +295 #ià +defšed + +__GNUC_STDC_INLINE__ + || defšed +__ýlu¥lus + + +296  + #__ex‹º_šlše + +__šlše + + `__©Œibu‹__ + (( +__gnu_šlše__ +)) + + ) + +297 #ià +__GNUC_PREREQ + (4,3) + +298  + #__ex‹º_®ways_šlše + \ + +299 +__®ways_šlše + + `__©Œibu‹__ + (( +__gnu_šlše__ +, +__¬tificŸl__ +)) + + ) + +301  + #__ex‹º_®ways_šlše + \ + +302 +__®ways_šlše + + `__©Œibu‹__ + (( +__gnu_šlše__ +)) + + ) + +305  + #__ex‹º_šlše + +__šlše + + + ) + +306 #ià +__GNUC_PREREQ + (4,3) + +307  + #__ex‹º_®ways_šlše + \ + +308 +__®ways_šlše + + `__©Œibu‹__ + (( +__¬tificŸl__ +)) + + ) + +310  + #__ex‹º_®ways_šlše + +__®ways_šlše + + + ) + +317 #ià +__GNUC_PREREQ + (4,3) + +318  + #__va_¬g_·ck +(è + `__bužtš_va_¬g_·ck + () + + ) + +319  + #__va_¬g_·ck_Ën +(è + `__bužtš_va_¬g_·ck_Ën + () + + ) + +326 #ià! +__GNUC_PREREQ + (2,8) + +327  + #__ex‹nsiÚ__ + + + ) + +331 #ià! +__GNUC_PREREQ + (2,92) + +332  + #__»¡riù + + + ) + +338 #ià +__GNUC_PREREQ + (3,1è&& ! +defšed + +__GNUG__ + + +339  + #__»¡riù_¬r + +__»¡riù + + + ) + +341 #ifdeà +__GNUC__ + + +342  + #__»¡riù_¬r + + + ) + +344 #ià +defšed + +__STDC_VERSION__ + && __STDC_VERSION__ >= 199901L + +345  + #__»¡riù_¬r + +»¡riù + + + ) + +348  + #__»¡riù_¬r + + + ) + +353  + ~ + +355 #ià +defšed + +__LONG_DOUBLE_MATH_OPTIONAL + && defšed +__NO_LONG_DOUBLE_MATH + + +356  + #__LDBL_COMPAT + 1 + + ) + +357 #ifdeà +__REDIRECT + + +358  + #__LDBL_REDIR1 +( +Çme +, +´Ùo +, +®Ÿs +è + `__REDIRECT + (Çme,…rÙo,‡lŸs) + + ) + +359  + #__LDBL_REDIR +( +Çme +, +´Ùo +) \ + +360 + `__LDBL_REDIR1 + ( +Çme +, +´Ùo +, +__Ædbl_ +##Çme) + + ) + +361  + #__LDBL_REDIR1_NTH +( +Çme +, +´Ùo +, +®Ÿs +è + `__REDIRECT_NTH + (Çme,…rÙo,‡lŸs) + + ) + +362  + #__LDBL_REDIR_NTH +( +Çme +, +´Ùo +) \ + +363 + `__LDBL_REDIR1_NTH + ( +Çme +, +´Ùo +, +__Ædbl_ +##Çme) + + ) + +364  + #__LDBL_REDIR1_DECL +( +Çme +, +®Ÿs +) \ + +365 + `__ty³of + ( +Çme +èÇm + `__asm + ( + `__ASMNAME + (#®Ÿs)); + + ) + +366  + #__LDBL_REDIR_DECL +( +Çme +) \ + +367 + `__ty³of + ( +Çme +èÇm + `__asm + ( + `__ASMNAME + ("__Ædbl_" #Çme)); + + ) + +368  + #__REDIRECT_LDBL +( +Çme +, +´Ùo +, +®Ÿs +) \ + +369 + `__LDBL_REDIR1 + ( +Çme +, +´Ùo +, +__Ædbl_ +## +®Ÿs +) + + ) + +370  + #__REDIRECT_NTH_LDBL +( +Çme +, +´Ùo +, +®Ÿs +) \ + +371 + `__LDBL_REDIR1_NTH + ( +Çme +, +´Ùo +, +__Ædbl_ +## +®Ÿs +) + + ) + +374 #ià! +defšed + +__LDBL_COMPAT + || !defšed +__REDIRECT + + +375  + #__LDBL_REDIR1 +( +Çme +, +´Ùo +, +®Ÿs +èÇm + ) +proto + +376  + #__LDBL_REDIR +( +Çme +, +´Ùo +èÇm + ) +proto + +377  + #__LDBL_REDIR1_NTH +( +Çme +, +´Ùo +, +®Ÿs +èÇm´ÙØ +__THROW + + + ) + +378  + #__LDBL_REDIR_NTH +( +Çme +, +´Ùo +èÇm´ÙØ +__THROW + + + ) + +379  + #__LDBL_REDIR_DECL +( +Çme +) + + ) + +380 #ifdeà +__REDIRECT + + +381  + #__REDIRECT_LDBL +( +Çme +, +´Ùo +, +®Ÿs +è + `__REDIRECT + (Çme,…rÙo,‡lŸs) + + ) + +382  + #__REDIRECT_NTH_LDBL +( +Çme +, +´Ùo +, +®Ÿs +) \ + +383 + `__REDIRECT_NTH + ( +Çme +, +´Ùo +, +®Ÿs +) + + ) + + @/usr/include/bits/libc-lock.h + +20 #iâdeà +_BITS_LIBC_LOCK_H + + +21  + #_BITS_LIBC_LOCK_H + 1 + + ) + +23  + ~<±h»ad.h +> + +24  + #__Ãed_NULL + + + ) + +25  + ~<¡ddef.h +> + +34 #ifdeà +_LIBC + + +35  + ~ + +36  + ~<Žs.h +> + +37  + ~<±h»ad-funùiÚs.h +> + +38  + ~<”ºo.h +> + +39  + ~ + +43 #ià +defšed + +_LIBC + || defšed +_IO_MTSAFE_IO + + +44 #ià( +defšed + +NOT_IN_libc + && !defšed +IS_IN_lib±h»ad +è|| !defšed +_LIBC + + +45  +±h»ad_mu‹x_t + + t__libc_lock_t +; + +46 ¡ruù { +±h»ad_mu‹x_t + + mmu‹x +; } + t__libc_lock_»cursive_t +; + +48  + t__libc_lock_t +; + +49 ¡ruù {  + mlock +;  + mút +; * + mowÃr +; } + t__libc_lock_»cursive_t +; + +51 ¡ruù { +±h»ad_mu‹x_t + + mmu‹x +; } + t__¹ld_lock_»cursive_t +; + +52 #ifdeà +__USE_UNIX98 + + +53  +±h»ad_rwlock_t + + t__libc_rwlock_t +; + +55  +__libc_rwlock_Ýaque__ + + t__libc_rwlock_t +; + +58  +__libc_lock_Ýaque__ + + t__libc_lock_t +; + +59  +__libc_lock_»cursive_Ýaque__ + + t__libc_lock_»cursive_t +; + +60  +__libc_rwlock_Ýaque__ + + t__libc_rwlock_t +; + +64  +±h»ad_key_t + + t__libc_key_t +; + +73  + #__libc_lock_defše +( +CLASS +, +NAME +) \ + +74 +CLASS + +__libc_lock_t + +NAME +; + + ) + +75  + #__libc_rwlock_defše +( +CLASS +, +NAME +) \ + +76 +CLASS + +__libc_rwlock_t + +NAME +; + + ) + +77  + #__libc_lock_defše_»cursive +( +CLASS +, +NAME +) \ + +78 +CLASS + +__libc_lock_»cursive_t + +NAME +; + + ) + +79  + #__¹ld_lock_defše_»cursive +( +CLASS +, +NAME +) \ + +80 +CLASS + +__¹ld_lock_»cursive_t + +NAME +; + + ) + +91 #ià +defšed + +_LIBC + && (!defšed +NOT_IN_libc + || defšed +IS_IN_lib±h»ad +) + +92 #ià +LLL_LOCK_INITIALIZER + == 0 + +93  + #__libc_lock_defše_š™Ÿlized +( +CLASS +, +NAME +) \ + +94 +CLASS + +__libc_lock_t + +NAME +; + + ) + +96  + #__libc_lock_defše_š™Ÿlized +( +CLASS +, +NAME +) \ + +97 +CLASS + +__libc_lock_t + +NAME + = +LLL_LOCK_INITIALIZER +; + + ) + +100 #ià +__LT_SPINLOCK_INIT + == 0 + +101  + #__libc_lock_defše_š™Ÿlized +( +CLASS +, +NAME +) \ + +102 +CLASS + +__libc_lock_t + +NAME +; + + ) + +104  + #__libc_lock_defše_š™Ÿlized +( +CLASS +, +NAME +) \ + +105 +CLASS + +__libc_lock_t + +NAME + = +PTHREAD_MUTEX_INITIALIZER +; + + ) + +109  + #__libc_rwlock_defše_š™Ÿlized +( +CLASS +, +NAME +) \ + +110 +CLASS + +__libc_rwlock_t + +NAME + = +PTHREAD_RWLOCK_INITIALIZER +; + + ) + +114 #ià +defšed + +_LIBC + && (!defšed +NOT_IN_libc + || defšed +IS_IN_lib±h»ad +) + +115 #ià +LLL_LOCK_INITIALIZER + == 0 + +116  + #__libc_lock_defše_š™Ÿlized_»cursive +( +CLASS +, +NAME +) \ + +117 +CLASS + +__libc_lock_»cursive_t + +NAME +; + + ) + +119  + #__libc_lock_defše_š™Ÿlized_»cursive +( +CLASS +, +NAME +) \ + +120 +CLASS + +__libc_lock_»cursive_t + +NAME + = +_LIBC_LOCK_RECURSIVE_INITIALIZER +; + + ) + +122  + #_LIBC_LOCK_RECURSIVE_INITIALIZER + \ + +123 { +LLL_LOCK_INITIALIZER +, 0, +NULL + } + + ) + +125  + #__libc_lock_defše_š™Ÿlized_»cursive +( +CLASS +, +NAME +) \ + +126 +CLASS + +__libc_lock_»cursive_t + +NAME + = +_LIBC_LOCK_RECURSIVE_INITIALIZER +; + + ) + +127  + #_LIBC_LOCK_RECURSIVE_INITIALIZER + \ + +128 { +PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP +} + + ) + +131  + #__¹ld_lock_defše_š™Ÿlized_»cursive +( +CLASS +, +NAME +) \ + +132 +CLASS + +__¹ld_lock_»cursive_t + +NAME + = +_RTLD_LOCK_RECURSIVE_INITIALIZER +; + + ) + +133  + #_RTLD_LOCK_RECURSIVE_INITIALIZER + \ + +134 { +PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP +} + + ) + +136  + #__¹ld_lock_š™Ÿlize +( +NAME +) \ + +137 (è(( +NAME +èð( +__¹ld_lock_»cursive_t +è +_RTLD_LOCK_RECURSIVE_INITIALIZER +) + + ) + +144 #ifdeà +__PIC__ + + +145  + #__libc_maybe_ÿÎ +( +FUNC +, +ARGS +, +ELSE +) \ + +146 ( + `__ex‹nsiÚ__ + ({ + `__ty³of + ( +FUNC +è* +_â + = (FUNC); \ + +147 +_â + !ð +NULL + ? (*_âè +ARGS + : +ELSE +; })) + + ) + +149  + #__libc_maybe_ÿÎ +( +FUNC +, +ARGS +, +ELSE +) \ + +150 ( +FUNC + !ð +NULL + ? FUNC +ARGS + : +ELSE +) + + ) + +154 #ià +defšed + +SHARED + && !defšed +NOT_IN_libc + + +155  + #PTFAVAIL +( +NAME +è +__libc_±h»ad_funùiÚs_š™ + + + ) + +156  + #__libc_±f_ÿÎ +( +FUNC +, +ARGS +, +ELSE +) \ + +157 ( +__libc_±h»ad_funùiÚs_š™ + ? + `PTHFCT_CALL + ( +±r_ +## +FUNC +, +ARGS +è: +ELSE +) + + ) + +158  + #__libc_±f_ÿÎ_®ways +( +FUNC +, +ARGS +) \ + +159 + `PTHFCT_CALL + ( +±r_ +## +FUNC +, +ARGS +) + + ) + +161  + #PTFAVAIL +( +NAME +è(NAME !ð +NULL +) + + ) + +162  + #__libc_±f_ÿÎ +( +FUNC +, +ARGS +, +ELSE +) \ + +163 + `__libc_maybe_ÿÎ + ( +FUNC +, +ARGS +, +ELSE +) + + ) + +164  + #__libc_±f_ÿÎ_®ways +( +FUNC +, +ARGS +) \ + +165 +FUNC + +ARGS + + + ) + +171 #ià +defšed + +_LIBC + && (!defšed +NOT_IN_libc + || defšed +IS_IN_lib±h»ad +) + +172  + #__libc_lock_š™ +( +NAME +è((NAMEèð +LLL_LOCK_INITIALIZER +, 0) + + ) + +174  + #__libc_lock_š™ +( +NAME +) \ + +175 + `__libc_maybe_ÿÎ + ( +__±h»ad_mu‹x_š™ +, (&( +NAME +), +NULL +), 0) + + ) + +177 #ià +defšed + +SHARED + && !defšed +NOT_IN_libc + + +180  + #__libc_rwlock_š™ +( +NAME +) \ + +181 ( + `__bužtš_mem£t + (&( +NAME +), '\0',  (NAME)), 0) + + ) + +183  + #__libc_rwlock_š™ +( +NAME +) \ + +184 + `__libc_maybe_ÿÎ + ( +__±h»ad_rwlock_š™ +, (&( +NAME +), +NULL +), 0) + + ) + +188 #ià +defšed + +_LIBC + && (!defšed +NOT_IN_libc + || defšed +IS_IN_lib±h»ad +) + +189  + #__libc_lock_š™_»cursive +( +NAME +) \ + +190 (( +NAME +èð( +__libc_lock_»cursive_t +è +_LIBC_LOCK_RECURSIVE_INITIALIZER +, 0) + + ) + +192  + #__libc_lock_š™_»cursive +( +NAME +) \ + +194 ià( +__±h»ad_mu‹x_š™ + !ð +NULL +) \ + +196 +±h»ad_mu‹x©Œ_t + +__©Œ +; \ + +197 + `__±h»ad_mu‹x©Œ_š™ + (& +__©Œ +); \ + +198 + `__±h»ad_mu‹x©Œ_£‰y³ + (& +__©Œ +, +PTHREAD_MUTEX_RECURSIVE_NP +); \ + +199 + `__±h»ad_mu‹x_š™ + (&( +NAME +). +mu‹x +, & +__©Œ +); \ + +200 + `__±h»ad_mu‹x©Œ_de¡roy + (& +__©Œ +); \ + +202 } 0) + + ) + +205  + #__¹ld_lock_š™_»cursive +( +NAME +) \ + +207 ià( +__±h»ad_mu‹x_š™ + !ð +NULL +) \ + +209 +±h»ad_mu‹x©Œ_t + +__©Œ +; \ + +210 + `__±h»ad_mu‹x©Œ_š™ + (& +__©Œ +); \ + +211 + `__±h»ad_mu‹x©Œ_£‰y³ + (& +__©Œ +, +PTHREAD_MUTEX_RECURSIVE_NP +); \ + +212 + `__±h»ad_mu‹x_š™ + (&( +NAME +). +mu‹x +, & +__©Œ +); \ + +213 + `__±h»ad_mu‹x©Œ_de¡roy + (& +__©Œ +); \ + +215 } 0) + + ) + +220 #ià +defšed + +_LIBC + && (!defšed +NOT_IN_libc + || defšed +IS_IN_lib±h»ad +) + +221  + #__libc_lock_fši +( +NAME +è((è0) + + ) + +223  + #__libc_lock_fši +( +NAME +) \ + +224 + `__libc_maybe_ÿÎ + ( +__±h»ad_mu‹x_de¡roy +, (&( +NAME +)), 0) + + ) + +226 #ià +defšed + +SHARED + && !defšed +NOT_IN_libc + + +227  + #__libc_rwlock_fši +( +NAME +è((è0) + + ) + +229  + #__libc_rwlock_fši +( +NAME +) \ + +230 + `__libc_maybe_ÿÎ + ( +__±h»ad_rwlock_de¡roy +, (&( +NAME +)), 0) + + ) + +234 #ià +defšed + +_LIBC + && (!defšed +NOT_IN_libc + || defšed +IS_IN_lib±h»ad +) + +235  + #__libc_lock_fši_»cursive +( +NAME +è((è0) + + ) + +237  + #__libc_lock_fši_»cursive +( +NAME +) \ + +238 + `__libc_maybe_ÿÎ + ( +__±h»ad_mu‹x_de¡roy +, (&( +NAME +)), 0) + + ) + +242 #ià +defšed + +_LIBC + && (!defšed +NOT_IN_libc + || defšed +IS_IN_lib±h»ad +) + +243 #ià +__OPTION_EGLIBC_BIG_MACROS + != 1 + +247  +__libc_lock_lock_â + ( +__libc_lock_t + *); + +248 +libc_hidd’_´Ùo + ( +__libc_lock_lock_â +); + +250 #ià +__OPTION_EGLIBC_BIG_MACROS + + +251  + #__libc_lock_lock +( +NAME +) \ + +252 ({ + `Îl_lock + ( +NAME +, +LLL_PRIVATE +); 0; }) + + ) + +254  + #__libc_lock_lock +( +NAME +) \ + +255 + `__libc_lock_lock_â + (&( +NAME +)) + + ) + +258  + #__libc_lock_lock +( +NAME +) \ + +259 + `__libc_maybe_ÿÎ + ( +__±h»ad_mu‹x_lock +, (&( +NAME +)), 0) + + ) + +261  + #__libc_rwlock_rdlock +( +NAME +) \ + +262 + `__libc_±f_ÿÎ + ( +__±h»ad_rwlock_rdlock +, (&( +NAME +)), 0) + + ) + +263  + #__libc_rwlock_w¾ock +( +NAME +) \ + +264 + `__libc_±f_ÿÎ + ( +__±h»ad_rwlock_w¾ock +, (&( +NAME +)), 0) + + ) + +267 #ià +defšed + +_LIBC + && (!defšed +NOT_IN_libc + || defšed +IS_IN_lib±h»ad +) + +268 #ià +__OPTION_EGLIBC_BIG_MACROS + != 1 + +272  +__libc_lock_lock_»cursive_â + ( +__libc_lock_»cursive_t + *); + +273 +libc_hidd’_´Ùo + ( +__libc_lock_lock_»cursive_â +); + +275 #ià +__OPTION_EGLIBC_BIG_MACROS + + +276  + #__libc_lock_lock_»cursive +( +NAME +) \ + +278 * +£lf + = +THREAD_SELF +; \ + +279 ià(( +NAME +). +owÃr + !ð +£lf +) \ + +281 + `Îl_lock + (( +NAME +). +lock +, +LLL_PRIVATE +); \ + +282 ( +NAME +). +owÃr + = +£lf +; \ + +284 ++( +NAME +). +út +; \ + +285 } 0) + + ) + +287  + #__libc_lock_lock_»cursive +( +NAME +) \ + +288 + `__libc_lock_lock_»cursive_â + (&( +NAME +)) + + ) + +291  + #__libc_lock_lock_»cursive +( +NAME +) \ + +292 + `__libc_maybe_ÿÎ + ( +__±h»ad_mu‹x_lock +, (&( +NAME +). +mu‹x +), 0) + + ) + +296 #ià +defšed + +_LIBC + && (!defšed +NOT_IN_libc + || defšed +IS_IN_lib±h»ad +) + +297 #ià +__OPTION_EGLIBC_BIG_MACROS + != 1 + +301  +__libc_lock_Œylock_â + ( +__libc_lock_t + *); + +302 +libc_hidd’_´Ùo + ( +__libc_lock_Œylock_â +); + +304 #ià +__OPTION_EGLIBC_BIG_MACROS + + +305  + #__libc_lock_Œylock +( +NAME +) \ + +306 + `Îl_Œylock + ( +NAME +) + + ) + +308  + #__libc_lock_Œylock +( +NAME +) \ + +309 + `__libc_lock_Œylock_â + (&( +NAME +)) + + ) + +312  + #__libc_lock_Œylock +( +NAME +) \ + +313 + `__libc_maybe_ÿÎ + ( +__±h»ad_mu‹x_Œylock +, (&( +NAME +)), 0) + + ) + +315  + #__libc_rwlock_Œyrdlock +( +NAME +) \ + +316 + `__libc_maybe_ÿÎ + ( +__±h»ad_rwlock_Œyrdlock +, (&( +NAME +)), 0) + + ) + +317  + #__libc_rwlock_Œyw¾ock +( +NAME +) \ + +318 + `__libc_maybe_ÿÎ + ( +__±h»ad_rwlock_Œyw¾ock +, (&( +NAME +)), 0) + + ) + +321 #ià +defšed + +_LIBC + && (!defšed +NOT_IN_libc + || defšed +IS_IN_lib±h»ad +) + +322 #ià +__OPTION_EGLIBC_BIG_MACROS + != 1 + +326  +__libc_lock_Œylock_»cursive_â + ( +__libc_lock_»cursive_t + *); + +327 +libc_hidd’_´Ùo + ( +__libc_lock_Œylock_»cursive_â +); + +329 #ià +__OPTION_EGLIBC_BIG_MACROS + + +330  + #__libc_lock_Œylock_»cursive +( +NAME +) \ + +332  +»suÉ + = 0; \ + +333 * +£lf + = +THREAD_SELF +; \ + +334 ià(( +NAME +). +owÃr + !ð +£lf +) \ + +336 ià( + `Îl_Œylock + (( +NAME +). +lock +) == 0) \ + +338 ( +NAME +). +owÃr + = +£lf +; \ + +339 ( +NAME +). +út + = 1; \ + +342 +»suÉ + = +EBUSY +; \ + +345 ++( +NAME +). +út +; \ + +346 +»suÉ +; \ + +347 }) + + ) + +349  + #__libc_lock_Œylock_»cursive +( +NAME +) \ + +350 + `__libc_lock_Œylock_»cursive_â + (&( +NAME +)) + + ) + +353  + #__libc_lock_Œylock_»cursive +( +NAME +) \ + +354 + `__libc_maybe_ÿÎ + ( +__±h»ad_mu‹x_Œylock +, (&( +NAME +)), 0) + + ) + +357  + #__¹ld_lock_Œylock_»cursive +( +NAME +) \ + +358 + `__libc_maybe_ÿÎ + ( +__±h»ad_mu‹x_Œylock +, (&( +NAME +). +mu‹x +), 0) + + ) + +361 #ià +defšed + +_LIBC + && (!defšed +NOT_IN_libc + || defšed +IS_IN_lib±h»ad +) + +362 #ià +__OPTION_EGLIBC_BIG_MACROS + != 1 + +366  +__libc_lock_uÆock_â + ( +__libc_lock_t + *); + +367 +libc_hidd’_´Ùo + ( +__libc_lock_uÆock_â +); + +369 #ià +__OPTION_EGLIBC_BIG_MACROS + + +370  + #__libc_lock_uÆock +( +NAME +) \ + +371 + `Îl_uÆock + ( +NAME +, +LLL_PRIVATE +) + + ) + +373  + #__libc_lock_uÆock +( +NAME +) \ + +374 + `__libc_lock_uÆock_â + (&( +NAME +)) + + ) + +377  + #__libc_lock_uÆock +( +NAME +) \ + +378 + `__libc_maybe_ÿÎ + ( +__±h»ad_mu‹x_uÆock +, (&( +NAME +)), 0) + + ) + +380  + #__libc_rwlock_uÆock +( +NAME +) \ + +381 + `__libc_±f_ÿÎ + ( +__±h»ad_rwlock_uÆock +, (&( +NAME +)), 0) + + ) + +384 #ià +defšed + +_LIBC + && (!defšed +NOT_IN_libc + || defšed +IS_IN_lib±h»ad +) + +385 #ià +__OPTION_EGLIBC_BIG_MACROS + != 1 + +389  +__libc_lock_uÆock_»cursive_â + ( +__libc_lock_»cursive_t + *); + +390 +libc_hidd’_´Ùo + ( +__libc_lock_uÆock_»cursive_â +); + +392 #ià +__OPTION_EGLIBC_BIG_MACROS + + +394  + #__libc_lock_uÆock_»cursive +( +NAME +) \ + +396 ià(--( +NAME +). +út + == 0) \ + +398 ( +NAME +). +owÃr + = +NULL +; \ + +399 + `Îl_uÆock + (( +NAME +). +lock +, +LLL_PRIVATE +); \ + +401 } 0) + + ) + +403  + #__libc_lock_uÆock_»cursive +( +NAME +) \ + +404 + `__libc_lock_uÆock_»cursive_â + (&( +NAME +)) + + ) + +407  + #__libc_lock_uÆock_»cursive +( +NAME +) \ + +408 + `__libc_maybe_ÿÎ + ( +__±h»ad_mu‹x_uÆock +, (&( +NAME +)), 0) + + ) + +411 #ià +defšed + +_LIBC + && defšed +SHARED + + +412  + #__¹ld_lock_deçuÉ_lock_»cursive +( +lock +) \ + +413 ++(( +±h»ad_mu‹x_t + *)( +lock +))-> +__d©a +. +__couÁ +; + + ) + +415  + #__¹ld_lock_deçuÉ_uÆock_»cursive +( +lock +) \ + +416 --(( +±h»ad_mu‹x_t + *)( +lock +))-> +__d©a +. +__couÁ +; + + ) + +418  + #__¹ld_lock_lock_»cursive +( +NAME +) \ + +419 + `GL +( +dl_¹ld_lock_»cursive +è(&( +NAME +). +mu‹x +) + + ) + +421  + #__¹ld_lock_uÆock_»cursive +( +NAME +) \ + +422 + `GL +( +dl_¹ld_uÆock_»cursive +è(&( +NAME +). +mu‹x +) + + ) + +424  + #__¹ld_lock_lock_»cursive +( +NAME +) \ + +425 + `__libc_maybe_ÿÎ + ( +__±h»ad_mu‹x_lock +, (&( +NAME +). +mu‹x +), 0) + + ) + +427  + #__¹ld_lock_uÆock_»cursive +( +NAME +) \ + +428 + `__libc_maybe_ÿÎ + ( +__±h»ad_mu‹x_uÆock +, (&( +NAME +). +mu‹x +), 0) + + ) + +432 #ià +PTHREAD_ONCE_INIT + == 0 + +435  + #__libc_Úû_defše +( +CLASS +, +NAME +) \ + +436 +CLASS + +±h»ad_Úû_t + +NAME + + + ) + +438  + #__libc_Úû_defše +( +CLASS +, +NAME +) \ + +439 +CLASS + +±h»ad_Úû_t + +NAME + = +PTHREAD_ONCE_INIT + + + ) + +443  + #__libc_Úû +( +ONCE_CONTROL +, +INIT_FUNCTION +) \ + +445 ià( + `PTFAVAIL + ( +__±h»ad_Úû +)) \ + +446 + `__libc_±f_ÿÎ_®ways + ( +__±h»ad_Úû +, (&( +ONCE_CONTROL +), \ + +447 +INIT_FUNCTION +)); \ + +448 ià(( +ONCE_CONTROL +è=ð +PTHREAD_ONCE_INIT +) { \ + +449 + `INIT_FUNCTION + (); \ + +450 ( +ONCE_CONTROL +) |= 2; \ + +452 } 0) + + ) + +459  +_±h»ad_þ—nup_push + ( +_±h»ad_þ—nup_bufãr + * +bufãr +, + +460 (* +routše +è(*), * +¬g +); + +461  + `_±h»ad_þ—nup_pÝ + ( +_±h»ad_þ—nup_bufãr + * +bufãr +, + +462  +execu‹ +); + +463  + `_±h»ad_þ—nup_push_deãr + ( +_±h»ad_þ—nup_bufãr + * +bufãr +, + +464 (* +routše +è(*), * +¬g +); + +465  + `_±h»ad_þ—nup_pÝ_»¡Üe + ( +_±h»ad_þ—nup_bufãr + * +bufãr +, + +466  +execu‹ +); + +469  + #__libc_þ—nup_»giÚ_¡¬t +( +DOIT +, +FCT +, +ARG +) \ + +470 {  +_±h»ad_þ—nup_bufãr + +_bufãr +; \ + +471  +_avaž +; \ + +472 ià( +DOIT +) { \ + +473 +_avaž + = + `PTFAVAIL + ( +_±h»ad_þ—nup_push_deãr +); \ + +474 ià( +_avaž +) { \ + +475 + `__libc_±f_ÿÎ_®ways + ( +_±h»ad_þ—nup_push_deãr +, (& +_bufãr +, +FCT +, \ + +476 +ARG +)); \ + +478 +_bufãr +. +__routše + = ( +FCT +); \ + +479 +_bufãr +. +__¬g + = ( +ARG +); \ + +482 +_avaž + = 0; \ + +483 } + + ) + +486  + #__libc_þ—nup_»giÚ_’d +( +DOIT +) \ + +487 ià( +_avaž +) { \ + +488 + `__libc_±f_ÿÎ_®ways + ( +_±h»ad_þ—nup_pÝ_»¡Üe +, (& +_bufãr +, +DOIT +));\ + +489 } ià( +DOIT +) \ + +490 +_bufãr +. + `__routše + (_bufãr. +__¬g +); \ + +491 + } + + ) +} + +494  + #__libc_þ—nup_’d +( +DOIT +) \ + +495 ià( +_avaž +) { \ + +496 + `__libc_±f_ÿÎ_®ways + ( +_±h»ad_þ—nup_pÝ_»¡Üe +, (& +_bufãr +, +DOIT +));\ + +497 } ià( +DOIT +) \ + +498 +_bufãr +. + `__routše + (_bufãr. +__¬g +) + + ) + +502 +__ex‹º_šlše +  + +503 + $__libc_þ—nup_routše + ( +__±h»ad_þ—nup_äame + * +f +) + +505 ià( +f +-> +__do_™ +) + +506 +f +-> + `__ÿnûl_routše + (f-> +__ÿnûl_¬g +); + +507 + } +} + +509  + #__libc_þ—nup_push +( +fù +, +¬g +) \ + +511  +__±h»ad_þ—nup_äame + +__þäame + \ + +512 + `__©Œibu‹__ + (( + `__þ—nup__ + ( +__libc_þ—nup_routše +))) \ + +513 ð{ . +__ÿnûl_routše + = ( +fù +), . +__ÿnûl_¬g + = ( +¬g +), \ + +514 . +__do_™ + = 1 }; + + ) + +516  + #__libc_þ—nup_pÝ +( +execu‹ +) \ + +517 +__þäame +. +__do_™ + = ( +execu‹ +); \ + +518 } 0) + + ) + +522  + #__libc_key_ü—‹ +( +KEY +, +DESTRUCTOR +) \ + +523 + `__libc_±f_ÿÎ + ( +__±h»ad_key_ü—‹ +, ( +KEY +, +DESTRUCTOR +), 1) + + ) + +526  + #__libc_g‘¥ecific +( +KEY +) \ + +527 + `__libc_±f_ÿÎ + ( +__±h»ad_g‘¥ecific +, ( +KEY +), +NULL +) + + ) + +530  + #__libc_£t¥ecific +( +KEY +, +VALUE +) \ + +531 + `__libc_±f_ÿÎ + ( +__±h»ad_£t¥ecific +, ( +KEY +, +VALUE +), 0) + + ) + +537  + #__libc_©fÜk +( +PREPARE +, +PARENT +, +CHILD +) \ + +538 + `__»gi¡”_©fÜk + ( +PREPARE +, +PARENT +, +CHILD +, +NULL +) + + ) + +539  +__»gi¡”_©fÜk + ((* +__´•¬e +) (), + +540 (* +__·»Á +) (), + +541 (* +__chžd +) (), + +542 * +__dso_hªdË +); + +547  + `__±h»ad_mu‹x_š™ + ( +±h»ad_mu‹x_t + * +__mu‹x +, + +548 +__cÚ¡ + +±h»ad_mu‹x©Œ_t + * +__mu‹x_©Œ +); + +550  + `__±h»ad_mu‹x_de¡roy + ( +±h»ad_mu‹x_t + * +__mu‹x +); + +552  + `__±h»ad_mu‹x_Œylock + ( +±h»ad_mu‹x_t + * +__mu‹x +); + +554  + `__±h»ad_mu‹x_lock + ( +±h»ad_mu‹x_t + * +__mu‹x +); + +556  + `__±h»ad_mu‹x_uÆock + ( +±h»ad_mu‹x_t + * +__mu‹x +); + +558  + `__±h»ad_mu‹x©Œ_š™ + ( +±h»ad_mu‹x©Œ_t + * +__©Œ +); + +560  + `__±h»ad_mu‹x©Œ_de¡roy + ( +±h»ad_mu‹x©Œ_t + * +__©Œ +); + +562  + `__±h»ad_mu‹x©Œ_£‰y³ + ( +±h»ad_mu‹x©Œ_t + * +__©Œ +, + +563  +__kšd +); + +565 #ifdeà +__USE_UNIX98 + + +566  + `__±h»ad_rwlock_š™ + ( +±h»ad_rwlock_t + * +__rwlock +, + +567 +__cÚ¡ + +±h»ad_rwlock©Œ_t + * +__©Œ +); + +569  + `__±h»ad_rwlock_de¡roy + ( +±h»ad_rwlock_t + * +__rwlock +); + +571  + `__±h»ad_rwlock_rdlock + ( +±h»ad_rwlock_t + * +__rwlock +); + +573  + `__±h»ad_rwlock_Œyrdlock + ( +±h»ad_rwlock_t + * +__rwlock +); + +575  + `__±h»ad_rwlock_w¾ock + ( +±h»ad_rwlock_t + * +__rwlock +); + +577  + `__±h»ad_rwlock_Œyw¾ock + ( +±h»ad_rwlock_t + * +__rwlock +); + +579  + `__±h»ad_rwlock_uÆock + ( +±h»ad_rwlock_t + * +__rwlock +); + +582  + `__±h»ad_key_ü—‹ + ( +±h»ad_key_t + * +__key +, + +583 (* +__de¡r_funùiÚ +) (*)); + +585  + `__±h»ad_£t¥ecific + ( +±h»ad_key_t + +__key +, + +586 +__cÚ¡ + * +__poš‹r +); + +588 * + `__±h»ad_g‘¥ecific + ( +±h»ad_key_t + +__key +); + +590  + `__±h»ad_Úû + ( +±h»ad_Úû_t + * +__Úû_cÚŒÞ +, + +591 (* +__š™_routše +) ()); + +593  + `__±h»ad_©fÜk + ((* +__´•¬e +) (), + +594 (* +__·»Á +) (), + +595 (* +__chžd +) ()); + +601 #iâdeà +__NO_WEAK_PTHREAD_ALIASES + + +602 #ifdeà +w—k_ex‹º + + +603 #ià +_LIBC + + +604  + ~ + +606  + #BP_SYM +( +sym +è + ) +sym + +608 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_mu‹x_š™ +)) + +609 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_mu‹x_de¡roy +)) + +610 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_mu‹x_lock +)) + +611 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_mu‹x_Œylock +)) + +612 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_mu‹x_uÆock +)) + +613 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_mu‹x©Œ_š™ +)) + +614 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_mu‹x©Œ_de¡roy +)) + +615 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_mu‹x©Œ_£‰y³ +)) + +616 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_rwlock_š™ +)) + +617 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_rwlock_de¡roy +)) + +618 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_rwlock_rdlock +)) + +619 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_rwlock_Œyrdlock +)) + +620 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_rwlock_w¾ock +)) + +621 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_rwlock_Œyw¾ock +)) + +622 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_rwlock_uÆock +)) + +623 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_key_ü—‹ +)) + +624 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_£t¥ecific +)) + +625 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_g‘¥ecific +)) + +626 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_Úû +)) + +627 + $w—k_ex‹º + ( +__±h»ad_š™Ÿlize +) + +628 + $w—k_ex‹º + ( +__±h»ad_©fÜk +) + +629 + `w—k_ex‹º + ( + $BP_SYM + ( +_±h»ad_þ—nup_push_deãr +)) + +630 + `w—k_ex‹º + ( + $BP_SYM + ( +_±h»ad_þ—nup_pÝ_»¡Üe +)) + +631 + `w—k_ex‹º + ( + $BP_SYM + ( +±h»ad_£tÿnûl¡©e +)) + +633 #´agm¨ +w—k + +__±h»ad_mu‹x_š™ + + +634 #´agm¨ +w—k + +__±h»ad_mu‹x_de¡roy + + +635 #´agm¨ +w—k + +__±h»ad_mu‹x_lock + + +636 #´agm¨ +w—k + +__±h»ad_mu‹x_Œylock + + +637 #´agm¨ +w—k + +__±h»ad_mu‹x_uÆock + + +638 #´agm¨ +w—k + +__±h»ad_mu‹x©Œ_š™ + + +639 #´agm¨ +w—k + +__±h»ad_mu‹x©Œ_de¡roy + + +640 #´agm¨ +w—k + +__±h»ad_mu‹x©Œ_£‰y³ + + +641 #´agm¨ +w—k + +__±h»ad_rwlock_de¡roy + + +642 #´agm¨ +w—k + +__±h»ad_rwlock_rdlock + + +643 #´agm¨ +w—k + +__±h»ad_rwlock_Œyrdlock + + +644 #´agm¨ +w—k + +__±h»ad_rwlock_w¾ock + + +645 #´agm¨ +w—k + +__±h»ad_rwlock_Œyw¾ock + + +646 #´agm¨ +w—k + +__±h»ad_rwlock_uÆock + + +647 #´agm¨ +w—k + +__±h»ad_key_ü—‹ + + +648 #´agm¨ +w—k + +__±h»ad_£t¥ecific + + +649 #´agm¨ +w—k + +__±h»ad_g‘¥ecific + + +650 #´agm¨ +w—k + +__±h»ad_Úû + + +651 #´agm¨ +w—k + +__±h»ad_š™Ÿlize + + +652 #´agm¨ +w—k + +__±h»ad_©fÜk + + +653 #´agm¨ +w—k + +_±h»ad_þ—nup_push_deãr + + +654 #´agm¨ +w—k + +_±h»ad_þ—nup_pÝ_»¡Üe + + +655 #´agm¨ +w—k + +±h»ad_£tÿnûl¡©e + + + @/usr/include/endian.h + +19 #iâdef +_ENDIAN_H + + +20  + #_ENDIAN_H + 1 + + ) + +22  + ~<ã©u»s.h +> + +32  + #__LITTLE_ENDIAN + 1234 + + ) + +33  + #__BIG_ENDIAN + 4321 + + ) + +34  + #__PDP_ENDIAN + 3412 + + ) + +37  + ~ + +41 #iâdeà +__FLOAT_WORD_ORDER + + +42  + #__FLOAT_WORD_ORDER + +__BYTE_ORDER + + + ) + +45 #ifdef +__USE_BSD + + +46  + #LITTLE_ENDIAN + +__LITTLE_ENDIAN + + + ) + +47  + #BIG_ENDIAN + +__BIG_ENDIAN + + + ) + +48  + #PDP_ENDIAN + +__PDP_ENDIAN + + + ) + +49  + #BYTE_ORDER + +__BYTE_ORDER + + + ) + +52 #ià +__BYTE_ORDER + =ð +__LITTLE_ENDIAN + + +53  + #__LONG_LONG_PAIR +( +HI +, +LO +èLO, + ) +HI + +54 #–ià +__BYTE_ORDER + =ð +__BIG_ENDIAN + + +55  + #__LONG_LONG_PAIR +( +HI +, +LO +èHI, + ) +LO + +59 #ifdeà +__USE_BSD + + +61  + ~ + +63 #ià +__BYTE_ORDER + =ð +__LITTLE_ENDIAN + + +64  + #htobe16 +( +x +è + `__bsw­_16 + (x) + + ) + +65  + #htÞe16 +( +x +è(x) + + ) + +66  + #be16toh +( +x +è + `__bsw­_16 + (x) + + ) + +67  + #Ë16toh +( +x +è(x) + + ) + +69  + #htobe32 +( +x +è + `__bsw­_32 + (x) + + ) + +70  + #htÞe32 +( +x +è(x) + + ) + +71  + #be32toh +( +x +è + `__bsw­_32 + (x) + + ) + +72  + #Ë32toh +( +x +è(x) + + ) + +74  + #htobe64 +( +x +è + `__bsw­_64 + (x) + + ) + +75  + #htÞe64 +( +x +è(x) + + ) + +76  + #be64toh +( +x +è + `__bsw­_64 + (x) + + ) + +77  + #Ë64toh +( +x +è(x) + + ) + +79  + #htobe16 +( +x +è(x) + + ) + +80  + #htÞe16 +( +x +è + `__bsw­_16 + (x) + + ) + +81  + #be16toh +( +x +è(x) + + ) + +82  + #Ë16toh +( +x +è + `__bsw­_16 + (x) + + ) + +84  + #htobe32 +( +x +è(x) + + ) + +85  + #htÞe32 +( +x +è + `__bsw­_32 + (x) + + ) + +86  + #be32toh +( +x +è(x) + + ) + +87  + #Ë32toh +( +x +è + `__bsw­_32 + (x) + + ) + +89  + #htobe64 +( +x +è(x) + + ) + +90  + #htÞe64 +( +x +è + `__bsw­_64 + (x) + + ) + +91  + #be64toh +( +x +è(x) + + ) + +92  + #Ë64toh +( +x +è + `__bsw­_64 + (x) + + ) + + @/usr/include/gconv.h + +23 #iâdeà +_GCONV_H + + +24  + #_GCONV_H + 1 + + ) + +26  + ~<ã©u»s.h +> + +27  + #__Ãed_mb¡©e_t + + + ) + +28  + #__Ãed_wšt_t + + + ) + +29  + ~ + +30  + #__Ãed_size_t + + + ) + +31  + #__Ãed_wch¬_t + + + ) + +32  + ~<¡ddef.h +> + +35  + #__UNKNOWN_10646_CHAR + (( +wch¬_t +è0xfffd) + + ) + +40 + m__GCONV_OK + = 0, + +41 + m__GCONV_NOCONV +, + +42 + m__GCONV_NODB +, + +43 + m__GCONV_NOMEM +, + +45 + m__GCONV_EMPTY_INPUT +, + +46 + m__GCONV_FULL_OUTPUT +, + +47 + m__GCONV_ILLEGAL_INPUT +, + +48 + m__GCONV_INCOMPLETE_INPUT +, + +50 + m__GCONV_ILLEGAL_DESCRIPTOR +, + +51 + m__GCONV_INTERNAL_ERROR + + +58 + m__GCONV_IS_LAST + = 0x0001, + +59 + m__GCONV_IGNORE_ERRORS + = 0x0002 + +64  + g__gcÚv_¡• +; + +65  + g__gcÚv_¡•_d©a +; + +66  + g__gcÚv_lßded_objeù +; + +67  + g__gcÚv_Œªs_d©a +; + +71 (* + t__gcÚv_fù +è( + t__gcÚv_¡• + *,  + t__gcÚv_¡•_d©a + *, + +72 + t__cÚ¡ + **, __const *, + +73 **, + tsize_t + *, , ); + +76  + $wšt_t + (* + t__gcÚv_btowc_fù +è( + t__gcÚv_¡• + *, ); + +79 (* + t__gcÚv_š™_fù +è( + t__gcÚv_¡• + *); + +80 (* + t__gcÚv_’d_fù +è( + t__gcÚv_¡• + *); + +84 (* + t__gcÚv_Œªs_fù +è( + t__gcÚv_¡• + *, + +85  + t__gcÚv_¡•_d©a + *, *, + +86 + t__cÚ¡ + *, + +87 + t__cÚ¡ + **, + +88 + t__cÚ¡ + *, **, + +89 + tsize_t + *); + +92 (* + t__gcÚv_Œªs_cÚ‹xt_fù +è(*, + t__cÚ¡ + *, + +93 + t__cÚ¡ + *, + +97 (* + t__gcÚv_Œªs_qu”y_fù +è( + t__cÚ¡ + *, __const ***, + +98 + tsize_t + *); + +101 (* + t__gcÚv_Œªs_š™_fù +) (**, const *); + +102 (* + t__gcÚv_Œªs_’d_fù +) (*); + +104  + s__gcÚv_Œªs_d©a + + +107 +__gcÚv_Œªs_fù + +__Œªs_fù +; + +108 +__gcÚv_Œªs_cÚ‹xt_fù + +__Œªs_cÚ‹xt_fù +; + +109 +__gcÚv_Œªs_’d_fù + +__Œªs_’d_fù +; + +110 * +__d©a +; + +111  +__gcÚv_Œªs_d©a + * +__Ãxt +; + +116  + s__gcÚv_¡• + + +118  +__gcÚv_lßded_objeù + * +__shlib_hªdË +; + +119 +__cÚ¡ + * +__modÇme +; + +121  +__couÁ” +; + +123 * +__äom_Çme +; + +124 * +__to_Çme +; + +126 +__gcÚv_fù + +__fù +; + +127 +__gcÚv_btowc_fù + +__btowc_fù +; + +128 +__gcÚv_š™_fù + +__š™_fù +; + +129 +__gcÚv_’d_fù + +__’d_fù +; + +133  +__mš_Ãeded_äom +; + +134  +__max_Ãeded_äom +; + +135  +__mš_Ãeded_to +; + +136  +__max_Ãeded_to +; + +139  +__¡©eful +; + +141 * +__d©a +; + +146  + s__gcÚv_¡•_d©a + + +148 * +__outbuf +; + +149 * +__outbuãnd +; + +153  +__æags +; + +157  +__švoÿtiÚ_couÁ” +; + +161  +__š‹º®_u£ +; + +163 +__mb¡©e_t + * +__¡©• +; + +164 +__mb¡©e_t + +__¡©e +; + +168  +__gcÚv_Œªs_d©a + * +__Œªs +; + +173  + s__gcÚv_šfo + + +175 +size_t + +__n¡•s +; + +176  +__gcÚv_¡• + * +__¡•s +; + +177 +__ex‹nsiÚ__ +  +__gcÚv_¡•_d©a + +__d©a + +__æex¬r +; + +178 } * + t__gcÚv_t +; + + @/usr/include/gnu/stubs-32.h + +6 #ifdeà +_LIBC + + +7 #”rÜ +AµliÿtiÚs + +may + +nÙ + +defše + +the + +maüo + +_LIBC + + +10  + #__¡ub___k”Ãl_co¦ + + + ) + +11  + #__¡ub___k”Ãl_sšl + + + ) + +12  + #__¡ub___k”Ãl_Æ + + + ) + +13  + #__¡ub_chæags + + + ) + +14  + #__¡ub_ç‰ach + + + ) + +15  + #__¡ub_fchæags + + + ) + +16  + #__¡ub_fd‘ach + + + ) + +17  + #__¡ub_g‰y + + + ) + +18  + #__¡ub_lchmod + + + ) + +19  + #__¡ub_»voke + + + ) + +20  + #__¡ub_£Žogš + + + ) + +21  + #__¡ub_sig»tuº + + + ) + +22  + #__¡ub_s¡k + + + ) + +23  + #__¡ub_¡ty + + + ) + + @/usr/include/gnu/stubs-64.h + +6 #ifdeà +_LIBC + + +7 #”rÜ +AµliÿtiÚs + +may + +nÙ + +defše + +the + +maüo + +_LIBC + + +10  + #__¡ub_bdæush + + + ) + +11  + #__¡ub_chæags + + + ) + +12  + #__¡ub_ç‰ach + + + ) + +13  + #__¡ub_fchæags + + + ) + +14  + #__¡ub_fd‘ach + + + ) + +15  + #__¡ub_g‘msg + + + ) + +16  + #__¡ub_g‰y + + + ) + +17  + #__¡ub_lchmod + + + ) + +18  + #__¡ub_putmsg + + + ) + +19  + #__¡ub_»voke + + + ) + +20  + #__¡ub_£Žogš + + + ) + +21  + #__¡ub_sig»tuº + + + ) + +22  + #__¡ub_s¡k + + + ) + +23  + #__¡ub_¡ty + + + ) + + @/usr/include/wchar.h + +24 #iâdeà +_WCHAR_H + + +26 #ià! +defšed + +__Ãed_mb¡©e_t + && !defšed +__Ãed_wšt_t + + +27  + #_WCHAR_H + 1 + + ) + +28  + ~<ã©u»s.h +> + +31 #ifdeà +_WCHAR_H + + +33  + #__Ãed___FILE + + + ) + +34 #ià +defšed + +__USE_UNIX98 + || defšed +__USE_XOPEN2K + + +35  + #__Ãed_FILE + + + ) + +37  + ~<¡dio.h +> + +39  + #__Ãed___va_li¡ + + + ) + +40  + ~<¡d¬g.h +> + +42  + ~ + +45  + #__Ãed_size_t + + + ) + +46  + #__Ãed_wch¬_t + + + ) + +47  + #__Ãed_NULL + + + ) + +49 #ià +defšed + +_WCHAR_H + || defšed +__Ãed_wšt_t + || !defšed +__WINT_TYPE__ + + +50 #undeà +__Ãed_wšt_t + + +51  + #__Ãed_wšt_t + + + ) + +52  + ~<¡ddef.h +> + +55 #ià +defšed + +__ýlu¥lus + && +__GNUC_PREREQ + (4, 4) + +56  + #__CORRECT_ISO_CPP_WCHAR_H_PROTO + + + ) + +61 #iâdeà +_WINT_T + + +66  + #_WINT_T + + + ) + +67  + twšt_t +; + +71 #ià +defšed + +__ýlu¥lus + && defšed +_GLIBCPP_USE_NAMESPACES + \ + +72 && +defšed + +__WINT_TYPE__ + + +73 +__BEGIN_NAMESPACE_STD + + +74  +__WINT_TYPE__ + + twšt_t +; + +75 + g__END_NAMESPACE_STD + + +80 #ià( +defšed + +_WCHAR_H + || defšed +__Ãed_mb¡©e_t +è&& !defšed +__mb¡©e_t_defšed + + +81  + #__mb¡©e_t_defšed + 1 + + ) + +85  + m__couÁ +; + +88 #ifdeà +__WINT_TYPE__ + + +89 +__WINT_TYPE__ + + m__wch +; + +91 +wšt_t + + m__wch +; + +93  + m__wchb +[4]; + +94 } + m__v®ue +; + +95 } + t__mb¡©e_t +; + +97 #undeà +__Ãed_mb¡©e_t + + +102 #ifdeà +_WCHAR_H + + +104 +__BEGIN_NAMESPACE_C99 + + +106  +__mb¡©e_t + + tmb¡©e_t +; + +107 + g__END_NAMESPACE_C99 + + +108 #ifdeà +__USE_GNU + + +109 + $__USING_NAMESPACE_C99 +( +mb¡©e_t +) + +112 #iâdeà +WCHAR_MIN + + +114  + #WCHAR_MIN + +__WCHAR_MIN + + + ) + +115  + #WCHAR_MAX + +__WCHAR_MAX + + + ) + +118 #iâdeà +WEOF + + +119  + #WEOF + (0xffffffffu) + + ) + +124 #ià +defšed + +__USE_XOPEN + && !defšed +__USE_UNIX98 + + +125  + ~ + +129 +__BEGIN_DECLS + + +131 +__BEGIN_NAMESPACE_STD + + +134  +tm +; + +135 +__END_NAMESPACE_STD + + +139 + $__USING_NAMESPACE_STD +( +tm +) + +142 +__BEGIN_NAMESPACE_STD + + +144 +wch¬_t + * + $wcsýy + ( +wch¬_t + * +__»¡riù + +__de¡ +, + +145 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +è +__THROW +; + +147 +wch¬_t + * + $wc¢ýy + ( +wch¬_t + * +__»¡riù + +__de¡ +, + +148 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, +size_t + +__n +) + +149 +__THROW +; + +152 +wch¬_t + * + $wcsÿt + ( +wch¬_t + * +__»¡riù + +__de¡ +, + +153 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +è +__THROW +; + +155 +wch¬_t + * + $wc¢ÿt + ( +wch¬_t + * +__»¡riù + +__de¡ +, + +156 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, +size_t + +__n +) + +157 +__THROW +; + +160  + $wcscmp + ( +__cÚ¡ + +wch¬_t + * +__s1 +, __cÚ¡ wch¬_ˆ* +__s2 +) + +161 +__THROW + +__©Œibu‹_pu»__ +; + +163  + $wc¢cmp + ( +__cÚ¡ + +wch¬_t + * +__s1 +, __cÚ¡ wch¬_ˆ* +__s2 +, +size_t + +__n +) + +164 +__THROW + +__©Œibu‹_pu»__ +; + +165 +__END_NAMESPACE_STD + + +167 #ifdeà +__USE_XOPEN2K8 + + +169  + $wcsÿ£cmp + ( +__cÚ¡ + +wch¬_t + * +__s1 +, __cÚ¡ wch¬_ˆ* +__s2 +è +__THROW +; + +172  + $wc¢ÿ£cmp + ( +__cÚ¡ + +wch¬_t + * +__s1 +, __cÚ¡ wch¬_ˆ* +__s2 +, + +173 +size_t + +__n +è +__THROW +; + +177  + ~ + +179  + $wcsÿ£cmp_l + ( +__cÚ¡ + +wch¬_t + * +__s1 +, __cÚ¡ wch¬_ˆ* +__s2 +, + +180 +__loÿË_t + +__loc +è +__THROW +; + +182  + $wc¢ÿ£cmp_l + ( +__cÚ¡ + +wch¬_t + * +__s1 +, __cÚ¡ wch¬_ˆ* +__s2 +, + +183 +size_t + +__n +, +__loÿË_t + +__loc +è +__THROW +; + +186 +__BEGIN_NAMESPACE_STD + + +189  + $wcscÞl + ( +__cÚ¡ + +wch¬_t + * +__s1 +, __cÚ¡ wch¬_ˆ* +__s2 +è +__THROW +; + +193 +size_t + + $wcsxäm + ( +wch¬_t + * +__»¡riù + +__s1 +, + +194 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s2 +, +size_t + +__n +è +__THROW +; + +195 +__END_NAMESPACE_STD + + +197 #ifdeà +__USE_XOPEN2K8 + + +203  + $wcscÞl_l + ( +__cÚ¡ + +wch¬_t + * +__s1 +, __cÚ¡ wch¬_ˆ* +__s2 +, + +204 +__loÿË_t + +__loc +è +__THROW +; + +209 +size_t + + $wcsxäm_l + ( +wch¬_t + * +__s1 +, +__cÚ¡ + wch¬_ˆ* +__s2 +, + +210 +size_t + +__n +, +__loÿË_t + +__loc +è +__THROW +; + +213 +wch¬_t + * + $wcsdup + ( +__cÚ¡ + +wch¬_t + * +__s +è +__THROW + +__©Œibu‹_m®loc__ +; + +216 +__BEGIN_NAMESPACE_STD + + +218 #ifdeà +__CORRECT_ISO_CPP_WCHAR_H_PROTO + + +219 "C++" +wch¬_t + * + $wcschr + ( +wch¬_t + * +__wcs +, wch¬_ˆ +__wc +) + +220 +__THROW + + `__asm + ("wcschr"è +__©Œibu‹_pu»__ +; + +221 "C++" +__cÚ¡ + +wch¬_t + * + $wcschr + ( +__cÚ¡ + +wch¬_t + * +__wcs +, wch¬_ˆ +__wc +) + +222 +__THROW + + `__asm + ("wcschr"è +__©Œibu‹_pu»__ +; + +224 +wch¬_t + * + $wcschr + ( +__cÚ¡ + +wch¬_t + * +__wcs +, wch¬_ˆ +__wc +) + +225 +__THROW + +__©Œibu‹_pu»__ +; + +228 #ifdeà +__CORRECT_ISO_CPP_WCHAR_H_PROTO + + +229 "C++" +wch¬_t + * + $wc¤chr + ( +wch¬_t + * +__wcs +, wch¬_ˆ +__wc +) + +230 +__THROW + + `__asm + ("wc¤chr"è +__©Œibu‹_pu»__ +; + +231 "C++" +__cÚ¡ + +wch¬_t + * + $wc¤chr + ( +__cÚ¡ + +wch¬_t + * +__wcs +, wch¬_ˆ +__wc +) + +232 +__THROW + + `__asm + ("wc¤chr"è +__©Œibu‹_pu»__ +; + +234 +wch¬_t + * + $wc¤chr + ( +__cÚ¡ + +wch¬_t + * +__wcs +, wch¬_ˆ +__wc +) + +235 +__THROW + +__©Œibu‹_pu»__ +; + +237 +__END_NAMESPACE_STD + + +239 #ifdeà +__USE_GNU + + +242 +wch¬_t + * + $wcschºul + ( +__cÚ¡ + +wch¬_t + * +__s +, wch¬_ˆ +__wc +) + +243 +__THROW + +__©Œibu‹_pu»__ +; + +246 +__BEGIN_NAMESPACE_STD + + +249 +size_t + + $wcsc¥n + ( +__cÚ¡ + +wch¬_t + * +__wcs +, __cÚ¡ wch¬_ˆ* +__»jeù +) + +250 +__THROW + +__©Œibu‹_pu»__ +; + +253 +size_t + + $wcs¥n + ( +__cÚ¡ + +wch¬_t + * +__wcs +, __cÚ¡ wch¬_ˆ* +__acû± +) + +254 +__THROW + +__©Œibu‹_pu»__ +; + +256 #ifdeà +__CORRECT_ISO_CPP_WCHAR_H_PROTO + + +257 "C++" +wch¬_t + * + $wc¥brk + ( +wch¬_t + * +__wcs +, +__cÚ¡ + wch¬_ˆ* +__acû± +) + +258 +__THROW + + `__asm + ("wc¥brk"è +__©Œibu‹_pu»__ +; + +259 "C++" +__cÚ¡ + +wch¬_t + * + $wc¥brk + ( +__cÚ¡ + +wch¬_t + * +__wcs +, + +260 +__cÚ¡ + +wch¬_t + * +__acû± +) + +261 +__THROW + + `__asm + ("wc¥brk"è +__©Œibu‹_pu»__ +; + +263 +wch¬_t + * + $wc¥brk + ( +__cÚ¡ + +wch¬_t + * +__wcs +, __cÚ¡ wch¬_ˆ* +__acû± +) + +264 +__THROW + +__©Œibu‹_pu»__ +; + +267 #ifdeà +__CORRECT_ISO_CPP_WCHAR_H_PROTO + + +268 "C++" +wch¬_t + * + $wcs¡r + ( +wch¬_t + * +__hay¡ack +, +__cÚ¡ + wch¬_ˆ* +__ÃedË +) + +269 +__THROW + + `__asm + ("wcs¡r"è +__©Œibu‹_pu»__ +; + +270 "C++" +__cÚ¡ + +wch¬_t + * + $wcs¡r + ( +__cÚ¡ + +wch¬_t + * +__hay¡ack +, + +271 +__cÚ¡ + +wch¬_t + * +__ÃedË +) + +272 +__THROW + + `__asm + ("wcs¡r"è +__©Œibu‹_pu»__ +; + +274 +wch¬_t + * + $wcs¡r + ( +__cÚ¡ + +wch¬_t + * +__hay¡ack +, __cÚ¡ wch¬_ˆ* +__ÃedË +) + +275 +__THROW + +__©Œibu‹_pu»__ +; + +279 +wch¬_t + * + $wc¡ok + ( +wch¬_t + * +__»¡riù + +__s +, + +280 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__d–im +, + +281 +wch¬_t + ** +__»¡riù + +__±r +è +__THROW +; + +284 +size_t + + $wc¦’ + ( +__cÚ¡ + +wch¬_t + * +__s +è +__THROW + +__©Œibu‹_pu»__ +; + +285 +__END_NAMESPACE_STD + + +287 #ifdeà +__USE_XOPEN + + +289 #ifdeà +__CORRECT_ISO_CPP_WCHAR_H_PROTO + + +290 "C++" +wch¬_t + * + $wcswcs + ( +wch¬_t + * +__hay¡ack +, +__cÚ¡ + wch¬_ˆ* +__ÃedË +) + +291 +__THROW + + `__asm + ("wcswcs"è +__©Œibu‹_pu»__ +; + +292 "C++" +__cÚ¡ + +wch¬_t + * + $wcswcs + ( +__cÚ¡ + +wch¬_t + * +__hay¡ack +, + +293 +__cÚ¡ + +wch¬_t + * +__ÃedË +) + +294 +__THROW + + `__asm + ("wcswcs"è +__©Œibu‹_pu»__ +; + +296 +wch¬_t + * + $wcswcs + ( +__cÚ¡ + +wch¬_t + * +__hay¡ack +, __cÚ¡ wch¬_ˆ* +__ÃedË +) + +297 +__THROW + +__©Œibu‹_pu»__ +; + +301 #ifdeà +__USE_XOPEN2K8 + + +303 +size_t + + $wc¢Ën + ( +__cÚ¡ + +wch¬_t + * +__s +, +size_t + +__maxËn +) + +304 +__THROW + +__©Œibu‹_pu»__ +; + +308 +__BEGIN_NAMESPACE_STD + + +310 #ifdeà +__CORRECT_ISO_CPP_WCHAR_H_PROTO + + +311 "C++" +wch¬_t + * + $wmemchr + ( +wch¬_t + * +__s +, wch¬_ˆ +__c +, +size_t + +__n +) + +312 +__THROW + + `__asm + ("wmemchr"è +__©Œibu‹_pu»__ +; + +313 "C++" +__cÚ¡ + +wch¬_t + * + $wmemchr + ( +__cÚ¡ + +wch¬_t + * +__s +, wch¬_ˆ +__c +, + +314 +size_t + +__n +) + +315 +__THROW + + `__asm + ("wmemchr"è +__©Œibu‹_pu»__ +; + +317 +wch¬_t + * + $wmemchr + ( +__cÚ¡ + +wch¬_t + * +__s +, wch¬_ˆ +__c +, +size_t + +__n +) + +318 +__THROW + +__©Œibu‹_pu»__ +; + +322  + $wmemcmp + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s1 +, + +323 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s2 +, +size_t + +__n +) + +324 +__THROW + +__©Œibu‹_pu»__ +; + +327 +wch¬_t + * + $wmemýy + ( +wch¬_t + * +__»¡riù + +__s1 +, + +328 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s2 +, +size_t + +__n +è +__THROW +; + +332 +wch¬_t + * + $wmemmove + ( +wch¬_t + * +__s1 +, +__cÚ¡ + wch¬_ˆ* +__s2 +, +size_t + +__n +) + +333 +__THROW +; + +336 +wch¬_t + * + $wmem£t + ( +wch¬_t + * +__s +, wch¬_ˆ +__c +, +size_t + +__n +è +__THROW +; + +337 +__END_NAMESPACE_STD + + +339 #ifdeà +__USE_GNU + + +342 +wch¬_t + * + $wmempýy + ( +wch¬_t + * +__»¡riù + +__s1 +, + +343 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s2 +, +size_t + +__n +) + +344 +__THROW +; + +348 +__BEGIN_NAMESPACE_STD + + +351 +wšt_t + + $btowc + ( +__c +è +__THROW +; + +355  + $wùob + ( +wšt_t + +__c +è +__THROW +; + +359  + $mbsš™ + ( +__cÚ¡ + +mb¡©e_t + * +__ps +è +__THROW + +__©Œibu‹_pu»__ +; + +363 +size_t + + $mb¹owc + ( +wch¬_t + * +__»¡riù + +__pwc +, + +364 +__cÚ¡ + * +__»¡riù + +__s +, +size_t + +__n +, + +365 +mb¡©e_t + * +__p +è +__THROW +; + +368 +size_t + + $wütomb + (* +__»¡riù + +__s +, +wch¬_t + +__wc +, + +369 +mb¡©e_t + * +__»¡riù + +__ps +è +__THROW +; + +372 +size_t + + $__mb¾’ + ( +__cÚ¡ + * +__»¡riù + +__s +, +size_t + +__n +, + +373 +mb¡©e_t + * +__»¡riù + +__ps +è +__THROW +; + +374 +size_t + + $mb¾’ + ( +__cÚ¡ + * +__»¡riù + +__s +, +size_t + +__n +, + +375 +mb¡©e_t + * +__»¡riù + +__ps +è +__THROW +; + +376 +__END_NAMESPACE_STD + + +378 #ifdeà +__USE_EXTERN_INLINES + + +384 +wšt_t + + $__btowc_®Ÿs + ( +__c +è + `__asm + ("btowc"); + +385 +__ex‹º_šlše + +wšt_t + + +386 + `__NTH + ( + $btowc + ( +__c +)) + +387 {  ( + `__bužtš_cÚ¡ªt_p + ( +__c +) && __c >= '\0' && __c <= '\x7f' + +388 ? ( +wšt_t +è +__c + : + `__btowc_®Ÿs + (__c)); + } +} + +390  + $__wùob_®Ÿs + ( +wšt_t + +__c +è + `__asm + ("wctob"); + +391 +__ex‹º_šlše +  + +392 + `__NTH + ( + $wùob + ( +wšt_t + +__wc +)) + +393 {  ( + `__bužtš_cÚ¡ªt_p + ( +__wc +è&& __wø>ð +L +'\0' && __wc <= L'\x7f' + +394 ? (è +__wc + : + `__wùob_®Ÿs + (__wc)); + } +} + +396 +__ex‹º_šlše + +size_t + + +397 +__NTH + ( + $mb¾’ + ( +__cÚ¡ + * +__»¡riù + +__s +, +size_t + +__n +, + +398 +mb¡©e_t + * +__»¡riù + +__ps +)) + +399 {  ( +__ps + !ð +NULL + + +400 ? + `mb¹owc + ( +NULL +, +__s +, +__n +, +__ps +è: + `__mb¾’ + (__s, __n, NULL)); + } +} + +403 +__BEGIN_NAMESPACE_STD + + +406 +size_t + + $mb¤towcs + ( +wch¬_t + * +__»¡riù + +__d¡ +, + +407 +__cÚ¡ + ** +__»¡riù + +__¤c +, +size_t + +__Ën +, + +408 +mb¡©e_t + * +__»¡riù + +__ps +è +__THROW +; + +412 +size_t + + $wc¤tombs + (* +__»¡riù + +__d¡ +, + +413 +__cÚ¡ + +wch¬_t + ** +__»¡riù + +__¤c +, +size_t + +__Ën +, + +414 +mb¡©e_t + * +__»¡riù + +__ps +è +__THROW +; + +415 +__END_NAMESPACE_STD + + +418 #ifdef +__USE_XOPEN2K8 + + +421 +size_t + + $mb¢¹owcs + ( +wch¬_t + * +__»¡riù + +__d¡ +, + +422 +__cÚ¡ + ** +__»¡riù + +__¤c +, +size_t + +__nmc +, + +423 +size_t + +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +è +__THROW +; + +427 +size_t + + $wc¢¹ombs + (* +__»¡riù + +__d¡ +, + +428 +__cÚ¡ + +wch¬_t + ** +__»¡riù + +__¤c +, + +429 +size_t + +__nwc +, size_ˆ +__Ën +, + +430 +mb¡©e_t + * +__»¡riù + +__ps +è +__THROW +; + +435 #ifdeà +__USE_XOPEN + + +437  + $wcwidth + ( +wch¬_t + +__c +è +__THROW +; + +441  + $wcswidth + ( +__cÚ¡ + +wch¬_t + * +__s +, +size_t + +__n +è +__THROW +; + +445 +__BEGIN_NAMESPACE_STD + + +448  + $wc¡od + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +449 +wch¬_t + ** +__»¡riù + +__’d±r +è +__THROW +; + +450 +__END_NAMESPACE_STD + + +452 #ifdeà +__USE_ISOC99 + + +453 +__BEGIN_NAMESPACE_C99 + + +455  + $wc¡of + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +456 +wch¬_t + ** +__»¡riù + +__’d±r +è +__THROW +; + +457  + $wc¡Þd + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +458 +wch¬_t + ** +__»¡riù + +__’d±r +è +__THROW +; + +459 +__END_NAMESPACE_C99 + + +463 +__BEGIN_NAMESPACE_STD + + +466  + $wc¡Þ + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +467 +wch¬_t + ** +__»¡riù + +__’d±r +,  +__ba£ +è +__THROW +; + +471  + $wc¡oul + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +472 +wch¬_t + ** +__»¡riù + +__’d±r +,  +__ba£ +) + +473 +__THROW +; + +474 +__END_NAMESPACE_STD + + +476 #ià +defšed + +__USE_ISOC99 + || (defšed +__GNUC__ + && defšed +__USE_GNU +) + +477 +__BEGIN_NAMESPACE_C99 + + +480 +__ex‹nsiÚ__ + + +481  + $wc¡Þl + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +482 +wch¬_t + ** +__»¡riù + +__’d±r +,  +__ba£ +) + +483 +__THROW +; + +487 +__ex‹nsiÚ__ + + +488  + $wc¡ouÎ + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +489 +wch¬_t + ** +__»¡riù + +__’d±r +, + +490  +__ba£ +è +__THROW +; + +491 +__END_NAMESPACE_C99 + + +494 #ià +defšed + +__GNUC__ + && defšed +__USE_GNU + + +497 +__ex‹nsiÚ__ + + +498  + $wc¡oq + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +499 +wch¬_t + ** +__»¡riù + +__’d±r +,  +__ba£ +) + +500 +__THROW +; + +504 +__ex‹nsiÚ__ + + +505  + $wc¡ouq + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +506 +wch¬_t + ** +__»¡riù + +__’d±r +, + +507  +__ba£ +è +__THROW +; + +510 #ifdeà +__USE_GNU + + +524  + ~ + +528  + $wc¡Þ_l + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +529 +wch¬_t + ** +__»¡riù + +__’d±r +,  +__ba£ +, + +530 +__loÿË_t + +__loc +è +__THROW +; + +532  + $wc¡oul_l + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +533 +wch¬_t + ** +__»¡riù + +__’d±r +, + +534  +__ba£ +, +__loÿË_t + +__loc +è +__THROW +; + +536 +__ex‹nsiÚ__ + + +537  + $wc¡Þl_l + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +538 +wch¬_t + ** +__»¡riù + +__’d±r +, + +539  +__ba£ +, +__loÿË_t + +__loc +è +__THROW +; + +541 +__ex‹nsiÚ__ + + +542  + $wc¡ouÎ_l + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +543 +wch¬_t + ** +__»¡riù + +__’d±r +, + +544  +__ba£ +, +__loÿË_t + +__loc +) + +545 +__THROW +; + +547  + $wc¡od_l + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +548 +wch¬_t + ** +__»¡riù + +__’d±r +, +__loÿË_t + +__loc +) + +549 +__THROW +; + +551  + $wc¡of_l + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +552 +wch¬_t + ** +__»¡riù + +__’d±r +, +__loÿË_t + +__loc +) + +553 +__THROW +; + +555  + $wc¡Þd_l + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +556 +wch¬_t + ** +__»¡riù + +__’d±r +, + +557 +__loÿË_t + +__loc +è +__THROW +; + +561 #ifdef +__USE_XOPEN2K8 + + +564 +wch¬_t + * + $wýýy + ( +wch¬_t + * +__de¡ +, +__cÚ¡ + wch¬_ˆ* +__¤c +è +__THROW +; + +568 +wch¬_t + * + $wýnýy + ( +wch¬_t + * +__de¡ +, +__cÚ¡ + wch¬_ˆ* +__¤c +, +size_t + +__n +) + +569 +__THROW +; + +575 #ifdef +__USE_XOPEN2K8 + + +578 +__FILE + * + $Ý’_wmem¡»am + ( +wch¬_t + ** +__buæoc +, +size_t + * +__siz–oc +è +__THROW +; + +581 #ià +defšed + +__USE_ISOC95 + || defšed +__USE_UNIX98 + + +582 +__BEGIN_NAMESPACE_STD + + +585  + $fwide + ( +__FILE + * +__å +,  +__mode +è +__THROW +; + +592  + `fw´štf + ( +__FILE + * +__»¡riù + +__¡»am +, + +593 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...) + +599  + `w´štf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...) + +602  + $sw´štf + ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__n +, + +603 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...) + +604 +__THROW + ; + +610  + `vfw´štf + ( +__FILE + * +__»¡riù + +__s +, + +611 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +612 +__gnuc_va_li¡ + +__¬g +) + +618  + `vw´štf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +619 +__gnuc_va_li¡ + +__¬g +) + +623  + $vsw´štf + ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__n +, + +624 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +625 +__gnuc_va_li¡ + +__¬g +) + +626 +__THROW + ; + +633  + `fwsÿnf + ( +__FILE + * +__»¡riù + +__¡»am +, + +634 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...) + +640  + `wsÿnf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...) + +643  + $swsÿnf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s +, + +644 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...) + +645 +__THROW + ; + +647 #ià +defšed + +__USE_ISOC99 + && !defšed +__USE_GNU + \ + +648 && (! +defšed + +__LDBL_COMPAT + || !defšed +__REDIRECT +) \ + +649 && ( +defšed + +__STRICT_ANSI__ + || defšed +__USE_XOPEN2K +) + +650 #ifdeà +__REDIRECT + + +654  + `__REDIRECT + ( +fwsÿnf +, ( +__FILE + * +__»¡riù + +__¡»am +, + +655 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...), + +656 +__isoc99_fwsÿnf +) + +658  + `__REDIRECT + ( +wsÿnf +, ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...), + +659 +__isoc99_wsÿnf +) + +661  + `__REDIRECT + ( +swsÿnf +, ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s +, + +662 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...), + +663 +__isoc99_swsÿnf +) + +664 +__THROW + ; + +666  + `__isoc99_fwsÿnf + ( +__FILE + * +__»¡riù + +__¡»am +, + +667 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...); + +668  + `__isoc99_wsÿnf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...); + +669  + $__isoc99_swsÿnf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s +, + +670 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...) + +671 +__THROW +; + +672  + #fwsÿnf + +__isoc99_fwsÿnf + + + ) + +673  + #wsÿnf + +__isoc99_wsÿnf + + + ) + +674  + #swsÿnf + +__isoc99_swsÿnf + + + ) + +678 +__END_NAMESPACE_STD + + +681 #ifdeà +__USE_ISOC99 + + +682 +__BEGIN_NAMESPACE_C99 + + +687  + `vfwsÿnf + ( +__FILE + * +__»¡riù + +__s +, + +688 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +689 +__gnuc_va_li¡ + +__¬g +) + +695  + `vwsÿnf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +696 +__gnuc_va_li¡ + +__¬g +) + +699  + $vswsÿnf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s +, + +700 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +701 +__gnuc_va_li¡ + +__¬g +) + +702 +__THROW + ; + +704 #ià! +defšed + +__USE_GNU + \ + +705 && (! +defšed + +__LDBL_COMPAT + || !defšed +__REDIRECT +) \ + +706 && ( +defšed + +__STRICT_ANSI__ + || defšed +__USE_XOPEN2K +) + +707 #ifdeà +__REDIRECT + + +708  + `__REDIRECT + ( +vfwsÿnf +, ( +__FILE + * +__»¡riù + +__s +, + +709 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +710 +__gnuc_va_li¡ + +__¬g +), +__isoc99_vfwsÿnf +) + +712  + `__REDIRECT + ( +vwsÿnf +, ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +713 +__gnuc_va_li¡ + +__¬g +), +__isoc99_vwsÿnf +) + +715  + `__REDIRECT + ( +vswsÿnf +, ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s +, + +716 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +717 +__gnuc_va_li¡ + +__¬g +), +__isoc99_vswsÿnf +) + +718 +__THROW + ; + +720  + `__isoc99_vfwsÿnf + ( +__FILE + * +__»¡riù + +__s +, + +721 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +722 +__gnuc_va_li¡ + +__¬g +); + +723  + `__isoc99_vwsÿnf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +724 +__gnuc_va_li¡ + +__¬g +); + +725  + $__isoc99_vswsÿnf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s +, + +726 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +727 +__gnuc_va_li¡ + +__¬g +è +__THROW +; + +728  + #vfwsÿnf + +__isoc99_vfwsÿnf + + + ) + +729  + #vwsÿnf + +__isoc99_vwsÿnf + + + ) + +730  + #vswsÿnf + +__isoc99_vswsÿnf + + + ) + +734 +__END_NAMESPACE_C99 + + +738 +__BEGIN_NAMESPACE_STD + + +743 +wšt_t + + `fg‘wc + ( +__FILE + * +__¡»am +); + +744 +wšt_t + + `g‘wc + ( +__FILE + * +__¡»am +); + +750 +wšt_t + + `g‘wch¬ + (); + +757 +wšt_t + + `åutwc + ( +wch¬_t + +__wc +, +__FILE + * +__¡»am +); + +758 +wšt_t + + `putwc + ( +wch¬_t + +__wc +, +__FILE + * +__¡»am +); + +764 +wšt_t + + `putwch¬ + ( +wch¬_t + +__wc +); + +772 +wch¬_t + * + `fg‘ws + (wch¬_ˆ* +__»¡riù + +__ws +,  +__n +, + +773 +__FILE + * +__»¡riù + +__¡»am +); + +779  + `åutws + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ws +, + +780 +__FILE + * +__»¡riù + +__¡»am +); + +787 +wšt_t + + `ung‘wc + (wšt_ˆ +__wc +, +__FILE + * +__¡»am +); + +788 +__END_NAMESPACE_STD + + +791 #ifdeà +__USE_GNU + + +799 +wšt_t + + `g‘wc_uÆocked + ( +__FILE + * +__¡»am +); + +800 +wšt_t + + `g‘wch¬_uÆocked + (); + +808 +wšt_t + + `fg‘wc_uÆocked + ( +__FILE + * +__¡»am +); + +816 +wšt_t + + `åutwc_uÆocked + ( +wch¬_t + +__wc +, +__FILE + * +__¡»am +); + +825 +wšt_t + + `putwc_uÆocked + ( +wch¬_t + +__wc +, +__FILE + * +__¡»am +); + +826 +wšt_t + + `putwch¬_uÆocked + ( +wch¬_t + +__wc +); + +835 +wch¬_t + * + `fg‘ws_uÆocked + (wch¬_ˆ* +__»¡riù + +__ws +,  +__n +, + +836 +__FILE + * +__»¡riù + +__¡»am +); + +844  + `åutws_uÆocked + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ws +, + +845 +__FILE + * +__»¡riù + +__¡»am +); + +849 +__BEGIN_NAMESPACE_C99 + + +853 +size_t + + $wcsáime + ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__maxsize +, + +854 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +855 +__cÚ¡ +  +tm + * +__»¡riù + +__ +è +__THROW +; + +856 +__END_NAMESPACE_C99 + + +858 #ifdeà +__USE_GNU + + +859  + ~ + +863 +size_t + + $wcsáime_l + ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__maxsize +, + +864 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +865 +__cÚ¡ +  +tm + * +__»¡riù + +__ +, + +866 +__loÿË_t + +__loc +è +__THROW +; + +875 #ià +defšed + +__USE_UNIX98 + && !defšed +__USE_GNU + + +876  + #__Ãed_iswxxx + + + ) + +877  + ~ + +881 #ià +__USE_FORTIFY_LEVEL + > 0 && +defšed + +__ex‹º_®ways_šlše + + +882  + ~ + +885 #ifdeà +__LDBL_COMPAT + + +886  + ~ + +889 +__END_DECLS + + +897 #undeà +__Ãed_mb¡©e_t + + +898 #undeà +__Ãed_wšt_t + + + @/usr/include/xlocale.h + +21 #iâdeà +_XLOCALE_H + + +22  + #_XLOCALE_H + 1 + + ) + +28  + s__loÿË_¡ruù + + +31  +loÿË_d©a + * + m__loÿËs +[13]; + +34 cÚ¡ * + m__ùy³_b +; + +35 cÚ¡ * + m__ùy³_tÞow” +; + +36 cÚ¡ * + m__ùy³_touµ” +; + +39 cÚ¡ * + m__Çmes +[13]; + +40 } * + t__loÿË_t +; + +43  +__loÿË_t + + tloÿË_t +; + + @/usr/include/bits/byteswap.h + +21 #ià! +defšed + +_BYTESWAP_H + && !defšed +_NETINET_IN_H + && !defšed +_ENDIAN_H + + +25 #iâdeà +_BITS_BYTESWAP_H + + +26  + #_BITS_BYTESWAP_H + 1 + + ) + +28  + ~ + +31  + #__bsw­_cÚ¡ªt_16 +( +x +) \ + +32 (((( +x +è>> 8è& 0xffè| (((xè& 0xffè<< 8)) + + ) + +34 #ià +defšed + +__GNUC__ + && __GNUC__ >= 2 + +35  + #__bsw­_16 +( +x +) \ + +36 ( +__ex‹nsiÚ__ + \ + +37 ({  +__v +, +__x + = ( +x +); \ + +38 ià( + `__bužtš_cÚ¡ªt_p + ( +__x +)) \ + +39 +__v + = + `__bsw­_cÚ¡ªt_16 + ( +__x +); \ + +41 + `__asm__ + ("rorw $8, %w0" \ + +42 : "ô" ( +__v +) \ + +43 : "0" ( +__x +) \ + +45 +__v +; })) + + ) + +48  + #__bsw­_16 +( +x +) \ + +49 ( +__ex‹nsiÚ__ + \ + +50 ({  +__x + = ( +x +); + `__bsw­_cÚ¡ªt_16 + (__x); })) + + ) + +55  + #__bsw­_cÚ¡ªt_32 +( +x +) \ + +56 (((( +x +) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ + +57 ((( +x +è& 0x0000ff00è<< 8è| (((xè& 0x000000ffè<< 24)) + + ) + +59 #ià +defšed + +__GNUC__ + && __GNUC__ >= 2 + +60 #ià +__WORDSIZE + =ð64 || ( +defšed + +__i486__ + || defšed +__³Áium__ + \ + +61 || +defšed + + g__³Áium´o__ + || defšed + g__³Áium4__ + \ + +62 || +defšed + + g__k8__ + || defšed + g__©hlÚ__ + \ + +63 || +defšed + + g__k6__ + || defšed + g__nocÚa__ + \ + +64 || +defšed + + g__cÜe2__ + || defšed + g__geode__ + \ + +65 || +defšed + + g__amdçm10__ +) + +68  + #__bsw­_32 +( +x +) \ + +69 ( +__ex‹nsiÚ__ + \ + +70 ({  +__v +, +__x + = ( +x +); \ + +71 ià( + `__bužtš_cÚ¡ªt_p + ( +__x +)) \ + +72 +__v + = + `__bsw­_cÚ¡ªt_32 + ( +__x +); \ + +74 + `__asm__ + ("bsw­ %0" : "ô" ( +__v +è: "0" ( +__x +)); \ + +75 +__v +; })) + + ) + +77  + #__bsw­_32 +( +x +) \ + +78 ( +__ex‹nsiÚ__ + \ + +79 ({  +__v +, +__x + = ( +x +); \ + +80 ià( + `__bužtš_cÚ¡ªt_p + ( +__x +)) \ + +81 +__v + = + `__bsw­_cÚ¡ªt_32 + ( +__x +); \ + +83 + `__asm__ + ("rorw $8, %w0;" \ + +86 : "ô" ( +__v +) \ + +87 : "0" ( +__x +) \ + +89 +__v +; })) + + ) + +92  + #__bsw­_32 +( +x +) \ + +93 ( +__ex‹nsiÚ__ + \ + +94 ({  +__x + = ( +x +); + `__bsw­_cÚ¡ªt_32 + (__x); })) + + ) + +98 #ià +defšed + +__GNUC__ + && __GNUC__ >= 2 + +100  + #__bsw­_cÚ¡ªt_64 +( +x +) \ + +101 (((( +x +) & 0xff00000000000000ull) >> 56) \ + +102 | ((( +x +) & 0x00ff000000000000ull) >> 40) \ + +103 | ((( +x +) & 0x0000ff0000000000ull) >> 24) \ + +104 | ((( +x +) & 0x000000ff00000000ull) >> 8) \ + +105 | ((( +x +) & 0x00000000ff000000ull) << 8) \ + +106 | ((( +x +) & 0x0000000000ff0000ull) << 24) \ + +107 | ((( +x +) & 0x000000000000ff00ull) << 40) \ + +108 | ((( +x +è& 0x00000000000000ffuÎè<< 56)) + + ) + +110 #ià +__WORDSIZE + == 64 + +111  + #__bsw­_64 +( +x +) \ + +112 ( +__ex‹nsiÚ__ + \ + +113 ({  +__v +, +__x + = ( +x +); \ + +114 ià( + `__bužtš_cÚ¡ªt_p + ( +__x +)) \ + +115 +__v + = + `__bsw­_cÚ¡ªt_64 + ( +__x +); \ + +117 + `__asm__ + ("bsw­ %q0" : "ô" ( +__v +è: "0" ( +__x +)); \ + +118 +__v +; })) + + ) + +120  + #__bsw­_64 +( +x +) \ + +121 ( +__ex‹nsiÚ__ + \ + +122 ({ uniÚ { +__ex‹nsiÚ__ +  +__Î +; \ + +123  +__l +[2]; } +__w +, +__r +; \ + +124 ià( + `__bužtš_cÚ¡ªt_p + ( +x +)) \ + +125 +__r +. +__Î + = + `__bsw­_cÚ¡ªt_64 + ( +x +); \ + +128 +__w +. +__Î + = ( +x +); \ + +129 +__r +. +__l +[0] = + `__bsw­_32 + ( +__w +.__l[1]); \ + +130 +__r +. +__l +[1] = + `__bsw­_32 + ( +__w +.__l[0]); \ + +132 +__r +. +__Î +; })) + + ) + + @/usr/include/bits/endian.h + +3 #iâdeà +_ENDIAN_H + + +7  + #__BYTE_ORDER + +__LITTLE_ENDIAN + + + ) + + @/usr/include/bits/wchar-ldbl.h + +20 #iâdeà +_WCHAR_H + + +24 #ià +defšed + +__USE_ISOC95 + || defšed +__USE_UNIX98 + + +25 +__BEGIN_NAMESPACE_C99 + + +26 +__LDBL_REDIR_DECL + ( +fw´štf +); + +27 +__LDBL_REDIR_DECL + ( +w´štf +); + +28 +__LDBL_REDIR_DECL + ( +sw´štf +); + +29 +__LDBL_REDIR_DECL + ( +vfw´štf +); + +30 +__LDBL_REDIR_DECL + ( +vw´štf +); + +31 +__LDBL_REDIR_DECL + ( +vsw´štf +); + +32 #ià +defšed + +__USE_ISOC99 + && !defšed +__USE_GNU + \ + +33 && ! +defšed + + g__REDIRECT + \ + +34 && ( +defšed + + g__STRICT_ANSI__ + || defšed + g__USE_XOPEN2K +) + +35 + $__LDBL_REDIR1_DECL + ( +fwsÿnf +, +__Ædbl___isoc99_fwsÿnf +) + +36 + $__LDBL_REDIR1_DECL + ( +wsÿnf +, +__Ædbl___isoc99_wsÿnf +) + +37 + $__LDBL_REDIR1_DECL + ( +swsÿnf +, +__Ædbl___isoc99_swsÿnf +) + +39 + `__LDBL_REDIR_DECL + ( +fwsÿnf +); + +40 + `__LDBL_REDIR_DECL + ( +wsÿnf +); + +41 + `__LDBL_REDIR_DECL + ( +swsÿnf +); + +43 +__END_NAMESPACE_C99 + + +46 #ifdeà +__USE_ISOC99 + + +47 +__BEGIN_NAMESPACE_C99 + + +48 + `__LDBL_REDIR1_DECL + ( +wc¡Þd +, +wc¡od +); + +49 #ià! +defšed + +__USE_GNU + && !defšed +__REDIRECT + \ + +50 && ( +defšed + +__STRICT_ANSI__ + || defšed +__USE_XOPEN2K +) + +51 + $__LDBL_REDIR1_DECL + ( +vfwsÿnf +, +__Ædbl___isoc99_vfwsÿnf +) + +52 + $__LDBL_REDIR1_DECL + ( +vwsÿnf +, +__Ædbl___isoc99_vwsÿnf +) + +53 + $__LDBL_REDIR1_DECL + ( +vswsÿnf +, +__Ædbl___isoc99_vswsÿnf +) + +55 + `__LDBL_REDIR_DECL + ( +vfwsÿnf +); + +56 + `__LDBL_REDIR_DECL + ( +vwsÿnf +); + +57 + `__LDBL_REDIR_DECL + ( +vswsÿnf +); + +59 +__END_NAMESPACE_C99 + + +62 #ifdeà +__USE_GNU + + +63 + `__LDBL_REDIR1_DECL + ( +wc¡Þd_l +, +wc¡od_l +); + +66 #ià +__USE_FORTIFY_LEVEL + > 0 && +defšed + +__ex‹º_®ways_šlše + + +67 + $__LDBL_REDIR_DECL + ( +__sw´štf_chk +) + +68 + $__LDBL_REDIR_DECL + ( +__vsw´štf_chk +) + +69 #ià +__USE_FORTIFY_LEVEL + > 1 + +70 + $__LDBL_REDIR_DECL + ( +__fw´štf_chk +) + +71 + $__LDBL_REDIR_DECL + ( +__w´štf_chk +) + +72 + $__LDBL_REDIR_DECL + ( +__vfw´štf_chk +) + +73 + $__LDBL_REDIR_DECL + ( +__vw´štf_chk +) + + @/usr/include/bits/wchar.h + +20 #iâdeà +_BITS_WCHAR_H + + +21  + #_BITS_WCHAR_H + 1 + + ) + +24 #ifdeà +__WCHAR_MAX__ + + +25  + #__WCHAR_MAX + +__WCHAR_MAX__ + + + ) + +27  + #__WCHAR_MAX + (2147483647) + + ) + +32 #ifdeà +__WCHAR_UNSIGNED__ + + +33  + #__WCHAR_MIN + +L +'\0' + + ) + +37 #–ià +L +'\0' - 1 > 0 + +38  + #__WCHAR_MIN + +L +'\0' + + ) + +40  + #__WCHAR_MIN + (- +__WCHAR_MAX + - 1) + + ) + + @/usr/include/bits/wchar2.h + +20 #iâdeà +_WCHAR_H + + +25 +wch¬_t + * + $__wmemýy_chk + ( +wch¬_t + * +__»¡riù + +__s1 +, + +26 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s2 +, +size_t + +__n +, + +27 +size_t + +__ns1 +è +__THROW +; + +28 +wch¬_t + * + `__REDIRECT_NTH + ( +__wmemýy_®Ÿs +, + +29 ( +wch¬_t + * +__»¡riù + +__s1 +, + +30 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s2 +, +size_t + +__n +), + +31 +wmemýy +); + +32 +wch¬_t + * + `__REDIRECT_NTH + ( +__wmemýy_chk_w¬n +, + +33 ( +wch¬_t + * +__»¡riù + +__s1 +, + +34 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s2 +, +size_t + +__n +, + +35 +size_t + +__ns1 +), +__wmemýy_chk +) + +36 + `__w¬Ç‰r + ("wmemcpy called with†ength biggerhan size of destination " + +39 +__ex‹º_®ways_šlše + +wch¬_t + * + +40 + `__NTH + ( + $wmemýy + ( +wch¬_t + * +__»¡riù + +__s1 +, +__cÚ¡ + wch¬_ˆ*__»¡riù +__s2 +, + +41 +size_t + +__n +)) + +43 ià( + `__bos0 + ( +__s1 +è!ð( +size_t +) -1) + +45 ià(! + `__bužtš_cÚ¡ªt_p + ( +__n +)) + +46  + `__wmemýy_chk + ( +__s1 +, +__s2 +, +__n +, + +47 + `__bos0 + ( +__s1 +è/  ( +wch¬_t +)); + +49 ià( +__n + > + `__bos0 + ( +__s1 +è/  ( +wch¬_t +)) + +50  + `__wmemýy_chk_w¬n + ( +__s1 +, +__s2 +, +__n +, + +51 + `__bos0 + ( +__s1 +è/  ( +wch¬_t +)); + +53  + `__wmemýy_®Ÿs + ( +__s1 +, +__s2 +, +__n +); + +54 + } +} + +57 +wch¬_t + * + $__wmemmove_chk + ( +wch¬_t + * +__s1 +, +__cÚ¡ + wch¬_ˆ* +__s2 +, + +58 +size_t + +__n +, size_ˆ +__ns1 +è +__THROW +; + +59 +wch¬_t + * + `__REDIRECT_NTH + ( +__wmemmove_®Ÿs +, (wch¬_ˆ* +__s1 +, + +60 +__cÚ¡ + +wch¬_t + * +__s2 +, + +61 +size_t + +__n +), +wmemmove +); + +62 +wch¬_t + * + `__REDIRECT_NTH + ( +__wmemmove_chk_w¬n +, + +63 ( +wch¬_t + * +__»¡riù + +__s1 +, + +64 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s2 +, +size_t + +__n +, + +65 +size_t + +__ns1 +), +__wmemmove_chk +) + +66 + `__w¬Ç‰r + ("wmemmove called with†ength biggerhan size of destination " + +69 +__ex‹º_®ways_šlše + +wch¬_t + * + +70 + `__NTH + ( + $wmemmove + ( +wch¬_t + * +__»¡riù + +__s1 +, +__cÚ¡ + wch¬_ˆ*__»¡riù +__s2 +, + +71 +size_t + +__n +)) + +73 ià( + `__bos0 + ( +__s1 +è!ð( +size_t +) -1) + +75 ià(! + `__bužtš_cÚ¡ªt_p + ( +__n +)) + +76  + `__wmemmove_chk + ( +__s1 +, +__s2 +, +__n +, + +77 + `__bos0 + ( +__s1 +è/  ( +wch¬_t +)); + +79 ià( +__n + > + `__bos0 + ( +__s1 +è/  ( +wch¬_t +)) + +80  + `__wmemmove_chk_w¬n + ( +__s1 +, +__s2 +, +__n +, + +81 + `__bos0 + ( +__s1 +è/  ( +wch¬_t +)); + +83  + `__wmemmove_®Ÿs + ( +__s1 +, +__s2 +, +__n +); + +84 + } +} + +87 #ifdeà +__USE_GNU + + +88 +wch¬_t + * + $__wmempýy_chk + ( +wch¬_t + * +__»¡riù + +__s1 +, + +89 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s2 +, +size_t + +__n +, + +90 +size_t + +__ns1 +è +__THROW +; + +91 +wch¬_t + * + `__REDIRECT_NTH + ( +__wmempýy_®Ÿs +, + +92 ( +wch¬_t + * +__»¡riù + +__s1 +, + +93 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s2 +, + +94 +size_t + +__n +), +wmempýy +); + +95 +wch¬_t + * + `__REDIRECT_NTH + ( +__wmempýy_chk_w¬n +, + +96 ( +wch¬_t + * +__»¡riù + +__s1 +, + +97 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s2 +, +size_t + +__n +, + +98 +size_t + +__ns1 +), +__wmempýy_chk +) + +99 + `__w¬Ç‰r + ("wmempcpy called with†ength biggerhan size of destination " + +102 +__ex‹º_®ways_šlše + +wch¬_t + * + +103 + `__NTH + ( + $wmempýy + ( +wch¬_t + * +__»¡riù + +__s1 +, +__cÚ¡ + wch¬_ˆ*__»¡riù +__s2 +, + +104 +size_t + +__n +)) + +106 ià( + `__bos0 + ( +__s1 +è!ð( +size_t +) -1) + +108 ià(! + `__bužtš_cÚ¡ªt_p + ( +__n +)) + +109  + `__wmempýy_chk + ( +__s1 +, +__s2 +, +__n +, + +110 + `__bos0 + ( +__s1 +è/  ( +wch¬_t +)); + +112 ià( +__n + > + `__bos0 + ( +__s1 +è/  ( +wch¬_t +)) + +113  + `__wmempýy_chk_w¬n + ( +__s1 +, +__s2 +, +__n +, + +114 + `__bos0 + ( +__s1 +è/  ( +wch¬_t +)); + +116  + `__wmempýy_®Ÿs + ( +__s1 +, +__s2 +, +__n +); + +117 + } +} + +121 +wch¬_t + * + $__wmem£t_chk + ( +wch¬_t + * +__s +, wch¬_ˆ +__c +, +size_t + +__n +, + +122 +size_t + +__ns +è +__THROW +; + +123 +wch¬_t + * + `__REDIRECT_NTH + ( +__wmem£t_®Ÿs +, (wch¬_ˆ* +__s +, wch¬_ˆ +__c +, + +124 +size_t + +__n +), +wmem£t +); + +125 +wch¬_t + * + `__REDIRECT_NTH + ( +__wmem£t_chk_w¬n +, + +126 ( +wch¬_t + * +__s +, wch¬_ˆ +__c +, +size_t + +__n +, + +127 +size_t + +__ns +), +__wmem£t_chk +) + +128 + `__w¬Ç‰r + ("wmemset called with†ength biggerhan size of destination " + +131 +__ex‹º_®ways_šlše + +wch¬_t + * + +132 + `__NTH + ( + $wmem£t + ( +wch¬_t + * +__»¡riù + +__s +, wch¬_ˆ +__c +, +size_t + +__n +)) + +134 ià( + `__bos0 + ( +__s +è!ð( +size_t +) -1) + +136 ià(! + `__bužtš_cÚ¡ªt_p + ( +__n +)) + +137  + `__wmem£t_chk + ( +__s +, +__c +, +__n +, + `__bos0 + (__sè/  ( +wch¬_t +)); + +139 ià( +__n + > + `__bos0 + ( +__s +è/  ( +wch¬_t +)) + +140  + `__wmem£t_chk_w¬n + ( +__s +, +__c +, +__n +, + +141 + `__bos0 + ( +__s +è/  ( +wch¬_t +)); + +143  + `__wmem£t_®Ÿs + ( +__s +, +__c +, +__n +); + +144 + } +} + +147 +wch¬_t + * + $__wcsýy_chk + ( +wch¬_t + * +__»¡riù + +__de¡ +, + +148 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, + +149 +size_t + +__n +è +__THROW +; + +150 +wch¬_t + * + `__REDIRECT_NTH + ( +__wcsýy_®Ÿs +, + +151 ( +wch¬_t + * +__»¡riù + +__de¡ +, + +152 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +), +wcsýy +); + +154 +__ex‹º_®ways_šlše + +wch¬_t + * + +155 + `__NTH + ( + $wcsýy + ( +wch¬_t + * +__de¡ +, +__cÚ¡ + wch¬_ˆ* +__¤c +)) + +157 ià( + `__bos + ( +__de¡ +è!ð( +size_t +) -1) + +158  + `__wcsýy_chk + ( +__de¡ +, +__¤c +, + `__bos + (__de¡è/  ( +wch¬_t +)); + +159  + `__wcsýy_®Ÿs + ( +__de¡ +, +__¤c +); + +160 + } +} + +163 +wch¬_t + * + $__wýýy_chk + ( +wch¬_t + * +__de¡ +, +__cÚ¡ + wch¬_ˆ* +__¤c +, + +164 +size_t + +__de¡Ën +è +__THROW +; + +165 +wch¬_t + * + `__REDIRECT_NTH + ( +__wýýy_®Ÿs +, (wch¬_ˆ* +__de¡ +, + +166 +__cÚ¡ + +wch¬_t + * +__¤c +), + +167 +wýýy +); + +169 +__ex‹º_®ways_šlše + +wch¬_t + * + +170 + `__NTH + ( + $wýýy + ( +wch¬_t + * +__de¡ +, +__cÚ¡ + wch¬_ˆ* +__¤c +)) + +172 ià( + `__bos + ( +__de¡ +è!ð( +size_t +) -1) + +173  + `__wýýy_chk + ( +__de¡ +, +__¤c +, + `__bos + (__de¡è/  ( +wch¬_t +)); + +174  + `__wýýy_®Ÿs + ( +__de¡ +, +__¤c +); + +175 + } +} + +178 +wch¬_t + * + $__wc¢ýy_chk + ( +wch¬_t + * +__»¡riù + +__de¡ +, + +179 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, +size_t + +__n +, + +180 +size_t + +__de¡Ën +è +__THROW +; + +181 +wch¬_t + * + `__REDIRECT_NTH + ( +__wc¢ýy_®Ÿs +, + +182 ( +wch¬_t + * +__»¡riù + +__de¡ +, + +183 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, + +184 +size_t + +__n +), +wc¢ýy +); + +185 +wch¬_t + * + `__REDIRECT_NTH + ( +__wc¢ýy_chk_w¬n +, + +186 ( +wch¬_t + * +__»¡riù + +__de¡ +, + +187 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, + +188 +size_t + +__n +, size_ˆ +__de¡Ën +), +__wc¢ýy_chk +) + +189 + `__w¬Ç‰r + ("wcsncpy called with†ength biggerhan size of destination " + +192 +__ex‹º_®ways_šlše + +wch¬_t + * + +193 + `__NTH + ( + $wc¢ýy + ( +wch¬_t + * +__de¡ +, +__cÚ¡ + wch¬_ˆ* +__¤c +, +size_t + +__n +)) + +195 ià( + `__bos + ( +__de¡ +è!ð( +size_t +) -1) + +197 ià(! + `__bužtš_cÚ¡ªt_p + ( +__n +)) + +198  + `__wc¢ýy_chk + ( +__de¡ +, +__¤c +, +__n +, + +199 + `__bos + ( +__de¡ +è/  ( +wch¬_t +)); + +200 ià( +__n + > + `__bos + ( +__de¡ +è/  ( +wch¬_t +)) + +201  + `__wc¢ýy_chk_w¬n + ( +__de¡ +, +__¤c +, +__n +, + +202 + `__bos + ( +__de¡ +è/  ( +wch¬_t +)); + +204  + `__wc¢ýy_®Ÿs + ( +__de¡ +, +__¤c +, +__n +); + +205 + } +} + +208 +wch¬_t + * + $__wýnýy_chk + ( +wch¬_t + * +__»¡riù + +__de¡ +, + +209 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, +size_t + +__n +, + +210 +size_t + +__de¡Ën +è +__THROW +; + +211 +wch¬_t + * + `__REDIRECT_NTH + ( +__wýnýy_®Ÿs +, + +212 ( +wch¬_t + * +__»¡riù + +__de¡ +, + +213 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, + +214 +size_t + +__n +), +wýnýy +); + +215 +wch¬_t + * + `__REDIRECT_NTH + ( +__wýnýy_chk_w¬n +, + +216 ( +wch¬_t + * +__»¡riù + +__de¡ +, + +217 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, + +218 +size_t + +__n +, size_ˆ +__de¡Ën +), +__wýnýy_chk +) + +219 + `__w¬Ç‰r + ("wcpncpy called with†ength biggerhan size of destination " + +222 +__ex‹º_®ways_šlše + +wch¬_t + * + +223 + `__NTH + ( + $wýnýy + ( +wch¬_t + * +__de¡ +, +__cÚ¡ + wch¬_ˆ* +__¤c +, +size_t + +__n +)) + +225 ià( + `__bos + ( +__de¡ +è!ð( +size_t +) -1) + +227 ià(! + `__bužtš_cÚ¡ªt_p + ( +__n +)) + +228  + `__wýnýy_chk + ( +__de¡ +, +__¤c +, +__n +, + +229 + `__bos + ( +__de¡ +è/  ( +wch¬_t +)); + +230 ià( +__n + > + `__bos + ( +__de¡ +è/  ( +wch¬_t +)) + +231  + `__wýnýy_chk_w¬n + ( +__de¡ +, +__¤c +, +__n +, + +232 + `__bos + ( +__de¡ +è/  ( +wch¬_t +)); + +234  + `__wýnýy_®Ÿs + ( +__de¡ +, +__¤c +, +__n +); + +235 + } +} + +238 +wch¬_t + * + $__wcsÿt_chk + ( +wch¬_t + * +__»¡riù + +__de¡ +, + +239 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, + +240 +size_t + +__de¡Ën +è +__THROW +; + +241 +wch¬_t + * + `__REDIRECT_NTH + ( +__wcsÿt_®Ÿs +, + +242 ( +wch¬_t + * +__»¡riù + +__de¡ +, + +243 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +), +wcsÿt +); + +245 +__ex‹º_®ways_šlše + +wch¬_t + * + +246 + `__NTH + ( + $wcsÿt + ( +wch¬_t + * +__de¡ +, +__cÚ¡ + wch¬_ˆ* +__¤c +)) + +248 ià( + `__bos + ( +__de¡ +è!ð( +size_t +) -1) + +249  + `__wcsÿt_chk + ( +__de¡ +, +__¤c +, + `__bos + (__de¡è/  ( +wch¬_t +)); + +250  + `__wcsÿt_®Ÿs + ( +__de¡ +, +__¤c +); + +251 + } +} + +254 +wch¬_t + * + $__wc¢ÿt_chk + ( +wch¬_t + * +__»¡riù + +__de¡ +, + +255 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, + +256 +size_t + +__n +, size_ˆ +__de¡Ën +è +__THROW +; + +257 +wch¬_t + * + `__REDIRECT_NTH + ( +__wc¢ÿt_®Ÿs +, + +258 ( +wch¬_t + * +__»¡riù + +__de¡ +, + +259 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, + +260 +size_t + +__n +), +wc¢ÿt +); + +262 +__ex‹º_®ways_šlše + +wch¬_t + * + +263 + `__NTH + ( + $wc¢ÿt + ( +wch¬_t + * +__de¡ +, +__cÚ¡ + wch¬_ˆ* +__¤c +, +size_t + +__n +)) + +265 ià( + `__bos + ( +__de¡ +è!ð( +size_t +) -1) + +266  + `__wc¢ÿt_chk + ( +__de¡ +, +__¤c +, +__n +, + +267 + `__bos + ( +__de¡ +è/  ( +wch¬_t +)); + +268  + `__wc¢ÿt_®Ÿs + ( +__de¡ +, +__¤c +, +__n +); + +269 + } +} + +272  + $__sw´štf_chk + ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__n +, + +273  +__æag +, +size_t + +__s_Ën +, + +274 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...) + +275 +__THROW + ; + +277  + `__REDIRECT_NTH_LDBL + ( +__sw´štf_®Ÿs +, + +278 ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__n +, + +279 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fmt +, ...), + +280 +sw´štf +); + +282 #ifdeà +__va_¬g_·ck + + +283 +__ex‹º_®ways_šlše +  + +284 + `__NTH + ( + $sw´štf + ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__n +, + +285 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fmt +, ...)) + +287 ià( + `__bos + ( +__s +è!ð( +size_t +è-1 || +__USE_FORTIFY_LEVEL + > 1) + +288  + `__sw´štf_chk + ( +__s +, +__n +, +__USE_FORTIFY_LEVEL + - 1, + +289 + `__bos + ( +__s +è/  ( +wch¬_t +), + +290 +__fmt +, + `__va_¬g_·ck + ()); + +291  + `__sw´štf_®Ÿs + ( +__s +, +__n +, +__fmt +, + `__va_¬g_·ck + ()); + +292 + } +} + +293 #–ià! +defšed + +__ýlu¥lus + + +295  + #sw´štf +( +s +, +n +, ...) \ + +296 ( + `__bos + ( +s +è!ð( +size_t +è-1 || +__USE_FORTIFY_LEVEL + > 1 \ + +297 ? + `__sw´štf_chk + ( +s +, +n +, +__USE_FORTIFY_LEVEL + - 1, \ + +298 + `__bos + ( +s +è/  ( +wch¬_t +), +__VA_ARGS__ +) \ + +299 : + `sw´štf + ( +s +, +n +, +__VA_ARGS__ +)) + + ) + +302  + $__vsw´štf_chk + ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__n +, + +303  +__æag +, +size_t + +__s_Ën +, + +304 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +305 +__gnuc_va_li¡ + +__¬g +) + +306 +__THROW + ; + +308  + `__REDIRECT_NTH_LDBL + ( +__vsw´štf_®Ÿs +, + +309 ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__n +, + +310 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fmt +, + +311 +__gnuc_va_li¡ + +__­ +), +vsw´štf +); + +313 +__ex‹º_®ways_šlše +  + +314 + `__NTH + ( + $vsw´štf + ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__n +, + +315 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fmt +, +__gnuc_va_li¡ + +__­ +)) + +317 ià( + `__bos + ( +__s +è!ð( +size_t +è-1 || +__USE_FORTIFY_LEVEL + > 1) + +318  + `__vsw´štf_chk + ( +__s +, +__n +, +__USE_FORTIFY_LEVEL + - 1, + +319 + `__bos + ( +__s +è/  ( +wch¬_t +), +__fmt +, +__­ +); + +320  + `__vsw´štf_®Ÿs + ( +__s +, +__n +, +__fmt +, +__­ +); + +321 + } +} + +324 #ià +__USE_FORTIFY_LEVEL + > 1 + +326  +__fw´štf_chk + ( +__FILE + * +__»¡riù + +__¡»am +,  +__æag +, + +327 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...); + +328  +__w´štf_chk + ( +__æag +, +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +330  +__vfw´štf_chk + ( +__FILE + * +__»¡riù + +__¡»am +,  +__æag +, + +331 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +332 +__gnuc_va_li¡ + +__­ +); + +333  +__vw´štf_chk + ( +__æag +, +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +334 +__gnuc_va_li¡ + +__­ +); + +336 #ifdeà +__va_¬g_·ck + + +337 +__ex‹º_®ways_šlše +  + +338 + $w´štf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fmt +, ...) + +340  + `__w´štf_chk + ( +__USE_FORTIFY_LEVEL + - 1, +__fmt +, + `__va_¬g_·ck + ()); + +341 + } +} + +343 +__ex‹º_®ways_šlše +  + +344 + $fw´štf + ( +__FILE + * +__»¡riù + +__¡»am +, +__cÚ¡ + +wch¬_t + *__»¡riù +__fmt +, ...) + +346  + `__fw´štf_chk + ( +__¡»am +, +__USE_FORTIFY_LEVEL + - 1, +__fmt +, + +347 + `__va_¬g_·ck + ()); + +348 + } +} + +349 #–ià! +defšed + +__ýlu¥lus + + +350  + #w´štf +(...) \ + +351 + `__w´štf_chk + ( +__USE_FORTIFY_LEVEL + - 1, +__VA_ARGS__ +) + + ) + +352  + #fw´štf +( +¡»am +, ...) \ + +353 + `__fw´štf_chk + ( +¡»am +, +__USE_FORTIFY_LEVEL + - 1, +__VA_ARGS__ +) + + ) + +356 +__ex‹º_®ways_šlše +  + +357 + $vw´štf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fmt +, +__gnuc_va_li¡ + +__­ +) + +359  + `__vw´štf_chk + ( +__USE_FORTIFY_LEVEL + - 1, +__fmt +, +__­ +); + +360 + } +} + +362 +__ex‹º_®ways_šlše +  + +363 + $vfw´štf + ( +__FILE + * +__»¡riù + +__¡»am +, + +364 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fmt +, +__gnuc_va_li¡ + +__­ +) + +366  + `__vfw´štf_chk + ( +__¡»am +, +__USE_FORTIFY_LEVEL + - 1, +__fmt +, +__­ +); + +367 + } +} + +371 +wch¬_t + * + $__fg‘ws_chk + ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__size +,  +__n +, + +372 +__FILE + * +__»¡riù + +__¡»am +è +__wur +; + +373 +wch¬_t + * + `__REDIRECT + ( +__fg‘ws_®Ÿs +, + +374 ( +wch¬_t + * +__»¡riù + +__s +,  +__n +, + +375 +__FILE + * +__»¡riù + +__¡»am +), +fg‘ws +è +__wur +; + +376 +wch¬_t + * + `__REDIRECT + ( +__fg‘ws_chk_w¬n +, + +377 ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__size +,  +__n +, + +378 +__FILE + * +__»¡riù + +__¡»am +), +__fg‘ws_chk +) + +379 +__wur + + `__w¬Ç‰r + ("fgetws called with bigger sizehan†ength " + +382 +__ex‹º_®ways_šlše + +__wur + +wch¬_t + * + +383 + $fg‘ws + ( +wch¬_t + * +__»¡riù + +__s +,  +__n +, +__FILE + *__»¡riù +__¡»am +) + +385 ià( + `__bos + ( +__s +è!ð( +size_t +) -1) + +387 ià(! + `__bužtš_cÚ¡ªt_p + ( +__n +) || __n <= 0) + +388  + `__fg‘ws_chk + ( +__s +, + `__bos + (__sè/  ( +wch¬_t +), + +389 +__n +, +__¡»am +); + +391 ià(( +size_t +è +__n + > + `__bos + ( +__s +è/  ( +wch¬_t +)) + +392  + `__fg‘ws_chk_w¬n + ( +__s +, + `__bos + (__sè/  ( +wch¬_t +), + +393 +__n +, +__¡»am +); + +395  + `__fg‘ws_®Ÿs + ( +__s +, +__n +, +__¡»am +); + +396 + } +} + +398 #ifdeà +__USE_GNU + + +399 +wch¬_t + * + $__fg‘ws_uÆocked_chk + ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__size +, + +400  +__n +, +__FILE + * +__»¡riù + +__¡»am +) + +401 +__wur +; + +402 +wch¬_t + * + `__REDIRECT + ( +__fg‘ws_uÆocked_®Ÿs +, + +403 ( +wch¬_t + * +__»¡riù + +__s +,  +__n +, + +404 +__FILE + * +__»¡riù + +__¡»am +), +fg‘ws_uÆocked +) + +405 +__wur +; + +406 +wch¬_t + * + `__REDIRECT + ( +__fg‘ws_uÆocked_chk_w¬n +, + +407 ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__size +,  +__n +, + +408 +__FILE + * +__»¡riù + +__¡»am +), + +409 +__fg‘ws_uÆocked_chk +) + +410 +__wur + + `__w¬Ç‰r + ("fgetws_unlocked called with bigger sizehan†ength " + +413 +__ex‹º_®ways_šlše + +__wur + +wch¬_t + * + +414 + $fg‘ws_uÆocked + ( +wch¬_t + * +__»¡riù + +__s +,  +__n +, +__FILE + *__»¡riù +__¡»am +) + +416 ià( + `__bos + ( +__s +è!ð( +size_t +) -1) + +418 ià(! + `__bužtš_cÚ¡ªt_p + ( +__n +) || __n <= 0) + +419  + `__fg‘ws_uÆocked_chk + ( +__s +, + `__bos + (__sè/  ( +wch¬_t +), + +420 +__n +, +__¡»am +); + +422 ià(( +size_t +è +__n + > + `__bos + ( +__s +è/  ( +wch¬_t +)) + +423  + `__fg‘ws_uÆocked_chk_w¬n + ( +__s +, + `__bos + (__sè/  ( +wch¬_t +), + +424 +__n +, +__¡»am +); + +426  + `__fg‘ws_uÆocked_®Ÿs + ( +__s +, +__n +, +__¡»am +); + +427 + } +} + +431 +size_t + + $__wütomb_chk + (* +__s +, +wch¬_t + +__wch¬ +, +mb¡©e_t + * +__p +, + +432 +size_t + +__buæ’ +è +__THROW + +__wur +; + +433 +size_t + + `__REDIRECT_NTH + ( +__wütomb_®Ÿs +, + +434 (* +__»¡riù + +__s +, +wch¬_t + +__wch¬ +, + +435 +mb¡©e_t + * +__»¡riù + +__ps +), +wütomb +è +__wur +; + +437 +__ex‹º_®ways_šlše + +__wur + +size_t + + +438 + `__NTH + ( + $wütomb + (* +__s +, +wch¬_t + +__wch¬ +, +mb¡©e_t + * +__ps +)) + +443  + #__WCHAR_MB_LEN_MAX + 16 + + ) + +444 #ià +defšed + +MB_LEN_MAX + && MB_LEN_MAX !ð +__WCHAR_MB_LEN_MAX + + +447 ià( + `__bos + ( +__s +è!ð( +size_t +è-1 && +__WCHAR_MB_LEN_MAX + > __bos (__s)) + +448  + `__wütomb_chk + ( +__s +, +__wch¬ +, +__ps +, + `__bos + (__s)); + +449  + `__wütomb_®Ÿs + ( +__s +, +__wch¬ +, +__ps +); + +450 + } +} + +453 +size_t + + $__mb¤towcs_chk + ( +wch¬_t + * +__»¡riù + +__d¡ +, + +454 +__cÚ¡ + ** +__»¡riù + +__¤c +, + +455 +size_t + +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +, + +456 +size_t + +__d¡Ën +è +__THROW +; + +457 +size_t + + `__REDIRECT_NTH + ( +__mb¤towcs_®Ÿs +, + +458 ( +wch¬_t + * +__»¡riù + +__d¡ +, + +459 +__cÚ¡ + ** +__»¡riù + +__¤c +, + +460 +size_t + +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +), + +461 +mb¤towcs +); + +462 +size_t + + `__REDIRECT_NTH + ( +__mb¤towcs_chk_w¬n +, + +463 ( +wch¬_t + * +__»¡riù + +__d¡ +, + +464 +__cÚ¡ + ** +__»¡riù + +__¤c +, + +465 +size_t + +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +, + +466 +size_t + +__d¡Ën +), +__mb¤towcs_chk +) + +467 + `__w¬Ç‰r + ("mbsrtowcs called with dst buffer smallerhan†en " + +470 +__ex‹º_®ways_šlše + +size_t + + +471 + `__NTH + ( + $mb¤towcs + ( +wch¬_t + * +__»¡riù + +__d¡ +, +__cÚ¡ + **__»¡riù +__¤c +, + +472 +size_t + +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +)) + +474 ià( + `__bos + ( +__d¡ +è!ð( +size_t +) -1) + +476 ià(! + `__bužtš_cÚ¡ªt_p + ( +__Ën +)) + +477  + `__mb¤towcs_chk + ( +__d¡ +, +__¤c +, +__Ën +, +__ps +, + +478 + `__bos + ( +__d¡ +è/  ( +wch¬_t +)); + +480 ià( +__Ën + > + `__bos + ( +__d¡ +è/  ( +wch¬_t +)) + +481  + `__mb¤towcs_chk_w¬n + ( +__d¡ +, +__¤c +, +__Ën +, +__ps +, + +482 + `__bos + ( +__d¡ +è/  ( +wch¬_t +)); + +484  + `__mb¤towcs_®Ÿs + ( +__d¡ +, +__¤c +, +__Ën +, +__ps +); + +485 + } +} + +488 +size_t + + $__wc¤tombs_chk + (* +__»¡riù + +__d¡ +, + +489 +__cÚ¡ + +wch¬_t + ** +__»¡riù + +__¤c +, + +490 +size_t + +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +, + +491 +size_t + +__d¡Ën +è +__THROW +; + +492 +size_t + + `__REDIRECT_NTH + ( +__wc¤tombs_®Ÿs +, + +493 (* +__»¡riù + +__d¡ +, + +494 +__cÚ¡ + +wch¬_t + ** +__»¡riù + +__¤c +, + +495 +size_t + +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +), + +496 +wc¤tombs +); + +497 +size_t + + `__REDIRECT_NTH + ( +__wc¤tombs_chk_w¬n +, + +498 (* +__»¡riù + +__d¡ +, + +499 +__cÚ¡ + +wch¬_t + ** +__»¡riù + +__¤c +, + +500 +size_t + +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +, + +501 +size_t + +__d¡Ën +), +__wc¤tombs_chk +) + +502 + `__w¬Ç‰r + ("wcsrtombs called with dst buffer smallerhan†en"); + +504 +__ex‹º_®ways_šlše + +size_t + + +505 + `__NTH + ( + $wc¤tombs + (* +__»¡riù + +__d¡ +, +__cÚ¡ + +wch¬_t + **__»¡riù +__¤c +, + +506 +size_t + +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +)) + +508 ià( + `__bos + ( +__d¡ +è!ð( +size_t +) -1) + +510 ià(! + `__bužtš_cÚ¡ªt_p + ( +__Ën +)) + +511  + `__wc¤tombs_chk + ( +__d¡ +, +__¤c +, +__Ën +, +__ps +, + `__bos + (__dst)); + +513 ià( +__Ën + > + `__bos + ( +__d¡ +)) + +514  + `__wc¤tombs_chk_w¬n + ( +__d¡ +, +__¤c +, +__Ën +, +__ps +, + `__bos + (__dst)); + +516  + `__wc¤tombs_®Ÿs + ( +__d¡ +, +__¤c +, +__Ën +, +__ps +); + +517 + } +} + +520 #ifdeà +__USE_GNU + + +521 +size_t + + $__mb¢¹owcs_chk + ( +wch¬_t + * +__»¡riù + +__d¡ +, + +522 +__cÚ¡ + ** +__»¡riù + +__¤c +, +size_t + +__nmc +, + +523 +size_t + +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +, + +524 +size_t + +__d¡Ën +è +__THROW +; + +525 +size_t + + `__REDIRECT_NTH + ( +__mb¢¹owcs_®Ÿs +, + +526 ( +wch¬_t + * +__»¡riù + +__d¡ +, + +527 +__cÚ¡ + ** +__»¡riù + +__¤c +, +size_t + +__nmc +, + +528 +size_t + +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +), + +529 +mb¢¹owcs +); + +530 +size_t + + `__REDIRECT_NTH + ( +__mb¢¹owcs_chk_w¬n +, + +531 ( +wch¬_t + * +__»¡riù + +__d¡ +, + +532 +__cÚ¡ + ** +__»¡riù + +__¤c +, +size_t + +__nmc +, + +533 +size_t + +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +, + +534 +size_t + +__d¡Ën +), +__mb¢¹owcs_chk +) + +535 + `__w¬Ç‰r + ("mbsnrtowcs called with dst buffer smallerhan†en " + +538 +__ex‹º_®ways_šlše + +size_t + + +539 + `__NTH + ( + $mb¢¹owcs + ( +wch¬_t + * +__»¡riù + +__d¡ +, +__cÚ¡ + **__»¡riù +__¤c +, + +540 +size_t + +__nmc +, size_ˆ +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +)) + +542 ià( + `__bos + ( +__d¡ +è!ð( +size_t +) -1) + +544 ià(! + `__bužtš_cÚ¡ªt_p + ( +__Ën +)) + +545  + `__mb¢¹owcs_chk + ( +__d¡ +, +__¤c +, +__nmc +, +__Ën +, +__ps +, + +546 + `__bos + ( +__d¡ +è/  ( +wch¬_t +)); + +548 ià( +__Ën + > + `__bos + ( +__d¡ +è/  ( +wch¬_t +)) + +549  + `__mb¢¹owcs_chk_w¬n + ( +__d¡ +, +__¤c +, +__nmc +, +__Ën +, +__ps +, + +550 + `__bos + ( +__d¡ +è/  ( +wch¬_t +)); + +552  + `__mb¢¹owcs_®Ÿs + ( +__d¡ +, +__¤c +, +__nmc +, +__Ën +, +__ps +); + +553 + } +} + +556 +size_t + + $__wc¢¹ombs_chk + (* +__»¡riù + +__d¡ +, + +557 +__cÚ¡ + +wch¬_t + ** +__»¡riù + +__¤c +, + +558 +size_t + +__nwc +, size_ˆ +__Ën +, + +559 +mb¡©e_t + * +__»¡riù + +__ps +, +size_t + +__d¡Ën +) + +560 +__THROW +; + +561 +size_t + + `__REDIRECT_NTH + ( +__wc¢¹ombs_®Ÿs +, + +562 (* +__»¡riù + +__d¡ +, + +563 +__cÚ¡ + +wch¬_t + ** +__»¡riù + +__¤c +, + +564 +size_t + +__nwc +, size_ˆ +__Ën +, + +565 +mb¡©e_t + * +__»¡riù + +__ps +), +wc¢¹ombs +); + +566 +size_t + + `__REDIRECT_NTH + ( +__wc¢¹ombs_chk_w¬n +, + +567 (* +__»¡riù + +__d¡ +, + +568 +__cÚ¡ + +wch¬_t + ** +__»¡riù + +__¤c +, + +569 +size_t + +__nwc +, size_ˆ +__Ën +, + +570 +mb¡©e_t + * +__»¡riù + +__ps +, + +571 +size_t + +__d¡Ën +), +__wc¢¹ombs_chk +) + +572 + `__w¬Ç‰r + ("wcsnrtombs called with dst buffer smallerhan†en"); + +574 +__ex‹º_®ways_šlše + +size_t + + +575 + `__NTH + ( + $wc¢¹ombs + (* +__»¡riù + +__d¡ +, +__cÚ¡ + +wch¬_t + **__»¡riù +__¤c +, + +576 +size_t + +__nwc +, size_ˆ +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +)) + +578 ià( + `__bos + ( +__d¡ +è!ð( +size_t +) -1) + +580 ià(! + `__bužtš_cÚ¡ªt_p + ( +__Ën +)) + +581  + `__wc¢¹ombs_chk + ( +__d¡ +, +__¤c +, +__nwc +, +__Ën +, +__ps +, + +582 + `__bos + ( +__d¡ +)); + +584 ià( +__Ën + > + `__bos + ( +__d¡ +)) + +585  + `__wc¢¹ombs_chk_w¬n + ( +__d¡ +, +__¤c +, +__nwc +, +__Ën +, +__ps +, + +586 + `__bos + ( +__d¡ +)); + +588  + `__wc¢¹ombs_®Ÿs + ( +__d¡ +, +__¤c +, +__nwc +, +__Ën +, +__ps +); + +589 + } +} + + @/usr/include/errno.h + +23 #iâdef +_ERRNO_H + + +27 #iâdef +__Ãed_Em©h + + +28  + #_ERRNO_H + 1 + + ) + +29  + ~<ã©u»s.h +> + +32 + g__BEGIN_DECLS + + +36  + ~ + +37 #undeà +__Ãed_Em©h + + +39 #ifdef +_ERRNO_H + + +46 #iâdef +”ºo + + +47  +”ºo +; + +50 #ifdeà +__USE_GNU + + +55 * +´og¿m_švoÿtiÚ_Çme +, * +´og¿m_švoÿtiÚ_shÜt_Çme +; + +59 + g__END_DECLS + + +67 #ià +defšed + +__USE_GNU + || defšed +__Ãed_”rÜ_t + + +68 #iâdeà +__”rÜ_t_defšed + + +69  + t”rÜ_t +; + +70  + #__”rÜ_t_defšed + 1 + + ) + +72 #undeà +__Ãed_”rÜ_t + + + @/usr/include/gnu/option-groups.h + +10 #iâdeà +__GNU_OPTION_GROUPS_H + + +11  + #__GNU_OPTION_GROUPS_H + + + ) + +13  + #__OPTION_EGLIBC_ADVANCED_INET6 + 1 + + ) + +14  + #__OPTION_EGLIBC_BACKTRACE + 1 + + ) + +15  + #__OPTION_EGLIBC_BIG_MACROS + 1 + + ) + +16  + #__OPTION_EGLIBC_BSD + 1 + + ) + +17  + #__OPTION_EGLIBC_CATGETS + 1 + + ) + +18  + #__OPTION_EGLIBC_CHARSETS + 1 + + ) + +19  + #__OPTION_EGLIBC_CXX_TESTS + 1 + + ) + +20  + #__OPTION_EGLIBC_DB_ALIASES + 1 + + ) + +21  + #__OPTION_EGLIBC_ENVZ + 1 + + ) + +22  + #__OPTION_EGLIBC_FCVT + 1 + + ) + +23  + #__OPTION_EGLIBC_FMTMSG + 1 + + ) + +24  + #__OPTION_EGLIBC_FSTAB + 1 + + ) + +25  + #__OPTION_EGLIBC_FTRAVERSE + 1 + + ) + +26  + #__OPTION_EGLIBC_GETLOGIN + 1 + + ) + +27  + #__OPTION_EGLIBC_INET + 1 + + ) + +28  + #__OPTION_EGLIBC_LIBM + 1 + + ) + +29  + #__OPTION_EGLIBC_LOCALES + 1 + + ) + +30  + #__OPTION_EGLIBC_LOCALE_CODE + 1 + + ) + +31  + #__OPTION_EGLIBC_MEMUSAGE + 1 + + ) + +32  + #__OPTION_EGLIBC_NIS + 1 + + ) + +33  + #__OPTION_EGLIBC_NSSWITCH + 1 + + ) + +34  + #__OPTION_EGLIBC_RCMD + 1 + + ) + +35  + #__OPTION_EGLIBC_SPAWN + 1 + + ) + +36  + #__OPTION_EGLIBC_STREAMS + 1 + + ) + +37  + #__OPTION_EGLIBC_SUNRPC + 1 + + ) + +38  + #__OPTION_EGLIBC_UTMP + 1 + + ) + +39  + #__OPTION_EGLIBC_UTMPX + 1 + + ) + +40  + #__OPTION_EGLIBC_WORDEXP + 1 + + ) + +41  + #__OPTION_POSIX_C_LANG_WIDE_CHAR + 1 + + ) + +42  + #__OPTION_POSIX_REGEXP + 1 + + ) + +43  + #__OPTION_POSIX_REGEXP_GLIBC + 1 + + ) + +44  + #__OPTION_POSIX_WIDE_CHAR_DEVICE_IO + 1 + + ) + + @/usr/include/pthread.h + +20 #iâdeà +_PTHREAD_H + + +21  + #_PTHREAD_H + 1 + + ) + +23  + ~<ã©u»s.h +> + +24  + ~<’dŸn.h +> + +25  + ~ + +26  + ~ + +28  + #__Ãed_sig£t_t + + + ) + +29  + ~ + +30  + ~ + +31  + ~ + +32  + ~ + +38 + mPTHREAD_CREATE_JOINABLE +, + +39  + #PTHREAD_CREATE_JOINABLE + +PTHREAD_CREATE_JOINABLE + + + ) + +40 + mPTHREAD_CREATE_DETACHED + + +41  + #PTHREAD_CREATE_DETACHED + +PTHREAD_CREATE_DETACHED + + + ) + +48 + mPTHREAD_MUTEX_TIMED_NP +, + +49 + mPTHREAD_MUTEX_RECURSIVE_NP +, + +50 + mPTHREAD_MUTEX_ERRORCHECK_NP +, + +51 + mPTHREAD_MUTEX_ADAPTIVE_NP + + +52 #ifdeà +__USE_UNIX98 + + +54 + mPTHREAD_MUTEX_NORMAL + = +PTHREAD_MUTEX_TIMED_NP +, + +55 + mPTHREAD_MUTEX_RECURSIVE + = +PTHREAD_MUTEX_RECURSIVE_NP +, + +56 + mPTHREAD_MUTEX_ERRORCHECK + = +PTHREAD_MUTEX_ERRORCHECK_NP +, + +57 + mPTHREAD_MUTEX_DEFAULT + = +PTHREAD_MUTEX_NORMAL + + +59 #ifdeà +__USE_GNU + + +61 , + mPTHREAD_MUTEX_FAST_NP + = +PTHREAD_MUTEX_TIMED_NP + + +66 #ifdeà +__USE_XOPEN2K + + +70 + mPTHREAD_MUTEX_STALLED +, + +71 + mPTHREAD_MUTEX_STALLED_NP + = +PTHREAD_MUTEX_STALLED +, + +72 + mPTHREAD_MUTEX_ROBUST +, + +73 + mPTHREAD_MUTEX_ROBUST_NP + = +PTHREAD_MUTEX_ROBUST + + +78 #ifdeà +__USE_UNIX98 + + +82 + mPTHREAD_PRIO_NONE +, + +83 + mPTHREAD_PRIO_INHERIT +, + +84 + mPTHREAD_PRIO_PROTECT + + +90 #ià +__WORDSIZE + == 64 + +91  + #PTHREAD_MUTEX_INITIALIZER + \ + +92 { { 0, 0, 0, 0, 0, 0, { 0, 0 } } } + + ) + +93 #ifdeà +__USE_GNU + + +94  + #PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP + \ + +95 { { 0, 0, 0, 0, +PTHREAD_MUTEX_RECURSIVE_NP +, 0, { 0, 0 } } } + + ) + +96  + #PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP + \ + +97 { { 0, 0, 0, 0, +PTHREAD_MUTEX_ERRORCHECK_NP +, 0, { 0, 0 } } } + + ) + +98  + #PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP + \ + +99 { { 0, 0, 0, 0, +PTHREAD_MUTEX_ADAPTIVE_NP +, 0, { 0, 0 } } } + + ) + +102  + #PTHREAD_MUTEX_INITIALIZER + \ + +103 { { 0, 0, 0, 0, 0, { 0 } } } + + ) + +104 #ifdeà +__USE_GNU + + +105  + #PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP + \ + +106 { { 0, 0, 0, +PTHREAD_MUTEX_RECURSIVE_NP +, 0, { 0 } } } + + ) + +107  + #PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP + \ + +108 { { 0, 0, 0, +PTHREAD_MUTEX_ERRORCHECK_NP +, 0, { 0 } } } + + ) + +109  + #PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP + \ + +110 { { 0, 0, 0, +PTHREAD_MUTEX_ADAPTIVE_NP +, 0, { 0 } } } + + ) + +116 #ià +defšed + +__USE_UNIX98 + || defšed +__USE_XOPEN2K + + +119 + mPTHREAD_RWLOCK_PREFER_READER_NP +, + +120 + mPTHREAD_RWLOCK_PREFER_WRITER_NP +, + +121 + mPTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP +, + +122 + mPTHREAD_RWLOCK_DEFAULT_NP + = +PTHREAD_RWLOCK_PREFER_READER_NP + + +126  + #PTHREAD_RWLOCK_INITIALIZER + \ + +127 { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } + + ) + +128 #ifdeà +__USE_GNU + + +129 #ià +__WORDSIZE + == 64 + +130  + #PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP + \ + +132 +PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP + } } + + ) + +134 #ià +__BYTE_ORDER + =ð +__LITTLE_ENDIAN + + +135  + #PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP + \ + +136 { { 0, 0, 0, 0, 0, 0, +PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP +, \ + +137 0, 0, 0, 0 } } + + ) + +139  + #PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP + \ + +140 { { 0, 0, 0, 0, 0, 0, 0, 0, 0, +PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP +,\ + +141 0 } } + + ) + +151 + mPTHREAD_INHERIT_SCHED +, + +152  + #PTHREAD_INHERIT_SCHED + +PTHREAD_INHERIT_SCHED + + + ) + +153 + mPTHREAD_EXPLICIT_SCHED + + +154  + #PTHREAD_EXPLICIT_SCHED + +PTHREAD_EXPLICIT_SCHED + + + ) + +161 + mPTHREAD_SCOPE_SYSTEM +, + +162  + #PTHREAD_SCOPE_SYSTEM + +PTHREAD_SCOPE_SYSTEM + + + ) + +163 + mPTHREAD_SCOPE_PROCESS + + +164  + #PTHREAD_SCOPE_PROCESS + +PTHREAD_SCOPE_PROCESS + + + ) + +171 + mPTHREAD_PROCESS_PRIVATE +, + +172  + #PTHREAD_PROCESS_PRIVATE + +PTHREAD_PROCESS_PRIVATE + + + ) + +173 + mPTHREAD_PROCESS_SHARED + + +174  + #PTHREAD_PROCESS_SHARED + +PTHREAD_PROCESS_SHARED + + + ) + +180  + #PTHREAD_COND_INITIALIZER + { { 0, 0, 0, 0, 0, (*è0, 0, 0 } } + + ) + +184  + s_±h»ad_þ—nup_bufãr + + +186 (* + m__routše +) (*); + +187 * + m__¬g +; + +188  + m__ÿnûÉy³ +; + +189  +_±h»ad_þ—nup_bufãr + * + m__´ev +; + +195 + mPTHREAD_CANCEL_ENABLE +, + +196  + #PTHREAD_CANCEL_ENABLE + +PTHREAD_CANCEL_ENABLE + + + ) + +197 + mPTHREAD_CANCEL_DISABLE + + +198  + #PTHREAD_CANCEL_DISABLE + +PTHREAD_CANCEL_DISABLE + + + ) + +202 + mPTHREAD_CANCEL_DEFERRED +, + +203  + #PTHREAD_CANCEL_DEFERRED + +PTHREAD_CANCEL_DEFERRED + + + ) + +204 + mPTHREAD_CANCEL_ASYNCHRONOUS + + +205  + #PTHREAD_CANCEL_ASYNCHRONOUS + +PTHREAD_CANCEL_ASYNCHRONOUS + + + ) + +207  + #PTHREAD_CANCELED + ((*è-1) + + ) + +211  + #PTHREAD_ONCE_INIT + 0 + + ) + +214 #ifdeà +__USE_XOPEN2K + + +218  + #PTHREAD_BARRIER_SERIAL_THREAD + -1 + + ) + +222 +__BEGIN_DECLS + + +227  +±h»ad_ü—‹ + ( +±h»ad_t + * +__»¡riù + +__Ãwth»ad +, + +228 +__cÚ¡ + +±h»ad_©Œ_t + * +__»¡riù + +__©Œ +, + +229 *(* +__¡¬t_routše +) (*), + +230 * +__»¡riù + +__¬g +è +__THROW + +__nÚnuÎ + ((1, 3)); + +236  + $±h»ad_ex™ + (* +__»tv® +è + `__©Œibu‹__ + (( +__nÜ‘uº__ +)); + +244  + `±h»ad_još + ( +±h»ad_t + +__th +, ** +__th»ad_»tuº +); + +246 #ifdeà +__USE_GNU + + +249  + $±h»ad_Œyjoš_Å + ( +±h»ad_t + +__th +, ** +__th»ad_»tuº +è +__THROW +; + +257  + `±h»ad_timedjoš_Å + ( +±h»ad_t + +__th +, ** +__th»ad_»tuº +, + +258 +__cÚ¡ +  +time¥ec + * +__ab¡ime +); + +265  + $±h»ad_d‘ach + ( +±h»ad_t + +__th +è +__THROW +; + +269 +±h»ad_t + + $±h»ad_£lf + (è +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +272  + $±h»ad_equ® + ( +±h»ad_t + +__th»ad1 +,…th»ad_ˆ +__th»ad2 +è +__THROW +; + +280  + $±h»ad_©Œ_š™ + ( +±h»ad_©Œ_t + * +__©Œ +è +__THROW + + `__nÚnuÎ + ((1)); + +283  + $±h»ad_©Œ_de¡roy + ( +±h»ad_©Œ_t + * +__©Œ +) + +284 +__THROW + + `__nÚnuÎ + ((1)); + +287  + $±h»ad_©Œ_g‘d‘ach¡©e + ( +__cÚ¡ + +±h»ad_©Œ_t + * +__©Œ +, + +288 * +__d‘ach¡©e +) + +289 +__THROW + + `__nÚnuÎ + ((1, 2)); + +292  + $±h»ad_©Œ_£td‘ach¡©e + ( +±h»ad_©Œ_t + * +__©Œ +, + +293  +__d‘ach¡©e +) + +294 +__THROW + + `__nÚnuÎ + ((1)); + +298  + $±h»ad_©Œ_g‘gu¬dsize + ( +__cÚ¡ + +±h»ad_©Œ_t + * +__©Œ +, + +299 +size_t + * +__gu¬dsize +) + +300 +__THROW + + `__nÚnuÎ + ((1, 2)); + +303  + $±h»ad_©Œ_£tgu¬dsize + ( +±h»ad_©Œ_t + * +__©Œ +, + +304 +size_t + +__gu¬dsize +) + +305 +__THROW + + `__nÚnuÎ + ((1)); + +309  + $±h»ad_©Œ_g‘sched·¿m + ( +__cÚ¡ + +±h»ad_©Œ_t + * +__»¡riù + + +310 +__©Œ +, + +311  +sched_·¿m + * +__»¡riù + +__·¿m +) + +312 +__THROW + + `__nÚnuÎ + ((1, 2)); + +315  + $±h»ad_©Œ_£tsched·¿m + ( +±h»ad_©Œ_t + * +__»¡riù + +__©Œ +, + +316 +__cÚ¡ +  +sched_·¿m + * +__»¡riù + + +317 +__·¿m +è +__THROW + + `__nÚnuÎ + ((1, 2)); + +320  + $±h»ad_©Œ_g‘schedpÞicy + ( +__cÚ¡ + +±h»ad_©Œ_t + * +__»¡riù + + +321 +__©Œ +, * +__»¡riù + +__pÞicy +) + +322 +__THROW + + `__nÚnuÎ + ((1, 2)); + +325  + $±h»ad_©Œ_£tschedpÞicy + ( +±h»ad_©Œ_t + * +__©Œ +,  +__pÞicy +) + +326 +__THROW + + `__nÚnuÎ + ((1)); + +329  + $±h»ad_©Œ_g‘šh”™sched + ( +__cÚ¡ + +±h»ad_©Œ_t + * +__»¡riù + + +330 +__©Œ +, * +__»¡riù + +__šh”™ +) + +331 +__THROW + + `__nÚnuÎ + ((1, 2)); + +334  + $±h»ad_©Œ_£tšh”™sched + ( +±h»ad_©Œ_t + * +__©Œ +, + +335  +__šh”™ +) + +336 +__THROW + + `__nÚnuÎ + ((1)); + +340  + $±h»ad_©Œ_g‘scÝe + ( +__cÚ¡ + +±h»ad_©Œ_t + * +__»¡riù + +__©Œ +, + +341 * +__»¡riù + +__scÝe +) + +342 +__THROW + + `__nÚnuÎ + ((1, 2)); + +345  + $±h»ad_©Œ_£tscÝe + ( +±h»ad_©Œ_t + * +__©Œ +,  +__scÝe +) + +346 +__THROW + + `__nÚnuÎ + ((1)); + +349  + $±h»ad_©Œ_g‘¡ackaddr + ( +__cÚ¡ + +±h»ad_©Œ_t + * +__»¡riù + + +350 +__©Œ +, ** +__»¡riù + +__¡ackaddr +) + +351 +__THROW + + `__nÚnuÎ + ((1, 2)è +__©Œibu‹_d•»ÿ‹d__ +; + +357  + $±h»ad_©Œ_£t¡ackaddr + ( +±h»ad_©Œ_t + * +__©Œ +, + +358 * +__¡ackaddr +) + +359 +__THROW + + `__nÚnuÎ + ((1)è +__©Œibu‹_d•»ÿ‹d__ +; + +362  + $±h»ad_©Œ_g‘¡acksize + ( +__cÚ¡ + +±h»ad_©Œ_t + * +__»¡riù + + +363 +__©Œ +, +size_t + * +__»¡riù + +__¡acksize +) + +364 +__THROW + + `__nÚnuÎ + ((1, 2)); + +369  + $±h»ad_©Œ_£t¡acksize + ( +±h»ad_©Œ_t + * +__©Œ +, + +370 +size_t + +__¡acksize +) + +371 +__THROW + + `__nÚnuÎ + ((1)); + +373 #ifdeà +__USE_XOPEN2K + + +375  + $±h»ad_©Œ_g‘¡ack + ( +__cÚ¡ + +±h»ad_©Œ_t + * +__»¡riù + +__©Œ +, + +376 ** +__»¡riù + +__¡ackaddr +, + +377 +size_t + * +__»¡riù + +__¡acksize +) + +378 +__THROW + + `__nÚnuÎ + ((1, 2, 3)); + +383  + $±h»ad_©Œ_£t¡ack + ( +±h»ad_©Œ_t + * +__©Œ +, * +__¡ackaddr +, + +384 +size_t + +__¡acksize +è +__THROW + + `__nÚnuÎ + ((1)); + +387 #ifdeà +__USE_GNU + + +390  + $±h»ad_©Œ_£ffš™y_Å + ( +±h»ad_©Œ_t + * +__©Œ +, + +391 +size_t + +__ýu£tsize +, + +392 +__cÚ¡ + +ýu_£t_t + * +__ýu£t +) + +393 +__THROW + + `__nÚnuÎ + ((1, 3)); + +397  + $±h»ad_©Œ_g‘affš™y_Å + ( +__cÚ¡ + +±h»ad_©Œ_t + * +__©Œ +, + +398 +size_t + +__ýu£tsize +, + +399 +ýu_£t_t + * +__ýu£t +) + +400 +__THROW + + `__nÚnuÎ + ((1, 3)); + +406  + $±h»ad_g‘©Œ_Å + ( +±h»ad_t + +__th +, +±h»ad_©Œ_t + * +__©Œ +) + +407 +__THROW + + `__nÚnuÎ + ((2)); + +415  + $±h»ad_£tsched·¿m + ( +±h»ad_t + +__rg‘_th»ad +,  +__pÞicy +, + +416 +__cÚ¡ +  +sched_·¿m + * +__·¿m +) + +417 +__THROW + + `__nÚnuÎ + ((3)); + +420  + $±h»ad_g‘sched·¿m + ( +±h»ad_t + +__rg‘_th»ad +, + +421 * +__»¡riù + +__pÞicy +, + +422  +sched_·¿m + * +__»¡riù + +__·¿m +) + +423 +__THROW + + `__nÚnuÎ + ((2, 3)); + +426  + $±h»ad_£tsched´io + ( +±h»ad_t + +__rg‘_th»ad +,  +__´io +) + +427 +__THROW +; + +430 #ifdeà +__USE_UNIX98 + + +432  + $±h»ad_g‘cÚcu¼’cy + (è +__THROW +; + +435  + $±h»ad_£tcÚcu¼’cy + ( +__Ëv– +è +__THROW +; + +438 #ifdeà +__USE_GNU + + +443  + $±h»ad_y›ld + (è +__THROW +; + +448  + $±h»ad_£ffš™y_Å + ( +±h»ad_t + +__th +, +size_t + +__ýu£tsize +, + +449 +__cÚ¡ + +ýu_£t_t + * +__ýu£t +) + +450 +__THROW + + `__nÚnuÎ + ((3)); + +453  + $±h»ad_g‘affš™y_Å + ( +±h»ad_t + +__th +, +size_t + +__ýu£tsize +, + +454 +ýu_£t_t + * +__ýu£t +) + +455 +__THROW + + `__nÚnuÎ + ((3)); + +468  + `±h»ad_Úû + ( +±h»ad_Úû_t + * +__Úû_cÚŒÞ +, + +469 (* +__š™_routše +è()è + `__nÚnuÎ + ((1, 2)); + +480  + `±h»ad_£tÿnûl¡©e + ( +__¡©e +, * +__Þd¡©e +); + +484  + `±h»ad_£tÿnûÉy³ + ( +__ty³ +, * +__Þdty³ +); + +487  + `±h»ad_ÿnûl + ( +±h»ad_t + +__th +); + +492  + `±h»ad_‹¡ÿnûl + (); + +501 +__jmp_buf + +__ÿnûl_jmp_buf +; + +502  +__mask_was_§ved +; + +503 } +__ÿnûl_jmp_buf +[1]; + +504 * +__·d +[4]; + +505 } + t__±h»ad_unwšd_buf_t + + t__©Œibu‹__ + (( + t__®igÃd__ +)); + +508 #iâdeà +__þ—nup_fù_©Œibu‹ + + +509  + #__þ—nup_fù_©Œibu‹ + + + ) + +514  + s__±h»ad_þ—nup_äame + + +516 (* +__ÿnûl_routše +) (*); + +517 * +__ÿnûl_¬g +; + +518  +__do_™ +; + +519  +__ÿnûl_ty³ +; + +522 #ià +defšed + +__GNUC__ + && defšed +__EXCEPTIONS + + +523 #ifdeà +__ýlu¥lus + + +525 þas  + c__±h»ad_þ—nup_þass + + +527 (* +__ÿnûl_routše +) (*); + +528 * +__ÿnûl_¬g +; + +529  +__do_™ +; + +530  +__ÿnûl_ty³ +; + +532 +public +: + +533 + `__±h»ad_þ—nup_þass + ((* +__fù +è(*), * +__¬g +) + +534 : + `__ÿnûl_routše + ( +__fù +), + `__ÿnûl_¬g + ( +__¬g +), + $__do_™ + (1) { } + +535 ~ + $__±h»ad_þ—nup_þass + (è{ ià( +__do_™ +è + `__ÿnûl_routše + ( +__ÿnûl_¬g +); + } +} + +536  + $__£tdo™ + ( +__Ãwv® +è{ +__do_™ + = __Ãwv®; + } +} + +537  + $__deãr + (è{ + `±h»ad_£tÿnûÉy³ + ( +PTHREAD_CANCEL_DEFERRED +, + +538 & +__ÿnûl_ty³ +); + } +} + +539  + $__»¡Üe + (ècÚ¡ { + `±h»ad_£tÿnûÉy³ + ( +__ÿnûl_ty³ +, 0); + } +} + +549  + #±h»ad_þ—nup_push +( +routše +, +¬g +) \ + +551 +__±h»ad_þ—nup_þass + + `__þäame + ( +routše +, +¬g +) + + ) + +555  + #±h»ad_þ—nup_pÝ +( +execu‹ +) \ + +556 +__þäame +. + `__£tdo™ + ( +execu‹ +); \ + +557 } 0) + + ) + +559 #ifdeà +__USE_GNU + + +563  + #±h»ad_þ—nup_push_deãr_Å +( +routše +, +¬g +) \ + +565 +__±h»ad_þ—nup_þass + + `__þäame + ( +routše +, +¬g +); \ + +566 +__þäame +. + `__deãr + () + + ) + +571  + #±h»ad_þ—nup_pÝ_»¡Üe_Å +( +execu‹ +) \ + +572 +__þäame +. + `__»¡Üe + (); \ + +573 +__þäame +. + `__£tdo™ + ( +execu‹ +); \ + +574 } 0) + + ) + +581 +__ex‹º_šlše +  + +582 + $__±h»ad_þ—nup_routše + ( +__±h»ad_þ—nup_äame + * +__äame +) + +584 ià( +__äame +-> +__do_™ +) + +585 +__äame +-> + `__ÿnûl_routše + (__äame-> +__ÿnûl_¬g +); + +586 + } +} + +595  + #±h»ad_þ—nup_push +( +routše +, +¬g +) \ + +597  +__±h»ad_þ—nup_äame + +__þäame + \ + +598 + `__©Œibu‹__ + (( + `__þ—nup__ + ( +__±h»ad_þ—nup_routše +))) \ + +599 ð{ . +__ÿnûl_routše + = ( +routše +), . +__ÿnûl_¬g + = ( +¬g +), \ + +600 . +__do_™ + = 1 }; + + ) + +604  + #±h»ad_þ—nup_pÝ +( +execu‹ +) \ + +605 +__þäame +. +__do_™ + = ( +execu‹ +); \ + +606 } 0) + + ) + +608 #ifdeà +__USE_GNU + + +612  + #±h»ad_þ—nup_push_deãr_Å +( +routše +, +¬g +) \ + +614  +__±h»ad_þ—nup_äame + +__þäame + \ + +615 + `__©Œibu‹__ + (( + `__þ—nup__ + ( +__±h»ad_þ—nup_routše +))) \ + +616 ð{ . +__ÿnûl_routše + = ( +routše +), . +__ÿnûl_¬g + = ( +¬g +), \ + +617 . +__do_™ + = 1 }; \ + +618 (è + `±h»ad_£tÿnûÉy³ + ( +PTHREAD_CANCEL_DEFERRED +, \ + +619 & +__þäame +. +__ÿnûl_ty³ +) + + ) + +624  + #±h»ad_þ—nup_pÝ_»¡Üe_Å +( +execu‹ +) \ + +625 (è + `±h»ad_£tÿnûÉy³ + ( +__þäame +. +__ÿnûl_ty³ +, +NULL +); \ + +626 +__þäame +. +__do_™ + = ( +execu‹ +); \ + +627 } 0) + + ) + +638  + #±h»ad_þ—nup_push +( +routše +, +¬g +) \ + +640 +__±h»ad_unwšd_buf_t + +__ÿnûl_buf +; \ + +641 (* +__ÿnûl_routše +è(*èð( +routše +); \ + +642 * +__ÿnûl_¬g + = ( +¬g +); \ + +643  +nÙ_fœ¡_ÿÎ + = + `__sig£tjmp + (( +__jmp_buf_g + *) (*) \ + +644 +__ÿnûl_buf +. +__ÿnûl_jmp_buf +, 0); \ + +645 ià( + `__bužtš_ex³ù + ( +nÙ_fœ¡_ÿÎ +, 0)) \ + +647 + `__ÿnûl_routše + ( +__ÿnûl_¬g +); \ + +648 + `__±h»ad_unwšd_Ãxt + (& +__ÿnûl_buf +); \ + +652 + `__±h»ad_»gi¡”_ÿnûl + (& +__ÿnûl_buf +); \ + +653 dØ{ + + ) + +654  +__±h»ad_»gi¡”_ÿnûl + ( +__±h»ad_unwšd_buf_t + * +__buf +) + +655 +__þ—nup_fù_©Œibu‹ +; + +659  + #±h»ad_þ—nup_pÝ +( +execu‹ +) \ + +662 + `__±h»ad_uÄegi¡”_ÿnûl + (& +__ÿnûl_buf +); \ + +663 ià( +execu‹ +) \ + +664 + `__ÿnûl_routše + ( +__ÿnûl_¬g +); \ + +665 } 0) + + ) + +666  + $__±h»ad_uÄegi¡”_ÿnûl + ( +__±h»ad_unwšd_buf_t + * +__buf +) + +667 +__þ—nup_fù_©Œibu‹ +; + +669 #ifdeà +__USE_GNU + + +673  + #±h»ad_þ—nup_push_deãr_Å +( +routše +, +¬g +) \ + +675 +__±h»ad_unwšd_buf_t + +__ÿnûl_buf +; \ + +676 (* +__ÿnûl_routše +è(*èð( +routše +); \ + +677 * +__ÿnûl_¬g + = ( +¬g +); \ + +678  +nÙ_fœ¡_ÿÎ + = + `__sig£tjmp + (( +__jmp_buf_g + *) (*) \ + +679 +__ÿnûl_buf +. +__ÿnûl_jmp_buf +, 0); \ + +680 ià( + `__bužtš_ex³ù + ( +nÙ_fœ¡_ÿÎ +, 0)) \ + +682 + `__ÿnûl_routše + ( +__ÿnûl_¬g +); \ + +683 + `__±h»ad_unwšd_Ãxt + (& +__ÿnûl_buf +); \ + +687 + `__±h»ad_»gi¡”_ÿnûl_deãr + (& +__ÿnûl_buf +); \ + +688 dØ{ + + ) + +689  + `__±h»ad_»gi¡”_ÿnûl_deãr + ( +__±h»ad_unwšd_buf_t + * +__buf +) + +690 +__þ—nup_fù_©Œibu‹ +; + +695  + #±h»ad_þ—nup_pÝ_»¡Üe_Å +( +execu‹ +) \ + +698 + `__±h»ad_uÄegi¡”_ÿnûl_»¡Üe + (& +__ÿnûl_buf +); \ + +699 ià( +execu‹ +) \ + +700 + `__ÿnûl_routše + ( +__ÿnûl_¬g +); \ + +701 + } +} 0) + + ) + +702  + $__±h»ad_uÄegi¡”_ÿnûl_»¡Üe + ( +__±h»ad_unwšd_buf_t + * +__buf +) + +703 +__þ—nup_fù_©Œibu‹ +; + +707  + $__±h»ad_unwšd_Ãxt + ( +__±h»ad_unwšd_buf_t + * +__buf +) + +708 +__þ—nup_fù_©Œibu‹ + + `__©Œibu‹__ + (( +__nÜ‘uº__ +)) + +709 #iâdeà +SHARED + + +710 + `__©Œibu‹__ + (( +__w—k__ +)) + +716  +__jmp_buf_g +; + +717  + $__sig£tjmp + ( +__jmp_buf_g + * +__’v +,  +__§vemask +è +__THROW +; + +723  + $±h»ad_mu‹x_š™ + ( +±h»ad_mu‹x_t + * +__mu‹x +, + +724 +__cÚ¡ + +±h»ad_mu‹x©Œ_t + * +__mu‹x©Œ +) + +725 +__THROW + + `__nÚnuÎ + ((1)); + +728  + $±h»ad_mu‹x_de¡roy + ( +±h»ad_mu‹x_t + * +__mu‹x +) + +729 +__THROW + + `__nÚnuÎ + ((1)); + +732  + $±h»ad_mu‹x_Œylock + ( +±h»ad_mu‹x_t + * +__mu‹x +) + +733 +__THROW + + `__nÚnuÎ + ((1)); + +736  + $±h»ad_mu‹x_lock + ( +±h»ad_mu‹x_t + * +__mu‹x +) + +737 +__THROW + + `__nÚnuÎ + ((1)); + +739 #ifdeà +__USE_XOPEN2K + + +741  + $±h»ad_mu‹x_timedlock + ( +±h»ad_mu‹x_t + * +__»¡riù + +__mu‹x +, + +742 +__cÚ¡ +  +time¥ec + * +__»¡riù + + +743 +__ab¡ime +è +__THROW + + `__nÚnuÎ + ((1, 2)); + +747  + $±h»ad_mu‹x_uÆock + ( +±h»ad_mu‹x_t + * +__mu‹x +) + +748 +__THROW + + `__nÚnuÎ + ((1)); + +751 #ifdeà +__USE_UNIX98 + + +753  + $±h»ad_mu‹x_g‘´ioûžšg + ( +__cÚ¡ + +±h»ad_mu‹x_t + * + +754 +__»¡riù + +__mu‹x +, + +755 * +__»¡riù + +__´ioûžšg +) + +756 +__THROW + + `__nÚnuÎ + ((1, 2)); + +760  + $±h»ad_mu‹x_£rioûžšg + ( +±h»ad_mu‹x_t + * +__»¡riù + +__mu‹x +, + +761  +__´ioûžšg +, + +762 * +__»¡riù + +__Þd_ûžšg +) + +763 +__THROW + + `__nÚnuÎ + ((1, 3)); + +767 #ifdeà +__USE_XOPEN2K8 + + +769  + $±h»ad_mu‹x_cÚsi¡’t_Å + ( +±h»ad_mu‹x_t + * +__mu‹x +) + +770 +__THROW + + `__nÚnuÎ + ((1)); + +771 #ifdeà +__USE_GNU + + +772  + $±h»ad_mu‹x_cÚsi¡’t_Å + ( +±h»ad_mu‹x_t + * +__mu‹x +) + +773 +__THROW + + `__nÚnuÎ + ((1)); + +782  + $±h»ad_mu‹x©Œ_š™ + ( +±h»ad_mu‹x©Œ_t + * +__©Œ +) + +783 +__THROW + + `__nÚnuÎ + ((1)); + +786  + $±h»ad_mu‹x©Œ_de¡roy + ( +±h»ad_mu‹x©Œ_t + * +__©Œ +) + +787 +__THROW + + `__nÚnuÎ + ((1)); + +790  + $±h»ad_mu‹x©Œ_g‘psh¬ed + ( +__cÚ¡ + +±h»ad_mu‹x©Œ_t + * + +791 +__»¡riù + +__©Œ +, + +792 * +__»¡riù + +__psh¬ed +) + +793 +__THROW + + `__nÚnuÎ + ((1, 2)); + +796  + $±h»ad_mu‹x©Œ_£sh¬ed + ( +±h»ad_mu‹x©Œ_t + * +__©Œ +, + +797  +__psh¬ed +) + +798 +__THROW + + `__nÚnuÎ + ((1)); + +800 #ifdeà +__USE_UNIX98 + + +802  + $±h»ad_mu‹x©Œ_g‘ty³ + ( +__cÚ¡ + +±h»ad_mu‹x©Œ_t + * +__»¡riù + + +803 +__©Œ +, * +__»¡riù + +__kšd +) + +804 +__THROW + + `__nÚnuÎ + ((1, 2)); + +809  + $±h»ad_mu‹x©Œ_£‰y³ + ( +±h»ad_mu‹x©Œ_t + * +__©Œ +,  +__kšd +) + +810 +__THROW + + `__nÚnuÎ + ((1)); + +813  + $±h»ad_mu‹x©Œ_g‘´ÙocÞ + ( +__cÚ¡ + +±h»ad_mu‹x©Œ_t + * + +814 +__»¡riù + +__©Œ +, + +815 * +__»¡riù + +__´ÙocÞ +) + +816 +__THROW + + `__nÚnuÎ + ((1, 2)); + +820  + $±h»ad_mu‹x©Œ_£rÙocÞ + ( +±h»ad_mu‹x©Œ_t + * +__©Œ +, + +821  +__´ÙocÞ +) + +822 +__THROW + + `__nÚnuÎ + ((1)); + +825  + $±h»ad_mu‹x©Œ_g‘´ioûžšg + ( +__cÚ¡ + +±h»ad_mu‹x©Œ_t + * + +826 +__»¡riù + +__©Œ +, + +827 * +__»¡riù + +__´ioûžšg +) + +828 +__THROW + + `__nÚnuÎ + ((1, 2)); + +831  + $±h»ad_mu‹x©Œ_£rioûžšg + ( +±h»ad_mu‹x©Œ_t + * +__©Œ +, + +832  +__´ioûžšg +) + +833 +__THROW + + `__nÚnuÎ + ((1)); + +836 #ifdeà +__USE_XOPEN2K + + +838  + $±h»ad_mu‹x©Œ_g‘robu¡ + ( +__cÚ¡ + +±h»ad_mu‹x©Œ_t + * +__©Œ +, + +839 * +__robu¡Ãss +) + +840 +__THROW + + `__nÚnuÎ + ((1, 2)); + +841 #ifdeà +__USE_GNU + + +842  + $±h»ad_mu‹x©Œ_g‘robu¡_Å + ( +__cÚ¡ + +±h»ad_mu‹x©Œ_t + * +__©Œ +, + +843 * +__robu¡Ãss +) + +844 +__THROW + + `__nÚnuÎ + ((1, 2)); + +848  + $±h»ad_mu‹x©Œ_£Œobu¡ + ( +±h»ad_mu‹x©Œ_t + * +__©Œ +, + +849  +__robu¡Ãss +) + +850 +__THROW + + `__nÚnuÎ + ((1)); + +851 #ifdeà +__USE_GNU + + +852  + $±h»ad_mu‹x©Œ_£Œobu¡_Å + ( +±h»ad_mu‹x©Œ_t + * +__©Œ +, + +853  +__robu¡Ãss +) + +854 +__THROW + + `__nÚnuÎ + ((1)); + +859 #ià +defšed + +__USE_UNIX98 + || defšed +__USE_XOPEN2K + + +864  + $±h»ad_rwlock_š™ + ( +±h»ad_rwlock_t + * +__»¡riù + +__rwlock +, + +865 +__cÚ¡ + +±h»ad_rwlock©Œ_t + * +__»¡riù + + +866 +__©Œ +è +__THROW + + `__nÚnuÎ + ((1)); + +869  + $±h»ad_rwlock_de¡roy + ( +±h»ad_rwlock_t + * +__rwlock +) + +870 +__THROW + + `__nÚnuÎ + ((1)); + +873  + $±h»ad_rwlock_rdlock + ( +±h»ad_rwlock_t + * +__rwlock +) + +874 +__THROW + + `__nÚnuÎ + ((1)); + +877  + $±h»ad_rwlock_Œyrdlock + ( +±h»ad_rwlock_t + * +__rwlock +) + +878 +__THROW + + `__nÚnuÎ + ((1)); + +880 #ifdeà +__USE_XOPEN2K + + +882  + $±h»ad_rwlock_timedrdlock + ( +±h»ad_rwlock_t + * +__»¡riù + +__rwlock +, + +883 +__cÚ¡ +  +time¥ec + * +__»¡riù + + +884 +__ab¡ime +è +__THROW + + `__nÚnuÎ + ((1, 2)); + +888  + $±h»ad_rwlock_w¾ock + ( +±h»ad_rwlock_t + * +__rwlock +) + +889 +__THROW + + `__nÚnuÎ + ((1)); + +892  + $±h»ad_rwlock_Œyw¾ock + ( +±h»ad_rwlock_t + * +__rwlock +) + +893 +__THROW + + `__nÚnuÎ + ((1)); + +895 #ifdeà +__USE_XOPEN2K + + +897  + $±h»ad_rwlock_timedw¾ock + ( +±h»ad_rwlock_t + * +__»¡riù + +__rwlock +, + +898 +__cÚ¡ +  +time¥ec + * +__»¡riù + + +899 +__ab¡ime +è +__THROW + + `__nÚnuÎ + ((1, 2)); + +903  + $±h»ad_rwlock_uÆock + ( +±h»ad_rwlock_t + * +__rwlock +) + +904 +__THROW + + `__nÚnuÎ + ((1)); + +910  + $±h»ad_rwlock©Œ_š™ + ( +±h»ad_rwlock©Œ_t + * +__©Œ +) + +911 +__THROW + + `__nÚnuÎ + ((1)); + +914  + $±h»ad_rwlock©Œ_de¡roy + ( +±h»ad_rwlock©Œ_t + * +__©Œ +) + +915 +__THROW + + `__nÚnuÎ + ((1)); + +918  + $±h»ad_rwlock©Œ_g‘psh¬ed + ( +__cÚ¡ + +±h»ad_rwlock©Œ_t + * + +919 +__»¡riù + +__©Œ +, + +920 * +__»¡riù + +__psh¬ed +) + +921 +__THROW + + `__nÚnuÎ + ((1, 2)); + +924  + $±h»ad_rwlock©Œ_£sh¬ed + ( +±h»ad_rwlock©Œ_t + * +__©Œ +, + +925  +__psh¬ed +) + +926 +__THROW + + `__nÚnuÎ + ((1)); + +929  + $±h»ad_rwlock©Œ_g‘kšd_Å + ( +__cÚ¡ + +±h»ad_rwlock©Œ_t + * + +930 +__»¡riù + +__©Œ +, + +931 * +__»¡riù + +__´ef +) + +932 +__THROW + + `__nÚnuÎ + ((1, 2)); + +935  + $±h»ad_rwlock©Œ_£tkšd_Å + ( +±h»ad_rwlock©Œ_t + * +__©Œ +, + +936  +__´ef +è +__THROW + + `__nÚnuÎ + ((1)); + +944  + $±h»ad_cÚd_š™ + ( +±h»ad_cÚd_t + * +__»¡riù + +__cÚd +, + +945 +__cÚ¡ + +±h»ad_cÚd©Œ_t + * +__»¡riù + + +946 +__cÚd_©Œ +è +__THROW + + `__nÚnuÎ + ((1)); + +949  + $±h»ad_cÚd_de¡roy + ( +±h»ad_cÚd_t + * +__cÚd +) + +950 +__THROW + + `__nÚnuÎ + ((1)); + +953  + $±h»ad_cÚd_sigÇl + ( +±h»ad_cÚd_t + * +__cÚd +) + +954 +__THROW + + `__nÚnuÎ + ((1)); + +957  + $±h»ad_cÚd_brßdÿ¡ + ( +±h»ad_cÚd_t + * +__cÚd +) + +958 +__THROW + + `__nÚnuÎ + ((1)); + +965  + $±h»ad_cÚd_wa™ + ( +±h»ad_cÚd_t + * +__»¡riù + +__cÚd +, + +966 +±h»ad_mu‹x_t + * +__»¡riù + +__mu‹x +) + +967 + `__nÚnuÎ + ((1, 2)); + +976  + $±h»ad_cÚd_timedwa™ + ( +±h»ad_cÚd_t + * +__»¡riù + +__cÚd +, + +977 +±h»ad_mu‹x_t + * +__»¡riù + +__mu‹x +, + +978 +__cÚ¡ +  +time¥ec + * +__»¡riù + + +979 +__ab¡ime +è + `__nÚnuÎ + ((1, 2, 3)); + +984  + $±h»ad_cÚd©Œ_š™ + ( +±h»ad_cÚd©Œ_t + * +__©Œ +) + +985 +__THROW + + `__nÚnuÎ + ((1)); + +988  + $±h»ad_cÚd©Œ_de¡roy + ( +±h»ad_cÚd©Œ_t + * +__©Œ +) + +989 +__THROW + + `__nÚnuÎ + ((1)); + +992  + $±h»ad_cÚd©Œ_g‘psh¬ed + ( +__cÚ¡ + +±h»ad_cÚd©Œ_t + * + +993 +__»¡riù + +__©Œ +, + +994 * +__»¡riù + +__psh¬ed +) + +995 +__THROW + + `__nÚnuÎ + ((1, 2)); + +998  + $±h»ad_cÚd©Œ_£sh¬ed + ( +±h»ad_cÚd©Œ_t + * +__©Œ +, + +999  +__psh¬ed +è +__THROW + + `__nÚnuÎ + ((1)); + +1001 #ifdeà +__USE_XOPEN2K + + +1003  + $±h»ad_cÚd©Œ_g‘þock + ( +__cÚ¡ + +±h»ad_cÚd©Œ_t + * + +1004 +__»¡riù + +__©Œ +, + +1005 +__þockid_t + * +__»¡riù + +__þock_id +) + +1006 +__THROW + + `__nÚnuÎ + ((1, 2)); + +1009  + $±h»ad_cÚd©Œ_£tþock + ( +±h»ad_cÚd©Œ_t + * +__©Œ +, + +1010 +__þockid_t + +__þock_id +) + +1011 +__THROW + + `__nÚnuÎ + ((1)); + +1015 #ifdeà +__USE_XOPEN2K + + +1020  + $±h»ad_¥š_š™ + ( +±h»ad_¥šlock_t + * +__lock +,  +__psh¬ed +) + +1021 +__THROW + + `__nÚnuÎ + ((1)); + +1024  + $±h»ad_¥š_de¡roy + ( +±h»ad_¥šlock_t + * +__lock +) + +1025 +__THROW + + `__nÚnuÎ + ((1)); + +1028  + $±h»ad_¥š_lock + ( +±h»ad_¥šlock_t + * +__lock +) + +1029 +__THROW + + `__nÚnuÎ + ((1)); + +1032  + $±h»ad_¥š_Œylock + ( +±h»ad_¥šlock_t + * +__lock +) + +1033 +__THROW + + `__nÚnuÎ + ((1)); + +1036  + $±h»ad_¥š_uÆock + ( +±h»ad_¥šlock_t + * +__lock +) + +1037 +__THROW + + `__nÚnuÎ + ((1)); + +1044  + $±h»ad_b¬r›r_š™ + ( +±h»ad_b¬r›r_t + * +__»¡riù + +__b¬r›r +, + +1045 +__cÚ¡ + +±h»ad_b¬r›¿‰r_t + * +__»¡riù + + +1046 +__©Œ +,  +__couÁ +) + +1047 +__THROW + + `__nÚnuÎ + ((1)); + +1050  + $±h»ad_b¬r›r_de¡roy + ( +±h»ad_b¬r›r_t + * +__b¬r›r +) + +1051 +__THROW + + `__nÚnuÎ + ((1)); + +1054  + $±h»ad_b¬r›r_wa™ + ( +±h»ad_b¬r›r_t + * +__b¬r›r +) + +1055 +__THROW + + `__nÚnuÎ + ((1)); + +1059  + $±h»ad_b¬r›¿‰r_š™ + ( +±h»ad_b¬r›¿‰r_t + * +__©Œ +) + +1060 +__THROW + + `__nÚnuÎ + ((1)); + +1063  + $±h»ad_b¬r›¿‰r_de¡roy + ( +±h»ad_b¬r›¿‰r_t + * +__©Œ +) + +1064 +__THROW + + `__nÚnuÎ + ((1)); + +1067  + $±h»ad_b¬r›¿‰r_g‘psh¬ed + ( +__cÚ¡ + +±h»ad_b¬r›¿‰r_t + * + +1068 +__»¡riù + +__©Œ +, + +1069 * +__»¡riù + +__psh¬ed +) + +1070 +__THROW + + `__nÚnuÎ + ((1, 2)); + +1073  + $±h»ad_b¬r›¿‰r_£sh¬ed + ( +±h»ad_b¬r›¿‰r_t + * +__©Œ +, + +1074  +__psh¬ed +) + +1075 +__THROW + + `__nÚnuÎ + ((1)); + +1087  + `±h»ad_key_ü—‹ + ( +±h»ad_key_t + * +__key +, + +1088 (* +__de¡r_funùiÚ +) (*)) + +1089 +__THROW + + `__nÚnuÎ + ((1)); + +1092  + $±h»ad_key_d–‘e + ( +±h»ad_key_t + +__key +è +__THROW +; + +1095 * + $±h»ad_g‘¥ecific + ( +±h»ad_key_t + +__key +è +__THROW +; + +1098  + $±h»ad_£t¥ecific + ( +±h»ad_key_t + +__key +, + +1099 +__cÚ¡ + * +__poš‹r +è +__THROW + ; + +1102 #ifdeà +__USE_XOPEN2K + + +1104  + $±h»ad_g‘ýuþockid + ( +±h»ad_t + +__th»ad_id +, + +1105 +__þockid_t + * +__þock_id +) + +1106 +__THROW + + `__nÚnuÎ + ((2)); + +1121  + `±h»ad_©fÜk + ((* +__´•¬e +) (), + +1122 (* +__·»Á +) (), + +1123 (* +__chžd +è()è +__THROW +; + +1126 #ifdeà +__USE_EXTERN_INLINES + + +1128 +__ex‹º_šlše +  + +1129 + `__NTH + ( + $±h»ad_equ® + ( +±h»ad_t + +__th»ad1 +,…th»ad_ˆ +__th»ad2 +)) + +1131  +__th»ad1 + =ð +__th»ad2 +; + +1132 + } +} + +1135 + g__END_DECLS + + + @/usr/include/wctype.h + +24 #iâdeà +_WCTYPE_H + + +26  + ~<ã©u»s.h +> + +27  + ~ + +29 #iâdeà +__Ãed_iswxxx + + +30  + #_WCTYPE_H + 1 + + ) + +33  + #__Ãed_wšt_t + + + ) + +34  + ~<¡ddef.h +> + +38 #iâdeà +WEOF + + +39  + #WEOF + (0xffffffffu) + + ) + +42 #undeà +__Ãed_iswxxx + + +47 #iâdeà +__iswxxx_defšed + + +48  + #__iswxxx_defšed + 1 + + ) + +50 +__BEGIN_NAMESPACE_C99 + + +53  + twùy³_t +; + +54 + g__END_NAMESPACE_C99 + + +56 #iâdeà +_ISwb™ + + +61  + ~<’dŸn.h +> + +62 #ià +__BYTE_ORDER + =ð +__BIG_ENDIAN + + +63  + #_ISwb™ +( +b™ +è(1 << (b™)) + + ) + +65  + #_ISwb™ +( +b™ +) \ + +66 (( +b™ +) < 8 ? () ((1UL << (bit)) << 24) \ + +67 : (( +b™ +) < 16 ? () ((1UL << (bit)) << 8) \ + +68 : (( +b™ +) < 24 ? () ((1UL << (bit)) >> 8) \ + +69 : (è((1UL << ( +b™ +)è>> 24)))) + + ) + +74 + m__ISwuµ” + = 0, + +75 + m__ISwlow” + = 1, + +76 + m__ISw®pha + = 2, + +77 + m__ISwdig™ + = 3, + +78 + m__ISwxdig™ + = 4, + +79 + m__ISw¥aû + = 5, + +80 + m__ISw´št + = 6, + +81 + m__ISwg¿ph + = 7, + +82 + m__ISwbÏnk + = 8, + +83 + m__ISwúŒl + = 9, + +84 + m__ISwpunù + = 10, + +85 + m__ISw®num + = 11, + +87 + m_ISwuµ” + = +_ISwb™ + ( +__ISwuµ” +), + +88 + m_ISwlow” + = +_ISwb™ + ( +__ISwlow” +), + +89 + m_ISw®pha + = +_ISwb™ + ( +__ISw®pha +), + +90 + m_ISwdig™ + = +_ISwb™ + ( +__ISwdig™ +), + +91 + m_ISwxdig™ + = +_ISwb™ + ( +__ISwxdig™ +), + +92 + m_ISw¥aû + = +_ISwb™ + ( +__ISw¥aû +), + +93 + m_ISw´št + = +_ISwb™ + ( +__ISw´št +), + +94 + m_ISwg¿ph + = +_ISwb™ + ( +__ISwg¿ph +), + +95 + m_ISwbÏnk + = +_ISwb™ + ( +__ISwbÏnk +), + +96 + m_ISwúŒl + = +_ISwb™ + ( +__ISwúŒl +), + +97 + m_ISwpunù + = +_ISwb™ + ( +__ISwpunù +), + +98 + m_ISw®num + = +_ISwb™ + ( +__ISw®num +) + +103 +__BEGIN_DECLS + + +105 +__BEGIN_NAMESPACE_C99 + + +112  + $isw®num + ( +wšt_t + +__wc +è +__THROW +; + +118  + $isw®pha + ( +wšt_t + +__wc +è +__THROW +; + +121  + $iswúŒl + ( +wšt_t + +__wc +è +__THROW +; + +125  + $iswdig™ + ( +wšt_t + +__wc +è +__THROW +; + +129  + $iswg¿ph + ( +wšt_t + +__wc +è +__THROW +; + +134  + $iswlow” + ( +wšt_t + +__wc +è +__THROW +; + +137  + $isw´št + ( +wšt_t + +__wc +è +__THROW +; + +142  + $iswpunù + ( +wšt_t + +__wc +è +__THROW +; + +147  + $isw¥aû + ( +wšt_t + +__wc +è +__THROW +; + +152  + $iswuµ” + ( +wšt_t + +__wc +è +__THROW +; + +157  + $iswxdig™ + ( +wšt_t + +__wc +è +__THROW +; + +162 #ifdeà +__USE_ISOC99 + + +163  + $iswbÏnk + ( +wšt_t + +__wc +è +__THROW +; + +172 +wùy³_t + + $wùy³ + ( +__cÚ¡ + * +__´Ý”ty +è +__THROW +; + +176  + $iswùy³ + ( +wšt_t + +__wc +, +wùy³_t + +__desc +è +__THROW +; + +177 +__END_NAMESPACE_C99 + + +184 +__BEGIN_NAMESPACE_C99 + + +187  +__cÚ¡ + + t__št32_t + * + twù¿ns_t +; + +188 +__END_NAMESPACE_C99 + + +189 #ifdeà +__USE_GNU + + +190 + $__USING_NAMESPACE_C99 +( +wù¿ns_t +) + +193 +__BEGIN_NAMESPACE_C99 + + +195 +wšt_t + + $towlow” + ( +wšt_t + +__wc +è +__THROW +; + +198 +wšt_t + + $towuµ” + ( +wšt_t + +__wc +è +__THROW +; + +199 +__END_NAMESPACE_C99 + + +201 +__END_DECLS + + +208 #ifdeà +_WCTYPE_H + + +214 +__BEGIN_DECLS + + +216 +__BEGIN_NAMESPACE_C99 + + +219 +wù¿ns_t + + $wù¿ns + ( +__cÚ¡ + * +__´Ý”ty +è +__THROW +; + +222 +wšt_t + + $towù¿ns + ( +wšt_t + +__wc +, +wù¿ns_t + +__desc +è +__THROW +; + +223 +__END_NAMESPACE_C99 + + +225 #ifdeà +__USE_XOPEN2K8 + + +227  + ~ + +231  + $isw®num_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +237  + $isw®pha_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +240  + $iswúŒl_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +244  + $iswdig™_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +248  + $iswg¿ph_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +253  + $iswlow”_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +256  + $isw´št_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +261  + $iswpunù_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +266  + $isw¥aû_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +271  + $iswuµ”_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +276  + $iswxdig™_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +281  + $iswbÏnk_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +285 +wùy³_t + + $wùy³_l + ( +__cÚ¡ + * +__´Ý”ty +, +__loÿË_t + +__loÿË +) + +286 +__THROW +; + +290  + $iswùy³_l + ( +wšt_t + +__wc +, +wùy³_t + +__desc +, +__loÿË_t + +__loÿË +) + +291 +__THROW +; + +299 +wšt_t + + $towlow”_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +302 +wšt_t + + $towuµ”_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +306 +wù¿ns_t + + $wù¿ns_l + ( +__cÚ¡ + * +__´Ý”ty +, +__loÿË_t + +__loÿË +) + +307 +__THROW +; + +310 +wšt_t + + $towù¿ns_l + ( +wšt_t + +__wc +, +wù¿ns_t + +__desc +, + +311 +__loÿË_t + +__loÿË +è +__THROW +; + +315 +__END_DECLS + + + @/usr/include/bits/errno.h + +20 #ifdeà +_ERRNO_H + + +22 #undeà +EDOM + + +23 #undeà +EILSEQ + + +24 #undeà +ERANGE + + +25  + ~ + +28  + #ENOTSUP + +EOPNOTSUPP + + + ) + +31 #iâdeà +ECANCELED + + +32  + #ECANCELED + 125 + + ) + +36 #iâdeà +EOWNERDEAD + + +37  + #EOWNERDEAD + 130 + + ) + +38  + #ENOTRECOVERABLE + 131 + + ) + +41 #iâdeà +__ASSEMBLER__ + + +43 * + $__”ºo_loÿtiÚ + (è +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +45 #ià! +defšed + +_LIBC + || defšed +_LIBC_REENTRANT + + +47  + #”ºo + (* + `__”ºo_loÿtiÚ + ()) + + ) + +52 #ià! +defšed + +_ERRNO_H + && defšed +__Ãed_Em©h + + +56  + #EDOM + 33 + + ) + +57  + #EILSEQ + 84 + + ) + +58  + #ERANGE + 34 + + ) + + @/usr/include/bits/pthreadtypes.h + +20 #iâdeà +_BITS_PTHREADTYPES_H + + +21  + #_BITS_PTHREADTYPES_H + 1 + + ) + +23  + ~ + +25 #ià +__WORDSIZE + == 64 + +26  + #__SIZEOF_PTHREAD_ATTR_T + 56 + + ) + +27  + #__SIZEOF_PTHREAD_MUTEX_T + 40 + + ) + +28  + #__SIZEOF_PTHREAD_MUTEXATTR_T + 4 + + ) + +29  + #__SIZEOF_PTHREAD_COND_T + 48 + + ) + +30  + #__SIZEOF_PTHREAD_CONDATTR_T + 4 + + ) + +31  + #__SIZEOF_PTHREAD_RWLOCK_T + 56 + + ) + +32  + #__SIZEOF_PTHREAD_RWLOCKATTR_T + 8 + + ) + +33  + #__SIZEOF_PTHREAD_BARRIER_T + 32 + + ) + +34  + #__SIZEOF_PTHREAD_BARRIERATTR_T + 4 + + ) + +36  + #__SIZEOF_PTHREAD_ATTR_T + 36 + + ) + +37  + #__SIZEOF_PTHREAD_MUTEX_T + 24 + + ) + +38  + #__SIZEOF_PTHREAD_MUTEXATTR_T + 4 + + ) + +39  + #__SIZEOF_PTHREAD_COND_T + 48 + + ) + +40  + #__SIZEOF_PTHREAD_CONDATTR_T + 4 + + ) + +41  + #__SIZEOF_PTHREAD_RWLOCK_T + 32 + + ) + +42  + #__SIZEOF_PTHREAD_RWLOCKATTR_T + 8 + + ) + +43  + #__SIZEOF_PTHREAD_BARRIER_T + 20 + + ) + +44  + #__SIZEOF_PTHREAD_BARRIERATTR_T + 4 + + ) + +50  + t±h»ad_t +; + +55  + m__size +[ +__SIZEOF_PTHREAD_ATTR_T +]; + +56  + m__®ign +; + +57 } + t±h»ad_©Œ_t +; + +60 #ià +__WORDSIZE + == 64 + +61  + s__±h»ad_š‹º®_li¡ + + +63  +__±h»ad_š‹º®_li¡ + * + m__´ev +; + +64  +__±h»ad_š‹º®_li¡ + * + m__Ãxt +; + +65 } + t__±h»ad_li¡_t +; + +67  + s__±h»ad_š‹º®_¦i¡ + + +69  +__±h»ad_š‹º®_¦i¡ + * + m__Ãxt +; + +70 } + t__±h»ad_¦i¡_t +; + +78  + s__±h»ad_mu‹x_s + + +80  + m__lock +; + +81  + m__couÁ +; + +82  + m__owÃr +; + +83 #ià +__WORDSIZE + == 64 + +84  + m__nu£rs +; + +88  + m__kšd +; + +89 #ià +__WORDSIZE + == 64 + +90  + m__¥šs +; + +91 +__±h»ad_li¡_t + + m__li¡ +; + +92  + #__PTHREAD_MUTEX_HAVE_PREV + 1 + + ) + +94  + m__nu£rs +; + +95 +__ex‹nsiÚ__ + union + +97  + m__¥šs +; + +98 +__±h»ad_¦i¡_t + + m__li¡ +; + +101 } + m__d©a +; + +102  + m__size +[ +__SIZEOF_PTHREAD_MUTEX_T +]; + +103  + m__®ign +; + +104 } + t±h»ad_mu‹x_t +; + +108  + m__size +[ +__SIZEOF_PTHREAD_MUTEXATTR_T +]; + +109  + m__®ign +; + +110 } + t±h»ad_mu‹x©Œ_t +; + +119  + m__lock +; + +120  + m__fu‹x +; + +121 +__ex‹nsiÚ__ +  + m__tÙ®_£q +; + +122 +__ex‹nsiÚ__ +  + m__wakeup_£q +; + +123 +__ex‹nsiÚ__ +  + m__wok’_£q +; + +124 * + m__mu‹x +; + +125  + m__nwa™”s +; + +126  + m__brßdÿ¡_£q +; + +127 } + m__d©a +; + +128  + m__size +[ +__SIZEOF_PTHREAD_COND_T +]; + +129 +__ex‹nsiÚ__ +  + m__®ign +; + +130 } + t±h»ad_cÚd_t +; + +134  + m__size +[ +__SIZEOF_PTHREAD_CONDATTR_T +]; + +135  + m__®ign +; + +136 } + t±h»ad_cÚd©Œ_t +; + +140  + t±h»ad_key_t +; + +144  + t±h»ad_Úû_t +; + +147 #ià +defšed + +__USE_UNIX98 + || defšed +__USE_XOPEN2K + + +152 #ià +__WORDSIZE + == 64 + +155  + m__lock +; + +156  + m__Ä_»ad”s +; + +157  + m__»ad”s_wakeup +; + +158  + m__wr™”_wakeup +; + +159  + m__Ä_»ad”s_queued +; + +160  + m__Ä_wr™”s_queued +; + +161  + m__wr™” +; + +162  + m__sh¬ed +; + +163  + m__·d1 +; + +164  + m__·d2 +; + +167  + m__æags +; + +168 } + m__d©a +; + +172  + m__lock +; + +173  + m__Ä_»ad”s +; + +174  + m__»ad”s_wakeup +; + +175  + m__wr™”_wakeup +; + +176  + m__Ä_»ad”s_queued +; + +177  + m__Ä_wr™”s_queued +; + +180  + m__æags +; + +181  + m__sh¬ed +; + +182  + m__·d1 +; + +183  + m__·d2 +; + +184  + m__wr™” +; + +185 } + m__d©a +; + +187  + m__size +[ +__SIZEOF_PTHREAD_RWLOCK_T +]; + +188  + m__®ign +; + +189 } + t±h»ad_rwlock_t +; + +193  + m__size +[ +__SIZEOF_PTHREAD_RWLOCKATTR_T +]; + +194  + m__®ign +; + +195 } + t±h»ad_rwlock©Œ_t +; + +199 #ifdeà +__USE_XOPEN2K + + +201 vÞ©ž + t±h»ad_¥šlock_t +; + +208  + m__size +[ +__SIZEOF_PTHREAD_BARRIER_T +]; + +209  + m__®ign +; + +210 } + t±h»ad_b¬r›r_t +; + +214  + m__size +[ +__SIZEOF_PTHREAD_BARRIERATTR_T +]; + +215  + m__®ign +; + +216 } + t±h»ad_b¬r›¿‰r_t +; + +220 #ià +__WORDSIZE + == 32 + +222  + #__þ—nup_fù_©Œibu‹ + + `__©Œibu‹__ + (( + `__»g·rm__ + (1))) + + ) + + @/usr/include/bits/setjmp.h + +20 #iâdeà +_BITS_SETJMP_H + + +21  + #_BITS_SETJMP_H + 1 + + ) + +23 #ià! +defšed + +_SETJMP_H + && !defšed +_PTHREAD_H + + +27  + ~ + +29 #iâdeà +_ASM + + +31 #ià +__WORDSIZE + == 64 + +32  + t__jmp_buf +[8]; + +34  + t__jmp_buf +[6]; + + @/usr/include/sched.h + +20 #iâdef +_SCHED_H + + +21  + #_SCHED_H + 1 + + ) + +23  + ~<ã©u»s.h +> + +26  + ~ + +28  + #__Ãed_size_t + + + ) + +29  + ~<¡ddef.h +> + +31  + #__Ãed_time¥ec + + + ) + +32  + ~ + +35  + ~ + +37  + #sched_´iÜ™y + +__sched_´iÜ™y + + + ) + +40 +__BEGIN_DECLS + + +43  + $sched_£¬am + ( +__pid_t + +__pid +, +__cÚ¡ +  +sched_·¿m + * +__·¿m +) + +44 +__THROW +; + +47  + $sched_g‘·¿m + ( +__pid_t + +__pid +,  +sched_·¿m + * +__·¿m +è +__THROW +; + +50  + $sched_£tscheduËr + ( +__pid_t + +__pid +,  +__pÞicy +, + +51 +__cÚ¡ +  +sched_·¿m + * +__·¿m +è +__THROW +; + +54  + $sched_g‘scheduËr + ( +__pid_t + +__pid +è +__THROW +; + +57  + $sched_y›ld + (è +__THROW +; + +60  + $sched_g‘_´iÜ™y_max + ( +__®gÜ™hm +è +__THROW +; + +63  + $sched_g‘_´iÜ™y_mš + ( +__®gÜ™hm +è +__THROW +; + +66  + $sched_¼_g‘_š‹rv® + ( +__pid_t + +__pid +,  +time¥ec + * +__t +è +__THROW +; + +69 #ifdeà +__USE_GNU + + +71  + #CPU_SETSIZE + +__CPU_SETSIZE + + + ) + +72  + #CPU_SET +( +ýu +, +ýu£ +è + `__CPU_SET_S + (ýu,  ( +ýu_£t_t +), cpu£) + + ) + +73  + #CPU_CLR +( +ýu +, +ýu£ +è + `__CPU_CLR_S + (ýu,  ( +ýu_£t_t +), cpu£) + + ) + +74  + #CPU_ISSET +( +ýu +, +ýu£ +è + `__CPU_ISSET_S + (ýu,  ( +ýu_£t_t +), \ + +75 +ýu£ +) + + ) + +76  + #CPU_ZERO +( +ýu£ +è + `__CPU_ZERO_S + ( ( +ýu_£t_t +), cpu£) + + ) + +77  + #CPU_COUNT +( +ýu£ +è + `__CPU_COUNT_S + ( ( +ýu_£t_t +), cpu£) + + ) + +79  + #CPU_SET_S +( +ýu +, +£tsize +, +ýu£ +è + `__CPU_SET_S + (ýu, s‘size, cpu£) + + ) + +80  + #CPU_CLR_S +( +ýu +, +£tsize +, +ýu£ +è + `__CPU_CLR_S + (ýu, s‘size, cpu£) + + ) + +81  + #CPU_ISSET_S +( +ýu +, +£tsize +, +ýu£ +è + `__CPU_ISSET_S + (cpu, setsize, \ + +82 +ýu£ +) + + ) + +83  + #CPU_ZERO_S +( +£tsize +, +ýu£ +è + `__CPU_ZERO_S + (£tsize, cpu£) + + ) + +84  + #CPU_COUNT_S +( +£tsize +, +ýu£ +è + `__CPU_COUNT_S + (£tsize, cpu£) + + ) + +86  + #CPU_EQUAL +( +ýu£1 +, +ýu£2 +) \ + +87 + `__CPU_EQUAL_S + ( ( +ýu_£t_t +), +ýu£1 +, +ýu£2 +) + + ) + +88  + #CPU_EQUAL_S +( +£tsize +, +ýu£1 +, +ýu£2 +) \ + +89 + `__CPU_EQUAL_S + ( +£tsize +, +ýu£1 +, +ýu£2 +) + + ) + +91  + #CPU_AND +( +de¡£t +, +¤c£t1 +, +¤c£t2 +) \ + +92 + `__CPU_OP_S + ( ( +ýu_£t_t +), +de¡£t +, +¤c£t1 +, +¤c£t2 +, &) + + ) + +93  + #CPU_OR +( +de¡£t +, +¤c£t1 +, +¤c£t2 +) \ + +94 + `__CPU_OP_S + ( ( +ýu_£t_t +), +de¡£t +, +¤c£t1 +, +¤c£t2 +, |) + + ) + +95  + #CPU_XOR +( +de¡£t +, +¤c£t1 +, +¤c£t2 +) \ + +96 + `__CPU_OP_S + ( ( +ýu_£t_t +), +de¡£t +, +¤c£t1 +, +¤c£t2 +, ^) + + ) + +97  + #CPU_AND_S +( +£tsize +, +de¡£t +, +¤c£t1 +, +¤c£t2 +) \ + +98 + `__CPU_OP_S + ( +£tsize +, +de¡£t +, +¤c£t1 +, +¤c£t2 +, &) + + ) + +99  + #CPU_OR_S +( +£tsize +, +de¡£t +, +¤c£t1 +, +¤c£t2 +) \ + +100 + `__CPU_OP_S + ( +£tsize +, +de¡£t +, +¤c£t1 +, +¤c£t2 +, |) + + ) + +101  + #CPU_XOR_S +( +£tsize +, +de¡£t +, +¤c£t1 +, +¤c£t2 +) \ + +102 + `__CPU_OP_S + ( +£tsize +, +de¡£t +, +¤c£t1 +, +¤c£t2 +, ^) + + ) + +104  + #CPU_ALLOC_SIZE +( +couÁ +è + `__CPU_ALLOC_SIZE + (couÁ) + + ) + +105  + #CPU_ALLOC +( +couÁ +è + `__CPU_ALLOC + (couÁ) + + ) + +106  + #CPU_FREE +( +ýu£t +è + `__CPU_FREE + (ýu£t) + + ) + +110  + $sched_£ffš™y + ( +__pid_t + +__pid +, +size_t + +__ýu£tsize +, + +111 +__cÚ¡ + +ýu_£t_t + * +__ýu£t +è +__THROW +; + +114  + $sched_g‘affš™y + ( +__pid_t + +__pid +, +size_t + +__ýu£tsize +, + +115 +ýu_£t_t + * +__ýu£t +è +__THROW +; + +118 +__END_DECLS + + + @/usr/include/signal.h + +23 #iâdef +_SIGNAL_H + + +25 #ià! +defšed + +__Ãed_sig_©omic_t + && !defšed +__Ãed_sig£t_t + + +26  + #_SIGNAL_H + + + ) + +29  + ~<ã©u»s.h +> + +31 + g__BEGIN_DECLS + + +33  + ~ + +37 #ià +defšed + +__Ãed_sig_©omic_t + || defšed +_SIGNAL_H + + +38 #iâdeà +__sig_©omic_t_defšed + + +39  + #__sig_©omic_t_defšed + + + ) + +40 +__BEGIN_NAMESPACE_STD + + +41  +__sig_©omic_t + + tsig_©omic_t +; + +42 + g__END_NAMESPACE_STD + + +44 #undeà +__Ãed_sig_©omic_t + + +47 #ià +defšed + +__Ãed_sig£t_t + || (defšed +_SIGNAL_H + && defšed +__USE_POSIX +) + +48 #iâdeà +__sig£t_t_defšed + + +49  + #__sig£t_t_defšed + + + ) + +50  +__sig£t_t + + tsig£t_t +; + +52 #undeà +__Ãed_sig£t_t + + +55 #ifdeà +_SIGNAL_H + + +57  + ~ + +58  + ~ + +60 #ià +defšed + +__USE_XOPEN + || defšed +__USE_XOPEN2K + + +61 #iâdeà +__pid_t_defšed + + +62  +__pid_t + + tpid_t +; + +63  + #__pid_t_defšed + + + ) + +65 #ifdeà +__USE_XOPEN + + +67 #iâdeà +__uid_t_defšed + + +68  +__uid_t + + tuid_t +; + +69  + #__uid_t_defšed + + + ) + +73 #ifdeà +__USE_POSIX199309 + + +75  + #__Ãed_time¥ec + + + ) + +76  + ~ + +79  + ~ + +84 (* + t__sighªdËr_t +) (); + +89 +__sighªdËr_t + + $__sysv_sigÇl + ( +__sig +, +__sighªdËr_t + +__hªdËr +) + +90 +__THROW +; + +91 #ifdeà +__USE_GNU + + +92 +__sighªdËr_t + + $sysv_sigÇl + ( +__sig +, +__sighªdËr_t + +__hªdËr +) + +93 +__THROW +; + +99 +__BEGIN_NAMESPACE_STD + + +100 #ifdeà +__USE_BSD + + +101 +__sighªdËr_t + + $sigÇl + ( +__sig +, +__sighªdËr_t + +__hªdËr +) + +102 +__THROW +; + +105 #ifdeà +__REDIRECT_NTH + + +106 +__sighªdËr_t + + `__REDIRECT_NTH + ( +sigÇl +, + +107 ( +__sig +, +__sighªdËr_t + +__hªdËr +), + +108 +__sysv_sigÇl +); + +110  + #sigÇl + +__sysv_sigÇl + + + ) + +113 +__END_NAMESPACE_STD + + +115 #ifdeà +__USE_XOPEN + + +118 +__sighªdËr_t + + $bsd_sigÇl + ( +__sig +, +__sighªdËr_t + +__hªdËr +) + +119 +__THROW +; + +125 #ifdeà +__USE_POSIX + + +126  + $kžl + ( +__pid_t + +__pid +,  +__sig +è +__THROW +; + +129 #ià +defšed + +__USE_BSD + || defšed +__USE_XOPEN_EXTENDED + + +133  + $kžÍg + ( +__pid_t + +__pg½ +,  +__sig +è +__THROW +; + +136 +__BEGIN_NAMESPACE_STD + + +138  + $¿i£ + ( +__sig +è +__THROW +; + +139 +__END_NAMESPACE_STD + + +141 #ifdeà +__USE_SVID + + +143 +__sighªdËr_t + + $ssigÇl + ( +__sig +, +__sighªdËr_t + +__hªdËr +) + +144 +__THROW +; + +145  + $gsigÇl + ( +__sig +è +__THROW +; + +148 #ià +defšed + +__USE_MISC + || defšed +__USE_XOPEN2K + + +150  + `psigÇl + ( +__sig +, +__cÚ¡ + * +__s +); + +153 #ifdeà +__USE_XOPEN2K + + +155  + `psigšfo + ( +__cÚ¡ + +sigšfo_t + * +__pšfo +, __cÚ¡ * +__s +); + +168  + `__sig·u£ + ( +__sig_Ü_mask +,  +__is_sig +); + +170 #ifdeà +__FAVOR_BSD + + +173  + $sig·u£ + ( +__mask +è +__THROW + +__©Œibu‹_d•»ÿ‹d__ +; + +175 #ifdeà +__USE_XOPEN + + +176 #ifdeà +__GNUC__ + + +177  + $sig·u£ + ( +__sig +è + `__asm__ + ("__xpg_sigpause"); + +180  + #sig·u£ +( +sig +è + `__sig·u£ + ((sig), 1) + + ) + +186 #ifdeà +__USE_BSD + + +193  + #sigmask +( +sig +è + `__sigmask +(sig) + + ) + +196  + $sigblock + ( +__mask +è +__THROW + +__©Œibu‹_d•»ÿ‹d__ +; + +199  + $sig£tmask + ( +__mask +è +__THROW + +__©Œibu‹_d•»ÿ‹d__ +; + +202  + $sigg‘mask + (è +__THROW + +__©Œibu‹_d•»ÿ‹d__ +; + +206 #ifdeà +__USE_MISC + + +207  + #NSIG + +_NSIG + + + ) + +210 #ifdeà +__USE_GNU + + +211  +__sighªdËr_t + + tsighªdËr_t +; + +215 #ifdeà +__USE_BSD + + +216  +__sighªdËr_t + + tsig_t +; + +219 #ifdeà +__USE_POSIX + + +222  + $sigem±y£t + ( +sig£t_t + * +__£t +è +__THROW + + `__nÚnuÎ + ((1)); + +225  + $sigfžl£t + ( +sig£t_t + * +__£t +è +__THROW + + `__nÚnuÎ + ((1)); + +228  + $sigadd£t + ( +sig£t_t + * +__£t +,  +__signo +è +__THROW + + `__nÚnuÎ + ((1)); + +231  + $sigd–£t + ( +sig£t_t + * +__£t +,  +__signo +è +__THROW + + `__nÚnuÎ + ((1)); + +234  + $sigismemb” + ( +__cÚ¡ + +sig£t_t + * +__£t +,  +__signo +) + +235 +__THROW + + `__nÚnuÎ + ((1)); + +237 #ifdeà +__USE_GNU + + +239  + $sigi£m±y£t + ( +__cÚ¡ + +sig£t_t + * +__£t +è +__THROW + + `__nÚnuÎ + ((1)); + +242  + $sigªd£t + ( +sig£t_t + * +__£t +, +__cÚ¡ + sig£t_ˆ* +__Ëá +, + +243 +__cÚ¡ + +sig£t_t + * +__right +è +__THROW + + `__nÚnuÎ + ((1, 2, 3)); + +246  + $sigÜ£t + ( +sig£t_t + * +__£t +, +__cÚ¡ + sig£t_ˆ* +__Ëá +, + +247 +__cÚ¡ + +sig£t_t + * +__right +è +__THROW + + `__nÚnuÎ + ((1, 2, 3)); + +252  + ~ + +255  + $sig´ocmask + ( +__how +, +__cÚ¡ + +sig£t_t + * +__»¡riù + +__£t +, + +256 +sig£t_t + * +__»¡riù + +__o£t +è +__THROW +; + +263  + $sigsu¥’d + ( +__cÚ¡ + +sig£t_t + * +__£t +è + `__nÚnuÎ + ((1)); + +266  + $sigaùiÚ + ( +__sig +, +__cÚ¡ +  +sigaùiÚ + * +__»¡riù + +__aù +, + +267  +sigaùiÚ + * +__»¡riù + +__ßù +è +__THROW +; + +270  + $sig³ndšg + ( +sig£t_t + * +__£t +è +__THROW + + `__nÚnuÎ + ((1)); + +277  + $sigwa™ + ( +__cÚ¡ + +sig£t_t + * +__»¡riù + +__£t +, *__»¡riù +__sig +) + +278 + `__nÚnuÎ + ((1, 2)); + +280 #ifdeà +__USE_POSIX199309 + + +285  + $sigwa™šfo + ( +__cÚ¡ + +sig£t_t + * +__»¡riù + +__£t +, + +286 +sigšfo_t + * +__»¡riù + +__šfo +è + `__nÚnuÎ + ((1)); + +293  + $sigtimedwa™ + ( +__cÚ¡ + +sig£t_t + * +__»¡riù + +__£t +, + +294 +sigšfo_t + * +__»¡riù + +__šfo +, + +295 +__cÚ¡ +  +time¥ec + * +__»¡riù + +__timeout +) + +296 + `__nÚnuÎ + ((1)); + +300  + $sigqueue + ( +__pid_t + +__pid +,  +__sig +, +__cÚ¡ +  +sigv® + +__v® +) + +301 +__THROW +; + +306 #ifdeà +__USE_BSD + + +310 +__cÚ¡ + *__cÚ¡ +_sys_sigli¡ +[ +_NSIG +]; + +311 +__cÚ¡ + *__cÚ¡ +sys_sigli¡ +[ +_NSIG +]; + +314  + ssigvec + + +316 +__sighªdËr_t + +sv_hªdËr +; + +317  +sv_mask +; + +319  +sv_æags +; + +320  + #sv_Ú¡ack + +sv_æags + + + ) + +324  + #SV_ONSTACK + (1 << 0) + + ) + +325  + #SV_INTERRUPT + (1 << 1) + + ) + +326  + #SV_RESETHAND + (1 << 2) + + ) + +334  + $sigvec + ( +__sig +, +__cÚ¡ +  +sigvec + * +__vec +, + +335  +sigvec + * +__ovec +è +__THROW +; + +339  + ~ + +342  + $sig»tuº + ( +sigcÚ‹xt + * +__sý +è +__THROW +; + +347 #ià +defšed + +__USE_BSD + || defšed +__USE_XOPEN_EXTENDED + + +348  + #__Ãed_size_t + + + ) + +349  + ~<¡ddef.h +> + +354  + $sigš‹¼u± + ( +__sig +,  +__š‹¼u± +è +__THROW +; + +356  + ~ + +357 #ifdeà +__USE_XOPEN + + +359  + ~ + +365  + $sig¡ack + ( +sig¡ack + * +__ss +, sig¡ack * +__oss +) + +366 +__THROW + +__©Œibu‹_d•»ÿ‹d__ +; + +370  + $sig®t¡ack + ( +__cÚ¡ +  +sig®t¡ack + * +__»¡riù + +__ss +, + +371  +sig®t¡ack + * +__»¡riù + +__oss +è +__THROW +; + +375 #ifdeà +__USE_XOPEN_EXTENDED + + +379  + $sighÞd + ( +__sig +è +__THROW +; + +382  + $sig»l£ + ( +__sig +è +__THROW +; + +385  + $sigignÜe + ( +__sig +è +__THROW +; + +388 +__sighªdËr_t + + $sig£t + ( +__sig +, +__sighªdËr_t + +__di¥ +è +__THROW +; + +391 #ià +defšed + +__USE_POSIX199506 + || defšed +__USE_UNIX98 + + +394  + ~ + +395  + ~ + +402  + $__libc_cu¼’t_sig¹mš + (è +__THROW +; + +404  + $__libc_cu¼’t_sig¹max + (è +__THROW +; + +408 +__END_DECLS + + + @/usr/include/time.h + +23 #iâdef +_TIME_H + + +25 #ià(! +defšed + +__Ãed_time_t + && !defšed +__Ãed_þock_t + && \ + +26 ! +defšed + + g__Ãed_time¥ec +) + +27  + #_TIME_H + 1 + + ) + +28  + ~<ã©u»s.h +> + +30 + g__BEGIN_DECLS + + +34 #ifdef +_TIME_H + + +36  + #__Ãed_size_t + + + ) + +37  + #__Ãed_NULL + + + ) + +38  + ~<¡ddef.h +> + +42  + ~ + +45 #ià! +defšed + +__STRICT_ANSI__ + && !defšed +__USE_XOPEN2K + + +46 #iâdeà +CLK_TCK + + +47  + #CLK_TCK + +CLOCKS_PER_SEC + + + ) + +53 #ià! +defšed + +__þock_t_defšed + && (defšed +_TIME_H + || defšed +__Ãed_þock_t +) + +54  + #__þock_t_defšed + 1 + + ) + +56  + ~ + +58 +__BEGIN_NAMESPACE_STD + + +60  +__þock_t + + tþock_t +; + +61 + g__END_NAMESPACE_STD + + +62 #ià +defšed + +__USE_XOPEN + || defšed +__USE_POSIX + || defšed +__USE_MISC + + +63 + $__USING_NAMESPACE_STD +( +þock_t +) + +67 #undeà +__Ãed_þock_t + + +69 #ià! +defšed + +__time_t_defšed + && (defšed +_TIME_H + || defšed +__Ãed_time_t +) + +70  + #__time_t_defšed + 1 + + ) + +72  + ~ + +74 +__BEGIN_NAMESPACE_STD + + +76  +__time_t + + ttime_t +; + +77 +__END_NAMESPACE_STD + + +78 #ià +defšed + +__USE_POSIX + || defšed +__USE_MISC + || defšed +__USE_SVID + + +79 + $__USING_NAMESPACE_STD +( +time_t +) + +83 #undeà +__Ãed_time_t + + +85 #ià! +defšed + +__þockid_t_defšed + && \ + +86 (( +defšed + +_TIME_H + && defšed +__USE_POSIX199309 +è|| defšed +__Ãed_þockid_t +) + +87  + #__þockid_t_defšed + 1 + + ) + +89  + ~ + +92  +__þockid_t + + tþockid_t +; + +95 #undeà +__þockid_time_t + + +97 #ià! +defšed + +__tim”_t_defšed + && \ + +98 (( +defšed + +_TIME_H + && defšed +__USE_POSIX199309 +è|| defšed +__Ãed_tim”_t +) + +99  + #__tim”_t_defšed + 1 + + ) + +101  + ~ + +104  +__tim”_t + + ttim”_t +; + +107 #undeà +__Ãed_tim”_t + + +110 #ià! +defšed + +__time¥ec_defšed + && \ + +111 (( +defšed + +_TIME_H + && \ + +112 ( +defšed + +__USE_POSIX199309 + || defšed +__USE_MISC +)) || \ + +113 +defšed + +__Ãed_time¥ec +) + +114  + #__time¥ec_defšed + 1 + + ) + +116  + ~ + +120  + stime¥ec + + +122 +__time_t + +tv_£c +; + +123  +tv_n£c +; + +127 #undeà +__Ãed_time¥ec + + +130 #ifdef +_TIME_H + + +131 +__BEGIN_NAMESPACE_STD + + +133  + stm + + +135  +tm_£c +; + +136  +tm_mš +; + +137  +tm_hour +; + +138  +tm_mday +; + +139  +tm_mÚ +; + +140  +tm_y—r +; + +141  +tm_wday +; + +142  +tm_yday +; + +143  +tm_isd¡ +; + +145 #ifdef +__USE_BSD + + +146  +tm_gmtoff +; + +147 +__cÚ¡ + * +tm_zÚe +; + +149  +__tm_gmtoff +; + +150 +__cÚ¡ + * +__tm_zÚe +; + +153 +__END_NAMESPACE_STD + + +154 #ià +defšed + +__USE_XOPEN + || defšed +__USE_POSIX + || defšed +__USE_MISC + + +155 + $__USING_NAMESPACE_STD +( +tm +) + +159 #ifdeà +__USE_POSIX199309 + + +161  + s™im”¥ec + + +163  +time¥ec + +™_š‹rv® +; + +164  +time¥ec + +™_v®ue +; + +168  +sigev’t +; + +172 #ifdeà +__USE_XOPEN2K + + +173 #iâdeà +__pid_t_defšed + + +174  +__pid_t + + tpid_t +; + +175  + #__pid_t_defšed + + + ) + +180 +__BEGIN_NAMESPACE_STD + + +183 +þock_t + + $þock + (è +__THROW +; + +186 +time_t + + $time + ( +time_t + * +__tim” +è +__THROW +; + +189  + $difáime + ( +time_t + +__time1 +,ime_ˆ +__time0 +) + +190 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +193 +time_t + + $mktime + ( +tm + * +__ +è +__THROW +; + +199 +size_t + + $¡ráime + (* +__»¡riù + +__s +, +size_t + +__maxsize +, + +200 +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +201 +__cÚ¡ +  +tm + * +__»¡riù + +__ +è +__THROW +; + +202 +__END_NAMESPACE_STD + + +204 #ifdeà +__USE_XOPEN + + +207 * + $¡½time + ( +__cÚ¡ + * +__»¡riù + +__s +, + +208 +__cÚ¡ + * +__»¡riù + +__fmt +,  +tm + * +__ +) + +209 +__THROW +; + +212 #ifdeà +__USE_XOPEN2K8 + + +215  + ~ + +217 +size_t + + $¡ráime_l + (* +__»¡riù + +__s +, +size_t + +__maxsize +, + +218 +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +219 +__cÚ¡ +  +tm + * +__»¡riù + +__ +, + +220 +__loÿË_t + +__loc +è +__THROW +; + +223 #ifdeà +__USE_GNU + + +224 * + $¡½time_l + ( +__cÚ¡ + * +__»¡riù + +__s +, + +225 +__cÚ¡ + * +__»¡riù + +__fmt +,  +tm + * +__ +, + +226 +__loÿË_t + +__loc +è +__THROW +; + +230 +__BEGIN_NAMESPACE_STD + + +233  +tm + * + $gmtime + ( +__cÚ¡ + +time_t + * +__tim” +è +__THROW +; + +237  +tm + * + $loÿÉime + ( +__cÚ¡ + +time_t + * +__tim” +è +__THROW +; + +238 +__END_NAMESPACE_STD + + +240 #ià +defšed + +__USE_POSIX + || defšed +__USE_MISC + + +243  +tm + * + $gmtime_r + ( +__cÚ¡ + +time_t + * +__»¡riù + +__tim” +, + +244  +tm + * +__»¡riù + +__ +è +__THROW +; + +248  +tm + * + $loÿÉime_r + ( +__cÚ¡ + +time_t + * +__»¡riù + +__tim” +, + +249  +tm + * +__»¡riù + +__ +è +__THROW +; + +252 +__BEGIN_NAMESPACE_STD + + +255 * + $asùime + ( +__cÚ¡ +  +tm + * +__ +è +__THROW +; + +258 * + $ùime + ( +__cÚ¡ + +time_t + * +__tim” +è +__THROW +; + +259 +__END_NAMESPACE_STD + + +261 #ià +defšed + +__USE_POSIX + || defšed +__USE_MISC + + +266 * + $asùime_r + ( +__cÚ¡ +  +tm + * +__»¡riù + +__ +, + +267 * +__»¡riù + +__buf +è +__THROW +; + +270 * + $ùime_r + ( +__cÚ¡ + +time_t + * +__»¡riù + +__tim” +, + +271 * +__»¡riù + +__buf +è +__THROW +; + +276 * +__tzÇme +[2]; + +277  +__daylight +; + +278  +__timezÚe +; + +281 #ifdef +__USE_POSIX + + +283 * +tzÇme +[2]; + +287  + $tz£t + (è +__THROW +; + +290 #ià +defšed + +__USE_SVID + || defšed +__USE_XOPEN + + +291  +daylight +; + +292  +timezÚe +; + +295 #ifdeà +__USE_SVID + + +298  + $¡ime + ( +__cÚ¡ + +time_t + * +__wh’ +è +__THROW +; + +304  + #__i¦—p +( +y—r +) \ + +305 (( +y—r +è% 4 =ð0 && ((y—rè% 100 !ð0 || (y—rè% 400 =ð0)) + + ) + +308 #ifdeà +__USE_MISC + + +313 +time_t + + $timegm + ( +tm + * +__ +è +__THROW +; + +316 +time_t + + $tim–oÿl + ( +tm + * +__ +è +__THROW +; + +319  + $dysize + ( +__y—r +è +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +323 #ifdeà +__USE_POSIX199309 + + +328  + `Çno¦“p + ( +__cÚ¡ +  +time¥ec + * +__»que¡ed_time +, + +329  +time¥ec + * +__»maššg +); + +333  + $þock_g‘»s + ( +þockid_t + +__þock_id +,  +time¥ec + * +__»s +è +__THROW +; + +336  + $þock_g‘time + ( +þockid_t + +__þock_id +,  +time¥ec + * +__ +è +__THROW +; + +339  + $þock_£‰ime + ( +þockid_t + +__þock_id +, +__cÚ¡ +  +time¥ec + * +__ +) + +340 +__THROW +; + +342 #ifdeà +__USE_XOPEN2K + + +347  + `þock_Çno¦“p + ( +þockid_t + +__þock_id +,  +__æags +, + +348 +__cÚ¡ +  +time¥ec + * +__»q +, + +349  +time¥ec + * +__»m +); + +352  + $þock_g‘ýuþockid + ( +pid_t + +__pid +, +þockid_t + * +__þock_id +è +__THROW +; + +357  + $tim”_ü—‹ + ( +þockid_t + +__þock_id +, + +358  +sigev’t + * +__»¡riù + +__evp +, + +359 +tim”_t + * +__»¡riù + +__tim”id +è +__THROW +; + +362  + $tim”_d–‘e + ( +tim”_t + +__tim”id +è +__THROW +; + +365  + $tim”_£‰ime + ( +tim”_t + +__tim”id +,  +__æags +, + +366 +__cÚ¡ +  +™im”¥ec + * +__»¡riù + +__v®ue +, + +367  +™im”¥ec + * +__»¡riù + +__ov®ue +è +__THROW +; + +370  + $tim”_g‘time + ( +tim”_t + +__tim”id +,  +™im”¥ec + * +__v®ue +) + +371 +__THROW +; + +374  + $tim”_g‘ov”run + ( +tim”_t + +__tim”id +è +__THROW +; + +378 #ifdeà +__USE_XOPEN_EXTENDED + + +390  +g‘d©e_”r +; + +399  +tm + * + `g‘d©e + ( +__cÚ¡ + * +__¡ršg +); + +402 #ifdeà +__USE_GNU + + +413  + `g‘d©e_r + ( +__cÚ¡ + * +__»¡riù + +__¡ršg +, + +414  +tm + * +__»¡riù + +__»sbuå +); + +417 +__END_DECLS + + + @/usr/include/bits/sched.h + +22 #iâdeà +__Ãed_sched·¿m + + +24 #iâdeà +_SCHED_H + + +30  + #SCHED_OTHER + 0 + + ) + +31  + #SCHED_FIFO + 1 + + ) + +32  + #SCHED_RR + 2 + + ) + +33 #ifdeà +__USE_GNU + + +34  + #SCHED_BATCH + 3 + + ) + +37 #ifdeà +__USE_MISC + + +39  + #CSIGNAL + 0x000000fà + + ) + +40  + #CLONE_VM + 0x00000100 + + ) + +41  + #CLONE_FS + 0x00000200 + + ) + +42  + #CLONE_FILES + 0x00000400 + + ) + +43  + #CLONE_SIGHAND + 0x00000800 + + ) + +44  + #CLONE_PTRACE + 0x00002000 + + ) + +45  + #CLONE_VFORK + 0x00004000 + + ) + +47  + #CLONE_PARENT + 0x00008000 + + ) + +49  + #CLONE_THREAD + 0x00010000 + + ) + +50  + #CLONE_NEWNS + 0x00020000 + + ) + +51  + #CLONE_SYSVSEM + 0x00040000 + + ) + +52  + #CLONE_SETTLS + 0x00080000 + + ) + +53  + #CLONE_PARENT_SETTID + 0x00100000 + + ) + +55  + #CLONE_CHILD_CLEARTID + 0x00200000 + + ) + +57  + #CLONE_DETACHED + 0x00400000 + + ) + +58  + #CLONE_UNTRACED + 0x00800000 + + ) + +60  + #CLONE_CHILD_SETTID + 0x01000000 + + ) + +62  + #CLONE_NEWUTS + 0x04000000 + + ) + +63  + #CLONE_NEWIPC + 0x08000000 + + ) + +64  + #CLONE_NEWUSER + 0x10000000 + + ) + +65  + #CLONE_NEWPID + 0x20000000 + + ) + +66  + #CLONE_NEWNET + 0x40000000 + + ) + +67  + #CLONE_IO + 0x80000000 + + ) + +71  + ssched_·¿m + + +73  + m__sched_´iÜ™y +; + +76 + g__BEGIN_DECLS + + +78 #ifdeà +__USE_MISC + + +80  +þÚe + ((* +__â +è(* +__¬g +), * +__chžd_¡ack +, + +81  +__æags +, * +__¬g +, ...è +__THROW +; + +84  + $unsh¬e + ( +__æags +è +__THROW +; + +87  + $sched_g‘ýu + (è +__THROW +; + +90 +__END_DECLS + + +94 #ià! +defšed + +__defšed_sched·¿m + \ + +95 && ( +defšed + +__Ãed_sched·¿m + || defšed +_SCHED_H +) + +96  + #__defšed_sched·¿m + 1 + + ) + +98  + s__sched_·¿m + + +100  +__sched_´iÜ™y +; + +102 #undeà +__Ãed_sched·¿m + + +106 #ià +defšed + +_SCHED_H + && !defšed +__ýu_£t_t_defšed + + +107  + #__ýu_£t_t_defšed + + + ) + +109  + #__CPU_SETSIZE + 1024 + + ) + +110  + #__NCPUBITS + (8 *  ( +__ýu_mask +)) + + ) + +113  + t__ýu_mask +; + +116  + #__CPUELT +( +ýu +è((ýuè/ +__NCPUBITS +) + + ) + +117  + #__CPUMASK +( +ýu +è(( +__ýu_mask +è1 << ((ýuè% +__NCPUBITS +)) + + ) + +122 +__ýu_mask + +__b™s +[ +__CPU_SETSIZE + / +__NCPUBITS +]; + +123 } + týu_£t_t +; + +126 #ià + `__GNUC_PREREQ + (2, 91) + +127  + #__CPU_ZERO_S +( +£tsize +, +ýu£ +) \ + +128 dØ + `__bužtš_mem£t + ( +ýu£ +, '\0', +£tsize +); 0) + + ) + +130  + #__CPU_ZERO_S +( +£tsize +, +ýu£ +) \ + +132 +size_t + +__i +; \ + +133 +size_t + +__imax + = ( +£tsize +è/  ( +__ýu_mask +); \ + +134 +__ýu_mask + * +__b™s + = ( +ýu£ +)->__bits; \ + +135  +__i + = 0; __˜< +__imax +; ++__i) \ + +136 +__b™s +[ +__i +] = 0; \ + +137 + } +} 0) + + ) + +139  + #__CPU_SET_S +( +ýu +, +£tsize +, +ýu£ +) \ + +140 ( +__ex‹nsiÚ__ + \ + +141 ({ +size_t + +__ýu + = ( +ýu +); \ + +142 +__ýu + < 8 * ( +£tsize +) \ + +143 ? ((( +__ýu_mask + *è(( +ýu£ +)-> +__b™s +))[ + `__CPUELT + ( +__ýu +)] \ + +144 |ð + `__CPUMASK + ( +__ýu +)) \ + +145 : 0; })) + + ) + +146  + #__CPU_CLR_S +( +ýu +, +£tsize +, +ýu£ +) \ + +147 ( +__ex‹nsiÚ__ + \ + +148 ({ +size_t + +__ýu + = ( +ýu +); \ + +149 +__ýu + < 8 * ( +£tsize +) \ + +150 ? ((( +__ýu_mask + *è(( +ýu£ +)-> +__b™s +))[ + `__CPUELT + ( +__ýu +)] \ + +151 &ð~ + `__CPUMASK + ( +__ýu +)) \ + +152 : 0; })) + + ) + +153  + #__CPU_ISSET_S +( +ýu +, +£tsize +, +ýu£ +) \ + +154 ( +__ex‹nsiÚ__ + \ + +155 ({ +size_t + +__ýu + = ( +ýu +); \ + +156 +__ýu + < 8 * ( +£tsize +) \ + +157 ? (((( +__cÚ¡ + +__ýu_mask + *è(( +ýu£ +)-> +__b™s +))[ + `__CPUELT + ( +__ýu +)] \ + +158 & + `__CPUMASK + ( +__ýu +))) != 0 \ + +159 : 0; })) + + ) + +161  + #__CPU_COUNT_S +( +£tsize +, +ýu£ +) \ + +162 + `__sched_ýucouÁ + ( +£tsize +, +ýu£ +) + + ) + +164 #ià +__GNUC_PREREQ + (2, 91) + +165  + #__CPU_EQUAL_S +( +£tsize +, +ýu£1 +, +ýu£2 +) \ + +166 ( + `__bužtš_memcmp + ( +ýu£1 +, +ýu£2 +, +£tsize +è=ð0) + + ) + +168  + #__CPU_EQUAL_S +( +£tsize +, +ýu£1 +, +ýu£2 +) \ + +169 ( +__ex‹nsiÚ__ + \ + +170 ({ +__cÚ¡ + +__ýu_mask + * +__¬r1 + = ( +ýu£1 +)-> +__b™s +; \ + +171 +__cÚ¡ + +__ýu_mask + * +__¬r2 + = ( +ýu£2 +)-> +__b™s +; \ + +172 +size_t + +__imax + = ( +£tsize +è/  ( +__ýu_mask +); \ + +173 +size_t + +__i +; \ + +174  +__i + = 0; __˜< +__imax +; ++__i) \ + +175 ià( +__b™s +[ +__i +] != __bits[__i]) \ + +177 +__i + =ð +__imax +; })) + + ) + +180  + #__CPU_OP_S +( +£tsize +, +de¡£t +, +¤c£t1 +, +¤c£t2 +, +Ý +) \ + +181 ( +__ex‹nsiÚ__ + \ + +182 ({ +ýu_£t_t + * +__de¡ + = ( +de¡£t +); \ + +183 +__cÚ¡ + +__ýu_mask + * +__¬r1 + = ( +¤c£t1 +)-> +__b™s +; \ + +184 +__cÚ¡ + +__ýu_mask + * +__¬r2 + = ( +¤c£t2 +)-> +__b™s +; \ + +185 +size_t + +__imax + = ( +£tsize +è/  ( +__ýu_mask +); \ + +186 +size_t + +__i +; \ + +187  +__i + = 0; __˜< +__imax +; ++__i) \ + +188 (( +__ýu_mask + *è +__de¡ +-> +__b™s +)[ +__i +] = +__¬r1 +[__i] +Ý + +__¬r2 +[__i]; \ + +189 +__de¡ +; })) + + ) + +191  + #__CPU_ALLOC_SIZE +( +couÁ +) \ + +192 (((( +couÁ +è+ +__NCPUBITS + - 1è/ __NCPUBITSè*  ( +__ýu_mask +)) + + ) + +193  + #__CPU_ALLOC +( +couÁ +è + `__sched_ýu®loc + (couÁ) + + ) + +194  + #__CPU_FREE +( +ýu£t +è + `__sched_ýuä“ + (ýu£t) + + ) + +196 +__BEGIN_DECLS + + +198  + $__sched_ýucouÁ + ( +size_t + +__£tsize +, cÚ¡ +ýu_£t_t + * +__£ +) + +199 +__THROW +; + +200 +ýu_£t_t + * + $__sched_ýu®loc + ( +size_t + +__couÁ +è +__THROW + +__wur +; + +201  + $__sched_ýuä“ + ( +ýu_£t_t + * +__£t +è +__THROW +; + +203 +__END_DECLS + + + @/usr/include/bits/sigaction.h + +20 #iâdeà +_SIGNAL_H + + +25  + ssigaùiÚ + + +28 #ifdeà +__USE_POSIX199309 + + +32 +__sighªdËr_t + + m§_hªdËr +; + +34 (* + m§_sigaùiÚ +è(, + msigšfo_t + *, *); + +36 + m__sigaùiÚ_hªdËr +; + +37  + #§_hªdËr + +__sigaùiÚ_hªdËr +. +§_hªdËr + + + ) + +38  + #§_sigaùiÚ + +__sigaùiÚ_hªdËr +. +§_sigaùiÚ + + + ) + +40 +__sighªdËr_t + + m§_hªdËr +; + +44 +__sig£t_t + + m§_mask +; + +47  + m§_æags +; + +50 (* + m§_»¡Ü” +) (); + +54  + #SA_NOCLDSTOP + 1 + + ) + +55  + #SA_NOCLDWAIT + 2 + + ) + +56  + #SA_SIGINFO + 4 + + ) + +58 #ià +defšed + +__USE_UNIX98 + || defšed +__USE_MISC + + +59  + #SA_ONSTACK + 0x08000000 + + ) + +60  + #SA_RESTART + 0x10000000 + + ) + +61  + #SA_NODEFER + 0x40000000 + + ) + +63  + #SA_RESETHAND + 0x80000000 + + ) + +65 #ifdeà +__USE_MISC + + +66  + #SA_INTERRUPT + 0x20000000 + + ) + +69  + #SA_NOMASK + +SA_NODEFER + + + ) + +70  + #SA_ONESHOT + +SA_RESETHAND + + + ) + +71  + #SA_STACK + +SA_ONSTACK + + + ) + +75  + #SIG_BLOCK + 0 + + ) + +76  + #SIG_UNBLOCK + 1 + + ) + +77  + #SIG_SETMASK + 2 + + ) + + @/usr/include/bits/sigcontext.h + +19 #iâdeà +_BITS_SIGCONTEXT_H + + +20  + #_BITS_SIGCONTEXT_H + 1 + + ) + +22 #ià! +defšed + +_SIGNAL_H + && !defšed +_SYS_UCONTEXT_H + + +26  + ~ + +28  + s_å»g + + +30  + msignifiÿnd +[4]; + +31  + mexpÚ’t +; + +34  + s_åx»g + + +36  + msignifiÿnd +[4]; + +37  + mexpÚ’t +; + +38  + m·ddšg +[3]; + +41  + s_xmm»g + + +43 +__ušt32_t + + m–em’t +[4]; + +48 #ià +__WORDSIZE + == 32 + +50  + s_å¡©e + + +53 +__ušt32_t + + mcw +; + +54 +__ušt32_t + + msw +; + +55 +__ušt32_t + + mg +; + +56 +__ušt32_t + + moff +; + +57 +__ušt32_t + + mcs£l +; + +58 +__ušt32_t + + md©aoff +; + +59 +__ušt32_t + + md©a£l +; + +60  +_å»g + + m_¡ +[8]; + +61  + m¡©us +; + +62  + mmagic +; + +65 +__ušt32_t + + m_fx¤_’v +[6]; + +66 +__ušt32_t + + mmxc¤ +; + +67 +__ušt32_t + + m»£rved +; + +68  +_åx»g + + m_fx¤_¡ +[8]; + +69  +_xmm»g + + m_xmm +[8]; + +70 +__ušt32_t + + m·ddšg +[56]; + +73 #iâdeà +sigcÚ‹xt_¡ruù + + +78  + #sigcÚ‹xt_¡ruù + +sigcÚ‹xt + + + ) + +81  + ssigcÚ‹xt + + +83  + mgs +, + m__gsh +; + +84  + mfs +, + m__fsh +; + +85  + mes +, + m__esh +; + +86  + mds +, + m__dsh +; + +87  + medi +; + +88  + mesi +; + +89  + mebp +; + +90  + me¥ +; + +91  + mebx +; + +92  + medx +; + +93  + mecx +; + +94  + m—x +; + +95  + mŒ­no +; + +96  + m”r +; + +97  + me +; + +98  + mcs +, + m__csh +; + +99  + meæags +; + +100  + me¥_©_sigÇl +; + +101  + mss +, + m__ssh +; + +102  +_å¡©e + * + må¡©e +; + +103  + mÞdmask +; + +104  + mü2 +; + +109  + s_å¡©e + + +112 +__ušt16_t + + mcwd +; + +113 +__ušt16_t + + mswd +; + +114 +__ušt16_t + + máw +; + +115 +__ušt16_t + + mfÝ +; + +116 +__ušt64_t + + mr +; + +117 +__ušt64_t + + mrdp +; + +118 +__ušt32_t + + mmxc¤ +; + +119 +__ušt32_t + + mmxü_mask +; + +120  +_åx»g + + m_¡ +[8]; + +121  +_xmm»g + + m_xmm +[16]; + +122 +__ušt32_t + + m·ddšg +[24]; + +125  + ssigcÚ‹xt + + +127  + mr8 +; + +128  + mr9 +; + +129  + mr10 +; + +130  + mr11 +; + +131  + mr12 +; + +132  + mr13 +; + +133  + mr14 +; + +134  + mr15 +; + +135  + mrdi +; + +136  + mrsi +; + +137  + mrbp +; + +138  + mrbx +; + +139  + mrdx +; + +140  + m¿x +; + +141  + mrcx +; + +142  + mr¥ +; + +143  + mr +; + +144  + meæags +; + +145  + mcs +; + +146  + mgs +; + +147  + mfs +; + +148  + m__·d0 +; + +149  + m”r +; + +150  + mŒ­no +; + +151  + mÞdmask +; + +152  + mü2 +; + +153  +_å¡©e + * + må¡©e +; + +154  + m__»£rved1 + [8]; + + @/usr/include/bits/siginfo.h + +20 #ià! +defšed + +_SIGNAL_H + && !defšed +__Ãed_sigšfo_t + \ + +21 && ! +defšed + + g__Ãed_sigev’t_t + + +25  + ~ + +27 #ià(! +defšed + +__have_sigv®_t + \ + +28 && ( +defšed + + g_SIGNAL_H + || defšed + g__Ãed_sigšfo_t + \ + +29 || +defšed + + g__Ãed_sigev’t_t +)) + +30  + #__have_sigv®_t + 1 + + ) + +33  + usigv® + + +35  + msiv®_št +; + +36 * + msiv®_±r +; + +37 } + tsigv®_t +; + +40 #ià(! +defšed + +__have_sigšfo_t + \ + +41 && ( +defšed + + g_SIGNAL_H + || defšed + g__Ãed_sigšfo_t +)) + +42  + #__have_sigšfo_t + 1 + + ) + +44  + #__SI_MAX_SIZE + 128 + + ) + +45 #ià +__WORDSIZE + == 64 + +46  + #__SI_PAD_SIZE + (( +__SI_MAX_SIZE + /  ()è- 4) + + ) + +48  + #__SI_PAD_SIZE + (( +__SI_MAX_SIZE + /  ()è- 3) + + ) + +51  + ssigšfo + + +53  + msi_signo +; + +54  + msi_”ºo +; + +56  + msi_code +; + +60  + m_·d +[ +__SI_PAD_SIZE +]; + +65 +__pid_t + + msi_pid +; + +66 +__uid_t + + msi_uid +; + +67 } + m_kžl +; + +72  + msi_tid +; + +73  + msi_ov”run +; + +74 +sigv®_t + + msi_sigv® +; + +75 } + m_tim” +; + +80 +__pid_t + + msi_pid +; + +81 +__uid_t + + msi_uid +; + +82 +sigv®_t + + msi_sigv® +; + +83 } + m_¹ +; + +88 +__pid_t + + msi_pid +; + +89 +__uid_t + + msi_uid +; + +90  + msi_¡©us +; + +91 +__þock_t + + msi_utime +; + +92 +__þock_t + + msi_¡ime +; + +93 } + m_sigchld +; + +98 * + msi_addr +; + +99 } + m_sigçuÉ +; + +104  + msi_bªd +; + +105  + msi_fd +; + +106 } + m_sigpÞl +; + +107 } + m_sif›lds +; + +108 } + tsigšfo_t +; + +112  + #si_pid + +_sif›lds +. +_kžl +. +si_pid + + + ) + +113  + #si_uid + +_sif›lds +. +_kžl +. +si_uid + + + ) + +114  + #si_tim”id + +_sif›lds +. +_tim” +. +si_tid + + + ) + +115  + #si_ov”run + +_sif›lds +. +_tim” +. +si_ov”run + + + ) + +116  + #si_¡©us + +_sif›lds +. +_sigchld +. +si_¡©us + + + ) + +117  + #si_utime + +_sif›lds +. +_sigchld +. +si_utime + + + ) + +118  + #si_¡ime + +_sif›lds +. +_sigchld +. +si_¡ime + + + ) + +119  + #si_v®ue + +_sif›lds +. +_¹ +. +si_sigv® + + + ) + +120  + #si_št + +_sif›lds +. +_¹ +. +si_sigv® +. +siv®_št + + + ) + +121  + #si_±r + +_sif›lds +. +_¹ +. +si_sigv® +. +siv®_±r + + + ) + +122  + #si_addr + +_sif›lds +. +_sigçuÉ +. +si_addr + + + ) + +123  + #si_bªd + +_sif›lds +. +_sigpÞl +. +si_bªd + + + ) + +124  + #si_fd + +_sif›lds +. +_sigpÞl +. +si_fd + + + ) + +131 + mSI_ASYNCNL + = -60, + +132  + #SI_ASYNCNL + +SI_ASYNCNL + + + ) + +133 + mSI_TKILL + = -6, + +134  + #SI_TKILL + +SI_TKILL + + + ) + +135 + mSI_SIGIO +, + +136  + #SI_SIGIO + +SI_SIGIO + + + ) + +137 + mSI_ASYNCIO +, + +138  + #SI_ASYNCIO + +SI_ASYNCIO + + + ) + +139 + mSI_MESGQ +, + +140  + #SI_MESGQ + +SI_MESGQ + + + ) + +141 + mSI_TIMER +, + +142  + #SI_TIMER + +SI_TIMER + + + ) + +143 + mSI_QUEUE +, + +144  + #SI_QUEUE + +SI_QUEUE + + + ) + +145 + mSI_USER +, + +146  + #SI_USER + +SI_USER + + + ) + +147 + mSI_KERNEL + = 0x80 + +148  + #SI_KERNEL + +SI_KERNEL + + + ) + +155 + mILL_ILLOPC + = 1, + +156  + #ILL_ILLOPC + +ILL_ILLOPC + + + ) + +157 + mILL_ILLOPN +, + +158  + #ILL_ILLOPN + +ILL_ILLOPN + + + ) + +159 + mILL_ILLADR +, + +160  + #ILL_ILLADR + +ILL_ILLADR + + + ) + +161 + mILL_ILLTRP +, + +162  + #ILL_ILLTRP + +ILL_ILLTRP + + + ) + +163 + mILL_PRVOPC +, + +164  + #ILL_PRVOPC + +ILL_PRVOPC + + + ) + +165 + mILL_PRVREG +, + +166  + #ILL_PRVREG + +ILL_PRVREG + + + ) + +167 + mILL_COPROC +, + +168  + #ILL_COPROC + +ILL_COPROC + + + ) + +169 + mILL_BADSTK + + +170  + #ILL_BADSTK + +ILL_BADSTK + + + ) + +176 + mFPE_INTDIV + = 1, + +177  + #FPE_INTDIV + +FPE_INTDIV + + + ) + +178 + mFPE_INTOVF +, + +179  + #FPE_INTOVF + +FPE_INTOVF + + + ) + +180 + mFPE_FLTDIV +, + +181  + #FPE_FLTDIV + +FPE_FLTDIV + + + ) + +182 + mFPE_FLTOVF +, + +183  + #FPE_FLTOVF + +FPE_FLTOVF + + + ) + +184 + mFPE_FLTUND +, + +185  + #FPE_FLTUND + +FPE_FLTUND + + + ) + +186 + mFPE_FLTRES +, + +187  + #FPE_FLTRES + +FPE_FLTRES + + + ) + +188 + mFPE_FLTINV +, + +189  + #FPE_FLTINV + +FPE_FLTINV + + + ) + +190 + mFPE_FLTSUB + + +191  + #FPE_FLTSUB + +FPE_FLTSUB + + + ) + +197 + mSEGV_MAPERR + = 1, + +198  + #SEGV_MAPERR + +SEGV_MAPERR + + + ) + +199 + mSEGV_ACCERR + + +200  + #SEGV_ACCERR + +SEGV_ACCERR + + + ) + +206 + mBUS_ADRALN + = 1, + +207  + #BUS_ADRALN + +BUS_ADRALN + + + ) + +208 + mBUS_ADRERR +, + +209  + #BUS_ADRERR + +BUS_ADRERR + + + ) + +210 + mBUS_OBJERR + + +211  + #BUS_OBJERR + +BUS_OBJERR + + + ) + +217 + mTRAP_BRKPT + = 1, + +218  + #TRAP_BRKPT + +TRAP_BRKPT + + + ) + +219 + mTRAP_TRACE + + +220  + #TRAP_TRACE + +TRAP_TRACE + + + ) + +226 + mCLD_EXITED + = 1, + +227  + #CLD_EXITED + +CLD_EXITED + + + ) + +228 + mCLD_KILLED +, + +229  + #CLD_KILLED + +CLD_KILLED + + + ) + +230 + mCLD_DUMPED +, + +231  + #CLD_DUMPED + +CLD_DUMPED + + + ) + +232 + mCLD_TRAPPED +, + +233  + #CLD_TRAPPED + +CLD_TRAPPED + + + ) + +234 + mCLD_STOPPED +, + +235  + #CLD_STOPPED + +CLD_STOPPED + + + ) + +236 + mCLD_CONTINUED + + +237  + #CLD_CONTINUED + +CLD_CONTINUED + + + ) + +243 + mPOLL_IN + = 1, + +244  + #POLL_IN + +POLL_IN + + + ) + +245 + mPOLL_OUT +, + +246  + #POLL_OUT + +POLL_OUT + + + ) + +247 + mPOLL_MSG +, + +248  + #POLL_MSG + +POLL_MSG + + + ) + +249 + mPOLL_ERR +, + +250  + #POLL_ERR + +POLL_ERR + + + ) + +251 + mPOLL_PRI +, + +252  + #POLL_PRI + +POLL_PRI + + + ) + +253 + mPOLL_HUP + + +254  + #POLL_HUP + +POLL_HUP + + + ) + +257 #undeà +__Ãed_sigšfo_t + + +261 #ià( +defšed + +_SIGNAL_H + || defšed +__Ãed_sigev’t_t +) \ + +262 && ! +defšed + + g__have_sigev’t_t + + +263  + #__have_sigev’t_t + 1 + + ) + +266  + #__SIGEV_MAX_SIZE + 64 + + ) + +267 #ià +__WORDSIZE + == 64 + +268  + #__SIGEV_PAD_SIZE + (( +__SIGEV_MAX_SIZE + /  ()è- 4) + + ) + +270  + #__SIGEV_PAD_SIZE + (( +__SIGEV_MAX_SIZE + /  ()è- 3) + + ) + +273  + ssigev’t + + +275 +sigv®_t + + msigev_v®ue +; + +276  + msigev_signo +; + +277  + msigev_nÙify +; + +281  + m_·d +[ +__SIGEV_PAD_SIZE +]; + +285 +__pid_t + + m_tid +; + +289 (* + m_funùiÚ +è( + msigv®_t +); + +290 * + m_©Œibu‹ +; + +291 } + m_sigev_th»ad +; + +292 } + m_sigev_un +; + +293 } + tsigev’t_t +; + +296  + #sigev_nÙify_funùiÚ + +_sigev_un +. +_sigev_th»ad +. +_funùiÚ + + + ) + +297  + #sigev_nÙify_©Œibu‹s + +_sigev_un +. +_sigev_th»ad +. +_©Œibu‹ + + + ) + +302 + mSIGEV_SIGNAL + = 0, + +303  + #SIGEV_SIGNAL + +SIGEV_SIGNAL + + + ) + +304 + mSIGEV_NONE +, + +305  + #SIGEV_NONE + +SIGEV_NONE + + + ) + +306 + mSIGEV_THREAD +, + +307  + #SIGEV_THREAD + +SIGEV_THREAD + + + ) + +309 + mSIGEV_THREAD_ID + = 4 + +310  + #SIGEV_THREAD_ID + +SIGEV_THREAD_ID + + + ) + + @/usr/include/bits/signum.h + +20 #ifdef +_SIGNAL_H + + +23  + #SIG_ERR + (( +__sighªdËr_t +è-1è + + ) + +24  + #SIG_DFL + (( +__sighªdËr_t +è0è + + ) + +25  + #SIG_IGN + (( +__sighªdËr_t +è1è + + ) + +27 #ifdeà +__USE_UNIX98 + + +28  + #SIG_HOLD + (( +__sighªdËr_t +è2è + + ) + +33  + #SIGHUP + 1 + + ) + +34  + #SIGINT + 2 + + ) + +35  + #SIGQUIT + 3 + + ) + +36  + #SIGILL + 4 + + ) + +37  + #SIGTRAP + 5 + + ) + +38  + #SIGABRT + 6 + + ) + +39  + #SIGIOT + 6 + + ) + +40  + #SIGBUS + 7 + + ) + +41  + #SIGFPE + 8 + + ) + +42  + #SIGKILL + 9 + + ) + +43  + #SIGUSR1 + 10 + + ) + +44  + #SIGSEGV + 11 + + ) + +45  + #SIGUSR2 + 12 + + ) + +46  + #SIGPIPE + 13 + + ) + +47  + #SIGALRM + 14 + + ) + +48  + #SIGTERM + 15 + + ) + +49  + #SIGSTKFLT + 16 + + ) + +50  + #SIGCLD + +SIGCHLD + + + ) + +51  + #SIGCHLD + 17 + + ) + +52  + #SIGCONT + 18 + + ) + +53  + #SIGSTOP + 19 + + ) + +54  + #SIGTSTP + 20 + + ) + +55  + #SIGTTIN + 21 + + ) + +56  + #SIGTTOU + 22 + + ) + +57  + #SIGURG + 23 + + ) + +58  + #SIGXCPU + 24 + + ) + +59  + #SIGXFSZ + 25 + + ) + +60  + #SIGVTALRM + 26 + + ) + +61  + #SIGPROF + 27 + + ) + +62  + #SIGWINCH + 28 + + ) + +63  + #SIGPOLL + +SIGIO + + + ) + +64  + #SIGIO + 29 + + ) + +65  + #SIGPWR + 30 + + ) + +66  + #SIGSYS + 31 + + ) + +67  + #SIGUNUSED + 31 + + ) + +69  + #_NSIG + 65 + + ) + +72  + #SIGRTMIN + ( + `__libc_cu¼’t_sig¹mš + ()) + + ) + +73  + #SIGRTMAX + ( + `__libc_cu¼’t_sig¹max + ()) + + ) + +77  + #__SIGRTMIN + 32 + + ) + +78  + #__SIGRTMAX + ( +_NSIG + - 1) + + ) + + @/usr/include/bits/sigset.h + +21 #iâdef +_SIGSET_H_ty³s + + +22  + #_SIGSET_H_ty³s + 1 + + ) + +24  + t__sig_©omic_t +; + +28  + #_SIGSET_NWORDS + (1024 / (8 *  ())) + + ) + +31  + m__v® +[ +_SIGSET_NWORDS +]; + +32 } + t__sig£t_t +; + +43 #ià! +defšed + +_SIGSET_H_âs + && defšed +_SIGNAL_H + + +44  + #_SIGSET_H_âs + 1 + + ) + +46 #iâdeà +_EXTERN_INLINE + + +47  + #_EXTERN_INLINE + +__ex‹º_šlše + + + ) + +51  + #__sigmask +( +sig +) \ + +52 (((è1è<< ((( +sig +è- 1è% (8 *  ()))) + + ) + +55  + #__sigwÜd +( +sig +è(((sigè- 1è/ (8 *  ())) + + ) + +57 #ià +defšed + +__GNUC__ + && __GNUC__ >= 2 + +58  + #__sigem±y£t +( +£t +) \ + +59 ( + `__ex‹nsiÚ__ + ({  +__út + = +_SIGSET_NWORDS +; \ + +60 +sig£t_t + * +__£t + = ( +£t +); \ + +61 -- +__út + >ð0è +__£t +-> +__v® +[__cnt] = 0; \ + +62 0; })) + + ) + +63  + #__sigfžl£t +( +£t +) \ + +64 ( + `__ex‹nsiÚ__ + ({  +__út + = +_SIGSET_NWORDS +; \ + +65 +sig£t_t + * +__£t + = ( +£t +); \ + +66 -- +__út + >ð0è +__£t +-> +__v® +[__cnt] = ~0UL; \ + +67 0; })) + + ) + +69 #ifdeà +__USE_GNU + + +73  + #__sigi£m±y£t +( +£t +) \ + +74 ( + `__ex‹nsiÚ__ + ({  +__út + = +_SIGSET_NWORDS +; \ + +75 cÚ¡ +sig£t_t + * +__£t + = ( +£t +); \ + +76  +__»t + = +__£t +-> +__v® +[-- +__út +]; \ + +77 ! +__»t + && -- +__út + >= 0) \ + +78 +__»t + = +__£t +-> +__v® +[ +__út +]; \ + +79 +__»t + =ð0; })) + + ) + +80  + #__sigªd£t +( +de¡ +, +Ëá +, +right +) \ + +81 ( + `__ex‹nsiÚ__ + ({  +__út + = +_SIGSET_NWORDS +; \ + +82 +sig£t_t + * +__de¡ + = ( +de¡ +); \ + +83 cÚ¡ +sig£t_t + * +__Ëá + = ( +Ëá +); \ + +84 cÚ¡ +sig£t_t + * +__right + = ( +right +); \ + +85 -- +__út + >= 0) \ + +86 +__de¡ +-> +__v® +[ +__út +] = ( +__Ëá +->__val[__cnt] \ + +87 & +__right +-> +__v® +[ +__út +]); \ + +88 0; })) + + ) + +89  + #__sigÜ£t +( +de¡ +, +Ëá +, +right +) \ + +90 ( + `__ex‹nsiÚ__ + ({  +__út + = +_SIGSET_NWORDS +; \ + +91 +sig£t_t + * +__de¡ + = ( +de¡ +); \ + +92 cÚ¡ +sig£t_t + * +__Ëá + = ( +Ëá +); \ + +93 cÚ¡ +sig£t_t + * +__right + = ( +right +); \ + +94 -- +__út + >= 0) \ + +95 +__de¡ +-> +__v® +[ +__út +] = ( +__Ëá +->__val[__cnt] \ + +96 | +__right +-> +__v® +[ +__út +]); \ + +97 0; })) + + ) + +104  +__sigismemb” + ( +__cÚ¡ + +__sig£t_t + *, ); + +105  +__sigadd£t + ( +__sig£t_t + *, ); + +106  +__sigd–£t + ( +__sig£t_t + *, ); + +108 #ifdeà +__USE_EXTERN_INLINES + + +109  + #__SIGSETFN +( +NAME +, +BODY +, +CONST +) \ + +110 +_EXTERN_INLINE + \ + +111 + `NAME + ( +CONST + +__sig£t_t + * +__£t +,  +__sig +) \ + +113  +__mask + = + `__sigmask + ( +__sig +); \ + +114  +__wÜd + = + `__sigwÜd + ( +__sig +); \ + +115  +BODY +; \ + +116 } + + ) + +118 +__SIGSETFN + ( +__sigismemb” +, ( +__£t +-> +__v® +[ +__wÜd +] & +__mask +è? 1 : 0, +__cÚ¡ +) + +119 +__SIGSETFN + ( +__sigadd£t +, (( +__£t +-> +__v® +[ +__wÜd +] |ð +__mask +), 0), ) + +120 +__SIGSETFN + ( +__sigd–£t +, (( +__£t +-> +__v® +[ +__wÜd +] &ð~ +__mask +), 0), ) + +122 #undeà +__SIGSETFN + + + @/usr/include/bits/sigstack.h + +20 #iâdeà +_SIGNAL_H + + +26  + ssig¡ack + + +28 * + mss_¥ +; + +29  + mss_Ú¡ack +; + +36 + mSS_ONSTACK + = 1, + +37  + #SS_ONSTACK + +SS_ONSTACK + + + ) + +38 + mSS_DISABLE + + +39  + #SS_DISABLE + +SS_DISABLE + + + ) + +43  + #MINSIGSTKSZ + 2048 + + ) + +46  + #SIGSTKSZ + 8192 + + ) + +50  + ssig®t¡ack + + +52 * + mss_¥ +; + +53  + mss_æags +; + +54 +size_t + + mss_size +; + +55 } + t¡ack_t +; + + @/usr/include/bits/sigthread.h + +20 #iâdeà +_BITS_SIGTHREAD_H + + +21  + #_BITS_SIGTHREAD_H + 1 + + ) + +23 #ià! +defšed + +_SIGNAL_H + && !defšed +_PTHREAD_H + + +31  + $±h»ad_sigmask + ( +__how +, + +32 +__cÚ¡ + +__sig£t_t + * +__»¡riù + +__Ãwmask +, + +33 +__sig£t_t + * +__»¡riù + +__Þdmask +) +__THROW +; + +36  + $±h»ad_kžl + ( +±h»ad_t + +__th»adid +,  +__signo +è +__THROW +; + +38 #ifdeà +__USE_GNU + + +40  + $±h»ad_sigqueue + ( +±h»ad_t + +__th»adid +,  +__signo +, + +41 cÚ¡  +sigv® + +__v®ue +è +__THROW +; + + @/usr/include/bits/time.h + +24 #iâdeà +__Ãed_timev® + + +25 #iâdeà +_BITS_TIME_H + + +26  + #_BITS_TIME_H + 1 + + ) + +34  + #CLOCKS_PER_SEC + 1000000l + + ) + +36 #ià! +defšed + +__STRICT_ANSI__ + && !defšed +__USE_XOPEN2K + + +39  + ~ + +40  +__syscÚf + (); + +41  + #CLK_TCK + (( +__þock_t +è + `__syscÚf + (2)è + + ) + +44 #ifdeà +__USE_POSIX199309 + + +46  + #CLOCK_REALTIME + 0 + + ) + +48  + #CLOCK_MONOTONIC + 1 + + ) + +50  + #CLOCK_PROCESS_CPUTIME_ID + 2 + + ) + +52  + #CLOCK_THREAD_CPUTIME_ID + 3 + + ) + +55  + #TIMER_ABSTIME + 1 + + ) + +61 #ifdeà +__Ãed_timev® + + +62 #undeà +__Ãed_timev® + + +63 #iâdeà +_STRUCT_TIMEVAL + + +64  + #_STRUCT_TIMEVAL + 1 + + ) + +65  + ~ + +69  + stimev® + + +71 +__time_t + + mtv_£c +; + +72 +__su£cÚds_t + + mtv_u£c +; + + @/usr/include/linux/errno.h + +1 #iâdeà +_LINUX_ERRNO_H + + +2  + #_LINUX_ERRNO_H + + + ) + +4  + ~ + + @/usr/include/sys/ucontext.h + +19 #iâdeà +_SYS_UCONTEXT_H + + +20  + #_SYS_UCONTEXT_H + 1 + + ) + +22  + ~<ã©u»s.h +> + +23  + ~ + +24  + ~ + +28  + ~ + +30 #ià +__WORDSIZE + == 64 + +33  + tg»g_t +; + +36  + #NGREG + 23 + + ) + +39  +g»g_t + + tg»g£t_t +[ +NGREG +]; + +41 #ifdeà +__USE_GNU + + +45 + mREG_R8 + = 0, + +46  + #REG_R8 + +REG_R8 + + + ) + +47 + mREG_R9 +, + +48  + #REG_R9 + +REG_R9 + + + ) + +49 + mREG_R10 +, + +50  + #REG_R10 + +REG_R10 + + + ) + +51 + mREG_R11 +, + +52  + #REG_R11 + +REG_R11 + + + ) + +53 + mREG_R12 +, + +54  + #REG_R12 + +REG_R12 + + + ) + +55 + mREG_R13 +, + +56  + #REG_R13 + +REG_R13 + + + ) + +57 + mREG_R14 +, + +58  + #REG_R14 + +REG_R14 + + + ) + +59 + mREG_R15 +, + +60  + #REG_R15 + +REG_R15 + + + ) + +61 + mREG_RDI +, + +62  + #REG_RDI + +REG_RDI + + + ) + +63 + mREG_RSI +, + +64  + #REG_RSI + +REG_RSI + + + ) + +65 + mREG_RBP +, + +66  + #REG_RBP + +REG_RBP + + + ) + +67 + mREG_RBX +, + +68  + #REG_RBX + +REG_RBX + + + ) + +69 + mREG_RDX +, + +70  + #REG_RDX + +REG_RDX + + + ) + +71 + mREG_RAX +, + +72  + #REG_RAX + +REG_RAX + + + ) + +73 + mREG_RCX +, + +74  + #REG_RCX + +REG_RCX + + + ) + +75 + mREG_RSP +, + +76  + #REG_RSP + +REG_RSP + + + ) + +77 + mREG_RIP +, + +78  + #REG_RIP + +REG_RIP + + + ) + +79 + mREG_EFL +, + +80  + #REG_EFL + +REG_EFL + + + ) + +81 + mREG_CSGSFS +, + +82  + #REG_CSGSFS + +REG_CSGSFS + + + ) + +83 + mREG_ERR +, + +84  + #REG_ERR + +REG_ERR + + + ) + +85 + mREG_TRAPNO +, + +86  + #REG_TRAPNO + +REG_TRAPNO + + + ) + +87 + mREG_OLDMASK +, + +88  + #REG_OLDMASK + +REG_OLDMASK + + + ) + +89 + mREG_CR2 + + +90  + #REG_CR2 + +REG_CR2 + + + ) + +94  + s_libc_åx»g + + +96  + msignifiÿnd +[4]; + +97  + mexpÚ’t +; + +98  + m·ddšg +[3]; + +101  + s_libc_xmm»g + + +103 +__ušt32_t + + m–em’t +[4]; + +106  + s_libc_å¡©e + + +109 +__ušt16_t + + mcwd +; + +110 +__ušt16_t + + mswd +; + +111 +__ušt16_t + + máw +; + +112 +__ušt16_t + + mfÝ +; + +113 +__ušt64_t + + mr +; + +114 +__ušt64_t + + mrdp +; + +115 +__ušt32_t + + mmxc¤ +; + +116 +__ušt32_t + + mmxü_mask +; + +117  +_libc_åx»g + + m_¡ +[8]; + +118  +_libc_xmm»g + + m_xmm +[16]; + +119 +__ušt32_t + + m·ddšg +[24]; + +123  +_libc_å¡©e + * + tå»g£t_t +; + +128 +g»g£t_t + + mg»gs +; + +130 +å»g£t_t + + må»gs +; + +131  + m__»£rved1 + [8]; + +132 } + tmcÚ‹xt_t +; + +135  + sucÚ‹xt + + +137  + muc_æags +; + +138  +ucÚ‹xt + * + muc_lšk +; + +139 +¡ack_t + + muc_¡ack +; + +140 +mcÚ‹xt_t + + muc_mcÚ‹xt +; + +141 +__sig£t_t + + muc_sigmask +; + +142  +_libc_å¡©e + + m__å»gs_mem +; + +143 } + tucÚ‹xt_t +; + +148  + tg»g_t +; + +151  + #NGREG + 19 + + ) + +154  +g»g_t + + tg»g£t_t +[ +NGREG +]; + +156 #ifdeà +__USE_GNU + + +160 + mREG_GS + = 0, + +161  + #REG_GS + +REG_GS + + + ) + +162 + mREG_FS +, + +163  + #REG_FS + +REG_FS + + + ) + +164 + mREG_ES +, + +165  + #REG_ES + +REG_ES + + + ) + +166 + mREG_DS +, + +167  + #REG_DS + +REG_DS + + + ) + +168 + mREG_EDI +, + +169  + #REG_EDI + +REG_EDI + + + ) + +170 + mREG_ESI +, + +171  + #REG_ESI + +REG_ESI + + + ) + +172 + mREG_EBP +, + +173  + #REG_EBP + +REG_EBP + + + ) + +174 + mREG_ESP +, + +175  + #REG_ESP + +REG_ESP + + + ) + +176 + mREG_EBX +, + +177  + #REG_EBX + +REG_EBX + + + ) + +178 + mREG_EDX +, + +179  + #REG_EDX + +REG_EDX + + + ) + +180 + mREG_ECX +, + +181  + #REG_ECX + +REG_ECX + + + ) + +182 + mREG_EAX +, + +183  + #REG_EAX + +REG_EAX + + + ) + +184 + mREG_TRAPNO +, + +185  + #REG_TRAPNO + +REG_TRAPNO + + + ) + +186 + mREG_ERR +, + +187  + #REG_ERR + +REG_ERR + + + ) + +188 + mREG_EIP +, + +189  + #REG_EIP + +REG_EIP + + + ) + +190 + mREG_CS +, + +191  + #REG_CS + +REG_CS + + + ) + +192 + mREG_EFL +, + +193  + #REG_EFL + +REG_EFL + + + ) + +194 + mREG_UESP +, + +195  + #REG_UESP + +REG_UESP + + + ) + +196 + mREG_SS + + +197  + #REG_SS + +REG_SS + + + ) + +202  + s_libc_å»g + + +204  + msignifiÿnd +[4]; + +205  + mexpÚ’t +; + +208  + s_libc_å¡©e + + +210  + mcw +; + +211  + msw +; + +212  + mg +; + +213  + moff +; + +214  + mcs£l +; + +215  + md©aoff +; + +216  + md©a£l +; + +217  +_libc_å»g + + m_¡ +[8]; + +218  + m¡©us +; + +222  +_libc_å¡©e + * + tå»g£t_t +; + +227 +g»g£t_t + + mg»gs +; + +230 +å»g£t_t + + må»gs +; + +231  + mÞdmask +; + +232  + mü2 +; + +233 } + tmcÚ‹xt_t +; + +236  + sucÚ‹xt + + +238  + muc_æags +; + +239  +ucÚ‹xt + * + muc_lšk +; + +240 +¡ack_t + + muc_¡ack +; + +241 +mcÚ‹xt_t + + muc_mcÚ‹xt +; + +242 +__sig£t_t + + muc_sigmask +; + +243  +_libc_å¡©e + + m__å»gs_mem +; + +244 } + tucÚ‹xt_t +; + + @/usr/include/asm/errno.h + +1  + ~ + + @/usr/include/asm-generic/errno.h + +1 #iâdeà +_ASM_GENERIC_ERRNO_H + + +2  + #_ASM_GENERIC_ERRNO_H + + + ) + +4  + ~ + +6  + #EDEADLK + 35 + + ) + +7  + #ENAMETOOLONG + 36 + + ) + +8  + #ENOLCK + 37 + + ) + +9  + #ENOSYS + 38 + + ) + +10  + #ENOTEMPTY + 39 + + ) + +11  + #ELOOP + 40 + + ) + +12  + #EWOULDBLOCK + +EAGAIN + + + ) + +13  + #ENOMSG + 42 + + ) + +14  + #EIDRM + 43 + + ) + +15  + #ECHRNG + 44 + + ) + +16  + #EL2NSYNC + 45 + + ) + +17  + #EL3HLT + 46 + + ) + +18  + #EL3RST + 47 + + ) + +19  + #ELNRNG + 48 + + ) + +20  + #EUNATCH + 49 + + ) + +21  + #ENOCSI + 50 + + ) + +22  + #EL2HLT + 51 + + ) + +23  + #EBADE + 52 + + ) + +24  + #EBADR + 53 + + ) + +25  + #EXFULL + 54 + + ) + +26  + #ENOANO + 55 + + ) + +27  + #EBADRQC + 56 + + ) + +28  + #EBADSLT + 57 + + ) + +30  + #EDEADLOCK + +EDEADLK + + + ) + +32  + #EBFONT + 59 + + ) + +33  + #ENOSTR + 60 + + ) + +34  + #ENODATA + 61 + + ) + +35  + #ETIME + 62 + + ) + +36  + #ENOSR + 63 + + ) + +37  + #ENONET + 64 + + ) + +38  + #ENOPKG + 65 + + ) + +39  + #EREMOTE + 66 + + ) + +40  + #ENOLINK + 67 + + ) + +41  + #EADV + 68 + + ) + +42  + #ESRMNT + 69 + + ) + +43  + #ECOMM + 70 + + ) + +44  + #EPROTO + 71 + + ) + +45  + #EMULTIHOP + 72 + + ) + +46  + #EDOTDOT + 73 + + ) + +47  + #EBADMSG + 74 + + ) + +48  + #EOVERFLOW + 75 + + ) + +49  + #ENOTUNIQ + 76 + + ) + +50  + #EBADFD + 77 + + ) + +51  + #EREMCHG + 78 + + ) + +52  + #ELIBACC + 79 + + ) + +53  + #ELIBBAD + 80 + + ) + +54  + #ELIBSCN + 81 + + ) + +55  + #ELIBMAX + 82 + + ) + +56  + #ELIBEXEC + 83 + + ) + +57  + #EILSEQ + 84 + + ) + +58  + #ERESTART + 85 + + ) + +59  + #ESTRPIPE + 86 + + ) + +60  + #EUSERS + 87 + + ) + +61  + #ENOTSOCK + 88 + + ) + +62  + #EDESTADDRREQ + 89 + + ) + +63  + #EMSGSIZE + 90 + + ) + +64  + #EPROTOTYPE + 91 + + ) + +65  + #ENOPROTOOPT + 92 + + ) + +66  + #EPROTONOSUPPORT + 93 + + ) + +67  + #ESOCKTNOSUPPORT + 94 + + ) + +68  + #EOPNOTSUPP + 95 + + ) + +69  + #EPFNOSUPPORT + 96 + + ) + +70  + #EAFNOSUPPORT + 97 + + ) + +71  + #EADDRINUSE + 98 + + ) + +72  + #EADDRNOTAVAIL + 99 + + ) + +73  + #ENETDOWN + 100 + + ) + +74  + #ENETUNREACH + 101 + + ) + +75  + #ENETRESET + 102 + + ) + +76  + #ECONNABORTED + 103 + + ) + +77  + #ECONNRESET + 104 + + ) + +78  + #ENOBUFS + 105 + + ) + +79  + #EISCONN + 106 + + ) + +80  + #ENOTCONN + 107 + + ) + +81  + #ESHUTDOWN + 108 + + ) + +82  + #ETOOMANYREFS + 109 + + ) + +83  + #ETIMEDOUT + 110 + + ) + +84  + #ECONNREFUSED + 111 + + ) + +85  + #EHOSTDOWN + 112 + + ) + +86  + #EHOSTUNREACH + 113 + + ) + +87  + #EALREADY + 114 + + ) + +88  + #EINPROGRESS + 115 + + ) + +89  + #ESTALE + 116 + + ) + +90  + #EUCLEAN + 117 + + ) + +91  + #ENOTNAM + 118 + + ) + +92  + #ENAVAIL + 119 + + ) + +93  + #EISNAM + 120 + + ) + +94  + #EREMOTEIO + 121 + + ) + +95  + #EDQUOT + 122 + + ) + +97  + #ENOMEDIUM + 123 + + ) + +98  + #EMEDIUMTYPE + 124 + + ) + +99  + #ECANCELED + 125 + + ) + +100  + #ENOKEY + 126 + + ) + +101  + #EKEYEXPIRED + 127 + + ) + +102  + #EKEYREVOKED + 128 + + ) + +103  + #EKEYREJECTED + 129 + + ) + +106  + #EOWNERDEAD + 130 + + ) + +107  + #ENOTRECOVERABLE + 131 + + ) + +109  + #ERFKILL + 132 + + ) + + @/usr/include/asm-generic/errno-base.h + +1 #iâdeà +_ASM_GENERIC_ERRNO_BASE_H + + +2  + #_ASM_GENERIC_ERRNO_BASE_H + + + ) + +4  + #EPERM + 1 + + ) + +5  + #ENOENT + 2 + + ) + +6  + #ESRCH + 3 + + ) + +7  + #EINTR + 4 + + ) + +8  + #EIO + 5 + + ) + +9  + #ENXIO + 6 + + ) + +10  + #E2BIG + 7 + + ) + +11  + #ENOEXEC + 8 + + ) + +12  + #EBADF + 9 + + ) + +13  + #ECHILD + 10 + + ) + +14  + #EAGAIN + 11 + + ) + +15  + #ENOMEM + 12 + + ) + +16  + #EACCES + 13 + + ) + +17  + #EFAULT + 14 + + ) + +18  + #ENOTBLK + 15 + + ) + +19  + #EBUSY + 16 + + ) + +20  + #EEXIST + 17 + + ) + +21  + #EXDEV + 18 + + ) + +22  + #ENODEV + 19 + + ) + +23  + #ENOTDIR + 20 + + ) + +24  + #EISDIR + 21 + + ) + +25  + #EINVAL + 22 + + ) + +26  + #ENFILE + 23 + + ) + +27  + #EMFILE + 24 + + ) + +28  + #ENOTTY + 25 + + ) + +29  + #ETXTBSY + 26 + + ) + +30  + #EFBIG + 27 + + ) + +31  + #ENOSPC + 28 + + ) + +32  + #ESPIPE + 29 + + ) + +33  + #EROFS + 30 + + ) + +34  + #EMLINK + 31 + + ) + +35  + #EPIPE + 32 + + ) + +36  + #EDOM + 33 + + ) + +37  + #ERANGE + 34 + + ) + + @ +1 +. +1 +/usr/include +64 +1601 +CG.h +CG_outputBuilder.h +CG_outputRepr.h +CG_stringBuilder.h +CG_stringRepr.h +CG_suifBuilder.h +CG_suifRepr.h +code_gen.h +output_repr.h +/usr/include/stdio.h +/usr/include/bits/stdio-ldbl.h +/usr/include/bits/stdio.h +/usr/include/bits/stdio2.h +/usr/include/bits/stdio_lim.h +/usr/include/bits/sys_errlist.h +/usr/include/bits/types.h +/usr/include/features.h +/usr/include/getopt.h +/usr/include/libio.h +/usr/include/_G_config.h +/usr/include/bits/libio-ldbl.h +/usr/include/bits/predefs.h +/usr/include/bits/stdio-lock.h +/usr/include/bits/typesizes.h +/usr/include/bits/wordsize.h +/usr/include/ctype.h +/usr/include/gnu/stubs.h +/usr/include/sys/cdefs.h +/usr/include/bits/libc-lock.h +/usr/include/endian.h +/usr/include/gconv.h +/usr/include/gnu/stubs-32.h +/usr/include/gnu/stubs-64.h +/usr/include/wchar.h +/usr/include/xlocale.h +/usr/include/bits/byteswap.h +/usr/include/bits/endian.h +/usr/include/bits/wchar-ldbl.h +/usr/include/bits/wchar.h +/usr/include/bits/wchar2.h +/usr/include/errno.h +/usr/include/gnu/option-groups.h +/usr/include/pthread.h +/usr/include/wctype.h +/usr/include/bits/errno.h +/usr/include/bits/pthreadtypes.h +/usr/include/bits/setjmp.h +/usr/include/sched.h +/usr/include/signal.h +/usr/include/time.h +/usr/include/bits/sched.h +/usr/include/bits/sigaction.h +/usr/include/bits/sigcontext.h +/usr/include/bits/siginfo.h +/usr/include/bits/signum.h +/usr/include/bits/sigset.h +/usr/include/bits/sigstack.h +/usr/include/bits/sigthread.h +/usr/include/bits/time.h +/usr/include/linux/errno.h +/usr/include/sys/ucontext.h +/usr/include/asm/errno.h +/usr/include/asm-generic/errno.h +/usr/include/asm-generic/errno-base.h diff --git a/omegalib/code_gen/include/code_gen/output_repr.h b/omegalib/code_gen/include/code_gen/output_repr.h new file mode 100644 index 0000000..254e71b --- /dev/null +++ b/omegalib/code_gen/include/code_gen/output_repr.h @@ -0,0 +1,46 @@ +#ifndef OUTPUT_REPR_H +#define OUTPUT_REPR_H + +#include +#include +#include +#include +#include + +namespace omega { +extern int last_level; + +CG_outputRepr* outputIdent(CG_outputBuilder* ocg, const Relation &R, Variable_ID v, const std::vector &assigned_on_the_fly); +std::pair outputAssignment(CG_outputBuilder *ocg, const Relation &R_, Variable_ID v, Relation &enforced, CG_outputRepr *&if_repr, const std::vector &assigned_on_the_fly); +std::pair outputBounds(CG_outputBuilder* ocg, const Relation &bounds, Variable_ID v, int indent, Relation &enforced, const std::vector &assigned_on_the_fly); +Tuple outputSubstitution(CG_outputBuilder* ocg, const Relation &R, const std::vector &assigned_on_the_fly); +CG_outputRepr* outputStatement(CG_outputBuilder* ocg, CG_outputRepr *stmt, int indent, const Relation &mapping, const Relation &known, const std::vector &assigned_on_the_fly); +CG_outputRepr* outputGuard(CG_outputBuilder* ocg, const Relation &guards_in, const std::vector &assigned_on_the_fly); +CG_outputRepr* output_as_guard(CG_outputBuilder* ocg, const Relation &guards_in, Constraint_Handle e, bool is_equality, const std::vector &assigned_on_the_fly); +CG_outputRepr* output_EQ_strides(CG_outputBuilder* ocg, const Relation &guards_in, const std::vector &assigned_on_the_fly); +CG_outputRepr* output_GEQ_strides(CG_outputBuilder* ocg, const Relation &guards_in, const std::vector &assigned_on_the_fly); +CG_outputRepr *outputLBasRepr(CG_outputBuilder* ocg, const GEQ_Handle &g, Relation &bounds, Variable_ID v, coef_t stride, const EQ_Handle &strideEQ, Relation known, const std::vector &assigned_on_the_fly); +CG_outputRepr *outputUBasRepr(CG_outputBuilder* ocg, const GEQ_Handle &g, Relation & bounds, Variable_ID v, + coef_t /*stride*/, // currently unused + const EQ_Handle &/*strideEQ*/, + const std::vector &assigned_on_the_fly = std::vector(last_level, static_cast(NULL))); +CG_outputRepr* outputEasyBoundAsRepr(CG_outputBuilder* ocg, Relation &bounds, const Constraint_Handle &g, Variable_ID v, bool ignoreWC, int ceiling, const std::vector &assigned_on_the_fly); + + +bool boundHitsStride(const GEQ_Handle &g, Variable_ID v, const EQ_Handle &strideEQ, coef_t /*stride, currently unused*/, Relation known); +Relation greatest_common_step(const Tuple &I, const Tuple &active, int level, const Relation &known = Relation::Null()); +bool findFloorInequality(Relation &r, Variable_ID v, GEQ_Handle &h, Variable_ID excluded); +Relation project_onto_levels(Relation R, int last_level, bool wildcards); +bool isSimpleStride(const EQ_Handle &g, Variable_ID v); +int countStrides(Conjunct *c, Variable_ID v, EQ_Handle &strideEQ, bool &simple); +bool hasBound(Relation r, int level, int UB); +bool find_any_constraint(int s, int level, Relation &kr, int direction, Relation &S, bool approx); +bool has_nonstride_EQ(Relation r, int level); +Relation pickOverhead(Relation r, int liftTo); +Relation minMaxOverhead(Relation r, int level); +int max_fs_arity(const Constraint_Handle &c); + + +} + +#endif diff --git a/omegalib/code_gen/include/code_gen/rose_attributes.h b/omegalib/code_gen/include/code_gen/rose_attributes.h new file mode 100644 index 0000000..9766f52 --- /dev/null +++ b/omegalib/code_gen/include/code_gen/rose_attributes.h @@ -0,0 +1,91 @@ +#ifndef ROSE_ATTRIBUTES_HH +#define ROSE_ATTRIBUTES_HH + +#include "rose.h" +#include +#include +#include + +namespace omega { + +class CodeInsertion; + +typedef std::vector CodeInsertionPtrList; +typedef std::vector::iterator CodeInsertionPtrListItr; + +class CodeInsertion { +public: + int loop_level; + bool marked; + CodeInsertion(int looplevel) { this->loop_level = looplevel; marked = false; } + ~CodeInsertion() {} + virtual SgStatement* getStatement(SgScopeStatement* scopeStmt = NULL) = 0; +}; + +class PragmaInsertion : public CodeInsertion { +private: + std::string name; +public: + PragmaInsertion(int loop_level, const std::string &pragma) : CodeInsertion(loop_level) { this->name = std::string(pragma); } + ~PragmaInsertion() { } + virtual SgStatement* getStatement(SgScopeStatement* scopeStmt = NULL); +}; + +class MMPrefetchInsertion : public CodeInsertion { +private: + std::string arrName; + std::vector indecies; + std::vector offsets; + int indexCount; + int cacheHint; + void initialize(const std::string& arrName, int hint); + void addDim(int offset); + void addDim(int offset, const std::string& indexer); + SgExpression* buildArrArg(SgScopeStatement* scopeStmt); + SgExpression* makeIndexExp(int dim, SgScopeStatement* scopeStmt); +public: + MMPrefetchInsertion(int loop_level, const std::string &arr, int hint) : CodeInsertion(loop_level) + { this->initialize(arr, hint); } + ~MMPrefetchInsertion() { } + virtual SgStatement* getStatement(SgScopeStatement* scopeStmt = NULL); +}; + +class CodeInsertionAttribute : public AstAttribute { +private: + std::vector code_insertions; +public: + CodeInsertionAttribute() { code_insertions = std::vector(); } + ~CodeInsertionAttribute() {} + + void add(CodeInsertion* ci) { code_insertions.push_back(ci); } + CodeInsertionPtrListItr begin() { return code_insertions.begin(); } + CodeInsertionPtrListItr end() { return code_insertions.end(); } + void remove(CodeInsertion* ci) { std::remove(code_insertions.begin(), code_insertions.end(), ci); } + int countCodeInsertions() { return code_insertions.size(); } +}; + +struct CodeInsertionMark { +public: + SgStatement* stmt; + CodeInsertion* ci; +}; + +class CodeInsertionVisitor : public AstPrePostProcessing { +private: + int loop_level; + std::vector ci_marks; + void markStmt(SgStatement* stmt, CodeInsertion* ci); +public: + void initialize(); + virtual void preOrderVisit(SgNode* n); + virtual void postOrderVisit(SgNode* n); + void insertCode(); +}; + +void postProcessRoseCodeInsertion(SgProject* proj); +void copyAttributes(SgNode* s, SgNode* d); +CodeInsertionAttribute* getOrCreateCodeInsertionAttribute(SgNode* node); + +} + +#endif diff --git a/omegalib/code_gen/src/CG.cc b/omegalib/code_gen/src/CG.cc new file mode 100644 index 0000000..42bd172 --- /dev/null +++ b/omegalib/code_gen/src/CG.cc @@ -0,0 +1,1163 @@ +/***************************************************************************** + Copyright (C) 1994-2000 the Omega Project Team + Copyright (C) 2005-2011 Chun Chen + All Rights Reserved. + + Purpose: + CG node classes, used to build AST tree from polyhedra scanning. + + Notes: + Parameter "restriction" is always tighter than "known" since CG_split + node does not correspond to any code for enforcement. This property is + destroyed after hoistGuard since "restriction" is not used anymore. + CG node's children are guaranteed not to be NULL, either NULL child is + removed from the children or the parent node itself becomes NULL. + + History: + 04/20/96 printRepr added by D people. Lei Zhou + 10/24/06 hoistGuard added by chun + 08/03/10 collect CG classes into one place, by Chun Chen + 08/04/10 track dynamically substituted variables in printRepr, by chun + 04/02/11 rewrite the CG node classes, by chun + *****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace omega { + +extern std::vector > smtNonSplitLevels; +extern std::vector > loopIdxNames; //per stmt +extern std::vector > syncs; + +extern int checkLoopLevel; +extern int stmtForLoopCheck; +extern int upperBoundForLevel; +extern int lowerBoundForLevel; +extern bool fillInBounds; + +//----------------------------------------------------------------------------- +// Class: CG_result +//----------------------------------------------------------------------------- + +CG_outputRepr *CG_result::printRepr(CG_outputBuilder *ocg, + const std::vector &stmts) const { + return printRepr(1, ocg, stmts, + std::vector >(num_level(), + std::make_pair(static_cast(NULL), 0))); +} + +std::string CG_result::printString() const { + CG_stringBuilder ocg; + std::vector stmts(codegen_->xforms_.size()); + for (int i = 0; i < stmts.size(); i++) + stmts[i] = new CG_stringRepr("s" + to_string(i)); + CG_stringRepr *repr = static_cast(printRepr(&ocg, stmts)); + for (int i = 0; i < stmts.size(); i++) + delete stmts[i]; + + if (repr != NULL) { + std::string s = repr->GetString(); + delete repr; + return s; + } else + return std::string(); +} + +int CG_result::num_level() const { + return codegen_->num_level(); +} + +//----------------------------------------------------------------------------- +// Class: CG_split +//----------------------------------------------------------------------------- + +CG_result *CG_split::recompute(const BoolSet<> &parent_active, + const Relation &known, const Relation &restriction) { + active_ &= parent_active; + if (active_.empty()) { + delete this; + return NULL; + } + + + int i = 0; + while (i < restrictions_.size()) { + Relation new_restriction = Intersection(copy(restrictions_[i]), + copy(restriction)); + + new_restriction.simplify(2, 4); + //new_restriction.simplify(); + clauses_[i] = clauses_[i]->recompute(active_, copy(known), + new_restriction); + if (clauses_[i] == NULL) { + restrictions_.erase(restrictions_.begin() + i); + clauses_.erase(clauses_.begin() + i); + } else + i++; + } + + + if (restrictions_.size() == 0) { + delete this; + return NULL; + } else + return this; +} + +int CG_split::populateDepth() { + int max_depth = 0; + for (int i = 0; i < clauses_.size(); i++) { + int t = clauses_[i]->populateDepth(); + if (t > max_depth) + max_depth = t; + } + return max_depth; +} + +std::pair CG_split::liftOverhead(int depth, + bool propagate_up) { + for (int i = 0; i < clauses_.size();) { + std::pair result = clauses_[i]->liftOverhead( + depth, propagate_up); + if (result.first == NULL) + clauses_.erase(clauses_.begin() + i); + else { + clauses_[i] = result.first; + if (!result.second.is_obvious_tautology()) + return std::make_pair(this, result.second); + i++; + } + + } + + if (clauses_.size() == 0) { + delete this; + return std::make_pair(static_cast(NULL), + Relation::True(num_level())); + } else + return std::make_pair(this, Relation::True(num_level())); +} + +Relation CG_split::hoistGuard() { + std::vector guards; + for (int i = 0; i < clauses_.size(); i++) + guards.push_back(clauses_[i]->hoistGuard()); + + return SimpleHull(guards, true, true); +} + +void CG_split::removeGuard(const Relation &guard) { + for (int i = 0; i < clauses_.size(); i++) + clauses_[i]->removeGuard(guard); +} + +std::vector CG_split::findNextLevel() const { + std::vector result; + for (int i = 0; i < clauses_.size(); i++) { + CG_split *splt = dynamic_cast(clauses_[i]); + if (splt != NULL) { + std::vector t = splt->findNextLevel(); + result.insert(result.end(), t.begin(), t.end()); + } else + result.push_back(clauses_[i]); + } + + return result; +} + +CG_outputRepr *CG_split::printRepr(int indent, CG_outputBuilder *ocg, + const std::vector &stmts, + const std::vector > &assigned_on_the_fly) const { + CG_outputRepr *stmtList = NULL; + std::vector next_level = findNextLevel(); + + std::vector cur_loops; + for (int i = 0; i < next_level.size(); i++) { + CG_loop *lp = dynamic_cast(next_level[i]); + if (lp != NULL) { + cur_loops.push_back(lp); + } else { + stmtList = ocg->StmtListAppend(stmtList, + loop_print_repr(cur_loops, 0, cur_loops.size(), + Relation::True(num_level()), NULL, indent, ocg, + stmts, assigned_on_the_fly)); + stmtList = ocg->StmtListAppend(stmtList, + next_level[i]->printRepr(indent, ocg, stmts, + assigned_on_the_fly)); + cur_loops.clear(); + } + } + + stmtList = ocg->StmtListAppend(stmtList, + loop_print_repr(cur_loops, 0, cur_loops.size(), + Relation::True(num_level()), NULL, indent, ocg, stmts, + assigned_on_the_fly)); + return stmtList; +} + +CG_result *CG_split::clone() const { + std::vector clauses(clauses_.size()); + for (int i = 0; i < clauses_.size(); i++) + clauses[i] = clauses_[i]->clone(); + return new CG_split(codegen_, active_, restrictions_, clauses); +} + +void CG_split::dump(int indent) const { + std::string prefix; + for (int i = 0; i < indent; i++) + prefix += " "; + std::cout << prefix << "SPLIT: " << active_ << std::endl; + for (int i = 0; i < restrictions_.size(); i++) { + std::cout << prefix << "restriction: "; + const_cast(this)->restrictions_[i].print(); + clauses_[i]->dump(indent + 1); + } + +} + +//----------------------------------------------------------------------------- +// Class: CG_loop +//----------------------------------------------------------------------------- + +CG_result *CG_loop::recompute(const BoolSet<> &parent_active, + const Relation &known, const Relation &restriction) { + known_ = copy(known); + restriction_ = copy(restriction); + active_ &= parent_active; + + std::vector Rs; + for (BoolSet<>::iterator i = active_.begin(); i != active_.end(); i++) { + Relation r = Intersection(copy(restriction), + copy(codegen_->projected_IS_[level_ - 1][*i])); + + //r.simplify(2, 4); + r.simplify(); + if (!r.is_upper_bound_satisfiable()) { + active_.unset(*i); + continue; + } + Rs.push_back(copy(r)); + } + + if (active_.empty()) { + delete this; + return NULL; + } + + Relation hull = SimpleHull(Rs, true, true); + + //hull.simplify(2,4); + + // check if actual loop is needed + std::pair result = find_simplest_assignment(hull, + hull.set_var(level_)); + if (result.second < INT_MAX) { + needLoop_ = false; + + bounds_ = Relation(hull.n_set()); + F_Exists *f_exists = bounds_.add_and()->add_exists(); + F_And *f_root = f_exists->add_and(); + std::map exists_mapping; + EQ_Handle h = f_root->add_EQ(); + for (Constr_Vars_Iter cvi(result.first); cvi; cvi++) { + Variable_ID v = cvi.curr_var(); + switch (v->kind()) { + case Input_Var: + h.update_coef(bounds_.input_var(v->get_position()), + cvi.curr_coef()); + break; + case Wildcard_Var: { + Variable_ID v2 = replicate_floor_definition(hull, v, bounds_, + f_exists, f_root, exists_mapping); + h.update_coef(v2, cvi.curr_coef()); + break; + } + case Global_Var: { + Global_Var_ID g = v->get_global_var(); + Variable_ID v2; + if (g->arity() == 0) + v2 = bounds_.get_local(g); + else + v2 = bounds_.get_local(g, v->function_of()); + h.update_coef(v2, cvi.curr_coef()); + break; + } + default: + assert(false); + } + } + h.update_const(result.first.get_const()); + bounds_.simplify(); + } + // loop iterates more than once, extract bounds now + else { + needLoop_ = true; + + bounds_ = Relation(hull.n_set()); + F_Exists *f_exists = bounds_.add_and()->add_exists(); + F_And *f_root = f_exists->add_and(); + std::map exists_mapping; + + Relation b = Gist(copy(hull), copy(known), 1); + bool has_unresolved_bound = false; + + std::set excluded_floor_vars; + excluded_floor_vars.insert(b.set_var(level_)); + for (GEQ_Iterator e(b.single_conjunct()->GEQs()); e; e++) + if ((*e).get_coef(b.set_var(level_)) != 0) { + bool is_bound = true; + for (Constr_Vars_Iter cvi(*e, true); cvi; cvi++) { + std::pair result = find_floor_definition( + b, cvi.curr_var(), excluded_floor_vars); + if (!result.first) { + is_bound = false; + has_unresolved_bound = true; + break; + } + } + + if (!is_bound) + continue; + + GEQ_Handle h = f_root->add_GEQ(); + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) { + Variable_ID v = cvi.curr_var(); + switch (v->kind()) { + case Input_Var: + h.update_coef(bounds_.input_var(v->get_position()), + cvi.curr_coef()); + break; + case Wildcard_Var: { + Variable_ID v2 = replicate_floor_definition(b, v, + bounds_, f_exists, f_root, exists_mapping); + h.update_coef(v2, cvi.curr_coef()); + break; + } + case Global_Var: { + Global_Var_ID g = v->get_global_var(); + Variable_ID v2; + if (g->arity() == 0) + v2 = bounds_.get_local(g); + else + v2 = bounds_.get_local(g, v->function_of()); + h.update_coef(v2, cvi.curr_coef()); + break; + } + default: + assert(false); + } + } + h.update_const((*e).get_const()); + } + + if (has_unresolved_bound) { + b = Approximate(b); + b.simplify(2, 4); + //Simplification of Hull + hull = Approximate(hull); + hull.simplify(2, 4); + //end : Anand + for (GEQ_Iterator e(b.single_conjunct()->GEQs()); e; e++) + if ((*e).get_coef(b.set_var(level_)) != 0) + f_root->add_GEQ(*e); + } + bounds_.simplify(); + hull.simplify(2,4); + // Since current SimpleHull does not support max() upper bound or min() lower bound, + // we have to forcefully split the loop when hull approximation does not return any bound. + bool has_lb = false; + bool has_ub = false; + for (GEQ_Iterator e = bounds_.single_conjunct()->GEQs(); e; e++) { + if ((*e).get_coef(bounds_.set_var(level_)) > 0) + has_lb = true; + else if ((*e).get_coef(bounds_.set_var(level_)) < 0) + has_ub = true; + if (has_lb && has_ub) + break; + } + + if (!has_lb) { + for (int i = 0; i < Rs.size(); i++) { + Relation r = Approximate(copy(Rs[i])); + r.simplify(2, 4); + for (GEQ_Iterator e = r.single_conjunct()->GEQs(); e; e++) + if ((*e).get_coef(r.input_var(level_)) > 0) { + Relation r2 = Relation::True(num_level()); + r2.and_with_GEQ(*e); + r2.simplify(); + std::vector restrictions(2); + restrictions[0] = Complement(copy(r2)); + restrictions[0].simplify(); + restrictions[1] = r2; + std::vector clauses(2); + clauses[0] = this; + clauses[1] = this->clone(); + CG_result *cgr = new CG_split(codegen_, active_, + restrictions, clauses); + cgr = cgr->recompute(active_, copy(known), + copy(restriction)); + return cgr; + } + } + for (int i = 0; i < Rs.size(); i++) { + Relation r = Approximate(copy(Rs[i])); + r.simplify(2, 4); + for (EQ_Iterator e = r.single_conjunct()->EQs(); e; e++) + if ((*e).get_coef(r.input_var(level_)) != 0) { + Relation r2 = Relation::True(num_level()); + r2.and_with_GEQ(*e); + r2.simplify(); + std::vector restrictions(2); + if ((*e).get_coef(r.input_var(level_)) > 0) { + restrictions[0] = Complement(copy(r2)); + restrictions[0].simplify(); + restrictions[1] = r2; + } else { + restrictions[0] = r2; + restrictions[1] = Complement(copy(r2)); + restrictions[1].simplify(); + } + std::vector clauses(2); + clauses[0] = this; + clauses[1] = this->clone(); + CG_result *cgr = new CG_split(codegen_, active_, + restrictions, clauses); + cgr = cgr->recompute(active_, copy(known), + copy(restriction)); + return cgr; + } + } + } else if (!has_ub) { + for (int i = 0; i < Rs.size(); i++) { + Relation r = Approximate(copy(Rs[i])); + r.simplify(2, 4); + for (GEQ_Iterator e = r.single_conjunct()->GEQs(); e; e++) + if ((*e).get_coef(r.input_var(level_)) < 0) { + Relation r2 = Relation::True(num_level()); + r2.and_with_GEQ(*e); + r2.simplify(); + std::vector restrictions(2); + restrictions[1] = Complement(copy(r2)); + restrictions[1].simplify(); + restrictions[0] = r2; + std::vector clauses(2); + clauses[0] = this; + clauses[1] = this->clone(); + CG_result *cgr = new CG_split(codegen_, active_, + restrictions, clauses); + cgr = cgr->recompute(active_, copy(known), + copy(restriction)); + return cgr; + } + } + for (int i = 0; i < Rs.size(); i++) { + Relation r = Approximate(copy(Rs[i])); + r.simplify(2, 4); + for (EQ_Iterator e = r.single_conjunct()->EQs(); e; e++) + if ((*e).get_coef(r.input_var(level_)) != 0) { + Relation r2 = Relation::True(num_level()); + r2.and_with_GEQ(*e); + r2.simplify(); + std::vector restrictions(2); + if ((*e).get_coef(r.input_var(level_)) > 0) { + restrictions[0] = Complement(copy(r2)); + restrictions[0].simplify(); + restrictions[1] = r2; + } else { + restrictions[0] = r2; + restrictions[1] = Complement(copy(r2)); + restrictions[1].simplify(); + } + std::vector clauses(2); + clauses[0] = this; + clauses[1] = this->clone(); + CG_result *cgr = new CG_split(codegen_, active_, + restrictions, clauses); + cgr = cgr->recompute(active_, copy(known), + copy(restriction)); + return cgr; + } + } + } + + if (!has_lb && !has_ub) + throw codegen_error( + "can't find any bound at loop level " + to_string(level_)); + else if (!has_lb) + throw codegen_error( + "can't find lower bound at loop level " + + to_string(level_)); + else if (!has_ub) + throw codegen_error( + "can't find upper bound at loop level " + + to_string(level_)); + } + bounds_.copy_names(hull); + bounds_.setup_names(); + + // additional guard/stride condition extraction + if (needLoop_) { + Relation cur_known = Intersection(copy(bounds_), copy(known_)); + cur_known.simplify(); + hull = Gist(hull, copy(cur_known), 1); + + std::pair result = find_simplest_stride(hull, + hull.set_var(level_)); + if (result.second != NULL) + if (abs(result.first.get_coef(hull.set_var(level_))) == 1) { + F_Exists *f_exists = bounds_.and_with_and()->add_exists(); + F_And *f_root = f_exists->add_and(); + std::map exists_mapping; + EQ_Handle h = f_root->add_EQ(); + for (Constr_Vars_Iter cvi(result.first); cvi; cvi++) { + Variable_ID v = cvi.curr_var(); + switch (v->kind()) { + case Input_Var: + h.update_coef(bounds_.input_var(v->get_position()), + cvi.curr_coef()); + break; + case Wildcard_Var: { + Variable_ID v2; + if (v == result.second) + v2 = f_exists->declare(); + else + v2 = replicate_floor_definition(hull, v, bounds_, + f_exists, f_root, exists_mapping); + h.update_coef(v2, cvi.curr_coef()); + break; + } + case Global_Var: { + Global_Var_ID g = v->get_global_var(); + Variable_ID v2; + if (g->arity() == 0) + v2 = bounds_.get_local(g); + else + v2 = bounds_.get_local(g, v->function_of()); + h.update_coef(v2, cvi.curr_coef()); + break; + } + default: + assert(false); + } + } + h.update_const(result.first.get_const()); + } else { + // since gist is not powerful enough on modular constraints for now, + // make an educated guess + coef_t stride = abs(result.first.get_coef(result.second)) + / gcd(abs(result.first.get_coef(result.second)), + abs( + result.first.get_coef( + hull.set_var(level_)))); + + Relation r1(hull.n_inp()); + F_Exists *f_exists = r1.add_and()->add_exists(); + F_And *f_root = f_exists->add_and(); + std::map exists_mapping; + EQ_Handle h = f_root->add_EQ(); + for (Constr_Vars_Iter cvi(result.first); cvi; cvi++) { + Variable_ID v = cvi.curr_var(); + switch (v->kind()) { + case Input_Var: + h.update_coef(r1.input_var(v->get_position()), + cvi.curr_coef()); + break; + case Wildcard_Var: { + Variable_ID v2; + if (v == result.second) + v2 = f_exists->declare(); + else + v2 = replicate_floor_definition(hull, v, r1, + f_exists, f_root, exists_mapping); + h.update_coef(v2, cvi.curr_coef()); + break; + } + case Global_Var: { + Global_Var_ID g = v->get_global_var(); + Variable_ID v2; + if (g->arity() == 0) + v2 = r1.get_local(g); + else + v2 = r1.get_local(g, v->function_of()); + h.update_coef(v2, cvi.curr_coef()); + break; + } + default: + assert(false); + } + } + h.update_const(result.first.get_const()); + r1.simplify(); + + bool guess_success = false; + for (GEQ_Iterator e(bounds_.single_conjunct()->GEQs()); e; e++) + if ((*e).get_coef(bounds_.set_var(level_)) == 1) { + Relation r2(hull.n_inp()); + F_Exists *f_exists = r2.add_and()->add_exists(); + F_And *f_root = f_exists->add_and(); + std::map exists_mapping; + EQ_Handle h = f_root->add_EQ(); + h.update_coef(f_exists->declare(), stride); + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) { + Variable_ID v = cvi.curr_var(); + switch (v->kind()) { + case Input_Var: + h.update_coef(r2.input_var(v->get_position()), + cvi.curr_coef()); + break; + case Wildcard_Var: { + Variable_ID v2 = replicate_floor_definition( + hull, v, r2, f_exists, f_root, + exists_mapping); + h.update_coef(v2, cvi.curr_coef()); + break; + } + case Global_Var: { + Global_Var_ID g = v->get_global_var(); + Variable_ID v2; + if (g->arity() == 0) + v2 = r2.get_local(g); + else + v2 = r2.get_local(g, v->function_of()); + h.update_coef(v2, cvi.curr_coef()); + break; + } + default: + assert(false); + } + } + h.update_const((*e).get_const()); + r2.simplify(); + + if (Gist(copy(r1), + Intersection(copy(cur_known), copy(r2)), 1).is_obvious_tautology() + && Gist(copy(r2), + Intersection(copy(cur_known), copy(r1)), + 1).is_obvious_tautology()) { + bounds_ = Intersection(bounds_, r2); + bounds_.simplify(); + guess_success = true; + break; + } + } + + // this is really a stride with non-unit coefficient for this loop variable + if (!guess_success) { + // TODO: for stride ax = b mod n it might be beneficial to + // generate modular linear equation solver code for + // runtime to get the starting position in printRepr, + // and stride would be n/gcd(|a|,n), thus this stride + // can be put into bounds_ too. + } + + } + + hull = Project(hull, hull.set_var(level_)); + hull.simplify(2, 4); + guard_ = Gist(hull, Intersection(copy(bounds_), copy(known_)), 1); + } + // don't generate guard for non-actual loop, postpone it. otherwise + // redundant if-conditions might be generated since for-loop semantics + // includes implicit comparison checking. -- by chun 09/14/10 + else + guard_ = Relation::True(num_level()); + guard_.copy_names(bounds_); + guard_.setup_names(); + + //guard_.simplify(); + // recursively down the AST + Relation new_known = Intersection(copy(known), + Intersection(copy(bounds_), copy(guard_))); + new_known.simplify(2, 4); + Relation new_restriction = Intersection(copy(restriction), + Intersection(copy(bounds_), copy(guard_))); + new_restriction.simplify(2, 4); + body_ = body_->recompute(active_, new_known, new_restriction); + if (body_ == NULL) { + delete this; + return NULL; + } else + return this; +} + +int CG_loop::populateDepth() { + int depth = body_->populateDepth(); + if (needLoop_) + depth_ = depth + 1; + else + depth_ = depth; + return depth_; +} + +std::pair CG_loop::liftOverhead(int depth, + bool propagate_up) { + if (depth_ > depth) { + assert(propagate_up == false); + std::pair result = body_->liftOverhead(depth, + false); + body_ = result.first; + return std::make_pair(this, Relation::True(num_level())); + } else { // (depth_ <= depth) + if (propagate_up) { + Relation r = pick_one_guard(guard_, level_); + if (!r.is_obvious_tautology()) + return std::make_pair(this, r); + } + + std::pair result; + if (propagate_up || needLoop_) + result = body_->liftOverhead(depth, true); + else + result = body_->liftOverhead(depth, false); + body_ = result.first; + if (result.second.is_obvious_tautology()) + return std::make_pair(this, result.second); + + // loop is an assignment, replace this loop variable in overhead condition + if (!needLoop_) { + result.second = Intersection(result.second, copy(bounds_)); + result.second = Project(result.second, + result.second.set_var(level_)); + result.second.simplify(2, 4); + } + + + int max_level = 0; + bool has_wildcard = false; + bool direction = true; + for (EQ_Iterator e(result.second.single_conjunct()->EQs()); e; e++) + if ((*e).has_wildcards()) { + if (has_wildcard) + assert(false); + else + has_wildcard = true; + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) + if (cvi.curr_var()->kind() == Input_Var + && cvi.curr_var()->get_position() > max_level) + max_level = cvi.curr_var()->get_position(); + } else + assert(false); + + if (!has_wildcard) { + int num_simple_geq = 0; + for (GEQ_Iterator e(result.second.single_conjunct()->GEQs()); e; + e++) + if (!(*e).has_wildcards()) { + num_simple_geq++; + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) + if (cvi.curr_var()->kind() == Input_Var + && cvi.curr_var()->get_position() > max_level) { + max_level = cvi.curr_var()->get_position(); + direction = (cvi.curr_coef() < 0) ? true : false; + } + } else { + has_wildcard = true; + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) + if (cvi.curr_var()->kind() == Input_Var + && cvi.curr_var()->get_position() > max_level) { + max_level = cvi.curr_var()->get_position(); + } + } + assert( + (has_wildcard && num_simple_geq == 0) || (!has_wildcard && num_simple_geq == 1)); + } + + // check if this is the top loop level for splitting for this overhead + if (!propagate_up || (has_wildcard && max_level == level_ - 1) + || (!has_wildcard && max_level == level_)) { + std::vector restrictions(2); + std::vector clauses(2); + int saved_num_level = num_level(); + if (has_wildcard || direction) { + restrictions[1] = Complement(copy(result.second)); + restrictions[1].simplify(); + clauses[1] = this->clone(); + restrictions[0] = result.second; + clauses[0] = this; + } else { + restrictions[0] = Complement(copy(result.second)); + restrictions[0].simplify(); + clauses[0] = this->clone(); + restrictions[1] = result.second; + clauses[1] = this; + } + CG_result *cgr = new CG_split(codegen_, active_, restrictions, + clauses); + CG_result *new_cgr = cgr->recompute(active_, copy(known_), + copy(restriction_)); + new_cgr->populateDepth(); + assert(new_cgr==cgr); + if (static_cast(new_cgr)->clauses_.size() == 1) + // infinite recursion detected, bail out + return std::make_pair(new_cgr, Relation::True(saved_num_level)); + else + return cgr->liftOverhead(depth, propagate_up); + } else + return std::make_pair(this, result.second); + } +} + +Relation CG_loop::hoistGuard() { + + Relation r = body_->hoistGuard(); + + // TODO: should bookkeep catched contraints in loop output as enforced and check if anything missing + // if (!Gist(copy(b), copy(enforced)).is_obvious_tautology()) { + // fprintf(stderr, "need to generate extra guard inside the loop\n"); + // } + + if (!needLoop_) + r = Intersection(r, copy(bounds_)); + r = Project(r, r.set_var(level_)); + r = Gist(r, copy(known_), 1); + + Relation eliminate_existentials_r; + Relation eliminate_existentials_known; + + eliminate_existentials_r = copy(r); + if (!r.is_obvious_tautology()) { + eliminate_existentials_r = Approximate(copy(r)); + eliminate_existentials_r.simplify(2,4); + eliminate_existentials_known = Approximate(copy(known_)); + eliminate_existentials_known.simplify(2,4); + + eliminate_existentials_r = Gist( eliminate_existentials_r, eliminate_existentials_known, 1); + } + + + if (!eliminate_existentials_r.is_obvious_tautology()) { + // if (!r.is_obvious_tautology()) { + body_->removeGuard(r); + guard_ = Intersection(guard_, copy(r)); + guard_.simplify(); + } + + return guard_; + + // return ifList; + // } + + +} + +void CG_loop::removeGuard(const Relation &guard) { + known_ = Intersection(known_, copy(guard)); + known_.simplify(); + + guard_ = Gist(guard_, copy(known_), 1); + guard_.copy_names(known_); + guard_.setup_names(); +} + +CG_outputRepr *CG_loop::printRepr(int indent, CG_outputBuilder *ocg, + const std::vector &stmts, + const std::vector > &assigned_on_the_fly) const { + return printRepr(true, indent, ocg, stmts, assigned_on_the_fly); +} + +CG_outputRepr *CG_loop::printRepr(bool do_print_guard, int indent, + CG_outputBuilder *ocg, const std::vector &stmts, + const std::vector > &assigned_on_the_fly) const { + CG_outputRepr *guardRepr; + if (do_print_guard) + guardRepr = output_guard(ocg, guard_, assigned_on_the_fly); + else + guardRepr = NULL; + + Relation cur_known = Intersection(copy(known_), copy(guard_)); + cur_known.simplify(); + if (needLoop_) { + + if (checkLoopLevel) + if (level_ == checkLoopLevel) + if (active_.get(stmtForLoopCheck)) + fillInBounds = true; + + CG_outputRepr *ctrlRepr = output_loop(ocg, bounds_, level_, cur_known, + assigned_on_the_fly); + + fillInBounds = false; + + CG_outputRepr *bodyRepr = body_->printRepr( + (guardRepr == NULL) ? indent + 1 : indent + 2, ocg, stmts, + assigned_on_the_fly); + CG_outputRepr * loopRepr; + + if (guardRepr == NULL) + loopRepr = ocg->CreateLoop(indent, ctrlRepr, bodyRepr); + else + loopRepr = ocg->CreateLoop(indent + 1, ctrlRepr, bodyRepr); + + if (!smtNonSplitLevels.empty()) { + bool blockLoop = false; + bool threadLoop = false; + bool sync = false; + int firstActiveStmt = -1; + for (int s = 0; s < active_.size(); s++) { + if (active_.get(s)) { + if (firstActiveStmt < 0) + firstActiveStmt = s; + //We assume smtNonSplitLevels is only used to mark the first of + //the block or thread loops to be reduced in CUDA-CHiLL. Here we + //place some comments to help with final code generation. + //int idx = smtNonSplitLevels[s].index(level_); + + if (s < smtNonSplitLevels.size()) { + if (smtNonSplitLevels[s].size() > 0) + if (smtNonSplitLevels[s][0] == level_) { + blockLoop = true; + } + //Assume every stmt marked with a thread loop index also has a block loop idx + if (smtNonSplitLevels[s].size() > 1) + if (smtNonSplitLevels[s][1] == level_) { + threadLoop = true; + } + } + } + } + if (blockLoop && threadLoop) { + fprintf(stderr, + "Warning, have %d level more than once in smtNonSplitLevels\n", + level_); + threadLoop = false; + } + std::string preferredIdx; + if (loopIdxNames.size() + && (level_ / 2) - 1 < loopIdxNames[firstActiveStmt].size()) + preferredIdx = loopIdxNames[firstActiveStmt][(level_ / 2) - 1]; + for (int s = 0; s < active_.size(); s++) { + if (active_.get(s)) { + for (int i = 0; i < syncs.size(); i++) { + if (syncs[i].first == s + && strcmp(syncs[i].second.c_str(), + preferredIdx.c_str()) == 0) { + sync = true; + //printf("FOUND SYNC\n"); + } + + } + } + + } + if (threadLoop || blockLoop || preferredIdx.length() != 0) { + char buf[1024]; + std::string loop; + if (blockLoop) + loop = "blockLoop "; + if (threadLoop) + loop = "threadLoop "; + if (preferredIdx.length() != 0 && sync) { + sprintf(buf, "~cuda~ %spreferredIdx: %s sync", loop.c_str(), + preferredIdx.c_str()); + } else if (preferredIdx.length() != 0) { + sprintf(buf, "~cuda~ %spreferredIdx: %s", loop.c_str(), + preferredIdx.c_str()); + } else { + sprintf(buf, "~cuda~ %s", loop.c_str()); + } + + + loopRepr = ocg->CreateAttribute(loopRepr, buf); + } + + } + if (guardRepr == NULL) + return loopRepr; + else + return ocg->CreateIf(indent, guardRepr, loopRepr, NULL); + } else { + std::pair > result = + output_assignment(ocg, bounds_, level_, cur_known, + assigned_on_the_fly); + guardRepr = ocg->CreateAnd(guardRepr, result.first); + + if (result.second.second < CodeGen::var_substitution_threshold) { + std::vector > atof = + assigned_on_the_fly; + atof[level_ - 1] = result.second; + CG_outputRepr *bodyRepr = body_->printRepr( + (guardRepr == NULL) ? indent : indent + 1, ocg, stmts, + atof); + delete atof[level_ - 1].first; + if (guardRepr == NULL) + return bodyRepr; + else + return ocg->CreateIf(indent, guardRepr, bodyRepr, NULL); + } else { + CG_outputRepr *assignRepr = ocg->CreateAssignment( + (guardRepr == NULL) ? indent : indent + 1, + output_ident(ocg, bounds_, + const_cast(this)->bounds_.set_var( + level_), assigned_on_the_fly), + result.second.first); + CG_outputRepr *bodyRepr = body_->printRepr( + (guardRepr == NULL) ? indent : indent + 1, ocg, stmts, + assigned_on_the_fly); + if (guardRepr == NULL) + return ocg->StmtListAppend(assignRepr, bodyRepr); + else + return ocg->CreateIf(indent, guardRepr, + ocg->StmtListAppend(assignRepr, bodyRepr), NULL); + } + + } +} + +CG_result *CG_loop::clone() const { + return new CG_loop(codegen_, active_, level_, body_->clone()); +} + +void CG_loop::dump(int indent) const { + std::string prefix; + for (int i = 0; i < indent; i++) + prefix += " "; + std::cout << prefix << "LOOP (level " << level_ << "): " << active_ + << std::endl; + std::cout << prefix << "known: "; + const_cast(this)->known_.print(); + std::cout << prefix << "restriction: "; + const_cast(this)->restriction_.print(); + std::cout << prefix << "bounds: "; + const_cast(this)->bounds_.print(); + std::cout << prefix << "guard: "; + const_cast(this)->guard_.print(); + body_->dump(indent + 1); +} + +//----------------------------------------------------------------------------- +// Class: CG_leaf +//----------------------------------------------------------------------------- + +CG_result* CG_leaf::recompute(const BoolSet<> &parent_active, + const Relation &known, const Relation &restriction) { + active_ &= parent_active; + known_ = copy(known); + + guards_.clear(); + for (BoolSet<>::iterator i = active_.begin(); i != active_.end(); i++) { + Relation r = Intersection( + copy(codegen_->projected_IS_[num_level() - 1][*i]), + copy(restriction)); + r.simplify(2, 4); + if (!r.is_upper_bound_satisfiable()) + active_.unset(*i); + else { + r = Gist(r, copy(known), 1); + if (!r.is_obvious_tautology()) { + guards_[*i] = r; + guards_[*i].copy_names(known); + guards_[*i].setup_names(); + } + } + } + + + if (active_.empty()) { + delete this; + return NULL; + } else + return this; +} + +std::pair CG_leaf::liftOverhead(int depth, bool) { + if (depth == 0) + return std::make_pair(this, Relation::True(num_level())); + + for (std::map::iterator i = guards_.begin(); + i != guards_.end(); i++) { + Relation r = pick_one_guard(i->second); + if (!r.is_obvious_tautology()) { + bool has_wildcard = false; + int max_level = 0; + for (EQ_Iterator e(r.single_conjunct()->EQs()); e; e++) { + if ((*e).has_wildcards()) + has_wildcard = true; + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) + if (cvi.curr_var()->kind() == Input_Var + && cvi.curr_var()->get_position() > max_level) + max_level = cvi.curr_var()->get_position(); + } + for (GEQ_Iterator e(r.single_conjunct()->GEQs()); e; e++) { + if ((*e).has_wildcards()) + has_wildcard = true; + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) + if (cvi.curr_var()->kind() == Input_Var + && cvi.curr_var()->get_position() > max_level) + max_level = cvi.curr_var()->get_position(); + } + + if (!(has_wildcard && max_level == codegen_->num_level())) + return std::make_pair(this, r); + } + } + + return std::make_pair(this, Relation::True(num_level())); +} + +Relation CG_leaf::hoistGuard() { + std::vector guards; + for (BoolSet<>::iterator i = active_.begin(); i != active_.end(); i++) { + std::map::iterator j = guards_.find(*i); + if (j == guards_.end()) { + Relation r = Relation::True(num_level()); + r.copy_names(known_); + r.setup_names(); + return r; + } else { + guards.push_back(j->second); + } + } + + return SimpleHull(guards, true, true); +} + +void CG_leaf::removeGuard(const Relation &guard) { + known_ = Intersection(known_, copy(guard)); + known_.simplify(); + + std::map::iterator i = guards_.begin(); + while (i != guards_.end()) { + i->second = Gist(i->second, copy(known_), 1); + if (i->second.is_obvious_tautology()) + guards_.erase(i++); + else + ++i; + } +} + +CG_outputRepr *CG_leaf::printRepr(int indent, CG_outputBuilder *ocg, + const std::vector &stmts, + const std::vector > &assigned_on_the_fly) const { + return leaf_print_repr(active_, guards_, NULL, known_, indent, ocg, + codegen_->remap_, codegen_->xforms_, stmts, assigned_on_the_fly); +} + +CG_result *CG_leaf::clone() const { + return new CG_leaf(codegen_, active_); +} + +void CG_leaf::dump(int indent) const { + std::string prefix; + for (int i = 0; i < indent; i++) + prefix += " "; + std::cout << prefix << "LEAF: " << active_ << std::endl; + std::cout << prefix << "known: "; + const_cast(this)->known_.print(); + for (std::map::const_iterator i = guards_.begin(); + i != guards_.end(); i++) { + std::cout << prefix << "guard #" << i->first << ":"; + const_cast(i->second).print(); + } +} + +} diff --git a/omegalib/code_gen/src/CG_roseBuilder.cc b/omegalib/code_gen/src/CG_roseBuilder.cc new file mode 100644 index 0000000..eb16830 --- /dev/null +++ b/omegalib/code_gen/src/CG_roseBuilder.cc @@ -0,0 +1,1533 @@ +/***************************************************************************** + Copyright (C) 2008 University of Southern California + Copyright (C) 2009-2010 University of Utah + All Rights Reserved. + + Purpose: + generate suif code for omega + + Notes: + + History: + 02/01/06 created by Chun Chen + *****************************************************************************/ + +#include +#include +#include + +struct ir_error: public std::runtime_error { + ir_error(const std::string &msg) : + std::runtime_error(msg) { + } +}; + +using namespace SageBuilder; +using namespace SageInterface; +using namespace OmpSupport; + +namespace omega { + +//----------------------------------------------------------------------------- +// make suif initilization happy +//----------------------------------------------------------------------------- +char *k_ocg_comment; + +// void __attribute__ ((constructor)) my_init(void) { +// ANNOTE(k_ocg_comment, "omega_comment", TRUE); +// } + +/* + const char *libcode_gen_ver_string = ""; + const char *libcode_gen_who_string = ""; + const char *libcode_gen_suif_string = ""; + + void init_code_gen(int&, char* []) { + ANNOTE(k_ocg_comment, "omega_comment", TRUE); + } + + void exit_code_gen(void) { + } + */ +CG_roseBuilder::CG_roseBuilder(int is_fortran, SgGlobal* global, SgGlobal* firstScope, + SgSymbolTable* symtab, SgSymbolTable* symtab2, SgNode* root) : + isFortran(is_fortran), global_(global), global_scope(firstScope), symtab_(symtab), symtab2_( + symtab2), root_(root) { +} + + +CG_roseBuilder::~CG_roseBuilder() { +} + +// Manu:: returns true if input is in fortran, else returns false +bool CG_roseBuilder::isInputFortran() const{ + if (isFortran) + return true; + else + return false; +} + +//----------------------------------------------------------------------------- +// place holder generation +//----------------------------------------------------------------------------- +CG_outputRepr* CG_roseBuilder::CreateSubstitutedStmt(int, CG_outputRepr *stmt, + const std::vector &vars, std::vector &subs) const { + + SgStatementPtrList* list = static_cast(stmt)->list_; + SgNode *tnl; + SgStatement* statement; + if (list != NULL) { + //statement = *((*list).begin()); + //tnl = isSgNode(statement); + delete stmt; + for (int i = 0; i < subs.size(); i++) { + if (subs[i] == NULL) + continue; + + CG_roseRepr *repr = static_cast(subs[i]); + SgExpression* op = repr->op_; + + for (SgStatementPtrList::iterator it = (*list).begin(); + it != (*list).end(); it++) { + statement = (*it); + tnl = isSgNode(statement); + + // std::string master = tnl->unparseToString(); + + int j; + int not_in_symtab_; + + not_in_symtab_ = 0; + + SgVariableSymbol *vs = symtab_->find_variable( + SgName(vars[i].c_str())); + + if (vs == NULL) { + + not_in_symtab_ = 1; + + vs = symtab2_->find_variable(SgName(vars[i].c_str())); + } + if (vs != NULL) { + //std::string x = vars[i].c_str() ; + //std::string y = isSgNode(op)->unparseToString(); + + std::vector array = substitute(tnl, + (const SgVariableSymbol*) vs, op, root_); + for (std::vector::iterator it = + array.begin(); it != array.end(); it++) { + + // std::string z = isSgNode(array[j])->unparseToString(); + if (isSgVarRefExp(op)) { + if (strcmp( + isSgVarRefExp(op)->get_symbol()->get_name().getString().c_str(), + vs->get_name().getString().c_str())) { + + (*it)->set_symbol( + isSgVarRefExp(op)->get_symbol()); + // std::string z = isSgNode(array[j])->unparseToString(); + + // isSgBinaryOp(array[j]->get_parent())->replace_expression(array[j], op); + + } + } else if (isSgExpression(op)) { + + if (isSgBinaryOp((*it)->get_parent())) + isSgBinaryOp((*it)->get_parent())->replace_expression( + *it, op); + else if (isSgUnaryOp((*it)->get_parent())) + isSgUnaryOp((*it)->get_parent())->replace_expression( + *it, op); + else if (isSgExprListExp((*it)->get_parent())) + isSgExprListExp((*it)->get_parent())->replace_expression( + *it, op); + else + throw ir_error("unrecognized expression type"); + } + + } + /* std::vector array2 = substitute (tnl,(const SgVariableSymbol*) vs, op, root_); + if(array2.size() != 0) + throw ir_error("variable replacement unsuccessful"); + */ + } + + } + + delete repr; + subs[i] = NULL; + + if (subs[i] != NULL) + throw ir_error("not freed properly"); + + } + + return new CG_roseRepr(list); + + } else { + tnl = static_cast(stmt)->tnl_; + //std::string master = tnl->unparseToString(); + + if (tnl == NULL) + throw ir_error("both list and tnl are null!!"); + + delete stmt; + int j; + int not_in_symtab_; + for (int i = 0; i < subs.size(); i++) { + if (subs[i] == NULL) + continue; + not_in_symtab_ = 0; + + + CG_roseRepr *repr = static_cast(subs[i]); + SgExpression* op = repr->op_; + delete repr; + subs[i] = NULL; + + SgVariableSymbol *vs = symtab_->find_variable( + SgName(vars[i].c_str())); + + if (vs == NULL) { + + not_in_symtab_ = 1; + + vs = symtab2_->find_variable(SgName(vars[i].c_str())); + } + if (vs != NULL) { + //std::string x = vars[i].c_str() ; + //std::string y = isSgNode(op)->unparseToString(); + std::vector array = substitute(tnl, vs, op, + root_); + + if (not_in_symtab_ && isSgVarRefExp(op)) { + if (strcmp( + isSgVarRefExp(op)->get_symbol()->get_name().getString().c_str(), + vs->get_name().getString().c_str())) { + // symtab2_->remove(vs); + } + } + /* else if(not_in_symtab_ && isSgVarRefExp(isSgAddOp(op)->get_lhs_operand())){ + if(strcmp(isSgVarRefExp(isSgAddOp(op)->get_lhs_operand())->get_symbol()->get_name().getString().c_str(),\ + vs->get_name().getString().c_str())){ + symtab2_->remove(vs); + } + }*/ + //symtab2_->remove(vs); + for (std::vector::iterator j = array.begin(); + j != array.end(); j++) { + // std::string z = isSgNode(array[j])->unparseToString(); + + if (isSgVarRefExp(op)) { + if (strcmp( + isSgVarRefExp(op)->get_symbol()->get_name().getString().c_str(), + vs->get_name().getString().c_str())) { + (*j)->set_symbol(isSgVarRefExp(op)->get_symbol()); + //isSgBinaryOp(array[j]->get_parent())->replace_expression(array[j], op); + // std::string z = isSgNode(array[j])->unparseToString(); + + } + } else if (isSgExpression(op)) { + + if (isSgBinaryOp((*j)->get_parent())) + isSgBinaryOp((*j)->get_parent())->replace_expression( + *j, op); + else if (isSgUnaryOp((*j)->get_parent())) + isSgUnaryOp((*j)->get_parent())->replace_expression( + *j, op); + else if (isSgExprListExp((*j)->get_parent())) { // Manu:: fortran indices are stored this way + isSgExprListExp((*j)->get_parent())->replace_expression(*j, op); + } + else + throw ir_error("unrecognized expression type"); + /* if(strcmp(isSgVarRefExp(isSgAddOp(op)->get_lhs_operand())->get_symbol()->get_name().getString().c_str(),\ + vs->get_name().getString().c_str() )){ + array[j]->set_symbol(isSgVarRefExp(isSgAddOp(op)->get_lhs_operand())->get_symbol()); + + */ + + } + + } + /* std::vector array2 = substitute (tnl,(const SgVariableSymbol*) vs, op, root_); + if(array2.size() != 0) + throw ir_error("variable replacement unsuccessful"); + */ + } + /* SgExpression* exp = NULL; + + if(stmt1 = isSgStatement(tnl)){ + if (SgExprStatement* expr_stmt = isSgExprStatement(stmt1)) + exp = expr_stmt->get_expression(); + else if( block = isSgBasicBlock(tnl)){ + SgStatementPtrList& stmts = block->get_statements(); + SgExpression* exp2; + for(int i =0; i < stmts.size(); i++){ + if(isSgExprStatement(stmts[i])){ + exp2 = isSgExprStatement(stmts[i])->get_expression(); + if(exp2 != NULL){ + + if(isSgBinaryOp(exp2)) { + substitute(isSgBinaryOp(exp2)->get_lhs_operand(), vs, op, root_, exp2); + substitute(isSgBinaryOp(exp2)->get_rhs_operand(), vs, op, root_, exp2); + } + else if (isSgUnaryOp(exp2)) + substitute(isSgUnaryOp(exp2)->get_operand(), vs, op, root_, exp2); + + + }//end if + + }//end if + }//end for + + }//end else + else if(SgForStatement* for_stmt = isSgForStatement(tnl)){ + SgForStatement* temp = for_stmt; + while(isSgForStatement(temp)){ + + + + } + + + + + } + + + }//end if + else + exp = isSgExpression(tnl); + + if(exp != NULL){ + if(isSgBinaryOp(exp)) { + substitute(isSgBinaryOp(exp)->get_lhs_operand(), vs, op, root_, exp); + substitute(isSgBinaryOp(exp)->get_rhs_operand(), vs, op, root_, exp); + } + else if (isSgUnaryOp(exp)) + substitute(isSgUnaryOp(exp)->get_operand(), vs, op, root_, exp); + + } + // if (op.is_instr()) + // delete op.instr(); + } + */ + } + return new CG_roseRepr(tnl); + } + +} + +//----------------------------------------------------------------------------- +// assignment generation +//----------------------------------------------------------------------------- +CG_outputRepr* CG_roseBuilder::CreateAssignment(int, CG_outputRepr *lhs, + CG_outputRepr *rhs) const { + if (lhs == NULL || rhs == NULL) { + fprintf(stderr, "Code generation: Missing lhs or rhs\n"); + return NULL; + } + + SgExpression* src = static_cast(rhs)->op_; + SgExpression* dst = static_cast(lhs)->op_; + + SgExprStatement* ins = buildAssignStatement(dst, src); + src->set_parent(ins); + dst->set_parent(ins); + + SgStatementPtrList* new_list = new SgStatementPtrList; + + (*new_list).push_back(isSgStatement(ins)); + + delete lhs; + delete rhs; + + return new CG_roseRepr(new_list); + +} + +//----------------------------------------------------------------------------- +// function invocation generation +//----------------------------------------------------------------------------- +CG_outputRepr* CG_roseBuilder::CreateInvoke(const std::string &fname, + std::vector &list) const { + + // Manu:: debug +// std::cout << "--------- CreateInvoke --------- \n"; + + if (fname == std::string("max") || fname == std::string("min")) { + if (list.size() == 0) { + return NULL; + } else if (list.size() == 1) { + return list[0]; + } else { + int last = list.size() - 1; + SgExpression* op2 = static_cast(list[last])->op_; + delete list[last]; + list.erase(list.end()-1); + CG_roseRepr *repr = static_cast(CreateInvoke(fname, + list)); + SgExpression* op1 = repr->op_; + + + SgExpression *ins; + SgExprListExp* arg_list = buildExprListExp(); + appendExpression(arg_list, op1); + appendExpression(arg_list, op2); + SgVarRefExp* opaque_var; + + + if (fname == std::string("max")) { + opaque_var = buildOpaqueVarRefExp("__rose_gt", global_); + ins = isSgExpression(buildFunctionCallExp(opaque_var, arg_list)); + + // Manu:: fortran support + if (isInputFortran()) { + SgName fName("merge"); + SgTypeInt *retType = buildIntType(); + + SgExpression *cond = static_cast(CreateLE(new CG_roseRepr(op2), new CG_roseRepr(op1)))->op_; + appendExpression(arg_list, cond); + ins = isSgExpression(buildFunctionCallExp(fName, retType, arg_list, global_)); +// std::cout << "--------- CreateInvoke:: " << isSgNode(ins)->unparseToString().c_str() << "\n"; + } + + } else { + opaque_var = buildOpaqueVarRefExp("__rose_lt", global_); + ins = isSgExpression(buildFunctionCallExp(opaque_var, arg_list)); + + // Manu:: fortran support + if (isInputFortran()) { + SgName fName("merge"); + SgTypeInt *retType = buildIntType(); + + SgExpression *cond = static_cast(CreateLE(new CG_roseRepr(op1), new CG_roseRepr(op2)))->op_; + appendExpression(arg_list, cond); + ins = isSgExpression(buildFunctionCallExp(fName, retType, arg_list, global_)); +// std::cout << "--------- CreateInvoke:: " << isSgNode(ins)->unparseToString().c_str() << "\n"; + } + + } + + repr->op_ = ins; + return repr; + } + } else { + fprintf(stderr, + "Code generation: invoke function io_call not implemented\n"); + return NULL; + } + +} + +//----------------------------------------------------------------------------- +// comment generation +//----------------------------------------------------------------------------- +CG_outputRepr* CG_roseBuilder::CreateComment(int, + const std::string &commentText) const { + if (commentText == std::string("")) { + return NULL; + } + + SgLocatedNode *tnl = new SgLocatedNode(); + buildComment(tnl, "//omega_comment: " + commentText); + + return new CG_roseRepr(isSgNode(tnl)); + +} + +//----------------------------------------------------------------------------- +// if stmt gen operations +//----------------------------------------------------------------------------- +CG_outputRepr* CG_roseBuilder::CreateIf(int, CG_outputRepr *guardList, + CG_outputRepr *true_stmtList, CG_outputRepr *false_stmtList) const { + + // static int if_counter = 1; + // std::string s = std::string("omegaif_")+to_string(if_counter++); + // SgLabelStatement* label =buildLabelStatement(SgName(const_cast(s.c_str()))); + + if (true_stmtList == NULL && false_stmtList == NULL) { + delete guardList; + return NULL; + } else if (guardList == NULL) { + return StmtListAppend(true_stmtList, false_stmtList); + } + + SgExpression* header = static_cast(guardList)->op_; + + SgStatementPtrList *then_part1, *else_part1; + SgStatement* then_part; + SgStatement* else_part; + SgBasicBlock* then_part2; + SgBasicBlock* else_part2; + if (true_stmtList != NULL) { + then_part1 = static_cast(true_stmtList)->list_; + if (then_part1 != NULL) { + then_part = *((*then_part1).begin()); + + if ((*then_part1).size() > 1) { + then_part2 = buildBasicBlock(); + for (SgStatementPtrList::iterator it = (*then_part1).begin(); + it != (*then_part1).end(); it++) { + then_part2->append_statement(*it); + + } + then_part = isSgStatement(then_part2); + + } + } else { + // Manu:: fortran support (if part) + if (isInputFortran()) { + then_part2 = buildBasicBlock(); + then_part2->append_statement(isSgStatement(static_cast(true_stmtList)->tnl_)); + then_part = isSgStatement(then_part2); + } else + then_part = isSgStatement(static_cast(true_stmtList)->tnl_); + } + } else { + then_part = NULL; + } + if (false_stmtList != NULL) { + else_part1 = static_cast(false_stmtList)->list_; + if (else_part1 != NULL) { + else_part = *((*else_part1).begin()); + if ((*else_part1).size() > 1) { + else_part2 = buildBasicBlock(); + for (SgStatementPtrList::iterator it2 = (*else_part1).begin(); + it2 != (*else_part1).end(); it2++) { + else_part2->append_statement(*it2); + + } + else_part = isSgStatement(else_part2); + + } + } else { + // Manu:: fortran support (if part) + if (isInputFortran()) { + else_part2 = buildBasicBlock(); + else_part2->append_statement(isSgStatement(static_cast(false_stmtList)->tnl_)); + else_part = isSgStatement(else_part2); + } else + else_part = isSgStatement(static_cast(false_stmtList)->tnl_); + } + } else { + else_part = NULL; + } + + SgIfStmt* ti = buildIfStmt(header, isSgStatement(then_part), + isSgStatement(else_part)); + +// label->set_scope(ti);//may have to be shifted to after symbol table insertion +// SgLabelSymbol* if_label = isSgLabelSymbol(label->get_symbol_from_symbol_table()); + +// symtab_->insert( SgName(const_cast(s.c_str())) , isSgSymbol(if_label)); + + delete guardList; + delete true_stmtList; + delete false_stmtList; + + return new CG_roseRepr(isSgNode(ti)); + +} + +//----------------------------------------------------------------------------- +// inductive variable generation, to be used in CreateLoop as control +//----------------------------------------------------------------------------- +CG_outputRepr* CG_roseBuilder::CreateInductive(CG_outputRepr *index, + CG_outputRepr *lower, CG_outputRepr *upper, CG_outputRepr *step) const { + + if (index == NULL || lower == NULL || upper == NULL) { + fprintf(stderr, + "Code generation: something wrong in CreateInductive\n"); + return NULL; + } + + if (step == NULL) + step = new CG_roseRepr(isSgExpression(buildIntVal(1))); + + SgVarRefExp *index_sym = isSgVarRefExp( + static_cast(index)->op_); + SgExpression* lower_bound = static_cast(lower)->op_; + SgExpression* upper_bound = static_cast(upper)->op_; + SgExpression* step_size = static_cast(step)->op_; + + /* label_sym *contLabel = new label_sym(""); + label_sym *brkLabel = new label_sym(""); may not be required on rose?! + */ + + SgStatement* for_init_stmt = buildAssignStatement(index_sym, lower_bound); + SgLessOrEqualOp* cond = buildLessOrEqualOp(index_sym, upper_bound); + SgExprStatement* test = buildExprStatement(cond); + SgPlusAssignOp* increment = buildPlusAssignOp(index_sym, step_size); + SgForStatement *for_stmt = buildForStatement(for_init_stmt, + isSgStatement(test), increment, NULL); + + delete index; + delete lower; + delete upper; + delete step; + + + // Manu + if (isInputFortran()) { + // std::cout << "CG_roseBuilder:: need to construct a fortran do statement\n"; + SgFortranDo * forStmt=new SgFortranDo(Sg_File_Info::generateDefaultFileInfoForTransformationNode()); + forStmt->set_has_end_statement(true); + forStmt->set_bound(upper_bound); + forStmt->set_increment(step_size); + forStmt->set_initialization(isSgExprStatement(for_init_stmt)->get_expression()); + return new CG_roseRepr(isSgNode(forStmt)); + } else { +// std::cout << "CG_roseBuilder:: for statement is fine\n"; + + return new CG_roseRepr(isSgNode(for_stmt)); + + } + +} + +//----------------------------------------------------------------------------- +// Attribute Creation +//----------------------------------------------------------------------------- +CG_outputRepr* CG_roseBuilder::CreateAttribute(CG_outputRepr *control, + const std::string &commentText) const { + + SgNode *tnl = static_cast(control)->tnl_; + + tnl->setAttribute("omega_comment", new AstTextAttribute(commentText)); + + return static_cast(control); + +} + +//----------------------------------------------------------------------------- +// Pragma Attribute +//----------------------------------------------------------------------------- +CG_outputRepr* CG_roseBuilder::CreatePragmaAttribute(CG_outputRepr *stmt, int looplevel, const std::string &pragmaText) const { + SgNode *tnl = static_cast(stmt)->tnl_; + CodeInsertionAttribute* attr = NULL; + if (!tnl->attributeExists("code_insertion")) { + attr = new CodeInsertionAttribute(); + tnl->setAttribute("code_insertion", attr); + } + else { + attr = static_cast(tnl->getAttribute("code_insertion")); + } + attr->add(new PragmaInsertion(looplevel, pragmaText)); + return stmt; +} + +//----------------------------------------------------------------------------- +// Prefetch Attribute +//----------------------------------------------------------------------------- +CG_outputRepr* CG_roseBuilder::CreatePrefetchAttribute(CG_outputRepr* stmt, int looplevel, const std::string &arrName, int hint) const { + SgNode *tnl = static_cast(stmt)->tnl_; + CodeInsertionAttribute *attr = getOrCreateCodeInsertionAttribute(tnl); + attr->add(new MMPrefetchInsertion(looplevel, arrName, hint)); +} + +//----------------------------------------------------------------------------- +// loop stmt generation +//----------------------------------------------------------------------------- +CG_outputRepr* CG_roseBuilder::CreateLoop(int, CG_outputRepr *control, + CG_outputRepr *stmtList) const { + if (stmtList == NULL) { + delete control; + return NULL; + } else if (control == NULL) { + fprintf(stderr, "Code generation: no inductive for this loop\n"); + return stmtList; + } + + SgNode *tnl = static_cast(control)->tnl_; + SgForStatement *tf = isSgForStatement(tnl); + + // Manu :: fortran support + SgFortranDo *tfd = NULL; + if (isInputFortran()) { + tfd = isSgFortranDo(tnl); + } + // Manu:: debug +/* if (!tf) { + std::cout << "CreateLoop:: Not a for loop\n"; + if (isSgFortranDo(tnl)) + std::cout << "CreateLoop:: It is a fortran do loop\n"; + } +*/ + + SgStatementPtrList * body = static_cast(stmtList)->list_; + + if (body != NULL) { + if (!((*body).empty())) { + if ((*body).size() == 1) { + // if(isSgBasicBlock(*((*body).begin()))){ + if (!isInputFortran()) { // Manu:: added if-else for fortran support + tf->set_loop_body(*((*body).begin())); + (*((*body).begin()))->set_parent(tf); + } else { + SgBasicBlock* bb1 = buildBasicBlock(); + bb1->set_parent(tfd); + bb1->append_statement(*((*body).begin())); + tfd->set_body(bb1); + } + // } + /* else{ + SgBasicBlock* bb1 = buildBasicBlock(); + bb1->set_parent(tf); + bb1->append_statement(*((*body).begin())); + tf->set_loop_body(bb1); + + }*/ + } else { + // Manu:: support for fortran label (do - continue) + SgName *sname = NULL; + + SgBasicBlock* bb = buildBasicBlock(); + if (!isInputFortran()) + bb->set_parent(tf); + else + bb->set_parent(tfd); + for (SgStatementPtrList::iterator it = (*body).begin(); + it != (*body).end(); it++) { + bb->append_statement(*it); + (*it)->set_parent(bb); + } + if (!isInputFortran()) + tf->set_loop_body(bb); + else { + tfd->set_body(bb); + } + } + } + } else { + SgNode* tnl2 = static_cast(stmtList)->tnl_; + + if (tnl2 != NULL) { + if (!isInputFortran()) { + tf->set_loop_body(isSgStatement(tnl2)); + tnl2->set_parent(tf); + } else { + SgBasicBlock* bb1 = buildBasicBlock(); + bb1->set_parent(tfd); + bb1->append_statement(isSgStatement(tnl2)); + tfd->set_body(bb1); + tnl2->set_parent(bb1); + } + } + } + + delete stmtList; + + return control; +} + +//----------------------------------------------------------------------------- +// basic int, identifier gen operations +//----------------------------------------------------------------------------- +CG_outputRepr* CG_roseBuilder::CreateInt(int _i) const { + return new CG_roseRepr(isSgExpression(buildIntVal(_i))); +} +bool CG_roseBuilder::isInteger(CG_outputRepr *op) const{ + + SgExpression *op1 = static_cast(op)->op_; + + if(op1) + if(isSgIntVal(op1)) + return true; + + return false; +} +CG_outputRepr* CG_roseBuilder::CreateIdent(const std::string &_s) const { + + SgVariableSymbol *vs = symtab_->find_variable(SgName(_s.c_str())); + SgVariableSymbol *vs2 = symtab2_->find_variable(SgName(_s.c_str())); + + if (vs == NULL && vs2 == NULL) { + + SgVariableDeclaration* defn = buildVariableDeclaration( + SgName(_s.c_str()), buildIntType()); + SgInitializedNamePtrList& variables = defn->get_variables(); + SgInitializedNamePtrList::const_iterator i = variables.begin(); + SgInitializedName* initializedName = *i; + vs = new SgVariableSymbol(initializedName); + prependStatement(defn, isSgScopeStatement(root_)); + + vs->set_parent(symtab2_); + symtab2_->insert(SgName(_s.c_str()), vs); + return new CG_roseRepr(isSgExpression(buildVarRefExp(vs))); + + } + + /* May have problem */ + + if (!isSgExpression(buildVarRefExp(SgName(_s.c_str())))) + throw ir_error("error in Create ident!!"); + if (vs2 != NULL) + return new CG_roseRepr(isSgExpression(buildVarRefExp(vs2))); + + return new CG_roseRepr(isSgExpression(buildVarRefExp(vs))); + +} + +//----------------------------------------------------------------------------- +// binary arithmetic operations +//----------------------------------------------------------------------------- +CG_outputRepr* CG_roseBuilder::CreatePlus(CG_outputRepr *lop, + CG_outputRepr *rop) const { + if (rop == NULL) { + return lop; + } else if (lop == NULL) { + return rop; + } + + SgExpression* op1 = static_cast(lop)->op_; + SgExpression* op2 = static_cast(rop)->op_; + + SgAddOp *ins = buildAddOp(op1, op2); + op1->set_parent(ins); + op2->set_parent(ins); + delete lop; + delete rop; + + return new CG_roseRepr(isSgExpression(ins)); + +} + +CG_outputRepr* CG_roseBuilder::CreateMinus(CG_outputRepr *lop, + CG_outputRepr *rop) const { + if (rop == NULL) { + return lop; /* May Cause Problem */ + } else if (lop == NULL) { + SgExpression *op = static_cast(rop)->op_; + SgMinusOp *ins = buildMinusOp(op); + + delete rop; + + return new CG_roseRepr(isSgExpression(ins)); + } else { + SgExpression* op1 = static_cast(lop)->op_; + SgExpression* op2 = static_cast(rop)->op_; + + SgSubtractOp *ins = buildSubtractOp(op1, op2); + op1->set_parent(ins); + op2->set_parent(ins); + delete lop; + delete rop; + return new CG_roseRepr(isSgExpression(ins)); + } + +} + +CG_outputRepr* CG_roseBuilder::CreateTimes(CG_outputRepr *lop, + CG_outputRepr *rop) const { + if (rop == NULL || lop == NULL) { + if (rop != NULL) { + rop->clear(); + delete rop; + } + if (lop != NULL) { + lop->clear(); + delete lop; + } + return NULL; + } + + SgExpression* op1 = static_cast(lop)->op_; + SgExpression* op2 = static_cast(rop)->op_; + + SgMultiplyOp *ins = buildMultiplyOp(op1, op2); + op1->set_parent(ins); + op2->set_parent(ins); + delete lop; + delete rop; + + return new CG_roseRepr(isSgExpression(ins)); + +} + +CG_outputRepr* CG_roseBuilder::CreateIntegerFloor(CG_outputRepr *lop, + CG_outputRepr *rop) const { + if (rop == NULL) { + fprintf(stderr, "Code generation: divide by NULL\n"); + return NULL; + } else if (lop == NULL) { + delete rop; + return NULL; + } + + // (6+5)*10 / 4 + SgExpression* op1 = static_cast(lop)->op_; + SgExpression* op2 = static_cast(rop)->op_; + + // bugs in SUIF prevent use of correct io_divfloor + SgDivideOp *ins = buildDivideOp(op1, op2); + + delete lop; + delete rop; + + return new CG_roseRepr(isSgExpression(ins)); + +} + +CG_outputRepr* CG_roseBuilder::CreateIntegerMod(CG_outputRepr *lop, + CG_outputRepr *rop) const { + if (rop == NULL || lop == NULL) { + return NULL; + } + + SgExpression* op1 = static_cast(lop)->op_; + SgExpression* op2 = static_cast(rop)->op_; + + // bugs in SUIF prevent use of correct io_mod + SgModOp *ins; + if (!isInputFortran()) { + ins = buildModOp(op1, op2); + delete lop; + delete rop; + + return new CG_roseRepr(isSgExpression(ins)); + } else { // Manu:: fortran mod is a function call and not an operator (f77 and f90) + SgExpression *fins; + SgName fName("MOD"); + SgExprListExp* arg_list = buildExprListExp(); + appendExpression(arg_list, op1); + appendExpression(arg_list, op2); + SgTypeInt *retType = buildIntType(); + fins = isSgExpression(buildFunctionCallExp(fName, retType, arg_list, global_)); + return new CG_roseRepr(isSgExpression(fins)); + } + +} + +//----------------------------------------------------------------------------- +// binary logical operations +//----------------------------------------------------------------------------- +CG_outputRepr* CG_roseBuilder::CreateAnd(CG_outputRepr *lop, + CG_outputRepr *rop) const { + /*if (rop == NULL || lop == NULL) { + return NULL; + }*/ + + if (rop == NULL) + return lop; + else if (lop == NULL) + return rop; + + SgExpression* op1 = static_cast(lop)->op_; + SgExpression* op2 = static_cast(rop)->op_; + + SgAndOp *ins = buildAndOp(op1, op2); + + delete lop; + delete rop; + + return new CG_roseRepr(isSgExpression(ins)); + +} + +//----------------------------------------------------------------------------- +// binary relational operations +//----------------------------------------------------------------------------- +/*CG_outputRepr* CG_roseBuilder::CreateGE(CG_outputRepr *lop, + CG_outputRepr *rop) const { + return CreateLE(rop, lop); +}*/ + +CG_outputRepr* CG_roseBuilder::CreateLE(CG_outputRepr *lop, + CG_outputRepr *rop) const { + if (rop == NULL || lop == NULL) { + return NULL; + } + + SgExpression* op1 = static_cast(lop)->op_; + SgExpression* op2 = static_cast(rop)->op_; + + SgLessOrEqualOp *ins = buildLessOrEqualOp(op1, op2); + + delete lop; + delete rop; + + return new CG_roseRepr(isSgExpression(ins)); + +} + +CG_outputRepr* CG_roseBuilder::CreateEQ(CG_outputRepr *lop, + CG_outputRepr *rop) const { + if (rop == NULL || lop == NULL) { + return NULL; + } + + SgExpression* op1 = static_cast(lop)->op_; + SgExpression* op2 = static_cast(rop)->op_; + + SgEqualityOp *ins = buildEqualityOp(op1, op2); + + delete lop; + delete rop; + + return new CG_roseRepr(isSgExpression(ins)); + +} + +//----------------------------------------------------------------------------- +// stmt list gen operations +//----------------------------------------------------------------------------- +/*CG_outputRepr* CG_roseBuilder::CreateStmtList(CG_outputRepr *singleton) const { + + if (singleton == NULL) { + return new CG_roseRepr(new SgStatementPtrList); + } + + SgStatementPtrList *tnl = static_cast(singleton)->list_; + SgNode* sgn = static_cast(singleton)->tnl_; + + if (tnl == NULL) + tnl = new SgStatementPtrList; + + if (sgn == NULL) { + SgExpression* op = static_cast(singleton)->op_; + + if (op != NULL) + (*tnl).push_back( + buildExprStatement( + static_cast(singleton)->op_)); + + } else + (*tnl).push_back(isSgStatement(sgn)); + + delete singleton; + return new CG_roseRepr(tnl); + +// tnl = isSgNode(buildBasicBlock(buildExprStatement(static_cast(singleton)->op_))); + +// delete singleton; +// return new CG_roseRepr(tnl); + +} + +CG_outputRepr* CG_roseBuilder::StmtListInsertLast(CG_outputRepr *list, + CG_outputRepr *node) const { + return StmtListAppend(list, node); +} +*/ +CG_outputRepr* CG_roseBuilder::StmtListAppend(CG_outputRepr *list1, + CG_outputRepr *list2) const { + + if (list2 == NULL) { + return list1; + } else if (list1 == NULL) { + return list2; + } + + // SgStatement* parent; + // SgStatement* stmt1; + // SgStatement* stmt2; + + SgStatementPtrList* new_list; + + SgStatementPtrList* tnl1 = static_cast(list1)->list_; + SgStatementPtrList* tnl2 = static_cast(list2)->list_; + SgNode* one = static_cast(list1)->tnl_; + SgNode* two = static_cast(list2)->tnl_; + + SgExpression* exp1 = static_cast(list1)->op_; + SgExpression* exp2 = static_cast(list2)->op_; + + if (exp1 || exp2) + throw ir_error("error in stmtlistappend!!"); + + if (tnl1 && one) + throw ir_error("error in stmtlistappend!!"); + + if (tnl2 && two) + throw ir_error("error in stmtlistappend!!"); +// SgNode* sg1 = static_cast(list1)->tnl_; + +//if((*tnl1).empty()){ + +// if(SgStatement* stmt = isSgStatement(sg1)) +// (*tnl1).push_back(stmt); +//else if(isSgScopeStatement(sg1)){ +// SgStatementPtrList scopeStmtPtrLst = isSgScopeStatement(sg1)->generateStatementList(); + +// for(SgStatementPtrList::iterator it1 = scopeStmtPtrLst.begin();it1 != scopeStmtPtrLst.end(); it1++) +// (*tnl1).push_back(*it1); +//} +//} + + if ((tnl1 == NULL) && (tnl2 == NULL)) { + + if ((one != NULL) && (two != NULL)) { + + new_list = new SgStatementPtrList; + + (*new_list).push_back(isSgStatement(one)); + (*new_list).push_back(isSgStatement(two)); + + CG_roseRepr* new_rep = new CG_roseRepr(new_list); + + return static_cast(new_rep); + + } else if ((one != NULL) && (two == NULL)) { + + return static_cast(new CG_roseRepr(one)); + + } else if ((two != NULL) && (one == NULL)) { + return static_cast(new CG_roseRepr(two)); + + } + + } else { + if ((tnl2 != NULL) && (tnl1 == NULL)) { + /* for(SgStatementPtrList::iterator it = (*tnl2).begin(); it != (*tnl2).end(); it++) + { + (*tnl1).push_back(*it); + + } + */ + if (one == NULL) + return list2; + else { + new_list = new SgStatementPtrList; + (*new_list).push_back(isSgStatement(one)); + + for (SgStatementPtrList::iterator it = (*tnl2).begin(); + it != (*tnl2).end(); it++) { + (*new_list).push_back(*it); + + } + //delete list2; + return static_cast(new CG_roseRepr(new_list)); + } + } else if ((tnl1 != NULL) && (tnl2 == NULL)) { + if (two == NULL) + return list1; + else { + + (*tnl1).push_back(isSgStatement(two)); + // delete list1; + return static_cast(new CG_roseRepr(tnl1)); + + } + + } else if ((tnl1 != NULL) && (tnl2 != NULL)) { + + for (SgStatementPtrList::iterator it = (*tnl2).begin(); + it != (*tnl2).end(); it++) { + (*tnl1).push_back(*it); + + } + + // delete list2; + // delete list1; + return static_cast(new CG_roseRepr(tnl1)); + } +//else{ +// SgNode* tnll2 = static_cast(list2)->tnl_; +// if(tnll2 != NULL){ +// if(isSgStatement(tnll2)) +// (*tnl1).push_back(isSgStatement(tnll2)); +// else if(isSgScopeStatement(tnll2)){ +// SgStatementPtrList scopeStmtPtrLst1 = isSgScopeStatement(tnll2)->generateStatementList(); + +// for(SgStatementPtrList::iterator it2 = scopeStmtPtrLst1.begin();it2 != scopeStmtPtrLst1.end(); it2++) +// (*tnl1).push_back(*it2); + +// } +//} +// else{ +// SgStatement* stmt2 = isSgStatement(buildExprStatement(static_cast(list2)->op_)); +// (*tnl1).push_back(stmt2); + +// } + +//} + // stmt2 = isSgStatement(tnl2); + +// std::string c = tnl1->unparseToString(); + +// std::string d = isSgNode(stmt2)->unparseToString(); + +// if(isSgForStatement(tnl1) || isSgBasicBlock(tnl1)) +// isSgScopeStatement(tnl1)->append_statement(stmt2); +// else +// { + // stmt1 = isSgStatement(tnl1); + // parent = isSgStatement(tnl1->get_parent()); + // if(isSgForStatement(tnl1->get_parent()) || isSgBasicBlock(tnl1->get_parent())) + // isSgScopeStatement(tnl1->get_parent())->append_statement(stmt2); + // else if (isSgStatement(tnl1->get_parent())) + // isSgStatement(tnl1->get_parent())->insert_statement(stmt1, stmt2, false); + +// } + + } +// delete list2; + +// return list1; + +} + + +CG_outputRepr* CG_roseBuilder::CreateDim3(const char* varName, CG_outputRepr* arg1, + CG_outputRepr* arg2, CG_outputRepr* arg3) const { + + //SgName type_name("dim3"); + //SgClassSymbol * type_symbol = global_scope->lookup_class_symbol(type_name); + // SgClassDeclaration * type_decl = isSgClassDeclaration( + // type_symbol->get_declaration()); + + //SgVariableDeclaration * var_decl = buildVariableDeclaration(varName, type_symbol->get_type()); + + SgFunctionSymbol * ctor_symbol = global_scope->lookup_function_symbol( + SgName("dim3")); + + SgExprListExp * ctor_args; + if(arg3 != NULL) + ctor_args = buildExprListExp(static_cast(arg1)->op_, + static_cast(arg2)->op_, static_cast(arg3)->op_); + else + ctor_args = buildExprListExp(static_cast(arg1)->op_, + static_cast(arg2)->op_); + SgFunctionCallExp * dim3_func_call = buildFunctionCallExp( + buildFunctionRefExp(ctor_symbol->get_declaration()), ctor_args); + + char joined_str[20]; + + strcpy(joined_str, "dim3 "); + strcat(joined_str, varName); + + SgExprStatement* decl = buildAssignStatement( + buildOpaqueVarRefExp(joined_str, isSgScopeStatement(root_)), + dim3_func_call); + + SgStatementPtrList *tnl2 = new SgStatementPtrList; + + // (*tnl2).push_back(var_decl); + (*tnl2).push_back(decl); + return new CG_roseRepr(tnl2); + +} + +/*CG_outputRepr* CG_roseBuilder::CreateDim3(const char* varName, int arg1, + int arg2) const { + + SgName type_name("dim3"); + SgClassSymbol * type_symbol = global_scope->lookup_class_symbol(type_name); + SgClassDeclaration * type_decl = isSgClassDeclaration( + type_symbol->get_declaration()); + + //SgVariableDeclaration * var_decl = buildVariableDeclaration(varName, type_symbol->get_type()); + + SgFunctionSymbol * ctor_symbol = global_scope->lookup_function_symbol( + SgName("dim3")); + + SgExprListExp * ctor_args = buildExprListExp(buildIntVal(arg1), + buildIntVal(arg2)); + + SgFunctionCallExp * dim3_func_call = buildFunctionCallExp( + buildFunctionRefExp(ctor_symbol->get_declaration()), ctor_args); + + char joined_str[20]; + + strcpy(joined_str, "dim3 "); + strcat(joined_str, varName); + + SgExprStatement* decl = buildAssignStatement( + buildOpaqueVarRefExp(joined_str, isSgScopeStatement(root_)), + dim3_func_call); + + SgStatementPtrList *tnl2 = new SgStatementPtrList; + + // (*tnl2).push_back(var_decl); + (*tnl2).push_back(decl); + return new CG_roseRepr(tnl2); +} + +CG_outputRepr* CG_roseBuilder::CreateDim3(const char* varName, int arg1, + int arg2, int arg3) const { + + SgName type_name("dim3"); + SgClassSymbol * type_symbol = global_scope->lookup_class_symbol(type_name); + SgClassDeclaration * type_decl = isSgClassDeclaration( + type_symbol->get_declaration()); + + //SgVariableDeclaration * var_decl = buildVariableDeclaration(varName, type_symbol->get_type()); + + SgFunctionSymbol * ctor_symbol = global_scope->lookup_function_symbol( + SgName("dim3")); + + SgExprListExp * ctor_args = buildExprListExp(buildIntVal(arg1), + buildIntVal(arg2), buildIntVal(arg3)); + + SgFunctionCallExp * dim3_func_call = buildFunctionCallExp( + buildFunctionRefExp(ctor_symbol->get_declaration()), ctor_args); + + char joined_str[20]; + + strcpy(joined_str, "dim3 "); + strcat(joined_str, varName); + + SgExprStatement* decl = buildAssignStatement( + buildOpaqueVarRefExp(joined_str, isSgScopeStatement(root_)), + dim3_func_call); + + SgStatementPtrList *tnl2 = new SgStatementPtrList; + + // (*tnl2).push_back(var_decl); + (*tnl2).push_back(decl); + return new CG_roseRepr(tnl2); + + + +} +*/ + +/*CG_outputRepr* CG_suifBuilder::CreateKernel(immed_list* iml) const { + instruction *ins = new in_rrr(io_mrk); + ins->append_annote(k_cuda_kernel, iml); + tree_node_list *tnl = new tree_node_list; + tnl->append(new tree_instr(ins)); + return new CG_suifRepr(tnl); + } + + type_node* CG_suifBuilder::ModifyType(type_node* base, const char* modifier) const { + modifier_type* result = new modifier_type(TYPE_NULL, base); + immed_list *iml = new immed_list; + iml->append(immed((char*)modifier)); + result->append_annote(k_cuda_modifier, iml); + return result; + } + */ + +std::vector substitute(SgNode *in, const SgVariableSymbol *sym, + SgExpression* expr, SgNode* root) { + + SgStatement* stmt; + SgExpression* op; + std::vector arrays; + + if (in != NULL) { + if (stmt = isSgStatement(in)) { + if (isSgBasicBlock(stmt)) { + SgStatementPtrList& stmts = + isSgBasicBlock(stmt)->get_statements(); + for (int i = 0; i < stmts.size(); i++) { + stmts[i]->set_parent(stmt); + std::vector a = substitute( + isSgNode(stmts[i]), sym, expr, root); + std::copy(a.begin(), a.end(), back_inserter(arrays)); + } + } else if (isSgForStatement(stmt)) { + SgForStatement *tnf = isSgForStatement(stmt); + tnf->get_for_init_stmt()->set_parent(tnf); + tnf->get_test()->set_parent(tnf); + tnf->get_increment()->set_parent(tnf); + tnf->get_loop_body()->set_parent(tnf); + std::vector a = substitute( + isSgNode(tnf->get_for_init_stmt()), sym, expr, root); + std::copy(a.begin(), a.end(), back_inserter(arrays)); + std::vector a1 = substitute( + isSgNode(tnf->get_test()), sym, expr, root); + std::copy(a1.begin(), a1.end(), back_inserter(arrays)); + std::vector a2 = substitute( + isSgNode(tnf->get_increment()), sym, expr, root); + std::copy(a2.begin(), a2.end(), back_inserter(arrays)); + std::vector a3 = substitute( + isSgNode(tnf->get_loop_body()), sym, expr, root); + std::copy(a3.begin(), a3.end(), back_inserter(arrays)); + } else if (isSgFortranDo(stmt)) { // Manu:: fortran support + SgFortranDo *tnf = isSgFortranDo(stmt); + tnf->get_initialization()->set_parent(tnf); + tnf->get_bound()->set_parent(tnf); + tnf->get_increment()->set_parent(tnf); + tnf->get_body()->set_parent(tnf); + std::vector a = substitute( + isSgNode(tnf->get_initialization()), sym, expr, root); + std::copy(a.begin(), a.end(), back_inserter(arrays)); + std::vector a1 = substitute( + isSgNode(tnf->get_bound()), sym, expr, root); + std::copy(a1.begin(), a1.end(), back_inserter(arrays)); + std::vector a2 = substitute( + isSgNode(tnf->get_increment()), sym, expr, root); + std::copy(a2.begin(), a2.end(), back_inserter(arrays)); + std::vector a3 = substitute( + isSgNode(tnf->get_body()), sym, expr, root); + std::copy(a3.begin(), a3.end(), back_inserter(arrays)); + } else if (isSgForInitStatement(stmt)) { + + SgStatementPtrList& stmts = + isSgForInitStatement(stmt)->get_init_stmt(); + + for (SgStatementPtrList::iterator it = stmts.begin(); + it != stmts.end(); it++) { + std::vector a = substitute(isSgNode(*it), + sym, expr, root); + + std::copy(a.begin(), a.end(), back_inserter(arrays)); + } + } + /*else if(isSgFortranDo(stmt)){ + SgFortranDo *tfortran = isSgFortranDo(stmt); + omega::CG_roseRepr *r = new omega::CG_roseRepr(isSgStatement(tfortran->get_body())); + std::vector a = FindArrayRef(r); + delete r; + std::copy(a.begin(), a.end(), back_inserter(arrays)); + }*/ + else if (isSgVariableDeclaration(stmt)) { + if (SgExpression *init = + isSgVariableDeclaration(stmt)->get_variables().front()->get_initializer()) { + if (isSgAssignInitializer(init)) { + std::vector a = substitute( + isSgAssignInitializer(init)->get_operand(), sym, + expr, root); + std::copy(a.begin(), a.end(), back_inserter(arrays)); + } + } + } else if (isSgIfStmt(stmt)) { + SgIfStmt* tni = isSgIfStmt(stmt); + //tni->get_conditional()->set_parent(tni); + //tni->get_true_body()->set_parent(tni); + //tni->get_false_body()->set_parent(tni); + std::vector a = substitute( + isSgNode(tni->get_conditional()), sym, expr, root); + std::copy(a.begin(), a.end(), back_inserter(arrays)); + std::vector a1 = substitute( + isSgNode(tni->get_true_body()), sym, expr, root); + std::copy(a1.begin(), a1.end(), back_inserter(arrays)); + std::vector a2 = substitute( + isSgNode(tni->get_false_body()), sym, expr, root); + std::copy(a2.begin(), a2.end(), back_inserter(arrays)); + } else if (isSgExprStatement(stmt)) { + (isSgExprStatement(stmt)->get_expression())->set_parent( + isSgExprStatement(stmt)); + std::vector a = substitute( + isSgNode(isSgExprStatement(stmt)->get_expression()), + sym, expr, root); + std::copy(a.begin(), a.end(), back_inserter(arrays)); + } //end else if + } //end if + else { + op = isSgExpression(in); + // std::string x = isSgNode(op)->unparseToString(); + std::string y = sym->get_name().getString(); +// std::cout << "------substitute else:: " << in->unparseToString().c_str() << ", " << y.c_str() << "\n"; + + if (isSgBinaryOp(op)) { + + isSgBinaryOp(op)->get_lhs_operand()->set_parent(op); + isSgBinaryOp(op)->get_rhs_operand()->set_parent(op); + + std::vector a = substitute( + isSgBinaryOp(op)->get_lhs_operand(), sym, expr, root); + std::copy(a.begin(), a.end(), back_inserter(arrays)); + std::vector a1 = substitute( + isSgBinaryOp(op)->get_rhs_operand(), sym, expr, root); + std::copy(a1.begin(), a1.end(), back_inserter(arrays)); + } else if (isSgUnaryOp(op)) { + //isSgUnaryOp(op)->get_operand()->set_parent(op); + //std::string x = isSgNode(op)->unparseToString(); + //std::cout< a = substitute( + isSgUnaryOp(op)->get_operand(), sym, expr, root); + std::copy(a.begin(), a.end(), back_inserter(arrays)); + } else if (isSgVarRefExp(op)) { + std::string z = + isSgVarRefExp(op)->get_symbol()->get_name().getString(); + if (!strcmp(z.c_str(), y.c_str())) { + //isSgVarRefExp(op)->set_symbol(isSgVarRefExp(expr)->get_symbol()); + arrays.push_back(isSgVarRefExp(op)); + //replaceVariableReferences(root, isSgVarRefExp(in)->get_symbol(), temp); + //r = true; + } //end if + } //end else if + else if (isSgCallExpression(op)) { + SgExprListExp* exprs = isSgCallExpression(op)->get_args(); + SgExpressionPtrList &expr_list = exprs->get_expressions(); + + for (SgExpressionPtrList::iterator it = expr_list.begin(); + it != expr_list.end(); it++) { + std::vector a = substitute(isSgNode(*it), + sym, expr, root); + std::copy(a.begin(), a.end(), back_inserter(arrays)); + } + } else if (isSgExprListExp(op)) { // Manu:: fortran indices are stored this way + SgExpressionPtrList &expr_list = isSgExprListExp(op)->get_expressions(); + + for (SgExpressionPtrList::iterator it = expr_list.begin(); + it != expr_list.end(); it++) { + std::vector a = substitute(isSgNode(*it), + sym, expr, root); + std::copy(a.begin(), a.end(), back_inserter(arrays)); + } + + } + + //end else if + //else if(!isSgValueExp(op)) + // throw ir_error("unrecognized expression type"); + } //end else + } //end if + + /* bool r = false; + if (isSgVarRefExp(in) && (isSgVarRefExp(in)->get_symbol() == sym)) { + omega::CG_roseRepr *result = new omega::CG_roseRepr(expr); + SgExpression* expr1 = result->GetExpression(); + delete result; + SgVariableSymbol* temp = isSgVarRefExp(expr1)->get_symbol(); + parent->replace_expression(in, expr1); + replaceVariableReferences(root, isSgVarRefExp(in)->get_symbol(), temp); + r = true; + } + else if(isSgBinaryOp(in)){ + substitute(isSgBinaryOp(in)->get_lhs_operand(), sym, expr, root, in); + substitute(isSgBinaryOp(in)->get_rhs_operand(), sym, expr, root, in); + } + else if(isSgUnaryOp(in)) + substitute(isSgUnaryOp(in)->get_operand(), sym, expr, root, in); + + */ + + return arrays; +} + +/*bool substitute(SgStatement *tn, SgVariableSymbol *sym, SgExpression* expr, SgNode* root, SgSymbolTable* symtab) { + if (tn == NULL) + return false; + + bool r = false; + if( tn != NULL){ + if(isSgExpression(tn)){ + r = substitute(isSgExpression(tn), sym, expr, root, isSgExpression(tn)) || r; + + } + else { + omega::CG_roseRepr *result = new omega::CG_roseRepr(expr); + SgExpression* expr1 = result->GetExpression(); + tn->replace_expression(buildVarRefExp(sym), expr1); + for (unsigned i = 0; i < tn->get_numberOfTraversalSuccessors(); i++) + r = substitute(isSgStatement(tn->get_traversalSuccessorByIndex(i)), sym, expr, root, symtab) || r; + + } + } + return r; + } + + bool substitute(SgNode *tnl, SgVariableSymbol *sym, SgExpression* expr, SgNode* root, SgSymbolTable* symtab) { + if (tnl == NULL) + return false; + + bool r = false; + + for(int i=0; i < tnl->get_numberOfTraversalSuccessors(); i++){ + + SgNode* tn = tnl->get_traversalSuccessorByIndex(i); + r = substitute(isSgStatement(tn), sym, expr, root, symtab) || r; + } + + + return r; + } + */ + +} // namespace diff --git a/omegalib/code_gen/src/CG_roseRepr.cc b/omegalib/code_gen/src/CG_roseRepr.cc new file mode 100644 index 0000000..99cf973 --- /dev/null +++ b/omegalib/code_gen/src/CG_roseRepr.cc @@ -0,0 +1,176 @@ +/***************************************************************************** + Copyright (C) 2008 University of Southern California. + All Rights Reserved. + + Purpose: + omega holder for suif implementaion + + Notes: + + History: + 02/01/06 - Chun Chen - created +*****************************************************************************/ + +#include +#include +#include +#include +#include +namespace omega { + + + + +CG_roseRepr::CG_roseRepr(): tnl_(NULL), op_(NULL), list_(NULL){ + +} + +CG_roseRepr::CG_roseRepr(SgNode *tnl): tnl_(tnl), op_(NULL),list_(NULL) { +} + +CG_roseRepr::CG_roseRepr(SgExpression* op): tnl_(NULL), op_(op),list_(NULL){ +} +CG_roseRepr::CG_roseRepr(SgStatementPtrList* stmtlist):tnl_(NULL), op_(NULL), list_(stmtlist){ +} + +CG_roseRepr::~CG_roseRepr() { + // delete nothing here. operand or tree_node_list should already be + // grafted to other expression tree or statement list +} + +CG_outputRepr* CG_roseRepr::clone() const { + + if( tnl_ != NULL) { + SgTreeCopy tc; + SgNode *tnl = tnl_->copy(tc); + copyAttributes(tnl_, tnl); + + tnl->set_parent(tnl_->get_parent()); + return new CG_roseRepr(tnl); + } + else if(op_ != NULL) + { + SgTreeCopy tc1; + SgNode* op = isSgNode(op_)->copy(tc1); + copyAttributes(op_, op); + + op->set_parent(isSgNode(op_)->get_parent()); + return new CG_roseRepr(isSgExpression(op)); + } + else if(list_ != NULL) + { + SgStatementPtrList* list2 = new SgStatementPtrList; + + for(SgStatementPtrList::iterator it = (*list_).begin(); it != (*list_).end(); it++){ + SgTreeCopy tc3; + SgNode *tnl2 = isSgNode(*it)->copy(tc3); + copyAttributes(*it, tnl2); + + tnl2->set_parent(isSgNode(*it)->get_parent()); + + (*list2).push_back(isSgStatement(tnl2)); + } + return new CG_roseRepr(list2); + } + + return NULL; +} + +void CG_roseRepr::clear() { + if(tnl_ != NULL) { + delete tnl_; + tnl_ = NULL; + } +} + +SgNode* CG_roseRepr::GetCode() const { + return tnl_; +} + +SgStatementPtrList* CG_roseRepr::GetList() const { + return list_; +} + +SgExpression* CG_roseRepr::GetExpression() const { + return op_; +} +void CG_roseRepr::Dump() const { +SgNode* tnl = tnl_; +SgExpression* op = op_ ; + if(tnl != NULL) + DumpFileHelper(tnl, stdout); + else if(op != NULL) + DumpFileHelper(isSgNode(op), stdout); + +} + +void CG_roseRepr::DumpFileHelper(SgNode* node, FILE *fp) const{ + std::string x; + size_t numberOfSuccessors = node->get_numberOfTraversalSuccessors(); + if(numberOfSuccessors == 0){ + x = node->unparseToString (); + fprintf(fp, "%s", x.c_str()); + } + else{ + for (size_t idx = 0; idx < numberOfSuccessors; idx++) + { + SgNode *child = NULL; + child = node->get_traversalSuccessorByIndex(idx); + DumpFileHelper(child, fp); + } + +} +} + +/*void CG_roseRepr::DumpToFile(FILE *fp) const { +// std::string x; +SgNode* tnl = tnl_; +SgExpression* op = op_ ; + +if(tnl!= NULL){ + std::string x = tnl->unparseToString(); + fprintf(fp, "%s", x.c_str()); + +} +else if(op != NULL){ + std::string x = isSgNode(op)->unparseToString(); + fprintf(fp, "%s", x.c_str()); + + + +} +} +*/ +/* +SgNode* CG_roseRepr::copyAST ( SgNode* node ) +{ + +// This is a better implementation using a derived class from SgCopyHelp to control the +// copying process (skipping the copy of any function definition). This is a variable +// declaration with an explicitly declared class type. +class RestrictedCopyType : public SgCopyHelp + { + // DQ (9/26/2005): This class demonstrates the use of the copy mechanism + // within Sage III (originally designed and implemented by Qing Yi). + // One problem with it is that there is no context information permitted. + + public: + virtual SgNode *copyAst(const SgNode *n) + { + // This is the simpliest possible version of a deep copy SgCopyHelp::copyAst() member function. + SgNode *returnValue = n->copy(*this); + + return returnValue; + } + } restrictedCopyType; + + + + +// This triggers a bug with test2005_152.C (the unparsed code fails for g++ 4.1.2, but not 3.5.6) +SgNode* copyOfNode = node->copy(restrictedCopyType); +return copyOfNode; + +} +*/ +} // namespace diff --git a/omegalib/code_gen/src/CG_stringBuilder.cc b/omegalib/code_gen/src/CG_stringBuilder.cc new file mode 100644 index 0000000..2f9286f --- /dev/null +++ b/omegalib/code_gen/src/CG_stringBuilder.cc @@ -0,0 +1,487 @@ +/***************************************************************************** + Copyright (C) 1994-2000 the Omega Project Team + Copyright (C) 2005-2011 Chun Chen + All Rights Reserved. + + Purpose: + generate pseudo string code + + Notes: + There is no need to check illegal NULL parameter and throw invalid_argument + in other IR interface implementation. They are for debugging purpose. + intMod implements modular function that returns positve remainder no matter + lop is postive or nagative and rop is guranteed to be positive here. + + History: + 04/17/96 - Lei Zhou - created + 08/31/09 add parenthesis to string operands, Chun Chen +*****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include + +namespace { + +std::string SafeguardString(const std::string &s, char op) { + int len = s.length(); + int paren_level = 0; + int num_plusminus = 0; + int num_mul = 0; + int num_div = 0; + for (int i = 0; i < len; i++) + switch (s[i]) { + case '(': + paren_level++; + break; + case ')': + paren_level--; + break; + case '+': + case '-': + if (paren_level == 0) + num_plusminus++; + break; + case '*': + if (paren_level == 0) + num_mul++; + break; + case '/': + if (paren_level == 0) + num_div++; + break; + default: + break; + } + + bool need_paren = false; + switch (op) { + case '-': + if (num_plusminus > 0) + need_paren = true; + break; + case '*': + if (num_plusminus > 0 || num_div > 0) + need_paren = true; + break; + case '/': + if (num_plusminus > 0 || num_div > 0 || num_mul > 0) + need_paren = true; + break; + default: + break; + } + + if (need_paren) + return "(" + s + ")"; + else + return s; +} + + +std::string GetIndentSpaces(int indent) { + std::string indentStr; + for (int i = 1; i < indent; i++) { + indentStr += " "; + } + return indentStr; +} + + +// A shortcut to extract the string enclosed in the CG_outputRepr and delete +// the original holder. +std::string GetString(omega::CG_outputRepr *repr) { + std::string result = static_cast(repr)->GetString(); + delete repr; + return result; +} + +} + + +namespace omega { + + + +//----------------------------------------------------------------------------- +// Class: CG_stringBuilder +//----------------------------------------------------------------------------- + +CG_stringRepr *CG_stringBuilder::CreateSubstitutedStmt(int indent, CG_outputRepr *stmt, + const std::vector &vars, + std::vector &subs) const { + std::string listStr = ""; + + for (int i = 0; i < subs.size(); i++) { + if (subs[i] == NULL) + listStr += "N/A"; + else + listStr += GetString(subs[i]); + if (i < subs.size() - 1) + listStr += ","; + } + + std::string stmtName = GetString(stmt); + std::string indentStr = GetIndentSpaces(indent); + + return new CG_stringRepr(indentStr + stmtName + "(" + listStr + ");\n"); +} + +CG_stringRepr *CG_stringBuilder::CreateAssignment(int indent, + CG_outputRepr *lhs, + CG_outputRepr *rhs) const { + if (lhs == NULL || rhs == NULL) + throw std::invalid_argument("missing lhs or rhs in assignment"); + + std::string lhsStr = GetString(lhs); + std::string rhsStr = GetString(rhs); + + std::string indentStr = GetIndentSpaces(indent); + + return new CG_stringRepr(indentStr + lhsStr + "=" + rhsStr + ";\n"); +} + + +CG_stringRepr *CG_stringBuilder::CreateInvoke(const std::string &funcName, + std::vector &list) const { + std::string listStr = ""; + + for (int i = 0; i < list.size(); i++) { + listStr += GetString(list[i]); + if ( i < list.size()-1) + listStr += ","; + } + + return new CG_stringRepr(funcName + "(" + listStr + ")"); +} + + +CG_stringRepr *CG_stringBuilder::CreateComment(int indent, const std::string &commentText) const { + if (commentText == std::string("")) { + return NULL; + } + + std::string indentStr = GetIndentSpaces(indent); + + return new CG_stringRepr(indentStr + "// " + commentText + "\n"); +} + +CG_stringRepr* CG_stringBuilder::CreateAttribute(CG_outputRepr *control, + const std::string &commentText) const { + if (commentText == std::string("")) { + return static_cast (control); + } + + std::string controlString = GetString(control); + + return new CG_stringRepr("// " + commentText + "\n" + controlString); + +} + +CG_outputRepr* CG_stringBuilder::CreatePragmaAttribute(CG_outputRepr *scopeStmt, int looplevel, const std::string &pragmaText) const { + // -- Not Implemented + return scopeStmt; +} + +CG_outputRepr* CG_stringBuilder::CreatePrefetchAttribute(CG_outputRepr* scopeStmt, int looplevel, const std::string& arrName, int hint) const { + // -- Not Implemented + return scopeStmt; +} + +CG_stringRepr *CG_stringBuilder::CreateIf(int indent, CG_outputRepr *guardList, + CG_outputRepr *true_stmtList, CG_outputRepr *false_stmtList) const { + if (guardList == NULL) + throw std::invalid_argument("missing if condition"); + + if (true_stmtList == NULL && false_stmtList == NULL) { + delete guardList; + return NULL; + } + + std::string guardListStr = GetString(guardList); + std::string indentStr = GetIndentSpaces(indent); + std::string s; + if (true_stmtList != NULL && false_stmtList == NULL) { + s = indentStr + "if (" + guardListStr + ") {\n" + + GetString(true_stmtList) + + indentStr + "}\n"; + } + else if (true_stmtList == NULL && false_stmtList != NULL) { + s = indentStr + "if !(" + guardListStr + ") {\n" + + GetString(false_stmtList) + + indentStr + "}\n"; + } + else { + s = indentStr + "if (" + guardListStr + ") {\n" + + GetString(true_stmtList) + + indentStr + "}\n" + + indentStr + "else {\n" + + GetString(false_stmtList) + + indentStr + "}\n"; + } + + return new CG_stringRepr(s); +} + + + +CG_stringRepr *CG_stringBuilder::CreateInductive(CG_outputRepr *index, + CG_outputRepr *lower, CG_outputRepr *upper, + CG_outputRepr *step) const { + if (index == NULL) + throw std::invalid_argument("missing loop index"); + if (lower == NULL) + throw std::invalid_argument("missing loop lower bound"); + if (upper == NULL) + throw std::invalid_argument("missing loop upper bound"); + if (step == NULL) + throw std::invalid_argument("missing loop step size"); + + std::string indexStr = GetString(index); + std::string lowerStr = GetString(lower); + std::string upperStr = GetString(upper); + + std::string doStr = "for(" + indexStr + " = " + lowerStr + "; " + + indexStr + " <= " + upperStr + "; " + + indexStr; + + std::string stepStr = GetString(step); + if (stepStr == to_string(1)) + doStr += "++"; + else + doStr += " += " + stepStr; + + doStr += ")"; + + return new CG_stringRepr(doStr); +} + + +CG_stringRepr *CG_stringBuilder::CreateLoop(int indent, CG_outputRepr *control, + CG_outputRepr *stmtList) const { + if (stmtList == NULL) { + delete control; + return NULL; + } + else if (control == NULL) + return static_cast(stmtList); + + std::string ctrlStr = GetString(control); + std::string stmtStr = GetString(stmtList); + + std::string indentStr = GetIndentSpaces(indent); + + std::string s = indentStr + ctrlStr + " {\n" + + stmtStr + + indentStr + "}\n"; + + return new CG_stringRepr(s); +} + + + +CG_stringRepr *CG_stringBuilder::CreateInt(int num) const { + std::string s = to_string(num); + return new CG_stringRepr(s); +} + + + +bool CG_stringBuilder::isInteger(CG_outputRepr *op) const { + + char * cstr; + std::string s = GetString(op); + cstr = new char [s.size()+1]; + strcpy (cstr, s.c_str()); + int count = 0; + while(cstr[count] != '\n' && cstr[count] != '\0' ) + if( !isdigit(cstr[count])) + return false; + + + return true; +} + + + +CG_stringRepr *CG_stringBuilder::CreateIdent(const std::string &varName) const { + if (varName == std::string("")) { + return NULL; + } + + return new CG_stringRepr(varName); +} + + +CG_stringRepr *CG_stringBuilder::CreatePlus(CG_outputRepr *lop, CG_outputRepr *rop) const { + if (rop == NULL) { + return static_cast(lop); + } + else if (lop == NULL) { + return static_cast(rop); + } + + std::string lopStr = GetString(lop); + std::string ropStr = GetString(rop); + + return new CG_stringRepr(lopStr + "+" + ropStr); +} + + +CG_stringRepr *CG_stringBuilder::CreateMinus(CG_outputRepr *lop, CG_outputRepr *rop) const { + if (rop == NULL) { + return static_cast(lop); + } + else if (lop == NULL) { + std::string ropStr = GetString(rop); + return new CG_stringRepr("-" + SafeguardString(ropStr, '-')); + } + + std::string lopStr = GetString(lop); + std::string ropStr = GetString(rop); + + return new CG_stringRepr(lopStr + "-" + SafeguardString(ropStr, '-')); +} + + +CG_stringRepr *CG_stringBuilder::CreateTimes(CG_outputRepr *lop, CG_outputRepr *rop) const { + if (rop == NULL || lop == NULL) { + delete rop; + delete lop; + return NULL; + } + + std::string lopStr = GetString(lop); + std::string ropStr = GetString(rop); + + return new CG_stringRepr(SafeguardString(lopStr, '*') + "*" + SafeguardString(ropStr, '*')); +} + + +CG_stringRepr *CG_stringBuilder::CreateDivide(CG_outputRepr *lop, CG_outputRepr *rop) const { + if (rop == NULL) + throw codegen_error("integer division by zero"); + else if (lop == NULL) { + delete rop; + return NULL; + } + + std::string lopStr = GetString(lop); + std::string ropStr = GetString(rop); + + return new CG_stringRepr(SafeguardString(lopStr, '/') + "/" + SafeguardString(ropStr, '/')); +} + + +CG_stringRepr *CG_stringBuilder::CreateIntegerFloor(CG_outputRepr *lop, CG_outputRepr *rop) const { + if (rop == NULL) + throw codegen_error("integer division by zero"); + else if (lop == NULL) { + delete rop; + return NULL; + } + + std::string lopStr = GetString(lop); + std::string ropStr = GetString(rop); + + return new CG_stringRepr("intFloor(" + lopStr + "," + ropStr + ")"); +} + + +CG_stringRepr *CG_stringBuilder::CreateIntegerMod(CG_outputRepr *lop, CG_outputRepr *rop) const { + if (rop == NULL) + throw codegen_error("integer modulo by zero"); + else if (lop == NULL) { + delete rop; + return NULL; + } + + std::string lopStr = GetString(lop); + std::string ropStr = GetString(rop); + + return new CG_stringRepr("intMod(" + lopStr + "," + ropStr + ")"); +} + +CG_stringRepr *CG_stringBuilder::CreateIntegerCeil(CG_outputRepr *lop, CG_outputRepr *rop) const { + if (rop == 0) + throw codegen_error("integer ceiling by zero"); + else if (lop == NULL) { + delete rop; + return NULL; + } + + std::string lopStr = GetString(lop); + std::string ropStr = GetString(rop); + + return new CG_stringRepr("intCeil(" + lopStr + "," + ropStr + ")"); +} + + +CG_stringRepr *CG_stringBuilder::CreateAnd(CG_outputRepr *lop, CG_outputRepr *rop) const { + if (rop == NULL) + return static_cast(lop); + else if (lop == NULL) + return static_cast(rop); + + std::string lopStr = GetString(lop); + std::string ropStr = GetString(rop); + + return new CG_stringRepr(lopStr + " && " + ropStr); +} + + +CG_stringRepr *CG_stringBuilder::CreateGE(CG_outputRepr *lop, CG_outputRepr *rop) const { + if (rop == NULL || lop == NULL) + throw std::invalid_argument("missing operand in greater than equal comparison condition"); + + std::string lopStr = GetString(lop); + std::string ropStr = GetString(rop); + + return new CG_stringRepr(lopStr + " >= " + ropStr); +} + + + +CG_stringRepr *CG_stringBuilder::CreateLE(CG_outputRepr *lop, CG_outputRepr *rop) const { + if (rop == NULL || lop == NULL) + throw std::invalid_argument("missing operand in less than equal comparison condition"); + + std::string lopStr = GetString(lop); + std::string ropStr = GetString(rop); + + return new CG_stringRepr(lopStr + " <= " + ropStr); +} + + + +CG_stringRepr *CG_stringBuilder::CreateEQ(CG_outputRepr *lop, CG_outputRepr *rop) const { + if (rop == NULL || lop == NULL) + throw std::invalid_argument("missing operand in equal comparison condition"); + + std::string lopStr = GetString(lop); + std::string ropStr = GetString(rop); + + return new CG_stringRepr(lopStr + " == " + ropStr); +} + + + +CG_stringRepr *CG_stringBuilder::StmtListAppend(CG_outputRepr *list1, CG_outputRepr *list2) const { + if (list2 == NULL) { + return static_cast(list1); + } + else if (list1 == NULL) { + return static_cast(list2); + } + + std::string list1Str = GetString(list1); + std::string list2Str = GetString(list2); + + return new CG_stringRepr(list1Str + list2Str); +} + +} diff --git a/omegalib/code_gen/src/CG_stringRepr.cc b/omegalib/code_gen/src/CG_stringRepr.cc new file mode 100644 index 0000000..63a1657 --- /dev/null +++ b/omegalib/code_gen/src/CG_stringRepr.cc @@ -0,0 +1,54 @@ +/***************************************************************************** + Copyright (C) 1994-2000 University of Maryland + Copyright (C) 2008 University of Southern California + Copyright (C) 2009 University of Utah + All Rights Reserved. + + Purpose: + omega holder for string implementation. + + Notes: + + History: + 04/17/96 - Lei Zhou - created +*****************************************************************************/ + +#include +#include + +namespace omega { + +CG_stringRepr::CG_stringRepr() { +} + +CG_stringRepr::CG_stringRepr(const std::string& _s) : s(_s) { +} + +CG_stringRepr::~CG_stringRepr() { +} + +CG_outputRepr* CG_stringRepr::clone() { + return new CG_stringRepr(s); +} + + +//----------------------------------------------------------------------------- +// basic operation +//----------------------------------------------------------------------------- +std::string CG_stringRepr::GetString() const { + return s; +} + + +//----------------------------------------------------------------------------- +// Dump operations +//----------------------------------------------------------------------------- +void CG_stringRepr::Dump() const { + printf("%s\n", s.c_str()); +} + +void CG_stringRepr::DumpToFile(FILE *fp) const { + fprintf(fp,"%s", s.c_str()); +} + +} // namespace diff --git a/omegalib/code_gen/src/CG_suifBuilder.cc b/omegalib/code_gen/src/CG_suifBuilder.cc new file mode 100644 index 0000000..6bb91b7 --- /dev/null +++ b/omegalib/code_gen/src/CG_suifBuilder.cc @@ -0,0 +1,678 @@ +/***************************************************************************** + Copyright (C) 2008 University of Southern California + Copyright (C) 2009-2010 University of Utah + All Rights Reserved. + + Purpose: + generate suif code for omega + + Notes: + + History: + 02/01/06 created by Chun Chen +*****************************************************************************/ + +#include +#include +#include +#include + +namespace omega { + +//----------------------------------------------------------------------------- +// make suif initilization happy +//----------------------------------------------------------------------------- +char *k_ocg_comment; +char *k_s2c_pragma; +char *k_cuda_dim3; +char *k_cuda_kernel; +char *k_cuda_modifier; +char *k_cuda_texture_memory; //protonu--added to track texture memory type + +// void __attribute__ ((constructor)) my_init(void) { +// ANNOTE(k_ocg_comment, "omega_comment", TRUE); +// } + +//protonu--extern decls +//protonu--adding stuff to make Chun's code work with Gabe's +extern Tuple< Tuple > smtNonSplitLevels; +extern Tuple< Tuple > loopIdxNames;//per stmt +extern std::vector< std::pair > syncs; +extern int checkLoopLevel; +extern int stmtForLoopCheck; +extern int upperBoundForLevel; +extern int lowerBoundForLevel; +extern bool fillInBounds; + + +const char *libcode_gen_ver_string = ""; +const char *libcode_gen_who_string = ""; +const char *libcode_gen_suif_string = ""; + + +void init_code_gen() { + static bool isInit = false; + if(!isInit) + { + isInit = true; + ANNOTE(k_ocg_comment, "omega_comment", TRUE); + ANNOTE(k_s2c_pragma, "s2c pragma", TRUE); + ANNOTE(k_cuda_dim3, "cuda dim3", TRUE); + ANNOTE(k_cuda_kernel, "cuda kernel", TRUE); + ANNOTE(k_cuda_modifier, "cuda modifier", TRUE); + } +} + + +void exit_code_gen(void) { +} + + +//----------------------------------------------------------------------------- +// Class: CG_suifBuilder +//----------------------------------------------------------------------------- + +CG_suifBuilder::CG_suifBuilder(proc_symtab *symtab) +{ + symtab_ = symtab; + init_code_gen(); +} + +CG_outputRepr* CG_suifBuilder::CreatePlaceHolder (int, CG_outputRepr *stmt, + Tuple &funcList, Tuple &loop_vars) const { + tree_node_list *tnl = static_cast(stmt)->tnl_; + delete stmt; + + for (int i = 1; i <= funcList.size(); i++) { + if (funcList[i] == NULL) + continue; + + CG_suifRepr *repr = static_cast(funcList[i]); + operand op = repr->op_; + delete repr; + + var_sym *vs = static_cast(symtab_->lookup_sym(loop_vars[i].c_str(), SYM_VAR)); + + substitute(tnl, vs, op, symtab_); + + if (op.is_instr()) + delete op.instr(); + } + + return new CG_suifRepr(tnl); +} + + +CG_outputRepr* CG_suifBuilder::CreateAssignment(int, CG_outputRepr *lhs, + CG_outputRepr *rhs) const { + if ( lhs == NULL || rhs == NULL ) { + fprintf(stderr, "Code generation: Missing lhs or rhs\n"); + return NULL; + } + + operand src = static_cast(rhs)->op_; + if (src.is_instr() && src.instr()->opcode() == io_array) { + in_array *ia = static_cast(src.instr()); + instruction *ins = new in_rrr(io_lod, ia->elem_type(), operand(), ia); + src = operand(ins); + } + + instruction *ins; + operand dst = static_cast(lhs)->op_; + if (dst.is_instr() && dst.instr()->opcode() == io_array) { + in_array *ia = static_cast(dst.instr()); + ins = new in_rrr(io_str, type_void, operand(), operand(ia), src); + } + else + ins = new in_rrr(io_cpy, src.type(), dst, src); + + delete lhs; + delete rhs; + + tree_node_list *tnl = new tree_node_list; + tnl->append(new tree_instr(ins)); + + return new CG_suifRepr(tnl); +} + + +CG_outputRepr* CG_suifBuilder::CreateInvoke(const std::string &fname, + Tuple &list) const { + if (fname == std::string("max") || fname == std::string("min")) { + if (list.size() == 0) { + return NULL; + } + else if (list.size() == 1) { + return list[1]; + } + else { + int last = list.size(); + operand op2 = static_cast(list[last])->op_; + delete list[last]; + list.delete_last(); + CG_suifRepr *repr = static_cast(CreateInvoke(fname, list)); + operand op1 = repr->op_; + + instruction *ins; + if (fname == std::string("max")) + ins = new in_rrr(io_max, op1.type(), operand(), op1, op2); + else + ins = new in_rrr(io_min, op1.type(), operand(), op1, op2); + + repr->op_ = operand(ins); + + return repr; + } + } + else { + fprintf(stderr, "Code generation: invoke function io_call not implemented\n"); + return NULL; + } +} + + +CG_outputRepr* CG_suifBuilder::CreateAttribute(CG_outputRepr *control, + const std::string &commentText)const { + if (commentText == std::string("")) { + return control; + } + + instruction *ins = new in_rrr(io_mrk); + + immed_list *iml = new immed_list; + iml->append(immed(const_cast(commentText.c_str()))); + ins->prepend_annote(k_ocg_comment, iml); + + tree_node_list *tnl ; + tnl = static_cast(control)->tnl_; + tnl->append(new tree_instr(ins)); + + + return new CG_suifRepr(tnl); + + +} + + + +CG_outputRepr* CG_suifBuilder::CreateComment(int, const std::string &commentText) const { + if ( commentText == std::string("") ) { + return NULL; + } + + instruction *ins = new in_rrr(io_mrk); + + immed_list *iml = new immed_list; + iml->append(immed(const_cast(commentText.c_str()))); + ins->prepend_annote(k_ocg_comment, iml); + + tree_node_list *tnl = new tree_node_list; + tnl->append(new tree_instr(ins)); + + return new CG_suifRepr(tnl); +} + + +CG_outputRepr* CG_suifBuilder::CreateIf(int, CG_outputRepr *guardList, + CG_outputRepr *true_stmtList, CG_outputRepr *false_stmtList) const { + static int if_counter = 1; + std::string s = std::string("omegaif_")+to_string(if_counter++); + label_sym *if_label = new label_sym(const_cast(s.c_str())); + symtab_->add_sym(if_label); + + if ( true_stmtList == NULL && false_stmtList == NULL ) { + delete guardList; + return NULL; + } + else if ( guardList == NULL ) { + return StmtListAppend(true_stmtList, false_stmtList); + } + + tree_node_list *header = new tree_node_list; + operand op = static_cast(guardList)->op_; + + std::stack S; + S.push(op.instr()); + while(!S.empty()) { + instruction *ins = static_cast(S.top()); + S.pop(); + if (ins->opcode() == io_and) { + instruction *ins1 = ins->src_op(0).instr(); + ins1->remove(); + S.push(ins1); + instruction *ins2 = ins->src_op(1).instr(); + ins2->remove(); + S.push(ins2); + delete ins; + } + else { + ins = new in_bj(io_bfalse, if_label, operand(ins)); + header->append(new tree_instr(ins)); + } + } + + tree_node_list *then_part, *else_part; + if (true_stmtList != NULL) + then_part = static_cast(true_stmtList)->tnl_; + else + then_part = NULL; + if (false_stmtList != NULL) + else_part = static_cast(false_stmtList)->tnl_; + else + else_part = NULL; + tree_if *ti = new tree_if(if_label, header, then_part, else_part); + + tree_node_list *tnl = new tree_node_list; + tnl->append(ti); + + delete guardList; + delete true_stmtList; + delete false_stmtList; + + return new CG_suifRepr(tnl); +} + + +CG_outputRepr* CG_suifBuilder::CreateInductive(CG_outputRepr *index, + CG_outputRepr *lower, + CG_outputRepr *upper, + CG_outputRepr *step) const { + if ( index == NULL || lower == NULL || upper == NULL ) { + fprintf(stderr, "Code generation: something wrong in CreateInductive\n"); + return NULL; + } + + if (step == NULL) + step = CreateInt(1); + + var_sym *index_sym = static_cast(index)->op_.symbol(); + operand lower_bound = static_cast(lower)->op_; + operand upper_bound = static_cast(upper)->op_; + operand step_size = static_cast(step)->op_; + + label_sym *contLabel = new label_sym(""); + label_sym *brkLabel = new label_sym(""); + symtab_->add_sym(contLabel); + symtab_->add_sym(brkLabel); + tree_for *tf = new tree_for(index_sym, FOR_SLTE, contLabel, brkLabel, NULL, + lower_bound, upper_bound, step_size, NULL); + + tree_node_list *tnl = new tree_node_list; + tnl->append(tf); + + delete index; + delete lower; + delete upper; + delete step; + + return new CG_suifRepr(tnl); +} + + +CG_outputRepr* CG_suifBuilder::CreateLoop(int, CG_outputRepr *control, + CG_outputRepr *stmtList) const { + if ( stmtList == NULL ) { + delete control; + return NULL; + } + else if ( control == NULL ) { + fprintf(stderr, "Code generation: no inductive for this loop\n"); + return stmtList; + } + + tree_node_list *tnl = static_cast(control)->tnl_; + tree_node_list_iter iter(tnl); + tree_for *tf = static_cast(iter.step()); + + tree_node_list *body = static_cast(stmtList)->tnl_; + tf->set_body(body); + + delete stmtList; + + return control; +} + + +CG_outputRepr* CG_suifBuilder::CreateInt(int _i) const { + in_ldc *ins = new in_ldc(type_s32, operand(), immed(_i)); + + return new CG_suifRepr(operand(ins)); +} + + +CG_outputRepr* CG_suifBuilder::CreateIdent(const std::string &_s) const { + if ( &_s == NULL || _s == std::string("") ) { + return NULL; + } + + var_sym *vs = static_cast(symtab_->lookup_sym(_s.c_str(), SYM_VAR)); + + if (vs == NULL) { + vs = new var_sym(type_s32, const_cast(_s.c_str())); + symtab_->add_sym(vs); + } + + return new CG_suifRepr(operand(vs)); +} + + +CG_outputRepr* CG_suifBuilder::CreatePlus(CG_outputRepr *lop, + CG_outputRepr *rop) const { + if ( rop == NULL ) { + return lop; + } + else if ( lop == NULL ) { + return rop; + } + + operand op1 = static_cast(lop)->op_; + operand op2 = static_cast(rop)->op_; + + instruction *ins = new in_rrr(io_add, op1.type(), operand(), op1, op2); + + delete lop; + delete rop; + + return new CG_suifRepr(operand(ins)); +} + + +CG_outputRepr* CG_suifBuilder::CreateMinus(CG_outputRepr *lop, + CG_outputRepr *rop) const { + if ( rop == NULL ) { + return lop; + } + else if ( lop == NULL ) { + operand op = static_cast(rop)->op_; + instruction *ins = new in_rrr(io_neg, op.type(), operand(), op); + + delete rop; + + return new CG_suifRepr(operand(ins)); + } + else { + operand op1 = static_cast(lop)->op_; + operand op2 = static_cast(rop)->op_; + + instruction *ins = new in_rrr(io_sub, op1.type(), operand(), op1, op2); + + delete lop; + delete rop; + + return new CG_suifRepr(operand(ins)); + } +} + + +CG_outputRepr* CG_suifBuilder::CreateTimes(CG_outputRepr *lop, + CG_outputRepr *rop) const { + if ( rop == NULL || lop == NULL) { + if (rop != NULL) { + rop->clear(); + delete rop; + } + if (lop != NULL) { + lop->clear(); + delete lop; + } + return NULL; + } + + operand op1 = static_cast(lop)->op_; + operand op2 = static_cast(rop)->op_; + + instruction *ins = new in_rrr(io_mul, op1.type(), operand(), op1, op2); + + delete lop; + delete rop; + + return new CG_suifRepr(operand(ins)); +} + + +CG_outputRepr* CG_suifBuilder::CreateIntegerDivide(CG_outputRepr *lop, + CG_outputRepr *rop) const { + if ( rop == NULL ) { + fprintf(stderr, "Code generation: divide by NULL\n"); + return NULL; + } + else if ( lop == NULL ) { + delete rop; + return NULL; + } + + // (6+5)*10 / 4 + operand op1 = static_cast(lop)->op_; + operand op2 = static_cast(rop)->op_; + + // bugs in SUIF prevent use of correct io_divfloor + instruction *ins = new in_rrr(io_div, op1.type(), operand(), op1, op2); + + delete lop; + delete rop; + + return new CG_suifRepr(operand(ins)); +} + + +CG_outputRepr* CG_suifBuilder::CreateIntegerMod(CG_outputRepr *lop, + CG_outputRepr *rop) const { + if ( rop == NULL || lop == NULL ) { + return NULL; + } + + operand op1 = static_cast(lop)->op_; + operand op2 = static_cast(rop)->op_; + + // bugs in SUIF prevent use of correct io_mod + instruction *ins = new in_rrr(io_rem, type_s32, operand(), op1, op2); + + delete lop; + delete rop; + + return new CG_suifRepr(operand(ins)); +} + + +CG_outputRepr* CG_suifBuilder::CreateAnd(CG_outputRepr *lop, + CG_outputRepr *rop) const { + if (rop == NULL) + return lop; + else if (lop == NULL) + return rop; + + operand op1 = static_cast(lop)->op_; + operand op2 = static_cast(rop)->op_; + + instruction *ins = new in_rrr(io_and, op1.type(), operand(), op1, op2); + + delete lop; + delete rop; + + return new CG_suifRepr(operand(ins)); +} + + +CG_outputRepr* CG_suifBuilder::CreateGE(CG_outputRepr *lop, + CG_outputRepr *rop) const { + return CreateLE(rop, lop); +} + + +CG_outputRepr* CG_suifBuilder::CreateLE(CG_outputRepr *lop, + CG_outputRepr *rop) const { + if ( rop == NULL || lop == NULL ) { + return NULL; + } + + operand op1 = static_cast(lop)->op_; + operand op2 = static_cast(rop)->op_; + + instruction *ins = new in_rrr(io_sle, type_s32, operand(), op1, op2); + + delete lop; + delete rop; + + return new CG_suifRepr(operand(ins)); +} + + +CG_outputRepr* CG_suifBuilder::CreateEQ(CG_outputRepr *lop, + CG_outputRepr *rop) const { + if ( rop == NULL || lop == NULL ) { + return NULL; + } + + operand op1 = static_cast(lop)->op_; + operand op2 = static_cast(rop)->op_; + + instruction *ins = new in_rrr(io_seq, type_s32, operand(), op1, op2); + + delete lop; + delete rop; + + return new CG_suifRepr(operand(ins)); +} + + + +CG_outputRepr* CG_suifBuilder::StmtListAppend(CG_outputRepr *list1, + CG_outputRepr *list2) const { + if ( list2 == NULL ) { + return list1; + } + else if ( list1 == NULL ) { + return list2; + } + + tree_node_list *tnl1 = static_cast(list1)->tnl_; + tree_node_list *tnl2 = static_cast(list2)->tnl_; + if (tnl2 == NULL) + tnl1->append(new tree_instr(static_cast(list2)->op_.instr())); + else + tnl1->append(tnl2); + + delete list2; + + return list1; +} + +//protonu--Gabe's stuff added here +//----------------------------------------------------------------------------- +// pragma generation +// TODO: Could allow for a immed_list* instead of a String for strongly typed prgma args +//----------------------------------------------------------------------------- +CG_outputRepr* CG_suifBuilder::CreatePragma(int, + const std::string &pragmaText) const { + if ( pragmaText == std::string("") ) { + return NULL; + } + instruction *ins = new in_rrr(io_mrk); + immed_list *iml = new immed_list; + iml->append(immed(const_cast(pragmaText.c_str()))); + ins->append_annote(k_s2c_pragma, iml); + tree_node_list *tnl = new tree_node_list; + tnl->append(new tree_instr(ins)); + return new CG_suifRepr(tnl); +} + +CG_outputRepr* CG_suifBuilder::CreateDim3(immed varName, immed arg1, immed arg2) const { + instruction *ins = new in_rrr(io_mrk); + immed_list *iml = new immed_list; + iml->append(immed(varName)); + iml->append(arg1); + iml->append(arg2); + ins->append_annote(k_cuda_dim3, iml); + tree_node_list *tnl = new tree_node_list; + tnl->append(new tree_instr(ins)); + return new CG_suifRepr(tnl); +} + +CG_outputRepr* CG_suifBuilder::CreateDim3(immed varName, immed arg1, immed arg2, immed arg3) const { + instruction *ins = new in_rrr(io_mrk); + immed_list *iml = new immed_list; + iml->append(immed(varName)); + iml->append(arg1); + iml->append(arg2); + iml->append(arg3); + ins->append_annote(k_cuda_dim3, iml); + tree_node_list *tnl = new tree_node_list; + tnl->append(new tree_instr(ins)); + return new CG_suifRepr(tnl); +} + +CG_outputRepr* CG_suifBuilder::CreateKernel(immed_list* iml) const { + instruction *ins = new in_rrr(io_mrk); + ins->append_annote(k_cuda_kernel, iml); + tree_node_list *tnl = new tree_node_list; + tnl->append(new tree_instr(ins)); + return new CG_suifRepr(tnl); +} + +type_node* CG_suifBuilder::ModifyType(type_node* base, const char* modifier) const { + modifier_type* result = new modifier_type(TYPE_NULL, base); + immed_list *iml = new immed_list; + iml->append(immed((char*)modifier)); + result->append_annote(k_cuda_modifier, iml); + return result; +} +//end-protonu + + +//----------------------------------------------------------------------------- +// suif utility +//----------------------------------------------------------------------------- + +bool substitute(instruction *in, var_sym *sym, operand expr, base_symtab *st) { + if (in == NULL || sym == NULL) + return false; + + bool r = false; + for (unsigned i = 0; i < in->num_srcs(); i++) { + operand op(in->src_op(i)); + + if (op.is_symbol() && op.symbol() == sym) { + in->set_src_op(i, expr.clone(st)); + r = true; + } + else if (op.is_instr()) { + r = substitute(op.instr(), sym, expr, st) || r; + } + } + + return r; +} + +bool substitute(tree_node *tn, var_sym *sym, operand expr, base_symtab *st) { + if (tn == NULL) + return false; + + bool r = false; + if (tn->kind() == TREE_INSTR) + r = substitute(static_cast(tn)->instr(), sym, expr, st) || r; + else { + for (unsigned i = 0; i < tn->num_child_lists(); i++) { + r = substitute(tn->child_list_num(i), sym, expr, st) || r; + } + } + + return r; +} + +bool substitute(tree_node_list *tnl, var_sym *sym, operand expr, + base_symtab *st) { + if (tnl == NULL) + return false; + + bool r = false; + tree_node_list_iter iter(tnl); + while (!iter.is_empty()) { + tree_node *tn = iter.step(); + + r = substitute(tn, sym, expr, st) || r; + } + + return r; +} + +} diff --git a/omegalib/code_gen/src/CG_suifRepr.cc b/omegalib/code_gen/src/CG_suifRepr.cc new file mode 100644 index 0000000..f4f987d --- /dev/null +++ b/omegalib/code_gen/src/CG_suifRepr.cc @@ -0,0 +1,81 @@ +/***************************************************************************** + Copyright (C) 2008 University of Southern California. + All Rights Reserved. + + Purpose: + omega holder for suif implementaion + + Notes: + + History: + 02/01/06 - Chun Chen - created +*****************************************************************************/ + +#include +#include + +namespace omega { + +CG_suifRepr::CG_suifRepr(): tnl_(NULL), op_() { +} + +CG_suifRepr::CG_suifRepr(tree_node_list *tnl): tnl_(tnl),op_() { +} + +CG_suifRepr::CG_suifRepr(operand op): tnl_(NULL), op_(op) { +} + +CG_suifRepr::~CG_suifRepr() { + // delete nothing here. operand or tree_node_list should already be + // grafted to other expression tree or statement list +} + +CG_outputRepr* CG_suifRepr::clone() { + if (!op_.is_null() ) { + operand op = op_.clone(); + return new CG_suifRepr(op); + } + else if (tnl_ != NULL) { + tree_node_list *tnl = tnl_->clone(); + return new CG_suifRepr(tnl); + } + else + return new CG_suifRepr(); +} + +void CG_suifRepr::clear() { + if (!op_.is_null()) { + if (op_.is_instr()) + delete op_.instr(); + op_.set_null(); + } + else if (tnl_ != NULL) { + delete tnl_; + tnl_ = NULL; + } +} + +tree_node_list* CG_suifRepr::GetCode() const { + return tnl_; +} + +operand CG_suifRepr::GetExpression() const { + return op_; +} + +void CG_suifRepr::Dump() const { + if (tnl_ != NULL) + tnl_->print(); + else if (!op_.is_null()) + op_.print(); +} + +void CG_suifRepr::DumpToFile(FILE *fp) const { + if (tnl_ != NULL) + tnl_->print(fp); + else if (!op_.is_null()) + op_.print(fp); +} + + +} // namespace diff --git a/omegalib/code_gen/src/CG_utils.cc b/omegalib/code_gen/src/CG_utils.cc new file mode 100755 index 0000000..d3a5f71 --- /dev/null +++ b/omegalib/code_gen/src/CG_utils.cc @@ -0,0 +1,1735 @@ +/***************************************************************************** + Copyright (C) 1994-2000 the Omega Project Team + Copyright (C) 2005-2011 Chun Chen + All Rights Reserved. + + Purpose: + Utility functions for processing CG tree. + + Notes: + + History: + 07/19/07 when generating output variable substitutions for a mapping + relation, map it to each output to get correct equality, -chun + 07/29/10 when translating equality to assignment, generate appropriate + if-condition when necesssary, -chun +*****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include + +namespace omega { + +int checkLoopLevel; +int stmtForLoopCheck; +int upperBoundForLevel; +int lowerBoundForLevel; +bool fillInBounds; + +//trick to static init checkLoopLevel to 0 +class JunkStaticInit{ public: JunkStaticInit(){ checkLoopLevel=0; fillInBounds=false;} }; +static JunkStaticInit junkInitInstance__; + + + + +namespace { + +Relation find_best_guard(const Relation &R, const BoolSet<> &active, const std::map &guards) { + std::pair best_cost = std::make_pair(0, 0); + Relation best_cond = Relation::True(R.n_set()); + + Relation r = copy(R); + int max_iter_count = 2*(r.single_conjunct()->n_EQs()) + r.single_conjunct()->n_GEQs(); + int iter_count = 0; + while (!r.is_obvious_tautology()) { + std::pair cost = std::make_pair(0, 0); + Relation cond = pick_one_guard(r); + Relation complement_cond = Complement(copy(cond)); + complement_cond.simplify(); + for (BoolSet<>::const_iterator i = active.begin(); i != active.end(); i++) { + std::map::const_iterator j = guards.find(*i); + if (j == guards.end()) + continue; + if (Must_Be_Subset(copy(j->second), copy(cond))) + cost.first++; + else if (Must_Be_Subset(copy(j->second), copy(complement_cond))) + cost.second++; + } + if (cost > best_cost) { + best_cost = cost; + best_cond = copy(cond); + } + r = Gist(r, cond, 1); + + if (iter_count > max_iter_count) + throw codegen_error("guard condition too complex to handle"); + + iter_count++; + } + + return best_cond; +} + + +Relation find_best_guard(const Relation &R, const std::vector &loops, int start, int end) { + std::pair best_cost = std::make_pair(0, 0); + Relation best_cond = Relation::True(R.n_set()); + + Relation r = copy(R); + int max_iter_count = 2*(r.single_conjunct()->n_EQs()) + r.single_conjunct()->n_GEQs(); + int iter_count = 0; + while (!r.is_obvious_tautology()) { + std::pair cost = std::make_pair(0, 0); + Relation cond = pick_one_guard(r); + int i = start; + for ( ; i < end; i++) { + if (Must_Be_Subset(copy(loops[i]->guard_), copy(cond))) + cost.first++; + else + break; + } + Relation complement_cond = Complement(copy(cond)); + complement_cond.simplify(); + for (int j = i; j < end; j++) + if (Must_Be_Subset(copy(loops[j]->guard_), copy(complement_cond))) + cost.second++; + else + break; + + if (cost > best_cost) { + best_cost = cost; + best_cond = copy(cond); + } + r = Gist(r, cond, 1); + + if (iter_count > max_iter_count) + throw codegen_error("guard condition too complex to handle"); + + iter_count++; + } + + return best_cond; +} + +} + +bool bound_must_hit_stride(const GEQ_Handle &inequality, Variable_ID v, const EQ_Handle &stride_eq, Variable_ID wc, const Relation &bounds, const Relation &known) { + assert(inequality.get_coef(v) != 0 && abs(stride_eq.get_coef(v)) == 1 && wc->kind() == Wildcard_Var && abs(stride_eq.get_coef(wc)) > 1); + + // if bound expression uses floor operation, bail out for now + // TODO: in the future, handle this + if (abs(inequality.get_coef(v)) != 1) + return false; + + coef_t stride = abs(stride_eq.get_coef(wc)); + + Relation r1(known.n_set()); + F_Exists *f_exists1 = r1.add_and()->add_exists(); + F_And *f_root1 = f_exists1->add_and(); + std::map exists_mapping1; + EQ_Handle h1 = f_root1->add_EQ(); + Relation r2(known.n_set()); + F_Exists *f_exists2 = r2.add_and()->add_exists(); + F_And *f_root2 = f_exists2->add_and(); + std::map exists_mapping2; + EQ_Handle h2 = f_root2->add_EQ(); + for (Constr_Vars_Iter cvi(inequality); cvi; cvi++) { + Variable_ID v = cvi.curr_var(); + switch (v->kind()) { + case Input_Var: + h1.update_coef(r1.input_var(v->get_position()), cvi.curr_coef()); + h2.update_coef(r2.input_var(v->get_position()), cvi.curr_coef()); + break; + case Global_Var: { + Global_Var_ID g = v->get_global_var(); + Variable_ID v1, v2; + if (g->arity() == 0) { + v1 = r1.get_local(g); + v2 = r2.get_local(g); + } + else { + v1 = r1.get_local(g, v->function_of()); + v2 = r2.get_local(g, v->function_of()); + } + h1.update_coef(v1, cvi.curr_coef()); + h2.update_coef(v2, cvi.curr_coef()); + break; + } + case Wildcard_Var: { + Variable_ID v1 = replicate_floor_definition(bounds, v, r1, f_exists1, f_root1, exists_mapping1); + Variable_ID v2 = replicate_floor_definition(bounds, v, r2, f_exists2, f_root2, exists_mapping2); + h1.update_coef(v1, cvi.curr_coef()); + h2.update_coef(v2, cvi.curr_coef()); + break; + } + default: + assert(false); + } + } + h1.update_const(inequality.get_const()); + h1.update_coef(f_exists1->declare(), stride); + h2.update_const(inequality.get_const()); + r1.simplify(); + r2.simplify(); + + Relation all_known = Intersection(copy(bounds), copy(known)); + all_known.simplify(); + + if (Gist(r1, copy(all_known), 1).is_obvious_tautology()) { + Relation r3(known.n_set()); + F_Exists *f_exists3 = r3.add_and()->add_exists(); + F_And *f_root3 = f_exists3->add_and(); + std::map exists_mapping3; + EQ_Handle h3 = f_root3->add_EQ(); + for (Constr_Vars_Iter cvi(stride_eq); cvi; cvi++) { + Variable_ID v= cvi.curr_var(); + switch (v->kind()) { + case Input_Var: + h3.update_coef(r3.input_var(v->get_position()), cvi.curr_coef()); + break; + case Global_Var: { + Global_Var_ID g = v->get_global_var(); + Variable_ID v3; + if (g->arity() == 0) + v3 = r3.get_local(g); + else + v3 = r3.get_local(g, v->function_of()); + h3.update_coef(v3, cvi.curr_coef()); + break; + } + case Wildcard_Var: + if (v == wc) + h3.update_coef(f_exists3->declare(), cvi.curr_coef()); + else { + Variable_ID v3 = replicate_floor_definition(bounds, v, r3, f_exists3, f_root3, exists_mapping3); + h3.update_coef(v3, cvi.curr_coef()); + } + break; + default: + assert(false); + } + } + h3.update_const(stride_eq.get_const()); + r3.simplify(); + + if (Gist(r3, Intersection(r2, all_known), 1).is_obvious_tautology()) + return true; + else + return false; + } + else + return false; +} + + +// +// output variable by its name, however if this variable need to be substituted, +// return the substitution. +// +CG_outputRepr *output_ident(CG_outputBuilder *ocg, const Relation &R, Variable_ID v, const std::vector > &assigned_on_the_fly) { + const_cast(R).setup_names(); // hack + + if (v->kind() == Input_Var) { + int pos = v->get_position(); + if (assigned_on_the_fly[pos-1].first != NULL) + return assigned_on_the_fly[pos-1].first->clone(); + else + return ocg->CreateIdent(v->name()); + } + else if (v->kind() == Global_Var) { + if (v->get_global_var()->arity() == 0) + return ocg->CreateIdent(v->name()); + else { + /* This should be improved to take into account the possible elimination + of the set variables. */ + int arity = v->get_global_var()->arity(); + std::vector argList; + for(int i = 1; i <= arity; i++) + argList.push_back(ocg->CreateIdent(const_cast(R).input_var(i)->name())); + CG_outputRepr *call = ocg->CreateInvoke(v->get_global_var()->base_name(), argList); + return call; + } + } + else + assert(false); +} + + +// +// return pair > +// +std::pair > output_assignment(CG_outputBuilder *ocg, const Relation &R, int level, const Relation &known, const std::vector > &assigned_on_the_fly) { + Variable_ID v = const_cast(R).set_var(level); + Conjunct *c = const_cast(R).single_conjunct(); + + std::pair result = find_simplest_assignment(R, v, assigned_on_the_fly); + + if (result.second == INT_MAX) + return std::make_pair(static_cast(NULL), std::make_pair(static_cast(NULL), INT_MAX)); + + CG_outputRepr *if_repr = NULL; + CG_outputRepr *assign_repr = NULL; + // check whether to generate if-conditions from equality constraints + if (abs(result.first.get_coef(v)) != 1) { + Relation r(R.n_set()); + F_Exists *f_exists = r.add_and()->add_exists(); + F_And *f_root = f_exists->add_and(); + std::map exists_mapping; + exists_mapping[v] = f_exists->declare(); + + EQ_Handle h = f_root->add_EQ(); + for (Constr_Vars_Iter cvi(result.first); cvi; cvi++) + switch (cvi.curr_var()->kind()) { + case Input_Var: { + if (cvi.curr_var() == v) + h.update_coef(exists_mapping[v], cvi.curr_coef()); + else + h.update_coef(r.set_var(cvi.curr_var()->get_position()), cvi.curr_coef()); + break; + } + case Global_Var: { + Global_Var_ID g = cvi.curr_var()->get_global_var(); + Variable_ID v2; + if (g->arity() == 0) + v2 = r.get_local(g); + else + v2 = r.get_local(g, cvi.curr_var()->function_of()); + h.update_coef(v2, cvi.curr_coef()); + break; + } + case Wildcard_Var: { + std::map::iterator p = exists_mapping.find(cvi.curr_var()); + Variable_ID v2; + if (p == exists_mapping.end()) { + v2 = f_exists->declare(); + exists_mapping[cvi.curr_var()] = v2; + } + else + v2 = p->second; + h.update_coef(v2, cvi.curr_coef()); + break; + } + default: + assert(0); + } + h.update_const(result.first.get_const()); + + for (EQ_Iterator e(c->EQs()); e; e++) + if (!((*e) == result.first)) { + EQ_Handle h = f_root->add_EQ(); + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) + switch (cvi.curr_var()->kind()) { + case Input_Var: { + assert(cvi.curr_var() != v); + h.update_coef(r.set_var(cvi.curr_var()->get_position()), cvi.curr_coef()); + break; + } + case Global_Var: { + Global_Var_ID g = cvi.curr_var()->get_global_var(); + Variable_ID v2; + if (g->arity() == 0) + v2 = r.get_local(g); + else + v2 = r.get_local(g, cvi.curr_var()->function_of()); + h.update_coef(v2, cvi.curr_coef()); + break; + } + case Wildcard_Var: { + std::map::iterator p = exists_mapping.find(cvi.curr_var()); + Variable_ID v2; + if (p == exists_mapping.end()) { + v2 = f_exists->declare(); + exists_mapping[cvi.curr_var()] = v2; + } + else + v2 = p->second; + h.update_coef(v2, cvi.curr_coef()); + break; + } + default: + assert(0); + } + h.update_const((*e).get_const()); + } + + for (GEQ_Iterator e(c->GEQs()); e; e++) { + GEQ_Handle h = f_root->add_GEQ(); + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) + switch (cvi.curr_var()->kind()) { + case Input_Var: { + h.update_coef(r.set_var(cvi.curr_var()->get_position()), cvi.curr_coef()); + break; + } + case Global_Var: { + Global_Var_ID g = cvi.curr_var()->get_global_var(); + Variable_ID v2; + if (g->arity() == 0) + v2 = r.get_local(g); + else + v2 = r.get_local(g, cvi.curr_var()->function_of()); + h.update_coef(v2, cvi.curr_coef()); + break; + } + case Wildcard_Var: { + std::map::iterator p = exists_mapping.find(cvi.curr_var()); + Variable_ID v2; + if (p == exists_mapping.end()) { + v2 = f_exists->declare(); + exists_mapping[cvi.curr_var()] = v2; + } + else + v2 = p->second; + h.update_coef(v2, cvi.curr_coef()); + break; + } + default: + assert(0); + } + h.update_const((*e).get_const()); + } + + r.simplify(); + if (!Gist(r, copy(known), 1).is_obvious_tautology()) { + CG_outputRepr *lhs = output_substitution_repr(ocg, result.first, v, false, R, assigned_on_the_fly); + if_repr = ocg->CreateEQ(ocg->CreateIntegerMod(lhs->clone(), ocg->CreateInt(abs(result.first.get_coef(v)))), ocg->CreateInt(0)); + assign_repr = ocg->CreateDivide(lhs, ocg->CreateInt(abs(result.first.get_coef(v)))); + } + else + assign_repr = output_substitution_repr(ocg, result.first, v, true, R, assigned_on_the_fly); + } + else + assign_repr = output_substitution_repr(ocg, result.first, v, true, R, assigned_on_the_fly); + + if (assign_repr == NULL) + assign_repr = ocg->CreateInt(0); + + return std::make_pair(if_repr, std::make_pair(assign_repr, result.second)); +} + + +// +// return NULL if 0 +// +CG_outputRepr *output_substitution_repr(CG_outputBuilder *ocg, const EQ_Handle &equality, Variable_ID v, bool apply_v_coef, const Relation &R, const std::vector > &assigned_on_the_fly) { + const_cast(R).setup_names(); // hack + + coef_t a = equality.get_coef(v); + assert(a != 0); + + CG_outputRepr *repr = NULL; + for (Constr_Vars_Iter cvi(equality); cvi; cvi++) + if (cvi.curr_var() != v) { + CG_outputRepr *t; + if (cvi.curr_var()->kind() == Wildcard_Var) { + std::pair result = find_floor_definition(R, cvi.curr_var()); + if (!result.first) { + delete repr; + throw codegen_error("can't output non floor defined wildcard"); + } + t = output_inequality_repr(ocg, result.second, cvi.curr_var(), R, assigned_on_the_fly); + } + else + t = output_ident(ocg, R, cvi.curr_var(), assigned_on_the_fly); + coef_t coef = cvi.curr_coef(); + + if (a > 0) { + if (coef > 0) { + if (coef == 1) + repr = ocg->CreateMinus(repr, t); + else + repr = ocg->CreateMinus(repr, ocg->CreateTimes(ocg->CreateInt(coef), t)); + } + else { // coef < 0 + if (coef == -1) + repr = ocg->CreatePlus(repr, t); + else + repr = ocg->CreatePlus(repr, ocg->CreateTimes(ocg->CreateInt(-coef), t)); + } + } + else { + if (coef > 0) { + if (coef == 1) + repr = ocg->CreatePlus(repr, t); + else + repr = ocg->CreatePlus(repr, ocg->CreateTimes(ocg->CreateInt(coef), t)); + } + else { // coef < 0 + if (coef == -1) + repr = ocg->CreateMinus(repr, t); + else + repr = ocg->CreateMinus(repr, ocg->CreateTimes(ocg->CreateInt(-coef), t)); + } + } + } + + int c = equality.get_const(); + if (a > 0) { + if (c > 0) + repr = ocg->CreateMinus(repr, ocg->CreateInt(c)); + else if (c < 0) + repr = ocg->CreatePlus(repr, ocg->CreateInt(-c)); + } + else { + if (c > 0) + repr = ocg->CreatePlus(repr, ocg->CreateInt(c)); + else if (c < 0) + repr = ocg->CreateMinus(repr, ocg->CreateInt(-c)); + } + + if (apply_v_coef && abs(a) != 1) + repr = ocg->CreateDivide(repr, ocg->CreateInt(abs(a))); + + return repr; +} + + +// +// original Substitutions class from omega can't handle integer +// division, this is new way. +// +std::vector output_substitutions(CG_outputBuilder *ocg, const Relation &R, const std::vector > &assigned_on_the_fly) { + std::vector subs; + + for (int i = 1; i <= R.n_out(); i++) { + Relation mapping(R.n_out(), 1); + F_And *f_root = mapping.add_and(); + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.output_var(1), 1); + h.update_coef(mapping.input_var(i), -1); + Relation r = Composition(mapping, copy(R)); + r.simplify(); + + Variable_ID v = r.output_var(1); + CG_outputRepr *repr = NULL; + std::pair result = find_simplest_assignment(r, v, assigned_on_the_fly); + if (result.second < INT_MAX) + repr = output_substitution_repr(ocg, result.first, v, true, r, assigned_on_the_fly); + else { + std::pair result = find_floor_definition(R, v); + if (result.first) + try { + repr = output_inequality_repr(ocg, result.second, v, R, assigned_on_the_fly); + } + catch (const codegen_error &) { + } + } + + subs.push_back(repr); + } + + return subs; +} + + +// +// handle floor definition wildcards in equality, the second in returned pair +// is the cost. +// +std::pair find_simplest_assignment(const Relation &R, Variable_ID v, const std::vector > &assigned_on_the_fly) { + Conjunct *c = const_cast(R).single_conjunct(); + + int min_cost = INT_MAX; + EQ_Handle eq; + for (EQ_Iterator e(c->EQs()); e; e++) + if (!(*e).has_wildcards() && (*e).get_coef(v) != 0) { + int cost = 0; + + if (abs((*e).get_coef(v)) != 1) + cost += 4; // divide cost + + int num_var = 0; + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) + if (cvi.curr_var() != v) { + num_var++; + if (abs(cvi.curr_coef()) != 1) + cost += 2; // multiply cost + if (cvi.curr_var()->kind() == Global_Var && cvi.curr_var()->get_global_var()->arity() > 0) + cost += 10; // function cost + else if (cvi.curr_var()->kind() == Input_Var && + assigned_on_the_fly.size() >= cvi.curr_var()->get_position() && + assigned_on_the_fly[cvi.curr_var()->get_position()-1].first != NULL) + cost += assigned_on_the_fly[cvi.curr_var()->get_position()-1].second; // substitution cost on record + } + if ((*e).get_const() != 0) + num_var++; + if (num_var > 1) + cost += num_var - 1; // addition cost + + if (cost < min_cost) { + min_cost = cost; + eq = *e; + } + } + + if (min_cost < INT_MAX) + return std::make_pair(eq, min_cost); + + for (EQ_Iterator e(c->EQs()); e; e++) + if ((*e).has_wildcards() && (*e).get_coef(v) != 0) { + bool is_assignment = true; + for (Constr_Vars_Iter cvi(*e, true); cvi; cvi++) { + std::pair result = find_floor_definition(R, v); + if (!result.first) { + is_assignment = false; + break; + } + } + if (!is_assignment) + continue; + + int cost = 0; + + if (abs((*e).get_coef(v)) != 1) + cost += 4; // divide cost + + int num_var = 0; + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) + if (cvi.curr_var() != v) { + num_var++; + if (abs(cvi.curr_coef()) != 1) + cost += 2; // multiply cost + if (cvi.curr_var()->kind() == Wildcard_Var) + cost += 10; // floor operation cost + else if (cvi.curr_var()->kind() == Global_Var && cvi.curr_var()->get_global_var()->arity() > 0) + cost += 20; // function cost + else if (cvi.curr_var()->kind() == Input_Var && + assigned_on_the_fly.size() >= cvi.curr_var()->get_position() && + assigned_on_the_fly[cvi.curr_var()->get_position()-1].first != NULL) + cost += assigned_on_the_fly[cvi.curr_var()->get_position()-1].second; // substitution cost on record + } + if ((*e).get_const() != 0) + num_var++; + if (num_var > 1) + cost += num_var - 1; // addition cost + + if (cost < min_cost) { + min_cost = cost; + eq = *e; + } + } + + return std::make_pair(eq, min_cost); +} + + +// +// find floor definition for variable v, e.g. m-c <= 4v <= m, (c is +// constant and 0 <= c < 4). this translates to v = floor(m, 4) and +// return 4v<=m in this case. All wildcards in such inequality are +// also floor defined. +// +std::pair find_floor_definition(const Relation &R, Variable_ID v, std::set excluded_floor_vars) { + Conjunct *c = const_cast(R).single_conjunct(); + + excluded_floor_vars.insert(v); + for (GEQ_Iterator e = c->GEQs(); e; e++) { + coef_t a = (*e).get_coef(v); + if (a >= -1) + continue; + a = -a; + + bool interested = true; + for (std::set::const_iterator i = excluded_floor_vars.begin(); i != excluded_floor_vars.end(); i++) + if ((*i) != v && (*e).get_coef(*i) != 0) { + interested = false; + break; + } + if (!interested) + continue; + + // check if any wildcard is floor defined + bool has_undefined_wc = false; + for (Constr_Vars_Iter cvi(*e, true); cvi; cvi++) + if (excluded_floor_vars.find(cvi.curr_var()) == excluded_floor_vars.end()) { + std::pair result = find_floor_definition(R, cvi.curr_var(), excluded_floor_vars); + if (!result.first) { + has_undefined_wc = true; + break; + } + } + if (has_undefined_wc) + continue; + + // find the matching upper bound for floor definition + for (GEQ_Iterator e2 = c->GEQs(); e2; e2++) + if ((*e2).get_coef(v) == a && (*e).get_const() + (*e2).get_const() < a) { + bool match = true; + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) + if ((*e2).get_coef(cvi.curr_var()) != -cvi.curr_coef()) { + match = false; + break; + } + if (!match) + continue; + for (Constr_Vars_Iter cvi(*e2); cvi; cvi++) + if ((*e).get_coef(cvi.curr_var()) != -cvi.curr_coef()) { + match = false; + break; + } + if (match) + return std::make_pair(true, *e); + } + } + + return std::make_pair(false, GEQ_Handle()); +} + +// +// find the stride involving the specified variable, the stride +// equality can have other wildcards as long as they are defined as +// floor variables. +// +std::pair find_simplest_stride(const Relation &R, Variable_ID v) { + int best_num_var = INT_MAX; + coef_t best_coef; + EQ_Handle best_eq; + Variable_ID best_stride_wc; + for (EQ_Iterator e(const_cast(R).single_conjunct()->EQs()); e; e++) + if ((*e).has_wildcards() && (*e).get_coef(v) != 0) { + bool is_stride = true; + bool found_free = false; + int num_var = 0; + int num_floor = 0; + Variable_ID stride_wc; + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) { + switch (cvi.curr_var()->kind()) { + case Wildcard_Var: { + bool is_free = true; + for (GEQ_Iterator e2(const_cast(R).single_conjunct()->GEQs()); e2; e2++) + if ((*e2).get_coef(cvi.curr_var()) != 0) { + is_free = false; + break; + } + if (is_free) { + if (found_free) + is_stride = false; + else { + found_free = true; + stride_wc = cvi.curr_var(); + } + } + else { + std::pair result = find_floor_definition(R, cvi.curr_var()); + if (result.first) + num_floor++; + else + is_stride = false; + } + break; + } + case Input_Var: + num_var++; + break; + default: + ; + } + + if (!is_stride) + break; + } + + if (is_stride) { + coef_t coef = abs((*e).get_coef(v)); + if (best_num_var == INT_MAX || coef < best_coef || + (coef == best_coef && num_var < best_num_var)) { + best_coef = coef; + best_num_var = num_var; + best_eq = *e; + best_stride_wc = stride_wc; + } + } + } + + if (best_num_var != INT_MAX) + return std::make_pair(best_eq, best_stride_wc); + else + return std::make_pair(EQ_Handle(), static_cast(NULL)); +} + +// +// convert relation to if-condition +// +CG_outputRepr *output_guard(CG_outputBuilder *ocg, const Relation &R, const std::vector > &assigned_on_the_fly) { + assert(R.n_out()==0); + + CG_outputRepr *result = NULL; + Conjunct *c = const_cast(R).single_conjunct(); + + // e.g. 4i=5*j + for (EQ_Iterator e = c->EQs(); e; e++) + if (!(*e).has_wildcards()) { + CG_outputRepr *lhs = NULL; + CG_outputRepr *rhs = NULL; + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) { + CG_outputRepr *v = output_ident(ocg, R, cvi.curr_var(), assigned_on_the_fly); + coef_t coef = cvi.curr_coef(); + if (coef > 0) { + if (coef == 1) + lhs = ocg->CreatePlus(lhs, v); + else + lhs = ocg->CreatePlus(lhs, ocg->CreateTimes(ocg->CreateInt(coef), v)); + } + else { // coef < 0 + if (coef == -1) + rhs = ocg->CreatePlus(rhs, v); + else + rhs = ocg->CreatePlus(rhs, ocg->CreateTimes(ocg->CreateInt(-coef), v)); + } + } + coef_t c = (*e).get_const(); + + CG_outputRepr *term; + if (lhs == NULL) + term = ocg->CreateEQ(rhs, ocg->CreateInt(c)); + else { + if (c > 0) + rhs = ocg->CreateMinus(rhs, ocg->CreateInt(c)); + else if (c < 0) + rhs = ocg->CreatePlus(rhs, ocg->CreateInt(-c)); + else if (rhs == NULL) + rhs = ocg->CreateInt(0); + term = ocg->CreateEQ(lhs, rhs); + } + result = ocg->CreateAnd(result, term); + } + + // e.g. i>5j + for (GEQ_Iterator e = c->GEQs(); e; e++) + if (!(*e).has_wildcards()) { + CG_outputRepr *lhs = NULL; + CG_outputRepr *rhs = NULL; + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) { + CG_outputRepr *v = output_ident(ocg, R, cvi.curr_var(), assigned_on_the_fly); + coef_t coef = cvi.curr_coef(); + if (coef > 0) { + if (coef == 1) + lhs = ocg->CreatePlus(lhs, v); + else + lhs = ocg->CreatePlus(lhs, ocg->CreateTimes(ocg->CreateInt(coef), v)); + } + else { // coef < 0 + if (coef == -1) + rhs = ocg->CreatePlus(rhs, v); + else + rhs = ocg->CreatePlus(rhs, ocg->CreateTimes(ocg->CreateInt(-coef), v)); + } + } + coef_t c = (*e).get_const(); + + CG_outputRepr *term; + if (lhs == NULL) + term = ocg->CreateLE(rhs, ocg->CreateInt(c)); + else { + if (c > 0) + rhs = ocg->CreateMinus(rhs, ocg->CreateInt(c)); + else if (c < 0) + rhs = ocg->CreatePlus(rhs, ocg->CreateInt(-c)); + else if (rhs == NULL) + rhs = ocg->CreateInt(0); + term = ocg->CreateGE(lhs, rhs); + } + result = ocg->CreateAnd(result, term); + } + + // e.g. 4i=5j+4alpha + for (EQ_Iterator e = c->EQs(); e; e++) + if ((*e).has_wildcards()) { + Variable_ID wc; + int num_wildcard = 0; + int num_positive = 0; + int num_negative = 0; + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) { + if (cvi.curr_var()->kind() == Wildcard_Var) { + num_wildcard++; + wc = cvi.curr_var(); + } + else { + if (cvi.curr_coef() > 0) + num_positive++; + else + num_negative++; + } + } + + if (num_wildcard > 1) { + delete result; + throw codegen_error("Can't generate equality condition with multiple wildcards"); + } + int sign = (num_positive>=num_negative)?1:-1; + + CG_outputRepr *lhs = NULL; + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) { + if (cvi.curr_var() != wc) { + CG_outputRepr *v = output_ident(ocg, R, cvi.curr_var(), assigned_on_the_fly); + coef_t coef = cvi.curr_coef(); + if (sign == 1) { + if (coef > 0) { + if (coef == 1) + lhs = ocg->CreatePlus(lhs, v); + else + lhs = ocg->CreatePlus(lhs, ocg->CreateTimes(ocg->CreateInt(coef), v)); + } + else { // coef < 0 + if (coef == -1) + lhs = ocg->CreateMinus(lhs, v); + else + lhs = ocg->CreateMinus(lhs, ocg->CreateTimes(ocg->CreateInt(-coef), v)); + } + } + else { + if (coef > 0) { + if (coef == 1) + lhs = ocg->CreateMinus(lhs, v); + else + lhs = ocg->CreateMinus(lhs, ocg->CreateTimes(ocg->CreateInt(coef), v)); + } + else { // coef < 0 + if (coef == -1) + lhs = ocg->CreatePlus(lhs, v); + else + lhs = ocg->CreatePlus(lhs, ocg->CreateTimes(ocg->CreateInt(-coef), v)); + } + } + } + } + coef_t c = (*e).get_const(); + if (sign == 1) { + if (c > 0) + lhs = ocg->CreatePlus(lhs, ocg->CreateInt(c)); + else if (c < 0) + lhs = ocg->CreateMinus(lhs, ocg->CreateInt(-c)); + } + else { + if (c > 0) + lhs = ocg->CreateMinus(lhs, ocg->CreateInt(c)); + else if (c < 0) + lhs = ocg->CreatePlus(lhs, ocg->CreateInt(-c)); + } + + lhs = ocg->CreateIntegerMod(lhs, ocg->CreateInt(abs((*e).get_coef(wc)))); + CG_outputRepr *term = ocg->CreateEQ(lhs, ocg->CreateInt(0)); + result = ocg->CreateAnd(result, term); + } + + // e.g. 4alpha<=i<=5alpha + for (GEQ_Iterator e = c->GEQs(); e; e++) + if ((*e).has_wildcards()) { + Variable_ID wc; + int num_wildcard = 0; + for (Constr_Vars_Iter cvi(*e, true); cvi; cvi++) + if (num_wildcard == 0) { + wc = cvi.curr_var(); + num_wildcard = 1; + } + else + num_wildcard++; + + if (num_wildcard > 1) { + delete result; + // e.g. c*alpha - x >= 0 (*) + // -d*alpha + y >= 0 (*) + // e1*alpha + f1*beta + g1 >= 0 (**) + // e2*alpha + f2*beta + g2 >= 0 (**) + // ... + // TODO: should generate a testing loop for alpha using its lower and + // upper bounds from (*) constraints and do the same if-condition test + // for beta from each pair of opposite (**) constraints as above, + // and exit the loop when if-condition satisfied. + throw codegen_error("Can't generate multiple wildcard GEQ guards right now"); + } + + coef_t c = (*e).get_coef(wc); + int sign = (c>0)?1:-1; + + GEQ_Iterator e2 = e; + e2++; + for ( ; e2; e2++) { + coef_t c2 = (*e2).get_coef(wc); + if (c2 == 0) + continue; + int sign2 = (c2>0)?1:-1; + if (sign != -sign2) + continue; + int num_wildcard2 = 0; + for (Constr_Vars_Iter cvi(*e2, true); cvi; cvi++) + num_wildcard2++; + if (num_wildcard2 > 1) + continue; + + GEQ_Handle lb, ub; + if (sign == 1) { + lb = (*e); + ub = (*e2); + } + else { + lb = (*e2); + ub = (*e); + } + + CG_outputRepr *lhs = NULL; + for (Constr_Vars_Iter cvi(lb); cvi; cvi++) + if (cvi.curr_var() != wc) { + CG_outputRepr *v = output_ident(ocg, R, cvi.curr_var(), assigned_on_the_fly); + coef_t coef = cvi.curr_coef(); + if (coef > 0) { + if (coef == 1) + lhs = ocg->CreateMinus(lhs, v); + else + lhs = ocg->CreateMinus(lhs, ocg->CreateTimes(ocg->CreateInt(coef), v)); + } + else { // coef < 0 + if (coef == -1) + lhs = ocg->CreatePlus(lhs, v); + else + lhs = ocg->CreatePlus(lhs, ocg->CreateTimes(ocg->CreateInt(-coef), v)); + } + } + coef_t c = lb.get_const(); + if (c > 0) + lhs = ocg->CreateMinus(lhs, ocg->CreateInt(c)); + else if (c < 0) + lhs = ocg->CreatePlus(lhs, ocg->CreateInt(-c)); + + CG_outputRepr *rhs = NULL; + for (Constr_Vars_Iter cvi(ub); cvi; cvi++) + if (cvi.curr_var() != wc) { + CG_outputRepr *v = output_ident(ocg, R, cvi.curr_var(), assigned_on_the_fly); + coef_t coef = cvi.curr_coef(); + if (coef > 0) { + if (coef == 1) + rhs = ocg->CreatePlus(rhs, v); + else + rhs = ocg->CreatePlus(rhs, ocg->CreateTimes(ocg->CreateInt(coef), v)); + } + else { // coef < 0 + if (coef == -1) + rhs = ocg->CreateMinus(rhs, v); + else + rhs = ocg->CreateMinus(rhs, ocg->CreateTimes(ocg->CreateInt(-coef), v)); + } + } + c = ub.get_const(); + if (c > 0) + rhs = ocg->CreatePlus(rhs, ocg->CreateInt(c)); + else if (c < 0) + rhs = ocg->CreateMinus(rhs, ocg->CreateInt(-c)); + + rhs = ocg->CreateIntegerFloor(rhs, ocg->CreateInt(-ub.get_coef(wc))); + rhs = ocg->CreateTimes(ocg->CreateInt(lb.get_coef(wc)), rhs); + CG_outputRepr *term = ocg->CreateLE(lhs, rhs); + result = ocg->CreateAnd(result, term); + } + } + + return result; +} + + +// +// return NULL if 0 +// +CG_outputRepr *output_inequality_repr(CG_outputBuilder *ocg, const GEQ_Handle &inequality, Variable_ID v, const Relation &R, const std::vector > &assigned_on_the_fly, std::set excluded_floor_vars) { + const_cast(R).setup_names(); // hack + + coef_t a = inequality.get_coef(v); + assert(a != 0); + excluded_floor_vars.insert(v); + + CG_outputRepr *repr = NULL; + for (Constr_Vars_Iter cvi(inequality); cvi; cvi++) + if (cvi.curr_var() != v) { + CG_outputRepr *t; + if (cvi.curr_var()->kind() == Wildcard_Var) { + std::pair result = find_floor_definition(R, cvi.curr_var(), excluded_floor_vars); + if (!result.first) { + delete repr; + throw codegen_error("Can't generate bound expression with wildcard not involved in floor definition"); + } + try { + t = output_inequality_repr(ocg, result.second, cvi.curr_var(), R, assigned_on_the_fly, excluded_floor_vars); + } + catch (const std::exception &e) { + delete repr; + throw e; + } + } + else + t = output_ident(ocg, R, cvi.curr_var(), assigned_on_the_fly); + + coef_t coef = cvi.curr_coef(); + if (a > 0) { + if (coef > 0) { + if (coef == 1) + repr = ocg->CreateMinus(repr, t); + else + repr = ocg->CreateMinus(repr, ocg->CreateTimes(ocg->CreateInt(coef), t)); + } + else { + if (coef == -1) + repr = ocg->CreatePlus(repr, t); + else + repr = ocg->CreatePlus(repr, ocg->CreateTimes(ocg->CreateInt(-coef), t)); + } + } + else { + if (coef > 0) { + if (coef == 1) + repr = ocg->CreatePlus(repr, t); + else + repr = ocg->CreatePlus(repr, ocg->CreateTimes(ocg->CreateInt(coef), t)); + } + else { + if (coef == -1) + repr = ocg->CreateMinus(repr, t); + else + repr = ocg->CreateMinus(repr, ocg->CreateTimes(ocg->CreateInt(-coef), t)); + } + } + } + coef_t c = inequality.get_const(); + if (c > 0) { + if (a > 0) + repr = ocg->CreateMinus(repr, ocg->CreateInt(c)); + else + repr = ocg->CreatePlus(repr, ocg->CreateInt(c)); + } + else if (c < 0) { + if (a > 0) + repr = ocg->CreatePlus(repr, ocg->CreateInt(-c)); + else + repr = ocg->CreateMinus(repr, ocg->CreateInt(-c)); + } + + if (abs(a) == 1) + return repr; + else if (a > 0) + return ocg->CreateIntegerCeil(repr, ocg->CreateInt(a)); + else // a < 0 + return ocg->CreateIntegerFloor(repr, ocg->CreateInt(-a)); +} + + +// +// nothing special, just an alias +// +CG_outputRepr *output_upper_bound_repr(CG_outputBuilder *ocg, const GEQ_Handle &inequality, Variable_ID v, const Relation &R, const std::vector > &assigned_on_the_fly) { + assert(inequality.get_coef(v) < 0); + CG_outputRepr* zero_; + + zero_ = output_inequality_repr(ocg, inequality, v, R, assigned_on_the_fly); + + if(!zero_) + zero_ = ocg->CreateInt(0); + + return zero_; + +} + + +// +// output lower bound with respect to lattice +// +CG_outputRepr *output_lower_bound_repr(CG_outputBuilder *ocg, const GEQ_Handle &inequality, Variable_ID v, const EQ_Handle &stride_eq, Variable_ID wc, const Relation &R, const Relation &known, const std::vector > &assigned_on_the_fly) { + assert(inequality.get_coef(v) > 0); + CG_outputRepr* zero_; + if (wc == NULL || bound_must_hit_stride(inequality, v, stride_eq, wc, R, known)){ + zero_ = output_inequality_repr(ocg, inequality, v, R, assigned_on_the_fly); + if(!zero_) + zero_ = ocg->CreateInt(0); + + return zero_; + } + CG_outputRepr *strideBoundRepr = NULL; + int sign = (stride_eq.get_coef(v)>0)?1:-1; + for (Constr_Vars_Iter cvi(stride_eq); cvi; cvi++) { + Variable_ID v2 = cvi.curr_var(); + if (v2 == v || v2 == wc) + continue; + + CG_outputRepr *v_repr; + if (v2->kind() == Input_Var || v2->kind() == Global_Var) + v_repr = output_ident(ocg, R, v2, assigned_on_the_fly); + else if (v2->kind() == Wildcard_Var) { + std::pair result = find_floor_definition(R, v2); + assert(result.first); + v_repr = output_inequality_repr(ocg, result.second, v2, R, assigned_on_the_fly); + } + + coef_t coef = cvi.curr_coef(); + if (sign < 0) { + if (coef > 0) { + if (coef == 1) + strideBoundRepr = ocg->CreatePlus(strideBoundRepr, v_repr); + else + strideBoundRepr = ocg->CreatePlus(strideBoundRepr, ocg->CreateTimes(ocg->CreateInt(coef), v_repr)); + } + else { // coef < 0 + if (coef == -1) + strideBoundRepr = ocg->CreateMinus(strideBoundRepr, v_repr); + else + strideBoundRepr = ocg->CreateMinus(strideBoundRepr, ocg->CreateTimes(ocg->CreateInt(-coef), v_repr)); + } + } + else { + if (coef > 0) { + if (coef == 1) + strideBoundRepr = ocg->CreateMinus(strideBoundRepr, v_repr); + else + strideBoundRepr = ocg->CreateMinus(strideBoundRepr, ocg->CreateTimes(ocg->CreateInt(coef), v_repr)); + } + else { // coef < 0 + if (coef == -1) + strideBoundRepr = ocg->CreatePlus(strideBoundRepr, v_repr); + else + strideBoundRepr = ocg->CreatePlus(strideBoundRepr, ocg->CreateTimes(ocg->CreateInt(-coef), v_repr)); + } + } + } + coef_t c = stride_eq.get_const(); + if (c > 0) { + if (sign < 0) + strideBoundRepr = ocg->CreatePlus(strideBoundRepr, ocg->CreateInt(c)); + else + strideBoundRepr = ocg->CreateMinus(strideBoundRepr, ocg->CreateInt(c)); + } + else if (c < 0) { + if (sign < 0) + strideBoundRepr = ocg->CreateMinus(strideBoundRepr, ocg->CreateInt(-c)); + else + strideBoundRepr = ocg->CreatePlus(strideBoundRepr, ocg->CreateInt(-c)); + } + + CG_outputRepr *repr = output_inequality_repr(ocg, inequality, v, R, assigned_on_the_fly); + CG_outputRepr *repr2 = ocg->CreateCopy(repr); + repr = ocg->CreatePlus(repr2, ocg->CreateIntegerMod(ocg->CreateMinus(strideBoundRepr, repr), ocg->CreateInt(abs(stride_eq.get_coef(wc))))); + + return repr; +} + + +// +// return loop control structure only +// +CG_outputRepr *output_loop(CG_outputBuilder *ocg, const Relation &R, int level, const Relation &known, const std::vector > &assigned_on_the_fly) { + std::pair result = find_simplest_stride(R, const_cast(R).set_var(level)); + if (result.second != NULL) + assert(abs(result.first.get_coef(const_cast(R).set_var(level))) == 1); + + std::vector lbList, ubList; + try { + + coef_t const_lb = negInfinity, const_ub = posInfinity; + + for (GEQ_Iterator e(const_cast(R).single_conjunct()->GEQs()); e; e++) { + coef_t coef = (*e).get_coef(const_cast(R).set_var(level)); + + if (coef > 0) { + CG_outputRepr *repr = output_lower_bound_repr(ocg, *e, const_cast(R).set_var(level), result.first, result.second, R, known, assigned_on_the_fly); + if (repr == NULL) + repr = ocg->CreateInt(0); + lbList.push_back(repr); + + if ((*e).is_const(const_cast(R).set_var(level))){ + if(!result.second) { + + //no variables but v in constr + coef_t L,m; + L = -((*e).get_const()); + + m = (*e).get_coef(const_cast(R).set_var(level)); + coef_t sb = (int) (ceil(((float) L) /m)); + set_max(const_lb, sb); + } + else{ + + coef_t L,m,s,c; + L = -((*e).get_const()); + m = (*e).get_coef(const_cast(R).set_var(level)); + s = abs(result.first.get_coef(result.second)); + c = result.first.get_const(); + coef_t sb = (s * (int) (ceil( (float) (L - (c * m)) /(s*m))))+ c; + set_max(const_lb, sb); + + } + } + + } + else if (coef < 0) { + CG_outputRepr *repr = output_upper_bound_repr(ocg, *e, const_cast(R).set_var(level), R, assigned_on_the_fly); + if (repr == NULL) + repr = ocg->CreateInt(0); + ubList.push_back(repr); + + if ((*e).is_const(const_cast(R).set_var(level))) { + // no variables but v in constraint + set_min(const_ub,-(*e).get_const()/(*e).get_coef(const_cast(R).set_var(level))); + } + + } + } + + if(fillInBounds && lbList.size() == 1 && const_lb != negInfinity) + lowerBoundForLevel = const_lb; + + if(fillInBounds && const_ub != posInfinity) + upperBoundForLevel = const_ub; + if (lbList.size() == 0) + throw codegen_error("missing lower bound at loop level " + to_string(level)); + if (ubList.size() == 0) + throw codegen_error("missing upper bound at loop level " + to_string(level)); + } + catch (const std::exception &e) { + for (int i = 0; i < lbList.size(); i++) + delete lbList[i]; + for (int i = 0; i < ubList.size(); i++) + delete ubList[i]; + throw e; + } + + CG_outputRepr *lbRepr = NULL; + if (lbList.size() > 1) + lbRepr = ocg->CreateInvoke("max", lbList); + else // (lbList.size() == 1) + lbRepr = lbList[0]; + + CG_outputRepr *ubRepr = NULL; + if (ubList.size() > 1) + ubRepr = ocg->CreateInvoke("min", ubList); + else // (ubList.size() == 1) + ubRepr = ubList[0]; + + CG_outputRepr *stRepr; + if (result.second == NULL) + stRepr = ocg->CreateInt(1); + else + stRepr = ocg->CreateInt(abs(result.first.get_coef(result.second))); + CG_outputRepr *indexRepr = output_ident(ocg, R, const_cast(R).set_var(level), assigned_on_the_fly); + return ocg->CreateInductive(indexRepr, lbRepr, ubRepr, stRepr); +} + + +// +// parameter f_root is inside f_exists, not the other way around. +// return replicated variable in new relation, with all cascaded floor definitions +// using wildcards defined in the same way as in the original relation. +// +Variable_ID replicate_floor_definition(const Relation &R, const Variable_ID floor_var, + Relation &r, F_Exists *f_exists, F_And *f_root, + std::map &exists_mapping) { + assert(R.n_out() == 0 && r.n_out() == 0 && R.n_inp() == r.n_inp()); + + std::set excluded_floor_vars; + std::stack to_fill; + to_fill.push(floor_var); + + while (!to_fill.empty()) { + Variable_ID v = to_fill.top(); + to_fill.pop(); + if (excluded_floor_vars.find(v) != excluded_floor_vars.end()) + continue; + + std::pair result = find_floor_definition(R, v, excluded_floor_vars); + assert(result.first); + excluded_floor_vars.insert(v); + + GEQ_Handle h1 = f_root->add_GEQ(); + GEQ_Handle h2 = f_root->add_GEQ(); + for (Constr_Vars_Iter cvi(result.second); cvi; cvi++) { + Variable_ID v2 = cvi.curr_var(); + switch (v2->kind()) { + case Input_Var: { + int pos = v2->get_position(); + h1.update_coef(r.input_var(pos), cvi.curr_coef()); + h2.update_coef(r.input_var(pos), -cvi.curr_coef()); + break; + } + case Wildcard_Var: { + std::map::iterator p = exists_mapping.find(v2); + Variable_ID v3; + if (p == exists_mapping.end()) { + v3 = f_exists->declare(); + exists_mapping[v2] = v3; + } + else + v3 = p->second; + h1.update_coef(v3, cvi.curr_coef()); + h2.update_coef(v3, -cvi.curr_coef()); + if (v2 != v) + to_fill.push(v2); + break; + } + case Global_Var: { + Global_Var_ID g = v2->get_global_var(); + Variable_ID v3; + if (g->arity() == 0) + v3 = r.get_local(g); + else + v3 = r.get_local(g, v2->function_of()); + h1.update_coef(v3, cvi.curr_coef()); + h2.update_coef(v3, -cvi.curr_coef()); + break; + } + default: + assert(false); + } + } + h1.update_const(result.second.get_const()); + h2.update_const(-result.second.get_const()-result.second.get_coef(v)-1); + } + + if (floor_var->kind() == Input_Var) + return r.input_var(floor_var->get_position()); + else if (floor_var->kind() == Wildcard_Var) + return exists_mapping[floor_var]; + else + assert(false); +} + + +// +// pick one guard condition from relation. it can involve multiple +// constraints when involving wildcards, as long as its complement +// is a single conjunct. +// +Relation pick_one_guard(const Relation &R, int level) { + assert(R.n_out()==0); + + Relation r = Relation::True(R.n_set()); + + for (GEQ_Iterator e(const_cast(R).single_conjunct()->GEQs()); e; e++) + if (!(*e).has_wildcards()) { + r.and_with_GEQ(*e); + r.simplify(); + r.copy_names(R); + r.setup_names(); + return r; + } + + for (EQ_Iterator e(const_cast(R).single_conjunct()->EQs()); e; e++) + if (!(*e).has_wildcards()) { + r.and_with_GEQ(*e); + r.simplify(); + r.copy_names(R); + r.setup_names(); + return r; + } + + for (EQ_Iterator e(const_cast(R).single_conjunct()->EQs()); e; e++) + if ((*e).has_wildcards()) { + int num_wildcard = 0; + int max_level = 0; + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) + switch (cvi.curr_var()->kind()) { + case Wildcard_Var: + num_wildcard++; + break; + case Input_Var: + if (cvi.curr_var()->get_position() > max_level) + max_level = cvi.curr_var()->get_position(); + break; + default: + ; + } + + if (num_wildcard == 1 && max_level != level-1) { + r.and_with_EQ(*e); + r.simplify(); + r.copy_names(R); + r.setup_names(); + return r; + } + } + + for (GEQ_Iterator e(const_cast(R).single_conjunct()->GEQs()); e; e++) + if ((*e).has_wildcards()) { + int num_wildcard = 0; + int max_level = 0; + bool direction; + Variable_ID wc; + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) + switch (cvi.curr_var()->kind()) { + case Wildcard_Var: + num_wildcard++; + wc = cvi.curr_var(); + direction = cvi.curr_coef()>0?true:false; + break; + case Input_Var: + if (cvi.curr_var()->get_position() > max_level) + max_level = cvi.curr_var()->get_position(); + break; + default: + ; + } + + if (num_wildcard == 1 && max_level != level-1) { + // find the pairing inequality + GEQ_Iterator e2 = e; + e2++; + for ( ; e2; e2++) { + int num_wildcard2 = 0; + int max_level2 = 0; + bool direction2; + Variable_ID wc2; + for (Constr_Vars_Iter cvi(*e2); cvi; cvi++) + switch (cvi.curr_var()->kind()) { + case Wildcard_Var: + num_wildcard2++; + wc2 = cvi.curr_var(); + direction2 = cvi.curr_coef()>0?true:false; + break; + case Input_Var: + if (cvi.curr_var()->get_position() > max_level2) + max_level2 = cvi.curr_var()->get_position(); + break; + default: + ; + } + + if (num_wildcard2 == 1 && max_level2 != level-1 && wc2 == wc && direction2 == not direction) { + F_Exists *f_exists = r.and_with_and()->add_exists(); + Variable_ID wc3 = f_exists->declare(); + F_And *f_root = f_exists->add_and(); + GEQ_Handle h = f_root->add_GEQ(); + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) { + switch (cvi.curr_var()->kind()) { + case Wildcard_Var: + h.update_coef(wc3, cvi.curr_coef()); + break; + case Input_Var: + h.update_coef(r.input_var(cvi.curr_var()->get_position()), cvi.curr_coef()); + break; + case Global_Var: { + Global_Var_ID g = cvi.curr_var()->get_global_var(); + Variable_ID v; + if (g->arity() == 0) + v = r.get_local(g); + else + v = r.get_local(g, cvi.curr_var()->function_of()); + h.update_coef(v, cvi.curr_coef()); + break; + } + default: + assert(false); + } + } + h.update_const((*e).get_const()); + + h = f_root->add_GEQ(); + for (Constr_Vars_Iter cvi(*e2); cvi; cvi++) { + switch (cvi.curr_var()->kind()) { + case Wildcard_Var: + h.update_coef(wc3, cvi.curr_coef()); + break; + case Input_Var: + h.update_coef(r.input_var(cvi.curr_var()->get_position()), cvi.curr_coef()); + break; + case Global_Var: { + Global_Var_ID g = cvi.curr_var()->get_global_var(); + Variable_ID v; + if (g->arity() == 0) + v = r.get_local(g); + else + v = r.get_local(g, cvi.curr_var()->function_of()); + h.update_coef(v, cvi.curr_coef()); + break; + } + default: + assert(false); + } + } + h.update_const((*e2).get_const()); + + r.simplify(); + r.copy_names(R); + r.setup_names(); + return r; + } + } + } + } +} + + +// +// heavy lifting for code output for one leaf node +// +CG_outputRepr *leaf_print_repr(BoolSet<> active, const std::map &guards, + CG_outputRepr *guard_repr, const Relation &known, + int indent, CG_outputBuilder *ocg, const std::vector &remap, + const std::vector &xforms, const std::vector &stmts, + const std::vector > &assigned_on_the_fly) { + if (active.num_elem() == 0) + return NULL; + + CG_outputRepr *stmt_list = NULL; + for (BoolSet<>::iterator i = active.begin(); i != active.end(); i++) { + std::map::const_iterator j = guards.find(*i); + if (j == guards.end() || Must_Be_Subset(copy(known), copy(j->second))) { + Relation mapping = Inverse(copy((xforms[remap[*i]]))); + mapping.simplify(); + mapping.setup_names(); + std::vector loop_vars; + for (int k = 1; k <= mapping.n_out(); k++) { + loop_vars.push_back(mapping.output_var(k)->name()); +// std::cout << "CG_Utils:: " << k << ", " << mapping.output_var(k)->name().c_str() << "\n"; + } + std::vector sList = output_substitutions(ocg, mapping, assigned_on_the_fly); + stmt_list = ocg->StmtListAppend(stmt_list, ocg->CreateSubstitutedStmt((guard_repr==NULL)?indent:indent+1, stmts[remap[*i]]->clone(), loop_vars, sList)); + active.unset(*i); + } + } + + if (stmt_list != NULL) { + if (active.num_elem() != 0) + stmt_list = ocg->StmtListAppend(stmt_list, leaf_print_repr(active, guards, NULL, known, (guard_repr==NULL)?indent:indent+1, ocg, remap, xforms, stmts, assigned_on_the_fly)); + if (guard_repr == NULL) + return stmt_list; + else + return ocg->CreateIf(indent, guard_repr, stmt_list, NULL); + } + else { + Relation then_cond = find_best_guard(const_cast &>(guards)[*(active.begin())], active, guards); + assert(!then_cond.is_obvious_tautology()); + Relation new_then_known = Intersection(copy(known), copy(then_cond)); + new_then_known.simplify(); + Relation else_cond = Complement(copy(then_cond)); + else_cond.simplify(); + Relation new_else_known = Intersection(copy(known), copy(else_cond)); + new_else_known.simplify(); + + BoolSet<> then_active(active.size()), else_active(active.size()), indep_active(active.size()); + std::map then_guards, else_guards; + for (BoolSet<>::iterator i = active.begin(); i != active.end(); i++) { + Relation &r = const_cast &>(guards)[*i]; + if (Must_Be_Subset(copy(r), copy(then_cond))) { + Relation r2 = Gist(copy(r), copy(then_cond), 1); + if (!r2.is_obvious_tautology()) + then_guards[*i] = r2; + then_active.set(*i); + } + else if (Must_Be_Subset(copy(r), copy(else_cond))) { + Relation r2 = Gist(copy(r), copy(else_cond), 1); + if (!r2.is_obvious_tautology()) + else_guards[*i] = r2; + else_active.set(*i); + } + else + indep_active.set(*i); + } + assert(!then_active.empty()); + + CG_outputRepr *new_guard_repr = output_guard(ocg, then_cond, assigned_on_the_fly); + if (else_active.empty() && indep_active.empty()) { + guard_repr = ocg->CreateAnd(guard_repr, new_guard_repr); + return leaf_print_repr(then_active, then_guards, guard_repr, new_then_known, indent, ocg, remap, xforms, stmts, assigned_on_the_fly); + } + else if (else_active.empty() && !indep_active.empty()) { + int new_indent = (guard_repr==NULL)?indent:indent+1; + stmt_list = leaf_print_repr(then_active, then_guards, new_guard_repr, new_then_known, new_indent, ocg, remap, xforms, stmts, assigned_on_the_fly); + stmt_list = ocg->StmtListAppend(stmt_list, leaf_print_repr(indep_active, guards, NULL, known, new_indent, ocg, remap, xforms, stmts, assigned_on_the_fly)); + if (guard_repr == NULL) + return stmt_list; + else + return ocg->CreateIf(indent, guard_repr, stmt_list, NULL); + } + else { // (!else_active.empty()) + int new_indent = (guard_repr==NULL)?indent:indent+1; + CG_outputRepr *then_stmt_list = leaf_print_repr(then_active, then_guards, NULL, new_then_known, new_indent+1, ocg, remap, xforms, stmts, assigned_on_the_fly); + CG_outputRepr *else_stmt_list = leaf_print_repr(else_active, else_guards, NULL, new_else_known, new_indent+1, ocg, remap, xforms, stmts, assigned_on_the_fly); + stmt_list = ocg->CreateIf(new_indent, new_guard_repr, then_stmt_list, else_stmt_list); + if (!indep_active.empty()) + stmt_list = ocg->StmtListAppend(stmt_list, leaf_print_repr(indep_active, guards, NULL, known, new_indent, ocg, remap, xforms, stmts, assigned_on_the_fly)); + if (guard_repr == NULL) + return stmt_list; + else + return ocg->CreateIf(indent, guard_repr, stmt_list, NULL); + } + } +} + + +// +// heavy lifting for code output for one level of loop nodes +// +CG_outputRepr *loop_print_repr(const std::vector &loops, int start, int end, + const Relation &guard, CG_outputRepr *guard_repr, + int indent, CG_outputBuilder *ocg, const std::vector &stmts, + const std::vector > &assigned_on_the_fly) { + if (start >= end) + return NULL; + + Relation R = Gist(copy(loops[start]->guard_), copy(guard), 1); + if (Must_Be_Subset(Intersection(copy(loops[start]->known_), copy(guard)), copy(R))) { + int new_indent = (guard_repr==NULL)?indent:indent+1; + int i = start+1; + for ( ; i < end; i++) + if (!Gist(copy(loops[i]->guard_), copy(guard), 1).is_obvious_tautology()) + break; + CG_outputRepr *stmt_list = NULL; + for (int j = start; j < i; j++) + stmt_list = ocg->StmtListAppend(stmt_list, loops[j]->printRepr(false, new_indent, ocg, stmts, assigned_on_the_fly)); + stmt_list = ocg->StmtListAppend(stmt_list, loop_print_repr(loops, i, end, guard, NULL, new_indent, ocg, stmts, assigned_on_the_fly)); + if (guard_repr == NULL) + return stmt_list; + else + return ocg->CreateIf(indent, guard_repr, stmt_list, NULL); + } + + Relation then_cond = find_best_guard(R, loops, start, end); + assert(!then_cond.is_obvious_tautology()); + Relation else_cond = Complement(copy(then_cond)); + else_cond.simplify(); + + std::vector then_loops, else_loops, indep_loops; + int i = start; + for ( ; i < end; i++) + if (!Must_Be_Subset(copy(loops[i]->guard_), copy(then_cond))) + break; + int j = i; + for ( ; j < end; j++) + if (!Must_Be_Subset(copy(loops[j]->guard_), copy(else_cond))) + break; + assert(i>start); + + CG_outputRepr *new_guard_repr = output_guard(ocg, then_cond, assigned_on_the_fly); + if (j == i && end == j) { + guard_repr = ocg->CreateAnd(guard_repr, new_guard_repr); + Relation new_guard = Intersection(copy(guard), copy(then_cond)); + new_guard.simplify(); + return loop_print_repr(loops, start, end, new_guard, guard_repr, indent, ocg, stmts, assigned_on_the_fly); + } + else if (j == i && end > j) { + int new_indent = (guard_repr==NULL)?indent:indent+1; + Relation new_guard = Intersection(copy(guard), copy(then_cond)); + new_guard.simplify(); + CG_outputRepr *stmt_list = loop_print_repr(loops, start, i, new_guard, new_guard_repr, new_indent, ocg, stmts, assigned_on_the_fly); + stmt_list = ocg->StmtListAppend(stmt_list, loop_print_repr(loops, j, end, guard, NULL, new_indent, ocg, stmts, assigned_on_the_fly)); + if (guard_repr == NULL) + return stmt_list; + else + return ocg->CreateIf(indent, guard_repr, stmt_list, NULL); + } + else { // (j > i) + int new_indent = (guard_repr==NULL)?indent:indent+1; + Relation then_new_guard = Intersection(copy(guard), copy(then_cond)); + then_new_guard.simplify(); + CG_outputRepr *then_stmt_list = loop_print_repr(loops, start, i, then_new_guard, NULL, new_indent+1, ocg, stmts, assigned_on_the_fly); + Relation else_new_guard = Intersection(copy(guard), copy(else_cond)); + else_new_guard.simplify(); + CG_outputRepr *else_stmt_list = loop_print_repr(loops, i, j, else_new_guard, NULL, new_indent+1, ocg, stmts, assigned_on_the_fly); + CG_outputRepr *stmt_list = ocg->CreateIf(new_indent, new_guard_repr, then_stmt_list, else_stmt_list); + stmt_list = ocg->StmtListAppend(stmt_list, loop_print_repr(loops, j, end, guard, NULL, new_indent, ocg, stmts, assigned_on_the_fly)); + if (guard_repr == NULL) + return stmt_list; + else + return ocg->CreateIf(indent, guard_repr, stmt_list, NULL); + } +} + +} diff --git a/omegalib/code_gen/src/code_gen.cc b/omegalib/code_gen/src/code_gen.cc new file mode 100644 index 0000000..168c86b --- /dev/null +++ b/omegalib/code_gen/src/code_gen.cc @@ -0,0 +1,656 @@ +/***************************************************************************** + Copyright (C) 1994-2000 University of Maryland + Copyright (C) 2008 University of Southern California + Copyright (C) 2009-2010 University of Utah + All Rights Reserved. + + Purpose: + Start code generation process here. + + Notes: + + History: + 04/24/96 MMGenerateCode implementation, added by D people. Lei Zhou +*****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace omega { + + +int last_level;// Should not be global, but it is. +SetTuple new_IS; +SetTupleTuple projected_nIS; +Tuple statementInfo; +RelTuple transformations; + +//protonu--adding stuff to make Chun's code work with Gabe's +Tuple< Tuple > smtNonSplitLevels; +Tuple< Tuple > loopIdxNames;//per stmt +std::vector< std::pair > syncs; + +//protonu-putting this in for now, not sure what all these do +//This lovely ugly hack allows us to extract hard upper-bounds at +//specific loop levels +int checkLoopLevel; +int stmtForLoopCheck; +int upperBoundForLevel; +int lowerBoundForLevel; +bool fillInBounds; + +//trick to static init checkLoopLevel to 0 +class JunkStaticInit{ public: JunkStaticInit(){ checkLoopLevel=0; fillInBounds=false;} }; +static JunkStaticInit junkInitInstance__; + +//end--protonu. + + +CG_result * gen_recursive(int level, IntTuple &isActive); + + +int code_gen_debug=0; + + +SetTuple filter_function_symbols(SetTuple &sets, bool keep_fs){ + SetTuple new_sets(sets.size()); + for(int i = 1; i <= sets.size(); i++) { + Relation R = sets[i]; + Relation &S = new_sets[i]; + assert(R.is_set()); + + S = Relation(R.n_set()); + S.copy_names(R); + F_Exists *fe = S.add_exists(); + F_Or *fo = fe->add_or(); + for(DNF_Iterator D(R.query_DNF()); D; D++) { + F_And *fa = fo->add_and(); + Variable_ID_Tuple &oldlocals = (*D)->locals(); + Section newlocals = fe->declare_tuple(oldlocals.size()); + + /* copy constraints. This is much more difficult than it needs + to be, but add_EQ(Constraint_Handle) doesn't work because it can't + keep track of existentially quantified varaibles across calls. + Sigh. */ + + for(EQ_Iterator e(*D); e; e++) + if((max_fs_arity(*e) > 0) == keep_fs){ + EQ_Handle n = fa->add_EQ(); + for(Constr_Vars_Iter cvi(*e,false);cvi;cvi++) + if((*cvi).var->kind() == Wildcard_Var) + n.update_coef(newlocals[oldlocals.index((*cvi).var)], + (*cvi).coef); + else + if((*cvi).var->kind() == Global_Var) + n.update_coef(S.get_local((*cvi).var->get_global_var(), + (*cvi).var->function_of()), + (*cvi).coef); + else + n.update_coef((*cvi).var,(*cvi).coef); + n.update_const((*e).get_const()); + n.finalize(); + } + + for(GEQ_Iterator g(*D); g; g++) + if((max_fs_arity(*g) > 0) == keep_fs) { + GEQ_Handle n = fa->add_GEQ(); + for(Constr_Vars_Iter cvi(*g,false);cvi;cvi++) + if((*cvi).var->kind() == Wildcard_Var) + n.update_coef(newlocals[oldlocals.index((*cvi).var)], + (*cvi).coef); + else + if((*cvi).var->kind() == Global_Var) + n.update_coef(S.get_local((*cvi).var->get_global_var(), + (*cvi).var->function_of()), + (*cvi).coef); + else + n.update_coef((*cvi).var,(*cvi).coef); + n.update_const((*g).get_const()); + n.finalize(); + } + } + S.finalize(); + } + + return new_sets; +} + + +RelTuple strip_function_symbols(SetTuple &sets) { + return filter_function_symbols(sets,false); +} + +RelTuple extract_function_symbols(SetTuple &sets) { + return filter_function_symbols(sets,true); +} + + +std::string MMGenerateCode(RelTuple &T, SetTuple &old_IS, Relation &known, int effort) { + Tuple nameInfo; + for (int stmt = 1; stmt <= T.size(); stmt++) + nameInfo.append(new CG_stringRepr("s" + to_string(stmt))); + + CG_stringBuilder ocg; + CG_stringRepr *sRepr = static_cast(MMGenerateCode(&ocg, T, old_IS, nameInfo, known, effort)); + + for (int i = 1; i <= nameInfo.size(); i++) + delete nameInfo[i]; + if (sRepr != NULL) + return GetString(sRepr); + else + return std::string(); +} + + +//***************************************************************************** +// MMGenerateCode implementation, added by D people. Lei Zhou, Apr. 24, 96 +//***************************************************************************** +CG_outputRepr* MMGenerateCode(CG_outputBuilder* ocg, RelTuple &T, SetTuple &old_IS, const Tuple &stmt_content, Relation &known, int effort) { + int stmts = T.size(); + if (stmts == 0) + return ocg->CreateComment(1, "No statements found!"); + if (!known.is_null()) + known.simplify(); + + // prepare iteration spaces by splitting disjoint conjunctions + int maxStmt = 1; + last_level = 0; + for (int stmt = 1; stmt <= stmts; stmt++) { + int old_dim = T[stmt].n_out(); + if (old_dim > last_level) + last_level = old_dim; + + for (int i = 1; i <= old_IS[stmt].n_set(); i++) + T[stmt].name_input_var(i, old_IS[stmt].set_var(i)->name()); + for (int i = 1; i <= old_dim; i++) + T[stmt].name_output_var(i, std::string("t")+to_string(i)); + T[stmt].setup_names(); + + Relation R = Range(Restrict_Domain(copy(T[stmt]), copy(old_IS[stmt]))); + R.simplify(); + while(R.is_upper_bound_satisfiable()) { + new_IS.reallocate(maxStmt); + transformations.reallocate(maxStmt); + statementInfo.reallocate(maxStmt); + DNF *dnf = R.query_DNF(); + DNF_Iterator c(dnf); + Relation R2 = Relation(R, *c); + R2.simplify(); + if (R2.is_inexact()) + throw codegen_error("unknown constraint in loop bounds"); + if (known.is_null()) { + new_IS[maxStmt] = R2; + transformations[maxStmt] = T[stmt]; + statementInfo[maxStmt] = stmt_content[stmt]; + maxStmt++; + } + else { + Relation R2_extended = copy(R2); + Relation known_extended = copy(known); + if (R2.n_set() > known.n_set()) + known_extended = Extend_Set(known_extended, R2.n_set()-known.n_set()); + else if (R2.n_set() < known.n_set()) + R2_extended = Extend_Set(R2_extended, known.n_set()-R2.n_set()); + if (Intersection(R2_extended, known_extended).is_upper_bound_satisfiable()) { + new_IS[maxStmt] = R2; + transformations[maxStmt] = T[stmt]; + statementInfo[maxStmt] = stmt_content[stmt]; + maxStmt++; + } + } + c.next(); + if (!c.live()) + break; + if(code_gen_debug) { + fprintf(DebugFile, "splitting iteration space for disjoint form\n"); + fprintf(DebugFile, "Original iteration space: \n"); + R.print_with_subs(DebugFile); + fprintf(DebugFile, "First conjunct: \n"); + R2.print_with_subs(DebugFile); + } + Relation remainder(R, *c); + c.next(); + while (c.live()) { + remainder = Union(remainder, Relation(R, *c)); + c.next(); + } + R = Difference(remainder, copy(R2)); + R.simplify(); + if(code_gen_debug) { + fprintf(DebugFile, "Remaining iteration space: \n"); + R.print_with_subs(DebugFile); + } + } + } + + // reset number of statements + stmts = maxStmt-1; + if(stmts == 0) + return ocg->CreateComment(1, "No points in any of the iteration spaces!"); + + // entend iteration spaces to maximum dimension + for (int stmt = 1; stmt <= stmts; stmt++) { + int old_dim = new_IS[stmt].n_set(); + if (old_dim < last_level) { + new_IS[stmt] = Extend_Set(new_IS[stmt], last_level-old_dim); + F_And *f_root = new_IS[stmt].and_with_and(); + for (int i = old_dim+1; i <= last_level; i++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(new_IS[stmt].set_var(i), 1); + h.update_const(posInfinity); + } + } + } + + // standarize the known condition + if(known.is_null()) { + known = Relation::True(last_level); + } + known = Extend_Set(known, last_level-known.n_set()); + for (int i = 1; i <= last_level; i++) + known.name_set_var(i, std::string("t")+to_string(i)); + known.setup_names(); + + // prepare projected subspaces for each loop level + projected_nIS.clear(); + projected_nIS.reallocate(last_level); + for(int i = 1; i <= last_level; i++ ) { + projected_nIS[i].reallocate(stmts); + } + for (int stmt = 1; stmt <= stmts; stmt++) { + if (last_level > 0) + projected_nIS[last_level][stmt] = new_IS[stmt]; + for (int i = last_level-1; i >= 1; i--) { + projected_nIS[i][stmt] = Project(copy(projected_nIS[i+1][stmt]), i+1, Set_Var); + projected_nIS[i][stmt].simplify(); + } + } + + // recursively generate AST + IntTuple allStmts(stmts); + for(int i = 1; i <= stmts; i++) + allStmts[i] = 1; + CG_result *cg = gen_recursive(1, allStmts); + + // always force finite bounds + cg = cg->recompute(known, known); + cg = cg->force_finite_bounds(); + + // loop overhead removal based on actual nesting depth -- by chun 09/17/2008 + for (int i = 1; i <= min(effort, cg->depth()); i++) + cg = cg->liftOverhead(i); + + // merge adjacent if-conditions -- by chun 10/24/2006 + cg->hoistGuard(); + + // really print out the loop + //CG_outputRepr* sRepr = cg->printRepr(ocg, 1, std::vector(last_level, NULL)); + CG_outputRepr* sRepr = cg->printRepr(ocg, 1, std::vector(last_level)); + delete cg; + cg = NULL; + projected_nIS.clear(); + transformations.clear(); + new_IS.clear(); + + return sRepr; +} + +//protonu--overload the above MMGenerateCode to take into the CUDA-CHiLL +CG_outputRepr* MMGenerateCode(CG_outputBuilder* ocg, RelTuple &T, SetTuple &old_IS, + const Tuple &stmt_content, Relation &known, + Tuple< IntTuple >& smtNonSplitLevels_, + std::vector< std::pair > syncs_, + const Tuple< Tuple >& loopIdxNames_, + int effort) { + int stmts = T.size(); + if (stmts == 0) + return ocg->CreateComment(1, "No statements found!"); + if (!known.is_null()) + known.simplify(); + + //protonu-- + //easier to handle this as a global + smtNonSplitLevels = smtNonSplitLevels_; + syncs = syncs_; + loopIdxNames = loopIdxNames_; + //end-protonu + + + + // prepare iteration spaces by splitting disjoint conjunctions + int maxStmt = 1; + last_level = 0; + for (int stmt = 1; stmt <= stmts; stmt++) { + int old_dim = T[stmt].n_out(); + if (old_dim > last_level) + last_level = old_dim; + + for (int i = 1; i <= old_IS[stmt].n_set(); i++) + T[stmt].name_input_var(i, old_IS[stmt].set_var(i)->name()); + for (int i = 1; i <= old_dim; i++) + T[stmt].name_output_var(i, std::string("t")+to_string(i)); + T[stmt].setup_names(); + + Relation R = Range(Restrict_Domain(copy(T[stmt]), copy(old_IS[stmt]))); + R.simplify(); + while(R.is_upper_bound_satisfiable()) { + new_IS.reallocate(maxStmt); + transformations.reallocate(maxStmt); + statementInfo.reallocate(maxStmt); + + //protonu--putting in fix provided by Mark Hall + smtNonSplitLevels.reallocate(maxStmt); + //end-protonu + + + DNF *dnf = R.query_DNF(); + DNF_Iterator c(dnf); + Relation R2 = Relation(R, *c); + R2.simplify(); + if (R2.is_inexact()) + throw codegen_error("unknown constraint in loop bounds"); + if (known.is_null()) { + new_IS[maxStmt] = R2; + transformations[maxStmt] = T[stmt]; + statementInfo[maxStmt] = stmt_content[stmt]; + maxStmt++; + } + else { + Relation R2_extended = copy(R2); + Relation known_extended = copy(known); + if (R2.n_set() > known.n_set()) + known_extended = Extend_Set(known_extended, R2.n_set()-known.n_set()); + else if (R2.n_set() < known.n_set()) + R2_extended = Extend_Set(R2_extended, known.n_set()-R2.n_set()); + if (Intersection(R2_extended, known_extended).is_upper_bound_satisfiable()) { + new_IS[maxStmt] = R2; + transformations[maxStmt] = T[stmt]; + statementInfo[maxStmt] = stmt_content[stmt]; + maxStmt++; + } + } + c.next(); + if (!c.live()) + break; + if(code_gen_debug) { + fprintf(DebugFile, "splitting iteration space for disjoint form\n"); + fprintf(DebugFile, "Original iteration space: \n"); + R.print_with_subs(DebugFile); + fprintf(DebugFile, "First conjunct: \n"); + R2.print_with_subs(DebugFile); + } + Relation remainder(R, *c); + c.next(); + while (c.live()) { + remainder = Union(remainder, Relation(R, *c)); + c.next(); + } + R = Difference(remainder, copy(R2)); + R.simplify(); + if(code_gen_debug) { + fprintf(DebugFile, "Remaining iteration space: \n"); + R.print_with_subs(DebugFile); + } + } + } + + // reset number of statements + stmts = maxStmt-1; + if(stmts == 0) + return ocg->CreateComment(1, "No points in any of the iteration spaces!"); + + // entend iteration spaces to maximum dimension + for (int stmt = 1; stmt <= stmts; stmt++) { + int old_dim = new_IS[stmt].n_set(); + if (old_dim < last_level) { + new_IS[stmt] = Extend_Set(new_IS[stmt], last_level-old_dim); + F_And *f_root = new_IS[stmt].and_with_and(); + for (int i = old_dim+1; i <= last_level; i++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(new_IS[stmt].set_var(i), 1); + h.update_const(posInfinity); + } + } + } + + // standarize the known condition + if(known.is_null()) { + known = Relation::True(last_level); + } + known = Extend_Set(known, last_level-known.n_set()); + for (int i = 1; i <= last_level; i++) + known.name_set_var(i, std::string("t")+to_string(i)); + known.setup_names(); + + // prepare projected subspaces for each loop level + projected_nIS.clear(); + projected_nIS.reallocate(last_level); + for(int i = 1; i <= last_level; i++ ) { + projected_nIS[i].reallocate(stmts); + } + for (int stmt = 1; stmt <= stmts; stmt++) { + if (last_level > 0) + projected_nIS[last_level][stmt] = new_IS[stmt]; + for (int i = last_level-1; i >= 1; i--) { + projected_nIS[i][stmt] = Project(copy(projected_nIS[i+1][stmt]), i+1, Set_Var); + projected_nIS[i][stmt].simplify(); + } + } + + // recursively generate AST + IntTuple allStmts(stmts); + for(int i = 1; i <= stmts; i++) + allStmts[i] = 1; + CG_result *cg = gen_recursive(1, allStmts); + + // always force finite bounds + cg = cg->recompute(known, known); + cg = cg->force_finite_bounds(); + + // loop overhead removal based on actual nesting depth -- by chun 09/17/2008 + for (int i = 1; i <= min(effort, cg->depth()); i++) + cg = cg->liftOverhead(i); + + // merge adjacent if-conditions -- by chun 10/24/2006 + cg->hoistGuard(); + + // really print out the loop + //CG_outputRepr* sRepr = cg->printRepr(ocg, 1, std::vector(last_level, NULL)); + CG_outputRepr* sRepr = cg->printRepr(ocg, 1, std::vector(last_level )); + delete cg; + cg = NULL; + projected_nIS.clear(); + transformations.clear(); + new_IS.clear(); + + return sRepr; +} + +CG_result *gen_recursive(int level, IntTuple &isActive) { + int stmts = isActive.size(); + + Set active; + int s; + for(s = 1; s <= stmts; s++) + if(isActive[s]) active.insert(s); + + assert (active.size() >= 1); + if(level > last_level) return new CG_leaf(isActive); + + if (active.size() == 1) + return new CG_loop(isActive,level, gen_recursive(level+1,isActive)); + + bool constantLevel = true; + + int test_rel_size; + coef_t start,finish; + finish = -(posInfinity-1); // -(MAXINT-1); + start = posInfinity; // MAXINT; + Tuple when(stmts); + for(s=1; s<=stmts; s++) if (isActive[s]) { + coef_t lb,ub; + test_rel_size = projected_nIS[level][s].n_set(); + projected_nIS[level][s].single_conjunct() + ->query_variable_bounds( + projected_nIS[level][s].set_var(level), + lb,ub); + if(code_gen_debug) { + fprintf(DebugFile, "IS%d: " coef_fmt " <= t%d <= " coef_fmt "\n",s, + lb,level,ub); + projected_nIS[level][s].prefix_print(DebugFile); + } + if (lb != ub) { + constantLevel = false; + break; + } + else { + set_max(finish,lb); + set_min(start,lb); + when[s] = lb; + } + } + + + if (constantLevel && finish-start <= stmts) { + IntTuple newActive(isActive.size()); + for(int i=1; i<=stmts; i++) + newActive[i] = isActive[i] && when[i] == start; + CG_result *r = new CG_loop(isActive,level, + gen_recursive(level+1,newActive)); + for(coef_t time = start+1; time <= finish; time++) { + int count = 0; + for(int i=1; i<=stmts; i++) { + newActive[i] = isActive[i] && when[i] == time; + if (newActive[i]) count++; + } + if (count) { + Relation test_rel(test_rel_size); + GEQ_Handle g = test_rel.and_with_GEQ(); + g.update_coef(test_rel.set_var(level),-1); + g.update_const(time-1); + + r = new CG_split(isActive,level,test_rel,r, + new CG_loop(isActive,level, + gen_recursive(level+1,newActive))); + } + } + return r; + } + +// Since the Hull computation is approximate, we will get regions that +// have no stmts. (since we will have split on constraints on the +// hull, and thus we are looking at a region outside the convex hull +// of all the iteration spaces.) +#if 1 + Relation hull = Hull(projected_nIS[level],isActive,1); +#else + Relation hull = Hull(projected_nIS[level],isActive,0); +#endif + + if(code_gen_debug) { + fprintf(DebugFile, "Hull (level %d) is:\n",level); + hull.prefix_print(DebugFile); + } + + + IntTuple firstChunk(isActive); + IntTuple secondChunk(isActive); + + //protonu-warn Chun about this change + //This does some fancy splitting of statements into loops with the + //fewest dimentions, but that's not necessarily what we want when + //code-gening for CUDA. smtNonSplitLevels keeps track per-statment of + //the levels that should not be split on. + bool checkForSplits = true; + for (int s = 1; s <= isActive.size(); s++){ + if (isActive[s]) { + if(s < smtNonSplitLevels.size() && smtNonSplitLevels[s].index(level-2) != 0){ + checkForSplits = false; + break; + } + } + } + + //protonu-modifying the next for loop + for (int s = 1; checkForSplits && s <= isActive.size(); s++) + if (isActive[s]) { + Relation gist = Gist(copy(projected_nIS[level][s]),copy(hull),1); + if (gist.is_obvious_tautology()) break; + gist.simplify(); + Conjunct *s_conj = gist.single_conjunct(); + for(GEQ_Iterator G(s_conj); G; G++) { + Relation test_rel(gist.n_set()); + test_rel.and_with_GEQ(*G); + Variable_ID v = set_var(level); + coef_t sign = (*G).get_coef(v); + if(sign > 0) test_rel = Complement(test_rel); + if(code_gen_debug) { + fprintf(DebugFile, "Considering split from stmt %d:\n",s); + test_rel.prefix_print(DebugFile); + } + + firstChunk[s] = sign <= 0; + secondChunk[s] = sign > 0; + int numberFirst = sign <= 0; + int numberSecond = sign > 0; + + for (int s2 = 1; s2 <= isActive.size(); s2++) + if (isActive[s2] && s2 != s) { + if(code_gen_debug) + fprintf(DebugFile,"Consider stmt %d\n",s2); + bool t = Intersection(copy(projected_nIS[level][s2]), + copy(test_rel)).is_upper_bound_satisfiable(); + bool f = Difference(copy(projected_nIS[level][s2]), + copy(test_rel)).is_upper_bound_satisfiable(); + assert(t || f); + if(code_gen_debug && t&&f) + fprintf(DebugFile, "Slashes stmt %d\n",s2); + if (t&&f) goto nextGEQ; + if(code_gen_debug) { + if (t) + fprintf(DebugFile, "true for stmt %d\n",s2); + else + fprintf(DebugFile, "false for stmt %d\n",s2); + } + if (t) numberFirst++; + else numberSecond++; + firstChunk[s2] = t; + secondChunk[s2] = !t; + } + + assert(numberFirst+numberSecond>1 && "Can't handle wildcard in iteration space"); + if(code_gen_debug) + fprintf(DebugFile, "%d true, %d false\n", + numberFirst, + numberSecond); + if (numberFirst && numberSecond) { + // Found a dividing constraint + return new CG_split(isActive,level,test_rel, + gen_recursive(level,firstChunk), + gen_recursive(level,secondChunk)); + } + nextGEQ: ; + } + } + + // No way found to divide stmts without splitting, generate loop + + return new CG_loop(isActive,level, gen_recursive(level+1,isActive)); +} + +} diff --git a/omegalib/code_gen/src/codegen.cc b/omegalib/code_gen/src/codegen.cc new file mode 100755 index 0000000..92ca702 --- /dev/null +++ b/omegalib/code_gen/src/codegen.cc @@ -0,0 +1,378 @@ +/***************************************************************************** + Copyright (C) 1994-2000 the Omega Project Team + Copyright (C) 2005-2011 Chun Chen + All Rights Reserved. + + Purpose: + CodeGen class as entry point for code generation. + + Notes: + Loop variable name prefix should not cause any possible name conflicts + with original loop variables wrapped in statement holder. This guarantees + that variable substitution done correctly in the generated code. + + History: + 04/24/96 MMGenerateCode, added by Fortran D people. Lei Zhou + 09/17/08 loop overhead removal based on actual nesting depth -- by chun + 03/05/11 fold MMGenerateCode into CodeGen class, Chun Chen +*****************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace omega { + +const std::string CodeGen::loop_var_name_prefix = "t"; +const int CodeGen::var_substitution_threshold = 10; + +//Anand--adding stuff to make Chun's code work with Gabe's +std::vector< std::vector > smtNonSplitLevels; +std::vector< std::vector > loopIdxNames;//per stmt +std::vector< std::pair > syncs; + + + +CodeGen::CodeGen(const std::vector &xforms, const std::vector &IS, const Relation &known, std::vector< std::vector > smtNonSplitLevels_ , std::vector< std::vector > loopIdxNames_, std::vector< std::pair > syncs_) { + // check for sanity of parameters + int num_stmt = IS.size(); + if (xforms.size() != num_stmt) + throw std::invalid_argument("number of iteration spaces does not match number of transformations"); + known_ = copy(known); + if (known_.n_out() != 0) + throw std::invalid_argument("known condition must be a set relation"); + if (known_.is_null()) + known_ = Relation::True(0); + else + known_.simplify(2, 4); + if (!known_.is_upper_bound_satisfiable()) + return; + if (known_.number_of_conjuncts() > 1) + throw std::invalid_argument("only one conjunct allowed in known condition"); + xforms_ = xforms; + for (int i = 0; i < num_stmt; i++) { + xforms_[i].simplify(); + if (!xforms_[i].has_single_conjunct()) + throw std::invalid_argument("mapping relation must have only one conjunct"); + if (xforms_[i].n_inp() != IS[i].n_inp() || IS[i].n_out() != 0) + throw std::invalid_argument("illegal iteration space or transformation arity"); + } + + + //protonu-- + //easier to handle this as a global + smtNonSplitLevels = smtNonSplitLevels_; + syncs = syncs_; + loopIdxNames = loopIdxNames_; + //end-protonu + + + + // find the maximum iteration space dimension we are going to operate on + int num_level = known_.n_inp(); + for (int i = 0; i < num_stmt; i++) + if (xforms_[i].n_out() > num_level) + num_level = xforms_[i].n_out(); + known_ = Extend_Set(known_, num_level-known_.n_inp()); + for (int i = 1; i <= num_level; i++) + known_.name_set_var(i, loop_var_name_prefix + to_string(i)); + known_.setup_names(); + + // split disjoint conjunctions in original iteration spaces + std::vector new_IS; + for (int i = 0; i < num_stmt; i++) { + for (int j = 1; j <= IS[i].n_inp(); j++) + xforms_[i].name_input_var(j, const_cast &>(IS)[i].input_var(j)->name()); + for (int j = 1; j <= xforms_[i].n_out(); j++) + xforms_[i].name_output_var(j, loop_var_name_prefix + to_string(j)); + xforms_[i].setup_names(); + + Relation R = Range(Restrict_Domain(copy(xforms_[i]), copy(IS[i]))); + R = Intersection(Extend_Set(R, num_level-R.n_inp()), copy(known_)); + R.simplify(2, 4); + if (R.is_inexact()) + throw codegen_error("cannot generate code for inexact iteration spaces"); + + while(R.is_upper_bound_satisfiable()) { + DNF *dnf = R.query_DNF(); + DNF_Iterator c(dnf); + Relation R2 = Relation(R, *c); + R2.simplify(); + new_IS.push_back(copy(R2)); + remap_.push_back(i); + c.next(); + if (!c.live()) + break; + Relation remainder(R, *c); + c.next(); + while (c.live()) { + remainder = Union(remainder, Relation(R, *c)); + c.next(); + } + R = Difference(remainder, R2); + R.simplify(2, 4); + } + } + + // number of new statements after splitting + num_stmt = new_IS.size(); + if(!smtNonSplitLevels.empty()) + smtNonSplitLevels.resize(num_stmt); + // assign a dummy value to loops created for the purpose of expanding to maximum dimension + for (int i = 0; i < num_stmt; i++) { + if (xforms[remap_[i]].n_out() < num_level) { + F_And *f_root = new_IS[i].and_with_and(); + for (int j = xforms[remap_[i]].n_out()+1; j <= num_level; j++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(new_IS[i].set_var(j), 1); + h.update_const(posInfinity); + } + new_IS[i].simplify(); + } + } + + // calculate projected subspaces for each loop level once and save for CG tree manipulation later + projected_IS_ = std::vector >(num_level); + for (int i = 0; i < num_level; i++) + projected_IS_[i] = std::vector(num_stmt); + for (int i = 0; i < num_stmt; i++) { + if (num_level > 0) + projected_IS_[num_level-1][i] = new_IS[i]; + for (int j = num_level-1; j >= 1; j--) { + projected_IS_[j-1][i] = Project(copy(projected_IS_[j][i]), j+1, Set_Var); + projected_IS_[j-1][i].simplify(2, 4); + } + } +} + + +CG_result *CodeGen::buildAST(int level, const BoolSet<> &active, bool split_on_const, const Relation &restriction) { + if (level > num_level()) + return new CG_leaf(this, active); + + int num_active_stmt = active.num_elem(); + if (num_active_stmt == 0) + return NULL; + else if (num_active_stmt == 1) + return new CG_loop(this, active, level, buildAST(level+1, active, true, restriction)); + + // use estimated constant bounds for fast non-overlap iteration space splitting + if (split_on_const) { + std::vector, int> > bounds; + + for (BoolSet<>::const_iterator i = active.begin(); i != active.end(); i++) { + Relation r = Intersection(copy(projected_IS_[level-1][*i]), copy(restriction)); + r.simplify(2, 4); + if (!r.is_upper_bound_satisfiable()) + continue; + coef_t lb, ub; + r.single_conjunct()->query_variable_bounds(r.set_var(level),lb,ub); + bounds.push_back(std::make_pair(std::make_pair(lb, ub), *i)); + } + sort(bounds.begin(), bounds.end()); + + std::vector split_cond; + std::vector split_child; + + coef_t prev_val = -posInfinity; + coef_t next_val = bounds[0].first.second; + BoolSet<> next_active(active.size()); + int i = 0; + while (i < bounds.size()) { + if (bounds[i].first.first <= next_val) { + next_active.set(bounds[i].second); + next_val = max(next_val, bounds[i].first.second); + i++; + } + else { + Relation r(num_level()); + F_And *f_root = r.add_and(); + if (prev_val != -posInfinity) { + GEQ_Handle h = f_root->add_GEQ(); + h.update_coef(r.set_var(level), 1); + h.update_const(-prev_val-1); + } + if (next_val != posInfinity) { + GEQ_Handle h = f_root->add_GEQ(); + h.update_coef(r.set_var(level), -1); + h.update_const(next_val); + } + r.simplify(); + + Relation new_restriction = Intersection(copy(r), copy(restriction)); + new_restriction.simplify(2, 4); + CG_result *child = buildAST(level, next_active, false, new_restriction); + if (child != NULL) { + split_cond.push_back(copy(r)); + split_child.push_back(child); + } + next_active.unset_all(); + prev_val = next_val; + next_val = bounds[i].first.second; + } + } + if (!next_active.empty()) { + Relation r = Relation::True(num_level()); + if (prev_val != -posInfinity) { + F_And *f_root = r.and_with_and(); + GEQ_Handle h = f_root->add_GEQ(); + h.update_coef(r.set_var(level), 1); + h.update_const(-prev_val-1); + r.simplify(); + } + Relation new_restriction = Intersection(copy(r), copy(restriction)); + new_restriction.simplify(2, 4); + CG_result *child = buildAST(level, next_active, false, new_restriction); + if (child != NULL) { + split_cond.push_back(copy(r)); + split_child.push_back(child); + } + } + + if (split_child.size() == 0) + return NULL; + else if (split_child.size() == 1) + return split_child[0]; + else + return new CG_split(this, active, split_cond, split_child); + } + // check bound conditions exhaustively for non-overlap iteration space splitting + else { + std::vector Rs(active.size()); + for (BoolSet<>::const_iterator i = active.begin(); i != active.end(); i++) { + Rs[*i] = Intersection(Approximate(copy(projected_IS_[level-1][*i])), copy(restriction)); + Rs[*i].simplify(2, 4); + } + Relation hull = SimpleHull(Rs); + + //protonu-warn Chun about this change + //This does some fancy splitting of statements into loops with the + //fewest dimentions, but that's not necessarily what we want when + //code-gening for CUDA. smtNonSplitLevels keeps track per-statment of + //the levels that should not be split on. + bool checkForSplits = true; + for (BoolSet<>::const_iterator i = active.begin(); i != active.end(); i++) { + if(*i < smtNonSplitLevels.size()) + for(int k = 0; k ::const_iterator i = active.begin(); i != active.end() && checkForSplits; i++) { + Relation r = Gist(copy(Rs[*i]), copy(hull), 1); + if (r.is_obvious_tautology()) + continue; + r = EQs_to_GEQs(r); + + for (GEQ_Iterator e = r.single_conjunct()->GEQs(); e; e++) { + if ((*e).has_wildcards()) + continue; + + Relation cond = Relation::True(num_level()); + BoolSet<> first_chunk(active.size()); + BoolSet<> second_chunk(active.size()); + + if ((*e).get_coef(hull.set_var(level)) > 0) { + cond.and_with_GEQ(*e); + cond = Complement(cond);; + cond.simplify(); + second_chunk.set(*i); + } + else if ((*e).get_coef(hull.set_var(level)) < 0) { + cond.and_with_GEQ(*e); + cond.simplify(); + first_chunk.set(*i); + } + else + continue; + + bool is_proper_split_cond = true; + for (BoolSet<>::const_iterator j = active.begin(); j != active.end(); j++) + if ( *j != *i) { + bool in_first = Intersection(copy(Rs[*j]), copy(cond)).is_upper_bound_satisfiable(); + bool in_second = Difference(copy(Rs[*j]), copy(cond)).is_upper_bound_satisfiable(); + + if (in_first && in_second) { + is_proper_split_cond = false; + break; + } + + if (in_first) + first_chunk.set(*j); + else if (in_second) + second_chunk.set(*j); + } + + if (is_proper_split_cond && first_chunk.num_elem() != 0 && second_chunk.num_elem() != 0) { + CG_result *first_cg = buildAST(level, first_chunk, false, copy(cond)); + CG_result *second_cg = buildAST(level, second_chunk, false, Complement(copy(cond))); + if (first_cg == NULL) + return second_cg; + else if (second_cg == NULL) + return first_cg; + else { + std::vector split_cond; + std::vector split_child; + split_cond.push_back(copy(cond)); + split_child.push_back(first_cg); + split_cond.push_back(Complement(copy(cond))); + split_child.push_back(second_cg); + + return new CG_split(this, active, split_cond, split_child); + } + } + } + } + return new CG_loop(this, active, level, buildAST(level+1, active, true, restriction)); + } +} + + +CG_result *CodeGen::buildAST(int effort) { + if (remap_.size() == 0) + return NULL; + + CG_result *cgr = buildAST(1, ~BoolSet<>(remap_.size()), true, Relation::True(num_level())); + if (cgr == NULL) + return NULL; + + + // break down the complete iteration space condition to levels of bound/guard condtions + cgr = cgr->recompute(cgr->active_, copy(known_), copy(known_)); + + + + if (cgr == NULL) + return NULL; + + // calculate each loop's nesting depth + int depth = cgr->populateDepth(); + + + // redistribute guard condition locations by additional splittings + std::pair result = cgr->liftOverhead(min(effort,depth), false); + + // since guard conditions are postponed for non-loop levels, hoist them now. + // this enables proper if-condition simplication when outputting actual code. + result.first->hoistGuard(); + + + + + return result.first; +} + +} diff --git a/omegalib/code_gen/src/cscope.out b/omegalib/code_gen/src/cscope.out new file mode 100644 index 0000000..ac4e74f --- /dev/null +++ b/omegalib/code_gen/src/cscope.out @@ -0,0 +1,89773 @@ +cscope 15 $HOME/suif-cuda-omega-latest/code_gen/src 0000481316 + @CG.cc + +21  + ~ + +22  + ~<¡ršg.h +> + +23  + ~ + +24  + ~ + +25  + ~ + +26  + ~ + +27  + ~ + +28  + ~ + +29  + ~<¡ack +> + +31 +Çme¥aû + + gomega + { + +33 +Tu¶e +< +R–©iÚ +> +Ãw_IS +; + +34 +Tu¶e + > +´ojeùed_nIS +; + +35 +Tu¶e +< +CG_ouutR•r + *> +¡©em’tInfo +; + +36 +Tu¶e +< +R–©iÚ +> +ŒªsfÜm©iÚs +; + +37  +Ï¡_Ëv– +; + +39 +CG_»suÉ + * +g’_»cursive +( +Ëv– +, +IÁTu¶e + & +isAùive +); + +43 +Çme¥aû + + gomega + { + +45 +Tu¶e +< +IÁTu¶e +> +smtNÚS¶™Lev–s +; + +46 +Tu¶e + > +loÝIdxNames +; + +47 +¡d +:: +veùÜ +<¡d:: +·œ +<, std:: +¡ršg +> > +syncs +; + +48  +checkLoÝLev– +; + +49  +¡mtFÜLoÝCheck +; + +50  +uµ”BoundFÜLev– +; + +51  +low”BoundFÜLev– +; + +52 +boÞ + +fžlInBounds +; + +58 + g¡d +:: +¡ršg + +CG_»suÉ +:: +´št +( +šd’t +) { + +59 +CG_¡ršgBužd” + +ocg +; + +60 +CG_ouutR•r + * + g»´ + = +´štR•r +(& +ocg +, +šd’t +, + +61 +¡d +:: +veùÜ +< +CG_ouutR•r + *>( +Ï¡_Ëv– +, + +62 +¡©ic_ÿ¡ +< +CG_ouutR•r + *>( +NULL +))); + +63 ià( + g»´ + =ð +NULL +) + +64  +¡d +:: +¡ršg +(); + +66  +G‘SŒšg +( +»´ +); + +73 + gCG_¥l™ +:: +CG_¥l™ +( +IÁTu¶e + & +aùive +,  +lvl +, cÚ¡ +R–©iÚ + & +cÚd_ +, + +74 +CG_»suÉ + * +T +, CG_»suÉ * +F +) { + +75 +R–©iÚ + + gcÚd + = +cÝy +( +cÚd_ +); + +76 +as£¹ +( +cÚd +. +has_sšgË_cÚjunù +()); + +78 +cÛf_t + + gc + = 0; + +79  + gpos + = -1; + +80 +GEQ_I‹¿tÜ + +G +( +cÚd +. +sšgË_cÚjunù +()); + +81 ià( + gG +) { + +82  +CÚ¡r_V¬s_I‹r + +cvi +(* +G +, +çl£ +); + gcvi +; cvi++) + +83 ià((* + gcvi +). + gcÛf + && (*cvi). + gv¬ +-> +kšd +(è=ð +IÅut_V¬ + + +84 && (* +cvi +). +v¬ +-> +g‘_pos™iÚ +(è> +pos +) { + +85 +pos + = (* +cvi +). +v¬ +-> +g‘_pos™iÚ +(); + +86 + gc + = (* +cvi +). +cÛf +; + +89 #iâdeà +NDEBUG + + +90 ià( + gpos + > + glvl + + 1) { + +91 +årštf +( +DebugFže +, "IÎeg® s¶™‡ˆlvÈ%d\n", +lvl +); + +92 + gcÚd +. +´efix_´št +( +DebugFže +); + +93 + gcode_g’_debug + = 1; + +97 +as£¹ +( +pos + =ð0 ||…o <ð +lvl + + 1); + +99 ià( + gpos + > 0 && + gc + > 0) { + +100 +CG_»suÉ + * + gfoo + = +T +; + +101 + gT + = +F +; + +102 + gF + = +foo +; + +103 ià( + gcode_g’_debug +) { + +104 +årštf +( +DebugFže +, + +105 "Rev”sšg cÏu£ iÀÃw s¶™‚od©†vÈ%d\n", +lvl +); + +106 + gcÚd +. +´efix_´št +( +DebugFže +); + +108 + gcÚd + = +Com¶em’t +( +cÚd +); + +110 + gcÚd +. +sim¶ify +(); + +112 +as£¹ +( +cÚd +. +has_sšgË_cÚjunù +()); + +115 +as£¹ +( +EQ_I‹¿tÜ +( +cÚd +. +sšgË_cÚjunù +())); + +117 + gisAùive + = +aùive +; + +118 + gcÚd™iÚ + = +cÚd +; + +119 + gËv– + = +lvl +; + +120 + gŒueCÏu£ + = +T +; + +121 + gçl£CÏu£ + = +F +; + +124 + g¡d +:: +¡ršg + +CG_¥l™ +:: +´štSŒuùu» +( +šd’t +) { + +125 +¡d +:: +¡ršg + +»suÉ + = +G‘Ind’tS·ûs +( +šd’t +) + "// split‡t " + +126 + +to_¡ršg +((*è +this +è+ "\n" + +G‘Ind’tS·ûs +( +šd’t +) + +127 + "// gu¬d:" + +gu¬d +. +´št_fÜmuÏ_to_¡ršg +() + "\n" + +128 + +G‘Ind’tS·ûs +( +šd’t +) + "// if " + +129 + +cÚd™iÚ +. +´št_fÜmuÏ_to_¡ršg +() + "hen\n" + +130 + +ŒueCÏu£ +-> +´štSŒuùu» +( +šd’t + + 1è+ +G‘Ind’tS·ûs +(indent) + +131 + "//ƒl£\n" + +çl£CÏu£ +-> +´štSŒuùu» +( +šd’t + + 1); + +132  + g»suÉ +; + +135 +CG_ouutR•r +* + gCG_¥l™ +:: +´štR•r +( +CG_ouutBužd” +* +ocg +,  +šd’t +, + +136 cÚ¡ +¡d +:: +veùÜ +< +CG_ouutR•r + *> & +assigÃd_Ú_the_æy +) { + +138 ià(! +Mu¡_Be_Sub£t +( +cÝy +( +»¡riùiÚs +), cÝy( +known +))) + +139 +´štf +("------------wrong------------------\n"); + +141 +CG_ouutR•r +* + g¡mtLi¡ +; + +143 +CG_ouutR•r + * + gù¾R•r + = +NULL +; + +144 ià(! + ggu¬d +. +is_nuÎ +(è&& !gu¬d. +is_obvious_utÞogy +()) { + +145 + gù¾R•r + = +ouutGu¬d +( +ocg +, +gu¬d +, +assigÃd_Ú_the_æy +); + +146 + gšd’t +++; + +148 ià( + gù¾R•r + !ð +NULL +) + +149 +¡mtLi¡ + = +ocg +-> +C»©eIf +( +šd’t + - 1, +ù¾R•r +, + +150 +ŒueCÏu£ +-> +´štR•r +( +ocg +, +šd’t +, +assigÃd_Ú_the_æy +), + +151 +çl£CÏu£ +-> +´štR•r +( +ocg +, +šd’t +, +assigÃd_Ú_the_æy +)); + +153 + g¡mtLi¡ + = +ocg +-> +StmtLi¡Aµ’d +( + +154 +ŒueCÏu£ +-> +´štR•r +( +ocg +, +šd’t +, +assigÃd_Ú_the_æy +), + +155 +çl£CÏu£ +-> +´štR•r +( +ocg +, +šd’t +, +assigÃd_Ú_the_æy +)); + +157  + g¡mtLi¡ +; + +160 +CG_»suÉ + * + gCG_¥l™ +:: +liáOv”h—d +( +d•th +) { + +161 +as£¹ +( +d•th + >= 1); + +162 + gŒueCÏu£ + = +ŒueCÏu£ +-> +liáOv”h—d +( +d•th +); + +163 + gçl£CÏu£ + = +çl£CÏu£ +-> +liáOv”h—d +( +d•th +); + +164  + gthis +; + +167 +CG_»suÉ + * + gCG_¥l™ +:: +fÜû_fš™e_bounds +() { + +168 +ŒueCÏu£ + =rueCÏu£-> +fÜû_fš™e_bounds +(); + +169 + gçl£CÏu£ + = +çl£CÏu£ +-> +fÜû_fš™e_bounds +(); + +170  + gthis +; + +173 +R–©iÚ + + gCG_¥l™ +:: +fšdOv”h—d +( +liáTo +) { + +174 +R–©iÚ + +r + = +ŒueCÏu£ +-> +fšdOv”h—d +( +liáTo +); + +175 ià( + gr +. +is_obvious_utÞogy +()) + +176 + gr + = +çl£CÏu£ +-> +fšdOv”h—d +( +liáTo +); + +177  + gr +; + +180 +CG_»suÉ + * + gCG_¥l™ +:: +»compu‹ +(cÚ¡ +R–©iÚ + & +k +, cÚ¡ R–©iÚ & +r +) { + +181 + gknown + = +cÝy +( +k +); + +182 + g»¡riùiÚs + = +cÝy +( +r +); + +184  + gnumAùive + = 0; + +185  + gs + = 1; s <ð +isAùive +. +size +(); s++) + +186 ià( + gisAùive +[ +s +]) { + +187 +R–©iÚ + + gI + = +´ojeùed_nIS +[ +Ëv– +][ +s +]; + +188 ià(! +IÁ”£ùiÚ +( +cÝy +( +»¡riùiÚs +), +I +). +is_uµ”_bound_§tisfŸbË +()) + +189 + gisAùive +[ +s +] = 0; + +191 + gnumAùive +++; + +193 ià( + gnumAùive + == 0) { + +194 +d–‘e + +this +; + +195  +Ãw + + gCG_nuÎ +; + +196 } ià( + gnumAùive + == 1 && 0) { + +199 +CG_»suÉ + * +cg + = +g’_»cursive +( +Ëv– +, +isAùive +); + +200 + gcg + = +cg +-> +»compu‹ +( +k +, +r +); + +201 +d–‘e + + gthis +; + +202  + gcg +; + +205 +R–©iÚ + + gÃw_»¡riùiÚs + = +IÁ”£ùiÚ +( +cÝy +( +»¡riùiÚs +), + +206 +cÝy +( +cÚd™iÚ +)); + +207 + gÃw_»¡riùiÚs +. +sim¶ify +(); + +208 + gŒueCÏu£ + = +ŒueCÏu£ +-> +»compu‹ +( +known +, +Ãw_»¡riùiÚs +); + +209 + gÃw_»¡riùiÚs + = +Difã»nû +( +cÝy +( +»¡riùiÚs +), cÝy( +cÚd™iÚ +)); + +210 + gÃw_»¡riùiÚs +. +sim¶ify +(); + +211 + gçl£CÏu£ + = +çl£CÏu£ +-> +»compu‹ +( +known +, +Ãw_»¡riùiÚs +); + +213 ià( + gŒueCÏu£ +-> +isNuÎ +()) { + +214 +CG_»suÉ + * + gcg + = +çl£CÏu£ +; + +215 + gçl£CÏu£ + = +NULL +; + +216 +d–‘e + + gthis +; + +217  + gcg +; + +219 ià( + gçl£CÏu£ +-> +isNuÎ +()) { + +220 +CG_»suÉ + * + gcg + = +ŒueCÏu£ +; + +221 + gŒueCÏu£ + = +NULL +; + +222 +d–‘e + + gthis +; + +223  + gcg +; + +225  + gthis +; + +228 +R–©iÚ + + gCG_¥l™ +:: +hoi¡Gu¬d +() { + +229 +R–©iÚ + +gu¬d1 + = +ŒueCÏu£ +-> +hoi¡Gu¬d +(); + +230 +R–©iÚ + + ggu¬d2 + = +çl£CÏu£ +-> +hoi¡Gu¬d +(); + +231 ià( + ggu¬d +. +is_nuÎ +()) + +232 + ggu¬d + = +R–©iÚ +:: +True +( +cÚd™iÚ +. +n_£t +()); + +234 ià(! + ggu¬d1 +. +is_obvious_utÞogy +(è&& ! + ggu¬d2 +.is_obvious_tautology() + +235 && +Mu¡_Be_Sub£t +( +cÝy +( +gu¬d1 +), cÝy( +gu¬d2 +)) + +236 && +Mu¡_Be_Sub£t +( +cÝy +( +gu¬d2 +), cÝy( +gu¬d1 +))) { + +237 + gŒueCÏu£ +-> +»moveGu¬d +(); + +238 + gçl£CÏu£ +-> +»moveGu¬d +(); + +239 + ggu¬d + = +IÁ”£ùiÚ +( +gu¬d +, +gu¬d1 +); + +242  + ggu¬d +; + +249 +R–©iÚ + + gCG_Ëaf +:: +fšdOv”h—d +( +liáTo +) { + +250  +s + = 1; + gs + <ð +isAùive +. +size +(); s++) + +251 ià( + gisAùive +[ +s +]) { + +252  + gbb + = ! +gu¬d +[ +s +]. +is_obvious_utÞogy +(); + +253 ià( + gbb +) { + +254 ià( + gcode_g’_debug +) + +255 +årštf +( +DebugFže +, + +257 +s +, +gu¬d +[s]. +´št_fÜmuÏ_to_¡ršg +(). +c_¡r +()); + +258 +R–©iÚ + + gr + = +pickOv”h—d +( +gu¬d +[ +s +], +liáTo +); + +259 ià(! + gr +. +is_obvious_utÞogy +()) + +260  + gr +; + +263  + gR–©iÚ +:: +True +( +known +. +n_£t +()); + +266 + g¡d +:: +¡ršg + +CG_Ëaf +:: +´štSŒuùu» +() { + +267 +¡d +:: +¡ršg + +»suÉ +; + +268  + gs + = 1; s <ð +isAùive +. +size +(); s++) + +269 ià( + gisAùive +[ +s +]) { + +270 + g»suÉ + +ð +¡d +:: +¡ršg +("s"è+ +to_¡ršg +( +s +); + +272  + g»suÉ + + "\n"; + +275 +CG_ouutR•r +* + gCG_Ëaf +:: +´štR•r +( +CG_ouutBužd” +* +ocg +,  +šd’t +, + +276 cÚ¡ +¡d +:: +veùÜ +< +CG_ouutR•r + *> & +assigÃd_Ú_the_æy +) { + +278 ià(! +Mu¡_Be_Sub£t +( +cÝy +( +»¡riùiÚs +), cÝy( +known +))) + +279 +´štf +("------------wrong------------------\n"); + +281 + g¡d +:: +¡ršg + +»suÉ +; + +282 +CG_ouutR•r +* + g¡mtLi¡ + = +NULL +; + +283 +CG_ouutR•r +* + g¡mtNode + = +NULL +; + +285 + gTu¶e +<> + gwÜkšg +; + +287 ià( + gcode_g’_debug + > 1) { + +288 + g»suÉ + = "known: " + +known +. +´št_fÜmuÏ_to_¡ršg +(); + +289 + g¡mtLi¡ + = +ocg +-> +StmtLi¡Aµ’d +( +¡mtLi¡ +, + +290 +ocg +-> +C»©eComm’t +( +šd’t +, +»suÉ +)); + +293  + gs + = 1; s <ð +isAùive +. +size +(); s++) + +294 ià( + gisAùive +[ +s +]) { + +295 ià( + ggu¬d +[ +s +]. +is_obvious_utÞogy +()) { + +296 + g¡mtNode + = +ouutS‹m’t +( +ocg +, +¡©em’tInfo +[ +s +]-> +þÚe +(), + +297 +šd’t +, +ŒªsfÜm©iÚs +[ +s +], +known +, +assigÃd_Ú_the_æy +); + +298 + g¡mtLi¡ + = +ocg +-> +StmtLi¡Aµ’d +( +¡mtLi¡ +, +¡mtNode +); + +300 ià( + gcode_g’_debug + > 1) { + +301 + g»suÉ + = "restrictions: " + +302 + +»¡riùiÚs +. +´št_fÜmuÏ_to_¡ršg +(); + +303 + g¡mtLi¡ + = +ocg +-> +StmtLi¡Aµ’d +( +¡mtLi¡ +, + +304 +ocg +-> +C»©eComm’t +( +šd’t +, +»suÉ +)); + +306 + gwÜkšg +. +­³nd +( +s +); + +311  + gi + = 1; i <ð +wÜkšg +. +size +(); i++) + +312 ià( + gwÜkšg +[ +i +] != 0) { + +313 +R–©iÚ + +g + = +IÁ”£ùiÚ +( +cÝy +( +gu¬d +[ +wÜkšg +[ +i +]]), cÝy( +known +)); + +314 + g¡mtNode + = +ouutS‹m’t +( +ocg +, +¡©em’tInfo +[ +wÜkšg +[ +i +]]-> +þÚe +(), + +315 +šd’t + + 1, +ŒªsfÜm©iÚs +[ +wÜkšg +[ +i +]], +g +, + +316 +assigÃd_Ú_the_æy +); + +318  + gj + = +i + + 1; j <ð +wÜkšg +. +size +(); j++) + +319 ià( + gwÜkšg +[ +j +] != 0) { + +320 ià( +Mu¡_Be_Sub£t +( +cÝy +( +gu¬d +[ +wÜkšg +[ +i +]]), + +321 +cÝy +( +gu¬d +[ +wÜkšg +[ +j +]])) + +322 && +Mu¡_Be_Sub£t +( +cÝy +( +gu¬d +[ +wÜkšg +[ +j +]]), + +323 +cÝy +( +gu¬d +[ +wÜkšg +[ +i +]]))) { + +324 +¡mtNode + = +ocg +-> +StmtLi¡Aµ’d +(stmtNode, + +325 +ouutS‹m’t +( +ocg +, + +326 +¡©em’tInfo +[ +wÜkšg +[ +j +]]-> +þÚe +(), + +327 +šd’t + + 1, +ŒªsfÜm©iÚs +[ +wÜkšg +[ +j +]], + +328 +g +, +assigÃd_Ú_the_æy +)); + +329 + gwÜkšg +[ +j +] = 0; + +333 +CG_ouutR•r + * + gifGu¬d + = +ouutGu¬d +( +ocg +, +gu¬d +[ +wÜkšg +[ +i +]], + +334 +assigÃd_Ú_the_æy +); + +335 + g¡mtNode + = +ocg +-> +C»©eIf +( +šd’t +, +ifGu¬d +, +¡mtNode +, +NULL +); + +336 + g¡mtLi¡ + = +ocg +-> +StmtLi¡Aµ’d +( +¡mtLi¡ +, +¡mtNode +); + +339  + g¡mtLi¡ +; + +342 +CG_»suÉ +* + gCG_Ëaf +:: +»compu‹ +(cÚ¡ +R–©iÚ + & +k +, cÚ¡ R–©iÚ & +r +) { + +343 + gknown + = +cÝy +( +k +); + +344 + g»¡riùiÚs + = +cÝy +( +r +); + +346 + ggu¬d +. +»®loÿ‹ +( +isAùive +. +size +()); + +348 +boÞ + + gªyAùive + = +çl£ +; + +349  + gs + = 1; s <ð +isAùive +. +size +(); s++) + +350 ià( + gisAùive +[ +s +]) { + +351 +R–©iÚ + + gI + = +IÁ”£ùiÚ +( +cÝy +( +»¡riùiÚs +), cÝy( +Ãw_IS +[ +s +])); + +352 ià(! + gI +. +is_uµ”_bound_§tisfŸbË +()) + +353 + gisAùive +[ +s +] = 0; + +355 + gªyAùive + = +Œue +; + +356 +as£¹ +(! +I +. +is_nuÎ +()); + +357 + ggu¬d +[ +s +] = +Gi¡ +( +cÝy +( +I +), cÝy( +known +), 1); + +363 ià(! + gªyAùive +) { + +364 +d–‘e + + gthis +; + +365  +Ãw + +CG_nuÎ +(); + +367  + gthis +; + +370 +R–©iÚ + + gCG_Ëaf +:: +hoi¡Gu¬d +() { + +371  +s +; + +372  + gs + = 1; s <ð +isAùive +. +size +(è&& !isAùive[ +s +]; s++) + +375 ià( + gs + > + gisAùive +. +size +()) + +376  + gR–©iÚ +:: +True +(1); + +378 +R–©iÚ + + ggu¬d1 + = +gu¬d +[ +s +]; + +380  + gi + = +s + + 1; i <ð +isAùive +. +size +(); i++) + +381 ià( + gisAùive +[ +i +] + +382 && !( +Mu¡_Be_Sub£t +( +cÝy +( +gu¬d1 +), cÝy( +gu¬d +[ +i +])) + +383 && +Mu¡_Be_Sub£t +( +cÝy +( +gu¬d +[ +i +]), cÝy( +gu¬d1 +)))) + +384  + gR–©iÚ +:: +True +( +gu¬d1 +. +n_£t +()); + +386  + ggu¬d1 +; + +389  + gCG_Ëaf +:: +»moveGu¬d +() { + +390  +i + = 1; + gi + <ð +isAùive +. +size +(); i++) + +391 ià( + gisAùive +[ +i +]) + +392 + ggu¬d +[ +i +] = +R–©iÚ +:: +True +( +gu¬d +[i]. +n_£t +()); + +399 +CG_»suÉ + * + gCG_loÝ +:: +fÜû_fš™e_bounds +() { + +400 ià(! +ÃedLoÝ + + +401 || ( +hasBound +( +bounds +, +Ëv– +, 0) && hasBound(bounds,†evel, 1))) { + +402 + gbody + = +body +-> +fÜû_fš™e_bounds +(); + +403  + gthis +; + +406 ià( + gcode_g’_debug +) + +407 +årštf +( +DebugFže +, "Don't have finite bounds in:\n%s\n\n", + +408 +this +-> +´št +(2). +c_¡r +()); + +409 +boÞ + + gbb + = ! +hasBound +( +bounds +, +Ëv– +, 0); + +410  + gdœeùiÚ + = +bb + ? 0 : 1; + +411  + gs +; + +412 +R–©iÚ + + gS +; + +413  + gs + = 1; s <ð +isAùive +. +size +(); s++) + +414 ià( + gisAùive +[ +s +]) + +415 ià( +fšd_ªy_cÚ¡¿št +( +s +, +Ëv– +, +»¡riùiÚs +, +dœeùiÚ +, +S +, + +416 +çl£ +)) + +420 ià( + gS +. +is_nuÎ +()) + +421  + gs + = 1; s <ð +isAùive +. +size +(); s++) + +422 ià( + gisAùive +[ +s +]) + +423 ià( +fšd_ªy_cÚ¡¿št +( +s +, +Ëv– +, +»¡riùiÚs +, +dœeùiÚ +, +S +, + +424 +Œue +)) + +427 ià( + gS +. +is_nuÎ +()) { + +429 +årštf +( +DebugFže +,"hasBound(%s,%d,%sè§id f®£, buˆov”h—d wa utÞogy\n", +I +. +´št_fÜmuÏ_to_¡ršg +(). +c_¡r +(), +Ëv– +, +dœeùiÚ +?"upper bound":"lower bound"); + +431 +throw + +codeg’_”rÜ +("unableo force finite bounds"); + +436 +´štf +("S¶™šg oÀ%s\n", +S +. +´št_fÜmuÏ_to_¡ršg +(). +c_¡r +()); + +438 +CG_»suÉ + * + g¥l + = +Ãw + +CG_¥l™ +( +isAùive +, +Ëv– +, +S +, +this +,his-> +þÚe +()); + +439 + g¥l + = +¥l +-> +»compu‹ +( +cÝy +( +known +), cÝy( +»¡riùiÚs +)); + +441 ià( + gcode_g’_debug +) + +442 +årštf +( +DebugFže +,"S¶™ oÀtØü—‹ fš™bounds:\n%s\n\n", +¥l +-> +´št +(2). +c_¡r +()); + +444  + g¥l +-> +fÜû_fš™e_bounds +(); + +447 +CG_»suÉ + * + gCG_loÝ +:: +liáOv”h—d +( +d•th +) { + +448 +as£¹ +( +d•th + >= 1); + +449 ià( + gthis +-> +d•th +(è< + gd•th +) + +450  + gthis +; + +451 ià(!( + gÃedLoÝ + && + gthis +-> +d•th +() == depth)) { + +452 +body + = body-> +liáOv”h—d +( +d•th +); + +453  + gthis +; + +456 +R–©iÚ + + gc + = +body +-> +fšdOv”h—d +( +Ëv– +); + +457 ià( + gc +. +is_obvious_utÞogy +()) + +458  + gthis +; + +459 +as£¹ +( +c +. +is_uµ”_bound_§tisfŸbË +()); + +460 + g¡d +:: +¡ršg + +befÜe +; + +461 ià( + gcode_g’_debug +) { + +462 + gbefÜe + = +´št +(1); + +464 +CG_»suÉ + * + gs + = +Ãw + +CG_¥l™ +( +isAùive +, +Ëv– +, +c +, +this +,his-> +þÚe +()); + +466 + gs + = +s +-> +»compu‹ +( +cÝy +( +known +), cÝy( +»¡riùiÚs +)); + +467 ià( + gcode_g’_debug +) { + +468 + g¡d +:: +¡ršg + +aá” + = +s +-> +´št +(1); + +469 +årštf +( +DebugFže +, "Lifted out overhead of %s\n", + +470 +c +. +´št_fÜmuÏ_to_¡ršg +(). +c_¡r +()); + +471 +årštf +( +DebugFže +, "äom:\n%s\n", +befÜe +. +c_¡r +()); + +472 +årštf +( +DebugFže +, "tØg‘:\n%s--\n", +aá” +. +c_¡r +()); + +474 + gs + = +s +-> +liáOv”h—d +( +d•th +); + +475  + gs +; + +478 + g¡d +:: +¡ršg + +CG_loÝ +:: +´štSŒuùu» +( +šd’t +) { + +479 +¡d +:: +¡ršg + +s + = ""; + +480  + gšdÁ + = +šd’t +; + +481 + gs + +ð +G‘Ind’tS·ûs +( +šd’t +è+ "//†oÝ" + ( +ÃedLoÝ + ? "" : "(single)") + +482 + " fÜ" + +to_¡ršg +( +Ëv– +è+ "‡ˆ" +o_¡ršg((*è +this +) + +484 + gs + +ð +G‘Ind’tS·ûs +( +šd’t +) + "// known: " + +485 + +known +. +´št_fÜmuÏ_to_¡ršg +() + "\n"; + +486 + gs + +ð +G‘Ind’tS·ûs +( +šd’t +) + "// guard: " + +487 + +gu¬d +. +´št_fÜmuÏ_to_¡ršg +() + "\n"; + +488 + gs + +ð +G‘Ind’tS·ûs +( +šd’t +) + "// bounds: " + +489 + +bounds +. +´št_fÜmuÏ_to_¡ršg +() + "\n"; + +492  + gi + = 1; i <ð +isAùive +. +size +(); i++) + +493 ià( + gisAùive +[ +i +]) { + +494 + gs + +ð +G‘Ind’tS·ûs +( +šd’t +è+ "// " + "s" + +to_¡ršg +( +i +) + ":" + +495 + +´ojeùed_nIS +[ +Ëv– +][ +i +]. +´št_fÜmuÏ_to_¡ršg +() + "\n"; + +498  + gs + + + gbody +-> +´štSŒuùu» +( +šdÁ + + 1è+ +G‘Ind’tS·ûs +(indnt + 1) + +502 +CG_ouutR•r +* + gCG_loÝ +:: +´štR•r +( +CG_ouutBužd” +* +ocg +,  +šd’t +, + +503 cÚ¡ +¡d +:: +veùÜ +< +CG_ouutR•r + *> & +assigÃd_Ú_the_æy +) { + +505 ià(! +Mu¡_Be_Sub£t +( +cÝy +( +»¡riùiÚs +), cÝy( +known +))) + +506 +´štf +("------------wrong------------------\n"); + +529 +CG_ouutR•r +* + ggu¬dR•r + = +ouutGu¬d +( +ocg +, +gu¬d +, +assigÃd_Ú_the_æy +); + +530 +R–©iÚ + + g’fÜûd + = +IÁ”£ùiÚ +( +cÝy +( +known +), cÝy( +gu¬d +)); + +531 + g’fÜûd +. +sim¶ify +(); + +536 + g¡d +:: +veùÜ +< +CG_ouutR•r + *> +aÙf + = +assigÃd_Ú_the_æy +; + +538 + g¡d +:: +·œ +< +CG_ouutR•r + *, + gboÞ +> + geqR•r + = +ouutAssignm’t +( +ocg +, +bounds +, + +539 +bounds +. +£t_v¬ +( +Ëv– +), +’fÜûd +, +gu¬dR•r +, +aÙf +); + +540 ià(! + geqR•r +. + g£cÚd +) + +541 + gaÙf +[ +Ëv– + - 1] = +eqR•r +. +fœ¡ +; + +543  + gšdÁ + = +šd’t +; + +544 ià( + ggu¬dR•r + !ð +NULL +) + +545 +šdÁ +++; + +548 ià( + gcheckLoÝLev– +) { + +549 ià( + gËv– + =ð +checkLoÝLev– +) { + +550 +boÞ + +¡mtP»£Á + = +çl£ +; + +551  + gs + = 1; s <ð +isAùive +. +size +(); s++) { + +552 ià( + gisAùive +[ +s +] && + gs + - 1 =ð +¡mtFÜLoÝCheck +) + +553 +¡mtP»£Á + = +Œue +; + +555 ià( + g¡mtP»£Á +) { + +556 + gfžlInBounds + = +Œue +; + +563 + g¡d +:: +·œ +< +CG_ouutR•r + *, + gboÞ +> + gù¾R•r + = +ouutBounds +( +ocg +, +bounds +, + +564 +bounds +. +£t_v¬ +( +Ëv– +), +šdÁ +, +’fÜûd +, +aÙf +); + +567 + gfžlInBounds + = +çl£ +; + +570 +R–©iÚ + + gËá_ov” + = +Gi¡ +( +cÝy +( +bounds +), cÝy( +’fÜûd +), 1); + +572 ià(! + gËá_ov” +. +is_obvious_utÞogy +()) + +573 +´štf +("=============something wrong===============\n"); + +575 +CG_ouutR•r + * + gloÝR•r + = +NULL +; + +576 ià( + geqR•r +. + g£cÚd +) { + +577 +CG_ouutR•r + * + gbodyR•r + = +body +-> +´štR•r +( +ocg +, +šdÁ +, +aÙf +); + +578 +CG_ouutR•r + * + gassignR•r + = +ocg +-> +C»©eAssignm’t +( +šdÁ +, + +579 +ocg +-> +C»©eId’t +( +bounds +. +£t_v¬ +( +Ëv– +)-> +Çme +()), +eqR•r +. +fœ¡ +); + +580 + gloÝR•r + = +ocg +-> +StmtLi¡Aµ’d +( +assignR•r +, +bodyR•r +); + +581 } ià( + gù¾R•r +. + g£cÚd +) { + +582 +CG_ouutR•r + * + gbodyR•r + = +body +-> +´štR•r +( +ocg +, +šdÁ + + 1, +aÙf +); + +583 + gloÝR•r + = +ocg +-> +C»©eLoÝ +( +šdÁ +, +ù¾R•r +. +fœ¡ +, +bodyR•r +); + +585 #ifdeà +BUILDCUDA + + +591 +boÞ + + gblockLoÝ + = +çl£ +; + +592 +boÞ + + gth»adLoÝ + = +çl£ +; + +593 +boÞ + + gsync + = +çl£ +; + +594  + gfœ¡AùiveStmt + = -1; + +595  + gs + = 1; s <ð +isAùive +. +size +(); s++) { + +596 ià( + gisAùive +[ +s +]) { + +597 ià( + gfœ¡AùiveStmt + < 0) + +598 + gfœ¡AùiveStmt + = +s +; + +602  + gidx + = +smtNÚS¶™Lev–s +[ +s +]. +šdex +( +Ëv– +); + +603 ià( + gidx + == 1) { + +604 +blockLoÝ + = +Œue +; + +607 ià( + gidx + == 2) { + +608 +th»adLoÝ + = +Œue +; + +612 ià( + gblockLoÝ + && + gth»adLoÝ +) { + +613 +årštf +( +¡d”r +, + +615 +Ëv– +); + +616 + gth»adLoÝ + = +çl£ +; + +618 + g¡d +:: +¡ršg + +´eã¼edIdx +; + +619 ià( + gloÝIdxNames +. +size +() + +620 && ( + gËv– + / 2è- 1 < + gloÝIdxNames +[ +fœ¡AùiveStmt +]. +size +()) + +621 + g´eã¼edIdx + = +loÝIdxNames +[ +fœ¡AùiveStmt +][( +Ëv– + / 2)]; + +622  + gs + = 1; s <ð +isAùive +. +size +(); s++) { + +623 ià( + gisAùive +[ +s +]) { + +624  + gi + = 0; i < + gsyncs +. +size +(); i++) { + +625 ià( + gsyncs +[ +i +]. + gfœ¡ + =ð +s + - 1 + +626 && +¡rcmp +( +syncs +[ +i +]. +£cÚd +. +c_¡r +(), + +627 +´eã¼edIdx +. +c_¡r +()) == 0) { + +628 +sync + = +Œue +; + +634 ià( + gth»adLoÝ + || + gblockLoÝ + || + g´eã¼edIdx +. +Ëngth +() != 0) { + +635  +buf +[1024]; + +636 + g¡d +:: +¡ršg + +loÝ +; + +637 ià( + gblockLoÝ +) + +638 + gloÝ + = "blockLoop "; + +639 ià( + gth»adLoÝ +) + +640 + gloÝ + = "threadLoop "; + +641 ià( + g´eã¼edIdx +. +Ëngth +(è!ð0 && +sync +) { + +642 +¥rštf +( +buf +, "~cuda~ %¥»ã¼edIdx: % sync", +loÝ +. +c_¡r +(), + +643 +´eã¼edIdx +. +c_¡r +()); + +644 } ià( + g´eã¼edIdx +. +Ëngth +() != 0) { + +645 +¥rštf +( +buf +, "~cuda~ %¥»ã¼edIdx: %s", +loÝ +. +c_¡r +(), + +646 +´eã¼edIdx +. +c_¡r +()); + +648 +¥rštf +( +buf +, "~cuda~ %s", +loÝ +. +c_¡r +()); + +651 #ifdeà +BUILD_ROSE + + +652 + gloÝR•r + = +ocg +-> +C»©eA‰ribu‹ +( +loÝR•r +, +buf +); + +658 + gloÝR•r + = +ocg +-> +StmtLi¡Aµ’d +(ocg-> +C»©eComm’t +( +šdÁ +, +buf +), + +659 +loÝR•r +); + +668 } ià( + gù¾R•r +. + gfœ¡ + !ð +NULL +) { + +669 +CG_ouutR•r + * +bodyR•r + = +body +-> +´štR•r +( +ocg +, +šdÁ +, +aÙf +); + +670 + gloÝR•r + = +ocg +-> +StmtLi¡Aµ’d +( +ù¾R•r +. +fœ¡ +, +bodyR•r +); + +672 + gloÝR•r + = +body +-> +´štR•r +( +ocg +, +šdÁ +, +aÙf +); + +674 ià( + ggu¬dR•r + !ð +NULL +) + +675 +loÝR•r + = +ocg +-> +C»©eIf +( +šd’t +, +gu¬dR•r +,†oÝR•r, +NULL +); + +677 +d–‘e + + gaÙf +[ +Ëv– + - 1]; + +678  + gloÝR•r +; + +757 +R–©iÚ + + gCG_loÝ +:: +fšdOv”h—d +( +liáTo +) { + +760 ià( +ÃedLoÝ +) { + +761  +bb + = ! +gu¬d +. +is_obvious_utÞogy +(); + +762 ià( + gbb +) { + +764 +årštf +( +DebugFže +,"Tryingo„emove overhead on guard of†oop %x‡t†evel %d: %s\n", + +765 (*è +this +, +Ëv– +, +gu¬d +. +´št_fÜmuÏ_to_¡ršg +(). +c_¡r +()); + +767 +R–©iÚ + + gr + = +pickOv”h—d +( +gu¬d +, +liáTo +); + +768 ià(! + gr +. +is_obvious_utÞogy +()) + +769  + gr +; + +771 +R–©iÚ + + gb + = +bounds +; + +772 +R–©iÚ + + gr + = +mšMaxOv”h—d +( +b +, +Ëv– +); + +773 ià(! + gr +. +is_obvious_utÞogy +()) { + +775 +årštf +( +DebugFže +,"Tryingo„emove minMax overhead on guard of†oop %x‡t†evel %d: %s\n", + +776 (*è +this +, +Ëv– +, +gu¬d +. +´št_fÜmuÏ_to_¡ršg +(). +c_¡r +()); + +778  + gr +; + +781 +R–©iÚ + + gr + = +body +-> +fšdOv”h—d +( +liáTo +); + +782 ià( + gr +. +is_obvious_utÞogy +()) + +783  + gr +; + +797 + gr + = +IÁ”£ùiÚ +( +r +, +cÝy +( +bounds +)); + +799 + gr + = +´ojeù_Úto_Ëv–s +( +r +, +Ëv– +, 0); + +801 + gr + = +Gi¡ +( +r +, +cÝy +( +bounds +), 1); + +804  + gr +; + +807 +CG_»suÉ + * + gCG_loÝ +:: +»compu‹ +(cÚ¡ +R–©iÚ + & +k +, cÚ¡ R–©iÚ & +r +) { + +808 + gknown + = +cÝy +( +k +); + +809 + g»¡riùiÚs + = +cÝy +( +r +); + +813 +boÞ + + gªyAùive + = +çl£ +; + +814  + gs + = 1; s <ð +isAùive +. +size +(); s++) + +815 ià( + gisAùive +[ +s +]) { + +816 ià(! +IÁ”£ùiÚ +( +cÝy +( +»¡riùiÚs +), + +817 +cÝy +( +´ojeùed_nIS +[ +Ëv– +][ +s +])). +is_uµ”_bound_§tisfŸbË +()) { + +818 + gisAùive +[ +s +] = 0; + +820 + gªyAùive + = +Œue +; + +823 ià(! + gªyAùive +) { + +824 +d–‘e + + gthis +; + +825  +Ãw + +CG_nuÎ +(); + +832 +R–©iÚ + + ghuÎ + = +HuÎ +( +´ojeùed_nIS +[ +Ëv– +], +isAùive +, 1, +Œue +, + +833 +cÝy +( +»¡riùiÚs +)); + +834 + ghuÎ + = +IÁ”£ùiÚ +( +huÎ +, +cÝy +( +»¡riùiÚs +)); + +835 + ghuÎ +. +sim¶ify +(2, 4); + +838 + gÃedLoÝ + = +Œue +; + +839  +EQ_I‹¿tÜ + + ge + = +huÎ +. +sšgË_cÚjunù +()-> +EQs +();ƒ;ƒ++) { + +840 ià(!(* + ge +). +has_wždÿrds +(è&& (*e). +g‘_cÛf +( +huÎ +. +£t_v¬ +( +Ëv– +)) != 0) { + +841 +ÃedLoÝ + = +çl£ +; + +842 + gbounds + = +R–©iÚ +:: +True +( +huÎ +. +n_£t +()); + +843 + gbounds +. +ªd_w™h_EQ +(* +e +); + +844 + gbounds +. +sim¶ify +(); + +845 + gbounds +. +cÝy_Çmes +( +huÎ +); + +846 + gbounds +. +£tup_Çmes +(); + +852 ià( + gÃedLoÝ +) { + +853 + ghuÎ + = +Gi¡ +( +huÎ +, +cÝy +( +known +), 1); + +854 +R–©iÚ + + gb + = +huÎ +; + +856 + gbounds + = +R–©iÚ +( +huÎ +. +n_£t +()); + +857 +F_Exi¡s + * + gã + = +bounds +. +add_ªd +()-> +add_exi¡s +(); + +858 +F_And + * + gf_roÙ + = +ã +-> +add_ªd +(); + +861 +boÞ + + ghas_uÄesÞved_bound + = +çl£ +; + +863 +CÚjunù + * + gc + = +b +. +sšgË_cÚjunù +(); + +864 +V¬ŸbË_ID + + gv + = +b +. +£t_v¬ +( +Ëv– +); + +865 + g¡d +:: +m­ + < +V¬ŸbË_ID +, + gV¬ŸbË_ID + > + gexi¡s_m­pšg +; + +866 + g¡d +:: +¡ack + < +¡d +:: +·œ +< +GEQ_HªdË +, + gV¬ŸbË_ID +> > + gæoÜ_geq_¡ack +; + +867 + g¡d +:: +£t + < +V¬ŸbË_ID + > +æoÜ_v¬_£t +; + +870  +GEQ_I‹¿tÜ + +gi +( +c +); + ggi +; gi++) + +871 ià((* + ggi +). +g‘_cÛf +( +v +) != 0) { + +872 +boÞ + +is_·¹_of_bound + = +Œue +; + +873 +GEQ_HªdË + + gh2 +; + +874  +CÚ¡r_V¬s_I‹r + +cvi +(* +gi +, +Œue +); + gcvi +; cvi++) + +875 ià(! +fšdFloÜIÃqu®™y +( +b +, +cvi +. +cu¼_v¬ +(), +h2 +, +v +)) { + +876 + ghas_uÄesÞved_bound + = +Œue +; + +877 + gis_·¹_of_bound + = +çl£ +; + +880 ià(! + gis_·¹_of_bound +) + +883 +GEQ_HªdË + + gh + = +f_roÙ +-> +add_GEQ +(); + +884  +CÚ¡r_V¬s_I‹r + +cvi +(* +gi +); + gcvi +; cvi++) { + +885 +V¬ŸbË_ID + + gv2 + = +cvi +. +cu¼_v¬ +(); + +886  + gv2 +-> +kšd +()) { + +887  + gIÅut_V¬ +: { + +888  +pos + = +v2 +-> +g‘_pos™iÚ +(); + +889 + gh +. +upd©e_cÛf +( +bounds +. +£t_v¬ +( +pos +), +cvi +. +cu¼_cÛf +()); + +892  + gExi¡s_V¬ +: + +893  +Wždÿrd_V¬ +: { + +894 +¡d +:: +m­ +< +V¬ŸbË_ID +, + gV¬ŸbË_ID +>:: +™”©Ü + +p + = + +895 +exi¡s_m­pšg +. +fšd +( +v2 +); + +896 +V¬ŸbË_ID + + ge +; + +897 ià( + gp + =ð +exi¡s_m­pšg +. +’d +()) { + +898 +e + = +ã +-> +deþ¬e +(); + +899 + gexi¡s_m­pšg +[ +v2 +] = +e +; + +901 + ge + = (* +p +). +£cÚd +; + +902 + gh +. +upd©e_cÛf +( +e +, +cvi +. +cu¼_cÛf +()); + +904 ià( + gæoÜ_v¬_£t +. +fšd +( +v2 +è=ð +æoÜ_v¬_£t +. +’d +()) { + +905 +fšdFloÜIÃqu®™y +( +b +, +v2 +, +h2 +, +v +); + +906 + gæoÜ_geq_¡ack +. +push +( +¡d +:: +make_·œ +( +h2 +, +v2 +)); + +907 + gæoÜ_v¬_£t +. +š£¹ +( +v2 +); + +911  + gGlob®_V¬ +: { + +912 +Glob®_V¬_ID + +g + = +v2 +-> +g‘_glob®_v¬ +(); + +913 +V¬ŸbË_ID + + gv3 +; + +914 ià( + gg +-> +¬™y +() == 0) + +915 +v3 + = +bounds +. +g‘_loÿl +( +g +); + +917 + gv3 + = +bounds +. +g‘_loÿl +( +g +, +v2 +-> +funùiÚ_of +()); + +918 + gh +. +upd©e_cÛf +( +v3 +, +cvi +. +cu¼_cÛf +()); + +922 +as£¹ +(0); + +925 + gh +. +upd©e_cÚ¡ +((* +gi +). +g‘_cÚ¡ +()); + +929 ! + gæoÜ_geq_¡ack +. +em±y +()) { + +930 + g¡d +:: +·œ + < +GEQ_HªdË +, + gV¬ŸbË_ID + > + gp + = +æoÜ_geq_¡ack +. +tÝ +(); + +931 + gæoÜ_geq_¡ack +. +pÝ +(); + +933 +GEQ_HªdË + + gh1 + = +f_roÙ +-> +add_GEQ +(); + +934 +GEQ_HªdË + + gh2 + = +f_roÙ +-> +add_GEQ +(); + +935  +CÚ¡r_V¬s_I‹r + +cvi +( +p +. +fœ¡ +); + gcvi +; cvi++) { + +936 +V¬ŸbË_ID + + gv2 + = (* +cvi +). +v¬ +; + +937  + gv2 +-> +kšd +()) { + +938  + gIÅut_V¬ +: { + +939  +pos + = +v2 +-> +g‘_pos™iÚ +(); + +940 + gh1 +. +upd©e_cÛf +( +bounds +. +šput_v¬ +( +pos +), +cvi +. +cu¼_cÛf +()); + +941 + gh2 +. +upd©e_cÛf +( +bounds +. +šput_v¬ +( +pos +), - +cvi +. +cu¼_cÛf +()); + +944  + gExi¡s_V¬ +: + +945  +Wždÿrd_V¬ +: { + +946 +¡d +:: +m­ +< +V¬ŸbË_ID +, + gV¬ŸbË_ID +>:: +™”©Ü + +p2 + = + +947 +exi¡s_m­pšg +. +fšd +( +v2 +); + +948 +V¬ŸbË_ID + + ge +; + +949 ià( + gp2 + =ð +exi¡s_m­pšg +. +’d +()) { + +950 +e + = +ã +-> +deþ¬e +(); + +951 + gexi¡s_m­pšg +[ +v2 +] = +e +; + +953 + ge + = (* +p2 +). +£cÚd +; + +954 + gh1 +. +upd©e_cÛf +( +e +, +cvi +. +cu¼_cÛf +()); + +955 + gh2 +. +upd©e_cÛf +( +e +, - +cvi +. +cu¼_cÛf +()); + +957 ià( + gæoÜ_v¬_£t +. +fšd +( +v2 +è=ð +æoÜ_v¬_£t +. +’d +()) { + +958 +GEQ_HªdË + +h3 +; + +959 +fšdFloÜIÃqu®™y +( +b +, +v2 +, +h3 +, +v +); + +960 + gæoÜ_geq_¡ack +. +push +( +¡d +:: +make_·œ +( +h3 +, +v2 +)); + +961 + gæoÜ_v¬_£t +. +š£¹ +( +v2 +); + +965  + gGlob®_V¬ +: { + +966 +Glob®_V¬_ID + +g + = +v2 +-> +g‘_glob®_v¬ +(); + +967 +V¬ŸbË_ID + + gv3 +; + +968 ià( + gg +-> +¬™y +() == 0) + +969 +v3 + = +bounds +. +g‘_loÿl +( +g +); + +971 + gv3 + = +bounds +. +g‘_loÿl +( +g +, +v2 +-> +funùiÚ_of +()); + +972 + gh1 +. +upd©e_cÛf +( +v3 +, +cvi +. +cu¼_cÛf +()); + +973 + gh2 +. +upd©e_cÛf +( +v3 +, - +cvi +. +cu¼_cÛf +()); + +977 +as£¹ +(0); + +980 + gh1 +. +upd©e_cÚ¡ +( +p +. +fœ¡ +. +g‘_cÚ¡ +()); + +981 + gh2 +. +upd©e_cÚ¡ +(- +p +. +fœ¡ +. +g‘_cÚ¡ +()); + +982 + gh2 +. +upd©e_cÚ¡ +(- +p +. +fœ¡ +. +g‘_cÛf +Õ. +£cÚd +) - 1); + +985 ià( + ghas_uÄesÞved_bound +) { + +986 + gb + = +Aµroxim©e +( +b +); + +987 + gb +. +sim¶ify +(); + +988 + gc + = +b +. +sšgË_cÚjunù +(); + +990  +GEQ_I‹¿tÜ + +gi +( +c +); + ggi +; gi++) + +991 ià((* + ggi +). +g‘_cÛf +( +v +) != 0) + +992 +f_roÙ +-> +add_GEQ +(* +gi +); + +996 +R–©iÚ + + gthe_gcs + = +g»©e¡_commÚ_¡• +( +´ojeùed_nIS +[ +Ëv– +], +isAùive +, + +997 +Ëv– +, +known +); + +998 + gbounds + = +IÁ”£ùiÚ +( +bounds +, +cÝy +( +the_gcs +)); + +999 + gbounds +. +sim¶ify +(); + +1000 + gbounds +. +cÝy_Çmes +( +huÎ +); + +1001 + gbounds +. +£tup_Çmes +(); + +1005 ià( + gÃedLoÝ +) { + +1006 + ggu¬d + = +Gi¡ +( +cÝy +( +huÎ +), cÝy( +bounds +)); + +1007 + ggu¬d + = +Projeù +( +gu¬d +, gu¬d. +£t_v¬ +( +Ëv– +)); + +1008 + ggu¬d + = +Gi¡ +( +gu¬d +, +cÝy +( +known +)); + +1009 + ggu¬d +. +sim¶ify +(); + +1014 + ggu¬d + = +R–©iÚ +:: +True +( +huÎ +. +n_£t +()); + +1016 + ggu¬d +. +cÝy_Çmes +( +huÎ +); + +1017 + ggu¬d +. +£tup_Çmes +(); + +1020 +R–©iÚ + + g’fÜûd + = +IÁ”£ùiÚ +( +cÝy +( +bounds +), cÝy( +gu¬d +)); + +1021 + g’fÜûd +. +sim¶ify +(); + +1022 +R–©iÚ + + gÃw_known + = +IÁ”£ùiÚ +( +cÝy +( +known +), cÝy( +’fÜûd +)); + +1023 + gÃw_known +. +sim¶ify +(); + +1024 +R–©iÚ + + gÃw_»¡riùiÚs + = +IÁ”£ùiÚ +( +cÝy +( +»¡riùiÚs +), + +1025 +cÝy +( +’fÜûd +)); + +1026 + gÃw_»¡riùiÚs +. +sim¶ify +(); + +1027 + gbody + = +body +-> +»compu‹ +( +Ãw_known +, +Ãw_»¡riùiÚs +); + +1028  + gthis +; + +1031 +R–©iÚ + + gCG_loÝ +:: +hoi¡Gu¬d +() { + +1032 +R–©iÚ + +r + = +body +-> +hoi¡Gu¬d +(); + +1033 ià(! + gr +. +is_obvious_utÞogy +()) { + +1035 +boÞ + + g­³¬ + = +çl£ +; + +1036  +DNF_I‹¿tÜ + +di +( +r +. +qu”y_DNF +()); + gdi +; di++) { + +1037  +GEQ_I‹¿tÜ + +gi +((* +di +)-> +GEQs +()); + ggi +; gi++) + +1038 ià((* + ggi +). +g‘_cÛf +( +r +. +£t_v¬ +( +Ëv– +)) != 0) { + +1039 +­³¬ + = +Œue +; + +1042 ià( + g­³¬ +) + +1045  +EQ_I‹¿tÜ + +ei +((* +di +)-> +EQs +()); + gei +;ƒi++) + +1046 ià((* + gei +). +g‘_cÛf +( +r +. +£t_v¬ +( +Ëv– +)) != 0) { + +1047 +­³¬ + = +Œue +; + +1050 ià( + g­³¬ +) + +1054 ià(! + g­³¬ +) { + +1055 + gbody +-> +»moveGu¬d +(); + +1056 + ggu¬d + = +IÁ”£ùiÚ +( +gu¬d +, +r +); + +1062 ià( + gÃedLoÝ +) + +1063  + gR–©iÚ +:: +True +( +bounds +. +n_£t +()); + +1065  + ggu¬d +; + + @CG_roseBuilder.cc + +15  + ~<¡ack +> + +16  + ~ + +17  + ~<¡ršg +> + +19  + gœ_”rÜ +: +public + +¡d +:: +ruÁime_”rÜ + { + +20 +œ_”rÜ +(cÚ¡ +¡d +:: +¡ršg + & +msg +) : + +21 +¡d +:: +ruÁime_”rÜ +( +msg +) { + +25 +usšg + +Çme¥aû + + gSageBužd” +; + +26 +usšg + +Çme¥aû + + gSageIÁ”çû +; + +27 +usšg + +Çme¥aû + + gOmpSuµÜt +; + +29 +Çme¥aû + + gomega + { + +34 * + gk_ocg_comm’t +; + +52 + gCG_ro£Bužd” +:: +CG_ro£Bužd” +( +SgGlob® +* +glob® +, SgGlob®* +fœ¡ScÝe +, + +53 +SgSymbÞTabË +* +symb +, SgSymbÞTabË* +symb2 +, +SgNode +* +roÙ +) : + +54 +glob®_ +( +glob® +), +glob®_scÝe +( +fœ¡ScÝe +), +symb_ +( +symb +), +symb2_ +( + +55 +symb2 +), +roÙ_ +( +roÙ +) { + +58 + gCG_ro£Bužd” +::~ +CG_ro£Bužd” +() { + +64 +CG_ouutR•r +* +CG_ro£Bužd” +:: +C»©ePÏûHÞd” +(, CG_ouutR•¸* +¡mt +, + +65 +Tu¶e +< +CG_ouutR•r +*> & +funcLi¡ +, Tu¶e< +¡d +:: +¡ršg +> & +loÝ_v¬s +) const { + +67 +SgS‹m’tPŒLi¡ +* +li¡ + = +¡©ic_ÿ¡ +< +CG_ro£R•r + *>( +¡mt +)-> +li¡_ +; + +68 +SgNode + * + gŠl +; + +69 +SgS‹m’t +* + g¡©em’t +; + +70 ià( + gli¡ + !ð +NULL +) { + +73 +d–‘e + +¡mt +; + +74  + gi + = 1; i <ð +funcLi¡ +. +size +(); i++) { + +76 ià(( + gfuncLi¡ +[ +i +] =ð +NULL +è&& (˜< +funcLi¡ +. +size +())) + +78 ià(( + gfuncLi¡ +[ +i +] =ð +NULL +è&& (˜=ð +funcLi¡ +. +size +())) + +81 +CG_ro£R•r + * + g»´ + = +¡©ic_ÿ¡ +( +funcLi¡ +[ +i +]); + +82 +SgEx´essiÚ +* + gÝ + = +»´ +-> +Ý_ +; + +84  + gSgS‹m’tPŒLi¡ +:: +™”©Ü + +™ + = (* +li¡ +). +begš +(); + +85 + g™ + !ð(* +li¡ +). +’d +(); it++) { + +86 + g¡©em’t + = (* +™ +); + +87 + gŠl + = +isSgNode +( +¡©em’t +); + +91  + gj +; + +92  + gnÙ_š_symb_ +; + +94 + gnÙ_š_symb_ + = 0; + +96 +SgV¬ŸbËSymbÞ + * + gvs + = +symb_ +-> +fšd_v¬ŸbË +( + +97 +SgName +( +loÝ_v¬s +[ +i +]. +c_¡r +())); + +99 ià( + gvs + =ð +NULL +) { + +101 +nÙ_š_symb_ + = 1; + +103 + gvs + = +symb2_ +-> +fšd_v¬ŸbË +( +SgName +( +loÝ_v¬s +[ +i +]. +c_¡r +())); + +105 ià( + gvs + !ð +NULL +) { + +109 +¡d +:: +veùÜ +< +SgV¬RefExp + *> +¬¿y + = +sub¡™u‹ +( +Šl +, + +110 (cÚ¡ +SgV¬ŸbËSymbÞ +*è +vs +, +Ý +, +roÙ_ +); + +111  + g¡d +:: +veùÜ +< +SgV¬RefExp + *>:: +™”©Ü + +™ + = + +112 +¬¿y +. +begš +(); + g™ + !ð¬¿y. +’d +(); it++) { + +115 ià( +isSgV¬RefExp +( +Ý +)) { + +116 ià( +¡rcmp +( + +117 +isSgV¬RefExp +( +Ý +)-> +g‘_symbÞ +()-> +g‘_Çme +(). +g‘SŒšg +(). +c_¡r +(), + +118 +vs +-> +g‘_Çme +(). +g‘SŒšg +(). +c_¡r +())) { + +120 (* + g™ +)-> +£t_symbÞ +( + +121 +isSgV¬RefExp +( +Ý +)-> +g‘_symbÞ +()); + +127 } ià( +isSgEx´essiÚ +( +Ý +)) { + +129 ià( +isSgBš¬yOp +((* +™ +)-> +g‘_·»Á +())) + +130 +isSgBš¬yOp +((* +™ +)-> +g‘_·»Á +())-> +»¶aû_ex´essiÚ +( + +131 * +™ +, +Ý +); + +143 +d–‘e + + g»´ +; + +144 + gfuncLi¡ +[ +i +] = +NULL +; + +146 ià( + gfuncLi¡ +[ +i +] !ð +NULL +) + +147 +throw + +œ_”rÜ +("not freed…roperly"); + +151  +Ãw + +CG_ro£R•r +( +li¡ +); + +154 + gŠl + = +¡©ic_ÿ¡ +< +CG_ro£R•r + *>( +¡mt +)-> +Šl_ +; + +157 ià( + gŠl + =ð +NULL +) + +158 +throw + +œ_”rÜ +("both†ist‡ndnl‡re‚ull!!"); + +160 +d–‘e + + g¡mt +; + +161  + gj +; + +162  + gnÙ_š_symb_ +; + +163  + gi + = 1; i <ð +funcLi¡ +. +size +(); i++) { + +164 + gnÙ_š_symb_ + = 0; + +166 ià(( + gfuncLi¡ +[ +i +] =ð +NULL +è&& (˜< +funcLi¡ +. +size +())) + +168 ià(( + gfuncLi¡ +[ +i +] =ð +NULL +è&& (˜=ð +funcLi¡ +. +size +())) + +171 +CG_ro£R•r + * + g»´ + = +¡©ic_ÿ¡ +( +funcLi¡ +[ +i +]); + +172 +SgEx´essiÚ +* + gÝ + = +»´ +-> +Ý_ +; + +173 +d–‘e + + g»´ +; + +174 + gfuncLi¡ +[ +i +] = +NULL +; + +176 +SgV¬ŸbËSymbÞ + * + gvs + = +symb_ +-> +fšd_v¬ŸbË +( + +177 +SgName +( +loÝ_v¬s +[ +i +]. +c_¡r +())); + +179 ià( + gvs + =ð +NULL +) { + +181 +nÙ_š_symb_ + = 1; + +183 + gvs + = +symb2_ +-> +fšd_v¬ŸbË +( +SgName +( +loÝ_v¬s +[ +i +]. +c_¡r +())); + +185 ià( + gvs + !ð +NULL +) { + +188 +¡d +:: +veùÜ +< +SgV¬RefExp + *> +¬¿y + = +sub¡™u‹ +( +Šl +, +vs +, +Ý +, + +189 +roÙ_ +); + +191 ià( + gnÙ_š_symb_ + && +isSgV¬RefExp +( +Ý +)) { + +192 ià( +¡rcmp +( + +193 +isSgV¬RefExp +( +Ý +)-> +g‘_symbÞ +()-> +g‘_Çme +(). +g‘SŒšg +(). +c_¡r +(), + +194 +vs +-> +g‘_Çme +(). +g‘SŒšg +(). +c_¡r +())) { + +205  + g¡d +:: +veùÜ +< +SgV¬RefExp + *>:: +™”©Ü + +j + = +¬¿y +. +begš +(); + +206 + gj + !ð +¬¿y +. +’d +(); j++) { + +209 ià( +isSgV¬RefExp +( +Ý +)) { + +210 ià( +¡rcmp +( + +211 +isSgV¬RefExp +( +Ý +)-> +g‘_symbÞ +()-> +g‘_Çme +(). +g‘SŒšg +(). +c_¡r +(), + +212 +vs +-> +g‘_Çme +(). +g‘SŒšg +(). +c_¡r +())) { + +213 (* + gj +)-> +£t_symbÞ +( +isSgV¬RefExp +( +Ý +)-> +g‘_symbÞ +()); + +218 } ià( +isSgEx´essiÚ +( +Ý +)) { + +220 ià( +isSgBš¬yOp +((* +j +)-> +g‘_·»Á +())) + +221 +isSgBš¬yOp +((* +j +)-> +g‘_·»Á +())-> +»¶aû_ex´essiÚ +( + +222 * +j +, +Ý +); + +297  +Ãw + +CG_ro£R•r +( +Šl +); + +305 +CG_ouutR•r +* + gCG_ro£Bužd” +:: +C»©eAssignm’t +(, CG_ouutR•¸* +lhs +, + +306 +CG_ouutR•r + * +rhs +) const { + +307 ià( + glhs + =ð +NULL + || +rhs + == NULL) { + +308 +årštf +( +¡d”r +, "Code generation: Missing†hs or„hs\n"); + +309  + gNULL +; + +312 +SgEx´essiÚ +* + g¤c + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +rhs +)-> +Ý_ +; + +313 +SgEx´essiÚ +* + gd¡ + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +lhs +)-> +Ý_ +; + +315 +SgEx´S‹m’t +* + gšs + = +buždAssignS‹m’t +( +d¡ +, +¤c +); + +316 + g¤c +-> +£t_·»Á +( +šs +); + +317 + gd¡ +-> +£t_·»Á +( +šs +); + +319 +SgS‹m’tPŒLi¡ +* + gÃw_li¡ + = +Ãw + SgStatementPtrList; + +321 (* + gÃw_li¡ +). +push_back +( +isSgS‹m’t +( +šs +)); + +323 +d–‘e + + glhs +; + +324 +d–‘e + + grhs +; + +326  +Ãw + +CG_ro£R•r +( +Ãw_li¡ +); + +333 +CG_ouutR•r +* + gCG_ro£Bužd” +:: +C»©eInvoke +(cÚ¡ +¡d +:: +¡ršg + & +âame +, + +334 +Tu¶e +< +CG_ouutR•r +*> & +li¡ +) const { + +336 ià( + gâame + =ð +¡d +:: +¡ršg +("max"è|| +âame + == std::string("min")) { + +337 ià( +li¡ +. +size +() == 0) { + +338  +NULL +; + +339 } ià( + gli¡ +. +size +() == 1) { + +340  +li¡ +[1]; + +342  + gÏ¡ + = +li¡ +. +size +(); + +343 +SgEx´essiÚ +* + gÝ2 + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +li¡ +[ +Ï¡ +])-> +Ý_ +; + +344 +d–‘e + + gli¡ +[ +Ï¡ +]; + +345 + gli¡ +. +d–‘e_Ï¡ +(); + +346 +CG_ro£R•r + * + g»´ + = +¡©ic_ÿ¡ +( +C»©eInvoke +( +âame +, + +347 +li¡ +)); + +348 +SgEx´essiÚ +* + gÝ1 + = +»´ +-> +Ý_ +; + +350 +SgEx´essiÚ + * + gšs +; + +351 +SgEx´Li¡Exp +* + g¬g_li¡ + = +buždEx´Li¡Exp +(); + +352 +­³ndEx´essiÚ +( +¬g_li¡ +, +Ý1 +); + +353 +­³ndEx´essiÚ +( +¬g_li¡ +, +Ý2 +); + +354 +SgV¬RefExp +* + gÝaque_v¬ +; + +356 ià( + gâame + =ð +¡d +:: +¡ršg +("max")) { + +357 +Ýaque_v¬ + = +buždO·queV¬RefExp +("__ro£_gt", +glob®_ +); + +358 + gšs + = +isSgEx´essiÚ +( + +359 +buždFunùiÚC®lExp +( +Ýaque_v¬ +, +¬g_li¡ +)); + +362 + gÝaque_v¬ + = +buždO·queV¬RefExp +("__ro£_É", +glob®_ +); + +363 + gšs + = +isSgEx´essiÚ +( + +364 +buždFunùiÚC®lExp +( +Ýaque_v¬ +, +¬g_li¡ +)); + +366 + g»´ +-> + gÝ_ + = +šs +; + +368  + g»´ +; + +371 +årštf +( +¡d”r +, + +373  + gNULL +; + +381 +CG_ouutR•r +* + gCG_ro£Bužd” +:: +C»©eComm’t +(, + +382 cÚ¡ +¡d +:: +¡ršg + & +comm’tText +) const { + +383 ià( +comm’tText + =ð +¡d +:: +¡ršg +("")) { + +384  +NULL +; + +387 +SgLoÿ‹dNode + * + gŠl + = +Ãw + SgLocatedNode(); + +388 +buždComm’t +( +Šl +, "//omega_comm’t: " + +comm’tText +); + +390  +Ãw + +CG_ro£R•r +( +isSgNode +( +Šl +)); + +397 +CG_ouutR•r +* + gCG_ro£Bužd” +:: +C»©eIf +(, CG_ouutR•¸* +gu¬dLi¡ +, + +398 +CG_ouutR•r + * +Œue_¡mtLi¡ +, CG_ouutR•¸* +çl£_¡mtLi¡ +) const { + +404 ià( + gŒue_¡mtLi¡ + =ð +NULL + && +çl£_¡mtLi¡ + == NULL) { + +405 +d–‘e + +gu¬dLi¡ +; + +406  + gNULL +; + +407 } ià( + ggu¬dLi¡ + =ð +NULL +) { + +408  +StmtLi¡Aµ’d +( +Œue_¡mtLi¡ +, +çl£_¡mtLi¡ +); + +411 +SgEx´essiÚ +* + gh—d” + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +gu¬dLi¡ +)-> +Ý_ +; + +413 +SgS‹m’tPŒLi¡ + * + gth’_·¹1 +, * + g–£_·¹1 +; + +414 +SgS‹m’t +* + gth’_·¹ +; + +415 +SgS‹m’t +* + g–£_·¹ +; + +416 +SgBasicBlock +* + gth’_·¹2 +; + +417 +SgBasicBlock +* + g–£_·¹2 +; + +418 ià( + gŒue_¡mtLi¡ + !ð +NULL +) { + +419 +th’_·¹1 + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +Œue_¡mtLi¡ +)-> +li¡_ +; + +420 ià( + gth’_·¹1 + !ð +NULL +) { + +421 +th’_·¹ + = *((* +th’_·¹1 +). +begš +()); + +423 ià((* + gth’_·¹1 +). +size +() > 1) { + +424 + gth’_·¹2 + = +buždBasicBlock +(); + +425  + gSgS‹m’tPŒLi¡ +:: +™”©Ü + +™ + = (* +th’_·¹1 +). +begš +(); + +426 + g™ + !ð(* +th’_·¹1 +). +’d +(); it++) { + +427 + gth’_·¹2 +-> +­³nd_¡©em’t +(* +™ +); + +430 + gth’_·¹ + = +isSgS‹m’t +( +th’_·¹2 +); + +434 + gth’_·¹ + = +isSgS‹m’t +( + +435 +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +Œue_¡mtLi¡ +)-> +Šl_ +); + +437 + gth’_·¹ + = +NULL +; + +439 ià( + gçl£_¡mtLi¡ + !ð +NULL +) { + +440 +–£_·¹1 + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +çl£_¡mtLi¡ +)-> +li¡_ +; + +441 ià( + g–£_·¹1 + !ð +NULL +) { + +442 +–£_·¹ + = *((* +–£_·¹1 +). +begš +()); + +443 ià((* + g–£_·¹1 +). +size +() > 1) { + +444 + g–£_·¹2 + = +buždBasicBlock +(); + +445  + gSgS‹m’tPŒLi¡ +:: +™”©Ü + +™2 + = (* +–£_·¹1 +). +begš +(); + +446 + g™2 + !ð(* +–£_·¹1 +). +’d +(); it2++) { + +447 + g–£_·¹2 +-> +­³nd_¡©em’t +(* +™2 +); + +450 + g–£_·¹ + = +isSgS‹m’t +( +–£_·¹2 +); + +454 + g–£_·¹ + = +isSgS‹m’t +( + +455 +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +çl£_¡mtLi¡ +)-> +Šl_ +); + +457 + g–£_·¹ + = +NULL +; + +460 +SgIfStmt +* + gti + = +buždIfStmt +( +h—d” +, +isSgS‹m’t +( +th’_·¹ +), + +461 +isSgS‹m’t +( +–£_·¹ +)); + +468 +d–‘e + + ggu¬dLi¡ +; + +469 +d–‘e + + gŒue_¡mtLi¡ +; + +470 +d–‘e + + gçl£_¡mtLi¡ +; + +472  +Ãw + +CG_ro£R•r +( +isSgNode +( +ti +)); + +479 +CG_ouutR•r +* + gCG_ro£Bužd” +:: +C»©eInduùive +(CG_ouutR•¸* +šdex +, + +480 +CG_ouutR•r + * +low” +, CG_ouutR•¸* +uµ” +, CG_ouutR•¸* +¡• +) const { + +482 ià( + gšdex + =ð +NULL + || +low” + =ðNULL || +uµ” + == NULL) { + +483 +årštf +( +¡d”r +, + +485  + gNULL +; + +488 ià( + g¡• + =ð +NULL +) + +489 +¡• + = +Ãw + +CG_ro£R•r +( +isSgEx´essiÚ +( +buždIÁV® +(1))); + +491 +SgV¬RefExp + * + gšdex_sym + = +isSgV¬RefExp +( + +492 +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +šdex +)-> +Ý_ +); + +493 +SgEx´essiÚ +* + glow”_bound + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +low” +)-> +Ý_ +; + +494 +SgEx´essiÚ +* + guµ”_bound + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +uµ” +)-> +Ý_ +; + +495 +SgEx´essiÚ +* + g¡•_size + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +¡• +)-> +Ý_ +; + +501 +SgS‹m’t +* + gfÜ_š™_¡mt + = +buždAssignS‹m’t +( +šdex_sym +, +low”_bound +); + +502 +SgLessOrEqu®Op +* + gcÚd + = +buždLessOrEqu®Op +( +šdex_sym +, +uµ”_bound +); + +503 +SgEx´S‹m’t +* + g‹¡ + = +buždEx´S‹m’t +( +cÚd +); + +504 +SgPlusAssignOp +* + gšüem’t + = +buždPlusAssignOp +( +šdex_sym +, +¡•_size +); + +505 +SgFÜS‹m’t + * + gfÜ_¡mt + = +buždFÜS‹m’t +( +fÜ_š™_¡mt +, + +506 +isSgS‹m’t +( +‹¡ +), +šüem’t +, +NULL +); + +508 +d–‘e + + gšdex +; + +509 +d–‘e + + glow” +; + +510 +d–‘e + + guµ” +; + +511 +d–‘e + + g¡• +; + +513  +Ãw + +CG_ro£R•r +( +isSgNode +( +fÜ_¡mt +)); + +520 +CG_ouutR•r +* + gCG_ro£Bužd” +:: +C»©eA‰ribu‹ +(CG_ouutR•¸* +cÚŒÞ +, + +521 cÚ¡ +¡d +:: +¡ršg + & +comm’tText +) const { + +523 +SgNode + * +Šl + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +cÚŒÞ +)-> +Šl_ +; + +525 + gŠl +-> +£tA‰ribu‹ +("omega_comm’t", +Ãw + +A¡TextA‰ribu‹ +( +comm’tText +)); + +527  + g¡©ic_ÿ¡ +< + gCG_ro£R•r +*>( + gcÚŒÞ +); + +534 +CG_ouutR•r +* + gCG_ro£Bužd” +:: +C»©eLoÝ +(, CG_ouutR•¸* +cÚŒÞ +, + +535 +CG_ouutR•r + * +¡mtLi¡ +) const { + +536 ià( + g¡mtLi¡ + =ð +NULL +) { + +537 +d–‘e + +cÚŒÞ +; + +538  + gNULL +; + +539 } ià( + gcÚŒÞ + =ð +NULL +) { + +540 +årštf +( +¡d”r +, "Code generation:‚o inductive forhis†oop\n"); + +541  + g¡mtLi¡ +; + +544 +SgNode + * + gŠl + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +cÚŒÞ +)-> +Šl_ +; + +545 +SgFÜS‹m’t + * + gtf + = +isSgFÜS‹m’t +( +Šl +); + +547 +SgS‹m’tPŒLi¡ + * + gbody + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +¡mtLi¡ +)-> +li¡_ +; + +549 ià( + gbody + !ð +NULL +) { + +550 ià(!((* +body +). +em±y +())) { + +551 ià((* +body +). +size +() == 1) { + +553 +tf +-> +£t_loÝ_body +(*((* +body +). +begš +())); + +554 (*((* + gbody +). +begš +()))-> +£t_·»Á +( +tf +); + +564 +SgBasicBlock +* + gbb + = +buždBasicBlock +(); + +565 + gbb +-> +£t_·»Á +( +tf +); + +566  + gSgS‹m’tPŒLi¡ +:: +™”©Ü + +™ + = (* +body +). +begš +(); + +567 + g™ + !ð(* +body +). +’d +(); it++) { + +568 + gbb +-> +­³nd_¡©em’t +(* +™ +); + +569 (* + g™ +)-> +£t_·»Á +( +bb +); + +571 + gtf +-> +£t_loÝ_body +( +bb +); + +576 +SgNode +* + gŠl2 + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +¡mtLi¡ +)-> +Šl_ +; + +578 ià( + gŠl2 + !ð +NULL +) { + +579 +tf +-> +£t_loÝ_body +( +isSgS‹m’t +( +Šl2 +)); + +580 + gŠl2 +-> +£t_·»Á +( +tf +); + +584 +d–‘e + + g¡mtLi¡ +; + +586  + gcÚŒÞ +; + +592 +CG_ouutR•r +* + gCG_ro£Bužd” +:: +C»©eIÁ +( +_i +) const { + +593  +Ãw + +CG_ro£R•r +( +isSgEx´essiÚ +( +buždIÁV® +( +_i +))); + +596 +CG_ouutR•r +* + gCG_ro£Bužd” +:: +C»©eId’t +(cÚ¡ +¡d +:: +¡ršg + & +_s +) const { + +598 +SgV¬ŸbËSymbÞ + * +vs + = +symb_ +-> +fšd_v¬ŸbË +( +SgName +( +_s +. +c_¡r +())); + +599 +SgV¬ŸbËSymbÞ + * + gvs2 + = +symb2_ +-> +fšd_v¬ŸbË +( +SgName +( +_s +. +c_¡r +())); + +601 ià( + gvs + =ð +NULL + && +vs2 + == NULL) { + +603 +SgV¬ŸbËDeþ¬©iÚ +* +deâ + = +buždV¬ŸbËDeþ¬©iÚ +( + +604 +SgName +( +_s +. +c_¡r +()), +buždIÁTy³ +()); + +605 + gSgIn™ŸlizedNamePŒLi¡ +& + gv¬ŸbËs + = +deâ +-> +g‘_v¬ŸbËs +(); + +606 + gSgIn™ŸlizedNamePŒLi¡ +:: +cÚ¡_™”©Ü + +i + = +v¬ŸbËs +. +begš +(); + +607 +SgIn™ŸlizedName +* + gš™ŸlizedName + = * +i +; + +608 + gvs + = +Ãw + +SgV¬ŸbËSymbÞ +( +š™ŸlizedName +); + +609 +´•’dS‹m’t +( +deâ +, +isSgScÝeS‹m’t +( +roÙ_ +)); + +611 + gvs +-> +£t_·»Á +( +symb2_ +); + +612 + gsymb2_ +-> +š£¹ +( +SgName +( +_s +. +c_¡r +()), +vs +); + +613  +Ãw + +CG_ro£R•r +( +isSgEx´essiÚ +( +buždV¬RefExp +( +vs +))); + +619 ià(! +isSgEx´essiÚ +( +buždV¬RefExp +( +SgName +( +_s +. +c_¡r +())))) + +620 +throw + +œ_”rÜ +("error in Create ident!!"); + +621 ià( + gvs2 + !ð +NULL +) + +622  +Ãw + +CG_ro£R•r +( +isSgEx´essiÚ +( +buždV¬RefExp +( +vs2 +))); + +624  +Ãw + +CG_ro£R•r +( +isSgEx´essiÚ +( +buždV¬RefExp +( +vs +))); + +631 +CG_ouutR•r +* + gCG_ro£Bužd” +:: +C»©ePlus +(CG_ouutR•¸* +lÝ +, + +632 +CG_ouutR•r + * +rÝ +) const { + +633 ià( + grÝ + =ð +NULL +) { + +634  +lÝ +; + +635 } ià( + glÝ + =ð +NULL +) { + +636  +rÝ +; + +639 +SgEx´essiÚ +* + gÝ1 + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +lÝ +)-> +Ý_ +; + +640 +SgEx´essiÚ +* + gÝ2 + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +rÝ +)-> +Ý_ +; + +642 +SgAddOp + * + gšs + = +buždAddOp +( +Ý1 +, +Ý2 +); + +643 + gÝ1 +-> +£t_·»Á +( +šs +); + +644 + gÝ2 +-> +£t_·»Á +( +šs +); + +645 +d–‘e + + glÝ +; + +646 +d–‘e + + grÝ +; + +648  +Ãw + +CG_ro£R•r +( +isSgEx´essiÚ +( +šs +)); + +652 +CG_ouutR•r +* + gCG_ro£Bužd” +:: +C»©eMšus +(CG_ouutR•¸* +lÝ +, + +653 +CG_ouutR•r + * +rÝ +) const { + +654 ià( + grÝ + =ð +NULL +) { + +655  +lÝ +; + +656 } ià( + glÝ + =ð +NULL +) { + +657 +SgEx´essiÚ + * +Ý + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +rÝ +)-> +Ý_ +; + +658 +SgMšusOp + * + gšs + = +buždMšusOp +( +Ý +); + +660 +d–‘e + + grÝ +; + +662  +Ãw + +CG_ro£R•r +( +isSgEx´essiÚ +( +šs +)); + +664 +SgEx´essiÚ +* + gÝ1 + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +lÝ +)-> +Ý_ +; + +665 +SgEx´essiÚ +* + gÝ2 + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +rÝ +)-> +Ý_ +; + +667 +SgSubŒaùOp + * + gšs + = +buždSubŒaùOp +( +Ý1 +, +Ý2 +); + +668 + gÝ1 +-> +£t_·»Á +( +šs +); + +669 + gÝ2 +-> +£t_·»Á +( +šs +); + +670 +d–‘e + + glÝ +; + +671 +d–‘e + + grÝ +; + +672  +Ãw + +CG_ro£R•r +( +isSgEx´essiÚ +( +šs +)); + +677 +CG_ouutR•r +* + gCG_ro£Bužd” +:: +C»©eTimes +(CG_ouutR•¸* +lÝ +, + +678 +CG_ouutR•r + * +rÝ +) const { + +679 ià( + grÝ + =ð +NULL + || +lÝ + == NULL) { + +680 ià( +rÝ + !ð +NULL +) { + +681 +rÝ +-> +þ—r +(); + +682 +d–‘e + + grÝ +; + +684 ià( + glÝ + !ð +NULL +) { + +685 +lÝ +-> +þ—r +(); + +686 +d–‘e + + glÝ +; + +688  + gNULL +; + +691 +SgEx´essiÚ +* + gÝ1 + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +lÝ +)-> +Ý_ +; + +692 +SgEx´essiÚ +* + gÝ2 + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +rÝ +)-> +Ý_ +; + +694 +SgMuÉlyOp + * + gšs + = +buždMuÉlyOp +( +Ý1 +, +Ý2 +); + +695 + gÝ1 +-> +£t_·»Á +( +šs +); + +696 + gÝ2 +-> +£t_·»Á +( +šs +); + +697 +d–‘e + + glÝ +; + +698 +d–‘e + + grÝ +; + +700  +Ãw + +CG_ro£R•r +( +isSgEx´essiÚ +( +šs +)); + +704 +CG_ouutR•r +* + gCG_ro£Bužd” +:: +C»©eIÁeg”Divide +(CG_ouutR•¸* +lÝ +, + +705 +CG_ouutR•r + * +rÝ +) const { + +706 ià( + grÝ + =ð +NULL +) { + +707 +årštf +( +¡d”r +, "Code generation: divide by NULL\n"); + +708  + gNULL +; + +709 } ià( + glÝ + =ð +NULL +) { + +710 +d–‘e + +rÝ +; + +711  + gNULL +; + +715 +SgEx´essiÚ +* + gÝ1 + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +lÝ +)-> +Ý_ +; + +716 +SgEx´essiÚ +* + gÝ2 + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +rÝ +)-> +Ý_ +; + +719 +SgDivideOp + * + gšs + = +buždDivideOp +( +Ý1 +, +Ý2 +); + +721 +d–‘e + + glÝ +; + +722 +d–‘e + + grÝ +; + +724  +Ãw + +CG_ro£R•r +( +isSgEx´essiÚ +( +šs +)); + +728 +CG_ouutR•r +* + gCG_ro£Bužd” +:: +C»©eIÁeg”Mod +(CG_ouutR•¸* +lÝ +, + +729 +CG_ouutR•r + * +rÝ +) const { + +730 ià( + grÝ + =ð +NULL + || +lÝ + == NULL) { + +731  +NULL +; + +734 +SgEx´essiÚ +* + gÝ1 + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +lÝ +)-> +Ý_ +; + +735 +SgEx´essiÚ +* + gÝ2 + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +rÝ +)-> +Ý_ +; + +738 +SgModOp + * + gšs + = +buždModOp +( +Ý1 +, +Ý2 +); + +740 +d–‘e + + glÝ +; + +741 +d–‘e + + grÝ +; + +743  +Ãw + +CG_ro£R•r +( +isSgEx´essiÚ +( +šs +)); + +750 +CG_ouutR•r +* + gCG_ro£Bužd” +:: +C»©eAnd +(CG_ouutR•¸* +lÝ +, + +751 +CG_ouutR•r + * +rÝ +) const { + +752 ià( + grÝ + =ð +NULL + || +lÝ + == NULL) { + +753  +NULL +; + +756 +SgEx´essiÚ +* + gÝ1 + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +lÝ +)-> +Ý_ +; + +757 +SgEx´essiÚ +* + gÝ2 + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +rÝ +)-> +Ý_ +; + +759 +SgAndOp + * + gšs + = +buždAndOp +( +Ý1 +, +Ý2 +); + +761 +d–‘e + + glÝ +; + +762 +d–‘e + + grÝ +; + +764  +Ãw + +CG_ro£R•r +( +isSgEx´essiÚ +( +šs +)); + +771 +CG_ouutR•r +* + gCG_ro£Bužd” +:: +C»©eGE +(CG_ouutR•¸* +lÝ +, + +772 +CG_ouutR•r + * +rÝ +) const { + +773  +C»©eLE +( +rÝ +, +lÝ +); + +776 +CG_ouutR•r +* + gCG_ro£Bužd” +:: +C»©eLE +(CG_ouutR•¸* +lÝ +, + +777 +CG_ouutR•r + * +rÝ +) const { + +778 ià( + grÝ + =ð +NULL + || +lÝ + == NULL) { + +779  +NULL +; + +782 +SgEx´essiÚ +* + gÝ1 + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +lÝ +)-> +Ý_ +; + +783 +SgEx´essiÚ +* + gÝ2 + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +rÝ +)-> +Ý_ +; + +785 +SgLessOrEqu®Op + * + gšs + = +buždLessOrEqu®Op +( +Ý1 +, +Ý2 +); + +787 +d–‘e + + glÝ +; + +788 +d–‘e + + grÝ +; + +790  +Ãw + +CG_ro£R•r +( +isSgEx´essiÚ +( +šs +)); + +794 +CG_ouutR•r +* + gCG_ro£Bužd” +:: +C»©eEQ +(CG_ouutR•¸* +lÝ +, + +795 +CG_ouutR•r + * +rÝ +) const { + +796 ià( + grÝ + =ð +NULL + || +lÝ + == NULL) { + +797  +NULL +; + +800 +SgEx´essiÚ +* + gÝ1 + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +lÝ +)-> +Ý_ +; + +801 +SgEx´essiÚ +* + gÝ2 + = +¡©ic_ÿ¡ +< +CG_ro£R•r +*>( +rÝ +)-> +Ý_ +; + +803 +SgEqu®™yOp + * + gšs + = +buždEqu®™yOp +( +Ý1 +, +Ý2 +); + +805 +d–‘e + + glÝ +; + +806 +d–‘e + + grÝ +; + +808  +Ãw + +CG_ro£R•r +( +isSgEx´essiÚ +( +šs +)); + +815 +CG_ouutR•r +* + gCG_ro£Bužd” +:: +C»©eStmtLi¡ +(CG_ouutR•¸* +sšgËtÚ +) const { + +819 ià( +sšgËtÚ + =ð +NULL +) { + +820  +Ãw + +CG_ro£R•r +Òew +SgS‹m’tPŒLi¡ +); + +823 +SgS‹m’tPŒLi¡ + * + gŠl + = +¡©ic_ÿ¡ +< +CG_ro£R•r + *>( +sšgËtÚ +)-> +li¡_ +; + +824 +SgNode +* + gsgn + = +¡©ic_ÿ¡ +< +CG_ro£R•r + *>( +sšgËtÚ +)-> +Šl_ +; + +826 ià( + gŠl + =ð +NULL +) + +827 +Šl + = +Ãw + +SgS‹m’tPŒLi¡ +; + +829 ià( + gsgn + =ð +NULL +) { + +830 +SgEx´essiÚ +* +Ý + = +¡©ic_ÿ¡ +< +CG_ro£R•r + *>( +sšgËtÚ +)-> +Ý_ +; + +832 ià( + gÝ + !ð +NULL +) + +833 (* +Šl +). +push_back +( + +834 +buždEx´S‹m’t +( + +835 +¡©ic_ÿ¡ +< +CG_ro£R•r + *>( +sšgËtÚ +)-> +Ý_ +)); + +838 (* + gŠl +). +push_back +( +isSgS‹m’t +( +sgn +)); + +840 +d–‘e + + gsšgËtÚ +; + +841  +Ãw + +CG_ro£R•r +( +Šl +); + +850 +CG_ouutR•r +* + gCG_ro£Bužd” +:: +StmtLi¡In£¹La¡ +(CG_ouutR•¸* +li¡ +, + +851 +CG_ouutR•r + * +node +) const { + +852  +StmtLi¡Aµ’d +( +li¡ +, +node +); + +855 +CG_ouutR•r +* + gCG_ro£Bužd” +:: +StmtLi¡Aµ’d +(CG_ouutR•¸* +li¡1 +, + +856 +CG_ouutR•r + * +li¡2 +) const { + +858 ià( + gli¡2 + =ð +NULL +) { + +859  +li¡1 +; + +860 } ià( + gli¡1 + =ð +NULL +) { + +861  +li¡2 +; + +868 +SgS‹m’tPŒLi¡ +* + gÃw_li¡ +; + +870 +SgS‹m’tPŒLi¡ +* + gŠl1 + = +¡©ic_ÿ¡ +< +CG_ro£R•r + *>( +li¡1 +)-> +li¡_ +; + +871 +SgS‹m’tPŒLi¡ +* + gŠl2 + = +¡©ic_ÿ¡ +< +CG_ro£R•r + *>( +li¡2 +)-> +li¡_ +; + +872 +SgNode +* + gÚe + = +¡©ic_ÿ¡ +< +CG_ro£R•r + *>( +li¡1 +)-> +Šl_ +; + +873 +SgNode +* + gtwo + = +¡©ic_ÿ¡ +< +CG_ro£R•r + *>( +li¡2 +)-> +Šl_ +; + +875 +SgEx´essiÚ +* + gexp1 + = +¡©ic_ÿ¡ +< +CG_ro£R•r + *>( +li¡1 +)-> +Ý_ +; + +876 +SgEx´essiÚ +* + gexp2 + = +¡©ic_ÿ¡ +< +CG_ro£R•r + *>( +li¡2 +)-> +Ý_ +; + +878 ià( + gexp1 + || + gexp2 +) + +879 +throw + +œ_”rÜ +("error in stmtlistappend!!"); + +895 ià(( + gŠl1 + =ð +NULL +è&& ( +Šl2 + == NULL)) { + +897 ià(( +Úe + !ð +NULL +è&& ( +two + != NULL)) { + +899 +Ãw_li¡ + = +Ãw + +SgS‹m’tPŒLi¡ +; + +901 (* + gÃw_li¡ +). +push_back +( +isSgS‹m’t +( +Úe +)); + +902 (* + gÃw_li¡ +). +push_back +( +isSgS‹m’t +( +two +)); + +904 +CG_ro£R•r +* + gÃw_»p + = +Ãw + CG_ro£R•r( +Ãw_li¡ +); + +906  + g¡©ic_ÿ¡ +< + gCG_ouutR•r + *>( + gÃw_»p +); + +908 } ià(( + gÚe + !ð +NULL +è&& ( +two + == NULL)) { + +910  +¡©ic_ÿ¡ +< +CG_ouutR•r + *>( +Ãw + +CG_ro£R•r +( +Úe +)); + +912 } ià(( + gtwo + !ð +NULL +è&& ( +Úe + == NULL)) { + +913  +¡©ic_ÿ¡ +< +CG_ouutR•r + *>( +Ãw + +CG_ro£R•r +( +two +)); + +918 ià(( + gŠl2 + !ð +NULL +è&& ( +Šl1 + == NULL)) { + +925 ià( +Úe + =ð +NULL +) + +926  +li¡2 +; + +929 (* + gŠl2 +). +push_back +( +isSgS‹m’t +( +Úe +)); + +931  + g¡©ic_ÿ¡ +< + gCG_ouutR•r + *>( +Ãw + +CG_ro£R•r +( +Šl2 +)); + +933 } ià(( + gŠl1 + !ð +NULL +è&& ( +Šl2 + == NULL)) { + +934 ià( +two + =ð +NULL +) + +935  +li¡1 +; + +938 (* + gŠl1 +). +push_back +( +isSgS‹m’t +( +two +)); + +940  + g¡©ic_ÿ¡ +< + gCG_ouutR•r + *>( +Ãw + +CG_ro£R•r +( +Šl1 +)); + +944 } ià(( + gŠl1 + !ð +NULL +è&& ( +Šl2 + != NULL)) { + +946  +SgS‹m’tPŒLi¡ +:: +™”©Ü + +™ + = (* +Šl2 +). +begš +(); + +947 + g™ + !ð(* +Šl2 +). +’d +(); it++) { + +948 (* + gŠl1 +). +push_back +(* +™ +); + +954  + g¡©ic_ÿ¡ +< + gCG_ouutR•r + *>( +Ãw + +CG_ro£R•r +( +Šl1 +)); + +1002 +CG_ouutR•r +* + gCG_ro£Bužd” +:: +C»©eDim3 +(cÚ¡ * +v¬Name +,  +¬g1 +, + +1003  +¬g2 +) const { + +1005 +SgName + +ty³_Çme +("dim3"); + +1006 +SgCÏssSymbÞ + * + gty³_symbÞ + = +glob®_scÝe +-> +lookup_þass_symbÞ +( +ty³_Çme +); + +1007 +SgCÏssDeþ¬©iÚ + * + gty³_deþ + = +isSgCÏssDeþ¬©iÚ +( + +1008 +ty³_symbÞ +-> +g‘_deþ¬©iÚ +()); + +1012 +SgFunùiÚSymbÞ + * + gùÜ_symbÞ + = +glob®_scÝe +-> +lookup_funùiÚ_symbÞ +( + +1013 +SgName +("dim3")); + +1015 +SgEx´Li¡Exp + * + gùÜ_¬gs + = +buždEx´Li¡Exp +( +buždIÁV® +( +¬g1 +), + +1016 +buždIÁV® +( +¬g2 +)); + +1018 +SgFunùiÚC®lExp + * + gdim3_func_ÿÎ + = +buždFunùiÚC®lExp +( + +1019 +buždFunùiÚRefExp +( +ùÜ_symbÞ +-> +g‘_deþ¬©iÚ +()), +ùÜ_¬gs +); + +1021  + gjošed_¡r +[20]; + +1023 +¡rýy +( +jošed_¡r +, "dim3 "); + +1024 +¡rÿt +( +jošed_¡r +, +v¬Name +); + +1026 +SgEx´S‹m’t +* + gdeþ + = +buždAssignS‹m’t +( + +1027 +buždO·queV¬RefExp +( +jošed_¡r +, +isSgScÝeS‹m’t +( +roÙ_ +)), + +1028 +dim3_func_ÿÎ +); + +1030 +SgS‹m’tPŒLi¡ + * + gŠl2 + = +Ãw + SgStatementPtrList; + +1033 (* + gŠl2 +). +push_back +( +deþ +); + +1034  +Ãw + +CG_ro£R•r +( +Šl2 +); + +1037 +CG_ouutR•r +* + gCG_ro£Bužd” +:: +C»©eDim3 +(cÚ¡ * +v¬Name +,  +¬g1 +, + +1038  +¬g2 +,  +¬g3 +) const { + +1040 +SgName + +ty³_Çme +("dim3"); + +1041 +SgCÏssSymbÞ + * + gty³_symbÞ + = +glob®_scÝe +-> +lookup_þass_symbÞ +( +ty³_Çme +); + +1042 +SgCÏssDeþ¬©iÚ + * + gty³_deþ + = +isSgCÏssDeþ¬©iÚ +( + +1043 +ty³_symbÞ +-> +g‘_deþ¬©iÚ +()); + +1047 +SgFunùiÚSymbÞ + * + gùÜ_symbÞ + = +glob®_scÝe +-> +lookup_funùiÚ_symbÞ +( + +1048 +SgName +("dim3")); + +1050 +SgEx´Li¡Exp + * + gùÜ_¬gs + = +buždEx´Li¡Exp +( +buždIÁV® +( +¬g1 +), + +1051 +buždIÁV® +( +¬g2 +), buždIÁV®( +¬g3 +)); + +1053 +SgFunùiÚC®lExp + * + gdim3_func_ÿÎ + = +buždFunùiÚC®lExp +( + +1054 +buždFunùiÚRefExp +( +ùÜ_symbÞ +-> +g‘_deþ¬©iÚ +()), +ùÜ_¬gs +); + +1056  + gjošed_¡r +[20]; + +1058 +¡rýy +( +jošed_¡r +, "dim3 "); + +1059 +¡rÿt +( +jošed_¡r +, +v¬Name +); + +1061 +SgEx´S‹m’t +* + gdeþ + = +buždAssignS‹m’t +( + +1062 +buždO·queV¬RefExp +( +jošed_¡r +, +isSgScÝeS‹m’t +( +roÙ_ +)), + +1063 +dim3_func_ÿÎ +); + +1065 +SgS‹m’tPŒLi¡ + * + gŠl2 + = +Ãw + SgStatementPtrList; + +1068 (* + gŠl2 +). +push_back +( +deþ +); + +1069  +Ãw + +CG_ro£R•r +( +Šl2 +); + +1144 + g¡d +:: +veùÜ +< +SgV¬RefExp + *> +sub¡™u‹ +( +SgNode + * +š +, cÚ¡ +SgV¬ŸbËSymbÞ + * +sym +, + +1145 +SgEx´essiÚ +* +ex´ +, +SgNode +* +roÙ +) { + +1147 +SgS‹m’t +* + g¡mt +; + +1148 +SgEx´essiÚ +* + gÝ +; + +1149 + g¡d +:: +veùÜ +< +SgV¬RefExp + *> +¬¿ys +; + +1151 ià( + gš + !ð +NULL +) { + +1152 ià( +¡mt + = +isSgS‹m’t +( +š +)) { + +1153 ià( +isSgBasicBlock +( +¡mt +)) { + +1154 +SgS‹m’tPŒLi¡ +& +¡mts + = + +1155 +isSgBasicBlock +( +¡mt +)-> +g‘_¡©em’ts +(); + +1156  + gi + = 0; i < + g¡mts +. +size +(); i++) { + +1157 + g¡mts +[ +i +]-> +£t_·»Á +( +¡mt +); + +1158 + g¡d +:: +veùÜ +< +SgV¬RefExp + *> +a + = +sub¡™u‹ +( + +1159 +isSgNode +( +¡mts +[ +i +]), +sym +, +ex´ +, +roÙ +); + +1160 + g¡d +:: +cÝy +( +a +. +begš +(),‡. +’d +(), +back_š£¹” +( +¬¿ys +)); + +1162 } ià( +isSgFÜS‹m’t +( +¡mt +)) { + +1163 +SgFÜS‹m’t + * + gŠf + = +isSgFÜS‹m’t +( +¡mt +); + +1164 + gŠf +-> +g‘_fÜ_š™_¡mt +()-> +£t_·»Á +( +Šf +); + +1165 + gŠf +-> +g‘_‹¡ +()-> +£t_·»Á +( +Šf +); + +1166 + gŠf +-> +g‘_šüem’t +()-> +£t_·»Á +( +Šf +); + +1167 + gŠf +-> +g‘_loÝ_body +()-> +£t_·»Á +( +Šf +); + +1168 + g¡d +:: +veùÜ +< +SgV¬RefExp + *> +a + = +sub¡™u‹ +( + +1169 +isSgNode +( +Šf +-> +g‘_fÜ_š™_¡mt +()), +sym +, +ex´ +, +roÙ +); + +1170 + g¡d +:: +cÝy +( +a +. +begš +(),‡. +’d +(), +back_š£¹” +( +¬¿ys +)); + +1171 + g¡d +:: +veùÜ +< +SgV¬RefExp + *> +a1 + = +sub¡™u‹ +( + +1172 +isSgNode +( +Šf +-> +g‘_‹¡ +()), +sym +, +ex´ +, +roÙ +); + +1173 + g¡d +:: +cÝy +( +a1 +. +begš +(),‡1. +’d +(), +back_š£¹” +( +¬¿ys +)); + +1174 + g¡d +:: +veùÜ +< +SgV¬RefExp + *> +a2 + = +sub¡™u‹ +( + +1175 +isSgNode +( +Šf +-> +g‘_šüem’t +()), +sym +, +ex´ +, +roÙ +); + +1176 + g¡d +:: +cÝy +( +a2 +. +begš +(),‡2. +’d +(), +back_š£¹” +( +¬¿ys +)); + +1177 + g¡d +:: +veùÜ +< +SgV¬RefExp + *> +a3 + = +sub¡™u‹ +( + +1178 +isSgNode +( +Šf +-> +g‘_loÝ_body +()), +sym +, +ex´ +, +roÙ +); + +1179 + g¡d +:: +cÝy +( +a3 +. +begš +(),‡3. +’d +(), +back_š£¹” +( +¬¿ys +)); + +1188 ià( +isSgV¬ŸbËDeþ¬©iÚ +( +¡mt +)) { + +1189 ià( +SgEx´essiÚ + * + gš™ + = + +1190 +isSgV¬ŸbËDeþ¬©iÚ +( +¡mt +)-> +g‘_v¬ŸbËs +(). +äÚt +()-> +g‘_š™Ÿliz” +()) { + +1191 ià( +isSgAssignIn™Ÿliz” +( +š™ +)) { + +1192 +¡d +:: +veùÜ +< +SgV¬RefExp + *> +a + = +sub¡™u‹ +( + +1193 +isSgAssignIn™Ÿliz” +( +š™ +)-> +g‘_Ý”ªd +(), +sym +, + +1194 +ex´ +, +roÙ +); + +1195 + g¡d +:: +cÝy +( +a +. +begš +(),‡. +’d +(), +back_š£¹” +( +¬¿ys +)); + +1198 } ià( +isSgIfStmt +( +¡mt +)) { + +1199 +SgIfStmt +* + gŠi + = +isSgIfStmt +( +¡mt +); + +1200 + gŠi +-> +g‘_cÚd™iÚ® +()-> +£t_·»Á +( +Ši +); + +1201 + gŠi +-> +g‘_Œue_body +()-> +£t_·»Á +( +Ši +); + +1202 + gŠi +-> +g‘_çl£_body +()-> +£t_·»Á +( +Ši +); + +1203 + g¡d +:: +veùÜ +< +SgV¬RefExp + *> +a + = +sub¡™u‹ +( + +1204 +isSgNode +( +Ši +-> +g‘_cÚd™iÚ® +()), +sym +, +ex´ +, +roÙ +); + +1205 + g¡d +:: +cÝy +( +a +. +begš +(),‡. +’d +(), +back_š£¹” +( +¬¿ys +)); + +1206 + g¡d +:: +veùÜ +< +SgV¬RefExp + *> +a1 + = +sub¡™u‹ +( + +1207 +isSgNode +( +Ši +-> +g‘_Œue_body +()), +sym +, +ex´ +, +roÙ +); + +1208 + g¡d +:: +cÝy +( +a1 +. +begš +(),‡1. +’d +(), +back_š£¹” +( +¬¿ys +)); + +1209 + g¡d +:: +veùÜ +< +SgV¬RefExp + *> +a2 + = +sub¡™u‹ +( + +1210 +isSgNode +( +Ši +-> +g‘_çl£_body +()), +sym +, +ex´ +, +roÙ +); + +1211 + g¡d +:: +cÝy +( +a2 +. +begš +(),‡2. +’d +(), +back_š£¹” +( +¬¿ys +)); + +1212 } ià( +isSgEx´S‹m’t +( +¡mt +)) { + +1213 ( +isSgEx´S‹m’t +( +¡mt +)-> +g‘_ex´essiÚ +())-> +£t_·»Á +( + +1214 +isSgEx´S‹m’t +( +¡mt +)); + +1215 + g¡d +:: +veùÜ +< +SgV¬RefExp + *> +a + = +sub¡™u‹ +( + +1216 +isSgNode +( +isSgEx´S‹m’t +( +¡mt +)-> +g‘_ex´essiÚ +()), + +1217 +sym +, +ex´ +, +roÙ +); + +1218 + g¡d +:: +cÝy +( +a +. +begš +(),‡. +’d +(), +back_š£¹” +( +¬¿ys +)); + +1222 + gÝ + = +isSgEx´essiÚ +( +š +); + +1224 + g¡d +:: +¡ršg + +y + = +sym +-> +g‘_Çme +(). +g‘SŒšg +(); + +1226 ià( +isSgBš¬yOp +( +Ý +)) { + +1228 +isSgBš¬yOp +( +Ý +)-> +g‘_lhs_Ý”ªd +()-> +£t_·»Á +(op); + +1229 +isSgBš¬yOp +( +Ý +)-> +g‘_rhs_Ý”ªd +()-> +£t_·»Á +(op); + +1231 + g¡d +:: +veùÜ +< +SgV¬RefExp + *> +a + = +sub¡™u‹ +( + +1232 +isSgBš¬yOp +( +Ý +)-> +g‘_lhs_Ý”ªd +(), +sym +, +ex´ +, +roÙ +); + +1233 + g¡d +:: +cÝy +( +a +. +begš +(),‡. +’d +(), +back_š£¹” +( +¬¿ys +)); + +1234 + g¡d +:: +veùÜ +< +SgV¬RefExp + *> +a1 + = +sub¡™u‹ +( + +1235 +isSgBš¬yOp +( +Ý +)-> +g‘_rhs_Ý”ªd +(), +sym +, +ex´ +, +roÙ +); + +1236 + g¡d +:: +cÝy +( +a1 +. +begš +(),‡1. +’d +(), +back_š£¹” +( +¬¿ys +)); + +1237 } ià( +isSgUÇryOp +( +Ý +)) { + +1238 +isSgUÇryOp +( +Ý +)-> +g‘_Ý”ªd +()-> +£t_·»Á +(op); + +1239 + g¡d +:: +veùÜ +< +SgV¬RefExp + *> +a + = +sub¡™u‹ +( + +1240 +isSgUÇryOp +( +Ý +)-> +g‘_Ý”ªd +(), +sym +, +ex´ +, +roÙ +); + +1241 + g¡d +:: +cÝy +( +a +. +begš +(),‡. +’d +(), +back_š£¹” +( +¬¿ys +)); + +1242 } ià( +isSgV¬RefExp +( +Ý +)) { + +1243 + g¡d +:: +¡ršg + +z + = + +1244 +isSgV¬RefExp +( +Ý +)-> +g‘_symbÞ +()-> +g‘_Çme +(). +g‘SŒšg +(); + +1245 ià(! +¡rcmp +( +z +. +c_¡r +(), +y +.c_str())) { + +1247 + g¬¿ys +. +push_back +( +isSgV¬RefExp +( +Ý +)); + +1273  + g¬¿ys +; + + @CG_roseRepr.cc + +14  + ~ + +15  + ~<¡dio.h +> + +16  + ~<¡ršg.h +> + +17  + ~ + +18 +Çme¥aû + + gomega + { + +23 + gCG_ro£R•r +:: +CG_ro£R•r +(): +Šl_ +( +NULL +), +Ý_ +(NULL), +li¡_ +(NULL){ + +27 + gCG_ro£R•r +:: +CG_ro£R•r +( +SgNode + * +Šl +): +Šl_ +ÑÆ), +Ý_ +( +NULL +), +li¡_ +(NULL) { + +30 + gCG_ro£R•r +:: +CG_ro£R•r +( +SgEx´essiÚ +* +Ý +): +Šl_ +( +NULL +), +Ý_ +(Ý), +li¡_ +(NULL){ + +32 + gCG_ro£R•r +:: +CG_ro£R•r +( +SgS‹m’tPŒLi¡ +* +¡mŽi¡ +): +Šl_ +( +NULL +), +Ý_ +(NULL), +li¡_ +(stmtlist){ + +35 + gCG_ro£R•r +::~ +CG_ro£R•r +() { + +40 +CG_ouutR•r +* +CG_ro£R•r +:: +þÚe +() { + +42 ifÐ +Šl_ + !ð +NULL +) { + +43 +SgT»eCÝy + +tc +; + +44 +SgNode + * + gŠl + = +Šl_ +-> +cÝy +( +tc +); + +45 + gŠl +-> +£t_·»Á +( +Šl_ +-> +g‘_·»Á +()); + +46  +Ãw + +CG_ro£R•r +( +Šl +); + +48 if( + gÝ_ + !ð +NULL +) + +50 +SgT»eCÝy + +tc1 +; + +51 +SgNode +* + gÝ + = +isSgNode +( +Ý_ +)-> +cÝy +( +tc1 +); + +53 + gÝ +-> +£t_·»Á +( +isSgNode +( +Ý_ +)-> +g‘_·»Á +()); + +54  +Ãw + +CG_ro£R•r +( +isSgEx´essiÚ +( +Ý +)); + +56 if( + gli¡_ + !ð +NULL +) + +58 +SgS‹m’tPŒLi¡ +* +li¡2 + = +Ãw + SgStatementPtrList; + +60  + gSgS‹m’tPŒLi¡ +:: +™”©Ü + +™ + = (* +li¡_ +). +begš +(); + g™ + !ð(*li¡_). +’d +(); it++){ + +61 +SgT»eCÝy + + gtc3 +; + +62 +SgNode + * + gŠl2 + = +isSgNode +(* +™ +)-> +cÝy +( +tc3 +); + +63 + gŠl2 +-> +£t_·»Á +( +isSgNode +(* +™ +)-> +g‘_·»Á +()); + +65 (* + gli¡2 +). +push_back +( +isSgS‹m’t +( +Šl2 +)); + +67  +Ãw + +CG_ro£R•r +( +li¡2 +); + +70  + gNULL +; + +73  + gCG_ro£R•r +:: +þ—r +() { + +74 if( +Šl_ + !ð +NULL +) { + +75 +d–‘e + +Šl_ +; + +76 + gŠl_ + = +NULL +; + +80 +SgNode +* + gCG_ro£R•r +:: +G‘Code +() const { + +81  +Šl_ +; + +84 +SgS‹m’tPŒLi¡ +* + gCG_ro£R•r +:: +G‘Li¡ +() const { + +85  +li¡_ +; + +88 +SgEx´essiÚ +* + gCG_ro£R•r +:: +G‘Ex´essiÚ +() const { + +89  +Ý_ +; + +91  + gCG_ro£R•r +:: +Dump +() const { + +92 +SgNode +* +Šl + = +Šl_ +; + +93 +SgEx´essiÚ +* + gÝ + = +Ý_ + ; + +94 if( + gŠl + !ð +NULL +) + +95 +DumpFžeH–³r +( +Šl +, +¡dout +); + +96 if( + gÝ + !ð +NULL +) + +97 +DumpFžeH–³r +( +isSgNode +( +Ý +), +¡dout +); + +101  + gCG_ro£R•r +:: +DumpFžeH–³r +( +SgNode +* +node +, +FILE + * +å +) const{ + +102 + g¡d +:: +¡ršg + +x +; + +103 +size_t + + gnumb”OfSucûssÜs + = +node +-> +g‘_numb”OfT¿v”§lSucûssÜs +(); + +104 if( + gnumb”OfSucûssÜs + == 0){ + +105 +x + = +node +-> +uŬ£ToSŒšg + (); + +106 +årštf +( +å +, "%s", +x +. +c_¡r +()); + +109  +size_t + + gidx + = 0; idx < + gnumb”OfSucûssÜs +; idx++) + +111 +SgNode + * + gchžd + = +NULL +; + +112 + gchžd + = +node +-> +g‘_Œav”§lSucûssÜByIndex +( +idx +); + +113 +DumpFžeH–³r +( +chžd +, +å +); + +119  + gCG_ro£R•r +:: +DumpToFže +( +FILE + * +å +) const { + +121 +SgNode +* +Šl + = +Šl_ +; + +122 +SgEx´essiÚ +* + gÝ + = +Ý_ + ; + +124 if( + gŠl +!ð +NULL +){ + +125 +¡d +:: +¡ršg + +x + = +Šl +-> +uŬ£ToSŒšg +(); + +126 +årštf +( +å +, "%s", +x +. +c_¡r +()); + +129 if( + gÝ + !ð +NULL +){ + +130 +¡d +:: +¡ršg + +x + = +isSgNode +( +Ý +)-> +uŬ£ToSŒšg +(); + +131 +årštf +( +å +, "%s", +x +. +c_¡r +()); + + @CG_stringBuilder.cc + +17  + ~ + +18  + ~ + +19  + ~<¡ršg +> + +21 +Çme¥aû + + gomega + { + +23  + g¡d +:: +¡ršg + +Saãgu¬dSŒšg +(cÚ¡ +¡d +::¡ršg & +s +,  +Ý +); + +29 +CG_ouutR•r +* + gCG_¡ršgBužd” +:: +C»©ePÏûHÞd” +( +šd’t +, + +30 +CG_ouutR•r + * +¡mt +, +Tu¶e + & +funcLi¡ +, + +31 +Tu¶e +< +¡d +:: +¡ršg +> &) const { + +32 +¡d +:: +¡ršg + +li¡SŒ + = ""; + +34  + gi + = 1; i <ð +funcLi¡ +. +size +(); i++) { + +35 ià( + gfuncLi¡ +[ +i +] =ð +NULL +) + +36 +li¡SŒ + += "N/A"; + +38 + gli¡SŒ + +ð +G‘SŒšg +( +funcLi¡ +[ +i +]); + +39 ià( + gi + < + gfuncLi¡ +. +size +()) + +40 + gli¡SŒ + += ","; + +43 + g¡d +:: +¡ršg + +¡mtName + = +G‘SŒšg +( +¡mt +); + +44 + g¡d +:: +¡ršg + +šd’tSŒ + = +G‘Ind’tS·ûs +( +šd’t +); + +46  +Ãw + +CG_¡ršgR•r +( +šd’tSŒ + + +¡mtName + + "(" + +li¡SŒ + + ");\n"); + +49 +CG_ouutR•r +* + gCG_¡ršgBužd” +:: +C»©eAssignm’t +( +šd’t +, + +50 +CG_ouutR•r +* +lhs +, CG_ouutR•r* +rhs +) const { + +51 ià( + glhs + =ð +NULL + || +rhs + == NULL) { + +52 +årštf +( +¡d”r +, "Code generation: missing†hs or„hs\n"); + +53  + gNULL +; + +56 + g¡d +:: +¡ršg + +lhsSŒ + = +G‘SŒšg +( +lhs +); + +57 + g¡d +:: +¡ršg + +rhsSŒ + = +G‘SŒšg +( +rhs +); + +59 + g¡d +:: +¡ršg + +šd’tSŒ + = +G‘Ind’tS·ûs +( +šd’t +); + +61  +Ãw + +CG_¡ršgR•r +( +šd’tSŒ + + +lhsSŒ + + "=" + +rhsSŒ + + ";\n"); + +64 +CG_ouutR•r +* + gCG_¡ršgBužd” +:: +C»©eInvoke +(cÚ¡ +¡d +:: +¡ršg + & +âame +, + +65 +Tu¶e +< +CG_ouutR•r +*> & +li¡ +) const { + +66 + g¡d +:: +¡ršg + +li¡SŒ + = ""; + +68  + gi + = 1; i <ð +li¡ +. +size +(); i++) { + +69 + gli¡SŒ + +ð +G‘SŒšg +( +li¡ +[ +i +]); + +70 ià( + gi + < + gli¡ +. +size +()) + +71 + gli¡SŒ + += ","; + +74  +Ãw + +CG_¡ršgR•r +( +âame + + "(" + +li¡SŒ + + ")"); + +77 +CG_ouutR•r +* + gCG_¡ršgBužd” +:: +C»©eComm’t +( +šd’t +, + +78 cÚ¡ +¡d +:: +¡ršg + & +comm’tText +) const { + +79 ià( +comm’tText + =ð +¡d +:: +¡ršg +("")) { + +80  +NULL +; + +83 + g¡d +:: +¡ršg + +šd’tSŒ + = +G‘Ind’tS·ûs +( +šd’t +); + +85  +Ãw + +CG_¡ršgR•r +( +šd’tSŒ + + "// " + +comm’tText + + "\n"); + +88 +CG_ouutR•r +* + gCG_¡ršgBužd” +:: +C»©eA‰ribu‹ +(CG_ouutR•¸* +cÚŒÞ +, + +89 cÚ¡ +¡d +:: +¡ršg + & +comm’tText +) const { + +90 ià( +comm’tText + =ð +¡d +:: +¡ršg +("")) { + +91  +cÚŒÞ +; + +94 + g¡d +:: +¡ršg + +cÚŒÞSŒšg + = +G‘SŒšg +( +cÚŒÞ +); + +96  +Ãw + +CG_¡ršgR•r +("// " + +comm’tText + + "\n" + +cÚŒÞSŒšg +); + +100 +CG_ouutR•r +* + gCG_¡ršgBužd” +:: +C»©eIf +( +šd’t +, CG_ouutR•r* +gu¬dLi¡ +, + +101 +CG_ouutR•r +* +Œue_¡mtLi¡ +, CG_ouutR•r* +çl£_¡mtLi¡ +) const { + +102 ià( + gŒue_¡mtLi¡ + =ð +NULL + && +çl£_¡mtLi¡ + == NULL) { + +103 +d–‘e + +gu¬dLi¡ +; + +104  + gNULL +; + +105 } ià( + ggu¬dLi¡ + =ð +NULL +) { + +106  +StmtLi¡Aµ’d +( +Œue_¡mtLi¡ +, +çl£_¡mtLi¡ +); + +109 + g¡d +:: +¡ršg + +gu¬dLi¡SŒ + = +G‘SŒšg +( +gu¬dLi¡ +); + +110 + g¡d +:: +¡ršg + +šd’tSŒ + = +G‘Ind’tS·ûs +( +šd’t +); + +111 + g¡d +:: +¡ršg + +s +; + +112 ià( + gŒue_¡mtLi¡ + !ð +NULL + && +çl£_¡mtLi¡ + == NULL) { + +113 +s + = +šd’tSŒ + + "ià(" + +gu¬dLi¡SŒ + + ") {\n" + +114 + +G‘SŒšg +( +Œue_¡mtLi¡ +è+ +šd’tSŒ + + "}\n"; + +115 } ià( + gŒue_¡mtLi¡ + =ð +NULL + && +çl£_¡mtLi¡ + != NULL) { + +116 +s + = +šd’tSŒ + + "ià!(" + +gu¬dLi¡SŒ + + ") {\n" + +117 + +G‘SŒšg +( +çl£_¡mtLi¡ +è+ +šd’tSŒ + + "}\n"; + +119 + gs + = +šd’tSŒ + + "ià(" + +gu¬dLi¡SŒ + + ") {\n" + +120 + +G‘SŒšg +( +Œue_¡mtLi¡ +è+ +šd’tSŒ + + "}\n" + indentStr + +121 + "–£ {\n" + +G‘SŒšg +( +çl£_¡mtLi¡ +è+ +šd’tSŒ + + "}\n"; + +124  +Ãw + +CG_¡ršgR•r +( +s +); + +127 +CG_ouutR•r +* + gCG_¡ršgBužd” +:: +C»©eInduùive +(CG_ouutR•r* +šdex +, + +128 +CG_ouutR•r +* +low” +, CG_ouutR•r* +uµ” +, CG_ouutR•r* +¡• +) const { + +129 ià( + gšdex + =ð +NULL +) { + +130 +årštf +( +¡d”r +, "Code generation: missing†oop index\n"); + +131  + gNULL +; + +134 ià( + glow” + =ð +NULL + || +uµ” + == NULL) { + +135 +årštf +( +¡d”r +, "Code generation: missing†oop bound\n"); + +138 + g¡d +:: +¡ršg + +šdexSŒ + = +G‘SŒšg +( +šdex +); + +139 + g¡d +:: +¡ršg + +low”SŒ +, + guµ”SŒ +; + +140 ià( + glow” + !ð +NULL +) + +141 +low”SŒ + = +G‘SŒšg +( +low” +); + +143 + glow”SŒ + = +¡d +:: +¡ršg +("-infinity"); + +144 ià( + guµ” + !ð +NULL +) + +145 +uµ”SŒ + = +G‘SŒšg +( +uµ” +); + +147 + guµ”SŒ + = +¡d +:: +¡ršg +("+infinity"); + +149 + g¡d +:: +¡ršg + +doSŒ + = "fÜ(" + +šdexSŒ + + " = " + +low”SŒ + + "; " + indexStr + +150 + " <ð" + +uµ”SŒ + + "; " + +šdexSŒ +; + +152 ià( + g¡• + !ð +NULL +) { + +153 +¡d +:: +¡ršg + +¡•SŒ + = +G‘SŒšg +( +¡• +); + +154 + gdoSŒ + +ð" +ð" + +¡•SŒ +; + +156 + gdoSŒ + += "++"; + +159 + gdoSŒ + += ")"; + +161  +Ãw + +CG_¡ršgR•r +( +doSŒ +); + +164 +CG_ouutR•r +* + gCG_¡ršgBužd” +:: +C»©eLoÝ +( +šd’t +, CG_ouutR•r* +cÚŒÞ +, + +165 +CG_ouutR•r +* +¡mtLi¡ +) const { + +166 ià( + g¡mtLi¡ + =ð +NULL +) { + +167 +d–‘e + +cÚŒÞ +; + +168  + gNULL +; + +169 } ià( + gcÚŒÞ + =ð +NULL +) { + +170 +årštf +( +¡d”r +, "Code generation:‚o inductive forhis†oop\n"); + +171  + g¡mtLi¡ +; + +174 + g¡d +:: +¡ršg + +ù¾SŒ + = +G‘SŒšg +( +cÚŒÞ +); + +175 + g¡d +:: +¡ršg + +¡mtSŒ + = +G‘SŒšg +( +¡mtLi¡ +); + +177 + g¡d +:: +¡ršg + +šd’tSŒ + = +G‘Ind’tS·ûs +( +šd’t +); + +179 + g¡d +:: +¡ršg + +s + = +šd’tSŒ + + +ù¾SŒ + + " {\n" + +¡mtSŒ + + indentStr + "}\n"; + +181  +Ãw + +CG_¡ršgR•r +( +s +); + +184 +CG_ouutR•r +* + gCG_¡ršgBužd” +:: +C»©eIÁ +( +_i +) const { + +185 +¡d +:: +¡ršg + +_s + = +to_¡ršg +( +_i +); + +186  +Ãw + +CG_¡ršgR•r +( +_s +); + +189 +CG_ouutR•r +* + gCG_¡ršgBužd” +:: +C»©eId’t +(cÚ¡ +¡d +:: +¡ršg + & +_s +) const { + +190 ià(& +_s + =ð +NULL + || _ =ð +¡d +:: +¡ršg +("")) { + +191  +NULL +; + +194  +Ãw + +CG_¡ršgR•r +( +_s +); + +197 +CG_ouutR•r +* + gCG_¡ršgBužd” +:: +C»©ePlus +(CG_ouutR•r* +lÝ +, + +198 +CG_ouutR•r +* +rÝ +) const { + +199 ià( + grÝ + =ð +NULL +) { + +200  +lÝ +; + +201 } ià( + glÝ + =ð +NULL +) { + +202  +rÝ +; + +205 + g¡d +:: +¡ršg + +lÝSŒ + = +G‘SŒšg +( +lÝ +); + +206 + g¡d +:: +¡ršg + +rÝSŒ + = +G‘SŒšg +( +rÝ +); + +208  +Ãw + +CG_¡ršgR•r +( +lÝSŒ + + "+" + +rÝSŒ +); + +211 +CG_ouutR•r +* + gCG_¡ršgBužd” +:: +C»©eMšus +(CG_ouutR•r* +lÝ +, + +212 +CG_ouutR•r +* +rÝ +) const { + +213 ià( + grÝ + =ð +NULL +) { + +214  +lÝ +; + +215 } ià( + glÝ + =ð +NULL +) { + +216 +¡d +:: +¡ršg + +rÝSŒ + = +G‘SŒšg +( +rÝ +); + +217  +Ãw + +CG_¡ršgR•r +("-" + +Saãgu¬dSŒšg +( +rÝSŒ +, '-')); + +220 + g¡d +:: +¡ršg + +lÝSŒ + = +G‘SŒšg +( +lÝ +); + +221 + g¡d +:: +¡ršg + +rÝSŒ + = +G‘SŒšg +( +rÝ +); + +223  +Ãw + +CG_¡ršgR•r +( +lÝSŒ + + "-" + +Saãgu¬dSŒšg +( +rÝSŒ +, '-')); + +226 +CG_ouutR•r +* + gCG_¡ršgBužd” +:: +C»©eTimes +(CG_ouutR•r* +lÝ +, + +227 +CG_ouutR•r +* +rÝ +) const { + +228 ià( + grÝ + =ð +NULL + || +lÝ + == NULL) { + +229 +d–‘e + +rÝ +; + +230 +d–‘e + + glÝ +; + +231  + gNULL +; + +234 + g¡d +:: +¡ršg + +lÝSŒ + = +G‘SŒšg +( +lÝ +); + +235 + g¡d +:: +¡ršg + +rÝSŒ + = +G‘SŒšg +( +rÝ +); + +237  +Ãw + +CG_¡ršgR•r +( + +238 +Saãgu¬dSŒšg +( +lÝSŒ +, '*'è+ "*" + Saãgu¬dSŒšg( +rÝSŒ +, '*')); + +241 +CG_ouutR•r +* + gCG_¡ršgBužd” +:: +C»©eIÁeg”Divide +(CG_ouutR•r* +lÝ +, + +242 +CG_ouutR•r +* +rÝ +) const { + +243 ià( + grÝ + =ð +NULL +) { + +244 +årštf +( +¡d”r +, "Code generation: divide by NULL\n"); + +245  + gNULL +; + +246 } ià( + glÝ + =ð +NULL +) { + +247 +d–‘e + +rÝ +; + +248  + gNULL +; + +251 + g¡d +:: +¡ršg + +lÝSŒ + = +G‘SŒšg +( +lÝ +); + +252 + g¡d +:: +¡ršg + +rÝSŒ + = +G‘SŒšg +( +rÝ +); + +254  +Ãw + +CG_¡ršgR•r +("štDiv(" + +lÝSŒ + + "," + +rÝSŒ + + ")"); + +257 +CG_ouutR•r +* + gCG_¡ršgBužd” +:: +C»©eIÁeg”Mod +(CG_ouutR•r* +lÝ +, + +258 +CG_ouutR•r +* +rÝ +) const { + +259 ià( + grÝ + =ð +NULL + || +lÝ + == NULL) { + +260  +NULL +; + +263 + g¡d +:: +¡ršg + +lÝSŒ + = +G‘SŒšg +( +lÝ +); + +264 + g¡d +:: +¡ršg + +rÝSŒ + = +G‘SŒšg +( +rÝ +); + +266  +Ãw + +CG_¡ršgR•r +("štMod(" + +lÝSŒ + + "," + +rÝSŒ + + ")"); + +269 +CG_ouutR•r +* + gCG_¡ršgBužd” +:: +C»©eIÁeg”Cež +(CG_ouutR•r* +lÝ +, + +270 +CG_ouutR•r +* +rÝ +) const { + +271 ià( + grÝ + =ð +NULL + || +lÝ + == NULL) { + +272  +NULL +; + +275 + g¡d +:: +¡ršg + +lÝSŒ + = +G‘SŒšg +( +lÝ +); + +276 + g¡d +:: +¡ršg + +rÝSŒ + = +G‘SŒšg +( +rÝ +); + +278  +Ãw + +CG_¡ršgR•r +("štCež(" + +lÝSŒ + + "," + +rÝSŒ + + ")"); + +281 +CG_ouutR•r +* + gCG_¡ršgBužd” +:: +C»©eAnd +(CG_ouutR•r* +lÝ +, + +282 +CG_ouutR•r +* +rÝ +) const { + +283 ià( + grÝ + =ð +NULL +) + +284  +lÝ +; + +285 ià( + glÝ + =ð +NULL +) + +286  +rÝ +; + +288 + g¡d +:: +¡ršg + +lÝSŒ + = +G‘SŒšg +( +lÝ +); + +289 + g¡d +:: +¡ršg + +rÝSŒ + = +G‘SŒšg +( +rÝ +); + +291  +Ãw + +CG_¡ršgR•r +( +lÝSŒ + + " && " + +rÝSŒ +); + +294 +CG_ouutR•r +* + gCG_¡ršgBužd” +:: +C»©eGE +(CG_ouutR•r* +lÝ +, + +295 +CG_ouutR•r +* +rÝ +) const { + +296 ià( + grÝ + =ð +NULL + || +lÝ + == NULL) { + +297  +NULL +; + +300 + g¡d +:: +¡ršg + +lÝSŒ + = +G‘SŒšg +( +lÝ +); + +301 + g¡d +:: +¡ršg + +rÝSŒ + = +G‘SŒšg +( +rÝ +); + +303  +Ãw + +CG_¡ršgR•r +( +lÝSŒ + + " >ð" + +rÝSŒ +); + +306 +CG_ouutR•r +* + gCG_¡ršgBužd” +:: +C»©eLE +(CG_ouutR•r* +lÝ +, + +307 +CG_ouutR•r +* +rÝ +) const { + +308 ià( + grÝ + =ð +NULL + || +lÝ + == NULL) { + +309  +NULL +; + +312 + g¡d +:: +¡ršg + +lÝSŒ + = +G‘SŒšg +( +lÝ +); + +313 + g¡d +:: +¡ršg + +rÝSŒ + = +G‘SŒšg +( +rÝ +); + +315  +Ãw + +CG_¡ršgR•r +( +lÝSŒ + + " <ð" + +rÝSŒ +); + +318 +CG_ouutR•r +* + gCG_¡ršgBužd” +:: +C»©eEQ +(CG_ouutR•r* +lÝ +, + +319 +CG_ouutR•r +* +rÝ +) const { + +320 ià( + grÝ + =ð +NULL + || +lÝ + == NULL) { + +321  +NULL +; + +324 + g¡d +:: +¡ršg + +lÝSŒ + = +G‘SŒšg +( +lÝ +); + +325 + g¡d +:: +¡ršg + +rÝSŒ + = +G‘SŒšg +( +rÝ +); + +327  +Ãw + +CG_¡ršgR•r +( +lÝSŒ + + " =ð" + +rÝSŒ +); + +330 +CG_ouutR•r +* + gCG_¡ršgBužd” +:: +StmtLi¡Aµ’d +(CG_ouutR•r* +li¡1 +, + +331 +CG_ouutR•r +* +li¡2 +) const { + +332 ià( + gli¡2 + =ð +NULL +) { + +333  +li¡1 +; + +334 } ià( + gli¡1 + =ð +NULL +) { + +335  +li¡2 +; + +338 + g¡d +:: +¡ršg + +li¡1SŒ + = +G‘SŒšg +( +li¡1 +); + +339 + g¡d +:: +¡ršg + +li¡2SŒ + = +G‘SŒšg +( +li¡2 +); + +341  +Ãw + +CG_¡ršgR•r +( +li¡1SŒ + + +li¡2SŒ +); + +347 + g¡d +:: +¡ršg + +G‘Ind’tS·ûs +( +šd’t +) { + +348 +¡d +:: +¡ršg + +šd’tSŒ +; + +349  + gi + = 1; i < + gšd’t +; i++) { + +350 + gšd’tSŒ + += " "; + +352  + gšd’tSŒ +; + +359 + g¡d +:: +¡ršg + +G‘SŒšg +( +CG_ouutR•r +* +»´ +) { + +360 +¡d +:: +¡ršg + +»suÉ + = +¡©ic_ÿ¡ +< +CG_¡ršgR•r + *>( +»´ +)-> +G‘SŒšg +(); + +361 +d–‘e + + g»´ +; + +362  + g»suÉ +; + +365  + g¡d +:: +¡ršg + +Saãgu¬dSŒšg +(cÚ¡ +¡d +::¡ršg & +s +,  +Ý +) { + +366  + gËn + = +s +. +Ëngth +(); + +367  + g·»n_Ëv– + = 0; + +368  + gnum_¶usmšus + = 0; + +369  + gnum_mul + = 0; + +370  + gnum_div + = 0; + +371  + gi + = 0; i < + gËn +; i++) + +372  + gs +[ +i +]) { + +374 +·»n_Ëv– +++; + +377 +·»n_Ëv– +--; + +381 ià( +·»n_Ëv– + == 0) + +382 +num_¶usmšus +++; + +385 ià( +·»n_Ëv– + == 0) + +386 +num_mul +++; + +389 ià( +·»n_Ëv– + == 0) + +390 +num_div +++; + +396 +boÞ + + gÃed_·»n + = +çl£ +; + +397  + gÝ +) { + +399 ià( +num_¶usmšus + > 0) + +400 +Ãed_·»n + = +Œue +; + +403 ià( +num_¶usmšus + > 0 || +num_div + > 0) + +404 +Ãed_·»n + = +Œue +; + +407 ià( +num_¶usmšus + > 0 || +num_div + > 0 || +num_mul + > 0) + +408 +Ãed_·»n + = +Œue +; + +414 ià( + gÃed_·»n +) + +415  "(" + + gs + + ")"; + +417  + gs +; + + @CG_stringRepr.cc + +16  + ~ + +17  + ~<¡dio.h +> + +19 +Çme¥aû + + gomega + { + +21 + gCG_¡ršgR•r +:: +CG_¡ršgR•r +() { + +24 +CG_¡ršgR•r +::CG_¡ršgR•r(cÚ¡ +¡d +:: +¡ršg +& +_s +è: +s +(_s) { + +27 +CG_¡ršgR•r +::~CG_stringRepr() { + +30 +CG_ouutR•r +* +CG_¡ršgR•r +:: +þÚe +() { + +31  +Ãw + +CG_¡ršgR•r +( +s +); + +38 + g¡d +:: +¡ršg + +CG_¡ršgR•r +:: +G‘SŒšg +() const { + +39  +s +; + +46  + gCG_¡ršgR•r +:: +Dump +() const { + +47 +´štf +("%s\n", +s +. +c_¡r +()); + +50  + gCG_¡ršgR•r +:: +DumpToFže +( +FILE + * +å +) const { + +51 +årštf +( +å +,"%s", +s +. +c_¡r +()); + + @CG_suifBuilder.cc + +15  + ~<¡ack +> + +16  + ~ + +17  + ~ + +18  + ~ + +20 +Çme¥aû + + gomega + { + +25 * + gk_ocg_comm’t +; + +26 * + gk_s2c_´agma +; + +27 * + gk_cuda_dim3 +; + +28 * + gk_cuda_k”Ãl +; + +29 * + gk_cuda_modif›r +; + +30 * + gk_cuda_‹xtu»_memÜy +; + +38 +Tu¶e +< Tu¶e<> > +smtNÚS¶™Lev–s +; + +39 +Tu¶e +< Tu¶e< +¡d +:: +¡ršg +> > +loÝIdxNames +; + +40 +¡d +:: +veùÜ +< std:: +·œ +<, std:: +¡ršg +> > +syncs +; + +41  +checkLoÝLev– +; + +42  +¡mtFÜLoÝCheck +; + +43  +uµ”BoundFÜLev– +; + +44  +low”BoundFÜLev– +; + +45 +boÞ + +fžlInBounds +; + +48 cÚ¡ * + glibcode_g’_v”_¡ršg + = ""; + +49 cÚ¡ * + glibcode_g’_who_¡ršg + = ""; + +50 cÚ¡ * + glibcode_g’_suif_¡ršg + = ""; + +53  +š™_code_g’ +() { + +54  +boÞ + + gisIn™ + = +çl£ +; + +55 if(! + gisIn™ +) + +57 + gisIn™ + = +Œue +; + +58 +ANNOTE +( +k_ocg_comm’t +, "omega_comm’t", +TRUE +); + +59 +ANNOTE +( +k_s2c_´agma +, "s2ø´agma", +TRUE +); + +60 +ANNOTE +( +k_cuda_dim3 +, "cud¨dim3", +TRUE +); + +61 +ANNOTE +( +k_cuda_k”Ãl +, "cud¨k”Ãl", +TRUE +); + +62 +ANNOTE +( +k_cuda_modif›r +, "cud¨modif›r", +TRUE +); + +67  +ex™_code_g’ +() { + +75 + gCG_suifBužd” +:: +CG_suifBužd” +( +´oc_symb + * +symb +) + +77 +symb_ + = +symb +; + +78 +š™_code_g’ +(); + +81 +CG_ouutR•r +* + gCG_suifBužd” +:: +C»©ePÏûHÞd” + (, CG_ouutR•¸* +¡mt +, + +82 +Tu¶e +< +CG_ouutR•r +*> & +funcLi¡ +, Tu¶e< +¡d +:: +¡ršg +> & +loÝ_v¬s +) const { + +83 +Œ“_node_li¡ + * +Šl + = +¡©ic_ÿ¡ +< +CG_suifR•r + *>( +¡mt +)-> +Šl_ +; + +84 +d–‘e + + g¡mt +; + +86  + gi + = 1; i <ð +funcLi¡ +. +size +(); i++) { + +87 ià( + gfuncLi¡ +[ +i +] =ð +NULL +) + +90 +CG_suifR•r + * + g»´ + = +¡©ic_ÿ¡ +( +funcLi¡ +[ +i +]); + +91 +Ý”ªd + + gÝ + = +»´ +-> +Ý_ +; + +92 +d–‘e + + g»´ +; + +94 +v¬_sym + * + gvs + = +¡©ic_ÿ¡ +( +symb_ +-> +lookup_sym +( +loÝ_v¬s +[ +i +]. +c_¡r +(), +SYM_VAR +)); + +96 +sub¡™u‹ +( +Šl +, +vs +, +Ý +, +symb_ +); + +98 ià( + gÝ +. +is_š¡r +()) + +99 +d–‘e + + gÝ +. +š¡r +(); + +102  +Ãw + +CG_suifR•r +( +Šl +); + +106 +CG_ouutR•r +* + gCG_suifBužd” +:: +C»©eAssignm’t +(, CG_ouutR•¸* +lhs +, + +107 +CG_ouutR•r + * +rhs +) const { + +108 iàÐ + glhs + =ð +NULL + || +rhs + == NULL ) { + +109 +årštf +( +¡d”r +, "Code generation: Missing†hs or„hs\n"); + +110  + gNULL +; + +113 +Ý”ªd + + g¤c + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +rhs +)-> +Ý_ +; + +114 ià( + g¤c +. +is_š¡r +(è&& src. +š¡r +()-> +Ýcode +(è=ð +io_¬¿y +) { + +115 +š_¬¿y + * +Ÿ + = +¡©ic_ÿ¡ +<š_¬¿y *>( +¤c +. +š¡r +()); + +116 +š¡ruùiÚ + * + gšs + = +Ãw + +š_¼r +( +io_lod +, +Ÿ +-> +–em_ty³ +(), +Ý”ªd +(), ia); + +117 + g¤c + = +Ý”ªd +( +šs +); + +120 +š¡ruùiÚ + * + gšs +; + +121 +Ý”ªd + + gd¡ + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +lhs +)-> +Ý_ +; + +122 ià( + gd¡ +. +is_š¡r +(è&& d¡. +š¡r +()-> +Ýcode +(è=ð +io_¬¿y +) { + +123 +š_¬¿y + * +Ÿ + = +¡©ic_ÿ¡ +<š_¬¿y *>( +d¡ +. +š¡r +()); + +124 + gšs + = +Ãw + +š_¼r +( +io_¡r +, +ty³_void +, +Ý”ªd +(), o³¿nd( +Ÿ +), +¤c +); + +127 + gšs + = +Ãw + +š_¼r +( +io_ýy +, +¤c +. +ty³ +(), +d¡ +, src); + +129 +d–‘e + + glhs +; + +130 +d–‘e + + grhs +; + +132 +Œ“_node_li¡ + * + gŠl + = +Ãw +ree_node_list; + +133 + gŠl +-> +­³nd +( +Ãw + +Œ“_š¡r +( +šs +)); + +135  +Ãw + +CG_suifR•r +( +Šl +); + +139 +CG_ouutR•r +* + gCG_suifBužd” +:: +C»©eInvoke +(cÚ¡ +¡d +:: +¡ršg + & +âame +, + +140 +Tu¶e +< +CG_ouutR•r +*> & +li¡ +) const { + +141 ià( + gâame + =ð +¡d +:: +¡ršg +("max"è|| +âame + == std::string("min")) { + +142 ià( +li¡ +. +size +() == 0) { + +143  +NULL +; + +145 ià( + gli¡ +. +size +() == 1) { + +146  +li¡ +[1]; + +149  + gÏ¡ + = +li¡ +. +size +(); + +150 +Ý”ªd + + gÝ2 + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +li¡ +[ +Ï¡ +])-> +Ý_ +; + +151 +d–‘e + + gli¡ +[ +Ï¡ +]; + +152 + gli¡ +. +d–‘e_Ï¡ +(); + +153 +CG_suifR•r + * + g»´ + = +¡©ic_ÿ¡ +( +C»©eInvoke +( +âame +, +li¡ +)); + +154 +Ý”ªd + + gÝ1 + = +»´ +-> +Ý_ +; + +156 +š¡ruùiÚ + * + gšs +; + +157 ià( + gâame + =ð +¡d +:: +¡ršg +("max")) + +158 +šs + = +Ãw + +š_¼r +( +io_max +, +Ý1 +. +ty³ +(), +Ý”ªd +(), op1, +Ý2 +); + +160 + gšs + = +Ãw + +š_¼r +( +io_mš +, +Ý1 +. +ty³ +(), +Ý”ªd +(), op1, +Ý2 +); + +162 + g»´ +-> + gÝ_ + = +Ý”ªd +( +šs +); + +164  + g»´ +; + +168 +årštf +( +¡d”r +, "Code generation: invoke function io_call‚ot implemented\n"); + +169  + gNULL +; + +174 +CG_ouutR•r +* + gCG_suifBužd” +:: +C»©eA‰ribu‹ +(CG_ouutR•¸* +cÚŒÞ +, + +175 cÚ¡ +¡d +:: +¡ršg + & +comm’tText +)const { + +176 ià( +comm’tText + =ð +¡d +:: +¡ršg +("")) { + +177  +cÚŒÞ +; + +180 +š¡ruùiÚ + * + gšs + = +Ãw + +š_¼r +( +io_mrk +); + +182 +immed_li¡ + * + giml + = +Ãw + immed_list; + +183 + giml +-> +­³nd +( +immed +( +cÚ¡_ÿ¡ +<*>( +comm’tText +. +c_¡r +()))); + +184 + gšs +-> +´•’d_ªnÙe +( +k_ocg_comm’t +, +iml +); + +186 +Œ“_node_li¡ + * + gŠl + ; + +187 + gŠl + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +cÚŒÞ +)-> +Šl_ +; + +188 + gŠl +-> +­³nd +( +Ãw + +Œ“_š¡r +( +šs +)); + +191  +Ãw + +CG_suifR•r +( +Šl +); + +198 +CG_ouutR•r +* + gCG_suifBužd” +:: +C»©eComm’t +(, cÚ¡ +¡d +:: +¡ršg + & +comm’tText +) const { + +199 iàÐ +comm’tText + =ð +¡d +:: +¡ršg +("") ) { + +200  +NULL +; + +203 +š¡ruùiÚ + * + gšs + = +Ãw + +š_¼r +( +io_mrk +); + +205 +immed_li¡ + * + giml + = +Ãw + immed_list; + +206 + giml +-> +­³nd +( +immed +( +cÚ¡_ÿ¡ +<*>( +comm’tText +. +c_¡r +()))); + +207 + gšs +-> +´•’d_ªnÙe +( +k_ocg_comm’t +, +iml +); + +209 +Œ“_node_li¡ + * + gŠl + = +Ãw +ree_node_list; + +210 + gŠl +-> +­³nd +( +Ãw + +Œ“_š¡r +( +šs +)); + +212  +Ãw + +CG_suifR•r +( +Šl +); + +216 +CG_ouutR•r +* + gCG_suifBužd” +:: +C»©eIf +(, CG_ouutR•¸* +gu¬dLi¡ +, + +217 +CG_ouutR•r + * +Œue_¡mtLi¡ +, CG_ouutR•¸* +çl£_¡mtLi¡ +) const { + +218  + gif_couÁ” + = 1; + +219 + g¡d +:: +¡ršg + +s + = +¡d +::¡ršg("omegaif_")+ +to_¡ršg +( +if_couÁ” +++); + +220 +Ïb–_sym + * + gif_Ïb– + = +Ãw +†ab–_sym( +cÚ¡_ÿ¡ +<*>( +s +. +c_¡r +())); + +221 + gsymb_ +-> +add_sym +( +if_Ïb– +); + +223 iàÐ + gŒue_¡mtLi¡ + =ð +NULL + && +çl£_¡mtLi¡ + == NULL ) { + +224 +d–‘e + +gu¬dLi¡ +; + +225  + gNULL +; + +227 iàÐ + ggu¬dLi¡ + =ð +NULL + ) { + +228  +StmtLi¡Aµ’d +( +Œue_¡mtLi¡ +, +çl£_¡mtLi¡ +); + +231 +Œ“_node_li¡ + * + gh—d” + = +Ãw +ree_node_list; + +232 +Ý”ªd + + gÝ + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +gu¬dLi¡ +)-> +Ý_ +; + +234 + g¡d +:: +¡ack +<*> +S +; + +235 + gS +. +push +( +Ý +. +š¡r +()); + +236 ! + gS +. +em±y +()) { + +237 +š¡ruùiÚ + * + gšs + = +¡©ic_ÿ¡ +<š¡ruùiÚ *>( +S +. +tÝ +()); + +238 + gS +. +pÝ +(); + +239 ià( + gšs +-> +Ýcode +(è=ð +io_ªd +) { + +240 +š¡ruùiÚ + * +šs1 + = +šs +-> +¤c_Ý +(0). +š¡r +(); + +241 + gšs1 +-> +»move +(); + +242 + gS +. +push +( +šs1 +); + +243 +š¡ruùiÚ + * + gšs2 + = +šs +-> +¤c_Ý +(1). +š¡r +(); + +244 + gšs2 +-> +»move +(); + +245 + gS +. +push +( +šs2 +); + +246 +d–‘e + + gšs +; + +249 + gšs + = +Ãw + +š_bj +( +io_bçl£ +, +if_Ïb– +, +Ý”ªd +( +šs +)); + +250 + gh—d” +-> +­³nd +( +Ãw + +Œ“_š¡r +( +šs +)); + +254 +Œ“_node_li¡ + * + gth’_·¹ +, * + g–£_·¹ +; + +255 ià( + gŒue_¡mtLi¡ + !ð +NULL +) + +256 +th’_·¹ + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +Œue_¡mtLi¡ +)-> +Šl_ +; + +258 + gth’_·¹ + = +NULL +; + +259 ià( + gçl£_¡mtLi¡ + !ð +NULL +) + +260 +–£_·¹ + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +çl£_¡mtLi¡ +)-> +Šl_ +; + +262 + g–£_·¹ + = +NULL +; + +263 +Œ“_if + * + gti + = +Ãw +»e_if( +if_Ïb– +, +h—d” +, +th’_·¹ +, +–£_·¹ +); + +265 +Œ“_node_li¡ + * + gŠl + = +Ãw +ree_node_list; + +266 + gŠl +-> +­³nd +( +ti +); + +268 +d–‘e + + ggu¬dLi¡ +; + +269 +d–‘e + + gŒue_¡mtLi¡ +; + +270 +d–‘e + + gçl£_¡mtLi¡ +; + +272  +Ãw + +CG_suifR•r +( +Šl +); + +276 +CG_ouutR•r +* + gCG_suifBužd” +:: +C»©eInduùive +(CG_ouutR•¸* +šdex +, + +277 +CG_ouutR•r + * +low” +, + +278 +CG_ouutR•r + * +uµ” +, + +279 +CG_ouutR•r + * +¡• +) const { + +280 iàÐ + gšdex + =ð +NULL + || +low” + =ðNULL || +uµ” + == NULL ) { + +281 +årštf +( +¡d”r +, "Code generation: something wrong in CreateInductive\n"); + +282  + gNULL +; + +285 ià( + g¡• + =ð +NULL +) + +286 +¡• + = +C»©eIÁ +(1); + +288 +v¬_sym + * + gšdex_sym + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +šdex +)-> +Ý_ +. +symbÞ +(); + +289 +Ý”ªd + + glow”_bound + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +low” +)-> +Ý_ +; + +290 +Ý”ªd + + guµ”_bound + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +uµ” +)-> +Ý_ +; + +291 +Ý”ªd + + g¡•_size + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +¡• +)-> +Ý_ +; + +293 +Ïb–_sym + * + gcÚtLab– + = +Ãw +†abel_sym(""); + +294 +Ïb–_sym + * + gbrkLab– + = +Ãw +†abel_sym(""); + +295 + gsymb_ +-> +add_sym +( +cÚtLab– +); + +296 + gsymb_ +-> +add_sym +( +brkLab– +); + +297 +Œ“_fÜ + * + gtf + = +Ãw +»e_fÜ( +šdex_sym +, +FOR_SLTE +, +cÚtLab– +, +brkLab– +, +NULL +, + +298 +low”_bound +, +uµ”_bound +, +¡•_size +, +NULL +); + +300 +Œ“_node_li¡ + * + gŠl + = +Ãw +ree_node_list; + +301 + gŠl +-> +­³nd +( +tf +); + +303 +d–‘e + + gšdex +; + +304 +d–‘e + + glow” +; + +305 +d–‘e + + guµ” +; + +306 +d–‘e + + g¡• +; + +308  +Ãw + +CG_suifR•r +( +Šl +); + +312 +CG_ouutR•r +* + gCG_suifBužd” +:: +C»©eLoÝ +(, CG_ouutR•¸* +cÚŒÞ +, + +313 +CG_ouutR•r + * +¡mtLi¡ +) const { + +314 iàÐ + g¡mtLi¡ + =ð +NULL + ) { + +315 +d–‘e + +cÚŒÞ +; + +316  + gNULL +; + +318 iàÐ + gcÚŒÞ + =ð +NULL + ) { + +319 +årštf +( +¡d”r +, "Code generation:‚o inductive forhis†oop\n"); + +320  + g¡mtLi¡ +; + +323 +Œ“_node_li¡ + * + gŠl + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +cÚŒÞ +)-> +Šl_ +; + +324 +Œ“_node_li¡_™” + +™” +( +Šl +); + +325 +Œ“_fÜ + * + gtf + = +¡©ic_ÿ¡ +<Œ“_fÜ*>( +™” +. +¡• +()); + +327 +Œ“_node_li¡ + * + gbody + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +¡mtLi¡ +)-> +Šl_ +; + +328 + gtf +-> +£t_body +( +body +); + +330 +d–‘e + + g¡mtLi¡ +; + +332  + gcÚŒÞ +; + +336 +CG_ouutR•r +* + gCG_suifBužd” +:: +C»©eIÁ +( +_i +) const { + +337 +š_ldc + * +šs + = +Ãw + in_ldc( +ty³_s32 +, +Ý”ªd +(), +immed +( +_i +)); + +339  +Ãw + +CG_suifR•r +( +Ý”ªd +( +šs +)); + +343 +CG_ouutR•r +* + gCG_suifBužd” +:: +C»©eId’t +(cÚ¡ +¡d +:: +¡ršg + & +_s +) const { + +344 iàÐ& +_s + =ð +NULL + || _ =ð +¡d +:: +¡ršg +("") ) { + +345  +NULL +; + +348 +v¬_sym + * + gvs + = +¡©ic_ÿ¡ +( +symb_ +-> +lookup_sym +( +_s +. +c_¡r +(), +SYM_VAR +)); + +350 ià( + gvs + =ð +NULL +) { + +351 +vs + = +Ãw + +v¬_sym +( +ty³_s32 +, +cÚ¡_ÿ¡ +<*>( +_s +. +c_¡r +())); + +352 + gsymb_ +-> +add_sym +( +vs +); + +355  +Ãw + +CG_suifR•r +( +Ý”ªd +( +vs +)); + +359 +CG_ouutR•r +* + gCG_suifBužd” +:: +C»©ePlus +(CG_ouutR•¸* +lÝ +, + +360 +CG_ouutR•r + * +rÝ +) const { + +361 iàÐ + grÝ + =ð +NULL + ) { + +362  +lÝ +; + +364 iàÐ + glÝ + =ð +NULL + ) { + +365  +rÝ +; + +368 +Ý”ªd + + gÝ1 + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +lÝ +)-> +Ý_ +; + +369 +Ý”ªd + + gÝ2 + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +rÝ +)-> +Ý_ +; + +371 +š¡ruùiÚ + * + gšs + = +Ãw + +š_¼r +( +io_add +, +Ý1 +. +ty³ +(), +Ý”ªd +(), op1, +Ý2 +); + +373 +d–‘e + + glÝ +; + +374 +d–‘e + + grÝ +; + +376  +Ãw + +CG_suifR•r +( +Ý”ªd +( +šs +)); + +380 +CG_ouutR•r +* + gCG_suifBužd” +:: +C»©eMšus +(CG_ouutR•¸* +lÝ +, + +381 +CG_ouutR•r + * +rÝ +) const { + +382 iàÐ + grÝ + =ð +NULL + ) { + +383  +lÝ +; + +385 iàÐ + glÝ + =ð +NULL + ) { + +386 +Ý”ªd + +Ý + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +rÝ +)-> +Ý_ +; + +387 +š¡ruùiÚ + * + gšs + = +Ãw + +š_¼r +( +io_Ãg +, +Ý +. +ty³ +(), +Ý”ªd +(), op); + +389 +d–‘e + + grÝ +; + +391  +Ãw + +CG_suifR•r +( +Ý”ªd +( +šs +)); + +394 +Ý”ªd + + gÝ1 + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +lÝ +)-> +Ý_ +; + +395 +Ý”ªd + + gÝ2 + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +rÝ +)-> +Ý_ +; + +397 +š¡ruùiÚ + * + gšs + = +Ãw + +š_¼r +( +io_sub +, +Ý1 +. +ty³ +(), +Ý”ªd +(), op1, +Ý2 +); + +399 +d–‘e + + glÝ +; + +400 +d–‘e + + grÝ +; + +402  +Ãw + +CG_suifR•r +( +Ý”ªd +( +šs +)); + +407 +CG_ouutR•r +* + gCG_suifBužd” +:: +C»©eTimes +(CG_ouutR•¸* +lÝ +, + +408 +CG_ouutR•r + * +rÝ +) const { + +409 iàÐ + grÝ + =ð +NULL + || +lÝ + == NULL) { + +410 ià( +rÝ + !ð +NULL +) { + +411 +rÝ +-> +þ—r +(); + +412 +d–‘e + + grÝ +; + +414 ià( + glÝ + !ð +NULL +) { + +415 +lÝ +-> +þ—r +(); + +416 +d–‘e + + glÝ +; + +418  + gNULL +; + +421 +Ý”ªd + + gÝ1 + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +lÝ +)-> +Ý_ +; + +422 +Ý”ªd + + gÝ2 + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +rÝ +)-> +Ý_ +; + +424 +š¡ruùiÚ + * + gšs + = +Ãw + +š_¼r +( +io_mul +, +Ý1 +. +ty³ +(), +Ý”ªd +(), op1, +Ý2 +); + +426 +d–‘e + + glÝ +; + +427 +d–‘e + + grÝ +; + +429  +Ãw + +CG_suifR•r +( +Ý”ªd +( +šs +)); + +433 +CG_ouutR•r +* + gCG_suifBužd” +:: +C»©eIÁeg”Divide +(CG_ouutR•¸* +lÝ +, + +434 +CG_ouutR•r + * +rÝ +) const { + +435 iàÐ + grÝ + =ð +NULL + ) { + +436 +årštf +( +¡d”r +, "Code generation: divide by NULL\n"); + +437  + gNULL +; + +439 iàÐ + glÝ + =ð +NULL + ) { + +440 +d–‘e + +rÝ +; + +441  + gNULL +; + +445 +Ý”ªd + + gÝ1 + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +lÝ +)-> +Ý_ +; + +446 +Ý”ªd + + gÝ2 + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +rÝ +)-> +Ý_ +; + +449 +š¡ruùiÚ + * + gšs + = +Ãw + +š_¼r +( +io_div +, +Ý1 +. +ty³ +(), +Ý”ªd +(), op1, +Ý2 +); + +451 +d–‘e + + glÝ +; + +452 +d–‘e + + grÝ +; + +454  +Ãw + +CG_suifR•r +( +Ý”ªd +( +šs +)); + +458 +CG_ouutR•r +* + gCG_suifBužd” +:: +C»©eIÁeg”Mod +(CG_ouutR•¸* +lÝ +, + +459 +CG_ouutR•r + * +rÝ +) const { + +460 iàÐ + grÝ + =ð +NULL + || +lÝ + == NULL ) { + +461  +NULL +; + +464 +Ý”ªd + + gÝ1 + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +lÝ +)-> +Ý_ +; + +465 +Ý”ªd + + gÝ2 + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +rÝ +)-> +Ý_ +; + +468 +š¡ruùiÚ + * + gšs + = +Ãw + +š_¼r +( +io_»m +, +ty³_s32 +, +Ý”ªd +(), +Ý1 +, +Ý2 +); + +470 +d–‘e + + glÝ +; + +471 +d–‘e + + grÝ +; + +473  +Ãw + +CG_suifR•r +( +Ý”ªd +( +šs +)); + +477 +CG_ouutR•r +* + gCG_suifBužd” +:: +C»©eAnd +(CG_ouutR•¸* +lÝ +, + +478 +CG_ouutR•r + * +rÝ +) const { + +479 ià( + grÝ + =ð +NULL +) + +480  +lÝ +; + +481 ià( + glÝ + =ð +NULL +) + +482  +rÝ +; + +484 +Ý”ªd + + gÝ1 + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +lÝ +)-> +Ý_ +; + +485 +Ý”ªd + + gÝ2 + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +rÝ +)-> +Ý_ +; + +487 +š¡ruùiÚ + * + gšs + = +Ãw + +š_¼r +( +io_ªd +, +Ý1 +. +ty³ +(), +Ý”ªd +(), op1, +Ý2 +); + +489 +d–‘e + + glÝ +; + +490 +d–‘e + + grÝ +; + +492  +Ãw + +CG_suifR•r +( +Ý”ªd +( +šs +)); + +496 +CG_ouutR•r +* + gCG_suifBužd” +:: +C»©eGE +(CG_ouutR•¸* +lÝ +, + +497 +CG_ouutR•r + * +rÝ +) const { + +498  +C»©eLE +( +rÝ +, +lÝ +); + +502 +CG_ouutR•r +* + gCG_suifBužd” +:: +C»©eLE +(CG_ouutR•¸* +lÝ +, + +503 +CG_ouutR•r + * +rÝ +) const { + +504 iàÐ + grÝ + =ð +NULL + || +lÝ + == NULL ) { + +505  +NULL +; + +508 +Ý”ªd + + gÝ1 + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +lÝ +)-> +Ý_ +; + +509 +Ý”ªd + + gÝ2 + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +rÝ +)-> +Ý_ +; + +511 +š¡ruùiÚ + * + gšs + = +Ãw + +š_¼r +( +io_¦e +, +ty³_s32 +, +Ý”ªd +(), +Ý1 +, +Ý2 +); + +513 +d–‘e + + glÝ +; + +514 +d–‘e + + grÝ +; + +516  +Ãw + +CG_suifR•r +( +Ý”ªd +( +šs +)); + +520 +CG_ouutR•r +* + gCG_suifBužd” +:: +C»©eEQ +(CG_ouutR•¸* +lÝ +, + +521 +CG_ouutR•r + * +rÝ +) const { + +522 iàÐ + grÝ + =ð +NULL + || +lÝ + == NULL ) { + +523  +NULL +; + +526 +Ý”ªd + + gÝ1 + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +lÝ +)-> +Ý_ +; + +527 +Ý”ªd + + gÝ2 + = +¡©ic_ÿ¡ +< +CG_suifR•r +*>( +rÝ +)-> +Ý_ +; + +529 +š¡ruùiÚ + * + gšs + = +Ãw + +š_¼r +( +io_£q +, +ty³_s32 +, +Ý”ªd +(), +Ý1 +, +Ý2 +); + +531 +d–‘e + + glÝ +; + +532 +d–‘e + + grÝ +; + +534  +Ãw + +CG_suifR•r +( +Ý”ªd +( +šs +)); + +539 +CG_ouutR•r +* + gCG_suifBužd” +:: +StmtLi¡Aµ’d +(CG_ouutR•¸* +li¡1 +, + +540 +CG_ouutR•r + * +li¡2 +) const { + +541 iàÐ + gli¡2 + =ð +NULL + ) { + +542  +li¡1 +; + +544 iàÐ + gli¡1 + =ð +NULL + ) { + +545  +li¡2 +; + +548 +Œ“_node_li¡ + * + gŠl1 + = +¡©ic_ÿ¡ +< +CG_suifR•r + *>( +li¡1 +)-> +Šl_ +; + +549 +Œ“_node_li¡ + * + gŠl2 + = +¡©ic_ÿ¡ +< +CG_suifR•r + *>( +li¡2 +)-> +Šl_ +; + +550 ià( + gŠl2 + =ð +NULL +) + +551 +Šl1 +-> +­³nd +( +Ãw + +Œ“_š¡r +( +¡©ic_ÿ¡ +< +CG_suifR•r + *>( +li¡2 +)-> +Ý_ +. +š¡r +())); + +553 + gŠl1 +-> +­³nd +( +Šl2 +); + +555 +d–‘e + + gli¡2 +; + +557  + gli¡1 +; + +565 +CG_ouutR•r +* + gCG_suifBužd” +:: +C»©eP¿gma +(, + +566 cÚ¡ +¡d +:: +¡ršg + & +´agmaText +) const { + +567 iàÐ +´agmaText + =ð +¡d +:: +¡ršg +("") ) { + +568  +NULL +; + +570 +š¡ruùiÚ + * + gšs + = +Ãw + +š_¼r +( +io_mrk +); + +571 +immed_li¡ + * + giml + = +Ãw + immed_list; + +572 + giml +-> +­³nd +( +immed +( +cÚ¡_ÿ¡ +<*>( +´agmaText +. +c_¡r +()))); + +573 + gšs +-> +­³nd_ªnÙe +( +k_s2c_´agma +, +iml +); + +574 +Œ“_node_li¡ + * + gŠl + = +Ãw +ree_node_list; + +575 + gŠl +-> +­³nd +( +Ãw + +Œ“_š¡r +( +šs +)); + +576  +Ãw + +CG_suifR•r +( +Šl +); + +579 +CG_ouutR•r +* + gCG_suifBužd” +:: +C»©eDim3 +( +immed + +v¬Name +, immed +¬g1 +, immed +¬g2 +) const { + +580 +š¡ruùiÚ + * + gšs + = +Ãw + +š_¼r +( +io_mrk +); + +581 +immed_li¡ + * + giml + = +Ãw + immed_list; + +582 + giml +-> +­³nd +( +immed +( +v¬Name +)); + +583 + giml +-> +­³nd +( +¬g1 +); + +584 + giml +-> +­³nd +( +¬g2 +); + +585 + gšs +-> +­³nd_ªnÙe +( +k_cuda_dim3 +, +iml +); + +586 +Œ“_node_li¡ + * + gŠl + = +Ãw +ree_node_list; + +587 + gŠl +-> +­³nd +( +Ãw + +Œ“_š¡r +( +šs +)); + +588  +Ãw + +CG_suifR•r +( +Šl +); + +591 +CG_ouutR•r +* + gCG_suifBužd” +:: +C»©eDim3 +( +immed + +v¬Name +, immed +¬g1 +, immed +¬g2 +, immed +¬g3 +) const { + +592 +š¡ruùiÚ + * + gšs + = +Ãw + +š_¼r +( +io_mrk +); + +593 +immed_li¡ + * + giml + = +Ãw + immed_list; + +594 + giml +-> +­³nd +( +immed +( +v¬Name +)); + +595 + giml +-> +­³nd +( +¬g1 +); + +596 + giml +-> +­³nd +( +¬g2 +); + +597 + giml +-> +­³nd +( +¬g3 +); + +598 + gšs +-> +­³nd_ªnÙe +( +k_cuda_dim3 +, +iml +); + +599 +Œ“_node_li¡ + * + gŠl + = +Ãw +ree_node_list; + +600 + gŠl +-> +­³nd +( +Ãw + +Œ“_š¡r +( +šs +)); + +601  +Ãw + +CG_suifR•r +( +Šl +); + +604 +CG_ouutR•r +* + gCG_suifBužd” +:: +C»©eK”Ãl +( +immed_li¡ +* +iml +) const { + +605 +š¡ruùiÚ + * +šs + = +Ãw + +š_¼r +( +io_mrk +); + +606 + gšs +-> +­³nd_ªnÙe +( +k_cuda_k”Ãl +, +iml +); + +607 +Œ“_node_li¡ + * + gŠl + = +Ãw +ree_node_list; + +608 + gŠl +-> +­³nd +( +Ãw + +Œ“_š¡r +( +šs +)); + +609  +Ãw + +CG_suifR•r +( +Šl +); + +612 +ty³_node +* + gCG_suifBužd” +:: +ModifyTy³ +Ñy³_node* +ba£ +, cÚ¡ * +modif›r +) const { + +613 +modif›r_ty³ +* + g»suÉ + = +Ãw + modif›r_ty³( +TYPE_NULL +, +ba£ +); + +614 +immed_li¡ + * + giml + = +Ãw + immed_list; + +615 + giml +-> +­³nd +( +immed +((*) +modif›r +)); + +616 + g»suÉ +-> +­³nd_ªnÙe +( +k_cuda_modif›r +, +iml +); + +617  + g»suÉ +; + +626 +boÞ + +sub¡™u‹ +( +š¡ruùiÚ + * +š +, +v¬_sym + * +sym +, +Ý”ªd + +ex´ +, +ba£_symb + * +¡ +) { + +627 ià( + gš + =ð +NULL + || +sym + == NULL) + +628  +çl£ +; + +630 +boÞ + + gr + = +çl£ +; + +631  + gi + = 0; i < + gš +-> +num_¤cs +(); i++) { + +632 +Ý”ªd + +Ý +( +š +-> +¤c_Ý +( +i +)); + +634 ià( + gÝ +. +is_symbÞ +(è&& op. +symbÞ +(è=ð +sym +) { + +635 +š +-> +£t_¤c_Ý +( +i +, +ex´ +. +þÚe +( +¡ +)); + +636 + gr + = +Œue +; + +638 ià( + gÝ +. +is_š¡r +()) { + +639 + gr + = +sub¡™u‹ +( +Ý +. +š¡r +(), +sym +, +ex´ +, +¡ +) ||„; + +643  + gr +; + +646 +boÞ + +sub¡™u‹ +( +Œ“_node + * +Š +, +v¬_sym + * +sym +, +Ý”ªd + +ex´ +, +ba£_symb + * +¡ +) { + +647 ià( + gŠ + =ð +NULL +) + +648  +çl£ +; + +650 +boÞ + + gr + = +çl£ +; + +651 ià( + gŠ +-> +kšd +(è=ð +TREE_INSTR +) + +652 +r + = +sub¡™u‹ +( +¡©ic_ÿ¡ +< +Œ“_š¡r +*>( +Š +)-> +š¡r +(), +sym +, +ex´ +, +¡ +è|| + gr +; + +654  + gi + = 0; i < + gŠ +-> +num_chžd_li¡s +(); i++) { + +655 + gr + = +sub¡™u‹ +( +Š +-> +chžd_li¡_num +( +i +), +sym +, +ex´ +, +¡ +) ||„; + +659  + gr +; + +662 +boÞ + +sub¡™u‹ +( +Œ“_node_li¡ + * +Šl +, +v¬_sym + * +sym +, +Ý”ªd + +ex´ +, + +663 +ba£_symb + * +¡ +) { + +664 ià( + gŠl + =ð +NULL +) + +665  +çl£ +; + +667 +boÞ + + gr + = +çl£ +; + +668 +Œ“_node_li¡_™” + +™” +( +Šl +); + +669 ! + g™” +. +is_em±y +()) { + +670 +Œ“_node + * + gŠ + = +™” +. +¡• +(); + +672 + gr + = +sub¡™u‹ +( +Š +, +sym +, +ex´ +, +¡ +) ||„; + +675  + gr +; + + @CG_suifRepr.cc + +14  + ~ + +15  + ~<¡dio.h +> + +17 +Çme¥aû + + gomega + { + +19 + gCG_suifR•r +:: +CG_suifR•r +(): +Šl_ +( +NULL +), +Ý_ +() { + +22 + gCG_suifR•r +:: +CG_suifR•r +( +Œ“_node_li¡ + * +Šl +): +Šl_ +ÑÆ), +Ý_ +() { + +25 + gCG_suifR•r +:: +CG_suifR•r +( +Ý”ªd + +Ý +): +Šl_ +( +NULL +), +Ý_ +(op) { + +28 + gCG_suifR•r +::~ +CG_suifR•r +() { + +33 +CG_ouutR•r +* +CG_suifR•r +:: +þÚe +() { + +34 ià(! +Ý_ +. +is_nuÎ +() ) { + +35 +Ý”ªd + +Ý + = +Ý_ +. +þÚe +(); + +36  +Ãw + +CG_suifR•r +( +Ý +); + +38 ià( + gŠl_ + !ð +NULL +) { + +39 +Œ“_node_li¡ + * +Šl + = +Šl_ +-> +þÚe +(); + +40  +Ãw + +CG_suifR•r +( +Šl +); + +43  +Ãw + +CG_suifR•r +(); + +46  + gCG_suifR•r +:: +þ—r +() { + +47 ià(! +Ý_ +. +is_nuÎ +()) { + +48 ià( +Ý_ +. +is_š¡r +()) + +49 +d–‘e + +Ý_ +. +š¡r +(); + +50 + gÝ_ +. +£t_nuÎ +(); + +52 ià( + gŠl_ + !ð +NULL +) { + +53 +d–‘e + +Šl_ +; + +54 + gŠl_ + = +NULL +; + +58 +Œ“_node_li¡ +* + gCG_suifR•r +:: +G‘Code +() const { + +59  +Šl_ +; + +62 +Ý”ªd + + gCG_suifR•r +:: +G‘Ex´essiÚ +() const { + +63  +Ý_ +; + +66  + gCG_suifR•r +:: +Dump +() const { + +67 ià( +Šl_ + !ð +NULL +) + +68 +Šl_ +-> +´št +(); + +69 ià(! + gÝ_ +. +is_nuÎ +()) + +70 + gÝ_ +. +´št +(); + +73  + gCG_suifR•r +:: +DumpToFže +( +FILE + * +å +) const { + +74 ià( +Šl_ + !ð +NULL +) + +75 +Šl_ +-> +´št +( +å +); + +76 ià(! + gÝ_ +. +is_nuÎ +()) + +77 + gÝ_ +. +´št +( +å +); + + @code_gen.cc + +16  + ~ + +17  + ~ + +18  + ~ + +19  + ~ + +20  + ~ + +21  + ~ + +22  + ~ + +23  + ~ + +24  + ~ + +26  + ~ + +27  + ~ + +28  + ~ + +29  + ~ + +30  + ~ + +31  + ~ + +32  + ~ + +34 +Çme¥aû + + gomega + { + +37  + gÏ¡_Ëv– +; + +38 +S‘Tu¶e + + gÃw_IS +; + +39 +S‘Tu¶eTu¶e + + g´ojeùed_nIS +; + +40 + gTu¶e +< + gCG_ouutR•r + *> + g¡©em’tInfo +; + +41 +R–Tu¶e + + gŒªsfÜm©iÚs +; + +44 + gTu¶e +< Tu¶e<> > + gsmtNÚS¶™Lev–s +; + +45 + gTu¶e +< Tu¶e< + g¡d +:: +¡ršg +> > +loÝIdxNames +; + +46 + g¡d +:: +veùÜ +< +¡d +:: +·œ +<, std:: +¡ršg +> > +syncs +; + +51  + gcheckLoÝLev– +; + +52  + g¡mtFÜLoÝCheck +; + +53  + guµ”BoundFÜLev– +; + +54  + glow”BoundFÜLev– +; + +55 +boÞ + + gfžlInBounds +; + +58 þas  + cJunkSticIn™ +{ + gpublic +: +JunkSticIn™ +(){ +checkLoÝLev– +=0; + gfžlInBounds += +çl£ +;} }; + +59  +JunkSticIn™ + + gjunkIn™In¡ªû__ +; + +64 +CG_»suÉ + * +g’_»cursive +( +Ëv– +, +IÁTu¶e + & +isAùive +); + +67  + gcode_g’_debug +=0; + +70 +S‘Tu¶e + + $fž‹r_funùiÚ_symbÞs +( +S‘Tu¶e + & +£ts +, +boÞ + +k“p_fs +){ + +71 +S‘Tu¶e + + `Ãw_£ts +( +£ts +. + `size +()); + +72  +i + = 1; i <ð +£ts +. + `size +(); i++) { + +73 +R–©iÚ + +R + = +£ts +[ +i +]; + +74 +R–©iÚ + & +S + = +Ãw_£ts +[ +i +]; + +75 + `as£¹ +( +R +. + `is_£t +()); + +77 +S + = + `R–©iÚ +( +R +. + `n_£t +()); + +78 +S +. + `cÝy_Çmes +( +R +); + +79 +F_Exi¡s + * +ã + = +S +. + `add_exi¡s +(); + +80 +F_Or + * +fo + = +ã +-> + `add_Ü +(); + +81  +DNF_I‹¿tÜ + + `D +( +R +. + `qu”y_DNF +()); +D +; D++) { + +82 +F_And + * +ç + = +fo +-> + `add_ªd +(); + +83 +V¬ŸbË_ID_Tu¶e + & +Þdloÿls + = (* +D +)-> + `loÿls +(); + +84 +SeùiÚ +< +V¬ŸbË_ID +> +Ãwloÿls + = +ã +-> + `deþ¬e_tu¶e +( +Þdloÿls +. + `size +()); + +91  +EQ_I‹¿tÜ + + `e +(* +D +); +e +;ƒ++) + +92 if(( + `max_fs_¬™y +(* +e +è> 0è=ð +k“p_fs +){ + +93 +EQ_HªdË + +n + = +ç +-> + `add_EQ +(); + +94  +CÚ¡r_V¬s_I‹r + + `cvi +(* +e +, +çl£ +); +cvi +;cvi++) + +95 if((* +cvi +). +v¬ +-> + `kšd +(è=ð +Wždÿrd_V¬ +) + +96 +n +. + `upd©e_cÛf +( +Ãwloÿls +[ +Þdloÿls +. + `šdex +((* +cvi +). +v¬ +)], + +97 (* +cvi +). +cÛf +); + +99 if((* +cvi +). +v¬ +-> + `kšd +(è=ð +Glob®_V¬ +) + +100 +n +. + `upd©e_cÛf +( +S +. + `g‘_loÿl +((* +cvi +). +v¬ +-> + `g‘_glob®_v¬ +(), + +101 (* +cvi +). +v¬ +-> + `funùiÚ_of +()), + +102 (* +cvi +). +cÛf +); + +104 +n +. + `upd©e_cÛf +((* +cvi +). +v¬ +,(*cvi). +cÛf +); + +105 +n +. + `upd©e_cÚ¡ +((* +e +). + `g‘_cÚ¡ +()); + +106 +n +. + `fš®ize +(); + +109  +GEQ_I‹¿tÜ + + `g +(* +D +); +g +; g++) + +110 if(( + `max_fs_¬™y +(* +g +è> 0è=ð +k“p_fs +) { + +111 +GEQ_HªdË + +n + = +ç +-> + `add_GEQ +(); + +112  +CÚ¡r_V¬s_I‹r + + `cvi +(* +g +, +çl£ +); +cvi +;cvi++) + +113 if((* +cvi +). +v¬ +-> + `kšd +(è=ð +Wždÿrd_V¬ +) + +114 +n +. + `upd©e_cÛf +( +Ãwloÿls +[ +Þdloÿls +. + `šdex +((* +cvi +). +v¬ +)], + +115 (* +cvi +). +cÛf +); + +117 if((* +cvi +). +v¬ +-> + `kšd +(è=ð +Glob®_V¬ +) + +118 +n +. + `upd©e_cÛf +( +S +. + `g‘_loÿl +((* +cvi +). +v¬ +-> + `g‘_glob®_v¬ +(), + +119 (* +cvi +). +v¬ +-> + `funùiÚ_of +()), + +120 (* +cvi +). +cÛf +); + +122 +n +. + `upd©e_cÛf +((* +cvi +). +v¬ +,(*cvi). +cÛf +); + +123 +n +. + `upd©e_cÚ¡ +((* +g +). + `g‘_cÚ¡ +()); + +124 +n +. + `fš®ize +(); + +127 +S +. + `fš®ize +(); + +130  +Ãw_£ts +; + +131 + } +} + +134 +R–Tu¶e + + $¡r_funùiÚ_symbÞs +( +S‘Tu¶e + & +£ts +) { + +135  + `fž‹r_funùiÚ_symbÞs +( +£ts +, +çl£ +); + +136 + } +} + +138 +R–Tu¶e + + $exŒaù_funùiÚ_symbÞs +( +S‘Tu¶e + & +£ts +) { + +139  + `fž‹r_funùiÚ_symbÞs +( +£ts +, +Œue +); + +140 + } +} + +143 + g¡d +:: +¡ršg + + $MMG’”©eCode +( +R–Tu¶e + & +T +, +S‘Tu¶e + & +Þd_IS +, +R–©iÚ + & +known +,  +effÜt +) { + +144 +Tu¶e +< +CG_ouutR•r + *> +ÇmeInfo +; + +145  +¡mt + = 1; stmˆ<ð +T +. + `size +(); stmt++) + +146 +ÇmeInfo +. + `­³nd +( +Ãw + + `CG_¡ršgR•r +("s" + + `to_¡ršg +( +¡mt +))); + +148 +CG_¡ršgBužd” + +ocg +; + +149 +CG_¡ršgR•r + * +sR•r + = +¡©ic_ÿ¡ +( + `MMG’”©eCode +(& +ocg +, +T +, +Þd_IS +, +ÇmeInfo +, +known +, +effÜt +)); + +151  +i + = 1; i <ð +ÇmeInfo +. + `size +(); i++) + +152 +d–‘e + +ÇmeInfo +[ +i +]; + +153 ià( +sR•r + !ð +NULL +) + +154  + `G‘SŒšg +( +sR•r +); + +156  +¡d +:: + `¡ršg +(); + +157 + } +} + +163 +CG_ouutR•r +* +MMG’”©eCode +( +CG_ouutBužd” +* +ocg +, +R–Tu¶e + & +T +, +S‘Tu¶e + & +Þd_IS +, cÚ¡ +Tu¶e + & +¡mt_cÚ‹Á +, +R–©iÚ + & +known +,  +effÜt +) { + +164  + g¡mts + = +T +. +size +(); + +165 ià( + g¡mts + == 0) + +166  +ocg +-> +C»©eComm’t +(1, "No statements found!"); + +167 ià(! + gknown +. +is_nuÎ +()) + +168 + gknown +. +sim¶ify +(); + +171  + gmaxStmt + = 1; + +172 + gÏ¡_Ëv– + = 0; + +173  + g¡mt + = 1; stmˆ<ð +¡mts +; stmt++) { + +174  + gÞd_dim + = +T +[ +¡mt +]. +n_out +(); + +175 ià( + gÞd_dim + > + gÏ¡_Ëv– +) + +176 + gÏ¡_Ëv– + = +Þd_dim +; + +178  + gi + = 1; i <ð +Þd_IS +[ +¡mt +]. +n_£t +(); i++) + +179 + gT +[ +¡mt +]. +Çme_šput_v¬ +( +i +, +Þd_IS +[¡mt]. +£t_v¬ +(i)-> +Çme +()); + +180  + gi + = 1; i <ð +Þd_dim +; i++) + +181 + gT +[ +¡mt +]. +Çme_ouut_v¬ +( +i +, +¡d +:: +¡ršg +("t")+ +to_¡ršg +(i)); + +182 + gT +[ +¡mt +]. +£tup_Çmes +(); + +184 +R–©iÚ + + gR + = +Rªge +( +Re¡riù_Domaš +( +cÝy +( +T +[ +¡mt +]), cÝy( +Þd_IS +[stmt]))); + +185 + gR +. +sim¶ify +(); + +186  + gR +. +is_uµ”_bound_§tisfŸbË +()) { + +187 + gÃw_IS +. +»®loÿ‹ +( +maxStmt +); + +188 + gŒªsfÜm©iÚs +. +»®loÿ‹ +( +maxStmt +); + +189 + g¡©em’tInfo +. +»®loÿ‹ +( +maxStmt +); + +190 +DNF + * + gdnf + = +R +. +qu”y_DNF +(); + +191 +DNF_I‹¿tÜ + +c +( +dnf +); + +192 +R–©iÚ + + gR2 + = R–©iÚ( +R +, * +c +); + +193 + gR2 +. +sim¶ify +(); + +194 ià( + gR2 +. +is_šexaù +()) + +195 +throw + +codeg’_”rÜ +("unknown constraint in†oop bounds"); + +196 ià( + gknown +. +is_nuÎ +()) { + +197 + gÃw_IS +[ +maxStmt +] = +R2 +; + +198 + gŒªsfÜm©iÚs +[ +maxStmt +] = +T +[ +¡mt +]; + +199 + g¡©em’tInfo +[ +maxStmt +] = +¡mt_cÚ‹Á +[ +¡mt +]; + +200 + gmaxStmt +++; + +203 +R–©iÚ + + gR2_ex‹nded + = +cÝy +( +R2 +); + +204 +R–©iÚ + + gknown_ex‹nded + = +cÝy +( +known +); + +205 ià( + gR2 +. +n_£t +(è> + gknown +.n_set()) + +206 + gknown_ex‹nded + = +Ex‹nd_S‘ +( +known_ex‹nded +, +R2 +. +n_£t +()- +known +.n_set()); + +207 ià( + gR2 +. +n_£t +(è< + gknown +.n_set()) + +208 + gR2_ex‹nded + = +Ex‹nd_S‘ +( +R2_ex‹nded +, +known +. +n_£t +()- +R2 +.n_set()); + +209 ià( +IÁ”£ùiÚ +( +R2_ex‹nded +, +known_ex‹nded +). +is_uµ”_bound_§tisfŸbË +()) { + +210 + gÃw_IS +[ +maxStmt +] = +R2 +; + +211 + gŒªsfÜm©iÚs +[ +maxStmt +] = +T +[ +¡mt +]; + +212 + g¡©em’tInfo +[ +maxStmt +] = +¡mt_cÚ‹Á +[ +¡mt +]; + +213 + gmaxStmt +++; + +216 + gc +. +Ãxt +(); + +217 ià(! + gc +. +live +()) + +219 if( + gcode_g’_debug +) { + +220 +årštf +( +DebugFže +, "splitting iteration space for disjoint form\n"); + +221 +årštf +( +DebugFže +, "Original iteration space: \n"); + +222 + gR +. +´št_w™h_subs +( +DebugFže +); + +223 +årštf +( +DebugFže +, "First conjunct: \n"); + +224 + gR2 +. +´št_w™h_subs +( +DebugFže +); + +226 +R–©iÚ + +»mašd” +( +R +, * +c +); + +227 + gc +. +Ãxt +(); + +228  + gc +. +live +()) { + +229 + g»mašd” + = +UniÚ +( +»mašd” +, +R–©iÚ +( +R +, * +c +)); + +230 + gc +. +Ãxt +(); + +232 + gR + = +Difã»nû +( +»mašd” +, +cÝy +( +R2 +)); + +233 + gR +. +sim¶ify +(); + +234 if( + gcode_g’_debug +) { + +235 +årštf +( +DebugFže +, "Remaining iteration space: \n"); + +236 + gR +. +´št_w™h_subs +( +DebugFže +); + +242 + g¡mts + = +maxStmt +-1; + +243 if( + g¡mts + == 0) + +244  +ocg +-> +C»©eComm’t +(1, "No…oints in‡ny ofhe iteration spaces!"); + +247  + g¡mt + = 1; stmˆ<ð +¡mts +; stmt++) { + +248  + gÞd_dim + = +Ãw_IS +[ +¡mt +]. +n_£t +(); + +249 ià( + gÞd_dim + < + gÏ¡_Ëv– +) { + +250 + gÃw_IS +[ +¡mt +] = +Ex‹nd_S‘ +( +Ãw_IS +[¡mt], +Ï¡_Ëv– +- +Þd_dim +); + +251 +F_And + * + gf_roÙ + = +Ãw_IS +[ +¡mt +]. +ªd_w™h_ªd +(); + +252  + gi + = +Þd_dim ++1; i <ð +Ï¡_Ëv– +; i++) { + +253 +EQ_HªdË + + gh + = +f_roÙ +-> +add_EQ +(); + +254 + gh +. +upd©e_cÛf +( +Ãw_IS +[ +¡mt +]. +£t_v¬ +( +i +), 1); + +255 + gh +. +upd©e_cÚ¡ +( +posInfš™y +); + +261 if( + gknown +. +is_nuÎ +()) { + +262 + gknown + = +R–©iÚ +:: +True +( +Ï¡_Ëv– +); + +264 + gknown + = +Ex‹nd_S‘ +( +known +, +Ï¡_Ëv– +-known. +n_£t +()); + +265  + gi + = 1; i <ð +Ï¡_Ëv– +; i++) + +266 + gknown +. +Çme_£t_v¬ +( +i +, +¡d +:: +¡ršg +("t")+ +to_¡ršg +(i)); + +267 + gknown +. +£tup_Çmes +(); + +270 + g´ojeùed_nIS +. +þ—r +(); + +271 + g´ojeùed_nIS +. +»®loÿ‹ +( +Ï¡_Ëv– +); + +272  + gi + = 1; i <ð +Ï¡_Ëv– +; i++ ) { + +273 + g´ojeùed_nIS +[ +i +]. +»®loÿ‹ +( +¡mts +); + +275  + g¡mt + = 1; stmˆ<ð +¡mts +; stmt++) { + +276 ià( + gÏ¡_Ëv– + > 0) + +277 + g´ojeùed_nIS +[ +Ï¡_Ëv– +][ +¡mt +] = +Ãw_IS +[stmt]; + +278  + gi + = +Ï¡_Ëv– +-1; i >= 1; i--) { + +279 + g´ojeùed_nIS +[ +i +][ +¡mt +] = +Projeù +( +cÝy +( +´ojeùed_nIS +[i+1][¡mt]), i+1, +S‘_V¬ +); + +280 + g´ojeùed_nIS +[ +i +][ +¡mt +]. +sim¶ify +(); + +285 +IÁTu¶e + +®lStmts +( +¡mts +); + +286  + gi + = 1; i <ð +¡mts +; i++) + +287 + g®lStmts +[ +i +] = 1; + +288 +CG_»suÉ + * + gcg + = +g’_»cursive +(1, +®lStmts +); + +291 + gcg + = +cg +-> +»compu‹ +( +known +, known); + +292 + gcg + = +cg +-> +fÜû_fš™e_bounds +(); + +295  + gi + = 1; i <ð +mš +( +effÜt +, +cg +-> +d•th +()); i++) + +296 + gcg + = +cg +-> +liáOv”h—d +( +i +); + +299 + gcg +-> +hoi¡Gu¬d +(); + +303 +CG_ouutR•r +* + gsR•r + = +cg +-> +´štR•r +( +ocg +, 1, +¡d +:: +veùÜ +( +Ï¡_Ëv– +)); + +304 +d–‘e + + gcg +; + +305 + gcg + = +NULL +; + +306 + g´ojeùed_nIS +. +þ—r +(); + +307 + gŒªsfÜm©iÚs +. +þ—r +(); + +308 + gÃw_IS +. +þ—r +(); + +310  + gsR•r +; + +314 +CG_ouutR•r +* +MMG’”©eCode +( +CG_ouutBužd” +* +ocg +, +R–Tu¶e + & +T +, +S‘Tu¶e + & +Þd_IS +, + +315 cÚ¡ +Tu¶e +< +CG_ouutR•r + *> & +¡mt_cÚ‹Á +, +R–©iÚ + & +known +, + +316 +Tu¶e +< +IÁTu¶e + >& +smtNÚS¶™Lev–s_ +, + +317 +¡d +:: +veùÜ +< std:: +·œ +<, std:: +¡ršg +> > +syncs_ +, + +318 cÚ¡ +Tu¶e +< Tu¶e< +¡d +:: +¡ršg +> >& +loÝIdxNames_ +, + +319  +effÜt +) { + +320  + g¡mts + = +T +. +size +(); + +321 ià( + g¡mts + == 0) + +322  +ocg +-> +C»©eComm’t +(1, "No statements found!"); + +323 ià(! + gknown +. +is_nuÎ +()) + +324 + gknown +. +sim¶ify +(); + +328 + gsmtNÚS¶™Lev–s + = +smtNÚS¶™Lev–s_ +; + +329 + gsyncs + = +syncs_ +; + +330 + gloÝIdxNames + = +loÝIdxNames_ +; + +336  + gmaxStmt + = 1; + +337 + gÏ¡_Ëv– + = 0; + +338  + g¡mt + = 1; stmˆ<ð +¡mts +; stmt++) { + +339  + gÞd_dim + = +T +[ +¡mt +]. +n_out +(); + +340 ià( + gÞd_dim + > + gÏ¡_Ëv– +) + +341 + gÏ¡_Ëv– + = +Þd_dim +; + +343  + gi + = 1; i <ð +Þd_IS +[ +¡mt +]. +n_£t +(); i++) + +344 + gT +[ +¡mt +]. +Çme_šput_v¬ +( +i +, +Þd_IS +[¡mt]. +£t_v¬ +(i)-> +Çme +()); + +345  + gi + = 1; i <ð +Þd_dim +; i++) + +346 + gT +[ +¡mt +]. +Çme_ouut_v¬ +( +i +, +¡d +:: +¡ršg +("t")+ +to_¡ršg +(i)); + +347 + gT +[ +¡mt +]. +£tup_Çmes +(); + +349 +R–©iÚ + + gR + = +Rªge +( +Re¡riù_Domaš +( +cÝy +( +T +[ +¡mt +]), cÝy( +Þd_IS +[stmt]))); + +350 + gR +. +sim¶ify +(); + +351  + gR +. +is_uµ”_bound_§tisfŸbË +()) { + +352 + gÃw_IS +. +»®loÿ‹ +( +maxStmt +); + +353 + gŒªsfÜm©iÚs +. +»®loÿ‹ +( +maxStmt +); + +354 + g¡©em’tInfo +. +»®loÿ‹ +( +maxStmt +); + +357 + gsmtNÚS¶™Lev–s +. +»®loÿ‹ +( +maxStmt +); + +361 +DNF + * + gdnf + = +R +. +qu”y_DNF +(); + +362 +DNF_I‹¿tÜ + +c +( +dnf +); + +363 +R–©iÚ + + gR2 + = R–©iÚ( +R +, * +c +); + +364 + gR2 +. +sim¶ify +(); + +365 ià( + gR2 +. +is_šexaù +()) + +366 +throw + +codeg’_”rÜ +("unknown constraint in†oop bounds"); + +367 ià( + gknown +. +is_nuÎ +()) { + +368 + gÃw_IS +[ +maxStmt +] = +R2 +; + +369 + gŒªsfÜm©iÚs +[ +maxStmt +] = +T +[ +¡mt +]; + +370 + g¡©em’tInfo +[ +maxStmt +] = +¡mt_cÚ‹Á +[ +¡mt +]; + +371 + gmaxStmt +++; + +374 +R–©iÚ + + gR2_ex‹nded + = +cÝy +( +R2 +); + +375 +R–©iÚ + + gknown_ex‹nded + = +cÝy +( +known +); + +376 ià( + gR2 +. +n_£t +(è> + gknown +.n_set()) + +377 + gknown_ex‹nded + = +Ex‹nd_S‘ +( +known_ex‹nded +, +R2 +. +n_£t +()- +known +.n_set()); + +378 ià( + gR2 +. +n_£t +(è< + gknown +.n_set()) + +379 + gR2_ex‹nded + = +Ex‹nd_S‘ +( +R2_ex‹nded +, +known +. +n_£t +()- +R2 +.n_set()); + +380 ià( +IÁ”£ùiÚ +( +R2_ex‹nded +, +known_ex‹nded +). +is_uµ”_bound_§tisfŸbË +()) { + +381 + gÃw_IS +[ +maxStmt +] = +R2 +; + +382 + gŒªsfÜm©iÚs +[ +maxStmt +] = +T +[ +¡mt +]; + +383 + g¡©em’tInfo +[ +maxStmt +] = +¡mt_cÚ‹Á +[ +¡mt +]; + +384 + gmaxStmt +++; + +387 + gc +. +Ãxt +(); + +388 ià(! + gc +. +live +()) + +390 if( + gcode_g’_debug +) { + +391 +årštf +( +DebugFže +, "splitting iteration space for disjoint form\n"); + +392 +årštf +( +DebugFže +, "Original iteration space: \n"); + +393 + gR +. +´št_w™h_subs +( +DebugFže +); + +394 +årštf +( +DebugFže +, "First conjunct: \n"); + +395 + gR2 +. +´št_w™h_subs +( +DebugFže +); + +397 +R–©iÚ + +»mašd” +( +R +, * +c +); + +398 + gc +. +Ãxt +(); + +399  + gc +. +live +()) { + +400 + g»mašd” + = +UniÚ +( +»mašd” +, +R–©iÚ +( +R +, * +c +)); + +401 + gc +. +Ãxt +(); + +403 + gR + = +Difã»nû +( +»mašd” +, +cÝy +( +R2 +)); + +404 + gR +. +sim¶ify +(); + +405 if( + gcode_g’_debug +) { + +406 +årštf +( +DebugFže +, "Remaining iteration space: \n"); + +407 + gR +. +´št_w™h_subs +( +DebugFže +); + +413 + g¡mts + = +maxStmt +-1; + +414 if( + g¡mts + == 0) + +415  +ocg +-> +C»©eComm’t +(1, "No…oints in‡ny ofhe iteration spaces!"); + +418  + g¡mt + = 1; stmˆ<ð +¡mts +; stmt++) { + +419  + gÞd_dim + = +Ãw_IS +[ +¡mt +]. +n_£t +(); + +420 ià( + gÞd_dim + < + gÏ¡_Ëv– +) { + +421 + gÃw_IS +[ +¡mt +] = +Ex‹nd_S‘ +( +Ãw_IS +[¡mt], +Ï¡_Ëv– +- +Þd_dim +); + +422 +F_And + * + gf_roÙ + = +Ãw_IS +[ +¡mt +]. +ªd_w™h_ªd +(); + +423  + gi + = +Þd_dim ++1; i <ð +Ï¡_Ëv– +; i++) { + +424 +EQ_HªdË + + gh + = +f_roÙ +-> +add_EQ +(); + +425 + gh +. +upd©e_cÛf +( +Ãw_IS +[ +¡mt +]. +£t_v¬ +( +i +), 1); + +426 + gh +. +upd©e_cÚ¡ +( +posInfš™y +); + +432 if( + gknown +. +is_nuÎ +()) { + +433 + gknown + = +R–©iÚ +:: +True +( +Ï¡_Ëv– +); + +435 + gknown + = +Ex‹nd_S‘ +( +known +, +Ï¡_Ëv– +-known. +n_£t +()); + +436  + gi + = 1; i <ð +Ï¡_Ëv– +; i++) + +437 + gknown +. +Çme_£t_v¬ +( +i +, +¡d +:: +¡ršg +("t")+ +to_¡ršg +(i)); + +438 + gknown +. +£tup_Çmes +(); + +441 + g´ojeùed_nIS +. +þ—r +(); + +442 + g´ojeùed_nIS +. +»®loÿ‹ +( +Ï¡_Ëv– +); + +443  + gi + = 1; i <ð +Ï¡_Ëv– +; i++ ) { + +444 + g´ojeùed_nIS +[ +i +]. +»®loÿ‹ +( +¡mts +); + +446  + g¡mt + = 1; stmˆ<ð +¡mts +; stmt++) { + +447 ià( + gÏ¡_Ëv– + > 0) + +448 + g´ojeùed_nIS +[ +Ï¡_Ëv– +][ +¡mt +] = +Ãw_IS +[stmt]; + +449  + gi + = +Ï¡_Ëv– +-1; i >= 1; i--) { + +450 + g´ojeùed_nIS +[ +i +][ +¡mt +] = +Projeù +( +cÝy +( +´ojeùed_nIS +[i+1][¡mt]), i+1, +S‘_V¬ +); + +451 + g´ojeùed_nIS +[ +i +][ +¡mt +]. +sim¶ify +(); + +456 +IÁTu¶e + +®lStmts +( +¡mts +); + +457  + gi + = 1; i <ð +¡mts +; i++) + +458 + g®lStmts +[ +i +] = 1; + +459 +CG_»suÉ + * + gcg + = +g’_»cursive +(1, +®lStmts +); + +462 + gcg + = +cg +-> +»compu‹ +( +known +, known); + +463 + gcg + = +cg +-> +fÜû_fš™e_bounds +(); + +466  + gi + = 1; i <ð +mš +( +effÜt +, +cg +-> +d•th +()); i++) + +467 + gcg + = +cg +-> +liáOv”h—d +( +i +); + +470 + gcg +-> +hoi¡Gu¬d +(); + +474 +CG_ouutR•r +* + gsR•r + = +cg +-> +´štR•r +( +ocg +, 1, +¡d +:: +veùÜ +( +Ï¡_Ëv– + )); + +475 +d–‘e + + gcg +; + +476 + gcg + = +NULL +; + +477 + g´ojeùed_nIS +. +þ—r +(); + +478 + gŒªsfÜm©iÚs +. +þ—r +(); + +479 + gÃw_IS +. +þ—r +(); + +481  + gsR•r +; + +484 +CG_»suÉ + * + $g’_»cursive +( +Ëv– +, +IÁTu¶e + & +isAùive +) { + +485  +¡mts + = +isAùive +. + `size +(); + +487 +S‘ +<> +aùive +; + +488  +s +; + +489  +s + = 1; s <ð +¡mts +; s++) + +490 if( +isAùive +[ +s +]è +aùive +. + `š£¹ +(s); + +492 + `as£¹ + ( +aùive +. + `size +() >= 1); + +493 if( +Ëv– + > +Ï¡_Ëv– +è +Ãw + + `CG_Ëaf +( +isAùive +); + +495 ià( +aùive +. + `size +() == 1) + +496  +Ãw + + `CG_loÝ +( +isAùive +, +Ëv– +, + `g’_»cursive +(level+1,isActive)); + +498 +boÞ + +cÚ¡ªtLev– + = +Œue +; + +500  +‹¡_»l_size +; + +501 +cÛf_t + +¡¬t +, +fšish +; + +502 +fšish + = -( +posInfš™y +-1); + +503 +¡¬t + = +posInfš™y +; + +504 +Tu¶e +< +cÛf_t +> + `wh’ +( +¡mts +); + +505  +s +=1; s<= +¡mts +; s++èià( +isAùive +[s]) { + +506 +cÛf_t + +lb +, +ub +; + +507 +‹¡_»l_size + = +´ojeùed_nIS +[ +Ëv– +][ +s +]. + `n_£t +(); + +508 +´ojeùed_nIS +[ +Ëv– +][ +s +]. + `sšgË_cÚjunù +() + +509 -> + `qu”y_v¬ŸbË_bounds +( + +510 +´ojeùed_nIS +[ +Ëv– +][ +s +]. + `£t_v¬ +(level), + +511 +lb +, +ub +); + +512 if( +code_g’_debug +) { + +513 + `årštf +( +DebugFže +, "IS%d: " +cÛf_fmt + " <ðt%d <ð" cÛf_fmˆ"\n", +s +, + +514 +lb +, +Ëv– +, +ub +); + +515 +´ojeùed_nIS +[ +Ëv– +][ +s +]. + `´efix_´št +( +DebugFže +); + +517 ià( +lb + !ð +ub +) { + +518 +cÚ¡ªtLev– + = +çl£ +; + +522 + `£t_max +( +fšish +, +lb +); + +523 + `£t_mš +( +¡¬t +, +lb +); + +524 +wh’ +[ +s +] = +lb +; + +529 ià( +cÚ¡ªtLev– + && +fšish +- +¡¬t + <ð +¡mts +) { + +530 +IÁTu¶e + + `ÃwAùive +( +isAùive +. + `size +()); + +531  +i +=1; i<= +¡mts +; i++) + +532 +ÃwAùive +[ +i +] = +isAùive +[i] && +wh’ +[i] =ð +¡¬t +; + +533 +CG_»suÉ + * +r + = +Ãw + + `CG_loÝ +( +isAùive +, +Ëv– +, + +534 + `g’_»cursive +( +Ëv– ++1, +ÃwAùive +)); + +535  +cÛf_t + +time + = +¡¬t ++1;im<ð +fšish +;ime++) { + +536  +couÁ + = 0; + +537  +i +=1; i<= +¡mts +; i++) { + +538 +ÃwAùive +[ +i +] = +isAùive +[i] && +wh’ +[i] =ð +time +; + +539 ià( +ÃwAùive +[ +i +]è +couÁ +++; + +541 ià( +couÁ +) { + +542 +R–©iÚ + + `‹¡_»l +( +‹¡_»l_size +); + +543 +GEQ_HªdË + +g + = +‹¡_»l +. + `ªd_w™h_GEQ +(); + +544 +g +. + `upd©e_cÛf +( +‹¡_»l +. + `£t_v¬ +( +Ëv– +),-1); + +545 +g +. + `upd©e_cÚ¡ +( +time +-1); + +547 +r + = +Ãw + + `CG_¥l™ +( +isAùive +, +Ëv– +, +‹¡_»l +,r, + +548 +Ãw + + `CG_loÝ +( +isAùive +, +Ëv– +, + +549 + `g’_»cursive +( +Ëv– ++1, +ÃwAùive +))); + +552  +r +; + +560 +R–©iÚ + +huÎ + = + `HuÎ +( +´ojeùed_nIS +[ +Ëv– +], +isAùive +,1); + +562 +R–©iÚ + +huÎ + = + `HuÎ +( +´ojeùed_nIS +[ +Ëv– +], +isAùive +,0); + +565 if( +code_g’_debug +) { + +566 + `årštf +( +DebugFže +, "HuÎ (Ëv– %dèis:\n", +Ëv– +); + +567 +huÎ +. + `´efix_´št +( +DebugFže +); + +571 +IÁTu¶e + + `fœ¡Chunk +( +isAùive +); + +572 +IÁTu¶e + + `£cÚdChunk +( +isAùive +); + +579 +boÞ + +checkFÜS¶™s + = +Œue +; + +580  +s + = 1; s <ð +isAùive +. + `size +(); s++){ + +581 ià( +isAùive +[ +s +]) { + +582 if( +s + < +smtNÚS¶™Lev–s +. + `size +(è&& smtNÚS¶™Lev–s[s]. + `šdex +( +Ëv– +-2) != 0){ + +583 +checkFÜS¶™s + = +çl£ +; + +590  +s + = 1; +checkFÜS¶™s + && s <ð +isAùive +. + `size +(); s++) + +591 ià( +isAùive +[ +s +]) { + +592 +R–©iÚ + +gi¡ + = + `Gi¡ +( + `cÝy +( +´ojeùed_nIS +[ +Ëv– +][ +s +]),cÝy( +huÎ +),1); + +593 ià( +gi¡ +. + `is_obvious_utÞogy +()) ; + +594 +gi¡ +. + `sim¶ify +(); + +595 +CÚjunù + * +s_cÚj + = +gi¡ +. + `sšgË_cÚjunù +(); + +596  +GEQ_I‹¿tÜ + + `G +( +s_cÚj +); +G +; G++) { + +597 +R–©iÚ + + `‹¡_»l +( +gi¡ +. + `n_£t +()); + +598 +‹¡_»l +. + `ªd_w™h_GEQ +(* +G +); + +599 +V¬ŸbË_ID + +v + = + `£t_v¬ +( +Ëv– +); + +600 +cÛf_t + +sign + = (* +G +). + `g‘_cÛf +( +v +); + +601 if( +sign + > 0è +‹¡_»l + = + `Com¶em’t +(test_rel); + +602 if( +code_g’_debug +) { + +603 + `årštf +( +DebugFže +, "CÚsid”šg s¶™ from stmˆ%d:\n", +s +); + +604 +‹¡_»l +. + `´efix_´št +( +DebugFže +); + +607 +fœ¡Chunk +[ +s +] = +sign + <= 0; + +608 +£cÚdChunk +[ +s +] = +sign + > 0; + +609  +numb”Fœ¡ + = +sign + <= 0; + +610  +numb”SecÚd + = +sign + > 0; + +612  +s2 + = 1; s2 <ð +isAùive +. + `size +(); s2++) + +613 ià( +isAùive +[ +s2 +] && s2 !ð +s +) { + +614 if( +code_g’_debug +) + +615 + `årštf +( +DebugFže +,"CÚsid” stmˆ%d\n", +s2 +); + +616 +boÞ + +t + = + `IÁ”£ùiÚ +( + `cÝy +( +´ojeùed_nIS +[ +Ëv– +][ +s2 +]), + +617 + `cÝy +( +‹¡_»l +)). + `is_uµ”_bound_§tisfŸbË +(); + +618 +boÞ + +f + = + `Difã»nû +( + `cÝy +( +´ojeùed_nIS +[ +Ëv– +][ +s2 +]), + +619 + `cÝy +( +‹¡_»l +)). + `is_uµ”_bound_§tisfŸbË +(); + +620 + `as£¹ +( +t + || +f +); + +621 if( +code_g’_debug + && +t +&& +f +) + +622 + `årštf +( +DebugFže +, "SÏshe ¡mˆ%d\n", +s2 +); + +623 ià( +t +&& +f +è +ÃxtGEQ +; + +624 if( +code_g’_debug +) { + +625 ià( +t +) + +626 + `årštf +( +DebugFže +, "ŒufÜ stmˆ%d\n", +s2 +); + +628 + `årštf +( +DebugFže +, "çl£ fÜ stmˆ%d\n", +s2 +); + +630 ià( +t +è +numb”Fœ¡ +++; + +631 +numb”SecÚd +++; + +632 +fœ¡Chunk +[ +s2 +] = +t +; + +633 +£cÚdChunk +[ +s2 +] = ! +t +; + +636 + `as£¹ +( +numb”Fœ¡ ++ +numb”SecÚd +>1 && "Can't handle wildcard in iteration space"); + +637 if( +code_g’_debug +) + +638 + `årštf +( +DebugFže +, "%drue, %d false\n", + +639 +numb”Fœ¡ +, + +640 +numb”SecÚd +); + +641 ià( +numb”Fœ¡ + && +numb”SecÚd +) { + +643  +Ãw + + `CG_¥l™ +( +isAùive +, +Ëv– +, +‹¡_»l +, + +644 + `g’_»cursive +( +Ëv– +, +fœ¡Chunk +), + +645 + `g’_»cursive +( +Ëv– +, +£cÚdChunk +)); + +647 +ÃxtGEQ +: ; + +653  +Ãw + + `CG_loÝ +( +isAùive +, +Ëv– +, + `g’_»cursive +(level+1,isActive)); + +654 + } +} + + @output_repr.cc + +16  + ~ + +17  + ~ + +18  + ~ + +19  + ~ + +20  + ~ + +21  + ~<¡ack +> + +22  + ~ + +24 +Çme¥aû + + gomega + { + +26 +Tu¶e + > +´ojeùed_nIS +; + +27  + gv¬_sub¡™utiÚ_th»shÞd + = 100; + +29  +uµ”BoundFÜLev– +; + +30  +low”BoundFÜLev– +; + +31 +boÞ + +fžlInBounds +; + +37 +Çme¥aû + + gomega + { + +39 + g¡d +:: +·œ +< +EQ_HªdË +, > +fšd_sim¶e¡_assignm’t +(cÚ¡ +R–©iÚ + & +R_ +, +V¬ŸbË_ID + +v +, cÚ¡ +¡d +:: +veùÜ +< +CG_ouutR•r + *> & +assigÃd_Ú_the_æy +); + +42 + gÇme¥aû + { + +47  +g‘_¡ride +(cÚ¡ +CÚ¡¿št_HªdË + & +h +, +V¬ŸbË_ID + & +wc +, +cÛf_t + & +¡• +){ + +48 + gwc + = 0; + +49  +CÚ¡r_V¬s_I‹r + +i +( +h +, +Œue +); + gi +; i++) { + +50 +as£¹ +( +wc + == 0); + +51 + gwc + = (* +i +). +v¬ +; + +52 + g¡• + = ((* +i +). +cÛf +); + +58 +CG_ouutR•r +* +ouutId’t +( +CG_ouutBužd” +* +ocg +, cÚ¡ +R–©iÚ + & +R_ +, +V¬ŸbË_ID + +v +, cÚ¡ +¡d +:: +veùÜ + & +assigÃd_Ú_the_æy +) { + +59 +R–©iÚ + & +R + = +cÚ¡_ÿ¡ +( +R_ +); + +61  + gv +-> +kšd +()) { + +62  + gS‘_V¬ +: { + +63  +pos + = +v +-> +g‘_pos™iÚ +(); + +64 ià( + gassigÃd_Ú_the_æy +[ +pos +-1] !ð +NULL +) + +65  +assigÃd_Ú_the_æy +[ +pos +-1]-> +þÚe +(); + +67  + gocg +-> +C»©eId’t +( +v +-> +Çme +()); + +70  + gGlob®_V¬ +: { + +71 ià( +v +-> +g‘_glob®_v¬ +()-> +¬™y +() == 0) + +72  +ocg +-> +C»©eId’t +( +v +-> +Çme +()); + +76  + g¬™y + = +v +-> +g‘_glob®_v¬ +()-> +¬™y +(); + +78 + gTu¶e +< + gCG_ouutR•r + *> + g¬gLi¡ +; + +82  + gi + = 1; i <ð +¬™y +; i++) + +83 + g¬gLi¡ +. +­³nd +( +ocg +-> +C»©eId’t +( +R +. +£t_v¬ +( +i +)-> +Çme +())); + +84 +CG_ouutR•r + * + gÿÎ + = +ocg +-> +C»©eInvoke +( +v +-> +g‘_glob®_v¬ +()-> +ba£_Çme +(), +¬gLi¡ +); + +85  + gÿÎ +; + +90 +throw + +¡d +:: +šv®id_¬gum’t +("wrong variableype"); + +101 + g¡d +:: +·œ +< +CG_ouutR•r + *, + gboÞ +> +ouutAssignm’t +( +CG_ouutBužd” + * +ocg +, cÚ¡ +R–©iÚ + & +R_ +, +V¬ŸbË_ID + +v +, R–©iÚ & +’fÜûd +, CG_ouutR•¸*& +if_»´ +, cÚ¡ +¡d +:: +veùÜ + & +assigÃd_Ú_the_æy +) { + +102 +R–©iÚ + & +R + = +cÚ¡_ÿ¡ +( +R_ +); + +104 +CÚjunù + * + gc + = +R +. +qu”y_DNF +()-> +sšgË_cÚjunù +(); + +107  +EQ_I‹¿tÜ + +ei +( +c +); + gei +;ƒi++) + +108 ià(!(* + gei +). +has_wždÿrds +(è&& +abs +((* +ei +). +g‘_cÛf +( +v +)) > 1) { + +109 +R–©iÚ + +r +( +R +. +n_£t +()); + +110 +F_And + * + gf_su³r_roÙ + = +r +. +add_ªd +(); + +111 +F_Exi¡s + * + gã + = +f_su³r_roÙ +-> +add_exi¡s +(); + +112 +V¬ŸbË_ID + + ge + = +ã +-> +deþ¬e +(); + +113 +F_And + * + gf_roÙ + = +ã +-> +add_ªd +(); + +114 +EQ_HªdË + + gh + = +f_roÙ +-> +add_EQ +(); + +115  +CÚ¡r_V¬s_I‹r + +cvi +(* +ei +); + gcvi +; cvi++) + +116 (* + gcvi +). + gv¬ +-> +kšd +()) { + +117  + gIÅut_V¬ +: { + +118 ià((* +cvi +). +v¬ + =ð +v +) + +119 +h +. +upd©e_cÛf +( +e +, (* +cvi +). +cÛf +); + +121 + gh +. +upd©e_cÛf +( +r +. +£t_v¬ +((* +cvi +). +v¬ +-> +g‘_pos™iÚ +()), (*cvi). +cÛf +); + +124  + gGlob®_V¬ +: { + +125 +Glob®_V¬_ID + +g + = (* +cvi +). +v¬ +-> +g‘_glob®_v¬ +(); + +126 +V¬ŸbË_ID + + gv2 +; + +127 ià( + gg +-> +¬™y +() == 0) + +128 +v2 + = +r +. +g‘_loÿl +( +g +); + +130 + gv2 + = +r +. +g‘_loÿl +( +g +, (* +cvi +). +v¬ +-> +funùiÚ_of +()); + +131 + gh +. +upd©e_cÛf +( +v2 +, (* +cvi +). +cÛf +); + +135 +as£¹ +(0); + +137 + gh +. +upd©e_cÚ¡ +((* +ei +). +g‘_cÚ¡ +()); + +139 + gr +. +cÝy_Çmes +( +R +); + +140 + gr +. +£tup_Çmes +(); + +143 ià(! +Gi¡ +( +r +, +cÝy +( +’fÜûd +), 1). +is_obvious_utÞogy +()) { + +144 +cÛf_t + + gcÛf + = (* +ei +). +g‘_cÛf +( +v +); + +145 +cÛf_t + + gsign + = -(( +cÛf +>0)?1:-1); + +146 + gcÛf + = +abs +( +cÛf +); + +148 +CG_ouutR•r + * + g‹rm + = +NULL +; + +149  +CÚ¡r_V¬s_I‹r + +cvi +(* +ei +); + gcvi +; cvi++) + +150 ià((* + gcvi +). + gv¬ + !ð +v +) { + +151 +CG_ouutR•r + * +v¬R•r + = +ouutId’t +( +ocg +, +R +, (* +cvi +). +v¬ +, +assigÃd_Ú_the_æy +); + +152 +cÛf_t + + gt + = +sign +*(* +cvi +). +cÛf +; + +153 ià( + gt + == 1) + +154 +‹rm + = +ocg +-> +C»©ePlus +Ñ”m, +v¬R•r +); + +155 ià( + gt + == -1) + +156 +‹rm + = +ocg +-> +C»©eMšus +Ñ”m, +v¬R•r +); + +157 ià( + gt + > 0) + +158 + g‹rm + = +ocg +-> +C»©ePlus +( +‹rm +, ocg-> +C»©eTimes +(ocg-> +C»©eIÁ +( +t +), +v¬R•r +)); + +159 ià( + gt + < 0) + +160 + g‹rm + = +ocg +-> +C»©eMšus +( +‹rm +, ocg-> +C»©eTimes +(ocg-> +C»©eIÁ +(- +t +), +v¬R•r +)); + +162 +cÛf_t + + gt + = +sign +*(* +ei +). +g‘_cÚ¡ +(); + +163 ià( + gt + > 0) + +164 + g‹rm + = +ocg +-> +C»©ePlus +( +‹rm +, ocg-> +C»©eIÁ +( +t +)); + +165 ià( + gt + < 0) + +166 + g‹rm + = +ocg +-> +C»©eMšus +( +‹rm +, ocg-> +C»©eIÁ +(- +t +)); + +168 + g‹rm + = +ocg +-> +C»©eIÁeg”Mod +( +‹rm +, ocg-> +C»©eIÁ +( +cÛf +)); + +169 + g‹rm + = +ocg +-> +C»©eEQ +( +‹rm +, ocg-> +C»©eIÁ +(0)); + +171 + gif_»´ + = +ocg +-> +C»©eAnd +( +if_»´ +, +‹rm +); + +174 + g’fÜûd +. +ªd_w™h_EQ +(* +ei +); + +175 + g’fÜûd +. +sim¶ify +(); + +179 + g¡d +:: +·œ +< +EQ_HªdË +, > + ga + = +fšd_sim¶e¡_assignm’t +( +R +, +v +, +assigÃd_Ú_the_æy +); + +182 ià( + ga +. + g£cÚd + < + gINT_MAX +) { + +183 +EQ_HªdË + + geq + = +a +. +fœ¡ +; + +184 +CG_ouutR•r + * + grÝ_»´ + = +NULL +; + +186 +cÛf_t + + gdivid” + = +eq +. +g‘_cÛf +( +v +); + +187  + gsign + = 1; + +188 ià( + gdivid” + < 0) { + +189 + gdivid” + = - +divid” +; + +190 + gsign + = -1; + +193  +CÚ¡r_V¬s_I‹r + +cvi +( +eq +); + gcvi +; cvi++) + +194 ià((* + gcvi +). + gv¬ + !ð +v +) { + +195 +CG_ouutR•r + * +v¬_»´ + = +ouutId’t +( +ocg +, +R +, (* +cvi +). +v¬ +, +assigÃd_Ú_the_æy +); + +196 +cÛf_t + + gcÛf + = (* +cvi +). +cÛf +; + +197 ià(- +sign + * + gcÛf + == -1) + +198 +rÝ_»´ + = +ocg +-> +C»©eMšus +ÔÝ_»´, +v¬_»´ +); + +199 ià(- +sign + * + gcÛf + < -1) + +200 + grÝ_»´ + = +ocg +-> +C»©eMšus +( +rÝ_»´ +, ocg-> +C»©eTimes +(ocg-> +C»©eIÁ +( +sign + * +cÛf +), +v¬_»´ +)); + +201 ià(- +sign + * + gcÛf + == 1) + +202 +rÝ_»´ + = +ocg +-> +C»©ePlus +ÔÝ_»´, +v¬_»´ +); + +204 + grÝ_»´ + = +ocg +-> +C»©ePlus +( +rÝ_»´ +, ocg-> +C»©eTimes +(ocg-> +C»©eIÁ +(- +sign + * +cÛf +), +v¬_»´ +)); + +207 +cÛf_t + + gc_‹rm + = -( +eq +. +g‘_cÚ¡ +(è* +sign +); + +209 ià( + gc_‹rm + > 0) + +210 + grÝ_»´ + = +ocg +-> +C»©ePlus +( +rÝ_»´ +, ocg-> +C»©eIÁ +( +c_‹rm +)); + +211 ià( + gc_‹rm + < 0) + +212 + grÝ_»´ + = +ocg +-> +C»©eMšus +( +rÝ_»´ +, ocg-> +C»©eIÁ +(- +c_‹rm +)); + +213 ià( + grÝ_»´ + =ð +NULL +) + +214 +rÝ_»´ + = +ocg +-> +C»©eIÁ +(0); + +216 ià( + gdivid” + != 1) + +217 +rÝ_»´ + = +ocg +-> +C»©eIÁeg”Divide +ÔÝ_»´, ocg-> +C»©eIÁ +( +divid” +)); + +219 + g’fÜûd +. +ªd_w™h_EQ +( +eq +); + +220 + g’fÜûd +. +sim¶ify +(); + +222 ià( + ga +. + g£cÚd + > + gv¬_sub¡™utiÚ_th»shÞd +) + +223  + g¡d +:: +make_·œ +( +rÝ_»´ +, +Œue +); + +225  + g¡d +:: +make_·œ +( +rÝ_»´ +, +çl£ +); + +228  + g¡d +:: +make_·œ +( +¡©ic_ÿ¡ +< +CG_ouutR•r + *>( +NULL +), +çl£ +); + +237 + gTu¶e +< + gCG_ouutR•r +*> +ouutSub¡™utiÚ +( +CG_ouutBužd” +* +ocg +, cÚ¡ +R–©iÚ + & +R_ +, cÚ¡ +¡d +:: +veùÜ +< +CG_ouutR•r + *> & +assigÃd_Ú_the_æy +) { + +238 +R–©iÚ + & +R + = +cÚ¡_ÿ¡ +( +R_ +); + +240 cÚ¡  + gn + = +R +. +n_out +(); + +241 + gTu¶e +< + gCG_ouutR•r +*> + goR•rLi¡ +; + +244  + gi + = 1; i <ð +n +; i++) { + +245 +R–©iÚ + +m­pšg +( +n +, 1); + +246 +F_And + * + gf_roÙ + = +m­pšg +. +add_ªd +(); + +247 +EQ_HªdË + + gh + = +f_roÙ +-> +add_EQ +(); + +248 + gh +. +upd©e_cÛf +( +m­pšg +. +ouut_v¬ +(1), 1); + +249 + gh +. +upd©e_cÛf +( +m­pšg +. +šput_v¬ +( +i +), -1); + +251 +R–©iÚ + + gS + = +Compos™iÚ +( +m­pšg +, +cÝy +( +R +)); + +253 + g¡d +:: +·œ +< +EQ_HªdË +, > + ga + = +fšd_sim¶e¡_assignm’t +( +S +, S. +ouut_v¬ +(1), +assigÃd_Ú_the_æy +); + +255 ià( + ga +. + g£cÚd + < + gINT_MAX +) { + +256  + ga +. + g£cÚd + > 0) { + +257 +EQ_HªdË + + geq + = +a +. +fœ¡ +; + +258 + g¡d +:: +£t +<> +ÿndid©es +; + +259  +CÚ¡r_V¬s_I‹r + +cvi +( +eq +); + gcvi +; cvi++) + +260 ià((* + gcvi +). + gv¬ +-> +kšd +(è=ð +IÅut_V¬ +) + +261 +ÿndid©es +. +š£¹ +((* +cvi +). +v¬ +-> +g‘_pos™iÚ +()); + +263 +boÞ + + gchªged + = +çl£ +; + +264  + g¡d +:: +£t +<>:: +™”©Ü + +j + = +ÿndid©es +. +begš +(); + gj + !ðÿndid©es. +’d +(); j++) { + +265 +R–©iÚ + + gS2 + = +Projeù +( +cÝy +( +S +), * +j +, +IÅut_V¬ +); + +266 + g¡d +:: +·œ +< +EQ_HªdË +, > + ga2 + = +fšd_sim¶e¡_assignm’t +( +S2 +, S2. +ouut_v¬ +(1), +assigÃd_Ú_the_æy +); + +267 ià( + ga2 +. + g£cÚd + <ð +a +. +£cÚd +) { + +268 +S + = +S2 +; + +269 + ga + = +a2 +; + +270 + gchªged + = +Œue +; + +274 ià(! + gchªged +) + +279 ià( + ga +. + g£cÚd + < + gINT_MAX +) { + +280 +CG_ouutR•r + * + g»´ + = +NULL +; + +281 +EQ_HªdË + + geq + = +a +. +fœ¡ +; + +282 +V¬ŸbË_ID + + gv + = +S +. +ouut_v¬ +(1); + +284  + gj + = 1; j <ð +S +. +n_šp +(); j++) + +285 + gS +. +Çme_šput_v¬ +( +j +, +R +. +šput_v¬ +(j)-> +Çme +()); + +286 + gS +. +£tup_Çmes +(); + +288  + gd + = +eq +. +g‘_cÛf +( +v +); + +289 +as£¹ +( +d + != 0); + +290  + gsign + = ( +d +>0)?-1:1; + +291 + gd + = - +sign + * +d +; + +292  +CÚ¡r_V¬s_I‹r + +cvi +( +eq +); + gcvi +; cvi++) + +293 ià((* + gcvi +). + gv¬ + !ð +v +) { + +294  +cÛf + = +sign + * (* +cvi +).coef; + +295 +CG_ouutR•r + * + gÝ + = +ouutId’t +( +ocg +, +S +, (* +cvi +). +v¬ +, +assigÃd_Ú_the_æy +); + +296 ià( + gcÛf + > 1) + +297 + gÝ + = +ocg +-> +C»©eTimes +(ocg-> +C»©eIÁ +( +cÛf +), +Ý +); + +298 ià( + gcÛf + < -1) + +299 + gÝ + = +ocg +-> +C»©eTimes +(ocg-> +C»©eIÁ +(- +cÛf +), +Ý +); + +300 ià( + gcÛf + > 0) + +301 + g»´ + = +ocg +-> +C»©ePlus +( +»´ +, +Ý +); + +302 ià( + gcÛf + < 0) + +303 + g»´ + = +ocg +-> +C»©eMšus +( +»´ +, +Ý +); + +306  + gc + = +sign + * +eq +. +g‘_cÚ¡ +(); + +307 ià( + gc + > 0) + +308 + g»´ + = +ocg +-> +C»©ePlus +( +»´ +, ocg-> +C»©eIÁ +( +c +)); + +309 ià( + gc + < 0) + +310 + g»´ + = +ocg +-> +C»©eMšus +( +»´ +, ocg-> +C»©eIÁ +(- +c +)); + +311 ià( + g»´ + =ð +NULL +) + +312 +»´ + = +ocg +-> +C»©eIÁ +(0); + +314 ià( + gd + != 1) + +315 +»´ + = +ocg +-> +C»©eIÁeg”Divide +Ô•r, ocg-> +C»©eIÁ +( +d +)); + +317 + goR•rLi¡ +. +­³nd +( +»´ +); + +320 + goR•rLi¡ +. +­³nd +( +NULL +); + +323  + goR•rLi¡ +; + +326 + gÇme¥aû + { + +328 +R–©iÚ + +ü—‹_¡ride_Ú_bound +( +n +, cÚ¡ +¡d +:: +m­ +< +V¬ŸbË_ID +, +cÛf_t +> & +lb +, cÛf_ˆ +¡ride +) { + +329 +R–©iÚ + +»suÉ +( +n +); + +330 +F_And + * + gf_roÙ + = +»suÉ +. +add_ªd +(); + +331 +EQ_HªdË + + gh + = +f_roÙ +-> +add_¡ride +( +¡ride +); + +333  + g¡d +:: +m­ +< +V¬ŸbË_ID +, + gcÛf_t +>:: +cÚ¡_™”©Ü + +i + = +lb +. +begš +(); + gi + !ðlb. +’d +(); i++) { + +334 ià( + gi +-> + gfœ¡ + =ð +NULL +) + +335 +h +. +upd©e_cÚ¡ +( +i +-> +£cÚd +); + +337  + gi +-> + gfœ¡ +-> +kšd +()) { + +338  + gIÅut_V¬ +: { + +339  +pos + = +i +-> +fœ¡ +-> +g‘_pos™iÚ +(); + +340 + gh +. +upd©e_cÛf +( +»suÉ +. +£t_v¬ +( +pos +), +i +-> +£cÚd +); + +343  + gGlob®_V¬ +: { + +344 +Glob®_V¬_ID + +g + = +i +-> +fœ¡ +-> +g‘_glob®_v¬ +(); + +345 +V¬ŸbË_ID + + gv +; + +346 ià( + gg +-> +¬™y +() == 0) + +347 +v + = +»suÉ +. +g‘_loÿl +( +g +); + +349 + gv + = +»suÉ +. +g‘_loÿl +( +g +, +i +-> +fœ¡ +-> +funùiÚ_of +()); + +350 + gh +. +upd©e_cÛf +( +v +, +i +-> +£cÚd +); + +354 +as£¹ +(0); + +359  + g»suÉ +; + +368 +R–©iÚ + +g»©e¡_commÚ_¡• +(cÚ¡ +Tu¶e + & +I +, cÚ¡ Tu¶e<> & +aùive +,  +Ëv– +, cÚ¡ R–©iÚ & +known +) { + +369 +as£¹ +( +I +. +size +(è=ð +aùive +.size()); + +370  + gn + = 0; + +372 + g¡d +:: +veùÜ +< +R–©iÚ +> +I1 +, + gI2 +; + +373  + gi + = 1; i <ð +I +. +size +(); i++) + +374 ià( + gaùive +[ +i +]) { + +375 ià( + gn + == 0) + +376 +n + = +I +[ +i +]. +n_£t +(); + +378 +R–©iÚ + + gr1 +; + +379 ià( + gknown +. +is_nuÎ +()) + +380 + gr1 + = +cÝy +( +I +[ +i +]); + +382 + gr1 + = +IÁ”£ùiÚ +( +cÝy +( +I +[ +i +]), cÝy( +known +)); + +383 + gr1 +. +sim¶ify +(); + +385 + gI1 +. +push_back +( +r1 +); + +386 +R–©iÚ + + gr2 + = +Gi¡ +( +cÝy +( +I +[ +i +]), cÝy( +known +)); + +387 +as£¹ +( +r2 +. +is_uµ”_bound_§tisfŸbË +()); + +388 ià( + gr2 +. +is_obvious_utÞogy +()) + +389  + gR–©iÚ +:: +True +( +n +); + +390 + gI2 +. +push_back +( +r2 +); + +393 + g¡d +:: +veùÜ +< +boÞ +> +is_exaù +( +I2 +. +size +(), +Œue +); + +394 + g¡d +:: +veùÜ +< +cÛf_t +> +¡• +( +I2 +. +size +(), 0); + +395 + g¡d +:: +veùÜ +< +cÛf_t +> +messy_¡• +( +I2 +. +size +(), 0); + +396 +V¬ŸbË_ID + + gt_cÞ + = +£t_v¬ +( +Ëv– +); + +397 + g¡d +:: +m­ +< +V¬ŸbË_ID +, + gcÛf_t +> + glb +; + +400  +size_t + + gi + = 0; i < + gI2 +. +size +(); i++) { + +401 +CÚjunù + * + gc + = +I2 +[ +i +]. +qu”y_DNF +()-> +sšgË_cÚjunù +(); + +403 +boÞ + + gis_deg’”©ed + = +çl£ +; + +404  +EQ_I‹¿tÜ + + ge + = +c +-> +EQs +();ƒ;ƒ++) { + +405 +cÛf_t + + gcÛf + = +abs +((* +e +). +g‘_cÛf +( +t_cÞ +)); + +406 ià( + gcÛf + !ð0 && !(* +e +). +has_wždÿrds +()) { + +407 +is_deg’”©ed + = +Œue +; + +411 ià( + gis_deg’”©ed +) + +414  +EQ_I‹¿tÜ + + ge + = +c +-> +EQs +();ƒ;ƒ++) { + +415 ià((* + ge +). +has_wždÿrds +()) { + +416 +cÛf_t + + gcÛf + = +abs +((* +e +). +g‘_cÛf +( +t_cÞ +)); + +417 ià( + gcÛf + == 0) + +419 ià( + gcÛf + != 1) { + +420 +is_exaù +[ +i +] = +çl£ +; + +424 +cÛf_t + + gthis_¡• + = +abs +( +CÚ¡r_V¬s_I‹r +(* +e +, +Œue +). +cu¼_cÛf +()); + +425 +as£¹ +( +this_¡• + != 1); + +427 ià( + glb +. +size +() != 0) { + +428 +R–©iÚ + +‹¡ + = +ü—‹_¡ride_Ú_bound +( +n +, +lb +, +this_¡• +); + +429 ià( +Gi¡ +( +‹¡ +, +cÝy +( +I1 +[ +i +])). +is_obvious_utÞogy +()) { + +430 ià( + g¡• +[ +i +] == 0) + +431 +¡• +[ +i +] = +this_¡• +; + +433 + g¡• +[ +i +] = +lcm +( +¡• +[i], +this_¡• +); + +436 + gis_exaù +[ +i +] = +çl£ +; + +440 +CÚjunù + * + gc + = +I2 +[ +i +]. +qu”y_DNF +()-> +sšgË_cÚjunù +(); + +441  +GEQ_I‹¿tÜ + + gge + = +c +-> +GEQs +(); ge; ge++) { + +442 ià((* + gge +). +has_wždÿrds +(è|| (*ge). +g‘_cÛf +( +t_cÞ +) != 1) + +445 + g¡d +:: +m­ +< +V¬ŸbË_ID +, + gcÛf_t +> + gcur_lb +; + +446  +CÚ¡r_V¬s_I‹r + +cv +(* +ge +); + gcv +; cv++) + +447 + gcur_lb +[ +cv +. +cu¼_v¬ +()] = cv. +cu¼_cÛf +(); + +448 + gcur_lb +[ +NULL +] = (* +ge +). +g‘_cÚ¡ +(); + +450 +R–©iÚ + + g‹¡ + = +ü—‹_¡ride_Ú_bound +( +n +, +cur_lb +, +this_¡• +); + +451 ià( +Gi¡ +( +‹¡ +, +cÝy +( +I1 +[ +i +])). +is_obvious_utÞogy +()) { + +452 ià( + g¡• +[ +i +] == 0) + +453 +¡• +[ +i +] = +this_¡• +; + +455 + g¡• +[ +i +] = +lcm +( +¡• +[i], +this_¡• +); + +457 + glb + = +cur_lb +; + +463 ià( + glb +. +size +() == 0) { + +464 +¡d +:: +m­ +< +V¬ŸbË_ID +, +cÛf_t +> +cur_lb +; + +465  + gwžd_couÁ + = 0; + +466  +CÚ¡r_V¬s_I‹r + +cv +(* +e +); + gcv +; cv++) + +467 ià( + gcv +. +cu¼_v¬ +()-> +kšd +(è=ð +Wždÿrd_V¬ +) + +468 +wžd_couÁ +++; + +470 + gcur_lb +[ +cv +. +cu¼_v¬ +()] = cv. +cu¼_cÛf +(); + +471 + gcur_lb +[ +NULL +] = (* +e +). +g‘_cÚ¡ +(); + +473 ià( + gwžd_couÁ + == 1) { + +474 +lb + = +cur_lb +; + +475 ià( + g¡• +[ +i +] == 0) + +476 +¡• +[ +i +] = +this_¡• +; + +478 + g¡• +[ +i +] = +lcm +( +¡• +[i], +this_¡• +); + +482 ià( + glb +. +size +() == 0) + +483 +is_exaù +[ +i +] = +çl£ +; + +490 +cÛf_t + + gglob®_¡• + = 0; + +491  +size_t + + gi + = 0; i < + gis_exaù +. +size +(); i++) + +492 ià( + gis_exaù +[ +i +]) + +493 + gglob®_¡• + = +gcd +( +glob®_¡• +, +¡• +[ +i +]); + +494 ià( + gglob®_¡• + == 1) + +495  +R–©iÚ +:: +True +( +n +); + +498  +size_t + + gi + = 0; i < + gI2 +. +size +(); i++) + +499 ià(! + gis_exaù +[ +i +]) { + +500 +CÚjunù + * + gc + = +I2 +[ +i +]. +qu”y_DNF +()-> +sšgË_cÚjunù +(); + +501  +EQ_I‹¿tÜ + + ge + = +c +-> +EQs +();ƒ;ƒ++) { + +502 +cÛf_t + + gcÛf + = +abs +((* +e +). +g‘_cÛf +( +t_cÞ +)); + +503 ià( + gcÛf + =ð0 || +cÛf + == 1) + +507 +cÛf_t + + gthis_¡• + = +abs +( +CÚ¡r_V¬s_I‹r +(* +e +, +Œue +). +cu¼_cÛf +()); + +508 + gthis_¡• + /ð +gcd +( +this_¡• +, +cÛf +); + +509 + gthis_¡• + = +gcd +( +glob®_¡• +, +this_¡• +); + +510 ià( + gthis_¡• + == 1) + +513 ià( + glb +. +size +() != 0) { + +514 +R–©iÚ + +‹¡ + = +ü—‹_¡ride_Ú_bound +( +n +, +lb +, +this_¡• +); + +515 ià( +Gi¡ +( +‹¡ +, +cÝy +( +I1 +[ +i +])). +is_obvious_utÞogy +()) { + +516 ià( + g¡• +[ +i +] == 0) + +517 +¡• +[ +i +] = +this_¡• +; + +519 + g¡• +[ +i +] = +lcm +( +¡• +[i], +this_¡• +); + +524 +CÚjunù + * + gc + = +I2 +[ +i +]. +qu”y_DNF +()-> +sšgË_cÚjunù +(); + +525  +GEQ_I‹¿tÜ + + gge + = +c +-> +GEQs +(); ge; ge++) { + +526 ià((* + gge +). +has_wždÿrds +(è|| (*ge). +g‘_cÛf +( +t_cÞ +) != 1) + +529 + g¡d +:: +m­ +< +V¬ŸbË_ID +, + gcÛf_t +> + gcur_lb +; + +531  +CÚ¡r_V¬s_I‹r + +cv +(* +ge +); + gcv +; cv++) + +532 + gcur_lb +[ +cv +. +cu¼_v¬ +()] = cv. +cu¼_cÛf +(); + +534 + gcur_lb +[ +NULL +] = (* +ge +). +g‘_cÚ¡ +(); + +536 +R–©iÚ + + g‹¡ + = +ü—‹_¡ride_Ú_bound +( +n +, +cur_lb +, +this_¡• +); + +537 ià( +Gi¡ +( +‹¡ +, +cÝy +( +I1 +[ +i +])). +is_obvious_utÞogy +()) { + +538 ià( + g¡• +[ +i +] == 0) + +539 +¡• +[ +i +] = +this_¡• +; + +541 + g¡• +[ +i +] = +lcm +( +¡• +[i], +this_¡• +); + +543 + glb + = +cur_lb +; + +552  +size_t + + gi + = 0; i < + gis_exaù +. +size +(); i++) + +553 ià(! + gis_exaù +[ +i +]) + +554 + gglob®_¡• + = +gcd +( +glob®_¡• +, +¡• +[ +i +]); + +555 ià( + gglob®_¡• + =ð1 || +glob®_¡• + == 0) + +556  +R–©iÚ +:: +True +( +n +); + +558 +R–©iÚ + + g»suÉ + = +ü—‹_¡ride_Ú_bound +( +n +, +lb +, +glob®_¡• +); + +561  +size_t + + gi + = 0; i < + gI1 +. +size +(); i++) + +562 ià( + g¡• +[ +i +] == 0) { + +563 ià(! +Gi¡ +( +cÝy +( +»suÉ +), cÝy( +I1 +[ +i +])). +is_obvious_utÞogy +()) + +564  +R–©iÚ +:: +True +( +n +); + +567  + g»suÉ +; + +574 +CG_ouutR•r +* +ouutS‹m’t +( +CG_ouutBužd” + * +ocg +, CG_ouutR•¸* +¡mt +,  +šd’t +, cÚ¡ +R–©iÚ + & +m­pšg_ +, cÚ¡ R–©iÚ & +known_ +, cÚ¡ +¡d +:: +veùÜ + & +assigÃd_Ú_the_æy +) { + +575 +R–©iÚ + +m­pšg + = +cÝy +( +m­pšg_ +); + +576 +R–©iÚ + + gknown + = +cÝy +( +known_ +); + +577 + gTu¶e +< + g¡d +:: +¡ršg +> +loÝ_v¬s +; + +579  + gi + = 1; i <ð +m­pšg +. +n_šp +(); i++) + +580 + gloÝ_v¬s +. +­³nd +( +m­pšg +. +šput_v¬ +( +i +)-> +Çme +()); + +583 ià( + gknown +. +n_£t +(è> + gm­pšg +. +n_out +()) { + +584 +R–©iÚ + +r +( +known +. +n_£t +(), +m­pšg +. +n_out +()); + +585 +F_And + * + gf_roÙ + = +r +. +add_ªd +(); + +586  + gi + = 1; i <ð +m­pšg +. +n_out +(); i++) { + +587 +EQ_HªdË + + gh + = +f_roÙ +-> +add_EQ +(); + +588 + gh +. +upd©e_cÛf +( +r +. +šput_v¬ +( +i +), 1); + +589 + gh +. +upd©e_cÛf +( +r +. +ouut_v¬ +( +i +), -1); + +591 + gknown + = +Rªge +( +Re¡riù_Domaš +( +r +, +known +)); + +592 + gknown +. +sim¶ify +(); + +596 +R–©iÚ + +k +( +known +. +n_£t +()); + +597 +F_And + * + gf_roÙ + = +k +. +add_ªd +(); + +598 +CÚjunù + * + gc + = +known +. +qu”y_DNF +()-> +sšgË_cÚjunù +(); + +599  +EQ_I‹¿tÜ + + ge + = +c +-> +EQs +();ƒ;ƒ++) { + +600 ià(!(* + ge +). +has_wždÿrds +()) + +601 + gf_roÙ +-> +add_EQ +(* +e +); + +603 + gk +. +sim¶ify +(); + +606 +R–©iÚ + + gInv_m­pšg + = +Re¡riù_Domaš +( +Inv”£ +( +m­pšg +), +k +); + +607 + gTu¶e +< + gCG_ouutR•r +*> + gsLi¡ + = +ouutSub¡™utiÚ +( +ocg +, +Inv_m­pšg +, +assigÃd_Ú_the_æy +); + +609  + gocg +-> +C»©ePÏûHÞd” +( +šd’t +, +¡mt +, +sLi¡ +, +loÝ_v¬s +); + +614 +boÞ + +fšdFloÜIÃqu®™y +( +R–©iÚ + & +r +, +V¬ŸbË_ID + +v +, +GEQ_HªdË + & +h +, V¬ŸbË_ID +exþuded +) { + +615 +CÚjunù + * + gc + = +r +. +sšgË_cÚjunù +(); + +617 + g¡d +:: +£t +< +V¬ŸbË_ID +> +v¬_checked +; + +618 + g¡d +:: +¡ack +< +V¬ŸbË_ID +> +v¬_checkšg +; + +619 + gv¬_checkšg +. +push +( +v +); + +621 ! + gv¬_checkšg +. +em±y +()) { + +622 +V¬ŸbË_ID + + gv2 + = +v¬_checkšg +. +tÝ +(); + +623 + gv¬_checkšg +. +pÝ +(); + +625 +boÞ + + gis_æoÜ + = +çl£ +; + +626  +GEQ_I‹¿tÜ + +gi +( +c +); + ggi +; gi++) { + +627 ià( + gexþuded + !ð +NULL + && (* +gi +). +g‘_cÛf +( +exþuded +) != 0) + +630 +cÛf_t + + ga + = (* +gi +). +g‘_cÛf +( +v2 +); + +631 ià( + ga + < 0) { + +632  +GEQ_I‹¿tÜ + +gi2 +( +c +); + ggi2 +; gi2++) { + +633 +cÛf_t + + gb + = (* +gi2 +). +g‘_cÛf +( +v2 +); + +634 ià( + gb + =ð- +a + && (* +gi +). +g‘_cÚ¡ +()+(* +gi2 +).get_const() < -a) { + +635 +boÞ + +m©ch + = +Œue +; + +636  +CÚ¡r_V¬s_I‹r + +cvi +(* +gi +); + gcvi +; cvi++) + +637 ià((* + ggi2 +). +g‘_cÛf +((* +cvi +). +v¬ +è!ð-(*cvi). +cÛf +) { + +638 +m©ch + = +çl£ +; + +641 ià(! + gm©ch +) + +643  +CÚ¡r_V¬s_I‹r + +cvi +(* +gi2 +); + gcvi +; cvi++) + +644 ià((* + ggi +). +g‘_cÛf +((* +cvi +). +v¬ +è!ð-(*cvi). +cÛf +) { + +645 +m©ch + = +çl£ +; + +648 ià( + gm©ch +) { + +649 + gv¬_checked +. +š£¹ +( +v2 +); + +650 + gis_æoÜ + = +Œue +; + +651 ià( + gv + =ð +v2 +) + +652 +h + = * +gi +; + +654  +CÚ¡r_V¬s_I‹r + +cvi +(* +gi +); + gcvi +; cvi++) + +655 ià(((* + gcvi +). + gv¬ +-> +kšd +(è=ð +Exi¡s_V¬ + || (* +cvi +). +v¬ +->kšd(è=ð +Wždÿrd_V¬ +) && + +656 +v¬_checked +. +fšd +((* +cvi +). +v¬ +è=ðv¬_checked. +’d +()) + +657 +v¬_checkšg +. +push +((* +cvi +). +v¬ +); + +663 ià( + gis_æoÜ +) + +667 ià(! + gis_æoÜ +) + +668  + gçl£ +; + +670  + gŒue +; + +680 +CG_ouutR•r +* +ouut_as_gu¬d +( +CG_ouutBužd” +* +ocg +, cÚ¡ +R–©iÚ + & +gu¬ds_š +, +CÚ¡¿št_HªdË + +e +, +boÞ + +is_equ®™y +, cÚ¡ +¡d +:: +veùÜ + & +assigÃd_Ú_the_æy +) { + +681 +R–©iÚ + & +gu¬ds + = +cÚ¡_ÿ¡ +( +gu¬ds_š +); + +682 ià( + ge +. +has_wždÿrds +()) + +683 +throw + + g¡d +:: +šv®id_¬gum’t +("constraint must‚ot have wildcard"); + +685 +V¬ŸbË_ID + + gv + = (* +CÚ¡r_V¬s_I‹r +( +e +)). +v¬ +; + +687 +cÛf_t + + g§ved_cÛf + = (( +e +). +g‘_cÛf +( +v +)); + +688  + gsign + = +§ved_cÛf + < 0 ? -1 : 1; + +690 ( + ge +). +upd©e_cÛf_duršg_sim¶ify +( +v +, - +§ved_cÛf ++ +sign +); + +691 +CG_ouutR•r +* + grÝ + = +ouutEasyBoundAsR•r +( +ocg +, +gu¬ds +, +e +, +v +, +çl£ +, 0, +assigÃd_Ú_the_æy +); + +692 ( + ge +). +upd©e_cÛf_duršg_sim¶ify +( +v +, +§ved_cÛf +- +sign +); + +694 +CG_ouutR•r +* + glÝ + = +ouutId’t +( +ocg +, +gu¬ds +, +v +, +assigÃd_Ú_the_æy +); + +695 ià( +abs +( +§ved_cÛf +) != 1) + +696 +lÝ + = +ocg +-> +C»©eTimes +(ocg-> +C»©eIÁ +( +abs +( +§ved_cÛf +)),†op); + +699 ià( + gis_equ®™y +) { + +700  + gocg +-> +C»©eEQ +( +lÝ +, +rÝ +); + +703 ià( + g§ved_cÛf + < 0) + +704  + gocg +-> +C»©eLE +( +lÝ +, +rÝ +); + +706  + gocg +-> +C»©eGE +( +lÝ +, +rÝ +); + +715 +CG_ouutR•r + * +ouut_EQ_¡rides +( +CG_ouutBužd” +* +ocg +, cÚ¡ +R–©iÚ + & +gu¬ds_š +, cÚ¡ +¡d +:: +veùÜ + & +assigÃd_Ú_the_æy +) { + +716 +R–©iÚ + +gu¬ds + = +cÚ¡_ÿ¡ +( +gu¬ds_š +); + +717 +CÚjunù + * + gc + = +gu¬ds +. +sšgË_cÚjunù +(); + +719 +CG_ouutR•r + * + geqR•r + = +NULL +; + +721  +EQ_I‹¿tÜ + +ei +( +c +-> +EQs +()); + gei +;ƒi++) { + +722 +V¬ŸbË_ID + + gwc + = +NULL +; + +723  +CÚ¡r_V¬s_I‹r + +cvi +((* +ei +), +Œue +); + gcvi +; cvi++) { + +724 ià( + gwc + !ð +NULL +) + +725 +throw + +codeg’_”rÜ +("Can't generateƒquality condition with multiple wildcards"); + +727 + gwc + = (* +cvi +). +v¬ +; + +729 ià( + gwc + =ð +NULL +) + +732 +cÛf_t + + g¡• + = (* +ei +). +g‘_cÛf +( +wc +); + +734 (* + gei +). +upd©e_cÛf_duršg_sim¶ify +( +wc +, 1- +¡• +); + +735 +CG_ouutR•r +* + glÝ + = +ouutEasyBoundAsR•r +( +ocg +, +gu¬ds +, (* +ei +), +wc +, +çl£ +, 0, +assigÃd_Ú_the_æy +); + +736 (* + gei +). +upd©e_cÛf_duršg_sim¶ify +( +wc +, +¡• +-1); + +738 +CG_ouutR•r +* + grÝ + = +ocg +-> +C»©eIÁ +( +abs +( +¡• +)); + +739 +CG_ouutR•r +* + gštMod + = +ocg +-> +C»©eIÁeg”Mod +( +lÝ +, +rÝ +); + +740 +CG_ouutR•r +* + geqNode + = +ocg +-> +C»©eEQ +( +štMod +, ocg-> +C»©eIÁ +(0)); + +742 + geqR•r + = +ocg +-> +C»©eAnd +( +eqR•r +, +eqNode +); + +745  + geqR•r +; + +759 +CG_ouutR•r + * +ouut_GEQ_¡rides +( +CG_ouutBužd” +* +ocg +, cÚ¡ +R–©iÚ + & +gu¬ds_š +, cÚ¡ +¡d +:: +veùÜ + & +assigÃd_Ú_the_æy +) { + +760 +R–©iÚ + +gu¬ds + = +cÚ¡_ÿ¡ +( +gu¬ds_š +); + +761 +CÚjunù + * + gc + = +gu¬ds +. +sšgË_cÚjunù +(); + +763 +CG_ouutR•r +* + ggeqR•r + = +NULL +; + +765 + g¡d +:: +£t +< +V¬ŸbË_ID +> +nÚ_Üphª_wždÿrd +; + +766  +GEQ_I‹¿tÜ + +gi +( +c +); + ggi +; gi++) { + +767  + gnum_wžd + = 0; + +768 +V¬ŸbË_ID + + gfœ¡_Úe +; + +769  +CÚ¡r_V¬s_I‹r + +cvi +(* +gi +, +Œue +); + gcvi +; cvi++) { + +770 + gnum_wžd +++; + +771 ià( + gnum_wžd + == 1) + +772 +fœ¡_Úe + = (* +cvi +). +v¬ +; + +774 + gnÚ_Üphª_wždÿrd +. +š£¹ +((* +cvi +). +v¬ +); + +776 ià( + gnum_wžd + > 1) + +777 + gnÚ_Üphª_wždÿrd +. +š£¹ +( +fœ¡_Úe +); + +780  + gi + = 1; i <ð(*( +c +-> +v¬ŸbËs +())). +size +(); i++) { + +781 +V¬ŸbË_ID + + gwc + = (*( +c +-> +v¬ŸbËs +()))[ +i +]; + +782 ià( + gwc +-> +kšd +(è=ð +Wždÿrd_V¬ + && +nÚ_Üphª_wždÿrd +. +fšd +( +wc +è=ðnÚ_Üphª_wždÿrd. +’d +()) { + +783 +Tu¶e +< +GEQ_HªdË +> +low” +, +uµ” +; + +784  +GEQ_I‹¿tÜ + +gi +( +c +); + ggi +; gi++) { + +785 if((* + ggi +). +g‘_cÛf +( +wc +) > 0) + +786 + glow” +. +­³nd +(* +gi +); + +787 if((* + ggi +). +g‘_cÛf +( +wc +) < 0) + +788 + guµ” +. +­³nd +(* +gi +); + +793  + gTu¶e_I‹¿tÜ +< + gGEQ_HªdË +> +low +( +low” +); + glow +;†ow++) { + +794  + gTu¶e_I‹¿tÜ +< + gGEQ_HªdË +> +up +( +uµ” +); + gup +; up++) { + +795 +cÛf_t + + glow_cÛf + = (* +low +). +g‘_cÛf +( +wc +); + +796 +cÛf_t + + gup_cÛf + = (* +up +). +g‘_cÛf +( +wc +); + +798 (* + glow +). +upd©e_cÛf_duršg_sim¶ify +( +wc +, 1- +low_cÛf +); + +799 +CG_ouutR•r +* + glowEx´ + = +ouutEasyBoundAsR•r +( +ocg +, +gu¬ds +, * +low +, +wc +, +çl£ +, 0, +assigÃd_Ú_the_æy +); + +800 (* + glow +). +upd©e_cÛf_duršg_sim¶ify +( +wc +, +low_cÛf +-1); + +802 (* + gup +). +upd©e_cÛf_duršg_sim¶ify +( +wc +, -1- +up_cÛf +); + +803 +CG_ouutR•r +* + gupEx´ + = +ouutEasyBoundAsR•r +( +ocg +, +gu¬ds +, * +up +, +wc +, +çl£ +, 0, +assigÃd_Ú_the_æy +); + +804 (* + gup +). +upd©e_cÛf_duršg_sim¶ify +( +wc +, +up_cÛf ++1); + +806 +CG_ouutR•r +* + gštDiv + = +ocg +-> +C»©eIÁeg”Divide +( +upEx´ +, ocg-> +C»©eIÁ +(- +up_cÛf +)); + +807 +CG_ouutR•r +* + grÝ + = +ocg +-> +C»©eTimes +(ocg-> +C»©eIÁ +( +low_cÛf +), +štDiv +); + +808 +CG_ouutR•r +* + ggeqNode + = +ocg +-> +C»©eLE +( +lowEx´ +, +rÝ +); + +810 + ggeqR•r + = +ocg +-> +C»©eAnd +( +geqR•r +, +geqNode +); + +816 ià( + gnÚ_Üphª_wždÿrd +. +size +() > 0) { + +826 +throw + +codeg’_”rÜ +("Can't generate multiple wildcard GEQ guards„ight‚ow"); + +829  + ggeqR•r +; + +836 +CG_ouutR•r + * +ouutGu¬d +( +CG_ouutBužd” +* +ocg +, cÚ¡ +R–©iÚ + & +gu¬ds_š +, cÚ¡ +¡d +:: +veùÜ + & +assigÃd_Ú_the_æy +) { + +837 +R–©iÚ + & +gu¬ds + = +cÚ¡_ÿ¡ +( +gu¬ds_š +); + +838 ià( + ggu¬ds +. +is_nuÎ +(è|| gu¬ds. +is_obvious_utÞogy +()) + +839  + gNULL +; + +841 +CG_ouutR•r +* + gnodeR•r + = +NULL +; + +843 +CG_ouutR•r + * + geqSŒideR•r + = +ouut_EQ_¡rides +( +ocg +, +gu¬ds +, +assigÃd_Ú_the_æy +); + +844 + gnodeR•r + = +ocg +-> +C»©eAnd +( +nodeR•r +, +eqSŒideR•r +); + +846 +CG_ouutR•r + * + ggeqSŒideR•r + = +ouut_GEQ_¡rides +( +ocg +, +gu¬ds +, +assigÃd_Ú_the_æy +); + +847 + gnodeR•r + = +ocg +-> +C»©eAnd +( +nodeR•r +, +geqSŒideR•r +); + +849 +CÚjunù + * + gc + = +gu¬ds +. +sšgË_cÚjunù +(); + +850  +EQ_I‹¿tÜ + +ei +( +c +-> +EQs +()); + gei +;ƒi++) + +851 ià(!(* + gei +). +has_wždÿrds +()) { + +852 +CG_ouutR•r + * + geqR•r + = +ouut_as_gu¬d +( +ocg +, +gu¬ds +, (* +ei +), +Œue +, +assigÃd_Ú_the_æy +); + +853 + gnodeR•r + = +ocg +-> +C»©eAnd +( +nodeR•r +, +eqR•r +); + +855  +GEQ_I‹¿tÜ + +gi +( +c +-> +GEQs +()); + ggi +; gi++) + +856 ià(!(* + ggi +). +has_wždÿrds +()) { + +857 +CG_ouutR•r + * + ggeqR•r + = +ouut_as_gu¬d +( +ocg +, +gu¬ds +, (* +gi +), +çl£ +, +assigÃd_Ú_the_æy +); + +858 + gnodeR•r + = +ocg +-> +C»©eAnd +( +nodeR•r +, +geqR•r +); + +861  + gnodeR•r +; + +869 +CG_ouutR•r + * +ouutLBasR•r +( +CG_ouutBužd” +* +ocg +, cÚ¡ +GEQ_HªdË + & +g +, + +870 +R–©iÚ + & +bounds +, +V¬ŸbË_ID + +v +, + +871 +cÛf_t + +¡ride +, cÚ¡ +EQ_HªdË + & +¡rideEQ +, + +872 +R–©iÚ + +known +, cÚ¡ +¡d +:: +veùÜ +< +CG_ouutR•r + *> & +assigÃd_Ú_the_æy +) { + +873 #ià! +defšed + +NDEBUG + + +874 +cÛf_t + +v_cÛf +; + +875 +as£¹ +(( +v_cÛf + = +g +. +g‘_cÛf +( +v +)) > 0); + +878 + g¡d +:: +¡ršg + +s +; + +879 +CG_ouutR•r + * + glbR•r +; + +880 ià( + g¡ride + == 1) { + +881 +lbR•r + = +ouutEasyBoundAsR•r +( +ocg +, +bounds +, +g +, +v +, +çl£ +, 1, +assigÃd_Ú_the_æy +); + +884 ià(! +boundH™sSŒide +( +g +, +v +, +¡rideEQ +, +¡ride +, +known +)) { + +885 + gbounds +. +£tup_Çmes +(); + +887 +CG_¡ršgBužd” + + goscg +; + +888 + g¡d +:: +¡ršg + +c + = +G‘SŒšg +( +ouutEasyBoundAsR•r +(& +oscg +, +bounds +, +¡rideEQ +, +v +, +Œue +, 0, +assigÃd_Ú_the_æy +)); + +889 +CG_ouutR•r + * + gcR•r + = +NULL +; + +890 ià( + gc + !ð +¡d +:: +¡ršg +("0")) + +891 +cR•r + = +ouutEasyBoundAsR•r +( +ocg +, +bounds +, +¡rideEQ +, +v +, +Œue +, 0, +assigÃd_Ú_the_æy +); + +892 + g¡d +:: +¡ršg + +Lov”M + = +G‘SŒšg +( +ouutEasyBoundAsR•r +(& +oscg +, +bounds +, +g +, +v +, +çl£ +, 1, +assigÃd_Ú_the_æy +)); + +893 +CG_ouutR•r + * + gLov”MR•r + = +NULL +; + +894 ià( + gLov”M + !ð +¡d +:: +¡ršg +("0")) + +895 +Lov”MR•r + = +ouutEasyBoundAsR•r +( +ocg +, +bounds +, +g +, +v +, +çl£ +, 1, +assigÃd_Ú_the_æy +); + +897 ià( + gcode_g’_debug + > 2) { + +898 +årštf +( +DebugFže +,"::: Lov”M i %s\n", +Lov”M +. +c_¡r +()); + +899 +årštf +( +DebugFže +,"::: c i %s\n", +c +. +c_¡r +()); + +902  + gcom¶ex™y1 + = 0, + gcom¶ex™y2 + = 0; + +903  +size_t + + gi + = 0; i < + gc +. +Ëngth +(); i++) + +904 ià( + gc +[ +i +] =ð'+' || +c +[i] == '-' || c[i] == '*' || c[i] == '/') + +905 +com¶ex™y1 +++; + +906 ià( + gc +[ +i +] == ',') + +907 +com¶ex™y1 + += 2; + +908  +size_t + + gi + = 0; i < + gLov”M +. +Ëngth +(); i++) + +909 ià( + gLov”M +[ +i +] =ð'+' || +Lov”M +[i] == '-' || LoverM[i] == '*' || LoverM[i] == '/') + +910 +com¶ex™y2 +++; + +911 ià( + gLov”M +[ +i +] == ',') + +912 +com¶ex™y2 + += 2; + +914 ià( + gcom¶ex™y1 + < + gcom¶ex™y2 +) { + +915 +CG_ouutR•r + * + gidUp + = +Lov”MR•r +; + +916 +CG_ouutR•r + * + gc1R•r + = +ocg +-> +C»©eCÝy +( +cR•r +); + +917 + gidUp + = +ocg +-> +C»©eMšus +( +idUp +, +c1R•r +); + +918 + gidUp + = +ocg +-> +C»©ePlus +( +idUp +, ocg-> +C»©eIÁ +( +¡ride +-1)); + +919 +CG_ouutR•r + * + gidLow + = +ocg +-> +C»©eIÁ +( +¡ride +); + +920 + glbR•r + = +ocg +-> +C»©eTimes +(ocg-> +C»©eIÁ +( +¡ride +), + +921 +ocg +-> +C»©eIÁeg”Divide +( +idUp +, +idLow +)); + +922 + glbR•r + = +ocg +-> +C»©ePlus +( +lbR•r +, +cR•r +); + +925 +CG_ouutR•r + * + gLov”M1R•r + = +ocg +-> +C»©eCÝy +( +Lov”MR•r +); + +926 +CG_ouutR•r + * + gimUp + = +ocg +-> +C»©eMšus +( +cR•r +, +Lov”M1R•r +); + +927 +CG_ouutR•r + * + gimLow + = +ocg +-> +C»©eIÁ +( +¡ride +); + +928 +CG_ouutR•r + * + gštMod + = +ocg +-> +C»©eIÁeg”Mod +( +imUp +, +imLow +); + +929 + glbR•r + = +ocg +-> +C»©ePlus +( +Lov”MR•r +, +štMod +); + +934 + gbounds +. +£tup_Çmes +(); + +935 + glbR•r + = +ouutEasyBoundAsR•r +( +ocg +, +bounds +, +g +, +v +, +çl£ +, 0, +assigÃd_Ú_the_æy +); + +939  + glbR•r +; + +946 +CG_ouutR•r + * +ouutUBasR•r +( +CG_ouutBužd” +* +ocg +, cÚ¡ +GEQ_HªdË + & +g +, + +947 +R–©iÚ + & +bounds +, + +948 +V¬ŸbË_ID + +v +, + +949 +cÛf_t + , + +950 cÚ¡ +EQ_HªdË + & , + +951 cÚ¡ +¡d +:: +veùÜ +< +CG_ouutR•r + *> & +assigÃd_Ú_the_æy +) { + +952 +as£¹ +( +g +. +g‘_cÛf +( +v +) < 0); + +953 +CG_ouutR•r +* + gupR•r + = +ouutEasyBoundAsR•r +( +ocg +, +bounds +, +g +, +v +, +çl£ +, 0, +assigÃd_Ú_the_æy +); + +954  + gupR•r +; + +966 +CG_ouutR•r +* +ouutEasyBoundAsR•r +( +CG_ouutBužd” +* +ocg +, +R–©iÚ + & +bounds +, + +967 cÚ¡ +CÚ¡¿št_HªdË + & +g +, +V¬ŸbË_ID + +v +, + +968 +boÞ + +ignÜeWC +, + +969  +ûžšg +, + +970 cÚ¡ +¡d +:: +veùÜ +< +CG_ouutR•r + *> & +assigÃd_Ú_the_æy +) { + +974 +CG_ouutR•r +* +—syBoundR•r + = +NULL +; + +976 +cÛf_t + + gv_cÛf + = +g +. +g‘_cÛf +( +v +); + +977  + gv_sign + = +v_cÛf + > 0 ? 1 : -1; + +978 + gv_cÛf + *ð +v_sign +; + +979 +as£¹ +( +v_cÛf + > 0); + +982  + gsign_adj + = - +v_sign +; + +987  +CÚ¡r_V¬s_I‹r + +c2 +( +g +, +çl£ +); + gc2 +; c2++) { + +988 ià((* + gc2 +). + gv¬ + !ð +v + && (! +ignÜeWC + || (* +c2 +). +v¬ +-> +kšd +()!= +Wždÿrd_V¬ +)) { + +990 +cÛf_t + +cf + = (* +c2 +). +cÛf +* +sign_adj +; + +991 +as£¹ +( +cf + != 0); + +993 +CG_ouutR•r + * + gv¬Name +; + +994 ià((* + gc2 +). + gv¬ +-> +kšd +(è=ð +Wždÿrd_V¬ +) { + +995 +GEQ_HªdË + +h +; + +996 ià(! +fšdFloÜIÃqu®™y +( +bounds +, (* +c2 +). +v¬ +, +h +, +v +)) { + +997 ià( + g—syBoundR•r + !ð +NULL +) { + +998 +—syBoundR•r +-> +þ—r +(); + +999 +d–‘e + + g—syBoundR•r +; + +1001  + gNULL +; + +1003 + gv¬Name + = +ouutEasyBoundAsR•r +( +ocg +, +bounds +, +h +, (* +c2 +). +v¬ +, +çl£ +, 0, +assigÃd_Ú_the_æy +); + +1006 + gv¬Name + = +ouutId’t +( +ocg +, +bounds +, (* +c2 +). +v¬ +, +assigÃd_Ú_the_æy +); + +1008 +CG_ouutR•r + * + gcfR•r + = +NULL +; + +1010 ià( + gcf + > 1) { + +1011 + gcfR•r + = +ocg +-> +C»©eIÁ +( +cf +); + +1012 +CG_ouutR•r +* + grbR•r + = +ocg +-> +C»©eTimes +( +cfR•r +, +v¬Name +); + +1013 + g—syBoundR•r + = +ocg +-> +C»©ePlus +( +—syBoundR•r +, +rbR•r +); + +1015 ià( + gcf + < -1) { + +1016 + gcfR•r + = +ocg +-> +C»©eIÁ +(- +cf +); + +1017 +CG_ouutR•r +* + grbR•r + = +ocg +-> +C»©eTimes +( +cfR•r +, +v¬Name +); + +1018 + g—syBoundR•r + = +ocg +-> +C»©eMšus +( +—syBoundR•r +, +rbR•r +); + +1020 ià( + gcf + == 1) { + +1021 +—syBoundR•r + = +ocg +-> +C»©ePlus +ÓasyBoundR•r, +v¬Name +); + +1023 ià( + gcf + == -1) { + +1024 +—syBoundR•r + = +ocg +-> +C»©eMšus +ÓasyBoundR•r, +v¬Name +); + +1029 ià( + gg +. +g‘_cÚ¡ +()) { + +1030 +cÛf_t + + gcf + = +g +. +g‘_cÚ¡ +()* +sign_adj +; + +1031 +as£¹ +( +cf + != 0); + +1032 ià( + gcf + > 0) { + +1033 + g—syBoundR•r + = +ocg +-> +C»©ePlus +( +—syBoundR•r +, ocg-> +C»©eIÁ +( +cf +)); + +1036 + g—syBoundR•r + = +ocg +-> +C»©eMšus +( +—syBoundR•r +, ocg-> +C»©eIÁ +(- +cf +)); + +1040 if( + g—syBoundR•r + =ð +NULL +) { + +1041 +—syBoundR•r + = +ocg +-> +C»©eIÁ +(0); + +1045 ià( + gv_cÛf + > 1) { + +1046 +as£¹ +( +ûžšg + >= 0); + +1047 ià( + gûžšg +) { + +1048 + g—syBoundR•r +ð +ocg +-> +C»©ePlus +( +—syBoundR•r +, ocg-> +C»©eIÁ +( +v_cÛf +-1)); + +1050 + g—syBoundR•r + = +ocg +-> +C»©eIÁeg”Divide +( +—syBoundR•r +, ocg-> +C»©eIÁ +( +v_cÛf +)); + +1053  + g—syBoundR•r +; + +1062 + g¡d +:: +·œ +< +CG_ouutR•r + *, + gboÞ +> +ouutBounds +( +CG_ouutBužd” +* +ocg +, cÚ¡ +R–©iÚ + & +bounds +, +V¬ŸbË_ID + +v +,  +šd’t +, R–©iÚ & +’fÜûd +, cÚ¡ +¡d +:: +veùÜ + & +assigÃd_Ú_the_æy +) { + +1063 +R–©iÚ + +b + = +cÝy +( +bounds +); + +1064 +CÚjunù + * + gc + = +b +. +qu”y_DNF +()-> +sšgË_cÚjunù +(); + +1068 +R–©iÚ + + gr1 + = R–©iÚ:: +True +( +b +. +n_£t +()), + gr2 + = Relation::True(b.n_set()); + +1069  +EQ_I‹¿tÜ + +ei +( +c +); + gei +;ƒi++) { + +1070 ià((* + gei +). +g‘_cÛf +( +v +è!ð0 && (* +ei +). +has_wždÿrds +()) { + +1071 +cÛf_t + +sign +; + +1072 ià((* + gei +). +g‘_cÛf +( +v +) > 0) + +1073 + gsign + = 1; + +1075 + gsign + = -1; + +1077 +cÛf_t + + g¡ride + = 0; + +1078  +CÚ¡r_V¬s_I‹r + +cvi +(* +ei +, +Œue +); + gcvi +; cvi++) + +1079 ià((* + gcvi +). + gv¬ +-> +kšd +(è=ð +Wždÿrd_V¬ +) { + +1080 +¡ride + = +abs +((* +cvi +). +cÛf +); + +1085 +boÞ + + gfound_m©ch + = +çl£ +; + +1086 ià( +abs +((* +ei +). +g‘_cÛf +( +v +)) != 1) { + +1087 +cÛf_t + +d + = +¡ride + / +gcd +( +abs +((* +ei +). +g‘_cÛf +( +v +)), stride); + +1088 +R–©iÚ + + gr3 + = R–©iÚ:: +True +( +b +. +n_£t +()); + +1089 + gr3 +. +ªd_w™h_EQ +(* +ei +); + +1091  +GEQ_I‹¿tÜ + +gi +( +c +); + ggi +; gi++) { + +1092 ià((* + ggi +). +g‘_cÛf +( +v +è=ð1 && !(* +gi +). +has_wždÿrds +()) { + +1093 +R–©iÚ + +r4 +( +b +. +n_£t +()); + +1094 +F_And + * + gf_roÙ + = +r4 +. +add_ªd +(); + +1095 +SŒide_HªdË + + gh + = +f_roÙ +-> +add_¡ride +( +d +); + +1097  +CÚ¡r_V¬s_I‹r + +cvi +(* +gi +); + gcvi +; cvi++) + +1098 (* + gcvi +). + gv¬ +-> +kšd +()) { + +1099  + gIÅut_V¬ +: { + +1100  +pos + = (* +cvi +). +v¬ +-> +g‘_pos™iÚ +(); + +1101 + gh +. +upd©e_cÛf +( +r4 +. +£t_v¬ +( +pos +), (* +cvi +). +cÛf +); + +1104  + gGlob®_V¬ +: { + +1105 +Glob®_V¬_ID + +g + = (* +cvi +). +v¬ +-> +g‘_glob®_v¬ +(); + +1106 +V¬ŸbË_ID + + gv +; + +1107 ià( + gg +-> +¬™y +() == 0) + +1108 +v + = +r4 +. +g‘_loÿl +( +g +); + +1110 + gv + = +r4 +. +g‘_loÿl +( +g +, (* +cvi +). +v¬ +-> +funùiÚ_of +()); + +1111 + gh +. +upd©e_cÛf +( +v +, (* +cvi +). +cÛf +); + +1115 +årštf +( +DebugFže +, "can't deal withhe variableype in†ower bound\n"); + +1116  + g¡d +:: +make_·œ +( +¡©ic_ÿ¡ +< +CG_ouutR•r + *>( +NULL +), +çl£ +); + +1118 + gh +. +upd©e_cÚ¡ +((* +gi +). +g‘_cÚ¡ +()); + +1120 +R–©iÚ + + gr5 + = +Gi¡ +( +cÝy +( +r3 +), +IÁ”£ùiÚ +(cÝy( +r4 +), cÝy( +’fÜûd +))); + +1123 ià( + gr5 +. +is_obvious_utÞogy +()) { + +1124 + gr1 + = +IÁ”£ùiÚ +( +r1 +, +r4 +); + +1125 + gfound_m©ch + = +Œue +; + +1132  +GEQ_I‹¿tÜ + +gi +( +c +); + ggi +; gi++) { + +1133 ià((* + ggi +). +g‘_cÛf +( +v +è=ð +abs +((* +ei +).g‘_cÛf(v)è&& !(* +gi +). +has_wždÿrds +()) { + +1134 +R–©iÚ + +r +( +b +. +n_£t +()); + +1135 +SŒide_HªdË + + gh + = +r +. +add_ªd +()-> +add_¡ride +( +¡ride +); + +1137  +CÚ¡r_V¬s_I‹r + +cvi +(* +gi +); + gcvi +; cvi++) + +1138 (* + gcvi +). + gv¬ +-> +kšd +()) { + +1139  + gIÅut_V¬ +: { + +1140  +pos + = (* +cvi +). +v¬ +-> +g‘_pos™iÚ +(); + +1141 ià((* + gcvi +). + gv¬ + !ð +v +) { + +1142  +t1 + = +št_mod +((* +cvi +). +cÛf +, +¡ride +); + +1143 ià( + gt1 + != 0) { + +1144 +cÛf_t + +t2 + = +’fÜûd +. +qu”y_v¬ŸbË_mod +ÓnfÜûd. +£t_v¬ +( +pos +), +¡ride +); + +1145 ià( + gt2 + !ð +posInfš™y +) + +1146 +h +. +upd©e_cÚ¡ +( +t1 +* +t2 +); + +1148 + gh +. +upd©e_cÛf +( +r +. +£t_v¬ +( +pos +), +t1 +); + +1152 + gh +. +upd©e_cÛf +( +r +. +£t_v¬ +( +pos +), (* +cvi +). +cÛf +); + +1155  + gGlob®_V¬ +: { + +1156 +Glob®_V¬_ID + +g + = (* +cvi +). +v¬ +-> +g‘_glob®_v¬ +(); + +1157 +V¬ŸbË_ID + + gv +; + +1158 ià( + gg +-> +¬™y +() == 0) + +1159 +v + = +’fÜûd +. +g‘_loÿl +( +g +); + +1161 + gv + = +’fÜûd +. +g‘_loÿl +( +g +, (* +cvi +). +v¬ +-> +funùiÚ_of +()); + +1162 +cÛf_t + + gt + = +’fÜûd +. +qu”y_v¬ŸbË_mod +( +v +, +¡ride +); + +1163 ià( + gt + !ð +posInfš™y +) + +1164 +h +. +upd©e_cÚ¡ +( +t +*(* +cvi +). +cÛf +); + +1166 +V¬ŸbË_ID + + gv2 +; + +1167 ià( + gg +-> +¬™y +() == 0) + +1168 +v2 + = +r +. +g‘_loÿl +( +g +); + +1170 + gv2 + = +r +. +g‘_loÿl +( +g +, (* +cvi +). +v¬ +-> +funùiÚ_of +()); + +1171 + gh +. +upd©e_cÛf +( +v2 +, (* +cvi +). +cÛf +); + +1176 +årštf +( +DebugFže +, "can't deal withhe variableype in†ower bound\n"); + +1177  + g¡d +:: +make_·œ +( +¡©ic_ÿ¡ +< +CG_ouutR•r + *>( +NULL +), +çl£ +); + +1179 + gh +. +upd©e_cÚ¡ +((* +gi +). +g‘_cÚ¡ +()); + +1181 +boÞ + + gt + = +Œue +; + +1183 +CÚjunù + * + gc2 + = +r +. +qu”y_DNF +()-> +sšgË_cÚjunù +(); + +1184 +EQ_HªdË + + gh2 +; + +1185  +EQ_I‹¿tÜ + +ei2 +( +c2 +); + gei2 +;ƒi2++) { + +1186 + gh2 + = * +ei2 +; + +1190  + gsign +; + +1191 ià( + gh2 +. +g‘_cÛf +( +v +è=ð(* +ei +).get_coef(v)) + +1192 +sign + = 1; + +1194 + gsign + = -1; + +1196 + gt + = +št_mod +( +h2 +. +g‘_cÚ¡ +(è- +sign + * (* +ei +).g‘_cÚ¡(), +¡ride +) == 0; + +1198 ià( + gt + !ð +çl£ +) + +1199  +CÚ¡r_V¬s_I‹r + +cvi +( +h2 +); + gcvi +; cvi++) + +1200 ià((* + gcvi +). + gv¬ +-> +kšd +(è!ð +Wždÿrd_V¬ + && + +1201 +št_mod +((* +cvi +). +cÛf + - +sign + * (* +ei +). +g‘_cÛf +((*cvi). +v¬ +), +¡ride +) != 0) { + +1202 +t + = +çl£ +; + +1206 ià( + gt + !ð +çl£ +) + +1207  +CÚ¡r_V¬s_I‹r + +cvi +(* +ei +); + gcvi +; cvi++) + +1208 ià((* + gcvi +). + gv¬ +-> +kšd +(è!ð +Wždÿrd_V¬ + && + +1209 +št_mod +((* +cvi +). +cÛf + - +sign + * +h2 +. +g‘_cÛf +((*cvi). +v¬ +), +¡ride +) != 0) { + +1210 +t + = +çl£ +; + +1216 ià( + gt +) { + +1218 +F_And + * + gf_roÙ + = +r1 +. +ªd_w™h_ªd +(); + +1219 +SŒide_HªdË + + gh + = +f_roÙ +-> +add_¡ride +( +¡ride +); + +1220  +CÚ¡r_V¬s_I‹r + +cvi +(* +gi +); + gcvi +; cvi++) + +1221 (* + gcvi +). + gv¬ +-> +kšd +()) { + +1222  + gIÅut_V¬ +: { + +1223 +h +. +upd©e_cÛf +( +r1 +. +£t_v¬ +((* +cvi +). +v¬ +-> +g‘_pos™iÚ +()), (*cvi). +cÛf +); + +1226  + gGlob®_V¬ +: { + +1227 +Glob®_V¬_ID + +g + = (* +cvi +). +v¬ +-> +g‘_glob®_v¬ +(); + +1228 +V¬ŸbË_ID + + gv +; + +1229 ià( + gg +-> +¬™y +() == 0) + +1230 +v + = +r1 +. +g‘_loÿl +( +g +); + +1232 + gv + = +r1 +. +g‘_loÿl +( +g +, (* +cvi +). +v¬ +-> +funùiÚ_of +()); + +1233 + gh +. +upd©e_cÛf +( +v +, (* +cvi +). +cÛf +); + +1237 +årštf +( +DebugFže +, "can't deal withhe variableype in†ower bound\n"); + +1238  + g¡d +:: +make_·œ +( +¡©ic_ÿ¡ +< +CG_ouutR•r + *>( +NULL +), +çl£ +); + +1240 + gh +. +upd©e_cÚ¡ +((* +gi +). +g‘_cÚ¡ +()); + +1242 + gfound_m©ch + = +Œue +; + +1249 ià(! + gfound_m©ch +) + +1250 + gr1 +. +ªd_w™h_EQ +(* +ei +); + +1252 ià((* + gei +). +g‘_cÛf +( +v +) == 0) { + +1253 +R–©iÚ + +r3 + = R–©iÚ:: +True +( +b +. +n_£t +()); + +1254 + gr3 +. +ªd_w™h_EQ +(* +ei +); + +1255 +R–©iÚ + + gr4 + = +Gi¡ +( +r3 +, +cÝy +( +’fÜûd +)); + +1256 ià(! + gr4 +. +is_obvious_utÞogy +()) + +1257 + gr2 +. +ªd_w™h_EQ +(* +ei +); + +1260 + gr2 +. +ªd_w™h_EQ +(* +ei +); + +1265 + g¡d +:: +m­ +< +V¬ŸbË_ID +, + gV¬ŸbË_ID +> + gexi¡s_m­pšg +; + +1266 +F_Exi¡s + * + gã + = +r2 +. +ªd_w™h_ªd +()-> +add_exi¡s +(); + +1267 +F_And + * + gf_roÙ + = +ã +-> +add_ªd +(); + +1268  +GEQ_I‹¿tÜ + +gi +( +c +); + ggi +; gi++) { + +1269 +GEQ_HªdË + + gh + = +f_roÙ +-> +add_GEQ +(); + +1270  +CÚ¡r_V¬s_I‹r + +cvi +(* +gi +); + gcvi +; cvi++) { + +1271 +V¬ŸbË_ID + + gv + = +cvi +. +cu¼_v¬ +(); + +1272  + gv +-> +kšd +()) { + +1273  + gIÅut_V¬ +: { + +1274  +pos + = +v +-> +g‘_pos™iÚ +(); + +1275 + gh +. +upd©e_cÛf +( +r2 +. +£t_v¬ +( +pos +), +cvi +. +cu¼_cÛf +()); + +1278  + gExi¡s_V¬ +: + +1279  +Wždÿrd_V¬ +: { + +1280 +¡d +:: +m­ +< +V¬ŸbË_ID +, + gV¬ŸbË_ID +>:: +™”©Ü + +p + = +exi¡s_m­pšg +. +fšd +( +v +); + +1281 +V¬ŸbË_ID + + ge +; + +1282 ià( + gp + =ð +exi¡s_m­pšg +. +’d +()) { + +1283 +e + = +ã +-> +deþ¬e +(); + +1284 + gexi¡s_m­pšg +[ +v +] = +e +; + +1287 + ge + = (* +p +). +£cÚd +; + +1288 + gh +. +upd©e_cÛf +( +e +, +cvi +. +cu¼_cÛf +()); + +1291  + gGlob®_V¬ +: { + +1292 +Glob®_V¬_ID + +g + = +v +-> +g‘_glob®_v¬ +(); + +1293 +V¬ŸbË_ID + + gv2 +; + +1294 ià( + gg +-> +¬™y +() == 0) + +1295 +v2 + = +r2 +. +g‘_loÿl +( +g +); + +1297 + gv2 + = +r2 +. +g‘_loÿl +( +g +, +v +-> +funùiÚ_of +()); + +1298 + gh +. +upd©e_cÛf +( +v2 +, +cvi +. +cu¼_cÛf +()); + +1302 +as£¹ +(0); + +1305 + gh +. +upd©e_cÚ¡ +((* +gi +). +g‘_cÚ¡ +()); + +1311 + gr1 +. +sim¶ify +(); + +1312 + gr2 +. +sim¶ify +(); + +1313 +R–©iÚ + + gb2 + = +IÁ”£ùiÚ +( +r1 +, +r2 +); + +1314 + gb2 +. +sim¶ify +(); + +1315  + gi + = 1; i <ð +b +. +n_£t +(); i++) + +1316 + gb2 +. +Çme_£t_v¬ +( +i +, +b +. +£t_v¬ +(i)-> +Çme +()); + +1317 + gb2 +. +£tup_Çmes +(); + +1318 + gb + = +b2 +; + +1319 + gc + = +b +. +qu”y_DNF +()-> +sšgË_cÚjunù +(); + +1324 +EQ_HªdË + + g¡rideEQ +; + +1325 +boÞ + + gfoundSŒide + = +çl£ +; + +1326 +boÞ + + gfoundSim¶eSŒide + = +çl£ +; + +1327 +cÛf_t + + g¡• + = 1; + +1328  + gnum_¡ride + = 0; + +1330  +EQ_I‹¿tÜ + +ei +( +c +); + gei +;ƒi++) { + +1331 ià((* + gei +). +g‘_cÛf +( +v +è!ð0 && (* +ei +). +has_wždÿrds +()) { + +1332 +num_¡ride +++; + +1334 ià( +abs +((* +ei +). +g‘_cÛf +( +v +)) != 1) + +1337 +boÞ + + gt + = +Œue +; + +1338 +cÛf_t + + gd + = 1; + +1339  +CÚ¡r_V¬s_I‹r + +cvi +(* +ei +); + gcvi +; cvi++) + +1340 ià((* + gcvi +). + gv¬ +-> +kšd +(è=ð +Wždÿrd_V¬ +) { + +1341 +as£¹ +( +d +==1); + +1342 + gd + = +abs +((* +cvi +). +cÛf +); + +1344 ià((* + gcvi +). + gv¬ +-> +kšd +(è=ð +IÅut_V¬ +) { + +1345 ià((* +cvi +). +v¬ + !ð +v +) + +1346 +t + = +çl£ +; + +1349 + gt + = +çl£ +; + +1351 ià( + gd + > + g¡• +) { + +1352 + g¡• + = +d +; + +1353 + gfoundSim¶eSŒide + = +t +; + +1354 + g¡rideEQ + = * +ei +; + +1355 + gfoundSŒide + = +Œue +; + +1362 ià(!( + gnum_¡ride + =ð0 || ( +num_¡ride + =ð1 && +foundSŒide +))) + +1363  +¡d +:: +make_·œ +( +¡©ic_ÿ¡ +< +CG_ouutR•r + *>( +NULL +), +çl£ +); + +1366  + glow”_bounds + = 0, + guµ”_bounds + = 0; + +1367 + gTu¶e +< + gCG_ouutR•r + *> + glbLi¡ +; + +1368 + gTu¶e +< + gCG_ouutR•r + *> + gubLi¡ +; + +1369 +cÛf_t + + gcÚ¡_lb + = +ÃgInfš™y +, + gcÚ¡_ub + = +posInfš™y +; + +1370  +GEQ_I‹¿tÜ + +g +( +c +); + gg +; g++) { + +1371 +cÛf_t + + gcÛf + = (* +g +). +g‘_cÛf +( +v +); + +1372 ià( + gcÛf + == 0) + +1374 ià( + gcÛf + > 0) { + +1375 + glow”_bounds +++; + +1376 ià((* + gg +). +is_cÚ¡ +( +v +è&& ! + gfoundSŒide +) { + +1378 +cÛf_t + + gL +, + gm +; + +1379 + gL + = -((* +g +). +g‘_cÚ¡ +()); + +1381 + gm + = (* +g +). +g‘_cÛf +( +v +); + +1382 +cÛf_t + + gsb + = (è( +ûž +(((è +L +è/ +m +)); + +1383 +£t_max +( +cÚ¡_lb +, +sb +); + +1385 ià((* + gg +). +is_cÚ¡ +( +v +è&& + gfoundSim¶eSŒide +) { + +1388 +cÛf_t + + gL +, + gm +, + gs +, + gc +; + +1389 + gL + = -((* +g +). +g‘_cÚ¡ +()); + +1390 + gm + = (* +g +). +g‘_cÛf +( +v +); + +1391 + gs + = +¡• +; + +1392 + gc + = +¡rideEQ +. +g‘_cÚ¡ +(); + +1393 +cÛf_t + + gsb + = ( +s + * (è( +ûž +Ð(è( +L + - ( +c + * +m +)) /(s*m))))+ c; + +1394 +£t_max +( +cÚ¡_lb +, +sb +); + +1397 + glbLi¡ +. +­³nd +( +ouutLBasR•r +( +ocg +, * +g +, +b +, +v +, +¡• +, +¡rideEQ +, +’fÜûd +, +assigÃd_Ú_the_æy +)); + +1400 + guµ”_bounds +++; + +1401 ià((* + gg +). +is_cÚ¡ +( +v +)) { + +1403 +£t_mš +( +cÚ¡_ub +,-(* +g +). +g‘_cÚ¡ +()/(*g). +g‘_cÛf +( +v +)); + +1406 + gubLi¡ +. +­³nd +( +ouutUBasR•r +( +ocg +, * +g +, +b +, +v +, +¡• +, +¡rideEQ +, +assigÃd_Ú_the_æy +)); + +1410 +CG_ouutR•r + * + glbR•r + = +NULL +; + +1411 +CG_ouutR•r + * + gubR•r + = +NULL +; + +1412 ià( + gcÚ¡_lb + !ð +ÃgInfš™y +) + +1413 +lbLi¡ +. +­³nd +( +ocg +-> +C»©eIÁ +( +cÚ¡_lb +)); + +1414 ià( + glbLi¡ +. +size +() > 1) + +1415 + glbR•r + = +ocg +-> +C»©eInvoke +("max", +lbLi¡ +); + +1416 ià( + glbLi¡ +. +size +() == 1) + +1417 +lbR•r + = +lbLi¡ +[1]; + +1420 if( + gfžlInBounds + && + glbLi¡ +. +size +(è=ð1 && +cÚ¡_lb + !ð +ÃgInfš™y +) + +1421 +low”BoundFÜLev– + = +cÚ¡_lb +; + +1424 ià( + gcÚ¡_ub + !ð +posInfš™y +) + +1425 +ubLi¡ +. +­³nd +( +ocg +-> +C»©eIÁ +( +cÚ¡_ub +)); + +1426 ià( + gubLi¡ +. +size +() > 1) + +1427 + gubR•r + = +ocg +-> +C»©eInvoke +("mš", +ubLi¡ +); + +1428 ià( + gubLi¡ +. +size +() == 1) + +1429 +ubR•r + = +ubLi¡ +[1]; + +1432 if( + gfžlInBounds + && + gcÚ¡_ub + !ð +posInfš™y +) + +1433 +uµ”BoundFÜLev– + = +cÚ¡_ub +; + +1436 ià( + guµ”_bounds + =ð0 || +low”_bounds + == 0) { + +1437  +¡d +:: +make_·œ +( +¡©ic_ÿ¡ +< +CG_ouutR•r + *>( +NULL +), +çl£ +); + +1441 +F_Exi¡s + * + gã + = +’fÜûd +. +ªd_w™h_ªd +()-> +add_exi¡s +(); + +1442 +F_And + * + gf_roÙ + = +ã +-> +add_ªd +(); + +1443 + g¡d +:: +m­ +< +V¬ŸbË_ID +, + gV¬ŸbË_ID +> + gexi¡s_m­pšg +; + +1444 + g¡d +:: +¡ack +< +¡d +:: +·œ +< +GEQ_HªdË +, + gV¬ŸbË_ID +> > + gæoÜ_geq_¡ack +; + +1445 + g¡d +:: +£t +< +V¬ŸbË_ID +> +æoÜ_v¬_£t +; + +1447 ià( + gfoundSŒide +) { + +1448 +EQ_HªdË + + gh + = +f_roÙ +-> +add_EQ +(); + +1449  +CÚ¡r_V¬s_I‹r + +cvi +( +¡rideEQ +); + gcvi +; cvi++) + +1450 (* + gcvi +). + gv¬ +-> +kšd +()) { + +1451  + gIÅut_V¬ +: { + +1452  +pos + = (* +cvi +). +v¬ +-> +g‘_pos™iÚ +(); + +1453 + gh +. +upd©e_cÛf +( +’fÜûd +. +£t_v¬ +( +pos +), (* +cvi +). +cÛf +); + +1456  + gExi¡s_V¬ +: + +1457  +Wždÿrd_V¬ +: { + +1458 +¡d +:: +m­ +< +V¬ŸbË_ID +, + gV¬ŸbË_ID +>:: +™”©Ü + +p + = +exi¡s_m­pšg +. +fšd +((* +cvi +). +v¬ +); + +1459 +V¬ŸbË_ID + + ge +; + +1460 ià( + gp + =ð +exi¡s_m­pšg +. +’d +()) { + +1461 +e + = +ã +-> +deþ¬e +(); + +1462 + gexi¡s_m­pšg +[(* +cvi +). +v¬ +] = +e +; + +1465 + ge + = (* +p +). +£cÚd +; + +1466 + gh +. +upd©e_cÛf +( +e +, (* +cvi +). +cÛf +); + +1469  + gGlob®_V¬ +: { + +1470 +Glob®_V¬_ID + +g + = (* +cvi +). +v¬ +-> +g‘_glob®_v¬ +(); + +1471 +V¬ŸbË_ID + + ge +; + +1472 ià( + gg +-> +¬™y +() == 0) + +1473 +e + = +’fÜûd +. +g‘_loÿl +( +g +); + +1475 + ge + = +’fÜûd +. +g‘_loÿl +( +g +, (* +cvi +). +v¬ +-> +funùiÚ_of +()); + +1476 + gh +. +upd©e_cÛf +( +e +, (* +cvi +). +cÛf +); + +1480 +as£¹ +(0); + +1482 + gh +. +upd©e_cÚ¡ +( +¡rideEQ +. +g‘_cÚ¡ +()); + +1485  +GEQ_I‹¿tÜ + +gi +( +c +); + ggi +; gi++) + +1486 ià((* + ggi +). +g‘_cÛf +( +v +) != 0) { + +1487 +GEQ_HªdË + +h + = +f_roÙ +-> +add_GEQ +(); + +1488  +CÚ¡r_V¬s_I‹r + +cvi +(* +gi +); + gcvi +; cvi++) + +1489 (* + gcvi +). + gv¬ +-> +kšd +()) { + +1490  + gIÅut_V¬ +: { + +1491  +pos + = (* +cvi +). +v¬ +-> +g‘_pos™iÚ +(); + +1492 + gh +. +upd©e_cÛf +( +’fÜûd +. +£t_v¬ +( +pos +), (* +cvi +). +cÛf +); + +1495  + gExi¡s_V¬ +: + +1496  +Wždÿrd_V¬ +: { + +1497 +¡d +:: +m­ +< +V¬ŸbË_ID +, + gV¬ŸbË_ID +>:: +™”©Ü + +p + = +exi¡s_m­pšg +. +fšd +((* +cvi +). +v¬ +); + +1498 +V¬ŸbË_ID + + ge +; + +1499 ià( + gp + =ð +exi¡s_m­pšg +. +’d +()) { + +1500 +e + = +ã +-> +deþ¬e +(); + +1501 + gexi¡s_m­pšg +[(* +cvi +). +v¬ +] = +e +; + +1504 + ge + = (* +p +). +£cÚd +; + +1505 + gh +. +upd©e_cÛf +( +e +, (* +cvi +). +cÛf +); + +1507 ià( + gæoÜ_v¬_£t +. +fšd +((* +cvi +). +v¬ +è=ð +æoÜ_v¬_£t +. +’d +()) { + +1508 +GEQ_HªdË + +h2 +; + +1509 +fšdFloÜIÃqu®™y +( +b +, (* +cvi +). +v¬ +, +h2 +, +v +); + +1510 + gæoÜ_geq_¡ack +. +push +( +¡d +:: +make_·œ +( +h2 +, (* +cvi +). +v¬ +)); + +1511 + gæoÜ_v¬_£t +. +š£¹ +((* +cvi +). +v¬ +); + +1515  + gGlob®_V¬ +: { + +1516 +Glob®_V¬_ID + +g + = (* +cvi +). +v¬ +-> +g‘_glob®_v¬ +(); + +1517 +V¬ŸbË_ID + + ge +; + +1518 ià( + gg +-> +¬™y +() == 0) + +1519 +e + = +’fÜûd +. +g‘_loÿl +( +g +); + +1521 + ge + = +’fÜûd +. +g‘_loÿl +( +g +, (* +cvi +). +v¬ +-> +funùiÚ_of +()); + +1522 + gh +. +upd©e_cÛf +( +e +, (* +cvi +). +cÛf +); + +1526 +as£¹ +(0); + +1528 + gh +. +upd©e_cÚ¡ +((* +gi +). +g‘_cÚ¡ +()); + +1532 ! + gæoÜ_geq_¡ack +. +em±y +()) { + +1533 + g¡d +:: +·œ +< +GEQ_HªdË +, + gV¬ŸbË_ID +> + gp + = +æoÜ_geq_¡ack +. +tÝ +(); + +1534 + gæoÜ_geq_¡ack +. +pÝ +(); + +1536 +GEQ_HªdË + + gh1 + = +f_roÙ +-> +add_GEQ +(); + +1537 +GEQ_HªdË + + gh2 + = +f_roÙ +-> +add_GEQ +(); + +1538  +CÚ¡r_V¬s_I‹r + +cvi +( +p +. +fœ¡ +); + gcvi +; cvi++) { + +1539 (* + gcvi +). + gv¬ +-> +kšd +()) { + +1540  + gIÅut_V¬ +: { + +1541  +pos + = (* +cvi +). +v¬ +-> +g‘_pos™iÚ +(); + +1542 + gh1 +. +upd©e_cÛf +( +’fÜûd +. +šput_v¬ +( +pos +), (* +cvi +). +cÛf +); + +1543 + gh2 +. +upd©e_cÛf +( +’fÜûd +. +šput_v¬ +( +pos +), -(* +cvi +). +cÛf +); + +1546  + gExi¡s_V¬ +: + +1547  +Wždÿrd_V¬ +: { + +1548 +¡d +:: +m­ +< +V¬ŸbË_ID +, + gV¬ŸbË_ID +>:: +™”©Ü + +p2 + = +exi¡s_m­pšg +. +fšd +((* +cvi +). +v¬ +); + +1549 +V¬ŸbË_ID + + ge +; + +1550 ià( + gp2 + =ð +exi¡s_m­pšg +. +’d +()) { + +1551 +e + = +ã +-> +deþ¬e +(); + +1552 + gexi¡s_m­pšg +[(* +cvi +). +v¬ +] = +e +; + +1555 + ge + = (* +p2 +). +£cÚd +; + +1556 + gh1 +. +upd©e_cÛf +( +e +, (* +cvi +). +cÛf +); + +1557 + gh2 +. +upd©e_cÛf +( +e +, -(* +cvi +). +cÛf +); + +1559 ià( + gæoÜ_v¬_£t +. +fšd +((* +cvi +). +v¬ +è=ð +æoÜ_v¬_£t +. +’d +()) { + +1560 +GEQ_HªdË + +h3 +; + +1561 +fšdFloÜIÃqu®™y +( +b +, (* +cvi +). +v¬ +, +h3 +, +v +); + +1562 + gæoÜ_geq_¡ack +. +push +( +¡d +:: +make_·œ +( +h3 +, (* +cvi +). +v¬ +)); + +1563 + gæoÜ_v¬_£t +. +š£¹ +((* +cvi +). +v¬ +); + +1567  + gGlob®_V¬ +: { + +1568 +Glob®_V¬_ID + +g + = (* +cvi +). +v¬ +-> +g‘_glob®_v¬ +(); + +1569 +V¬ŸbË_ID + + ge +; + +1570 ià( + gg +-> +¬™y +() == 0) + +1571 +e + = +’fÜûd +. +g‘_loÿl +( +g +); + +1573 + ge + = +’fÜûd +. +g‘_loÿl +( +g +, (* +cvi +). +v¬ +-> +funùiÚ_of +()); + +1574 + gh1 +. +upd©e_cÛf +( +e +, (* +cvi +). +cÛf +); + +1575 + gh2 +. +upd©e_cÛf +( +e +, -(* +cvi +). +cÛf +); + +1579 +as£¹ +(0); + +1582 + gh1 +. +upd©e_cÚ¡ +( +p +. +fœ¡ +. +g‘_cÚ¡ +()); + +1583 + gh2 +. +upd©e_cÚ¡ +(- +p +. +fœ¡ +. +g‘_cÚ¡ +()); + +1584 + gh2 +. +upd©e_cÚ¡ +(- +p +. +fœ¡ +. +g‘_cÛf +Õ. +£cÚd +)-1); + +1586 + g’fÜûd +. +sim¶ify +(); + +1588 +CG_ouutR•r + * + g¡R•r + = +NULL +; + +1589 ià( + g¡• + != 1) + +1590 +¡R•r + = +ocg +-> +C»©eIÁ +( +abs +( +¡• +)); + +1591 +CG_ouutR•r + * + gšdexR•r + = +ouutId’t +( +ocg +, +b +, +v +, +assigÃd_Ú_the_æy +); + +1592 +CG_ouutR•r + * + gù¾R•r + = +ocg +-> +C»©eInduùive +( +šdexR•r +, +lbR•r +, +ubR•r +, +¡R•r +); + +1594  + g¡d +:: +make_·œ +( +ù¾R•r +, +Œue +); + +1599 +R–©iÚ + +´ojeù_Úto_Ëv–s +(R–©iÚ +R +,  +Ï¡_Ëv– +, +boÞ + +wždÿrds +) { + +1600 +as£¹ +( +Ï¡_Ëv– + >ð0 && +R +. +is_£t +(è&&†a¡_Ëv– <ðR. +n_£t +()); + +1601 ià( + gÏ¡_Ëv– + =ð +R +. +n_£t +())  R; + +1603  + gÜig_v¬s + = +R +. +n_£t +(); + +1604  + gnum_´ojeùed + = +Üig_v¬s + - +Ï¡_Ëv– +; + +1605 + gR + = +Ex‹nd_S‘ +( +R +, +num_´ojeùed + + +1607 +M­pšg + + gm1 + = M­pšg:: +Id’t™y +( +R +. +n_£t +()); + +1609  + gi += +Ï¡_Ëv– ++1; i <ð +Üig_v¬s +; i++) { + +1610 + gm1 +. +£t_m­ +( +S‘_V¬ +, +i +, +Exi¡s_V¬ +, i); + +1611 + gm1 +. +£t_m­ +( +S‘_V¬ +, +i ++ +num_´ojeùed +, Set_Var, i); + +1614 +M­R–1 +( +R +, +m1 +, +Comb_Id +); + +1615 + gR +. +fš®ize +(); + +1616 + gR +. +sim¶ify +(); + +1617 ià(! + gwždÿrds +) + +1618 + gR + = +Aµroxim©e +( +R +,1); + +1619 +as£¹ +( +R +. +is_£t +()); + +1620  + gR +; + +1627 +boÞ + +boundH™sSŒide +(cÚ¡ +GEQ_HªdË + & +g +, +V¬ŸbË_ID + +v +, + +1628 cÚ¡ +EQ_HªdË + & +¡rideEQ +, + +1629 +cÛf_t + , + +1630 +R–©iÚ + +known +) { + +1635 +cÛf_t + + gm + = +g +. +g‘_cÛf +( +v +); + +1636 +R–©iÚ + +‹¡ +( +known +. +n_£t +()); + +1637 +F_Exi¡s + * + ge + = +‹¡ +. +add_exi¡s +(); + +1638 +V¬ŸbË_ID + + g®pha + = +e +-> +deþ¬e +(); + +1639 +F_And + * + ga + = +e +-> +add_ªd +(); + +1640 +EQ_HªdË + + gh + = +a +-> +add_EQ +(); + +1641  +CÚ¡r_V¬s_I‹r + +I +( +g +, +çl£ +); + gI +; I++) + +1642 if((* + gI +). + gv¬ + !ð +v +) { + +1643 if((* +I +). +v¬ +-> +kšd +(è!ð +Glob®_V¬ +) + +1644 +h +. +upd©e_cÛf +((* +I +). +v¬ +, (*I). +cÛf +); + +1646 + gh +. +upd©e_cÛf +( +‹¡ +. +g‘_loÿl +((* +I +). +v¬ +-> +g‘_glob®_v¬ +()), (*I). +cÛf +); + +1649 + gh +. +upd©e_cÚ¡ +( +g +. +g‘_cÚ¡ +()); + +1650 + gh +. +upd©e_cÛf +( +®pha +, +m +); + +1651 ià(!( +Gi¡ +( +‹¡ +, +cÝy +( +known +)). +is_obvious_utÞogy +())) + +1652  + gçl£ +; + +1654 +R–©iÚ + + gboundR– + = +known +; + +1655 + gboundR– +. +ªd_w™h_EQ +( +g +); + +1656 +R–©iÚ + +¡rideR– +( +known +. +n_£t +()); + +1657 + g¡rideR– +. +ªd_w™h_EQ +( +¡rideEQ +); + +1658  +Gi¡ +( +¡rideR– +, +boundR– +). +is_obvious_utÞogy +(); + +1663 +boÞ + +isSim¶eSŒide +(cÚ¡ +EQ_HªdË + & +g +, +V¬ŸbË_ID + +v +) { + +1664 +EQ_HªdË + + ggg + = +g +; + +1666 +boÞ + + gis_sim¶e += +Œue +; + +1667  +CÚ¡r_V¬s_I‹r + +cvi +( +gg +, +çl£ +); + gcvi + && + gis_sim¶e +; cvi++) + +1668 + gis_sim¶e + = ((* +cvi +). +cÛf + =ð0 || (*cvi). +v¬ + =ð +v + + +1669 || (* +cvi +). +v¬ +-> +kšd +(è=ð +Wždÿrd_V¬ +); + +1670  + gis_sim¶e +; + +1674  +couÁSŒides +( +CÚjunù + * +c +, +V¬ŸbË_ID + +v +, +EQ_HªdË + & +¡rideEQ +, + +1675 +boÞ + & +sim¶e +) { + +1676  + g¡rides +=0; + +1677  +EQ_I‹¿tÜ + +G +( +c +); + gG +; G++) + +1678  +CÚ¡r_V¬s_I‹r + +I +(* +G +, +Œue +); + gI +; I++) + +1679 ià(((* + gI +). + gcÛf + !ð0è&& (* +G +). +g‘_cÛf +( +v +) != 0) { + +1680 +¡rides +++; + +1681 + gsim¶e + = +isSim¶eSŒide +(* +G +, +v +); + +1682 + g¡rideEQ + = * +G +; + +1685  + g¡rides +; + +1688 + gÇme¥aû + { + +1690 +boÞ + +hasEQ +( +R–©iÚ + +r +,  +Ëv– +) { + +1691 + gr +. +sim¶ify +(); + +1692 +V¬ŸbË_ID + + gv + = +£t_v¬ +( +Ëv– +); + +1693 +CÚjunù + * + gs_cÚj + = +r +. +sšgË_cÚjunù +(); + +1694  +EQ_I‹¿tÜ + +G +( +s_cÚj +); + gG +; G++) + +1695 ià((* + gG +). +g‘_cÛf +( +v +)) + +1696  + gŒue +; + +1697  + gçl£ +; + +1702  +R–©iÚ + +pickEQ +(R–©iÚ +r +,  +Ëv– +) { + +1703 + gr +. +sim¶ify +(); + +1704 +V¬ŸbË_ID + + gv + = +£t_v¬ +( +Ëv– +); + +1705 +CÚjunù + * + gs_cÚj + = +r +. +sšgË_cÚjunù +(); + +1706  +EQ_I‹¿tÜ + +E +( +s_cÚj +); + gE +; E++) + +1707 ià((* + gE +). +g‘_cÛf +( +v +)) { + +1708 +R–©iÚ + +‹¡_»l +( +r +. +n_£t +()); + +1709 + g‹¡_»l +. +ªd_w™h_EQ +(* +E +); + +1710  + g‹¡_»l +; + +1712 +as£¹ +(0); + +1713  + gr +; + +1717 +R–©iÚ + +pickBound +(R–©iÚ +r +,  +Ëv– +,  +UB +) { + +1718 + gr +. +sim¶ify +(); + +1719 +V¬ŸbË_ID + + gv + = +£t_v¬ +( +Ëv– +); + +1720 +CÚjunù + * + gs_cÚj + = +r +. +sšgË_cÚjunù +(); + +1721  +GEQ_I‹¿tÜ + +G +( +s_cÚj +); + gG +; G++) { + +1722 ià(( + gUB + && (* + gG +). +g‘_cÛf +( +v +) < 0) + +1723 || (! + gUB + && (* + gG +). +g‘_cÛf +( +v +) > 0) ) { + +1724 +R–©iÚ + +‹¡_»l +( +r +. +n_£t +()); + +1725 + g‹¡_»l +. +ªd_w™h_GEQ +(* +G +); + +1726  + g‹¡_»l +; + +1729  +EQ_I‹¿tÜ + +E +( +s_cÚj +); + gE +; E++) { + +1730 ià((* + gE +). +g‘_cÛf +( +v +)) { + +1731 +R–©iÚ + +‹¡_»l +( +r +. +n_£t +()); + +1732 + g‹¡_»l +. +ªd_w™h_GEQ +(* +E +); + +1733 ià(( + gUB + && (* + gE +). +g‘_cÛf +( +v +) > 0) + +1734 || (! + gUB + && (* + gE +). +g‘_cÛf +( +v +) < 0) ) + +1735 + g‹¡_»l + = +Com¶em’t +( +‹¡_»l +); + +1736  + g‹¡_»l +; + +1739 +as£¹ +(0); + +1740  + gr +; + +1745 +R–©iÚ + +pickOv”h—d +(R–©iÚ +r +,  +liáTo +) { + +1746 + gr +. +sim¶ify +(); + +1747 +CÚjunù + * + gs_cÚj + = +r +. +sšgË_cÚjunù +(); + +1748  +GEQ_I‹¿tÜ + +G +( +s_cÚj +); + gG +; G++) { + +1749 +R–©iÚ + +‹¡_»l +( +r +. +n_£t +()); + +1750 + g‹¡_»l +. +ªd_w™h_GEQ +(* +G +); + +1751 +V¬ŸbË_ID + + gv +; + +1752 +cÛf_t + + gpos + = -1; + +1753 +cÛf_t + + gc += 0; + +1754  +CÚ¡r_V¬s_I‹r + +cvi +(* +G +, +çl£ +); + gcvi +; cvi++) + +1755 ià((* + gcvi +). + gcÛf + && (*cvi). + gv¬ +-> +kšd +(è=ð +IÅut_V¬ + + +1756 && (* +cvi +). +v¬ +-> +g‘_pos™iÚ +(è> +pos +) { + +1757 +v + = (* +cvi +). +v¬ +; + +1758 + gpos + = (* +cvi +). +v¬ +-> +g‘_pos™iÚ +(); + +1759 + gc + = (* +cvi +). +cÛf +; + +1762 +årštf +( +DebugFže +,"Coef = %d, constraint = %s\n", + +1763 +c +,(cÚ¡ *) +‹¡_»l +. +´št_fÜmuÏ_to_¡ršg +()); + +1765  + g‹¡_»l +; + +1767  +EQ_I‹¿tÜ + +E +( +s_cÚj +); + gE +; E++) { + +1768 +as£¹ +( +liáTo + >= 1); + +1769  + gpos + = +max +((* +E +). +max_tu¶e_pos +(), +max_fs_¬™y +(*E)+1); + +1773 ià((* + gE +). +has_wždÿrds +(è&& + gpos + < + gliáTo +) { + +1774 +R–©iÚ + +‹¡_»l +( +r +. +n_£t +()); + +1775 + g‹¡_»l +. +ªd_w™h_EQ +(* +E +); + +1776  + g‹¡_»l +; + +1778 ià(!(* + gE +). +has_wždÿrds +(è&& + gpos + <ð +liáTo +) { + +1779 +R–©iÚ + +‹¡_»l +( +r +. +n_£t +()); + +1780 + g‹¡_»l +. +ªd_w™h_EQ +(* +E +); + +1781 + g‹¡_»l +. +sim¶ify +(); + +1782 + g‹¡_»l + = +EQs_to_GEQs +( +‹¡_»l +, +Œue +); + +1783  +pickOv”h—d +( +‹¡_»l +, +liáTo +); + +1786 ià( + gcode_g’_debug +>1) { + +1787 +årštf +( +DebugFže +,"Could‚ot find overhead:\n"); + +1788 + gr +. +´efix_´št +( +DebugFže +); + +1790  + gR–©iÚ +:: +True +( +r +. +n_£t +()); + +1795 +boÞ + +hasBound +( +R–©iÚ + +r +,  +Ëv– +,  +UB +) { + +1796 + gr +. +sim¶ify +(); + +1797 +V¬ŸbË_ID + + gv + = +£t_v¬ +( +Ëv– +); + +1798 +CÚjunù + * + gs_cÚj + = +r +. +sšgË_cÚjunù +(); + +1799  +GEQ_I‹¿tÜ + +G +( +s_cÚj +); + gG +; G++) { + +1800 ià( + gUB + && (* + gG +). +g‘_cÛf +( +v +è< 0è + gŒue +; + +1801 ià(! + gUB + && (* + gG +). +g‘_cÛf +( +v +è> 0è + gŒue +; + +1803  +EQ_I‹¿tÜ + +E +( +s_cÚj +); + gE +; E++) { + +1804 ià((* + gE +). +g‘_cÛf +( +v +)è + gŒue +; + +1806  + gçl£ +; + +1809 +boÞ + +fšd_ªy_cÚ¡¿št +( +s +,  +Ëv– +, +R–©iÚ + & +kr +,  +dœeùiÚ +, + +1810 +R–©iÚ + & +S +, +boÞ + +­´ox +) { + +1816 +R–©iÚ + + gI + = +´ojeùed_nIS +[ +Ëv– +][ +s +]; + +1817 + gI + = +Gi¡ +( +I +, +cÝy +( +kr +)); + +1818 if( + g­´ox +è + gI + = +Aµroxim©e +( +I +); + +1819 ià( +hasBound +( +I +, +Ëv– +, +dœeùiÚ +)) { + +1820 +R–©iÚ + + gpickäom +; + +1821 if( +has_nÚ¡ride_EQ +( +I +, +Ëv– +)) + +1822 + gpickäom + = +pickEQ +( +I +, +Ëv– +); + +1824 + gpickäom + = +pickBound +( +I +, +Ëv– +, +dœeùiÚ +); + +1825 + gS + = +pickOv”h—d +( +pickäom +, +Ëv– +); + +1826 if( + gS +. +is_obvious_utÞogy +()èS = +R–©iÚ +:: +NuÎ +(); + +1827  ! + gS +. +is_nuÎ +(); + +1829  + gçl£ +; + +1833 +boÞ + +has_nÚ¡ride_EQ +( +R–©iÚ + +r +,  +Ëv– +) { + +1834 + gr +. +sim¶ify +(); + +1835 +V¬ŸbË_ID + + gv + = +£t_v¬ +( +Ëv– +); + +1836 +CÚjunù + * + gs_cÚj + = +r +. +sšgË_cÚjunù +(); + +1837  +EQ_I‹¿tÜ + +G +( +s_cÚj +); + gG +; G++) + +1838 ià((* + gG +). +g‘_cÛf +( +v +è&& !(*G). +has_wždÿrds +()) + +1839  + gŒue +; + +1840  + gçl£ +; + +1844 +R–©iÚ + +mšMaxOv”h—d +(R–©iÚ +r +,  +Ëv– +) { + +1845 + gr +. +fš®ize +(); + +1846 + gr +. +sim¶ify +(); + +1847 +CÚjunù + * + gs_cÚj + = +r +. +sšgË_cÚjunù +(); + +1848 +GEQ_HªdË + + gLBs +[50], + gUBs +[50]; + +1849  + gnumLBs + = 0; + +1850  + gnumUBs + = 0; + +1851 +V¬ŸbË_ID + + gv + = +£t_v¬ +( +Ëv– +); + +1852  +GEQ_I‹¿tÜ + +G +( +s_cÚj +); + gG +; G++èià((*G). +g‘_cÛf +( +v +)) { + +1853 +GEQ_HªdË + + gg + = * +G +; + +1854 ià( + gg +. +g‘_cÛf +( +v +è> 0è + gLBs +[ +numLBs +++] = +g +; + +1855 + gUBs +[ +numUBs +++] = +g +; + +1857 ià( + gnumLBs + <ð1 && +numUBs + <= 1) { + +1858  +R–©iÚ +:: +True +( +r +. +n_£t +()); + +1860 +R–©iÚ + +r1 +( +r +. +n_£t +()); + +1861 +R–©iÚ + +r2 +( +r +. +n_£t +()); + +1862 ià( + gnumLBs + > 1) { + +1864 + gr1 +. +ªd_w™h_GEQ +( +LBs +[0]); + +1865 + gr2 +. +ªd_w™h_GEQ +( +LBs +[1]); + +1866 + gr1 + = +´ojeù_Úto_Ëv–s +( +Difã»nû +( +r1 +, +r2 +), +Ëv– +-1,0); + +1870 + gr1 +. +ªd_w™h_GEQ +( +UBs +[0]); + +1871 + gr2 +. +ªd_w™h_GEQ +( +UBs +[1]); + +1872 + gr1 + = +´ojeù_Úto_Ëv–s +( +Difã»nû +( +r1 +, +r2 +), +Ëv– +-1,0); + +1875 +årštf +( +DebugFže +,"Te¡šg %s\n",(cÚ¡ *) +r1 +. +´št_fÜmuÏ_to_¡ršg +()); + +1876 +årštf +( +DebugFže +,"wžÈ»moved ov”h—d oÀbound oàt%d: %s\n", +Ëv– +, + +1877 (cÚ¡ *) +r +. +´št_fÜmuÏ_to_¡ršg +()); + +1880  +pickOv”h—d +( +r1 +, -1); + +1883 + g¡d +:: +·œ +< +EQ_HªdË +, > +fšd_sim¶e¡_assignm’t +(cÚ¡ +R–©iÚ + & +R_ +, +V¬ŸbË_ID + +v +, cÚ¡ +¡d +:: +veùÜ +< +CG_ouutR•r + *> & +assigÃd_Ú_the_æy +) { + +1884 +R–©iÚ + & +R + = +cÚ¡_ÿ¡ +( +R_ +); + +1885 +CÚjunù + * + gc + = +R +. +sšgË_cÚjunù +(); + +1887  + gmš_co¡ + = +INT_MAX +; + +1888 +EQ_HªdË + + geq +; + +1889  +EQ_I‹¿tÜ + +ei +( +c +-> +EQs +()); + gei +;ƒi++) + +1890 ià(!(* + gei +). +has_wždÿrds +(è&& (*ei). +g‘_cÛf +( +v +) != 0) { + +1891  +co¡ + = 0; + +1893 ià( +abs +((* +ei +). +g‘_cÛf +( +v +)) != 1) + +1894 +co¡ + += 4; + +1896  + gnum_v¬ + = 0; + +1897  +CÚ¡r_V¬s_I‹r + +cvi +(* +ei +); + gcvi +; cvi++) + +1898 ià((* + gcvi +). + gv¬ + !ð +v +) { + +1899 +num_v¬ +++; + +1900 ià((* + gcvi +). + gv¬ +-> +kšd +(è=ð +Glob®_V¬ + && (* +cvi +). +v¬ +-> +g‘_glob®_v¬ +()-> +¬™y +() > 0) { + +1901 +co¡ + += 10; + +1903 ià( +abs +((* +cvi +). +cÛf +) != 1) + +1904 +co¡ + += 2; + +1905 ià((* + gcvi +). + gv¬ +-> +kšd +(è=ð +IÅut_V¬ + && +assigÃd_Ú_the_æy +[(* +cvi +). +v¬ +-> +g‘_pos™iÚ +()-1] !ð +NULL +) { + +1906 +co¡ + += 5; + +1909 ià((* + gei +). +g‘_cÚ¡ +() != 0) + +1910 +num_v¬ +++; + +1911 ià( + gnum_v¬ + > 1) + +1912 + gco¡ + +ð +num_v¬ + - 1; + +1914 ià( + gco¡ + < + gmš_co¡ +) { + +1915 + gmš_co¡ + = +co¡ +; + +1916 + geq + = * +ei +; + +1920  + g¡d +:: +make_·œ +( +eq +, +mš_co¡ +); + +1923  +max_fs_¬™y +(cÚ¡ +CÚ¡¿št_HªdË + & +c +) { + +1924  + gmax_¬™y +=0; + +1925  +CÚ¡r_V¬s_I‹r + +cv +( +c +); + gcv +; cv++) + +1926 if((* + gcv +). + gv¬ +-> +kšd +(è=ð +Glob®_V¬ +) + +1927 +max_¬™y + = +max +(max_¬™y,(* +cv +). +v¬ +-> +g‘_glob®_v¬ +()-> +¬™y +()); + +1928  + gmax_¬™y +; + + @/usr/include/math.h + +25 #iâdef +_MATH_H + + +26  + #_MATH_H + 1 + + ) + +28  + ~<ã©u»s.h +> + +30 + g__BEGIN_DECLS + + +34  + ~ + +35 #ifdeà +__USE_ISOC99 + + +36  + ~ + +37  + ~ + +40  + ~ + +43  + ~ + +47  + ~ + +54  + #__MATHCALL +( +funùiÚ +, +suffix +, +¬gs +) \ + +55 + `__MATHDECL + ( +_MdoubË_ +, +funùiÚ +, +suffix +, +¬gs +) + + ) + +56  + #__MATHDECL +( +ty³ +, +funùiÚ +, +suffix +, +¬gs +) \ + +57 + `__MATHDECL_1 +( +ty³ +, +funùiÚ +, +suffix +, +¬gs +); \ + +58 + `__MATHDECL_1 +( +ty³ +, + `__CONCAT +( +__ +, +funùiÚ +), +suffix +, +¬gs +) + + ) + +59  + #__MATHCALLX +( +funùiÚ +, +suffix +, +¬gs +, +©Œib +) \ + +60 + `__MATHDECLX + ( +_MdoubË_ +, +funùiÚ +, +suffix +, +¬gs +, +©Œib +) + + ) + +61  + #__MATHDECLX +( +ty³ +, +funùiÚ +, +suffix +, +¬gs +, +©Œib +) \ + +62 + `__MATHDECL_1 +( +ty³ +, +funùiÚ +, +suffix +, +¬gs +è + `__©Œibu‹__ + ( +©Œib +); \ + +63 + `__MATHDECL_1 +( +ty³ +, + `__CONCAT +( +__ +, +funùiÚ +), +suffix +, +¬gs +è + `__©Œibu‹__ + ( +©Œib +) + + ) + +64  + #__MATHDECL_1 +( +ty³ +, +funùiÚ +, +suffix +, +¬gs +) \ + +65 +ty³ + + `__MATH_PRECNAME +( +funùiÚ +, +suffix +è +¬gs + +__THROW + + + ) + +67  + #_MdoubË_ +  + + ) + +68  + #__MATH_PRECNAME +( +Çme +, +r +è + `__CONCAT +Òame,r) + + ) + +69  + #_MdoubË_BEGIN_NAMESPACE + +__BEGIN_NAMESPACE_STD + + + ) + +70  + #_MdoubË_END_NAMESPACE + +__END_NAMESPACE_STD + + + ) + +71  + ~ + +72 #undeà +_MdoubË_ + + +73 #undeà +_MdoubË_BEGIN_NAMESPACE + + +74 #undeà +_MdoubË_END_NAMESPACE + + +75 #undeà +__MATH_PRECNAME + + +77 #ià +defšed + +__USE_MISC + || defšed +__USE_ISOC99 + + +83 #iâdeà +_Mæßt_ + + +84  + #_Mæßt_ +  + + ) + +86  + #_MdoubË_ + +_Mæßt_ + + + ) + +87 #ifdeà +__STDC__ + + +88  + #__MATH_PRECNAME +( +Çme +, +r +èÇme## +f +## + ) +r + +90  + #__MATH_PRECNAME +( +Çme +, +r +èÇm +f + + ) +r + +92  + #_MdoubË_BEGIN_NAMESPACE + +__BEGIN_NAMESPACE_C99 + + + ) + +93  + #_MdoubË_END_NAMESPACE + +__END_NAMESPACE_C99 + + + ) + +94  + ~ + +95 #undeà +_MdoubË_ + + +96 #undeà +_MdoubË_BEGIN_NAMESPACE + + +97 #undeà +_MdoubË_END_NAMESPACE + + +98 #undeà +__MATH_PRECNAME + + +100 #ià( +__STDC__ + - 0 || +__GNUC__ + - 0) \ + +101 && (! +defšed + +__NO_LONG_DOUBLE_MATH + \ + +102 || +defšed + +__LDBL_COMPAT + \ + +103 || ! +defšed + +_LIBC +) + +104 #ifdeà +__LDBL_COMPAT + + +106 #ifdeà +__USE_ISOC99 + + +107  + $__Ædbl_Ãx‰ow¬df + ( +__x +,  +__y +) + +108 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +109 #ifdeà +__REDIRECT_NTH + + +110  + `__REDIRECT_NTH + ( +Ãx‰ow¬df +, ( +__x +,  +__y +), + +111 +__Ædbl_Ãx‰ow¬df +) + +112 + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +113  + `__REDIRECT_NTH + ( +Ãx‰ow¬d +, ( +__x +,  +__y +), + +114 +Ãxá” +è + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +115  + `__REDIRECT_NTH + ( +Ãx‰ow¬dl +, + +116 ( +__x +,  +__y +), + +117 +Ãxá” +è + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +122 #ià +defšed + +__LDBL_COMPAT + || defšed +__NO_LONG_DOUBLE_MATH + + +124 #undeà +__MATHDECL_1 + + +125  + #__MATHDECL_2 +( +ty³ +, +funùiÚ +, +suffix +, +¬gs +, +®Ÿs +) \ + +126 +ty³ + + `__REDIRECT_NTH +( + `__MATH_PRECNAME +( +funùiÚ +, +suffix +), \ + +127 +¬gs +, +®Ÿs +) + + ) + +128  + #__MATHDECL_1 +( +ty³ +, +funùiÚ +, +suffix +, +¬gs +) \ + +129 + `__MATHDECL_2 +( +ty³ +, +funùiÚ +, +suffix +, +¬gs +, + `__CONCAT +(funùiÚ,suffix)) + + ) + +134 #iâdeà +_MlÚg_doubË_ + + +135  + #_MlÚg_doubË_ +  + + ) + +137  + #_MdoubË_ + +_MlÚg_doubË_ + + + ) + +138 #ifdeà +__STDC__ + + +139  + #__MATH_PRECNAME +( +Çme +, +r +èÇme## +l +## + ) +r + +141  + #__MATH_PRECNAME +( +Çme +, +r +èÇm +l + + ) +r + +143  + #_MdoubË_BEGIN_NAMESPACE + +__BEGIN_NAMESPACE_C99 + + + ) + +144  + #_MdoubË_END_NAMESPACE + +__END_NAMESPACE_C99 + + + ) + +145  + ~ + +146 #undeà +_MdoubË_ + + +147 #undeà +_MdoubË_BEGIN_NAMESPACE + + +148 #undeà +_MdoubË_END_NAMESPACE + + +149 #undeà +__MATH_PRECNAME + + +154 #undeà +__MATHDECL_1 + + +155 #undeà +__MATHDECL + + +156 #undeà +__MATHCALL + + +159 #ià +defšed + +__USE_MISC + || defšed +__USE_XOPEN + + +161  +signgam +; + +166 #ifdeà +__USE_ISOC99 + + +204 +FP_NAN +, + +205  + #FP_NAN + +FP_NAN + + + ) + +206 +FP_INFINITE +, + +207  + #FP_INFINITE + +FP_INFINITE + + + ) + +208 +FP_ZERO +, + +209  + #FP_ZERO + +FP_ZERO + + + ) + +210 +FP_SUBNORMAL +, + +211  + #FP_SUBNORMAL + +FP_SUBNORMAL + + + ) + +212 +FP_NORMAL + + +213  + #FP_NORMAL + +FP_NORMAL + + + ) + +217 #ifdeà +__NO_LONG_DOUBLE_MATH + + +218  + #åþassify +( +x +) \ + +219 ( ( +x +è=ð (è? + `__åþassifyf + (xè: + `__åþassify + (x)) + + ) + +221  + #åþassify +( +x +) \ + +222 ( ( +x +) ==  () \ + +223 ? + `__åþassifyf + ( +x +) \ + +224 :  ( +x +) ==  () \ + +225 ? + `__åþassify + ( +x +è: + `__åþassifyl + (x)) + + ) + +229 #ifdeà +__NO_LONG_DOUBLE_MATH + + +230  + #signb™ +( +x +) \ + +231 ( ( +x +è=ð (è? + `__signb™f + (xè: + `__signb™ + (x)) + + ) + +233  + #signb™ +( +x +) \ + +234 ( ( +x +) ==  () \ + +235 ? + `__signb™f + ( +x +) \ + +236 :  ( +x +) ==  () \ + +237 ? + `__signb™ + ( +x +è: + `__signb™l + (x)) + + ) + +241 #ifdeà +__NO_LONG_DOUBLE_MATH + + +242  + #isfš™e +( +x +) \ + +243 ( ( +x +è=ð (è? + `__fš™ef + (xè: + `__fš™e + (x)) + + ) + +245  + #isfš™e +( +x +) \ + +246 ( ( +x +) ==  () \ + +247 ? + `__fš™ef + ( +x +) \ + +248 :  ( +x +) ==  () \ + +249 ? + `__fš™e + ( +x +è: + `__fš™– + (x)) + + ) + +253  + #i¢Üm® +( +x +è( + `åþassify + (xè=ð +FP_NORMAL +) + + ) + +257 #ifdeà +__NO_LONG_DOUBLE_MATH + + +258  + #i¢ª +( +x +) \ + +259 ( ( +x +è=ð (è? + `__i¢ªf + (xè: + `__i¢ª + (x)) + + ) + +261  + #i¢ª +( +x +) \ + +262 ( ( +x +) ==  () \ + +263 ? + `__i¢ªf + ( +x +) \ + +264 :  ( +x +) ==  () \ + +265 ? + `__i¢ª + ( +x +è: + `__i¢ªl + (x)) + + ) + +269 #ifdeà +__NO_LONG_DOUBLE_MATH + + +270  + #isšf +( +x +) \ + +271 ( ( +x +è=ð (è? + `__isšff + (xè: + `__isšf + (x)) + + ) + +273  + #isšf +( +x +) \ + +274 ( ( +x +) ==  () \ + +275 ? + `__isšff + ( +x +) \ + +276 :  ( +x +) ==  () \ + +277 ? + `__isšf + ( +x +è: + `__isšæ + (x)) + + ) + +281  + #MATH_ERRNO + 1 + + ) + +282  + #MATH_ERREXCEPT + 2 + + ) + +287 #iâdeà +__FAST_MATH__ + + +288  + #m©h_”rhªdlšg + ( +MATH_ERRNO + | +MATH_ERREXCEPT +) + + ) + +293 #ifdef +__USE_MISC + + +297 +_IEEE_ + = -1, + +298 +_SVID_ +, + +299 +_XOPEN_ +, + +300 +_POSIX_ +, + +301 +_ISOC_ + + +302 } + t_LIB_VERSION_TYPE +; + +307 +_LIB_VERSION_TYPE + +_LIB_VERSION +; + +311 #ifdeà +__USE_SVID + + +317 #ifdeà +__ýlu¥lus + + +318  +__exû±iÚ + + +320  +exû±iÚ + + +323  +ty³ +; + +324 * +Çme +; + +325  +¬g1 +; + +326  +¬g2 +; + +327  +»tv® +; + +328 + } +}; + +330 #ifdeà +__ýlu¥lus + + +331  + $m©h”r + ( +__exû±iÚ + * +__exc +è + `throw + (); + +333  + `m©h”r + ( +exû±iÚ + * +__exc +); + +336  + #X_TLOSS + 1.41484755040568800000e+16 + + ) + +339  + #DOMAIN + 1 + + ) + +340  + #SING + 2 + + ) + +341  + #OVERFLOW + 3 + + ) + +342  + #UNDERFLOW + 4 + + ) + +343  + #TLOSS + 5 + + ) + +344  + #PLOSS + 6 + + ) + +347  + #HUGE + 3.40282347e+38F + + ) + +351 #ifdeà +__USE_XOPEN + + +353  + #MAXFLOAT + 3.40282347e+38F + + ) + +360 #ià +defšed + +__USE_BSD + || defšed +__USE_XOPEN + + +361  + #M_E + 2.7182818284590452354 + + ) + +362  + #M_LOG2E + 1.4426950408889634074 + + ) + +363  + #M_LOG10E + 0.43429448190325182765 + + ) + +364  + #M_LN2 + 0.69314718055994530942 + + ) + +365  + #M_LN10 + 2.30258509299404568402 + + ) + +366  + #M_PI + 3.14159265358979323846 + + ) + +367  + #M_PI_2 + 1.57079632679489661923 + + ) + +368  + #M_PI_4 + 0.78539816339744830962 + + ) + +369  + #M_1_PI + 0.31830988618379067154 + + ) + +370  + #M_2_PI + 0.63661977236758134308 + + ) + +371  + #M_2_SQRTPI + 1.12837916709551257390 + + ) + +372  + #M_SQRT2 + 1.41421356237309504880 + + ) + +373  + #M_SQRT1_2 + 0.70710678118654752440 + + ) + +379 #ifdeà +__USE_GNU + + +380  + #M_El + 2.7182818284590452353602874713526625L + + ) + +381  + #M_LOG2El + 1.4426950408889634073599246810018921L + + ) + +382  + #M_LOG10El + 0.4342944819032518276511289189166051L + + ) + +383  + #M_LN2l + 0.6931471805599453094172321214581766L + + ) + +384  + #M_LN10l + 2.3025850929940456840179914546843642L + + ) + +385  + #M_PIl + 3.1415926535897932384626433832795029L + + ) + +386  + #M_PI_2l + 1.5707963267948966192313216916397514L + + ) + +387  + #M_PI_4l + 0.7853981633974483096156608458198757L + + ) + +388  + #M_1_PIl + 0.3183098861837906715377675267450287L + + ) + +389  + #M_2_PIl + 0.6366197723675813430755350534900574L + + ) + +390  + #M_2_SQRTPIl + 1.1283791670955125738961589031215452L + + ) + +391  + #M_SQRT2l + 1.4142135623730950488016887242096981L + + ) + +392  + #M_SQRT1_2l + 0.7071067811865475244008443621048490L + + ) + +399 #ià +defšed + +__STRICT_ANSI__ + && !defšed +__NO_MATH_INLINES + + +400  + #__NO_MATH_INLINES + 1 + + ) + +403 #ià +defšed + +__USE_ISOC99 + && + `__GNUC_PREREQ +(2,97) + +410  + #isg»©” +( +x +, +y +è + `__bužtš_isg»©” +(x, y) + + ) + +411  + #isg»©”equ® +( +x +, +y +è + `__bužtš_isg»©”equ® +(x, y) + + ) + +412  + #i¦ess +( +x +, +y +è + `__bužtš_i¦ess +(x, y) + + ) + +413  + #i¦es£qu® +( +x +, +y +è + `__bužtš_i¦es£qu® +(x, y) + + ) + +414  + #i¦essg»©” +( +x +, +y +è + `__bužtš_i¦essg»©” +(x, y) + + ) + +415  + #isunÜd”ed +( +u +, +v +è + `__bužtš_isunÜd”ed +(u, v) + + ) + +419 #ifdeà +__USE_EXTERN_INLINES + + +420  + ~ + +423 #ifdeà +__USE_ISOC99 + + +427 #iâdeà +isg»©” + + +428  + #isg»©” +( +x +, +y +) \ + +429 ( +__ex‹nsiÚ__ + \ + +430 ({ + `__ty³of__ +( +x +è +__x + = (x); __ty³of__( +y +è +__y + = (y); \ + +431 ! + `isunÜd”ed + ( +__x +, +__y +è&& __x > __y; + } +})) + + ) + +435 #iâdeà +isg»©”equ® + + +436  + #isg»©”equ® +( +x +, +y +) \ + +437 ( +__ex‹nsiÚ__ + \ + +438 ({ + `__ty³of__ +( +x +è +__x + = (x); __ty³of__( +y +è +__y + = (y); \ + +439 ! + `isunÜd”ed + ( +__x +, +__y +è&& __x >ð__y; })) + + ) + +443 #iâdeà +i¦ess + + +444  + #i¦ess +( +x +, +y +) \ + +445 ( +__ex‹nsiÚ__ + \ + +446 ({ + `__ty³of__ +( +x +è +__x + = (x); __ty³of__( +y +è +__y + = (y); \ + +447 ! + `isunÜd”ed + ( +__x +, +__y +è&& __x < __y; })) + + ) + +451 #iâdeà +i¦es£qu® + + +452  + #i¦es£qu® +( +x +, +y +) \ + +453 ( +__ex‹nsiÚ__ + \ + +454 ({ + `__ty³of__ +( +x +è +__x + = (x); __ty³of__( +y +è +__y + = (y); \ + +455 ! + `isunÜd”ed + ( +__x +, +__y +è&& __x <ð__y; })) + + ) + +459 #iâdeà +i¦essg»©” + + +460  + #i¦essg»©” +( +x +, +y +) \ + +461 ( +__ex‹nsiÚ__ + \ + +462 ({ + `__ty³of__ +( +x +è +__x + = (x); __ty³of__( +y +è +__y + = (y); \ + +463 ! + `isunÜd”ed + ( +__x +, +__y +è&& (__x < __y || __y < __x); })) + + ) + +467 #iâdeà +isunÜd”ed + + +468  + #isunÜd”ed +( +u +, +v +) \ + +469 ( +__ex‹nsiÚ__ + \ + +470 ({ + `__ty³of__ +( +u +è +__u + = (u); __ty³of__( +v +è +__v + = (v); \ + +471 + `åþassify + ( +__u +è=ð +FP_NAN + || fpþassify ( +__v +è=ðFP_NAN; })) + + ) + +476 + g__END_DECLS + + + @/usr/include/stdio.h + +24 #iâdeà +_STDIO_H + + +26 #ià! +defšed + +__Ãed_FILE + && !defšed +__Ãed___FILE + + +27  + #_STDIO_H + 1 + + ) + +28  + ~<ã©u»s.h +> + +30 + g__BEGIN_DECLS + + +32  + #__Ãed_size_t + + + ) + +33  + #__Ãed_NULL + + + ) + +34  + ~<¡ddef.h +> + +36  + ~ + +37  + #__Ãed_FILE + + + ) + +38  + #__Ãed___FILE + + + ) + +42 #ià! +defšed + +__FILE_defšed + && defšed +__Ãed_FILE + + +45  + g_IO_FILE +; + +47 +__BEGIN_NAMESPACE_STD + + +49  +_IO_FILE + + tFILE +; + +50 + g__END_NAMESPACE_STD + + +51 #ià +defšed + +__USE_LARGEFILE64 + || defšed +__USE_SVID + || defšed +__USE_POSIX + \ + +52 || +defšed + + g__USE_BSD + || defšed + g__USE_ISOC99 + || defšed + g__USE_XOPEN + \ + +53 || +defšed + +__USE_POSIX2 + + +54 + $__USING_NAMESPACE_STD +( +FILE +) + +57  + #__FILE_defšed + 1 + + ) + +59 #undeà +__Ãed_FILE + + +62 #ià! +defšed + +____FILE_defšed + && defšed +__Ãed___FILE + + +65  +_IO_FILE + + t__FILE +; + +67  + #____FILE_defšed + 1 + + ) + +69 #undeà +__Ãed___FILE + + +72 #ifdef +_STDIO_H + + +73  + #_STDIO_USES_IOSTREAM + + + ) + +75  + ~ + +77 #ifdeà +__USE_XOPEN + + +78 #ifdeà +__GNUC__ + + +79 #iâdeà +_VA_LIST_DEFINED + + +80  +_G_va_li¡ + + tva_li¡ +; + +81  + #_VA_LIST_DEFINED + + + ) + +84  + ~<¡d¬g.h +> + +89 +__BEGIN_NAMESPACE_STD + + +90 #iâdeà +__USE_FILE_OFFSET64 + + +91  +_G_åos_t + + tåos_t +; + +93  +_G_åos64_t + + tåos_t +; + +95 +__END_NAMESPACE_STD + + +96 #ifdeà +__USE_LARGEFILE64 + + +97  +_G_åos64_t + + tåos64_t +; + +101  + #_IOFBF + 0 + + ) + +102  + #_IOLBF + 1 + + ) + +103  + #_IONBF + 2 + + ) + +107 #iâdeà +BUFSIZ + + +108  + #BUFSIZ + +_IO_BUFSIZ + + + ) + +114 #iâdeà +EOF + + +115  + #EOF + (-1) + + ) + +121  + #SEEK_SET + 0 + + ) + +122  + #SEEK_CUR + 1 + + ) + +123  + #SEEK_END + 2 + + ) + +126 #ià +defšed + +__USE_SVID + || defšed +__USE_XOPEN + + +128  + #P_tmpdœ + "/tmp" + + ) + +141  + ~ + +145  +_IO_FILE + * +¡dš +; + +146  +_IO_FILE + * +¡dout +; + +147  +_IO_FILE + * +¡d”r +; + +149  + #¡dš + +¡dš + + + ) + +150  + #¡dout + +¡dout + + + ) + +151  + #¡d”r + +¡d”r + + + ) + +153 +__BEGIN_NAMESPACE_STD + + +155  + $»move + ( +__cÚ¡ + * +__fž’ame +è +__THROW +; + +157  + $»Çme + ( +__cÚ¡ + * +__Þd +, __cÚ¡ * +__Ãw +è +__THROW +; + +158 +__END_NAMESPACE_STD + + +160 #ifdeà +__USE_ATFILE + + +162  + $»Çm—t + ( +__Þdfd +, +__cÚ¡ + * +__Þd +,  +__Ãwfd +, + +163 +__cÚ¡ + * +__Ãw +è +__THROW +; + +166 +__BEGIN_NAMESPACE_STD + + +171 #iâdeà +__USE_FILE_OFFSET64 + + +172 +FILE + * + $tmpfže + (è +__wur +; + +174 #ifdeà +__REDIRECT + + +175 +FILE + * + `__REDIRECT + ( +tmpfže +, (), +tmpfže64 +è +__wur +; + +177  + #tmpfže + +tmpfže64 + + + ) + +181 #ifdeà +__USE_LARGEFILE64 + + +182 +FILE + * + $tmpfže64 + (è +__wur +; + +186 * + $tm²am + (* +__s +è +__THROW + +__wur +; + +187 +__END_NAMESPACE_STD + + +189 #ifdeà +__USE_MISC + + +192 * + $tm²am_r + (* +__s +è +__THROW + +__wur +; + +196 #ià +defšed + +__USE_SVID + || defšed +__USE_XOPEN + + +204 * + $‹m²am + ( +__cÚ¡ + * +__dœ +, __cÚ¡ * +__pfx +) + +205 +__THROW + +__©Œibu‹_m®loc__ + +__wur +; + +209 +__BEGIN_NAMESPACE_STD + + +214  + `fþo£ + ( +FILE + * +__¡»am +); + +219  + `fæush + ( +FILE + * +__¡»am +); + +220 +__END_NAMESPACE_STD + + +222 #ifdeà +__USE_MISC + + +229  + `fæush_uÆocked + ( +FILE + * +__¡»am +); + +232 #ifdeà +__USE_GNU + + +239  + `fþo£®l + (); + +243 +__BEGIN_NAMESPACE_STD + + +244 #iâdeà +__USE_FILE_OFFSET64 + + +249 +FILE + * + $fÝ’ + ( +__cÚ¡ + * +__»¡riù + +__fž’ame +, + +250 +__cÚ¡ + * +__»¡riù + +__modes +è +__wur +; + +255 +FILE + * + $äeÝ’ + ( +__cÚ¡ + * +__»¡riù + +__fž’ame +, + +256 +__cÚ¡ + * +__»¡riù + +__modes +, + +257 +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +259 #ifdeà +__REDIRECT + + +260 +FILE + * + `__REDIRECT + ( +fÝ’ +, ( +__cÚ¡ + * +__»¡riù + +__fž’ame +, + +261 +__cÚ¡ + * +__»¡riù + +__modes +), +fÝ’64 +) + +262 +__wur +; + +263 +FILE + * + `__REDIRECT + ( +äeÝ’ +, ( +__cÚ¡ + * +__»¡riù + +__fž’ame +, + +264 +__cÚ¡ + * +__»¡riù + +__modes +, + +265 +FILE + * +__»¡riù + +__¡»am +), +äeÝ’64 +) + +266 +__wur +; + +268  + #fÝ’ + +fÝ’64 + + + ) + +269  + #äeÝ’ + +äeÝ’64 + + + ) + +272 +__END_NAMESPACE_STD + + +273 #ifdeà +__USE_LARGEFILE64 + + +274 +FILE + * + $fÝ’64 + ( +__cÚ¡ + * +__»¡riù + +__fž’ame +, + +275 +__cÚ¡ + * +__»¡riù + +__modes +è +__wur +; + +276 +FILE + * + $äeÝ’64 + ( +__cÚ¡ + * +__»¡riù + +__fž’ame +, + +277 +__cÚ¡ + * +__»¡riù + +__modes +, + +278 +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +281 #ifdef +__USE_POSIX + + +283 +FILE + * + $fdÝ’ + ( +__fd +, +__cÚ¡ + * +__modes +è +__THROW + +__wur +; + +286 #ifdef +__USE_GNU + + +289 +FILE + * + $fÝ’cook› + (* +__»¡riù + +__magic_cook› +, + +290 +__cÚ¡ + * +__»¡riù + +__modes +, + +291 +_IO_cook›_io_funùiÚs_t + +__io_funcs +è +__THROW + +__wur +; + +294 #ifdeà +__USE_XOPEN2K8 + + +296 +FILE + * + $fmemÝ’ + (* +__s +, +size_t + +__Ën +, +__cÚ¡ + * +__modes +) + +297 +__THROW + +__wur +; + +302 +FILE + * + $Ý’_mem¡»am + (** +__buæoc +, +size_t + * +__siz–oc +è +__THROW + +__wur +; + +306 +__BEGIN_NAMESPACE_STD + + +309  + $£tbuf + ( +FILE + * +__»¡riù + +__¡»am +, *__»¡riù +__buf +è +__THROW +; + +313  + $£tvbuf + ( +FILE + * +__»¡riù + +__¡»am +, *__»¡riù +__buf +, + +314  +__modes +, +size_t + +__n +è +__THROW +; + +315 +__END_NAMESPACE_STD + + +317 #ifdef +__USE_BSD + + +320  + $£tbufãr + ( +FILE + * +__»¡riù + +__¡»am +, *__»¡riù +__buf +, + +321 +size_t + +__size +è +__THROW +; + +324  + $£Žšebuf + ( +FILE + * +__¡»am +è +__THROW +; + +328 +__BEGIN_NAMESPACE_STD + + +333  + `årštf + ( +FILE + * +__»¡riù + +__¡»am +, + +334 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...); + +339  + `´štf + ( +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...); + +341  + $¥rštf + (* +__»¡riù + +__s +, + +342 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...è +__THROW +; + +348  + `vårštf + ( +FILE + * +__»¡riù + +__s +, +__cÚ¡ + *__»¡riù +__fÜm© +, + +349 +_G_va_li¡ + +__¬g +); + +354  + `v´štf + ( +__cÚ¡ + * +__»¡riù + +__fÜm© +, +_G_va_li¡ + +__¬g +); + +356  + $v¥rštf + (* +__»¡riù + +__s +, +__cÚ¡ + *__»¡riù +__fÜm© +, + +357 +_G_va_li¡ + +__¬g +è +__THROW +; + +358 +__END_NAMESPACE_STD + + +360 #ià +defšed + +__USE_BSD + || defšed +__USE_ISOC99 + || defšed +__USE_UNIX98 + + +361 +__BEGIN_NAMESPACE_C99 + + +363  + $¢´štf + (* +__»¡riù + +__s +, +size_t + +__maxËn +, + +364 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...) + +365 +__THROW + + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__´štf__ +, 3, 4))); + +367  + $v¢´štf + (* +__»¡riù + +__s +, +size_t + +__maxËn +, + +368 +__cÚ¡ + * +__»¡riù + +__fÜm© +, +_G_va_li¡ + +__¬g +) + +369 +__THROW + + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__´štf__ +, 3, 0))); + +370 +__END_NAMESPACE_C99 + + +373 #ifdeà +__USE_GNU + + +376  + $va¥rštf + (** +__»¡riù + +__±r +, +__cÚ¡ + *__»¡riù +__f +, + +377 +_G_va_li¡ + +__¬g +) + +378 +__THROW + + `__©Œibu‹__ + (( + $__fÜm©__ + ( +__´štf__ +, 2, 0))è +__wur +; + +379  + $__a¥rštf + (** +__»¡riù + +__±r +, + +380 +__cÚ¡ + * +__»¡riù + +__fmt +, ...) + +381 +__THROW + + `__©Œibu‹__ + (( + $__fÜm©__ + ( +__´štf__ +, 2, 3))è +__wur +; + +382  + $a¥rštf + (** +__»¡riù + +__±r +, + +383 +__cÚ¡ + * +__»¡riù + +__fmt +, ...) + +384 +__THROW + + `__©Œibu‹__ + (( + $__fÜm©__ + ( +__´štf__ +, 2, 3))è +__wur +; + +387 #ifdeà +__USE_XOPEN2K8 + + +394  + $vd´štf + ( +__fd +, +__cÚ¡ + * +__»¡riù + +__fmt +, + +395 +_G_va_li¡ + +__¬g +) + +396 + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__´štf__ +, 2, 0))); + +397  + $d´štf + ( +__fd +, +__cÚ¡ + * +__»¡riù + +__fmt +, ...) + +398 + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__´štf__ +, 2, 3))); + +402 +__BEGIN_NAMESPACE_STD + + +407  + $fsÿnf + ( +FILE + * +__»¡riù + +__¡»am +, + +408 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...è +__wur +; + +413  + $sÿnf + ( +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...è +__wur +; + +415  + $ssÿnf + ( +__cÚ¡ + * +__»¡riù + +__s +, + +416 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...è +__THROW +; + +418 #ià +defšed + +__USE_ISOC99 + && !defšed +__USE_GNU + \ + +419 && (! +defšed + +__LDBL_COMPAT + || !defšed +__REDIRECT +) \ + +420 && ( +defšed + +__STRICT_ANSI__ + || defšed +__USE_XOPEN2K +) + +421 #ifdeà +__REDIRECT + + +425  + `__REDIRECT + ( +fsÿnf +, ( +FILE + * +__»¡riù + +__¡»am +, + +426 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...), + +427 +__isoc99_fsÿnf +è +__wur +; + +428  + `__REDIRECT + ( +sÿnf +, ( +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...), + +429 +__isoc99_sÿnf +è +__wur +; + +430  + `__REDIRECT + ( +ssÿnf +, ( +__cÚ¡ + * +__»¡riù + +__s +, + +431 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...), + +432 +__isoc99_ssÿnf +è +__THROW +; + +434  + $__isoc99_fsÿnf + ( +FILE + * +__»¡riù + +__¡»am +, + +435 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...è +__wur +; + +436  + $__isoc99_sÿnf + ( +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...è +__wur +; + +437  + $__isoc99_ssÿnf + ( +__cÚ¡ + * +__»¡riù + +__s +, + +438 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...è +__THROW +; + +439  + #fsÿnf + +__isoc99_fsÿnf + + + ) + +440  + #sÿnf + +__isoc99_sÿnf + + + ) + +441  + #ssÿnf + +__isoc99_ssÿnf + + + ) + +445 +__END_NAMESPACE_STD + + +447 #ifdef +__USE_ISOC99 + + +448 +__BEGIN_NAMESPACE_C99 + + +453  + $vfsÿnf + ( +FILE + * +__»¡riù + +__s +, +__cÚ¡ + *__»¡riù +__fÜm© +, + +454 +_G_va_li¡ + +__¬g +) + +455 + `__©Œibu‹__ + (( + $__fÜm©__ + ( +__sÿnf__ +, 2, 0))è +__wur +; + +461  + $vsÿnf + ( +__cÚ¡ + * +__»¡riù + +__fÜm© +, +_G_va_li¡ + +__¬g +) + +462 + `__©Œibu‹__ + (( + $__fÜm©__ + ( +__sÿnf__ +, 1, 0))è +__wur +; + +465  + $vssÿnf + ( +__cÚ¡ + * +__»¡riù + +__s +, + +466 +__cÚ¡ + * +__»¡riù + +__fÜm© +, +_G_va_li¡ + +__¬g +) + +467 +__THROW + + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__sÿnf__ +, 2, 0))); + +469 #ià! +defšed + +__USE_GNU + \ + +470 && (! +defšed + +__LDBL_COMPAT + || !defšed +__REDIRECT +) \ + +471 && ( +defšed + +__STRICT_ANSI__ + || defšed +__USE_XOPEN2K +) + +472 #ifdeà +__REDIRECT + + +476  + `__REDIRECT + ( +vfsÿnf +, + +477 ( +FILE + * +__»¡riù + +__s +, + +478 +__cÚ¡ + * +__»¡riù + +__fÜm© +, +_G_va_li¡ + +__¬g +), + +479 +__isoc99_vfsÿnf +) + +480 + `__©Œibu‹__ + (( + $__fÜm©__ + ( +__sÿnf__ +, 2, 0))è +__wur +; + +481  + `__REDIRECT + ( +vsÿnf +, ( +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +482 +_G_va_li¡ + +__¬g +), +__isoc99_vsÿnf +) + +483 + `__©Œibu‹__ + (( + $__fÜm©__ + ( +__sÿnf__ +, 1, 0))è +__wur +; + +484  + `__REDIRECT + ( +vssÿnf +, + +485 ( +__cÚ¡ + * +__»¡riù + +__s +, + +486 +__cÚ¡ + * +__»¡riù + +__fÜm© +, +_G_va_li¡ + +__¬g +), + +487 +__isoc99_vssÿnf +) + +488 +__THROW + + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__sÿnf__ +, 2, 0))); + +490  + $__isoc99_vfsÿnf + ( +FILE + * +__»¡riù + +__s +, + +491 +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +492 +_G_va_li¡ + +__¬g +è +__wur +; + +493  + $__isoc99_vsÿnf + ( +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +494 +_G_va_li¡ + +__¬g +è +__wur +; + +495  + $__isoc99_vssÿnf + ( +__cÚ¡ + * +__»¡riù + +__s +, + +496 +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +497 +_G_va_li¡ + +__¬g +è +__THROW +; + +498  + #vfsÿnf + +__isoc99_vfsÿnf + + + ) + +499  + #vsÿnf + +__isoc99_vsÿnf + + + ) + +500  + #vssÿnf + +__isoc99_vssÿnf + + + ) + +504 +__END_NAMESPACE_C99 + + +508 +__BEGIN_NAMESPACE_STD + + +513  + `fg‘c + ( +FILE + * +__¡»am +); + +514  + `g‘c + ( +FILE + * +__¡»am +); + +520  + `g‘ch¬ + (); + +521 +__END_NAMESPACE_STD + + +525  + #g‘c +( +_å +è + `_IO_g‘c + (_å) + + ) + +527 #ià +defšed + +__USE_POSIX + || defšed +__USE_MISC + + +532  + `g‘c_uÆocked + ( +FILE + * +__¡»am +); + +533  + `g‘ch¬_uÆocked + (); + +536 #ifdeà +__USE_MISC + + +543  + `fg‘c_uÆocked + ( +FILE + * +__¡»am +); + +547 +__BEGIN_NAMESPACE_STD + + +555  + `åutc + ( +__c +, +FILE + * +__¡»am +); + +556  + `putc + ( +__c +, +FILE + * +__¡»am +); + +562  + `putch¬ + ( +__c +); + +563 +__END_NAMESPACE_STD + + +567  + #putc +( +_ch +, +_å +è + `_IO_putc + (_ch, _å) + + ) + +569 #ifdeà +__USE_MISC + + +576  + `åutc_uÆocked + ( +__c +, +FILE + * +__¡»am +); + +579 #ià +defšed + +__USE_POSIX + || defšed +__USE_MISC + + +584  + `putc_uÆocked + ( +__c +, +FILE + * +__¡»am +); + +585  + `putch¬_uÆocked + ( +__c +); + +589 #ià +defšed + +__USE_SVID + || defšed +__USE_MISC + \ + +590 || ( +defšed + +__USE_XOPEN + && !defšed +__USE_XOPEN2K +) + +592  + `g‘w + ( +FILE + * +__¡»am +); + +595  + `putw + ( +__w +, +FILE + * +__¡»am +); + +599 +__BEGIN_NAMESPACE_STD + + +604 * + $fg‘s + (* +__»¡riù + +__s +,  +__n +, +FILE + *__»¡riù +__¡»am +) + +605 +__wur +; + +612 * + $g‘s + (* +__s +è +__wur +; + +613 +__END_NAMESPACE_STD + + +615 #ifdeà +__USE_GNU + + +622 * + $fg‘s_uÆocked + (* +__»¡riù + +__s +,  +__n +, + +623 +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +627 #ifdef +__USE_XOPEN2K8 + + +638 +_IO_ssize_t + + $__g‘d–im + (** +__»¡riù + +__lš•Œ +, + +639 +size_t + * +__»¡riù + +__n +,  +__d–im™” +, + +640 +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +641 +_IO_ssize_t + + $g‘d–im + (** +__»¡riù + +__lš•Œ +, + +642 +size_t + * +__»¡riù + +__n +,  +__d–im™” +, + +643 +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +651 +_IO_ssize_t + + $g‘lše + (** +__»¡riù + +__lš•Œ +, + +652 +size_t + * +__»¡riù + +__n +, + +653 +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +657 +__BEGIN_NAMESPACE_STD + + +662  + `åuts + ( +__cÚ¡ + * +__»¡riù + +__s +, +FILE + *__»¡riù +__¡»am +); + +668  + `puts + ( +__cÚ¡ + * +__s +); + +675  + `ung‘c + ( +__c +, +FILE + * +__¡»am +); + +682 +size_t + + $ä—d + (* +__»¡riù + +__±r +, +size_t + +__size +, + +683 +size_t + +__n +, +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +688 +size_t + + `fwr™e + ( +__cÚ¡ + * +__»¡riù + +__±r +, size_ˆ +__size +, + +689 +size_t + +__n +, +FILE + * +__»¡riù + +__s +); + +690 +__END_NAMESPACE_STD + + +692 #ifdeà +__USE_GNU + + +699  + `åuts_uÆocked + ( +__cÚ¡ + * +__»¡riù + +__s +, + +700 +FILE + * +__»¡riù + +__¡»am +); + +703 #ifdeà +__USE_MISC + + +710 +size_t + + $ä—d_uÆocked + (* +__»¡riù + +__±r +, +size_t + +__size +, + +711 +size_t + +__n +, +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +712 +size_t + + `fwr™e_uÆocked + ( +__cÚ¡ + * +__»¡riù + +__±r +, size_ˆ +__size +, + +713 +size_t + +__n +, +FILE + * +__»¡riù + +__¡»am +); + +717 +__BEGIN_NAMESPACE_STD + + +722  + `f£ek + ( +FILE + * +__¡»am +,  +__off +,  +__wh’û +); + +727  + $á–l + ( +FILE + * +__¡»am +è +__wur +; + +732  + `»wšd + ( +FILE + * +__¡»am +); + +733 +__END_NAMESPACE_STD + + +740 #ià +defšed + +__USE_LARGEFILE + || defšed +__USE_XOPEN2K + + +741 #iâdeà +__USE_FILE_OFFSET64 + + +746  + `f£eko + ( +FILE + * +__¡»am +, +__off_t + +__off +,  +__wh’û +); + +751 +__off_t + + $á–lo + ( +FILE + * +__¡»am +è +__wur +; + +753 #ifdeà +__REDIRECT + + +754  + `__REDIRECT + ( +f£eko +, + +755 ( +FILE + * +__¡»am +, +__off64_t + +__off +,  +__wh’û +), + +756 +f£eko64 +); + +757 +__off64_t + + `__REDIRECT + ( +á–lo +, ( +FILE + * +__¡»am +), +á–lo64 +); + +759  + #f£eko + +f£eko64 + + + ) + +760  + #á–lo + +á–lo64 + + + ) + +765 +__BEGIN_NAMESPACE_STD + + +766 #iâdeà +__USE_FILE_OFFSET64 + + +771  + `fg‘pos + ( +FILE + * +__»¡riù + +__¡»am +, +åos_t + *__»¡riù +__pos +); + +776  + `f£os + ( +FILE + * +__¡»am +, +__cÚ¡ + +åos_t + * +__pos +); + +778 #ifdeà +__REDIRECT + + +779  + `__REDIRECT + ( +fg‘pos +, ( +FILE + * +__»¡riù + +__¡»am +, + +780 +åos_t + * +__»¡riù + +__pos +), +fg‘pos64 +); + +781  + `__REDIRECT + ( +f£os +, + +782 ( +FILE + * +__¡»am +, +__cÚ¡ + +åos_t + * +__pos +), +f£os64 +); + +784  + #fg‘pos + +fg‘pos64 + + + ) + +785  + #f£os + +f£os64 + + + ) + +788 +__END_NAMESPACE_STD + + +790 #ifdeà +__USE_LARGEFILE64 + + +791  + `f£eko64 + ( +FILE + * +__¡»am +, +__off64_t + +__off +,  +__wh’û +); + +792 +__off64_t + + $á–lo64 + ( +FILE + * +__¡»am +è +__wur +; + +793  + `fg‘pos64 + ( +FILE + * +__»¡riù + +__¡»am +, +åos64_t + *__»¡riù +__pos +); + +794  + `f£os64 + ( +FILE + * +__¡»am +, +__cÚ¡ + +åos64_t + * +__pos +); + +797 +__BEGIN_NAMESPACE_STD + + +799  + $þ—»¼ + ( +FILE + * +__¡»am +è +__THROW +; + +801  + $ãof + ( +FILE + * +__¡»am +è +__THROW + +__wur +; + +803  + $ã¼Ü + ( +FILE + * +__¡»am +è +__THROW + +__wur +; + +804 +__END_NAMESPACE_STD + + +806 #ifdeà +__USE_MISC + + +808  + $þ—»¼_uÆocked + ( +FILE + * +__¡»am +è +__THROW +; + +809  + $ãof_uÆocked + ( +FILE + * +__¡»am +è +__THROW + +__wur +; + +810  + $ã¼Ü_uÆocked + ( +FILE + * +__¡»am +è +__THROW + +__wur +; + +814 +__BEGIN_NAMESPACE_STD + + +819  + `³¼Ü + ( +__cÚ¡ + * +__s +); + +820 +__END_NAMESPACE_STD + + +826  + ~ + +829 #ifdef +__USE_POSIX + + +831  + $fž’o + ( +FILE + * +__¡»am +è +__THROW + +__wur +; + +834 #ifdeà +__USE_MISC + + +836  + $fž’o_uÆocked + ( +FILE + * +__¡»am +è +__THROW + +__wur +; + +840 #ià( +defšed + +__USE_POSIX2 + || defšed +__USE_SVID + || defšed +__USE_BSD + || \ + +841 +defšed + +__USE_MISC +) + +846 +FILE + * + $pÝ’ + ( +__cÚ¡ + * +__commªd +, __cÚ¡ * +__modes +è +__wur +; + +852  + `pþo£ + ( +FILE + * +__¡»am +); + +856 #ifdef +__USE_POSIX + + +858 * + $ù”mid + (* +__s +è +__THROW +; + +862 #ifdeà +__USE_XOPEN + + +864 * + `cu£rid + (* +__s +); + +868 #ifdef +__USE_GNU + + +869  +ob¡ack +; + +872  + $ob¡ack_´štf + ( +ob¡ack + * +__»¡riù + +__ob¡ack +, + +873 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...) + +874 +__THROW + + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__´štf__ +, 2, 3))); + +875  + $ob¡ack_v´štf + ( +ob¡ack + * +__»¡riù + +__ob¡ack +, + +876 +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +877 +_G_va_li¡ + +__¬gs +) + +878 +__THROW + + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__´štf__ +, 2, 0))); + +882 #ià +defšed + +__USE_POSIX + || defšed +__USE_MISC + + +886  + $æockfže + ( +FILE + * +__¡»am +è +__THROW +; + +890  + $árylockfže + ( +FILE + * +__¡»am +è +__THROW + +__wur +; + +893  + $fuÆockfže + ( +FILE + * +__¡»am +è +__THROW +; + +896 #ià +defšed + +__USE_XOPEN + && !defšed +__USE_XOPEN2K + && !defšed +__USE_GNU + + +900  + #__Ãed_g‘Ýt + + + ) + +901  + ~ + +906 #ifdeà +__USE_EXTERN_INLINES + + +907  + ~ + +909 #ià +__USE_FORTIFY_LEVEL + > 0 && +defšed + +__ex‹º_®ways_šlše + + +910  + ~ + +912 #ifdeà +__LDBL_COMPAT + + +913  + ~ + +916 +__END_DECLS + + + @/usr/include/string.h + +23 #iâdef +_STRING_H + + +24  + #_STRING_H + 1 + + ) + +26  + ~<ã©u»s.h +> + +28 + g__BEGIN_DECLS + + +31  + #__Ãed_size_t + + + ) + +32  + #__Ãed_NULL + + + ) + +33  + ~<¡ddef.h +> + +36 #ià +defšed + +__ýlu¥lus + && +__GNUC_PREREQ + (4, 4) + +37  + #__CORRECT_ISO_CPP_STRING_H_PROTO + + + ) + +41 +__BEGIN_NAMESPACE_STD + + +43 * + $memýy + (* +__»¡riù + +__de¡ +, + +44 +__cÚ¡ + * +__»¡riù + +__¤c +, +size_t + +__n +) + +45 +__THROW + + `__nÚnuÎ + ((1, 2)); + +48 * + $memmove + (* +__de¡ +, +__cÚ¡ + * +__¤c +, +size_t + +__n +) + +49 +__THROW + + `__nÚnuÎ + ((1, 2)); + +50 +__END_NAMESPACE_STD + + +55 #ià +defšed + +__USE_SVID + || defšed +__USE_BSD + || defšed +__USE_XOPEN + + +56 * + $memcýy + (* +__»¡riù + +__de¡ +, +__cÚ¡ + *__»¡riù +__¤c +, + +57  +__c +, +size_t + +__n +) + +58 +__THROW + + `__nÚnuÎ + ((1, 2)); + +62 +__BEGIN_NAMESPACE_STD + + +64 * + $mem£t + (* +__s +,  +__c +, +size_t + +__n +è +__THROW + + `__nÚnuÎ + ((1)); + +67  + $memcmp + ( +__cÚ¡ + * +__s1 +, __cÚ¡ * +__s2 +, +size_t + +__n +) + +68 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +71 #ifdeà +__CORRECT_ISO_CPP_STRING_H_PROTO + + +74 * + `memchr + (* +__s +,  +__c +, +size_t + +__n +) + +75 +__THROW + + `__asm + ("memchr"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +76 +__cÚ¡ + * + `memchr + (__cÚ¡ * +__s +,  +__c +, +size_t + +__n +) + +77 +__THROW + + `__asm + ("memchr"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +79 #ifdeà +__OPTIMIZE__ + + +80 +__ex‹º_®ways_šlše + * + +81 + `memchr + (* +__s +,  +__c +, +size_t + +__n +è +__THROW + + +83  + `__bužtš_memchr + ( +__s +, +__c +, +__n +); + +86 +__ex‹º_®ways_šlše + +__cÚ¡ + * + +87 + `memchr + ( +__cÚ¡ + * +__s +,  +__c +, +size_t + +__n +è +__THROW + + +89  + `__bužtš_memchr + ( +__s +, +__c +, +__n +); + +92 + } +} + +94 * + $memchr + ( +__cÚ¡ + * +__s +,  +__c +, +size_t + +__n +) + +95 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +97 +__END_NAMESPACE_STD + + +99 #ifdeà +__USE_GNU + + +102 #ifdeà +__CORRECT_ISO_CPP_STRING_H_PROTO + + +103 "C++" * + $¿wmemchr + (* +__s +,  +__c +) + +104 +__THROW + + `__asm + ("¿wmemchr"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +105 "C++" +__cÚ¡ + * + $¿wmemchr + ( +__cÚ¡ + * +__s +,  +__c +) + +106 +__THROW + + `__asm + ("¿wmemchr"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +108 * + $¿wmemchr + ( +__cÚ¡ + * +__s +,  +__c +) + +109 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +113 #ifdeà +__CORRECT_ISO_CPP_STRING_H_PROTO + + +114 "C++" * + $memrchr + (* +__s +,  +__c +, +size_t + +__n +) + +115 +__THROW + + `__asm + ("memrchr"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +116 "C++" +__cÚ¡ + * + $memrchr + ( +__cÚ¡ + * +__s +,  +__c +, +size_t + +__n +) + +117 +__THROW + + `__asm + ("memrchr"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +119 * + $memrchr + ( +__cÚ¡ + * +__s +,  +__c +, +size_t + +__n +) + +120 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +125 +__BEGIN_NAMESPACE_STD + + +127 * + $¡rýy + (* +__»¡riù + +__de¡ +, +__cÚ¡ + *__»¡riù +__¤c +) + +128 +__THROW + + `__nÚnuÎ + ((1, 2)); + +130 * + $¡ºýy + (* +__»¡riù + +__de¡ +, + +131 +__cÚ¡ + * +__»¡riù + +__¤c +, +size_t + +__n +) + +132 +__THROW + + `__nÚnuÎ + ((1, 2)); + +135 * + $¡rÿt + (* +__»¡riù + +__de¡ +, +__cÚ¡ + *__»¡riù +__¤c +) + +136 +__THROW + + `__nÚnuÎ + ((1, 2)); + +138 * + $¡ºÿt + (* +__»¡riù + +__de¡ +, +__cÚ¡ + *__»¡riù +__¤c +, + +139 +size_t + +__n +è +__THROW + + `__nÚnuÎ + ((1, 2)); + +142  + $¡rcmp + ( +__cÚ¡ + * +__s1 +, __cÚ¡ * +__s2 +) + +143 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +145  + $¡ºcmp + ( +__cÚ¡ + * +__s1 +, __cÚ¡ * +__s2 +, +size_t + +__n +) + +146 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +149  + $¡rcÞl + ( +__cÚ¡ + * +__s1 +, __cÚ¡ * +__s2 +) + +150 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +152 +size_t + + $¡rxäm + (* +__»¡riù + +__de¡ +, + +153 +__cÚ¡ + * +__»¡riù + +__¤c +, +size_t + +__n +) + +154 +__THROW + + `__nÚnuÎ + ((2)); + +155 +__END_NAMESPACE_STD + + +157 #ifdeà +__USE_XOPEN2K8 + + +161  + ~ + +164  + $¡rcÞl_l + ( +__cÚ¡ + * +__s1 +, __cÚ¡ * +__s2 +, +__loÿË_t + +__l +) + +165 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2, 3)); + +167 +size_t + + $¡rxäm_l + (* +__de¡ +, +__cÚ¡ + * +__¤c +, +size_t + +__n +, + +168 +__loÿË_t + +__l +è +__THROW + + `__nÚnuÎ + ((2, 4)); + +171 #ià +defšed + +__USE_SVID + || defšed +__USE_BSD + || defšed +__USE_XOPEN_EXTENDED + + +173 * + $¡rdup + ( +__cÚ¡ + * +__s +) + +174 +__THROW + +__©Œibu‹_m®loc__ + + `__nÚnuÎ + ((1)); + +180 #ià +defšed + +__USE_XOPEN2K8 + + +181 * + $¡ºdup + ( +__cÚ¡ + * +__¡ršg +, +size_t + +__n +) + +182 +__THROW + +__©Œibu‹_m®loc__ + + `__nÚnuÎ + ((1)); + +185 #ià +defšed + +__USE_GNU + && defšed +__GNUC__ + + +187  + #¡rdu· +( +s +) \ + +188 ( +__ex‹nsiÚ__ + \ + +190 +__cÚ¡ + * +__Þd + = ( +s +); \ + +191 +size_t + +__Ën + = + `¡¾’ + ( +__Þd +) + 1; \ + +192 * +__Ãw + = (*è + `__bužtš_®loÿ + ( +__Ën +); \ + +193 (*è + `memýy + ( +__Ãw +, +__Þd +, +__Ën +); \ + +194 + } +})) + + ) + +197  + #¡ºdu· +( +s +, +n +) \ + +198 ( +__ex‹nsiÚ__ + \ + +200 +__cÚ¡ + * +__Þd + = ( +s +); \ + +201 +size_t + +__Ën + = + `¡ºËn + ( +__Þd +, ( +n +)); \ + +202 * +__Ãw + = (*è + `__bužtš_®loÿ + ( +__Ën + + 1); \ + +203 +__Ãw +[ +__Ën +] = '\0'; \ + +204 (*è + `memýy + ( +__Ãw +, +__Þd +, +__Ën +); \ + +205 })) + + ) + +208 + g__BEGIN_NAMESPACE_STD + + +210 #ifdeà +__CORRECT_ISO_CPP_STRING_H_PROTO + + +213 * +¡rchr + (* +__s +,  +__c +) + +214 +__THROW + +__asm + ("¡rchr"è +__©Œibu‹_pu»__ + +__nÚnuÎ + ((1)); + +215 +__cÚ¡ + * +¡rchr + (__cÚ¡ * +__s +,  +__c +) + +216 +__THROW + +__asm + ("¡rchr"è +__©Œibu‹_pu»__ + +__nÚnuÎ + ((1)); + +218 #ifdeà +__OPTIMIZE__ + + +219 +__ex‹º_®ways_šlše + * + +220 +¡rchr + (* +__s +,  +__c +è + g__THROW + + +222  +__bužtš_¡rchr + ( +__s +, +__c +); + +225 +__ex‹º_®ways_šlše + +__cÚ¡ + * + +226 +¡rchr + ( +__cÚ¡ + * +__s +,  +__c +è + g__THROW + + +228  +__bužtš_¡rchr + ( +__s +, +__c +); + +233 * + $¡rchr + ( +__cÚ¡ + * +__s +,  +__c +) + +234 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +237 #ifdeà +__CORRECT_ISO_CPP_STRING_H_PROTO + + +240 * + `¡¼chr + (* +__s +,  +__c +) + +241 +__THROW + + `__asm + ("¡¼chr"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +242 +__cÚ¡ + * + `¡¼chr + (__cÚ¡ * +__s +,  +__c +) + +243 +__THROW + + `__asm + ("¡¼chr"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +245 #ifdeà +__OPTIMIZE__ + + +246 +__ex‹º_®ways_šlše + * + +247 + `¡¼chr + (* +__s +,  +__c +è +__THROW + + +249  + `__bužtš_¡¼chr + ( +__s +, +__c +); + +252 +__ex‹º_®ways_šlše + +__cÚ¡ + * + +253 + `¡¼chr + ( +__cÚ¡ + * +__s +,  +__c +è +__THROW + + +255  + `__bužtš_¡¼chr + ( +__s +, +__c +); + +258 + } +} + +260 * + $¡¼chr + ( +__cÚ¡ + * +__s +,  +__c +) + +261 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +263 +__END_NAMESPACE_STD + + +265 #ifdeà +__USE_GNU + + +268 #ifdeà +__CORRECT_ISO_CPP_STRING_H_PROTO + + +269 "C++" * + $¡rchºul + (* +__s +,  +__c +) + +270 +__THROW + + `__asm + ("¡rchºul"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +271 "C++" +__cÚ¡ + * + $¡rchºul + ( +__cÚ¡ + * +__s +,  +__c +) + +272 +__THROW + + `__asm + ("¡rchºul"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +274 * + $¡rchºul + ( +__cÚ¡ + * +__s +,  +__c +) + +275 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +279 +__BEGIN_NAMESPACE_STD + + +282 +size_t + + $¡rc¥n + ( +__cÚ¡ + * +__s +, __cÚ¡ * +__»jeù +) + +283 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +286 +size_t + + $¡r¥n + ( +__cÚ¡ + * +__s +, __cÚ¡ * +__acû± +) + +287 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +289 #ifdeà +__CORRECT_ISO_CPP_STRING_H_PROTO + + +292 * + `¡½brk + (* +__s +, +__cÚ¡ + * +__acû± +) + +293 +__THROW + + `__asm + ("¡½brk"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +294 +__cÚ¡ + * + `¡½brk + (__cÚ¡ * +__s +, __cÚ¡ * +__acû± +) + +295 +__THROW + + `__asm + ("¡½brk"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +297 #ifdeà +__OPTIMIZE__ + + +298 +__ex‹º_®ways_šlše + * + +299 + `¡½brk + (* +__s +, +__cÚ¡ + * +__acû± +è +__THROW + + +301  + `__bužtš_¡½brk + ( +__s +, +__acû± +); + +304 +__ex‹º_®ways_šlše + +__cÚ¡ + * + +305 + `¡½brk + ( +__cÚ¡ + * +__s +, __cÚ¡ * +__acû± +è +__THROW + + +307  + `__bužtš_¡½brk + ( +__s +, +__acû± +); + +310 + } +} + +312 * + $¡½brk + ( +__cÚ¡ + * +__s +, __cÚ¡ * +__acû± +) + +313 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +316 #ifdeà +__CORRECT_ISO_CPP_STRING_H_PROTO + + +319 * + `¡r¡r + (* +__hay¡ack +, +__cÚ¡ + * +__ÃedË +) + +320 +__THROW + + `__asm + ("¡r¡r"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +321 +__cÚ¡ + * + `¡r¡r + (__cÚ¡ * +__hay¡ack +, + +322 +__cÚ¡ + * +__ÃedË +) + +323 +__THROW + + `__asm + ("¡r¡r"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +325 #ifdeà +__OPTIMIZE__ + + +326 +__ex‹º_®ways_šlše + * + +327 + `¡r¡r + (* +__hay¡ack +, +__cÚ¡ + * +__ÃedË +è +__THROW + + +329  + `__bužtš_¡r¡r + ( +__hay¡ack +, +__ÃedË +); + +332 +__ex‹º_®ways_šlše + +__cÚ¡ + * + +333 + `¡r¡r + ( +__cÚ¡ + * +__hay¡ack +, __cÚ¡ * +__ÃedË +è +__THROW + + +335  + `__bužtš_¡r¡r + ( +__hay¡ack +, +__ÃedË +); + +338 + } +} + +340 * + $¡r¡r + ( +__cÚ¡ + * +__hay¡ack +, __cÚ¡ * +__ÃedË +) + +341 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +346 * + $¡¹ok + (* +__»¡riù + +__s +, +__cÚ¡ + *__»¡riù +__d–im +) + +347 +__THROW + + `__nÚnuÎ + ((2)); + +348 +__END_NAMESPACE_STD + + +352 * + $__¡¹ok_r + (* +__»¡riù + +__s +, + +353 +__cÚ¡ + * +__»¡riù + +__d–im +, + +354 ** +__»¡riù + +__§ve_±r +) + +355 +__THROW + + `__nÚnuÎ + ((2, 3)); + +356 #ià +defšed + +__USE_POSIX + || defšed +__USE_MISC + + +357 * + $¡¹ok_r + (* +__»¡riù + +__s +, +__cÚ¡ + *__»¡riù +__d–im +, + +358 ** +__»¡riù + +__§ve_±r +) + +359 +__THROW + + `__nÚnuÎ + ((2, 3)); + +362 #ifdeà +__USE_GNU + + +364 #ifdeà +__CORRECT_ISO_CPP_STRING_H_PROTO + + +365 "C++" * + $¡rÿ£¡r + (* +__hay¡ack +, +__cÚ¡ + * +__ÃedË +) + +366 +__THROW + + `__asm + ("¡rÿ£¡r"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +367 "C++" +__cÚ¡ + * + $¡rÿ£¡r + ( +__cÚ¡ + * +__hay¡ack +, + +368 +__cÚ¡ + * +__ÃedË +) + +369 +__THROW + + `__asm + ("¡rÿ£¡r"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +371 * + $¡rÿ£¡r + ( +__cÚ¡ + * +__hay¡ack +, __cÚ¡ * +__ÃedË +) + +372 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +376 #ifdeà +__USE_GNU + + +380 * + $memmem + ( +__cÚ¡ + * +__hay¡ack +, +size_t + +__hay¡ackËn +, + +381 +__cÚ¡ + * +__ÃedË +, +size_t + +__ÃedËËn +) + +382 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 3)); + +386 * + $__mempýy + (* +__»¡riù + +__de¡ +, + +387 +__cÚ¡ + * +__»¡riù + +__¤c +, +size_t + +__n +) + +388 +__THROW + + `__nÚnuÎ + ((1, 2)); + +389 * + $mempýy + (* +__»¡riù + +__de¡ +, + +390 +__cÚ¡ + * +__»¡riù + +__¤c +, +size_t + +__n +) + +391 +__THROW + + `__nÚnuÎ + ((1, 2)); + +395 +__BEGIN_NAMESPACE_STD + + +397 +size_t + + $¡¾’ + ( +__cÚ¡ + * +__s +) + +398 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +399 +__END_NAMESPACE_STD + + +401 #ifdef +__USE_XOPEN2K8 + + +404 +size_t + + $¡ºËn + ( +__cÚ¡ + * +__¡ršg +, +size_t + +__maxËn +) + +405 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +409 +__BEGIN_NAMESPACE_STD + + +411 * + $¡»¼Ü + ( +__”ºum +è +__THROW +; + +412 +__END_NAMESPACE_STD + + +413 #ià +defšed + +__USE_XOPEN2K + || defšed +__USE_MISC + + +421 #ià +defšed + +__USE_XOPEN2K + && !defšed +__USE_GNU + + +424 #ifdeà +__REDIRECT_NTH + + +425  + `__REDIRECT_NTH + ( +¡»¼Ü_r +, + +426 ( +__”ºum +, * +__buf +, +size_t + +__buæ’ +), + +427 +__xpg_¡»¼Ü_r +è + `__nÚnuÎ + ((2)); + +429  + $__xpg_¡»¼Ü_r + ( +__”ºum +, * +__buf +, +size_t + +__buæ’ +) + +430 +__THROW + + `__nÚnuÎ + ((2)); + +431  + #¡»¼Ü_r + +__xpg_¡»¼Ü_r + + + ) + +436 * + $¡»¼Ü_r + ( +__”ºum +, * +__buf +, +size_t + +__buæ’ +) + +437 +__THROW + + `__nÚnuÎ + ((2)); + +441 #ifdeà +__USE_XOPEN2K8 + + +443 * + $¡»¼Ü_l + ( +__”ºum +, +__loÿË_t + +__l +è +__THROW +; + +449  + $__bz”o + (* +__s +, +size_t + +__n +è +__THROW + + `__nÚnuÎ + ((1)); + +451 #ifdeà +__USE_BSD + + +453  + $bcÝy + ( +__cÚ¡ + * +__¤c +, * +__de¡ +, +size_t + +__n +) + +454 +__THROW + + `__nÚnuÎ + ((1, 2)); + +457  + $bz”o + (* +__s +, +size_t + +__n +è +__THROW + + `__nÚnuÎ + ((1)); + +460  + $bcmp + ( +__cÚ¡ + * +__s1 +, __cÚ¡ * +__s2 +, +size_t + +__n +) + +461 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +464 #ifdeà +__CORRECT_ISO_CPP_STRING_H_PROTO + + +467 * + `šdex + (* +__s +,  +__c +) + +468 +__THROW + + `__asm + ("šdex"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +469 +__cÚ¡ + * + `šdex + (__cÚ¡ * +__s +,  +__c +) + +470 +__THROW + + `__asm + ("šdex"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +472 #ià +defšed + +__OPTIMIZE__ + && !defšed +__CORRECT_ISO_CPP_STRINGS_H_PROTO + + +473 +__ex‹º_®ways_šlše + * + +474 + `šdex + (* +__s +,  +__c +è +__THROW + + +476  + `__bužtš_šdex + ( +__s +, +__c +); + +479 +__ex‹º_®ways_šlše + +__cÚ¡ + * + +480 + `šdex + ( +__cÚ¡ + * +__s +,  +__c +è +__THROW + + +482  + `__bužtš_šdex + ( +__s +, +__c +); + +485 + } +} + +487 * + $šdex + ( +__cÚ¡ + * +__s +,  +__c +) + +488 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +492 #ifdeà +__CORRECT_ISO_CPP_STRING_H_PROTO + + +495 * + `ršdex + (* +__s +,  +__c +) + +496 +__THROW + + `__asm + ("ršdex"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +497 +__cÚ¡ + * + `ršdex + (__cÚ¡ * +__s +,  +__c +) + +498 +__THROW + + `__asm + ("ršdex"è +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +500 #ià +defšed + +__OPTIMIZE__ + && !defšed +__CORRECT_ISO_CPP_STRINGS_H_PROTO + + +501 +__ex‹º_®ways_šlše + * + +502 + `ršdex + (* +__s +,  +__c +è +__THROW + + +504  + `__bužtš_ršdex + ( +__s +, +__c +); + +507 +__ex‹º_®ways_šlše + +__cÚ¡ + * + +508 + `ršdex + ( +__cÚ¡ + * +__s +,  +__c +è +__THROW + + +510  + `__bužtš_ršdex + ( +__s +, +__c +); + +513 + } +} + +515 * + $ršdex + ( +__cÚ¡ + * +__s +,  +__c +) + +516 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)); + +521  + $ffs + ( +__i +è +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +525 #ifdef +__USE_GNU + + +526  + $ff¦ + ( +__l +è +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +527 #ifdeà +__GNUC__ + + +528 +__ex‹nsiÚ__ +  + $ff¦l + ( +__Î +) + +529 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +534  + $¡rÿ£cmp + ( +__cÚ¡ + * +__s1 +, __cÚ¡ * +__s2 +) + +535 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +538  + $¡ºÿ£cmp + ( +__cÚ¡ + * +__s1 +, __cÚ¡ * +__s2 +, +size_t + +__n +) + +539 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +542 #ifdef +__USE_GNU + + +545  + $¡rÿ£cmp_l + ( +__cÚ¡ + * +__s1 +, __cÚ¡ * +__s2 +, + +546 +__loÿË_t + +__loc +) + +547 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2, 3)); + +549  + $¡ºÿ£cmp_l + ( +__cÚ¡ + * +__s1 +, __cÚ¡ * +__s2 +, + +550 +size_t + +__n +, +__loÿË_t + +__loc +) + +551 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2, 4)); + +554 #ifdef +__USE_BSD + + +557 * + $¡r£p + (** +__»¡riù + +__¡ršgp +, + +558 +__cÚ¡ + * +__»¡riù + +__d–im +) + +559 +__THROW + + `__nÚnuÎ + ((1, 2)); + +562 #ifdef +__USE_XOPEN2K8 + + +564 * + $¡rsigÇl + ( +__sig +è +__THROW +; + +567 * + $__¡pýy + (* +__»¡riù + +__de¡ +, +__cÚ¡ + *__»¡riù +__¤c +) + +568 +__THROW + + `__nÚnuÎ + ((1, 2)); + +569 * + $¡pýy + (* +__»¡riù + +__de¡ +, +__cÚ¡ + *__»¡riù +__¤c +) + +570 +__THROW + + `__nÚnuÎ + ((1, 2)); + +574 * + $__¡²ýy + (* +__»¡riù + +__de¡ +, + +575 +__cÚ¡ + * +__»¡riù + +__¤c +, +size_t + +__n +) + +576 +__THROW + + `__nÚnuÎ + ((1, 2)); + +577 * + $¡²ýy + (* +__»¡riù + +__de¡ +, + +578 +__cÚ¡ + * +__»¡riù + +__¤c +, +size_t + +__n +) + +579 +__THROW + + `__nÚnuÎ + ((1, 2)); + +582 #ifdef +__USE_GNU + + +584  + $¡rv”scmp + ( +__cÚ¡ + * +__s1 +, __cÚ¡ * +__s2 +) + +585 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1, 2)); + +588 * + $¡räy + (* +__¡ršg +è +__THROW + + `__nÚnuÎ + ((1)); + +591 * + $memäob + (* +__s +, +size_t + +__n +è +__THROW + + `__nÚnuÎ + ((1)); + +593 #iâdeà +ba£Çme + + +598 #ifdeà +__CORRECT_ISO_CPP_STRING_H_PROTO + + +599 "C++" * + $ba£Çme + (* +__fž’ame +) + +600 +__THROW + + `__asm + ("ba£Çme"è + `__nÚnuÎ + ((1)); + +601 "C++" +__cÚ¡ + * + $ba£Çme + ( +__cÚ¡ + * +__fž’ame +) + +602 +__THROW + + `__asm + ("ba£Çme"è + `__nÚnuÎ + ((1)); + +604 * + $ba£Çme + ( +__cÚ¡ + * +__fž’ame +è +__THROW + + `__nÚnuÎ + ((1)); + +610 #ià +defšed + +__GNUC__ + && __GNUC__ >= 2 + +611 #ià +defšed + +__OPTIMIZE__ + && !defšed +__OPTIMIZE_SIZE__ + \ + +612 && ! +defšed + +__NO_INLINE__ + && !defšed +__ýlu¥lus + + +632  + ~ + +635  + ~ + +638 #ià +__USE_FORTIFY_LEVEL + > 0 && +defšed + +__ex‹º_®ways_šlše + + +640  + ~ + +644 +__END_DECLS + + + @/usr/include/bits/huge_val.h + +22 #iâdeà +_MATH_H + + +28 #ià +__GNUC_PREREQ +(3,3) + +29  + #HUGE_VAL + ( + `__bužtš_huge_v® +()) + + ) + +30 #–ià +__GNUC_PREREQ +(2,96) + +31  + #HUGE_VAL + ( +__ex‹nsiÚ__ + 0x1.0 +p2047 +) + + ) + +32 #–ià +defšed + +__GNUC__ + + +34  + #HUGE_VAL + \ + +35 ( +__ex‹nsiÚ__ + \ + +36 ((uniÚ {  +__l + + `__©Œibu‹__ +(( + `__mode__ +( +__DI__ +)));  +__d +; }) \ + +37 { +__l +: 0x7ff0000000000000ULL }). +__d +) + + ) + +41  + ~<’dŸn.h +> + +43 uniÚ {  + m__c +[8];  + m__d +; } + t__huge_v®_t +; + +45 #ià +__BYTE_ORDER + =ð +__BIG_ENDIAN + + +46  + #__HUGE_VAL_by‹s + { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } + + ) + +48 #ià +__BYTE_ORDER + =ð +__LITTLE_ENDIAN + + +49  + #__HUGE_VAL_by‹s + { 0, 0, 0, 0, 0, 0, 0xf0, 0x7à} + + ) + +52  +__huge_v®_t + + g__huge_v® + = { +__HUGE_VAL_by‹s + }; + +53  + #HUGE_VAL + ( +__huge_v® +. +__d +) + + ) + + @/usr/include/bits/huge_valf.h + +22 #iâdeà +_MATH_H + + +28 #ià +__GNUC_PREREQ +(3,3) + +29  + #HUGE_VALF + ( + `__bužtš_huge_v®f +()) + + ) + +30 #–ià +__GNUC_PREREQ +(2,96) + +31  + #HUGE_VALF + ( +__ex‹nsiÚ__ + 0x1.0 +p255f +) + + ) + +32 #–ià +defšed + +__GNUC__ + + +34  + #HUGE_VALF + \ + +35 ( +__ex‹nsiÚ__ + \ + +36 ((uniÚ {  +__l + + `__©Œibu‹__ +(( + `__mode__ +( +__SI__ +)));  +__d +; }) \ + +37 { +__l +: 0x7f800000UL }). +__d +) + + ) + +41 uniÚ {  + m__c +[4];  + m__f +; } + t__huge_v®f_t +; + +43 #ià +__BYTE_ORDER + =ð +__BIG_ENDIAN + + +44  + #__HUGE_VALF_by‹s + { 0x7f, 0x80, 0, 0 } + + ) + +46 #ià +__BYTE_ORDER + =ð +__LITTLE_ENDIAN + + +47  + #__HUGE_VALF_by‹s + { 0, 0, 0x80, 0x7à} + + ) + +50  +__huge_v®f_t + + g__huge_v®f + = { +__HUGE_VALF_by‹s + }; + +51  + #HUGE_VALF + ( +__huge_v®f +. +__f +) + + ) + + @/usr/include/bits/huge_vall.h + +21 #iâdeà +_MATH_H + + +25 #ià +__GNUC_PREREQ +(3,3) + +26  + #HUGE_VALL + ( + `__bužtš_huge_v®l +()) + + ) + +28  + #HUGE_VALL + ((è +HUGE_VAL +) + + ) + + @/usr/include/bits/inf.h + +20 #iâdeà +_MATH_H + + +26 #ià +__GNUC_PREREQ +(3,3) + +27  + #INFINITY + ( + `__bužtš_šff +()) + + ) + +29  + #INFINITY + +HUGE_VALF + + + ) + + @/usr/include/bits/mathcalls.h + +46 #iâdeà +_MATH_H + + +53 +_MdoubË_BEGIN_NAMESPACE + + +55 +__MATHCALL + ( +acos +,, ( +_MdoubË_ + +__x +)); + +57 +__MATHCALL + ( +asš +,, ( +_MdoubË_ + +__x +)); + +59 +__MATHCALL + ( +©ª +,, ( +_MdoubË_ + +__x +)); + +61 +__MATHCALL + ( +©ª2 +,, ( +_MdoubË_ + +__y +, _MdoubË_ +__x +)); + +64 +__MATHCALL + ( +cos +,, ( +_MdoubË_ + +__x +)); + +66 +__MATHCALL + ( +sš +,, ( +_MdoubË_ + +__x +)); + +68 +__MATHCALL + ( +n +,, ( +_MdoubË_ + +__x +)); + +73 +__MATHCALL + ( +cosh +,, ( +_MdoubË_ + +__x +)); + +75 +__MATHCALL + ( +sšh +,, ( +_MdoubË_ + +__x +)); + +77 +__MATHCALL + ( +nh +,, ( +_MdoubË_ + +__x +)); + +78 + g_MdoubË_END_NAMESPACE + + +80 #ifdeà +__USE_GNU + + +82 +__MATHDECL + (, +sšcos +,, + +83 ( +_MdoubË_ + +__x +, _MdoubË_ * +__sšx +, _MdoubË_ * +__cosx +)); + +86 #ià +defšed + +__USE_MISC + || defšed +__USE_XOPEN_EXTENDED + || defšed +__USE_ISOC99 + + +87 +__BEGIN_NAMESPACE_C99 + + +89 +__MATHCALL + ( +acosh +,, ( +_MdoubË_ + +__x +)); + +91 +__MATHCALL + ( +asšh +,, ( +_MdoubË_ + +__x +)); + +93 +__MATHCALL + ( +©ªh +,, ( +_MdoubË_ + +__x +)); + +94 + g__END_NAMESPACE_C99 + + +99 +_MdoubË_BEGIN_NAMESPACE + + +101 +__MATHCALL + ( +exp +,, ( +_MdoubË_ + +__x +)); + +104 +__MATHCALL + ( +äexp +,, ( +_MdoubË_ + +__x +, * +__expÚ’t +)); + +107 +__MATHCALL + ( +ldexp +,, ( +_MdoubË_ + +__x +,  +__expÚ’t +)); + +110 +__MATHCALL + ( +log +,, ( +_MdoubË_ + +__x +)); + +113 +__MATHCALL + ( +log10 +,, ( +_MdoubË_ + +__x +)); + +116 +__MATHCALL + ( +modf +,, ( +_MdoubË_ + +__x +, _MdoubË_ * +__Œ +)); + +117 + g_MdoubË_END_NAMESPACE + + +119 #ifdeà +__USE_GNU + + +121 +__MATHCALL + ( +exp10 +,, ( +_MdoubË_ + +__x +)); + +123 +__MATHCALL + ( +pow10 +,, ( +_MdoubË_ + +__x +)); + +126 #ià +defšed + +__USE_MISC + || defšed +__USE_XOPEN_EXTENDED + || defšed +__USE_ISOC99 + + +127 +__BEGIN_NAMESPACE_C99 + + +129 +__MATHCALL + ( +expm1 +,, ( +_MdoubË_ + +__x +)); + +132 +__MATHCALL + ( +log1p +,, ( +_MdoubË_ + +__x +)); + +135 +__MATHCALL + ( +logb +,, ( +_MdoubË_ + +__x +)); + +136 + g__END_NAMESPACE_C99 + + +139 #ifdeà +__USE_ISOC99 + + +140 +__BEGIN_NAMESPACE_C99 + + +142 +__MATHCALL + ( +exp2 +,, ( +_MdoubË_ + +__x +)); + +145 +__MATHCALL + ( +log2 +,, ( +_MdoubË_ + +__x +)); + +146 + g__END_NAMESPACE_C99 + + +152 +_MdoubË_BEGIN_NAMESPACE + + +154 +__MATHCALL + ( +pow +,, ( +_MdoubË_ + +__x +, _MdoubË_ +__y +)); + +157 +__MATHCALL + ( +sq¹ +,, ( +_MdoubË_ + +__x +)); + +158 + g_MdoubË_END_NAMESPACE + + +160 #ià +defšed + +__USE_MISC + || defšed +__USE_XOPEN + || defšed +__USE_ISOC99 + + +161 +__BEGIN_NAMESPACE_C99 + + +163 +__MATHCALL + ( +hypÙ +,, ( +_MdoubË_ + +__x +, _MdoubË_ +__y +)); + +164 + g__END_NAMESPACE_C99 + + +167 #ià +defšed + +__USE_MISC + || defšed +__USE_XOPEN_EXTENDED + || defšed +__USE_ISOC99 + + +168 +__BEGIN_NAMESPACE_C99 + + +170 +__MATHCALL + ( +cb¹ +,, ( +_MdoubË_ + +__x +)); + +171 + g__END_NAMESPACE_C99 + + +177 +_MdoubË_BEGIN_NAMESPACE + + +179 +__MATHCALLX + ( +ûž +,, ( +_MdoubË_ + +__x +), ( +__cÚ¡__ +)); + +182 +__MATHCALLX + ( +çbs +,, ( +_MdoubË_ + +__x +), ( +__cÚ¡__ +)); + +185 +__MATHCALLX + ( +æoÜ +,, ( +_MdoubË_ + +__x +), ( +__cÚ¡__ +)); + +188 +__MATHCALL + ( +fmod +,, ( +_MdoubË_ + +__x +, _MdoubË_ +__y +)); + +193 +__MATHDECL_1 + (, +__isšf +,, ( +_MdoubË_ + +__v®ue +)è +__©Œibu‹__ + (( +__cÚ¡__ +)); + +196 +__MATHDECL_1 + (, +__fš™e +,, ( +_MdoubË_ + +__v®ue +)è +__©Œibu‹__ + (( +__cÚ¡__ +)); + +197 + g_MdoubË_END_NAMESPACE + + +199 #ifdeà +__USE_MISC + + +202 +__MATHDECL_1 + (, +isšf +,, ( +_MdoubË_ + +__v®ue +)è +__©Œibu‹__ + (( +__cÚ¡__ +)); + +205 +__MATHDECL_1 + (, +fš™e +,, ( +_MdoubË_ + +__v®ue +)è +__©Œibu‹__ + (( +__cÚ¡__ +)); + +208 +__MATHCALL + ( +d»m +,, ( +_MdoubË_ + +__x +, _MdoubË_ +__y +)); + +212 +__MATHCALL + ( +signifiÿnd +,, ( +_MdoubË_ + +__x +)); + +215 #ià +defšed + +__USE_MISC + || defšed +__USE_ISOC99 + + +216 +__BEGIN_NAMESPACE_C99 + + +218 +__MATHCALLX + ( +cÝysign +,, ( +_MdoubË_ + +__x +, _MdoubË_ +__y +), ( +__cÚ¡__ +)); + +219 + g__END_NAMESPACE_C99 + + +222 #ifdeà +__USE_ISOC99 + + +223 +__BEGIN_NAMESPACE_C99 + + +225 +__MATHCALLX + ( +Çn +,, ( +__cÚ¡ + * +__gb +), ( +__cÚ¡__ +)); + +226 + g__END_NAMESPACE_C99 + + +231 +__MATHDECL_1 + (, +__i¢ª +,, ( +_MdoubË_ + +__v®ue +)è +__©Œibu‹__ + (( +__cÚ¡__ +)); + +233 #ià +defšed + +__USE_MISC + || defšed +__USE_XOPEN + + +235 +__MATHDECL_1 + (, +i¢ª +,, ( +_MdoubË_ + +__v®ue +)è +__©Œibu‹__ + (( +__cÚ¡__ +)); + +238 +__MATHCALL + ( +j0 +,, ( +_MdoubË_ +)); + +239 +__MATHCALL + ( +j1 +,, ( +_MdoubË_ +)); + +240 +__MATHCALL + ( +jn +,, (, +_MdoubË_ +)); + +241 +__MATHCALL + ( +y0 +,, ( +_MdoubË_ +)); + +242 +__MATHCALL + ( +y1 +,, ( +_MdoubË_ +)); + +243 +__MATHCALL + ( +yn +,, (, +_MdoubË_ +)); + +247 #ià +defšed + +__USE_MISC + || defšed +__USE_XOPEN + || defšed +__USE_ISOC99 + + +248 +__BEGIN_NAMESPACE_C99 + + +250 +__MATHCALL + ( +”f +,, ( +_MdoubË_ +)); + +251 +__MATHCALL + ( +”fc +,, ( +_MdoubË_ +)); + +252 +__MATHCALL + ( +lgamma +,, ( +_MdoubË_ +)); + +253 + g__END_NAMESPACE_C99 + + +256 #ifdeà +__USE_ISOC99 + + +257 +__BEGIN_NAMESPACE_C99 + + +259 +__MATHCALL + ( +tgamma +,, ( +_MdoubË_ +)); + +260 + g__END_NAMESPACE_C99 + + +263 #ià +defšed + +__USE_MISC + || defšed +__USE_XOPEN + + +265 +__MATHCALL + ( +gamma +,, ( +_MdoubË_ +)); + +268 #ifdeà +__USE_MISC + + +272 +__MATHCALL + ( +lgamma +, +_r +, ( +_MdoubË_ +, * +__signgamp +)); + +276 #ià +defšed + +__USE_MISC + || defšed +__USE_XOPEN_EXTENDED + || defšed +__USE_ISOC99 + + +277 +__BEGIN_NAMESPACE_C99 + + +280 +__MATHCALL + ( +ršt +,, ( +_MdoubË_ + +__x +)); + +283 +__MATHCALLX + ( +Ãxá” +,, ( +_MdoubË_ + +__x +, _MdoubË_ +__y +), ( +__cÚ¡__ +)); + +284 #ià +defšed + +__USE_ISOC99 + && !defšed +__LDBL_COMPAT + + +285 +__MATHCALLX + ( +Ãx‰ow¬d +,, ( +_MdoubË_ + +__x +,  +__y +), ( +__cÚ¡__ +)); + +289 +__MATHCALL + ( +»mašd” +,, ( +_MdoubË_ + +__x +, _MdoubË_ +__y +)); + +291 #ià +defšed + +__USE_MISC + || defšed +__USE_ISOC99 + + +293 +__MATHCALL + ( +sÿlbn +,, ( +_MdoubË_ + +__x +,  +__n +)); + +297 +__MATHDECL + (, +žogb +,, ( +_MdoubË_ + +__x +)); + +300 #ifdeà +__USE_ISOC99 + + +302 +__MATHCALL + ( +sÿlbÊ +,, ( +_MdoubË_ + +__x +,  +__n +)); + +306 +__MATHCALL + ( +ìbyšt +,, ( +_MdoubË_ + +__x +)); + +310 +__MATHCALLX + ( +round +,, ( +_MdoubË_ + +__x +), ( +__cÚ¡__ +)); + +314 +__MATHCALLX + ( +Œunc +,, ( +_MdoubË_ + +__x +), ( +__cÚ¡__ +)); + +319 +__MATHCALL + ( +»mquo +,, ( +_MdoubË_ + +__x +, _MdoubË_ +__y +, * +__quo +)); + +326 +__MATHDECL + (, +Ìšt +,, ( +_MdoubË_ + +__x +)); + +327 +__MATHDECL + (, +Îršt +,, ( +_MdoubË_ + +__x +)); + +331 +__MATHDECL + (, +Ìound +,, ( +_MdoubË_ + +__x +)); + +332 +__MATHDECL + (, +Îround +,, ( +_MdoubË_ + +__x +)); + +336 +__MATHCALL + ( +fdim +,, ( +_MdoubË_ + +__x +, _MdoubË_ +__y +)); + +339 +__MATHCALL + ( +fmax +,, ( +_MdoubË_ + +__x +, _MdoubË_ +__y +)); + +342 +__MATHCALL + ( +fmš +,, ( +_MdoubË_ + +__x +, _MdoubË_ +__y +)); + +346 +__MATHDECL_1 + (, +__åþassify +,, ( +_MdoubË_ + +__v®ue +)) + +347 +__©Œibu‹__ + (( +__cÚ¡__ +)); + +350 +__MATHDECL_1 + (, +__signb™ +,, ( +_MdoubË_ + +__v®ue +)) + +351 +__©Œibu‹__ + (( +__cÚ¡__ +)); + +355 +__MATHCALL + ( +fma +,, ( +_MdoubË_ + +__x +, _MdoubË_ +__y +, _MdoubË_ +__z +)); + +358 #ià +defšed + +__USE_MISC + || defšed +__USE_XOPEN_EXTENDED + || defšed +__USE_ISOC99 + + +359 + g__END_NAMESPACE_C99 + + +362 #ià +defšed + +__USE_MISC + || defšed +__USE_XOPEN_EXTENDED + + +364 +__MATHCALL + ( +sÿlb +,, ( +_MdoubË_ + +__x +, _MdoubË_ +__n +)); + + @/usr/include/bits/mathdef.h + +19 #ià! +defšed + +_MATH_H + && !defšed +_COMPLEX_H + + +23 #ià +defšed + +__USE_ISOC99 + && defšed +_MATH_H + && !defšed +_MATH_H_MATHDEF + + +24  + #_MATH_H_MATHDEF + 1 + + ) + +26  + ~ + +28 #ià +__WORDSIZE + =ð64 || ( +defšed + +__FLT_EVAL_METHOD__ + && __FLT_EVAL_METHOD__ == 0) + +31  + tæßt_t +; + +32  + tdoubË_t +; + +38  + tæßt_t +; + +40  + tdoubË_t +; + +45  + #FP_ILOGB0 + (-2147483647 - 1) + + ) + +46  + #FP_ILOGBNAN + (-2147483647 - 1) + + ) + + @/usr/include/bits/mathinline.h + +21 #iâdeà +_MATH_H + + +25  + ~ + +27 #iâdeà +__ex‹º_šlše + + +28  + #__MATH_INLINE + +__šlše + + + ) + +30  + #__MATH_INLINE + +__ex‹º_šlše + + + ) + +34 #ià +defšed + +__USE_ISOC99 + && defšed +__GNUC__ + && __GNUC__ >= 2 + +37 +__MATH_INLINE +  + +38 +__NTH + ( + $__signb™f + ( +__x +)) + +40 #ià +__WORDSIZE + == 32 + +41 +__ex‹nsiÚ__ + uniÚ {  +__f +;  +__i +; } +__u + = { __f: +__x + }; + +42  +__u +. +__i + < 0; + +44  +__m +; + +45 + `__asm + ("pmovmskb %1, %0" : "ô" ( +__m +è: "x" ( +__x +)); + +46  +__m + & 0x8; + +48 + } +} + +49 +__MATH_INLINE +  + +50 +__NTH + ( + $__signb™ + ( +__x +)) + +52 #ià +__WORDSIZE + == 32 + +53 +__ex‹nsiÚ__ + uniÚ {  +__d +;  +__i +[2]; } +__u + = { __d: +__x + }; + +54  +__u +. +__i +[1] < 0; + +56  +__m +; + +57 + `__asm + ("pmovmskb %1, %0" : "ô" ( +__m +è: "x" ( +__x +)); + +58  +__m + & 0x80; + +60 + } +} + +61 +__MATH_INLINE +  + +62 +__NTH + ( + $__signb™l + ( +__x +)) + +64 +__ex‹nsiÚ__ + uniÚ {  +__l +;  +__i +[3]; } +__u + = { __l: +__x + }; + +65  ( +__u +. +__i +[2] & 0x8000) != 0; + +66 + } +} + + @/usr/include/bits/nan.h + +20 #iâdeà +_MATH_H + + +27 #ià +__GNUC_PREREQ +(3,3) + +29  + #NAN + ( + `__bužtš_Çnf + ("")) + + ) + +31 #–ià +defšed + +__GNUC__ + + +33  + #NAN + \ + +34 ( +__ex‹nsiÚ__ + \ + +35 ((uniÚ {  +__l + + `__©Œibu‹__ + (( + `__mode__ + ( +__SI__ +)));  +__d +; }) \ + +36 { +__l +: 0x7fc00000UL }). +__d +) + + ) + +40  + ~<’dŸn.h +> + +42 #ià +__BYTE_ORDER + =ð +__BIG_ENDIAN + + +43  + #__Çn_by‹s + { 0x7f, 0xc0, 0, 0 } + + ) + +45 #ià +__BYTE_ORDER + =ð +__LITTLE_ENDIAN + + +46  + #__Çn_by‹s + { 0, 0, 0xc0, 0x7à} + + ) + +49 uniÚ {  + m__c +[4];  + m__d +; } +__Çn_uniÚ + + +50 + g__©Œibu‹_u£d__ + = { +__Çn_by‹s + }; + +51  + #NAN + ( +__Çn_uniÚ +. +__d +) + + ) + + @/usr/include/bits/stdio-ldbl.h + +20 #iâdeà +_STDIO_H + + +24 +__BEGIN_NAMESPACE_STD + + +25 + $__LDBL_REDIR_DECL + ( +årštf +) + +26 + $__LDBL_REDIR_DECL + ( +´štf +) + +27 + $__LDBL_REDIR_DECL + ( +¥rštf +) + +28 + $__LDBL_REDIR_DECL + ( +vårštf +) + +29 + $__LDBL_REDIR_DECL + ( +v´štf +) + +30 + $__LDBL_REDIR_DECL + ( +v¥rštf +) + +31 #ià +defšed + +__USE_ISOC99 + && !defšed +__USE_GNU + \ + +32 && ! +defšed + +__REDIRECT + \ + +33 && ( +defšed + +__STRICT_ANSI__ + || defšed +__USE_XOPEN2K +) + +34 + $__LDBL_REDIR1_DECL + ( +fsÿnf +, +__Ædbl___isoc99_fsÿnf +) + +35 + $__LDBL_REDIR1_DECL + ( +sÿnf +, +__Ædbl___isoc99_sÿnf +) + +36 + $__LDBL_REDIR1_DECL + ( +ssÿnf +, +__Ædbl___isoc99_ssÿnf +) + +38 + $__LDBL_REDIR_DECL + ( +fsÿnf +) + +39 + $__LDBL_REDIR_DECL + ( +sÿnf +) + +40 + $__LDBL_REDIR_DECL + ( +ssÿnf +) + +42 +__END_NAMESPACE_STD + + +44 #ià +defšed + +__USE_BSD + || defšed +__USE_ISOC99 + || defšed +__USE_UNIX98 + + +45 +__BEGIN_NAMESPACE_C99 + + +46 + $__LDBL_REDIR_DECL + ( +¢´štf +) + +47 + $__LDBL_REDIR_DECL + ( +v¢´štf +) + +48 +__END_NAMESPACE_C99 + + +51 #ifdef +__USE_ISOC99 + + +52 +__BEGIN_NAMESPACE_C99 + + +53 #ià! +defšed + +__USE_GNU + && !defšed +__REDIRECT + \ + +54 && ( +defšed + +__STRICT_ANSI__ + || defšed +__USE_XOPEN2K +) + +55 + $__LDBL_REDIR1_DECL + ( +vfsÿnf +, +__Ædbl___isoc99_vfsÿnf +) + +56 + $__LDBL_REDIR1_DECL + ( +vsÿnf +, +__Ædbl___isoc99_vsÿnf +) + +57 + $__LDBL_REDIR1_DECL + ( +vssÿnf +, +__Ædbl___isoc99_vssÿnf +) + +59 + $__LDBL_REDIR_DECL + ( +vfsÿnf +) + +60 + $__LDBL_REDIR_DECL + ( +vssÿnf +) + +61 + $__LDBL_REDIR_DECL + ( +vsÿnf +) + +63 +__END_NAMESPACE_C99 + + +66 #ifdeà +__USE_GNU + + +67 + $__LDBL_REDIR_DECL + ( +vd´štf +) + +68 + $__LDBL_REDIR_DECL + ( +d´štf +) + +69 + $__LDBL_REDIR_DECL + ( +va¥rštf +) + +70 + $__LDBL_REDIR_DECL + ( +__a¥rštf +) + +71 + $__LDBL_REDIR_DECL + ( +a¥rštf +) + +72 + $__LDBL_REDIR_DECL + ( +ob¡ack_´štf +) + +73 + $__LDBL_REDIR_DECL + ( +ob¡ack_v´štf +) + +76 #ià +__USE_FORTIFY_LEVEL + > 0 && +defšed + +__ex‹º_®ways_šlše + + +77 + $__LDBL_REDIR_DECL + ( +__¥rštf_chk +) + +78 + $__LDBL_REDIR_DECL + ( +__v¥rštf_chk +) + +79 #ià +defšed + +__USE_BSD + || defšed +__USE_ISOC99 + || defšed +__USE_UNIX98 + + +80 + $__LDBL_REDIR_DECL + ( +__¢´štf_chk +) + +81 + $__LDBL_REDIR_DECL + ( +__v¢´štf_chk +) + +83 #ià +__USE_FORTIFY_LEVEL + > 1 + +84 + $__LDBL_REDIR_DECL + ( +__årštf_chk +) + +85 + $__LDBL_REDIR_DECL + ( +__´štf_chk +) + +86 + $__LDBL_REDIR_DECL + ( +__vårštf_chk +) + +87 + $__LDBL_REDIR_DECL + ( +__v´štf_chk +) + +88 #ifdeà +__USE_GNU + + +89 + $__LDBL_REDIR_DECL + ( +__a¥rštf_chk +) + +90 + $__LDBL_REDIR_DECL + ( +__va¥rštf_chk +) + +91 + $__LDBL_REDIR_DECL + ( +__d´štf_chk +) + +92 + $__LDBL_REDIR_DECL + ( +__vd´štf_chk +) + +93 + $__LDBL_REDIR_DECL + ( +__ob¡ack_´štf_chk +) + +94 + $__LDBL_REDIR_DECL + ( +__ob¡ack_v´štf_chk +) + + @/usr/include/bits/stdio.h + +20 #iâdeà +_STDIO_H + + +24 #iâdeà +__ex‹º_šlše + + +25  + #__STDIO_INLINE + +šlše + + + ) + +27  + #__STDIO_INLINE + +__ex‹º_šlše + + + ) + +31 #ifdeà +__USE_EXTERN_INLINES + + +34 #ià!( +__USE_FORTIFY_LEVEL + > 0 && +defšed + +__ex‹º_®ways_šlše +) + +36 +__STDIO_INLINE +  + +37 + $v´štf + ( +__cÚ¡ + * +__»¡riù + +__fmt +, +_G_va_li¡ + +__¬g +) + +39  + `vårštf + ( +¡dout +, +__fmt +, +__¬g +); + +40 + } +} + +44 +__STDIO_INLINE +  + +45 + $g‘ch¬ + () + +47  + `_IO_g‘c + ( +¡dš +); + +48 + } +} + +51 #ifdeà +__USE_MISC + + +53 +__STDIO_INLINE +  + +54 + $fg‘c_uÆocked + ( +FILE + * +__å +) + +56  + `_IO_g‘c_uÆocked + ( +__å +); + +57 + } +} + +61 #ià +defšed + +__USE_POSIX + || defšed +__USE_MISC + + +63 +__STDIO_INLINE +  + +64 + $g‘c_uÆocked + ( +FILE + * +__å +) + +66  + `_IO_g‘c_uÆocked + ( +__å +); + +67 + } +} + +70 +__STDIO_INLINE +  + +71 + $g‘ch¬_uÆocked + () + +73  + `_IO_g‘c_uÆocked + ( +¡dš +); + +74 + } +} + +79 +__STDIO_INLINE +  + +80 + $putch¬ + ( +__c +) + +82  + `_IO_putc + ( +__c +, +¡dout +); + +83 + } +} + +86 #ifdeà +__USE_MISC + + +88 +__STDIO_INLINE +  + +89 + $åutc_uÆocked + ( +__c +, +FILE + * +__¡»am +) + +91  + `_IO_putc_uÆocked + ( +__c +, +__¡»am +); + +92 + } +} + +96 #ià +defšed + +__USE_POSIX + || defšed +__USE_MISC + + +98 +__STDIO_INLINE +  + +99 + $putc_uÆocked + ( +__c +, +FILE + * +__¡»am +) + +101  + `_IO_putc_uÆocked + ( +__c +, +__¡»am +); + +102 + } +} + +105 +__STDIO_INLINE +  + +106 + $putch¬_uÆocked + ( +__c +) + +108  + `_IO_putc_uÆocked + ( +__c +, +¡dout +); + +109 + } +} + +113 #ifdef +__USE_GNU + + +115 +__STDIO_INLINE + +_IO_ssize_t + + +116 + $g‘lše + (** +__lš•Œ +, +size_t + * +__n +, +FILE + * +__¡»am +) + +118  + `__g‘d–im + ( +__lš•Œ +, +__n +, '\n', +__¡»am +); + +119 + } +} + +123 #ifdeà +__USE_MISC + + +125 +__STDIO_INLINE +  + +126 +__NTH + ( + $ãof_uÆocked + ( +FILE + * +__¡»am +)) + +128  + `_IO_ãof_uÆocked + ( +__¡»am +); + +129 + } +} + +132 +__STDIO_INLINE +  + +133 +__NTH + ( + $ã¼Ü_uÆocked + ( +FILE + * +__¡»am +)) + +135  + `_IO_ã¼Ü_uÆocked + ( +__¡»am +); + +136 + } +} + +142 #ià +defšed + +__USE_MISC + && defšed +__GNUC__ + && defšed +__OPTIMIZE__ + \ + +143 && ! +defšed + + g__ýlu¥lus + + +145  + #ä—d_uÆocked +( +±r +, +size +, +n +, +¡»am +) \ + +146 ( + `__ex‹nsiÚ__ + (( + `__bužtš_cÚ¡ªt_p + ( +size +è&& __bužtš_cÚ¡ªt_°( +n +) \ + +147 && ( +size_t +è( +size +è* (size_tè( +n +) <= 8 \ + +148 && ( +size_t +è( +size +) != 0) \ + +149 ? ({ * +__±r + = (*è( +±r +); \ + +150 +FILE + * +__¡»am + = ( +¡»am +); \ + +151 +size_t + +__út +; \ + +152  +__út + = ( +size_t +è( +size +è* (size_tè( +n +); \ + +153 +__út + > 0; --__cnt) \ + +155  +__c + = + `_IO_g‘c_uÆocked + ( +__¡»am +); \ + +156 ià( +__c + =ð +EOF +) \ + +158 * +__±r +++ = +__c +; \ + +160 (( +size_t +è( +size +è* (size_tè( +n +è- +__út +) \ + +161 / ( +size_t +è( +size +); }) \ + +162 : ((( + `__bužtš_cÚ¡ªt_p + ( +size +è&& ( +size_t +) (size) == 0) \ + +163 || ( + `__bužtš_cÚ¡ªt_p + ( +n +è&& ( +size_t +) (n) == 0)) \ + +165 ? ((è( +±r +), (è( +¡»am +), (è( +size +), \ + +166 (è( +n +), ( +size_t +) 0) \ + +167 : + `ä—d_uÆocked + ( +±r +, +size +, +n +, +¡»am +)))) + + ) + +169  + #fwr™e_uÆocked +( +±r +, +size +, +n +, +¡»am +) \ + +170 ( + `__ex‹nsiÚ__ + (( + `__bužtš_cÚ¡ªt_p + ( +size +è&& __bužtš_cÚ¡ªt_°( +n +) \ + +171 && ( +size_t +è( +size +è* (size_tè( +n +) <= 8 \ + +172 && ( +size_t +è( +size +) != 0) \ + +173 ? ({ cÚ¡ * +__±r + = (cÚ¡ *è( +±r +); \ + +174 +FILE + * +__¡»am + = ( +¡»am +); \ + +175 +size_t + +__út +; \ + +176  +__út + = ( +size_t +è( +size +è* (size_tè( +n +); \ + +177 +__út + > 0; --__cnt) \ + +178 ià( + `_IO_putc_uÆocked + (* +__±r +++, +__¡»am +è=ð +EOF +) \ + +180 (( +size_t +è( +size +è* (size_tè( +n +è- +__út +) \ + +181 / ( +size_t +è( +size +); }) \ + +182 : ((( + `__bužtš_cÚ¡ªt_p + ( +size +è&& ( +size_t +) (size) == 0) \ + +183 || ( + `__bužtš_cÚ¡ªt_p + ( +n +è&& ( +size_t +) (n) == 0)) \ + +185 ? ((è( +±r +), (è( +¡»am +), (è( +size +), \ + +186 (è( +n +), ( +size_t +) 0) \ + +187 : + `fwr™e_uÆocked + ( +±r +, +size +, +n +, +¡»am +)))) + + ) + +191 #undeà +__STDIO_INLINE + + + @/usr/include/bits/stdio2.h + +20 #iâdeà +_STDIO_H + + +24  + $__¥rštf_chk + (* +__»¡riù + +__s +,  +__æag +, +size_t + +__¦’ +, + +25 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...è +__THROW +; + +26  + $__v¥rštf_chk + (* +__»¡riù + +__s +,  +__æag +, +size_t + +__¦’ +, + +27 +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +28 +_G_va_li¡ + +__­ +è +__THROW +; + +30 #ifdeà +__va_¬g_·ck + + +31 +__ex‹º_®ways_šlše +  + +32 + `__NTH + ( + $¥rštf + (* +__»¡riù + +__s +, +__cÚ¡ + *__»¡riù +__fmt +, ...)) + +34  + `__bužtš___¥rštf_chk + ( +__s +, +__USE_FORTIFY_LEVEL + - 1, + +35 + `__bos + ( +__s +), +__fmt +, + `__va_¬g_·ck + ()); + +36 + } +} + +37 #–ià! +defšed + +__ýlu¥lus + + +38  + #¥rštf +( +¡r +, ...) \ + +39 + `__bužtš___¥rštf_chk + ( +¡r +, +__USE_FORTIFY_LEVEL + - 1, + `__bos + (str), \ + +40 +__VA_ARGS__ +) + + ) + +43 +__ex‹º_®ways_šlše +  + +44 +__NTH + ( + $v¥rštf + (* +__»¡riù + +__s +, +__cÚ¡ + *__»¡riù +__fmt +, + +45 +_G_va_li¡ + +__­ +)) + +47  + `__bužtš___v¥rštf_chk + ( +__s +, +__USE_FORTIFY_LEVEL + - 1, + +48 + `__bos + ( +__s +), +__fmt +, +__­ +); + +49 + } +} + +51 #ià +defšed + +__USE_BSD + || defšed +__USE_ISOC99 + || defšed +__USE_UNIX98 + + +53  + $__¢´štf_chk + (* +__»¡riù + +__s +, +size_t + +__n +,  +__æag +, + +54 +size_t + +__¦’ +, +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +55 ...è +__THROW +; + +56  + $__v¢´štf_chk + (* +__»¡riù + +__s +, +size_t + +__n +,  +__æag +, + +57 +size_t + +__¦’ +, +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +58 +_G_va_li¡ + +__­ +è +__THROW +; + +60 #ifdeà +__va_¬g_·ck + + +61 +__ex‹º_®ways_šlše +  + +62 + `__NTH + ( + $¢´štf + (* +__»¡riù + +__s +, +size_t + +__n +, + +63 +__cÚ¡ + * +__»¡riù + +__fmt +, ...)) + +65  + `__bužtš___¢´štf_chk + ( +__s +, +__n +, +__USE_FORTIFY_LEVEL + - 1, + +66 + `__bos + ( +__s +), +__fmt +, + `__va_¬g_·ck + ()); + +67 + } +} + +68 #–ià! +defšed + +__ýlu¥lus + + +69  + #¢´štf +( +¡r +, +Ën +, ...) \ + +70 + `__bužtš___¢´štf_chk + ( +¡r +, +Ën +, +__USE_FORTIFY_LEVEL + - 1, + `__bos + (str), \ + +71 +__VA_ARGS__ +) + + ) + +74 +__ex‹º_®ways_šlše +  + +75 +__NTH + ( + $v¢´štf + (* +__»¡riù + +__s +, +size_t + +__n +, + +76 +__cÚ¡ + * +__»¡riù + +__fmt +, +_G_va_li¡ + +__­ +)) + +78  + `__bužtš___v¢´štf_chk + ( +__s +, +__n +, +__USE_FORTIFY_LEVEL + - 1, + +79 + `__bos + ( +__s +), +__fmt +, +__­ +); + +80 + } +} + +84 #ià +__USE_FORTIFY_LEVEL + > 1 + +86  +__årštf_chk + ( +FILE + * +__»¡riù + +__¡»am +,  +__æag +, + +87 +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...); + +88  +__´štf_chk + ( +__æag +, +__cÚ¡ + * +__»¡riù + +__fÜm© +, ...); + +89  +__vårštf_chk + ( +FILE + * +__»¡riù + +__¡»am +,  +__æag +, + +90 +__cÚ¡ + * +__»¡riù + +__fÜm© +, +_G_va_li¡ + +__­ +); + +91  +__v´štf_chk + ( +__æag +, +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +92 +_G_va_li¡ + +__­ +); + +94 #ifdeà +__va_¬g_·ck + + +95 +__ex‹º_®ways_šlše +  + +96 + $årštf + ( +FILE + * +__»¡riù + +__¡»am +, +__cÚ¡ + *__»¡riù +__fmt +, ...) + +98  + `__årštf_chk + ( +__¡»am +, +__USE_FORTIFY_LEVEL + - 1, +__fmt +, + +99 + `__va_¬g_·ck + ()); + +100 + } +} + +102 +__ex‹º_®ways_šlše +  + +103 + $´štf + ( +__cÚ¡ + * +__»¡riù + +__fmt +, ...) + +105  + `__´štf_chk + ( +__USE_FORTIFY_LEVEL + - 1, +__fmt +, + `__va_¬g_·ck + ()); + +106 + } +} + +107 #–ià! +defšed + +__ýlu¥lus + + +108  + #´štf +(...) \ + +109 + `__´štf_chk + ( +__USE_FORTIFY_LEVEL + - 1, +__VA_ARGS__ +) + + ) + +110  + #årštf +( +¡»am +, ...) \ + +111 + `__årštf_chk + ( +¡»am +, +__USE_FORTIFY_LEVEL + - 1, +__VA_ARGS__ +) + + ) + +114 +__ex‹º_®ways_šlše +  + +115 + $v´štf + ( +__cÚ¡ + * +__»¡riù + +__fmt +, +_G_va_li¡ + +__­ +) + +117 #ifdeà +__USE_EXTERN_INLINES + + +118  + `__vårštf_chk + ( +¡dout +, +__USE_FORTIFY_LEVEL + - 1, +__fmt +, +__­ +); + +120  + `__v´štf_chk + ( +__USE_FORTIFY_LEVEL + - 1, +__fmt +, +__­ +); + +122 + } +} + +124 +__ex‹º_®ways_šlše +  + +125 + $vårštf + ( +FILE + * +__»¡riù + +__¡»am +, + +126 +__cÚ¡ + * +__»¡riù + +__fmt +, +_G_va_li¡ + +__­ +) + +128  + `__vårštf_chk + ( +__¡»am +, +__USE_FORTIFY_LEVEL + - 1, +__fmt +, +__­ +); + +129 + } +} + +131 #ifdeà +__USE_GNU + + +133  + $__a¥rštf_chk + (** +__»¡riù + +__±r +,  +__æag +, + +134 +__cÚ¡ + * +__»¡riù + +__fmt +, ...) + +135 +__THROW + + `__©Œibu‹__ + (( + $__fÜm©__ + ( +__´štf__ +, 3, 4))è +__wur +; + +136  + $__va¥rštf_chk + (** +__»¡riù + +__±r +,  +__æag +, + +137 +__cÚ¡ + * +__»¡riù + +__fmt +, +_G_va_li¡ + +__¬g +) + +138 +__THROW + + `__©Œibu‹__ + (( + $__fÜm©__ + ( +__´štf__ +, 3, 0))è +__wur +; + +139  + $__d´štf_chk + ( +__fd +,  +__æag +, +__cÚ¡ + * +__»¡riù + +__fmt +, + +140 ...è + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__´štf__ +, 3, 4))); + +141  + $__vd´štf_chk + ( +__fd +,  +__æag +, + +142 +__cÚ¡ + * +__»¡riù + +__fmt +, +_G_va_li¡ + +__¬g +) + +143 + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__´štf__ +, 3, 0))); + +144  + $__ob¡ack_´štf_chk + ( +ob¡ack + * +__»¡riù + +__ob¡ack +, + +145  +__æag +, +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +147 +__THROW + + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__´štf__ +, 3, 4))); + +148  + $__ob¡ack_v´štf_chk + ( +ob¡ack + * +__»¡riù + +__ob¡ack +, + +149  +__æag +, + +150 +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +151 +_G_va_li¡ + +__¬gs +) + +152 +__THROW + + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__´štf__ +, 3, 0))); + +154 #ifdeà +__va_¬g_·ck + + +155 +__ex‹º_®ways_šlše +  + +156 + `__NTH + ( + $a¥rštf + (** +__»¡riù + +__±r +, +__cÚ¡ + *__»¡riù +__fmt +, ...)) + +158  + `__a¥rštf_chk + ( +__±r +, +__USE_FORTIFY_LEVEL + - 1, +__fmt +, + +159 + `__va_¬g_·ck + ()); + +160 + } +} + +162 +__ex‹º_®ways_šlše +  + +163 +__NTH + ( + $__a¥rštf + (** +__»¡riù + +__±r +, +__cÚ¡ + *__»¡riù +__fmt +, + +166  + `__a¥rštf_chk + ( +__±r +, +__USE_FORTIFY_LEVEL + - 1, +__fmt +, + +167 + `__va_¬g_·ck + ()); + +168 + } +} + +170 +__ex‹º_®ways_šlše +  + +171 + $d´štf + ( +__fd +, +__cÚ¡ + * +__»¡riù + +__fmt +, ...) + +173  + `__d´štf_chk + ( +__fd +, +__USE_FORTIFY_LEVEL + - 1, +__fmt +, + +174 + `__va_¬g_·ck + ()); + +175 + } +} + +177 +__ex‹º_®ways_šlše +  + +178 +__NTH + ( + $ob¡ack_´štf + ( +ob¡ack + * +__»¡riù + +__ob¡ack +, + +179 +__cÚ¡ + * +__»¡riù + +__fmt +, ...)) + +181  + `__ob¡ack_´štf_chk + ( +__ob¡ack +, +__USE_FORTIFY_LEVEL + - 1, +__fmt +, + +182 + `__va_¬g_·ck + ()); + +183 + } +} + +184 #–ià! +defšed + +__ýlu¥lus + + +185  + #a¥rštf +( +±r +, ...) \ + +186 + `__a¥rštf_chk + ( +±r +, +__USE_FORTIFY_LEVEL + - 1, +__VA_ARGS__ +) + + ) + +187  + #__a¥rštf +( +±r +, ...) \ + +188 + `__a¥rštf_chk + ( +±r +, +__USE_FORTIFY_LEVEL + - 1, +__VA_ARGS__ +) + + ) + +189  + #d´štf +( +fd +, ...) \ + +190 + `__d´štf_chk + ( +fd +, +__USE_FORTIFY_LEVEL + - 1, +__VA_ARGS__ +) + + ) + +191  + #ob¡ack_´štf +( +ob¡ack +, ...) \ + +192 + `__ob¡ack_´štf_chk + ( +ob¡ack +, +__USE_FORTIFY_LEVEL + - 1, +__VA_ARGS__ +) + + ) + +195 +__ex‹º_®ways_šlše +  + +196 +__NTH + ( + $va¥rštf + (** +__»¡riù + +__±r +, +__cÚ¡ + *__»¡riù +__fmt +, + +197 +_G_va_li¡ + +__­ +)) + +199  + `__va¥rštf_chk + ( +__±r +, +__USE_FORTIFY_LEVEL + - 1, +__fmt +, +__­ +); + +200 + } +} + +202 +__ex‹º_®ways_šlše +  + +203 + $vd´štf + ( +__fd +, +__cÚ¡ + * +__»¡riù + +__fmt +, +_G_va_li¡ + +__­ +) + +205  + `__vd´štf_chk + ( +__fd +, +__USE_FORTIFY_LEVEL + - 1, +__fmt +, +__­ +); + +206 + } +} + +208 +__ex‹º_®ways_šlše +  + +209 +__NTH + ( + $ob¡ack_v´štf + ( +ob¡ack + * +__»¡riù + +__ob¡ack +, + +210 +__cÚ¡ + * +__»¡riù + +__fmt +, +_G_va_li¡ + +__­ +)) + +212  + `__ob¡ack_v´štf_chk + ( +__ob¡ack +, +__USE_FORTIFY_LEVEL + - 1, +__fmt +, + +213 +__­ +); + +214 + } +} + +220 * + $__g‘s_chk + (* +__¡r +, +size_t +è +__wur +; + +221 * + `__REDIRECT + ( +__g‘s_w¬n +, (* +__¡r +), +g‘s +) + +222 +__wur + + `__w¬Ç‰r + ("please use fgets or getline instead, gets can't " + +225 +__ex‹º_®ways_šlše + +__wur + * + +226 + $g‘s + (* +__¡r +) + +228 ià( + `__bos + ( +__¡r +è!ð( +size_t +) -1) + +229  + `__g‘s_chk + ( +__¡r +, + `__bos + (__str)); + +230  + `__g‘s_w¬n + ( +__¡r +); + +231 + } +} + +233 * + $__fg‘s_chk + (* +__»¡riù + +__s +, +size_t + +__size +,  +__n +, + +234 +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +235 * + `__REDIRECT + ( +__fg‘s_®Ÿs +, + +236 (* +__»¡riù + +__s +,  +__n +, + +237 +FILE + * +__»¡riù + +__¡»am +), +fg‘s +è +__wur +; + +238 * + `__REDIRECT + ( +__fg‘s_chk_w¬n +, + +239 (* +__»¡riù + +__s +, +size_t + +__size +,  +__n +, + +240 +FILE + * +__»¡riù + +__¡»am +), +__fg‘s_chk +) + +241 +__wur + + `__w¬Ç‰r + ("fgets called with bigger sizehan†ength " + +244 +__ex‹º_®ways_šlše + +__wur + * + +245 + $fg‘s + (* +__»¡riù + +__s +,  +__n +, +FILE + *__»¡riù +__¡»am +) + +247 ià( + `__bos + ( +__s +è!ð( +size_t +) -1) + +249 ià(! + `__bužtš_cÚ¡ªt_p + ( +__n +) || __n <= 0) + +250  + `__fg‘s_chk + ( +__s +, + `__bos + (__s), +__n +, +__¡»am +); + +252 ià(( +size_t +è +__n + > + `__bos + ( +__s +)) + +253  + `__fg‘s_chk_w¬n + ( +__s +, + `__bos + (__s), +__n +, +__¡»am +); + +255  + `__fg‘s_®Ÿs + ( +__s +, +__n +, +__¡»am +); + +256 + } +} + +258 +size_t + + $__ä—d_chk + (* +__»¡riù + +__±r +, +size_t + +__±¾’ +, + +259 +size_t + +__size +, size_ˆ +__n +, + +260 +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +261 +size_t + + `__REDIRECT + ( +__ä—d_®Ÿs +, + +262 (* +__»¡riù + +__±r +, +size_t + +__size +, + +263 +size_t + +__n +, +FILE + * +__»¡riù + +__¡»am +), + +264 +ä—d +è +__wur +; + +265 +size_t + + `__REDIRECT + ( +__ä—d_chk_w¬n +, + +266 (* +__»¡riù + +__±r +, +size_t + +__±¾’ +, + +267 +size_t + +__size +, size_ˆ +__n +, + +268 +FILE + * +__»¡riù + +__¡»am +), + +269 +__ä—d_chk +) + +270 +__wur + + `__w¬Ç‰r + ("fread called with bigger size *‚membhan†ength " + +273 +__ex‹º_®ways_šlše + +__wur + +size_t + + +274 + $ä—d + (* +__»¡riù + +__±r +, +size_t + +__size +, size_ˆ +__n +, + +275 +FILE + * +__»¡riù + +__¡»am +) + +277 ià( + `__bos0 + ( +__±r +è!ð( +size_t +) -1) + +279 ià(! + `__bužtš_cÚ¡ªt_p + ( +__size +) + +280 || ! + `__bužtš_cÚ¡ªt_p + ( +__n +) + +281 || ( +__size + | +__n +è>ð((( +size_t +) 1) << (8 *  (size_t) / 2))) + +282  + `__ä—d_chk + ( +__±r +, + `__bos0 + (__±r), +__size +, +__n +, +__¡»am +); + +284 ià( +__size + * +__n + > + `__bos0 + ( +__±r +)) + +285  + `__ä—d_chk_w¬n + ( +__±r +, + `__bos0 + (__±r), +__size +, +__n +, +__¡»am +); + +287  + `__ä—d_®Ÿs + ( +__±r +, +__size +, +__n +, +__¡»am +); + +288 + } +} + +290 #ifdeà +__USE_GNU + + +291 * + $__fg‘s_uÆocked_chk + (* +__»¡riù + +__s +, +size_t + +__size +, + +292  +__n +, +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +293 * + `__REDIRECT + ( +__fg‘s_uÆocked_®Ÿs +, + +294 (* +__»¡riù + +__s +,  +__n +, + +295 +FILE + * +__»¡riù + +__¡»am +), +fg‘s_uÆocked +è +__wur +; + +296 * + `__REDIRECT + ( +__fg‘s_uÆocked_chk_w¬n +, + +297 (* +__»¡riù + +__s +, +size_t + +__size +,  +__n +, + +298 +FILE + * +__»¡riù + +__¡»am +), +__fg‘s_uÆocked_chk +) + +299 +__wur + + `__w¬Ç‰r + ("fgets_unlocked called with bigger sizehan†ength " + +302 +__ex‹º_®ways_šlše + +__wur + * + +303 + $fg‘s_uÆocked + (* +__»¡riù + +__s +,  +__n +, +FILE + *__»¡riù +__¡»am +) + +305 ià( + `__bos + ( +__s +è!ð( +size_t +) -1) + +307 ià(! + `__bužtš_cÚ¡ªt_p + ( +__n +) || __n <= 0) + +308  + `__fg‘s_uÆocked_chk + ( +__s +, + `__bos + (__s), +__n +, +__¡»am +); + +310 ià(( +size_t +è +__n + > + `__bos + ( +__s +)) + +311  + `__fg‘s_uÆocked_chk_w¬n + ( +__s +, + `__bos + (__s), +__n +, +__¡»am +); + +313  + `__fg‘s_uÆocked_®Ÿs + ( +__s +, +__n +, +__¡»am +); + +314 + } +} + +317 #ifdeà +__USE_MISC + + +318 #undeà +ä—d_uÆocked + + +319 +size_t + + $__ä—d_uÆocked_chk + (* +__»¡riù + +__±r +, +size_t + +__±¾’ +, + +320 +size_t + +__size +, size_ˆ +__n +, + +321 +FILE + * +__»¡riù + +__¡»am +è +__wur +; + +322 +size_t + + `__REDIRECT + ( +__ä—d_uÆocked_®Ÿs +, + +323 (* +__»¡riù + +__±r +, +size_t + +__size +, + +324 +size_t + +__n +, +FILE + * +__»¡riù + +__¡»am +), + +325 +ä—d_uÆocked +è +__wur +; + +326 +size_t + + `__REDIRECT + ( +__ä—d_uÆocked_chk_w¬n +, + +327 (* +__»¡riù + +__±r +, +size_t + +__±¾’ +, + +328 +size_t + +__size +, size_ˆ +__n +, + +329 +FILE + * +__»¡riù + +__¡»am +), + +330 +__ä—d_uÆocked_chk +) + +331 +__wur + + `__w¬Ç‰r + ("fread_unlocked called with bigger size *‚membhan " + +334 +__ex‹º_®ways_šlše + +__wur + +size_t + + +335 + $ä—d_uÆocked + (* +__»¡riù + +__±r +, +size_t + +__size +, size_ˆ +__n +, + +336 +FILE + * +__»¡riù + +__¡»am +) + +338 ià( + `__bos0 + ( +__±r +è!ð( +size_t +) -1) + +340 ià(! + `__bužtš_cÚ¡ªt_p + ( +__size +) + +341 || ! + `__bužtš_cÚ¡ªt_p + ( +__n +) + +342 || ( +__size + | +__n +è>ð((( +size_t +) 1) << (8 *  (size_t) / 2))) + +343  + `__ä—d_uÆocked_chk + ( +__±r +, + `__bos0 + (__±r), +__size +, +__n +, + +344 +__¡»am +); + +346 ià( +__size + * +__n + > + `__bos0 + ( +__±r +)) + +347  + `__ä—d_uÆocked_chk_w¬n + ( +__±r +, + `__bos0 + (__±r), +__size +, +__n +, + +348 +__¡»am +); + +351 #ifdeà +__USE_EXTERN_INLINES + + +352 ià( + `__bužtš_cÚ¡ªt_p + ( +__size +) + +353 && + `__bužtš_cÚ¡ªt_p + ( +__n +) + +354 && ( +__size + | +__n +è< ((( +size_t +) 1) << (8 *  (size_t) / 2)) + +355 && +__size + * +__n + <= 8) + +357 +size_t + +__út + = +__size + * +__n +; + +358 * +__ýŒ + = (*è +__±r +; + +359 ià( +__út + == 0) + +362 ; +__út + > 0; --__cnt) + +364  +__c + = + `_IO_g‘c_uÆocked + ( +__¡»am +); + +365 ià( +__c + =ð +EOF +) + +367 * +__ýŒ +++ = +__c +; + +369  ( +__ýŒ + - (*è +__±r +è/ +__size +; + +372  + `__ä—d_uÆocked_®Ÿs + ( +__±r +, +__size +, +__n +, +__¡»am +); + +373 + } +} + + @/usr/include/bits/stdio_lim.h + +19 #ià! +defšed + +_STDIO_H + && !defšed +__Ãed_FOPEN_MAX + && !defšed +__Ãed_IOV_MAX + + +23 #ifdeà +_STDIO_H + + +24  + #L_tm²am + 20 + + ) + +25  + #TMP_MAX + 238328 + + ) + +26  + #FILENAME_MAX + 4096 + + ) + +28 #ifdeà +__USE_POSIX + + +29  + #L_ù”mid + 9 + + ) + +30 #ià! +defšed + +__USE_XOPEN2K + || defšed +__USE_GNU + + +31  + #L_cu£rid + 9 + + ) + +36 #ià +defšed + +__Ãed_FOPEN_MAX + || defšed +_STDIO_H + + +37 #undeà +FOPEN_MAX + + +38  + #FOPEN_MAX + 16 + + ) + +41 #ià +defšed + +__Ãed_IOV_MAX + && !defšed +IOV_MAX + + +42  + #IOV_MAX + 1024 + + ) + + @/usr/include/bits/string.h + +20 #iâdeà +_STRING_H + + +26  + #_STRING_ARCH_uÇligÃd + 1 + + ) + + @/usr/include/bits/string2.h + +21 #iâdeà +_STRING_H + + +25 #ià! +defšed + +__NO_STRING_INLINES + && !defšed +__BOUNDED_POINTERS__ + + +42 #iâdeà +__STRING_INLINE + + +43 #ifdeà +__ýlu¥lus + + +44  + #__STRING_INLINE + +šlše + + + ) + +46  + #__STRING_INLINE + +__ex‹º_šlše + + + ) + +50 #ià +_STRING_ARCH_uÇligÃd + + +52  + ~<’dŸn.h +> + +53  + ~ + +55 #ià +__BYTE_ORDER + =ð +__LITTLE_ENDIAN + + +56  + #__STRING2_SMALL_GET16 +( +¤c +, +idx +) \ + +57 ((( +__cÚ¡ + *è(__cÚ¡ *è( +¤c +))[ +idx + + 1] << 8 \ + +58 | (( +__cÚ¡ + *è(__cÚ¡ *è( +¤c +))[ +idx +]) + + ) + +59  + #__STRING2_SMALL_GET32 +( +¤c +, +idx +) \ + +60 ((((( +__cÚ¡ + *è(__cÚ¡ *è( +¤c +))[ +idx + + 3] << 8 \ + +61 | (( +__cÚ¡ + *è(__cÚ¡ *è( +¤c +))[ +idx + + 2]) << 8 \ + +62 | (( +__cÚ¡ + *è(__cÚ¡ *è( +¤c +))[ +idx + + 1]) << 8 \ + +63 | (( +__cÚ¡ + *è(__cÚ¡ *è( +¤c +))[ +idx +]) + + ) + +65  + #__STRING2_SMALL_GET16 +( +¤c +, +idx +) \ + +66 ((( +__cÚ¡ + *è(__cÚ¡ *è( +¤c +))[ +idx +] << 8 \ + +67 | (( +__cÚ¡ + *è(__cÚ¡ *è( +¤c +))[ +idx + + 1]) + + ) + +68  + #__STRING2_SMALL_GET32 +( +¤c +, +idx +) \ + +69 ((((( +__cÚ¡ + *è(__cÚ¡ *è( +¤c +))[ +idx +] << 8 \ + +70 | (( +__cÚ¡ + *è(__cÚ¡ *è( +¤c +))[ +idx + + 1]) << 8 \ + +71 | (( +__cÚ¡ + *è(__cÚ¡ *è( +¤c +))[ +idx + + 2]) << 8 \ + +72 | (( +__cÚ¡ + *è(__cÚ¡ *è( +¤c +))[ +idx + + 3]) + + ) + +77  + #__STRING2_COPY_TYPE +( +N +) \ + +78 ¡ruù {  +__¬r +[ +N +]; } \ + +79 + t__©Œibu‹__ + (( + t__·cked__ +)è + t__STRING2_COPY_ARR +## + tN + + + ) + +80 + t__STRING2_COPY_TYPE + (2); + +81 +__STRING2_COPY_TYPE + (3); + +82 +__STRING2_COPY_TYPE + (4); + +83 +__STRING2_COPY_TYPE + (5); + +84 +__STRING2_COPY_TYPE + (6); + +85 +__STRING2_COPY_TYPE + (7); + +86 +__STRING2_COPY_TYPE + (8); + +87 #undeà +__STRING2_COPY_TYPE + + +93  + #__¡ršg2_1b±r_p +( +__x +) \ + +94 (( +size_t +)(cÚ¡ *)(( +__x +è+ 1è- (size_t)(cÚ¡ *)(__xè=ð1) + + ) + +97 #ià! +defšed + +_HAVE_STRING_ARCH_mem£t + + +98 #ià! +__GNUC_PREREQ + (3, 0) + +99 #ià +_STRING_ARCH_uÇligÃd + + +100  + #mem£t +( +s +, +c +, +n +) \ + +101 ( + `__ex‹nsiÚ__ + ( + `__bužtš_cÚ¡ªt_p + ( +n +) && (n) <= 16 \ + +102 ? (( +n +) == 1 \ + +103 ? + `__mem£t_1 + ( +s +, +c +) \ + +104 : + `__mem£t_gc + ( +s +, +c +, +n +)) \ + +105 : ( + `__bužtš_cÚ¡ªt_p + ( +c +) && (c) == '\0' \ + +106 ? ({ * +__s + = ( +s +); + `__bz”o + (__s, +n +); __s; }) \ + +107 : + `mem£t + ( +s +, +c +, +n +)))) + + ) + +109  + #__mem£t_1 +( +s +, +c +è({ * +__s + = (s); \ + +110 *(( +__ušt8_t + *è +__s +èð(__ušt8_tè +c +; __s; }) + + ) + +112  + #__mem£t_gc +( +s +, +c +, +n +) \ + +113 ({ * +__s + = ( +s +); \ + +115  +__ui +; \ + +116  +__usi +; \ + +117  +__uc +; \ + +118 } * +__u + = +__s +; \ + +119 +__ušt8_t + +__c + = (__ušt8_tè( +c +); \ + +122 (è( +n +)) \ + +125 +__u +-> +__ui + = +__c + * 0x01010101; \ + +126 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 4); \ + +128 +__u +-> +__ui + = +__c + * 0x01010101; \ + +129 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 4); \ + +131 +__u +-> +__ui + = +__c + * 0x01010101; \ + +132 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 4); \ + +134 +__u +-> +__usi + = (è +__c + * 0x0101; \ + +135 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 2); \ + +136 +__u +-> +__uc + = (è +__c +; \ + +140 +__u +-> +__ui + = +__c + * 0x01010101; \ + +141 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 4); \ + +143 +__u +-> +__ui + = +__c + * 0x01010101; \ + +144 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 4); \ + +146 +__u +-> +__ui + = +__c + * 0x01010101; \ + +147 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 4); \ + +149 +__u +-> +__usi + = (è +__c + * 0x0101; \ + +153 +__u +-> +__ui + = +__c + * 0x01010101; \ + +154 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 4); \ + +156 +__u +-> +__ui + = +__c + * 0x01010101; \ + +157 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 4); \ + +159 +__u +-> +__ui + = +__c + * 0x01010101; \ + +160 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 4); \ + +162 +__u +-> +__uc + = (è +__c +; \ + +166 +__u +-> +__ui + = +__c + * 0x01010101; \ + +167 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 4); \ + +169 +__u +-> +__ui + = +__c + * 0x01010101; \ + +170 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 4); \ + +172 +__u +-> +__ui + = +__c + * 0x01010101; \ + +173 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 4); \ + +175 +__u +-> +__ui + = +__c + * 0x01010101; \ + +180 +__s +; }) + + ) + +182  + #mem£t +( +s +, +c +, +n +) \ + +183 ( + `__ex‹nsiÚ__ + ( + `__bužtš_cÚ¡ªt_p + ( +c +) && (c) == '\0' \ + +184 ? ({ * +__s + = ( +s +); + `__bz”o + (__s, +n +); __s; }) \ + +185 : + `mem£t + ( +s +, +c +, +n +))) + + ) + +194 #ià +__GNUC_PREREQ + (2, 91) + +195  + #__bz”o +( +s +, +n +è + `__bužtš_mem£t + (s, '\0',‚) + + ) + +203 #ifdeà +__USE_GNU + + +204 #ià! +defšed + +_HAVE_STRING_ARCH_mempýy + || defšed +_FORCE_INLINES + + +205 #iâdeà +_HAVE_STRING_ARCH_mempýy + + +206 #ià +__GNUC_PREREQ + (3, 4) + +207  + #__mempýy +( +de¡ +, +¤c +, +n +è + `__bužtš_mempýy + (de¡, src,‚) + + ) + +208 #–ià +__GNUC_PREREQ + (3, 0) + +209  + #__mempýy +( +de¡ +, +¤c +, +n +) \ + +210 ( + `__ex‹nsiÚ__ + ( + `__bužtš_cÚ¡ªt_p + ( +¤c +è&& __bužtš_cÚ¡ªt_°( +n +) \ + +211 && + `__¡ršg2_1b±r_p + ( +¤c +è&& +n + <= 8 \ + +212 ? + `__bužtš_memýy + ( +de¡ +, +¤c +, +n +) + (n) \ + +213 : + `__mempýy + ( +de¡ +, +¤c +, +n +))) + + ) + +215  + #__mempýy +( +de¡ +, +¤c +, +n +) \ + +216 ( + `__ex‹nsiÚ__ + ( + `__bužtš_cÚ¡ªt_p + ( +¤c +è&& __bužtš_cÚ¡ªt_°( +n +) \ + +217 && + `__¡ršg2_1b±r_p + ( +¤c +è&& +n + <= 8 \ + +218 ? + `__mempýy_sm®l + ( +de¡ +, + `__mempýy_¬gs + ( +¤c +), +n +) \ + +219 : + `__mempýy + ( +de¡ +, +¤c +, +n +))) + + ) + +223  + #mempýy +( +de¡ +, +¤c +, +n +è + `__mempýy + (de¡, src,‚) + + ) + +226 #ià! +__GNUC_PREREQ + (3, 0è|| +defšed + +_FORCE_INLINES + + +227 #ià +_STRING_ARCH_uÇligÃd + + +228 #iâdeà +_FORCE_INLINES + + +229  + #__mempýy_¬gs +( +¤c +) \ + +230 (( +__cÚ¡ + *è( +¤c +))[0], ((__const *) (src))[2], \ + +231 (( +__cÚ¡ + *è( +¤c +))[4], ((__const *) (src))[6], \ + +232 +__ex‹nsiÚ__ + + `__STRING2_SMALL_GET16 + ( +¤c +, 0), \ + +233 +__ex‹nsiÚ__ + + `__STRING2_SMALL_GET16 + ( +¤c +, 4), \ + +234 +__ex‹nsiÚ__ + + `__STRING2_SMALL_GET32 + ( +¤c +, 0), \ + +235 +__ex‹nsiÚ__ + + `__STRING2_SMALL_GET32 + ( +¤c +, 4) + + ) + +237 +__STRING_INLINE + * +__mempýy_sm®l + (*, , , , , + +238 +__ušt16_t +, __ušt16_t, +__ušt32_t +, + +239 +__ušt32_t +, +size_t +); + +240 +__STRING_INLINE + * + +241 + $__mempýy_sm®l + (* +__de¡1 +, + +242  +__¤c0_1 +,  +__¤c2_1 +,  +__¤c4_1 +,  +__¤c6_1 +, + +243 +__ušt16_t + +__¤c0_2 +, __ušt16_ˆ +__¤c4_2 +, + +244 +__ušt32_t + +__¤c0_4 +, __ušt32_ˆ +__¤c4_4 +, + +245 +size_t + +__¤þ’ +) + +248 +__ušt32_t + +__ui +; + +249 +__ušt16_t + +__usi +; + +250  +__uc +; + +251  +__c +; + +252 } * +__u + = +__de¡1 +; + +253 (è +__¤þ’ +) + +256 +__u +-> +__c + = +__¤c0_1 +; + +257 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 1); + +260 +__u +-> +__usi + = +__¤c0_2 +; + +261 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 2); + +264 +__u +-> +__usi + = +__¤c0_2 +; + +265 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 2); + +266 +__u +-> +__c + = +__¤c2_1 +; + +267 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 1); + +270 +__u +-> +__ui + = +__¤c0_4 +; + +271 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 4); + +274 +__u +-> +__ui + = +__¤c0_4 +; + +275 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 4); + +276 +__u +-> +__c + = +__¤c4_1 +; + +277 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 1); + +280 +__u +-> +__ui + = +__¤c0_4 +; + +281 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 4); + +282 +__u +-> +__usi + = +__¤c4_2 +; + +283 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 2); + +286 +__u +-> +__ui + = +__¤c0_4 +; + +287 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 4); + +288 +__u +-> +__usi + = +__¤c4_2 +; + +289 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 2); + +290 +__u +-> +__c + = +__¤c6_1 +; + +291 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 1); + +294 +__u +-> +__ui + = +__¤c0_4 +; + +295 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 4); + +296 +__u +-> +__ui + = +__¤c4_4 +; + +297 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 4); + +300  (*è +__u +; + +301 + } +} + +303 #iâdeà +_FORCE_INLINES + + +304  + #__mempýy_¬gs +( +¤c +) \ + +305 (( +__cÚ¡ + *è( +¤c +))[0], \ + +306 + `__ex‹nsiÚ__ + (( +__STRING2_COPY_ARR2 +) \ + +307 { { (( +__cÚ¡ + *è( +¤c +))[0], ((__const *) (src))[1] } }), \ + +308 + `__ex‹nsiÚ__ + (( +__STRING2_COPY_ARR3 +) \ + +309 { { (( +__cÚ¡ + *è( +¤c +))[0], ((__const *) (src))[1], \ + +310 (( +__cÚ¡ + *è( +¤c +))[2] } }), \ + +311 + `__ex‹nsiÚ__ + (( +__STRING2_COPY_ARR4 +) \ + +312 { { (( +__cÚ¡ + *è( +¤c +))[0], ((__const *) (src))[1], \ + +313 (( +__cÚ¡ + *è( +¤c +))[2], ((__const *) (src))[3] } }), \ + +314 + `__ex‹nsiÚ__ + (( +__STRING2_COPY_ARR5 +) \ + +315 { { (( +__cÚ¡ + *è( +¤c +))[0], ((__const *) (src))[1], \ + +316 (( +__cÚ¡ + *è( +¤c +))[2], ((__const *) (src))[3], \ + +317 (( +__cÚ¡ + *è( +¤c +))[4] } }), \ + +318 + `__ex‹nsiÚ__ + (( +__STRING2_COPY_ARR6 +) \ + +319 { { (( +__cÚ¡ + *è( +¤c +))[0], ((__const *) (src))[1], \ + +320 (( +__cÚ¡ + *è( +¤c +))[2], ((__const *) (src))[3], \ + +321 (( +__cÚ¡ + *è( +¤c +))[4], ((__const *) (src))[5] } }), \ + +322 + `__ex‹nsiÚ__ + (( +__STRING2_COPY_ARR7 +) \ + +323 { { (( +__cÚ¡ + *è( +¤c +))[0], ((__const *) (src))[1], \ + +324 (( +__cÚ¡ + *è( +¤c +))[2], ((__const *) (src))[3], \ + +325 (( +__cÚ¡ + *è( +¤c +))[4], ((__const *) (src))[5], \ + +326 (( +__cÚ¡ + *è( +¤c +))[6] } }), \ + +327 + `__ex‹nsiÚ__ + (( +__STRING2_COPY_ARR8 +) \ + +328 { { (( +__cÚ¡ + *è( +¤c +))[0], ((__const *) (src))[1], \ + +329 (( +__cÚ¡ + *è( +¤c +))[2], ((__const *) (src))[3], \ + +330 (( +__cÚ¡ + *è( +¤c +))[4], ((__const *) (src))[5], \ + +331 (( +__cÚ¡ + *è( +¤c +))[6], ((__cÚ¡ *è(¤c))[7] } }) + + ) + +333 +__STRING_INLINE + * +__mempýy_sm®l + (*, , +__STRING2_COPY_ARR2 +, + +334 +__STRING2_COPY_ARR3 +, + +335 +__STRING2_COPY_ARR4 +, + +336 +__STRING2_COPY_ARR5 +, + +337 +__STRING2_COPY_ARR6 +, + +338 +__STRING2_COPY_ARR7 +, + +339 +__STRING2_COPY_ARR8 +, +size_t +); + +340 +__STRING_INLINE + * + +341 + $__mempýy_sm®l + (* +__de¡ +,  +__¤c1 +, + +342 +__STRING2_COPY_ARR2 + +__¤c2 +, +__STRING2_COPY_ARR3 + +__¤c3 +, + +343 +__STRING2_COPY_ARR4 + +__¤c4 +, +__STRING2_COPY_ARR5 + +__¤c5 +, + +344 +__STRING2_COPY_ARR6 + +__¤c6 +, +__STRING2_COPY_ARR7 + +__¤c7 +, + +345 +__STRING2_COPY_ARR8 + +__¤c8 +, +size_t + +__¤þ’ +) + +348  +__c +; + +349 +__STRING2_COPY_ARR2 + +__sÿ2 +; + +350 +__STRING2_COPY_ARR3 + +__sÿ3 +; + +351 +__STRING2_COPY_ARR4 + +__sÿ4 +; + +352 +__STRING2_COPY_ARR5 + +__sÿ5 +; + +353 +__STRING2_COPY_ARR6 + +__sÿ6 +; + +354 +__STRING2_COPY_ARR7 + +__sÿ7 +; + +355 +__STRING2_COPY_ARR8 + +__sÿ8 +; + +356 } * +__u + = +__de¡ +; + +357 (è +__¤þ’ +) + +360 +__u +-> +__c + = +__¤c1 +; + +363 +__ex‹nsiÚ__ + +__u +-> +__sÿ2 + = +__¤c2 +; + +366 +__ex‹nsiÚ__ + +__u +-> +__sÿ3 + = +__¤c3 +; + +369 +__ex‹nsiÚ__ + +__u +-> +__sÿ4 + = +__¤c4 +; + +372 +__ex‹nsiÚ__ + +__u +-> +__sÿ5 + = +__¤c5 +; + +375 +__ex‹nsiÚ__ + +__u +-> +__sÿ6 + = +__¤c6 +; + +378 +__ex‹nsiÚ__ + +__u +-> +__sÿ7 + = +__¤c7 +; + +381 +__ex‹nsiÚ__ + +__u +-> +__sÿ8 + = +__¤c8 +; + +384  + `__ex‹nsiÚ__ + ((*è +__u + + +__¤þ’ +); + +385 + } +} + +393 #iâdeà +_HAVE_STRING_ARCH_¡rchr + + +394 * +__¿wmemchr + (cÚ¡ * +__s +,  +__c +); + +395 #ià +__GNUC_PREREQ + (3, 2) + +396  + #¡rchr +( +s +, +c +) \ + +397 ( + `__ex‹nsiÚ__ + ( + `__bužtš_cÚ¡ªt_p + ( +c +è&& !__bužtš_cÚ¡ªt_°( +s +) \ + +398 && ( +c +) == '\0' \ + +399 ? (*è + `__¿wmemchr + ( +s +, +c +) \ + +400 : + `__bužtš_¡rchr + ( +s +, +c +))) + + ) + +402  + #¡rchr +( +s +, +c +) \ + +403 ( + `__ex‹nsiÚ__ + ( + `__bužtš_cÚ¡ªt_p + ( +c +) && (c) == '\0' \ + +404 ? (*è + `__¿wmemchr + ( +s +, +c +) \ + +405 : + `¡rchr + ( +s +, +c +))) + + ) + +411 #ià(! +defšed + +_HAVE_STRING_ARCH_¡rýy + && ! +__GNUC_PREREQ + (3, 0)) \ + +412 || +defšed + + g_FORCE_INLINES + + +413 #ià! +defšed + +_HAVE_STRING_ARCH_¡rýy + && ! +__GNUC_PREREQ + (3, 0) + +414  + #¡rýy +( +de¡ +, +¤c +) \ + +415 ( + `__ex‹nsiÚ__ + ( + `__bužtš_cÚ¡ªt_p + ( +¤c +) \ + +416 ? ( + `__¡ršg2_1b±r_p + ( +¤c +è&& + `¡¾’ + (src) + 1 <= 8 \ + +417 ? + `__¡rýy_sm®l + ( +de¡ +, + `__¡rýy_¬gs + ( +¤c +), \ + +418 + `¡¾’ + ( +¤c +) + 1) \ + +419 : (*è + `memýy + ( +de¡ +, +¤c +, + `¡¾’ + (src) + 1)) \ + +420 : + `¡rýy + ( +de¡ +, +¤c +))) + + ) + +423 #ià +_STRING_ARCH_uÇligÃd + + +424 #iâdeà +_FORCE_INLINES + + +425  + #__¡rýy_¬gs +( +¤c +) \ + +426 +__ex‹nsiÚ__ + + `__STRING2_SMALL_GET16 + ( +¤c +, 0), \ + +427 +__ex‹nsiÚ__ + + `__STRING2_SMALL_GET16 + ( +¤c +, 4), \ + +428 +__ex‹nsiÚ__ + + `__STRING2_SMALL_GET32 + ( +¤c +, 0), \ + +429 +__ex‹nsiÚ__ + + `__STRING2_SMALL_GET32 + ( +¤c +, 4) + + ) + +431 +__STRING_INLINE + * +__¡rýy_sm®l + (*, +__ušt16_t +, __uint16_t, + +432 +__ušt32_t +, __ušt32_t, +size_t +); + +433 +__STRING_INLINE + * + +434 + $__¡rýy_sm®l + (* +__de¡ +, + +435 +__ušt16_t + +__¤c0_2 +, __ušt16_ˆ +__¤c4_2 +, + +436 +__ušt32_t + +__¤c0_4 +, __ušt32_ˆ +__¤c4_4 +, + +437 +size_t + +__¤þ’ +) + +440 +__ušt32_t + +__ui +; + +441 +__ušt16_t + +__usi +; + +442  +__uc +; + +443 } * +__u + = (*è +__de¡ +; + +444 (è +__¤þ’ +) + +447 +__u +-> +__uc + = '\0'; + +450 +__u +-> +__usi + = +__¤c0_2 +; + +453 +__u +-> +__usi + = +__¤c0_2 +; + +454 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 2); + +455 +__u +-> +__uc + = '\0'; + +458 +__u +-> +__ui + = +__¤c0_4 +; + +461 +__u +-> +__ui + = +__¤c0_4 +; + +462 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 4); + +463 +__u +-> +__uc + = '\0'; + +466 +__u +-> +__ui + = +__¤c0_4 +; + +467 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 4); + +468 +__u +-> +__usi + = +__¤c4_2 +; + +471 +__u +-> +__ui + = +__¤c0_4 +; + +472 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 4); + +473 +__u +-> +__usi + = +__¤c4_2 +; + +474 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 2); + +475 +__u +-> +__uc + = '\0'; + +478 +__u +-> +__ui + = +__¤c0_4 +; + +479 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 4); + +480 +__u +-> +__ui + = +__¤c4_4 +; + +483  +__de¡ +; + +484 + } +} + +486 #iâdeà +_FORCE_INLINES + + +487  + #__¡rýy_¬gs +( +¤c +) \ + +488 + `__ex‹nsiÚ__ + (( +__STRING2_COPY_ARR2 +) \ + +489 { { (( +__cÚ¡ + *è( +¤c +))[0], '\0' } }), \ + +490 + `__ex‹nsiÚ__ + (( +__STRING2_COPY_ARR3 +) \ + +491 { { (( +__cÚ¡ + *è( +¤c +))[0], ((__const *) (src))[1], \ + +493 + `__ex‹nsiÚ__ + (( +__STRING2_COPY_ARR4 +) \ + +494 { { (( +__cÚ¡ + *è( +¤c +))[0], ((__const *) (src))[1], \ + +495 (( +__cÚ¡ + *è( +¤c +))[2], '\0' } }), \ + +496 + `__ex‹nsiÚ__ + (( +__STRING2_COPY_ARR5 +) \ + +497 { { (( +__cÚ¡ + *è( +¤c +))[0], ((__const *) (src))[1], \ + +498 (( +__cÚ¡ + *è( +¤c +))[2], ((__const *) (src))[3], \ + +500 + `__ex‹nsiÚ__ + (( +__STRING2_COPY_ARR6 +) \ + +501 { { (( +__cÚ¡ + *è( +¤c +))[0], ((__const *) (src))[1], \ + +502 (( +__cÚ¡ + *è( +¤c +))[2], ((__const *) (src))[3], \ + +503 (( +__cÚ¡ + *è( +¤c +))[4], '\0' } }), \ + +504 + `__ex‹nsiÚ__ + (( +__STRING2_COPY_ARR7 +) \ + +505 { { (( +__cÚ¡ + *è( +¤c +))[0], ((__const *) (src))[1], \ + +506 (( +__cÚ¡ + *è( +¤c +))[2], ((__const *) (src))[3], \ + +507 (( +__cÚ¡ + *è( +¤c +))[4], ((__const *) (src))[5], \ + +509 + `__ex‹nsiÚ__ + (( +__STRING2_COPY_ARR8 +) \ + +510 { { (( +__cÚ¡ + *è( +¤c +))[0], ((__const *) (src))[1], \ + +511 (( +__cÚ¡ + *è( +¤c +))[2], ((__const *) (src))[3], \ + +512 (( +__cÚ¡ + *è( +¤c +))[4], ((__const *) (src))[5], \ + +513 (( +__cÚ¡ + *è( +¤c +))[6], '\0' } }) + + ) + +515 +__STRING_INLINE + * +__¡rýy_sm®l + (*, +__STRING2_COPY_ARR2 +, + +516 +__STRING2_COPY_ARR3 +, + +517 +__STRING2_COPY_ARR4 +, + +518 +__STRING2_COPY_ARR5 +, + +519 +__STRING2_COPY_ARR6 +, + +520 +__STRING2_COPY_ARR7 +, + +521 +__STRING2_COPY_ARR8 +, +size_t +); + +522 +__STRING_INLINE + * + +523 + $__¡rýy_sm®l + (* +__de¡ +, + +524 +__STRING2_COPY_ARR2 + +__¤c2 +, +__STRING2_COPY_ARR3 + +__¤c3 +, + +525 +__STRING2_COPY_ARR4 + +__¤c4 +, +__STRING2_COPY_ARR5 + +__¤c5 +, + +526 +__STRING2_COPY_ARR6 + +__¤c6 +, +__STRING2_COPY_ARR7 + +__¤c7 +, + +527 +__STRING2_COPY_ARR8 + +__¤c8 +, +size_t + +__¤þ’ +) + +530  +__c +; + +531 +__STRING2_COPY_ARR2 + +__sÿ2 +; + +532 +__STRING2_COPY_ARR3 + +__sÿ3 +; + +533 +__STRING2_COPY_ARR4 + +__sÿ4 +; + +534 +__STRING2_COPY_ARR5 + +__sÿ5 +; + +535 +__STRING2_COPY_ARR6 + +__sÿ6 +; + +536 +__STRING2_COPY_ARR7 + +__sÿ7 +; + +537 +__STRING2_COPY_ARR8 + +__sÿ8 +; + +538 } * +__u + = (*è +__de¡ +; + +539 (è +__¤þ’ +) + +542 +__u +-> +__c + = '\0'; + +545 +__ex‹nsiÚ__ + +__u +-> +__sÿ2 + = +__¤c2 +; + +548 +__ex‹nsiÚ__ + +__u +-> +__sÿ3 + = +__¤c3 +; + +551 +__ex‹nsiÚ__ + +__u +-> +__sÿ4 + = +__¤c4 +; + +554 +__ex‹nsiÚ__ + +__u +-> +__sÿ5 + = +__¤c5 +; + +557 +__ex‹nsiÚ__ + +__u +-> +__sÿ6 + = +__¤c6 +; + +560 +__ex‹nsiÚ__ + +__u +-> +__sÿ7 + = +__¤c7 +; + +563 +__ex‹nsiÚ__ + +__u +-> +__sÿ8 + = +__¤c8 +; + +566  +__de¡ +; + +567 + } +} + +573 #ifdeà +__USE_GNU + + +574 #ià! +defšed + +_HAVE_STRING_ARCH_¡pýy + || defšed +_FORCE_INLINES + + +575 #iâdeà +_HAVE_STRING_ARCH_¡pýy + + +576 #ià +__GNUC_PREREQ + (3, 4) + +577  + #__¡pýy +( +de¡ +, +¤c +è + `__bužtš_¡pýy + (de¡, src) + + ) + +578 #–ià +__GNUC_PREREQ + (3, 0) + +579  + #__¡pýy +( +de¡ +, +¤c +) \ + +580 ( + `__ex‹nsiÚ__ + ( + `__bužtš_cÚ¡ªt_p + ( +¤c +) \ + +581 ? ( + `__¡ršg2_1b±r_p + ( +¤c +è&& + `¡¾’ + (src) + 1 <= 8 \ + +582 ? + `__bužtš_¡rýy + ( +de¡ +, +¤c +è+ + `¡¾’ + (src) \ + +583 : ((*è( +__mempýy +è( +de¡ +, +¤c +, + `¡¾’ + (src) + 1) \ + +585 : + `__¡pýy + ( +de¡ +, +¤c +))) + + ) + +587  + #__¡pýy +( +de¡ +, +¤c +) \ + +588 ( + `__ex‹nsiÚ__ + ( + `__bužtš_cÚ¡ªt_p + ( +¤c +) \ + +589 ? ( + `__¡ršg2_1b±r_p + ( +¤c +è&& + `¡¾’ + (src) + 1 <= 8 \ + +590 ? + `__¡pýy_sm®l + ( +de¡ +, + `__¡pýy_¬gs + ( +¤c +), \ + +591 + `¡¾’ + ( +¤c +) + 1) \ + +592 : ((*è( +__mempýy +è( +de¡ +, +¤c +, + `¡¾’ + (src) + 1) \ + +594 : + `__¡pýy + ( +de¡ +, +¤c +))) + + ) + +598  + #¡pýy +( +de¡ +, +¤c +è + `__¡pýy + (de¡, src) + + ) + +601 #ià! +__GNUC_PREREQ + (3, 0è|| +defšed + +_FORCE_INLINES + + +602 #ià +_STRING_ARCH_uÇligÃd + + +603 #iâdeà +_FORCE_INLINES + + +604  + #__¡pýy_¬gs +( +¤c +) \ + +605 +__ex‹nsiÚ__ + + `__STRING2_SMALL_GET16 + ( +¤c +, 0), \ + +606 +__ex‹nsiÚ__ + + `__STRING2_SMALL_GET16 + ( +¤c +, 4), \ + +607 +__ex‹nsiÚ__ + + `__STRING2_SMALL_GET32 + ( +¤c +, 0), \ + +608 +__ex‹nsiÚ__ + + `__STRING2_SMALL_GET32 + ( +¤c +, 4) + + ) + +610 +__STRING_INLINE + * +__¡pýy_sm®l + (*, +__ušt16_t +, __uint16_t, + +611 +__ušt32_t +, __ušt32_t, +size_t +); + +612 +__STRING_INLINE + * + +613 + $__¡pýy_sm®l + (* +__de¡ +, + +614 +__ušt16_t + +__¤c0_2 +, __ušt16_ˆ +__¤c4_2 +, + +615 +__ušt32_t + +__¤c0_4 +, __ušt32_ˆ +__¤c4_4 +, + +616 +size_t + +__¤þ’ +) + +619  +__ui +; + +620  +__usi +; + +621  +__uc +; + +622  +__c +; + +623 } * +__u + = (*è +__de¡ +; + +624 (è +__¤þ’ +) + +627 +__u +-> +__uc + = '\0'; + +630 +__u +-> +__usi + = +__¤c0_2 +; + +631 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 1); + +634 +__u +-> +__usi + = +__¤c0_2 +; + +635 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 2); + +636 +__u +-> +__uc + = '\0'; + +639 +__u +-> +__ui + = +__¤c0_4 +; + +640 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 3); + +643 +__u +-> +__ui + = +__¤c0_4 +; + +644 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 4); + +645 +__u +-> +__uc + = '\0'; + +648 +__u +-> +__ui + = +__¤c0_4 +; + +649 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 4); + +650 +__u +-> +__usi + = +__¤c4_2 +; + +651 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 1); + +654 +__u +-> +__ui + = +__¤c0_4 +; + +655 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 4); + +656 +__u +-> +__usi + = +__¤c4_2 +; + +657 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 2); + +658 +__u +-> +__uc + = '\0'; + +661 +__u +-> +__ui + = +__¤c0_4 +; + +662 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 4); + +663 +__u +-> +__ui + = +__¤c4_4 +; + +664 +__u + = + `__ex‹nsiÚ__ + ((*) __u + 3); + +667  & +__u +-> +__c +; + +668 + } +} + +670 #iâdeà +_FORCE_INLINES + + +671  + #__¡pýy_¬gs +( +¤c +) \ + +672 + `__ex‹nsiÚ__ + (( +__STRING2_COPY_ARR2 +) \ + +673 { { (( +__cÚ¡ + *è( +¤c +))[0], '\0' } }), \ + +674 + `__ex‹nsiÚ__ + (( +__STRING2_COPY_ARR3 +) \ + +675 { { (( +__cÚ¡ + *è( +¤c +))[0], ((__const *) (src))[1], \ + +677 + `__ex‹nsiÚ__ + (( +__STRING2_COPY_ARR4 +) \ + +678 { { (( +__cÚ¡ + *è( +¤c +))[0], ((__const *) (src))[1], \ + +679 (( +__cÚ¡ + *è( +¤c +))[2], '\0' } }), \ + +680 + `__ex‹nsiÚ__ + (( +__STRING2_COPY_ARR5 +) \ + +681 { { (( +__cÚ¡ + *è( +¤c +))[0], ((__const *) (src))[1], \ + +682 (( +__cÚ¡ + *è( +¤c +))[2], ((__const *) (src))[3], \ + +684 + `__ex‹nsiÚ__ + (( +__STRING2_COPY_ARR6 +) \ + +685 { { (( +__cÚ¡ + *è( +¤c +))[0], ((__const *) (src))[1], \ + +686 (( +__cÚ¡ + *è( +¤c +))[2], ((__const *) (src))[3], \ + +687 (( +__cÚ¡ + *è( +¤c +))[4], '\0' } }), \ + +688 + `__ex‹nsiÚ__ + (( +__STRING2_COPY_ARR7 +) \ + +689 { { (( +__cÚ¡ + *è( +¤c +))[0], ((__const *) (src))[1], \ + +690 (( +__cÚ¡ + *è( +¤c +))[2], ((__const *) (src))[3], \ + +691 (( +__cÚ¡ + *è( +¤c +))[4], ((__const *) (src))[5], \ + +693 + `__ex‹nsiÚ__ + (( +__STRING2_COPY_ARR8 +) \ + +694 { { (( +__cÚ¡ + *è( +¤c +))[0], ((__const *) (src))[1], \ + +695 (( +__cÚ¡ + *è( +¤c +))[2], ((__const *) (src))[3], \ + +696 (( +__cÚ¡ + *è( +¤c +))[4], ((__const *) (src))[5], \ + +697 (( +__cÚ¡ + *è( +¤c +))[6], '\0' } }) + + ) + +699 +__STRING_INLINE + * +__¡pýy_sm®l + (*, +__STRING2_COPY_ARR2 +, + +700 +__STRING2_COPY_ARR3 +, + +701 +__STRING2_COPY_ARR4 +, + +702 +__STRING2_COPY_ARR5 +, + +703 +__STRING2_COPY_ARR6 +, + +704 +__STRING2_COPY_ARR7 +, + +705 +__STRING2_COPY_ARR8 +, +size_t +); + +706 +__STRING_INLINE + * + +707 + $__¡pýy_sm®l + (* +__de¡ +, + +708 +__STRING2_COPY_ARR2 + +__¤c2 +, +__STRING2_COPY_ARR3 + +__¤c3 +, + +709 +__STRING2_COPY_ARR4 + +__¤c4 +, +__STRING2_COPY_ARR5 + +__¤c5 +, + +710 +__STRING2_COPY_ARR6 + +__¤c6 +, +__STRING2_COPY_ARR7 + +__¤c7 +, + +711 +__STRING2_COPY_ARR8 + +__¤c8 +, +size_t + +__¤þ’ +) + +714  +__c +; + +715 +__STRING2_COPY_ARR2 + +__sÿ2 +; + +716 +__STRING2_COPY_ARR3 + +__sÿ3 +; + +717 +__STRING2_COPY_ARR4 + +__sÿ4 +; + +718 +__STRING2_COPY_ARR5 + +__sÿ5 +; + +719 +__STRING2_COPY_ARR6 + +__sÿ6 +; + +720 +__STRING2_COPY_ARR7 + +__sÿ7 +; + +721 +__STRING2_COPY_ARR8 + +__sÿ8 +; + +722 } * +__u + = (*è +__de¡ +; + +723 (è +__¤þ’ +) + +726 +__u +-> +__c + = '\0'; + +729 +__ex‹nsiÚ__ + +__u +-> +__sÿ2 + = +__¤c2 +; + +732 +__ex‹nsiÚ__ + +__u +-> +__sÿ3 + = +__¤c3 +; + +735 +__ex‹nsiÚ__ + +__u +-> +__sÿ4 + = +__¤c4 +; + +738 +__ex‹nsiÚ__ + +__u +-> +__sÿ5 + = +__¤c5 +; + +741 +__ex‹nsiÚ__ + +__u +-> +__sÿ6 + = +__¤c6 +; + +744 +__ex‹nsiÚ__ + +__u +-> +__sÿ7 + = +__¤c7 +; + +747 +__ex‹nsiÚ__ + +__u +-> +__sÿ8 + = +__¤c8 +; + +750  +__de¡ + + +__¤þ’ + - 1; + +751 + } +} + +759 #iâdeà +_HAVE_STRING_ARCH_¡ºýy + + +760 #ià +__GNUC_PREREQ + (3, 2) + +761  + #¡ºýy +( +de¡ +, +¤c +, +n +è + `__bužtš_¡ºýy + (de¡, src,‚) + + ) + +763  + #¡ºýy +( +de¡ +, +¤c +, +n +) \ + +764 ( + `__ex‹nsiÚ__ + ( + `__bužtš_cÚ¡ªt_p + ( +¤c +è&& __bužtš_cÚ¡ªt_°( +n +) \ + +765 ? ( + `¡¾’ + ( +¤c +è+ 1 >ð(( +size_t +è( +n +)) \ + +766 ? (*è + `memýy + ( +de¡ +, +¤c +, +n +) \ + +767 : + `¡ºýy + ( +de¡ +, +¤c +, +n +)) \ + +768 : + `¡ºýy + ( +de¡ +, +¤c +, +n +))) + + ) + +774 #iâdeà +_HAVE_STRING_ARCH_¡ºÿt + + +775 #ifdeà +_USE_STRING_ARCH_¡rchr + + +776  + #¡ºÿt +( +de¡ +, +¤c +, +n +) \ + +777 ( + `__ex‹nsiÚ__ + ({ * +__de¡ + = ( +de¡ +); \ + +778 + `__bužtš_cÚ¡ªt_p + ( +¤c +è&& __bužtš_cÚ¡ªt_°( +n +) \ + +779 ? ( + `¡¾’ + ( +¤c +è< (( +size_t +è( +n +)) \ + +780 ? + `¡rÿt + ( +__de¡ +, +¤c +) \ + +781 : (*((*è + `__mempýy + ( + `¡rchr + ( +__de¡ +, '\0'), \ + +782 +¤c +, +n +)èð'\0', +__de¡ +)) \ + +783 : + `¡ºÿt + ( +de¡ +, +¤c +, +n +); })) + + ) + +784 #–ià +__GNUC_PREREQ + (3, 2) + +785  + #¡ºÿt +( +de¡ +, +¤c +, +n +è + `__bužtš_¡ºÿt + (de¡, src,‚) + + ) + +787  + #¡ºÿt +( +de¡ +, +¤c +, +n +) \ + +788 ( + `__ex‹nsiÚ__ + ( + `__bužtš_cÚ¡ªt_p + ( +¤c +è&& __bužtš_cÚ¡ªt_°( +n +) \ + +789 ? ( + `¡¾’ + ( +¤c +è< (( +size_t +è( +n +)) \ + +790 ? + `¡rÿt + ( +de¡ +, +¤c +) \ + +791 : + `¡ºÿt + ( +de¡ +, +¤c +, +n +)) \ + +792 : + `¡ºÿt + ( +de¡ +, +¤c +, +n +))) + + ) + +798 #iâdeà +_HAVE_STRING_ARCH_¡rcmp + + +799 #ià +__GNUC_PREREQ + (3, 2) + +800  + #¡rcmp +( +s1 +, +s2 +) \ + +801 +__ex‹nsiÚ__ + \ + +802 ({ +size_t + +__s1_Ën +, +__s2_Ën +; \ + +803 ( + `__bužtš_cÚ¡ªt_p + ( +s1 +è&& __bužtš_cÚ¡ªt_°( +s2 +) \ + +804 && ( +__s1_Ën + = + `¡¾’ + ( +s1 +), +__s2_Ën + = sŒËÀ( +s2 +), \ + +805 (! + `__¡ršg2_1b±r_p + ( +s1 +è|| +__s1_Ën + >= 4) \ + +806 && (! + `__¡ršg2_1b±r_p + ( +s2 +è|| +__s2_Ën + >= 4)) \ + +807 ? + `__bužtš_¡rcmp + ( +s1 +, +s2 +) \ + +808 : ( + `__bužtš_cÚ¡ªt_p + ( +s1 +è&& + `__¡ršg2_1b±r_p + (s1) \ + +809 && ( +__s1_Ën + = + `¡¾’ + ( +s1 +), __s1_len < 4) \ + +810 ? ( + `__bužtš_cÚ¡ªt_p + ( +s2 +è&& + `__¡ršg2_1b±r_p + (s2) \ + +811 ? + `__bužtš_¡rcmp + ( +s1 +, +s2 +) \ + +812 : + `__¡rcmp_cg + ( +s1 +, +s2 +, +__s1_Ën +)) \ + +813 : ( + `__bužtš_cÚ¡ªt_p + ( +s2 +è&& + `__¡ršg2_1b±r_p + (s2) \ + +814 && ( +__s2_Ën + = + `¡¾’ + ( +s2 +), __s2_len < 4) \ + +815 ? ( + `__bužtš_cÚ¡ªt_p + ( +s1 +è&& + `__¡ršg2_1b±r_p + (s1) \ + +816 ? + `__bužtš_¡rcmp + ( +s1 +, +s2 +) \ + +817 : + `__¡rcmp_gc + ( +s1 +, +s2 +, +__s2_Ën +)) \ + +818 : + `__bužtš_¡rcmp + ( +s1 +, +s2 +)))); }) + + ) + +820  + #¡rcmp +( +s1 +, +s2 +) \ + +821 +__ex‹nsiÚ__ + \ + +822 ({ +size_t + +__s1_Ën +, +__s2_Ën +; \ + +823 ( + `__bužtš_cÚ¡ªt_p + ( +s1 +è&& __bužtš_cÚ¡ªt_°( +s2 +) \ + +824 && ( +__s1_Ën + = + `¡¾’ + ( +s1 +), +__s2_Ën + = sŒËÀ( +s2 +), \ + +825 (! + `__¡ršg2_1b±r_p + ( +s1 +è|| +__s1_Ën + >= 4) \ + +826 && (! + `__¡ršg2_1b±r_p + ( +s2 +è|| +__s2_Ën + >= 4)) \ + +827 ? + `memcmp + (( +__cÚ¡ + *è( +s1 +), (__cÚ¡ *è( +s2 +), \ + +828 ( +__s1_Ën + < +__s2_Ën + ? __s1_len : __s2_len) + 1) \ + +829 : ( + `__bužtš_cÚ¡ªt_p + ( +s1 +è&& + `__¡ršg2_1b±r_p + (s1) \ + +830 && ( +__s1_Ën + = + `¡¾’ + ( +s1 +), __s1_len < 4) \ + +831 ? ( + `__bužtš_cÚ¡ªt_p + ( +s2 +è&& + `__¡ršg2_1b±r_p + (s2) \ + +832 ? + `__¡rcmp_cc + ( +s1 +, +s2 +, +__s1_Ën +) \ + +833 : + `__¡rcmp_cg + ( +s1 +, +s2 +, +__s1_Ën +)) \ + +834 : ( + `__bužtš_cÚ¡ªt_p + ( +s2 +è&& + `__¡ršg2_1b±r_p + (s2) \ + +835 && ( +__s2_Ën + = + `¡¾’ + ( +s2 +), __s2_len < 4) \ + +836 ? ( + `__bužtš_cÚ¡ªt_p + ( +s1 +è&& + `__¡ršg2_1b±r_p + (s1) \ + +837 ? + `__¡rcmp_cc + ( +s1 +, +s2 +, +__s2_Ën +) \ + +838 : + `__¡rcmp_gc + ( +s1 +, +s2 +, +__s2_Ën +)) \ + +839 : + `¡rcmp + ( +s1 +, +s2 +)))); }) + + ) + +842  + #__¡rcmp_cc +( +s1 +, +s2 +, +l +) \ + +843 ( + `__ex‹nsiÚ__ + ({  +__»suÉ + = \ + +844 ((( +__cÚ¡ + *è(__cÚ¡ *è( +s1 +))[0] \ + +845 - (( +__cÚ¡ + *è(__cÚ¡ *)( +s2 +))[0]);\ + +846 ià( +l + > 0 && +__»suÉ + == 0) \ + +848 +__»suÉ + = ((( +__cÚ¡ + *) \ + +849 ( +__cÚ¡ + *è( +s1 +))[1] \ + +850 - (( +__cÚ¡ + *) \ + +851 ( +__cÚ¡ + *è( +s2 +))[1]); \ + +852 ià( +l + > 1 && +__»suÉ + == 0) \ + +854 +__»suÉ + = \ + +855 ((( +__cÚ¡ + *) \ + +856 ( +__cÚ¡ + *è( +s1 +))[2] \ + +857 - (( +__cÚ¡ + *) \ + +858 ( +__cÚ¡ + *è( +s2 +))[2]); \ + +859 ià( +l + > 2 && +__»suÉ + == 0) \ + +860 +__»suÉ + = \ + +861 ((( +__cÚ¡ + *) \ + +862 ( +__cÚ¡ + *è( +s1 +))[3] \ + +863 - (( +__cÚ¡ + *) \ + +864 ( +__cÚ¡ + *è( +s2 +))[3]); \ + +867 +__»suÉ +; })) + + ) + +869  + #__¡rcmp_cg +( +s1 +, +s2 +, +l1 +) \ + +870 ( + `__ex‹nsiÚ__ + ({ +__cÚ¡ + * +__s2 + = \ + +871 ( +__cÚ¡ + *è(__cÚ¡ *è( +s2 +); \ + +872  +__»suÉ + = \ + +873 ((( +__cÚ¡ + *è(__cÚ¡ *è( +s1 +))[0] \ + +874 - +__s2 +[0]); \ + +875 ià( +l1 + > 0 && +__»suÉ + == 0) \ + +877 +__»suÉ + = ((( +__cÚ¡ + *) \ + +878 ( +__cÚ¡ + *è( +s1 +))[1] - +__s2 +[1]); \ + +879 ià( +l1 + > 1 && +__»suÉ + == 0) \ + +881 +__»suÉ + = ((( +__cÚ¡ + *) \ + +882 ( +__cÚ¡ + *è( +s1 +))[2] - +__s2 +[2]);\ + +883 ià( +l1 + > 2 && +__»suÉ + == 0) \ + +884 +__»suÉ + = ((( +__cÚ¡ + *) \ + +885 ( +__cÚ¡ + *è( +s1 +))[3] \ + +886 - +__s2 +[3]); \ + +889 +__»suÉ +; })) + + ) + +891  + #__¡rcmp_gc +( +s1 +, +s2 +, +l2 +) \ + +892 ( + `__ex‹nsiÚ__ + ({ +__cÚ¡ + * +__s1 + = \ + +893 ( +__cÚ¡ + *è(__cÚ¡ *è( +s1 +); \ + +894  +__»suÉ + = \ + +895 +__s1 +[0] - (( +__cÚ¡ + *) \ + +896 ( +__cÚ¡ + *è( +s2 +))[0]; \ + +897 ià( +l2 + > 0 && +__»suÉ + == 0) \ + +899 +__»suÉ + = ( +__s1 +[1] \ + +900 - (( +__cÚ¡ + *) \ + +901 ( +__cÚ¡ + *è( +s2 +))[1]); \ + +902 ià( +l2 + > 1 && +__»suÉ + == 0) \ + +904 +__»suÉ + = \ + +905 ( +__s1 +[2] - (( +__cÚ¡ + *) \ + +906 ( +__cÚ¡ + *è( +s2 +))[2]); \ + +907 ià( +l2 + > 2 && +__»suÉ + == 0) \ + +908 +__»suÉ + = \ + +909 ( +__s1 +[3] \ + +910 - (( +__cÚ¡ + *) \ + +911 ( +__cÚ¡ + *è( +s2 +))[3]); \ + +914 +__»suÉ +; })) + + ) + +919 #iâdeà +_HAVE_STRING_ARCH_¡ºcmp + + +920  + #¡ºcmp +( +s1 +, +s2 +, +n +) \ + +921 ( + `__ex‹nsiÚ__ + ( + `__bužtš_cÚ¡ªt_p + ( +n +) \ + +922 && (( + `__bužtš_cÚ¡ªt_p + ( +s1 +) \ + +923 && + `¡¾’ + ( +s1 +è< (( +size_t +è( +n +))) \ + +924 || ( + `__bužtš_cÚ¡ªt_p + ( +s2 +) \ + +925 && + `¡¾’ + ( +s2 +è< (( +size_t +è( +n +)))) \ + +926 ? + `¡rcmp + ( +s1 +, +s2 +è: + `¡ºcmp + (s1, s2, +n +))) + + ) + +932 #ià! +defšed + +_HAVE_STRING_ARCH_¡rc¥n + || defšed +_FORCE_INLINES + + +933 #iâdeà +_HAVE_STRING_ARCH_¡rc¥n + + +934 #ià +__GNUC_PREREQ + (3, 2) + +935  + #¡rc¥n +( +s +, +»jeù +) \ + +936 +__ex‹nsiÚ__ + \ + +937 ({  +__r0 +, +__r1 +, +__r2 +; \ + +938 ( + `__bužtš_cÚ¡ªt_p + ( +»jeù +è&& + `__¡ršg2_1b±r_p + (reject) \ + +939 ? (( + `__bužtš_cÚ¡ªt_p + ( +s +è&& + `__¡ršg2_1b±r_p + (s)) \ + +940 ? + `__bužtš_¡rc¥n + ( +s +, +»jeù +) \ + +941 : (( +__r0 + = (( +__cÚ¡ + *è( +»jeù +))[0], __r0 == '\0') \ + +942 ? + `¡¾’ + ( +s +) \ + +943 : (( +__r1 + = (( +__cÚ¡ + *è( +»jeù +))[1], __r1 == '\0') \ + +944 ? + `__¡rc¥n_c1 + ( +s +, +__r0 +) \ + +945 : (( +__r2 + = (( +__cÚ¡ + *è( +»jeù +))[2], __r2 == '\0') \ + +946 ? + `__¡rc¥n_c2 + ( +s +, +__r0 +, +__r1 +) \ + +947 : ((( +__cÚ¡ + *è( +»jeù +))[3] == '\0' \ + +948 ? + `__¡rc¥n_c3 + ( +s +, +__r0 +, +__r1 +, +__r2 +) \ + +949 : + `__bužtš_¡rc¥n + ( +s +, +»jeù +)))))) \ + +950 : + `__bužtš_¡rc¥n + ( +s +, +»jeù +)); }) + + ) + +952  + #¡rc¥n +( +s +, +»jeù +) \ + +953 +__ex‹nsiÚ__ + \ + +954 ({  +__r0 +, +__r1 +, +__r2 +; \ + +955 ( + `__bužtš_cÚ¡ªt_p + ( +»jeù +è&& + `__¡ršg2_1b±r_p + (reject) \ + +956 ? (( +__r0 + = (( +__cÚ¡ + *è( +»jeù +))[0], __r0 == '\0') \ + +957 ? + `¡¾’ + ( +s +) \ + +958 : (( +__r1 + = (( +__cÚ¡ + *è( +»jeù +))[1], __r1 == '\0') \ + +959 ? + `__¡rc¥n_c1 + ( +s +, +__r0 +) \ + +960 : (( +__r2 + = (( +__cÚ¡ + *è( +»jeù +))[2], __r2 == '\0') \ + +961 ? + `__¡rc¥n_c2 + ( +s +, +__r0 +, +__r1 +) \ + +962 : ((( +__cÚ¡ + *è( +»jeù +))[3] == '\0' \ + +963 ? + `__¡rc¥n_c3 + ( +s +, +__r0 +, +__r1 +, +__r2 +) \ + +964 : + `¡rc¥n + ( +s +, +»jeù +))))) \ + +965 : + `¡rc¥n + ( +s +, +»jeù +)); }) + + ) + +969 +__STRING_INLINE + +size_t + +__¡rc¥n_c1 + ( +__cÚ¡ + * +__s +,  +__»jeù +); + +970 +__STRING_INLINE + +size_t + + +971 + $__¡rc¥n_c1 + ( +__cÚ¡ + * +__s +,  +__»jeù +) + +973  +size_t + +__»suÉ + = 0; + +974  +__s +[ +__»suÉ +] !ð'\0' && __s[__»suÉ] !ð +__»jeù +) + +975 ++ +__»suÉ +; + +976  +__»suÉ +; + +977 + } +} + +979 +__STRING_INLINE + +size_t + +__¡rc¥n_c2 + ( +__cÚ¡ + * +__s +,  +__»jeù1 +, + +980  +__»jeù2 +); + +981 +__STRING_INLINE + +size_t + + +982 + $__¡rc¥n_c2 + ( +__cÚ¡ + * +__s +,  +__»jeù1 +,  +__»jeù2 +) + +984  +size_t + +__»suÉ + = 0; + +985  +__s +[ +__»suÉ +] !ð'\0' && __s[__»suÉ] !ð +__»jeù1 + + +986 && +__s +[ +__»suÉ +] !ð +__»jeù2 +) + +987 ++ +__»suÉ +; + +988  +__»suÉ +; + +989 + } +} + +991 +__STRING_INLINE + +size_t + +__¡rc¥n_c3 + ( +__cÚ¡ + * +__s +,  +__»jeù1 +, + +992  +__»jeù2 +,  +__»jeù3 +); + +993 +__STRING_INLINE + +size_t + + +994 + $__¡rc¥n_c3 + ( +__cÚ¡ + * +__s +,  +__»jeù1 +,  +__»jeù2 +, + +995  +__»jeù3 +) + +997  +size_t + +__»suÉ + = 0; + +998  +__s +[ +__»suÉ +] !ð'\0' && __s[__»suÉ] !ð +__»jeù1 + + +999 && +__s +[ +__»suÉ +] !ð +__»jeù2 + && __s[__»suÉ] !ð +__»jeù3 +) + +1000 ++ +__»suÉ +; + +1001  +__»suÉ +; + +1002 + } +} + +1008 #ià! +defšed + +_HAVE_STRING_ARCH_¡r¥n + || defšed +_FORCE_INLINES + + +1009 #iâdeà +_HAVE_STRING_ARCH_¡r¥n + + +1010 #ià +__GNUC_PREREQ + (3, 2) + +1011  + #¡r¥n +( +s +, +acû± +) \ + +1012 +__ex‹nsiÚ__ + \ + +1013 ({  +__a0 +, +__a1 +, +__a2 +; \ + +1014 ( + `__bužtš_cÚ¡ªt_p + ( +acû± +è&& + `__¡ršg2_1b±r_p + (accept) \ + +1015 ? (( + `__bužtš_cÚ¡ªt_p + ( +s +è&& + `__¡ršg2_1b±r_p + (s)) \ + +1016 ? + `__bužtš_¡r¥n + ( +s +, +acû± +) \ + +1017 : (( +__a0 + = (( +__cÚ¡ + *è( +acû± +))[0], __a0 == '\0') \ + +1018 ? ((è( +s +), 0) \ + +1019 : (( +__a1 + = (( +__cÚ¡ + *è( +acû± +))[1], __a1 == '\0') \ + +1020 ? + `__¡r¥n_c1 + ( +s +, +__a0 +) \ + +1021 : (( +__a2 + = (( +__cÚ¡ + *è( +acû± +))[2], __a2 == '\0') \ + +1022 ? + `__¡r¥n_c2 + ( +s +, +__a0 +, +__a1 +) \ + +1023 : ((( +__cÚ¡ + *è( +acû± +))[3] == '\0' \ + +1024 ? + `__¡r¥n_c3 + ( +s +, +__a0 +, +__a1 +, +__a2 +) \ + +1025 : + `__bužtš_¡r¥n + ( +s +, +acû± +)))))) \ + +1026 : + `__bužtš_¡r¥n + ( +s +, +acû± +)); }) + + ) + +1028  + #¡r¥n +( +s +, +acû± +) \ + +1029 +__ex‹nsiÚ__ + \ + +1030 ({  +__a0 +, +__a1 +, +__a2 +; \ + +1031 ( + `__bužtš_cÚ¡ªt_p + ( +acû± +è&& + `__¡ršg2_1b±r_p + (accept) \ + +1032 ? (( +__a0 + = (( +__cÚ¡ + *è( +acû± +))[0], __a0 == '\0') \ + +1033 ? ((è( +s +), 0) \ + +1034 : (( +__a1 + = (( +__cÚ¡ + *è( +acû± +))[1], __a1 == '\0') \ + +1035 ? + `__¡r¥n_c1 + ( +s +, +__a0 +) \ + +1036 : (( +__a2 + = (( +__cÚ¡ + *è( +acû± +))[2], __a2 == '\0') \ + +1037 ? + `__¡r¥n_c2 + ( +s +, +__a0 +, +__a1 +) \ + +1038 : ((( +__cÚ¡ + *è( +acû± +))[3] == '\0' \ + +1039 ? + `__¡r¥n_c3 + ( +s +, +__a0 +, +__a1 +, +__a2 +) \ + +1040 : + `¡r¥n + ( +s +, +acû± +))))) \ + +1041 : + `¡r¥n + ( +s +, +acû± +)); }) + + ) + +1045 +__STRING_INLINE + +size_t + +__¡r¥n_c1 + ( +__cÚ¡ + * +__s +,  +__acû± +); + +1046 +__STRING_INLINE + +size_t + + +1047 + $__¡r¥n_c1 + ( +__cÚ¡ + * +__s +,  +__acû± +) + +1049  +size_t + +__»suÉ + = 0; + +1051  +__s +[ +__»suÉ +] =ð +__acû± +) + +1052 ++ +__»suÉ +; + +1053  +__»suÉ +; + +1054 + } +} + +1056 +__STRING_INLINE + +size_t + +__¡r¥n_c2 + ( +__cÚ¡ + * +__s +,  +__acû±1 +, + +1057  +__acû±2 +); + +1058 +__STRING_INLINE + +size_t + + +1059 + $__¡r¥n_c2 + ( +__cÚ¡ + * +__s +,  +__acû±1 +,  +__acû±2 +) + +1061  +size_t + +__»suÉ + = 0; + +1063  +__s +[ +__»suÉ +] =ð +__acû±1 + || __s[__»suÉ] =ð +__acû±2 +) + +1064 ++ +__»suÉ +; + +1065  +__»suÉ +; + +1066 + } +} + +1068 +__STRING_INLINE + +size_t + +__¡r¥n_c3 + ( +__cÚ¡ + * +__s +,  +__acû±1 +, + +1069  +__acû±2 +,  +__acû±3 +); + +1070 +__STRING_INLINE + +size_t + + +1071 + $__¡r¥n_c3 + ( +__cÚ¡ + * +__s +,  +__acû±1 +,  +__acû±2 +,  +__acû±3 +) + +1073  +size_t + +__»suÉ + = 0; + +1075  +__s +[ +__»suÉ +] =ð +__acû±1 + || __s[__»suÉ] =ð +__acû±2 + + +1076 || +__s +[ +__»suÉ +] =ð +__acû±3 +) + +1077 ++ +__»suÉ +; + +1078  +__»suÉ +; + +1079 + } +} + +1084 #ià! +defšed + +_HAVE_STRING_ARCH_¡½brk + || defšed +_FORCE_INLINES + + +1085 #iâdeà +_HAVE_STRING_ARCH_¡½brk + + +1086 #ià +__GNUC_PREREQ + (3, 2) + +1087  + #¡½brk +( +s +, +acû± +) \ + +1088 +__ex‹nsiÚ__ + \ + +1089 ({  +__a0 +, +__a1 +, +__a2 +; \ + +1090 ( + `__bužtš_cÚ¡ªt_p + ( +acû± +è&& + `__¡ršg2_1b±r_p + (accept) \ + +1091 ? (( + `__bužtš_cÚ¡ªt_p + ( +s +è&& + `__¡ršg2_1b±r_p + (s)) \ + +1092 ? + `__bužtš_¡½brk + ( +s +, +acû± +) \ + +1093 : (( +__a0 + = (( +__cÚ¡ + *è( +acû± +))[0], __a0 == '\0') \ + +1094 ? ((è( +s +), (*è +NULL +) \ + +1095 : (( +__a1 + = (( +__cÚ¡ + *è( +acû± +))[1], __a1 == '\0') \ + +1096 ? + `__bužtš_¡rchr + ( +s +, +__a0 +) \ + +1097 : (( +__a2 + = (( +__cÚ¡ + *è( +acû± +))[2], __a2 == '\0') \ + +1098 ? + `__¡½brk_c2 + ( +s +, +__a0 +, +__a1 +) \ + +1099 : ((( +__cÚ¡ + *è( +acû± +))[3] == '\0' \ + +1100 ? + `__¡½brk_c3 + ( +s +, +__a0 +, +__a1 +, +__a2 +) \ + +1101 : + `__bužtš_¡½brk + ( +s +, +acû± +)))))) \ + +1102 : + `__bužtš_¡½brk + ( +s +, +acû± +)); }) + + ) + +1104  + #¡½brk +( +s +, +acû± +) \ + +1105 +__ex‹nsiÚ__ + \ + +1106 ({  +__a0 +, +__a1 +, +__a2 +; \ + +1107 ( + `__bužtš_cÚ¡ªt_p + ( +acû± +è&& + `__¡ršg2_1b±r_p + (accept) \ + +1108 ? (( +__a0 + = (( +__cÚ¡ + *è( +acû± +))[0], __a0 == '\0') \ + +1109 ? ((è( +s +), (*è +NULL +) \ + +1110 : (( +__a1 + = (( +__cÚ¡ + *è( +acû± +))[1], __a1 == '\0') \ + +1111 ? + `¡rchr + ( +s +, +__a0 +) \ + +1112 : (( +__a2 + = (( +__cÚ¡ + *è( +acû± +))[2], __a2 == '\0') \ + +1113 ? + `__¡½brk_c2 + ( +s +, +__a0 +, +__a1 +) \ + +1114 : ((( +__cÚ¡ + *è( +acû± +))[3] == '\0' \ + +1115 ? + `__¡½brk_c3 + ( +s +, +__a0 +, +__a1 +, +__a2 +) \ + +1116 : + `¡½brk + ( +s +, +acû± +))))) \ + +1117 : + `¡½brk + ( +s +, +acû± +)); }) + + ) + +1121 +__STRING_INLINE + * +__¡½brk_c2 + ( +__cÚ¡ + * +__s +,  +__acû±1 +, + +1122  +__acû±2 +); + +1123 +__STRING_INLINE + * + +1124 + $__¡½brk_c2 + ( +__cÚ¡ + * +__s +,  +__acû±1 +,  +__acû±2 +) + +1127 * +__s + !ð'\0' && *__ !ð +__acû±1 + && *__ !ð +__acû±2 +) + +1128 ++ +__s +; + +1129  * +__s + =ð'\0' ? +NULL + : (*è( +size_t +) __s; + +1130 + } +} + +1132 +__STRING_INLINE + * +__¡½brk_c3 + ( +__cÚ¡ + * +__s +,  +__acû±1 +, + +1133  +__acû±2 +,  +__acû±3 +); + +1134 +__STRING_INLINE + * + +1135 + $__¡½brk_c3 + ( +__cÚ¡ + * +__s +,  +__acû±1 +,  +__acû±2 +, + +1136  +__acû±3 +) + +1139 * +__s + !ð'\0' && *__ !ð +__acû±1 + && *__ !ð +__acû±2 + + +1140 && * +__s + !ð +__acû±3 +) + +1141 ++ +__s +; + +1142  * +__s + =ð'\0' ? +NULL + : (*è( +size_t +) __s; + +1143 + } +} + +1149 #ià! +defšed + +_HAVE_STRING_ARCH_¡r¡r + && ! +__GNUC_PREREQ + (2, 97) + +1150  + #¡r¡r +( +hay¡ack +, +ÃedË +) \ + +1151 ( + `__ex‹nsiÚ__ + ( + `__bužtš_cÚ¡ªt_p + ( +ÃedË +è&& + `__¡ršg2_1b±r_p + (needle) \ + +1152 ? ((( +__cÚ¡ + *è( +ÃedË +))[0] == '\0' \ + +1153 ? (*è( +size_t +è( +hay¡ack +) \ + +1154 : ((( +__cÚ¡ + *è( +ÃedË +))[1] == '\0' \ + +1155 ? + `¡rchr + ( +hay¡ack +, \ + +1156 (( +__cÚ¡ + *è( +ÃedË +))[0]) \ + +1157 : + `¡r¡r + ( +hay¡ack +, +ÃedË +))) \ + +1158 : + `¡r¡r + ( +hay¡ack +, +ÃedË +))) + + ) + +1162 #ià! +defšed + +_HAVE_STRING_ARCH_¡¹ok_r + || defšed +_FORCE_INLINES + + +1163 #iâdeà +_HAVE_STRING_ARCH_¡¹ok_r + + +1164  + #__¡¹ok_r +( +s +, +£p +, +Ãx +) \ + +1165 ( + `__ex‹nsiÚ__ + ( + `__bužtš_cÚ¡ªt_p + ( +£p +è&& + `__¡ršg2_1b±r_p + (sep) \ + +1166 && (( +__cÚ¡ + *è( +£p +))[0] != '\0' \ + +1167 && (( +__cÚ¡ + *è( +£p +))[1] == '\0' \ + +1168 ? + `__¡¹ok_r_1c + ( +s +, (( +__cÚ¡ + *è( +£p +))[0], +Ãx +) \ + +1169 : + `__¡¹ok_r + ( +s +, +£p +, +Ãx +))) + + ) + +1172 +__STRING_INLINE + * +__¡¹ok_r_1c + (* +__s +,  +__£p +, ** +__Ãx +); + +1173 +__STRING_INLINE + * + +1174 + $__¡¹ok_r_1c + (* +__s +,  +__£p +, ** +__Ãx +) + +1176 * +__»suÉ +; + +1177 ià( +__s + =ð +NULL +) + +1178 +__s + = * +__Ãx +; + +1179 * +__s + =ð +__£p +) + +1180 ++ +__s +; + +1181 +__»suÉ + = +NULL +; + +1182 ià(* +__s + != '\0') + +1184 +__»suÉ + = +__s +++; + +1185 * +__s + != '\0') + +1186 ià(* +__s +++ =ð +__£p +) + +1188 +__s +[-1] = '\0'; + +1192 * +__Ãx + = +__s +; + +1193  +__»suÉ +; + +1194 + } +} + +1195 #ià +defšed + +__USE_POSIX + || defšed +__USE_MISC + + +1196  + #¡¹ok_r +( +s +, +£p +, +Ãx +è + `__¡¹ok_r + (s, s•,‚ex) + + ) + +1201 #ià! +defšed + +_HAVE_STRING_ARCH_¡r£p + || defšed +_FORCE_INLINES + + +1202 #iâdeà +_HAVE_STRING_ARCH_¡r£p + + +1204 * +__¡r£p_g + (** +__¡ršgp +, +__cÚ¡ + * +__d–im +); + +1205  + #__¡r£p +( +s +, +»jeù +) \ + +1206 +__ex‹nsiÚ__ + \ + +1207 ({  +__r0 +, +__r1 +, +__r2 +; \ + +1208 ( + `__bužtš_cÚ¡ªt_p + ( +»jeù +è&& + `__¡ršg2_1b±r_p + (reject) \ + +1209 && ( +__r0 + = (( +__cÚ¡ + *è( +»jeù +))[0], \ + +1210 (( +__cÚ¡ + *è( +»jeù +))[0] != '\0') \ + +1211 ? (( +__r1 + = (( +__cÚ¡ + *è( +»jeù +))[1], \ + +1212 (( +__cÚ¡ + *è( +»jeù +))[1] == '\0') \ + +1213 ? + `__¡r£p_1c + ( +s +, +__r0 +) \ + +1214 : (( +__r2 + = (( +__cÚ¡ + *è( +»jeù +))[2], __r2 == '\0') \ + +1215 ? + `__¡r£p_2c + ( +s +, +__r0 +, +__r1 +) \ + +1216 : ((( +__cÚ¡ + *è( +»jeù +))[3] == '\0' \ + +1217 ? + `__¡r£p_3c + ( +s +, +__r0 +, +__r1 +, +__r2 +) \ + +1218 : + `__¡r£p_g + ( +s +, +»jeù +)))) \ + +1219 : + `__¡r£p_g + ( +s +, +»jeù +)); }) + + ) + +1222 +__STRING_INLINE + * +__¡r£p_1c + (** +__s +,  +__»jeù +); + +1223 +__STRING_INLINE + * + +1224 + $__¡r£p_1c + (** +__s +,  +__»jeù +) + +1226 * +__»tv® + = * +__s +; + +1227 ià( +__»tv® + !ð +NULL + && (* +__s + = + `¡rchr + (__»tv®, +__»jeù +)) != NULL) + +1228 *(* +__s +)++ = '\0'; + +1229  +__»tv® +; + +1230 + } +} + +1232 +__STRING_INLINE + * +__¡r£p_2c + (** +__s +,  +__»jeù1 +,  +__»jeù2 +); + +1233 +__STRING_INLINE + * + +1234 + $__¡r£p_2c + (** +__s +,  +__»jeù1 +,  +__»jeù2 +) + +1236 * +__»tv® + = * +__s +; + +1237 ià( +__»tv® + !ð +NULL +) + +1239 * +__ý + = +__»tv® +; + +1242 ià(* +__ý + == '\0') + +1244 +__ý + = +NULL +; + +1247 ià(* +__ý + =ð +__»jeù1 + || *__ý =ð +__»jeù2 +) + +1249 * +__ý +++ = '\0'; + +1252 ++ +__ý +; + +1254 * +__s + = +__ý +; + +1256  +__»tv® +; + +1257 + } +} + +1259 +__STRING_INLINE + * +__¡r£p_3c + (** +__s +,  +__»jeù1 +,  +__»jeù2 +, + +1260  +__»jeù3 +); + +1261 +__STRING_INLINE + * + +1262 + $__¡r£p_3c + (** +__s +,  +__»jeù1 +,  +__»jeù2 +,  +__»jeù3 +) + +1264 * +__»tv® + = * +__s +; + +1265 ià( +__»tv® + !ð +NULL +) + +1267 * +__ý + = +__»tv® +; + +1270 ià(* +__ý + == '\0') + +1272 +__ý + = +NULL +; + +1275 ià(* +__ý + =ð +__»jeù1 + || *__ý =ð +__»jeù2 + || *__ý =ð +__»jeù3 +) + +1277 * +__ý +++ = '\0'; + +1280 ++ +__ý +; + +1282 * +__s + = +__ý +; + +1284  +__»tv® +; + +1285 + } +} + +1286 #ifdeà +__USE_BSD + + +1287  + #¡r£p +( +s +, +»jeù +è + `__¡r£p + (s,„ejeù) + + ) + +1294 #ifdeà +__USE_MISC + + +1296 #ià! +defšed + +_HAVE_STRING_ARCH_¡rdup + || !defšed +_HAVE_STRING_ARCH_¡ºdup + + +1297  + #__Ãed_m®loc_ªd_ÿÎoc + + + ) + +1298  + ~<¡dlib.h +> + +1301 #iâdeà +_HAVE_STRING_ARCH_¡rdup + + +1303 * + $__¡rdup + ( +__cÚ¡ + * +__¡ršg +è +__THROW + +__©Œibu‹_m®loc__ +; + +1304  + #__¡rdup +( +s +) \ + +1305 ( + `__ex‹nsiÚ__ + ( + `__bužtš_cÚ¡ªt_p + ( +s +è&& + `__¡ršg2_1b±r_p + (s) \ + +1306 ? ((( +__cÚ¡ + *è( +s +))[0] == '\0' \ + +1307 ? (*è + `ÿÎoc + (( +size_t +) 1, (size_t) 1) \ + +1308 : ({ +size_t + +__Ën + = + `¡¾’ + ( +s +) + 1; \ + +1309 * +__»tv® + = (*è + `m®loc + ( +__Ën +); \ + +1310 ià( +__»tv® + !ð +NULL +) \ + +1311 +__»tv® + = (*è + `memýy + (__»tv®, +s +, +__Ën +); \ + +1312 +__»tv® +; + } +})) \ + +1313 : + `__¡rdup + ( +s +))) + + ) + +1315 #ià +defšed + +__USE_SVID + || defšed +__USE_BSD + || defšed +__USE_XOPEN_EXTENDED + + +1316  + #¡rdup +( +s +è + `__¡rdup + (s) + + ) + +1320 #iâdeà +_HAVE_STRING_ARCH_¡ºdup + + +1322 * + $__¡ºdup + ( +__cÚ¡ + * +__¡ršg +, +size_t + +__n +) + +1323 +__THROW + +__©Œibu‹_m®loc__ +; + +1324  + #__¡ºdup +( +s +, +n +) \ + +1325 ( + `__ex‹nsiÚ__ + ( + `__bužtš_cÚ¡ªt_p + ( +s +è&& + `__¡ršg2_1b±r_p + (s) \ + +1326 ? ((( +__cÚ¡ + *è( +s +))[0] == '\0' \ + +1327 ? (*è + `ÿÎoc + (( +size_t +) 1, (size_t) 1) \ + +1328 : ({ +size_t + +__Ën + = + `¡¾’ + ( +s +) + 1; \ + +1329 +size_t + +__n + = ( +n +); \ + +1330 * +__»tv® +; \ + +1331 ià( +__n + < +__Ën +) \ + +1332 +__Ën + = +__n + + 1; \ + +1333 +__»tv® + = (*è + `m®loc + ( +__Ën +); \ + +1334 ià( +__»tv® + !ð +NULL +) \ + +1336 +__»tv® +[ +__Ën + - 1] = '\0'; \ + +1337 +__»tv® + = (*è + `memýy + (__»tv®, +s +, \ + +1338 +__Ën + - 1); \ + +1340 +__»tv® +; + } +})) \ + +1341 : + `__¡ºdup + ( +s +, +n +))) + + ) + +1343 #ifdeà +__USE_GNU + + +1344  + #¡ºdup +( +s +, +n +è + `__¡ºdup + (s,‚) + + ) + +1350 #iâdeà +_FORCE_INLINES + + +1351 #undeà +__STRING_INLINE + + + @/usr/include/bits/string3.h + +19 #iâdeà +_STRING_H + + +23 +__w¬ndeþ + ( +__w¬n_mem£t_z”o_Ën +, + +26 #iâdeà +__ýlu¥lus + + +30 #undeà +memýy + + +31 #undeà +memmove + + +32 #undeà +mem£t + + +33 #undeà +¡rÿt + + +34 #undeà +¡rýy + + +35 #undeà +¡ºÿt + + +36 #undeà +¡ºýy + + +37 #ifdeà +__USE_GNU + + +38 #undeà +mempýy + + +39 #undeà +¡pýy + + +41 #ifdeà +__USE_BSD + + +42 #undeà +bcÝy + + +43 #undeà +bz”o + + +48 +__ex‹º_®ways_šlše + * + +49 +__NTH + ( + $memýy + (* +__»¡riù + +__de¡ +, +__cÚ¡ + *__»¡riù +__¤c +, + +50 +size_t + +__Ën +)) + +52  + `__bužtš___memýy_chk + ( +__de¡ +, +__¤c +, +__Ën +, + `__bos0 + (__dest)); + +53 + } +} + +55 +__ex‹º_®ways_šlše + * + +56 +__NTH + ( + $memmove + (* +__»¡riù + +__de¡ +, +__cÚ¡ + *__»¡riù +__¤c +, + +57 +size_t + +__Ën +)) + +59  + `__bužtš___memmove_chk + ( +__de¡ +, +__¤c +, +__Ën +, + `__bos0 + (__dest)); + +60 + } +} + +62 #ifdeà +__USE_GNU + + +63 +__ex‹º_®ways_šlše + * + +64 +__NTH + ( + $mempýy + (* +__»¡riù + +__de¡ +, +__cÚ¡ + *__»¡riù +__¤c +, + +65 +size_t + +__Ën +)) + +67  + `__bužtš___mempýy_chk + ( +__de¡ +, +__¤c +, +__Ën +, + `__bos0 + (__dest)); + +68 + } +} + +77 +__ex‹º_®ways_šlše + * + +78 +__NTH + ( + $mem£t + (* +__de¡ +,  +__ch +, +size_t + +__Ën +)) + +80 ià( + `__bužtš_cÚ¡ªt_p + ( +__Ën +) && __len == 0 + +81 && (! + `__bužtš_cÚ¡ªt_p + ( +__ch +) || __ch != 0)) + +83 + `__w¬n_mem£t_z”o_Ën + (); + +84  +__de¡ +; + +86  + `__bužtš___mem£t_chk + ( +__de¡ +, +__ch +, +__Ën +, + `__bos0 + (__dest)); + +87 + } +} + +89 #ifdeà +__USE_BSD + + +90 +__ex‹º_®ways_šlše +  + +91 +__NTH + ( + $bcÝy + ( +__cÚ¡ + * +__»¡riù + +__¤c +, *__»¡riù +__de¡ +, + +92 +size_t + +__Ën +)) + +94 (è + `__bužtš___memmove_chk + ( +__de¡ +, +__¤c +, +__Ën +, + `__bos0 + (__dest)); + +95 + } +} + +97 +__ex‹º_®ways_šlše +  + +98 +__NTH + ( + $bz”o + (* +__de¡ +, +size_t + +__Ën +)) + +100 (è + `__bužtš___mem£t_chk + ( +__de¡ +, '\0', +__Ën +, + `__bos0 + (__dest)); + +101 + } +} + +104 +__ex‹º_®ways_šlše + * + +105 +__NTH + ( + $¡rýy + (* +__»¡riù + +__de¡ +, +__cÚ¡ + *__»¡riù +__¤c +)) + +107  + `__bužtš___¡rýy_chk + ( +__de¡ +, +__¤c +, + `__bos + (__dest)); + +108 + } +} + +110 #ifdeà +__USE_GNU + + +111 +__ex‹º_®ways_šlše + * + +112 +__NTH + ( + $¡pýy + (* +__»¡riù + +__de¡ +, +__cÚ¡ + *__»¡riù +__¤c +)) + +114  + `__bužtš___¡pýy_chk + ( +__de¡ +, +__¤c +, + `__bos + (__dest)); + +115 + } +} + +119 +__ex‹º_®ways_šlše + * + +120 +__NTH + ( + $¡ºýy + (* +__»¡riù + +__de¡ +, +__cÚ¡ + *__»¡riù +__¤c +, + +121 +size_t + +__Ën +)) + +123  + `__bužtš___¡ºýy_chk + ( +__de¡ +, +__¤c +, +__Ën +, + `__bos + (__dest)); + +124 + } +} + +127 * + $__¡²ýy_chk + (* +__de¡ +, +__cÚ¡ + * +__¤c +, +size_t + +__n +, + +128 +size_t + +__de¡Ën +è +__THROW +; + +129 * + `__REDIRECT_NTH + ( +__¡²ýy_®Ÿs +, (* +__de¡ +, + +130 +__cÚ¡ + * +__¤c +, + +131 +size_t + +__n +), +¡²ýy +); + +133 +__ex‹º_®ways_šlše + * + +134 + `__NTH + ( + $¡²ýy + (* +__de¡ +, +__cÚ¡ + * +__¤c +, +size_t + +__n +)) + +136 ià( + `__bos + ( +__de¡ +è!ð( +size_t +) -1 + +137 && (! + `__bužtš_cÚ¡ªt_p + ( +__n +è|| __À<ð + `__bos + ( +__de¡ +))) + +138  + `__¡²ýy_chk + ( +__de¡ +, +__¤c +, +__n +, + `__bos + (__dest)); + +139  + `__¡²ýy_®Ÿs + ( +__de¡ +, +__¤c +, +__n +); + +140 + } +} + +143 +__ex‹º_®ways_šlše + * + +144 +__NTH + ( + $¡rÿt + (* +__»¡riù + +__de¡ +, +__cÚ¡ + *__»¡riù +__¤c +)) + +146  + `__bužtš___¡rÿt_chk + ( +__de¡ +, +__¤c +, + `__bos + (__dest)); + +147 + } +} + +150 +__ex‹º_®ways_šlše + * + +151 +__NTH + ( + $¡ºÿt + (* +__»¡riù + +__de¡ +, +__cÚ¡ + *__»¡riù +__¤c +, + +152 +size_t + +__Ën +)) + +154  + `__bužtš___¡ºÿt_chk + ( +__de¡ +, +__¤c +, +__Ën +, + `__bos + (__dest)); + +155 + } +} + + @/usr/include/bits/sys_errlist.h + +20 #iâdeà +_STDIO_H + + +26 #ifdeà +__USE_BSD + + +27  +sys_ü +; + +28 +__cÚ¡ + *__cÚ¡ +sys_”¾i¡ +[]; + +30 #ifdeà +__USE_GNU + + +31  +_sys_ü +; + +32 +__cÚ¡ + *__cÚ¡ +_sys_”¾i¡ +[]; + + @/usr/include/bits/types.h + +24 #iâdef +_BITS_TYPES_H + + +25  + #_BITS_TYPES_H + 1 + + ) + +27  + ~<ã©u»s.h +> + +28  + ~ + +31  + t__u_ch¬ +; + +32  + t__u_shÜt +; + +33  + t__u_št +; + +34  + t__u_lÚg +; + +37 sigÃd  + t__št8_t +; + +38  + t__ušt8_t +; + +39 sigÃd  + t__št16_t +; + +40  + t__ušt16_t +; + +41 sigÃd  + t__št32_t +; + +42  + t__ušt32_t +; + +43 #ià +__WORDSIZE + == 64 + +44 sigÃd  + t__št64_t +; + +45  + t__ušt64_t +; + +46 #–ià +defšed + +__GLIBC_HAVE_LONG_LONG + + +47 +__ex‹nsiÚ__ + sigÃd  + t__št64_t +; + +48 +__ex‹nsiÚ__ +  + t__ušt64_t +; + +52 #ià +__WORDSIZE + == 64 + +53  + t__quad_t +; + +54  + t__u_quad_t +; + +55 #–ià +defšed + +__GLIBC_HAVE_LONG_LONG + + +56 +__ex‹nsiÚ__ +  + t__quad_t +; + +57 +__ex‹nsiÚ__ +  + t__u_quad_t +; + +61  + m__v® +[2]; + +62 } + t__quad_t +; + +65 +__u_lÚg + + m__v® +[2]; + +66 } + t__u_quad_t +; + +99  + #__S16_TYPE +  + + ) + +100  + #__U16_TYPE +  + + ) + +101  + #__S32_TYPE +  + + ) + +102  + #__U32_TYPE +  + + ) + +103  + #__SLONGWORD_TYPE +  + + ) + +104  + #__ULONGWORD_TYPE +  + + ) + +105 #ià +__WORDSIZE + == 32 + +106  + #__SQUAD_TYPE + +__quad_t + + + ) + +107  + #__UQUAD_TYPE + +__u_quad_t + + + ) + +108  + #__SWORD_TYPE +  + + ) + +109  + #__UWORD_TYPE +  + + ) + +110  + #__SLONG32_TYPE +  + + ) + +111  + #__ULONG32_TYPE +  + + ) + +112  + #__S64_TYPE + +__quad_t + + + ) + +113  + #__U64_TYPE + +__u_quad_t + + + ) + +116  + #__STD_TYPE + +__ex‹nsiÚ__ +  + + ) + +117 #–ià +__WORDSIZE + == 64 + +118  + t__SQUAD_TYPE +  + + ) + +119  + t__UQUAD_TYPE +  + + ) + +120  + t__SWORD_TYPE +  + + ) + +121  + t__UWORD_TYPE +  + + ) + +122  + t__SLONG32_TYPE +  + + ) + +123  + t__ULONG32_TYPE +  + + ) + +124  + t__S64_TYPE +  + + ) + +125  + t__U64_TYPE +  + + ) + +127  + t__STD_TYPE +  + + ) + +131  + ~ + +134 +__STD_TYPE + + t__DEV_T_TYPE + + t__dev_t +; + +135 +__STD_TYPE + +__UID_T_TYPE + + g__uid_t +; + +136 +__STD_TYPE + +__GID_T_TYPE + + g__gid_t +; + +137 +__STD_TYPE + +__INO_T_TYPE + + g__šo_t +; + +138 +__STD_TYPE + +__INO64_T_TYPE + + g__šo64_t +; + +139 +__STD_TYPE + +__MODE_T_TYPE + + g__mode_t +; + +140 +__STD_TYPE + +__NLINK_T_TYPE + + g__Æšk_t +; + +141 +__STD_TYPE + +__OFF_T_TYPE + + g__off_t +; + +142 +__STD_TYPE + +__OFF64_T_TYPE + + g__off64_t +; + +143 +__STD_TYPE + +__PID_T_TYPE + + g__pid_t +; + +144 +__STD_TYPE + +__FSID_T_TYPE + + g__fsid_t +; + +145 +__STD_TYPE + +__CLOCK_T_TYPE + + g__þock_t +; + +146 +__STD_TYPE + +__RLIM_T_TYPE + + g__¾im_t +; + +147 +__STD_TYPE + +__RLIM64_T_TYPE + + g__¾im64_t +; + +148 +__STD_TYPE + +__ID_T_TYPE + + g__id_t +; + +149 +__STD_TYPE + +__TIME_T_TYPE + + g__time_t +; + +150 +__STD_TYPE + +__USECONDS_T_TYPE + + g__u£cÚds_t +; + +151 +__STD_TYPE + +__SUSECONDS_T_TYPE + + g__su£cÚds_t +; + +153 +__STD_TYPE + +__DADDR_T_TYPE + + g__daddr_t +; + +154 +__STD_TYPE + +__SWBLK_T_TYPE + + g__swblk_t +; + +155 +__STD_TYPE + +__KEY_T_TYPE + + g__key_t +; + +158 +__STD_TYPE + +__CLOCKID_T_TYPE + + g__þockid_t +; + +161 +__STD_TYPE + +__TIMER_T_TYPE + + g__tim”_t +; + +164 +__STD_TYPE + +__BLKSIZE_T_TYPE + + g__blksize_t +; + +169 +__STD_TYPE + +__BLKCNT_T_TYPE + + g__blkút_t +; + +170 +__STD_TYPE + +__BLKCNT64_T_TYPE + + g__blkút64_t +; + +173 +__STD_TYPE + +__FSBLKCNT_T_TYPE + + g__fsblkút_t +; + +174 +__STD_TYPE + +__FSBLKCNT64_T_TYPE + + g__fsblkút64_t +; + +177 +__STD_TYPE + +__FSFILCNT_T_TYPE + + g__fsfžút_t +; + +178 +__STD_TYPE + +__FSFILCNT64_T_TYPE + + g__fsfžút64_t +; + +180 +__STD_TYPE + +__SSIZE_T_TYPE + + g__ssize_t +; + +184  +__off64_t + + t__loff_t +; + +185  +__quad_t + * + t__qaddr_t +; + +186 * + t__ÿddr_t +; + +189 +__STD_TYPE + +__SWORD_TYPE + + g__šŒ_t +; + +192 +__STD_TYPE + +__U32_TYPE + + g__sockËn_t +; + +195 #undeà +__STD_TYPE + + + @/usr/include/features.h + +19 #iâdef +_FEATURES_H + + +20  + #_FEATURES_H + 1 + + ) + +95 #undeà +__USE_ISOC99 + + +96 #undeà +__USE_ISOC95 + + +97 #undeà +__USE_POSIX + + +98 #undeà +__USE_POSIX2 + + +99 #undeà +__USE_POSIX199309 + + +100 #undeà +__USE_POSIX199506 + + +101 #undeà +__USE_XOPEN + + +102 #undeà +__USE_XOPEN_EXTENDED + + +103 #undeà +__USE_UNIX98 + + +104 #undeà +__USE_XOPEN2K + + +105 #undeà +__USE_XOPEN2K8 + + +106 #undeà +__USE_LARGEFILE + + +107 #undeà +__USE_LARGEFILE64 + + +108 #undeà +__USE_FILE_OFFSET64 + + +109 #undeà +__USE_BSD + + +110 #undeà +__USE_SVID + + +111 #undeà +__USE_MISC + + +112 #undeà +__USE_ATFILE + + +113 #undeà +__USE_GNU + + +114 #undeà +__USE_REENTRANT + + +115 #undeà +__USE_FORTIFY_LEVEL + + +116 #undeà +__FAVOR_BSD + + +117 #undeà +__KERNEL_STRICT_NAMES + + +121 #iâdeà +_LOOSE_KERNEL_NAMES + + +122  + #__KERNEL_STRICT_NAMES + + + ) + +126  + #__USE_ANSI + 1 + + ) + +135 #ià +defšed + +__GNUC__ + && defšed +__GNUC_MINOR__ + + +136  + #__GNUC_PREREQ +( +maj +, +mš +) \ + +137 (( +__GNUC__ + << 16è+ +__GNUC_MINOR__ + >ð(( +maj +è<< 16è+ ( +mš +)) + + ) + +139  + #__GNUC_PREREQ +( +maj +, +mš +è0 + + ) + +144 #ià +defšed + +_BSD_SOURCE + && \ + +145 !( +defšed + + g_POSIX_SOURCE + || defšed + g_POSIX_C_SOURCE + || \ + +146 +defšed + + g_XOPEN_SOURCE + || defšed + g_XOPEN_SOURCE_EXTENDED + || \ + +147 +defšed + + g_GNU_SOURCE + || defšed + g_SVID_SOURCE +) + +148  + #__FAVOR_BSD + 1 + + ) + +152 #ifdeà +_GNU_SOURCE + + +153 #undeà +_ISOC99_SOURCE + + +154  + #_ISOC99_SOURCE + 1 + + ) + +155 #undeà +_POSIX_SOURCE + + +156  + #_POSIX_SOURCE + 1 + + ) + +157 #undeà +_POSIX_C_SOURCE + + +158  + #_POSIX_C_SOURCE + 200809L + + ) + +159 #undeà +_XOPEN_SOURCE + + +160  + #_XOPEN_SOURCE + 700 + + ) + +161 #undeà +_XOPEN_SOURCE_EXTENDED + + +162  + #_XOPEN_SOURCE_EXTENDED + 1 + + ) + +163 #undeà +_LARGEFILE64_SOURCE + + +164  + #_LARGEFILE64_SOURCE + 1 + + ) + +165 #undeà +_BSD_SOURCE + + +166  + #_BSD_SOURCE + 1 + + ) + +167 #undeà +_SVID_SOURCE + + +168  + #_SVID_SOURCE + 1 + + ) + +169 #undeà +_ATFILE_SOURCE + + +170  + #_ATFILE_SOURCE + 1 + + ) + +175 #ià(! +defšed + +__STRICT_ANSI__ + && !defšed +_ISOC99_SOURCE + && \ + +176 ! +defšed + + g_POSIX_SOURCE + && !defšed + g_POSIX_C_SOURCE + && \ + +177 ! +defšed + + g_XOPEN_SOURCE + && !defšed + g_XOPEN_SOURCE_EXTENDED + && \ + +178 ! +defšed + + g_BSD_SOURCE + && !defšed + g_SVID_SOURCE +) + +179  + #_BSD_SOURCE + 1 + + ) + +180  + #_SVID_SOURCE + 1 + + ) + +187 #ià( +defšed + +_ISOC99_SOURCE + || defšed +_ISOC9X_SOURCE + \ + +188 || ( +defšed + + g__STDC_VERSION__ + && __STDC_VERSION__ >= 199901L)) + +189  + #__USE_ISOC99 + 1 + + ) + +193 #ià( +defšed + +_ISOC99_SOURCE + || defšed +_ISOC9X_SOURCE + \ + +194 || ( +defšed + +__STDC_VERSION__ + && __STDC_VERSION__ >= 199409L)) + +195  + #__USE_ISOC95 + 1 + + ) + +200 #ià((! +defšed + +__STRICT_ANSI__ + || ( +_XOPEN_SOURCE + - 0) >= 500) && \ + +201 ! +defšed + +_POSIX_SOURCE + && !defšed +_POSIX_C_SOURCE +) + +202  + #_POSIX_SOURCE + 1 + + ) + +203 #ià +defšed + +_XOPEN_SOURCE + && (_XOPEN_SOURCE - 0) < 500 + +204  + #_POSIX_C_SOURCE + 2 + + ) + +205 #–ià +defšed + +_XOPEN_SOURCE + && (_XOPEN_SOURCE - 0) < 600 + +206  + #_POSIX_C_SOURCE + 199506L + + ) + +207 #–ià +defšed + +_XOPEN_SOURCE + && (_XOPEN_SOURCE - 0) < 700 + +208  + #_POSIX_C_SOURCE + 200112L + + ) + +210  + #_POSIX_C_SOURCE + 200809L + + ) + +212  + #__USE_POSIX_IMPLICITLY + 1 + + ) + +215 #ià +defšed + +_POSIX_SOURCE + || +_POSIX_C_SOURCE + >ð1 || defšed +_XOPEN_SOURCE + + +216  + #__USE_POSIX + 1 + + ) + +219 #ià +defšed + +_POSIX_C_SOURCE + && _POSIX_C_SOURCE >ð2 || defšed +_XOPEN_SOURCE + + +220  + #__USE_POSIX2 + 1 + + ) + +223 #ià( +_POSIX_C_SOURCE + - 0) >= 199309L + +224  + #__USE_POSIX199309 + 1 + + ) + +227 #ià( +_POSIX_C_SOURCE + - 0) >= 199506L + +228  + #__USE_POSIX199506 + 1 + + ) + +231 #ià( +_POSIX_C_SOURCE + - 0) >= 200112L + +232  + #__USE_XOPEN2K + 1 + + ) + +233 #undeà +__USE_ISOC99 + + +234  + #__USE_ISOC99 + 1 + + ) + +237 #ià( +_POSIX_C_SOURCE + - 0) >= 200809L + +238  + #__USE_XOPEN2K8 + 1 + + ) + +239 #undeà +_ATFILE_SOURCE + + +240  + #_ATFILE_SOURCE + 1 + + ) + +243 #ifdef +_XOPEN_SOURCE + + +244  + #__USE_XOPEN + 1 + + ) + +245 #ià( +_XOPEN_SOURCE + - 0) >= 500 + +246  + #__USE_XOPEN_EXTENDED + 1 + + ) + +247  + #__USE_UNIX98 + 1 + + ) + +248 #undeà +_LARGEFILE_SOURCE + + +249  + #_LARGEFILE_SOURCE + 1 + + ) + +250 #ià( +_XOPEN_SOURCE + - 0) >= 600 + +251 #ià( +_XOPEN_SOURCE + - 0) >= 700 + +252  + #__USE_XOPEN2K8 + 1 + + ) + +254  + #__USE_XOPEN2K + 1 + + ) + +255 #undeà +__USE_ISOC99 + + +256  + #__USE_ISOC99 + 1 + + ) + +259 #ifdeà +_XOPEN_SOURCE_EXTENDED + + +260  + #__USE_XOPEN_EXTENDED + 1 + + ) + +265 #ifdeà +_LARGEFILE_SOURCE + + +266  + #__USE_LARGEFILE + 1 + + ) + +269 #ifdeà +_LARGEFILE64_SOURCE + + +270  + #__USE_LARGEFILE64 + 1 + + ) + +273 #ià +defšed + +_FILE_OFFSET_BITS + && _FILE_OFFSET_BITS == 64 + +274  + #__USE_FILE_OFFSET64 + 1 + + ) + +277 #ià +defšed + +_BSD_SOURCE + || defšed +_SVID_SOURCE + + +278  + #__USE_MISC + 1 + + ) + +281 #ifdef +_BSD_SOURCE + + +282  + #__USE_BSD + 1 + + ) + +285 #ifdef +_SVID_SOURCE + + +286  + #__USE_SVID + 1 + + ) + +289 #ifdef +_ATFILE_SOURCE + + +290  + #__USE_ATFILE + 1 + + ) + +293 #ifdef +_GNU_SOURCE + + +294  + #__USE_GNU + 1 + + ) + +297 #ià +defšed + +_REENTRANT + || defšed +_THREAD_SAFE + + +298  + #__USE_REENTRANT + 1 + + ) + +301 #ià +defšed + +_FORTIFY_SOURCE + && _FORTIFY_SOURCE > 0 \ + +302 && +__GNUC_PREREQ + (4, 1è&& +defšed + + g__OPTIMIZE__ + && __OPTIMIZE__ > 0 + +303 #ià +_FORTIFY_SOURCE + > 1 + +304  + #__USE_FORTIFY_LEVEL + 2 + + ) + +306  + #__USE_FORTIFY_LEVEL + 1 + + ) + +309  + #__USE_FORTIFY_LEVEL + 0 + + ) + +313  + ~ + +316  + #__STDC_ISO_10646__ + 200009L + + ) + +324 #undeà +__GNU_LIBRARY__ + + +325  + #__GNU_LIBRARY__ + 6 + + ) + +329  + #__GLIBC__ + 2 + + ) + +330  + #__GLIBC_MINOR__ + 11 + + ) + +332  + #__GLIBC_PREREQ +( +maj +, +mš +) \ + +333 (( +__GLIBC__ + << 16è+ +__GLIBC_MINOR__ + >ð(( +maj +è<< 16è+ ( +mš +)) + + ) + +336 #ià +defšed + +__GNUC__ + \ + +337 || ( +defšed + + g__PGI + && defšed + g__i386__ + ) \ + +338 || ( +defšed + + g__INTEL_COMPILER + && (defšed + g__i386__ + || defšed + g__Ÿ64__ +)) \ + +339 || ( +defšed + + g__STDC_VERSION__ + && __STDC_VERSION__ >= 199901L) + +340  + #__GLIBC_HAVE_LONG_LONG + 1 + + ) + +344 #iâdeà +__ASSEMBLER__ + + +345 #iâdeà +_SYS_CDEFS_H + + +346  + ~ + +351 #ià +defšed + +__USE_FILE_OFFSET64 + && !defšed +__REDIRECT + + +352  + #__USE_LARGEFILE + 1 + + ) + +353  + #__USE_LARGEFILE64 + 1 + + ) + +359 #ià +__GNUC_PREREQ + (2, 7è&& +defšed + +__OPTIMIZE__ + \ + +360 && ! +defšed + + g__OPTIMIZE_SIZE__ + && !defšed + g__NO_INLINE__ + \ + +361 && +defšed + + g__ex‹º_šlše + + +362  + #__USE_EXTERN_INLINES + 1 + + ) + +367 #ià +__GNUC_PREREQ + (2, 7è&& +defšed + +__OPTIMIZE__ + \ + +368 && ( +defšed + + g_LIBC + || !defšed + g__OPTIMIZE_SIZE__ +è&& !defšed + g__NO_INLINE__ + \ + +369 && +defšed + + g__ex‹º_šlše + + +370  + #__USE_EXTERN_INLINES_IN_LIBC + 1 + + ) + +378  + ~ + + @/usr/include/getopt.h + +21 #iâdeà +_GETOPT_H + + +23 #iâdeà +__Ãed_g‘Ýt + + +24  + #_GETOPT_H + 1 + + ) + +34 #ià! +defšed + +__GNU_LIBRARY__ + + +35  + ~<ùy³.h +> + +38 #iâdeà +__THROW + + +39 #iâdeà +__GNUC_PREREQ + + +40  + #__GNUC_PREREQ +( +maj +, +mš +è(0) + + ) + +42 #ià +defšed + +__ýlu¥lus + && +__GNUC_PREREQ + (2,8) + +43  + #__THROW + + `throw + () + + ) + +45  + #__THROW + + + ) + +49 #ifdef +__ýlu¥lus + + +59 * +Ýrg +; + +73  +Ýtšd +; + +78  +Ý‹¼ +; + +82  +ÝtÝt +; + +84 #iâdeà +__Ãed_g‘Ýt + + +106  + sÝtiÚ + + +108 cÚ¡ * + gÇme +; + +111  + ghas_¬g +; + +112 * + gæag +; + +113  + gv® +; + +118  + #no_¬gum’t + 0 + + ) + +119  + #»quœed_¬gum’t + 1 + + ) + +120  + #ÝtiÚ®_¬gum’t + 2 + + ) + +148 #ifdeà +__GNU_LIBRARY__ + + +152  +g‘Ýt + ( +___¬gc +, *cÚ¡ * +___¬gv +, cÚ¡ * +__shÜtÝts +) + +153 +__THROW +; + +155 #ià +defšed + +__Ãed_g‘Ýt + && defšed +__USE_POSIX2 + \ + +156 && ! +defšed + + g__USE_POSIX_IMPLICITLY + && !defšed + g__USE_GNU + + +160 #ifdeà +__REDIRECT + + +161  +__REDIRECT + ( +g‘Ýt +, ( +___¬gc +, *cÚ¡ * +___¬gv +, + +162 cÚ¡ * +__shÜtÝts +), + +163 +__posix_g‘Ýt +è +__THROW +; + +165  +__posix_g‘Ýt + ( +___¬gc +, *cÚ¡ * +___¬gv +, + +166 cÚ¡ * +__shÜtÝts +è +__THROW +; + +167  + #g‘Ýt + +__posix_g‘Ýt + + + ) + +171  +g‘Ýt + (); + +174 #iâdeà +__Ãed_g‘Ýt + + +175  +g‘Ýt_lÚg + ( +___¬gc +, *cÚ¡ * +___¬gv +, + +176 cÚ¡ * +__shÜtÝts +, + +177 cÚ¡  +ÝtiÚ + * +__lÚgÝts +, * +__lÚgšd +) + +178 +__THROW +; + +179  +g‘Ýt_lÚg_Úly + ( +___¬gc +, *cÚ¡ * +___¬gv +, + +180 cÚ¡ * +__shÜtÝts +, + +181 cÚ¡  +ÝtiÚ + * +__lÚgÝts +, * +__lÚgšd +) + +182 +__THROW +; + +186 #ifdef +__ýlu¥lus + + +191 #undeà +__Ãed_g‘Ýt + + + @/usr/include/libio.h + +29 #iâdeà +_IO_STDIO_H + + +30  + #_IO_STDIO_H + + + ) + +32  + ~<_G_cÚfig.h +> + +34  + #_IO_pos_t + +_G_åos_t + + + ) + +35  + #_IO_åos_t + +_G_åos_t + + + ) + +36  + #_IO_åos64_t + +_G_åos64_t + + + ) + +37  + #_IO_size_t + +_G_size_t + + + ) + +38  + #_IO_ssize_t + +_G_ssize_t + + + ) + +39  + #_IO_off_t + +_G_off_t + + + ) + +40  + #_IO_off64_t + +_G_off64_t + + + ) + +41  + #_IO_pid_t + +_G_pid_t + + + ) + +42  + #_IO_uid_t + +_G_uid_t + + + ) + +43  + #_IO_icÚv_t + +_G_icÚv_t + + + ) + +44  + #_IO_HAVE_SYS_WAIT + +_G_HAVE_SYS_WAIT + + + ) + +45  + #_IO_HAVE_ST_BLKSIZE + +_G_HAVE_ST_BLKSIZE + + + ) + +46  + #_IO_BUFSIZ + +_G_BUFSIZ + + + ) + +47  + #_IO_va_li¡ + +_G_va_li¡ + + + ) + +48  + #_IO_wšt_t + +_G_wšt_t + + + ) + +50 #ifdeà +_G_NEED_STDARG_H + + +52  + #__Ãed___va_li¡ + + + ) + +53  + ~<¡d¬g.h +> + +54 #ifdeà +__GNUC_VA_LIST + + +55 #undeà +_IO_va_li¡ + + +56  + #_IO_va_li¡ + +__gnuc_va_li¡ + + + ) + +60 #iâdeà +__P + + +61 #ià +_G_HAVE_SYS_CDEFS + + +62  + ~ + +64 #ifdeà +__STDC__ + + +65  + #__P +( +p +è + ) +p + +66  + #__PMT +( +p +è + ) +p + +68  + #__P +( +p +è() + + ) + +69  + #__PMT +( +p +è() + + ) + +75 #iâdeà +_PARAMS + + +76  + #_PARAMS +( +´Ùos +è + `__P +ÕrÙos) + + ) + +79 #iâdeà +__STDC__ + + +81 cÚ¡ + + ) + +84  + #_IO_UNIFIED_JUMPTABLES + 1 + + ) + +85 #iâdeà +_G_HAVE_PRINTF_FP + + +86  + #_IO_USE_DTOA + 1 + + ) + +89 #iâdeà +EOF + + +90  + #EOF + (-1) + + ) + +92 #iâdeà +NULL + + +93 #ià +defšed + +__GNUG__ + && \ + +94 ( + g__GNUC__ + > 2 || (__GNUC__ =ð2 && +__GNUC_MINOR__ + >= 8)) + +95  + #NULL + ( +__nuÎ +) + + ) + +97 #ià! +defšed +( +__ýlu¥lus +) + +98  + #NULL + ((*)0) + + ) + +100  + #NULL + (0) + + ) + +105  + #_IOS_INPUT + 1 + + ) + +106  + #_IOS_OUTPUT + 2 + + ) + +107  + #_IOS_ATEND + 4 + + ) + +108  + #_IOS_APPEND + 8 + + ) + +109  + #_IOS_TRUNC + 16 + + ) + +110  + #_IOS_NOCREATE + 32 + + ) + +111  + #_IOS_NOREPLACE + 64 + + ) + +112  + #_IOS_BIN + 128 + + ) + +120  + #_IO_MAGIC + 0xFBAD0000 + + ) + +121  + #_OLD_STDIO_MAGIC + 0xFABC0000 + + ) + +122  + #_IO_MAGIC_MASK + 0xFFFF0000 + + ) + +123  + #_IO_USER_BUF + 1 + + ) + +124  + #_IO_UNBUFFERED + 2 + + ) + +125  + #_IO_NO_READS + 4 + + ) + +126  + #_IO_NO_WRITES + 8 + + ) + +127  + #_IO_EOF_SEEN + 0x10 + + ) + +128  + #_IO_ERR_SEEN + 0x20 + + ) + +129  + #_IO_DELETE_DONT_CLOSE + 0x40 + + ) + +130  + #_IO_LINKED + 0x80 + + ) + +131  + #_IO_IN_BACKUP + 0x100 + + ) + +132  + #_IO_LINE_BUF + 0x200 + + ) + +133  + #_IO_TIED_PUT_GET + 0x400 + + ) + +134  + #_IO_CURRENTLY_PUTTING + 0x800 + + ) + +135  + #_IO_IS_APPENDING + 0x1000 + + ) + +136  + #_IO_IS_FILEBUF + 0x2000 + + ) + +137  + #_IO_BAD_SEEN + 0x4000 + + ) + +138  + #_IO_USER_LOCK + 0x8000 + + ) + +140  + #_IO_FLAGS2_MMAP + 1 + + ) + +141  + #_IO_FLAGS2_NOTCANCEL + 2 + + ) + +142 #ifdeà +_LIBC + + +143  + #_IO_FLAGS2_FORTIFY + 4 + + ) + +145  + #_IO_FLAGS2_USER_WBUF + 8 + + ) + +146 #ifdeà +_LIBC + + +147  + #_IO_FLAGS2_SCANF_STD + 16 + + ) + +151  + #_IO_SKIPWS + 01 + + ) + +152  + #_IO_LEFT + 02 + + ) + +153  + #_IO_RIGHT + 04 + + ) + +154  + #_IO_INTERNAL + 010 + + ) + +155  + #_IO_DEC + 020 + + ) + +156  + #_IO_OCT + 040 + + ) + +157  + #_IO_HEX + 0100 + + ) + +158  + #_IO_SHOWBASE + 0200 + + ) + +159  + #_IO_SHOWPOINT + 0400 + + ) + +160  + #_IO_UPPERCASE + 01000 + + ) + +161  + #_IO_SHOWPOS + 02000 + + ) + +162  + #_IO_SCIENTIFIC + 04000 + + ) + +163  + #_IO_FIXED + 010000 + + ) + +164  + #_IO_UNITBUF + 020000 + + ) + +165  + #_IO_STDIO + 040000 + + ) + +166  + #_IO_DONT_CLOSE + 0100000 + + ) + +167  + #_IO_BOOLALPHA + 0200000 + + ) + +170  +_IO_jump_t +;  + g_IO_FILE +; + +173 #ifdeà +_IO_MTSAFE_IO + + +174 #ià +defšed + +__GLIBC__ + && __GLIBC__ >= 2 + +175  + ~ + +180  + t_IO_lock_t +; + +186  + s_IO_m¬k” + { + +187  +_IO_m¬k” + * + m_Ãxt +; + +188  +_IO_FILE + * + m_sbuf +; + +192  + m_pos +; + +194  +£t_¡»ampos +( +¡»ampos + +¥ +è{ + m_¥os + = sp; } + +195  +£t_off£t +( +off£t +è{ + m_pos + = off£t; + m_¥os + = ( +¡»ampos +)(-2); } + +196 + mpublic +: + +197 +¡»amm¬k” +( +¡»ambuf + * +sb +); + +198 ~ +¡»amm¬k” +(); + +199  +§všg +(è{  + m_¥os + == -2; } + +200  +d– +( +¡»amm¬k” +&); + +201  +d– +(); + +206 + e__codecvt_»suÉ + + +208 + m__codecvt_ok +, + +209 + m__codecvt_·¹Ÿl +, + +210 + m__codecvt_”rÜ +, + +211 + m__codecvt_nocÚv + + +214 #ià +defšed + +_LIBC + || defšed +_GLIBCPP_USE_WCHAR_T + + +217  + s_IO_codecvt + + +219 (* + m__codecvt_de¡r +è( + m_IO_codecvt + *); + +220 +__codecvt_»suÉ + (* +__codecvt_do_out +è( + m_IO_codecvt + *, + +221 + m__mb¡©e_t + *, + +222 cÚ¡ + mwch¬_t + *, + +223 cÚ¡ + mwch¬_t + *, + +224 cÚ¡ + mwch¬_t + **, *, + +226 +__codecvt_»suÉ + (* +__codecvt_do_unshiá +è( + m_IO_codecvt + *, + +227 + m__mb¡©e_t + *, *, + +229 +__codecvt_»suÉ + (* +__codecvt_do_š +è( + m_IO_codecvt + *, + +230 + m__mb¡©e_t + *, + +232 cÚ¡ **, + mwch¬_t + *, + +233 + mwch¬_t + *, wchar_t **); + +234 (* + m__codecvt_do_’codšg +è( + m_IO_codecvt + *); + +235 (* + m__codecvt_do_®ways_nocÚv +è( + m_IO_codecvt + *); + +236 (* + m__codecvt_do_Ëngth +è( + m_IO_codecvt + *, + m__mb¡©e_t + *, + +237 cÚ¡ *, cÚ¡ *, + m_IO_size_t +); + +238 (* + m__codecvt_do_max_Ëngth +è( + m_IO_codecvt + *); + +240 +_IO_icÚv_t + + m__cd_š +; + +241 +_IO_icÚv_t + + m__cd_out +; + +245  + s_IO_wide_d©a + + +247 +wch¬_t + * + m_IO_»ad_±r +; + +248 +wch¬_t + * + m_IO_»ad_’d +; + +249 +wch¬_t + * + m_IO_»ad_ba£ +; + +250 +wch¬_t + * + m_IO_wr™e_ba£ +; + +251 +wch¬_t + * + m_IO_wr™e_±r +; + +252 +wch¬_t + * + m_IO_wr™e_’d +; + +253 +wch¬_t + * + m_IO_buf_ba£ +; + +254 +wch¬_t + * + m_IO_buf_’d +; + +256 +wch¬_t + * + m_IO_§ve_ba£ +; + +257 +wch¬_t + * + m_IO_backup_ba£ +; + +259 +wch¬_t + * + m_IO_§ve_’d +; + +261 +__mb¡©e_t + + m_IO_¡©e +; + +262 +__mb¡©e_t + + m_IO_Ï¡_¡©e +; + +263  +_IO_codecvt + + m_codecvt +; + +265 +wch¬_t + + m_shÜtbuf +[1]; + +267 cÚ¡  +_IO_jump_t + * + m_wide_vbË +; + +271  + s_IO_FILE + { + +272  + m_æags +; + +273  + #_IO_fže_æags + +_æags + + + ) + +277 * + m_IO_»ad_±r +; + +278 * + m_IO_»ad_’d +; + +279 * + m_IO_»ad_ba£ +; + +280 * + m_IO_wr™e_ba£ +; + +281 * + m_IO_wr™e_±r +; + +282 * + m_IO_wr™e_’d +; + +283 * + m_IO_buf_ba£ +; + +284 * + m_IO_buf_’d +; + +286 * + m_IO_§ve_ba£ +; + +287 * + m_IO_backup_ba£ +; + +288 * + m_IO_§ve_’d +; + +290  +_IO_m¬k” + * + m_m¬k”s +; + +292  +_IO_FILE + * + m_chaš +; + +294  + m_fž’o +; + +296  + m_blksize +; + +298  + m_æags2 +; + +300 +_IO_off_t + + m_Þd_off£t +; + +302  + #__HAVE_COLUMN + + + ) + +304  + m_cur_cÞumn +; + +305 sigÃd  + m_vbË_off£t +; + +306  + m_shÜtbuf +[1]; + +310 +_IO_lock_t + * + m_lock +; + +311 #ifdeà +_IO_USE_OLD_IO_FILE + + +314  + s_IO_FILE_com¶‘e + + +316  +_IO_FILE + + m_fže +; + +318 #ià +defšed + +_G_IO_IO_FILE_VERSION + && _G_IO_IO_FILE_VERSION == 0x20001 + +319 +_IO_off64_t + + m_off£t +; + +320 #ià +defšed + +_LIBC + || defšed +_GLIBCPP_USE_WCHAR_T + + +322  +_IO_codecvt + * + m_codecvt +; + +323  +_IO_wide_d©a + * + m_wide_d©a +; + +324  +_IO_FILE + * + m_ä“»s_li¡ +; + +325 * + m_ä“»s_buf +; + +326 +size_t + + m_ä“»s_size +; + +328 * + m__·d1 +; + +329 * + m__·d2 +; + +330 * + m__·d3 +; + +331 * + m__·d4 +; + +332 +size_t + + m__·d5 +; + +334  + m_mode +; + +336  + m_unu£d2 +[15 *  (è- 4 *  (*è-  ( +size_t +)]; + +340 #iâdeà +__ýlu¥lus + + +341  +_IO_FILE + + t_IO_FILE +; + +344  + g_IO_FILE_¶us +; + +346  +_IO_FILE_¶us + +_IO_2_1_¡dš_ +; + +347  +_IO_FILE_¶us + +_IO_2_1_¡dout_ +; + +348  +_IO_FILE_¶us + +_IO_2_1_¡d”r_ +; + +349 #iâdeà +_LIBC + + +350  + #_IO_¡dš + (( +_IO_FILE +*)(& +_IO_2_1_¡dš_ +)) + + ) + +351  + #_IO_¡dout + (( +_IO_FILE +*)(& +_IO_2_1_¡dout_ +)) + + ) + +352  + #_IO_¡d”r + (( +_IO_FILE +*)(& +_IO_2_1_¡d”r_ +)) + + ) + +354 +_IO_FILE + * +_IO_¡dš + +©Œibu‹_hidd’ +; + +355 +_IO_FILE + * +_IO_¡dout + +©Œibu‹_hidd’ +; + +356 +_IO_FILE + * +_IO_¡d”r + +©Œibu‹_hidd’ +; + +364  +__ssize_t + + t__io_»ad_â + (* + t__cook› +, * + t__buf +, + tsize_t + + t__nby‹s +); + +372  +__ssize_t + + t__io_wr™e_â + (* + t__cook› +, + t__cÚ¡ + * + t__buf +, + +373 + tsize_t + + t__n +); + +381  + t__io_£ek_â + (* + t__cook› +, + t_IO_off64_t + * + t__pos +,  + t__w +); + +384  + t__io_þo£_â + (* + t__cook› +); + +387 #ifdeà +_GNU_SOURCE + + +389  +__io_»ad_â + + tcook›_»ad_funùiÚ_t +; + +390  +__io_wr™e_â + + tcook›_wr™e_funùiÚ_t +; + +391  +__io_£ek_â + + tcook›_£ek_funùiÚ_t +; + +392  +__io_þo£_â + + tcook›_þo£_funùiÚ_t +; + +397 +__io_»ad_â + * + m»ad +; + +398 +__io_wr™e_â + * + mwr™e +; + +399 +__io_£ek_â + * + m£ek +; + +400 +__io_þo£_â + * + mþo£ +; + +401 } + t_IO_cook›_io_funùiÚs_t +; + +402  +_IO_cook›_io_funùiÚs_t + + tcook›_io_funùiÚs_t +; + +404  + g_IO_cook›_fže +; + +407  +_IO_cook›_š™ + ( +_IO_cook›_fže + * +__cfže +,  +__»ad_wr™e +, + +408 * +__cook› +, +_IO_cook›_io_funùiÚs_t + +__âs +); + +412 #ifdeà +__ýlu¥lus + + +416  +__und”æow + ( +_IO_FILE + *); + +417  +__uæow + ( +_IO_FILE + *); + +418  +__ov”æow + ( +_IO_FILE + *, ); + +419 #ià +defšed + +_LIBC + || defšed +_GLIBCPP_USE_WCHAR_T + + +420 +_IO_wšt_t + +__wund”æow + ( +_IO_FILE + *); + +421 +_IO_wšt_t + +__wuæow + ( +_IO_FILE + *); + +422 +_IO_wšt_t + +__wov”æow + ( +_IO_FILE + *, _IO_wint_t); + +425 #ià +__GNUC__ + >= 3 + +426  + #_IO_BE +( +ex´ +, +»s +è + `__bužtš_ex³ù + (Óx´),„es) + + ) + +428  + #_IO_BE +( +ex´ +, +»s +èÓx´) + + ) + +431  + #_IO_g‘c_uÆocked +( +_å +) \ + +432 ( + `_IO_BE + (( +_å +)-> +_IO_»ad_±r + >ð(_å)-> +_IO_»ad_’d +, 0) \ + +433 ? + `__uæow + ( +_å +è: *(*è(_å)-> +_IO_»ad_±r +++) + + ) + +434  + #_IO_³ekc_uÆocked +( +_å +) \ + +435 ( + `_IO_BE + (( +_å +)-> +_IO_»ad_±r + >ð(_å)-> +_IO_»ad_’d +, 0) \ + +436 && + `__und”æow + ( +_å +è=ð +EOF + ? EOF \ + +437 : *(*è( +_å +)-> +_IO_»ad_±r +) + + ) + +438  + #_IO_putc_uÆocked +( +_ch +, +_å +) \ + +439 ( + `_IO_BE + (( +_å +)-> +_IO_wr™e_±r + >ð(_å)-> +_IO_wr™e_’d +, 0) \ + +440 ? + `__ov”æow + ( +_å +, (è( +_ch +)) \ + +441 : (è(*( +_å +)-> +_IO_wr™e_±r +++ = ( +_ch +))) + + ) + +443 #ià +defšed + +_LIBC + || defšed +_GLIBCPP_USE_WCHAR_T + + +444  + #_IO_g‘wc_uÆocked +( +_å +) \ + +445 ( + `_IO_BE + (( +_å +)-> +_wide_d©a + =ð +NULL + \ + +446 || (( +_å +)-> +_wide_d©a +-> +_IO_»ad_±r + \ + +447 >ð( +_å +)-> +_wide_d©a +-> +_IO_»ad_’d +), 0) \ + +448 ? + `__wuæow + ( +_å +è: ( +_IO_wšt_t +è*(_å)-> +_wide_d©a +-> +_IO_»ad_±r +++) + + ) + +449  + #_IO_putwc_uÆocked +( +_wch +, +_å +) \ + +450 ( + `_IO_BE + (( +_å +)-> +_wide_d©a + =ð +NULL + \ + +451 || (( +_å +)-> +_wide_d©a +-> +_IO_wr™e_±r + \ + +452 >ð( +_å +)-> +_wide_d©a +-> +_IO_wr™e_’d +), 0) \ + +453 ? + `__wov”æow + ( +_å +, +_wch +) \ + +454 : ( +_IO_wšt_t +è(*( +_å +)-> +_wide_d©a +-> +_IO_wr™e_±r +++ = ( +_wch +))) + + ) + +457  + #_IO_ãof_uÆocked +( +__å +è(((__å)-> +_æags + & +_IO_EOF_SEEN +è!ð0) + + ) + +458  + #_IO_ã¼Ü_uÆocked +( +__å +è(((__å)-> +_æags + & +_IO_ERR_SEEN +è!ð0) + + ) + +460  +_IO_g‘c + ( +_IO_FILE + * +__å +); + +461  +_IO_putc + ( +__c +, +_IO_FILE + * +__å +); + +462  +_IO_ãof + ( +_IO_FILE + * +__å +è +__THROW +; + +463  +_IO_ã¼Ü + ( +_IO_FILE + * +__å +è +__THROW +; + +465  +_IO_³ekc_locked + ( +_IO_FILE + * +__å +); + +468  + #_IO_PENDING_OUTPUT_COUNT +( +_å +) \ + +469 (( +_å +)-> +_IO_wr™e_±r + - (_å)-> +_IO_wr™e_ba£ +) + + ) + +471  +_IO_æockfže + ( +_IO_FILE + *è +__THROW +; + +472  +_IO_fuÆockfže + ( +_IO_FILE + *è +__THROW +; + +473  +_IO_árylockfže + ( +_IO_FILE + *è +__THROW +; + +475 #ifdeà +_IO_MTSAFE_IO + + +476  + #_IO_³ekc +( +_å +è + `_IO_³ekc_locked + (_å) + + ) + +477  + #_IO_æockfže +( +_å +) \ + +478 ià((( +_å +)-> +_æags + & +_IO_USER_LOCK +è=ð0è + `_IO_æockfže + (_å) + + ) + +479  + #_IO_fuÆockfže +( +_å +) \ + +480 ià((( +_å +)-> +_æags + & +_IO_USER_LOCK +è=ð0è + `_IO_fuÆockfže + (_å) + + ) + +482  + #_IO_³ekc +( +_å +è + `_IO_³ekc_uÆocked + (_å) + + ) + +483  + #_IO_æockfže +( +_å +è + + ) + +484  + #_IO_fuÆockfže +( +_å +è + + ) + +485  + #_IO_árylockfže +( +_å +è + + ) + +486  + #_IO_þ—nup_»giÚ_¡¬t +( +_fù +, +_å +è + + ) + +487  + #_IO_þ—nup_»giÚ_’d +( +_Do™ +è + + ) + +490  +_IO_vfsÿnf + ( +_IO_FILE + * +__»¡riù +, const * __restrict, + +491 +_IO_va_li¡ +, * +__»¡riù +); + +492  +_IO_vårštf + ( +_IO_FILE + * +__»¡riù +, const *__restrict, + +493 +_IO_va_li¡ +); + +494 +_IO_ssize_t + +_IO_·dn + ( +_IO_FILE + *, , _IO_ssize_t); + +495 +_IO_size_t + +_IO_sg‘n + ( +_IO_FILE + *, *, _IO_size_t); + +497 +_IO_off64_t + +_IO_£ekoff + ( +_IO_FILE + *, _IO_off64_t, , ); + +498 +_IO_off64_t + +_IO_£ekpos + ( +_IO_FILE + *, _IO_off64_t, ); + +500  +_IO_ä“_backup_¬— + ( +_IO_FILE + *è +__THROW +; + +502 #ià +defšed + +_LIBC + || defšed +_GLIBCPP_USE_WCHAR_T + + +503 +_IO_wšt_t + +_IO_g‘wc + ( +_IO_FILE + * +__å +); + +504 +_IO_wšt_t + +_IO_putwc + ( +wch¬_t + +__wc +, +_IO_FILE + * +__å +); + +505  +_IO_fwide + ( +_IO_FILE + * +__å +,  +__mode +è +__THROW +; + +506 #ià +__GNUC__ + >= 2 + +509 #ià +defšed + +_LIBC + && defšed +SHARED + + +510  + ~ + +511 #ià +SHLIB_COMPAT + ( +libc +, +GLIBC_2_0 +, +GLIBC_2_1 +) + +512  + #_IO_fwide_maybe_šcom·tibË + \ + +513 ( + `__bužtš_ex³ù + (& +_IO_¡dš_u£d + =ð +NULL +, 0)) + + ) + +514 cÚ¡  +_IO_¡dš_u£d +; + +515 +w—k_ex‹º + ( +_IO_¡dš_u£d +); + +518 #iâdeà +_IO_fwide_maybe_šcom·tibË + + +519  + #_IO_fwide_maybe_šcom·tibË + (0) + + ) + +523  + #_IO_fwide +( +__å +, +__mode +) \ + +524 ({  +__»suÉ + = ( +__mode +); \ + +525 ià( +__»suÉ + < 0 && ! +_IO_fwide_maybe_šcom·tibË +) \ + +527 ià(( +__å +)-> +_mode + == 0) \ + +529 ( +__å +)-> +_mode + = -1; \ + +530 +__»suÉ + = ( +__å +)-> +_mode +; \ + +532 ià( + `__bužtš_cÚ¡ªt_p + ( +__mode +) && (__mode) == 0) \ + +533 +__»suÉ + = +_IO_fwide_maybe_šcom·tibË + ? -1 : ( +__å +)-> +_mode +; \ + +535 +__»suÉ + = + `_IO_fwide + ( +__å +, __result); \ + +536 +__»suÉ +; }) + + ) + +539  +_IO_vfwsÿnf + ( +_IO_FILE + * +__»¡riù +, cÚ¡ +wch¬_t + * __restrict, + +540 +_IO_va_li¡ +, * +__»¡riù +); + +541  +_IO_vfw´štf + ( +_IO_FILE + * +__»¡riù +, cÚ¡ +wch¬_t + *__restrict, + +542 +_IO_va_li¡ +); + +543 +_IO_ssize_t + +_IO_w·dn + ( +_IO_FILE + *, +wšt_t +, _IO_ssize_t); + +544  +_IO_ä“_wbackup_¬— + ( +_IO_FILE + *è +__THROW +; + +547 #ifdeà +__LDBL_COMPAT + + +548  + ~ + +551 #ifdeà +__ýlu¥lus + + + @/usr/include/xlocale.h + +21 #iâdeà +_XLOCALE_H + + +22  + #_XLOCALE_H + 1 + + ) + +28  + s__loÿË_¡ruù + + +31  +loÿË_d©a + * + m__loÿËs +[13]; + +34 cÚ¡ * + m__ùy³_b +; + +35 cÚ¡ * + m__ùy³_tÞow” +; + +36 cÚ¡ * + m__ùy³_touµ” +; + +39 cÚ¡ * + m__Çmes +[13]; + +40 } * + t__loÿË_t +; + +43  +__loÿË_t + + tloÿË_t +; + + @/usr/include/_G_config.h + +4 #iâdeà +_G_cÚfig_h + + +5  + #_G_cÚfig_h + 1 + + ) + +9  + ~ + +10  + #__Ãed_size_t + + + ) + +11 #ià +defšed + +_LIBC + || defšed +_GLIBCPP_USE_WCHAR_T + + +12  + #__Ãed_wch¬_t + + + ) + +14  + #__Ãed_NULL + + + ) + +15  + ~<¡ddef.h +> + +16  + #__Ãed_mb¡©e_t + + + ) + +17 #ià +defšed + +_LIBC + || defšed +_GLIBCPP_USE_WCHAR_T + + +18  + #__Ãed_wšt_t + + + ) + +20  + ~ + +21  + #_G_size_t + +size_t + + + ) + +24 +__off_t + + m__pos +; + +25 +__mb¡©e_t + + m__¡©e +; + +26 } + t_G_åos_t +; + +29 +__off64_t + + m__pos +; + +30 +__mb¡©e_t + + m__¡©e +; + +31 } + t_G_åos64_t +; + +32  + #_G_ssize_t + +__ssize_t + + + ) + +33  + #_G_off_t + +__off_t + + + ) + +34  + #_G_off64_t + +__off64_t + + + ) + +35  + #_G_pid_t + +__pid_t + + + ) + +36  + #_G_uid_t + +__uid_t + + + ) + +37  + #_G_wch¬_t + +wch¬_t + + + ) + +38  + #_G_wšt_t + +wšt_t + + + ) + +39  + #_G_¡©64 + +¡©64 + + + ) + +40 #ià +defšed + +_LIBC + || defšed +_GLIBCPP_USE_WCHAR_T + + +41  + ~ + +44  +__gcÚv_šfo + + m__cd +; + +47  +__gcÚv_šfo + + m__cd +; + +48  +__gcÚv_¡•_d©a + + m__d©a +; + +49 } + m__combšed +; + +50 } + t_G_icÚv_t +; + +53  + t_G_št16_t + + t__©Œibu‹__ + (( + t__mode__ + ( + t__HI__ +))); + +54  + t_G_št32_t + + t__©Œibu‹__ + (( + t__mode__ + ( + t__SI__ +))); + +55  + t_G_ušt16_t + + t__©Œibu‹__ + (( + t__mode__ + ( + t__HI__ +))); + +56  + t_G_ušt32_t + + t__©Œibu‹__ + (( + t__mode__ + ( + t__SI__ +))); + +58  + #_G_HAVE_BOOL + 1 + + ) + +62  + #_G_HAVE_ATEXIT + 1 + + ) + +63  + #_G_HAVE_SYS_CDEFS + 1 + + ) + +64  + #_G_HAVE_SYS_WAIT + 1 + + ) + +65  + #_G_NEED_STDARG_H + 1 + + ) + +66  + #_G_va_li¡ + +__gnuc_va_li¡ + + + ) + +68  + #_G_HAVE_PRINTF_FP + 1 + + ) + +69  + #_G_HAVE_MMAP + 1 + + ) + +70  + #_G_HAVE_MREMAP + 1 + + ) + +71  + #_G_HAVE_LONG_DOUBLE_IO + 1 + + ) + +72  + #_G_HAVE_IO_FILE_OPEN + 1 + + ) + +73  + #_G_HAVE_IO_GETLINE_INFO + 1 + + ) + +75  + #_G_IO_IO_FILE_VERSION + 0x20001 + + ) + +77  + #_G_OPEN64 + +__Ý’64 + + + ) + +78  + #_G_LSEEK64 + +__l£ek64 + + + ) + +79  + #_G_MMAP64 + +__mm­64 + + + ) + +80  + #_G_FSTAT64 +( +fd +, +buf +è + `__fx¡©64 + ( +_STAT_VER +, fd, buf) + + ) + +83  + #_G_HAVE_ST_BLKSIZE + + `defšed + ( +_STATBUF_ST_BLKSIZE +) + + ) + +85  + #_G_BUFSIZ + 8192 + + ) + +88  + #_G_NAMES_HAVE_UNDERSCORE + 0 + + ) + +89  + #_G_VTABLE_LABEL_HAS_LENGTH + 1 + + ) + +90  + #_G_USING_THUNKS + 1 + + ) + +91  + #_G_VTABLE_LABEL_PREFIX + "__vt_" + + ) + +92  + #_G_VTABLE_LABEL_PREFIX_ID + +__vt_ + + + ) + +95 #ià +defšed + +__ýlu¥lus + || defšed +__STDC__ + + +96  + #_G_ARGS +( +ARGLIST +è + ) +ARGLIST + +98  + #_G_ARGS +( +ARGLIST +è() + + ) + + @/usr/include/bits/libio-ldbl.h + +20 #iâdeà +_IO_STDIO_H + + +24 + $__LDBL_REDIR_DECL + ( +_IO_vfsÿnf +) + +25 + `__LDBL_REDIR_DECL + ( +_IO_vårštf +) + + @/usr/include/bits/predefs.h + +19 #iâdeà +_FEATURES_H + + +23 #iâdeà +_PREDEFS_H + + +24  + #_PREDEFS_H + + + ) + +27  + #__STDC_IEC_559__ + 1 + + ) + +28  + #__STDC_IEC_559_COMPLEX__ + 1 + + ) + + @/usr/include/bits/stdio-lock.h + +20 #iâdeà +_BITS_STDIO_LOCK_H + + +21  + #_BITS_STDIO_LOCK_H + 1 + + ) + +23  + ~ + +24  + ~ + +28  + #_IO_lock_šex³nsive + 1 + + ) + +30 ¡ruù {  + mlock +;  + mút +; * + mowÃr +; } + t_IO_lock_t +; + +32  + #_IO_lock_š™Ÿliz” + { +LLL_LOCK_INITIALIZER +, 0, +NULL + } + + ) + +34  + #_IO_lock_š™ +( +_Çme +) \ + +35 (( +_Çme +èð( +_IO_lock_t +è +_IO_lock_š™Ÿliz” + , 0) + + ) + +37  + #_IO_lock_fši +( +_Çme +) \ + +38 ((è0) + + ) + +40  + #_IO_lock_lock +( +_Çme +) \ + +42 * +__£lf + = +THREAD_SELF +; \ + +43 ià(( +_Çme +). +owÃr + !ð +__£lf +) \ + +45 + `Îl_lock + (( +_Çme +). +lock +, +LLL_PRIVATE +); \ + +46 ( +_Çme +). +owÃr + = +__£lf +; \ + +48 ++( +_Çme +). +út +; \ + +49 } 0) + + ) + +51  + #_IO_lock_Œylock +( +_Çme +) \ + +53  +__»suÉ + = 0; \ + +54 * +__£lf + = +THREAD_SELF +; \ + +55 ià(( +_Çme +). +owÃr + !ð +__£lf +) \ + +57 ià( + `Îl_Œylock + (( +_Çme +). +lock +) == 0) \ + +59 ( +_Çme +). +owÃr + = +__£lf +; \ + +60 ( +_Çme +). +út + = 1; \ + +63 +__»suÉ + = +EBUSY +; \ + +66 ++( +_Çme +). +út +; \ + +67 +__»suÉ +; \ + +68 }) + + ) + +70  + #_IO_lock_uÆock +( +_Çme +) \ + +72 ià(--( +_Çme +). +út + == 0) \ + +74 ( +_Çme +). +owÃr + = +NULL +; \ + +75 + `Îl_uÆock + (( +_Çme +). +lock +, +LLL_PRIVATE +); \ + +77 } 0) + + ) + +81  + #_IO_þ—nup_»giÚ_¡¬t +( +_fù +, +_å +) \ + +82 + `__libc_þ—nup_»giÚ_¡¬t + ((( +_å +)-> +_æags + & +_IO_USER_LOCK +è=ð0, +_fù +, _å) + + ) + +83  + #_IO_þ—nup_»giÚ_¡¬t_nßrg +( +_fù +) \ + +84 + `__libc_þ—nup_»giÚ_¡¬t + (1, +_fù +, +NULL +) + + ) + +85  + #_IO_þ—nup_»giÚ_’d +( +_do™ +) \ + +86 + `__libc_þ—nup_»giÚ_’d + ( +_do™ +) + + ) + +88 #ià +defšed + +_LIBC + && !defšed +NOT_IN_libc + + +90 #ifdeà +__EXCEPTIONS + + +91  + #_IO_acquœe_lock +( +_å +) \ + +93 +_IO_FILE + * +_IO_acquœe_lock_fže + \ + +94 + `__©Œibu‹__ +(( + `þ—nup + ( +_IO_acquœe_lock_fù +))) \ + +95 ð( +_å +); \ + +96 + `_IO_æockfže + ( +_IO_acquœe_lock_fže +); + + ) + +97  + #_IO_acquœe_lock_þ—r_æags2 +( +_å +) \ + +99 +_IO_FILE + * +_IO_acquœe_lock_fže + \ + +100 + `__©Œibu‹__ +(( + `þ—nup + ( +_IO_acquœe_lock_þ—r_æags2_fù +))) \ + +101 ð( +_å +); \ + +102 + `_IO_æockfže + ( +_IO_acquœe_lock_fže +); + + ) + +104  + #_IO_acquœe_lock +( +_å +è +_IO_acquœe_lock_Ãeds_exû±iÚs_’abËd + + + ) + +105  + #_IO_acquœe_lock_þ—r_æags2 +( +_å +è + `_IO_acquœe_lock + (_å) + + ) + +107  + #_IO_»Ëa£_lock +( +_å +è; } 0) + + ) + + @/usr/include/bits/typesizes.h + +20 #iâdeà +_BITS_TYPES_H + + +24 #iâdef +_BITS_TYPESIZES_H + + +25  + #_BITS_TYPESIZES_H + 1 + + ) + +30  + #__DEV_T_TYPE + +__UQUAD_TYPE + + + ) + +31  + #__UID_T_TYPE + +__U32_TYPE + + + ) + +32  + #__GID_T_TYPE + +__U32_TYPE + + + ) + +33  + #__INO_T_TYPE + +__ULONGWORD_TYPE + + + ) + +34  + #__INO64_T_TYPE + +__UQUAD_TYPE + + + ) + +35  + #__MODE_T_TYPE + +__U32_TYPE + + + ) + +36  + #__NLINK_T_TYPE + +__UWORD_TYPE + + + ) + +37  + #__OFF_T_TYPE + +__SLONGWORD_TYPE + + + ) + +38  + #__OFF64_T_TYPE + +__SQUAD_TYPE + + + ) + +39  + #__PID_T_TYPE + +__S32_TYPE + + + ) + +40  + #__RLIM_T_TYPE + +__ULONGWORD_TYPE + + + ) + +41  + #__RLIM64_T_TYPE + +__UQUAD_TYPE + + + ) + +42  + #__BLKCNT_T_TYPE + +__SLONGWORD_TYPE + + + ) + +43  + #__BLKCNT64_T_TYPE + +__SQUAD_TYPE + + + ) + +44  + #__FSBLKCNT_T_TYPE + +__ULONGWORD_TYPE + + + ) + +45  + #__FSBLKCNT64_T_TYPE + +__UQUAD_TYPE + + + ) + +46  + #__FSFILCNT_T_TYPE + +__ULONGWORD_TYPE + + + ) + +47  + #__FSFILCNT64_T_TYPE + +__UQUAD_TYPE + + + ) + +48  + #__ID_T_TYPE + +__U32_TYPE + + + ) + +49  + #__CLOCK_T_TYPE + +__SLONGWORD_TYPE + + + ) + +50  + #__TIME_T_TYPE + +__SLONGWORD_TYPE + + + ) + +51  + #__USECONDS_T_TYPE + +__U32_TYPE + + + ) + +52  + #__SUSECONDS_T_TYPE + +__SLONGWORD_TYPE + + + ) + +53  + #__DADDR_T_TYPE + +__S32_TYPE + + + ) + +54  + #__SWBLK_T_TYPE + +__SLONGWORD_TYPE + + + ) + +55  + #__KEY_T_TYPE + +__S32_TYPE + + + ) + +56  + #__CLOCKID_T_TYPE + +__S32_TYPE + + + ) + +57  + #__TIMER_T_TYPE + * + + ) + +58  + #__BLKSIZE_T_TYPE + +__SLONGWORD_TYPE + + + ) + +59  + #__FSID_T_TYPE + sŒuù {  +__v® +[2]; } + + ) + +60  + #__SSIZE_T_TYPE + +__SWORD_TYPE + + + ) + +63  + #__FD_SETSIZE + 1024 + + ) + + @/usr/include/bits/wordsize.h + +3 #ià +defšed + +__x86_64__ + + +4  + #__WORDSIZE + 64 + + ) + +5  + #__WORDSIZE_COMPAT32 + 1 + + ) + +7  + #__WORDSIZE + 32 + + ) + + @/usr/include/ctype.h + +24 #iâdef +_CTYPE_H + + +25  + #_CTYPE_H + 1 + + ) + +27  + ~<ã©u»s.h +> + +28  + ~ + +30 + g__BEGIN_DECLS + + +32 #iâdeà +_ISb™ + + +41  + ~<’dŸn.h +> + +42 #ià +__BYTE_ORDER + =ð +__BIG_ENDIAN + + +43  + #_ISb™ +( +b™ +è(1 << (b™)) + + ) + +45  + #_ISb™ +( +b™ +è((b™è< 8 ? ((1 << (b™)è<< 8è: ((1 << (b™)è>> 8)) + + ) + +50 + m_ISuµ” + = +_ISb™ + (0), + +51 + m_ISlow” + = +_ISb™ + (1), + +52 + m_IS®pha + = +_ISb™ + (2), + +53 + m_ISdig™ + = +_ISb™ + (3), + +54 + m_ISxdig™ + = +_ISb™ + (4), + +55 + m_IS¥aû + = +_ISb™ + (5), + +56 + m_IS´št + = +_ISb™ + (6), + +57 + m_ISg¿ph + = +_ISb™ + (7), + +58 + m_ISbÏnk + = +_ISb™ + (8), + +59 + m_ISúŒl + = +_ISb™ + (9), + +60 + m_ISpunù + = +_ISb™ + (10), + +61 + m_IS®num + = +_ISb™ + (11) + +81 +__cÚ¡ + ** + $__ùy³_b_loc + () + +82 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡ +)); + +83 +__cÚ¡ + +__št32_t + ** + $__ùy³_tÞow”_loc + () + +84 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡ +)); + +85 +__cÚ¡ + +__št32_t + ** + $__ùy³_touµ”_loc + () + +86 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡ +)); + +88  + #__isùy³ +( +c +, +ty³ +) \ + +89 ((* + `__ùy³_b_loc + ())[(è( +c +)] & (è +ty³ +) + + ) + +91  + #__i§scii +( +c +è(((cè& ~0x7fè=ð0è + + ) + +92  + #__tßscii +( +c +è((cè& 0x7fè + + ) + +94  + #__exùy³ +( +Çme +è  + `Çme + (è +__THROW + + + ) + +96 +__BEGIN_NAMESPACE_STD + + +102 + `__exùy³ + ( +i§Êum +); + +103 + `__exùy³ + ( +i§Íha +); + +104 + `__exùy³ + ( +isúŒl +); + +105 + `__exùy³ + ( +isdig™ +); + +106 + `__exùy³ + ( +i¦ow” +); + +107 + `__exùy³ + ( +isg¿ph +); + +108 + `__exùy³ + ( +i¥ršt +); + +109 + `__exùy³ + ( +i¥unù +); + +110 + `__exùy³ + ( +is¥aû +); + +111 + `__exùy³ + ( +isuµ” +); + +112 + `__exùy³ + ( +isxdig™ +); + +116  + $tÞow” + ( +__c +è +__THROW +; + +119  + $touµ” + ( +__c +è +__THROW +; + +121 +__END_NAMESPACE_STD + + +125 #ifdef +__USE_ISOC99 + + +126 +__BEGIN_NAMESPACE_C99 + + +128 + `__exùy³ + ( +isbÏnk +); + +130 +__END_NAMESPACE_C99 + + +133 #ifdeà +__USE_GNU + + +135  + $isùy³ + ( +__c +,  +__mask +è +__THROW +; + +138 #ià +defšed + +__USE_SVID + || defšed +__USE_MISC + || defšed +__USE_XOPEN + + +142  + $i§scii + ( +__c +è +__THROW +; + +146  + $tßscii + ( +__c +è +__THROW +; + +150 + `__exùy³ + ( +_touµ” +); + +151 + `__exùy³ + ( +_tÞow” +); + +155  + #__tobody +( +c +, +f +, +a +, +¬gs +) \ + +156 ( +__ex‹nsiÚ__ + \ + +157 ({  +__»s +; \ + +158 ià( ( +c +) > 1) \ + +160 ià( + `__bužtš_cÚ¡ªt_p + ( +c +)) \ + +162  +__c + = ( +c +); \ + +163 +__»s + = +__c + < -128 || __ø> 255 ? __ø: ( +a +)[__c]; \ + +166 +__»s + = +f + +¬gs +; \ + +169 +__»s + = ( +a +)[(è( +c +)]; \ + +170 +__»s +; + } +})) + + ) + +172 #ià! +defšed + +__NO_CTYPE + && !defšed +__ýlu¥lus + + +173  + #i§Êum +( +c +è + `__isùy³ +((c), +_IS®num +) + + ) + +174  + #i§Íha +( +c +è + `__isùy³ +((c), +_IS®pha +) + + ) + +175  + #isúŒl +( +c +è + `__isùy³ +((c), +_ISúŒl +) + + ) + +176  + #isdig™ +( +c +è + `__isùy³ +((c), +_ISdig™ +) + + ) + +177  + #i¦ow” +( +c +è + `__isùy³ +((c), +_ISlow” +) + + ) + +178  + #isg¿ph +( +c +è + `__isùy³ +((c), +_ISg¿ph +) + + ) + +179  + #i¥ršt +( +c +è + `__isùy³ +((c), +_IS´št +) + + ) + +180  + #i¥unù +( +c +è + `__isùy³ +((c), +_ISpunù +) + + ) + +181  + #is¥aû +( +c +è + `__isùy³ +((c), +_IS¥aû +) + + ) + +182  + #isuµ” +( +c +è + `__isùy³ +((c), +_ISuµ” +) + + ) + +183  + #isxdig™ +( +c +è + `__isùy³ +((c), +_ISxdig™ +) + + ) + +185 #ifdeà +__USE_ISOC99 + + +186  + #isbÏnk +( +c +è + `__isùy³ +((c), +_ISbÏnk +) + + ) + +189 #ifdeà +__USE_EXTERN_INLINES + + +190 +__ex‹º_šlše +  + +191 +__NTH + ( + $tÞow” + ( +__c +)) + +193  +__c + >ð-128 && __ø< 256 ? (* + `__ùy³_tÞow”_loc + ())[__c] : __c; + +194 + } +} + +196 +__ex‹º_šlše +  + +197 +__NTH + ( + $touµ” + ( +__c +)) + +199  +__c + >ð-128 && __ø< 256 ? (* + `__ùy³_touµ”_loc + ())[__c] : __c; + +200 + } +} + +203 #ià +__GNUC__ + >ð2 && +defšed + +__OPTIMIZE__ + && !defšed +__ýlu¥lus + + +204  + #tÞow” +( +c +è + `__tobody + (c, +tÞow” +, * + `__ùy³_tÞow”_loc + (), (c)) + + ) + +205  + #touµ” +( +c +è + `__tobody + (c, +touµ” +, * + `__ùy³_touµ”_loc + (), (c)) + + ) + +208 #ià +defšed + +__USE_SVID + || defšed +__USE_MISC + || defšed +__USE_XOPEN + + +209  + #i§scii +( +c +è + `__i§scii + (c) + + ) + +210  + #tßscii +( +c +è + `__tßscii + (c) + + ) + +212  + #_tÞow” +( +c +è((è(* + `__ùy³_tÞow”_loc + ())[(è(c)]) + + ) + +213  + #_touµ” +( +c +è((è(* + `__ùy³_touµ”_loc + ())[(è(c)]) + + ) + +219 #ifdeà +__USE_XOPEN2K8 + + +233  + ~ + +237  + #__isùy³_l +( +c +, +ty³ +, +loÿË +) \ + +238 (( +loÿË +)-> +__ùy³_b +[(è( +c +)] & (è +ty³ +) + + ) + +240  + #__exùy³_l +( +Çme +) \ + +241  + `Çme + (, +__loÿË_t +è +__THROW + + + ) + +247 +__exùy³_l + ( +i§Êum_l +); + +248 +__exùy³_l + ( +i§Íha_l +); + +249 +__exùy³_l + ( +isúŒl_l +); + +250 +__exùy³_l + ( +isdig™_l +); + +251 +__exùy³_l + ( +i¦ow”_l +); + +252 +__exùy³_l + ( +isg¿ph_l +); + +253 +__exùy³_l + ( +i¥ršt_l +); + +254 +__exùy³_l + ( +i¥unù_l +); + +255 +__exùy³_l + ( +is¥aû_l +); + +256 +__exùy³_l + ( +isuµ”_l +); + +257 +__exùy³_l + ( +isxdig™_l +); + +259 +__exùy³_l + ( +isbÏnk_l +); + +263  + $__tÞow”_l + ( +__c +, +__loÿË_t + +__l +è +__THROW +; + +264  + $tÞow”_l + ( +__c +, +__loÿË_t + +__l +è +__THROW +; + +267  + $__touµ”_l + ( +__c +, +__loÿË_t + +__l +è +__THROW +; + +268  + $touµ”_l + ( +__c +, +__loÿË_t + +__l +è +__THROW +; + +270 #ià +__GNUC__ + >ð2 && +defšed + +__OPTIMIZE__ + && !defšed +__ýlu¥lus + + +271  + #__tÞow”_l +( +c +, +loÿË +) \ + +272 + `__tobody + ( +c +, +__tÞow”_l +, ( +loÿË +)-> +__ùy³_tÞow” +, (c,†oÿË)) + + ) + +273  + #__touµ”_l +( +c +, +loÿË +) \ + +274 + `__tobody + ( +c +, +__touµ”_l +, ( +loÿË +)-> +__ùy³_touµ” +, (c,†oÿË)) + + ) + +275  + #tÞow”_l +( +c +, +loÿË +è + `__tÞow”_l + ((c), (loÿË)) + + ) + +276  + #touµ”_l +( +c +, +loÿË +è + `__touµ”_l + ((c), (loÿË)) + + ) + +280 #iâdeà +__NO_CTYPE + + +281  + #__i§Êum_l +( +c +, +l +è + `__isùy³_l +((c), +_IS®num +, (l)) + + ) + +282  + #__i§Íha_l +( +c +, +l +è + `__isùy³_l +((c), +_IS®pha +, (l)) + + ) + +283  + #__isúŒl_l +( +c +, +l +è + `__isùy³_l +((c), +_ISúŒl +, (l)) + + ) + +284  + #__isdig™_l +( +c +, +l +è + `__isùy³_l +((c), +_ISdig™ +, (l)) + + ) + +285  + #__i¦ow”_l +( +c +, +l +è + `__isùy³_l +((c), +_ISlow” +, (l)) + + ) + +286  + #__isg¿ph_l +( +c +, +l +è + `__isùy³_l +((c), +_ISg¿ph +, (l)) + + ) + +287  + #__i¥ršt_l +( +c +, +l +è + `__isùy³_l +((c), +_IS´št +, (l)) + + ) + +288  + #__i¥unù_l +( +c +, +l +è + `__isùy³_l +((c), +_ISpunù +, (l)) + + ) + +289  + #__is¥aû_l +( +c +, +l +è + `__isùy³_l +((c), +_IS¥aû +, (l)) + + ) + +290  + #__isuµ”_l +( +c +, +l +è + `__isùy³_l +((c), +_ISuµ” +, (l)) + + ) + +291  + #__isxdig™_l +( +c +, +l +è + `__isùy³_l +((c), +_ISxdig™ +, (l)) + + ) + +293  + #__isbÏnk_l +( +c +, +l +è + `__isùy³_l +((c), +_ISbÏnk +, (l)) + + ) + +295 #ià +defšed + +__USE_SVID + || defšed +__USE_MISC + + +296  + #__i§scii_l +( +c +, +l +è(Ö), + `__i§scii + (c)) + + ) + +297  + #__tßscii_l +( +c +, +l +è(Ö), + `__tßscii + (c)) + + ) + +300  + #i§Êum_l +( +c +, +l +è + `__i§Êum_l + ((c), (l)) + + ) + +301  + #i§Íha_l +( +c +, +l +è + `__i§Íha_l + ((c), (l)) + + ) + +302  + #isúŒl_l +( +c +, +l +è + `__isúŒl_l + ((c), (l)) + + ) + +303  + #isdig™_l +( +c +, +l +è + `__isdig™_l + ((c), (l)) + + ) + +304  + #i¦ow”_l +( +c +, +l +è + `__i¦ow”_l + ((c), (l)) + + ) + +305  + #isg¿ph_l +( +c +, +l +è + `__isg¿ph_l + ((c), (l)) + + ) + +306  + #i¥ršt_l +( +c +, +l +è + `__i¥ršt_l + ((c), (l)) + + ) + +307  + #i¥unù_l +( +c +, +l +è + `__i¥unù_l + ((c), (l)) + + ) + +308  + #is¥aû_l +( +c +, +l +è + `__is¥aû_l + ((c), (l)) + + ) + +309  + #isuµ”_l +( +c +, +l +è + `__isuµ”_l + ((c), (l)) + + ) + +310  + #isxdig™_l +( +c +, +l +è + `__isxdig™_l + ((c), (l)) + + ) + +312  + #isbÏnk_l +( +c +, +l +è + `__isbÏnk_l + ((c), (l)) + + ) + +314 #ià +defšed + +__USE_SVID + || defšed +__USE_MISC + + +315  + #i§scii_l +( +c +, +l +è + `__i§scii_l + ((c), (l)) + + ) + +316  + #tßscii_l +( +c +, +l +è + `__tßscii_l + ((c), (l)) + + ) + +323 +__END_DECLS + + + @/usr/include/endian.h + +19 #iâdef +_ENDIAN_H + + +20  + #_ENDIAN_H + 1 + + ) + +22  + ~<ã©u»s.h +> + +32  + #__LITTLE_ENDIAN + 1234 + + ) + +33  + #__BIG_ENDIAN + 4321 + + ) + +34  + #__PDP_ENDIAN + 3412 + + ) + +37  + ~ + +41 #iâdeà +__FLOAT_WORD_ORDER + + +42  + #__FLOAT_WORD_ORDER + +__BYTE_ORDER + + + ) + +45 #ifdef +__USE_BSD + + +46  + #LITTLE_ENDIAN + +__LITTLE_ENDIAN + + + ) + +47  + #BIG_ENDIAN + +__BIG_ENDIAN + + + ) + +48  + #PDP_ENDIAN + +__PDP_ENDIAN + + + ) + +49  + #BYTE_ORDER + +__BYTE_ORDER + + + ) + +52 #ià +__BYTE_ORDER + =ð +__LITTLE_ENDIAN + + +53  + #__LONG_LONG_PAIR +( +HI +, +LO +èLO, + ) +HI + +54 #–ià +__BYTE_ORDER + =ð +__BIG_ENDIAN + + +55  + #__LONG_LONG_PAIR +( +HI +, +LO +èHI, + ) +LO + +59 #ifdeà +__USE_BSD + + +61  + ~ + +63 #ià +__BYTE_ORDER + =ð +__LITTLE_ENDIAN + + +64  + #htobe16 +( +x +è + `__bsw­_16 + (x) + + ) + +65  + #htÞe16 +( +x +è(x) + + ) + +66  + #be16toh +( +x +è + `__bsw­_16 + (x) + + ) + +67  + #Ë16toh +( +x +è(x) + + ) + +69  + #htobe32 +( +x +è + `__bsw­_32 + (x) + + ) + +70  + #htÞe32 +( +x +è(x) + + ) + +71  + #be32toh +( +x +è + `__bsw­_32 + (x) + + ) + +72  + #Ë32toh +( +x +è(x) + + ) + +74  + #htobe64 +( +x +è + `__bsw­_64 + (x) + + ) + +75  + #htÞe64 +( +x +è(x) + + ) + +76  + #be64toh +( +x +è + `__bsw­_64 + (x) + + ) + +77  + #Ë64toh +( +x +è(x) + + ) + +79  + #htobe16 +( +x +è(x) + + ) + +80  + #htÞe16 +( +x +è + `__bsw­_16 + (x) + + ) + +81  + #be16toh +( +x +è(x) + + ) + +82  + #Ë16toh +( +x +è + `__bsw­_16 + (x) + + ) + +84  + #htobe32 +( +x +è(x) + + ) + +85  + #htÞe32 +( +x +è + `__bsw­_32 + (x) + + ) + +86  + #be32toh +( +x +è(x) + + ) + +87  + #Ë32toh +( +x +è + `__bsw­_32 + (x) + + ) + +89  + #htobe64 +( +x +è(x) + + ) + +90  + #htÞe64 +( +x +è + `__bsw­_64 + (x) + + ) + +91  + #be64toh +( +x +è(x) + + ) + +92  + #Ë64toh +( +x +è + `__bsw­_64 + (x) + + ) + + @/usr/include/gnu/stubs.h + +4  + ~ + +6 #ià +__WORDSIZE + == 32 + +7  + ~ + +8 #–ià +__WORDSIZE + == 64 + +9  + ~ + + @/usr/include/stdlib.h + +23 #iâdef +_STDLIB_H + + +25  + ~<ã©u»s.h +> + +28  + #__Ãed_size_t + + + ) + +29 #iâdeà +__Ãed_m®loc_ªd_ÿÎoc + + +30  + #__Ãed_wch¬_t + + + ) + +31  + #__Ãed_NULL + + + ) + +33  + ~<¡ddef.h +> + +35 + g__BEGIN_DECLS + + +37 #iâdeà +__Ãed_m®loc_ªd_ÿÎoc + + +38  + #_STDLIB_H + 1 + + ) + +40 #ià +defšed + +__USE_XOPEN + && !defšed +_SYS_WAIT_H + + +42  + ~ + +43  + ~ + +45 #ifdeà +__USE_BSD + + +50 #ià +defšed + +__GNUC__ + && !defšed +__ýlu¥lus + + +51  + #__WAIT_INT +( +¡©us +) \ + +52 ( + `__ex‹nsiÚ__ + (((uniÚ { + `__ty³of +( +¡©us +è +__š +;  +__i +; }) \ + +53 { . +__š + = ( +¡©us +è}). +__i +)) + + ) + +55  + #__WAIT_INT +( +¡©us +è(*(*è&(¡©us)) + + ) + +63 #ià! +defšed + +__GNUC__ + || __GNUC__ < 2 || defšed +__ýlu¥lus + + +64  + #__WAIT_STATUS + * + + ) + +65  + #__WAIT_STATUS_DEFN + * + + ) + +70  +wa™ + * + m__u±r +; + +71 * + m__Œ +; + +72 } + t__WAIT_STATUS + + t__©Œibu‹__ + (( + t__Œª¥¬’t_uniÚ__ +)); + +73  + #__WAIT_STATUS_DEFN + * + + ) + +78  + #__WAIT_INT +( +¡©us +è(¡©us) + + ) + +79  + #__WAIT_STATUS + * + + ) + +80  + #__WAIT_STATUS_DEFN + * + + ) + +85  + #WEXITSTATUS +( +¡©us +è + `__WEXITSTATUS + ( + `__WAIT_INT + (¡©us)) + + ) + +86  + #WTERMSIG +( +¡©us +è + `__WTERMSIG + ( + `__WAIT_INT + (¡©us)) + + ) + +87  + #WSTOPSIG +( +¡©us +è + `__WSTOPSIG + ( + `__WAIT_INT + (¡©us)) + + ) + +88  + #WIFEXITED +( +¡©us +è + `__WIFEXITED + ( + `__WAIT_INT + (¡©us)) + + ) + +89  + #WIFSIGNALED +( +¡©us +è + `__WIFSIGNALED + ( + `__WAIT_INT + (¡©us)) + + ) + +90  + #WIFSTOPPED +( +¡©us +è + `__WIFSTOPPED + ( + `__WAIT_INT + (¡©us)) + + ) + +91 #ifdeà +__WIFCONTINUED + + +92  + #WIFCONTINUED +( +¡©us +è + `__WIFCONTINUED + ( + `__WAIT_INT + (¡©us)) + + ) + +96 +__BEGIN_NAMESPACE_STD + + +100  + mquÙ +; + +101  + m»m +; + +102 } + tdiv_t +; + +105 #iâdeà +__ldiv_t_defšed + + +108  + mquÙ +; + +109  + m»m +; + +110 } + tldiv_t +; + +111  + #__ldiv_t_defšed + 1 + + ) + +113 + g__END_NAMESPACE_STD + + +115 #ià +defšed + +__USE_ISOC99 + && !defšed +__Îdiv_t_defšed + + +116 +__BEGIN_NAMESPACE_C99 + + +118 +__ex‹nsiÚ__ + struct + +120  + mquÙ +; + +121  + m»m +; + +122 } + tÎdiv_t +; + +123  + #__Îdiv_t_defšed + 1 + + ) + +124 + g__END_NAMESPACE_C99 + + +129  + #RAND_MAX + 2147483647 + + ) + +134  + #EXIT_FAILURE + 1 + + ) + +135  + #EXIT_SUCCESS + 0 + + ) + +139  + #MB_CUR_MAX + ( + `__ùy³_g‘_mb_cur_max + ()) + + ) + +140 +size_t + + $__ùy³_g‘_mb_cur_max + (è +__THROW + +__wur +; + +143 +__BEGIN_NAMESPACE_STD + + +145  + $©of + ( +__cÚ¡ + * +__ÅŒ +) + +146 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)è +__wur +; + +148  + $©oi + ( +__cÚ¡ + * +__ÅŒ +) + +149 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)è +__wur +; + +151  + $©Þ + ( +__cÚ¡ + * +__ÅŒ +) + +152 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)è +__wur +; + +153 +__END_NAMESPACE_STD + + +155 #ià +defšed + +__USE_ISOC99 + || (defšed +__GLIBC_HAVE_LONG_LONG + && defšed +__USE_MISC +) + +156 +__BEGIN_NAMESPACE_C99 + + +158 +__ex‹nsiÚ__ +  + $©Þl + ( +__cÚ¡ + * +__ÅŒ +) + +159 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)è +__wur +; + +160 +__END_NAMESPACE_C99 + + +163 +__BEGIN_NAMESPACE_STD + + +165  + $¡¹od + ( +__cÚ¡ + * +__»¡riù + +__ÅŒ +, + +166 ** +__»¡riù + +__’d±r +) + +167 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +168 +__END_NAMESPACE_STD + + +170 #ifdef +__USE_ISOC99 + + +171 +__BEGIN_NAMESPACE_C99 + + +173  + $¡¹of + ( +__cÚ¡ + * +__»¡riù + +__ÅŒ +, + +174 ** +__»¡riù + +__’d±r +è +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +176  + $¡¹Þd + ( +__cÚ¡ + * +__»¡riù + +__ÅŒ +, + +177 ** +__»¡riù + +__’d±r +) + +178 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +179 +__END_NAMESPACE_C99 + + +182 +__BEGIN_NAMESPACE_STD + + +184  + $¡¹Þ + ( +__cÚ¡ + * +__»¡riù + +__ÅŒ +, + +185 ** +__»¡riù + +__’d±r +,  +__ba£ +) + +186 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +188  + $¡¹oul + ( +__cÚ¡ + * +__»¡riù + +__ÅŒ +, + +189 ** +__»¡riù + +__’d±r +,  +__ba£ +) + +190 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +191 +__END_NAMESPACE_STD + + +193 #ià +defšed + +__GLIBC_HAVE_LONG_LONG + && defšed +__USE_BSD + + +195 +__ex‹nsiÚ__ + + +196  + $¡¹oq + ( +__cÚ¡ + * +__»¡riù + +__ÅŒ +, + +197 ** +__»¡riù + +__’d±r +,  +__ba£ +) + +198 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +200 +__ex‹nsiÚ__ + + +201  + $¡¹ouq + ( +__cÚ¡ + * +__»¡riù + +__ÅŒ +, + +202 ** +__»¡riù + +__’d±r +,  +__ba£ +) + +203 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +206 #ià +defšed + +__USE_ISOC99 + || (defšed +__GLIBC_HAVE_LONG_LONG + && defšed +__USE_MISC +) + +207 +__BEGIN_NAMESPACE_C99 + + +209 +__ex‹nsiÚ__ + + +210  + $¡¹Þl + ( +__cÚ¡ + * +__»¡riù + +__ÅŒ +, + +211 ** +__»¡riù + +__’d±r +,  +__ba£ +) + +212 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +214 +__ex‹nsiÚ__ + + +215  + $¡¹ouÎ + ( +__cÚ¡ + * +__»¡riù + +__ÅŒ +, + +216 ** +__»¡riù + +__’d±r +,  +__ba£ +) + +217 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +218 +__END_NAMESPACE_C99 + + +222 #ifdeà +__USE_GNU + + +236  + ~ + +240  + $¡¹Þ_l + ( +__cÚ¡ + * +__»¡riù + +__ÅŒ +, + +241 ** +__»¡riù + +__’d±r +,  +__ba£ +, + +242 +__loÿË_t + +__loc +è +__THROW + + `__nÚnuÎ + ((1, 4)è +__wur +; + +244  + $¡¹oul_l + ( +__cÚ¡ + * +__»¡riù + +__ÅŒ +, + +245 ** +__»¡riù + +__’d±r +, + +246  +__ba£ +, +__loÿË_t + +__loc +) + +247 +__THROW + + `__nÚnuÎ + ((1, 4)è +__wur +; + +249 +__ex‹nsiÚ__ + + +250  + $¡¹Þl_l + ( +__cÚ¡ + * +__»¡riù + +__ÅŒ +, + +251 ** +__»¡riù + +__’d±r +,  +__ba£ +, + +252 +__loÿË_t + +__loc +) + +253 +__THROW + + `__nÚnuÎ + ((1, 4)è +__wur +; + +255 +__ex‹nsiÚ__ + + +256  + $¡¹ouÎ_l + ( +__cÚ¡ + * +__»¡riù + +__ÅŒ +, + +257 ** +__»¡riù + +__’d±r +, + +258  +__ba£ +, +__loÿË_t + +__loc +) + +259 +__THROW + + `__nÚnuÎ + ((1, 4)è +__wur +; + +261  + $¡¹od_l + ( +__cÚ¡ + * +__»¡riù + +__ÅŒ +, + +262 ** +__»¡riù + +__’d±r +, +__loÿË_t + +__loc +) + +263 +__THROW + + `__nÚnuÎ + ((1, 3)è +__wur +; + +265  + $¡¹of_l + ( +__cÚ¡ + * +__»¡riù + +__ÅŒ +, + +266 ** +__»¡riù + +__’d±r +, +__loÿË_t + +__loc +) + +267 +__THROW + + `__nÚnuÎ + ((1, 3)è +__wur +; + +269  + $¡¹Þd_l + ( +__cÚ¡ + * +__»¡riù + +__ÅŒ +, + +270 ** +__»¡riù + +__’d±r +, + +271 +__loÿË_t + +__loc +) + +272 +__THROW + + `__nÚnuÎ + ((1, 3)è +__wur +; + +276 #ifdeà +__USE_EXTERN_INLINES + + +277 +__BEGIN_NAMESPACE_STD + + +278 +__ex‹º_šlše +  + +279 + `__NTH + ( + $©of + ( +__cÚ¡ + * +__ÅŒ +)) + +281  + `¡¹od + ( +__ÅŒ +, (**è +NULL +); + +282 + } +} + +283 +__ex‹º_šlše +  + +284 +__NTH + ( + $©oi + ( +__cÚ¡ + * +__ÅŒ +)) + +286  (è + `¡¹Þ + ( +__ÅŒ +, (**è +NULL +, 10); + +287 + } +} + +288 +__ex‹º_šlše +  + +289 +__NTH + ( + $©Þ + ( +__cÚ¡ + * +__ÅŒ +)) + +291  + `¡¹Þ + ( +__ÅŒ +, (**è +NULL +, 10); + +292 + } +} + +293 + g__END_NAMESPACE_STD + + +295 #ià +defšed + +__USE_MISC + || defšed +__USE_ISOC99 + + +296 +__BEGIN_NAMESPACE_C99 + + +297 +__ex‹nsiÚ__ + +__ex‹º_šlše +  + +298 +__NTH + ( + $©Þl + ( +__cÚ¡ + * +__ÅŒ +)) + +300  + `¡¹Þl + ( +__ÅŒ +, (**è +NULL +, 10); + +301 + } +} + +302 + g__END_NAMESPACE_C99 + + +307 #ià +defšed + +__USE_SVID + || defšed +__USE_XOPEN_EXTENDED + + +311 * + $l64a + ( +__n +è +__THROW + +__wur +; + +314  + $a64l + ( +__cÚ¡ + * +__s +) + +315 +__THROW + +__©Œibu‹_pu»__ + + `__nÚnuÎ + ((1)è +__wur +; + +319 #ià +defšed + +__USE_SVID + || defšed +__USE_XOPEN_EXTENDED + || defšed +__USE_BSD + + +320  + ~ + +327  + $¿ndom + (è +__THROW +; + +330  + $¤ªdom + ( +__£ed +è +__THROW +; + +336 * + $š™¡©e + ( +__£ed +, * +__¡©ebuf +, + +337 +size_t + +__¡©–’ +è +__THROW + + `__nÚnuÎ + ((2)); + +341 * + $£t¡©e + (* +__¡©ebuf +è +__THROW + + `__nÚnuÎ + ((1)); + +344 #ifdeà +__USE_MISC + + +349  + s¿ndom_d©a + + +351 +št32_t + * +åŒ +; + +352 +št32_t + * +½Œ +; + +353 +št32_t + * +¡©e +; + +354  +¿nd_ty³ +; + +355  +¿nd_deg +; + +356  +¿nd_£p +; + +357 +št32_t + * +’d_±r +; + +360  + $¿ndom_r + ( +¿ndom_d©a + * +__»¡riù + +__buf +, + +361 +št32_t + * +__»¡riù + +__»suÉ +è +__THROW + + `__nÚnuÎ + ((1, 2)); + +363  + $¤ªdom_r + ( +__£ed +,  +¿ndom_d©a + * +__buf +) + +364 +__THROW + + `__nÚnuÎ + ((2)); + +366  + $š™¡©e_r + ( +__£ed +, * +__»¡riù + +__¡©ebuf +, + +367 +size_t + +__¡©–’ +, + +368  +¿ndom_d©a + * +__»¡riù + +__buf +) + +369 +__THROW + + `__nÚnuÎ + ((2, 4)); + +371  + $£t¡©e_r + (* +__»¡riù + +__¡©ebuf +, + +372  +¿ndom_d©a + * +__»¡riù + +__buf +) + +373 +__THROW + + `__nÚnuÎ + ((1, 2)); + +378 +__BEGIN_NAMESPACE_STD + + +380  + $¿nd + (è +__THROW +; + +382  + $¤ªd + ( +__£ed +è +__THROW +; + +383 +__END_NAMESPACE_STD + + +385 #ifdeà +__USE_POSIX + + +387  + $¿nd_r + (* +__£ed +è +__THROW +; + +391 #ià +defšed + +__USE_SVID + || defšed +__USE_XOPEN + + +395  + $d¿nd48 + (è +__THROW +; + +396  + $”ªd48 + ( +__xsubi +[3]è +__THROW + + `__nÚnuÎ + ((1)); + +399  + $̪d48 + (è +__THROW +; + +400  + $Īd48 + ( +__xsubi +[3]) + +401 +__THROW + + `__nÚnuÎ + ((1)); + +404  + $m¿nd48 + (è +__THROW +; + +405  + $j¿nd48 + ( +__xsubi +[3]) + +406 +__THROW + + `__nÚnuÎ + ((1)); + +409  + $¤ªd48 + ( +__£edv® +è +__THROW +; + +410 * + $£ed48 + ( +__£ed16v +[3]) + +411 +__THROW + + `__nÚnuÎ + ((1)); + +412  + $lcÚg48 + ( +__·¿m +[7]è +__THROW + + `__nÚnuÎ + ((1)); + +414 #ifdeà +__USE_MISC + + +418  + sd¿nd48_d©a + + +420  +__x +[3]; + +421  +__Þd_x +[3]; + +422  +__c +; + +423  +__š™ +; + +424  +__a +; + +428  + $d¿nd48_r + ( +d¿nd48_d©a + * +__»¡riù + +__bufãr +, + +429 * +__»¡riù + +__»suÉ +è +__THROW + + `__nÚnuÎ + ((1, 2)); + +430  + $”ªd48_r + ( +__xsubi +[3], + +431  +d¿nd48_d©a + * +__»¡riù + +__bufãr +, + +432 * +__»¡riù + +__»suÉ +è +__THROW + + `__nÚnuÎ + ((1, 2)); + +435  + $̪d48_r + ( +d¿nd48_d©a + * +__»¡riù + +__bufãr +, + +436 * +__»¡riù + +__»suÉ +) + +437 +__THROW + + `__nÚnuÎ + ((1, 2)); + +438  + $Īd48_r + ( +__xsubi +[3], + +439  +d¿nd48_d©a + * +__»¡riù + +__bufãr +, + +440 * +__»¡riù + +__»suÉ +) + +441 +__THROW + + `__nÚnuÎ + ((1, 2)); + +444  + $m¿nd48_r + ( +d¿nd48_d©a + * +__»¡riù + +__bufãr +, + +445 * +__»¡riù + +__»suÉ +) + +446 +__THROW + + `__nÚnuÎ + ((1, 2)); + +447  + $j¿nd48_r + ( +__xsubi +[3], + +448  +d¿nd48_d©a + * +__»¡riù + +__bufãr +, + +449 * +__»¡riù + +__»suÉ +) + +450 +__THROW + + `__nÚnuÎ + ((1, 2)); + +453  + $¤ªd48_r + ( +__£edv® +,  +d¿nd48_d©a + * +__bufãr +) + +454 +__THROW + + `__nÚnuÎ + ((2)); + +456  + $£ed48_r + ( +__£ed16v +[3], + +457  +d¿nd48_d©a + * +__bufãr +è +__THROW + + `__nÚnuÎ + ((1, 2)); + +459  + $lcÚg48_r + ( +__·¿m +[7], + +460  +d¿nd48_d©a + * +__bufãr +) + +461 +__THROW + + `__nÚnuÎ + ((1, 2)); + +467 #iâdeà +__m®loc_ªd_ÿÎoc_defšed + + +468  + #__m®loc_ªd_ÿÎoc_defšed + + + ) + +469 +__BEGIN_NAMESPACE_STD + + +471 * + $m®loc + ( +size_t + +__size +è +__THROW + +__©Œibu‹_m®loc__ + +__wur +; + +473 * + $ÿÎoc + ( +size_t + +__nmemb +, size_ˆ +__size +) + +474 +__THROW + +__©Œibu‹_m®loc__ + +__wur +; + +475 +__END_NAMESPACE_STD + + +478 #iâdeà +__Ãed_m®loc_ªd_ÿÎoc + + +479 +__BEGIN_NAMESPACE_STD + + +485 * + $»®loc + (* +__±r +, +size_t + +__size +) + +486 +__THROW + +__©Œibu‹_w¬n_unu£d_»suÉ__ +; + +488  + $ä“ + (* +__±r +è +__THROW +; + +489 +__END_NAMESPACE_STD + + +491 #ifdef +__USE_MISC + + +493  + $cä“ + (* +__±r +è +__THROW +; + +496 #ià +defšed + +__USE_GNU + || defšed +__USE_BSD + || defšed +__USE_MISC + + +497  + ~<®loÿ.h +> + +500 #ià +defšed + +__USE_BSD + || defšed +__USE_XOPEN_EXTENDED + + +502 * + $v®loc + ( +size_t + +__size +è +__THROW + +__©Œibu‹_m®loc__ + +__wur +; + +505 #ifdeà +__USE_XOPEN2K + + +507  + $posix_mem®ign + (** +__mem±r +, +size_t + +__®ignm’t +, size_ˆ +__size +) + +508 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +511 +__BEGIN_NAMESPACE_STD + + +513  + $abÜt + (è +__THROW + + `__©Œibu‹__ + (( +__nÜ‘uº__ +)); + +517  + `©ex™ + ((* +__func +è()è +__THROW + + `__nÚnuÎ + ((1)); + +519 #ifdeà +__USE_GNU + + +523 #ifdeà +__ýlu¥lus + + +524 "C++"  + `©_quick_ex™ + ((* +__func +) ()) + +525 +__THROW + + `__asm + ("©_quick_ex™"è + `__nÚnuÎ + ((1)); + +527  + `©_quick_ex™ + ((* +__func +è()è +__THROW + + `__nÚnuÎ + ((1)); + +530 +__END_NAMESPACE_STD + + +532 #ifdef +__USE_MISC + + +535  + `Ú_ex™ + ((* +__func +è( +__¡©us +, * +__¬g +), *__arg) + +536 +__THROW + + `__nÚnuÎ + ((1)); + +539 +__BEGIN_NAMESPACE_STD + + +543  + $ex™ + ( +__¡©us +è +__THROW + + `__©Œibu‹__ + (( +__nÜ‘uº__ +)); + +545 #ifdeà +__USE_GNU + + +551  + $quick_ex™ + ( +__¡©us +è +__THROW + + `__©Œibu‹__ + (( +__nÜ‘uº__ +)); + +553 +__END_NAMESPACE_STD + + +555 #ifdeà +__USE_ISOC99 + + +556 +__BEGIN_NAMESPACE_C99 + + +559  + $_Ex™ + ( +__¡©us +è +__THROW + + `__©Œibu‹__ + (( +__nÜ‘uº__ +)); + +560 +__END_NAMESPACE_C99 + + +564 +__BEGIN_NAMESPACE_STD + + +566 * + $g‘’v + ( +__cÚ¡ + * +__Çme +è +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +567 +__END_NAMESPACE_STD + + +571 * + $__£cu»_g‘’v + ( +__cÚ¡ + * +__Çme +) + +572 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +574 #ià +defšed + +__USE_SVID + || defšed +__USE_XOPEN + + +578  + $pu‹nv + (* +__¡ršg +è +__THROW + + `__nÚnuÎ + ((1)); + +581 #ià +defšed + +__USE_BSD + || defšed +__USE_XOPEN2K + + +584  + $£‹nv + ( +__cÚ¡ + * +__Çme +, __cÚ¡ * +__v®ue +,  +__»¶aû +) + +585 +__THROW + + `__nÚnuÎ + ((2)); + +588  + $un£‹nv + ( +__cÚ¡ + * +__Çme +è +__THROW +; + +591 #ifdef +__USE_MISC + + +595  + $þ—»nv + (è +__THROW +; + +599 #ià +defšed + +__USE_MISC + || defšed +__USE_XOPEN_EXTENDED + + +604 * + $mk‹mp + (* +__‹m¶©e +è +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +614 #iâdeà +__USE_FILE_OFFSET64 + + +615  + $mk¡emp + (* +__‹m¶©e +è + `__nÚnuÎ + ((1)è +__wur +; + +617 #ifdeà +__REDIRECT + + +618  + `__REDIRECT + ( +mk¡emp +, (* +__‹m¶©e +), +mk¡emp64 +) + +619 + `__nÚnuÎ + ((1)è +__wur +; + +621  + #mk¡emp + +mk¡emp64 + + + ) + +624 #ifdeà +__USE_LARGEFILE64 + + +625  + $mk¡emp64 + (* +__‹m¶©e +è + `__nÚnuÎ + ((1)è +__wur +; + +629 #ifdeà +__USE_MISC + + +636 #iâdeà +__USE_FILE_OFFSET64 + + +637  + $mk¡emps + (* +__‹m¶©e +,  +__suffixËn +è + `__nÚnuÎ + ((1)è +__wur +; + +639 #ifdeà +__REDIRECT + + +640  + `__REDIRECT + ( +mk¡emps +, (* +__‹m¶©e +,  +__suffixËn +), + +641 +mk¡emps64 +è + `__nÚnuÎ + ((1)è +__wur +; + +643  + #mk¡emps + +mk¡emps64 + + + ) + +646 #ifdeà +__USE_LARGEFILE64 + + +647  + $mk¡emps64 + (* +__‹m¶©e +,  +__suffixËn +) + +648 + `__nÚnuÎ + ((1)è +__wur +; + +652 #ià +defšed + +__USE_BSD + || defšed +__USE_XOPEN2K8 + + +658 * + $mkd‹mp + (* +__‹m¶©e +è +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +661 #ifdeà +__USE_GNU + + +668 #iâdeà +__USE_FILE_OFFSET64 + + +669  + $mko¡emp + (* +__‹m¶©e +,  +__æags +è + `__nÚnuÎ + ((1)è +__wur +; + +671 #ifdeà +__REDIRECT + + +672  + `__REDIRECT + ( +mko¡emp +, (* +__‹m¶©e +,  +__æags +), +mko¡emp64 +) + +673 + `__nÚnuÎ + ((1)è +__wur +; + +675  + #mko¡emp + +mko¡emp64 + + + ) + +678 #ifdeà +__USE_LARGEFILE64 + + +679  + $mko¡emp64 + (* +__‹m¶©e +,  +__æags +è + `__nÚnuÎ + ((1)è +__wur +; + +688 #iâdeà +__USE_FILE_OFFSET64 + + +689  + $mko¡emps + (* +__‹m¶©e +,  +__suffixËn +,  +__æags +) + +690 + `__nÚnuÎ + ((1)è +__wur +; + +692 #ifdeà +__REDIRECT + + +693  + `__REDIRECT + ( +mko¡emps +, (* +__‹m¶©e +,  +__suffixËn +, + +694  +__æags +), +mko¡emps64 +) + +695 + `__nÚnuÎ + ((1)è +__wur +; + +697  + #mko¡emps + +mko¡emps64 + + + ) + +700 #ifdeà +__USE_LARGEFILE64 + + +701  + $mko¡emps64 + (* +__‹m¶©e +,  +__suffixËn +,  +__æags +) + +702 + `__nÚnuÎ + ((1)è +__wur +; + +707 +__BEGIN_NAMESPACE_STD + + +712  + $sy¡em + ( +__cÚ¡ + * +__commªd +è +__wur +; + +713 +__END_NAMESPACE_STD + + +716 #ifdef +__USE_GNU + + +719 * + $ÿnÚiÿlize_fže_Çme + ( +__cÚ¡ + * +__Çme +) + +720 +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +723 #ià +defšed + +__USE_BSD + || defšed +__USE_XOPEN_EXTENDED + + +729 * + $»®·th + ( +__cÚ¡ + * +__»¡riù + +__Çme +, + +730 * +__»¡riù + +__»sÞved +è +__THROW + +__wur +; + +735 #iâdeà +__COMPAR_FN_T + + +736  + #__COMPAR_FN_T + + + ) + +737 (* + t__com·r_â_t +è( + t__cÚ¡ + *, __const *); + +739 #ifdef +__USE_GNU + + +740  +__com·r_â_t + + tcom·risÚ_â_t +; + +743 #ifdeà +__USE_GNU + + +744 (* + t__com·r_d_â_t +è( + t__cÚ¡ + *, __const *, *); + +747 +__BEGIN_NAMESPACE_STD + + +750 * + $b£¬ch + ( +__cÚ¡ + * +__key +, __cÚ¡ * +__ba£ +, + +751 +size_t + +__nmemb +, size_ˆ +__size +, +__com·r_â_t + +__com·r +) + +752 + `__nÚnuÎ + ((1, 2, 5)è +__wur +; + +756  + $qsÜt + (* +__ba£ +, +size_t + +__nmemb +, size_ˆ +__size +, + +757 +__com·r_â_t + +__com·r +è + `__nÚnuÎ + ((1, 4)); + +758 #ifdeà +__USE_GNU + + +759  + $qsÜt_r + (* +__ba£ +, +size_t + +__nmemb +, size_ˆ +__size +, + +760 +__com·r_d_â_t + +__com·r +, * +__¬g +) + +761 + `__nÚnuÎ + ((1, 4)); + +766  + $abs + ( +__x +è +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)è +__wur +; + +767  + $Ïbs + ( +__x +è +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)è +__wur +; + +768 +__END_NAMESPACE_STD + + +770 #ifdeà +__USE_ISOC99 + + +771 +__ex‹nsiÚ__ +  + $Îabs + ( +__x +) + +772 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)è +__wur +; + +776 +__BEGIN_NAMESPACE_STD + + +780 +div_t + + $div + ( +__num” +,  +__d’om +) + +781 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)è +__wur +; + +782 +ldiv_t + + $ldiv + ( +__num” +,  +__d’om +) + +783 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)è +__wur +; + +784 +__END_NAMESPACE_STD + + +786 #ifdeà +__USE_ISOC99 + + +787 +__BEGIN_NAMESPACE_C99 + + +788 +__ex‹nsiÚ__ + +Îdiv_t + + $Îdiv + ( +__num” +, + +789  +__d’om +) + +790 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)è +__wur +; + +791 +__END_NAMESPACE_C99 + + +795 #ià +defšed + +__USE_SVID + || defšed +__USE_XOPEN_EXTENDED + + +802 * + $ecvt + ( +__v®ue +,  +__ndig™ +, * +__»¡riù + +__deýt +, + +803 * +__»¡riù + +__sign +è +__THROW + + `__nÚnuÎ + ((3, 4)è +__wur +; + +808 * + $fcvt + ( +__v®ue +,  +__ndig™ +, * +__»¡riù + +__deýt +, + +809 * +__»¡riù + +__sign +è +__THROW + + `__nÚnuÎ + ((3, 4)è +__wur +; + +814 * + $gcvt + ( +__v®ue +,  +__ndig™ +, * +__buf +) + +815 +__THROW + + `__nÚnuÎ + ((3)è +__wur +; + +818 #ifdeà +__USE_MISC + + +820 * + $qecvt + ( +__v®ue +,  +__ndig™ +, + +821 * +__»¡riù + +__deýt +, *__»¡riù +__sign +) + +822 +__THROW + + `__nÚnuÎ + ((3, 4)è +__wur +; + +823 * + $qfcvt + ( +__v®ue +,  +__ndig™ +, + +824 * +__»¡riù + +__deýt +, *__»¡riù +__sign +) + +825 +__THROW + + `__nÚnuÎ + ((3, 4)è +__wur +; + +826 * + $qgcvt + ( +__v®ue +,  +__ndig™ +, * +__buf +) + +827 +__THROW + + `__nÚnuÎ + ((3)è +__wur +; + +832  + $ecvt_r + ( +__v®ue +,  +__ndig™ +, * +__»¡riù + +__deýt +, + +833 * +__»¡riù + +__sign +, *__»¡riù +__buf +, + +834 +size_t + +__Ën +è +__THROW + + `__nÚnuÎ + ((3, 4, 5)); + +835  + $fcvt_r + ( +__v®ue +,  +__ndig™ +, * +__»¡riù + +__deýt +, + +836 * +__»¡riù + +__sign +, *__»¡riù +__buf +, + +837 +size_t + +__Ën +è +__THROW + + `__nÚnuÎ + ((3, 4, 5)); + +839  + $qecvt_r + ( +__v®ue +,  +__ndig™ +, + +840 * +__»¡riù + +__deýt +, *__»¡riù +__sign +, + +841 * +__»¡riù + +__buf +, +size_t + +__Ën +) + +842 +__THROW + + `__nÚnuÎ + ((3, 4, 5)); + +843  + $qfcvt_r + ( +__v®ue +,  +__ndig™ +, + +844 * +__»¡riù + +__deýt +, *__»¡riù +__sign +, + +845 * +__»¡riù + +__buf +, +size_t + +__Ën +) + +846 +__THROW + + `__nÚnuÎ + ((3, 4, 5)); + +851 +__BEGIN_NAMESPACE_STD + + +854  + $mbËn + ( +__cÚ¡ + * +__s +, +size_t + +__n +è +__THROW + +__wur +; + +857  + $mbtowc + ( +wch¬_t + * +__»¡riù + +__pwc +, + +858 +__cÚ¡ + * +__»¡riù + +__s +, +size_t + +__n +è +__THROW + +__wur +; + +861  + $wùomb + (* +__s +, +wch¬_t + +__wch¬ +è +__THROW + +__wur +; + +865 +size_t + + $mb¡owcs + ( +wch¬_t + * +__»¡riù + +__pwcs +, + +866 +__cÚ¡ + * +__»¡riù + +__s +, +size_t + +__n +è +__THROW +; + +868 +size_t + + $wc¡ombs + (* +__»¡riù + +__s +, + +869 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__pwcs +, +size_t + +__n +) + +870 +__THROW +; + +871 +__END_NAMESPACE_STD + + +874 #ifdeà +__USE_SVID + + +879  + $½m©ch + ( +__cÚ¡ + * +__»¥Ú£ +è +__THROW + + `__nÚnuÎ + ((1)è +__wur +; + +883 #ifdeà +__USE_XOPEN_EXTENDED + + +890  + $g‘subÝt + (** +__»¡riù + +__ÝtiÚp +, + +891 * +__cÚ¡ + * +__»¡riù + +__tok’s +, + +892 ** +__»¡riù + +__v®u• +) + +893 +__THROW + + `__nÚnuÎ + ((1, 2, 3)è +__wur +; + +897 #ifdeà +__USE_XOPEN + + +899  + $£tkey + ( +__cÚ¡ + * +__key +è +__THROW + + `__nÚnuÎ + ((1)); + +905 #ifdeà +__USE_XOPEN2K + + +907  + $posix_Ý’± + ( +__oæag +è +__wur +; + +910 #ifdeà +__USE_XOPEN + + +915  + $g¿Á± + ( +__fd +è +__THROW +; + +919  + $uÆock± + ( +__fd +è +__THROW +; + +924 * + $±¢ame + ( +__fd +è +__THROW + +__wur +; + +927 #ifdeà +__USE_GNU + + +931  + $±¢ame_r + ( +__fd +, * +__buf +, +size_t + +__buæ’ +) + +932 +__THROW + + `__nÚnuÎ + ((2)); + +935  + `g‘± + (); + +938 #ifdeà +__USE_BSD + + +942  + $g‘lßdavg + ( +__lßdavg +[],  +__ÃËm +) + +943 +__THROW + + `__nÚnuÎ + ((1)); + +948 #ià +__USE_FORTIFY_LEVEL + > 0 && +defšed + +__ex‹º_®ways_šlše + + +949  + ~ + +951 #ifdeà +__LDBL_COMPAT + + +952  + ~ + +956 #undeà +__Ãed_m®loc_ªd_ÿÎoc + + +958 +__END_DECLS + + + @/usr/include/sys/cdefs.h + +20 #iâdef +_SYS_CDEFS_H + + +21  + #_SYS_CDEFS_H + 1 + + ) + +24 #iâdeà +_FEATURES_H + + +25  + ~<ã©u»s.h +> + +31 #ià +defšed + +__GNUC__ + && !defšed +__STDC__ + + +36 #undeà +__P + + +37 #undeà +__PMT + + +39 #ifdeà +__GNUC__ + + +46 #ià! +defšed + +__ýlu¥lus + && +__GNUC_PREREQ + (3, 3) + +47  + #__THROW + + `__©Œibu‹__ + (( +__nÙhrow__ +)) + + ) + +48  + #__NTH +( +fù +è + `__©Œibu‹__ + (( +__nÙhrow__ +)è + ) +fct + +50 #ià +defšed + +__ýlu¥lus + && +__GNUC_PREREQ + (2,8) + +51  + #__THROW + + `throw + () + + ) + +52  + #__NTH +( +fù +èfù + `throw + () + + ) + +54  + #__THROW + + + ) + +55  + #__NTH +( +fù +è + ) +fct + +61  + #__šlše + + + ) + +63  + #__THROW + + + ) + +64  + #__NTH +( +fù +è + ) +fct + +66  + #__cÚ¡ + cÚ¡ + + ) + +67  + #__sigÃd + sigÃd + + ) + +68  + #__vÞ©že + vÞ©že + + ) + +74  + #__P +( +¬gs +è + ) +args + +75  + #__PMT +( +¬gs +è + ) +args + +80  + #__CONCAT +( +x +, +y +èx ## + ) +y + +81  + #__STRING +( +x +è#x + + ) + +84  + #__±r_t + * + + ) + +85  + #__lÚg_doubË_t +  + + ) + +89 #ifdef +__ýlu¥lus + + +90  + #__BEGIN_DECLS + "C" { + + ) + +91  + #__END_DECLS + } + + ) + +93  + #__BEGIN_DECLS + + + ) + +94  + #__END_DECLS + + + ) + +103 #ià +defšed + +__ýlu¥lus + && defšed +_GLIBCPP_USE_NAMESPACES + + +104  + #__BEGIN_NAMESPACE_STD + +Çme¥aû + +¡d + { + + ) + +105  + #__END_NAMESPACE_STD + } + + ) + +106  + #__USING_NAMESPACE_STD +( +Çme +è +usšg + +¡d +::Çme; + + ) + +107  + #__BEGIN_NAMESPACE_C99 + +Çme¥aû + +__c99 + { + + ) + +108  + #__END_NAMESPACE_C99 + } + + ) + +109  + #__USING_NAMESPACE_C99 +( +Çme +è +usšg + +__c99 +::Çme; + + ) + +114  + #__BEGIN_NAMESPACE_STD + + + ) + +115  + #__END_NAMESPACE_STD + + + ) + +116  + #__USING_NAMESPACE_STD +( +Çme +) + + ) + +117  + #__BEGIN_NAMESPACE_C99 + + + ) + +118  + #__END_NAMESPACE_C99 + + + ) + +119  + #__USING_NAMESPACE_C99 +( +Çme +) + + ) + +124 #iâdeà +__BOUNDED_POINTERS__ + + +125  + #__bounded + + + ) + +126  + #__unbounded + + + ) + +127  + #__±rv®ue + + + ) + +132  + #__bos +( +±r +è + `__bužtš_objeù_size + (±r, +__USE_FORTIFY_LEVEL + > 1) + + ) + +133  + #__bos0 +( +±r +è + `__bužtš_objeù_size + (±r, 0) + + ) + +135 #ià +__GNUC_PREREQ + (4,3) + +136  + #__w¬ndeþ +( +Çme +, +msg +) \ + +137  + `Çme + (è + `__©Œibu‹__ +(( + `__w¬nšg__ + ( +msg +))) + + ) + +138  + #__w¬Ç‰r +( +msg +è + `__©Œibu‹__ +(( + `__w¬nšg__ + (msg))) + + ) + +139  + #__”rÜdeþ +( +Çme +, +msg +) \ + +140  + `Çme + (è + `__©Œibu‹__ +(( + `__”rÜ__ + ( +msg +))) + + ) + +142  + #__w¬ndeþ +( +Çme +, +msg +è  + `Çme + () + + ) + +143  + #__w¬Ç‰r +( +msg +) + + ) + +144  + #__”rÜdeþ +( +Çme +, +msg +è  + `Çme + () + + ) + +148 #ià +__GNUC_PREREQ + (2,97) + +150  + #__æex¬r + [] + + ) + +152 #ifdeà +__GNUC__ + + +153  + #__æex¬r + [0] + + ) + +155 #ià +defšed + +__STDC_VERSION__ + && __STDC_VERSION__ >= 199901L + +156  + #__æex¬r + [] + + ) + +159  + #__æex¬r + [1] + + ) + +175 #ià +defšed + +__GNUC__ + && __GNUC__ >= 2 + +177  + #__REDIRECT +( +Çme +, +´Ùo +, +®Ÿs +èÇm´ÙØ + `__asm__ + ( + `__ASMNAME + (#®Ÿs)) + + ) + +178 #ifdeà +__ýlu¥lus + + +179  + #__REDIRECT_NTH +( +Çme +, +´Ùo +, +®Ÿs +) \ + +180 +Çme + +´Ùo + +__THROW + + `__asm__ + ( + `__ASMNAME + (#®Ÿs)) + + ) + +182  + #__REDIRECT_NTH +( +Çme +, +´Ùo +, +®Ÿs +) \ + +183 +Çme + +´Ùo + + `__asm__ + ( + `__ASMNAME + (#®Ÿs)è +__THROW + + + ) + +185  + #__ASMNAME +( +úame +è + `__ASMNAME2 + ( +__USER_LABEL_PREFIX__ +, cÇme) + + ) + +186  + #__ASMNAME2 +( +´efix +, +úame +è + `__STRING + (´efixè + ) +cname + +199 #ià! +defšed + +__GNUC__ + || __GNUC__ < 2 + +200  + #__©Œibu‹__ +( +xyz +è + + ) + +206 #ià +__GNUC_PREREQ + (2,96) + +207  + #__©Œibu‹_m®loc__ + + `__©Œibu‹__ + (( +__m®loc__ +)) + + ) + +209  + #__©Œibu‹_m®loc__ + + + ) + +215 #ià +__GNUC_PREREQ + (2,96) + +216  + #__©Œibu‹_pu»__ + + `__©Œibu‹__ + (( +__pu»__ +)) + + ) + +218  + #__©Œibu‹_pu»__ + + + ) + +224 #ià +__GNUC_PREREQ + (3,1) + +225  + #__©Œibu‹_u£d__ + + `__©Œibu‹__ + (( +__u£d__ +)) + + ) + +226  + #__©Œibu‹_nošlše__ + + `__©Œibu‹__ + (( +__nošlše__ +)) + + ) + +228  + #__©Œibu‹_u£d__ + + `__©Œibu‹__ + (( +__unu£d__ +)) + + ) + +229  + #__©Œibu‹_nošlše__ + + + ) + +233 #ià +__GNUC_PREREQ + (3,2) + +234  + #__©Œibu‹_d•»ÿ‹d__ + + `__©Œibu‹__ + (( +__d•»ÿ‹d__ +)) + + ) + +236  + #__©Œibu‹_d•»ÿ‹d__ + + + ) + +245 #ià +__GNUC_PREREQ + (2,8) + +246  + #__©Œibu‹_fÜm©_¬g__ +( +x +è + `__©Œibu‹__ + (( + `__fÜm©_¬g__ + (x))) + + ) + +248  + #__©Œibu‹_fÜm©_¬g__ +( +x +è + + ) + +255 #ià +__GNUC_PREREQ + (2,97) + +256  + #__©Œibu‹_fÜm©_¡rfmÚ__ +( +a +, +b +) \ + +257 + `__©Œibu‹__ + (( + `__fÜm©__ + ( +__¡rfmÚ__ +, +a +, +b +))) + + ) + +259  + #__©Œibu‹_fÜm©_¡rfmÚ__ +( +a +, +b +è + + ) + +264 #ià +__GNUC_PREREQ + (3,3) + +265  + #__nÚnuÎ +( +·¿ms +è + `__©Œibu‹__ + (( +__nÚnuÎ__ +…¬ams)) + + ) + +267  + #__nÚnuÎ +( +·¿ms +) + + ) + +272 #ià +__GNUC_PREREQ + (3,4) + +273  + #__©Œibu‹_w¬n_unu£d_»suÉ__ + \ + +274 + `__©Œibu‹__ + (( +__w¬n_unu£d_»suÉ__ +)) + + ) + +275 #ià +__USE_FORTIFY_LEVEL + > 0 + +276  + #__wur + +__©Œibu‹_w¬n_unu£d_»suÉ__ + + + ) + +279  + #__©Œibu‹_w¬n_unu£d_»suÉ__ + + + ) + +281 #iâdeà +__wur + + +282  + #__wur + + + ) + +286 #ià +__GNUC_PREREQ + (3,2) + +287  + #__®ways_šlše + +__šlše + + `__©Œibu‹__ + (( +__®ways_šlše__ +)) + + ) + +289  + #__®ways_šlše + +__šlše + + + ) + +294 #ià! +defšed + +__ýlu¥lus + || +__GNUC_PREREQ + (4,3) + +295 #ià +defšed + +__GNUC_STDC_INLINE__ + || defšed +__ýlu¥lus + + +296  + #__ex‹º_šlše + +__šlše + + `__©Œibu‹__ + (( +__gnu_šlše__ +)) + + ) + +297 #ià +__GNUC_PREREQ + (4,3) + +298  + #__ex‹º_®ways_šlše + \ + +299 +__®ways_šlše + + `__©Œibu‹__ + (( +__gnu_šlše__ +, +__¬tificŸl__ +)) + + ) + +301  + #__ex‹º_®ways_šlše + \ + +302 +__®ways_šlše + + `__©Œibu‹__ + (( +__gnu_šlše__ +)) + + ) + +305  + #__ex‹º_šlše + +__šlše + + + ) + +306 #ià +__GNUC_PREREQ + (4,3) + +307  + #__ex‹º_®ways_šlše + \ + +308 +__®ways_šlše + + `__©Œibu‹__ + (( +__¬tificŸl__ +)) + + ) + +310  + #__ex‹º_®ways_šlše + +__®ways_šlše + + + ) + +317 #ià +__GNUC_PREREQ + (4,3) + +318  + #__va_¬g_·ck +(è + `__bužtš_va_¬g_·ck + () + + ) + +319  + #__va_¬g_·ck_Ën +(è + `__bužtš_va_¬g_·ck_Ën + () + + ) + +326 #ià! +__GNUC_PREREQ + (2,8) + +327  + #__ex‹nsiÚ__ + + + ) + +331 #ià! +__GNUC_PREREQ + (2,92) + +332  + #__»¡riù + + + ) + +338 #ià +__GNUC_PREREQ + (3,1è&& ! +defšed + +__GNUG__ + + +339  + #__»¡riù_¬r + +__»¡riù + + + ) + +341 #ifdeà +__GNUC__ + + +342  + #__»¡riù_¬r + + + ) + +344 #ià +defšed + +__STDC_VERSION__ + && __STDC_VERSION__ >= 199901L + +345  + #__»¡riù_¬r + +»¡riù + + + ) + +348  + #__»¡riù_¬r + + + ) + +353  + ~ + +355 #ià +defšed + +__LONG_DOUBLE_MATH_OPTIONAL + && defšed +__NO_LONG_DOUBLE_MATH + + +356  + #__LDBL_COMPAT + 1 + + ) + +357 #ifdeà +__REDIRECT + + +358  + #__LDBL_REDIR1 +( +Çme +, +´Ùo +, +®Ÿs +è + `__REDIRECT + (Çme,…rÙo,‡lŸs) + + ) + +359  + #__LDBL_REDIR +( +Çme +, +´Ùo +) \ + +360 + `__LDBL_REDIR1 + ( +Çme +, +´Ùo +, +__Ædbl_ +##Çme) + + ) + +361  + #__LDBL_REDIR1_NTH +( +Çme +, +´Ùo +, +®Ÿs +è + `__REDIRECT_NTH + (Çme,…rÙo,‡lŸs) + + ) + +362  + #__LDBL_REDIR_NTH +( +Çme +, +´Ùo +) \ + +363 + `__LDBL_REDIR1_NTH + ( +Çme +, +´Ùo +, +__Ædbl_ +##Çme) + + ) + +364  + #__LDBL_REDIR1_DECL +( +Çme +, +®Ÿs +) \ + +365 + `__ty³of + ( +Çme +èÇm + `__asm + ( + `__ASMNAME + (#®Ÿs)); + + ) + +366  + #__LDBL_REDIR_DECL +( +Çme +) \ + +367 + `__ty³of + ( +Çme +èÇm + `__asm + ( + `__ASMNAME + ("__Ædbl_" #Çme)); + + ) + +368  + #__REDIRECT_LDBL +( +Çme +, +´Ùo +, +®Ÿs +) \ + +369 + `__LDBL_REDIR1 + ( +Çme +, +´Ùo +, +__Ædbl_ +## +®Ÿs +) + + ) + +370  + #__REDIRECT_NTH_LDBL +( +Çme +, +´Ùo +, +®Ÿs +) \ + +371 + `__LDBL_REDIR1_NTH + ( +Çme +, +´Ùo +, +__Ædbl_ +## +®Ÿs +) + + ) + +374 #ià! +defšed + +__LDBL_COMPAT + || !defšed +__REDIRECT + + +375  + #__LDBL_REDIR1 +( +Çme +, +´Ùo +, +®Ÿs +èÇm + ) +proto + +376  + #__LDBL_REDIR +( +Çme +, +´Ùo +èÇm + ) +proto + +377  + #__LDBL_REDIR1_NTH +( +Çme +, +´Ùo +, +®Ÿs +èÇm´ÙØ +__THROW + + + ) + +378  + #__LDBL_REDIR_NTH +( +Çme +, +´Ùo +èÇm´ÙØ +__THROW + + + ) + +379  + #__LDBL_REDIR_DECL +( +Çme +) + + ) + +380 #ifdeà +__REDIRECT + + +381  + #__REDIRECT_LDBL +( +Çme +, +´Ùo +, +®Ÿs +è + `__REDIRECT + (Çme,…rÙo,‡lŸs) + + ) + +382  + #__REDIRECT_NTH_LDBL +( +Çme +, +´Ùo +, +®Ÿs +) \ + +383 + `__REDIRECT_NTH + ( +Çme +, +´Ùo +, +®Ÿs +) + + ) + + @/usr/include/alloca.h + +19 #iâdef +_ALLOCA_H + + +20  + #_ALLOCA_H + 1 + + ) + +22  + ~<ã©u»s.h +> + +24  + #__Ãed_size_t + + + ) + +25  + ~<¡ddef.h +> + +27 + g__BEGIN_DECLS + + +30 #undeà +®loÿ + + +33 * + $®loÿ + ( +size_t + +__size +è +__THROW +; + +35 #ifdef +__GNUC__ + + +36  + #®loÿ +( +size +è + `__bužtš_®loÿ + (size) + + ) + +39 +__END_DECLS + + + @/usr/include/bits/byteswap.h + +21 #ià! +defšed + +_BYTESWAP_H + && !defšed +_NETINET_IN_H + && !defšed +_ENDIAN_H + + +25 #iâdeà +_BITS_BYTESWAP_H + + +26  + #_BITS_BYTESWAP_H + 1 + + ) + +28  + ~ + +31  + #__bsw­_cÚ¡ªt_16 +( +x +) \ + +32 (((( +x +è>> 8è& 0xffè| (((xè& 0xffè<< 8)) + + ) + +34 #ià +defšed + +__GNUC__ + && __GNUC__ >= 2 + +35  + #__bsw­_16 +( +x +) \ + +36 ( +__ex‹nsiÚ__ + \ + +37 ({  +__v +, +__x + = ( +x +); \ + +38 ià( + `__bužtš_cÚ¡ªt_p + ( +__x +)) \ + +39 +__v + = + `__bsw­_cÚ¡ªt_16 + ( +__x +); \ + +41 + `__asm__ + ("rorw $8, %w0" \ + +42 : "ô" ( +__v +) \ + +43 : "0" ( +__x +) \ + +45 +__v +; })) + + ) + +48  + #__bsw­_16 +( +x +) \ + +49 ( +__ex‹nsiÚ__ + \ + +50 ({  +__x + = ( +x +); + `__bsw­_cÚ¡ªt_16 + (__x); })) + + ) + +55  + #__bsw­_cÚ¡ªt_32 +( +x +) \ + +56 (((( +x +) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ + +57 ((( +x +è& 0x0000ff00è<< 8è| (((xè& 0x000000ffè<< 24)) + + ) + +59 #ià +defšed + +__GNUC__ + && __GNUC__ >= 2 + +60 #ià +__WORDSIZE + =ð64 || ( +defšed + +__i486__ + || defšed +__³Áium__ + \ + +61 || +defšed + + g__³Áium´o__ + || defšed + g__³Áium4__ + \ + +62 || +defšed + + g__k8__ + || defšed + g__©hlÚ__ + \ + +63 || +defšed + + g__k6__ + || defšed + g__nocÚa__ + \ + +64 || +defšed + + g__cÜe2__ + || defšed + g__geode__ + \ + +65 || +defšed + + g__amdçm10__ +) + +68  + #__bsw­_32 +( +x +) \ + +69 ( +__ex‹nsiÚ__ + \ + +70 ({  +__v +, +__x + = ( +x +); \ + +71 ià( + `__bužtš_cÚ¡ªt_p + ( +__x +)) \ + +72 +__v + = + `__bsw­_cÚ¡ªt_32 + ( +__x +); \ + +74 + `__asm__ + ("bsw­ %0" : "ô" ( +__v +è: "0" ( +__x +)); \ + +75 +__v +; })) + + ) + +77  + #__bsw­_32 +( +x +) \ + +78 ( +__ex‹nsiÚ__ + \ + +79 ({  +__v +, +__x + = ( +x +); \ + +80 ià( + `__bužtš_cÚ¡ªt_p + ( +__x +)) \ + +81 +__v + = + `__bsw­_cÚ¡ªt_32 + ( +__x +); \ + +83 + `__asm__ + ("rorw $8, %w0;" \ + +86 : "ô" ( +__v +) \ + +87 : "0" ( +__x +) \ + +89 +__v +; })) + + ) + +92  + #__bsw­_32 +( +x +) \ + +93 ( +__ex‹nsiÚ__ + \ + +94 ({  +__x + = ( +x +); + `__bsw­_cÚ¡ªt_32 + (__x); })) + + ) + +98 #ià +defšed + +__GNUC__ + && __GNUC__ >= 2 + +100  + #__bsw­_cÚ¡ªt_64 +( +x +) \ + +101 (((( +x +) & 0xff00000000000000ull) >> 56) \ + +102 | ((( +x +) & 0x00ff000000000000ull) >> 40) \ + +103 | ((( +x +) & 0x0000ff0000000000ull) >> 24) \ + +104 | ((( +x +) & 0x000000ff00000000ull) >> 8) \ + +105 | ((( +x +) & 0x00000000ff000000ull) << 8) \ + +106 | ((( +x +) & 0x0000000000ff0000ull) << 24) \ + +107 | ((( +x +) & 0x000000000000ff00ull) << 40) \ + +108 | ((( +x +è& 0x00000000000000ffuÎè<< 56)) + + ) + +110 #ià +__WORDSIZE + == 64 + +111  + #__bsw­_64 +( +x +) \ + +112 ( +__ex‹nsiÚ__ + \ + +113 ({  +__v +, +__x + = ( +x +); \ + +114 ià( + `__bužtš_cÚ¡ªt_p + ( +__x +)) \ + +115 +__v + = + `__bsw­_cÚ¡ªt_64 + ( +__x +); \ + +117 + `__asm__ + ("bsw­ %q0" : "ô" ( +__v +è: "0" ( +__x +)); \ + +118 +__v +; })) + + ) + +120  + #__bsw­_64 +( +x +) \ + +121 ( +__ex‹nsiÚ__ + \ + +122 ({ uniÚ { +__ex‹nsiÚ__ +  +__Î +; \ + +123  +__l +[2]; } +__w +, +__r +; \ + +124 ià( + `__bužtš_cÚ¡ªt_p + ( +x +)) \ + +125 +__r +. +__Î + = + `__bsw­_cÚ¡ªt_64 + ( +x +); \ + +128 +__w +. +__Î + = ( +x +); \ + +129 +__r +. +__l +[0] = + `__bsw­_32 + ( +__w +.__l[1]); \ + +130 +__r +. +__l +[1] = + `__bsw­_32 + ( +__w +.__l[0]); \ + +132 +__r +. +__Î +; })) + + ) + + @/usr/include/bits/endian.h + +3 #iâdeà +_ENDIAN_H + + +7  + #__BYTE_ORDER + +__LITTLE_ENDIAN + + + ) + + @/usr/include/bits/libc-lock.h + +20 #iâdeà +_BITS_LIBC_LOCK_H + + +21  + #_BITS_LIBC_LOCK_H + 1 + + ) + +23  + ~<±h»ad.h +> + +24  + #__Ãed_NULL + + + ) + +25  + ~<¡ddef.h +> + +34 #ifdeà +_LIBC + + +35  + ~ + +36  + ~<Žs.h +> + +37  + ~<±h»ad-funùiÚs.h +> + +38  + ~<”ºo.h +> + +39  + ~ + +43 #ià +defšed + +_LIBC + || defšed +_IO_MTSAFE_IO + + +44 #ià( +defšed + +NOT_IN_libc + && !defšed +IS_IN_lib±h»ad +è|| !defšed +_LIBC + + +45  +±h»ad_mu‹x_t + + t__libc_lock_t +; + +46 ¡ruù { +±h»ad_mu‹x_t + + mmu‹x +; } + t__libc_lock_»cursive_t +; + +48  + t__libc_lock_t +; + +49 ¡ruù {  + mlock +;  + mút +; * + mowÃr +; } + t__libc_lock_»cursive_t +; + +51 ¡ruù { +±h»ad_mu‹x_t + + mmu‹x +; } + t__¹ld_lock_»cursive_t +; + +52 #ifdeà +__USE_UNIX98 + + +53  +±h»ad_rwlock_t + + t__libc_rwlock_t +; + +55  +__libc_rwlock_Ýaque__ + + t__libc_rwlock_t +; + +58  +__libc_lock_Ýaque__ + + t__libc_lock_t +; + +59  +__libc_lock_»cursive_Ýaque__ + + t__libc_lock_»cursive_t +; + +60  +__libc_rwlock_Ýaque__ + + t__libc_rwlock_t +; + +64  +±h»ad_key_t + + t__libc_key_t +; + +73  + #__libc_lock_defše +( +CLASS +, +NAME +) \ + +74 +CLASS + +__libc_lock_t + +NAME +; + + ) + +75  + #__libc_rwlock_defše +( +CLASS +, +NAME +) \ + +76 +CLASS + +__libc_rwlock_t + +NAME +; + + ) + +77  + #__libc_lock_defše_»cursive +( +CLASS +, +NAME +) \ + +78 +CLASS + +__libc_lock_»cursive_t + +NAME +; + + ) + +79  + #__¹ld_lock_defše_»cursive +( +CLASS +, +NAME +) \ + +80 +CLASS + +__¹ld_lock_»cursive_t + +NAME +; + + ) + +91 #ià +defšed + +_LIBC + && (!defšed +NOT_IN_libc + || defšed +IS_IN_lib±h»ad +) + +92 #ià +LLL_LOCK_INITIALIZER + == 0 + +93  + #__libc_lock_defše_š™Ÿlized +( +CLASS +, +NAME +) \ + +94 +CLASS + +__libc_lock_t + +NAME +; + + ) + +96  + #__libc_lock_defše_š™Ÿlized +( +CLASS +, +NAME +) \ + +97 +CLASS + +__libc_lock_t + +NAME + = +LLL_LOCK_INITIALIZER +; + + ) + +100 #ià +__LT_SPINLOCK_INIT + == 0 + +101  + #__libc_lock_defše_š™Ÿlized +( +CLASS +, +NAME +) \ + +102 +CLASS + +__libc_lock_t + +NAME +; + + ) + +104  + #__libc_lock_defše_š™Ÿlized +( +CLASS +, +NAME +) \ + +105 +CLASS + +__libc_lock_t + +NAME + = +PTHREAD_MUTEX_INITIALIZER +; + + ) + +109  + #__libc_rwlock_defše_š™Ÿlized +( +CLASS +, +NAME +) \ + +110 +CLASS + +__libc_rwlock_t + +NAME + = +PTHREAD_RWLOCK_INITIALIZER +; + + ) + +114 #ià +defšed + +_LIBC + && (!defšed +NOT_IN_libc + || defšed +IS_IN_lib±h»ad +) + +115 #ià +LLL_LOCK_INITIALIZER + == 0 + +116  + #__libc_lock_defše_š™Ÿlized_»cursive +( +CLASS +, +NAME +) \ + +117 +CLASS + +__libc_lock_»cursive_t + +NAME +; + + ) + +119  + #__libc_lock_defše_š™Ÿlized_»cursive +( +CLASS +, +NAME +) \ + +120 +CLASS + +__libc_lock_»cursive_t + +NAME + = +_LIBC_LOCK_RECURSIVE_INITIALIZER +; + + ) + +122  + #_LIBC_LOCK_RECURSIVE_INITIALIZER + \ + +123 { +LLL_LOCK_INITIALIZER +, 0, +NULL + } + + ) + +125  + #__libc_lock_defše_š™Ÿlized_»cursive +( +CLASS +, +NAME +) \ + +126 +CLASS + +__libc_lock_»cursive_t + +NAME + = +_LIBC_LOCK_RECURSIVE_INITIALIZER +; + + ) + +127  + #_LIBC_LOCK_RECURSIVE_INITIALIZER + \ + +128 { +PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP +} + + ) + +131  + #__¹ld_lock_defše_š™Ÿlized_»cursive +( +CLASS +, +NAME +) \ + +132 +CLASS + +__¹ld_lock_»cursive_t + +NAME + = +_RTLD_LOCK_RECURSIVE_INITIALIZER +; + + ) + +133  + #_RTLD_LOCK_RECURSIVE_INITIALIZER + \ + +134 { +PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP +} + + ) + +136  + #__¹ld_lock_š™Ÿlize +( +NAME +) \ + +137 (è(( +NAME +èð( +__¹ld_lock_»cursive_t +è +_RTLD_LOCK_RECURSIVE_INITIALIZER +) + + ) + +144 #ifdeà +__PIC__ + + +145  + #__libc_maybe_ÿÎ +( +FUNC +, +ARGS +, +ELSE +) \ + +146 ( + `__ex‹nsiÚ__ + ({ + `__ty³of + ( +FUNC +è* +_â + = (FUNC); \ + +147 +_â + !ð +NULL + ? (*_âè +ARGS + : +ELSE +; })) + + ) + +149  + #__libc_maybe_ÿÎ +( +FUNC +, +ARGS +, +ELSE +) \ + +150 ( +FUNC + !ð +NULL + ? FUNC +ARGS + : +ELSE +) + + ) + +154 #ià +defšed + +SHARED + && !defšed +NOT_IN_libc + + +155  + #PTFAVAIL +( +NAME +è +__libc_±h»ad_funùiÚs_š™ + + + ) + +156  + #__libc_±f_ÿÎ +( +FUNC +, +ARGS +, +ELSE +) \ + +157 ( +__libc_±h»ad_funùiÚs_š™ + ? + `PTHFCT_CALL + ( +±r_ +## +FUNC +, +ARGS +è: +ELSE +) + + ) + +158  + #__libc_±f_ÿÎ_®ways +( +FUNC +, +ARGS +) \ + +159 + `PTHFCT_CALL + ( +±r_ +## +FUNC +, +ARGS +) + + ) + +161  + #PTFAVAIL +( +NAME +è(NAME !ð +NULL +) + + ) + +162  + #__libc_±f_ÿÎ +( +FUNC +, +ARGS +, +ELSE +) \ + +163 + `__libc_maybe_ÿÎ + ( +FUNC +, +ARGS +, +ELSE +) + + ) + +164  + #__libc_±f_ÿÎ_®ways +( +FUNC +, +ARGS +) \ + +165 +FUNC + +ARGS + + + ) + +171 #ià +defšed + +_LIBC + && (!defšed +NOT_IN_libc + || defšed +IS_IN_lib±h»ad +) + +172  + #__libc_lock_š™ +( +NAME +è((NAMEèð +LLL_LOCK_INITIALIZER +, 0) + + ) + +174  + #__libc_lock_š™ +( +NAME +) \ + +175 + `__libc_maybe_ÿÎ + ( +__±h»ad_mu‹x_š™ +, (&( +NAME +), +NULL +), 0) + + ) + +177 #ià +defšed + +SHARED + && !defšed +NOT_IN_libc + + +180  + #__libc_rwlock_š™ +( +NAME +) \ + +181 ( + `__bužtš_mem£t + (&( +NAME +), '\0',  (NAME)), 0) + + ) + +183  + #__libc_rwlock_š™ +( +NAME +) \ + +184 + `__libc_maybe_ÿÎ + ( +__±h»ad_rwlock_š™ +, (&( +NAME +), +NULL +), 0) + + ) + +188 #ià +defšed + +_LIBC + && (!defšed +NOT_IN_libc + || defšed +IS_IN_lib±h»ad +) + +189  + #__libc_lock_š™_»cursive +( +NAME +) \ + +190 (( +NAME +èð( +__libc_lock_»cursive_t +è +_LIBC_LOCK_RECURSIVE_INITIALIZER +, 0) + + ) + +192  + #__libc_lock_š™_»cursive +( +NAME +) \ + +194 ià( +__±h»ad_mu‹x_š™ + !ð +NULL +) \ + +196 +±h»ad_mu‹x©Œ_t + +__©Œ +; \ + +197 + `__±h»ad_mu‹x©Œ_š™ + (& +__©Œ +); \ + +198 + `__±h»ad_mu‹x©Œ_£‰y³ + (& +__©Œ +, +PTHREAD_MUTEX_RECURSIVE_NP +); \ + +199 + `__±h»ad_mu‹x_š™ + (&( +NAME +). +mu‹x +, & +__©Œ +); \ + +200 + `__±h»ad_mu‹x©Œ_de¡roy + (& +__©Œ +); \ + +202 } 0) + + ) + +205  + #__¹ld_lock_š™_»cursive +( +NAME +) \ + +207 ià( +__±h»ad_mu‹x_š™ + !ð +NULL +) \ + +209 +±h»ad_mu‹x©Œ_t + +__©Œ +; \ + +210 + `__±h»ad_mu‹x©Œ_š™ + (& +__©Œ +); \ + +211 + `__±h»ad_mu‹x©Œ_£‰y³ + (& +__©Œ +, +PTHREAD_MUTEX_RECURSIVE_NP +); \ + +212 + `__±h»ad_mu‹x_š™ + (&( +NAME +). +mu‹x +, & +__©Œ +); \ + +213 + `__±h»ad_mu‹x©Œ_de¡roy + (& +__©Œ +); \ + +215 } 0) + + ) + +220 #ià +defšed + +_LIBC + && (!defšed +NOT_IN_libc + || defšed +IS_IN_lib±h»ad +) + +221  + #__libc_lock_fši +( +NAME +è((è0) + + ) + +223  + #__libc_lock_fši +( +NAME +) \ + +224 + `__libc_maybe_ÿÎ + ( +__±h»ad_mu‹x_de¡roy +, (&( +NAME +)), 0) + + ) + +226 #ià +defšed + +SHARED + && !defšed +NOT_IN_libc + + +227  + #__libc_rwlock_fši +( +NAME +è((è0) + + ) + +229  + #__libc_rwlock_fši +( +NAME +) \ + +230 + `__libc_maybe_ÿÎ + ( +__±h»ad_rwlock_de¡roy +, (&( +NAME +)), 0) + + ) + +234 #ià +defšed + +_LIBC + && (!defšed +NOT_IN_libc + || defšed +IS_IN_lib±h»ad +) + +235  + #__libc_lock_fši_»cursive +( +NAME +è((è0) + + ) + +237  + #__libc_lock_fši_»cursive +( +NAME +) \ + +238 + `__libc_maybe_ÿÎ + ( +__±h»ad_mu‹x_de¡roy +, (&( +NAME +)), 0) + + ) + +242 #ià +defšed + +_LIBC + && (!defšed +NOT_IN_libc + || defšed +IS_IN_lib±h»ad +) + +243 #ià +__OPTION_EGLIBC_BIG_MACROS + != 1 + +247  +__libc_lock_lock_â + ( +__libc_lock_t + *); + +248 +libc_hidd’_´Ùo + ( +__libc_lock_lock_â +); + +250 #ià +__OPTION_EGLIBC_BIG_MACROS + + +251  + #__libc_lock_lock +( +NAME +) \ + +252 ({ + `Îl_lock + ( +NAME +, +LLL_PRIVATE +); 0; }) + + ) + +254  + #__libc_lock_lock +( +NAME +) \ + +255 + `__libc_lock_lock_â + (&( +NAME +)) + + ) + +258  + #__libc_lock_lock +( +NAME +) \ + +259 + `__libc_maybe_ÿÎ + ( +__±h»ad_mu‹x_lock +, (&( +NAME +)), 0) + + ) + +261  + #__libc_rwlock_rdlock +( +NAME +) \ + +262 + `__libc_±f_ÿÎ + ( +__±h»ad_rwlock_rdlock +, (&( +NAME +)), 0) + + ) + +263  + #__libc_rwlock_w¾ock +( +NAME +) \ + +264 + `__libc_±f_ÿÎ + ( +__±h»ad_rwlock_w¾ock +, (&( +NAME +)), 0) + + ) + +267 #ià +defšed + +_LIBC + && (!defšed +NOT_IN_libc + || defšed +IS_IN_lib±h»ad +) + +268 #ià +__OPTION_EGLIBC_BIG_MACROS + != 1 + +272  +__libc_lock_lock_»cursive_â + ( +__libc_lock_»cursive_t + *); + +273 +libc_hidd’_´Ùo + ( +__libc_lock_lock_»cursive_â +); + +275 #ià +__OPTION_EGLIBC_BIG_MACROS + + +276  + #__libc_lock_lock_»cursive +( +NAME +) \ + +278 * +£lf + = +THREAD_SELF +; \ + +279 ià(( +NAME +). +owÃr + !ð +£lf +) \ + +281 + `Îl_lock + (( +NAME +). +lock +, +LLL_PRIVATE +); \ + +282 ( +NAME +). +owÃr + = +£lf +; \ + +284 ++( +NAME +). +út +; \ + +285 } 0) + + ) + +287  + #__libc_lock_lock_»cursive +( +NAME +) \ + +288 + `__libc_lock_lock_»cursive_â + (&( +NAME +)) + + ) + +291  + #__libc_lock_lock_»cursive +( +NAME +) \ + +292 + `__libc_maybe_ÿÎ + ( +__±h»ad_mu‹x_lock +, (&( +NAME +). +mu‹x +), 0) + + ) + +296 #ià +defšed + +_LIBC + && (!defšed +NOT_IN_libc + || defšed +IS_IN_lib±h»ad +) + +297 #ià +__OPTION_EGLIBC_BIG_MACROS + != 1 + +301  +__libc_lock_Œylock_â + ( +__libc_lock_t + *); + +302 +libc_hidd’_´Ùo + ( +__libc_lock_Œylock_â +); + +304 #ià +__OPTION_EGLIBC_BIG_MACROS + + +305  + #__libc_lock_Œylock +( +NAME +) \ + +306 + `Îl_Œylock + ( +NAME +) + + ) + +308  + #__libc_lock_Œylock +( +NAME +) \ + +309 + `__libc_lock_Œylock_â + (&( +NAME +)) + + ) + +312  + #__libc_lock_Œylock +( +NAME +) \ + +313 + `__libc_maybe_ÿÎ + ( +__±h»ad_mu‹x_Œylock +, (&( +NAME +)), 0) + + ) + +315  + #__libc_rwlock_Œyrdlock +( +NAME +) \ + +316 + `__libc_maybe_ÿÎ + ( +__±h»ad_rwlock_Œyrdlock +, (&( +NAME +)), 0) + + ) + +317  + #__libc_rwlock_Œyw¾ock +( +NAME +) \ + +318 + `__libc_maybe_ÿÎ + ( +__±h»ad_rwlock_Œyw¾ock +, (&( +NAME +)), 0) + + ) + +321 #ià +defšed + +_LIBC + && (!defšed +NOT_IN_libc + || defšed +IS_IN_lib±h»ad +) + +322 #ià +__OPTION_EGLIBC_BIG_MACROS + != 1 + +326  +__libc_lock_Œylock_»cursive_â + ( +__libc_lock_»cursive_t + *); + +327 +libc_hidd’_´Ùo + ( +__libc_lock_Œylock_»cursive_â +); + +329 #ià +__OPTION_EGLIBC_BIG_MACROS + + +330  + #__libc_lock_Œylock_»cursive +( +NAME +) \ + +332  +»suÉ + = 0; \ + +333 * +£lf + = +THREAD_SELF +; \ + +334 ià(( +NAME +). +owÃr + !ð +£lf +) \ + +336 ià( + `Îl_Œylock + (( +NAME +). +lock +) == 0) \ + +338 ( +NAME +). +owÃr + = +£lf +; \ + +339 ( +NAME +). +út + = 1; \ + +342 +»suÉ + = +EBUSY +; \ + +345 ++( +NAME +). +út +; \ + +346 +»suÉ +; \ + +347 }) + + ) + +349  + #__libc_lock_Œylock_»cursive +( +NAME +) \ + +350 + `__libc_lock_Œylock_»cursive_â + (&( +NAME +)) + + ) + +353  + #__libc_lock_Œylock_»cursive +( +NAME +) \ + +354 + `__libc_maybe_ÿÎ + ( +__±h»ad_mu‹x_Œylock +, (&( +NAME +)), 0) + + ) + +357  + #__¹ld_lock_Œylock_»cursive +( +NAME +) \ + +358 + `__libc_maybe_ÿÎ + ( +__±h»ad_mu‹x_Œylock +, (&( +NAME +). +mu‹x +), 0) + + ) + +361 #ià +defšed + +_LIBC + && (!defšed +NOT_IN_libc + || defšed +IS_IN_lib±h»ad +) + +362 #ià +__OPTION_EGLIBC_BIG_MACROS + != 1 + +366  +__libc_lock_uÆock_â + ( +__libc_lock_t + *); + +367 +libc_hidd’_´Ùo + ( +__libc_lock_uÆock_â +); + +369 #ià +__OPTION_EGLIBC_BIG_MACROS + + +370  + #__libc_lock_uÆock +( +NAME +) \ + +371 + `Îl_uÆock + ( +NAME +, +LLL_PRIVATE +) + + ) + +373  + #__libc_lock_uÆock +( +NAME +) \ + +374 + `__libc_lock_uÆock_â + (&( +NAME +)) + + ) + +377  + #__libc_lock_uÆock +( +NAME +) \ + +378 + `__libc_maybe_ÿÎ + ( +__±h»ad_mu‹x_uÆock +, (&( +NAME +)), 0) + + ) + +380  + #__libc_rwlock_uÆock +( +NAME +) \ + +381 + `__libc_±f_ÿÎ + ( +__±h»ad_rwlock_uÆock +, (&( +NAME +)), 0) + + ) + +384 #ià +defšed + +_LIBC + && (!defšed +NOT_IN_libc + || defšed +IS_IN_lib±h»ad +) + +385 #ià +__OPTION_EGLIBC_BIG_MACROS + != 1 + +389  +__libc_lock_uÆock_»cursive_â + ( +__libc_lock_»cursive_t + *); + +390 +libc_hidd’_´Ùo + ( +__libc_lock_uÆock_»cursive_â +); + +392 #ià +__OPTION_EGLIBC_BIG_MACROS + + +394  + #__libc_lock_uÆock_»cursive +( +NAME +) \ + +396 ià(--( +NAME +). +út + == 0) \ + +398 ( +NAME +). +owÃr + = +NULL +; \ + +399 + `Îl_uÆock + (( +NAME +). +lock +, +LLL_PRIVATE +); \ + +401 } 0) + + ) + +403  + #__libc_lock_uÆock_»cursive +( +NAME +) \ + +404 + `__libc_lock_uÆock_»cursive_â + (&( +NAME +)) + + ) + +407  + #__libc_lock_uÆock_»cursive +( +NAME +) \ + +408 + `__libc_maybe_ÿÎ + ( +__±h»ad_mu‹x_uÆock +, (&( +NAME +)), 0) + + ) + +411 #ià +defšed + +_LIBC + && defšed +SHARED + + +412  + #__¹ld_lock_deçuÉ_lock_»cursive +( +lock +) \ + +413 ++(( +±h»ad_mu‹x_t + *)( +lock +))-> +__d©a +. +__couÁ +; + + ) + +415  + #__¹ld_lock_deçuÉ_uÆock_»cursive +( +lock +) \ + +416 --(( +±h»ad_mu‹x_t + *)( +lock +))-> +__d©a +. +__couÁ +; + + ) + +418  + #__¹ld_lock_lock_»cursive +( +NAME +) \ + +419 + `GL +( +dl_¹ld_lock_»cursive +è(&( +NAME +). +mu‹x +) + + ) + +421  + #__¹ld_lock_uÆock_»cursive +( +NAME +) \ + +422 + `GL +( +dl_¹ld_uÆock_»cursive +è(&( +NAME +). +mu‹x +) + + ) + +424  + #__¹ld_lock_lock_»cursive +( +NAME +) \ + +425 + `__libc_maybe_ÿÎ + ( +__±h»ad_mu‹x_lock +, (&( +NAME +). +mu‹x +), 0) + + ) + +427  + #__¹ld_lock_uÆock_»cursive +( +NAME +) \ + +428 + `__libc_maybe_ÿÎ + ( +__±h»ad_mu‹x_uÆock +, (&( +NAME +). +mu‹x +), 0) + + ) + +432 #ià +PTHREAD_ONCE_INIT + == 0 + +435  + #__libc_Úû_defše +( +CLASS +, +NAME +) \ + +436 +CLASS + +±h»ad_Úû_t + +NAME + + + ) + +438  + #__libc_Úû_defše +( +CLASS +, +NAME +) \ + +439 +CLASS + +±h»ad_Úû_t + +NAME + = +PTHREAD_ONCE_INIT + + + ) + +443  + #__libc_Úû +( +ONCE_CONTROL +, +INIT_FUNCTION +) \ + +445 ià( + `PTFAVAIL + ( +__±h»ad_Úû +)) \ + +446 + `__libc_±f_ÿÎ_®ways + ( +__±h»ad_Úû +, (&( +ONCE_CONTROL +), \ + +447 +INIT_FUNCTION +)); \ + +448 ià(( +ONCE_CONTROL +è=ð +PTHREAD_ONCE_INIT +) { \ + +449 + `INIT_FUNCTION + (); \ + +450 ( +ONCE_CONTROL +) |= 2; \ + +452 } 0) + + ) + +459  +_±h»ad_þ—nup_push + ( +_±h»ad_þ—nup_bufãr + * +bufãr +, + +460 (* +routše +è(*), * +¬g +); + +461  + `_±h»ad_þ—nup_pÝ + ( +_±h»ad_þ—nup_bufãr + * +bufãr +, + +462  +execu‹ +); + +463  + `_±h»ad_þ—nup_push_deãr + ( +_±h»ad_þ—nup_bufãr + * +bufãr +, + +464 (* +routše +è(*), * +¬g +); + +465  + `_±h»ad_þ—nup_pÝ_»¡Üe + ( +_±h»ad_þ—nup_bufãr + * +bufãr +, + +466  +execu‹ +); + +469  + #__libc_þ—nup_»giÚ_¡¬t +( +DOIT +, +FCT +, +ARG +) \ + +470 {  +_±h»ad_þ—nup_bufãr + +_bufãr +; \ + +471  +_avaž +; \ + +472 ià( +DOIT +) { \ + +473 +_avaž + = + `PTFAVAIL + ( +_±h»ad_þ—nup_push_deãr +); \ + +474 ià( +_avaž +) { \ + +475 + `__libc_±f_ÿÎ_®ways + ( +_±h»ad_þ—nup_push_deãr +, (& +_bufãr +, +FCT +, \ + +476 +ARG +)); \ + +478 +_bufãr +. +__routše + = ( +FCT +); \ + +479 +_bufãr +. +__¬g + = ( +ARG +); \ + +482 +_avaž + = 0; \ + +483 } + + ) + +486  + #__libc_þ—nup_»giÚ_’d +( +DOIT +) \ + +487 ià( +_avaž +) { \ + +488 + `__libc_±f_ÿÎ_®ways + ( +_±h»ad_þ—nup_pÝ_»¡Üe +, (& +_bufãr +, +DOIT +));\ + +489 } ià( +DOIT +) \ + +490 +_bufãr +. + `__routše + (_bufãr. +__¬g +); \ + +491 + } + + ) +} + +494  + #__libc_þ—nup_’d +( +DOIT +) \ + +495 ià( +_avaž +) { \ + +496 + `__libc_±f_ÿÎ_®ways + ( +_±h»ad_þ—nup_pÝ_»¡Üe +, (& +_bufãr +, +DOIT +));\ + +497 } ià( +DOIT +) \ + +498 +_bufãr +. + `__routše + (_bufãr. +__¬g +) + + ) + +502 +__ex‹º_šlše +  + +503 + $__libc_þ—nup_routše + ( +__±h»ad_þ—nup_äame + * +f +) + +505 ià( +f +-> +__do_™ +) + +506 +f +-> + `__ÿnûl_routše + (f-> +__ÿnûl_¬g +); + +507 + } +} + +509  + #__libc_þ—nup_push +( +fù +, +¬g +) \ + +511  +__±h»ad_þ—nup_äame + +__þäame + \ + +512 + `__©Œibu‹__ + (( + `__þ—nup__ + ( +__libc_þ—nup_routše +))) \ + +513 ð{ . +__ÿnûl_routše + = ( +fù +), . +__ÿnûl_¬g + = ( +¬g +), \ + +514 . +__do_™ + = 1 }; + + ) + +516  + #__libc_þ—nup_pÝ +( +execu‹ +) \ + +517 +__þäame +. +__do_™ + = ( +execu‹ +); \ + +518 } 0) + + ) + +522  + #__libc_key_ü—‹ +( +KEY +, +DESTRUCTOR +) \ + +523 + `__libc_±f_ÿÎ + ( +__±h»ad_key_ü—‹ +, ( +KEY +, +DESTRUCTOR +), 1) + + ) + +526  + #__libc_g‘¥ecific +( +KEY +) \ + +527 + `__libc_±f_ÿÎ + ( +__±h»ad_g‘¥ecific +, ( +KEY +), +NULL +) + + ) + +530  + #__libc_£t¥ecific +( +KEY +, +VALUE +) \ + +531 + `__libc_±f_ÿÎ + ( +__±h»ad_£t¥ecific +, ( +KEY +, +VALUE +), 0) + + ) + +537  + #__libc_©fÜk +( +PREPARE +, +PARENT +, +CHILD +) \ + +538 + `__»gi¡”_©fÜk + ( +PREPARE +, +PARENT +, +CHILD +, +NULL +) + + ) + +539  +__»gi¡”_©fÜk + ((* +__´•¬e +) (), + +540 (* +__·»Á +) (), + +541 (* +__chžd +) (), + +542 * +__dso_hªdË +); + +547  + `__±h»ad_mu‹x_š™ + ( +±h»ad_mu‹x_t + * +__mu‹x +, + +548 +__cÚ¡ + +±h»ad_mu‹x©Œ_t + * +__mu‹x_©Œ +); + +550  + `__±h»ad_mu‹x_de¡roy + ( +±h»ad_mu‹x_t + * +__mu‹x +); + +552  + `__±h»ad_mu‹x_Œylock + ( +±h»ad_mu‹x_t + * +__mu‹x +); + +554  + `__±h»ad_mu‹x_lock + ( +±h»ad_mu‹x_t + * +__mu‹x +); + +556  + `__±h»ad_mu‹x_uÆock + ( +±h»ad_mu‹x_t + * +__mu‹x +); + +558  + `__±h»ad_mu‹x©Œ_š™ + ( +±h»ad_mu‹x©Œ_t + * +__©Œ +); + +560  + `__±h»ad_mu‹x©Œ_de¡roy + ( +±h»ad_mu‹x©Œ_t + * +__©Œ +); + +562  + `__±h»ad_mu‹x©Œ_£‰y³ + ( +±h»ad_mu‹x©Œ_t + * +__©Œ +, + +563  +__kšd +); + +565 #ifdeà +__USE_UNIX98 + + +566  + `__±h»ad_rwlock_š™ + ( +±h»ad_rwlock_t + * +__rwlock +, + +567 +__cÚ¡ + +±h»ad_rwlock©Œ_t + * +__©Œ +); + +569  + `__±h»ad_rwlock_de¡roy + ( +±h»ad_rwlock_t + * +__rwlock +); + +571  + `__±h»ad_rwlock_rdlock + ( +±h»ad_rwlock_t + * +__rwlock +); + +573  + `__±h»ad_rwlock_Œyrdlock + ( +±h»ad_rwlock_t + * +__rwlock +); + +575  + `__±h»ad_rwlock_w¾ock + ( +±h»ad_rwlock_t + * +__rwlock +); + +577  + `__±h»ad_rwlock_Œyw¾ock + ( +±h»ad_rwlock_t + * +__rwlock +); + +579  + `__±h»ad_rwlock_uÆock + ( +±h»ad_rwlock_t + * +__rwlock +); + +582  + `__±h»ad_key_ü—‹ + ( +±h»ad_key_t + * +__key +, + +583 (* +__de¡r_funùiÚ +) (*)); + +585  + `__±h»ad_£t¥ecific + ( +±h»ad_key_t + +__key +, + +586 +__cÚ¡ + * +__poš‹r +); + +588 * + `__±h»ad_g‘¥ecific + ( +±h»ad_key_t + +__key +); + +590  + `__±h»ad_Úû + ( +±h»ad_Úû_t + * +__Úû_cÚŒÞ +, + +591 (* +__š™_routše +) ()); + +593  + `__±h»ad_©fÜk + ((* +__´•¬e +) (), + +594 (* +__·»Á +) (), + +595 (* +__chžd +) ()); + +601 #iâdeà +__NO_WEAK_PTHREAD_ALIASES + + +602 #ifdeà +w—k_ex‹º + + +603 #ià +_LIBC + + +604  + ~ + +606  + #BP_SYM +( +sym +è + ) +sym + +608 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_mu‹x_š™ +)) + +609 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_mu‹x_de¡roy +)) + +610 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_mu‹x_lock +)) + +611 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_mu‹x_Œylock +)) + +612 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_mu‹x_uÆock +)) + +613 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_mu‹x©Œ_š™ +)) + +614 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_mu‹x©Œ_de¡roy +)) + +615 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_mu‹x©Œ_£‰y³ +)) + +616 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_rwlock_š™ +)) + +617 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_rwlock_de¡roy +)) + +618 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_rwlock_rdlock +)) + +619 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_rwlock_Œyrdlock +)) + +620 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_rwlock_w¾ock +)) + +621 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_rwlock_Œyw¾ock +)) + +622 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_rwlock_uÆock +)) + +623 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_key_ü—‹ +)) + +624 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_£t¥ecific +)) + +625 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_g‘¥ecific +)) + +626 + `w—k_ex‹º + ( + $BP_SYM + ( +__±h»ad_Úû +)) + +627 + $w—k_ex‹º + ( +__±h»ad_š™Ÿlize +) + +628 + $w—k_ex‹º + ( +__±h»ad_©fÜk +) + +629 + `w—k_ex‹º + ( + $BP_SYM + ( +_±h»ad_þ—nup_push_deãr +)) + +630 + `w—k_ex‹º + ( + $BP_SYM + ( +_±h»ad_þ—nup_pÝ_»¡Üe +)) + +631 + `w—k_ex‹º + ( + $BP_SYM + ( +±h»ad_£tÿnûl¡©e +)) + +633 #´agm¨ +w—k + +__±h»ad_mu‹x_š™ + + +634 #´agm¨ +w—k + +__±h»ad_mu‹x_de¡roy + + +635 #´agm¨ +w—k + +__±h»ad_mu‹x_lock + + +636 #´agm¨ +w—k + +__±h»ad_mu‹x_Œylock + + +637 #´agm¨ +w—k + +__±h»ad_mu‹x_uÆock + + +638 #´agm¨ +w—k + +__±h»ad_mu‹x©Œ_š™ + + +639 #´agm¨ +w—k + +__±h»ad_mu‹x©Œ_de¡roy + + +640 #´agm¨ +w—k + +__±h»ad_mu‹x©Œ_£‰y³ + + +641 #´agm¨ +w—k + +__±h»ad_rwlock_de¡roy + + +642 #´agm¨ +w—k + +__±h»ad_rwlock_rdlock + + +643 #´agm¨ +w—k + +__±h»ad_rwlock_Œyrdlock + + +644 #´agm¨ +w—k + +__±h»ad_rwlock_w¾ock + + +645 #´agm¨ +w—k + +__±h»ad_rwlock_Œyw¾ock + + +646 #´agm¨ +w—k + +__±h»ad_rwlock_uÆock + + +647 #´agm¨ +w—k + +__±h»ad_key_ü—‹ + + +648 #´agm¨ +w—k + +__±h»ad_£t¥ecific + + +649 #´agm¨ +w—k + +__±h»ad_g‘¥ecific + + +650 #´agm¨ +w—k + +__±h»ad_Úû + + +651 #´agm¨ +w—k + +__±h»ad_š™Ÿlize + + +652 #´agm¨ +w—k + +__±h»ad_©fÜk + + +653 #´agm¨ +w—k + +_±h»ad_þ—nup_push_deãr + + +654 #´agm¨ +w—k + +_±h»ad_þ—nup_pÝ_»¡Üe + + +655 #´agm¨ +w—k + +±h»ad_£tÿnûl¡©e + + + @/usr/include/bits/stdlib-ldbl.h + +20 #iâdeà +_STDLIB_H + + +24 #ifdef +__USE_ISOC99 + + +25 +__BEGIN_NAMESPACE_C99 + + +26 + $__LDBL_REDIR1_DECL + ( +¡¹Þd +, +¡¹od +) + +27 +__END_NAMESPACE_C99 + + +30 #ifdeà +__USE_GNU + + +31 + $__LDBL_REDIR1_DECL + ( +¡¹Þd_l +, +¡¹od_l +) + +34 #ià +defšed + +__USE_SVID + || defšed +__USE_XOPEN_EXTENDED + + +35 #ifdeà +__USE_MISC + + +36 + $__LDBL_REDIR1_DECL + ( +qecvt +, +ecvt +) + +37 + $__LDBL_REDIR1_DECL + ( +qfcvt +, +fcvt +) + +38 + $__LDBL_REDIR1_DECL + ( +qgcvt +, +gcvt +) + +39 + $__LDBL_REDIR1_DECL + ( +qecvt_r +, +ecvt_r +) + +40 + $__LDBL_REDIR1_DECL + ( +qfcvt_r +, +fcvt_r +) + + @/usr/include/bits/stdlib.h + +20 #iâdeà +_STDLIB_H + + +24 * + $__»®·th_chk + ( +__cÚ¡ + * +__»¡riù + +__Çme +, + +25 * +__»¡riù + +__»sÞved +, + +26 +size_t + +__»sÞvedËn +è +__THROW + +__wur +; + +27 * + `__REDIRECT_NTH + ( +__»®·th_®Ÿs +, + +28 ( +__cÚ¡ + * +__»¡riù + +__Çme +, + +29 * +__»¡riù + +__»sÞved +), +»®·th +è +__wur +; + +30 * + `__REDIRECT_NTH + ( +__»®·th_chk_w¬n +, + +31 ( +__cÚ¡ + * +__»¡riù + +__Çme +, + +32 * +__»¡riù + +__»sÞved +, + +33 +size_t + +__»sÞvedËn +), +__»®·th_chk +è +__wur + + +34 + `__w¬Ç‰r + ("second‡rgument of„ealpath must beƒither NULL or‡t " + +37 +__ex‹º_®ways_šlše + +__wur + * + +38 + `__NTH + ( + $»®·th + ( +__cÚ¡ + * +__»¡riù + +__Çme +, *__»¡riù +__»sÞved +)) + +40 ià( + `__bos + ( +__»sÞved +è!ð( +size_t +) -1) + +42 #ià +defšed + +_LIBC_LIMITS_H_ + && defšed +PATH_MAX + + +43 ià( + `__bos + ( +__»sÞved +è< +PATH_MAX +) + +44  + `__»®·th_chk_w¬n + ( +__Çme +, +__»sÞved +, + `__bos + (__resolved)); + +46  + `__»®·th_chk + ( +__Çme +, +__»sÞved +, + `__bos + (__resolved)); + +49  + `__»®·th_®Ÿs + ( +__Çme +, +__»sÞved +); + +50 + } +} + +53  + $__±¢ame_r_chk + ( +__fd +, * +__buf +, +size_t + +__buæ’ +, + +54 +size_t + +__Ä—l +è +__THROW + + `__nÚnuÎ + ((2)); + +55  + `__REDIRECT_NTH + ( +__±¢ame_r_®Ÿs +, ( +__fd +, * +__buf +, + +56 +size_t + +__buæ’ +), +±¢ame_r +) + +57 + `__nÚnuÎ + ((2)); + +58  + `__REDIRECT_NTH + ( +__±¢ame_r_chk_w¬n +, + +59 ( +__fd +, * +__buf +, +size_t + +__buæ’ +, + +60 +size_t + +__Ä—l +), +__±¢ame_r_chk +) + +61 + `__nÚnuÎ + ((2)è + `__w¬Ç‰r + ("ptsname_r called with buflen biggerhan " + +64 +__ex‹º_®ways_šlše +  + +65 + `__NTH + ( + $±¢ame_r + ( +__fd +, * +__buf +, +size_t + +__buæ’ +)) + +67 ià( + `__bos + ( +__buf +è!ð( +size_t +) -1) + +69 ià(! + `__bužtš_cÚ¡ªt_p + ( +__buæ’ +)) + +70  + `__±¢ame_r_chk + ( +__fd +, +__buf +, +__buæ’ +, + `__bos + (__buf)); + +71 ià( +__buæ’ + > + `__bos + ( +__buf +)) + +72  + `__±¢ame_r_chk_w¬n + ( +__fd +, +__buf +, +__buæ’ +, + `__bos + (__buf)); + +74  + `__±¢ame_r_®Ÿs + ( +__fd +, +__buf +, +__buæ’ +); + +75 + } +} + +78  + $__wùomb_chk + (* +__s +, +wch¬_t + +__wch¬ +, +size_t + +__buæ’ +) + +79 +__THROW + +__wur +; + +80  + `__REDIRECT_NTH + ( +__wùomb_®Ÿs +, (* +__s +, +wch¬_t + +__wch¬ +), + +81 +wùomb +è +__wur +; + +83 +__ex‹º_®ways_šlše + +__wur +  + +84 + `__NTH + ( + $wùomb + (* +__s +, +wch¬_t + +__wch¬ +)) + +89  + #__STDLIB_MB_LEN_MAX + 16 + + ) + +90 #ià +defšed + +MB_LEN_MAX + && MB_LEN_MAX !ð +__STDLIB_MB_LEN_MAX + + +93 ià( + `__bos + ( +__s +è!ð( +size_t +è-1 && +__STDLIB_MB_LEN_MAX + > __bos (__s)) + +94  + `__wùomb_chk + ( +__s +, +__wch¬ +, + `__bos + (__s)); + +95  + `__wùomb_®Ÿs + ( +__s +, +__wch¬ +); + +96 + } +} + +99 +size_t + + $__mb¡owcs_chk + ( +wch¬_t + * +__»¡riù + +__d¡ +, + +100 +__cÚ¡ + * +__»¡riù + +__¤c +, + +101 +size_t + +__Ën +, size_ˆ +__d¡Ën +è +__THROW +; + +102 +size_t + + `__REDIRECT_NTH + ( +__mb¡owcs_®Ÿs +, + +103 ( +wch¬_t + * +__»¡riù + +__d¡ +, + +104 +__cÚ¡ + * +__»¡riù + +__¤c +, + +105 +size_t + +__Ën +), +mb¡owcs +); + +106 +size_t + + `__REDIRECT_NTH + ( +__mb¡owcs_chk_w¬n +, + +107 ( +wch¬_t + * +__»¡riù + +__d¡ +, + +108 +__cÚ¡ + * +__»¡riù + +__¤c +, + +109 +size_t + +__Ën +, size_ˆ +__d¡Ën +), +__mb¡owcs_chk +) + +110 + `__w¬Ç‰r + ("mbstowcs called with dst buffer smallerhan†en " + +113 +__ex‹º_®ways_šlše + +size_t + + +114 + `__NTH + ( + $mb¡owcs + ( +wch¬_t + * +__»¡riù + +__d¡ +, +__cÚ¡ + *__»¡riù +__¤c +, + +115 +size_t + +__Ën +)) + +117 ià( + `__bos + ( +__d¡ +è!ð( +size_t +) -1) + +119 ià(! + `__bužtš_cÚ¡ªt_p + ( +__Ën +)) + +120  + `__mb¡owcs_chk + ( +__d¡ +, +__¤c +, +__Ën +, + +121 + `__bos + ( +__d¡ +è/  ( +wch¬_t +)); + +123 ià( +__Ën + > + `__bos + ( +__d¡ +è/  ( +wch¬_t +)) + +124  + `__mb¡owcs_chk_w¬n + ( +__d¡ +, +__¤c +, +__Ën +, + +125 + `__bos + ( +__d¡ +è/  ( +wch¬_t +)); + +127  + `__mb¡owcs_®Ÿs + ( +__d¡ +, +__¤c +, +__Ën +); + +128 + } +} + +131 +size_t + + $__wc¡ombs_chk + (* +__»¡riù + +__d¡ +, + +132 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, + +133 +size_t + +__Ën +, size_ˆ +__d¡Ën +è +__THROW +; + +134 +size_t + + `__REDIRECT_NTH + ( +__wc¡ombs_®Ÿs +, + +135 (* +__»¡riù + +__d¡ +, + +136 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, + +137 +size_t + +__Ën +), +wc¡ombs +); + +138 +size_t + + `__REDIRECT_NTH + ( +__wc¡ombs_chk_w¬n +, + +139 (* +__»¡riù + +__d¡ +, + +140 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, + +141 +size_t + +__Ën +, size_ˆ +__d¡Ën +), +__wc¡ombs_chk +) + +142 + `__w¬Ç‰r + ("wcstombs called with dst buffer smallerhan†en"); + +144 +__ex‹º_®ways_šlše + +size_t + + +145 + `__NTH + ( + $wc¡ombs + (* +__»¡riù + +__d¡ +, +__cÚ¡ + +wch¬_t + *__»¡riù +__¤c +, + +146 +size_t + +__Ën +)) + +148 ià( + `__bos + ( +__d¡ +è!ð( +size_t +) -1) + +150 ià(! + `__bužtš_cÚ¡ªt_p + ( +__Ën +)) + +151  + `__wc¡ombs_chk + ( +__d¡ +, +__¤c +, +__Ën +, + `__bos + (__dst)); + +152 ià( +__Ën + > + `__bos + ( +__d¡ +)) + +153  + `__wc¡ombs_chk_w¬n + ( +__d¡ +, +__¤c +, +__Ën +, + `__bos + (__dst)); + +155  + `__wc¡ombs_®Ÿs + ( +__d¡ +, +__¤c +, +__Ën +); + +156 + } +} + + @/usr/include/bits/waitflags.h + +20 #ià! +defšed + +_SYS_WAIT_H + && !defšed +_STDLIB_H + + +26  + #WNOHANG + 1 + + ) + +27  + #WUNTRACED + 2 + + ) + +30  + #WSTOPPED + 2 + + ) + +31  + #WEXITED + 4 + + ) + +32  + #WCONTINUED + 8 + + ) + +33  + #WNOWAIT + 0x01000000 + + ) + +35  + #__WNOTHREAD + 0x20000000 + + ) + +37  + #__WALL + 0x40000000 + + ) + +38  + #__WCLONE + 0x80000000 + + ) + + @/usr/include/bits/waitstatus.h + +20 #ià! +defšed + +_SYS_WAIT_H + && !defšed +_STDLIB_H + + +29  + #__WEXITSTATUS +( +¡©us +è(((¡©usè& 0xff00è>> 8) + + ) + +32  + #__WTERMSIG +( +¡©us +è((¡©usè& 0x7f) + + ) + +35  + #__WSTOPSIG +( +¡©us +è + `__WEXITSTATUS +(¡©us) + + ) + +38  + #__WIFEXITED +( +¡©us +è( + `__WTERMSIG +(¡©usè=ð0) + + ) + +41  + #__WIFSIGNALED +( +¡©us +) \ + +42 (((sigÃd è((( +¡©us +è& 0x7fè+ 1è>> 1è> 0) + + ) + +45  + #__WIFSTOPPED +( +¡©us +è(((¡©usè& 0xffè=ð0x7f) + + ) + +49 #ifdeà +WCONTINUED + + +50  + #__WIFCONTINUED +( +¡©us +è((¡©usè=ð +__W_CONTINUED +) + + ) + +54  + #__WCOREDUMP +( +¡©us +è((¡©usè& +__WCOREFLAG +) + + ) + +57  + #__W_EXITCODE +( +»t +, +sig +è(Ô‘è<< 8 | (sig)) + + ) + +58  + #__W_STOPCODE +( +sig +è((sigè<< 8 | 0x7f) + + ) + +59  + #__W_CONTINUED + 0xffff + + ) + +60  + #__WCOREFLAG + 0x80 + + ) + +63 #ifdef +__USE_BSD + + +65  + ~<’dŸn.h +> + +67  + uwa™ + + +69  + mw_¡©us +; + +72 #if +__BYTE_ORDER + =ð +__LITTLE_ENDIAN + + +73  + m__w_‹rmsig +:7; + +74  + m__w_cÜedump +:1; + +75  + m__w_»tcode +:8; + +78 #if +__BYTE_ORDER + =ð +__BIG_ENDIAN + + +80  + m__w_»tcode +:8; + +81  + m__w_cÜedump +:1; + +82  + m__w_‹rmsig +:7; + +84 } + m__wa™_‹rmš©ed +; + +87 #if +__BYTE_ORDER + =ð +__LITTLE_ENDIAN + + +88  + m__w_¡Ýv® +:8; + +89  + m__w_¡Ýsig +:8; + +92 #if +__BYTE_ORDER + =ð +__BIG_ENDIAN + + +94  + m__w_¡Ýsig +:8; + +95  + m__w_¡Ýv® +:8; + +97 } + m__wa™_¡Ý³d +; + +100  + #w_‹rmsig + +__wa™_‹rmš©ed +. +__w_‹rmsig + + + ) + +101  + #w_cÜedump + +__wa™_‹rmš©ed +. +__w_cÜedump + + + ) + +102  + #w_»tcode + +__wa™_‹rmš©ed +. +__w_»tcode + + + ) + +103  + #w_¡Ýsig + +__wa™_¡Ý³d +. +__w_¡Ýsig + + + ) + +104  + #w_¡Ýv® + +__wa™_¡Ý³d +. +__w_¡Ýv® + + + ) + + @/usr/include/gconv.h + +23 #iâdeà +_GCONV_H + + +24  + #_GCONV_H + 1 + + ) + +26  + ~<ã©u»s.h +> + +27  + #__Ãed_mb¡©e_t + + + ) + +28  + #__Ãed_wšt_t + + + ) + +29  + ~ + +30  + #__Ãed_size_t + + + ) + +31  + #__Ãed_wch¬_t + + + ) + +32  + ~<¡ddef.h +> + +35  + #__UNKNOWN_10646_CHAR + (( +wch¬_t +è0xfffd) + + ) + +40 + m__GCONV_OK + = 0, + +41 + m__GCONV_NOCONV +, + +42 + m__GCONV_NODB +, + +43 + m__GCONV_NOMEM +, + +45 + m__GCONV_EMPTY_INPUT +, + +46 + m__GCONV_FULL_OUTPUT +, + +47 + m__GCONV_ILLEGAL_INPUT +, + +48 + m__GCONV_INCOMPLETE_INPUT +, + +50 + m__GCONV_ILLEGAL_DESCRIPTOR +, + +51 + m__GCONV_INTERNAL_ERROR + + +58 + m__GCONV_IS_LAST + = 0x0001, + +59 + m__GCONV_IGNORE_ERRORS + = 0x0002 + +64  + g__gcÚv_¡• +; + +65  + g__gcÚv_¡•_d©a +; + +66  + g__gcÚv_lßded_objeù +; + +67  + g__gcÚv_Œªs_d©a +; + +71 (* + t__gcÚv_fù +è( + t__gcÚv_¡• + *,  + t__gcÚv_¡•_d©a + *, + +72 + t__cÚ¡ + **, __const *, + +73 **, + tsize_t + *, , ); + +76  + $wšt_t + (* + t__gcÚv_btowc_fù +è( + t__gcÚv_¡• + *, ); + +79 (* + t__gcÚv_š™_fù +è( + t__gcÚv_¡• + *); + +80 (* + t__gcÚv_’d_fù +è( + t__gcÚv_¡• + *); + +84 (* + t__gcÚv_Œªs_fù +è( + t__gcÚv_¡• + *, + +85  + t__gcÚv_¡•_d©a + *, *, + +86 + t__cÚ¡ + *, + +87 + t__cÚ¡ + **, + +88 + t__cÚ¡ + *, **, + +89 + tsize_t + *); + +92 (* + t__gcÚv_Œªs_cÚ‹xt_fù +è(*, + t__cÚ¡ + *, + +93 + t__cÚ¡ + *, + +97 (* + t__gcÚv_Œªs_qu”y_fù +è( + t__cÚ¡ + *, __const ***, + +98 + tsize_t + *); + +101 (* + t__gcÚv_Œªs_š™_fù +) (**, const *); + +102 (* + t__gcÚv_Œªs_’d_fù +) (*); + +104  + s__gcÚv_Œªs_d©a + + +107 +__gcÚv_Œªs_fù + +__Œªs_fù +; + +108 +__gcÚv_Œªs_cÚ‹xt_fù + +__Œªs_cÚ‹xt_fù +; + +109 +__gcÚv_Œªs_’d_fù + +__Œªs_’d_fù +; + +110 * +__d©a +; + +111  +__gcÚv_Œªs_d©a + * +__Ãxt +; + +116  + s__gcÚv_¡• + + +118  +__gcÚv_lßded_objeù + * +__shlib_hªdË +; + +119 +__cÚ¡ + * +__modÇme +; + +121  +__couÁ” +; + +123 * +__äom_Çme +; + +124 * +__to_Çme +; + +126 +__gcÚv_fù + +__fù +; + +127 +__gcÚv_btowc_fù + +__btowc_fù +; + +128 +__gcÚv_š™_fù + +__š™_fù +; + +129 +__gcÚv_’d_fù + +__’d_fù +; + +133  +__mš_Ãeded_äom +; + +134  +__max_Ãeded_äom +; + +135  +__mš_Ãeded_to +; + +136  +__max_Ãeded_to +; + +139  +__¡©eful +; + +141 * +__d©a +; + +146  + s__gcÚv_¡•_d©a + + +148 * +__outbuf +; + +149 * +__outbuãnd +; + +153  +__æags +; + +157  +__švoÿtiÚ_couÁ” +; + +161  +__š‹º®_u£ +; + +163 +__mb¡©e_t + * +__¡©• +; + +164 +__mb¡©e_t + +__¡©e +; + +168  +__gcÚv_Œªs_d©a + * +__Œªs +; + +173  + s__gcÚv_šfo + + +175 +size_t + +__n¡•s +; + +176  +__gcÚv_¡• + * +__¡•s +; + +177 +__ex‹nsiÚ__ +  +__gcÚv_¡•_d©a + +__d©a + +__æex¬r +; + +178 } * + t__gcÚv_t +; + + @/usr/include/gnu/stubs-32.h + +6 #ifdeà +_LIBC + + +7 #”rÜ +AµliÿtiÚs + +may + +nÙ + +defše + +the + +maüo + +_LIBC + + +10  + #__¡ub___k”Ãl_co¦ + + + ) + +11  + #__¡ub___k”Ãl_sšl + + + ) + +12  + #__¡ub___k”Ãl_Æ + + + ) + +13  + #__¡ub_chæags + + + ) + +14  + #__¡ub_ç‰ach + + + ) + +15  + #__¡ub_fchæags + + + ) + +16  + #__¡ub_fd‘ach + + + ) + +17  + #__¡ub_g‰y + + + ) + +18  + #__¡ub_lchmod + + + ) + +19  + #__¡ub_»voke + + + ) + +20  + #__¡ub_£Žogš + + + ) + +21  + #__¡ub_sig»tuº + + + ) + +22  + #__¡ub_s¡k + + + ) + +23  + #__¡ub_¡ty + + + ) + + @/usr/include/gnu/stubs-64.h + +6 #ifdeà +_LIBC + + +7 #”rÜ +AµliÿtiÚs + +may + +nÙ + +defše + +the + +maüo + +_LIBC + + +10  + #__¡ub_bdæush + + + ) + +11  + #__¡ub_chæags + + + ) + +12  + #__¡ub_ç‰ach + + + ) + +13  + #__¡ub_fchæags + + + ) + +14  + #__¡ub_fd‘ach + + + ) + +15  + #__¡ub_g‘msg + + + ) + +16  + #__¡ub_g‰y + + + ) + +17  + #__¡ub_lchmod + + + ) + +18  + #__¡ub_putmsg + + + ) + +19  + #__¡ub_»voke + + + ) + +20  + #__¡ub_£Žogš + + + ) + +21  + #__¡ub_sig»tuº + + + ) + +22  + #__¡ub_s¡k + + + ) + +23  + #__¡ub_¡ty + + + ) + + @/usr/include/sys/types.h + +24 #iâdef +_SYS_TYPES_H + + +25  + #_SYS_TYPES_H + 1 + + ) + +27  + ~<ã©u»s.h +> + +29 + g__BEGIN_DECLS + + +31  + ~ + +33 #ifdef +__USE_BSD + + +34 #iâdeà +__u_ch¬_defšed + + +35  +__u_ch¬ + + tu_ch¬ +; + +36  +__u_shÜt + + tu_shÜt +; + +37  +__u_št + + tu_št +; + +38  +__u_lÚg + + tu_lÚg +; + +39  +__quad_t + + tquad_t +; + +40  +__u_quad_t + + tu_quad_t +; + +41  +__fsid_t + + tfsid_t +; + +42  + #__u_ch¬_defšed + + + ) + +46  +__loff_t + + tloff_t +; + +48 #iâdeà +__šo_t_defšed + + +49 #iâdeà +__USE_FILE_OFFSET64 + + +50  +__šo_t + + tšo_t +; + +52  +__šo64_t + + tšo_t +; + +54  + #__šo_t_defšed + + + ) + +56 #ià +defšed + +__USE_LARGEFILE64 + && !defšed +__šo64_t_defšed + + +57  +__šo64_t + + tšo64_t +; + +58  + #__šo64_t_defšed + + + ) + +61 #iâdeà +__dev_t_defšed + + +62  +__dev_t + + tdev_t +; + +63  + #__dev_t_defšed + + + ) + +66 #iâdeà +__gid_t_defšed + + +67  +__gid_t + + tgid_t +; + +68  + #__gid_t_defšed + + + ) + +71 #iâdeà +__mode_t_defšed + + +72  +__mode_t + + tmode_t +; + +73  + #__mode_t_defšed + + + ) + +76 #iâdeà +__Æšk_t_defšed + + +77  +__Æšk_t + + tÆšk_t +; + +78  + #__Æšk_t_defšed + + + ) + +81 #iâdeà +__uid_t_defšed + + +82  +__uid_t + + tuid_t +; + +83  + #__uid_t_defšed + + + ) + +86 #iâdeà +__off_t_defšed + + +87 #iâdeà +__USE_FILE_OFFSET64 + + +88  +__off_t + + toff_t +; + +90  +__off64_t + + toff_t +; + +92  + #__off_t_defšed + + + ) + +94 #ià +defšed + +__USE_LARGEFILE64 + && !defšed +__off64_t_defšed + + +95  +__off64_t + + toff64_t +; + +96  + #__off64_t_defšed + + + ) + +99 #iâdeà +__pid_t_defšed + + +100  +__pid_t + + tpid_t +; + +101  + #__pid_t_defšed + + + ) + +104 #ià( +defšed + +__USE_SVID + || defšed +__USE_XOPEN +è&& !defšed +__id_t_defšed + + +105  +__id_t + + tid_t +; + +106  + #__id_t_defšed + + + ) + +109 #iâdeà +__ssize_t_defšed + + +110  +__ssize_t + + tssize_t +; + +111  + #__ssize_t_defšed + + + ) + +114 #ifdef +__USE_BSD + + +115 #iâdeà +__daddr_t_defšed + + +116  +__daddr_t + + tdaddr_t +; + +117  +__ÿddr_t + + tÿddr_t +; + +118  + #__daddr_t_defšed + + + ) + +122 #ià( +defšed + +__USE_SVID + || defšed +__USE_XOPEN +è&& !defšed +__key_t_defšed + + +123  +__key_t + + tkey_t +; + +124  + #__key_t_defšed + + + ) + +127 #ifdeà +__USE_XOPEN + + +128  + #__Ãed_þock_t + + + ) + +130  + #__Ãed_time_t + + + ) + +131  + #__Ãed_tim”_t + + + ) + +132  + #__Ãed_þockid_t + + + ) + +133  + ~ + +135 #ifdeà +__USE_XOPEN + + +136 #iâdeà +__u£cÚds_t_defšed + + +137  +__u£cÚds_t + + tu£cÚds_t +; + +138  + #__u£cÚds_t_defšed + + + ) + +140 #iâdeà +__su£cÚds_t_defšed + + +141  +__su£cÚds_t + + tsu£cÚds_t +; + +142  + #__su£cÚds_t_defšed + + + ) + +146  + #__Ãed_size_t + + + ) + +147  + ~<¡ddef.h +> + +149 #ifdeà +__USE_MISC + + +151  + tulÚg +; + +152  + tushÜt +; + +153  + tušt +; + +158 #ià! +__GNUC_PREREQ + (2, 7) + +161 #iâdeà +__št8_t_defšed + + +162  + #__št8_t_defšed + + + ) + +163  + tšt8_t +; + +164  + tšt16_t +; + +165  + tšt32_t +; + +166 #ià +__WORDSIZE + == 64 + +167  + tšt64_t +; + +168 #–ià +__GLIBC_HAVE_LONG_LONG + + +169 +__ex‹nsiÚ__ +  + tšt64_t +; + +174  + tu_št8_t +; + +175  + tu_št16_t +; + +176  + tu_št32_t +; + +177 #ià +__WORDSIZE + == 64 + +178  + tu_št64_t +; + +179 #–ià +__GLIBC_HAVE_LONG_LONG + + +180 +__ex‹nsiÚ__ +  + tu_št64_t +; + +183  + t»gi¡”_t +; + +188  + #__štN_t +( +N +, +MODE +) \ + +189 ## + tN +## + t_t + + t__©Œibu‹__ + (( + t__mode__ + ( + tMODE +))) + + ) + +190  + t__u_štN_t +( + tN +, + tMODE +) \ + +191  + tu_št +## + tN +## + t_t + + t__©Œibu‹__ + (( + t__mode__ + ( + tMODE +))) + + ) + +193 #iâdeà + t__št8_t_defšed + + +194  + t__št8_t_defšed + + + ) + +195 + t__štN_t + (8, + t__QI__ +); + +196 +__štN_t + (16, +__HI__ +); + +197 +__štN_t + (32, +__SI__ +); + +198 +__štN_t + (64, +__DI__ +); + +201 +__u_štN_t + (8, +__QI__ +); + +202 +__u_štN_t + (16, +__HI__ +); + +203 +__u_štN_t + (32, +__SI__ +); + +204 +__u_štN_t + (64, +__DI__ +); + +206  + t»gi¡”_t + + t__©Œibu‹__ + (( + t__mode__ + ( + t__wÜd__ +))); + +212  + #__BIT_TYPES_DEFINED__ + 1 + + ) + +215 #ifdef +__USE_BSD + + +217  + ~<’dŸn.h +> + +220  + ~ + +223  + ~ + +227 #ià +defšed + +__USE_UNIX98 + && !defšed +__blksize_t_defšed + + +228  +__blksize_t + + tblksize_t +; + +229  + #__blksize_t_defšed + + + ) + +233 #iâdeà +__USE_FILE_OFFSET64 + + +234 #iâdeà +__blkút_t_defšed + + +235  +__blkút_t + + tblkút_t +; + +236  + #__blkút_t_defšed + + + ) + +238 #iâdeà +__fsblkút_t_defšed + + +239  +__fsblkút_t + + tfsblkút_t +; + +240  + #__fsblkút_t_defšed + + + ) + +242 #iâdeà +__fsfžút_t_defšed + + +243  +__fsfžút_t + + tfsfžút_t +; + +244  + #__fsfžút_t_defšed + + + ) + +247 #iâdeà +__blkút_t_defšed + + +248  +__blkút64_t + + tblkút_t +; + +249  + #__blkút_t_defšed + + + ) + +251 #iâdeà +__fsblkút_t_defšed + + +252  +__fsblkút64_t + + tfsblkút_t +; + +253  + #__fsblkút_t_defšed + + + ) + +255 #iâdeà +__fsfžút_t_defšed + + +256  +__fsfžút64_t + + tfsfžút_t +; + +257  + #__fsfžút_t_defšed + + + ) + +261 #ifdeà +__USE_LARGEFILE64 + + +262  +__blkút64_t + + tblkút64_t +; + +263  +__fsblkút64_t + + tfsblkút64_t +; + +264  +__fsfžút64_t + + tfsfžút64_t +; + +269 #ià +defšed + +__USE_POSIX199506 + || defšed +__USE_UNIX98 + + +270  + ~ + +273 + g__END_DECLS + + + @/usr/include/wchar.h + +24 #iâdeà +_WCHAR_H + + +26 #ià! +defšed + +__Ãed_mb¡©e_t + && !defšed +__Ãed_wšt_t + + +27  + #_WCHAR_H + 1 + + ) + +28  + ~<ã©u»s.h +> + +31 #ifdeà +_WCHAR_H + + +33  + #__Ãed___FILE + + + ) + +34 #ià +defšed + +__USE_UNIX98 + || defšed +__USE_XOPEN2K + + +35  + #__Ãed_FILE + + + ) + +37  + ~<¡dio.h +> + +39  + #__Ãed___va_li¡ + + + ) + +40  + ~<¡d¬g.h +> + +42  + ~ + +45  + #__Ãed_size_t + + + ) + +46  + #__Ãed_wch¬_t + + + ) + +47  + #__Ãed_NULL + + + ) + +49 #ià +defšed + +_WCHAR_H + || defšed +__Ãed_wšt_t + || !defšed +__WINT_TYPE__ + + +50 #undeà +__Ãed_wšt_t + + +51  + #__Ãed_wšt_t + + + ) + +52  + ~<¡ddef.h +> + +55 #ià +defšed + +__ýlu¥lus + && +__GNUC_PREREQ + (4, 4) + +56  + #__CORRECT_ISO_CPP_WCHAR_H_PROTO + + + ) + +61 #iâdeà +_WINT_T + + +66  + #_WINT_T + + + ) + +67  + twšt_t +; + +71 #ià +defšed + +__ýlu¥lus + && defšed +_GLIBCPP_USE_NAMESPACES + \ + +72 && +defšed + +__WINT_TYPE__ + + +73 +__BEGIN_NAMESPACE_STD + + +74  +__WINT_TYPE__ + + twšt_t +; + +75 + g__END_NAMESPACE_STD + + +80 #ià( +defšed + +_WCHAR_H + || defšed +__Ãed_mb¡©e_t +è&& !defšed +__mb¡©e_t_defšed + + +81  + #__mb¡©e_t_defšed + 1 + + ) + +85  + m__couÁ +; + +88 #ifdeà +__WINT_TYPE__ + + +89 +__WINT_TYPE__ + + m__wch +; + +91 +wšt_t + + m__wch +; + +93  + m__wchb +[4]; + +94 } + m__v®ue +; + +95 } + t__mb¡©e_t +; + +97 #undeà +__Ãed_mb¡©e_t + + +102 #ifdeà +_WCHAR_H + + +104 +__BEGIN_NAMESPACE_C99 + + +106  +__mb¡©e_t + + tmb¡©e_t +; + +107 + g__END_NAMESPACE_C99 + + +108 #ifdeà +__USE_GNU + + +109 + $__USING_NAMESPACE_C99 +( +mb¡©e_t +) + +112 #iâdeà +WCHAR_MIN + + +114  + #WCHAR_MIN + +__WCHAR_MIN + + + ) + +115  + #WCHAR_MAX + +__WCHAR_MAX + + + ) + +118 #iâdeà +WEOF + + +119  + #WEOF + (0xffffffffu) + + ) + +124 #ià +defšed + +__USE_XOPEN + && !defšed +__USE_UNIX98 + + +125  + ~ + +129 +__BEGIN_DECLS + + +131 +__BEGIN_NAMESPACE_STD + + +134  +tm +; + +135 +__END_NAMESPACE_STD + + +139 + $__USING_NAMESPACE_STD +( +tm +) + +142 +__BEGIN_NAMESPACE_STD + + +144 +wch¬_t + * + $wcsýy + ( +wch¬_t + * +__»¡riù + +__de¡ +, + +145 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +è +__THROW +; + +147 +wch¬_t + * + $wc¢ýy + ( +wch¬_t + * +__»¡riù + +__de¡ +, + +148 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, +size_t + +__n +) + +149 +__THROW +; + +152 +wch¬_t + * + $wcsÿt + ( +wch¬_t + * +__»¡riù + +__de¡ +, + +153 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +è +__THROW +; + +155 +wch¬_t + * + $wc¢ÿt + ( +wch¬_t + * +__»¡riù + +__de¡ +, + +156 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, +size_t + +__n +) + +157 +__THROW +; + +160  + $wcscmp + ( +__cÚ¡ + +wch¬_t + * +__s1 +, __cÚ¡ wch¬_ˆ* +__s2 +) + +161 +__THROW + +__©Œibu‹_pu»__ +; + +163  + $wc¢cmp + ( +__cÚ¡ + +wch¬_t + * +__s1 +, __cÚ¡ wch¬_ˆ* +__s2 +, +size_t + +__n +) + +164 +__THROW + +__©Œibu‹_pu»__ +; + +165 +__END_NAMESPACE_STD + + +167 #ifdeà +__USE_XOPEN2K8 + + +169  + $wcsÿ£cmp + ( +__cÚ¡ + +wch¬_t + * +__s1 +, __cÚ¡ wch¬_ˆ* +__s2 +è +__THROW +; + +172  + $wc¢ÿ£cmp + ( +__cÚ¡ + +wch¬_t + * +__s1 +, __cÚ¡ wch¬_ˆ* +__s2 +, + +173 +size_t + +__n +è +__THROW +; + +177  + ~ + +179  + $wcsÿ£cmp_l + ( +__cÚ¡ + +wch¬_t + * +__s1 +, __cÚ¡ wch¬_ˆ* +__s2 +, + +180 +__loÿË_t + +__loc +è +__THROW +; + +182  + $wc¢ÿ£cmp_l + ( +__cÚ¡ + +wch¬_t + * +__s1 +, __cÚ¡ wch¬_ˆ* +__s2 +, + +183 +size_t + +__n +, +__loÿË_t + +__loc +è +__THROW +; + +186 +__BEGIN_NAMESPACE_STD + + +189  + $wcscÞl + ( +__cÚ¡ + +wch¬_t + * +__s1 +, __cÚ¡ wch¬_ˆ* +__s2 +è +__THROW +; + +193 +size_t + + $wcsxäm + ( +wch¬_t + * +__»¡riù + +__s1 +, + +194 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s2 +, +size_t + +__n +è +__THROW +; + +195 +__END_NAMESPACE_STD + + +197 #ifdeà +__USE_XOPEN2K8 + + +203  + $wcscÞl_l + ( +__cÚ¡ + +wch¬_t + * +__s1 +, __cÚ¡ wch¬_ˆ* +__s2 +, + +204 +__loÿË_t + +__loc +è +__THROW +; + +209 +size_t + + $wcsxäm_l + ( +wch¬_t + * +__s1 +, +__cÚ¡ + wch¬_ˆ* +__s2 +, + +210 +size_t + +__n +, +__loÿË_t + +__loc +è +__THROW +; + +213 +wch¬_t + * + $wcsdup + ( +__cÚ¡ + +wch¬_t + * +__s +è +__THROW + +__©Œibu‹_m®loc__ +; + +216 +__BEGIN_NAMESPACE_STD + + +218 #ifdeà +__CORRECT_ISO_CPP_WCHAR_H_PROTO + + +219 "C++" +wch¬_t + * + $wcschr + ( +wch¬_t + * +__wcs +, wch¬_ˆ +__wc +) + +220 +__THROW + + `__asm + ("wcschr"è +__©Œibu‹_pu»__ +; + +221 "C++" +__cÚ¡ + +wch¬_t + * + $wcschr + ( +__cÚ¡ + +wch¬_t + * +__wcs +, wch¬_ˆ +__wc +) + +222 +__THROW + + `__asm + ("wcschr"è +__©Œibu‹_pu»__ +; + +224 +wch¬_t + * + $wcschr + ( +__cÚ¡ + +wch¬_t + * +__wcs +, wch¬_ˆ +__wc +) + +225 +__THROW + +__©Œibu‹_pu»__ +; + +228 #ifdeà +__CORRECT_ISO_CPP_WCHAR_H_PROTO + + +229 "C++" +wch¬_t + * + $wc¤chr + ( +wch¬_t + * +__wcs +, wch¬_ˆ +__wc +) + +230 +__THROW + + `__asm + ("wc¤chr"è +__©Œibu‹_pu»__ +; + +231 "C++" +__cÚ¡ + +wch¬_t + * + $wc¤chr + ( +__cÚ¡ + +wch¬_t + * +__wcs +, wch¬_ˆ +__wc +) + +232 +__THROW + + `__asm + ("wc¤chr"è +__©Œibu‹_pu»__ +; + +234 +wch¬_t + * + $wc¤chr + ( +__cÚ¡ + +wch¬_t + * +__wcs +, wch¬_ˆ +__wc +) + +235 +__THROW + +__©Œibu‹_pu»__ +; + +237 +__END_NAMESPACE_STD + + +239 #ifdeà +__USE_GNU + + +242 +wch¬_t + * + $wcschºul + ( +__cÚ¡ + +wch¬_t + * +__s +, wch¬_ˆ +__wc +) + +243 +__THROW + +__©Œibu‹_pu»__ +; + +246 +__BEGIN_NAMESPACE_STD + + +249 +size_t + + $wcsc¥n + ( +__cÚ¡ + +wch¬_t + * +__wcs +, __cÚ¡ wch¬_ˆ* +__»jeù +) + +250 +__THROW + +__©Œibu‹_pu»__ +; + +253 +size_t + + $wcs¥n + ( +__cÚ¡ + +wch¬_t + * +__wcs +, __cÚ¡ wch¬_ˆ* +__acû± +) + +254 +__THROW + +__©Œibu‹_pu»__ +; + +256 #ifdeà +__CORRECT_ISO_CPP_WCHAR_H_PROTO + + +257 "C++" +wch¬_t + * + $wc¥brk + ( +wch¬_t + * +__wcs +, +__cÚ¡ + wch¬_ˆ* +__acû± +) + +258 +__THROW + + `__asm + ("wc¥brk"è +__©Œibu‹_pu»__ +; + +259 "C++" +__cÚ¡ + +wch¬_t + * + $wc¥brk + ( +__cÚ¡ + +wch¬_t + * +__wcs +, + +260 +__cÚ¡ + +wch¬_t + * +__acû± +) + +261 +__THROW + + `__asm + ("wc¥brk"è +__©Œibu‹_pu»__ +; + +263 +wch¬_t + * + $wc¥brk + ( +__cÚ¡ + +wch¬_t + * +__wcs +, __cÚ¡ wch¬_ˆ* +__acû± +) + +264 +__THROW + +__©Œibu‹_pu»__ +; + +267 #ifdeà +__CORRECT_ISO_CPP_WCHAR_H_PROTO + + +268 "C++" +wch¬_t + * + $wcs¡r + ( +wch¬_t + * +__hay¡ack +, +__cÚ¡ + wch¬_ˆ* +__ÃedË +) + +269 +__THROW + + `__asm + ("wcs¡r"è +__©Œibu‹_pu»__ +; + +270 "C++" +__cÚ¡ + +wch¬_t + * + $wcs¡r + ( +__cÚ¡ + +wch¬_t + * +__hay¡ack +, + +271 +__cÚ¡ + +wch¬_t + * +__ÃedË +) + +272 +__THROW + + `__asm + ("wcs¡r"è +__©Œibu‹_pu»__ +; + +274 +wch¬_t + * + $wcs¡r + ( +__cÚ¡ + +wch¬_t + * +__hay¡ack +, __cÚ¡ wch¬_ˆ* +__ÃedË +) + +275 +__THROW + +__©Œibu‹_pu»__ +; + +279 +wch¬_t + * + $wc¡ok + ( +wch¬_t + * +__»¡riù + +__s +, + +280 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__d–im +, + +281 +wch¬_t + ** +__»¡riù + +__±r +è +__THROW +; + +284 +size_t + + $wc¦’ + ( +__cÚ¡ + +wch¬_t + * +__s +è +__THROW + +__©Œibu‹_pu»__ +; + +285 +__END_NAMESPACE_STD + + +287 #ifdeà +__USE_XOPEN + + +289 #ifdeà +__CORRECT_ISO_CPP_WCHAR_H_PROTO + + +290 "C++" +wch¬_t + * + $wcswcs + ( +wch¬_t + * +__hay¡ack +, +__cÚ¡ + wch¬_ˆ* +__ÃedË +) + +291 +__THROW + + `__asm + ("wcswcs"è +__©Œibu‹_pu»__ +; + +292 "C++" +__cÚ¡ + +wch¬_t + * + $wcswcs + ( +__cÚ¡ + +wch¬_t + * +__hay¡ack +, + +293 +__cÚ¡ + +wch¬_t + * +__ÃedË +) + +294 +__THROW + + `__asm + ("wcswcs"è +__©Œibu‹_pu»__ +; + +296 +wch¬_t + * + $wcswcs + ( +__cÚ¡ + +wch¬_t + * +__hay¡ack +, __cÚ¡ wch¬_ˆ* +__ÃedË +) + +297 +__THROW + +__©Œibu‹_pu»__ +; + +301 #ifdeà +__USE_XOPEN2K8 + + +303 +size_t + + $wc¢Ën + ( +__cÚ¡ + +wch¬_t + * +__s +, +size_t + +__maxËn +) + +304 +__THROW + +__©Œibu‹_pu»__ +; + +308 +__BEGIN_NAMESPACE_STD + + +310 #ifdeà +__CORRECT_ISO_CPP_WCHAR_H_PROTO + + +311 "C++" +wch¬_t + * + $wmemchr + ( +wch¬_t + * +__s +, wch¬_ˆ +__c +, +size_t + +__n +) + +312 +__THROW + + `__asm + ("wmemchr"è +__©Œibu‹_pu»__ +; + +313 "C++" +__cÚ¡ + +wch¬_t + * + $wmemchr + ( +__cÚ¡ + +wch¬_t + * +__s +, wch¬_ˆ +__c +, + +314 +size_t + +__n +) + +315 +__THROW + + `__asm + ("wmemchr"è +__©Œibu‹_pu»__ +; + +317 +wch¬_t + * + $wmemchr + ( +__cÚ¡ + +wch¬_t + * +__s +, wch¬_ˆ +__c +, +size_t + +__n +) + +318 +__THROW + +__©Œibu‹_pu»__ +; + +322  + $wmemcmp + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s1 +, + +323 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s2 +, +size_t + +__n +) + +324 +__THROW + +__©Œibu‹_pu»__ +; + +327 +wch¬_t + * + $wmemýy + ( +wch¬_t + * +__»¡riù + +__s1 +, + +328 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s2 +, +size_t + +__n +è +__THROW +; + +332 +wch¬_t + * + $wmemmove + ( +wch¬_t + * +__s1 +, +__cÚ¡ + wch¬_ˆ* +__s2 +, +size_t + +__n +) + +333 +__THROW +; + +336 +wch¬_t + * + $wmem£t + ( +wch¬_t + * +__s +, wch¬_ˆ +__c +, +size_t + +__n +è +__THROW +; + +337 +__END_NAMESPACE_STD + + +339 #ifdeà +__USE_GNU + + +342 +wch¬_t + * + $wmempýy + ( +wch¬_t + * +__»¡riù + +__s1 +, + +343 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s2 +, +size_t + +__n +) + +344 +__THROW +; + +348 +__BEGIN_NAMESPACE_STD + + +351 +wšt_t + + $btowc + ( +__c +è +__THROW +; + +355  + $wùob + ( +wšt_t + +__c +è +__THROW +; + +359  + $mbsš™ + ( +__cÚ¡ + +mb¡©e_t + * +__ps +è +__THROW + +__©Œibu‹_pu»__ +; + +363 +size_t + + $mb¹owc + ( +wch¬_t + * +__»¡riù + +__pwc +, + +364 +__cÚ¡ + * +__»¡riù + +__s +, +size_t + +__n +, + +365 +mb¡©e_t + * +__p +è +__THROW +; + +368 +size_t + + $wütomb + (* +__»¡riù + +__s +, +wch¬_t + +__wc +, + +369 +mb¡©e_t + * +__»¡riù + +__ps +è +__THROW +; + +372 +size_t + + $__mb¾’ + ( +__cÚ¡ + * +__»¡riù + +__s +, +size_t + +__n +, + +373 +mb¡©e_t + * +__»¡riù + +__ps +è +__THROW +; + +374 +size_t + + $mb¾’ + ( +__cÚ¡ + * +__»¡riù + +__s +, +size_t + +__n +, + +375 +mb¡©e_t + * +__»¡riù + +__ps +è +__THROW +; + +376 +__END_NAMESPACE_STD + + +378 #ifdeà +__USE_EXTERN_INLINES + + +384 +wšt_t + + $__btowc_®Ÿs + ( +__c +è + `__asm + ("btowc"); + +385 +__ex‹º_šlše + +wšt_t + + +386 + `__NTH + ( + $btowc + ( +__c +)) + +387 {  ( + `__bužtš_cÚ¡ªt_p + ( +__c +) && __c >= '\0' && __c <= '\x7f' + +388 ? ( +wšt_t +è +__c + : + `__btowc_®Ÿs + (__c)); + } +} + +390  + $__wùob_®Ÿs + ( +wšt_t + +__c +è + `__asm + ("wctob"); + +391 +__ex‹º_šlše +  + +392 + `__NTH + ( + $wùob + ( +wšt_t + +__wc +)) + +393 {  ( + `__bužtš_cÚ¡ªt_p + ( +__wc +è&& __wø>ð +L +'\0' && __wc <= L'\x7f' + +394 ? (è +__wc + : + `__wùob_®Ÿs + (__wc)); + } +} + +396 +__ex‹º_šlše + +size_t + + +397 +__NTH + ( + $mb¾’ + ( +__cÚ¡ + * +__»¡riù + +__s +, +size_t + +__n +, + +398 +mb¡©e_t + * +__»¡riù + +__ps +)) + +399 {  ( +__ps + !ð +NULL + + +400 ? + `mb¹owc + ( +NULL +, +__s +, +__n +, +__ps +è: + `__mb¾’ + (__s, __n, NULL)); + } +} + +403 +__BEGIN_NAMESPACE_STD + + +406 +size_t + + $mb¤towcs + ( +wch¬_t + * +__»¡riù + +__d¡ +, + +407 +__cÚ¡ + ** +__»¡riù + +__¤c +, +size_t + +__Ën +, + +408 +mb¡©e_t + * +__»¡riù + +__ps +è +__THROW +; + +412 +size_t + + $wc¤tombs + (* +__»¡riù + +__d¡ +, + +413 +__cÚ¡ + +wch¬_t + ** +__»¡riù + +__¤c +, +size_t + +__Ën +, + +414 +mb¡©e_t + * +__»¡riù + +__ps +è +__THROW +; + +415 +__END_NAMESPACE_STD + + +418 #ifdef +__USE_XOPEN2K8 + + +421 +size_t + + $mb¢¹owcs + ( +wch¬_t + * +__»¡riù + +__d¡ +, + +422 +__cÚ¡ + ** +__»¡riù + +__¤c +, +size_t + +__nmc +, + +423 +size_t + +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +è +__THROW +; + +427 +size_t + + $wc¢¹ombs + (* +__»¡riù + +__d¡ +, + +428 +__cÚ¡ + +wch¬_t + ** +__»¡riù + +__¤c +, + +429 +size_t + +__nwc +, size_ˆ +__Ën +, + +430 +mb¡©e_t + * +__»¡riù + +__ps +è +__THROW +; + +435 #ifdeà +__USE_XOPEN + + +437  + $wcwidth + ( +wch¬_t + +__c +è +__THROW +; + +441  + $wcswidth + ( +__cÚ¡ + +wch¬_t + * +__s +, +size_t + +__n +è +__THROW +; + +445 +__BEGIN_NAMESPACE_STD + + +448  + $wc¡od + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +449 +wch¬_t + ** +__»¡riù + +__’d±r +è +__THROW +; + +450 +__END_NAMESPACE_STD + + +452 #ifdeà +__USE_ISOC99 + + +453 +__BEGIN_NAMESPACE_C99 + + +455  + $wc¡of + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +456 +wch¬_t + ** +__»¡riù + +__’d±r +è +__THROW +; + +457  + $wc¡Þd + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +458 +wch¬_t + ** +__»¡riù + +__’d±r +è +__THROW +; + +459 +__END_NAMESPACE_C99 + + +463 +__BEGIN_NAMESPACE_STD + + +466  + $wc¡Þ + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +467 +wch¬_t + ** +__»¡riù + +__’d±r +,  +__ba£ +è +__THROW +; + +471  + $wc¡oul + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +472 +wch¬_t + ** +__»¡riù + +__’d±r +,  +__ba£ +) + +473 +__THROW +; + +474 +__END_NAMESPACE_STD + + +476 #ià +defšed + +__USE_ISOC99 + || (defšed +__GNUC__ + && defšed +__USE_GNU +) + +477 +__BEGIN_NAMESPACE_C99 + + +480 +__ex‹nsiÚ__ + + +481  + $wc¡Þl + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +482 +wch¬_t + ** +__»¡riù + +__’d±r +,  +__ba£ +) + +483 +__THROW +; + +487 +__ex‹nsiÚ__ + + +488  + $wc¡ouÎ + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +489 +wch¬_t + ** +__»¡riù + +__’d±r +, + +490  +__ba£ +è +__THROW +; + +491 +__END_NAMESPACE_C99 + + +494 #ià +defšed + +__GNUC__ + && defšed +__USE_GNU + + +497 +__ex‹nsiÚ__ + + +498  + $wc¡oq + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +499 +wch¬_t + ** +__»¡riù + +__’d±r +,  +__ba£ +) + +500 +__THROW +; + +504 +__ex‹nsiÚ__ + + +505  + $wc¡ouq + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +506 +wch¬_t + ** +__»¡riù + +__’d±r +, + +507  +__ba£ +è +__THROW +; + +510 #ifdeà +__USE_GNU + + +524  + ~ + +528  + $wc¡Þ_l + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +529 +wch¬_t + ** +__»¡riù + +__’d±r +,  +__ba£ +, + +530 +__loÿË_t + +__loc +è +__THROW +; + +532  + $wc¡oul_l + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +533 +wch¬_t + ** +__»¡riù + +__’d±r +, + +534  +__ba£ +, +__loÿË_t + +__loc +è +__THROW +; + +536 +__ex‹nsiÚ__ + + +537  + $wc¡Þl_l + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +538 +wch¬_t + ** +__»¡riù + +__’d±r +, + +539  +__ba£ +, +__loÿË_t + +__loc +è +__THROW +; + +541 +__ex‹nsiÚ__ + + +542  + $wc¡ouÎ_l + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +543 +wch¬_t + ** +__»¡riù + +__’d±r +, + +544  +__ba£ +, +__loÿË_t + +__loc +) + +545 +__THROW +; + +547  + $wc¡od_l + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +548 +wch¬_t + ** +__»¡riù + +__’d±r +, +__loÿË_t + +__loc +) + +549 +__THROW +; + +551  + $wc¡of_l + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +552 +wch¬_t + ** +__»¡riù + +__’d±r +, +__loÿË_t + +__loc +) + +553 +__THROW +; + +555  + $wc¡Þd_l + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ÅŒ +, + +556 +wch¬_t + ** +__»¡riù + +__’d±r +, + +557 +__loÿË_t + +__loc +è +__THROW +; + +561 #ifdef +__USE_XOPEN2K8 + + +564 +wch¬_t + * + $wýýy + ( +wch¬_t + * +__de¡ +, +__cÚ¡ + wch¬_ˆ* +__¤c +è +__THROW +; + +568 +wch¬_t + * + $wýnýy + ( +wch¬_t + * +__de¡ +, +__cÚ¡ + wch¬_ˆ* +__¤c +, +size_t + +__n +) + +569 +__THROW +; + +575 #ifdef +__USE_XOPEN2K8 + + +578 +__FILE + * + $Ý’_wmem¡»am + ( +wch¬_t + ** +__buæoc +, +size_t + * +__siz–oc +è +__THROW +; + +581 #ià +defšed + +__USE_ISOC95 + || defšed +__USE_UNIX98 + + +582 +__BEGIN_NAMESPACE_STD + + +585  + $fwide + ( +__FILE + * +__å +,  +__mode +è +__THROW +; + +592  + `fw´štf + ( +__FILE + * +__»¡riù + +__¡»am +, + +593 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...) + +599  + `w´štf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...) + +602  + $sw´štf + ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__n +, + +603 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...) + +604 +__THROW + ; + +610  + `vfw´štf + ( +__FILE + * +__»¡riù + +__s +, + +611 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +612 +__gnuc_va_li¡ + +__¬g +) + +618  + `vw´štf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +619 +__gnuc_va_li¡ + +__¬g +) + +623  + $vsw´štf + ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__n +, + +624 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +625 +__gnuc_va_li¡ + +__¬g +) + +626 +__THROW + ; + +633  + `fwsÿnf + ( +__FILE + * +__»¡riù + +__¡»am +, + +634 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...) + +640  + `wsÿnf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...) + +643  + $swsÿnf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s +, + +644 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...) + +645 +__THROW + ; + +647 #ià +defšed + +__USE_ISOC99 + && !defšed +__USE_GNU + \ + +648 && (! +defšed + +__LDBL_COMPAT + || !defšed +__REDIRECT +) \ + +649 && ( +defšed + +__STRICT_ANSI__ + || defšed +__USE_XOPEN2K +) + +650 #ifdeà +__REDIRECT + + +654  + `__REDIRECT + ( +fwsÿnf +, ( +__FILE + * +__»¡riù + +__¡»am +, + +655 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...), + +656 +__isoc99_fwsÿnf +) + +658  + `__REDIRECT + ( +wsÿnf +, ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...), + +659 +__isoc99_wsÿnf +) + +661  + `__REDIRECT + ( +swsÿnf +, ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s +, + +662 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...), + +663 +__isoc99_swsÿnf +) + +664 +__THROW + ; + +666  + `__isoc99_fwsÿnf + ( +__FILE + * +__»¡riù + +__¡»am +, + +667 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...); + +668  + `__isoc99_wsÿnf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...); + +669  + $__isoc99_swsÿnf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s +, + +670 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...) + +671 +__THROW +; + +672  + #fwsÿnf + +__isoc99_fwsÿnf + + + ) + +673  + #wsÿnf + +__isoc99_wsÿnf + + + ) + +674  + #swsÿnf + +__isoc99_swsÿnf + + + ) + +678 +__END_NAMESPACE_STD + + +681 #ifdeà +__USE_ISOC99 + + +682 +__BEGIN_NAMESPACE_C99 + + +687  + `vfwsÿnf + ( +__FILE + * +__»¡riù + +__s +, + +688 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +689 +__gnuc_va_li¡ + +__¬g +) + +695  + `vwsÿnf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +696 +__gnuc_va_li¡ + +__¬g +) + +699  + $vswsÿnf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s +, + +700 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +701 +__gnuc_va_li¡ + +__¬g +) + +702 +__THROW + ; + +704 #ià! +defšed + +__USE_GNU + \ + +705 && (! +defšed + +__LDBL_COMPAT + || !defšed +__REDIRECT +) \ + +706 && ( +defšed + +__STRICT_ANSI__ + || defšed +__USE_XOPEN2K +) + +707 #ifdeà +__REDIRECT + + +708  + `__REDIRECT + ( +vfwsÿnf +, ( +__FILE + * +__»¡riù + +__s +, + +709 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +710 +__gnuc_va_li¡ + +__¬g +), +__isoc99_vfwsÿnf +) + +712  + `__REDIRECT + ( +vwsÿnf +, ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +713 +__gnuc_va_li¡ + +__¬g +), +__isoc99_vwsÿnf +) + +715  + `__REDIRECT + ( +vswsÿnf +, ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s +, + +716 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +717 +__gnuc_va_li¡ + +__¬g +), +__isoc99_vswsÿnf +) + +718 +__THROW + ; + +720  + `__isoc99_vfwsÿnf + ( +__FILE + * +__»¡riù + +__s +, + +721 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +722 +__gnuc_va_li¡ + +__¬g +); + +723  + `__isoc99_vwsÿnf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +724 +__gnuc_va_li¡ + +__¬g +); + +725  + $__isoc99_vswsÿnf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s +, + +726 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +727 +__gnuc_va_li¡ + +__¬g +è +__THROW +; + +728  + #vfwsÿnf + +__isoc99_vfwsÿnf + + + ) + +729  + #vwsÿnf + +__isoc99_vwsÿnf + + + ) + +730  + #vswsÿnf + +__isoc99_vswsÿnf + + + ) + +734 +__END_NAMESPACE_C99 + + +738 +__BEGIN_NAMESPACE_STD + + +743 +wšt_t + + `fg‘wc + ( +__FILE + * +__¡»am +); + +744 +wšt_t + + `g‘wc + ( +__FILE + * +__¡»am +); + +750 +wšt_t + + `g‘wch¬ + (); + +757 +wšt_t + + `åutwc + ( +wch¬_t + +__wc +, +__FILE + * +__¡»am +); + +758 +wšt_t + + `putwc + ( +wch¬_t + +__wc +, +__FILE + * +__¡»am +); + +764 +wšt_t + + `putwch¬ + ( +wch¬_t + +__wc +); + +772 +wch¬_t + * + `fg‘ws + (wch¬_ˆ* +__»¡riù + +__ws +,  +__n +, + +773 +__FILE + * +__»¡riù + +__¡»am +); + +779  + `åutws + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ws +, + +780 +__FILE + * +__»¡riù + +__¡»am +); + +787 +wšt_t + + `ung‘wc + (wšt_ˆ +__wc +, +__FILE + * +__¡»am +); + +788 +__END_NAMESPACE_STD + + +791 #ifdeà +__USE_GNU + + +799 +wšt_t + + `g‘wc_uÆocked + ( +__FILE + * +__¡»am +); + +800 +wšt_t + + `g‘wch¬_uÆocked + (); + +808 +wšt_t + + `fg‘wc_uÆocked + ( +__FILE + * +__¡»am +); + +816 +wšt_t + + `åutwc_uÆocked + ( +wch¬_t + +__wc +, +__FILE + * +__¡»am +); + +825 +wšt_t + + `putwc_uÆocked + ( +wch¬_t + +__wc +, +__FILE + * +__¡»am +); + +826 +wšt_t + + `putwch¬_uÆocked + ( +wch¬_t + +__wc +); + +835 +wch¬_t + * + `fg‘ws_uÆocked + (wch¬_ˆ* +__»¡riù + +__ws +,  +__n +, + +836 +__FILE + * +__»¡riù + +__¡»am +); + +844  + `åutws_uÆocked + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__ws +, + +845 +__FILE + * +__»¡riù + +__¡»am +); + +849 +__BEGIN_NAMESPACE_C99 + + +853 +size_t + + $wcsáime + ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__maxsize +, + +854 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +855 +__cÚ¡ +  +tm + * +__»¡riù + +__ +è +__THROW +; + +856 +__END_NAMESPACE_C99 + + +858 #ifdeà +__USE_GNU + + +859  + ~ + +863 +size_t + + $wcsáime_l + ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__maxsize +, + +864 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +865 +__cÚ¡ +  +tm + * +__»¡riù + +__ +, + +866 +__loÿË_t + +__loc +è +__THROW +; + +875 #ià +defšed + +__USE_UNIX98 + && !defšed +__USE_GNU + + +876  + #__Ãed_iswxxx + + + ) + +877  + ~ + +881 #ià +__USE_FORTIFY_LEVEL + > 0 && +defšed + +__ex‹º_®ways_šlše + + +882  + ~ + +885 #ifdeà +__LDBL_COMPAT + + +886  + ~ + +889 +__END_DECLS + + +897 #undeà +__Ãed_mb¡©e_t + + +898 #undeà +__Ãed_wšt_t + + + @/usr/include/bits/pthreadtypes.h + +20 #iâdeà +_BITS_PTHREADTYPES_H + + +21  + #_BITS_PTHREADTYPES_H + 1 + + ) + +23  + ~ + +25 #ià +__WORDSIZE + == 64 + +26  + #__SIZEOF_PTHREAD_ATTR_T + 56 + + ) + +27  + #__SIZEOF_PTHREAD_MUTEX_T + 40 + + ) + +28  + #__SIZEOF_PTHREAD_MUTEXATTR_T + 4 + + ) + +29  + #__SIZEOF_PTHREAD_COND_T + 48 + + ) + +30  + #__SIZEOF_PTHREAD_CONDATTR_T + 4 + + ) + +31  + #__SIZEOF_PTHREAD_RWLOCK_T + 56 + + ) + +32  + #__SIZEOF_PTHREAD_RWLOCKATTR_T + 8 + + ) + +33  + #__SIZEOF_PTHREAD_BARRIER_T + 32 + + ) + +34  + #__SIZEOF_PTHREAD_BARRIERATTR_T + 4 + + ) + +36  + #__SIZEOF_PTHREAD_ATTR_T + 36 + + ) + +37  + #__SIZEOF_PTHREAD_MUTEX_T + 24 + + ) + +38  + #__SIZEOF_PTHREAD_MUTEXATTR_T + 4 + + ) + +39  + #__SIZEOF_PTHREAD_COND_T + 48 + + ) + +40  + #__SIZEOF_PTHREAD_CONDATTR_T + 4 + + ) + +41  + #__SIZEOF_PTHREAD_RWLOCK_T + 32 + + ) + +42  + #__SIZEOF_PTHREAD_RWLOCKATTR_T + 8 + + ) + +43  + #__SIZEOF_PTHREAD_BARRIER_T + 20 + + ) + +44  + #__SIZEOF_PTHREAD_BARRIERATTR_T + 4 + + ) + +50  + t±h»ad_t +; + +55  + m__size +[ +__SIZEOF_PTHREAD_ATTR_T +]; + +56  + m__®ign +; + +57 } + t±h»ad_©Œ_t +; + +60 #ià +__WORDSIZE + == 64 + +61  + s__±h»ad_š‹º®_li¡ + + +63  +__±h»ad_š‹º®_li¡ + * + m__´ev +; + +64  +__±h»ad_š‹º®_li¡ + * + m__Ãxt +; + +65 } + t__±h»ad_li¡_t +; + +67  + s__±h»ad_š‹º®_¦i¡ + + +69  +__±h»ad_š‹º®_¦i¡ + * + m__Ãxt +; + +70 } + t__±h»ad_¦i¡_t +; + +78  + s__±h»ad_mu‹x_s + + +80  + m__lock +; + +81  + m__couÁ +; + +82  + m__owÃr +; + +83 #ià +__WORDSIZE + == 64 + +84  + m__nu£rs +; + +88  + m__kšd +; + +89 #ià +__WORDSIZE + == 64 + +90  + m__¥šs +; + +91 +__±h»ad_li¡_t + + m__li¡ +; + +92  + #__PTHREAD_MUTEX_HAVE_PREV + 1 + + ) + +94  + m__nu£rs +; + +95 +__ex‹nsiÚ__ + union + +97  + m__¥šs +; + +98 +__±h»ad_¦i¡_t + + m__li¡ +; + +101 } + m__d©a +; + +102  + m__size +[ +__SIZEOF_PTHREAD_MUTEX_T +]; + +103  + m__®ign +; + +104 } + t±h»ad_mu‹x_t +; + +108  + m__size +[ +__SIZEOF_PTHREAD_MUTEXATTR_T +]; + +109  + m__®ign +; + +110 } + t±h»ad_mu‹x©Œ_t +; + +119  + m__lock +; + +120  + m__fu‹x +; + +121 +__ex‹nsiÚ__ +  + m__tÙ®_£q +; + +122 +__ex‹nsiÚ__ +  + m__wakeup_£q +; + +123 +__ex‹nsiÚ__ +  + m__wok’_£q +; + +124 * + m__mu‹x +; + +125  + m__nwa™”s +; + +126  + m__brßdÿ¡_£q +; + +127 } + m__d©a +; + +128  + m__size +[ +__SIZEOF_PTHREAD_COND_T +]; + +129 +__ex‹nsiÚ__ +  + m__®ign +; + +130 } + t±h»ad_cÚd_t +; + +134  + m__size +[ +__SIZEOF_PTHREAD_CONDATTR_T +]; + +135  + m__®ign +; + +136 } + t±h»ad_cÚd©Œ_t +; + +140  + t±h»ad_key_t +; + +144  + t±h»ad_Úû_t +; + +147 #ià +defšed + +__USE_UNIX98 + || defšed +__USE_XOPEN2K + + +152 #ià +__WORDSIZE + == 64 + +155  + m__lock +; + +156  + m__Ä_»ad”s +; + +157  + m__»ad”s_wakeup +; + +158  + m__wr™”_wakeup +; + +159  + m__Ä_»ad”s_queued +; + +160  + m__Ä_wr™”s_queued +; + +161  + m__wr™” +; + +162  + m__sh¬ed +; + +163  + m__·d1 +; + +164  + m__·d2 +; + +167  + m__æags +; + +168 } + m__d©a +; + +172  + m__lock +; + +173  + m__Ä_»ad”s +; + +174  + m__»ad”s_wakeup +; + +175  + m__wr™”_wakeup +; + +176  + m__Ä_»ad”s_queued +; + +177  + m__Ä_wr™”s_queued +; + +180  + m__æags +; + +181  + m__sh¬ed +; + +182  + m__·d1 +; + +183  + m__·d2 +; + +184  + m__wr™” +; + +185 } + m__d©a +; + +187  + m__size +[ +__SIZEOF_PTHREAD_RWLOCK_T +]; + +188  + m__®ign +; + +189 } + t±h»ad_rwlock_t +; + +193  + m__size +[ +__SIZEOF_PTHREAD_RWLOCKATTR_T +]; + +194  + m__®ign +; + +195 } + t±h»ad_rwlock©Œ_t +; + +199 #ifdeà +__USE_XOPEN2K + + +201 vÞ©ž + t±h»ad_¥šlock_t +; + +208  + m__size +[ +__SIZEOF_PTHREAD_BARRIER_T +]; + +209  + m__®ign +; + +210 } + t±h»ad_b¬r›r_t +; + +214  + m__size +[ +__SIZEOF_PTHREAD_BARRIERATTR_T +]; + +215  + m__®ign +; + +216 } + t±h»ad_b¬r›¿‰r_t +; + +220 #ià +__WORDSIZE + == 32 + +222  + #__þ—nup_fù_©Œibu‹ + + `__©Œibu‹__ + (( + `__»g·rm__ + (1))) + + ) + + @/usr/include/bits/wchar-ldbl.h + +20 #iâdeà +_WCHAR_H + + +24 #ià +defšed + +__USE_ISOC95 + || defšed +__USE_UNIX98 + + +25 +__BEGIN_NAMESPACE_C99 + + +26 +__LDBL_REDIR_DECL + ( +fw´štf +); + +27 +__LDBL_REDIR_DECL + ( +w´štf +); + +28 +__LDBL_REDIR_DECL + ( +sw´štf +); + +29 +__LDBL_REDIR_DECL + ( +vfw´štf +); + +30 +__LDBL_REDIR_DECL + ( +vw´štf +); + +31 +__LDBL_REDIR_DECL + ( +vsw´štf +); + +32 #ià +defšed + +__USE_ISOC99 + && !defšed +__USE_GNU + \ + +33 && ! +defšed + + g__REDIRECT + \ + +34 && ( +defšed + + g__STRICT_ANSI__ + || defšed + g__USE_XOPEN2K +) + +35 + $__LDBL_REDIR1_DECL + ( +fwsÿnf +, +__Ædbl___isoc99_fwsÿnf +) + +36 + $__LDBL_REDIR1_DECL + ( +wsÿnf +, +__Ædbl___isoc99_wsÿnf +) + +37 + $__LDBL_REDIR1_DECL + ( +swsÿnf +, +__Ædbl___isoc99_swsÿnf +) + +39 + `__LDBL_REDIR_DECL + ( +fwsÿnf +); + +40 + `__LDBL_REDIR_DECL + ( +wsÿnf +); + +41 + `__LDBL_REDIR_DECL + ( +swsÿnf +); + +43 +__END_NAMESPACE_C99 + + +46 #ifdeà +__USE_ISOC99 + + +47 +__BEGIN_NAMESPACE_C99 + + +48 + `__LDBL_REDIR1_DECL + ( +wc¡Þd +, +wc¡od +); + +49 #ià! +defšed + +__USE_GNU + && !defšed +__REDIRECT + \ + +50 && ( +defšed + +__STRICT_ANSI__ + || defšed +__USE_XOPEN2K +) + +51 + $__LDBL_REDIR1_DECL + ( +vfwsÿnf +, +__Ædbl___isoc99_vfwsÿnf +) + +52 + $__LDBL_REDIR1_DECL + ( +vwsÿnf +, +__Ædbl___isoc99_vwsÿnf +) + +53 + $__LDBL_REDIR1_DECL + ( +vswsÿnf +, +__Ædbl___isoc99_vswsÿnf +) + +55 + `__LDBL_REDIR_DECL + ( +vfwsÿnf +); + +56 + `__LDBL_REDIR_DECL + ( +vwsÿnf +); + +57 + `__LDBL_REDIR_DECL + ( +vswsÿnf +); + +59 +__END_NAMESPACE_C99 + + +62 #ifdeà +__USE_GNU + + +63 + `__LDBL_REDIR1_DECL + ( +wc¡Þd_l +, +wc¡od_l +); + +66 #ià +__USE_FORTIFY_LEVEL + > 0 && +defšed + +__ex‹º_®ways_šlše + + +67 + $__LDBL_REDIR_DECL + ( +__sw´štf_chk +) + +68 + $__LDBL_REDIR_DECL + ( +__vsw´štf_chk +) + +69 #ià +__USE_FORTIFY_LEVEL + > 1 + +70 + $__LDBL_REDIR_DECL + ( +__fw´štf_chk +) + +71 + $__LDBL_REDIR_DECL + ( +__w´štf_chk +) + +72 + $__LDBL_REDIR_DECL + ( +__vfw´štf_chk +) + +73 + $__LDBL_REDIR_DECL + ( +__vw´štf_chk +) + + @/usr/include/bits/wchar.h + +20 #iâdeà +_BITS_WCHAR_H + + +21  + #_BITS_WCHAR_H + 1 + + ) + +24 #ifdeà +__WCHAR_MAX__ + + +25  + #__WCHAR_MAX + +__WCHAR_MAX__ + + + ) + +27  + #__WCHAR_MAX + (2147483647) + + ) + +32 #ifdeà +__WCHAR_UNSIGNED__ + + +33  + #__WCHAR_MIN + +L +'\0' + + ) + +37 #–ià +L +'\0' - 1 > 0 + +38  + #__WCHAR_MIN + +L +'\0' + + ) + +40  + #__WCHAR_MIN + (- +__WCHAR_MAX + - 1) + + ) + + @/usr/include/bits/wchar2.h + +20 #iâdeà +_WCHAR_H + + +25 +wch¬_t + * + $__wmemýy_chk + ( +wch¬_t + * +__»¡riù + +__s1 +, + +26 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s2 +, +size_t + +__n +, + +27 +size_t + +__ns1 +è +__THROW +; + +28 +wch¬_t + * + `__REDIRECT_NTH + ( +__wmemýy_®Ÿs +, + +29 ( +wch¬_t + * +__»¡riù + +__s1 +, + +30 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s2 +, +size_t + +__n +), + +31 +wmemýy +); + +32 +wch¬_t + * + `__REDIRECT_NTH + ( +__wmemýy_chk_w¬n +, + +33 ( +wch¬_t + * +__»¡riù + +__s1 +, + +34 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s2 +, +size_t + +__n +, + +35 +size_t + +__ns1 +), +__wmemýy_chk +) + +36 + `__w¬Ç‰r + ("wmemcpy called with†ength biggerhan size of destination " + +39 +__ex‹º_®ways_šlše + +wch¬_t + * + +40 + `__NTH + ( + $wmemýy + ( +wch¬_t + * +__»¡riù + +__s1 +, +__cÚ¡ + wch¬_ˆ*__»¡riù +__s2 +, + +41 +size_t + +__n +)) + +43 ià( + `__bos0 + ( +__s1 +è!ð( +size_t +) -1) + +45 ià(! + `__bužtš_cÚ¡ªt_p + ( +__n +)) + +46  + `__wmemýy_chk + ( +__s1 +, +__s2 +, +__n +, + +47 + `__bos0 + ( +__s1 +è/  ( +wch¬_t +)); + +49 ià( +__n + > + `__bos0 + ( +__s1 +è/  ( +wch¬_t +)) + +50  + `__wmemýy_chk_w¬n + ( +__s1 +, +__s2 +, +__n +, + +51 + `__bos0 + ( +__s1 +è/  ( +wch¬_t +)); + +53  + `__wmemýy_®Ÿs + ( +__s1 +, +__s2 +, +__n +); + +54 + } +} + +57 +wch¬_t + * + $__wmemmove_chk + ( +wch¬_t + * +__s1 +, +__cÚ¡ + wch¬_ˆ* +__s2 +, + +58 +size_t + +__n +, size_ˆ +__ns1 +è +__THROW +; + +59 +wch¬_t + * + `__REDIRECT_NTH + ( +__wmemmove_®Ÿs +, (wch¬_ˆ* +__s1 +, + +60 +__cÚ¡ + +wch¬_t + * +__s2 +, + +61 +size_t + +__n +), +wmemmove +); + +62 +wch¬_t + * + `__REDIRECT_NTH + ( +__wmemmove_chk_w¬n +, + +63 ( +wch¬_t + * +__»¡riù + +__s1 +, + +64 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s2 +, +size_t + +__n +, + +65 +size_t + +__ns1 +), +__wmemmove_chk +) + +66 + `__w¬Ç‰r + ("wmemmove called with†ength biggerhan size of destination " + +69 +__ex‹º_®ways_šlše + +wch¬_t + * + +70 + `__NTH + ( + $wmemmove + ( +wch¬_t + * +__»¡riù + +__s1 +, +__cÚ¡ + wch¬_ˆ*__»¡riù +__s2 +, + +71 +size_t + +__n +)) + +73 ià( + `__bos0 + ( +__s1 +è!ð( +size_t +) -1) + +75 ià(! + `__bužtš_cÚ¡ªt_p + ( +__n +)) + +76  + `__wmemmove_chk + ( +__s1 +, +__s2 +, +__n +, + +77 + `__bos0 + ( +__s1 +è/  ( +wch¬_t +)); + +79 ià( +__n + > + `__bos0 + ( +__s1 +è/  ( +wch¬_t +)) + +80  + `__wmemmove_chk_w¬n + ( +__s1 +, +__s2 +, +__n +, + +81 + `__bos0 + ( +__s1 +è/  ( +wch¬_t +)); + +83  + `__wmemmove_®Ÿs + ( +__s1 +, +__s2 +, +__n +); + +84 + } +} + +87 #ifdeà +__USE_GNU + + +88 +wch¬_t + * + $__wmempýy_chk + ( +wch¬_t + * +__»¡riù + +__s1 +, + +89 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s2 +, +size_t + +__n +, + +90 +size_t + +__ns1 +è +__THROW +; + +91 +wch¬_t + * + `__REDIRECT_NTH + ( +__wmempýy_®Ÿs +, + +92 ( +wch¬_t + * +__»¡riù + +__s1 +, + +93 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s2 +, + +94 +size_t + +__n +), +wmempýy +); + +95 +wch¬_t + * + `__REDIRECT_NTH + ( +__wmempýy_chk_w¬n +, + +96 ( +wch¬_t + * +__»¡riù + +__s1 +, + +97 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__s2 +, +size_t + +__n +, + +98 +size_t + +__ns1 +), +__wmempýy_chk +) + +99 + `__w¬Ç‰r + ("wmempcpy called with†ength biggerhan size of destination " + +102 +__ex‹º_®ways_šlše + +wch¬_t + * + +103 + `__NTH + ( + $wmempýy + ( +wch¬_t + * +__»¡riù + +__s1 +, +__cÚ¡ + wch¬_ˆ*__»¡riù +__s2 +, + +104 +size_t + +__n +)) + +106 ià( + `__bos0 + ( +__s1 +è!ð( +size_t +) -1) + +108 ià(! + `__bužtš_cÚ¡ªt_p + ( +__n +)) + +109  + `__wmempýy_chk + ( +__s1 +, +__s2 +, +__n +, + +110 + `__bos0 + ( +__s1 +è/  ( +wch¬_t +)); + +112 ià( +__n + > + `__bos0 + ( +__s1 +è/  ( +wch¬_t +)) + +113  + `__wmempýy_chk_w¬n + ( +__s1 +, +__s2 +, +__n +, + +114 + `__bos0 + ( +__s1 +è/  ( +wch¬_t +)); + +116  + `__wmempýy_®Ÿs + ( +__s1 +, +__s2 +, +__n +); + +117 + } +} + +121 +wch¬_t + * + $__wmem£t_chk + ( +wch¬_t + * +__s +, wch¬_ˆ +__c +, +size_t + +__n +, + +122 +size_t + +__ns +è +__THROW +; + +123 +wch¬_t + * + `__REDIRECT_NTH + ( +__wmem£t_®Ÿs +, (wch¬_ˆ* +__s +, wch¬_ˆ +__c +, + +124 +size_t + +__n +), +wmem£t +); + +125 +wch¬_t + * + `__REDIRECT_NTH + ( +__wmem£t_chk_w¬n +, + +126 ( +wch¬_t + * +__s +, wch¬_ˆ +__c +, +size_t + +__n +, + +127 +size_t + +__ns +), +__wmem£t_chk +) + +128 + `__w¬Ç‰r + ("wmemset called with†ength biggerhan size of destination " + +131 +__ex‹º_®ways_šlše + +wch¬_t + * + +132 + `__NTH + ( + $wmem£t + ( +wch¬_t + * +__»¡riù + +__s +, wch¬_ˆ +__c +, +size_t + +__n +)) + +134 ià( + `__bos0 + ( +__s +è!ð( +size_t +) -1) + +136 ià(! + `__bužtš_cÚ¡ªt_p + ( +__n +)) + +137  + `__wmem£t_chk + ( +__s +, +__c +, +__n +, + `__bos0 + (__sè/  ( +wch¬_t +)); + +139 ià( +__n + > + `__bos0 + ( +__s +è/  ( +wch¬_t +)) + +140  + `__wmem£t_chk_w¬n + ( +__s +, +__c +, +__n +, + +141 + `__bos0 + ( +__s +è/  ( +wch¬_t +)); + +143  + `__wmem£t_®Ÿs + ( +__s +, +__c +, +__n +); + +144 + } +} + +147 +wch¬_t + * + $__wcsýy_chk + ( +wch¬_t + * +__»¡riù + +__de¡ +, + +148 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, + +149 +size_t + +__n +è +__THROW +; + +150 +wch¬_t + * + `__REDIRECT_NTH + ( +__wcsýy_®Ÿs +, + +151 ( +wch¬_t + * +__»¡riù + +__de¡ +, + +152 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +), +wcsýy +); + +154 +__ex‹º_®ways_šlše + +wch¬_t + * + +155 + `__NTH + ( + $wcsýy + ( +wch¬_t + * +__de¡ +, +__cÚ¡ + wch¬_ˆ* +__¤c +)) + +157 ià( + `__bos + ( +__de¡ +è!ð( +size_t +) -1) + +158  + `__wcsýy_chk + ( +__de¡ +, +__¤c +, + `__bos + (__de¡è/  ( +wch¬_t +)); + +159  + `__wcsýy_®Ÿs + ( +__de¡ +, +__¤c +); + +160 + } +} + +163 +wch¬_t + * + $__wýýy_chk + ( +wch¬_t + * +__de¡ +, +__cÚ¡ + wch¬_ˆ* +__¤c +, + +164 +size_t + +__de¡Ën +è +__THROW +; + +165 +wch¬_t + * + `__REDIRECT_NTH + ( +__wýýy_®Ÿs +, (wch¬_ˆ* +__de¡ +, + +166 +__cÚ¡ + +wch¬_t + * +__¤c +), + +167 +wýýy +); + +169 +__ex‹º_®ways_šlše + +wch¬_t + * + +170 + `__NTH + ( + $wýýy + ( +wch¬_t + * +__de¡ +, +__cÚ¡ + wch¬_ˆ* +__¤c +)) + +172 ià( + `__bos + ( +__de¡ +è!ð( +size_t +) -1) + +173  + `__wýýy_chk + ( +__de¡ +, +__¤c +, + `__bos + (__de¡è/  ( +wch¬_t +)); + +174  + `__wýýy_®Ÿs + ( +__de¡ +, +__¤c +); + +175 + } +} + +178 +wch¬_t + * + $__wc¢ýy_chk + ( +wch¬_t + * +__»¡riù + +__de¡ +, + +179 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, +size_t + +__n +, + +180 +size_t + +__de¡Ën +è +__THROW +; + +181 +wch¬_t + * + `__REDIRECT_NTH + ( +__wc¢ýy_®Ÿs +, + +182 ( +wch¬_t + * +__»¡riù + +__de¡ +, + +183 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, + +184 +size_t + +__n +), +wc¢ýy +); + +185 +wch¬_t + * + `__REDIRECT_NTH + ( +__wc¢ýy_chk_w¬n +, + +186 ( +wch¬_t + * +__»¡riù + +__de¡ +, + +187 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, + +188 +size_t + +__n +, size_ˆ +__de¡Ën +), +__wc¢ýy_chk +) + +189 + `__w¬Ç‰r + ("wcsncpy called with†ength biggerhan size of destination " + +192 +__ex‹º_®ways_šlše + +wch¬_t + * + +193 + `__NTH + ( + $wc¢ýy + ( +wch¬_t + * +__de¡ +, +__cÚ¡ + wch¬_ˆ* +__¤c +, +size_t + +__n +)) + +195 ià( + `__bos + ( +__de¡ +è!ð( +size_t +) -1) + +197 ià(! + `__bužtš_cÚ¡ªt_p + ( +__n +)) + +198  + `__wc¢ýy_chk + ( +__de¡ +, +__¤c +, +__n +, + +199 + `__bos + ( +__de¡ +è/  ( +wch¬_t +)); + +200 ià( +__n + > + `__bos + ( +__de¡ +è/  ( +wch¬_t +)) + +201  + `__wc¢ýy_chk_w¬n + ( +__de¡ +, +__¤c +, +__n +, + +202 + `__bos + ( +__de¡ +è/  ( +wch¬_t +)); + +204  + `__wc¢ýy_®Ÿs + ( +__de¡ +, +__¤c +, +__n +); + +205 + } +} + +208 +wch¬_t + * + $__wýnýy_chk + ( +wch¬_t + * +__»¡riù + +__de¡ +, + +209 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, +size_t + +__n +, + +210 +size_t + +__de¡Ën +è +__THROW +; + +211 +wch¬_t + * + `__REDIRECT_NTH + ( +__wýnýy_®Ÿs +, + +212 ( +wch¬_t + * +__»¡riù + +__de¡ +, + +213 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, + +214 +size_t + +__n +), +wýnýy +); + +215 +wch¬_t + * + `__REDIRECT_NTH + ( +__wýnýy_chk_w¬n +, + +216 ( +wch¬_t + * +__»¡riù + +__de¡ +, + +217 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, + +218 +size_t + +__n +, size_ˆ +__de¡Ën +), +__wýnýy_chk +) + +219 + `__w¬Ç‰r + ("wcpncpy called with†ength biggerhan size of destination " + +222 +__ex‹º_®ways_šlše + +wch¬_t + * + +223 + `__NTH + ( + $wýnýy + ( +wch¬_t + * +__de¡ +, +__cÚ¡ + wch¬_ˆ* +__¤c +, +size_t + +__n +)) + +225 ià( + `__bos + ( +__de¡ +è!ð( +size_t +) -1) + +227 ià(! + `__bužtš_cÚ¡ªt_p + ( +__n +)) + +228  + `__wýnýy_chk + ( +__de¡ +, +__¤c +, +__n +, + +229 + `__bos + ( +__de¡ +è/  ( +wch¬_t +)); + +230 ià( +__n + > + `__bos + ( +__de¡ +è/  ( +wch¬_t +)) + +231  + `__wýnýy_chk_w¬n + ( +__de¡ +, +__¤c +, +__n +, + +232 + `__bos + ( +__de¡ +è/  ( +wch¬_t +)); + +234  + `__wýnýy_®Ÿs + ( +__de¡ +, +__¤c +, +__n +); + +235 + } +} + +238 +wch¬_t + * + $__wcsÿt_chk + ( +wch¬_t + * +__»¡riù + +__de¡ +, + +239 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, + +240 +size_t + +__de¡Ën +è +__THROW +; + +241 +wch¬_t + * + `__REDIRECT_NTH + ( +__wcsÿt_®Ÿs +, + +242 ( +wch¬_t + * +__»¡riù + +__de¡ +, + +243 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +), +wcsÿt +); + +245 +__ex‹º_®ways_šlše + +wch¬_t + * + +246 + `__NTH + ( + $wcsÿt + ( +wch¬_t + * +__de¡ +, +__cÚ¡ + wch¬_ˆ* +__¤c +)) + +248 ià( + `__bos + ( +__de¡ +è!ð( +size_t +) -1) + +249  + `__wcsÿt_chk + ( +__de¡ +, +__¤c +, + `__bos + (__de¡è/  ( +wch¬_t +)); + +250  + `__wcsÿt_®Ÿs + ( +__de¡ +, +__¤c +); + +251 + } +} + +254 +wch¬_t + * + $__wc¢ÿt_chk + ( +wch¬_t + * +__»¡riù + +__de¡ +, + +255 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, + +256 +size_t + +__n +, size_ˆ +__de¡Ën +è +__THROW +; + +257 +wch¬_t + * + `__REDIRECT_NTH + ( +__wc¢ÿt_®Ÿs +, + +258 ( +wch¬_t + * +__»¡riù + +__de¡ +, + +259 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__¤c +, + +260 +size_t + +__n +), +wc¢ÿt +); + +262 +__ex‹º_®ways_šlše + +wch¬_t + * + +263 + `__NTH + ( + $wc¢ÿt + ( +wch¬_t + * +__de¡ +, +__cÚ¡ + wch¬_ˆ* +__¤c +, +size_t + +__n +)) + +265 ià( + `__bos + ( +__de¡ +è!ð( +size_t +) -1) + +266  + `__wc¢ÿt_chk + ( +__de¡ +, +__¤c +, +__n +, + +267 + `__bos + ( +__de¡ +è/  ( +wch¬_t +)); + +268  + `__wc¢ÿt_®Ÿs + ( +__de¡ +, +__¤c +, +__n +); + +269 + } +} + +272  + $__sw´štf_chk + ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__n +, + +273  +__æag +, +size_t + +__s_Ën +, + +274 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...) + +275 +__THROW + ; + +277  + `__REDIRECT_NTH_LDBL + ( +__sw´štf_®Ÿs +, + +278 ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__n +, + +279 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fmt +, ...), + +280 +sw´štf +); + +282 #ifdeà +__va_¬g_·ck + + +283 +__ex‹º_®ways_šlše +  + +284 + `__NTH + ( + $sw´štf + ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__n +, + +285 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fmt +, ...)) + +287 ià( + `__bos + ( +__s +è!ð( +size_t +è-1 || +__USE_FORTIFY_LEVEL + > 1) + +288  + `__sw´štf_chk + ( +__s +, +__n +, +__USE_FORTIFY_LEVEL + - 1, + +289 + `__bos + ( +__s +è/  ( +wch¬_t +), + +290 +__fmt +, + `__va_¬g_·ck + ()); + +291  + `__sw´štf_®Ÿs + ( +__s +, +__n +, +__fmt +, + `__va_¬g_·ck + ()); + +292 + } +} + +293 #–ià! +defšed + +__ýlu¥lus + + +295  + #sw´štf +( +s +, +n +, ...) \ + +296 ( + `__bos + ( +s +è!ð( +size_t +è-1 || +__USE_FORTIFY_LEVEL + > 1 \ + +297 ? + `__sw´štf_chk + ( +s +, +n +, +__USE_FORTIFY_LEVEL + - 1, \ + +298 + `__bos + ( +s +è/  ( +wch¬_t +), +__VA_ARGS__ +) \ + +299 : + `sw´štf + ( +s +, +n +, +__VA_ARGS__ +)) + + ) + +302  + $__vsw´štf_chk + ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__n +, + +303  +__æag +, +size_t + +__s_Ën +, + +304 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +305 +__gnuc_va_li¡ + +__¬g +) + +306 +__THROW + ; + +308  + `__REDIRECT_NTH_LDBL + ( +__vsw´štf_®Ÿs +, + +309 ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__n +, + +310 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fmt +, + +311 +__gnuc_va_li¡ + +__­ +), +vsw´štf +); + +313 +__ex‹º_®ways_šlše +  + +314 + `__NTH + ( + $vsw´štf + ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__n +, + +315 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fmt +, +__gnuc_va_li¡ + +__­ +)) + +317 ià( + `__bos + ( +__s +è!ð( +size_t +è-1 || +__USE_FORTIFY_LEVEL + > 1) + +318  + `__vsw´štf_chk + ( +__s +, +__n +, +__USE_FORTIFY_LEVEL + - 1, + +319 + `__bos + ( +__s +è/  ( +wch¬_t +), +__fmt +, +__­ +); + +320  + `__vsw´štf_®Ÿs + ( +__s +, +__n +, +__fmt +, +__­ +); + +321 + } +} + +324 #ià +__USE_FORTIFY_LEVEL + > 1 + +326  +__fw´štf_chk + ( +__FILE + * +__»¡riù + +__¡»am +,  +__æag +, + +327 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, ...); + +328  +__w´štf_chk + ( +__æag +, +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +330  +__vfw´štf_chk + ( +__FILE + * +__»¡riù + +__¡»am +,  +__æag +, + +331 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +332 +__gnuc_va_li¡ + +__­ +); + +333  +__vw´štf_chk + ( +__æag +, +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fÜm© +, + +334 +__gnuc_va_li¡ + +__­ +); + +336 #ifdeà +__va_¬g_·ck + + +337 +__ex‹º_®ways_šlše +  + +338 + $w´štf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fmt +, ...) + +340  + `__w´štf_chk + ( +__USE_FORTIFY_LEVEL + - 1, +__fmt +, + `__va_¬g_·ck + ()); + +341 + } +} + +343 +__ex‹º_®ways_šlše +  + +344 + $fw´štf + ( +__FILE + * +__»¡riù + +__¡»am +, +__cÚ¡ + +wch¬_t + *__»¡riù +__fmt +, ...) + +346  + `__fw´štf_chk + ( +__¡»am +, +__USE_FORTIFY_LEVEL + - 1, +__fmt +, + +347 + `__va_¬g_·ck + ()); + +348 + } +} + +349 #–ià! +defšed + +__ýlu¥lus + + +350  + #w´štf +(...) \ + +351 + `__w´štf_chk + ( +__USE_FORTIFY_LEVEL + - 1, +__VA_ARGS__ +) + + ) + +352  + #fw´štf +( +¡»am +, ...) \ + +353 + `__fw´štf_chk + ( +¡»am +, +__USE_FORTIFY_LEVEL + - 1, +__VA_ARGS__ +) + + ) + +356 +__ex‹º_®ways_šlše +  + +357 + $vw´štf + ( +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fmt +, +__gnuc_va_li¡ + +__­ +) + +359  + `__vw´štf_chk + ( +__USE_FORTIFY_LEVEL + - 1, +__fmt +, +__­ +); + +360 + } +} + +362 +__ex‹º_®ways_šlše +  + +363 + $vfw´štf + ( +__FILE + * +__»¡riù + +__¡»am +, + +364 +__cÚ¡ + +wch¬_t + * +__»¡riù + +__fmt +, +__gnuc_va_li¡ + +__­ +) + +366  + `__vfw´štf_chk + ( +__¡»am +, +__USE_FORTIFY_LEVEL + - 1, +__fmt +, +__­ +); + +367 + } +} + +371 +wch¬_t + * + $__fg‘ws_chk + ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__size +,  +__n +, + +372 +__FILE + * +__»¡riù + +__¡»am +è +__wur +; + +373 +wch¬_t + * + `__REDIRECT + ( +__fg‘ws_®Ÿs +, + +374 ( +wch¬_t + * +__»¡riù + +__s +,  +__n +, + +375 +__FILE + * +__»¡riù + +__¡»am +), +fg‘ws +è +__wur +; + +376 +wch¬_t + * + `__REDIRECT + ( +__fg‘ws_chk_w¬n +, + +377 ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__size +,  +__n +, + +378 +__FILE + * +__»¡riù + +__¡»am +), +__fg‘ws_chk +) + +379 +__wur + + `__w¬Ç‰r + ("fgetws called with bigger sizehan†ength " + +382 +__ex‹º_®ways_šlše + +__wur + +wch¬_t + * + +383 + $fg‘ws + ( +wch¬_t + * +__»¡riù + +__s +,  +__n +, +__FILE + *__»¡riù +__¡»am +) + +385 ià( + `__bos + ( +__s +è!ð( +size_t +) -1) + +387 ià(! + `__bužtš_cÚ¡ªt_p + ( +__n +) || __n <= 0) + +388  + `__fg‘ws_chk + ( +__s +, + `__bos + (__sè/  ( +wch¬_t +), + +389 +__n +, +__¡»am +); + +391 ià(( +size_t +è +__n + > + `__bos + ( +__s +è/  ( +wch¬_t +)) + +392  + `__fg‘ws_chk_w¬n + ( +__s +, + `__bos + (__sè/  ( +wch¬_t +), + +393 +__n +, +__¡»am +); + +395  + `__fg‘ws_®Ÿs + ( +__s +, +__n +, +__¡»am +); + +396 + } +} + +398 #ifdeà +__USE_GNU + + +399 +wch¬_t + * + $__fg‘ws_uÆocked_chk + ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__size +, + +400  +__n +, +__FILE + * +__»¡riù + +__¡»am +) + +401 +__wur +; + +402 +wch¬_t + * + `__REDIRECT + ( +__fg‘ws_uÆocked_®Ÿs +, + +403 ( +wch¬_t + * +__»¡riù + +__s +,  +__n +, + +404 +__FILE + * +__»¡riù + +__¡»am +), +fg‘ws_uÆocked +) + +405 +__wur +; + +406 +wch¬_t + * + `__REDIRECT + ( +__fg‘ws_uÆocked_chk_w¬n +, + +407 ( +wch¬_t + * +__»¡riù + +__s +, +size_t + +__size +,  +__n +, + +408 +__FILE + * +__»¡riù + +__¡»am +), + +409 +__fg‘ws_uÆocked_chk +) + +410 +__wur + + `__w¬Ç‰r + ("fgetws_unlocked called with bigger sizehan†ength " + +413 +__ex‹º_®ways_šlše + +__wur + +wch¬_t + * + +414 + $fg‘ws_uÆocked + ( +wch¬_t + * +__»¡riù + +__s +,  +__n +, +__FILE + *__»¡riù +__¡»am +) + +416 ià( + `__bos + ( +__s +è!ð( +size_t +) -1) + +418 ià(! + `__bužtš_cÚ¡ªt_p + ( +__n +) || __n <= 0) + +419  + `__fg‘ws_uÆocked_chk + ( +__s +, + `__bos + (__sè/  ( +wch¬_t +), + +420 +__n +, +__¡»am +); + +422 ià(( +size_t +è +__n + > + `__bos + ( +__s +è/  ( +wch¬_t +)) + +423  + `__fg‘ws_uÆocked_chk_w¬n + ( +__s +, + `__bos + (__sè/  ( +wch¬_t +), + +424 +__n +, +__¡»am +); + +426  + `__fg‘ws_uÆocked_®Ÿs + ( +__s +, +__n +, +__¡»am +); + +427 + } +} + +431 +size_t + + $__wütomb_chk + (* +__s +, +wch¬_t + +__wch¬ +, +mb¡©e_t + * +__p +, + +432 +size_t + +__buæ’ +è +__THROW + +__wur +; + +433 +size_t + + `__REDIRECT_NTH + ( +__wütomb_®Ÿs +, + +434 (* +__»¡riù + +__s +, +wch¬_t + +__wch¬ +, + +435 +mb¡©e_t + * +__»¡riù + +__ps +), +wütomb +è +__wur +; + +437 +__ex‹º_®ways_šlše + +__wur + +size_t + + +438 + `__NTH + ( + $wütomb + (* +__s +, +wch¬_t + +__wch¬ +, +mb¡©e_t + * +__ps +)) + +443  + #__WCHAR_MB_LEN_MAX + 16 + + ) + +444 #ià +defšed + +MB_LEN_MAX + && MB_LEN_MAX !ð +__WCHAR_MB_LEN_MAX + + +447 ià( + `__bos + ( +__s +è!ð( +size_t +è-1 && +__WCHAR_MB_LEN_MAX + > __bos (__s)) + +448  + `__wütomb_chk + ( +__s +, +__wch¬ +, +__ps +, + `__bos + (__s)); + +449  + `__wütomb_®Ÿs + ( +__s +, +__wch¬ +, +__ps +); + +450 + } +} + +453 +size_t + + $__mb¤towcs_chk + ( +wch¬_t + * +__»¡riù + +__d¡ +, + +454 +__cÚ¡ + ** +__»¡riù + +__¤c +, + +455 +size_t + +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +, + +456 +size_t + +__d¡Ën +è +__THROW +; + +457 +size_t + + `__REDIRECT_NTH + ( +__mb¤towcs_®Ÿs +, + +458 ( +wch¬_t + * +__»¡riù + +__d¡ +, + +459 +__cÚ¡ + ** +__»¡riù + +__¤c +, + +460 +size_t + +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +), + +461 +mb¤towcs +); + +462 +size_t + + `__REDIRECT_NTH + ( +__mb¤towcs_chk_w¬n +, + +463 ( +wch¬_t + * +__»¡riù + +__d¡ +, + +464 +__cÚ¡ + ** +__»¡riù + +__¤c +, + +465 +size_t + +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +, + +466 +size_t + +__d¡Ën +), +__mb¤towcs_chk +) + +467 + `__w¬Ç‰r + ("mbsrtowcs called with dst buffer smallerhan†en " + +470 +__ex‹º_®ways_šlše + +size_t + + +471 + `__NTH + ( + $mb¤towcs + ( +wch¬_t + * +__»¡riù + +__d¡ +, +__cÚ¡ + **__»¡riù +__¤c +, + +472 +size_t + +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +)) + +474 ià( + `__bos + ( +__d¡ +è!ð( +size_t +) -1) + +476 ià(! + `__bužtš_cÚ¡ªt_p + ( +__Ën +)) + +477  + `__mb¤towcs_chk + ( +__d¡ +, +__¤c +, +__Ën +, +__ps +, + +478 + `__bos + ( +__d¡ +è/  ( +wch¬_t +)); + +480 ià( +__Ën + > + `__bos + ( +__d¡ +è/  ( +wch¬_t +)) + +481  + `__mb¤towcs_chk_w¬n + ( +__d¡ +, +__¤c +, +__Ën +, +__ps +, + +482 + `__bos + ( +__d¡ +è/  ( +wch¬_t +)); + +484  + `__mb¤towcs_®Ÿs + ( +__d¡ +, +__¤c +, +__Ën +, +__ps +); + +485 + } +} + +488 +size_t + + $__wc¤tombs_chk + (* +__»¡riù + +__d¡ +, + +489 +__cÚ¡ + +wch¬_t + ** +__»¡riù + +__¤c +, + +490 +size_t + +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +, + +491 +size_t + +__d¡Ën +è +__THROW +; + +492 +size_t + + `__REDIRECT_NTH + ( +__wc¤tombs_®Ÿs +, + +493 (* +__»¡riù + +__d¡ +, + +494 +__cÚ¡ + +wch¬_t + ** +__»¡riù + +__¤c +, + +495 +size_t + +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +), + +496 +wc¤tombs +); + +497 +size_t + + `__REDIRECT_NTH + ( +__wc¤tombs_chk_w¬n +, + +498 (* +__»¡riù + +__d¡ +, + +499 +__cÚ¡ + +wch¬_t + ** +__»¡riù + +__¤c +, + +500 +size_t + +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +, + +501 +size_t + +__d¡Ën +), +__wc¤tombs_chk +) + +502 + `__w¬Ç‰r + ("wcsrtombs called with dst buffer smallerhan†en"); + +504 +__ex‹º_®ways_šlše + +size_t + + +505 + `__NTH + ( + $wc¤tombs + (* +__»¡riù + +__d¡ +, +__cÚ¡ + +wch¬_t + **__»¡riù +__¤c +, + +506 +size_t + +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +)) + +508 ià( + `__bos + ( +__d¡ +è!ð( +size_t +) -1) + +510 ià(! + `__bužtš_cÚ¡ªt_p + ( +__Ën +)) + +511  + `__wc¤tombs_chk + ( +__d¡ +, +__¤c +, +__Ën +, +__ps +, + `__bos + (__dst)); + +513 ià( +__Ën + > + `__bos + ( +__d¡ +)) + +514  + `__wc¤tombs_chk_w¬n + ( +__d¡ +, +__¤c +, +__Ën +, +__ps +, + `__bos + (__dst)); + +516  + `__wc¤tombs_®Ÿs + ( +__d¡ +, +__¤c +, +__Ën +, +__ps +); + +517 + } +} + +520 #ifdeà +__USE_GNU + + +521 +size_t + + $__mb¢¹owcs_chk + ( +wch¬_t + * +__»¡riù + +__d¡ +, + +522 +__cÚ¡ + ** +__»¡riù + +__¤c +, +size_t + +__nmc +, + +523 +size_t + +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +, + +524 +size_t + +__d¡Ën +è +__THROW +; + +525 +size_t + + `__REDIRECT_NTH + ( +__mb¢¹owcs_®Ÿs +, + +526 ( +wch¬_t + * +__»¡riù + +__d¡ +, + +527 +__cÚ¡ + ** +__»¡riù + +__¤c +, +size_t + +__nmc +, + +528 +size_t + +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +), + +529 +mb¢¹owcs +); + +530 +size_t + + `__REDIRECT_NTH + ( +__mb¢¹owcs_chk_w¬n +, + +531 ( +wch¬_t + * +__»¡riù + +__d¡ +, + +532 +__cÚ¡ + ** +__»¡riù + +__¤c +, +size_t + +__nmc +, + +533 +size_t + +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +, + +534 +size_t + +__d¡Ën +), +__mb¢¹owcs_chk +) + +535 + `__w¬Ç‰r + ("mbsnrtowcs called with dst buffer smallerhan†en " + +538 +__ex‹º_®ways_šlše + +size_t + + +539 + `__NTH + ( + $mb¢¹owcs + ( +wch¬_t + * +__»¡riù + +__d¡ +, +__cÚ¡ + **__»¡riù +__¤c +, + +540 +size_t + +__nmc +, size_ˆ +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +)) + +542 ià( + `__bos + ( +__d¡ +è!ð( +size_t +) -1) + +544 ià(! + `__bužtš_cÚ¡ªt_p + ( +__Ën +)) + +545  + `__mb¢¹owcs_chk + ( +__d¡ +, +__¤c +, +__nmc +, +__Ën +, +__ps +, + +546 + `__bos + ( +__d¡ +è/  ( +wch¬_t +)); + +548 ià( +__Ën + > + `__bos + ( +__d¡ +è/  ( +wch¬_t +)) + +549  + `__mb¢¹owcs_chk_w¬n + ( +__d¡ +, +__¤c +, +__nmc +, +__Ën +, +__ps +, + +550 + `__bos + ( +__d¡ +è/  ( +wch¬_t +)); + +552  + `__mb¢¹owcs_®Ÿs + ( +__d¡ +, +__¤c +, +__nmc +, +__Ën +, +__ps +); + +553 + } +} + +556 +size_t + + $__wc¢¹ombs_chk + (* +__»¡riù + +__d¡ +, + +557 +__cÚ¡ + +wch¬_t + ** +__»¡riù + +__¤c +, + +558 +size_t + +__nwc +, size_ˆ +__Ën +, + +559 +mb¡©e_t + * +__»¡riù + +__ps +, +size_t + +__d¡Ën +) + +560 +__THROW +; + +561 +size_t + + `__REDIRECT_NTH + ( +__wc¢¹ombs_®Ÿs +, + +562 (* +__»¡riù + +__d¡ +, + +563 +__cÚ¡ + +wch¬_t + ** +__»¡riù + +__¤c +, + +564 +size_t + +__nwc +, size_ˆ +__Ën +, + +565 +mb¡©e_t + * +__»¡riù + +__ps +), +wc¢¹ombs +); + +566 +size_t + + `__REDIRECT_NTH + ( +__wc¢¹ombs_chk_w¬n +, + +567 (* +__»¡riù + +__d¡ +, + +568 +__cÚ¡ + +wch¬_t + ** +__»¡riù + +__¤c +, + +569 +size_t + +__nwc +, size_ˆ +__Ën +, + +570 +mb¡©e_t + * +__»¡riù + +__ps +, + +571 +size_t + +__d¡Ën +), +__wc¢¹ombs_chk +) + +572 + `__w¬Ç‰r + ("wcsnrtombs called with dst buffer smallerhan†en"); + +574 +__ex‹º_®ways_šlše + +size_t + + +575 + `__NTH + ( + $wc¢¹ombs + (* +__»¡riù + +__d¡ +, +__cÚ¡ + +wch¬_t + **__»¡riù +__¤c +, + +576 +size_t + +__nwc +, size_ˆ +__Ën +, +mb¡©e_t + * +__»¡riù + +__ps +)) + +578 ià( + `__bos + ( +__d¡ +è!ð( +size_t +) -1) + +580 ià(! + `__bužtš_cÚ¡ªt_p + ( +__Ën +)) + +581  + `__wc¢¹ombs_chk + ( +__d¡ +, +__¤c +, +__nwc +, +__Ën +, +__ps +, + +582 + `__bos + ( +__d¡ +)); + +584 ià( +__Ën + > + `__bos + ( +__d¡ +)) + +585  + `__wc¢¹ombs_chk_w¬n + ( +__d¡ +, +__¤c +, +__nwc +, +__Ën +, +__ps +, + +586 + `__bos + ( +__d¡ +)); + +588  + `__wc¢¹ombs_®Ÿs + ( +__d¡ +, +__¤c +, +__nwc +, +__Ën +, +__ps +); + +589 + } +} + + @/usr/include/errno.h + +23 #iâdef +_ERRNO_H + + +27 #iâdef +__Ãed_Em©h + + +28  + #_ERRNO_H + 1 + + ) + +29  + ~<ã©u»s.h +> + +32 + g__BEGIN_DECLS + + +36  + ~ + +37 #undeà +__Ãed_Em©h + + +39 #ifdef +_ERRNO_H + + +46 #iâdef +”ºo + + +47  +”ºo +; + +50 #ifdeà +__USE_GNU + + +55 * +´og¿m_švoÿtiÚ_Çme +, * +´og¿m_švoÿtiÚ_shÜt_Çme +; + +59 + g__END_DECLS + + +67 #ià +defšed + +__USE_GNU + || defšed +__Ãed_”rÜ_t + + +68 #iâdeà +__”rÜ_t_defšed + + +69  + t”rÜ_t +; + +70  + #__”rÜ_t_defšed + 1 + + ) + +72 #undeà +__Ãed_”rÜ_t + + + @/usr/include/gnu/option-groups.h + +10 #iâdeà +__GNU_OPTION_GROUPS_H + + +11  + #__GNU_OPTION_GROUPS_H + + + ) + +13  + #__OPTION_EGLIBC_ADVANCED_INET6 + 1 + + ) + +14  + #__OPTION_EGLIBC_BACKTRACE + 1 + + ) + +15  + #__OPTION_EGLIBC_BIG_MACROS + 1 + + ) + +16  + #__OPTION_EGLIBC_BSD + 1 + + ) + +17  + #__OPTION_EGLIBC_CATGETS + 1 + + ) + +18  + #__OPTION_EGLIBC_CHARSETS + 1 + + ) + +19  + #__OPTION_EGLIBC_CXX_TESTS + 1 + + ) + +20  + #__OPTION_EGLIBC_DB_ALIASES + 1 + + ) + +21  + #__OPTION_EGLIBC_ENVZ + 1 + + ) + +22  + #__OPTION_EGLIBC_FCVT + 1 + + ) + +23  + #__OPTION_EGLIBC_FMTMSG + 1 + + ) + +24  + #__OPTION_EGLIBC_FSTAB + 1 + + ) + +25  + #__OPTION_EGLIBC_FTRAVERSE + 1 + + ) + +26  + #__OPTION_EGLIBC_GETLOGIN + 1 + + ) + +27  + #__OPTION_EGLIBC_INET + 1 + + ) + +28  + #__OPTION_EGLIBC_LIBM + 1 + + ) + +29  + #__OPTION_EGLIBC_LOCALES + 1 + + ) + +30  + #__OPTION_EGLIBC_LOCALE_CODE + 1 + + ) + +31  + #__OPTION_EGLIBC_MEMUSAGE + 1 + + ) + +32  + #__OPTION_EGLIBC_NIS + 1 + + ) + +33  + #__OPTION_EGLIBC_NSSWITCH + 1 + + ) + +34  + #__OPTION_EGLIBC_RCMD + 1 + + ) + +35  + #__OPTION_EGLIBC_SPAWN + 1 + + ) + +36  + #__OPTION_EGLIBC_STREAMS + 1 + + ) + +37  + #__OPTION_EGLIBC_SUNRPC + 1 + + ) + +38  + #__OPTION_EGLIBC_UTMP + 1 + + ) + +39  + #__OPTION_EGLIBC_UTMPX + 1 + + ) + +40  + #__OPTION_EGLIBC_WORDEXP + 1 + + ) + +41  + #__OPTION_POSIX_C_LANG_WIDE_CHAR + 1 + + ) + +42  + #__OPTION_POSIX_REGEXP + 1 + + ) + +43  + #__OPTION_POSIX_REGEXP_GLIBC + 1 + + ) + +44  + #__OPTION_POSIX_WIDE_CHAR_DEVICE_IO + 1 + + ) + + @/usr/include/pthread.h + +20 #iâdeà +_PTHREAD_H + + +21  + #_PTHREAD_H + 1 + + ) + +23  + ~<ã©u»s.h +> + +24  + ~<’dŸn.h +> + +25  + ~ + +26  + ~ + +28  + #__Ãed_sig£t_t + + + ) + +29  + ~ + +30  + ~ + +31  + ~ + +32  + ~ + +38 + mPTHREAD_CREATE_JOINABLE +, + +39  + #PTHREAD_CREATE_JOINABLE + +PTHREAD_CREATE_JOINABLE + + + ) + +40 + mPTHREAD_CREATE_DETACHED + + +41  + #PTHREAD_CREATE_DETACHED + +PTHREAD_CREATE_DETACHED + + + ) + +48 + mPTHREAD_MUTEX_TIMED_NP +, + +49 + mPTHREAD_MUTEX_RECURSIVE_NP +, + +50 + mPTHREAD_MUTEX_ERRORCHECK_NP +, + +51 + mPTHREAD_MUTEX_ADAPTIVE_NP + + +52 #ifdeà +__USE_UNIX98 + + +54 + mPTHREAD_MUTEX_NORMAL + = +PTHREAD_MUTEX_TIMED_NP +, + +55 + mPTHREAD_MUTEX_RECURSIVE + = +PTHREAD_MUTEX_RECURSIVE_NP +, + +56 + mPTHREAD_MUTEX_ERRORCHECK + = +PTHREAD_MUTEX_ERRORCHECK_NP +, + +57 + mPTHREAD_MUTEX_DEFAULT + = +PTHREAD_MUTEX_NORMAL + + +59 #ifdeà +__USE_GNU + + +61 , + mPTHREAD_MUTEX_FAST_NP + = +PTHREAD_MUTEX_TIMED_NP + + +66 #ifdeà +__USE_XOPEN2K + + +70 + mPTHREAD_MUTEX_STALLED +, + +71 + mPTHREAD_MUTEX_STALLED_NP + = +PTHREAD_MUTEX_STALLED +, + +72 + mPTHREAD_MUTEX_ROBUST +, + +73 + mPTHREAD_MUTEX_ROBUST_NP + = +PTHREAD_MUTEX_ROBUST + + +78 #ifdeà +__USE_UNIX98 + + +82 + mPTHREAD_PRIO_NONE +, + +83 + mPTHREAD_PRIO_INHERIT +, + +84 + mPTHREAD_PRIO_PROTECT + + +90 #ià +__WORDSIZE + == 64 + +91  + #PTHREAD_MUTEX_INITIALIZER + \ + +92 { { 0, 0, 0, 0, 0, 0, { 0, 0 } } } + + ) + +93 #ifdeà +__USE_GNU + + +94  + #PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP + \ + +95 { { 0, 0, 0, 0, +PTHREAD_MUTEX_RECURSIVE_NP +, 0, { 0, 0 } } } + + ) + +96  + #PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP + \ + +97 { { 0, 0, 0, 0, +PTHREAD_MUTEX_ERRORCHECK_NP +, 0, { 0, 0 } } } + + ) + +98  + #PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP + \ + +99 { { 0, 0, 0, 0, +PTHREAD_MUTEX_ADAPTIVE_NP +, 0, { 0, 0 } } } + + ) + +102  + #PTHREAD_MUTEX_INITIALIZER + \ + +103 { { 0, 0, 0, 0, 0, { 0 } } } + + ) + +104 #ifdeà +__USE_GNU + + +105  + #PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP + \ + +106 { { 0, 0, 0, +PTHREAD_MUTEX_RECURSIVE_NP +, 0, { 0 } } } + + ) + +107  + #PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP + \ + +108 { { 0, 0, 0, +PTHREAD_MUTEX_ERRORCHECK_NP +, 0, { 0 } } } + + ) + +109  + #PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP + \ + +110 { { 0, 0, 0, +PTHREAD_MUTEX_ADAPTIVE_NP +, 0, { 0 } } } + + ) + +116 #ià +defšed + +__USE_UNIX98 + || defšed +__USE_XOPEN2K + + +119 + mPTHREAD_RWLOCK_PREFER_READER_NP +, + +120 + mPTHREAD_RWLOCK_PREFER_WRITER_NP +, + +121 + mPTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP +, + +122 + mPTHREAD_RWLOCK_DEFAULT_NP + = +PTHREAD_RWLOCK_PREFER_READER_NP + + +126  + #PTHREAD_RWLOCK_INITIALIZER + \ + +127 { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } + + ) + +128 #ifdeà +__USE_GNU + + +129 #ià +__WORDSIZE + == 64 + +130  + #PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP + \ + +132 +PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP + } } + + ) + +134 #ià +__BYTE_ORDER + =ð +__LITTLE_ENDIAN + + +135  + #PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP + \ + +136 { { 0, 0, 0, 0, 0, 0, +PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP +, \ + +137 0, 0, 0, 0 } } + + ) + +139  + #PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP + \ + +140 { { 0, 0, 0, 0, 0, 0, 0, 0, 0, +PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP +,\ + +141 0 } } + + ) + +151 + mPTHREAD_INHERIT_SCHED +, + +152  + #PTHREAD_INHERIT_SCHED + +PTHREAD_INHERIT_SCHED + + + ) + +153 + mPTHREAD_EXPLICIT_SCHED + + +154  + #PTHREAD_EXPLICIT_SCHED + +PTHREAD_EXPLICIT_SCHED + + + ) + +161 + mPTHREAD_SCOPE_SYSTEM +, + +162  + #PTHREAD_SCOPE_SYSTEM + +PTHREAD_SCOPE_SYSTEM + + + ) + +163 + mPTHREAD_SCOPE_PROCESS + + +164  + #PTHREAD_SCOPE_PROCESS + +PTHREAD_SCOPE_PROCESS + + + ) + +171 + mPTHREAD_PROCESS_PRIVATE +, + +172  + #PTHREAD_PROCESS_PRIVATE + +PTHREAD_PROCESS_PRIVATE + + + ) + +173 + mPTHREAD_PROCESS_SHARED + + +174  + #PTHREAD_PROCESS_SHARED + +PTHREAD_PROCESS_SHARED + + + ) + +180  + #PTHREAD_COND_INITIALIZER + { { 0, 0, 0, 0, 0, (*è0, 0, 0 } } + + ) + +184  + s_±h»ad_þ—nup_bufãr + + +186 (* + m__routše +) (*); + +187 * + m__¬g +; + +188  + m__ÿnûÉy³ +; + +189  +_±h»ad_þ—nup_bufãr + * + m__´ev +; + +195 + mPTHREAD_CANCEL_ENABLE +, + +196  + #PTHREAD_CANCEL_ENABLE + +PTHREAD_CANCEL_ENABLE + + + ) + +197 + mPTHREAD_CANCEL_DISABLE + + +198  + #PTHREAD_CANCEL_DISABLE + +PTHREAD_CANCEL_DISABLE + + + ) + +202 + mPTHREAD_CANCEL_DEFERRED +, + +203  + #PTHREAD_CANCEL_DEFERRED + +PTHREAD_CANCEL_DEFERRED + + + ) + +204 + mPTHREAD_CANCEL_ASYNCHRONOUS + + +205  + #PTHREAD_CANCEL_ASYNCHRONOUS + +PTHREAD_CANCEL_ASYNCHRONOUS + + + ) + +207  + #PTHREAD_CANCELED + ((*è-1) + + ) + +211  + #PTHREAD_ONCE_INIT + 0 + + ) + +214 #ifdeà +__USE_XOPEN2K + + +218  + #PTHREAD_BARRIER_SERIAL_THREAD + -1 + + ) + +222 +__BEGIN_DECLS + + +227  +±h»ad_ü—‹ + ( +±h»ad_t + * +__»¡riù + +__Ãwth»ad +, + +228 +__cÚ¡ + +±h»ad_©Œ_t + * +__»¡riù + +__©Œ +, + +229 *(* +__¡¬t_routše +) (*), + +230 * +__»¡riù + +__¬g +è +__THROW + +__nÚnuÎ + ((1, 3)); + +236  + $±h»ad_ex™ + (* +__»tv® +è + `__©Œibu‹__ + (( +__nÜ‘uº__ +)); + +244  + `±h»ad_još + ( +±h»ad_t + +__th +, ** +__th»ad_»tuº +); + +246 #ifdeà +__USE_GNU + + +249  + $±h»ad_Œyjoš_Å + ( +±h»ad_t + +__th +, ** +__th»ad_»tuº +è +__THROW +; + +257  + `±h»ad_timedjoš_Å + ( +±h»ad_t + +__th +, ** +__th»ad_»tuº +, + +258 +__cÚ¡ +  +time¥ec + * +__ab¡ime +); + +265  + $±h»ad_d‘ach + ( +±h»ad_t + +__th +è +__THROW +; + +269 +±h»ad_t + + $±h»ad_£lf + (è +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +272  + $±h»ad_equ® + ( +±h»ad_t + +__th»ad1 +,…th»ad_ˆ +__th»ad2 +è +__THROW +; + +280  + $±h»ad_©Œ_š™ + ( +±h»ad_©Œ_t + * +__©Œ +è +__THROW + + `__nÚnuÎ + ((1)); + +283  + $±h»ad_©Œ_de¡roy + ( +±h»ad_©Œ_t + * +__©Œ +) + +284 +__THROW + + `__nÚnuÎ + ((1)); + +287  + $±h»ad_©Œ_g‘d‘ach¡©e + ( +__cÚ¡ + +±h»ad_©Œ_t + * +__©Œ +, + +288 * +__d‘ach¡©e +) + +289 +__THROW + + `__nÚnuÎ + ((1, 2)); + +292  + $±h»ad_©Œ_£td‘ach¡©e + ( +±h»ad_©Œ_t + * +__©Œ +, + +293  +__d‘ach¡©e +) + +294 +__THROW + + `__nÚnuÎ + ((1)); + +298  + $±h»ad_©Œ_g‘gu¬dsize + ( +__cÚ¡ + +±h»ad_©Œ_t + * +__©Œ +, + +299 +size_t + * +__gu¬dsize +) + +300 +__THROW + + `__nÚnuÎ + ((1, 2)); + +303  + $±h»ad_©Œ_£tgu¬dsize + ( +±h»ad_©Œ_t + * +__©Œ +, + +304 +size_t + +__gu¬dsize +) + +305 +__THROW + + `__nÚnuÎ + ((1)); + +309  + $±h»ad_©Œ_g‘sched·¿m + ( +__cÚ¡ + +±h»ad_©Œ_t + * +__»¡riù + + +310 +__©Œ +, + +311  +sched_·¿m + * +__»¡riù + +__·¿m +) + +312 +__THROW + + `__nÚnuÎ + ((1, 2)); + +315  + $±h»ad_©Œ_£tsched·¿m + ( +±h»ad_©Œ_t + * +__»¡riù + +__©Œ +, + +316 +__cÚ¡ +  +sched_·¿m + * +__»¡riù + + +317 +__·¿m +è +__THROW + + `__nÚnuÎ + ((1, 2)); + +320  + $±h»ad_©Œ_g‘schedpÞicy + ( +__cÚ¡ + +±h»ad_©Œ_t + * +__»¡riù + + +321 +__©Œ +, * +__»¡riù + +__pÞicy +) + +322 +__THROW + + `__nÚnuÎ + ((1, 2)); + +325  + $±h»ad_©Œ_£tschedpÞicy + ( +±h»ad_©Œ_t + * +__©Œ +,  +__pÞicy +) + +326 +__THROW + + `__nÚnuÎ + ((1)); + +329  + $±h»ad_©Œ_g‘šh”™sched + ( +__cÚ¡ + +±h»ad_©Œ_t + * +__»¡riù + + +330 +__©Œ +, * +__»¡riù + +__šh”™ +) + +331 +__THROW + + `__nÚnuÎ + ((1, 2)); + +334  + $±h»ad_©Œ_£tšh”™sched + ( +±h»ad_©Œ_t + * +__©Œ +, + +335  +__šh”™ +) + +336 +__THROW + + `__nÚnuÎ + ((1)); + +340  + $±h»ad_©Œ_g‘scÝe + ( +__cÚ¡ + +±h»ad_©Œ_t + * +__»¡riù + +__©Œ +, + +341 * +__»¡riù + +__scÝe +) + +342 +__THROW + + `__nÚnuÎ + ((1, 2)); + +345  + $±h»ad_©Œ_£tscÝe + ( +±h»ad_©Œ_t + * +__©Œ +,  +__scÝe +) + +346 +__THROW + + `__nÚnuÎ + ((1)); + +349  + $±h»ad_©Œ_g‘¡ackaddr + ( +__cÚ¡ + +±h»ad_©Œ_t + * +__»¡riù + + +350 +__©Œ +, ** +__»¡riù + +__¡ackaddr +) + +351 +__THROW + + `__nÚnuÎ + ((1, 2)è +__©Œibu‹_d•»ÿ‹d__ +; + +357  + $±h»ad_©Œ_£t¡ackaddr + ( +±h»ad_©Œ_t + * +__©Œ +, + +358 * +__¡ackaddr +) + +359 +__THROW + + `__nÚnuÎ + ((1)è +__©Œibu‹_d•»ÿ‹d__ +; + +362  + $±h»ad_©Œ_g‘¡acksize + ( +__cÚ¡ + +±h»ad_©Œ_t + * +__»¡riù + + +363 +__©Œ +, +size_t + * +__»¡riù + +__¡acksize +) + +364 +__THROW + + `__nÚnuÎ + ((1, 2)); + +369  + $±h»ad_©Œ_£t¡acksize + ( +±h»ad_©Œ_t + * +__©Œ +, + +370 +size_t + +__¡acksize +) + +371 +__THROW + + `__nÚnuÎ + ((1)); + +373 #ifdeà +__USE_XOPEN2K + + +375  + $±h»ad_©Œ_g‘¡ack + ( +__cÚ¡ + +±h»ad_©Œ_t + * +__»¡riù + +__©Œ +, + +376 ** +__»¡riù + +__¡ackaddr +, + +377 +size_t + * +__»¡riù + +__¡acksize +) + +378 +__THROW + + `__nÚnuÎ + ((1, 2, 3)); + +383  + $±h»ad_©Œ_£t¡ack + ( +±h»ad_©Œ_t + * +__©Œ +, * +__¡ackaddr +, + +384 +size_t + +__¡acksize +è +__THROW + + `__nÚnuÎ + ((1)); + +387 #ifdeà +__USE_GNU + + +390  + $±h»ad_©Œ_£ffš™y_Å + ( +±h»ad_©Œ_t + * +__©Œ +, + +391 +size_t + +__ýu£tsize +, + +392 +__cÚ¡ + +ýu_£t_t + * +__ýu£t +) + +393 +__THROW + + `__nÚnuÎ + ((1, 3)); + +397  + $±h»ad_©Œ_g‘affš™y_Å + ( +__cÚ¡ + +±h»ad_©Œ_t + * +__©Œ +, + +398 +size_t + +__ýu£tsize +, + +399 +ýu_£t_t + * +__ýu£t +) + +400 +__THROW + + `__nÚnuÎ + ((1, 3)); + +406  + $±h»ad_g‘©Œ_Å + ( +±h»ad_t + +__th +, +±h»ad_©Œ_t + * +__©Œ +) + +407 +__THROW + + `__nÚnuÎ + ((2)); + +415  + $±h»ad_£tsched·¿m + ( +±h»ad_t + +__rg‘_th»ad +,  +__pÞicy +, + +416 +__cÚ¡ +  +sched_·¿m + * +__·¿m +) + +417 +__THROW + + `__nÚnuÎ + ((3)); + +420  + $±h»ad_g‘sched·¿m + ( +±h»ad_t + +__rg‘_th»ad +, + +421 * +__»¡riù + +__pÞicy +, + +422  +sched_·¿m + * +__»¡riù + +__·¿m +) + +423 +__THROW + + `__nÚnuÎ + ((2, 3)); + +426  + $±h»ad_£tsched´io + ( +±h»ad_t + +__rg‘_th»ad +,  +__´io +) + +427 +__THROW +; + +430 #ifdeà +__USE_UNIX98 + + +432  + $±h»ad_g‘cÚcu¼’cy + (è +__THROW +; + +435  + $±h»ad_£tcÚcu¼’cy + ( +__Ëv– +è +__THROW +; + +438 #ifdeà +__USE_GNU + + +443  + $±h»ad_y›ld + (è +__THROW +; + +448  + $±h»ad_£ffš™y_Å + ( +±h»ad_t + +__th +, +size_t + +__ýu£tsize +, + +449 +__cÚ¡ + +ýu_£t_t + * +__ýu£t +) + +450 +__THROW + + `__nÚnuÎ + ((3)); + +453  + $±h»ad_g‘affš™y_Å + ( +±h»ad_t + +__th +, +size_t + +__ýu£tsize +, + +454 +ýu_£t_t + * +__ýu£t +) + +455 +__THROW + + `__nÚnuÎ + ((3)); + +468  + `±h»ad_Úû + ( +±h»ad_Úû_t + * +__Úû_cÚŒÞ +, + +469 (* +__š™_routše +è()è + `__nÚnuÎ + ((1, 2)); + +480  + `±h»ad_£tÿnûl¡©e + ( +__¡©e +, * +__Þd¡©e +); + +484  + `±h»ad_£tÿnûÉy³ + ( +__ty³ +, * +__Þdty³ +); + +487  + `±h»ad_ÿnûl + ( +±h»ad_t + +__th +); + +492  + `±h»ad_‹¡ÿnûl + (); + +501 +__jmp_buf + +__ÿnûl_jmp_buf +; + +502  +__mask_was_§ved +; + +503 } +__ÿnûl_jmp_buf +[1]; + +504 * +__·d +[4]; + +505 } + t__±h»ad_unwšd_buf_t + + t__©Œibu‹__ + (( + t__®igÃd__ +)); + +508 #iâdeà +__þ—nup_fù_©Œibu‹ + + +509  + #__þ—nup_fù_©Œibu‹ + + + ) + +514  + s__±h»ad_þ—nup_äame + + +516 (* +__ÿnûl_routše +) (*); + +517 * +__ÿnûl_¬g +; + +518  +__do_™ +; + +519  +__ÿnûl_ty³ +; + +522 #ià +defšed + +__GNUC__ + && defšed +__EXCEPTIONS + + +523 #ifdeà +__ýlu¥lus + + +525 þas  + c__±h»ad_þ—nup_þass + + +527 (* +__ÿnûl_routše +) (*); + +528 * +__ÿnûl_¬g +; + +529  +__do_™ +; + +530  +__ÿnûl_ty³ +; + +532 +public +: + +533 + `__±h»ad_þ—nup_þass + ((* +__fù +è(*), * +__¬g +) + +534 : + `__ÿnûl_routše + ( +__fù +), + `__ÿnûl_¬g + ( +__¬g +), + $__do_™ + (1) { } + +535 ~ + $__±h»ad_þ—nup_þass + (è{ ià( +__do_™ +è + `__ÿnûl_routše + ( +__ÿnûl_¬g +); + } +} + +536  + $__£tdo™ + ( +__Ãwv® +è{ +__do_™ + = __Ãwv®; + } +} + +537  + $__deãr + (è{ + `±h»ad_£tÿnûÉy³ + ( +PTHREAD_CANCEL_DEFERRED +, + +538 & +__ÿnûl_ty³ +); + } +} + +539  + $__»¡Üe + (ècÚ¡ { + `±h»ad_£tÿnûÉy³ + ( +__ÿnûl_ty³ +, 0); + } +} + +549  + #±h»ad_þ—nup_push +( +routše +, +¬g +) \ + +551 +__±h»ad_þ—nup_þass + + `__þäame + ( +routše +, +¬g +) + + ) + +555  + #±h»ad_þ—nup_pÝ +( +execu‹ +) \ + +556 +__þäame +. + `__£tdo™ + ( +execu‹ +); \ + +557 } 0) + + ) + +559 #ifdeà +__USE_GNU + + +563  + #±h»ad_þ—nup_push_deãr_Å +( +routše +, +¬g +) \ + +565 +__±h»ad_þ—nup_þass + + `__þäame + ( +routše +, +¬g +); \ + +566 +__þäame +. + `__deãr + () + + ) + +571  + #±h»ad_þ—nup_pÝ_»¡Üe_Å +( +execu‹ +) \ + +572 +__þäame +. + `__»¡Üe + (); \ + +573 +__þäame +. + `__£tdo™ + ( +execu‹ +); \ + +574 } 0) + + ) + +581 +__ex‹º_šlše +  + +582 + $__±h»ad_þ—nup_routše + ( +__±h»ad_þ—nup_äame + * +__äame +) + +584 ià( +__äame +-> +__do_™ +) + +585 +__äame +-> + `__ÿnûl_routše + (__äame-> +__ÿnûl_¬g +); + +586 + } +} + +595  + #±h»ad_þ—nup_push +( +routše +, +¬g +) \ + +597  +__±h»ad_þ—nup_äame + +__þäame + \ + +598 + `__©Œibu‹__ + (( + `__þ—nup__ + ( +__±h»ad_þ—nup_routše +))) \ + +599 ð{ . +__ÿnûl_routše + = ( +routše +), . +__ÿnûl_¬g + = ( +¬g +), \ + +600 . +__do_™ + = 1 }; + + ) + +604  + #±h»ad_þ—nup_pÝ +( +execu‹ +) \ + +605 +__þäame +. +__do_™ + = ( +execu‹ +); \ + +606 } 0) + + ) + +608 #ifdeà +__USE_GNU + + +612  + #±h»ad_þ—nup_push_deãr_Å +( +routše +, +¬g +) \ + +614  +__±h»ad_þ—nup_äame + +__þäame + \ + +615 + `__©Œibu‹__ + (( + `__þ—nup__ + ( +__±h»ad_þ—nup_routše +))) \ + +616 ð{ . +__ÿnûl_routše + = ( +routše +), . +__ÿnûl_¬g + = ( +¬g +), \ + +617 . +__do_™ + = 1 }; \ + +618 (è + `±h»ad_£tÿnûÉy³ + ( +PTHREAD_CANCEL_DEFERRED +, \ + +619 & +__þäame +. +__ÿnûl_ty³ +) + + ) + +624  + #±h»ad_þ—nup_pÝ_»¡Üe_Å +( +execu‹ +) \ + +625 (è + `±h»ad_£tÿnûÉy³ + ( +__þäame +. +__ÿnûl_ty³ +, +NULL +); \ + +626 +__þäame +. +__do_™ + = ( +execu‹ +); \ + +627 } 0) + + ) + +638  + #±h»ad_þ—nup_push +( +routše +, +¬g +) \ + +640 +__±h»ad_unwšd_buf_t + +__ÿnûl_buf +; \ + +641 (* +__ÿnûl_routše +è(*èð( +routše +); \ + +642 * +__ÿnûl_¬g + = ( +¬g +); \ + +643  +nÙ_fœ¡_ÿÎ + = + `__sig£tjmp + (( +__jmp_buf_g + *) (*) \ + +644 +__ÿnûl_buf +. +__ÿnûl_jmp_buf +, 0); \ + +645 ià( + `__bužtš_ex³ù + ( +nÙ_fœ¡_ÿÎ +, 0)) \ + +647 + `__ÿnûl_routše + ( +__ÿnûl_¬g +); \ + +648 + `__±h»ad_unwšd_Ãxt + (& +__ÿnûl_buf +); \ + +652 + `__±h»ad_»gi¡”_ÿnûl + (& +__ÿnûl_buf +); \ + +653 dØ{ + + ) + +654  +__±h»ad_»gi¡”_ÿnûl + ( +__±h»ad_unwšd_buf_t + * +__buf +) + +655 +__þ—nup_fù_©Œibu‹ +; + +659  + #±h»ad_þ—nup_pÝ +( +execu‹ +) \ + +662 + `__±h»ad_uÄegi¡”_ÿnûl + (& +__ÿnûl_buf +); \ + +663 ià( +execu‹ +) \ + +664 + `__ÿnûl_routše + ( +__ÿnûl_¬g +); \ + +665 } 0) + + ) + +666  + $__±h»ad_uÄegi¡”_ÿnûl + ( +__±h»ad_unwšd_buf_t + * +__buf +) + +667 +__þ—nup_fù_©Œibu‹ +; + +669 #ifdeà +__USE_GNU + + +673  + #±h»ad_þ—nup_push_deãr_Å +( +routše +, +¬g +) \ + +675 +__±h»ad_unwšd_buf_t + +__ÿnûl_buf +; \ + +676 (* +__ÿnûl_routše +è(*èð( +routše +); \ + +677 * +__ÿnûl_¬g + = ( +¬g +); \ + +678  +nÙ_fœ¡_ÿÎ + = + `__sig£tjmp + (( +__jmp_buf_g + *) (*) \ + +679 +__ÿnûl_buf +. +__ÿnûl_jmp_buf +, 0); \ + +680 ià( + `__bužtš_ex³ù + ( +nÙ_fœ¡_ÿÎ +, 0)) \ + +682 + `__ÿnûl_routše + ( +__ÿnûl_¬g +); \ + +683 + `__±h»ad_unwšd_Ãxt + (& +__ÿnûl_buf +); \ + +687 + `__±h»ad_»gi¡”_ÿnûl_deãr + (& +__ÿnûl_buf +); \ + +688 dØ{ + + ) + +689  + `__±h»ad_»gi¡”_ÿnûl_deãr + ( +__±h»ad_unwšd_buf_t + * +__buf +) + +690 +__þ—nup_fù_©Œibu‹ +; + +695  + #±h»ad_þ—nup_pÝ_»¡Üe_Å +( +execu‹ +) \ + +698 + `__±h»ad_uÄegi¡”_ÿnûl_»¡Üe + (& +__ÿnûl_buf +); \ + +699 ià( +execu‹ +) \ + +700 + `__ÿnûl_routše + ( +__ÿnûl_¬g +); \ + +701 + } +} 0) + + ) + +702  + $__±h»ad_uÄegi¡”_ÿnûl_»¡Üe + ( +__±h»ad_unwšd_buf_t + * +__buf +) + +703 +__þ—nup_fù_©Œibu‹ +; + +707  + $__±h»ad_unwšd_Ãxt + ( +__±h»ad_unwšd_buf_t + * +__buf +) + +708 +__þ—nup_fù_©Œibu‹ + + `__©Œibu‹__ + (( +__nÜ‘uº__ +)) + +709 #iâdeà +SHARED + + +710 + `__©Œibu‹__ + (( +__w—k__ +)) + +716  +__jmp_buf_g +; + +717  + $__sig£tjmp + ( +__jmp_buf_g + * +__’v +,  +__§vemask +è +__THROW +; + +723  + $±h»ad_mu‹x_š™ + ( +±h»ad_mu‹x_t + * +__mu‹x +, + +724 +__cÚ¡ + +±h»ad_mu‹x©Œ_t + * +__mu‹x©Œ +) + +725 +__THROW + + `__nÚnuÎ + ((1)); + +728  + $±h»ad_mu‹x_de¡roy + ( +±h»ad_mu‹x_t + * +__mu‹x +) + +729 +__THROW + + `__nÚnuÎ + ((1)); + +732  + $±h»ad_mu‹x_Œylock + ( +±h»ad_mu‹x_t + * +__mu‹x +) + +733 +__THROW + + `__nÚnuÎ + ((1)); + +736  + $±h»ad_mu‹x_lock + ( +±h»ad_mu‹x_t + * +__mu‹x +) + +737 +__THROW + + `__nÚnuÎ + ((1)); + +739 #ifdeà +__USE_XOPEN2K + + +741  + $±h»ad_mu‹x_timedlock + ( +±h»ad_mu‹x_t + * +__»¡riù + +__mu‹x +, + +742 +__cÚ¡ +  +time¥ec + * +__»¡riù + + +743 +__ab¡ime +è +__THROW + + `__nÚnuÎ + ((1, 2)); + +747  + $±h»ad_mu‹x_uÆock + ( +±h»ad_mu‹x_t + * +__mu‹x +) + +748 +__THROW + + `__nÚnuÎ + ((1)); + +751 #ifdeà +__USE_UNIX98 + + +753  + $±h»ad_mu‹x_g‘´ioûžšg + ( +__cÚ¡ + +±h»ad_mu‹x_t + * + +754 +__»¡riù + +__mu‹x +, + +755 * +__»¡riù + +__´ioûžšg +) + +756 +__THROW + + `__nÚnuÎ + ((1, 2)); + +760  + $±h»ad_mu‹x_£rioûžšg + ( +±h»ad_mu‹x_t + * +__»¡riù + +__mu‹x +, + +761  +__´ioûžšg +, + +762 * +__»¡riù + +__Þd_ûžšg +) + +763 +__THROW + + `__nÚnuÎ + ((1, 3)); + +767 #ifdeà +__USE_XOPEN2K8 + + +769  + $±h»ad_mu‹x_cÚsi¡’t_Å + ( +±h»ad_mu‹x_t + * +__mu‹x +) + +770 +__THROW + + `__nÚnuÎ + ((1)); + +771 #ifdeà +__USE_GNU + + +772  + $±h»ad_mu‹x_cÚsi¡’t_Å + ( +±h»ad_mu‹x_t + * +__mu‹x +) + +773 +__THROW + + `__nÚnuÎ + ((1)); + +782  + $±h»ad_mu‹x©Œ_š™ + ( +±h»ad_mu‹x©Œ_t + * +__©Œ +) + +783 +__THROW + + `__nÚnuÎ + ((1)); + +786  + $±h»ad_mu‹x©Œ_de¡roy + ( +±h»ad_mu‹x©Œ_t + * +__©Œ +) + +787 +__THROW + + `__nÚnuÎ + ((1)); + +790  + $±h»ad_mu‹x©Œ_g‘psh¬ed + ( +__cÚ¡ + +±h»ad_mu‹x©Œ_t + * + +791 +__»¡riù + +__©Œ +, + +792 * +__»¡riù + +__psh¬ed +) + +793 +__THROW + + `__nÚnuÎ + ((1, 2)); + +796  + $±h»ad_mu‹x©Œ_£sh¬ed + ( +±h»ad_mu‹x©Œ_t + * +__©Œ +, + +797  +__psh¬ed +) + +798 +__THROW + + `__nÚnuÎ + ((1)); + +800 #ifdeà +__USE_UNIX98 + + +802  + $±h»ad_mu‹x©Œ_g‘ty³ + ( +__cÚ¡ + +±h»ad_mu‹x©Œ_t + * +__»¡riù + + +803 +__©Œ +, * +__»¡riù + +__kšd +) + +804 +__THROW + + `__nÚnuÎ + ((1, 2)); + +809  + $±h»ad_mu‹x©Œ_£‰y³ + ( +±h»ad_mu‹x©Œ_t + * +__©Œ +,  +__kšd +) + +810 +__THROW + + `__nÚnuÎ + ((1)); + +813  + $±h»ad_mu‹x©Œ_g‘´ÙocÞ + ( +__cÚ¡ + +±h»ad_mu‹x©Œ_t + * + +814 +__»¡riù + +__©Œ +, + +815 * +__»¡riù + +__´ÙocÞ +) + +816 +__THROW + + `__nÚnuÎ + ((1, 2)); + +820  + $±h»ad_mu‹x©Œ_£rÙocÞ + ( +±h»ad_mu‹x©Œ_t + * +__©Œ +, + +821  +__´ÙocÞ +) + +822 +__THROW + + `__nÚnuÎ + ((1)); + +825  + $±h»ad_mu‹x©Œ_g‘´ioûžšg + ( +__cÚ¡ + +±h»ad_mu‹x©Œ_t + * + +826 +__»¡riù + +__©Œ +, + +827 * +__»¡riù + +__´ioûžšg +) + +828 +__THROW + + `__nÚnuÎ + ((1, 2)); + +831  + $±h»ad_mu‹x©Œ_£rioûžšg + ( +±h»ad_mu‹x©Œ_t + * +__©Œ +, + +832  +__´ioûžšg +) + +833 +__THROW + + `__nÚnuÎ + ((1)); + +836 #ifdeà +__USE_XOPEN2K + + +838  + $±h»ad_mu‹x©Œ_g‘robu¡ + ( +__cÚ¡ + +±h»ad_mu‹x©Œ_t + * +__©Œ +, + +839 * +__robu¡Ãss +) + +840 +__THROW + + `__nÚnuÎ + ((1, 2)); + +841 #ifdeà +__USE_GNU + + +842  + $±h»ad_mu‹x©Œ_g‘robu¡_Å + ( +__cÚ¡ + +±h»ad_mu‹x©Œ_t + * +__©Œ +, + +843 * +__robu¡Ãss +) + +844 +__THROW + + `__nÚnuÎ + ((1, 2)); + +848  + $±h»ad_mu‹x©Œ_£Œobu¡ + ( +±h»ad_mu‹x©Œ_t + * +__©Œ +, + +849  +__robu¡Ãss +) + +850 +__THROW + + `__nÚnuÎ + ((1)); + +851 #ifdeà +__USE_GNU + + +852  + $±h»ad_mu‹x©Œ_£Œobu¡_Å + ( +±h»ad_mu‹x©Œ_t + * +__©Œ +, + +853  +__robu¡Ãss +) + +854 +__THROW + + `__nÚnuÎ + ((1)); + +859 #ià +defšed + +__USE_UNIX98 + || defšed +__USE_XOPEN2K + + +864  + $±h»ad_rwlock_š™ + ( +±h»ad_rwlock_t + * +__»¡riù + +__rwlock +, + +865 +__cÚ¡ + +±h»ad_rwlock©Œ_t + * +__»¡riù + + +866 +__©Œ +è +__THROW + + `__nÚnuÎ + ((1)); + +869  + $±h»ad_rwlock_de¡roy + ( +±h»ad_rwlock_t + * +__rwlock +) + +870 +__THROW + + `__nÚnuÎ + ((1)); + +873  + $±h»ad_rwlock_rdlock + ( +±h»ad_rwlock_t + * +__rwlock +) + +874 +__THROW + + `__nÚnuÎ + ((1)); + +877  + $±h»ad_rwlock_Œyrdlock + ( +±h»ad_rwlock_t + * +__rwlock +) + +878 +__THROW + + `__nÚnuÎ + ((1)); + +880 #ifdeà +__USE_XOPEN2K + + +882  + $±h»ad_rwlock_timedrdlock + ( +±h»ad_rwlock_t + * +__»¡riù + +__rwlock +, + +883 +__cÚ¡ +  +time¥ec + * +__»¡riù + + +884 +__ab¡ime +è +__THROW + + `__nÚnuÎ + ((1, 2)); + +888  + $±h»ad_rwlock_w¾ock + ( +±h»ad_rwlock_t + * +__rwlock +) + +889 +__THROW + + `__nÚnuÎ + ((1)); + +892  + $±h»ad_rwlock_Œyw¾ock + ( +±h»ad_rwlock_t + * +__rwlock +) + +893 +__THROW + + `__nÚnuÎ + ((1)); + +895 #ifdeà +__USE_XOPEN2K + + +897  + $±h»ad_rwlock_timedw¾ock + ( +±h»ad_rwlock_t + * +__»¡riù + +__rwlock +, + +898 +__cÚ¡ +  +time¥ec + * +__»¡riù + + +899 +__ab¡ime +è +__THROW + + `__nÚnuÎ + ((1, 2)); + +903  + $±h»ad_rwlock_uÆock + ( +±h»ad_rwlock_t + * +__rwlock +) + +904 +__THROW + + `__nÚnuÎ + ((1)); + +910  + $±h»ad_rwlock©Œ_š™ + ( +±h»ad_rwlock©Œ_t + * +__©Œ +) + +911 +__THROW + + `__nÚnuÎ + ((1)); + +914  + $±h»ad_rwlock©Œ_de¡roy + ( +±h»ad_rwlock©Œ_t + * +__©Œ +) + +915 +__THROW + + `__nÚnuÎ + ((1)); + +918  + $±h»ad_rwlock©Œ_g‘psh¬ed + ( +__cÚ¡ + +±h»ad_rwlock©Œ_t + * + +919 +__»¡riù + +__©Œ +, + +920 * +__»¡riù + +__psh¬ed +) + +921 +__THROW + + `__nÚnuÎ + ((1, 2)); + +924  + $±h»ad_rwlock©Œ_£sh¬ed + ( +±h»ad_rwlock©Œ_t + * +__©Œ +, + +925  +__psh¬ed +) + +926 +__THROW + + `__nÚnuÎ + ((1)); + +929  + $±h»ad_rwlock©Œ_g‘kšd_Å + ( +__cÚ¡ + +±h»ad_rwlock©Œ_t + * + +930 +__»¡riù + +__©Œ +, + +931 * +__»¡riù + +__´ef +) + +932 +__THROW + + `__nÚnuÎ + ((1, 2)); + +935  + $±h»ad_rwlock©Œ_£tkšd_Å + ( +±h»ad_rwlock©Œ_t + * +__©Œ +, + +936  +__´ef +è +__THROW + + `__nÚnuÎ + ((1)); + +944  + $±h»ad_cÚd_š™ + ( +±h»ad_cÚd_t + * +__»¡riù + +__cÚd +, + +945 +__cÚ¡ + +±h»ad_cÚd©Œ_t + * +__»¡riù + + +946 +__cÚd_©Œ +è +__THROW + + `__nÚnuÎ + ((1)); + +949  + $±h»ad_cÚd_de¡roy + ( +±h»ad_cÚd_t + * +__cÚd +) + +950 +__THROW + + `__nÚnuÎ + ((1)); + +953  + $±h»ad_cÚd_sigÇl + ( +±h»ad_cÚd_t + * +__cÚd +) + +954 +__THROW + + `__nÚnuÎ + ((1)); + +957  + $±h»ad_cÚd_brßdÿ¡ + ( +±h»ad_cÚd_t + * +__cÚd +) + +958 +__THROW + + `__nÚnuÎ + ((1)); + +965  + $±h»ad_cÚd_wa™ + ( +±h»ad_cÚd_t + * +__»¡riù + +__cÚd +, + +966 +±h»ad_mu‹x_t + * +__»¡riù + +__mu‹x +) + +967 + `__nÚnuÎ + ((1, 2)); + +976  + $±h»ad_cÚd_timedwa™ + ( +±h»ad_cÚd_t + * +__»¡riù + +__cÚd +, + +977 +±h»ad_mu‹x_t + * +__»¡riù + +__mu‹x +, + +978 +__cÚ¡ +  +time¥ec + * +__»¡riù + + +979 +__ab¡ime +è + `__nÚnuÎ + ((1, 2, 3)); + +984  + $±h»ad_cÚd©Œ_š™ + ( +±h»ad_cÚd©Œ_t + * +__©Œ +) + +985 +__THROW + + `__nÚnuÎ + ((1)); + +988  + $±h»ad_cÚd©Œ_de¡roy + ( +±h»ad_cÚd©Œ_t + * +__©Œ +) + +989 +__THROW + + `__nÚnuÎ + ((1)); + +992  + $±h»ad_cÚd©Œ_g‘psh¬ed + ( +__cÚ¡ + +±h»ad_cÚd©Œ_t + * + +993 +__»¡riù + +__©Œ +, + +994 * +__»¡riù + +__psh¬ed +) + +995 +__THROW + + `__nÚnuÎ + ((1, 2)); + +998  + $±h»ad_cÚd©Œ_£sh¬ed + ( +±h»ad_cÚd©Œ_t + * +__©Œ +, + +999  +__psh¬ed +è +__THROW + + `__nÚnuÎ + ((1)); + +1001 #ifdeà +__USE_XOPEN2K + + +1003  + $±h»ad_cÚd©Œ_g‘þock + ( +__cÚ¡ + +±h»ad_cÚd©Œ_t + * + +1004 +__»¡riù + +__©Œ +, + +1005 +__þockid_t + * +__»¡riù + +__þock_id +) + +1006 +__THROW + + `__nÚnuÎ + ((1, 2)); + +1009  + $±h»ad_cÚd©Œ_£tþock + ( +±h»ad_cÚd©Œ_t + * +__©Œ +, + +1010 +__þockid_t + +__þock_id +) + +1011 +__THROW + + `__nÚnuÎ + ((1)); + +1015 #ifdeà +__USE_XOPEN2K + + +1020  + $±h»ad_¥š_š™ + ( +±h»ad_¥šlock_t + * +__lock +,  +__psh¬ed +) + +1021 +__THROW + + `__nÚnuÎ + ((1)); + +1024  + $±h»ad_¥š_de¡roy + ( +±h»ad_¥šlock_t + * +__lock +) + +1025 +__THROW + + `__nÚnuÎ + ((1)); + +1028  + $±h»ad_¥š_lock + ( +±h»ad_¥šlock_t + * +__lock +) + +1029 +__THROW + + `__nÚnuÎ + ((1)); + +1032  + $±h»ad_¥š_Œylock + ( +±h»ad_¥šlock_t + * +__lock +) + +1033 +__THROW + + `__nÚnuÎ + ((1)); + +1036  + $±h»ad_¥š_uÆock + ( +±h»ad_¥šlock_t + * +__lock +) + +1037 +__THROW + + `__nÚnuÎ + ((1)); + +1044  + $±h»ad_b¬r›r_š™ + ( +±h»ad_b¬r›r_t + * +__»¡riù + +__b¬r›r +, + +1045 +__cÚ¡ + +±h»ad_b¬r›¿‰r_t + * +__»¡riù + + +1046 +__©Œ +,  +__couÁ +) + +1047 +__THROW + + `__nÚnuÎ + ((1)); + +1050  + $±h»ad_b¬r›r_de¡roy + ( +±h»ad_b¬r›r_t + * +__b¬r›r +) + +1051 +__THROW + + `__nÚnuÎ + ((1)); + +1054  + $±h»ad_b¬r›r_wa™ + ( +±h»ad_b¬r›r_t + * +__b¬r›r +) + +1055 +__THROW + + `__nÚnuÎ + ((1)); + +1059  + $±h»ad_b¬r›¿‰r_š™ + ( +±h»ad_b¬r›¿‰r_t + * +__©Œ +) + +1060 +__THROW + + `__nÚnuÎ + ((1)); + +1063  + $±h»ad_b¬r›¿‰r_de¡roy + ( +±h»ad_b¬r›¿‰r_t + * +__©Œ +) + +1064 +__THROW + + `__nÚnuÎ + ((1)); + +1067  + $±h»ad_b¬r›¿‰r_g‘psh¬ed + ( +__cÚ¡ + +±h»ad_b¬r›¿‰r_t + * + +1068 +__»¡riù + +__©Œ +, + +1069 * +__»¡riù + +__psh¬ed +) + +1070 +__THROW + + `__nÚnuÎ + ((1, 2)); + +1073  + $±h»ad_b¬r›¿‰r_£sh¬ed + ( +±h»ad_b¬r›¿‰r_t + * +__©Œ +, + +1074  +__psh¬ed +) + +1075 +__THROW + + `__nÚnuÎ + ((1)); + +1087  + `±h»ad_key_ü—‹ + ( +±h»ad_key_t + * +__key +, + +1088 (* +__de¡r_funùiÚ +) (*)) + +1089 +__THROW + + `__nÚnuÎ + ((1)); + +1092  + $±h»ad_key_d–‘e + ( +±h»ad_key_t + +__key +è +__THROW +; + +1095 * + $±h»ad_g‘¥ecific + ( +±h»ad_key_t + +__key +è +__THROW +; + +1098  + $±h»ad_£t¥ecific + ( +±h»ad_key_t + +__key +, + +1099 +__cÚ¡ + * +__poš‹r +è +__THROW + ; + +1102 #ifdeà +__USE_XOPEN2K + + +1104  + $±h»ad_g‘ýuþockid + ( +±h»ad_t + +__th»ad_id +, + +1105 +__þockid_t + * +__þock_id +) + +1106 +__THROW + + `__nÚnuÎ + ((2)); + +1121  + `±h»ad_©fÜk + ((* +__´•¬e +) (), + +1122 (* +__·»Á +) (), + +1123 (* +__chžd +è()è +__THROW +; + +1126 #ifdeà +__USE_EXTERN_INLINES + + +1128 +__ex‹º_šlše +  + +1129 + `__NTH + ( + $±h»ad_equ® + ( +±h»ad_t + +__th»ad1 +,…th»ad_ˆ +__th»ad2 +)) + +1131  +__th»ad1 + =ð +__th»ad2 +; + +1132 + } +} + +1135 + g__END_DECLS + + + @/usr/include/sys/select.h + +22 #iâdeà +_SYS_SELECT_H + + +23  + #_SYS_SELECT_H + 1 + + ) + +25  + ~<ã©u»s.h +> + +28  + ~ + +31  + ~ + +34  + ~ + +36 #iâdeà +__sig£t_t_defšed + + +37  + #__sig£t_t_defšed + + + ) + +38  +__sig£t_t + + tsig£t_t +; + +42  + #__Ãed_time_t + + + ) + +43  + #__Ãed_time¥ec + + + ) + +44  + ~ + +45  + #__Ãed_timev® + + + ) + +46  + ~ + +48 #iâdeà +__su£cÚds_t_defšed + + +49  +__su£cÚds_t + + tsu£cÚds_t +; + +50  + #__su£cÚds_t_defšed + + + ) + +55  + t__fd_mask +; + +58 #undeà +__NFDBITS + + +59 #undeà +__FDELT + + +60 #undeà +__FDMASK + + +62  + #__NFDBITS + (8 * (è ( +__fd_mask +)) + + ) + +63  + #__FDELT +( +d +è((dè/ +__NFDBITS +) + + ) + +64  + #__FDMASK +( +d +è(( +__fd_mask +è1 << ((dè% +__NFDBITS +)) + + ) + +71 #ifdeà +__USE_XOPEN + + +72 +__fd_mask + + mfds_b™s +[ +__FD_SETSIZE + / +__NFDBITS +]; + +73  + #__FDS_BITS +( +£t +è((£t)-> +fds_b™s +) + + ) + +75 +__fd_mask + + m__fds_b™s +[ +__FD_SETSIZE + / +__NFDBITS +]; + +76  + #__FDS_BITS +( +£t +è((£t)-> +__fds_b™s +) + + ) + +78 } + tfd_£t +; + +81  + #FD_SETSIZE + +__FD_SETSIZE + + + ) + +83 #ifdeà +__USE_MISC + + +85  +__fd_mask + + tfd_mask +; + +88  + #NFDBITS + +__NFDBITS + + + ) + +93  + #FD_SET +( +fd +, +fd£ +è + `__FD_SET + (fd, fd£) + + ) + +94  + #FD_CLR +( +fd +, +fd£ +è + `__FD_CLR + (fd, fd£) + + ) + +95  + #FD_ISSET +( +fd +, +fd£ +è + `__FD_ISSET + (fd, fd£) + + ) + +96  + #FD_ZERO +( +fd£ +è + `__FD_ZERO + (fd£) + + ) + +99 +__BEGIN_DECLS + + +109  +£Ëù + ( +__nfds +, +fd_£t + * +__»¡riù + +__»adfds +, + +110 +fd_£t + * +__»¡riù + +__wr™efds +, + +111 +fd_£t + * +__»¡riù + +__exû±fds +, + +112  +timev® + * +__»¡riù + +__timeout +); + +114 #ifdeà +__USE_XOPEN2K + + +121  +p£Ëù + ( +__nfds +, +fd_£t + * +__»¡riù + +__»adfds +, + +122 +fd_£t + * +__»¡riù + +__wr™efds +, + +123 +fd_£t + * +__»¡riù + +__exû±fds +, + +124 cÚ¡  +time¥ec + * +__»¡riù + +__timeout +, + +125 cÚ¡ +__sig£t_t + * +__»¡riù + +__sigmask +); + +128 + g__END_DECLS + + + @/usr/include/sys/sysmacros.h + +21 #iâdeà +_SYS_SYSMACROS_H + + +22  + #_SYS_SYSMACROS_H + 1 + + ) + +24  + ~<ã©u»s.h +> + +29 #ifdeà +__GLIBC_HAVE_LONG_LONG + + +30 +__ex‹nsiÚ__ + + +31  + $gnu_dev_majÜ + ( +__dev +) + +32 +__THROW +; + +33 +__ex‹nsiÚ__ + + +34  + $gnu_dev_mšÜ + ( +__dev +) + +35 +__THROW +; + +36 +__ex‹nsiÚ__ + + +37  + $gnu_dev_makedev + ( +__majÜ +, + +38  +__mšÜ +) + +39 +__THROW +; + +41 #ià +defšed + +__GNUC__ + && __GNUC__ >ð2 && defšed +__USE_EXTERN_INLINES + + +42 +__ex‹nsiÚ__ + +__ex‹º_šlše +  + +43 + `__NTH + ( + $gnu_dev_majÜ + ( +__dev +)) + +45  (( +__dev + >> 8) & 0xfff) | (() (__dev >> 32) & ~0xfff); + +46 + } +} + +48 +__ex‹nsiÚ__ + +__ex‹º_šlše +  + +49 +__NTH + ( + $gnu_dev_mšÜ + ( +__dev +)) + +51  ( +__dev + & 0xff) | (() (__dev >> 12) & ~0xff); + +52 + } +} + +54 +__ex‹nsiÚ__ + +__ex‹º_šlše +  + +55 +__NTH + ( + $gnu_dev_makedev + ( +__majÜ +,  +__mšÜ +)) + +57  (( +__mšÜ + & 0xffè| (( +__majÜ + & 0xfff) << 8) + +58 | (((è( +__mšÜ + & ~0xff)) << 12) + +59 | (((è( +__majÜ + & ~0xfff)) << 32)); + +60 + } +} + +65  + #majÜ +( +dev +è + `gnu_dev_majÜ + (dev) + + ) + +66  + #mšÜ +( +dev +è + `gnu_dev_mšÜ + (dev) + + ) + +67  + #makedev +( +maj +, +mš +è + `gnu_dev_makedev + (maj, mš) + + ) + + @/usr/include/time.h + +23 #iâdef +_TIME_H + + +25 #ià(! +defšed + +__Ãed_time_t + && !defšed +__Ãed_þock_t + && \ + +26 ! +defšed + + g__Ãed_time¥ec +) + +27  + #_TIME_H + 1 + + ) + +28  + ~<ã©u»s.h +> + +30 + g__BEGIN_DECLS + + +34 #ifdef +_TIME_H + + +36  + #__Ãed_size_t + + + ) + +37  + #__Ãed_NULL + + + ) + +38  + ~<¡ddef.h +> + +42  + ~ + +45 #ià! +defšed + +__STRICT_ANSI__ + && !defšed +__USE_XOPEN2K + + +46 #iâdeà +CLK_TCK + + +47  + #CLK_TCK + +CLOCKS_PER_SEC + + + ) + +53 #ià! +defšed + +__þock_t_defšed + && (defšed +_TIME_H + || defšed +__Ãed_þock_t +) + +54  + #__þock_t_defšed + 1 + + ) + +56  + ~ + +58 +__BEGIN_NAMESPACE_STD + + +60  +__þock_t + + tþock_t +; + +61 + g__END_NAMESPACE_STD + + +62 #ià +defšed + +__USE_XOPEN + || defšed +__USE_POSIX + || defšed +__USE_MISC + + +63 + $__USING_NAMESPACE_STD +( +þock_t +) + +67 #undeà +__Ãed_þock_t + + +69 #ià! +defšed + +__time_t_defšed + && (defšed +_TIME_H + || defšed +__Ãed_time_t +) + +70  + #__time_t_defšed + 1 + + ) + +72  + ~ + +74 +__BEGIN_NAMESPACE_STD + + +76  +__time_t + + ttime_t +; + +77 +__END_NAMESPACE_STD + + +78 #ià +defšed + +__USE_POSIX + || defšed +__USE_MISC + || defšed +__USE_SVID + + +79 + $__USING_NAMESPACE_STD +( +time_t +) + +83 #undeà +__Ãed_time_t + + +85 #ià! +defšed + +__þockid_t_defšed + && \ + +86 (( +defšed + +_TIME_H + && defšed +__USE_POSIX199309 +è|| defšed +__Ãed_þockid_t +) + +87  + #__þockid_t_defšed + 1 + + ) + +89  + ~ + +92  +__þockid_t + + tþockid_t +; + +95 #undeà +__þockid_time_t + + +97 #ià! +defšed + +__tim”_t_defšed + && \ + +98 (( +defšed + +_TIME_H + && defšed +__USE_POSIX199309 +è|| defšed +__Ãed_tim”_t +) + +99  + #__tim”_t_defšed + 1 + + ) + +101  + ~ + +104  +__tim”_t + + ttim”_t +; + +107 #undeà +__Ãed_tim”_t + + +110 #ià! +defšed + +__time¥ec_defšed + && \ + +111 (( +defšed + +_TIME_H + && \ + +112 ( +defšed + +__USE_POSIX199309 + || defšed +__USE_MISC +)) || \ + +113 +defšed + +__Ãed_time¥ec +) + +114  + #__time¥ec_defšed + 1 + + ) + +116  + ~ + +120  + stime¥ec + + +122 +__time_t + +tv_£c +; + +123  +tv_n£c +; + +127 #undeà +__Ãed_time¥ec + + +130 #ifdef +_TIME_H + + +131 +__BEGIN_NAMESPACE_STD + + +133  + stm + + +135  +tm_£c +; + +136  +tm_mš +; + +137  +tm_hour +; + +138  +tm_mday +; + +139  +tm_mÚ +; + +140  +tm_y—r +; + +141  +tm_wday +; + +142  +tm_yday +; + +143  +tm_isd¡ +; + +145 #ifdef +__USE_BSD + + +146  +tm_gmtoff +; + +147 +__cÚ¡ + * +tm_zÚe +; + +149  +__tm_gmtoff +; + +150 +__cÚ¡ + * +__tm_zÚe +; + +153 +__END_NAMESPACE_STD + + +154 #ià +defšed + +__USE_XOPEN + || defšed +__USE_POSIX + || defšed +__USE_MISC + + +155 + $__USING_NAMESPACE_STD +( +tm +) + +159 #ifdeà +__USE_POSIX199309 + + +161  + s™im”¥ec + + +163  +time¥ec + +™_š‹rv® +; + +164  +time¥ec + +™_v®ue +; + +168  +sigev’t +; + +172 #ifdeà +__USE_XOPEN2K + + +173 #iâdeà +__pid_t_defšed + + +174  +__pid_t + + tpid_t +; + +175  + #__pid_t_defšed + + + ) + +180 +__BEGIN_NAMESPACE_STD + + +183 +þock_t + + $þock + (è +__THROW +; + +186 +time_t + + $time + ( +time_t + * +__tim” +è +__THROW +; + +189  + $difáime + ( +time_t + +__time1 +,ime_ˆ +__time0 +) + +190 +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +193 +time_t + + $mktime + ( +tm + * +__ +è +__THROW +; + +199 +size_t + + $¡ráime + (* +__»¡riù + +__s +, +size_t + +__maxsize +, + +200 +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +201 +__cÚ¡ +  +tm + * +__»¡riù + +__ +è +__THROW +; + +202 +__END_NAMESPACE_STD + + +204 #ifdeà +__USE_XOPEN + + +207 * + $¡½time + ( +__cÚ¡ + * +__»¡riù + +__s +, + +208 +__cÚ¡ + * +__»¡riù + +__fmt +,  +tm + * +__ +) + +209 +__THROW +; + +212 #ifdeà +__USE_XOPEN2K8 + + +215  + ~ + +217 +size_t + + $¡ráime_l + (* +__»¡riù + +__s +, +size_t + +__maxsize +, + +218 +__cÚ¡ + * +__»¡riù + +__fÜm© +, + +219 +__cÚ¡ +  +tm + * +__»¡riù + +__ +, + +220 +__loÿË_t + +__loc +è +__THROW +; + +223 #ifdeà +__USE_GNU + + +224 * + $¡½time_l + ( +__cÚ¡ + * +__»¡riù + +__s +, + +225 +__cÚ¡ + * +__»¡riù + +__fmt +,  +tm + * +__ +, + +226 +__loÿË_t + +__loc +è +__THROW +; + +230 +__BEGIN_NAMESPACE_STD + + +233  +tm + * + $gmtime + ( +__cÚ¡ + +time_t + * +__tim” +è +__THROW +; + +237  +tm + * + $loÿÉime + ( +__cÚ¡ + +time_t + * +__tim” +è +__THROW +; + +238 +__END_NAMESPACE_STD + + +240 #ià +defšed + +__USE_POSIX + || defšed +__USE_MISC + + +243  +tm + * + $gmtime_r + ( +__cÚ¡ + +time_t + * +__»¡riù + +__tim” +, + +244  +tm + * +__»¡riù + +__ +è +__THROW +; + +248  +tm + * + $loÿÉime_r + ( +__cÚ¡ + +time_t + * +__»¡riù + +__tim” +, + +249  +tm + * +__»¡riù + +__ +è +__THROW +; + +252 +__BEGIN_NAMESPACE_STD + + +255 * + $asùime + ( +__cÚ¡ +  +tm + * +__ +è +__THROW +; + +258 * + $ùime + ( +__cÚ¡ + +time_t + * +__tim” +è +__THROW +; + +259 +__END_NAMESPACE_STD + + +261 #ià +defšed + +__USE_POSIX + || defšed +__USE_MISC + + +266 * + $asùime_r + ( +__cÚ¡ +  +tm + * +__»¡riù + +__ +, + +267 * +__»¡riù + +__buf +è +__THROW +; + +270 * + $ùime_r + ( +__cÚ¡ + +time_t + * +__»¡riù + +__tim” +, + +271 * +__»¡riù + +__buf +è +__THROW +; + +276 * +__tzÇme +[2]; + +277  +__daylight +; + +278  +__timezÚe +; + +281 #ifdef +__USE_POSIX + + +283 * +tzÇme +[2]; + +287  + $tz£t + (è +__THROW +; + +290 #ià +defšed + +__USE_SVID + || defšed +__USE_XOPEN + + +291  +daylight +; + +292  +timezÚe +; + +295 #ifdeà +__USE_SVID + + +298  + $¡ime + ( +__cÚ¡ + +time_t + * +__wh’ +è +__THROW +; + +304  + #__i¦—p +( +y—r +) \ + +305 (( +y—r +è% 4 =ð0 && ((y—rè% 100 !ð0 || (y—rè% 400 =ð0)) + + ) + +308 #ifdeà +__USE_MISC + + +313 +time_t + + $timegm + ( +tm + * +__ +è +__THROW +; + +316 +time_t + + $tim–oÿl + ( +tm + * +__ +è +__THROW +; + +319  + $dysize + ( +__y—r +è +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +323 #ifdeà +__USE_POSIX199309 + + +328  + `Çno¦“p + ( +__cÚ¡ +  +time¥ec + * +__»que¡ed_time +, + +329  +time¥ec + * +__»maššg +); + +333  + $þock_g‘»s + ( +þockid_t + +__þock_id +,  +time¥ec + * +__»s +è +__THROW +; + +336  + $þock_g‘time + ( +þockid_t + +__þock_id +,  +time¥ec + * +__ +è +__THROW +; + +339  + $þock_£‰ime + ( +þockid_t + +__þock_id +, +__cÚ¡ +  +time¥ec + * +__ +) + +340 +__THROW +; + +342 #ifdeà +__USE_XOPEN2K + + +347  + `þock_Çno¦“p + ( +þockid_t + +__þock_id +,  +__æags +, + +348 +__cÚ¡ +  +time¥ec + * +__»q +, + +349  +time¥ec + * +__»m +); + +352  + $þock_g‘ýuþockid + ( +pid_t + +__pid +, +þockid_t + * +__þock_id +è +__THROW +; + +357  + $tim”_ü—‹ + ( +þockid_t + +__þock_id +, + +358  +sigev’t + * +__»¡riù + +__evp +, + +359 +tim”_t + * +__»¡riù + +__tim”id +è +__THROW +; + +362  + $tim”_d–‘e + ( +tim”_t + +__tim”id +è +__THROW +; + +365  + $tim”_£‰ime + ( +tim”_t + +__tim”id +,  +__æags +, + +366 +__cÚ¡ +  +™im”¥ec + * +__»¡riù + +__v®ue +, + +367  +™im”¥ec + * +__»¡riù + +__ov®ue +è +__THROW +; + +370  + $tim”_g‘time + ( +tim”_t + +__tim”id +,  +™im”¥ec + * +__v®ue +) + +371 +__THROW +; + +374  + $tim”_g‘ov”run + ( +tim”_t + +__tim”id +è +__THROW +; + +378 #ifdeà +__USE_XOPEN_EXTENDED + + +390  +g‘d©e_”r +; + +399  +tm + * + `g‘d©e + ( +__cÚ¡ + * +__¡ršg +); + +402 #ifdeà +__USE_GNU + + +413  + `g‘d©e_r + ( +__cÚ¡ + * +__»¡riù + +__¡ršg +, + +414  +tm + * +__»¡riù + +__»sbuå +); + +417 +__END_DECLS + + + @/usr/include/wctype.h + +24 #iâdeà +_WCTYPE_H + + +26  + ~<ã©u»s.h +> + +27  + ~ + +29 #iâdeà +__Ãed_iswxxx + + +30  + #_WCTYPE_H + 1 + + ) + +33  + #__Ãed_wšt_t + + + ) + +34  + ~<¡ddef.h +> + +38 #iâdeà +WEOF + + +39  + #WEOF + (0xffffffffu) + + ) + +42 #undeà +__Ãed_iswxxx + + +47 #iâdeà +__iswxxx_defšed + + +48  + #__iswxxx_defšed + 1 + + ) + +50 +__BEGIN_NAMESPACE_C99 + + +53  + twùy³_t +; + +54 + g__END_NAMESPACE_C99 + + +56 #iâdeà +_ISwb™ + + +61  + ~<’dŸn.h +> + +62 #ià +__BYTE_ORDER + =ð +__BIG_ENDIAN + + +63  + #_ISwb™ +( +b™ +è(1 << (b™)) + + ) + +65  + #_ISwb™ +( +b™ +) \ + +66 (( +b™ +) < 8 ? () ((1UL << (bit)) << 24) \ + +67 : (( +b™ +) < 16 ? () ((1UL << (bit)) << 8) \ + +68 : (( +b™ +) < 24 ? () ((1UL << (bit)) >> 8) \ + +69 : (è((1UL << ( +b™ +)è>> 24)))) + + ) + +74 + m__ISwuµ” + = 0, + +75 + m__ISwlow” + = 1, + +76 + m__ISw®pha + = 2, + +77 + m__ISwdig™ + = 3, + +78 + m__ISwxdig™ + = 4, + +79 + m__ISw¥aû + = 5, + +80 + m__ISw´št + = 6, + +81 + m__ISwg¿ph + = 7, + +82 + m__ISwbÏnk + = 8, + +83 + m__ISwúŒl + = 9, + +84 + m__ISwpunù + = 10, + +85 + m__ISw®num + = 11, + +87 + m_ISwuµ” + = +_ISwb™ + ( +__ISwuµ” +), + +88 + m_ISwlow” + = +_ISwb™ + ( +__ISwlow” +), + +89 + m_ISw®pha + = +_ISwb™ + ( +__ISw®pha +), + +90 + m_ISwdig™ + = +_ISwb™ + ( +__ISwdig™ +), + +91 + m_ISwxdig™ + = +_ISwb™ + ( +__ISwxdig™ +), + +92 + m_ISw¥aû + = +_ISwb™ + ( +__ISw¥aû +), + +93 + m_ISw´št + = +_ISwb™ + ( +__ISw´št +), + +94 + m_ISwg¿ph + = +_ISwb™ + ( +__ISwg¿ph +), + +95 + m_ISwbÏnk + = +_ISwb™ + ( +__ISwbÏnk +), + +96 + m_ISwúŒl + = +_ISwb™ + ( +__ISwúŒl +), + +97 + m_ISwpunù + = +_ISwb™ + ( +__ISwpunù +), + +98 + m_ISw®num + = +_ISwb™ + ( +__ISw®num +) + +103 +__BEGIN_DECLS + + +105 +__BEGIN_NAMESPACE_C99 + + +112  + $isw®num + ( +wšt_t + +__wc +è +__THROW +; + +118  + $isw®pha + ( +wšt_t + +__wc +è +__THROW +; + +121  + $iswúŒl + ( +wšt_t + +__wc +è +__THROW +; + +125  + $iswdig™ + ( +wšt_t + +__wc +è +__THROW +; + +129  + $iswg¿ph + ( +wšt_t + +__wc +è +__THROW +; + +134  + $iswlow” + ( +wšt_t + +__wc +è +__THROW +; + +137  + $isw´št + ( +wšt_t + +__wc +è +__THROW +; + +142  + $iswpunù + ( +wšt_t + +__wc +è +__THROW +; + +147  + $isw¥aû + ( +wšt_t + +__wc +è +__THROW +; + +152  + $iswuµ” + ( +wšt_t + +__wc +è +__THROW +; + +157  + $iswxdig™ + ( +wšt_t + +__wc +è +__THROW +; + +162 #ifdeà +__USE_ISOC99 + + +163  + $iswbÏnk + ( +wšt_t + +__wc +è +__THROW +; + +172 +wùy³_t + + $wùy³ + ( +__cÚ¡ + * +__´Ý”ty +è +__THROW +; + +176  + $iswùy³ + ( +wšt_t + +__wc +, +wùy³_t + +__desc +è +__THROW +; + +177 +__END_NAMESPACE_C99 + + +184 +__BEGIN_NAMESPACE_C99 + + +187  +__cÚ¡ + + t__št32_t + * + twù¿ns_t +; + +188 +__END_NAMESPACE_C99 + + +189 #ifdeà +__USE_GNU + + +190 + $__USING_NAMESPACE_C99 +( +wù¿ns_t +) + +193 +__BEGIN_NAMESPACE_C99 + + +195 +wšt_t + + $towlow” + ( +wšt_t + +__wc +è +__THROW +; + +198 +wšt_t + + $towuµ” + ( +wšt_t + +__wc +è +__THROW +; + +199 +__END_NAMESPACE_C99 + + +201 +__END_DECLS + + +208 #ifdeà +_WCTYPE_H + + +214 +__BEGIN_DECLS + + +216 +__BEGIN_NAMESPACE_C99 + + +219 +wù¿ns_t + + $wù¿ns + ( +__cÚ¡ + * +__´Ý”ty +è +__THROW +; + +222 +wšt_t + + $towù¿ns + ( +wšt_t + +__wc +, +wù¿ns_t + +__desc +è +__THROW +; + +223 +__END_NAMESPACE_C99 + + +225 #ifdeà +__USE_XOPEN2K8 + + +227  + ~ + +231  + $isw®num_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +237  + $isw®pha_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +240  + $iswúŒl_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +244  + $iswdig™_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +248  + $iswg¿ph_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +253  + $iswlow”_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +256  + $isw´št_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +261  + $iswpunù_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +266  + $isw¥aû_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +271  + $iswuµ”_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +276  + $iswxdig™_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +281  + $iswbÏnk_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +285 +wùy³_t + + $wùy³_l + ( +__cÚ¡ + * +__´Ý”ty +, +__loÿË_t + +__loÿË +) + +286 +__THROW +; + +290  + $iswùy³_l + ( +wšt_t + +__wc +, +wùy³_t + +__desc +, +__loÿË_t + +__loÿË +) + +291 +__THROW +; + +299 +wšt_t + + $towlow”_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +302 +wšt_t + + $towuµ”_l + ( +wšt_t + +__wc +, +__loÿË_t + +__loÿË +è +__THROW +; + +306 +wù¿ns_t + + $wù¿ns_l + ( +__cÚ¡ + * +__´Ý”ty +, +__loÿË_t + +__loÿË +) + +307 +__THROW +; + +310 +wšt_t + + $towù¿ns_l + ( +wšt_t + +__wc +, +wù¿ns_t + +__desc +, + +311 +__loÿË_t + +__loÿË +è +__THROW +; + +315 +__END_DECLS + + + @/usr/include/bits/errno.h + +20 #ifdeà +_ERRNO_H + + +22 #undeà +EDOM + + +23 #undeà +EILSEQ + + +24 #undeà +ERANGE + + +25  + ~ + +28  + #ENOTSUP + +EOPNOTSUPP + + + ) + +31 #iâdeà +ECANCELED + + +32  + #ECANCELED + 125 + + ) + +36 #iâdeà +EOWNERDEAD + + +37  + #EOWNERDEAD + 130 + + ) + +38  + #ENOTRECOVERABLE + 131 + + ) + +41 #iâdeà +__ASSEMBLER__ + + +43 * + $__”ºo_loÿtiÚ + (è +__THROW + + `__©Œibu‹__ + (( +__cÚ¡__ +)); + +45 #ià! +defšed + +_LIBC + || defšed +_LIBC_REENTRANT + + +47  + #”ºo + (* + `__”ºo_loÿtiÚ + ()) + + ) + +52 #ià! +defšed + +_ERRNO_H + && defšed +__Ãed_Em©h + + +56  + #EDOM + 33 + + ) + +57  + #EILSEQ + 84 + + ) + +58  + #ERANGE + 34 + + ) + + @/usr/include/bits/select.h + +19 #iâdeà +_SYS_SELECT_H + + +23  + ~ + +26 #ià +defšed + +__GNUC__ + && __GNUC__ >= 2 + +28 #ià +__WORDSIZE + == 64 + +29  + #__FD_ZERO_STOS + "¡osq" + + ) + +31  + #__FD_ZERO_STOS + "¡o¦" + + ) + +34  + #__FD_ZERO +( +fd¥ +) \ + +36  +__d0 +, +__d1 +; \ + +37 +__asm__ + + `__vÞ©že__ + ("þd;„•; " +__FD_ZERO_STOS + \ + +38 : "=c" ( +__d0 +), "=D" ( +__d1 +) \ + +39 : "a" (0), "0" ( ( +fd_£t +) \ + +40 /  ( +__fd_mask +)), \ + +41 "1" (& + `__FDS_BITS + ( +fd¥ +)[0]) \ + +43 } 0) + + ) + +49  + #__FD_ZERO +( +£t +) \ + +51  +__i +; \ + +52 +fd_£t + * +__¬r + = ( +£t +); \ + +53  +__i + = 0; __˜<  ( +fd_£t +è/  ( +__fd_mask +); ++__i) \ + +54 + `__FDS_BITS + ( +__¬r +)[ +__i +] = 0; \ + +55 } 0) + + ) + +59  + #__FD_SET +( +d +, +£t +è( + `__FDS_BITS + (£t)[ + `__FDELT + (d)] |ð + `__FDMASK + (d)) + + ) + +60  + #__FD_CLR +( +d +, +£t +è( + `__FDS_BITS + (£t)[ + `__FDELT + (d)] &ð~ + `__FDMASK + (d)) + + ) + +61  + #__FD_ISSET +( +d +, +£t +) \ + +62 (( + `__FDS_BITS + ( +£t +)[ + `__FDELT + ( +d +)] & + `__FDMASK + (d)è!ð0) + + ) + + @/usr/include/bits/setjmp.h + +20 #iâdeà +_BITS_SETJMP_H + + +21  + #_BITS_SETJMP_H + 1 + + ) + +23 #ià! +defšed + +_SETJMP_H + && !defšed +_PTHREAD_H + + +27  + ~ + +29 #iâdeà +_ASM + + +31 #ià +__WORDSIZE + == 64 + +32  + t__jmp_buf +[8]; + +34  + t__jmp_buf +[6]; + + @/usr/include/bits/sigset.h + +21 #iâdef +_SIGSET_H_ty³s + + +22  + #_SIGSET_H_ty³s + 1 + + ) + +24  + t__sig_©omic_t +; + +28  + #_SIGSET_NWORDS + (1024 / (8 *  ())) + + ) + +31  + m__v® +[ +_SIGSET_NWORDS +]; + +32 } + t__sig£t_t +; + +43 #ià! +defšed + +_SIGSET_H_âs + && defšed +_SIGNAL_H + + +44  + #_SIGSET_H_âs + 1 + + ) + +46 #iâdeà +_EXTERN_INLINE + + +47  + #_EXTERN_INLINE + +__ex‹º_šlše + + + ) + +51  + #__sigmask +( +sig +) \ + +52 (((è1è<< ((( +sig +è- 1è% (8 *  ()))) + + ) + +55  + #__sigwÜd +( +sig +è(((sigè- 1è/ (8 *  ())) + + ) + +57 #ià +defšed + +__GNUC__ + && __GNUC__ >= 2 + +58  + #__sigem±y£t +( +£t +) \ + +59 ( + `__ex‹nsiÚ__ + ({  +__út + = +_SIGSET_NWORDS +; \ + +60 +sig£t_t + * +__£t + = ( +£t +); \ + +61 -- +__út + >ð0è +__£t +-> +__v® +[__cnt] = 0; \ + +62 0; })) + + ) + +63  + #__sigfžl£t +( +£t +) \ + +64 ( + `__ex‹nsiÚ__ + ({  +__út + = +_SIGSET_NWORDS +; \ + +65 +sig£t_t + * +__£t + = ( +£t +); \ + +66 -- +__út + >ð0è +__£t +-> +__v® +[__cnt] = ~0UL; \ + +67 0; })) + + ) + +69 #ifdeà +__USE_GNU + + +73  + #__sigi£m±y£t +( +£t +) \ + +74 ( + `__ex‹nsiÚ__ + ({  +__út + = +_SIGSET_NWORDS +; \ + +75 cÚ¡ +sig£t_t + * +__£t + = ( +£t +); \ + +76  +__»t + = +__£t +-> +__v® +[-- +__út +]; \ + +77 ! +__»t + && -- +__út + >= 0) \ + +78 +__»t + = +__£t +-> +__v® +[ +__út +]; \ + +79 +__»t + =ð0; })) + + ) + +80  + #__sigªd£t +( +de¡ +, +Ëá +, +right +) \ + +81 ( + `__ex‹nsiÚ__ + ({  +__út + = +_SIGSET_NWORDS +; \ + +82 +sig£t_t + * +__de¡ + = ( +de¡ +); \ + +83 cÚ¡ +sig£t_t + * +__Ëá + = ( +Ëá +); \ + +84 cÚ¡ +sig£t_t + * +__right + = ( +right +); \ + +85 -- +__út + >= 0) \ + +86 +__de¡ +-> +__v® +[ +__út +] = ( +__Ëá +->__val[__cnt] \ + +87 & +__right +-> +__v® +[ +__út +]); \ + +88 0; })) + + ) + +89  + #__sigÜ£t +( +de¡ +, +Ëá +, +right +) \ + +90 ( + `__ex‹nsiÚ__ + ({  +__út + = +_SIGSET_NWORDS +; \ + +91 +sig£t_t + * +__de¡ + = ( +de¡ +); \ + +92 cÚ¡ +sig£t_t + * +__Ëá + = ( +Ëá +); \ + +93 cÚ¡ +sig£t_t + * +__right + = ( +right +); \ + +94 -- +__út + >= 0) \ + +95 +__de¡ +-> +__v® +[ +__út +] = ( +__Ëá +->__val[__cnt] \ + +96 | +__right +-> +__v® +[ +__út +]); \ + +97 0; })) + + ) + +104  +__sigismemb” + ( +__cÚ¡ + +__sig£t_t + *, ); + +105  +__sigadd£t + ( +__sig£t_t + *, ); + +106  +__sigd–£t + ( +__sig£t_t + *, ); + +108 #ifdeà +__USE_EXTERN_INLINES + + +109  + #__SIGSETFN +( +NAME +, +BODY +, +CONST +) \ + +110 +_EXTERN_INLINE + \ + +111 + `NAME + ( +CONST + +__sig£t_t + * +__£t +,  +__sig +) \ + +113  +__mask + = + `__sigmask + ( +__sig +); \ + +114  +__wÜd + = + `__sigwÜd + ( +__sig +); \ + +115  +BODY +; \ + +116 } + + ) + +118 +__SIGSETFN + ( +__sigismemb” +, ( +__£t +-> +__v® +[ +__wÜd +] & +__mask +è? 1 : 0, +__cÚ¡ +) + +119 +__SIGSETFN + ( +__sigadd£t +, (( +__£t +-> +__v® +[ +__wÜd +] |ð +__mask +), 0), ) + +120 +__SIGSETFN + ( +__sigd–£t +, (( +__£t +-> +__v® +[ +__wÜd +] &ð~ +__mask +), 0), ) + +122 #undeà +__SIGSETFN + + + @/usr/include/bits/time.h + +24 #iâdeà +__Ãed_timev® + + +25 #iâdeà +_BITS_TIME_H + + +26  + #_BITS_TIME_H + 1 + + ) + +34  + #CLOCKS_PER_SEC + 1000000l + + ) + +36 #ià! +defšed + +__STRICT_ANSI__ + && !defšed +__USE_XOPEN2K + + +39  + ~ + +40  +__syscÚf + (); + +41  + #CLK_TCK + (( +__þock_t +è + `__syscÚf + (2)è + + ) + +44 #ifdeà +__USE_POSIX199309 + + +46  + #CLOCK_REALTIME + 0 + + ) + +48  + #CLOCK_MONOTONIC + 1 + + ) + +50  + #CLOCK_PROCESS_CPUTIME_ID + 2 + + ) + +52  + #CLOCK_THREAD_CPUTIME_ID + 3 + + ) + +55  + #TIMER_ABSTIME + 1 + + ) + +61 #ifdeà +__Ãed_timev® + + +62 #undeà +__Ãed_timev® + + +63 #iâdeà +_STRUCT_TIMEVAL + + +64  + #_STRUCT_TIMEVAL + 1 + + ) + +65  + ~ + +69  + stimev® + + +71 +__time_t + + mtv_£c +; + +72 +__su£cÚds_t + + mtv_u£c +; + + @/usr/include/sched.h + +20 #iâdef +_SCHED_H + + +21  + #_SCHED_H + 1 + + ) + +23  + ~<ã©u»s.h +> + +26  + ~ + +28  + #__Ãed_size_t + + + ) + +29  + ~<¡ddef.h +> + +31  + #__Ãed_time¥ec + + + ) + +32  + ~ + +35  + ~ + +37  + #sched_´iÜ™y + +__sched_´iÜ™y + + + ) + +40 +__BEGIN_DECLS + + +43  + $sched_£¬am + ( +__pid_t + +__pid +, +__cÚ¡ +  +sched_·¿m + * +__·¿m +) + +44 +__THROW +; + +47  + $sched_g‘·¿m + ( +__pid_t + +__pid +,  +sched_·¿m + * +__·¿m +è +__THROW +; + +50  + $sched_£tscheduËr + ( +__pid_t + +__pid +,  +__pÞicy +, + +51 +__cÚ¡ +  +sched_·¿m + * +__·¿m +è +__THROW +; + +54  + $sched_g‘scheduËr + ( +__pid_t + +__pid +è +__THROW +; + +57  + $sched_y›ld + (è +__THROW +; + +60  + $sched_g‘_´iÜ™y_max + ( +__®gÜ™hm +è +__THROW +; + +63  + $sched_g‘_´iÜ™y_mš + ( +__®gÜ™hm +è +__THROW +; + +66  + $sched_¼_g‘_š‹rv® + ( +__pid_t + +__pid +,  +time¥ec + * +__t +è +__THROW +; + +69 #ifdeà +__USE_GNU + + +71  + #CPU_SETSIZE + +__CPU_SETSIZE + + + ) + +72  + #CPU_SET +( +ýu +, +ýu£ +è + `__CPU_SET_S + (ýu,  ( +ýu_£t_t +), cpu£) + + ) + +73  + #CPU_CLR +( +ýu +, +ýu£ +è + `__CPU_CLR_S + (ýu,  ( +ýu_£t_t +), cpu£) + + ) + +74  + #CPU_ISSET +( +ýu +, +ýu£ +è + `__CPU_ISSET_S + (ýu,  ( +ýu_£t_t +), \ + +75 +ýu£ +) + + ) + +76  + #CPU_ZERO +( +ýu£ +è + `__CPU_ZERO_S + ( ( +ýu_£t_t +), cpu£) + + ) + +77  + #CPU_COUNT +( +ýu£ +è + `__CPU_COUNT_S + ( ( +ýu_£t_t +), cpu£) + + ) + +79  + #CPU_SET_S +( +ýu +, +£tsize +, +ýu£ +è + `__CPU_SET_S + (ýu, s‘size, cpu£) + + ) + +80  + #CPU_CLR_S +( +ýu +, +£tsize +, +ýu£ +è + `__CPU_CLR_S + (ýu, s‘size, cpu£) + + ) + +81  + #CPU_ISSET_S +( +ýu +, +£tsize +, +ýu£ +è + `__CPU_ISSET_S + (cpu, setsize, \ + +82 +ýu£ +) + + ) + +83  + #CPU_ZERO_S +( +£tsize +, +ýu£ +è + `__CPU_ZERO_S + (£tsize, cpu£) + + ) + +84  + #CPU_COUNT_S +( +£tsize +, +ýu£ +è + `__CPU_COUNT_S + (£tsize, cpu£) + + ) + +86  + #CPU_EQUAL +( +ýu£1 +, +ýu£2 +) \ + +87 + `__CPU_EQUAL_S + ( ( +ýu_£t_t +), +ýu£1 +, +ýu£2 +) + + ) + +88  + #CPU_EQUAL_S +( +£tsize +, +ýu£1 +, +ýu£2 +) \ + +89 + `__CPU_EQUAL_S + ( +£tsize +, +ýu£1 +, +ýu£2 +) + + ) + +91  + #CPU_AND +( +de¡£t +, +¤c£t1 +, +¤c£t2 +) \ + +92 + `__CPU_OP_S + ( ( +ýu_£t_t +), +de¡£t +, +¤c£t1 +, +¤c£t2 +, &) + + ) + +93  + #CPU_OR +( +de¡£t +, +¤c£t1 +, +¤c£t2 +) \ + +94 + `__CPU_OP_S + ( ( +ýu_£t_t +), +de¡£t +, +¤c£t1 +, +¤c£t2 +, |) + + ) + +95  + #CPU_XOR +( +de¡£t +, +¤c£t1 +, +¤c£t2 +) \ + +96 + `__CPU_OP_S + ( ( +ýu_£t_t +), +de¡£t +, +¤c£t1 +, +¤c£t2 +, ^) + + ) + +97  + #CPU_AND_S +( +£tsize +, +de¡£t +, +¤c£t1 +, +¤c£t2 +) \ + +98 + `__CPU_OP_S + ( +£tsize +, +de¡£t +, +¤c£t1 +, +¤c£t2 +, &) + + ) + +99  + #CPU_OR_S +( +£tsize +, +de¡£t +, +¤c£t1 +, +¤c£t2 +) \ + +100 + `__CPU_OP_S + ( +£tsize +, +de¡£t +, +¤c£t1 +, +¤c£t2 +, |) + + ) + +101  + #CPU_XOR_S +( +£tsize +, +de¡£t +, +¤c£t1 +, +¤c£t2 +) \ + +102 + `__CPU_OP_S + ( +£tsize +, +de¡£t +, +¤c£t1 +, +¤c£t2 +, ^) + + ) + +104  + #CPU_ALLOC_SIZE +( +couÁ +è + `__CPU_ALLOC_SIZE + (couÁ) + + ) + +105  + #CPU_ALLOC +( +couÁ +è + `__CPU_ALLOC + (couÁ) + + ) + +106  + #CPU_FREE +( +ýu£t +è + `__CPU_FREE + (ýu£t) + + ) + +110  + $sched_£ffš™y + ( +__pid_t + +__pid +, +size_t + +__ýu£tsize +, + +111 +__cÚ¡ + +ýu_£t_t + * +__ýu£t +è +__THROW +; + +114  + $sched_g‘affš™y + ( +__pid_t + +__pid +, +size_t + +__ýu£tsize +, + +115 +ýu_£t_t + * +__ýu£t +è +__THROW +; + +118 +__END_DECLS + + + @/usr/include/signal.h + +23 #iâdef +_SIGNAL_H + + +25 #ià! +defšed + +__Ãed_sig_©omic_t + && !defšed +__Ãed_sig£t_t + + +26  + #_SIGNAL_H + + + ) + +29  + ~<ã©u»s.h +> + +31 + g__BEGIN_DECLS + + +33  + ~ + +37 #ià +defšed + +__Ãed_sig_©omic_t + || defšed +_SIGNAL_H + + +38 #iâdeà +__sig_©omic_t_defšed + + +39  + #__sig_©omic_t_defšed + + + ) + +40 +__BEGIN_NAMESPACE_STD + + +41  +__sig_©omic_t + + tsig_©omic_t +; + +42 + g__END_NAMESPACE_STD + + +44 #undeà +__Ãed_sig_©omic_t + + +47 #ià +defšed + +__Ãed_sig£t_t + || (defšed +_SIGNAL_H + && defšed +__USE_POSIX +) + +48 #iâdeà +__sig£t_t_defšed + + +49  + #__sig£t_t_defšed + + + ) + +50  +__sig£t_t + + tsig£t_t +; + +52 #undeà +__Ãed_sig£t_t + + +55 #ifdeà +_SIGNAL_H + + +57  + ~ + +58  + ~ + +60 #ià +defšed + +__USE_XOPEN + || defšed +__USE_XOPEN2K + + +61 #iâdeà +__pid_t_defšed + + +62  +__pid_t + + tpid_t +; + +63  + #__pid_t_defšed + + + ) + +65 #ifdeà +__USE_XOPEN + + +67 #iâdeà +__uid_t_defšed + + +68  +__uid_t + + tuid_t +; + +69  + #__uid_t_defšed + + + ) + +73 #ifdeà +__USE_POSIX199309 + + +75  + #__Ãed_time¥ec + + + ) + +76  + ~ + +79  + ~ + +84 (* + t__sighªdËr_t +) (); + +89 +__sighªdËr_t + + $__sysv_sigÇl + ( +__sig +, +__sighªdËr_t + +__hªdËr +) + +90 +__THROW +; + +91 #ifdeà +__USE_GNU + + +92 +__sighªdËr_t + + $sysv_sigÇl + ( +__sig +, +__sighªdËr_t + +__hªdËr +) + +93 +__THROW +; + +99 +__BEGIN_NAMESPACE_STD + + +100 #ifdeà +__USE_BSD + + +101 +__sighªdËr_t + + $sigÇl + ( +__sig +, +__sighªdËr_t + +__hªdËr +) + +102 +__THROW +; + +105 #ifdeà +__REDIRECT_NTH + + +106 +__sighªdËr_t + + `__REDIRECT_NTH + ( +sigÇl +, + +107 ( +__sig +, +__sighªdËr_t + +__hªdËr +), + +108 +__sysv_sigÇl +); + +110  + #sigÇl + +__sysv_sigÇl + + + ) + +113 +__END_NAMESPACE_STD + + +115 #ifdeà +__USE_XOPEN + + +118 +__sighªdËr_t + + $bsd_sigÇl + ( +__sig +, +__sighªdËr_t + +__hªdËr +) + +119 +__THROW +; + +125 #ifdeà +__USE_POSIX + + +126  + $kžl + ( +__pid_t + +__pid +,  +__sig +è +__THROW +; + +129 #ià +defšed + +__USE_BSD + || defšed +__USE_XOPEN_EXTENDED + + +133  + $kžÍg + ( +__pid_t + +__pg½ +,  +__sig +è +__THROW +; + +136 +__BEGIN_NAMESPACE_STD + + +138  + $¿i£ + ( +__sig +è +__THROW +; + +139 +__END_NAMESPACE_STD + + +141 #ifdeà +__USE_SVID + + +143 +__sighªdËr_t + + $ssigÇl + ( +__sig +, +__sighªdËr_t + +__hªdËr +) + +144 +__THROW +; + +145  + $gsigÇl + ( +__sig +è +__THROW +; + +148 #ià +defšed + +__USE_MISC + || defšed +__USE_XOPEN2K + + +150  + `psigÇl + ( +__sig +, +__cÚ¡ + * +__s +); + +153 #ifdeà +__USE_XOPEN2K + + +155  + `psigšfo + ( +__cÚ¡ + +sigšfo_t + * +__pšfo +, __cÚ¡ * +__s +); + +168  + `__sig·u£ + ( +__sig_Ü_mask +,  +__is_sig +); + +170 #ifdeà +__FAVOR_BSD + + +173  + $sig·u£ + ( +__mask +è +__THROW + +__©Œibu‹_d•»ÿ‹d__ +; + +175 #ifdeà +__USE_XOPEN + + +176 #ifdeà +__GNUC__ + + +177  + $sig·u£ + ( +__sig +è + `__asm__ + ("__xpg_sigpause"); + +180  + #sig·u£ +( +sig +è + `__sig·u£ + ((sig), 1) + + ) + +186 #ifdeà +__USE_BSD + + +193  + #sigmask +( +sig +è + `__sigmask +(sig) + + ) + +196  + $sigblock + ( +__mask +è +__THROW + +__©Œibu‹_d•»ÿ‹d__ +; + +199  + $sig£tmask + ( +__mask +è +__THROW + +__©Œibu‹_d•»ÿ‹d__ +; + +202  + $sigg‘mask + (è +__THROW + +__©Œibu‹_d•»ÿ‹d__ +; + +206 #ifdeà +__USE_MISC + + +207  + #NSIG + +_NSIG + + + ) + +210 #ifdeà +__USE_GNU + + +211  +__sighªdËr_t + + tsighªdËr_t +; + +215 #ifdeà +__USE_BSD + + +216  +__sighªdËr_t + + tsig_t +; + +219 #ifdeà +__USE_POSIX + + +222  + $sigem±y£t + ( +sig£t_t + * +__£t +è +__THROW + + `__nÚnuÎ + ((1)); + +225  + $sigfžl£t + ( +sig£t_t + * +__£t +è +__THROW + + `__nÚnuÎ + ((1)); + +228  + $sigadd£t + ( +sig£t_t + * +__£t +,  +__signo +è +__THROW + + `__nÚnuÎ + ((1)); + +231  + $sigd–£t + ( +sig£t_t + * +__£t +,  +__signo +è +__THROW + + `__nÚnuÎ + ((1)); + +234  + $sigismemb” + ( +__cÚ¡ + +sig£t_t + * +__£t +,  +__signo +) + +235 +__THROW + + `__nÚnuÎ + ((1)); + +237 #ifdeà +__USE_GNU + + +239  + $sigi£m±y£t + ( +__cÚ¡ + +sig£t_t + * +__£t +è +__THROW + + `__nÚnuÎ + ((1)); + +242  + $sigªd£t + ( +sig£t_t + * +__£t +, +__cÚ¡ + sig£t_ˆ* +__Ëá +, + +243 +__cÚ¡ + +sig£t_t + * +__right +è +__THROW + + `__nÚnuÎ + ((1, 2, 3)); + +246  + $sigÜ£t + ( +sig£t_t + * +__£t +, +__cÚ¡ + sig£t_ˆ* +__Ëá +, + +247 +__cÚ¡ + +sig£t_t + * +__right +è +__THROW + + `__nÚnuÎ + ((1, 2, 3)); + +252  + ~ + +255  + $sig´ocmask + ( +__how +, +__cÚ¡ + +sig£t_t + * +__»¡riù + +__£t +, + +256 +sig£t_t + * +__»¡riù + +__o£t +è +__THROW +; + +263  + $sigsu¥’d + ( +__cÚ¡ + +sig£t_t + * +__£t +è + `__nÚnuÎ + ((1)); + +266  + $sigaùiÚ + ( +__sig +, +__cÚ¡ +  +sigaùiÚ + * +__»¡riù + +__aù +, + +267  +sigaùiÚ + * +__»¡riù + +__ßù +è +__THROW +; + +270  + $sig³ndšg + ( +sig£t_t + * +__£t +è +__THROW + + `__nÚnuÎ + ((1)); + +277  + $sigwa™ + ( +__cÚ¡ + +sig£t_t + * +__»¡riù + +__£t +, *__»¡riù +__sig +) + +278 + `__nÚnuÎ + ((1, 2)); + +280 #ifdeà +__USE_POSIX199309 + + +285  + $sigwa™šfo + ( +__cÚ¡ + +sig£t_t + * +__»¡riù + +__£t +, + +286 +sigšfo_t + * +__»¡riù + +__šfo +è + `__nÚnuÎ + ((1)); + +293  + $sigtimedwa™ + ( +__cÚ¡ + +sig£t_t + * +__»¡riù + +__£t +, + +294 +sigšfo_t + * +__»¡riù + +__šfo +, + +295 +__cÚ¡ +  +time¥ec + * +__»¡riù + +__timeout +) + +296 + `__nÚnuÎ + ((1)); + +300  + $sigqueue + ( +__pid_t + +__pid +,  +__sig +, +__cÚ¡ +  +sigv® + +__v® +) + +301 +__THROW +; + +306 #ifdeà +__USE_BSD + + +310 +__cÚ¡ + *__cÚ¡ +_sys_sigli¡ +[ +_NSIG +]; + +311 +__cÚ¡ + *__cÚ¡ +sys_sigli¡ +[ +_NSIG +]; + +314  + ssigvec + + +316 +__sighªdËr_t + +sv_hªdËr +; + +317  +sv_mask +; + +319  +sv_æags +; + +320  + #sv_Ú¡ack + +sv_æags + + + ) + +324  + #SV_ONSTACK + (1 << 0) + + ) + +325  + #SV_INTERRUPT + (1 << 1) + + ) + +326  + #SV_RESETHAND + (1 << 2) + + ) + +334  + $sigvec + ( +__sig +, +__cÚ¡ +  +sigvec + * +__vec +, + +335  +sigvec + * +__ovec +è +__THROW +; + +339  + ~ + +342  + $sig»tuº + ( +sigcÚ‹xt + * +__sý +è +__THROW +; + +347 #ià +defšed + +__USE_BSD + || defšed +__USE_XOPEN_EXTENDED + + +348  + #__Ãed_size_t + + + ) + +349  + ~<¡ddef.h +> + +354  + $sigš‹¼u± + ( +__sig +,  +__š‹¼u± +è +__THROW +; + +356  + ~ + +357 #ifdeà +__USE_XOPEN + + +359  + ~ + +365  + $sig¡ack + ( +sig¡ack + * +__ss +, sig¡ack * +__oss +) + +366 +__THROW + +__©Œibu‹_d•»ÿ‹d__ +; + +370  + $sig®t¡ack + ( +__cÚ¡ +  +sig®t¡ack + * +__»¡riù + +__ss +, + +371  +sig®t¡ack + * +__»¡riù + +__oss +è +__THROW +; + +375 #ifdeà +__USE_XOPEN_EXTENDED + + +379  + $sighÞd + ( +__sig +è +__THROW +; + +382  + $sig»l£ + ( +__sig +è +__THROW +; + +385  + $sigignÜe + ( +__sig +è +__THROW +; + +388 +__sighªdËr_t + + $sig£t + ( +__sig +, +__sighªdËr_t + +__di¥ +è +__THROW +; + +391 #ià +defšed + +__USE_POSIX199506 + || defšed +__USE_UNIX98 + + +394  + ~ + +395  + ~ + +402  + $__libc_cu¼’t_sig¹mš + (è +__THROW +; + +404  + $__libc_cu¼’t_sig¹max + (è +__THROW +; + +408 +__END_DECLS + + + @/usr/include/bits/sched.h + +22 #iâdeà +__Ãed_sched·¿m + + +24 #iâdeà +_SCHED_H + + +30  + #SCHED_OTHER + 0 + + ) + +31  + #SCHED_FIFO + 1 + + ) + +32  + #SCHED_RR + 2 + + ) + +33 #ifdeà +__USE_GNU + + +34  + #SCHED_BATCH + 3 + + ) + +37 #ifdeà +__USE_MISC + + +39  + #CSIGNAL + 0x000000fà + + ) + +40  + #CLONE_VM + 0x00000100 + + ) + +41  + #CLONE_FS + 0x00000200 + + ) + +42  + #CLONE_FILES + 0x00000400 + + ) + +43  + #CLONE_SIGHAND + 0x00000800 + + ) + +44  + #CLONE_PTRACE + 0x00002000 + + ) + +45  + #CLONE_VFORK + 0x00004000 + + ) + +47  + #CLONE_PARENT + 0x00008000 + + ) + +49  + #CLONE_THREAD + 0x00010000 + + ) + +50  + #CLONE_NEWNS + 0x00020000 + + ) + +51  + #CLONE_SYSVSEM + 0x00040000 + + ) + +52  + #CLONE_SETTLS + 0x00080000 + + ) + +53  + #CLONE_PARENT_SETTID + 0x00100000 + + ) + +55  + #CLONE_CHILD_CLEARTID + 0x00200000 + + ) + +57  + #CLONE_DETACHED + 0x00400000 + + ) + +58  + #CLONE_UNTRACED + 0x00800000 + + ) + +60  + #CLONE_CHILD_SETTID + 0x01000000 + + ) + +62  + #CLONE_NEWUTS + 0x04000000 + + ) + +63  + #CLONE_NEWIPC + 0x08000000 + + ) + +64  + #CLONE_NEWUSER + 0x10000000 + + ) + +65  + #CLONE_NEWPID + 0x20000000 + + ) + +66  + #CLONE_NEWNET + 0x40000000 + + ) + +67  + #CLONE_IO + 0x80000000 + + ) + +71  + ssched_·¿m + + +73  + m__sched_´iÜ™y +; + +76 + g__BEGIN_DECLS + + +78 #ifdeà +__USE_MISC + + +80  +þÚe + ((* +__â +è(* +__¬g +), * +__chžd_¡ack +, + +81  +__æags +, * +__¬g +, ...è +__THROW +; + +84  + $unsh¬e + ( +__æags +è +__THROW +; + +87  + $sched_g‘ýu + (è +__THROW +; + +90 +__END_DECLS + + +94 #ià! +defšed + +__defšed_sched·¿m + \ + +95 && ( +defšed + +__Ãed_sched·¿m + || defšed +_SCHED_H +) + +96  + #__defšed_sched·¿m + 1 + + ) + +98  + s__sched_·¿m + + +100  +__sched_´iÜ™y +; + +102 #undeà +__Ãed_sched·¿m + + +106 #ià +defšed + +_SCHED_H + && !defšed +__ýu_£t_t_defšed + + +107  + #__ýu_£t_t_defšed + + + ) + +109  + #__CPU_SETSIZE + 1024 + + ) + +110  + #__NCPUBITS + (8 *  ( +__ýu_mask +)) + + ) + +113  + t__ýu_mask +; + +116  + #__CPUELT +( +ýu +è((ýuè/ +__NCPUBITS +) + + ) + +117  + #__CPUMASK +( +ýu +è(( +__ýu_mask +è1 << ((ýuè% +__NCPUBITS +)) + + ) + +122 +__ýu_mask + +__b™s +[ +__CPU_SETSIZE + / +__NCPUBITS +]; + +123 } + týu_£t_t +; + +126 #ià + `__GNUC_PREREQ + (2, 91) + +127  + #__CPU_ZERO_S +( +£tsize +, +ýu£ +) \ + +128 dØ + `__bužtš_mem£t + ( +ýu£ +, '\0', +£tsize +); 0) + + ) + +130  + #__CPU_ZERO_S +( +£tsize +, +ýu£ +) \ + +132 +size_t + +__i +; \ + +133 +size_t + +__imax + = ( +£tsize +è/  ( +__ýu_mask +); \ + +134 +__ýu_mask + * +__b™s + = ( +ýu£ +)->__bits; \ + +135  +__i + = 0; __˜< +__imax +; ++__i) \ + +136 +__b™s +[ +__i +] = 0; \ + +137 + } +} 0) + + ) + +139  + #__CPU_SET_S +( +ýu +, +£tsize +, +ýu£ +) \ + +140 ( +__ex‹nsiÚ__ + \ + +141 ({ +size_t + +__ýu + = ( +ýu +); \ + +142 +__ýu + < 8 * ( +£tsize +) \ + +143 ? ((( +__ýu_mask + *è(( +ýu£ +)-> +__b™s +))[ + `__CPUELT + ( +__ýu +)] \ + +144 |ð + `__CPUMASK + ( +__ýu +)) \ + +145 : 0; })) + + ) + +146  + #__CPU_CLR_S +( +ýu +, +£tsize +, +ýu£ +) \ + +147 ( +__ex‹nsiÚ__ + \ + +148 ({ +size_t + +__ýu + = ( +ýu +); \ + +149 +__ýu + < 8 * ( +£tsize +) \ + +150 ? ((( +__ýu_mask + *è(( +ýu£ +)-> +__b™s +))[ + `__CPUELT + ( +__ýu +)] \ + +151 &ð~ + `__CPUMASK + ( +__ýu +)) \ + +152 : 0; })) + + ) + +153  + #__CPU_ISSET_S +( +ýu +, +£tsize +, +ýu£ +) \ + +154 ( +__ex‹nsiÚ__ + \ + +155 ({ +size_t + +__ýu + = ( +ýu +); \ + +156 +__ýu + < 8 * ( +£tsize +) \ + +157 ? (((( +__cÚ¡ + +__ýu_mask + *è(( +ýu£ +)-> +__b™s +))[ + `__CPUELT + ( +__ýu +)] \ + +158 & + `__CPUMASK + ( +__ýu +))) != 0 \ + +159 : 0; })) + + ) + +161  + #__CPU_COUNT_S +( +£tsize +, +ýu£ +) \ + +162 + `__sched_ýucouÁ + ( +£tsize +, +ýu£ +) + + ) + +164 #ià +__GNUC_PREREQ + (2, 91) + +165  + #__CPU_EQUAL_S +( +£tsize +, +ýu£1 +, +ýu£2 +) \ + +166 ( + `__bužtš_memcmp + ( +ýu£1 +, +ýu£2 +, +£tsize +è=ð0) + + ) + +168  + #__CPU_EQUAL_S +( +£tsize +, +ýu£1 +, +ýu£2 +) \ + +169 ( +__ex‹nsiÚ__ + \ + +170 ({ +__cÚ¡ + +__ýu_mask + * +__¬r1 + = ( +ýu£1 +)-> +__b™s +; \ + +171 +__cÚ¡ + +__ýu_mask + * +__¬r2 + = ( +ýu£2 +)-> +__b™s +; \ + +172 +size_t + +__imax + = ( +£tsize +è/  ( +__ýu_mask +); \ + +173 +size_t + +__i +; \ + +174  +__i + = 0; __˜< +__imax +; ++__i) \ + +175 ià( +__b™s +[ +__i +] != __bits[__i]) \ + +177 +__i + =ð +__imax +; })) + + ) + +180  + #__CPU_OP_S +( +£tsize +, +de¡£t +, +¤c£t1 +, +¤c£t2 +, +Ý +) \ + +181 ( +__ex‹nsiÚ__ + \ + +182 ({ +ýu_£t_t + * +__de¡ + = ( +de¡£t +); \ + +183 +__cÚ¡ + +__ýu_mask + * +__¬r1 + = ( +¤c£t1 +)-> +__b™s +; \ + +184 +__cÚ¡ + +__ýu_mask + * +__¬r2 + = ( +¤c£t2 +)-> +__b™s +; \ + +185 +size_t + +__imax + = ( +£tsize +è/  ( +__ýu_mask +); \ + +186 +size_t + +__i +; \ + +187  +__i + = 0; __˜< +__imax +; ++__i) \ + +188 (( +__ýu_mask + *è +__de¡ +-> +__b™s +)[ +__i +] = +__¬r1 +[__i] +Ý + +__¬r2 +[__i]; \ + +189 +__de¡ +; })) + + ) + +191  + #__CPU_ALLOC_SIZE +( +couÁ +) \ + +192 (((( +couÁ +è+ +__NCPUBITS + - 1è/ __NCPUBITSè*  ( +__ýu_mask +)) + + ) + +193  + #__CPU_ALLOC +( +couÁ +è + `__sched_ýu®loc + (couÁ) + + ) + +194  + #__CPU_FREE +( +ýu£t +è + `__sched_ýuä“ + (ýu£t) + + ) + +196 +__BEGIN_DECLS + + +198  + $__sched_ýucouÁ + ( +size_t + +__£tsize +, cÚ¡ +ýu_£t_t + * +__£ +) + +199 +__THROW +; + +200 +ýu_£t_t + * + $__sched_ýu®loc + ( +size_t + +__couÁ +è +__THROW + +__wur +; + +201  + $__sched_ýuä“ + ( +ýu_£t_t + * +__£t +è +__THROW +; + +203 +__END_DECLS + + + @/usr/include/bits/sigaction.h + +20 #iâdeà +_SIGNAL_H + + +25  + ssigaùiÚ + + +28 #ifdeà +__USE_POSIX199309 + + +32 +__sighªdËr_t + + m§_hªdËr +; + +34 (* + m§_sigaùiÚ +è(, + msigšfo_t + *, *); + +36 + m__sigaùiÚ_hªdËr +; + +37  + #§_hªdËr + +__sigaùiÚ_hªdËr +. +§_hªdËr + + + ) + +38  + #§_sigaùiÚ + +__sigaùiÚ_hªdËr +. +§_sigaùiÚ + + + ) + +40 +__sighªdËr_t + + m§_hªdËr +; + +44 +__sig£t_t + + m§_mask +; + +47  + m§_æags +; + +50 (* + m§_»¡Ü” +) (); + +54  + #SA_NOCLDSTOP + 1 + + ) + +55  + #SA_NOCLDWAIT + 2 + + ) + +56  + #SA_SIGINFO + 4 + + ) + +58 #ià +defšed + +__USE_UNIX98 + || defšed +__USE_MISC + + +59  + #SA_ONSTACK + 0x08000000 + + ) + +60  + #SA_RESTART + 0x10000000 + + ) + +61  + #SA_NODEFER + 0x40000000 + + ) + +63  + #SA_RESETHAND + 0x80000000 + + ) + +65 #ifdeà +__USE_MISC + + +66  + #SA_INTERRUPT + 0x20000000 + + ) + +69  + #SA_NOMASK + +SA_NODEFER + + + ) + +70  + #SA_ONESHOT + +SA_RESETHAND + + + ) + +71  + #SA_STACK + +SA_ONSTACK + + + ) + +75  + #SIG_BLOCK + 0 + + ) + +76  + #SIG_UNBLOCK + 1 + + ) + +77  + #SIG_SETMASK + 2 + + ) + + @/usr/include/bits/sigcontext.h + +19 #iâdeà +_BITS_SIGCONTEXT_H + + +20  + #_BITS_SIGCONTEXT_H + 1 + + ) + +22 #ià! +defšed + +_SIGNAL_H + && !defšed +_SYS_UCONTEXT_H + + +26  + ~ + +28  + s_å»g + + +30  + msignifiÿnd +[4]; + +31  + mexpÚ’t +; + +34  + s_åx»g + + +36  + msignifiÿnd +[4]; + +37  + mexpÚ’t +; + +38  + m·ddšg +[3]; + +41  + s_xmm»g + + +43 +__ušt32_t + + m–em’t +[4]; + +48 #ià +__WORDSIZE + == 32 + +50  + s_å¡©e + + +53 +__ušt32_t + + mcw +; + +54 +__ušt32_t + + msw +; + +55 +__ušt32_t + + mg +; + +56 +__ušt32_t + + moff +; + +57 +__ušt32_t + + mcs£l +; + +58 +__ušt32_t + + md©aoff +; + +59 +__ušt32_t + + md©a£l +; + +60  +_å»g + + m_¡ +[8]; + +61  + m¡©us +; + +62  + mmagic +; + +65 +__ušt32_t + + m_fx¤_’v +[6]; + +66 +__ušt32_t + + mmxc¤ +; + +67 +__ušt32_t + + m»£rved +; + +68  +_åx»g + + m_fx¤_¡ +[8]; + +69  +_xmm»g + + m_xmm +[8]; + +70 +__ušt32_t + + m·ddšg +[56]; + +73 #iâdeà +sigcÚ‹xt_¡ruù + + +78  + #sigcÚ‹xt_¡ruù + +sigcÚ‹xt + + + ) + +81  + ssigcÚ‹xt + + +83  + mgs +, + m__gsh +; + +84  + mfs +, + m__fsh +; + +85  + mes +, + m__esh +; + +86  + mds +, + m__dsh +; + +87  + medi +; + +88  + mesi +; + +89  + mebp +; + +90  + me¥ +; + +91  + mebx +; + +92  + medx +; + +93  + mecx +; + +94  + m—x +; + +95  + mŒ­no +; + +96  + m”r +; + +97  + me +; + +98  + mcs +, + m__csh +; + +99  + meæags +; + +100  + me¥_©_sigÇl +; + +101  + mss +, + m__ssh +; + +102  +_å¡©e + * + må¡©e +; + +103  + mÞdmask +; + +104  + mü2 +; + +109  + s_å¡©e + + +112 +__ušt16_t + + mcwd +; + +113 +__ušt16_t + + mswd +; + +114 +__ušt16_t + + máw +; + +115 +__ušt16_t + + mfÝ +; + +116 +__ušt64_t + + mr +; + +117 +__ušt64_t + + mrdp +; + +118 +__ušt32_t + + mmxc¤ +; + +119 +__ušt32_t + + mmxü_mask +; + +120  +_åx»g + + m_¡ +[8]; + +121  +_xmm»g + + m_xmm +[16]; + +122 +__ušt32_t + + m·ddšg +[24]; + +125  + ssigcÚ‹xt + + +127  + mr8 +; + +128  + mr9 +; + +129  + mr10 +; + +130  + mr11 +; + +131  + mr12 +; + +132  + mr13 +; + +133  + mr14 +; + +134  + mr15 +; + +135  + mrdi +; + +136  + mrsi +; + +137  + mrbp +; + +138  + mrbx +; + +139  + mrdx +; + +140  + m¿x +; + +141  + mrcx +; + +142  + mr¥ +; + +143  + mr +; + +144  + meæags +; + +145  + mcs +; + +146  + mgs +; + +147  + mfs +; + +148  + m__·d0 +; + +149  + m”r +; + +150  + mŒ­no +; + +151  + mÞdmask +; + +152  + mü2 +; + +153  +_å¡©e + * + må¡©e +; + +154  + m__»£rved1 + [8]; + + @/usr/include/bits/siginfo.h + +20 #ià! +defšed + +_SIGNAL_H + && !defšed +__Ãed_sigšfo_t + \ + +21 && ! +defšed + + g__Ãed_sigev’t_t + + +25  + ~ + +27 #ià(! +defšed + +__have_sigv®_t + \ + +28 && ( +defšed + + g_SIGNAL_H + || defšed + g__Ãed_sigšfo_t + \ + +29 || +defšed + + g__Ãed_sigev’t_t +)) + +30  + #__have_sigv®_t + 1 + + ) + +33  + usigv® + + +35  + msiv®_št +; + +36 * + msiv®_±r +; + +37 } + tsigv®_t +; + +40 #ià(! +defšed + +__have_sigšfo_t + \ + +41 && ( +defšed + + g_SIGNAL_H + || defšed + g__Ãed_sigšfo_t +)) + +42  + #__have_sigšfo_t + 1 + + ) + +44  + #__SI_MAX_SIZE + 128 + + ) + +45 #ià +__WORDSIZE + == 64 + +46  + #__SI_PAD_SIZE + (( +__SI_MAX_SIZE + /  ()è- 4) + + ) + +48  + #__SI_PAD_SIZE + (( +__SI_MAX_SIZE + /  ()è- 3) + + ) + +51  + ssigšfo + + +53  + msi_signo +; + +54  + msi_”ºo +; + +56  + msi_code +; + +60  + m_·d +[ +__SI_PAD_SIZE +]; + +65 +__pid_t + + msi_pid +; + +66 +__uid_t + + msi_uid +; + +67 } + m_kžl +; + +72  + msi_tid +; + +73  + msi_ov”run +; + +74 +sigv®_t + + msi_sigv® +; + +75 } + m_tim” +; + +80 +__pid_t + + msi_pid +; + +81 +__uid_t + + msi_uid +; + +82 +sigv®_t + + msi_sigv® +; + +83 } + m_¹ +; + +88 +__pid_t + + msi_pid +; + +89 +__uid_t + + msi_uid +; + +90  + msi_¡©us +; + +91 +__þock_t + + msi_utime +; + +92 +__þock_t + + msi_¡ime +; + +93 } + m_sigchld +; + +98 * + msi_addr +; + +99 } + m_sigçuÉ +; + +104  + msi_bªd +; + +105  + msi_fd +; + +106 } + m_sigpÞl +; + +107 } + m_sif›lds +; + +108 } + tsigšfo_t +; + +112  + #si_pid + +_sif›lds +. +_kžl +. +si_pid + + + ) + +113  + #si_uid + +_sif›lds +. +_kžl +. +si_uid + + + ) + +114  + #si_tim”id + +_sif›lds +. +_tim” +. +si_tid + + + ) + +115  + #si_ov”run + +_sif›lds +. +_tim” +. +si_ov”run + + + ) + +116  + #si_¡©us + +_sif›lds +. +_sigchld +. +si_¡©us + + + ) + +117  + #si_utime + +_sif›lds +. +_sigchld +. +si_utime + + + ) + +118  + #si_¡ime + +_sif›lds +. +_sigchld +. +si_¡ime + + + ) + +119  + #si_v®ue + +_sif›lds +. +_¹ +. +si_sigv® + + + ) + +120  + #si_št + +_sif›lds +. +_¹ +. +si_sigv® +. +siv®_št + + + ) + +121  + #si_±r + +_sif›lds +. +_¹ +. +si_sigv® +. +siv®_±r + + + ) + +122  + #si_addr + +_sif›lds +. +_sigçuÉ +. +si_addr + + + ) + +123  + #si_bªd + +_sif›lds +. +_sigpÞl +. +si_bªd + + + ) + +124  + #si_fd + +_sif›lds +. +_sigpÞl +. +si_fd + + + ) + +131 + mSI_ASYNCNL + = -60, + +132  + #SI_ASYNCNL + +SI_ASYNCNL + + + ) + +133 + mSI_TKILL + = -6, + +134  + #SI_TKILL + +SI_TKILL + + + ) + +135 + mSI_SIGIO +, + +136  + #SI_SIGIO + +SI_SIGIO + + + ) + +137 + mSI_ASYNCIO +, + +138  + #SI_ASYNCIO + +SI_ASYNCIO + + + ) + +139 + mSI_MESGQ +, + +140  + #SI_MESGQ + +SI_MESGQ + + + ) + +141 + mSI_TIMER +, + +142  + #SI_TIMER + +SI_TIMER + + + ) + +143 + mSI_QUEUE +, + +144  + #SI_QUEUE + +SI_QUEUE + + + ) + +145 + mSI_USER +, + +146  + #SI_USER + +SI_USER + + + ) + +147 + mSI_KERNEL + = 0x80 + +148  + #SI_KERNEL + +SI_KERNEL + + + ) + +155 + mILL_ILLOPC + = 1, + +156  + #ILL_ILLOPC + +ILL_ILLOPC + + + ) + +157 + mILL_ILLOPN +, + +158  + #ILL_ILLOPN + +ILL_ILLOPN + + + ) + +159 + mILL_ILLADR +, + +160  + #ILL_ILLADR + +ILL_ILLADR + + + ) + +161 + mILL_ILLTRP +, + +162  + #ILL_ILLTRP + +ILL_ILLTRP + + + ) + +163 + mILL_PRVOPC +, + +164  + #ILL_PRVOPC + +ILL_PRVOPC + + + ) + +165 + mILL_PRVREG +, + +166  + #ILL_PRVREG + +ILL_PRVREG + + + ) + +167 + mILL_COPROC +, + +168  + #ILL_COPROC + +ILL_COPROC + + + ) + +169 + mILL_BADSTK + + +170  + #ILL_BADSTK + +ILL_BADSTK + + + ) + +176 + mFPE_INTDIV + = 1, + +177  + #FPE_INTDIV + +FPE_INTDIV + + + ) + +178 + mFPE_INTOVF +, + +179  + #FPE_INTOVF + +FPE_INTOVF + + + ) + +180 + mFPE_FLTDIV +, + +181  + #FPE_FLTDIV + +FPE_FLTDIV + + + ) + +182 + mFPE_FLTOVF +, + +183  + #FPE_FLTOVF + +FPE_FLTOVF + + + ) + +184 + mFPE_FLTUND +, + +185  + #FPE_FLTUND + +FPE_FLTUND + + + ) + +186 + mFPE_FLTRES +, + +187  + #FPE_FLTRES + +FPE_FLTRES + + + ) + +188 + mFPE_FLTINV +, + +189  + #FPE_FLTINV + +FPE_FLTINV + + + ) + +190 + mFPE_FLTSUB + + +191  + #FPE_FLTSUB + +FPE_FLTSUB + + + ) + +197 + mSEGV_MAPERR + = 1, + +198  + #SEGV_MAPERR + +SEGV_MAPERR + + + ) + +199 + mSEGV_ACCERR + + +200  + #SEGV_ACCERR + +SEGV_ACCERR + + + ) + +206 + mBUS_ADRALN + = 1, + +207  + #BUS_ADRALN + +BUS_ADRALN + + + ) + +208 + mBUS_ADRERR +, + +209  + #BUS_ADRERR + +BUS_ADRERR + + + ) + +210 + mBUS_OBJERR + + +211  + #BUS_OBJERR + +BUS_OBJERR + + + ) + +217 + mTRAP_BRKPT + = 1, + +218  + #TRAP_BRKPT + +TRAP_BRKPT + + + ) + +219 + mTRAP_TRACE + + +220  + #TRAP_TRACE + +TRAP_TRACE + + + ) + +226 + mCLD_EXITED + = 1, + +227  + #CLD_EXITED + +CLD_EXITED + + + ) + +228 + mCLD_KILLED +, + +229  + #CLD_KILLED + +CLD_KILLED + + + ) + +230 + mCLD_DUMPED +, + +231  + #CLD_DUMPED + +CLD_DUMPED + + + ) + +232 + mCLD_TRAPPED +, + +233  + #CLD_TRAPPED + +CLD_TRAPPED + + + ) + +234 + mCLD_STOPPED +, + +235  + #CLD_STOPPED + +CLD_STOPPED + + + ) + +236 + mCLD_CONTINUED + + +237  + #CLD_CONTINUED + +CLD_CONTINUED + + + ) + +243 + mPOLL_IN + = 1, + +244  + #POLL_IN + +POLL_IN + + + ) + +245 + mPOLL_OUT +, + +246  + #POLL_OUT + +POLL_OUT + + + ) + +247 + mPOLL_MSG +, + +248  + #POLL_MSG + +POLL_MSG + + + ) + +249 + mPOLL_ERR +, + +250  + #POLL_ERR + +POLL_ERR + + + ) + +251 + mPOLL_PRI +, + +252  + #POLL_PRI + +POLL_PRI + + + ) + +253 + mPOLL_HUP + + +254  + #POLL_HUP + +POLL_HUP + + + ) + +257 #undeà +__Ãed_sigšfo_t + + +261 #ià( +defšed + +_SIGNAL_H + || defšed +__Ãed_sigev’t_t +) \ + +262 && ! +defšed + + g__have_sigev’t_t + + +263  + #__have_sigev’t_t + 1 + + ) + +266  + #__SIGEV_MAX_SIZE + 64 + + ) + +267 #ià +__WORDSIZE + == 64 + +268  + #__SIGEV_PAD_SIZE + (( +__SIGEV_MAX_SIZE + /  ()è- 4) + + ) + +270  + #__SIGEV_PAD_SIZE + (( +__SIGEV_MAX_SIZE + /  ()è- 3) + + ) + +273  + ssigev’t + + +275 +sigv®_t + + msigev_v®ue +; + +276  + msigev_signo +; + +277  + msigev_nÙify +; + +281  + m_·d +[ +__SIGEV_PAD_SIZE +]; + +285 +__pid_t + + m_tid +; + +289 (* + m_funùiÚ +è( + msigv®_t +); + +290 * + m_©Œibu‹ +; + +291 } + m_sigev_th»ad +; + +292 } + m_sigev_un +; + +293 } + tsigev’t_t +; + +296  + #sigev_nÙify_funùiÚ + +_sigev_un +. +_sigev_th»ad +. +_funùiÚ + + + ) + +297  + #sigev_nÙify_©Œibu‹s + +_sigev_un +. +_sigev_th»ad +. +_©Œibu‹ + + + ) + +302 + mSIGEV_SIGNAL + = 0, + +303  + #SIGEV_SIGNAL + +SIGEV_SIGNAL + + + ) + +304 + mSIGEV_NONE +, + +305  + #SIGEV_NONE + +SIGEV_NONE + + + ) + +306 + mSIGEV_THREAD +, + +307  + #SIGEV_THREAD + +SIGEV_THREAD + + + ) + +309 + mSIGEV_THREAD_ID + = 4 + +310  + #SIGEV_THREAD_ID + +SIGEV_THREAD_ID + + + ) + + @/usr/include/bits/signum.h + +20 #ifdef +_SIGNAL_H + + +23  + #SIG_ERR + (( +__sighªdËr_t +è-1è + + ) + +24  + #SIG_DFL + (( +__sighªdËr_t +è0è + + ) + +25  + #SIG_IGN + (( +__sighªdËr_t +è1è + + ) + +27 #ifdeà +__USE_UNIX98 + + +28  + #SIG_HOLD + (( +__sighªdËr_t +è2è + + ) + +33  + #SIGHUP + 1 + + ) + +34  + #SIGINT + 2 + + ) + +35  + #SIGQUIT + 3 + + ) + +36  + #SIGILL + 4 + + ) + +37  + #SIGTRAP + 5 + + ) + +38  + #SIGABRT + 6 + + ) + +39  + #SIGIOT + 6 + + ) + +40  + #SIGBUS + 7 + + ) + +41  + #SIGFPE + 8 + + ) + +42  + #SIGKILL + 9 + + ) + +43  + #SIGUSR1 + 10 + + ) + +44  + #SIGSEGV + 11 + + ) + +45  + #SIGUSR2 + 12 + + ) + +46  + #SIGPIPE + 13 + + ) + +47  + #SIGALRM + 14 + + ) + +48  + #SIGTERM + 15 + + ) + +49  + #SIGSTKFLT + 16 + + ) + +50  + #SIGCLD + +SIGCHLD + + + ) + +51  + #SIGCHLD + 17 + + ) + +52  + #SIGCONT + 18 + + ) + +53  + #SIGSTOP + 19 + + ) + +54  + #SIGTSTP + 20 + + ) + +55  + #SIGTTIN + 21 + + ) + +56  + #SIGTTOU + 22 + + ) + +57  + #SIGURG + 23 + + ) + +58  + #SIGXCPU + 24 + + ) + +59  + #SIGXFSZ + 25 + + ) + +60  + #SIGVTALRM + 26 + + ) + +61  + #SIGPROF + 27 + + ) + +62  + #SIGWINCH + 28 + + ) + +63  + #SIGPOLL + +SIGIO + + + ) + +64  + #SIGIO + 29 + + ) + +65  + #SIGPWR + 30 + + ) + +66  + #SIGSYS + 31 + + ) + +67  + #SIGUNUSED + 31 + + ) + +69  + #_NSIG + 65 + + ) + +72  + #SIGRTMIN + ( + `__libc_cu¼’t_sig¹mš + ()) + + ) + +73  + #SIGRTMAX + ( + `__libc_cu¼’t_sig¹max + ()) + + ) + +77  + #__SIGRTMIN + 32 + + ) + +78  + #__SIGRTMAX + ( +_NSIG + - 1) + + ) + + @/usr/include/bits/sigstack.h + +20 #iâdeà +_SIGNAL_H + + +26  + ssig¡ack + + +28 * + mss_¥ +; + +29  + mss_Ú¡ack +; + +36 + mSS_ONSTACK + = 1, + +37  + #SS_ONSTACK + +SS_ONSTACK + + + ) + +38 + mSS_DISABLE + + +39  + #SS_DISABLE + +SS_DISABLE + + + ) + +43  + #MINSIGSTKSZ + 2048 + + ) + +46  + #SIGSTKSZ + 8192 + + ) + +50  + ssig®t¡ack + + +52 * + mss_¥ +; + +53  + mss_æags +; + +54 +size_t + + mss_size +; + +55 } + t¡ack_t +; + + @/usr/include/bits/sigthread.h + +20 #iâdeà +_BITS_SIGTHREAD_H + + +21  + #_BITS_SIGTHREAD_H + 1 + + ) + +23 #ià! +defšed + +_SIGNAL_H + && !defšed +_PTHREAD_H + + +31  + $±h»ad_sigmask + ( +__how +, + +32 +__cÚ¡ + +__sig£t_t + * +__»¡riù + +__Ãwmask +, + +33 +__sig£t_t + * +__»¡riù + +__Þdmask +) +__THROW +; + +36  + $±h»ad_kžl + ( +±h»ad_t + +__th»adid +,  +__signo +è +__THROW +; + +38 #ifdeà +__USE_GNU + + +40  + $±h»ad_sigqueue + ( +±h»ad_t + +__th»adid +,  +__signo +, + +41 cÚ¡  +sigv® + +__v®ue +è +__THROW +; + + @/usr/include/linux/errno.h + +1 #iâdeà +_LINUX_ERRNO_H + + +2  + #_LINUX_ERRNO_H + + + ) + +4  + ~ + + @/usr/include/sys/ucontext.h + +19 #iâdeà +_SYS_UCONTEXT_H + + +20  + #_SYS_UCONTEXT_H + 1 + + ) + +22  + ~<ã©u»s.h +> + +23  + ~ + +24  + ~ + +28  + ~ + +30 #ià +__WORDSIZE + == 64 + +33  + tg»g_t +; + +36  + #NGREG + 23 + + ) + +39  +g»g_t + + tg»g£t_t +[ +NGREG +]; + +41 #ifdeà +__USE_GNU + + +45 + mREG_R8 + = 0, + +46  + #REG_R8 + +REG_R8 + + + ) + +47 + mREG_R9 +, + +48  + #REG_R9 + +REG_R9 + + + ) + +49 + mREG_R10 +, + +50  + #REG_R10 + +REG_R10 + + + ) + +51 + mREG_R11 +, + +52  + #REG_R11 + +REG_R11 + + + ) + +53 + mREG_R12 +, + +54  + #REG_R12 + +REG_R12 + + + ) + +55 + mREG_R13 +, + +56  + #REG_R13 + +REG_R13 + + + ) + +57 + mREG_R14 +, + +58  + #REG_R14 + +REG_R14 + + + ) + +59 + mREG_R15 +, + +60  + #REG_R15 + +REG_R15 + + + ) + +61 + mREG_RDI +, + +62  + #REG_RDI + +REG_RDI + + + ) + +63 + mREG_RSI +, + +64  + #REG_RSI + +REG_RSI + + + ) + +65 + mREG_RBP +, + +66  + #REG_RBP + +REG_RBP + + + ) + +67 + mREG_RBX +, + +68  + #REG_RBX + +REG_RBX + + + ) + +69 + mREG_RDX +, + +70  + #REG_RDX + +REG_RDX + + + ) + +71 + mREG_RAX +, + +72  + #REG_RAX + +REG_RAX + + + ) + +73 + mREG_RCX +, + +74  + #REG_RCX + +REG_RCX + + + ) + +75 + mREG_RSP +, + +76  + #REG_RSP + +REG_RSP + + + ) + +77 + mREG_RIP +, + +78  + #REG_RIP + +REG_RIP + + + ) + +79 + mREG_EFL +, + +80  + #REG_EFL + +REG_EFL + + + ) + +81 + mREG_CSGSFS +, + +82  + #REG_CSGSFS + +REG_CSGSFS + + + ) + +83 + mREG_ERR +, + +84  + #REG_ERR + +REG_ERR + + + ) + +85 + mREG_TRAPNO +, + +86  + #REG_TRAPNO + +REG_TRAPNO + + + ) + +87 + mREG_OLDMASK +, + +88  + #REG_OLDMASK + +REG_OLDMASK + + + ) + +89 + mREG_CR2 + + +90  + #REG_CR2 + +REG_CR2 + + + ) + +94  + s_libc_åx»g + + +96  + msignifiÿnd +[4]; + +97  + mexpÚ’t +; + +98  + m·ddšg +[3]; + +101  + s_libc_xmm»g + + +103 +__ušt32_t + + m–em’t +[4]; + +106  + s_libc_å¡©e + + +109 +__ušt16_t + + mcwd +; + +110 +__ušt16_t + + mswd +; + +111 +__ušt16_t + + máw +; + +112 +__ušt16_t + + mfÝ +; + +113 +__ušt64_t + + mr +; + +114 +__ušt64_t + + mrdp +; + +115 +__ušt32_t + + mmxc¤ +; + +116 +__ušt32_t + + mmxü_mask +; + +117  +_libc_åx»g + + m_¡ +[8]; + +118  +_libc_xmm»g + + m_xmm +[16]; + +119 +__ušt32_t + + m·ddšg +[24]; + +123  +_libc_å¡©e + * + tå»g£t_t +; + +128 +g»g£t_t + + mg»gs +; + +130 +å»g£t_t + + må»gs +; + +131  + m__»£rved1 + [8]; + +132 } + tmcÚ‹xt_t +; + +135  + sucÚ‹xt + + +137  + muc_æags +; + +138  +ucÚ‹xt + * + muc_lšk +; + +139 +¡ack_t + + muc_¡ack +; + +140 +mcÚ‹xt_t + + muc_mcÚ‹xt +; + +141 +__sig£t_t + + muc_sigmask +; + +142  +_libc_å¡©e + + m__å»gs_mem +; + +143 } + tucÚ‹xt_t +; + +148  + tg»g_t +; + +151  + #NGREG + 19 + + ) + +154  +g»g_t + + tg»g£t_t +[ +NGREG +]; + +156 #ifdeà +__USE_GNU + + +160 + mREG_GS + = 0, + +161  + #REG_GS + +REG_GS + + + ) + +162 + mREG_FS +, + +163  + #REG_FS + +REG_FS + + + ) + +164 + mREG_ES +, + +165  + #REG_ES + +REG_ES + + + ) + +166 + mREG_DS +, + +167  + #REG_DS + +REG_DS + + + ) + +168 + mREG_EDI +, + +169  + #REG_EDI + +REG_EDI + + + ) + +170 + mREG_ESI +, + +171  + #REG_ESI + +REG_ESI + + + ) + +172 + mREG_EBP +, + +173  + #REG_EBP + +REG_EBP + + + ) + +174 + mREG_ESP +, + +175  + #REG_ESP + +REG_ESP + + + ) + +176 + mREG_EBX +, + +177  + #REG_EBX + +REG_EBX + + + ) + +178 + mREG_EDX +, + +179  + #REG_EDX + +REG_EDX + + + ) + +180 + mREG_ECX +, + +181  + #REG_ECX + +REG_ECX + + + ) + +182 + mREG_EAX +, + +183  + #REG_EAX + +REG_EAX + + + ) + +184 + mREG_TRAPNO +, + +185  + #REG_TRAPNO + +REG_TRAPNO + + + ) + +186 + mREG_ERR +, + +187  + #REG_ERR + +REG_ERR + + + ) + +188 + mREG_EIP +, + +189  + #REG_EIP + +REG_EIP + + + ) + +190 + mREG_CS +, + +191  + #REG_CS + +REG_CS + + + ) + +192 + mREG_EFL +, + +193  + #REG_EFL + +REG_EFL + + + ) + +194 + mREG_UESP +, + +195  + #REG_UESP + +REG_UESP + + + ) + +196 + mREG_SS + + +197  + #REG_SS + +REG_SS + + + ) + +202  + s_libc_å»g + + +204  + msignifiÿnd +[4]; + +205  + mexpÚ’t +; + +208  + s_libc_å¡©e + + +210  + mcw +; + +211  + msw +; + +212  + mg +; + +213  + moff +; + +214  + mcs£l +; + +215  + md©aoff +; + +216  + md©a£l +; + +217  +_libc_å»g + + m_¡ +[8]; + +218  + m¡©us +; + +222  +_libc_å¡©e + * + tå»g£t_t +; + +227 +g»g£t_t + + mg»gs +; + +230 +å»g£t_t + + må»gs +; + +231  + mÞdmask +; + +232  + mü2 +; + +233 } + tmcÚ‹xt_t +; + +236  + sucÚ‹xt + + +238  + muc_æags +; + +239  +ucÚ‹xt + * + muc_lšk +; + +240 +¡ack_t + + muc_¡ack +; + +241 +mcÚ‹xt_t + + muc_mcÚ‹xt +; + +242 +__sig£t_t + + muc_sigmask +; + +243  +_libc_å¡©e + + m__å»gs_mem +; + +244 } + tucÚ‹xt_t +; + + @/usr/include/asm/errno.h + +1  + ~ + + @/usr/include/asm-generic/errno.h + +1 #iâdeà +_ASM_GENERIC_ERRNO_H + + +2  + #_ASM_GENERIC_ERRNO_H + + + ) + +4  + ~ + +6  + #EDEADLK + 35 + + ) + +7  + #ENAMETOOLONG + 36 + + ) + +8  + #ENOLCK + 37 + + ) + +9  + #ENOSYS + 38 + + ) + +10  + #ENOTEMPTY + 39 + + ) + +11  + #ELOOP + 40 + + ) + +12  + #EWOULDBLOCK + +EAGAIN + + + ) + +13  + #ENOMSG + 42 + + ) + +14  + #EIDRM + 43 + + ) + +15  + #ECHRNG + 44 + + ) + +16  + #EL2NSYNC + 45 + + ) + +17  + #EL3HLT + 46 + + ) + +18  + #EL3RST + 47 + + ) + +19  + #ELNRNG + 48 + + ) + +20  + #EUNATCH + 49 + + ) + +21  + #ENOCSI + 50 + + ) + +22  + #EL2HLT + 51 + + ) + +23  + #EBADE + 52 + + ) + +24  + #EBADR + 53 + + ) + +25  + #EXFULL + 54 + + ) + +26  + #ENOANO + 55 + + ) + +27  + #EBADRQC + 56 + + ) + +28  + #EBADSLT + 57 + + ) + +30  + #EDEADLOCK + +EDEADLK + + + ) + +32  + #EBFONT + 59 + + ) + +33  + #ENOSTR + 60 + + ) + +34  + #ENODATA + 61 + + ) + +35  + #ETIME + 62 + + ) + +36  + #ENOSR + 63 + + ) + +37  + #ENONET + 64 + + ) + +38  + #ENOPKG + 65 + + ) + +39  + #EREMOTE + 66 + + ) + +40  + #ENOLINK + 67 + + ) + +41  + #EADV + 68 + + ) + +42  + #ESRMNT + 69 + + ) + +43  + #ECOMM + 70 + + ) + +44  + #EPROTO + 71 + + ) + +45  + #EMULTIHOP + 72 + + ) + +46  + #EDOTDOT + 73 + + ) + +47  + #EBADMSG + 74 + + ) + +48  + #EOVERFLOW + 75 + + ) + +49  + #ENOTUNIQ + 76 + + ) + +50  + #EBADFD + 77 + + ) + +51  + #EREMCHG + 78 + + ) + +52  + #ELIBACC + 79 + + ) + +53  + #ELIBBAD + 80 + + ) + +54  + #ELIBSCN + 81 + + ) + +55  + #ELIBMAX + 82 + + ) + +56  + #ELIBEXEC + 83 + + ) + +57  + #EILSEQ + 84 + + ) + +58  + #ERESTART + 85 + + ) + +59  + #ESTRPIPE + 86 + + ) + +60  + #EUSERS + 87 + + ) + +61  + #ENOTSOCK + 88 + + ) + +62  + #EDESTADDRREQ + 89 + + ) + +63  + #EMSGSIZE + 90 + + ) + +64  + #EPROTOTYPE + 91 + + ) + +65  + #ENOPROTOOPT + 92 + + ) + +66  + #EPROTONOSUPPORT + 93 + + ) + +67  + #ESOCKTNOSUPPORT + 94 + + ) + +68  + #EOPNOTSUPP + 95 + + ) + +69  + #EPFNOSUPPORT + 96 + + ) + +70  + #EAFNOSUPPORT + 97 + + ) + +71  + #EADDRINUSE + 98 + + ) + +72  + #EADDRNOTAVAIL + 99 + + ) + +73  + #ENETDOWN + 100 + + ) + +74  + #ENETUNREACH + 101 + + ) + +75  + #ENETRESET + 102 + + ) + +76  + #ECONNABORTED + 103 + + ) + +77  + #ECONNRESET + 104 + + ) + +78  + #ENOBUFS + 105 + + ) + +79  + #EISCONN + 106 + + ) + +80  + #ENOTCONN + 107 + + ) + +81  + #ESHUTDOWN + 108 + + ) + +82  + #ETOOMANYREFS + 109 + + ) + +83  + #ETIMEDOUT + 110 + + ) + +84  + #ECONNREFUSED + 111 + + ) + +85  + #EHOSTDOWN + 112 + + ) + +86  + #EHOSTUNREACH + 113 + + ) + +87  + #EALREADY + 114 + + ) + +88  + #EINPROGRESS + 115 + + ) + +89  + #ESTALE + 116 + + ) + +90  + #EUCLEAN + 117 + + ) + +91  + #ENOTNAM + 118 + + ) + +92  + #ENAVAIL + 119 + + ) + +93  + #EISNAM + 120 + + ) + +94  + #EREMOTEIO + 121 + + ) + +95  + #EDQUOT + 122 + + ) + +97  + #ENOMEDIUM + 123 + + ) + +98  + #EMEDIUMTYPE + 124 + + ) + +99  + #ECANCELED + 125 + + ) + +100  + #ENOKEY + 126 + + ) + +101  + #EKEYEXPIRED + 127 + + ) + +102  + #EKEYREVOKED + 128 + + ) + +103  + #EKEYREJECTED + 129 + + ) + +106  + #EOWNERDEAD + 130 + + ) + +107  + #ENOTRECOVERABLE + 131 + + ) + +109  + #ERFKILL + 132 + + ) + + @/usr/include/asm-generic/errno-base.h + +1 #iâdeà +_ASM_GENERIC_ERRNO_BASE_H + + +2  + #_ASM_GENERIC_ERRNO_BASE_H + + + ) + +4  + #EPERM + 1 + + ) + +5  + #ENOENT + 2 + + ) + +6  + #ESRCH + 3 + + ) + +7  + #EINTR + 4 + + ) + +8  + #EIO + 5 + + ) + +9  + #ENXIO + 6 + + ) + +10  + #E2BIG + 7 + + ) + +11  + #ENOEXEC + 8 + + ) + +12  + #EBADF + 9 + + ) + +13  + #ECHILD + 10 + + ) + +14  + #EAGAIN + 11 + + ) + +15  + #ENOMEM + 12 + + ) + +16  + #EACCES + 13 + + ) + +17  + #EFAULT + 14 + + ) + +18  + #ENOTBLK + 15 + + ) + +19  + #EBUSY + 16 + + ) + +20  + #EEXIST + 17 + + ) + +21  + #EXDEV + 18 + + ) + +22  + #ENODEV + 19 + + ) + +23  + #ENOTDIR + 20 + + ) + +24  + #EISDIR + 21 + + ) + +25  + #EINVAL + 22 + + ) + +26  + #ENFILE + 23 + + ) + +27  + #EMFILE + 24 + + ) + +28  + #ENOTTY + 25 + + ) + +29  + #ETXTBSY + 26 + + ) + +30  + #EFBIG + 27 + + ) + +31  + #ENOSPC + 28 + + ) + +32  + #ESPIPE + 29 + + ) + +33  + #EROFS + 30 + + ) + +34  + #EMLINK + 31 + + ) + +35  + #EPIPE + 32 + + ) + +36  + #EDOM + 33 + + ) + +37  + #ERANGE + 34 + + ) + + @ +1 +. +1 +/usr/include +87 +2228 +CG.cc +CG_roseBuilder.cc +CG_roseRepr.cc +CG_stringBuilder.cc +CG_stringRepr.cc +CG_suifBuilder.cc +CG_suifRepr.cc +code_gen.cc +output_repr.cc +/usr/include/math.h +/usr/include/stdio.h +/usr/include/string.h +/usr/include/bits/huge_val.h +/usr/include/bits/huge_valf.h +/usr/include/bits/huge_vall.h +/usr/include/bits/inf.h +/usr/include/bits/mathcalls.h +/usr/include/bits/mathdef.h +/usr/include/bits/mathinline.h +/usr/include/bits/nan.h +/usr/include/bits/stdio-ldbl.h +/usr/include/bits/stdio.h +/usr/include/bits/stdio2.h +/usr/include/bits/stdio_lim.h +/usr/include/bits/string.h +/usr/include/bits/string2.h +/usr/include/bits/string3.h +/usr/include/bits/sys_errlist.h +/usr/include/bits/types.h +/usr/include/features.h +/usr/include/getopt.h +/usr/include/libio.h +/usr/include/xlocale.h +/usr/include/_G_config.h +/usr/include/bits/libio-ldbl.h +/usr/include/bits/predefs.h +/usr/include/bits/stdio-lock.h +/usr/include/bits/typesizes.h +/usr/include/bits/wordsize.h +/usr/include/ctype.h +/usr/include/endian.h +/usr/include/gnu/stubs.h +/usr/include/stdlib.h +/usr/include/sys/cdefs.h +/usr/include/alloca.h +/usr/include/bits/byteswap.h +/usr/include/bits/endian.h +/usr/include/bits/libc-lock.h +/usr/include/bits/stdlib-ldbl.h +/usr/include/bits/stdlib.h +/usr/include/bits/waitflags.h +/usr/include/bits/waitstatus.h +/usr/include/gconv.h +/usr/include/gnu/stubs-32.h +/usr/include/gnu/stubs-64.h +/usr/include/sys/types.h +/usr/include/wchar.h +/usr/include/bits/pthreadtypes.h +/usr/include/bits/wchar-ldbl.h +/usr/include/bits/wchar.h +/usr/include/bits/wchar2.h +/usr/include/errno.h +/usr/include/gnu/option-groups.h +/usr/include/pthread.h +/usr/include/sys/select.h +/usr/include/sys/sysmacros.h +/usr/include/time.h +/usr/include/wctype.h +/usr/include/bits/errno.h +/usr/include/bits/select.h +/usr/include/bits/setjmp.h +/usr/include/bits/sigset.h +/usr/include/bits/time.h +/usr/include/sched.h +/usr/include/signal.h +/usr/include/bits/sched.h +/usr/include/bits/sigaction.h +/usr/include/bits/sigcontext.h +/usr/include/bits/siginfo.h +/usr/include/bits/signum.h +/usr/include/bits/sigstack.h +/usr/include/bits/sigthread.h +/usr/include/linux/errno.h +/usr/include/sys/ucontext.h +/usr/include/asm/errno.h +/usr/include/asm-generic/errno.h +/usr/include/asm-generic/errno-base.h diff --git a/omegalib/code_gen/src/output_repr.cc b/omegalib/code_gen/src/output_repr.cc new file mode 100644 index 0000000..955cc14 --- /dev/null +++ b/omegalib/code_gen/src/output_repr.cc @@ -0,0 +1,1931 @@ +/***************************************************************************** + Copyright (C) 1994-2000 University of Maryland + Copyright (C) 2008 University of Southern California + Copyright (C) 2009-2010 University of Utah + All Rights Reserved. + + Purpose: + utility functions for outputing CG_outputReprs + + Notes: + + History: + 07/30/10 collect various code outputing into one place, by Chun Chen +*****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include + +namespace omega { + +extern Tuple > projected_nIS; +int var_substitution_threshold = 100; +//protonu. +extern int upperBoundForLevel; +extern int lowerBoundForLevel; +extern bool fillInBounds; +//end--protonu. + +} + + +namespace omega { + +std::pair find_simplest_assignment(const Relation &R_, Variable_ID v, const std::vector &assigned_on_the_fly); + + +namespace { + + + + +void get_stride(const Constraint_Handle &h, Variable_ID &wc, coef_t &step){ + wc = 0; + for(Constr_Vars_Iter i(h,true); i; i++) { + assert(wc == 0); + wc = (*i).var; + step = ((*i).coef); + } +} + +} + +CG_outputRepr* outputIdent(CG_outputBuilder* ocg, const Relation &R_, Variable_ID v, const std::vector &assigned_on_the_fly) { + Relation &R = const_cast(R_); + + switch (v->kind()) { + case Set_Var: { + int pos = v->get_position(); + if (assigned_on_the_fly[pos-1] != NULL) + return assigned_on_the_fly[pos-1]->clone(); + else + return ocg->CreateIdent(v->name()); + break; + } + case Global_Var: { + if (v->get_global_var()->arity() == 0) + return ocg->CreateIdent(v->name()); + else { + /* This should be improved to take into account the possible elimination + of the set variables. */ + int arity = v->get_global_var()->arity(); + //assert(arity <= last_level); + Tuple argList; + // Relation R = Relation::True(arity); + + // name_codegen_vars(R); // easy way to make sure the names are correct. + for(int i = 1; i <= arity; i++) + argList.append(ocg->CreateIdent(R.set_var(i)->name())); + CG_outputRepr *call = ocg->CreateInvoke(v->get_global_var()->base_name(), argList); + return call; + } + break; + } + default: + throw std::invalid_argument("wrong variable type"); + } +} + + +//---------------------------------------------------------------------------- +// Translate equality constraints to if-condition and assignment. +// return.first is right-hand-side of assignment, return.second +// is true if assignment is required. +// -- by chun 07/29/2010 +// ---------------------------------------------------------------------------- +std::pair outputAssignment(CG_outputBuilder *ocg, const Relation &R_, Variable_ID v, Relation &enforced, CG_outputRepr *&if_repr, const std::vector &assigned_on_the_fly) { + Relation &R = const_cast(R_); + + Conjunct *c = R.query_DNF()->single_conjunct(); + + // check whether to generate if-conditions from equality constraints + for (EQ_Iterator ei(c); ei; ei++) + if (!(*ei).has_wildcards() && abs((*ei).get_coef(v)) > 1) { + Relation r(R.n_set()); + F_And *f_super_root = r.add_and(); + F_Exists *fe = f_super_root->add_exists(); + Variable_ID e = fe->declare(); + F_And *f_root = fe->add_and(); + EQ_Handle h = f_root->add_EQ(); + for (Constr_Vars_Iter cvi(*ei); cvi; cvi++) + switch ((*cvi).var->kind()) { + case Input_Var: { + if ((*cvi).var == v) + h.update_coef(e, (*cvi).coef); + else + h.update_coef(r.set_var((*cvi).var->get_position()), (*cvi).coef); + break; + } + case Global_Var: { + Global_Var_ID g = (*cvi).var->get_global_var(); + Variable_ID v2; + if (g->arity() == 0) + v2 = r.get_local(g); + else + v2 = r.get_local(g, (*cvi).var->function_of()); + h.update_coef(v2, (*cvi).coef); + break; + } + default: + assert(0); + } + h.update_const((*ei).get_const()); + + r.copy_names(R); + r.setup_names(); + + // need if-condition to make sure this loop variable has integer value + if (!Gist(r, copy(enforced), 1).is_obvious_tautology()) { + coef_t coef = (*ei).get_coef(v); + coef_t sign = -((coef>0)?1:-1); + coef = abs(coef); + + CG_outputRepr *term = NULL; + for (Constr_Vars_Iter cvi(*ei); cvi; cvi++) + if ((*cvi).var != v) { + CG_outputRepr *varRepr = outputIdent(ocg, R, (*cvi).var, assigned_on_the_fly); + coef_t t = sign*(*cvi).coef; + if (t == 1) + term = ocg->CreatePlus(term, varRepr); + else if (t == -1) + term = ocg->CreateMinus(term, varRepr); + else if (t > 0) + term = ocg->CreatePlus(term, ocg->CreateTimes(ocg->CreateInt(t), varRepr)); + else if (t < 0) + term = ocg->CreateMinus(term, ocg->CreateTimes(ocg->CreateInt(-t), varRepr)); + } + coef_t t = sign*(*ei).get_const(); + if (t > 0) + term = ocg->CreatePlus(term, ocg->CreateInt(t)); + else if (t < 0) + term = ocg->CreateMinus(term, ocg->CreateInt(-t)); + + term = ocg->CreateIntegerMod(term, ocg->CreateInt(coef)); + term = ocg->CreateEQ(term, ocg->CreateInt(0)); + + if_repr = ocg->CreateAnd(if_repr, term); + } + + enforced.and_with_EQ(*ei); + enforced.simplify(); + } + + // find the simplest assignment + std::pair a = find_simplest_assignment(R, v, assigned_on_the_fly); + + // now generate assignment + if (a.second < INT_MAX) { + EQ_Handle eq = a.first; + CG_outputRepr *rop_repr = NULL; + + coef_t divider = eq.get_coef(v); + int sign = 1; + if (divider < 0) { + divider = -divider; + sign = -1; + } + + for (Constr_Vars_Iter cvi(eq); cvi; cvi++) + if ((*cvi).var != v) { + CG_outputRepr *var_repr = outputIdent(ocg, R, (*cvi).var, assigned_on_the_fly); + coef_t coef = (*cvi).coef; + if (-sign * coef == -1) + rop_repr = ocg->CreateMinus(rop_repr, var_repr); + else if (-sign * coef < -1) + rop_repr = ocg->CreateMinus(rop_repr, ocg->CreateTimes(ocg->CreateInt(sign * coef), var_repr)); + else if (-sign * coef == 1) + rop_repr = ocg->CreatePlus(rop_repr, var_repr); + else // -sign * coef > 1 + rop_repr = ocg->CreatePlus(rop_repr, ocg->CreateTimes(ocg->CreateInt(-sign * coef), var_repr)); + } + + coef_t c_term = -(eq.get_const() * sign); + + if (c_term > 0) + rop_repr = ocg->CreatePlus(rop_repr, ocg->CreateInt(c_term)); + else if (c_term < 0) + rop_repr = ocg->CreateMinus(rop_repr, ocg->CreateInt(-c_term)); + else if (rop_repr == NULL) + rop_repr = ocg->CreateInt(0); + + if (divider != 1) + rop_repr = ocg->CreateIntegerDivide(rop_repr, ocg->CreateInt(divider)); + + enforced.and_with_EQ(eq); + enforced.simplify(); + + if (a.second > var_substitution_threshold) + return std::make_pair(rop_repr, true); + else + return std::make_pair(rop_repr, false); + } + else + return std::make_pair(static_cast(NULL), false); +} + + +//---------------------------------------------------------------------------- +// Don't use Substitutions class since it can't handle integer +// division. Instead, use relation mapping to a single output +// variable to get substitution. -- by chun, 07/19/2007 +//---------------------------------------------------------------------------- +Tuple outputSubstitution(CG_outputBuilder* ocg, const Relation &R_, const std::vector &assigned_on_the_fly) { + Relation &R = const_cast(R_); + + const int n = R.n_out(); + Tuple oReprList; + + // Find substitution for each output variable + for (int i = 1; i <= n; i++) { + Relation mapping(n, 1); + F_And *f_root = mapping.add_and(); + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.output_var(1), 1); + h.update_coef(mapping.input_var(i), -1); + + Relation S = Composition(mapping, copy(R)); + + std::pair a = find_simplest_assignment(S, S.output_var(1), assigned_on_the_fly); + + if (a.second < INT_MAX) { + while (a.second > 0) { + EQ_Handle eq = a.first; + std::set candidates; + for (Constr_Vars_Iter cvi(eq); cvi; cvi++) + if ((*cvi).var->kind() == Input_Var) + candidates.insert((*cvi).var->get_position()); + + bool changed = false; + for (std::set::iterator j = candidates.begin(); j != candidates.end(); j++) { + Relation S2 = Project(copy(S), *j, Input_Var); + std::pair a2 = find_simplest_assignment(S2, S2.output_var(1), assigned_on_the_fly); + if (a2.second <= a.second) { + S = S2; + a = a2; + changed = true; + break; + } + } + if (!changed) + break; + } + } + + if (a.second < INT_MAX) { + CG_outputRepr *repr = NULL; + EQ_Handle eq = a.first; + Variable_ID v = S.output_var(1); + + for (int j = 1; j <= S.n_inp(); j++) + S.name_input_var(j, R.input_var(j)->name()); + S.setup_names(); + + int d = eq.get_coef(v); + assert(d != 0); + int sign = (d>0)?-1:1; + d = -sign * d; + for (Constr_Vars_Iter cvi(eq); cvi; cvi++) + if ((*cvi).var != v) { + int coef = sign * (*cvi).coef; + CG_outputRepr *op = outputIdent(ocg, S, (*cvi).var, assigned_on_the_fly); + if (coef > 1) + op = ocg->CreateTimes(ocg->CreateInt(coef), op); + else if (coef < -1) + op = ocg->CreateTimes(ocg->CreateInt(-coef), op); + if (coef > 0) + repr = ocg->CreatePlus(repr, op); + else if (coef < 0) + repr = ocg->CreateMinus(repr, op); + } + + int c = sign * eq.get_const(); + if (c > 0) + repr = ocg->CreatePlus(repr, ocg->CreateInt(c)); + else if (c < 0) + repr = ocg->CreateMinus(repr, ocg->CreateInt(-c)); + else if (repr == NULL) + repr = ocg->CreateInt(0); + + if (d != 1) + repr = ocg->CreateIntegerDivide(repr, ocg->CreateInt(d)); + + oReprList.append(repr); + } + else + oReprList.append(NULL); + } + + return oReprList; +} + +namespace { + +Relation create_stride_on_bound(int n, const std::map &lb, coef_t stride) { + Relation result(n); + F_And *f_root = result.add_and(); + EQ_Handle h = f_root->add_stride(stride); + + for (std::map::const_iterator i = lb.begin(); i != lb.end(); i++) { + if (i->first == NULL) + h.update_const(i->second); + else { + switch(i->first->kind()) { + case Input_Var: { + int pos = i->first->get_position(); + h.update_coef(result.set_var(pos), i->second); + break; + } + case Global_Var: { + Global_Var_ID g = i->first->get_global_var(); + Variable_ID v; + if (g->arity() == 0) + v = result.get_local(g); + else + v = result.get_local(g, i->first->function_of()); + h.update_coef(v, i->second); + break; + } + default: + assert(0); + } + } + } + + return result; +} + +} + +//---------------------------------------------------------------------------- +// Find the most restrictive common stride constraint for a set of +// relations. -- by chun, 05/20/09 +// ---------------------------------------------------------------------------- +Relation greatest_common_step(const Tuple &I, const Tuple &active, int level, const Relation &known) { + assert(I.size() == active.size()); + int n = 0; + + std::vector I1, I2; + for (int i = 1; i <= I.size(); i++) + if (active[i]) { + if (n == 0) + n = I[i].n_set(); + + Relation r1; + if (known.is_null()) + r1 = copy(I[i]); + else { + r1 = Intersection(copy(I[i]), copy(known)); + r1.simplify(); + } + I1.push_back(r1); + Relation r2 = Gist(copy(I[i]), copy(known)); + assert(r2.is_upper_bound_satisfiable()); + if (r2.is_obvious_tautology()) + return Relation::True(n); + I2.push_back(r2); + } + + std::vector is_exact(I2.size(), true); + std::vector step(I2.size(), 0); + std::vector messy_step(I2.size(), 0); + Variable_ID t_col = set_var(level); + std::map lb; + + // first check all clean strides: t_col = ... (mod step) + for (size_t i = 0; i < I2.size(); i++) { + Conjunct *c = I2[i].query_DNF()->single_conjunct(); + + bool is_degenerated = false; + for (EQ_Iterator e = c->EQs(); e; e++) { + coef_t coef = abs((*e).get_coef(t_col)); + if (coef != 0 && !(*e).has_wildcards()) { + is_degenerated = true; + break; + } + } + if (is_degenerated) + continue; + + for (EQ_Iterator e = c->EQs(); e; e++) { + if ((*e).has_wildcards()) { + coef_t coef = abs((*e).get_coef(t_col)); + if (coef == 0) + continue; + if (coef != 1) { + is_exact[i] = false; + continue; + } + + coef_t this_step = abs(Constr_Vars_Iter(*e, true).curr_coef()); + assert(this_step != 1); + + if (lb.size() != 0) { + Relation test = create_stride_on_bound(n, lb, this_step); + if (Gist(test, copy(I1[i])).is_obvious_tautology()) { + if (step[i] == 0) + step[i] = this_step; + else + step[i] = lcm(step[i], this_step); + } + else + is_exact[i] = false; + } + else { + // try to find a lower bound that hits on stride + Conjunct *c = I2[i].query_DNF()->single_conjunct(); + for (GEQ_Iterator ge = c->GEQs(); ge; ge++) { + if ((*ge).has_wildcards() || (*ge).get_coef(t_col) != 1) + continue; + + std::map cur_lb; + for (Constr_Vars_Iter cv(*ge); cv; cv++) + cur_lb[cv.curr_var()] = cv.curr_coef(); + cur_lb[NULL] = (*ge).get_const(); + + Relation test = create_stride_on_bound(n, cur_lb, this_step); + if (Gist(test, copy(I1[i])).is_obvious_tautology()) { + if (step[i] == 0) + step[i] = this_step; + else + step[i] = lcm(step[i], this_step); + + lb = cur_lb; + break; + } + } + + // no clean lower bound, thus we use this modular constraint as is + if (lb.size() == 0) { + std::map cur_lb; + int wild_count = 0; + for (Constr_Vars_Iter cv(*e); cv; cv++) + if (cv.curr_var()->kind() == Wildcard_Var) + wild_count++; + else + cur_lb[cv.curr_var()] = cv.curr_coef(); + cur_lb[NULL] = (*e).get_const(); + + if (wild_count == 1) { + lb = cur_lb; + if (step[i] == 0) + step[i] = this_step; + else + step[i] = lcm(step[i], this_step); + } + } + + if (lb.size() == 0) + is_exact[i] = false; + } + } + } + } + + // aggregate all exact steps + coef_t global_step = 0; + for (size_t i = 0; i < is_exact.size(); i++) + if (is_exact[i]) + global_step = gcd(global_step, step[i]); + if (global_step == 1) + return Relation::True(n); + + // now check all messy strides: a*t_col = ... (mod step) + for (size_t i = 0; i < I2.size(); i++) + if (!is_exact[i]) { + Conjunct *c = I2[i].query_DNF()->single_conjunct(); + for (EQ_Iterator e = c->EQs(); e; e++) { + coef_t coef = abs((*e).get_coef(t_col)); + if (coef == 0 || coef == 1) + continue; + + // make a guess for messy stride condition -- by chun 07/27/2007 + coef_t this_step = abs(Constr_Vars_Iter(*e, true).curr_coef()); + this_step /= gcd(this_step, coef); + this_step = gcd(global_step, this_step); + if (this_step == 1) + continue; + + if (lb.size() != 0) { + Relation test = create_stride_on_bound(n, lb, this_step); + if (Gist(test, copy(I1[i])).is_obvious_tautology()) { + if (step[i] == 0) + step[i] = this_step; + else + step[i] = lcm(step[i], this_step); + } + } + else { + // try to find a lower bound that hits on stride + Conjunct *c = I2[i].query_DNF()->single_conjunct(); + for (GEQ_Iterator ge = c->GEQs(); ge; ge++) { + if ((*ge).has_wildcards() || (*ge).get_coef(t_col) != 1) + continue; + + std::map cur_lb; + + for (Constr_Vars_Iter cv(*ge); cv; cv++) + cur_lb[cv.curr_var()] = cv.curr_coef(); + + cur_lb[NULL] = (*ge).get_const(); + + Relation test = create_stride_on_bound(n, cur_lb, this_step); + if (Gist(test, copy(I1[i])).is_obvious_tautology()) { + if (step[i] == 0) + step[i] = this_step; + else + step[i] = lcm(step[i], this_step); + + lb = cur_lb; + break; + } + } + } + } + } + + // aggregate all non-exact steps + for (size_t i = 0; i < is_exact.size(); i++) + if (!is_exact[i]) + global_step = gcd(global_step, step[i]); + if (global_step == 1 || global_step == 0) + return Relation::True(n); + + Relation result = create_stride_on_bound(n, lb, global_step); + + // check for statements that haven't been factored into global step + for (size_t i = 0; i < I1.size(); i++) + if (step[i] == 0) { + if (!Gist(copy(result), copy(I1[i])).is_obvious_tautology()) + return Relation::True(n); + } + + return result; +} + + +//----------------------------------------------------------------------------- +// Substitute variables in a statement according to mapping function. +//----------------------------------------------------------------------------- +CG_outputRepr* outputStatement(CG_outputBuilder *ocg, CG_outputRepr *stmt, int indent, const Relation &mapping_, const Relation &known_, const std::vector &assigned_on_the_fly) { + Relation mapping = copy(mapping_); + Relation known = copy(known_); + Tuple loop_vars; + + for (int i = 1; i <= mapping.n_inp(); i++) + loop_vars.append(mapping.input_var(i)->name()); + + // discard non-existant variables from iteration spaces -- by chun 12/31/2008 + if (known.n_set() > mapping.n_out()) { + Relation r(known.n_set(), mapping.n_out()); + F_And *f_root = r.add_and(); + for (int i = 1; i <= mapping.n_out(); i++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(r.input_var(i), 1); + h.update_coef(r.output_var(i), -1); + } + known = Range(Restrict_Domain(r, known)); + known.simplify(); + } + + // remove modular constraints from known to simplify mapping process -- by chun 11/10/2008 + Relation k(known.n_set()); + F_And *f_root = k.add_and(); + Conjunct *c = known.query_DNF()->single_conjunct(); + for (EQ_Iterator e = c->EQs(); e; e++) { + if (!(*e).has_wildcards()) + f_root->add_EQ(*e); + } + k.simplify(); + + // get variable substituion list + Relation Inv_mapping = Restrict_Domain(Inverse(mapping), k); + Tuple sList = outputSubstitution(ocg, Inv_mapping, assigned_on_the_fly); + + return ocg->CreatePlaceHolder(indent, stmt, sList, loop_vars); +} + + +// find floor definition for variable such as m-3 <= 4v <= m +bool findFloorInequality(Relation &r, Variable_ID v, GEQ_Handle &h, Variable_ID excluded) { + Conjunct *c = r.single_conjunct(); + + std::set var_checked; + std::stack var_checking; + var_checking.push(v); + + while (!var_checking.empty()) { + Variable_ID v2 = var_checking.top(); + var_checking.pop(); + + bool is_floor = false; + for (GEQ_Iterator gi(c); gi; gi++) { + if (excluded != NULL && (*gi).get_coef(excluded) != 0) + continue; + + coef_t a = (*gi).get_coef(v2); + if (a < 0) { + for (GEQ_Iterator gi2(c); gi2; gi2++) { + coef_t b = (*gi2).get_coef(v2); + if (b == -a && (*gi).get_const()+(*gi2).get_const() < -a) { + bool match = true; + for (Constr_Vars_Iter cvi(*gi); cvi; cvi++) + if ((*gi2).get_coef((*cvi).var) != -(*cvi).coef) { + match = false; + break; + } + if (!match) + continue; + for (Constr_Vars_Iter cvi(*gi2); cvi; cvi++) + if ((*gi).get_coef((*cvi).var) != -(*cvi).coef) { + match = false; + break; + } + if (match) { + var_checked.insert(v2); + is_floor = true; + if (v == v2) + h = *gi; + + for (Constr_Vars_Iter cvi(*gi); cvi; cvi++) + if (((*cvi).var->kind() == Exists_Var || (*cvi).var->kind() == Wildcard_Var) && + var_checked.find((*cvi).var) == var_checked.end()) + var_checking.push((*cvi).var); + + break; + } + } + } + if (is_floor) + break; + } + } + if (!is_floor) + return false; + } + return true; +} + + + + +//----------------------------------------------------------------------------- +// Output a reqular equality or inequality to conditions. +// e.g. (i=5*j) +//----------------------------------------------------------------------------- +CG_outputRepr* output_as_guard(CG_outputBuilder* ocg, const Relation &guards_in, Constraint_Handle e, bool is_equality, const std::vector &assigned_on_the_fly) { + Relation &guards = const_cast(guards_in); + if (e.has_wildcards()) + throw std::invalid_argument("constraint must not have wildcard"); + + Variable_ID v = (*Constr_Vars_Iter(e)).var; + + coef_t saved_coef = ((e).get_coef(v)); + int sign = saved_coef < 0 ? -1 : 1; + + (e).update_coef_during_simplify(v, -saved_coef+sign); + CG_outputRepr* rop = outputEasyBoundAsRepr(ocg, guards, e, v, false, 0, assigned_on_the_fly); + (e).update_coef_during_simplify(v,saved_coef-sign); + + CG_outputRepr* lop = outputIdent(ocg, guards, v, assigned_on_the_fly); + if (abs(saved_coef) != 1) + lop = ocg->CreateTimes(ocg->CreateInt(abs(saved_coef)), lop); + + + if (is_equality) { + return ocg->CreateEQ(lop, rop); + } + else { + if (saved_coef < 0) + return ocg->CreateLE(lop, rop); + else + return ocg->CreateGE(lop, rop); + } +} + + +//----------------------------------------------------------------------------- +// Output stride conditions from equalities. +// e.g. (exists alpha: i = 5*alpha) +//----------------------------------------------------------------------------- +CG_outputRepr *output_EQ_strides(CG_outputBuilder* ocg, const Relation &guards_in, const std::vector &assigned_on_the_fly) { + Relation guards = const_cast(guards_in); + Conjunct *c = guards.single_conjunct(); + + CG_outputRepr *eqRepr = NULL; + + for (EQ_Iterator ei(c->EQs()); ei; ei++) { + Variable_ID wc = NULL; + for (Constr_Vars_Iter cvi((*ei), true); cvi; cvi++) { + if (wc != NULL) + throw codegen_error("Can't generate equality condition with multiple wildcards"); + else + wc = (*cvi).var; + } + if (wc == NULL) + continue; + + coef_t step = (*ei).get_coef(wc); + + (*ei).update_coef_during_simplify(wc, 1-step); + CG_outputRepr* lop = outputEasyBoundAsRepr(ocg, guards, (*ei), wc, false, 0, assigned_on_the_fly); + (*ei).update_coef_during_simplify(wc, step-1); + + CG_outputRepr* rop = ocg->CreateInt(abs(step)); + CG_outputRepr* intMod = ocg->CreateIntegerMod(lop, rop); + CG_outputRepr* eqNode = ocg->CreateEQ(intMod, ocg->CreateInt(0)); + + eqRepr = ocg->CreateAnd(eqRepr, eqNode); + } + + return eqRepr; +} + + + +//----------------------------------------------------------------------------- +// Output hole conditions created by inequalities involving wildcards. +// e.g. (exists alpha: 4*alpha <= i <= 5*alpha) +// Collect wildcards +// For each whildcard +// collect lower and upper bounds in which wildcard appears +// For each lower bound +// create constraint with each upper bound +//----------------------------------------------------------------------------- +CG_outputRepr *output_GEQ_strides(CG_outputBuilder* ocg, const Relation &guards_in, const std::vector &assigned_on_the_fly) { + Relation guards = const_cast(guards_in); + Conjunct *c = guards.single_conjunct(); + + CG_outputRepr* geqRepr = NULL; + + std::set non_orphan_wildcard; + for (GEQ_Iterator gi(c); gi; gi++) { + int num_wild = 0; + Variable_ID first_one; + for (Constr_Vars_Iter cvi(*gi, true); cvi; cvi++) { + num_wild++; + if (num_wild == 1) + first_one = (*cvi).var; + else + non_orphan_wildcard.insert((*cvi).var); + } + if (num_wild > 1) + non_orphan_wildcard.insert(first_one); + } + + for (int i = 1; i <= (*(c->variables())).size(); i++) { + Variable_ID wc = (*(c->variables()))[i]; + if (wc->kind() == Wildcard_Var && non_orphan_wildcard.find(wc) == non_orphan_wildcard.end()) { + Tuple lower, upper; + for (GEQ_Iterator gi(c); gi; gi++) { + if((*gi).get_coef(wc) > 0) + lower.append(*gi); + else if((*gi).get_coef(wc) < 0) + upper.append(*gi); + } + + // low: c*alpha - x >= 0 + // up: -d*alpha + y >= 0 + for (Tuple_Iterator low(lower); low; low++) { + for (Tuple_Iterator up(upper); up; up++) { + coef_t low_coef = (*low).get_coef(wc); + coef_t up_coef = (*up).get_coef(wc); + + (*low).update_coef_during_simplify(wc, 1-low_coef); + CG_outputRepr* lowExpr = outputEasyBoundAsRepr(ocg, guards, *low, wc, false, 0, assigned_on_the_fly); + (*low).update_coef_during_simplify(wc, low_coef-1); + + (*up).update_coef_during_simplify(wc, -1-up_coef); + CG_outputRepr* upExpr = outputEasyBoundAsRepr(ocg, guards, *up, wc, false, 0, assigned_on_the_fly); + (*up).update_coef_during_simplify(wc, up_coef+1); + + CG_outputRepr* intDiv = ocg->CreateIntegerDivide(upExpr, ocg->CreateInt(-up_coef)); + CG_outputRepr* rop = ocg->CreateTimes(ocg->CreateInt(low_coef), intDiv); + CG_outputRepr* geqNode = ocg->CreateLE(lowExpr, rop); + + geqRepr = ocg->CreateAnd(geqRepr, geqNode); + } + } + } + } + + if (non_orphan_wildcard.size() > 0) { + // e.g. c*alpha - x >= 0 (*) + // -d*alpha + y >= 0 (*) + // e1*alpha + f1*beta + g1 >= 0 (**) + // e2*alpha + f2*beta + g2 >= 0 (**) + // ... + // TODO: should generate a testing loop for alpha using its lower and + // upper bounds from (*) constraints and do the same if-condition test + // for beta from each pair of opposite (**) constraints as above, + // and exit the loop when if-condition satisfied. + throw codegen_error("Can't generate multiple wildcard GEQ guards right now"); + } + + return geqRepr; +} + + +//----------------------------------------------------------------------------- +// Translate all constraints in a relation to guard conditions. +//----------------------------------------------------------------------------- +CG_outputRepr *outputGuard(CG_outputBuilder* ocg, const Relation &guards_in, const std::vector &assigned_on_the_fly) { + Relation &guards = const_cast(guards_in); + if (guards.is_null() || guards.is_obvious_tautology()) + return NULL; + + CG_outputRepr* nodeRepr = NULL; + + CG_outputRepr *eqStrideRepr = output_EQ_strides(ocg, guards, assigned_on_the_fly); + nodeRepr = ocg->CreateAnd(nodeRepr, eqStrideRepr); + + CG_outputRepr *geqStrideRepr = output_GEQ_strides(ocg, guards, assigned_on_the_fly); + nodeRepr = ocg->CreateAnd(nodeRepr, geqStrideRepr); + + Conjunct *c = guards.single_conjunct(); + for(EQ_Iterator ei(c->EQs()); ei; ei++) + if (!(*ei).has_wildcards()) { + CG_outputRepr *eqRepr = output_as_guard(ocg, guards, (*ei), true, assigned_on_the_fly); + nodeRepr = ocg->CreateAnd(nodeRepr, eqRepr); + } + for(GEQ_Iterator gi(c->GEQs()); gi; gi++) + if (!(*gi).has_wildcards()) { + CG_outputRepr *geqRepr = output_as_guard(ocg, guards, (*gi), false, assigned_on_the_fly); + nodeRepr = ocg->CreateAnd(nodeRepr, geqRepr); + } + + return nodeRepr; +} + + +//----------------------------------------------------------------------------- +// one is 1 for LB +// this function is overloaded should replace the original one +//----------------------------------------------------------------------------- +CG_outputRepr *outputLBasRepr(CG_outputBuilder* ocg, const GEQ_Handle &g, + Relation &bounds, Variable_ID v, + coef_t stride, const EQ_Handle &strideEQ, + Relation known, const std::vector &assigned_on_the_fly) { +#if ! defined NDEBUG + coef_t v_coef; + assert((v_coef = g.get_coef(v)) > 0); +#endif + + std::string s; + CG_outputRepr *lbRepr; + if (stride == 1) { + lbRepr = outputEasyBoundAsRepr(ocg, bounds, g, v, false, 1, assigned_on_the_fly); + } + else { + if (!boundHitsStride(g,v,strideEQ,stride,known)) { + bounds.setup_names(); // boundsHitsStride resets variable names + + CG_stringBuilder oscg; + std::string c = GetString(outputEasyBoundAsRepr(&oscg, bounds, strideEQ, v, true, 0, assigned_on_the_fly)); + CG_outputRepr *cRepr = NULL; + if (c != std::string("0")) + cRepr = outputEasyBoundAsRepr(ocg, bounds, strideEQ, v, true, 0, assigned_on_the_fly); + std::string LoverM = GetString(outputEasyBoundAsRepr(&oscg, bounds, g, v, false, 1, assigned_on_the_fly)); + CG_outputRepr *LoverMRepr = NULL; + if (LoverM != std::string("0")) + LoverMRepr = outputEasyBoundAsRepr(ocg, bounds, g, v, false, 1, assigned_on_the_fly); + + if (code_gen_debug > 2) { + fprintf(DebugFile,"::: LoverM is %s\n", LoverM.c_str()); + fprintf(DebugFile,"::: c is %s\n", c.c_str()); + } + + int complexity1 = 0, complexity2 = 0; + for (size_t i = 0; i < c.length(); i++) + if (c[i] == '+' || c[i] == '-' || c[i] == '*' || c[i] == '/') + complexity1++; + else if (c[i] == ',') + complexity1 += 2; + for (size_t i = 0; i < LoverM.length(); i++) + if (LoverM[i] == '+' || LoverM[i] == '-' || LoverM[i] == '*' || LoverM[i] == '/') + complexity2++; + else if (LoverM[i] == ',') + complexity2 += 2; + + if (complexity1 < complexity2) { + CG_outputRepr *idUp = LoverMRepr; + CG_outputRepr *c1Repr = ocg->CreateCopy(cRepr); + idUp = ocg->CreateMinus(idUp, c1Repr); + idUp = ocg->CreatePlus(idUp, ocg->CreateInt(stride-1)); + CG_outputRepr *idLow = ocg->CreateInt(stride); + lbRepr = ocg->CreateTimes(ocg->CreateInt(stride), + ocg->CreateIntegerDivide(idUp, idLow)); + lbRepr = ocg->CreatePlus(lbRepr, cRepr); + } + else { + CG_outputRepr *LoverM1Repr = ocg->CreateCopy(LoverMRepr); + CG_outputRepr *imUp = ocg->CreateMinus(cRepr, LoverM1Repr); + CG_outputRepr *imLow = ocg->CreateInt(stride); + CG_outputRepr *intMod = ocg->CreateIntegerMod(imUp, imLow); + lbRepr = ocg->CreatePlus(LoverMRepr, intMod); + } + } + else { + // boundsHitsStride resets variable names + bounds.setup_names(); + lbRepr = outputEasyBoundAsRepr(ocg, bounds, g, v, false, 0, assigned_on_the_fly); + } + } + + return lbRepr; +} + +//----------------------------------------------------------------------------- +// one is -1 for UB +// this function is overloaded should replace the original one +//----------------------------------------------------------------------------- +CG_outputRepr *outputUBasRepr(CG_outputBuilder* ocg, const GEQ_Handle &g, + Relation & bounds, + Variable_ID v, + coef_t /*stride*/, // currently unused + const EQ_Handle &/*strideEQ*/, //currently unused + const std::vector &assigned_on_the_fly) { + assert(g.get_coef(v) < 0); + CG_outputRepr* upRepr = outputEasyBoundAsRepr(ocg, bounds, g, v, false, 0, assigned_on_the_fly); + return upRepr; +} + +//----------------------------------------------------------------------------- +// Print the expression for the variable given as v. Works for both +// GEQ's and EQ's, but produces intDiv (not intMod) when v has a nonunit +// coefficient. So it is OK for loop bounds, but for checking stride +// constraints, you want to make sure the coef of v is 1, and insert the +// intMod yourself. +// +// original name is outputEasyBound +//----------------------------------------------------------------------------- +CG_outputRepr* outputEasyBoundAsRepr(CG_outputBuilder* ocg, Relation &bounds, + const Constraint_Handle &g, Variable_ID v, + bool ignoreWC, + int ceiling, + const std::vector &assigned_on_the_fly) { + // assert ignoreWC => g is EQ + // rewrite constraint as foo (== or <= or >=) v, return foo as string + + CG_outputRepr* easyBoundRepr = NULL; + + coef_t v_coef = g.get_coef(v); + int v_sign = v_coef > 0 ? 1 : -1; + v_coef *= v_sign; + assert(v_coef > 0); + // foo is (-constraint)/v_sign/v_coef + + int sign_adj = -v_sign; + + //---------------------------------------------------------------------- + // the following generates +- cf*varName + //---------------------------------------------------------------------- + for(Constr_Vars_Iter c2(g, false); c2; c2++) { + if ((*c2).var != v && (!ignoreWC || (*c2).var->kind()!=Wildcard_Var)) { + + coef_t cf = (*c2).coef*sign_adj; + assert(cf != 0); + + CG_outputRepr *varName; + if ((*c2).var->kind() == Wildcard_Var) { + GEQ_Handle h; + if (!findFloorInequality(bounds, (*c2).var, h, v)) { + if (easyBoundRepr != NULL) { + easyBoundRepr->clear(); + delete easyBoundRepr; + } + return NULL; + } + varName = outputEasyBoundAsRepr(ocg, bounds, h, (*c2).var, false, 0, assigned_on_the_fly); + } + else { + varName = outputIdent(ocg, bounds, (*c2).var, assigned_on_the_fly); + } + CG_outputRepr *cfRepr = NULL; + + if (cf > 1) { + cfRepr = ocg->CreateInt(cf); + CG_outputRepr* rbRepr = ocg->CreateTimes(cfRepr, varName); + easyBoundRepr = ocg->CreatePlus(easyBoundRepr, rbRepr); + } + else if (cf < -1) { + cfRepr = ocg->CreateInt(-cf); + CG_outputRepr* rbRepr = ocg->CreateTimes(cfRepr, varName); + easyBoundRepr = ocg->CreateMinus(easyBoundRepr, rbRepr); + } + else if (cf == 1) { + easyBoundRepr = ocg->CreatePlus(easyBoundRepr, varName); + } + else if (cf == -1) { + easyBoundRepr = ocg->CreateMinus(easyBoundRepr, varName); + } + } + } + + if (g.get_const()) { + coef_t cf = g.get_const()*sign_adj; + assert(cf != 0); + if (cf > 0) { + easyBoundRepr = ocg->CreatePlus(easyBoundRepr, ocg->CreateInt(cf)); + } + else { + easyBoundRepr = ocg->CreateMinus(easyBoundRepr, ocg->CreateInt(-cf)); + } + } + else { + if(easyBoundRepr == NULL) { + easyBoundRepr = ocg->CreateInt(0); + } + } + + if (v_coef > 1) { + assert(ceiling >= 0); + if (ceiling) { + easyBoundRepr= ocg->CreatePlus(easyBoundRepr, ocg->CreateInt(v_coef-1)); + } + easyBoundRepr = ocg->CreateIntegerDivide(easyBoundRepr, ocg->CreateInt(v_coef)); + } + + return easyBoundRepr; +} + + +//---------------------------------------------------------------------------- +// Translate inequality constraints to loop or assignment. +// if return.second is true, return.first is loop structure, +// otherwise it is assignment. +// ---------------------------------------------------------------------------- +std::pair outputBounds(CG_outputBuilder* ocg, const Relation &bounds, Variable_ID v, int indent, Relation &enforced, const std::vector &assigned_on_the_fly) { + Relation b = copy(bounds); + Conjunct *c = b.query_DNF()->single_conjunct(); + + // Elaborate stride simplification which is complementary to gist function + // since we further target the specific loop variable. -- by chun 08/07/2008 + Relation r1 = Relation::True(b.n_set()), r2 = Relation::True(b.n_set()); + for (EQ_Iterator ei(c); ei; ei++) { + if ((*ei).get_coef(v) != 0 && (*ei).has_wildcards()) { // stride condition found + coef_t sign; + if ((*ei).get_coef(v) > 0) + sign = 1; + else + sign = -1; + + coef_t stride = 0; + for (Constr_Vars_Iter cvi(*ei, true); cvi; cvi++) + if ((*cvi).var->kind() == Wildcard_Var) { + stride = abs((*cvi).coef); + break; + } + + // check if stride hits lower bound + bool found_match = false; + if (abs((*ei).get_coef(v)) != 1) { // expensive matching for non-clean stride condition + coef_t d = stride / gcd(abs((*ei).get_coef(v)), stride); + Relation r3 = Relation::True(b.n_set()); + r3.and_with_EQ(*ei); + + for (GEQ_Iterator gi(c); gi; gi++) { + if ((*gi).get_coef(v) == 1 && !(*gi).has_wildcards()) { + Relation r4(b.n_set()); + F_And *f_root = r4.add_and(); + Stride_Handle h = f_root->add_stride(d); + + for (Constr_Vars_Iter cvi(*gi); cvi; cvi++) + switch ((*cvi).var->kind()) { + case Input_Var: { + int pos = (*cvi).var->get_position(); + h.update_coef(r4.set_var(pos), (*cvi).coef); + break; + } + case Global_Var: { + Global_Var_ID g = (*cvi).var->get_global_var(); + Variable_ID v; + if (g->arity() == 0) + v = r4.get_local(g); + else + v = r4.get_local(g, (*cvi).var->function_of()); + h.update_coef(v, (*cvi).coef); + break; + } + default: + fprintf(DebugFile, "can't deal with the variable type in lower bound\n"); + return std::make_pair(static_cast(NULL), false); + } + h.update_const((*gi).get_const()); + + Relation r5 = Gist(copy(r3), Intersection(copy(r4), copy(enforced))); + + // replace original stride condition with striding from this lower bound + if (r5.is_obvious_tautology()) { + r1 = Intersection(r1, r4); + found_match = true; + break; + } + } + } + } + else { + for (GEQ_Iterator gi(c); gi; gi++) { + if ((*gi).get_coef(v) == abs((*ei).get_coef(v)) && !(*gi).has_wildcards()) { // potential matching lower bound found + Relation r(b.n_set()); + Stride_Handle h = r.add_and()->add_stride(stride); + + for (Constr_Vars_Iter cvi(*gi); cvi; cvi++) + switch ((*cvi).var->kind()) { + case Input_Var: { + int pos = (*cvi).var->get_position(); + if ((*cvi).var != v) { + int t1 = int_mod((*cvi).coef, stride); + if (t1 != 0) { + coef_t t2 = enforced.query_variable_mod(enforced.set_var(pos), stride); + if (t2 != posInfinity) + h.update_const(t1*t2); + else + h.update_coef(r.set_var(pos), t1); + } + } + else + h.update_coef(r.set_var(pos), (*cvi).coef); + break; + } + case Global_Var: { + Global_Var_ID g = (*cvi).var->get_global_var(); + Variable_ID v; + if (g->arity() == 0) + v = enforced.get_local(g); + else + v = enforced.get_local(g, (*cvi).var->function_of()); + coef_t t = enforced.query_variable_mod(v, stride); + if (t != posInfinity) + h.update_const(t*(*cvi).coef); + else { + Variable_ID v2; + if (g->arity() == 0) + v2 = r.get_local(g); + else + v2 = r.get_local(g, (*cvi).var->function_of()); + h.update_coef(v2, (*cvi).coef); + } + break; + } + default: + fprintf(DebugFile, "can't deal with the variable type in lower bound\n"); + return std::make_pair(static_cast(NULL), false); + } + h.update_const((*gi).get_const()); + + bool t = true; + { + Conjunct *c2 = r.query_DNF()->single_conjunct(); + EQ_Handle h2; + for (EQ_Iterator ei2(c2); ei2; ei2++) { + h2 = *ei2; + break; + } + + int sign; + if (h2.get_coef(v) == (*ei).get_coef(v)) + sign = 1; + else + sign = -1; + + t = int_mod(h2.get_const() - sign * (*ei).get_const(), stride) == 0; + + if (t != false) + for (Constr_Vars_Iter cvi(h2); cvi; cvi++) + if ((*cvi).var->kind() != Wildcard_Var && + int_mod((*cvi).coef - sign * (*ei).get_coef((*cvi).var), stride) != 0) { + t = false; + break; + } + + if (t != false) + for (Constr_Vars_Iter cvi(*ei); cvi; cvi++) + if ((*cvi).var->kind() != Wildcard_Var && + int_mod((*cvi).coef - sign * h2.get_coef((*cvi).var), stride) != 0) { + t = false; + break; + } + + } + + if (t) { + // replace original stride condition with striding from this lower bound + F_And *f_root = r1.and_with_and(); + Stride_Handle h = f_root->add_stride(stride); + for (Constr_Vars_Iter cvi(*gi); cvi; cvi++) + switch ((*cvi).var->kind()) { + case Input_Var: { + h.update_coef(r1.set_var((*cvi).var->get_position()), (*cvi).coef); + break; + } + case Global_Var: { + Global_Var_ID g = (*cvi).var->get_global_var(); + Variable_ID v; + if (g->arity() == 0) + v = r1.get_local(g); + else + v = r1.get_local(g, (*cvi).var->function_of()); + h.update_coef(v, (*cvi).coef); + break; + } + default: + fprintf(DebugFile, "can't deal with the variable type in lower bound\n"); + return std::make_pair(static_cast(NULL), false); + } + h.update_const((*gi).get_const()); + + found_match = true; + break; + } + } + } + } + + if (!found_match) + r1.and_with_EQ(*ei); + } + else if ((*ei).get_coef(v) == 0) { + Relation r3 = Relation::True(b.n_set()); + r3.and_with_EQ(*ei); + Relation r4 = Gist(r3, copy(enforced)); + if (!r4.is_obvious_tautology()) + r2.and_with_EQ(*ei); + } + else + r2.and_with_EQ(*ei); + } + + // restore remaining inequalities + { + std::map exists_mapping; + F_Exists *fe = r2.and_with_and()->add_exists(); + F_And *f_root = fe->add_and(); + for (GEQ_Iterator gi(c); gi; gi++) { + GEQ_Handle h = f_root->add_GEQ(); + for (Constr_Vars_Iter cvi(*gi); cvi; cvi++) { + Variable_ID v = cvi.curr_var(); + switch (v->kind()) { + case Input_Var: { + int pos = v->get_position(); + h.update_coef(r2.set_var(pos), cvi.curr_coef()); + break; + } + case Exists_Var: + case Wildcard_Var: { + std::map::iterator p = exists_mapping.find(v); + Variable_ID e; + if (p == exists_mapping.end()) { + e = fe->declare(); + exists_mapping[v] = e; + } + else + e = (*p).second; + h.update_coef(e, cvi.curr_coef()); + break; + } + case Global_Var: { + Global_Var_ID g = v->get_global_var(); + Variable_ID v2; + if (g->arity() == 0) + v2 = r2.get_local(g); + else + v2 = r2.get_local(g, v->function_of()); + h.update_coef(v2, cvi.curr_coef()); + break; + } + default: + assert(0); + } + } + h.update_const((*gi).get_const()); + } + } + + // overwrite original bounds + { + r1.simplify(); + r2.simplify(); + Relation b2 = Intersection(r1, r2); + b2.simplify(); + for (int i = 1; i <= b.n_set(); i++) + b2.name_set_var(i, b.set_var(i)->name()); + b2.setup_names(); + b = b2; + c = b.query_DNF()->single_conjunct(); + } + + + // get loop strides + EQ_Handle strideEQ; + bool foundStride = false; // stride that can be translated to loop + bool foundSimpleStride = false; // stride that starts from const value + coef_t step = 1; + int num_stride = 0; + + for (EQ_Iterator ei(c); ei; ei++) { + if ((*ei).get_coef(v) != 0 && (*ei).has_wildcards()) { + num_stride++; + + if (abs((*ei).get_coef(v)) != 1) + continue; + + bool t = true; + coef_t d = 1; + for (Constr_Vars_Iter cvi(*ei); cvi; cvi++) + if ((*cvi).var->kind() == Wildcard_Var) { + assert(d==1); + d = abs((*cvi).coef); + } + else if ((*cvi).var->kind() == Input_Var) { + if ((*cvi).var != v) + t = false; + } + else + t = false; + + if (d > step) { + step = d; + foundSimpleStride = t; + strideEQ = *ei; + foundStride = true; + } + } + } + + // More than one stride or complex stride found, we should move all + // but strideEQ to body's guard condition. alas, not implemented. + if (!(num_stride == 0 || (num_stride == 1 && foundStride))) + return std::make_pair(static_cast(NULL), false); + + // get loop bounds + int lower_bounds = 0, upper_bounds = 0; + Tuple lbList; + Tuple ubList; + coef_t const_lb = negInfinity, const_ub = posInfinity; + for (GEQ_Iterator g(c); g; g++) { + coef_t coef = (*g).get_coef(v); + if (coef == 0) + continue; + else if (coef > 0) { // lower bound + lower_bounds++; + if ((*g).is_const(v) && !foundStride) { + //no variables but v in constr + coef_t L,m; + L = -((*g).get_const()); + + m = (*g).get_coef(v); + coef_t sb = (int) (ceil(((float) L) /m)); + set_max(const_lb, sb); + } + else if ((*g).is_const(v) && foundSimpleStride) { + // no variables but v in constr + //make LB fit the stride constraint + coef_t L,m,s,c; + L = -((*g).get_const()); + m = (*g).get_coef(v); + s = step; + c = strideEQ.get_const(); + coef_t sb = (s * (int) (ceil( (float) (L - (c * m)) /(s*m))))+ c; + set_max(const_lb, sb); + } + else + lbList.append(outputLBasRepr(ocg, *g, b, v, step, strideEQ, enforced, assigned_on_the_fly)); + } + else { // upper bound + upper_bounds++; + if ((*g).is_const(v)) { + // no variables but v in constraint + set_min(const_ub,-(*g).get_const()/(*g).get_coef(v)); + } + else + ubList.append(outputUBasRepr(ocg, *g, b, v, step, strideEQ, assigned_on_the_fly)); + } + } + + CG_outputRepr *lbRepr = NULL; + CG_outputRepr *ubRepr = NULL; + if (const_lb != negInfinity) + lbList.append(ocg->CreateInt(const_lb)); + if (lbList.size() > 1) + lbRepr = ocg->CreateInvoke("max", lbList); + else if (lbList.size() == 1) + lbRepr = lbList[1]; + + //protonu + if(fillInBounds && lbList.size() == 1 && const_lb != negInfinity) + lowerBoundForLevel = const_lb; + //end-protonu + + if (const_ub != posInfinity) + ubList.append(ocg->CreateInt(const_ub)); + if (ubList.size() > 1) + ubRepr = ocg->CreateInvoke("min", ubList); + else if (ubList.size() == 1) + ubRepr = ubList[1]; + + //protonu + if(fillInBounds && const_ub != posInfinity) + upperBoundForLevel = const_ub; + //end-protonu + + if (upper_bounds == 0 || lower_bounds == 0) { + return std::make_pair(static_cast(NULL), false); + } + else { + // bookkeeping catched constraints in new_knwon + F_Exists *fe = enforced.and_with_and()->add_exists(); + F_And *f_root = fe->add_and(); + std::map exists_mapping; + std::stack > floor_geq_stack; + std::set floor_var_set; + + if (foundStride) { + EQ_Handle h = f_root->add_EQ(); + for (Constr_Vars_Iter cvi(strideEQ); cvi; cvi++) + switch ((*cvi).var->kind()) { + case Input_Var: { + int pos = (*cvi).var->get_position(); + h.update_coef(enforced.set_var(pos), (*cvi).coef); + break; + } + case Exists_Var: + case Wildcard_Var: { + std::map::iterator p = exists_mapping.find((*cvi).var); + Variable_ID e; + if (p == exists_mapping.end()) { + e = fe->declare(); + exists_mapping[(*cvi).var] = e; + } + else + e = (*p).second; + h.update_coef(e, (*cvi).coef); + break; + } + case Global_Var: { + Global_Var_ID g = (*cvi).var->get_global_var(); + Variable_ID e; + if (g->arity() == 0) + e = enforced.get_local(g); + else + e = enforced.get_local(g, (*cvi).var->function_of()); + h.update_coef(e, (*cvi).coef); + break; + } + default: + assert(0); + } + h.update_const(strideEQ.get_const()); + } + + for (GEQ_Iterator gi(c); gi; gi++) + if ((*gi).get_coef(v) != 0) { + GEQ_Handle h = f_root->add_GEQ(); + for (Constr_Vars_Iter cvi(*gi); cvi; cvi++) + switch ((*cvi).var->kind()) { + case Input_Var: { + int pos = (*cvi).var->get_position(); + h.update_coef(enforced.set_var(pos), (*cvi).coef); + break; + } + case Exists_Var: + case Wildcard_Var: { + std::map::iterator p = exists_mapping.find((*cvi).var); + Variable_ID e; + if (p == exists_mapping.end()) { + e = fe->declare(); + exists_mapping[(*cvi).var] = e; + } + else + e = (*p).second; + h.update_coef(e, (*cvi).coef); + + if (floor_var_set.find((*cvi).var) == floor_var_set.end()) { + GEQ_Handle h2; + findFloorInequality(b, (*cvi).var, h2, v); + floor_geq_stack.push(std::make_pair(h2, (*cvi).var)); + floor_var_set.insert((*cvi).var); + } + break; + } + case Global_Var: { + Global_Var_ID g = (*cvi).var->get_global_var(); + Variable_ID e; + if (g->arity() == 0) + e = enforced.get_local(g); + else + e = enforced.get_local(g, (*cvi).var->function_of()); + h.update_coef(e, (*cvi).coef); + break; + } + default: + assert(0); + } + h.update_const((*gi).get_const()); + } + + // add floor definition involving variables appeared in bounds + while (!floor_geq_stack.empty()) { + std::pair p = floor_geq_stack.top(); + floor_geq_stack.pop(); + + GEQ_Handle h1 = f_root->add_GEQ(); + GEQ_Handle h2 = f_root->add_GEQ(); + for (Constr_Vars_Iter cvi(p.first); cvi; cvi++) { + switch ((*cvi).var->kind()) { + case Input_Var: { + int pos = (*cvi).var->get_position(); + h1.update_coef(enforced.input_var(pos), (*cvi).coef); + h2.update_coef(enforced.input_var(pos), -(*cvi).coef); + break; + } + case Exists_Var: + case Wildcard_Var: { + std::map::iterator p2 = exists_mapping.find((*cvi).var); + Variable_ID e; + if (p2 == exists_mapping.end()) { + e = fe->declare(); + exists_mapping[(*cvi).var] = e; + } + else + e = (*p2).second; + h1.update_coef(e, (*cvi).coef); + h2.update_coef(e, -(*cvi).coef); + + if (floor_var_set.find((*cvi).var) == floor_var_set.end()) { + GEQ_Handle h3; + findFloorInequality(b, (*cvi).var, h3, v); + floor_geq_stack.push(std::make_pair(h3, (*cvi).var)); + floor_var_set.insert((*cvi).var); + } + break; + } + case Global_Var: { + Global_Var_ID g = (*cvi).var->get_global_var(); + Variable_ID e; + if (g->arity() == 0) + e = enforced.get_local(g); + else + e = enforced.get_local(g, (*cvi).var->function_of()); + h1.update_coef(e, (*cvi).coef); + h2.update_coef(e, -(*cvi).coef); + break; + } + default: + assert(0); + } + } + h1.update_const(p.first.get_const()); + h2.update_const(-p.first.get_const()); + h2.update_const(-p.first.get_coef(p.second)-1); + } + enforced.simplify(); + + CG_outputRepr *stRepr = NULL; + if (step != 1) + stRepr = ocg->CreateInt(abs(step)); + CG_outputRepr *indexRepr = outputIdent(ocg, b, v, assigned_on_the_fly); + CG_outputRepr *ctrlRepr = ocg->CreateInductive(indexRepr, lbRepr, ubRepr, stRepr); + + return std::make_pair(ctrlRepr, true); + } +} + + +Relation project_onto_levels(Relation R, int last_level, bool wildcards) { + assert(last_level >= 0 && R.is_set() && last_level <= R.n_set()); + if (last_level == R.n_set()) return R; + + int orig_vars = R.n_set(); + int num_projected = orig_vars - last_level; + R = Extend_Set(R,num_projected + ); // Project out vars numbered > last_level + Mapping m1 = Mapping::Identity(R.n_set()); // now orig_vars+num_proj + + for(int i=last_level+1; i <= orig_vars; i++) { + m1.set_map(Set_Var, i, Exists_Var, i); + m1.set_map(Set_Var, i+num_projected, Set_Var, i); + } + + MapRel1(R, m1, Comb_Id); + R.finalize(); + R.simplify(); + if (!wildcards) + R = Approximate(R,1); + assert(R.is_set()); + return R; +} + + +// Check if the lower bound already enforces the stride by +// (Where m is coef of v in g and L is the bound on m*v): +// Check if m divides L evenly and Check if this l.bound on v implies strideEQ +bool boundHitsStride(const GEQ_Handle &g, Variable_ID v, + const EQ_Handle &strideEQ, + coef_t /*stride*/, // currently unused + Relation known) { +/* m = coef of v in g; + L = bound on v part of g; +*/ + // Check if m divides L evenly + coef_t m = g.get_coef(v); + Relation test(known.n_set()); + F_Exists *e = test.add_exists(); // g is "L >= mv" + Variable_ID alpha = e->declare(); // want: "l = m alpha" + F_And *a = e->add_and(); + EQ_Handle h = a->add_EQ(); + for(Constr_Vars_Iter I(g,false); I; I++) + if((*I).var != v) { + if((*I).var->kind() != Global_Var) + h.update_coef((*I).var, (*I).coef); + else + h.update_coef(test.get_local((*I).var->get_global_var()), (*I).coef); + } + + h.update_const(g.get_const()); + h.update_coef(alpha,m); // set alpha's coef to m + if (!(Gist(test,copy(known)).is_obvious_tautology())) + return false; + // Check if this lower bound on v implies the strideEQ + Relation boundRel = known; // want: "known and l = m v" + boundRel.and_with_EQ(g); // add in l = mv + Relation strideRel(known.n_set()); + strideRel.and_with_EQ(strideEQ); + return Gist(strideRel, boundRel).is_obvious_tautology(); +} + + +// // Return true if there are no variables in g except wildcards & v +bool isSimpleStride(const EQ_Handle &g, Variable_ID v) { + EQ_Handle gg = g; // should not be necessary, but iterators are + // a bit brain-dammaged + bool is_simple=true; + for(Constr_Vars_Iter cvi(gg, false); cvi && is_simple; cvi++) + is_simple = ((*cvi).coef == 0 || (*cvi).var == v + || (*cvi).var->kind() == Wildcard_Var); + return is_simple; +} + + +int countStrides(Conjunct *c, Variable_ID v, EQ_Handle &strideEQ, + bool &simple) { + int strides=0; + for(EQ_Iterator G(c); G; G++) + for(Constr_Vars_Iter I(*G, true); I; I++) + if (((*I).coef != 0) && (*G).get_coef(v) != 0) { + strides++; + simple = isSimpleStride(*G,v); + strideEQ = *G; + break; + } + return strides; +} + +namespace { + +bool hasEQ(Relation r, int level) { + r.simplify(); + Variable_ID v = set_var(level); + Conjunct *s_conj = r.single_conjunct(); + for(EQ_Iterator G(s_conj); G; G++) + if ((*G).get_coef(v)) + return true; + return false; +} + + + +static Relation pickEQ(Relation r, int level) { + r.simplify(); + Variable_ID v = set_var(level); + Conjunct *s_conj = r.single_conjunct(); + for(EQ_Iterator E(s_conj); E; E++) + if ((*E).get_coef(v)) { + Relation test_rel(r.n_set()); + test_rel.and_with_EQ(*E); + return test_rel; + } + assert(0); + return r; +} + +/* pickBound will return an EQ as a GEQ if it finds one */ +Relation pickBound(Relation r, int level, int UB) { + r.simplify(); + Variable_ID v = set_var(level); + Conjunct *s_conj = r.single_conjunct(); + for(GEQ_Iterator G(s_conj); G; G++) { + if ((UB && (*G).get_coef(v) < 0) + || (!UB && (*G).get_coef(v) > 0) ) { + Relation test_rel(r.n_set()); + test_rel.and_with_GEQ(*G); + return test_rel; + } + } + for(EQ_Iterator E(s_conj); E; E++) { + if ((*E).get_coef(v)) { + Relation test_rel(r.n_set()); + test_rel.and_with_GEQ(*E); + if ((UB && (*E).get_coef(v) > 0) + || (!UB && (*E).get_coef(v) < 0) ) + test_rel = Complement(test_rel); + return test_rel; + } + } + assert(0); + return r; +} + +} + +Relation pickOverhead(Relation r, int liftTo) { + r.simplify(); + Conjunct *s_conj = r.single_conjunct(); + for(GEQ_Iterator G(s_conj); G; G++) { + Relation test_rel(r.n_set()); + test_rel.and_with_GEQ(*G); + Variable_ID v; + coef_t pos = -1; + coef_t c= 0; + for(Constr_Vars_Iter cvi(*G, false); cvi; cvi++) + if ((*cvi).coef && (*cvi).var->kind() == Input_Var + && (*cvi).var->get_position() > pos) { + v = (*cvi).var; + pos = (*cvi).var->get_position(); + c = (*cvi).coef; + } +#if 0 + fprintf(DebugFile,"Coef = %d, constraint = %s\n", + c,(const char *)test_rel.print_formula_to_string()); +#endif + return test_rel; + } + for(EQ_Iterator E(s_conj); E; E++) { + assert(liftTo >= 1); + int pos = max((*E).max_tuple_pos(),max_fs_arity(*E)+1); + +/* Pick stride constraints only when the variables with stride are outer + loop variables */ + if ((*E).has_wildcards() && pos < liftTo) { + Relation test_rel(r.n_set()); + test_rel.and_with_EQ(*E); + return test_rel; + } + else if (!(*E).has_wildcards() && pos <= liftTo) { + Relation test_rel(r.n_set()); + test_rel.and_with_EQ(*E); + test_rel.simplify(); + test_rel = EQs_to_GEQs(test_rel,true); + return pickOverhead(test_rel,liftTo); + } + } + if (code_gen_debug>1) { + fprintf(DebugFile,"Could not find overhead:\n"); + r.prefix_print(DebugFile); + } + return Relation::True(r.n_set()); +} + + + +bool hasBound(Relation r, int level, int UB) { + r.simplify(); + Variable_ID v = set_var(level); + Conjunct *s_conj = r.single_conjunct(); + for(GEQ_Iterator G(s_conj); G; G++) { + if (UB && (*G).get_coef(v) < 0) return true; + if (!UB && (*G).get_coef(v) > 0) return true; + } + for(EQ_Iterator E(s_conj); E; E++) { + if ((*E).get_coef(v)) return true; + } + return false; +} + +bool find_any_constraint(int s, int level, Relation &kr, int direction, + Relation &S, bool approx) { + /* If we don't intersect I with restrictions, the combination + of S and restrictions can be unsatisfiable, which means that + the new split node gets pruned away and we still don't have + finite bounds -> infinite recursion. */ + + Relation I = projected_nIS[level][s]; + I = Gist(I,copy(kr)); + if(approx) I = Approximate(I); + if (hasBound(I,level,direction)) { + Relation pickfrom; + if(has_nonstride_EQ(I,level)) + pickfrom = pickEQ(I,level); + else + pickfrom = pickBound(I,level,direction); + S = pickOverhead(pickfrom,level); + if(S.is_obvious_tautology()) S = Relation::Null(); + return !S.is_null(); + } + return false; +} + + +bool has_nonstride_EQ(Relation r, int level) { + r.simplify(); + Variable_ID v = set_var(level); + Conjunct *s_conj = r.single_conjunct(); + for(EQ_Iterator G(s_conj); G; G++) + if ((*G).get_coef(v) && !(*G).has_wildcards()) + return true; + return false; +} + + +Relation minMaxOverhead(Relation r, int level) { + r.finalize(); + r.simplify(); + Conjunct *s_conj = r.single_conjunct(); + GEQ_Handle LBs[50],UBs[50]; + int numLBs = 0; + int numUBs = 0; + Variable_ID v = set_var(level); + for(GEQ_Iterator G(s_conj); G; G++) if ((*G).get_coef(v)) { + GEQ_Handle g = *G; + if (g.get_coef(v) > 0) LBs[numLBs++] = g; + else UBs[numUBs++] = g; + } + if (numLBs <= 1 && numUBs <= 1) { + return Relation::True(r.n_set()); + } + Relation r1(r.n_set()); + Relation r2(r.n_set()); + if (numLBs > 1) { + // remove a max in lower bound + r1.and_with_GEQ(LBs[0]); + r2.and_with_GEQ(LBs[1]); + r1 = project_onto_levels(Difference(r1,r2),level-1,0); + } + else { + // remove a min in upper bound + r1.and_with_GEQ(UBs[0]); + r2.and_with_GEQ(UBs[1]); + r1 = project_onto_levels(Difference(r1,r2),level-1,0); + } +#if 0 + fprintf(DebugFile,"Testing %s\n",(const char *)r1.print_formula_to_string()); + fprintf(DebugFile,"will removed overhead on bounds of t%d: %s\n",level, + (const char *)r.print_formula_to_string()); +#endif + + return pickOverhead(r1, -1); +} + +std::pair find_simplest_assignment(const Relation &R_, Variable_ID v, const std::vector &assigned_on_the_fly) { + Relation &R = const_cast(R_); + Conjunct *c = R.single_conjunct(); + + int min_cost = INT_MAX; + EQ_Handle eq; + for (EQ_Iterator ei(c->EQs()); ei; ei++) + if (!(*ei).has_wildcards() && (*ei).get_coef(v) != 0) { + int cost = 0; + + if (abs((*ei).get_coef(v)) != 1) + cost += 4; // divide cost + + int num_var = 0; + for (Constr_Vars_Iter cvi(*ei); cvi; cvi++) + if ((*cvi).var != v) { + num_var++; + if ((*cvi).var->kind() == Global_Var && (*cvi).var->get_global_var()->arity() > 0) { + cost += 10; // function cost + } + if (abs((*cvi).coef) != 1) + cost += 2; // multiply cost + if ((*cvi).var->kind() == Input_Var && assigned_on_the_fly[(*cvi).var->get_position()-1] != NULL) { + cost += 5; // substituted variable cost + } + } + if ((*ei).get_const() != 0) + num_var++; + if (num_var > 1) + cost += num_var - 1; // addition cost + + if (cost < min_cost) { + min_cost = cost; + eq = *ei; + } + } + + return std::make_pair(eq, min_cost); +} + +int max_fs_arity(const Constraint_Handle &c) { + int max_arity=0; + for(Constr_Vars_Iter cv(c); cv; cv++) + if((*cv).var->kind() == Global_Var) + max_arity = max(max_arity,(*cv).var->get_global_var()->arity()); + return max_arity; +} + +} diff --git a/omegalib/code_gen/src/rose_attributes.cc b/omegalib/code_gen/src/rose_attributes.cc new file mode 100644 index 0000000..bb9681c --- /dev/null +++ b/omegalib/code_gen/src/rose_attributes.cc @@ -0,0 +1,183 @@ +#include + +namespace omega { + +CodeInsertionAttribute* getOrCreateCodeInsertionAttribute(SgNode* node) { + CodeInsertionAttribute* attr; + if(node->attributeExists("code_insertion")) + return static_cast(node->getAttribute("code_insertion")); + attr = new CodeInsertionAttribute(); + node->setAttribute("code_insertion", attr); + return attr; +} + +void postProcessRoseCodeInsertion(SgProject* proj) { + //generatePDF(*proj); + CodeInsertionVisitor visitor = CodeInsertionVisitor(); + visitor.initialize(); + visitor.traverseInputFiles(proj); + visitor.insertCode(); +} + +// Swap a code insertion from one node (sn) to another (dn) +// -- note that this function does not currently remove the insertion from the sn node +void moveCodeInsertion(SgNode* sn, CodeInsertion* ci, SgNode* dn) { + CodeInsertionAttribute* new_attr; + // TODO in the near future: replace the above statement with 'new_attr = getOrCreateCodeInsertionAttribute(...)' + CodeInsertionAttribute* old_attr = static_cast(sn->getAttribute("code_insertion")); + if(dn->attributeExists("code_insertion")) { + new_attr = static_cast(dn->getAttribute("code_insertion")); + } + else { + new_attr = new CodeInsertionAttribute(); + dn->setAttribute("code_insertion", new_attr); + } + new_attr->add(ci); +} + +// A function that copies a specific attribute from one node to another +// this function exists to get around a ROSE limitation that does not +// copy attributes +void copyAttribute(std::string attr_name, SgNode* s, SgNode* d) { + if(s->attributeExists(attr_name)) { + d->setAttribute(attr_name,s->getAttribute(attr_name)); + } +} + +// TODO: find all existng attributes and iterate over them instead of doing them +// individually +void copyAttributes(SgNode* s, SgNode* d) { + copyAttribute("code_insertion", s, d); + //...any other attributes... +} + +void CodeInsertionVisitor::initialize() { + this->loop_level = 0; + this->ci_marks = std::vector(); +} + +void CodeInsertionVisitor::markStmt(SgStatement* stmt, CodeInsertion* ci) { + // this check prevents multiple copies of stmts + // -- may be changed in the future + if(!ci->marked) { + CodeInsertionMark* pos = new CodeInsertionMark(); + pos->stmt = stmt; + pos->ci = ci; + this->ci_marks.push_back(pos); + ci->marked = true; + } +} + +// increase loop_level as the visitor descends +void CodeInsertionVisitor::preOrderVisit(SgNode* n) { + if (isSgForStatement(n)) { + this->loop_level++; + } +} + +void CodeInsertionVisitor::postOrderVisit(SgNode* n) { + if(isSgForStatement(n)) { + this->loop_level--; + } + if(isSgStatement(n)) { + if(n->attributeExists("code_insertion")) { + CodeInsertionAttribute *attr = static_cast(n->getAttribute("code_insertion")); + for(CodeInsertionPtrListItr itr = attr->begin(); itr != attr->end(); ++itr) { + CodeInsertion *insertion = *itr; + // check loop level -- if it is equivelent, mark statement for insertion + // -- else, move attribute up to parent + if(insertion->loop_level != this->loop_level) { + moveCodeInsertion(n, insertion, n->get_parent()); + } + else { + this->markStmt(isSgStatement(n), insertion); + } + } + } + } +} + +// final stage of algorithm that inserts marked statements +void CodeInsertionVisitor::insertCode() { + for(std::vector::iterator itr = this->ci_marks.begin(); itr != this->ci_marks.end(); ++itr) { + CodeInsertionMark* mark = *itr; + SgScopeStatement* scope = static_cast(mark->stmt->get_parent()); + SageInterface::insertStatementBefore(mark->stmt, mark->ci->getStatement(scope)); + } +} + +SgStatement* PragmaInsertion::getStatement(SgScopeStatement* scopeStmt) { + SgStatement* stmt = SageBuilder::buildPragmaDeclaration(this->name); + return stmt; +} + +//SgStatement* MMPrefetchInsertion::getStatement(SgScopeStatement* scopeStmt) { +// const SgName& name = SgName("_mm_prefetch"); +// SgType* rtype = SageBuilder::buildVoidType(); +// SgExpression* arr_arg = SageBuilder::buildVarRefExp(this->arrName); +// SgExpression* hint_arg = SageBuilder::buildShortVal(this->cacheHint); +// SgExprListExp* args = SageBuilder::buildExprListExp(arr_arg,hint_arg); +// SgStatement* stmt = SageBuilder::buildFunctionCallStmt(name, rtype, args, scopeStmt); +// return stmt; +//} + +SgStatement* MMPrefetchInsertion::getStatement(SgScopeStatement* scopeStmt) { + const SgName fname = SgName("_mm_prefetch"); + SgType* rtype = SageBuilder::buildVoidType(); + SgExpression* arr_arg = this->buildArrArg(scopeStmt); + SgExpression* hint_arg = SageBuilder::buildShortVal(this->cacheHint); + SgExprListExp* args = SageBuilder::buildExprListExp(arr_arg, hint_arg); + return SageBuilder::buildFunctionCallStmt(fname, rtype, args, scopeStmt); +} + +SgExpression* MMPrefetchInsertion::buildArrArg(SgScopeStatement* scopeStmt) { + // if there are no index arguments given, just return a variable reference + if(this->indexCount == 0) { + const SgName aname = SgName(this->arrName); + return SageBuilder::buildVarRefExp(aname, scopeStmt); + } + std::vector argList = std::vector(); + // foreach dimension + for(int i = 0; i < this->indexCount; i++) { + argList.push_back(this->makeIndexExp(i, scopeStmt)); + } + return SageBuilder::buildExprListExp(argList); +} + +SgExpression* MMPrefetchInsertion::makeIndexExp(int dim, SgScopeStatement* scopeStmt) { + //(i + offset) or (offset) or (i) + std::string* indexer = this->indecies.at(dim); + int offset = this->offsets.at(dim); + if(indexer == NULL) { + return SageBuilder::buildIntVal(offset); + } + else { + const SgName name = SgName(*indexer); + SgVarRefExp* iref = SageBuilder::buildVarRefExp(name, scopeStmt); + if(offset == 0) { + return iref; + } + else { + return SageBuilder::buildAddOp(iref, SageBuilder::buildIntVal(offset)); + } + } +} + +void MMPrefetchInsertion::initialize(const std::string& arrName, int hint) { + this->arrName = std::string(arrName); + this->cacheHint = hint; + this->indecies = std::vector(); + this->offsets = std::vector(); + this->indexCount = 0; +} +void MMPrefetchInsertion::addDim(int offset) { + this->offsets.push_back(offset); + this->indecies.push_back(NULL); + this->indexCount++; +} +void MMPrefetchInsertion::addDim(int offset, const std::string& indexer) { + this->offsets.push_back(offset); + this->indecies.push_back(new std::string(indexer)); + this->indexCount++; +} +} diff --git a/omegalib/code_gen/src/tags b/omegalib/code_gen/src/tags new file mode 100644 index 0000000..a69c38b --- /dev/null +++ b/omegalib/code_gen/src/tags @@ -0,0 +1,158 @@ +!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ +!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ +!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/ +!_TAG_PROGRAM_NAME Exuberant Ctags // +!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/ +!_TAG_PROGRAM_VERSION 5.8 // +CG_split CG.cc /^CG_split::CG_split(IntTuple &active, int lvl, const Relation &cond_, CG_result *T, CG_result *F) { $/;" f class:omega::CG_split +CG_stringRepr CG_stringRepr.cc /^CG_stringRepr::CG_stringRepr() {$/;" f class:omega::CG_stringRepr +CG_stringRepr CG_stringRepr.cc /^CG_stringRepr::CG_stringRepr(const std::string& _s) : s(_s) {$/;" f class:omega::CG_stringRepr +CG_suifRepr CG_suifRepr.cc /^CG_suifRepr::CG_suifRepr(): tnl_(NULL), op_() {$/;" f class:omega::CG_suifRepr +CG_suifRepr CG_suifRepr.cc /^CG_suifRepr::CG_suifRepr(operand op): tnl_(NULL), op_(op) {$/;" f class:omega::CG_suifRepr +CG_suifRepr CG_suifRepr.cc /^CG_suifRepr::CG_suifRepr(tree_node_list *tnl): tnl_(tnl),op_() {$/;" f class:omega::CG_suifRepr +CreateAnd CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateAnd(CG_outputRepr* lop, CG_outputRepr* rop) const {$/;" f class:omega::CG_stringBuilder +CreateAnd CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateAnd(CG_outputRepr *lop,$/;" f class:omega::CG_suifBuilder +CreateAssignment CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateAssignment(int indent, $/;" f class:omega::CG_stringBuilder +CreateAssignment CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateAssignment(int, CG_outputRepr *lhs,$/;" f class:omega::CG_suifBuilder +CreateComment CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateComment(int indent, const std::string &commentText) const {$/;" f class:omega::CG_stringBuilder +CreateComment CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateComment(int, const std::string &commentText) const {$/;" f class:omega::CG_suifBuilder +CreateEQ CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateEQ(CG_outputRepr* lop, CG_outputRepr* rop) const {$/;" f class:omega::CG_stringBuilder +CreateEQ CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateEQ(CG_outputRepr *lop,$/;" f class:omega::CG_suifBuilder +CreateGE CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateGE(CG_outputRepr* lop, CG_outputRepr* rop) const {$/;" f class:omega::CG_stringBuilder +CreateGE CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateGE(CG_outputRepr *lop,$/;" f class:omega::CG_suifBuilder +CreateIdent CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateIdent(const std::string &_s) const {$/;" f class:omega::CG_stringBuilder +CreateIdent CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateIdent(const std::string &_s) const {$/;" f class:omega::CG_suifBuilder +CreateIf CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateIf(int indent, CG_outputRepr* guardList,$/;" f class:omega::CG_stringBuilder +CreateIf CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateIf(int, CG_outputRepr *guardList,$/;" f class:omega::CG_suifBuilder +CreateInductive CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateInductive(CG_outputRepr* index,$/;" f class:omega::CG_stringBuilder +CreateInductive CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateInductive(CG_outputRepr *index,$/;" f class:omega::CG_suifBuilder +CreateInt CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateInt(int _i) const {$/;" f class:omega::CG_stringBuilder +CreateInt CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateInt(int _i) const {$/;" f class:omega::CG_suifBuilder +CreateIntegerCeil CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateIntegerCeil(CG_outputRepr* lop, CG_outputRepr* rop) const {$/;" f class:omega::CG_stringBuilder +CreateIntegerDivide CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateIntegerDivide(CG_outputRepr* lop, CG_outputRepr* rop) const {$/;" f class:omega::CG_stringBuilder +CreateIntegerDivide CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateIntegerDivide(CG_outputRepr *lop,$/;" f class:omega::CG_suifBuilder +CreateIntegerMod CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateIntegerMod(CG_outputRepr* lop, CG_outputRepr* rop) const {$/;" f class:omega::CG_stringBuilder +CreateIntegerMod CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateIntegerMod(CG_outputRepr *lop,$/;" f class:omega::CG_suifBuilder +CreateInvoke CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateInvoke(const std::string &fname,$/;" f class:omega::CG_stringBuilder +CreateInvoke CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateInvoke(const std::string &fname,$/;" f class:omega::CG_suifBuilder +CreateLE CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateLE(CG_outputRepr* lop, CG_outputRepr* rop) const {$/;" f class:omega::CG_stringBuilder +CreateLE CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateLE(CG_outputRepr *lop,$/;" f class:omega::CG_suifBuilder +CreateLoop CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateLoop(int indent, CG_outputRepr* control,$/;" f class:omega::CG_stringBuilder +CreateLoop CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateLoop(int, CG_outputRepr *control,$/;" f class:omega::CG_suifBuilder +CreateMinus CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateMinus(CG_outputRepr* lop, CG_outputRepr* rop) const {$/;" f class:omega::CG_stringBuilder +CreateMinus CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateMinus(CG_outputRepr *lop,$/;" f class:omega::CG_suifBuilder +CreatePlaceHolder CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreatePlaceHolder(int indent, CG_outputRepr *stmt,$/;" f class:omega::CG_stringBuilder +CreatePlaceHolder CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreatePlaceHolder (int, CG_outputRepr *stmt,$/;" f class:omega::CG_suifBuilder +CreatePlus CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreatePlus(CG_outputRepr* lop, CG_outputRepr* rop) const {$/;" f class:omega::CG_stringBuilder +CreatePlus CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreatePlus(CG_outputRepr *lop,$/;" f class:omega::CG_suifBuilder +CreateTimes CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::CreateTimes(CG_outputRepr* lop, CG_outputRepr* rop) const {$/;" f class:omega::CG_stringBuilder +CreateTimes CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::CreateTimes(CG_outputRepr *lop,$/;" f class:omega::CG_suifBuilder +Dump CG_stringRepr.cc /^void CG_stringRepr::Dump() const {$/;" f class:omega::CG_stringRepr +Dump CG_suifRepr.cc /^void CG_suifRepr::Dump() const {$/;" f class:omega::CG_suifRepr +DumpToFile CG_stringRepr.cc /^void CG_stringRepr::DumpToFile(FILE *fp) const {$/;" f class:omega::CG_stringRepr +DumpToFile CG_suifRepr.cc /^void CG_suifRepr::DumpToFile(FILE *fp) const {$/;" f class:omega::CG_suifRepr +GetCode CG_suifRepr.cc /^tree_node_list* CG_suifRepr::GetCode() const {$/;" f class:omega::CG_suifRepr +GetExpression CG_suifRepr.cc /^operand CG_suifRepr::GetExpression() const {$/;" f class:omega::CG_suifRepr +GetIndentSpaces CG_stringBuilder.cc /^std::string GetIndentSpaces(int indent) {$/;" f namespace:omega +GetString CG_stringBuilder.cc /^std::string GetString(CG_outputRepr* repr) {$/;" f namespace:omega +GetString CG_stringRepr.cc /^std::string CG_stringRepr::GetString() const { $/;" f class:omega::CG_stringRepr +JunkStaticInit code_gen.cc /^class JunkStaticInit{ public: JunkStaticInit(){ checkLoopLevel=0; fillInBounds=false;} };$/;" c namespace:omega file: +JunkStaticInit code_gen.cc /^class JunkStaticInit{ public: JunkStaticInit(){ checkLoopLevel=0; fillInBounds=false;} };$/;" f class:omega::JunkStaticInit +MMGenerateCode code_gen.cc /^CG_outputRepr* MMGenerateCode(CG_outputBuilder* ocg, RelTuple &T, SetTuple &old_IS, $/;" f namespace:omega +MMGenerateCode code_gen.cc /^CG_outputRepr* MMGenerateCode(CG_outputBuilder* ocg, RelTuple &T, SetTuple &old_IS, const Tuple &stmt_content, Relation &known, int effort) {$/;" f namespace:omega +MMGenerateCode code_gen.cc /^std::string MMGenerateCode(RelTuple &T, SetTuple &old_IS, Relation &known, int effort) {$/;" f namespace:omega +SafeguardString CG_stringBuilder.cc /^static std::string SafeguardString(const std::string &s, char op) {$/;" f namespace:omega +StmtListAppend CG_stringBuilder.cc /^CG_outputRepr* CG_stringBuilder::StmtListAppend(CG_outputRepr* list1, CG_outputRepr* list2) const {$/;" f class:omega::CG_stringBuilder +StmtListAppend CG_suifBuilder.cc /^CG_outputRepr* CG_suifBuilder::StmtListAppend(CG_outputRepr *list1, $/;" f class:omega::CG_suifBuilder +boundHitsStride output_repr.cc /^bool boundHitsStride(const GEQ_Handle &g, Variable_ID v,$/;" f namespace:omega +checkLoopLevel code_gen.cc /^int checkLoopLevel;$/;" m namespace:omega file: +clear CG_suifRepr.cc /^void CG_suifRepr::clear() {$/;" f class:omega::CG_suifRepr +clone CG_stringRepr.cc /^CG_outputRepr* CG_stringRepr::clone() {$/;" f class:omega::CG_stringRepr +clone CG_suifRepr.cc /^CG_outputRepr* CG_suifRepr::clone() {$/;" f class:omega::CG_suifRepr +code_gen_debug code_gen.cc /^int code_gen_debug=0;$/;" m namespace:omega file: +countStrides output_repr.cc /^int countStrides(Conjunct *c, Variable_ID v, EQ_Handle &strideEQ, $/;" f namespace:omega +create_stride_on_bound output_repr.cc /^Relation create_stride_on_bound(int n, const std::map &lb, coef_t stride) {$/;" f namespace:omega::__anon2 +exit_code_gen CG_suifBuilder.cc /^void exit_code_gen(void) {$/;" f namespace:omega +extract_function_symbols code_gen.cc /^RelTuple extract_function_symbols(SetTuple &sets) {$/;" f namespace:omega +fillInBounds code_gen.cc /^bool fillInBounds;$/;" m namespace:omega file: +filter_function_symbols code_gen.cc /^SetTuple filter_function_symbols(SetTuple &sets, bool keep_fs){$/;" f namespace:omega +findFloorInequality output_repr.cc /^bool findFloorInequality(Relation &r, Variable_ID v, GEQ_Handle &h, Variable_ID excluded) {$/;" f namespace:omega +findOverhead CG.cc /^Relation CG_leaf::findOverhead(int liftTo) {$/;" f class:omega::CG_leaf +findOverhead CG.cc /^Relation CG_loop::findOverhead(int liftTo) {$/;" f class:omega::CG_loop +findOverhead CG.cc /^Relation CG_split::findOverhead(int liftTo) {$/;" f class:omega::CG_split +find_any_constraint output_repr.cc /^bool find_any_constraint(int s, int level, Relation &kr, int direction,$/;" f namespace:omega +find_simplest_assignment output_repr.cc /^std::pair find_simplest_assignment(const Relation &R_, Variable_ID v, const std::vector &assigned_on_the_fly) {$/;" f namespace:omega +force_finite_bounds CG.cc /^CG_result * CG_loop::force_finite_bounds() {$/;" f class:omega::CG_loop +force_finite_bounds CG.cc /^CG_result * CG_split::force_finite_bounds() {$/;" f class:omega::CG_split +gen_recursive code_gen.cc /^CG_result *gen_recursive(int level, IntTuple &isActive) {$/;" f namespace:omega +get_stride output_repr.cc /^void get_stride(const Constraint_Handle &h, Variable_ID &wc, coef_t &step){$/;" f namespace:omega::__anon1 +greatest_common_step output_repr.cc /^Relation greatest_common_step(const Tuple &I, const Tuple &active, int level, const Relation &known) {$/;" f namespace:omega +hasBound output_repr.cc /^bool hasBound(Relation r, int level, int UB) {$/;" f namespace:omega +hasEQ output_repr.cc /^bool hasEQ(Relation r, int level) {$/;" f namespace:omega::__anon3 +has_nonstride_EQ output_repr.cc /^bool has_nonstride_EQ(Relation r, int level) {$/;" f namespace:omega +hoistGuard CG.cc /^Relation CG_leaf::hoistGuard() {$/;" f class:omega::CG_leaf +hoistGuard CG.cc /^Relation CG_loop::hoistGuard() {$/;" f class:omega::CG_loop +hoistGuard CG.cc /^Relation CG_split::hoistGuard() {$/;" f class:omega::CG_split +init_code_gen CG_suifBuilder.cc /^void init_code_gen(int&, char* []) {$/;" f namespace:omega +isSimpleStride output_repr.cc /^bool isSimpleStride(const EQ_Handle &g, Variable_ID v) {$/;" f namespace:omega +junkInitInstance__ code_gen.cc /^static JunkStaticInit junkInitInstance__;$/;" m namespace:omega file: +k_ocg_comment CG_suifBuilder.cc /^char *k_ocg_comment;$/;" m namespace:omega file: +last_level code_gen.cc /^int last_level;\/\/ Should not be global, but it is.$/;" m namespace:omega file: +libcode_gen_suif_string CG_suifBuilder.cc /^const char *libcode_gen_suif_string = "";$/;" m namespace:omega file: +libcode_gen_ver_string CG_suifBuilder.cc /^const char *libcode_gen_ver_string = "";$/;" m namespace:omega file: +libcode_gen_who_string CG_suifBuilder.cc /^const char *libcode_gen_who_string = "";$/;" m namespace:omega file: +liftOverhead CG.cc /^CG_result * CG_loop::liftOverhead(int depth) {$/;" f class:omega::CG_loop +liftOverhead CG.cc /^CG_result * CG_split::liftOverhead(int depth) {$/;" f class:omega::CG_split +loopIdxNames code_gen.cc /^Tuple< Tuple > loopIdxNames;\/\/per stmt$/;" m namespace:omega file: +lowerBoundForLevel code_gen.cc /^int lowerBoundForLevel;$/;" m namespace:omega file: +max_fs_arity output_repr.cc /^int max_fs_arity(const Constraint_Handle &c) {$/;" f namespace:omega +minMaxOverhead output_repr.cc /^Relation minMaxOverhead(Relation r, int level) {$/;" f namespace:omega +new_IS code_gen.cc /^SetTuple new_IS;$/;" m namespace:omega file: +omega CG.cc /^namespace omega {$/;" n file: +omega CG_stringBuilder.cc /^namespace omega {$/;" n file: +omega CG_stringRepr.cc /^namespace omega {$/;" n file: +omega CG_suifBuilder.cc /^namespace omega {$/;" n file: +omega CG_suifRepr.cc /^namespace omega {$/;" n file: +omega code_gen.cc /^namespace omega {$/;" n file: +omega output_repr.cc /^namespace omega {$/;" n file: +outputAssignment output_repr.cc /^std::pair outputAssignment(CG_outputBuilder *ocg, const Relation &R_, Variable_ID v, Relation &enforced, CG_outputRepr *&if_repr, const std::vector &assigned_on_the_fly) {$/;" f namespace:omega +outputBounds output_repr.cc /^std::pair outputBounds(CG_outputBuilder* ocg, const Relation &bounds, Variable_ID v, int indent, Relation &enforced, const std::vector &assigned_on_the_fly) {$/;" f namespace:omega +outputEasyBoundAsRepr output_repr.cc /^CG_outputRepr* outputEasyBoundAsRepr(CG_outputBuilder* ocg, Relation &bounds,$/;" f namespace:omega +outputGuard output_repr.cc /^CG_outputRepr *outputGuard(CG_outputBuilder* ocg, const Relation &guards_in, const std::vector &assigned_on_the_fly) {$/;" f namespace:omega +outputIdent output_repr.cc /^CG_outputRepr* outputIdent(CG_outputBuilder* ocg, const Relation &R_, Variable_ID v, const std::vector &assigned_on_the_fly) {$/;" f namespace:omega +outputLBasRepr output_repr.cc /^CG_outputRepr *outputLBasRepr(CG_outputBuilder* ocg, const GEQ_Handle &g, $/;" f namespace:omega +outputStatement output_repr.cc /^CG_outputRepr* outputStatement(CG_outputBuilder *ocg, CG_outputRepr *stmt, int indent, const Relation &mapping_, const Relation &known_, const std::vector &assigned_on_the_fly) {$/;" f namespace:omega +outputSubstitution output_repr.cc /^Tuple outputSubstitution(CG_outputBuilder* ocg, const Relation &R_, const std::vector &assigned_on_the_fly) {$/;" f namespace:omega +outputUBasRepr output_repr.cc /^CG_outputRepr *outputUBasRepr(CG_outputBuilder* ocg, const GEQ_Handle &g, $/;" f namespace:omega +output_EQ_strides output_repr.cc /^CG_outputRepr *output_EQ_strides(CG_outputBuilder* ocg, const Relation &guards_in, const std::vector &assigned_on_the_fly) {$/;" f namespace:omega +output_GEQ_strides output_repr.cc /^CG_outputRepr *output_GEQ_strides(CG_outputBuilder* ocg, const Relation &guards_in, const std::vector &assigned_on_the_fly) {$/;" f namespace:omega +output_as_guard output_repr.cc /^CG_outputRepr* output_as_guard(CG_outputBuilder* ocg, const Relation &guards_in, Constraint_Handle e, bool is_equality, const std::vector &assigned_on_the_fly) {$/;" f namespace:omega +pickBound output_repr.cc /^Relation pickBound(Relation r, int level, int UB) {$/;" f namespace:omega::__anon3 +pickEQ output_repr.cc /^static Relation pickEQ(Relation r, int level) {$/;" f namespace:omega::__anon3 +pickOverhead output_repr.cc /^Relation pickOverhead(Relation r, int liftTo) {$/;" f namespace:omega +print CG.cc /^std::string CG_result::print(int indent) {$/;" f class:omega::CG_result +printRepr CG.cc /^CG_outputRepr* CG_leaf::printRepr(CG_outputBuilder* ocg, int indent, const std::vector &assigned_on_the_fly) {$/;" f class:omega::CG_leaf +printRepr CG.cc /^CG_outputRepr* CG_loop::printRepr(CG_outputBuilder* ocg, int indent, const std::vector &assigned_on_the_fly) {$/;" f class:omega::CG_loop +printRepr CG.cc /^CG_outputRepr* CG_split::printRepr(CG_outputBuilder* ocg, int indent, const std::vector &assigned_on_the_fly) {$/;" f class:omega::CG_split +printStructure CG.cc /^std::string CG_leaf::printStructure(int) {$/;" f class:omega::CG_leaf +printStructure CG.cc /^std::string CG_loop::printStructure(int indent) {$/;" f class:omega::CG_loop +printStructure CG.cc /^std::string CG_split::printStructure(int indent) {$/;" f class:omega::CG_split +project_onto_levels output_repr.cc /^Relation project_onto_levels(Relation R, int last_level, bool wildcards) {$/;" f namespace:omega +projected_nIS code_gen.cc /^SetTupleTuple projected_nIS;$/;" m namespace:omega file: +recompute CG.cc /^CG_result * CG_loop::recompute(const Relation &k, const Relation &r) {$/;" f class:omega::CG_loop +recompute CG.cc /^CG_result * CG_split::recompute(const Relation &k, const Relation &r) {$/;" f class:omega::CG_split +recompute CG.cc /^CG_result* CG_leaf::recompute(const Relation &k, const Relation &r) {$/;" f class:omega::CG_leaf +removeGuard CG.cc /^void CG_leaf::removeGuard() {$/;" f class:omega::CG_leaf +smtNonSplitLevels code_gen.cc /^Tuple< IntTuple > smtNonSplitLevels;$/;" m namespace:omega file: +statementInfo code_gen.cc /^Tuple statementInfo;$/;" m namespace:omega file: +stmtForLoopCheck code_gen.cc /^int stmtForLoopCheck;$/;" m namespace:omega file: +strip_function_symbols code_gen.cc /^RelTuple strip_function_symbols(SetTuple &sets) {$/;" f namespace:omega +substitute CG_suifBuilder.cc /^bool substitute(instruction *in, var_sym *sym, operand expr, base_symtab *st) {$/;" f namespace:omega +substitute CG_suifBuilder.cc /^bool substitute(tree_node *tn, var_sym *sym, operand expr, base_symtab *st) {$/;" f namespace:omega +substitute CG_suifBuilder.cc /^bool substitute(tree_node_list *tnl, var_sym *sym, operand expr,$/;" f namespace:omega +syncs code_gen.cc /^std::vector< std::pair > syncs;$/;" m namespace:omega file: +transformations code_gen.cc /^RelTuple transformations;$/;" m namespace:omega file: +upperBoundForLevel code_gen.cc /^int upperBoundForLevel;$/;" m namespace:omega file: +var_substitution_threshold output_repr.cc /^int var_substitution_threshold = 4;$/;" m namespace:omega file: +~CG_stringRepr CG_stringRepr.cc /^CG_stringRepr::~CG_stringRepr() {$/;" f class:omega::CG_stringRepr +~CG_suifRepr CG_suifRepr.cc /^CG_suifRepr::~CG_suifRepr() {$/;" f class:omega::CG_suifRepr diff --git a/omegalib/doc/calculator.pdf b/omegalib/doc/calculator.pdf new file mode 100755 index 0000000..5c307ab Binary files /dev/null and b/omegalib/doc/calculator.pdf differ diff --git a/omegalib/doc/interface.pdf b/omegalib/doc/interface.pdf new file mode 100755 index 0000000..7f918ae Binary files /dev/null and b/omegalib/doc/interface.pdf differ diff --git a/omegalib/examples/basics b/omegalib/examples/basics new file mode 100644 index 0000000..9f0728d --- /dev/null +++ b/omegalib/examples/basics @@ -0,0 +1,30 @@ +# +# Some examples from the documentation for the Omega Calculator +# This is the input for figures 2 and 3. +# + +R := { [i] -> [i'] : 1 <= i,i' <= 10 && i' = i+1 }; +R; +inverse R; +domain R; +range R; +R compose R; +R+; # closure of R = R union (R compose R) union (R compose R ... +complement R; +S := {[i] : 5 <= i <= 25}; +S; +R(S); # apply R to S +R \ S; # restrict domain of R to S +R / S; # restrict range of R to S +(R\S) union (R/S); +(R\S) intersection (R/S); +(R/S) - (R\S); +S*S; # cross product +D := S - {[9:16:2]} - {[17:19]}; +D; +T := { [i] : 1 <= i <= 11 & exists (a : i = 2a) }; +T; +Hull T; +Hull D; +codegen D; +codegen {[i,j] : 1 <= i+j,j <= 10}; diff --git a/omegalib/examples/basics.out b/omegalib/examples/basics.out new file mode 100644 index 0000000..6f8f2bb --- /dev/null +++ b/omegalib/examples/basics.out @@ -0,0 +1,76 @@ +>>> # +>>> # Some examples from the documentation for the Omega Calculator +>>> # This is the input for figures 2 and 3. +>>> # +>>> +>>> R := { [i] -> [i'] : 1 <= i,i' <= 10 && i' = i+1 }; +>>> R; +{[i] -> [i+1] : 1 <= i <= 9} +>>> inverse R; +{[i] -> [i-1] : 2 <= i <= 10} +>>> domain R; +{[i]: 1 <= i <= 9} +>>> range R; +{[i]: 2 <= i <= 10} +>>> R compose R; +{[i] -> [i+2] : 1 <= i <= 8} +>>> R+; +{[i] -> [i'] : 1 <= i < i' <= 10} +>>> # closure of R = R union (R compose R) union (R compose R ... +>>> complement R; +{[i] -> [i'] : i <= 0} union + {[i] -> [i'] : 10 <= i} union + {[i] -> [i'] : 1, i' <= i <= 9} union + {[i] -> [i'] : 1 <= i <= 9, i'-2} +>>> S := {[i] : 5 <= i <= 25}; +>>> S; +{[i]: 5 <= i <= 25} +>>> R(S); +{[i]: 6 <= i <= 10} +>>> # apply R to S +>>> R \ S; +{[i] -> [i+1] : 5 <= i <= 9} +>>> # restrict domain of R to S +>>> R / S; +{[i] -> [i+1] : 4 <= i <= 9} +>>> # restrict range of R to S +>>> (R\S) union (R/S); +{[i] -> [i+1] : 4 <= i <= 9} +>>> (R\S) intersection (R/S); +{[i] -> [i+1] : 5 <= i <= 9} +>>> (R/S) - (R\S); +{[4] -> [5] } +>>> S*S; +{[i] -> [i'] : 5 <= i <= 25 && 5 <= i' <= 25} +>>> # cross product +>>> D := S - {[9:16:2]} - {[17:19]}; +>>> D; +{[i]: 5 <= i <= 8} union + {[i]: exists ( alpha : 2alpha = i && 10 <= i <= 16)} union + {[i]: 20 <= i <= 25} +>>> T := { [i] : 1 <= i <= 11 & exists (a : i = 2a) }; +>>> T; +{[i]: exists ( alpha : 2alpha = i && 2 <= i <= 10)} +>>> Hull T; +{[i]: exists ( alpha : 2alpha = i && 2 <= i <= 10)} +>>> Hull D; +{[i]: 5 <= i <= 25} +>>> codegen D; +for(t1 = 5; t1 <= 8; t1++) { + s0(t1); +} +for(t1 = 10; t1 <= 16; t1 += 2) { + s0(t1); +} +for(t1 = 20; t1 <= 25; t1++) { + s0(t1); +} + +>>> codegen {[i,j] : 1 <= i+j,j <= 10}; +for(t1 = -9; t1 <= 9; t1++) { + for(t2 = max(1,-t1+1); t2 <= min(-t1+10,10); t2++) { + s0(t1,t2); + } +} + +>>> diff --git a/omegalib/examples/c_code/PT-example.c b/omegalib/examples/c_code/PT-example.c new file mode 100644 index 0000000..c2560e7 --- /dev/null +++ b/omegalib/examples/c_code/PT-example.c @@ -0,0 +1,12 @@ +#if defined DONT_INCLUDE_TEMPLATE_CODE + +/* DONT BOTHER COMPILING THIS FILE UNLESS WE ARE USING G++ >= 260 + AND -fno-implicit-templates AND -DDONT_INCLUDE_TEMPLATE_CODE */ + +#undef DONT_INCLUDE_TEMPLATE_CODE + +#include + +// If we needed other templates, we would put them here + +#endif diff --git a/omegalib/examples/c_code/example.c b/omegalib/examples/c_code/example.c new file mode 100644 index 0000000..8bd84b3 --- /dev/null +++ b/omegalib/examples/c_code/example.c @@ -0,0 +1,89 @@ +#include + +// THIS NEEDS TO BE A LOT SIMPLER - I'M CUTTING IT DOWN + +// R := { [i,j] -> [i', j'] : +// 1 <= i, i' <= n && 1 <= j <= L(i) && 1 <= j' <= m && +// j = j' && i < i' } +// +// S := { [x,y] : 1 <= x <= n && y <= x + 5 && x is divisible by 17 && +// there exists z such that y <= z <= x && +// ( z is divisible by 8 || z+5x is divisible by 12 ) } + +using namespace omega; +int main() { + Relation S(2); + S.name_set_var(1, "x"); + S.name_set_var(2, "y"); + + assert( S.is_set()); + + Free_Var_Decl n("n"); + + +/* Relation R(2,2); */ +/* assert(!R.is_set()); */ + +/* Free_Var_Decl m("m"); */ +/* Free_Var_Decl l("L", 1); */ + +/* Variable_ID local_n = R.get_local(&n); */ +/* Variable_ID local_m = R.get_local(&m); */ +/* Variable_ID l_in = R.get_local(&l, Input_Tuple); */ +/* Variable_ID l_out = R.get_local(&l, Output_Tuple); */ + +/* Variable_ID in1 = R.input_var(1); */ +/* Variable_ID in2 = R.input_var(2); */ +/* Variable_ID out1 = R.output_var(1); */ +/* Variable_ID out2 = R.output_var(2); */ + + Variable_ID x = S.set_var(1); + Variable_ID y = S.set_var(2); + + F_And *S_root = S.add_and(); + + GEQ_Handle xmin = S_root->add_GEQ(); // x-1 >= 0 + xmin.update_coef(x, 1); + xmin.update_const(-1); + GEQ_Handle xmax = S_root->add_GEQ(); // n-x >= 0 + xmax.update_coef(x, -1); + xmax.update_coef(S.get_local(&n), 1); + GEQ_Handle ymax = S_root->add_GEQ(); // x+5-y >= 0 + ymax.update_coef(x, 1); + ymax.update_coef(y, -1); + ymax.update_const(5); + + // x is divisible by 17 + S_root->add_stride(17).update_coef(x,1); + + F_Exists *e = S_root->add_exists(); + + Variable_ID z = e->declare("z"); // exists z + F_And *z_stuff = e->add_and(); + + GEQ_Handle zmin = z_stuff->add_GEQ(); // z-y >= 0 + zmin.update_coef(z,1); + zmin.update_coef(y,-1); + GEQ_Handle zmax = z_stuff->add_GEQ(); // x-z >= 0 + zmax.update_coef(x,1); + zmax.update_coef(z,-1); + + F_Or *o = z_stuff->add_or(); + Stride_Handle z8 = o->add_and()->add_stride(8); + z8.update_coef(z,1); // z divisible by 8 + + Stride_Handle z12 = o->add_and()->add_stride(12); + z12.update_coef(z,1); + z12.update_coef(x,5); // z+5x divisible by 12 + + + S.print(); + S.finalize(); + S.prefix_print(); + S.is_upper_bound_satisfiable(); + S.print(); + S.prefix_print(); + + return 0; +} + diff --git a/omegalib/examples/c_code/library_example.c b/omegalib/examples/c_code/library_example.c new file mode 100644 index 0000000..06f6570 --- /dev/null +++ b/omegalib/examples/c_code/library_example.c @@ -0,0 +1,190 @@ +/* + IF THESE EXAMPLES CHANGE, CHANGE construction.tex CORRESPONDINGLY + + S1 := { [t] : 1 <= t <= n } + + S2 := { [x] : (0 <= x <= 100 and + exists y : (2n <= y <= x and y is odd)) + or x = 17 } + + R := { [i,j] -> [i',j'] : 1 <= i <= i' <= n and not (F(i) = F(i')) + and 1 <= j, j' <= m } +*/ + +//BEGIN PART 1 +#include +using namespace omega; +int main() { + Relation S1(1), S2(1), R(2,2); + S1.name_set_var(1, "t"); + S2.name_set_var(1, "x"); + + assert(!R.is_set()); + assert(S1.is_set()); + assert(S2.is_set()); + + Free_Var_Decl n("n"); + Free_Var_Decl m("m"); + Free_Var_Decl f("F", 1); + + Variable_ID S1s_n = S1.get_local(&n); + Variable_ID S2s_n = S2.get_local(&n); + + Variable_ID Rs_n = R.get_local(&n); + Variable_ID Rs_m = R.get_local(&m); + Variable_ID Rs_f_in = R.get_local(&f, Input_Tuple); + Variable_ID Rs_f_out = R.get_local(&f, Output_Tuple); + + R.name_input_var(1, "i"); + R.name_input_var(2, "j"); + R.name_output_var(1, "i'"); + R.name_output_var(2, "j'"); + Variable_ID i = R.input_var(1); + Variable_ID j = R.input_var(2); + Variable_ID i2 = R.output_var(1); + Variable_ID j2 = R.output_var(2); + + Variable_ID t = S1.set_var(1); + Variable_ID x = S2.set_var(1); +//END PART 1 +//BEGIN PART 2 + F_And *S1_root = S1.add_and(); + + GEQ_Handle tmin = S1_root->add_GEQ(); // t-1 >= 0 + tmin.update_coef(t, 10); + tmin.update_coef(t, -9); // t now has coef. 1 + tmin.update_const(-1); + GEQ_Handle tmax = S1_root->add_GEQ(); // n-t >= 0 + tmax.update_coef(S1s_n,1); + tmax.update_coef(t, -1); + + + F_Or *S2_root = S2.add_or(); + F_And *part1 = S2_root->add_and(); + + GEQ_Handle xmin = part1->add_GEQ(); + xmin.update_coef(x,1); + GEQ_Handle xmax = part1->add_GEQ(); + xmax.update_coef(x,-1); + xmax.update_const(100); + + F_Exists *exists_y = part1->add_exists(); + Variable_ID y = exists_y->declare("y"); + + F_And *y_stuff = exists_y->add_and(); + GEQ_Handle ymin = y_stuff->add_GEQ(); + ymin.update_coef(y,1); + ymin.update_coef(S2s_n,-2); + GEQ_Handle ymax = y_stuff->add_GEQ(); + ymax.update_coef(x,1); + ymax.update_coef(y,-1); + Stride_Handle y_even = y_stuff->add_stride(2); + y_even.update_coef(y,1); + y_even.update_const(1); + + F_And *part2 = S2_root->add_and(); + + EQ_Handle xvalue = part2->add_EQ(); + xvalue.update_coef(x,1); + xvalue.update_const(-17); +//END PART 2 +//BEGIN PART 3 + F_And *R_root = R.add_and(); + + GEQ_Handle imin = R_root->add_GEQ(); + imin.update_coef(i,1); + imin.update_const(-1); + GEQ_Handle imax = R_root->add_GEQ(); + imax.update_coef(i2,1); + imax.update_coef(i,-1); + GEQ_Handle i2max = R_root->add_GEQ(); + i2max.update_coef(Rs_n,1); + i2max.update_coef(i2,-1); + + EQ_Handle f_eq = R_root->add_not()->add_and()->add_EQ(); + f_eq.update_coef(Rs_f_in,-1); + f_eq.update_coef(Rs_f_out,1); // F(In) - F(Out) = 0 + + GEQ_Handle jmin = R_root->add_GEQ(); + jmin.update_coef(j,1); + jmin.update_const(-1); + GEQ_Handle jmax = R_root->add_GEQ(); + jmax.update_coef(Rs_m,1); + jmax.update_coef(j,-1); + + GEQ_Handle j2min = R_root->add_GEQ(); + j2min.update_coef(j2,1); + j2min.update_const(-1); + GEQ_Handle j2max = R_root->add_GEQ(); + j2max.update_coef(Rs_m,1); + j2max.update_coef(j2,-1); +//END PART 3 +//BEGIN PART 4 + S1.print_with_subs(stdout); + assert(S1.is_upper_bound_satisfiable()); + assert(!S1.is_tautology()); + S1.print_with_subs(stdout); // same as above print + printf("\n"); + + S2.print(); + assert(S2.is_upper_bound_satisfiable()); + assert(!S2.is_tautology()); + S2.print(); // different from above + printf("\n"); + + assert(R.is_upper_bound_satisfiable()); + assert(!R.is_tautology()); + R.print_with_subs(stdout); + + coef_t lb, ub; + bool coupled; + R.query_difference(i2, i, lb, ub, coupled); + assert(lb == 1); // i < i2: i2 - i1 > 0 + assert(ub == posInfinity); + + for(DNF_Iterator di(R.query_DNF()); di; di++) { + printf("In next conjunct,\n"); + for(EQ_Iterator ei = (*di)->EQs(); ei; ei++) { + printf(" In next equality constraint,\n"); + for(Constr_Vars_Iter cvi(*ei); cvi; cvi++) + printf(" Variable %s has coefficient "coef_fmt"\n", + (*cvi).var->char_name(), + (*cvi).coef); + } + for(GEQ_Iterator gi = (*di)->GEQs(); gi; gi++) { + printf(" In next inequality constraint,\n"); + for(Constr_Vars_Iter cvi(*gi); cvi; cvi++) + printf(" Variable %s has coefficient "coef_fmt"\n", + (*cvi).var->char_name(), + (*cvi).coef); + int c = (*gi).get_const(); + if (c != 0) + printf(" Constant %d\n", c); + } + + printf("\n"); + } +//END PART 4 +//BEGIN PART 5 + Relation S1_or_S2 = Union(copy(S1), copy(S2)); + + // NOTE! THE FOLLOWING KILLS S1 AND S2 + Relation S1_and_S2 = Intersection(S1, S2); + + S1_or_S2.is_upper_bound_satisfiable(); + S1_and_S2.is_upper_bound_satisfiable(); + + S1_or_S2.print(); + printf("\n"); + + S1_and_S2.print(); + printf("\n"); + + Relation R_R = Composition(copy(R), R); + R_R.query_difference(i2, i, lb, ub, coupled); + assert(lb == 2); + assert(ub == posInfinity); + + return 0; +} +//END PART 5 diff --git a/omegalib/examples/code_gen b/omegalib/examples/code_gen new file mode 100644 index 0000000..b3a0b4e --- /dev/null +++ b/omegalib/examples/code_gen @@ -0,0 +1,60 @@ +# Example taken from http://www.cloog.org +# + +r0:={[i,j]:i>=1 && j<=7 && j>=i-1}; +r1:={[i,j]:2<=i<=6 && 0<=j<=4}; + +# CLooG optimized for size +## +## for (i=1;i<=8;i++) { +## for (j=i-1;j<=7;j++) { +## S0(i,j); +## } +## if ((i>=2)&&(i<=6)) { +## for (j=0;j<=4;j++) { +## S1(i,j); +## } +## } +## } +## +## Since CLooG might not preserve the lexcicographical order other than +## the default code generation strategy (custom -f or -l values). Its +## generated code might not be correct should there exist reorder-preventing +## dependence among statements. +## + +# no overhead removal, minimal code size +codegen 0 r0,r1; + +# remove one-deep loop nest (innermost loop) overhead +codegen 1 r0,r1; + +# CLooG optimized for control +## +## for (t2=0;t2<=7;t2++) { +## S0(1,t2); +## } +## for (t1=2;t1<=6;t1++) { +## for (t2=0;t2<=t1-2;t2++) { +## S1(t1,t2); +## } +## for (t2=t1-1;t2<=4;t2++) { +## S0(t1,t2); +## S1(t1,t2); +## } +## for (t2=5;t2<=7;t2++) { +## S0(t1,t2); +## } +## } +## for (t1=7;t1<=8;t1++) { +## for (t2=t1-1;t2<=7;t2++) { +## S0(t1,t2); +## } +## } +## +## This is CLooG's default code generation strategy. It guarantees +## the lexicographical order as shown in input iteration spaces. +## + +# minimal control overhead, removing overhead from 2-deep loop nest +codegen 2 r0,r1; diff --git a/omegalib/examples/code_gen.out b/omegalib/examples/code_gen.out new file mode 100644 index 0000000..16e1b21 --- /dev/null +++ b/omegalib/examples/code_gen.out @@ -0,0 +1,33 @@ +# Omega Calculator [v1.1, Nov 96]: +# # +# # Example of code generation from Omega Calculator documentation +# # +# +# T10:={[i] -> [0,i,0,0]}; +# +# T20:={[i,j] -> [1,j,0,i]}; +# +# T30:={[i] -> [1,i-1,1,0]}; +# +# +# Symbolic n; +# +# IS10 := {[i]: 2 <= i <= n}; +# +# IS20 := {[i,j]: 2 <= i <= n && 1 <= j <= i-1}; +# +# IS30 := IS10; +# +# +# codegen T10:IS10,T20:IS20,T30:IS30; +for(t2 = 2; t2 <= n; t2++) { + s1(t2); +} +for(t2 = 1; t2 <= n-1; t2++) { + for(t4 = t2+1; t4 <= n; t4++) { + s2(t4,t2); + } + s3(t2+1); +} + +# diff --git a/omegalib/examples/experiments/gemm/codegen.input b/omegalib/examples/experiments/gemm/codegen.input new file mode 100755 index 0000000..cf1554b --- /dev/null +++ b/omegalib/examples/experiments/gemm/codegen.input @@ -0,0 +1,14 @@ +symbolic n, over1, over2; +s0:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta,tau : 2tau = 1+t10 && 2alpha = 1+t8 && t2 = 1+512beta && t4 = 1+128gamma && t6 = 1+8delta && t1 = 0 && t3 = 0 && t5 = 1 && t7 = 2 && t9 = 1 && t11 = 0 && t13 = 0 && 1, t12-511 <= t2 <= t12 <= n && 1, t10-6 <= t6 <= t10 && 1, t8-126 <= t4 <= t8 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && over2+t10 <= n && over1+t8 <= n) }; +s1:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9] : exists ( alpha,beta : t4 = 1+128beta && t2 = 1+512alpha && t1 = 0 && t3 = 0 && t5 = 0 && t7 = 0 && t9 = 0 && 1, t8-127 <= t4 <= t8 <= n && 1, t2 <= t6 <= n, t2+511 && 0 <= over2 <= 1 && 0 <= over1 <= 1) }; +s2:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11] : exists ( alpha,beta,gamma : t6 = 1+8gamma && t4 = 1+128alpha && t2 = 1+512beta && t5 = 1 && t9 = 0 && t11 = 0 && t1 = 0 && 1+t7 = 0 && t3 = 0 && 1, t10-511 <= t2 <= t10 <= n && 1, t8-7 <= t6 <= t8 <= n && 0 <= over2 <= 1 && 0 <= over1 <= 1 && 1 <= t4 <= n) }; +s3:= { [t1,t2,t3,t4,t5,t6,t7] : exists ( alpha,beta,gamma : t6 = 1+8gamma && t4 = 1+128alpha && t2 = 1+512beta && t5 = 1 && t1 = 0 && t7 = 0 && t3 = 0 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && 1 <= t2 <= n && 1 <= t4 <= n && 1 <= t6 <= n) }; +s4:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma : t6 = 1+8beta && t4 = 1+128gamma && t2 = 1+512alpha && n = t8 && over1 = 1 && t5 = 1 && t9 = 0 && t11 = 0 && t13 = 0 && t1 = 0 && t7 = 4 && t3 = 0 && 1, t12-511 <= t2 <= t12 <= t8 <= t4+127 && 1, t10-7 <= t6 <= t10 <= t8 && 0 <= over2 <= 1 && t4 <= t8) }; +s5:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta,tau : 2tau = 1+t10 && 2alpha = 1+t8 && t2 = 1+512beta && t4 = 1+128gamma && t6 = 1+8delta && t1 = 0 && t3 = 0 && t5 = 1 && t7 = 2 && t9 = 1 && t11 = 0 && t13 = 1 && 1, t12-511 <= t2 <= t12 <= n && 1, t10-6 <= t6 <= t10 && 1, t8-126 <= t4 <= t8 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && over2+t10 <= n && over1+t8 <= n) }; +s6:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9] : exists ( alpha,beta,gamma,delta : t6 = 1+8delta && 2alpha = 1+t8 && t2 = 1+512beta && t4 = 1+128gamma && 1+t9 = 0 && t7 = 2 && t1 = 0 && t3 = 0 && t5 = 1 && 1, t8-126 <= t4 <= t8 && 0 <= over1 <= 1 && 0 <= over2 <= 1 && 1 <= t2 <= n && 1 <= t6 <= n && over1+t8 <= n) }; +s7:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta : t6 = 1+8beta && 2alpha = t8+t4 && t2 = 1+512delta && 1+128gamma = t4 && t10 = n && over2 = 1 && t5 = 1 && t7 = 2 && t11 = 0 && t13 = 0 && t1 = 0 && t9 = 2 && t3 = 0 && 1, t12-511 <= t2 <= t12 <= n <= t6+7 && 1, t8-126 <= t4 <= t8 && 0 <= over1 <= 1 && t6 <= n && over1+t8 <= n) }; +s8:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta : t6 = 1+8beta && 2alpha = t8+t4 && t2 = 1+512delta && 1+128gamma = t4 && t10 = n && over2 = 1 && t5 = 1 && t7 = 2 && t11 = 0 && t13 = 1 && t1 = 0 && t9 = 2 && t3 = 0 && 1, t12-511 <= t2 <= t12 <= n <= t6+7 && 1, t8-126 <= t4 <= t8 && 0 <= over1 <= 1 && t6 <= n && over1+t8 <= n) }; +s9:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta,tau : 2delta = 1+t10 && 2alpha = 1+t8 && t2 = 1+512beta && t4 = 1+128gamma && t6+8tau = 1 && t13 = 2 && t9 = 1 && t11 = 0 && t1 = 0 && t3 = 0 && t5 = 1 && t7 = 2 && 1, t12-511 <= t2 <= t12 <= n && 1, t10-6 <= t6 <= t10 && 1, t8-126 <= t4 <= t8 && 0 <= over1 <= 1 && 0 <= over2 <= 1 && over2+t10 <= n && over1+t8 <= n) }; + +codegen 1 s0,s1,s2,s3,s4,s5,s6,s7,s8,s9; + diff --git a/omegalib/examples/experiments/gemm/gemm.out b/omegalib/examples/experiments/gemm/gemm.out new file mode 100644 index 0000000..dfd0156 --- /dev/null +++ b/omegalib/examples/experiments/gemm/gemm.out @@ -0,0 +1,58 @@ +>>> symbolic n, over1, over2; +>>> s0:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta,tau : 2tau = 1+t10 && 2alpha = 1+t8 && t2 = 1+512beta && t4 = 1+128gamma && t6 = 1+8delta && t1 = 0 && t3 = 0 && t5 = 1 && t7 = 2 && t9 = 1 && t11 = 0 && t13 = 0 && 1, t12-511 <= t2 <= t12 <= n && 1, t10-6 <= t6 <= t10 && 1, t8-126 <= t4 <= t8 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && over2+t10 <= n && over1+t8 <= n) }; +>>> s1:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9] : exists ( alpha,beta : t4 = 1+128beta && t2 = 1+512alpha && t1 = 0 && t3 = 0 && t5 = 0 && t7 = 0 && t9 = 0 && 1, t8-127 <= t4 <= t8 <= n && 1, t2 <= t6 <= n, t2+511 && 0 <= over2 <= 1 && 0 <= over1 <= 1) }; +>>> s2:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11] : exists ( alpha,beta,gamma : t6 = 1+8gamma && t4 = 1+128alpha && t2 = 1+512beta && t5 = 1 && t9 = 0 && t11 = 0 && t1 = 0 && 1+t7 = 0 && t3 = 0 && 1, t10-511 <= t2 <= t10 <= n && 1, t8-7 <= t6 <= t8 <= n && 0 <= over2 <= 1 && 0 <= over1 <= 1 && 1 <= t4 <= n) }; +>>> s3:= { [t1,t2,t3,t4,t5,t6,t7] : exists ( alpha,beta,gamma : t6 = 1+8gamma && t4 = 1+128alpha && t2 = 1+512beta && t5 = 1 && t1 = 0 && t7 = 0 && t3 = 0 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && 1 <= t2 <= n && 1 <= t4 <= n && 1 <= t6 <= n) }; +>>> s4:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma : t6 = 1+8beta && t4 = 1+128gamma && t2 = 1+512alpha && n = t8 && over1 = 1 && t5 = 1 && t9 = 0 && t11 = 0 && t13 = 0 && t1 = 0 && t7 = 4 && t3 = 0 && 1, t12-511 <= t2 <= t12 <= t8 <= t4+127 && 1, t10-7 <= t6 <= t10 <= t8 && 0 <= over2 <= 1 && t4 <= t8) }; +>>> s5:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta,tau : 2tau = 1+t10 && 2alpha = 1+t8 && t2 = 1+512beta && t4 = 1+128gamma && t6 = 1+8delta && t1 = 0 && t3 = 0 && t5 = 1 && t7 = 2 && t9 = 1 && t11 = 0 && t13 = 1 && 1, t12-511 <= t2 <= t12 <= n && 1, t10-6 <= t6 <= t10 && 1, t8-126 <= t4 <= t8 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && over2+t10 <= n && over1+t8 <= n) }; +>>> s6:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9] : exists ( alpha,beta,gamma,delta : t6 = 1+8delta && 2alpha = 1+t8 && t2 = 1+512beta && t4 = 1+128gamma && 1+t9 = 0 && t7 = 2 && t1 = 0 && t3 = 0 && t5 = 1 && 1, t8-126 <= t4 <= t8 && 0 <= over1 <= 1 && 0 <= over2 <= 1 && 1 <= t2 <= n && 1 <= t6 <= n && over1+t8 <= n) }; +>>> s7:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta : t6 = 1+8beta && 2alpha = t8+t4 && t2 = 1+512delta && 1+128gamma = t4 && t10 = n && over2 = 1 && t5 = 1 && t7 = 2 && t11 = 0 && t13 = 0 && t1 = 0 && t9 = 2 && t3 = 0 && 1, t12-511 <= t2 <= t12 <= n <= t6+7 && 1, t8-126 <= t4 <= t8 && 0 <= over1 <= 1 && t6 <= n && over1+t8 <= n) }; +>>> s8:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta : t6 = 1+8beta && 2alpha = t8+t4 && t2 = 1+512delta && 1+128gamma = t4 && t10 = n && over2 = 1 && t5 = 1 && t7 = 2 && t11 = 0 && t13 = 1 && t1 = 0 && t9 = 2 && t3 = 0 && 1, t12-511 <= t2 <= t12 <= n <= t6+7 && 1, t8-126 <= t4 <= t8 && 0 <= over1 <= 1 && t6 <= n && over1+t8 <= n) }; +>>> s9:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta,tau : 2delta = 1+t10 && 2alpha = 1+t8 && t2 = 1+512beta && t4 = 1+128gamma && t6+8tau = 1 && t13 = 2 && t9 = 1 && t11 = 0 && t1 = 0 && t3 = 0 && t5 = 1 && t7 = 2 && 1, t12-511 <= t2 <= t12 <= n && 1, t10-6 <= t6 <= t10 && 1, t8-126 <= t4 <= t8 && 0 <= over1 <= 1 && 0 <= over2 <= 1 && over2+t10 <= n && over1+t8 <= n) }; +>>> +>>> codegen 1 s0,s1,s2,s3,s4,s5,s6,s7,s8,s9; +if (over1 >= 0 && over2 >= 0 && over2 <= 1 && over1 <= 1) { + for(t2 = 1; t2 <= n; t2 += 512) { + for(t4 = 1; t4 <= n; t4 += 128) { + for(t6 = t2; t6 <= min(n,t2+511); t6++) { + for(t8 = t4; t8 <= min(t4+127,n); t8++) { + s1(0,t2,0,t4,0,t6,0,t8,0); + } + } + for(t6 = 1; t6 <= n; t6 += 8) { + for(t8 = t6; t8 <= min(n,t6+7); t8++) { + for(t10 = t2; t10 <= min(t2+511,n); t10++) { + s2(0,t2,0,t4,1,t6,-1,t8,0,t10,0); + } + } + s3(0,t2,0,t4,1,t6,0); + for(t8 = t4; t8 <= min(-over1+n,t4+126); t8 += 2) { + s6(0,t2,0,t4,1,t6,2,t8,-1); + for(t10 = t6; t10 <= min(t6+6,-over2+n); t10 += 2) { + for(t12 = t2; t12 <= min(n,t2+511); t12++) { + s0(0,t2,0,t4,1,t6,2,t8,1,t10,0,t12,0); + s5(0,t2,0,t4,1,t6,2,t8,1,t10,0,t12,1); + s9(0,t2,0,t4,1,t6,2,t8,1,t10,0,t12,2); + } + } + if (over2 >= 1 && t6 >= n-7) { + for(t12 = t2; t12 <= min(n,t2+511); t12++) { + s7(0,t2,0,t4,1,t6,2,t8,2,n,0,t12,0); + s8(0,t2,0,t4,1,t6,2,t8,2,n,0,t12,1); + } + } + } + if (t4 >= n-127 && over1 >= 1) { + for(t10 = t6; t10 <= min(n,t6+7); t10++) { + for(t12 = t2; t12 <= min(n,t2+511); t12++) { + s4(0,t2,0,t4,1,t6,4,n,0,t10,0,t12,0); + } + } + } + } + } + } +} + +>>> +>>> diff --git a/omegalib/examples/experiments/gemv/codegen.input b/omegalib/examples/experiments/gemv/codegen.input new file mode 100755 index 0000000..4152560 --- /dev/null +++ b/omegalib/examples/experiments/gemv/codegen.input @@ -0,0 +1,14 @@ +symbolic n, over1, over2; + +s0:= { [t1,t2,t3,t4,t5] : exists ( alpha,beta : t2 = 1+4beta && t4 = 1+4alpha && t1 = 1 && t3 = 1 && t5 = 0 && 0 <= over2 <= 3 && 0 <= over1 <= 3 && 1 <= t4 && 1 <= t2 && over1+t2 <= n && over2+t4 <= n) }; +s1:= { [t1] : 1+t1 = 0 && 0 <= over2 <= 3 && 0 <= over1 <= 3 && 1 <= n }; +s2:= { [t1,t2,t3,t4,t5] : t1 = 2 && t3 = 0 && t5 = 0 && 1 <= t2 <= n && 1 <= t4 <= n && 0 <= over2 <= 3 && over1 <= 3 && n < over1+t2 }; +s3:= { [t1,t2,t3,t4,t5] : exists ( alpha,beta : t2 = 1+4beta && t4 = 1+4alpha && t1 = 1 && t3 = 1 && t5 = 1 && 0 <= over2 <= 3 && 0 <= over1 <= 3 && 1 <= t4 && 1 <= t2 && over1+t2 <= n && over2+t4 <= n) }; +s4:= { [t1,t2,t3] : exists ( alpha : t2 = 1+4alpha && 1+t3 = 0 && t1 = 1 && 0 <= over1 <= 3 && 0 <= over2 <= 3 && over1+t2 <= n && 1 <= t2) }; +s5:= { [t1,t2,t3,t4,t5] : exists ( alpha : t2 = 1+4alpha && t5 = 0 && t1 = 1 && t3 = 2 && 0 <= over1 <= 3 && 1 <= t4 <= n && over2 <= 3 && 1 <= t2 && over1+t2 <= n && n < over2+t4) }; +s6:= { [t1,t2,t3,t4,t5] : exists ( alpha : t2 = 1+4alpha && t5 = 1 && t1 = 1 && t3 = 2 && 0 <= over1 <= 3 && 1 <= t4 <= n && over2 <= 3 && 1 <= t2 && over1+t2 <= n && n < over2+t4) }; +s7:= { [t1,t2,t3,t4,t5] : exists ( alpha,beta : t2 = 1+4beta && t4 = 1+4alpha && t5 = 2 && t1 = 1 && t3 = 1 && 0 <= over1 <= 3 && 0 <= over2 <= 3 && 1 <= t4 && 1 <= t2 && over1+t2 <= n && over2+t4 <= n) }; + +codegen s0,s1,s2,s3,s4,s5,s6,s7; + + diff --git a/omegalib/examples/experiments/gemv/gemv.out b/omegalib/examples/experiments/gemv/gemv.out new file mode 100644 index 0000000..b9dd445 --- /dev/null +++ b/omegalib/examples/experiments/gemv/gemv.out @@ -0,0 +1,40 @@ +>>> symbolic n, over1, over2; +>>> +>>> s0:= { [t1,t2,t3,t4,t5] : exists ( alpha,beta : t2 = 1+4beta && t4 = 1+4alpha && t1 = 1 && t3 = 1 && t5 = 0 && 0 <= over2 <= 3 && 0 <= over1 <= 3 && 1 <= t4 && 1 <= t2 && over1+t2 <= n && over2+t4 <= n) }; +>>> s1:= { [t1] : 1+t1 = 0 && 0 <= over2 <= 3 && 0 <= over1 <= 3 && 1 <= n }; +>>> s2:= { [t1,t2,t3,t4,t5] : t1 = 2 && t3 = 0 && t5 = 0 && 1 <= t2 <= n && 1 <= t4 <= n && 0 <= over2 <= 3 && over1 <= 3 && n < over1+t2 }; +>>> s3:= { [t1,t2,t3,t4,t5] : exists ( alpha,beta : t2 = 1+4beta && t4 = 1+4alpha && t1 = 1 && t3 = 1 && t5 = 1 && 0 <= over2 <= 3 && 0 <= over1 <= 3 && 1 <= t4 && 1 <= t2 && over1+t2 <= n && over2+t4 <= n) }; +>>> s4:= { [t1,t2,t3] : exists ( alpha : t2 = 1+4alpha && 1+t3 = 0 && t1 = 1 && 0 <= over1 <= 3 && 0 <= over2 <= 3 && over1+t2 <= n && 1 <= t2) }; +>>> s5:= { [t1,t2,t3,t4,t5] : exists ( alpha : t2 = 1+4alpha && t5 = 0 && t1 = 1 && t3 = 2 && 0 <= over1 <= 3 && 1 <= t4 <= n && over2 <= 3 && 1 <= t2 && over1+t2 <= n && n < over2+t4) }; +>>> s6:= { [t1,t2,t3,t4,t5] : exists ( alpha : t2 = 1+4alpha && t5 = 1 && t1 = 1 && t3 = 2 && 0 <= over1 <= 3 && 1 <= t4 <= n && over2 <= 3 && 1 <= t2 && over1+t2 <= n && n < over2+t4) }; +>>> s7:= { [t1,t2,t3,t4,t5] : exists ( alpha,beta : t2 = 1+4beta && t4 = 1+4alpha && t5 = 2 && t1 = 1 && t3 = 1 && 0 <= over1 <= 3 && 0 <= over2 <= 3 && 1 <= t4 && 1 <= t2 && over1+t2 <= n && over2+t4 <= n) }; +>>> +>>> codegen s0,s1,s2,s3,s4,s5,s6,s7; +if (over2 >= 0 && over1 <= 3 && over2 <= 3) { + if (over1 >= 0) { + if (n >= 1) { + s1(-1); + } + for(t2 = 1; t2 <= n-over1; t2 += 4) { + s4(1,t2,-1); + for(t4 = 1; t4 <= n-over2; t4 += 4) { + s0(1,t2,1,t4,0); + s3(1,t2,1,t4,1); + s7(1,t2,1,t4,2); + } + for(t4 = max(1,n-over2+1); t4 <= n; t4++) { + s5(1,t2,2,t4,0); + s6(1,t2,2,t4,1); + } + } + } + for(t2 = max(1,n-over1+1); t2 <= n; t2++) { + for(t4 = 1; t4 <= n; t4++) { + s2(2,t2,0,t4,0); + } + } +} + +>>> +>>> +>>> diff --git a/omegalib/examples/experiments/lu/codegen.input b/omegalib/examples/experiments/lu/codegen.input new file mode 100755 index 0000000..0505f2d --- /dev/null +++ b/omegalib/examples/experiments/lu/codegen.input @@ -0,0 +1,33 @@ +symbolic n, over1, over2, over3; + +s0:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : 1=2 }; +s1:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2sigma = t12 && t2 = 1+t6+256alpha && 2beta = 1+t10 && t4 = 1+256gamma && t6 = 1+64delta && t8 = 2+8tau && t15 = 1 && t9 = 2 && t11 = 1 && t13 = 0 && t1 = 0 && t3 = 0 && t5 = 0 && t7 = 1 && t12-62, t14+2 <= t2 <= t8 <= t12 <= t8+6 && t2-1, t10-254 <= t6 <= t10 && 1, t14-255 <= t4 <= t14 && 0 <= over2 <= 1 && 0 <= over3 <= 1 && 0 <= over1 <= 1 && over3+t12 <= n && over2+t10 <= n) }; +s2:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9] : exists ( alpha : t2 = 2+64alpha && 1+t4 = t6 && t7 = 0 && t9 = 0 && t1 = 0 && t3 = 2 && t5 = 0 && 2, t6-63 <= t2 <= t6 <= t8 <= n && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1) }; +s3:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9] : exists ( alpha : t2 = 2+64alpha && t5 = 1 && t7 = 0 && t9 = 0 && t1 = 0 && t3 = 2 && t2-1 <= t4 < t6 <= t2+63, n && t4 < t8 <= n && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && 2 <= t2) }; +s4:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2tau = t12 && 2alpha = t10 && t6 = 1+256beta && t2 = 2+64gamma && t4 = 2+256delta && t8+8sigma = 2 && t1 = 0 && 1+t3 = 0 && 1+t5 = 0 && t7 = 0 && t9 = 0 && t11 = 1 && t13 = 0 && t15 = 0 && 1, t14-255 <= t6 <= t14 < t4 <= t10 <= t4+254, t2-4 && t2, t12-6 <= t8 <= t12 <= t2+62 && 0 <= over1 <= 1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && over1+t12 <= n) }; +s5:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11] : exists ( alpha,beta : t2 = 2+64beta && t4 = 2+256alpha && 1+t3 = 0 && t7 = 0 && t9 = 0 && t11 = 1 && t1 = 0 && t5 = 1 && 2, t6-255 <= t4 <= t10 < t6 <= t2-2 && t8-63 <= t2 <= t8 <= n && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1) }; +s6:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11] : exists ( alpha,beta,gamma : t4 = 2+256gamma && t6 = 1+256alpha && t2 = 2+64beta && t1 = 0 && 1+t3 = 0 && 1+t5 = 0 && 1+t7 = 0 && t9 = 0 && t11 = 0 && 1, t8-255 <= t6 <= t8 < t4 <= t10 <= t2-2, t4+255 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && t2 <= n) }; +s7:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta : t8 = 2+8delta && t4 = 2+256alpha && t6 = 1+256beta && t2 = 2+64gamma && 1+t5 = 0 && t7 = 0 && t11 = 0 && t13 = 0 && t1 = 0 && 2+t9 = 0 && 1+t3 = 0 && t4+64, t10-63 <= t2 <= t8 <= t10 <= t8+7, n && 1, t12-255 <= t6 <= t12 <= t4-1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1) }; +s8:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta : t8 = 2+8delta && t4 = 2+256alpha && t6 = 1+256beta && 2+t10 = t2 && t2 = 2+64gamma && t7 = 0 && t11 = 0 && t13 = 0 && t15 = 1 && t1 = 0 && t9 = 1 && 1+t3 = 0 && 1+t5 = 0 && t4+64, t12-63 <= t2 <= t8 <= t12 <= t8+7, n && 1, t14-255 <= t6 <= t14 <= t4-1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && t2 <= t4+256) }; +s9:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2sigma = t12 && 2alpha = t10 && t6 = 1+256beta && t2 = 2+64gamma && t4 = 2+256delta && t8 = 2+8tau && t1 = 0 && 1+t3 = 0 && 1+t5 = 0 && t7 = 0 && t9 = 0 && t11 = 1 && t13 = 0 && t15 = 1 && 1, t14-255 <= t6 <= t14 < t4 <= t10 <= t4+254, t2-4 && t2, t12-6 <= t8 <= t12 && 0 <= over1 <= 1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && t8 <= t2+56 && over1+t12 <= n) }; +s10:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11] : exists ( alpha,beta,gamma,delta,tau : t8 = 2+8tau && 2alpha = t10 && t6 = 1+256beta && t2 = 2+64gamma && t4 = 2+256delta && t7 = 0 && t9 = 0 && t1 = 0 && 1+t11 = 0 && 1+t3 = 0 && 1+t5 = 0 && t6+1, t10-254 <= t4 <= t10 <= t2-4 && t8-56 <= t2 <= t8 <= n && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && 1 <= t6) }; +s11:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau : t8 = 2+8beta && 2gamma = t10 && t6 = 1+256delta && t2 = 2+64tau && t4 = 2+256alpha && n = t12 && over1 = 1 && t7 = 0 && t9 = 0 && t13 = 0 && t15 = 0 && t1 = 0 && t11 = 2 && 1+t3 = 0 && 1+t5 = 0 && 1, t14-255 <= t6 <= t14 < t4 <= t10 <= t2-4, t4+254 && t12-63 <= t2 <= t8 <= t12 <= t8+7 && 0 <= over2 <= 1 && 0 <= over3 <= 1) }; +s12:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau : t8 = 2+8beta && 2gamma = t10 && t6 = 1+256delta && t2 = 2+64tau && t4 = 2+256alpha && n = t12 && over1 = 1 && t7 = 0 && t9 = 0 && t13 = 0 && t15 = 1 && t1 = 0 && t11 = 2 && 1+t3 = 0 && 1+t5 = 0 && 1, t14-255 <= t6 <= t14 < t4 <= t10 <= t4+254, t2-4 && t8-56 <= t2 <= t8 <= t12 <= t8+7 && 0 <= over2 <= 1 && 0 <= over3 <= 1) }; +s13:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2sigma = t12 && 2alpha = t10 && t6 = 1+256beta && t2 = 2+64gamma && t4 = 2+256delta && t8 = 2+8tau && t7 = 0 && t9 = 0 && t11 = 1 && t13 = 0 && t1 = 0 && t15 = 2 && 1+t3 = 0 && 1+t5 = 0 && 1, t14-255 <= t6 <= t14 < t4 <= t10 <= t4+254, t2-4 && t2, t12-6 <= t8 <= t12 <= t2+62 && 0 <= over1 <= 1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && over1+t12 <= n) }; +s14:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9] : exists ( alpha,beta : t2 = 2+64beta && t4 = 2+256alpha && t1 = 0 && 1+t3 = 0 && t5 = 0 && t7 = 0 && t9 = 0 && 2, t8-255 <= t4 <= t6 < t8 <= t2-2 && 0 <= over1 <= 1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && t2 <= n) }; +s15:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11] : exists ( alpha,beta,gamma : t2 = 1+t6+256gamma && t6 = 1+64alpha && t4 = 1+256beta && t1 = 0 && t3 = 0 && t5 = 0 && t7 = 0 && t9 = 0 && t11 = 0 && 1, t8-255 <= t4 <= t8 <= t2-2 && t2-1, t10-255 <= t6 <= t10 <= n && 0 <= over1 <= 1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && t2 <= n) }; +s16:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta : t8 = 2+8delta && t2 = 1+t6+256alpha && t6 = 1+64beta && t4 = 1+256gamma && t5 = 0 && t7 = 1 && t11 = 0 && t13 = 0 && t1 = 0 && 1+t9 = 0 && t3 = 0 && t12+2, t10-63 <= t2 <= t8 <= t10 <= t8+7, n && 1, t12-255 <= t4 <= t12 && 0 <= over1 <= 1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && t2-1 <= t6 <= n) }; +s17:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9] : exists ( alpha,beta,gamma,delta : t8 = 2+8delta && t2 = 1+t6+256alpha && t6 = 1+64beta && t4 = 1+256gamma && t5 = 0 && t7 = 1 && t1 = 0 && t9 = 0 && t3 = 0 && t8-56, t4+65 <= t2 <= t8 <= n && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && t2-1 <= t6 <= n && 1 <= t4) }; +s18:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta : t8 = 2+8beta && t2 = 1+t6+256gamma && t6 = 1+64delta && t4 = 1+256alpha && n = t10 && over2 = 1 && t5 = 0 && t7 = 1 && t11 = 0 && t13 = 0 && t15 = 1 && t1 = 0 && t9 = 3 && t3 = 0 && t14+2, t12-63 <= t2 <= t8 <= t12 <= t8+7, t10 && 1, t14-255 <= t4 <= t14 && t10-255 <= t6 <= t10 && 0 <= over1 <= 1 && 0 <= over3 <= 1) }; +s19:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : 1=2 }; +s20:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2sigma = t12 && t2 = 1+t6+256alpha && 2beta = 1+t10 && t4 = 1+256gamma && t6 = 1+64delta && t8 = 2+8tau && t15 = 3 && t9 = 2 && t11 = 1 && t13 = 0 && t1 = 0 && t3 = 0 && t5 = 0 && t7 = 1 && 1, t14-255 <= t4 <= t14 <= t2-2 && t2, t12-6 <= t8 <= t12 && t2-1, t10-254 <= t6 <= t10 && 0 <= over2 <= 1 && 0 <= over3 <= 1 && 0 <= over1 <= 1 && t8 <= t2+56 && over2+t10 <= n && over3+t12 <= n) }; +s21:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11] : exists ( alpha,beta,gamma,delta,tau : t8 = 2+8tau && t2 = 1+t6+256alpha && t6 = 1+64beta && t4 = 1+256gamma && 2delta = t10+t6 && 1+t11 = 0 && t7 = 1 && t9 = 2 && t1 = 0 && t3 = 0 && t5 = 0 && t8-56, t4+65 <= t2 <= t8 <= n && t2-1, t10-254 <= t6 <= t10 && 0 <= over2 <= 1 && 0 <= over3 <= 1 && 0 <= over1 <= 1 && 1 <= t4 && over2+t10 <= n) }; +s22:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta : t8 = 2+8beta && 2delta = 1+t10 && t4 = 1+256alpha && t2 = 1+t6 && n = t12 && t6 = 1+64gamma && over3 = 1 && t7 = 1 && t9 = 2 && t13 = 0 && t15 = 1 && t1 = 0 && t11 = 3 && t3 = 0 && t5 = 0 && 1, t14-255 <= t4 <= t14 < t6 < t8 <= t12 <= t8+7, t6+64 && 0 <= over1 <= 1 && 0 <= over2 <= 1 && t6 <= t10 && over2+t10 <= t12) }; +s23:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta : t8 = 2+8beta && 2delta = 1+t10 && t4 = 1+256alpha && t2 = 1+t6 && t12 = n && t6 = 1+64gamma && over3 = 1 && t7 = 1 && t9 = 2 && t13 = 0 && t15 = 3 && t1 = 0 && t11 = 3 && t3 = 0 && t5 = 0 && 1, t14-255 <= t4 <= t14 < t6 < t8 <= n <= t8+7 && 0 <= over1 <= 1 && 0 <= over2 <= 1 && t8-57 <= t6 <= t10 && over2+t10 <= n) }; +s24:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : 1=2 }; +s25:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2sigma = t12 && t2 = 1+t6+256alpha && 2beta = 1+t10 && t4 = 1+256gamma && t6 = 1+64delta && t8 = 2+8tau && t15 = 5 && t9 = 2 && t11 = 1 && t13 = 0 && t1 = 0 && t3 = 0 && t5 = 0 && t7 = 1 && t12-62, t14+2 <= t2 <= t8 <= t12 <= t8+6 && t2-1, t10-254 <= t6 <= t10 && 1, t14-255 <= t4 <= t14 && 0 <= over2 <= 1 && 0 <= over3 <= 1 && 0 <= over1 <= 1 && over2+t10 <= n && over3+t12 <= n) }; +s26:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : 1=2 }; +s27:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2sigma = t12 && t2 = 1+t6+256alpha && 2beta = 1+t10 && t4 = 1+256gamma && t6 = 1+64delta && t8 = 2+8tau && t15 = 7 && t9 = 2 && t11 = 1 && t13 = 0 && t1 = 0 && t3 = 0 && t5 = 0 && t7 = 1 && 1, t14-255 <= t4 <= t14 <= t2-2 && t12-6, t2 <= t8 <= t12 && t2-1, t10-254 <= t6 <= t10 && 0 <= over2 <= 1 && 0 <= over3 <= 1 && 0 <= over1 <= 1 && t8 <= t2+56 && over2+t10 <= n && over3+t12 <= n) }; + +codegen 1 s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20,s21,s22,s23,s24,s25,s26,s27; + diff --git a/omegalib/examples/experiments/lu/lu.out b/omegalib/examples/experiments/lu/lu.out new file mode 100644 index 0000000..443a4db --- /dev/null +++ b/omegalib/examples/experiments/lu/lu.out @@ -0,0 +1,141 @@ +>>> symbolic n, over1, over2, over3; +>>> +>>> s0:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : 1=2 }; +>>> s1:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2sigma = t12 && t2 = 1+t6+256alpha && 2beta = 1+t10 && t4 = 1+256gamma && t6 = 1+64delta && t8 = 2+8tau && t15 = 1 && t9 = 2 && t11 = 1 && t13 = 0 && t1 = 0 && t3 = 0 && t5 = 0 && t7 = 1 && t12-62, t14+2 <= t2 <= t8 <= t12 <= t8+6 && t2-1, t10-254 <= t6 <= t10 && 1, t14-255 <= t4 <= t14 && 0 <= over2 <= 1 && 0 <= over3 <= 1 && 0 <= over1 <= 1 && over3+t12 <= n && over2+t10 <= n) }; +>>> s2:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9] : exists ( alpha : t2 = 2+64alpha && 1+t4 = t6 && t7 = 0 && t9 = 0 && t1 = 0 && t3 = 2 && t5 = 0 && 2, t6-63 <= t2 <= t6 <= t8 <= n && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1) }; +>>> s3:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9] : exists ( alpha : t2 = 2+64alpha && t5 = 1 && t7 = 0 && t9 = 0 && t1 = 0 && t3 = 2 && t2-1 <= t4 < t6 <= t2+63, n && t4 < t8 <= n && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && 2 <= t2) }; +>>> s4:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2tau = t12 && 2alpha = t10 && t6 = 1+256beta && t2 = 2+64gamma && t4 = 2+256delta && t8+8sigma = 2 && t1 = 0 && 1+t3 = 0 && 1+t5 = 0 && t7 = 0 && t9 = 0 && t11 = 1 && t13 = 0 && t15 = 0 && 1, t14-255 <= t6 <= t14 < t4 <= t10 <= t4+254, t2-4 && t2, t12-6 <= t8 <= t12 <= t2+62 && 0 <= over1 <= 1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && over1+t12 <= n) }; +>>> s5:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11] : exists ( alpha,beta : t2 = 2+64beta && t4 = 2+256alpha && 1+t3 = 0 && t7 = 0 && t9 = 0 && t11 = 1 && t1 = 0 && t5 = 1 && 2, t6-255 <= t4 <= t10 < t6 <= t2-2 && t8-63 <= t2 <= t8 <= n && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1) }; +>>> s6:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11] : exists ( alpha,beta,gamma : t4 = 2+256gamma && t6 = 1+256alpha && t2 = 2+64beta && t1 = 0 && 1+t3 = 0 && 1+t5 = 0 && 1+t7 = 0 && t9 = 0 && t11 = 0 && 1, t8-255 <= t6 <= t8 < t4 <= t10 <= t2-2, t4+255 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && t2 <= n) }; +>>> s7:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta : t8 = 2+8delta && t4 = 2+256alpha && t6 = 1+256beta && t2 = 2+64gamma && 1+t5 = 0 && t7 = 0 && t11 = 0 && t13 = 0 && t1 = 0 && 2+t9 = 0 && 1+t3 = 0 && t4+64, t10-63 <= t2 <= t8 <= t10 <= t8+7, n && 1, t12-255 <= t6 <= t12 <= t4-1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1) }; +>>> s8:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta : t8 = 2+8delta && t4 = 2+256alpha && t6 = 1+256beta && 2+t10 = t2 && t2 = 2+64gamma && t7 = 0 && t11 = 0 && t13 = 0 && t15 = 1 && t1 = 0 && t9 = 1 && 1+t3 = 0 && 1+t5 = 0 && t4+64, t12-63 <= t2 <= t8 <= t12 <= t8+7, n && 1, t14-255 <= t6 <= t14 <= t4-1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && t2 <= t4+256) }; +>>> s9:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2sigma = t12 && 2alpha = t10 && t6 = 1+256beta && t2 = 2+64gamma && t4 = 2+256delta && t8 = 2+8tau && t1 = 0 && 1+t3 = 0 && 1+t5 = 0 && t7 = 0 && t9 = 0 && t11 = 1 && t13 = 0 && t15 = 1 && 1, t14-255 <= t6 <= t14 < t4 <= t10 <= t4+254, t2-4 && t2, t12-6 <= t8 <= t12 && 0 <= over1 <= 1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && t8 <= t2+56 && over1+t12 <= n) }; +>>> s10:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11] : exists ( alpha,beta,gamma,delta,tau : t8 = 2+8tau && 2alpha = t10 && t6 = 1+256beta && t2 = 2+64gamma && t4 = 2+256delta && t7 = 0 && t9 = 0 && t1 = 0 && 1+t11 = 0 && 1+t3 = 0 && 1+t5 = 0 && t6+1, t10-254 <= t4 <= t10 <= t2-4 && t8-56 <= t2 <= t8 <= n && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && 1 <= t6) }; +>>> s11:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau : t8 = 2+8beta && 2gamma = t10 && t6 = 1+256delta && t2 = 2+64tau && t4 = 2+256alpha && n = t12 && over1 = 1 && t7 = 0 && t9 = 0 && t13 = 0 && t15 = 0 && t1 = 0 && t11 = 2 && 1+t3 = 0 && 1+t5 = 0 && 1, t14-255 <= t6 <= t14 < t4 <= t10 <= t2-4, t4+254 && t12-63 <= t2 <= t8 <= t12 <= t8+7 && 0 <= over2 <= 1 && 0 <= over3 <= 1) }; +>>> s12:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau : t8 = 2+8beta && 2gamma = t10 && t6 = 1+256delta && t2 = 2+64tau && t4 = 2+256alpha && n = t12 && over1 = 1 && t7 = 0 && t9 = 0 && t13 = 0 && t15 = 1 && t1 = 0 && t11 = 2 && 1+t3 = 0 && 1+t5 = 0 && 1, t14-255 <= t6 <= t14 < t4 <= t10 <= t4+254, t2-4 && t8-56 <= t2 <= t8 <= t12 <= t8+7 && 0 <= over2 <= 1 && 0 <= over3 <= 1) }; +>>> s13:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2sigma = t12 && 2alpha = t10 && t6 = 1+256beta && t2 = 2+64gamma && t4 = 2+256delta && t8 = 2+8tau && t7 = 0 && t9 = 0 && t11 = 1 && t13 = 0 && t1 = 0 && t15 = 2 && 1+t3 = 0 && 1+t5 = 0 && 1, t14-255 <= t6 <= t14 < t4 <= t10 <= t4+254, t2-4 && t2, t12-6 <= t8 <= t12 <= t2+62 && 0 <= over1 <= 1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && over1+t12 <= n) }; +>>> s14:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9] : exists ( alpha,beta : t2 = 2+64beta && t4 = 2+256alpha && t1 = 0 && 1+t3 = 0 && t5 = 0 && t7 = 0 && t9 = 0 && 2, t8-255 <= t4 <= t6 < t8 <= t2-2 && 0 <= over1 <= 1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && t2 <= n) }; +>>> s15:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11] : exists ( alpha,beta,gamma : t2 = 1+t6+256gamma && t6 = 1+64alpha && t4 = 1+256beta && t1 = 0 && t3 = 0 && t5 = 0 && t7 = 0 && t9 = 0 && t11 = 0 && 1, t8-255 <= t4 <= t8 <= t2-2 && t2-1, t10-255 <= t6 <= t10 <= n && 0 <= over1 <= 1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && t2 <= n) }; +>>> s16:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13] : exists ( alpha,beta,gamma,delta : t8 = 2+8delta && t2 = 1+t6+256alpha && t6 = 1+64beta && t4 = 1+256gamma && t5 = 0 && t7 = 1 && t11 = 0 && t13 = 0 && t1 = 0 && 1+t9 = 0 && t3 = 0 && t12+2, t10-63 <= t2 <= t8 <= t10 <= t8+7, n && 1, t12-255 <= t4 <= t12 && 0 <= over1 <= 1 && 0 <= over3 <= 1 && 0 <= over2 <= 1 && t2-1 <= t6 <= n) }; +>>> s17:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9] : exists ( alpha,beta,gamma,delta : t8 = 2+8delta && t2 = 1+t6+256alpha && t6 = 1+64beta && t4 = 1+256gamma && t5 = 0 && t7 = 1 && t1 = 0 && t9 = 0 && t3 = 0 && t8-56, t4+65 <= t2 <= t8 <= n && 0 <= over3 <= 1 && 0 <= over2 <= 1 && 0 <= over1 <= 1 && t2-1 <= t6 <= n && 1 <= t4) }; +>>> s18:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta : t8 = 2+8beta && t2 = 1+t6+256gamma && t6 = 1+64delta && t4 = 1+256alpha && n = t10 && over2 = 1 && t5 = 0 && t7 = 1 && t11 = 0 && t13 = 0 && t15 = 1 && t1 = 0 && t9 = 3 && t3 = 0 && t14+2, t12-63 <= t2 <= t8 <= t12 <= t8+7, t10 && 1, t14-255 <= t4 <= t14 && t10-255 <= t6 <= t10 && 0 <= over1 <= 1 && 0 <= over3 <= 1) }; +>>> s19:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : 1=2 }; +>>> s20:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2sigma = t12 && t2 = 1+t6+256alpha && 2beta = 1+t10 && t4 = 1+256gamma && t6 = 1+64delta && t8 = 2+8tau && t15 = 3 && t9 = 2 && t11 = 1 && t13 = 0 && t1 = 0 && t3 = 0 && t5 = 0 && t7 = 1 && 1, t14-255 <= t4 <= t14 <= t2-2 && t2, t12-6 <= t8 <= t12 && t2-1, t10-254 <= t6 <= t10 && 0 <= over2 <= 1 && 0 <= over3 <= 1 && 0 <= over1 <= 1 && t8 <= t2+56 && over2+t10 <= n && over3+t12 <= n) }; +>>> s21:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11] : exists ( alpha,beta,gamma,delta,tau : t8 = 2+8tau && t2 = 1+t6+256alpha && t6 = 1+64beta && t4 = 1+256gamma && 2delta = t10+t6 && 1+t11 = 0 && t7 = 1 && t9 = 2 && t1 = 0 && t3 = 0 && t5 = 0 && t8-56, t4+65 <= t2 <= t8 <= n && t2-1, t10-254 <= t6 <= t10 && 0 <= over2 <= 1 && 0 <= over3 <= 1 && 0 <= over1 <= 1 && 1 <= t4 && over2+t10 <= n) }; +>>> s22:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta : t8 = 2+8beta && 2delta = 1+t10 && t4 = 1+256alpha && t2 = 1+t6 && n = t12 && t6 = 1+64gamma && over3 = 1 && t7 = 1 && t9 = 2 && t13 = 0 && t15 = 1 && t1 = 0 && t11 = 3 && t3 = 0 && t5 = 0 && 1, t14-255 <= t4 <= t14 < t6 < t8 <= t12 <= t8+7, t6+64 && 0 <= over1 <= 1 && 0 <= over2 <= 1 && t6 <= t10 && over2+t10 <= t12) }; +>>> s23:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta : t8 = 2+8beta && 2delta = 1+t10 && t4 = 1+256alpha && t2 = 1+t6 && t12 = n && t6 = 1+64gamma && over3 = 1 && t7 = 1 && t9 = 2 && t13 = 0 && t15 = 3 && t1 = 0 && t11 = 3 && t3 = 0 && t5 = 0 && 1, t14-255 <= t4 <= t14 < t6 < t8 <= n <= t8+7 && 0 <= over1 <= 1 && 0 <= over2 <= 1 && t8-57 <= t6 <= t10 && over2+t10 <= n) }; +>>> s24:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : 1=2 }; +>>> s25:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2sigma = t12 && t2 = 1+t6+256alpha && 2beta = 1+t10 && t4 = 1+256gamma && t6 = 1+64delta && t8 = 2+8tau && t15 = 5 && t9 = 2 && t11 = 1 && t13 = 0 && t1 = 0 && t3 = 0 && t5 = 0 && t7 = 1 && t12-62, t14+2 <= t2 <= t8 <= t12 <= t8+6 && t2-1, t10-254 <= t6 <= t10 && 1, t14-255 <= t4 <= t14 && 0 <= over2 <= 1 && 0 <= over3 <= 1 && 0 <= over1 <= 1 && over2+t10 <= n && over3+t12 <= n) }; +>>> s26:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : 1=2 }; +>>> s27:= { [t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15] : exists ( alpha,beta,gamma,delta,tau,sigma : 2sigma = t12 && t2 = 1+t6+256alpha && 2beta = 1+t10 && t4 = 1+256gamma && t6 = 1+64delta && t8 = 2+8tau && t15 = 7 && t9 = 2 && t11 = 1 && t13 = 0 && t1 = 0 && t3 = 0 && t5 = 0 && t7 = 1 && 1, t14-255 <= t4 <= t14 <= t2-2 && t12-6, t2 <= t8 <= t12 && t2-1, t10-254 <= t6 <= t10 && 0 <= over2 <= 1 && 0 <= over3 <= 1 && 0 <= over1 <= 1 && t8 <= t2+56 && over2+t10 <= n && over3+t12 <= n) }; +>>> +>>> codegen 1 s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20,s21,s22,s23,s24,s25,s26,s27; +if (over1 >= 0 && over1 <= 1 && over3 <= 1 && over3 >= 0 && over2 >= 0 && over2 <= 1) { + for(t2 = 2; t2 <= n; t2 += 64) { + for(t4 = 2; t4 <= t2-64; t4 += 256) { + for(t6 = 1; t6 <= t4-1; t6 += 256) { + for(t8 = t6; t8 <= min(t6+255,t4-1); t8++) { + for(t10 = t4; t10 <= min(t2-2,t4+255); t10++) { + s6(0,t2,-1,t4,-1,t6,-1,t8,0,t10,0); + } + } + for(t8 = t2; t8 <= min(n,t2+56); t8 += 8) { + for(t10 = t8; t10 <= min(t8+7,n); t10++) { + for(t12 = t6; t12 <= min(t6+255,t4-1); t12++) { + s7(0,t2,-1,t4,-1,t6,0,t8,-2,t10,0,t12,0); + } + } + for(t10 = t4; t10 <= min(t2-4,t4+254); t10 += 2) { + s10(0,t2,-1,t4,-1,t6,0,t8,0,t10,-1); + for(t12 = t8; t12 <= min(-over1+n,t8+6); t12 += 2) { + for(t14 = t6; t14 <= min(t4-1,t6+255); t14++) { + s4(0,t2,-1,t4,-1,t6,0,t8,0,t10,1,t12,0,t14,0); + s9(0,t2,-1,t4,-1,t6,0,t8,0,t10,1,t12,0,t14,1); + s13(0,t2,-1,t4,-1,t6,0,t8,0,t10,1,t12,0,t14,2); + } + } + if (t8 >= n-7 && over1 >= 1) { + for(t14 = t6; t14 <= min(t4-1,t6+255); t14++) { + s11(0,t2,-1,t4,-1,t6,0,t8,0,t10,2,n,0,t14,0); + s12(0,t2,-1,t4,-1,t6,0,t8,0,t10,2,n,0,t14,1); + } + } + } + if (t4 >= t2-256) { + for(t12 = t8; t12 <= min(t8+7,n); t12++) { + for(t14 = t6; t14 <= min(t6+255,t4-1); t14++) { + s8(0,t2,-1,t4,-1,t6,0,t8,1,t2-2,0,t12,0,t14,1); + } + } + } + } + } + for(t6 = t4; t6 <= min(t4+254,t2-3); t6++) { + for(t8 = t6+1; t8 <= min(t2-2,t4+255); t8++) { + s14(0,t2,-1,t4,0,t6,0,t8,0); + } + } + for(t6 = t4+1; t6 <= min(t2-2,t4+255); t6++) { + for(t8 = t2; t8 <= min(n,t2+63); t8++) { + for(t10 = t4; t10 <= t6-1; t10++) { + s5(0,t2,-1,t4,1,t6,0,t8,0,t10,1); + } + } + } + } + for(t4 = 1; t4 <= t2-65; t4 += 256) { + for(t6 = t2-1; t6 <= n; t6 += 256) { + for(t8 = t4; t8 <= min(t4+255,t2-2); t8++) { + for(t10 = t6; t10 <= min(n,t6+255); t10++) { + s15(0,t2,0,t4,0,t6,0,t8,0,t10,0); + } + } + for(t8 = t2; t8 <= min(t2+56,n); t8 += 8) { + for(t10 = t8; t10 <= min(n,t8+7); t10++) { + for(t12 = t4; t12 <= min(t4+255,t2-2); t12++) { + s16(0,t2,0,t4,0,t6,1,t8,-1,t10,0,t12,0); + } + } + s17(0,t2,0,t4,0,t6,1,t8,0); + for(t10 = t6; t10 <= min(n-over2,t6+254); t10 += 2) { + s21(0,t2,0,t4,0,t6,1,t8,2,t10,-1); + for(t12 = t8; t12 <= min(t8+6,n-over3); t12 += 2) { + for(t14 = t4; t14 <= min(t2-2,t4+255); t14++) { + s1(0,t2,0,t4,0,t6,1,t8,2,t10,1,t12,0,t14,1); + s20(0,t2,0,t4,0,t6,1,t8,2,t10,1,t12,0,t14,3); + s25(0,t2,0,t4,0,t6,1,t8,2,t10,1,t12,0,t14,5); + s27(0,t2,0,t4,0,t6,1,t8,2,t10,1,t12,0,t14,7); + } + } + if (over3 >= 1 && t8 >= n-7) { + for(t14 = t4; t14 <= min(t6-1,t4+255); t14++) { + s22(0,t2,0,t4,0,t6,1,t8,2,t10,3,n,0,t14,1); + s23(0,t2,0,t4,0,t6,1,t8,2,t10,3,n,0,t14,3); + } + } + } + if (t6 >= n-255 && over2 >= 1) { + for(t12 = t8; t12 <= min(t8+7,n); t12++) { + for(t14 = t4; t14 <= min(t2-2,t4+255); t14++) { + s18(0,t2,0,t4,0,t6,1,t8,3,n,0,t12,0,t14,1); + } + } + } + } + } + } + for(t4 = t2-1; t4 <= min(t2+62,n-1); t4++) { + for(t8 = t4+1; t8 <= n; t8++) { + s2(0,t2,2,t4,0,t4+1,0,t8,0); + } + for(t6 = t4+1; t6 <= min(n,t2+63); t6++) { + for(t8 = t4+1; t8 <= n; t8++) { + s3(0,t2,2,t4,1,t6,0,t8,0); + } + } + } + } +} + +>>> +>>> diff --git a/omegalib/examples/experiments/qr/codegen.input b/omegalib/examples/experiments/qr/codegen.input new file mode 100755 index 0000000..01f8496 --- /dev/null +++ b/omegalib/examples/experiments/qr/codegen.input @@ -0,0 +1,17 @@ +symbolic M, N; + +s1:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : 1+In_3 = 0 && In_4 = 1+In_6 && In_2 = In_6 && In_7 = 0 && In_1 = 0 && In_5 = 0 && 0 <= In_6 < N }; +s2:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_3 = 0 && 1+In_2 = In_4 && In_7 = 0 && In_1 = 0 && In_5 = 0 && 1 <= In_4 <= In_6+1, N && In_6 < M }; +s3:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_3 = 0 && In_4 = 1+In_6 && In_2 = In_6 && In_7 = 0 && In_1 = 0 && In_5 = 1 && 0 <= In_6 < N }; +s4:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_3 = 0 && 1+In_2 = In_4 && In_7 = 0 && In_1 = 0 && In_5 = 2 && 1 <= In_4 <= In_6+1, N && In_6 < M }; +s5:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_3 = 1 && In_4 = 1+In_6 && In_2 = In_6 && In_7 = 0 && In_1 = 0 && In_5 = 0 && 0 <= In_6 < N }; +s6:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_1 = 0 && In_3 = 4 && In_5 = 0 && In_7 = 0 && In_6 = In_2 && 0 <= In_2 <= In_4-2 && In_4 < N }; +s7:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_1 = 0 && In_3 = 4 && In_5 = 3 && In_7 = 0 && 0 <= In_2 <= In_6 < M && In_2+2 <= In_4 < N }; +s8:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_1 = 0 && In_3 = 4 && In_5 = 2 && In_7 = 0 && In_6 = M && In_2+2 <= In_4 <= N && 0 <= In_2 }; +s9:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_1 = 0 && In_3 = 4 && In_5 = 3 && In_7 = 1 && 0 <= In_2 <= In_6 < M && In_2+2 <= In_4 <= N }; +s10:= {[In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_3 = 2 && In_4 = N && In_6 = M && In_5 = 0 && In_7 = 0 && In_1 = 0 && 0 <= In_2 < N }; +s11:= {[In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_5 = 0 && In_3 = 3 && In_7 = 0 && In_1 = 0 && In_6 = In_2 && In_4 = 1+In_2 && 0 <= In_2 <= N-2 }; +s12:= {[In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_5 = 3 && In_3 = 3 && In_7 = 0 && In_1 = 0 && In_4 = 1+In_2 && 0 <= In_2 <= In_6 < M && In_2 <= N-2 }; + + +codegen s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12; diff --git a/omegalib/examples/experiments/qr/qr.out b/omegalib/examples/experiments/qr/qr.out new file mode 100644 index 0000000..e09cc75 --- /dev/null +++ b/omegalib/examples/experiments/qr/qr.out @@ -0,0 +1,54 @@ +>>> symbolic M, N; +>>> +>>> s1:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : 1+In_3 = 0 && In_4 = 1+In_6 && In_2 = In_6 && In_7 = 0 && In_1 = 0 && In_5 = 0 && 0 <= In_6 < N }; +>>> s2:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_3 = 0 && 1+In_2 = In_4 && In_7 = 0 && In_1 = 0 && In_5 = 0 && 1 <= In_4 <= In_6+1, N && In_6 < M }; +>>> s3:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_3 = 0 && In_4 = 1+In_6 && In_2 = In_6 && In_7 = 0 && In_1 = 0 && In_5 = 1 && 0 <= In_6 < N }; +>>> s4:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_3 = 0 && 1+In_2 = In_4 && In_7 = 0 && In_1 = 0 && In_5 = 2 && 1 <= In_4 <= In_6+1, N && In_6 < M }; +>>> s5:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_3 = 1 && In_4 = 1+In_6 && In_2 = In_6 && In_7 = 0 && In_1 = 0 && In_5 = 0 && 0 <= In_6 < N }; +>>> s6:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_1 = 0 && In_3 = 4 && In_5 = 0 && In_7 = 0 && In_6 = In_2 && 0 <= In_2 <= In_4-2 && In_4 < N }; +>>> s7:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_1 = 0 && In_3 = 4 && In_5 = 3 && In_7 = 0 && 0 <= In_2 <= In_6 < M && In_2+2 <= In_4 < N }; +>>> s8:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_1 = 0 && In_3 = 4 && In_5 = 2 && In_7 = 0 && In_6 = M && In_2+2 <= In_4 <= N && 0 <= In_2 }; +>>> s9:= { [In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_1 = 0 && In_3 = 4 && In_5 = 3 && In_7 = 1 && 0 <= In_2 <= In_6 < M && In_2+2 <= In_4 <= N }; +>>> s10:= {[In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_3 = 2 && In_4 = N && In_6 = M && In_5 = 0 && In_7 = 0 && In_1 = 0 && 0 <= In_2 < N }; +>>> s11:= {[In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_5 = 0 && In_3 = 3 && In_7 = 0 && In_1 = 0 && In_6 = In_2 && In_4 = 1+In_2 && 0 <= In_2 <= N-2 }; +>>> s12:= {[In_1,In_2,In_3,In_4,In_5,In_6,In_7] : In_5 = 3 && In_3 = 3 && In_7 = 0 && In_1 = 0 && In_4 = 1+In_2 && 0 <= In_2 <= In_6 < M && In_2 <= N-2 }; +>>> +>>> +>>> codegen s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12; +for(t2 = 0; t2 <= N-1; t2++) { + s0(0,t2,-1,t2+1,0,t2,0); + for(t6 = t2+1-1; t6 <= M-1; t6++) { + s1(0,t2,0,t2+1,0,t6,0); + } + s2(0,t2,0,t2+1,1,t2,0); + for(t6 = t2+1-1; t6 <= M-1; t6++) { + s3(0,t2,0,t2+1,2,t6,0); + } + s4(0,t2,1,t2+1,0,t2,0); + s9(0,t2,2,N,0,M,0); + if (N >= t2+2) { + s10(0,t2,3,t2+1,0,t2+1-1,0); + for(t6 = t2; t6 <= M-1; t6++) { + s11(0,t2,3,t2+1,3,t6,0); + } + } + for(t4 = t2+2; t4 <= N; t4++) { + if (N >= t4+1) { + s5(0,t2,4,t4,0,t2,0); + } + s7(0,t2,4,t4,2,M,0); + if (N >= t4+1) { + for(t6 = t2; t6 <= M-1; t6++) { + s6(0,t2,4,t4,3,t6,0); + s8(0,t2,4,t4,3,t6,1); + } + } + else { + for(t6 = t2; t6 <= M-1; t6++) { + s8(0,t2,4,t4,3,t6,1); + } + } + } +} + +>>> diff --git a/omegalib/examples/experiments/swim/swim-codegen.input b/omegalib/examples/experiments/swim/swim-codegen.input new file mode 100755 index 0000000..4e558bc --- /dev/null +++ b/omegalib/examples/experiments/swim/swim-codegen.input @@ -0,0 +1,53 @@ +symbolic N3,M,N; + + +s0:= {[t,i,j] : 0 <= j <= N-1 && 0 <= i <= M-1 && 0 <= t <= N3-1 }; +t0:={[t,i,j] -> [0,t,0,i,0,j,0]}; +s1:= {[t,j] : 0 <= j <= N-1 && 0 <= t <= N3-1}; +t1:={[t,j] -> [0,t,1,j,0,0,0]}; +s2:= {[t,i] : 0 <= i <= M-1 && 0 <= t <= N3-1}; +t2:={[t,i] -> [0,t,2,i,0,0,0]}; +s3:= {[t] : 0 <= t <= N3-1 }; +t3:={[t] -> [0,t,3,0,0,0,0]}; +s4:= {[t,i,j] : 0 <= j <= N-1 && i=M-1 && 0 <= t <= N3-1 }; +t4:={[t,i,j] -> [0,t,4,i,0,j,0] }; +s5:= {[t,j] : 0 <= j <= N-1 && 0 <= t <= N3-1 }; +t5:={[t,j] -> [0,t,8,j,0,0,0]}; +s6:= {[t,i] : 0 <= i <= M-1 && 0 <= t <= N3-1 }; +t6:={[t,i] -> [0,t,9,i,0,0,0]}; +s7:= {[t] : 0 <= t <= N3-1 }; +t7:={[t] -> [0,t,10,0,0,0,0]}; +s8:= {[t,i,j] : 0 <= j <= N-1 && M-2 <= i <= M-1 && 0 <= t <= N3-1 }; +t8:= {[t,i,j] -> [0,t,12,i,0,j,0]}; +s9:= {[t,j] : 0 <= j <= N-1 && 0 <= t <= N3-1 }; +t9:={[t,j] -> [0,t,15,j,0,0,0]}; +s10:= {[t,i] : 0 <= i <= M-1 && 0 <= t <= N3-1 }; +t10:={[t,i] -> [0,t,16,i,3,0,0]}; +s11:= {[t] : 0 <= t <= N3-1 }; +t11:={[t] -> [0,t,17,0,0,0,0]}; +s12:= {[t,i,j] : 0 <= j <= N-1 && 0 <= i <= 1 && 0 <= t <= N3-1 }; +t12:= {[t,i,j] -> [0,t,11,i,0,j,0]}; +s13:= {[t,i,j] : N-2 <= j <= N-1 && 2 <= i <= M-3 && 0 <= t <= N3-1 }; +t13:= {[t,i,j] -> [0,t,14,i,0,j,0]}; +s14:= {[t,i,j] : 0 <= j <= 1 && 2 <= i <= M-3 && 0 <= t <= N3-1 }; +t14:= {[t,i,j] -> [0,t,13,i,0,j,0]}; +s15:= {[t,i,j] : 2 <= j <= N-3 && 2 <= i <= M-3 && 0 <= t <= N3-1 }; +t15:={[t,i,j] -> [0,t,0,i+3,0,j+2,2]}; + +s16:= {[t,i,j] : 0 <= j <= N-1 && i=0 && 0 <= t <= N3-1 }; +t16:={[t,i,j] -> [0,t,5,i,0,j,0] }; + +s17:= {[t,i,j] : j =N-1 && 1<= i <=M-2 && 0 <= t <= N3-1 }; +t17:={[t,i,j] -> [0,t,6,i,0,j,0] }; + +s18:= {[t,i,j] : j =0 && 1<= i <=M-2 && 0 <= t <= N3-1}; +t18:={[t,i,j] -> [0,t,7,i,0,j,0] }; + +s19:= {[t,i,j] :1 <= j <= N-2 && 1 <= i <= M-2 && 0 <= t <= N3-1 }; +t19:={[t,i,j] -> [0,t,0,i+2,0,j+1,1]}; + + + +codegen 2 t0:s0,t1:s1,t2:s2,t3:s3,t4:s4,t5:s5,t6:s6,t7:s7,t8:s8,t9:s9,t10:s10,t11:s11,t12:s12,t13:s13,t14:s14,t15:s15,t16:s16,t17:s17,t18:s18,t19:s19; +#codegen 2 s0,t1:s1,t2:s2,t3:s3,t4:s4,t5:s5,t6:s6,t7:s7,t8:s8,t9:s9,t10:s10,t11:s11,t12:s12,t13:s13,t14:s14,t15:s15,t16:s16,t17:s17,t18:s18,t19:s19; + diff --git a/omegalib/examples/experiments/swim/swim.out b/omegalib/examples/experiments/swim/swim.out new file mode 100644 index 0000000..6adffdb --- /dev/null +++ b/omegalib/examples/experiments/swim/swim.out @@ -0,0 +1,176 @@ +>>> symbolic N3,M,N; +>>> +>>> +>>> s0:= {[t,i,j] : 0 <= j <= N-1 && 0 <= i <= M-1 && 0 <= t <= N3-1 }; +>>> t0:={[t,i,j] -> [0,t,0,i,0,j,0]}; +>>> s1:= {[t,j] : 0 <= j <= N-1 && 0 <= t <= N3-1}; +>>> +>>> t1:={[t,j] -> [0,t,1,j,0,0,0]}; +>>> s2:= {[t,i] : 0 <= i <= M-1 && 0 <= t <= N3-1}; +>>> t2:={[t,i] -> [0,t,2,i,0,0,0]}; +>>> +>>> s3:= {[t] : 0 <= t <= N3-1 }; +>>> +>>> t3:={[t] -> [0,t,3,0,0,0,0]}; +>>> +>>> s4:= {[t,i,j] : 0 <= j <= N-1 && i=M-1 && 0 <= t <= N3-1 }; +>>> t4:={[t,i,j] -> [0,t,4,i,0,j,0] }; +>>> s5:= {[t,j] : 0 <= j <= N-1 && 0 <= t <= N3-1 }; +>>> +>>> t5:={[t,j] -> [0,t,8,j,0,0,0]}; +>>> +>>> s6:= {[t,i] : 0 <= i <= M-1 && 0 <= t <= N3-1 }; +>>> +>>> t6:={[t,i] -> [0,t,9,i,0,0,0]}; +>>> +>>> s7:= {[t] : 0 <= t <= N3-1 }; +>>> +>>> t7:={[t] -> [0,t,10,0,0,0,0]}; +>>> +>>> s8:= {[t,i,j] : 0 <= j <= N-1 && M-2 <= i <= M-1 && 0 <= t <= N3-1 }; +>>> t8:= {[t,i,j] -> [0,t,12,i,0,j,0]}; +>>> s9:= {[t,j] : 0 <= j <= N-1 && 0 <= t <= N3-1 }; +>>> +>>> t9:={[t,j] -> [0,t,15,j,0,0,0]}; +>>> s10:= {[t,i] : 0 <= i <= M-1 && 0 <= t <= N3-1 }; +>>> t10:={[t,i] -> [0,t,16,i,3,0,0]}; +>>> +>>> s11:= {[t] : 0 <= t <= N3-1 }; +>>> +>>> t11:={[t] -> [0,t,17,0,0,0,0]}; +>>> +>>> s12:= {[t,i,j] : 0 <= j <= N-1 && 0 <= i <= 1 && 0 <= t <= N3-1 }; +>>> t12:= {[t,i,j] -> [0,t,11,i,0,j,0]}; +>>> s13:= {[t,i,j] : N-2 <= j <= N-1 && 2 <= i <= M-3 && 0 <= t <= N3-1 }; +>>> t13:= {[t,i,j] -> [0,t,14,i,0,j,0]}; +>>> s14:= {[t,i,j] : 0 <= j <= 1 && 2 <= i <= M-3 && 0 <= t <= N3-1 }; +>>> t14:= {[t,i,j] -> [0,t,13,i,0,j,0]}; +>>> s15:= {[t,i,j] : 2 <= j <= N-3 && 2 <= i <= M-3 && 0 <= t <= N3-1 }; +>>> t15:={[t,i,j] -> [0,t,0,i+3,0,j+2,2]}; +>>> +>>> s16:= {[t,i,j] : 0 <= j <= N-1 && i=0 && 0 <= t <= N3-1 }; +>>> t16:={[t,i,j] -> [0,t,5,i,0,j,0] }; +>>> +>>> s17:= {[t,i,j] : j =N-1 && 1<= i <=M-2 && 0 <= t <= N3-1 }; +>>> t17:={[t,i,j] -> [0,t,6,i,0,j,0] }; +>>> +>>> s18:= {[t,i,j] : j =0 && 1<= i <=M-2 && 0 <= t <= N3-1}; +>>> t18:={[t,i,j] -> [0,t,7,i,0,j,0] }; +>>> +>>> s19:= {[t,i,j] :1 <= j <= N-2 && 1 <= i <= M-2 && 0 <= t <= N3-1 }; +>>> t19:={[t,i,j] -> [0,t,0,i+2,0,j+1,1]}; +>>> +>>> +>>> +>>> codegen 2 t0:s0,t1:s1,t2:s2,t3:s3,t4:s4,t5:s5,t6:s6,t7:s7,t8:s8,t9:s9,t10:s10,t11:s11,t12:s12,t13:s13,t14:s14,t15:s15,t16:s16,t17:s17,t18:s18,t19:s19; +for(t2 = 0; t2 <= N3-1; t2++) { + if (N >= 1) { + for(t4 = 0; t4 <= min(2,M-1); t4++) { + for(t6 = 0; t6 <= N-1; t6++) { + s0(t2,t4,t6); + } + } + for(t4 = 3; t4 <= min(M-1,4); t4++) { + for(t6 = 0; t6 <= min(1,N-1); t6++) { + s0(t2,t4,t6); + } + for(t6 = 2; t6 <= min(3,N-1); t6++) { + s0(t2,t4,t6); + s19(t2,t4-2,t6-1); + } + for(t6 = 4; t6 <= N-1; t6++) { + s0(t2,t4,t6); + s19(t2,t4-2,t6-1); + } + } + for(t4 = 5; t4 <= M-1; t4++) { + for(t6 = 0; t6 <= min(1,N-1); t6++) { + s0(t2,t4,t6); + } + for(t6 = 2; t6 <= min(N-1,3); t6++) { + s0(t2,t4,t6); + s19(t2,t4-2,t6-1); + } + for(t6 = 4; t6 <= N-1; t6++) { + s0(t2,t4,t6); + s19(t2,t4-2,t6-1); + s15(t2,t4-3,t6-2); + } + } + } + if (M >= 3) { + if (M >= 5) { + for(t6 = 2; t6 <= min(N-1,3); t6++) { + s19(t2,M-2,t6-1); + } + for(t6 = 4; t6 <= N-1; t6++) { + s19(t2,M-2,t6-1); + s15(t2,M-3,t6-2); + } + } + else { + for(t6 = 2; t6 <= N-1; t6++) { + s19(t2,M-2,t6-1); + } + } + } + for(t4 = 0; t4 <= N-1; t4++) { + s1(t2,t4); + } + for(t4 = 0; t4 <= M-1; t4++) { + s2(t2,t4); + } + s3(t2); + for(t6 = 0; t6 <= N-1; t6++) { + s4(t2,M-1,t6); + } + for(t6 = 0; t6 <= N-1; t6++) { + s16(t2,0,t6); + } + for(t4 = 1; t4 <= M-2; t4++) { + s17(t2,t4,N-1); + } + for(t4 = 1; t4 <= M-2; t4++) { + s18(t2,t4,0); + } + for(t4 = 0; t4 <= N-1; t4++) { + s5(t2,t4); + } + for(t4 = 0; t4 <= M-1; t4++) { + s6(t2,t4); + } + s7(t2); + if (N >= 1) { + for(t4 = 0; t4 <= 1; t4++) { + for(t6 = 0; t6 <= N-1; t6++) { + s12(t2,t4,t6); + } + } + for(t4 = M-2; t4 <= M-1; t4++) { + for(t6 = 0; t6 <= N-1; t6++) { + s8(t2,t4,t6); + } + } + } + for(t4 = 2; t4 <= M-3; t4++) { + for(t6 = 0; t6 <= 1; t6++) { + s14(t2,t4,t6); + } + } + for(t4 = 2; t4 <= M-3; t4++) { + for(t6 = N-2; t6 <= N-1; t6++) { + s13(t2,t4,t6); + } + } + for(t4 = 0; t4 <= N-1; t4++) { + s9(t2,t4); + } + for(t4 = 0; t4 <= M-1; t4++) { + s10(t2,t4); + } + s11(t2); +} + +>>> #codegen 2 s0,t1:s1,t2:s2,t3:s3,t4:s4,t5:s5,t6:s6,t7:s7,t8:s8,t9:s9,t10:s10,t11:s11,t12:s12,t13:s13,t14:s14,t15:s15,t16:s16,t17:s17,t18:s18,t19:s19; +>>> +>>> diff --git a/omegalib/examples/floor_bound b/omegalib/examples/floor_bound new file mode 100644 index 0000000..3cb0d57 --- /dev/null +++ b/omegalib/examples/floor_bound @@ -0,0 +1,46 @@ +# +# Test floor/ceiling variable definitions in loop bounds +# Notes: +# intFloor, intCeil are strict mathematical definition, +# intMod(a,b) always has input b>0 and returns [0,b). +# + +symbolic m, n; + +# loop is strided +# +is := {[i]: exists (alpha: i = 4alpha && m <= 3i <= n)}; +codegen is; + +# only one single floor/ceiling variable in bound +# +is := {[i]: exists (lb: m-4 < 4*lb <= m && lb <= i <= n)}; +codegen is; + +# the floor/ceiling variable in bound has coefficient +# +is := {[i]: exists (lb: m-4 < 4*lb <= m && 4*lb <= i <= n)}; +codegen is; + +# mutiple floor/ceiling variables in bound +# +is := {[i]:exists (alpha,beta: m-4<4alpha<=m && m-3<3beta<=m && + 4alpha+3*beta<=i<=n )}; +codegen is; + +# non-tight floor/ceiling definition +# +is := {[i]: exists (ub: n-2 < 3*ub <= n && m <= i <= 5*ub)}; +codegen is; + +# chain floor/ceiling definitions +# +is := {[i]: exists (alpha, beta: beta-4<4alpha<=beta && + m-8<8beta<=m && 4alpha<=i<=n )}; +codegen is; + +# one complicated case +# +is := {[i]: exists (alpha, beta: beta-4<4alpha<=beta && + m-7<8beta<=m && 4alpha<=i<=n )}; +codegen is; diff --git a/omegalib/examples/floor_bound.out b/omegalib/examples/floor_bound.out new file mode 100644 index 0000000..2d59f65 --- /dev/null +++ b/omegalib/examples/floor_bound.out @@ -0,0 +1,76 @@ +>>> # +>>> # Test floor/ceiling variable definitions in loop bounds +>>> # +>>> +>>> symbolic m, n; +>>> +>>> # loop is strided +>>> # +>>> is := {[i]: exists (alpha: i = 4alpha && m <= 3i <= n)}; +>>> codegen is; +for(t1 = 4*intDiv(intDiv(m+2,3)+3,4); t1 <= intDiv(n,3); t1 += 4) { + s1(t1); +} + +>>> +>>> # only one single floor/ceiling variable in bound +>>> # +>>> is := {[i]: exists (lb: m-4 < 4*lb <= m && lb <= i <= n)}; +>>> codegen is; +for(t1 = intDiv(m-3+3,4); t1 <= n; t1++) { + s1(t1); +} + +>>> +>>> # the floor/ceiling variable in bound has coefficient +>>> # +>>> is := {[i]: exists (lb: m-4 < 4*lb <= m && 4*lb <= i <= n)}; +>>> codegen is; +for(t1 = 4*intDiv(m,4); t1 <= n; t1++) { + s1(t1); +} + +>>> +>>> # mutiple floor/ceiling variables in bound +>>> # +>>> is := {[i]:exists (alpha,beta: m-4<4alpha<=m && m-3<3beta<=m && +>>> 4alpha+3*beta<=i<=n )}; +>>> codegen is; +for(t1 = 3*intDiv(m,3)+4*intDiv(m,4); t1 <= n; t1++) { + s1(t1); +} + +>>> +>>> # non-tight floor/ceiling definition +>>> # +>>> is := {[i]: exists (ub: n-2 < 3*ub <= n && m <= i <= 5*ub)}; +>>> codegen is; +if (n-1 <= 3*intDiv(n,3)) { + for(t1 = m; t1 <= 5*intDiv(n,3); t1++) { + s1(t1); + } +} + +>>> +>>> # chain floor/ceiling definitions +>>> # +>>> is := {[i]: exists (alpha, beta: beta-4<4alpha<=beta && +>>> m-8<8beta<=m && 4alpha<=i<=n )}; +>>> codegen is; +for(t1 = 4*intDiv(m,32); t1 <= n; t1++) { + s1(t1); +} + +>>> +>>> # one complicated case +>>> # +>>> is := {[i]: exists (alpha, beta: beta-4<4alpha<=beta && +>>> m-7<8beta<=m && 4alpha<=i<=n )}; +>>> codegen is; +if (m-6 <= 8*intDiv(m,8)) { + for(t1 = 4*intDiv(m,32); t1 <= n; t1++) { + s1(t1); + } +} + + diff --git a/omegalib/examples/gist b/omegalib/examples/gist new file mode 100644 index 0000000..5919b88 --- /dev/null +++ b/omegalib/examples/gist @@ -0,0 +1,60 @@ +# +# Test gist function and code generation for modular equations +# + +symbolic n; + +# basic gist function +# +R:={[t1,t2]: exists (aa : 2aa = t1 && 2 <= t1 && t1 <= 8)}; +known := {[t1,t2]: 1 <= t1 <= 9}; +gist R given known; + + +# test modulo equations by coprime numbers +# +is := { [i,j] : 1 <= i <= n && i <= j <= n && exists (alpha, beta: i= 1+4*alpha && j = i+3*beta) }; +is; +known := { [i,j] : 1 <= i <= n && exists (alpha: i = 1+4*alpha) }; +gist is given known; + +codegen is; + +# test modulo equations by numbers in multiple +# +is := { [i,j] : 1 <= i <= n && i <= j <= n && exists (alpha, beta: i= 1+4*alpha && j = i+8*beta) }; +is; +known := { [i,j] : 1 <= i <= n && exists (alpha: i = 1+4*alpha) }; +gist is given known; + +codegen is; + +is := { [i,j] : 1 <= i <= n && i <= j <= n && exists (alpha, beta: i= 1+256*alpha && j = i+8*beta) }; +is; +known := { [i,j] : 1 <= i <= n && exists (alpha: i = 1+256*alpha) }; +gist is given known; + +codegen is; + +# test modulo equations by gcd != 1 +# +is := { [i,j] : 1 <= i <= n && i <= j <= n && exists (alpha, beta: i= 1+4*alpha && j = i+1+6*beta) }; +is; +known := { [i,j] : 1 <= i <= n && exists (alpha: i = 1+4*alpha) }; +gist is given known; +codegen is; + +is := { [i,j] : 1 <= i <= n && i <= j <= n && exists (alpha, beta: i= 1+6*alpha && j = i+4*beta) }; +is; +known := { [i,j] : 1 <= i <= n && exists (alpha: i = 1+6*alpha) }; +gist is given known; +codegen is; + +# gist won't simpilfy to the result we want, but the code generation +# takes care of it +# +is := { [i,j] : 1 <= i <= n && i <= j <= n && exists (alpha, beta: i= 1+12*alpha && j = i+8*beta) }; +is; +known := { [i,j] : 1 <= i <= n && exists (alpha: i = 1+12*alpha) }; +gist is given known; +codegen is; diff --git a/omegalib/examples/gist.out b/omegalib/examples/gist.out new file mode 100644 index 0000000..44fa8f7 --- /dev/null +++ b/omegalib/examples/gist.out @@ -0,0 +1,110 @@ +>>> # +>>> # Test gist function and code generation for modular equations +>>> # +>>> +>>> symbolic n; +>>> +>>> # basic gist function +>>> # +>>> R:={[t1,t2]: exists (aa : 2aa = t1 && 2 <= t1 && t1 <= 8)}; +>>> known := {[t1,t2]: 1 <= t1 <= 9}; +>>> gist R given known; +{[t1,t2]: exists ( alpha : 2alpha = t1)} +>>> +>>> +>>> # test modulo equations by coprime numbers +>>> # +>>> is := { [i,j] : 1 <= i <= n && i <= j <= n && exists (alpha, beta: i= 1+4*alpha && j = i+3*beta) }; +>>> is; +{[i,j]: exists ( alpha : 3+i = 4j+12alpha && 1 <= i <= j <= n)} +>>> known := { [i,j] : 1 <= i <= n && exists (alpha: i = 1+4*alpha) }; +>>> gist is given known; +{[i,j]: exists ( alpha : j = i+3alpha && i <= j <= n)} +>>> +>>> codegen is; +for(t1 = 1; t1 <= n; t1 += 4) { + for(t2 = t1; t2 <= n; t2 += 3) { + s0(t1,t2); + } +} + +>>> +>>> # test modulo equations by numbers in multiple +>>> # +>>> is := { [i,j] : 1 <= i <= n && i <= j <= n && exists (alpha, beta: i= 1+4*alpha && j = i+8*beta) }; +>>> is; +{[i,j]: exists ( alpha,beta : j = i+8alpha && i = 1+4beta && 1 <= i <= j <= n)} +>>> known := { [i,j] : 1 <= i <= n && exists (alpha: i = 1+4*alpha) }; +>>> gist is given known; +{[i,j]: exists ( alpha : j = i+8alpha && i <= j <= n)} +>>> +>>> codegen is; +for(t1 = 1; t1 <= n; t1 += 4) { + for(t2 = t1; t2 <= n; t2 += 8) { + s0(t1,t2); + } +} + +>>> +>>> is := { [i,j] : 1 <= i <= n && i <= j <= n && exists (alpha, beta: i= 1+256*alpha && j = i+8*beta) }; +>>> is; +{[i,j]: exists ( alpha,beta : j = 1+8alpha && i = 1+256beta && 1 <= i <= j <= n)} +>>> known := { [i,j] : 1 <= i <= n && exists (alpha: i = 1+256*alpha) }; +>>> gist is given known; +{[i,j]: exists ( alpha : j = 1+8alpha && i <= j <= n)} +>>> +>>> codegen is; +for(t1 = 1; t1 <= n; t1 += 256) { + for(t2 = t1; t2 <= n; t2 += 8) { + s0(t1,t2); + } +} + +>>> +>>> # test modulo equations by gcd != 1 +>>> # +>>> is := { [i,j] : 1 <= i <= n && i <= j <= n && exists (alpha, beta: i= 1+4*alpha && j = i+1+6*beta) }; +>>> is; +{[i,j]: exists ( alpha,beta : i+2j = 5+12alpha && i = 1+4beta && 1 <= i < j <= n)} +>>> known := { [i,j] : 1 <= i <= n && exists (alpha: i = 1+4*alpha) }; +>>> gist is given known; +{[i,j]: exists ( alpha : i+2j = 5+12alpha && i < j <= n)} +>>> codegen is; +for(t1 = 1; t1 <= n-1; t1 += 4) { + for(t2 = t1+1; t2 <= n; t2 += 6) { + s0(t1,t2); + } +} + +>>> +>>> is := { [i,j] : 1 <= i <= n && i <= j <= n && exists (alpha, beta: i= 1+6*alpha && j = i+4*beta) }; +>>> is; +{[i,j]: exists ( alpha,beta : 3j = 2+i+12alpha && i = 1+6beta && 1 <= i <= j <= n)} +>>> known := { [i,j] : 1 <= i <= n && exists (alpha: i = 1+6*alpha) }; +>>> gist is given known; +{[i,j]: exists ( alpha : i+j = 2+4alpha && i <= j <= n)} +>>> codegen is; +for(t1 = 1; t1 <= n; t1 += 6) { + for(t2 = t1; t2 <= n; t2 += 4) { + s0(t1,t2); + } +} + +>>> +>>> # gist won't simpilfy to the result we want, but the code generation +>>> # takes care of it +>>> # +>>> is := { [i,j] : 1 <= i <= n && i <= j <= n && exists (alpha, beta: i= 1+12*alpha && j = i+8*beta) }; +>>> is; +{[i,j]: exists ( alpha,beta : 3j = 2+i+24alpha && i = 1+12beta && 1 <= i <= j <= n)} +>>> known := { [i,j] : 1 <= i <= n && exists (alpha: i = 1+12*alpha) }; +>>> gist is given known; +{[i,j]: exists ( alpha : 2+i = 3j+8alpha && i <= j <= n)} +>>> codegen is; +for(t1 = 1; t1 <= n; t1 += 12) { + for(t2 = t1; t2 <= n; t2 += 8) { + s0(t1,t2); + } +} + +>>> diff --git a/omegalib/examples/hpf b/omegalib/examples/hpf new file mode 100644 index 0000000..8d6eca8 --- /dev/null +++ b/omegalib/examples/hpf @@ -0,0 +1,49 @@ +# Example taken from +# @INPROCEEDINGS{delft, +# author = {Corinne Ancourt and Fabien Coelho and Fran\c{c}ois Irigoin +# and Ronan Keryell}, +# title = {A Linear Algebra Framework for Static HPF Code Distribution}, +# booktitle = {Proceedings of the Fourth International Workshop +# on Compilers for Parallel Computers}, +# year = 1993, +# month = dec, +# pages = {117-132}, +# publisher = {Delft University of Technology} +# } +# +# Generate local code for this HPF code fragment +# !HPF$ template T(0:150,0:150) +# !HPF$ align Y(I,J) with T(3*I,3*J) +A := { [i,j] -> [3i,3j] }; +# !HPF$ processors P(0:3, 0:3) +# !HPF$ distribute +# !HPF$ T(cyclic(4), cyclic(4)) onto P +D := { [t1,t2] -> [p1,p2,c1,c2,o1,o2] : + t1 = 16c1+4p1+o1 + && t2 = 16c2+4p2+o2 + && 0 <= p1,p2 <= 3 + && 0 <= o1,o2 <= 3 }; +# +# do I = 0, 14 +# Y(I,I) = 1.0 +# enddo +# +I := { [i] : 0 <= i <= 14 }; +Y := { [i] -> [i,i] }; +R := D(A(Y(I))); +R; + +symbolic P1,P2; +selectLocal := {[P1,P2,c1,c2,o1,o2] -> [c1,c2,o1,o2]}; +# We want to iteration the chunk and offset values +# of Y touched by this statement. +# the code given in the above paper is: +# do u3 = 0, 2 +# do u4 = 0, 2 +# do u5 = max(max(0,intDiv(2+4*p1+16*u3,3)),intDiv(2+4*p2+16*u4),3), +# min(min(14,intDiv(3+4*p1+16*u3,3)),intDiv(3+4*p2+16*u4,3)) +# u6 = intDiv(3*u5-4*p1-16*u3,3) +# s1[u3,u4,u5,u6] +# +# We generate: +codegen selectLocal(R); diff --git a/omegalib/examples/hpf.out b/omegalib/examples/hpf.out new file mode 100644 index 0000000..3ee21e7 --- /dev/null +++ b/omegalib/examples/hpf.out @@ -0,0 +1,59 @@ +>>> # Example taken from +>>> # @INPROCEEDINGS{delft, +>>> # author = {Corinne Ancourt and Fabien Coelho and Fran\c{c}ois Irigoin +>>> # and Ronan Keryell}, +>>> # title = {A Linear Algebra Framework for Static HPF Code Distribution}, +>>> # booktitle = {Proceedings of the Fourth International Workshop +>>> # on Compilers for Parallel Computers}, +>>> # year = 1993, +>>> # month = dec, +>>> # pages = {117-132}, +>>> # publisher = {Delft University of Technology} +>>> # } +>>> # +>>> # Generate local code for this HPF code fragment +>>> # !HPF$ template T(0:150,0:150) +>>> # !HPF$ align Y(I,J) with T(3*I,3*J) +>>> A := { [i,j] -> [3i,3j] }; +>>> # !HPF$ processors P(0:3, 0:3) +>>> # !HPF$ distribute +>>> # !HPF$ T(cyclic(4), cyclic(4)) onto P +>>> D := { [t1,t2] -> [p1,p2,c1,c2,o1,o2] : +>>> t1 = 16c1+4p1+o1 +>>> && t2 = 16c2+4p2+o2 +>>> && 0 <= p1,p2 <= 3 +>>> && 0 <= o1,o2 <= 3 }; +>>> # +>>> # do I = 0, 14 +>>> # Y(I,I) = 1.0 +>>> # enddo +>>> # +>>> I := { [i] : 0 <= i <= 14 }; +>>> Y := { [i] -> [i,i] }; +>>> R := D(A(Y(I))); +>>> R; +{[p1,p1,c1,c1,o1,o1]: exists ( alpha : p1+o1+c1 = 3alpha && 0 <= p1 <= 3, -c1+4 && 0 <= o1 <= 3 && 0 <= c1 <= 2)} +>>> +>>> symbolic P1,P2; +>>> selectLocal := {[P1,P2,c1,c2,o1,o2] -> [c1,c2,o1,o2]}; +>>> # We want to iteration the chunk and offset values +>>> # of Y touched by this statement. +>>> # the code given in the above paper is: +>>> # do u3 = 0, 2 +>>> # do u4 = 0, 2 +>>> # do u5 = max(max(0,intDiv(2+4*p1+16*u3,3)),intDiv(2+4*p2+16*u4),3), +>>> # min(min(14,intDiv(3+4*p1+16*u3,3)),intDiv(3+4*p2+16*u4,3)) +>>> # u6 = intDiv(3*u5-4*p1-16*u3,3) +>>> # s1[u3,u4,u5,u6] +>>> # +>>> # We generate: +>>> codegen selectLocal(R); +if (P1 == P2 && P1 >= 0 && P1 <= 3) { + for(t1 = 0; t1 <= min(-P1+4,2); t1++) { + for(t3 = intMod(-P1-t1,3); t3 <= 3; t3 += 3) { + s0(t1,t1,t3,t3); + } + } +} + +>>> diff --git a/omegalib/examples/hull b/omegalib/examples/hull new file mode 100644 index 0000000..dbb4d3c --- /dev/null +++ b/omegalib/examples/hull @@ -0,0 +1,102 @@ +# compare new SimpleHull with legacy hull methods + +symbolic m,n; + +r1 := {[i,j]: i>=0 && j>=0 && i+j<=1}; +r2 := {[i,j]: j>=0 && i<=1 && j<=i}; + +ConvexHull (r1 union r2); +DecoupledConvexHull (r1 union r2); +RectHull (r1 union r2); +SimpleHull (r1 union r2); +QuickHull (r1 union r2); +Hull (r1 union r2); + +r1 := {[i]:i<=n && n>=7}; +r2 := {[i]:i<=n-2 && n>=6}; + +ConvexHull (r1 union r2); +DecoupledConvexHull (r1 union r2); +RectHull (r1 union r2); +SimpleHull (r1 union r2); +QuickHull (r1 union r2); +Hull (r1 union r2); + +r1 := {[i,j]:0<=i,j<=2}; +r2 := {[i,j]:0<=i && 1<=j && i+j<=4}; + +ConvexHull (r1 union r2); +DecoupledConvexHull (r1 union r2); +RectHull (r1 union r2); +SimpleHull (r1 union r2); +QuickHull (r1 union r2); +Hull (r1 union r2); + +r1 := {[i,j]: 1<=i<=n && j=0}; +r2 := {[i,j]: 2<=i<=n+1 && j=1}; + +ConvexHull (r1 union r2); +DecoupledConvexHull (r1 union r2); +RectHull (r1 union r2); +SimpleHull (r1 union r2); +QuickHull (r1 union r2); +Hull (r1 union r2); + +r1 := {[i,j,k]: 1<=i<=n && j=0 && k=17i}; +r2 := {[i,j,k]: 2<=i<=n+5 && j=1 && k=17i+10}; + +ConvexHull (r1 union r2); +DecoupledConvexHull (r1 union r2); +RectHull (r1 union r2); +SimpleHull (r1 union r2); +QuickHull (r1 union r2); +Hull (r1 union r2); + +r1:={[x,y]:y<=x && y>=0 && y<=2-x}; +r2:={[x,y]:y>=0 && x<=2 && 2y<=x}; + +ConvexHull (r1 union r2); +DecoupledConvexHull (r1 union r2); +RectHull (r1 union r2); +SimpleHull (r1 union r2); +QuickHull (r1 union r2); +Hull (r1 union r2); + +r1 := {[i,j]: 0<=i<=1000 && 500<=j<=600}; +r2 := {[i,j]: 500<=i<=600 && 0<=j<=1000}; + +ConvexHull (r1 union r2); +DecoupledConvexHull (r1 union r2); +RectHull (r1 union r2); +SimpleHull (r1 union r2); +QuickHull (r1 union r2); +Hull (r1 union r2); + +r1:= {[t1,t2,t3,t4,t5] : 1+t4 = t3 && 32t1+1 <= t3 <= 499, 32t1+32 && 16t2+1 <= t5 <= 499, 16t2+16 && 0 <= t1 && 0 <= t2}; +r2:= {[t1,t2,t3,t4,t5] : t4 = t3 && 16t2 <= t5 <= 498, 16t2+15 && 32t1+1 <= t3 <= 499, 32t1+32 && 0 <= t1 && 0 <= t2 }; + +ConvexHull (r1 union r2); +DecoupledConvexHull (r1 union r2); +RectHull (r1 union r2); +SimpleHull (r1 union r2); +QuickHull (r1 union r2); +Hull (r1 union r2); + +r1:={[i]:i<=n && n<=100 && i>=m-10}; +r2:={[i]:i<=2n && n<=200 && i>=m}; + +ConvexHull (r1 union r2); +DecoupledConvexHull (r1 union r2); +RectHull (r1 union r2); +SimpleHull (r1 union r2); +QuickHull (r1 union r2); +Hull (r1 union r2); + +r:= {[1,1]} union {[2,2]} union {[3,3]} union {[4,4]}; + +ConvexHull r; +DecoupledConvexHull r; +RectHull r; +SimpleHull r; +QuickHull r; +Hull r; diff --git a/omegalib/examples/hull.out b/omegalib/examples/hull.out new file mode 100644 index 0000000..8d53f57 --- /dev/null +++ b/omegalib/examples/hull.out @@ -0,0 +1,40 @@ +>>> # test new hull calculation method RectHull +>>> +>>> symbolic m,n; +>>> +>>> r1 := {[i,j]: i>=0 && j>=0 && i+j<=1}; +>>> r2 := {[i,j]: j>=0 && i<=1 && j<=i}; +>>> +>>> ConvexHull (r1 union r2); +{[i,j]: 0 <= i <= 1 && 0 <= j <= 1} +>>> RectHull (r1 union r2); +{[i,j]: 0 <= i <= 1 && 0 <= j <= 1} +>>> QuickHull (r1 union r2); +{[i,j]: 0 <= j} +>>> Hull (r1 union r2); +{[i,j]: 0 <= i <= 1 && 0 <= j <= 1} +>>> +>>> r1 := {[i]:i<=n && n>=7}; +>>> r2 := {[i]:i<=n-2 && n>=6}; +>>> +>>> ConvexHull (r1 union r2); +{[i]: i <= 3n-14, n && 6 <= n} +>>> RectHull (r1 union r2); +{[i]: i <= n && 6 <= n} +>>> QuickHull (r1 union r2); +{[i]: i <= n && 6 <= n} +>>> Hull (r1 union r2); +{[i]: i <= n, 3n-14 && 6 <= n} +>>> +>>> r1 := {[i,j]:0<=i,j<=2}; +>>> r2 := {[i,j]:0<=i && 1<=j && i+j<=4}; +>>> +>>> ConvexHull (r1 union r2); +{[i,j]: 0 <= i <= j+2, -j+4 && 0 <= j} +>>> RectHull (r1 union r2); +{[i,j]: 0 <= i <= -j+4, 3 && 0 <= j} +>>> QuickHull (r1 union r2); +{[i,j]: 0 <= i && 0 <= j} +>>> Hull (r1 union r2); +{[i,j]: 0 <= i <= -j+4, j+2 && 0 <= j} + diff --git a/omegalib/examples/if_then b/omegalib/examples/if_then new file mode 100755 index 0000000..9f159c7 --- /dev/null +++ b/omegalib/examples/if_then @@ -0,0 +1,19 @@ +# test if-then-else generation + +symbolic n,m; +r0:={[i,j]:1<=i,j<=n && m>1 && m1 && m>=n }; +r2:={[i,j]:1<=i,j<=n && m<=1}; +codegen 0 r0,r1,r2; + +r0:={[i]:1<=i<=100 && n> 1}; +r1:={[i,j]:1<=i,j<=100 && n>1}; +r2:={[i,j]:1<=i,j<=100}; +codegen 0 r0,r1,r2; +codegen 1 r0,r1,r2; +codegen 2 r0,r1,r2; + +r0:={[i,j]:1<=i,j<=100 && exists (alpha: i=4alpha)}; +r1:={[i,j]:10<=i,j<=100 && exists (alpha: i=4alpha+2)}; +codegen 0 r0,r1; +codegen 1 r0,r1; diff --git a/omegalib/examples/interface b/omegalib/examples/interface new file mode 100644 index 0000000..48cac6d --- /dev/null +++ b/omegalib/examples/interface @@ -0,0 +1,15 @@ +# These are the examples from the documentation for the +# C++ interface to the Omega Library. +# +symbolic n, m, F(1); + +S1 := { [t] : 1 <= t <= n }; +S2 := { [x] : (0 <= x <= 100 and + exists (y : 2n <= y <= x and exists (z : y = 2*z+1))) + or x = 17 }; + +R := { [i,j] -> [i',j'] : 1 <= i <= i' <= n and not (F(In) = F(Out)) + and 1 <= j, j' <= m }; +S1; +S2; +R; diff --git a/omegalib/examples/interface.out b/omegalib/examples/interface.out new file mode 100644 index 0000000..8b5290f --- /dev/null +++ b/omegalib/examples/interface.out @@ -0,0 +1,36 @@ +# Omega Calculator [v1.1, Oct 96]: +# # +# # These are the examples from the documentation for the +# # C++ interface to the Omega Library. +# # +# +# symbolic n, m, F(1); +# +# +# S1 := { [t] : 1 <= t <= n }; +# +# S2 := { [x] : (0 <= x <= 100 and +# exists (y : 2n <= y <= x and exists (z : y = 2*z+1))) +# or x = 17 }; +# +# R := { [i,j] -> [i',j'] : 1 <= i <= i' <= n and not (F(In) = F(Out)) +# and 1 <= j, j' <= m }; +# +# +# S1; + +{[t]: 1 <= t <= n} + +# +# S2; + +{[x]: 0, 2n+1 <= x <= 100} union + {[x]: x = 17} + +# +# R; + +{[i,j] -> [i',j'] : 1 <= i < i' <= n && 1 <= j <= m && 1 <= j' <= m && F(i) < F(i')} union + {[i,j] -> [i',j'] : 1 <= i < i' <= n && 1 <= j <= m && 1 <= j' <= m && F(i') < F(i)} + +# diff --git a/omegalib/examples/lu b/omegalib/examples/lu new file mode 100644 index 0000000..800d8a0 --- /dev/null +++ b/omegalib/examples/lu @@ -0,0 +1,41 @@ +# Perform imperfect loop interchange of LU decomposition +# to get jki form and then block the k and i loops +# +#for k = 1 to n do +# for i = k+1 to n do +# a(i,k) = a(i,k) / a(k,k) +# for j = k+1 to n do +# a(i,j) = a(i,j) - a(k,j)*a(i,k) +# endfor +# endfor +#endfor +# +# + +symbolic n; + +IS10 := {[k,i] : 1 <= k <= n && k+1 <= i <= n}; +IS20 := {[k,i,j] : 1 <= k <= n && k+1 <= i <= n && k+1 <= j <= n}; + +T10 := {[k,i] -> [t1,t2,k,k,i]: +exists (alpha,beta: t1 = 64beta+1 && k-1 = alpha + 64 beta && + alpha >= 0 && alpha <= 63) +&& exists (gamma,delta: t2 = 64delta && i = gamma +64delta && + gamma >= 0 && gamma <= 63)}; + +T20 := {[k,i,j] -> [t1,t2,j,k,i]: +exists (alpha,beta: t1 = 64beta+1 && k-1 = alpha + 64 beta && + alpha >= 0 && alpha <= 63) +&& exists (gamma,delta: t2 = 64delta && i = gamma +64delta && + gamma >= 0 && gamma <= 63)}; + +T10; +T20; + +# Generate code with different ammounts of overhead remove +# The more overhead we remove, the more code duplication may occur +codegen 0 T10:IS10,T20:IS20; +codegen 1 T10:IS10,T20:IS20; +codegen 2 T10:IS10,T20:IS20; +codegen 3 T10:IS10,T20:IS20; + diff --git a/omegalib/examples/lu.out b/omegalib/examples/lu.out new file mode 100644 index 0000000..eecaa51 --- /dev/null +++ b/omegalib/examples/lu.out @@ -0,0 +1,117 @@ +>>> # Perform imperfect loop interchange of LU decomposition +>>> # to get jki form and then block the k and i loops +>>> # +>>> #for k = 1 to n do +>>> # for i = k+1 to n do +>>> # a(i,k) = a(i,k) / a(k,k) +>>> # for j = k+1 to n do +>>> # a(i,j) = a(i,j) - a(k,j)*a(i,k) +>>> # endfor +>>> # endfor +>>> #endfor +>>> # +>>> # +>>> +>>> symbolic n; +>>> +>>> IS10 := {[k,i] : 1 <= k <= n && k+1 <= i <= n}; +>>> IS20 := {[k,i,j] : 1 <= k <= n && k+1 <= i <= n && k+1 <= j <= n}; +>>> +>>> T10 := {[k,i] -> [t1,t2,k,k,i]: +>>> exists (alpha,beta: t1 = 64beta+1 && k-1 = alpha + 64 beta && +>>> alpha >= 0 && alpha <= 63) +>>> && exists (gamma,delta: t2 = 64delta && i = gamma +64delta && +>>> gamma >= 0 && gamma <= 63)}; +>>> +>>> T20 := {[k,i,j] -> [t1,t2,j,k,i]: +>>> exists (alpha,beta: t1 = 64beta+1 && k-1 = alpha + 64 beta && +>>> alpha >= 0 && alpha <= 63) +>>> && exists (gamma,delta: t2 = 64delta && i = gamma +64delta && +>>> gamma >= 0 && gamma <= 63)}; +>>> +>>> T10; +{[k,i] -> [t1,t2,k,k,i] : exists ( alpha,beta : t1 = 1+64alpha && t2 = 64beta && k-63 <= t1 <= k && i-63 <= t2 <= i)} +>>> T20; +{[k,i,j] -> [t1,t2,j,k,i] : exists ( alpha,beta : t1 = 1+64alpha && t2 = 64beta && k-63 <= t1 <= k && i-63 <= t2 <= i)} +>>> +>>> # Generate code with different ammounts of overhead remove +>>> # The more overhead we remove, the more code duplication may occur +>>> codegen 0 T10:IS10,T20:IS20; +for(t1 = 1; t1 <= n-1; t1 += 64) { + for(t2 = t1-1; t2 <= n; t2 += 64) { + for(t3 = t1; t3 <= n; t3++) { + for(t4 = t1; t4 <= min(t3-1,t2+62,t1+63); t4++) { + for(t5 = max(t2,t4+1); t5 <= min(n,t2+63); t5++) { + s1(t4,t5,t3); + } + } + if (t1 >= t3-63) { + for(t5 = max(t3+1,t2); t5 <= min(n,t2+63); t5++) { + s0(t3,t5); + } + } + } + } +} + +>>> codegen 1 T10:IS10,T20:IS20; +for(t1 = 1; t1 <= n-1; t1 += 64) { + for(t2 = t1-1; t2 <= n; t2 += 64) { + for(t3 = t1; t3 <= n; t3++) { + for(t4 = t1; t4 <= min(t3-1,t2+62,t1+63); t4++) { + for(t5 = max(t2,t4+1); t5 <= min(n,t2+63); t5++) { + s1(t4,t5,t3); + } + } + if (t1 >= t3-63) { + for(t5 = max(t3+1,t2); t5 <= min(n,t2+63); t5++) { + s0(t3,t5); + } + } + } + } +} + +>>> codegen 2 T10:IS10,T20:IS20; +for(t1 = 1; t1 <= n-1; t1 += 64) { + for(t2 = t1-1; t2 <= n; t2 += 64) { + for(t3 = t1; t3 <= n; t3++) { + for(t4 = t1; t4 <= min(t3-1,t2+62,t1+63); t4++) { + for(t5 = max(t2,t4+1); t5 <= min(n,t2+63); t5++) { + s1(t4,t5,t3); + } + } + if (t1 >= t3-63) { + for(t5 = max(t3+1,t2); t5 <= min(n,t2+63); t5++) { + s0(t3,t5); + } + } + } + } +} + +>>> codegen 3 T10:IS10,T20:IS20; +for(t1 = 1; t1 <= n-1; t1 += 64) { + for(t2 = t1-1; t2 <= n; t2 += 64) { + for(t3 = t1; t3 <= min(t1+63,n); t3++) { + for(t4 = t1; t4 <= min(t2+62,t3-1); t4++) { + for(t5 = max(t2,t4+1); t5 <= min(t2+63,n); t5++) { + s1(t4,t5,t3); + } + } + for(t5 = max(t2,t3+1); t5 <= min(n,t2+63); t5++) { + s0(t3,t5); + } + } + for(t3 = t1+64; t3 <= n; t3++) { + for(t4 = t1; t4 <= min(t2+62,t1+63); t4++) { + for(t5 = max(t2,t4+1); t5 <= min(t2+63,n); t5++) { + s1(t4,t5,t3); + } + } + } + } +} + +>>> +>>> diff --git a/omegalib/examples/old_test/affineClosure b/omegalib/examples/old_test/affineClosure new file mode 100644 index 0000000..1039856 --- /dev/null +++ b/omegalib/examples/old_test/affineClosure @@ -0,0 +1,19 @@ + +symbolic n; +symbolic c; + +R := {[i,j] : 1 <= i <= 10 && 1 <= j <= n}; +R; +ac := approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : + 0 <= lambda0, lambda1,lambda2,lambda3,lambda4 + && c = lambda0-lambda1+ 10 lambda2 - lambda3 + && i = lambda1-lambda2 + && j = lambda3-lambda4 + && n = lambda4)}; +ac; + +#ac intersection {[i,j] : i = 1 && c = -1} ; +#ac intersection {[i,j] : i = -1 && c = 10} ; +#ac intersection {[i,j] : j = 1 && c = -1 } ; +#ac intersection {[i,j] : j = -1 && n = 1} ; + diff --git a/omegalib/examples/old_test/affineClosure.oc-rt b/omegalib/examples/old_test/affineClosure.oc-rt new file mode 100644 index 0000000..fbf8bf9 --- /dev/null +++ b/omegalib/examples/old_test/affineClosure.oc-rt @@ -0,0 +1,32 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# +# symbolic n; +# +# symbolic c; +# +# +# R := {[i,j] : 1 <= i <= 10 && 1 <= j <= n}; +# +# R; + +{[i,j]: 1 <= i <= 10 && 1 <= j <= n} + +# +# ac := approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : +# 0 <= lambda0, lambda1,lambda2,lambda3,lambda4 +# && c = lambda0-lambda1+ 10 lambda2 - lambda3 +# && i = lambda1-lambda2 +# && j = lambda3-lambda4 +# && n = lambda4)}; +# +# ac; + +{[i,j]: 0 <= n && 0 <= n+c+i+j && 0 <= n+c+10i+j && 0 <= n+j} + +# +# +# #ac intersection {[i,j] : i = 1 && c = -1} ; +# #ac intersection {[i,j] : i = -1 && c = 10} ; +# #ac intersection {[i,j] : j = 1 && c = -1 } ; +# #ac intersection {[i,j] : j = -1 && n = 1} ; +# diff --git a/omegalib/examples/old_test/affineClosure2 b/omegalib/examples/old_test/affineClosure2 new file mode 100644 index 0000000..35ae0e1 --- /dev/null +++ b/omegalib/examples/old_test/affineClosure2 @@ -0,0 +1,55 @@ +symbolic n; +symbolic c; +# # Omega Calculator [v1.00, Mar 96]: +# # +# # +# # +# # R := {[i,j] : 1 <= i <= 10 && 1 <= j <= n}; +# # +# # R; +# +# {[i,j]: 1 <= i <= 10 && 1 <= j <= n} +# +# # +# # ac := approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : +# # 0 <= lambda0, lambda1,lambda2,lambda3,lambda4 +# # && c = lambda0-lambda1+ 10 lambda2 - lambda3 +# # && i = lambda1-lambda2 +# # && j = lambda3-lambda4 +# # && n = lambda4)}; +# # +# # ac; +# +# {[i,j]: 0 <= n && 0 <= n+c+i+j && 0 <= n+c+10i+j && 0 <= n+j} +# +# # +# # +# # #ac intersection {[i,j] : i = 1 && c = -1} ; +# # #ac intersection {[i,j] : i = -1 && c = 10} ; +# # #ac intersection {[i,j] : j = 1 && c = -1 } ; +# # #ac intersection {[i,j] : j = -1 && n = 1} ; +# # + +approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : + 0 <= lambda0,lambda1,lambda2,lambda3,lambda4 + && n = lambda1+lambda2+lambda3+lambda4 + && i = lambda2+10lambda3 + && j = lambda2+lambda3+lambda4 + && c = lambda0+lambda2+lambda3 + && c = 1 + )}; +approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : + 0 <= lambda1,lambda2,lambda3,lambda4 + && n = lambda1+lambda2+lambda3+lambda4 + && i = lambda2+10lambda3 + && j = lambda2+lambda3+lambda4 + && c = lambda2+lambda3 + && c = 1 + )}; +approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : + 0 <= lambda1,lambda2,lambda3,lambda4 + && n = lambda1+lambda2+lambda3+lambda4 + && i = lambda2+10lambda3 + && j = lambda2+lambda3+lambda4 + && c = lambda2+lambda3 + )}; diff --git a/omegalib/examples/old_test/affineClosure2.oc-rt b/omegalib/examples/old_test/affineClosure2.oc-rt new file mode 100644 index 0000000..b4c1fd7 --- /dev/null +++ b/omegalib/examples/old_test/affineClosure2.oc-rt @@ -0,0 +1,70 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n; +# +# symbolic c; +# +# # # Omega Calculator [v1.00, Mar 96]: +# # # +# # # +# # # +# # # R := {[i,j] : 1 <= i <= 10 && 1 <= j <= n}; +# # # +# # # R; +# # +# # {[i,j]: 1 <= i <= 10 && 1 <= j <= n} +# # +# # # +# # # ac := approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : +# # # 0 <= lambda0, lambda1,lambda2,lambda3,lambda4 +# # # && c = lambda0-lambda1+ 10 lambda2 - lambda3 +# # # && i = lambda1-lambda2 +# # # && j = lambda3-lambda4 +# # # && n = lambda4)}; +# # # +# # # ac; +# # +# # {[i,j]: 0 <= n && 0 <= n+c+i+j && 0 <= n+c+10i+j && 0 <= n+j} +# # +# # # +# # # +# # # #ac intersection {[i,j] : i = 1 && c = -1} ; +# # # #ac intersection {[i,j] : i = -1 && c = 10} ; +# # # #ac intersection {[i,j] : j = 1 && c = -1 } ; +# # # #ac intersection {[i,j] : j = -1 && n = 1} ; +# # # +# +# approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : +# 0 <= lambda0,lambda1,lambda2,lambda3,lambda4 +# && n = lambda1+lambda2+lambda3+lambda4 +# && i = lambda2+10lambda3 +# && j = lambda2+lambda3+lambda4 +# && c = lambda0+lambda2+lambda3 +# && c = 1 +# )}; + +{[i,j]: c = 1 && 0 <= i <= 10j, 10 && j <= n} + +# +# approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : +# 0 <= lambda1,lambda2,lambda3,lambda4 +# && n = lambda1+lambda2+lambda3+lambda4 +# && i = lambda2+10lambda3 +# && j = lambda2+lambda3+lambda4 +# && c = lambda2+lambda3 +# && c = 1 +# )}; + +{[i,j]: c = 1 && 1 <= i <= 10 && 1 <= j <= n} + +# +# approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : +# 0 <= lambda1,lambda2,lambda3,lambda4 +# && n = lambda1+lambda2+lambda3+lambda4 +# && i = lambda2+10lambda3 +# && j = lambda2+lambda3+lambda4 +# && c = lambda2+lambda3 +# )}; + +{[i,j]: c <= i <= 10c && c <= j <= n} + +# diff --git a/omegalib/examples/old_test/beatrice2 b/omegalib/examples/old_test/beatrice2 new file mode 100644 index 0000000..7b425fd --- /dev/null +++ b/omegalib/examples/old_test/beatrice2 @@ -0,0 +1,51 @@ +# do i = 1, np { +# do j = 1, i { +# ij = ia(i) + j +# a = 1. / (i + j) +# do k = 1, i { +# maxl = k +# if (k == i) then +# maxl = j +# endif +# do l = 1, maxl { +# kl = ia(k) + l +# b = 1. / (k + l) +# val = a + b +# if (i == j) then +# val = val * .5 +# endif +# if (k == l) then +# val = val * .5 +# endif +# x(ij,kl) = val +# x(kl,ij) = val +# } +# } +# } +# } +#! +# +# +# As far as I remember it was the dependence test between X(IJ,KL) and X(IJ,KL). +# +# Pips discovered the following precondition: +# + +{[d1,d2,d3,d4] : exists ( NP, + I,J,K,L,IJ,KJ,MAXL, + I',J',K',L',IJ',KJ',MAXL' : + I' = I+d1 && + J' = J+d2 && + K' = K+d3 && + L' = L+d4 + && 1<=L && 1<=J && MAXL<=K && I<=NP && NP<=40 && 10<=NP + && 10+8K+MAXL<=NP+8I+J && 38K+MAXL<=38I+J + && J+K<=I+MAXL && L<=MAXL + && 1 <= J,K <= I <= NP && 1 <=L <= MAXL + + && 1<=L' && 1<=J' && MAXL'<=K' && I'<=NP && NP<=40 && 10<=NP + && 10+8K'+MAXL'<=NP+8I'+J' && 38K'+MAXL'<=38I'+J' + && J'+K'<=I'+MAXL' && L'<=MAXL' + && 1 <= J',K' <= I' <= NP && 1 <=L' <= MAXL' + )}; + diff --git a/omegalib/examples/old_test/beatrice2.oc-rt b/omegalib/examples/old_test/beatrice2.oc-rt new file mode 100644 index 0000000..7952859 --- /dev/null +++ b/omegalib/examples/old_test/beatrice2.oc-rt @@ -0,0 +1,56 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # do i = 1, np { +# # do j = 1, i { +# # ij = ia(i) + j +# # a = 1. / (i + j) +# # do k = 1, i { +# # maxl = k +# # if (k == i) then +# # maxl = j +# # endif +# # do l = 1, maxl { +# # kl = ia(k) + l +# # b = 1. / (k + l) +# # val = a + b +# # if (i == j) then +# # val = val * .5 +# # endif +# # if (k == l) then +# # val = val * .5 +# # endif +# # x(ij,kl) = val +# # x(kl,ij) = val +# # } +# # } +# # } +# # } +# #! +# # +# # +# # As far as I remember it was the dependence test between X(IJ,KL) and X(IJ,KL). +# # +# # Pips discovered the following precondition: +# # +# +# {[d1,d2,d3,d4] : exists ( NP, +# I,J,K,L,IJ,KJ,MAXL, +# I',J',K',L',IJ',KJ',MAXL' : +# I' = I+d1 && +# J' = J+d2 && +# K' = K+d3 && +# L' = L+d4 +# && 1<=L && 1<=J && MAXL<=K && I<=NP && NP<=40 && 10<=NP +# && 10+8K+MAXL<=NP+8I+J && 38K+MAXL<=38I+J +# && J+K<=I+MAXL && L<=MAXL +# && 1 <= J,K <= I <= NP && 1 <=L <= MAXL +# +# && 1<=L' && 1<=J' && MAXL'<=K' && I'<=NP && NP<=40 && 10<=NP +# && 10+8K'+MAXL'<=NP+8I'+J' && 38K'+MAXL'<=38I'+J' +# && J'+K'<=I'+MAXL' && L'<=MAXL' +# && 1 <= J',K' <= I' <= NP && 1 <=L' <= MAXL' +# )}; + +{[d1,d2,d3,d4]: d2-39, -39, d4-39, d3-39 <= d1 <= d3+39, d2+39, d4+39, 39 && d4-39, -39 <= d3 <= 39, d4+39 && -39 <= d2 <= 39 && 39d4 <= 1521+38d1+d2 && d3 <= 39+d1+d4 && d2 <= 1521+d1+38d3+d4 && 38d1+d2 <= 1521+39d4 && 38d1+d2 <= 1521+38d3+d4 && d2 <= 1521+d1+39d4 && d1+38d3+d4 <= 1521+d2 && d1+d4 <= 39+d3 && 38d3+d4 <= 1521+38d1+d2 && d1+39d4 <= 1521+d2} + +# +# diff --git a/omegalib/examples/old_test/blume1.w b/omegalib/examples/old_test/blume1.w new file mode 100644 index 0000000..14d7329 --- /dev/null +++ b/omegalib/examples/old_test/blume1.w @@ -0,0 +1,6 @@ +symbolic n, line5expr(2); + +$$ +\{ [i,j] -> [i',j'] \mid line5expr(In) = line5expr(Out) && 2 <= j <= 1 && 1 <= i <= n && 2 <= j' <= 1 && 1 <= i' <= n \}; +$$ + diff --git a/omegalib/examples/old_test/blume1.w.oc-rt b/omegalib/examples/old_test/blume1.w.oc-rt new file mode 100644 index 0000000..68d6aad --- /dev/null +++ b/omegalib/examples/old_test/blume1.w.oc-rt @@ -0,0 +1,12 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# Symbolic n, line5expr(2); +# +# +# $$ +# \{ [i,j] -> [i',j'] \mid line5expr(In) = line5expr(Out) && 2 <= j <= 1 && 1 <= i <= n && 2 <= j' <= 1 && 1 <= i' <= n \}; + +{[i,j] -> [i',j'] : FALSE } + +# +# $$ +# diff --git a/omegalib/examples/old_test/cfft2d1 b/omegalib/examples/old_test/cfft2d1 new file mode 100644 index 0000000..8b59f29 --- /dev/null +++ b/omegalib/examples/old_test/cfft2d1 @@ -0,0 +1,21 @@ +# +# A (memory-based!) data dependence relation from a greatly simplified +# cfft2d1.t that was causing us trouble. +# + +symbolic line22(1), im_1(2); + +flow := { [iii_w,jj_w] -> [iii_r,jj_r] : + im_1(In) = im_1(Out) + && 1 <= jj_w + && jj_w <= line22(In) + && 1 <= iii_w + && iii_w <= 200 + && 1 <= jj_r + && jj_r <= line22(Out) + && 1 <= iii_r + && iii_r <= 200 }; + +zero_plus := { [i1,j1] -> [i2,j2] : i1 = i2 && j1 < j2 }; + +flow intersection zero_plus; diff --git a/omegalib/examples/old_test/cfft2d1.oc-rt b/omegalib/examples/old_test/cfft2d1.oc-rt new file mode 100644 index 0000000..8f8dd27 --- /dev/null +++ b/omegalib/examples/old_test/cfft2d1.oc-rt @@ -0,0 +1,29 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # +# # A (memory-based!) data dependence relation from a greatly simplified +# # cfft2d1.t that was causing us trouble. +# # +# +# Symbolic line22(1), im_1(2); +# +# +# flow := { [iii_w,jj_w] -> [iii_r,jj_r] : +# im_1(In) = im_1(Out) +# && 1 <= jj_w +# && jj_w <= line22(In) +# && 1 <= iii_w +# && iii_w <= 200 +# && 1 <= jj_r +# && jj_r <= line22(Out) +# && 1 <= iii_r +# && iii_r <= 200 }; +# +# +# zero_plus := { [i1,j1] -> [i2,j2] : i1 = i2 && j1 < j2 }; +# +# +# flow intersection zero_plus; + +{[In_1,In_2] -> [Out_1,Out_2] : im_1(In_1,In_2) = im_1(Out_1,Out_2) && Out_1 = In_1 && 1 <= In_2 < Out_2 <= line22(In_1) && 1 <= In_1 <= 200} + +# diff --git a/omegalib/examples/old_test/chosol b/omegalib/examples/old_test/chosol new file mode 100644 index 0000000..134172c --- /dev/null +++ b/omegalib/examples/old_test/chosol @@ -0,0 +1,11 @@ +T10:={[i] -> [0,i,0,0]}; +T20:={[i,j] -> [1,j,0,i]}; +T30:={[i] -> [1,i-1,1,0]}; + +symbolic n; +IS10 := {[i]: 2 <= i <= n}; +IS20 := {[i,j]: 2 <= i <= n && 1 <= j <= i-1}; +IS30 := IS10; + +codegen T10:IS10,T20:IS20,T30:IS30; +codegen 2 T10:IS10,T20:IS20,T30:IS30; diff --git a/omegalib/examples/old_test/chosol.oc-rt b/omegalib/examples/old_test/chosol.oc-rt new file mode 100644 index 0000000..8fa3b38 --- /dev/null +++ b/omegalib/examples/old_test/chosol.oc-rt @@ -0,0 +1,32 @@ +>>> T10:={[i] -> [0,i,0,0]}; +>>> T20:={[i,j] -> [1,j,0,i]}; +>>> T30:={[i] -> [1,i-1,1,0]}; +>>> +>>> Symbolic n; +>>> IS10 := {[i]: 2 <= i <= n}; +>>> IS20 := {[i,j]: 2 <= i <= n && 1 <= j <= i-1}; +>>> IS30 := IS10; +>>> +>>> codegen T10:IS10,T20:IS20,T30:IS30; +for(t2 = 2; t2 <= n; t2++) { + s1(t2); +} +for(t2 = 1; t2 <= n-1; t2++) { + for(t4 = t2+1; t4 <= n; t4++) { + s2(t4,t2); + } + s3(t2+1); +} + +>>> codegen 2 T10:IS10,T20:IS20,T30:IS30; +for(t2 = 2; t2 <= n; t2++) { + s1(t2); +} +for(t2 = 1; t2 <= n-1; t2++) { + for(t4 = t2+1; t4 <= n; t4++) { + s2(t4,t2); + } + s3(t2+1); +} + + diff --git a/omegalib/examples/old_test/closure1 b/omegalib/examples/old_test/closure1 new file mode 100644 index 0000000..0e4c541 --- /dev/null +++ b/omegalib/examples/old_test/closure1 @@ -0,0 +1,8 @@ +({[i] -> [i+2]} union {[i] -> [i+3]})+; +R := ({[i] -> [i'] : i'=i+3} union {[i] -> [i'] : i'=i+5} union {[i] -> [i'] : i'=i+7})+; +R; +notR := {[i] -> [i'] : i' >= i+3} - R; +notR; +{[i] -> [i'] : i' >= i+3} - notR; + + diff --git a/omegalib/examples/old_test/closure1.oc-rt b/omegalib/examples/old_test/closure1.oc-rt new file mode 100644 index 0000000..93ecda0 --- /dev/null +++ b/omegalib/examples/old_test/closure1.oc-rt @@ -0,0 +1,31 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# ({[i] -> [i+2]} union {[i] -> [i+3]})+; + +{[i] -> [Out_1] : Exists ( alpha : 2alpha = i+Out_1 && i <= Out_1-2)} union + {[i] -> [Out_1] : Exists ( alpha : i < Out_1+2alpha && Out_1+3alpha <= i)} + +# +# R := ({[i] -> [i'] : i'=i+3} union {[i] -> [i'] : i'=i+5} union {[i] -> [i'] : i'=i+7})+; +# +# R; + +{[i] -> [i'] : Exists ( alpha : i+3alpha = i' && i <= i'-3)} union + {[i] -> [i'] : Exists ( alpha : i < i'+3alpha && 2i'+7alpha <= 2i)} union + {[i] -> [i'] : Exists ( alpha : i'+3alpha < i && 2i <= 2i'+5alpha)} + +# +# notR := {[i] -> [i'] : i' >= i+3} - R; +# +# notR; + +{[i] -> [i+4] } + +# +# {[i] -> [i'] : i' >= i+3} - notR; + +{[i] -> [i+3] } union + {[i] -> [i'] : i <= i'-5} + +# +# +# diff --git a/omegalib/examples/old_test/closure2 b/omegalib/examples/old_test/closure2 new file mode 100644 index 0000000..1cfcefd --- /dev/null +++ b/omegalib/examples/old_test/closure2 @@ -0,0 +1,4 @@ +R := {[i,j] -> [i+3,j]} union {[i,j] -> [i+2,j-1]} union {[i,j] -> [i+1,j+1]}; +R+; +R+ compose R; +R - (R+ compose R); diff --git a/omegalib/examples/old_test/closure2.oc-rt b/omegalib/examples/old_test/closure2.oc-rt new file mode 100644 index 0000000..e10a428 --- /dev/null +++ b/omegalib/examples/old_test/closure2.oc-rt @@ -0,0 +1,22 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := {[i,j] -> [i+3,j]} union {[i,j] -> [i+2,j-1]} union {[i,j] -> [i+1,j+1]}; +# +# R+; + +{[i,j] -> [Out_1,j'] : Out_1+2j' = i+2j && j' < j} union + {[i,j] -> [Out_1,j'] : Exists ( alpha : i+j' = j+Out_1+3alpha && 3+i+2j <= Out_1+2j' && i+j' <= j+Out_1)} + +# +# R+ compose R; + +{[i,j] -> [Out_1,j'] : Out_1+2j' = i+2j && j' <= j-2} union + {[i,j] -> [Out_1,j'] : Exists ( alpha : i+j' = j+Out_1+3alpha && 3+i+2j <= Out_1+2j' && 3+i+j' <= j+Out_1)} union + {[i,j] -> [Out_1,j'] : Exists ( alpha : i+j' = j+Out_1+3alpha && 6+i+2j <= Out_1+2j' && i+j' <= j+Out_1)} + +# +# R - (R+ compose R); + +{[i,j] -> [i+2,j-1] } union + {[i,j] -> [i+1,j+1] } + +# diff --git a/omegalib/examples/old_test/closure3 b/omegalib/examples/old_test/closure3 new file mode 100644 index 0000000..4fdc022 --- /dev/null +++ b/omegalib/examples/old_test/closure3 @@ -0,0 +1,10 @@ +symbolic n,m; +d11 := {[i,j] -> [i,2i+j] : 1 <= i <= n && 1 <= j,2i+j <= m}; +d12 := {[i,j] -> [i,j+4] : 1 <= i <= n && 1 <= j,j+4 <= m}; +d := d11 union d12; +d+; +d+ compose d; +d11 - (d+ compose d); +gist d11 - (d+ compose d) given d11; +d12 - (d+ compose d); +gist d12 - (d+ compose d) given d12; diff --git a/omegalib/examples/old_test/closure3.oc-rt b/omegalib/examples/old_test/closure3.oc-rt new file mode 100644 index 0000000..4d99b34 --- /dev/null +++ b/omegalib/examples/old_test/closure3.oc-rt @@ -0,0 +1,48 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n,m; +# +# d11 := {[i,j] -> [i,2i+j] : 1 <= i <= n && 1 <= j,2i+j <= m}; +# +# d12 := {[i,j] -> [i,j+4] : 1 <= i <= n && 1 <= j,j+4 <= m}; +# +# d := d11 union d12; +# +# d+; + +{[1,j] -> [1,j+2] : j+2 <= m <= 4 && 1 <= n && 1 <= j} union + {[i,j] -> [i,Out_2] : Exists ( alpha : Out_2 = j+4alpha && Out_2+4 <= m <= 2i && 1 <= j <= Out_2-4 && i <= n)} union + {[i,j] -> [i,Out_2] : Exists ( alpha : Out_2 = 2i+j+4alpha && 1 <= i <= n && Out_2 <= m && 1 <= j && 5 <= m && 2i+j <= Out_2)} union + {[i,j] -> [i,Out_2] : Exists ( alpha,beta : Out_2 = j+4alpha && 1 <= i <= n && Out_2 <= m && 2i+4beta < Out_2 && 1 <= j && Out_2 <= m+2i+4beta && 4i+j <= Out_2)} union + {[i,j] -> [i,Out_2] : Exists ( alpha : Out_2 = j+4alpha && 1 <= i <= n && 1 <= j <= Out_2-4 && Out_2 <= m && 2i < m)} + +# +# d+ compose d; + +{[i,j] -> [i,Out_2] : Exists ( alpha : Out_2 = j+4alpha && Out_2+4 <= m <= 2i && 1 <= j <= Out_2-8 && i <= n)} union + {[i,j] -> [i,Out_2] : Exists ( alpha : Out_2 = j+4alpha && 1 <= i <= n && Out_2 <= m && 1 <= j && 4i+j <= Out_2)} union + {[i,j] -> [i,Out_2] : Exists ( alpha : Out_2 = 2i+j+4alpha && 1 <= i <= n && Out_2 <= m && 4+2i+j <= Out_2 && 1 <= j)} union + {[i,j] -> [i,Out_2] : Exists ( alpha : Out_2 = j+4alpha && 1 <= i <= n && 1 <= j <= Out_2-8 && Out_2 <= m && 2i < m)} + +# +# d11 - (d+ compose d); + +{[i,j] -> [i,2i+j] : 1 <= i <= 3, n && 1 <= j && 2i+j <= m} union + {[i,j] -> [i,2i+j] : Exists ( alpha : 2alpha = 1+i && 5 <= i <= n && 2i+j <= m && 1 <= j)} + +# +# gist d11 - (d+ compose d) given d11; + +{[i,j] -> [i',Out_2] : i' <= 3} union + {[i,j] -> [i',Out_2] : Exists ( alpha : 0 = 1+i'+2alpha && 5 <= i)} + +# +# d12 - (d+ compose d); + +{[i,j] -> [i,j+4] : 2 <= i <= n && 1 <= j <= m-4} + +# +# gist d12 - (d+ compose d) given d12; + +{[i,j] -> [i',Out_2] : 2 <= i'} + +# diff --git a/omegalib/examples/old_test/closure4 b/omegalib/examples/old_test/closure4 new file mode 100644 index 0000000..e5adb13 --- /dev/null +++ b/omegalib/examples/old_test/closure4 @@ -0,0 +1,8 @@ +symbolic n,m; +R1 := {[x,y] -> [x,y+1] : 1 <= x,y <= 10}; +R2 := {[x,y] -> [x+1,y] : 1 <= x <= 20 && 5 <= y <= 15}; +R12 := R1 union R2; +R12c := R12+; +R12c; +(R12c compose R12c) - R12c; +(R12c compose R12) - R12c; diff --git a/omegalib/examples/old_test/closure4.oc-rt b/omegalib/examples/old_test/closure4.oc-rt new file mode 100644 index 0000000..d208cce --- /dev/null +++ b/omegalib/examples/old_test/closure4.oc-rt @@ -0,0 +1,28 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n,m; +# +# R1 := {[x,y] -> [x,y+1] : 1 <= x,y <= 10}; +# +# R2 := {[x,y] -> [x+1,y] : 1 <= x <= 20 && 5 <= y <= 15}; +# +# R12 := R1 union R2; +# +# R12c := R12+; +# +# R12c; + +{[x,y] -> [x,y'] : 1 <= y < y' <= 11 && 1 <= x <= 10} union + {[x,y] -> [x',y] : 1 <= x < x' <= 21 && 5 <= y <= 15} union + {[x,y] -> [x',y'] : 1 <= x < x' <= 21 && 1 <= y < y' <= 11 && x <= 10 && 5 <= y'} + +# +# (R12c compose R12c) - R12c; + +{[x,y] -> [x',y'] : FALSE } + +# +# (R12c compose R12) - R12c; + +{[x,y] -> [x',y'] : FALSE } + +# diff --git a/omegalib/examples/old_test/closure5 b/omegalib/examples/old_test/closure5 new file mode 100644 index 0000000..2792806 --- /dev/null +++ b/omegalib/examples/old_test/closure5 @@ -0,0 +1,6 @@ +symbolic n,m; +d11 := {[i,j] -> [i,2i+j] : 1 <= i <= n && 1 <= j,2i+j <= m}; +d12 := {[i,j] -> [i,j+4] : 1 <= i <= n && 1 <= j,j+4 <= m}; +d := d11 union d12; +e := d - (d+ compose d); +gist e given d; diff --git a/omegalib/examples/old_test/closure5.oc-rt b/omegalib/examples/old_test/closure5.oc-rt new file mode 100644 index 0000000..62ade41 --- /dev/null +++ b/omegalib/examples/old_test/closure5.oc-rt @@ -0,0 +1,18 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n,m; +# +# d11 := {[i,j] -> [i,2i+j] : 1 <= i <= n && 1 <= j,2i+j <= m}; +# +# d12 := {[i,j] -> [i,j+4] : 1 <= i <= n && 1 <= j,j+4 <= m}; +# +# d := d11 union d12; +# +# e := d - (d+ compose d); +# +# gist e given d; + +{[i,j] -> [i,2i+j] : 1 <= i <= 3, n && 1 <= j && 2i+j <= m} union + {[i,j] -> [i,2i+j] : Exists ( alpha : 2alpha = 1+i && 5 <= i <= n && 2i+j <= m && 1 <= j)} union + {[i,j] -> [i,j+4] : 2 <= i <= n && 1 <= j <= m-4} + +# diff --git a/omegalib/examples/old_test/closure6 b/omegalib/examples/old_test/closure6 new file mode 100644 index 0000000..777fbba --- /dev/null +++ b/omegalib/examples/old_test/closure6 @@ -0,0 +1,13 @@ + +T1 := {[k,i,j] -> [k',i,j] : 1 <= k < k' < j <= i <= 1024}; + +T2 := {[k,i,i] -> [i,i',j'] : 1 <= k < i < j' <= i' <= 1024}; + +T3 := {[k,i,j] -> [j,i',i] : 1 <= k < j < i <= i' <= 1024}; + +T := T1 union T2 union T3; + +B := {[k,i,j]: 1 <= k < j <= i <= 1024}; + +T + within B; + diff --git a/omegalib/examples/old_test/closure6.oc-rt b/omegalib/examples/old_test/closure6.oc-rt new file mode 100644 index 0000000..0eefdaa --- /dev/null +++ b/omegalib/examples/old_test/closure6.oc-rt @@ -0,0 +1,29 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# +# T1 := {[k,i,j] -> [k',i,j] : 1 <= k < k' < j <= i <= 1024}; +# +# +# T2 := {[k,i,i] -> [i,i',j'] : 1 <= k < i < j' <= i' <= 1024}; +# +# +# T3 := {[k,i,j] -> [j,i',i] : 1 <= k < j < i <= i' <= 1024}; +# +# +# T := T1 union T2 union T3; +# +# +# B := {[k,i,j]: 1 <= k < j <= i <= 1024}; +# +# +# T + within B; + +{[k,i,j] -> [j',i,j] : 1 <= k < j' < j <= i <= 1024} union + {[k,i,j] -> [j',i',Out_3] : 1 <= k < j < i < j' < Out_3 <= i' <= 1024} union + {[k,i,i] -> [j',i',Out_3] : 1 <= k < i < j' < Out_3 <= i' <= 1024} union + {[k,i,i] -> [i,i',Out_3] : 1 <= k < i < Out_3 <= i' <= 1024} union + {[k,i,j] -> [j,i',i] : 1 <= k < j < i <= i' <= 1024} union + {[k,i,j] -> [j',i',i] : 1 <= k < j < j' < i <= i' <= 1024} union + {[k,i,j] -> [i,i',Out_3] : 1 <= k < j < i < Out_3 <= i' <= 1024} + +# +# diff --git a/omegalib/examples/old_test/closure7 b/omegalib/examples/old_test/closure7 new file mode 100644 index 0000000..6ba2e1d --- /dev/null +++ b/omegalib/examples/old_test/closure7 @@ -0,0 +1,12 @@ + +R := {[t,s] -> [t+1,s] } union + {[t,s] -> [t,s] } union + {[t,s] -> [t,s+1] }; + +R; +R+; + +S := {[t,s] -> [t+1,s] } union {[t,s] -> [t,s+1] }; + +S; +S+; diff --git a/omegalib/examples/old_test/closure7.oc-rt b/omegalib/examples/old_test/closure7.oc-rt new file mode 100644 index 0000000..0de9745 --- /dev/null +++ b/omegalib/examples/old_test/closure7.oc-rt @@ -0,0 +1,36 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# +# R := {[t,s] -> [t+1,s] } union +# {[t,s] -> [t,s] } union +# {[t,s] -> [t,s+1] }; +# +# +# R; + +{[t,s] -> [t+1,s] } union + {[t,s] -> [t,s] } union + {[t,s] -> [t,s+1] } + +# +# R+; + +{[t,s] -> [t,s'] : s <= s'} union + {[t,s] -> [t',s'] : t < t' && s <= s'} + +# +# +# S := {[t,s] -> [t+1,s] } union {[t,s] -> [t,s+1] }; +# +# +# S; + +{[t,s] -> [t+1,s] } union + {[t,s] -> [t,s+1] } + +# +# S+; + +{[t,s] -> [t,s'] : s < s'} union + {[t,s] -> [t',s'] : t < t' && s <= s'} + +# diff --git a/omegalib/examples/old_test/closure8 b/omegalib/examples/old_test/closure8 new file mode 100644 index 0000000..b1f9b9b --- /dev/null +++ b/omegalib/examples/old_test/closure8 @@ -0,0 +1 @@ +{[i] -> [i]}+; diff --git a/omegalib/examples/old_test/closure8.oc-rt b/omegalib/examples/old_test/closure8.oc-rt new file mode 100644 index 0000000..90d5282 --- /dev/null +++ b/omegalib/examples/old_test/closure8.oc-rt @@ -0,0 +1,6 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# {[i] -> [i]}+; + +{[i] -> [i] } + +# diff --git a/omegalib/examples/old_test/collard b/omegalib/examples/old_test/collard new file mode 100644 index 0000000..0fb4ee4 --- /dev/null +++ b/omegalib/examples/old_test/collard @@ -0,0 +1,16 @@ +symbolic n; + +I1 := {[i,j] : 1 <= i < j <= n}; +I2 := {[i,j,K] : 1 <= i < j,K <= n}; +I3 := {[i] : 1 <= i <= n}; +I4 := {[i,j] : 1 <= j < i <= n}; +I5 := {[i] : 1 <= i <= n}; + +T1 := {[i,j] -> [1,i,0,n-i,n-j]}; +T2 := {[i,j,k] -> [1,i,1,n-j,k]}; +T3 := {[i] -> [0,0,0,0,i]}; +T4 := {[i,j] -> [2,j,1,i,j]}; +T5 := {[i] -> [2,i,0,0,0]}; + + +codegen T1:I1,T2:I2,T3:I3,T4:I4,T5:I5; diff --git a/omegalib/examples/old_test/collard.oc-rt b/omegalib/examples/old_test/collard.oc-rt new file mode 100644 index 0000000..9d2c8c0 --- /dev/null +++ b/omegalib/examples/old_test/collard.oc-rt @@ -0,0 +1,49 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n; +# +# +# I1 := {[i,j] : 1 <= i < j <= n}; +# +# I2 := {[i,j,K] : 1 <= i < j,K <= n}; +# +# I3 := {[i] : 1 <= i <= n}; +# +# I4 := {[i,j] : 1 <= j < i <= n}; +# +# I5 := {[i] : 1 <= i <= n}; +# +# +# T1 := {[i,j] -> [1,i,0,n-i,n-j]}; +# +# T2 := {[i,j,k] -> [1,i,1,n-j,k]}; +# +# T3 := {[i] -> [0,0,0,0,i]}; +# +# T4 := {[i,j] -> [2,j,1,i,j]}; +# +# T5 := {[i] -> [2,i,0,0,0]}; +# +# +# +# codegen T1:I1,T2:I2,T3:I3,T4:I4,T5:I5; +for(t5 = 1; t5 <= n; t5++) { + s3(t5); +} +for(t2 = 1; t2 <= n-1; t2++) { + for(t5 = 0; t5 <= n-t2-1; t5++) { + s1(t2,n-t5); + } + for(t4 = 0; t4 <= n-t2-1; t4++) { + for(t5 = t2+1; t5 <= n; t5++) { + s2(t2,n-t4,t5); + } + } +} +for(t2 = 1; t2 <= n; t2++) { + s5(t2); + for(t4 = t2+1; t4 <= n; t4++) { + s4(t4,t2); + } +} + +# diff --git a/omegalib/examples/old_test/cover b/omegalib/examples/old_test/cover new file mode 100644 index 0000000..2cfdacf --- /dev/null +++ b/omegalib/examples/old_test/cover @@ -0,0 +1,6 @@ +symbolic p(2), n, m; +R := { [ir,jr] : 1 <= ir <= n && 1 <= jr <= m }; +W1 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(Set) >= 0 }; +W2 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(Set) < 0 }; +Exposed := R intersection complement ( W1 union W2 ); +Exposed; diff --git a/omegalib/examples/old_test/cover.oc-rt b/omegalib/examples/old_test/cover.oc-rt new file mode 100644 index 0000000..1d25c6e --- /dev/null +++ b/omegalib/examples/old_test/cover.oc-rt @@ -0,0 +1,16 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic p(2), n, m; +# +# R := { [ir,jr] : 1 <= ir <= n && 1 <= jr <= m }; +# +# W1 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(Set) >= 0 }; +# +# W2 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(Set) < 0 }; +# +# Exposed := R intersection complement ( W1 union W2 ); +# +# Exposed; + +{[In_1,In_2] : FALSE } + +# diff --git a/omegalib/examples/old_test/dagstuhl1 b/omegalib/examples/old_test/dagstuhl1 new file mode 100644 index 0000000..56f1a4e --- /dev/null +++ b/omegalib/examples/old_test/dagstuhl1 @@ -0,0 +1,7 @@ +T := {[i,j] -> [i+10j]}; +I := {[0:9,0:9]}; +# Version 1.0.0 incorrectly generates references to i and j +codegen T:I; + +# Version 1.0.0 doesn't generate an assignment for t2 +codegen {[p,i,j] : 0 <= i,j <= 9 && p = i+10j}; diff --git a/omegalib/examples/old_test/dagstuhl1.oc-rt b/omegalib/examples/old_test/dagstuhl1.oc-rt new file mode 100644 index 0000000..7c3f019 --- /dev/null +++ b/omegalib/examples/old_test/dagstuhl1.oc-rt @@ -0,0 +1,23 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# T := {[i,j] -> [i+10j]}; +# +# I := {[0:9,0:9]}; +# +# # Version 1.0.0 incorrectly generates references to i and j +# codegen T:I; +for(t1 = 0; t1 <= 99; t1++) { + s1(intDiv(t1+-10*j,1),intDiv(t1-i,10)); +} + +# +# +# # Version 1.0.0 doesn't generate an assignment for t2 +# codegen {[p,i,j] : 0 <= i,j <= 9 && p = i+10j}; +for(t1 = 0; t1 <= 99; t1++) { + for(t2 = intMod(t1,10); t2 <= 9; t2 += 10) { + t3=intDiv((-t2+t1+9),10); + s1(t2+10*t3,t2,t3); + } +} + +# diff --git a/omegalib/examples/old_test/dagstuhl2 b/omegalib/examples/old_test/dagstuhl2 new file mode 100644 index 0000000..4cc3758 --- /dev/null +++ b/omegalib/examples/old_test/dagstuhl2 @@ -0,0 +1,6 @@ +{[i,j] : + 2i+6j>=9 + && 5i-3j >= 0 + && 2i-10j >= -15 + && -2i+6j >= 3 + && -2i-6j >= -17}; diff --git a/omegalib/examples/old_test/dagstuhl2.oc-rt b/omegalib/examples/old_test/dagstuhl2.oc-rt new file mode 100644 index 0000000..2cf1f8c --- /dev/null +++ b/omegalib/examples/old_test/dagstuhl2.oc-rt @@ -0,0 +1,11 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# {[i,j] : +# 2i+6j>=9 +# && 5i-3j >= 0 +# && 2i-10j >= -15 +# && -2i+6j >= 3 +# && -2i-6j >= -17}; + +{[i,j] : FALSE } + +# diff --git a/omegalib/examples/old_test/dagstuhl3 b/omegalib/examples/old_test/dagstuhl3 new file mode 100644 index 0000000..c63fdf8 --- /dev/null +++ b/omegalib/examples/old_test/dagstuhl3 @@ -0,0 +1,4 @@ +# In verify, we now prefer to eliminate wildcards last +# This gives us an improved chance of finding equality +# constraints on wildcards. +{[i,j] : 0 <= i,j <= 4 && exists(a:i=j+5a)}; diff --git a/omegalib/examples/old_test/dagstuhl3.oc-rt b/omegalib/examples/old_test/dagstuhl3.oc-rt new file mode 100644 index 0000000..6dbb128 --- /dev/null +++ b/omegalib/examples/old_test/dagstuhl3.oc-rt @@ -0,0 +1,9 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # In verify, we now prefer to eliminate wildcards last +# # This gives us an improved chance of finding equality +# # constraints on wildcards. +# {[i,j] : 0 <= i,j <= 4 && exists(a:i=j+5a)}; + +{[i,i]: 0 <= i <= 4} + +# diff --git a/omegalib/examples/old_test/davew1 b/omegalib/examples/old_test/davew1 new file mode 100644 index 0000000..2d8d907 --- /dev/null +++ b/omegalib/examples/old_test/davew1 @@ -0,0 +1,25 @@ +# +# A one point, we couldn't handling this analysis of value-based dependences. +# Now we can :-) +# + +Pos := {[In_1,In_2] -> [i,j] : 1 <= i,j <= 100 && + In_1 = 1+2j+i && 2i+In_2 = 1 }; + +ko := {[In_1,In_2] -> [i,j] : 1+In_1+2j = 4i && In_2+i+2j = 0 && + 1 <= i <= 100 && 1 <= j <= 100}; + +kf := {[i,j] -> [i',j'] : 1 <= i,i',j,j' <= 100 && i < i' && + 4i = 2+2j+2j'+i' && 2i' = 1+2j+i }; + +k := ko join kf; + +k intersection Pos; +example (k intersection Pos); +Pos; +Pos - (ko join kf); +Pos - k; +answer := Pos - k; +answer; +answer intersection {[7,-7] -> [4,1]}; +gist answer given Pos; diff --git a/omegalib/examples/old_test/davew1.oc-rt b/omegalib/examples/old_test/davew1.oc-rt new file mode 100644 index 0000000..bc9844c --- /dev/null +++ b/omegalib/examples/old_test/davew1.oc-rt @@ -0,0 +1,67 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # +# # A one point, we couldn't handling this analysis of value-based dependences. +# # Now we can :-) +# # +# +# Pos := {[In_1,In_2] -> [i,j] : 1 <= i,j <= 100 && +# In_1 = 1+2j+i && 2i+In_2 = 1 }; +# +# +# ko := {[In_1,In_2] -> [i,j] : 1+In_1+2j = 4i && In_2+i+2j = 0 && +# 1 <= i <= 100 && 1 <= j <= 100}; +# +# +# kf := {[i,j] -> [i',j'] : 1 <= i,i',j,j' <= 100 && i < i' && +# 4i = 2+2j+2j'+i' && 2i' = 1+2j+i }; +# +# +# k := ko join kf; +# +# +# k intersection Pos; + +{[In_1,In_2] -> [i,j] : Exists ( alpha : In_2+2i = 1 && 2In_1+In_2 = 3+4j && In_2 = 5+8j+20alpha && -199 <= In_2 <= -2j-5 && 1 <= j)} + +# +# example (k intersection Pos); + +{[7,-7] -> [4,1] } + +# +# Pos; + +{[In_1,In_2] -> [i,j] : In_1 = 1+i+2j && In_2+2i = 1 && 1 <= i <= 100 && 1 <= j <= 100} + +# +# Pos - (ko join kf); + +{[In_1,In_2] -> [i,j] : In_1 = 1+i+2j && In_2+2i = 1 && 1 <= i <= j+2, 100 && 1 <= j <= 100} union + {[In_1,In_2] -> [i,j] : Exists ( alpha : In_1 = 1+i+2j && In_2+2i = 1 && j+3 <= i <= 100 && 5+10alpha <= 3i+2j && 3i+2j <= 13+10alpha && 1 <= j)} + +# +# Pos - k; + +{[In_1,In_2] -> [i,j] : 1+i+2j = In_1 && 2In_1+In_2 = 3+4j && 2j+2 <= In_1 <= 3j+3, 2j+101 && 1 <= j <= 100} union + {[In_1,In_2] -> [i,j] : Exists ( alpha : 1+i+2j = In_1 && 2In_1+In_2 = 3+4j && 3j+4 <= In_1 <= 2j+101 && 8+4j+10alpha <= 3In_1 && 3In_1 <= 16+4j+10alpha && 1 <= j)} + +# +# answer := Pos - k; +# +# answer; + +{[In_1,In_2] -> [i,j] : 1+i+2j = In_1 && 2In_1+In_2 = 3+4j && 2j+2 <= In_1 <= 3j+3, 2j+101 && 1 <= j <= 100} union + {[In_1,In_2] -> [i,j] : Exists ( alpha : 1+i+2j = In_1 && 2In_1+In_2 = 3+4j && 3j+4 <= In_1 <= 2j+101 && 8+4j+10alpha <= 3In_1 && 3In_1 <= 16+4j+10alpha && 1 <= j)} + +# +# answer intersection {[7,-7] -> [4,1]}; + +{[In_1,In_2] -> [i,j] : FALSE } + +# +# gist answer given Pos; + +{[In_1,In_2] -> [i,j] : i <= j+2} union + {[In_1,In_2] -> [i,j] : Exists ( alpha : j <= i-3 && 3i+2j <= 13+10alpha && 5+10alpha <= 3i+2j)} + +# diff --git a/omegalib/examples/old_test/ddtest b/omegalib/examples/old_test/ddtest new file mode 100644 index 0000000..27b1ff3 --- /dev/null +++ b/omegalib/examples/old_test/ddtest @@ -0,0 +1,97 @@ +symbolic p(2), n, m1, m2, low; + +R := { [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 }; + +f1i := { [iw,jw] -> [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 && + 1 <= iw <= n && 1 <= jw <= m2 && + jw = jr && + iw = ir }; +f1f := { [iw,jw] -> [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 && + 1 <= iw <= n && 1 <= jw <= m2 && + jw = jr && + iw < ir }; + +f3i := { [iw,jw] -> [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 && + 1 <= iw <= n && 1 < low <= jw <= m1 && + jw-1 = jr && + iw = ir }; +f3f := { [iw,jw] -> [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 && + 1 <= iw <= n && 1 < low <= jw <= m1 && + jw-1 = jr && + iw < ir }; + +o31i := { [iw3,jw3] -> [iw1,jw1] : 1 <= iw1 <= n && 1 <= jw1 <= m2 && + 1 <= iw3 <= n && 1 < low <= jw3 <= m1 && + jw1 = jw3-1 && + iw1 = iw3 }; + +o13f := { [iw1,jw1] -> [iw3,jw3] : 1 <= iw1 <= n && 1 <= jw1 <= m2 && + 1 <= iw3 <= n && 1 < low <= jw3 <= m1 && + jw1 = jw3-1 && + iw1 < iw3 }; + +o31f := { [iw3,jw3] -> [iw1,jw1] : 1 <= iw1 <= n && 1 <= jw1 <= m2 && + 1 <= iw3 <= n && 1 < low <= jw3 <= m1 && + jw1 = jw3-1 && + iw3 < iw1 }; + +o11f := { [iw1a,jw1a] -> [iw1b,jw1b] : 1 <=iw1a<= n && 1 <=jw1a<= m2 && + 1 <=iw1b<= n && 1 <=jw1b<= m2 && + jw1a = jw1b && + iw1a < iw1b }; +o33f := { [iw3a,jw3a] -> [iw3b,jw3b] : 1 <=iw3a<= n && 1 < low <=jw3a<= m1 && + 1 <=iw3b<= n && 1 < low <=jw3b<= m1 && + jw3a-1 = jw3b-1 && + iw3a < iw3b }; + + +# FIRST GROUP - 1i and 2i (NO POSSIBLE OUTPUT DEPS. BETWEEN) +v1i := f1i; +v1i; + +Exposed12i := R intersection complement domain f1i; +Exposed12i; + +# SECOND GROUP - 3i +v3i := f3i / Exposed12i; # / is restrictRange +v3i; + +Exposed3i := R intersection complement domain f3i; +Exposed3i; + +# THIRD GROUP - 1,2,3f (THERE ARE POSSIBLE OUTPUT DEPS BETWEEN THEM) + +v1f := ( f1f / Exposed3i ) + intersection complement ( f3i compose o13f ) + intersection complement ( f3f compose o13f ) + intersection complement ( f1i compose o11f ) + intersection complement ( f1f compose o11f ); +v1f; + +# WE SHOULD BE ABLE TO DO v1f WITH SOME VALUE-BASED FLOW DD'S + +v1f_val := ( f1f / Exposed3i ) + intersection complement ( v3i compose o13f ) + intersection complement ( f3f compose o13f ) + intersection complement ( v1i compose o11f ) + intersection complement ( f1f compose o11f ); +v1f_val; + +# +# The effects of loop-independent flow have been taken out already, +# so this should work. But it does not. Probably I am stupyd. +# + +v1f_clever := ( f1f / Exposed3i ) + intersection complement ( f3f compose o13f ) + intersection complement ( f1f compose o11f ); +v1f_clever; + +# +# NOW CHECK FOR EQUIVALENCES - THESE SHOULD BE TRUE +# + +v1f subset v1f_val; +v1f_val subset v1f; +# v1f subset v1f_clever; +# v1f_clever subset v1f; diff --git a/omegalib/examples/old_test/ddtest.oc-rt b/omegalib/examples/old_test/ddtest.oc-rt new file mode 100644 index 0000000..1c3e009 --- /dev/null +++ b/omegalib/examples/old_test/ddtest.oc-rt @@ -0,0 +1,152 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic p(2), n, m1, m2, low; +# +# +# R := { [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 }; +# +# +# f1i := { [iw,jw] -> [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 && +# 1 <= iw <= n && 1 <= jw <= m2 && +# jw = jr && +# iw = ir }; +# +# f1f := { [iw,jw] -> [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 && +# 1 <= iw <= n && 1 <= jw <= m2 && +# jw = jr && +# iw < ir }; +# +# +# f3i := { [iw,jw] -> [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 && +# 1 <= iw <= n && 1 < low <= jw <= m1 && +# jw-1 = jr && +# iw = ir }; +# +# f3f := { [iw,jw] -> [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 && +# 1 <= iw <= n && 1 < low <= jw <= m1 && +# jw-1 = jr && +# iw < ir }; +# +# +# o31i := { [iw3,jw3] -> [iw1,jw1] : 1 <= iw1 <= n && 1 <= jw1 <= m2 && +# 1 <= iw3 <= n && 1 < low <= jw3 <= m1 && +# jw1 = jw3-1 && +# iw1 = iw3 }; +# +# +# o13f := { [iw1,jw1] -> [iw3,jw3] : 1 <= iw1 <= n && 1 <= jw1 <= m2 && +# 1 <= iw3 <= n && 1 < low <= jw3 <= m1 && +# jw1 = jw3-1 && +# iw1 < iw3 }; +# +# +# o31f := { [iw3,jw3] -> [iw1,jw1] : 1 <= iw1 <= n && 1 <= jw1 <= m2 && +# 1 <= iw3 <= n && 1 < low <= jw3 <= m1 && +# jw1 = jw3-1 && +# iw3 < iw1 }; +# +# +# o11f := { [iw1a,jw1a] -> [iw1b,jw1b] : 1 <=iw1a<= n && 1 <=jw1a<= m2 && +# 1 <=iw1b<= n && 1 <=jw1b<= m2 && +# jw1a = jw1b && +# iw1a < iw1b }; +# +# o33f := { [iw3a,jw3a] -> [iw3b,jw3b] : 1 <=iw3a<= n && 1 < low <=jw3a<= m1 && +# 1 <=iw3b<= n && 1 < low <=jw3b<= m1 && +# jw3a-1 = jw3b-1 && +# iw3a < iw3b }; +# +# +# +# # FIRST GROUP - 1i and 2i (NO POSSIBLE OUTPUT DEPS. BETWEEN) +# v1i := f1i; +# +# v1i; + +{[iw,jw] -> [iw,jw] : 1 <= jw <= m1, m2 && 1 <= iw <= n} + +# +# +# Exposed12i := R intersection complement domain f1i; +# +# Exposed12i; + +{[In_1,In_2]: 1, m2+1 <= In_2 <= m1 && 1 <= In_1 <= n} + +# +# +# # SECOND GROUP - 3i +# v3i := f3i / Exposed12i; +# # / is restrictRange +# v3i; + +{[iw,jw] -> [iw,jw-1] : 2 <= low <= jw <= m1 && 1 <= iw <= n && m2 <= jw-2} + +# +# +# Exposed3i := R intersection complement domain f3i; +# +# Exposed3i; + +{[In_1,In_2]: 1 <= In_1 <= n && 1 <= In_2 <= m1 && low <= 1} union + {[In_1,In_2]: 1 <= In_2 <= m1, low-1 && 1 <= In_1 <= n} + +# +# +# # THIRD GROUP - 1,2,3f (THERE ARE POSSIBLE OUTPUT DEPS BETWEEN THEM) +# +# v1f := ( f1f / Exposed3i ) +# intersection complement ( f3i compose o13f ) +# intersection complement ( f3f compose o13f ) +# intersection complement ( f1i compose o11f ) +# intersection complement ( f1f compose o11f ); +# +# v1f; + +{[iw1a,jw1a] -> [ir,jr] : FALSE } + +# +# +# # WE SHOULD BE ABLE TO DO v1f WITH SOME VALUE-BASED FLOW DD'S +# +# v1f_val := ( f1f / Exposed3i ) +# intersection complement ( v3i compose o13f ) +# intersection complement ( f3f compose o13f ) +# intersection complement ( v1i compose o11f ) +# intersection complement ( f1f compose o11f ); +# +# v1f_val; + +{[iw1a,jw1a] -> [ir,jr] : FALSE } + +# +# +# # +# # The effects of loop-independent flow have been taken out already, +# # so this should work. But it does not. Probably I am stupyd. +# # +# +# v1f_clever := ( f1f / Exposed3i ) +# intersection complement ( f3f compose o13f ) +# intersection complement ( f1f compose o11f ); +# +# v1f_clever; + +{[iw1a,jw1a] -> [iw1a+1,jw1a] : 1 <= jw1a <= m2, m1 && 1 <= iw1a < n && low <= 1} union + {[iw1a,jw1a] -> [iw1a+1,jw1a] : 1 <= jw1a <= m2, m1, low-1 && 1 <= iw1a < n} + +# +# +# # +# # NOW CHECK FOR EQUIVALENCES - THESE SHOULD BE TRUE +# # +# +# v1f subset v1f_val; + +True +# +# v1f_val subset v1f; + +True +# +# # v1f subset v1f_clever; +# # v1f_clever subset v1f; diff --git a/omegalib/examples/old_test/emit b/omegalib/examples/old_test/emit new file mode 100644 index 0000000..3b33a98 --- /dev/null +++ b/omegalib/examples/old_test/emit @@ -0,0 +1,38 @@ +# +# A problem that arises during the analysis of emit.t +# We are trying to find the dependences to the read 58: rhs(i) +# There are memory-based deps from the write 58: rhs(j) +# and the write 50: rhs(i0+k) +# Due to some screwy stuff, we do not realize that the first is +# a partial cover for the second, and do the real kill test. +# +# line_49_expr is nwall(l) +# + +symbolic matdim_E, i0_1(1), line_49_expr(1); + +is_58 := { [i,j] : i+1 <= j <= matdim_E && 1 <= i <= matdim_E }; +is_50 := { [l,k] : 1 <= k <= line_49_expr(Set) && 1 <= l <= 5 }; + +plus_plus := { [i,j] -> [i',j'] : i < i' && j < j' }; +plus_zero := { [i,j] -> [i',j'] : i < i' && j = j' }; +plus_star := { [i,j] -> [i',j'] : i < i' }; + +mo_50_50 := (is_50 * is_50) intersection plus_star + intersection { [l1,k1]->[l2,k2] : i0_1(In)+k1 = i0_1(Out)+k2 }; +mo_50_58 := (is_50 * is_58) + intersection { [l,k] -> [i,j] : i0_1(In)+k = j }; +mo_58_58 := (is_58 * is_58) intersection plus_zero + intersection { [i,j] -> [i',j'] : j = j' }; + +mf_58_58 := (is_58 * is_58) intersection plus_plus + intersection { [iw,jw] -> [ir,jr] : jw = ir }; +mf_50_58 := (is_50 * is_58) + intersection { [l,k] -> [i,j] : i0_1(In)+k = i }; + +vf_58_58 := mf_58_58 - (mf_58_58 compose mo_58_58); +vf_58_58; + +vf_50_58 := mf_50_58 intersection ( complement (mf_58_58 compose mo_50_58) ) + intersection ( complement (mf_50_58 compose mo_50_50) ); +vf_50_58; diff --git a/omegalib/examples/old_test/emit.oc-rt b/omegalib/examples/old_test/emit.oc-rt new file mode 100644 index 0000000..1bf7d6c --- /dev/null +++ b/omegalib/examples/old_test/emit.oc-rt @@ -0,0 +1,61 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # +# # A problem that arises during the analysis of emit.t +# # We are trying to find the dependences to the read 58: rhs(i) +# # There are memory-based deps from the write 58: rhs(j) +# # and the write 50: rhs(i0+k) +# # Due to some screwy stuff, we do not realize that the first is +# # a partial cover for the second, and do the real kill test. +# # +# # line_49_expr is nwall(l) +# # +# +# Symbolic matdim_E, i0_1(1), line_49_expr(1); +# +# +# is_58 := { [i,j] : i+1 <= j <= matdim_E && 1 <= i <= matdim_E }; +# +# is_50 := { [l,k] : 1 <= k <= line_49_expr(Set) && 1 <= l <= 5 }; +# +# +# plus_plus := { [i,j] -> [i',j'] : i < i' && j < j' }; +# +# plus_zero := { [i,j] -> [i',j'] : i < i' && j = j' }; +# +# plus_star := { [i,j] -> [i',j'] : i < i' }; +# +# +# mo_50_50 := (is_50 * is_50) intersection plus_star +# intersection { [l1,k1]->[l2,k2] : i0_1(In)+k1 = i0_1(Out)+k2 }; +# +# mo_50_58 := (is_50 * is_58) +# intersection { [l,k] -> [i,j] : i0_1(In)+k = j }; +# +# mo_58_58 := (is_58 * is_58) intersection plus_zero +# intersection { [i,j] -> [i',j'] : j = j' }; +# +# +# mf_58_58 := (is_58 * is_58) intersection plus_plus +# intersection { [iw,jw] -> [ir,jr] : jw = ir }; +# +# mf_50_58 := (is_50 * is_58) +# intersection { [l,k] -> [i,j] : i0_1(In)+k = i }; +# +# +# vf_58_58 := mf_58_58 - (mf_58_58 compose mo_58_58); +# +# vf_58_58; + +{[i,i+1] -> [i+1,Out_2] : 1 <= i <= Out_2-2 && Out_2 <= matdim_E} + +# +# +# vf_50_58 := mf_50_58 intersection ( complement (mf_58_58 compose mo_50_58) ) +# intersection ( complement (mf_50_58 compose mo_50_50) ); +# +# vf_50_58; + +{[In_1,-i0_1(In_1)+1] -> [1,j] : -line_49_expr(In_1)+1 <= i0_1(In_1) <= 0 && 1 <= In_1 <= 4 && 2 <= j <= matdim_E && UNKNOWN} union + {[In_1,-i0_1(In_1)+1] -> [1,j] : In_1 = 5 && -line_49_expr(In_1)+1 <= i0_1(In_1) <= 0 && 2 <= j <= matdim_E} + +# diff --git a/omegalib/examples/old_test/example1 b/omegalib/examples/old_test/example1 new file mode 100644 index 0000000..0721b20 --- /dev/null +++ b/omegalib/examples/old_test/example1 @@ -0,0 +1,4 @@ +foo := {[In_1,In_2] -> [i,j] : exists ( alpha : In_2+2i = 1 && 2In_1+In_2 = 3+4j && In_2+20alpha = 5+8j && -199 <= In_2 <= -2j-5 && 1 <= j)}; +example foo; + + diff --git a/omegalib/examples/old_test/example1.oc-rt b/omegalib/examples/old_test/example1.oc-rt new file mode 100644 index 0000000..89b2e0a --- /dev/null +++ b/omegalib/examples/old_test/example1.oc-rt @@ -0,0 +1,10 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# foo := {[In_1,In_2] -> [i,j] : Exists ( alpha : In_2+2i = 1 && 2In_1+In_2 = 3+4j && In_2+20alpha = 5+8j && -199 <= In_2 <= -2j-5 && 1 <= j)}; +# +# example foo; + +{[7,-7] -> [4,1] } + +# +# +# diff --git a/omegalib/examples/old_test/farkas b/omegalib/examples/old_test/farkas new file mode 100644 index 0000000..ce754fc --- /dev/null +++ b/omegalib/examples/old_test/farkas @@ -0,0 +1,8 @@ + +symbolic n; +symbolic c; + +R := {[i,j] : 1 <= i <= 10 && 1 <= j <= n}; + +ac := farkas R; +ac; diff --git a/omegalib/examples/old_test/farkas.oc-rt b/omegalib/examples/old_test/farkas.oc-rt new file mode 100644 index 0000000..cd52e5e --- /dev/null +++ b/omegalib/examples/old_test/farkas.oc-rt @@ -0,0 +1,17 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# +# symbolic n; +# +# symbolic c; +# +# +# R := {[i,j] : 1 <= i <= 10 && 1 <= j <= n}; +# +# +# ac := farkas R; +# +# ac; + +{[i,j]: 0 <= constantTerm+n+i+j && 0 <= constantTerm+n+10i+j && 0 <= n+j && 0 <= n} + +# diff --git a/omegalib/examples/old_test/farkas2 b/omegalib/examples/old_test/farkas2 new file mode 100644 index 0000000..2781423 --- /dev/null +++ b/omegalib/examples/old_test/farkas2 @@ -0,0 +1,6 @@ + +R := {[1:10,1:10]} union {[5:15,11:20]}; +R; +f := farkas R; +f; +Hull R; diff --git a/omegalib/examples/old_test/farkas2.oc-rt b/omegalib/examples/old_test/farkas2.oc-rt new file mode 100644 index 0000000..22d43cc --- /dev/null +++ b/omegalib/examples/old_test/farkas2.oc-rt @@ -0,0 +1,22 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# +# R := {[1:10,1:10]} union {[5:15,11:20]}; +# +# R; + +{[In_1,In_2]: 1 <= In_1 <= 10 && 1 <= In_2 <= 10} union + {[In_1,In_2]: 5 <= In_1 <= 15 && 11 <= In_2 <= 20} + +# +# f := farkas R; +# +# f; + +{[In_1,In_2]: 0 <= constantTerm+10In_1+In_2 && 0 <= constantTerm+In_1+10In_2 && 0 <= constantTerm+15In_1+20In_2 && 0 <= constantTerm+In_1+In_2 && 0 <= constantTerm+15In_1+11In_2 && 0 <= constantTerm+5In_1+20In_2} + +# +# Hull R; + +{[In_1,In_2]: 1, 2In_1-19 <= In_2 <= 20 && 1 <= In_1 <= 15 && 2In_2 <= 15+5In_1} + +# diff --git a/omegalib/examples/old_test/farkas3 b/omegalib/examples/old_test/farkas3 new file mode 100644 index 0000000..8adec2e --- /dev/null +++ b/omegalib/examples/old_test/farkas3 @@ -0,0 +1,3 @@ + +R := {[1:10,1:10,1:10,1:10]}; +AffineHull R; diff --git a/omegalib/examples/old_test/farkas3.oc-rt b/omegalib/examples/old_test/farkas3.oc-rt new file mode 100644 index 0000000..095cb54 --- /dev/null +++ b/omegalib/examples/old_test/farkas3.oc-rt @@ -0,0 +1,9 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# +# R := {[1:10,1:10,1:10,1:10]}; +# +# AffineHull R; + +{[In_1,In_2,In_3,In_4]} + +# diff --git a/omegalib/examples/old_test/fc1 b/omegalib/examples/old_test/fc1 new file mode 100644 index 0000000..66a9e90 --- /dev/null +++ b/omegalib/examples/old_test/fc1 @@ -0,0 +1,23 @@ +symbolic n; + +I1 := {[i,j] : 1 <= i < j <= n}; +I2 := {[i,j,k] : 1 <= i < j,k <= n}; +I3 := {[i] : 1 <= i <= n}; +I4 := {[i,j] : 1 <= j < i <= n}; +I5 := {[i] : 1 <= i <= n}; + +T1 := {[i,j] -> [i-1,0,n-i,n-j]}; +T2 := {[i,j,k] -> [i-1,1,n-i,n-j]}; +T3 := {[i] -> [0,0,0,i]}; +T4 := {[i,j] -> [j+n-1,0,i,j]}; +T5 := {[i] -> [i+n-2,1,0,0]}; + +T1(I1); +T2(I2); +T3(I3); +T4(I4); +T5(I5); +codegen T1:I1,T2:I2; +codegen T1:I1,T2:I2,T3:I3,T4:I4,T5:I5; +codegen 2 T1:I1,T2:I2,T3:I3,T4:I4,T5:I5; + diff --git a/omegalib/examples/old_test/fc1.oc-rt b/omegalib/examples/old_test/fc1.oc-rt new file mode 100644 index 0000000..8075f2d --- /dev/null +++ b/omegalib/examples/old_test/fc1.oc-rt @@ -0,0 +1,89 @@ +>>> symbolic n; +>>> +>>> I1 := {[i,j] : 1 <= i < j <= n}; +>>> I2 := {[i,j,k] : 1 <= i < j,k <= n}; +>>> I3 := {[i] : 1 <= i <= n}; +>>> I4 := {[i,j] : 1 <= j < i <= n}; +>>> I5 := {[i] : 1 <= i <= n}; +>>> +>>> T1 := {[i,j] -> [i-1,0,n-i,n-j]}; +>>> T2 := {[i,j,k] -> [i-1,1,n-i,n-j]}; +>>> T3 := {[i] -> [0,0,0,i]}; +>>> T4 := {[i,j] -> [j+n-1,0,i,j]}; +>>> T5 := {[i] -> [i+n-2,1,0,0]}; +>>> +>>> T1(I1); +{[In_1,0,n-In_1-1,In_4]: 0 <= In_1 && 2+In_1+In_4 <= n && 0 <= In_4} +>>> T2(I2); +{[In_1,1,n-In_1-1,In_4]: 0 <= In_1 && 2+In_1+In_4 <= n && 0 <= In_4} +>>> T3(I3); +{[0,0,0,i]: 1 <= i <= n} +>>> T4(I4); +{[In_1,0,i,In_1-n+1]: i <= n <= In_1 && 2+In_1 <= n+i} +>>> T5(I5); +{[In_1,1,0,0]: n-1 <= In_1 <= 2n-2} +>>> codegen T1:I1,T2:I2; +for(t1 = 0; t1 <= n-2; t1++) { + for(t4 = 0; t4 <= -t1+n-2; t4++) { + s1(t1+1,n-t4); + } + for(t4 = 0; t4 <= -t1+n-2; t4++) { + s2(t1+1,n-t4,N/A); + } +} + +>>> codegen T1:I1,T2:I2,T3:I3,T4:I4,T5:I5; +for(t1 = 0; t1 <= 2*n-2; t1++) { + if (t1 <= 0) { + for(t4 = 1; t4 <= n; t4++) { + s3(t4); + } + } + for(t4 = 0; t4 <= -t1+n-2; t4++) { + s1(t1+1,n-t4); + } + if (t1 >= n) { + for(t3 = -n+t1+2; t3 <= n; t3++) { + s4(t3,t1-n+1); + } + } + for(t4 = 0; t4 <= -t1+n-2; t4++) { + s2(t1+1,n-t4,N/A); + } + if (t1 >= n-1) { + s5(-n+t1+2); + } +} + +>>> codegen 2 T1:I1,T2:I2,T3:I3,T4:I4,T5:I5; +for(t4 = 1; t4 <= n; t4++) { + s3(t4); +} +for(t4 = 0; t4 <= n-2; t4++) { + s1(1,-t4+n); +} +for(t4 = 0; t4 <= n-2; t4++) { + s2(1,-t4+n,N/A); +} +if (n == 1) { + s5(-n+2); +} +for(t1 = 1; t1 <= n-2; t1++) { + for(t4 = 0; t4 <= -t1+n-2; t4++) { + s1(t1+1,n-t4); + } + for(t4 = 0; t4 <= -t1+n-2; t4++) { + s2(t1+1,n-t4,N/A); + } +} +if (n >= 2) { + s5(1); +} +for(t1 = max(n,1); t1 <= 2*n-2; t1++) { + for(t3 = t1-n+2; t3 <= n; t3++) { + s4(t3,t1-n+1); + } + s5(-n+t1+2); +} + + diff --git a/omegalib/examples/old_test/fc2 b/omegalib/examples/old_test/fc2 new file mode 100644 index 0000000..b195d72 --- /dev/null +++ b/omegalib/examples/old_test/fc2 @@ -0,0 +1,29 @@ +symbolic n; + +I1 := {[i,j] : 1 <= i < j <= n}; +I2 := {[i,j,k] : 1 <= i < j,k <= n}; +I3 := {[i] : 1 <= i <= n}; +I4 := {[i,j] : 1 <= j < i <= n}; +I5 := {[i] : 1 <= i <= n}; + +T1 := {[i,j] -> [i-1,0,n-i,n-j]}; +T2 := {[i,j,k] -> [i-1,1,n-i,n-j]}; +T3 := {[i] -> [0,0,0,i]}; +T4 := {[i,j] -> [j+n-1,0,i,j]}; +T5 := {[i] -> [i+n-2,1,0,0]}; + +first := {[i,*,*,*] -> [i]}; + +first(T1(I1)); +first(T2(I2)); +first(T3(I3)); +first(T4(I4)); +first(T5(I5)); +T1(I1); +T2(I2); +T3(I3); +T4(I4); +T5(I5); +codegen T1:I1,T2:I2; +codegen T1:I1,T2:I2,T3:I3,T4:I4,T5:I5; + diff --git a/omegalib/examples/old_test/fc2.oc-rt b/omegalib/examples/old_test/fc2.oc-rt new file mode 100644 index 0000000..742929e --- /dev/null +++ b/omegalib/examples/old_test/fc2.oc-rt @@ -0,0 +1,115 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n; +# +# +# I1 := {[i,j] : 1 <= i < j <= n}; +# +# I2 := {[i,j,k] : 1 <= i < j,k <= n}; +# +# I3 := {[i] : 1 <= i <= n}; +# +# I4 := {[i,j] : 1 <= j < i <= n}; +# +# I5 := {[i] : 1 <= i <= n}; +# +# +# T1 := {[i,j] -> [i-1,0,n-i,n-j]}; +# +# T2 := {[i,j,k] -> [i-1,1,n-i,n-j]}; +# +# T3 := {[i] -> [0,0,0,i]}; +# +# T4 := {[i,j] -> [j+n-1,0,i,j]}; +# +# T5 := {[i] -> [i+n-2,1,0,0]}; +# +# +# first := {[i,*,*,*] -> [i]}; +# +# +# first(T1(I1)); + +{[i]: 0 <= i <= n-2} + +# +# first(T2(I2)); + +{[i]: 0 <= i <= n-2} + +# +# first(T3(I3)); + +{[0]: 1 <= n} + +# +# first(T4(I4)); + +{[i]: n <= i <= 2n-2} + +# +# first(T5(I5)); + +{[i]: n-1 <= i <= 2n-2} + +# +# T1(I1); + +{[In_1,0,n-In_1-1,In_4]: 0 <= In_1 && 2+In_1+In_4 <= n && 0 <= In_4} + +# +# T2(I2); + +{[In_1,1,n-In_1-1,In_4]: 0 <= In_1 && 2+In_1+In_4 <= n && 0 <= In_4} + +# +# T3(I3); + +{[0,0,0,i]: 1 <= i <= n} + +# +# T4(I4); + +{[In_1,0,i,In_1-n+1]: i <= n <= In_1 && 2+In_1 <= n+i} + +# +# T5(I5); + +{[In_1,1,0,0]: n-1 <= In_1 <= 2n-2} + +# +# codegen T1:I1,T2:I2; +for(t1 = 0; t1 <= n-2; t1++) { + for(t4 = 0; t4 <= -t1+n-2; t4++) { + s1(t1+1,n-t4); + } + for(t4 = 0; t4 <= -t1+n-2; t4++) { + s2(t1+1,n-t4); + } +} + +# +# codegen T1:I1,T2:I2,T3:I3,T4:I4,T5:I5; +for(t1 = 0; t1 <= 2*n-2; t1++) { + if (t1 <= 0) { + for(t4 = 1; t4 <= n; t4++) { + s3(t4); + } + } + for(t4 = 0; t4 <= -t1+n-2; t4++) { + s1(t1+1,n-t4); + } + if (t1 >= n) { + for(t3 = t1-n+2; t3 <= n; t3++) { + s4(t3,t1-n+1); + } + } + for(t4 = 0; t4 <= -t1+n-2; t4++) { + s2(t1+1,n-t4); + } + if (t1 >= n-1) { + s5(t1-n+2); + } +} + +# +# diff --git a/omegalib/examples/old_test/foo b/omegalib/examples/old_test/foo new file mode 100644 index 0000000..1a5ef46 --- /dev/null +++ b/omegalib/examples/old_test/foo @@ -0,0 +1,13 @@ + +R := {[t,s] -> [t+2,s+2] : t <= s} union + {[t,s] -> [t+4,s+4] : t <= s} union + {[t,s] -> [t+3,s+3] : t <= s} union + {[t,s] -> [t',s-t+t'] : t <= s, t'-5} union + {[t,s] -> [t+1,s+1] : t <= s} union + {[t,s] -> [t',s-t+t'] : t <= s-1, t'-2}; +R; +difference R; +Hull difference R; + +Hull R; + diff --git a/omegalib/examples/old_test/foo.oc-rt b/omegalib/examples/old_test/foo.oc-rt new file mode 100644 index 0000000..3f7f5a9 --- /dev/null +++ b/omegalib/examples/old_test/foo.oc-rt @@ -0,0 +1,37 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# +# R := {[t,s] -> [t+2,s+2] : t <= s} union +# {[t,s] -> [t+4,s+4] : t <= s} union +# {[t,s] -> [t+3,s+3] : t <= s} union +# {[t,s] -> [t',s-t+t'] : t <= s, t'-5} union +# {[t,s] -> [t+1,s+1] : t <= s} union +# {[t,s] -> [t',s-t+t'] : t <= s-1, t'-2}; +# +# R; + +{[t,s] -> [t+2,s+2] : t <= s} union + {[t,s] -> [t+4,s+4] : t <= s} union + {[t,s] -> [t+3,s+3] : t <= s} union + {[t,s] -> [t',s-t+t'] : t <= s, t'-5} union + {[t,s] -> [t+1,s+1] : t <= s} union + {[t,s] -> [t',s-t+t'] : t <= s-1, t'-2} + +# +# difference R; + +{[1,1]} union + {[In_1,In_1]: 2 <= In_1} + +# +# hull difference R; + +{[In_1,In_1]: 1 <= In_1} + +# +# +# Hull R; + +{[t,s] -> [t',s-t+t'] : t <= s, t'-1} + +# +# diff --git a/omegalib/examples/old_test/foo2 b/omegalib/examples/old_test/foo2 new file mode 100644 index 0000000..69a63da --- /dev/null +++ b/omegalib/examples/old_test/foo2 @@ -0,0 +1,3 @@ +Hull( {[1,1]} union + {[In_1,In_1]: 2 <= In_1}); + diff --git a/omegalib/examples/old_test/foo2.oc-rt b/omegalib/examples/old_test/foo2.oc-rt new file mode 100644 index 0000000..c8f0209 --- /dev/null +++ b/omegalib/examples/old_test/foo2.oc-rt @@ -0,0 +1,8 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# hull( {[1,1]} union +# {[In_1,In_1]: 2 <= In_1}); + +{[In_1,In_1]: 1 <= In_1} + +# +# diff --git a/omegalib/examples/old_test/foo6 b/omegalib/examples/old_test/foo6 new file mode 100644 index 0000000..0b702cd --- /dev/null +++ b/omegalib/examples/old_test/foo6 @@ -0,0 +1 @@ +approximate {[i,j] : exists (a,b : a,b >= 0 && i = -201a-3b && j = 103a+200b)}; diff --git a/omegalib/examples/old_test/foo6.oc-rt b/omegalib/examples/old_test/foo6.oc-rt new file mode 100644 index 0000000..aeb1b67 --- /dev/null +++ b/omegalib/examples/old_test/foo6.oc-rt @@ -0,0 +1,6 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# approximate {[i,j] : exists (a,b : a,b >= 0 && i = -201a-3b && j = 103a+200b)}; + +{[i,j]: 200i+3j <= 0 && 0 <= 103i+201j} + +# diff --git a/omegalib/examples/old_test/forall b/omegalib/examples/old_test/forall new file mode 100644 index 0000000..8b1de0a --- /dev/null +++ b/omegalib/examples/old_test/forall @@ -0,0 +1,21 @@ +symbolic n,m,B; +{ [max_diff] : + forall (m : + (not exists (z1,z2 : 0<=z1= minX)) && + exists (x1,x2 : 0<=x1= minY)) && + exists (y1,y2 : 0<=y1= minX)) && + exists (x1,x2 : 0<=x1= minY)) && + exists (y1,y2 : 0<=y1= minX)) && +# exists (x1,x2 : 0<=x1= minY)) && +# exists (y1,y2 : 0<=y1= minX)) && +# exists (x1,x2 : 0<=x1= minY)) && +# exists (y1,y2 : 0<=y1 [i,k,1,0]}; +T2 := {[k,i,j] -> [i,j,0,k]}; +T1(I1); +T2(I2); +codegen T1:I1,T2:I2; +codegen 2 T1:I1,T2:I2; diff --git a/omegalib/examples/old_test/ge.oc-rt b/omegalib/examples/old_test/ge.oc-rt new file mode 100644 index 0000000..1006fe5 --- /dev/null +++ b/omegalib/examples/old_test/ge.oc-rt @@ -0,0 +1,38 @@ +>>> symbolic n; +>>> I1 := {[k,i] : 1 <= k < i <= n }; +>>> I2 := {[k,i,j] : 1 <= k < i,j <= n }; +>>> T1 := {[k,i] -> [i,k,1,0]}; +>>> T2 := {[k,i,j] -> [i,j,0,k]}; +>>> T1(I1); +{[i,k,1,0]: 1 <= k < i <= n} +>>> T2(I2); +{[i,j,0,k]: 1 <= k < i,j <= n} +>>> codegen T1:I1,T2:I2; +for(t1 = 2; t1 <= n; t1++) { + for(t2 = 1; t2 <= n; t2++) { + for(t4 = 1; t4 <= min(t1-1,t2-1); t4++) { + s2(t4,t1,t2); + } + if (t2 <= t1-1) { + s1(t2,t1); + } + } +} + +>>> codegen 2 T1:I1,T2:I2; +for(t1 = 2; t1 <= n; t1++) { + s1(1,t1); + for(t2 = 2; t2 <= t1-1; t2++) { + for(t4 = 1; t4 <= t2-1; t4++) { + s2(t4,t1,t2); + } + s1(t2,t1); + } + for(t2 = t1; t2 <= n; t2++) { + for(t4 = 1; t4 <= t1-1; t4++) { + s2(t4,t1,t2); + } + } +} + + diff --git a/omegalib/examples/old_test/givens2 b/omegalib/examples/old_test/givens2 new file mode 100644 index 0000000..0c6f634 --- /dev/null +++ b/omegalib/examples/old_test/givens2 @@ -0,0 +1,15 @@ +# +# an example from a slightly defective dependence relation for givens2.t +# + +symbolic n, line6exp(2) ; + +{ [i,j,k] -> [i',j',k'] : + 1 <= i <= n && + 1 <= i' <= n && + i+1 <= j <= n && + i'+1 <= j' <= n && + i <= k <= n && + i' <= k' <= n and + ( 1 <= line6exp(i,j) or line6exp(i,j) <= -1 ) and + ( 1 <= line6exp(i',j') or line6exp(i',j') <= -1 ) }; diff --git a/omegalib/examples/old_test/givens2.oc-rt b/omegalib/examples/old_test/givens2.oc-rt new file mode 100644 index 0000000..9dfac42 --- /dev/null +++ b/omegalib/examples/old_test/givens2.oc-rt @@ -0,0 +1,38 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # +# # an example from a slightly defective dependence relation for givens2.t +# # +# +# Symbolic n, line6exp(2) ; +# +# +# { [i,j,k] -> [i',j',k'] : +# 1 <= i <= n && +# 1 <= i' <= n && +# i+1 <= j <= n && +# i'+1 <= j' <= n && +# i <= k <= n && +# i' <= k' <= n and +# ( 1 <= line6exp(i,j) or line6exp(i,j) <= -1 ) and +# ( 1 <= line6exp(i',j') or line6exp(i',j') <= -1 ) }; + +{[i,j,k] -> [i,j,k'] : 1 <= i <= k', j-1, k && j <= n && k <= n && k' <= n && 1 <= line6exp(i,j)} union + {[i,j,k] -> [i,j,k'] : 1 <= i <= k', j-1, k && line6exp(i,j) <= -1 && j <= n && k <= n && k' <= n} union + {[i,j,k] -> [i',j',k'] : 1 <= i' < i < j <= n && i <= k <= n && i' < j' <= n && i' <= k' <= n && 1 <= line6exp(i,j) && 1 <= line6exp(i',j')} union + {[i,j,k] -> [i',j',k'] : 1 <= i < i' < j' <= n && i < j <= n && i <= k <= n && i' <= k' <= n && 1 <= line6exp(i,j) && 1 <= line6exp(i',j')} union + {[i,j,k] -> [i',j',k'] : i' = i && 1 <= i < j' < j <= n && i <= k,k' <= n && 1 <= line6exp(i,j) && 1 <= line6exp(i',j')} union + {[i,j,k] -> [i',j',k'] : i' = i && 1 <= i < j < j' <= n && i <= k,k' <= n && 1 <= line6exp(i,j) && 1 <= line6exp(i',j')} union + {[i,j,k] -> [i',j',k'] : 1 <= i' < i < j <= n && i <= k <= n && i' < j' <= n && i' <= k' <= n && line6exp(i,j) <= -1 && 1 <= line6exp(i',j')} union + {[i,j,k] -> [i',j',k'] : 1 <= i < i' < j' <= n && i < j <= n && i <= k <= n && i' <= k' <= n && line6exp(i,j) <= -1 && 1 <= line6exp(i',j')} union + {[i,j,k] -> [i',j',k'] : i' = i && 1 <= i < j' < j <= n && i <= k,k' <= n && line6exp(i,j) <= -1 && 1 <= line6exp(i',j')} union + {[i,j,k] -> [i',j',k'] : i' = i && 1 <= i < j < j' <= n && i <= k,k' <= n && line6exp(i,j) <= -1 && 1 <= line6exp(i',j')} union + {[i,j,k] -> [i',j',k'] : 1 <= i' < i < j <= n && i <= k <= n && i' < j' <= n && i' <= k' <= n && line6exp(i',j') <= -1 && 1 <= line6exp(i,j)} union + {[i,j,k] -> [i',j',k'] : 1 <= i < i' < j' <= n && i < j <= n && i <= k <= n && i' <= k' <= n && line6exp(i',j') <= -1 && 1 <= line6exp(i,j)} union + {[i,j,k] -> [i',j',k'] : i' = i && 1 <= i < j' < j <= n && i <= k,k' <= n && line6exp(i',j') <= -1 && 1 <= line6exp(i,j)} union + {[i,j,k] -> [i',j',k'] : i' = i && 1 <= i < j < j' <= n && i <= k,k' <= n && line6exp(i',j') <= -1 && 1 <= line6exp(i,j)} union + {[i,j,k] -> [i',j',k'] : 1 <= i' < i < j <= n && i <= k <= n && i' < j' <= n && i' <= k' <= n && line6exp(i,j) <= -1 && line6exp(i',j') <= -1} union + {[i,j,k] -> [i',j',k'] : 1 <= i < i' < j' <= n && i < j <= n && i <= k <= n && i' <= k' <= n && line6exp(i,j) <= -1 && line6exp(i',j') <= -1} union + {[i,j,k] -> [i',j',k'] : i' = i && 1 <= i < j' < j <= n && i <= k,k' <= n && line6exp(i',j') <= -1 && line6exp(i,j) <= -1} union + {[i,j,k] -> [i',j',k'] : i' = i && 1 <= i < j < j' <= n && i <= k,k' <= n && line6exp(i',j') <= -1 && line6exp(i,j) <= -1} + +# diff --git a/omegalib/examples/old_test/guard1 b/omegalib/examples/old_test/guard1 new file mode 100644 index 0000000..0496d3b --- /dev/null +++ b/omegalib/examples/old_test/guard1 @@ -0,0 +1,11 @@ +symbolic n,m; +incomingKnown := { [i1,i2] : exists ( alpha : i1+3alpha = 1+i2 ) && + i1 = n && i2 = m}; + + +codegen incomingKnown; +incomingKnown := { [i1,i2] : exists ( alpha : i1+2alpha = 1+i2 ) && + i1 = n && i2 = m}; + + +codegen incomingKnown; diff --git a/omegalib/examples/old_test/guard1.oc-rt b/omegalib/examples/old_test/guard1.oc-rt new file mode 100644 index 0000000..db4b780 --- /dev/null +++ b/omegalib/examples/old_test/guard1.oc-rt @@ -0,0 +1,25 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n,m; +# +# incomingKnown := { [i1,i2] : Exists ( alpha : i1+3alpha = 1+i2 ) && +# i1 = n && i2 = m}; +# +# +# +# codegen incomingKnown; +if (intMod(-n+m+1,3) == 0) { + s1(n,m); +} + +# +# incomingKnown := { [i1,i2] : Exists ( alpha : i1+2alpha = 1+i2 ) && +# i1 = n && i2 = m}; +# +# +# +# codegen incomingKnown; +if (intMod(n+m+1,2) == 0) { + s1(n,m); +} + +# diff --git a/omegalib/examples/old_test/hull1 b/omegalib/examples/old_test/hull1 new file mode 100644 index 0000000..afb18a2 --- /dev/null +++ b/omegalib/examples/old_test/hull1 @@ -0,0 +1,4 @@ +R := {[1:10,1:10]} union {[-10:-1,-10:-1]} union + {[x,y] : -10 <= x,y <= 10 && -10 <= x-y <= 10}; +R; +Hull R; diff --git a/omegalib/examples/old_test/hull1.oc-rt b/omegalib/examples/old_test/hull1.oc-rt new file mode 100644 index 0000000..f8973fa --- /dev/null +++ b/omegalib/examples/old_test/hull1.oc-rt @@ -0,0 +1,14 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := {[1:10,1:10]} union {[-10:-1,-10:-1]} union +# {[x,y] : -10 <= x,y <= 10 && -10 <= x-y <= 10}; +# +# R; + +{[x,y]: -10, y-10 <= x <= 10, y+10 && -10 <= y <= 10} + +# +# Hull R; + +{[x,y]: -10, y-10 <= x <= 10, y+10 && -10 <= y <= 10} + +# diff --git a/omegalib/examples/old_test/hull2 b/omegalib/examples/old_test/hull2 new file mode 100644 index 0000000..69214f8 --- /dev/null +++ b/omegalib/examples/old_test/hull2 @@ -0,0 +1,3 @@ +R := {[1,1]} union {[3,3]}; +R; +Hull R; diff --git a/omegalib/examples/old_test/hull2.oc-rt b/omegalib/examples/old_test/hull2.oc-rt new file mode 100644 index 0000000..f5e2e94 --- /dev/null +++ b/omegalib/examples/old_test/hull2.oc-rt @@ -0,0 +1,14 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := {[1,1]} union {[3,3]}; +# +# R; + +{[1,1]} union + {[3,3]} + +# +# hull R; + +{[In_1,In_1]: 1 <= In_1 <= 3} + +# diff --git a/omegalib/examples/old_test/hull3 b/omegalib/examples/old_test/hull3 new file mode 100644 index 0000000..22e0324 --- /dev/null +++ b/omegalib/examples/old_test/hull3 @@ -0,0 +1,17 @@ + +symbolic n; + +s1:={[t1, 0, 0]:1 <= t1 && 64 * t1 <= n}; + +s2 := {[t1, t2, 0]: 1 <= t1 && 64 * t1 <= n && t2 = t1}; + +s3 := {[t1, 0, t3]: 1 <= t1 && 64 * t1 <= n && t3 = t1}; + +s := (s1 union s2 union s3); + +s; +h := Hull s; + +h; + +h - s; diff --git a/omegalib/examples/old_test/hull3.oc-rt b/omegalib/examples/old_test/hull3.oc-rt new file mode 100644 index 0000000..c094288 --- /dev/null +++ b/omegalib/examples/old_test/hull3.oc-rt @@ -0,0 +1,40 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# +# symbolic n; +# +# +# s1:={[t1, 0, 0]:1 <= t1 && 64 * t1 <= n}; +# +# +# s2 := {[t1, t2, 0]: 1 <= t1 && 64 * t1 <= n && t2 = t1}; +# +# +# s3 := {[t1, 0, t3]: 1 <= t1 && 64 * t1 <= n && t3 = t1}; +# +# +# s := (s1 union s2 union s3); +# +# +# s; + +{[t1,0,0]: 1 <= t1 && 64t1 <= n} union + {[t1,t1,0]: 1 <= t1 && 64t1 <= n} union + {[t1,0,t1]: 1 <= t1 && 64t1 <= n} + +# +# h := hull s; +# +# +# h; + +{[t1,t2,t3]: 0 <= t3 && 0 <= t2 && 64t1 <= n && 1 <= t1 && t2+t3 <= t1} + +# +# +# h - s; + +{[t1,t2,t3]: 1 <= t3 && 1 <= t2 && 64t1 <= n && t2+t3 <= t1} union + {[t1,t2,0]: 1 <= t2 < t1 && 64t1 <= n} union + {[t1,0,t3]: 1 <= t3 < t1 && 64t1 <= n} + +# diff --git a/omegalib/examples/old_test/ip1 b/omegalib/examples/old_test/ip1 new file mode 100644 index 0000000..b8cd8c4 --- /dev/null +++ b/omegalib/examples/old_test/ip1 @@ -0,0 +1,13 @@ +time {[a,b,c,d,e,f] : + a+b+2c+2d+e+2f >= 1 + && a - 3b - 2f >= 1 + && 3a-b >= 1 + && a-c >= 1 + && -b-3c+2e-2f >= 1 + && -a-2e>=1 + && b-2d-f >= 1 + && 4a+b-e >= 1 + && a-c+e >= 1 + && a >= 1 + }; + diff --git a/omegalib/examples/old_test/ip1.oc-rt b/omegalib/examples/old_test/ip1.oc-rt new file mode 100644 index 0000000..6646b8f --- /dev/null +++ b/omegalib/examples/old_test/ip1.oc-rt @@ -0,0 +1,15 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# time {[a,b,c,d,e,f] : +# a+b+2c+2d+e+2f >= 1 +# && a - 3b - 2f >= 1 +# && 3a-b >= 1 +# && a-c >= 1 +# && -b-3c+2e-2f >= 1 +# && -a-2e>=1 +# && b-2d-f >= 1 +# && 4a+b-e >= 1 +# && a-c+e >= 1 +# && a >= 1 +'time' requires getrusage, but the omega calclator was compiled with OMIT_GETRUSAGE set! +# }; +# diff --git a/omegalib/examples/old_test/ip2 b/omegalib/examples/old_test/ip2 new file mode 100644 index 0000000..cfef018 --- /dev/null +++ b/omegalib/examples/old_test/ip2 @@ -0,0 +1,11 @@ +time {[a,b,c,d,e,f] : + a+b+2c+2d+e+2f >= 1 + && 2a-3b-2f >= 1 + && 3a-2b >= 1 + && a-3c >= 1 + && -b-3c+2e-2f>=1 + && -a-2e >= 1 + && b-2d-3f >= 1 + && 3a+b-e >= 1 + }; + diff --git a/omegalib/examples/old_test/ip2.oc-rt b/omegalib/examples/old_test/ip2.oc-rt new file mode 100644 index 0000000..74cda4f --- /dev/null +++ b/omegalib/examples/old_test/ip2.oc-rt @@ -0,0 +1,13 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# time {[a,b,c,d,e,f] : +# a+b+2c+2d+e+2f >= 1 +# && 2a-3b-2f >= 1 +# && 3a-2b >= 1 +# && a-3c >= 1 +# && -b-3c+2e-2f>=1 +# && -a-2e >= 1 +# && b-2d-3f >= 1 +# && 3a+b-e >= 1 +'time' requires getrusage, but the omega calclator was compiled with OMIT_GETRUSAGE set! +# }; +# diff --git a/omegalib/examples/old_test/ip3 b/omegalib/examples/old_test/ip3 new file mode 100644 index 0000000..7fc0ec1 --- /dev/null +++ b/omegalib/examples/old_test/ip3 @@ -0,0 +1,18 @@ +approximate {[a,b,c,d,e,f] : ( + a+b+2c+2d+e+2f >= 1 + && 2a-3b-2f >= 1 + && 3a-2b >= 1 + && a-3c >= 1 + && -b-3c+2e-2f>=1 + && -a-2e >= 1 + && b-2d-3f >= 1 + && 3a+b-e >= 1 + + && a = 0 + && b = -1 + && c = -1 + && e = -2 + && d = 11 + ) + }; + diff --git a/omegalib/examples/old_test/ip3.oc-rt b/omegalib/examples/old_test/ip3.oc-rt new file mode 100644 index 0000000..645e3f8 --- /dev/null +++ b/omegalib/examples/old_test/ip3.oc-rt @@ -0,0 +1,23 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# approximate {[a,b,c,d,e,f] : ( +# a+b+2c+2d+e+2f >= 1 +# && 2a-3b-2f >= 1 +# && 3a-2b >= 1 +# && a-3c >= 1 +# && -b-3c+2e-2f>=1 +# && -a-2e >= 1 +# && b-2d-3f >= 1 +# && 3a+b-e >= 1 +# +# && a = 0 +# && b = -1 +# && c = -1 +# && e = -2 +# && d = 11 +# ) +# }; + +{[0,-1,-1,11,-2,-8]} + +# +# diff --git a/omegalib/examples/old_test/iter1 b/omegalib/examples/old_test/iter1 new file mode 100644 index 0000000..86ece54 --- /dev/null +++ b/omegalib/examples/old_test/iter1 @@ -0,0 +1,2 @@ +R := { [i] : i < 10 && i > 1}; +codegen R; diff --git a/omegalib/examples/old_test/iter1.oc-rt b/omegalib/examples/old_test/iter1.oc-rt new file mode 100644 index 0000000..172ced0 --- /dev/null +++ b/omegalib/examples/old_test/iter1.oc-rt @@ -0,0 +1,9 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := { [i] : i < 10 && i > 1}; +# +# codegen R; +for(t1 = 2; t1 <= 9; t1++) { + s1(t1); +} + +# diff --git a/omegalib/examples/old_test/iter2 b/omegalib/examples/old_test/iter2 new file mode 100644 index 0000000..e3ccff1 --- /dev/null +++ b/omegalib/examples/old_test/iter2 @@ -0,0 +1,2 @@ +R := { [i,j] : i <= 10 && i >= 1 && j <=100 && j >= 10}; +codegen R; diff --git a/omegalib/examples/old_test/iter2.oc-rt b/omegalib/examples/old_test/iter2.oc-rt new file mode 100644 index 0000000..0597426 --- /dev/null +++ b/omegalib/examples/old_test/iter2.oc-rt @@ -0,0 +1,11 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := { [i,j] : i <= 10 && i >= 1 && j <=100 && j >= 10}; +# +# codegen R; +for(t1 = 1; t1 <= 10; t1++) { + for(t2 = 10; t2 <= 100; t2++) { + s1(t1,t2); + } +} + +# diff --git a/omegalib/examples/old_test/iter3 b/omegalib/examples/old_test/iter3 new file mode 100644 index 0000000..604574b --- /dev/null +++ b/omegalib/examples/old_test/iter3 @@ -0,0 +1,2 @@ +R := { [i,j] : i < 10 && i > 1 && j < 10 && j > i}; +codegen R; diff --git a/omegalib/examples/old_test/iter3.oc-rt b/omegalib/examples/old_test/iter3.oc-rt new file mode 100644 index 0000000..d1288b5 --- /dev/null +++ b/omegalib/examples/old_test/iter3.oc-rt @@ -0,0 +1,11 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := { [i,j] : i < 10 && i > 1 && j < 10 && j > i}; +# +# codegen R; +for(t1 = 2; t1 <= 8; t1++) { + for(t2 = t1+1; t2 <= 9; t2++) { + s1(t1,t2); + } +} + +# diff --git a/omegalib/examples/old_test/iter4 b/omegalib/examples/old_test/iter4 new file mode 100644 index 0000000..2660d33 --- /dev/null +++ b/omegalib/examples/old_test/iter4 @@ -0,0 +1,2 @@ +R := { [i,j] : i < 10 && i > 1 && j <=2i && j > i}; +codegen R; diff --git a/omegalib/examples/old_test/iter4.oc-rt b/omegalib/examples/old_test/iter4.oc-rt new file mode 100644 index 0000000..182cb09 --- /dev/null +++ b/omegalib/examples/old_test/iter4.oc-rt @@ -0,0 +1,11 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := { [i,j] : i < 10 && i > 1 && j <=2i && j > i}; +# +# codegen R; +for(t1 = 2; t1 <= 9; t1++) { + for(t2 = t1+1; t2 <= 2*t1; t2++) { + s1(t1,t2); + } +} + +# diff --git a/omegalib/examples/old_test/iter5 b/omegalib/examples/old_test/iter5 new file mode 100644 index 0000000..b2a973b --- /dev/null +++ b/omegalib/examples/old_test/iter5 @@ -0,0 +1,2 @@ +R := { [i,j] : i < 10 && i > 1 && j <=2i && j > i && j <= 16}; +codegen R; diff --git a/omegalib/examples/old_test/iter5.oc-rt b/omegalib/examples/old_test/iter5.oc-rt new file mode 100644 index 0000000..8b567d5 --- /dev/null +++ b/omegalib/examples/old_test/iter5.oc-rt @@ -0,0 +1,11 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := { [i,j] : i < 10 && i > 1 && j <=2i && j > i && j <= 16}; +# +# codegen R; +for(t1 = 2; t1 <= 9; t1++) { + for(t2 = t1+1; t2 <= min(2*t1,16); t2++) { + s1(t1,t2); + } +} + +# diff --git a/omegalib/examples/old_test/iter6 b/omegalib/examples/old_test/iter6 new file mode 100644 index 0000000..b093c0b --- /dev/null +++ b/omegalib/examples/old_test/iter6 @@ -0,0 +1,6 @@ +Y := { [i,j] : 1 <= i <= 5 and 12 <= j <= 17}; +codegen Y; + +X := { [i,j] : 17i-153 = 12j+17 and 1 <= i <= 100 and 1 <= j <= 100 and i < j}; +codegen X; + diff --git a/omegalib/examples/old_test/iter6.oc-rt b/omegalib/examples/old_test/iter6.oc-rt new file mode 100644 index 0000000..74f06da --- /dev/null +++ b/omegalib/examples/old_test/iter6.oc-rt @@ -0,0 +1,22 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# Y := { [i,j] : 1 <= i <= 5 and 12 <= j <= 17}; +# +# codegen Y; +for(t1 = 1; t1 <= 5; t1++) { + for(t2 = 12; t2 <= 17; t2++) { + s1(t1,t2); + } +} + +# +# +# X := { [i,j] : 17i-153 = 12j+17 and 1 <= i <= 100 and 1 <= j <= 100 and i < j}; +# +# codegen X; +for(t1 = 46; t1 <= 70; t1 += 12) { + t2=intDiv((17*t1+11),12); + s1(t1,intDiv(17*t1+-170,12)); +} + +# +# diff --git a/omegalib/examples/old_test/iter7 b/omegalib/examples/old_test/iter7 new file mode 100644 index 0000000..3364dd7 --- /dev/null +++ b/omegalib/examples/old_test/iter7 @@ -0,0 +1,3 @@ +R := {[i,j] : 3i+2j=15 && 1<=i<=j<=100}; +R; +codegen R; diff --git a/omegalib/examples/old_test/iter7.oc-rt b/omegalib/examples/old_test/iter7.oc-rt new file mode 100644 index 0000000..52b7860 --- /dev/null +++ b/omegalib/examples/old_test/iter7.oc-rt @@ -0,0 +1,15 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := {[i,j] : 3i+2j=15 && 1<=i<=j<=100}; +# +# R; + +{[i,j]: 3i+2j = 15 && 3 <= j <= 6} + +# +# codegen R; +for(t1 = 1; t1 <= 3; t1 += 2) { + t2=intDiv((-3*t1+15+1),2); + s1(t1,intDiv(-3*t1+15,2)); +} + +# diff --git a/omegalib/examples/old_test/iter8 b/omegalib/examples/old_test/iter8 new file mode 100644 index 0000000..65682bb --- /dev/null +++ b/omegalib/examples/old_test/iter8 @@ -0,0 +1,12 @@ +symbolic exprVar1; +symbolic exprVar2; +symbolic exprVar3; + +ispace := {[In_1] : exists ( alpha : In_1+8alpha = 1+exprVar2 && exprVar3 = +0 && 1 <= exprVar1 < In_1 <= 16 && exprVar2 < In_1)}; + +known := {[In1] : exists ( alpha : exprVar3 = 0 && exprVar2 <= 8alpha +15 +&& alpha <= 0 && 1 <= exprVar1 && exprVar1+8alpha <= exprVar2)}; + +codegen ispace given known; + diff --git a/omegalib/examples/old_test/iter8.oc-rt b/omegalib/examples/old_test/iter8.oc-rt new file mode 100644 index 0000000..ede80cb --- /dev/null +++ b/omegalib/examples/old_test/iter8.oc-rt @@ -0,0 +1,23 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic exprVar1; +# +# symbolic exprVar2; +# +# symbolic exprVar3; +# +# +# ispace := {[In_1] : Exists ( alpha : In_1+8alpha = 1+exprVar2 && exprVar3 = +# 0 && 1 <= exprVar1 < In_1 <= 16 && exprVar2 < In_1)}; +# +# +# known := {[In1] : Exists ( alpha : exprVar3 = 0 && exprVar2 <= 8alpha +15 +# && alpha <= 0 && 1 <= exprVar1 && exprVar1+8alpha <= exprVar2)}; +# +# +# codegen ispace given known; +for(t1 = max(exprVar2+1,exprVar1+1+intMod(((exprVar2+1)-exprVar1+1),8)); t1 <= 16; t1 += 8) { + s1(t1); +} + +# +# diff --git a/omegalib/examples/old_test/iter9 b/omegalib/examples/old_test/iter9 new file mode 100644 index 0000000..42724f5 --- /dev/null +++ b/omegalib/examples/old_test/iter9 @@ -0,0 +1,40 @@ + +symbolic exprVar1; +symbolic exprVar2; + +ispace0 := {[In_1] : exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 +&& alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; + +ispace1 := {[In_1] : exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 +&& alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; + +ispace2 := {[In_1] : exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 +&& alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; + +ispace3 := {[In_1] : exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 +&& alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; + +ispace4 := {[In_1] : exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 +&& alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; + +ispace5 := {[In_1] : exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 +&& alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)} union + {[In_1] : exists ( alpha : 1+exprVar1 = In_1+8alpha && exprVar2 = 0 && 1, +exprVar1+1 <= In_1 <= 15)}; + +known := { [In_1] : exprVar2 = 0 && exprVar1 <= 15} union + {[In_1] : exprVar2 = 0 && exprVar1 <= 14} union + {[In_1] : exprVar2 = 0 && exprVar1 <= 15}; + + +k := Hull known; + +gist ispace0 given k; +gist ispace1 given k; +gist ispace2 given k; +gist ispace3 given k; +gist ispace4 given k; +gist ispace5 given k; + +codegen ispace0, ispace1, ispace2, ispace3, ispace4, ispace5 given k; + diff --git a/omegalib/examples/old_test/iter9.oc-rt b/omegalib/examples/old_test/iter9.oc-rt new file mode 100644 index 0000000..93b1c48 --- /dev/null +++ b/omegalib/examples/old_test/iter9.oc-rt @@ -0,0 +1,121 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# +# symbolic exprVar1; +# +# symbolic exprVar2; +# +# +# ispace0 := {[In_1] : Exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 +# && alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; +# +# +# ispace1 := {[In_1] : Exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 +# && alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; +# +# +# ispace2 := {[In_1] : Exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 +# && alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; +# +# +# ispace3 := {[In_1] : Exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 +# && alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; +# +# +# ispace4 := {[In_1] : Exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 +# && alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; +# +# +# ispace5 := {[In_1] : Exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 +# && alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)} union +# {[In_1] : Exists ( alpha : 1+exprVar1 = In_1+8alpha && exprVar2 = 0 && 1, +# exprVar1+1 <= In_1 <= 15)}; +# +# +# known := { [In_1] : exprVar2 = 0 && exprVar1 <= 15} union +# {[In_1] : exprVar2 = 0 && exprVar1 <= 14} union +# {[In_1] : exprVar2 = 0 && exprVar1 <= 15}; +# +# +# +# k := Hull known; +# +# +# gist ispace0 given k; + +{[In_1]: Exists ( alpha : exprVar1 <= 8alpha+15 && 1 <= In_1 && In_1+8alpha <= exprVar1)} + +# +# gist ispace1 given k; + +{[In_1]: Exists ( alpha : exprVar1 <= 8alpha+15 && 1 <= In_1 && In_1+8alpha <= exprVar1)} + +# +# gist ispace2 given k; + +{[In_1]: Exists ( alpha : exprVar1 <= 8alpha+15 && 1 <= In_1 && In_1+8alpha <= exprVar1)} + +# +# gist ispace3 given k; + +{[In_1]: Exists ( alpha : exprVar1 <= 8alpha+15 && 1 <= In_1 && In_1+8alpha <= exprVar1)} + +# +# gist ispace4 given k; + +{[In_1]: Exists ( alpha : exprVar1 <= 8alpha+15 && 1 <= In_1 && In_1+8alpha <= exprVar1)} + +# +# gist ispace5 given k; + +{[In_1]: Exists ( alpha : exprVar1 <= 8alpha+15 && 1 <= In_1 && In_1+8alpha <= exprVar1)} union + {[In_1]: Exists ( alpha : In_1+8alpha = 1+exprVar1 && 1, exprVar1+1 <= In_1 <= 15)} + +# +# +# codegen ispace0, ispace1, ispace2, ispace3, ispace4, ispace5 given k; +for(t1 = 1; t1 <= 8; t1++) { + if (exprVar1-15 <= 8*intDiv(exprVar1-t1,8) && exprVar1-15 <= 8*intDiv(exprVar1-t1,8)) { + s1(t1); + } + if (exprVar1-15 <= 8*intDiv(exprVar1-t1,8) && exprVar1-15 <= 8*intDiv(exprVar1-t1,8)) { + s2(t1); + } + if (exprVar1-15 <= 8*intDiv(exprVar1-t1,8) && exprVar1-15 <= 8*intDiv(exprVar1-t1,8)) { + s3(t1); + } + if (exprVar1-15 <= 8*intDiv(exprVar1-t1,8) && exprVar1-15 <= 8*intDiv(exprVar1-t1,8)) { + s4(t1); + } + if (exprVar1-15 <= 8*intDiv(exprVar1-t1,8) && exprVar1-15 <= 8*intDiv(exprVar1-t1,8)) { + s5(t1); + } + if (exprVar1-15 <= 8*intDiv(exprVar1-t1,8) && exprVar1-15 <= 8*intDiv(exprVar1-t1,8)) { + s6(t1); + } +} +for(t1 = 9; t1 <= 15; t1++) { + if (exprVar1-15 <= 8*intDiv(-t1+exprVar1,8)) { + s1(t1); + } + if (exprVar1-15 <= 8*intDiv(-t1+exprVar1,8)) { + s2(t1); + } + if (exprVar1-15 <= 8*intDiv(-t1+exprVar1,8)) { + s3(t1); + } + if (exprVar1-15 <= 8*intDiv(-t1+exprVar1,8)) { + s4(t1); + } + if (exprVar1-15 <= 8*intDiv(-t1+exprVar1,8)) { + s5(t1); + } + if (exprVar1-15 <= 8*intDiv(-t1+exprVar1,8)) { + s6(t1); + } + if (intMod(-t1+exprVar1+1,8) == 0) { + s6(t1); + } +} + +# +# diff --git a/omegalib/examples/old_test/lefur00 b/omegalib/examples/old_test/lefur00 new file mode 100644 index 0000000..061f78c --- /dev/null +++ b/omegalib/examples/old_test/lefur00 @@ -0,0 +1,15 @@ +R := { [i, j, k, l] : + 0 <= i <= 19 && + 0 <= j <= 19 && + 1 <= k <= 1000 && + -k + l >= 0 && + 2 k - l + 1 >= 0 && + -200 i + k + l >= 0 && + 200 i - k - l + 199 >= 0 && + -200 j - k + 2 l >= 0 && + 200 j + k -2 l + 199 >= 0 +} ; + + +codegen R; + diff --git a/omegalib/examples/old_test/lefur00.oc-rt b/omegalib/examples/old_test/lefur00.oc-rt new file mode 100644 index 0000000..3b3736f --- /dev/null +++ b/omegalib/examples/old_test/lefur00.oc-rt @@ -0,0 +1,28 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := { [i, j, k, l] : +# 0 <= i <= 19 && +# 0 <= j <= 19 && +# 1 <= k <= 1000 && +# -k + l >= 0 && +# 2 k - l + 1 >= 0 && +# -200 i + k + l >= 0 && +# 200 i - k - l + 199 >= 0 && +# -200 j - k + 2 l >= 0 && +# 200 j + k -2 l + 199 >= 0 +# } ; +# +# +# +# codegen R; +for(t1 = 0; t1 <= 15; t1++) { + for(t2 = max(2*t1-15,intDiv(t1-1+1,2)); t2 <= min(t1+1,15); t2++) { + for(t3 = max(intDiv(200*t1-1+2,3),intDiv(200*t2-2+2,3),intDiv(-200*t2+400*t1-199+2,3),1); t3 <= min(100*t1+99,intDiv(-200*t2+400*t1+398,3),1000); t3++) { + for(t4 = max(t3,200*t1-t3,intDiv(200*t2+t3+1,2)); t4 <= min(2*t3+1,intDiv(200*t2+t3+199,2),200*t1-t3+199); t4++) { + s1(t1,t2,t3,t4); + } + } + } +} + +# +# diff --git a/omegalib/examples/old_test/lefur01 b/omegalib/examples/old_test/lefur01 new file mode 100644 index 0000000..495c4f3 --- /dev/null +++ b/omegalib/examples/old_test/lefur01 @@ -0,0 +1,14 @@ +R := { [i, j, k, l] : + 0 <= i <= 19 && + 0 <= j <= 19 && + 1 <= k <= 1000 && + -k + l >= 0 && + 2 k - l + 1 >= 0 && + -200 i + k + l >= 0 && + 200 i - k - l + 199 >= 0 && + -200 j - k + 2 l >= 0 && + 200 j + k -2 l + 199 >= 0 +} ; + +codegen R; +codegen 2 R; diff --git a/omegalib/examples/old_test/lefur01.oc-rt b/omegalib/examples/old_test/lefur01.oc-rt new file mode 100644 index 0000000..4437f93 --- /dev/null +++ b/omegalib/examples/old_test/lefur01.oc-rt @@ -0,0 +1,103 @@ +>>> R := { [i, j, k, l] : +>>> 0 <= i <= 19 && +>>> 0 <= j <= 19 && +>>> 1 <= k <= 1000 && +>>> -k + l >= 0 && +>>> 2 k - l + 1 >= 0 && +>>> -200 i + k + l >= 0 && +>>> 200 i - k - l + 199 >= 0 && +>>> -200 j - k + 2 l >= 0 && +>>> 200 j + k -2 l + 199 >= 0 +>>> } ; +>>> +>>> codegen R; +for(t1 = 0; t1 <= 15; t1++) { + for(t2 = max(2*t1-15,intDiv(t1-1+1,2)); t2 <= min(t1+1,15); t2++) { + for(t3 = max(intDiv(200*t1-1+2,3),intDiv(200*t2-2+2,3),intDiv(400*t1-200*t2-199+2,3),1); t3 <= min(100*t1+99,intDiv(400*t1-200*t2+398,3),1000); t3++) { + for(t4 = max(t3,-t3+200*t1,intDiv(t3+200*t2+1,2)); t4 <= min(2*t3+1,-t3+200*t1+199,intDiv(t3+200*t2+199,2)); t4++) { + s1(t1,t2,t3,t4); + } + } + } +} + +>>> codegen 2 R; +for(t1 = 0; t1 <= 15; t1++) { + for(t2 = max(2*t1-15,intDiv(t1-1+1,2)); t2 <= min(t1+1,15); t2++) { + if (t2 <= t1-1) { + for(t3 = intDiv(-200*t2+400*t1-199+2,3); t3 <= min(100*t1-1,intDiv(-200*t2+400*t1-2,3)); t3++) { + for(t4 = 200*t1-t3; t4 <= intDiv(t3+200*t2+199,2); t4++) { + s1(t1,t2,t3,t4); + } + } + } + for(t3 = max(intDiv(200*t1-1+2,3),intDiv(200*t2-2+2,3)); t3 <= min(100*t1-1,intDiv(200*t2+195,3),intDiv(400*t1-200*t2+398,3),1000); t3++) { + for(t4 = intDiv(t3+200*t2+1,2); t4 <= 2*t3+1; t4++) { + s1(t1,t2,t3,t4); + } + } + for(t3 = max(intDiv(200*t2+196+2,3),intDiv(-200*t2+400*t1-1+2,3)); t3 <= min(100*t1-1,intDiv(-200*t2+400*t1+198,3),1000); t3++) { + for(t4 = intDiv(200*t2+t3+1,2); t4 <= intDiv(200*t2+t3+199,2); t4++) { + s1(t1,t2,t3,t4); + } + } + if (t2 <= t1) { + for(t3 = intDiv(-200*t2+400*t1+199+2,3); t3 <= min(intDiv(-200*t2+400*t1+398,3),100*t1-1,1000); t3++) { + for(t4 = intDiv(200*t2+t3+1,2); t4 <= -t3+200*t1+199; t4++) { + s1(t1,t2,t3,t4); + } + } + } + if (t2 == 1 && t1 == 1) { + for(t3 = 100; t3 <= 132; t3++) { + for(t4 = intDiv(t3+200+1,2); t4 <= 2*t3+1; t4++) { + s1(1,1,t3,t4); + } + } + } + if (2*t2 == t1+1 && t2 >= 2) { + for(t3 = 200*t2-100; t3 <= 200*t2-68; t3++) { + for(t4 = intDiv(200*t2+t3+1,2); t4 <= intDiv(200*t2+t3+199,2); t4++) { + s1(t1,intDiv(t1+1,2),t3,t4); + } + } + } + if (2*t2 >= t1+1) { + for(t3 = max(intDiv(200*t2-2+2,3),intDiv(-200*t2+400*t1+199+2,3),100*t1); t3 <= min(intDiv(-200*t2+400*t1+398,3),1000); t3++) { + for(t4 = intDiv(t3+200*t2+1,2); t4 <= 200*t1-t3+199; t4++) { + s1(t1,t2,t3,t4); + } + } + } + if (t2 == 0 && t1 <= 0) { + for(t3 = 1; t3 <= 65; t3++) { + for(t4 = t3; t4 <= 2*t3+1; t4++) { + s1(0,0,t3,t4); + } + } + } + if (t2 == 0) { + for(t3 = max(100*t1,66); t3 <= intDiv(200*t1+198,3); t3++) { + for(t4 = t3; t4 <= intDiv(t3+199,2); t4++) { + s1(t1,0,t3,t4); + } + } + } + if (2*t2 <= t1) { + for(t3 = max(100*t1,intDiv(200*t1+199+2,3)); t3 <= min(200*t2+199,intDiv(400*t1-200*t2+200,3),1000); t3++) { + for(t4 = t3; t4 <= intDiv(t3+200*t2+199,2); t4++) { + s1(t1,t2,t3,t4); + } + } + } + if (2*t2 == t1 && t2 <= 4) { + for(t3 = 200*t2+67; t3 <= 200*t2+99; t3++) { + for(t4 = t3; t4 <= -t3+400*t2+199; t4++) { + s1(t1,intDiv(t1,2),t3,t4); + } + } + } + } +} + + diff --git a/omegalib/examples/old_test/lefur03 b/omegalib/examples/old_test/lefur03 new file mode 100644 index 0000000..c237eca --- /dev/null +++ b/omegalib/examples/old_test/lefur03 @@ -0,0 +1,16 @@ +# From Fabien Coelho + +R := { [i,j,k,l,m,n] : + 0 <= i <= 3 && + 0 <= j <= 3 && + 0 <= k <= 3 && + 0 <= l <= 3 && + 1 <= m <= 1000 && + -1 <= 3 m - 1000 k <= 998 && + m <= n <= 2 m + 1 && + 0 <= m + n - 1000 i <= 999 && + 0 <= 2 n - m - 1000 j <= 999 && + 2 <= n + 2 m - 1000 l <= 1001 +} ; + +codegen R; diff --git a/omegalib/examples/old_test/lefur03-3 b/omegalib/examples/old_test/lefur03-3 new file mode 100644 index 0000000..1c576a1 --- /dev/null +++ b/omegalib/examples/old_test/lefur03-3 @@ -0,0 +1,20 @@ +# From Fabien Coelho + +R := { [i,j,k,l,m,n] : + 0 <= i <= 3 && + 0 <= j <= 3 && + 0 <= k <= 3 && + 0 <= l <= 3 && + 1 <= m <= 1000 && + -1 <= 3 m - 1000 k <= 998 && + m <= n <= 2 m + 1 && + 0 <= m + n - 1000 i <= 999 && + 0 <= 2 n - m - 1000 j <= 999 && + 2 <= n + 2 m - 1000 l <= 1001 +} ; + +codegen R; +codegen R; +codegen R; +codegen R; +codegen R; diff --git a/omegalib/examples/old_test/lefur03-3.oc-rt b/omegalib/examples/old_test/lefur03-3.oc-rt new file mode 100644 index 0000000..a1aa81a --- /dev/null +++ b/omegalib/examples/old_test/lefur03-3.oc-rt @@ -0,0 +1,107 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # From Fabien Coelho +# +# R := { [i,j,k,l,m,n] : +# 0 <= i <= 3 && +# 0 <= j <= 3 && +# 0 <= k <= 3 && +# 0 <= l <= 3 && +# 1 <= m <= 1000 && +# -1 <= 3 m - 1000 k <= 998 && +# m <= n <= 2 m + 1 && +# 0 <= m + n - 1000 i <= 999 && +# 0 <= 2 n - m - 1000 j <= 999 && +# 2 <= n + 2 m - 1000 l <= 1001 +# } ; +# +# +# codegen R; +for(t1 = 0; t1 <= 3; t1++) { + for(t2 = max(2*t1-3,0); t2 <= min(t1+1,3); t2++) { + for(t3 = t1; t3 <= min(2*t1-t2+1,3*t2+2,3); t3++) { + for(t4 = max(intDiv(t3+3*t1-3+2,3),intDiv(5*t3+3*t2-6+5,6),intDiv(4*t2-3+2,3),0); t4 <= min(intDiv(-t2+5*t1+4,3),intDiv(5*t3+3*t2+7,6),3); t4++) { + if (t1 <= t4+1) { + for(t5 = max(intDiv(1000*t3-1+2,3),250*t4+1,intDiv(-1000*t2+2000*t1-999+2,3),intDiv(1000*t2-2+2,3),-200*t2+400*t4-199); t5 <= min(intDiv(1000*t4+1001,3),-200*t2+400*t4+400,intDiv(1000*t3+998,3),500*t1+499,1000); t5++) { + for(t6 = max(t5,intDiv(t5+1000*t2+1,2),-2*t5+1000*t4+2,-t5+1000*t1); t6 <= min(-2*t5+1000*t4+1001,2*t5+1,intDiv(t5+1000*t2+999,2),-t5+1000*t1+999); t6++) { + s1(t1,t2,t3,t4,t5,t6); + } + } + } + } + } + } +} + +# +# codegen R; +for(t1 = 0; t1 <= 3; t1++) { + for(t2 = max(2*t1-3,0); t2 <= min(t1+1,3); t2++) { + for(t3 = t1; t3 <= min(2*t1-t2+1,3*t2+2,3); t3++) { + for(t4 = max(intDiv(t3+3*t1-3+2,3),intDiv(5*t3+3*t2-6+5,6),intDiv(4*t2-3+2,3),0); t4 <= min(intDiv(-t2+5*t1+4,3),intDiv(5*t3+3*t2+7,6),3); t4++) { + if (t1 <= t4+1) { + for(t5 = max(intDiv(1000*t3-1+2,3),250*t4+1,intDiv(-1000*t2+2000*t1-999+2,3),intDiv(1000*t2-2+2,3),-200*t2+400*t4-199); t5 <= min(intDiv(1000*t4+1001,3),-200*t2+400*t4+400,intDiv(1000*t3+998,3),500*t1+499,1000); t5++) { + for(t6 = max(t5,intDiv(t5+1000*t2+1,2),-2*t5+1000*t4+2,-t5+1000*t1); t6 <= min(-2*t5+1000*t4+1001,2*t5+1,intDiv(t5+1000*t2+999,2),-t5+1000*t1+999); t6++) { + s1(t1,t2,t3,t4,t5,t6); + } + } + } + } + } + } +} + +# +# codegen R; +for(t1 = 0; t1 <= 3; t1++) { + for(t2 = max(2*t1-3,0); t2 <= min(t1+1,3); t2++) { + for(t3 = t1; t3 <= min(2*t1-t2+1,3*t2+2,3); t3++) { + for(t4 = max(intDiv(t3+3*t1-3+2,3),intDiv(5*t3+3*t2-6+5,6),intDiv(4*t2-3+2,3),0); t4 <= min(intDiv(-t2+5*t1+4,3),intDiv(5*t3+3*t2+7,6),3); t4++) { + if (t1 <= t4+1) { + for(t5 = max(intDiv(1000*t3-1+2,3),250*t4+1,intDiv(-1000*t2+2000*t1-999+2,3),intDiv(1000*t2-2+2,3),-200*t2+400*t4-199); t5 <= min(intDiv(1000*t4+1001,3),-200*t2+400*t4+400,intDiv(1000*t3+998,3),500*t1+499,1000); t5++) { + for(t6 = max(t5,intDiv(t5+1000*t2+1,2),-2*t5+1000*t4+2,-t5+1000*t1); t6 <= min(-2*t5+1000*t4+1001,2*t5+1,intDiv(t5+1000*t2+999,2),-t5+1000*t1+999); t6++) { + s1(t1,t2,t3,t4,t5,t6); + } + } + } + } + } + } +} + +# +# codegen R; +for(t1 = 0; t1 <= 3; t1++) { + for(t2 = max(2*t1-3,0); t2 <= min(t1+1,3); t2++) { + for(t3 = t1; t3 <= min(2*t1-t2+1,3*t2+2,3); t3++) { + for(t4 = max(intDiv(t3+3*t1-3+2,3),intDiv(5*t3+3*t2-6+5,6),intDiv(4*t2-3+2,3),0); t4 <= min(intDiv(-t2+5*t1+4,3),intDiv(5*t3+3*t2+7,6),3); t4++) { + if (t1 <= t4+1) { + for(t5 = max(intDiv(1000*t3-1+2,3),250*t4+1,intDiv(-1000*t2+2000*t1-999+2,3),intDiv(1000*t2-2+2,3),-200*t2+400*t4-199); t5 <= min(intDiv(1000*t4+1001,3),-200*t2+400*t4+400,intDiv(1000*t3+998,3),500*t1+499,1000); t5++) { + for(t6 = max(t5,intDiv(t5+1000*t2+1,2),-2*t5+1000*t4+2,-t5+1000*t1); t6 <= min(-2*t5+1000*t4+1001,2*t5+1,intDiv(t5+1000*t2+999,2),-t5+1000*t1+999); t6++) { + s1(t1,t2,t3,t4,t5,t6); + } + } + } + } + } + } +} + +# +# codegen R; +for(t1 = 0; t1 <= 3; t1++) { + for(t2 = max(2*t1-3,0); t2 <= min(t1+1,3); t2++) { + for(t3 = t1; t3 <= min(2*t1-t2+1,3*t2+2,3); t3++) { + for(t4 = max(intDiv(t3+3*t1-3+2,3),intDiv(5*t3+3*t2-6+5,6),intDiv(4*t2-3+2,3),0); t4 <= min(intDiv(-t2+5*t1+4,3),intDiv(5*t3+3*t2+7,6),3); t4++) { + if (t1 <= t4+1) { + for(t5 = max(intDiv(1000*t3-1+2,3),250*t4+1,intDiv(-1000*t2+2000*t1-999+2,3),intDiv(1000*t2-2+2,3),-200*t2+400*t4-199); t5 <= min(intDiv(1000*t4+1001,3),-200*t2+400*t4+400,intDiv(1000*t3+998,3),500*t1+499,1000); t5++) { + for(t6 = max(t5,intDiv(t5+1000*t2+1,2),-2*t5+1000*t4+2,-t5+1000*t1); t6 <= min(-2*t5+1000*t4+1001,2*t5+1,intDiv(t5+1000*t2+999,2),-t5+1000*t1+999); t6++) { + s1(t1,t2,t3,t4,t5,t6); + } + } + } + } + } + } +} + +# diff --git a/omegalib/examples/old_test/lefur03.c b/omegalib/examples/old_test/lefur03.c new file mode 100644 index 0000000..7df0865 --- /dev/null +++ b/omegalib/examples/old_test/lefur03.c @@ -0,0 +1,36 @@ + +#include +#include "basic/util.h" + +template int max(int, int); +template int min(int, int); + +void Exit(int foo) { + exit(foo); + } + +int main() { + +int t1,t2,t3,t4,t5,t6; + + + + + +for(t1 = 0; t1 <= 3; t1++) { + for(t2 = max(2*t1-3,0); t2 <= min(t1+1,3); t2++) { + for(t3 = t1; t3 <= min(-t2+2*t1+1,3*t2+2,3); t3++) { + for(t4 = max(max(int_div(5*t3+3*t2-6+5,6),int_div(5*t1-t2-4+2,3)),max(t2,0)); t4 <= min(int_div(5*t3+3*t2+7,6),int_div(5*t1-t2+4,3),3); t4++) { + for(t5 = max(max(max(int_div(1000*t2-2+2,3),250*t4+1),max(int_div(2000*t1-1000*t2-999+2,3),400*t4-200*t2-199)),int_div(1000*t3-1+2,3)); + t5 <= min(min(min(400*t4-200*t2+400,500*t1+499),min(int_div(1000*t3+998,3),int_div(1000*t4+1001,3))),1000); t5++) { + for(t6 = max(max(int_div(t5+1000*t2+1,2),t5),max(1000*t1-t5,-2*t5+1000*t4+2)); t6 <= min(min(int_div(t5+1000*t2+999,2),2*t5+1),min(1000*t1-t5+999,-2*t5+1000*t4+1001)); t6++) { + printf("%d,%d,%d,%d,%d,%d\n", + t1,t2,t3,t4,t5,t6); + } + } + } + } + } + } +} + diff --git a/omegalib/examples/old_test/lefur03.oc-rt b/omegalib/examples/old_test/lefur03.oc-rt new file mode 100644 index 0000000..3fbb8cb --- /dev/null +++ b/omegalib/examples/old_test/lefur03.oc-rt @@ -0,0 +1,35 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # From Fabien Coelho +# +# R := { [i,j,k,l,m,n] : +# 0 <= i <= 3 && +# 0 <= j <= 3 && +# 0 <= k <= 3 && +# 0 <= l <= 3 && +# 1 <= m <= 1000 && +# -1 <= 3 m - 1000 k <= 998 && +# m <= n <= 2 m + 1 && +# 0 <= m + n - 1000 i <= 999 && +# 0 <= 2 n - m - 1000 j <= 999 && +# 2 <= n + 2 m - 1000 l <= 1001 +# } ; +# +# +# codegen R; +for(t1 = 0; t1 <= 3; t1++) { + for(t2 = max(2*t1-3,0); t2 <= min(t1+1,3); t2++) { + for(t3 = t1; t3 <= min(2*t1-t2+1,3*t2+2,3); t3++) { + for(t4 = max(intDiv(t3+3*t1-3+2,3),intDiv(5*t3+3*t2-6+5,6),intDiv(4*t2-3+2,3),0); t4 <= min(intDiv(-t2+5*t1+4,3),intDiv(5*t3+3*t2+7,6),3); t4++) { + if (t1 <= t4+1) { + for(t5 = max(intDiv(1000*t3-1+2,3),250*t4+1,intDiv(-1000*t2+2000*t1-999+2,3),intDiv(1000*t2-2+2,3),-200*t2+400*t4-199); t5 <= min(intDiv(1000*t4+1001,3),-200*t2+400*t4+400,intDiv(1000*t3+998,3),500*t1+499,1000); t5++) { + for(t6 = max(t5,intDiv(t5+1000*t2+1,2),-2*t5+1000*t4+2,-t5+1000*t1); t6 <= min(-2*t5+1000*t4+1001,2*t5+1,intDiv(t5+1000*t2+999,2),-t5+1000*t1+999); t6++) { + s1(t1,t2,t3,t4,t5,t6); + } + } + } + } + } + } +} + +# diff --git a/omegalib/examples/old_test/lefur04 b/omegalib/examples/old_test/lefur04 new file mode 100644 index 0000000..4a9e0c4 --- /dev/null +++ b/omegalib/examples/old_test/lefur04 @@ -0,0 +1,19 @@ +# From Fabien Coelho + +R := { [i, j, k, l, m, n, o, p] : + 0 <= i <= 3 && + 0 <= j <= 3 && + 0 <= k <= 3 && + 0 <= l <= 3 && + 0 <= m <= 3 && + 0 <= n <= 3 && + 1 <= o <= 1000 && o <= p <= 2 o +1 && + 0 <= -1000 i + o + p <= 999 && + 0 <= -1000 j - o + 2p <= 999 && + -1 <= -1000 k + 3 o <= 998 && + 2 <= -1000 l + 2 o + p <= 1001 && + 0 <= -1000 m + o <= 999 && + 3 <= -1000 n + 2 p<= 1002 +} ; + +codegen R; diff --git a/omegalib/examples/old_test/lefur04.oc-rt b/omegalib/examples/old_test/lefur04.oc-rt new file mode 100644 index 0000000..b449d8c --- /dev/null +++ b/omegalib/examples/old_test/lefur04.oc-rt @@ -0,0 +1,42 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # From Fabien Coelho +# +# R := { [i, j, k, l, m, n, o, p] : +# 0 <= i <= 3 && +# 0 <= j <= 3 && +# 0 <= k <= 3 && +# 0 <= l <= 3 && +# 0 <= m <= 3 && +# 0 <= n <= 3 && +# 1 <= o <= 1000 && o <= p <= 2 o +1 && +# 0 <= -1000 i + o + p <= 999 && +# 0 <= -1000 j - o + 2p <= 999 && +# -1 <= -1000 k + 3 o <= 998 && +# 2 <= -1000 l + 2 o + p <= 1001 && +# 0 <= -1000 m + o <= 999 && +# 3 <= -1000 n + 2 p<= 1002 +# } ; +# +# +# codegen R; +for(t1 = 0; t1 <= 3; t1++) { + for(t2 = max(2*t1-3,0); t2 <= min(intDiv(3*t1+2,2),3); t2++) { + for(t3 = t1; t3 <= min(-t2+2*t1+1,intDiv(3*t1+2,2),3); t3++) { + for(t4 = max(intDiv(2*t3-2+2,3),intDiv(-t2+5*t1-4+2,3),intDiv(3*t2+5*t3-6+5,6),intDiv(4*t2-3+2,3)); t4 <= min(intDiv(t2+5,2),intDiv(4*t3+3,3),intDiv(-t2+5*t1+4,3),3); t4++) { + for(t5 = max(intDiv(t2-2+2,3),intDiv(t3-2+2,3)); t5 <= intDiv(t3,3); t5++) { + for(t6 = max(intDiv(6*t4-4*t3-6+2,3),intDiv(2*t3-3+2,3),2*t4-4,intDiv(4*t2-3+2,3),intDiv(t3+3*t2-3+2,3),0); t6 <= min(intDiv(6*t4-4*t3+5,3),t2+1,t4); t6++) { + if (t4 >= t1-1) { + for(t7 = max(intDiv(2000*t1-1000*t2-999+2,3),1000*t1-500*t6-501,250*t4+1,400*t4-200*t2-199,intDiv(1000*t3-1+2,3),intDiv(1000*t2-2+2,3)); t7 <= min(1000*t1-500*t6+997,intDiv(1000*t4+1001,3),400*t4-200*t2+400,500*t1+499,500*t6+501,intDiv(1000*t3+998,3),1000); t7++) { + for(t8 = max(1000*t1-t7,500*t6+2,1000*t4-2*t7+2,t7,intDiv(t7+1000*t2+1,2)); t8 <= min(1000*t1-t7+999,500*t6+501,1000*t4-2*t7+1001,2*t7+1,intDiv(t7+1000*t2+999,2)); t8++) { + s1(t1,t2,t3,t4,t5,t6,t7,t8); + } + } + } + } + } + } + } + } +} + +# diff --git a/omegalib/examples/old_test/lefur05 b/omegalib/examples/old_test/lefur05 new file mode 100644 index 0000000..436ac54 --- /dev/null +++ b/omegalib/examples/old_test/lefur05 @@ -0,0 +1,49 @@ +# From Fabien Coelho + +R := { [i, j, k, l, m, n, o, p] : + 0 <= i <= 3 && + 0 <= j <= 3 && + 0 <= k <= 3 && + 0 <= l <= 3 && + 0 <= m <= 3 && + 0 <= n <= 3 && + 1 <= o <= 1000 && o <= p <= 2 o +1 && + 0 <= -1000 i + o + p <= 999 && + 0 <= -1000 j - o + 2p <= 999 && + -1 <= -1000 k + 3 o <= 998 && + 2 <= -1000 l + 2 o + p <= 1001 && + 0 <= -1000 m + o <= 999 && + 3 <= -1000 n + 2 p<= 1002 +} ; + +R; + +R7 := { [i, j, k, l, m, n, o, p] + -> [i, j, k, l, m, n, o ]}(R); +R7; +approximate R7; +R6 := { [i, j, k, l, m, n, o] + -> [i, j, k, l, m, n ]}(R7); +R6; +approximate R6; +R5 := { [i, j, k, l, m, n] + -> [i, j, k, l, m ]}(R6); +R5; +approximate R5; +R4 := { [i, j, k, l, m] + -> [i, j, k, l ]}(R5); +R4; +approximate R4; +R3 := { [i, j, k, l] + -> [i, j, k ]}(R4); +R3; +approximate R3; +R2 := { [i, j, k] + -> [i, j ]}(R3); +R2; +approximate R2; +R1 := { [i, j] + -> [i]}(R2); +R1; +approximate R1; + diff --git a/omegalib/examples/old_test/lefur05.oc-rt b/omegalib/examples/old_test/lefur05.oc-rt new file mode 100644 index 0000000..6d5e45e --- /dev/null +++ b/omegalib/examples/old_test/lefur05.oc-rt @@ -0,0 +1,118 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # From Fabien Coelho +# +# R := { [i, j, k, l, m, n, o, p] : +# 0 <= i <= 3 && +# 0 <= j <= 3 && +# 0 <= k <= 3 && +# 0 <= l <= 3 && +# 0 <= m <= 3 && +# 0 <= n <= 3 && +# 1 <= o <= 1000 && o <= p <= 2 o +1 && +# 0 <= -1000 i + o + p <= 999 && +# 0 <= -1000 j - o + 2p <= 999 && +# -1 <= -1000 k + 3 o <= 998 && +# 2 <= -1000 l + 2 o + p <= 1001 && +# 0 <= -1000 m + o <= 999 && +# 3 <= -1000 n + 2 p<= 1002 +# } ; +# +# +# R; + +{[i,j,k,l,m,n,o,p]: 1000m <= o <= p <= 500n+501, 2o+1 && o <= 1000m+999, 1000 && 1000i <= o+p && o+p <= 999+1000i && 1000j+o <= 2p && 2p <= 999+1000j+o && 1000k <= 1+3o && 3o <= 998+1000k && 2+500n <= p && 0 <= n && 2+1000l <= 2o+p && 2o+p <= 1001+1000l} + +# +# +# R7 := { [i, j, k, l, m, n, o, p] +# -> [i, j, k, l, m, n, o ]}(R); +# +# R7; + +{[i,j,k,l,m,n,o]: 1000m, 250n+1 <= o <= 1000m+999, 1000, 500n+501, 1000j+999, 500i+499 && 200j+o <= 400+400l && 1000j+o <= 1002+1000n && 1000i <= 1+3o && 1000j+3o <= 1998+2000i && 1000k <= 1+3o && 3o <= 998+1000k && 1000j <= 2+3o && 2000i <= 999+1000j+3o && 0 <= n && 1000i <= 501+500n+o && 250n+o <= 499+500l && 1000n <= 995+1000j+o && 500n+o <= 997+1000i && 3o <= 1001+1000l && 500l <= 249+250n+o && 400l <= 199+200j+o && 1000l <= 997+1000i+o} + +# +# approximate R7; + +{[i,j,k,l,m,n,o]: 1000m, 250n+1 <= o <= 1000m+999, 1000, 500n+501, 1000j+999, 500i+499 && 200j+o <= 400+400l && 1000j+o <= 1002+1000n && 1000i <= 1+3o && 1000j+3o <= 1998+2000i && 1000k <= 1+3o && 3o <= 998+1000k && 1000j <= 2+3o && 2000i <= 999+1000j+3o && 0 <= n && 1000i <= 501+500n+o && 250n+o <= 499+500l && 1000n <= 995+1000j+o && 500n+o <= 997+1000i && 3o <= 1001+1000l && 500l <= 249+250n+o && 400l <= 199+200j+o && 1000l <= 997+1000i+o} + +# +# R6 := { [i, j, k, l, m, n, o] +# -> [i, j, k, l, m, n ]}(R7); +# +# R6; + +{[i,j,k,l,m,n]: Exists ( alpha : 0, 2l-4 <= n <= 3, j+1, l, 2j+1 && 3m <= k <= 3, 3m+2 && 2i-3 <= j <= 3m+2 && 2k <= 2+3i && 1000i <= 1+3alpha && 1000j+3alpha <= 1998+2000i && 4j <= 3+3n && 1000k <= 1+3alpha && 3alpha <= 998+1000k && 1000j <= 2+3alpha && 2000i <= 999+1000j+3alpha && 4k+3n <= 5+6l && 6i <= 5+2l+3n && 3alpha <= 1001+1000l && 3j+5k <= 6+6l && 4l <= 7+2j+5n && 2l <= 2+3i && 2k <= 3+3n)} + +# +# approximate R6; + +{[i,j,k,l,m,n]: 2l-4, 0 <= n <= 3, j+1, l, 2j+1 && 3m, i <= k <= 3m+2, 3 && 2i-3 <= j <= 3m+2 && 2k <= 2+3i && j+k <= 1+2i && 4j <= 3+3n && 2l <= 2+3i && 2k <= 3+3n && 4l <= 7+2j+5n && 4k+3n <= 5+6l && 6i <= 5+2l+3n && 3j+5k <= 6+6l} + +# +# R5 := { [i, j, k, l, m, n] +# -> [i, j, k, l, m ]}(R6); +# +# R5; + +{[i,j,k,l,m]: Exists ( alpha,beta : 2i-3, 0 <= j <= 3m+2 && 3m <= k <= 3, 3m+2 && l <= 3 && 2k <= 2+3i && 2k <= 3+3alpha && 1000i <= 1+3beta && 1000j+3beta <= 1998+2000i && 4j <= 3+3alpha && 1000k <= 1+3beta && 3beta <= 998+1000k && 1000j <= 2+3beta && 2000i <= 999+1000j+3beta && 4k+3alpha <= 5+6l && 6i <= 5+2l+3alpha && 6i <= 5+5l && 3beta <= 1001+1000l && 4j <= 3+3l && 2k <= 2+3l && 3j+5k <= 6+6l && 4l <= 7+2j+5alpha && 2l <= 2+3i)} + +# +# approximate R5; + +{[i,j,k,l,m]: i, 3m <= k <= 3m+2, 3 && 0, 2i-3 <= j <= 3m+2 && l <= 3 && 2k <= 2+3i && 2l <= 2+3i && 2k <= 2+3l && j+k <= 1+2i && 3j+5k <= 6+6l && 6i <= 5+5l && 4j <= 3+3l} + +# +# R4 := { [i, j, k, l, m] +# -> [i, j, k, l ]}(R5); +# +# R4; + +{[i,j,k,l]: Exists ( alpha,beta,gamma : 2i-3, 0 <= j <= 3alpha+2 && 3alpha <= k <= 3, 3alpha+2 && l <= 3 && 2k <= 2+3i && 2k <= 3+3beta && 1000i <= 1+3gamma && 1000j+3gamma <= 1998+2000i && 4j <= 3+3beta && 1000k <= 1+3gamma && 3gamma <= 998+1000k && 1000j <= 2+3gamma && 2000i <= 999+1000j+3gamma && 4k+3beta <= 5+6l && 6i <= 5+2l+3beta && 6i <= 5+5l && 3gamma <= 1001+1000l && 4j <= 3+3l && 2k <= 2+3l && 3j+5k <= 6+6l && 4l <= 7+2j+5beta && 2l <= 2+3i)} + +# +# approximate R4; + +{[i,j,k,l]: i <= k <= 3 && l <= 3 && 2k <= 2+3i && 2l <= 2+3i && 6i <= 5+5l && j+k <= 1+2i && 3j+5k <= 6+6l && 4j <= 3+3l && 2i <= 3+j && 2k <= 2+3l && 0 <= j} + +# +# R3 := { [i, j, k, l] +# -> [i, j, k ]}(R4); +# +# R3; + +{[i,j,k]: Exists ( alpha,beta,gamma,delta : 2i-3, 0 <= j <= 3beta+2 && 3beta <= k <= 3, 3beta+2 && alpha <= 3 && 2k <= 2+3i && 2k <= 3+3gamma && 1000i <= 1+3delta && 1000j+3delta <= 1998+2000i && 4j <= 3+3gamma && 1000k <= 1+3delta && 3delta <= 998+1000k && 1000j <= 2+3delta && 2000i <= 999+1000j+3delta && 4k+3gamma <= 5+6alpha && 6i <= 5+2alpha+3gamma && 6i <= 5+5alpha && 3delta <= 1001+1000alpha && 4j <= 3+3alpha && 2k <= 2+3alpha && 3j+5k <= 6+6alpha && 4alpha <= 7+2j+5gamma && 2alpha <= 2+3i)} + +# +# approximate R3; + +{[i,j,k]: 0, 2i-3 <= j <= 3 && i <= k <= 3 && 2k <= 2+3i && j+k <= 1+2i} + +# +# R2 := { [i, j, k] +# -> [i, j ]}(R3); +# +# R2; + +{[i,j]: Exists ( alpha,beta,gamma,delta,tau : 2i-3, 0 <= j <= 3tau+2 && 3tau <= alpha <= 3, 3tau+2 && delta <= 3 && 2alpha <= 2+3i && 2alpha <= 3+3beta && 1000i <= 1+3gamma && 1000j+3gamma <= 1998+2000i && 4j <= 3+3beta && 1000alpha <= 1+3gamma && 3gamma <= 998+1000alpha && 1000j <= 2+3gamma && 2000i <= 999+1000j+3gamma && 4alpha+3beta <= 5+6delta && 6i <= 5+3beta+2delta && 6i <= 5+5delta && 3gamma <= 1001+1000delta && 4j <= 3+3delta && 2alpha <= 2+3delta && 3j+5alpha <= 6+6delta && 4delta <= 7+2j+5beta && 2delta <= 2+3i)} + +# +# approximate R2; + +{[i,j]: 0, 2i-3 <= j <= i+1, 3} + +# +# R1 := { [i, j] +# -> [i]}(R2); +# +# R1; + +{[i]: Exists ( alpha,beta,gamma,delta,tau,sigma : 2i-3, 0 <= alpha <= 3beta+2 && 3beta <= gamma <= 3, 3beta+2 && sigma <= 3 && 2gamma <= 2+3i && 2gamma <= 3+3delta && 1000i <= 1+3tau && 1000alpha+3tau <= 1998+2000i && 4alpha <= 3+3delta && 1000gamma <= 1+3tau && 3tau <= 998+1000gamma && 1000alpha <= 2+3tau && 2000i <= 999+1000alpha+3tau && 4gamma+3delta <= 5+6sigma && 6i <= 5+3delta+2sigma && 6i <= 5+5sigma && 3tau <= 1001+1000sigma && 4alpha <= 3+3sigma && 2gamma <= 2+3sigma && 3alpha+5gamma <= 6+6sigma && 4sigma <= 7+2alpha+5delta && 2sigma <= 2+3i)} + +# +# approximate R1; + +{[i]: -1 <= i <= 3} + +# +# diff --git a/omegalib/examples/old_test/lift1 b/omegalib/examples/old_test/lift1 new file mode 100644 index 0000000..fb3ada1 --- /dev/null +++ b/omegalib/examples/old_test/lift1 @@ -0,0 +1,16 @@ +I1 := { [i,j,k,l,m] : 1 <= i <= 60 && 1 <= j,k,l,m <= 100 }; +I2 := { [i,j,k,l,m] : 1 <= i,j,k,l,m <= 100 }; + +codegen 0 I1,I2; + +#default +codegen 1 I1,I2; + +codegen 2 I1,I2; + +codegen 3 I1,I2; + +codegen 4 I1,I2; + +codegen 5 I1,I2; + diff --git a/omegalib/examples/old_test/lift1.oc-rt b/omegalib/examples/old_test/lift1.oc-rt new file mode 100644 index 0000000..683ac07 --- /dev/null +++ b/omegalib/examples/old_test/lift1.oc-rt @@ -0,0 +1,147 @@ +>>> I1 := { [i,j,k,l,m] : 1 <= i <= 60 && 1 <= j,k,l,m <= 100 }; +>>> I2 := { [i,j,k,l,m] : 1 <= i,j,k,l,m <= 100 }; +>>> +>>> codegen 0 I1,I2; +for(t1 = 1; t1 <= 100; t1++) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + if (t1 <= 60) { + s1(t1,t2,t3,t4,t5); + } + } + } + } + } +} + +>>> +>>> #default +>>> codegen 1 I1,I2; +for(t1 = 1; t1 <= 100; t1++) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + if (t1 <= 60) { + for(t5 = 1; t5 <= 100; t5++) { + s1(t1,t2,t3,t4,t5); + s2(t1,t2,t3,t4,t5); + } + } + if (t1 >= 61) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + } + } +} + +>>> +>>> codegen 2 I1,I2; +for(t1 = 1; t1 <= 100; t1++) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + if (t1 <= 60) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s1(t1,t2,t3,t4,t5); + s2(t1,t2,t3,t4,t5); + } + } + } + if (t1 >= 61) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + } + } +} + +>>> +>>> codegen 3 I1,I2; +for(t1 = 1; t1 <= 100; t1++) { + for(t2 = 1; t2 <= 100; t2++) { + if (t1 <= 60) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s1(t1,t2,t3,t4,t5); + s2(t1,t2,t3,t4,t5); + } + } + } + } + if (t1 >= 61) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + } + } +} + +>>> +>>> codegen 4 I1,I2; +for(t1 = 1; t1 <= 100; t1++) { + if (t1 <= 60) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s1(t1,t2,t3,t4,t5); + s2(t1,t2,t3,t4,t5); + } + } + } + } + } + if (t1 >= 61) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + } + } +} + +>>> +>>> codegen 5 I1,I2; +for(t1 = 1; t1 <= 60; t1++) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s1(t1,t2,t3,t4,t5); + s2(t1,t2,t3,t4,t5); + } + } + } + } +} +for(t1 = 61; t1 <= 100; t1++) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + } +} + + diff --git a/omegalib/examples/old_test/lift2 b/omegalib/examples/old_test/lift2 new file mode 100644 index 0000000..fada83e --- /dev/null +++ b/omegalib/examples/old_test/lift2 @@ -0,0 +1,16 @@ +I1 := { [i,j,k,l,m] : 5 <= i <= 60 && 1 <= j,k,l,m <= 100 }; +I2 := { [i,j,k,l,m] : 1 <= i,j,k,l,m <= 100 }; + +codegen 0 I1,I2; + +#default +codegen 1 I1,I2; + +codegen 2 I1,I2; + +codegen 3 I1,I2; + +codegen 4 I1,I2; + +codegen 5 I1,I2; + diff --git a/omegalib/examples/old_test/lift2.oc-rt b/omegalib/examples/old_test/lift2.oc-rt new file mode 100644 index 0000000..41e1fa8 --- /dev/null +++ b/omegalib/examples/old_test/lift2.oc-rt @@ -0,0 +1,190 @@ +>>> I1 := { [i,j,k,l,m] : 5 <= i <= 60 && 1 <= j,k,l,m <= 100 }; +>>> I2 := { [i,j,k,l,m] : 1 <= i,j,k,l,m <= 100 }; +>>> +>>> codegen 0 I1,I2; +for(t1 = 1; t1 <= 100; t1++) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + if (t1 >= 5 && t1 <= 60) { + s1(t1,t2,t3,t4,t5); + } + } + } + } + } +} + +>>> +>>> #default +>>> codegen 1 I1,I2; +for(t1 = 1; t1 <= 100; t1++) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + if (t1 <= 4) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + if (t1 >= 5 && t1 <= 60) { + for(t5 = 1; t5 <= 100; t5++) { + s1(t1,t2,t3,t4,t5); + s2(t1,t2,t3,t4,t5); + } + } + if (t1 >= 61) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + } + } +} + +>>> +>>> codegen 2 I1,I2; +for(t1 = 1; t1 <= 100; t1++) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + if (t1 <= 4) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + if (t1 >= 5 && t1 <= 60) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s1(t1,t2,t3,t4,t5); + s2(t1,t2,t3,t4,t5); + } + } + } + if (t1 >= 61) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + } + } +} + +>>> +>>> codegen 3 I1,I2; +for(t1 = 1; t1 <= 100; t1++) { + for(t2 = 1; t2 <= 100; t2++) { + if (t1 <= 4) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + } + if (t1 >= 5 && t1 <= 60) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s1(t1,t2,t3,t4,t5); + s2(t1,t2,t3,t4,t5); + } + } + } + } + if (t1 >= 61) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + } + } +} + +>>> +>>> codegen 4 I1,I2; +for(t1 = 1; t1 <= 100; t1++) { + if (t1 <= 4) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + } + } + if (t1 >= 5 && t1 <= 60) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s1(t1,t2,t3,t4,t5); + s2(t1,t2,t3,t4,t5); + } + } + } + } + } + if (t1 >= 61) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + } + } +} + +>>> +>>> codegen 5 I1,I2; +for(t1 = 1; t1 <= 4; t1++) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + } +} +for(t1 = 5; t1 <= 60; t1++) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s1(t1,t2,t3,t4,t5); + s2(t1,t2,t3,t4,t5); + } + } + } + } +} +for(t1 = 61; t1 <= 100; t1++) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + } +} + + diff --git a/omegalib/examples/old_test/long_input b/omegalib/examples/old_test/long_input new file mode 100644 index 0000000..6112756 --- /dev/null +++ b/omegalib/examples/old_test/long_input @@ -0,0 +1,2 @@ +{ [i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c] -> [j] : 1 <= i < j <= 20 }; +{ [j] -> [i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v] : 1 <= i < j <= 20 }; diff --git a/omegalib/examples/old_test/long_input.oc-rt b/omegalib/examples/old_test/long_input.oc-rt new file mode 100644 index 0000000..281d321 --- /dev/null +++ b/omegalib/examples/old_test/long_input.oc-rt @@ -0,0 +1,11 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# { [i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c] -> [j] : 1 <= i < j <= 20 }; + +{[i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c] -> [j] : 1 <= i < j <= 20} + +# +# { [j] -> [i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v] : 1 <= i < j <= 20 }; + +{[j] -> [i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v] : 1 <= i < j <= 20} + +# diff --git a/omegalib/examples/old_test/lu_ijk b/omegalib/examples/old_test/lu_ijk new file mode 100644 index 0000000..5f60bfa --- /dev/null +++ b/omegalib/examples/old_test/lu_ijk @@ -0,0 +1,17 @@ +symbolic n,lb,ub; +I5 := {[k,j] : 1 <= k < j <= n}; +I7 := {[k,j,i] : 1 <= k < j,i <= n}; +T5 := {[k,j] -> [k,j,1,0]}; +T7 := {[k,j,i] -> [i,j,0,k]}; +D57 := {[k,j] -> [k,j,i] : 1 <= k < j,i <= n}; +D75 := {[k,j,k+1] -> [k+1,j] : 1 <= k <= j-2 && j <= n} union + {[k,k+1,k+1] -> [k+1,j'] : 1 <= k <= j'-2 && j' <= n}; +D77 := {[k,j,i] -> [k+1,j,i] : 1 <= k <= i-2, j-2 && j <= n && i <= n} + union + {[k,k+1,i] -> [k+1,j',i] : 1 <= k <= i-2, j'-2 && j' <= n && i <= n}; +difference ( (inverse T5) join D57 join T7 ); +difference ( (inverse T7) join D75 join T5 ); +difference ( (inverse T7) join D77 join T7 ); +codegen T5:I5,T7:I7; +codegen 2 T5:I5,T7:I7; +codegen 3 T5:I5,T7:I7; diff --git a/omegalib/examples/old_test/lu_ijk.oc-rt b/omegalib/examples/old_test/lu_ijk.oc-rt new file mode 100644 index 0000000..d067dff --- /dev/null +++ b/omegalib/examples/old_test/lu_ijk.oc-rt @@ -0,0 +1,81 @@ +>>> symbolic n,lb,ub; +>>> I5 := {[k,j] : 1 <= k < j <= n}; +>>> I7 := {[k,j,i] : 1 <= k < j,i <= n}; +>>> T5 := {[k,j] -> [k,j,1,0]}; +>>> T7 := {[k,j,i] -> [i,j,0,k]}; +>>> D57 := {[k,j] -> [k,j,i] : 1 <= k < j,i <= n}; +>>> D75 := {[k,j,k+1] -> [k+1,j] : 1 <= k <= j-2 && j <= n} union +>>> {[k,k+1,k+1] -> [k+1,j'] : 1 <= k <= j'-2 && j' <= n}; +>>> D77 := {[k,j,i] -> [k+1,j,i] : 1 <= k <= i-2, j-2 && j <= n && i <= n} +>>> union +>>> {[k,k+1,i] -> [k+1,j',i] : 1 <= k <= i-2, j'-2 && j' <= n && i <= n}; +>>> difference ( (inverse T5) join D57 join T7 ); +{[In_1,0,-1,In_4]: 1 <= In_4 && In_1+In_4 <= n && 1 <= In_1} +>>> difference ( (inverse T7) join D75 join T5 ); +{[0,0,1,In_4]: -n+2 <= In_4 <= -1} union + {[0,In_2,1,In_4]: In_4 <= -1 && 1 <= In_2 && In_2 < n+In_4} +>>> difference ( (inverse T7) join D77 join T7 ); +{[0,0,0,1]: 3 <= n} union + {[0,In_2,0,1]: 1 <= In_2 <= n-2} +>>> codegen T5:I5,T7:I7; +if (n >= 2) { + for(t1 = 1; t1 <= n; t1++) { + for(t2 = 2; t2 <= n; t2++) { + for(t4 = 1; t4 <= min(t2-1,t1-1); t4++) { + s2(t4,t2,t1); + } + if (t1 <= t2-1) { + s1(t1,t2); + } + } + } +} + +>>> codegen 2 T5:I5,T7:I7; +if (n >= 2) { + for(t1 = 1; t1 <= n; t1++) { + if (t1 <= 1) { + for(t2 = 2; t2 <= n; t2++) { + s1(1,t2); + } + } + for(t2 = 2; t2 <= t1; t2++) { + for(t4 = 1; t4 <= t2-1; t4++) { + s2(t4,t2,t1); + } + } + if (t1 >= 2) { + for(t2 = t1+1; t2 <= n; t2++) { + for(t4 = 1; t4 <= t1-1; t4++) { + s2(t4,t2,t1); + } + s1(t1,t2); + } + } + } +} + +>>> codegen 3 T5:I5,T7:I7; +for(t2 = 2; t2 <= n; t2++) { + s1(1,t2); +} +for(t1 = 2; t1 <= n-1; t1++) { + for(t2 = 2; t2 <= t1; t2++) { + for(t4 = 1; t4 <= t2-1; t4++) { + s2(t4,t2,t1); + } + } + for(t2 = t1+1; t2 <= n; t2++) { + for(t4 = 1; t4 <= t1-1; t4++) { + s2(t4,t2,t1); + } + s1(t1,t2); + } +} +for(t2 = 2; t2 <= n; t2++) { + for(t4 = 1; t4 <= t2-1; t4++) { + s2(t4,t2,n); + } +} + + diff --git a/omegalib/examples/old_test/lu_spmd b/omegalib/examples/old_test/lu_spmd new file mode 100644 index 0000000..6587ef0 --- /dev/null +++ b/omegalib/examples/old_test/lu_spmd @@ -0,0 +1,19 @@ +symbolic n,lb,ub; +I1 := {[k,i] : 1 <= k < i <= n && lb <= k <= ub}; +I2 := {[k,i,j] : 1 <= k <= i,j <= n && lb <= j <= ub}; +p := {[k,i] : 1, lb <= k <= ub < n && k < i <= n}; +w := {[k,i,j,k,i] : 1 <= k <= i,j <= n && k < lb = j <= ub}; + +T1 := {[k,i] -> [k,i,0,0,0,0,0,0]}; +T2 := {[k,i,j] -> [k,i,1,j,0,0,0,0]}; +Tp := {[k,i] -> [k,i,0,0,1,0,0,0]}; +Tw := {[k,i,j,t1,t2] -> [k,i,1,j,-1,t1,t2,0]}; + +known := {[*,*,*,*,*,*,*,*] : 1 <= lb && ub <= n}; +known2 := {[*,*,*,*,*,*,*,*] : 1 <= lb <= ub <= n}; + +codegen 0 T1:I1,T2:I2,Tp:p,Tw:w given known; +codegen 1 T1:I1,T2:I2,Tp:p,Tw:w given known; +# codegen 2 T1:I1,T2:I2,Tp:p,Tw:w given known; +# codegen 1 T1:I1,T2:I2,Tp:p,Tw:w given known2; +# codegen 2 T1:I1,T2:I2,Tp:p,Tw:w given known2; diff --git a/omegalib/examples/old_test/lu_spmd.oc-rt b/omegalib/examples/old_test/lu_spmd.oc-rt new file mode 100644 index 0000000..f221d8e --- /dev/null +++ b/omegalib/examples/old_test/lu_spmd.oc-rt @@ -0,0 +1,58 @@ +>>> symbolic n,lb,ub; +>>> I1 := {[k,i] : 1 <= k < i <= n && lb <= k <= ub}; +>>> I2 := {[k,i,j] : 1 <= k <= i,j <= n && lb <= j <= ub}; +>>> p := {[k,i] : 1, lb <= k <= ub < n && k < i <= n}; +>>> w := {[k,i,j,k,i] : 1 <= k <= i,j <= n && k < lb = j <= ub}; +>>> +>>> T1 := {[k,i] -> [k,i,0,0,0,0,0,0]}; +>>> T2 := {[k,i,j] -> [k,i,1,j,0,0,0,0]}; +>>> Tp := {[k,i] -> [k,i,0,0,1,0,0,0]}; +>>> Tw := {[k,i,j,t1,t2] -> [k,i,1,j,-1,t1,t2,0]}; +>>> +>>> known := {[*,*,*,*,*,*,*,*] : 1 <= lb && ub <= n}; +>>> known2 := {[*,*,*,*,*,*,*,*] : 1 <= lb <= ub <= n}; +>>> +>>> codegen 0 T1:I1,T2:I2,Tp:p,Tw:w given known; +if (lb <= ub) { + for(t1 = 1; t1 <= ub; t1++) { + for(t2 = t1; t2 <= n; t2++) { + if (t1 >= lb && t2 >= t1+1) { + s1(t1,t2); + } + if (ub <= n-1 && t2 >= t1+1 && t1 >= lb) { + s3(t1,t2); + } + for(t4 = max(lb,t1); t4 <= ub; t4++) { + if (t4 >= t1+1 && t4 <= lb) { + s4(t1,t2,t4,t1,t2); + } + s2(t1,t2,t4); + } + } + } +} + +>>> codegen 1 T1:I1,T2:I2,Tp:p,Tw:w given known; +if (lb <= ub) { + for(t1 = 1; t1 <= ub; t1++) { + for(t2 = t1; t2 <= n; t2++) { + if (t1 >= lb && t2 >= t1+1) { + s1(t1,t2); + } + if (ub <= n-1 && t2 >= t1+1 && t1 >= lb) { + s3(t1,t2); + } + for(t4 = max(lb,t1); t4 <= ub; t4++) { + if (t4 >= t1+1 && t4 <= lb) { + s4(t1,t2,t4,t1,t2); + } + s2(t1,t2,t4); + } + } + } +} + +>>> # codegen 2 T1:I1,T2:I2,Tp:p,Tw:w given known; +>>> # codegen 1 T1:I1,T2:I2,Tp:p,Tw:w given known2; +>>> # codegen 2 T1:I1,T2:I2,Tp:p,Tw:w given known2; + diff --git a/omegalib/examples/old_test/m1 b/omegalib/examples/old_test/m1 new file mode 100644 index 0000000..1ff50d1 --- /dev/null +++ b/omegalib/examples/old_test/m1 @@ -0,0 +1,6 @@ +T1:={[i,j]->[i,j,0]}; +T2:={[i,j]->[i,j,1]}; +R1:={[1:9,1:9]}; +R2:={[5,1:9]}; +codegen T1:R1,T2:R2; +codegen 2 T1:R1,T2:R2; diff --git a/omegalib/examples/old_test/m1.oc-rt b/omegalib/examples/old_test/m1.oc-rt new file mode 100644 index 0000000..ad2c49c --- /dev/null +++ b/omegalib/examples/old_test/m1.oc-rt @@ -0,0 +1,41 @@ +>>> T1:={[i,j]->[i,j,0]}; +>>> T2:={[i,j]->[i,j,1]}; +>>> R1:={[1:9,1:9]}; +>>> R2:={[5,1:9]}; +>>> codegen T1:R1,T2:R2; +for(t1 = 1; t1 <= 9; t1++) { + if (t1 <= 4) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t1,t2); + } + } + if (t1 == 5) { + for(t2 = 1; t2 <= 9; t2++) { + s1(5,t2); + s2(5,t2); + } + } + if (t1 >= 6) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t1,t2); + } + } +} + +>>> codegen 2 T1:R1,T2:R2; +for(t1 = 1; t1 <= 4; t1++) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t1,t2); + } +} +for(t2 = 1; t2 <= 9; t2++) { + s1(5,t2); + s2(5,t2); +} +for(t1 = 6; t1 <= 9; t1++) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t1,t2); + } +} + + diff --git a/omegalib/examples/old_test/m10 b/omegalib/examples/old_test/m10 new file mode 100644 index 0000000..01fa540 --- /dev/null +++ b/omegalib/examples/old_test/m10 @@ -0,0 +1,5 @@ +IS:={[i,j]: 1 <= i,j <= 9}; +T1:={[i,j]->[4j,i,0]}; +T2:={[i,j]->[2j,i,1]}; +codegen T1:IS,T2:IS; +codegen 2 T1:IS,T2:IS; diff --git a/omegalib/examples/old_test/m10.oc-rt b/omegalib/examples/old_test/m10.oc-rt new file mode 100644 index 0000000..c782e1d --- /dev/null +++ b/omegalib/examples/old_test/m10.oc-rt @@ -0,0 +1,47 @@ +>>> IS:={[i,j]: 1 <= i,j <= 9}; +>>> T1:={[i,j]->[4j,i,0]}; +>>> T2:={[i,j]->[2j,i,1]}; +>>> codegen T1:IS,T2:IS; +for(t1 = 2; t1 <= 36; t1 += 2) { + if (intMod(t1,4) == 0 && t1 <= 16) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,intDiv(t1,4)); + s2(t2,intDiv(t1,2)); + } + } + if (intMod(t1,4) == 0 && t1 >= 20) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,intDiv(t1,4)); + } + } + if (intMod(t1-2,4) == 0 && t1 <= 18) { + for(t2 = 1; t2 <= 9; t2++) { + s2(t2,intDiv(t1,2)); + } + } +} + +>>> codegen 2 T1:IS,T2:IS; +for(t1 = 2; t1 <= 16; t1 += 2) { + if (intMod(t1,4) == 0) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,intDiv(t1,4)); + s2(t2,intDiv(t1,2)); + } + } + if (intMod(t1-2,4) == 0) { + for(t2 = 1; t2 <= 9; t2++) { + s2(t2,intDiv(t1,2)); + } + } +} +for(t2 = 1; t2 <= 9; t2++) { + s2(t2,9); +} +for(t1 = 20; t1 <= 36; t1 += 4) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,intDiv(t1,4)); + } +} + + diff --git a/omegalib/examples/old_test/m11 b/omegalib/examples/old_test/m11 new file mode 100644 index 0000000..1367ff8 --- /dev/null +++ b/omegalib/examples/old_test/m11 @@ -0,0 +1,10 @@ +symbolic m; +I := {[p1,p2,c2,a1,a2,b1,b2] : + 1 <= p1 <= 4 && 1 <= p2 <= 2 && 17p1<=16+2m + && 1<=2c2+p2 <= 6 + && 0 <= 10c2+5p2-a2 <= 4 + && 0 <= 17p1-2a1 <= 16 && a1 <= 30 && a2-m+a1 <= 1 + && 17 <= 2b1-2a1+17p1 <= 18 + && b2 = 5 + a2-5p2-5c2}; +I; +codegen I; diff --git a/omegalib/examples/old_test/m11.oc-rt b/omegalib/examples/old_test/m11.oc-rt new file mode 100644 index 0000000..4218a2e --- /dev/null +++ b/omegalib/examples/old_test/m11.oc-rt @@ -0,0 +1,32 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic m; +# +# I := {[p1,p2,c2,a1,a2,b1,b2] : +# 1 <= p1 <= 4 && 1 <= p2 <= 2 && 17p1<=16+2m +# && 1<=2c2+p2 <= 6 +# && 0 <= 10c2+5p2-a2 <= 4 +# && 0 <= 17p1-2a1 <= 16 && a1 <= 30 && a2-m+a1 <= 1 +# && 17 <= 2b1-2a1+17p1 <= 18 +# && b2 = 5 + a2-5p2-5c2}; +# +# I; + +{[p1,p2,c2,a1,a2,b1,a2-5p2-5c2+5]: 1, -2c2+1 <= p2 <= 2, -2c2+6 && a1 <= 30 && 1 <= p1 && 17p1+2b1 <= 18+2a1 && 17+2a1 <= 17p1+2b1 && a2 <= 5p2+10c2 && 5p2+10c2 <= 4+a2 && 2a1 <= 17p1 && 17p1 <= 16+2a1 && a1+a2 <= 1+m} + +# +# codegen I; +for(t1 = 1; t1 <= min(intDiv(2*m+16,17),4); t1++) { + for(t2 = 1; t2 <= min(intDiv(2*m-17*t1+26,10),2); t2++) { + for(t3 = 0; t3 <= min(intDiv(2*m-10*t2-17*t1+26,20),2); t3++) { + for(t4 = intDiv(17*t1-16+1,2); t4 <= min(intDiv(17*t1,2),m-5*t2-10*t3+5,30); t4++) { + for(t5 = 5*t2+10*t3-4; t5 <= min(m-t4+1,5*t2+10*t3); t5++) { + for(t6 = intDiv(-17*t1+2*t4+17+1,2); t6 <= intDiv(-17*t1+2*t4+18,2); t6++) { + s1(t1,t2,t3,t4,t5,t6,t5+-5*t2+-5*t3+5); + } + } + } + } + } +} + +# diff --git a/omegalib/examples/old_test/m12 b/omegalib/examples/old_test/m12 new file mode 100644 index 0000000..2f1101f --- /dev/null +++ b/omegalib/examples/old_test/m12 @@ -0,0 +1,8 @@ +symbolic n,m; +I1 := {[1,1:n,1:m,0]}; +I2 := {[2,1:n,0,0]}; +I3 := {[3,1:m,1,1:n]}; +I4 := {[3,1:m,2,1:n]}; +I5 := {[4,1:m,0,0]}; +codegen I1; +codegen I1,I1,I2,I2,I3,I3,I4,I4,I5,I5; diff --git a/omegalib/examples/old_test/m12.oc-rt b/omegalib/examples/old_test/m12.oc-rt new file mode 100644 index 0000000..ab5953b --- /dev/null +++ b/omegalib/examples/old_test/m12.oc-rt @@ -0,0 +1,54 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n,m; +# +# I1 := {[1,1:n,1:m,0]}; +# +# I2 := {[2,1:n,0,0]}; +# +# I3 := {[3,1:m,1,1:n]}; +# +# I4 := {[3,1:m,2,1:n]}; +# +# I5 := {[4,1:m,0,0]}; +# +# codegen I1; +if (m >= 1) { + for(t2 = 1; t2 <= n; t2++) { + for(t3 = 1; t3 <= m; t3++) { + s1(1,t2,t3,0); + } + } +} + +# +# codegen I1,I1,I2,I2,I3,I3,I4,I4,I5,I5; +if (m >= 1) { + for(t2 = 1; t2 <= n; t2++) { + for(t3 = 1; t3 <= m; t3++) { + s1(1,t2,t3,0); + s2(1,t2,t3,0); + } + } +} +for(t2 = 1; t2 <= n; t2++) { + s3(2,t2,0,0); + s4(2,t2,0,0); +} +if (n >= 1) { + for(t2 = 1; t2 <= m; t2++) { + for(t4 = 1; t4 <= n; t4++) { + s5(3,t2,1,t4); + s6(3,t2,1,t4); + } + for(t4 = 1; t4 <= n; t4++) { + s7(3,t2,2,t4); + s8(3,t2,2,t4); + } + } +} +for(t2 = 1; t2 <= m; t2++) { + s9(4,t2,0,0); + s10(4,t2,0,0); +} + +# diff --git a/omegalib/examples/old_test/m2 b/omegalib/examples/old_test/m2 new file mode 100644 index 0000000..be93f8e --- /dev/null +++ b/omegalib/examples/old_test/m2 @@ -0,0 +1,4 @@ +R1:={[i,j]: 2 <= i,j <= 9}; +R2:={[i,j]: 5 <= i <= 9 & 1 <= j <= 9}; +codegen R1,R2; +codegen 2 R1,R2; diff --git a/omegalib/examples/old_test/m2.oc-rt b/omegalib/examples/old_test/m2.oc-rt new file mode 100644 index 0000000..cdd76dd --- /dev/null +++ b/omegalib/examples/old_test/m2.oc-rt @@ -0,0 +1,35 @@ +>>> R1:={[i,j]: 2 <= i,j <= 9}; +>>> R2:={[i,j]: 5 <= i <= 9 & 1 <= j <= 9}; +>>> codegen R1,R2; +for(t1 = 2; t1 <= 9; t1++) { + if (t1 >= 5) { + s2(t1,1); + } + if (t1 <= 4) { + for(t2 = 2; t2 <= 9; t2++) { + s1(t1,t2); + } + } + if (t1 >= 5) { + for(t2 = 2; t2 <= 9; t2++) { + s1(t1,t2); + s2(t1,t2); + } + } +} + +>>> codegen 2 R1,R2; +for(t1 = 2; t1 <= 4; t1++) { + for(t2 = 2; t2 <= 9; t2++) { + s1(t1,t2); + } +} +for(t1 = 5; t1 <= 9; t1++) { + s2(t1,1); + for(t2 = 2; t2 <= 9; t2++) { + s1(t1,t2); + s2(t1,t2); + } +} + + diff --git a/omegalib/examples/old_test/m3 b/omegalib/examples/old_test/m3 new file mode 100644 index 0000000..e160e8c --- /dev/null +++ b/omegalib/examples/old_test/m3 @@ -0,0 +1,2 @@ +I := {[i,j] : 1 <= i+j,j <= 10}; +codegen I; diff --git a/omegalib/examples/old_test/m3.oc-rt b/omegalib/examples/old_test/m3.oc-rt new file mode 100644 index 0000000..b466eb9 --- /dev/null +++ b/omegalib/examples/old_test/m3.oc-rt @@ -0,0 +1,11 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# I := {[i,j] : 1 <= i+j,j <= 10}; +# +# codegen I; +for(t1 = -9; t1 <= 9; t1++) { + for(t2 = max(-t1+1,1); t2 <= min(-t1+10,10); t2++) { + s1(t1,t2); + } +} + +# diff --git a/omegalib/examples/old_test/m4 b/omegalib/examples/old_test/m4 new file mode 100644 index 0000000..d25f961 --- /dev/null +++ b/omegalib/examples/old_test/m4 @@ -0,0 +1,11 @@ +T1:={[i,j]->[j,i,0]}; +T2:={[i,j]->[j,i,1]}; +IS:={[i,j]: 1 <= i,j <= 9}; + +newIS1 := T1 \ IS; +newIS1; +newIS2 := T2 \ IS; +newIS2; + +codegen T1:IS,T2:IS; +codegen 2 T1:IS,T2:IS; diff --git a/omegalib/examples/old_test/m4.oc-rt b/omegalib/examples/old_test/m4.oc-rt new file mode 100644 index 0000000..d710dce --- /dev/null +++ b/omegalib/examples/old_test/m4.oc-rt @@ -0,0 +1,28 @@ +>>> T1:={[i,j]->[j,i,0]}; +>>> T2:={[i,j]->[j,i,1]}; +>>> IS:={[i,j]: 1 <= i,j <= 9}; +>>> +>>> newIS1 := T1 \ IS; +>>> newIS1; +{[i,j] -> [j,i,0] : 1 <= i <= 9 && 1 <= j <= 9} +>>> newIS2 := T2 \ IS; +>>> newIS2; +{[i,j] -> [j,i,1] : 1 <= i <= 9 && 1 <= j <= 9} +>>> +>>> codegen T1:IS,T2:IS; +for(t1 = 1; t1 <= 9; t1++) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,t1); + s2(t2,t1); + } +} + +>>> codegen 2 T1:IS,T2:IS; +for(t1 = 1; t1 <= 9; t1++) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,t1); + s2(t2,t1); + } +} + + diff --git a/omegalib/examples/old_test/m7 b/omegalib/examples/old_test/m7 new file mode 100644 index 0000000..62c0c64 --- /dev/null +++ b/omegalib/examples/old_test/m7 @@ -0,0 +1,6 @@ +T1:={[i,j]->[j,i,0]}; +T2:={[i,j]->[j,i,1]}; +R2:={[i,j]: 1 <= i,j <= 9}; +R3:={[i,j]: 1 <= i,j <= 9 && exists (alpha: j = 2alpha)}; +codegen T1:R2,T2:R3; +codegen 2 T1:R2,T2:R3; diff --git a/omegalib/examples/old_test/m7.oc-rt b/omegalib/examples/old_test/m7.oc-rt new file mode 100644 index 0000000..a98c8a7 --- /dev/null +++ b/omegalib/examples/old_test/m7.oc-rt @@ -0,0 +1,35 @@ +>>> T1:={[i,j]->[j,i,0]}; +>>> T2:={[i,j]->[j,i,1]}; +>>> R2:={[i,j]: 1 <= i,j <= 9}; +>>> R3:={[i,j]: 1 <= i,j <= 9 && exists (alpha: j = 2alpha)}; +>>> codegen T1:R2,T2:R3; +for(t1 = 1; t1 <= 9; t1++) { + if (intMod(-t1,2) == 0) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,t1); + s2(t2,t1); + } + } + if (intMod(-t1-1,2) == 0) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,t1); + } + } +} + +>>> codegen 2 T1:R2,T2:R3; +for(t1 = 1; t1 <= 9; t1++) { + if (intMod(-t1,2) == 0) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,t1); + s2(t2,t1); + } + } + if (intMod(-t1-1,2) == 0) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,t1); + } + } +} + + diff --git a/omegalib/examples/old_test/m8 b/omegalib/examples/old_test/m8 new file mode 100644 index 0000000..eb6938b --- /dev/null +++ b/omegalib/examples/old_test/m8 @@ -0,0 +1,6 @@ +T1:={[i,j]->[j,i,0]}; +T2:={[i,j]->[j,i,1]}; +R2:={[i,j]: 1 <= i,j <= 9 && exists (alpha: j = 4alpha)}; +R3:={[i,j]: 1 <= i,j <= 9 && exists (alpha: j = 2alpha)}; +codegen T1:R2,T2:R3; +codegen 2 T1:R2,T2:R3; diff --git a/omegalib/examples/old_test/m8.oc-rt b/omegalib/examples/old_test/m8.oc-rt new file mode 100644 index 0000000..670052b --- /dev/null +++ b/omegalib/examples/old_test/m8.oc-rt @@ -0,0 +1,35 @@ +>>> T1:={[i,j]->[j,i,0]}; +>>> T2:={[i,j]->[j,i,1]}; +>>> R2:={[i,j]: 1 <= i,j <= 9 && exists (alpha: j = 4alpha)}; +>>> R3:={[i,j]: 1 <= i,j <= 9 && exists (alpha: j = 2alpha)}; +>>> codegen T1:R2,T2:R3; +for(t1 = 2; t1 <= 8; t1 += 2) { + if (intMod(t1,4) == 0) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,t1); + s2(t2,t1); + } + } + if (intMod(t1-2,4) == 0) { + for(t2 = 1; t2 <= 9; t2++) { + s2(t2,t1); + } + } +} + +>>> codegen 2 T1:R2,T2:R3; +for(t1 = 2; t1 <= 8; t1 += 2) { + if (intMod(t1,4) == 0) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,t1); + s2(t2,t1); + } + } + if (intMod(t1-2,4) == 0) { + for(t2 = 1; t2 <= 9; t2++) { + s2(t2,t1); + } + } +} + + diff --git a/omegalib/examples/old_test/m9 b/omegalib/examples/old_test/m9 new file mode 100644 index 0000000..fb59381 --- /dev/null +++ b/omegalib/examples/old_test/m9 @@ -0,0 +1,5 @@ +IS:={[i,j]: 1 <= i,j <= 9}; +T1:={[i,j]->[2j,i,0]}; +T2:={[i,j]->[2j,i,1]}; +codegen T1:IS,T2:IS; +codegen 2 T1:IS,T2:IS; diff --git a/omegalib/examples/old_test/m9.oc-rt b/omegalib/examples/old_test/m9.oc-rt new file mode 100644 index 0000000..c331a0c --- /dev/null +++ b/omegalib/examples/old_test/m9.oc-rt @@ -0,0 +1,20 @@ +>>> IS:={[i,j]: 1 <= i,j <= 9}; +>>> T1:={[i,j]->[2j,i,0]}; +>>> T2:={[i,j]->[2j,i,1]}; +>>> codegen T1:IS,T2:IS; +for(t1 = 2; t1 <= 18; t1 += 2) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,intDiv(t1,2)); + s2(t2,intDiv(t1,2)); + } +} + +>>> codegen 2 T1:IS,T2:IS; +for(t1 = 2; t1 <= 18; t1 += 2) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,intDiv(t1,2)); + s2(t2,intDiv(t1,2)); + } +} + + diff --git a/omegalib/examples/old_test/maximize b/omegalib/examples/old_test/maximize new file mode 100644 index 0000000..be13c89 --- /dev/null +++ b/omegalib/examples/old_test/maximize @@ -0,0 +1,7 @@ +symbolic n, f(1); + +R0 := {[x] : 1 <= x <= n}; +R1 := {[x] : 1 <= x <= n && f(x) >= 0}; +maximize R0; +maximize R1; +R1 intersection maximize R0; diff --git a/omegalib/examples/old_test/maximize.oc-rt b/omegalib/examples/old_test/maximize.oc-rt new file mode 100644 index 0000000..4f1826e --- /dev/null +++ b/omegalib/examples/old_test/maximize.oc-rt @@ -0,0 +1,24 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n, f(1); +# +# +# R0 := {[x] : 1 <= x <= n}; +# +# R1 := {[x] : 1 <= x <= n && f(x) >= 0}; +# +# maximize R0; + +{[n]: 1 <= n} + +# +# maximize R1; + +{[x]: 1 <= x < n && 0 <= f(x) && UNKNOWN} union + {[x]: n = x && 0 <= f(x) && 1 <= x} + +# +# R1 intersection maximize R0; + +{[x]: n = x && 1 <= x && 0 <= f(x)} + +# diff --git a/omegalib/examples/old_test/olda b/omegalib/examples/old_test/olda new file mode 100644 index 0000000..095388b --- /dev/null +++ b/omegalib/examples/old_test/olda @@ -0,0 +1,9 @@ +T10:={[mp,mq,mi] -> [mi,mq,mp,0]}; +T20:={[mp,mq,mi] -> [mi,mp,mq,1]}; + +symbolic np,morb; +IS10 := {[mp,mq,mi]: 1 <= mp <= np && 1 <= mq <= mp && 1 <= mi <= morb}; +IS20 := IS10; + +codegen T10:IS10,T20:IS20; +codegen 2 T10:IS10,T20:IS20; diff --git a/omegalib/examples/old_test/olda.oc-rt b/omegalib/examples/old_test/olda.oc-rt new file mode 100644 index 0000000..52e3406 --- /dev/null +++ b/omegalib/examples/old_test/olda.oc-rt @@ -0,0 +1,52 @@ +>>> T10:={[mp,mq,mi] -> [mi,mq,mp,0]}; +>>> T20:={[mp,mq,mi] -> [mi,mp,mq,1]}; +>>> +>>> Symbolic np,morb; +>>> IS10 := {[mp,mq,mi]: 1 <= mp <= np && 1 <= mq <= mp && 1 <= mi <= morb}; +>>> IS20 := IS10; +>>> +>>> codegen T10:IS10,T20:IS20; +if (np >= 1) { + for(t1 = 1; t1 <= morb; t1++) { + for(t2 = 1; t2 <= np; t2++) { + for(t3 = 1; t3 <= t2-1; t3++) { + s2(t2,t3,t1); + } + s1(t2,t2,t1); + s2(t2,t2,t1); + for(t3 = t2+1; t3 <= np; t3++) { + s1(t3,t2,t1); + } + } + } +} + +>>> codegen 2 T10:IS10,T20:IS20; +if (np >= 1) { + for(t1 = 1; t1 <= morb; t1++) { + s1(1,1,t1); + s2(1,1,t1); + for(t3 = 2; t3 <= np; t3++) { + s1(t3,1,t1); + } + for(t2 = 2; t2 <= np-1; t2++) { + for(t3 = 1; t3 <= t2-1; t3++) { + s2(t2,t3,t1); + } + s1(t2,t2,t1); + s2(t2,t2,t1); + for(t3 = t2+1; t3 <= np; t3++) { + s1(t3,t2,t1); + } + } + for(t3 = 1; t3 <= np-1; t3++) { + s2(np,t3,t1); + } + if (np >= 2) { + s1(np,np,t1); + s2(np,np,t1); + } + } +} + + diff --git a/omegalib/examples/old_test/p.delft b/omegalib/examples/old_test/p.delft new file mode 100644 index 0000000..27840a2 --- /dev/null +++ b/omegalib/examples/old_test/p.delft @@ -0,0 +1,22 @@ +# Generate local code for this HPF code fragment +# !HPF$ template T(0:150,0:150) +# !HPF$ align X(I,J) with T(3*I,3*J) +A := { [i,j] -> [3i,3j] }; +# !HPF$ processors P(0:3, 0:3) +# !HPF$ distribute +# !HPF$ T(cyclic(4), cyclic(4)) onto P +D := { [t1,t2] -> [p1,p2,c1,c2,l1,l2] : + t1 = 16c1+4p1+l1 + && t2 = 16c2+4p2+l2 + && 0 <= p1,p2 <= 3 + && 0 <= l1,l2 <= 3 }; +# do I = 0, 14 +# Y(I,I) = 1.0 +# enddo +I := { [i] : 0 <= i <= 14 }; +X := { [i] -> [i,i] }; +R := D(A(X(I))); +R; +symbolic P1,P2; +selectLocal := {[P1,P2,c1,c2,l1,l2] -> [c1,c2,l1,l2]}; +codegen selectLocal(R); diff --git a/omegalib/examples/old_test/p.delft.oc-rt b/omegalib/examples/old_test/p.delft.oc-rt new file mode 100644 index 0000000..d59a886 --- /dev/null +++ b/omegalib/examples/old_test/p.delft.oc-rt @@ -0,0 +1,43 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # Generate local code for this HPF code fragment +# # !HPF$ template T(0:150,0:150) +# # !HPF$ align X(I,J) with T(3*I,3*J) +# A := { [i,j] -> [3i,3j] }; +# +# # !HPF$ processors P(0:3, 0:3) +# # !HPF$ distribute +# # !HPF$ T(cyclic(4), cyclic(4)) onto P +# D := { [t1,t2] -> [p1,p2,c1,c2,l1,l2] : +# t1 = 16c1+4p1+l1 +# && t2 = 16c2+4p2+l2 +# && 0 <= p1,p2 <= 3 +# && 0 <= l1,l2 <= 3 }; +# +# # do I = 0, 14 +# # Y(I,I) = 1.0 +# # enddo +# I := { [i] : 0 <= i <= 14 }; +# +# X := { [i] -> [i,i] }; +# +# R := D(A(X(I))); +# +# R; + +{[p1,p1,c1,c1,l1,l1]: Exists ( alpha : p1+l1+c1 = 3alpha && 0 <= p1 <= -4c1+10, 3 && 0 <= l1 <= 3 && 0 <= c1)} + +# +# symbolic P1,P2; +# +# selectLocal := {[P1,P2,c1,c2,l1,l2] -> [c1,c2,l1,l2]}; +# +# codegen selectLocal(R); +if (P1 == P2 && P1 >= 0 && P1 <= 3) { + for(t1 = 0; t1 <= min(-P1+4,2); t1++) { + for(t3 = intMod((-P1-t1),3); t3 <= 3; t3 += 3) { + s1(t1,t1,t3,t3); + } + } +} + +# diff --git a/omegalib/examples/old_test/p.delft2 b/omegalib/examples/old_test/p.delft2 new file mode 100644 index 0000000..32e5da0 --- /dev/null +++ b/omegalib/examples/old_test/p.delft2 @@ -0,0 +1,24 @@ +# Compute Sends and receives for the following HPF fragment + +I := { [i,j] : 1 <= i <= 14 && 0 <= j <= 14 }; +X := { [i,j] -> [3i,3j] }; +Y := { [i,j] -> [i',3j] : 3i-1 <= i'<= 3i}; +A := { [i,j] -> [3i,3j] }; +D := { [t1,t2] -> [p1,p2,c1,c2,l1,l2] : + t1 = 16c1+4p1+l1 + && t2 = 16c2+4p2+l2 + && 0 <= p1,p2 <= 3 + && 0 <= l1,l2 <= 3 }; +P := { [p1,p2,c1,c2,l1,l2] -> [p1,p2]}; +C := { [p1,p2,c1,c2,l1,l2] -> [p1,p2,c1,c2]}; +own := P(D(A(X))) \I; +own; +need := D(A(Y)) \I; +need; +different := {[p1,p2] -> [q1,q2,c1,c2,l1,l2] : p1 != q1 || p2 != q2}; +ship := (need compose (inverse own) ) intersection different; +symbolic P1,P2; +P := {[P1,P2]}; +S := range (ship \ P); +S; +codegen S; diff --git a/omegalib/examples/old_test/p.delft2.oc-rt b/omegalib/examples/old_test/p.delft2.oc-rt new file mode 100644 index 0000000..3ee662e --- /dev/null +++ b/omegalib/examples/old_test/p.delft2.oc-rt @@ -0,0 +1,80 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # Compute Sends and receives for the following HPF fragment +# +# I := { [i,j] : 1 <= i <= 14 && 0 <= j <= 14 }; +# +# X := { [i,j] -> [3i,3j] }; +# +# Y := { [i,j] -> [i',3j] : 3i-1 <= i'<= 3i}; +# +# A := { [i,j] -> [3i,3j] }; +# +# D := { [t1,t2] -> [p1,p2,c1,c2,l1,l2] : +# t1 = 16c1+4p1+l1 +# && t2 = 16c2+4p2+l2 +# && 0 <= p1,p2 <= 3 +# && 0 <= l1,l2 <= 3 }; +# +# P := { [p1,p2,c1,c2,l1,l2] -> [p1,p2]}; +# +# C := { [p1,p2,c1,c2,l1,l2] -> [p1,p2,c1,c2]}; +# +# own := P(D(A(X))) \I; +# +# own; + +{[i,j] -> [p1,p2] : Exists ( alpha,beta : 1 <= i <= 14 && 0 <= j <= 14 && 0 <= p1 <= 3 && 0 <= p2 <= 3 && 4p1+16alpha <= 9i && 4p2+16beta <= 9j && 9i <= 3+4p1+16alpha && 9j <= 3+4p2+16beta)} + +# +# need := D(A(Y)) \I; +# +# need; + +{[i,j] -> [p1,p2,c1,c2,l1,9j-4p2-16c2] : Exists ( alpha : p1+c1+l1 = 3alpha && 1 <= i <= 14 && 0 <= j <= 14 && 0 <= p1 <= 3 && 0 <= p2 <= 3 && 0 <= l1 <= 3 && 4p2+16c2 <= 9j && 9j <= 3+4p2+16c2 && 9i <= 3+4p1+16c1+l1 && 4p1+16c1+l1 <= 9i)} + +# +# different := {[p1,p2] -> [q1,q2,c1,c2,l1,l2] : p1 != q1 || p2 != q2}; +# +# ship := (need compose (inverse own) ) intersection different; +# +# symbolic P1,P2; +# +# P := {[P1,P2]}; +# +# S := range (ship \ P); +# +# S; + +{[3,P2,c1,c2,l1,l2]: Exists ( alpha,beta,gamma : 4P2+l2 = 2c2+9beta && l1+c1 = 3alpha && 0 <= P1 <= -4c1+27 && 0 <= P2 <= 3 && -16c1-6 <= l1 <= 3 && 0 <= l2 <= 3 && 0 <= c2 && 4P2+l2+16c2 <= 126 && 9gamma <= 15+l1+16c1 && 16+4P1+16c1 <= 9gamma)} union + {[In_1,P2,c1,c2,l1,l2]: Exists ( alpha,beta,gamma : 4P2+l2 = 2c2+9beta && In_1+c1+l1 = 3alpha && 0 <= In_1 < P1 <= -4c1+31, 3 && 0 <= P2 <= 3 && 0 <= l2 <= 3 && l1 <= 3 && 6 <= 4In_1+16c1+l1 && 4P1+16c1 <= 9gamma && 0 <= 4P2+l2+16c2 && 4P2+l2+16c2 <= 126 && 9gamma <= 3+4In_1+16c1+l1)} + +# +# codegen S; +if (P1 >= 1 && P2 >= 0 && P1 <= 3 && P2 <= 3) { + for(t3 = intDiv(-P1+2+3,4); t3 <= 7; t3++) { + for(t4 = 0; t4 <= 7; t4++) { + for(t5 = 1+intMod(((-P1-t3+1)-1),3); t5 <= 3; t5 += 3) { + if (intMod(4*P1-2*t3+t5-1,9) == 0) { + for(t6 = intMod((-4*P2+2*t4),9); t6 <= 3; t6 += 9) { + s1(P1-1,P2,t3,t4,t5,t6); + } + } + } + } + } +} +if (P1 == 0 && P2 >= 0 && P2 <= 3) { + for(t3 = 0; t3 <= 6; t3++) { + for(t4 = 0; t4 <= 7; t4++) { + for(t5 = 1+intMod((-t3-1),3); t5 <= 3; t5 += 3) { + if (4*t5 == -t3+12) { + for(t6 = intMod((-4*P2+2*t4),9); t6 <= 3; t6 += 9) { + s1(3,P2,-4*t5+12,t4,t5,t6); + } + } + } + } + } +} + +# diff --git a/omegalib/examples/old_test/p.delft3 b/omegalib/examples/old_test/p.delft3 new file mode 100644 index 0000000..b2321f1 --- /dev/null +++ b/omegalib/examples/old_test/p.delft3 @@ -0,0 +1,20 @@ +Hull {[p1,p2] -> [p1-1,p2,Out_3,Out_4] : +exists ( alpha,gamma : +1 <= p1 <= 3 +&& 0 <= p2 <= 3 +&& -2Out_4+1 <= alpha <= -2Out_4+14 +&& -2Out_3+1 <= gamma <= -2Out_3+14 +&& 4p1 <= 2Out_3+9gamma +&& 4p2 <= 2Out_4+9alpha +&& 2Out_3+9gamma <= 2+4p1 +&& 2Out_4+9alpha <= 3+4p2)}; + +Hull {[0,p2] -> [3,p2,Out_3,Out_4] : +exists (alpha,gamma : +Out_3+4alpha = 0 +&& 0 <= p2 <= 3 +&& 0 <= Out_3 <= 4 +&& -2Out_4+1 <= gamma <= -2Out_4+14 +&& 4p2 <= 2Out_4+9gamma +&& 2Out_4+9gamma <= 3+4p2)}; + diff --git a/omegalib/examples/old_test/p.delft3.oc-rt b/omegalib/examples/old_test/p.delft3.oc-rt new file mode 100644 index 0000000..6f85d83 --- /dev/null +++ b/omegalib/examples/old_test/p.delft3.oc-rt @@ -0,0 +1,29 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# hull {[p1,p2] -> [p1-1,p2,Out_3,Out_4] : +# Exists ( alpha,gamma : +# 1 <= p1 <= 3 +# && 0 <= p2 <= 3 +# && -2Out_4+1 <= alpha <= -2Out_4+14 +# && -2Out_3+1 <= gamma <= -2Out_3+14 +# && 4p1 <= 2Out_3+9gamma +# && 4p2 <= 2Out_4+9alpha +# && 2Out_3+9gamma <= 2+4p1 +# && 2Out_4+9alpha <= 3+4p2)}; + +{[p1,p2] -> [p1-1,p2,Out_3,Out_4] : 1, -4Out_3+2 <= p1 <= 3 && 0, -4Out_4+2 <= p2 <= 3 && Out_3 <= 7 && Out_4 <= 7} + +# +# +# hull {[0,p2] -> [3,p2,Out_3,Out_4] : +# Exists (alpha,gamma : +# Out_3+4alpha = 0 +# && 0 <= p2 <= 3 +# && 0 <= Out_3 <= 4 +# && -2Out_4+1 <= gamma <= -2Out_4+14 +# && 4p2 <= 2Out_4+9gamma +# && 2Out_4+9gamma <= 3+4p2)}; + +{[0,p2] -> [3,p2,Out_3,Out_4] : 0, -4Out_4+2 <= p2 <= 3 && 0 <= Out_3 <= 4 && Out_4 <= 7} + +# +# diff --git a/omegalib/examples/old_test/p.subset b/omegalib/examples/old_test/p.subset new file mode 100644 index 0000000..3c8894c --- /dev/null +++ b/omegalib/examples/old_test/p.subset @@ -0,0 +1,3 @@ +{ [i] -> [j] : 1 <= i <= 9 } subset { [i] -> [j] : 1 <= i <= 11 }; + +{ [i] -> [j] : 1 <= i <= 9 } subset { [i] -> [j] : 1 <= i <= 7 }; diff --git a/omegalib/examples/old_test/p.subset.oc-rt b/omegalib/examples/old_test/p.subset.oc-rt new file mode 100644 index 0000000..b35b90f --- /dev/null +++ b/omegalib/examples/old_test/p.subset.oc-rt @@ -0,0 +1,10 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# { [i] -> [j] : 1 <= i <= 9 } subset { [i] -> [j] : 1 <= i <= 11 }; + +True +# +# +# { [i] -> [j] : 1 <= i <= 9 } subset { [i] -> [j] : 1 <= i <= 7 }; + +False +# diff --git a/omegalib/examples/old_test/p1 b/omegalib/examples/old_test/p1 new file mode 100644 index 0000000..0f29643 --- /dev/null +++ b/omegalib/examples/old_test/p1 @@ -0,0 +1 @@ +{ [i] -> [j] : 1 <= i < j <= 20 }; diff --git a/omegalib/examples/old_test/p1.oc-rt b/omegalib/examples/old_test/p1.oc-rt new file mode 100644 index 0000000..3151bd6 --- /dev/null +++ b/omegalib/examples/old_test/p1.oc-rt @@ -0,0 +1,6 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# { [i] -> [j] : 1 <= i < j <= 20 }; + +{[i] -> [j] : 1 <= i < j <= 20} + +# diff --git a/omegalib/examples/old_test/p10 b/omegalib/examples/old_test/p10 new file mode 100644 index 0000000..c802845 --- /dev/null +++ b/omegalib/examples/old_test/p10 @@ -0,0 +1 @@ +{[i,j,k,l,m] -> [i,i,i,i,i] : 1 <= i <= 100 }; diff --git a/omegalib/examples/old_test/p10.oc-rt b/omegalib/examples/old_test/p10.oc-rt new file mode 100644 index 0000000..e10a453 --- /dev/null +++ b/omegalib/examples/old_test/p10.oc-rt @@ -0,0 +1,6 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# {[i,j,k,l,m] -> [i,i,i,i,i] : 1 <= i <= 100 }; + +{[i,j,k,l,m] -> [i,i,i,i,i] : 1 <= i <= 100} + +# diff --git a/omegalib/examples/old_test/p11 b/omegalib/examples/old_test/p11 new file mode 100644 index 0000000..1871c82 --- /dev/null +++ b/omegalib/examples/old_test/p11 @@ -0,0 +1,10 @@ +{[i] : 1 <= i <= 10 + && ! i = 3 + && ! i = 2 + && ! i = 4 + && ! i = 7 + && ! i = 6 + && ! i = 8 +}; + + diff --git a/omegalib/examples/old_test/p11.oc-rt b/omegalib/examples/old_test/p11.oc-rt new file mode 100644 index 0000000..04641f2 --- /dev/null +++ b/omegalib/examples/old_test/p11.oc-rt @@ -0,0 +1,17 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# {[i] : 1 <= i <= 10 +# && ! i = 3 +# && ! i = 2 +# && ! i = 4 +# && ! i = 7 +# && ! i = 6 +# && ! i = 8 +# }; + +{[1]} union + {[5]} union + {[i]: 9 <= i <= 10} + +# +# +# diff --git a/omegalib/examples/old_test/p12 b/omegalib/examples/old_test/p12 new file mode 100644 index 0000000..ffe4b1d --- /dev/null +++ b/omegalib/examples/old_test/p12 @@ -0,0 +1,7 @@ +symbolic n,m; +T := { [i,j] -> [i-1,j] : 1 <= i <= n && 0 <= j <= m } union + { [i,j] -> [i,j-1] : 0 <= i <= n && 1 <= j <= m }; +T; +T+; +Inverse ( (Inverse T)+); +T@; diff --git a/omegalib/examples/old_test/p12.oc-rt b/omegalib/examples/old_test/p12.oc-rt new file mode 100644 index 0000000..51df294 --- /dev/null +++ b/omegalib/examples/old_test/p12.oc-rt @@ -0,0 +1,33 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n,m; +# +# T := { [i,j] -> [i-1,j] : 1 <= i <= n && 0 <= j <= m } union +# { [i,j] -> [i,j-1] : 0 <= i <= n && 1 <= j <= m }; +# +# T; + +{[i,j] -> [i-1,j] : 1 <= i <= n && 0 <= j <= m} union + {[i,j] -> [i,j-1] : 0 <= i <= n && 1 <= j <= m} + +# +# T+; + +{[i,0] -> [i',0] : m = 0 && 0 <= i' < i <= n} union + {[0,j] -> [0,j'] : n = 0 && 0 <= j' < j <= m} union + {[i,j] -> [i',j'] : 0 <= i' < i <= n && 0 <= j' <= j <= m && 1 <= m} union + {[i,j] -> [i,j'] : 0 <= j' < j <= m && 0 <= i <= n && 1 <= n} + +# +# Inverse ( (Inverse T)+); + +{[i,0] -> [i',0] : m = 0 && 0 <= i' < i <= n} union + {[0,j] -> [0,j'] : n = 0 && 0 <= j' < j <= m} union + {[i,j] -> [i',j'] : 0 <= i' < i <= n && 0 <= j' <= j <= m && 1 <= m} union + {[i,j] -> [i,j'] : 0 <= j' < j <= m && 0 <= i <= n && 1 <= n} + +# +# T@; + +{[In_1,In_2] -> [Out_1,Out_2] : Out_1 <= In_1 && Out_2 <= In_2 && In_2 <= m+Out_2 && In_1 <= n+Out_1} + +# diff --git a/omegalib/examples/old_test/p13 b/omegalib/examples/old_test/p13 new file mode 100644 index 0000000..28ca23c --- /dev/null +++ b/omegalib/examples/old_test/p13 @@ -0,0 +1,3 @@ +T := { [d1, -1] : d1 > 0 }; +T; +farkas T; diff --git a/omegalib/examples/old_test/p13.oc-rt b/omegalib/examples/old_test/p13.oc-rt new file mode 100644 index 0000000..b52c4d6 --- /dev/null +++ b/omegalib/examples/old_test/p13.oc-rt @@ -0,0 +1,13 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# T := { [d1, -1] : d1 > 0 }; +# +# T; + +{[d1,-1]: 1 <= d1} + +# +# farkas T; + +{[d1,In_2]: 0 <= d1 && In_2 <= constantTerm+d1} + +# diff --git a/omegalib/examples/old_test/p2 b/omegalib/examples/old_test/p2 new file mode 100644 index 0000000..b880627 --- /dev/null +++ b/omegalib/examples/old_test/p2 @@ -0,0 +1 @@ +{ [i,j] -> [i+1,j+1] : 1 <= i <= 9 && 5 <= j <= 25 }; diff --git a/omegalib/examples/old_test/p2.oc-rt b/omegalib/examples/old_test/p2.oc-rt new file mode 100644 index 0000000..0d4f77c --- /dev/null +++ b/omegalib/examples/old_test/p2.oc-rt @@ -0,0 +1,6 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# { [i,j] -> [i+1,j+1] : 1 <= i <= 9 && 5 <= j <= 25 }; + +{[i,j] -> [i+1,j+1] : 1 <= i <= 9 && 5 <= j <= 25} + +# diff --git a/omegalib/examples/old_test/p3 b/omegalib/examples/old_test/p3 new file mode 100644 index 0000000..226a619 --- /dev/null +++ b/omegalib/examples/old_test/p3 @@ -0,0 +1,2 @@ +symbolic n; +{ [i] -> [i+1] : 1 <= i <= n }+; diff --git a/omegalib/examples/old_test/p3.oc-rt b/omegalib/examples/old_test/p3.oc-rt new file mode 100644 index 0000000..03c8ebb --- /dev/null +++ b/omegalib/examples/old_test/p3.oc-rt @@ -0,0 +1,8 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n; +# +# { [i] -> [i+1] : 1 <= i <= n }+; + +{[i] -> [Out_1] : 1 <= i < Out_1 <= n+1} + +# diff --git a/omegalib/examples/old_test/p4 b/omegalib/examples/old_test/p4 new file mode 100644 index 0000000..2fcd2aa --- /dev/null +++ b/omegalib/examples/old_test/p4 @@ -0,0 +1,5 @@ +inverse { [i] -> [i+1] : 1 <= i <= 9 }; +domain { [i] -> [i+1] : 1 <= i <= 9 }; +range { [i] -> [i+1] : 1 <= i <= 9 }; +{ [i] -> [i+1] : 1 <= i <= 9 } compose { [i] -> [i+1] : 1 <= i <= 9 }; + diff --git a/omegalib/examples/old_test/p4.oc-rt b/omegalib/examples/old_test/p4.oc-rt new file mode 100644 index 0000000..020d1d2 --- /dev/null +++ b/omegalib/examples/old_test/p4.oc-rt @@ -0,0 +1,22 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# inverse { [i] -> [i+1] : 1 <= i <= 9 }; + +{[In_1] -> [In_1-1] : 2 <= In_1 <= 10} + +# +# domain { [i] -> [i+1] : 1 <= i <= 9 }; + +{[i]: 1 <= i <= 9} + +# +# range { [i] -> [i+1] : 1 <= i <= 9 }; + +{[In_1]: 2 <= In_1 <= 10} + +# +# { [i] -> [i+1] : 1 <= i <= 9 } compose { [i] -> [i+1] : 1 <= i <= 9 }; + +{[i] -> [i+2] : 1 <= i <= 8} + +# +# diff --git a/omegalib/examples/old_test/p5 b/omegalib/examples/old_test/p5 new file mode 100644 index 0000000..ae7b242 --- /dev/null +++ b/omegalib/examples/old_test/p5 @@ -0,0 +1,8 @@ +symbolic n; +{[iw] -> [ir] : + 1 <= iw, ir <= 2n and iw=ir + and ! exists ( ik,jk : 1 <= ik <= 2n && 1 <= jk < n and + iw <= ik = ir and 2jk = ir ) + and ! exists ( ik,jk : 1 <= ik <= 2n && 1 <= jk < n and + iw <= ik = ir and 2jk+1 = ir ) + }; diff --git a/omegalib/examples/old_test/p5.oc-rt b/omegalib/examples/old_test/p5.oc-rt new file mode 100644 index 0000000..ef73886 --- /dev/null +++ b/omegalib/examples/old_test/p5.oc-rt @@ -0,0 +1,16 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n; +# +# {[iw] -> [ir] : +# 1 <= iw, ir <= 2n and iw=ir +# and ! exists ( ik,jk : 1 <= ik <= 2n && 1 <= jk < n and +# iw <= ik = ir and 2jk = ir ) +# and ! exists ( ik,jk : 1 <= ik <= 2n && 1 <= jk < n and +# iw <= ik = ir and 2jk+1 = ir ) +# }; + +{[iw] -> [iw] : n = 1 && 1 <= iw <= 2} union + {[2n] -> [2n] : 2 <= n} union + {[1] -> [1] : 2 <= n} + +# diff --git a/omegalib/examples/old_test/p6 b/omegalib/examples/old_test/p6 new file mode 100644 index 0000000..f09634a --- /dev/null +++ b/omegalib/examples/old_test/p6 @@ -0,0 +1,25 @@ +R := { [i] -> [i'] : 1 <= i,i' <= 10 && i' = i+1 }; +R; +inverse R; +domain R; +range R; +R compose R; +R+; # closure of R = R union (R compose R) union (R compose R ... +complement R; +S := {[i] : 5 <= i <= 25}; +S; +R(S); # apply R to S +R \ S; # restrict domain of R to S +R / S; # restrict range of R to S +(R\S) union (R/S); +(R\S) intersection (R/S); +(R/S) - (R\S); +S*S; # cross product +D := S - {[9:16:2]} - {[17:19]}; +D; +T := { [i] : 1 <= i <= 11 & exists (a : i = 2a) }; +T; +Hull T; +Hull D; +codegen D; +codegen {[i,j] : 1 <= i+j,j <= 10}; diff --git a/omegalib/examples/old_test/p6.oc-rt b/omegalib/examples/old_test/p6.oc-rt new file mode 100644 index 0000000..109e029 --- /dev/null +++ b/omegalib/examples/old_test/p6.oc-rt @@ -0,0 +1,129 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := { [i] -> [i'] : 1 <= i,i' <= 10 && i' = i+1 }; +# +# R; + +{[i] -> [i+1] : 1 <= i <= 9} + +# +# inverse R; + +{[i] -> [i-1] : 2 <= i <= 10} + +# +# domain R; + +{[i]: 1 <= i <= 9} + +# +# range R; + +{[i]: 2 <= i <= 10} + +# +# R compose R; + +{[i] -> [i+2] : 1 <= i <= 8} + +# +# R+; + +{[i] -> [i'] : 1 <= i < i' <= 10} + +# # closure of R = R union (R compose R) union (R compose R ... +# complement R; + +{[i] -> [i'] : i <= 0} union + {[i] -> [i'] : 10 <= i} union + {[i] -> [i'] : 1 <= i <= 9, i'-2} union + {[i] -> [i'] : 1, i' <= i <= 9} + +# +# S := {[i] : 5 <= i <= 25}; +# +# S; + +{[i]: 5 <= i <= 25} + +# +# R(S); + +{[i]: 6 <= i <= 10} + +# # apply R to S +# R \ S; + +{[i] -> [i+1] : 5 <= i <= 9} + +# # restrict domain of R to S +# R / S; + +{[i] -> [i+1] : 4 <= i <= 9} + +# # restrict range of R to S +# (R\S) union (R/S); + +{[i] -> [i+1] : 4 <= i <= 9} + +# +# (R\S) intersection (R/S); + +{[i] -> [i+1] : 5 <= i <= 9} + +# +# (R/S) - (R\S); + +{[4] -> [5] } + +# +# S*S; + +{[i] -> [i'] : 5 <= i <= 25 && 5 <= i' <= 25} + +# # cross product +# D := S - {[9:16:2]} - {[17:19]}; +# +# D; + +{[i]: 5 <= i <= 8} union + {[i]: Exists ( alpha : 2alpha = i && 10 <= i <= 16)} union + {[i]: 20 <= i <= 25} + +# +# T := { [i] : 1 <= i <= 11 & exists (a : i = 2a) }; +# +# T; + +{[i]: Exists ( alpha : 2alpha = i && 2 <= i <= 10)} + +# +# Hull T; + +{[i]: 2 <= i <= 10} + +# +# Hull D; + +{[i]: 5 <= i <= 25} + +# +# codegen D; +for(t1 = 5; t1 <= 8; t1++) { + s1(t1); +} +for(t1 = 10; t1 <= 16; t1 += 2) { + s1(t1); +} +for(t1 = 20; t1 <= 25; t1++) { + s1(t1); +} + +# +# codegen {[i,j] : 1 <= i+j,j <= 10}; +for(t1 = -9; t1 <= 9; t1++) { + for(t2 = max(-t1+1,1); t2 <= min(-t1+10,10); t2++) { + s1(t1,t2); + } +} + +# diff --git a/omegalib/examples/old_test/p7 b/omegalib/examples/old_test/p7 new file mode 100644 index 0000000..d892912 --- /dev/null +++ b/omegalib/examples/old_test/p7 @@ -0,0 +1 @@ +{ [i] -> [j] : 1 <= i,j <= 10 and i != j}; diff --git a/omegalib/examples/old_test/p7.oc-rt b/omegalib/examples/old_test/p7.oc-rt new file mode 100644 index 0000000..af7cf5f --- /dev/null +++ b/omegalib/examples/old_test/p7.oc-rt @@ -0,0 +1,7 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# { [i] -> [j] : 1 <= i,j <= 10 and i != j}; + +{[i] -> [j] : 1 <= j < i <= 10} union + {[i] -> [j] : 1 <= i < j <= 10} + +# diff --git a/omegalib/examples/old_test/p8 b/omegalib/examples/old_test/p8 new file mode 100644 index 0000000..d6031ad --- /dev/null +++ b/omegalib/examples/old_test/p8 @@ -0,0 +1,6 @@ +R1 := {[i] -> [j] : i < j}; +R2 := {[x] -> [y] : x < y}; +inverse R2; +R1 union R2; +R2(R1); + diff --git a/omegalib/examples/old_test/p8.oc-rt b/omegalib/examples/old_test/p8.oc-rt new file mode 100644 index 0000000..b9d569a --- /dev/null +++ b/omegalib/examples/old_test/p8.oc-rt @@ -0,0 +1,21 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R1 := {[i] -> [j] : i < j}; +# +# R2 := {[x] -> [y] : x < y}; +# +# inverse R2; + +{[y] -> [x] : x < y} + +# +# R1 union R2; + +{[In_1] -> [Out_1] : In_1 < Out_1} + +# +# R2(R1); + +{[i] -> [y] : i <= y-2} + +# +# diff --git a/omegalib/examples/old_test/p9 b/omegalib/examples/old_test/p9 new file mode 100644 index 0000000..8f38d36 --- /dev/null +++ b/omegalib/examples/old_test/p9 @@ -0,0 +1,7 @@ +symbolic lot_E; +{[k_w,l_w] -> [k_r,l_r] : +1 <= k_r <= 12 and +1 <= l_r <= lot_E and +2k_r+96l_r = 12+2k_w+96l_w and +1 <= k_w <= 3 and +1 <= l_w <= lot_E}; diff --git a/omegalib/examples/old_test/p9.oc-rt b/omegalib/examples/old_test/p9.oc-rt new file mode 100644 index 0000000..b3e1f55 --- /dev/null +++ b/omegalib/examples/old_test/p9.oc-rt @@ -0,0 +1,13 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic lot_E; +# +# {[k_w,l_w] -> [k_r,l_r] : +# 1 <= k_r <= 12 and +# 1 <= l_r <= lot_E and +# 2k_r+96l_r = 12+2k_w+96l_w and +# 1 <= k_w <= 3 and +# 1 <= l_w <= lot_E}; + +{[k_w,l_w] -> [k_w+6,l_w] : 1 <= k_w <= 3 && 1 <= l_w <= lot_E} + +# diff --git a/omegalib/examples/old_test/pufs1 b/omegalib/examples/old_test/pufs1 new file mode 100644 index 0000000..908c84f --- /dev/null +++ b/omegalib/examples/old_test/pufs1 @@ -0,0 +1,2 @@ +symbolic n(1); +{ [i] -> [j] : 1 <= i <= j <= 100 && n(i) != n(j)}; diff --git a/omegalib/examples/old_test/pufs1.oc-rt b/omegalib/examples/old_test/pufs1.oc-rt new file mode 100644 index 0000000..0a7312f --- /dev/null +++ b/omegalib/examples/old_test/pufs1.oc-rt @@ -0,0 +1,9 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n(1); +# +# { [i] -> [j] : 1 <= i <= j <= 100 && n(i) != n(j)}; + +{[i] -> [j] : 1 <= i < j <= 100 && n(j) < n(i)} union + {[i] -> [j] : 1 <= i < j <= 100 && n(i) < n(j)} + +# diff --git a/omegalib/examples/old_test/pufs2 b/omegalib/examples/old_test/pufs2 new file mode 100644 index 0000000..391c9d4 --- /dev/null +++ b/omegalib/examples/old_test/pufs2 @@ -0,0 +1,9 @@ +symbolic n(1); +R := { [i] -> [j] : 1 <= i = j <= 100 && n(i) <= n(j)}; +S := { [i] -> [j] : 1 <= i <= j <= 100 && n(i) = n(j)}; + +R; +S; +R intersection S; +R union S; +R intersection complement S; diff --git a/omegalib/examples/old_test/pufs2.oc-rt b/omegalib/examples/old_test/pufs2.oc-rt new file mode 100644 index 0000000..b71d651 --- /dev/null +++ b/omegalib/examples/old_test/pufs2.oc-rt @@ -0,0 +1,35 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n(1); +# +# R := { [i] -> [j] : 1 <= i = j <= 100 && n(i) <= n(j)}; +# +# S := { [i] -> [j] : 1 <= i <= j <= 100 && n(i) = n(j)}; +# +# +# R; + +{[i] -> [i] : 1 <= i <= 100} + +# +# S; + +{[i] -> [i] : 1 <= i <= 100} union + {[i] -> [j] : n(j) = n(i) && 1 <= i < j <= 100} + +# +# R intersection S; + +{[i] -> [i] : 1 <= i <= 100} + +# +# R union S; + +{[i] -> [j] : n(j) = n(i) && 1 <= i < j <= 100} union + {[i] -> [i] : 1 <= i <= 100} + +# +# R intersection complement S; + +{[i] -> [j] : FALSE } + +# diff --git a/omegalib/examples/old_test/pufs3 b/omegalib/examples/old_test/pufs3 new file mode 100644 index 0000000..0a1af56 --- /dev/null +++ b/omegalib/examples/old_test/pufs3 @@ -0,0 +1,8 @@ +symbolic n(1); +R := { [i] -> [j] : 1 <= i = j <= 100 && n(i) <= n(j)}; +S := { [i] -> [j] : 1 <= i <= j <= 100 && n(i) = n(j)}; + +R intersection complement S; +inverse R; +inverse S; +inverse S intersection complement inverse R; diff --git a/omegalib/examples/old_test/pufs3.oc-rt b/omegalib/examples/old_test/pufs3.oc-rt new file mode 100644 index 0000000..55f851c --- /dev/null +++ b/omegalib/examples/old_test/pufs3.oc-rt @@ -0,0 +1,29 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n(1); +# +# R := { [i] -> [j] : 1 <= i = j <= 100 && n(i) <= n(j)}; +# +# S := { [i] -> [j] : 1 <= i <= j <= 100 && n(i) = n(j)}; +# +# +# R intersection complement S; + +{[i] -> [j] : FALSE } + +# +# inverse R; + +{[j] -> [j] : 1 <= j <= 100} + +# +# inverse S; + +{[j] -> [j] : 1 <= j <= 100} union + {[j] -> [i] : n(j) = n(i) && 1 <= i < j <= 100} + +# +# inverse S intersection complement inverse R; + +{[j] -> [i] : n(j) = n(i) && 1 <= i < j <= 100} + +# diff --git a/omegalib/examples/old_test/pufs4 b/omegalib/examples/old_test/pufs4 new file mode 100644 index 0000000..57e868e --- /dev/null +++ b/omegalib/examples/old_test/pufs4 @@ -0,0 +1,16 @@ +# Calculate exposed reads for this code fragment +# for i := 1 to n do +# for j := 1 to m do +# if p(i,j) >= 0 then a(i,j) = 1 +# else a(i,j) = 0 +# .... a(i,j) +# + +symbolic p(2), n, m; +R := { [ir,jr] : 1 <= ir <= n && 1 <= jr <= m }; +W1 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(iw,jw) >= 0 }; +W2 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(iw,jw) < 0 }; + +Exposed := R-W1-W2; + +Exposed; diff --git a/omegalib/examples/old_test/pufs4.oc-rt b/omegalib/examples/old_test/pufs4.oc-rt new file mode 100644 index 0000000..2c32c83 --- /dev/null +++ b/omegalib/examples/old_test/pufs4.oc-rt @@ -0,0 +1,26 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # Calculate exposed reads for this code fragment +# # for i := 1 to n do +# # for j := 1 to m do +# # if p(i,j) >= 0 then a(i,j) = 1 +# # else a(i,j) = 0 +# # .... a(i,j) +# # +# +# symbolic p(2), n, m; +# +# R := { [ir,jr] : 1 <= ir <= n && 1 <= jr <= m }; +# +# W1 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(iw,jw) >= 0 }; +# +# W2 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(iw,jw) < 0 }; +# +# +# Exposed := R-W1-W2; +# +# +# Exposed; + +{[iw,jw] : FALSE } + +# diff --git a/omegalib/examples/old_test/pufs5 b/omegalib/examples/old_test/pufs5 new file mode 100644 index 0000000..19249af --- /dev/null +++ b/omegalib/examples/old_test/pufs5 @@ -0,0 +1,22 @@ +symbolic n(1); +S := { [i] -> [j] : 1 <= i < j <= 100 && n(j) >= 0}; +R := domain S; +S; +R; +upper_bound R; +lower_bound R; + +R - {[1:50]}; +{[1:50]} - R; +{[1:50]} - upper_bound R; +{[1:50]} - lower_bound R; + +R union {[10:30]} union {[25:100]} union {[1:10]}; +upper_bound (R union {[10:30]} union {[25:100]} union {[1:10]}); +lower_bound (R union {[10:30]} union {[25:100]} union {[1:10]}); + +{[101:200]} - R; +{[1:200]} - R; +{[1:200]} - R - {[10:30]} - {[25:100]}; +{[1:200]} - (R union {[10:30]} union {[25:100]} union {[1:10]}); +{[1:200]} - R - {[10:30]} - {[25:100]} - {[1:10]}; diff --git a/omegalib/examples/old_test/pufs5.oc-rt b/omegalib/examples/old_test/pufs5.oc-rt new file mode 100644 index 0000000..614a9fb --- /dev/null +++ b/omegalib/examples/old_test/pufs5.oc-rt @@ -0,0 +1,98 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n(1); +# +# S := { [i] -> [j] : 1 <= i < j <= 100 && n(j) >= 0}; +# +# R := domain S; +# +# S; + +{[i] -> [j] : 1 <= i < j <= 100 && 0 <= n(j)} + +# +# R; + +{[i]: 1 <= i <= 99 && UNKNOWN} + +# +# upper_bound R; + +{[i]: 1 <= i <= 99} + +# +# lower_bound R; + +{[i] : FALSE } + +# +# +# R - {[1:50]}; + +{[i]: 51 <= i <= 99 && UNKNOWN} + +# +# {[1:50]} - R; + +{[i]: 1 <= i <= 50 && UNKNOWN} + +# +# {[1:50]} - upper_bound R; + +{[i] : FALSE } + +# +# {[1:50]} - lower_bound R; + +{[i]: 1 <= i <= 50} + +# +# +# R union {[10:30]} union {[25:100]} union {[1:10]}; + +{[i]: 1 <= i <= 99 && UNKNOWN} union + {[i]: 10 <= i <= 30} union + {[i]: 25 <= i <= 100} union + {[i]: 1 <= i <= 10} + +# +# upper_bound (R union {[10:30]} union {[25:100]} union {[1:10]}); + +{[i]: 1 <= i <= 99} union + {[i]: 25 <= i <= 100} + +# +# lower_bound (R union {[10:30]} union {[25:100]} union {[1:10]}); + +{[i]: 10 <= i <= 30} union + {[i]: 25 <= i <= 100} union + {[i]: 1 <= i <= 10} + +# +# +# {[101:200]} - R; + +{[i]: 101 <= i <= 200} + +# +# {[1:200]} - R; + +{[i]: 1 <= i <= 99 && UNKNOWN} union + {[i]: 100 <= i <= 200} + +# +# {[1:200]} - R - {[10:30]} - {[25:100]}; + +{[i]: 1 <= i <= 9 && UNKNOWN} union + {[i]: 101 <= i <= 200} + +# +# {[1:200]} - (R union {[10:30]} union {[25:100]} union {[1:10]}); + +{[i]: 101 <= i <= 200} + +# +# {[1:200]} - R - {[10:30]} - {[25:100]} - {[1:10]}; + +{[i]: 101 <= i <= 200} + +# diff --git a/omegalib/examples/old_test/pufs6 b/omegalib/examples/old_test/pufs6 new file mode 100644 index 0000000..e24aa12 --- /dev/null +++ b/omegalib/examples/old_test/pufs6 @@ -0,0 +1,19 @@ +symbolic n, f(1), f_last, f_first; + +True := { [] : 1 = 1 }; + +old_R1 := { [x] -> [] : (1 <= x <= n and f(x) > 0)}; +old_R2 := { [x] -> [] : (1 <= x <= n and f(x) <=0)}; +True - range old_R1 - range old_R2; + +R1 := { [x] -> [] : (3 <= x <= n-1 and f(x) > 0) + or (1 <= n and f_last > 0) + or (1 <= n and f_first > 0) }; +R2 := { [x] -> [] : (3 <= x <= n-1 and f(x) <=0) + or (1 <= n and f_last <=0) + or (1 <= n and f_first <=0) }; +True - range R1 - range R2; + +R1a := { [x] -> [] : (1 <= x <= n and (f(x) > 0 or f_first > 0 or f_last > 0)) }; +R2a := { [x] -> [] : (1 <= x <= n and (f(x) <=0 or f_first <=0 or f_last <=0)) }; +True - range R1a - range R2a; diff --git a/omegalib/examples/old_test/pufs6.oc-rt b/omegalib/examples/old_test/pufs6.oc-rt new file mode 100644 index 0000000..d782cfc --- /dev/null +++ b/omegalib/examples/old_test/pufs6.oc-rt @@ -0,0 +1,42 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# Symbolic n, f(1), f_last, f_first; +# +# +# True := { [] : 1 = 1 }; +# +# +# old_R1 := { [x] -> [] : (1 <= x <= n and f(x) > 0)}; +# +# old_R2 := { [x] -> [] : (1 <= x <= n and f(x) <=0)}; +# +# True - range old_R1 - range old_R2; + +{ 1 <= n && UNKNOWN} union + { n <= 0} + +# +# +# R1 := { [x] -> [] : (3 <= x <= n-1 and f(x) > 0) +# or (1 <= n and f_last > 0) +# or (1 <= n and f_first > 0) }; +# +# R2 := { [x] -> [] : (3 <= x <= n-1 and f(x) <=0) +# or (1 <= n and f_last <=0) +# or (1 <= n and f_first <=0) }; +# +# True - range R1 - range R2; + +{ n <= 0} + +# +# +# R1a := { [x] -> [] : (1 <= x <= n and (f(x) > 0 or f_first > 0 or f_last > 0)) }; +# +# R2a := { [x] -> [] : (1 <= x <= n and (f(x) <=0 or f_first <=0 or f_last <=0)) }; +# +# True - range R1a - range R2a; + +{ f_last <= 0 && n <= 0} union + { n <= 0 && 1 <= f_last} + +# diff --git a/omegalib/examples/old_test/pufs7 b/omegalib/examples/old_test/pufs7 new file mode 100644 index 0000000..33905bf --- /dev/null +++ b/omegalib/examples/old_test/pufs7 @@ -0,0 +1,6 @@ +symbolic n(1),m; +{[i] : n(i) >= 0} union {[i] : n(i) <=0}; + +{[i] : n(i) >= 1 && 1 <= i <= m} + union {[i] : n(i) <1 && 1 <= i <= m}; + diff --git a/omegalib/examples/old_test/pufs7.oc-rt b/omegalib/examples/old_test/pufs7.oc-rt new file mode 100644 index 0000000..84a8b93 --- /dev/null +++ b/omegalib/examples/old_test/pufs7.oc-rt @@ -0,0 +1,18 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n(1),m; +# +# {[i] : n(i) >= 0} union {[i] : n(i) <=0}; + +{[i]: 0 <= n(i)} union + {[i]: n(i) <= 0} + +# +# +# {[i] : n(i) >= 1 && 1 <= i <= m} +# union {[i] : n(i) <1 && 1 <= i <= m}; + +{[i]: 1 <= i <= m && 1 <= n(i)} union + {[i]: 1 <= i <= m && n(i) <= 0} + +# +# diff --git a/omegalib/examples/old_test/reach1 b/omegalib/examples/old_test/reach1 new file mode 100644 index 0000000..268868f --- /dev/null +++ b/omegalib/examples/old_test/reach1 @@ -0,0 +1,5 @@ + +reachable (a,b,c) + { a->b:{[1]->[2]}, + b->c:{[2]->[3]}, + a:{[1]}}; diff --git a/omegalib/examples/old_test/reach1.oc-rt b/omegalib/examples/old_test/reach1.oc-rt new file mode 100644 index 0000000..8333ede --- /dev/null +++ b/omegalib/examples/old_test/reach1.oc-rt @@ -0,0 +1,9 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# +# reachable (a,b,c) +# { a->b:{[1]->[2]}, +# b->c:{[2]->[3]}, +# a:{[1]}}; +Node b: {[2]} +Node c: {[3]} +# diff --git a/omegalib/examples/old_test/reach2 b/omegalib/examples/old_test/reach2 new file mode 100644 index 0000000..1a692a0 --- /dev/null +++ b/omegalib/examples/old_test/reach2 @@ -0,0 +1,29 @@ + +a2b:={[1]->[2]}; + +b2c1:={[i]->[i]}; +b2c2:={[i]->[j]}; + +a2a:={[i]->[i]}; +b2b:={[i]->[i]}; +c2c:={[i]->[i]}; + + + +reachable (a,b,c){ a->b:a2b, b->c:b2c1, a->a:a2a, b->b:b2b, c->c:c2c, + a:{[1]}}; + +reachable (a,b,c) { a->b:a2b, b->c:b2c2, a->a:a2a, b->b:b2b, c->c:c2c, + a:{[1]}}; + +b2c3:={[i]->[i+1]}; +b2b2:={[i]->[i+1]}; + +reachable (a,b,c){ a->b:a2b, b->c:b2c3, a->a:a2a, b->b:b2b2, c->c:c2c, + a:{[1]}}; + +b2c3:={[i]->[i]}; + +reachable (a,b,c){ a->b:a2b, b->c:b2c3, a->a:a2a, b->b:b2b2, c->c:c2c, + a:{[1]}}; + diff --git a/omegalib/examples/old_test/reach2.oc-rt b/omegalib/examples/old_test/reach2.oc-rt new file mode 100644 index 0000000..8a8a904 --- /dev/null +++ b/omegalib/examples/old_test/reach2.oc-rt @@ -0,0 +1,61 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# +# a2b:={[1]->[2]}; +# +# +# b2c1:={[i]->[i]}; +# +# b2c2:={[i]->[j]}; +# +# +# a2a:={[i]->[i]}; +# +# b2b:={[i]->[i]}; +# +# c2c:={[i]->[i]}; +# +# +# +# +# reachable (a,b,c){ a->b:a2b, b->c:b2c1, a->a:a2a, b->b:b2b, c->c:c2c, +# a:{[1]}}; +Node a: {[1]} +Node b: {[2]} +Node c: {[2]} +# +# +# reachable (a,b,c) { a->b:a2b, b->c:b2c2, a->a:a2a, b->b:b2b, c->c:c2c, +# a:{[1]}}; +Node a: {[1]} +Node b: {[2]} +Node c: {[In_1]} +# +# +# b2c3:={[i]->[i+1]}; +# +# b2b2:={[i]->[i+1]}; +# +# +# reachable (a,b,c){ a->b:a2b, b->c:b2c3, a->a:a2a, b->b:b2b2, c->c:c2c, +# a:{[1]}}; +Node a: {[1]} +Node b: {[2]} union + {[In_1]: 4 <= In_1} union + {[3]} +Node c: {[i]: 4 <= i} union + {[3]} +# +# +# b2c3:={[i]->[i]}; +# +# +# reachable (a,b,c){ a->b:a2b, b->c:b2c3, a->a:a2a, b->b:b2b2, c->c:c2c, +# a:{[1]}}; +Node a: {[1]} +Node b: {[2]} union + {[In_1]: 4 <= In_1} union + {[3]} +Node c: {[i]: 3 <= i} union + {[2]} +# +# diff --git a/omegalib/examples/old_test/reach3 b/omegalib/examples/old_test/reach3 new file mode 100644 index 0000000..39c954d --- /dev/null +++ b/omegalib/examples/old_test/reach3 @@ -0,0 +1,18 @@ + +a2b:={[1]->[2]}; +a2a:={[i]->[i]}; +b2b2:={[i]->[i+1]}; +b2c3:={[i]->[i]}; +c2c:={[i]->[i]}; + +reachable of a in (a,b,c) { + a->b:a2b, b->c:b2c3, a->a:a2a, b->b:b2b2, c->c:c2c, + a:{[1]} + }; +reachable of b in (a,b,c) { + a->b:a2b, b->c:b2c3, a->a:a2a, a:{[1]}, b->b:b2b2, c->c:c2c + }; +cr := reachable of c in (a,b,c) { + a:{[1]},a->b:a2b, b->c:b2c3, a->a:a2a, + b->b:b2b2, c->c:c2c }; +cr; diff --git a/omegalib/examples/old_test/reach3.oc-rt b/omegalib/examples/old_test/reach3.oc-rt new file mode 100644 index 0000000..3418061 --- /dev/null +++ b/omegalib/examples/old_test/reach3.oc-rt @@ -0,0 +1,40 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# +# a2b:={[1]->[2]}; +# +# a2a:={[i]->[i]}; +# +# b2b2:={[i]->[i+1]}; +# +# b2c3:={[i]->[i]}; +# +# c2c:={[i]->[i]}; +# +# +# reachable of a in (a,b,c) { +# a->b:a2b, b->c:b2c3, a->a:a2a, b->b:b2b2, c->c:c2c, +# a:{[1]} +# }; + +{[1]} + +# +# reachable of b in (a,b,c) { +# a->b:a2b, b->c:b2c3, a->a:a2a, a:{[1]}, b->b:b2b2, c->c:c2c +# }; + +{[2]} union + {[In_1]: 4 <= In_1} union + {[3]} + +# +# cr := reachable of c in (a,b,c) { +# a:{[1]},a->b:a2b, b->c:b2c3, a->a:a2a, +# b->b:b2b2, c->c:c2c }; +# +# cr; + +{[i]: 3 <= i} union + {[2]} + +# diff --git a/omegalib/examples/old_test/red1 b/omegalib/examples/old_test/red1 new file mode 100644 index 0000000..1a479b3 --- /dev/null +++ b/omegalib/examples/old_test/red1 @@ -0,0 +1,3 @@ +R1 := {[i,j,k] : 17i=12j+170}; +R2 := {[i,j,k] : k >= 0}; +gist R1 given R2; diff --git a/omegalib/examples/old_test/red1.oc-rt b/omegalib/examples/old_test/red1.oc-rt new file mode 100644 index 0000000..32cbb97 --- /dev/null +++ b/omegalib/examples/old_test/red1.oc-rt @@ -0,0 +1,10 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R1 := {[i,j,k] : 17i=12j+170}; +# +# R2 := {[i,j,k] : k >= 0}; +# +# gist R1 given R2; + +{[i,j,k]: 17i = 170+12j} + +# diff --git a/omegalib/examples/old_test/saman b/omegalib/examples/old_test/saman new file mode 100644 index 0000000..bf44452 --- /dev/null +++ b/omegalib/examples/old_test/saman @@ -0,0 +1,20 @@ +# Passing array sections through array reshaping +# procedure foo() +# real a(1:5,1:64,1:64,1:5) +# for i = 1 to 64 do +# for j = 1 to 64 do +# bar(a(1,i,j,1)) +# ... +# procedure bar(x(*)) +# x(1:5) = ... +# +# Question which element of a are effected by the call to bar? +# +symbolic i,j; +R := {[i1,i2,i3,i4] -> [o1] : + (i1-1) + (i2-i)*5 + (i3-j)*5*64 + (i4-1)*5*64*64 + = o1-1 + && 1 <= i1,i4 <= 5 + && 1 <= i,j,i2,i3 <= 64}; +R; +(inverse R)({[1:5]}); diff --git a/omegalib/examples/old_test/saman.oc-rt b/omegalib/examples/old_test/saman.oc-rt new file mode 100644 index 0000000..d75d4df --- /dev/null +++ b/omegalib/examples/old_test/saman.oc-rt @@ -0,0 +1,31 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # Passing array sections through array reshaping +# # procedure foo() +# # real a(1:5,1:64,1:64,1:5) +# # for i = 1 to 64 do +# # for j = 1 to 64 do +# # bar(a(1,i,j,1)) +# # ... +# # procedure bar(x(*)) +# # x(1:5) = ... +# # +# # Question which element of a are effected by the call to bar? +# # +# symbolic i,j; +# +# R := {[i1,i2,i3,i4] -> [o1] : +# (i1-1) + (i2-i)*5 + (i3-j)*5*64 + (i4-1)*5*64*64 +# = o1-1 +# && 1 <= i1,i4 <= 5 +# && 1 <= i,j,i2,i3 <= 64}; +# +# R; + +{[i1,i2,i3,i4] -> [i1-320j-5i+5i2+320i3+20480i4-20480] : 1 <= j <= 64 && 1 <= i <= 64 && 1 <= i1 <= 5 && 1 <= i2 <= 64 && 1 <= i3 <= 64 && 1 <= i4 <= 5} + +# +# (inverse R)({[1:5]}); + +{[i1,i,j,1]: 1 <= i <= 64 && 1 <= j <= 64 && 1 <= i1 <= 5} + +# diff --git a/omegalib/examples/old_test/sample1 b/omegalib/examples/old_test/sample1 new file mode 100644 index 0000000..fb292b3 --- /dev/null +++ b/omegalib/examples/old_test/sample1 @@ -0,0 +1,14 @@ +example { [i] -> [j] : 1 <= i < j <= 20 }; + +example { [i,j] -> [i+1,j+1] : 1 <= i <= 9 && 5 <= j <= 25 }; + +example (inverse { [i] -> [i+1] : 1 <= i <= 9 }); + +example (domain { [i] -> [i+1] : 1 <= i <= 9 }); + +example (range { [i] -> [i+1] : 1 <= i <= 9 }); + +example ({[i] -> [i+1] : 1 <= i <= 9 } compose { [i] -> [i+1] : 1 <= i <= 9 }); + + + diff --git a/omegalib/examples/old_test/sample1.oc-rt b/omegalib/examples/old_test/sample1.oc-rt new file mode 100644 index 0000000..bb19b15 --- /dev/null +++ b/omegalib/examples/old_test/sample1.oc-rt @@ -0,0 +1,39 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# example { [i] -> [j] : 1 <= i < j <= 20 }; + +{[19] -> [20] } + +# +# +# example { [i,j] -> [i+1,j+1] : 1 <= i <= 9 && 5 <= j <= 25 }; + +{[1,5] -> [2,6] } + +# +# +# example (inverse { [i] -> [i+1] : 1 <= i <= 9 }); + +{[2] -> [1] } + +# +# +# example (domain { [i] -> [i+1] : 1 <= i <= 9 }); + +{[1]} + +# +# +# example (range { [i] -> [i+1] : 1 <= i <= 9 }); + +{[2]} + +# +# +# example ({[i] -> [i+1] : 1 <= i <= 9 } compose { [i] -> [i+1] : 1 <= i <= 9 }); + +{[1] -> [3] } + +# +# +# +# diff --git a/omegalib/examples/old_test/sample2 b/omegalib/examples/old_test/sample2 new file mode 100644 index 0000000..1ca6b19 --- /dev/null +++ b/omegalib/examples/old_test/sample2 @@ -0,0 +1,11 @@ +symbolic n,m; + +example { [i] -> [j] : 1 <= i <= 20 }; + +example {[i] : 1 <= i <= n}; + +example {[i] : m <= i <= n}; + +example {[i] : exists ( alpha : i <= 2alpha)}; + +example {[i] : exists ( alpha : i = 2alpha)}; diff --git a/omegalib/examples/old_test/sample2.oc-rt b/omegalib/examples/old_test/sample2.oc-rt new file mode 100644 index 0000000..e18d650 --- /dev/null +++ b/omegalib/examples/old_test/sample2.oc-rt @@ -0,0 +1,33 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# Symbolic n,m; +# +# +# example { [i] -> [j] : 1 <= i <= 20 }; + +{[1] -> [42] } + +# +# +# example {[i] : 1 <= i <= n}; + +{[1]: n = 1} + +# +# +# example {[i] : m <= i <= n}; + +{[42]: m = 42 && n = 42} + +# +# +# example {[i] : exists ( alpha : i <= 2alpha)}; + +{[42]} + +# +# +# example {[i] : exists ( alpha : i = 2alpha)}; + +{[0]} + +# diff --git a/omegalib/examples/old_test/sample3 b/omegalib/examples/old_test/sample3 new file mode 100644 index 0000000..44a481d --- /dev/null +++ b/omegalib/examples/old_test/sample3 @@ -0,0 +1,11 @@ +symbolic n,m; + +sym_example {[i] : 1 <= i <= n}; + +sym_example {[i] : m <= i <= n}; + +sym_example {[i] : m <= i <= n && exists (alpha : i = 2alpha)}; +example {[i] : m <= i <= n && exists (alpha : i = 2alpha)}; +example {[i] : m < i <= n && exists (alpha : i = 2alpha)}; +example {[i] : m < i < n}; + diff --git a/omegalib/examples/old_test/sample3.oc-rt b/omegalib/examples/old_test/sample3.oc-rt new file mode 100644 index 0000000..a486bdd --- /dev/null +++ b/omegalib/examples/old_test/sample3.oc-rt @@ -0,0 +1,37 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# Symbolic n,m; +# +# +# sym_example {[i] : 1 <= i <= n}; + +{[1]: 1 <= n} + +# +# +# sym_example {[i] : m <= i <= n}; + +{[m]: m <= n} + +# +# +# sym_example {[i] : m <= i <= n && exists (alpha : i = 2alpha)}; + +{[0]: m <= 0 && 0 <= n} + +# +# example {[i] : m <= i <= n && exists (alpha : i = 2alpha)}; + +{[42]: m = 42 && n = 42} + +# +# example {[i] : m < i <= n && exists (alpha : i = 2alpha)}; + +{[44]: m = 42 && n = 44} + +# +# example {[i] : m < i < n}; + +{[43]: m = 42 && n = 44} + +# +# diff --git a/omegalib/examples/old_test/stodghil b/omegalib/examples/old_test/stodghil new file mode 100644 index 0000000..99e9430 --- /dev/null +++ b/omegalib/examples/old_test/stodghil @@ -0,0 +1,21 @@ +symbolic n; + +S := {[k_w,j_w,l_w]->[k_r,j_r,l_r] : ((1 <= k_w) and (k_w <= n) and ((k_w + 1) <= j_w) +and (j_w <= n) +and ((k_w + 1) <= l_w) and (l_w <= j_w) and (1 <= k_r) +and (k_r <= n) and ((k_r + 1) <= j_r) and (j_r <= n) +and ((k_r + 1) <= l_r) and (l_r <= j_r) and ((k_w < k_r) or ((k_w = k_r) +and (j_w < j_r)) or ((k_w = k_r) and (j_w = j_r) and (l_w < l_r))) +and (j_w = j_r) and (l_w = l_r) +and !exists(k_1 : ((1 <= k_1) and (k_1 <= n) and (k_w < k_1) and ((k_1 < k_r) or (k_1 = k_r)) +and (k_1 = j_r) and (k_1 = l_r))) +and !exists(k_2,i_2 : ((1 <= k_2) and (k_2 <= n) and ((k_2 + 1) <= i_2) and (i_2 <= n) and (k_w < k_2) and ((k_2 < k_r) or (k_2 = k_r)) and (i_2 = j_r) and (k_2 = l_r))) +and !exists(k_3,j_3,l_3 : ((1 <= k_3) and (k_3 <= n) and ((k_3 + 1) <= j_3) + and (j_3 <= n) and ((k_3 + 1) <= l_3) and (l_3 <= j_3) +and ((k_w < k_3) or ((k_w = k_3) and (j_w < j_3)) or ((k_w = k_3) +and (j_w = j_3) and (l_w < l_3))) +and ((k_3 < k_r) or ((k_3 = k_r) and (j_3 < j_r)) or ((k_3 = k_r) +and (j_3 = j_r) and (l_3 < l_r))) and (j_3 = j_r) and (l_3 = l_r)) +))}; + +S; diff --git a/omegalib/examples/old_test/stodghil.oc-rt b/omegalib/examples/old_test/stodghil.oc-rt new file mode 100644 index 0000000..0d554d2 --- /dev/null +++ b/omegalib/examples/old_test/stodghil.oc-rt @@ -0,0 +1,28 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n; +# +# +# S := {[k_w,j_w,l_w]->[k_r,j_r,l_r] : ((1 <= k_w) and (k_w <= n) and ((k_w + 1) <= j_w) +# and (j_w <= n) +# and ((k_w + 1) <= l_w) and (l_w <= j_w) and (1 <= k_r) +# and (k_r <= n) and ((k_r + 1) <= j_r) and (j_r <= n) +# and ((k_r + 1) <= l_r) and (l_r <= j_r) and ((k_w < k_r) or ((k_w = k_r) +# and (j_w < j_r)) or ((k_w = k_r) and (j_w = j_r) and (l_w < l_r))) +# and (j_w = j_r) and (l_w = l_r) +# and !exists(k_1 : ((1 <= k_1) and (k_1 <= n) and (k_w < k_1) and ((k_1 < k_r) or (k_1 = k_r)) +# and (k_1 = j_r) and (k_1 = l_r))) +# and !exists(k_2,i_2 : ((1 <= k_2) and (k_2 <= n) and ((k_2 + 1) <= i_2) and (i_2 <= n) and (k_w < k_2) and ((k_2 < k_r) or (k_2 = k_r)) and (i_2 = j_r) and (k_2 = l_r))) +# and !exists(k_3,j_3,l_3 : ((1 <= k_3) and (k_3 <= n) and ((k_3 + 1) <= j_3) +# and (j_3 <= n) and ((k_3 + 1) <= l_3) and (l_3 <= j_3) +# and ((k_w < k_3) or ((k_w = k_3) and (j_w < j_3)) or ((k_w = k_3) +# and (j_w = j_3) and (l_w < l_3))) +# and ((k_3 < k_r) or ((k_3 = k_r) and (j_3 < j_r)) or ((k_3 = k_r) +# and (j_3 = j_r) and (l_3 < l_r))) and (j_3 = j_r) and (l_3 = l_r)) +# ))}; +# +# +# S; + +{[k_w,j_w,l_w] -> [k_w+1,j_w,l_w] : k_w+2 <= l_w <= j_w <= n && 1 <= k_w} + +# diff --git a/omegalib/examples/old_test/stride1 b/omegalib/examples/old_test/stride1 new file mode 100644 index 0000000..fc2b727 --- /dev/null +++ b/omegalib/examples/old_test/stride1 @@ -0,0 +1,2 @@ +R := { [i] : i < 10 && i > 1 && exists ( alpha : i = 3alpha) }; +codegen R; diff --git a/omegalib/examples/old_test/stride1.oc-rt b/omegalib/examples/old_test/stride1.oc-rt new file mode 100644 index 0000000..a577449 --- /dev/null +++ b/omegalib/examples/old_test/stride1.oc-rt @@ -0,0 +1,9 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := { [i] : i < 10 && i > 1 && exists ( alpha : i = 3alpha) }; +# +# codegen R; +for(t1 = 3; t1 <= 9; t1 += 3) { + s1(t1); +} + +# diff --git a/omegalib/examples/old_test/stride2 b/omegalib/examples/old_test/stride2 new file mode 100644 index 0000000..37a355f --- /dev/null +++ b/omegalib/examples/old_test/stride2 @@ -0,0 +1,4 @@ +symbolic n; +new_IS := {[t1,t2] : exists (alpha : t1 = 32alpha && + t2 - 31,0 <= t1 <= t2 <= n)}; +codegen new_IS; diff --git a/omegalib/examples/old_test/stride2.oc-rt b/omegalib/examples/old_test/stride2.oc-rt new file mode 100644 index 0000000..ee8fb75 --- /dev/null +++ b/omegalib/examples/old_test/stride2.oc-rt @@ -0,0 +1,14 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# Sym n; +# +# new_IS := {[t1,t2] : exists (alpha : t1 = 32alpha && +# t2 - 31,0 <= t1 <= t2 <= n)}; +# +# codegen new_IS; +for(t1 = 0; t1 <= n; t1 += 32) { + for(t2 = t1; t2 <= min(n,t1+31); t2++) { + s1(t1,t2); + } +} + +# diff --git a/omegalib/examples/old_test/stride3 b/omegalib/examples/old_test/stride3 new file mode 100644 index 0000000..859e9b8 --- /dev/null +++ b/omegalib/examples/old_test/stride3 @@ -0,0 +1,4 @@ +symbolic n; +new_IS := {[t1,t2] : exists (alpha : t1 = 32alpha+3 && + t2 - 31,0 <= t1 <= t2 <= n)}; +codegen new_IS; diff --git a/omegalib/examples/old_test/stride3.oc-rt b/omegalib/examples/old_test/stride3.oc-rt new file mode 100644 index 0000000..7ba925f --- /dev/null +++ b/omegalib/examples/old_test/stride3.oc-rt @@ -0,0 +1,14 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# Sym n; +# +# new_IS := {[t1,t2] : exists (alpha : t1 = 32alpha+3 && +# t2 - 31,0 <= t1 <= t2 <= n)}; +# +# codegen new_IS; +for(t1 = 3; t1 <= n; t1 += 32) { + for(t2 = t1; t2 <= min(n,t1+31); t2++) { + s1(t1,t2); + } +} + +# diff --git a/omegalib/examples/old_test/stride4 b/omegalib/examples/old_test/stride4 new file mode 100644 index 0000000..21781a2 --- /dev/null +++ b/omegalib/examples/old_test/stride4 @@ -0,0 +1,4 @@ +symbolic n; +new_IS := {[i] : exists (alpha : i = 5alpha-2 && + i >= 17 && i <= 100)}; +codegen new_IS; diff --git a/omegalib/examples/old_test/stride4.oc-rt b/omegalib/examples/old_test/stride4.oc-rt new file mode 100644 index 0000000..3905486 --- /dev/null +++ b/omegalib/examples/old_test/stride4.oc-rt @@ -0,0 +1,12 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# Sym n; +# +# new_IS := {[i] : exists (alpha : i = 5alpha-2 && +# i >= 17 && i <= 100)}; +# +# codegen new_IS; +for(t1 = 18; t1 <= 98; t1 += 5) { + s1(t1); +} + +# diff --git a/omegalib/examples/old_test/stride5 b/omegalib/examples/old_test/stride5 new file mode 100644 index 0000000..9c4f1b0 --- /dev/null +++ b/omegalib/examples/old_test/stride5 @@ -0,0 +1,4 @@ +symbolic n; +R := {[i,j]: i >= 1 && i <= 101 && exists (alpha : i = 2 alpha) && + j >= i+2n && j <=401 && exists (alpha : j = 2 alpha)}; +codegen R; diff --git a/omegalib/examples/old_test/stride5.oc-rt b/omegalib/examples/old_test/stride5.oc-rt new file mode 100644 index 0000000..85e9551 --- /dev/null +++ b/omegalib/examples/old_test/stride5.oc-rt @@ -0,0 +1,14 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# Sym n; +# +# R := {[i,j]: i >= 1 && i <= 101 && exists (alpha : i = 2 alpha) && +# j >= i+2n && j <=401 && exists (alpha : j = 2 alpha)}; +# +# codegen R; +for(t1 = 2; t1 <= min(-2*n+400,100); t1 += 2) { + for(t2 = 2*n+t1; t2 <= 400; t2 += 2) { + s1(t1,t2); + } +} + +# diff --git a/omegalib/examples/old_test/stride6 b/omegalib/examples/old_test/stride6 new file mode 100644 index 0000000..364e24c --- /dev/null +++ b/omegalib/examples/old_test/stride6 @@ -0,0 +1,10 @@ +symbolic n; +R := {[i,j]: i >= 1 && i <= 101 && + j >= i && j <=401 && exists (alpha : j = 2 alpha)}; +codegen R; +S := {[i,j]: i >= 1 && i <= 101 && exists (alpha : i = 2 alpha) && + j >= i && j <=401 && exists (alpha : j = 2 alpha)}; +codegen S; +T := {[i,j]: i >= 1 && i <= 101 && exists (alpha : i = 2 alpha) && + j >= i && j <=401 && exists (alpha : 2j = 4 alpha)}; +codegen T; diff --git a/omegalib/examples/old_test/stride6.oc-rt b/omegalib/examples/old_test/stride6.oc-rt new file mode 100644 index 0000000..eeb242f --- /dev/null +++ b/omegalib/examples/old_test/stride6.oc-rt @@ -0,0 +1,36 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# Sym n; +# +# R := {[i,j]: i >= 1 && i <= 101 && +# j >= i && j <=401 && exists (alpha : j = 2 alpha)}; +# +# codegen R; +for(t1 = 1; t1 <= 101; t1++) { + for(t2 = 2*intDiv(t1+1,2); t2 <= 400; t2 += 2) { + s1(t1,t2); + } +} + +# +# S := {[i,j]: i >= 1 && i <= 101 && exists (alpha : i = 2 alpha) && +# j >= i && j <=401 && exists (alpha : j = 2 alpha)}; +# +# codegen S; +for(t1 = 2; t1 <= 100; t1 += 2) { + for(t2 = t1; t2 <= 400; t2 += 2) { + s1(t1,t2); + } +} + +# +# T := {[i,j]: i >= 1 && i <= 101 && exists (alpha : i = 2 alpha) && +# j >= i && j <=401 && exists (alpha : 2j = 4 alpha)}; +# +# codegen T; +for(t1 = 2; t1 <= 100; t1 += 2) { + for(t2 = t1; t2 <= 400; t2 += 2) { + s1(t1,t2); + } +} + +# diff --git a/omegalib/examples/old_test/stride7 b/omegalib/examples/old_test/stride7 new file mode 100644 index 0000000..4bfe1cd --- /dev/null +++ b/omegalib/examples/old_test/stride7 @@ -0,0 +1,6 @@ +IS:={[i,j]: 1 <= i,j <= 9}; +T1:={[i,j]->[4j,i,0]}; +T2:={[i,j]->[j,i,1]}; +codegen T1:IS,T2:IS; +codegen 2 T1:IS,T2:IS; + diff --git a/omegalib/examples/old_test/stride7.oc-rt b/omegalib/examples/old_test/stride7.oc-rt new file mode 100644 index 0000000..60ac1d4 --- /dev/null +++ b/omegalib/examples/old_test/stride7.oc-rt @@ -0,0 +1,47 @@ +>>> IS:={[i,j]: 1 <= i,j <= 9}; +>>> T1:={[i,j]->[4j,i,0]}; +>>> T2:={[i,j]->[j,i,1]}; +>>> codegen T1:IS,T2:IS; +for(t1 = 1; t1 <= 36; t1++) { + if (intMod(t1,4) == 0 && t1 <= 8) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,intDiv(t1,4)); + s2(t2,t1); + } + } + if (intMod(t1,4) == 0 && t1 >= 12) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,intDiv(t1,4)); + } + } + if (t1-3 <= 4*intDiv(t1-1,4) && t1 <= 9) { + for(t2 = 1; t2 <= 9; t2++) { + s2(t2,t1); + } + } +} + +>>> codegen 2 T1:IS,T2:IS; +for(t1 = 1; t1 <= 8; t1++) { + if (intMod(t1,4) == 0) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,intDiv(t1,4)); + s2(t2,t1); + } + } + if (t1-3 <= 4*intDiv(t1-1,4)) { + for(t2 = 1; t2 <= 9; t2++) { + s2(t2,t1); + } + } +} +for(t2 = 1; t2 <= 9; t2++) { + s2(t2,9); +} +for(t1 = 12; t1 <= 36; t1 += 4) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,intDiv(t1,4)); + } +} + + diff --git a/omegalib/examples/old_test/subsets1 b/omegalib/examples/old_test/subsets1 new file mode 100644 index 0000000..1b3721d --- /dev/null +++ b/omegalib/examples/old_test/subsets1 @@ -0,0 +1,20 @@ +R := {[x]:x > 1 }; +R; +R2 := subsetof R; +R2; + +R - R2; +R subset R2; +R2 - R; +R2 subset R; + +S := {[x]: x > 0}; +S - R; +R subset S; +S - R2; +R2 subset S; + +S2 := {[x]: x > -1}; +S3 := subsetof S2; +S3 - S; +S subset S3; diff --git a/omegalib/examples/old_test/subsets1.oc-rt b/omegalib/examples/old_test/subsets1.oc-rt new file mode 100644 index 0000000..345639f --- /dev/null +++ b/omegalib/examples/old_test/subsets1.oc-rt @@ -0,0 +1,70 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := {[x]:x > 1 }; +# +# R; + +{[x]: 2 <= x} + +# +# R2 := subsetof R; +# +# R2; + +{[x]: 2 <= x && UNKNOWN} + +# +# +# R - R2; + +{[x]: 2 <= x && UNKNOWN} + +# +# R subset R2; + +False +# +# R2 - R; + +{[x] : FALSE } + +# +# R2 subset R; + +True +# +# +# S := {[x]: x > 0}; +# +# S - R; + +{[1]} + +# +# R subset S; + +True +# +# S - R2; + +{[x]: 2 <= x && UNKNOWN} union + {[1]} + +# +# R2 subset S; + +True +# +# +# S2 := {[x]: x > -1}; +# +# S3 := subsetof S2; +# +# S3 - S; + +{[0]: UNKNOWN} + +# +# S subset S3; + +False +# diff --git a/omegalib/examples/old_test/subsets2 b/omegalib/examples/old_test/subsets2 new file mode 100644 index 0000000..4d4a98a --- /dev/null +++ b/omegalib/examples/old_test/subsets2 @@ -0,0 +1,5 @@ +(subsetof {[1:10]}) - subsetof {[1:10]}; + +{[1:10]} - subsetof {[1:10]}; + +(subsetof {[1:10]}) - {[1:10]}; diff --git a/omegalib/examples/old_test/subsets2.oc-rt b/omegalib/examples/old_test/subsets2.oc-rt new file mode 100644 index 0000000..0bbb1c7 --- /dev/null +++ b/omegalib/examples/old_test/subsets2.oc-rt @@ -0,0 +1,18 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# (subsetof {[1:10]}) - subsetof {[1:10]}; + +{[In_1]: 1 <= In_1 <= 10 && UNKNOWN} + +# +# +# {[1:10]} - subsetof {[1:10]}; + +{[In_1]: 1 <= In_1 <= 10 && UNKNOWN} + +# +# +# (subsetof {[1:10]}) - {[1:10]}; + +{[In_1] : FALSE } + +# diff --git a/omegalib/examples/old_test/tex1 b/omegalib/examples/old_test/tex1 new file mode 100644 index 0000000..ca84924 --- /dev/null +++ b/omegalib/examples/old_test/tex1 @@ -0,0 +1,49 @@ +# +# Extract from omega4 +# removed "eqnarray" commands, associated &'s, and overbrace commands +# added declaration of n +# added semicolon +# +# It would be nice not to have to do the following: +# removed \ in front of variable names +# + +$$ +symbolic n; +R := \{\ [ii] \rightarrow [ki] \mid +1 \leq ii \leq 2n + \ \land \ 1 \leq ki \leq 2n +\land ii = ki +\land ii = ki\\ +\t \land + \ \neg (\ \exists [ji, jj] \st +(1 \leq ji \leq 2n \land 1 \leq jj \leq n\!-\!1) +\land (ii \leq ji \land ji \leq ki) \land (2jj = ki)\ )\\ +\t +\land \ +\neg (\ \exists [ji, jj] \st +(1 \leq ji \leq 2n \land 1 \leq jj \leq n\!-\!1) +\land (ii \leq ji \land ji \leq ki) \land (2jj\!+\!1 = ki)\ ) +\ \} +; + +R; +$$ +# S := \{\ [\ii] \rightarrow [\ki] \mid +# 1 \leq \ii \leq 2\n +# \ \land \ 1 \leq \ki \leq 2\n +# \land \ii = \ki +# \land \ii = \ki\\ +# \t \land +# \ \neg (\ \exists [\ji, \jj] \st +# (1 \leq \ji \leq 2\n \land 1 \leq \jj \leq \n\!-\!1) +# \land (\ii \leq \ji \land \ji \leq \ki) \land (2\jj = \ki)\ )\\ +# \t +# \land \ +# \neg (\ \exists [\ji, \jj] \st +# (1 \leq \ji \leq 2\n \land 1 \leq \jj \leq \n\!-\!1) +# \land (\ii \leq \ji \land \ji \leq \ki) \land (2\jj\!+\!1 = \ki)\ ) +# \ \} +# ; +# +# S; diff --git a/omegalib/examples/old_test/tex1.oc-rt b/omegalib/examples/old_test/tex1.oc-rt new file mode 100644 index 0000000..fd138d0 --- /dev/null +++ b/omegalib/examples/old_test/tex1.oc-rt @@ -0,0 +1,58 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # +# # Extract from omega4 +# # removed "eqnarray" commands, associated &'s, and overbrace commands +# # added declaration of n +# # added semicolon +# # +# # It would be nice not to have to do the following: +# # removed \ in front of variable names +# # +# +# $$ +# symbolic n; +# +# R := \{\ [ii] \rightarrow [ki] \mid +# 1 \leq ii \leq 2n +# \ \land \ 1 \leq ki \leq 2n +# \land ii = ki +# \land ii = ki\\ +# \t \land +# \ \neg (\ \exists [ji, jj] \st +# (1 \leq ji \leq 2n \land 1 \leq jj \leq n\!-\!1) +# \land (ii \leq ji \land ji \leq ki) \land (2jj = ki)\ )\\ +# \t +# \land \ +# \neg (\ \exists [ji, jj] \st +# (1 \leq ji \leq 2n \land 1 \leq jj \leq n\!-\!1) +# \land (ii \leq ji \land ji \leq ki) \land (2jj\!+\!1 = ki)\ ) +# \ \} +# ; +# +# +# R; + +{[ii] -> [ii] : n = 1 && 1 <= ii <= 2} union + {[2n] -> [2n] : 2 <= n} union + {[1] -> [1] : 2 <= n} + +# +# $$ +# # S := \{\ [\ii] \rightarrow [\ki] \mid +# # 1 \leq \ii \leq 2\n +# # \ \land \ 1 \leq \ki \leq 2\n +# # \land \ii = \ki +# # \land \ii = \ki\\ +# # \t \land +# # \ \neg (\ \exists [\ji, \jj] \st +# # (1 \leq \ji \leq 2\n \land 1 \leq \jj \leq \n\!-\!1) +# # \land (\ii \leq \ji \land \ji \leq \ki) \land (2\jj = \ki)\ )\\ +# # \t +# # \land \ +# # \neg (\ \exists [\ji, \jj] \st +# # (1 \leq \ji \leq 2\n \land 1 \leq \jj \leq \n\!-\!1) +# # \land (\ii \leq \ji \land \ji \leq \ki) \land (2\jj\!+\!1 = \ki)\ ) +# # \ \} +# # ; +# # +# # S; diff --git a/omegalib/examples/old_test/tricky b/omegalib/examples/old_test/tricky new file mode 100644 index 0000000..d12077c --- /dev/null +++ b/omegalib/examples/old_test/tricky @@ -0,0 +1,11 @@ +symbolic N,M,k; +{ [i,j] -> [] : 0 <= i <= M and 0 <= j <= N and 2i+j = k + and not ( exists [i2,j2] : + 0 <= i2 <= M and 0 <= j2 <= N + and 2i2+j2 = k + and i < i2 ) }; +{ [i,j] -> [] : 0 <= i <= M and 0 <= j <= N and 2i+j = k + and not ( i < M && 2i-2 <= k && + N-k <= 2M + && ( N-k < k or N <= 2k && (exists a : k = 2 a) + ))}; diff --git a/omegalib/examples/old_test/tricky.oc-rt b/omegalib/examples/old_test/tricky.oc-rt new file mode 100644 index 0000000..8282b7f --- /dev/null +++ b/omegalib/examples/old_test/tricky.oc-rt @@ -0,0 +1,25 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic N,M,k; +# +# { [i,j] -> [] : 0 <= i <= M and 0 <= j <= N and 2i+j = k +# and NOT( exists [i2,j2] : +# 0 <= i2 <= M and 0 <= j2 <= N +# and 2i2+j2 = k +# and i < i2 ) }; + +{[i,k-2i] -> : 2i <= k <= 2i+1 && 0 <= i <= M && k <= N+2i} union + {[M,k-2M] -> : 2+2M <= k && k <= N+2M && 0 <= M} + +# +# { [i,j] -> [] : 0 <= i <= M and 0 <= j <= N and 2i+j = k +# and NOT( i < M && 2i-2 <= k && +# N-k <= 2M +# && ( N-k < k or N <= 2k && (exists a : k = 2 a) +# ))}; + +{[i,k-2i] -> : 0 <= i <= M && 2M+k < N && 2i <= k} union + {[M,k-2M] -> : N <= 2M+k && k <= N+2M && 2M <= k} union + {[i,k-2i] -> : 2k < N && N <= 2M+k && 0 <= i && 2i <= k} union + {[i,k-2i] -> : Exists ( alpha : N = 2k && 2i = 1+k+2alpha && 2i+1 <= k <= 2M-1 && 0 <= i)} + +# diff --git a/omegalib/examples/old_test/ts1d-check-sblock b/omegalib/examples/old_test/ts1d-check-sblock new file mode 100644 index 0000000..01757ea --- /dev/null +++ b/omegalib/examples/old_test/ts1d-check-sblock @@ -0,0 +1,155 @@ +# This is the file facts.prew, which is prepended to the .prew files +# for the particular code generation we want, defines things like the +# iteration space and dependences. Known facts are inserted by the +# Makefile. +# +# If you're looking at a .w file instead of facts.prew, then you should +# remember to edit the original .prew files, not the .w files. +# +# This facts.prew file describes the program +# +# for(i = 0; i <= N-1; i++) { +# cur[i]=... +# } +# for(t = 0; t < T; t++) { +# for(i = 0; i <= N-1; i++) { +# old[i]=cur[i]; +# } +# for(i = 1; i <= N-2; i++) { +# cur[i] = (old[i-1]+old[i]+old[i]+old[i+1])*0.25; +# } +# } + + + +# first, the spaces and memory maps + +symbolic T, N; + +IS_INIT := { [1,i,1,0,0] : 0<=i<=N-1 }; +MM_INIT := { [1,i,1,0,0] -> [0,i] : 0<=i<=N-1 }; + +IS_COPY := { [2,t,0,i,1] : 0<=t [t+1,i] : 0<=t [t+1,i] : 0<=t [x',t',y',i',z'] : + (x'>x) or + (x'=x and t'>t) or + (x'=x and t'=t and y'>y) or + (x'=x and t'=t and y'=y and i'>i) or + (x'=x and t'=t and y'=y and i'=i and z'>z) }; +FWD7 := {[x,t,y,i,z,a,b] -> [x',t',y',i',z',a',b'] : + (x'>x) or + (x'=x and t'>t) or + (x'=x and t'=t and y'>y) or + (x'=x and t'=t and y'=y and i'>i) or + (x'=x and t'=t and y'=y and i'=i and z'>z) or + (x'=x and t'=t and y'=y and i'=i and z'=z and a'>a) or + (x'=x and t'=t and y'=y and i'=i and z'=z and a'=a and b'>b) }; +BWD5 := inverse FWD5; +BWD7 := inverse FWD7; +EQi := {[x,t,y,i,z] -> [x',t',y',i',z'] : i'=i }; + +# output deps + +OAA := (IS_COPY * IS_COPY) intersection FWD5 intersection EQi; +OCC := (IS_CALC * IS_CALC) intersection FWD5 intersection EQi; + +# combined flow/anti deps + +FAC := (IS_COPY * IS_CALC) intersection FWD5 intersection {[2,t,0,i,1] -> [2,t',1,i',1] : (i'-1<=i<=i'+1)}; +FCA := (IS_CALC * IS_COPY) intersection FWD5 intersection {[2,t,1,i,1] -> [2,t',0,i',1] : (i-1<=i'<=i+1)}; + +# total memory deps in the "core" + +COREMEMDEPS := OAA union OCC union FAC union FCA; + + + +# data flow for original code: + +DF_12p1 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,0,0,i,1] : 0 [2,t,0,0,1] }; +DF_12p3 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,t,0,i,1] : i=N-1 && N>1 }; +DF_32 := ( IS_CALC * IS_COPY ) intersection {[2,t,1,i,1] -> [2,t+1,0,i,1]}; + +DF_23a := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i+1,1] }; +DF_23b := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i,1] }; +DF_23c := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i-1,1] }; + + +# data flow for array expanded code, +# after forward substitution of "old[i] = cur[i]" + +DF1Ia := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; +DF1Ib := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t>0 && i=0 } restrictDomain IS_INIT restrictRange IS_CALC; +DF1C := { [2,t,1,i,1] -> [2,t+1,1,i+1,1] } restrictDomain IS_CALC restrictRange IS_CALC; +DF2I := { [1,i,1,0,0] -> [2,t,1,i,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; +DF2C := { [2,t,1,i,1] -> [2,t+1,1,i+0,1] } restrictDomain IS_CALC restrictRange IS_CALC; +DF3Ia := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; +DF3Ib := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t>0 && i=N-1 } restrictDomain IS_INIT restrictRange IS_CALC; +DF3C := { [2,t,1,i,1] -> [2,t+1,1,i-1,1] } restrictDomain IS_CALC restrictRange IS_CALC; + +# total data flow + +COREDATAFLOW := DF1C union DF2C union DF3C; + + +# arity expansion relations +ex_0_5v := { [] -> [a,b,c,d,e] }; +ex_0_7v := { [] -> [a,b,c,d,e,f,g] }; +ex_3_5 := { [a,b,c] -> [a,b,c,0,0] }; +ex_3_7 := { [a,b,c] -> [a,b,c,0,0,0,0] }; +ex_5_7 := { [a,b,c,d,e] -> [a,b,c,d,e,0,0] }; + +ex_5_3 := { [a,b,c,0,0] -> [a,b,c] }; +ex_7_3 := { [a,b,c,0,0,0,0] -> [a,b,c] }; +ex_7_5 := { [a,b,c,d,e,0,0] -> [a,b,c,d,e] }; + + +# stuff used in skew and tskew + +# Here is the description of time skewing from the current draft of the paper. +IS_Trans := { [2,t,1,i,1] -> [2,tb,1,s,1,tt,1] : + 0<=tt<1000 && s=i+1*t && t=1000*tb+tt }; + +IS_Tinv := inverse IS_Trans; + +# We use it to transform the iteration spaces +TS_IS_CALC := IS_CALC join IS_Trans; +# for some reason OC refuses do to this "join" but will do the reverse: +# TS_IS_INIT := ex_7_5 join IS_INIT; +TS_IS_INIT := IS_INIT join (inverse ex_7_5); + +# Now we can update the data flow relations to correspond to the new I.S.'s +TS_DF1Ia := ex_7_5 join DF1Ia join IS_Trans; +TS_DF1Ib := ex_7_5 join DF1Ib join IS_Trans; +TS_DF1C := IS_Tinv join DF1C join IS_Trans; +TS_DF2I := ex_7_5 join DF2I join IS_Trans; +TS_DF2C := IS_Tinv join DF2C join IS_Trans; +TS_DF3Ia := ex_7_5 join DF3Ia join IS_Trans; +TS_DF3Ib := ex_7_5 join DF3Ib join IS_Trans; +TS_DF3C := IS_Tinv join DF3C join IS_Trans; + + +KNOWN := { [] : T >= 0 and N >= 4 }; + +IS_INIT_EXP := { [1,t,1,i,0] : (0=t && 0<=i<=N-1) || + (1=t && 0=i) || + (1=t && N-1=i) }; + +TSKEW := { [2, t, 1, i, 1] -> [2, tb, t+i, tt, 0] : + 1000*tb+tt = t and 0 <= tt < 1000 }; + +codegen + IS_INIT_EXP, TSKEW : IS_CALC +given (KNOWN join ex_0_5v); + diff --git a/omegalib/examples/old_test/ts1d-check-sblock.oc-rt b/omegalib/examples/old_test/ts1d-check-sblock.oc-rt new file mode 100644 index 0000000..492fa30 --- /dev/null +++ b/omegalib/examples/old_test/ts1d-check-sblock.oc-rt @@ -0,0 +1,227 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # This is the file facts.prew, which is prepended to the .prew files +# # for the particular code generation we want, defines things like the +# # iteration space and dependences. Known facts are inserted by the +# # Makefile. +# # +# # If you're looking at a .w file instead of facts.prew, then you should +# # remember to edit the original .prew files, not the .w files. +# # +# # This facts.prew file describes the program +# # +# # for(i = 0; i <= N-1; i++) { +# # cur[i]=... +# # } +# # for(t = 0; t < T; t++) { +# # for(i = 0; i <= N-1; i++) { +# # old[i]=cur[i]; +# # } +# # for(i = 1; i <= N-2; i++) { +# # cur[i] = (old[i-1]+old[i]+old[i]+old[i+1])*0.25; +# # } +# # } +# +# +# +# # first, the spaces and memory maps +# +# symbolic T, N; +# +# +# IS_INIT := { [1,i,1,0,0] : 0<=i<=N-1 }; +# +# MM_INIT := { [1,i,1,0,0] -> [0,i] : 0<=i<=N-1 }; +# +# +# IS_COPY := { [2,t,0,i,1] : 0<=t [t+1,i] : 0<=t [t+1,i] : 0<=t [x',t',y',i',z'] : +# (x'>x) or +# (x'=x and t'>t) or +# (x'=x and t'=t and y'>y) or +# (x'=x and t'=t and y'=y and i'>i) or +# (x'=x and t'=t and y'=y and i'=i and z'>z) }; +# +# FWD7 := {[x,t,y,i,z,a,b] -> [x',t',y',i',z',a',b'] : +# (x'>x) or +# (x'=x and t'>t) or +# (x'=x and t'=t and y'>y) or +# (x'=x and t'=t and y'=y and i'>i) or +# (x'=x and t'=t and y'=y and i'=i and z'>z) or +# (x'=x and t'=t and y'=y and i'=i and z'=z and a'>a) or +# (x'=x and t'=t and y'=y and i'=i and z'=z and a'=a and b'>b) }; +# +# BWD5 := inverse FWD5; +# +# BWD7 := inverse FWD7; +# +# EQi := {[x,t,y,i,z] -> [x',t',y',i',z'] : i'=i }; +# +# +# # output deps +# +# OAA := (IS_COPY * IS_COPY) intersection FWD5 intersection EQi; +# +# OCC := (IS_CALC * IS_CALC) intersection FWD5 intersection EQi; +# +# +# # combined flow/anti deps +# +# FAC := (IS_COPY * IS_CALC) intersection FWD5 intersection {[2,t,0,i,1] -> [2,t',1,i',1] : (i'-1<=i<=i'+1)}; +# +# FCA := (IS_CALC * IS_COPY) intersection FWD5 intersection {[2,t,1,i,1] -> [2,t',0,i',1] : (i-1<=i'<=i+1)}; +# +# +# # total memory deps in the "core" +# +# COREMEMDEPS := OAA union OCC union FAC union FCA; +# +# +# +# +# # data flow for original code: +# +# DF_12p1 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,0,0,i,1] : 0 [2,t,0,0,1] }; +# +# DF_12p3 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,t,0,i,1] : i=N-1 && N>1 }; +# +# DF_32 := ( IS_CALC * IS_COPY ) intersection {[2,t,1,i,1] -> [2,t+1,0,i,1]}; +# +# +# DF_23a := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i+1,1] }; +# +# DF_23b := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i,1] }; +# +# DF_23c := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i-1,1] }; +# +# +# +# # data flow for array expanded code, +# # after forward substitution of "old[i] = cur[i]" +# +# DF1Ia := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; +# +# DF1Ib := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t>0 && i=0 } restrictDomain IS_INIT restrictRange IS_CALC; +# +# DF1C := { [2,t,1,i,1] -> [2,t+1,1,i+1,1] } restrictDomain IS_CALC restrictRange IS_CALC; +# +# DF2I := { [1,i,1,0,0] -> [2,t,1,i,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; +# +# DF2C := { [2,t,1,i,1] -> [2,t+1,1,i+0,1] } restrictDomain IS_CALC restrictRange IS_CALC; +# +# DF3Ia := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; +# +# DF3Ib := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t>0 && i=N-1 } restrictDomain IS_INIT restrictRange IS_CALC; +# +# DF3C := { [2,t,1,i,1] -> [2,t+1,1,i-1,1] } restrictDomain IS_CALC restrictRange IS_CALC; +# +# +# # total data flow +# +# COREDATAFLOW := DF1C union DF2C union DF3C; +# +# +# +# # arity expansion relations +# ex_0_5v := { [] -> [a,b,c,d,e] }; +# +# ex_0_7v := { [] -> [a,b,c,d,e,f,g] }; +# +# ex_3_5 := { [a,b,c] -> [a,b,c,0,0] }; +# +# ex_3_7 := { [a,b,c] -> [a,b,c,0,0,0,0] }; +# +# ex_5_7 := { [a,b,c,d,e] -> [a,b,c,d,e,0,0] }; +# +# +# ex_5_3 := { [a,b,c,0,0] -> [a,b,c] }; +# +# ex_7_3 := { [a,b,c,0,0,0,0] -> [a,b,c] }; +# +# ex_7_5 := { [a,b,c,d,e,0,0] -> [a,b,c,d,e] }; +# +# +# +# # stuff used in skew and tskew +# +# # Here is the description of time skewing from the current draft of the paper. +# IS_Trans := { [2,t,1,i,1] -> [2,tb,1,s,1,tt,1] : +# 0<=tt<1000 && s=i+1*t && t=1000*tb+tt }; +# +# +# IS_Tinv := inverse IS_Trans; +# +# +# # We use it to transform the iteration spaces +# TS_IS_CALC := IS_CALC join IS_Trans; +# +# # for some reason OC refuses do to this "join" but will do the reverse: +# # TS_IS_INIT := ex_7_5 join IS_INIT; +# TS_IS_INIT := IS_INIT join (inverse ex_7_5); +# +# +# # Now we can update the data flow relations to correspond to the new I.S.'s +# TS_DF1Ia := ex_7_5 join DF1Ia join IS_Trans; +# +# TS_DF1Ib := ex_7_5 join DF1Ib join IS_Trans; +# +# TS_DF1C := IS_Tinv join DF1C join IS_Trans; +# +# TS_DF2I := ex_7_5 join DF2I join IS_Trans; +# +# TS_DF2C := IS_Tinv join DF2C join IS_Trans; +# +# TS_DF3Ia := ex_7_5 join DF3Ia join IS_Trans; +# +# TS_DF3Ib := ex_7_5 join DF3Ib join IS_Trans; +# +# TS_DF3C := IS_Tinv join DF3C join IS_Trans; +# +# +# +# KNOWN := { [] : T >= 0 and N >= 4 }; +# +# +# IS_INIT_EXP := { [1,t,1,i,0] : (0=t && 0<=i<=N-1) || +# (1=t && 0=i) || +# (1=t && N-1=i) }; +# +# +# TSKEW := { [2, t, 1, i, 1] -> [2, tb, t+i, tt, 0] : +# 1000*tb+tt = t and 0 <= tt < 1000 }; +# +# +# codegen +# IS_INIT_EXP, TSKEW : IS_CALC +# given (KNOWN join ex_0_5v); +for(t4 = 0; t4 <= N-1; t4++) { + s1(1,0,1,t4,0); +} +s1(1,1,1,0,0); +s1(1,1,1,N-1,0); +for(t2 = 0; t2 <= intDiv(T-1,1000); t2++) { + for(t3 = 1000*t2+1; t3 <= min(N+1000*t2+997,N+T-3); t3++) { + for(t4 = max(-N+t3-1000*t2+2,0); t4 <= min(T-1000*t2-1,t3-1000*t2-1,999); t4++) { + s2(2,t4+1000*t2,1,t3-t4+-1000*t2,1); + } + } +} + +# +# diff --git a/omegalib/examples/old_test/ts1d-check0 b/omegalib/examples/old_test/ts1d-check0 new file mode 100644 index 0000000..9db25df --- /dev/null +++ b/omegalib/examples/old_test/ts1d-check0 @@ -0,0 +1,176 @@ +# This is the file facts.prew, which is prepended to the .prew files +# for the particular code generation we want, defines things like the +# iteration space and dependences. Known facts are inserted by the +# Makefile. +# +# If you're looking at a .w file instead of facts.prew, then you should +# remember to edit the original .prew files, not the .w files. +# +# This facts.prew file describes the program +# +# for(i = 0; i <= N-1; i++) { +# cur[i]=... +# } +# for(t = 0; t < T; t++) { +# for(i = 0; i <= N-1; i++) { +# old[i]=cur[i]; +# } +# for(i = 1; i <= N-2; i++) { +# cur[i] = (old[i-1]+old[i]+old[i]+old[i+1])*0.25; +# } +# } + + + +# first, the spaces and memory maps + +symbolic T, N; + +IS_INIT := { [1,i,1,0,0] : 0<=i<=N-1 }; +MM_INIT := { [1,i,1,0,0] -> [0,i] : 0<=i<=N-1 }; + +IS_COPY := { [2,t,0,i,1] : 0<=t [t+1,i] : 0<=t [t+1,i] : 0<=t [x',t',y',i',z'] : + (x'>x) or + (x'=x and t'>t) or + (x'=x and t'=t and y'>y) or + (x'=x and t'=t and y'=y and i'>i) or + (x'=x and t'=t and y'=y and i'=i and z'>z) }; +FWD7 := {[x,t,y,i,z,a,b] -> [x',t',y',i',z',a',b'] : + (x'>x) or + (x'=x and t'>t) or + (x'=x and t'=t and y'>y) or + (x'=x and t'=t and y'=y and i'>i) or + (x'=x and t'=t and y'=y and i'=i and z'>z) or + (x'=x and t'=t and y'=y and i'=i and z'=z and a'>a) or + (x'=x and t'=t and y'=y and i'=i and z'=z and a'=a and b'>b) }; +BWD5 := inverse FWD5; +BWD7 := inverse FWD7; +EQi := {[x,t,y,i,z] -> [x',t',y',i',z'] : i'=i }; + +# output deps + +OAA := (IS_COPY * IS_COPY) intersection FWD5 intersection EQi; +OCC := (IS_CALC * IS_CALC) intersection FWD5 intersection EQi; + +# combined flow/anti deps + +FAC := (IS_COPY * IS_CALC) intersection FWD5 intersection {[2,t,0,i,1] -> [2,t',1,i',1] : (i'-1<=i<=i'+1)}; +FCA := (IS_CALC * IS_COPY) intersection FWD5 intersection {[2,t,1,i,1] -> [2,t',0,i',1] : (i-1<=i'<=i+1)}; + +# total memory deps in the "core" + +COREMEMDEPS := OAA union OCC union FAC union FCA; + + + +# data flow for original code: + +DF_12p1 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,0,0,i,1] : 0 [2,t,0,0,1] }; +DF_12p3 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,t,0,i,1] : i=N-1 && N>1 }; +DF_32 := ( IS_CALC * IS_COPY ) intersection {[2,t,1,i,1] -> [2,t+1,0,i,1]}; + +DF_23a := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i+1,1] }; +DF_23b := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i,1] }; +DF_23c := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i-1,1] }; + + +# data flow for array expanded code, +# after forward substitution of "old[i] = cur[i]" + +DF1Ia := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; +DF1Ib := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t>0 && i=0 } restrictDomain IS_INIT restrictRange IS_CALC; +DF1C := { [2,t,1,i,1] -> [2,t+1,1,i+1,1] } restrictDomain IS_CALC restrictRange IS_CALC; +DF2I := { [1,i,1,0,0] -> [2,t,1,i,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; +DF2C := { [2,t,1,i,1] -> [2,t+1,1,i+0,1] } restrictDomain IS_CALC restrictRange IS_CALC; +DF3Ia := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; +DF3Ib := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t>0 && i=N-1 } restrictDomain IS_INIT restrictRange IS_CALC; +DF3C := { [2,t,1,i,1] -> [2,t+1,1,i-1,1] } restrictDomain IS_CALC restrictRange IS_CALC; + +# total data flow + +COREDATAFLOW := DF1C union DF2C union DF3C; + + +# arity expansion relations +ex_0_5v := { [] -> [a,b,c,d,e] }; +ex_0_7v := { [] -> [a,b,c,d,e,f,g] }; +ex_3_5 := { [a,b,c] -> [a,b,c,0,0] }; +ex_3_7 := { [a,b,c] -> [a,b,c,0,0,0,0] }; +ex_5_7 := { [a,b,c,d,e] -> [a,b,c,d,e,0,0] }; + +ex_5_3 := { [a,b,c,0,0] -> [a,b,c] }; +ex_7_3 := { [a,b,c,0,0,0,0] -> [a,b,c] }; +ex_7_5 := { [a,b,c,d,e,0,0] -> [a,b,c,d,e] }; + + +# stuff used in skew and tskew + +# Here is the description of time skewing from the current draft of the paper. +IS_Trans := { [2,t,1,i,1] -> [2,tb,1,s,1,tt,1] : + 0<=tt<1000 && s=i+1*t && t=1000*tb+tt }; + +IS_Tinv := inverse IS_Trans; + +# We use it to transform the iteration spaces +TS_IS_CALC := IS_CALC join IS_Trans; +# for some reason OC refuses do to this "join" but will do the reverse: +# TS_IS_INIT := ex_7_5 join IS_INIT; +TS_IS_INIT := IS_INIT join (inverse ex_7_5); + +# Now we can update the data flow relations to correspond to the new I.S.'s +TS_DF1Ia := ex_7_5 join DF1Ia join IS_Trans; +TS_DF1Ib := ex_7_5 join DF1Ib join IS_Trans; +TS_DF1C := IS_Tinv join DF1C join IS_Trans; +TS_DF2I := ex_7_5 join DF2I join IS_Trans; +TS_DF2C := IS_Tinv join DF2C join IS_Trans; +TS_DF3Ia := ex_7_5 join DF3Ia join IS_Trans; +TS_DF3Ib := ex_7_5 join DF3Ib join IS_Trans; +TS_DF3C := IS_Tinv join DF3C join IS_Trans; + + +KNOWN := { [] : T >= 0 and N >= 4 }; + +# Lets try to build up the equivalent of the time skewing transformation, +# IS_Trans := { [2,t,1,i,1] -> [2,tb,1,x,1,y,1] : +# 1000*tb<=t-1<=1000*(tb+1)-1 && y=t-1000*tb && x=y+i }; +# for both statements together, right from the diagram in the new TOPLAS stuff. + +# original code without mmap +# + +# First, look at it as a wider space + +WIDEN := { [2, t, s, i , 1] -> [2, 2t+s, 0, i, 1] : 0<=s<=1 }; +TSKEW := { [2, t, 0, i , 1] -> [2, tb, t+i, tt, 1] : + 1000*tb+tt = t and 0 <= tt < 1000 }; + +TSKEW_2LOOPS := WIDEN join TSKEW; +# print this for the paper + +# I think this should work but it blows up codegen: +# codegen +# IS_INIT, TSKEW_2LOOPS : IS_COPY, TSKEW_2LOOPS : IS_CALC +# given (KNOWN join ex_0_5v); + +# So we fake it as follows, +# relying on the fact that neither "t" nor "s" is used in any statement + +WIDEN0 := { [2, t, 0, i , 1] -> [2, 2t, 0, i, 1] }; +WIDEN1 := { [2, t, 1, i , 1] -> [2, 2t+1, 0, i, 1] }; + +codegen + IS_INIT, TSKEW : (IS_COPY join WIDEN0) , TSKEW : (IS_CALC join WIDEN1) +given (KNOWN join ex_0_5v); + diff --git a/omegalib/examples/old_test/ts1d-check0.oc-rt b/omegalib/examples/old_test/ts1d-check0.oc-rt new file mode 100644 index 0000000..a258f26 --- /dev/null +++ b/omegalib/examples/old_test/ts1d-check0.oc-rt @@ -0,0 +1,260 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # This is the file facts.prew, which is prepended to the .prew files +# # for the particular code generation we want, defines things like the +# # iteration space and dependences. Known facts are inserted by the +# # Makefile. +# # +# # If you're looking at a .w file instead of facts.prew, then you should +# # remember to edit the original .prew files, not the .w files. +# # +# # This facts.prew file describes the program +# # +# # for(i = 0; i <= N-1; i++) { +# # cur[i]=... +# # } +# # for(t = 0; t < T; t++) { +# # for(i = 0; i <= N-1; i++) { +# # old[i]=cur[i]; +# # } +# # for(i = 1; i <= N-2; i++) { +# # cur[i] = (old[i-1]+old[i]+old[i]+old[i+1])*0.25; +# # } +# # } +# +# +# +# # first, the spaces and memory maps +# +# symbolic T, N; +# +# +# IS_INIT := { [1,i,1,0,0] : 0<=i<=N-1 }; +# +# MM_INIT := { [1,i,1,0,0] -> [0,i] : 0<=i<=N-1 }; +# +# +# IS_COPY := { [2,t,0,i,1] : 0<=t [t+1,i] : 0<=t [t+1,i] : 0<=t [x',t',y',i',z'] : +# (x'>x) or +# (x'=x and t'>t) or +# (x'=x and t'=t and y'>y) or +# (x'=x and t'=t and y'=y and i'>i) or +# (x'=x and t'=t and y'=y and i'=i and z'>z) }; +# +# FWD7 := {[x,t,y,i,z,a,b] -> [x',t',y',i',z',a',b'] : +# (x'>x) or +# (x'=x and t'>t) or +# (x'=x and t'=t and y'>y) or +# (x'=x and t'=t and y'=y and i'>i) or +# (x'=x and t'=t and y'=y and i'=i and z'>z) or +# (x'=x and t'=t and y'=y and i'=i and z'=z and a'>a) or +# (x'=x and t'=t and y'=y and i'=i and z'=z and a'=a and b'>b) }; +# +# BWD5 := inverse FWD5; +# +# BWD7 := inverse FWD7; +# +# EQi := {[x,t,y,i,z] -> [x',t',y',i',z'] : i'=i }; +# +# +# # output deps +# +# OAA := (IS_COPY * IS_COPY) intersection FWD5 intersection EQi; +# +# OCC := (IS_CALC * IS_CALC) intersection FWD5 intersection EQi; +# +# +# # combined flow/anti deps +# +# FAC := (IS_COPY * IS_CALC) intersection FWD5 intersection {[2,t,0,i,1] -> [2,t',1,i',1] : (i'-1<=i<=i'+1)}; +# +# FCA := (IS_CALC * IS_COPY) intersection FWD5 intersection {[2,t,1,i,1] -> [2,t',0,i',1] : (i-1<=i'<=i+1)}; +# +# +# # total memory deps in the "core" +# +# COREMEMDEPS := OAA union OCC union FAC union FCA; +# +# +# +# +# # data flow for original code: +# +# DF_12p1 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,0,0,i,1] : 0 [2,t,0,0,1] }; +# +# DF_12p3 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,t,0,i,1] : i=N-1 && N>1 }; +# +# DF_32 := ( IS_CALC * IS_COPY ) intersection {[2,t,1,i,1] -> [2,t+1,0,i,1]}; +# +# +# DF_23a := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i+1,1] }; +# +# DF_23b := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i,1] }; +# +# DF_23c := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i-1,1] }; +# +# +# +# # data flow for array expanded code, +# # after forward substitution of "old[i] = cur[i]" +# +# DF1Ia := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; +# +# DF1Ib := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t>0 && i=0 } restrictDomain IS_INIT restrictRange IS_CALC; +# +# DF1C := { [2,t,1,i,1] -> [2,t+1,1,i+1,1] } restrictDomain IS_CALC restrictRange IS_CALC; +# +# DF2I := { [1,i,1,0,0] -> [2,t,1,i,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; +# +# DF2C := { [2,t,1,i,1] -> [2,t+1,1,i+0,1] } restrictDomain IS_CALC restrictRange IS_CALC; +# +# DF3Ia := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; +# +# DF3Ib := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t>0 && i=N-1 } restrictDomain IS_INIT restrictRange IS_CALC; +# +# DF3C := { [2,t,1,i,1] -> [2,t+1,1,i-1,1] } restrictDomain IS_CALC restrictRange IS_CALC; +# +# +# # total data flow +# +# COREDATAFLOW := DF1C union DF2C union DF3C; +# +# +# +# # arity expansion relations +# ex_0_5v := { [] -> [a,b,c,d,e] }; +# +# ex_0_7v := { [] -> [a,b,c,d,e,f,g] }; +# +# ex_3_5 := { [a,b,c] -> [a,b,c,0,0] }; +# +# ex_3_7 := { [a,b,c] -> [a,b,c,0,0,0,0] }; +# +# ex_5_7 := { [a,b,c,d,e] -> [a,b,c,d,e,0,0] }; +# +# +# ex_5_3 := { [a,b,c,0,0] -> [a,b,c] }; +# +# ex_7_3 := { [a,b,c,0,0,0,0] -> [a,b,c] }; +# +# ex_7_5 := { [a,b,c,d,e,0,0] -> [a,b,c,d,e] }; +# +# +# +# # stuff used in skew and tskew +# +# # Here is the description of time skewing from the current draft of the paper. +# IS_Trans := { [2,t,1,i,1] -> [2,tb,1,s,1,tt,1] : +# 0<=tt<1000 && s=i+1*t && t=1000*tb+tt }; +# +# +# IS_Tinv := inverse IS_Trans; +# +# +# # We use it to transform the iteration spaces +# TS_IS_CALC := IS_CALC join IS_Trans; +# +# # for some reason OC refuses do to this "join" but will do the reverse: +# # TS_IS_INIT := ex_7_5 join IS_INIT; +# TS_IS_INIT := IS_INIT join (inverse ex_7_5); +# +# +# # Now we can update the data flow relations to correspond to the new I.S.'s +# TS_DF1Ia := ex_7_5 join DF1Ia join IS_Trans; +# +# TS_DF1Ib := ex_7_5 join DF1Ib join IS_Trans; +# +# TS_DF1C := IS_Tinv join DF1C join IS_Trans; +# +# TS_DF2I := ex_7_5 join DF2I join IS_Trans; +# +# TS_DF2C := IS_Tinv join DF2C join IS_Trans; +# +# TS_DF3Ia := ex_7_5 join DF3Ia join IS_Trans; +# +# TS_DF3Ib := ex_7_5 join DF3Ib join IS_Trans; +# +# TS_DF3C := IS_Tinv join DF3C join IS_Trans; +# +# +# +# KNOWN := { [] : T >= 0 and N >= 4 }; +# +# +# # Lets try to build up the equivalent of the time skewing transformation, +# # IS_Trans := { [2,t,1,i,1] -> [2,tb,1,x,1,y,1] : +# # 1000*tb<=t-1<=1000*(tb+1)-1 && y=t-1000*tb && x=y+i }; +# # for both statements together, right from the diagram in the new TOPLAS stuff. +# +# # original code without mmap +# # +# +# # First, look at it as a wider space +# +# WIDEN := { [2, t, s, i , 1] -> [2, 2t+s, 0, i, 1] : 0<=s<=1 }; +# +# TSKEW := { [2, t, 0, i , 1] -> [2, tb, t+i, tt, 1] : +# 1000*tb+tt = t and 0 <= tt < 1000 }; +# +# +# TSKEW_2LOOPS := WIDEN join TSKEW; +# +# # print this for the paper +# +# # I think this should work but it blows up codegen: +# # codegen +# # IS_INIT, TSKEW_2LOOPS : IS_COPY, TSKEW_2LOOPS : IS_CALC +# # given (KNOWN join ex_0_5v); +# +# # So we fake it as follows, +# # relying on the fact that neither "t" nor "s" is used in any statement +# +# WIDEN0 := { [2, t, 0, i , 1] -> [2, 2t, 0, i, 1] }; +# +# WIDEN1 := { [2, t, 1, i , 1] -> [2, 2t+1, 0, i, 1] }; +# +# +# codegen +# IS_INIT, TSKEW : (IS_COPY join WIDEN0) , TSKEW : (IS_CALC join WIDEN1) +# given (KNOWN join ex_0_5v); +for(t2 = 0; t2 <= N-1; t2++) { + s1(1,t2,1,0,0); +} +for(t2 = 0; t2 <= intDiv(T-1,500); t2++) { + for(t3 = 1000*t2; t3 <= min(1000*t2+N+997,N+2*T-3); t3++) { + if (intMod(-N+t3+1,2) == 0 && 1000*t2 <= -N+t3+1) { + s2(2,t3-N+1,0,N-1,1); + } + for(t4 = max(-1000*t2-N+t3+2,0); t4 <= min(-1000*t2+2*T-1,-1000*t2+t3-1,999); t4++) { + if (intMod(t4,2) == 0) { + s2(2,t4+1000*t2,0,t3-t4+-1000*t2,1); + } + if (intMod(t4+1,2) == 0) { + s3(2,t4+1000*t2,0,t3-t4+-1000*t2,1); + } + } + if (intMod(t3,2) == 0 && 2*T >= t3+2 && 1000*t2 >= t3-998) { + s2(2,t3,0,0,1); + } + } +} + +# +# diff --git a/omegalib/examples/old_test/ts1d-mp-i_ts-m_b b/omegalib/examples/old_test/ts1d-mp-i_ts-m_b new file mode 100644 index 0000000..f288263 --- /dev/null +++ b/omegalib/examples/old_test/ts1d-mp-i_ts-m_b @@ -0,0 +1,289 @@ +# This is the file facts.prew, which is prepended to the .prew files +# for the particular code generation we want, defines things like the +# iteration space and dependences. Known facts are inserted by the +# Makefile. +# +# If you're looking at a .w file instead of facts.prew, then you should +# remember to edit the original .prew files, not the .w files. +# +# This facts.prew file describes the program +# +# for(i = 0; i <= N-1; i++) { +# cur[i]=... +# } +# for(t = 0; t < T; t++) { +# for(i = 0; i <= N-1; i++) { +# old[i]=cur[i]; +# } +# for(i = 1; i <= N-2; i++) { +# cur[i] = (old[i-1]+old[i]+old[i]+old[i+1])*0.25; +# } +# } + + + +# first, the spaces and memory maps + +symbolic T, N; + +IS_INIT := { [1,i,1,0,0] : 0<=i<=N-1 }; +MM_INIT := { [1,i,1,0,0] -> [0,i] : 0<=i<=N-1 }; + +IS_COPY := { [2,t,0,i,1] : 0<=t [t+1,i] : 0<=t [t+1,i] : 0<=t [x',t',y',i',z'] : + (x'>x) or + (x'=x and t'>t) or + (x'=x and t'=t and y'>y) or + (x'=x and t'=t and y'=y and i'>i) or + (x'=x and t'=t and y'=y and i'=i and z'>z) }; +FWD7 := {[x,t,y,i,z,a,b] -> [x',t',y',i',z',a',b'] : + (x'>x) or + (x'=x and t'>t) or + (x'=x and t'=t and y'>y) or + (x'=x and t'=t and y'=y and i'>i) or + (x'=x and t'=t and y'=y and i'=i and z'>z) or + (x'=x and t'=t and y'=y and i'=i and z'=z and a'>a) or + (x'=x and t'=t and y'=y and i'=i and z'=z and a'=a and b'>b) }; +BWD5 := inverse FWD5; +BWD7 := inverse FWD7; +EQi := {[x,t,y,i,z] -> [x',t',y',i',z'] : i'=i }; + +# output deps + +OAA := (IS_COPY * IS_COPY) intersection FWD5 intersection EQi; +OCC := (IS_CALC * IS_CALC) intersection FWD5 intersection EQi; + +# combined flow/anti deps + +FAC := (IS_COPY * IS_CALC) intersection FWD5 intersection {[2,t,0,i,1] -> [2,t',1,i',1] : (i'-1<=i<=i'+1)}; +FCA := (IS_CALC * IS_COPY) intersection FWD5 intersection {[2,t,1,i,1] -> [2,t',0,i',1] : (i-1<=i'<=i+1)}; + +# total memory deps in the "core" + +COREMEMDEPS := OAA union OCC union FAC union FCA; + + + +# data flow for original code: + +DF_12p1 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,0,0,i,1] : 0 [2,t,0,0,1] }; +DF_12p3 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,t,0,i,1] : i=N-1 && N>1 }; +DF_32 := ( IS_CALC * IS_COPY ) intersection {[2,t,1,i,1] -> [2,t+1,0,i,1]}; + +DF_23a := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i+1,1] }; +DF_23b := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i,1] }; +DF_23c := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i-1,1] }; + + +# data flow for array expanded code, +# after forward substitution of "old[i] = cur[i]" + +DF1Ia := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; +DF1Ib := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t>0 && i=0 } restrictDomain IS_INIT restrictRange IS_CALC; +DF1C := { [2,t,1,i,1] -> [2,t+1,1,i+1,1] } restrictDomain IS_CALC restrictRange IS_CALC; +DF2I := { [1,i,1,0,0] -> [2,t,1,i,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; +DF2C := { [2,t,1,i,1] -> [2,t+1,1,i+0,1] } restrictDomain IS_CALC restrictRange IS_CALC; +DF3Ia := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; +DF3Ib := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t>0 && i=N-1 } restrictDomain IS_INIT restrictRange IS_CALC; +DF3C := { [2,t,1,i,1] -> [2,t+1,1,i-1,1] } restrictDomain IS_CALC restrictRange IS_CALC; + +# total data flow + +COREDATAFLOW := DF1C union DF2C union DF3C; + + +# arity expansion relations +ex_0_5v := { [] -> [a,b,c,d,e] }; +ex_0_7v := { [] -> [a,b,c,d,e,f,g] }; +ex_3_5 := { [a,b,c] -> [a,b,c,0,0] }; +ex_3_7 := { [a,b,c] -> [a,b,c,0,0,0,0] }; +ex_5_7 := { [a,b,c,d,e] -> [a,b,c,d,e,0,0] }; + +ex_5_3 := { [a,b,c,0,0] -> [a,b,c] }; +ex_7_3 := { [a,b,c,0,0,0,0] -> [a,b,c] }; +ex_7_5 := { [a,b,c,d,e,0,0] -> [a,b,c,d,e] }; + + +# stuff used in skew and tskew + +# Here is the description of time skewing from the current draft of the paper. +IS_Trans := { [2,t,1,i,1] -> [2,tb,1,s,1,tt,1] : + 0<=tt<500 && s=i+1*t && t=500*tb+tt }; + +IS_Tinv := inverse IS_Trans; + +# We use it to transform the iteration spaces +TS_IS_CALC := IS_CALC join IS_Trans; +# for some reason OC refuses do to this "join" but will do the reverse: +# TS_IS_INIT := ex_7_5 join IS_INIT; +TS_IS_INIT := IS_INIT join (inverse ex_7_5); + +# Now we can update the data flow relations to correspond to the new I.S.'s +TS_DF1Ia := ex_7_5 join DF1Ia join IS_Trans; +TS_DF1Ib := ex_7_5 join DF1Ib join IS_Trans; +TS_DF1C := IS_Tinv join DF1C join IS_Trans; +TS_DF2I := ex_7_5 join DF2I join IS_Trans; +TS_DF2C := IS_Tinv join DF2C join IS_Trans; +TS_DF3Ia := ex_7_5 join DF3Ia join IS_Trans; +TS_DF3Ib := ex_7_5 join DF3Ib join IS_Trans; +TS_DF3C := IS_Tinv join DF3C join IS_Trans; + + +KNOWN := { [] : T >= 0 and N >= 4 }; + +# +# multiprocessor version +# time skewed iteration space +# blocked memory mapping +# + +# +# First of all, if 500 is much less than 4000, +# there's a problem with the constraints below. +# To keep send and recv. slices from "crashing", 4000>=2BS+2 (safe approx?) +# + +assertUnsatisfiable( { [] : 4000 < 2 * 500 + 2 } ); + +# this transformation has no existentially quantified variables; +# basically, it factors out the common stuff below, +# but the quantified variables are left in the output, so we can get them +# everything after the 000 is not needed in final xform + +# +# DANGER WILL ROBINSON! +# the .c file depends on the fact that t4 is always the processor number +# + +MP_TSKEW_ALL := { [2, t, 1, i, 1] -> + [2, tb, slice, proc, t+i, tt, 000, t, i, lproc, t0, i0, ie]: +## +## define time block and tt +## + 500*tb+tt = t and 0 <= tt < 500 +## +## define "logical proc", then "wrap" onto physical later: +## "logical proc" (lproc) = (t-i) div sigma +## + and 4000*lproc <= t-i < 4000*(lproc+1) +## +## for uniproc. test, just do proc = -lproc (for multi, proc = lproc % 8) +## + and proc = -lproc +## +## t0,i0 = first iteration in a block; +## t0,ie = maximum "i" in t0 of this block) +## + and t0=500*tb + and t0-ie=4000*lproc + and i0+4000-1=ie +}; + +# +# We need to send things "down" (to same time block of next proc.) +# and "right" (to next time block of next proc.) +# The "+2" is for the things to send right (not mentioned in IPDPS paper). +# + +MP_TSKEW_SEND_SL := MP_TSKEW_ALL join + { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> + [2, tb, 1, proc, t_p_i, tt, 0] : +## define send slice... + (t+i) <= (t0+(500-2) + i0+(500-1) + 2) +}; + +MP_TSKEW_SEND_ME := MP_TSKEW_ALL join + { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> + [2, tb, 2, proc, t_p_i, tt, 0] : +## in the send slice + (t+i) <= (t0+(500-2) + i0+(500-1) + 2) +## and near the (t-i) border: + and (t-i) >= ((t0-i0)-1) +}; + +MP_TSKEW_COMP_SL := MP_TSKEW_ALL join + { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> + [2, tb, 3, proc, t_p_i, tt, 0] : +## define computation slice... +## not send + (t+i) > (t0+(500-2) + i0+(500-1) + 2) +## and not recv + and (t+i) <= (t0+ie) +}; + + + +# Receive the iterations that we sent, +# but after the calculation, +# and on the neighbor (lower) processor + +MP_TSKEW_R_FROM_ME := MP_TSKEW_SEND_ME join + { [2, tb, 2, proc, t_p_i, tt, 0] -> + [2, tb, 4, proc-1, t_p_i, tt, 0] }; + + +MP_TSKEW_RECV_SL := MP_TSKEW_ALL join + { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> + [2, tb, 5, proc, t_p_i, tt, 0] : +## define recv slice... + (t+i) > (t0+ie) +}; + + + + +## stuff to gather each processor's final results... + +IS_GATHER := IS_CALC intersection { [2,t,1,i,1] : t=T-1 }; + +GATHER_EXPANDER := MP_TSKEW_ALL join + { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> + [3, tb, 7, proc, t_p_i, tt, 0] }; + +## stuff to initialize things right in the first place + +### NOTE THAT t4 (processor #) is used in a loop in initialization + +IS_INIT_EXP := { [1,t,i,0,0] : (-1=t && 0<=i<=N-1) || + (0<=t [0,i] : 0<=i<=N-1 }; +# +# +# IS_COPY := { [2,t,0,i,1] : 0<=t [t+1,i] : 0<=t [t+1,i] : 0<=t [x',t',y',i',z'] : +# (x'>x) or +# (x'=x and t'>t) or +# (x'=x and t'=t and y'>y) or +# (x'=x and t'=t and y'=y and i'>i) or +# (x'=x and t'=t and y'=y and i'=i and z'>z) }; +# +# FWD7 := {[x,t,y,i,z,a,b] -> [x',t',y',i',z',a',b'] : +# (x'>x) or +# (x'=x and t'>t) or +# (x'=x and t'=t and y'>y) or +# (x'=x and t'=t and y'=y and i'>i) or +# (x'=x and t'=t and y'=y and i'=i and z'>z) or +# (x'=x and t'=t and y'=y and i'=i and z'=z and a'>a) or +# (x'=x and t'=t and y'=y and i'=i and z'=z and a'=a and b'>b) }; +# +# BWD5 := inverse FWD5; +# +# BWD7 := inverse FWD7; +# +# EQi := {[x,t,y,i,z] -> [x',t',y',i',z'] : i'=i }; +# +# +# # output deps +# +# OAA := (IS_COPY * IS_COPY) intersection FWD5 intersection EQi; +# +# OCC := (IS_CALC * IS_CALC) intersection FWD5 intersection EQi; +# +# +# # combined flow/anti deps +# +# FAC := (IS_COPY * IS_CALC) intersection FWD5 intersection {[2,t,0,i,1] -> [2,t',1,i',1] : (i'-1<=i<=i'+1)}; +# +# FCA := (IS_CALC * IS_COPY) intersection FWD5 intersection {[2,t,1,i,1] -> [2,t',0,i',1] : (i-1<=i'<=i+1)}; +# +# +# # total memory deps in the "core" +# +# COREMEMDEPS := OAA union OCC union FAC union FCA; +# +# +# +# +# # data flow for original code: +# +# DF_12p1 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,0,0,i,1] : 0 [2,t,0,0,1] }; +# +# DF_12p3 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,t,0,i,1] : i=N-1 && N>1 }; +# +# DF_32 := ( IS_CALC * IS_COPY ) intersection {[2,t,1,i,1] -> [2,t+1,0,i,1]}; +# +# +# DF_23a := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i+1,1] }; +# +# DF_23b := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i,1] }; +# +# DF_23c := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i-1,1] }; +# +# +# +# # data flow for array expanded code, +# # after forward substitution of "old[i] = cur[i]" +# +# DF1Ia := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; +# +# DF1Ib := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t>0 && i=0 } restrictDomain IS_INIT restrictRange IS_CALC; +# +# DF1C := { [2,t,1,i,1] -> [2,t+1,1,i+1,1] } restrictDomain IS_CALC restrictRange IS_CALC; +# +# DF2I := { [1,i,1,0,0] -> [2,t,1,i,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; +# +# DF2C := { [2,t,1,i,1] -> [2,t+1,1,i+0,1] } restrictDomain IS_CALC restrictRange IS_CALC; +# +# DF3Ia := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; +# +# DF3Ib := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t>0 && i=N-1 } restrictDomain IS_INIT restrictRange IS_CALC; +# +# DF3C := { [2,t,1,i,1] -> [2,t+1,1,i-1,1] } restrictDomain IS_CALC restrictRange IS_CALC; +# +# +# # total data flow +# +# COREDATAFLOW := DF1C union DF2C union DF3C; +# +# +# +# # arity expansion relations +# ex_0_5v := { [] -> [a,b,c,d,e] }; +# +# ex_0_7v := { [] -> [a,b,c,d,e,f,g] }; +# +# ex_3_5 := { [a,b,c] -> [a,b,c,0,0] }; +# +# ex_3_7 := { [a,b,c] -> [a,b,c,0,0,0,0] }; +# +# ex_5_7 := { [a,b,c,d,e] -> [a,b,c,d,e,0,0] }; +# +# +# ex_5_3 := { [a,b,c,0,0] -> [a,b,c] }; +# +# ex_7_3 := { [a,b,c,0,0,0,0] -> [a,b,c] }; +# +# ex_7_5 := { [a,b,c,d,e,0,0] -> [a,b,c,d,e] }; +# +# +# +# # stuff used in skew and tskew +# +# # Here is the description of time skewing from the current draft of the paper. +# IS_Trans := { [2,t,1,i,1] -> [2,tb,1,s,1,tt,1] : +# 0<=tt<500 && s=i+1*t && t=500*tb+tt }; +# +# +# IS_Tinv := inverse IS_Trans; +# +# +# # We use it to transform the iteration spaces +# TS_IS_CALC := IS_CALC join IS_Trans; +# +# # for some reason OC refuses do to this "join" but will do the reverse: +# # TS_IS_INIT := ex_7_5 join IS_INIT; +# TS_IS_INIT := IS_INIT join (inverse ex_7_5); +# +# +# # Now we can update the data flow relations to correspond to the new I.S.'s +# TS_DF1Ia := ex_7_5 join DF1Ia join IS_Trans; +# +# TS_DF1Ib := ex_7_5 join DF1Ib join IS_Trans; +# +# TS_DF1C := IS_Tinv join DF1C join IS_Trans; +# +# TS_DF2I := ex_7_5 join DF2I join IS_Trans; +# +# TS_DF2C := IS_Tinv join DF2C join IS_Trans; +# +# TS_DF3Ia := ex_7_5 join DF3Ia join IS_Trans; +# +# TS_DF3Ib := ex_7_5 join DF3Ib join IS_Trans; +# +# TS_DF3C := IS_Tinv join DF3C join IS_Trans; +# +# +# +# KNOWN := { [] : T >= 0 and N >= 4 }; +# +# +# # +# # multiprocessor version +# # time skewed iteration space +# # blocked memory mapping +# # +# +# # +# # First of all, if 500 is much less than 4000, +# # there's a problem with the constraints below. +# # To keep send and recv. slices from "crashing", 4000>=2BS+2 (safe approx?) +# # +# +# assertUnsatisfiable( { [] : 4000 < 2 * 500 + 2 } ); + +{ FALSE } + +# +# +# # this transformation has no existentially quantified variables; +# # basically, it factors out the common stuff below, +# # but the quantified variables are left in the output, so we can get them +# # everything after the 000 is not needed in final xform +# +# # +# # DANGER WILL ROBINSON! +# # the .c file depends on the fact that t4 is always the processor number +# # +# +# MP_TSKEW_ALL := { [2, t, 1, i, 1] -> +# [2, tb, slice, proc, t+i, tt, 000, t, i, lproc, t0, i0, ie]: +# ## +# ## define time block and tt +# ## +# 500*tb+tt = t and 0 <= tt < 500 +# ## +# ## define "logical proc", then "wrap" onto physical later: +# ## "logical proc" (lproc) = (t-i) div sigma +# ## +# and 4000*lproc <= t-i < 4000*(lproc+1) +# ## +# ## for uniproc. test, just do proc = -lproc (for multi, proc = lproc % 8) +# ## +# and proc = -lproc +# ## +# ## t0,i0 = first iteration in a block; +# ## t0,ie = maximum "i" in t0 of this block) +# ## +# and t0=500*tb +# and t0-ie=4000*lproc +# and i0+4000-1=ie +# }; +# +# +# # +# # We need to send things "down" (to same time block of next proc.) +# # and "right" (to next time block of next proc.) +# # The "+2" is for the things to send right (not mentioned in IPDPS paper). +# # +# +# MP_TSKEW_SEND_SL := MP_TSKEW_ALL join +# { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> +# [2, tb, 1, proc, t_p_i, tt, 0] : +# ## define send slice... +# (t+i) <= (t0+(500-2) + i0+(500-1) + 2) +# }; +# +# +# MP_TSKEW_SEND_ME := MP_TSKEW_ALL join +# { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> +# [2, tb, 2, proc, t_p_i, tt, 0] : +# ## in the send slice +# (t+i) <= (t0+(500-2) + i0+(500-1) + 2) +# ## and near the (t-i) border: +# and (t-i) >= ((t0-i0)-1) +# }; +# +# +# MP_TSKEW_COMP_SL := MP_TSKEW_ALL join +# { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> +# [2, tb, 3, proc, t_p_i, tt, 0] : +# ## define computation slice... +# ## not send +# (t+i) > (t0+(500-2) + i0+(500-1) + 2) +# ## and not recv +# and (t+i) <= (t0+ie) +# }; +# +# +# +# +# # Receive the iterations that we sent, +# # but after the calculation, +# # and on the neighbor (lower) processor +# +# MP_TSKEW_R_FROM_ME := MP_TSKEW_SEND_ME join +# { [2, tb, 2, proc, t_p_i, tt, 0] -> +# [2, tb, 4, proc-1, t_p_i, tt, 0] }; +# +# +# +# MP_TSKEW_RECV_SL := MP_TSKEW_ALL join +# { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> +# [2, tb, 5, proc, t_p_i, tt, 0] : +# ## define recv slice... +# (t+i) > (t0+ie) +# }; +# +# +# +# +# +# ## stuff to gather each processor's final results... +# +# IS_GATHER := IS_CALC intersection { [2,t,1,i,1] : t=T-1 }; +# +# +# GATHER_EXPANDER := MP_TSKEW_ALL join +# { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> +# [3, tb, 7, proc, t_p_i, tt, 0] }; +# +# +# ## stuff to initialize things right in the first place +# +# ### NOTE THAT t4 (processor #) is used in a loop in initialization +# +# IS_INIT_EXP := { [1,t,i,0,0] : (-1=t && 0<=i<=N-1) || +# (0<=t= 1) { + for(t2 = intDiv(T-500+499,500); t2 <= intDiv(T-1,500); t2++) { + for(t4 = intDiv(-T+2+3999,4000); t4 <= intDiv(N-T+3998,4000); t4++) { + for(t5 = max(4000*t4+2*T-4001,T); t5 <= min(4000*t4+2*T-2,N+T-3); t5++) { + s7(2,T-1,1,t5-T+1,1); + } + } + } +} + +# +# diff --git a/omegalib/examples/old_test/ts1d-orig0 b/omegalib/examples/old_test/ts1d-orig0 new file mode 100644 index 0000000..48e5a10 --- /dev/null +++ b/omegalib/examples/old_test/ts1d-orig0 @@ -0,0 +1,151 @@ +# This is the file facts.prew, which is prepended to the .prew files +# for the particular code generation we want, defines things like the +# iteration space and dependences. Known facts are inserted by the +# Makefile. +# +# If you're looking at a .w file instead of facts.prew, then you should +# remember to edit the original .prew files, not the .w files. +# +# This facts.prew file describes the program +# +# for(i = 0; i <= N-1; i++) { +# cur[i]=... +# } +# for(t = 0; t < T; t++) { +# for(i = 0; i <= N-1; i++) { +# old[i]=cur[i]; +# } +# for(i = 1; i <= N-2; i++) { +# cur[i] = (old[i-1]+old[i]+old[i]+old[i+1])*0.25; +# } +# } + + + +# first, the spaces and memory maps + +symbolic T, N; + +IS_INIT := { [1,i,1,0,0] : 0<=i<=N-1 }; +MM_INIT := { [1,i,1,0,0] -> [0,i] : 0<=i<=N-1 }; + +IS_COPY := { [2,t,0,i,1] : 0<=t [t+1,i] : 0<=t [t+1,i] : 0<=t [x',t',y',i',z'] : + (x'>x) or + (x'=x and t'>t) or + (x'=x and t'=t and y'>y) or + (x'=x and t'=t and y'=y and i'>i) or + (x'=x and t'=t and y'=y and i'=i and z'>z) }; +FWD7 := {[x,t,y,i,z,a,b] -> [x',t',y',i',z',a',b'] : + (x'>x) or + (x'=x and t'>t) or + (x'=x and t'=t and y'>y) or + (x'=x and t'=t and y'=y and i'>i) or + (x'=x and t'=t and y'=y and i'=i and z'>z) or + (x'=x and t'=t and y'=y and i'=i and z'=z and a'>a) or + (x'=x and t'=t and y'=y and i'=i and z'=z and a'=a and b'>b) }; +BWD5 := inverse FWD5; +BWD7 := inverse FWD7; +EQi := {[x,t,y,i,z] -> [x',t',y',i',z'] : i'=i }; + +# output deps + +OAA := (IS_COPY * IS_COPY) intersection FWD5 intersection EQi; +OCC := (IS_CALC * IS_CALC) intersection FWD5 intersection EQi; + +# combined flow/anti deps + +FAC := (IS_COPY * IS_CALC) intersection FWD5 intersection {[2,t,0,i,1] -> [2,t',1,i',1] : (i'-1<=i<=i'+1)}; +FCA := (IS_CALC * IS_COPY) intersection FWD5 intersection {[2,t,1,i,1] -> [2,t',0,i',1] : (i-1<=i'<=i+1)}; + +# total memory deps in the "core" + +COREMEMDEPS := OAA union OCC union FAC union FCA; + + + +# data flow for original code: + +DF_12p1 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,0,0,i,1] : 0 [2,t,0,0,1] }; +DF_12p3 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,t,0,i,1] : i=N-1 && N>1 }; +DF_32 := ( IS_CALC * IS_COPY ) intersection {[2,t,1,i,1] -> [2,t+1,0,i,1]}; + +DF_23a := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i+1,1] }; +DF_23b := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i,1] }; +DF_23c := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i-1,1] }; + + +# data flow for array expanded code, +# after forward substitution of "old[i] = cur[i]" + +DF1Ia := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; +DF1Ib := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t>0 && i=0 } restrictDomain IS_INIT restrictRange IS_CALC; +DF1C := { [2,t,1,i,1] -> [2,t+1,1,i+1,1] } restrictDomain IS_CALC restrictRange IS_CALC; +DF2I := { [1,i,1,0,0] -> [2,t,1,i,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; +DF2C := { [2,t,1,i,1] -> [2,t+1,1,i+0,1] } restrictDomain IS_CALC restrictRange IS_CALC; +DF3Ia := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; +DF3Ib := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t>0 && i=N-1 } restrictDomain IS_INIT restrictRange IS_CALC; +DF3C := { [2,t,1,i,1] -> [2,t+1,1,i-1,1] } restrictDomain IS_CALC restrictRange IS_CALC; + +# total data flow + +COREDATAFLOW := DF1C union DF2C union DF3C; + + +# arity expansion relations +ex_0_5v := { [] -> [a,b,c,d,e] }; +ex_0_7v := { [] -> [a,b,c,d,e,f,g] }; +ex_3_5 := { [a,b,c] -> [a,b,c,0,0] }; +ex_3_7 := { [a,b,c] -> [a,b,c,0,0,0,0] }; +ex_5_7 := { [a,b,c,d,e] -> [a,b,c,d,e,0,0] }; + +ex_5_3 := { [a,b,c,0,0] -> [a,b,c] }; +ex_7_3 := { [a,b,c,0,0,0,0] -> [a,b,c] }; +ex_7_5 := { [a,b,c,d,e,0,0] -> [a,b,c,d,e] }; + + +# stuff used in skew and tskew + +# Here is the description of time skewing from the current draft of the paper. +IS_Trans := { [2,t,1,i,1] -> [2,tb,1,s,1,tt,1] : + 0<=tt<1000 && s=i+1*t && t=1000*tb+tt }; + +IS_Tinv := inverse IS_Trans; + +# We use it to transform the iteration spaces +TS_IS_CALC := IS_CALC join IS_Trans; +# for some reason OC refuses do to this "join" but will do the reverse: +# TS_IS_INIT := ex_7_5 join IS_INIT; +TS_IS_INIT := IS_INIT join (inverse ex_7_5); + +# Now we can update the data flow relations to correspond to the new I.S.'s +TS_DF1Ia := ex_7_5 join DF1Ia join IS_Trans; +TS_DF1Ib := ex_7_5 join DF1Ib join IS_Trans; +TS_DF1C := IS_Tinv join DF1C join IS_Trans; +TS_DF2I := ex_7_5 join DF2I join IS_Trans; +TS_DF2C := IS_Tinv join DF2C join IS_Trans; +TS_DF3Ia := ex_7_5 join DF3Ia join IS_Trans; +TS_DF3Ib := ex_7_5 join DF3Ib join IS_Trans; +TS_DF3C := IS_Tinv join DF3C join IS_Trans; + + +KNOWN := { [] : T >= 0 and N >= 4 }; + +# original code without mmap +# + +codegen + IS_INIT, IS_COPY, IS_CALC +given (KNOWN join ex_0_5v); + diff --git a/omegalib/examples/old_test/ts1d-orig0.oc-rt b/omegalib/examples/old_test/ts1d-orig0.oc-rt new file mode 100644 index 0000000..775af7e --- /dev/null +++ b/omegalib/examples/old_test/ts1d-orig0.oc-rt @@ -0,0 +1,220 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # This is the file facts.prew, which is prepended to the .prew files +# # for the particular code generation we want, defines things like the +# # iteration space and dependences. Known facts are inserted by the +# # Makefile. +# # +# # If you're looking at a .w file instead of facts.prew, then you should +# # remember to edit the original .prew files, not the .w files. +# # +# # This facts.prew file describes the program +# # +# # for(i = 0; i <= N-1; i++) { +# # cur[i]=... +# # } +# # for(t = 0; t < T; t++) { +# # for(i = 0; i <= N-1; i++) { +# # old[i]=cur[i]; +# # } +# # for(i = 1; i <= N-2; i++) { +# # cur[i] = (old[i-1]+old[i]+old[i]+old[i+1])*0.25; +# # } +# # } +# +# +# +# # first, the spaces and memory maps +# +# symbolic T, N; +# +# +# IS_INIT := { [1,i,1,0,0] : 0<=i<=N-1 }; +# +# MM_INIT := { [1,i,1,0,0] -> [0,i] : 0<=i<=N-1 }; +# +# +# IS_COPY := { [2,t,0,i,1] : 0<=t [t+1,i] : 0<=t [t+1,i] : 0<=t [x',t',y',i',z'] : +# (x'>x) or +# (x'=x and t'>t) or +# (x'=x and t'=t and y'>y) or +# (x'=x and t'=t and y'=y and i'>i) or +# (x'=x and t'=t and y'=y and i'=i and z'>z) }; +# +# FWD7 := {[x,t,y,i,z,a,b] -> [x',t',y',i',z',a',b'] : +# (x'>x) or +# (x'=x and t'>t) or +# (x'=x and t'=t and y'>y) or +# (x'=x and t'=t and y'=y and i'>i) or +# (x'=x and t'=t and y'=y and i'=i and z'>z) or +# (x'=x and t'=t and y'=y and i'=i and z'=z and a'>a) or +# (x'=x and t'=t and y'=y and i'=i and z'=z and a'=a and b'>b) }; +# +# BWD5 := inverse FWD5; +# +# BWD7 := inverse FWD7; +# +# EQi := {[x,t,y,i,z] -> [x',t',y',i',z'] : i'=i }; +# +# +# # output deps +# +# OAA := (IS_COPY * IS_COPY) intersection FWD5 intersection EQi; +# +# OCC := (IS_CALC * IS_CALC) intersection FWD5 intersection EQi; +# +# +# # combined flow/anti deps +# +# FAC := (IS_COPY * IS_CALC) intersection FWD5 intersection {[2,t,0,i,1] -> [2,t',1,i',1] : (i'-1<=i<=i'+1)}; +# +# FCA := (IS_CALC * IS_COPY) intersection FWD5 intersection {[2,t,1,i,1] -> [2,t',0,i',1] : (i-1<=i'<=i+1)}; +# +# +# # total memory deps in the "core" +# +# COREMEMDEPS := OAA union OCC union FAC union FCA; +# +# +# +# +# # data flow for original code: +# +# DF_12p1 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,0,0,i,1] : 0 [2,t,0,0,1] }; +# +# DF_12p3 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,t,0,i,1] : i=N-1 && N>1 }; +# +# DF_32 := ( IS_CALC * IS_COPY ) intersection {[2,t,1,i,1] -> [2,t+1,0,i,1]}; +# +# +# DF_23a := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i+1,1] }; +# +# DF_23b := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i,1] }; +# +# DF_23c := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i-1,1] }; +# +# +# +# # data flow for array expanded code, +# # after forward substitution of "old[i] = cur[i]" +# +# DF1Ia := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; +# +# DF1Ib := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t>0 && i=0 } restrictDomain IS_INIT restrictRange IS_CALC; +# +# DF1C := { [2,t,1,i,1] -> [2,t+1,1,i+1,1] } restrictDomain IS_CALC restrictRange IS_CALC; +# +# DF2I := { [1,i,1,0,0] -> [2,t,1,i,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; +# +# DF2C := { [2,t,1,i,1] -> [2,t+1,1,i+0,1] } restrictDomain IS_CALC restrictRange IS_CALC; +# +# DF3Ia := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC; +# +# DF3Ib := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t>0 && i=N-1 } restrictDomain IS_INIT restrictRange IS_CALC; +# +# DF3C := { [2,t,1,i,1] -> [2,t+1,1,i-1,1] } restrictDomain IS_CALC restrictRange IS_CALC; +# +# +# # total data flow +# +# COREDATAFLOW := DF1C union DF2C union DF3C; +# +# +# +# # arity expansion relations +# ex_0_5v := { [] -> [a,b,c,d,e] }; +# +# ex_0_7v := { [] -> [a,b,c,d,e,f,g] }; +# +# ex_3_5 := { [a,b,c] -> [a,b,c,0,0] }; +# +# ex_3_7 := { [a,b,c] -> [a,b,c,0,0,0,0] }; +# +# ex_5_7 := { [a,b,c,d,e] -> [a,b,c,d,e,0,0] }; +# +# +# ex_5_3 := { [a,b,c,0,0] -> [a,b,c] }; +# +# ex_7_3 := { [a,b,c,0,0,0,0] -> [a,b,c] }; +# +# ex_7_5 := { [a,b,c,d,e,0,0] -> [a,b,c,d,e] }; +# +# +# +# # stuff used in skew and tskew +# +# # Here is the description of time skewing from the current draft of the paper. +# IS_Trans := { [2,t,1,i,1] -> [2,tb,1,s,1,tt,1] : +# 0<=tt<1000 && s=i+1*t && t=1000*tb+tt }; +# +# +# IS_Tinv := inverse IS_Trans; +# +# +# # We use it to transform the iteration spaces +# TS_IS_CALC := IS_CALC join IS_Trans; +# +# # for some reason OC refuses do to this "join" but will do the reverse: +# # TS_IS_INIT := ex_7_5 join IS_INIT; +# TS_IS_INIT := IS_INIT join (inverse ex_7_5); +# +# +# # Now we can update the data flow relations to correspond to the new I.S.'s +# TS_DF1Ia := ex_7_5 join DF1Ia join IS_Trans; +# +# TS_DF1Ib := ex_7_5 join DF1Ib join IS_Trans; +# +# TS_DF1C := IS_Tinv join DF1C join IS_Trans; +# +# TS_DF2I := ex_7_5 join DF2I join IS_Trans; +# +# TS_DF2C := IS_Tinv join DF2C join IS_Trans; +# +# TS_DF3Ia := ex_7_5 join DF3Ia join IS_Trans; +# +# TS_DF3Ib := ex_7_5 join DF3Ib join IS_Trans; +# +# TS_DF3C := IS_Tinv join DF3C join IS_Trans; +# +# +# +# KNOWN := { [] : T >= 0 and N >= 4 }; +# +# +# # original code without mmap +# # +# +# codegen +# IS_INIT, IS_COPY, IS_CALC +# given (KNOWN join ex_0_5v); +for(t2 = 0; t2 <= N-1; t2++) { + s1(1,t2,1,0,0); +} +for(t2 = 0; t2 <= T-1; t2++) { + for(t4 = 0; t4 <= N-1; t4++) { + s2(2,t2,0,t4,1); + } + for(t4 = 1; t4 <= N-2; t4++) { + s3(2,t2,1,t4,1); + } +} + +# +# diff --git a/omegalib/examples/old_test/tseng b/omegalib/examples/old_test/tseng new file mode 100644 index 0000000..2ae39f8 --- /dev/null +++ b/omegalib/examples/old_test/tseng @@ -0,0 +1,16 @@ +symbolic n; +symbolic LV,UV; +D := {[ i,i+1] -> [i+1,k] : 1 <= i && i+1 < k <= n}; +local := {[i1,k1] -> [i2,k2] : LV <= k1,k2 <= UV }; +sameP := {[i1,k1] -> [i2,k2] : k1=k2 || LV <= k1,k2 <= UV }; +myIter := {[i,k] : LV <= k <= UV}; +lexPos := {[i1,k1] -> [i2,k2] : i1 = i2 && k1 < k2 || i1 < i2}; + +post := D restrictDomain myIter; +wait := D restrictRange myIter; +enforcedTime := sameP intersection lexPos; +enforcedTime; +enforced := enforcedTime compose D union D compose enforcedTime union enforcedTime; +enforced; +post - enforced; +wait - enforced; diff --git a/omegalib/examples/old_test/tseng.oc-rt b/omegalib/examples/old_test/tseng.oc-rt new file mode 100644 index 0000000..53ff139 --- /dev/null +++ b/omegalib/examples/old_test/tseng.oc-rt @@ -0,0 +1,54 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n; +# +# symbolic LV,UV; +# +# D := {[ i,i+1] -> [i+1,k] : 1 <= i && i+1 < k <= n}; +# +# local := {[i1,k1] -> [i2,k2] : LV <= k1,k2 <= UV }; +# +# sameP := {[i1,k1] -> [i2,k2] : k1=k2 || LV <= k1,k2 <= UV }; +# +# myIter := {[i,k] : LV <= k <= UV}; +# +# lexPos := {[i1,k1] -> [i2,k2] : i1 = i2 && k1 < k2 || i1 < i2}; +# +# +# post := D restrictDomain myIter; +# +# wait := D restrictRange myIter; +# +# enforcedTime := sameP intersection lexPos; +# +# enforcedTime; + +{[i1,k1] -> [i1,k2] : LV <= k1 < k2 <= UV} union + {[i1,k1] -> [i2,k1] : i1 < i2} union + {[i1,k1] -> [i2,k2] : LV <= k1,k2 <= UV && i1 < i2} + +# +# enforced := enforcedTime compose D union D compose enforcedTime union enforcedTime; +# +# enforced; + +{[i1,i1+1] -> [i2,k2] : 1 <= i1 <= n-2, UV-2, i2-2 && LV <= k2 <= UV && LV <= n} union + {[i1,k1] -> [i2,k2] : k1 = 1+i1 && 1 <= i1 <= i2-2, k2-2 && k2 <= n} union + {[i1,i1+1] -> [i1+1,k2] : 1 <= i1 <= n-2, k2-3 && LV < k2 <= UV && LV <= n} union + {[i1,k1] -> [i2,k2] : 2, LV, i1+2 <= i2 < k2 <= n && LV <= k1 <= UV && i2 <= UV} union + {[i1,k1] -> [k1,k2] : 2, i1+2 <= k1 < k2 <= n} union + {[i1,k1] -> [i1+1,k2] : LV <= k1 <= i1 <= k2-2, UV-1 && k2 <= n && 1 <= i1} union + {[i1,k1] -> [i2,k2] : LV <= k1,k2 <= UV && i1 < i2} union + {[i1,k1] -> [i2,k1] : i1 < i2} union + {[i1,k1] -> [i1,k2] : LV <= k1 < k2 <= UV} + +# +# post - enforced; + +{[In_1,In_1+1] -> [In_1+1,Out_2] : 1, LV-1 <= In_1 < UV < Out_2 <= n} + +# +# wait - enforced; + +{[In_1,In_1+1] -> [In_1+1,LV] : In_1+2 <= LV <= n, UV && 1 <= In_1} + +# diff --git a/omegalib/examples/old_test/verlind1 b/omegalib/examples/old_test/verlind1 new file mode 100644 index 0000000..181b1c5 --- /dev/null +++ b/omegalib/examples/old_test/verlind1 @@ -0,0 +1,44 @@ + without_simplify; + + R3 := {[x] -> [y] : (y = x) | (y = 3x)}; + + Rf := {[x] -> [y] : x <= y <= 3x}; + + R3; + + Rf; + + s12 := {[x] : 1 <= x <= 2}; + s12; + + sd3 := R3(s12); + sd3; + + sc3 := Rf(s12); + sc3; + + sc3 intersection sd3; + + # I think this is faulty + sc3 - sd3; + + # This is OK + sd3 - sc3; + + complement sc3; + complement sd3; + + sc3; + + sc3 intersection (complement sd3); + + # alternative description of sd3; + sd3' := {[y] : 1 <= y <= 3 | y = 6}; + sd3'; + sc3 - sd3'; + + # sd3 wrt sd3'; + + sd3 - sd3'; + + sd3' - sd3; diff --git a/omegalib/examples/old_test/verlind1.oc-rt b/omegalib/examples/old_test/verlind1.oc-rt new file mode 100644 index 0000000..050b199 --- /dev/null +++ b/omegalib/examples/old_test/verlind1.oc-rt @@ -0,0 +1,120 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R3 := {[x] -> [y] : (y = x) | (y = 3x)}; +# +# +# Rf := {[x] -> [y] : x <= y <= 3x}; +# +# +# R3; + +{[x] -> [x] } union + {[x] -> [3x] } + +# +# +# Rf; + +{[x] -> [y] : x <= y <= 3x} + +# +# +# s12 := {[x] : 1 <= x <= 2}; +# +# s12; + +{[x]: 1 <= x <= 2} + +# +# +# sd3 := R3(s12); +# +# sd3; + +{[y]: 1 <= y <= 2} union + {[y]: Exists ( alpha : y = 3alpha && 3 <= y <= 6)} + +# +# +# sc3 := Rf(s12); +# +# sc3; + +{[y]: 1 <= y <= 6} + +# +# +# sc3 intersection sd3; + +{[y]: 1 <= y <= 2} union + {[y]: Exists ( alpha : y = 3alpha && 3 <= y <= 6)} + +# +# +# # I think this is faulty +# sc3 - sd3; + +{[y]: 4 <= y <= 5} + +# +# +# # This is OK +# sd3 - sc3; + +{[y] : FALSE } + +# +# +# complement sc3; + +{[y]: y <= 0} union + {[y]: 7 <= y} + +# +# complement sd3; + +{[y]: y <= 0} union + {[y]: 7 <= y} union + {[y]: 4 <= y <= 5} + +# +# +# sc3; + +{[y]: 1 <= y <= 6} + +# +# +# sc3 intersection (complement sd3); + +{[y]: 4 <= y <= 5} + +# +# +# # alternative description of sd3; +# sd3' := {[y] : 1 <= y <= 3 | y = 6}; +# +# sd3'; + +{[y]: 1 <= y <= 3} union + {[6]} + +# +# sc3 - sd3'; + +{[y]: 4 <= y <= 5} + +# +# +# # sd3 wrt sd3'; +# +# sd3 - sd3'; + +{[y] : FALSE } + +# +# +# sd3' - sd3; + +{[y] : FALSE } + +# diff --git a/omegalib/examples/old_test/verlind1a b/omegalib/examples/old_test/verlind1a new file mode 100644 index 0000000..e43ec19 --- /dev/null +++ b/omegalib/examples/old_test/verlind1a @@ -0,0 +1,3 @@ +R := { [i] : 1 <= i <= 6 & exists (alpha : 3 alpha + 1 <= i <= 3 alpha + 2) + & not (1 <= i <= 2) }; +R; diff --git a/omegalib/examples/old_test/verlind1a.oc-rt b/omegalib/examples/old_test/verlind1a.oc-rt new file mode 100644 index 0000000..11e2d1e --- /dev/null +++ b/omegalib/examples/old_test/verlind1a.oc-rt @@ -0,0 +1,9 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := { [i] : 1 <= i <= 6 & Exists (alpha : 3 alpha + 1 <= i <= 3 alpha + 2) +# & not (1 <= i <= 2) }; +# +# R; + +{[i]: 4 <= i <= 5} + +# diff --git a/omegalib/examples/old_test/wak1 b/omegalib/examples/old_test/wak1 new file mode 100644 index 0000000..5e9e315 --- /dev/null +++ b/omegalib/examples/old_test/wak1 @@ -0,0 +1,13 @@ +symbolic a1,a2,a3,b1,b2,b3; + +IS1 := {[i] : a1 <= i <= b1 }; +IS2 := {[i] : a2 <= i <= b2 }; +IS3 := {[i] : a3 <= i <= b3 }; + +T1 := {[i] -> [i,0]}; +T2 := {[i] -> [i,1]}; +T3 := {[i] -> [i,2]}; + +codegen 0 T1:IS1,T2:IS2,T3:IS3; + +codegen T1:IS1,T2:IS2,T3:IS3; diff --git a/omegalib/examples/old_test/wak1.oc-rt b/omegalib/examples/old_test/wak1.oc-rt new file mode 100644 index 0000000..e8bdf0e --- /dev/null +++ b/omegalib/examples/old_test/wak1.oc-rt @@ -0,0 +1,87 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# +# Symbolic a1,a2,a3,b1,b2,b3; +# +# +# IS1 := {[i] : a1 <= i <= b1 }; +# +# IS2 := {[i] : a2 <= i <= b2 }; +# +# IS3 := {[i] : a3 <= i <= b3 }; +# +# +# T1 := {[i] -> [i,0]}; +# +# T2 := {[i] -> [i,1]}; +# +# T3 := {[i] -> [i,2]}; +# +# +# codegen T1:IS1,T2:IS2,T3:IS3; +for(t1 = a3; t1 <= min(b3,a1-1,a2-1); t1++) { + s3(t1); +} +for(t1 = a2; t1 <= min(b2,a1-1,a3-1,b3); t1++) { + s2(t1); +} +for(t1 = max(a2,a3); t1 <= min(a1-1,b2,b3); t1++) { + s2(t1); + s3(t1); +} +for(t1 = max(a2,b3+1); t1 <= min(b2,a1-1); t1++) { + s2(t1); +} +for(t1 = max(a3,a2,b2+1); t1 <= min(b3,a1-1); t1++) { + s3(t1); +} +for(t1 = a1; t1 <= min(b1,a3-1,b3,a2-1); t1++) { + s1(t1); +} +for(t1 = max(a1,a3); t1 <= min(b1,a2-1,b3); t1++) { + s1(t1); + s3(t1); +} +for(t1 = max(a1,b3+1); t1 <= min(b1,a2-1); t1++) { + s1(t1); +} +for(t1 = max(a1,a2); t1 <= min(b1,b2,a3-1); t1++) { + s1(t1); + s2(t1); +} +for(t1 = max(a1,a2,a3); t1 <= min(b1,b2,b3); t1++) { + s1(t1); + s2(t1); + s3(t1); +} +for(t1 = max(a1,a2,a3,b3+1); t1 <= min(b1,b2); t1++) { + s1(t1); + s2(t1); +} +for(t1 = max(a1,b2+1,a2); t1 <= min(b1,a3-1); t1++) { + s1(t1); +} +for(t1 = max(a1,a2,b2+1,a3); t1 <= min(b1,b3); t1++) { + s1(t1); + s3(t1); +} +for(t1 = max(a1,b3+1,a3,a2,b2+1); t1 <= b1; t1++) { + s1(t1); +} +for(t1 = max(a3,a1,b1+1); t1 <= min(b3,b2,a2-1); t1++) { + s3(t1); +} +for(t1 = max(a2,a1,b1+1); t1 <= min(b2,a3-1); t1++) { + s2(t1); +} +for(t1 = max(a1,b1+1,a2,a3); t1 <= min(b2,b3); t1++) { + s2(t1); + s3(t1); +} +for(t1 = max(a2,a1,b1+1,b3+1,a3); t1 <= b2; t1++) { + s2(t1); +} +for(t1 = max(a3,a1,b1+1,b2+1); t1 <= b3; t1++) { + s3(t1); +} + +# diff --git a/omegalib/examples/old_test/wak2 b/omegalib/examples/old_test/wak2 new file mode 100644 index 0000000..927fc2f --- /dev/null +++ b/omegalib/examples/old_test/wak2 @@ -0,0 +1,10 @@ +symbolic a1,a2,b1,b2,c1,c2,d1,d2; + +IS1 := {[i,j] : a1 <= i <= b1 && c1 <= j <= d1}; +IS2 := {[i,j] : a2 <= i <= b2 && c2 <= j <= d2}; + +T1 := {[i,j] -> [i,j,0]}; +T2 := {[i,j] -> [i,j,1]}; + +codegen T1:IS1,T2:IS2; +codegen 2 T1:IS1,T2:IS2; diff --git a/omegalib/examples/old_test/wak2.oc-rt b/omegalib/examples/old_test/wak2.oc-rt new file mode 100644 index 0000000..6dc6270 --- /dev/null +++ b/omegalib/examples/old_test/wak2.oc-rt @@ -0,0 +1,307 @@ +>>> Symbolic a1,a2,b1,b2,c1,c2,d1,d2; +>>> +>>> IS1 := {[i,j] : a1 <= i <= b1 && c1 <= j <= d1}; +>>> IS2 := {[i,j] : a2 <= i <= b2 && c2 <= j <= d2}; +>>> +>>> T1 := {[i,j] -> [i,j,0]}; +>>> T2 := {[i,j] -> [i,j,1]}; +>>> +>>> codegen T1:IS1,T2:IS2; +if (d2 >= c2) { + for(t1 = a2; t1 <= min(a1-1,b2); t1++) { + for(t2 = c2; t2 <= d2; t2++) { + s2(t1,t2); + } + } +} +for(t1 = a1; t1 <= b1; t1++) { + if (t1 >= a2 && t1 <= b2) { + for(t2 = c2; t2 <= min(c1-1,d2); t2++) { + s2(t1,t2); + } + } + if (t1 <= a2-1) { + for(t2 = c1; t2 <= d1; t2++) { + s1(t1,t2); + } + } + if (t1 >= a2 && t1 <= b2) { + for(t2 = c1; t2 <= min(d1,c2-1,d2); t2++) { + s1(t1,t2); + } + } + if (t1 <= b2 && t1 >= a2) { + for(t2 = max(c2,c1); t2 <= min(d2,d1); t2++) { + s1(t1,t2); + s2(t1,t2); + } + } + if (t1 >= a2 && t1 <= b2) { + for(t2 = max(d2+1,c1); t2 <= d1; t2++) { + s1(t1,t2); + } + } + if (t1 >= a2 && t1 >= b2+1) { + for(t2 = c1; t2 <= d1; t2++) { + s1(t1,t2); + } + } + if (t1 >= a2 && t1 <= b2) { + for(t2 = max(c2,d1+1,c1); t2 <= d2; t2++) { + s2(t1,t2); + } + } +} +if (d2 >= c2) { + for(t1 = max(a1,a2,b1+1); t1 <= b2; t1++) { + for(t2 = c2; t2 <= d2; t2++) { + s2(t1,t2); + } + } +} + +>>> codegen 2 T1:IS1,T2:IS2; +if (d2 >= c2) { + for(t1 = a2; t1 <= min(a1-1,b2); t1++) { + for(t2 = c2; t2 <= d2; t2++) { + s2(t1,t2); + } + } +} +if (d1 >= c1) { + for(t1 = a1; t1 <= min(a2-1,b1); t1++) { + for(t2 = c1; t2 <= d1; t2++) { + s1(t1,t2); + } + } +} +if (d1 >= c1 && c1 >= d2+2 && c2 <= d2) { + for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { + for(t2 = c2; t2 <= d2; t2++) { + s2(t1,t2); + } + for(t2 = c1; t2 <= d1; t2++) { + s1(t1,t2); + } + } +} +if (d2 >= c2 && d2 <= c1-2 && d1 <= c1-1) { + for(t1 = max(a1,a2); t1 <= min(b2,b1); t1++) { + for(t2 = c2; t2 <= d2; t2++) { + s2(t1,t2); + } + } +} +if (c1 >= c2+1 && d1 <= d2-1 && d1 >= c1) { + for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { + for(t2 = c2; t2 <= c1-1; t2++) { + s2(t1,t2); + } + for(t2 = c1; t2 <= d1; t2++) { + s1(t1,t2); + s2(t1,t2); + } + for(t2 = d1+1; t2 <= d2; t2++) { + s2(t1,t2); + } + } +} +if (c1 >= c2+1 && c1 <= d2 && d1 >= d2+1) { + for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { + for(t2 = c2; t2 <= c1-1; t2++) { + s2(t1,t2); + } + for(t2 = c1; t2 <= d2; t2++) { + s1(t1,t2); + s2(t1,t2); + } + for(t2 = d2+1; t2 <= d1; t2++) { + s1(t1,t2); + } + } +} +if (d1 == d2 && d1 >= c1 && c1 >= c2+1) { + for(t1 = max(a2,a1); t1 <= min(b2,b1); t1++) { + for(t2 = c2; t2 <= c1-1; t2++) { + s2(t1,t2); + } + for(t2 = c1; t2 <= d2; t2++) { + s1(t1,t2); + s2(t1,t2); + } + } +} +if (d2 == c1-1 && d2 <= d1-1 && d2 >= c2) { + for(t1 = max(a2,a1); t1 <= min(b2,b1); t1++) { + for(t2 = c2; t2 <= c1-1; t2++) { + s2(t1,t2); + } + for(t2 = c1; t2 <= d1; t2++) { + s1(t1,t2); + } + } +} +if (c2 <= c1-1 && d2 >= c1 && d1 <= c1-1) { + for(t1 = max(a1,a2); t1 <= min(b2,b1); t1++) { + for(t2 = c2; t2 <= c1-1; t2++) { + s2(t1,t2); + } + for(t2 = c1; t2 <= d2; t2++) { + s2(t1,t2); + } + } +} +if (d2 == c1-1 && d2 >= d1 && d2 >= c2) { + for(t1 = max(a1,a2); t1 <= min(b1,b2); t1++) { + for(t2 = c2; t2 <= d2; t2++) { + s2(t1,t2); + } + } +} +if (d1 >= c1 && c1 >= c2+1 && d2 <= c2-1) { + for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { + for(t2 = c1; t2 <= d1; t2++) { + s1(t1,t2); + } + } +} +if (c1 <= c2-1 && d1 >= c2 && d1 <= d2-1) { + for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { + for(t2 = c1; t2 <= c2-1; t2++) { + s1(t1,t2); + } + for(t2 = c2; t2 <= d1; t2++) { + s1(t1,t2); + s2(t1,t2); + } + for(t2 = d1+1; t2 <= d2; t2++) { + s2(t1,t2); + } + } +} +if (c1 <= c2-1 && d1 >= d2+1 && c2 <= d2) { + for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { + for(t2 = c1; t2 <= c2-1; t2++) { + s1(t1,t2); + } + for(t2 = c2; t2 <= d2; t2++) { + s1(t1,t2); + s2(t1,t2); + } + for(t2 = d2+1; t2 <= d1; t2++) { + s1(t1,t2); + } + } +} +if (d1 == d2 && d1 >= c2 && c1 <= c2-1) { + for(t1 = max(a2,a1); t1 <= min(b2,b1); t1++) { + for(t2 = c1; t2 <= c2-1; t2++) { + s1(t1,t2); + } + for(t2 = c2; t2 <= d2; t2++) { + s1(t1,t2); + s2(t1,t2); + } + } +} +if (c2 <= d2 && d1 >= c1 && d1 <= c2-1) { + for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { + for(t2 = c1; t2 <= d1; t2++) { + s1(t1,t2); + } + for(t2 = c2; t2 <= d2; t2++) { + s2(t1,t2); + } + } +} +if (d1 >= c1 && d2 <= c2-1 && d1 <= d2-1) { + for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { + for(t2 = c1; t2 <= d1; t2++) { + s1(t1,t2); + } + } +} +if (d2 >= c1 && d2 <= c2-1 && d1 >= d2+1) { + for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { + for(t2 = c1; t2 <= d2; t2++) { + s1(t1,t2); + } + for(t2 = d2+1; t2 <= d1; t2++) { + s1(t1,t2); + } + } +} +if (d1 == d2 && d1 <= c2-1 && d1 >= c1) { + for(t1 = max(a2,a1); t1 <= min(b2,b1); t1++) { + for(t2 = c1; t2 <= d1; t2++) { + s1(t1,t2); + } + } +} +if (d2 >= c2 && c2 >= c1+1 && d1 <= c1-1) { + for(t1 = max(a1,a2); t1 <= min(b2,b1); t1++) { + for(t2 = c2; t2 <= d2; t2++) { + s2(t1,t2); + } + } +} +if (c2 == c1 && c2 <= d1 && d1 <= d2-1) { + for(t1 = max(a2,a1); t1 <= min(b2,b1); t1++) { + for(t2 = c1; t2 <= d1; t2++) { + s1(t1,t2); + s2(t1,t2); + } + for(t2 = d1+1; t2 <= d2; t2++) { + s2(t1,t2); + } + } +} +if (c2 == c1 && d1 >= d2+1 && c2 <= d2) { + for(t1 = max(a2,a1); t1 <= min(b2,b1); t1++) { + for(t2 = c1; t2 <= d2; t2++) { + s1(t1,t2); + s2(t1,t2); + } + for(t2 = d2+1; t2 <= d1; t2++) { + s1(t1,t2); + } + } +} +if (c1 == c2 && d1 == d2 && d1 >= c1) { + for(t1 = max(a1,a2); t1 <= min(b2,b1); t1++) { + for(t2 = c1; t2 <= d2; t2++) { + s1(t1,t2); + s2(t1,t2); + } + } +} +if (c1 == c2 && c1 >= d1+1 && d2 >= c1) { + for(t1 = max(a1,a2); t1 <= min(b1,b2); t1++) { + for(t2 = c2; t2 <= d2; t2++) { + s2(t1,t2); + } + } +} +if (d1 >= c1 && c1 <= c2 && d2 <= c1-1) { + for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { + for(t2 = c1; t2 <= d1; t2++) { + s1(t1,t2); + } + } +} +if (d1 >= c1) { + for(t1 = max(b2+1,a1,a2); t1 <= b1; t1++) { + for(t2 = c1; t2 <= d1; t2++) { + s1(t1,t2); + } + } +} +if (d2 >= c2) { + for(t1 = max(a1,a2,b1+1); t1 <= b2; t1++) { + for(t2 = c2; t2 <= d2; t2++) { + s2(t1,t2); + } + } +} + + diff --git a/omegalib/examples/old_test/wak3 b/omegalib/examples/old_test/wak3 new file mode 100644 index 0000000..51ca234 --- /dev/null +++ b/omegalib/examples/old_test/wak3 @@ -0,0 +1,12 @@ +symbolic a,b; + +IS1 := {[i] : a <= i <= b }; +IS2 := {[i] : a+10 <= i <= b+10 }; +IS3 := {[i] : a+20 <= i <= b+20 }; + +T1 := {[i] -> [i,0]}; +T2 := {[i] -> [i,1]}; +T3 := {[i] -> [i,2]}; + +codegen T1:IS1,T2:IS2,T3:IS3; +codegen 2 T1:IS1,T2:IS2,T3:IS3; diff --git a/omegalib/examples/old_test/wak3.oc-rt b/omegalib/examples/old_test/wak3.oc-rt new file mode 100644 index 0000000..825c72f --- /dev/null +++ b/omegalib/examples/old_test/wak3.oc-rt @@ -0,0 +1,59 @@ +>>> Symbolic a,b; +>>> +>>> IS1 := {[i] : a <= i <= b }; +>>> IS2 := {[i] : a+10 <= i <= b+10 }; +>>> IS3 := {[i] : a+20 <= i <= b+20 }; +>>> +>>> T1 := {[i] -> [i,0]}; +>>> T2 := {[i] -> [i,1]}; +>>> T3 := {[i] -> [i,2]}; +>>> +>>> codegen T1:IS1,T2:IS2,T3:IS3; +for(t1 = a; t1 <= min(b,a+9); t1++) { + s1(t1); +} +for(t1 = a+10; t1 <= min(b,a+19); t1++) { + s1(t1); + s2(t1); +} +for(t1 = a+20; t1 <= b; t1++) { + s1(t1); + s2(t1); + s3(t1); +} +for(t1 = max(a+10,b+1); t1 <= min(b+10,a+19); t1++) { + s2(t1); +} +for(t1 = max(a+20,b+1); t1 <= b+10; t1++) { + s2(t1); + s3(t1); +} +for(t1 = max(a+20,b+11); t1 <= b+20; t1++) { + s3(t1); +} + +>>> codegen 2 T1:IS1,T2:IS2,T3:IS3; +for(t1 = a; t1 <= min(b,a+9); t1++) { + s1(t1); +} +for(t1 = a+10; t1 <= min(b,a+19); t1++) { + s1(t1); + s2(t1); +} +for(t1 = a+20; t1 <= b; t1++) { + s1(t1); + s2(t1); + s3(t1); +} +for(t1 = max(a+10,b+1); t1 <= min(b+10,a+19); t1++) { + s2(t1); +} +for(t1 = max(a+20,b+1); t1 <= b+10; t1++) { + s2(t1); + s3(t1); +} +for(t1 = max(a+20,b+11); t1 <= b+20; t1++) { + s3(t1); +} + + diff --git a/omegalib/examples/old_test/wak4 b/omegalib/examples/old_test/wak4 new file mode 100644 index 0000000..48224b9 --- /dev/null +++ b/omegalib/examples/old_test/wak4 @@ -0,0 +1,9 @@ +symbolic a1,a2,a3,a4,a5,b1,b2,b3,b4,b5; +IS1 := {[i] : a1,a2,a3,a4,a5 <= i <= b1,b2,b3,b4,b5 }; +IS2 := {[i] : a1,a2,a3,a4,a5 <= i <= b1,b2,b3,b4,b5 }; + +T1 := {[i] -> [i,0]}; +T2 := {[i] -> [i,1]}; + +codegen T1:IS1,T2:IS2; +codegen 2 T1:IS1,T2:IS2; diff --git a/omegalib/examples/old_test/wak4.oc-rt b/omegalib/examples/old_test/wak4.oc-rt new file mode 100644 index 0000000..5f2cacd --- /dev/null +++ b/omegalib/examples/old_test/wak4.oc-rt @@ -0,0 +1,20 @@ +>>> Symbolic a1,a2,a3,a4,a5,b1,b2,b3,b4,b5; +>>> IS1 := {[i] : a1,a2,a3,a4,a5 <= i <= b1,b2,b3,b4,b5 }; +>>> IS2 := {[i] : a1,a2,a3,a4,a5 <= i <= b1,b2,b3,b4,b5 }; +>>> +>>> T1 := {[i] -> [i,0]}; +>>> T2 := {[i] -> [i,1]}; +>>> +>>> codegen T1:IS1,T2:IS2; +for(t1 = max(a1,a2,a3,a4,a5); t1 <= min(b1,b2,b3,b4,b5); t1++) { + s1(t1); + s2(t1); +} + +>>> codegen 2 T1:IS1,T2:IS2; +for(t1 = max(a1,a2,a3,a4,a5); t1 <= min(b1,b2,b3,b4,b5); t1++) { + s1(t1); + s2(t1); +} + + diff --git a/omegalib/examples/old_test/wak5 b/omegalib/examples/old_test/wak5 new file mode 100644 index 0000000..1232b34 --- /dev/null +++ b/omegalib/examples/old_test/wak5 @@ -0,0 +1,4 @@ +S1 := {[1,In_2,0,In_4,In_5,In_6,In_7]: 2 <= In_4 <= 1024 && 2 <= In_2 <= 1024}; +S2 := {[1,In_2,0,In_4,In_5,In_6,In_7]: 1 <= In_4 < In_2 <= 1024}; + +Hull (S1 union S2); diff --git a/omegalib/examples/old_test/wak5.oc-rt b/omegalib/examples/old_test/wak5.oc-rt new file mode 100644 index 0000000..2d5830c --- /dev/null +++ b/omegalib/examples/old_test/wak5.oc-rt @@ -0,0 +1,11 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# S1 := {[1,In_2,0,In_4,In_5,In_6,In_7]: 2 <= In_4 <= 1024 && 2 <= In_2 <= 1024}; +# +# S2 := {[1,In_2,0,In_4,In_5,In_6,In_7]: 1 <= In_4 < In_2 <= 1024}; +# +# +# Hull (S1 union S2); + +{[1,In_2,0,In_4,In_5,In_6,In_7]: 1 <= In_4 <= 1024 && 2 <= In_2 <= 1024} + +# diff --git a/omegalib/examples/old_test/wak6 b/omegalib/examples/old_test/wak6 new file mode 100644 index 0000000..c251ca6 --- /dev/null +++ b/omegalib/examples/old_test/wak6 @@ -0,0 +1,14 @@ +T1 := {[k,i,j] -> [k',i,j] : 1 <= k < k' < i <= 1024 && k'+1 <= j <= 1024}; +T2 := {[k,i,j] -> [j,i,j'] : 1 <= k < j < i <= 1024 && j < j' <= 1024}; +T3 := {[k,k+1,k+1] -> [k+1,i',j'] : 1 <= k <= i'-2, j'-2 && j' <= 1024 && i' <= 1024}; + +# The following expression evaluates to FALSE, which I believe is incorrect: + +T3+; + +# And the following cause assertion failures: + +(T2 union T3)+; +(T1 union T2)+; + +# This comes from Guassian Elimination. diff --git a/omegalib/examples/old_test/wak6.oc-rt b/omegalib/examples/old_test/wak6.oc-rt new file mode 100644 index 0000000..458f5e9 --- /dev/null +++ b/omegalib/examples/old_test/wak6.oc-rt @@ -0,0 +1,36 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# T1 := {[k,i,j] -> [k',i,j] : 1 <= k < k' < i <= 1024 && k'+1 <= j <= 1024}; +# +# T2 := {[k,i,j] -> [j,i,j'] : 1 <= k < j < i <= 1024 && j < j' <= 1024}; +# +# T3 := {[k,k+1,k+1] -> [k+1,i',j'] : 1 <= k <= i'-2, j'-2 && j' <= 1024 && i' <= 1024}; +# +# +# # The following expression evaluates to FALSE, which I believe is incorrect: +# +# T3+; + +{[k,k+1,k+1] -> [Out_1,i,j] : 1 <= k < Out_1 < i <= 1024 && Out_1+1 <= j <= 1024} + +# +# +# # And the following cause assertion failures: +# +# (T2 union T3)+; + +{[k,k+1,k+1] -> [j',i',j''] : 1 <= k < j' < i' <= 1024 && j'+1 <= j'' <= 1024} union + {[k,i,i-1] -> [j',i',j''] : k+2 <= i <= j' < j'' <= 1024 && j' < i' <= 1024 && 1 <= k} union + {[k,i,j] -> [j',i',j''] : j+2 <= i <= j' < i' <= 1024 && 1 <= k < j && j' < j'' <= 1024} union + {[k,i,j] -> [j',i,j''] : 1 <= k < j < j' < i <= 1024 && j' < j'' <= 1024} union + {[k,i,j] -> [j,i,j''] : 1 <= k < j < i <= 1024 && j < j'' <= 1024} + +# +# (T1 union T2)+; + +{[k,i,j] -> [Out_1,i,j] : 1 <= k < Out_1 < i <= 1024 && Out_1+1 <= j <= 1024} union + {[k,i,j] -> [Out_1,i,j'] : 1 <= k < j < Out_1 < i <= 1024 && Out_1 < j' <= 1024} union + {[k,i,j] -> [j,i,j'] : 1 <= k < j < i <= 1024 && j < j' <= 1024} + +# +# +# # This comes from Guassian Elimination. diff --git a/omegalib/examples/old_test/wak7 b/omegalib/examples/old_test/wak7 new file mode 100644 index 0000000..b122c5a --- /dev/null +++ b/omegalib/examples/old_test/wak7 @@ -0,0 +1,5 @@ +R := {[k,k+1,k+1]: 1 <= k <= 1022} + union {[k,i,j]: 2 <= k < i <= 1024 && k < j <= 1024}; + +Hull R; + diff --git a/omegalib/examples/old_test/wak7.oc-rt b/omegalib/examples/old_test/wak7.oc-rt new file mode 100644 index 0000000..3ccdb0a --- /dev/null +++ b/omegalib/examples/old_test/wak7.oc-rt @@ -0,0 +1,11 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := {[k,k+1,k+1]: 1 <= k <= 1022} +# union {[k,i,j]: 2 <= k < i <= 1024 && k < j <= 1024}; +# +# +# Hull R; + +{[k,i,j]: k+1, 2 <= j <= 1024 && k < i <= 1024} + +# +# diff --git a/omegalib/examples/old_test/wak8 b/omegalib/examples/old_test/wak8 new file mode 100644 index 0000000..f55c2b9 --- /dev/null +++ b/omegalib/examples/old_test/wak8 @@ -0,0 +1,15 @@ + T1 := {[i1,i2,i3] -> [o1,i2,o3] : 2 <= i2 <= 511 && o1 <= 256 +&& o3 <= 511 && 2 <= i3 && i1+o3 <= i3+o1 + && 255i3+o1 <= i1+255o3 && 1 <= i1}; + +T1; + + T2 := {[i1,i2,i3] -> [o1,i2,o3] : exists ( x: 2 <= i2 <= 511 + && 2 <= o3 <= 509 && o1 <= 256 + && 3+i1+o3 <= i3+o1 && 2o1+o3 <= 511+2x + && 2 <= i3 && i1+2o1+o3 <= i3+3x + && 255i3+511x <= i1+510o1+255o3 && 1 <= i1)}; + +T2; + + T1 compose T2; diff --git a/omegalib/examples/old_test/wak8.oc-rt b/omegalib/examples/old_test/wak8.oc-rt new file mode 100644 index 0000000..10ba68d --- /dev/null +++ b/omegalib/examples/old_test/wak8.oc-rt @@ -0,0 +1,30 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# T1 := {[i1,i2,i3] -> [o1,i2,o3] : 2 <= i2 <= 511 && o1 <= 256 +# && o3 <= 511 && 2 <= i3 && i1+o3 <= i3+o1 +# && 255i3+o1 <= i1+255o3 && 1 <= i1}; +# +# +# T1; + +{[i1,i2,i3] -> [o1,i2,o3] : 2 <= i2 <= 511 && o1 <= 256 && o3 <= 511 && 2 <= i3 && i1+o3 <= i3+o1 && 255i3+o1 <= i1+255o3 && 1 <= i1} + +# +# +# T2 := {[i1,i2,i3] -> [o1,i2,o3] : Exists ( x: 2 <= i2 <= 511 +# && 2 <= o3 <= 509 && o1 <= 256 +# && 3+i1+o3 <= i3+o1 && 2o1+o3 <= 511+2x +# && 2 <= i3 && i1+2o1+o3 <= i3+3x +# && 255i3+511x <= i1+510o1+255o3 && 1 <= i1)}; +# +# +# T2; + +{[i1,i2,i3] -> [o1,i2,o3] : Exists ( alpha : 2 <= i2 <= 511 && 2 <= o3 <= 509 && o1 <= 256 && 3+i1+o3 <= i3+o1 && 2o1+o3 <= 511+2alpha && 2 <= i3 && i1+2o1+o3 <= i3+3alpha && 255i3+511alpha <= i1+510o1+255o3 && 1 <= i1)} + +# +# +# T1 compose T2; + +{[i1,i2,i3] -> [o1,i2,o3] : Exists ( alpha,beta,gamma : 2 <= i2 <= 511 && 2 <= gamma <= 509 && o1 <= 256 && o3 <= 511 && o3+alpha <= o1+gamma && o1+255gamma <= 255o3+alpha && gamma+2alpha <= 511+2beta && 1 <= i1 && 255i3+511beta <= i1+255gamma+510alpha && i1+gamma+2alpha <= i3+3beta && 2 <= i3 && 3+i1+gamma <= i3+alpha)} + +# diff --git a/omegalib/examples/old_test/wielage b/omegalib/examples/old_test/wielage new file mode 100644 index 0000000..f2e3911 --- /dev/null +++ b/omegalib/examples/old_test/wielage @@ -0,0 +1,13 @@ +{[k1,k2,k3] : +15+k1+2k2+3k3 = 0 + && k2+k3 <= 0 + && 0 <= 5+k2+k3 + && k3 <= 0 + && 0 <= 5+k3 + && k1+k2+k3 <= 0 + && 0 <= 5+k1+k2+k3 +}; + + +{[x] : exists (a,b : 0 <= x+4a <= 2 && 0 <= x+8b <= 6)}; + diff --git a/omegalib/examples/old_test/wielage.oc-rt b/omegalib/examples/old_test/wielage.oc-rt new file mode 100644 index 0000000..6c4b10a --- /dev/null +++ b/omegalib/examples/old_test/wielage.oc-rt @@ -0,0 +1,22 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# {[k1,k2,k3] : +# 15+k1+2k2+3k3 = 0 +# && k2+k3 <= 0 +# && 0 <= 5+k2+k3 +# && k3 <= 0 +# && 0 <= 5+k3 +# && k1+k2+k3 <= 0 +# && 0 <= 5+k1+k2+k3 +# }; + +{[0,0,-5]} + +# +# +# +# {[x] : exists (a,b : 0 <= x+4a <= 2 && 0 <= x+8b <= 6)}; + +{[x]: Exists ( alpha,beta : -4alpha <= x <= -4alpha+2, -8beta+6 && alpha <= 2beta)} + +# +# diff --git a/omegalib/examples/old_test/wild b/omegalib/examples/old_test/wild new file mode 100644 index 0000000..7c43e3c --- /dev/null +++ b/omegalib/examples/old_test/wild @@ -0,0 +1,13 @@ +symbolic L,M; + +I := {[j,i] : 1 <= j <= 100 && j-L <= i <= j}; + +D := I*I intersection {[j1,i1] -> [j2,i2] : i1+j1 = i2+M}; +I; +D; +range D; +(range D) - (range D); +E := I - range D; +sample := {[-M+3,-M+3]: L = 0 && -97 <= M <= 2}; +sample intersection range D; +sample intersection E; diff --git a/omegalib/examples/old_test/wild.oc-rt b/omegalib/examples/old_test/wild.oc-rt new file mode 100644 index 0000000..811519b --- /dev/null +++ b/omegalib/examples/old_test/wild.oc-rt @@ -0,0 +1,43 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic L,M; +# +# +# I := {[j,i] : 1 <= j <= 100 && j-L <= i <= j}; +# +# +# D := I*I intersection {[j1,i1] -> [j2,i2] : i1+j1 = i2+M}; +# +# I; + +{[j,i]: 1, i <= j <= 100 && j <= L+i} + +# +# D; + +{[In_1,In_2] -> [Out_1,In_1-M+In_2] : 1, In_2 <= In_1 <= 100 && 1 <= Out_1 <= 100 && In_1 <= L+In_2 && M+Out_1 <= L+In_1+In_2 && In_1+In_2 <= M+Out_1} + +# +# range D; + +{[In_1,In_2]: Exists ( alpha : 1, In_2 <= In_1 <= 100 && M <= -In_2+200 && 2 <= M+L+In_2 && M+In_2 <= L+2alpha && 2alpha <= M+In_2 && In_1 <= L+In_2)} + +# +# (range D) - (range D); + +{[In_1,In_2] : FALSE } + +# +# E := I - range D; +# +# sample := {[-M+3,-M+3]: L = 0 && -97 <= M <= 2}; +# +# sample intersection range D; + +{[In_1,In_2] : FALSE } + +# +# sample intersection E; + +{[-M+3,-M+3]: L = 0 && -97 <= M <= 2} + +# diff --git a/omegalib/examples/old_test/wrap b/omegalib/examples/old_test/wrap new file mode 100644 index 0000000..895c51b --- /dev/null +++ b/omegalib/examples/old_test/wrap @@ -0,0 +1,12 @@ +symbolic n; +I := {[i,j,k] : 1 <= i,j,k <= n}; +R1 := {[i,j,n] -> [i,j+1,1] : 1 <= i,j,j+1 <= n} + union {[i,j,k] -> [i,j,k'] : 1 <= i,j,k,k' <= n && k' = k+1}; +R1; +R1+; +R1+ within I; +R2 := {[i,n,n] -> [i+1,1,1] : 1 <= i,i+1 <= n} + union R1; +R2; +R2+; +R2+ within I; diff --git a/omegalib/examples/old_test/wrap.oc-rt b/omegalib/examples/old_test/wrap.oc-rt new file mode 100644 index 0000000..0729e41 --- /dev/null +++ b/omegalib/examples/old_test/wrap.oc-rt @@ -0,0 +1,50 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n; +# +# I := {[i,j,k] : 1 <= i,j,k <= n}; +# +# R1 := {[i,j,n] -> [i,j+1,1] : 1 <= i,j,j+1 <= n} +# union {[i,j,k] -> [i,j,k'] : 1 <= i,j,k,k' <= n && k' = k+1}; +# +# R1; + +{[i,j,n] -> [i,j+1,1] : 1 <= i <= n && 1 <= j < n} union + {[i,j,k] -> [i,j,k+1] : 1 <= i <= n && 1 <= j <= n && 1 <= k < n} + +# +# R1+; + +{[i,j,k] -> [i,j',k'] : 1 <= j < j' <= n && 1 <= i <= n && 1 <= k <= n && 1 <= k' <= n} union + {[i,j,k] -> [i,j,k'] : 1 <= k < k' <= n && 1 <= i <= n && 1 <= j <= n} + +# +# R1+ within I; + +{[i,j,k] -> [i,j',k'] : 1 <= j < j' <= n && 1 <= i <= n && 1 <= k <= n && 1 <= k' <= n} union + {[i,j,k] -> [i,j,k'] : 1 <= k < k' <= n && 1 <= i <= n && 1 <= j <= n} + +# +# R2 := {[i,n,n] -> [i+1,1,1] : 1 <= i,i+1 <= n} +# union R1; +# +# R2; + +{[i,n,n] -> [i+1,1,1] : 1 <= i < n} union + {[i,j,k] -> [i,j,k+1] : 1 <= i <= n && 1 <= j <= n && 1 <= k < n} union + {[i,j,n] -> [i,j+1,1] : 1 <= i <= n && 1 <= j < n} + +# +# R2+; + +{[i,j,k] -> [i',j',k'] : 1 <= i < i' <= n && 1 <= j <= n && 1 <= k <= n && 1 <= j' <= n && 1 <= k' <= n} union + {[i,j,k] -> [i,j',k'] : 1 <= j < j' <= n && 1 <= i <= n && 1 <= k <= n && 1 <= k' <= n} union + {[i,j,k] -> [i,j,k'] : 1 <= k < k' <= n && 1 <= i <= n && 1 <= j <= n} + +# +# R2+ within I; + +{[i,j,k] -> [i',j',k'] : 1 <= i < i' <= n && 1 <= j <= n && 1 <= k <= n && 1 <= j' <= n && 1 <= k' <= n} union + {[i,j,k] -> [i,j',k'] : 1 <= j < j' <= n && 1 <= i <= n && 1 <= k <= n && 1 <= k' <= n} union + {[i,j,k] -> [i,j,k'] : 1 <= k < k' <= n && 1 <= i <= n && 1 <= j <= n} + +# diff --git a/omegalib/examples/old_test/wrap0 b/omegalib/examples/old_test/wrap0 new file mode 100644 index 0000000..ca914af --- /dev/null +++ b/omegalib/examples/old_test/wrap0 @@ -0,0 +1,7 @@ +symbolic n; +I := {[i,j,k] : 1 <= i,j,k <= n}; +R1 := {[i,j,n] -> [i,j+1,1] : 1 <= i,j,j+1 <= n} + union {[i,j,k] -> [i,j,k'] : 1 <= i,j,k,k' <= n && k' = k+1}; +R1; +R1+ within I; +R1+; diff --git a/omegalib/examples/old_test/wrap0.oc-rt b/omegalib/examples/old_test/wrap0.oc-rt new file mode 100644 index 0000000..d9c7d34 --- /dev/null +++ b/omegalib/examples/old_test/wrap0.oc-rt @@ -0,0 +1,26 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n; +# +# I := {[i,j,k] : 1 <= i,j,k <= n}; +# +# R1 := {[i,j,n] -> [i,j+1,1] : 1 <= i,j,j+1 <= n} +# union {[i,j,k] -> [i,j,k'] : 1 <= i,j,k,k' <= n && k' = k+1}; +# +# R1; + +{[i,j,n] -> [i,j+1,1] : 1 <= i <= n && 1 <= j < n} union + {[i,j,k] -> [i,j,k+1] : 1 <= i <= n && 1 <= j <= n && 1 <= k < n} + +# +# R1+ within I; + +{[i,j,k] -> [i,j',k'] : 1 <= j < j' <= n && 1 <= i <= n && 1 <= k <= n && 1 <= k' <= n} union + {[i,j,k] -> [i,j,k'] : 1 <= k < k' <= n && 1 <= i <= n && 1 <= j <= n} + +# +# R1+; + +{[i,j,k] -> [i,j',k'] : 1 <= j < j' <= n && 1 <= i <= n && 1 <= k <= n && 1 <= k' <= n} union + {[i,j,k] -> [i,j,k'] : 1 <= k < k' <= n && 1 <= i <= n && 1 <= j <= n} + +# diff --git a/omegalib/examples/old_test/wrap1 b/omegalib/examples/old_test/wrap1 new file mode 100644 index 0000000..d862a5a --- /dev/null +++ b/omegalib/examples/old_test/wrap1 @@ -0,0 +1,8 @@ +symbolic n; +I := {[i,j,k] : 1 <= i,j,k <= n}; +R1 := {[i,j,n] -> [i,j+1,1] : 1 <= i,j,j+1 <= n} + union {[i,j,k] -> [i,j,k'] : 1 <= i,j,k,k' <= n && k' = k+1}; +R2 := {[i,n,n] -> [i+1,1,1] : 1 <= i,i+1 <= n} + union R1; +R2; +R2+ within I; diff --git a/omegalib/examples/old_test/wrap1.oc-rt b/omegalib/examples/old_test/wrap1.oc-rt new file mode 100644 index 0000000..9e43201 --- /dev/null +++ b/omegalib/examples/old_test/wrap1.oc-rt @@ -0,0 +1,25 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n; +# +# I := {[i,j,k] : 1 <= i,j,k <= n}; +# +# R1 := {[i,j,n] -> [i,j+1,1] : 1 <= i,j,j+1 <= n} +# union {[i,j,k] -> [i,j,k'] : 1 <= i,j,k,k' <= n && k' = k+1}; +# +# R2 := {[i,n,n] -> [i+1,1,1] : 1 <= i,i+1 <= n} +# union R1; +# +# R2; + +{[i,n,n] -> [i+1,1,1] : 1 <= i < n} union + {[i,j,k] -> [i,j,k+1] : 1 <= i <= n && 1 <= j <= n && 1 <= k < n} union + {[i,j,n] -> [i,j+1,1] : 1 <= i <= n && 1 <= j < n} + +# +# R2+ within I; + +{[i,j,k] -> [i',j',k'] : 1 <= i < i' <= n && 1 <= j <= n && 1 <= k <= n && 1 <= j' <= n && 1 <= k' <= n} union + {[i,j,k] -> [i,j',k'] : 1 <= j < j' <= n && 1 <= i <= n && 1 <= k <= n && 1 <= k' <= n} union + {[i,j,k] -> [i,j,k'] : 1 <= k < k' <= n && 1 <= i <= n && 1 <= j <= n} + +# diff --git a/omegalib/examples/old_test/x b/omegalib/examples/old_test/x new file mode 100644 index 0000000..56c23ca --- /dev/null +++ b/omegalib/examples/old_test/x @@ -0,0 +1,9 @@ +old_IS:= {[i,j]: 1 <= i <= 8 & 1 <= j <= 4}; +T1:={[i,j] -> [j-i+8,i,0]}; +T2:={[i,j] -> [i+j-1,i,1]}; +n1:= T1 \ old_IS; +n1; +n2:= T2 \ old_IS; +n2; +codegen T1:old_IS,T2:old_IS; +codegen 2 T1:old_IS,T2:old_IS; diff --git a/omegalib/examples/old_test/x.oc-rt b/omegalib/examples/old_test/x.oc-rt new file mode 100644 index 0000000..fc77e1a --- /dev/null +++ b/omegalib/examples/old_test/x.oc-rt @@ -0,0 +1,84 @@ +>>> old_IS:= {[i,j]: 1 <= i <= 8 & 1 <= j <= 4}; +>>> T1:={[i,j] -> [j-i+8,i,0]}; +>>> T2:={[i,j] -> [i+j-1,i,1]}; +>>> n1:= T1 \ old_IS; +>>> n1; +{[i,j] -> [j-i+8,i,0] : 1 <= i <= 8 && 1 <= j <= 4} +>>> n2:= T2 \ old_IS; +>>> n2; +{[i,j] -> [i+j-1,i,1] : 1 <= i <= 8 && 1 <= j <= 4} +>>> codegen T1:old_IS,T2:old_IS; +for(t1 = 1; t1 <= 11; t1++) { + for(t2 = max(t1-3,1); t2 <= min(t1,-t1+8); t2++) { + s2(t2,t1-t2+1); + } + for(t2 = max(-t1+9,1); t2 <= min(-t1+12,t1-4); t2++) { + s1(t2,t1+t2-8); + } + for(t2 = max(-t1+9,t1-3); t2 <= min(-t1+12,t1); t2++) { + s1(t2,t1+t2-8); + s2(t2,t1-t2+1); + } + for(t2 = max(-t1+9,t1+1); t2 <= min(-t1+12,8); t2++) { + s1(t2,t1+t2-8); + } + for(t2 = max(t1-3,-t1+13); t2 <= min(t1,8); t2++) { + s2(t2,t1-t2+1); + } +} + +>>> codegen 2 T1:old_IS,T2:old_IS; +for(t1 = 1; t1 <= 3; t1++) { + for(t2 = 1; t2 <= t1; t2++) { + s2(t2,t1-t2+1); + } + for(t2 = -t1+9; t2 <= 8; t2++) { + s1(t2,t1+t2-8); + } +} +for(t2 = 1; t2 <= 4; t2++) { + s2(t2,-t2+5); +} +for(t2 = 5; t2 <= 8; t2++) { + s1(t2,t2-4); +} +for(t2 = 2; t2 <= 3; t2++) { + s2(t2,-t2+6); +} +for(t2 = 4; t2 <= 5; t2++) { + s1(t2,t2-3); + s2(t2,-t2+6); +} +for(t2 = 6; t2 <= 7; t2++) { + s1(t2,t2-3); +} +for(t2 = 3; t2 <= 6; t2++) { + s1(t2,t2-2); + s2(t2,-t2+7); +} +for(t2 = 2; t2 <= 3; t2++) { + s1(t2,t2-1); +} +for(t2 = 4; t2 <= 5; t2++) { + s1(t2,t2-1); + s2(t2,-t2+8); +} +for(t2 = 6; t2 <= 7; t2++) { + s2(t2,-t2+8); +} +for(t2 = 1; t2 <= 4; t2++) { + s1(t2,t2); +} +for(t2 = 5; t2 <= 8; t2++) { + s2(t2,-t2+9); +} +for(t1 = 9; t1 <= 11; t1++) { + for(t2 = 1; t2 <= -t1+12; t2++) { + s1(t2,t1+t2-8); + } + for(t2 = t1-3; t2 <= 8; t2++) { + s2(t2,t1-t2+1); + } +} + + diff --git a/omegalib/examples/pufs b/omegalib/examples/pufs new file mode 100644 index 0000000..fa20bc8 --- /dev/null +++ b/omegalib/examples/pufs @@ -0,0 +1,20 @@ +# +# Examples of relations using uninterpreted function symbols +# from Omega Calculator documentation +# + +symbolic p(2), n, m; +R := { [ir,jr] : 1 <= ir <= n && 1 <= jr <= m }; +W1 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(Set) >= 0 }; +W2 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(Set) < 0 }; +Exposed := R intersection complement ( W1 union W2 ); +Exposed; + +symbolic f(1); +R1 := { [i] -> [j] : 1 <= i = j <= 100 && f(In) <= f(Out)}; +R2 := { [i] -> [j] : 1 <= i <= j <= 100 && f(In) = f(Out)}; + +R1 intersection R2; +R1 union R2; +R1 intersection complement R2; +R1; diff --git a/omegalib/examples/pufs.out b/omegalib/examples/pufs.out new file mode 100644 index 0000000..df65564 --- /dev/null +++ b/omegalib/examples/pufs.out @@ -0,0 +1,50 @@ +# Omega Calculator [v1.1, Nov 96]: +# # +# # Examples of relations using uninterpreted function symbols +# # from Omega Calculator documentation +# # +# +# symbolic p(2), n, m; +# +# R := { [ir,jr] : 1 <= ir <= n && 1 <= jr <= m }; +# +# W1 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(Set) >= 0 }; +# +# W2 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(Set) < 0 }; +# +# Exposed := R intersection complement ( W1 union W2 ); +# +# Exposed; + +{[In_1,In_2] : FALSE } + +# +# +# symbolic f(1); +# +# R1 := { [i] -> [j] : 1 <= i = j <= 100 && f(In) <= f(Out)}; +# +# R2 := { [i] -> [j] : 1 <= i <= j <= 100 && f(In) = f(Out)}; +# +# +# R1 intersection R2; + +{[i] -> [i] : 1 <= i <= 100} + +# +# R1 union R2; + +{[i] -> [j] : f(j) = f(i) && 1 <= i < j <= 100} union + {[i] -> [i] : 1 <= i <= 100} + +# +# R1 intersection complement R2; + +{[i] -> [j] : FALSE } + +# +# R1; + +{[i] -> [i] : 1 <= i <= 100} + +# diff --git a/omegalib/examples/substitution b/omegalib/examples/substitution new file mode 100644 index 0000000..9d841fe --- /dev/null +++ b/omegalib/examples/substitution @@ -0,0 +1,35 @@ +# +# Test various variable substitution scenarios +# + +symbolic n; + +# unimodular transformation +# +is := { [i,j] : 0 <=i<= 4 && 0 <= j<= 6 }; +t := { [i,j] -> [i2,j2] : i2 = i+j && j2 = i+2*j }; +codegen t:is; + +# non-unimodular transformation +# +is := { [i,j] : 0 <=i<= 4 && 0 <= j<= 6 }; +t := { [i,j] -> [i2,j2] : i2 = 2*i+j && j2 = i+2*j }; +codegen t:is; + +# second loop level is degenerated +# +is := {[i,j]:1 <= j <= 100 && j = i+4}; +t := {[i,j]->[a,b]: a = i && b = j}; +codegen t:is; + +# global variable case 1 +# +is := { [i] : 19+n = i }; +t:= { [i] -> [j]: j = i }; +codegen t:is; + +# global variable case 2 +# +is := {[i]: i-16 <= n < i && exists (alpha: i = n+1+3*alpha) }; +t := {[i] -> [i] : exists ( alpha : i = 1+n+18alpha)}; +codegen t:is; diff --git a/omegalib/examples/substitution.out b/omegalib/examples/substitution.out new file mode 100644 index 0000000..3a08405 --- /dev/null +++ b/omegalib/examples/substitution.out @@ -0,0 +1,60 @@ +>>> # +>>> # Test various variable substitution scenarios +>>> # +>>> +>>> symbolic n; +>>> +>>> # unimodular transformation +>>> # +>>> is := { [i,j] : 0 <=i<= 4 && 0 <= j<= 6 }; +>>> t := { [i,j] -> [i2,j2] : i2 = i+j && j2 = i+2*j }; +>>> codegen t:is; +for(t1 = 0; t1 <= 10; t1++) { + for(t2 = max(t1,2*t1-4); t2 <= min(t1+6,2*t1); t2++) { + s1(2*t1-t2,t2-t1); + } +} + +>>> +>>> +>>> # non-unimodular transformation +>>> # +>>> is := { [i,j] : 0 <=i<= 4 && 0 <= j<= 6 }; +>>> t := { [i,j] -> [i2,j2] : i2 = 2*i+j && j2 = i+2*j }; +>>> codegen t:is; +for(t1 = 0; t1 <= 14; t1++) { + for(t2 = max(3*intDiv(intDiv(t1+1,2)--t1+2,3)+-t1,2*t1-12); t2 <= min(intDiv(t1+18,2),2*t1); t2 += 3) { + s1(intDiv(2*t1-t2,3),intDiv(2*t2-t1,3)); + } +} + +>>> +>>> +>>> # second loop level is degenerated +>>> # +>>> is := {[i,j]:1 <= j <= 100 && j = i+4}; +>>> t := {[i,j]->[a,b]: a = i && b = j}; +>>> codegen t:is; +for(t1 = -3; t1 <= 96; t1++) { + s1(t1,t1+4); +} + +>>> +>>> +>>> # global variable case 1 +>>> # +>>> is := { [i] : 19+n = i }; +>>> t:= { [i] -> [j]: j = i }; +>>> codegen t:is; +s1(n+19); + +>>> +>>> +>>> # global variable case 2 +>>> # +>>> is := {[i]: i-16 <= n < i && exists (alpha: i = n+1+3*alpha) }; +>>> t := {[i] -> [i] : Exists ( alpha : i = 1+n+18alpha)}; +>>> codegen t:is; +s1(n+1); + + diff --git a/omegalib/examples/syr2k b/omegalib/examples/syr2k new file mode 100644 index 0000000..29cdf4e --- /dev/null +++ b/omegalib/examples/syr2k @@ -0,0 +1,17 @@ +# This example of code generation comes from +# "Access Normalization: Loop Restructuring for NUMA Compilers" +# by Wei Li and Keshav Pingali +# Cornell Tech. report TR 92-1278 + +symbolic n,b; + +IS10 := {[i,j,k] : 1 <= i <= j <= n && j <= i+2b-2 + && i-b+1,j-b+1,1 <= k <= i+b-1,j+b-1,n}; +T10 := {[i,j,k] -> [j-i+1,k-j,k]}; + +known := {[*,*,*] : 1 <= b <= n}; + +codegen T10:IS10; +codegen T10:IS10 given known; +codegen T10:IS10; +codegen T10:IS10 given known; diff --git a/omegalib/examples/syr2k.out b/omegalib/examples/syr2k.out new file mode 100644 index 0000000..345ad04 --- /dev/null +++ b/omegalib/examples/syr2k.out @@ -0,0 +1,69 @@ +>>> # This example of code generation comes from +>>> # "Access Normalization: Loop Restructuring for NUMA Compilers" +>>> # by Wei Li and Keshav Pingali +>>> # Cornell Tech. report TR 92-1278 +>>> Symbolic n,b; +>>> +>>> IS10 := {[i,j,k] : 1 <= i <= j <= n && j <= i+2b-2 +>>> && i-b+1,j-b+1,1 <= k <= i+b-1,j+b-1,n}; +>>> T10 :={[i,j,k] -> [j-i+1,k-j,k]}; +>>> +>>> known := {[*,*,*] : 1 <= b <= n}; +>>> +>>> codegen T10:IS10; +for(t1 = 1; t1 <= min(2*b-1,n); t1++) { + for(t2 = max(-b+1,-n+1); t2 <= min(b-t1,n-t1); t2++) { + for(t3 = max(t1+t2,1); t3 <= min(t2+n,n); t3++) { + s1(t3-t1-t2+1,t3-t2,t3); + } + } +} + +>>> codegen T10:IS10 given known; +for(t1 = 1; t1 <= min(n,2*b-1); t1++) { + for(t2 = -b+1; t2 <= b-t1; t2++) { + for(t3 = max(t1+t2,1); t3 <= min(n,n+t2); t3++) { + s1(t3-t1-t2+1,t3-t2,t3); + } + } +} + +>>> codegen 2 T10:IS10; +for(t1 = 1; t1 <= min(2*b-1,n); t1++) { + for(t2 = max(-b+1,-n+1); t2 <= -t1; t2++) { + for(t3 = 1; t3 <= t2+n; t3++) { + s1(t3-t1-t2+1,t3-t2,t3); + } + } + for(t2 = max(-t1+1,-b+1); t2 <= min(-t1+b,-1); t2++) { + for(t3 = t1+t2; t3 <= t2+n; t3++) { + s1(t3-t1-t2+1,t3-t2,t3); + } + } + for(t2 = 0; t2 <= min(-t1+n,-t1+b); t2++) { + for(t3 = t1+t2; t3 <= n; t3++) { + s1(t3-t1-t2+1,t3-t2,t3); + } + } +} + +>>> codegen 2 T10:IS10 given known; +for(t1 = 1; t1 <= min(n,2*b-1); t1++) { + for(t2 = -b+1; t2 <= -t1; t2++) { + for(t3 = 1; t3 <= t2+n; t3++) { + s1(t3-t1-t2+1,t3-t2,t3); + } + } + for(t2 = max(-t1+1,-b+1); t2 <= min(b-t1,0); t2++) { + for(t3 = t2+t1; t3 <= t2+n; t3++) { + s1(t3-t1-t2+1,t3-t2,t3); + } + } + for(t2 = 1; t2 <= b-t1; t2++) { + for(t3 = t1+t2; t3 <= n; t3++) { + s1(t3-t1-t2+1,t3-t2,t3); + } + } +} + + diff --git a/omegalib/examples/union b/omegalib/examples/union new file mode 100644 index 0000000..d03fcba --- /dev/null +++ b/omegalib/examples/union @@ -0,0 +1,64 @@ +# test ConvexRepresentation + +symbolic n; + +# +# result is convex, same behavior as PairwiseCheck +# +r1:={[i,j]: 0<=i,j<=100}; +r2:={[i,j]: i>=100 && j>=0 && i+j<=200}; +r3:={[i,j]: i>=0 && j>=100 && i+j<=200}; +PairwiseCheck (r1 union r2 union r3); +ConvexRepresentation (r1 union r2 union r3); + +r1:={[i]: 1<=i<=n && exists (alpha: i=2alpha)}; +r2:={[i]: 1<=i<=n && exists (alpha: i=2alpha+1)}; +PairwiseCheck (r1 union r2); +ConvexRepresentation (r1 union r2); + +# +# test neighboring regions merge +# +r1:={[i]: 1<=i<=9 && exists (alpha: i=2alpha+1)}; +r2:={[i]: 9<=i<=99 && exists (alpha: i=2alpha+1)}; +PairwiseCheck (r1 union r2); +ConvexRepresentation (r1 union r2); + +r1:={[i,j]:1<=i,j<=100}; +r2:={[i,j]:50<=i<=100 && 100<=j<=200}; +r3:={[i,j]:1<=i<=50 && 100<=j<=200}; +r4:={[i,j]: 1000<=i,j<=2000}; +PairwiseCheck (r1 union r2 union r3 union r4); +ConvexRepresentation (r1 union r2 union r3 union r4); + +# +# test stride condition merge, filling up holes +# +r1:={[i]:1<=i<=100 && exists (alpha: 1+7alpha<=i<=3+7alpha)}; +r2:={[i]:1<=i<=100 && exists (alpha: i=4+7alpha)}; +r3:={[i]:1<=i<=100 && exists (alpha: i=5+7alpha)}; +r4:={[i]:1<=i<=100 && exists (alpha: 6+7alpha<=i<=9+7alpha)}; +PairwiseCheck (r1 union r2 union r3); +ConvexRepresentation (r1 union r2 union r3); + +PairwiseCheck (r1 union r2 union r4); +ConvexRepresentation (r1 union r2 union r4); + +r1:={[i]:6<=i<=96 && exists (alpha: i=6alpha)}; +r2:={[i]:3<=i<=93 && exists (alpha: i=3+6alpha)}; +PairwiseCheck (r1 union r2); +ConvexRepresentation (r1 union r2); + +r1:={[i]:1<=i<=100 && exists (alpha: 1+15alpha<=i<=4+15alpha)}; +r2:={[i]:1<=i<=100 && exists (alpha: 6+15alpha<=i<=8+15alpha)}; +r3:={[i]:1<=i<=100 && exists (alpha: 11+15alpha<=i<=13+15alpha)}; +PairwiseCheck (r1 union r2 union r3); +ConvexRepresentation (r1 union r2 union r3); + +# +# additional test cases +# +r1:={[i]:0<=i<=100}; +r2:={[i]: 10<=i<=100 && exists (alpha: i=1+5alpha)}; +PairwiseCheck (r1 union r2); +ConvexRepresentation (r1 union r2); diff --git a/omegalib/examples/union.out b/omegalib/examples/union.out new file mode 100644 index 0000000..bf42f02 --- /dev/null +++ b/omegalib/examples/union.out @@ -0,0 +1,96 @@ +>>> # test ConvexRepresentation +>>> +>>> symbolic n; +>>> +>>> # +>>> # result is convex, same behavior as PairwiseCheck +>>> # +>>> r1:={[i,j]: 0<=i,j<=100}; +>>> r2:={[i,j]: i>=100 && j>=0 && i+j<=200}; +>>> r3:={[i,j]: i>=0 && j>=100 && i+j<=200}; +>>> PairwiseCheck (r1 union r2 union r3); +{[i,j]: 0 <= i <= -j+200 && 0 <= j} +>>> ConvexRepresentation (r1 union r2 union r3); +{[i,j]: 0 <= i <= -j+200 && 0 <= j} +>>> +>>> r1:={[i]: 1<=i<=n && exists (alpha: i=2alpha)}; +>>> r2:={[i]: 1<=i<=n && exists (alpha: i=2alpha+1)}; +>>> PairwiseCheck (r1 union r2); +{[i]: 1 <= i <= n} +>>> ConvexRepresentation (r1 union r2); +{[i]: 1 <= i <= n} +>>> +>>> # +>>> # test neighboring regions merge +>>> # +>>> r1:={[i]: 1<=i<=9 && exists (alpha: i=2alpha+1)}; +>>> r2:={[i]: 9<=i<=99 && exists (alpha: i=2alpha+1)}; +>>> PairwiseCheck (r1 union r2); +{[i]: Exists ( alpha : 2alpha = 1+i && 1 <= i <= 9)} union + {[i]: Exists ( alpha : 2alpha = 1+i && 9 <= i <= 99)} +>>> ConvexRepresentation (r1 union r2); +{[i]: Exists ( alpha : 2alpha = 1+i && 1 <= i <= 99)} +>>> +>>> r1:={[i,j]:1<=i,j<=100}; +>>> r2:={[i,j]:50<=i<=100 && 100<=j<=200}; +>>> r3:={[i,j]:1<=i<=50 && 100<=j<=200}; +>>> r4:={[i,j]: 1000<=i,j<=2000}; +>>> PairwiseCheck (r1 union r2 union r3 union r4); +{[i,j]: 1 <= i <= 100 && 1 <= j <= 100} union + {[i,j]: 50 <= i <= 100 && 100 <= j <= 200} union + {[i,j]: 1 <= i <= 50 && 100 <= j <= 200} union + {[i,j]: 1000 <= i <= 2000 && 1000 <= j <= 2000} +>>> ConvexRepresentation (r1 union r2 union r3 union r4); +{[i,j]: 1 <= i <= 100 && 1 <= j <= 200} union + {[i,j]: 1000 <= i <= 2000 && 1000 <= j <= 2000} +>>> +>>> # +>>> # test stride condition merge, filling up holes +>>> # +>>> r1:={[i]:1<=i<=100 && exists (alpha: 1+7alpha<=i<=3+7alpha)}; +>>> r2:={[i]:1<=i<=100 && exists (alpha: i=4+7alpha)}; +>>> r3:={[i]:1<=i<=100 && exists (alpha: i=5+7alpha)}; +>>> r4:={[i]:1<=i<=100 && exists (alpha: 6+7alpha<=i<=9+7alpha)}; +>>> PairwiseCheck (r1 union r2 union r3); +{[i]: Exists ( alpha : 1, 7alpha+1 <= i <= 100, 7alpha+3)} union + {[i]: Exists ( alpha : 3+i = 7alpha && 4 <= i <= 95)} union + {[i]: Exists ( alpha : 2+i = 7alpha && 5 <= i <= 96)} +>>> ConvexRepresentation (r1 union r2 union r3); +{[i]: Exists ( alpha : 1, 7alpha+1 <= i <= 100, 7alpha+5)} +>>> +>>> PairwiseCheck (r1 union r2 union r4); +{[i]: Exists ( alpha : 1, 7alpha+1 <= i <= 100, 7alpha+3)} union + {[i]: Exists ( alpha : 3+i = 7alpha && 4 <= i <= 95)} union + {[i]: Exists ( alpha : 1, 7alpha+6 <= i <= 100, 7alpha+9)} +>>> ConvexRepresentation (r1 union r2 union r4); +{[i]: Exists ( alpha : 1, 7alpha+6 <= i <= 100, 7alpha+11)} +>>> +>>> r1:={[i]:6<=i<=96 && exists (alpha: i=6alpha)}; +>>> r2:={[i]:3<=i<=93 && exists (alpha: i=3+6alpha)}; +>>> PairwiseCheck (r1 union r2); +{[i]: Exists ( alpha : i = 6alpha && 6 <= i <= 96)} union + {[i]: Exists ( alpha : i = 3+6alpha && 3 <= i <= 93)} +>>> ConvexRepresentation (r1 union r2); +{[i]: Exists ( alpha : i = 3alpha && 3 <= i <= 96)} +>>> +>>> r1:={[i]:1<=i<=100 && exists (alpha: 1+15alpha<=i<=4+15alpha)}; +>>> r2:={[i]:1<=i<=100 && exists (alpha: 6+15alpha<=i<=8+15alpha)}; +>>> r3:={[i]:1<=i<=100 && exists (alpha: 11+15alpha<=i<=13+15alpha)}; +>>> PairwiseCheck (r1 union r2 union r3); +{[i]: Exists ( alpha : 1, 15alpha+1 <= i <= 100, 15alpha+4)} union + {[i]: Exists ( alpha : 1, 15alpha+6 <= i <= 100, 15alpha+8)} union + {[i]: Exists ( alpha : 1, 15alpha+11 <= i <= 100, 15alpha+13)} +>>> ConvexRepresentation (r1 union r2 union r3); +{[i]: Exists ( alpha : i = 4+15alpha && 4 <= i <= 94)} union + {[i]: Exists ( alpha : 1, 5alpha+1 <= i <= 100, 5alpha+3)} +>>> +>>> # +>>> # additional test cases +>>> # +>>> r1:={[i]:0<=i<=100}; +>>> r2:={[i]: 10<=i<=100 && exists (alpha: i=1+5alpha)}; +>>> PairwiseCheck (r1 union r2); +{[i]: 0 <= i <= 100} +>>> ConvexRepresentation (r1 union r2); +{[i]: 0 <= i <= 100} +>>> diff --git a/omegalib/include/basic b/omegalib/include/basic new file mode 120000 index 0000000..5f3270d --- /dev/null +++ b/omegalib/include/basic @@ -0,0 +1 @@ +../basic/include/basic \ No newline at end of file diff --git a/omegalib/include/code_gen b/omegalib/include/code_gen new file mode 120000 index 0000000..c46afac --- /dev/null +++ b/omegalib/include/code_gen @@ -0,0 +1 @@ +../code_gen/include/code_gen/ \ No newline at end of file diff --git a/omegalib/include/codegen.h b/omegalib/include/codegen.h new file mode 120000 index 0000000..7ea5d1d --- /dev/null +++ b/omegalib/include/codegen.h @@ -0,0 +1 @@ +code_gen/codegen.h \ No newline at end of file diff --git a/omegalib/include/config.h b/omegalib/include/config.h new file mode 100644 index 0000000..7ba9c03 --- /dev/null +++ b/omegalib/include/config.h @@ -0,0 +1,36 @@ +/* include/config.h. Generated from config.h.in by configure. */ +/* include/config.h.in. Generated from configure.ac by autoheader. */ + +/* Use Rose */ +#define BUILD_ROSE /**/ + +/* Omega version */ +#define OMEGA_VERSION "0.1.0" + +/* Name of package */ +#define PACKAGE "omega" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "omega" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "omega 0.1.0" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "omega" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "0.1.0" + +/* Version number of package */ +#define VERSION "0.1.0" + +/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a + `char[]'. */ +#define YYTEXT_POINTER 1 diff --git a/omegalib/include/config.h.in b/omegalib/include/config.h.in new file mode 100644 index 0000000..fbabcd4 --- /dev/null +++ b/omegalib/include/config.h.in @@ -0,0 +1,35 @@ +/* include/config.h.in. Generated from configure.ac by autoheader. */ + +/* Use Rose */ +#undef BUILD_ROSE + +/* Omega version */ +#undef OMEGA_VERSION + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Version number of package */ +#undef VERSION + +/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a + `char[]'. */ +#undef YYTEXT_POINTER diff --git a/omegalib/include/omega b/omegalib/include/omega new file mode 120000 index 0000000..8f80c19 --- /dev/null +++ b/omegalib/include/omega @@ -0,0 +1 @@ +../omega_lib/include/omega \ No newline at end of file diff --git a/omegalib/include/omega.h b/omegalib/include/omega.h new file mode 120000 index 0000000..8be0f76 --- /dev/null +++ b/omegalib/include/omega.h @@ -0,0 +1 @@ +../omega_lib/include/omega.h \ No newline at end of file diff --git a/omegalib/include/stamp-h1 b/omegalib/include/stamp-h1 new file mode 100644 index 0000000..b330768 --- /dev/null +++ b/omegalib/include/stamp-h1 @@ -0,0 +1 @@ +timestamp for include/config.h diff --git a/omegalib/omega_calc/CMakeLists.txt b/omegalib/omega_calc/CMakeLists.txt new file mode 100644 index 0000000..67f25b8 --- /dev/null +++ b/omegalib/omega_calc/CMakeLists.txt @@ -0,0 +1,29 @@ +find_package(BISON) +find_package(FLEX) + +FLEX_TARGET(OCScanner src/parser.ll ${CMAKE_CURRENT_BINARY_DIR}/lex.yy.cc COMPILE_FLAGS "-+") +BISON_TARGET(OCParser src/parser.yy ${CMAKE_CURRENT_BINARY_DIR}/parser.tab.cc COMPILE_FLAGS "-t -d") +ADD_FLEX_BISON_DEPENDENCY(OCScanner OCParser) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + include + ${OMEGAROOT}/omega_lib/include + ${OMEGAROOT}/code_gen/include + ${OMEGAROOT}/basic/include + ) + +string(TIMESTAMP build_date "\\\"%m/%d/%Y\\\"") + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBUILD_CODEGEN -DOMEGA_BUILD_DATE=\"${build_date}\"") + +add_executable(omega_calc + EXCLUDE_FROM_ALL + src/AST.cc + src/myflex.cc + ${FLEX_OCScanner_OUTPUTS} + ${BISON_OCParser_OUTPUTS} + ) + +add_dependencies(omega_calc omega codegen) +target_link_libraries(omega_calc omega codegen) diff --git a/omegalib/omega_calc/doc/calculator.pdf b/omegalib/omega_calc/doc/calculator.pdf new file mode 100644 index 0000000..5c307ab Binary files /dev/null and b/omegalib/omega_calc/doc/calculator.pdf differ diff --git a/omegalib/omega_calc/include/omega_calc/AST.h b/omegalib/omega_calc/include/omega_calc/AST.h new file mode 100644 index 0000000..58d74fb --- /dev/null +++ b/omegalib/omega_calc/include/omega_calc/AST.h @@ -0,0 +1,310 @@ +#ifndef _AST_H +#define _AST_H + +#include +#include +#include +#include + +typedef enum {eq, lt, gt, geq, leq, neq} Rel_Op; + +class tupleDescriptor; + +class Variable_Ref { +public: + int anonymous; + omega::Const_String name; + omega::Const_String stripped_name; + omega::Variable_ID vid; + omega::Variable_ID id(omega::Rel_Body *R) { + if (vid) return vid; + if (arity == 0) + vid = R->get_local(g); + else + vid = R->get_local(g,of); + return vid; + } + omega::Variable_ID id(omega::Relation &R) { + if (vid) return vid; + if (arity == 0) + vid = R.get_local(g); + else + vid = R.get_local(g,of); + return vid; + } + omega::Free_Var_Decl *g; + int arity; + int pos; + omega::Argument_Tuple of; + Variable_Ref(char *s, int _arity, omega::Argument_Tuple _of); + Variable_Ref(char *s); + Variable_Ref(); + ~Variable_Ref(); +}; + +extern std::map functionOfInput; +extern std::map functionOfOutput; + +class Declaration_Site { +public: + Declaration_Site(); + Declaration_Site(std::set *v); + virtual Variable_Ref *extend(char *s); + virtual Variable_Ref *extend(char *s, omega::Argument_Tuple, int); + virtual ~Declaration_Site(); + + Variable_Ref *extend(); + void print() { + for (std::set::iterator i = declarations.begin(); ;) { + printf("%s", static_cast((*i)->name)); + i++; + if (i != declarations.end()) + printf(","); + else + break; + } + } + + Declaration_Site *previous; + std::set declarations; +}; + +class Global_Declaration_Site: public Declaration_Site { +public: + virtual Variable_Ref *extend(char *s); + virtual Variable_Ref *extend() { + return Declaration_Site::extend(); + } + virtual Variable_Ref *extend(char *s, omega::Argument_Tuple in_of, int in_arity) { + return Declaration_Site::extend(s,in_of,in_arity); + } + void extend_both_tuples(char *s, int arity); + virtual ~Global_Declaration_Site(); +}; + +extern Declaration_Site *current_Declaration_Site; + +inline void popScope() { + assert(current_Declaration_Site); + current_Declaration_Site = current_Declaration_Site->previous; +} + +Variable_Ref *lookupScalar(char *s); +Declaration_Site * defined (char *); + +class Exp { +public: + Exp(omega::coef_t c); + Exp(Variable_Ref *v); + friend Exp *multiply (omega::coef_t c, Exp *x); + friend Exp *multiply (Exp *x, Exp *y); + friend Exp *negate (Exp *x); + friend Exp *add (Exp *x, Exp *y); + friend Exp *subtract (Exp *x, Exp *y); + std::map coefs; + omega::coef_t constantTerm; +protected: + void addTerm(omega::coef_t coef, omega::Variable_ID v); +}; + + +typedef struct { + Exp *e; + int step; +} strideConstraint; + + +class AST; +class AST_constraints; + + +class Tuple_Part { +public: + Variable_Ref *from,*to; + Tuple_Part(Variable_Ref *f, Variable_Ref *t) + { from = f; to = t; } + Tuple_Part(Variable_Ref *f) + { from = f; to = 0; } + Tuple_Part() + { from = 0; to = 0; } +}; + + +class AST { +public: + virtual void install(omega::Formula *F) = 0; + virtual void print() = 0; + virtual ~AST() {} +}; + + +class AST_And: public AST { +public: + AST_And(AST *l, AST *r) { left = l; right = r; } + ~AST_And() { delete left; delete right; } + + virtual void install(omega::Formula *F); + + virtual void print() { + printf("("); + left->print(); + printf(" && "); + right->print(); + printf(")"); + } + + AST *left,*right; +}; + + +class AST_Or: public AST { +public: + AST_Or(AST *l, AST *r) { left = l; right = r; } + ~AST_Or() { delete left; delete right; } + + virtual void install(omega::Formula *F); + + virtual void print() { + printf("("); + left->print(); + printf(" || "); + right->print(); + printf(")"); + } + + + AST *left, *right; +}; + + +class AST_Not: public AST { +public: + AST_Not(AST *c) { child = c; } + ~AST_Not() { delete child; } + + virtual void install(omega::Formula *F); + + virtual void print() { + printf("(!"); + child->print(); + printf(")"); + } + + AST *child; +}; + + +class AST_declare: public AST { +public: + virtual void install(omega::Formula *F) = 0; + + virtual void print() { + printf("("); + declaredVariables->print(); + printf(" : "); + child->print(); + printf(")"); + } + + Declaration_Site *declaredVariables; + AST *child; +}; + + +class AST_exists: public AST_declare { +public: + AST_exists(Declaration_Site *dV, AST *c) {declaredVariables = dV, child = c;} + ~AST_exists() { delete child; delete declaredVariables; } + + virtual void install(omega::Formula *F); + + virtual void print() { + printf("exists "); + AST_declare::print(); + } +}; + + +class AST_forall: public AST_declare { +public: + AST_forall(Declaration_Site *dV, AST *c) {declaredVariables = dV, child = c; } + ~AST_forall() { delete child; delete declaredVariables; } + + virtual void install(omega::Formula *F); + + virtual void print() { + printf("forall "); + AST_declare::print(); + } +}; + + + +class AST_constraints: public AST { +public: + AST_constraints(std::set *f, Rel_Op r, AST_constraints *o); + AST_constraints(std::set *f, Rel_Op r, std::set *s); + AST_constraints(std::set *f); + ~AST_constraints(); + + virtual void install(omega::Formula *F); + + virtual void print(); + + AST_constraints *others; + std::set *first; + Rel_Op rel_op; +}; + +void install_stride(omega::F_And *F, strideConstraint *c); +void install_eq(omega::F_And *F, Exp *e1, Exp *e2); +void install_geq(omega::F_And *F, Exp *e1, Exp *e2); +void install_gt(omega::F_And *F, Exp *e1, Exp *e2); +void install_neq(omega::F_And *F, Exp *e1, Exp *e2); + + + +class tupleDescriptor { +public: + tupleDescriptor() { size = 0; } + void extend(); + void extend(Exp * e); + void extend(Exp * lb, Exp *ub); + void extend(Exp * lb, Exp *ub, omega::coef_t stride); + void extend(char * s, Exp *e); + void extend(char * s); + void extend(char * s, omega::Argument_Tuple, int); + + int size; + std::vector vars; + std::set eq_constraints; + std::set geq_constraints; + std::set stride_constraints; + ~tupleDescriptor() { + for (std::set::iterator i = eq_constraints.begin(); i != eq_constraints.end(); i++) + delete *i; + for (std::set::iterator i = geq_constraints.begin(); i != geq_constraints.end(); i++) + delete *i; + for (std::set::iterator i = stride_constraints.begin(); i != stride_constraints.end(); i++) { + delete (*i)->e; + delete *i; + } + } +}; + +extern Global_Declaration_Site *globalDecls; +extern Declaration_Site *relationDecl; +extern tupleDescriptor *currentTupleDescriptor; + +void resetGlobals(); + + +// Used to parse a list of paired relations for code generation commands +// class RelTuplePair { +// public: +// RelTuplePair() : ispaces(0), mappings(0) {} +// omega::Tuple ispaces; +// omega::Tuple mappings; +// }; + +#endif diff --git a/omegalib/omega_calc/include/omega_calc/PT-omega.c b/omegalib/omega_calc/include/omega_calc/PT-omega.c new file mode 100644 index 0000000..ad6b979 --- /dev/null +++ b/omegalib/omega_calc/include/omega_calc/PT-omega.c @@ -0,0 +1,81 @@ +#undef DONT_INCLUDE_TEMPLATE_CODE + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template int max(int, int); +template int min(int, int); +template unsigned int min(unsigned int, unsigned int); +template void set_max(int&,int); +template void set_min(int&,int); +template void swap(int&,int&); +template void swap(short&,short&); +template void swap(signed char&,signed char&); +template Relation copy(const Relation &); + +instantiate_Set(int); +instantiate_Set(Global_Var_ID); +instantiate_Set(Variable_ID); + +instantiate_List(int); +instantiate_List(exit_func); +instantiate_List(Formula *); +instantiate_List(Conjunct *); +instantiate_List(DNF *); +instantiate_List(Relation *); +instantiate_Simple_List(Relation); + +typedef Tuple RelationTuple; +instantiate_Tuple(bool); +instantiate_Tuple(int); +instantiate_Tuple(coef_t); +instantiate_Tuple(char *); +instantiate_Tuple(Const_String); +instantiate_Tuple(Conjunct *); +instantiate_Tuple(Relation); +instantiate_Tuple(RelationTuple); +instantiate_Tuple(Variable_ID); +instantiate_Tuple(Free_Var_Decl *); +instantiate_Tuple(std::string); +instantiate_Tuple(GEQ_Handle); + +instantiate_Section(Variable_ID); + +instantiate_Generator(Variable_Info); +instantiate_Generator(GEQ_Handle); +instantiate_Generator(EQ_Handle); +instantiate_Generator(Constraint_Handle); +instantiate_Generator(Sub_Handle); + +instantiate_Map(Variable_ID,int); +instantiate_Map(Global_Var_ID, Variable_ID); +instantiate_Map(GEQ_Handle,Variable_ID); +instantiate_Map(EQ_Handle,Variable_ID); +instantiate_Map(Variable_ID,Set); +instantiate_Map(Const_String, Relation *); + +instantiate_Dynamic_Array1(Coef_Var_Decl *); +instantiate_Dynamic_Array1(Relation); +instantiate_Dynamic_Array2(Relation); + + +/* Stuff required by calculator: */ +instantiate_Bag(Exp *); +instantiate_Bag(strideConstraint *); +instantiate_Bag(Variable_Ref *); +instantiate_Bag(char *); +instantiate_Map(Variable_Ref *, int); +instantiate_Map(Variable_Ref *, Variable_Ref *); +instantiate_Map(Const_String, Variable_Ref *); +instantiate_Set(Free_Var_Decl *); +instantiate_Tuple(Variable_Ref *); diff --git a/omegalib/omega_calc/include/omega_calc/myflex.h b/omegalib/omega_calc/include/omega_calc/myflex.h new file mode 100755 index 0000000..d472e51 --- /dev/null +++ b/omegalib/omega_calc/include/omega_calc/myflex.h @@ -0,0 +1,27 @@ +#ifndef _MYFLEX_H +#define _MYFLEX_H + +#ifndef yyFlexLexerOnce +#include +#endif +#include +#include +#include + +class myFlexLexer: public yyFlexLexer { +protected: + std::string cur_line; + int cur_pos; + std::vector history; + int first_history_pos; + int last_history_pos; + std::vector key_seqs; + +public: + myFlexLexer(std::istream *arg_yyin = NULL, std::ostream *arg_yyout = NULL); + ~myFlexLexer() {} +protected: + int LexerInput(char *buf, int max_size); +}; + +#endif diff --git a/omegalib/omega_calc/src/AST.cc b/omegalib/omega_calc/src/AST.cc new file mode 100644 index 0000000..1f885a6 --- /dev/null +++ b/omegalib/omega_calc/src/AST.cc @@ -0,0 +1,467 @@ +/***************************************************************************** + Copyright (C) 1994-2000 the Omega Project Team + Copyright (C) 2009-2011 Chun Chen + All Rights Reserved. + + Purpose: + build relation from parsed input. + + Notes: + + History: +*****************************************************************************/ + +#include +#include + +using namespace omega; + +Global_Declaration_Site *globalDecls; +Declaration_Site *relationDecl = NULL; +tupleDescriptor *currentTupleDescriptor; +std::map functionOfInput; +std::map functionOfOutput; + +AST_constraints::AST_constraints(std::set *f, Rel_Op r, AST_constraints *o) { + others = o; + rel_op = r; + first = f; +} + +AST_constraints::AST_constraints(std::set *f, Rel_Op r, std::set *s) { + others = new AST_constraints(s); + rel_op = r; + first = f; +} + +AST_constraints::AST_constraints(std::set *f){ + others = 0; + first = f; +} + +AST_constraints::~AST_constraints() { + for (std::set::iterator i = first->begin(); i != first->end(); i++) + delete *i; + delete first; + delete others; +} + +void AST_constraints::print() { + for (std::set::iterator i = first->begin(); ;) { + printf(coef_fmt, (*i)->constantTerm); + for (std::map::iterator j = (*i)->coefs.begin(); j != (*i)->coefs.end(); j++) + printf("+"coef_fmt"%s", (*j).second, static_cast((*j).first->name)); + i++; + if (i != first->end()) + printf(", "); + else + break; + } +} + + +Exp::Exp(coef_t c) : coefs() { + constantTerm = c; +} + +Exp::Exp(Variable_Ref *v) : coefs() { + assert(v != 0); + constantTerm = 0; + coefs[v] = 1; +} + +Exp *negate (Exp *x) { + x->constantTerm = -x->constantTerm; + for (std::map::iterator i = x->coefs.begin(); i != x->coefs.end(); i++) + (*i).second = -(*i).second; + return x; +} + +Exp *add (Exp *x, Exp *y) { + x->constantTerm += y->constantTerm; + for (std::map::iterator i = y->coefs.begin(); i != y->coefs.end(); i++) + x->coefs[(*i).first] += (*i).second; + delete y; + return x; +} + +Exp *subtract (Exp *x, Exp *y) { + x->constantTerm -= y->constantTerm; + for (std::map::iterator i = y->coefs.begin(); i != y->coefs.end(); i++) + x->coefs[(*i).first] -= (*i).second; + delete y; + return x; +} + +Exp *multiply (coef_t c, Exp *x) { + x->constantTerm *= c; + for (std::map::iterator i = x->coefs.begin(); i != x->coefs.end(); i++) + (*i).second *= c; + return x; +} + +Exp *multiply (Exp *x, Exp *y) { + bool found_nonzero = false; + for (std::map::iterator i = x->coefs.begin(); i != x->coefs.end(); i++) + if ((*i).second != 0) + found_nonzero = true; + if (!found_nonzero) { + coef_t c = x->constantTerm; + delete x; + return multiply(c,y); + } + + found_nonzero = false; + for (std::map::iterator i = y->coefs.begin(); i != y->coefs.end(); i++) + if ((*i).second != 0) + found_nonzero = true; + if (!found_nonzero) { + coef_t c = y->constantTerm; + delete y; + return multiply(c,x); + } + + delete x; + delete y; + throw std::runtime_error("invalid exp multiply"); +} + + + +Declaration_Site *current_Declaration_Site = 0; + +Declaration_Site::Declaration_Site() { + previous = current_Declaration_Site; + current_Declaration_Site = this; +} + +Declaration_Site::Declaration_Site(std::set *v) { + previous = current_Declaration_Site; + current_Declaration_Site = this; + for (std::set::iterator i = v->begin(); i != v->end(); i++) + declarations.insert(new Variable_Ref(*i)); +} + +Declaration_Site::~Declaration_Site() { + for (std::set::iterator i = declarations.begin(); i != declarations.end(); i++) + delete *i; +} + +Variable_Ref::Variable_Ref(char *s, int _arity, Argument_Tuple _of) { + name = s; + arity = _arity; + of = _of; + anonymous = !strncmp("In_",s,3) || !strncmp("Out_",s,4); + char *t = s; + while (*t != '\0') t++; + t--; + while (*t == '\'') t--; + t++; + *t = '\0'; + stripped_name = s; + g = 0; +} + +Variable_Ref::Variable_Ref(char *s) { + name = s; + arity = 0; + anonymous = !strncmp("In_",s,3) || !strncmp("Out_",s,4); + char *t = s; + while (*t != '\0') t++; + t--; + while (*t == '\'') t--; + t++; + *t = '\0'; + stripped_name = s; + g = 0; +} + +Variable_Ref::Variable_Ref() { + name = "#anonymous"; + arity = 0; + anonymous = 1; + stripped_name = name; + g = 0; +} + +Variable_Ref::~Variable_Ref() { + assert(g == 0); +} + +Variable_Ref *lookupScalar(char *s) { + Declaration_Site *ds; + for(ds = current_Declaration_Site; ds; ds = ds->previous) + for (std::set::iterator i = ds->declarations.begin(); i != ds->declarations.end(); i++) + if ((*i)->name == static_cast(s)) + return (*i); + return NULL; +} + +Declaration_Site *defined(char *s) { + Declaration_Site *ds; + for(ds = current_Declaration_Site; ds; ds = ds->previous) + for (std::set::iterator i = ds->declarations.begin(); i != ds->declarations.end(); i++) + if ((*i)->name == static_cast(s)) + return ds; + return NULL; +} + + +void AST_Or::install(Formula *F) { + if (F->node_type() != Op_Or) + F = F->add_or(); + left->install(F); + right->install(F); +} + +void AST_And::install(Formula *F) { + if (F->node_type() != Op_And) F = F->add_and(); + left->install(F); + right->install(F); +} + +void AST_Not::install(Formula *F) { + child->install(F->add_not()); +} + +void AST_exists::install(Formula *F) { + F_Exists *G = F->add_exists(); + for (std::set::iterator i = declaredVariables->declarations.begin(); i != declaredVariables->declarations.end(); i++) + (*i)->vid = G->declare((*i)->stripped_name); + child->install(G); +} + +void AST_forall::install(Formula *F) { + F_Forall *G = F->add_forall(); + for (std::set::iterator i = declaredVariables->declarations.begin(); i != declaredVariables->declarations.end(); i++) + (*i)->vid = G->declare((*i)->stripped_name); + child->install(G); +} + +void AST_constraints::install(Formula *F) { + if (!others) return; + F_And *f = F->and_with(); + + for (std::set::iterator i = first->begin(); i != first->end(); i++) + for (std::set::iterator j = others->first->begin(); j != others->first->end(); j++) + switch (rel_op) { + case(lt) : install_gt(f, *j, *i); break; + case(gt) : install_gt(f, *i, *j); break; + case(leq) : install_geq(f, *j, *i); break; + case(geq) : install_geq(f, *i, *j); break; + case(eq) : install_eq(f, *i, *j); break; + case(neq) : install_neq(f, *i, *j); break; + default : assert(0); + } + others->install(f); +} + + +void install_neq(F_And *F, Exp *e1, Exp *e2) { + F_Or *or_ = F->add_or(); + F_And *and1 = or_->add_and(); + F_And *and2 = or_->add_and(); + install_gt(and1,e1,e2); + install_gt(and2,e2,e1); +}; + +void install_stride(F_And *F, strideConstraint *s) { + Stride_Handle c = F->add_stride(s->step); + c.update_const(s->e->constantTerm); + for (std::map::iterator i = s->e->coefs.begin(); i != s->e->coefs.end(); i++) + c.update_coef((*i).first->id(F->relation()), (*i).second); + c.finalize(); +} + +void install_eq(F_And *F, Exp *e1, Exp *e2) { + EQ_Handle c = F->add_EQ(); + c.update_const(e1->constantTerm); + if (e2) c.update_const(-e2->constantTerm); + for (std::map::iterator i = e1->coefs.begin(); i != e1->coefs.end(); i++) + c.update_coef((*i).first->id(F->relation()), (*i).second); + if (e2) + for (std::map::iterator i = e2->coefs.begin(); i != e2->coefs.end(); i++) + c.update_coef((*i).first->id(F->relation()), -(*i).second); + c.finalize(); +} + +void install_geq(F_And *F, Exp *e1, Exp *e2) { + GEQ_Handle c = F->add_GEQ(); + c.update_const(e1->constantTerm); + if (e2) c.update_const(-e2->constantTerm); + for (std::map::iterator i = e1->coefs.begin(); i != e1->coefs.end(); i++) + c.update_coef((*i).first->id(F->relation()), (*i).second); + if (e2) + for (std::map::iterator i = e2->coefs.begin(); i != e2->coefs.end(); i++) + c.update_coef((*i).first->id(F->relation()), -(*i).second); + c.finalize(); +} + +void install_gt(F_And *F, Exp *e1, Exp *e2) { + GEQ_Handle c = F->add_GEQ(); + c.update_const(-1); + c.update_const(e1->constantTerm); + if (e2) c.update_const(-e2->constantTerm); + for (std::map::iterator i = e1->coefs.begin(); i != e1->coefs.end(); i++) + c.update_coef((*i).first->id(F->relation()), (*i).second); + if (e2) + for (std::map::iterator i = e2->coefs.begin(); i != e2->coefs.end(); i++) + c.update_coef((*i).first->id(F->relation()), -(*i).second); + c.finalize(); +} + + +Global_Declaration_Site::~Global_Declaration_Site() { +/* // Take care of global variables - since we do that kludge */ +/* // of declaring globals twice if arity > 0, we must take care */ +/* // not to just delete each global once per declaration. */ + +/* // Actually, we can't free these, since Relations containing references to */ +/* // this may get freed later */ +/* foreach(v,Variable_Ref*,this->declarations,v->g=0); */ +/* //Set globals; */ +/* //foreach(v,Variable_Ref*,this->declarations,(globals.insert(v->g),v->g=0)); */ +/* //foreach(g,Free_Var_Decl*,globals,delete g); */ + + // Only delete global variables here. --chun 5/28/2008 + for (std::set::iterator i= declarations.begin(); i != declarations.end(); i++) { + if ((*i)->g != 0) { + if ((*i)->arity != 0) { // functional symbols + // only delete once from a pair of "(in)" and "(out)" variables + const char *name = static_cast((*i)->name); + const char *s = "(in)"; + bool match = true; + for (size_t p = strlen(name)-4, q = 0; p < strlen(name); p++, q++) + if (s[q] != name[p]) { + match = false; + break; + } + if (match) + delete (*i)->g; + } + else // not functions + delete (*i)->g; + + (*i)->g = 0; + } + } +} + +Variable_Ref * Global_Declaration_Site::extend(char *s) { + Variable_Ref *r = new Variable_Ref(s); + r->g = new Free_Var_Decl(r->stripped_name); + declarations.insert(r); + return r; +} + +void Global_Declaration_Site::extend_both_tuples(char *s, int arity) { + if (arity == 0) + extend(s); + else { + assert(arity > 0); + + char s1[strlen(s)+5], s2[strlen(s)+6]; + strcpy(s1,s); strcat(s1,"(in)"); + strcpy(s2,s); strcat(s2,"(out)"); + Const_String name = s; + + Variable_Ref *r1 = new Variable_Ref(s1, arity, Input_Tuple); + Variable_Ref *r2 = new Variable_Ref(s2, arity, Output_Tuple); + r1->g = r2->g = new Free_Var_Decl(s,arity); + + functionOfInput[name] = r1; + functionOfOutput[name] = r2; + + declarations.insert(r1); + declarations.insert(r2); + } +} + + +void resetGlobals() { + for (std::set::iterator i = globalDecls->declarations.begin(); i != globalDecls->declarations.end(); i++) + (*i)->vid = 0; +} + + +Variable_Ref *Declaration_Site::extend(char *s) { + Variable_Ref *r = new Variable_Ref(s); + declarations.insert(r); + return r; +} + +Variable_Ref *Declaration_Site::extend(char *s, Argument_Tuple of, int pos) { + Variable_Ref *r = new Variable_Ref(s); + declarations.insert(r); + r->of = of; + r->pos = pos; + return r; +} + +Variable_Ref * Declaration_Site::extend() { + Variable_Ref *r = new Variable_Ref(); + declarations.insert(r); + return r; +} + +void tupleDescriptor::extend(char *s) { + Variable_Ref *r = relationDecl->extend(s); + size++; + vars.push_back(r); + assert(size == vars.size()); +} + +void tupleDescriptor::extend(char *s, Argument_Tuple of, int pos) { + Variable_Ref *r = relationDecl->extend(s, of, pos); + size++; + vars.push_back(r); + assert(size == vars.size()); +} + +void tupleDescriptor::extend(Exp *e) { + Variable_Ref *r = relationDecl->extend(); + size++; + vars.push_back(r); + assert(size == vars.size()); + Exp *eq = subtract(e, new Exp(r)); + eq_constraints.insert(eq); +} + +void tupleDescriptor::extend(char *s, Exp *e) { + Variable_Ref *r = relationDecl->extend(s); + size++; + vars.push_back(r); + assert(size == vars.size()); + Exp *eq = subtract(e, new Exp(r)); + eq_constraints.insert(eq); +} + +void tupleDescriptor::extend() { + Variable_Ref *r = relationDecl->extend(); + size++; + vars.push_back(r); + assert(size == vars.size()); +} +void tupleDescriptor::extend(Exp *lb,Exp *ub) { + Variable_Ref *r = relationDecl->extend(); + size++; + vars.push_back(r); + assert(size == vars.size()); + Exp *lb_exp = subtract(new Exp(r), lb); + geq_constraints.insert(lb_exp); + Exp *ub_exp = subtract(ub, new Exp(r)); + geq_constraints.insert(ub_exp); +} +void tupleDescriptor::extend(Exp *lb,Exp *ub, coef_t stride) { + Variable_Ref *r = relationDecl->extend(); + size++; + vars.push_back(r); + Exp *lb_exp = subtract(new Exp(r), new Exp(*lb)); + geq_constraints.insert(lb_exp); + Exp *ub_exp = subtract(ub, new Exp(r)); + geq_constraints.insert(ub_exp); + strideConstraint *s = new strideConstraint; + s->e = subtract(lb, new Exp(r)); + s->step = stride; + stride_constraints.insert(s); +} diff --git a/omegalib/omega_calc/src/myflex.cc b/omegalib/omega_calc/src/myflex.cc new file mode 100755 index 0000000..89a2544 --- /dev/null +++ b/omegalib/omega_calc/src/myflex.cc @@ -0,0 +1,421 @@ +/***************************************************************************** + Copyright (C) 2011 Chun Chen + All Rights Reserved. + + Purpose: + support command line editing for calculator. + + Notes: + Since terminfo database is not queried for those nagging escape sequences, + current supported terminials are limited to xterm, linux, cygwin. + + History: + 02/06/11 created by Chun Chen +*****************************************************************************/ + +#include +#include +#include +#include + +#if defined __USE_POSIX +#include +#include +#include +#elif defined __WIN32 +#else +#endif + +#define HISTORY_SIZE 100 + +namespace { +enum {MY_KEY_EOF=0, MY_KEY_LEFT, MY_KEY_RIGHT, MY_KEY_UP, MY_KEY_DOWN, + MY_KEY_DEL, MY_KEY_HOME, MY_KEY_END, MY_KEY_PGUP, MY_KEY_PGDOWN, + MY_KEY_NUMPAD_HOME, MY_KEY_NUMPAD_END}; +} + +extern bool is_interactive; +extern const char * PROMPT_STRING; + +void move_cursor(int col, int n, int num_cols, const std::vector &key_seqs) { + if (n == 0) + return; + + int new_col = omega::int_mod(col + n, num_cols); + if (new_col == 0) + new_col = num_cols; + + for (int i = 0; i < new_col-col; i++) + std::cout.write(key_seqs[MY_KEY_RIGHT].c_str(), key_seqs[MY_KEY_RIGHT].length()); + for (int i = 0; i < col-new_col; i++) + std::cout.write(key_seqs[MY_KEY_LEFT].c_str(), key_seqs[MY_KEY_LEFT].length()); + + if (n < 0) + for (int i = 0; i < omega::abs(n) / num_cols + (new_col>col)?1:0; i++) + std::cout.write(key_seqs[MY_KEY_UP].c_str(), key_seqs[MY_KEY_UP].length()); + else + for (int i = 0; i < omega::abs(n) / num_cols + (new_col 0 && cur_line[len-1] == '\n') { + int n = omega::min(len-cur_pos, max_size); + for (int i = 0; i < n; i++) + buf[i] = cur_line[cur_pos+i]; + cur_pos = cur_pos + n; + if (cur_pos == len) { + // save history + if (len > 1) { + if (last_history_pos == -1) + last_history_pos = 0; + else { + last_history_pos = (last_history_pos+1)%HISTORY_SIZE; + if ((last_history_pos + 1)%HISTORY_SIZE == first_history_pos) + first_history_pos = (first_history_pos+1)%HISTORY_SIZE; + } + history[last_history_pos] = cur_line.substr(0, len-1); + cur_history_pos = (last_history_pos+1)%HISTORY_SIZE; + } + + // clear the working line + cur_pos = 0; + cur_line.clear(); + } + tcsetattr(STDIN_FILENO, TCSANOW, &old_settings); + return n; + } + + int count = read(STDIN_FILENO, keycodes, 255); + + // handle special key my way + int eaten = 0; + while (eaten < count) { + if (key_seqs[MY_KEY_EOF].length() > 0 && + static_cast(count - eaten) >= key_seqs[MY_KEY_EOF].length() && + strncmp(&keycodes[eaten], key_seqs[MY_KEY_EOF].c_str(), key_seqs[MY_KEY_EOF].length()) == 0) { + if (cur_line.length() == 0) { + tcsetattr(STDIN_FILENO, TCSANOW, &old_settings); + return 0; + } + + eaten += key_seqs[MY_KEY_EOF].length(); + } + else if (key_seqs[MY_KEY_LEFT].length() > 0 && + static_cast(count - eaten) >= key_seqs[MY_KEY_LEFT].length() && + strncmp(&keycodes[eaten], key_seqs[MY_KEY_LEFT].c_str(), key_seqs[MY_KEY_LEFT].length()) == 0) { + if (cur_pos > 0) { + int cur_col = (cur_pos + 1 + strlen(PROMPT_STRING) + 1) % num_cols; + if (cur_col == 0) + cur_col = num_cols; + + cur_pos--; + + move_cursor(cur_col, -1, num_cols, key_seqs); + } + eaten += key_seqs[MY_KEY_LEFT].length(); + } + else if (key_seqs[MY_KEY_RIGHT].length() > 0 && + static_cast(count - eaten) >= key_seqs[MY_KEY_RIGHT].length() && + strncmp(&keycodes[eaten], key_seqs[MY_KEY_RIGHT].c_str(), key_seqs[MY_KEY_RIGHT].length()) == 0) { + if (static_cast(cur_pos) < cur_line.length()) { + int cur_col = (cur_pos + 1 + strlen(PROMPT_STRING) + 1) % num_cols; + if (cur_col == 0) + cur_col = num_cols; + + cur_pos++; + + move_cursor(cur_col, 1, num_cols, key_seqs); + } + eaten += key_seqs[MY_KEY_RIGHT].length(); + } + else if (key_seqs[MY_KEY_UP].length() > 0 && + static_cast(count - eaten) >= key_seqs[MY_KEY_UP].length() && + strncmp(&keycodes[eaten], key_seqs[MY_KEY_UP].c_str(), key_seqs[MY_KEY_UP].length()) == 0) { + if (cur_history_pos >= 0 && cur_history_pos != first_history_pos) { + history[cur_history_pos] = cur_line; + cur_history_pos = omega::int_mod(cur_history_pos-1, HISTORY_SIZE); + + int cur_col = (cur_pos + 1 + strlen(PROMPT_STRING) + 1) % num_cols; + if (cur_col == 0) + cur_col = num_cols; + + move_cursor(cur_col, -cur_pos, num_cols, key_seqs); + + std::cout.write(history[cur_history_pos].c_str(), history[cur_history_pos].length()); + + cur_col = (history[cur_history_pos].length() + strlen(PROMPT_STRING) + 1) % num_cols; + if (cur_col == 0) { + std::cout.put(' '); + std::cout.put('\b'); + } + + if (cur_line.length() > history[cur_history_pos].length()) { + for (size_t i = 0; i < cur_line.length() - history[cur_history_pos].length(); i++) + std::cout.put(' '); + + cur_col = (cur_line.length() + strlen(PROMPT_STRING) + 1) % num_cols; + if (cur_col == 0) + cur_col = num_cols + 1; + else + cur_col++; + + move_cursor(cur_col, -(cur_line.length() - history[cur_history_pos].length()), num_cols, key_seqs); + } + cur_line = history[cur_history_pos]; + cur_pos = cur_line.length(); + } + + eaten += key_seqs[MY_KEY_UP].length(); + } + else if (key_seqs[MY_KEY_DOWN].length() > 0 && + static_cast(count - eaten) >= key_seqs[MY_KEY_DOWN].length() && + strncmp(&keycodes[eaten], key_seqs[MY_KEY_DOWN].c_str(), key_seqs[MY_KEY_DOWN].length()) == 0) { + if (cur_history_pos >= 0 && cur_history_pos != (last_history_pos+1)%HISTORY_SIZE) { + history[cur_history_pos] = cur_line; + cur_history_pos = (cur_history_pos+1)%HISTORY_SIZE; + + int cur_col = (cur_pos + 1 + strlen(PROMPT_STRING) + 1) % num_cols; + if (cur_col == 0) + cur_col = num_cols; + + move_cursor(cur_col, -cur_pos, num_cols, key_seqs); + + std::cout.write(history[cur_history_pos].c_str(), history[cur_history_pos].length()); + + cur_col = (history[cur_history_pos].length() + strlen(PROMPT_STRING) + 1) % num_cols; + if (cur_col == 0) { + std::cout.put(' '); + std::cout.put('\b'); + } + + if (cur_line.length() > history[cur_history_pos].length()) { + for (size_t i = 0; i < cur_line.length() - history[cur_history_pos].length(); i++) + std::cout.put(' '); + + cur_col = (cur_line.length() + strlen(PROMPT_STRING) + 1) % num_cols; + if (cur_col == 0) + cur_col = num_cols + 1; + else + cur_col++; + + move_cursor(cur_col, -(cur_line.length() - history[cur_history_pos].length()), num_cols, key_seqs); + } + cur_line = history[cur_history_pos]; + cur_pos = cur_line.length(); + } + + eaten += key_seqs[MY_KEY_DOWN].length(); + } + else if (key_seqs[MY_KEY_DEL].length() > 0 && + static_cast(count - eaten) >= key_seqs[MY_KEY_DEL].length() && + strncmp(&keycodes[eaten], key_seqs[MY_KEY_DEL].c_str(), key_seqs[MY_KEY_DEL].length()) == 0) { + if (static_cast(cur_pos) < cur_line.length()) { + cur_line.erase(cur_pos, 1); + std::cout.write(&(cur_line.c_str()[cur_pos]), cur_line.length()-cur_pos); + std::cout.put(' '); + + int cur_col = (cur_line.length() + 1 + strlen(PROMPT_STRING) + 1) % num_cols; + if (cur_col == 0) + cur_col = num_cols + 1; + else + cur_col++; + + move_cursor(cur_col, -(cur_line.length()-cur_pos+1), num_cols, key_seqs); + } + + eaten += key_seqs[MY_KEY_DEL].length(); + } + else if (key_seqs[MY_KEY_HOME].length() > 0 && + static_cast(count - eaten) >= key_seqs[MY_KEY_HOME].length() && + strncmp(&keycodes[eaten], key_seqs[MY_KEY_HOME].c_str(), key_seqs[MY_KEY_HOME].length()) == 0) { + int cur_col = (cur_pos + 1 + strlen(PROMPT_STRING) + 1) % num_cols; + if (cur_col == 0) + cur_col = num_cols; + + move_cursor(cur_col, -cur_pos, num_cols, key_seqs); + + cur_pos = 0; + eaten += key_seqs[MY_KEY_HOME].length(); + } + else if (key_seqs[MY_KEY_END].length() > 0 && + static_cast(count - eaten) >= key_seqs[MY_KEY_END].length() && + strncmp(&keycodes[eaten], key_seqs[MY_KEY_END].c_str(), key_seqs[MY_KEY_END].length()) == 0) { + int cur_col = (cur_pos + 1 + strlen(PROMPT_STRING) + 1) % num_cols; + if (cur_col == 0) + cur_col = num_cols; + + move_cursor(cur_col, cur_line.length()-cur_pos, num_cols, key_seqs); + + cur_pos = cur_line.length(); + eaten += key_seqs[MY_KEY_END].length(); + } + else if (key_seqs[MY_KEY_PGUP].length() > 0 && + static_cast(count - eaten) >= key_seqs[MY_KEY_PGUP].length() && + strncmp(&keycodes[eaten], key_seqs[MY_KEY_PGUP].c_str(), key_seqs[MY_KEY_PGUP].length()) == 0) { + eaten += key_seqs[MY_KEY_PGUP].length(); + } + else if (key_seqs[MY_KEY_PGDOWN].length() > 0 && + static_cast(count - eaten) >= key_seqs[MY_KEY_PGDOWN].length() && + strncmp(&keycodes[eaten], key_seqs[MY_KEY_PGDOWN].c_str(), key_seqs[MY_KEY_PGDOWN].length()) == 0) { + eaten += key_seqs[MY_KEY_PGDOWN].length(); + } + else if (key_seqs[MY_KEY_NUMPAD_HOME].length() > 0 && + static_cast(count - eaten) >= key_seqs[MY_KEY_NUMPAD_HOME].length() && + strncmp(&keycodes[eaten], key_seqs[MY_KEY_NUMPAD_HOME].c_str(), key_seqs[MY_KEY_NUMPAD_HOME].length()) == 0) { + eaten += key_seqs[MY_KEY_NUMPAD_HOME].length(); + } + else if (key_seqs[MY_KEY_NUMPAD_END].length() > 0 && + static_cast(count - eaten) >= key_seqs[MY_KEY_NUMPAD_END].length() && + strncmp(&keycodes[eaten], key_seqs[MY_KEY_NUMPAD_END].c_str(), key_seqs[MY_KEY_NUMPAD_END].length()) == 0) { + eaten += key_seqs[MY_KEY_NUMPAD_END].length(); + } + else if (keycodes[eaten] == '\x1B' && (count - eaten == 1 || keycodes[eaten+1] == '\x1B')) { // single ESC key + eaten++; + } + else if (keycodes[eaten] == '\x1B') { // unknown escape sequences + while (eaten+1 < count && keycodes[eaten+1] != '\x1B') + eaten++; + + keycodes[eaten] = '~'; + } + else if (keycodes[eaten] == '\x7F') { // backspace key + if (cur_pos > 0) { + int cur_col = (cur_pos + 1 + strlen(PROMPT_STRING) + 1) % num_cols; + if (cur_col == 0) + cur_col = num_cols; + + cur_pos--; + cur_line.erase(cur_pos, 1); + + move_cursor(cur_col, -1, num_cols, key_seqs); + + std::cout.write(&(cur_line.c_str()[cur_pos]), cur_line.length()-cur_pos); + std::cout.put(' '); + + cur_col = (cur_line.length() + 1 + strlen(PROMPT_STRING) + 1) % num_cols; + if (cur_col == 0) + cur_col = num_cols + 1; + else + cur_col++; + + move_cursor(cur_col, -(cur_line.length()-cur_pos+1), num_cols, key_seqs); + } + + eaten++; + } + else if (keycodes[eaten] == '\n'){ // return key + int cur_col = (cur_pos + 1 + strlen(PROMPT_STRING) + 1) % num_cols; + if (cur_col == 0) + cur_col = num_cols; + + move_cursor(cur_col, cur_line.length()-cur_pos, num_cols, key_seqs); + + std::cout.put(keycodes[eaten]); + cur_line.append(1, '\n'); + cur_pos = 0; + break; + } + else { // all other key + std::cout.put(keycodes[eaten]); + std::cout.write(&(cur_line.c_str()[cur_pos]), cur_line.length()-cur_pos); + + cur_line.insert(cur_pos, &keycodes[eaten], 1); + cur_pos++; + + int cur_col = (cur_line.length() + strlen(PROMPT_STRING) + 1) % num_cols; + if (cur_col == 0) { + // force cursor to move to the next line when the last printed char is at + // the right boundary of the terminal + std::cout.put(' '); + std::cout.put('\b'); + + cur_col = 1; + } + else + cur_col++; + + move_cursor(cur_col, -(cur_line.length()-cur_pos), num_cols, key_seqs); + + eaten++; + } + + std::cout.flush(); + } + } +#else + return yyFlexLexer::LexerInput(buf, max_size); +#endif +} diff --git a/omegalib/omega_calc/src/parser.l b/omegalib/omega_calc/src/parser.l new file mode 100644 index 0000000..ac2b448 --- /dev/null +++ b/omegalib/omega_calc/src/parser.l @@ -0,0 +1,350 @@ +%{ +#include +#include +#include +#include +#include +#include + +using namespace omega; +#include "y.tab.h" + +#define BUFFER scanBuf += yytext +std::string scanBuf; +std::string err_msg; + +extern "C" int yywrap() {return 1;}; + + +#define MAX_INCLUDE_DEPTH 10 +YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; +int include_stack_ptr = 0; +int comment_caller; + +extern bool is_interactive; +extern const char *PROMPT_STRING; +extern bool need_coef; + +// void yyerror(const char *s); +void yyerror(const std::string &s); +void flushScanBuffer(); + +%} + +%s LATEX INCLUDE COMMENT +%option yylineno + +%% + +"<<" { BUFFER; BEGIN(INCLUDE); } +[^>\n ]+">>" { + BUFFER; + scanBuf += "\n"; + flushScanBuffer(); + + if (include_stack_ptr >= MAX_INCLUDE_DEPTH) { + fprintf(stderr, "File including nested too deeply, abort"); + exit(1); + } + + char *s = yytext; + while (*s != '>') s++; + *s = '\0'; + FILE *f = fopen(yytext, "r"); + if (!f) { + fprintf(stderr, "Can't open file %s\n", yytext); + } + else { + include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER; + yyin = f; + yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); + } + BEGIN(INITIAL); +} +[ \n] { + fprintf(stderr,"Error in include syntax\n"); + fprintf(stderr,"Use <> to include the file named fname\n"); + BEGIN(INITIAL); + if(is_interactive && include_stack_ptr == 0) + printf("%s ", PROMPT_STRING); +} + +\n { + BUFFER; + BEGIN(comment_caller); + if(is_interactive && include_stack_ptr == 0) + printf("%s ", PROMPT_STRING); +} + +\n { + BUFFER; + if(is_interactive && include_stack_ptr == 0) + printf("%s ", PROMPT_STRING); +} + +"\\ " { BUFFER; } +[ \t]+ { BUFFER; } +# { BUFFER; comment_caller = YY_START; BEGIN(COMMENT); } +.* { BUFFER; flushScanBuffer(); } +"\$\$" { BUFFER; BEGIN(INITIAL); } +"\$\$" { BUFFER; BEGIN(LATEX); } +"\\t" { BUFFER; } +"\\!" { BUFFER; } +"\\\\" { BUFFER; } + +"{" { BUFFER; return OPEN_BRACE; } +"\\{" { BUFFER; return OPEN_BRACE; } +"}" { BUFFER; return CLOSE_BRACE; } +"\\}" { BUFFER; return CLOSE_BRACE; } +"approximate" { BUFFER; return APPROX; } +"union" { BUFFER; return UNION; } +"\\cup" { BUFFER; return UNION; } +"intersection" { BUFFER; return INTERSECTION; } +"\\cap" { BUFFER; return INTERSECTION; } +"symbolic" { BUFFER; return SYMBOLIC; } +"sym" { BUFFER; return SYMBOLIC; } +"\\mid" { BUFFER; return VERTICAL_BAR; } +"|" { BUFFER; return VERTICAL_BAR; } +"\\st" { BUFFER; return SUCH_THAT; } +"s.t." { BUFFER; return SUCH_THAT; } +"inverse" { BUFFER; return INVERSE; } +"complement" { BUFFER; return COMPLEMENT; } +"\\circ" { BUFFER; return COMPOSE; } +"compose" { BUFFER; return COMPOSE; } +"difference" { BUFFER; return DIFFERENCE; } +"diffToRel" { BUFFER; return DIFFERENCE_TO_RELATION; } +"project away symbols" { BUFFER; return PROJECT_AWAY_SYMBOLS; } +"project_away_symbols" { BUFFER; return PROJECT_AWAY_SYMBOLS; } +"projectAwaySymbols" { BUFFER; return PROJECT_AWAY_SYMBOLS; } +"project on symbols" { BUFFER; return PROJECT_ON_SYMBOLS; } +"project_on_symbols" { BUFFER; return PROJECT_ON_SYMBOLS; } +"projectOnSymbols" { BUFFER; return PROJECT_ON_SYMBOLS; } +"\\join" { BUFFER; return JOIN; } +"\." { BUFFER; return JOIN; } +"join" { BUFFER; return JOIN; } +"domain" { BUFFER; return DOMAIN; } +"time" { BUFFER; return TIME; } +"timeclosure" { BUFFER; return TIMECLOSURE; } +"range" { BUFFER; return RANGE; } +"\\forall" { BUFFER; return FORALL; } +"forall" { BUFFER; return FORALL; } +"\\exists" { BUFFER; return EXISTS; } +"exists" { BUFFER; return EXISTS; } + +"Venn" { BUFFER; return VENN; } +"ConvexRepresentation" { BUFFER; return CONVEX_REPRESENTATION; } +"ConvexCombination" { BUFFER; return CONVEX_COMBINATION; } +"PositiveCombination" { BUFFER; return POSITIVE_COMBINATION; } +"LinearCombination" { BUFFER; return LINEAR_COMBINATION; } +"AffineCombination" { BUFFER; return AFFINE_COMBINATION; } +"RectHull" { BUFFER; return RECT_HULL; } +"ConvexHull" { BUFFER; return CONVEX_HULL; } +"DecoupledConvexHull" { BUFFER; return DECOUPLED_CONVEX_HULL; } +"AffineHull" { BUFFER; return AFFINE_HULL; } +"ConicHull" { BUFFER; return CONIC_HULL; } +"LinearHull" { BUFFER; return LINEAR_HULL; } +"PairwiseCheck" { /*deprecated*/ BUFFER; return PAIRWISE_CHECK; } +"ConvexCheck" { /*deprecated*/ BUFFER; return CONVEX_CHECK; } +"QuickHull" { /*deprecated*/ BUFFER; return QUICK_HULL; } +"hull" { BUFFER; return HULL; } + +"minimize" { BUFFER; return MINIMIZE; } +"maximize" { BUFFER; return MAXIMIZE; } +"minimize-range" { BUFFER; return MINIMIZE_RANGE; } +"maximize-range" { BUFFER; return MAXIMIZE_RANGE; } +"minimizerange" { BUFFER; return MINIMIZE_RANGE; } +"maximizerange" { BUFFER; return MAXIMIZE_RANGE; } +"minimize-domain" { BUFFER; return MINIMIZE_DOMAIN; } +"maximize-domain" { BUFFER; return MAXIMIZE_DOMAIN; } +"minimizedomain" { BUFFER; return MINIMIZE_DOMAIN; } +"maximizedomain" { BUFFER; return MAXIMIZE_DOMAIN; } +"gist" { BUFFER; return GIST; } +"given" { BUFFER; return GIVEN; } +"within" { BUFFER; return WITHIN; } +"subset" { BUFFER; return SUBSET; } +"codegen" { BUFFER; return CODEGEN; } +"farkas" { BUFFER; return FARKAS; } +"decoupledfarkas" { BUFFER; return DECOUPLED_FARKAS; } +"decoupled-farkas" { BUFFER; return DECOUPLED_FARKAS; } +"decoupled_farkas" { BUFFER; return DECOUPLED_FARKAS; } +"upper_bound" { BUFFER; return MAKE_UPPER_BOUND; } +"lower_bound" { BUFFER; return MAKE_LOWER_BOUND; } +"supersetof" { BUFFER; return SUPERSETOF;} +"subsetof" { BUFFER; return SUBSETOF;} +"sym_example" { BUFFER; return SYM_SAMPLE;} +"example" { BUFFER; return SAMPLE;} +"carried_by" { BUFFER; return CARRIED_BY;} +"reachable" { BUFFER; return REACHABLE_FROM; } +"reachable of" { BUFFER; return REACHABLE_OF; } +"restrict_domain" { BUFFER; return RESTRICT_DOMAIN; } +"restrictDomain" { BUFFER; return RESTRICT_DOMAIN; } +"\\" { yyerror("Can't use \\ for restrict_domain in Tex mode"); } +"\\" { BUFFER; return RESTRICT_DOMAIN; } +"restrict_range" { BUFFER; return RESTRICT_RANGE; } +"restrictRange" { BUFFER; return RESTRICT_RANGE; } +"assertUnsatisfiable" { BUFFER; return ASSERT_UNSAT; } +"assert_unsatisfiable" { BUFFER; return ASSERT_UNSAT; } + +"/" { BUFFER; return RESTRICT_RANGE; } +"&" { BUFFER; return AND; } +"|" { BUFFER; return OR; } +"&&" { BUFFER; return AND; } +"||" { BUFFER; return OR; } +"and" { BUFFER; return AND; } +"or" { BUFFER; return OR; } +"\\land" { BUFFER; return AND; } +"\\lor" { BUFFER; return OR; } +"!" { BUFFER; return NOT; } +"not" { BUFFER; return NOT; } +"\\neg" { BUFFER; return NOT; } +":=" { BUFFER; return IS_ASSIGNED; } +"->" { BUFFER; return GOES_TO; } +"in" { BUFFER; return IN; } +"\\rightarrow" { BUFFER; return GOES_TO; } +"<=" { BUFFER; yylval.REL_OPERATOR = leq; return REL_OP; } +"\\leq" { BUFFER; yylval.REL_OPERATOR = leq; return REL_OP; } +"\\le" { BUFFER; yylval.REL_OPERATOR = leq; return REL_OP; } +">=" { BUFFER; yylval.REL_OPERATOR = geq; return REL_OP; } +"\\geq" { BUFFER; yylval.REL_OPERATOR = geq; return REL_OP; } +"\\ge" { BUFFER; yylval.REL_OPERATOR = geq; return REL_OP; } +"!=" { BUFFER; yylval.REL_OPERATOR = neq; return REL_OP; } +"\\neq" { BUFFER; yylval.REL_OPERATOR = neq; return REL_OP; } +"<" { BUFFER; yylval.REL_OPERATOR = lt; return REL_OP; } +">" { BUFFER; yylval.REL_OPERATOR = gt; return REL_OP; } +"=" { BUFFER; yylval.REL_OPERATOR = eq; return REL_OP; } +"==" { BUFFER; yylval.REL_OPERATOR = eq; return REL_OP; } + +[A-Za-z][A-Za-z0-9_]*[\']* { + BUFFER; + if (yyleng > 19) yyerror("Identifier too long"); + yylval.VAR_NAME = new char[yyleng+1]; + strcpy(yylval.VAR_NAME,yytext); + return VAR; +} +[A-Za-z][A-Za-z0-9_]*"(in)" { + BUFFER; + if (yyleng > 19) yyerror("Identifier too long"); + yylval.VAR_NAME = new char[yyleng+1]; + strcpy(yylval.VAR_NAME,yytext); + yylval.VAR_NAME[yyleng-3] = 'i'; // lowercase + yylval.VAR_NAME[yyleng-2] = 'n'; + return VAR; +} +[A-Za-z][A-Za-z0-9_]*"(set)" { + BUFFER; + if (yyleng > 19) yyerror("Identifier too long"); + yylval.VAR_NAME = new char[yyleng+1]; + strcpy(yylval.VAR_NAME,yytext); + yylval.VAR_NAME[yyleng-4] = 'i'; // Change to "in" + yylval.VAR_NAME[yyleng-3] = 'n'; // Be afraid + yylval.VAR_NAME[yyleng-2] = ')'; + yylval.VAR_NAME[yyleng-1] = '\0'; + return VAR; +} +[A-Za-z][A-Za-z0-9_]*"(out)" { + BUFFER; + if (yyleng > 19) yyerror("Identifier too long"); + yylval.VAR_NAME = new char[yyleng+1]; + strcpy(yylval.VAR_NAME,yytext); + yylval.VAR_NAME[yyleng-4] = 'o'; // lowercase + yylval.VAR_NAME[yyleng-3] = 'u'; + yylval.VAR_NAME[yyleng-2] = 't'; + return VAR; +} +"\\"[A-Za-z][A-Za-z0-9_]* { + BUFFER; + if (yyleng > 19) yyerror("Identifier too long"); + yylval.VAR_NAME = new char[yyleng+1]; + strcpy(yylval.VAR_NAME,yytext); + return VAR; + } +"\\"[A-Za-z][A-Za-z0-9_]*"(in)" { + BUFFER; + if (yyleng > 19) yyerror("Identifier too long"); + yylval.VAR_NAME = new char[yyleng+1]; + strcpy(yylval.VAR_NAME,yytext); + yylval.VAR_NAME[yyleng-3] = 'i'; // lowercase + yylval.VAR_NAME[yyleng-2] = 'n'; + return VAR; + } +"\\"[A-Za-z][A-Za-z0-9_]*"(set)" { + BUFFER; + if (yyleng > 19) yyerror("Identifier too long"); + yylval.VAR_NAME = new char[yyleng+1]; + strcpy(yylval.VAR_NAME,yytext); + yylval.VAR_NAME[yyleng-4] = 'i'; // Change to "in" + yylval.VAR_NAME[yyleng-3] = 'n'; // Be afraid + yylval.VAR_NAME[yyleng-2] = ')'; + yylval.VAR_NAME[yyleng-1] = '\0'; + return VAR; + } +"\\"[A-Za-z][A-Za-z0-9_]*"(out)" { + BUFFER; + if (yyleng > 19) yyerror("Identifier too long"); + yylval.VAR_NAME = new char[yyleng+1]; + strcpy(yylval.VAR_NAME,yytext); + yylval.VAR_NAME[yyleng-4] = 'o'; // lowercase + yylval.VAR_NAME[yyleng-3] = 'u'; + yylval.VAR_NAME[yyleng-2] = 't'; + return VAR; + } + +[0-9]+ { BUFFER; + if (need_coef) { + sscanf(yytext, coef_fmt, &yylval.COEF_VALUE); + return COEF; + } + else { + yylval.INT_VALUE = atoi(yytext); + return INT; + } +} + +\"[^\"]*\" { BUFFER; + yytext[strlen(yytext)-1]='\0'; + yylval.STRING_VALUE = new std::string(yytext+1); + return STRING; +} + + +<> { + if (--include_stack_ptr < 0) { + flushScanBuffer(); + return yytext[0]; + } + yy_delete_buffer(YY_CURRENT_BUFFER); + yy_switch_to_buffer(include_stack[include_stack_ptr]); +} + +. { BUFFER; return yytext[0]; } + + +%% + +void yyerror(const std::string &s) { + std::stringstream ss; + if (is_interactive && include_stack_ptr == 0) + ss << s << "\n"; + else + ss << s << " at line " << yylineno << "\n"; + err_msg = ss.str(); +} + + +void flushScanBuffer() { + if (scanBuf.size() == 0) + return; + if (!is_interactive || include_stack_ptr > 0) { + size_t prev_pos = 0; + if (scanBuf[0] == '\n') + prev_pos = 1; + for (size_t pos = prev_pos; pos <= scanBuf.size(); pos++) { + if (pos == scanBuf.size() || scanBuf[pos] == '\n') { + std::cout << PROMPT_STRING << " " << scanBuf.substr(prev_pos, pos-prev_pos) << std::endl; + prev_pos = pos+1; + } + } + } + + scanBuf.clear(); +} diff --git a/omegalib/omega_calc/src/parser.ll b/omegalib/omega_calc/src/parser.ll new file mode 100755 index 0000000..86de3a4 --- /dev/null +++ b/omegalib/omega_calc/src/parser.ll @@ -0,0 +1,350 @@ +/***************************************************************************** + Copyright (C) 1994-2000 the Omega Project Team + Copyright (C) 2005-2011 Chun Chen + All Rights Reserved. + + Purpose: + lex parser for calculator. + + Notes: + + History: + 02/04/11 migrate to flex c++ mode, Chun Chen +*****************************************************************************/ + +%{ +#include +#include +#include +#include +#include +#include +#include +#include +#include "parser.tab.hh" +#include + +myFlexLexer mylexer; +bool is_interactive; +const char *PROMPT_STRING = ">>>"; + +#define BUFFER scanBuf += yytext +std::string scanBuf; +std::string err_msg; + +extern bool need_coef; + +void yyerror(const std::string &s); +void flushScanBuffer(); + +%} + +%s LATEX INCLUDE COMMENT +%option yylineno +%option noyywrap + +%% + +"<<" { BUFFER; BEGIN(INCLUDE); } +[^>\n ]+">>" { + BUFFER; + scanBuf += "\n"; + flushScanBuffer(); + + if (is_interactive) { + std::cout << "file include disabled in interactive mode\n"; + } + else { + char *s = yytext; + while (*s != '>') s++; + *s = '\0'; + std::ifstream *ifs = new std::ifstream(yytext, std::ifstream::in); + if (!ifs->is_open()) { + fprintf(stderr, "Can't open file %s\n", yytext); + } + else { + yy_buffer_state *bs = mylexer.yy_create_buffer(ifs, 8092); + mylexer.yypush_buffer_state(bs); + } + } + BEGIN(INITIAL); +} +[ \n] { + std::cout << "Error in include syntax\n"; + std::cout << "Use <> to include the file named fname\n"; + BEGIN(INITIAL); + if(is_interactive) { + std::cout << PROMPT_STRING << ' '; + std::cout.flush(); + } +} + + + + + +"\\ " { BUFFER; } +[ \t]+ { BUFFER; } +# { BUFFER; BEGIN(COMMENT); } +.* { BUFFER; } +"\$\$\n" { BUFFER; BEGIN(INITIAL); } +"\$\$" { BUFFER; BEGIN(INITIAL); } +"\$\$" { BUFFER; BEGIN(LATEX); } +"\\n" { BUFFER; } +"\\t" { BUFFER; } +"\\!" { BUFFER; } +"\\\\" { BUFFER; } +"\n" { BUFFER; } + + +\n { + BUFFER; + BEGIN(INITIAL); + if(is_interactive) { + std::cout << PROMPT_STRING << ' '; + std::cout.flush(); + } +} + + + + + +"{" { BUFFER; return OPEN_BRACE; } +"\\{" { BUFFER; return OPEN_BRACE; } +"}" { BUFFER; return CLOSE_BRACE; } +"\\}" { BUFFER; return CLOSE_BRACE; } +"approximate" { BUFFER; return APPROX; } +"union" { BUFFER; return UNION; } +"\\cup" { BUFFER; return UNION; } +"intersection" { BUFFER; return INTERSECTION; } +"\\cap" { BUFFER; return INTERSECTION; } +"without_simplify" { BUFFER; return NO_SIMPLIFY; } +"symbolic" { BUFFER; return SYMBOLIC; } +"sym" { BUFFER; return SYMBOLIC; } +"\\mid" { BUFFER; return VERTICAL_BAR; } +"|" { BUFFER; return VERTICAL_BAR; } +"\\st" { BUFFER; return SUCH_THAT; } +"s.t." { BUFFER; return SUCH_THAT; } +"inverse" { BUFFER; return INVERSE; } +"complement" { BUFFER; return COMPLEMENT; } +"\\circ" { BUFFER; return COMPOSE; } +"compose" { BUFFER; return COMPOSE; } +"difference" { BUFFER; return DIFFERENCE; } +"diffToRel" { BUFFER; return DIFFERENCE_TO_RELATION; } +"project away symbols" { BUFFER; return PROJECT_AWAY_SYMBOLS; } +"project_away_symbols" { BUFFER; return PROJECT_AWAY_SYMBOLS; } +"projectAwaySymbols" { BUFFER; return PROJECT_AWAY_SYMBOLS; } +"project on symbols" { BUFFER; return PROJECT_ON_SYMBOLS; } +"project_on_symbols" { BUFFER; return PROJECT_ON_SYMBOLS; } +"projectOnSymbols" { BUFFER; return PROJECT_ON_SYMBOLS; } +"\\join" { BUFFER; return JOIN; } +"\." { BUFFER; return JOIN; } +"join" { BUFFER; return JOIN; } +"domain" { BUFFER; return DOMAIN; } +"time" { BUFFER; return TIME; } +"timeclosure" { BUFFER; return TIMECLOSURE; } +"range" { BUFFER; return RANGE; } +"\\forall" { BUFFER; return FORALL; } +"forall" { BUFFER; return FORALL; } +"\\exists" { BUFFER; return EXISTS; } +"exists" { BUFFER; return EXISTS; } + +"Venn" { BUFFER; return VENN; } +"ConvexRepresentation" { BUFFER; return CONVEX_REPRESENTATION; } +"ConvexCombination" { BUFFER; return CONVEX_COMBINATION; } +"PositiveCombination" { BUFFER; return POSITIVE_COMBINATION; } +"LinearCombination" { BUFFER; return LINEAR_COMBINATION; } +"AffineCombination" { BUFFER; return AFFINE_COMBINATION; } +"RectHull" { /*deprecated*/ BUFFER; return RECT_HULL; } +"SimpleHull" { BUFFER; return SIMPLE_HULL; } +"ConvexHull" { BUFFER; return CONVEX_HULL; } +"DecoupledConvexHull" { BUFFER; return DECOUPLED_CONVEX_HULL; } +"AffineHull" { BUFFER; return AFFINE_HULL; } +"ConicHull" { BUFFER; return CONIC_HULL; } +"LinearHull" { BUFFER; return LINEAR_HULL; } +"PairwiseCheck" { /*deprecated*/ BUFFER; return PAIRWISE_CHECK; } +"ConvexCheck" { /*deprecated*/ BUFFER; return CONVEX_CHECK; } +"QuickHull" { /*deprecated*/ BUFFER; return QUICK_HULL; } +"Hull" { BUFFER; return HULL; } +"farkas" { BUFFER; return FARKAS; } +"decoupledfarkas" { BUFFER; return DECOUPLED_FARKAS; } +"decoupled-farkas" { BUFFER; return DECOUPLED_FARKAS; } +"decoupled_farkas" { BUFFER; return DECOUPLED_FARKAS; } + +"minimize" { BUFFER; return MINIMIZE; } +"maximize" { BUFFER; return MAXIMIZE; } +"minimize-range" { BUFFER; return MINIMIZE_RANGE; } +"maximize-range" { BUFFER; return MAXIMIZE_RANGE; } +"minimizerange" { BUFFER; return MINIMIZE_RANGE; } +"maximizerange" { BUFFER; return MAXIMIZE_RANGE; } +"minimize-domain" { BUFFER; return MINIMIZE_DOMAIN; } +"maximize-domain" { BUFFER; return MAXIMIZE_DOMAIN; } +"minimizedomain" { BUFFER; return MINIMIZE_DOMAIN; } +"maximizedomain" { BUFFER; return MAXIMIZE_DOMAIN; } +"gist" { BUFFER; return GIST; } +"given" { BUFFER; return GIVEN; } +"within" { BUFFER; return WITHIN; } +"subset" { BUFFER; return SUBSET; } +"codegen" { BUFFER; return CODEGEN; } +"upper_bound" { BUFFER; return MAKE_UPPER_BOUND; } +"lower_bound" { BUFFER; return MAKE_LOWER_BOUND; } +"supersetof" { BUFFER; return SUPERSETOF;} +"subsetof" { BUFFER; return SUBSETOF;} +"sym_example" { BUFFER; return SYM_SAMPLE;} +"example" { BUFFER; return SAMPLE;} +"carried_by" { BUFFER; return CARRIED_BY;} +"reachable" { BUFFER; return REACHABLE_FROM; } +"reachable of" { BUFFER; return REACHABLE_OF; } +"restrict_domain" { BUFFER; return RESTRICT_DOMAIN; } +"restrictDomain" { BUFFER; return RESTRICT_DOMAIN; } +"\\" { BUFFER; return RESTRICT_DOMAIN; } +"restrict_range" { BUFFER; return RESTRICT_RANGE; } +"restrictRange" { BUFFER; return RESTRICT_RANGE; } +"assertUnsatisfiable" { BUFFER; return ASSERT_UNSAT; } +"assert_unsatisfiable" { BUFFER; return ASSERT_UNSAT; } + +"/" { BUFFER; return RESTRICT_RANGE; } +"&" { BUFFER; return AND; } +"|" { BUFFER; return OR; } +"&&" { BUFFER; return AND; } +"||" { BUFFER; return OR; } +"and" { BUFFER; return AND; } +"or" { BUFFER; return OR; } +"\\land" { BUFFER; return AND; } +"\\lor" { BUFFER; return OR; } +"!" { BUFFER; return NOT; } +"not" { BUFFER; return NOT; } +"\\neg" { BUFFER; return NOT; } +":=" { BUFFER; return IS_ASSIGNED; } +"->" { BUFFER; return GOES_TO; } +"in" { BUFFER; return IN; } +"\\rightarrow" { BUFFER; return GOES_TO; } +"<=" { BUFFER; yylval.REL_OPERATOR = leq; return REL_OP; } +"\\leq" { BUFFER; yylval.REL_OPERATOR = leq; return REL_OP; } +"\\le" { BUFFER; yylval.REL_OPERATOR = leq; return REL_OP; } +">=" { BUFFER; yylval.REL_OPERATOR = geq; return REL_OP; } +"\\geq" { BUFFER; yylval.REL_OPERATOR = geq; return REL_OP; } +"\\ge" { BUFFER; yylval.REL_OPERATOR = geq; return REL_OP; } +"!=" { BUFFER; yylval.REL_OPERATOR = neq; return REL_OP; } +"\\neq" { BUFFER; yylval.REL_OPERATOR = neq; return REL_OP; } +"<" { BUFFER; yylval.REL_OPERATOR = lt; return REL_OP; } +">" { BUFFER; yylval.REL_OPERATOR = gt; return REL_OP; } +"=" { BUFFER; yylval.REL_OPERATOR = eq; return REL_OP; } +"==" { BUFFER; yylval.REL_OPERATOR = eq; return REL_OP; } + +[A-Za-z_][A-Za-z0-9_]*[\']* { + BUFFER; + yylval.VAR_NAME = new char[yyleng+1]; + strcpy(yylval.VAR_NAME,yytext); + return VAR; +} +[A-Za-z][A-Za-z0-9_]*"(In)" { + BUFFER; + yylval.VAR_NAME = new char[yyleng+1]; + strcpy(yylval.VAR_NAME,yytext); + yylval.VAR_NAME[yyleng-3] = 'i'; // lowercase + yylval.VAR_NAME[yyleng-2] = 'n'; + return VAR; +} +[A-Za-z][A-Za-z0-9_]*"(Set)" { + BUFFER; + yylval.VAR_NAME = new char[yyleng+1]; + strcpy(yylval.VAR_NAME,yytext); + yylval.VAR_NAME[yyleng-4] = 'i'; // Change to "in" + yylval.VAR_NAME[yyleng-3] = 'n'; // Be afraid + yylval.VAR_NAME[yyleng-2] = ')'; + yylval.VAR_NAME[yyleng-1] = '\0'; + return VAR; +} +[A-Za-z][A-Za-z0-9_]*"(Out)" { + BUFFER; + yylval.VAR_NAME = new char[yyleng+1]; + strcpy(yylval.VAR_NAME,yytext); + yylval.VAR_NAME[yyleng-4] = 'o'; // lowercase + yylval.VAR_NAME[yyleng-3] = 'u'; + yylval.VAR_NAME[yyleng-2] = 't'; + return VAR; +} +"\\"[A-Za-z][A-Za-z0-9_]* { + BUFFER; + yylval.VAR_NAME = new char[yyleng+1]; + strcpy(yylval.VAR_NAME,yytext); + return VAR; + } +"\\"[A-Za-z][A-Za-z0-9_]*"(In)" { + BUFFER; + yylval.VAR_NAME = new char[yyleng+1]; + strcpy(yylval.VAR_NAME,yytext); + yylval.VAR_NAME[yyleng-3] = 'i'; // lowercase + yylval.VAR_NAME[yyleng-2] = 'n'; + return VAR; + } +"\\"[A-Za-z][A-Za-z0-9_]*"(Set)" { + BUFFER; + yylval.VAR_NAME = new char[yyleng+1]; + strcpy(yylval.VAR_NAME,yytext); + yylval.VAR_NAME[yyleng-4] = 'i'; // Change to "in" + yylval.VAR_NAME[yyleng-3] = 'n'; // Be afraid + yylval.VAR_NAME[yyleng-2] = ')'; + yylval.VAR_NAME[yyleng-1] = '\0'; + return VAR; + } +"\\"[A-Za-z][A-Za-z0-9_]*"(Out)" { + BUFFER; + yylval.VAR_NAME = new char[yyleng+1]; + strcpy(yylval.VAR_NAME,yytext); + yylval.VAR_NAME[yyleng-4] = 'o'; // lowercase + yylval.VAR_NAME[yyleng-3] = 'u'; + yylval.VAR_NAME[yyleng-2] = 't'; + return VAR; + } + +[0-9]+ { BUFFER; + if (need_coef) { + sscanf(yytext, coef_fmt, &yylval.COEF_VALUE); + return COEF; + } + else { + yylval.INT_VALUE = atoi(yytext); + return INT; + } +} + +\"[^\"]*\" { BUFFER; + yytext[yyleng-1]='\0'; + yylval.STRING_VALUE = new std::string(yytext+1); + return STRING; +} + + +<> { + mylexer.yypop_buffer_state(); + if (!YY_CURRENT_BUFFER) { + flushScanBuffer(); + return YY_NULL; + } +} + +. { BUFFER; return yytext[0]; } + + +%% + +void flushScanBuffer() { + if (scanBuf.size() == 0) + return; + if (!is_interactive) { + size_t prev_pos = 0; + if (scanBuf[0] == '\n') + prev_pos = 1; + for (size_t pos = prev_pos; pos <= scanBuf.size(); pos++) { + if (pos == scanBuf.size() || scanBuf[pos] == '\n') { + std::cout << PROMPT_STRING << " " << scanBuf.substr(prev_pos, pos-prev_pos) << std::endl; + prev_pos = pos+1; + } + } + } + + scanBuf.clear(); +} diff --git a/omegalib/omega_calc/src/parser.y b/omegalib/omega_calc/src/parser.y new file mode 100644 index 0000000..7369b94 --- /dev/null +++ b/omegalib/omega_calc/src/parser.y @@ -0,0 +1,1925 @@ +/***************************************************************************** + Copyright (C) 1994-2000 University of Maryland. + Copyright (C) 2008 University of Southern California. + Copyright (C) 2009-2010 University of Utah. + All Rights Reserved. + + Purpose: + omega calculator yacc parser. + + Notes: + + History: +*****************************************************************************/ + +%{ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef WIN32 +#include +#define isatty _isatty +#define alloca _alloca +#endif +#ifndef WIN32 +#include +#include +#endif +#if !defined(OMIT_GETRUSAGE) +#include +#include +#include +#endif + +#if !defined(OMIT_GETRUSAGE) +#ifdef __sparc__ +extern "C" int getrusage (int, struct rusage*); +#endif + +using namespace omega; + +struct rusage start_time; +bool anyTimingDone = false; + +void start_clock( void ) { + getrusage(RUSAGE_SELF, &start_time); +} + +int clock_diff( void ) { + struct rusage current_time; + getrusage(RUSAGE_SELF, ¤t_time); + return (current_time.ru_utime.tv_sec -start_time.ru_utime.tv_sec)*1000000 + (current_time.ru_utime.tv_usec-start_time.ru_utime.tv_usec); +} +#endif + +int omega_calc_debug = 0; + +bool is_interactive; +const char *PROMPT_STRING = ">>>"; +extern std::string err_msg; +extern FILE *yyin; +bool need_coef; + +Map relationMap ((Relation *)0); +namespace { + int redundant_conj_level = 2; // default maximum 2 + int redundant_constr_level = 4; // default maximum 4 +} + +int argCount = 0; +int tuplePos = 0; +Argument_Tuple currentTuple = Input_Tuple; + +Relation LexForward(int n); +reachable_information *reachable_info; + +int yylex(); +void yyerror(const std::string &s); +void flushScanBuffer(); + +%} + +%union { + int INT_VALUE; + coef_t COEF_VALUE; + Rel_Op REL_OPERATOR; + char *VAR_NAME; + VarList *VAR_LIST; + Exp *EXP; + ExpList *EXP_LIST; + AST *ASTP; + Argument_Tuple ARGUMENT_TUPLE; + AST_constraints *ASTCP; + Declaration_Site * DECLARATION_SITE; + Relation * RELATION; + tupleDescriptor * TUPLE_DESCRIPTOR; + RelTuplePair * REL_TUPLE_PAIR; + Dynamic_Array2 * RELATION_ARRAY_2D; + Dynamic_Array1 * RELATION_ARRAY_1D; + Tuple *STRING_TUPLE; + std::string *STRING_VALUE; +} + +%token VAR +%token INT +%token COEF +%token STRING +%token OPEN_BRACE CLOSE_BRACE +%token SYMBOLIC +%token OR AND NOT +%token ST APPROX +%token IS_ASSIGNED +%token FORALL EXISTS +%token DOMAIN RANGE +%token DIFFERENCE DIFFERENCE_TO_RELATION +%token GIST GIVEN HULL WITHIN MAXIMIZE MINIMIZE +%token AFFINE_HULL VENN CONVEX_COMBINATION POSITIVE_COMBINATION LINEAR_COMBINATION AFFINE_COMBINATION CONVEX_HULL CONIC_HULL LINEAR_HULL QUICK_HULL PAIRWISE_CHECK CONVEX_CHECK CONVEX_REPRESENTATION RECT_HULL DECOUPLED_CONVEX_HULL +%token MAXIMIZE_RANGE MINIMIZE_RANGE +%token MAXIMIZE_DOMAIN MINIMIZE_DOMAIN +%token LEQ GEQ NEQ +%token GOES_TO +%token COMPOSE JOIN INVERSE COMPLEMENT IN CARRIED_BY TIME TIMECLOSURE +%token UNION INTERSECTION +%token VERTICAL_BAR SUCH_THAT +%token SUBSET CODEGEN DECOUPLED_FARKAS FARKAS +%token MAKE_UPPER_BOUND MAKE_LOWER_BOUND +%token REL_OP +%token RESTRICT_DOMAIN RESTRICT_RANGE +%token SUPERSETOF SUBSETOF SAMPLE SYM_SAMPLE +%token PROJECT_AWAY_SYMBOLS PROJECT_ON_SYMBOLS REACHABLE_FROM REACHABLE_OF +%token ASSERT_UNSAT +%token PARSE_EXPRESSION PARSE_FORMULA PARSE_RELATION + +%type effort +%type exp simpleExp +%type expList +%type varList +%type argumentList +%type formula optionalFormula +%type constraintChain +%type tupleDeclaration +%type varDecl varDeclOptBrackets +%type relation builtRelation context +%type reachable_of +%type relPairList +%type reachable + +%destructor {delete []$$;} VAR +%destructor {delete $$;} STRING +%destructor {delete $$;} relation builtRelation tupleDeclaration formula optionalFormula context reachable_of constraintChain varDecl varDeclOptBrackets relPairList reachable +%destructor {delete $$;} varList exp simpleExp +%destructor { + foreach(e, Exp *, *$$, delete e); + delete $$; + } expList; + +%nonassoc ASSERT_UNSAT +%left UNION p1 '+' '-' +%nonassoc SUPERSETOF SUBSETOF +%left p2 RESTRICT_DOMAIN RESTRICT_RANGE +%left INTERSECTION p3 '*' '@' +%left p4 +%left OR p5 +%left AND p6 +%left COMPOSE JOIN CARRIED_BY +%right NOT APPROX DOMAIN RANGE HULL PROJECT_AWAY_SYMBOLS PROJECT_ON_SYMBOLS DIFFERENCE DIFFERENCE_TO_RELATION INVERSE COMPLEMENT FARKAS SAMPLE SYM_SAMPLE MAKE_UPPER_BOUND MAKE_LOWER_BOUND p7 +%left p8 +%nonassoc GIVEN +%left p9 +%left '(' p10 + +%% + +inputSequence : /*empty*/ + | inputSequence { assert( current_Declaration_Site == globalDecls);} + inputItem +; + +inputItem : ';' /*empty*/ + | error ';' { + flushScanBuffer(); + std::cout << err_msg; + err_msg.clear(); + current_Declaration_Site = globalDecls; + need_coef = false; + std::cout << "...skipping to statement end..." << std::endl; + delete relationDecl; + relationDecl = NULL; + } + | SYMBOLIC globVarList ';' {flushScanBuffer();} + | VAR IS_ASSIGNED relation ';' { + flushScanBuffer(); + try { + $3->simplify(redundant_conj_level, redundant_constr_level); + Relation *r = relationMap((Const_String)$1); + if (r) delete r; + relationMap[(Const_String)$1] = $3; + } + catch (const std::exception &e) { + std::cout << e.what() << std::endl; + } + delete []$1; + } + | relation ';' { + flushScanBuffer(); + $1->simplify(redundant_conj_level, redundant_constr_level); + $1->print_with_subs(stdout); + delete $1; + } + | TIME relation ';' { +#if defined(OMIT_GETRUSAGE) + printf("'time' requires getrusage, but the omega calclator was compiled with OMIT_GETRUSAGE set!\n"); +#else + flushScanBuffer(); + printf("\n"); + int t; + Relation R; + bool SKIP_FULL_CHECK = getenv("OC_TIMING_SKIP_FULL_CHECK"); + ($2)->and_with_GEQ(); + start_clock(); + for (t=1;t<=100;t++) { + R = *$2; + R.finalize(); + } + int copyTime = clock_diff(); + start_clock(); + for (t=1;t<=100;t++) { + R = *$2; + R.finalize(); + R.simplify(); /* default simplification effort */ + } + int simplifyTime = clock_diff() -copyTime; + Relation R2; + if (!SKIP_FULL_CHECK) { + start_clock(); + for (t=1;t<=100;t++) { + R2 = *$2; + R2.finalize(); + R2.simplify(2,4); /* maximal simplification effort */ + } + } + int excessiveTime = clock_diff() - copyTime; + printf("Times (in microseconds): \n"); + printf("%5d us to copy original set of constraints\n",copyTime/100); + printf("%5d us to do the default amount of simplification, obtaining: \n\t", simplifyTime/100); + R.print_with_subs(stdout); + printf("\n"); + if (!SKIP_FULL_CHECK) { + printf("%5d us to do the maximum (i.e., excessive) amount of simplification, obtaining: \n\t", excessiveTime/100); + R2.print_with_subs(stdout); + printf("\n"); + } + if (!anyTimingDone) { + bool warn = false; +#ifndef SPEED + warn =true; +#endif +#ifndef NDEBUG + warn = true; +#endif + if (warn) { + printf("WARNING: The Omega calculator was compiled with options that force\n"); + printf("it to perform additional consistency and error checks\n"); + printf("that may slow it down substantially\n"); + printf("\n"); + } + printf("NOTE: These times relect the time of the current _implementation_\n"); + printf("of our algorithms. Performance bugs do exist. If you intend to publish or \n"); + printf("report on the performance on the Omega test, we respectfully but strongly \n"); + printf("request that send your test cases to us to allow us to determine if the \n"); + printf("times are appropriate, and if the way you are using the Omega library to \n"); + printf("solve your problem is the most effective way.\n"); + printf("\n"); + + printf("Also, please be aware that over the past two years, we have focused our \n"); + printf("efforts on the expressive power of the Omega library, sometimes at the\n"); + printf("expensive of raw speed. Our original implementation of the Omega test\n"); + printf("was substantially faster on the limited domain it handled.\n"); + printf("\n"); + printf(" Thanks, \n"); + printf(" the Omega Team \n"); + } + anyTimingDone = true; + delete $2; +#endif + } + | TIMECLOSURE relation ';' { +#if defined(OMIT_GETRUSAGE) + printf("'timeclosure' requires getrusage, but the omega calclator was compiled with OMIT_GETRUSAGE set!\n"); +#else + flushScanBuffer(); + try { + int t; + Relation R; + ($2)->and_with_GEQ(); + start_clock(); + for (t=1;t<=100;t++) { + R = *$2; + R.finalize(); + } + int copyTime = clock_diff(); + start_clock(); + for (t=1;t<=100;t++) { + R = *$2; + R.finalize(); + R.simplify(); + } + int simplifyTime = clock_diff() -copyTime; + Relation Rclosed; + start_clock(); + for (t=1;t<=100;t++) { + Rclosed = *$2; + Rclosed.finalize(); + Rclosed = TransitiveClosure(Rclosed, 1,Relation::Null()); + } + int closureTime = clock_diff() - copyTime; + Relation R2; + start_clock(); + for (t=1;t<=100;t++) { + R2 = *$2; + R2.finalize(); + R2.simplify(2,4); + } + int excessiveTime = clock_diff() - copyTime; + printf("Times (in microseconds): \n"); + printf("%5d us to copy original set of constraints\n",copyTime/100); + printf("%5d us to do the default amount of simplification, obtaining: \n\t", simplifyTime/100); + R.print_with_subs(stdout); + printf("\n"); + printf("%5d us to do the maximum (i.e., excessive) amount of simplification, obtaining: \n\t", excessiveTime/100); + R2.print_with_subs(stdout); + printf("%5d us to do the transitive closure, obtaining: \n\t", closureTime/100); + Rclosed.print_with_subs(stdout); + printf("\n"); + if (!anyTimingDone) { + bool warn = false; +#ifndef SPEED + warn =true; +#endif +#ifndef NDEBUG + warn = true; +#endif + if (warn) { + printf("WARNING: The Omega calculator was compiled with options that force\n"); + printf("it to perform additional consistency and error checks\n"); + printf("that may slow it down substantially\n"); + printf("\n"); + } + printf("NOTE: These times relect the time of the current _implementation_\n"); + printf("of our algorithms. Performance bugs do exist. If you intend to publish or \n"); + printf("report on the performance on the Omega test, we respectfully but strongly \n"); + printf("request that send your test cases to us to allow us to determine if the \n"); + printf("times are appropriate, and if the way you are using the Omega library to \n"); + printf("solve your problem is the most effective way.\n"); + printf("\n"); + + printf("Also, please be aware that over the past two years, we have focused our \n"); + printf("efforts on the expressive power of the Omega library, sometimes at the\n"); + printf("expensive of raw speed. Our original implementation of the Omega test\n"); + printf("was substantially faster on the limited domain it handled.\n"); + printf("\n"); + printf(" Thanks, \n"); + printf(" the Omega Team \n"); + } + anyTimingDone = true; + } + catch (const std::exception &e) { + std::cout << e.what() << std::endl; + } + delete $2; +#endif + } + | relation SUBSET relation ';' { + flushScanBuffer(); + try { + if (Must_Be_Subset(copy(*$1), copy(*$3))) + std::cout << "True" << std::endl; + else if (Might_Be_Subset(copy(*$1), copy(*$3))) + std::cout << "Possible" << std::endl; + else + std::cout << "False" << std::endl; + } + catch (const std::exception &e) { + std::cout << e.what() << std::endl; + } + delete $1; + delete $3; + } + | CODEGEN effort relPairList context';' { + flushScanBuffer(); + try { + std::string s = MMGenerateCode($3->mappings, $3->ispaces,*$4,$2); + std::cout << s << std::endl; + } + catch (const std::exception &e) { + std::cout << e.what() << std::endl; + } + delete $4; + delete $3; + } + | reachable ';' { + flushScanBuffer(); + Dynamic_Array1 &final = *$1; + bool any_sat = false; + int i,n_nodes = reachable_info->node_names.size(); + for(i = 1; i <= n_nodes; i++) + if(final[i].is_upper_bound_satisfiable()) { + any_sat = true; + std::cout << "Node %s: " << reachable_info->node_names[i]; + final[i].print_with_subs(stdout); + } + if(!any_sat) + std::cout << "No nodes reachable.\n"; + delete $1; + delete reachable_info; + } +; + + +effort : {$$ = 1;} + | INT {$$ = $1;} + | '-' INT {$$ = -$2;} +; + +context : {$$ = new Relation(); *$$ = Relation::Null();} + | GIVEN relation {$$ = $2; } +; + +relPairList : relPairList ',' relation ':' relation { + try { + $1->mappings.append(*$3); + $1->mappings[$1->mappings.size()].compress(); + $1->ispaces.append(*$5); + $1->ispaces[$1->ispaces.size()].compress(); + } + catch (const std::exception &e) { + delete $1; + delete $3; + delete $5; + yyerror(e.what()); + YYERROR; + } + delete $3; + delete $5; + $$ = $1; + } + | relPairList ',' relation { + try { + $1->mappings.append(Identity($3->n_set())); + $1->mappings[$1->mappings.size()].compress(); + $1->ispaces.append(*$3); + $1->ispaces[$1->ispaces.size()].compress(); + } + catch (const std::exception &e) { + delete $1; + delete $3; + yyerror(e.what()); + YYERROR; + } + delete $3; + $$ = $1; + } + | relation ':' relation { + RelTuplePair *rtp = new RelTuplePair; + try { + rtp->mappings.append(*$1); + rtp->mappings[rtp->mappings.size()].compress(); + rtp->ispaces.append(*$3); + rtp->ispaces[rtp->ispaces.size()].compress(); + } + catch (const std::exception &e) { + delete rtp; + delete $1; + delete $3; + yyerror(e.what()); + YYERROR; + } + delete $1; + delete $3; + $$ = rtp; + } + | relation { + RelTuplePair *rtp = new RelTuplePair; + try { + rtp->mappings.append(Identity($1->n_set())); + rtp->mappings[rtp->mappings.size()].compress(); + rtp->ispaces.append(*$1); + rtp->ispaces[rtp->ispaces.size()].compress(); + } + catch (const std::exception &e) { + delete rtp; + delete $1; + yyerror(e.what()); + YYERROR; + } + delete $1; + $$ = rtp; + } +; + +relation : OPEN_BRACE {need_coef = true; relationDecl = new Declaration_Site();} + builtRelation CLOSE_BRACE { + need_coef = false; + $$ = $3; + if (omega_calc_debug) { + fprintf(DebugFile,"Built relation:\n"); + $$->prefix_print(DebugFile); + } + current_Declaration_Site = globalDecls; + delete relationDecl; + relationDecl = NULL; + } + | VAR { + Const_String s = $1; + Relation *r = relationMap(s); + if (r == NULL) { + yyerror(std::string("relation ") + to_string($1) + std::string(" not declared")); + delete []$1; + YYERROR; + } + $$ = new Relation(*r); + delete []$1; + } + | '(' relation ')' {$$ = $2;} + | relation '+' %prec p9 { + $$ = new Relation(); + try { + *$$ = TransitiveClosure(*$1, 1, Relation::Null()); + } + catch (const std::exception &e) { + delete $$; + delete $1; + yyerror(e.what()); + YYERROR; + } + delete $1; + } + | relation '*' %prec p9 { + $$ = new Relation(); + try { + int vars = $1->n_inp(); + *$$ = Union(Identity(vars), TransitiveClosure(*$1, 1, Relation::Null())); + } + catch (const std::exception &e) { + delete $$; + delete $1; + yyerror(e.what()); + YYERROR; + } + delete $1; + } + | relation '+' WITHIN relation %prec p9 { + $$ = new Relation(); + try { + *$$= TransitiveClosure(*$1, 1, *$4); + } + catch (const std::exception &e) { + delete $$; + delete $1; + delete $4; + yyerror(e.what()); + YYERROR; + } + delete $1; + delete $4; + } + | relation '^' '@' %prec p8 { + $$ = new Relation(); + try { + *$$ = ApproxClosure(*$1); + } + catch (const std::exception &e) { + delete $$; + delete $1; + yyerror(e.what()); + YYERROR; + } + delete $1; + } + | relation '^' '+' %prec p8 { + $$ = new Relation(); + try { + *$$ = calculateTransitiveClosure(*$1); + } + catch (const std::exception &e) { + delete $$; + delete $1; + yyerror(e.what()); + YYERROR; + } + delete $1; + } + | MINIMIZE_RANGE relation %prec p8 { + $$ = new Relation(); + try { + Relation o(*$2); + Relation r(*$2); + r = Join(r,LexForward($2->n_out())); + *$$ = Difference(o,r); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | MAXIMIZE_RANGE relation %prec p8 { + $$ = new Relation(); + try { + Relation o(*$2); + Relation r(*$2); + r = Join(r,Inverse(LexForward($2->n_out()))); + *$$ = Difference(o,r); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | MINIMIZE_DOMAIN relation %prec p8 { + $$ = new Relation(); + try { + Relation o(*$2); + Relation r(*$2); + r = Join(LexForward($2->n_inp()),r); + *$$ = Difference(o,r); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | MAXIMIZE_DOMAIN relation %prec p8 { + $$ = new Relation(); + try { + Relation o(*$2); + Relation r(*$2); + r = Join(Inverse(LexForward($2->n_inp())),r); + *$$ = Difference(o,r); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | MAXIMIZE relation %prec p8 { + $$ = new Relation(); + try { + Relation c(*$2); + Relation r(*$2); + *$$ = Cross_Product(Relation(*$2),c); + *$$ = Difference(r,Domain(Intersection(*$$,LexForward($$->n_inp())))); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | MINIMIZE relation %prec p8 { + $$ = new Relation(); + try { + Relation c(*$2); + Relation r(*$2); + *$$ = Cross_Product(Relation(*$2),c); + *$$ = Difference(r,Range(Intersection(*$$,LexForward($$->n_inp())))); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | FARKAS relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Farkas(*$2, Basic_Farkas); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | DECOUPLED_FARKAS relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Farkas(*$2, Decoupled_Farkas); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | relation '@' %prec p9 { + $$ = new Relation(); + try { + *$$ = ConicClosure(*$1); + } + catch (const std::exception &e) { + delete $$; + delete $1; + yyerror(e.what()); + YYERROR; + } + delete $1; + } + | PROJECT_AWAY_SYMBOLS relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Project_Sym(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | PROJECT_ON_SYMBOLS relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Project_On_Sym(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | DIFFERENCE relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Deltas(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | DIFFERENCE_TO_RELATION relation %prec p8 { + $$ = new Relation(); + try { + *$$ = DeltasToRelation(*$2,$2->n_set(),$2->n_set()); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | DOMAIN relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Domain(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | VENN relation %prec p8 { + $$ = new Relation(); + try { + *$$ = VennDiagramForm(*$2,Relation::True(*$2)); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | VENN relation GIVEN relation %prec p8 { + $$ = new Relation(); + try { + *$$ = VennDiagramForm(*$2,*$4); + } + catch (const std::exception &e) { + delete $$; + delete $2; + delete $4; + yyerror(e.what()); + YYERROR; + } + delete $2; + delete $4; + } + | CONVEX_HULL relation %prec p8 { + $$ = new Relation(); + try { + *$$ = ConvexHull(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | DECOUPLED_CONVEX_HULL relation %prec p8 { + $$ = new Relation(); + try { + *$$ = DecoupledConvexHull(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | POSITIVE_COMBINATION relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Farkas(*$2,Positive_Combination_Farkas); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | LINEAR_COMBINATION relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Farkas(*$2,Linear_Combination_Farkas); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | AFFINE_COMBINATION relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Farkas(*$2,Affine_Combination_Farkas); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | CONVEX_COMBINATION relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Farkas(*$2,Convex_Combination_Farkas); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | PAIRWISE_CHECK relation %prec p8 { + $$ = new Relation(); + try { + *$$ = CheckForConvexRepresentation(CheckForConvexPairs(*$2)); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | CONVEX_CHECK relation %prec p8 { + $$ = new Relation(); + try { + *$$ = CheckForConvexRepresentation(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | CONVEX_REPRESENTATION relation %prec p8 { + $$ = new Relation(); + try { + *$$ = ConvexRepresentation(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | AFFINE_HULL relation %prec p8 { + $$ = new Relation(); + try { + *$$ = AffineHull(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | CONIC_HULL relation %prec p8 { + $$ = new Relation(); + try { + *$$ = ConicHull(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | LINEAR_HULL relation %prec p8 { + $$ = new Relation(); + try { + *$$ = LinearHull(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | QUICK_HULL relation %prec p8 { + $$ = new Relation(); + try { + *$$ = QuickHull(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | RECT_HULL relation %prec p8 { + $$ = new Relation(); + try { + *$$ = RectHull(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | HULL relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Hull(*$2,false,1,Relation::Null()); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | HULL relation GIVEN relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Hull(*$2,false,1,*$4); + } + catch (const std::exception &e) { + delete $$; + delete $2; + delete $4; + yyerror(e.what()); + YYERROR; + } + delete $2; + delete $4; + } + | APPROX relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Approximate(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | RANGE relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Range(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | INVERSE relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Inverse(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | COMPLEMENT relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Complement(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | GIST relation GIVEN relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Gist(*$2,*$4,1); + } + catch (const std::exception &e) { + delete $$; + delete $2; + delete $4; + yyerror(e.what()); + YYERROR; + } + delete $2; + delete $4; + } + | relation '(' relation ')' { + $$ = new Relation(); + try { + *$$ = Composition(*$1,*$3); + } + catch (const std::exception &e) { + delete $$; + delete $1; + delete $3; + yyerror(e.what()); + YYERROR; + } + delete $1; + delete $3; + } + | relation COMPOSE relation { + $$ = new Relation(); + try { + *$$ = Composition(*$1,*$3); + } + catch (const std::exception &e) { + delete $$; + delete $1; + delete $3; + yyerror(e.what()); + YYERROR; + } + delete $1; + delete $3; + } + | relation CARRIED_BY INT { + $$ = new Relation(); + try { + *$$ = After(*$1,$3,$3); + (*$$).prefix_print(stdout); + } + catch (const std::exception &e) { + delete $$; + delete $1; + yyerror(e.what()); + YYERROR; + } + delete $1; + } + | relation JOIN relation { + $$ = new Relation(); + try { + *$$ = Composition(*$3,*$1); + } + catch (const std::exception &e) { + delete $$; + delete $1; + delete $3; + yyerror(e.what()); + YYERROR; + } + delete $1; + delete $3; + } + | relation RESTRICT_RANGE relation { + $$ = new Relation(); + try { + *$$ = Restrict_Range(*$1,*$3); + } + catch (const std::exception &e) { + delete $$; + delete $1; + delete $3; + yyerror(e.what()); + YYERROR; + } + delete $1; + delete $3; + } + | relation RESTRICT_DOMAIN relation { + $$ = new Relation(); + try { + *$$ = Restrict_Domain(*$1,*$3); + } + catch (const std::exception &e) { + delete $$; + delete $1; + delete $3; + yyerror(e.what()); + YYERROR; + } + delete $1; + delete $3; + } + | relation INTERSECTION relation { + $$ = new Relation(); + try { + *$$ = Intersection(*$1,*$3); + } + catch (const std::exception &e) { + delete $$; + delete $1; + delete $3; + yyerror(e.what()); + YYERROR; + } + delete $1; + delete $3; + } + | relation '-' relation %prec INTERSECTION { + $$ = new Relation(); + try { + *$$ = Difference(*$1,*$3); + } + catch (const std::exception &e) { + delete $$; + delete $1; + delete $3; + yyerror(e.what()); + YYERROR; + } + delete $1; + delete $3; + } + | relation UNION relation { + $$ = new Relation(); + try { + *$$ = Union(*$1,*$3); + } + catch (const std::exception &e) { + delete $$; + delete $1; + delete $3; + yyerror(e.what()); + YYERROR; + } + delete $1; + delete $3; + } + | relation '*' relation { + $$ = new Relation(); + try { + *$$ = Cross_Product(*$1,*$3); + } + catch (const std::exception &e) { + delete $$; + delete $1; + delete $3; + yyerror(e.what()); + YYERROR; + } + delete $1; + delete $3; + } + | SUPERSETOF relation { + $$ = new Relation(); + try { + *$$ = Union(*$2, Relation::Unknown(*$2)); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | SUBSETOF relation { + $$ = new Relation(); + try { + *$$ = Intersection(*$2, Relation::Unknown(*$2)); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | MAKE_UPPER_BOUND relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Upper_Bound(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | MAKE_LOWER_BOUND relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Lower_Bound(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | SAMPLE relation { + $$ = new Relation(); + try { + *$$ = Sample_Solution(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | SYM_SAMPLE relation { + $$ = new Relation(); + try { + *$$ = Symbolic_Solution(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | reachable_of { $$ = $1; } + | ASSERT_UNSAT relation { + if (($2)->is_satisfiable()) { + fprintf(stderr,"assert_unsatisfiable failed on "); + ($2)->print_with_subs(stderr); + exit(1); + } + $$=$2; + } +; + +builtRelation : tupleDeclaration GOES_TO {currentTuple = Output_Tuple;} + tupleDeclaration {currentTuple = Input_Tuple;} optionalFormula { + Relation * r = new Relation($1->size,$4->size); + resetGlobals(); + F_And *f = r->add_and(); + for(int i=1;i<=$1->size;i++) { + $1->vars[i]->vid = r->input_var(i); + if (!$1->vars[i]->anonymous) + r->name_input_var(i,$1->vars[i]->stripped_name); + } + for(int i=1;i<=$4->size;i++) { + $4->vars[i]->vid = r->output_var(i); + if (!$4->vars[i]->anonymous) + r->name_output_var(i,$4->vars[i]->stripped_name); + } + r->setup_names(); + foreach(e,Exp*,$1->eq_constraints, install_eq(f,e,0)); + foreach(e,Exp*,$1->geq_constraints, install_geq(f,e,0)); + foreach(c,strideConstraint*,$1->stride_constraints, install_stride(f,c)); + foreach(e,Exp*,$4->eq_constraints, install_eq(f,e,0)); + foreach(e,Exp*,$4->geq_constraints, install_geq(f,e,0)); + foreach(c,strideConstraint*,$4->stride_constraints, install_stride(f,c)); + if ($6) $6->install(f); + delete $1; + delete $4; + delete $6; + $$ = r; + } + | tupleDeclaration optionalFormula { + Relation * r = new Relation($1->size); + resetGlobals(); + F_And *f = r->add_and(); + for(int i=1;i<=$1->size;i++) { + $1->vars[i]->vid = r->set_var(i); + if (!$1->vars[i]->anonymous) + r->name_set_var(i,$1->vars[i]->stripped_name); + } + r->setup_names(); + foreach(e,Exp*,$1->eq_constraints, install_eq(f,e,0)); + foreach(e,Exp*,$1->geq_constraints, install_geq(f,e,0)); + foreach(c,strideConstraint*,$1->stride_constraints, install_stride(f,c)); + if ($2) $2->install(f); + delete $1; + delete $2; + $$ = r; + } + | formula { + Relation * r = new Relation(0,0); + F_And *f = r->add_and(); + $1->install(f); + delete $1; + $$ = r; + } +; + +optionalFormula : formula_sep formula {$$ = $2;} + | {$$ = 0;} +; + +formula_sep : ':' + | VERTICAL_BAR + | SUCH_THAT +; + +tupleDeclaration : {currentTupleDescriptor = new tupleDescriptor; tuplePos = 1;} + '[' optionalTupleVarList ']' + {$$ = currentTupleDescriptor; tuplePos = 0;} +; + +optionalTupleVarList : /* empty */ + | tupleVar + | optionalTupleVarList ',' tupleVar +; + +tupleVar : VAR %prec p10 { + Declaration_Site *ds = defined($1); + if (!ds) + currentTupleDescriptor->extend($1,currentTuple,tuplePos); + else { + Variable_Ref *v = lookupScalar($1); + if (v == NULL) { + yyerror(std::string("cannot find declaration for variable ") + to_string($1)); + delete []$1; + YYERROR; + } + if (ds != globalDecls) + currentTupleDescriptor->extend($1, new Exp(v)); + else + currentTupleDescriptor->extend(new Exp(v)); + } + tuplePos++; + delete []$1; + } + | '*' {currentTupleDescriptor->extend(); tuplePos++;} + | exp %prec p1 { + currentTupleDescriptor->extend($1); + tuplePos++; + } + | exp ':' exp %prec p1 { + currentTupleDescriptor->extend($1,$3); + tuplePos++; + } + | exp ':' exp ':' COEF %prec p1 { + currentTupleDescriptor->extend($1,$3,$5); + tuplePos++; + } +; + +varList : varList ',' VAR {$$ = $1; $$->insert($3); $3 = NULL;} + | VAR {$$ = new VarList; $$->insert($1); $1 = NULL;} +; + +varDecl : varList { + $$ = current_Declaration_Site = new Declaration_Site($1); + foreach(s,char *, *$1, delete []s); + delete $1; + } +; + +varDeclOptBrackets : varDecl {$$ = $1;} + |'[' varDecl ']' {$$ = $2;} +; + +globVarList : globVarList ',' globVar + | globVar +; + +globVar : VAR '(' INT ')' {globalDecls->extend_both_tuples($1, $3); delete []$1;} + | VAR { + globalDecls->extend($1); + delete []$1; + } +; + +formula : formula AND formula {$$ = new AST_And($1,$3);} + | formula OR formula {$$ = new AST_Or($1,$3);} + | constraintChain {$$ = $1;} + | '(' formula ')' {$$ = $2;} + | NOT formula {$$ = new AST_Not($2);} + | start_exists varDeclOptBrackets exists_sep formula end_quant {$$ = new AST_exists($2,$4);} + | start_forall varDeclOptBrackets forall_sep formula end_quant {$$ = new AST_forall($2,$4);} +; + +start_exists : '(' EXISTS + | EXISTS '(' +; + +exists_sep : ':' + | VERTICAL_BAR + | SUCH_THAT +; + +start_forall : '(' FORALL + | FORALL '(' +; + +forall_sep : ':' +; + +end_quant : ')' {popScope();} +; + +expList : exp ',' expList {$$ = $3; $$->insert($1);} + | exp {$$ = new ExpList; $$->insert($1);} +; + +constraintChain : expList REL_OP expList {$$ = new AST_constraints($1,$2,$3);} + | expList REL_OP constraintChain {$$ = new AST_constraints($1,$2,$3);} +; + +simpleExp : VAR %prec p9 { + Variable_Ref *v = lookupScalar($1); + if (v == NULL) { + yyerror(std::string("cannot find declaration for variable ") + to_string($1)); + delete []$1; + YYERROR; + } + $$ = new Exp(v); + delete []$1; + } + | VAR '(' {argCount = 1;} argumentList ')' %prec p9 { + Variable_Ref *v; + if ($4 == Input_Tuple) + v = functionOfInput[$1]; + else + v = functionOfOutput[$1]; + if (v == NULL) { + yyerror(std::string("Function ") + to_string($1) + std::string(" not declared")); + delete []$1; + YYERROR; + } + $$ = new Exp(v); + delete []$1; + } + | '(' exp ')' { $$ = $2; } +; + +argumentList : argumentList ',' VAR { + Variable_Ref *v = lookupScalar($3); + if (v == NULL) { + yyerror(std::string("cannot find declaration for variable ") + to_string($1)); + delete []$3; + YYERROR; + } + if (v->pos != argCount || v->of != $1 || (v->of != Input_Tuple && v->of != Output_Tuple)) { + yyerror("arguments to function must be prefix of input or output tuple"); + delete []$3; + YYERROR; + } + $$ = v->of; + argCount++; + delete []$3; + } + | VAR { + Variable_Ref *v = lookupScalar($1); + if (v == NULL) { + yyerror(std::string("cannot find declaration for variable ") + to_string($1)); + delete []$1; + YYERROR; + } + if (v->pos != argCount || (v->of != Input_Tuple && v->of != Output_Tuple)) { + yyerror("arguments to function must be prefix of input or output tuple"); + delete []$1; + YYERROR; + } + $$ = v->of; + argCount++; + delete []$1; + } +; + +exp : COEF {$$ = new Exp($1);} + | COEF simpleExp %prec '*' {$$ = multiply($1,$2);} + | simpleExp {$$ = $1; } + | '-' exp %prec '*' {$$ = negate($2);} + | exp '+' exp {$$ = add($1,$3);} + | exp '-' exp {$$ = subtract($1,$3);} + | exp '*' exp {$$ = multiply($1,$3);} +; + + +reachable : REACHABLE_FROM nodeNameList nodeSpecificationList { + Dynamic_Array1 *final = Reachable_Nodes(reachable_info); + $$ = final; + } +; + +reachable_of : REACHABLE_OF VAR IN nodeNameList nodeSpecificationList { + Dynamic_Array1 *final = Reachable_Nodes(reachable_info); + int index = reachable_info->node_names.index(std::string($2)); + if (index == 0) { + yyerror(std::string("no such node ") + to_string($2)); + delete []$2; + delete final; + delete reachable_info; + YYERROR; + } + $$ = new Relation; + *$$ = (*final)[index]; + delete final; + delete reachable_info; + delete []$2; + } +; + +nodeNameList : '(' realNodeNameList ')' { + int sz = reachable_info->node_names.size(); + reachable_info->node_arity.reallocate(sz); + reachable_info->transitions.resize(sz+1,sz+1); + reachable_info->start_nodes.resize(sz+1); + } +; + +realNodeNameList : realNodeNameList ',' VAR { + reachable_info->node_names.append(std::string($3)); + delete []$3; + } + | VAR { + reachable_info = new reachable_information; + reachable_info->node_names.append(std::string($1)); + delete []$1; + } +; + + +nodeSpecificationList : OPEN_BRACE realNodeSpecificationList CLOSE_BRACE { + int i,j; + int n_nodes = reachable_info->node_names.size(); + Tuple &arity = reachable_info->node_arity; + Dynamic_Array2 &transitions = reachable_info->transitions; + + /* fixup unspecified transitions to be false */ + /* find arity */ + for(i = 1; i <= n_nodes; i++) arity[i] = -1; + for(i = 1; i <= n_nodes; i++) + for(j = 1; j <= n_nodes; j++) + if(! transitions[i][j].is_null()) { + int in_arity = transitions[i][j].n_inp(); + int out_arity = transitions[i][j].n_out(); + if(arity[i] < 0) arity[i] = in_arity; + if(arity[j] < 0) arity[j] = out_arity; + if(in_arity != arity[i] || out_arity != arity[j]) { + yyerror(std::string("arity mismatch in node transition: ") + to_string(reachable_info->node_names[i]) + std::string(" -> ") + to_string(reachable_info->node_names[j])); + delete reachable_info; + YYERROR; + } + } + for(i = 1; i <= n_nodes; i++) + if(arity[i] < 0) arity[i] = 0; + /* Fill in false relations */ + for(i = 1; i <= n_nodes; i++) + for(j = 1; j <= n_nodes; j++) + if(transitions[i][j].is_null()) + transitions[i][j] = Relation::False(arity[i],arity[j]); + + /* fixup unused start node positions */ + Dynamic_Array1 &nodes = reachable_info->start_nodes; + for(i = 1; i <= n_nodes; i++) + if(nodes[i].is_null()) + nodes[i] = Relation::False(arity[i]); + else + if(nodes[i].n_set() != arity[i]){ + yyerror(std::string("arity mismatch in start node ") + to_string(reachable_info->node_names[i])); + delete reachable_info; + YYERROR; + } + } +; + +realNodeSpecificationList : realNodeSpecificationList ',' VAR ':' relation { + int n_nodes = reachable_info->node_names.size(); + int index = reachable_info->node_names.index($3); + if (!(index > 0 && index <= n_nodes)) { + yyerror(std::string("no such node ")+to_string($3)); + delete $5; + delete []$3; + delete reachable_info; + YYERROR; + } + reachable_info->start_nodes[index] = *$5; + delete $5; + delete []$3; + } + | realNodeSpecificationList ',' VAR GOES_TO VAR ':' relation { + int n_nodes = reachable_info->node_names.size(); + int from_index = reachable_info->node_names.index($3); + if (!(from_index > 0 && from_index <= n_nodes)) { + yyerror(std::string("no such node ")+to_string($3)); + delete $7; + delete []$3; + delete []$5; + delete reachable_info; + YYERROR; + } + int to_index = reachable_info->node_names.index($5); + if (!(to_index > 0 && to_index <= n_nodes)) { + yyerror(std::string("no such node ")+to_string($5)); + delete $7; + delete []$3; + delete []$5; + delete reachable_info; + YYERROR; + } + reachable_info->transitions[from_index][to_index] = *$7; + delete $7; + delete []$3; + delete []$5; + } + | VAR GOES_TO VAR ':' relation { + int n_nodes = reachable_info->node_names.size(); + int from_index = reachable_info->node_names.index($1); + if (!(from_index > 0 && from_index <= n_nodes)) { + yyerror(std::string("no such node ")+to_string($1)); + delete $5; + delete []$1; + delete []$3; + delete reachable_info; + YYERROR; + } + int to_index = reachable_info->node_names.index($3); + if (!(to_index > 0 && to_index <= n_nodes)) { + yyerror(std::string("no such node ")+to_string($3)); + delete $5; + delete []$1; + delete []$3; + delete reachable_info; + YYERROR; + } + reachable_info->transitions[from_index][to_index] = *$5; + delete $5; + delete []$1; + delete []$3; + } + | VAR ':' relation { + int n_nodes = reachable_info->node_names.size(); + int index = reachable_info->node_names.index($1); + if (!(index > 0 && index <= n_nodes)) { + yyerror(std::string("no such node ")+to_string($1)); + delete $3; + delete []$1; + delete reachable_info; + YYERROR; + } + reachable_info->start_nodes[index] = *$3; + delete $3; + delete []$1; + } +; + +%% + + +void printUsage(FILE *outf, char **argv) { + fprintf(outf, "usage: %s {-R} {-D[facility][level]...} infile\n -R means skip redundant conjunct elimination\n -D sets debugging level as follows:\n a = all debugging flags\n g = code generation\n l = calculator\n c = omega core\n p = presburger functions\n r = relational operators\n t = transitive closure\n", argv[0]); +} + + +bool process_calc_debugging_flags(char *arg,int &j) { + char debug_type; + while((debug_type=arg[j]) != 0) { + j++; + int level; + if(isdigit(arg[j])) + level = (arg[j++]) - '0'; + else + if(arg[j] == 0 || isalpha(arg[j])) + level = 1; + else + return false; + if (level < 0 || level > 4) { + fprintf(stderr,"Debug level %c out of range: %d\n", debug_type, level); + return false; + } + switch(debug_type) { + case 'a': + omega_core_debug = relation_debug = hull_debug = + closure_presburger_debug = + farkas_debug = + pres_debug = omega_calc_debug = code_gen_debug = level; + break; + case 'g': + code_gen_debug = level; break; + case 'f': + farkas_debug = level; break; + case 'h': + hull_debug = level; break; + case 'c': + omega_core_debug = level; break; + case 'r': + relation_debug = level; break; + case 'p': + pres_debug = level; break; + case 't': + closure_presburger_debug = level; break; + case 'l': + omega_calc_debug = level; break; +#if defined STUDY_EVACUATIONS + case 'e': + evac_debug = level; break; +#endif + default: + fprintf(stderr, "Unknown debug type %c\n", debug_type); + return false; + } + } + return true; +} + + +int main(int argc, char **argv) { +#if YYDEBUG != 0 + yydebug = 1; +#endif + + /* process flags */ + char *fileName = 0; + for(int i=1; iadd_and(); + for(int j=1;jadd_EQ(); + e.update_coef(r.input_var(j),-1); + e.update_coef(r.output_var(j),1); + e.finalize(); + } + GEQ_Handle e = g->add_GEQ(); + e.update_coef(r.input_var(i),-1); + e.update_coef(r.output_var(i),1); + e.update_const(-1); + e.finalize(); + } + r.finalize(); + return r; +} diff --git a/omegalib/omega_calc/src/parser.yy b/omegalib/omega_calc/src/parser.yy new file mode 100755 index 0000000..cad6e8e --- /dev/null +++ b/omegalib/omega_calc/src/parser.yy @@ -0,0 +1,1928 @@ +/***************************************************************************** + Copyright (C) 1994-2000 the Omega Project Team + Copyright (C) 2005-2011 Chun Chen + All Rights Reserved. + + Purpose: + yacc parser for calculator. + + Notes: + + History: + 02/04/11 work with flex c++ mode, Chun Chen +*****************************************************************************/ + +%{ +//#define YYDEBUG 1 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "parser.tab.hh" +#include +//#include + +#if defined __USE_POSIX +#include +#elif defined __WIN32 +#include +#endif + + +#ifndef WIN32 +#include +#include +#endif +#if !defined(OMIT_GETRUSAGE) +#include +#include +#include +#endif + +#if !defined(OMIT_GETRUSAGE) +#ifdef __sparc__ +extern "C" int getrusage (int, struct rusage*); +#endif + + + + +struct rusage start_time; +bool anyTimingDone = false; + +void start_clock( void ) { + getrusage(RUSAGE_SELF, &start_time); +} + +int clock_diff( void ) { + struct rusage current_time; + getrusage(RUSAGE_SELF, ¤t_time); + return (current_time.ru_utime.tv_sec -start_time.ru_utime.tv_sec)*1000000 + (current_time.ru_utime.tv_usec-start_time.ru_utime.tv_usec); +} +#endif + + +#ifdef BUILD_CODEGEN +#include +#endif + +extern myFlexLexer mylexer; +#define yylex mylexer.yylex + + + + +int omega_calc_debug = 0; + +extern bool is_interactive; +extern const char *PROMPT_STRING; +bool simplify = true; +using namespace omega; + +extern std::string err_msg; + +bool need_coef; + +namespace { + int redundant_conj_level = 2; // default maximum 2 + int redundant_constr_level = 4; // default maximum 4 +} + +std::map relationMap; +int argCount = 0; +int tuplePos = 0; +Argument_Tuple currentTuple = Input_Tuple; + +Relation LexForward(int n); +reachable_information *reachable_info; + +void yyerror(const std::string &s); +void flushScanBuffer(); + +%} + +%union { + int INT_VALUE; + omega::coef_t COEF_VALUE; + Rel_Op REL_OPERATOR; + char *VAR_NAME; + std::set *VAR_LIST; + Exp *EXP; + std::set *EXP_LIST; + AST *ASTP; + omega::Argument_Tuple ARGUMENT_TUPLE; + AST_constraints *ASTCP; + Declaration_Site *DECLARATION_SITE; + omega::Relation *RELATION; + tupleDescriptor *TUPLE_DESCRIPTOR; + std::pair, std::vector > *REL_TUPLE_PAIR; + omega::Dynamic_Array1 * RELATION_ARRAY_1D; + std::string *STRING_VALUE; +} + +%token VAR +%token INT +%token COEF +%token STRING +%token OPEN_BRACE CLOSE_BRACE +%token SYMBOLIC NO_SIMPLIFY +%token OR AND NOT +%token ST APPROX +%token IS_ASSIGNED +%token FORALL EXISTS +%token DOMAIN RANGE +%token DIFFERENCE DIFFERENCE_TO_RELATION +%token GIST GIVEN HULL WITHIN MAXIMIZE MINIMIZE +%token AFFINE_HULL VENN CONVEX_COMBINATION POSITIVE_COMBINATION LINEAR_COMBINATION AFFINE_COMBINATION CONVEX_HULL CONIC_HULL LINEAR_HULL QUICK_HULL PAIRWISE_CHECK CONVEX_CHECK CONVEX_REPRESENTATION RECT_HULL SIMPLE_HULL DECOUPLED_CONVEX_HULL +%token MAXIMIZE_RANGE MINIMIZE_RANGE +%token MAXIMIZE_DOMAIN MINIMIZE_DOMAIN +%token LEQ GEQ NEQ +%token GOES_TO +%token COMPOSE JOIN INVERSE COMPLEMENT IN CARRIED_BY TIME TIMECLOSURE +%token UNION INTERSECTION +%token VERTICAL_BAR SUCH_THAT +%token SUBSET CODEGEN DECOUPLED_FARKAS FARKAS +%token MAKE_UPPER_BOUND MAKE_LOWER_BOUND +%token REL_OP +%token RESTRICT_DOMAIN RESTRICT_RANGE +%token SUPERSETOF SUBSETOF SAMPLE SYM_SAMPLE +%token PROJECT_AWAY_SYMBOLS PROJECT_ON_SYMBOLS REACHABLE_FROM REACHABLE_OF +%token ASSERT_UNSAT +%token PARSE_EXPRESSION PARSE_FORMULA PARSE_RELATION + +%type exp simpleExp +%type expList +%type varList +%type argumentList +%type formula optionalFormula +%type constraintChain +%type tupleDeclaration +%type varDecl varDeclOptBrackets +%type relation builtRelation context +%type reachable_of +%type relPairList +%type reachable + +%destructor {delete []$$;} VAR +%destructor {delete $$;} STRING +%destructor {delete $$;} relation builtRelation tupleDeclaration formula optionalFormula context reachable_of constraintChain varDecl varDeclOptBrackets relPairList reachable +%destructor {delete $$;} exp simpleExp +%destructor { + for (std::set::iterator i = $$->begin(); i != $$->end(); i++) + delete *i; + delete $$; + } expList; +%destructor { + for (std::set::iterator i = $$->begin(); i != $$->end(); i++) + delete []*i; + delete $$; + } varList; + +%nonassoc ASSERT_UNSAT +%left UNION p1 '+' '-' +%nonassoc SUPERSETOF SUBSETOF +%left p2 RESTRICT_DOMAIN RESTRICT_RANGE +%left INTERSECTION p3 '*' '@' +%left p4 +%left OR p5 +%left AND p6 +%left COMPOSE JOIN CARRIED_BY +%right NOT APPROX DOMAIN RANGE HULL PROJECT_AWAY_SYMBOLS PROJECT_ON_SYMBOLS DIFFERENCE DIFFERENCE_TO_RELATION INVERSE COMPLEMENT FARKAS SAMPLE SYM_SAMPLE MAKE_UPPER_BOUND MAKE_LOWER_BOUND p7 +%left p8 +%nonassoc GIVEN +%left p9 +%left '(' p10 + +%% + +inputSequence : /*empty*/ + | inputSequence { assert( current_Declaration_Site == globalDecls);} + inputItem; +; + +inputItem : ';' /*empty*/ + | NO_SIMPLIFY ';'{ + simplify = false; + } + | error ';' { + flushScanBuffer(); + std::cout << err_msg; + err_msg.clear(); + current_Declaration_Site = globalDecls; + need_coef = false; + std::cout << "...skipping to statement end..." << std::endl; + delete relationDecl; + relationDecl = NULL; + } + | SYMBOLIC globVarList ';' {flushScanBuffer();} + | VAR IS_ASSIGNED relation ';' { + flushScanBuffer(); + try { + if(simplify) + $3->simplify(redundant_conj_level, redundant_constr_level); + else + $3->simplify(); + Relation *r = relationMap[std::string($1)]; + if (r != NULL) delete r; + relationMap[std::string($1)] = $3; + } + catch(const std::exception &e){ + std::cout << e.what() << std::endl; + } + + delete []$1; + } + | relation ';' { + flushScanBuffer(); + if(simplify) + $1->simplify(redundant_conj_level, redundant_constr_level); + else + $1->simplify(); + $1->print_with_subs(stdout); + delete $1; + } + | TIME relation ';' { +#if defined(OMIT_GETRUSAGE) + printf("'time' requires getrusage, but the omega calclator was compiled with OMIT_GETRUSAGE set!\n"); +#else + flushScanBuffer(); + printf("\n"); + int t; + Relation R; + bool SKIP_FULL_CHECK = getenv("OC_TIMING_SKIP_FULL_CHECK"); + ($2)->and_with_GEQ(); + start_clock(); + for (t=1;t<=100;t++) { + R = *$2; + R.finalize(); + } + int copyTime = clock_diff(); + start_clock(); + for (t=1;t<=100;t++) { + R = *$2; + R.finalize(); + R.simplify(); /* default simplification effort */ + } + int simplifyTime = clock_diff() -copyTime; + Relation R2; + if (!SKIP_FULL_CHECK) { + start_clock(); + for (t=1;t<=100;t++) { + R2 = *$2; + R2.finalize(); + R2.simplify(2,4); /* maximal simplification effort */ + } + } + int excessiveTime = clock_diff() - copyTime; + printf("Times (in microseconds): \n"); + printf("%5d us to copy original set of constraints\n",copyTime/100); + printf("%5d us to do the default amount of simplification, obtaining: \n\t", simplifyTime/100); + R.print_with_subs(stdout); + printf("\n"); + if (!SKIP_FULL_CHECK) { + printf("%5d us to do the maximum (i.e., excessive) amount of simplification, obtaining: \n\t", excessiveTime/100); + R2.print_with_subs(stdout); + printf("\n"); + } + if (!anyTimingDone) { + bool warn = false; +#ifndef SPEED + warn =true; +#endif +#ifndef NDEBUG + warn = true; +#endif + if (warn) { + printf("WARNING: The Omega calculator was compiled with options that force\n"); + printf("it to perform additional consistency and error checks\n"); + printf("that may slow it down substantially\n"); + printf("\n"); + } + printf("NOTE: These times relect the time of the current _implementation_\n"); + printf("of our algorithms. Performance bugs do exist. If you intend to publish or \n"); + printf("report on the performance on the Omega test, we respectfully but strongly \n"); + printf("request that send your test cases to us to allow us to determine if the \n"); + printf("times are appropriate, and if the way you are using the Omega library to \n"); + printf("solve your problem is the most effective way.\n"); + printf("\n"); + + printf("Also, please be aware that over the past two years, we have focused our \n"); + printf("efforts on the expressive power of the Omega library, sometimes at the\n"); + printf("expensive of raw speed. Our original implementation of the Omega test\n"); + printf("was substantially faster on the limited domain it handled.\n"); + printf("\n"); + printf(" Thanks, \n"); + printf(" the Omega Team \n"); + } + anyTimingDone = true; + delete $2; +#endif + } + | TIMECLOSURE relation ';' { +#if defined(OMIT_GETRUSAGE) + printf("'timeclosure' requires getrusage, but the omega calclator was compiled with OMIT_GETRUSAGE set!\n"); +#else + flushScanBuffer(); + try { + int t; + Relation R; + ($2)->and_with_GEQ(); + start_clock(); + for (t=1;t<=100;t++) { + R = *$2; + R.finalize(); + } + int copyTime = clock_diff(); + start_clock(); + for (t=1;t<=100;t++) { + R = *$2; + R.finalize(); + R.simplify(); + } + int simplifyTime = clock_diff() -copyTime; + Relation Rclosed; + start_clock(); + for (t=1;t<=100;t++) { + Rclosed = *$2; + Rclosed.finalize(); + Rclosed = TransitiveClosure(Rclosed, 1,Relation::Null()); + } + int closureTime = clock_diff() - copyTime; + Relation R2; + start_clock(); + for (t=1;t<=100;t++) { + R2 = *$2; + R2.finalize(); + R2.simplify(2,4); + } + int excessiveTime = clock_diff() - copyTime; + printf("Times (in microseconds): \n"); + printf("%5d us to copy original set of constraints\n",copyTime/100); + printf("%5d us to do the default amount of simplification, obtaining: \n\t", simplifyTime/100); + R.print_with_subs(stdout); + printf("\n"); + printf("%5d us to do the maximum (i.e., excessive) amount of simplification, obtaining: \n\t", excessiveTime/100); + R2.print_with_subs(stdout); + printf("%5d us to do the transitive closure, obtaining: \n\t", closureTime/100); + Rclosed.print_with_subs(stdout); + printf("\n"); + if (!anyTimingDone) { + bool warn = false; +#ifndef SPEED + warn =true; +#endif +#ifndef NDEBUG + warn = true; +#endif + if (warn) { + printf("WARNING: The Omega calculator was compiled with options that force\n"); + printf("it to perform additional consistency and error checks\n"); + printf("that may slow it down substantially\n"); + printf("\n"); + } + printf("NOTE: These times relect the time of the current _implementation_\n"); + printf("of our algorithms. Performance bugs do exist. If you intend to publish or \n"); + printf("report on the performance on the Omega test, we respectfully but strongly \n"); + printf("request that send your test cases to us to allow us to determine if the \n"); + printf("times are appropriate, and if the way you are using the Omega library to \n"); + printf("solve your problem is the most effective way.\n"); + printf("\n"); + + printf("Also, please be aware that over the past two years, we have focused our \n"); + printf("efforts on the expressive power of the Omega library, sometimes at the\n"); + printf("expensive of raw speed. Our original implementation of the Omega test\n"); + printf("was substantially faster on the limited domain it handled.\n"); + printf("\n"); + printf(" Thanks, \n"); + printf(" the Omega Team \n"); + } + anyTimingDone = true; + } + catch (const std::exception &e) { + std::cout << e.what() << std::endl; + } + delete $2; +#endif + } + | relation SUBSET relation ';' { + flushScanBuffer(); + try { + if (Must_Be_Subset(copy(*$1), copy(*$3))) + std::cout << "True" << std::endl; + else if (Might_Be_Subset(copy(*$1), copy(*$3))) + std::cout << "Possible" << std::endl; + else + std::cout << "False" << std::endl; + } + catch (const std::exception &e) { + std::cout << e.what() << std::endl; + } + delete $1; + delete $3; + } + | CODEGEN relPairList context';' { + flushScanBuffer(); +#ifdef BUILD_CODEGEN + try { + CodeGen cg($2->first, $2->second, *$3); + CG_result *cgr = cg.buildAST(); + if (cgr != NULL) { + std::string s = cgr->printString(); + std::cout << s << std::endl; + delete cgr; + } + else + std::cout << "/* empty */" << std::endl; + } + catch (const std::exception &e) { + std::cout << e.what() << std::endl; + } +#else + std::cout << "CodeGen package not built" << std::endl; +#endif + delete $3; + delete $2; + } + | CODEGEN INT relPairList context';' { + flushScanBuffer(); +#ifdef BUILD_CODEGEN + try { + CodeGen cg($3->first, $3->second, *$4); + CG_result *cgr = cg.buildAST($2); + if (cgr != NULL) { + std::string s = cgr->printString(); + std::cout << s << std::endl; + delete cgr; + } + else + std::cout << "/* empty */" << std::endl; + } + catch (const std::exception &e) { + std::cout << e.what() << std::endl; + } +#else + std::cout << "CodeGen package not built" << std::endl; +#endif + delete $4; + delete $3; + } + | reachable ';' { + flushScanBuffer(); + Dynamic_Array1 &final = *$1; + bool any_sat = false; + int i,n_nodes = reachable_info->node_names.size(); + for(i = 1; i <= n_nodes; i++) + if(final[i].is_upper_bound_satisfiable()) { + any_sat = true; + std::cout << "Node " << reachable_info->node_names[i] << ": "; + final[i].print_with_subs(stdout); + } + if(!any_sat) + std::cout << "No nodes reachable.\n"; + delete $1; + delete reachable_info; + } +; + + +context : {$$ = new Relation(); *$$ = Relation::Null();} + | GIVEN relation {$$ = $2; } +; + +relPairList : relPairList ',' relation ':' relation { + try { + $1->first.push_back(*$3); + $1->second.push_back(*$5); + } + catch (const std::exception &e) { + delete $1; + delete $3; + delete $5; + yyerror(e.what()); + YYERROR; + } + delete $3; + delete $5; + $$ = $1; + } + | relPairList ',' relation { + try { + $1->first.push_back(Identity($3->n_set())); + $1->second.push_back(*$3); + } + catch (const std::exception &e) { + delete $1; + delete $3; + yyerror(e.what()); + YYERROR; + } + delete $3; + $$ = $1; + } + | relation ':' relation { + std::pair, std::vector > *rtp = new std::pair, std::vector >(); + try { + rtp->first.push_back(*$1); + rtp->second.push_back(*$3); + } + catch (const std::exception &e) { + delete rtp; + delete $1; + delete $3; + yyerror(e.what()); + YYERROR; + } + delete $1; + delete $3; + $$ = rtp; + } + | relation { + std::pair, std::vector > *rtp = new std::pair, std::vector >(); + try { + rtp->first.push_back(Identity($1->n_set())); + rtp->second.push_back(*$1); + } + catch (const std::exception &e) { + delete rtp; + delete $1; + yyerror(e.what()); + YYERROR; + } + delete $1; + $$ = rtp; + } +; + +relation : OPEN_BRACE {need_coef = true; relationDecl = new Declaration_Site();} + builtRelation CLOSE_BRACE { + need_coef = false; + $$ = $3; + current_Declaration_Site = globalDecls; + delete relationDecl; + relationDecl = NULL; + } + | VAR { + Relation *r = relationMap[std::string($1)]; + if (r == NULL) { + yyerror(std::string("relation ") + to_string($1) + std::string(" not declared")); + delete []$1; + YYERROR; + } + $$ = new Relation(*r); + delete []$1; + } + | '(' relation ')' {$$ = $2;} + | relation '+' %prec p9 { + $$ = new Relation(); + try { + *$$ = TransitiveClosure(*$1, 1, Relation::Null()); + } + catch (const std::exception &e) { + delete $$; + delete $1; + yyerror(e.what()); + YYERROR; + } + delete $1; + } + | relation '*' %prec p9 { + $$ = new Relation(); + try { + int vars = $1->n_inp(); + *$$ = Union(Identity(vars), TransitiveClosure(*$1, 1, Relation::Null())); + } + catch (const std::exception &e) { + delete $$; + delete $1; + yyerror(e.what()); + YYERROR; + } + delete $1; + } + | relation '+' WITHIN relation %prec p9 { + $$ = new Relation(); + try { + *$$= TransitiveClosure(*$1, 1, *$4); + } + catch (const std::exception &e) { + delete $$; + delete $1; + delete $4; + yyerror(e.what()); + YYERROR; + } + delete $1; + delete $4; + } + | relation '^' '@' %prec p8 { + $$ = new Relation(); + try { + *$$ = ApproxClosure(*$1); + } + catch (const std::exception &e) { + delete $$; + delete $1; + yyerror(e.what()); + YYERROR; + } + delete $1; + } + | relation '^' '+' %prec p8 { + $$ = new Relation(); + try { + *$$ = calculateTransitiveClosure(*$1); + } + catch (const std::exception &e) { + delete $$; + delete $1; + yyerror(e.what()); + YYERROR; + } + delete $1; + } + | MINIMIZE_RANGE relation %prec p8 { + $$ = new Relation(); + try { + Relation o(*$2); + Relation r(*$2); + r = Join(r,LexForward($2->n_out())); + *$$ = Difference(o,r); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | MAXIMIZE_RANGE relation %prec p8 { + $$ = new Relation(); + try { + Relation o(*$2); + Relation r(*$2); + r = Join(r,Inverse(LexForward($2->n_out()))); + *$$ = Difference(o,r); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | MINIMIZE_DOMAIN relation %prec p8 { + $$ = new Relation(); + try { + Relation o(*$2); + Relation r(*$2); + r = Join(LexForward($2->n_inp()),r); + *$$ = Difference(o,r); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | MAXIMIZE_DOMAIN relation %prec p8 { + $$ = new Relation(); + try { + Relation o(*$2); + Relation r(*$2); + r = Join(Inverse(LexForward($2->n_inp())),r); + *$$ = Difference(o,r); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | MAXIMIZE relation %prec p8 { + $$ = new Relation(); + try { + Relation c(*$2); + Relation r(*$2); + *$$ = Cross_Product(Relation(*$2),c); + *$$ = Difference(r,Domain(Intersection(*$$,LexForward($$->n_inp())))); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | MINIMIZE relation %prec p8 { + $$ = new Relation(); + try { + Relation c(*$2); + Relation r(*$2); + *$$ = Cross_Product(Relation(*$2),c); + *$$ = Difference(r,Range(Intersection(*$$,LexForward($$->n_inp())))); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | FARKAS relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Farkas(*$2, Basic_Farkas); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | DECOUPLED_FARKAS relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Farkas(*$2, Decoupled_Farkas); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | relation '@' %prec p9 { + $$ = new Relation(); + try { + *$$ = ConicClosure(*$1); + } + catch (const std::exception &e) { + delete $$; + delete $1; + yyerror(e.what()); + YYERROR; + } + delete $1; + } + | PROJECT_AWAY_SYMBOLS relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Project_Sym(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | PROJECT_ON_SYMBOLS relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Project_On_Sym(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | DIFFERENCE relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Deltas(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | DIFFERENCE_TO_RELATION relation %prec p8 { + $$ = new Relation(); + try { + *$$ = DeltasToRelation(*$2,$2->n_set(),$2->n_set()); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | DOMAIN relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Domain(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | VENN relation %prec p8 { + $$ = new Relation(); + try { + *$$ = VennDiagramForm(*$2,Relation::True(*$2)); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | VENN relation GIVEN relation %prec p8 { + $$ = new Relation(); + try { + *$$ = VennDiagramForm(*$2,*$4); + } + catch (const std::exception &e) { + delete $$; + delete $2; + delete $4; + yyerror(e.what()); + YYERROR; + } + delete $2; + delete $4; + } + | CONVEX_HULL relation %prec p8 { + $$ = new Relation(); + try { + *$$ = ConvexHull(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | DECOUPLED_CONVEX_HULL relation %prec p8 { + $$ = new Relation(); + try { + *$$ = DecoupledConvexHull(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | POSITIVE_COMBINATION relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Farkas(*$2,Positive_Combination_Farkas); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | LINEAR_COMBINATION relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Farkas(*$2,Linear_Combination_Farkas); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | AFFINE_COMBINATION relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Farkas(*$2,Affine_Combination_Farkas); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | CONVEX_COMBINATION relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Farkas(*$2,Convex_Combination_Farkas); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | PAIRWISE_CHECK relation %prec p8 { + $$ = new Relation(); + try { + *$$ = CheckForConvexRepresentation(CheckForConvexPairs(*$2)); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | CONVEX_CHECK relation %prec p8 { + $$ = new Relation(); + try { + *$$ = CheckForConvexRepresentation(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | CONVEX_REPRESENTATION relation %prec p8 { + $$ = new Relation(); + try { + *$$ = ConvexRepresentation(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | AFFINE_HULL relation %prec p8 { + $$ = new Relation(); + try { + *$$ = AffineHull(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | CONIC_HULL relation %prec p8 { + $$ = new Relation(); + try { + *$$ = ConicHull(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | LINEAR_HULL relation %prec p8 { + $$ = new Relation(); + try { + *$$ = LinearHull(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | QUICK_HULL relation %prec p8 { + $$ = new Relation(); + try { + *$$ = QuickHull(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | RECT_HULL relation %prec p8 { + $$ = new Relation(); + try { + *$$ = RectHull(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | SIMPLE_HULL relation %prec p8 { + $$ = new Relation(); + try { + *$$ = SimpleHull(*$2, true, true); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | HULL relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Hull(*$2,true,1,Relation::Null()); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | HULL relation GIVEN relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Hull(*$2,true,1,*$4); + } + catch (const std::exception &e) { + delete $$; + delete $2; + delete $4; + yyerror(e.what()); + YYERROR; + } + delete $2; + delete $4; + } + | APPROX relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Approximate(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | RANGE relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Range(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | INVERSE relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Inverse(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | COMPLEMENT relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Complement(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | GIST relation GIVEN relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Gist(*$2,*$4,1); + } + catch (const std::exception &e) { + delete $$; + delete $2; + delete $4; + yyerror(e.what()); + YYERROR; + } + delete $2; + delete $4; + } + | relation '(' relation ')' { + $$ = new Relation(); + try { + *$$ = Composition(*$1,*$3); + } + catch (const std::exception &e) { + delete $$; + delete $1; + delete $3; + yyerror(e.what()); + YYERROR; + } + delete $1; + delete $3; + } + | relation COMPOSE relation { + $$ = new Relation(); + try { + *$$ = Composition(*$1,*$3); + } + catch (const std::exception &e) { + delete $$; + delete $1; + delete $3; + yyerror(e.what()); + YYERROR; + } + delete $1; + delete $3; + } + | relation CARRIED_BY INT { + $$ = new Relation(); + try { + *$$ = After(*$1,$3,$3); + (*$$).prefix_print(stdout); + } + catch (const std::exception &e) { + delete $$; + delete $1; + yyerror(e.what()); + YYERROR; + } + delete $1; + } + | relation JOIN relation { + $$ = new Relation(); + try { + *$$ = Composition(*$3,*$1); + } + catch (const std::exception &e) { + delete $$; + delete $1; + delete $3; + yyerror(e.what()); + YYERROR; + } + delete $1; + delete $3; + } + | relation RESTRICT_RANGE relation { + $$ = new Relation(); + try { + *$$ = Restrict_Range(*$1,*$3); + } + catch (const std::exception &e) { + delete $$; + delete $1; + delete $3; + yyerror(e.what()); + YYERROR; + } + delete $1; + delete $3; + } + | relation RESTRICT_DOMAIN relation { + $$ = new Relation(); + try { + *$$ = Restrict_Domain(*$1,*$3); + } + catch (const std::exception &e) { + delete $$; + delete $1; + delete $3; + yyerror(e.what()); + YYERROR; + } + delete $1; + delete $3; + } + | relation INTERSECTION relation { + $$ = new Relation(); + try { + *$$ = Intersection(*$1,*$3); + } + catch (const std::exception &e) { + delete $$; + delete $1; + delete $3; + yyerror(e.what()); + YYERROR; + } + delete $1; + delete $3; + } + | relation '-' relation %prec INTERSECTION { + $$ = new Relation(); + try { + *$$ = Difference(*$1,*$3); + } + catch (const std::exception &e) { + delete $$; + delete $1; + delete $3; + yyerror(e.what()); + YYERROR; + } + delete $1; + delete $3; + } + | relation UNION relation { + $$ = new Relation(); + try { + *$$ = Union(*$1,*$3); + } + catch (const std::exception &e) { + delete $$; + delete $1; + delete $3; + yyerror(e.what()); + YYERROR; + } + delete $1; + delete $3; + } + | relation '*' relation { + $$ = new Relation(); + try { + *$$ = Cross_Product(*$1,*$3); + } + catch (const std::exception &e) { + delete $$; + delete $1; + delete $3; + yyerror(e.what()); + YYERROR; + } + delete $1; + delete $3; + } + | SUPERSETOF relation { + $$ = new Relation(); + try { + *$$ = Union(*$2, Relation::Unknown(*$2)); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | SUBSETOF relation { + $$ = new Relation(); + try { + *$$ = Intersection(*$2, Relation::Unknown(*$2)); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | MAKE_UPPER_BOUND relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Upper_Bound(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | MAKE_LOWER_BOUND relation %prec p8 { + $$ = new Relation(); + try { + *$$ = Lower_Bound(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | SAMPLE relation { + $$ = new Relation(); + try { + *$$ = Sample_Solution(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | SYM_SAMPLE relation { + $$ = new Relation(); + try { + *$$ = Symbolic_Solution(*$2); + } + catch (const std::exception &e) { + delete $$; + delete $2; + yyerror(e.what()); + YYERROR; + } + delete $2; + } + | reachable_of { $$ = $1; } + | ASSERT_UNSAT relation { + if (($2)->is_satisfiable()) { + fprintf(stderr,"assert_unsatisfiable failed on "); + ($2)->print_with_subs(stderr); + exit(1); + } + $$=$2; + } +; + +builtRelation : tupleDeclaration GOES_TO {currentTuple = Output_Tuple;} + tupleDeclaration {currentTuple = Input_Tuple;} optionalFormula { + Relation * r = new Relation($1->size,$4->size); + resetGlobals(); + F_And *f = r->add_and(); + for(int i = 1; i <= $1->size; i++) { + $1->vars[i-1]->vid = r->input_var(i); + if (!$1->vars[i-1]->anonymous) + r->name_input_var(i, $1->vars[i-1]->stripped_name); + } + for(int i = 1; i <= $4->size; i++) { + $4->vars[i-1]->vid = r->output_var(i); + if (!$4->vars[i-1]->anonymous) + r->name_output_var(i, $4->vars[i-1]->stripped_name); + } + r->setup_names(); + for (std::set::iterator i = $1->eq_constraints.begin(); i != $1->eq_constraints.end(); i++) + install_eq(f, *i, 0); + for (std::set::iterator i = $1->geq_constraints.begin(); i != $1->geq_constraints.end(); i++) + install_geq(f, *i, 0); + for (std::set::iterator i = $1->stride_constraints.begin(); i != $1->stride_constraints.end(); i++) + install_stride(f, *i); + for (std::set::iterator i = $4->eq_constraints.begin(); i != $4->eq_constraints.end(); i++) + install_eq(f, *i, 0); + for (std::set::iterator i = $4->geq_constraints.begin(); i != $4->geq_constraints.end(); i++) + install_geq(f, *i, 0); + for (std::set::iterator i = $4->stride_constraints.begin(); i != $4->stride_constraints.end(); i++) + install_stride(f, *i); + if ($6) $6->install(f); + delete $1; + delete $4; + delete $6; + $$ = r; + } + | tupleDeclaration optionalFormula { + Relation * r = new Relation($1->size); + resetGlobals(); + F_And *f = r->add_and(); + for(int i = 1; i <= $1->size; i++) { + $1->vars[i-1]->vid = r->set_var(i); + if (!$1->vars[i-1]->anonymous) + r->name_set_var(i, $1->vars[i-1]->stripped_name); + } + r->setup_names(); + for (std::set::iterator i = $1->eq_constraints.begin(); i != $1->eq_constraints.end(); i++) + install_eq(f, *i, 0); + for (std::set::iterator i = $1->geq_constraints.begin(); i != $1->geq_constraints.end(); i++) + install_geq(f, *i, 0); + for (std::set::iterator i = $1->stride_constraints.begin(); i != $1->stride_constraints.end(); i++) + install_stride(f, *i); + if ($2) $2->install(f); + delete $1; + delete $2; + $$ = r; + } + | formula { + Relation * r = new Relation(0,0); + F_And *f = r->add_and(); + $1->install(f); + delete $1; + $$ = r; + } +; + +optionalFormula : formula_sep formula {$$ = $2;} + | {$$ = 0;} +; + +formula_sep : ':' + | VERTICAL_BAR + | SUCH_THAT +; + +tupleDeclaration : {currentTupleDescriptor = new tupleDescriptor; tuplePos = 1;} + '[' optionalTupleVarList ']' + {$$ = currentTupleDescriptor; tuplePos = 0;} +; + +optionalTupleVarList : /* empty */ + | tupleVar + | optionalTupleVarList ',' tupleVar +; + +tupleVar : VAR %prec p10 { + Declaration_Site *ds = defined($1); + if (!ds) + currentTupleDescriptor->extend($1,currentTuple,tuplePos); + else { + Variable_Ref *v = lookupScalar($1); + if (v == NULL) { + yyerror(std::string("cannot find declaration for variable ") + to_string($1)); + delete []$1; + YYERROR; + } + if (ds != globalDecls) + currentTupleDescriptor->extend($1, new Exp(v)); + else + currentTupleDescriptor->extend(new Exp(v)); + } + tuplePos++; + delete []$1; + } + | '*' {currentTupleDescriptor->extend(); tuplePos++;} + | exp %prec p1 { + currentTupleDescriptor->extend($1); + tuplePos++; + } + | exp ':' exp %prec p1 { + currentTupleDescriptor->extend($1,$3); + tuplePos++; + } + | exp ':' exp ':' COEF %prec p1 { + currentTupleDescriptor->extend($1,$3,$5); + tuplePos++; + } +; + +varList : varList ',' VAR {$$ = $1; $$->insert($3); $3 = NULL;} + | VAR {$$ = new std::set(); $$->insert($1); $1 = NULL;} +; + +varDecl : varList { + $$ = current_Declaration_Site = new Declaration_Site($1); + for (std::set::iterator i = $1->begin(); i != $1->end(); i++) + delete [](*i); + delete $1; + } +; + +varDeclOptBrackets : varDecl {$$ = $1;} + |'[' varDecl ']' {$$ = $2;} +; + +globVarList : globVarList ',' globVar + | globVar +; + +globVar : VAR '(' INT ')' {globalDecls->extend_both_tuples($1, $3); delete []$1;} + | VAR { + globalDecls->extend($1); + delete []$1; + } +; + +formula : formula AND formula {$$ = new AST_And($1,$3);} + | formula OR formula {$$ = new AST_Or($1,$3);} + | constraintChain {$$ = $1;} + | '(' formula ')' {$$ = $2;} + | NOT formula {$$ = new AST_Not($2);} + | start_exists varDeclOptBrackets exists_sep formula end_quant {$$ = new AST_exists($2,$4);} + | start_forall varDeclOptBrackets forall_sep formula end_quant {$$ = new AST_forall($2,$4);} +; + +start_exists : '(' EXISTS + | EXISTS '(' +; + +exists_sep : ':' + | VERTICAL_BAR + | SUCH_THAT +; + +start_forall : '(' FORALL + | FORALL '(' +; + +forall_sep : ':' +; + +end_quant : ')' {popScope();} +; + +expList : exp ',' expList {$$ = $3; $$->insert($1);} + | exp {$$ = new std::set(); $$->insert($1);} +; + +constraintChain : expList REL_OP expList {$$ = new AST_constraints($1,$2,$3);} + | expList REL_OP constraintChain {$$ = new AST_constraints($1,$2,$3);} +; + +simpleExp : VAR %prec p9 { + Variable_Ref *v = lookupScalar($1); + if (v == NULL) { + yyerror(std::string("cannot find declaration for variable ") + to_string($1)); + delete []$1; + YYERROR; + } + $$ = new Exp(v); + delete []$1; + } + | VAR '(' {argCount = 1;} argumentList ')' %prec p9 { + Variable_Ref *v; + if ($4 == Input_Tuple) + v = functionOfInput[$1]; + else + v = functionOfOutput[$1]; + if (v == NULL) { + yyerror(std::string("Function ") + to_string($1) + std::string(" not declared")); + delete []$1; + YYERROR; + } + $$ = new Exp(v); + delete []$1; + } + | '(' exp ')' { $$ = $2; } +; + +argumentList : argumentList ',' VAR { + Variable_Ref *v = lookupScalar($3); + if (v == NULL) { + yyerror(std::string("cannot find declaration for variable ") + to_string($1)); + delete []$3; + YYERROR; + } + if (v->pos != argCount || v->of != $1 || (v->of != Input_Tuple && v->of != Output_Tuple)) { + yyerror("arguments to function must be prefix of input or output tuple"); + delete []$3; + YYERROR; + } + $$ = v->of; + argCount++; + delete []$3; + } + | VAR { + Variable_Ref *v = lookupScalar($1); + if (v == NULL) { + yyerror(std::string("cannot find declaration for variable ") + to_string($1)); + delete []$1; + YYERROR; + } + if (v->pos != argCount || (v->of != Input_Tuple && v->of != Output_Tuple)) { + yyerror("arguments to function must be prefix of input or output tuple"); + delete []$1; + YYERROR; + } + $$ = v->of; + argCount++; + delete []$1; + } +; + +exp : COEF {$$ = new Exp($1);} + | COEF simpleExp %prec '*' {$$ = multiply($1,$2);} + | simpleExp {$$ = $1; } + | '-' exp %prec '*' {$$ = negate($2);} + | exp '+' exp {$$ = add($1,$3);} + | exp '-' exp {$$ = subtract($1,$3);} + | exp '*' exp { + try { + $$ = multiply($1,$3); + } + catch (const std::exception &e) { + yyerror(e.what()); + YYERROR; + } + } +; + + +reachable : REACHABLE_FROM nodeNameList nodeSpecificationList { + Dynamic_Array1 *final = Reachable_Nodes(reachable_info); + $$ = final; + } +; + +reachable_of : REACHABLE_OF VAR IN nodeNameList nodeSpecificationList { + Dynamic_Array1 *final = Reachable_Nodes(reachable_info); + int index = reachable_info->node_names.index(std::string($2)); + if (index == 0) { + yyerror(std::string("no such node ") + to_string($2)); + delete []$2; + delete final; + delete reachable_info; + YYERROR; + } + $$ = new Relation; + *$$ = (*final)[index]; + delete final; + delete reachable_info; + delete []$2; + } +; + +nodeNameList : '(' realNodeNameList ')' { + int sz = reachable_info->node_names.size(); + reachable_info->node_arity.reallocate(sz); + reachable_info->transitions.resize(sz+1,sz+1); + reachable_info->start_nodes.resize(sz+1); + } +; + +realNodeNameList : realNodeNameList ',' VAR { + reachable_info->node_names.append(std::string($3)); + delete []$3; + } + | VAR { + reachable_info = new reachable_information; + reachable_info->node_names.append(std::string($1)); + delete []$1; + } +; + + +nodeSpecificationList : OPEN_BRACE realNodeSpecificationList CLOSE_BRACE { + int i,j; + int n_nodes = reachable_info->node_names.size(); + Tuple &arity = reachable_info->node_arity; + Dynamic_Array2 &transitions = reachable_info->transitions; + + /* fixup unspecified transitions to be false */ + /* find arity */ + for(i = 1; i <= n_nodes; i++) arity[i] = -1; + for(i = 1; i <= n_nodes; i++) + for(j = 1; j <= n_nodes; j++) + if(! transitions[i][j].is_null()) { + int in_arity = transitions[i][j].n_inp(); + int out_arity = transitions[i][j].n_out(); + if(arity[i] < 0) arity[i] = in_arity; + if(arity[j] < 0) arity[j] = out_arity; + if(in_arity != arity[i] || out_arity != arity[j]) { + yyerror(std::string("arity mismatch in node transition: ") + to_string(reachable_info->node_names[i]) + std::string(" -> ") + to_string(reachable_info->node_names[j])); + delete reachable_info; + YYERROR; + } + } + for(i = 1; i <= n_nodes; i++) + if(arity[i] < 0) arity[i] = 0; + /* Fill in false relations */ + for(i = 1; i <= n_nodes; i++) + for(j = 1; j <= n_nodes; j++) + if(transitions[i][j].is_null()) + transitions[i][j] = Relation::False(arity[i],arity[j]); + + /* fixup unused start node positions */ + Dynamic_Array1 &nodes = reachable_info->start_nodes; + for(i = 1; i <= n_nodes; i++) + if(nodes[i].is_null()) + nodes[i] = Relation::False(arity[i]); + else + if(nodes[i].n_set() != arity[i]){ + yyerror(std::string("arity mismatch in start node ") + to_string(reachable_info->node_names[i])); + delete reachable_info; + YYERROR; + } + } +; + +realNodeSpecificationList : realNodeSpecificationList ',' VAR ':' relation { + int n_nodes = reachable_info->node_names.size(); + int index = reachable_info->node_names.index($3); + if (!(index > 0 && index <= n_nodes)) { + yyerror(std::string("no such node ")+to_string($3)); + delete $5; + delete []$3; + delete reachable_info; + YYERROR; + } + reachable_info->start_nodes[index] = *$5; + delete $5; + delete []$3; + } + | realNodeSpecificationList ',' VAR GOES_TO VAR ':' relation { + int n_nodes = reachable_info->node_names.size(); + int from_index = reachable_info->node_names.index($3); + if (!(from_index > 0 && from_index <= n_nodes)) { + yyerror(std::string("no such node ")+to_string($3)); + delete $7; + delete []$3; + delete []$5; + delete reachable_info; + YYERROR; + } + int to_index = reachable_info->node_names.index($5); + if (!(to_index > 0 && to_index <= n_nodes)) { + yyerror(std::string("no such node ")+to_string($5)); + delete $7; + delete []$3; + delete []$5; + delete reachable_info; + YYERROR; + } + reachable_info->transitions[from_index][to_index] = *$7; + delete $7; + delete []$3; + delete []$5; + } + | VAR GOES_TO VAR ':' relation { + int n_nodes = reachable_info->node_names.size(); + int from_index = reachable_info->node_names.index($1); + if (!(from_index > 0 && from_index <= n_nodes)) { + yyerror(std::string("no such node ")+to_string($1)); + delete $5; + delete []$1; + delete []$3; + delete reachable_info; + YYERROR; + } + int to_index = reachable_info->node_names.index($3); + if (!(to_index > 0 && to_index <= n_nodes)) { + yyerror(std::string("no such node ")+to_string($3)); + delete $5; + delete []$1; + delete []$3; + delete reachable_info; + YYERROR; + } + reachable_info->transitions[from_index][to_index] = *$5; + delete $5; + delete []$1; + delete []$3; + } + | VAR ':' relation { + int n_nodes = reachable_info->node_names.size(); + int index = reachable_info->node_names.index($1); + if (!(index > 0 && index <= n_nodes)) { + yyerror(std::string("no such node ")+to_string($1)); + delete $3; + delete []$1; + delete reachable_info; + YYERROR; + } + reachable_info->start_nodes[index] = *$3; + delete $3; + delete []$1; + } +; + +%% + +void yyerror(const std::string &s) { + std::stringstream ss; + if (is_interactive) + ss << s << "\n"; + else + ss << s << " at line " << mylexer.lineno() << "\n"; + err_msg = ss.str(); +} + + +int main(int argc, char **argv) { + if (argc > 2){ + fprintf(stderr, "Usage: %s [script_file]\n", argv[0]); + exit(1); + } + + if (argc == 2) { + std::ifstream *ifs = new std::ifstream; + ifs->open(argv[1], std::ifstream::in); + if (!ifs->is_open()) { + fprintf(stderr, "can't open input file %s\n", argv[1]); + exit(1); + } + yy_buffer_state *bs = mylexer.yy_create_buffer(ifs, 8092); + mylexer.yypush_buffer_state(bs); + } + + //yydebug = 1; + is_interactive = false; + if (argc == 1) { +#if defined __USE_POSIX + if (isatty((int)fileno(stdin))) + is_interactive = true; +#elif defined __WIN32 + if (_isatty(_fileno(stdin))) + is_interactive = true; +#endif + } + + if (is_interactive) { +#ifdef BUILD_CODEGEN + std::cout << "Omega+ and CodeGen+ "; +#else + std::cout << "Omega+ "; +#endif + std::cout << "v2.2.3 (built on " OMEGA_BUILD_DATE ")" << std::endl; + std::cout << "Copyright (C) 1994-2000 the Omega Project Team" << std::endl; + std::cout << "Copyright (C) 2005-2011 Chun Chen" << std::endl; + std::cout << "Copyright (C) 2011-2012 University of Utah" << std::endl; + std::cout << PROMPT_STRING << ' '; + std::cout.flush(); + } + + need_coef = false; + current_Declaration_Site = globalDecls = new Global_Declaration_Site(); + + if (yyparse() != 0) { + if (!is_interactive) + std::cout << "syntax error at the end of the file, missing ';'" << std::endl; + else + std::cout << std::endl; + delete relationDecl; + relationDecl = NULL; + } + else { + if (is_interactive) + std::cout << std::endl; + } + + for (std::map::iterator i = relationMap.begin(); i != relationMap.end(); i++) + delete (*i).second; + delete globalDecls; + + return 0; +} + +Relation LexForward(int n) { + Relation r(n,n); + F_Or *f = r.add_or(); + for (int i=1; i <= n; i++) { + F_And *g = f->add_and(); + for(int j=1;jadd_EQ(); + e.update_coef(r.input_var(j),-1); + e.update_coef(r.output_var(j),1); + e.finalize(); + } + GEQ_Handle e = g->add_GEQ(); + e.update_coef(r.input_var(i),-1); + e.update_coef(r.output_var(i),1); + e.update_const(-1); + e.finalize(); + } + r.finalize(); + return r; +} diff --git a/omegalib/omega_lib/CMakeLists.txt b/omegalib/omega_lib/CMakeLists.txt new file mode 100644 index 0000000..84ee384 --- /dev/null +++ b/omegalib/omega_lib/CMakeLists.txt @@ -0,0 +1,64 @@ +set(BASIC_SRC + ${OMEGAROOT}/basic/src/ConstString.cc + ${OMEGAROOT}/basic/src/Link.cc + ) + +set(OC_SRC + src/omega_core/oc.cc + src/omega_core/oc_eq.cc + src/omega_core/oc_exp_kill.cc + src/omega_core/oc_global.cc + src/omega_core/oc_print.cc + src/omega_core/oc_problems.cc + src/omega_core/oc_simple.cc + src/omega_core/oc_solve.cc + src/omega_core/oc_query.cc + src/omega_core/oc_quick_kill.cc + src/omega_core/oc_util.cc + ) + +set(PRES_SRC + src/pres_beaut.cc + src/pres_cnstr.cc + src/pres_col.cc + src/pres_conj.cc + src/pres_decl.cc + src/pres_dnf.cc + src/pres_form.cc + src/pres_gen.cc + src/pres_logic.cc + src/pres_print.cc + src/pres_rear.cc + src/pres_quant.cc + src/pres_subs.cc + src/pres_var.cc + ) + +set(REL_SRC + src/evac.cc + src/farkas.cc + src/hull_legacy.cc + src/hull_simple.cc + src/Relation.cc + src/Relations.cc + src/RelBody.cc + src/RelVar.cc + ) + +set(FANCY_SRC + src/closure.cc + src/reach.cc + ) + +include_directories( + ${OMEGAROOT}/basic/include + include + ) + +add_library(omega + ${BASIC_SRC} + ${OC_SRC} + ${PRES_SRC} + ${REL_SRC} + ${FANCY_SRC} + ) diff --git a/omegalib/omega_lib/doc/interface.pdf b/omegalib/omega_lib/doc/interface.pdf new file mode 100644 index 0000000..7f918ae Binary files /dev/null and b/omegalib/omega_lib/doc/interface.pdf differ diff --git a/omegalib/omega_lib/include/omega.h b/omegalib/omega_lib/include/omega.h new file mode 100644 index 0000000..8aa2c08 --- /dev/null +++ b/omegalib/omega_lib/include/omega.h @@ -0,0 +1,71 @@ +/********************************************************************* + Old license information from the Omega Project, updated one can be + found in LICENSE file. + + Copyright (C) 1994-1996 by the Omega Project + All rights reserved. + + NOTICE: This software is provided ``as is'', without any + warranty, including any implied warranty for merchantability or + fitness for a particular purpose. Under no circumstances shall + the Omega Project or its agents be liable for any use of, misuse + of, or inability to use this software, including incidental and + consequential damages. + + License is hereby given to use, modify, and redistribute this + software, in whole or in part, for any purpose, commercial or + non-commercial, provided that the user agrees to the terms of this + copyright notice, including disclaimer of warranty, and provided + that this copyright notice, including disclaimer of warranty, is + preserved in the source code and documentation of anything derived + from this software. Any redistributor of this software or + anything derived from this software assumes responsibility for + ensuring that any parties to whom such a redistribution is made + are fully aware of the terms of this license and disclaimer. + + The Omega project can be contacted at omega@cs.umd.edu + or http://www.cs.umd.edu/projects/omega +*********************************************************************/ + +#ifndef Already_Included_Omega +#define Already_Included_Omega + +/* + * The presburger interface is divided into the following parts. + * These parts are all included together, but are in separate + * files to keep things organized a bit. + * + * In many files, you can include just some of the following, + * specifically: if you are building a presburger tree, just + * include "pres_tree.h"; if you are querying it, include + * "pres_dnf.d" and "pres_conj.h"; if you are doing relational + * operations, include "Relation.h" + * + * Most of the function definitions are in the .c files with + * the same name as the .h that declares them, except: + * the remap and push_exists functions are in pres_var.c + * the DNFize functions are in pres_dnf.c + * the functions involving printing are in pres_print.c + * the beautify functions are in pres_beaut.c + * the rearrange functions are in pres_rear.c + * the compression functions are in pres_cmpr.c + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#endif diff --git a/omegalib/omega_lib/include/omega/RelBody.h b/omegalib/omega_lib/include/omega/RelBody.h new file mode 100644 index 0000000..3c11702 --- /dev/null +++ b/omegalib/omega_lib/include/omega/RelBody.h @@ -0,0 +1,165 @@ +#if ! defined _RelBody_h +#define _RelBody_h 1 + +#include +#include + +namespace omega { + +typedef enum {under_construction, compressed, uncompressed} Rel_Body_Status; +typedef unsigned char Rel_Unknown_Uses; +const Rel_Unknown_Uses no_u = 1; +const Rel_Unknown_Uses and_u = 2; +const Rel_Unknown_Uses or_u = 4; + +// +// Relation body. +// Body and representative are separated to do reference counting. +// + +class Rel_Body : public Formula { +public: + bool is_null() const; + + inline Node_Type node_type() { return Op_Relation; } + + inline bool is_set() const { return number_output == 0; } + int n_inp() const; + int n_out() const; + int n_set() const; + + inline Variable_ID_Tuple *global_decls() { return &Symbolic; } + int max_ufs_arity(); + int max_shared_ufs_arity(); + int max_ufs_arity_of_set(); + int max_ufs_arity_of_in(); + int max_ufs_arity_of_out(); + + Variable_ID input_var(int nth); + Variable_ID output_var(int nth); + Variable_ID set_var(int nth); + Variable_ID get_local(const Variable_ID v); + Variable_ID get_local(const Global_Var_ID G); + Variable_ID get_local(const Global_Var_ID G, Argument_Tuple of); + bool has_local(const Global_Var_ID G); + bool has_local(const Global_Var_ID G, Argument_Tuple of); + void name_input_var(int, Const_String); + void name_output_var(int, Const_String); + void name_set_var(int, Const_String); + + F_And *and_with_and(); + EQ_Handle and_with_EQ(); + EQ_Handle and_with_EQ(const Constraint_Handle &c); + GEQ_Handle and_with_GEQ(); + GEQ_Handle and_with_GEQ(const Constraint_Handle &c); + + void print(); + void print(FILE *output_file) { print(output_file, true); } + void print(FILE *output_file, bool printSym); + std::string print_variables_to_string(bool printSym); + void print_with_subs(FILE *output_file, bool printSym, bool newline); + void print_with_subs(); + std::string print_with_subs_to_string(bool printSym, bool newline); + std::string print_outputs_with_subs_to_string(); + std::string print_outputs_with_subs_to_string(int i); + std::string print_formula_to_string(); + void prefix_print(); + void prefix_print(FILE *output_file, int debug = 1); + + bool is_satisfiable(); + bool is_lower_bound_satisfiable(); + bool is_upper_bound_satisfiable(); + bool is_obvious_tautology(); + bool is_definite_tautology(); + bool is_unknown(); + DNF* query_DNF(); + DNF* query_DNF(int rdt_conjs, int rdt_constrs); + void simplify(int rdt_conjs = 0, int rdt_constrs = 0); + void finalize(); + inline bool is_finalized() { return finalized; } + inline bool is_shared() { return ref_count > 1; } + + void query_difference(Variable_ID v1, Variable_ID v2, + coef_t &lowerBound, coef_t &upperBound, + bool &quaranteed); + void query_variable_bounds(Variable_ID, coef_t &lowerBound, coef_t &upperBound); + coef_t query_variable_mod(Variable_ID v, coef_t factor); + + Relation extract_dnf_by_carried_level(int level, int direction); + void make_level_carried_to(int level); + + // these are only public to allow the creation of "null_rel" + Rel_Body(); + ~Rel_Body(); + void setup_names(); + +private: + + // These are manipulated primarily as parts of Relations + friend class Relation; + friend_rel_ops; + + friend void remap_DNF_vars(Rel_Body *new_rel, Rel_Body *old_rel); + + Rel_Unknown_Uses unknown_uses(); + + inline bool is_simplified() const { return (simplified_DNF!=NULL && get_children().empty()); } + bool is_compressed(); + Conjunct *rm_first_conjunct(); + Conjunct *single_conjunct(); + bool has_single_conjunct(); + + void beautify(); + void rearrange(); + + friend class EQ_Handle; // these set up names for printing + friend class GEQ_Handle; // and check if simplified + friend class Constraint_Handle; // and update coefficients + + void compress(); + void uncompress(); + + void interpret_unknown_as_true(); + void interpret_unknown_as_false(); + + Rel_Body(int n_input, int n_output); + /* Rel_Body(Rel_Body *r); */ + Rel_Body(Rel_Body *r, Conjunct *c); + Rel_Body &operator=(Rel_Body &r); + Rel_Body *clone(); + + inline Formula *formula() { return children().front(); } + inline Formula *rm_formula() { return children().remove_front(); } + bool can_add_child(); + + void reverse_leading_dir_info(); + void invalidate_leading_info(int changed = -1) { Formula::invalidate_leading_info(changed); } + void enforce_leading_info(int guaranteed, int possible, int dir) { Formula::enforce_leading_info(guaranteed, possible, dir); } + // re-declare this so that Relation (a friend) can call it + + DNF* DNFize(); + void DNF_to_formula(); + + Conjunct *find_available_conjunct(); + F_And *find_available_And(); + + +/* === data === */ +private: + + int ref_count; + Rel_Body_Status status; + + int number_input, number_output; + Tuple In_Names, Out_Names; + Variable_ID_Tuple Symbolic; + + DNF* simplified_DNF; + short r_conjs; // are redundant conjuncts eliminated? + bool finalized; + bool _is_set; +}; + +} // namespace + +#endif diff --git a/omegalib/omega_lib/include/omega/Rel_map.h b/omegalib/omega_lib/include/omega/Rel_map.h new file mode 100644 index 0000000..5641cb3 --- /dev/null +++ b/omegalib/omega_lib/include/omega/Rel_map.h @@ -0,0 +1,161 @@ +#if ! defined _Rel_map_h +#define _Rel_map_h 1 + +#include +#include + +namespace omega { + +// +// Mapping for relations +// When a relation operation needs to re-arrange the variables, +// it describes the re-arragement with a mapping, and then calls +// align to re-arrange them. +// +// In a mapping, map_in (map_out/map_set) gives the new type and +// position of each of the old input (output/set) variables. +// For variables being mapped to Input, Output, or Set variables, +// the position is the new position in the tuple. +// For variables being mapped to Exists_Var, Forall_Var, or +// Wildcard_Var, the positions can be used to map multiple +// variables to the same quantified variable, by providing +// the same position. Each variable with a negative position +// is given a unique quantified variable that is NOT listed +// in the seen_exists_ids list. +// I'm not sure what the positions mean for Global_Vars - perhaps +// they are ignored? +// +// Currently, align seems to support only mapping to Set, Input, +// Output, and Exists vars. +// + +class Mapping { +public: + inline Mapping(int no_in, int no_out): n_input(no_in), n_output(no_out) {} + inline Mapping(int no_set): n_input(no_set), n_output(0){} + inline Mapping(const Mapping &m): n_input(m.n_input), n_output(m.n_output) { + int i; + for(i=1; i<=n_input; i++) map_in_kind[i] = m.map_in_kind[i]; + for(i=1; i<=n_input; i++) map_in_pos[i] = m.map_in_pos[i]; + for(i=1; i<=n_output;i++) map_out_kind[i] = m.map_out_kind[i]; + for(i=1; i<=n_output;i++) map_out_pos[i] = m.map_out_pos[i]; + } + + inline void set_map (Var_Kind in_kind, int pos, Var_Kind type, int map) { + if(in_kind==Input_Var) + set_map_in(pos,type,map); + else if(in_kind==Set_Var) + set_map_in(pos,type,map); + else if(in_kind==Output_Var) + set_map_out(pos,type,map); + else + assert(0); + } + + inline void set_map_in (int pos, Var_Kind type, int map) { + assert(pos>=1 && pos<=n_input); + map_in_kind[pos] = type; + map_in_pos[pos] = map; + } + inline void set_map_set (int pos, Var_Kind type, int map) { + assert(pos>=1 && pos<=n_input); + map_in_kind[pos] = type; + map_in_pos[pos] = map; + } + + inline void set_map_out(int pos, Var_Kind type, int map) { + assert(pos>=1 && pos<=n_output); + map_out_kind[pos] = type; + map_out_pos[pos] = map; + } + + inline Var_Kind get_map_in_kind(int pos) const { + assert(pos>=1 && pos<=n_input); + return map_in_kind[pos]; + } + + inline int get_map_in_pos(int pos) const { + assert(pos>=1 && pos<=n_input); + return map_in_pos[pos]; + } + + inline Var_Kind get_map_out_kind(int pos) const { + assert(pos>=1 && pos<=n_output); + return map_out_kind[pos]; + } + + inline int get_map_out_pos(int pos) const { + assert(pos>=1 && pos<=n_output); + return map_out_pos[pos]; + } + + inline int n_in() const { return n_input; } + inline int n_out() const { return n_output; } + + // If a tuple as a whole becomes the new Input or Output tuple, + // return the Tuple of they will become (Input, Output) + // Return Unknown_Tuple otherwise + + inline Argument_Tuple get_tuple_fate(Argument_Tuple t, int prefix = -1) const { + return t== Input_Tuple ? get_input_fate(prefix) : + (t==Output_Tuple ? get_output_fate(prefix) : Unknown_Tuple); } + + inline Argument_Tuple get_set_fate(int prefix = -1) const { + return get_input_fate(prefix); } + + inline Argument_Tuple get_input_fate(int prefix = -1) const { + if (prefix < 0) prefix = n_input; + assert(n_input >= prefix); + if (n_input < prefix) + return Unknown_Tuple; + Var_Kind vf = map_in_kind[1]; + for (int i = 1; i<=prefix; i++) + if (map_in_pos[i]!=i || map_in_kind[i]!=vf) + return Unknown_Tuple; + + return vf == Input_Var ? Input_Tuple + : vf == Set_Var ? Set_Tuple + : vf == Output_Var ? Output_Tuple + : Unknown_Tuple; + } + + inline Argument_Tuple get_output_fate(int prefix = -1) const { + if (prefix < 0) prefix = n_output; + assert(n_output >= prefix); + if (n_output < 1) + return Unknown_Tuple; + Var_Kind vf = map_out_kind[1]; + for (int i = 1; i<=prefix; i++) + if (map_out_pos[i]!=i || map_out_kind[i]!=vf) + return Unknown_Tuple; + return vf == Input_Var ? Input_Tuple + : vf == Set_Var ? Set_Tuple + : vf == Output_Var ? Output_Tuple + : Unknown_Tuple; + } + + inline static Mapping Identity(int inp, int outp) { + Mapping m(inp, outp); int i; + for(i=1; i<=m.n_input; i++) m.set_map(Input_Var, i, Input_Var, i); + for(i=1; i<=m.n_output;i++) m.set_map(Output_Var, i, Output_Var, i); + return m; + } + + inline static Mapping Identity(int setvars) { + Mapping m(setvars); int i; + for(i=1; i<=setvars; i++) m.set_map(Set_Var, i, Set_Var, i); + return m; + } + +private: + int n_input; + int n_output; + Var_Kind map_in_kind[maxVars]; + int map_in_pos[maxVars]; + Var_Kind map_out_kind[maxVars]; + int map_out_pos[maxVars]; +}; + +} // namespace + +#endif diff --git a/omegalib/omega_lib/include/omega/Relation.h b/omegalib/omega_lib/include/omega/Relation.h new file mode 100644 index 0000000..b41bef5 --- /dev/null +++ b/omegalib/omega_lib/include/omega/Relation.h @@ -0,0 +1,299 @@ +#if ! defined _Relation_h +#define _Relation_h 1 + +#include +#include +#include +#include + +namespace omega { + +// +// Relation representative. +// Body and representative are separated to do reference counting. +// +class Relation { +public: + Relation(); + + Relation(int n_input, int n_output = 0); + Relation(const Relation &r); + Relation(const Relation &r, Conjunct *c); + Relation &operator=(const Relation &r); + Relation(Rel_Body &r, int foo); + + static Relation Null(); + static Relation Empty(const Relation &R); + static Relation True(const Relation &R); + static Relation True(int setvars); + static Relation True(int in, int out); + static Relation False(const Relation &R); + static Relation False(int setvars); + static Relation False(int in, int out); + static Relation Unknown(const Relation &R); + static Relation Unknown(int setvars); + static Relation Unknown(int in, int out); + + + bool is_null() const; + + ~Relation(); + + inline F_Forall *add_forall() + { return rel_body->add_forall(); } + inline F_Exists *add_exists() + { return rel_body->add_exists(); } + inline F_And *add_and() + { return rel_body->add_and(); } + inline F_And *and_with() + { return rel_body->and_with(); } + inline F_Or *add_or() + { return rel_body->add_or(); } + inline F_Not *add_not() + { return rel_body->add_not(); } + inline void finalize() + { rel_body->finalize(); } + inline bool is_finalized() const + { return rel_body->finalized; } + inline bool is_set() const + { return rel_body->is_set(); } + inline int n_inp() const + { return rel_body->n_inp(); } + inline int n_out() const + { return rel_body->n_out(); } + inline int n_set() const + { return rel_body->n_set(); } + + inline const Variable_ID_Tuple *global_decls() const + { return rel_body->global_decls(); } + inline int max_ufs_arity() const + { return rel_body->max_ufs_arity(); } + inline int max_ufs_arity_of_in() const + { return rel_body->max_ufs_arity_of_in(); } + inline int max_ufs_arity_of_set() const + { return rel_body->max_ufs_arity_of_set(); } + inline int max_ufs_arity_of_out() const + { return rel_body->max_ufs_arity_of_out(); } + inline int max_shared_ufs_arity() const + { return rel_body->max_shared_ufs_arity(); } + + inline Variable_ID input_var(int nth) + { return rel_body->input_var(nth); } + inline Variable_ID output_var(int nth) + { return rel_body->output_var(nth); } + inline Variable_ID set_var(int nth) + { return rel_body->set_var(nth); } + inline bool has_local(const Global_Var_ID G) + { return rel_body->has_local(G); } + inline bool has_local(const Global_Var_ID G, Argument_Tuple of) + { return rel_body->has_local(G, of); } + inline Variable_ID get_local(const Variable_ID v) + { return split()->get_local(v); } + inline Variable_ID get_local(const Global_Var_ID G) + { return split()->get_local(G); } + inline Variable_ID get_local(const Global_Var_ID G, Argument_Tuple of) + { return split()->get_local(G, of); } + + inline void name_input_var(int nth, Const_String S) + { split()->name_input_var(nth, S); } + inline void name_output_var(int nth, Const_String S) + { split()->name_output_var(nth, S); } + inline void name_set_var(int nth, Const_String S) + { split()->name_set_var(nth, S); } + + + inline F_And *and_with_and() + { return split()->and_with_and(); } + inline EQ_Handle and_with_EQ() + { return split()->and_with_EQ(); } + inline EQ_Handle and_with_EQ(const Constraint_Handle &c) + { return split()->and_with_EQ(c); } + inline GEQ_Handle and_with_GEQ() + { return split()->and_with_GEQ(); } + inline GEQ_Handle and_with_GEQ(const Constraint_Handle &c) + { return split()->and_with_GEQ(c); } + + inline void print() + { rel_body->print(); } + inline void print(FILE *output_file) + { rel_body->print(output_file); } + inline void print_with_subs() + { rel_body->print_with_subs(); } + inline void print_with_subs(FILE *output_file, bool printSym=false, + bool newline=true) + { rel_body->print_with_subs(output_file, printSym, newline); } + inline std::string print_with_subs_to_string(bool printSym=false, + bool newline=true) + { return rel_body->print_with_subs_to_string(printSym, newline); } + inline std::string print_outputs_with_subs_to_string() + { return rel_body->print_outputs_with_subs_to_string(); } + inline std::string print_outputs_with_subs_to_string(int i) + { return rel_body->print_outputs_with_subs_to_string(i); } + inline void prefix_print() + { rel_body->prefix_print(); } + inline void prefix_print(FILE *output_file, int debug = 1) + { rel_body->prefix_print(output_file, debug); } + inline std::string print_formula_to_string() { + return rel_body->print_formula_to_string(); + } + void dimensions(int & ndim_all, int &ndim_domain); + + inline bool is_lower_bound_satisfiable() + { return rel_body->is_lower_bound_satisfiable(); } + inline bool is_upper_bound_satisfiable() + { return rel_body->is_upper_bound_satisfiable(); } + inline bool is_satisfiable() + { return rel_body->is_satisfiable(); } + + inline bool is_tautology() + { return rel_body->is_obvious_tautology(); } // for compatibility + inline bool is_obvious_tautology() + { return rel_body->is_obvious_tautology(); } + inline bool is_definite_tautology() + { return rel_body->is_definite_tautology(); } + + // return x s.t. forall conjuncts c, c has >= x leading 0s + // for set, return -1 (pass this in, in case there are no conjuncts + inline int number_of_conjuncts() + { return rel_body->query_DNF()->length(); } + + // return x s.t. forall conjuncts c, c has >= x leading 0s + // for set, return -1 (pass this in, in case there are no conjuncts + inline int query_guaranteed_leading_0s() + { return rel_body->query_DNF()->query_guaranteed_leading_0s(this->is_set() ? -1 : 0); } + + // return x s.t. forall conjuncts c, c has <= x leading 0s + // if no conjuncts return min of input and output tuple sizes, or -1 if relation is a set + inline int query_possible_leading_0s() + { return rel_body->query_DNF()->query_possible_leading_0s( + this->is_set()? -1 : min(n_inp(),n_out())); } + + // return +-1 according to sign of leading dir, or 0 if we don't know + inline int query_leading_dir() + { return rel_body->query_DNF()->query_leading_dir(); } + + inline DNF* query_DNF() + { return rel_body->query_DNF(); } + inline DNF* query_DNF(int rdt_conjs, int rdt_constrs) + { return rel_body->query_DNF(rdt_conjs, rdt_constrs); } + inline void simplify(int rdt_conjs = 0, int rdt_constrs = 0) + { rel_body->simplify(rdt_conjs, rdt_constrs); } + inline bool is_simplified() + { return rel_body->is_simplified(); } + inline bool is_compressed() const + { return rel_body->is_compressed(); } + inline Conjunct *rm_first_conjunct() + { return rel_body->rm_first_conjunct(); } + inline Conjunct *single_conjunct() + { return rel_body->single_conjunct(); } + inline bool has_single_conjunct() + { return rel_body->has_single_conjunct(); } + + + void query_difference(Variable_ID v1, Variable_ID v2, coef_t &lowerBound, coef_t &upperBound, bool &guaranteed) { + rel_body->query_difference(v1, v2, lowerBound, upperBound, guaranteed); + } + void query_variable_bounds(Variable_ID v, coef_t &lowerBound, coef_t &upperBound) { + rel_body->query_variable_bounds(v,lowerBound,upperBound); + } + coef_t query_variable_mod(Variable_ID v, coef_t factor) { + assert(factor > 0); + return rel_body->query_variable_mod(v, factor); + } + int query_variable_mod(Variable_ID v, int factor) { + assert(sizeof(int) <= sizeof(coef_t)); + coef_t result = rel_body->query_variable_mod(v, static_cast(factor)); + if (result == posInfinity) + return INT_MAX; + else + return static_cast(result); + } + + + inline void make_level_carried_to(int level) + { + split()->make_level_carried_to(level); + } + + inline Relation extract_dnf_by_carried_level(int level, int direction) + { + return split()->extract_dnf_by_carried_level(level, direction); + } + + inline void compress() + { +#if defined(INCLUDE_COMPRESSION) + split()->compress(); +#endif + } + void uncompress() + { rel_body->uncompress(); } + + inline bool is_exact() const + { return !(rel_body->unknown_uses() & (and_u | or_u)) ; } + inline bool is_inexact() const + { return !is_exact(); } + inline bool is_unknown() const + { return rel_body->is_unknown(); } + inline Rel_Unknown_Uses unknown_uses() const + { return rel_body->unknown_uses(); } + + void setup_names() {rel_body->setup_names();} + void copy_names(const Relation &r) { + copy_names(*r.rel_body); + }; + void copy_names(Rel_Body &r); + +private: + // Functions that have to create sets from relations: + friend class Rel_Body; + friend_rel_ops; + + + Rel_Body *split(); + + DNF* simplified_DNF() { + simplify(); + return rel_body->simplified_DNF; + }; + + inline void invalidate_leading_info(int changed = -1) + { split()->invalidate_leading_info(changed); } + inline void enforce_leading_info(int guaranteed, int possible, int dir) + { + split()->enforce_leading_info(guaranteed, possible, dir); + } + + + void makeSet(); + void markAsSet(); + void markAsRelation(); + + friend bool operator==(const Relation &, const Relation &); + + void reverse_leading_dir_info() + { split()->reverse_leading_dir_info(); } + void interpret_unknown_as_true() + { split()->interpret_unknown_as_true(); } + void interpret_unknown_as_false() + { split()->interpret_unknown_as_false(); } + + + Rel_Body *rel_body; + + + friend Relation merge_rels(Tuple &R, const Tuple > > &mapping, const Tuple &inverse, Combine_Type ctype, int number_input, int number_output); +}; + +inline std::ostream & operator<<(std::ostream &o, Relation &R) +{ + return o << R.print_with_subs_to_string(); +} + +Relation copy(const Relation &r); + +} // namespace + +#include + +#endif diff --git a/omegalib/omega_lib/include/omega/Relations.h b/omegalib/omega_lib/include/omega/Relations.h new file mode 100644 index 0000000..4fd81e6 --- /dev/null +++ b/omegalib/omega_lib/include/omega/Relations.h @@ -0,0 +1,88 @@ +#if ! defined _Relations_h +#define _Relations_h 1 + +#include +#include + +namespace omega { + +// UPDATE friend_rel_ops IN pres_gen.h WHEN ADDING TO THIS LIST +// REMEMBER TO TAKE OUT DEFAULT ARGUMENTS IN THAT FILE + +/* The following allows us to avoid warnings about passing + temporaries as non-const references. This is useful but + has suddenly become illegal. */ +Relation consume_and_regurgitate(NOT_CONST Relation &R); + +// +// Operations over relations +// +Relation Union(NOT_CONST Relation &r1, NOT_CONST Relation &r2); +Relation Intersection(NOT_CONST Relation &r1, NOT_CONST Relation &r2); +Relation Extend_Domain(NOT_CONST Relation &R); +Relation Extend_Domain(NOT_CONST Relation &R, int more); +Relation Extend_Range(NOT_CONST Relation &R); +Relation Extend_Range(NOT_CONST Relation &R, int more); +Relation Extend_Set(NOT_CONST Relation &R); +Relation Extend_Set(NOT_CONST Relation &R, int more); +Relation Restrict_Domain(NOT_CONST Relation &r1, NOT_CONST Relation &r2); // Takes set as 2nd +Relation Restrict_Range(NOT_CONST Relation &r1, NOT_CONST Relation &r2); // Takes set as 2nd +Relation Domain(NOT_CONST Relation &r); // Returns set +Relation Range(NOT_CONST Relation &r); // Returns set +Relation Cross_Product(NOT_CONST Relation &A, NOT_CONST Relation &B); // Takes two sets +Relation Inverse(NOT_CONST Relation &r); +Relation After(NOT_CONST Relation &r, int carried_by, int new_output,int dir=1); +Relation Deltas(NOT_CONST Relation &R); // Returns set +Relation Deltas(NOT_CONST Relation &R, int eq_no); // Returns set +Relation DeltasToRelation(NOT_CONST Relation &R, int n_input, int n_output); +Relation Complement(NOT_CONST Relation &r); +Relation Project(NOT_CONST Relation &R, Global_Var_ID v); +Relation Project(NOT_CONST Relation &r, int pos, Var_Kind vkind); +Relation Project(NOT_CONST Relation &S, Variable_ID v); +Relation Project(NOT_CONST Relation &S, Sequence &s); +Relation Project_Sym(NOT_CONST Relation &R); +Relation Project_On_Sym(NOT_CONST Relation &R, + NOT_CONST Relation &context = Relation::Null()); +Relation GistSingleConjunct(NOT_CONST Relation &R, NOT_CONST Relation &R2, int effort=0); +Relation Gist(NOT_CONST Relation &R1, NOT_CONST Relation &R2, int effort=0); +Relation Difference(NOT_CONST Relation &r1, NOT_CONST Relation &r2); +Relation Approximate(NOT_CONST Relation &R, bool strides_allowed = false); +Relation Identity(int n_inp); +Relation Identity(NOT_CONST Relation &r); +bool Must_Be_Subset(NOT_CONST Relation &r1, NOT_CONST Relation &r2); +bool Might_Be_Subset(NOT_CONST Relation &r1, NOT_CONST Relation &r2); +// May is the same as might, just another name +bool May_Be_Subset(NOT_CONST Relation &r1, NOT_CONST Relation &r2); +bool Is_Obvious_Subset(NOT_CONST Relation &r1, NOT_CONST Relation &r2); +Relation Composition(NOT_CONST Relation &F, NOT_CONST Relation &G); +bool prepare_relations_for_composition(Relation &F, Relation &G); +Relation Join(NOT_CONST Relation &G, NOT_CONST Relation &F); +Relation EQs_to_GEQs(NOT_CONST Relation &, bool excludeStrides=false); +Relation Symbolic_Solution(NOT_CONST Relation &S); +Relation Symbolic_Solution(NOT_CONST Relation &S, Sequence &T); +Relation Sample_Solution(NOT_CONST Relation &S); +Relation Solution(NOT_CONST Relation &S, Sequence &T); +Relation Upper_Bound(NOT_CONST Relation &r); +Relation Lower_Bound(NOT_CONST Relation &r); + +Relation merge_rels(Tuple &R, const Tuple > > &mapping, const Tuple &inverse, Combine_Type ctype, int number_input = -1, int number_output = -1); + +// The followings might retire in the futrue!!! +void MapRel1(Relation &inputRel, + const Mapping &map, + Combine_Type ctype, + int number_input=-1, int number_output=-1, + bool invalidate_resulting_leading_info = true, + bool finalize = true); +Relation MapAndCombineRel2(Relation &R1, Relation &R2, + const Mapping &mapping1, const Mapping &mapping2, + Combine_Type ctype, + int number_input=-1, int number_output=-1); +void align(Rel_Body *originalr, Rel_Body *newr, F_Exists *fe, + Formula *f, const Mapping &mapping, bool &newrIsSet, + List &seen_exists, + Variable_ID_Tuple &seen_exists_ids); + +} // namespace + +#endif diff --git a/omegalib/omega_lib/include/omega/closure.h b/omegalib/omega_lib/include/omega/closure.h new file mode 100644 index 0000000..67088dd --- /dev/null +++ b/omegalib/omega_lib/include/omega/closure.h @@ -0,0 +1,31 @@ +#if ! defined _closure_h +#define _closure_h + +#include + +namespace omega { + +Relation VennDiagramForm( + Tuple &Rs, + NOT_CONST Relation &Context_In); +Relation VennDiagramForm( + NOT_CONST Relation &R_In, + NOT_CONST Relation &Context_In = Relation::Null()); + +// Given a Relation R, returns a relation deltas +// that correspond to the ConicHull of the detlas of R +Relation ConicClosure (NOT_CONST Relation &R); + +Relation TransitiveClosure (NOT_CONST Relation &r, + int maxExpansion = 1, + NOT_CONST Relation &IterationSpace=Relation::Null()); + +/* Tomasz Klimek */ +Relation calculateTransitiveClosure(NOT_CONST Relation &r); + +/* Tomasz Klimek */ +Relation ApproxClosure(NOT_CONST Relation &r); + +} // namespace + +#endif diff --git a/omegalib/omega_lib/include/omega/evac.h b/omegalib/omega_lib/include/omega/evac.h new file mode 100644 index 0000000..a561f8c --- /dev/null +++ b/omegalib/omega_lib/include/omega/evac.h @@ -0,0 +1,15 @@ +#if defined STUDY_EVACUATIONS + +namespace omega { + +// study the evacuation from one side of C to the other for UFS's of +// arity up to max_arity +extern void study_evacuation(Conjunct *C, which_way dir, int max_arity); + +// study the evacuation from the joined C2's output and C1's input to +// either of the other possible tuples +extern void study_evacuation(Conjunct *C1, Conjunct *C2, int max_arity); + +} // namespace + +#endif diff --git a/omegalib/omega_lib/include/omega/farkas.h b/omegalib/omega_lib/include/omega/farkas.h new file mode 100644 index 0000000..e77ed66 --- /dev/null +++ b/omegalib/omega_lib/include/omega/farkas.h @@ -0,0 +1,19 @@ +#ifndef Already_Included_Affine_Closure +#define Already_Included_Affine_Closure + +#include + +namespace omega { + +enum Farkas_Type {Basic_Farkas, Decoupled_Farkas, + Linear_Combination_Farkas, Positive_Combination_Farkas, + Affine_Combination_Farkas, Convex_Combination_Farkas }; + +Relation Farkas(NOT_CONST Relation &R, Farkas_Type op, bool early_bailout = false); + +extern coef_t farkasDifficulty; +extern Global_Var_ID coefficient_of_constant_term; + +} // namespace + +#endif diff --git a/omegalib/omega_lib/include/omega/hull.h b/omegalib/omega_lib/include/omega/hull.h new file mode 100644 index 0000000..928d0c6 --- /dev/null +++ b/omegalib/omega_lib/include/omega/hull.h @@ -0,0 +1,89 @@ +#ifndef Already_Included_Hull +#define Already_Included_Hull + +#include + +namespace omega { + +Relation SimpleHull(const Relation &R, bool allow_stride_constraint = false, bool allow_irregular_constraint = false); +Relation SimpleHull(const std::vector &Rs, bool allow_stride_constraint = false, bool allow_irregular_constraint = false); + + +// All of the following first call approximate on R to +// eliminate any wildcards and strides. + +// x in Convex Hull of R +// iff +// exist a_i, y_i s.t. +// x = Sum_i a_i y_i s.t. +// forall i, y_i in R +// forall i, a_i >=0 +// sum_i a_i = 1 +Relation ConvexHull(NOT_CONST Relation &R); + +// DecoupledConvexHull is the same as ConvexHull, +// except that it only finds constraints that involve +// both variables x&y if there is a constraint +// that involves both x&y in one of the conjuncts +// of R. +Relation DecoupledConvexHull(NOT_CONST Relation &R); + +// The affine hull just consists of equality constraints +// but is otherwise the tightest hull on R. +// x in Affine Hull of R +// iff +// exist a_i, y_i s.t. +// x = Sum_i a_i y_i s.t. +// forall i, y_i in R +// sum_i a_i = 1 +Relation AffineHull(NOT_CONST Relation &R); + +// x in Linear Hull of R +// iff +// exist a_i, y_i s.t. +// x = Sum_i a_i y_i s.t. +// forall i, y_i in R +Relation LinearHull(NOT_CONST Relation &R); + +// The conic hull is the tighest cone that contains R +// x in Conic Hull of R. +// iff +// exist a_i, y_i s.t. +// x = Sum_i a_i y_i s.t. +// forall i, y_i in R +// forall i, a_i >=0 +Relation ConicHull(NOT_CONST Relation &R); + +// RectHull includes readily-available constraints from relation +// that can be part of hull, plus rectangular bounds calculated +// from input/output/set variables' range. +Relation RectHull(NOT_CONST Relation &Rel); + +// A constraint is in the result of QuickHull only if it appears in one of +// the relations and is directly implied by a single constraint in each of +// the other relations. +Relation QuickHull(Relation &R); // deprecated +Relation QuickHull(Tuple &Rs); // deprecated + +Relation FastTightHull(NOT_CONST Relation &input_R, + NOT_CONST Relation &input_H); +Relation Hull(NOT_CONST Relation &R, + bool stridesAllowed = false, + int effort=1, + NOT_CONST Relation &knownHull = Relation::Null() + ); +Relation Hull(Tuple &Rs, + const std::vector &validMask, + int effort = 1, + bool stridesAllowed = false, + NOT_CONST Relation &knownHull = Relation::Null()); + +// If a union of several conjuncts is a convex, their union +// representaition can be simplified by their convex hull. +Relation ConvexRepresentation(NOT_CONST Relation &R); +Relation CheckForConvexPairs(NOT_CONST Relation &S); // deprecated +Relation CheckForConvexRepresentation(NOT_CONST Relation &R_In); // deprecated + +} + +#endif diff --git a/omegalib/omega_lib/include/omega/omega_core/debugging.h b/omegalib/omega_lib/include/omega/omega_core/debugging.h new file mode 100644 index 0000000..e217ae9 --- /dev/null +++ b/omegalib/omega_lib/include/omega/omega_core/debugging.h @@ -0,0 +1,30 @@ +#if !defined(Already_included_debugging) +#define Already_included_debugging + +// Debugging flags. Can set any of these. + +#include +#include + +namespace omega { + + + +extern int omega_core_debug; +extern int pres_debug; +extern int relation_debug; +extern int closure_presburger_debug; +extern int hull_debug; +extern int farkas_debug; +extern int code_gen_debug; + +enum negation_control { any_negation, one_geq_or_eq, one_geq_or_stride }; +extern negation_control pres_legal_negations; + +#if defined STUDY_EVACUATIONS +extern int evac_debug; +#endif + +} // namespace + +#endif diff --git a/omegalib/omega_lib/include/omega/omega_core/oc.h b/omegalib/omega_lib/include/omega/omega_core/oc.h new file mode 100644 index 0000000..e4f5444 --- /dev/null +++ b/omegalib/omega_lib/include/omega/omega_core/oc.h @@ -0,0 +1,350 @@ +#ifndef Already_Included_OC +#define Already_Included_OC 1 + +#include +#include +#include +#include +#include + +namespace omega { + +// Manu:: commented the line below -- fortran bug workaround +//#define maxVars 256 /* original 56, increased by chun */ +#define maxVars 100 + +extern int maxGEQs; +extern int maxEQs; + +// Manu:: commented the lines below -- fortran bug workaround +//const int maxmaxGEQs = 2048; // original 512, increaded by chun +//const int maxmaxEQs = 512; // original 256, increased by chun +const int maxmaxGEQs = 512; +const int maxmaxEQs = 256; + +/* #if ! defined maxmaxGEQs */ +/* #define maxmaxGEQs 2048 /\* original 512, increaded by chun *\/ */ +/* #endif */ +/* #if ! defined maxmaxEQs */ +/* #define maxmaxEQs 512 /\* original 256, increased by chun *\/ */ +/* #endif */ + + +#if 0 +#if ! defined Already_Included_Portable +typedef unsigned char bool; /* what a gross thing to do */ +#endif +#endif + +typedef int EqnKey; + +enum {EQ_BLACK = 0, EQ_RED = 1}; +enum {OC_SOLVE_UNKNOWN = 2, OC_SOLVE_SIMPLIFY = 3}; + +struct eqn { + EqnKey key; + coef_t touched; // see oc_simple.c + int color; + int essential; + int varCount; + coef_t coef[maxVars + 1]; +}; + +// typedef eqn * Eqn; +enum redType {notRed=0, redEQ, redGEQ, redLEQ, redStride}; +enum redCheck {noRed=0, redFalse, redConstraints}; +enum normalizeReturnType {normalize_false, normalize_uncoupled, + normalize_coupled}; + +extern char wildName[200][20]; + +extern FILE *outputFile; /* printProblem writes its output to this file */ +#define doTrace (trace && TRACE) +#define isRed(e) (desiredResult == OC_SOLVE_SIMPLIFY && (e)->color) +// #define eqnncpy(e1,e2,s) {int *p00,*q00,*r00; p00 = (int *)(e1); q00 = (int *)(e2); r00 = &p00[headerWords+1+s]; while(p00 < r00) *p00++ = *q00++; } +// #define eqncpy(e1,e2) eqnncpy(e1,e2,nVars) +// #define eqnnzero(e,s) {int *p00,*r00; p00 = (int *)(e); r00 = &p00[headerWords+1+(s)]; while(p00 < r00) *p00++ = 0;} +// #define eqnzero(e) eqnnzero(e,nVars) + +//void eqnncpy(eqn *dest, eqn *src, int); +//void eqnnzero(eqn *e, int); + +inline void eqnncpy(eqn *dest, eqn *src, int nVars) { + dest->key = src->key; + dest->touched = src->touched; + dest->color = src->color; + dest->essential = src->essential; + dest->varCount = src->varCount; + for (int i = 0; i <= nVars; i++) + dest->coef[i] = src->coef[i]; +} + + +inline void eqnnzero(eqn *e, int nVars) { + e->key = 0; + e->touched = 0; + e->color = EQ_BLACK; + e->essential = 0; + e->varCount = 0; + for (int i = 0; i <= nVars; i++) + e->coef[i] = 0; +} + +extern int mayBeRed; + +#ifdef SPEED +#define TRACE 0 +#define DBUG 0 +#define DEBUG 0 +#else +#define TRACE (omega_core_debug) +#define DBUG (omega_core_debug > 1) +#define DEBUG (omega_core_debug > 2) +#endif + + +class Memory { +public: + int length; + coef_t stride; + redType kind; + coef_t constantTerm; + coef_t coef[maxVars + 1]; + int var[maxVars + 1]; +}; + +/* #define headerWords ((4*sizeof(int) + sizeof(coef_t))/sizeof(int)) */ + +void check_number_EQs(int); +void check_number_GEQs(int); +extern eqn SUBs[]; +extern Memory redMemory[]; + +class Problem { +public: + short nVars, safeVars; + short nEQs, nGEQs,nSUBs,nMemories,allocEQs,allocGEQs; + short varsOfInterest; + bool variablesInitialized; + bool variablesFreed; + short var[maxVars+2]; + short forwardingAddress[maxVars+2]; + // int variableColor[maxVars+2]; + int hashVersion; + const char *(*get_var_name)(unsigned int var, void *args); + void *getVarNameArgs; + eqn *GEQs; + eqn *EQs; + bool isTemporary; + + Problem(int in_eqs=0, int in_geqs=0); + Problem(const Problem &); + ~Problem(); + Problem & operator=(const Problem &); + +/* Allocation parameters and functions */ + + static const int min_alloc,first_alloc_pad; + int padEQs(int oldalloc, int newreq) { + check_number_EQs(newreq); + return min((newreq < 2*oldalloc ? 2*oldalloc : 2*newreq),maxmaxEQs); + } + int padGEQs(int oldalloc, int newreq) { + check_number_GEQs(newreq); + return min((newreq < 2*oldalloc ? 2*oldalloc : 2*newreq),maxmaxGEQs); + } + int padEQs(int newreq) { + check_number_EQs(newreq); + return min(max(newreq+first_alloc_pad,min_alloc), maxmaxEQs); + } + int padGEQs(int newreq) { + check_number_GEQs(newreq); + return min(max(newreq+first_alloc_pad,min_alloc), maxmaxGEQs); + } + + + void zeroVariable(int i); + + void putVariablesInStandardOrder(); + void noteEssential(int onlyWildcards); + int findDifference(int e, int &v1, int &v2); + int chainKill(int color,int onlyWildcards); + + int newGEQ(); + int newEQ(); + int newSUB(){ + return nSUBs++; + } + + + void initializeProblem(); + void initializeVariables() const; + void printProblem(int debug = 1) const; + void printSub(int v) const; + std::string print_sub_to_string(int v) const; + void clearSubs(); + void printRedEquations() const; + int countRedEquations() const; + int countRedGEQs() const; + int countRedEQs() const; + int countRedSUBs() const; + void difficulty(int &numberNZs, coef_t &maxMinAbsCoef, coef_t &sumMinAbsCoef) const; + int prettyPrintProblem() const; + std::string prettyPrintProblemToString() const; + int prettyPrintRedEquations() const; + int simplifyProblem(int verify, int subs, int redundantElimination); + int simplifyProblem(); + int simplifyAndVerifyProblem(); + int simplifyApproximate(bool strides_allowed); + void coalesce(); + void partialElimination(); + void unprotectVariable(int var); + void negateGEQ(int); + void convertEQstoGEQs(bool excludeStrides); + void convertEQtoGEQs(int eq); + void nameWildcard(int i); + void useWildNames(); + void ordered_elimination(int symbolic); + int eliminateRedundant (bool expensive); + void eliminateRed(bool expensive); + void constrainVariableSign(int color, int var, int sign); + void constrainVariableValue(int color, int var, int value); + void query_difference(int v1, int v2, coef_t &lowerBound, coef_t &upperBound, bool &guaranteed); + int solve(int desiredResult); + std::string print_term_to_string(const eqn *e, int c) const; + void printTerm(const eqn * e, int c) const; + std::string printEqnToString(const eqn * e, int test, int extra) const; + void sprintEqn(char *str, const eqn * e, int is_geq,int extra) const; + void printEqn(const eqn * e, int is_geq, int extra) const; + void printEQ(const eqn *e) const {printEqn(e,0,0); } + std::string print_EQ_to_string(const eqn *e) const {return printEqnToString(e,0,0);} + std::string print_GEQ_to_string(const eqn *e) const {return printEqnToString(e,1,0);} + void printGEQ(const eqn *e) const {printEqn(e,1,0); } + void printGEQextra(const eqn *e) const {printEqn(e,1,1); } + void printSubstitution(int s) const; + void printVars(int debug = 1) const; + void swapVars(int i, int j); + void reverseProtectedVariables(); + redCheck redSimplifyProblem(int effort, int computeGist); + + // calculate value of variable mod integer from set of equations -- by chun 12/14/2006 + coef_t query_variable_mod(int v, coef_t factor, int color=EQ_BLACK, int nModularEQs=0, int nModularVars=0) const; + coef_t query_variable_mod(int v, coef_t factor, int color, int nModularEQs, int nModularVars, Tuple &working_on) const; // helper function + + int queryVariable(int i, coef_t *lowerBound, coef_t *upperBound); + int query_variable_bounds(int i, coef_t *l, coef_t *u); + void queryCoupledVariable(int i, coef_t *l, coef_t *u, int *couldBeZero, coef_t lowerBound, coef_t upperBound); + int queryVariableSigns(int i, int dd_lt, int dd_eq, int dd_gt, coef_t lowerBound, coef_t upperBound, bool *distKnown, coef_t *dist); + void addingEqualityConstraint(int e); + normalizeReturnType normalize(); + void normalize_ext(); + void cleanoutWildcards(); + void substitute(eqn *sub, int i, coef_t c); + void deleteVariable( int i); + void deleteBlack(); + int addNewProtectedWildcard(); + int addNewUnprotectedWildcard(); + int protectWildcard( int i); + void doMod( coef_t factor, int e, int j); + void freeEliminations( int fv); + int verifyProblem(); + void resurrectSubs(); + int solveEQ(); + int combineToTighten() ; + int quickKill(int onlyWildcards, bool desperate = false); + int expensiveEqualityCheck(); + int expensiveRedKill(); + int expensiveKill(); + int smoothWeirdEquations(); + void quickRedKill(int computeGist); + void chainUnprotect(); + void freeRedEliminations(); + void doElimination( int e, int i); + void analyzeElimination( + int &v, + int &darkConstraints, + int &darkShadowFeasible, + int &unit, + coef_t ¶llelSplinters, + coef_t &disjointSplinters, + coef_t &lbSplinters, + coef_t &ubSplinters, + int ¶llelLB); + int parallelSplinter(int e, int diff, int desiredResult); + int solveGEQ( int desiredResult); + void setInternals(); + void setExternals(); + int reduceProblem(); + void problem_merge(Problem &); + void deleteRed(); + void turnRedBlack(); + void checkGistInvariant() const; + void check() const; + coef_t checkSum() const; + void rememberRedConstraint(eqn *e, redType type, coef_t stride); + void recallRedMemories(); + void simplifyStrideConstraints(); + const char * orgVariable(int i) const { + return ((i == 0) ? // cfront likes this form better + "1" : + ((i < 0) ? + wildName[-i] : + (*get_var_name)(i,getVarNameArgs))); + }; + const char * variable(int i) const { + return orgVariable(var[i]) ; + }; + + void deleteGEQ(int e) { + if (DEBUG) { + fprintf(outputFile,"Deleting %d (last:%d): ",e,nGEQs-1); + printGEQ(&GEQs[e]); + fprintf(outputFile,"\n"); + }; + if (e < nGEQs-1) + eqnncpy (&GEQs[e], &GEQs[nGEQs - 1],(nVars)); + nGEQs--; + }; + void deleteEQ(int e) { + if (DEBUG) { + fprintf(outputFile,"Deleting %d (last:%d): ",e,nEQs-1); + printGEQ(&EQs[e]); + fprintf(outputFile,"\n"); + }; + if (e < nEQs-1) + eqnncpy (&EQs[e], &EQs[nEQs - 1],(nVars)); + nEQs--; + }; + +}; + + + +/* #define UNKNOWN 2 */ +/* #define SIMPLIFY 3 */ +/* #define _red 1 */ +/* #define black 0 */ + + +extern int print_in_code_gen_style; + + +void initializeOmega(void); + + +/* set extra to 0 for normal use */ +int singleVarGEQ(eqn *e); + +void setPrintLevel(int level); + +void printHeader(); + +void setOutputFile(FILE *file); + +extern void check_number_EQs(int nEQs); +extern void check_number_GEQs(int nGEQs); +extern void checkVars(int nVars); + +} // namespace + +#endif diff --git a/omegalib/omega_lib/include/omega/omega_core/oc_i.h b/omegalib/omega_lib/include/omega/omega_core/oc_i.h new file mode 100644 index 0000000..9533a40 --- /dev/null +++ b/omegalib/omega_lib/include/omega/omega_core/oc_i.h @@ -0,0 +1,79 @@ +#if !defined(Already_included_oc_i) +#define Already_included_oc_i + +#include +#include +#include +#include +#include +#include + +namespace omega { + +#define maxWildcards 18 + +extern int findingImplicitEqualities; +extern int firstCheckForRedundantEquations; +extern int use_ugly_names; +extern int doItAgain; +extern int newVar; +extern int conservative; +extern FILE *outputFile; /* printProblem writes its output to this file */ +extern int nextWildcard; +extern int trace; +extern int depth; +extern int packing[maxVars]; +extern int headerLevel; +extern int inApproximateMode; +extern int inStridesAllowedMode; +extern int addingOuterEqualities; +extern int outerColor; + +const int keyMult = 31; +const int hashTableSize =5*maxmaxGEQs; +const int maxKeys = 8*maxmaxGEQs; +extern int hashVersion; +extern eqn hashMaster[hashTableSize]; +extern int fastLookup[maxKeys*2]; +extern int nextKey; + +extern int reduceWithSubs; +extern int pleaseNoEqualitiesInSimplifiedProblems; + +#define noProblem ((Problem *) 0) + +extern Problem *originalProblem; +int checkIfSingleVar(eqn *e, int i); +/* Solve e = factor alpha for x_j and substitute */ + +void negateCoefficients(eqn * eqn, int nV); + +extern int omegaInitialized; +extern Problem full_answer, context,redProblem; + +#if defined BRAIN_DAMAGED_FREE +static inline void free(const Problem *p) +{ + free((char *)p); +} +#endif + +#if defined NDEBUG +#define CHECK_FOR_DUPLICATE_VARIABLE_NAMES +#else +#define CHECK_FOR_DUPLICATE_VARIABLE_NAMES \ + { \ + std::vector name(nVars); \ + for(int i=1; i<=nVars; i++) { \ + name[i-1] = variable(i); \ + assert(!name[i-1].empty()); \ + for(int j=1; j + +namespace omega { + +/* #define Assert(c,t) if(!(c)) PresErrAssert(t) */ +/* void PresErrAssert(const char *t); */ + +extern Rel_Body null_rel; + +extern int skip_finalization_check; +// extern int skip_set_checks; + +// Global input and output variable tuples. + +extern Global_Input_Output_Tuple input_vars; +extern Global_Input_Output_Tuple output_vars; +extern Global_Input_Output_Tuple &set_vars; + +} // namespace + +#if ! defined DONT_INCLUDE_TEMPLATE_CODE +// with g++258, everything will need to make Tuple, as a +// function taking it as an argument is a friend of lots of classes +#include +#endif + +#endif diff --git a/omegalib/omega_lib/include/omega/pres_cmpr.h b/omegalib/omega_lib/include/omega/pres_cmpr.h new file mode 100644 index 0000000..fb3e6f0 --- /dev/null +++ b/omegalib/omega_lib/include/omega/pres_cmpr.h @@ -0,0 +1,49 @@ +#if ! defined _pres_cmpr_h +#define _pres_cmpr_h 1 + +#include + +namespace omega { + +// +// Compressed problem: rectangular non-0 cut from the big problem. +// +class Comp_Constraints { +public: + Comp_Constraints(eqn *constrs, int no_constrs, int no_vars); + void UncompressConstr(eqn *constrs, short &pn_constrs); + ~Comp_Constraints(); + bool no_constraints() const + { return n_constrs == 0; } + int n_constraints() const + { return n_constrs; } + +protected: + inline int coef_index(int e, int v) + {return e*(n_vars+1) + v;} + +private: + int n_constrs; + int n_vars; + coef_t *coefs; +}; + +class Comp_Problem { +public: + Comp_Problem(Problem *problem); + Problem *UncompressProblem(); + bool no_constraints() const + { return eqs.no_constraints() && geqs.no_constraints(); } + +private: +/* === data === */ + int _nVars, _safeVars; + const char *(*_get_var_name)(unsigned int var, void *args); + void *_getVarNameArgs; + Comp_Constraints eqs; + Comp_Constraints geqs; +}; + +} // namespace + +#endif diff --git a/omegalib/omega_lib/include/omega/pres_cnstr.h b/omegalib/omega_lib/include/omega/pres_cnstr.h new file mode 100644 index 0000000..7b2d98d --- /dev/null +++ b/omegalib/omega_lib/include/omega/pres_cnstr.h @@ -0,0 +1,192 @@ +#if ! defined _pres_cnstr_h +#define _pres_cnstr_h 1 + +#include +#include + +namespace omega { + +// +// Constraint handles +// + + + +void copy_constraint(Constraint_Handle H, const Constraint_Handle initial); + +class Constraint_Handle { +public: + Constraint_Handle() {} + virtual ~Constraint_Handle() {} + + void update_coef(Variable_ID, coef_t delta); + void update_const(coef_t delta); + coef_t get_coef(Variable_ID v) const; + coef_t get_const() const; + bool has_wildcards() const; + int max_tuple_pos() const; + int min_tuple_pos() const; + bool is_const(Variable_ID v); + bool is_const_except_for_global(Variable_ID v); + + virtual std::string print_to_string() const; + virtual std::string print_term_to_string() const; + + Variable_ID get_local(const Global_Var_ID G); + Variable_ID get_local(const Global_Var_ID G, Argument_Tuple of); + // not sure that the second one can be used in a meaningful + // way if the conjunct is in multiple relations + + void finalize(); + void multiply(int multiplier); + Rel_Body *relation() const; + + +protected: + Conjunct *c; + eqn **eqns; + int e; + + friend class Constr_Vars_Iter; + friend class Constraint_Iterator; + + Constraint_Handle(Conjunct *, eqn **, int); + +#if defined PROTECTED_DOESNT_WORK + friend class EQ_Handle; + friend class GEQ_Handle; +#endif + + void update_coef_during_simplify(Variable_ID, coef_t delta); + void update_const_during_simplify(coef_t delta); + coef_t get_const_during_simplify() const; + coef_t get_coef_during_simplify(Variable_ID v) const; + + +public: + friend class Conjunct; // assert_leading_info updates coef's + // as does move_UFS_to_input + friend class DNF; // and DNF::make_level_carried_to + + friend void copy_constraint(Constraint_Handle H, + const Constraint_Handle initial); + // copy_constraint does updates and gets at c and e + +}; + +class GEQ_Handle : public Constraint_Handle { +public: + inline GEQ_Handle() {} + + virtual std::string print_to_string() const; + virtual std::string print_term_to_string() const; + bool operator==(const Constraint_Handle &that); + + void negate(); + +private: + friend class Conjunct; + friend class GEQ_Iterator; + + GEQ_Handle(Conjunct *, int); +}; + + +class EQ_Handle : public Constraint_Handle { +public: + inline EQ_Handle() {} + + virtual std::string print_to_string() const; + virtual std::string print_term_to_string() const; + bool operator==(const Constraint_Handle &that); + +private: + friend class Conjunct; + friend class EQ_Iterator; + + EQ_Handle(Conjunct *, int); +}; + + +// +// Conjuct iterators -- for querying resulting DNF. +// +class Constraint_Iterator : public Generator { +public: + Constraint_Iterator(Conjunct *); + int live() const; + void operator++(int); + void operator++(); + Constraint_Handle operator* (); + Constraint_Handle operator* () const; + +private: + Conjunct *c; + int current,last; + eqn **eqns; +}; + + +class EQ_Iterator : public Generator { +public: + EQ_Iterator(Conjunct *); + int live() const; + void operator++(int); + void operator++(); + EQ_Handle operator* (); + EQ_Handle operator* () const; + +private: + Conjunct *c; + int current, last; +}; + + +class GEQ_Iterator : public Generator { +public: + GEQ_Iterator(Conjunct *); + int live() const; + void operator++(int); + void operator++(); + GEQ_Handle operator* (); + GEQ_Handle operator* () const; + +private: + Conjunct *c; + int current, last; +}; + + +// +// Variables of constraint iterator. +// +struct Variable_Info { + Variable_ID var; + coef_t coef; + Variable_Info(Variable_ID _var, coef_t _coef) + { var = _var; coef = _coef; } +}; + +class Constr_Vars_Iter : public Generator { +public: + Constr_Vars_Iter(const Constraint_Handle &ch, bool _wild_only = false); + int live() const; + void operator++(int); + void operator++(); + Variable_Info operator*() const; + + Variable_ID curr_var() const; + coef_t curr_coef() const; + +private: + eqn **eqns; + int e; + Problem *prob; + Variable_ID_Tuple &vars; + bool wild_only; + int current; +}; + +} // namespace + +#endif diff --git a/omegalib/omega_lib/include/omega/pres_conj.h b/omegalib/omega_lib/include/omega/pres_conj.h new file mode 100644 index 0000000..ea10a2c --- /dev/null +++ b/omegalib/omega_lib/include/omega/pres_conj.h @@ -0,0 +1,299 @@ +#if ! defined _pres_conj_h +#define _pres_conj_h 1 + +#include +#include +#include +#include + +namespace omega { + +// +// Conjunct +// +// About variables in Conjunct: +// All varaibles appear in exactly one declaration. +// All variables used in Conjunct are referenced in mappedVars. +// Wildcard variables are referenced both in mappedVars and in myLocals, +// since they are declared in the conjunct. +// All other variables are declared at the levels above. +// Column number is: +// in forwardingAddress in Problem if variablesInitialized is set, +// equal to position of Variable_ID in mappedVars list otherwise. +// + +class Conjunct : public F_Declaration { +public: + Constraint_Iterator constraints(); + Variable_ID_Tuple *variables(); + EQ_Iterator EQs(); + GEQ_Iterator GEQs(); + inline int n_EQs() { return problem->nEQs; } + inline int n_GEQs() { return problem->nGEQs; } + + void promise_that_ub_solutions_exist(Relation &R); + + inline Node_Type node_type() {return Op_Conjunct;} + + inline int is_true() {return problem->nEQs==0 && problem->nGEQs==0 + && exact;} + + void query_difference(Variable_ID v1, Variable_ID v2, + coef_t &lowerBound, coef_t &upperBound, bool &guaranteed); + void query_variable_bounds(Variable_ID v, coef_t &lowerBound, coef_t &upperBound); + coef_t query_variable_mod(Variable_ID v, coef_t factor); + bool query_variable_used(Variable_ID v); + + int countNonzeros() const { + int numberNZs; + coef_t maxCoef, SumAbsCoef; + problem->difficulty(numberNZs,maxCoef,SumAbsCoef); + return numberNZs; + } + + void difficulty(int &numberNZs, coef_t &maxCoef, coef_t &SumAbsCoef) const { + problem->difficulty(numberNZs,maxCoef,SumAbsCoef); + } + + int query_guaranteed_leading_0s() { + count_leading_0s(); + return guaranteed_leading_0s; + } + + int query_possible_leading_0s() { + count_leading_0s(); + return possible_leading_0s; + } + + int query_leading_dir() { + count_leading_0s(); + return leading_dir; + } + + void calculate_dimensions(Relation &R, int &ndim_all, int &ndim_domain); + int max_ufs_arity_of_set(); + int max_ufs_arity_of_in(); + int max_ufs_arity_of_out(); + + int rank(); + + ~Conjunct(); + + bool is_unknown() const; + inline bool is_exact() const { return exact;} + inline bool is_inexact() const { return !exact;} + inline void make_inexact() { exact=false;} + + +#if ! defined NDEBUG + void assert_leading_info(); +#else + void assert_leading_info() {} +#endif + + + // PRINTING FUNCTIONS + void print(FILE *output_file); + void prefix_print(FILE *output_file, int debug = 1); + std::string print_to_string(int true_printed); + std::string print_EQ_to_string(eqn *e) { return problem->print_EQ_to_string(e); } + std::string print_GEQ_to_string(eqn *e) { return problem->print_GEQ_to_string(e); } + std::string print_EQ_to_string(int e) + { return problem->print_EQ_to_string(&(problem->EQs[e])); } + std::string print_GEQ_to_string(int e) + { return problem->print_GEQ_to_string(&(problem->GEQs[e])); } + std::string print_term_to_string(eqn *e) { return problem->print_term_to_string(e,1); } + std::string print_EQ_term_to_string(int e) + { return problem->print_term_to_string(&(problem->EQs[e]),1); } + std::string print_GEQ_term_to_string(int e) + { return problem->print_term_to_string(&(problem->GEQs[e]),1); } + std::string print_sub_to_string(int col) { return problem->print_sub_to_string(col); } + +private: + + inline void interpret_unknown_as_true() { exact=true;} + + friend Relation approx_closure(NOT_CONST Relation &r, int n); + + virtual Conjunct *really_conjunct(); + + + // create new constraints with all co-efficients 0 + // These are public in F_And, use them from there. + EQ_Handle add_stride(int step, int preserves_level = 0); + EQ_Handle add_EQ(int preserves_level = 0); + GEQ_Handle add_GEQ(int preserves_level = 0); + EQ_Handle add_EQ(const Constraint_Handle &c, int preserves_level = 0); + GEQ_Handle add_GEQ(const Constraint_Handle &c, int preserves_level = 0); + + friend class GEQ_Handle; + friend class EQ_Handle; + friend class Sub_Handle; + friend class Constraint_Handle; + friend class Constraint_Iterator; + friend class GEQ_Iterator; + friend class EQ_Iterator; + friend class Sub_Iterator; + friend class Constr_Vars_Iter; + + + // FUNCTIONS HAVING TO DO WITH BUILDING FORMULAS/DNFs + bool can_add_child(); + void remap(); + void beautify(); + DNF* DNFize(); + int priority(); + virtual Conjunct *find_available_conjunct(); + void finalize(); + + friend class DNF; + + + + // CREATING CONJUNCTS + Conjunct(); + Conjunct(Conjunct &); + Conjunct(Formula *, Rel_Body *); + + friend class Formula; // add_conjunct (a private function) creates Conjuncts + friend class F_Not; + friend class F_Or; + // class F_And; is a friend below + + + // VARIOUS FUNCTIONS TO CREATE / WORK WITH VARIABLES + Variable_ID declare(Const_String s); + Variable_ID declare(); + Variable_ID declare(Variable_ID v); + + friend const char *get_var_name(unsigned int, void *); + void push_exists(Variable_ID_Tuple &S); + int get_column(Variable_ID); + int find_column(Variable_ID); + int map_to_column(Variable_ID); + void combine_columns(); + void reorder(); + void reorder_for_print(bool reverseOrder=false, + int first_pass_input=0, + int first_pass_output=0, + bool sort=false); + + friend void remap_DNF_vars(Rel_Body *new_rel, Rel_Body *old_rel); + + void localize_var(Variable_ID D); + + + // this creates variables in conjuncts for us: + friend int new_WC(Conjunct *nc, Problem *np); + + + // UFS/LEADING ZEROS STUFF + + void move_UFS_to_input(); + + void count_leading_0s(); + void invalidate_leading_info(int changed = -1); + void enforce_leading_info(int guaranteed, int possible, int dir); + + void reverse_leading_dir_info(); + + + + // CONJUNCT SPECIFIC STUFF + + void rm_color_constrs(); + inline int N_protected() { return problem->safeVars; } + + + void ordered_elimination(int symLen) { problem->ordered_elimination(symLen);} + void convertEQstoGEQs(bool excludeStrides); + + int cost(); + + inline Formula* copy(Formula *parent, Rel_Body *reln) + { return copy_conj_diff_relation(parent,reln); } + Conjunct* copy_conj_diff_relation(Formula *parent, Rel_Body *reln); + inline Conjunct* copy_conj_same_relation() + { return copy_conj_diff_relation(&(parent()), relation()); } + friend void internal_copy_conjunct(Conjunct* to, Conjunct* fr); + friend void copy_constraint(Constraint_Handle H, + const Constraint_Handle initial); + +#if defined STUDY_EVACUATIONS + // The core function of "evac.c" does lots of work with conjuncts: + friend bool check_subseq_n(Conjunct *c, Sequence &evac_from, Sequence &evac_to, int n_from, int n_to, int max_arity, int n, bool allow_offset); + friend void assert_subbed_syms(Conjunct *c); + friend bool check_affine(Conjunct *d, Sequence &evac_from, Sequence &evac_to, int n_from, int n_to, int max_arity); + friend evac study(Conjunct *C, Sequence &evac_from, Sequence &evac_to, int n_from, int n_to, int max_arity); +#endif + + // The relational ops tend to do lots of demented things to Conjuncts: + friend class Rel_Body; + friend_rel_ops; + + // F_And sometimes absorbs conjuncts + friend class F_And; + + // Various DNFize functions also get a the problem: + + friend DNF* conj_and_not_dnf(Conjunct *pos_conj, DNF *neg_conjs, bool weak); + friend class F_Exists; + + // Substitutions are a wrapper around a low-level Problem operation + friend class Substitutions; + + // private functions to call problem functions + int simplifyProblem(); + int simplifyProblem(int verify, int subs, int redundantElimination); + int redSimplifyProblem(int effort, int computeGist); + + friend int simplify_conj(Conjunct* conj, int ver_sim, int elim_red, int color); + friend DNF* negate_conj(Conjunct* conj); + friend Conjunct* merge_conjs(Conjunct* conj1, Conjunct* conj2, + Merge_Action action, Rel_Body *body = 0); + friend void copy_conj_header(Conjunct* to, Conjunct* fr); + + + // === at last, the data === + + Variable_ID_Tuple mappedVars; + + int n_open_constraints; + bool cols_ordered; + bool simplified; + bool verified; + + int guaranteed_leading_0s; // -1 if unknown + int possible_leading_0s; // -1 if unknown + int leading_dir; // 0 if unknown, else +/- 1 + int leading_dir_valid_and_known(); + + bool exact; + + short r_constrs; // are redundant constraints eliminated? + Problem *problem; + + bool is_compressed(); + void compress(); + void uncompress(); + + friend class Comp_Problem; + Comp_Problem *comp_problem; +}; + + +/* === Misc. problem manipulation utilities === */ + +const int CantBeNegated = INT_MAX-10; +const int AvoidNegating = INT_MAX-11; + +void copy_column(Problem *tp, int to_col, + Problem *fp, int fr_col, + int start_EQ, int start_GEQ); +void zero_column(Problem *tp, int to_col, + int start_EQ, int start_GEQ, + int no_EQs, int no_GEQs); + +} // namespace + +#endif diff --git a/omegalib/omega_lib/include/omega/pres_decl.h b/omegalib/omega_lib/include/omega/pres_decl.h new file mode 100644 index 0000000..7fec0bc --- /dev/null +++ b/omegalib/omega_lib/include/omega/pres_decl.h @@ -0,0 +1,55 @@ +#if ! defined _pres_decl_h +#define _pres_decl_h 1 + +#include +#include +#include + +namespace omega { + +// +// Base class for presburger formula nodes with variables +// + +class F_Declaration : public Formula { +public: + virtual Variable_ID declare(Const_String s)=0; + virtual Variable_ID declare()=0; + virtual Variable_ID declare(Variable_ID)=0; + virtual Section declare_tuple(int size); + + void finalize(); + + inline Variable_ID_Tuple &locals() {return myLocals;} + +protected: + F_Declaration(Formula *, Rel_Body *); + F_Declaration(Formula *, Rel_Body *, Variable_ID_Tuple &); + ~F_Declaration(); + + Variable_ID do_declare(Const_String s, Var_Kind var_kind); + + void prefix_print(FILE *output_file, int debug = 1); + void print(FILE *output_file); + + void setup_names(); + void setup_anonymous_wildcard_names(); + + Variable_ID_Tuple myLocals; + friend class F_Forall; // rearrange needs to access myLocals + friend class F_Or; // push_exists + +private: + virtual bool can_add_child(); + + int priority(); + + friend void align(Rel_Body *originalr, Rel_Body *newr, F_Exists *fe, + Formula *f, const Mapping &mapping, bool &newrIsSet, + List &seen_exists, + Variable_ID_Tuple &seen_exists_ids); +}; + +} // namespace + +#endif diff --git a/omegalib/omega_lib/include/omega/pres_dnf.h b/omegalib/omega_lib/include/omega/pres_dnf.h new file mode 100644 index 0000000..93d5942 --- /dev/null +++ b/omegalib/omega_lib/include/omega/pres_dnf.h @@ -0,0 +1,87 @@ +#if ! defined _pres_dnf_h +#define _pres_dnf_h 1 + +#include + +namespace omega { + +// +// Disjunctive Normal Form -- list of Conjuncts +// +class DNF { +public: + void print(FILE *out_file); + void prefix_print(FILE *out_file, int debug = 1, bool parent_names_setup=false); + + bool is_definitely_false() const; + bool is_definitely_true() const; + int length() const; + + Conjunct *single_conjunct() const; + bool has_single_conjunct() const; + Conjunct *rm_first_conjunct(); + void clear(); + int query_guaranteed_leading_0s(int what_to_return_for_empty_dnf); + int query_possible_leading_0s(int what_to_return_for_empty_dnf); + int query_leading_dir(); + +private: + // all DNFize functions need to access the dnf builders: + friend class F_And; + friend class F_Or; + friend class Conjunct; + friend DNF * negate_conj(Conjunct *); + + friend class Rel_Body; + friend_rel_ops; + + DNF(); + ~DNF(); + + DNF* copy(Rel_Body *); + + void simplify(); + void make_level_carried_to(int level); + void count_leading_0s(); + + void add_conjunct(Conjunct*); + void join_DNF(DNF*); + void rm_conjunct(Conjunct *c); + + void rm_redundant_conjs(int effort); + void rm_redundant_inexact_conjs(); + void DNF_to_formula(Formula* root); + + + friend void remap_DNF_vars(Rel_Body *new_rel, Rel_Body *old_rel); + void remap(); + + void setup_names(); + + void remove_inexact_conj(); + + // These may need to get at the conjList itself: + friend DNF* DNF_and_DNF(DNF*, DNF*); + friend DNF* DNF_and_conj(DNF*, Conjunct*); + friend DNF* conj_and_not_dnf(Conjunct *pos_conj, DNF *neg_conjs, bool weak); + + friend class DNF_Iterator; + + List conjList; +}; + +DNF* conj_and_not_dnf(Conjunct *pos_conj, DNF *neg_conjs, bool weak=false); + +// +// DNF iterator +// +class DNF_Iterator : public List_Iterator { +public: + DNF_Iterator(DNF*dnf) : List_Iterator(dnf->conjList) {} + DNF_Iterator() {} + void curr_set(Conjunct *c) { *(*this) = c; } +}; + +} // namespace + +#endif diff --git a/omegalib/omega_lib/include/omega/pres_form.h b/omegalib/omega_lib/include/omega/pres_form.h new file mode 100644 index 0000000..ed3258e --- /dev/null +++ b/omegalib/omega_lib/include/omega/pres_form.h @@ -0,0 +1,112 @@ +#if ! defined _pres_form_h +#define _pres_form_h 1 + +#include + +namespace omega { + +typedef enum {Op_Relation, Op_Not, Op_And, Op_Or, + Op_Conjunct, Op_Forall, Op_Exists} Node_Type; + + +// +// Presburger Formula base class +// + +class Formula { +public: + virtual Node_Type node_type()=0; + + F_Forall *add_forall(); + F_Exists *add_exists(); + virtual F_And *and_with(); + F_And *add_and(); + F_Or *add_or(); + F_Not *add_not(); + void add_unknown(); + + virtual void finalize(); + virtual void print(FILE *output_file); + + Rel_Body *relation() { return myRelation; } + +protected: + virtual ~Formula(); +private: + Formula(Formula *, Rel_Body *); + + // The relational operations need to work with formula trees + friend class Relation; + friend_rel_ops; + // as do the functions that build DNF's + friend class DNF; + // or other parts of the tree + friend class Conjunct; + friend class F_Declaration; + friend class F_Exists; + friend class F_Forall; + friend class F_Or; + friend class F_And; + friend class F_Not; + friend class Rel_Body; + + + // Operations needed for manipulation of formula trees: + + void remove_child(Formula *); + void replace_child(Formula *child, Formula *new_child); + virtual bool can_add_child(); + void add_child(Formula *); + + Conjunct *add_conjunct(); + virtual Conjunct *find_available_conjunct() = 0; + + virtual Formula *copy(Formula *parent, Rel_Body *reln); + F_Exists *add_exists(Variable_ID_Tuple &S); + virtual void push_exists(Variable_ID_Tuple &S); + + // Accessor functions for tree building + + List &children() {return myChildren;} + int n_children() const {return myChildren.length();} + const List &get_children() const {return myChildren;} + Formula &parent() {return *myParent;} + void set_parent(Formula *p) {myParent = p;} + + + virtual int priority(); + + void verify_tree(); // should be const, but iterators are used + + virtual void reverse_leading_dir_info(); + virtual void invalidate_leading_info(int changed = -1); + virtual void enforce_leading_info(int guaranteed, int possible, int dir); + + virtual void remap(); + virtual DNF* DNFize() = 0; + virtual void beautify(); + virtual void rearrange(); + virtual void setup_names(); + + virtual void print_separator(FILE *output_file); + virtual void combine_columns(); + virtual void prefix_print(FILE *output_file, int debug = 1); + void print_head(FILE *output_file); + + void set_relation(Rel_Body *r); + void set_parent(Formula *parent, Rel_Body *reln); + + void assert_not_finalized(); + + virtual Conjunct *really_conjunct(); // until we get RTTI + +private: + List myChildren; + Formula *myParent; + Rel_Body *myRelation; + +}; + +} // namespace + +#endif diff --git a/omegalib/omega_lib/include/omega/pres_gen.h b/omegalib/omega_lib/include/omega/pres_gen.h new file mode 100644 index 0000000..ba6a793 --- /dev/null +++ b/omegalib/omega_lib/include/omega/pres_gen.h @@ -0,0 +1,192 @@ +#if ! defined _pres_gen_h +#define _pres_gen_h 1 + +#include +#include +#include +#include +#include +#include +#include + +namespace omega { + +// +// general presburger stuff thats needed everywhere +// + +/* The following allows us to avoid warnings about passing + temporaries as non-const references. This is useful but + has suddenly become illegal. */ + +#if !defined(LIE_ABOUT_CONST_TO_MAKE_ANSI_COMMITTEE_HAPPY) +#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)) +#define LIE_ABOUT_CONST_TO_MAKE_ANSI_COMMITTEE_HAPPY 1 +#else +#define LIE_ABOUT_CONST_TO_MAKE_ANSI_COMMITTEE_HAPPY 0 +#endif +#endif + +#if LIE_ABOUT_CONST_TO_MAKE_ANSI_COMMITTEE_HAPPY +#define NOT_CONST const +#else +#define NOT_CONST +#endif + +// +// I/O and error processing and control flags (also in omega_core/debugging.h) +// + +extern FILE *DebugFile; +extern int pres_debug; + +extern int mega_total; +extern int use_ugly_names; + +extern negation_control pres_legal_negations; + + +// +// Lots of things refer to each other, +// so we forward declare these classes: +// + +class Var_Decl; +typedef enum {Input_Var, Set_Var = Input_Var, Output_Var, + Global_Var, Forall_Var, Exists_Var, Wildcard_Var} Var_Kind; +class Global_Var_Decl; +typedef enum {Unknown_Tuple = 0, Input_Tuple = 1, Output_Tuple = 2, + Set_Tuple = Input_Tuple } Argument_Tuple; + +class Constraint_Handle; +class EQ_Handle; +class GEQ_Handle; +typedef EQ_Handle Stride_Handle; + +class Formula; +class F_Declaration; +class F_Forall; +class F_Exists; +class F_And; +class F_Or; +class F_Not; +class Conjunct; +class Relation; +class Rel_Body; +class DNF; +class Mapping; +class Omega_Var; +class Coef_Var_Decl; + +typedef Var_Decl *Variable_ID; +typedef Global_Var_Decl *Global_Var_ID; + +typedef Tuple Variable_ID_Tuple; +typedef Sequence Variable_ID_Sequence; // use only for rvalues +typedef Tuple_Iterator Variable_ID_Tuple_Iterator; +typedef Tuple_Iterator Variable_ID_Iterator; + +typedef Variable_ID_Iterator Variable_Iterator; + +typedef enum {Comb_Id, Comb_And, Comb_Or, Comb_AndNot} Combine_Type; + + +// things that are (hopefully) used only privately +class Comp_Problem; +class Comp_Constraints; + +// this has to be here rather than in pres_conj.h because +// MergeConj has to be a friend of Constraint_Handle +typedef enum {MERGE_REGULAR, MERGE_COMPOSE, MERGE_GIST} Merge_Action; + + +// Conjunct can be exact or lower or upper bound. +// For lower bound conjunct, the upper bound is assumed to be true; +// For upper bound conjunct, the lower bound is assumed to be false + +typedef enum {EXACT_BOUND, UPPER_BOUND, LOWER_BOUND, UNSET_BOUND} Bound_Type; + + +#if defined STUDY_EVACUATIONS +typedef enum { in_to_out = 0, out_to_in = 1} which_way; + +enum evac { evac_trivial = 0, + evac_offset = 1, + evac_subseq = 2, + evac_offset_subseq = 3, +// evac_permutation = , + evac_affine = 4, + evac_nasty = 5 }; + +extern char *evac_names[]; + +#endif + +// the following list should be updated in sync with Relations.h + +#define friend_rel_ops \ +friend Relation Union(NOT_CONST Relation &r1, NOT_CONST Relation &r2); \ +friend Relation Intersection(NOT_CONST Relation &r1, NOT_CONST Relation &r2); \ +friend Relation After(NOT_CONST Relation &R, int carried_by, int new_output, int dir);\ +friend Relation Extend_Domain(NOT_CONST Relation &R); \ +friend Relation Extend_Domain(NOT_CONST Relation &R, int more); \ +friend Relation Extend_Range(NOT_CONST Relation &R); \ +friend Relation Extend_Range(NOT_CONST Relation &R, int more); \ +friend Relation Extend_Set(NOT_CONST Relation &R); \ +friend Relation Extend_Set(NOT_CONST Relation &R, int more); \ +friend Relation Restrict_Domain(NOT_CONST Relation &r1, NOT_CONST Relation &r2); \ +friend Relation Restrict_Range(NOT_CONST Relation &r1, NOT_CONST Relation &r2); \ +friend Relation Domain(NOT_CONST Relation &r); \ +friend Relation Range(NOT_CONST Relation &r); \ +friend Relation Cross_Product(NOT_CONST Relation &A, NOT_CONST Relation &B); \ +friend Relation Inverse(NOT_CONST Relation &r); \ +friend Relation Deltas(NOT_CONST Relation &R); \ +friend Relation Deltas(NOT_CONST Relation &R, int eq_no); \ +friend Relation DeltasToRelation(NOT_CONST Relation &R, int n_input, int n_output); \ +friend Relation Complement(NOT_CONST Relation &r); \ +friend Relation Project(NOT_CONST Relation &R, Global_Var_ID v); \ +friend Relation Project(NOT_CONST Relation &r, int pos, Var_Kind vkind); \ +friend Relation Project(NOT_CONST Relation &S, Sequence &s); \ +friend Relation Project_Sym(NOT_CONST Relation &R); \ +friend Relation Project_On_Sym(NOT_CONST Relation &R, NOT_CONST Relation &context); \ +friend Relation GistSingleConjunct(NOT_CONST Relation &R1, NOT_CONST Relation &R2, int effort); \ +friend Relation Gist(NOT_CONST Relation &R1, NOT_CONST Relation &R2, int effort); \ +friend Relation Difference(NOT_CONST Relation &r1, NOT_CONST Relation &r2); \ +friend Relation Approximate(NOT_CONST Relation &R, bool strides_allowed); \ +friend Relation Identity(int n_inp); \ +friend Relation Identity(NOT_CONST Relation &r); \ +friend bool do_subset_check(NOT_CONST Relation &r1, NOT_CONST Relation &r2); \ +friend bool Must_Be_Subset(NOT_CONST Relation &r1, NOT_CONST Relation &r2); \ +friend bool Might_Be_Subset(NOT_CONST Relation &r1, NOT_CONST Relation &r2); \ +friend bool May_Be_Subset(NOT_CONST Relation &r1, NOT_CONST Relation &r2); \ +friend bool Is_Obvious_Subset(NOT_CONST Relation &r1, NOT_CONST Relation &r2); \ +friend Relation Join(NOT_CONST Relation &G, NOT_CONST Relation &F); \ +friend Relation Composition(NOT_CONST Relation &F, NOT_CONST Relation &G); \ +friend bool can_do_exact_composition(NOT_CONST Relation &F, NOT_CONST Relation &G); \ +friend Relation EQs_to_GEQs(NOT_CONST Relation &, bool excludeStrides); \ +friend Relation Symbolic_Solution(NOT_CONST Relation &S); \ +friend Relation Symbolic_Solution(NOT_CONST Relation &S, Sequence &T); \ +friend Relation Sample_Solution(NOT_CONST Relation &S); \ +friend Relation Solution(NOT_CONST Relation &S, Sequence &T); \ +friend void MapRel1(Relation &inputRel, const Mapping &map, \ + Combine_Type ctype, int number_input, \ + int number_output, bool, bool); \ +friend Relation MapAndCombineRel2(Relation &R1, Relation &R2, \ + const Mapping &mapping1, \ + const Mapping &mapping2, \ + Combine_Type ctype, \ + int number_input, \ + int number_output); \ +friend void align(Rel_Body *, Rel_Body *, F_Exists *, \ + Formula *, const Mapping &, bool &, \ + List &, Variable_ID_Tuple &); \ +friend Relation Lower_Bound(NOT_CONST Relation &r); \ +friend Relation Upper_Bound(NOT_CONST Relation &r) + + +// REMEMBER - THE LAST LINE OF THE MACRO SHOULD NOT HAVE A ; +/* TransitiveClosure doesn't need to be in friend_rel_ops */ + +} // namespace + +#endif diff --git a/omegalib/omega_lib/include/omega/pres_logic.h b/omegalib/omega_lib/include/omega/pres_logic.h new file mode 100644 index 0000000..27c4553 --- /dev/null +++ b/omegalib/omega_lib/include/omega/pres_logic.h @@ -0,0 +1,90 @@ +#if ! defined _pres_logic_h +#define _pres_logic_h 1 + +#include + +namespace omega { +// +// Presburger formula classes for logical operations: and, or not +// + +class F_And : public Formula { +public: + inline Node_Type node_type() {return Op_And;} + + // "preserves level" should be 0 unless we know this will not + // change the "level" of the constraints - ie the number of + // leading corresponding in,out variables known to be equal + GEQ_Handle add_GEQ(int preserves_level = 0); + EQ_Handle add_EQ(int preserves_level = 0); + Stride_Handle add_stride(int step, int preserves_level = 0); + EQ_Handle add_EQ(const Constraint_Handle &c, int preserves_level = 0); + GEQ_Handle add_GEQ(const Constraint_Handle &c, int preserves_level = 0); + + F_And *and_with(); + void add_unknown(); + +private: + friend class Formula; // add_and() + F_And(Formula *p, Rel_Body *r); + +private: + Formula *copy(Formula *parent, Rel_Body *reln); + virtual Conjunct *find_available_conjunct(); + int priority(); + void print_separator(FILE *output_file); + void prefix_print(FILE *output_file, int debug = 1); + void beautify(); + DNF* DNFize(); + + Conjunct *pos_conj; +}; + + +class F_Or : public Formula { +public: + inline Node_Type node_type() {return Op_Or;} + +private: + friend class Formula; // add_or + F_Or(Formula *, Rel_Body *); + +private: + Formula *copy(Formula *parent, Rel_Body *reln); + + virtual Conjunct *find_available_conjunct(); + void print_separator(FILE *output_file); + void prefix_print(FILE *output_file, int debug = 1); + void beautify(); + int priority(); + DNF* DNFize(); + void push_exists(Variable_ID_Tuple &S); +}; + + +class F_Not : public Formula { +public: + inline Node_Type node_type() {return Op_Not;} + void finalize(); + +private: + friend class Formula; + F_Not(Formula *, Rel_Body *); + +private: + Formula *copy(Formula *parent, Rel_Body *reln); + + virtual Conjunct *find_available_conjunct(); + friend class F_Forall; + bool can_add_child(); + void beautify(); + void rearrange(); + int priority(); + DNF* DNFize(); + void print(FILE *output_file); + void prefix_print(FILE *output_file, int debug = 1); +}; + +} // namespace + +#endif diff --git a/omegalib/omega_lib/include/omega/pres_quant.h b/omegalib/omega_lib/include/omega/pres_quant.h new file mode 100644 index 0000000..98c30df --- /dev/null +++ b/omegalib/omega_lib/include/omega/pres_quant.h @@ -0,0 +1,63 @@ +#if ! defined _pres_quant_h +#define _pres_quant_h 1 + +#include + +namespace omega { + +// +// Presburger formula nodes for quantifiers +// + +class F_Exists : public F_Declaration { +public: + inline Node_Type node_type() {return Op_Exists;} + Variable_ID declare(Const_String s); + Variable_ID declare(); + Variable_ID declare(Variable_ID v); + virtual void push_exists(Variable_ID_Tuple &S); + +protected: + friend class Formula; + + F_Exists(Formula *, Rel_Body *); + F_Exists(Formula *, Rel_Body *, Variable_ID_Tuple &); + +private: + Formula *copy(Formula *parent, Rel_Body *reln); + + virtual Conjunct *find_available_conjunct(); + void print(FILE *output_file); + void prefix_print(FILE *output_file, int debug = 1); + void beautify(); + void rearrange(); + DNF* DNFize(); +}; + + +class F_Forall : public F_Declaration { +public: + inline Node_Type node_type() {return Op_Forall;} + Variable_ID declare(Const_String s); + Variable_ID declare(); + Variable_ID declare(Variable_ID v); + +protected: + friend class Formula; + + F_Forall(Formula *, Rel_Body *); + +private: + Formula *copy(Formula *parent, Rel_Body *reln); + + virtual Conjunct *find_available_conjunct(); + void print(FILE *output_file); + void prefix_print(FILE *output_file, int debug = 1); + void beautify(); + void rearrange(); + DNF* DNFize(); +}; + +} // namespace + +#endif diff --git a/omegalib/omega_lib/include/omega/pres_subs.h b/omegalib/omega_lib/include/omega/pres_subs.h new file mode 100644 index 0000000..8a9ee92 --- /dev/null +++ b/omegalib/omega_lib/include/omega/pres_subs.h @@ -0,0 +1,88 @@ +#if !defined(pres_subs_h) +#define pres_subs_h + +/* Interface to omega core's substitutions. + + Creating an object of class Substitutions causes ordered elimination, + i.e. variables in the input and output tuples are substituted for by + functions of earlier variables. Could conceivablely create a more + flexible interface to orderedElimination if we developed a way to + specify the desired variable order. + + This is not an entirely consistent interface, since Sub_Handles + shouldn't really permit update_coef on SUBs. It is not a real + problem since subs are now no longer part of a conjunct, but it is + a slightly odd situation. + + Don't try to simplify r after performing orderedElimination. +*/ + + +#include +#include +#include +#include + +namespace omega { + +class Sub_Handle; +class Sub_Iterator; + +class Substitutions { +public: + Substitutions(Relation &input_R, Conjunct *input_c); + ~Substitutions(); + Sub_Handle get_sub(Variable_ID v); + bool substituted(Variable_ID v); + bool sub_involves(Variable_ID v, Var_Kind kind); +private: + friend class Sub_Iterator; + friend class Sub_Handle; + Relation *r; + Conjunct *c; + eqn *subs; + Variable_ID_Tuple subbed_vars; +}; + + +//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + + +class Sub_Handle: public Constraint_Handle { +public: + inline Sub_Handle() {} + + virtual std::string print_to_string() const; + virtual std::string print_term_to_string() const; + Variable_ID variable() {return v;} + +private: + friend class Substitutions; + friend class Sub_Iterator; + Sub_Handle(Substitutions *, int, Variable_ID); +// Sub_Handle(Substitutions *, int); + + Variable_ID v; +}; + +//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + + +class Sub_Iterator : public Generator { +public: + Sub_Iterator(Substitutions *input_s): s(input_s), current(0), + last(s->c->problem->nSUBs-1) {} + int live() const; + void operator++(int); + void operator++(); + Sub_Handle operator* (); + Sub_Handle operator* () const; + +private: + Substitutions *s; + int current, last; +}; + +} // namespace + +#endif diff --git a/omegalib/omega_lib/include/omega/pres_tree.h b/omegalib/omega_lib/include/omega/pres_tree.h new file mode 100644 index 0000000..ad78ad0 --- /dev/null +++ b/omegalib/omega_lib/include/omega/pres_tree.h @@ -0,0 +1,15 @@ +#if ! defined _pres_tree_h +#define _pres_tree_h 1 + +// +// Header to include if you need all the classes to build +// a Presburger formula: +// variables, constraints, nodes for logical operations & quantifiers +// + +#include +#include +#include +#include + +#endif diff --git a/omegalib/omega_lib/include/omega/pres_var.h b/omegalib/omega_lib/include/omega/pres_var.h new file mode 100644 index 0000000..bf60dcb --- /dev/null +++ b/omegalib/omega_lib/include/omega/pres_var.h @@ -0,0 +1,230 @@ +#if ! defined _pres_var_h +#define _pres_var_h 1 + +#include +#include + +namespace omega { + +// +// Variable declaration. +// Variables are free or quantified. +// Free variables are classified as input, output and global. +// Quantified variables are classified as forall, exists and wildcard. +// All global variables are functions symbols of (possibly 0) arguments +// Local variables that correspond to >0-ary functions are identified +// as functions of a prefix of the input, output, or both tuples +// +// +// typedef enum {Input_Var, Output_Var, Set_Var, +// Global_Var, Forall_Var, Exists_Var, Wildcard_Var} Var_Kind; + +typedef enum {Free_Var, Coef_Var, Bomega_Var} Global_Kind; + +// NOW IN PRES_GEN.H, as its used as an argument and can't +// be forward declared: +// typedef enum {Unknown_Tuple = 0, Input_Tuple = 1, Output_Tuple = 2, +// Set_Tuple = Input_Tuple } Argument_Tuple; +// Only Input, Output, and Set can be passed to get_local, +// but the values 0 and 3 are also used internally. + + +class Var_Decl { +public: + inline Var_Kind kind() { return var_kind; } + int get_position(); + Global_Var_ID get_global_var(); + Argument_Tuple function_of(); // valid iff kind() == Global_var + + Const_String base_name; + void name_variable(char *newname); + + // The following should be used with care, as they are only valid + // after setup_names has been used on the relation containing this + // variable. + std::string name(); + const char* char_name(); + void set_kind(Var_Kind v) { var_kind = v; } + + // Operation to allow the remap field to be used for + // union-find operations on variables. + // Be sure to reset the remap fields afterward + void UF_union(Variable_ID v); + Variable_ID UF_owner(); + +private: + Var_Decl(Const_String name, Var_Kind vkind, int pos); + Var_Decl(Var_Kind vkind, int pos); + Var_Decl(Variable_ID v); + Var_Decl(Const_String name, Global_Var_ID v); + Var_Decl(Const_String name, Global_Var_ID v, Argument_Tuple function_of); + + friend class F_Declaration; // creates local variables + friend class Global_Var_Decl; // its constructors create Var_Decls. + + friend class Global_Input_Output_Tuple; + friend void copy_var_decls(Variable_ID_Tuple &new_vl, Variable_ID_Tuple &vl); + +private: + int instance; + void setup_name(); + + // these set up the names + friend class Rel_Body; +// friend class F_Declaration; already a friend + +private: + Variable_ID remap; // pointer to new copy of this node + + // lots of things need to get at "remap" - lots of relation ops, + // and functions that move UFS's around: + // dnf::make_level_carried_to and Conjunct::move_UFS_to_input() + // Also of course Conjunct::remap and push_exists + friend_rel_ops; + friend class DNF; + friend class Conjunct; + + // this prints remap to the debugging output + friend void print_var_addrs(std::string &s, Variable_ID v); + + friend void reset_remap_field(Variable_ID v); + friend void reset_remap_field(Sequence &S); + friend void reset_remap_field(Sequence &S, int var_no); + friend void reset_remap_field(Variable_ID_Tuple &S); + friend void reset_remap_field(Variable_ID_Tuple &S, int var_no); + +private: + + Var_Kind var_kind; + int position; // only for Input_Var, Output_Var + Global_Var_ID global_var; // only for Global_Var + Argument_Tuple of; // only for Global_Var +}; + +bool rm_variable(Variable_ID_Tuple &vl, Variable_ID v); +void reset_remap_field(Sequence &S); +void reset_remap_field(Sequence &S, int var_no); +void reset_remap_field(Variable_ID v); +void reset_remap_field(Variable_ID_Tuple &S); +void reset_remap_field(Variable_ID_Tuple &S, int var_no); + +class Global_Input_Output_Tuple: public Tuple { +public: + Global_Input_Output_Tuple(Var_Kind in_my_kind, int init=-1); + ~Global_Input_Output_Tuple(); + virtual Variable_ID &operator[](int index); + virtual const Variable_ID &operator[](int index) const; +private: + Var_Kind my_kind; + static const int initial_allocation; +}; + +extern Global_Input_Output_Tuple input_vars; +extern Global_Input_Output_Tuple output_vars; +// This allows the user to refer to set_vars to query sets, w/o knowing +// they are really inputs. +extern Global_Input_Output_Tuple &set_vars; + +Variable_ID input_var(int nth); +Variable_ID output_var(int nth); +Variable_ID set_var(int nth); + + + +// +// Global_Var_ID uniquely identifies global var-s through the whole program. +// Global_Var_Decl is an ADT with the following operations: +// - create global variable, +// - find the arity of the variable, (default = 0, for symbolic consts) +// - get the name of global variable, +// - tell if two variables are the same (if they are the same object) +// + +class Global_Var_Decl { +public: + Global_Var_Decl(Const_String baseName); + + virtual Const_String base_name() const + { + return loc_rep1.base_name; + } + + virtual void set_base_name(Const_String newName) + { + loc_rep1.base_name = newName; + loc_rep2.base_name = newName; + } + + virtual int arity() const + { + return 0; // default compatible with old symbolic constant stuff + } + + virtual Omega_Var *really_omega_var(); // until we get RTTI in C++ + virtual Coef_Var_Decl *really_coef_var(); // until we get RTTI in C++ + virtual Global_Kind kind() const; + +private: + + friend class Rel_Body; // Rel_Body::get_local calls this get_local + + Variable_ID get_local() + { + assert(arity() == 0); + return &loc_rep1; + } + Variable_ID get_local(Argument_Tuple of) + { + assert(arity() == 0 || of == Input_Tuple || of == Output_Tuple); + return ((arity() == 0 || of == Input_Tuple) ? &loc_rep1 : &loc_rep2); + } + + // local representative, there is just 1 for every 0-ary global variable + Var_Decl loc_rep1; // arity == 0, or arity > 0 and of == In + Var_Decl loc_rep2; // arity > 0 and of == Out + +public: +// friend class Rel_Body; // Rel_Body::setup_names sets instance + friend class Var_Decl; + int instance; +}; + + +class Coef_Var_Decl : public Global_Var_Decl { +public: + Coef_Var_Decl(int id, int var); + int stmt() const; + int var() const; + virtual Global_Kind kind() const; + virtual Coef_Var_Decl *really_coef_var(); // until we get RTTI in C++ + +private: + int i, v; +}; + + + +// +// Test subclass for Global_Var: named global variable +// +class Free_Var_Decl : public Global_Var_Decl { +public: + Free_Var_Decl(Const_String name); + Free_Var_Decl(Const_String name, int arity); + int arity() const; + virtual Global_Kind kind() const; + +private: + int _arity; +}; + + +/* === implementation functions === */ +void copy_var_decls(Variable_ID_Tuple &new_vl, Variable_ID_Tuple &vl); +void free_var_decls(Variable_ID_Tuple &vl); + +extern int wildCardInstanceNumber; + +} // namespace + +#endif diff --git a/omegalib/omega_lib/include/omega/reach.h b/omegalib/omega_lib/include/omega/reach.h new file mode 100644 index 0000000..ff4bf79 --- /dev/null +++ b/omegalib/omega_lib/include/omega/reach.h @@ -0,0 +1,23 @@ +#if ! defined _reach_h +#define _reach_h 1 + +namespace omega { + +class reachable_information { +public: + Tuple node_names; + Tuple node_arity; + Dynamic_Array1 start_nodes; + Dynamic_Array2 transitions; +}; + + +Dynamic_Array1 * +Reachable_Nodes(reachable_information * reachable_info); + +Dynamic_Array1 * +I_Reachable_Nodes(reachable_information * reachable_info); + +} // namespace + +#endif diff --git a/omegalib/omega_lib/src/RelBody.cc b/omegalib/omega_lib/src/RelBody.cc new file mode 100644 index 0000000..825b153 --- /dev/null +++ b/omegalib/omega_lib/src/RelBody.cc @@ -0,0 +1,906 @@ +/***************************************************************************** + Copyright (C) 1994-2000 the Omega Project Team + Copyright (C) 2005-2011 Chun Chen + All Rights Reserved. + + Purpose: + class Rel_Body, internal Relation representation + + Notes: + + History: + 11/26/09 Remove unecessary mandatary checking for set or relation, + treat them uniformly for easy coding, by Chun Chen +*****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include + +namespace omega { + +Rel_Body null_rel; +bool Rel_Body::is_null() const { + return(this == &null_rel); +} + + +int Rel_Body::max_ufs_arity() { + int ma = 0, a; + for (Variable_ID_Iterator v(*global_decls()); v; v++) { + a = (*v)->get_global_var()->arity(); + if (a > ma) + ma = a; + } + return ma; +} + +int Rel_Body::max_ufs_arity_of_set() { + int ma = 0, a; + for (Variable_ID_Iterator v(*global_decls()); v; v++) + if ((*v)->function_of() == Set_Tuple) { + a = (*v)->get_global_var()->arity(); + if (a > ma) + ma = a; + } + return ma; +} + +int Rel_Body::max_ufs_arity_of_in() { + int ma = 0, a; + for (Variable_ID_Iterator v(*global_decls()); v; v++) + if ((*v)->function_of() == Input_Tuple) { + a = (*v)->get_global_var()->arity(); + if (a > ma) + ma = a; + } + return ma; +} + +int Rel_Body::max_ufs_arity_of_out() { + int ma = 0, a; + for (Variable_ID_Iterator v(*global_decls()); v; v++) + if ((*v)->function_of() == Output_Tuple) { + a = (*v)->get_global_var()->arity(); + if (a > ma) + ma = a; + } + return ma; +} + +int Rel_Body::max_shared_ufs_arity() { + int ma = 0, a; + for (Variable_ID_Iterator v(*global_decls()); v; v++) + for (Variable_ID_Iterator v2(*global_decls()); v2; v2++) + if (*v != *v2 + && (*v)->get_global_var() == (*v2)->get_global_var() + && (*v)->function_of() != (*v2)->function_of()) { + a = (*v)->get_global_var()->arity(); + if (a > ma) + ma = a; + } + return ma; +} + +// +// Input and output variables. +// +void Rel_Body::name_input_var(int nth, Const_String S) { + // assert(1 <= nth && nth <= number_input && (!is_set() || skip_set_checks > 0)); + if (is_null()) + throw std::invalid_argument("empty relation"); + if (nth < 1 || nth > number_input) + throw std::invalid_argument("invalid input var number"); + In_Names[nth] = S; +} + +void Rel_Body::name_output_var(int nth, Const_String S) { + // assert(1<= nth && nth <= number_output && (!is_set() || skip_set_checks > 0)); + if (is_null()) + throw std::invalid_argument("empty relation"); + if (nth < 1 || nth > number_output) + throw std::invalid_argument("invalid output var number"); + Out_Names[nth] = S; +} + +void Rel_Body::name_set_var(int nth, Const_String S) { + if (number_output != 0) + throw std::runtime_error("relation is not a set"); + name_input_var(nth, S); +} + +int Rel_Body::n_inp() const { + // assert(!is_null() && (!is_set()||skip_set_checks>0)); + if (is_null()) + return 0; + else + return number_input; +} + +int Rel_Body::n_out() const { + // assert(!is_null() && (!is_set()||skip_set_checks>0)); + if (is_null()) + return 0; + else + return number_output; +} + +int Rel_Body::n_set() const { + if (number_output != 0) + throw std::runtime_error("relation is not a set"); + return n_inp(); +} + +Variable_ID Rel_Body::input_var(int nth) { + // assert(!is_null()); + // assert(!is_set() || skip_set_checks>0); + // assert(1 <= nth && nth <= number_input); + if (is_null()) + throw std::invalid_argument("empty relation"); + if (nth < 1 || nth > number_input) + throw std::invalid_argument("invalid input var number"); + input_vars[nth]->base_name = In_Names[nth]; + return input_vars[nth]; +} + +Variable_ID Rel_Body::output_var(int nth) { + // assert(!is_null()); + // assert(!is_set() || skip_set_checks>0); + // assert(1<= nth && nth <= number_output); + if (is_null()) + throw std::invalid_argument("empty relation"); + if (nth < 1 || nth > number_output) + throw std::invalid_argument("invalid output var number"); + output_vars[nth]->base_name = Out_Names[nth]; + return output_vars[nth]; +} + +Variable_ID Rel_Body::set_var(int nth) { + if (number_output != 0) + throw std::runtime_error("relation is not a set"); + return input_var(nth); +} + +// +// Add the AND node to the relation. +// Useful for adding restraints. +// +F_And *Rel_Body::and_with_and() { + assert(!is_null()); + if (is_simplified()) + DNF_to_formula(); + relation()->finalized = false; + Formula *f = rm_formula(); + F_And *a = add_and(); + a->add_child(f); + return a; +} + +// +// Add constraint to relation at the upper level. +// +EQ_Handle Rel_Body::and_with_EQ() { + assert(!is_null()); + if (is_simplified()) + DNF_to_formula(); + assert(! is_shared()); // The relation has been split. + relation()->finalized = false; + return find_available_conjunct()->add_EQ(); +} + +EQ_Handle Rel_Body::and_with_EQ(const Constraint_Handle &initial) { + assert(!is_null()); + assert(initial.relation()->is_simplified()); + EQ_Handle H = and_with_EQ(); + copy_constraint(H, initial); + return H; +} + +GEQ_Handle Rel_Body::and_with_GEQ() { + assert(!is_null()); + if (is_simplified()) + DNF_to_formula(); + assert(! is_shared()); // The relation has been split. + relation()->finalized = false; // We are giving out a handle. + // We should evantually implement finalization + // of subtrees, so the existing formula cannot + // be modified. + return find_available_conjunct()->add_GEQ(); +} + +GEQ_Handle Rel_Body::and_with_GEQ(const Constraint_Handle &initial) { + assert(!is_null()); + assert(initial.relation()->is_simplified()); + GEQ_Handle H = and_with_GEQ(); + copy_constraint(H, initial); + return H; +} + + + +Conjunct *Rel_Body::find_available_conjunct() { + Conjunct *c; + assert(!is_null()); + + if (children().empty()) { + c = add_conjunct(); + } + else { + assert(children().length() == 1); + Formula *kid = children().front(); // RelBodies have only one child + c = kid->find_available_conjunct(); + if (c==NULL) { + remove_child(kid); + F_And *a = add_and(); + a->add_child(kid); + c = a->add_conjunct(); + } + } + return c; +} + +void Rel_Body::finalize() { + assert(!is_null()); + if (!is_finalized()) + assert(! is_shared()); // no other pointers into here + finalized = true; + if (! children().empty()) + children().front()->finalize(); // Can have at most one child +} + +// Null Rel_Body +// This is the only rel_body constructor that has ref_count initialized to 1; +// That's because it's used to construct the global Rel_Body "null_rel". +// Unfortunately because we don't know in what order global constructors will +// be called, we could create a global relation with the default relation +// constructor (which would set the null_rel ref count to 1), and *then* +// call Rel_Body::Rel_Body(), which would set it back to 0, leaving a relation +// that points to a rel_body with it's ref_count set to 0! So this is done as +// a special case, in which the ref_count is always 1. +Rel_Body::Rel_Body(): + Formula(0, this), + ref_count(1), + status(under_construction), + number_input(0), number_output(0), + In_Names(0), Out_Names(0), + simplified_DNF(NULL), + r_conjs(0), + finalized(true), + _is_set(false) { +} + + +Rel_Body::Rel_Body(int n_input, int n_output): + Formula(0, this), + ref_count(0), + status(under_construction), + number_input(n_input), number_output(n_output), + In_Names(n_input), Out_Names(n_output), + simplified_DNF(NULL), + r_conjs(0), + finalized(false) { + if (n_output == 0) + _is_set = true; + else + _is_set = false; + if(pres_debug) { + fprintf(DebugFile, "+++ Create Rel_Body::Rel_Body(%d, %d) = 0x%p +++\n", + n_input, n_output, this); + } + int i; + for(i=1; i<=number_input; i++) { + In_Names[i] = Const_String(); + } + for(i=1; i<=number_output; i++) { + Out_Names[i] = Const_String(); + } +} + +// Rel_Body::Rel_Body(Rel_Body *r): +// Formula(0, this), +// ref_count(0), +// status(r->status), +// number_input(r->number_input), number_output(r->number_output), +// In_Names(r->number_input), Out_Names(r->number_output), +// simplified_DNF(NULL), +// r_conjs(r->r_conjs), +// finalized(r->finalized), +// _is_set(r->_is_set) { +// if(pres_debug) { +// fprintf(DebugFile, "+++ Copy Rel_Body::Rel_Body(Rel_Body * 0x%p) = 0x%p +++\n", r, this); +// prefix_print(DebugFile); +// } + +// int i; +// for(i=1;i<=r->number_input;i++) In_Names[i] = r->In_Names[i]; +// for(i=1;i<=r->number_output;i++) Out_Names[i] = r->Out_Names[i]; +// copy_var_decls(Symbolic,r->Symbolic); + +// if(!r->children().empty() && r->simplified_DNF==NULL) { +// Formula *f = r->formula()->copy(this,this); +// f->remap(); +// children().append(f); +// } +// else if(r->children().empty() && r->simplified_DNF!=NULL) { +// simplified_DNF = r->simplified_DNF->copy(this); +// simplified_DNF->remap(); +// } +// else { // copy NULL relation +// } + +// reset_remap_field(r->Symbolic); +// } + +Rel_Body *Rel_Body::clone() { + Rel_Body *b = new Rel_Body(); + + b->ref_count = 0; + b->status = status; + b->number_input = number_input; + b->number_output = number_output; + b->r_conjs = r_conjs; + b->finalized = finalized; + b->_is_set = _is_set; + + b->In_Names = Tuple(number_input); + b->Out_Names = Tuple(number_output); + for(int i = 1; i <= number_input; i++) + b->In_Names[i] = In_Names[i]; + for(int i = 1; i <= number_output; i++) + b->Out_Names[i] = Out_Names[i]; + + copy_var_decls(b->Symbolic, Symbolic); + + if(!children().empty() && simplified_DNF==NULL) { + Formula *f = formula()->copy(b, b); + f->remap(); + b->children().append(f); + } + else if(children().empty() && simplified_DNF!=NULL) { + b->simplified_DNF = simplified_DNF->copy(b); + b->simplified_DNF->remap(); + } + else { // copy NULL relation + } + + reset_remap_field(Symbolic); + return b; +} + + +Rel_Body::Rel_Body(Rel_Body *r, Conjunct *c): + Formula(0, this), + ref_count(0), + status(uncompressed), + number_input(r->number_input), number_output(r->number_output), + In_Names(r->number_input), Out_Names(r->number_output), + r_conjs(0), + finalized(r->finalized), + _is_set(r->_is_set) { + if(pres_debug) { + fprintf(DebugFile, "+++ Copy Rel_Body::Rel_Body(Rel_Body * 0x%p, Conjunct * 0x%p) = 0x%p +++\n",r,c,this); + } + + int i; + for(i=1;i<=r->number_input;i++) In_Names[i] = r->In_Names[i]; + for(i=1;i<=r->number_output;i++) Out_Names[i] = r->Out_Names[i]; + copy_var_decls(Symbolic,r->Symbolic); + + // assert that r has as many variables as c requires, or that c is from r + assert(r == c->relation()); + assert(r->simplified_DNF != NULL); + simplified_DNF = new DNF; + simplified_DNF->add_conjunct(c->copy_conj_diff_relation(this,this)); + single_conjunct()->remap(); + + reset_remap_field(r->Symbolic); +} + +Rel_Body::~Rel_Body() { + if(pres_debug) { + fprintf(DebugFile, "+++ Destroy Rel_Body::~Rel_Body() 0x%p +++\n", this); + } + free_var_decls(Symbolic); + if(simplified_DNF != NULL) { + delete simplified_DNF; + } +} + +// +// Take a relation that has been simplified and convert it +// back to formula form. +// +void Rel_Body::DNF_to_formula() { + assert(!is_null()); + if (simplified_DNF != NULL) { + simplified_DNF->DNF_to_formula(this); + simplified_DNF = NULL; + status = under_construction; + } +} + +bool Rel_Body::can_add_child() { + assert(this != &null_rel); + return n_children() < 1; +} + + + +// ******************** +// Simplify functions +// ******************** + + +extern int s_rdt_constrs; + + +// +// Simplify a given relation. +// Store the resulting DNF in the relation, clean out the formula. +// +void Rel_Body::simplify(int rdt_conjs, int rdt_constrs) { + if(simplified_DNF == NULL) { + finalized = true; + if(children().empty()) { + simplified_DNF = new DNF; + } + else { + if(pres_debug) { + if(DebugFile==NULL) { + DebugFile = fopen("test.out", "w"); + if(DebugFile==NULL) + fprintf(stderr, "Can not open file test.out\n"); + } + } + + assert(children().length()==1); + if(pres_debug) { + fprintf(DebugFile, "=== %p Rel_Body::simplify(%d, %d) Input tree (%d) ===\n", this,rdt_conjs,rdt_constrs,r_conjs); + prefix_print(DebugFile); + } + verify_tree(); + + beautify(); + verify_tree(); + + rearrange(); + verify_tree(); + + beautify(); + verify_tree(); + + s_rdt_constrs = rdt_constrs; + if(pres_debug) { + fprintf(DebugFile, "\n=== In simplify, before DNFize ===\n"); + prefix_print(DebugFile); + } + DNFize(); + if(pres_debug) { + fprintf(DebugFile, "\n=== In simplify, after DNFize ===\n"); + prefix_print(DebugFile); + } + verify_tree(); + + + simplified_DNF->rm_redundant_inexact_conjs(); + verify_tree(); + + if (rdt_conjs > 0 && !simplified_DNF->is_definitely_false() && simplified_DNF->length() > 1) { + simplified_DNF->rm_redundant_conjs(rdt_conjs-1); + verify_tree(); + } + + if(pres_debug) { + fprintf(DebugFile, "\n=== Resulting Relation ===\n"); + prefix_print(DebugFile); + } + } + } + else { + /* Reprocess DNF to get rid of redundant stuff */ + + if (rdt_constrs < 0) return; + simplified_DNF->rm_redundant_inexact_conjs(); + + if (rdt_conjs > r_conjs) { + if(pres_debug) + fprintf(DebugFile,"=== Rel_Body::simplify() redundant CONJUNCTS ===\n"); + simplified_DNF->rm_redundant_conjs(rdt_conjs-1); + } + if (rdt_constrs > 0 ) { + if(pres_debug) + fprintf(DebugFile,"=== Rel_Body::simplify() redundant CONSTR-S ===\n"); + s_rdt_constrs = rdt_constrs; + simplified_DNF->simplify(); + } + } + + r_conjs = rdt_conjs; + + for(DNF_Iterator D(simplified_DNF); D.live(); D.next()) { + D.curr()->set_relation(this); + D.curr()->set_parent(this); + } +} + + +// ****************** +// Query functions +// ****************** + + +// +// Check if relation has a single conjunct formula and return this conjunct. +// +Conjunct *Rel_Body::single_conjunct() { + simplify(); + return simplified_DNF->single_conjunct(); +} + +bool Rel_Body::has_single_conjunct() { + simplify(); + return simplified_DNF->has_single_conjunct(); +} + +// +// Remove and return first conjunct +// +Conjunct *Rel_Body::rm_first_conjunct() { + simplify(); + return simplified_DNF->rm_first_conjunct(); +} + + +void Rel_Body::query_difference(Variable_ID v1, Variable_ID v2, coef_t &lowerBound, coef_t &upperBound, bool &guaranteed) { + simplify(); + + coef_t _lb, _ub; + int first = 1; + bool _g; + lowerBound = negInfinity; // default values if no DNF's + upperBound = posInfinity; + guaranteed = 0; + + for (DNF_Iterator D(simplified_DNF); D.live(); D.next()) { + (*D)->query_difference(v1, v2, _lb, _ub, _g); + if (first) { + lowerBound = _lb; + upperBound = _ub; + guaranteed = _g; + first = 0; + } + else { + guaranteed = guaranteed && _g; + lowerBound = min(lowerBound, _lb); + upperBound = max(upperBound, _ub); + } + } +} + + +void Rel_Body::query_variable_bounds(Variable_ID v, coef_t &lowerBound, coef_t &upperBound) { + simplify(); + + coef_t _lb, _ub; + int first = 1; + lowerBound = negInfinity; // default values if no DNF's + upperBound = posInfinity; + + for (DNF_Iterator D(simplified_DNF); D.live(); D.next()) { + (*D)->query_variable_bounds(v, _lb, _ub); + if (first) { + lowerBound = _lb; + upperBound = _ub; + first = 0; + } + else { + lowerBound = min(lowerBound, _lb); + upperBound = max(upperBound, _ub); + } + } +} + +coef_t Rel_Body::query_variable_mod(Variable_ID v, coef_t factor) { + simplify(); + + bool first = true; + coef_t result; + + for (DNF_Iterator D(simplified_DNF); D.live(); D.next()) { + coef_t t = (*D)->query_variable_mod(v, factor); + if (t == posInfinity) + return posInfinity; + + if (first) { + result = t; + first = false; + } + else { + if (result != t) + return posInfinity; + } + } + + return result; +} + + + +// +// Simplify formula if needed and return the resulting DNF. +// +DNF* Rel_Body::query_DNF() { + return(query_DNF(false,false)); +} + +DNF* Rel_Body::query_DNF(int rdt_conjs, int rdt_constrs) { + simplify(rdt_conjs, rdt_constrs); + return(simplified_DNF); +} + +// +// Other formula queries. +// + +// Interpret UNKNOWN as true, then check satisfiability +// i.e., check if the formula simplifies to FALSE, since the library +// will never say that if the *known* constraints are unsatisfiable by +// themselves. +bool Rel_Body::is_upper_bound_satisfiable() { + int tmp = s_rdt_constrs; + s_rdt_constrs = -1; + simplify(); + s_rdt_constrs = tmp; + return(!simplified_DNF->is_definitely_false()); +} + +// Interpret UNKNOWN as false, then check satisfiability +// i.e., check if there exist any exact conjuncts in the solution +bool Rel_Body::is_lower_bound_satisfiable() { + int tmp = s_rdt_constrs; + s_rdt_constrs = -1; + simplify(); + s_rdt_constrs = tmp; + for(DNF_Iterator d(simplified_DNF); d; d++) + if((*d)->is_exact()) return true; + return false; +} + +bool Rel_Body::is_satisfiable() { + assert(is_lower_bound_satisfiable() == is_upper_bound_satisfiable()); + return is_upper_bound_satisfiable(); +} + +// Check if we can easily determine if the formula evaluates to true. +bool Rel_Body::is_obvious_tautology() { + int tmp = s_rdt_constrs; + s_rdt_constrs = 0; + simplify(); + s_rdt_constrs = tmp; + return(simplified_DNF->is_definitely_true()); +} + +// Expensive check to determine if the formula evaluates to true. +bool Rel_Body::is_definite_tautology() { + if(is_obvious_tautology()) return true; + Relation l = Lower_Bound(Relation(*this,1)); + return !(Complement(l).is_upper_bound_satisfiable()); +} + +bool Rel_Body::is_unknown() { + simplify(); + return(has_single_conjunct() && single_conjunct()->is_unknown()); +} + +// +// Get accuracy status of the relation +// + +Rel_Unknown_Uses Rel_Body::unknown_uses() { + if (!is_simplified()) + simplify(); + + Rel_Unknown_Uses local_status=0; + int n_conj=0; + + for (DNF_Iterator c(simplified_DNF); c; c++) { + n_conj++; + if ((*c)->is_exact()) + local_status |= no_u; + else if ((*c)->is_unknown()) + local_status |= or_u; + else + local_status |= and_u; + } + + if (n_conj == 0) { + assert(local_status == 0); + local_status = no_u; + } + assert(local_status); +#if ! defined NDEBUG + Rel_Unknown_Uses impossible = (and_u | or_u); + assert( (local_status & impossible) != impossible); +#endif + + return local_status; +} + +void Rel_Body::interpret_unknown_as_false() { + simplify(); + simplified_DNF->remove_inexact_conj(); +} + +void Rel_Body::interpret_unknown_as_true() { + simplify(); + for(DNF_Iterator d(simplified_DNF); d; d++) + (*d)->interpret_unknown_as_true(); +} + + +void Rel_Body::reverse_leading_dir_info() { + if (is_simplified()) { + for (DNF_Iterator c(simplified_DNF); c; c++) + (*c)->reverse_leading_dir_info(); + } + else { + assert(!simplified_DNF); + assert(children().size() == 1); + children().front()->reverse_leading_dir_info(); + } +} + +// +// Rel_Body::DNFize just DNF-izes its child node and calls verify +// + +DNF* Rel_Body::DNFize() { +#if defined(INCLUDE_COMPRESSION) + assert(!this->is_compressed()); +#endif + if (! simplified_DNF) { + simplified_DNF = children().remove_front()->DNFize(); + + int mua = max_shared_ufs_arity(); + if (mua > 0) { + if (pres_debug) { + fprintf(DebugFile, "\n=== In DNFize, before LCDNF ===\n"); + prefix_print(DebugFile); + } + + simplified_DNF->make_level_carried_to(mua); + } + + if(pres_debug) { + fprintf(DebugFile, "\n=== In DNFize, before verify ===\n"); + prefix_print(DebugFile); + } + + simplified_DNF->simplify(); + } + + assert(children().length() == 0); + + return simplified_DNF; +} + +void Rel_Body::make_level_carried_to(int level) { + if (!simplified_DNF) { + DNFize(); + } + + assert(simplified_DNF && children().empty()); + + simplified_DNF->make_level_carried_to(level); +} + +// +// if direction==0, move all conjuncts with >= level leading 0's to return +// else move all conjuncts with level-1 0's followed by +// the appropriate signed difference to returned Relation +// + +Relation Rel_Body::extract_dnf_by_carried_level(int level, int direction) { + if (!simplified_DNF) { + DNFize(); + } + + assert(simplified_DNF && children().empty()); + + simplified_DNF->make_level_carried_to(level); + + Relation extracted(n_inp(), n_out()); + extracted.copy_names(*this); + assert(extracted.rel_body->children().empty()); + assert(extracted.rel_body->simplified_DNF == NULL); + extracted.rel_body->simplified_DNF = new DNF; + extracted.rel_body->Symbolic = Symbolic; + + DNF *remaining = new DNF; + Conjunct *curr; + + for (curr = simplified_DNF->rm_first_conjunct(); + curr; + curr = simplified_DNF->rm_first_conjunct()) { + assert(curr->guaranteed_leading_0s >= level || curr->guaranteed_leading_0s == curr->possible_leading_0s); + assert(curr->possible_leading_0s >= 0); + + curr->assert_leading_info(); + + if ((direction == 0 && curr->guaranteed_leading_0s >= level) || + (curr->guaranteed_leading_0s == level-1 && + curr->leading_dir_valid_and_known() && + curr->leading_dir * direction > 0)) { + extracted.rel_body->simplified_DNF->add_conjunct(curr); + } + else { + remaining->add_conjunct(curr); + } + } + delete simplified_DNF; + simplified_DNF = remaining; + +#if ! defined NDEBUG + for (DNF_Iterator rc(simplified_DNF); rc; rc++) + (*rc)->assert_leading_info(); + + for (DNF_Iterator ec(extracted.rel_body->simplified_DNF); ec; ec++) + (*ec)->assert_leading_info(); +#endif + + finalize(); + extracted.finalize(); + return extracted; +} + +//Compress/uncompress functions + +bool Rel_Body::is_compressed() { +#if defined(INCLUDE_COMPRESSION) + if(is_simplified()) { + for(DNF_Iterator p(simplified_DNF); p.live(); p.next()) { + if(p.curr()->is_compressed()) + return true; + } + } + return false; +#else + return true; // This allows is_compressed assertions to work +#endif +} + +void Rel_Body::compress() { +#if !defined(INCLUDE_COMPRESSION) + return; +#else + if (status == compressed) + return; + if (pres_debug) + fprintf(DebugFile,">>> Compressing relation %p\n",this); + simplify(); + for(DNF_Iterator p(simplified_DNF); p.live(); p.next()) { + p.curr()->compress(); + status = compressed; + } +#endif +} + +void Rel_Body::uncompress() { +#if !defined(INCLUDE_COMPRESSION) + return; +#else + if (pres_debug) + fprintf(DebugFile,"<<< Uncompressing relation %p\n",this); + assert(is_simplified()); + for(DNF_Iterator p(simplified_DNF); p.live(); p.next()) { + p.curr()->uncompress(); + status = uncompressed; + } +#endif +} + +} diff --git a/omegalib/omega_lib/src/RelVar.cc b/omegalib/omega_lib/src/RelVar.cc new file mode 100644 index 0000000..d9b977c --- /dev/null +++ b/omegalib/omega_lib/src/RelVar.cc @@ -0,0 +1,71 @@ +#include +#include + +namespace omega { + +Variable_ID Rel_Body::get_local(const Variable_ID v) { + Global_Var_ID g; + if (v->kind() == Global_Var) { + g = v->get_global_var(); + if (g->arity()) return get_local(g,v->function_of()); + return get_local(g); + } + if (is_set()) return set_var(v->get_position()); + if (v->kind() == Input_Var) return input_var(v->get_position()); + if (v->kind() == Output_Var) return output_var(v->get_position()); + assert(0 && "Can only get local for variable with global scope"); + exit(1); + return 0; +} + +// +// Find or declare global variable. +// If the VarID does not exist, it is created. Otherwise it's returned. +// Note that this version now works only for 0-ary functions. +// +Variable_ID Rel_Body::get_local(const Global_Var_ID G) { + assert(G->arity() == 0); + for(Variable_Iterator i(Symbolic); i; i++) + if ((*i)->get_global_var() == G) + return (*i); + + Variable_ID v = G->get_local(); + Symbolic.append(v); + return v; +} + + +Variable_ID Rel_Body::get_local(const Global_Var_ID G, Argument_Tuple of) { + assert(G->arity() == 0 || of == Input_Tuple || of == Output_Tuple); + + for(Variable_Iterator i = Symbolic; i; i++) + if ((*i)->get_global_var() == G && (G->arity() == 0 || + of == (*i)->function_of())) + return (*i); + + Variable_ID V = G->get_local(of); + Symbolic.append(V); + return V; +} + + +bool Rel_Body::has_local(const Global_Var_ID G) { + assert(G->arity() == 0); + for(Variable_Iterator i = Symbolic; i; i++) + if ((*i)->get_global_var() == G) + return true; + return false; +} + + +bool Rel_Body::has_local(const Global_Var_ID G, Argument_Tuple of) { + assert(G->arity() == 0 || of == Input_Tuple || of == Output_Tuple); + + for(Variable_Iterator i = Symbolic; i; i++) + if ((*i)->get_global_var() == G && (G->arity() == 0 || + of == (*i)->function_of())) + return true; + return false; +} + +} // namespace diff --git a/omegalib/omega_lib/src/Relation.cc b/omegalib/omega_lib/src/Relation.cc new file mode 100644 index 0000000..1cca43a --- /dev/null +++ b/omegalib/omega_lib/src/Relation.cc @@ -0,0 +1,279 @@ +/***************************************************************************** + Copyright (C) 1994-2000 the Omega Project Team + Copyright (C) 2005-2011 Chun Chen + All Rights Reserved. + + Purpose: + class Relation + + Notes: + + History: +*****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include + +namespace omega { + +// copy function for Relation, will be removed in the future +// in favor of correct C++ copy constructor and const paramater passing +Relation copy(const Relation &t) { + Relation r = t; + return r; +} + +// +// Create null relation. +// +Relation::Relation() : rel_body(&null_rel) { + rel_body->ref_count = 1; +} + +Relation Relation::Null() { + return Relation(); +} + +bool Relation::is_null() const { + return(rel_body == &null_rel); +} + + +// +// Create a relation. Its will be built later. +// +Relation::Relation(int n_input, int n_output) { + rel_body = new Rel_Body(n_input,n_output); + rel_body->ref_count = 1; +} + +Relation::Relation(Rel_Body &r, int) { + rel_body = &r; + r.ref_count++; +} + +Relation Relation::Empty(const Relation &R) { + if (R.is_set()) return Relation(R.n_set()); + else return Relation(R.n_inp(),R.n_out()); +} + +// +// Create relation which is FALSE or TRUE. +// + +Relation Relation::True(const Relation &R) { + if (R.is_set()) return True(R.n_set()); + else return True(R.n_inp(),R.n_out()); +} + +Relation Relation::False(const Relation &R) { + if (R.is_set()) return False(R.n_set()); + else return False(R.n_inp(),R.n_out()); +} + +Relation Relation::Unknown(const Relation &R) { + if (R.is_set()) return Unknown(R.n_set()); + else return Unknown(R.n_inp(), R.n_out()); +} + + +Relation Relation::True(int setvars) { + Relation R(setvars); + R.add_and(); + R.finalize(); + return R; +} + +Relation Relation::True (int in, int out) { + Relation R(in,out); + R.add_and(); + R.finalize(); + return R; +} + +Relation Relation::False (int setvars) { + Relation R(setvars); + R.add_or(); + R.finalize(); + return R; +} + +Relation Relation::False (int in, int out) { + Relation R(in,out); + R.add_or(); + R.finalize(); + return R; +} + + +Relation Relation::Unknown (int setvars) { + Relation R(setvars); + R.add_and(); + R.finalize(); + R.simplify(); + Conjunct * c= R.single_conjunct(); + c->make_inexact(); + return R; +} + +Relation Relation::Unknown (int in, int out) { + Relation R(in,out); + R.add_and(); + R.finalize(); + R.simplify(); + Conjunct * c= R.single_conjunct(); + c->make_inexact(); + return R; +} + + +// +// Copy a relation. +// +Relation::Relation(const Relation &r) { +#if defined(INCLUDE_COMPRESSION) + assert(!r.is_compressed()); +#endif + if (r.is_finalized()) { + rel_body = r.rel_body; + rel_body->ref_count++; + } else { + assert(! r.rel_body->is_shared()); + // rel_body = new Rel_Body(r.rel_body); + rel_body = r.rel_body->clone(); + rel_body->ref_count = 1; + } +} + +// +// Copy relation r and replace formula in it with conjunct c. +// Wayne (TM) function. +// +Relation::Relation(const Relation &r, Conjunct *c) { + rel_body = new Rel_Body(r.rel_body, c); + rel_body->ref_count = 1; +} + + +// +// Assign a relation r to this relation. +// +Relation &Relation::operator=(const Relation &r) { +#if defined(INCLUDE_COMPRESSION) + assert (!r.is_compressed()); +#endif + + /* === Destroy this === */ + assert(rel_body->ref_count >= 1); + if(rel_body!=&null_rel && --(rel_body->ref_count)==0) { + delete rel_body; + } + + /* === Copy r to this === */ + if (r.is_finalized()) { + rel_body = r.rel_body; + rel_body->ref_count++; + } else { + assert(! r.rel_body->is_shared()); + // rel_body = new Rel_Body(r.rel_body); + rel_body = r.rel_body->clone(); + rel_body->ref_count = 1; + } + return *this; +} + +void Relation::copy_names(Rel_Body &r) { + int t; + for(t = 1; t <= r.n_inp(); t++) + name_input_var(t,r.input_var(t)->base_name); + for(t = 1; t <= r.n_out(); t++) + name_output_var(t,r.output_var(t)->base_name); +} + + +// Like makeSet (see Relations.c), but won't invert the relation -- +// fails if it has output instead of input variables. Called in Relation +// functions just after a MapRel, so that we know there are no outputs anyway. + +void Relation::markAsSet() { + assert(!is_null()); + assert(is_set() || (n_inp() >= 0 && n_out() == 0)); + if (!is_set()) split(); // split if we'll modify this + rel_body->_is_set = true; + invalidate_leading_info(); +} + +void Relation::markAsRelation() { + assert(!is_null()); + if (is_set()) split(); // split if we'll modify this + rel_body->_is_set = false; +} + + +Relation::~Relation() { + assert(rel_body->ref_count >= 1); + assert(this->is_null() == (rel_body == &null_rel)); + if(rel_body!=&null_rel && --(rel_body->ref_count)==0) { + if (rel_body == &null_rel) abort(); + delete rel_body; + } +} + + + +// +// One of the representatives using the body wants to be changed. +// Create a separate body for this rep not to damage other reps. +// Return address of the body. Old rep point to new body. +// +Rel_Body *Relation::split() { + assert(rel_body != &null_rel && "Error: Attempt to modify a null relation"); + assert (rel_body->ref_count >= 1); + if(!(rel_body==&null_rel || rel_body->ref_count==1)) { + if(pres_debug) { + fprintf(DebugFile, "+++ SPLIT relation +++\n"); + } + // Rel_Body *new_body = new Rel_Body(rel_body); + Rel_Body *new_body = rel_body->clone(); + new_body->ref_count = 1; + rel_body->ref_count--; + rel_body = new_body; + if(pres_debug>=2) { + fprintf(DebugFile, " copying 0x%p to give 0x%p\n", this, rel_body); + } + } + return (rel_body); +} + + +void Relation::dimensions(int & ndim_all, int &ndim_domain) { + ndim_all = ndim_domain = 0; + int a,d; + simplify(2,2); + for (DNF_Iterator s(query_DNF()); s.live(); s.next()) { + s.curr()->calculate_dimensions(*this, a, d); + if (a > ndim_all) ndim_all = a; + if (d > ndim_domain) ndim_domain = d; + } +} + +// Make a set: assert that it had only input or output variables, make it +// it have only input, set a flag. Called from domain, range, and difference, +// as well as functions that require a set as input. +void Relation::makeSet() { + assert(!is_null()); + // Assert that it is a set... + assert((n_inp() == 0 && n_out() >= 0) || (n_inp() >= 0 && n_out() == 0)); + + if ((n_inp() == 0 && n_out() != 0) || !is_set()) split(); // split if we'll modify this + if (n_inp() == 0 && n_out() != 0) //Inverse the relation + Inverse(*this); // Modifies "this"; also returns this but we ignore it + rel_body->_is_set = true; +} + +} // namespace diff --git a/omegalib/omega_lib/src/Relations.cc b/omegalib/omega_lib/src/Relations.cc new file mode 100644 index 0000000..d7dbe86 --- /dev/null +++ b/omegalib/omega_lib/src/Relations.cc @@ -0,0 +1,2882 @@ +/***************************************************************************** + Copyright (C) 1994-2000 the Omega Project Team + Copyright (C) 2005-2011 Chun Chen + All Rights Reserved. + + Purpose: + Integer set and relation operations. + + Notes: + + History: + 04/22/09 merge_rels, Chun Chen +*****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if defined STUDY_EVACUATIONS +#include +#endif +#include + +namespace omega { + +#define CHECK_MAYBE_SUBSET 1 + +int relation_debug=0; + +namespace { + int leave_pufs_untouched = 0; + Variable_ID_Tuple exists_ids; + List exists_numbers; + F_And * and_below_exists; +} + +/* The following allows us to avoid warnings about passing + temporaries as non-const references. This is useful but + has suddenly become illegal. */ + +Relation consume_and_regurgitate(NOT_CONST Relation &R) { + if(!R.is_null()) + ((Relation &) R).finalize(); + Relation S = (Relation &) R; + (Relation &) R = Relation::Null(); + return S; +} + + +// +// r1 Union r2. +// align the input tuples (if any) for F and G +// align the output tuples (if any) for F and G +// match named variables in F and G +// formula is f | g +// +Relation Union(NOT_CONST Relation &input_r1, + NOT_CONST Relation &input_r2) { + Relation r1 = consume_and_regurgitate(input_r1); + Relation r2 = consume_and_regurgitate(input_r2); + if (r1.is_null()) + return r2; + else if (r2.is_null()) + return r1; + if (r1.n_inp() != r2.n_inp() || r1.n_out() != r2.n_out()) + throw std::invalid_argument("relation arity does not match"); + + // skip_set_checks++; + // assert(r1.n_inp() == r2.n_inp()); + // assert(r1.n_out() == r2.n_out()); + // assert(!r1.is_null() && !r2.is_null()); + int in = r1.n_inp(), out = r1.n_out(); + // skip_set_checks--; + + return MapAndCombineRel2(r1, r2, Mapping::Identity(in, out), + Mapping::Identity(in,out), Comb_Or); +} + + +// +// F intersection G +// align the input tuples (if any) for F and G +// align the output tuples (if any) for F and G +// match named variables in F and G +// formula is f & g +// +Relation Intersection(NOT_CONST Relation &input_r1, + NOT_CONST Relation &input_r2) { + Relation r1 = consume_and_regurgitate(input_r1); + Relation r2 = consume_and_regurgitate(input_r2); + if (r1.is_null()) + return r2; + else if (r2.is_null()) + return r1; + if (r1.n_inp() != r2.n_inp() || r1.n_out() != r2.n_out()) + throw std::invalid_argument("relation arity does not match"); + + // skip_set_checks++; + // assert(r1.n_inp() == r2.n_inp()); + // assert(r1.n_out() == r2.n_out()); + // assert(!r1.is_null() && !r2.is_null()); + int in = r1.n_inp(), out = r1.n_out(); + // skip_set_checks--; + + return MapAndCombineRel2(r1, r2, Mapping::Identity(in,out), + Mapping::Identity(in,out), Comb_And); +} + + +// +// F \ G (the relation F restricted to domain G) +// align the input tuples for F and G +// match named variables in F and G +// formula is f & g +// +Relation Restrict_Domain(NOT_CONST Relation &input_r1, + NOT_CONST Relation &input_r2) { + Relation r1 = consume_and_regurgitate(input_r1); + Relation r2 = consume_and_regurgitate(input_r2); + if (r1.is_null()) + return r1; + else if (r2.is_null()) + return r1; + if (r1.n_inp() != r2.n_set()) + throw std::invalid_argument("relation arity does not match"); + + // assert(!r1.is_null() && !r2.is_null()); + // skip_set_checks++; + // assert(r1.n_inp() == r2.n_set()); + // assert(r2.is_set()); + int in = r1.n_inp(), out = r1.n_out(); + // skip_set_checks--; + + int i; + Mapping m2(r2.n_set()); + for(i=1; i<=r2.n_set(); i++) m2.set_map_set(i, Input_Var,i); + + // skip_set_checks++; + assert(r2.query_guaranteed_leading_0s() == -1 && + r2.query_possible_leading_0s() == -1); + // skip_set_checks--; + + Relation result = MapAndCombineRel2(r1, r2, Mapping::Identity(in,out), + m2, Comb_And); + // FERD -- update leading 0's - the may close up? + //result.invalidate_leading_info(); // could do better + return result; +} + +// +// +// F / G (the relation F restricted to range G) +// align the output tuples for F and G +// match named variables in F and G +// formula is f & g +// +Relation Restrict_Range(NOT_CONST Relation &input_r1, + NOT_CONST Relation &input_r2) { + Relation r1 = consume_and_regurgitate(input_r1); + Relation r2 = consume_and_regurgitate(input_r2); + if (r1.is_null()) + return r1; + else if (r2.is_null()) + return r1; + if (r1.n_out() != r2.n_set()) + throw std::invalid_argument("relation arity does not match"); + + // skip_set_checks++; + // assert(r1.n_out() == r2.n_set()); + // assert(r2.is_set()); + // assert(!r1.is_null() && !r2.is_null()); + int in = r1.n_inp(), out = r1.n_out(); + // skip_set_checks--; + + int i; + Mapping m2(r2.n_set()); + for(i=1; i<=r2.n_set(); i++) m2.set_map_set(i, Output_Var,i); + + // skip_set_checks++; + assert(r2.query_guaranteed_leading_0s() == -1 && + r2.query_possible_leading_0s() == -1); + // skip_set_checks--; + + Relation result = MapAndCombineRel2(r1, r2, Mapping::Identity(in, out), + m2, Comb_And); + // FERD -- update leading 0's - the may close up? + // result.invalidate_leading_info(); // could do better + return result; +} + + +// +// Add input variable to relation. +// +Relation Extend_Domain(NOT_CONST Relation &S) { + Relation R = consume_and_regurgitate(S); + if (R.is_null()) + throw std::invalid_argument("cannot extend domain on null relation"); + + // assert(!R.is_null() && (skip_set_checks || !R.is_set())); + // assert(!R.is_null()); + Rel_Body *r = R.split(); + r->In_Names.append(Const_String()); + r->number_input++; + assert(!r->is_null()); + + if (r->number_input <= r->number_output) + R.invalidate_leading_info(r->number_input); + + return R; +} + +// +// Add more input variables to relation. +// +Relation Extend_Domain(NOT_CONST Relation &S, int more) { + Relation R = consume_and_regurgitate(S); + if (R.is_null()) + throw std::invalid_argument("cannot extend domain on null relation"); + + // assert(!R.is_null()); + R.split(); + for (int i=1; i<=more; i++) R = Extend_Domain(R); + return R; +} + + +// +// Add output variable to relation. +// +Relation Extend_Range(NOT_CONST Relation &S) { + Relation R = consume_and_regurgitate(S); + if (R.is_null()) + throw std::invalid_argument("cannot extend range on null relation"); + + // assert(!R.is_null() && !R.is_set()); + // assert(!R.is_null()); + Rel_Body *r = R.split(); + r->Out_Names.append(Const_String()); + r->number_output++; + assert(!r->is_null()); + + if (r->number_output <= r->number_input) + R.invalidate_leading_info(r->number_output); + + return R; +} + +// +// Add more output variables to relation. +// +Relation Extend_Range(NOT_CONST Relation &S, int more) { + Relation R = consume_and_regurgitate(S); + + // assert(!R.is_null()); + R.split(); + for (int i=1; i<=more; i++) R = Extend_Range(R); + return R; +} + + +// +// Add set variable to set. +// +Relation Extend_Set(NOT_CONST Relation &S) { + Relation R = consume_and_regurgitate(S); + if (R.is_null()) + throw std::invalid_argument("cannot extend set on null relation"); + if (R.n_out() > 0) + throw std::invalid_argument("relation must be a set"); + + // assert(!R.is_null() && R.is_set()); + Rel_Body *r = R.split(); + r->In_Names.append(Const_String()); + r->number_input++; + assert(!r->is_null()); + return R; +} + +// +// Add more variables to set +// +Relation Extend_Set(NOT_CONST Relation &S, int more) { + Relation R = consume_and_regurgitate(S); + R.split(); + for (int i=1; i<=more; i++) R = Extend_Set(R); + return R; +} + + + +// +// Domain and Range. +// Make output (input) variables wildcards and simplify. +// Move all UFS's to have have the remaining tuple as an argument, +// and maprel will move them to the set tuple +// RESET all leading 0's +// +Relation Domain(NOT_CONST Relation &S) { + Relation r = consume_and_regurgitate(S); + if (r.is_null()) + return r; + + // assert(!S.is_null()); + // assert(!r.is_set()); + // skip_set_checks++; + int i; + Mapping m1(r.n_inp(), r.n_out()); + for(i=1; i<=r.n_inp(); i++) m1.set_map_in (i, Set_Var,i); + for(i=1; i<=r.n_out(); i++) m1.set_map_out(i, Exists_Var,i); + // skip_set_checks--; + + int a = r.max_ufs_arity_of_out(); + if (a > 0) { + // UFS's must evacuate from the output tuple + Variable_ID_Tuple remapped; + + r.simplify(); + DNF *d = r.split()->DNFize(); + d->count_leading_0s(); + // Any conjucts with leading_0s == -1 must have >= "a" leading 0s + // What a gross way to do this. Ferd + + for (DNF_Iterator conj(d); conj; conj++) { +#if defined STUDY_EVACUATIONS + study_evacuation(*conj, out_to_in, a); +#endif + + int cL0 = (*conj)->guaranteed_leading_0s; + + for (Variable_ID_Iterator func((*conj)->mappedVars); func; func++) + if ((*func)->kind() == Global_Var) { + Global_Var_ID f = (*func)->get_global_var(); + if (f->arity() > 0 && (*func)->function_of()==Output_Tuple) { + if (cL0 >= f->arity()) { + (*func)->remap = r.get_local(f, Input_Tuple); + } + else { + (*func)->remap = (*conj)->declare(); + (*conj)->make_inexact(); + } + remapped.append(*func); + } + } + (*conj)->remap(); + reset_remap_field(remapped); + remapped.clear(); + + (*conj)->guaranteed_leading_0s = (*conj)->possible_leading_0s = -1; + (*conj)->leading_dir = 0; + } + } + + MapRel1(r, m1, Comb_Id); // this invalidates leading0s + assert(r.is_set() || m1.n_in() == 0); // MapRel can't tell to make a set + r.markAsSet(); // if there were no inputs. + + // skip_set_checks++; + assert(r.query_guaranteed_leading_0s() == -1 && r.query_possible_leading_0s() == -1); + // skip_set_checks--; + + return r; +} + + +Relation Range(NOT_CONST Relation &S) { + Relation r = consume_and_regurgitate(S); + if (r.is_null()) + return r; + + //assert(!r.is_null()); + // skip_set_checks++; + + int i; + Mapping m1(r.n_inp(), r.n_out()); + for(i=1; i<=r.n_inp(); i++) m1.set_map_in (i, Exists_Var,i); + for(i=1; i<=r.n_out(); i++) m1.set_map_out(i, Set_Var,i); + // skip_set_checks--; + + int a = r.max_ufs_arity_of_in(); + if (a > 0) { + // UFS's must evacuate from the input tuple + Variable_ID_Tuple remapped; + + r.simplify(); + DNF *d = r.split()->DNFize(); + d->count_leading_0s(); + // Any conjucts with leading_0s == -1 must have >= "a" leading 0s + // What a gross way to do this. Ferd + + for (DNF_Iterator conj(d); conj; conj++) { +#if defined STUDY_EVACUATIONS + study_evacuation(*conj, in_to_out, a); +#endif + + int cL0 = (*conj)->guaranteed_leading_0s; + for (Variable_ID_Iterator func((*conj)->mappedVars); func; func++) + if ((*func)->kind() == Global_Var) { + Global_Var_ID f = (*func)->get_global_var(); + if (f->arity() > 0 && (*func)->function_of()==Input_Tuple) { + if (cL0 >= f->arity()) { + (*func)->remap = r.get_local(f, Output_Tuple); + } + else { + (*func)->remap = (*conj)->declare(); + (*conj)->make_inexact(); + } + remapped.append(*func); + } + } + (*conj)->remap(); + reset_remap_field(remapped); + remapped.clear(); + + (*conj)->guaranteed_leading_0s = (*conj)->possible_leading_0s = -1; + (*conj)->leading_dir = 0; + } + } + + MapRel1(r, m1, Comb_Id); // this invalidates leading0s + assert(r.is_set() || m1.n_out() == 0); // MapRel can't tell to make a set + r.markAsSet(); // if there were no outputs. + + // skip_set_checks++; + assert(r.query_guaranteed_leading_0s() == -1 && r.query_possible_leading_0s() == -1); + // skip_set_checks--; + + return r; +} + + +// +// Cross Product. Give two sets, A and B, create a relation whose +// domain is A and whose range is B. +// +Relation Cross_Product(NOT_CONST Relation &input_A, + NOT_CONST Relation &input_B) { + Relation A = consume_and_regurgitate(input_A); + Relation B = consume_and_regurgitate(input_B); + if (A.is_null() || B.is_null()) + throw std::invalid_argument("null relation"); + if (!A.is_set() || !B.is_set()) + throw std::invalid_argument("cross product must be on two set"); + + // assert(A.is_set()); + // assert(B.is_set()); + + // skip_set_checks++; + assert(A.query_guaranteed_leading_0s() == -1 && + A.query_possible_leading_0s() == -1); + assert(B.query_guaranteed_leading_0s() == -1 && + B.query_possible_leading_0s() == -1); + // skip_set_checks--; + + Mapping mA(A.n_set()); + Mapping mB(B.n_set()); + int i; + for(i = 1; i <= B.n_set(); i++) mB.set_map_set(i, Output_Var,i); + for(i = 1; i <= A.n_set(); i++) mA.set_map_set(i, Input_Var,i); + return MapAndCombineRel2(A, B, mA, mB, Comb_And); +} + + +// +// inverse F +// reverse the input and output tuples +// +Relation Inverse(NOT_CONST Relation &S) { + Relation r = consume_and_regurgitate(S); + if (r.is_null()) + return r; + + // assert(!r.is_null()); + // assert(!r.is_set()); + int i; + + Mapping m1(r.n_inp(), r.n_out()); + for(i=1; i<=r.n_inp(); i++) m1.set_map_in (i, Output_Var,i); + for(i=1; i<=r.n_out(); i++) m1.set_map_out(i, Input_Var,i); + + MapRel1(r, m1, Comb_Id, -1, -1, false); + + r.reverse_leading_dir_info(); + + return r; +} + +Relation After(NOT_CONST Relation &input_S, + int carried_by, int new_output,int dir) { + Relation S = consume_and_regurgitate(input_S); + assert(!S.is_null()); + assert(!S.is_set()); + int i; + Relation r(*S.split(),42); + + int a = r.max_ufs_arity_of_out(); + int preserved_positions = min(carried_by-1,new_output); + if (a >= preserved_positions) { + // UFS's must evacuate from the output tuple + Variable_ID_Tuple remapped; + + r.simplify(); + DNF *d = r.split()->DNFize(); + d->count_leading_0s(); + // Any conjucts with leading_0s == -1 must have >= "a" leading 0s + // What a gross way to do this. Ferd + + for (DNF_Iterator conj(d); conj; conj++) { + int cL0 = (*conj)->guaranteed_leading_0s; + + for (Variable_ID_Iterator func((*conj)->mappedVars); func; func++) + if ((*func)->kind() == Global_Var) { + Global_Var_ID f = (*func)->get_global_var(); + if (f->arity() > preserved_positions + && (*func)->function_of()==Output_Tuple) { + if (cL0 >= f->arity()) { + (*func)->remap = r.get_local(f, Input_Tuple); + } + else { + (*func)->remap = (*conj)->declare(); + (*conj)->make_inexact(); + } + remapped.append(*func); + } + } + (*conj)->remap(); + reset_remap_field(remapped); + remapped.clear(); + + (*conj)->guaranteed_leading_0s = + (*conj)->possible_leading_0s = -1; + (*conj)->leading_dir = 0; + } + } + + Mapping m1(r.n_inp(), r.n_out()); + for(i=1; i<=r.n_inp(); i++) m1.set_map_in (i, Input_Var,i); + if (carried_by > new_output) { + int preserve = min(new_output,r.n_out()); + for(i=1; i<=preserve; i++) m1.set_map_out(i, Output_Var,i); + for(i=preserve+1; i<=r.n_out(); i++) m1.set_map_out(i, Exists_Var,-1); + MapRel1(r, m1, Comb_Id, -1, -1, true); + if (new_output > preserve) + r = Extend_Range(r,new_output-r.n_out()); + return r; + } + + for(i=1; iOut_Names.append(Const_String()); + body->number_output++; + assert(body->n_out() <= input_vars.size()); + + + GEQ_Handle h = and_below_exists->add_GEQ(0); + assert(carried_by < 128); + h.update_coef(exists_ids[1],-dir); + h.update_coef(r.output_var(carried_by),dir); + h.update_const(-1); + h.finalize(); + r.finalize(); + if (new_output > r.n_out()) + r = Extend_Range(r,new_output-r.n_out()); + return r; +} + +// +// Identity. +// +Relation Identity(int n_inp) { + Relation rr(n_inp, n_inp); + F_And *f = rr.add_and(); + for(int i=1; i<=n_inp; i++) { + EQ_Handle e = f->add_EQ(); + e.update_coef(rr.input_var(i), -1); + e.update_coef(rr.output_var(i), 1); + e.finalize(); + } + rr.finalize(); + assert(!rr.is_null()); + return rr; +} + +Relation Identity(NOT_CONST Relation &input_r) { + Relation r = consume_and_regurgitate(input_r); + return Restrict_Domain(Identity(r.n_set()),r); +} + +// +// Deltas(F) +// Return a set such that the ith variable is old Out_i - In_i +// Delta variables are created as input variables. +// Then input and output variables are projected out. +// +Relation Deltas(NOT_CONST Relation &S) { + Relation R = consume_and_regurgitate(S); + assert(!R.is_null()); + // skip_set_checks++; + assert(R.n_inp()==R.n_out()); + int in = R.n_inp(); + // skip_set_checks--; + return Deltas(R,in); +} + +Relation Deltas(NOT_CONST Relation &S, int eq_no) { + Relation R = consume_and_regurgitate(S); + // skip_set_checks++; + assert(!R.is_null()); + assert(eq_no<=R.n_inp()); + assert(eq_no<=R.n_out()); + // R.split(); + + int no_inp = R.n_inp(); + int no_out = R.n_out(); + + if(relation_debug) { + fprintf(DebugFile,"Computing Deltas:\n"); + R.prefix_print(DebugFile); + } + int a = R.max_ufs_arity(); + if (a > 0) { + Variable_ID_Tuple remapped; + + // UFS's must evacuate from all tuples - we need to go to DNF + // to enumerate the variables, I think... + R.simplify(); + if(relation_debug) { + fprintf(DebugFile,"Relation simplified:\n"); + R.prefix_print(DebugFile); + } + DNF *d = R.split()->DNFize(); + + for (DNF_Iterator conj(d); conj; conj++) { + for (Variable_ID_Iterator func((*conj)->mappedVars); func; func++) + if ((*func)->kind() == Global_Var) { + Global_Var_ID f = (*func)->get_global_var(); + if (f->arity() > 0) { + (*func)->remap = (*conj)->declare(); + (*conj)->make_inexact(); + remapped.append(*func); + } + } + (*conj)->remap(); + reset_remap_field(remapped); + remapped.clear(); + } + } + + R = Extend_Domain(R, eq_no); // add eq_no Delta vars + Mapping M(no_inp+eq_no, no_out); + int i; + for(i=1; i<=eq_no; i++) { // Set up Deltas equalities + EQ_Handle E = R.and_with_EQ(); + /* delta_i - w_i + r_i = 0 */ + E.update_coef(R.input_var(i), 1); + E.update_coef(R.output_var(i), -1); + E.update_coef(R.input_var(no_inp+i), 1); + E.finalize(); + M.set_map(Input_Var, no_inp+i, Set_Var, i); // Result will be a set + } + for(i=1; i<=no_inp; i++) { // project out input variables + M.set_map(Input_Var, i, Exists_Var, i); + } + for(i=1; i<=no_out; i++) { // project out output variables + M.set_map(Output_Var, i, Exists_Var, no_inp+i); + } + MapRel1(R, M, Comb_Id, eq_no, 0); + + if(relation_debug) { + fprintf(DebugFile,"Computing deltas:\n"); + R.prefix_print(DebugFile); + }; + R.finalize(); + assert(R.is_set()); // Should be since we map things to Set_Var + assert(R.n_set() == eq_no); + // skip_set_checks--; + return R; +} + + + + +Relation DeltasToRelation(NOT_CONST Relation &D, int n_inputs, int n_outputs) { + Relation R = consume_and_regurgitate(D); + + // skip_set_checks++; + assert(!R.is_null()); + R.markAsRelation(); + int common = R.n_inp(); + assert(common <= n_inputs); + assert(common <= n_outputs); + R.split(); + + if (R.max_ufs_arity() > 0) { + assert(R.max_ufs_arity() == 0 && + "'Deltas' not ready for UFS yet"); // FERD + fprintf(stderr, "'Deltas' not ready for UFS yet"); + exit(1); + } + + R = Extend_Domain(R, n_inputs); + R = Extend_Range(R, n_outputs); + Mapping M(common+n_inputs, n_outputs); + int i; + for(i=1; i<=common; i++) { // Set up Deltas equalities + EQ_Handle E = R.and_with_EQ(); + /* delta_i - w_i + r_i = 0 */ + E.update_coef(R.input_var(i), 1); + E.update_coef(R.output_var(i), -1); + E.update_coef(R.input_var(common+i), 1); + E.finalize(); + M.set_map(Input_Var, i, Exists_Var, i); // Result will be a set + } + for(i=1; i<=n_inputs; i++) { // project out input variables + M.set_map(Input_Var, common+i, Input_Var, i); + } + for(i=1; i<=n_outputs; i++) { // project out output variables + M.set_map(Output_Var, i, Output_Var, i); + } + MapRel1(R, M, Comb_Id, n_inputs, n_outputs); + + if(relation_debug) { + fprintf(DebugFile,"Computed DeltasToRelation:\n"); + R.prefix_print(DebugFile); + } + R.finalize(); + assert(!R.is_set()); + // skip_set_checks--; + return R; +} + + + +Relation Join(NOT_CONST Relation &G, NOT_CONST Relation &F) { + return Composition(F, G); +} + +bool prepare_relations_for_composition(Relation &r1,Relation &r2) { + assert(!r2.is_null() && !r1.is_null()); + + if(r2.is_set()) { + int a1 = r1.max_ufs_arity_of_in(), a2 = r2.max_ufs_arity_of_set(); + + if (a1 == 0 && a2 == 0) + return true; + else { + assert(0 && "Can't compose relation and set with function symbols"); + fprintf(stderr, "Can't compose relation and set with function symbols"); + exit(1); + return false; // make compiler shut up + } + } + + assert(r2.n_out() == r1.n_inp()); + + int zeros = max(r1.query_guaranteed_leading_0s(), + r2.query_guaranteed_leading_0s()); + return (zeros >= r1.max_ufs_arity_of_in() + && zeros >= r2.max_ufs_arity_of_out()); +} + +// +// Composition(F, G) = F o G, where F o G (x) = F(G(x)) +// That is, if F = { [i] -> [j] : ... } +// and G = { [x] -> [y] : ... } +// then Composition(F, G) = { [x] -> [j] : ... } +// +// align the output tuple for G and the input tuple for F, +// these become existensially quantified variables +// use the output tuple from F and the input tuple from G for the result +// match named variables in G and F +// formula is g & f +// +// If there are function symbols of arity > 0, we call special case +// code to handle them. This is not set up for the r2.is_set case yet. +// + +Relation Composition(NOT_CONST Relation &input_r1, NOT_CONST Relation &input_r2) { + Relation r1 = consume_and_regurgitate(input_r1); + Relation r2 = consume_and_regurgitate(input_r2); + assert(!r2.is_null() && !r1.is_null()); + + if(r2.is_set()) { + int a1 = r1.max_ufs_arity_of_in(), a2 = r2.max_ufs_arity_of_set(); + if (r2.n_set() != r1.n_inp()) { + fprintf(stderr,"Illegal composition/application, arities don't match\n"); + fprintf(stderr,"Trying to compute r1(r2)\n"); + fprintf(stderr,"arity of r2 must match input arity of r1\n"); + fprintf(stderr,"r1: "); + r1.print_with_subs(stderr); + fprintf(stderr,"r2: "); + r2.print_with_subs(stderr); + fprintf(stderr,"\n"); + assert(r2.n_set() == r1.n_inp()); + exit(1); + } + // skip_set_checks++; + int i; + if (a1 == 0 && a2 == 0) { + int x = r1.n_out(); + Mapping m1(r1.n_inp(), r1.n_out()); + for(i=1; i<=r1.n_out(); i++) m1.set_map_out(i, Set_Var,i); + for(i=1; i<=r1.n_inp(); i++) m1.set_map_in (i, Exists_Var,i); + Mapping m2(r2.n_set()); + for(i=1; i<=r2.n_set(); i++) m2.set_map_set(i, Exists_Var,i); + Relation R3 = MapAndCombineRel2(r2, r1, m2, m1, Comb_And); + // skip_set_checks--; + if (x == 0) + R3.markAsSet(); + return R3; + } + else { + assert(0 && + "Can't compose relation and set with function symbols"); + fprintf(stderr, + "Can't compose relation and set with function symbols"); + exit(1); + return Identity(0); // make compiler shut up + } + } + + if (r2.n_out() != r1.n_inp()) { + fprintf(stderr,"Illegal composition, arities don't match\n"); + fprintf(stderr,"Trying to compute r1 compose r2\n"); + fprintf(stderr,"Output arity of r2 must match input arity of r1\n"); + fprintf(stderr,"r1: "); + r1.print_with_subs(stderr); + fprintf(stderr,"r2: "); + r2.print_with_subs(stderr); + fprintf(stderr,"\n"); + assert(r2.n_out() == r1.n_inp()); + exit(1); + } + + int a1 = r1.max_ufs_arity_of_in(), a2 = r2.max_ufs_arity_of_out(); + + if (a1 == 0 && a2 == 0 && 0 /* FERD - leading 0's go wrong here */ ) { + // If no real UFS's, we can just use the general code: + int i; + Mapping m1(r1.n_inp(), r1.n_out()); + for(i=1; i<=r1.n_inp(); i++) m1.set_map_in (i, Exists_Var,i); + for(i=1; i<=r1.n_out(); i++) m1.set_map_out(i, Output_Var,i); + Mapping m2(r2.n_inp(), r2.n_out()); + for(i=1; i<=r2.n_inp(); i++) m2.set_map_in (i, Input_Var,i); + for(i=1; i<=r2.n_out(); i++) m2.set_map_out(i, Exists_Var,i); + + return MapAndCombineRel2(r2, r1, m2, m1, Comb_And); + } + else { + Relation result(r2.n_inp(), r1.n_out()); + int mid_size = r2.n_out(); + int i; + for(i =1; i<=r2.n_inp(); i++) + result.name_input_var(i,r2.input_var(i)->base_name); + for(i =1; i<=r1.n_out(); i++) + result.name_output_var(i,r1.output_var(i)->base_name); + + r1.simplify(); + r2.simplify(); + + Rel_Body *b1 = r1.split(), *b2 = r2.split(); + + if (b1 == b2) { + assert(0 && "Compose: not ready to handle b1 == b2 yet."); + fprintf(stderr, "Compose: not ready to handle b1 == b2 yet.\n"); + exit(1); + } + + DNF *d1 = b1->DNFize(); + DNF *d2 = b2->DNFize(); + + d1->count_leading_0s(); + d2->count_leading_0s(); + // Any conjucts with leading_0s == -1 must have >= max_arity leading 0s + // What a gross way to do this. Ferd + + F_Exists *exists = result.add_exists(); + Section middle_tuple = exists->declare_tuple(mid_size); + Map lost_functions((Variable_ID)0); + + F_Or *result_conjs = exists->add_or(); + + for (DNF_Iterator conj1(d1); conj1; conj1++) + for (DNF_Iterator conj2(d2); conj2; conj2++) { + // combine conj1 and conj2: + // conj2's in becomes result's in; conj1's out becomes out + // conj2's out and conj1's in get merged and exist. quant. + // conj2's f(in) and conj1's f(out) become f(in) and f(out) + // conj2's f(out) and conj1's f(in) get merged, evacuate: + // if conj1 has f.arity leading 0s, they become f(out), + // if conj2 has f.arity leading 0s, they become f(in) + // if neither has enough 0s, they become a wildcard + // and the result is inexact + // old wildcards stay wildcards + +#if defined STUDY_EVACUATIONS + study_evacuation(*conj1, *conj2, max(a1, a2)); +#endif + + Conjunct *copy1, *copy2; + copy2 = (*conj2)->copy_conj_same_relation(); + copy1 = (*conj1)->copy_conj_same_relation(); + + Variable_ID_Tuple remapped; + + int c1L0 = copy1->guaranteed_leading_0s; + int c2L0 = copy2->guaranteed_leading_0s; + + int inexact = 0; + + // get rid of conj2's f(out) + { + for (Variable_ID_Iterator func(copy2->mappedVars); func; func++) + if ((*func)->kind() == Global_Var) { + Global_Var_ID f = (*func)->get_global_var(); + if (f->arity() > 0 && (*func)->function_of()==Output_Tuple) { + if (c2L0 >= f->arity()) { + (*func)->remap = r2.get_local(f, Input_Tuple); + remapped.append(*func); + } + else if (c1L0 >= f->arity()) { + // f->remap = copy1->get_local(f, Output_Tuple); + // this should work with the current impl. + // SHOULD BE A NO-OP? + assert((*func)==r1.get_local(f,Output_Tuple)); + } + else { + Variable_ID f_quantified = lost_functions[f]; + if (!f_quantified) { + f_quantified = exists->declare(); + lost_functions[f] = f_quantified; + } + inexact = 1; + (*func)->remap = f_quantified; + remapped.append(*func); + } + } + } + } + + // remap copy2's out + for (i=1; i<=mid_size; i++) { + r2.output_var(i)->remap = middle_tuple[i]; + } + + // do remapping for conj2, then reset everything so + // we can go on with conj1 + + copy2->remap(); + reset_remap_field(remapped); + reset_remap_field(output_vars,mid_size); + + + remapped.clear(); + + // get rid of conj1's f(in) + { + for (Variable_ID_Iterator func(copy1->mappedVars); func; func++) + if ((*func)->kind() == Global_Var) { + Global_Var_ID f = (*func)->get_global_var(); + if (f->arity() > 0 && (*func)->function_of()==Input_Tuple) { + if (c1L0 >= f->arity()) { + (*func)->remap = r1.get_local(f,Output_Tuple); + remapped.append(*func); + } + else if (c2L0 >= f->arity()) { + // f->remap = copy2->get_local(f, Input_Tuple); + // this should work with the current impl. + // SHOULD BE A NO-OP? + assert((*func)==r2.get_local(f,Input_Tuple)); + } + else { + Variable_ID f_quantified = lost_functions[f]; + if (!f_quantified) { + f_quantified = exists->declare(); + lost_functions[f] = f_quantified; + } + inexact = 1; + (*func)->remap = f_quantified; + remapped.append(*func); + } + } + } + } + + // merge copy1's in with the already remapped copy2's out + for (i=1; i<=mid_size; i++) { + r1.input_var(i)->remap = middle_tuple[i]; + } + + copy1->remap(); + reset_remap_field(remapped); + reset_remap_field(input_vars,mid_size); + + Conjunct *conj3 = merge_conjs(copy1, copy2, MERGE_COMPOSE, exists->relation()); + result_conjs->add_child(conj3); + delete copy1; + delete copy2; + + // make sure all variables used in the conjunct + // are listed in the "result" relation + + for (Variable_ID_Iterator func(conj3->mappedVars); func; func++) + if ((*func)->kind() == Global_Var) { + Global_Var_ID f = (*func)->get_global_var(); + if (f->arity() > 0) + result.get_local(f, (*func)->function_of()); + else + result.get_local(f); + } + + if (inexact) + conj3->make_inexact(); + } + + // result.simplify(2, 4); // can't really do that now, will cause failure in chill + result.finalize(); + r1 = r2 = Relation(); + return result; + } +} + + + +bool Is_Obvious_Subset(NOT_CONST Relation &input_r1, NOT_CONST Relation &input_r2) { + Relation r1 = consume_and_regurgitate(input_r1); + Relation r2 = consume_and_regurgitate(input_r2); + + assert(!r1.is_null() && !r2.is_null()); + Rel_Body *rr1 = r1.split(); + Rel_Body *rr2 = r2.split(); + rr1->simplify(); + rr2->simplify(); + use_ugly_names++; + + remap_DNF_vars(rr2, rr1); + + for(DNF_Iterator pd1(rr1->query_DNF()); pd1.live(); pd1.next()) { + Conjunct *conj1 = pd1.curr(); + int found = false; + for(DNF_Iterator pd2(rr2->query_DNF()); pd2.live(); pd2.next()) { + Conjunct *conj2 = pd2.curr(); + if (!conj2->is_exact()) continue; + + Conjunct *cgist = merge_conjs(conj1, conj2, MERGE_GIST, conj2->relation()); +#ifndef NDEBUG + cgist->setup_names(); +#endif + if (cgist->redSimplifyProblem(2, 0) == noRed) { + delete cgist; + found = true; + break; + } + delete cgist; + } + if (! found) { + use_ugly_names--; + r1 = r2 = Relation(); + return false; + } + } + use_ugly_names--; + r1 = r2 = Relation(); + return true; +} /* Is_Obvious_Subset */ + + +bool do_subset_check(NOT_CONST Relation &input_r1, + NOT_CONST Relation &input_r2); + +// do_subset_check really implements Must_Be_Subset anyway (due to +// correct handling of inexactness in the negation code), but +// still take upper and lower bounds here +bool Must_Be_Subset(NOT_CONST Relation &r1, NOT_CONST Relation &r2) { + Relation s1 = Upper_Bound(consume_and_regurgitate(r1)); + Relation s2 = Lower_Bound(consume_and_regurgitate(r2)); + return do_subset_check(s1,s2); +} + +bool Might_Be_Subset(NOT_CONST Relation &r1, NOT_CONST Relation &r2) { + Relation s1 = Lower_Bound(consume_and_regurgitate(r1)); + Relation s2 = Upper_Bound(consume_and_regurgitate(r2)); + return do_subset_check(s1,s2); +} + +bool May_Be_Subset(NOT_CONST Relation &r1, NOT_CONST Relation &r2){ + return Might_Be_Subset(r1,r2); +} + + + + +// +// F Must_Be_Subset G +// Test that (f => g) === (~f | g) is a Tautology +// or that (f & ~g) is unsatisfiable: +// align the input tuples (if any) for F and G +// align the output tuples (if any) for F and G +// Special case: if r2 has a single conjunct then use HasRedQeuations. +// + +bool do_subset_check(NOT_CONST Relation &input_r1, + NOT_CONST Relation &input_r2) { + Relation r1 = consume_and_regurgitate(input_r1); + Relation r2 = consume_and_regurgitate(input_r2); + if (r1.is_null() || r2.is_null()) + throw std::invalid_argument("null relation"); + if (r1.n_inp() != r2.n_inp() || r1.n_out() != r2.n_out()) + throw std::invalid_argument("relation arity does not match"); + + // assert(!r1.is_null() && !r2.is_null()); + // skip_set_checks++; + // assert(r1.n_inp() == r2.n_inp()); + // assert(r1.n_out() == r2.n_out()); + // skip_set_checks--; + r1.simplify(1,0); + r2.simplify(2,2); + Rel_Body *rr1 = r1.split(); + + if(relation_debug) { + fprintf(DebugFile, "\n$$$ Must_Be_Subset IN $$$\n"); + } + + bool c = true; + + // Check each conjunct separately + for(DNF_Iterator pd(rr1->query_DNF()); c && pd.live(); ) { + Relation tmp(r1,pd.curr()); + pd.next(); +#ifndef CHECK_MAYBE_SUBSET + if (pd.live()) + c = !Difference(tmp,copy(r2)).is_upper_bound_satisfiable(); + else + c = !Difference(tmp,r2).is_upper_bound_satisfiable(); +#else + Relation d=Difference(copy(tmp), copy(r2)); + c=!d.is_upper_bound_satisfiable(); + if (!c && !d.is_exact()) { // negation-induced inexactness + static int OMEGA_WHINGE = -1; + if (OMEGA_WHINGE < 0) { + OMEGA_WHINGE = getenv("OMEGA_WHINGE") ? atoi(getenv("OMEGA_WHINGE")) : 0; + } + if (OMEGA_WHINGE) { + fprintf(DebugFile,"\n===== r1 is maybe a Must_Be_Subset of r2 ========\n"); + fprintf(DebugFile,"-------> r1:\n"); + tmp.print_with_subs(DebugFile); + fprintf(DebugFile,"-------> r2:\n"); + r2.print_with_subs(DebugFile); + fprintf(DebugFile,"-------> r1-r2:\n"); + d.print_with_subs(DebugFile); + } + } +#endif + } + + if(relation_debug) { + fprintf(DebugFile, "$$$ Must_Be_Subset OUT $$$\n"); + } + r1 = r2 = Relation(); + return c; +} + + +// +// F minus G +// +Relation Difference(NOT_CONST Relation &input_r1, + NOT_CONST Relation &input_r2) { + Relation r1 = consume_and_regurgitate(input_r1); + Relation r2 = consume_and_regurgitate(input_r2); + if (r1.is_null() || r2.is_null()) + return r1; + if (r1.n_inp() != r2.n_inp() || r1.n_out() != r2.n_out()) + throw std::invalid_argument("relation arity does not match"); + + //assert(!r1.is_null() && !r2.is_null()); + // skip_set_checks++; + // assert(r1.n_inp() == r2.n_inp()); + // assert(r1.n_out() == r2.n_out()); + + int i; + Mapping m1(r1.n_inp(), r1.n_out()); + for(i=1; i<=r1.n_inp(); i++) m1.set_map_in (i, Input_Var,i); + for(i=1; i<=r1.n_out(); i++) m1.set_map_out(i, Output_Var,i); + Mapping m2(r2.n_inp(), r2.n_out()); + for(i=1; i<=r2.n_inp(); i++) m2.set_map_in (i, Input_Var,i); + for(i=1; i<=r2.n_out(); i++) m2.set_map_out(i, Output_Var,i); + // skip_set_checks--; + + return MapAndCombineRel2(r1, r2, m1, m2, Comb_AndNot); +} + +// +// complement F +// not F +// +Relation Complement(NOT_CONST Relation &S) { + Relation r = consume_and_regurgitate(S); + if (r.is_null()) + return r; + + // assert(!r.is_null()); + // skip_set_checks++; + int i; + Mapping m(r.n_inp(), r.n_out()); + for(i=1; i<=r.n_inp(); i++) m.set_map_in (i, Input_Var,i); + for(i=1; i<=r.n_out(); i++) m.set_map_out(i, Output_Var,i); + // skip_set_checks--; + + MapRel1(r, m, Comb_AndNot, -1, -1, false); + return r; +} + + +// +// Compute (gist r1 given r2). +// Currently we assume that r2 has only one conjunct. +// r2 may have zero input and output OR may have # in/out vars equal to r1. +// +Relation GistSingleConjunct(NOT_CONST Relation &input_R1, + NOT_CONST Relation &input_R2, int effort) { + Relation R1 = consume_and_regurgitate(input_R1); + Relation R2 = consume_and_regurgitate(input_R2); + + // skip_set_checks++; + assert(!R1.is_null() && !R2.is_null()); + assert((R1.n_inp() == R2.n_inp() && R1.n_out() == R2.n_out()) || + (R2.n_inp() == 0 && R2.n_out() == 0)); + R1.simplify(); + R2.simplify(); + Rel_Body *r1 = R1.split(); + Rel_Body *r2 = R2.split(); + + if(relation_debug) { + fprintf(DebugFile, "\n### GIST computation start ### [\n"); + R1.prefix_print(DebugFile); + R2.prefix_print(DebugFile); + fprintf(DebugFile, "### ###\n"); + } + + +// The merged conjunct has to have the variables of either r1 or r2, but +// not both. Use r1's, since it'll be cheaper to remap r2's single conj. + remap_DNF_vars(r2, r1); + assert(r2->is_upper_bound_satisfiable() && "Gist: second operand is FALSE"); + // skip_set_checks--; + + Conjunct *known = r2->single_conjunct(); + assert(known != NULL && "Gist: second operand has more than 1 conjunct"); + + DNF *new_dnf = new DNF(); + for(DNF_Iterator pd(r1->simplified_DNF); pd.live(); pd.next()) { + Conjunct *conj = pd.curr(); + Conjunct *cgist = merge_conjs(known, conj, MERGE_GIST, conj->relation()); // Uses r1's vars + cgist->set_relation(r1); // Thinks it's part of r1 now, for var. purposes + if(simplify_conj(cgist, true, effort+1, EQ_RED)) { + /* Throw out black constraints, turn red constraints into black */ + cgist->rm_color_constrs(); + if(cgist->is_true()) { + delete new_dnf; + delete cgist; + // skip_set_checks++; + Relation retval = Relation::True(r1->n_inp(), r2->n_out()); + // retval.finalize(); + retval.simplify(); + if(R1.is_set() && R2.is_set()) retval.markAsSet(); + // skip_set_checks--; + return retval; + } + else { + // since modular equations might be changed, simplify again! + simplify_conj(cgist, true, effort+1, EQ_BLACK); + + new_dnf->add_conjunct(cgist); + } + } + } + delete r1->simplified_DNF; + r1->simplified_DNF = new_dnf; + assert(!r1->is_null()); + R1.finalize(); + if(relation_debug) { + fprintf(DebugFile, "] ### GIST computation end ###\n"); + R1.prefix_print(DebugFile); + fprintf(DebugFile, "### ###\n"); + } + return(R1); +} + + +// +// Compute gist r1 given r2. r2 can have multiple conjuncts, +// return result is always simplified. +// +Relation Gist(NOT_CONST Relation &input_R1, + NOT_CONST Relation &input_R2, int effort) { + Relation R1 = consume_and_regurgitate(input_R1); + Relation R2 = consume_and_regurgitate(input_R2); + if (R1.is_null()) + return R1; + // change the Gist semantics to allow r2 be null -- by chun 07/30/2007 + if (R2.is_null()) { + R1.simplify(); + return R1; + } + if (!(R1.n_inp() == 0 && R2.n_out() == 0) && + (R1.n_inp() != R2.n_inp() || R1.n_out() != R2.n_out())) + throw std::invalid_argument("relation arity does not match"); + + // skip_set_checks++; + // assert(!R1.is_null()); + // assert(R2.is_null() || + // (R1.n_inp() == R2.n_inp() && R1.n_out() == R2.n_out()) || + // (R2.n_inp() == 0 && R2.n_out() == 0)); + // skip_set_checks--; + R2.simplify(); + + if(relation_debug) { + fprintf(DebugFile, "\n### multi-GIST computation start ### [\n"); + R1.prefix_print(DebugFile); + R2.prefix_print(DebugFile); + fprintf(DebugFile, "### ###\n"); + } + + if (!R2.is_upper_bound_satisfiable()) + return Relation::True(R1); + if (R2.is_obvious_tautology()) { + R1.simplify(); + return R1; + } + R1.simplify(); + + if (!Intersection(copy(R1), copy(R2)).is_upper_bound_satisfiable()) + return Relation::False(R1); + + int nconj1=0; + for (DNF_Iterator di(R1.simplified_DNF()); di.live(); di.next()) + nconj1++; + int nconj2=0; + for (DNF_Iterator di2(R2.simplified_DNF()); di2.live(); di2.next()) + nconj2++; + + { + static int OMEGA_WHINGE = -1; + if (OMEGA_WHINGE < 0) { + OMEGA_WHINGE = getenv("OMEGA_WHINGE") ? atoi(getenv("OMEGA_WHINGE")) : 0; + } + if (OMEGA_WHINGE && (nconj1 + nconj2 > 50)) { + fprintf(DebugFile,"WOW!!!! - Gist (%d conjuncts, %d conjuncts)!!!\n", + nconj1,nconj2); + fprintf(DebugFile,"Base:\n"); + R1.prefix_print(DebugFile); + fprintf(DebugFile,"Context:\n"); + R2.prefix_print(DebugFile); + } + } + + if (nconj2==1) + return GistSingleConjunct(R1,R2, effort); + else { + R1.simplify(0,1); + R2.simplify(0,1); + Relation G = Relation::True(R1); + for (DNF_Iterator di2(R2.simplified_DNF()); di2.live(); di2.next()) { + Conjunct * c2 = di2.curr(); + Relation G2 = Relation::False(R1); + for (DNF_Iterator di1(R1.simplified_DNF()); di1.live(); di1.next()) { + Conjunct * c1 = di1.curr(); + Relation G1=GistSingleConjunct(Relation(R1,c1), Relation(R2,c2),effort); + + if (G1.is_obvious_tautology()) { + G2 = G1; + break; + } + else if (!G1.is_upper_bound_satisfiable() || !G1.is_exact()) { + if(relation_debug) { + fprintf(DebugFile, "gist A given B is unsatisfiable\n"); + fprintf(DebugFile, "A:\n"); + Relation(R1,c1).prefix_print(DebugFile); + fprintf(DebugFile, "B:\n"); + Relation(R2,c2).prefix_print(DebugFile); + fprintf(DebugFile, "\n"); + } + //G1 = Relation(R1,c1); + return R1; + } + else if(0 && G1.is_exact() && !Must_Be_Subset(Relation(R1,c1),copy(G1))) { + fprintf(DebugFile,"Unexpected non-Must_Be_Subset gist result!\n"); + fprintf(DebugFile,"base: \n"); + Relation(R1,c1).prefix_print(DebugFile); + fprintf(DebugFile,"context: \n"); + Relation(R2,c2).prefix_print(DebugFile); + fprintf(DebugFile,"result: \n"); + G1.prefix_print(DebugFile); + fprintf(DebugFile,"base not subseteq result: \n"); + assert(!G1.is_exact() || Must_Be_Subset(Relation(R1,c1),copy(G1))); + } + G2=Union(G2,G1); + } + G2.simplify(0,1); + G = Intersection(G,G2); + G.simplify(0,1); + if(relation_debug) { + fprintf(DebugFile, "result so far is:\n"); + G.prefix_print(DebugFile); + } + } + + if(relation_debug) { + fprintf(DebugFile, "\n### end multi-GIST computation ### ]\n"); + fprintf(DebugFile, "G is:\n"); + G.prefix_print(DebugFile); + fprintf(DebugFile, "### ###\n"); + } +#if ! defined NDEBUG + Relation S1 = Intersection(copy(R1), copy(R2)); + Relation S2 = Intersection(copy(G), copy(R2)); + + + if(relation_debug) { + fprintf(DebugFile, "\n---->[Checking validity of the GIST result\n"); + fprintf(DebugFile, "for G=gist R1 given R2:\n"); + fprintf(DebugFile, "R1 intersect R2 is:\n"); + S1.print_with_subs(DebugFile); + fprintf(DebugFile, "\nG intersect R2 is:\n"); + S2.print_with_subs(DebugFile); + fprintf(DebugFile, "---->]\n"); + } + assert (!S1.is_exact() || !S2.is_exact() || (Must_Be_Subset(copy(S1),copy(S2)) && Must_Be_Subset(copy(S2),copy(S1)))); +#endif + return G; + } +} + + +// Project away all input and output variables. +Relation Project_On_Sym(NOT_CONST Relation &S, + NOT_CONST Relation &input_context) { + Relation R = consume_and_regurgitate(S); + Relation context = consume_and_regurgitate(input_context); + int i; + + // skip_set_checks++; + leave_pufs_untouched++; + int in_arity = R.max_ufs_arity_of_in(); + int out_arity = R.max_ufs_arity_of_out(); + assert(!R.is_null()); + R.split(); + + int no_inp = R.n_inp(); + int no_out = R.n_out(); + Mapping M(no_inp, no_out); + + for(i=1; i<=no_inp; i++) { // project out input variables + M.set_map(Input_Var, i, Exists_Var, i); + } + for(i=1; i<=no_out; i++) { // project out output variables + M.set_map(Output_Var, i, Exists_Var, no_inp+i); + } + MapRel1(R, M, Comb_Id, 0, 0); + + R.finalize(); + if (in_arity) R = Extend_Domain(R,in_arity); + if (out_arity) R = Extend_Range(R,out_arity); + + int d = min(in_arity,out_arity); + if (d && !context.is_null()) { + int g = min(d,context.query_guaranteed_leading_0s()); + int p = min(d,context.query_possible_leading_0s()); + int dir = context.query_leading_dir(); + R.enforce_leading_info(g,p,dir); + } + + leave_pufs_untouched--; + // skip_set_checks--; + if(relation_debug) { + fprintf(DebugFile,"\nProjecting onto symbolic (%d,%d):\n",in_arity,out_arity); + R.prefix_print(DebugFile); + } + return R; +} + + +// +// Project out global variable g from relation r +// +Relation Project(NOT_CONST Relation &S, Global_Var_ID g) { + Relation R = consume_and_regurgitate(S); + assert(!R.is_null()); + + skip_finalization_check++; + + Rel_Body *r = R.split(); + r->DNF_to_formula(); + Formula *f = r->rm_formula(); + F_Exists *ex = r->add_exists(); + ex->add_child(f); + + if (g->arity() == 0) { + assert(R.has_local(g) && "Project: Relation doesn't contain variable to be projected"); + Variable_ID v = R.get_local(g); + + bool rmd = rm_variable(r->Symbolic,v); + assert(rmd && "Project: Variable to be projected doesn't exist"); + + v->remap = ex->declare(v->base_name); + f->remap(); + v->remap = v; + } + else { + assert((R.has_local(g, Input_Tuple) || R.has_local(g, Output_Tuple)) && "Project: Relation doesn't contain variable to be projected"); + + if (R.has_local(g, Input_Tuple)) { + Variable_ID v = R.get_local(g, Input_Tuple); + + bool rmd = rm_variable(r->Symbolic,v); + assert(rmd && "Project: Variable to be projected doesn't exist"); + + v->remap = ex->declare(v->base_name); + f->remap(); + v->remap = v; + } + if (R.has_local(g, Output_Tuple)) { + Variable_ID v = R.get_local(g, Output_Tuple); + + bool rmd = rm_variable(r->Symbolic,v); + assert(rmd && "Project: Variable to be projected doesn't exist"); + + v->remap = ex->declare(v->base_name); + f->remap(); + v->remap = v; + } + } + + skip_finalization_check--; + + R.finalize(); + return R; +} + + +// +// Project all symbolic variables from relation r +// +Relation Project_Sym(NOT_CONST Relation &S) { + Relation R = consume_and_regurgitate(S); + assert(!R.is_null()); + + Rel_Body *r = R.split(); + r->DNF_to_formula(); + + Formula *f = r->rm_formula(); + + skip_finalization_check++; + F_Exists *ex = r->add_exists(); + for(Variable_ID_Iterator R_Sym(r->Symbolic); R_Sym; R_Sym++) { + Variable_ID v = *R_Sym; + v->remap = ex->declare(v->base_name); + } + ex->add_child(f); + skip_finalization_check--; + + f->remap(); + + reset_remap_field(r->Symbolic); + r->Symbolic.clear(); + + R.finalize(); + return R; +} + +// +// Project specified variables, leaving those variables with no constraints. +// +Relation Project(NOT_CONST Relation &S, Sequence &s) { + // This is difficult to do with mappings. This cheats, since it is + // much easier and more straightforward. + + Relation R = consume_and_regurgitate(S); + assert(!R.is_null()); + + Rel_Body *r = R.split(); + r->DNF_to_formula(); + Formula *f = r->rm_formula(); + bool need_symbolic_clear = false; + + skip_finalization_check++; + F_Exists *ex = r->add_exists(); + for(int i = 1; i <= s.size(); i++) { + if (s[i]->kind() == Global_Var) + need_symbolic_clear = true; + s[i]->remap = ex->declare(s[i]->base_name); + } + ex->add_child(f); + skip_finalization_check--; + + f->remap(); + + reset_remap_field(s); + if (need_symbolic_clear) + r->Symbolic.clear(); + + R.finalize(); + return R; +} + +Relation Project(NOT_CONST Relation &S, int pos, Var_Kind vkind) { + Variable_ID v = 0; // shut the compiler up + switch (vkind) { + case Input_Var: + v = input_vars[pos]; + break; + case Output_Var: + v = output_vars[pos]; + break; + // case Set_Var: + // v = set_vars[pos]; + // break; + default: + assert(0); + } + + return Project(S, v); +} + +Relation Project(NOT_CONST Relation &S, Variable_ID v) { + Tuple s; + s.append(v); + return Project(S, s); +} + +// +// Variables in DNF of map_rel reference declarations of map_rel (or not). +// remap_DNF_vars makes them to reference declarations of ref_rel. +// Ref_rel can get new global variable declarations in the process. +// +void remap_DNF_vars(Rel_Body *map_rel, Rel_Body *ref_rel) { + // skip_set_checks++; + assert (map_rel->simplified_DNF); + assert (ref_rel->simplified_DNF); + + // skip_set_checks++; + + for(DNF_Iterator pd(map_rel->simplified_DNF); pd.live(); pd.next()) { + Conjunct *cc = pd.curr(); + Variable_ID_Tuple &mvars = cc->mappedVars; + for(Variable_Iterator mvarsIter=mvars; mvarsIter; mvarsIter++) { + Variable_ID v = *mvarsIter; + switch(v->kind()) { + case Input_Var: + assert(ref_rel->n_inp() >= v->get_position()); + break; + case Output_Var: + assert(ref_rel->n_out() >= v->get_position()); + break; + case Global_Var: + // The assignment is a noop, but tells ref_rel that the global may be + // used inside it, which is required. + *mvarsIter = ref_rel->get_local(v->get_global_var(),v->function_of()); + break; + case Wildcard_Var: + break; + default: + assert(0 && "bad variable kind"); + } + } + } + // skip_set_checks--; +} + + +Relation projectOntoJust(Relation R, Variable_ID v) { + // skip_set_checks++; + + int ivars = R.n_inp(), ovars = R.n_out(); + int ex_ivars= 0, ex_ovars = 0; + + assert(v->kind() == Input_Var || v->kind() == Output_Var); + if (v->kind() == Input_Var) { + ex_ivars = 1; + R = Extend_Domain(R,1); + } + else { + ex_ovars = 1; + R = Extend_Range(R,1); + } + + // Project everything except v + Mapping m(ivars+ex_ivars,ovars+ex_ovars); + int j; + for(j = 1; j <=ivars+ex_ivars; j++) m.set_map_in(j, Exists_Var, j); + for(j = 1; j <=ovars+ex_ovars; j++) m.set_map_out(j, Exists_Var, j+ivars+ex_ivars); + m.set_map(v->kind(), v->get_position(), v->kind(), v->get_position()); + + MapRel1(R, m, Comb_Id,-1,-1); + R.finalize(); + // skip_set_checks--; + return R; +} + +//static +//void copyEQtoGEQ(GEQ_Handle &g, const EQ_Handle &e, bool negate) { +//extern void copy_constraint(Constraint_Handle H, Constraint_Handle initial); +// copy_constraint(g, e); +//} + + +Relation EQs_to_GEQs(NOT_CONST Relation &S, bool excludeStrides) { + Relation R = consume_and_regurgitate(S); + assert(R.is_simplified()); + use_ugly_names++; + for (DNF_Iterator s(R.query_DNF()); s.live(); s.next()) + s.curr()->convertEQstoGEQs(excludeStrides); + use_ugly_names--; + return R; +} + + +// Tuple to find values for is input+output +Relation Symbolic_Solution(NOT_CONST Relation &R) { + Relation S = consume_and_regurgitate(R); + Tuple vee; + // skip_set_checks++; + int i; + for(i = 1; i <= S.n_inp(); i++) vee.append(input_var(i)); + for(i = 1; i <= S.n_out(); i++) vee.append(output_var(i)); + // skip_set_checks--; + + return Solution(S, vee); +} + + +// Tuple to find values for is given as arg, plus input and output +Relation Symbolic_Solution(NOT_CONST Relation &R, Sequence &for_these){ + Relation S = consume_and_regurgitate(R); + Tuple vee; + // skip_set_checks++; + int i; + for(Any_Iterator it(for_these); it; it++) + vee.append(*it); + for(i = 1; i <= S.n_inp(); i++) vee.append(input_var(i)); + for(i = 1; i <= S.n_out(); i++) vee.append(output_var(i)); + // skip_set_checks--; + + return Solution(S, vee); +} + + +// Tuple to find values for is input+output+global_decls +Relation Sample_Solution(NOT_CONST Relation &R) { + Relation S = consume_and_regurgitate(R); + + Tuple vee; + + // skip_set_checks++; + int i; + for(i = 1; i <= S.global_decls()->size(); i++) + vee.append((*S.global_decls())[i]); + for(i = 1; i <= S.n_inp(); i++) vee.append(input_var(i)); + for(i = 1; i <= S.n_out(); i++) vee.append(output_var(i)); + // skip_set_checks--; + + return Solution(S,vee); +} + + +// Tuple to find values is given as arg +Relation Solution(NOT_CONST Relation &S, Sequence &for_these ) { + Relation R = consume_and_regurgitate(S); + if (R.is_null()) + return R; + + //assert(!R.is_null()); + + if(!R.is_upper_bound_satisfiable()) { + return Relation::False(R); + } + + bool inexactAnswer=false; + if(R.is_inexact()) { + if(R.is_lower_bound_satisfiable()) + R = Lower_Bound(R); // a solution to LB is a solution to the relation + else { + // A solution to the UB may not be a solution to the relation: + // There may be a solution which satisfies all known constraints, but + // we have no way of knowing if it satisifies the unknown constraints. + inexactAnswer = true; + R = Upper_Bound(R); + } + } + + Sequence &vee = for_these; + for (DNF_Iterator di(R.query_DNF()); di; di++) { + Relation current(R, *di); + int i; + for(i = vee.size()-1; i >= 0; i--) { + bool some_constraints = false, one_stride = false; + + int current_var = vee.size()-i; + Section s(&vee,current_var+1,i); + + // Query variable in vee[current_var] + Relation projected = Project(copy(current), s); + + retry_solution: + assert(projected.has_single_conjunct()); + DNF_Iterator one = projected.query_DNF(); + + // Look for candidate EQ's + EQ_Handle stride; + EQ_Iterator ei(*one); + for(; ei; ei++) { + if((*ei).get_coef(vee[current_var]) != 0) { + if(!Constr_Vars_Iter(*ei,true).live()) { // no wildcards + some_constraints = true; + // Add this constraint to the current as an EQ + current.and_with_EQ(*ei); + break; + } + else { + one_stride = !one_stride && !some_constraints; + stride = *ei; + } + } + } + if(ei) + continue; // Found an EQ, skip to next variable + else if (one_stride && !some_constraints) { + // if unconstrained except for a stride, pick stride as value + Constr_Vars_Iter cvi(stride,true); + assert(cvi.live()); + cvi++; + if(!cvi) { // Just one existentially quantified variable + Relation current_copy = current; + EQ_Handle eh = current_copy.and_with_EQ(); + for(Constr_Vars_Iter si = stride; si; si++) + if((*si).var->kind() != Wildcard_Var){ + // pick "0" for wildcard, don't set its coef + eh.update_coef((*si).var, (*si).coef); + } + eh.update_const(stride.get_const()); + if(current_copy.is_upper_bound_satisfiable()){ + current = current_copy; + continue; // skip to next var + } + } + some_constraints = true; // count the stride as a constraint + } + + // Can we convert a GEQ? + GEQ_Iterator gi(*one); + for(; gi; gi++) { + if((*gi).get_coef(vee[current_var]) != 0) { + some_constraints = true; + if(!Constr_Vars_Iter(*gi,true).live()) { // no wildcards + Relation current_copy = current; + // Add this constraint to the current as an EQ & test + current_copy.and_with_EQ(*gi); + if (current_copy.is_upper_bound_satisfiable()) { + current = current_copy; + break; + } + } + } + } + if (gi) continue; // Turned a GEQ into EQ, skip to next + + // Remove wildcards, try try again + Relation approx = Approximate(copy(projected)); + assert(approx.has_single_conjunct()); + DNF_Iterator d2 = approx.query_DNF(); + + EQ_Iterator ei2(*d2); + for(; ei2; ei2++) { + if((*ei2).get_coef(vee[current_var]) != 0) { + some_constraints = true; + assert(!Constr_Vars_Iter(*ei2,true).live()); // no wildcards + Relation current_copy = current; + // Add this constraint to the current as an EQ & test + current_copy.and_with_EQ(*ei2); + if (current_copy.is_upper_bound_satisfiable()) { + current = current_copy; + break; + } + } + } + if(ei2) continue; // Found an EQ, skip to next variable + + GEQ_Iterator gi2(*d2); + for(; gi2; gi2++) { + if((*gi2).get_coef(vee[current_var]) != 0) { + some_constraints = true; + assert(!Constr_Vars_Iter(*gi2,true).live()); // no wildcards + Relation current_copy = current; + // Add this constraint to the current as an EQ & test + current_copy.and_with_EQ(*gi2); + if (current_copy.is_upper_bound_satisfiable()) { + current = current_copy; + break; + } + } + } + if(gi2) continue; + + if(!some_constraints) { // No constraints on this variable were found + EQ_Handle e = current.and_with_EQ(); + e.update_const(-42); // Be creative + e.update_coef(vee[current_var], 1); + continue; + } + else { // What to do? Find a wildcard to discard + Variable_ID wild = NULL; + + for (GEQ_Iterator gi(*one); gi; gi++) + if ((*gi).get_coef(vee[current_var]) != 0 && (*gi).has_wildcards()) { + Constr_Vars_Iter cvi(*gi, true); + wild = (*cvi).var; + break; + } + if (wild == NULL) + for (EQ_Iterator ei(*one); ei; ei++) + if ((*ei).get_coef(vee[current_var]) != 0 && (*ei).has_wildcards()) { + Constr_Vars_Iter cvi(*ei, true); + wild = (*cvi).var; + break; + } + + if (wild != NULL) { + // skip_set_checks++; + + Relation R2; + { + Tuple r(1); + r[1] = projected; + Tuple > > mapping(1); + mapping[1][wild] = std::make_pair(vee[current_var]->kind(), vee[current_var]->get_position()); + mapping[1][vee[current_var]] = std::make_pair(Exists_Var, 1); + Tuple inverse(1); + inverse[1] = false; + R2 = merge_rels(r, mapping, inverse, Comb_And); + } + + Variable_ID R2_v; + switch (vee[current_var]->kind()) { + // case Set_Var: + case Input_Var: { + int pos = vee[current_var]->get_position(); + R2_v = R2.input_var(pos); + break; + } + case Output_Var: { + int pos = vee[current_var]->get_position(); + R2_v = R2.output_var(pos); + break; + } + case Global_Var: { + Global_Var_ID g = vee[current_var]->get_global_var(); + if (g->arity() == 0) + R2_v = R2.get_local(g); + else + R2_v = R2.get_local(g, vee[current_var]->function_of()); + } + default: + assert(0); + } + + Relation S2; + { + Tuple vee; + vee.append(R2_v); + S2 = Solution(R2, vee); + } + + Variable_ID S2_v; + switch (vee[current_var]->kind()) { + // case Set_Var: + case Input_Var: { + int pos = vee[current_var]->get_position(); + S2_v = S2.input_var(pos); + break; + } + case Output_Var: { + int pos = vee[current_var]->get_position(); + S2_v = S2.output_var(pos); + break; + } + case Global_Var: { + Global_Var_ID g = vee[current_var]->get_global_var(); + if (g->arity() == 0) + S2_v = S2.get_local(g); + else + S2_v = S2.get_local(g, vee[current_var]->function_of()); + } + default: + assert(0); + } + + Relation R3; + { + Tuple r(2); + r[1] = projected; + r[2] = S2; + Tuple > > mapping(2); + mapping[1][wild] = std::make_pair(Exists_Var, 1); + mapping[2][S2_v] = std::make_pair(Exists_Var, 1); + Tuple inverse(2); + inverse[1] = inverse[2] = false; + R3 = merge_rels(r, mapping, inverse, Comb_And); + } + + // skip_set_checks--; + + if (R3.is_upper_bound_satisfiable()) { + projected = R3; + goto retry_solution; + } + } + } + + // If we get here, we failed to find a suitable constraint for + // this variable at this conjunct, look for another conjunct. + break; + } + + if (i < 0) { // solution found + if(inexactAnswer) + current.and_with_and()->add_unknown(); + current.finalize(); + return current; + } + } + + // No solution found for any conjunct, we bail out. + fprintf(stderr,"Couldn't find suitable constraint for variable\n"); + return Relation::Unknown(R); +} + + +Relation Approximate(NOT_CONST Relation &input_R, bool strides_allowed) { + Relation R = consume_and_regurgitate(input_R); + if (R.is_null()) + return R; + + // assert(!R.is_null()); + Rel_Body *r = R.split(); + + // approximate can be used to remove lambda variables from farkas, + // so be careful not to invoke simplification process for integers. + r->simplify(-1,-1); + + if (pres_debug) { + fprintf(DebugFile,"Computing approximation "); + if (strides_allowed) fprintf(DebugFile,"with strides allowed "); + fprintf(DebugFile,"[ \n"); + r->prefix_print(DebugFile); + } + + use_ugly_names++; + for (DNF_Iterator pd(r->simplified_DNF); pd.live(); ) { + Conjunct *C = pd.curr(); + pd.next(); + + for(int i = 0; i < C->problem->nGEQs; i++) + C->problem->GEQs[i].touched = 1; + + C->reorder(); + if(C->problem->simplifyApproximate(strides_allowed)==0) { + r->simplified_DNF->rm_conjunct(C); + delete C; + } + else { + C->simplifyProblem(1,0,1); + + free_var_decls(C->myLocals); C->myLocals.clear(); + + Problem *p = C->problem; + Variable_ID_Tuple new_mapped(0); // This is expanded by "append" + for (int i = 1; i <= p->safeVars; i++) { + // what is now in column i used to be in column p->var[i] + Variable_ID v = C->mappedVars[p->var[i]]; + assert (v->kind() != Wildcard_Var); + new_mapped.append(v); + } + assert(strides_allowed || C->problem->nVars == C->problem->safeVars); + C->mappedVars = new_mapped; + for (int i = p->safeVars+1; i <= p->nVars; i++) { + Variable_ID v = C->declare(); + C->mappedVars.append(v); + } + + + // reset var and forwarding address if desired. + p->variablesInitialized = 0; + for(int i = 1; i < C->problem->nVars; i++) + C->problem->var[i] = C->problem->forwardingAddress[i] = i; + } + } + + if (pres_debug) + fprintf(DebugFile,"] done Computing approximation\n"); + use_ugly_names--; + return R; +} + + +Relation Lower_Bound(NOT_CONST Relation &r) { + Relation s = consume_and_regurgitate(r); + s.interpret_unknown_as_false(); + return s; +} + + +Relation Upper_Bound(NOT_CONST Relation &r) { + Relation s = consume_and_regurgitate(r); + s.interpret_unknown_as_true(); + return s; +} + + +bool operator==(const Relation &, const Relation &) { + assert(0 && "You rilly, rilly don't want to do this.\n"); + abort(); + return false; +} + + +namespace { // supporting stuff for MapRel1 and MapAndCombine2 + // Determine if a mapping requires an f_exists node + bool has_existentials(const Mapping &m) { + for(int i=1;i<=m.n_in(); i++) + if (m.get_map_in_kind(i) == Exists_Var) return true; + for(int j=1;j<=m.n_out(); j++) + if (m.get_map_out_kind(j) == Exists_Var) return true; + return false; + } + + void get_relation_arity_from_one_mapping(const Mapping &m1, + int &in_req, int &out_req) { + int j, i; + in_req = 0; out_req = 0; + for(i = 1; i <= m1.n_in(); i++) { + j = m1.get_map_in_pos(i); + switch(m1.get_map_in_kind(i)) { + case Input_Var: in_req = max(in_req, j); break; + // case Set_Var: in_req = max(in_req, j); break; + case Output_Var: out_req = max(out_req, j); break; + default: break; + } + } + for(i = 1; i <= m1.n_out(); i++) { + j = m1.get_map_out_pos(i); + switch(m1.get_map_out_kind(i)) { + case Input_Var: in_req = max(in_req, j); break; + // case Set_Var: in_req = max(in_req, j); break; + case Output_Var: out_req = max(out_req, j); break; + default: break; + } + } + } + + // Scan mappings to see how many input and output variables they require. + void get_relation_arity_from_mappings(const Mapping &m1, + const Mapping &m2, + int &in_req, int &out_req) { + int inreq1, inreq2, outreq1, outreq2; + get_relation_arity_from_one_mapping(m1, inreq1, outreq1); + get_relation_arity_from_one_mapping(m2, inreq2, outreq2); + in_req = max(inreq1, inreq2); + out_req = max(outreq1, outreq2); + } +} + + +// +// Build lists of variables that need to be replaced in the given +// Formula. Declare globals in new relation. Then call +// map_vars to do the replacements. +// +// Obnoxiously many arguments here: +// Relation arguments contain declarations of symbolic and in/out vars. +// F_Exists argument is where needed existentially quant. vars can be decl. +// +// Mapping specifies how in/out vars are mapped +// Two lists are required to be able to map in/out variables from the first +// and second relations to the same existentially quantified variable. +// +void align(Rel_Body *originalr, Rel_Body *newr, F_Exists *fe, + Formula *f, const Mapping &mapping, bool &newrIsSet, + List &seen_exists, Variable_ID_Tuple &seen_exists_ids) { + int i, cur_ex = 0; // initialize cur_ex to shut up the compiler + + f->set_relation(newr); // Might not need to do this anymore, if bugs were fixed + int input_remapped = 0; + int output_remapped = 0; + int sym_remapped = 0; + // skip_set_checks++; + + Variable_ID new_var; + Const_String new_name; + int new_pos; + + // MAP old input variables by setting their remap fields + for(i = 1; i <= originalr->n_inp(); i++) { + Variable_ID this_var = originalr->input_var(i), New_E; + Const_String this_name = originalr->In_Names[i]; + + switch (mapping.get_map_in_kind(i)) { + case Input_Var: + // case Set_Var: + // if (mapping.get_map_in_kind(i) == Set_Var) + // newrIsSet = true; // Don't mark it just yet; we still need to + // // refer to its "input" vars internally + + // assert((newrIsSet && mapping.get_map_in_kind(i) == Set_Var) + // || ((!newrIsSet &&mapping.get_map_in_kind(i) == Input_Var))); + + new_pos = mapping.get_map_in_pos(i); + new_var = newr->input_var(new_pos); + if (this_var != new_var) { + input_remapped = 1; + this_var->remap = new_var; + } + new_name = newr->In_Names[new_pos]; + if (!this_name.null()) { // should we name this? + if (!new_name.null()) { // already named, anonymize + if (new_name != this_name) + newr->name_input_var(new_pos, Const_String()); + } + else + newr->name_input_var(new_pos, this_name); + } + break; + case Output_Var: + assert(!newr->is_set()); + input_remapped = 1; + new_pos = mapping.get_map_in_pos(i); + this_var->remap = new_var = newr->output_var(new_pos); + new_name = newr->Out_Names[new_pos]; + if (!this_name.null()) { + if (!new_name.null()) { // already named, anonymize + if (new_name != this_name) + newr->name_output_var(new_pos, Const_String()); + } + else + newr->name_output_var(new_pos, this_name); + } + break; + case Exists_Var: + input_remapped = 1; + // check if we have declared it, use that if so. + // create it if not. + if (mapping.get_map_in_pos(i) <= 0 || + (cur_ex = seen_exists.index(mapping.get_map_in_pos(i))) == 0){ + if (!this_name.null()) + New_E = fe->declare(this_name); + else + New_E = fe->declare(); + this_var->remap = New_E; + if (mapping.get_map_in_pos(i) > 0) { + seen_exists.append(mapping.get_map_in_pos(i)); + seen_exists_ids.append(New_E); + } + } + else { + this_var->remap = new_var = seen_exists_ids[cur_ex]; + if (!this_name.null()) { // Have we already assigned a name? + if (!new_var->base_name.null()) { + if (new_var->base_name != this_name) + new_var->base_name = Const_String(); + } + else { + new_var->base_name = this_name; + assert(!this_name.null()); + } + } + } + break; + default: + assert(0 && "Unsupported var type in MapRel2"); + break; + } + } + + // MAP old output variables. + for(i = 1; i <= originalr->n_out(); i++) { + Variable_ID this_var = originalr->output_var(i), New_E; + Const_String this_name = originalr->Out_Names[i]; + + switch (mapping.get_map_out_kind(i)) { + case Input_Var: + // case Set_Var: + // if (mapping.get_map_out_kind(i) == Set_Var) + // newrIsSet = true; // Don't mark it just yet; we still need to refer to its "input" vars internally + + // assert((newrIsSet && mapping.get_map_out_kind(i) == Set_Var) + // ||((!newrIsSet &&mapping.get_map_out_kind(i) == Input_Var))); + + output_remapped = 1; + new_pos = mapping.get_map_out_pos(i); + this_var->remap = new_var = newr->input_var(new_pos); + new_name = newr->In_Names[new_pos]; + if (!this_name.null()) { + if (!new_name.null()) { // already named, anonymize + if (new_name != this_name) + newr->name_input_var(new_pos, Const_String()); + } + else + newr->name_input_var(new_pos, this_name); + } + break; + case Output_Var: + assert(!newr->is_set()); + new_pos = mapping.get_map_out_pos(i); + new_var = newr->output_var(new_pos); + if (new_var != this_var) { + output_remapped = 1; + this_var->remap = new_var; + } + new_name = newr->Out_Names[new_pos]; + if (!this_name.null()) { + if (!new_name.null()) { // already named, anonymize + if (new_name != this_name) + newr->name_output_var(new_pos, Const_String()); + } + else + newr->name_output_var(new_pos, this_name); + } + break; + case Exists_Var: + // check if we have declared it, create it if not. + output_remapped = 1; + if (mapping.get_map_out_pos(i) <= 0 || + (cur_ex = seen_exists.index(mapping.get_map_out_pos(i))) == 0) { // Declare it. + New_E = fe->declare(this_name); + this_var->remap = New_E; + if (mapping.get_map_out_pos(i) > 0) { + seen_exists.append(mapping.get_map_out_pos(i)); + seen_exists_ids.append(New_E); + } + } + else { + this_var->remap = new_var = seen_exists_ids[cur_ex]; + if (!this_name.null()) { + if (!new_var->base_name.null()) { + if (new_var->base_name != this_name) + new_var->base_name = Const_String(); + } + else { + new_var->base_name = this_name; + } + } + } + break; + default: + assert(0 &&"Unsupported var type in MapRel2"); + break; + } + } + + Variable_ID_Tuple *oldSym = originalr->global_decls(); + for(i=1; i<=(*oldSym).size(); i++) { + Variable_ID v = (*oldSym)[i]; + assert(v->kind()==Global_Var); + if (v->get_global_var()->arity() > 0) { + Argument_Tuple new_of = v->function_of(); + if (!leave_pufs_untouched) + new_of = mapping.get_tuple_fate(new_of, v->get_global_var()->arity()); + if (new_of == Unknown_Tuple) { + // hopefully v is not really used + // if we get here, f should have been in DNF, + // now an OR node with conjuncts below + // we just need to check that no conjunct uses v +#if ! defined NDEBUG + if (f->node_type() == Op_Conjunct) { + assert(f->really_conjunct()->mappedVars.index(v)==0 + && "v unused"); + } +#if 0 + else { + // assert(f->node_type() == Op_Or); + for (List_Iterator conj(f->children()); conj; conj++) { + assert((*conj)->really_conjunct()->mappedVars.index(v)==0 + && "v unused"); + } + } +#endif +#endif + // since its not really used, don't bother adding it to + // the the global_vars list of the new relation + continue; + } + if (v->function_of() != new_of) { + Variable_ID new_v=newr->get_local(v->get_global_var(),new_of); + assert(v != new_v); + v->remap = new_v; + sym_remapped = 1; + } + else { + // add symbolic to symbolic list +#if ! defined NDEBUG + Variable_ID new_v = +#endif + newr->get_local(v->get_global_var(), v->function_of()); +#if ! defined NDEBUG + assert(v == new_v); +#endif + } + } + else { + // add symbolic to symbolic list +#if ! defined NDEBUG + Variable_ID new_v = +#endif + newr->get_local(v->get_global_var()); +#if ! defined NDEBUG + assert(v == new_v); +#endif + } + } + + if (sym_remapped || input_remapped || output_remapped) { + f->remap(); + + // If 2 vars mapped to same variable, combine them + //There's a column to combine only when there are two equal remap fields. + Tuple vt(0); + bool combine = false; + Tuple_Iterator t(input_vars); + for(i=1; !combine && i<=originalr->n_inp(); t++, i++) + if (vt.index((*t)->remap)) + combine = true; + else + vt.append((*t)->remap); + Tuple_Iterator t2(output_vars); + for(i=1; !combine && i <= originalr->n_out(); t2++, i++) + if (vt.index((*t2)->remap)) + combine = true; + else + vt.append((*t2)->remap); + if (combine) f->combine_columns(); + + if (sym_remapped) + reset_remap_field(originalr->Symbolic); + if (input_remapped) + reset_remap_field(input_vars,originalr->n_inp()); + if (output_remapped) + reset_remap_field(output_vars,originalr->n_out()); + } + + // skip_set_checks--; + +#ifndef NDEBUG + if (fe) + foreach(v,Variable_ID,fe->myLocals,assert(v == v->remap)); +#endif +} + + +// MapRel1, MapAndCombineRel2 can be replaced by merge_rels +void MapRel1(Relation &R, const Mapping &map, Combine_Type ctype, + int number_input, int number_output, + bool invalidate_resulting_leading_info, + bool finalize) { +#if defined(INCLUDE_COMPRESSION) + assert(!R.is_compressed()); +#endif + assert(!R.is_null()); + + Relation inputRel = R; + R = Relation(); + Rel_Body *inputRelBody = inputRel.split(); + + int in_req=0, out_req=0; + get_relation_arity_from_one_mapping(map, in_req, out_req); + + R = Relation(number_input == -1 ? in_req : number_input, + number_output == -1 ? out_req : number_output); + + Rel_Body *outputRelBody = R.split(); + + inputRelBody->DNF_to_formula(); + Formula *f1 = inputRelBody->rm_formula(); + + F_Exists *fe; + Formula *f; + if (has_existentials(map)) { + f = fe = outputRelBody->add_exists(); + } + else { + fe = NULL; + f = outputRelBody; + } + and_below_exists = NULL; + if (finalize) and_below_exists = NULL; + else f = and_below_exists = f->add_and(); + if(ctype == Comb_AndNot) { + f = f->add_not(); + } + f->add_child(f1); + + exists_ids.clear(); + exists_numbers.clear(); + + bool returnAsSet=false; + align(inputRelBody, outputRelBody, fe, f1, map, returnAsSet, + exists_numbers, exists_ids); + + if (returnAsSet || + (inputRelBody->is_set() && outputRelBody->n_out() == 0)) { + R.markAsSet(); + R.invalidate_leading_info(); // nonsensical for a set + } + + if (finalize) R.finalize(); + inputRel = Relation(); + if (invalidate_resulting_leading_info) + R.invalidate_leading_info(); +} + + +Relation MapAndCombineRel2(Relation &R1, Relation &R2, const Mapping &mapping1, + const Mapping &mapping2, Combine_Type ctype, + int number_input, int number_output) { +#if defined(INCLUDE_COMPRESSION) + assert(!R1.is_compressed()); + assert(!R2.is_compressed()); +#endif + assert(!R1.is_null() && !R2.is_null()); + Rel_Body *r1 = R1.split(); + Rel_Body *r2 = R2.split(); + + int in_req, out_req; // Create the new relation + get_relation_arity_from_mappings(mapping1, mapping2, in_req, out_req); + Relation R3(number_input == -1 ? in_req : number_input, + number_output == -1 ? out_req : number_output); + Rel_Body *r3 = R3.split(); // This is just to get the pointer, it's cheap + + /* permit the add_{exists,and} below, reset after they are done.*/ + skip_finalization_check++; + + F_Exists *fe = NULL; + Formula *f; + if (has_existentials(mapping1) || has_existentials(mapping2)) { + fe = r3->add_exists(); + f = fe; + } + else { + f = r3; + } + + r1->DNF_to_formula(); + Formula *f1 = r1->rm_formula(); + r2->DNF_to_formula(); + Formula *f2 = r2->rm_formula(); + + // align: change r1 vars to r3 vars in formula f1 via map mapping1, + // declaring needed exists vars in F_Exists *fe + // Also maps symbolic variables appropriately, sets relation ptrs in f1. + // In order to map variables of both relations to the same variables, + // we keep a list of new existentially quantified vars between calls. + // returnAsSet means mark r3 as set before return. Don't mark it yet, + // because internally we need to refer to "input_vars" of a set, and that + // would blow assertions. + + bool returnAsSet=false; + exists_ids.clear(); + exists_numbers.clear(); + align(r1, r3, fe, f1, mapping1, returnAsSet, exists_numbers, exists_ids); + // align: change r2 vars to r3 vars in formula f2 via map mapping2 + align(r2, r3, fe, f2, mapping2, returnAsSet, exists_numbers, exists_ids); + + switch (ctype) { + case Comb_Or: + if(f1->node_type() == Op_Or) { + f->add_child(f1); + f = f1; + } + else { + f = f->add_or(); + f->add_child(f1); + } + break; + case Comb_And: + case Comb_AndNot: + if(f1->node_type() == Op_And) { + f->add_child(f1); + f = f1; + } + else { + f = f->add_and(); + f->add_child(f1); + } + break; + default: + assert(0 && "Invalid combine type in MapAndCombineRel2"); + } + + Formula *c2; + if (ctype==Comb_AndNot) { + c2 = f->add_not(); + } + else { + c2 = f; + } + c2->add_child(f2); + + skip_finalization_check--; /* Set this back for return */ + R3.finalize(); + + if (returnAsSet || + (R1.is_set() && R2.is_set() && R3.n_inp() >= 0 && R3.n_out() == 0)){ + R3.markAsSet(); + R3.invalidate_leading_info(); + } + R1 = Relation(); + R2 = Relation(); + return R3; +} + + +// +// Scramble each relation's variables and merge these relations +// together. Support variable mapping to and from existentials. +// Unspecified variables in mapping are mapped to themselves by +// default. It intends to replace MapRel1 and MapAndCombineRel2 +// functions (the time saved by grafting formula tree might be +// neglegible when compared to the simplification cost). +// +Relation merge_rels(Tuple &R, const Tuple > > &mapping, const Tuple &inverse, Combine_Type ctype, int number_input, int number_output) { + const int m = R.size(); + assert(mapping.size() == m && inverse.size() == m); + // skip_set_checks++; + + // if new relation's arity is not given, calculate it on demand + if (number_input == -1) { + number_input = 0; + for (int i = 1; i <= m; i++) { + for (int j = R[i].n_inp(); j >= 1; j--) { + Variable_ID v = R[i].input_var(j); + std::map >::const_iterator p = mapping[i].find(v); + if (p == mapping[i].end()) { + number_input = j; + break; + } + } + + for (std::map >::const_iterator j = mapping[i].begin(); j != mapping[i].end(); j++) { + if ((*j).second.first == Input_Var || (*j).second.first == Set_Var) + number_input = max(number_input, (*j).second.second); + } + } + } + + if (number_output == -1) { + number_output = 0; + for (int i = 1; i <= m; i++) { + for (int j = R[i].n_out(); j >= 1; j--) { + Variable_ID v = R[i].output_var(j); + std::map >::const_iterator p = mapping[i].find(v); + if (p == mapping[i].end()) { + number_output = j; + break; + } + } + for (std::map >::const_iterator j = mapping[i].begin(); j != mapping[i].end(); j++) { + if ((*j).second.first == Output_Var) + number_output = max(number_output, (*j).second.second); + } + } + } + + Relation R2(number_input, number_output); + F_Exists *fe = R2.add_exists(); + Formula *f_root; + switch (ctype) { + case Comb_And: + f_root = fe->add_and(); + break; + case Comb_Or: + f_root = fe->add_or(); + break; + default: + assert(0); // unsupported merge type + } + + std::map seen_exists_by_num; + std::map seen_exists_by_id; + + for (int i = 1; i <= m; i++) { + F_Or *fo; + if (inverse[i]) + fo = f_root->add_not()->add_or(); + else + fo = f_root->add_or(); + + for (DNF_Iterator di(R[i].query_DNF()); di; di++) { + F_And *f = fo->add_and(); + + for (GEQ_Iterator gi(*di); gi; gi++) { + GEQ_Handle h = f->add_GEQ(); + for (Constr_Vars_Iter cvi(*gi); cvi; cvi++) { + Variable_ID v = cvi.curr_var(); + std::map >::const_iterator p = mapping[i].find(v); + if (p == mapping[i].end()) { + switch (v->kind()) { + // case Set_Var: + case Input_Var: { + int pos = v->get_position(); + h.update_coef(R2.input_var(pos), cvi.curr_coef()); + break; + } + case Output_Var: { + int pos = v->get_position(); + h.update_coef(R2.output_var(pos), cvi.curr_coef()); + break; + } + case Exists_Var: + case Wildcard_Var: { + std::map::iterator p2 = seen_exists_by_id.find(cvi.curr_var()); + Variable_ID e; + if (p2 == seen_exists_by_id.end()) { + e = fe->declare(); + seen_exists_by_id[cvi.curr_var()] = e; + } + else + e = (*p2).second; + h.update_coef(e, cvi.curr_coef()); + break; + } + case Global_Var: { + Global_Var_ID g = v->get_global_var(); + Variable_ID v2; + if (g->arity() == 0) + v2 = R2.get_local(g); + else + v2 = R2.get_local(g, v->function_of()); + h.update_coef(v2, cvi.curr_coef()); + break; + } + default: + assert(0); // shouldn't happen if input relations are simplified + } + } + else { + switch ((*p).second.first) { + // case Set_Var: + case Input_Var: { + int pos = (*p).second.second; + h.update_coef(R2.input_var(pos), cvi.curr_coef()); + break; + } + case Output_Var: { + int pos = (*p).second.second; + h.update_coef(R2.output_var(pos), cvi.curr_coef()); + break; + } + case Exists_Var: + case Wildcard_Var: { + int pos = (*p).second.second; + std::map::iterator p2 = seen_exists_by_num.find(pos); + Variable_ID e; + if (p2 == seen_exists_by_num.end()) { + e = fe->declare(); + seen_exists_by_num[pos] = e; + } + else + e = (*p2).second; + h.update_coef(e, cvi.curr_coef()); + break; + } + default: + assert(0); // mapped to unsupported variable type + } + } + } + h.update_const((*gi).get_const()); + } + + for (EQ_Iterator ei(*di); ei; ei++) { + EQ_Handle h = f->add_EQ(); + for (Constr_Vars_Iter cvi(*ei); cvi; cvi++) { + Variable_ID v = cvi.curr_var(); + std::map >::const_iterator p = mapping[i].find(v); + if (p == mapping[i].end()) { + switch (v->kind()) { + // case Set_Var: + case Input_Var: { + int pos = v->get_position(); + h.update_coef(R2.input_var(pos), cvi.curr_coef()); + break; + } + case Output_Var: { + int pos = v->get_position(); + h.update_coef(R2.output_var(pos), cvi.curr_coef()); + break; + } + case Exists_Var: + case Wildcard_Var: { + std::map::iterator p2 = seen_exists_by_id.find(v); + Variable_ID e; + if (p2 == seen_exists_by_id.end()) { + e = fe->declare(); + seen_exists_by_id[v] = e; + } + else + e = (*p2).second; + h.update_coef(e, cvi.curr_coef()); + break; + } + case Global_Var: { + Global_Var_ID g = v->get_global_var(); + Variable_ID v2; + if (g->arity() == 0) + v2 = R2.get_local(g); + else + v2 = R2.get_local(g, v->function_of()); + h.update_coef(v2, cvi.curr_coef()); + break; + } + default: + assert(0); // shouldn't happen if input relations are simplified + } + } + else { + switch ((*p).second.first) { + // case Set_Var: + case Input_Var: { + int pos = (*p).second.second; + h.update_coef(R2.input_var(pos), cvi.curr_coef()); + break; + } + case Output_Var: { + int pos = (*p).second.second; + h.update_coef(R2.output_var(pos), cvi.curr_coef()); + break; + } + case Exists_Var: + case Wildcard_Var: { + int pos = (*p).second.second; + std::map::iterator p2 = seen_exists_by_num.find(pos); + Variable_ID e; + if (p2 == seen_exists_by_num.end()) { + e = fe->declare(); + seen_exists_by_num[pos] = e; + } + else + e = (*p2).second; + h.update_coef(e, cvi.curr_coef()); + break; + } + default: + assert(0); // mapped to unsupported variable type + } + } + } + h.update_const((*ei).get_const()); + } + } + } + + // skip_set_checks--; + + if (number_output == 0) { + R2.markAsSet(); + // R2.invalidate_leading_info(); + } + + return R2; +} + +} // namespace diff --git a/omegalib/omega_lib/src/closure.cc b/omegalib/omega_lib/src/closure.cc new file mode 100644 index 0000000..416a3e7 --- /dev/null +++ b/omegalib/omega_lib/src/closure.cc @@ -0,0 +1,2100 @@ +/***************************************************************************** + Copyright (C) 1994-2000 the Omega Project Team + Copyright (C) 2005-2011 Chun Chen + Copyright (C) 2009-2011 West Pomeranian University of Technology, Szczecin + All Rights Reserved. + + Purpose: + All calculations of closure are now here. + + Notes: + Related paper: + - "Transitive closure of infinite graphs and its applications", + Wayne Kelly, William Pugh, Evan Rosser and Tatiana Shpeisman, IJPP 1996. + - "Computing the Transitive Closure of a Union of Affine Integer Tuple + Relations", Anna Beletska, Denis Barthou, Wlodzimierz Bielecki and + Albert Cohen, COCOA 2009. + - "An Iterative Algorithm of Computing the Transitive Closure of a Union + of Parameterized Affine Integer Tuple Relations", Bielecki Wlodzimierz, + Klimek Tomasz, Palkowski Marek and Anna Beletska, COCOA 2010. + + History: + 12/27/09 move ConicClosure here, Chun Chen + 01/19/11 new closure algorithms, Klimek Tomzsz + 02/02/11 move VennDiagramFrom here, Chun Chen +*****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include + +namespace omega { + +void InvestigateClosure(Relation r, Relation r_closure, Relation bounds); +void print_given_bounds(const Relation & R1, NOT_CONST Relation& input_Bounds); +#define printConjunctClosure (closure_presburger_debug & 0x1) +#define detailedClosureDebug (closure_presburger_debug & 0x2) + + +#ifdef TC_STATS +extern int clock_diff(); +extern void start_clock(); +FILE *statsfile; +int singles, totals=0; +#endif + +int closure_presburger_debug = 0; + + +Relation VennDiagramForm(NOT_CONST Relation &Context_In, + Tuple &Rs, + int next, + bool anyPositives, + int weight) { + Relation Context = consume_and_regurgitate(Context_In); + if (hull_debug) { + fprintf(DebugFile,"[VennDiagramForm, next = %d, anyPositives = %d, weight = %d \n", next,anyPositives,weight); + fprintf(DebugFile,"context:\n"); + Context.prefix_print(DebugFile); + } + if (anyPositives && weight > 3) { + Context.simplify(); + if (!Context.is_upper_bound_satisfiable()) { + if (hull_debug) + fprintf(DebugFile,"] not satisfiable\n"); + return Context; + } + weight = 0; + } + if (next > Rs.size()) { + if (!anyPositives) { + if (hull_debug) + fprintf(DebugFile,"] no positives\n"); + return Relation::False(Context); + } + Context.simplify(); + if (hull_debug) { + fprintf(DebugFile,"] answer is:\n"); + Context.prefix_print(DebugFile); + } + return Context; + } + Relation Pos = VennDiagramForm(Intersection(copy(Context),copy(Rs[next])), + Rs, + next+1, + true, + weight+2); + Relation Neg = VennDiagramForm(Difference(Context,copy(Rs[next])), + Rs, + next+1, + anyPositives, + weight+1); + if (hull_debug) { + fprintf(DebugFile,"] VennDiagramForm\n"); + fprintf(DebugFile,"pos part:\n"); + Pos.prefix_print(DebugFile); + fprintf(DebugFile,"neg part:\n"); + Neg.prefix_print(DebugFile); + } + return Union(Pos,Neg); +} + + +Relation VennDiagramForm(Tuple &Rs, NOT_CONST Relation &Context_In) { + Relation Context = consume_and_regurgitate(Context_In); + if (Context.is_null()) Context = Relation::True(Rs[1]); + if (hull_debug) { + fprintf(DebugFile,"Starting computation of VennDiagramForm\n"); + fprintf(DebugFile,"Context:\n"); + Context.prefix_print(DebugFile); + for(int i = 1; i <= Rs.size(); i++) { + fprintf(DebugFile,"#%d:\n",i); + Rs[i].prefix_print(DebugFile); + } + } + return VennDiagramForm(Context,Rs,1,false,0); +} + +Relation VennDiagramForm(NOT_CONST Relation &R_In, NOT_CONST Relation &Context_In) { + Relation R = consume_and_regurgitate(R_In); + Relation Context = consume_and_regurgitate(Context_In); + Tuple Rs; + for (DNF_Iterator c(R.query_DNF()); c.live(); ) { + Rs.append(Relation(R,c.curr())); + c.next(); + } + return VennDiagramForm(Rs,Context); +} + + +Relation ConicClosure (NOT_CONST Relation &R) { + int n = R.n_inp(); + if (n != R.n_out()) + throw std::invalid_argument("conic closure must have the same input arity and output arity"); + + return DeltasToRelation(ConicHull(Deltas(R)), n, n); +} + + +bool is_lex_forward(Relation R) { + if(R.n_inp() != R.n_out()) { + fprintf(stderr, "relation has wrong inputs/outpts\n"); + exit(1); + } + Relation forw(R.n_inp(), R.n_out()); + F_Or * o = forw.add_or(); + for(int a = 1; a <= forw.n_inp(); a++) { + F_And * andd = o->add_and(); + GEQ_Handle g = andd->add_GEQ(); + g.update_coef(input_var(a), -1); + g.update_coef(output_var(a), 1); + g.update_const(1); + for(int b = 1; b < a; b++) { + EQ_Handle e = andd->add_EQ(); + e.update_coef(input_var(a),1); + e.update_coef(output_var(a),-1); + } + } + Relation test = Difference(R, forw); + return !test.is_upper_bound_satisfiable(); +} + + +static Relation compose_n(NOT_CONST Relation &input_r, int n) { + Relation r = consume_and_regurgitate(input_r); + if (n == 1) + return r; + else + return Composition(r, compose_n(copy(r), n-1)); +} /* compose_n */ + + + + +Relation approx_closure(NOT_CONST Relation &input_r, int n) { + Relation r = consume_and_regurgitate(input_r); + Relation r_closure; + + r_closure=r; + int i; + for(i=2; i<=n; i++) + r_closure=Union(r_closure,compose_n(copy(r), n)); + r_closure = Union(r_closure, Relation::Unknown(r_closure)); + + return r_closure; +} /* approx_closure */ + + +static bool is_closure_itself(NOT_CONST Relation &r) { + return Must_Be_Subset(Composition(copy(r),copy(r)),copy(r)); +} + + +/***** + * get a D form of the Relation (single conjunct). + * D = {[ i_1,i_2,...,i_m] -> [j_1, j_2, ..., j_m ] : + * (forall p, 1<= p <= m) L_p <= j_p - i_p <= U_p && + * j_p - i_p == M_p alpha_p}; + * Right now only wildcards that are in stride constraints are treated. + *****/ + +Relation get_D_form (Relation & R) { + Relation D(R.n_inp(), R.n_out()); + + R.make_level_carried_to(R.n_inp()); + assert(R.has_single_conjunct()); + int n_zero=0; + for (DNF_Iterator d(R.query_DNF()); d.live(); d.next()) + n_zero=d.curr()->query_guaranteed_leading_0s(); + + Relation Diff=Deltas(copy(R)); + + if (detailedClosureDebug) { + fprintf(DebugFile, "The relation projected onto differencies is:\n"); + Diff.print_with_subs(DebugFile); + } + + + /* now form D */ + + int i; + coef_t l,u; + F_And * N = D.add_and(); + GEQ_Handle g; + for (i=1; i<=Diff.n_set(); i++) { + Diff.query_variable_bounds(Diff.set_var(i), l,u); +/* if (i== n_zero+1 && l==negInfinity) + l=1; */ + if (l!=negInfinity) { + g=N->add_GEQ(); + g.update_coef(D.input_var(i),-1); + g.update_coef(D.output_var(i),1); + g.update_const(-l); + g.finalize(); + } + if (u!=posInfinity) { + g=N->add_GEQ(); + g.update_coef(D.input_var(i),1); + g.update_coef(D.output_var(i),-1); + g.update_const(u); + g.finalize(); + } + } + + /* add all stride constrains if they do exist */ + + Conjunct *c = Diff.single_conjunct(); + + if (c->locals().size()>0) {// there are local variables + // now go through all the equalities + + coef_t coef=0; + int pos=0; + for (EQ_Iterator eq = c->EQs(); eq.live(); eq.next()) { + // constraint is in stride form if it has 2 vars, + // one of which is wildcard. Count number if vars and wildcard vars + int nwild=0,nvar=0; + + for (Constr_Vars_Iter cvi(*eq, false); cvi; cvi++) { + if ((*cvi).var->kind() == Global_Var) + continue; + else if ((*cvi).var->kind() == Wildcard_Var) { + coef=(*cvi).coef; + nwild++; + } + else + pos=(*cvi).var->get_position(); + nvar++; + } + if (nvar==2 && nwild==1) { //stride constraint + EQ_Handle e=N->add_stride(coef); + e.update_coef(D.input_var(pos),-1); + e.update_coef(D.output_var(pos),1); + e.finalize(); + } + } + } // end search of stride constrains + + D.finalize(); + D.simplify(); + return D; +} /* end get_D_form */ + +/**** + * get relation A x A describing a region of domain and range: + * A=Hull(Domain(R), Range(R)) intersection IterationSpace + * returns cross product A x A + ***/ + +Relation form_region(const Relation &R, const Relation& IterationSpace) { + Relation H=Union(Domain(copy(R)), Range(copy(R))); + H.simplify(1,1); + H = EQs_to_GEQs(H); + H=Hull(H); + Relation A=Intersection(H, copy(IterationSpace)); + Relation A1=A; + return Cross_Product(A,A1); +} + +Relation form_region1(const Relation &R, const Relation& IterationSpace) { + Relation Dom=Intersection(Domain(copy(R)), copy(IterationSpace)); + Relation Ran=Intersection(Range(copy(R)), copy(IterationSpace)); + return Cross_Product(Dom,Ran); +} + + +/**** + * Check if we can use D instead of R + * i.e. D intersection (A cross A) is Must_Be_Subset of R + ***/ + +bool isD_OK(Relation &R, Relation &D, Relation &AxA) { + Relation B=Intersection(copy(D), copy(AxA)); + B.simplify(); + + if (detailedClosureDebug) { + fprintf(DebugFile, "Intersection of D and AxA is:\n"); + B.print_with_subs(DebugFile); + } + assert (Must_Be_Subset(copy(R),copy(B))); + + return Must_Be_Subset(B, copy(R)); +} + + + +/**** + * check if the constraint is a stride one. Here we say that an equality + * constraint is a stride constraint if it has exatly one wildcard. + * The function returns number of the wildcards in the constraint. + * So if we know that constraint is from the relation in D form, then + * it cannot have more than 1 wildcard variables, and the result of + * this functions can be treated as bool. + ***/ + +static int is_stride(const EQ_Handle &eq) { + int n=0; + + for (Constr_Vars_Iter cvi(eq,true); cvi; cvi++) + n++; + + return n; +} + + + +/***** + * check if the constraint is in the form i_k' - i_k comp_op c + * return v - the number of the var and the type of the comp_op: + * 1 - >, -1 - <, 0 - not in the right form + * if this is equality constraint in the right form any 1 or -1 can be + * returned + ******/ + +static coef_t is_constraint_in_D_form(Relation &r, const Constraint_Handle &h, int &v) { + v=-1; + coef_t c_out = 0; + for (int i = 1; i <= r.n_inp(); i++) { + coef_t c_in = h.get_coef(r.input_var(i)); + if (c_in) { + if (v!=-1) + return 0; + v=i; + c_out = h.get_coef(r.output_var(i)); + + // special case for modular constraint -- by chun 04/02/2009 + if (h.has_wildcards() && typeid(h) == typeid(EQ_Handle)) { + coef_t g = 0; + for (Constr_Vars_Iter cvi(h, true); cvi; cvi++) + g = gcd(g, abs(cvi.curr_coef())); + c_in = int_mod_hat(c_in, g); + c_out = int_mod_hat(c_out, g); + + if (g == 2) { + if (c_in * c_out == 1) { + c_out = -1; + } + else + return 0; + } + else if (c_in * c_out != -1) + return 0; + } + // other cases + else if (c_in * c_out != -1) + return 0; + } + } + return c_out; +} + + +/*** + * Check if relation is in the D form + * D = {[ i_1,i_2,...,i_m] -> [j_1, j_2, ..., j_m ] : + * (forall p, 1<= p <= m) L_p <= j_p - i_p <= U_p && + * j_p - i_p == M_p alpha_p}; + * Right now we do not check for multiple stride constraints for one var. + * Probably they cannot exist in simplified conjunct + * This function will be used in assertions + *****/ + +bool is_in_D_form(Relation & D) { + /* check that D has one conjunct */ + + if (! D.has_single_conjunct()) + return false; + + Conjunct * c=D.single_conjunct(); + + if (D.global_decls()->size() != 0) // there are symbolic vars + return false; + + if (D.n_inp() != D.n_out()) + return false; + + int n=D.n_inp(); + + Tuple bl(n), bu(n); + + for (int i=1; i<= n; i++) + bl[i]=bu[i]=0; + + int v; + coef_t res; + + for (EQ_Iterator eq = c->EQs(); eq.live(); eq.next()) { + if ((res=is_constraint_in_D_form(D,*eq,v))==0) + return false; + int n_wild=is_stride(*eq); + if (n_wild>=2) + return false; + if (n_wild==0) { // not stride constraint + if (bl[v] || bu[v]) + return false; + bl[v]=bu[v]=1; + } + } + + for (GEQ_Iterator geq = c->GEQs(); geq.live(); geq.next()) { + if ((res=is_constraint_in_D_form(D,*geq,v))==0) + return false; + if ((res>0 && bl[v]) || (res<0 && bu[v])) + return false; + if (res>0) + bl[v]=1; + else + bu[v]=1; + } + + return true; +} + + +#define get_D_plus_form(R) (get_D_closure(R,1)) +#define get_D_star_form(R) (get_D_closure(R,0)) + +/**** + * Get D+ or D* from the relation that is in D form + * To get D+ calculate: + * D+= {[i1, i2 .. i_m] -> {j1, j2, ..., j_m]: + * exists s s.t. s>=1 and + * (forall p, 1<= p <= m) L_p * s<= j_p - i_p <= U_p*s && + * j_p - i_p == M_p alpha_p}; + * To get D* calculate almost the same relation but s>=0. + * Parameter n is 1 for getting D+ and 0 for D* + ****/ + + +Relation get_D_closure(Relation & D, int n) { + assert (is_in_D_form(D)); + assert(n==0 || n==1); + + Conjunct *c=D.single_conjunct(); + + Relation R(D.n_inp(), D.n_out()); + + F_Exists * ex = R.add_exists(); + Variable_ID s = ex->declare("s"); + F_And * N = ex->add_and(); + + /* add s>=1 or s>=0 */ + + GEQ_Handle geq= N->add_GEQ(); + geq.update_coef(s,1); + geq.update_const(-n); + geq.finalize(); + + + /* copy and modify all the EQs */ + + for (EQ_Iterator j= c->EQs(); j.live(); j.next()) { + EQ_Handle eq=N->add_EQ(); + copy_constraint(eq, *j); + + // if it's stride constraint do not change it + + if (!is_stride(*j)) { + /* eq is j_k -i_k = c, replace c buy s*c */ + + eq.update_coef(s, (*j).get_const()); + eq.update_const(-(*j).get_const()); + } + eq.finalize(); + } + + /* copy and modify all the GEQs */ + + for (GEQ_Iterator gi= c->GEQs(); gi.live(); gi.next()) { + geq=N->add_GEQ(); + copy_constraint(geq, *gi); + + /* geq is j_k -i_k >=c or i_k-j_k >=c, replace c buy s*c */ + + geq.update_coef(s,(*gi).get_const()); + geq.update_const(-(*gi).get_const()); + geq.finalize(); + } + + R.finalize(); + + if (detailedClosureDebug) { + fprintf(DebugFile, "Simplified D%c is:\n", n==1?'+':'*'); + R.print_with_subs(DebugFile); + } + + return R; +} + + +/*** + * Check if we can easily calculate the D* (D* will be convex). + * We can calculate D* if all differences have both lower and upper + * bounds to be non -/+ infinity + ***/ + + +bool can_get_D_star_form(Relation &D) { + assert(is_in_D_form(D)); + Conjunct *c=D.single_conjunct(); + + int n=D.n_inp(); + Tuple bl(n), bu(n); + int i; + + for (i=1; i<=n; i++) + bl[i]=bu[i]=0; + + for (EQ_Iterator eq = c->EQs(); eq.live(); eq.next()) { + // do not check stride constraints + if (!is_stride(*eq)) { + for (i=1; i<=n; i++) { + if ((*eq).get_coef(D.input_var(i)) !=0 ) + bl[i]=bu[i]=1; + } + } + } + + + for (GEQ_Iterator geq = c->GEQs(); geq.live(); geq.next()) { + for (i=1; i<=n; i++) { + coef_t k; + if ((k=(*geq).get_coef(D.input_var(i))) != 0) { + if (k>0) + bu[i]=1; + else + bl[i]=1; + } + } + } + + for (i=1; i<=n; i++) + if (!bl[i] || !bu[i]) + return false; + + return true; +} + + + +/***** + * Check whether the relation intersect with identity or not + ****/ + +bool does_intersect_with_identity(Relation &R) { + assert (R.n_inp() == R.n_out()); + + Relation I=Identity(R.n_inp()); + Relation C=Intersection(I, copy(R)); + return C.is_upper_bound_satisfiable(); +} + +bool does_include_identity(Relation &R) { + Relation I=Identity(R.n_inp()); + return Must_Be_Subset(I, copy(R)); +} + +/***** + * Bill's closure: check if it is possible to calculate transitive closure + * of the relation using the Bill's algorithm. + * Return the transitive closure relation if it is possible and null relation + * otherwise + ****/ + +bool Bill_closure(Relation &R, Relation& IterationSpace, Relation & R_plus, Relation & R_star) { +#ifdef TC_STATS + fprintf(statsfile,"start bill closure\n"); +#endif + + if (does_include_identity(R)) + return false; + + if (detailedClosureDebug) { + fprintf(DebugFile, "\nApplying Bill's method to calculate transitive closure\n"); + } + + // get D and AxA + Relation D=get_D_form(R); + + + if (detailedClosureDebug) { + fprintf(DebugFile,"\n D form for the relation:\n"); + D.print_with_subs(DebugFile); + } + + Relation AxA=form_region1(R, IterationSpace); + + if (detailedClosureDebug) { + fprintf(DebugFile, "\n AxA for the relation:\n"); + AxA.print_with_subs(DebugFile); + } + + // compute R_+ + + R_plus=Intersection(get_D_plus_form(D), copy(AxA)); + + if (detailedClosureDebug) { + fprintf(DebugFile, "\nR_+= D+ intersection AxA is:\n"); + R_plus.print_with_subs(DebugFile); + } + + // compute R_* + R_star=Intersection(get_D_star_form(D), form_region(R,IterationSpace)); + + if (detailedClosureDebug) { + fprintf(DebugFile, "\nR_*= D* intersection AxA is:\n"); + R_star.print_with_subs(DebugFile); + } + +/* Check that R_+ is acyclic. + Given the way we constructed R_+, R_+=(R_+)+. + As a result it's enough to verify that R_+ intersection I = 0, + to prove that R_+ is acyclic. +*/ + + if (does_intersect_with_identity(R_plus)) { + if (detailedClosureDebug) { + fprintf(DebugFile,"R_+ is not acyclic.\n"); + } + return false; + } + + //Check R_+ - R is Must_Be_Subset of R o R_+ + + if (!Must_Be_Subset(Difference(copy(R_plus), copy(R)), Composition(copy(R), copy(R_plus)))) { +#if defined(TC_STATS) + fprintf(statsfile, "R_+ -R is not a Must_Be_Subset of R o R_+\n"); + fprintf(statsfile, "Bill Method is not applicable\n"); +#endif + return false; + } + if (detailedClosureDebug) { + fprintf(DebugFile, "R_+ -R is a Must_Be_Subset of R o R_+ - good\n"); + } + +// if we are here than all tests worked, and R_+ is transitive closure +// of R. + +#if defined(TC_STATS) + fprintf(statsfile,"\nAll three tests succeeded -- exact closure found\n"); + fprintf(statsfile, "Transitive closure is R_+\n"); +#endif +// assert(isD_OK(R,D,AxA)); + return true; +} + + +/********************************************************************** + * print the relation given the bounds on the iteration space + * If the bounds are unknown (Bounds is Null), then just print relation + * itself + ****/ + +void print_given_bounds( const Relation& R1, NOT_CONST Relation& input_Bounds) { + Relation & Bounds = (Relation &)input_Bounds; + Relation r; + if (Bounds.is_null()) + r=R1; + else + r = Gist(copy(R1),copy(Bounds),1); + r.print_with_subs(DebugFile); +} + +/********************************************************************** + * Investigate closure: + * checks if the copmuted approximation on the Transitive closure + * is upper and lower bound. If it's both - it's exact. + * This function doesn't return any value. It's just prints a lot + * of debug output + * INPUT: + * r - relation + * r_closure - approximation on r+. + * F - iteration space + **********************************************************************/ + +void InvestigateClosure(Relation r, Relation r_closure, Relation F) { + Relation r3; + bool LB_res, UB_res; + + if (!F.is_null()) + F=Cross_Product(copy(F),copy(F)); + + fprintf(DebugFile, "\n\n--->investigating the closure of the relation:\n"); + print_given_bounds(r,F); + + fprintf(DebugFile, "\nComputed closure is:\n"); + print_given_bounds(r_closure,F); + + r3=Composition(copy(r),copy(r_closure)); + r3.simplify(1,1); + + r3=Union(r3,Composition(copy(r_closure),copy(r))); + r3.simplify(1,1); + + r3=Union(r3,copy(r)); + r3.simplify(1,1); + + Relation remainder = Difference(copy(r3),copy(r_closure)); + + if (!F.is_null()) { + r3=Gist(r3,F,1); + } + r3.simplify(1,1); + + if (!F.is_null()) { + r_closure=Gist(r_closure,F,1); + } + r_closure.simplify(1,1); + + LB_res= Must_Be_Subset(copy(r_closure),copy(r3)); + + UB_res=Must_Be_Subset(copy(r3),copy(r_closure)); + + fprintf(DebugFile,"\nThe results of checking closure (gist) are:\n"); + fprintf(DebugFile,"LB - %s, UB - %s\n", LB_res?"YES":"NO", UB_res?"YES":"NO"); + + if (!UB_res) { + remainder.simplify(2,2); + fprintf(DebugFile,"Dependences not included include:\n"); + print_given_bounds(remainder,F); + } +} + + + +/**** + * Transitive closure of the relation containing single conjunct + ****/ + +bool ConjunctTransitiveClosure (NOT_CONST Relation & input_R, Relation & IterationSpace, Relation & R_plus, Relation & R_star) { + Relation R = consume_and_regurgitate(input_R); + assert(R.has_single_conjunct()); + + if (printConjunctClosure) { + fprintf(DebugFile,"\nTaking closure of the single conjunct: [\n"); + R.print_with_subs(DebugFile); + } +#ifdef TC_STATS + fprintf(statsfile,"start conjuncttransitiveclosure\n"); + singles++; +#endif + + if (is_closure_itself(copy(R))) { +#ifdef TC_STATS + fprintf(statsfile, "Relation is closure itself\n"); +#endif + int ndim_all, ndim_domain; + R.dimensions(ndim_all,ndim_domain); + if (ndim_all == ndim_domain +1) { + Relation ispace = Cross_Product(Domain(copy(R)),Range(copy(R))); + Relation R_zero = Intersection(copy(ispace),Identity(R.n_inp())); + R_star = Hull(Union(copy(R),R_zero),true,1,ispace); + R_plus=R; + if (printConjunctClosure) { + fprintf(DebugFile, "\n] For this relation R+=R\n"); + fprintf(DebugFile,"R*:\n"); + R_star.print_with_subs(DebugFile); + } + return true; + } + else { + R_star=R; + R_plus=R; + if (printConjunctClosure) { + fprintf(DebugFile, "\n] For this relation R+=R, not appropriate for R*\n"); + } + return false; + } + } + else { + bool done=false; + if (!IterationSpace.is_null()) { +// Bill's closure requires the information about Iteration Space. +// So if IterationSpace is NULL, i.e. unknown( e.g. when calling from parser, +// we do not do Bill's closure + + done = Bill_closure(R, IterationSpace, R_plus, R_star); +#ifdef TC_STATS + fprintf(statsfile,"Bill closure is %sapplicable\n",done?"":"not "); +#endif + if (printConjunctClosure) { + if (!done) + fprintf(DebugFile, "Bill's closure is not applicable\n"); + else { + fprintf(DebugFile, "Bill's closure is applicable\n"); + fprintf (DebugFile, " For R:\n"); + R.print_with_subs(DebugFile); + fprintf(DebugFile, "R+ is:\n"); + R_plus.print_with_subs(DebugFile); + fprintf(DebugFile, "R* is:\n"); + R_star.print_with_subs(DebugFile); + fprintf(DebugFile, "\n"); + InvestigateClosure(R, R_plus, IterationSpace); + } + } + } + if (done) { + if (printConjunctClosure) { + fprintf(DebugFile, "]\n"); + } + return true; + } + else { + // do and check approximate closure (several compositions) + R_plus = approx_closure(copy(R), 2); +#ifdef TC_STATS + fprintf(statsfile,"Approximating closure with 2 compositions\n"); +#endif + if (printConjunctClosure) { + fprintf(DebugFile, "Doing approximate closure\n"); + InvestigateClosure(R, R_plus, IterationSpace); + } + } //end else (!done after Bill Closure or Iteration space is NULL) + + if (printConjunctClosure) { + fprintf(DebugFile, "]\n"); + } + } + return false; +} + + +/********************************************************************* + * try to get conjunct transitive closure. + * it we can get it easy get it, return true. + * if not - return false + ********************************************************************/ + + +bool TryConjunctTransitiveClosure (NOT_CONST Relation & input_R, Relation & IterationSpace, Relation & R_plus) { + Relation R = consume_and_regurgitate(input_R); + assert(R.has_single_conjunct()); +#ifdef TC_STATS + fprintf(statsfile,"start tryconjuncttransitiveclosure\n"); + singles++; +#endif + + if (printConjunctClosure) { + fprintf(DebugFile,"\nTrying to take closure of the single conjunct: [\n"); + R.print_with_subs(DebugFile); + } + + if (is_closure_itself(copy(R))) { +#ifdef TC_STATS + fprintf(statsfile, "Relation is closure itself, leave alone (try)\n"); +#endif + if (printConjunctClosure) + fprintf(DebugFile, "\n ]The relation is closure itself. Leave it alone\n"); + return false; + } + else { + bool done; + assert(!IterationSpace.is_null()); + Relation R_star; + done = Bill_closure(R, IterationSpace, R_plus, R_star); +#ifdef TC_STATS + fprintf(statsfile, "Bill closure is %sapplicable (try)\n", done?"":"NOT "); +#endif + if (printConjunctClosure) { + if (!done) + fprintf(DebugFile, "]Bill's closure is not applicable\n"); + else { + fprintf(DebugFile, "]Bill's closure is applicable\n"); + fprintf (DebugFile, " For R:\n"); + R.print_with_subs(DebugFile); + fprintf(DebugFile, "R+ is:\n"); + R_plus.print_with_subs(DebugFile); + fprintf(DebugFile, "R* is:\n"); + R_star.print_with_subs(DebugFile); + fprintf(DebugFile, "\n"); + InvestigateClosure(R, R_plus, IterationSpace); + } + } + return done; + } + //return false; +} + + +bool Equal (const Relation & r1, const Relation & r2) { + bool res=Must_Be_Subset (copy(r1), copy(r2)); + if (!res) + return false; + return Must_Be_Subset (copy(r2),copy(r1)); +} + + +void appendClausesToList(Simple_List &L, Relation &R) { + R.make_level_carried_to(R.n_inp()); + R.simplify(2,2); + for(int depth = R.n_inp(); depth >= -1; depth--) + for (DNF_Iterator d(R.query_DNF()); d.live(); d.next()) + if (d.curr()->query_guaranteed_leading_0s() == depth) { + L.append(Relation(R, d.curr())); + } +} + +void printRelationList(Simple_List &L) { + for (Simple_List_Iterator li(L); li.live(); li.next()) { + li.curr().print_with_subs(DebugFile); + } +} + +/**** + * Transitive closure of the relation containing multiple conjuncts + * New (Bill's) version + ***/ + +Relation TransitiveClosure0(NOT_CONST Relation &input_r, int maxExpansion, NOT_CONST Relation & input_IterationSpace) { + Relation r = consume_and_regurgitate(input_r); + Relation IterationSpace = consume_and_regurgitate(input_IterationSpace); + + if (closure_presburger_debug) + fprintf(DebugFile, "\n\n[Transitive closure\n\n"); + + Relation result; + +#ifdef TC_STATS +#define TC_RUNS 1 + int in_conj = copy(r).query_DNF()->length(); + totals++; + fprintf(statsfile,"%d closure run\n", totals); + if(is_in_D_form(copy(r))) + fprintf(statsfile, "Relation initially in D form\n"); + else + fprintf(statsfile, "Relation initially NOT in D form\n"); + if(is_lex_forward(copy(r))) + fprintf(statsfile, "Relation is initially lex forw\n"); + else + fprintf(statsfile, "Relation is NOT initially lex forw\n"); + start_clock(); + for(int tc_loop = 1; tc_loop <= TC_RUNS; tc_loop++) { + singles = 0; +#endif + + assert(!r.is_null()); + assert(r.n_inp() == r.n_out()); + + if (r.max_ufs_arity() > 0) { + assert(r.max_ufs_arity() == 0 && "Can't take transitive closure with UFS yet."); + + fprintf(stderr, "Can't take transitive closure with UFS yet."); + exit(1); + } + + r.simplify(2,2); + if (!r.is_upper_bound_satisfiable()) { +#ifdef TC_STATS + int totalTime = clock_diff(); + fprintf(statsfile, "Relation is unsatisfiable\n"); + fprintf(statsfile, "input conj: %d output conj: %d #singe conj closures: %d time: %d\n", + in_conj, copy(result).query_DNF()->length(), + singles, + totalTime/TC_RUNS); +#endif + + + if (closure_presburger_debug) + fprintf(DebugFile, "]TC : relation is false\n"); + return r; + } + + IterationSpace = Hull(Union(Domain(copy(r)),Range(copy(r))), true, 1, IterationSpace); + + if (detailedClosureDebug) { + fprintf(DebugFile, "r is:\n"); + r.print_with_subs(DebugFile); + fprintf(DebugFile, "IS is:\n"); + IterationSpace.print_with_subs(DebugFile); + } + Relation dom = Domain(copy(r)); + dom.simplify(2,1); + Relation rng = Range(copy(r)); + rng.simplify(2,1); + Relation AC = ConicClosure(Restrict_Range(Restrict_Domain(copy(r),copy(rng)),copy(dom))); + Relation UB = Union(copy(r),Join(copy(r),Join(AC,copy(r)))); + UB.simplify(2,1); + + if (detailedClosureDebug) { + fprintf(DebugFile, "UB is:\n"); + UB.print_with_subs(DebugFile); + } + result = Relation::False(r); + Simple_List firstChoice,secondChoice; + + r.simplify(2,2); + + Relation test = Difference(copy(r),Composition(copy(r),copy(r))); + test.simplify(2,2); + if (r.number_of_conjuncts() > test.number_of_conjuncts()) { + Relation test2 = Union(copy(test),Composition(copy(test),copy(test))); + test2.simplify(2,2); + if (Must_Be_Subset(copy(r),copy(test2))) r = test; + else if (detailedClosureDebug) { + fprintf(DebugFile, "Transitive reduction not possible:\n"); + fprintf(DebugFile, "R is:\n"); + r.print_with_subs(DebugFile); + fprintf(DebugFile, "test2 is:\n"); + test2.print_with_subs(DebugFile); + } + } + + r.make_level_carried_to(r.n_inp()); + if (detailedClosureDebug) { + fprintf(DebugFile, "r is:\n"); + r.print_with_subs(DebugFile); + } + for(int depth = r.n_inp(); depth >= -1; depth--) + for (DNF_Iterator d(r.query_DNF()); d.live(); d.next()) + if (d.curr()->query_guaranteed_leading_0s() == depth) { + Relation C(r, d.curr()); + firstChoice.append(C); + } + + bool first_conj=true; + for (Simple_List_Iterator sli(firstChoice); sli; sli++) { + if (first_conj) + first_conj=false; + else { + Relation C_plus; + bool change=TryConjunctTransitiveClosure( + copy(sli.curr()), IterationSpace, C_plus); + if (change) + sli.curr()=C_plus; + } + } + + //compute closure + int maxClauses = 3+firstChoice.size()*(1+maxExpansion); + + int resultConjuncts = 0; + int numFails = 0; + bool resultInexact = false; + while (!firstChoice.empty() || !secondChoice.empty()) { + Relation R_plus, R_star; + + if (detailedClosureDebug) { + fprintf(DebugFile,"Main loop of TC:\n"); + if (!firstChoice.empty()) { + fprintf(DebugFile,"First choice:\n"); + printRelationList(firstChoice); + } + if (!secondChoice.empty()) { + fprintf(DebugFile,"Second choice:\n"); + printRelationList(secondChoice); + } + } + + Relation R; + if (!firstChoice.empty()) + R = firstChoice.remove_front(); + else R = secondChoice.remove_front(); + + if (detailedClosureDebug) { + fprintf(DebugFile, "Working with conjunct:\n"); + R.print_with_subs(DebugFile); + } + + bool known=ConjunctTransitiveClosure(copy(R),IterationSpace, R_plus, R_star); + + if (!known && numFails < firstChoice.size()) { + numFails++; + firstChoice.append(R); + if (detailedClosureDebug) { + fprintf(DebugFile, "\nTry another conjunct, R is not suitable\n"); + R.print_with_subs(DebugFile); + } + continue; + } + + + if (detailedClosureDebug) { + fprintf(DebugFile,"\nR+ is:\n"); + R_plus.print_with_subs(DebugFile); + if (known) { + fprintf(DebugFile, "Known R? is :\n"); + R_star.print_with_subs(DebugFile); + } + else + fprintf(DebugFile, "The R* for this relation is not calculated\n"); + } + + Relation R_z; + if (known) { + R_z=Difference(copy(R_star),copy(R_plus)); + known = R_z.is_upper_bound_satisfiable(); + if (known) { + int d = R.single_conjunct()->query_guaranteed_leading_0s(); + R_z.make_level_carried_to(min(R.n_inp(),d+1)); + if (R_z.query_DNF()->length() > 1) known = false; + if (detailedClosureDebug) { + fprintf(DebugFile, "\nForced R_Z to be level carried at level %d\n",min(R.n_inp(),d+1)); + } + } + if (detailedClosureDebug) { + if (known) { + fprintf(DebugFile, "\nDifference between R? and R+ is:\n"); + R_z.print_with_subs(DebugFile); + } + else + fprintf(DebugFile, "\nR_z is unusable\n"); + } + } + else R_z = Relation::False(r); + + if (!known) + numFails++; + else numFails = 0; + if (!known && numFails <= firstChoice.size()) { + firstChoice.append(R); + if (detailedClosureDebug) { + fprintf(DebugFile, "\nTry another conjunct, Rz is avaiable for R:\n"); + R.print_with_subs(DebugFile); + } + continue; + } + + //make N empty list + Relation N = Relation::False(r); + + //append R+ to T + result = Union(result, copy(R_plus)); + resultConjuncts++; + + int expansion = maxClauses - (resultConjuncts + 2*firstChoice.size() + secondChoice.size()); + if (expansion < 0) expansion = 0; + if (detailedClosureDebug) { + fprintf(DebugFile,"Max clauses = %d\n",maxClauses); + fprintf(DebugFile,"result conjuncts = %d\n",resultConjuncts); + fprintf(DebugFile,"firstChoice's = %d\n",firstChoice.size()); + fprintf(DebugFile,"secondChoice's = %d\n",secondChoice.size()); + fprintf(DebugFile,"Allowed expansion is %d\n",expansion); + } + + bool firstPart=true; + if (!known && expansion == 0) { + if (detailedClosureDebug) { + fprintf(DebugFile,"Expansion = 0, R? unknown, skipping composition\n"); + } + if (!resultInexact && detailedClosureDebug) fprintf(DebugFile,"RESULT BECOMES INEXACT 1\n"); + resultInexact = true; + } + else + for (Simple_List_Iterator s(firstChoice); + firstPart? + (s.live()?true: + (s = Simple_List_Iterator(secondChoice), + firstPart = false, + s.live())) + :s.live(); + s.next()) { + assert(s.live()); + Relation C=(s.curr()); + if (detailedClosureDebug) { + fprintf(DebugFile, "\nComposing chosen conjunct with C:\n"); + C.print_with_subs(DebugFile); + } + + if (!known) { + if (detailedClosureDebug) { + fprintf(DebugFile, "\nR? is unknown! No debug info here yet\n"); + } + Relation C1=Composition(copy(C), copy(R_plus)); + if (detailedClosureDebug) { + fprintf(DebugFile, "\nGenerating \n"); + C1.print_with_subs(DebugFile); + } + C1.simplify(); + Relation newStuff = + Difference( + Difference(copy(C1),copy(C)), + copy(R_plus)); + newStuff.simplify(); + if (detailedClosureDebug) { + fprintf(DebugFile, "New Stuff:\n"); + newStuff.print_with_subs(DebugFile); + } + bool C1_contains_new_stuff = newStuff.is_upper_bound_satisfiable(); + if (C1_contains_new_stuff) { + if (newStuff.has_single_conjunct()) + C1 = newStuff; + if (expansion) { + N = Union(N,copy(C1)); + expansion--; + } + else { + if (!resultInexact && detailedClosureDebug) fprintf(DebugFile,"RESULT BECOMES INEXACT 2\n"); + resultInexact = true; + break; + } + } + else C1 = Relation::False(C1); + + Relation C2(Composition(copy(R_plus),copy(C))); + if (detailedClosureDebug) { + fprintf(DebugFile, "\nGenerating \n"); + C2.print_with_subs(DebugFile); + } + newStuff = + Difference( + Difference( + Difference(copy(C2),copy(C)), + copy(C1)), + copy(R_plus)); + newStuff.simplify(); + if (detailedClosureDebug) { + fprintf(DebugFile, "New Stuff:\n"); + newStuff.print_with_subs(DebugFile); + } + if (newStuff.is_upper_bound_satisfiable()) { + if (newStuff.has_single_conjunct()) + C2 = newStuff; + if (expansion) { + N = Union(N,copy(C2)); + expansion--; + } + else { + if (!resultInexact && detailedClosureDebug) fprintf(DebugFile,"RESULT BECOMES INEXACT 3\n"); + resultInexact = true; + break; + } + } + else C2 = Relation::False(C2); + + if (C1_contains_new_stuff) { + Relation C3(Composition(copy(R_plus),copy(C1))); + if (detailedClosureDebug) { + fprintf(DebugFile, "\nGenerating \n"); + C3.print_with_subs(DebugFile); + } + newStuff = + Difference( + Difference( + Difference( + Difference(copy(C3),copy(C)), + copy(C1)), + copy(C2)), + copy(R_plus)); + newStuff.simplify(); + if (detailedClosureDebug) { + fprintf(DebugFile, "New Stuff:\n"); + newStuff.print_with_subs(DebugFile); + } + if (newStuff.is_upper_bound_satisfiable()) { + if (newStuff.has_single_conjunct()) + C3 = newStuff; + if (expansion) { + N = Union(N,C3); + expansion--; + } + else { + if (!resultInexact && detailedClosureDebug) fprintf(DebugFile,"RESULT BECOMES INEXACT 4\n"); + resultInexact = true; + break; + } + } + } + + } + else { + Relation C_Rz(Composition(copy(C),copy(R_z))); + if (detailedClosureDebug) { + fprintf(DebugFile, "C o Rz is:\n"); + C_Rz.print_with_subs(DebugFile); + } + + Relation Rz_C_Rz(Composition(copy(R_z),copy(C_Rz))); + if (detailedClosureDebug) { + fprintf(DebugFile, "\nRz o C o Rz is:\n"); + Rz_C_Rz.print_with_subs(DebugFile); + } + + if (Equal(C,Rz_C_Rz)) { +#if defined(TC_STATS) + fprintf(statsfile,"weak test selects C?\n"); +#endif + Relation tmp = Composition(C,copy(R_star)); + tmp.simplify(); + Relation tmp2 = Composition(copy(R_star),copy(tmp)); + tmp2.simplify(); + if (Must_Be_Subset(copy(tmp2),copy(tmp))) + *s = tmp; + else + *s = tmp2; + if (detailedClosureDebug) { + fprintf(DebugFile,"\nC is equal to Rz o C o Rz so R? o C o R? replaces C\n"); + fprintf(DebugFile, "R? o C o R? is:\n"); + (*s).print_with_subs(DebugFile); + } + } + else { +#if defined(TC_STATS) + fprintf(statsfile,"weak test fails\n"); +#endif + if (Equal(C, C_Rz)) { + *s=Composition(copy(C),copy(R_star)); + Relation p(Composition(copy(R_plus), copy(*s))); + p.simplify(); + if (detailedClosureDebug) { + fprintf(DebugFile, "\nC is equal to C o Rz, so C o Rz replaces C\n"); + fprintf (DebugFile, "C o R? is:\n"); + (*s).print_with_subs(DebugFile); + fprintf (DebugFile, "R+ o C o R? is added to list N. It's :\n"); + p.print_with_subs(DebugFile); + } + if (!Is_Obvious_Subset(copy(p),copy(R_plus)) + && !Is_Obvious_Subset(copy(p),copy(C))) { + if (expansion) { + p.simplify(2,2); + expansion--; + } + else { + if (!resultInexact && detailedClosureDebug) fprintf(DebugFile,"RESULT BECOMES INEXACT 5\n"); + resultInexact = true; + break; + } + } + } + else { + Relation Rz_C(Composition(copy(R_z),copy(C))); + + if (Equal(C,Rz_C)) { + *s=Composition(copy(R_star),copy(C)); + Relation Rstar_C_Rplus(Composition(copy(*s),copy(R_plus))); + Rstar_C_Rplus.simplify(); + if (detailedClosureDebug) { + fprintf(DebugFile, "\nC is equal to Rz o C , so R? o C replaces C\n"); + fprintf (DebugFile, "R? o C is:\n"); + (*s).print_with_subs(DebugFile); + fprintf (DebugFile, "R+ o C is added to list N. It's :\n"); + Rstar_C_Rplus.print_with_subs(DebugFile); + } + if (!Is_Obvious_Subset(copy(Rstar_C_Rplus),copy(R_plus)) + && !Is_Obvious_Subset(copy(Rstar_C_Rplus),copy(C))) { + if (expansion) + N = Union(N,Rstar_C_Rplus); + else { + if (!resultInexact && detailedClosureDebug) fprintf(DebugFile,"RESULT BECOMES INEXACT 6\n"); + resultInexact = true; + break; + } + } + } + else { + if (detailedClosureDebug) { + fprintf(DebugFile, "\nHave to handle it the hard way\n"); + } + Relation C1=Composition(copy(C), copy(R_plus)); + C1.simplify(); + if (!Is_Obvious_Subset(copy(C1),copy(R_plus)) + && !Is_Obvious_Subset(copy(C1),copy(C))) { + if (expansion) { + N = Union(N,copy(C1)); + expansion--; + } + else { + if (!resultInexact && detailedClosureDebug) fprintf(DebugFile,"RESULT BECOMES INEXACT 7\n"); + resultInexact = true; + break; + } + } + + Relation C2(Composition(copy(R_plus),copy(C))); + C2.simplify(); + if (!Is_Obvious_Subset(copy(C2),copy(R_plus)) + && !Is_Obvious_Subset(copy(C2),copy(C))) { + if (expansion) { + N = Union(N,C2); + expansion--; + } + else { + if (!resultInexact && detailedClosureDebug) { + fprintf(DebugFile,"RESULT BECOMES INEXACT 8\n"); + fprintf(DebugFile,"Have to discard:\n"); + C2.print_with_subs(DebugFile); + } + resultInexact = true; + break; + } + } + Relation C3(Composition(copy(R_plus),C1)); + C3.simplify(); + if (!Is_Obvious_Subset(copy(C3),copy(R_plus)) && !Is_Obvious_Subset(copy(C3),copy(C))) { + if (expansion) { + N = Union(N,C3); + expansion--; + } + else { + if (!resultInexact && detailedClosureDebug) + fprintf(DebugFile,"RESULT BECOMES INEXACT 9\n"); + resultInexact = true; + break; + } + } + } + } + } + } + } + + //now we processed the first conjunct. + if (detailedClosureDebug) { + N.simplify(2,2); + fprintf(DebugFile, "\nNew conjuncts:\n"); + N.print_with_subs(DebugFile); + } + + N.simplify(2,2); + appendClausesToList(secondChoice,N); + } + + //Did we do all conjuncts? If not, make T be inexact + result.copy_names(r); + + result.simplify(2,2); + + if (!result.is_exact()) { + result = Lower_Bound(result); + resultInexact = true; + } + if (resultInexact) { + Relation test(Composition(copy(result),copy(result))); + test.simplify(2,2); + if (detailedClosureDebug) { + fprintf(DebugFile, "\nResult is:\n"); + result.print_with_subs(DebugFile); + fprintf(DebugFile, "\nResult composed with itself is:\n"); + test.print_with_subs(DebugFile); + } + if (!Must_Be_Subset(test,copy(result))) { + result = Union(result,Intersection(UB, Relation::Unknown(result))); + } + } + +#ifdef TC_STATS + { + Relation rcopy = result; + Relation test2(Composition(copy(rcopy),copy(rcopy))); + test2.simplify(2,2); + test2.remove_disjunction_with_unknown(); + rcopy.remove_disjunction_with_unknown(); + if (detailedClosureDebug) { + fprintf(DebugFile, "\nResult is:\n"); + rcopy.print_with_subs(DebugFile); + fprintf(DebugFile, "\nResult composed with itself is:\n"); + test2.print_with_subs(DebugFile); + } + if (!Must_Be_Subset(test2,copy(rcopy))) { + fprintf(statsfile,"multi TC result is inexact\n"); + } + else + fprintf(statsfile,"TC result is exact%s\n", (resultInexact || !rcopy.is_exact())?" despite perceived inexactness":""); + } +#endif + +#ifdef TC_STATS + } + int totalTime = clock_diff(); + fprintf(statsfile, "input conj: %d output conj: %d #singe conj closures: %d time: %d\n", + in_conj, copy(result).query_DNF()->length(), + singles, + totalTime/TC_RUNS); +#endif + + if (closure_presburger_debug || detailedClosureDebug) { + if (detailedClosureDebug) { + fprintf(DebugFile, "\nThe transitive closure is :\n"); + result.print_with_subs(DebugFile); + } + fprintf(DebugFile, "\n\n] END Transitive closure\n\n"); + } + return result; +} + + +Relation TransitiveClosure(NOT_CONST Relation &input_r, + int maxExpansion, + NOT_CONST Relation & input_IterationSpace) { + Relation r = consume_and_regurgitate(input_r); + Relation IterationSpace = consume_and_regurgitate(input_IterationSpace); + if (r.is_null()) + return r; + if (r.n_out() == 0) + throw std::invalid_argument("transitive closure does not apply to set"); + if (r.n_inp() != r.n_out()) + throw std::invalid_argument("transitive closure must has the same input and output arity"); + + if (closure_presburger_debug) { + fprintf(DebugFile,"\nComputing Transitive closure of:\n"); + r.print_with_subs(DebugFile); + fprintf(DebugFile,"\nIteration space is:\n"); + IterationSpace.print_with_subs(DebugFile); + } + if (!r.is_upper_bound_satisfiable()) { + if (closure_presburger_debug) + fprintf(DebugFile, "]TC : relation is false\n"); + return r; + } + + Relation UB = DeltasToRelation(ConicHull(Project_Sym(Deltas(copy(r)))), + r.n_inp(),r.n_out()); + if (closure_presburger_debug) { + fprintf(DebugFile,"UB is:\n"); + UB.print_with_subs(DebugFile); + } + + Relation conditions = Restrict_Domain(copy(UB),Domain(copy(r))); + conditions.simplify(); + if (closure_presburger_debug) { + fprintf(DebugFile,"Forward reachable is:\n"); + conditions.print_with_subs(DebugFile); + } + conditions = Composition(Inverse(copy(UB)),conditions); + conditions.simplify(); + if (closure_presburger_debug) { + fprintf(DebugFile,"Backward/forward reachable is:\n"); + conditions.print_with_subs(DebugFile); + } + conditions = Range(conditions); + conditions.simplify(); + // conditions = Approximate(conditions); + // conditions.simplify(); + conditions = VennDiagramForm(conditions); + conditions.simplify(); + + if (closure_presburger_debug) { + fprintf(DebugFile,"Condition regions are:\n"); + conditions.print_with_subs(DebugFile); + } + + if (conditions.is_obvious_tautology()) { + return TransitiveClosure0(r, maxExpansion, IterationSpace); + } + else { + Relation answer = Relation::False(r); + answer.copy_names(r); + answer.setup_names(); + + for (DNF_Iterator c(conditions.query_DNF()); c.live(); c.next()) { + Relation tmp = Relation(conditions, c.curr()); + if (closure_presburger_debug) { + fprintf(DebugFile,"\nComputing Transitive closure:\n"); + fprintf(DebugFile,"\nRegion:\n"); + tmp.prefix_print(DebugFile); + } + + Relation tmp3 = Restrict_Domain(copy(r),tmp); + tmp3.simplify(2,2); + if (closure_presburger_debug) { + fprintf(DebugFile,"\nRelation:\n"); + tmp3.prefix_print(DebugFile); + } + + answer = Union(answer, TransitiveClosure0(tmp3, maxExpansion,copy(IterationSpace))); + } + return answer; + } +} + + +/* ********************************* */ +/* Function check if relation */ +/* belong to d-form or */ +/* uniform relaion class */ +/* ********************************* */ + +Relation is_DForm_or_Uniform(NOT_CONST Relation &r){ + + Relation s = consume_and_regurgitate(r); + Relation Rtmp, Rdelta, delta; + + delta = Deltas(copy(s)); + Rdelta = DeltasToRelation(copy(delta), s.n_inp(), s.n_out()); + Rtmp = DeltasToRelation(Project_Sym(delta), s.n_inp(), s.n_out()); + + Rtmp = Restrict_Domain(Rtmp, Domain(copy(Rdelta))); + Rtmp = Restrict_Range(Rtmp, Range(Rdelta)); + + Rdelta = copy(Rtmp); + + Rtmp = Restrict_Domain(Rtmp, Domain(copy(s))); + Rtmp = Restrict_Range(Rtmp, Range(copy(s))); + + if (Must_Be_Subset( copy(Rtmp), copy(s)) && \ + Must_Be_Subset(copy(s), copy(Rtmp))) { + Rtmp = Relation::Null(); + } + else { + Rtmp = Rdelta = Relation::Null(); + } + + return Rdelta; + } + + + + /* ********************************* */ + /* Get a conjunction for */ + /* a given number from set */ + /* of relations */ + /* ********************************* */ + +Relation getConjunctionNr(NOT_CONST Relation &r, int conjNr) { + + Relation s = consume_and_regurgitate(r); + int i = 1; + + for (DNF_Iterator c(s.query_DNF()); c; c++,i++) { + if ( i == conjNr ) { + return Relation(s, c.curr()); + } + } + + return Relation::False(s.n_inp(), s.n_out()); + + } + + +/* ********************************* */ +/* Get a common region for */ +/* a given set of relations */ +/* ********************************* */ + +Relation getCommonRegion( NOT_CONST Relation &r, const long* relTab, const long relCount) { + + Relation s = consume_and_regurgitate(r); + Relation commonRegion, Rcurr; + long i = 0; + + Rcurr = getConjunctionNr( copy(s), relTab[0]); + commonRegion = Union(Domain(copy(Rcurr)), Range(copy(Rcurr))); + + for( i=1; i < relCount; i++ ){ + Rcurr = getConjunctionNr( copy(s), relTab[i]); + commonRegion = Intersection( commonRegion, Union( Domain(copy(Rcurr)), Range(copy(Rcurr))) ); + } + + return commonRegion; + } + + +/* ********************************* */ +/* Get a set of relations */ +/* ********************************* */ + +Relation getRelationsSet( NOT_CONST Relation &r, const long* relTab, const long relCount) { + + Relation s = consume_and_regurgitate(r); + Relation R = Relation::False(s.n_inp(), s.n_out()); + long i = 0; + + for( i=0; i < relCount; i++ ){ + R = Union( R, getConjunctionNr( copy(s), relTab[i]) ); + } + + return R; + } + + +/* ********************************* */ +/* Get a set of relations */ +/* from a common region */ +/* ********************************* */ + +Relation relationsOnCommonRegion( NOT_CONST Relation &r, NOT_CONST Relation ®ion ) { + + Relation set = consume_and_regurgitate(r); + Relation reg = consume_and_regurgitate(region); + Relation R = Relation::True(set.n_inp(), set.n_out()); + + R = Restrict_Domain(R, copy(reg)); + R.simplify(2,1); + R = Restrict_Range(R, reg); + R.simplify(2,1); + + R = Intersection(R, set); + + return R; + + } + + +Relation compose_N(NOT_CONST Relation &input_r) { + Relation r = consume_and_regurgitate(input_r); + Relation powerR, powerR2; + + r = Union(r, Identity(r.n_inp())); + powerR = copy(r); + + for(;;){ + if (powerR.number_of_conjuncts() > 50) { + powerR = Relation::Null(); + return powerR; + } + + powerR2 = Composition(copy(powerR), copy(r)); + powerR2.simplify(2,1); + + if (Must_Be_Subset( copy(powerR2), copy(powerR))) { + powerR2 = Relation::Null(); + return powerR; + } + + powerR = Relation::Null(); + powerR = copy(powerR2); + powerR2 = Relation::Null(); + } +} + + +/****************************** */ +/* Check exactness of R+ */ +/* */ +/* Tomasz Klimek 05-06-2010 */ +/****************************** */ + +bool checkExactness(NOT_CONST Relation &r, NOT_CONST Relation &rplus){ + + +Relation s1 = consume_and_regurgitate(r); +Relation s2 = consume_and_regurgitate(rplus); +Relation R; + +R = Composition(copy(s1), copy(s2)); +R = Union(s1, R); + + if( Must_Be_Subset(copy(s2), copy(R)) && \ + Must_Be_Subset(copy(R), copy(s2))) { + R = Relation::Null(); + s1 = Relation::Null(); + return true; + } + + R = Relation::Null(); + s1 = Relation::Null(); + + return false; + +} + +/************************************** */ +/* Calculate approximation of R* */ +/* */ +/* Tomasz Klimek 05-06-2010 */ +/************************************** */ + + +Relation ApproxClosure(NOT_CONST Relation &r) { + + Relation s = consume_and_regurgitate(r); + Relation R = Relation::False(s.n_inp(), s.n_out()); + Relation tc = Identity(s.n_inp()); + Relation Rtmp; + + + for (DNF_Iterator c(s.query_DNF()); c; c++) { + Rtmp = Hull(Project_Sym(Deltas(Relation(s, c.curr()))), false, 1, Relation::Null()); + R = Union(R, TransitiveClosure(DeltasToRelation(Rtmp,s.n_inp(),s.n_out()), 1, Relation::Null())); + } + + for (DNF_Iterator c(R.query_DNF()); c; c++) { + Rtmp = Union(Identity(s.n_inp()), Relation(R, c.curr())); + tc = Composition(tc, Rtmp); + tc = Hull(tc, false, 1, Relation::Null()); + } + + tc = Restrict_Domain(tc,Domain(copy(s))); + tc.simplify(2,1); + tc = Restrict_Range(tc,Range(s)); + tc.simplify(2,1); + tc = Intersection(tc, Relation::Unknown(tc)); + + return tc; +} + + +/************************************** */ +/* Calculate R* on unbounded region */ +/* */ +/* Tomasz Klimek 05-06-2010 */ +/************************************** */ + +Relation ClosureOnUnboundedRegion(NOT_CONST Relation &r) { + + Relation s = consume_and_regurgitate(r); + Relation R = Relation::False(s.n_inp(), s.n_out()); + Relation tc = Identity(s.n_inp()); + Relation Rtmp,tcTmp; + + for (DNF_Iterator c(s.query_DNF()); c; c++) { + Rtmp = is_DForm_or_Uniform(Relation(s, c.curr())); + + if (!(Rtmp.is_null())) { + tcTmp = TransitiveClosure(Rtmp, 1, Relation::Null()); + + if (!(tcTmp.is_exact())){ + tcTmp = R = Relation::Null(); + /* fprintf(DebugFile,"\nTC is inexact!"); */ + return tcTmp; + } + } + else { + R = Relation::Null(); + /* fprintf(DebugFile,"\nR is not d-form relation!"); */ + return Relation::Null(); + } + + R = Union(R, tcTmp); + } + + for (DNF_Iterator c(R.query_DNF()); c; c++) { + Rtmp = Union(Identity(s.n_inp()), Relation(R, c.curr())); + tc = Composition(tc, Rtmp); + tc.simplify(2,1); + } + + tc = Difference(tc, Identity(s.n_inp())); + + return tc; + +} + + + + +/******************************* */ +/* Try to select sets of domain */ +/* and range */ +/* */ +/* Tomasz Klimek 05-06-2010 */ +/******************************* */ + +Relation SelectRegionForClosure(NOT_CONST Relation &r){ + + Relation s = consume_and_regurgitate(r); + Relation DR = Union(Domain(copy(s)),Range(copy(s))); + Relation region,tc,tcTmp; + + region = SimpleHull(copy(DR)); + region.simplify(2,1); + + tc = ClosureOnUnboundedRegion(copy(s)); + + if (tc.is_null()) { + return tc; + } + + tcTmp = Restrict_Domain(copy(tc),copy(region)); + tcTmp.simplify(2,1); + tcTmp = Restrict_Range(tcTmp,region); + tcTmp.simplify(2,1); + + if (checkExactness(copy(s), copy(tcTmp))) { + s = tc = Relation::Null(); + return tcTmp; + } + + tcTmp = Relation::Null(); + region = Hull(DR,false,1,Relation::Null()); + + tcTmp = Restrict_Domain(copy(tc),copy(region)); + tcTmp.simplify(2,1); + tcTmp = Restrict_Range(tcTmp,region); + tcTmp.simplify(2,1); + + if (checkExactness(copy(s), copy(tcTmp))) { + s = tc = Relation::Null(); + return tcTmp; + } + + tcTmp = Relation::Null(); + + tc = Restrict_Domain(tc,Domain(copy(s))); + tc.simplify(2,1); + tc = Restrict_Range(tc,Domain(copy(s))); + tc.simplify(2,1); + + if (checkExactness(copy(s), copy(tc))) { + s = Relation::Null(); + return tc; + } + + tc = Relation::Null(); + + return ApproxClosure(s); + +} + + + + +/************************************** */ +/* Calculate R* */ +/* */ +/* Tomasz Klimek 05-06-2010 */ +/************************************** */ + +Relation calculateTransitiveClosure(NOT_CONST Relation &r) { + + Relation s = consume_and_regurgitate(r); + Relation tc = Relation::False(s.n_inp(), s.n_out()); + long* relationsSet = NULL; + Relation commonRegion, regionTmp; + Relation inputRelations; + long i,j=-1; + long N,M; + Relation R; + + + commonRegion = SelectRegionForClosure(copy(s)); + + if (commonRegion.is_null()) { + return ApproxClosure(s); + } + + if (commonRegion.is_exact()) { + return commonRegion; + } + + commonRegion = Relation::Null(); + N = M = s.number_of_conjuncts(); + relationsSet = (long*)calloc(N,sizeof(long)); + + if (relationsSet == NULL) { + return Relation::False(s.n_inp(), s.n_out()); + } + + for (; N > 1;) { + for ( i=0; i j ) { + relationsSet[i] = relationsSet[i-1] + 1; + } + else if ( i == j ) { + relationsSet[i] += 1; + } + if ( relationsSet[i] <= M ) { + j = i; + } + else { + j = i - 1; + break; + } + } + + if ( j+1 == N) { + /* fprintf(DebugFile,"\n"); + for(i=0;i +#include +#include +#include +#include + +namespace omega { + +int evac_debug = 0; + +char *evac_names[] = { "trivial", + "offset", + "subseq", + "off_sub", +// "perm.", + "affine", + "nasty" }; + +int single_evacs[evac_nasty+1]; +int double_evacs[evac_nasty+1][evac_nasty+1]; + +/* + * We're going to try to describe the equalities among a set of variables + * We want to perform some substitutions to ensure that we don't miss + * v_1 = v_2 due to its expression as v_1 = v_3 && v_2 = v_3 + * We therefore try to substitute out all variables that we don't care + * about (e.g., v_3 in the above example). + */ + +static bool try_to_sub(Problem *p, int col) { + int e, i; + + if (!p->variablesInitialized) { + p->initializeVariables(); + } + + assert(col <= p->nVars); + assert(!inApproximateMode); + + for(e=0;enEQs;e++) + if (p->EQs[e].coef[col] == 1 || p->EQs[e].coef[col] == -1) { + int var = p->var[col]; + p->doElimination(e, col); + if (col != p->nVars + 1) + p->forwardingAddress[p->var[p->nVars+1]] = col; + assert(p->SUBs[p->nSUBs-1].key = var); + p->forwardingAddress[var] = -p->nSUBs; + break; + } + + if (e == p->nEQs) + return false; + + for (int c=0;c<=p->nVars;c++) { + assert(p->EQs[e].coef[c] == 0); + } + + p->nEQs--; + if (e < p->nEQs) eqnncpy(&p->EQs[e], &p->EQs[p->nEQs], p->nVars); + + for (i = 0; i < p->nSUBs; i++) { + assert(p->forwardingAddress[p->SUBs[i].key] == -i - 1); + } + + return true; +} + + +// should be static, but must be a friend +bool check_subseq_n(Conjunct *c, Sequence &evac_from, Sequence &evac_to, int n_from, int n_to, int max_arity, int n, bool allow_offset) { + // check each position v to see if from[v] == to[v+n] (+ offset) + + assert(max_arity + n <= n_to); + + for (int v = 1; v <= max_arity; v++){ + // first, get rid of possible interlopers: + int col; + Conjunct *d = c->copy_conj_same_relation(); + for (int tv = 1; tv <= n_to; tv++) + if (tv != v+n) + if ((col = d->find_column(evac_to[tv])) > 0) + try_to_sub(d->problem, col); + for (int fv = 1; fv <= n_from; fv++) + if (fv != v) + if ((col = d->find_column(evac_from[fv])) > 0) + try_to_sub(d->problem, col); + + int c_to = d->find_column(evac_to[v+n]); + int c_from = d->find_column(evac_from[v]); + assert(c_to > 0); + assert(c_from > 0); + assert(c_to != c_from); + + // now, just look for an equality c_to = c_from + offset + + bool found_needed_eq = false; + + for (int e = 0; e < d->problem->nEQs; e++) { + if (d->problem->EQs[e].coef[c_from] != 0) { + for (int k = allow_offset?1:0; k < d->problem->nVars; k++) + if (k!=c_to && k!=c_from && d->problem->EQs[e].coef[k]!=0) + break; // this EQ is not what we need + if (k == d->problem->nVars) { // this EQ is what we need + found_needed_eq = true; + break; + } + } + } + + delete d; + + if (!found_needed_eq) + return false; // no EQ did what we need + } + + return true; +} + +void assert_subbed_syms(Conjunct *c) { + int v, col; + + // where possible, symbolic constants must have been subbed out + for (v = 1; v <= c->relation()->global_decls()->length(); v++) + if ((col = c->find_column((*c->relation()->global_decls())[v]))>0) + assert(!try_to_sub(c->problem, col)); +} + + +static bool check_offset(Conjunct *c, Sequence &evac_from, Sequence &evac_to, int n_from, int n_to, int max_arity) { + assert_subbed_syms(c); + + return check_subseq_n(c,evac_from,evac_to,n_from,n_to,max_arity,0,true); +} + +static bool check_subseq(Conjunct *c, Sequence &evac_from, Sequence &evac_to, int n_from, int n_to, int max_arity) { + assert_subbed_syms(c); + + for (int i = 0; i <= n_to - max_arity; i++) + if (check_subseq_n(c,evac_from,evac_to,n_from,n_to,max_arity,i,false)) + return true; + + return false; +} + +static bool check_offset_subseq(Conjunct *c, Sequence &evac_from, Sequence &evac_to, int n_from, int n_to, int max_arity) { + assert_subbed_syms(c); + + for (int i = 0; i <= n_to - max_arity; i++) + if (check_subseq_n(c,evac_from,evac_to,n_from,n_to,max_arity,i,true)) + return true; + + return false; +} + +bool check_affine(Conjunct *d, Sequence &evac_from, Sequence &evac_to, int n_from, int n_to, int max_arity) { + int v, col; + Conjunct *c = d->copy_conj_same_relation(); + assert_subbed_syms(c); + + // try to find substitutions for all evac_to variables + for (v = 1; v <= max_arity; v++) + if ((col = c->find_column(evac_to[v])) > 0) + try_to_sub(c->problem, col); + + // any that didn't have substitutions, aren't affine + for (v = 1; v <= max_arity; v++) + if (c->find_column(evac_to[v]) >= 0) { + delete c; + return false; + } + + // FERD - disallow symbolic constants? + delete c; + return true; +} + + +evac study(Conjunct *C, Sequence &evac_from, Sequence &evac_to, int n_from, int n_to, int max_arity) { + assert(max_arity > 0); + assert(max_arity <= C->relation()->n_inp()); + assert(max_arity <= C->relation()->n_out()); + + assert((&evac_from == &input_vars && &evac_to == &output_vars) || + (&evac_from == &output_vars && &evac_to == &input_vars)); + + evac ret = evac_nasty; + + if (C->query_guaranteed_leading_0s() >= max_arity) + ret = evac_trivial; + else { + Conjunct *c = C->copy_conj_same_relation(); + assert(c->relation() == C->relation()); + + if (evac_debug >= 3) { + fprintf(DebugFile, "About to study %s evacuation for conjunct\n", + &evac_from == &input_vars ? "In-->Out" : "Out-->In"); + use_ugly_names++; + C->prefix_print(DebugFile); + use_ugly_names--; + } + + bool sat = simplify_conj(c, true, 4, black); + assert(sat); // else c is deleted + + int v, col; + + // Substitute out all possible symbolic constants + assert(c->problem->nSUBs == 0); + for (v = 1; v <= c->relation()->global_decls()->length(); v++) + if ((col = c->find_column((*c->relation()->global_decls())[v]))>0) + try_to_sub(c->problem, col); + + if (check_offset(c, evac_from, evac_to, n_from, n_to, max_arity)) + ret = evac_offset; + else if (check_subseq(c, evac_from, evac_to, n_from, n_to, max_arity)) + ret = evac_subseq; + else if (check_offset_subseq(c, evac_from, evac_to, n_from, n_to, max_arity)) + ret = evac_offset_subseq; + else if (check_affine(c, evac_from, evac_to, n_from, n_to, max_arity)) + ret = evac_affine; + + delete c; + } + + if (evac_debug >= 2) { + if ((evac_debug == 2 && ret != evac_trivial && ret != evac_nasty)) { + fprintf(DebugFile, "Studied %s evacuation for conjunct\n", + &evac_from == &input_vars ? "In-->Out" : "Out-->In"); + use_ugly_names++; + C->prefix_print(DebugFile); + use_ugly_names--; + } + + fprintf(DebugFile, "Saw evacuation type %s\n", evac_names[ret]); + } + + return ret; +} + + +void study_evacuation(Conjunct *C, which_way dir, int max_arity) { + if (evac_debug > 0) { + assert(max_arity >= 0); + + if (max_arity > 0) + if (dir == in_to_out) { + assert(max_arity <= C->relation()->n_inp()); + if (max_arity <= C->relation()->n_out()) + single_evacs[study(C, input_vars, output_vars, + C->relation()->n_inp(), + C->relation()->n_out(), + max_arity)]++; + } + else { + assert(max_arity <= C->relation()->n_out()); + if (max_arity <= C->relation()->n_inp()) + single_evacs[study(C, output_vars, input_vars, + C->relation()->n_out(), + C->relation()->n_inp(), + max_arity)]++; + } + } +} + +void study_evacuation(Conjunct *C1, Conjunct *C2, int max_arity) { + if (evac_debug > 0) { + assert(max_arity >= 0); + assert(max_arity <= C1->relation()->n_inp()); + assert(C2->relation()->n_out() == C1->relation()->n_inp()); + + if (max_arity > 0) + if (max_arity <= C1->relation()->n_out() && + max_arity <= C2->relation()->n_inp()) { + double_evacs[study(C1, input_vars, output_vars, + C1->relation()->n_inp(), + C1->relation()->n_out(), + max_arity)] + [study(C2, output_vars, input_vars, + C2->relation()->n_out(), + C2->relation()->n_inp(), + max_arity)]++; + } + else if (max_arity <= C1->relation()->n_out()) { + single_evacs[study(C1, input_vars, output_vars, + C1->relation()->n_inp(), + C1->relation()->n_out(), + max_arity)]++; + } + else if (max_arity <= C2->relation()->n_inp()) { + single_evacs[study(C2, output_vars, input_vars, + C2->relation()->n_out(), + C2->relation()->n_inp(), + max_arity)]++; + } + } +} + +class Evac_info_printer { +public: + ~Evac_info_printer(); +}; + +Evac_info_printer::~Evac_info_printer() { + if (evac_debug > 0) { + int i, j; + + fprintf(DebugFile, "\n"); + + fprintf(DebugFile, "SINGLE"); + for (i = 0; i <= evac_nasty; i++) + fprintf(DebugFile, "\t%s", evac_names[i]); + fprintf(DebugFile, "\n"); + + for (i = 0; i <= evac_nasty; i++) + fprintf(DebugFile, "\t%d", single_evacs[i]); + fprintf(DebugFile, "\n\n"); + + + fprintf(DebugFile, "DOUBLE"); + for (i = 0; i <= evac_nasty; i++) + fprintf(DebugFile, "\t%s", evac_names[i]); + fprintf(DebugFile, "\n"); + + for (i = 0; i <= evac_nasty; i++) { + fprintf(DebugFile, "%s\t", evac_names[i]); + for (j = 0; j <= evac_nasty; j++) + fprintf(DebugFile, "%d\t", double_evacs[i][j]); + fprintf(DebugFile, "\n"); + } + } +} + +static Evac_info_printer print_stats_at_exit; + +} // namespace + +#endif diff --git a/omegalib/omega_lib/src/farkas.cc b/omegalib/omega_lib/src/farkas.cc new file mode 100644 index 0000000..1b3ef87 --- /dev/null +++ b/omegalib/omega_lib/src/farkas.cc @@ -0,0 +1,480 @@ +/***************************************************************************** + Copyright (C) 1994-2000 the Omega Project Team + Copyright (C) 2005-2011 Chun Chen + All Rights Reserved. + + Purpose: + convert to dual cone for manipulation. + + Notes: + + History: +*****************************************************************************/ + +#include +#include +#include +#include + +namespace omega { + +static Global_Var_Decl constant_term("constantTerm"); + +// class Constant_Term { +// public: +// Global_Var_Decl *p; + +// Constant_Term(); +// ~Constant_Term(); +// }; + +// namespace { +// Constant_Term constant_term; +// } + +// Constant_Term::Constant_Term() { +// p = new Global_Var_Decl("constantTerm"); +// } + +// Constant_Term::~Constant_Term() { +// delete p; +// } + +// Global_Var_ID coefficient_of_constant_term = constant_term.p; + +Global_Var_ID coefficient_of_constant_term = &constant_term; + +extern int inApproximateMode; + +int farkas_debug = 0; + +coef_t farkasDifficulty; + +//***************************************************************************** +// +// forall x1,..,xn s.t. a10 + a11 x1 + ... + a1n xn >= 0 and +// ... +// am0 + am1 x1 + ... + amn xn >= 0 +// +// b0 + b1 x1 + ... + bn xn >= 0 +// +// iff +// +// exists lambda_0,...,lambda_m >= 0 s.t. +// forall x1,..,xn +// lambda_0 + +// lambda_1 ( a10 + a11 x1 + ... + a1n xn) + +// ... +// lambda_m ( am0 + am1 x1 + ... + amn xn) = +// +// b0 + b1 x1 + ... + bn xn +// +// iff +// +// exists lambda_0,...,lambda_m >= 0 s.t. +// lambda_0 + sum_i ( lambda_i a_i0 ) = b_0 +// for j in 1..n +// sum_i ( a_ij lambda_i ) = b_j +// +// iff +// +// exists lambda0,...,lambda_m s.t. +// lambda1,...,lambda_m >= 0 +// lambda0 >= 0 +// lambda_0 = b_0 - sum_i ( lambda_i a_i0 ) +// for j in 1..n +// sum_i ( a_ij lambda_i ) = b_j +// iff +// +// exists lambda1,...,lambda_m s.t. +// lambda1,...,lambda_m >= 0 +// b_0 - sum_i ( lambda_i a_i0 ) >= 0 +// for j in 1..n +// sum_i ( a_ij lambda_i ) = b_j +// +// a_ij come from relation rel +// +// x_1,...,x_n are input and output variables from rel. +// +// b_0,...,b_m are input and output arrays of coef_vars +// +//***************************************************************************** + + +// Given a Relation/Set R +// Compute A,B,C such that +// Ax+By + C >= 0 is true for all x,y in R +// iff [A,B] : constantTerm=C is in AffineClosure(R) +// Note: constantTerm is a special global variable +// If constantTerm appears in the incoming relation +// then set it's coefficient to be 1 in the result + + +// # For example, given +// R := {[i,j] : 1 <= i <= 10 && 1 <= j <= n}; +// # the farkas closure of R is: +// # ac := approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : +// # 0 <= lambda1,lambda2,lambda3,lambda4 +// # && constantTerm - (-lambda1+ 10 lambda2 - lambda3) >= 0 +// # && i = lambda1-lambda2 +// # && j = lambda3-lambda4 +// # && n = lambda4)}; +// # +// # ac; +// +// {[i,j]: 0 <= n && 0 <= n+constantTerm+i+j +// && 0 <= n+constantTerm+10i+j && 0 <= n+j} +// +// The ConvexCombination of ac is: +//# +//# approximate {[i,j] : exists (lambda1,lambda2,lambda3,lambda4 : +//# 0 <= lambda1,lambda2,lambda3,lambda4 +//# && 1 = lambda2+lambda3 +//# && i = lambda2+10lambda3 +//# && j = lambda2+lambda3+lambda4 +//# && n = lambda1+lambda2+lambda3+lambda4 +//# )}; +// +//{[i,j]: 1 <= i <= 10 && 1 <= j <= n} +// + +static void handleVariable(Relation &farkas, Conjunct * conj, + F_And* and_node, + Map &gMap, + Map &eMap, + Variable_ID v) { + use_ugly_names++; + if (farkas_debug > 1) { + fprintf(DebugFile,"Building equality for %s\n", v->name().c_str()); + } + + EQ_Handle e = and_node->add_EQ(); + + for (GEQ_Iterator g = conj->GEQs(); g.live(); g.next()) + if (gMap(*g) != (Variable_ID) 0) { + coef_t c = (*g).get_coef(v); + if (c != 0) { + e.update_coef(gMap(*g), c); + } + } + + for (EQ_Iterator eq = conj->EQs(); eq.live(); eq.next()) + if (eMap(*eq) != (Variable_ID) 0) { + coef_t c = (*eq).get_coef(v); + if (c != 0) { + e.update_coef(eMap(*eq), c); + } + } + + if ((v)->kind() == Global_Var && + (v)->get_global_var() == coefficient_of_constant_term) + e.update_const(-1); + else + e.update_coef(farkas.get_local(v), -1); + + e.finalize(); + if (farkas_debug > 1) { + fprintf(DebugFile,"Constraint is %s\n", e.print_to_string().c_str()); + } + use_ugly_names--; +} + + +Relation Farkas(NOT_CONST Relation &input_R, Farkas_Type op, bool early_bailout) { + assert(!input_R.is_null()); + int saved_use_ugly_names = use_ugly_names; + + use_ugly_names++; + farkasDifficulty = 0; + + Relation R = consume_and_regurgitate(input_R); + + if (op == Basic_Farkas || op == Decoupled_Farkas) { + R.simplify(2, 4); + R = Approximate(R, false); + } + + Relation result = Relation::False(R); + + if (farkas_debug) { + fprintf(DebugFile,"Computing farka of: [\n"); + R.prefix_print(DebugFile); + } + + Variable_ID_Tuple vars; + for (Variable_ID_Iterator v(*R.global_decls()); v; v++) vars.append(*v); + if (R.is_set()) + for(int i=1; i <= R.n_set(); i++) vars.append(R.set_var(i)); + else { + int i; + for(i=1; i <= R.n_inp(); i++) vars.append(R.input_var(i)); + for(i=1; i <= R.n_out(); i++) vars.append(R.output_var(i)); + } + + Set empty; + Variable_ID_Tuple owners; + Map > connectedVariables(empty); + + if (op == Decoupled_Farkas) { + for (Variable_ID_Iterator v(*R.global_decls()); v; v++) + if ((*v)->kind() == Global_Var) { + Global_Var_ID g = (*v)->get_global_var(); + if (g->arity() > 0) { + if (R.is_set()) + for(int i=1; i <= g->arity(); i++) + (*v)->UF_union(R.set_var(i)); + else if ((*v)->function_of() == Input_Tuple) + for(int i=1; i <= g->arity(); i++) + (*v)->UF_union(R.input_var(i)); + else + for(int i=1; i <= g->arity(); i++) + (*v)->UF_union(R.output_var(i)); + } + } + + for (DNF_Iterator s(R.query_DNF()); s.live(); s.next()) { + for (Variable_ID_Iterator v1(*(*s)->variables()); v1; v1++) { + for (EQ_Iterator eq = (*s)->EQs(); eq.live(); eq.next()) + if ((*eq).get_coef(*v1)) + for (Variable_ID_Iterator v2(*(*s)->variables()); v2; v2++) + if ((*eq).get_coef(*v2)) + (*v1)->UF_union(*v2); + for (GEQ_Iterator g = (*s)->GEQs(); g.live(); g.next()) + if ((*g).get_coef(*v1)) + for (Variable_ID_Iterator v2(*(*s)->variables()); v2; v2++) + if ((*g).get_coef(*v2)) + (*v1)->UF_union(*v2); + } + } + for (Variable_ID_Iterator v3(vars); v3.live(); v3.next()) + connectedVariables[(*v3)->UF_owner()] |= *v3; + + foreach_map(v,Variable_ID,s,Set,connectedVariables, + owners.append(v); + if (farkas_debug) { + fprintf(DebugFile,"%s:",v->char_name()); + foreach(v2,Variable_ID,s, + fprintf(DebugFile," %s",v2->char_name()); + ); + fprintf(DebugFile,"\n"); + } + ); + } + + Variable_ID_Iterator varGroup(owners); + int lambda_cnt = 1; + + Relation partialResult; + bool firstGroup = true; + try { + while ((op == Decoupled_Farkas && varGroup.live()) + || (op != Decoupled_Farkas && firstGroup)) { + + if (farkas_debug && op == Decoupled_Farkas) { + fprintf(DebugFile,"[Computing decoupled farkas for:"); + foreach(v2,Variable_ID,connectedVariables(varGroup.curr()), + fprintf(DebugFile," %s",v2->char_name()); + ); + fprintf(DebugFile,"\n"); + } + firstGroup = false; + partialResult = Relation::True(R); + coef_t difficulty = 0; + for (DNF_Iterator s(R.query_DNF()); s.live(); s.next()) { + int nz; + coef_t m,sum; + (*s)->difficulty(nz,m,sum); + difficulty = max((coef_t) nz,2*nz+2*m+sum); + if (farkas_debug) { + fprintf(DebugFile,"Computing farka of conjunct: \n"); + (*s)->prefix_print(DebugFile); + fprintf(DebugFile,"Difficulty is " coef_fmt "(%d," coef_fmt "," coef_fmt ")\n", difficulty,nz,m,sum); + } + if (early_bailout && difficulty >= 500) { + farkasDifficulty = difficulty; + if (farkas_debug) { + fprintf(DebugFile,"Too ugly, returning dull result\n"); + } + use_ugly_names--; + if (op == Basic_Farkas || op == Decoupled_Farkas) + return Relation::False(partialResult); + else return Relation::True(partialResult); + } + Relation farkas = Relation::Empty(R); + farkas.copy_names(R); + F_Exists* exist = farkas.add_exists(); + F_And* and_node = exist->add_and(); + Map gMap((Variable_ID)0); + Map eMap((Variable_ID)0); + for (EQ_Iterator eq = (*s)->EQs(); eq.live(); eq.next()) { + if (op == Decoupled_Farkas) { + bool ShouldConsider = true; + for (Variable_ID_Iterator v(*(*s)->variables()); v; v++) { + if ((*eq).get_coef(*v) != 0 + && (*v)->UF_owner() != varGroup.curr()) { + ShouldConsider = false; + break; + } + } + if (!ShouldConsider) continue; + } + char s[10]; + sprintf(s, "lambda%d", lambda_cnt++); + eMap[*eq] = exist->declare(s); + assert(op == Basic_Farkas || op == Decoupled_Farkas + || (*eq).get_const() == 0); + } + for (GEQ_Iterator g = (*s)->GEQs(); g.live(); g.next()) { + if (op == Decoupled_Farkas) { + bool ShouldConsider = true; + for (Variable_ID_Iterator v(*(*s)->variables()); v; v++) { + if ((*g).get_coef(*v) != 0 + && (*v)->UF_owner() != varGroup.curr()) { + ShouldConsider = false; + break; + } + } + if (!ShouldConsider) continue; + } + char s[10]; + sprintf(s, "lambda%d", lambda_cnt++); + Variable_ID lambda = exist->declare(s); + GEQ_Handle positive; + switch(op) { + case Positive_Combination_Farkas: + case Convex_Combination_Farkas: + case Basic_Farkas: + case Decoupled_Farkas: + positive = and_node->add_GEQ(); + positive.update_coef(lambda, 1); + positive.finalize(); + break; + case Linear_Combination_Farkas: + case Affine_Combination_Farkas: + break; + } + gMap[*g] = lambda; + assert(op == Basic_Farkas || op == Decoupled_Farkas || (*g).get_const() == 0); + } + + for (Variable_ID_Iterator v(vars); v; v++) { + assert((*v)->kind() != Wildcard_Var); + if ((*v)->kind() == Global_Var + && (*v)->get_global_var() == coefficient_of_constant_term) { + assert(op != Basic_Farkas && op != Decoupled_Farkas); + if (op == Linear_Combination_Farkas) continue; + if (op == Positive_Combination_Farkas) continue; + } + if (op == Decoupled_Farkas && (*v)->UF_owner() != varGroup.curr()) { + EQ_Handle e = and_node->add_EQ(); + e.update_coef(farkas.get_local(*v),-1); + continue; + } + handleVariable(farkas, *s, and_node, gMap,eMap, *v); + } + + if (op == Basic_Farkas || op == Decoupled_Farkas) { + GEQ_Handle e = and_node->add_GEQ(); + e.update_coef(farkas.get_local(coefficient_of_constant_term),1); + for (GEQ_Iterator g = s.curr()->GEQs(); g.live(); g.next()) + if (gMap(*g) != (Variable_ID) 0) + e.update_coef( gMap(*g),-(*g).get_const()); + for (EQ_Iterator eq = s.curr()->EQs(); eq.live(); eq.next()) + if (eMap(*eq) != (Variable_ID) 0) + e.update_coef(eMap(*eq),-(*eq).get_const()); + e.finalize(); + } + + // lambda variables are not integers, so disable integer problem solving, + // we just mark it as simplified. + farkas.simplify(-1, -1); + + farkas.single_conjunct()->difficulty(nz,m,sum); + difficulty = max((coef_t) nz,2*nz+2*m+sum); + if (farkas_debug) { + fprintf(DebugFile,"farka has difficulty " coef_fmt "(%d," coef_fmt "," coef_fmt "):\n", difficulty,nz,m,sum); + farkas.prefix_print(DebugFile); + } + if (early_bailout && difficulty >= 500) { + farkasDifficulty = difficulty; + if (farkas_debug) { + fprintf(DebugFile,"Too ugly, returning dull result\n"); + } + use_ugly_names--; + if (op == Basic_Farkas || op == Decoupled_Farkas) + return Relation::False(partialResult); + else return Relation::True(partialResult); + } + farkas = Approximate(farkas); + if (farkas_debug) { + fprintf(DebugFile,"simplified:\n"); + farkas.prefix_print(DebugFile); + } + partialResult = Approximate(Intersection(partialResult,farkas)); + if (farkas_debug) { + fprintf(DebugFile,"combined:\n"); + partialResult.prefix_print(DebugFile); + } + if (partialResult.has_single_conjunct()) { + partialResult.single_conjunct()->difficulty(nz,m,sum); + difficulty = max((coef_t) nz,2*nz+2*m+sum); + } + else + difficulty = 1000; + if (early_bailout && difficulty >= 500) { + farkasDifficulty = difficulty; + if (farkas_debug) { + fprintf(DebugFile,"Too ugly, returning dull result\n"); + } + use_ugly_names--; + if (op == Basic_Farkas || op == Decoupled_Farkas) + return Relation::False(partialResult); + else return Relation::True(partialResult); + } + } + farkasDifficulty += difficulty; + + if (farkas_debug) { + fprintf(DebugFile,"] done computing farkas\n"); + partialResult.prefix_print(DebugFile); + } + + if (op == Decoupled_Farkas) { + result = Union(result,partialResult); + varGroup.next(); + } + } + } + catch (const std::overflow_error &e) { + // clear global variables + inApproximateMode = 0; + use_ugly_names = saved_use_ugly_names; + + if (early_bailout) { + if (farkasDifficulty < 1000) + farkasDifficulty = 1000; + // return dull result + if (op == Basic_Farkas || op == Decoupled_Farkas) + return Relation::False(partialResult); + else + return Relation::True(partialResult); + } + else + throw std::overflow_error("farkas too ugly"); + } + + if (1 || op == Decoupled_Farkas) { + foreach(v,Variable_ID,vars, reset_remap_field(v)); + } + use_ugly_names--; + if (op == Decoupled_Farkas) { + if (farkas_debug) { + fprintf(DebugFile,"] decoupled result:\n"); + result.prefix_print(DebugFile); + } + return result; + } + return partialResult; +} + +} // namespace diff --git a/omegalib/omega_lib/src/hull.cc b/omegalib/omega_lib/src/hull.cc new file mode 100644 index 0000000..f1b0601 --- /dev/null +++ b/omegalib/omega_lib/src/hull.cc @@ -0,0 +1,1489 @@ +/***************************************************************************** + Copyright (C) 1994-2000 University of Maryland + Copyright (C) 2008 University of Southern California + Copyright (C) 2009-2010 University of Utah + All Rights Reserved. + + Purpose: + Various hull calculations. + + Notes: + + History: + 06/15/09 ConvexRepresentation, Chun Chen + 11/25/09 RectHull, Chun Chen +*****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace omega { + +int hull_debug = 0; + +Relation ConvexHull(NOT_CONST Relation &R) { + Relation S = Approximate(consume_and_regurgitate(R)); + if (!S.is_upper_bound_satisfiable()) + return S; + if (S.has_single_conjunct()) + return S; + return Farkas(Farkas(S,Basic_Farkas), Convex_Combination_Farkas); +} + +Relation DecoupledConvexHull(NOT_CONST Relation &R) { + Relation S = Approximate(consume_and_regurgitate(R)); + if (!S.is_upper_bound_satisfiable()) + return S; + if (S.has_single_conjunct()) + return S; + return Farkas(Farkas(S,Decoupled_Farkas), Convex_Combination_Farkas); +} + +Relation AffineHull(NOT_CONST Relation &R) { + Relation S = Approximate(consume_and_regurgitate(R)); + if (!S.is_upper_bound_satisfiable()) + return S; + return Farkas(Farkas(S,Basic_Farkas), Affine_Combination_Farkas); +} + +Relation LinearHull(NOT_CONST Relation &R) { + Relation S = Approximate(consume_and_regurgitate(R)); + if (!S.is_upper_bound_satisfiable()) + return S; + return Farkas(Farkas(S,Basic_Farkas), Linear_Combination_Farkas); +} + +Relation ConicHull(NOT_CONST Relation &R) { + Relation S = Approximate(consume_and_regurgitate(R)); + if (!S.is_upper_bound_satisfiable()) + return S; + return Farkas(Farkas(S,Basic_Farkas), Positive_Combination_Farkas); +} + + +Relation FastTightHull(NOT_CONST Relation &input_R, NOT_CONST Relation &input_H) { + Relation R = Approximate(consume_and_regurgitate(input_R)); + Relation H = Approximate(consume_and_regurgitate(input_H)); + + if (hull_debug) { + fprintf(DebugFile,"[ Computing FastTightHull of:\n"); + R.prefix_print(DebugFile); + fprintf(DebugFile,"given known hull of:\n"); + H.prefix_print(DebugFile); + } + + if (!H.has_single_conjunct()) { + if (hull_debug) + fprintf(DebugFile, "] bailing out of FastTightHull, known hull not convex\n"); + return H; + } + + if (!H.is_obvious_tautology()) { + R = Gist(R,copy(H)); + R.simplify(1,0); + } + + if (R.has_single_conjunct()) { + R = Intersection(R,H); + if (hull_debug) { + fprintf(DebugFile, "] quick easy answer to FastTightHull\n"); + R.prefix_print(DebugFile); + } + return R; + } + if (R.has_local(coefficient_of_constant_term)) { + if (hull_debug) { + fprintf(DebugFile, "] Can't handle recursive application of Farkas lemma\n"); + } + return H; + } + + if (hull_debug) { + fprintf(DebugFile,"Gist of R given H is:\n"); + R.prefix_print(DebugFile); + } + + if (1) { + Set vars; + int conjuncts = 0; + for (DNF_Iterator s(R.query_DNF()); s.live(); s.next()) { + conjuncts++; + for (Variable_ID_Iterator v(*((*s)->variables())); v.live(); v++) { + bool found = false; + for (EQ_Iterator eq = (*s)->EQs(); eq.live(); eq.next()) + if ((*eq).get_coef(*v) != 0) { + if (!found) vars.insert(*v); + found = true; + break; + } + if (!found) + for (GEQ_Iterator geq = (*s)->GEQs(); geq.live(); geq.next()) + if ((*geq).get_coef(*v) != 0) { + if (!found) vars.insert(*v); + found = true; + break; + } + } + } + + + // We now know which variables appear in R + if (hull_debug) { + fprintf(DebugFile,"Variables we need a better hull on are: "); + foreach(v,Variable_ID,vars, + fprintf(DebugFile," %s",v->char_name())); + fprintf(DebugFile,"\n"); + } + Conjunct *c = H.single_conjunct(); + int total=0; + int copied = 0; + for (EQ_Iterator eq = c->EQs(); eq.live(); eq.next()) { + total++; + foreach(v,Variable_ID,vars, + if ((*eq).get_coef(v) != 0) { + R.and_with_EQ(*eq); + copied++; + break; // out of variable loop + } + ); + } + for (GEQ_Iterator geq = c->GEQs(); geq.live(); geq.next()) { + total++; + foreach(v,Variable_ID,vars, + if ((*geq).get_coef(v) != 0) { + R.and_with_GEQ(*geq); + copied++; + break; // out of variable loop + } + ); + } + if (copied < total) { + R = Approximate(R); + + if (hull_debug) { + fprintf(DebugFile,"Decomposed relation, copied only %d of %d constraints\n",copied,total); + fprintf(DebugFile,"Original R:\n"); + R.prefix_print(DebugFile); + fprintf(DebugFile,"Known hull:\n"); + H.prefix_print(DebugFile); + fprintf(DebugFile,"New R:\n"); + R.prefix_print(DebugFile); + } + } + } + + Relation F = Farkas(copy(R), Basic_Farkas, true); + if (hull_debug) + fprintf(DebugFile,"Farkas Difficulty = " coef_fmt "\n", farkasDifficulty); + if (farkasDifficulty > 260) { + if (hull_debug) { + fprintf(DebugFile, "] bailing out, farkas is way too complex\n"); + fprintf(DebugFile,"Farkas:\n"); + F.prefix_print(DebugFile); + } + return H; + } + else if (farkasDifficulty > 130) { + // Bail out + if (hull_debug) { + fprintf(DebugFile, coef_fmt " non-zeros in original farkas\n", farkasDifficulty); + } + Relation tmp = Farkas(R, Decoupled_Farkas, true); + + if (hull_debug) { + fprintf(DebugFile, coef_fmt " non-zeros in decoupled farkas\n", farkasDifficulty); + } + if (farkasDifficulty > 260) { + if (hull_debug) { + fprintf(DebugFile, "] bailing out, farkas is way too complex\n"); + fprintf(DebugFile,"Farkas:\n"); + F.prefix_print(DebugFile); + } + return H; + } + else { + if (farkasDifficulty > 130) + R = Intersection(H, Farkas(tmp, Affine_Combination_Farkas, true)); + else R = Intersection(H, + Intersection(Farkas(tmp, Convex_Combination_Farkas, true), + Farkas(F, Affine_Combination_Farkas, true))); + if (hull_debug) { + fprintf(DebugFile, "] bailing out, farkas is too complex, using affine hull\n"); + fprintf(DebugFile,"Farkas:\n"); + F.prefix_print(DebugFile); + fprintf(DebugFile,"Affine hull:\n"); + R.prefix_print(DebugFile); + } + return R; + } + } + + R = Intersection(H, Farkas(F, Convex_Combination_Farkas, true)); + if (hull_debug) { + fprintf(DebugFile, "] Result of FastTightHull:\n"); + R.prefix_print(DebugFile); + } + return R; +} + + + +namespace { + bool parallel(const GEQ_Handle &g1, const GEQ_Handle &g2) { + for(Constr_Vars_Iter cvi(g1, false); cvi; cvi++) { + coef_t c1 = (*cvi).coef; + coef_t c2 = g2.get_coef((*cvi).var); + if (c1 != c2) return false; + } + { + for(Constr_Vars_Iter cvi(g2, false); cvi; cvi++) { + coef_t c1 = g1.get_coef((*cvi).var); + coef_t c2 = (*cvi).coef; + if (c1 != c2) return false; + } + } + return true; + } + + + bool hull(const EQ_Handle &e, const GEQ_Handle &g, coef_t &hull) { + int sign = 0; + for(Constr_Vars_Iter cvi(e, false); cvi; cvi++) { + coef_t c1 = (*cvi).coef; + coef_t c2 = g.get_coef((*cvi).var); + if (sign == 0) sign = (c1*c2>=0?1:-1); + if (sign*c1 != c2) return false; + } + assert(sign != 0); + { + for(Constr_Vars_Iter cvi(g, false); cvi; cvi++) { + coef_t c1 = e.get_coef((*cvi).var); + coef_t c2 = (*cvi).coef; + if (sign*c1 != c2) return false; + } + } + hull = max(sign * e.get_const(), g.get_const()); + if (hull_debug) { + fprintf(DebugFile,"Hull of:\n %s\n", e.print_to_string().c_str()); + fprintf(DebugFile," %s\n", g.print_to_string().c_str()); + fprintf(DebugFile,"is " coef_fmt "\n\n",hull); + } + return true; + } + + bool eq(const EQ_Handle &e1, const EQ_Handle &e2) { + int sign = 0; + for(Constr_Vars_Iter cvi(e1, false); cvi; cvi++) { + coef_t c1 = (*cvi).coef; + coef_t c2 = e2.get_coef((*cvi).var); + if (sign == 0) sign = (c1*c2>=0?1:-1); + if (sign*c1 != c2) return false; + } + assert(sign != 0); + { + for(Constr_Vars_Iter cvi(e2, false); cvi; cvi++) { + coef_t c1 = e1.get_coef((*cvi).var); + coef_t c2 = (*cvi).coef; + if (sign*c1 != c2) return false; + } + } + return sign * e1.get_const() == e2.get_const(); + } +} + + +// This function is deprecated!!! +Relation QuickHull(Relation &R) { + Tuple Rs(1); + Rs[1] = R; + return QuickHull(Rs); +} + + +// This function is deprecated!!! +Relation QuickHull(Tuple &Rs) { + assert(!Rs.empty()); + + // if (Rs.size() == 1) return Rs[1]; + + Tuple l_Rs; + for (int i = 1; i <= Rs.size(); i++) + for (DNF_Iterator c(Rs[i].query_DNF()); c; c++) { + Relation r = Relation(Rs[i], c.curr()); + l_Rs.append(Approximate(r)); + } + + if (l_Rs.size() == 1) + return l_Rs[1]; + + Relation result = Relation::True(Rs[1]); + result.copy_names(Rs[1]); + + use_ugly_names++; + + if (hull_debug > 1) + for (int i = 1; i <= l_Rs.size(); i++) { + fprintf(DebugFile,"#%d \n",i); + l_Rs[i].prefix_print(DebugFile); + } + + +// Relation R = copy(Rs[1]); +// for (int i = 2; i <= Rs.size(); i++) +// R = Union(R,copy(Rs[i])); + +// #if 0 +// if (!R.is_set()) { +// if (R.n_inp() == R.n_out()) { +// Relation AC = DeltasToRelation(Hull(Deltas(copy(R), +// min(R.n_inp(),R.n_out()))), +// R.n_inp(),R.n_out()); +// Relation dH = Hull(Domain(copy(R)),false); +// Relation rH = Hull(Range(copy(R)),false); +// result = Intersection(AC,Cross_Product(dH,rH)); +// } +// else { +// Relation dH = Hull(Domain(copy(R)),false); +// Relation rH = Hull(Range(copy(R)),false); +// result = Cross_Product(dH,rH); +// assert(Must_Be_Subset(copy(R),copy(result))); +// } +// } + +// #endif + + Conjunct *first; + l_Rs[1] = EQs_to_GEQs(l_Rs[1]); + first = l_Rs[1].single_conjunct(); + for (GEQ_Iterator candidate(first->GEQs()); candidate.live(); candidate.next()) { + coef_t maxConstantTerm = (*candidate).get_const(); + bool found = true; + if (hull_debug > 1) { + fprintf(DebugFile,"searching for bound on:\n %s\n", (*candidate).print_to_string().c_str()); + } + for (int i = 2; i <= l_Rs.size(); i++) { + Conjunct *other = l_Rs[i].single_conjunct(); + bool found_for_i = false; + for (GEQ_Iterator target(other->GEQs()); target.live(); target.next()) { + if (hull_debug > 2) { + fprintf(DebugFile,"candidate:\n %s\n", (*candidate).print_to_string().c_str()); + fprintf(DebugFile,"target:\n %s\n", (*target).print_to_string().c_str()); + } + if (parallel(*candidate,*target)) { + if (hull_debug > 1) + fprintf(DebugFile,"Found bound:\n %s\n", (*target).print_to_string().c_str()); + maxConstantTerm = max(maxConstantTerm,(*target).get_const()); + found_for_i = true; + break; + } + } + if (!found_for_i) { + for (EQ_Iterator target_e(other->EQs()); target_e.live(); target_e.next()) { + coef_t h; + if (hull(*target_e,*candidate,h)) { + if (hull_debug > 1) + fprintf(DebugFile,"Found bound of " coef_fmt ":\n %s\n", h, (*target_e).print_to_string().c_str()); + maxConstantTerm = max(maxConstantTerm,h); + found_for_i = true; + break; + } + }; + if (!found_for_i) { + if (hull_debug > 1) { + fprintf(DebugFile,"No bound found in:\n"); + fprintf(DebugFile, "%s", l_Rs[i].print_with_subs_to_string().c_str()); + } + //if nothing found + found = false; + break; + } + } + } + + if (found) { + GEQ_Handle h = result.and_with_GEQ(); + copy_constraint(h,*candidate); + if (hull_debug > 1) + fprintf(DebugFile,"Setting constant term to " coef_fmt " in\n %s\n", maxConstantTerm, h.print_to_string().c_str()); + h.update_const(maxConstantTerm - (*candidate).get_const()); + if (hull_debug > 1) + fprintf(DebugFile,"Updated constraint is\n %s\n", h.print_to_string().c_str()); + } + } + + + for (EQ_Iterator candidate_eq(first->EQs()); candidate_eq.live(); candidate_eq.next()) { + bool found = true; + for (int i = 2; i <= l_Rs.size(); i++) { + Conjunct *C = l_Rs[i].single_conjunct(); + bool found_for_i = false; + + for (EQ_Iterator target(C->EQs()); target.live(); target.next()) { + if (eq(*candidate_eq,*target)) { + found_for_i = true; + break; + } + } + if (!found_for_i) { + //if nothing found + found = false; + break; + } + } + + if (found) { + EQ_Handle h = result.and_with_EQ(); + copy_constraint(h,*candidate_eq); + if (hull_debug > 1) + fprintf(DebugFile,"Adding eq constraint: %s\n", h.print_to_string().c_str()); + } + } + + use_ugly_names--; + if (hull_debug > 1) { + fprintf(DebugFile,"quick hull is of:"); + result.print_with_subs(DebugFile); + } + return result; +} + + +// Relation Hull2(Tuple &Rs, Tuple &active) { +// assert(Rs.size() == active.size() && Rs.size() > 0); + +// Tuple l_Rs; +// for (int i = 1; i <= Rs.size(); i++) +// if (active[i]) +// l_Rs.append(copy(Rs[i])); + +// if (l_Rs.size() == 0) +// return Relation::False(Rs[1]); + +// try { +// Relation r = l_Rs[1]; +// for (int i = 2; i <= l_Rs.size(); i++) { +// r = Union(r, copy(l_Rs[i])); +// r.simplify(); +// } + +// // Relation F = Farkas(r, Basic_Farkas, true); +// // if (farkasDifficulty >= 500) +// // throw std::overflow_error("loop convex hull too complicated."); +// // F = Farkas(F, Convex_Combination_Farkas, true); +// return Farkas(Farkas(r, Basic_Farkas, true), Convex_Combination_Farkas, true); +// } +// catch (std::overflow_error) { +// return QuickHull(l_Rs); +// } +// } + + +namespace { + void printRs(Tuple &Rs) { + fprintf(DebugFile,"Rs:\n"); + for (int i = 1; i <= Rs.size(); i++) + fprintf(DebugFile,"#%d : %s\n",i, + Rs[i].print_with_subs_to_string().c_str()); + } +} + +Relation BetterHull(Tuple &Rs, bool stridesAllowed, bool checkSubsets, + NOT_CONST Relation &input_knownHull = Relation::Null()) { + Relation knownHull = consume_and_regurgitate(input_knownHull); + static int OMEGA_WHINGE = -1; + if (OMEGA_WHINGE < 0) { + OMEGA_WHINGE = getenv("OMEGA_WHINGE") ? atoi(getenv("OMEGA_WHINGE")) : 0; + } + assert(!Rs.empty()); + if (Rs.size() == 1) { + if (stridesAllowed) return Rs[1]; + else return Approximate(Rs[1]); + } + + if (checkSubsets) { + Tuple live(Rs.size()); + if (hull_debug) { + fprintf(DebugFile,"Checking subsets in hull computation:\n"); + printRs(Rs); + } + int i; + for(i=1;i <=Rs.size(); i++) live[i] = true; + for(i=1;i <=Rs.size(); i++) + for(int j=1;j <=Rs.size(); j++) if (i != j && live[j]) { + if (hull_debug) fprintf(DebugFile,"checking %d Is_Obvious_Subset %d\n",i,j); + if (Is_Obvious_Subset(copy(Rs[i]),copy(Rs[j]))) { + if (hull_debug) fprintf(DebugFile,"yes...\n"); + live[i] = false; + break; + } + } + for(i=1;i <=Rs.size(); i++) if (!live[i]) { + if (i < Rs.size()) { + Rs[i] = Rs[Rs.size()]; + live[i] = live[Rs.size()]; + } + Rs[Rs.size()] = Relation(); + Rs.delete_last(); + i--; + } + } + Relation hull; + if (hull_debug) { + fprintf(DebugFile,"Better Hull:\n"); + printRs(Rs); + fprintf(DebugFile,"known hull: %s\n", knownHull.print_with_subs_to_string().c_str()); + } + if (knownHull.is_null()) hull = QuickHull(Rs); + else hull = Intersection(QuickHull(Rs),knownHull); + // for (int i = 1; i <= Rs.size(); i++) + // hull = RectHull(Union(hull, copy(Rs[i]))); + // hull = Intersection(hull, knownHull); + hull.simplify(); + if (hull_debug) { + fprintf(DebugFile,"quick hull: %s\n", hull.print_with_subs_to_string().c_str()); + } + + Relation orig = Relation::False(Rs[1]); + int i; + for (i = 1; i <= Rs.size(); i++) + orig = Union(orig,copy(Rs[i])); + + orig.simplify(); + + for (i = 1; i <= Rs.size(); i++) { + if (!hull.is_obvious_tautology()) Rs[i] = Gist(Rs[i],copy(hull)); + Rs[i].simplify(); + if (Rs[i].is_obvious_tautology()) return hull; + if (Rs[i].has_single_conjunct()) { + Rs[i] = EQs_to_GEQs(Rs[i]); + if (hull_debug) { + fprintf(DebugFile,"Checking for hull constraints in:\n %s\n", Rs[i].print_with_subs_to_string().c_str()); + } + Conjunct *c = Rs[i].single_conjunct(); + for (GEQ_Iterator g(c->GEQs()); g.live(); g.next()) { + Relation tmp = Relation::True(Rs[i]); + tmp.and_with_GEQ(*g); + if (!Difference(copy(orig),tmp).is_upper_bound_satisfiable()) + hull.and_with_GEQ(*g); + } + for (EQ_Iterator e(c->EQs()); e.live(); e.next()) { + Relation tmp = Relation::True(Rs[i]); + tmp.and_with_EQ(*e); + if (!Difference(copy(orig),tmp).is_upper_bound_satisfiable()) + hull.and_with_EQ(*e); + } + } + } + + hull = FastTightHull(orig,hull); + assert(hull.has_single_conjunct()); + + if (stridesAllowed) return hull; + else return Approximate(hull); + +} + + + +Relation Hull(NOT_CONST Relation &S, + bool stridesAllowed, + int effort, + NOT_CONST Relation &knownHull) { + Relation R = consume_and_regurgitate(S); + R.simplify(1,0); + if (!R.is_upper_bound_satisfiable()) return R; + Tuple Rs; + for (DNF_Iterator c(R.query_DNF()); c.live(); ) { + Rs.append(Relation(R,c.curr())); + c.next(); + } + if (effort == 1) + return BetterHull(Rs,stridesAllowed,false,knownHull); + else + return QuickHull(Rs); +} + + + +Relation Hull(Tuple &Rs, + Tuple &validMask, + int effort, + bool stridesAllowed, + NOT_CONST Relation &knownHull) { + // Use relation of index i only when validMask[i] != 0 + Tuple Rs2; + for(int i = 1; i <= Rs.size(); i++) { + if (validMask[i]) { + Rs[i].simplify(); + for (DNF_Iterator c(Rs[i].query_DNF()); c.live(); ) { + Rs2.append(Relation(Rs[i],c.curr())); + c.next(); + } + } + } + assert(effort == 0 || effort == 1); + if (effort == 1) + return BetterHull(Rs2,stridesAllowed,true,knownHull); + else + return QuickHull(Rs2); +} + + +// This function is deprecated!!! +Relation CheckForConvexRepresentation(NOT_CONST Relation &R_In) { + Relation R = consume_and_regurgitate(R_In); + Relation h = Hull(copy(R)); + if (!Difference(copy(h),copy(R)).is_upper_bound_satisfiable()) + return h; + else + return R; +} + +// This function is deprecated!!! +Relation CheckForConvexPairs(NOT_CONST Relation &S) { + Relation R = consume_and_regurgitate(S); + Relation hull = FastTightHull(copy(R),Relation::True(R)); + R.simplify(1,0); + if (!R.is_upper_bound_satisfiable() || R.number_of_conjuncts() < 2) return R; + Tuple Rs; + for (DNF_Iterator c(R.query_DNF()); c.live(); ) { + Rs.append(Relation(R,c.curr())); + c.next(); + } + + bool *dead = new bool[Rs.size()+1]; + int i; + for(i = 1; i<=Rs.size();i++) dead[i] = false; + + for(i = 1; i<=Rs.size();i++) + if (!dead[i]) + for(int j = i+1; j<=Rs.size();j++) if (!dead[j]) { + if (hull_debug) { + fprintf(DebugFile,"Comparing #%d and %d\n",i,j); + } + Relation U = Union(copy(Rs[i]),copy(Rs[j])); + Relation H_ij = FastTightHull(copy(U),copy(hull)); + if (!Difference(copy(H_ij),U).is_upper_bound_satisfiable()) { + Rs[i] = H_ij; + dead[j] = true; + if (hull_debug) { + fprintf(DebugFile,"Combined them\n"); + } + } + } + i = 1; + while(i<=Rs.size() && dead[i]) i++; + assert(i<=Rs.size()); + R = Rs[i]; + i++; + for(; i<=Rs.size();i++) + if (!dead[i]) + R = Union(R,Rs[i]); + delete []dead; + return R; +} + +// +// Supporting functions for ConvexRepresentation +// +namespace { +struct Interval { + std::list >::iterator pos; + coef_t lb; + coef_t ub; + bool change; + coef_t modulo; + Interval(std::list >::iterator pos_, coef_t lb_, coef_t ub_): + pos(pos_), lb(lb_), ub(ub_) {} + friend bool operator<(const Interval &a, const Interval &b); +}; + +bool operator<(const Interval &a, const Interval &b) { + return a.lb < b.lb; +} + +struct Modulo_Interval { + coef_t modulo; + coef_t start; + coef_t size; + Modulo_Interval(coef_t modulo_, coef_t start_, coef_t size_): + modulo(modulo_), start(start_), size(size_) {} + friend bool operator<(const Interval &a, const Interval &b); +}; + +bool operator<(const Modulo_Interval &a, const Modulo_Interval &b) { + if (a.modulo == b.modulo) { + if (a.start == b.start) + return a.size < b.size; + else + return a.start < b.start; + } + else + return a.modulo < b.modulo; +} + +void merge_intervals(std::list &intervals, coef_t modulo, std::list > &Rs, std::list >::iterator orig) { + // normalize intervals + for (std::list::iterator i = intervals.begin(); i != intervals.end(); i++) { + (*i).modulo = modulo; + (*i).change = false; + if ((*i).ub - (*i).lb + 1>= modulo) { + (*i).lb = 0; + (*i).ub = modulo - 1; + } + else if ((*i).ub < 0 || (*i).lb >= modulo) { + coef_t range = (*i).ub - (*i).lb; + (*i).lb = int_mod((*i).lb, modulo); + (*i).ub = (*i).lb + range; + } + } + + intervals.sort(); + + // merge neighboring intervals + std::list::iterator p = intervals.begin(); + while (p != intervals.end()) { + std::list::iterator q = p; + q++; + while (q != intervals.end()) { + if ((*p).ub + 1 >= (*q).lb) { + Relation hull = ConvexHull(Union(copy((*(*p).pos).first), copy((*(*q).pos).first))); + Relation remainder = Difference(Difference(copy(hull), copy((*(*p).pos).first)), copy((*(*q).pos).first)); + if (!remainder.is_upper_bound_satisfiable()) { + if ((*q).pos == orig) + std::swap((*p).pos, (*q).pos); + (*(*p).pos).first = hull; + (*p).ub = max((*p).ub, (*q).ub); + (*p).change = true; + Rs.erase((*q).pos); + q = intervals.erase(q); + } + else + break; + } + else + break; + } + + bool p_moved = false; + q = p; + q++; + while (q != intervals.end()) { + if ((*q).ub >= modulo && int_mod((*q).ub, modulo) + 1 >= (*p).lb) { + Relation hull = ConvexHull(Union(copy((*(*p).pos).first), copy((*(*q).pos).first))); + Relation remainder = Difference(Difference(copy(hull), copy((*(*p).pos).first)), copy((*(*q).pos).first)); + if (!remainder.is_upper_bound_satisfiable()) { + if ((*p).pos == orig) + std::swap((*p).pos, (*q).pos); + (*(*q).pos).first = hull; + coef_t t = (*p).ub - int_mod((*q).ub, modulo); + if (t > 0) + (*q).ub = (*q).ub + t; + (*q).change = true; + Rs.erase((*p).pos); + p = intervals.erase(p); + p_moved = true; + break; + } + else + q++; + } + else + q++; + } + + if (!p_moved) + p++; + } + + // merge by reducing the strengh of modulo + std::list modulo_intervals; + coef_t max_distance = modulo/2; + for (std::list::iterator p = intervals.begin(); p != intervals.end(); p++) { + if ((*p).lb >= max_distance) + break; + + coef_t size = (*p).ub - (*p).lb; + + std::list::iterator q = p; + q++; + while (q != intervals.end()) { + coef_t distance = (*q).lb - (*p).lb; + if (distance > max_distance) + break; + + if ((*q).ub - (*q).lb != size || int_mod(modulo, distance) != 0) { + q++; + continue; + } + + int num_reduced = 0; + coef_t looking_for = int_mod((*p).lb, distance); + for (std::list::iterator k = intervals.begin(); k != intervals.end(); k++) { + if ((*k).lb == looking_for && (*k).ub - (*k).lb == size) { + num_reduced++; + looking_for += distance; + if (looking_for >= modulo) + break; + } + else if ((*k).lb <= looking_for && (*k).ub >= looking_for + size) { + looking_for += distance; + if (looking_for >= modulo) + break; + } + else if ((*k).lb > looking_for) + break; + } + + if (looking_for >= modulo && num_reduced > 1) + modulo_intervals.push_back(Modulo_Interval(distance, int_mod((*p).lb, distance), size)); + + q++; + } + } + + modulo_intervals.sort(); + + // remove redundant reduced-strength intervals + std::list::iterator p2 = modulo_intervals.begin(); + while (p2 != modulo_intervals.end()) { + std::list::iterator q2 = p2; + q2++; + while (q2 != modulo_intervals.end()) { + if ((*p2).modulo == (*q2).modulo && (*p2).start == (*q2).start) + q2 = modulo_intervals.erase(q2); + else if (int_mod((*q2).modulo, (*p2).modulo) == 0 && + (*p2).start == int_mod((*q2).start, (*p2).modulo) && + (*p2).size >= (*q2).size) + q2 = modulo_intervals.erase(q2); + else + q2++; + } + p2++; + } + + // replace original intervals with new reduced-strength ones + for (std::list::iterator i = modulo_intervals.begin(); i != modulo_intervals.end(); i++) { + std::vector candidates; + int num_replaced = 0; + for (std::list::iterator j = intervals.begin(); j != intervals.end(); j++) + if (int_mod((*j).modulo, (*i).modulo) == 0 && + (*j).ub - (*j).lb >= (*i).size && + (int_mod((*j).lb, (*i).modulo) == (*i).start || + int_mod((*j).ub, (*i).modulo) == (*i).start + (*i).size)) { + candidates.push_back(&((*(*j).pos).first)); + if (int_mod((*j).lb, (*i).modulo) == (*i).start && + (*j).ub - (*j).lb == (*i).size) + num_replaced++; + } + if (num_replaced <= 1) + continue; + + Relation R = copy(*candidates[0]); + for (size_t k = 1; k < candidates.size(); k++) + R = Union(R, copy(*candidates[k])); + Relation hull = ConvexHull(copy(R)); + Relation remainder = Difference(copy(hull), copy(R)); + if (!remainder.is_upper_bound_satisfiable()) { + std::list::iterator replaced_one = intervals.end(); + for (std::list::iterator j = intervals.begin(); j != intervals.end();) + if (int_mod((*j).modulo, (*i).modulo) == 0 && + (*j).ub - (*j).lb >= (*i).size && + (int_mod((*j).lb, (*i).modulo) == (*i).start || + int_mod((*j).ub, (*i).modulo) == (*i).start + (*i).size)) { + if (int_mod((*j).lb, (*i).modulo) == (*i).start && + (*j).ub - (*j).lb == (*i).size) { + if (replaced_one == intervals.end()) { + (*(*j).pos).first = hull; + (*j).lb = int_mod((*j).lb, (*i).modulo); + (*j).ub = int_mod((*j).ub, (*i).modulo); + (*j).modulo = (*i).modulo; + (*j).change = true; + replaced_one = j; + j++; + } + else { + if ((*j).pos == orig) { + std::swap((*replaced_one).pos, (*j).pos); + (*(*replaced_one).pos).first = (*(*j).pos).first; + } + Rs.erase((*j).pos); + j = intervals.erase(j); + } + } + else { + if (int_mod((*j).lb, (*i).modulo) == (*i).start) + (*j).lb = (*j).lb + (*i).size + 1; + else + (*j).ub = (*j).ub - (*i).size - 1; + (*j).change = true; + j++; + } + } + else + j++; + } + } +} +} // namespace + + +// +// Simplify a union of sets/relations to a minimal (may not be +// optimal) number of convex regions. It intends to replace +// CheckForConvexRepresentation and CheckForConvexPairs functions. +// +Relation ConvexRepresentation(NOT_CONST Relation &R) { + Relation l_R = copy(R); + if (!l_R.is_upper_bound_satisfiable() || l_R.number_of_conjuncts() < 2) + return R; + + // separate each conjunct into smooth convex region and holes + std::list > Rs; // pair(smooth region, hole condition) + for (DNF_Iterator c(l_R.query_DNF()); c.live(); c++) { + Relation r1 = Relation(l_R, c.curr()); + Relation r2 = Approximate(copy(r1)); + r1 = Gist(r1, copy(r2)); + Rs.push_back(std::make_pair(r2, r1)); + } + + try { + bool change = true; + while (change) { + change = false; + + std::list >::iterator i = Rs.begin(); + while (i != Rs.end()) { + // find regions with identical hole conditions to merge + { + std::list >::iterator j = i; + j++; + while (j != Rs.end()) { + if (!Difference(copy((*i).second), copy((*j).second)).is_upper_bound_satisfiable() && + !Difference(copy((*j).second), copy((*i).second)).is_upper_bound_satisfiable()) { + if (Must_Be_Subset(copy((*j).first), copy((*i).first))) { + j = Rs.erase(j); + } + else if (Must_Be_Subset(copy((*i).first), copy((*j).first))) { + (*i).first = (*j).first; + j = Rs.erase(j); + change = true; + } + else { + Relation r; + bool already_use_recthull = false; + try { + // chun's debug + // throw std::runtime_error("dfdf"); + + r = ConvexHull(Union(copy((*i).first), copy((*j).first))); + } + catch (const std::overflow_error &e) { + r = RectHull(Union(copy((*i).first), copy((*j).first))); + already_use_recthull = true; + } + retry_recthull: + Relation r2 = Difference(Difference(copy(r), copy((*i).first)), copy((*j).first)); + if (!r2.is_upper_bound_satisfiable()) { // convex hull is tight + (*i).first = r; + j = Rs.erase(j); + change = true; + } + else { + if (!already_use_recthull) { + r = RectHull(Union(copy((*i).first), copy((*j).first))); + already_use_recthull = true; + goto retry_recthull; + } + else + j++; + } + } + } + else + j++; + } + } + + // find identical smooth regions as candidates for hole merge + std::list >::iterator> s; + for (std::list >::iterator j = Rs.begin(); j != Rs.end(); j++) + if (j != i) { + if (!Intersection(Difference(copy((*i).first), copy((*j).first)), copy((*j).second)).is_upper_bound_satisfiable() && + !Intersection(Difference(copy((*j).first), copy((*i).first)), copy((*i).second)).is_upper_bound_satisfiable()) + s.push_back(j); + } + + if (s.size() != 0) { + // convert hole condition c1*x1+c2*x2+... = c*alpha+d to a pair of inequalities + (*i).second = EQs_to_GEQs((*i).second, false); + + // find potential wildcards that can be used for hole conditions + std::set nonsingle_wild; + for (EQ_Iterator ei((*i).second.single_conjunct()); ei; ei++) + if ((*ei).has_wildcards()) + for (Constr_Vars_Iter cvi(*ei, true); cvi; cvi++) + nonsingle_wild.insert(cvi.curr_var()); + for (GEQ_Iterator gei((*i).second.single_conjunct()); gei; gei++) + if ((*gei).has_wildcards()) { + Constr_Vars_Iter cvi(*gei, true); + Constr_Vars_Iter cvi2 = cvi; + cvi2++; + if (cvi2) { + nonsingle_wild.insert(cvi.curr_var()); + for (; cvi2; cvi2++) + nonsingle_wild.insert(cvi2.curr_var()); + } + } + + // find hole condition in c*alpha+d1<=c1*x1+c2*x2+...<=c*alpha+d2 format + for (GEQ_Iterator gei((*i).second.single_conjunct()); gei; gei++) + if ((*gei).has_wildcards()) { + coef_t c; + Variable_ID v; + { + Constr_Vars_Iter cvi(*gei, true); + v = cvi.curr_var(); + c = cvi.curr_coef(); + if (c < 0 || nonsingle_wild.find(v) != nonsingle_wild.end()) + continue; + } + + coef_t lb = posInfinity; + for (GEQ_Iterator gei2((*i).second.single_conjunct()); gei2; gei2++) { + if (!(*gei2 == *gei) && (*gei2).get_coef(v) != 0) { + if (lb != posInfinity) { + nonsingle_wild.insert(v); + break; + } + + bool match = true; + for (Constr_Vars_Iter cvi2(*gei); cvi2; cvi2++) + if (cvi2.curr_coef() != -((*gei2).get_coef(cvi2.curr_var()))) { + match = false; + break; + } + if (match) + for (Constr_Vars_Iter cvi2(*gei2); cvi2; cvi2++) + if (cvi2.curr_coef() != -((*gei).get_coef(cvi2.curr_var()))) { + match = false; + break; + } + if (!match) { + nonsingle_wild.insert(v); + break; + } + + lb = -(*gei2).get_const(); + } + } + + if (nonsingle_wild.find(v) != nonsingle_wild.end()) + continue; + + Relation stride_cond = Relation::True((*i).second); + F_Exists *f_exists = stride_cond.and_with_and()->add_exists(); + Variable_ID e = f_exists->declare(); + F_And *f_root = f_exists->add_and(); + GEQ_Handle h1 = f_root->add_GEQ(); + GEQ_Handle h2 = f_root->add_GEQ(); + for (Constr_Vars_Iter cvi2(*gei); cvi2; cvi2++) { + Variable_ID v = cvi2.curr_var(); + switch (v->kind()) { + case Wildcard_Var: + h1.update_coef(e, cvi2.curr_coef()); + h2.update_coef(e, -cvi2.curr_coef()); + break; + case Global_Var: { + Global_Var_ID g = v->get_global_var(); + Variable_ID v2; + if (g->arity() == 0) + v2 = stride_cond.get_local(g); + else + v2 = stride_cond.get_local(g, v->function_of()); + h1.update_coef(v2, cvi2.curr_coef()); + h2.update_coef(v2, -cvi2.curr_coef()); + break; + } + default: + h1.update_coef(v, cvi2.curr_coef()); + h2.update_coef(v, -cvi2.curr_coef()); + } + } + h1.update_const((*gei).get_const()); + h2.update_const(-lb); + + stride_cond.simplify(); + Relation other_cond = Gist(copy((*i).second), copy(stride_cond)); + + // find regions with potential mergeable stride condition with this one + std::list intervals; + intervals.push_back(Interval(i, lb, (*gei).get_const())); + + for (std::list >::iterator>::iterator j = s.begin(); j != s.end(); j++) + if (Must_Be_Subset(copy((**j).second), copy(other_cond))) { + Relation stride_cond2 = Gist(copy((**j).second), copy(other_cond)); + + // interval can be removed + if (stride_cond2.is_obvious_tautology()) { + intervals.push_back(Interval(*j, 0, c-1)); + continue; + } + + stride_cond2 = EQs_to_GEQs(stride_cond2, false); + coef_t lb, ub; + GEQ_Iterator gei2(stride_cond2.single_conjunct()); + coef_t sign = 0; + for (Constr_Vars_Iter cvi(*gei2, true); cvi; cvi++) + if (sign != 0) { + sign = 0; + break; + } + else if (cvi.curr_coef() == c) + sign = 1; + else if (cvi.curr_coef() == -c) + sign = -1; + else { + sign = 0; + break; + } + if (sign == 0) + continue; + + bool match = true; + for (Constr_Vars_Iter cvi(*gei2); cvi; cvi++) { + Variable_ID v = cvi.curr_var(); + if (v->kind() == Wildcard_Var) + continue; + else if (v->kind() == Global_Var) { + Global_Var_ID g = v->get_global_var(); + if (g->arity() == 0) + v = (*i).second.get_local(g); + else + v = (*i).second.get_local(g, v->function_of()); + } + + if (cvi.curr_coef() != sign * (*gei).get_coef(v)) { + match = false; + break; + } + } + if (!match) + continue; + + for (Constr_Vars_Iter cvi(*gei); cvi; cvi++) { + Variable_ID v = cvi.curr_var(); + if (v->kind() == Wildcard_Var) + continue; + else if (v->kind() == Global_Var) { + Global_Var_ID g = v->get_global_var(); + if (g->arity() == 0) + v = stride_cond2.get_local(g); + else + v = stride_cond2.get_local(g, v->function_of()); + } + + if (cvi.curr_coef() != sign * (*gei2).get_coef(v)) { + match = false; + break; + } + } + if (!match) + continue; + if (sign > 0) + ub = (*gei2).get_const(); + else + lb = -(*gei2).get_const(); + + gei2++; + if (!gei2) + continue; + + coef_t sign2 = 0; + for (Constr_Vars_Iter cvi(*gei2, true); cvi; cvi++) + if (sign2 != 0) { + sign2 = 0; + break; + } + else if (cvi.curr_coef() == c) + sign2 = 1; + else if (cvi.curr_coef() == -c) + sign2 = -1; + else { + sign2 = 0; + break; + } + if (sign2 != -sign) + continue; + + for (Constr_Vars_Iter cvi(*gei2); cvi; cvi++) { + Variable_ID v = cvi.curr_var(); + if (v->kind() == Wildcard_Var) + continue; + else if (v->kind() == Global_Var) { + Global_Var_ID g = v->get_global_var(); + if (g->arity() == 0) + v = (*i).second.get_local(g); + else + v = (*i).second.get_local(g, v->function_of()); + } + + if (cvi.curr_coef() != sign2 * (*gei).get_coef(v)) { + match = false; + break; + } + } + if (!match) + continue; + + for (Constr_Vars_Iter cvi(*gei); cvi; cvi++) { + Variable_ID v = cvi.curr_var(); + if (v->kind() == Wildcard_Var) + continue; + else if (v->kind() == Global_Var) { + Global_Var_ID g = v->get_global_var(); + if (g->arity() == 0) + v = stride_cond2.get_local(g); + else + v = stride_cond2.get_local(g, v->function_of()); + } + + if (cvi.curr_coef() != sign2 * (*gei2).get_coef(v)) { + match = false; + break; + } + } + if (!match) + continue; + if (sign2 > 0) + ub = (*gei2).get_const(); + else + lb = -(*gei2).get_const(); + + gei2++; + if (gei2) + continue; + + intervals.push_back(Interval(*j, lb, ub)); + } + + merge_intervals(intervals, c, Rs, i); + + // make current region the last one being updated + bool invalid = false; + for (std::list::iterator ii = intervals.begin(); ii != intervals.end(); ii++) + if ((*ii).change && (*ii).pos == i) { + invalid = true; + intervals.push_back(*ii); + intervals.erase(ii); + break; + } + + // update hole condition for each region + for (std::list::iterator ii = intervals.begin(); ii != intervals.end(); ii++) + if ((*ii).change) { + change = true; + + if ((*ii).ub - (*ii).lb + 1 >= (*ii).modulo) + (*(*ii).pos).second = copy(other_cond); + else { + Relation stride_cond = Relation::True((*i).second); + F_Exists *f_exists = stride_cond.and_with_and()->add_exists(); + Variable_ID e = f_exists->declare(); + F_And *f_root = f_exists->add_and(); + GEQ_Handle h1 = f_root->add_GEQ(); + GEQ_Handle h2 = f_root->add_GEQ(); + for (Constr_Vars_Iter cvi2(*gei); cvi2; cvi2++) { + Variable_ID v = cvi2.curr_var(); + switch (v->kind()) { + case Wildcard_Var: + h1.update_coef(e, (*ii).modulo); + h2.update_coef(e, -(*ii).modulo); + break; + case Global_Var: { + Global_Var_ID g = v->get_global_var(); + Variable_ID v2; + if (g->arity() == 0) + v2 = stride_cond.get_local(g); + else + v2 = stride_cond.get_local(g, v->function_of()); + h1.update_coef(v2, cvi2.curr_coef()); + h2.update_coef(v2, -cvi2.curr_coef()); + break; + } + default: + h1.update_coef(v, cvi2.curr_coef()); + h2.update_coef(v, -cvi2.curr_coef()); + } + } + h1.update_const((*ii).ub); + h2.update_const(-(*ii).lb); + + (*(*ii).pos).second = Intersection(copy(other_cond), stride_cond); + (*(*ii).pos).second.simplify(); + } + } + + if (invalid) + break; + } + } + i++; + } + } + } + catch (const presburger_error &e) { + throw e; + } + + Relation R2 = Relation::False(l_R); + for (std::list >::iterator i = Rs.begin(); i != Rs.end(); i++) + R2 = Union(R2, Intersection((*i).first, (*i).second)); + R2.simplify(0, 1); + + return R2; +} + + +// +// Use gist and value range to calculate a quick rectangular hull. It +// intends to replace all hull calculations (QuickHull, BetterHull, +// FastTightHull) beyond the method of ConvexHull (dual +// representations). In the future, it will support max(...)-like +// upper bound. So RectHull complements ConvexHull in two ways: first +// for relations that ConvexHull gets too complicated, second for +// relations where different conjuncts have different symbolic upper +// bounds. +// +Relation RectHull(NOT_CONST Relation &Rel) { + Relation R = Approximate(consume_and_regurgitate(Rel)); + if (!R.is_upper_bound_satisfiable()) + return R; + if (R.has_single_conjunct()) + return R; + + std::vector input_names(R.n_inp()); + for (int i = 1; i <= R.n_inp(); i++) + input_names[i-1] = R.input_var(i)->name(); + std::vector output_names(R.n_out()); + for (int i = 1; i <= R.n_out(); i++) + output_names[i-1] = R.output_var(i)->name(); + + DNF_Iterator c(R.query_DNF()); + Relation r = Relation(R, c.curr()); + c++; + std::vector > bounds1(R.n_inp()); + std::vector > bounds2(R.n_out()); + { + Relation t = Project_Sym(copy(r)); + t.simplify(); + for (int i = 1; i <= R.n_inp(); i++) { + Tuple v; + for (int j = 1; j <= R.n_inp(); j++) + if (j != i) + v.append(r.input_var(j)); + for (int j = 1; j <= R.n_out(); j++) + v.append(r.output_var(j)); + Relation t2 = Project(copy(t), v); + t2.query_variable_bounds(t2.input_var(i), bounds1[i-1].first, bounds1[i-1].second); + } + for (int i = 1; i <= R.n_out(); i++) { + Tuple v; + for (int j = 1; j <= R.n_out(); j++) + if (j != i) + v.append(r.output_var(j)); + for (int j = 1; j <= R.n_inp(); j++) + v.append(r.input_var(j)); + Relation t2 = Project(copy(t), v); + t2.query_variable_bounds(t2.output_var(i), bounds2[i-1].first, bounds2[i-1].second); + } + } + + while (c.live()) { + Relation r2 = Relation(R, c.curr()); + c++; + Relation x = Gist(copy(r), Gist(copy(r), copy(r2), 1), 1); + if (Difference(copy(r2), copy(x)).is_upper_bound_satisfiable()) + x = Relation::True(R); + Relation y = Gist(copy(r2), Gist(copy(r2), copy(r), 1), 1); + if (Difference(copy(r), copy(y)).is_upper_bound_satisfiable()) + y = Relation::True(R); + r = Intersection(x, y); + + { + Relation t = Project_Sym(copy(r2)); + t.simplify(); + for (int i = 1; i <= R.n_inp(); i++) { + Tuple v; + for (int j = 1; j <= R.n_inp(); j++) + if (j != i) + v.append(r2.input_var(j)); + for (int j = 1; j <= R.n_out(); j++) + v.append(r2.output_var(j)); + Relation t2 = Project(copy(t), v); + coef_t lbound, ubound; + t2.query_variable_bounds(t2.input_var(i), lbound, ubound); + bounds1[i-1].first = min(bounds1[i-1].first, lbound); + bounds1[i-1].second = max(bounds1[i-1].second, ubound); + } + for (int i = 1; i <= R.n_out(); i++) { + Tuple v; + for (int j = 1; j <= R.n_out(); j++) + if (j != i) + v.append(r2.output_var(j)); + for (int j = 1; j <= R.n_inp(); j++) + v.append(r2.input_var(j)); + Relation t2 = Project(copy(t), v); + coef_t lbound, ubound; + t2.query_variable_bounds(t2.output_var(i), lbound, ubound); + bounds2[i-1].first = min(bounds2[i-1].first, lbound); + bounds2[i-1].second = max(bounds2[i-1].second, ubound); + } + } + + Relation r3(R.n_inp(), R.n_out()); + F_And *f_root = r3.add_and(); + for (int i = 1; i <= R.n_inp(); i++) { + if (bounds1[i-1].first != -posInfinity) { + GEQ_Handle h = f_root->add_GEQ(); + h.update_coef(r3.input_var(i), 1); + h.update_const(-bounds1[i-1].first); + } + if (bounds1[i-1].second != posInfinity) { + GEQ_Handle h = f_root->add_GEQ(); + h.update_coef(r3.input_var(i), -1); + h.update_const(bounds1[i-1].second); + } + } + for (int i = 1; i <= R.n_out(); i++) { + if (bounds2[i-1].first != -posInfinity) { + GEQ_Handle h = f_root->add_GEQ(); + h.update_coef(r3.output_var(i), 1); + h.update_const(-bounds2[i-1].first); + } + if (bounds2[i-1].second != posInfinity) { + GEQ_Handle h = f_root->add_GEQ(); + h.update_coef(r3.output_var(i), -1); + h.update_const(bounds2[i-1].second); + } + } + r = Intersection(r, r3); + r.simplify(); + } + + for (int i = 1; i <= r.n_inp(); i++) + r.name_input_var(i, input_names[i-1]); + for (int i = 1; i <= r.n_out(); i++) + r.name_output_var(i, output_names[i-1]); + r.setup_names(); + return r; +} + +} // namespace diff --git a/omegalib/omega_lib/src/hull_legacy.cc b/omegalib/omega_lib/src/hull_legacy.cc new file mode 100755 index 0000000..a59d34f --- /dev/null +++ b/omegalib/omega_lib/src/hull_legacy.cc @@ -0,0 +1,1484 @@ +/***************************************************************************** + Copyright (C) 1994-2000 the Omega Project Team + Copyright (C) 2005-2011 Chun Chen + All Rights Reserved. + + Purpose: + Legacy hull calculations' implementation. + + Notes: + + History: + 06/15/09 ConvexRepresentation, Chun Chen + 11/25/09 RectHull, Chun Chen +*****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace omega { + +int hull_debug = 0; + +Relation ConvexHull(NOT_CONST Relation &R) { + Relation S = Approximate(consume_and_regurgitate(R)); + if (!S.is_upper_bound_satisfiable()) + return S; + if (S.has_single_conjunct()) + return S; + return Farkas(Farkas(S,Basic_Farkas), Convex_Combination_Farkas); +} + +Relation DecoupledConvexHull(NOT_CONST Relation &R) { + Relation S = Approximate(consume_and_regurgitate(R)); + if (!S.is_upper_bound_satisfiable()) + return S; + if (S.has_single_conjunct()) + return S; + return Farkas(Farkas(S,Decoupled_Farkas), Convex_Combination_Farkas); +} + +Relation AffineHull(NOT_CONST Relation &R) { + Relation S = Approximate(consume_and_regurgitate(R)); + if (!S.is_upper_bound_satisfiable()) + return S; + return Farkas(Farkas(S,Basic_Farkas), Affine_Combination_Farkas); +} + +Relation LinearHull(NOT_CONST Relation &R) { + Relation S = Approximate(consume_and_regurgitate(R)); + if (!S.is_upper_bound_satisfiable()) + return S; + return Farkas(Farkas(S,Basic_Farkas), Linear_Combination_Farkas); +} + +Relation ConicHull(NOT_CONST Relation &R) { + Relation S = Approximate(consume_and_regurgitate(R)); + if (!S.is_upper_bound_satisfiable()) + return S; + return Farkas(Farkas(S,Basic_Farkas), Positive_Combination_Farkas); +} + + +Relation FastTightHull(NOT_CONST Relation &input_R, NOT_CONST Relation &input_H) { + Relation R = Approximate(consume_and_regurgitate(input_R)); + Relation H = Approximate(consume_and_regurgitate(input_H)); + + if (hull_debug) { + fprintf(DebugFile,"[ Computing FastTightHull of:\n"); + R.prefix_print(DebugFile); + fprintf(DebugFile,"given known hull of:\n"); + H.prefix_print(DebugFile); + } + + if (!H.has_single_conjunct()) { + if (hull_debug) + fprintf(DebugFile, "] bailing out of FastTightHull, known hull not convex\n"); + return H; + } + + if (!H.is_obvious_tautology()) { + R = Gist(R,copy(H)); + R.simplify(1,0); + } + + if (R.has_single_conjunct()) { + R = Intersection(R,H); + if (hull_debug) { + fprintf(DebugFile, "] quick easy answer to FastTightHull\n"); + R.prefix_print(DebugFile); + } + return R; + } + if (R.has_local(coefficient_of_constant_term)) { + if (hull_debug) { + fprintf(DebugFile, "] Can't handle recursive application of Farkas lemma\n"); + } + return H; + } + + if (hull_debug) { + fprintf(DebugFile,"Gist of R given H is:\n"); + R.prefix_print(DebugFile); + } + + if (1) { + Set vars; + int conjuncts = 0; + for (DNF_Iterator s(R.query_DNF()); s.live(); s.next()) { + conjuncts++; + for (Variable_ID_Iterator v(*((*s)->variables())); v.live(); v++) { + bool found = false; + for (EQ_Iterator eq = (*s)->EQs(); eq.live(); eq.next()) + if ((*eq).get_coef(*v) != 0) { + if (!found) vars.insert(*v); + found = true; + break; + } + if (!found) + for (GEQ_Iterator geq = (*s)->GEQs(); geq.live(); geq.next()) + if ((*geq).get_coef(*v) != 0) { + if (!found) vars.insert(*v); + found = true; + break; + } + } + } + + + // We now know which variables appear in R + if (hull_debug) { + fprintf(DebugFile,"Variables we need a better hull on are: "); + foreach(v,Variable_ID,vars, + fprintf(DebugFile," %s",v->char_name())); + fprintf(DebugFile,"\n"); + } + Conjunct *c = H.single_conjunct(); + int total=0; + int copied = 0; + for (EQ_Iterator eq = c->EQs(); eq.live(); eq.next()) { + total++; + foreach(v,Variable_ID,vars, + if ((*eq).get_coef(v) != 0) { + R.and_with_EQ(*eq); + copied++; + break; // out of variable loop + } + ); + } + for (GEQ_Iterator geq = c->GEQs(); geq.live(); geq.next()) { + total++; + foreach(v,Variable_ID,vars, + if ((*geq).get_coef(v) != 0) { + R.and_with_GEQ(*geq); + copied++; + break; // out of variable loop + } + ); + } + if (copied < total) { + R = Approximate(R); + + if (hull_debug) { + fprintf(DebugFile,"Decomposed relation, copied only %d of %d constraints\n",copied,total); + fprintf(DebugFile,"Original R:\n"); + R.prefix_print(DebugFile); + fprintf(DebugFile,"Known hull:\n"); + H.prefix_print(DebugFile); + fprintf(DebugFile,"New R:\n"); + R.prefix_print(DebugFile); + } + } + } + + Relation F = Farkas(copy(R), Basic_Farkas, true); + if (hull_debug) + fprintf(DebugFile,"Farkas Difficulty = " coef_fmt "\n", farkasDifficulty); + if (farkasDifficulty > 260) { + if (hull_debug) { + fprintf(DebugFile, "] bailing out, farkas is way too complex\n"); + fprintf(DebugFile,"Farkas:\n"); + F.prefix_print(DebugFile); + } + return H; + } + else if (farkasDifficulty > 130) { + // Bail out + if (hull_debug) { + fprintf(DebugFile, coef_fmt " non-zeros in original farkas\n", farkasDifficulty); + } + Relation tmp = Farkas(R, Decoupled_Farkas, true); + + if (hull_debug) { + fprintf(DebugFile, coef_fmt " non-zeros in decoupled farkas\n", farkasDifficulty); + } + if (farkasDifficulty > 260) { + if (hull_debug) { + fprintf(DebugFile, "] bailing out, farkas is way too complex\n"); + fprintf(DebugFile,"Farkas:\n"); + F.prefix_print(DebugFile); + } + return H; + } + else { + if (farkasDifficulty > 130) + R = Intersection(H, Farkas(tmp, Affine_Combination_Farkas, true)); + else R = Intersection(H, + Intersection(Farkas(tmp, Convex_Combination_Farkas, true), + Farkas(F, Affine_Combination_Farkas, true))); + if (hull_debug) { + fprintf(DebugFile, "] bailing out, farkas is too complex, using affine hull\n"); + fprintf(DebugFile,"Farkas:\n"); + F.prefix_print(DebugFile); + fprintf(DebugFile,"Affine hull:\n"); + R.prefix_print(DebugFile); + } + return R; + } + } + + R = Intersection(H, Farkas(F, Convex_Combination_Farkas, true)); + if (hull_debug) { + fprintf(DebugFile, "] Result of FastTightHull:\n"); + R.prefix_print(DebugFile); + } + return R; +} + + + +namespace { + bool parallel(const GEQ_Handle &g1, const GEQ_Handle &g2) { + for(Constr_Vars_Iter cvi(g1, false); cvi; cvi++) { + coef_t c1 = (*cvi).coef; + coef_t c2 = g2.get_coef((*cvi).var); + if (c1 != c2) return false; + } + { + for(Constr_Vars_Iter cvi(g2, false); cvi; cvi++) { + coef_t c1 = g1.get_coef((*cvi).var); + coef_t c2 = (*cvi).coef; + if (c1 != c2) return false; + } + } + return true; + } + + + bool hull(const EQ_Handle &e, const GEQ_Handle &g, coef_t &hull) { + int sign = 0; + for(Constr_Vars_Iter cvi(e, false); cvi; cvi++) { + coef_t c1 = (*cvi).coef; + coef_t c2 = g.get_coef((*cvi).var); + if (sign == 0) sign = (c1*c2>=0?1:-1); + if (sign*c1 != c2) return false; + } + assert(sign != 0); + { + for(Constr_Vars_Iter cvi(g, false); cvi; cvi++) { + coef_t c1 = e.get_coef((*cvi).var); + coef_t c2 = (*cvi).coef; + if (sign*c1 != c2) return false; + } + } + hull = max(sign * e.get_const(), g.get_const()); + if (hull_debug) { + fprintf(DebugFile,"Hull of:\n %s\n", e.print_to_string().c_str()); + fprintf(DebugFile," %s\n", g.print_to_string().c_str()); + fprintf(DebugFile,"is " coef_fmt "\n\n",hull); + } + return true; + } + + bool eq(const EQ_Handle &e1, const EQ_Handle &e2) { + int sign = 0; + for(Constr_Vars_Iter cvi(e1, false); cvi; cvi++) { + coef_t c1 = (*cvi).coef; + coef_t c2 = e2.get_coef((*cvi).var); + if (sign == 0) sign = (c1*c2>=0?1:-1); + if (sign*c1 != c2) return false; + } + assert(sign != 0); + { + for(Constr_Vars_Iter cvi(e2, false); cvi; cvi++) { + coef_t c1 = e1.get_coef((*cvi).var); + coef_t c2 = (*cvi).coef; + if (sign*c1 != c2) return false; + } + } + return sign * e1.get_const() == e2.get_const(); + } +} + + +// This function is deprecated!!! +Relation QuickHull(Relation &R) { + Tuple Rs(1); + Rs[1] = R; + return QuickHull(Rs); +} + + +// This function is deprecated!!! +Relation QuickHull(Tuple &Rs) { + assert(!Rs.empty()); + + // if (Rs.size() == 1) return Rs[1]; + + Tuple l_Rs; + for (int i = 1; i <= Rs.size(); i++) + for (DNF_Iterator c(Rs[i].query_DNF()); c; c++) { + Relation r = Relation(Rs[i], c.curr()); + l_Rs.append(Approximate(r)); + } + + if (l_Rs.size() == 1) + return l_Rs[1]; + + Relation result = Relation::True(Rs[1]); + result.copy_names(Rs[1]); + + use_ugly_names++; + + if (hull_debug > 1) + for (int i = 1; i <= l_Rs.size(); i++) { + fprintf(DebugFile,"#%d \n",i); + l_Rs[i].prefix_print(DebugFile); + } + + +// Relation R = copy(Rs[1]); +// for (int i = 2; i <= Rs.size(); i++) +// R = Union(R,copy(Rs[i])); + +// #if 0 +// if (!R.is_set()) { +// if (R.n_inp() == R.n_out()) { +// Relation AC = DeltasToRelation(Hull(Deltas(copy(R), +// min(R.n_inp(),R.n_out()))), +// R.n_inp(),R.n_out()); +// Relation dH = Hull(Domain(copy(R)),false); +// Relation rH = Hull(Range(copy(R)),false); +// result = Intersection(AC,Cross_Product(dH,rH)); +// } +// else { +// Relation dH = Hull(Domain(copy(R)),false); +// Relation rH = Hull(Range(copy(R)),false); +// result = Cross_Product(dH,rH); +// assert(Must_Be_Subset(copy(R),copy(result))); +// } +// } + +// #endif + + Conjunct *first; + l_Rs[1] = EQs_to_GEQs(l_Rs[1]); + first = l_Rs[1].single_conjunct(); + for (GEQ_Iterator candidate(first->GEQs()); candidate.live(); candidate.next()) { + coef_t maxConstantTerm = (*candidate).get_const(); + bool found = true; + if (hull_debug > 1) { + fprintf(DebugFile,"searching for bound on:\n %s\n", (*candidate).print_to_string().c_str()); + } + for (int i = 2; i <= l_Rs.size(); i++) { + Conjunct *other = l_Rs[i].single_conjunct(); + bool found_for_i = false; + for (GEQ_Iterator target(other->GEQs()); target.live(); target.next()) { + if (hull_debug > 2) { + fprintf(DebugFile,"candidate:\n %s\n", (*candidate).print_to_string().c_str()); + fprintf(DebugFile,"target:\n %s\n", (*target).print_to_string().c_str()); + } + if (parallel(*candidate,*target)) { + if (hull_debug > 1) + fprintf(DebugFile,"Found bound:\n %s\n", (*target).print_to_string().c_str()); + maxConstantTerm = max(maxConstantTerm,(*target).get_const()); + found_for_i = true; + break; + } + } + if (!found_for_i) { + for (EQ_Iterator target_e(other->EQs()); target_e.live(); target_e.next()) { + coef_t h; + if (hull(*target_e,*candidate,h)) { + if (hull_debug > 1) + fprintf(DebugFile,"Found bound of " coef_fmt ":\n %s\n", h, (*target_e).print_to_string().c_str()); + maxConstantTerm = max(maxConstantTerm,h); + found_for_i = true; + break; + } + }; + if (!found_for_i) { + if (hull_debug > 1) { + fprintf(DebugFile,"No bound found in:\n"); + fprintf(DebugFile, "%s", l_Rs[i].print_with_subs_to_string().c_str()); + } + //if nothing found + found = false; + break; + } + } + } + + if (found) { + GEQ_Handle h = result.and_with_GEQ(); + copy_constraint(h,*candidate); + if (hull_debug > 1) + fprintf(DebugFile,"Setting constant term to " coef_fmt " in\n %s\n", maxConstantTerm, h.print_to_string().c_str()); + h.update_const(maxConstantTerm - (*candidate).get_const()); + if (hull_debug > 1) + fprintf(DebugFile,"Updated constraint is\n %s\n", h.print_to_string().c_str()); + } + } + + + for (EQ_Iterator candidate_eq(first->EQs()); candidate_eq.live(); candidate_eq.next()) { + bool found = true; + for (int i = 2; i <= l_Rs.size(); i++) { + Conjunct *C = l_Rs[i].single_conjunct(); + bool found_for_i = false; + + for (EQ_Iterator target(C->EQs()); target.live(); target.next()) { + if (eq(*candidate_eq,*target)) { + found_for_i = true; + break; + } + } + if (!found_for_i) { + //if nothing found + found = false; + break; + } + } + + if (found) { + EQ_Handle h = result.and_with_EQ(); + copy_constraint(h,*candidate_eq); + if (hull_debug > 1) + fprintf(DebugFile,"Adding eq constraint: %s\n", h.print_to_string().c_str()); + } + } + + use_ugly_names--; + if (hull_debug > 1) { + fprintf(DebugFile,"quick hull is of:"); + result.print_with_subs(DebugFile); + } + return result; +} + + +// Relation Hull2(Tuple &Rs, Tuple &active) { +// assert(Rs.size() == active.size() && Rs.size() > 0); + +// Tuple l_Rs; +// for (int i = 1; i <= Rs.size(); i++) +// if (active[i]) +// l_Rs.append(copy(Rs[i])); + +// if (l_Rs.size() == 0) +// return Relation::False(Rs[1]); + +// try { +// Relation r = l_Rs[1]; +// for (int i = 2; i <= l_Rs.size(); i++) { +// r = Union(r, copy(l_Rs[i])); +// r.simplify(); +// } + +// // Relation F = Farkas(r, Basic_Farkas, true); +// // if (farkasDifficulty >= 500) +// // throw std::overflow_error("loop convex hull too complicated."); +// // F = Farkas(F, Convex_Combination_Farkas, true); +// return Farkas(Farkas(r, Basic_Farkas, true), Convex_Combination_Farkas, true); +// } +// catch (std::overflow_error) { +// return QuickHull(l_Rs); +// } +// } + + +namespace { + void printRs(Tuple &Rs) { + fprintf(DebugFile,"Rs:\n"); + for (int i = 1; i <= Rs.size(); i++) + fprintf(DebugFile,"#%d : %s\n",i, + Rs[i].print_with_subs_to_string().c_str()); + } +} + +Relation BetterHull(Tuple &Rs, bool stridesAllowed, bool checkSubsets, + NOT_CONST Relation &input_knownHull = Relation::Null()) { + Relation knownHull = consume_and_regurgitate(input_knownHull); + static int OMEGA_WHINGE = -1; + if (OMEGA_WHINGE < 0) { + OMEGA_WHINGE = getenv("OMEGA_WHINGE") ? atoi(getenv("OMEGA_WHINGE")) : 0; + } + assert(!Rs.empty()); + if (Rs.size() == 1) { + if (stridesAllowed) return Rs[1]; + else return Approximate(Rs[1]); + } + + if (checkSubsets) { + Tuple live(Rs.size()); + if (hull_debug) { + fprintf(DebugFile,"Checking subsets in hull computation:\n"); + printRs(Rs); + } + int i; + for(i=1;i <=Rs.size(); i++) live[i] = true; + for(i=1;i <=Rs.size(); i++) + for(int j=1;j <=Rs.size(); j++) if (i != j && live[j]) { + if (hull_debug) fprintf(DebugFile,"checking %d Is_Obvious_Subset %d\n",i,j); + if (Is_Obvious_Subset(copy(Rs[i]),copy(Rs[j]))) { + if (hull_debug) fprintf(DebugFile,"yes...\n"); + live[i] = false; + break; + } + } + for(i=1;i <=Rs.size(); i++) if (!live[i]) { + if (i < Rs.size()) { + Rs[i] = Rs[Rs.size()]; + live[i] = live[Rs.size()]; + } + Rs[Rs.size()] = Relation(); + Rs.delete_last(); + i--; + } + } + Relation hull; + if (hull_debug) { + fprintf(DebugFile,"Better Hull:\n"); + printRs(Rs); + fprintf(DebugFile,"known hull: %s\n", knownHull.print_with_subs_to_string().c_str()); + } + if (knownHull.is_null()) hull = QuickHull(Rs); + else hull = Intersection(QuickHull(Rs),knownHull); + // for (int i = 1; i <= Rs.size(); i++) + // hull = RectHull(Union(hull, copy(Rs[i]))); + // hull = Intersection(hull, knownHull); + hull.simplify(); + if (hull_debug) { + fprintf(DebugFile,"quick hull: %s\n", hull.print_with_subs_to_string().c_str()); + } + + Relation orig = Relation::False(Rs[1]); + int i; + for (i = 1; i <= Rs.size(); i++) + orig = Union(orig,copy(Rs[i])); + + orig.simplify(); + + for (i = 1; i <= Rs.size(); i++) { + if (!hull.is_obvious_tautology()) Rs[i] = Gist(Rs[i],copy(hull)); + Rs[i].simplify(); + if (Rs[i].is_obvious_tautology()) return hull; + if (Rs[i].has_single_conjunct()) { + Rs[i] = EQs_to_GEQs(Rs[i]); + if (hull_debug) { + fprintf(DebugFile,"Checking for hull constraints in:\n %s\n", Rs[i].print_with_subs_to_string().c_str()); + } + Conjunct *c = Rs[i].single_conjunct(); + for (GEQ_Iterator g(c->GEQs()); g.live(); g.next()) { + Relation tmp = Relation::True(Rs[i]); + tmp.and_with_GEQ(*g); + if (!Difference(copy(orig),tmp).is_upper_bound_satisfiable()) + hull.and_with_GEQ(*g); + } + for (EQ_Iterator e(c->EQs()); e.live(); e.next()) { + Relation tmp = Relation::True(Rs[i]); + tmp.and_with_EQ(*e); + if (!Difference(copy(orig),tmp).is_upper_bound_satisfiable()) + hull.and_with_EQ(*e); + } + } + } + + hull = FastTightHull(orig,hull); + assert(hull.has_single_conjunct()); + + if (stridesAllowed) return hull; + else return Approximate(hull); + +} + + + +Relation Hull(NOT_CONST Relation &S, + bool stridesAllowed, + int effort, + NOT_CONST Relation &knownHull) { + Relation R = consume_and_regurgitate(S); + R.simplify(1,0); + if (!R.is_upper_bound_satisfiable()) return R; + Tuple Rs; + for (DNF_Iterator c(R.query_DNF()); c.live(); ) { + Rs.append(Relation(R,c.curr())); + c.next(); + } + if (effort == 1) + return BetterHull(Rs,stridesAllowed,false,knownHull); + else + return QuickHull(Rs); +} + + + +Relation Hull(Tuple &Rs, + const std::vector &validMask, + int effort, + bool stridesAllowed, + NOT_CONST Relation &knownHull) { + // Use relation of index i only when validMask[i] != 0 + Tuple Rs2; + for(int i = 1; i <= Rs.size(); i++) { + if (validMask[i-1]) { + Rs[i].simplify(); + for (DNF_Iterator c(Rs[i].query_DNF()); c.live(); ) { + Rs2.append(Relation(Rs[i],c.curr())); + c.next(); + } + } + } + assert(effort == 0 || effort == 1); + if (effort == 1) + return BetterHull(Rs2,stridesAllowed,true,knownHull); + else + return QuickHull(Rs2); +} + + +// This function is deprecated!!! +Relation CheckForConvexRepresentation(NOT_CONST Relation &R_In) { + Relation R = consume_and_regurgitate(R_In); + Relation h = Hull(copy(R)); + if (!Difference(copy(h),copy(R)).is_upper_bound_satisfiable()) + return h; + else + return R; +} + +// This function is deprecated!!! +Relation CheckForConvexPairs(NOT_CONST Relation &S) { + Relation R = consume_and_regurgitate(S); + Relation hull = FastTightHull(copy(R),Relation::True(R)); + R.simplify(1,0); + if (!R.is_upper_bound_satisfiable() || R.number_of_conjuncts() < 2) return R; + Tuple Rs; + for (DNF_Iterator c(R.query_DNF()); c.live(); ) { + Rs.append(Relation(R,c.curr())); + c.next(); + } + + bool *dead = new bool[Rs.size()+1]; + int i; + for(i = 1; i<=Rs.size();i++) dead[i] = false; + + for(i = 1; i<=Rs.size();i++) + if (!dead[i]) + for(int j = i+1; j<=Rs.size();j++) if (!dead[j]) { + if (hull_debug) { + fprintf(DebugFile,"Comparing #%d and %d\n",i,j); + } + Relation U = Union(copy(Rs[i]),copy(Rs[j])); + Relation H_ij = FastTightHull(copy(U),copy(hull)); + if (!Difference(copy(H_ij),U).is_upper_bound_satisfiable()) { + Rs[i] = H_ij; + dead[j] = true; + if (hull_debug) { + fprintf(DebugFile,"Combined them\n"); + } + } + } + i = 1; + while(i<=Rs.size() && dead[i]) i++; + assert(i<=Rs.size()); + R = Rs[i]; + i++; + for(; i<=Rs.size();i++) + if (!dead[i]) + R = Union(R,Rs[i]); + delete []dead; + return R; +} + +// +// Supporting functions for ConvexRepresentation +// +namespace { +struct Interval { + std::list >::iterator pos; + coef_t lb; + coef_t ub; + bool change; + coef_t modulo; + Interval(std::list >::iterator pos_, coef_t lb_, coef_t ub_): + pos(pos_), lb(lb_), ub(ub_) {} + friend bool operator<(const Interval &a, const Interval &b); +}; + +bool operator<(const Interval &a, const Interval &b) { + return a.lb < b.lb; +} + +struct Modulo_Interval { + coef_t modulo; + coef_t start; + coef_t size; + Modulo_Interval(coef_t modulo_, coef_t start_, coef_t size_): + modulo(modulo_), start(start_), size(size_) {} + friend bool operator<(const Interval &a, const Interval &b); +}; + +bool operator<(const Modulo_Interval &a, const Modulo_Interval &b) { + if (a.modulo == b.modulo) { + if (a.start == b.start) + return a.size < b.size; + else + return a.start < b.start; + } + else + return a.modulo < b.modulo; +} + +void merge_intervals(std::list &intervals, coef_t modulo, std::list > &Rs, std::list >::iterator orig) { + // normalize intervals + for (std::list::iterator i = intervals.begin(); i != intervals.end(); i++) { + (*i).modulo = modulo; + (*i).change = false; + if ((*i).ub - (*i).lb + 1>= modulo) { + (*i).lb = 0; + (*i).ub = modulo - 1; + } + else if ((*i).ub < 0 || (*i).lb >= modulo) { + coef_t range = (*i).ub - (*i).lb; + (*i).lb = int_mod((*i).lb, modulo); + (*i).ub = (*i).lb + range; + } + } + + intervals.sort(); + + // merge neighboring intervals + std::list::iterator p = intervals.begin(); + while (p != intervals.end()) { + std::list::iterator q = p; + q++; + while (q != intervals.end()) { + if ((*p).ub + 1 >= (*q).lb) { + Relation hull = ConvexHull(Union(copy((*(*p).pos).first), copy((*(*q).pos).first))); + Relation remainder = Difference(Difference(copy(hull), copy((*(*p).pos).first)), copy((*(*q).pos).first)); + if (!remainder.is_upper_bound_satisfiable()) { + if ((*q).pos == orig) + std::swap((*p).pos, (*q).pos); + (*(*p).pos).first = hull; + (*p).ub = max((*p).ub, (*q).ub); + (*p).change = true; + Rs.erase((*q).pos); + q = intervals.erase(q); + } + else + break; + } + else + break; + } + + bool p_moved = false; + q = p; + q++; + while (q != intervals.end()) { + if ((*q).ub >= modulo && int_mod((*q).ub, modulo) + 1 >= (*p).lb) { + Relation hull = ConvexHull(Union(copy((*(*p).pos).first), copy((*(*q).pos).first))); + Relation remainder = Difference(Difference(copy(hull), copy((*(*p).pos).first)), copy((*(*q).pos).first)); + if (!remainder.is_upper_bound_satisfiable()) { + if ((*p).pos == orig) + std::swap((*p).pos, (*q).pos); + (*(*q).pos).first = hull; + coef_t t = (*p).ub - int_mod((*q).ub, modulo); + if (t > 0) + (*q).ub = (*q).ub + t; + (*q).change = true; + Rs.erase((*p).pos); + p = intervals.erase(p); + p_moved = true; + break; + } + else + q++; + } + else + q++; + } + + if (!p_moved) + p++; + } + + // merge by reducing the strengh of modulo + std::list modulo_intervals; + coef_t max_distance = modulo/2; + for (std::list::iterator p = intervals.begin(); p != intervals.end(); p++) { + if ((*p).lb >= max_distance) + break; + + coef_t size = (*p).ub - (*p).lb; + + std::list::iterator q = p; + q++; + while (q != intervals.end()) { + coef_t distance = (*q).lb - (*p).lb; + if (distance > max_distance) + break; + + if ((*q).ub - (*q).lb != size || int_mod(modulo, distance) != 0) { + q++; + continue; + } + + int num_reduced = 0; + coef_t looking_for = int_mod((*p).lb, distance); + for (std::list::iterator k = intervals.begin(); k != intervals.end(); k++) { + if ((*k).lb == looking_for && (*k).ub - (*k).lb == size) { + num_reduced++; + looking_for += distance; + if (looking_for >= modulo) + break; + } + else if ((*k).lb <= looking_for && (*k).ub >= looking_for + size) { + looking_for += distance; + if (looking_for >= modulo) + break; + } + else if ((*k).lb > looking_for) + break; + } + + if (looking_for >= modulo && num_reduced > 1) + modulo_intervals.push_back(Modulo_Interval(distance, int_mod((*p).lb, distance), size)); + + q++; + } + } + + modulo_intervals.sort(); + + // remove redundant reduced-strength intervals + std::list::iterator p2 = modulo_intervals.begin(); + while (p2 != modulo_intervals.end()) { + std::list::iterator q2 = p2; + q2++; + while (q2 != modulo_intervals.end()) { + if ((*p2).modulo == (*q2).modulo && (*p2).start == (*q2).start) + q2 = modulo_intervals.erase(q2); + else if (int_mod((*q2).modulo, (*p2).modulo) == 0 && + (*p2).start == int_mod((*q2).start, (*p2).modulo) && + (*p2).size >= (*q2).size) + q2 = modulo_intervals.erase(q2); + else + q2++; + } + p2++; + } + + // replace original intervals with new reduced-strength ones + for (std::list::iterator i = modulo_intervals.begin(); i != modulo_intervals.end(); i++) { + std::vector candidates; + int num_replaced = 0; + for (std::list::iterator j = intervals.begin(); j != intervals.end(); j++) + if (int_mod((*j).modulo, (*i).modulo) == 0 && + (*j).ub - (*j).lb >= (*i).size && + (int_mod((*j).lb, (*i).modulo) == (*i).start || + int_mod((*j).ub, (*i).modulo) == (*i).start + (*i).size)) { + candidates.push_back(&((*(*j).pos).first)); + if (int_mod((*j).lb, (*i).modulo) == (*i).start && + (*j).ub - (*j).lb == (*i).size) + num_replaced++; + } + if (num_replaced <= 1) + continue; + + Relation R = copy(*candidates[0]); + for (size_t k = 1; k < candidates.size(); k++) + R = Union(R, copy(*candidates[k])); + Relation hull = ConvexHull(copy(R)); + Relation remainder = Difference(copy(hull), copy(R)); + if (!remainder.is_upper_bound_satisfiable()) { + std::list::iterator replaced_one = intervals.end(); + for (std::list::iterator j = intervals.begin(); j != intervals.end();) + if (int_mod((*j).modulo, (*i).modulo) == 0 && + (*j).ub - (*j).lb >= (*i).size && + (int_mod((*j).lb, (*i).modulo) == (*i).start || + int_mod((*j).ub, (*i).modulo) == (*i).start + (*i).size)) { + if (int_mod((*j).lb, (*i).modulo) == (*i).start && + (*j).ub - (*j).lb == (*i).size) { + if (replaced_one == intervals.end()) { + (*(*j).pos).first = hull; + (*j).lb = int_mod((*j).lb, (*i).modulo); + (*j).ub = int_mod((*j).ub, (*i).modulo); + (*j).modulo = (*i).modulo; + (*j).change = true; + replaced_one = j; + j++; + } + else { + if ((*j).pos == orig) { + std::swap((*replaced_one).pos, (*j).pos); + (*(*replaced_one).pos).first = (*(*j).pos).first; + } + Rs.erase((*j).pos); + j = intervals.erase(j); + } + } + else { + if (int_mod((*j).lb, (*i).modulo) == (*i).start) + (*j).lb = (*j).lb + (*i).size + 1; + else + (*j).ub = (*j).ub - (*i).size - 1; + (*j).change = true; + j++; + } + } + else + j++; + } + } +} +} // namespace + + +// +// Simplify a union of sets/relations to a minimal (may not be +// optimal) number of convex regions. It intends to replace +// CheckForConvexRepresentation and CheckForConvexPairs functions. +// +Relation ConvexRepresentation(NOT_CONST Relation &R) { + Relation l_R = copy(R); + if (!l_R.is_upper_bound_satisfiable() || l_R.number_of_conjuncts() < 2) + return R; + + // separate each conjunct into smooth convex region and holes + std::list > Rs; // pair(smooth region, hole condition) + for (DNF_Iterator c(l_R.query_DNF()); c.live(); c++) { + Relation r1 = Relation(l_R, c.curr()); + Relation r2 = Approximate(copy(r1)); + r1 = Gist(r1, copy(r2)); + Rs.push_back(std::make_pair(r2, r1)); + } + + try { + bool change = true; + while (change) { + change = false; + + std::list >::iterator i = Rs.begin(); + while (i != Rs.end()) { + // find regions with identical hole conditions to merge + { + std::list >::iterator j = i; + j++; + while (j != Rs.end()) { + if (!Difference(copy((*i).second), copy((*j).second)).is_upper_bound_satisfiable() && + !Difference(copy((*j).second), copy((*i).second)).is_upper_bound_satisfiable()) { + if (Must_Be_Subset(copy((*j).first), copy((*i).first))) { + j = Rs.erase(j); + } + else if (Must_Be_Subset(copy((*i).first), copy((*j).first))) { + (*i).first = (*j).first; + j = Rs.erase(j); + change = true; + } + else { + Relation r; + bool already_use_recthull = false; + try { + r = ConvexHull(Union(copy((*i).first), copy((*j).first))); + } + catch (const std::overflow_error &e) { + r = SimpleHull(Union(copy((*i).first), copy((*j).first))); + already_use_recthull = true; + } + retry_recthull: + Relation r2 = Difference(Difference(copy(r), copy((*i).first)), copy((*j).first)); + if (!r2.is_upper_bound_satisfiable()) { // convex hull is tight + (*i).first = r; + j = Rs.erase(j); + change = true; + } + else { + if (!already_use_recthull) { + r = SimpleHull(Union(copy((*i).first), copy((*j).first))); + already_use_recthull = true; + goto retry_recthull; + } + else + j++; + } + } + } + else + j++; + } + } + + // find identical smooth regions as candidates for hole merge + std::list >::iterator> s; + for (std::list >::iterator j = Rs.begin(); j != Rs.end(); j++) + if (j != i) { + if (!Intersection(Difference(copy((*i).first), copy((*j).first)), copy((*j).second)).is_upper_bound_satisfiable() && + !Intersection(Difference(copy((*j).first), copy((*i).first)), copy((*i).second)).is_upper_bound_satisfiable()) + s.push_back(j); + } + + if (s.size() != 0) { + // convert hole condition c1*x1+c2*x2+... = c*alpha+d to a pair of inequalities + (*i).second = EQs_to_GEQs((*i).second, false); + + // find potential wildcards that can be used for hole conditions + std::set nonsingle_wild; + for (EQ_Iterator ei((*i).second.single_conjunct()); ei; ei++) + if ((*ei).has_wildcards()) + for (Constr_Vars_Iter cvi(*ei, true); cvi; cvi++) + nonsingle_wild.insert(cvi.curr_var()); + for (GEQ_Iterator gei((*i).second.single_conjunct()); gei; gei++) + if ((*gei).has_wildcards()) { + Constr_Vars_Iter cvi(*gei, true); + Constr_Vars_Iter cvi2 = cvi; + cvi2++; + if (cvi2) { + nonsingle_wild.insert(cvi.curr_var()); + for (; cvi2; cvi2++) + nonsingle_wild.insert(cvi2.curr_var()); + } + } + + // find hole condition in c*alpha+d1<=c1*x1+c2*x2+...<=c*alpha+d2 format + for (GEQ_Iterator gei((*i).second.single_conjunct()); gei; gei++) + if ((*gei).has_wildcards()) { + coef_t c; + Variable_ID v; + { + Constr_Vars_Iter cvi(*gei, true); + v = cvi.curr_var(); + c = cvi.curr_coef(); + if (c < 0 || nonsingle_wild.find(v) != nonsingle_wild.end()) + continue; + } + + coef_t lb = posInfinity; + for (GEQ_Iterator gei2((*i).second.single_conjunct()); gei2; gei2++) { + if (!(*gei2 == *gei) && (*gei2).get_coef(v) != 0) { + if (lb != posInfinity) { + nonsingle_wild.insert(v); + break; + } + + bool match = true; + for (Constr_Vars_Iter cvi2(*gei); cvi2; cvi2++) + if (cvi2.curr_coef() != -((*gei2).get_coef(cvi2.curr_var()))) { + match = false; + break; + } + if (match) + for (Constr_Vars_Iter cvi2(*gei2); cvi2; cvi2++) + if (cvi2.curr_coef() != -((*gei).get_coef(cvi2.curr_var()))) { + match = false; + break; + } + if (!match) { + nonsingle_wild.insert(v); + break; + } + + lb = -(*gei2).get_const(); + } + } + + if (nonsingle_wild.find(v) != nonsingle_wild.end()) + continue; + + Relation stride_cond = Relation::True((*i).second); + F_Exists *f_exists = stride_cond.and_with_and()->add_exists(); + Variable_ID e = f_exists->declare(); + F_And *f_root = f_exists->add_and(); + GEQ_Handle h1 = f_root->add_GEQ(); + GEQ_Handle h2 = f_root->add_GEQ(); + for (Constr_Vars_Iter cvi2(*gei); cvi2; cvi2++) { + Variable_ID v = cvi2.curr_var(); + switch (v->kind()) { + case Wildcard_Var: + h1.update_coef(e, cvi2.curr_coef()); + h2.update_coef(e, -cvi2.curr_coef()); + break; + case Global_Var: { + Global_Var_ID g = v->get_global_var(); + Variable_ID v2; + if (g->arity() == 0) + v2 = stride_cond.get_local(g); + else + v2 = stride_cond.get_local(g, v->function_of()); + h1.update_coef(v2, cvi2.curr_coef()); + h2.update_coef(v2, -cvi2.curr_coef()); + break; + } + default: + h1.update_coef(v, cvi2.curr_coef()); + h2.update_coef(v, -cvi2.curr_coef()); + } + } + h1.update_const((*gei).get_const()); + h2.update_const(-lb); + + stride_cond.simplify(); + Relation other_cond = Gist(copy((*i).second), copy(stride_cond)); + + // find regions with potential mergeable stride condition with this one + std::list intervals; + intervals.push_back(Interval(i, lb, (*gei).get_const())); + + for (std::list >::iterator>::iterator j = s.begin(); j != s.end(); j++) + if (Must_Be_Subset(copy((**j).second), copy(other_cond))) { + Relation stride_cond2 = Gist(copy((**j).second), copy(other_cond)); + + // interval can be removed + if (stride_cond2.is_obvious_tautology()) { + intervals.push_back(Interval(*j, 0, c-1)); + continue; + } + + stride_cond2 = EQs_to_GEQs(stride_cond2, false); + coef_t lb, ub; + GEQ_Iterator gei2(stride_cond2.single_conjunct()); + coef_t sign = 0; + for (Constr_Vars_Iter cvi(*gei2, true); cvi; cvi++) + if (sign != 0) { + sign = 0; + break; + } + else if (cvi.curr_coef() == c) + sign = 1; + else if (cvi.curr_coef() == -c) + sign = -1; + else { + sign = 0; + break; + } + if (sign == 0) + continue; + + bool match = true; + for (Constr_Vars_Iter cvi(*gei2); cvi; cvi++) { + Variable_ID v = cvi.curr_var(); + if (v->kind() == Wildcard_Var) + continue; + else if (v->kind() == Global_Var) { + Global_Var_ID g = v->get_global_var(); + if (g->arity() == 0) + v = (*i).second.get_local(g); + else + v = (*i).second.get_local(g, v->function_of()); + } + + if (cvi.curr_coef() != sign * (*gei).get_coef(v)) { + match = false; + break; + } + } + if (!match) + continue; + + for (Constr_Vars_Iter cvi(*gei); cvi; cvi++) { + Variable_ID v = cvi.curr_var(); + if (v->kind() == Wildcard_Var) + continue; + else if (v->kind() == Global_Var) { + Global_Var_ID g = v->get_global_var(); + if (g->arity() == 0) + v = stride_cond2.get_local(g); + else + v = stride_cond2.get_local(g, v->function_of()); + } + + if (cvi.curr_coef() != sign * (*gei2).get_coef(v)) { + match = false; + break; + } + } + if (!match) + continue; + if (sign > 0) + ub = (*gei2).get_const(); + else + lb = -(*gei2).get_const(); + + gei2++; + if (!gei2) + continue; + + coef_t sign2 = 0; + for (Constr_Vars_Iter cvi(*gei2, true); cvi; cvi++) + if (sign2 != 0) { + sign2 = 0; + break; + } + else if (cvi.curr_coef() == c) + sign2 = 1; + else if (cvi.curr_coef() == -c) + sign2 = -1; + else { + sign2 = 0; + break; + } + if (sign2 != -sign) + continue; + + for (Constr_Vars_Iter cvi(*gei2); cvi; cvi++) { + Variable_ID v = cvi.curr_var(); + if (v->kind() == Wildcard_Var) + continue; + else if (v->kind() == Global_Var) { + Global_Var_ID g = v->get_global_var(); + if (g->arity() == 0) + v = (*i).second.get_local(g); + else + v = (*i).second.get_local(g, v->function_of()); + } + + if (cvi.curr_coef() != sign2 * (*gei).get_coef(v)) { + match = false; + break; + } + } + if (!match) + continue; + + for (Constr_Vars_Iter cvi(*gei); cvi; cvi++) { + Variable_ID v = cvi.curr_var(); + if (v->kind() == Wildcard_Var) + continue; + else if (v->kind() == Global_Var) { + Global_Var_ID g = v->get_global_var(); + if (g->arity() == 0) + v = stride_cond2.get_local(g); + else + v = stride_cond2.get_local(g, v->function_of()); + } + + if (cvi.curr_coef() != sign2 * (*gei2).get_coef(v)) { + match = false; + break; + } + } + if (!match) + continue; + if (sign2 > 0) + ub = (*gei2).get_const(); + else + lb = -(*gei2).get_const(); + + gei2++; + if (gei2) + continue; + + intervals.push_back(Interval(*j, lb, ub)); + } + + merge_intervals(intervals, c, Rs, i); + + // make current region the last one being updated + bool invalid = false; + for (std::list::iterator ii = intervals.begin(); ii != intervals.end(); ii++) + if ((*ii).change && (*ii).pos == i) { + invalid = true; + intervals.push_back(*ii); + intervals.erase(ii); + break; + } + + // update hole condition for each region + for (std::list::iterator ii = intervals.begin(); ii != intervals.end(); ii++) + if ((*ii).change) { + change = true; + + if ((*ii).ub - (*ii).lb + 1 >= (*ii).modulo) + (*(*ii).pos).second = copy(other_cond); + else { + Relation stride_cond = Relation::True((*i).second); + F_Exists *f_exists = stride_cond.and_with_and()->add_exists(); + Variable_ID e = f_exists->declare(); + F_And *f_root = f_exists->add_and(); + GEQ_Handle h1 = f_root->add_GEQ(); + GEQ_Handle h2 = f_root->add_GEQ(); + for (Constr_Vars_Iter cvi2(*gei); cvi2; cvi2++) { + Variable_ID v = cvi2.curr_var(); + switch (v->kind()) { + case Wildcard_Var: + h1.update_coef(e, (*ii).modulo); + h2.update_coef(e, -(*ii).modulo); + break; + case Global_Var: { + Global_Var_ID g = v->get_global_var(); + Variable_ID v2; + if (g->arity() == 0) + v2 = stride_cond.get_local(g); + else + v2 = stride_cond.get_local(g, v->function_of()); + h1.update_coef(v2, cvi2.curr_coef()); + h2.update_coef(v2, -cvi2.curr_coef()); + break; + } + default: + h1.update_coef(v, cvi2.curr_coef()); + h2.update_coef(v, -cvi2.curr_coef()); + } + } + h1.update_const((*ii).ub); + h2.update_const(-(*ii).lb); + + (*(*ii).pos).second = Intersection(copy(other_cond), stride_cond); + (*(*ii).pos).second.simplify(); + } + } + + if (invalid) + break; + } + } + i++; + } + } + } + catch (const presburger_error &e) { + throw e; + } + + Relation R2 = Relation::False(l_R); + for (std::list >::iterator i = Rs.begin(); i != Rs.end(); i++) + R2 = Union(R2, Intersection((*i).first, (*i).second)); + R2.simplify(0, 1); + + return R2; +} + +// +// Use gist and value range to calculate a quick rectangular hull. It +// intends to replace all hull calculations (QuickHull, BetterHull, +// FastTightHull) beyond the method of ConvexHull (dual +// representations). In the future, it will support max(...)-like +// upper bound. So RectHull complements ConvexHull in two ways: first +// for relations that ConvexHull gets too complicated, second for +// relations where different conjuncts have different symbolic upper +// bounds. +// +Relation RectHull(NOT_CONST Relation &Rel) { + Relation R = Approximate(consume_and_regurgitate(Rel)); + if (!R.is_upper_bound_satisfiable()) + return R; + if (R.has_single_conjunct()) + return R; + + std::vector input_names(R.n_inp()); + for (int i = 1; i <= R.n_inp(); i++) + input_names[i-1] = R.input_var(i)->name(); + std::vector output_names(R.n_out()); + for (int i = 1; i <= R.n_out(); i++) + output_names[i-1] = R.output_var(i)->name(); + + DNF_Iterator c(R.query_DNF()); + Relation r = Relation(R, c.curr()); + c++; + std::vector > bounds1(R.n_inp()); + std::vector > bounds2(R.n_out()); + { + Relation t = Project_Sym(copy(r)); + t.simplify(); + for (int i = 1; i <= R.n_inp(); i++) { + Tuple v; + for (int j = 1; j <= R.n_inp(); j++) + if (j != i) + v.append(r.input_var(j)); + for (int j = 1; j <= R.n_out(); j++) + v.append(r.output_var(j)); + Relation t2 = Project(copy(t), v); + t2.query_variable_bounds(t2.input_var(i), bounds1[i-1].first, bounds1[i-1].second); + } + for (int i = 1; i <= R.n_out(); i++) { + Tuple v; + for (int j = 1; j <= R.n_out(); j++) + if (j != i) + v.append(r.output_var(j)); + for (int j = 1; j <= R.n_inp(); j++) + v.append(r.input_var(j)); + Relation t2 = Project(copy(t), v); + t2.query_variable_bounds(t2.output_var(i), bounds2[i-1].first, bounds2[i-1].second); + } + } + + while (c.live()) { + Relation r2 = Relation(R, c.curr()); + c++; + Relation x = Gist(copy(r), Gist(copy(r), copy(r2), 1), 1); + if (Difference(copy(r2), copy(x)).is_upper_bound_satisfiable()) + x = Relation::True(R); + Relation y = Gist(copy(r2), Gist(copy(r2), copy(r), 1), 1); + if (Difference(copy(r), copy(y)).is_upper_bound_satisfiable()) + y = Relation::True(R); + r = Intersection(x, y); + + { + Relation t = Project_Sym(copy(r2)); + t.simplify(); + for (int i = 1; i <= R.n_inp(); i++) { + Tuple v; + for (int j = 1; j <= R.n_inp(); j++) + if (j != i) + v.append(r2.input_var(j)); + for (int j = 1; j <= R.n_out(); j++) + v.append(r2.output_var(j)); + Relation t2 = Project(copy(t), v); + coef_t lbound, ubound; + t2.query_variable_bounds(t2.input_var(i), lbound, ubound); + bounds1[i-1].first = min(bounds1[i-1].first, lbound); + bounds1[i-1].second = max(bounds1[i-1].second, ubound); + } + for (int i = 1; i <= R.n_out(); i++) { + Tuple v; + for (int j = 1; j <= R.n_out(); j++) + if (j != i) + v.append(r2.output_var(j)); + for (int j = 1; j <= R.n_inp(); j++) + v.append(r2.input_var(j)); + Relation t2 = Project(copy(t), v); + coef_t lbound, ubound; + t2.query_variable_bounds(t2.output_var(i), lbound, ubound); + bounds2[i-1].first = min(bounds2[i-1].first, lbound); + bounds2[i-1].second = max(bounds2[i-1].second, ubound); + } + } + + Relation r3(R.n_inp(), R.n_out()); + F_And *f_root = r3.add_and(); + for (int i = 1; i <= R.n_inp(); i++) { + if (bounds1[i-1].first != -posInfinity) { + GEQ_Handle h = f_root->add_GEQ(); + h.update_coef(r3.input_var(i), 1); + h.update_const(-bounds1[i-1].first); + } + if (bounds1[i-1].second != posInfinity) { + GEQ_Handle h = f_root->add_GEQ(); + h.update_coef(r3.input_var(i), -1); + h.update_const(bounds1[i-1].second); + } + } + for (int i = 1; i <= R.n_out(); i++) { + if (bounds2[i-1].first != -posInfinity) { + GEQ_Handle h = f_root->add_GEQ(); + h.update_coef(r3.output_var(i), 1); + h.update_const(-bounds2[i-1].first); + } + if (bounds2[i-1].second != posInfinity) { + GEQ_Handle h = f_root->add_GEQ(); + h.update_coef(r3.output_var(i), -1); + h.update_const(bounds2[i-1].second); + } + } + r = Intersection(r, r3); + r.simplify(); + } + + for (int i = 1; i <= r.n_inp(); i++) + r.name_input_var(i, input_names[i-1]); + for (int i = 1; i <= r.n_out(); i++) + r.name_output_var(i, output_names[i-1]); + r.setup_names(); + return r; +} + +} + diff --git a/omegalib/omega_lib/src/hull_simple.cc b/omegalib/omega_lib/src/hull_simple.cc new file mode 100755 index 0000000..93d8ad3 --- /dev/null +++ b/omegalib/omega_lib/src/hull_simple.cc @@ -0,0 +1,1013 @@ +/***************************************************************************** + Copyright (C) 2011 Chun Chen + All Rights Reserved. + + Purpose: + Hull approximation including lattice and irregular constraints that + involves wildcards. + + Notes: + + History: + 03/12/11 Created by Chun Chen + *****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace omega { + +Relation SimpleHull(const Relation &R, bool allow_stride_constraint, + bool allow_irregular_constraint) { + std::vector Rs; + Rs.push_back(R); + return SimpleHull(Rs, allow_stride_constraint, allow_irregular_constraint); +} + +Relation SimpleHull(const std::vector &Rs, + bool allow_stride_constraint, bool allow_irregular_constraint) { + // check for sanity of parameters + if (Rs.size() == 0) + return Relation::False(0); + int num_dim = -1; + int first_non_null; + for (int i = 0; i < Rs.size(); i++) { + if (Rs[i].is_null()) + continue; + + if (num_dim == -1) { + num_dim = Rs[i].n_inp(); + first_non_null = i; + } + + if (Rs[i].n_inp() != num_dim) + throw std::invalid_argument( + "relations for hull must have same dimension"); + if (Rs[i].n_out() != 0) + throw std::invalid_argument( + "hull calculation must be set relation"); + } + + // convert to a list of relations each with a single conjunct + std::vector l_Rs; + for (int i = 0; i < Rs.size(); i++) { + if (Rs[i].is_null()) + continue; + + Relation r = copy(Rs[i]); + + //r.simplify(2, 4); + r.simplify(); + DNF_Iterator c(r.query_DNF()); + int top = l_Rs.size(); + while (c.live()) { + Relation r2 = Relation(r, c.curr()); + + // quick elimination of redundant conjuncts + bool already_included = false; + for (int j = 0; j < top; j++) + if (Must_Be_Subset(copy(r2), copy(l_Rs[j]))) { + already_included = true; + break; + } else if (Must_Be_Subset(copy(l_Rs[j]), copy(r2))) { + l_Rs.erase(l_Rs.begin() + j); + top--; + break; + } + + if (!already_included) + l_Rs.push_back(r2); + c++; + } + } + + // shortcut for simple case + if (l_Rs.size() == 0) { + if (num_dim == -1) + return Relation::False(0); + else { + Relation r = Relation::False(num_dim); + r.copy_names(Rs[first_non_null]); + r.setup_names(); + return r; + } + } else if (l_Rs.size() == 1) { + if (allow_stride_constraint && allow_irregular_constraint) { + l_Rs[0].copy_names(Rs[first_non_null]); + l_Rs[0].setup_names(); + return l_Rs[0]; + } else if (!allow_stride_constraint && !allow_irregular_constraint) { + l_Rs[0] = Approximate(l_Rs[0]); + l_Rs[0].copy_names(Rs[first_non_null]); + l_Rs[0].setup_names(); + return l_Rs[0]; + } + } + + Relation hull = Relation::True(num_dim); + + // lattice union approximation + if (allow_stride_constraint) { + std::vector > > > strides( + l_Rs.size()); + for (int i = 0; i < l_Rs.size(); i++) + for (EQ_Iterator e = l_Rs[i].single_conjunct()->EQs(); e; e++) + if ((*e).has_wildcards()) { + int num_wildcard = 0; + BoolSet<> affected(num_dim); + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) { + if (cvi.curr_var()->kind() == Wildcard_Var) + num_wildcard++; + else if (cvi.curr_var()->kind() == Input_Var) + affected.set(cvi.curr_var()->get_position() - 1); + } + if (num_wildcard == 1) + strides[i].push_back(std::make_pair(*e, affected)); + } + + for (int i = 0; i < strides[0].size(); i++) { + coef_t c = + abs( + strides[0][i].first.get_coef( + Constr_Vars_Iter(strides[0][i].first, true).curr_var())); + coef_t old_c = c; + bool is_stride = true; + for (int j = 1; j < l_Rs.size(); j++) { + std::list candidates; + for (int k = 0; k < strides[j].size(); k++) + if (!(strides[0][i].second & strides[j][k].second).empty()) { + coef_t t = gcd(c, + abs( + strides[j][k].first.get_coef( + Constr_Vars_Iter( + strides[j][k].first, + true).curr_var()))); + if (t != 1) { + std::list::iterator p = candidates.begin(); + while (p != candidates.end() && *p > t) + ++p; + if (p == candidates.end() || *p != t) + candidates.insert(p, t); + + t = gcd(t, abs(strides[0][i].first.get_const())); + t = gcd(t, abs(strides[j][k].first.get_const())); + if (t != 1) { + std::list::iterator p = + candidates.begin(); + while (p != candidates.end() && *p > t) + ++p; + if (p == candidates.end() || *p != t) + candidates.insert(p, t); + } + } + } + + bool found_matched_stride = false; + for (std::list::iterator k = candidates.begin(); + k != candidates.end(); k++) { + Relation r = Relation::True(num_dim); + EQ_Handle h = r.and_with_EQ(strides[0][i].first); + h.update_coef(Constr_Vars_Iter(h, true).curr_var(), + -old_c + *k); + r.simplify(); + if (Must_Be_Subset(copy(l_Rs[j]), copy(r))) { + c = *k; + found_matched_stride = true; + break; + } + } + + if (!found_matched_stride) { + is_stride = false; + break; + } + } + + if (is_stride) { + Relation r = Relation::True(num_dim); + EQ_Handle h = r.and_with_EQ(strides[0][i].first); + h.update_coef(Constr_Vars_Iter(h, true).curr_var(), -old_c + c); + r.simplify(); + hull = Intersection(hull, r); + } + } + } + + // consider some special wildcard constraints + if (allow_irregular_constraint) { + std::vector< + std::vector< + std::pair > > > ranges( + l_Rs.size()); + for (int i = 0; i < l_Rs.size(); i++) { + std::vector > > geqs_ub; + std::vector > > geqs_lb; + for (GEQ_Iterator e = l_Rs[i].single_conjunct()->GEQs(); e; e++) + if ((*e).has_wildcards()) { + int num_wildcard = 0; + std::map formula; + int direction; + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) { + Variable_ID v = cvi.curr_var(); + switch (v->kind()) { + case Wildcard_Var: + num_wildcard++; + if (cvi.curr_coef() > 0) + direction = true; + else + direction = false; + break; + case Input_Var: + case Global_Var: + formula[cvi.curr_var()] = cvi.curr_coef(); + break; + default: + assert(false); + } + } + if (num_wildcard == 1) { + if (direction) { + for (std::map::iterator j = + formula.begin(); j != formula.end(); j++) + j->second = -j->second; + geqs_ub.push_back(std::make_pair(*e, formula)); + } else + geqs_lb.push_back(std::make_pair(*e, formula)); + } + } + for (int j = 0; j < geqs_lb.size(); j++) { + Variable_ID v = + Constr_Vars_Iter(geqs_lb[j].first, true).curr_var(); + for (int k = 0; k < geqs_ub.size(); k++) + if (v == Constr_Vars_Iter(geqs_ub[k].first, true).curr_var() + && geqs_lb[j].second == geqs_ub[k].second) + ranges[i].push_back( + std::make_pair(v, geqs_lb[j].second)); + } + } + + // find compatible wildcard match + // TODO: evaluate to find the best match, also avoid mapping two wildcards + // in a single conjunct to one variable (incorrect) + std::vector > all_match; + for (int i = 0; i < ranges[0].size(); i++) { + std::vector match(l_Rs.size(), -1); + match[0] = i; + for (int j = 1; j < l_Rs.size(); j++) { + for (int k = 0; k < ranges[j].size(); k++) + if (ranges[0][i].second == ranges[j][k].second) { + match[j] = k; + break; + } + if (match[j] == -1) + break; + } + if (match[l_Rs.size() - 1] != -1) + all_match.push_back(match); + } + + // map compatible wildcards to input variables + std::vector ll_Rs(l_Rs.size()); + for (int i = 0; i < l_Rs.size(); i++) { + Relation r(num_dim + all_match.size()); + F_Exists *f_exists = r.add_and()->add_exists(); + F_And *f_root = f_exists->add_and(); + std::map wc_map; + for (int j = 0; j < all_match.size(); j++) + wc_map[ranges[i][all_match[j][i]].first] = r.set_var(j + 1); + + for (EQ_Iterator e(l_Rs[i].single_conjunct()->EQs()); e; e++) + if (!(*e).has_wildcards()) { + EQ_Handle h = f_root->add_EQ(); + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) + switch (cvi.curr_var()->kind()) { + case Input_Var: { + h.update_coef( + r.set_var( + cvi.curr_var()->get_position() + + all_match.size()), + cvi.curr_coef()); + break; + } + case Global_Var: { + Global_Var_ID g = cvi.curr_var()->get_global_var(); + Variable_ID v; + if (g->arity() == 0) + v = r.get_local(g); + else + v = r.get_local(g, + cvi.curr_var()->function_of()); + h.update_coef(v, cvi.curr_coef()); + break; + } + default: + assert(false); + } + h.update_const((*e).get_const()); + } + + for (GEQ_Iterator e(l_Rs[i].single_conjunct()->GEQs()); e; e++) { + GEQ_Handle h = f_root->add_GEQ(); + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) + switch (cvi.curr_var()->kind()) { + case Input_Var: { + h.update_coef( + r.set_var( + cvi.curr_var()->get_position() + + all_match.size()), + cvi.curr_coef()); + break; + } + case Global_Var: { + Global_Var_ID g = cvi.curr_var()->get_global_var(); + Variable_ID v; + if (g->arity() == 0) + v = r.get_local(g); + else + v = r.get_local(g, cvi.curr_var()->function_of()); + h.update_coef(v, cvi.curr_coef()); + break; + } + case Wildcard_Var: { + std::map::iterator p = + wc_map.find(cvi.curr_var()); + Variable_ID v; + if (p == wc_map.end()) { + v = f_exists->declare(); + wc_map[cvi.curr_var()] = v; + } else + v = p->second; + h.update_coef(v, cvi.curr_coef()); + break; + } + default: + assert(false); + } + h.update_const((*e).get_const()); + } + + r.simplify(); + ll_Rs[i] = r; + } + + // now use SimpleHull on regular bounds only + Relation result = SimpleHull(ll_Rs, false, false); + + // convert imaginary input variables back to wildcards + Relation mapping(num_dim + all_match.size(), num_dim); + F_And *f_root = mapping.add_and(); + for (int i = 0; i < num_dim; i++) { + EQ_Handle h = f_root->add_EQ(); + h.update_coef(mapping.input_var(all_match.size() + i + 1), 1); + h.update_coef(mapping.output_var(i + 1), -1); + } + result = Range(Restrict_Domain(mapping, result)); + + hull = Intersection(hull, result); + hull.simplify(); + hull.copy_names(Rs[first_non_null]); + hull.setup_names(); + return hull; + } + + // check regular bounds + if (l_Rs.size() == 1) { + hull = Intersection(hull, Approximate(copy(l_Rs[0]))); + } else { + for (int i = 0; i < l_Rs.size(); i++) { + l_Rs[i] = Approximate(l_Rs[i]); + l_Rs[i].simplify(2, 4); + } + + // check global variables + // TODO: global variable function_of() is not considered for now + std::map globals; + for (int i = 0; i < l_Rs.size(); i++) + for (Constraint_Iterator e( + l_Rs[i].single_conjunct()->constraints()); e; e++) + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) + if (cvi.curr_var()->kind() == Global_Var) + globals[cvi.curr_var()->get_global_var()] = -1; + + if (globals.size() > 0) { + int count = 1; + for (std::map::iterator i = globals.begin(); + i != globals.end(); i++) + i->second = count++; + + std::vector ll_Rs(l_Rs.size()); + for (int i = 0; i < l_Rs.size(); i++) { + Relation r(num_dim + globals.size()); + F_And *f_root = r.add_and(); + for (EQ_Iterator e(l_Rs[i].single_conjunct()->EQs()); e; e++) { + EQ_Handle h = f_root->add_EQ(); + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) + switch (cvi.curr_var()->kind()) { + case Input_Var: { + h.update_coef( + r.set_var( + cvi.curr_var()->get_position() + + globals.size()), + cvi.curr_coef()); + break; + } + case Global_Var: { + h.update_coef( + r.set_var( + globals[cvi.curr_var()->get_global_var()]), + cvi.curr_coef()); + break; + } + default: + assert(false); + } + h.update_const((*e).get_const()); + } + for (GEQ_Iterator e(l_Rs[i].single_conjunct()->GEQs()); e; + e++) { + GEQ_Handle h = f_root->add_GEQ(); + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) + switch (cvi.curr_var()->kind()) { + case Input_Var: { + h.update_coef( + r.set_var( + cvi.curr_var()->get_position() + + globals.size()), + cvi.curr_coef()); + break; + } + case Global_Var: { + h.update_coef( + r.set_var( + globals[cvi.curr_var()->get_global_var()]), + cvi.curr_coef()); + break; + } + default: + assert(false); + } + h.update_const((*e).get_const()); + } + + ll_Rs[i] = r; + } + + Relation result = SimpleHull(ll_Rs, false, false); + + std::map globals_reverse; + for (std::map::iterator i = globals.begin(); + i != globals.end(); i++) + globals_reverse[i->second] = i->first; + + Relation r(num_dim); + F_And *f_root = r.add_and(); + for (EQ_Iterator e(result.single_conjunct()->EQs()); e; e++) { + EQ_Handle h = f_root->add_EQ(); + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) + switch (cvi.curr_var()->kind()) { + case Input_Var: { + int pos = cvi.curr_var()->get_position(); + if (pos > globals_reverse.size()) + h.update_coef( + r.set_var(pos - globals_reverse.size()), + cvi.curr_coef()); + else { + Global_Var_ID g = globals_reverse[pos]; + h.update_coef(r.get_local(g), cvi.curr_coef()); + } + break; + } + default: + assert(false); + } + h.update_const((*e).get_const()); + } + for (GEQ_Iterator e(result.single_conjunct()->GEQs()); e; e++) { + GEQ_Handle h = f_root->add_GEQ(); + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) + switch (cvi.curr_var()->kind()) { + case Input_Var: { + int pos = cvi.curr_var()->get_position(); + if (pos > globals_reverse.size()) + h.update_coef( + r.set_var(pos - globals_reverse.size()), + cvi.curr_coef()); + else { + Global_Var_ID g = globals_reverse[pos]; + h.update_coef(r.get_local(g), cvi.curr_coef()); + } + break; + } + default: + assert(false); + } + h.update_const((*e).get_const()); + } + + hull = Intersection(hull, r); + hull.simplify(); + hull.copy_names(Rs[first_non_null]); + hull.setup_names(); + return hull; + } else { + std::vector > projected(num_dim + 1, + std::vector(l_Rs.size())); + for (int i = 0; i < l_Rs.size(); i++) { + projected[num_dim][i] = copy(l_Rs[i]); + for (int j = num_dim - 1; j >= 0; j--) { + projected[j][i] = Project(copy(projected[j + 1][i]), + projected[j + 1][i].input_var(j + 1)); + projected[j][i].simplify(2, 4); + } + } + + std::vector has_lb(num_dim, false); + std::vector has_ub(num_dim, false); + for (int i = 0; i < num_dim; i++) { + bool skip_lb = false; + bool skip_ub = false; + std::vector bound(l_Rs.size()); + for (int j = 0; j < l_Rs.size(); j++) { + bound[j] = Gist(copy(projected[i + 1][j]), + copy(projected[i][j]), 1); + bound[j] = Approximate(bound[j]); + bound[j] = EQs_to_GEQs(bound[j]); + + bool has_lb_not_in_hull = false; + bool has_ub_not_in_hull = false; + for (GEQ_Iterator e = bound[j].single_conjunct()->GEQs(); e; + e++) { + coef_t coef = (*e).get_coef(bound[j].input_var(i + 1)); + if (!skip_lb && coef > 0) { + Relation r = Relation::True(bound[j].n_inp()); + r.and_with_GEQ(*e); + r.simplify(); + + if (j != 0 && l_Rs.size() > 2 + && Must_Be_Subset(copy(hull), copy(r))) + continue; + + bool belong_to_hull = true; + for (int k = 0; k < l_Rs.size(); k++) + if (k != j + && !Must_Be_Subset(copy(l_Rs[k]), + copy(r))) { + belong_to_hull = false; + break; + } + if (belong_to_hull) { + hull.and_with_GEQ(*e); + has_lb[i] = true; + } else + has_lb_not_in_hull = true; + } else if (!skip_ub && coef < 0) { + Relation r = Relation::True(bound[j].n_inp()); + r.and_with_GEQ(*e); + r.simplify(); + + if (j != 0 && l_Rs.size() > 2 + && Must_Be_Subset(copy(hull), copy(r))) + continue; + + bool belong_to_hull = true; + for (int k = 0; k < l_Rs.size(); k++) + if (k != j + && !Must_Be_Subset(copy(l_Rs[k]), + copy(r))) { + belong_to_hull = false; + break; + } + if (belong_to_hull) { + hull.and_with_GEQ(*e); + has_ub[i] = true; + } else + has_ub_not_in_hull = true; + } + } + + if (!has_lb_not_in_hull) + skip_lb = true; + if (!has_ub_not_in_hull) + skip_ub = true; + if (skip_lb && skip_ub) + break; + } + + // no ready lower bound, approximate it + bool got_rect_lb = false; + if (!skip_lb) { + for (int j = 0; j < l_Rs.size(); j++) { + std::set > S; + for (GEQ_Iterator e = + bound[j].single_conjunct()->GEQs(); e; e++) { + coef_t coef = (*e).get_coef( + bound[j].input_var(i + 1)); + if (coef > 0) { + BoolSet<> s(i); + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) + if ((*cvi).var->kind() == Input_Var + && (*cvi).var->get_position() - 1 + != i) { + if (((*cvi).coef > 0 + && has_ub[(*cvi).var->get_position() + - 1]) + || ((*cvi).coef < 0 + && has_lb[(*cvi).var->get_position() + - 1])) + s.set( + (*cvi).var->get_position() + - 1); + else { + for (GEQ_Iterator e2 = + bound[j].single_conjunct()->GEQs(); + e2; e2++) + if (e2 != e + && (((*cvi).coef > 0 + && (*e2).get_coef( + (*cvi).var) + < 0) + || ((*cvi).coef + < 0 + && (*e2).get_coef( + (*cvi).var) + > 0))) { + s.set( + (*cvi).var->get_position() + - 1); + break; + } + } + } + + if (s.num_elem() > 0) + S.insert(s); + } + } + + if (S.size() > 0) { + BoolSet<> s(i); + for (std::set >::iterator k = S.begin(); + k != S.end(); k++) + s |= *k; + for (int k = 0; k < i; k++) + if (s.get(k)) { + BoolSet<> t(i); + t.set(k); + S.insert(t); + } + + for (std::set >::iterator k = S.begin(); + k != S.end(); k++) { + + bool do_again = false; + std::set vars; + int round_trip = 0; + do { + Relation r = copy(projected[i + 1][j]); + + if (!do_again) { + for (int kk = 0; kk < i; kk++) + if ((*k).get(kk)) { + r = Project(r, + r.input_var(kk + 1)); + vars.insert(kk + 1); + } + } else { + for (std::set::iterator vars_it = + vars.begin(); + vars_it != vars.end(); + vars_it++) + if (*vars_it < i + 1) + r = Project(r, + r.input_var(*vars_it)); + } + + r.simplify(2, 4); + Relation r2 = Project(copy(r), + r.input_var(i + 1)); + Relation b = Gist(copy(r), copy(r2), 1); + // Relation c = Project(copy(r),r.input_var(4) ); + + // c.simplify(2,4); + // Relation d = Project(copy(c), r.input_var(i+1)); + // Relation e = Gist(copy(c), copy(d), 1); + + b = Approximate(b); + b = EQs_to_GEQs(b); + + for (GEQ_Iterator e = + b.single_conjunct()->GEQs(); e; + e++) { + coef_t coef = (*e).get_coef( + b.input_var(i + 1)); + if (coef > 0) { + Relation r = Relation::True( + b.n_inp()); + r.and_with_GEQ(*e); + r.simplify(); + + if (Must_Be_Subset(copy(hull), + copy(r))) + continue; + + bool belong_to_hull = true; + for (int k = 0; k < l_Rs.size(); + k++) + if (k != j + && !Must_Be_Subset( + copy(l_Rs[k]), + copy(r))) { + belong_to_hull = false; + break; + } + if (belong_to_hull) { + hull.and_with_GEQ(*e); + got_rect_lb = true; + } + } + } + do_again = false; + if (!got_rect_lb) { + bool found = false; + for (GEQ_Iterator e = + b.single_conjunct()->GEQs(); e; + e++) { + coef_t coef = (*e).get_coef( + b.input_var(i + 1)); + + if (coef > 0) { + for (Constr_Vars_Iter cvi(*e); + cvi; cvi++) + if ((*cvi).var->kind() + == Input_Var + && (*cvi).var->get_position() + - 1 != i) { + + if (((*cvi).coef > 0 + && has_ub[(*cvi).var->get_position() + - 1]) + || ((*cvi).coef + < 0 + && has_lb[(*cvi).var->get_position() + - 1])) { + vars.insert( + (*cvi).var->get_position()); + found = true; + } else { + for (GEQ_Iterator e2 = + b.single_conjunct()->GEQs(); + e2; e2++) + if (e2 != e + && (((*cvi).coef + > 0 + && (*e2).get_coef( + (*cvi).var) + < 0) + || ((*cvi).coef + < 0 + && (*e2).get_coef( + (*cvi).var) + > 0))) { + vars.insert( + (*cvi).var->get_position()); + found = + true; + break; + } + } + + } + + } + if (found) + break; + + } + if (found && (round_trip < i)) + do_again = true; + + } + round_trip++; + } while (do_again); + } + + if (got_rect_lb) + break; + } + } + } + + // no ready upper bound, approximate it + bool got_rect_ub = false; + if (!skip_ub) { + for (int j = 0; j < l_Rs.size(); j++) { + std::set > S; + for (GEQ_Iterator e = + bound[j].single_conjunct()->GEQs(); e; e++) { + coef_t coef = (*e).get_coef( + bound[j].input_var(i + 1)); + if (coef < 0) { + BoolSet<> s(i); + for (Constr_Vars_Iter cvi(*e); cvi; cvi++) + if ((*cvi).var->kind() == Input_Var + && (*cvi).var->get_position() - 1 + != i) { + if (((*cvi).coef > 0 + && has_ub[(*cvi).var->get_position() + - 1]) + || ((*cvi).coef < 0 + && has_lb[(*cvi).var->get_position() + - 1])) + s.set( + (*cvi).var->get_position() + - 1); + else { + for (GEQ_Iterator e2 = + bound[j].single_conjunct()->GEQs(); + e2; e2++) + if (e2 != e + && (((*cvi).coef > 0 + && (*e2).get_coef( + (*cvi).var) + < 0) + || ((*cvi).coef + < 0 + && (*e2).get_coef( + (*cvi).var) + > 0))) { + s.set( + (*cvi).var->get_position() + - 1); + break; + } + } + } + + if (s.num_elem() > 0) + S.insert(s); + } + } + + if (S.size() > 0) { + BoolSet<> s(i); + for (std::set >::iterator k = S.begin(); + k != S.end(); k++) + s |= *k; + for (int k = 0; k < i; k++) + if (s.get(k)) { + BoolSet<> t(i); + t.set(k); + S.insert(t); + } + + for (std::set >::iterator k = S.begin(); + k != S.end(); k++) { + + bool do_again = false; + std::set vars; + int round_trip = 0; + do { + + Relation r = copy(projected[i + 1][j]); + + if (!do_again) { + for (int kk = 0; kk < i; kk++) + if ((*k).get(kk)) { + r = Project(r, + r.input_var(kk + 1)); + vars.insert(kk + 1); + } + } else { + for (std::set::iterator vars_it = + vars.begin(); + vars_it != vars.end(); + vars_it++) + if (*vars_it < i + 1) + r = Project(r, + r.input_var(*vars_it)); + } + + r.simplify(2, 4); + Relation r2 = Project(copy(r), + r.input_var(i + 1)); + // r2.simplify(2,4); + Relation b = Gist(r, r2, 1); + b = Approximate(b); + b = EQs_to_GEQs(b); + + for (GEQ_Iterator e = + b.single_conjunct()->GEQs(); e; + e++) { + coef_t coef = (*e).get_coef( + b.input_var(i + 1)); + if (coef < 0) { + Relation r = Relation::True( + b.n_inp()); + r.and_with_GEQ(*e); + r.simplify(); + + if (Must_Be_Subset(copy(hull), + copy(r))) + continue; + + bool belong_to_hull = true; + for (int k = 0; k < l_Rs.size(); + k++) + if (k != j + && !Must_Be_Subset( + copy(l_Rs[k]), + copy(r))) { + belong_to_hull = false; + break; + } + if (belong_to_hull) { + hull.and_with_GEQ(*e); + got_rect_ub = true; + } + } + } + do_again = false; + if (!got_rect_ub) { + bool found = false; + for (GEQ_Iterator e = + b.single_conjunct()->GEQs(); e; + e++) { + coef_t coef = (*e).get_coef( + b.input_var(i + 1)); + if (coef < 0) { + for (Constr_Vars_Iter cvi(*e); + cvi; cvi++) + if ((*cvi).var->kind() + == Input_Var + && (*cvi).var->get_position() + - 1 != i) { + + if (((*cvi).coef > 0 + && has_ub[(*cvi).var->get_position() + - 1]) + || ((*cvi).coef + < 0 + && has_lb[(*cvi).var->get_position() + - 1])) { + vars.insert( + (*cvi).var->get_position()); + found = true; + } else { + for (GEQ_Iterator e2 = + b.single_conjunct()->GEQs(); + e2; e2++) + if (e2 != e + && (((*cvi).coef + > 0 + && (*e2).get_coef( + (*cvi).var) + < 0) + || ((*cvi).coef + < 0 + && (*e2).get_coef( + (*cvi).var) + > 0))) { + vars.insert( + (*cvi).var->get_position()); + found = + true; + break; + } + } + + } + } + if (found) + break; + } + if (found && (round_trip < i)) + do_again = true; + + } + round_trip++; + } while (do_again); + } + + if (got_rect_ub) + break; + } + } + } + } + } + } + + hull.simplify(); + hull.copy_names(Rs[first_non_null]); + hull.setup_names(); + return hull; +} + +} + diff --git a/omegalib/omega_lib/src/omega_core/oc.cc b/omegalib/omega_lib/src/omega_core/oc.cc new file mode 100644 index 0000000..0dc9b49 --- /dev/null +++ b/omegalib/omega_lib/src/omega_core/oc.cc @@ -0,0 +1,754 @@ +/***************************************************************************** + Copyright (C) 1994-2000 the Omega Project Team + Copyright (C) 2005-2011 Chun Chen + All Rights Reserved. + + Purpose: + Simplify a problem. + + Notes: + + History: + 12/10/06 Improved gist function, by Chun Chen. +*****************************************************************************/ + +#include + +namespace omega { + +eqn SUBs[maxVars+1]; +Memory redMemory[maxVars+1]; + +int Problem::reduceProblem() { + int result; + checkVars(nVars+1); + assert(omegaInitialized); + if (nVars > nEQs + 3 * safeVars) + freeEliminations(safeVars); + + check(); + if (!mayBeRed && nSUBs == 0 && safeVars == 0) { + result = solve(OC_SOLVE_UNKNOWN); + nGEQs = 0; + nEQs = 0; + nSUBs = 0; + nMemories = 0; + if (!result) { + int e = newEQ(); + assert(e == 0); + eqnnzero(&EQs[0], nVars); + EQs[0].color = EQ_BLACK; + EQs[0].coef[0] = 1; + } + check(); + return result; + } + return solve(OC_SOLVE_SIMPLIFY); +} + + +int Problem::simplifyProblem(int verify, int subs, int redundantElimination) { + checkVars(nVars+1); + assert(omegaInitialized); + setInternals(); + check(); + if (!reduceProblem()) goto returnFalse; + if (verify) { + addingOuterEqualities++; + int r = verifyProblem(); + addingOuterEqualities--; + if (!r) goto returnFalse; + if (nEQs) { // found some equality constraints during verification + int numRed = 0; + if (mayBeRed) + for (int e = nGEQs - 1; e >= 0; e--) if (GEQs[e].color == EQ_RED) numRed++; + if (mayBeRed && nVars == safeVars && numRed == 1) + nEQs = 0; // discard them + else if (!reduceProblem()) { + assert(0 && "Added equality constraint to verified problem generates false"); + } + } + } + if (redundantElimination) { + if (redundantElimination > 1) { + if (!expensiveEqualityCheck()) goto returnFalse; + } + if (!quickKill(0)) goto returnFalse; + if (redundantElimination > 1) { + if (!expensiveKill()) goto returnFalse; + } + } + resurrectSubs(); + if (redundantElimination) + simplifyStrideConstraints(); + if (redundantElimination > 2 && safeVars < nVars) { + if (!quickKill(0)) goto returnFalse; + return simplifyProblem(verify, subs, redundantElimination-2); + } + setExternals(); + assert(nMemories == 0); + return (1); + +returnFalse: + nGEQs = 0; + nEQs = 0; + resurrectSubs(); + nGEQs = 0; + nEQs = 0; + int neweq = newEQ(); + assert(neweq == 0); + eqnnzero(&EQs[neweq], nVars); + EQs[neweq].color = EQ_BLACK; + EQs[neweq].coef[0] = 1; + nMemories = 0; + return 0; +} + +int Problem::simplifyApproximate(bool strides_allowed) { + int result; + checkVars(nVars+1); + assert(inApproximateMode == 0); + + inApproximateMode = 1; + inStridesAllowedMode = strides_allowed; + if (TRACE) + fprintf(outputFile, "Entering Approximate Mode [\n"); + + assert(omegaInitialized); + result = simplifyProblem(0,0,0); + + while (result && !strides_allowed && nVars > safeVars) { + int e; + for (e = nGEQs - 1; e >= 0; e--) + if (GEQs[e].coef[nVars]) deleteGEQ(e); + for (e = nEQs - 1; e >= 0; e--) + if (EQs[e].coef[nVars]) deleteEQ(e); + nVars--; + result = simplifyProblem(0,0,0); + } + + if (TRACE) + fprintf(outputFile, "] Leaving Approximate Mode\n"); + + assert(inApproximateMode == 1); + inApproximateMode=0; + inStridesAllowedMode = 0; + + assert(nMemories == 0); + return (result); +} + + + + +/* + * Return 1 if red equations constrain the set of possible + * solutions. We assume that there are solutions to the black + * equations by themselves, so if there is no solution to the combined + * problem, we return 1. + */ + +#ifdef GIST_CHECK +Problem full_answer, context; +Problem redProblem; +#endif + +redCheck Problem::redSimplifyProblem(int effort, int computeGist) { + int result; + int e; + + checkVars(nVars+1); + assert(mayBeRed >= 0); + mayBeRed++; + + assert(omegaInitialized); + if (TRACE) { + fprintf(outputFile, "Checking for red equations:\n"); + printProblem(); + } + setInternals(); + +#ifdef GIST_CHECK + int r1,r2; + if (TRACE) + fprintf(outputFile,"Set-up for gist invariant checking[\n"); + redProblem = *this; + redProblem.check(); + full_answer = *this; + full_answer.check(); + full_answer.turnRedBlack(); + full_answer.check(); + r1 = full_answer.simplifyProblem(1,0,1); + full_answer.check(); + if (DBUG) fprintf(outputFile,"Simplifying context [\n"); + context = *this; + context.check(); + context.deleteRed(); + context.check(); + r2 = context.simplifyProblem(1,0,1); + context.check(); + if (DBUG) fprintf(outputFile,"] Simplifying context\n"); + + if (!r2 && TRACE) fprintf(outputFile, "WARNING: Gist context is false!\n"); + if (TRACE) + fprintf(outputFile,"] Set-up for gist invariant checking done\n"); +#endif + + // Save known integer modular equations, -- by chun 12/10/2006 + eqn ModularEQs[nEQs]; + int nModularEQs = 0; + int old_nVars = nVars; + for (int e = 0; e < nEQs; e++) + if (EQs[e].color != EQ_RED) + for (int i = safeVars+1; i <= nVars; i++) + if (EQs[e].coef[i] != 0) { + eqnncpy(&(ModularEQs[nModularEQs++]), &(EQs[e]), nVars); + break; + } + + + if (solveEQ() == false) { + if (TRACE) + fprintf(outputFile, "Gist is FALSE\n"); + if (computeGist) { + nMemories = 0; + nGEQs = 0; + nEQs = 0; + resurrectSubs(); + nGEQs = 0; + nEQs = 0; + int neweq = newEQ(); + assert(neweq == 0); + eqnnzero(&EQs[neweq], nVars); + EQs[neweq].color = EQ_RED; + EQs[neweq].coef[0] = 1; + } + mayBeRed--; + return redFalse; + } + + if (!computeGist && nMemories) + return redConstraints; + if (normalize() == normalize_false) { + if (TRACE) + fprintf(outputFile, "Gist is FALSE\n"); + if (computeGist) { + nGEQs = 0; + nEQs = 0; + resurrectSubs(); + nMemories = 0; + nGEQs = 0; + nEQs = 0; + int neweq = newEQ(); + assert(neweq == 0); + eqnnzero(&EQs[neweq], nVars); + EQs[neweq].color = EQ_RED; + EQs[neweq].coef[0] = 1; + } + mayBeRed--; + return redFalse; + } + + result = 0; + for (e = nGEQs - 1; e >= 0; e--) if (GEQs[e].color == EQ_RED) result = 1; + for (e = nEQs - 1; e >= 0; e--) if (EQs[e].color == EQ_RED) result = 1; + if (nMemories) result = 1; + if (!result) { + if (computeGist) { + nGEQs = 0; + nEQs = 0; + resurrectSubs(); + nGEQs = 0; + nMemories = 0; + nEQs = 0; + } + mayBeRed--; + return noRed; + } + + result = simplifyProblem(effort?1:0,1,0); +#ifdef GIST_CHECK + if (!r1 && TRACE && result) + fprintf(outputFile, "Gist is False but not detected\n"); +#endif + if (!result) { + if (TRACE) + fprintf(outputFile, "Gist is FALSE\n"); + if (computeGist) { + nGEQs = 0; + nEQs = 0; + resurrectSubs(); + nGEQs = 0; + nEQs = 0; + int neweq = newEQ(); + assert(neweq == 0); + nMemories = 0; + eqnnzero(&EQs[neweq], nVars); + EQs[neweq].color = EQ_RED; + EQs[neweq].coef[0] = 1; + } + mayBeRed--; + return redFalse; + } + + freeRedEliminations(); + + result = 0; + for (e = nGEQs - 1; e >= 0; e--) if (GEQs[e].color == EQ_RED) result = 1; + for (e = nEQs - 1; e >= 0; e--) if (EQs[e].color == EQ_RED) result = 1; + if (nMemories) result = 1; + if (!result) { + if (computeGist) { + nGEQs = 0; + nEQs = 0; + resurrectSubs(); + nGEQs = 0; + nMemories = 0; + nEQs = 0; + } + mayBeRed--; + return noRed; + } + + if (effort && (computeGist || !nMemories)) { + if (TRACE) + fprintf(outputFile, "*** Doing potentially expensive elimination tests for red equations [\n"); + quickRedKill(computeGist); + checkGistInvariant(); + result = nMemories; + for (e = nGEQs - 1; e >= 0; e--) if (GEQs[e].color == EQ_RED) result++; + for (e = nEQs - 1; e >= 0; e--) if (EQs[e].color == EQ_RED) result++; + if (result && effort > 1 && (computeGist || !nMemories)) { + expensiveRedKill(); + result = nMemories; + for (e = nGEQs-1; e >= 0; e--) if (GEQs[e].color == EQ_RED) result++; + for (e = nEQs-1; e >= 0; e--) if (EQs[e].color == EQ_RED) result++; + } + + if (!result) { + if (TRACE) + fprintf(outputFile, "]******************** Redudant Red Equations eliminated!!\n"); + if (computeGist) { + nGEQs = 0; + nEQs = 0; + resurrectSubs(); + nGEQs = 0; + nMemories = 0; + nEQs = 0; + } + mayBeRed--; + return noRed; + } + + if (TRACE) fprintf(outputFile, "]******************** Red Equations remain\n"); + if (DEBUG) printProblem(); + } + + if (computeGist) { + resurrectSubs(); + cleanoutWildcards(); + + + // Restore saved modular equations into EQs without affecting the problem + if (nEQs+nModularEQs > allocEQs) { + allocEQs = padEQs(allocEQs, nEQs+nModularEQs); + eqn *new_eqs = new eqn[allocEQs]; + for (int e = 0; e < nEQs; e++) + eqnncpy(&(new_eqs[e]), &(EQs[e]), nVars); + delete[] EQs; + EQs= new_eqs; + } + + for (int e = 0; e < nModularEQs; e++) { + eqnncpy(&(EQs[nEQs+e]), &(ModularEQs[e]), old_nVars); + EQs[nEQs+e].color = EQ_RED; + Tuple t(safeVars); + for (int i = 1; i <= safeVars; i++) + t[i] = ModularEQs[e].coef[var[i]]; + for (int i = 1; i <= safeVars; i++) + EQs[nEQs+e].coef[i] = t[i]; + } + + + // Now simplify modular equations using Chinese remainder theorem -- by chun 12/10/2006 + for (int e = 0; e < nEQs; e++) + if (EQs[e].color == EQ_RED) { + int wild_pos = -1; + for (int i = safeVars+1; i <= nVars; i++) + if (EQs[e].coef[i] != 0) { + wild_pos = i; + break; + } + + if (wild_pos == -1) + continue; + + for (int e2 = e+1; e2 < nEQs+nModularEQs; e2++) + if (EQs[e2].color == EQ_RED) { + int wild_pos2 = -1; + for (int i = safeVars+1; i <= ((e20?1:-1)*g4; + } + } + } + + deleteBlack(); + } + + setExternals(); + mayBeRed--; + assert(nMemories == 0); + return redConstraints; +} + + +void Problem::convertEQstoGEQs(bool excludeStrides) { + int i; + int e; + if (DBUG) + fprintf(outputFile, "Converting all EQs to GEQs\n"); + simplifyProblem(0,0,0); + for(e=0;e working_on(safeVars); + for (int i = 1; i <= safeVars; i++) + working_on[i] = false; + + return query_variable_mod(v, factor, color, nModularEQs, nModularVars, working_on); +} + +coef_t Problem::query_variable_mod(int v, coef_t factor, int color, int nModularEQs, int nModularVars, Tuple &working_on) const { + working_on[v] = true; + + for (int e = 0; e < nEQs+nModularEQs; e++) + if (EQs[e].color == color) { + coef_t coef = int_mod_hat(EQs[e].coef[v], factor); + if (abs(coef) != 1) + continue; + + bool wild_factored = true; + for (int i = safeVars+1; i <= ((echeck(); + p2->check(); + p1->resurrectSubs(); + p2->resurrectSubs(); + p1->check(); + p2->check(); + p1->putVariablesInStandardOrder(); + p2->putVariablesInStandardOrder(); + p1->check(); + p2->check(); + p1->ordered_elimination(0); + p2->ordered_elimination(0); + p1->check(); + p2->check(); + r1 = p1->simplifyProblem(1,1,0); + r2 = p2->simplifyProblem(1,1,0); + p1->check(); + p2->check(); + + if (!r1 || !r2) { + if (r1 == r2) return apparentlyEqual; + return NotEqual; + } + if (p1->nVars != p2->nVars + || p1->nGEQs != p2->nGEQs + || p1->nSUBs != p2->nSUBs + || p1->checkSum() != p2->checkSum()) { + r1 = p1->simplifyProblem(0,1,1); + r2 = p2->simplifyProblem(0,1,1); + assert(r1 && r2); + p1->check(); + p2->check(); + if (p1->nVars != p2->nVars + || p1->nGEQs != p2->nGEQs + || p1->nSUBs != p2->nSUBs + || p1->checkSum() != p2->checkSum()) { + r1 = p1->simplifyProblem(0,1,2); + r2 = p2->simplifyProblem(0,1,2); + p1->check(); + p2->check(); + assert(r1 && r2); + if (p1->nVars != p2->nVars + || p1->nGEQs != p2->nGEQs + || p1->nSUBs != p2->nSUBs + || p1->checkSum() != p2->checkSum()) { + p1->check(); + p2->check(); + p1->resurrectSubs(); + p2->resurrectSubs(); + p1->check(); + p2->check(); + p1->putVariablesInStandardOrder(); + p2->putVariablesInStandardOrder(); + p1->check(); + p2->check(); + p1->ordered_elimination(0); + p2->ordered_elimination(0); + p1->check(); + p2->check(); + r1 = p1->simplifyProblem(1,1,0); + r2 = p2->simplifyProblem(1,1,0); + p1->check(); + p2->check(); + } + } + } + + if (p1->nVars != p2->nVars + || p1->nSUBs != p2->nSUBs + || p1->nGEQs != p2->nGEQs + || p1->nSUBs != p2->nSUBs) return NotEqual; + if (p1->checkSum() != p2->checkSum()) return mightNotBeEqual; + return apparentlyEqual; +} +#endif + +void Problem::checkGistInvariant() const { +#ifdef GIST_CHECK + Problem new_answer; + int r; + + check(); + fullAnswer.check(); + context.check(); + + if (safeVars < nVars) { + if (DBUG) { + fprintf(outputFile,"Can't check gist invariant due to wildcards\n"); + printProblem(); + } + return; + } + if (DBUG) { + fprintf(outputFile,"Checking gist invariant on: [\n"); + printProblem(); + } + + new_answer = *this; + new_answer->resurrectSubs(); + new_answer->cleanoutWildcards(); + if (DEBUG) { + fprintf(outputFile,"which is: \n"); + printProblem(); + } + deleteBlack(&new_answer); + turnRedBlack(&new_answer); + if (DEBUG) { + fprintf(outputFile,"Black version of answer: \n"); + printProblem(&new_answer); + } + problem_merge(&new_answer,&context); + + r = checkEquiv(&full_answer,&new_answer); + if (r != apparentlyEqual) { + fprintf(outputFile,"GIST INVARIANT REQUIRES MANUAL CHECK:[\n"); + fprintf(outputFile,"Original problem:\n"); + printProblem(&redProblem); + + fprintf(outputFile,"Context:\n"); + printProblem(&context); + + fprintf(outputFile,"Computed gist:\n"); + printProblem(); + + fprintf(outputFile,"Combined answer:\n"); + printProblem(&full_answer); + + fprintf(outputFile,"Context && red constraints:\n"); + printProblem(&new_answer); + fprintf(outputFile,"]\n"); + } + + if (DBUG) { + fprintf(outputFile,"] Done checking gist invariant on\n"); + } +#endif +} + +} // namespace diff --git a/omegalib/omega_lib/src/omega_core/oc_eq.cc b/omegalib/omega_lib/src/omega_core/oc_eq.cc new file mode 100644 index 0000000..dc595ea --- /dev/null +++ b/omegalib/omega_lib/src/omega_core/oc_eq.cc @@ -0,0 +1,653 @@ +/***************************************************************************** + Copyright (C) 1994-2000 the Omega Project Team + Copyright (C) 2005-2011 Chun Chen + All Rights Reserved. + + Purpose: + Solve equalities. + + Notes: + + History: + *****************************************************************************/ + +#include + +namespace omega { + +void Problem::simplifyStrideConstraints() { + int e, e2, i; + if (DBUG) + fprintf(outputFile, "Checking for stride constraints\n"); + for (i = safeVars + 1; i <= nVars; i++) { + if (DBUG) + fprintf(outputFile, "checking %s\n", variable(i)); + for (e = 0; e < nGEQs; e++) + if (GEQs[e].coef[i]) + break; + if (e >= nGEQs) { + if (DBUG) + fprintf(outputFile, "%s passed GEQ test\n", variable(i)); + e2 = -1; + for (e = 0; e < nEQs; e++) + if (EQs[e].coef[i]) { + if (e2 == -1) + e2 = e; + else { + e2 = -1; + break; + } + } + if (e2 >= 0) { + if (DBUG) { + fprintf(outputFile, "Found stride constraint: "); + printEQ(&EQs[e2]); + fprintf(outputFile, "\n"); + } + /* Is a stride constraint */ + coef_t g = abs(EQs[e2].coef[i]); + assert(g>0); + int j; + for (j = 0; j <= nVars; j++) + if (i != j) + EQs[e2].coef[j] = int_mod_hat(EQs[e2].coef[j], g); + } + } + } +} + +void Problem::doMod(coef_t factor, int e, int j) { + /* Solve e = factor alpha for x_j and substitute */ + int k; + eqn eq; + coef_t nFactor; + + int alpha; + + // if (j > safeVars) alpha = j; + // else + if (EQs[e].color) { + rememberRedConstraint(&EQs[e], redEQ, 0); + EQs[e].color = EQ_BLACK; + } + alpha = addNewUnprotectedWildcard(); + eqnncpy(&eq, &EQs[e], nVars); + newVar = alpha; + + if (DEBUG) { + fprintf(outputFile, "doing moding: "); + fprintf(outputFile, "Solve "); + printTerm(&eq, 1); + fprintf(outputFile, " = " coef_fmt " %s for %s and substitute\n", + factor, variable(alpha), variable(j)); + } + for (k = nVars; k >= 0; k--) + eq.coef[k] = int_mod_hat(eq.coef[k], factor); + nFactor = eq.coef[j]; + assert(nFactor == 1 || nFactor == -1); + eq.coef[alpha] = factor / nFactor; + if (DEBUG) { + fprintf(outputFile, "adjusted: "); + fprintf(outputFile, "Solve "); + printTerm(&eq, 1); + fprintf(outputFile, " = 0 for %s and substitute\n", variable(j)); + } + + eq.coef[j] = 0; + substitute(&eq, j, nFactor); + newVar = -1; + deleteVariable(j); + for (k = nVars; k >= 0; k--) { + assert(EQs[e].coef[k] % factor == 0); + EQs[e].coef[k] = EQs[e].coef[k] / factor; + } + if (DEBUG) { + fprintf(outputFile, "Mod-ing and normalizing produces:\n"); + printProblem(); + } +} + +void Problem::substitute(eqn *sub, int i, coef_t c) { + int e, j; + coef_t k; + int recordSubstitution = (i <= safeVars && var[i] >= 0); + + redType clr; + if (sub->color) + clr = redEQ; + else + clr = notRed; + + assert(c == 1 || c == -1); + + if (DBUG || doTrace) { + if (sub->color) + fprintf(outputFile, "RED SUBSTITUTION\n"); + fprintf(outputFile, "substituting using %s := ", variable(i)); + printTerm(sub, -c); + fprintf(outputFile, "\n"); + printVars(); + } +#ifndef NDEBUG + if (i > safeVars && clr) { + bool unsafeSub = false; + for (e = nEQs - 1; e >= 0; e--) + if (!(EQs[e].color || !EQs[e].coef[i])) + unsafeSub = true; + for (e = nGEQs - 1; e >= 0; e--) + if (!(GEQs[e].color || !GEQs[e].coef[i])) + unsafeSub = true; + for (e = nSUBs - 1; e >= 0; e--) + if (SUBs[e].coef[i]) + unsafeSub = true; + if (unsafeSub) { + fprintf(outputFile, "UNSAFE RED SUBSTITUTION\n"); + fprintf(outputFile, "substituting using %s := ", variable(i)); + printTerm(sub, -c); + fprintf(outputFile, "\n"); + printProblem(); + assert(0 && "UNSAFE RED SUBSTITUTION"); + } + } +#endif + + for (e = nEQs - 1; e >= 0; e--) { + eqn *eq; + eq = &(EQs[e]); + k = eq->coef[i]; + if (k != 0) { + k = check_mul(k, c); // Should be k = k/c, but same effect since abs(c) == 1 + eq->coef[i] = 0; + for (j = nVars; j >= 0; j--) { + eq->coef[j] -= check_mul(sub->coef[j], k); + } + } + if (DEBUG) { + printEQ(eq); + fprintf(outputFile, "\n"); + } + } + for (e = nGEQs - 1; e >= 0; e--) { + int zero; + eqn *eq; + eq = &(GEQs[e]); + k = eq->coef[i]; + if (k != 0) { + k = check_mul(k, c); // Should be k = k/c, but same effect since abs(c) == 1 + eq->touched = true; + eq->coef[i] = 0; + zero = 1; + for (j = nVars; j >= 0; j--) { + eq->coef[j] -= check_mul(sub->coef[j], k); + if (j > 0 && eq->coef[j]) + zero = 0; + } + if (zero && clr != notRed && !eq->color) { + coef_t z = int_div(eq->coef[0], abs(k)); + if (DBUG || doTrace) { + fprintf(outputFile, + "Black inequality matches red substitution\n"); + if (z < 0) + fprintf(outputFile, "System is infeasible\n"); + else if (z > 0) + fprintf(outputFile, "Black inequality is redundant\n"); + else { + fprintf(outputFile, + "Black constraint partially implies red equality\n"); + if (k < 0) { + fprintf(outputFile, "Black constraints tell us "); + assert(sub->coef[i] == 0); + sub->coef[i] = c; + printTerm(sub, 1); + sub->coef[i] = 0; + fprintf(outputFile, "<= 0\n"); + } else { + fprintf(outputFile, "Black constraints tell us "); + assert(sub->coef[i] == 0); + sub->coef[i] = c; + printTerm(sub, 1); + sub->coef[i] = 0; + fprintf(outputFile, " >= 0\n"); + } + } + } + if (z == 0) { + if (k < 0) { + if (clr == redEQ) + clr = redGEQ; + else if (clr == redLEQ) + clr = notRed; + } else { + if (clr == redEQ) + clr = redLEQ; + else if (clr == redGEQ) + clr = notRed; + } + } + + } + } + if (DEBUG) { + printGEQ(eq); + fprintf(outputFile, "\n"); + } + } + if (i <= safeVars && clr) { + assert(sub->coef[i] == 0); + sub->coef[i] = c; + rememberRedConstraint(sub, clr, 0); + sub->coef[i] = 0; + } + + if (recordSubstitution) { + int s = nSUBs++; + int kk; + eqn *eq = &(SUBs[s]); + for (kk = nVars; kk >= 0; kk--) + eq->coef[kk] = check_mul(-c, (sub->coef[kk])); + eq->key = var[i]; + if (DEBUG) { + fprintf(outputFile, "Recording substition as: "); + printSubstitution(s); + fprintf(outputFile, "\n"); + } + } + if (DEBUG) { + fprintf(outputFile, "Ready to update subs\n"); + if (sub->color) + fprintf(outputFile, "RED SUBSTITUTION\n"); + fprintf(outputFile, "substituting using %s := ", variable(i)); + printTerm(sub, -c); + fprintf(outputFile, "\n"); + printVars(); + } + + for (e = nSUBs - 1; e >= 0; e--) { + eqn *eq = &(SUBs[e]); + k = eq->coef[i]; + if (k != 0) { + k = check_mul(k, c); // Should be k = k/c, but same effect since abs(c) == 1 + eq->coef[i] = 0; + for (j = nVars; j >= 0; j--) { + eq->coef[j] -= check_mul(sub->coef[j], k); + } + } + if (DEBUG) { + fprintf(outputFile, "updated sub (" coef_fmt "): ", c); + printSubstitution(e); + fprintf(outputFile, "\n"); + } + } + + if (DEBUG) { + fprintf(outputFile, "---\n\n"); + printProblem(); + fprintf(outputFile, "===\n\n"); + } +} + + +void Problem::doElimination(int e, int i) { + if (DBUG || doTrace) + fprintf(outputFile, "eliminating variable %s\n", variable(i)); + + eqn sub; + eqnncpy(&sub, &EQs[e], nVars); + coef_t c = sub.coef[i]; + sub.coef[i] = 0; + + if (c == 1 || c == -1) { + substitute(&sub, i, c); + } else { + coef_t a = abs(c); + if (TRACE) + fprintf(outputFile, + "performing non-exact elimination, c = " coef_fmt "\n", c); + if (DBUG) + printProblem(); + assert(inApproximateMode); + + for (int e2 = nEQs - 1; e2 >= 0; e2--) { + eqn *eq = &(EQs[e2]); + coef_t k = eq->coef[i]; + if (k != 0) { + coef_t l = lcm(abs(k), a); + coef_t scale1 = l / abs(k); + for (int j = nVars; j >= 0; j--) + eq->coef[j] = check_mul(eq->coef[j], scale1); + eq->coef[i] = 0; + coef_t scale2 = l / c; + if (k < 0) + scale2 = -scale2; + for (int j = nVars; j >= 0; j--) + eq->coef[j] -= check_mul(sub.coef[j], scale2); + eq->color |= sub.color; + } + } + for (int e2 = nGEQs - 1; e2 >= 0; e2--) { + eqn *eq = &(GEQs[e2]); + coef_t k = eq->coef[i]; + if (k != 0) { + coef_t l = lcm(abs(k), a); + coef_t scale1 = l / abs(k); + for (int j = nVars; j >= 0; j--) + eq->coef[j] = check_mul(eq->coef[j], scale1); + eq->coef[i] = 0; + coef_t scale2 = l / c; + if (k < 0) + scale2 = -scale2; + for (int j = nVars; j >= 0; j--) + eq->coef[j] -= check_mul(sub.coef[j], scale2); + eq->color |= sub.color; + eq->touched = 1; + } + } + for (int e2 = nSUBs - 1; e2 >= 0; e2--) + if (SUBs[e2].coef[i]) { + eqn *eq = &(EQs[e2]); + assert(0); + // We can't handle this since we can't multiply + // the coefficient of the left-hand side + assert(!sub.color); + for (int j = nVars; j >= 0; j--) + eq->coef[j] = check_mul(eq->coef[j], a); + coef_t k = eq->coef[i]; + eq->coef[i] = 0; + for (int j = nVars; j >= 0; j--) + eq->coef[j] -= check_mul(sub.coef[j], k / c); + } + } + deleteVariable(i); +} + +int Problem::solveEQ() { + check(); + + // Reorder equations according to complexity. + { + int delay[nEQs]; + + for (int e = 0; e < nEQs; e++) { + delay[e] = 0; + if (EQs[e].color) + delay[e] += 8; + int nonunitWildCards = 0; + int unitWildCards = 0; + for (int i = nVars; i > safeVars; i--) + if (EQs[e].coef[i]) { + if (EQs[e].coef[i] == 1 || EQs[e].coef[i] == -1) + unitWildCards++; + else + nonunitWildCards++; + } + int unit = 0; + int nonUnit = 0; + for (int i = safeVars; i > 0; i--) + if (EQs[e].coef[i]) { + if (EQs[e].coef[i] == 1 || EQs[e].coef[i] == -1) + unit++; + else + nonUnit++; + } + if (unitWildCards == 1 && nonunitWildCards == 0) + delay[e] += 0; + else if (unitWildCards >= 1 && nonunitWildCards == 0) + delay[e] += 1; + else if (inApproximateMode && nonunitWildCards > 0) + delay[e] += 2; + else if (unit == 1 && nonUnit == 0 && nonunitWildCards == 0) + delay[e] += 3; + else if (unit > 1 && nonUnit == 0 && nonunitWildCards == 0) + delay[e] += 4; + else if (unit >= 1 && nonunitWildCards <= 1) + delay[e] += 5; + else + delay[e] += 6; + } + + for (int e = 0; e < nEQs; e++) { + int e2, slowest; + slowest = e; + for (e2 = e + 1; e2 < nEQs; e2++) + if (delay[e2] > delay[slowest]) + slowest = e2; + if (slowest != e) { + int tmp = delay[slowest]; + delay[slowest] = delay[e]; + delay[e] = tmp; + eqn eq; + eqnncpy(&eq, &EQs[slowest], nVars); + eqnncpy(&EQs[slowest], &EQs[e], nVars); + eqnncpy(&EQs[e], &eq, nVars); + } + } + } + + // Eliminate all equations. + while (nEQs != 0) { + int e = nEQs - 1; + eqn *eq = &(EQs[e]); + coef_t g, g2; + + assert(mayBeRed || !eq->color); + + check(); + + // get gcd of coefficients of all unprotected variables + g2 = 0; + for (int i = nVars; i > safeVars; i--) + if (eq->coef[i] != 0) { + g2 = gcd(abs(eq->coef[i]), g2); + if (g2 == 1) + break; + } + + // get gcd of coefficients of all variables + g = g2; + if (g != 1) + for (int i = safeVars; i >= 1; i--) + if (eq->coef[i] != 0) { + g = gcd(abs(eq->coef[i]), g); + if (g == 1) + break; + } + + // approximate mode bypass integer modular test; in Farkas(), + // existential variable lambda's are rational numbers. + if (inApproximateMode && g2 != 0) + g = gcd(abs(eq->coef[0]), g); + + // simple test to see if the equation is satisfiable + if (g == 0) { + if (eq->coef[0] != 0) { + return (false); + } else { + nEQs--; + continue; + } + } else if (abs(eq->coef[0]) % g != 0) { + return (false); + } + + // set gcd of all coefficients to 1 + if (g != 1) { + for (int i = nVars; i >= 0; i--) + eq->coef[i] /= g; + g2 = g2 / g; + } + + // exact elimination of unit coefficient variable + if (g2 != 0) { // for constraint with unprotected variable + int i; + for (i = nVars; i > safeVars; i--) + if (abs(eq->coef[i]) == 1) + break; + if (i > safeVars) { + nEQs--; + doElimination(e, i); + continue; + } + } else { // for constraint without unprotected variable + + // pick the unit coefficient variable with complex inequalites + // to eliminate, this will make inequalities tighter. e.g. + // {[t4,t6,t10]:exists (alpha: 0<=t6<=3 && t10=4alpha+t6 && + // 64t4<=t10<=64t4+15)} + int unit_var; + int cost = -1; + + for (int i = safeVars; i > 0; i--) + + if (abs(eq->coef[i]) == 1) { + int cur_cost = 0; + for (int j = 0; j < nGEQs; j++) + if (GEQs[j].coef[i] != 0) { + for (int k = safeVars; k > 0; k--) + if (GEQs[j].coef[k] != 0) { + if (abs(GEQs[j].coef[k]) != 1){ + + cur_cost += 3; + + } + else + cur_cost += 1; + } + } + + if (cur_cost > cost) { + cost = cur_cost; + unit_var = i; + } + + } + + if (cost != -1) { + nEQs--; + doElimination(e, unit_var); + continue; + } + + + } + + // check if there is an unprotected variable as wildcard + if (g2 > 0) { + int pos = 0; + coef_t g3; + for (int k = nVars; k > safeVars; k--) + if (eq->coef[k] != 0) { + int e2; + for (e2 = e - 1; e2 >= 0; e2--) + if (EQs[e2].coef[k]) + break; + if (e2 >= 0) + continue; + for (e2 = nGEQs - 1; e2 >= 0; e2--) + if (GEQs[e2].coef[k]) + break; + if (e2 >= 0) + continue; + for (e2 = nSUBs - 1; e2 >= 0; e2--) + if (SUBs[e2].coef[k]) + break; + if (e2 >= 0) + continue; + + if (pos == 0) { + g3 = abs(eq->coef[k]); + pos = k; + } else { + if (abs(eq->coef[k]) < g3) { + g3 = abs(eq->coef[k]); + pos = k; + } + } + } + + if (pos != 0) { + bool change = false; + for (int k2 = nVars; k2 >= 0; k2--) + if (k2 != pos && eq->coef[k2] != 0) { + coef_t t = int_mod_hat(eq->coef[k2], g3); + if (t != eq->coef[k2]) { + eq->coef[k2] = t; + change = true; + } + } + + // strength reduced, try this equation again + if (change) { + // nameWildcard(pos); + continue; + } + } + } + + // insert new stride constraint + if (g2 > 1 && !(inApproximateMode && !inStridesAllowedMode)) { + int newvar = addNewProtectedWildcard(); + int neweq = newEQ(); + assert(neweq == e+1); + // we were working on highest-numbered EQ + eqnnzero(&EQs[neweq], nVars); + eqnncpy(&EQs[neweq], eq, safeVars); + + for (int k = nVars; k >= 0; k--) { + EQs[neweq].coef[k] = int_mod_hat(EQs[neweq].coef[k], g2); + } + if (EQs[e].color) + rememberRedConstraint(&EQs[neweq], redStride, g2); + EQs[neweq].coef[newvar] = g2; + EQs[neweq].color = EQ_BLACK; + continue; + } + + // inexact elimination of unprotected variable + if (g2 > 0 && inApproximateMode) { + int pos = 0; + for (int k = nVars; k > safeVars; k--) + if (eq->coef[k] != 0) { + pos = k; + break; + } + assert(pos > safeVars); + + // special handling for wildcard used in breaking down + // diophantine equation + if (abs(eq->coef[pos]) > 1) { + int e2; + for (e2 = nSUBs - 1; e2 >= 0; e2--) + if (SUBs[e2].coef[pos]) + break; + if (e2 >= 0) { + protectWildcard(pos); + continue; + } + } + + nEQs--; + doElimination(e, pos); + continue; + } + + // now solve linear diophantine equation using least remainder + // algorithm + { + coef_t factor = (posInfinity); // was MAXINT + int pos = 0; + for (int k = nVars; k > (g2 > 0 ? safeVars : 0); k--) + if (eq->coef[k] != 0 && factor > abs(eq->coef[k]) + 1) { + factor = abs(eq->coef[k]) + 1; + pos = k; + } + assert(pos > (g2>0?safeVars:0)); + doMod(factor, e, pos); + continue; + } + } + + assert(nEQs == 0); + return (OC_SOLVE_UNKNOWN); +} + +} // namespace diff --git a/omegalib/omega_lib/src/omega_core/oc_exp_kill.cc b/omegalib/omega_lib/src/omega_core/oc_exp_kill.cc new file mode 100644 index 0000000..bf3ba19 --- /dev/null +++ b/omegalib/omega_lib/src/omega_core/oc_exp_kill.cc @@ -0,0 +1,297 @@ +/***************************************************************************** + Copyright (C) 1994-2000 the Omega Project Team + Copyright (C) 2005-2011 Chun Chen + All Rights Reserved. + + Purpose: + Expensive inequality elimination. + + Notes: + + History: + 03/31/09 Use BoolSet, Chun Chen +*****************************************************************************/ + +#include +#include +#include + +namespace omega { + +int Problem::expensiveKill() { + int e; + if (TRACE) fprintf(outputFile,"Performing expensive kill tests: [\n"); + if (DBUG) printProblem(); + Problem tmpProblem; + int oldTrace = trace; + int constraintsRemoved = 0; + + trace = 0; + conservative++; + + for (e = nGEQs - 1; e >= 0; e--) + if (!GEQs[e].essential) { + if (DBUG) { + fprintf(outputFile, "checking equation %d to see if it is redundant: ", e); + printGEQ(&(GEQs[e])); + fprintf(outputFile, "\n"); + } + tmpProblem = *this; + tmpProblem.negateGEQ(e); + tmpProblem.varsOfInterest = 0; + tmpProblem.nSUBs = 0; + tmpProblem.nMemories = 0; + tmpProblem.safeVars = 0; + tmpProblem.variablesFreed = 0; + tmpProblem.isTemporary = true; + + if (!tmpProblem.solve(false)) { + if (DBUG) + fprintf(outputFile, "redundant!\n"); + constraintsRemoved++; + deleteGEQ(e); + } + } + + if (constraintsRemoved) { + if (TRACE) fprintf(outputFile,"%d Constraints removed!!\n",constraintsRemoved); + } + + trace = oldTrace; + conservative--; + if (TRACE) fprintf(outputFile,"] expensive kill tests done\n"); + return 1; +} + +int Problem::expensiveRedKill() { + int e; + if (TRACE) fprintf(outputFile,"Performing expensive red kill tests: [\n"); + Problem tmpProblem; + int oldTrace = trace; + int constraintsRemoved = 0; + + trace = 0; + conservative++; + + for (e = nGEQs - 1; e >= 0; e--) + if (!GEQs[e].essential && GEQs[e].color) { + if (DEBUG) { + fprintf(outputFile, "checking equation %d to see if it is redundant: ", e); + printGEQ(&(GEQs[e])); + fprintf(outputFile, "\n"); + } + tmpProblem = *this; + tmpProblem.negateGEQ(e); + tmpProblem.varsOfInterest = 0; + tmpProblem.nSUBs = 0; + tmpProblem.nMemories = 0; + tmpProblem.safeVars = 0; + tmpProblem.variablesFreed = 0; + tmpProblem.isTemporary = true; + tmpProblem.turnRedBlack(); + if (!tmpProblem.solve(false)) { + constraintsRemoved++; + deleteGEQ(e); + } + } + + if (constraintsRemoved) { + if (TRACE) fprintf(outputFile,"%d Constraints removed!!\n",constraintsRemoved); + } + + trace = oldTrace; + conservative--; + if (TRACE) fprintf(outputFile,"] expensive red kill tests done\n"); + return 1; +} + + +int Problem::expensiveEqualityCheck() { + int e; + return 1; + if (TRACE) fprintf(outputFile,"Performing expensive equality tests: [\n"); + Problem tmpProblem; + int oldTrace = trace; + int equalitiesFound = 0; + + trace = 0; + conservative++; + + for (e = nGEQs - 1; e >= 0; e--) { + if (DEBUG) { + fprintf(outputFile, "checking equation %d to see if it is an equality: ", e); + printGEQ(&(GEQs[e])); + fprintf(outputFile, "\n"); + } + tmpProblem = *this; + tmpProblem.GEQs[e].coef[0]--; + tmpProblem.varsOfInterest = 0; + tmpProblem.nSUBs = 0; + tmpProblem.nMemories = 0; + tmpProblem.safeVars = 0; + tmpProblem.variablesFreed = 0; + tmpProblem.isTemporary = true; + if (!tmpProblem.solve(false)) { + int neweq = newEQ(); + eqnncpy(&EQs[neweq], &GEQs[e], nVars); + equalitiesFound++; + addingEqualityConstraint(neweq); + } + } + if (equalitiesFound) { + if (TRACE) fprintf(outputFile,"%d Equalities found!!\n",equalitiesFound); + } + + trace = oldTrace; + conservative--; + if (equalitiesFound) { + if (!solveEQ()) return 0; + if (!normalize()) return 0; + } + if (TRACE) fprintf(outputFile,"] expensive equality tests done\n"); + return 1; +} + + +void Problem::quickRedKill(int computeGist) { + if (DBUG) { + fprintf(outputFile, "in quickRedKill: [\n"); + printProblem(); + } + + noteEssential(0); + int moreToDo = chainKill(1,0); + +#ifdef NDEBUG + if (!moreToDo) { + if (DBUG) fprintf(outputFile, "] quickRedKill\n"); + return; + } +#endif + + int isDead[nGEQs]; + int deadCount = 0; + std::vector > P(nGEQs, BoolSet<>(nVars)), Z(nGEQs, BoolSet<>(nVars)), N(nGEQs, BoolSet<>(nVars)); + BoolSet<> PP, PZ, PN; /* possible Positives, possible zeros & possible negatives */ + BoolSet<> MZ; /* must zeros */ + + int equationsToKill = 0; + for (int e = nGEQs - 1; e >= 0; e--) { + isDead[e] = 0; + if (GEQs[e].color && !GEQs[e].essential) equationsToKill++; + if (GEQs[e].color && GEQs[e].essential && !computeGist) + if (!moreToDo) { + if (DBUG) fprintf(outputFile, "] quickRedKill\n"); + return; + } + for (int i = nVars; i >= 1; i--) { + if (GEQs[e].coef[i] > 0) + P[e].set(i-1); + else if (GEQs[e].coef[i] < 0) + N[e].set(i-1); + else + Z[e].set(i-1); + } + } + + if (!equationsToKill) + if (!moreToDo) { + if (DBUG) fprintf(outputFile, "] quickRedKill\n"); + return; + } + + for (int e = nGEQs - 1; e > 0; e--) + if (!isDead[e]) + for (int e2 = e - 1; e2 >= 0; e2--) + if (!isDead[e2]) { + coef_t a = 0; + int i, j; + for (i = nVars; i > 1; i--) { + for (j = i - 1; j > 0; j--) { + a = (GEQs[e].coef[i] * GEQs[e2].coef[j] - GEQs[e2].coef[i] * GEQs[e].coef[j]); + if (a != 0) + goto foundPair; + } + } + continue; + + foundPair: + if (DEBUG) { + fprintf(outputFile, "found two equations to combine, i = %s, ", variable(i)); + fprintf(outputFile, "j = %s, alpha = " coef_fmt "\n", variable(j), a); + printGEQ(&(GEQs[e])); + fprintf(outputFile, "\n"); + printGEQ(&(GEQs[e2])); + fprintf(outputFile, "\n"); + } + + MZ = (Z[e] & Z[e2]); + PZ = MZ | (P[e] & N[e2]) | (N[e] & P[e2]); + PP = P[e] | P[e2]; + PN = N[e] | N[e2]; + + for (int e3 = nGEQs - 1; e3 >= 0; e3--) + if (e3 != e && e3 != e2 && GEQs[e3].color && !GEQs[e3].essential) { + coef_t alpha1, alpha2, alpha3; + + if (!PZ.imply(Z[e3]) || MZ.imply(~Z[e3])) continue; + if (!PP.imply(P[e3]) || !PN.imply(N[e3])) continue; + + if (a > 0) { + alpha1 = GEQs[e2].coef[j] * GEQs[e3].coef[i] - GEQs[e2].coef[i] * GEQs[e3].coef[j]; + alpha2 = -(GEQs[e].coef[j] * GEQs[e3].coef[i] - GEQs[e].coef[i] * GEQs[e3].coef[j]); + alpha3 = a; + } + else { + alpha1 = -(GEQs[e2].coef[j] * GEQs[e3].coef[i] - GEQs[e2].coef[i] * GEQs[e3].coef[j]); + alpha2 = -(-(GEQs[e].coef[j] * GEQs[e3].coef[i] - GEQs[e].coef[i] * GEQs[e3].coef[j])); + alpha3 = -a; + } + + if (alpha1 > 0 && alpha2 > 0) { + if (DEBUG) { + fprintf(outputFile, "alpha1 = " coef_fmt ", alpha2 = " coef_fmt "; comparing against: ", alpha1, alpha2); + printGEQ(&(GEQs[e3])); + fprintf(outputFile, "\n"); + } + coef_t c; + int k; + for (k = nVars; k >= 0; k--) { + c = alpha1 * GEQs[e].coef[k] + alpha2 * GEQs[e2].coef[k]; + if (DEBUG) { + if (k>0) + fprintf(outputFile, " %s: " coef_fmt ", " coef_fmt "\n", variable(k), c, alpha3 * GEQs[e3].coef[k]); + else fprintf(outputFile, " constant: " coef_fmt ", " coef_fmt "\n", c, alpha3 * GEQs[e3].coef[k]); + } + if (c != alpha3 * GEQs[e3].coef[k]) + break; + } + if (k < 0 || (k == 0 && c < alpha3 * (GEQs[e3].coef[k]+1))) { + if (DEBUG) { + deadCount++; + fprintf(outputFile, "red equation#%d is dead (%d dead so far, %d remain)\n", e3, deadCount, nGEQs - deadCount); + printGEQ(&(GEQs[e])); + fprintf(outputFile, "\n"); + printGEQ(&(GEQs[e2])); + fprintf(outputFile, "\n"); + printGEQ(&(GEQs[e3])); + fprintf(outputFile, "\n"); + assert(moreToDo); + } + isDead[e3] = 1; + } + } + } + } + + for (int e = nGEQs - 1; e >= 0; e--) + if (isDead[e]) + deleteGEQ(e); + + if (DBUG) { + fprintf(outputFile,"] quickRedKill\n"); + printProblem(); + } +} + +} // namespace diff --git a/omegalib/omega_lib/src/omega_core/oc_global.cc b/omegalib/omega_lib/src/omega_core/oc_global.cc new file mode 100644 index 0000000..17d8a0c --- /dev/null +++ b/omegalib/omega_lib/src/omega_core/oc_global.cc @@ -0,0 +1,45 @@ +#include + +namespace omega { + +const int Problem::min_alloc = 10; +const int Problem::first_alloc_pad = 5; + +int omega_core_debug = 0; // 3: full debugging info + +int maxEQs = 100; // original 35, increased by chun +int maxGEQs = 200; // original 70, increased by chun + +int newVar = -1; +int findingImplicitEqualities = 0; +int firstCheckForRedundantEquations = 0; +int doItAgain; +int conservative = 0; +FILE *outputFile = stderr; /* printProblem writes its output to this file */ +char wildName[200][20]; +int nextWildcard = 0; +int trace = 1; +int depth = 0; +int headerLevel; +int inApproximateMode = 0; +int inStridesAllowedMode = 0; +int addingOuterEqualities = 0; +int outerColor = 0; +int reduceWithSubs = 1; +int pleaseNoEqualitiesInSimplifiedProblems = 0; +Problem *originalProblem = noProblem; +int omegaInitialized = 0; +int mayBeRed = 0; + + +// Hash table is used to hash all inequalties for all problems. It +// persists across problems for quick problem merging in case. When +// the table is filled to 1/3 full, it is flushed and the filling +// process starts all over again. +int packing[maxVars]; +int hashVersion = 0; +eqn hashMaster[hashTableSize]; +int fastLookup[maxKeys*2]; +int nextKey; + +} // namespace diff --git a/omegalib/omega_lib/src/omega_core/oc_print.cc b/omegalib/omega_lib/src/omega_core/oc_print.cc new file mode 100644 index 0000000..7934713 --- /dev/null +++ b/omegalib/omega_lib/src/omega_core/oc_print.cc @@ -0,0 +1,686 @@ +#include + +namespace omega { + +int print_in_code_gen_style = 0; + +void Problem::initializeVariables() const { + Problem *p = (Problem *)this; + int i; + assert(!p->variablesInitialized); + for (i = p->nVars; i >= 0; i--) + p->forwardingAddress[i] = p->var[i] = i; + p->variablesInitialized = 1; +} + + +std::string Problem::print_term_to_string(const eqn *e, int c) const { + std::string s=""; + int i; + int first; + int n = nVars; + int wentFirst = -1; + first = 1; + for (i = 1; i <= n; i++) + if (c * e->coef[i] > 0) { + first = 0; + wentFirst = i; + + if (c * e->coef[i] == 1) + s+= variable(i); + else { + s += to_string(c * e->coef[i]); + if (print_in_code_gen_style) s += "*"; + s += variable(i); + } + break; + } + for (i = 1; i <= n; i++) + if (i != wentFirst && c * e->coef[i] != 0) { + if (!first && c * e->coef[i] > 0) + s += "+"; + + first = 0; + + if (c * e->coef[i] == 1) + s += variable(i); + else if (c * e->coef[i] == -1) { + s += "-"; s += variable(i); + } + else { + s += to_string(c * e->coef[i]); + if (print_in_code_gen_style) s += "*"; + s += variable(i); + } + } + if (!first && c * e->coef[0] > 0) + s += "+"; + if (first || c * e->coef[0] != 0) + s += to_string(c * e->coef[0]); + return s; +} + + +void Problem::printTerm(const eqn * e, int c) const { + std::string s = print_term_to_string(e, c); + fprintf(outputFile, "%s", s.c_str()); +} + + +void Problem::printSub(int v) const { + std::string s = print_sub_to_string(v); + fprintf(outputFile, "%s", s.c_str()); +} + + +std::string Problem::print_sub_to_string(int v) const { + std::string s; + + if (v > 0) + s = variable(v); + else + s = print_term_to_string(&SUBs[-v-1], 1); + return s; +} + + +void Problem::clearSubs() { + nSUBs = 0; + nMemories = 0; +} + + +void Problem::printEqn(const eqn *e, int test, int extra) const { + char buf[maxVars * 12 + 180]; // original buf[maxVars * 12 + 80] + + sprintEqn(buf, e, test, extra); + fprintf(outputFile, "%s", buf); +} + + +std::string Problem::printEqnToString(const eqn *e, int test, int extra) const { + char buf[maxVars * 12 + 180]; // original buf[maxVars * 12 + 80] + sprintEqn(buf, e, test, extra); + return std::string(buf); +} + + +void Problem::sprintEqn(char *str, const eqn *e, int test, int extra) const { + int i; + int first; + int n = nVars + extra; + int isLT; + + isLT = test && e->coef[0] == -1; + if (isLT) + isLT = 1; +#if 0 + if (test) { + if (DEBUG && e->touched) { + sprintf(str, "!"); + while (*str) + str++; + } + else if (DBUG && !e->touched && e->key != 0) { + sprintf(str, "%d: ", e->key); + while (*str) + str++; + } + } +#endif + if (e->color) { + sprintf(str, "["); + while (*str) + str++; + } + first = 1; + for (i = isLT; i <= n; i++) + if (e->coef[i] < 0) { + if (!first) { + sprintf(str, "+"); + while (*str) + str++; + } + else + first = 0; + if (i == 0) { + sprintf(str, coef_fmt, -e->coef[i]); + while (*str) + str++; + } + else if (e->coef[i] == -1) { + sprintf(str, "%s", variable(i)); + while (*str) + str++; + } + else { + if (print_in_code_gen_style) + sprintf(str, coef_fmt "*%s", -e->coef[i], variable(i)); + else sprintf(str, coef_fmt "%s", -e->coef[i], variable(i)); + while (*str) + str++; + } + } + if (first) { + if (isLT) { + sprintf(str, "1"); + isLT = 0; + } + else + sprintf(str, "0"); + while (*str) + str++; + } + if (test == 0) { + if (print_in_code_gen_style) sprintf(str, " == "); + else sprintf(str, " = "); + while (*str) + str++; + } + else { + if (isLT) + sprintf(str, " < "); + else + sprintf(str, " <= "); + while (*str) + str++; + } + + first = 1; + for (i = 0; i <= n; i++) + if (e->coef[i] > 0) { + if (!first) { + sprintf(str, "+"); + while (*str) + str++; + } + else + first = 0; + if (i == 0) { + sprintf(str, coef_fmt , e->coef[i]); + while (*str) + str++; + } + else if (e->coef[i] == 1) { + sprintf(str, "%s", variable(i)); + while (*str) + str++; + } + else { + if (print_in_code_gen_style) + sprintf(str, coef_fmt "*%s", e->coef[i], variable(i)); + else + sprintf(str, coef_fmt "%s", e->coef[i], variable(i)); + while (*str) + str++; + } + } + if (first) { + sprintf(str, "0"); + while (*str) + str++; + } + if (e->color) { + sprintf(str, "]"); + while (*str) + str++; + } +} + + +void Problem::printSubstitution(int s) const { + const eqn * eq = &(SUBs[s]); + assert(eq->key > 0); + fprintf(outputFile, "%s := ", orgVariable(eq->key)); + printTerm(eq, 1); +} + + +void Problem::printVars(int /*debug*/) const { + int i; + fprintf(outputFile, "variables = "); + if (safeVars > 0) + fprintf(outputFile, "("); + for (i = 1; i <= nVars; i++) { + fprintf(outputFile, "%s", variable(i)); + if (i == safeVars) + fprintf(outputFile, ")"); + if (i < nVars) + fprintf(outputFile, ", "); + } + fprintf(outputFile, "\n"); + /* + fprintf(outputFile, "forward addresses = "); + if (safeVars > 0) + fprintf(outputFile, "("); + for (i = 1; i <= nVars; i++) + { + int v = forwardingAddress[i]; + if (v > 0) fprintf(outputFile, "%s", variable(i)); + else fprintf(outputFile, "*"); + if (i == safeVars) + fprintf(outputFile, ")"); + if (i < nVars) + fprintf(outputFile, ", "); + }; + fprintf(outputFile, "\n"); + */ +} + + +void printHeader() { + int i; + for(i=0; i= "); + break; + case redEQ: + fprintf(outputFile,"Red: 0 == "); + break; + case redStride: + fprintf(outputFile,"Red stride " coef_fmt ": ", redMemory[e].stride); + break; + } + fprintf(outputFile," " coef_fmt, redMemory[e].constantTerm); + for(i=0;i< redMemory[e].length; i++) + if(redMemory[e].coef[i] >= 0) + fprintf(outputFile,"+" coef_fmt "%s", redMemory[e].coef[i], orgVariable(redMemory[e].var[i])); + else + fprintf(outputFile,"-" coef_fmt "%s", -redMemory[e].coef[i], orgVariable(redMemory[e].var[i])); + fprintf(outputFile, "\n"); + } + fflush(outputFile); + + CHECK_FOR_DUPLICATE_VARIABLE_NAMES; +} + + +void Problem::printRedEquations() const { + int e; + + if (!variablesInitialized) + initializeVariables(); + printVars(1); + for (e = 0; e < nEQs; e++) { + if (EQs[e].color == EQ_RED) { + printEQ(&EQs[e]); + fprintf(outputFile, "\n"); + } + } + for (e = 0; e < nGEQs; e++) { + if (GEQs[e].color == EQ_RED) { + printGEQ(&GEQs[e]); + fprintf(outputFile, "\n"); + } + } + for (e = 0; e < nSUBs; e++) { + if (SUBs[e].color) { + printSubstitution(e); + fprintf(outputFile, "\n"); + } + } + fflush(outputFile); +} + + +int Problem::prettyPrintProblem() const { + std::string s = prettyPrintProblemToString(); + fprintf(outputFile, "%s", s.c_str()); + fflush(outputFile); + return 0; +} + + +std::string Problem::prettyPrintProblemToString() const { + std::string s=""; + int e; + int v; + int live[maxmaxGEQs]; + int v1, v2, v3; + int t, change; + int stuffPrinted = 0; + const char *connector = " && "; + + typedef enum { + none, le, lt + } partialOrderType; + + partialOrderType po[maxVars][maxVars]; + int poE[maxVars][maxVars]; + int lastLinks[maxVars]; + int firstLinks[maxVars]; + int chainLength[maxVars]; + int chain[maxVars]; + int varCount[maxVars]; + int i, m, multiprint; + + + if (!variablesInitialized) + initializeVariables(); + + if (nVars > 0) { + for (e = 0; e < nEQs; e++) { + if (stuffPrinted) + s += connector; + stuffPrinted = 1; + s += print_EQ_to_string(&EQs[e]); + } + + for (e = 0; e < nGEQs; e++) { + live[e] = true; + varCount[e] = 0; + for (v = 1; v <= nVars; v++) + if (GEQs[e].coef[v]) varCount[e]++; + } + + if (!print_in_code_gen_style) + while (1) { + for (v = 1; v <= nVars; v++) { + lastLinks[v] = firstLinks[v] = 0; + chainLength[v] = 0; + for (v2 = 1; v2 <= nVars; v2++) + po[v][v2] = none; + } + + for (e = 0; e < nGEQs; e++) + if (live[e] && varCount[e] <= 2) { + for (v = 1; v <= nVars; v++) { + if (GEQs[e].coef[v] == 1) + firstLinks[v]++; + else if (GEQs[e].coef[v] == -1) + lastLinks[v]++; + } + + v1 = nVars; + while (v1 > 0 && GEQs[e].coef[v1] == 0) + v1--; + v2 = v1 - 1; + while (v2 > 0 && GEQs[e].coef[v2] == 0) + v2--; + v3 = v2 - 1; + while (v3 > 0 && GEQs[e].coef[v3] == 0) + v3--; + + if (GEQs[e].coef[0] > 0 || GEQs[e].coef[0] < -1 + || v2 <= 0 || v3 > 0 + || GEQs[e].coef[v1] * GEQs[e].coef[v2] != -1) { + /* Not a partial order relation */ + + } + else { + if (GEQs[e].coef[v1] == 1) { + v3 = v2; + v2 = v1; + v1 = v3; + } + /* relation is v1 <= v2 or v1 < v2 */ + po[v1][v2] = ((GEQs[e].coef[0] == 0) ? le : lt); + poE[v1][v2] = e; + } + } + for (v = 1; v <= nVars; v++) + chainLength[v] = lastLinks[v]; + + /* + * printf("\n\nPartial order:\n"); printf(" "); for (v1 = 1; v1 <= nVars; v1++) + * printf("%7s",variable(v1)); printf("\n"); for (v1 = 1; v1 <= nVars; v1++) { printf("%6s: + * ",variable(v1)); for (v2 = 1; v2 <= nVars; v2++) switch (po[v1][v2]) { case none: printf(" "); + * break; case le: printf(" <= "); break; case lt: printf(" < "); break; } printf("\n"); } + */ + + + /* Just in case nVars <= 0 */ + change = false; + for (t = 0; t < nVars; t++) { + change = false; + for (v1 = 1; v1 <= nVars; v1++) + for (v2 = 1; v2 <= nVars; v2++) + if (po[v1][v2] != none && + chainLength[v1] <= chainLength[v2]) { + chainLength[v1] = chainLength[v2] + 1; + change = true; + } + } + + if (change) { + /* caught in cycle */ + +#if 0 + printf("\n\nPartial order:\n"); printf(" "); + for (v1 = 1; v1 <= nVars; v1++) printf("%7s",variable(v1)); printf("\n"); + for (v1 = 1; v1 <= nVars; v1++) { + printf("%6s: ",variable(v1)); + for (v2 = 1; v2 <= nVars; v2++) switch (po[v1][v2]) { + case none: printf(" "); break; + case le: printf(" <= "); break; + case lt: printf(" < "); break; + } + printf("\n"); + } + + printProblem(1); +#endif + break; + } + + for (v1 = 1; v1 <= nVars; v1++) + if (chainLength[v1] == 0) + firstLinks[v1] = 0; + + v = 1; + for (v1 = 2; v1 <= nVars; v1++) + if (chainLength[v1] + firstLinks[v1] > chainLength[v] + firstLinks[v]) + v = v1; + + if (chainLength[v] + firstLinks[v] == 0) + break; + + if (stuffPrinted) + s += connector; + stuffPrinted = 1; + /* chain starts at v */ + /* print firstLinks */ + { + coef_t tmp; + int first; + first = 1; + for (e = 0; e < nGEQs; e++) + if (live[e] && GEQs[e].coef[v] == 1 && varCount[e] <= 2) { + if (!first) + s += ", "; + tmp = GEQs[e].coef[v]; + ((Problem *)this)-> + GEQs[e].coef[v] = 0; + s += print_term_to_string(&GEQs[e], -1); + ((Problem *)this)-> + GEQs[e].coef[v] = tmp; + live[e] = false; + first = 0; + } + if (!first) + s += " <= "; + } + + + /* find chain */ + chain[0] = v; + m = 1; + while (1) { + /* print chain */ + for (v2 = 1; v2 <= nVars; v2++) + if (po[v][v2] && chainLength[v] == 1 + chainLength[v2]) + break; + if (v2 > nVars) + break; + chain[m++] = v2; + v = v2; + } + + s += variable(chain[0]); + + multiprint = 0; + for (i = 1; i < m; i++) { + v = chain[i - 1]; + v2 = chain[i]; + if (po[v][v2] == le) + s += " <= "; + else + s += " < "; + s += variable(v2); + live[poE[v][v2]] = false; + if (!multiprint && i < m - 1) + for (v3 = 1; v3 <= nVars; v3++) { + if (v == v3 || v2 == v3) + continue; + if (po[v][v2] != po[v][v3]) + continue; + if (po[v2][chain[i + 1]] != po[v3][chain[i + 1]]) + continue; + s += ","; s += variable(v3); + live[poE[v][v3]] = false; + live[poE[v3][chain[i + 1]]] = false; + multiprint = 1; + } + else + multiprint = 0; + } + + v = chain[m - 1]; + /* print lastLinks */ + { + coef_t tmp; + int first; + first = 1; + for (e = 0; e < nGEQs; e++) + if (live[e] && GEQs[e].coef[v] == -1 && varCount[e] <= 2) { + if (!first) + s += ", "; + else + s += " <= "; + tmp = GEQs[e].coef[v]; + ((Problem *)this)-> + GEQs[e].coef[v] = 0; + s += print_term_to_string(&GEQs[e], 1); + ((Problem *)this)-> + GEQs[e].coef[v] = tmp; + live[e] = false; + first = 0; + } + } + } + + + for (e = 0; e < nGEQs; e++) + if (live[e]) { + if (stuffPrinted) + s += connector; + stuffPrinted = 1; + s += print_GEQ_to_string(&GEQs[e]); + } + + for (e = 0; e < nSUBs; e++) { + const eqn * eq = &SUBs[e]; + if (stuffPrinted) + s += connector; + stuffPrinted = 1; + if (eq->key > 0) { + s += orgVariable(eq->key); s += " := "; + } + else { + s += "#"; s += to_string(eq->key); s += " := "; + } + s += print_term_to_string(eq, 1); + } + } + return s; +} + + +int Problem::prettyPrintRedEquations() const { + int e, stuffPrinted = 0; + const char *connector = " && "; + + if (!variablesInitialized) + initializeVariables(); + + for (e = 0; e < nEQs; e++) { + if (EQs[e].color == EQ_RED) { + if (stuffPrinted) + fprintf(outputFile, "%s", connector); + stuffPrinted = 1; + ((Problem *)this)-> + EQs[e].color = EQ_BLACK; + printEQ(&EQs[e]); + ((Problem *)this)-> + EQs[e].color = EQ_RED; + } + } + for (e = 0; e < nGEQs; e++) { + if (GEQs[e].color == EQ_RED) { + if (stuffPrinted) + fprintf(outputFile, "%s", connector); + stuffPrinted = 1; + ((Problem *)this)-> + GEQs[e].color = EQ_BLACK; + printGEQ(&GEQs[e]); + ((Problem *)this)-> + GEQs[e].color = EQ_RED; + } + } + for (e = 0; e < nSUBs; e++) { + if (SUBs[e].color) { + if (stuffPrinted) + fprintf(outputFile, "%s", connector); + stuffPrinted = 1; + printSubstitution(e); + } + } + fflush(outputFile); + + return 0; +} + +} diff --git a/omegalib/omega_lib/src/omega_core/oc_problems.cc b/omegalib/omega_lib/src/omega_core/oc_problems.cc new file mode 100644 index 0000000..8b6e04c --- /dev/null +++ b/omegalib/omega_lib/src/omega_core/oc_problems.cc @@ -0,0 +1,198 @@ +#include +#include + +namespace omega { + +Problem::~Problem() { + delete[] EQs; + delete[] GEQs; +} + + +void check_number_EQs(int n) { + if (n < 0) { + fprintf(stderr,"ERROR: nEQs < 0??\n"); + exit(1); + } + + if (n > maxmaxEQs) { + // clear global variables + inApproximateMode = 0; + outerColor = 0; + + throw presburger_error("\nERROR:\n" + "An attempt was made to set the number of available equality constraints to " + to_string(n) + ".\n" + "The maximum number of equality constraints in a conjunction is " + to_string(maxmaxEQs) + ".\n" + "This limit can be changed by redefining maxmaxEQs in oc.h and recompiling.\n\n"); + + // fprintf(stderr, "\nERROR:\n"); + // fprintf(stderr, "An attempt was made to set the number of available equality constraints to %d.\n", n); + // fprintf(stderr, "The maximum number of equality constraints in a conjunction is %d.\n", maxmaxEQs); + // fprintf(stderr, "This limit can be changed by redefining maxmaxEQs in oc.h and recompiling.\n\n"); + // exit(2); + } +} + +void check_number_GEQs(int n) { + if (n < 0) { + fprintf(stderr,"ERROR: nGEQs < 0??\n"); + exit(1); + } + + if (n > maxmaxGEQs) { + // clear global variables + inApproximateMode = 0; + outerColor = 0; + + throw presburger_error("\nERROR:\n" + "An attempt was made to set the number of available inequality constraints to " + to_string(n) +".\n" + "The maximum number of inequality constraints in a conjunction is " + to_string(maxmaxGEQs) +".\n" + "This limit can be changed by redefining maxmaxGEQs in oc.h and recompiling.\n\n"); + + // fprintf(stderr, "\nERROR:\n"); + // fprintf(stderr, "An attempt was made to set the number of available inequality constraints to %d.\n", n); + // fprintf(stderr, "The maximum number of inequality constraints in a conjunction is %d.\n", maxmaxGEQs); + // fprintf(stderr, "This limit can be changed by redefining maxmaxGEQs in oc.h and recompiling.\n\n"); + // exit(2); + } +} + + +void check_number_EQs_GEQs(int e, int g) { + check_number_EQs(e); + check_number_GEQs(g); +} + + +Problem::Problem(int in_eqs, int in_geqs) { + check_number_EQs_GEQs(in_eqs, in_geqs); + allocEQs = padEQs(in_eqs); + allocGEQs = padGEQs(in_geqs); + assert(allocEQs > 0 && allocGEQs > 0); + EQs = new eqn[allocEQs]; + GEQs = new eqn[allocGEQs]; + nVars = 0; + hashVersion = omega::hashVersion; + variablesInitialized = 0; + variablesFreed = 0; + varsOfInterest = 0; + safeVars = 0; + nEQs = 0; + nGEQs = 0; + nSUBs = 0; + nMemories = 0; + isTemporary = false; +} + +Problem::Problem(const Problem & p2) { + allocEQs = padEQs(p2.nEQs); // Don't over-allocate; p2 might have too many! + allocGEQs = padGEQs(p2.nGEQs); + assert(allocEQs > 0 && allocGEQs > 0); + EQs = new eqn[allocEQs]; + GEQs = new eqn[allocGEQs]; + int e, i; + nVars = p2.nVars; + hashVersion = p2.hashVersion; + variablesInitialized = p2.variablesInitialized; + variablesFreed = p2.variablesFreed; + varsOfInterest = p2.varsOfInterest; + safeVars = p2.safeVars; + nEQs = p2.nEQs; + isTemporary = p2.isTemporary; + //nSUBs = 0; + for (e = p2.nEQs - 1; e >= 0; e--) + eqnncpy(&(EQs[e]), &(p2.EQs[e]), p2.nVars); + nGEQs = p2.nGEQs; + for (e = p2.nGEQs - 1; e >= 0; e--) + eqnncpy(&(GEQs[e]), &(p2.GEQs[e]), p2.nVars); + for (i = 0; i <= p2.nVars; i++) + var[i] = p2.var[i]; + for (i = 0; i <= maxVars; i++) + forwardingAddress[i] = p2.forwardingAddress[i]; + //nMemories = 0; + get_var_name = p2.get_var_name; + getVarNameArgs = p2.getVarNameArgs; +} + +Problem & Problem::operator=(const Problem & p2) { + if (this != &p2) { + if(allocEQs < p2.nEQs) { + delete[] EQs; + allocEQs = padEQs(p2.nEQs); + EQs = new eqn[allocEQs]; + } + if(allocGEQs < p2.nGEQs) { + delete[] GEQs; + allocGEQs = padGEQs(p2.nGEQs); + GEQs = new eqn[allocGEQs]; + } + int e, i; + nVars = p2.nVars; + hashVersion = p2.hashVersion; + variablesInitialized = p2.variablesInitialized; + variablesFreed = p2.variablesFreed; + varsOfInterest = p2.varsOfInterest; + safeVars = p2.safeVars; + nEQs = p2.nEQs; + isTemporary = p2.isTemporary; + //nSUBs = 0; + for (e = p2.nEQs - 1; e >= 0; e--) + eqnncpy(&(EQs[e]), &(p2.EQs[e]), p2.nVars); + nGEQs = p2.nGEQs; + for (e = p2.nGEQs - 1; e >= 0; e--) + eqnncpy(&(GEQs[e]), &(p2.GEQs[e]), p2.nVars); + for (i = 0; i <= p2.nVars; i++) + var[i] = p2.var[i]; + for (i = 0; i <= maxVars; i++) + forwardingAddress[i] = p2.forwardingAddress[i]; + //nMemories = 0; + get_var_name = p2.get_var_name; + getVarNameArgs = p2.getVarNameArgs; + } + return *this; +} + + +void Problem::zeroVariable(int i) { + int e; + for (e = nGEQs - 1; e >= 0; e--) GEQs[e].coef[i] = 0; + for (e = nEQs - 1; e >= 0; e--) EQs[e].coef[i] = 0; + for (e = nSUBs - 1; e >= 0; e--) SUBs[e].coef[i] = 0; +} + +/* Functions for allocating EQ's and GEQ's */ + +int Problem::newGEQ() { + if (++nGEQs > allocGEQs) { + check_number_GEQs(nGEQs); + allocGEQs = padGEQs(allocGEQs, nGEQs); + assert(allocGEQs >= nGEQs); + eqn *new_geqs = new eqn[allocGEQs]; + for (int e = nGEQs - 2; e >= 0; e--) + eqnncpy(&(new_geqs[e]), &(GEQs[e]), nVars); + delete[] GEQs; + GEQs = new_geqs; + } +// problem->GEQs[nGEQs-1].color = black; +// eqnnzero(&problem->GEQs[nGEQs-1],problem->nVars); + return nGEQs-1; +} + +int Problem::newEQ() { + if (++nEQs > allocEQs) { + check_number_EQs(nEQs); + allocEQs = padEQs(allocEQs, nEQs); + assert(allocEQs >= nEQs); + eqn *new_eqs = new eqn[allocEQs]; + for (int e = nEQs - 2; e >= 0; e--) + eqnncpy(&(new_eqs[e]), &(EQs[e]), nVars); + delete[] EQs; + EQs = new_eqs; + } +// Could do this here, but some calls to newEQ do a copy instead of a zero; +// problem->EQs[nEQs-1].color = black; +// eqnnzero(&problem->EQs[nEQs-1],problem->nVars); + return nEQs-1; +} + +} // namespace diff --git a/omegalib/omega_lib/src/omega_core/oc_query.cc b/omegalib/omega_lib/src/omega_core/oc_query.cc new file mode 100644 index 0000000..528b297 --- /dev/null +++ b/omegalib/omega_lib/src/omega_core/oc_query.cc @@ -0,0 +1,478 @@ +#include + +namespace omega { + +void Problem::unprotectVariable( int v) { + int e, j, i; + coef_t t; + i = forwardingAddress[v]; + if (i < 0) { + i = -1 - i; + nSUBs--; + if (i < nSUBs) { + eqnncpy(&SUBs[i], &SUBs[nSUBs], nVars); + forwardingAddress[SUBs[i].key] = -i - 1; + } + } + else { + int bringToLife[maxVars]; + int comingBack = 0; + int e2; + for (e = nSUBs - 1; e >= 0; e--) + if ((bringToLife[e] = (SUBs[e].coef[i] != 0))) + comingBack++; + + for (e2 = nSUBs - 1; e2 >= 0; e2--) + if (bringToLife[e2]) { + + nVars++; + safeVars++; + if (safeVars < nVars) { + for (e = nGEQs - 1; e >= 0; e--) { + GEQs[e].coef[nVars] = GEQs[e].coef[safeVars]; + GEQs[e].coef[safeVars] = 0; + } + for (e = nEQs - 1; e >= 0; e--) { + EQs[e].coef[nVars] = EQs[e].coef[safeVars]; + EQs[e].coef[safeVars] = 0; + } + for (e = nSUBs - 1; e >= 0; e--) { + SUBs[e].coef[nVars] = SUBs[e].coef[safeVars]; + SUBs[e].coef[safeVars] = 0; + } + var[nVars] = var[safeVars]; + forwardingAddress[var[nVars]] = nVars; + } + else { + for (e = nGEQs - 1; e >= 0; e--) { + GEQs[e].coef[safeVars] = 0; + } + for (e = nEQs - 1; e >= 0; e--) { + EQs[e].coef[safeVars] = 0; + } + for (e = nSUBs - 1; e >= 0; e--) { + SUBs[e].coef[safeVars] = 0; + } + } + + var[safeVars] = SUBs[e2].key; + forwardingAddress[SUBs[e2].key] = safeVars; + + int neweq = newEQ(); + eqnncpy(&(EQs[neweq]), &(SUBs[e2]), nVars); + EQs[neweq].coef[safeVars] = -1; + if (e2 < nSUBs - 1) + eqnncpy(&(SUBs[e2]), &(SUBs[nSUBs - 1]), nVars); + nSUBs--; + } + + if (i < safeVars) { + j = safeVars; + for (e = nSUBs - 1; e >= 0; e--) { + t = SUBs[e].coef[j]; + SUBs[e].coef[j] = SUBs[e].coef[i]; + SUBs[e].coef[i] = t; + } + for (e = nGEQs - 1; e >= 0; e--) + if (GEQs[e].coef[j] != GEQs[e].coef[i]) { + GEQs[e].touched = true; + t = GEQs[e].coef[j]; + GEQs[e].coef[j] = GEQs[e].coef[i]; + GEQs[e].coef[i] = t; + } + for (e = nEQs - 1; e >= 0; e--) { + t = EQs[e].coef[j]; + EQs[e].coef[j] = EQs[e].coef[i]; + EQs[e].coef[i] = t; + } + { + short t; + t = var[j]; + var[j] = var[i]; + var[i] = t; + } + forwardingAddress[var[i]] = i; + forwardingAddress[var[j]] = j; + } + safeVars--; + } + chainUnprotect(); +} + +void Problem::constrainVariableSign( int color, int i, int sign) { + int nV = nVars; + int e, k, j; + + k = forwardingAddress[i]; + if (k < 0) { + k = -1 - k; + + if (sign != 0) { + e = newGEQ(); + eqnncpy(&GEQs[e], &SUBs[k], nVars); + for (j = 0; j <= nV; j++) + GEQs[e].coef[j] *= sign; + GEQs[e].coef[0]--; + GEQs[e].touched = 1; + GEQs[e].color = color; + } + else { + e = newEQ(); + eqnncpy(&EQs[e], &SUBs[k], nVars); + EQs[e].color = color; + } + } + else if (sign != 0) { + e = newGEQ(); + eqnnzero(&GEQs[e], nVars); + GEQs[e].coef[k] = sign; + GEQs[e].coef[0] = -1; + GEQs[e].touched = 1; + GEQs[e].color = color; + } + else { + e = newEQ(); + eqnnzero(&EQs[e], nVars); + EQs[e].coef[k] = 1; + EQs[e].color = color; + } + /* + unprotectVariable(i); + return (simplifyProblem(0,1,0)); + */ +} + +void Problem::constrainVariableValue( int color, int i, int value) { + int e, k; + + k = forwardingAddress[i]; + if (k < 0) { + k = -1 - k; + + e = newEQ(); + eqnncpy(&EQs[e], &SUBs[k], nVars); + EQs[e].coef[0] -= value; + + } + else { + e = newEQ(); + eqnnzero(&EQs[e], nVars); + EQs[e].coef[k] = 1; + EQs[e].coef[0] = -value; + } + EQs[e].color = color; +} + +// Analyze v1-v2 +void Problem:: query_difference(int v1, int v2, coef_t &lowerBound, coef_t &upperBound, bool &guaranteed) { + int nV = nVars; + int e,i,e2; + + coef_t lb1,ub1; + coef_t lb2,ub2; + assert(nSUBs == 0); + lowerBound = negInfinity; + lb1 = lb2 = negInfinity; + upperBound = posInfinity; + ub1 = ub2 = posInfinity; + guaranteed = true; + for (e = nEQs - 1; e >= 0; e--) { + if (EQs[e].coef[v1] == 0 && EQs[e].coef[v2] == 0) + continue; + for(i=nV;i>0;i--) + if (EQs[e].coef[i] && i!=v1 && i != v2) { + break; + } + if (i != 0) { + if (i > safeVars) { + // check to see if this variable appears anywhere else + for(e2 = nEQs-1; e2>=0;e2--) if (e != e2 && EQs[e2].coef[i]) break; + if (e2 < 0) + for(e2 = nGEQs-1; e2>=0;e2--) if (e != e2 && GEQs[e2].coef[i]) break; + if (e2 < 0) + for(e2 = nSUBs-1; e2>=0;e2--) if (e != e2 && SUBs[e2].coef[i]) break; + if (e2 >= 0) guaranteed = false; + } + else guaranteed = false; + continue; + } + if (EQs[e].coef[v1]*EQs[e].coef[v2] == -1) { + // found exact difference + coef_t d = - EQs[e].coef[v1] * EQs[e].coef[0]; + set_max(lowerBound, d); + set_min(upperBound, d); + guaranteed =true; + return; + } + else if (EQs[e].coef[v1] == 0) + lb2 = ub2 = -EQs[e].coef[0]/ EQs[e].coef[v2]; + else if (EQs[e].coef[v2] == 0) + lb1 = ub1 = -EQs[e].coef[0]/ EQs[e].coef[v1]; + else guaranteed = false; + } + + bool isDead[maxmaxGEQs]; + + for (e = nGEQs - 1; e >= 0; e--) isDead[e] = false; + int tryAgain = 1; + while (tryAgain) { + tryAgain = 0; + for (i = nVars; i > 0;i--) + if (i!= v1 && i != v2) { + for (e = nGEQs - 1; e >= 0; e--) + if (!isDead[e] && GEQs[e].coef[i]) + break; + if (e < 0) + e2 = e; + else if (GEQs[e].coef[i] > 0) { + for (e2 = e - 1; e2 >= 0; e2--) + if (!isDead[e2] && GEQs[e2].coef[i] < 0) + break; + } + else { + for (e2 = e - 1; e2 >= 0; e2--) + if (!isDead[e2] && GEQs[e2].coef[i] > 0) + break; + } + if (e2 < 0) { + int e3; + for (e3 = nSUBs - 1; e3 >= 0; e3--) + if (SUBs[e3].coef[i]) + break; + if (e3 >= 0) + continue; + for (e3 = nEQs - 1; e3 >= 0; e3--) + if (EQs[e3].coef[i]) + break; + if (e3 >= 0) + continue; + if (e >= 0) { + isDead[e] = true; + for (e--; e >= 0; e--) + if (GEQs[e].coef[i]) isDead[e] = true; + } + } + } + } + + for (e = nGEQs - 1; e >= 0; e--) + if (!isDead[e]) { + if (GEQs[e].coef[v1] == 0 && GEQs[e].coef[v2] == 0) + continue; + for(i=nV;i>0;i--) + if (GEQs[e].coef[i] && i!=v1 && i != v2) + break; + if (i != 0) { + guaranteed = false; + continue; + } + if (GEQs[e].coef[v1]*GEQs[e].coef[v2] == -1) { + // found relative difference + if (GEQs[e].coef[v1] == 1) { + // v1 - v2 + c >= 0 + set_max(lowerBound, - GEQs[e].coef[0]); + } + else { + // v2 - v1 + c >= 0 + // c >= v1-v2 + set_min(upperBound, GEQs[e].coef[0]); + } + } + else if (GEQs[e].coef[v1] == 0 && GEQs[e].coef[v2] > 0) + lb2 = -GEQs[e].coef[0]/ GEQs[e].coef[v2]; + else if (GEQs[e].coef[v1] == 0 && GEQs[e].coef[v2] < 0) + ub2 = -GEQs[e].coef[0]/ GEQs[e].coef[v2]; + else if (GEQs[e].coef[v2] == 0 && GEQs[e].coef[v1] > 0) + lb1 = -GEQs[e].coef[0]/ GEQs[e].coef[v1]; + else if (GEQs[e].coef[v2] == 0 && GEQs[e].coef[v1] < 0) + ub1 = -GEQs[e].coef[0]/ GEQs[e].coef[v1]; + else guaranteed = false; + } + + // ub1-lb2 >= v1-v2 >= lb1-ub2 + + if (negInfinity < lb2 && ub1 < posInfinity) set_min(upperBound, ub1-lb2); + if (negInfinity < lb1 && ub2 < posInfinity) set_max(lowerBound, lb1-ub2); + if (lowerBound >= upperBound) guaranteed = 1; +} + + +int Problem::queryVariable(int i, coef_t *lowerBound, coef_t *upperBound) { + int nV = nVars; + int e, j; + int isSimple; + int coupled = false; + for(j=1;j<=safeVars;j++) + if (var[j] > 0) + assert(forwardingAddress[var[j]] == j); + + assert(i > 0); + i = forwardingAddress[i]; + assert(i != 0); + + (*lowerBound) = negInfinity; + (*upperBound) = posInfinity; + + if (i < 0) { + int easy = true; + i = -i - 1; + for (j = 1; j <= nV; j++) + if (SUBs[i].coef[j] != 0) + easy = false; + if (easy) { + *upperBound = *lowerBound = SUBs[i].coef[0]; + return (false); + } + return (true); + } + + for (e = nSUBs - 1; e >= 0; e--) + if (SUBs[e].coef[i] != 0) + coupled = true; + + for (e = nEQs - 1; e >= 0; e--) + if (EQs[e].coef[i] != 0) { + isSimple = true; + for (j = 1; j <= nV; j++) + if (i != j && EQs[e].coef[j] != 0) { + isSimple = false; + coupled = true; + break; + } + if (!isSimple) + continue; + else { + *lowerBound = *upperBound = -EQs[e].coef[i] * EQs[e].coef[0]; + return (false); + } + } + for (e = nGEQs - 1; e >= 0; e--) + if (GEQs[e].coef[i] != 0) { + if (GEQs[e].key == i) { + set_max(*lowerBound, -GEQs[e].coef[0]); + } + else if (GEQs[e].key == -i) { + set_min(*upperBound, GEQs[e].coef[0]); + } + else + coupled = true; + } + return (coupled); +} + +int Problem::query_variable_bounds(int i, coef_t *l, coef_t *u) { + int coupled; + *l = negInfinity; + *u = posInfinity; + coupled = queryVariable(i, l, u); + if (!coupled || (nVars == 1 && forwardingAddress[i] == 1)) + return 0; + if (abs(forwardingAddress[i]) == 1 && nVars + nSUBs == 2 && nEQs + nSUBs == 1) { + int couldBeZero; + queryCoupledVariable(i, l, u, &couldBeZero, negInfinity, posInfinity); + return 0; + } + return 1; +} + +void Problem::queryCoupledVariable(int i, coef_t *l, coef_t *u, int *couldBeZero, coef_t lowerBound, coef_t upperBound) { + int e; + coef_t b1, b2; + const eqn *eqn; + coef_t sign; + int v; + + if (abs(forwardingAddress[i]) != 1 || nVars + nSUBs != 2 || nEQs + nSUBs != 1) { + fprintf(outputFile, "queryCoupledVariablecalled with bad parameters\n"); + printProblem(); + exit(2); + } + + if (forwardingAddress[i] == -1) { + eqn = &SUBs[0]; + sign = 1; + v = 1; + } + else { + eqn = &EQs[0]; + sign = -eqn->coef[1]; + v = 2; + } + + /* Variable i is defined in terms of variable v */ + + for (e = nGEQs - 1; e >= 0; e--) + if (GEQs[e].coef[v] != 0) { + if (GEQs[e].coef[v] == 1) { + set_max(lowerBound, -GEQs[e].coef[0]); + } + else { + set_min(upperBound, GEQs[e].coef[0]); + } + } + /* lowerBound and upperBound are bounds on the value of v */ + + if (lowerBound > upperBound) { + *l = posInfinity; + *u = negInfinity; + *couldBeZero = 0; + return; + } + if (lowerBound == negInfinity) { + if (eqn->coef[v] > 0) + b1 = sign * negInfinity; + else + b1 = -sign * negInfinity; + } + else + b1 = sign * (eqn->coef[0] + eqn->coef[v] * lowerBound); + if (upperBound == posInfinity) { + if (eqn->coef[v] > 0) + b2 = sign * posInfinity; + else + b2 = -sign * posInfinity; + } + else + b2 = sign * (eqn->coef[0] + eqn->coef[v] * upperBound); + + /* b1 and b2 are bounds on the value of i (don't know which is upper bound) */ + if (b1 <= b2) { + set_max(*l, b1); + set_min(*u, b2); + } + else { + set_max(*l, b2); + set_min(*u, b1); + } + *couldBeZero = *l <= 0 && 0 <= *u && int_mod(eqn->coef[0], abs(eqn->coef[v])) == 0; +} + + +int Problem::queryVariableSigns(int i, int dd_lt, int dd_eq, int dd_gt, coef_t lowerBound, coef_t upperBound, bool *distKnown, coef_t *dist) { + int result; + coef_t l, u; + int couldBeZero; + + l = negInfinity; + u = posInfinity; + + queryVariable(i, &l, &u); + queryCoupledVariable(i, &l, &u, &couldBeZero, lowerBound, upperBound); + result = 0; + if (l < 0) + result |= dd_gt; + if (u > 0) + result |= dd_lt; + if (couldBeZero) + result |= dd_eq; + if (l == u) { + *distKnown = 1; + *dist = l; + } + else { + *distKnown = 0; + } + return (result); +} + +} // namespace diff --git a/omegalib/omega_lib/src/omega_core/oc_quick_kill.cc b/omegalib/omega_lib/src/omega_core/oc_quick_kill.cc new file mode 100644 index 0000000..e49aee7 --- /dev/null +++ b/omegalib/omega_lib/src/omega_core/oc_quick_kill.cc @@ -0,0 +1,775 @@ +/***************************************************************************** + Copyright (C) 1994-2000 the Omega Project Team + Copyright (C) 2005-2011 Chun Chen + All Rights Reserved. + + Purpose: + Quick inequality elimination. + + Notes: + + History: + 03/31/09 Use BoolSet, Chun Chen +*****************************************************************************/ + +#include +#include +#include +#include + +namespace omega { + +int Problem::combineToTighten() { + int effort = min(12+5*(nVars-safeVars),23); + + if (DBUG) { + fprintf(outputFile, "\nin combineToTighten (%d,%d):\n",effort,nGEQs); + printProblem(); + fprintf(outputFile, "\n"); + } + if (nGEQs > effort) { + if (TRACE) { + fprintf(outputFile, "too complicated to tighten\n"); + } + return 1; + } + + for(int e = 1; e < nGEQs; e++) { + for(int e2 = 0; e2 < e; e2++) { + coef_t g = 0; + + bool has_wildcard = false; + bool has_wildcard2 = false; + for (int i = nVars; i > safeVars; i--) { + coef_t a = GEQs[e].coef[i]; + coef_t b = GEQs[e2].coef[i]; + g = gcd(g, abs(a+b)); + if (a != 0) + has_wildcard = true; + if (b != 0) + has_wildcard2 = true; + } + + coef_t c, c2; + if ((has_wildcard && !has_wildcard2) || (!has_wildcard && has_wildcard2)) + c = 0; + else + c = -1; + for (int i = safeVars; i >= 1; i--) { + coef_t a = GEQs[e].coef[i]; + coef_t b = GEQs[e2].coef[i]; + if (a != 0 || b != 0) { + g = gcd(g, abs(a+b)); + + if (c < 0) { + if (g == 1) + break; + } + else if ((a>0 && b<0) || (a<0 && b>0)) { + if (c == 0) { + try { + coef_t prod = lcm(abs(a), abs(b)); + c = prod/abs(a); + c2 = prod/abs(b); + } + catch (std::overflow_error) { + c = -1; + } + } + else { + if (c*a+c2*b != 0) + c = -1; + } + } + else { + c = -1; + } + } + } + + bool done_unit_combine = false; + if (g > 1 && (GEQs[e].coef[0] + GEQs[e2].coef[0]) % g != 0) { + int e3 = newGEQ(); + for(int i = nVars; i >= 1; i--) { + GEQs[e3].coef[i] = (GEQs[e].coef[i] + GEQs[e2].coef[i])/g; + } + GEQs[e3].coef[0] = int_div(GEQs[e].coef[0] + GEQs[e2].coef[0], g); + GEQs[e3].color = GEQs[e].color || GEQs[e2].color; + GEQs[e3].touched = 1; + if (DBUG) { + fprintf(outputFile, "Combined "); + printGEQ(&GEQs[e]); + fprintf(outputFile,"\n and "); + printGEQ(&GEQs[e2]); + fprintf(outputFile,"\n to get #%d: ",e3); + printGEQ(&GEQs[e3]); + fprintf(outputFile,"\n\n"); + } + + done_unit_combine = true; + if (nGEQs > effort+5 || nGEQs > maxmaxGEQs-10) goto doneCombining; + } + + if (c > 0 && !(c == 1 && c2 == 1 && done_unit_combine)) { + bool still_has_wildcard = false; + coef_t p[nVars-safeVars]; + for (int i = nVars; i > safeVars; i--) { + p[i-safeVars-1] = c * GEQs[e].coef[i] + c2 * GEQs[e2].coef[i]; + if (p[i-safeVars-1] != 0) + still_has_wildcard = true; + } + if (still_has_wildcard) { + int e3 = newGEQ(); + for(int i = nVars; i > safeVars; i--) + GEQs[e3].coef[i] = p[i-safeVars-1]; + for (int i = safeVars; i > 0; i--) + GEQs[e3].coef[i] = 0; + GEQs[e3].coef[0] = c * GEQs[e].coef[0] + c2 * GEQs[e2].coef[0]; + GEQs[e3].color = GEQs[e].color || GEQs[e2].color; + GEQs[e3].touched = 1; + if (DBUG) { + fprintf(outputFile, "Additionally combined "); + printGEQ(&GEQs[e]); + fprintf(outputFile,"\n and "); + printGEQ(&GEQs[e2]); + fprintf(outputFile,"\n to get #%d: ",e3); + printGEQ(&GEQs[e3]); + fprintf(outputFile,"\n\n"); + } + + if (nGEQs > effort+5 || nGEQs > maxmaxGEQs-10) goto doneCombining; + } + } + } + } + +doneCombining: + if (normalize() == normalize_false) return 0; + while (nEQs) { + if (!solveEQ()) return 0; + if (normalize() == normalize_false) return 0; + } + return 1; +} + + +void Problem::noteEssential(int onlyWildcards) { + for (int e = nGEQs - 1; e >= 0; e--) { + GEQs[e].essential = 0; + GEQs[e].varCount = 0; + } + if (onlyWildcards) { + for (int e = nGEQs - 1; e >= 0; e--) { + GEQs[e].essential = 1; + for (int i = nVars; i > safeVars; i--) + if (GEQs[e].coef[i] < -1 || GEQs[e].coef[i] > 1) { + GEQs[e].essential = 0; + break; + } + } + } + for (int i = nVars; i >= 1; i--) { + int onlyLB = -1; + int onlyUB = -1; + for (int e = nGEQs - 1; e >= 0; e--) + if (GEQs[e].coef[i] > 0) { + GEQs[e].varCount ++; + if (onlyLB == -1) onlyLB = e; + else onlyLB = -2; + } + else if (GEQs[e].coef[i] < 0) { + GEQs[e].varCount ++; + if (onlyUB == -1) onlyUB = e; + else onlyUB = -2; + } + if (onlyUB >= 0) { + if (DBUG) { + fprintf(outputFile,"only UB: "); + printGEQ(&GEQs[onlyUB]); + fprintf(outputFile,"\n"); + } + GEQs[onlyUB].essential = 1; + } + if (onlyLB >= 0) { + if (DBUG) { + fprintf(outputFile,"only LB: "); + printGEQ(&GEQs[onlyLB]); + fprintf(outputFile,"\n"); + } + GEQs[onlyLB].essential = 1; + } + } + for (int e = nGEQs - 1; e >= 0; e--) + if (!GEQs[e].essential && GEQs[e].varCount > 1) { + int i1,i2,i3; + for (i1 = nVars; i1 >= 1; i1--) if (GEQs[e].coef[i1]) break; + for (i2 = i1-1; i2 >= 1; i2--) if (GEQs[e].coef[i2]) break; + for (i3 = i2-1; i3 >= 1; i3--) if (GEQs[e].coef[i3]) break; + assert(i2 >= 1); + int e2; + for (e2 = nGEQs - 1; e2 >= 0; e2--) + if (e!=e2) { + coef_t crossProduct; + crossProduct = GEQs[e].coef[i1]*GEQs[e2].coef[i1]; + crossProduct += GEQs[e].coef[i2]*GEQs[e2].coef[i2]; + for (int i = i3; i >= 1; i--) + if (GEQs[e2].coef[i]) + crossProduct += GEQs[e].coef[i]*GEQs[e2].coef[i]; + if (crossProduct > 0) { + if (DBUG) fprintf(outputFile,"Cross product of %d and %d is " coef_fmt "\n", e, e2, crossProduct); + break; + } + } + if (e2 < 0) GEQs[e].essential = 1; + } + if (DBUG) { + fprintf(outputFile,"Computed essential equations\n"); + fprintf(outputFile,"essential equations:\n"); + for (int e = 0; e < nGEQs; e++) + if (GEQs[e].essential) { + printGEQ(&GEQs[e]); + fprintf(outputFile,"\n"); + } + fprintf(outputFile,"potentially redundant equations:\n"); + for (int e = 0; e < nGEQs; e++) + if (!GEQs[e].essential) { + printGEQ(&GEQs[e]); + fprintf(outputFile,"\n"); + } + } +} + + +int Problem::findDifference(int e, int &v1, int &v2) { + // if 1 returned, eqn E is of form v1 -coef >= v2 + for(v1=1;v1<=nVars;v1++) + if (GEQs[e].coef[v1]) break; + for(v2=v1+1;v2<=nVars;v2++) + if (GEQs[e].coef[v2]) break; + if (v2 > nVars) { + if (GEQs[e].coef[v1] == -1) { + v2 = v1; + v1 = 0; + return 1; + } + if (GEQs[e].coef[v1] == 1) { + v2 = 0; + return 1; + } + return 0; + } + if (GEQs[e].coef[v1] * GEQs[e].coef[v2] != -1) return 0; + if (GEQs[e].coef[v1] < 0) std::swap(v1,v2); + return 1; +} + + +namespace { + struct succListStruct { + int num; + int notEssential; + int var[maxVars]; + coef_t diff[maxVars]; + int eqn[maxVars]; + }; +} + + +int Problem::chainKill(int color, int onlyWildcards) { + int v1,v2,e; + int essentialPred[maxVars]; + int redundant[maxmaxGEQs]; + int inChain[maxVars]; + int goodStartingPoint[maxVars]; + int tryToEliminate[maxmaxGEQs]; + int triedDoubleKill = 0; + + succListStruct succ[maxVars]; + +restart: + + int anyToKill = 0; + int anyKilled = 0; + int canHandle = 0; + + for(v1=0;v1<=nVars;v1++) { + succ[v1].num = 0; + succ[v1].notEssential = 0; + goodStartingPoint[v1] = 0; + inChain[v1] = -1; + essentialPred[v1] = 0; + } + + int essentialEquations = 0; + for (e = 0; e < nGEQs; e++) { + redundant[e] = 0; + tryToEliminate[e] = !GEQs[e].essential; + if (GEQs[e].essential) essentialEquations++; + if (color && !GEQs[e].color) tryToEliminate[e] = 0; + } + if (essentialEquations == nGEQs) return 0; + if (2*essentialEquations < nVars) return 1; + + for (e = 0; e < nGEQs; e++) + if (tryToEliminate[e] && GEQs[e].varCount <= 2 && findDifference(e,v1,v2)) { + assert(v1 == 0 || GEQs[e].coef[v1] == 1); + assert(v2 == 0 || GEQs[e].coef[v2] == -1); + succ[v2].notEssential++; + int s = succ[v2].num++; + succ[v2].eqn[s] = e; + succ[v2].var[s] = v1; + succ[v2].diff[s] = -GEQs[e].coef[0]; + goodStartingPoint[v2] = 1; + anyToKill++; + canHandle++; + } + if (!anyToKill) { + return canHandle < nGEQs; + } + for (e = 0; e < nGEQs; e++) + if (!tryToEliminate[e] && GEQs[e].varCount <= 2 && findDifference(e,v1,v2)) { + assert(v1 == 0 || GEQs[e].coef[v1] == 1); + assert(v2 == 0 || GEQs[e].coef[v2] == -1); + int s = succ[v2].num++; + essentialPred[v1]++; + succ[v2].eqn[s] = e; + succ[v2].var[s] = v1; + succ[v2].diff[s] = -GEQs[e].coef[0]; + canHandle++; + } + + + if (DBUG) { + int s; + fprintf(outputFile,"In chainkill: [\n"); + for(v1 = 0;v1<=nVars;v1++) { + fprintf(outputFile,"#%d <= %s: ",essentialPred[v1],variable(v1)); + for(s=0;s= succ[v1].diff[s1a]) { + if (DBUG) { + fprintf(outputFile,"quick double kill: "); + printGEQ(&GEQs[succ[v1].eqn[s1a]]); + fprintf(outputFile,"\n"); + } + redundant[succ[v1].eqn[s1a]] = 1; + anyKilled++; + anyToKill--; + goto nextVictim; + } + } + nextVictim: v1 = v1; + } + if (anyKilled) { + for (e = nGEQs-1; e >= 0;e--) + if (redundant[e]) { + if (DBUG) { + fprintf(outputFile,"Deleting "); + printGEQ(&GEQs[e]); + fprintf(outputFile,"\n"); + } + deleteGEQ(e); + } + + if (!anyToKill) return canHandle < nGEQs; + noteEssential(onlyWildcards); + triedDoubleKill = 1; + goto restart; + } + + for(v1 = 0;v1<=nVars;v1++) + if (succ[v1].num == succ[v1].notEssential && succ[v1].notEssential > 0) { + succ[v1].notEssential--; + essentialPred[succ[v1].var[succ[v1].notEssential]]++; + } + + while (1) { + int chainLength; + int chain[maxVars]; + coef_t distance[maxVars]; + // pick a place to start + for(v1 = 0;v1<=nVars;v1++) + if (essentialPred[v1] == 0 && succ[v1].num > succ[v1].notEssential) + break; + if (v1 > nVars) + for(v1 = 0;v1<=nVars;v1++) + if (goodStartingPoint[v1] && succ[v1].num > succ[v1].notEssential) + break; + if (v1 > nVars) break; + + chainLength = 1; + chain[0] = v1; + distance[0] = 0; + inChain[v1] = 0; + int s; + + while (succ[v1].num > succ[v1].notEssential) { + s = succ[v1].num-1; + if (inChain[succ[v1].var[s]] >= 0) { + // Found cycle, don't do anything with them yet + break; + } + succ[v1].num = s; + + distance[chainLength]= distance[chainLength-1] + succ[v1].diff[s]; + v1 = chain[chainLength] = succ[v1].var[s]; + essentialPred[v1]--; + assert(essentialPred[v1] >= 0); + inChain[v1] = chainLength; + chainLength++; + } + + + int c; + if (DBUG) { + fprintf(outputFile,"Found chain: \n"); + for (c = 0; c < chainLength; c++) + fprintf(outputFile,"%s:" coef_fmt " ",variable(chain[c]), distance[c]); + fprintf(outputFile,"\n"); + } + + + for (c = 0; c < chainLength; c++) { + v1 = chain[c]; + for(s=0;s c+1) { + if (DBUG) + fprintf(outputFile,"%s + " coef_fmt " <= %s is in chain\n", variable(v1), distance[inChain[succ[v1].var[s]]]- distance[c], variable(succ[v1].var[s])); + if ( distance[inChain[succ[v1].var[s]]]- distance[c] >= succ[v1].diff[s]) { + if (DBUG) + fprintf(outputFile,"%s + " coef_fmt " <= %s is redundant\n", variable(v1),succ[v1].diff[s], variable(succ[v1].var[s])); + redundant[succ[v1].eqn[s]] = 1; + } + } + } + } + for (c = 0; c < chainLength; c++) + inChain[chain[c]] = -1; + } + + for (e = nGEQs-1; e >= 0;e--) + if (redundant[e]) { + if (DBUG) { + fprintf(outputFile,"Deleting "); + printGEQ(&GEQs[e]); + fprintf(outputFile,"\n"); + } + deleteGEQ(e); + anyKilled = 1; + } + + if (anyKilled) noteEssential(onlyWildcards); + + if (anyKilled && DBUG) { + fprintf(outputFile,"\nResult:\n"); + printProblem(); + } + if (DBUG) { + fprintf(outputFile,"] end chainkill\n"); + printProblem(); + } + return canHandle < nGEQs; +} + + +namespace { + struct varCountStruct { + int e; + int safeVarCount; + int wildVarCount; + varCountStruct(int e_, int count1_, int count2_) { + e = e_; + safeVarCount = count1_; + wildVarCount = count2_; } + }; + bool operator<(const varCountStruct &a, const varCountStruct &b) { + if (a.wildVarCount < b.wildVarCount) + return true; + else if (a.wildVarCount > b.wildVarCount) + return false; + else + return a.safeVarCount < b.safeVarCount; + } +} + + +// +// Deduct redundant inequalities by combination of any two inequalities. +// Return value: 0 (no solution), +// 1 (nothing killed), +// 2 (some inequality killed). +// +int Problem::quickKill(int onlyWildcards, bool desperate) { + if (!onlyWildcards && !combineToTighten()) + return 0; + noteEssential(onlyWildcards); + int moreToDo = chainKill(0, onlyWildcards); + +#ifdef NDEBUG + if (!moreToDo) return 1; +#endif + + + if (!desperate && nGEQs > 256) { // original 60, increased by chun + if (TRACE) { + fprintf(outputFile, "%d inequalities are too complicated to quick kill\n", nGEQs); + } + return 1; + } + + if (DBUG) { + fprintf(outputFile, "in eliminate Redudant:\n"); + printProblem(); + } + + int isDead[nGEQs]; + std::vector killOrder; + std::vector > P(nGEQs, BoolSet<>(nVars)), Z(nGEQs, BoolSet<>(nVars)), N(nGEQs, BoolSet<>(nVars)); + BoolSet<> PP, PZ, PN; // possible Positives, possible zeros & possible negatives + + for (int e = nGEQs - 1; e >= 0; e--) { + isDead[e] = 0; + int safeVarCount = 0; + int wildVarCount = 0; + for (int i = nVars; i >= 1; i--) { + if (GEQs[e].coef[i] == 0) + Z[e].set(i-1); + else { + if (i > safeVars) + wildVarCount++; + else + safeVarCount++; + if (GEQs[e].coef[i] < 0) + N[e].set(i-1); + else + P[e].set(i-1); + } + } + + if (!GEQs[e].essential || wildVarCount > 0) + killOrder.push_back(varCountStruct(e, safeVarCount, wildVarCount)); + } + + sort(killOrder.begin(), killOrder.end()); + + if (DEBUG) { + fprintf(outputFile,"Prefered kill order:\n"); + for (int e3I = killOrder.size()-1; e3I >= 0; e3I--) { + fprintf(outputFile,"%2d: ",nGEQs-1-e3I); + printGEQ(&GEQs[killOrder[e3I].e]); + fprintf(outputFile,"\n"); + } + } + + int e3U = killOrder.size()-1; + while (e3U >= 0) { + // each round of elimination is for inequalities of same complexity and rounds are at descending complexity order + int e3L = e3U-1; + for(; e3L >= 0; e3L--) + if (killOrder[e3L].safeVarCount+killOrder[e3L].wildVarCount != killOrder[e3U].safeVarCount + killOrder[e3U].wildVarCount) + break; + + // check if e3 can be eliminated from combination of e1 and e2 + for (int e1 = 0; e1 < nGEQs; e1++) + if (!isDead[e1]) + for (int e2 = e1+1; e2 < nGEQs; e2++) + if (!isDead[e2]) { + coef_t alpha = 0; + int p, q; + for (p = nVars; p > 1; p--) + for (q = p - 1; q > 0; q--) { + try { + alpha = check_mul(GEQs[e1].coef[p], GEQs[e2].coef[q]) - check_mul(GEQs[e2].coef[p], GEQs[e1].coef[q]); + } + catch (std::overflow_error) { + continue; + } + if (alpha != 0) + goto foundPQ; + } + continue; + + foundPQ: + PZ = (Z[e1] & Z[e2]) | (P[e1] & N[e2]) | (N[e1] & P[e2]); + PP = P[e1] | P[e2]; + PN = N[e1] | N[e2]; + if (DEBUG) { + fprintf(outputFile,"Considering combination of "); + printGEQ(&(GEQs[e1])); + fprintf(outputFile," and "); + printGEQ(&(GEQs[e2])); + fprintf(outputFile,"\n"); + } + + for (int e3I = e3U; e3I > e3L; e3I--) { + int e3 = killOrder[e3I].e; + if (!isDead[e3] && e3 != e1 && e3 != e2) + try { + coef_t alpha1, alpha2, alpha3; + + if (!PZ.imply(Z[e3])) + goto nextE3; + + alpha1 = check_mul(GEQs[e2].coef[q], GEQs[e3].coef[p]) - check_mul(GEQs[e2].coef[p], GEQs[e3].coef[q]); + alpha2 = -(check_mul(GEQs[e1].coef[q], GEQs[e3].coef[p]) - check_mul(GEQs[e1].coef[p], GEQs[e3].coef[q])); + alpha3 = alpha; + + if (alpha1 < 0) { + alpha1 = -alpha1; + alpha2 = -alpha2; + alpha3 = -alpha3; + } + if (alpha1 == 0 || alpha2 <= 0) + goto nextE3; + + { + coef_t g = gcd(gcd(alpha1, alpha2), abs(alpha3)); + alpha1 /= g; + alpha2 /= g; + alpha3 /= g; + } + + if (DEBUG) { + fprintf(outputFile, coef_fmt "e1 + " coef_fmt "e2 = " coef_fmt "e3: ",alpha1,alpha2,alpha3); + printGEQ(&(GEQs[e3])); + fprintf(outputFile,"\n"); + } + + if (alpha3 > 0) { // trying to prove e3 is redundant + if (!GEQs[e3].color && (GEQs[e1].color || GEQs[e2].color)) { + goto nextE3; + } + if (!PP.imply(P[e3]) | !PN.imply(N[e3])) + goto nextE3; + + // verify alpha1*v1+alpha2*v2 = alpha3*v3 + for (int k = nVars; k >= 1; k--) + if (check_mul(alpha3, GEQs[e3].coef[k]) != check_mul(alpha1, GEQs[e1].coef[k]) + check_mul(alpha2, GEQs[e2].coef[k])) + goto nextE3; + + coef_t c = check_mul(alpha1, GEQs[e1].coef[0]) + check_mul(alpha2, GEQs[e2].coef[0]); + if (c < check_mul(alpha3, (GEQs[e3].coef[0] + 1))) { + if (DBUG) { + fprintf(outputFile, "found redundant inequality\n"); + fprintf(outputFile, "alpha1, alpha2, alpha3 = " coef_fmt "," coef_fmt "," coef_fmt "\n", alpha1, alpha2, alpha3); + printGEQ(&(GEQs[e1])); + fprintf(outputFile, "\n"); + printGEQ(&(GEQs[e2])); + fprintf(outputFile, "\n=> "); + printGEQ(&(GEQs[e3])); + fprintf(outputFile, "\n\n"); + assert(moreToDo); + } + + isDead[e3] = 1; + } + } + else { // trying to prove e3 <= 0 or e3 = 0 + if (!PN.imply(P[e3]) | !PP.imply(N[e3])) + goto nextE3; + + // verify alpha1*v1+alpha2*v2 = alpha3*v3 + for (int k = nVars; k >= 1; k--) + if (check_mul(alpha3, GEQs[e3].coef[k]) != check_mul(alpha1, GEQs[e1].coef[k]) + check_mul(alpha2, GEQs[e2].coef[k])) + goto nextE3; + + if (DEBUG) { + fprintf(outputFile,"All but constant term checked\n"); + } + coef_t c = check_mul(alpha1, GEQs[e1].coef[0]) + check_mul(alpha2, GEQs[e2].coef[0]); + if (DEBUG) { + fprintf(outputFile,"All but constant term checked\n"); + fprintf(outputFile,"Constant term is " coef_fmt " vs " coef_fmt "\n", + alpha3*GEQs[e3].coef[0], + alpha3*(GEQs[e3].coef[0]-1)); + } + if (c < check_mul(alpha3, (GEQs[e3].coef[0]))) { + // we just proved e3 < 0, so no solutions exist + if (DBUG) { + fprintf(outputFile, "found implied over tight inequality\n"); + fprintf(outputFile, "alpha1, alpha2, alpha3 = " coef_fmt "," coef_fmt "," coef_fmt "\n", alpha1, alpha2, -alpha3); + printGEQ(&(GEQs[e1])); + fprintf(outputFile, "\n"); + printGEQ(&(GEQs[e2])); + fprintf(outputFile, "\n=> not "); + printGEQ(&(GEQs[e3])); + fprintf(outputFile, "\n\n"); + } + return 0; + } + else if (!GEQs[e3].color && (GEQs[e1].color || GEQs[e2].color)) { + goto nextE3; + } + else if (c < check_mul(alpha3, (GEQs[e3].coef[0] - 1))) { + // we just proved e3 <= 0, so e3 = 0 + if (DBUG) { + fprintf(outputFile, "found implied tight inequality\n"); + fprintf(outputFile, "alpha1, alpha2, alpha3 = " coef_fmt "," coef_fmt "," coef_fmt "\n", alpha1, alpha2, -alpha3); + printGEQ(&(GEQs[e1])); + fprintf(outputFile, "\n"); + printGEQ(&(GEQs[e2])); + fprintf(outputFile, "\n=> inverse "); + printGEQ(&(GEQs[e3])); + fprintf(outputFile, "\n\n"); + } + int neweq = newEQ(); + eqnncpy(&EQs[neweq], &GEQs[e3], nVars); + addingEqualityConstraint(neweq); + isDead[e3] = 1; + } + } + nextE3:; + } + catch (std::overflow_error) { + continue; + } + } + } + + e3U = e3L; + } + + bool anything_killed = false; + for (int e = nGEQs - 1; e >= 0; e--) { + if (isDead[e]) { + anything_killed = true; + deleteGEQ(e); + } + } + + if (DBUG) { + fprintf(outputFile,"\nResult:\n"); + printProblem(); + } + + if (anything_killed) + return 2; + else + return 1; +} + +} // namespace diff --git a/omegalib/omega_lib/src/omega_core/oc_simple.cc b/omegalib/omega_lib/src/omega_core/oc_simple.cc new file mode 100644 index 0000000..ebbf407 --- /dev/null +++ b/omegalib/omega_lib/src/omega_core/oc_simple.cc @@ -0,0 +1,1373 @@ +/***************************************************************************** + Copyright (C) 1994-2000 the Omega Project Team + Copyright (C) 2005-2011 Chun Chen + All Rights Reserved. + + Purpose: + Support functions for solving a problem. + + Notes: + + History: + 10/13/08 Complete back substitution process, Chun Chen. + 05/28/09 Extend normalize process to handle redundancy involving + wilddcards, Chun Chen +*****************************************************************************/ + +#include +#include +#include +#include + +namespace omega { + +int checkIfSingleVar(eqn* e, int i) { + for (; i > 0; i--) + if (e->coef[i]) { + i--; + break; + } + for (; i > 0; i--) + if (e->coef[i]) + break; + return (i == 0); +} + + +int singleVarGEQ(eqn* e) { + return !e->touched && e->key != 0 && -maxVars <= e->key && e->key <= maxVars; +} + + +void checkVars(int nVars) { + if (nVars > maxVars) { + fprintf(stderr, "\nERROR:\n"); + fprintf(stderr, "An attempt was made to create a conjunction with %d variables.\n", nVars); + fprintf(stderr, "The current limit on variables in a single conjunction is %d.\n", maxVars); + fprintf(stderr, "This limit can be changed by changing the #define of maxVars in oc.h.\n\n"); + exit(2); + } +} + + +void Problem::difficulty(int &numberNZs, coef_t &maxMinAbsCoef, coef_t &sumMinAbsCoef) const { + numberNZs=0; + maxMinAbsCoef=0; + sumMinAbsCoef=0; + for (int e = 0; e < nGEQs; e++) { + coef_t maxCoef = 0; + for(int i = 1;i <= nVars;i++) + if (GEQs[e].coef[i]!=0) { + coef_t a = abs(GEQs[e].coef[i]); + maxCoef = max(maxCoef,a); + numberNZs++; + } + coef_t nextCoef = 0; + for(int i = 1;i <= nVars;i++) + if (GEQs[e].coef[i]!=0) { + coef_t a = abs(GEQs[e].coef[i]); + if (a < maxCoef) nextCoef = max(nextCoef,a); + else if (a == maxCoef) maxCoef = 0x7fffffff; + } + maxMinAbsCoef = max(maxMinAbsCoef,nextCoef); + sumMinAbsCoef += nextCoef; + } + + for (int e = 0; e < nEQs; e++) { + coef_t maxCoef = 0; + for(int i = 1;i <= nVars;i++) + if (EQs[e].coef[i]!=0) { + coef_t a = abs(EQs[e].coef[i]); + maxCoef = max(maxCoef,a); + numberNZs++; + } + coef_t nextCoef = 0; + for(int i = 1;i <= nVars;i++) + if (EQs[e].coef[i]!=0) { + coef_t a = abs(EQs[e].coef[i]); + if (a < maxCoef) nextCoef = max(nextCoef,a); + else if (a == maxCoef) maxCoef = 0x7fffffff; + } + maxMinAbsCoef = max(maxMinAbsCoef,nextCoef); + sumMinAbsCoef += nextCoef; + } +} + +int Problem::countRedGEQs() const { + int result = 0; + for (int e = 0; e < nGEQs; e++) + if (GEQs[e].color == EQ_RED) result++; + return result; +} + +int Problem::countRedEQs() const { + int result = 0; + for (int e = 0; e < nEQs; e++) + if (EQs[e].color == EQ_RED) result++; + return result; +} + +int Problem::countRedEquations() const { + int result = 0; + for (int e = 0; e < nEQs; e++) + if (EQs[e].color == EQ_RED) { + int i; + for (i = nVars; i > 0; i--) if (EQs[e].coef[i]) break; + if (i == 0 && EQs[e].coef[0] != 0) return 0; + else result+=2; + } + for (int e = 0; e < nGEQs; e++) + if (GEQs[e].color == EQ_RED) result+=1; + for (int e = 0; e < nMemories; e++) + switch(redMemory[e].kind ) { + case redEQ: + case redStride: + e++; + case redLEQ: + case redGEQ: + e++; + case notRed: + ; /* avoid warning about notRed not handled */ + } + return result; +} + +void Problem::deleteBlack() { + int RedVar[maxVars]; + for(int i = safeVars+1;i <= nVars;i++) RedVar[i] = 0; + + assert(nSUBs == 0); + + for (int e = nEQs-1; e >= 0; e--) + if (EQs[e].color != EQ_RED) { + eqnncpy(&EQs[e],&EQs[nEQs-1], nVars); + nEQs--; + } + else + for(int i = safeVars+1;i <= nVars;i++) + if (EQs[e].coef[i]) RedVar[i] = 1; + + for (int e = nGEQs-1; e >= 0; e--) + if (GEQs[e].color != EQ_RED) { + eqnncpy(&GEQs[e],&GEQs[nGEQs-1], nVars); + nGEQs--; + } + else + for(int i = safeVars+1;i <= nVars;i++) + if (GEQs[e].coef[i]) RedVar[i] = 1; + + assert(nSUBs == 0); + + for(int i = nVars; i > safeVars;i--) { + if (!RedVar[i]) deleteVariable(i); + } +} + + +void Problem::deleteRed() { + int BlackVar[maxVars]; + for(int i = safeVars+1;i <= nVars;i++) BlackVar[i] = 0; + + assert(nSUBs == 0); + for (int e = nEQs-1; e >=0; e--) + if (EQs[e].color) { + eqnncpy(&EQs[e],&EQs[nEQs-1], nVars); + nEQs--; + } + else + for(int i = safeVars+1;i <= nVars;i++) + if (EQs[e].coef[i]) BlackVar[i] = 1; + + for (int e = nGEQs-1; e >=0; e--) + if (GEQs[e].color) { + eqnncpy(&GEQs[e],&GEQs[nGEQs-1], nVars); + nGEQs--; + } + else + for(int i = safeVars+1;i <= nVars;i++) + if (GEQs[e].coef[i]) BlackVar[i] = 1; + + assert(nSUBs == 0); + + for(int i = nVars; i> safeVars;i--) { + if (!BlackVar[i]) deleteVariable(i); + } +} + + +void Problem::turnRedBlack() { + for (int e = nEQs-1; e >= 0; e--) EQs[e].color = 0; + for (int e = nGEQs-1; e >= 0; e--) GEQs[e].color = 0; +} + + +void Problem::useWildNames() { + for(int i = safeVars+1; i <= nVars; i++) nameWildcard(i); +} + + +void negateCoefficients(eqn* eqn, int nVars) { + for (int i = nVars; i >= 0; i--) + eqn-> coef[i] = -eqn->coef[i]; + eqn->touched = true; +} + + +void Problem::negateGEQ(int e) { + negateCoefficients(&GEQs[e],nVars); + GEQs[e].coef[0]--; +} + + +void Problem:: deleteVariable(int i) { + if (i < safeVars) { + int j = safeVars; + for (int e = nGEQs - 1; e >= 0; e--) { + GEQs[e].touched = true; + GEQs[e].coef[i] = GEQs[e].coef[j]; + GEQs[e].coef[j] = GEQs[e].coef[nVars]; + } + for (int e = nEQs - 1; e >= 0; e--) { + EQs[e].coef[i] = EQs[e].coef[j]; + EQs[e].coef[j] = EQs[e].coef[nVars]; + } + for (int e = nSUBs - 1; e >= 0; e--) { + SUBs[e].coef[i] = SUBs[e].coef[j]; + SUBs[e].coef[j] = SUBs[e].coef[nVars]; + } + var[i] = var[j]; + var[j] = var[nVars]; + } + else if (i < nVars) { + for (int e = nGEQs - 1; e >= 0; e--) + if (GEQs[e].coef[nVars]) { + GEQs[e].coef[i] = GEQs[e].coef[nVars]; + GEQs[e].touched = true; + } + for (int e = nEQs - 1; e >= 0; e--) + EQs[e].coef[i] = EQs[e].coef[nVars]; + for (int e = nSUBs - 1; e >= 0; e--) + SUBs[e].coef[i] = SUBs[e].coef[nVars]; + var[i] = var[nVars]; + } + if (i <= safeVars) + safeVars--; + nVars--; +} + + +void Problem::setInternals() { + if (!variablesInitialized) { + initializeVariables(); + } + + var[0] = 0; + nextWildcard = 0; + for(int i = 1;i <= nVars;i++) + if (var[i] < 0) + var[i] = --nextWildcard; + + assert(nextWildcard >= -maxWildcards); + + CHECK_FOR_DUPLICATE_VARIABLE_NAMES; + + int v = nSUBs; + for(int i = 1;i <= safeVars;i++) if (var[i] > 0) v++; + varsOfInterest = v; + + if (nextKey * 3 > maxKeys) { + omega::hashVersion++; + nextKey = maxVars + 1; + for (int e = nGEQs - 1; e >= 0; e--) + GEQs[e].touched = true; + for (int i = 0; i < hashTableSize; i++) + hashMaster[i].touched = -1; + hashVersion = omega::hashVersion; + } + else if (hashVersion != omega::hashVersion) { + for (int e = nGEQs - 1; e >= 0; e--) + GEQs[e].touched = true; + hashVersion = omega::hashVersion; + } +} + + +void Problem::setExternals() { + for (int i = 1; i <= safeVars; i++) + forwardingAddress[var[i]] = i; + for (int i = 0; i < nSUBs; i++) + forwardingAddress[SUBs[i].key] = -i - 1; +} + + +void setOutputFile(FILE * file) { + /* sets the file to which printProblem should send its output to "file" */ + + outputFile = file; +} + + +void setPrintLevel(int level) { + /* Sets the nber of points printed before constraints in printProblem */ + headerLevel = level; +} + + +void Problem::putVariablesInStandardOrder() { + for(int i = 1;i <= safeVars;i++) { + int b = i; + for(int j=i+1;j<=safeVars;j++) { + if (var[b] < var[j]) b = j; + } + if (b != i) swapVars(i,b); + } +} + + +void Problem::nameWildcard(int i) { + int j; + do { + --nextWildcard; + if (nextWildcard < -maxWildcards) + nextWildcard = -1; + var[i] = nextWildcard; + for(j = nVars; j > 0;j--) if (i!=j && var[j] == nextWildcard) break; + } while (j != 0); +} + + +int Problem::protectWildcard(int i) { + assert (i > safeVars); + if (i != safeVars+1) swapVars(i,safeVars+1); + safeVars++; + nameWildcard(safeVars); + return safeVars; +} + + +int Problem::addNewProtectedWildcard() { + int i = ++safeVars; + nVars++; + if (nVars != i) { + for (int e = nGEQs - 1; e >= 0; e--) { + if (GEQs[e].coef[i] != 0) + GEQs[e].touched = true; + GEQs[e].coef[nVars] = GEQs[e].coef[i]; + } + for (int e = nEQs - 1; e >= 0; e--) { + EQs[e].coef[nVars] = EQs[e].coef[i]; + } + for (int e = nSUBs - 1; e >= 0; e--) { + SUBs[e].coef[nVars] = SUBs[e].coef[i]; + } + var[nVars] = var[i]; + } + for (int e = nGEQs - 1; e >= 0; e--) + GEQs[e].coef[i] = 0; + for (int e = nEQs - 1; e >= 0; e--) + EQs[e].coef[i] = 0; + for (int e = nSUBs - 1; e >= 0; e--) + SUBs[e].coef[i] = 0; + nameWildcard(i); + return (i); +} + + +int Problem::addNewUnprotectedWildcard() { + int i = ++nVars; + for (int e = nGEQs - 1; e >= 0; e--) GEQs[e].coef[i] = 0; + for (int e = nEQs - 1; e >= 0; e--) EQs[e].coef[i] = 0; + for (int e = nSUBs - 1; e >= 0; e--) SUBs[e].coef[i] = 0; + nameWildcard(i); + return i; +} + + +void Problem::cleanoutWildcards() { + bool renormalize = false; + + // substituting wildcard equality + for (int e = nEQs-1; e >= 0; e--) { + for (int i = nVars; i >= safeVars+1; i--) + if (EQs[e].coef[i] != 0) { + coef_t c = EQs[e].coef[i]; + coef_t a = abs(c); + + bool preserveThisConstraint = true; + for (int e2 = nEQs-1; e2 >= 0; e2--) + if (e2 != e && EQs[e2].coef[i] != 0 && EQs[e2].color >= EQs[e].color) { + preserveThisConstraint = preserveThisConstraint && (gcd(a,abs(EQs[e2].coef[i])) != 1); + coef_t k = lcm(a, abs(EQs[e2].coef[i])); + coef_t coef1 = (EQs[e2].coef[i]>0?1:-1) * k / c; + coef_t coef2 = k / abs(EQs[e2].coef[i]); + for (int j = nVars; j >= 0; j--) + EQs[e2].coef[j] = EQs[e2].coef[j] * coef2 - EQs[e].coef[j] * coef1; + + coef_t g = 0; + for (int j = nVars; j >= 0; j--) { + g = gcd(abs(EQs[e2].coef[j]), g); + if (g == 1) + break; + } + if (g != 0 && g != 1) + for (int j = nVars; j >= 0; j--) + EQs[e2].coef[j] /= g; + } + + for (int e2 = nGEQs-1; e2 >= 0; e2--) + if (GEQs[e2].coef[i] != 0 && GEQs[e2].color >= EQs[e].color) { + coef_t k = lcm(a, abs(GEQs[e2].coef[i])); + coef_t coef1 = (GEQs[e2].coef[i]>0?1:-1) * k / c; + coef_t coef2 = k / abs(GEQs[e2].coef[i]); + for (int j = nVars; j >= 0; j--) + GEQs[e2].coef[j] = GEQs[e2].coef[j] * coef2 - EQs[e].coef[j] * coef1; + + GEQs[e2].touched = 1; + renormalize = true; + } + + for (int e2 = nSUBs-1; e2 >= 0; e2--) + if (SUBs[e2].coef[i] != 0 && SUBs[e2].color >= EQs[e].color) { + coef_t k = lcm(a, abs(SUBs[e2].coef[i])); + coef_t coef1 = (SUBs[e2].coef[i]>0?1:-1) * k / c; + coef_t coef2 = k / abs(SUBs[e2].coef[i]); + for (int j = nVars; j >= 0; j--) + SUBs[e2].coef[j] = SUBs[e2].coef[j] * coef2 - EQs[e].coef[j] * coef1; + + coef_t g = 0; + for (int j = nVars; j >= 0; j--) { + g = gcd(abs(SUBs[e2].coef[j]), g); + if (g == 1) + break; + } + if (g != 0 && g != 1) + for (int j = nVars; j >= 0; j--) + SUBs[e2].coef[j] /= g; + } + + // remove redundent wildcard equality + if (!preserveThisConstraint) { + if (e < nEQs-1) + eqnncpy (&EQs[e], &EQs[nEQs-1], nVars); + nEQs--; + deleteVariable(i); + } + + break; + } + } + + // remove multi-wildcard equality in approximation mode + if (inApproximateMode) + for (int e = nEQs-1; e >= 0; e--) + for (int i = nVars; i >= safeVars+1; i--) + if (EQs[e].coef[i] != 0) { + int j = i-1; + for (; j >= safeVars+1; j--) + if (EQs[e].coef[j] != 0) + break; + + if (j != safeVars) { + if (e < nEQs-1) + eqnncpy (&EQs[e], &EQs[nEQs-1], nVars); + nEQs--; + } + + break; + } + + if (renormalize) + normalize(); +} + + +void Problem:: check() const { +#ifndef NDEBUG + int v = nSUBs; + checkVars(nVars+1); + for(int i = 1; i <= safeVars; i++) if (var[i] > 0) v++; + assert(v == varsOfInterest); + for(int e = 0; e < nGEQs; e++) assert(GEQs[e].touched || GEQs[e].key != 0); + if(!mayBeRed) { + for(int e = 0; e < nEQs; e++) assert(!EQs[e].color); + for(int e = 0; e < nGEQs; e++) assert(!GEQs[e].color); + } + else + for(int i = safeVars+1; i <= nVars; i++) { + int isBlack = 0; + int isRed = 0; + for(int e = 0; e < nEQs; e++) + if (EQs[e].coef[i]) { + if (EQs[e].color) isRed = 1; + else isBlack = 1; + } + for(int e = 0; e < nGEQs; e++) + if (GEQs[e].coef[i]) { + if (GEQs[e].color) isRed = 1; + else isBlack = 1; + } + if (isBlack && isRed && 0) { + fprintf(outputFile,"Mixed Red and Black variable:\n"); + printProblem(); + } + } +#endif +} + + +void Problem::rememberRedConstraint(eqn *e, redType type, coef_t stride) { + // Check if this is really a stride constraint + if (type == redEQ && newVar == nVars && e->coef[newVar]) { + type = redStride; + stride = e->coef[newVar]; + } + // else for(int i = safeVars+1; i <= nVars; i++) assert(!e->coef[i]); // outdated -- by chun 10/30/2008 + + assert(type != notRed); + assert(type == redStride || stride == 0); + + if (TRACE) { + fprintf(outputFile,"being asked to remember red constraint:\n"); + switch(type) { + case notRed: fprintf(outputFile,"notRed: "); + break; + case redGEQ: fprintf(outputFile,"Red: 0 <= "); + break; + case redLEQ: fprintf(outputFile,"Red: 0 >= "); + break; + case redEQ: fprintf(outputFile,"Red: 0 == "); + break; + case redStride: fprintf(outputFile,"Red stride " coef_fmt ": ",stride); + break; + } + printTerm(e,1); + fprintf(outputFile,"\n"); + printProblem(); + fprintf(outputFile,"----\n"); + } + + // Convert redLEQ to redGEQ + eqn mem; + eqnncpy(&mem,e, nVars); + e = &mem; + if (type == redLEQ) { + for(int i = 0; i <= safeVars; i++) + e->coef[i] = -e->coef[i]; + type = redGEQ; + } + + // Prepare coefficient array for red constraint + bool has_wildcard = false; + coef_t coef[varsOfInterest-nextWildcard+1]; + for (int i = 0; i <= varsOfInterest-nextWildcard; i++) + coef[i] = 0; + for (int i = 0; i <= safeVars; i++) { + if (var[i] < 0) { + if (e->coef[i] != 0) { + coef[varsOfInterest-var[i]] = e->coef[i]; + has_wildcard = true; + } + } + else + coef[var[i]] = e->coef[i]; + } + + // Sophisticated back substituion for wildcards, use Gaussian elimination + // as a fallback if no simple equations available. -- by chun 10/13/2008 + if (has_wildcard) { + // Find substitutions involving wildcard + coef_t *repl_subs[nSUBs]; + int num_wild_in_repl_subs[nSUBs]; + int num_repl_subs = 0; + for (int i = 0; i < nSUBs; i++) { + int t = 0; + for (int j = 1; j <= safeVars; j++) { + if (var[j] < 0 && SUBs[i].coef[j] != 0) + t++; + } + if (t > 0) { + repl_subs[num_repl_subs] = new coef_t[varsOfInterest-nextWildcard+1]; + for (int j = 0; j <= varsOfInterest-nextWildcard; j++) + repl_subs[num_repl_subs][j] = 0; + + for (int k = 0; k <= safeVars; k++) + repl_subs[num_repl_subs][(var[k]<0)?varsOfInterest-var[k]:var[k]] = SUBs[i].coef[k]; + repl_subs[num_repl_subs][SUBs[i].key] = -1; + num_wild_in_repl_subs[num_repl_subs] = t; + num_repl_subs++; + } + } + + int wild_solved[-nextWildcard+1]; + bool has_unsolved = false; + for (int i = 1; i <= -nextWildcard; i++) { + int minimum_wild = 0; + int pos; + for (int j = 0; j < num_repl_subs; j++) + if (repl_subs[j][varsOfInterest+i] != 0 && (minimum_wild == 0 || num_wild_in_repl_subs[j] < minimum_wild)) { + minimum_wild = num_wild_in_repl_subs[j]; + pos = j; + } + + if (minimum_wild == 0) { + wild_solved[i] = -1; + if (coef[varsOfInterest+i] != 0) { + fprintf(outputFile,"No feasible back substitutions available\n"); + printProblem(); + exit(1); + } + } + else if (minimum_wild == 1) + wild_solved[i] = pos; + else { + wild_solved[i] = -1; + if (coef[varsOfInterest+i] != 0) + has_unsolved = true; + } + } + + // Gaussian elimination + while (has_unsolved) { + for (int i = 0; i < num_repl_subs; i++) + if (num_wild_in_repl_subs[i] > 1) { + for (int j = 1; j <= -nextWildcard; j++) { + if (repl_subs[i][varsOfInterest+j] != 0 && wild_solved[j] >= 0) { + int s = wild_solved[j]; + coef_t l = lcm(abs(repl_subs[i][varsOfInterest+j]), abs(repl_subs[s][varsOfInterest+j])); + coef_t scale_1 = l/abs(repl_subs[i][varsOfInterest+j]); + coef_t scale_2 = l/abs(repl_subs[s][varsOfInterest+j]); + int sign = ((repl_subs[i][varsOfInterest+j]>0)?1:-1) * ((repl_subs[s][varsOfInterest+j]>0)?1:-1); + for (int k = 0; k <= varsOfInterest-nextWildcard; k++) + repl_subs[i][k] = scale_1*repl_subs[i][k] - sign*scale_2*repl_subs[s][k]; + num_wild_in_repl_subs[i]--; + } + } + + if (num_wild_in_repl_subs[i] == 1) { + for (int j = 1; j <= -nextWildcard; j++) + if (repl_subs[i][varsOfInterest+j] != 0) { + assert(wild_solved[j]==-1); + wild_solved[j] = i; + break; + } + } + else if (num_wild_in_repl_subs[i] > 1) { + int pos = 0; + for (int j = 1; j <= -nextWildcard; j++) + if (repl_subs[i][varsOfInterest+j] != 0) { + pos = j; + break; + } + assert(pos > 0); + + for (int j = i+1; j < num_repl_subs; j++) + if (repl_subs[j][varsOfInterest+pos] != 0) { + coef_t l = lcm(abs(repl_subs[i][varsOfInterest+pos]), abs(repl_subs[j][varsOfInterest+pos])); + coef_t scale_1 = l/abs(repl_subs[i][varsOfInterest+pos]); + coef_t scale_2 = l/abs(repl_subs[j][varsOfInterest+pos]); + int sign = ((repl_subs[i][varsOfInterest+pos]>0)?1:-1) * ((repl_subs[j][varsOfInterest+pos]>0)?1:-1); + for (int k = 0; k <= varsOfInterest-nextWildcard; k++) + repl_subs[j][k] = scale_2*repl_subs[j][k] - sign*scale_1*repl_subs[i][k]; + + num_wild_in_repl_subs[j] = 0; + int first_wild = 0; + for (int k = 1; k <= -nextWildcard; k++) + if (repl_subs[j][varsOfInterest+k] != 0) { + num_wild_in_repl_subs[j]++; + first_wild = k; + } + + if (num_wild_in_repl_subs[j] == 1) { + if (wild_solved[first_wild] < 0) + wild_solved[first_wild] = j; + } + } + } + } + + has_unsolved = false; + for (int i = 1; i <= -nextWildcard; i++) + if (coef[varsOfInterest+i] != 0 && wild_solved[i] < 0) { + has_unsolved = true; + break; + } + } + + // Substitute all widecards in the red constraint + for (int i = 1; i <= -nextWildcard; i++) { + if (coef[varsOfInterest+i] != 0) { + int s = wild_solved[i]; + assert(s >= 0); + + coef_t l = lcm(abs(coef[varsOfInterest+i]), abs(repl_subs[s][varsOfInterest+i])); + coef_t scale_1 = l/abs(coef[varsOfInterest+i]); + coef_t scale_2 = l/abs(repl_subs[s][varsOfInterest+i]); + int sign = ((coef[varsOfInterest+i]>0)?1:-1) * ((repl_subs[s][varsOfInterest+i]>0)?1:-1); + for (int j = 0; j <= varsOfInterest-nextWildcard; j++) + coef[j] = scale_1*coef[j] - sign*scale_2*repl_subs[s][j]; + + if (scale_1 != 1) + stride *= scale_1; + } + } + + for (int i = 0; i < num_repl_subs; i++) + delete []repl_subs[i]; + } + + // Ready to insert into redMemory + int m = nMemories++; + redMemory[m].length = 0; + redMemory[m].kind = type; + redMemory[m].constantTerm = coef[0]; + for(int i = 1; i <= varsOfInterest; i++) + if (coef[i]) { + int j = redMemory[m].length++; + redMemory[m].coef[j] = coef[i]; + redMemory[m].var[j] = i; + } + if (type == redStride) redMemory[m].stride = stride; + if (DBUG) { + fprintf(outputFile,"Red constraint remembered\n"); + printProblem(); + } +} + +void Problem::recallRedMemories() { + if (nMemories) { + if (TRACE) { + fprintf(outputFile,"Recalling red memories\n"); + printProblem(); + } + + eqn* e = 0; + for(int m = 0; m < nMemories; m++) { + switch(redMemory[m].kind) { + case redGEQ: + { + int temporary_eqn = newGEQ(); + e = &GEQs[temporary_eqn]; + eqnnzero(e, nVars); + e->touched = 1; + break; + } + case redEQ: + { + int temporary_eqn = newEQ(); + e = &EQs[temporary_eqn]; + eqnnzero(e, nVars); + break; + } + case redStride: + { + int temporary_eqn = newEQ(); + e = &EQs[temporary_eqn]; + eqnnzero(e, nVars); + int i = addNewUnprotectedWildcard(); + e->coef[i] = -redMemory[m].stride; + break; + } + default: + assert(0); + } + e->color = EQ_RED; + e->coef[0] = redMemory[m].constantTerm; + for(int i = 0; i < redMemory[m].length; i++) { + int v = redMemory[m].var[i]; + assert(var[forwardingAddress[v]] == v); + e->coef[forwardingAddress[v]] = redMemory[m].coef[i]; + } + } + + nMemories = 0; + if (TRACE) { + fprintf(outputFile,"Red memories recalled\n"); + printProblem(); + } + } +} + +void Problem::swapVars(int i, int j) { + if (DEBUG) { + use_ugly_names++; + fprintf(outputFile, "Swapping %d and %d\n", i, j); + printProblem(); + use_ugly_names--; + } + std::swap(var[i], var[j]); + for (int e = nGEQs - 1; e >= 0; e--) + if (GEQs[e].coef[i] != GEQs[e].coef[j]) { + GEQs[e].touched = true; + coef_t t = GEQs[e].coef[i]; + GEQs[e].coef[i] = GEQs[e].coef[j]; + GEQs[e].coef[j] = t; + } + for (int e = nEQs - 1; e >= 0; e--) + if (EQs[e].coef[i] != EQs[e].coef[j]) { + coef_t t = EQs[e].coef[i]; + EQs[e].coef[i] = EQs[e].coef[j]; + EQs[e].coef[j] = t; + } + for (int e = nSUBs - 1; e >= 0; e--) + if (SUBs[e].coef[i] != SUBs[e].coef[j]) { + coef_t t = SUBs[e].coef[i]; + SUBs[e].coef[i] = SUBs[e].coef[j]; + SUBs[e].coef[j] = t; + } + if (DEBUG) { + use_ugly_names++; + fprintf(outputFile, "Swapping complete \n"); + printProblem(); + fprintf(outputFile, "\n"); + use_ugly_names--; + } +} + +void Problem::addingEqualityConstraint(int e) { + if (addingOuterEqualities && originalProblem != noProblem && + originalProblem != this && !conservative) { + int e2 = originalProblem->newEQ(); + if (TRACE) + fprintf(outputFile, "adding equality constraint %d to outer problem\n", e2); + eqnnzero(&originalProblem->EQs[e2], originalProblem->nVars); + for (int i = nVars; i >= 1; i--) { + int j; + for (j = originalProblem->nVars; j >= 1; j--) + if (originalProblem->var[j] == var[i]) + break; + if (j <= 0 || (outerColor && j > originalProblem->safeVars)) { + if (DBUG) + fprintf(outputFile, "retracting\n"); + originalProblem->nEQs--; + return; + } + originalProblem->EQs[e2].coef[j] = EQs[e].coef[i]; + } + originalProblem->EQs[e2].coef[0] = EQs[e].coef[0]; + + originalProblem->EQs[e2].color = outerColor; + if (DBUG) + originalProblem->printProblem(); + } +} + + +// Initialize hash codes for inequalities, remove obvious redundancy. +// Case 1: +// a1*x1+a2*x2+...>=c (1) +// a1*x2+a2*x2+...>=c' (2) +// if c>=c' then (2) is redundant, and vice versa. +// +// case 2: +// a1*x1+a2*x2+...>=c (1) +// a1*x1+a2*x2+...<=c' (2) +// if c=c' then add equality of (1) or (2), +// if c>c' then no solution. +// +// Finally it calls extended normalize process which handles +// wildcards in redundacy removal. +normalizeReturnType Problem::normalize() { + int i, j; + bool coupledSubscripts = false; + + check(); + + for (int e = 0; e < nGEQs; e++) { + if (!GEQs[e].touched) { + if (!singleVarGEQ(&GEQs[e])) + coupledSubscripts = true; + } + else { // normalize e + coef_t g; + int topVar; + int i0; + coef_t hashCode; + + { + int *p = &packing[0]; + for (int k = 1; k <= nVars; k++) + if (GEQs[e].coef[k]) { + *(p++) = k; + } + topVar = (p - &packing[0]) - 1; + } + + if (topVar == -1) { + if (GEQs[e].coef[0] < 0) { + // e has no solution + return (normalize_false); + } + deleteGEQ(e); + e--; + continue; + } + else if (topVar == 0) { + int singleVar = packing[0]; + g = GEQs[e].coef[singleVar]; + if (g > 0) { + GEQs[e].coef[singleVar] = 1; + GEQs[e].key = singleVar; + } + else { + g = -g; + GEQs[e].coef[singleVar] = -1; + GEQs[e].key = -singleVar; + } + if (g > 1) + GEQs[e].coef[0] = int_div(GEQs[e].coef[0], g); + } + else { + coupledSubscripts = true; + i0 = topVar; + i = packing[i0--]; + g = GEQs[e].coef[i]; + hashCode = g * (i + 3); + if (g < 0) + g = -g; + for (; i0 >= 0; i0--) { + coef_t x; + i = packing[i0]; + x = GEQs[e].coef[i]; + hashCode = hashCode * keyMult * (i + 3) + x; + if (x < 0) + x = -x; + if (x == 1) { + g = 1; + i0--; + break; + } + else + g = gcd(x, g); + } + for (; i0 >= 0; i0--) { + coef_t x; + i = packing[i0]; + x = GEQs[e].coef[i]; + hashCode = hashCode * keyMult * (i + 3) + x; + } + if (g > 1) { + GEQs[e].coef[0] = int_div(GEQs[e].coef[0], g); + i0 = topVar; + i = packing[i0--]; + GEQs[e].coef[i] = GEQs[e].coef[i] / g; + hashCode = GEQs[e].coef[i] * (i + 3); + for (; i0 >= 0; i0--) { + i = packing[i0]; + GEQs[e].coef[i] = GEQs[e].coef[i] / g; + hashCode = hashCode * keyMult * (i + 3) + GEQs[e].coef[i]; + } + } + + { + coef_t g2 = abs(hashCode); // get e's hash code + j = static_cast(g2 % static_cast(hashTableSize)); + assert (g2 % (coef_t) hashTableSize == j); + while (1) { + eqn *proto = &(hashMaster[j]); + if (proto->touched == g2) { + if (proto->coef[0] == topVar) { + if (hashCode >= 0) + for (i0 = topVar; i0 >= 0; i0--) { + i = packing[i0]; + if (GEQs[e].coef[i] != proto->coef[i]) + break; + } + else + for (i0 = topVar; i0 >= 0; i0--) { + i = packing[i0]; + if (GEQs[e].coef[i] != -proto->coef[i]) + break; + } + + if (i0 < 0) { + if (hashCode >= 0) + GEQs[e].key = proto->key; + else + GEQs[e].key = -proto->key; + break; + } + } + } + else if (proto->touched < 0) { //insert e into the empty entry in hash table + eqnnzero(proto, nVars); + if (hashCode >= 0) + for (i0 = topVar; i0 >= 0; i0--) { + i = packing[i0]; + proto->coef[i] = GEQs[e].coef[i]; + } + else + for (i0 = topVar; i0 >= 0; i0--) { + i = packing[i0]; + proto->coef[i] = -GEQs[e].coef[i]; + } + proto->coef[0] = topVar; + proto->touched = g2; + proto->key = nextKey++; + + if (proto->key > maxKeys) { + fprintf(outputFile, "too many hash keys generated \n"); + fflush(outputFile); + exit(2); + } + if (hashCode >= 0) + GEQs[e].key = proto->key; + else + GEQs[e].key = -proto->key; + break; + } + j = (j + 1) % hashTableSize; + } + } + } + } + + GEQs[e].touched = false; + + { + int eKey = GEQs[e].key; + int e2; + if (e > 0) { + e2 = fastLookup[maxKeys - eKey]; + if (e2 >= 0 && e2 < e && GEQs[e2].key == -eKey) { + // confirm it is indeed a match -- by chun 10/29/2008 + int k; + for (k = nVars; k >= 1; k--) + if (GEQs[e2].coef[k] != -GEQs[e].coef[k]) + break; + + if (k == 0) { + if (GEQs[e2].coef[0] < -GEQs[e].coef[0]) { + // there is no solution from e and e2 + return (normalize_false); + } + else if (GEQs[e2].coef[0] == -GEQs[e].coef[0]) { + // reduce e and e2 to an equation + int neweq = newEQ(); + eqnncpy(&EQs[neweq], &GEQs[e], nVars); + EQs[neweq].color = GEQs[e].color || GEQs[e2].color; + addingEqualityConstraint(neweq); + } + } + } + + e2 = fastLookup[maxKeys + eKey]; + if (e2 >= 0 && e2 < e && GEQs[e2].key == eKey) { + // confirm it is indeed a match -- by chun 10/29/2008 + int k; + for (k = nVars; k >= 1; k--) + if (GEQs[e2].coef[k] != GEQs[e].coef[k]) + break; + + if (k == 0) { + if (GEQs[e2].coef[0] > GEQs[e].coef[0] || + (GEQs[e2].coef[0] == GEQs[e].coef[0] && GEQs[e2].color)) { + // e2 is redundant + GEQs[e2].coef[0] = GEQs[e].coef[0]; + GEQs[e2].color = GEQs[e].color; + deleteGEQ(e); + e--; + continue; + } + else { + // e is redundant + deleteGEQ(e); + e--; + continue; + } + } + } + } + fastLookup[maxKeys + eKey] = e; + } + } + + // bypass entended normalization for temporary problem + if (!isTemporary && !inApproximateMode) + normalize_ext(); + + return coupledSubscripts ? normalize_coupled : normalize_uncoupled; +} + +// +// Extended normalize process, remove redundancy involving wildcards. +// e.g. +// exists alpha, beta: +// v1+8*alpha<=v2<=15+8*alpha (1) +// v1+8*beta<=v2<=15+8*beta (2) +// if there are no other inequalities involving alpha or beta, +// then either (1) or (2) is redundant. Such case can't be simplified +// by fourier-motzkin algorithm due to special meanings of existentials. +// +void Problem::normalize_ext() { + std::vector > disjoint_wildcards(nVars-safeVars, BoolSet<>(nVars-safeVars)); + std::vector > wildcards_in_inequality(nVars-safeVars, BoolSet<>(nGEQs)); + for (int i = 0; i < nVars-safeVars; i++) { + disjoint_wildcards[i].set(i); + } + + // create disjoint wildcard sets according to inequalities + for (int e = 0; e < nGEQs; e++) { + std::vector >::iterator first_set = disjoint_wildcards.end(); + for (int i = 0; i < nVars-safeVars; i++) + if (GEQs[e].coef[i+safeVars+1] != 0) { + wildcards_in_inequality[i].set(e); + + std::vector >::iterator cur_set = disjoint_wildcards.end(); + for (std::vector >::iterator j = disjoint_wildcards.begin(); j != disjoint_wildcards.end(); j++) + if ((*j).get(i)) { + cur_set = j; + break; + } + assert(cur_set!=disjoint_wildcards.end()); + if (first_set == disjoint_wildcards.end()) + first_set = cur_set; + else if (first_set != cur_set) { + *first_set |= *cur_set; + disjoint_wildcards.erase(cur_set); + } + } + } + + // do not consider wildcards appearing in equalities + for (int e = 0; e < nEQs; e++) + for (int i = 0; i < nVars-safeVars; i++) + if (EQs[e].coef[i+safeVars+1] != 0) { + for (std::vector >::iterator j = disjoint_wildcards.begin(); j != disjoint_wildcards.end(); j++) + if ((*j).get(i)) { + disjoint_wildcards.erase(j); + break; + } + } + + // create disjoint inequality sets + std::vector > disjoint_inequalities(disjoint_wildcards.size()); + for (size_t i = 0; i < disjoint_wildcards.size(); i++) + for (int j = 0; j < nVars-safeVars; j++) + if (disjoint_wildcards[i].get(j)) + disjoint_inequalities[i] |= wildcards_in_inequality[j]; + + // hash the inequality again, this time separate wildcard variables from + // regular variables + coef_t hash_safe[nGEQs]; + coef_t hash_wild[nGEQs]; + for (int e = 0; e < nGEQs; e++) { + coef_t hashCode = 0; + for (int i = 1; i <= safeVars; i++) + if (GEQs[e].coef[i] != 0) + hashCode = hashCode * keyMult * (i+3) + GEQs[e].coef[i]; + hash_safe[e] = hashCode; + + hashCode = 0; + for (int i = safeVars+1; i <= nVars; i++) + if (GEQs[e].coef[i] != 0) + hashCode = hashCode * keyMult + GEQs[e].coef[i]; + hash_wild[e] = hashCode; + } + + // sort hash keys for each disjoint set + std::vector > > > disjoint_hash(disjoint_inequalities.size()); + for (size_t i = 0; i < disjoint_inequalities.size(); i++) + for (int e = 0; e < nGEQs; e++) + if (disjoint_inequalities[i].get(e)) { + std::vector > >::iterator j = disjoint_hash[i].begin(); + for (; j != disjoint_hash[i].end(); j++) + if ((hash_safe[e] > (*j).second.first) || + (hash_safe[e] == (*j).second.first && hash_wild[e] > (*j).second.second)) + break; + disjoint_hash[i].insert(j, std::make_pair(e, std::make_pair(hash_safe[e], hash_wild[e]))); + } + + // test wildcard equivalance + std::vector is_dead(nGEQs, false); + for (size_t i = 0; i < disjoint_wildcards.size(); i++) { + if (disjoint_inequalities[i].num_elem() == 0) + continue; + + for (size_t j = i+1; j < disjoint_wildcards.size(); j++) { + if (disjoint_wildcards[i].num_elem() != disjoint_wildcards[j].num_elem() || + disjoint_hash[i].size() != disjoint_hash[j].size()) + continue; + + bool match = true; + for (size_t k = 0; k < disjoint_hash[i].size(); k++) { + if (disjoint_hash[i][k].second != disjoint_hash[j][k].second) { + match = false; + break; + } + } + if (!match) + continue; + + // confirm same coefficients for regular variables + for (size_t k = 0; k < disjoint_hash[i].size(); k++) { + for (int p = 1; p <= safeVars; p++) + if (GEQs[disjoint_hash[i][k].first].coef[p] != GEQs[disjoint_hash[j][k].first].coef[p]) { + match = false; + break; + } + if (!match) + break; + } + if (!match) + continue; + + // now try combinatory wildcard matching + std::vector wild_map(nVars-safeVars, -1); + for (size_t k = 0; k < disjoint_hash[i].size(); k++) { + int e1 = disjoint_hash[i][k].first; + int e2 = disjoint_hash[j][k].first; + + for (int p = 0; p < nVars-safeVars; p++) + if (GEQs[e1].coef[p+safeVars+1] != 0) { + if (wild_map[p] == -1) { + for (int q = 0; q < nVars-safeVars; q++) + if (wild_map[q] == -1 && + GEQs[e2].coef[q+safeVars+1] == GEQs[e1].coef[p+safeVars+1]) { + wild_map[p] = q; + wild_map[q] = p; + break; + } + if (wild_map[p] == -1) { + match = false; + break; + } + } + else if (GEQs[e2].coef[wild_map[p]+safeVars+1] != GEQs[e1].coef[p+safeVars+1]) { + match = false; + break; + } + } + if (!match) + break; + + for (int p = 0; p < nVars-safeVars; p++) + if (GEQs[e2].coef[p+safeVars+1] != 0 && + (wild_map[p] == -1 || GEQs[e2].coef[p+safeVars+1] != GEQs[e1].coef[wild_map[p]+safeVars+1])) { + match = false; + break; + } + if (!match) + break; + } + if (!match) + continue; + + // check constants + int dir = 0; + for (size_t k = 0; k < disjoint_hash[i].size(); k++) { + if (GEQs[disjoint_hash[i][k].first].coef[0] > GEQs[disjoint_hash[j][k].first].coef[0]) { + if (dir == 0) + dir = 1; + else if (dir == -1) { + match = false; + break; + } + } + else if (GEQs[disjoint_hash[i][k].first].coef[0] < GEQs[disjoint_hash[j][k].first].coef[0]) { + if (dir == 0) + dir = -1; + else if (dir == 1) { + match = false; + break; + } + } + } + if (!match) + continue; + + // check redness + int red_dir = 0; + for (size_t k = 0; k < disjoint_hash[i].size(); k++) { + if (GEQs[disjoint_hash[i][k].first].color > GEQs[disjoint_hash[j][k].first].color) { + if (red_dir == 0) + red_dir = 1; + else if (red_dir == -1) { + match = false; + break; + } + } + else if (GEQs[disjoint_hash[i][k].first].color < GEQs[disjoint_hash[j][k].first].color) { + if (red_dir == 0) + red_dir = -1; + else if (red_dir == 1) { + match = false; + break; + } + } + } + if (!match) + continue; + + // remove redundant inequalities + if (dir == 1 || (dir == 0 && red_dir == 1)) { + for (size_t k = 0; k < disjoint_hash[i].size(); k++) { + GEQs[disjoint_hash[i][k].first].coef[0] = GEQs[disjoint_hash[j][k].first].coef[0]; + GEQs[disjoint_hash[i][k].first].color = GEQs[disjoint_hash[j][k].first].color; + is_dead[disjoint_hash[j][k].first] = true; + } + } + else { + for (size_t k = 0; k < disjoint_hash[i].size(); k++) { + is_dead[disjoint_hash[j][k].first] = true; + } + } + } + } + + // eliminate dead inequalities + for (int e = nGEQs-1; e >= 0; e--) + if (is_dead[e]) { + deleteGEQ(e); + } +} + + +void initializeOmega(void) { + if (omegaInitialized) + return; + +// assert(sizeof(eqn)==sizeof(int)*(headerWords)+sizeof(coef_t)*(1+maxVars)); + nextWildcard = 0; + nextKey = maxVars + 1; + for (int i = 0; i < hashTableSize; i++) + hashMaster[i].touched = -1; + + sprintf(wildName[1], "__alpha"); + sprintf(wildName[2], "__beta"); + sprintf(wildName[3], "__gamma"); + sprintf(wildName[4], "__delta"); + sprintf(wildName[5], "__tau"); + sprintf(wildName[6], "__sigma"); + sprintf(wildName[7], "__chi"); + sprintf(wildName[8], "__omega"); + sprintf(wildName[9], "__pi"); + sprintf(wildName[10], "__ni"); + sprintf(wildName[11], "__Alpha"); + sprintf(wildName[12], "__Beta"); + sprintf(wildName[13], "__Gamma"); + sprintf(wildName[14], "__Delta"); + sprintf(wildName[15], "__Tau"); + sprintf(wildName[16], "__Sigma"); + sprintf(wildName[17], "__Chi"); + sprintf(wildName[18], "__Omega"); + sprintf(wildName[19], "__Pi"); + + omegaInitialized = 1; +} + +// +// This is experimental (I would say, clinical) fact: +// If the code below is removed then simplifyProblem cycles. +// +class brainDammage { +public: + brainDammage(); +}; + +brainDammage::brainDammage() { + initializeOmega(); +} + +static brainDammage Podgorny; + +} // namespace diff --git a/omegalib/omega_lib/src/omega_core/oc_solve.cc b/omegalib/omega_lib/src/omega_core/oc_solve.cc new file mode 100644 index 0000000..c25b6d0 --- /dev/null +++ b/omegalib/omega_lib/src/omega_core/oc_solve.cc @@ -0,0 +1,1378 @@ +/***************************************************************************** + Copyright (C) 1994-2000 the Omega Project Team + Copyright (C) 2005-2011 Chun Chen + All Rights Reserved. + + Purpose: + Solve ineqalities. + + Notes: + + History: +*****************************************************************************/ + +#include + +namespace omega { + +static int solveDepth = 0; +#define maxDead maxmaxGEQs + +int Problem::solve(int desiredResult) { + assert(omegaInitialized); + int result; + + checkVars(nVars+1); + assert(nVars >= safeVars); + if (desiredResult != OC_SOLVE_SIMPLIFY) + safeVars = 0; + + solveDepth++; + if (solveDepth > 50) { + fprintf(outputFile, "Solve depth = %d, inApprox = %d, aborting\n", solveDepth, inApproximateMode); + printProblem(); + fflush(outputFile); + + if (solveDepth > 60) + exit(2); + } + + check(); + do { + doItAgain = 0; + check(); + if (solveEQ() == false) { + solveDepth--; + return (false); + } + check(); + if (!nGEQs) { + result = true; + nVars = safeVars; + break; + } + else + result = solveGEQ(desiredResult); + check(); + } + while (doItAgain && desiredResult == OC_SOLVE_SIMPLIFY); + solveDepth--; + + return (result); +} + + +// Supporting functions of solveGEQ +int Problem::smoothWeirdEquations() { + int e1, e2, e3, p, q, k; + coef_t alpha, alpha1, alpha2, alpha3; + coef_t c; + int v; + int result = 0; + + for (e1 = nGEQs - 1; e1 >= 0; e1--) + if (!GEQs[e1].color) { + coef_t g = 999999; + for (v = nVars; v >= 1; v--) + if (GEQs[e1].coef[v] != 0 && abs(GEQs[e1].coef[v]) < g) + g = abs(GEQs[e1].coef[v]); + if (g > 20) { + e3 = newGEQ(); /* Create a scratch GEQ,not part of the prob.*/ + nGEQs--; + for (v = nVars; v >= 1; v--) + GEQs[e3].coef[v] = int_div(6 * GEQs[e1].coef[v] + g / 2, g); + GEQs[e3].color = EQ_BLACK; + GEQs[e3].touched = 1; + GEQs[e3].coef[0] = 9997; + if (DBUG) { + fprintf(outputFile, "Checking to see if we can derive: "); + printGEQ(&GEQs[e3]); + fprintf(outputFile, "\n from: "); + printGEQ(&GEQs[e1]); + fprintf(outputFile, "\n"); + } + + + for (e2 = nGEQs - 1; e2 >= 0; e2--) + if (e1 != e2 && !GEQs[e2].color) { + for (p = nVars; p > 1; p--) { + for (q = p - 1; q > 0; q--) { + alpha = check_mul(GEQs[e1].coef[p], GEQs[e2].coef[q]) - check_mul(GEQs[e2].coef[p], GEQs[e1].coef[q]); + if (alpha != 0) + goto foundPQ; + } + } + continue; + + foundPQ: + + alpha1 = check_mul(GEQs[e2].coef[q], GEQs[e3].coef[p]) - check_mul(GEQs[e2].coef[p], GEQs[e3].coef[q]); + alpha2 = -(check_mul(GEQs[e1].coef[q], GEQs[e3].coef[p]) - check_mul(GEQs[e1].coef[p], GEQs[e3].coef[q])); + alpha3 = alpha; + + if (alpha1 * alpha2 <= 0) + continue; + if (alpha1 < 0) { + alpha1 = -alpha1; + alpha2 = -alpha2; + alpha3 = -alpha3; + } + if (alpha3 > 0) { + /* Trying to prove e3 is redundant */ + + /* verify alpha1*v1+alpha2*v2 = alpha3*v3 */ + for (k = nVars; k >= 1; k--) + if (check_mul(alpha3, GEQs[e3].coef[k]) + != check_mul(alpha1, GEQs[e1].coef[k]) + check_mul(alpha2, GEQs[e2].coef[k])) + goto nextE2; + + c = check_mul(alpha1, GEQs[e1].coef[0]) + check_mul(alpha2, GEQs[e2].coef[0]); + if (c < check_mul(alpha3, (GEQs[e3].coef[0] + 1))) + GEQs[e3].coef[0] = int_div(c, alpha3); + + } + nextE2:; + } + if (GEQs[e3].coef[0] < 9997) { + result++; +#if !defined NDEBUG + int e4 = +#endif + newGEQ(); +#if !defined NDEBUG + assert(e3 == e4); +#endif + if (DBUG) { + fprintf(outputFile, "Smoothing wierd equations; adding:\n"); + printGEQ(&GEQs[e3]); + fprintf(outputFile, "\nto:\n"); + printProblem(); + fprintf(outputFile, "\n\n"); + } + } + } + } + return (result); +} + + +void Problem::analyzeElimination( + int &v, + int &darkConstraints, + int &darkShadowFeasible, + int &unit, + coef_t ¶llelSplinters, + coef_t &disjointSplinters, + coef_t &lbSplinters, + coef_t &ubSplinters, + int ¶llelLB) { + + parallelSplinters = (posInfinity); // was MAXINT + disjointSplinters = 0; + lbSplinters = 0; + ubSplinters = 0; + + darkConstraints = 0; + darkShadowFeasible = 1; + coef_t maxUBc = 0; + coef_t maxLBc = 0; + int e,e2; + unit = 0; + int exact = 1; + + for (e = nGEQs - 1; e >= 0; e--) { + coef_t c = GEQs[e].coef[v]; + + if (c < 0) { + coef_t Lc, Uc, g, diff, grey; + + set_max(maxUBc, -c); + Uc = -c; + for (e2 = nGEQs - 1; e2 >= 0; e2--) + if (GEQs[e2].coef[v] > 0) { + Lc = GEQs[e2].coef[v]; + g = 0; + grey = (Lc - 1) * (Uc - 1); + + for (int j = nVars; j >= 1; j--) { + coef_t diff = check_mul(Lc, GEQs[e].coef[j]) + check_mul(Uc, GEQs[e2].coef[j]); + if (diff < 0) diff = -diff; + g = gcd(g, diff); + if (g == 1) + break; + } + diff = check_mul(Lc, GEQs[e].coef[0]) + check_mul(Uc, GEQs[e2].coef[0]); + if (g == 0) { + if (diff < 0) { + /* Real shadow must be true */ + /* otherwise we would have found it during */ + /* check for opposing constraints */ + fprintf(outputFile, "Found conflicting constraints "); + printGEQ(&GEQs[e]); + fprintf(outputFile," and "); + printGEQ(&GEQs[e2]); + fprintf(outputFile,"\nin\n"); + printProblem(); + assert(diff >= 0); + } + if (diff < grey) { + darkShadowFeasible = 0; + if (parallelSplinters > diff+1) { + parallelSplinters = diff + 1; + parallelLB = e2; + } + } + else {/* dark shadow is true, don't need to worry about this constraint pair */ + } + } + else { + coef_t splinters= int_div(diff, g) - int_div(diff - grey, g); + if (splinters) exact = 0; + disjointSplinters += splinters; + if (g > 1) unit++; + darkConstraints++; + } + } + } + else if (c > 0) { + set_max(maxLBc, c); + } /* else + darkConstraints++; */ + } + + if (darkShadowFeasible) { + disjointSplinters++; + ubSplinters++; + lbSplinters++; + } + else disjointSplinters = (posInfinity); // was MAXINT + + + if (!darkShadowFeasible || !exact) + for (e = nGEQs - 1; e >= 0; e--) { + coef_t c = GEQs[e].coef[v]; + if (c < -1) { + c = -c; + ubSplinters += 1+(check_mul(c, maxLBc) - c - maxLBc) / maxLBc; + } + else if (c > 1) { + lbSplinters += 1+ (check_mul(c, maxUBc) - c - maxUBc) / maxUBc; + } + } + + if (DEBUG) { + fprintf(outputFile,"analyzing elimination of %s(%d)\n",variable(v),v); + if (darkShadowFeasible) + fprintf(outputFile," # dark constraints = %d\n", darkConstraints); + else + fprintf(outputFile," dark shadow obviously unfeasible\n"); + + fprintf(outputFile," " coef_fmt " LB splinters\n", lbSplinters); + fprintf(outputFile," " coef_fmt " UB splinters\n", ubSplinters); + if (disjointSplinters != (posInfinity)) + fprintf(outputFile," " coef_fmt " disjoint splinters\n", disjointSplinters); + if (parallelSplinters != (posInfinity)) + fprintf(outputFile," " coef_fmt " parallel splinters\n", parallelSplinters); + fprintf(outputFile, "\n"); + fprintf(outputFile," %3d unit score \n", unit); + } +} + + +void Problem::partialElimination() { + if (DBUG) { + fprintf(outputFile, "Performing Partial elimination\n"); + printProblem(); + } + int fv; + if (0) + fv = 0; + else + fv = safeVars; + bool somethingHappened = false; + for (int i = nVars; i > fv; i--) { + bool isDead[maxmaxGEQs]; + int e; + for (e = nGEQs-1; e >= 0; e--) isDead[e] = false; + int deadEqns[maxDead]; + int numDead = 0; + for (int e1 = nGEQs-1; e1 >= 0; e1--) + if (abs(GEQs[e1].coef[i]) == 1) { + bool isGood = true; + for (int e2 = nGEQs-1; e2 >= 0; e2--) + if (check_mul(GEQs[e2].coef[i], GEQs[e1].coef[i]) < 0) + if (GEQs[e1].key != -GEQs[e2].key) { + coef_t Uc = abs(GEQs[e2].coef[i]); + for (int k = nVars; k > fv; k--) + if (GEQs[e2].coef[k] + check_mul(GEQs[e1].coef[k], Uc) != 0) + isGood = false; + } + if (isGood) { + somethingHappened = true; + for (int e2 = nGEQs-1; e2 >= 0; e2--) + if (check_mul(GEQs[e2].coef[i], GEQs[e1].coef[i]) < 0) { + if (GEQs[e1].key != -GEQs[e2].key) { + coef_t Uc = abs(GEQs[e2].coef[i]); + int new_eqn; + if (numDead == 0) { + new_eqn = newGEQ(); + } + else { + new_eqn = deadEqns[--numDead]; + } + isDead[new_eqn] = false; + if (DBUG) { + fprintf(outputFile,"Eliminating constraint on %s\n", variable(i)); + fprintf(outputFile, "e1 = %d, e2 = %d, gen = %d\n", e1, e2, new_eqn); + printGEQ(&(GEQs[e1])); + fprintf(outputFile, "\n"); + printGEQ(&(GEQs[e2])); + fprintf(outputFile, "\n"); + } + + for (int k = nVars; k >= 0; k--) + GEQs[new_eqn].coef[k] = GEQs[e2].coef[k] + check_mul(GEQs[e1].coef[k], Uc); + GEQs[new_eqn].touched = true; + GEQs[new_eqn].color = GEQs[e2].color | GEQs[e1].color; + if (DBUG) { + fprintf(outputFile, "give "); + printGEQ(&(GEQs[new_eqn])); + fprintf(outputFile, "\n"); + } + assert(GEQs[new_eqn].coef[i] == 0); + } + } + deadEqns[numDead++] = e1; + isDead[e1] = true; + if (DEBUG) + fprintf(outputFile, "Killed %d\n", e1); + } + } + for (e = nGEQs - 1; e >= 0; e--) + if (isDead[e]) { + deleteGEQ(e); + } + } + if (somethingHappened && DBUG) { + fprintf(outputFile, "Result of Partial elimination\n"); + printProblem(); + } +} + + +int Problem:: solveGEQ(int desiredResult) { + int i, j, k, e; + int fv; + int result; + int coupledSubscripts; + int eliminateAgain; + int smoothed = 0; + int triedEliminatingRedundant = 0; + j = 0; + + if (desiredResult != OC_SOLVE_SIMPLIFY) { + nSUBs = 0; + nMemories = 0; + safeVars = 0; + varsOfInterest = 0; + } + +solveGEQstart: + while (1) { + assert(desiredResult == OC_SOLVE_SIMPLIFY || nSUBs == 0); + check_number_GEQs(nGEQs); + + if (DEBUG) { + fprintf(outputFile, "\nSolveGEQ(%d,%d):\n", desiredResult, pleaseNoEqualitiesInSimplifiedProblems); + printProblem(); + fprintf(outputFile, "\n"); + } + +#ifndef NDEBUG + for(e=0;e= 0; e--) { + coef_t a = GEQs[e].coef[1]; + coef_t c = GEQs[e].coef[0]; + /* our equation is ax + c >= 0, or ax >= -c, or c >= -ax */ + if (a == 0) { + if (c < 0) { + if (TRACE) + fprintf(outputFile, "equations have no solution (G)\n"); + return (false); + } + } + else if (a > 0) { + if (a != 1) + c = int_div(c, a); + if (lowerBound < -c || (lowerBound == -c && !isRed(&GEQs[e]))) { + lowerBound = -c; + lColor = GEQs[e].color; + } + } + else { + if (a != -1) + c = int_div(c, -a); + if (upperBound > c || (upperBound == c && !isRed(&GEQs[e]))) { + upperBound = c; + uColor = GEQs[e].color; + } + } + } + if (DEBUG) + fprintf(outputFile, "upper bound = " coef_fmt "\n", upperBound); + if (DEBUG) + fprintf(outputFile, "lower bound = " coef_fmt "\n", lowerBound); + if (lowerBound > upperBound) { + if (TRACE) + fprintf(outputFile, "equations have no solution (H)\n"); + return (false); + } + if (desiredResult == OC_SOLVE_SIMPLIFY) { + nGEQs = 0; + if (safeVars == 1) { + if (lowerBound == upperBound && !uColor && !lColor) { + int e = newEQ(); + assert(e == 0); + EQs[e].coef[0] = -lowerBound; + EQs[e].coef[1] = 1; + EQs[e].color = lColor | uColor; + return (solve(desiredResult)); + } + else { + if (lowerBound > negInfinity) { + int e = newGEQ(); + assert(e == 0); + GEQs[e].coef[0] = -lowerBound; + GEQs[e].coef[1] = 1; + GEQs[e].key = 1; + GEQs[e].color = lColor; + GEQs[e].touched = 0; + } + if (upperBound < posInfinity) { + int e = newGEQ(); + GEQs[e].coef[0] = upperBound; + GEQs[e].coef[1] = -1; + GEQs[e].key = -1; + GEQs[e].color = uColor; + GEQs[e].touched = 0; + } + } + } + else + nVars = 0; + return (true); + } + if (originalProblem != noProblem && !lColor && !uColor && !conservative && lowerBound == upperBound) { + int e = newEQ(); + assert(e == 0); + EQs[e].coef[0] = -lowerBound; + EQs[e].coef[1] = 1; + EQs[e].color = EQ_BLACK; + addingEqualityConstraint(0); + } + return (true); + } + + if (!variablesFreed) { + variablesFreed = 1; + if (desiredResult != OC_SOLVE_SIMPLIFY) + freeEliminations(0); + else + freeEliminations(safeVars); + if (nVars == 1) + continue; + } + + + switch (normalize()) { + case normalize_false: + return (false); + break; + case normalize_coupled: + coupledSubscripts = true; + break; + case normalize_uncoupled: + coupledSubscripts = false; + break; + default: + coupledSubscripts = false; + assert(0 && "impossible case in SolveGEQ"); + } + + + if ((doTrace && desiredResult == OC_SOLVE_SIMPLIFY) || DBUG) { + fprintf(outputFile, "\nafter normalization:\n"); + printProblem(); + fprintf(outputFile, "\n"); + for(e=0;e 0) + return (solve(desiredResult)); + + if (!coupledSubscripts) { + if (safeVars == 0) + nGEQs = 0; + else + for (e = nGEQs - 1; e >= 0; e--) + if (GEQs[e].key > safeVars || -safeVars > GEQs[e].key) + deleteGEQ(e); + nVars = safeVars; + return (true); + } + + if (desiredResult != OC_SOLVE_SIMPLIFY) + fv = 0; + else + fv = safeVars; + + if (nVars == 0 || nGEQs == 0) { + nGEQs = 0; + if (desiredResult == OC_SOLVE_SIMPLIFY) + nVars = safeVars; + return (true); + } + if (desiredResult == OC_SOLVE_SIMPLIFY && nVars == safeVars) { + return (true); + } + + + if (nGEQs+6 > maxGEQs || nGEQs > 2 * nVars * nVars + 4 * nVars + 10) { + if (TRACE) + fprintf(outputFile, "TOO MANY EQUATIONS; %d equations, %d variables, ELIMINATING REDUNDANT ONES\n", nGEQs, nVars); + if (!quickKill(0,true)) + return 0; + if (nEQs > 0) + return (solve(desiredResult)); + if (TRACE) + fprintf(outputFile, "END ELIMINATION OF REDUNDANT EQUATIONS\n"); + if (DBUG) printProblem(); + } + + + { + int darkConstraints, darkShadowFeasible, unit, parallelLB; + coef_t parallelSplinters, disjointSplinters, lbSplinters, ubSplinters, splinters; + coef_t bestScore, score; + int bestVar; + int exact; + int Ue,Le; + + if (desiredResult != OC_SOLVE_SIMPLIFY) fv = 0; + else fv = safeVars; + + if (DEBUG) { + fprintf(outputFile,"Considering elimination possibilities[ \n"); + printProblem(); + } + + analyzeGEQstart: + try { + bestScore = posInfinity; + bestVar = -1; + for (i = nVars; i != fv; i--) { + analyzeElimination(i, darkConstraints, darkShadowFeasible, unit, parallelSplinters, disjointSplinters, lbSplinters, ubSplinters, parallelLB); + + score = min(min(parallelSplinters,disjointSplinters), + min(lbSplinters,ubSplinters)); + exact = score == 1; + score = 10000*(score-1) + darkConstraints; + if (score >= posInfinity) // too big the score + score = posInfinity - 1; + score -= 3*unit; + + if (score < bestScore) { + bestScore = score; + bestVar = i; + if (i > 4 && score < nGEQs) break; + } + } + assert(bestVar>=0); + exact = bestScore < 10000; + i = bestVar; + assert(i<=nVars); + analyzeElimination(i, darkConstraints, darkShadowFeasible, unit, parallelSplinters, disjointSplinters, lbSplinters, ubSplinters, parallelLB); + if (DEBUG) { + fprintf(outputFile,"] Choose to eliminate %s \n",variable(i)); + } + splinters = lbSplinters; + if (splinters <= parallelSplinters) + parallelSplinters = posInfinity; + else splinters = parallelSplinters; + if (disjointSplinters == 1) splinters = 1; + exact = splinters == 1; + if (inApproximateMode) exact = 1; + } + catch (std::overflow_error) { + int result = quickKill(0, true); + if (result == 0) + return 0; + else if (result == 1) + return true; + else { + if (nEQs > 0) + return (solve(desiredResult)); + triedEliminatingRedundant = 1; + goto analyzeGEQstart; + } + } + + if (!triedEliminatingRedundant && darkConstraints > maxGEQs) { + if (TRACE) + fprintf(outputFile, "Elimination will create TOO MANY EQUATIONS; %d equations, %d variables, %d new constraints, ELIMINATING REDUNDANT ONES\n", nGEQs, nVars,darkConstraints); + if (!quickKill(0)) + return 0; + if (nEQs > 0) + return (solve(desiredResult)); + if (TRACE) + fprintf(outputFile, "END ELIMINATION OF REDUNDANT EQUATIONS\n"); + if (DBUG) printProblem(); + + triedEliminatingRedundant = 1; + eliminateAgain = 1; + continue; + } + + if (!exact && !triedEliminatingRedundant && + safeVars > 0 && desiredResult == OC_SOLVE_SIMPLIFY) { + if (TRACE) + fprintf(outputFile, "Trying to produce exact elimination by finding redundant constraints [\n"); + if (!quickKill(1)) return 0; + if (TRACE) + fprintf(outputFile, "]\n"); + triedEliminatingRedundant = 1; + eliminateAgain = 1; + continue; + } + triedEliminatingRedundant = 0; + + if (desiredResult == OC_SOLVE_SIMPLIFY && !exact) { + partialElimination(); + switch (normalize()) { + case normalize_false: + return (false); + break; + case normalize_coupled: + case normalize_uncoupled: + break; + } + if (nEQs) return solveEQ(); + if (DBUG) fprintf(outputFile,"Stopping short due to non-exact elimination\n"); + return (true); + } + + if ( desiredResult == OC_SOLVE_SIMPLIFY && darkConstraints > maxGEQs) { + if (DBUG) fprintf(outputFile,"Stopping short due to overflow of GEQs: %d\n", darkConstraints); + return (true); + } + + if ((doTrace && desiredResult == OC_SOLVE_SIMPLIFY) || DBUG) { + fprintf(outputFile, "going to eliminate %s, (%d)\n", variable(i), i); + if (DEBUG) + printProblem(); + fprintf(outputFile, "score = " coef_fmt "/" coef_fmt "\n", bestScore,splinters); + } + + if (!exact && desiredResult == OC_SOLVE_SIMPLIFY && parallelSplinters == splinters) { + return parallelSplinter(parallelLB, parallelSplinters, desiredResult); + } + + // smoothed = 0; // what a bug!!! -- by chun 6/10/2008 + + if (i != nVars) { + j = nVars; + swapVars(i,j); + + i = j; + } + else if (DEBUG) { + printVars(); + fprintf(outputFile, "No swap needed before eliminating %s(%d/%d)\n",variable(i),i,nVars); + for(j=1;j<=i;j++) fprintf(outputFile,"var #%d = %s(%x)\n",j,variable(j),var[j]); + printProblem(); + } + nVars--; + + if (exact) { + if (nVars == 1) { + coef_t upperBound = posInfinity; + coef_t lowerBound = negInfinity; + int ub_color = 0; + int lb_color = 0; + coef_t constantTerm, coefficient; + int topEqn = nGEQs - 1; + coef_t Lc; + for (Le = topEqn; Le >= 0; Le--) + if ((Lc = GEQs[Le].coef[i]) == 0) { + if (GEQs[Le].coef[1] == 1) { + constantTerm = -GEQs[Le].coef[0]; + if (constantTerm > lowerBound || (constantTerm == lowerBound && !isRed(&GEQs[Le]))) { + lowerBound = constantTerm; + lb_color = GEQs[Le].color; + } + if (DEBUG) { + if (GEQs[Le].color == EQ_BLACK) + fprintf(outputFile, " :::=> %s >= " coef_fmt "\n", variable(1), constantTerm); + else + fprintf(outputFile, " :::=> [%s >= " coef_fmt "]\n", variable(1), constantTerm); + } + } + else { + constantTerm = GEQs[Le].coef[0]; + if (constantTerm < upperBound || (constantTerm == upperBound && !isRed(&GEQs[Le]))) { + upperBound = constantTerm; + ub_color = GEQs[Le].color; + } + if (DEBUG) { + if (GEQs[Le].color == EQ_BLACK) + fprintf(outputFile, " :::=> %s <= " coef_fmt "\n", variable(1), constantTerm); + else + fprintf(outputFile, " :::=> [%s <= " coef_fmt "]\n", variable(1), constantTerm); + } + } + } + else if (Lc > 0) { + for (Ue = topEqn; Ue >= 0; Ue--) + if (GEQs[Ue].coef[i] < 0) { + if (GEQs[Le].key != -GEQs[Ue].key) { + coef_t Uc = -GEQs[Ue].coef[i]; + coefficient = check_mul(GEQs[Ue].coef[1], Lc) + check_mul(GEQs[Le].coef[1], Uc); + constantTerm = check_mul(GEQs[Ue].coef[0], Lc) + check_mul(GEQs[Le].coef[0], Uc); + if (DEBUG) { + printGEQextra(&(GEQs[Ue])); + fprintf(outputFile, "\n"); + printGEQextra(&(GEQs[Le])); + fprintf(outputFile, "\n"); + } + if (coefficient > 0) { + constantTerm = -(int_div(constantTerm, coefficient)); + /* assert(black == 0) */ + if (constantTerm > lowerBound || + (constantTerm == lowerBound && + (desiredResult != OC_SOLVE_SIMPLIFY || (GEQs[Ue].color == EQ_BLACK && GEQs[Le].color == EQ_BLACK)))) { + lowerBound = constantTerm; + lb_color = GEQs[Ue].color || GEQs[Le].color; + } + if (DEBUG) { + if (GEQs[Ue].color || GEQs[Le].color) + fprintf(outputFile, " ::=> [%s >= " coef_fmt "]\n", variable(1), constantTerm); + else + fprintf(outputFile, " ::=> %s >= " coef_fmt "\n", variable(1), constantTerm); + } + } + else if (coefficient < 0) { + constantTerm = (int_div(constantTerm, -coefficient)); + if (constantTerm < upperBound || + (constantTerm == upperBound && GEQs[Ue].color == EQ_BLACK && GEQs[Le].color == EQ_BLACK)) { + upperBound = constantTerm; + ub_color = GEQs[Ue].color || GEQs[Le].color; + } + if (DEBUG) { + if (GEQs[Ue].color || GEQs[Le].color) + fprintf(outputFile, " ::=> [%s <= " coef_fmt "]\n", variable(1), constantTerm); + else + fprintf(outputFile, " ::=> %s <= " coef_fmt "\n", variable(1), constantTerm); + } + } + } + } + } + nGEQs = 0; + if (DEBUG) + fprintf(outputFile, " therefore, %c" coef_fmt " <= %c%s%c <= " coef_fmt "%c\n", lb_color ? '[' : ' ', lowerBound, (lb_color && !ub_color) ? ']' : ' ', variable(1), (!lb_color && ub_color) ? '[' : ' ', upperBound, ub_color ? ']' : ' '); + if (lowerBound > upperBound) + return (false); + + if (upperBound == lowerBound) { + int e = newEQ(); + assert(e == 0); + EQs[e].coef[1] = -1; + EQs[e].coef[0] = upperBound; + EQs[e].color = ub_color | lb_color; + addingEqualityConstraint(0); + } + else if (safeVars == 1) { + if (upperBound != posInfinity) { + int e = newGEQ(); + assert(e == 0); + GEQs[e].coef[1] = -1; + GEQs[e].coef[0] = upperBound; + GEQs[e].color = ub_color; + GEQs[e].key = -1; + GEQs[e].touched = 0; + } + if (lowerBound != negInfinity) { + int e = newGEQ(); + GEQs[e].coef[1] = 1; + GEQs[e].coef[0] = -lowerBound; + GEQs[e].color = lb_color; + GEQs[e].key = 1; + GEQs[e].touched = 0; + } + } + if (safeVars == 0) + nVars = 0; + return (true); + } + eliminateAgain = 1; + + { + int deadEqns[maxDead]; + int numDead = 0; + int topEqn = nGEQs - 1; + int lowerBoundCount = 0; + for (Le = topEqn; Le >= 0; Le--) + if (GEQs[Le].coef[i] > 0) + lowerBoundCount++; + if (DEBUG) + fprintf(outputFile, "lower bound count = %d\n", lowerBoundCount); + if (lowerBoundCount == 0) { + if (desiredResult != OC_SOLVE_SIMPLIFY) fv = 0; + else fv = safeVars; + nVars++; + freeEliminations(fv); + continue; + } + for (Le = topEqn; Le >= 0; Le--) + if (GEQs[Le].coef[i] > 0) { + coef_t Lc = GEQs[Le].coef[i]; + for (Ue = topEqn; Ue >= 0; Ue--) + if (GEQs[Ue].coef[i] < 0) { + if (GEQs[Le].key != -GEQs[Ue].key) { + coef_t Uc = -GEQs[Ue].coef[i]; + int e2; + if (numDead == 0) { + /*( Big kludge warning ) */ + /* this code is still using location nVars+1 */ + /* but newGEQ, if it reallocates, only copies*/ + /* locations up to nVars. This fixes that. */ + nVars++; + e2 = newGEQ(); + nVars--; + } + else { + e2 = deadEqns[--numDead]; + } + if (DEBUG) + fprintf(outputFile, "Le = %d, Ue = %d, gen = %d\n", Le, Ue, e2); + if (DEBUG) { + printGEQextra(&(GEQs[Le])); + fprintf(outputFile, "\n"); + printGEQextra(&(GEQs[Ue])); + fprintf(outputFile, "\n"); + } + eliminateAgain = 0; + coef_t g = gcd(Lc,Uc); + coef_t Lc_over_g = Lc/g; + coef_t Uc_over_g = Uc/g; + + for (k = nVars; k >= 0; k--) + GEQs[e2].coef[k] = + check_mul(GEQs[Ue].coef[k], Lc_over_g) + check_mul(GEQs[Le].coef[k], Uc_over_g); + + GEQs[e2].coef[nVars + 1] = 0; + GEQs[e2].touched = true; + GEQs[e2].color = GEQs[Ue].color | GEQs[Le].color; + + if (DEBUG) { + printGEQ(&(GEQs[e2])); + fprintf(outputFile, "\n"); + } + } + if (lowerBoundCount == 1) { + deadEqns[numDead++] = Ue; + if (DEBUG) + fprintf(outputFile, "Killed %d\n", Ue); + } + } + lowerBoundCount--; + deadEqns[numDead++] = Le; + if (DEBUG) + fprintf(outputFile, "Killed %d\n", Le); + } + + { + int isDead[maxmaxGEQs]; + for (e = nGEQs - 1; e >= 0; e--) + isDead[e] = false; + while (numDead > 0) { + e = deadEqns[--numDead]; + isDead[e] = true; + } + for (e = nGEQs - 1; e >= 0; e--) + if (isDead[e]) { + nVars++; + deleteGEQ(e); + nVars--; + } + } + continue; + } + } + else { + Problem *rS, *iS; + + rS = new Problem; + iS = new Problem; + + iS->nVars = rS->nVars = nVars; // do this immed.; in case of reallocation, we + // need to know how much to copy + rS->get_var_name = get_var_name; + rS->getVarNameArgs = getVarNameArgs; + iS->get_var_name = get_var_name; + iS->getVarNameArgs = getVarNameArgs; + + for (e = 0; e < nGEQs; e++) + if (GEQs[e].coef[i] == 0) { + int re2 = rS->newGEQ(); + int ie2 = iS->newGEQ(); + eqnncpy(&(rS->GEQs[re2]), &GEQs[e], nVars); + eqnncpy(&(iS->GEQs[ie2]), &GEQs[e], nVars); + if (DEBUG) { + int t; + fprintf(outputFile, "Copying (%d, " coef_fmt "): ", i, GEQs[e].coef[i]); + printGEQextra(&GEQs[e]); + fprintf(outputFile, "\n"); + for (t = 0; t <= nVars + 1; t++) + fprintf(outputFile, coef_fmt " ", GEQs[e].coef[t]); + fprintf(outputFile, "\n"); + } + } + for (Le = nGEQs - 1; Le >= 0; Le--) + if (GEQs[Le].coef[i] > 0) { + coef_t Lc = GEQs[Le].coef[i]; + for (Ue = nGEQs - 1; Ue >= 0; Ue--) + if (GEQs[Ue].coef[i] < 0) + if (GEQs[Le].key != -GEQs[Ue].key) { + coef_t Uc = -GEQs[Ue].coef[i]; + coef_t g = gcd(Lc,Uc); + coef_t Lc_over_g = Lc/g; + coef_t Uc_over_g = Uc/g; + int re2 = rS->newGEQ(); + int ie2 = iS->newGEQ(); + rS->GEQs[re2].touched = iS->GEQs[ie2].touched = true; + if (DEBUG) { + fprintf(outputFile, "---\n"); + fprintf(outputFile, "Le(Lc) = %d(" coef_fmt "), Ue(Uc) = %d(" coef_fmt "), gen = %d\n", Le, Lc, Ue, Uc, ie2); + printGEQextra(&GEQs[Le]); + fprintf(outputFile, "\n"); + printGEQextra(&GEQs[Ue]); + fprintf(outputFile, "\n"); + } + + if (Uc == Lc) { + for (k = nVars; k >= 0; k--) + iS->GEQs[ie2].coef[k] = rS->GEQs[re2].coef[k] = + GEQs[Ue].coef[k] + GEQs[Le].coef[k]; + iS->GEQs[ie2].coef[0] -= (Uc - 1); + } + else { + for (k = nVars; k >= 0; k--) + iS->GEQs[ie2].coef[k] = rS->GEQs[re2].coef[k] = + check_mul(GEQs[Ue].coef[k], Lc_over_g) + check_mul(GEQs[Le].coef[k], Uc_over_g); + iS->GEQs[ie2].coef[0] -= check_mul(Uc_over_g-1, Lc_over_g-1); + } + + iS->GEQs[ie2].color = rS->GEQs[re2].color + = GEQs[Ue].color || GEQs[Le].color; + + if (DEBUG) { + printGEQ(&(rS->GEQs[re2])); + fprintf(outputFile, "\n"); + } + // ie2 = iS->newGEQ(); + // re2 = rS->newGEQ(); + } + + } + iS->variablesInitialized = rS->variablesInitialized = 1; + iS->nEQs = rS->nEQs = 0; + assert(desiredResult != OC_SOLVE_SIMPLIFY); + assert(nSUBs == 0); + iS->nSUBs = rS->nSUBs = nSUBs; + iS->safeVars = rS->safeVars = safeVars; + int t; + for (t = nVars; t >= 0; t--) + rS->var[t] = var[t]; + for (t = nVars; t >= 0; t--) + iS->var[t] = var[t]; + nVars++; + if (desiredResult != true) { + int t = trace; + if (TRACE) + fprintf(outputFile, "\nreal solution(%d):\n", depth); + depth++; + trace = 0; + if (originalProblem == noProblem) { + originalProblem = this; + result = rS->solveGEQ(false); + originalProblem = noProblem; + } + else + result = rS->solveGEQ(false); + trace = t; + depth--; + if (result == false) { + delete rS; + delete iS; + return (result); + } + + if (nEQs > 0) { + /* An equality constraint must have been found */ + delete rS; + delete iS; + return (solve(desiredResult)); + } + } + if (desiredResult != false) { + if (darkShadowFeasible) { + if (TRACE) + fprintf(outputFile, "\ninteger solution(%d):\n", depth); + depth++; + conservative++; + result = iS->solveGEQ(desiredResult); + conservative--; + depth--; + if (result != false) { + delete rS; + delete iS; + return (result); + } + } + if (TRACE) + fprintf(outputFile, "have to do exact analysis\n"); + + { + coef_t worstLowerBoundConstant=1; + int lowerBounds = 0; + int lowerBound[maxmaxGEQs]; + int smallest; + int t; + conservative++; + for (e = 0; e < nGEQs; e++) + if (GEQs[e].coef[i] < -1) { + set_max(worstLowerBoundConstant, + -GEQs[e].coef[i]); + } + else if (GEQs[e].coef[i] > 1) + lowerBound[lowerBounds++] = e; + /* sort array */ + for (j = 0; j < lowerBounds; j++) { + smallest = j; + for (k = j + 1; k < lowerBounds; k++) + if (GEQs[lowerBound[smallest]].coef[i] > GEQs[lowerBound[k]].coef[i]) + smallest = k; + t = lowerBound[smallest]; + lowerBound[smallest] = lowerBound[j]; + lowerBound[j] = t; + } + if (DEBUG) { + fprintf(outputFile, "lower bound coeeficients = "); + for (j = 0; j < lowerBounds; j++) + fprintf(outputFile, " " coef_fmt, GEQs[lowerBound[j]].coef[i]); + fprintf(outputFile, "\n"); + } + + + for (j = 0; j < lowerBounds; j++) { + coef_t maxIncr; + coef_t c; + e = lowerBound[j]; + maxIncr = (check_mul(GEQs[e].coef[i]-1, worstLowerBoundConstant-1) - 1) / worstLowerBoundConstant; + + /* maxIncr += 2; */ + if ((doTrace && desiredResult == OC_SOLVE_SIMPLIFY) || DBUG) { + fprintf(outputFile, "for equation "); + printGEQ(&GEQs[e]); + fprintf(outputFile, "\ntry decrements from 0 to " coef_fmt "\n", maxIncr); + printProblem(); + } + if (maxIncr > 50) { + if (!smoothed && smoothWeirdEquations()) { + conservative--; + delete rS; + delete iS; + smoothed = 1; + goto solveGEQstart; + } + } + int neweq = newEQ(); + assert(neweq == 0); + eqnncpy(&EQs[neweq], &GEQs[e], nVars); + /* + * if (GEQs[e].color) fprintf(outputFile,"warning: adding black equality constraint + * based on red inequality\n"); + */ + EQs[neweq].color = EQ_BLACK; + eqnnzero(&GEQs[e], nVars); + GEQs[e].touched = true; + for (c = maxIncr; c >= 0; c--) { + if (DBUG) + fprintf(outputFile, "trying next decrement of " coef_fmt "\n", maxIncr - c); + if (DBUG) + printProblem(); + *rS = *this; + if (DEBUG) + rS->printProblem(); + result = rS->solve(desiredResult); + if (result == true) { + delete rS; + delete iS; + conservative--; + return (true); + } + EQs[0].coef[0]--; + } + if (j + 1 < lowerBounds) { + nEQs = 0; + eqnncpy(&GEQs[e], &EQs[0], nVars); + GEQs[e].touched = 1; + GEQs[e].color = EQ_BLACK; + *rS = *this; + if (DEBUG) + fprintf(outputFile, "exhausted lower bound, checking if still feasible "); + result = rS->solve(false); + if (result == false) + break; + } + } + if ((doTrace && desiredResult == OC_SOLVE_SIMPLIFY) || DBUG) + fprintf(outputFile, "fall-off the end\n"); + delete rS; + delete iS; + + conservative--; + return (false); + } + } + delete rS; + delete iS; + } + return (OC_SOLVE_UNKNOWN); + } + } + while (eliminateAgain); + } +} + + +int Problem::parallelSplinter(int e, int diff, int desiredResult) { + Problem *tmpProblem; + int i; + if (DBUG) { + fprintf(outputFile, "Using parallel splintering\n"); + printProblem(); + } + tmpProblem = new Problem; + int neweq = newEQ(); + assert(neweq == 0); + eqnncpy(&EQs[0], &GEQs[e], nVars); + for (i = 0; i <= diff; i++) { + *tmpProblem = * this; + tmpProblem->isTemporary = true; + if (DBUG) { + fprintf(outputFile, "Splinter # %i\n", i); + printProblem(); + } + if (tmpProblem->solve(desiredResult)) { + delete tmpProblem; + return true; + } + EQs[0].coef[0]--; + } + delete tmpProblem; + return false; +} + + +int Problem::verifyProblem() { + int result; + int e; + int areRed; + check(); + Problem tmpProblem(*this); + tmpProblem.varsOfInterest = 0; + tmpProblem.safeVars = 0; + tmpProblem.nSUBs = 0; + tmpProblem.nMemories = 0; + tmpProblem.isTemporary = true; + areRed = 0; + if (mayBeRed) { + for(e=0; e fv; i--) { + for (e = nGEQs - 1; e >= 0; e--) + if (GEQs[e].coef[i]) + break; + if (e < 0) + e2 = e; + else if (GEQs[e].coef[i] > 0) { + for (e2 = e - 1; e2 >= 0; e2--) + if (GEQs[e2].coef[i] < 0) + break; + } + else { + for (e2 = e - 1; e2 >= 0; e2--) + if (GEQs[e2].coef[i] > 0) + break; + } + if (e2 < 0) { + int e3; + for (e3 = nSUBs - 1; e3 >= 0; e3--) + if (SUBs[e3].coef[i]) + break; + if (e3 >= 0) + continue; + for (e3 = nEQs - 1; e3 >= 0; e3--) + if (EQs[e3].coef[i]) + break; + if (e3 >= 0) + continue; + if (DBUG) + fprintf(outputFile, "a free elimination of %s (%d)\n", variable(i),e); + if (e >= 0) { + deleteGEQ(e); + for (e--; e >= 0; e--) + if (GEQs[e].coef[i]) { + deleteGEQ(e); + } + tryAgain = (i < nVars); + } + deleteVariable(i); + } + } + } + + if (DEBUG) { + fprintf(outputFile, "\nafter free eliminations:\n"); + printProblem(); + fprintf(outputFile, "\n"); + } +} + + +void Problem::freeRedEliminations() { + int tryAgain = 1; + int i, e, e2; + int isRedVar[maxVars]; + int isDeadVar[maxVars]; + int isDeadGEQ[maxmaxGEQs]; + for (i = nVars; i > 0; i--) { + isRedVar[i] = 0; + isDeadVar[i] = 0; + } + for (e = nGEQs - 1; e >= 0; e--) { + isDeadGEQ[e] = 0; + if (GEQs[e].color) + for (i = nVars; i > 0; i--) + if (GEQs[e].coef[i] != 0) + isRedVar[i] = 1; + } + + while (tryAgain) { + tryAgain = 0; + for (i = nVars; i > 0; i--) + if (!isRedVar[i] && !isDeadVar[i]) { + for (e = nGEQs - 1; e >= 0; e--) + if (!isDeadGEQ[e] && GEQs[e].coef[i]) + break; + if (e < 0) + e2 = e; + else if (GEQs[e].coef[i] > 0) { + for (e2 = e - 1; e2 >= 0; e2--) + if (!isDeadGEQ[e2] && GEQs[e2].coef[i] < 0) + break; + } + else { + for (e2 = e - 1; e2 >= 0; e2--) + if (!isDeadGEQ[e2] && GEQs[e2].coef[i] > 0) + break; + } + if (e2 < 0) { + int e3; + for (e3 = nSUBs - 1; e3 >= 0; e3--) + if (SUBs[e3].coef[i]) + break; + if (e3 >= 0) + continue; + for (e3 = nEQs - 1; e3 >= 0; e3--) + if (EQs[e3].coef[i]) + break; + if (e3 >= 0) + continue; + if (DBUG) + fprintf(outputFile, "a free red elimination of %s\n", variable(i)); + for (; e >= 0; e--) + if (GEQs[e].coef[i]) + isDeadGEQ[e] = 1; + tryAgain = 1; + isDeadVar[i] = 1; + } + } + } + + for (e = nGEQs - 1; e >= 0; e--) + if (isDeadGEQ[e]) + deleteGEQ(e); + + for (i = nVars; i > safeVars; i--) + if (isDeadVar[i]) + deleteVariable(i); + + + if (DEBUG) { + fprintf(outputFile, "\nafter free red eliminations:\n"); + printProblem(); + fprintf(outputFile, "\n"); + } +} + +} // namespace diff --git a/omegalib/omega_lib/src/omega_core/oc_util.cc b/omegalib/omega_lib/src/omega_core/oc_util.cc new file mode 100644 index 0000000..a7d21be --- /dev/null +++ b/omegalib/omega_lib/src/omega_core/oc_util.cc @@ -0,0 +1,327 @@ +/***************************************************************************** + Copyright (C) 1994-2000 the Omega Project Team + Copyright (C) 2005-2011 Chun Chen + All Rights Reserved. + + Purpose: + + Notes: + + History: +*****************************************************************************/ + +#include +#include + +namespace omega { + +void Problem:: problem_merge(Problem &p2) { + int newLocation[maxVars]; + int i,e2; + + resurrectSubs(); + p2.resurrectSubs(); + setExternals(); + p2.setExternals(); + + assert(safeVars == p2.safeVars); + if(DBUG) { + fprintf(outputFile,"Merging:\n"); + printProblem(); + fprintf(outputFile,"and\n"); + p2.printProblem(); + } + for(i=1; i<= p2.safeVars; i++) { + assert(p2.var[i] > 0) ; + newLocation[i] = forwardingAddress[p2.var[i]]; + } + for(; i<= p2.nVars; i++) { + int j = ++(nVars); + newLocation[i] = j; + zeroVariable(j); + var[j] = -1; + } + newLocation[0] = 0; + + for (e2 = p2.nEQs - 1; e2 >= 0; e2--) { + int e1 = newEQ(); + eqnnzero(&(EQs[e1]), nVars); + for(i=0;i<=p2.nVars;i++) + EQs[e1].coef[newLocation[i]] = p2.EQs[e2].coef[i]; + } + for (e2 = p2.nGEQs - 1; e2 >= 0; e2--) { + int e1 = newGEQ(); + eqnnzero(&(GEQs[e1]), nVars); + GEQs[e1].touched = 1; + for(i=0;i<=p2.nVars;i++) + GEQs[e1].coef[newLocation[i]] = p2.GEQs[e2].coef[i]; + } + int w = -1; + for (i = 1; i <= nVars; i++) + if (var[i] < 0) var[i] = w--; + if(DBUG) { + fprintf(outputFile,"to get:\n"); + printProblem(); + } +} + + + +void Problem::chainUnprotect() { + int i, e; + int unprotect[maxVars]; + int any = 0; + for (i = 1; i <= safeVars; i++) { + unprotect[i] = (var[i] < 0); + for (e = nSUBs - 1; e >= 0; e--) + if (SUBs[e].coef[i]) + unprotect[i] = 0; + } + for (i = 1; i <= safeVars; i++) if (unprotect[i]) any=1; + if (!any) return; + + if (DBUG) { + fprintf(outputFile, "Doing chain reaction unprotection\n"); + printProblem(); + for (i = 1; i <= safeVars; i++) + if (unprotect[i]) + fprintf(outputFile, "unprotecting %s\n", variable(i)); + } + for (i = 1; i <= safeVars; i++) + if (unprotect[i]) { + /* wild card */ + if (i < safeVars) { + int j = safeVars; + std::swap(var[i], var[j]); + for (e = nGEQs - 1; e >= 0; e--) { + GEQs[e].touched = 1; + std::swap(GEQs[e].coef[i], GEQs[e].coef[j]); + } + for (e = nEQs - 1; e >= 0; e--) + std::swap(EQs[e].coef[i], EQs[e].coef[j]); + for (e = nSUBs - 1; e >= 0; e--) + std::swap(SUBs[e].coef[i], SUBs[e].coef[j]); + std::swap(unprotect[i], unprotect[j]); + i--; + } + safeVars--; + } + if (DBUG) { + fprintf(outputFile, "After chain reactions\n"); + printProblem(); + } +} + +void Problem::resurrectSubs() { + if (nSUBs > 0 && !pleaseNoEqualitiesInSimplifiedProblems) { + int i, e, n, m,mbr; + mbr = 0; + for (e = nGEQs - 1; e >= 0; e--) if (GEQs[e].color) mbr=1; + for (e = nEQs - 1; e >= 0; e--) if (EQs[e].color) mbr=1; + if (nMemories) mbr = 1; + + assert(!mbr || mayBeRed); + + if (DBUG) { + fprintf(outputFile, "problem reduced, bringing variables back to life\n"); + if(mbr && !mayBeRed) fprintf(outputFile, "Red equations we don't expect\n"); + printProblem(); + } + if (DBUG && nEQs > 0) + fprintf(outputFile,"This is wierd: problem has equalities\n"); + + for (i = 1; i <= safeVars; i++) + if (var[i] < 0) { + /* wild card */ + if (i < safeVars) { + int j = safeVars; + std::swap(var[i], var[j]); + for (e = nGEQs - 1; e >= 0; e--) { + GEQs[e].touched = 1; + std::swap(GEQs[e].coef[i], GEQs[e].coef[j]); + } + for (e = nEQs - 1; e >= 0; e--) + std::swap(EQs[e].coef[i], EQs[e].coef[j]); + for (e = nSUBs - 1; e >= 0; e--) + std::swap(SUBs[e].coef[i], SUBs[e].coef[j]); + i--; + } + safeVars--; + } + + m = nSUBs; + n = nVars; + if (n < safeVars + m) + n = safeVars + m; + for (e = nGEQs - 1; e >= 0; e--) { + if (singleVarGEQ(&GEQs[e])) { + i = abs(GEQs[e].key); + if (i >= safeVars + 1) + GEQs[e].key += (GEQs[e].key > 0 ? m : -m); + } + else { + GEQs[e].touched = true; + GEQs[e].key = 0; + } + } + for (i = nVars; i >= safeVars + 1; i--) { + var[i + m] = var[i]; + for (e = nGEQs - 1; e >= 0; e--) + GEQs[e].coef[i + m] = GEQs[e].coef[i]; + for (e = nEQs - 1; e >= 0; e--) + EQs[e].coef[i + m] = EQs[e].coef[i]; + for (e = nSUBs - 1; e >= 0; e--) + SUBs[e].coef[i + m] = SUBs[e].coef[i]; + } + for (i = safeVars + m; i >= safeVars + 1; i--) { + for (e = nGEQs - 1; e >= 0; e--) GEQs[e].coef[i] = 0; + for (e = nEQs - 1; e >= 0; e--) EQs[e].coef[i] = 0; + for (e = nSUBs - 1; e >= 0; e--) SUBs[e].coef[i] = 0; + } + nVars += m; + safeVars += m; + for (e = nSUBs - 1; e >= 0; e--) + var[safeVars -m + 1 + e] = SUBs[e].key; + for (i = 1; i <= safeVars; i++) + forwardingAddress[var[i]] = i; + if (DBUG) { + fprintf(outputFile,"Ready to wake substitutions\n"); + printProblem(); + } + for (e = nSUBs - 1; e >= 0; e--) { + int neweq = newEQ(); + eqnncpy(&(EQs[neweq]), &(SUBs[e]), nVars); + EQs[neweq].coef[safeVars -m + 1 + e] = -1; + EQs[neweq].color = EQ_BLACK; + if (DBUG) { + fprintf(outputFile, "brought back: "); + printEQ(&EQs[neweq]); + fprintf(outputFile, "\n"); + } + } + nSUBs = 0; + + if (DBUG) { + fprintf(outputFile, "variables brought back to life\n"); + printProblem(); + } + } + + coalesce(); + recallRedMemories(); + cleanoutWildcards(); +} + + +void Problem::reverseProtectedVariables() { + int v1,v2,e,i; + coef_t t; + for (v1 = 1; v1 <= safeVars; v1++) { + v2 = safeVars+1-v1; + if (v2>=v1) break; + for(e=0;esymbolic;i--) + for(e=0;ei;j--) if (EQs[e].coef[j]) break; + if (i==j) { + doElimination(e, i); + isDead[e] = 1; + break; + } + } + + for(e=nEQs-1;e>=0;e--) + if (isDead[e]) { + nEQs--; + if (e < nEQs) eqnncpy(&EQs[e], &EQs[nEQs], nVars); + } + + for (i = 1; i <= safeVars; i++) + forwardingAddress[var[i]] = i; + for (i = 0; i < nSUBs; i++) + forwardingAddress[SUBs[i].key] = -i - 1; +} + + +coef_t Problem::checkSum() const { + coef_t cs; + int e; + cs = 0; + for(e=0;e= 0; e--) + if (isDead[e]) { + deleteGEQ(e); + } + if (DEBUG && foundSomething) { + fprintf(outputFile, "Coalesced GEQs into %d EQ's:\n", foundSomething); + printProblem(); + } +} + +} // namespace diff --git a/omegalib/omega_lib/src/pres_beaut.cc b/omegalib/omega_lib/src/pres_beaut.cc new file mode 100644 index 0000000..c23962a --- /dev/null +++ b/omegalib/omega_lib/src/pres_beaut.cc @@ -0,0 +1,235 @@ +#include +#include +#include +#include + +///////////////////////// +// // +// Beautify functions // +// // +///////////////////////// + + +namespace omega { + +// +// f & true = f +// f | false = f +// f1 & f2 & ... & fn = Conjunct(f1,f2,...,fn) +// + +void Rel_Body::beautify() { + assert(children().length()==1); + set_parent(NULL,this); + + skip_finalization_check++; + formula()->beautify(); + Formula *child = formula(); + if(child->node_type()==Op_And && child->children().empty()) { + remove_child(child); + delete child; + add_conjunct(); + } + skip_finalization_check--; + + if(pres_debug) { + fprintf(DebugFile, "\n=== Beautified TREE ===\n"); + prefix_print(DebugFile); + } + assert(children().length()==1); +} + +void Formula::beautify() { + // copy list of children, as they may be removed as we work + List kiddies = myChildren; + + for(List_Iterator c(kiddies); c; c++) + (*c)->beautify(); +} + +void F_Exists::beautify() { + Formula::beautify(); + assert(children().length()==1); + + if(myLocals.empty()) { + // exists( : ***) + parent().remove_child(this); + parent().add_child(children().remove_front()); + delete this; + } + else if (children()[1]->node_type() == Op_And && children()[1]->children().empty()) { + // exists(*** : TRUE) --chun 6/4/2008 + parent().remove_child(this); + parent().add_child(children().remove_front()); + delete this; + } + else { + Formula *child = children().front(); + if(child->node_type() == Op_Conjunct || child->node_type() == Op_Exists) { + child->push_exists(myLocals); + parent().remove_child(this); + parent().add_child(child); + children().remove_front(); + delete this; + } + } +} + +void F_Forall::beautify() { + Formula::beautify(); + assert(children().length()==1); + + if(myLocals.empty()) { + parent().remove_child(this); + parent().add_child(children().remove_front()); + delete this; + } +} + + +// +// The Pix-free versions of beautify for And and Or are a bit +// less efficient than the previous code, as we keep moving +// things from one list to another, but they do not depend on +// knowing that a Pix is valid after the list is updated, and +// they can always be optimized later if necessary. +// + +void F_Or::beautify() { + Formula::beautify(); + + List uglies, beauties; + uglies.join(children()); assert(children().empty()); +#if ! defined NDEBUG + foreach(c,Formula*,uglies,c->set_parent(0)); +#endif + + while(!uglies.empty()) { + Formula *f = uglies.remove_front(); + if(f->node_type()==Op_And && f->children().empty() ) { + // smth | true = true + foreach(c,Formula*,uglies,delete c); + foreach(c,Formula*,beauties,delete c); + parent().remove_child(this); + parent().add_and(); + delete f; + delete this; + return; + } + else if(f->node_type()==Op_Or) { + // OR(f[1-m], OR(c[1-n])) = OR(f[1-m], c[1-n]) +#if ! defined NDEBUG + foreach(c,Formula*,f->children(),c->set_parent(0)); +#endif + uglies.join(f->children()); + delete f; + } + else + beauties.prepend(f); + } + + if(beauties.length()==1) { + beauties.front()->set_parent(&parent()); + parent().remove_child(this); + parent().add_child(beauties.remove_front()); + delete this; + } + else { + foreach(c,Formula*,beauties,(c->set_parent(this), + c->set_relation(relation()))); + assert(children().empty()); + children().join(beauties); + } +} + +void F_And::beautify() { + Formula::beautify(); + + Conjunct *conj = NULL; + + List uglies, beauties; + uglies.join(children()); assert(children().empty()); +#if ! defined NDEBUG + foreach(c,Formula*,uglies,c->set_parent(0)); +#endif + + while(!uglies.empty()) { + Formula *f = uglies.remove_front(); + if (f->node_type() == Op_Conjunct) { + if(conj==NULL) + conj = f->really_conjunct(); + else { + Conjunct *conj1 = merge_conjs(conj, f->really_conjunct(), MERGE_REGULAR); + delete f; + delete conj; + conj = conj1; + } + } + else if(f->node_type()==Op_Or && f->children().empty()) { + // smth & false = false + foreach(c,Formula*,uglies,delete c); + foreach(c,Formula*,beauties,delete c); + parent().remove_child(this); + parent().add_or(); + delete f; + delete conj; + delete this; + return; + } + else if(f->node_type()==Op_And) { + // AND(f[1-m], AND(c[1-n])) = AND(f[1-m], c[1-n]) +#if ! defined NDEBUG + foreach(c,Formula*,f->children(),c->set_parent(0)); +#endif + uglies.join(f->children()); + delete f; + } + else + beauties.prepend(f); + } + + if(conj!=NULL) + beauties.prepend(conj); + + if(beauties.length()==1) { + beauties.front()->set_parent(&parent()); + parent().remove_child(this); + parent().add_child(beauties.remove_front()); + delete this; + } + else { + foreach(c,Formula*,beauties,(c->set_parent(this), + c->set_relation(relation()))); + assert(children().empty()); + children().join(beauties); + } +} + +void F_Not::beautify() { + Formula::beautify(); + assert(children().length()==1); + Formula *child = children().front(); + + if(child->node_type()==Op_And && child->children().empty()) { + // Not TRUE = FALSE + parent().remove_child(this); + parent().add_or(); + delete this; + } + else if (child->node_type()==Op_Or && child->children().empty()) { + // Not FALSE = TRUE + parent().remove_child(this); + parent().add_and(); + delete this; + } +} + +void Conjunct::beautify() { + if(is_true()) { + parent().remove_child(this); + parent().add_and(); + delete this; + } +} + +} // namespace diff --git a/omegalib/omega_lib/src/pres_cnstr.cc b/omegalib/omega_lib/src/pres_cnstr.cc new file mode 100644 index 0000000..a8ebd15 --- /dev/null +++ b/omegalib/omega_lib/src/pres_cnstr.cc @@ -0,0 +1,450 @@ +#include +#include +#include +#include + +namespace omega { + +Constraint_Handle::Constraint_Handle(Conjunct *_c, eqn **_eqns, int _e): + c(_c), eqns(_eqns), e(_e) { +} + +GEQ_Handle::GEQ_Handle(Conjunct *_c, int _e): + Constraint_Handle(_c,&(_c->problem->GEQs),_e) { +} + +bool Constraint_Handle::is_const(Variable_ID v) { + bool is_const=true; + for(Constr_Vars_Iter cvi(*this, false); cvi && is_const; cvi++) + is_const = ((*cvi).coef == 0 || ((*cvi).var == v && (*cvi).coef !=0)); + return is_const; +} + +bool Constraint_Handle::is_const_except_for_global(Variable_ID v){ + bool is_const=true; + for(Constr_Vars_Iter cvi(*this, false); cvi && is_const; cvi++) + if((*cvi).var->kind() != Global_Var) + is_const = ((*cvi).coef == 0 || ((*cvi).var == v && (*cvi).coef !=0)); + return is_const; +} + +bool EQ_Handle::operator==(const Constraint_Handle &that) { + Constraint_Handle &e1=*this; + const Constraint_Handle &e2=that; + int sign = 0; + for(Constr_Vars_Iter cvi(e1, false); cvi; cvi++) { + coef_t c1 = (*cvi).coef; + coef_t c2 = e2.get_coef((*cvi).var); + if (sign == 0) sign = (c1*c2>=0?1:-1); + if (sign*c1 != c2) return false; + } + assert(sign != 0); + { + for(Constr_Vars_Iter cvi(e2, false); cvi; cvi++) { + coef_t c1 = e1.get_coef((*cvi).var); + coef_t c2 = (*cvi).coef; + if (sign*c1 != c2) return false; + } + } + return sign * e1.get_const() == e2.get_const(); +} + +bool GEQ_Handle::operator==(const Constraint_Handle &that) { + Constraint_Handle &e1=*this; + const Constraint_Handle &e2=that; + for(Constr_Vars_Iter cvi(e1, false); cvi; cvi++) { + coef_t c1 = (*cvi).coef; + coef_t c2 = e2.get_coef((*cvi).var); + if (c1 != c2) return false; + } + { + for(Constr_Vars_Iter cvi(e2, false); cvi; cvi++) { + coef_t c1 = e1.get_coef((*cvi).var); + coef_t c2 = (*cvi).coef; + if (c1 != c2) return false; + } + } + return e1.get_const() == e2.get_const(); +} + + + + +void GEQ_Handle::negate() { + assert(! this->relation()->is_simplified()); + int i; + for(i=1; i<=c->problem->nVars; i++) { + (*eqns)[e].coef[i] = -(*eqns)[e].coef[i]; + } + (*eqns)[e].coef[0] = -(*eqns)[e].coef[0]-1; +} + +bool Constraint_Handle::has_wildcards() const { + Constr_Vars_Iter C(*this, true); + if (C.live()) { + assert(C.curr_var()->kind() == Wildcard_Var); + assert(C.curr_coef() != 0); + return 1; + } + return 0; +} + +int Constraint_Handle::max_tuple_pos() const { + int m = 0; + for( Constr_Vars_Iter C(*this, false); C.live() ; C.next()) { + switch (C.curr_var()->kind()) { + case Input_Var: + case Output_Var: { + int pos = C.curr_var()->get_position(); + if (m < pos) m = pos; + break; + } + default: + ; + } + } + return m; +} + +int Constraint_Handle::min_tuple_pos() const { + int m = 0; + for( Constr_Vars_Iter C(*this, false); C.live() ; C.next()) { + switch (C.curr_var()->kind()) { + case Input_Var: + case Output_Var: { + int pos = C.curr_var()->get_position(); + if (m == 0 || m > pos) m = pos; + break; + } + default: + ; + } + } + return m; +} + + +EQ_Handle::EQ_Handle(Conjunct *_c, int _e): Constraint_Handle(_c,&(_c->problem->EQs),_e) { +} + +// +// Update functions. +// +void Constraint_Handle::update_coef(Variable_ID D, coef_t I) { + assert(! this->relation()->is_simplified()); + assert(D != 0); + // The next two assertions are somewhat high-cost. +#if !defined(NDEBUG) + // skip_set_checks++; + assert((D->kind() != Input_Var || D->get_position() <= this->relation()->n_inp())); + assert((D->kind() != Output_Var || D->get_position() <= this->relation()->n_out())); + // skip_set_checks--; +#endif + int col = c->get_column(D); + (*eqns)[e].coef[col] += I; +} + +void Constraint_Handle::update_const(coef_t I) { + assert(! this->relation()->is_simplified()); + (*eqns)[e].coef[0] += I; +} + + +// update a coefficient of a variable that already exists in mappedvars + +void Constraint_Handle::update_coef_during_simplify(Variable_ID D, coef_t I) { + assert(D != 0); + int col = c->get_column(D); + (*eqns)[e].coef[col] += I; +} + +void Constraint_Handle::update_const_during_simplify(coef_t I) { + (*eqns)[e].coef[0] += I; +} + +// +// Get functions. +// + +coef_t Constraint_Handle::get_coef(Variable_ID v) const { + assert(this->relation()->is_simplified()); + assert(v != 0); + int col = c->find_column(v); + if(col == 0) { + return 0; + } + else { + return (*eqns)[e].coef[col]; + } +} + +coef_t Constraint_Handle::get_coef_during_simplify(Variable_ID v) const { + assert(v != 0); + int col = c->find_column(v); + if(col == 0) { + return 0; + } + else { + return (*eqns)[e].coef[col]; + } +} + +coef_t Constraint_Handle::get_const() const { + assert(this->relation()->is_simplified()); + return((*eqns)[e].coef[0]); +} + +coef_t Constraint_Handle::get_const_during_simplify() const { + return((*eqns)[e].coef[0]); +} + +Variable_ID Constraint_Handle::get_local(const Global_Var_ID G) { + return relation()->get_local(G); +} + +Variable_ID Constraint_Handle::get_local(const Global_Var_ID G, Argument_Tuple of) { + return relation()->get_local(G, of); +} + +void Constraint_Handle::finalize() { + c->n_open_constraints--; +} + +void Constraint_Handle::multiply(int multiplier) { + int i; + assert(! this->relation()->is_simplified()); + for(i=1; i<=c->problem->nVars; i++) { + (*eqns)[e].coef[i] = (*eqns)[e].coef[i] * multiplier; + } + (*eqns)[e].coef[0] = (*eqns)[e].coef[0] * multiplier; +} + +Rel_Body *Constraint_Handle::relation() const { + return c->relation(); +} + + +// +// Variables of constraint iterator. +// +Constr_Vars_Iter::Constr_Vars_Iter(const Constraint_Handle &ch, bool _wild_only): eqns(ch.eqns), e(ch.e), prob(ch.c->problem), vars(ch.c->mappedVars), wild_only(_wild_only) { + assert(vars.size() == prob->nVars); + for(current=1; current<=prob->nVars; current++) { + if((*eqns)[e].coef[current]!=0 && + (!wild_only || vars[current]->kind()==Wildcard_Var)) + return; + } +} + +int Constr_Vars_Iter::live() const { + return (current<=prob->nVars); +} + + +void Constr_Vars_Iter::operator++() { this->operator++(0); } + +void Constr_Vars_Iter::operator++(int) { + for(current++ ; current <=prob->nVars; current++) + if((*eqns)[e].coef[current]!=0 && + (!wild_only || vars[current]->kind()==Wildcard_Var)) + return; +} + + +Variable_ID Constr_Vars_Iter::curr_var() const { + assert(current <= prob->nVars); + return vars[current]; +} + +coef_t Constr_Vars_Iter::curr_coef() const { + assert(current <= prob->nVars); + return (*eqns)[e].coef[current]; +} + +Variable_Info Constr_Vars_Iter::operator*() const { + assert(current <= prob->nVars); + return Variable_Info(vars[current],(*eqns)[e].coef[current]); +} + +// +// Constraint iterator. +// +Constraint_Iterator Conjunct::constraints() { + return Constraint_Iterator(this); +} + +Constraint_Iterator::Constraint_Iterator(Conjunct *_c): c(_c), current(0), + last(c->problem->nGEQs-1), eqns(&(c->problem->GEQs)) { + if(!this->live()) (*this)++; // switch to EQ's if no GEQs +} + +int Constraint_Iterator::live() const { + return current <=last; +} + +void Constraint_Iterator::operator++() { + this->operator++(0); +} + +void Constraint_Iterator::operator++(int) { + if(++current > last) + if(eqns == &(c->problem->GEQs)) { // Switch to EQs + eqns = &(c->problem->EQs); + current = 0; + last = c->problem->nEQs-1; + } +} + +Constraint_Handle Constraint_Iterator::operator*() { + assert((c && eqns && current <= last) && "Constraint_Iterator::operator*: bad call"); + return Constraint_Handle(c,eqns,current); +} + +Constraint_Handle Constraint_Iterator::operator*() const { + assert((c && eqns && current <= last) && "Constraint_Iterator::operator*: bad call"); + return Constraint_Handle(c,eqns,current); +} + + +// +// EQ iterator. +// +EQ_Iterator Conjunct::EQs() { + return EQ_Iterator(this); +} + +EQ_Iterator::EQ_Iterator(Conjunct *_c) : c(_c) { + last = c->problem->nEQs-1; + current = 0; +} + +int EQ_Iterator::live() const { + return current <= last; +} + +void EQ_Iterator::operator++() { + this->operator++(0); +} + +void EQ_Iterator::operator++(int) { + current++; +} + +EQ_Handle EQ_Iterator::operator*() { + assert((c && current <= last) && "EQ_Iterator::operator*: bad call"); + return EQ_Handle(c,current); +} + +EQ_Handle EQ_Iterator::operator*() const { + assert((c && current <= last) && "EQ_Iterator::operator*: bad call"); + return EQ_Handle(c,current); +} + + +// +// GEQ iterator. +// +GEQ_Iterator Conjunct::GEQs() { + return GEQ_Iterator(this); +} + +GEQ_Iterator::GEQ_Iterator(Conjunct *_c) : c(_c) { + last = c->problem->nGEQs-1; + current = 0; +} + +int GEQ_Iterator::live() const { + return current <= last; +} + +void GEQ_Iterator::operator++() { + this->operator++(0); +} + +void GEQ_Iterator::operator++(int) { + current++; +} + + +GEQ_Handle GEQ_Iterator::operator*() { + assert((c && current <= last) && "GEQ_Iterator::operator*: bad call"); + return GEQ_Handle(c,current); +} + +GEQ_Handle GEQ_Iterator::operator*() const { + assert((c && current <= last) && "GEQ_Iterator::operator*: bad call"); + return GEQ_Handle(c,current); +} + + +void copy_constraint(Constraint_Handle H, const Constraint_Handle initial) { + // skip_set_checks++; +// assert(H.relation()->n_inp() == initial.relation()->n_inp()); +// assert(H.relation()->n_out() == initial.relation()->n_out()); + + H.update_const_during_simplify(initial.get_const_during_simplify()); + if (H.relation() == initial.relation()) { + for( Constr_Vars_Iter C(initial, false); C.live() ; C.next()) { + assert(C.curr_var()->kind()!= Forall_Var && + C.curr_var()->kind()!= Exists_Var); + if (C.curr_var()->kind()!= Wildcard_Var) + H.update_coef_during_simplify(C.curr_var(), C.curr_coef()); + else + // Must add a new wildcard, + // since they can't be used outside local Conjunct + H.update_coef_during_simplify(H.c->declare(), C.curr_coef()); + } + } + else { + Rel_Body *this_rel = H.relation(); + for( Constr_Vars_Iter C(initial, false); C.live() ; C.next()) { + switch (C.curr_var()->kind()) { + case Forall_Var: + case Exists_Var: + assert(0 && "Can't copy quantified constraints across relations"); + break; + case Wildcard_Var: + // for each wildcard var we see, create a new wildcard + // will lead to lots of wildcards, but Wayne likes it + // that way + { + H.update_coef_during_simplify(H.c->declare(), C.curr_coef()); + break; + } + case Input_Var: //use variable_ID of corresponding position + { + int pos = C.curr_var()->get_position(); + assert(this_rel->n_inp() >= pos); + Variable_ID V = this_rel->input_var(pos); + H.update_coef_during_simplify(V, C.curr_coef()); + break; + } + case Output_Var: //use variable_ID of corresponding position + { + int pos = C.curr_var()->get_position(); + assert(this_rel->n_out() >= pos); + Variable_ID V = this_rel->output_var(pos); + H.update_coef_during_simplify(V, C.curr_coef()); + break; + } + + case Global_Var: // get this Global's Var_ID in this relation + { + Variable_ID V; + Global_Var_ID G = C.curr_var()->get_global_var(); + if (G->arity() == 0) + V = this_rel->get_local(G); + else + V = this_rel->get_local(G,C.curr_var()->function_of()); + H.update_coef_during_simplify(V, C.curr_coef()); + break; + } + default: + assert(0 && "copy_constraint: variable of impossible type"); + } + } + } + // skip_set_checks--; +} + +} // namespace diff --git a/omegalib/omega_lib/src/pres_col.cc b/omegalib/omega_lib/src/pres_col.cc new file mode 100644 index 0000000..1569116 --- /dev/null +++ b/omegalib/omega_lib/src/pres_col.cc @@ -0,0 +1,104 @@ +#include +#include +#include + +namespace omega { + +// +// Copy column fr_col of problem fp +// to column to_col of problem tp. +// Displacement for constraints in tp are start_EQ and start_GEQ. +// +void copy_column(Problem *tp, int to_col, + Problem *fp, int fr_col, + int start_EQ, int start_GEQ) { + checkVars(to_col); + assert(start_EQ + fp->nEQs <= tp->allocEQs); + assert(start_GEQ + fp->nGEQs <= tp->allocGEQs); + + int i; + for(i=0; inEQs; i++) { + tp->EQs[i+start_EQ].coef[to_col] = fp->EQs[i].coef[fr_col]; + } + for(i=0; inGEQs; i++) { + tp->GEQs[i+start_GEQ].coef[to_col] = fp->GEQs[i].coef[fr_col]; + } +} + +// +// Zero column to_col of problem tp. +// Displacement for constraints in to_conj are start_EQ and start_GEQ. +// Number of constraints to zero are no_EQ and no_GEQ. +// +void zero_column(Problem *tp, int to_col, + int start_EQ, int start_GEQ, + int no_EQs, int no_GEQs) { + assert(start_EQ + no_EQs <= tp->allocEQs); + assert(start_GEQ + no_GEQs <= tp->allocGEQs); + + int i; + for(i=0; iEQs[i+start_EQ].coef[to_col] = 0; + } + for(i=0; iGEQs[i+start_GEQ].coef[to_col] = 0; + } +} + +// +// return column for D in conjunct +// +int Conjunct::get_column(Variable_ID D) { + int col = find_column(D); + if (col == 0) // if it does not already have a column assigned + col = map_to_column(D); + assert(col > 0); // Not substituted + return col; +} + +// +// Find column in conjunct. +// +int Conjunct::find_column(Variable_ID D) { + assert(D != 0); + int column = mappedVars.index(D); + + // If it has been through the omega core (variablesInitialized), + // and it exists in the problem, check to see if it has been forwarded. + // This will likely only be the case if substitutions have been done; + // that won't arise in user code, only in print_with_subs and the + // Substitutions class. + if (problem->variablesInitialized && column > 0) { + assert(problem->forwardingAddress[column] != 0); + column = problem->forwardingAddress[column]; + } + assert (column <= problem->nVars); + return column; +} + +// +// Create new column in conjunct. +// +int Conjunct::map_to_column(Variable_ID D) { + assert(D != 0); + // This heavy-duty assertion says that if you are trying to use a global + // var's local representative in a relation, that you have first told the + // relation that you are using it here. PUFS requires that we know + // all the function symbols that might be used in a relation. + // If one wanted to be less strict, one could just tell the relation + // that the global variable was being used. + assert(D->kind() != Global_Var || + (relation()->has_local(D->get_global_var(), D->function_of()) + && "Attempt to update global var without a local variable ID")); + + cols_ordered = false; // extremely important + checkVars(problem->nVars+2); + int col = ++problem->nVars; + mappedVars.append(D); + problem->forwardingAddress[col] = col; + problem->var[col] = col; + zero_column(problem, col, 0, 0, problem->nEQs, problem->nGEQs); + return col; +} + +} // namespace diff --git a/omegalib/omega_lib/src/pres_conj.cc b/omegalib/omega_lib/src/pres_conj.cc new file mode 100644 index 0000000..f3f458d --- /dev/null +++ b/omegalib/omega_lib/src/pres_conj.cc @@ -0,0 +1,1460 @@ +/***************************************************************************** + Copyright (C) 1994-2000 the Omega Project Team + Copyright (C) 2005-2011 Chun Chen + All Rights Reserved. + + Purpose: + class Conjunct. + + Notes: + + History: +*****************************************************************************/ + +#include +#include +#include +#include +#include +#include + +namespace omega { + +int NR_CONJUNCTS, MAX_CONJUNCTS; + +/* + * Make a new wildcard variable, return WC number. + * Should be static to this file, but must be a friend of conjunct. + */ +int new_WC(Conjunct *nc, Problem *) { + Variable_ID wc = nc->declare(); + int wc_no = nc->map_to_column(wc); + return(wc_no); +} + + +const char* get_var_name(unsigned int col, void * void_conj) { +#if defined PRINT_COLUMN_NUMBERS + static char scum[512]; +#endif + Conjunct *c = (Conjunct *) void_conj; + if (col == 0) + return 0; + Variable_ID v = c->mappedVars[col]; + assert(v!=0); +#if defined PRINT_COLUMN_NUMBERS + strcpy(scum, v->char_name()); + sprintf(scum + strlen(scum), "(%d)", col); + return scum; +#endif + return v->char_name(); +} + +void Conjunct::promise_that_ub_solutions_exist(Relation &R) { +#ifndef NDEBUG + Relation verify=Relation(R, this); + assert(verify.is_upper_bound_satisfiable()); +#endif + verified = true; +} + + +int Conjunct::max_ufs_arity_of_set() { + int ma = 0, a; + for (Variable_ID_Iterator v(mappedVars); v; v++) + if ((*v)->kind() == Global_Var && (*v)->function_of() == Set_Tuple + && query_variable_used(*v)) { + a = (*v)->get_global_var()->arity(); + if (a > ma) + ma = a; + } + return ma; +} + + +int Conjunct::max_ufs_arity_of_in() { + int ma = 0, a; + for (Variable_ID_Iterator v(mappedVars); v; v++) + if ((*v)->kind() == Global_Var && (*v)->function_of() == Input_Tuple + && query_variable_used(*v)) { + a = (*v)->get_global_var()->arity(); + if (a > ma) + ma = a; + } + return ma; +} + + +int Conjunct::max_ufs_arity_of_out() { + int ma = 0, a; + for (Variable_ID_Iterator v(mappedVars); v; v++) + if ((*v)->kind() == Global_Var && (*v)->function_of() == Output_Tuple + && query_variable_used(*v)) { + a = (*v)->get_global_var()->arity(); + if (a > ma) + ma = a; + } + return ma; +} + + +bool Conjunct::is_unknown() const { + assert(problem || comp_problem); + return !exact && ((problem && problem->nEQs==0 && problem->nGEQs==0) || + (comp_problem && comp_problem->no_constraints())); +} + + +/* + * Remove black constraints from the problem. + * Make all the remaining red constraints black. + */ +void Conjunct::rm_color_constrs() { + int geqs = 0, eqs = 0; + + possible_leading_0s = -1; + guaranteed_leading_0s = -1; + leading_dir = 0; + + for(int i=0; inGEQs; i++) { + if(problem->GEQs[i].color) { + if(geqs!=i) + eqnncpy(&problem->GEQs[geqs], &problem->GEQs[i], problem->nVars); + problem->GEQs[geqs].color = EQ_BLACK; + geqs++; + } + } + problem->nGEQs = geqs; + + for(int i=0; inEQs; i++) { + if(problem->EQs[i].color) { + if(eqs!=i) + eqnncpy(&problem->EQs[eqs], &problem->EQs[i], problem->nVars); + problem->EQs[eqs].color = EQ_BLACK; + eqs++; + } + } + problem->nEQs = eqs; +} + + + +// +// Conjunct constructors. +// +Conjunct::Conjunct() : + F_Declaration(NULL, NULL), + mappedVars(0), + n_open_constraints(0), + cols_ordered(false), + simplified(false), + verified(false), + guaranteed_leading_0s(-1), + possible_leading_0s(-1), + leading_dir(0), + exact(true), + r_constrs(0) { + NR_CONJUNCTS++; + if (NR_CONJUNCTS>MAX_CONJUNCTS) MAX_CONJUNCTS = NR_CONJUNCTS; + problem = new Problem; + comp_problem = NULL; + problem->get_var_name = get_var_name; + problem->getVarNameArgs = (void *) this; +} + + +Conjunct::Conjunct(Formula *f, Rel_Body *r) : + F_Declaration(f,r), + mappedVars(0), + n_open_constraints(0), + cols_ordered(false), + simplified(false), + verified(false), + guaranteed_leading_0s(-1), + possible_leading_0s(-1), + leading_dir(0), + exact(true), + r_constrs(0) { + NR_CONJUNCTS++; + if (NR_CONJUNCTS>MAX_CONJUNCTS) MAX_CONJUNCTS = NR_CONJUNCTS; + problem = new Problem; + comp_problem = NULL; + problem->get_var_name = get_var_name; + problem->getVarNameArgs = (void *) this ; +} + +void internal_copy_conjunct(Conjunct* to, Conjunct* fr); + +// +// Copy Conjunct. +// +Conjunct* Conjunct::copy_conj_diff_relation(Formula *parent, Rel_Body *rel_body) { + Conjunct *new_conj; + if(problem && comp_problem==NULL) { + new_conj = new Conjunct(parent, rel_body); + internal_copy_conjunct(new_conj, this); + } + else if (problem==NULL && comp_problem) { + /* copy compressed conjunct */ + assert(0 && "copy compressed conjunct"); + new_conj = 0; + } + else { + assert(0 && "problem == NULL"); + new_conj = 0; + } + return new_conj; +} + + +void internal_copy_conjunct(Conjunct* to, Conjunct* fr) { + copy_conj_header(to, fr); + + // + // We repeat part of what is done by copy_conj_header(to, fr) by + // calling Problem::operator=(const Problem &). + // copy_conj_header should go away, but there is some code that still needs + // it in negate_conj. + // + to->r_constrs = fr->r_constrs; + to->simplified = fr->simplified; + to->verified = fr->verified; + to->guaranteed_leading_0s = fr->guaranteed_leading_0s; + to->possible_leading_0s = fr->possible_leading_0s; + to->leading_dir = fr->leading_dir; + // the following duplicates some work of the "copy_conj_header" brain damage + *to->problem = *fr->problem; + to->problem->getVarNameArgs = (void *)to; // important +} + + +// +// Copy Conjunct variable declarations +// and problem parameters but not problem itself. +// +void copy_conj_header(Conjunct* to, Conjunct* fr) { + free_var_decls(to->myLocals); to->myLocals.clear(); + + copy_var_decls(to->myLocals, fr->myLocals); + to->mappedVars = fr->mappedVars; + to->remap(); + reset_remap_field(fr->myLocals); + + to->cols_ordered = fr->cols_ordered; + to->r_constrs = fr->r_constrs; + to->simplified = fr->simplified; + to->verified = fr->verified; + to->guaranteed_leading_0s = fr->guaranteed_leading_0s; + to->possible_leading_0s = fr->possible_leading_0s; + to->leading_dir = fr->leading_dir; + to->n_open_constraints = fr->n_open_constraints; + to->exact=fr->exact; + + Problem *fp = fr->problem; + Problem *tp = to->problem; + tp->nVars = fp->nVars; + tp->safeVars = fp->safeVars; + tp->variablesInitialized = fp->variablesInitialized; + tp->variablesFreed = fp->variablesFreed; + for(int i=1; i<=maxVars; i++) { // only need nVars of var + tp->forwardingAddress[i] = fp->forwardingAddress[i]; + tp->var[i] = fp->var[i]; + } + to->problem->get_var_name = get_var_name; + to->problem->getVarNameArgs = (void *)to ; +} + + +void Conjunct::reverse_leading_dir_info() { + leading_dir *= -1; +} + + +void Conjunct::enforce_leading_info(int guaranteed, int possible, int dir) { + skip_finalization_check++; + guaranteed_leading_0s = guaranteed; + + int d = min(relation()->n_inp(),relation()->n_out()); + + assert(0 <= guaranteed); + assert(guaranteed <= possible); + assert(possible <= d); + + for(int i = 1; i <= guaranteed; i++) { + EQ_Handle e = add_EQ(); + e.update_coef_during_simplify(input_var(i), -1); + e.update_coef_during_simplify(output_var(i), 1); + e.finalize(); + } + + + if (guaranteed == possible && guaranteed >= 0 && possible+1 <= d && dir) { + GEQ_Handle g = add_GEQ(); + if (dir > 0) { + g.update_coef_during_simplify(input_var(possible+1), -1); + g.update_coef_during_simplify(output_var(possible+1), 1); + } + else { + g.update_coef_during_simplify(input_var(possible+1), 1); + g.update_coef_during_simplify(output_var(possible+1), -1); + } + g.update_const_during_simplify(-1); + g.finalize(); + possible_leading_0s = possible; + leading_dir = dir; + } + else { + possible_leading_0s = d; + leading_dir = 0; + } + + skip_finalization_check--; +#if ! defined NDEBUG + assert_leading_info(); +#endif +} + + +void Conjunct::invalidate_leading_info(int changed) { + if (changed == -1) { + guaranteed_leading_0s = possible_leading_0s = -1; + leading_dir = 0; + } + else { + int d = min(relation()->n_inp(), relation()->n_out()); + assert(1 <= changed && changed <= d); + if (possible_leading_0s == changed -1) { + possible_leading_0s = d; + } + guaranteed_leading_0s = min(guaranteed_leading_0s,changed-1); + } +#if ! defined NDEBUG + assert_leading_info(); +#endif +} + + +int Conjunct::leading_dir_valid_and_known() { + if (relation()->is_set()) { + return 0; + } + // if we know leading dir, we can rule out extra possible 0's + assert(leading_dir == 0 || + possible_leading_0s == guaranteed_leading_0s); + + return (possible_leading_0s == guaranteed_leading_0s && + possible_leading_0s >= 0 && + possible_leading_0s < min(relation()->n_inp(),relation()->n_out()) + && leading_dir); +} + + +#if ! defined NDEBUG +void Conjunct::assert_leading_info() { + if (relation()->is_set()) { + return; + } + + int d = min(relation()->n_inp(), relation()->n_out()); + + if ( guaranteed_leading_0s == -1 + && guaranteed_leading_0s == possible_leading_0s) + assert(leading_dir == 0); + + if(leading_dir != 0 && + possible_leading_0s != guaranteed_leading_0s) { + use_ugly_names++; + prefix_print(DebugFile); + use_ugly_names--; + } + + assert(leading_dir == 0 || possible_leading_0s == guaranteed_leading_0s); + + assert(possible_leading_0s <= d && guaranteed_leading_0s <= d); + + assert(possible_leading_0s == -1 || guaranteed_leading_0s <= possible_leading_0s); + + // check that there must be "guaranteed_leading_0s" 0s + int carried_level; + for (carried_level = 1; carried_level <= guaranteed_leading_0s; carried_level++) { + Variable_ID in = input_var(carried_level), + out = output_var(carried_level); + coef_t lb, ub; + bool guar; + query_difference(out, in, lb, ub, guar); + if (lb != 0 && ub != 0) { + // probably "query_difference" is just approximate + // add the negation of leading_dir and assert that + // the result is unsatisfiable; + // add in > out (in-out-1>=0) and assert unsatisfiable. + + Conjunct *test = copy_conj_same_relation(); + test->problem->turnRedBlack(); + skip_finalization_check++; + + GEQ_Handle g = test->add_GEQ(); + g.update_coef_during_simplify(in, -1); + g.update_coef_during_simplify(out, 1); + g.update_const_during_simplify(-1); + g.finalize(); + assert(!simplify_conj(test, true, 0, 0)); + // test was deleted by simplify_conj, as it was FALSE + + test = copy_conj_same_relation(); + test->problem->turnRedBlack(); + g = test->add_GEQ(); + g.update_coef_during_simplify(in, 1); + g.update_coef_during_simplify(out, -1); + g.update_const_during_simplify(-1); + g.finalize(); + assert(!simplify_conj(test, true, 0, 0)); + // test was deleted by simplify_conj, as it was FALSE + + skip_finalization_check--; + } + } + + carried_level = possible_leading_0s+1; + + // check that there can't be another + if (guaranteed_leading_0s == possible_leading_0s + && possible_leading_0s >= 0 && + carried_level <= min(relation()->n_inp(), relation()->n_out())) { + Variable_ID in = input_var(carried_level), + out = output_var(carried_level); + coef_t lb, ub; + bool guar; + query_difference(out, in, lb, ub, guar); + if (lb <= 0 && ub >= 0) { + // probably "query_difference" is just approximate + // add a 0 and see if its satisfiable + + Conjunct *test = copy_conj_same_relation(); + test->problem->turnRedBlack(); + skip_finalization_check++; + + EQ_Handle e = test->add_EQ(); + e.update_coef_during_simplify(in, -1); + e.update_coef_during_simplify(out, 1); + e.finalize(); + assert(!simplify_conj(test, true, 0, 0)); + // test was deleted by simplify_conj, as it was FALSE + + skip_finalization_check--; + } + } + + // check leading direction info + if (leading_dir_valid_and_known()) { + Variable_ID in = input_var(guaranteed_leading_0s+1), + out = output_var(guaranteed_leading_0s+1); + coef_t lb, ub; + bool guar; + query_difference(out, in, lb, ub, guar); + if ((leading_dir < 0 && ub >= 0) || + (leading_dir > 0 && lb <= 0)) { + // probably "query_difference" is just approximate + // add the negation of leading_dir and assert that + // the result is unsatisfiable; + // eg for leading_dir = +1 (in must be < out), + // add in >= out (in-out>=0) and assert unsatisfiable. + + Conjunct *test = copy_conj_same_relation(); + test->problem->turnRedBlack(); + skip_finalization_check++; + + GEQ_Handle g = test->add_GEQ(); + g.update_coef_during_simplify(in, leading_dir); + g.update_coef_during_simplify(out, -leading_dir); + g.finalize(); + + assert(!simplify_conj(test, true, 0, 0)); + // test was deleted by simplify_conj, as it was FALSE + + skip_finalization_check--; + } + } +} +#endif + + +Variable_ID Conjunct::declare(Const_String s) { + return do_declare(s, Wildcard_Var); +} + +Variable_ID Conjunct::declare() { + return do_declare(Const_String(), Wildcard_Var); +} + +Variable_ID Conjunct::declare(Variable_ID v) { + return do_declare(v->base_name, Wildcard_Var); +} + +Conjunct* Conjunct::really_conjunct() { + return this; +} + + +Variable_ID_Tuple* Conjunct::variables() { + return &mappedVars; +} + +Stride_Handle Conjunct::add_stride(int step, int preserves_level) { + assert_not_finalized(); + Variable_ID wild = declare(); + int c; + c = problem->newEQ(); + simplified = false; + verified = false; + if (! preserves_level) { + if (leading_dir == 0) + possible_leading_0s = -1; + // otherwise we must still have leading_dir, and thus no more 0's + } + problem->EQs[c].color = EQ_BLACK; + eqnnzero(&problem->EQs[c],problem->nVars); + n_open_constraints++; + EQ_Handle h = EQ_Handle(this, c); + h.update_coef(wild,step); + return h; +} + +// This should only be used to copy constraints from simplified relations, +// i.e. there are no quantified variables in c except wildcards. +EQ_Handle Conjunct::add_EQ(const Constraint_Handle &c, int /*preserves_level, currently unused*/) { + EQ_Handle e = add_EQ(); + copy_constraint(e,c); + return e; +} + + +EQ_Handle Conjunct::add_EQ(int preserves_level) { + assert_not_finalized(); + int c; + c = problem->newEQ(); + simplified = false; + verified = false; + if (!preserves_level) { + if (leading_dir == 0) + possible_leading_0s = -1; + // otherwise we must still have leading_dir, and thus no more 0's + } + problem->EQs[c].color = EQ_BLACK; + eqnnzero(&problem->EQs[c],problem->nVars); + n_open_constraints++; + return EQ_Handle(this, c); +} + + +// This should only be used to copy constraints from simplified relations, +// i.e. there are no quantified variables in c except wildcards. +GEQ_Handle Conjunct::add_GEQ(const Constraint_Handle &c, int /*preserves_level, currently unused */) { + GEQ_Handle g = add_GEQ(); + copy_constraint(g,c); + return g; +} + + +GEQ_Handle Conjunct::add_GEQ(int preserves_level) { + assert_not_finalized(); + int c; + c = problem->newGEQ(); + simplified = false; + verified = false; + if (!preserves_level) { + if (leading_dir == 0) + possible_leading_0s = -1; + // otherwise we must still have leading_dir, and thus no more 0's + } + problem->GEQs[c].color = EQ_BLACK; + eqnnzero(&problem->GEQs[c],problem->nVars); + n_open_constraints++; + return GEQ_Handle(this, c); +} + + +Conjunct *Conjunct::find_available_conjunct() { + return this; +} + + +bool Conjunct::can_add_child() { + return false; +} + + +void Conjunct::combine_columns() { + int nvars = mappedVars.size(),i,j,k; + + for(i=1; i<=nvars; i++) + for(j=i+1; j<=nvars; j++) { + // If they are the same, copy into the higher numbered column. + // That way we won't have problems with already-merged columns later + assert(i != j); + if(mappedVars[i] == mappedVars[j]) { + if (pres_debug) + fprintf(DebugFile, "combine_col:Actually combined %d,%d\n", + j,i); + for(k=0; knEQs; k++) + problem->EQs[k].coef[j] += problem->EQs[k].coef[i]; + for(k=0; knGEQs; k++) + problem->GEQs[k].coef[j] += problem->GEQs[k].coef[i]; + zero_column(problem, i, 0, 0, problem->nEQs, problem->nGEQs); + // Create a wildcard w/no constraints. temporary measure, + // so we don't have to shuffle columns + Variable_ID zero_var = declare(); + mappedVars[i] = zero_var; + break; + } + } +} + + +void Conjunct::finalize() { +// Debugging version of finalize; copy the conjunct and free the old one, +// so that purify will catch accesses to finalized constraints +// assert(n_open_constraints == 0); +// Conjunct *C = this->copy(); +// parent().replace_child(this, C); +// delete this; +} + +Conjunct::~Conjunct() { + NR_CONJUNCTS--; + delete problem; + delete comp_problem; +} + + +// +// Cost = # of terms in DNF when negated +// or CantBeNegated if too bad (i.e. bad wildcards) +// or AvoidNegating if it would be inexact +// +// Also check pres_legal_negations -- +// If set to any_negation, just return the number +// If set to one_geq_or_stride, return CantBeNegated if c > 1 +// If set to one_geq_or_eq, return CantBeNegated if not a single geq or eq +// + +int Conjunct::cost() { + int c; + int i; + int wc_no; + int wc_j = 0; // initialize to shut up the compiler + + // cost 1 per GEQ, and if 1 GEQ has wildcards, +2 for each of them + + c = problem->nGEQs; + for(i=0; inGEQs; i++) { + wc_no = 0; + for(int j=1; j<=problem->nVars; j++) if(problem->GEQs[i].coef[j]!=0) { + Variable_ID v = mappedVars[j]; + if(v->kind()==Wildcard_Var) { + wc_no++; + c+=2; + wc_j = j; + } + } + if (wc_no > 1) return CantBeNegated; + } + + for(i=0; inEQs; i++) { + wc_no = 0; + for(int j=1; j<=problem->nVars; j++) if(problem->EQs[i].coef[j]!=0) { + Variable_ID v = mappedVars[j]; + if(v->kind()==Wildcard_Var) { + wc_no++; + wc_j = j; + } + } + + if (wc_no == 0) // no wildcards + c+=2; + else if (wc_no == 1) { // one wildcard - maybe we can negate it + int i2; + for(i2=0; i2nEQs; i2++) + if(i != i2 && problem->EQs[i2].coef[wc_j]!=0) break; + if (i2 >= problem->nEQs) // Stride constraint + c++; + else // We are not ready to handle this + return CantBeNegated; + } + else // Multiple wildcards + return CantBeNegated; + } + if (!exact) return AvoidNegating; + + if (pres_legal_negations == any_negation) { + return c; + } + else { + // single GEQ ok either way as long as no wildcards + // (we might be able to handle wildcards, but I haven't thought about it) + if (problem->nEQs==0 && problem->nGEQs<=1) { + if (c>1) { // the GEQ had a wildcard -- I'm not ready to go here. + if (pres_debug > 0) { + fprintf(DebugFile, + "Refusing to negate a GEQ with wildcard(s)" + " under restricted_negation; " + "It may be possible to fix this.\n"); + } + return CantBeNegated; + } + return c; + } + else if (problem->nEQs==1 && problem->nGEQs==0) { + assert(c == 1 || c == 2); + + if (pres_legal_negations == one_geq_or_stride) { + if (c == 1) + return c; // stride constraint is ok + else { + if (pres_debug > 0) { + fprintf(DebugFile, "Refusing to negate a non-stride EQ under current pres_legal_negations.\n"); + } + return CantBeNegated; + } + } + else { + assert(pres_legal_negations == one_geq_or_eq); + return c; + } + } + else { + if (pres_debug > 0) { + fprintf(DebugFile, "Refusing to negate multiple constraints under current pres_legal_negations.\n"); + } + return CantBeNegated; + } + } +} + + +// +// Merge CONJ1 & CONJ2 -> CONJ. +// Action: MERGE_REGULAR or MERGE_COMPOSE: regular merge. +// MERGE_GIST make constraints from conj2 red, i.e. +// Gist Conj2 given Conj1 (T.S. comment). +// Reorder columns as we go. +// Merge the columns for identical variables. +// We assume we know nothing about the ordering of conj1, conj2. +// +// Does not consume its arguments +// +// Optional 4th argument gives the relation for the result - if +// null, conj1 and conj2 must have the same relation, which will +// be used for the result +// +// The only members of conj1 and conj2 that are used are: problem, +// mappedVars and declare(), and the leading_0s/leading_dir members +// and exact. +// +// NOTE: variables that are shared between conjuncts are necessarily +// declared above, not here; so we can simply create columns for the +// locals of each conj after doing the protected vars. +// +Conjunct* merge_conjs(Conjunct* conj1, Conjunct* conj2, + Merge_Action action, Rel_Body *body) { + // body must be set unless both conjuncts are from the same relation + assert(body || conj1->relation() == conj2->relation()); + + if (body == conj1->relation() && body == conj2->relation()) + body = 0; // we test this later to see if there is a new body + + Conjunct *conj3 = new Conjunct(NULL, body ? body : conj2->relation()); + Problem *p1 = conj1->problem; + Problem *p2 = conj2->problem; + Problem *p3 = conj3->problem; + int i; + + if (action != MERGE_COMPOSE) { + conj1->assert_leading_info(); + conj2->assert_leading_info(); + } + + if(pres_debug>=2) { + use_ugly_names++; + fprintf(DebugFile, ">>> Merge conjuncts: Merging%s:\n", + (action == MERGE_GIST ? " for gist" : + (action == MERGE_COMPOSE ? " for composition" : ""))); + conj1->prefix_print(DebugFile); + conj2->prefix_print(DebugFile); + fprintf(DebugFile, "\n"); + use_ugly_names--; + } + + + + switch(action) { + case MERGE_REGULAR: + case MERGE_COMPOSE: + conj3->exact=conj1->exact && conj2->exact; + break; + case MERGE_GIST: + conj3->exact=conj2->exact; + break; + } + + if (action == MERGE_COMPOSE) { + conj3->guaranteed_leading_0s=min(conj1->guaranteed_leading_0s, + conj2->guaranteed_leading_0s); + conj3->possible_leading_0s=min((unsigned int) conj1->possible_leading_0s, + (unsigned int) conj2->possible_leading_0s); + + assert( conj3->guaranteed_leading_0s <= conj3->possible_leading_0s); + + // investigate leading_dir - not well tested code + if (conj1->guaranteed_leading_0s<0 || conj2->guaranteed_leading_0s<0) { + conj3->leading_dir = 0; + } + else if (conj1->guaranteed_leading_0s == conj2->guaranteed_leading_0s) + if (conj1->leading_dir == conj2->leading_dir) + conj3->leading_dir = conj1->leading_dir; + else + conj3->leading_dir = 0; + else if (conj1->guaranteed_leading_0s < conj2->guaranteed_leading_0s) { + conj3->leading_dir = conj1->leading_dir; + } + else { // (conj1->guaranteed_leading_0s > conj2->guaranteed_leading_0s) + conj3->leading_dir = conj2->leading_dir; + } + + if (conj3->leading_dir == 0) + conj3->possible_leading_0s = min(conj3->relation()->n_inp(), + conj3->relation()->n_out()); + + assert(conj3->guaranteed_leading_0s <= conj3->possible_leading_0s); + assert(conj3->guaranteed_leading_0s == conj3->possible_leading_0s + || !conj3->leading_dir); + } + else if (!body) { // if body is set, who knows what leading 0's mean? + assert(action == MERGE_REGULAR || action == MERGE_GIST); + + int feasable = 1; + + int redAndBlackGuarLeadingZeros = max(conj1->guaranteed_leading_0s, + conj2->guaranteed_leading_0s); + if (action == MERGE_REGULAR) + conj3->guaranteed_leading_0s= redAndBlackGuarLeadingZeros; + else conj3->guaranteed_leading_0s=conj1->guaranteed_leading_0s; + + conj3->possible_leading_0s=min((unsigned)conj1->possible_leading_0s, + (unsigned)conj2->possible_leading_0s); + if (conj3->possible_leading_0s < redAndBlackGuarLeadingZeros) + feasable = 0; + else if (conj3->guaranteed_leading_0s == -1 + || conj3->possible_leading_0s > redAndBlackGuarLeadingZeros) + conj3->leading_dir = 0; + else { + if (conj1->guaranteed_leading_0s == conj2->guaranteed_leading_0s) + if (!conj1->leading_dir_valid_and_known()) + conj3->leading_dir = conj2->leading_dir; + else if (!conj2->leading_dir_valid_and_known()) + conj3->leading_dir = conj1->leading_dir; + else if (conj1->leading_dir * conj2->leading_dir > 0) + conj3->leading_dir = conj1->leading_dir; // 1,2 same dir + else + feasable = 0; // 1 and 2 go in opposite directions + else if (conj3->possible_leading_0s != conj3->guaranteed_leading_0s) + conj3->leading_dir = 0; + else if (conj1->guaranteed_leading_0sguaranteed_leading_0s) { + assert(!conj1->leading_dir_valid_and_known()); + conj3->leading_dir = conj2->leading_dir; + } + else { + assert(!conj2->leading_dir_valid_and_known()); + conj3->leading_dir = conj1->leading_dir; + } + } + + if (!feasable) { + if(pres_debug>=2) + fprintf(DebugFile, ">>> Merge conjuncts: quick check proves FALSE.\n"); + + // return 0 = 1 + + int e = p3->newEQ(); + p3->EQs[e].color = EQ_BLACK; + p3->EQs[e].touched = 1; + p3->EQs[e].key = 0; + p3->EQs[e].coef[0] = 1; + + // Make sure these don't blow later assertions + conj3->possible_leading_0s = conj3->guaranteed_leading_0s = -1; + conj3->leading_dir = 0; + + return conj3; + } + } + else { // provided "body" argument but not composing, leading 0s meaningless + conj3->guaranteed_leading_0s = conj3->possible_leading_0s = -1; + conj3->leading_dir = 0; + } + + // initialize omega stuff + + for(i=0; inGEQs+p2->nGEQs; i++) { + int e = p3->newGEQ(); + assert(e == i); + p3->GEQs[e].color = EQ_BLACK; + p3->GEQs[e].touched = 1; + p3->GEQs[e].key = 0; + } + for(i=0; inEQs+p2->nEQs; i++) { + int e = p3->newEQ(); + assert(e == i); + p3->EQs[e].color = EQ_BLACK; + p3->EQs[e].touched = 1; + p3->EQs[e].key = 0; + } + + assert(p3->nGEQs == p1->nGEQs + p2->nGEQs); + assert(p3->nEQs == p1->nEQs + p2->nEQs); + + // flag constraints from second constraint as red, if necessary + if (action == MERGE_GIST) { + for(i=0; inEQs; i++) { + p3->EQs[i+p1->nEQs].color = EQ_RED; + } + for(i=0; inGEQs; i++) { + p3->GEQs[i+p1->nGEQs].color = EQ_RED; + } + } + + // copy constant column + copy_column(p3, 0, p1, 0, 0, 0); + copy_column(p3, 0, p2, 0, p1->nEQs, p1->nGEQs); + + // copy protected variables column from conj1 + int new_col = 1; + Variable_Iterator VI(conj1->mappedVars); + for(i=1; VI; VI++, i++) { + Variable_ID v = *VI; + if(v->kind() != Wildcard_Var) { + conj3->mappedVars.append(v); + int fr_ix = i; + copy_column(p3, new_col, p1, fr_ix, 0, 0); + zero_column(p3, new_col, p1->nEQs, p1->nGEQs, + p2->nEQs, p2->nGEQs); + new_col++; + } + } + + // copy protected variables column from conj2, + // checking if conj3 already has this variable from conj1 + for(i=1; i <= conj2->mappedVars.size(); i++) { + Variable_ID v = conj2->mappedVars[i]; + if(v->kind() != Wildcard_Var) { + int to_ix = conj3->mappedVars.index(v); + int fr_ix = i; + if(to_ix > 0) { + // use old column + copy_column(p3, to_ix, p2, fr_ix, p1->nEQs, p1->nGEQs); + } + else { + // create new column + conj3->mappedVars.append(v); + zero_column(p3, new_col, 0, 0, p1->nEQs, p1->nGEQs); + copy_column(p3, new_col, p2, fr_ix, p1->nEQs, p1->nGEQs); + new_col++; + } + } + } + + p3->safeVars = new_col-1; + + // copy wildcards from conj1 + for(i=1; i <= conj1->mappedVars.size(); i++) { + Variable_ID v = conj1->mappedVars[i]; + if(v->kind() == Wildcard_Var) { + Variable_ID nv = conj3->declare(v); + conj3->mappedVars.append(nv); + int fr_ix = i; + copy_column(p3, new_col, p1, fr_ix, 0, 0); + zero_column(p3, new_col, p1->nEQs, p1->nGEQs, + p2->nEQs, p2->nGEQs); + new_col++; + } + } + + // copy wildcards from conj2 + for(i=1; i <= conj2->mappedVars.size(); i++) { + Variable_ID v = conj2->mappedVars[i]; + if(v->kind() == Wildcard_Var) { + Variable_ID nv = conj3->declare(v); + conj3->mappedVars.append(nv); + int fr_ix = i; + zero_column(p3, new_col, 0, 0, p1->nEQs, p1->nGEQs); + copy_column(p3, new_col, p2, fr_ix, p1->nEQs, p1->nGEQs); + new_col++; + } + } + + p3->nVars = new_col-1; + checkVars(p3->nVars); + p3->variablesInitialized = 1; + for(i=1; i<=p3->nVars; i++) + p3->var[i] = p3->forwardingAddress[i] = i; + + conj3->cols_ordered = true; + conj3->simplified = false; + conj3->verified = false; + + if(pres_debug>=2) { + use_ugly_names++; + fprintf(DebugFile, ">>> Merge conjuncts: result is:\n"); + conj3->prefix_print(DebugFile); + fprintf(DebugFile, "\n"); + use_ugly_names--; + } + + conj3->assert_leading_info(); + + return conj3; +} + + + + +// +// Reorder variables by swapping. +// cols_ordered is just a hint that thorough check needs to be done. +// Sets _safeVars. +// +void Conjunct::reorder() { + if(!cols_ordered) { + int var_no = mappedVars.size(); + int first_wild = 1; + int last_prot = var_no; + while(first_wild < last_prot) { + for(; first_wild<=var_no && mappedVars[first_wild]->kind()!=Wildcard_Var; + first_wild++) ; + for(; last_prot>=1 && mappedVars[last_prot]->kind()==Wildcard_Var; + last_prot--) ; + if(first_wild < last_prot) { + problem->swapVars(first_wild, last_prot); + problem->variablesInitialized = false; + Var_Decl *t = mappedVars[first_wild]; + mappedVars[first_wild] = mappedVars[last_prot]; + mappedVars[last_prot] = t; + if(pres_debug) { + fprintf(DebugFile, "<<>>: swapped var-s %d and %d\n", first_wild, last_prot); + } + } + } + + int safe_vars; + for(safe_vars=0; + safe_varskind()!=Wildcard_Var; + safe_vars++) ; + +#if ! defined NDEBUG + for(int s = safe_vars ; skind() == Wildcard_Var); + } +#endif + + problem->safeVars = safe_vars; + cols_ordered = true; + } +} + + + +// Wherever possible, move function symbols to input tuple. +// This ensures that if in == out, red F(in) = x is redundant +// with black F(out) = x + +void Conjunct::move_UFS_to_input() { + if (guaranteed_leading_0s > 0) { + std::set already_done; + int remapped = 0; + skip_finalization_check++; + Rel_Body *body = relation(); + + assert(body); + + for (Variable_ID_Iterator func(*body->global_decls()); func; func++) { + Global_Var_ID f = (*func)->get_global_var(); + if (f->arity() <= guaranteed_leading_0s) + if (already_done.find(f) == already_done.end() && + body->has_local(f, Input_Tuple) && + body->has_local(f, Output_Tuple)) { + already_done.insert(f); + + // equatE f(in) = f(out) + Variable_ID f_in = body->get_local(f, Input_Tuple); + Variable_ID f_out = body->get_local(f, Output_Tuple); + if (f_in != f_out) { + EQ_Handle e = add_EQ(1); + + e.update_coef_during_simplify(f_in, -1); + e.update_coef_during_simplify(f_out, 1); + + f_out->remap = f_in; + remapped = 1; + } + } + } + + if (remapped) { + remap(); + combine_columns(); + reset_remap_field(*body->global_decls()); + remapped = 0; + } + + skip_finalization_check--; + } +} + + + + + +// +// Simplify CONJ. +// Return TRUE if there are solutions, FALSE -- no solutions. +// +int simplify_conj(Conjunct* conj, int ver_sim, int simplificationEffort, int color) { + if (conj->verified + && simplificationEffort <= conj->r_constrs + && (conj->simplified || simplificationEffort < 0) + && !color) { + if(pres_debug) { + fprintf(DebugFile, "$$$ Redundant simplify_conj ignored (%d,%d,%d)\n",ver_sim,simplificationEffort,color); + conj->prefix_print(DebugFile); + } + return 1; + } + + if (simplificationEffort < 0) simplificationEffort = 0; + conj->move_UFS_to_input(); + conj->reorder(); + + Problem *p = conj->problem; + + use_ugly_names++; + + int i; + for(i=0; inGEQs; i++) { + p->GEQs[i].touched = 1; + } + for(i=0; inEQs; i++) { + p->EQs[i].touched = 1; + } + + if(pres_debug) { + fprintf(DebugFile, "$$$ simplify_conj (%d,%d,%d)[\n",ver_sim,simplificationEffort,color); + conj->prefix_print(DebugFile); + } + + assert(conj->cols_ordered); + + int ret_code; + assert(p == conj->problem); + if(!color) { + ret_code = conj->simplifyProblem(ver_sim && ! conj->verified,0,simplificationEffort); + } + else { + ret_code = conj->redSimplifyProblem(simplificationEffort,1); + ret_code = (ret_code==redFalse ? 0 : 1); + } + assert(p->nSUBs==0); + + if(ret_code == 0) { + if(pres_debug) + fprintf(DebugFile, "] $$$ simplify_conj : false\n\n"); + delete conj; + use_ugly_names--; + return(false); + } + + + // + // mappedVars is mapping from columns to Variable_IDs. + // Recompute mappedVars for problem returned from ip.c + // + Variable_ID_Tuple new_mapped(0); // This is expanded by "append" + for (i=1; i<=p->safeVars; i++) { + // what is now in column i used to be in column p->var[i] + Variable_ID v = conj->mappedVars[p->var[i]]; + assert(v->kind() != Wildcard_Var); + new_mapped.append(v); + } + + /* Redeclare all wildcards that weren't eliminated. */ + free_var_decls(conj->myLocals); conj->myLocals.clear(); + + conj->mappedVars = new_mapped; + for (i = p->safeVars+1; i<=p->nVars; i++) { + Variable_ID v = conj->declare(); + conj->mappedVars.append(v); + } + + // reset var and forwarding address if desired. + p->variablesInitialized = 1; + for(i=1; i<=conj->problem->nVars; i++) + conj->problem->var[i] = conj->problem->forwardingAddress[i] = i; + + if(pres_debug) { + fprintf(DebugFile, "] $$$ simplify_conj\n"); + conj->prefix_print(DebugFile); + fprintf(DebugFile, "\n"); + } + + + use_ugly_names--; + conj->simplified = true; + conj->setup_anonymous_wildcard_names(); + + return(true); +} + + +int Conjunct::rank() { + Conjunct *C = this->copy_conj_same_relation(); + C->reorder(); + C->ordered_elimination(C->relation()->global_decls()->size()); + int C_rank = 0; + for(Variable_Iterator vi = C->mappedVars; vi; vi++) + if(C->find_column(*vi) > 0) C_rank++; + delete C; + return C_rank; + +} + + +void Conjunct::query_difference(Variable_ID v1, Variable_ID v2, coef_t &lowerBound, coef_t &upperBound, bool &guaranteed) { + int c1 = get_column(v1); + int c2 = get_column(v2); + assert(c1 && c2); + problem->query_difference(c1, c2, lowerBound, upperBound, guaranteed); +} + + +void Conjunct::query_variable_bounds(Variable_ID v, coef_t &lowerBound, coef_t &upperBound) { + int c = get_column(v); + assert (c); + problem->query_variable_bounds(c, &lowerBound, &upperBound); +} + +coef_t Conjunct::query_variable_mod(Variable_ID v, coef_t factor) { + int c = get_column(v); + assert(c); + return problem->query_variable_mod(c, factor); +} + +bool Conjunct::query_variable_used(Variable_ID v) { + for (GEQ_Iterator g = GEQs(); g.live(); g.next()) { + if ((*g).get_coef(v)) return true; + } + for (EQ_Iterator e = EQs(); e.live(); e.next()) { + if ((*e).get_coef(v)) return true; + } + return false; +} + + +int Conjunct::simplifyProblem(int verify, int subs, int redundantElimination) { + if (verified) verify = 0; + int result = problem->simplifyProblem(verify, subs, redundantElimination); + if (result == false && !exact) + exact=true; + assert(!(verified && verify && result == false)); + if (verify && result) verified = true; + else if (!result) verified = false; + return result; +} + + +// not as confident about this one as the previous: +int Conjunct::redSimplifyProblem(int effort, int computeGist) { + redCheck result = problem->redSimplifyProblem(effort, computeGist); + if (result == redFalse && !exact) + exact=true; + return result; +} + + +// +// Add given list of wildcards S to this Conjunct. +// Clears argument. (That's very important, otherwise those var_id's get freed) +// Push_exists takes responsibility for reusing or deleting Var_ID's; +// here we reuse them. Must also empty out the Tuple when finished (joins). +void Conjunct::push_exists(Variable_ID_Tuple &S) { + for(Tuple_Iterator VI(S); VI; VI++) { + (*VI)->var_kind = Wildcard_Var; + } + myLocals.join(S); // Sets S to be empty. + cols_ordered = false; + simplified = false; +} + + +Conjunct *Formula::add_conjunct() { + assert_not_finalized(); + assert(can_add_child()); + Conjunct *f = new Conjunct(this, myRelation); + myChildren.append(f); + return f; +} + +// Compress/uncompress functions + +bool Conjunct::is_compressed() { + if(problem!=NULL && comp_problem==NULL) { + return false; + } + else if(problem==NULL && comp_problem!=NULL) { + return true; + } + else { + assert(0 && "Conjunct::is_compressed: bad conjunct"); + return false; + } +} + + +void Conjunct::compress() { + if(!is_compressed()) { // compress + comp_problem = new Comp_Problem(problem); + delete problem; + problem = NULL; + } +} + + +void Conjunct::uncompress() { + if(is_compressed()) { + problem = comp_problem->UncompressProblem(); + delete comp_problem; + comp_problem = NULL; + } +} + + +Comp_Problem::Comp_Problem(Problem *problem) : + _nVars(problem->nVars), + _safeVars(problem->safeVars), + _get_var_name(problem->get_var_name), + _getVarNameArgs(problem->getVarNameArgs), + eqs(&problem->EQs[0],problem->nEQs,problem->nVars), + geqs(&problem->GEQs[0],problem->nGEQs,problem->nVars) { +} + +Comp_Constraints::Comp_Constraints(eqn *constrs, int no_constrs, int no_vars) : + n_constrs(no_constrs), + n_vars(no_vars) { + coefs = new coef_t[(n_vars+1)*n_constrs]; + int e, v; + for(e=0; eget_var_name = get_var_name; + p->getVarNameArgs = _getVarNameArgs; + p->nVars = _nVars; + p->safeVars = _safeVars; + for(int i=1; i<=p->nVars; i++) { + p->forwardingAddress[i] = i; + p->var[i] = i; + } + eqs.UncompressConstr(&p->EQs[0], p->nEQs); + geqs.UncompressConstr(&p->GEQs[0], p->nGEQs); + return p; +} + +void Comp_Constraints::UncompressConstr(eqn *constrs, short &pn_constrs) { + int e, v; + for(e=0; econvertEQstoGEQs(excludeStrides); +} + + +void Conjunct::calculate_dimensions(Relation &R, int &ndim_all, int &ndim_domain) { + + Conjunct * c = this; + Relation rc=Relation(R, c); + + if(relation_debug) { + fprintf(DebugFile,"{{{\nIn Conjunct::calculate_dimensions:\n"); + rc.prefix_print(DebugFile); + } + + rc=Approximate(rc); + Relation rd=rc; + + if(relation_debug) { + fprintf(DebugFile,"Conjunct::calculate_dimensions: Approximated as:\n"); + rc.prefix_print(DebugFile); + } + + // skip_set_checks++; + + Conjunct * rc_conj=rc.single_conjunct(); + ndim_all=rc.n_inp()+rc.n_out(); + ndim_all-=rc_conj->n_EQs(); + + rc = Project_On_Sym(rc); + rc.simplify(); + + if(relation_debug) { + fprintf(DebugFile, "Conjunct::calculate_dimensions: after project_on_sym\n"); + rc.prefix_print(DebugFile); + } + + int n_eq_sym = 1000; + for (DNF_Iterator s(rc.query_DNF()); s.live(); s.next()) + n_eq_sym = min(n_eq_sym, s.curr()->n_EQs()); + ndim_all+=n_eq_sym; + // skip_set_checks--; + + if (R.is_set()) + ndim_domain = ndim_all; + else { + /* get dimensions for the domain (broadcasting) */ + + rd=Domain(rd); + rd.simplify(); + + if(relation_debug) { + fprintf(DebugFile,"Domain is:\n"); + rd.prefix_print(DebugFile); + } + + rc_conj=rd.single_conjunct(); + ndim_domain=rd.n_set()-rc_conj->n_EQs()+n_eq_sym; + } + + if(relation_debug) { + fprintf(DebugFile,"n_eq_sym=%d \n",n_eq_sym); + fprintf(DebugFile,"Dimensions: all=%d domain=%d\n}}}\n", ndim_all,ndim_domain); + } +} + +} // namespace diff --git a/omegalib/omega_lib/src/pres_decl.cc b/omegalib/omega_lib/src/pres_decl.cc new file mode 100644 index 0000000..f5ac312 --- /dev/null +++ b/omegalib/omega_lib/src/pres_decl.cc @@ -0,0 +1,71 @@ +#include +#include + +namespace omega { + +// +// Declare functions. +// +Variable_ID F_Declaration::do_declare(Const_String s, Var_Kind var_type) { + Variable_ID v; + assert(var_type != Global_Var); + if(!s.null()) { + v = new Var_Decl(s, var_type, 0); + } + else { + v = new Var_Decl(var_type, 0); + } + myLocals.append(v); + return v; +} + +Variable_ID F_Declaration::declare(Const_String) { + assert(0); // must be declared in forall, exists, or conjunct + return(NULL); +} + +Section F_Declaration::declare_tuple(int n) { + int first = myLocals.size()+1; + + for (int i=1 ; i<=n; i++) + declare(); + + return Section(&myLocals, first, n); +} + + +void F_Declaration::finalize() { + assert(n_children() == 1); + Formula::finalize(); +} + +bool F_Declaration::can_add_child() { + return n_children() < 1; +} + + +F_Declaration::F_Declaration(Formula *p, Rel_Body *r): + Formula(p,r), myLocals(0) { +} + +F_Declaration::F_Declaration(Formula *p, Rel_Body *r, Variable_ID_Tuple &S): + Formula(p,r), myLocals(S) { +} + +// +// Destruct declarative node. +// Delete variableID's themselves if they are not global. +// +F_Declaration::~F_Declaration() { + free_var_decls(myLocals); +} + +//Setup names for printing +void F_Declaration::setup_anonymous_wildcard_names() { + for(Tuple_Iterator VI(myLocals); VI; VI++) { + Variable_ID v = *VI; + if (v->base_name.null()) v->instance = wildCardInstanceNumber++; + } +} + +} // namespace diff --git a/omegalib/omega_lib/src/pres_dnf.cc b/omegalib/omega_lib/src/pres_dnf.cc new file mode 100644 index 0000000..c9fd7e6 --- /dev/null +++ b/omegalib/omega_lib/src/pres_dnf.cc @@ -0,0 +1,1416 @@ +/***************************************************************************** + Copyright (C) 1994-2000 the Omega Project Team + Copyright (C) 2005-2011 Chun Chen + All Rights Reserved. + + Purpose: + Functions for disjunctive normal form. + + Notes: + + History: +*****************************************************************************/ + +#include +#include +#include +#include /* all DNFize functions are here */ +#include +#include + +namespace omega { + +void DNF::remap() { + for(DNF_Iterator DI(this); DI.live(); DI.next()) { + Conjunct *C = DI.curr(); + C->remap(); + } +} + + +// +// DNF1 & DNF2 -> DNF. +// Free arguments. +// +DNF* DNF_and_DNF(DNF* dnf1, DNF* dnf2) { + DNF* new_dnf = new DNF; + for(DNF_Iterator p(dnf2); p.live(); p.next()) { + new_dnf->join_DNF(DNF_and_conj(dnf1, p.curr())); + } + delete dnf1; + delete dnf2; + if(new_dnf->length() > 1) { + new_dnf->simplify(); + } + + if(pres_debug) { + fprintf(DebugFile, "+++ DNF_and_DNF OUT +++\n"); + new_dnf->prefix_print(DebugFile); + } + return(new_dnf); +} + + +/* + * Remove redundant conjuncts from given DNF. + * If (C1 => C2), remove C1. + * C1 => C2 is TRUE: when problem where C1 is Black and C2 is Red + * Blk Red : has no red constraints. + * It means that C1 is a subset of C2 and therefore C1 is redundant. + * + * Exception: C1 => UNKNOWN - leave them as they are + */ +void DNF::rm_redundant_conjs(int effort) { + if(is_definitely_false() || has_single_conjunct()) + return; + + use_ugly_names++; + // skip_set_checks++; + + int count = 0; + for(DNF_Iterator p(this); p.live(); p.next()) count++; + + if(pres_debug) { + int i = 0; + fprintf(DebugFile, "@@@ rm_redundant_conjs IN @@@[\n"); + prefix_print(DebugFile); + for(DNF_Iterator p(this); p.live(); p.next()) + fprintf(DebugFile, "#%d = %p\n", ++i, p.curr()); + } + + DNF_Iterator pdnext; + DNF_Iterator pdel(this); + for(; pdel.live(); pdel=pdnext) { + pdnext = pdel; + pdnext.next(); + Conjunct *cdel = pdel.curr(); + int del_min_leading_zeros = cdel->query_guaranteed_leading_0s(); + int del_max_leading_zeros = cdel->query_possible_leading_0s(); + + for(DNF_Iterator p(this); p.live(); p.next()) { + Conjunct *c = p.curr(); + if(c != cdel) { + int c_min_leading_zeros = cdel->query_guaranteed_leading_0s(); + int c_max_leading_zeros = cdel->query_possible_leading_0s(); + if(pres_debug) + fprintf(DebugFile, "@@@ rm_redundant_conjs @%p => @%p[\n", cdel, c); + + if (c->is_inexact() && cdel->is_exact()) { + if (pres_debug) + fprintf(DebugFile, "]@@@ rm_redundant_conjs @@@ Exact Conj => Inexact Conj is not tested\n"); + } + else if (del_min_leading_zeros >=0 && c_min_leading_zeros >= 0 + && c_max_leading_zeros >= 0 && del_max_leading_zeros >=0 + && (del_min_leading_zeros > c_max_leading_zeros + || c_min_leading_zeros > del_max_leading_zeros)) { + if (1 || pres_debug) + fprintf(DebugFile, "]@@@ not redundant due to leading zero info\n"); + } + else { + Conjunct *cgist = merge_conjs(cdel, c, MERGE_GIST); + + if (!cgist->redSimplifyProblem(effort,0)) { + if(pres_debug) { + fprintf(DebugFile, "]@@@ rm_redundant_conjs @@@ IMPLICATION TRUE @%p\n", cdel); + cdel->prefix_print (DebugFile); + fprintf(DebugFile, "=>\n"); + c->prefix_print (DebugFile); + } + rm_conjunct(cdel); + delete cdel; + delete cgist; + break; + } + else { + if(pres_debug) { + fprintf(DebugFile, "]@@@ rm_redundant_conjs @@@ IMPLICATION FALSE @%p\n", cdel); + if(pres_debug > 1) + cgist->prefix_print(DebugFile); + } + delete cgist; + } + } + } + } + } + + if(pres_debug) { + fprintf(DebugFile, "]@@@ rm_redundant_conjs OUT @@@\n"); + prefix_print(DebugFile); + } + // skip_set_checks--; + use_ugly_names--; +} + + +/* Remove inexact conjuncts from given DNF if it contains UNKNOWN + * conjunct + */ + +void DNF::rm_redundant_inexact_conjs() { + if (is_definitely_false() || has_single_conjunct()) + return; + + bool has_unknown=false; + bool has_inexact=false; + + Conjunct * c_unknown = 0; // make compiler shut up + for (DNF_Iterator p(this); p.live(); p.next()) { + assert (p.curr()->problem!=NULL); + if (p.curr()->is_inexact()) { + if (p.curr()->is_unknown()) { + has_unknown=true; + c_unknown = p.curr(); + } + else + has_inexact=true; + } + } + + if (! has_unknown || ! has_inexact) + return; + + use_ugly_names++; + // skip_set_checks++; + + DNF_Iterator pdnext; + DNF_Iterator pdel(this); + + for (; pdel.live(); pdel=pdnext) { + pdnext = pdel; + pdnext.next(); + Conjunct * cdel=pdel.curr(); + if (cdel->is_inexact() && cdel!=c_unknown) { + rm_conjunct(cdel); + delete cdel; + } + } + + use_ugly_names--; + // skip_set_checks--; +} + + + +// +// DNF properties. +// +bool DNF::is_definitely_false() const { + return(conjList.empty()); +} + +bool DNF::is_definitely_true() const { + return(has_single_conjunct() && single_conjunct()->is_true()); +} + +int DNF::length() const { + return conjList.length(); +} + +Conjunct *DNF::single_conjunct() const { + assert(conjList.length()==1); + return(conjList.front()); +} + +bool DNF::has_single_conjunct() const { + return (conjList.length()==1); +} + +Conjunct *DNF::rm_first_conjunct() { + if(conjList.empty()) { + return NULL; + } + else { + return conjList.remove_front(); + } +} + + +// +// Convert DNF to Formula and add it root. +// Free this DNF. +// +void DNF::DNF_to_formula(Formula* root) { + Formula *new_or; + if (conjList.length()!=1) { + skip_finalization_check++; + new_or = root->add_or(); + skip_finalization_check--; + } + else { + new_or = root; + } + while(!conjList.empty()) { + Conjunct *conj = conjList.remove_front(); + new_or->add_child(conj); + } + delete this; +} + + +// +// DNF functions. +// +DNF::DNF() : conjList() { +} + +DNF::~DNF() { + // for(DNF_Iterator p(this); p.live(); p.next()) { + // if(p.curr() != NULL) + // delete p.curr(); + // } + for(List_Iterator i(conjList); i.live(); i.next()) + delete *i; +} + +// +// Copy DNF +// +DNF* DNF::copy(Rel_Body *rel_body) { + DNF *new_dnf = new DNF; + for(DNF_Iterator pd(this); pd.live(); pd.next()) { + Conjunct *conj = pd.curr(); + if(conj) + new_dnf->add_conjunct(conj->copy_conj_diff_relation(rel_body,rel_body)); + } + return(new_dnf); +} + +// +// Add Conjunct to DNF +// +void DNF::add_conjunct(Conjunct* conj) { + conjList.append(conj); +} + +// +// Add DNF to DNF. +// The second DNF is reused. +// +void DNF::join_DNF(DNF* dnf) { + conjList.join(dnf->conjList); + delete dnf; +} + +// +// Remove conjunct from DNF. +// Conjunct itself is not deleted. +// +void DNF::rm_conjunct(Conjunct *c) { + if(conjList.front() == c) { + conjList.remove_front(); + } + else { + List_Iterator p, pp; + for(p=List_Iterator (conjList); p; p++) { + if((*p)==c) { + conjList.del_after(pp); + return; + } + pp = p; + } + assert(0 && "DNF::rm_conjunct: no such conjunct"); + } +} + + +// remove (but don't delete) all conjuncts + +void DNF::clear() { + conjList.clear(); +} + + +// +// DNF & CONJ -> new DNF. +// Don't touch arguments. +// +DNF* DNF_and_conj(DNF* dnf, Conjunct* conj) { + DNF* new_dnf = new DNF; + for(DNF_Iterator p(dnf); p.live(); p.next()) { + Conjunct* new_conj = merge_conjs(p.curr(), conj, MERGE_REGULAR); + new_dnf->add_conjunct(new_conj); + } + if(new_dnf->length() > 1) { + new_dnf->simplify(); + } + return(new_dnf); +} + +// +// Compute C0 and not (C1 or C2 or ... CN). +// Reuse/delete its arguments. +// +DNF* conj_and_not_dnf(Conjunct *positive_conjunct, DNF *neg_conjs, bool weak) { + DNF *ret_dnf = new DNF; + int recursive = 0; + use_ugly_names++; + + if(pres_debug) { + fprintf(DebugFile, "conj_and_not_dnf [\n"); + fprintf(DebugFile, "positive_conjunct:\n"); + positive_conjunct->prefix_print(DebugFile); + fprintf(DebugFile, "neg_conjs:\n"); + neg_conjs->prefix_print(DebugFile); + fprintf(DebugFile, "\n\n"); + } + + if (simplify_conj(positive_conjunct, true, false, EQ_BLACK) == false) { + positive_conjunct = NULL; + goto ReturnDNF; + } + + /* Compute gists of negative conjuncts given positive conjunct */ + + + int c0_updated; + c0_updated = true; + while(c0_updated) { + c0_updated = false; + for(DNF_Iterator p(neg_conjs); p.live(); p.next()) { + Conjunct *neg_conj = p.curr(); + if(neg_conj==NULL) continue; + if (!positive_conjunct->is_exact() + && !neg_conj->is_exact()) { + // C1 and unknown & ~(C2 and unknown) = C1 and unknown + delete neg_conj; + p.curr_set(NULL); + continue; + } + Conjunct *cgist = merge_conjs(positive_conjunct, neg_conj, MERGE_GIST); + if(simplify_conj(cgist, false, true, EQ_RED) == false) { + // C1 & ~FALSE = C1 + delete neg_conj; + p.curr_set(NULL); + } + else { + cgist->rm_color_constrs(); + if(cgist->is_true()) { + // C1 & ~TRUE = FALSE + delete cgist; + goto ReturnDNF; + } + else { + if(cgist->cost()==1) { // single inequality + DNF *neg_dnf = negate_conj(cgist); + delete cgist; + Conjunct *conj = + merge_conjs(positive_conjunct, neg_dnf->single_conjunct(), MERGE_REGULAR); + delete positive_conjunct; + delete neg_dnf; + positive_conjunct = conj; + delete neg_conj; + p.curr_set(NULL); + if(!simplify_conj(positive_conjunct, false, false, EQ_BLACK)) { + positive_conjunct = NULL; + goto ReturnDNF; + } + c0_updated = true; + } + else { + delete neg_conj; + p.curr_set(cgist); + } + } + } + } + } + + if(pres_debug) { + fprintf(DebugFile, "--- conj_and_not_dnf positive_conjunct NEW:\n"); + positive_conjunct->prefix_print(DebugFile); + fprintf(DebugFile, "--- conj_and_not_dnf neg_conjs GISTS:\n"); + neg_conjs->prefix_print(DebugFile); + fprintf(DebugFile, "--- conj_and_not_dnf ---\n\n"); + } + + /* Find minimal negative conjunct */ + { + Conjunct *min_conj = NULL; + int min_cost = INT_MAX; + DNF_Iterator min_p; + int live_count = 0; + for(DNF_Iterator q(neg_conjs); q.live(); q.next()) { + Conjunct *neg_conj = q.curr(); + if(neg_conj!=NULL) { + live_count++; + if(neg_conj->cost() < min_cost) { + min_conj = neg_conj; + min_cost = neg_conj->cost(); + min_p = q; + } + } + } + + /* Negate minimal conjunct, AND result with positive conjunct */ + if(weak || min_conj==NULL) { + ret_dnf->add_conjunct(positive_conjunct); + positive_conjunct = NULL; + } + else if (min_cost == CantBeNegated) { + static int OMEGA_WHINGE = -1; + if (OMEGA_WHINGE < 0) { + OMEGA_WHINGE = getenv("OMEGA_WHINGE") ? atoi(getenv("OMEGA_WHINGE")) : 0; + } + if (OMEGA_WHINGE) { + fprintf(stderr, "Ignoring negative clause that can't be negated and generating inexact result\n"); + if (!pres_debug) fprintf(DebugFile, "Ignoring negative clause that can't be negated and generating inexact result\n"); + } + + positive_conjunct->make_inexact(); + ret_dnf->add_conjunct(positive_conjunct); + positive_conjunct = NULL; + if(pres_debug) + fprintf(DebugFile, "Ignoring negative clause that can't be negated and generating inexact upper bound\n"); + } + else { + DNF *neg_dnf = negate_conj(min_conj); + delete min_conj; + min_p.curr_set(NULL); + DNF *new_pos = DNF_and_conj(neg_dnf, positive_conjunct); + delete neg_dnf; + delete positive_conjunct; + positive_conjunct = NULL; + // new_dnf->rm_redundant_conjs(2); + if(live_count>1) { + recursive = 1; + for(DNF_Iterator pd(new_pos); pd.live(); pd.next()) { + Conjunct *conj = pd.curr(); + ret_dnf->join_DNF(conj_and_not_dnf(conj, neg_conjs->copy(conj->relation()))); + pd.curr_set(NULL); + } + delete new_pos; + } + else { + ret_dnf->join_DNF(new_pos); + } + } + } + +ReturnDNF:; + delete positive_conjunct; + delete neg_conjs; + + //if (recursive) ret_dnf->rm_redundant_conjs(1); + + if(pres_debug) { + fprintf(DebugFile, "] conj_and_not_dnf RETURN:\n"); + ret_dnf->prefix_print(DebugFile); + fprintf(DebugFile, "\n\n"); + } + use_ugly_names--; + return ret_dnf; +} + +/* first some functions for manipulating oc "problems" */ + +static void EqnnZero(eqn *e, int s) { +// memset((char*)e, 0, (headerWords+1+s)*sizeof(int)); + e->key = 0; + e->touched = 0; + e->color = EQ_BLACK; + e->essential = 0; + e->varCount = 0; + for (int i = 0; i <= s; i++) + e->coef[i] = 0; +} + +/* + * Make a new black equation in a given problem + */ +static int NewEquation(Problem *p) { + int e = p->newEQ(); + EqnnZero(&p->EQs[e], p->nVars); + return e; +} + +/* + * Make a new black inequality in a given problem + */ +static int NewInequality(Problem *p) { + int g = p->newGEQ(); + EqnnZero(&p->GEQs[g], p->nVars); + return g; +} + +// +// ~CONJ -> DNF +// +DNF* negate_conj(Conjunct* conj) { + if(pres_debug) { + fprintf(DebugFile, "%%%%%% negate_conj IN %%%%%%\n"); + conj->prefix_print(DebugFile); + fprintf(DebugFile, "\n"); + } + + DNF* new_dnf = new DNF; + Problem *p = conj->problem; + int i, j,k; + + if (!conj->is_exact()) new_dnf->add_conjunct(conj->copy_conj_same_relation()); + + Conjunct* true_part = new Conjunct(NULL, conj->relation()); + Problem *tp = true_part->problem; + copy_conj_header(true_part, conj); + true_part->invalidate_leading_info(); + int *wildCard = new int[p->nGEQs]; + int *handleIt = new int[p->nVars+1]; + for(j=1; j<=p->nVars; j++) handleIt[j] = false; + + for(i=0; inGEQs; i++) { + wildCard[i] = 0; + for(j=1; j<=p->nVars; j++) { + Variable_ID v = conj->mappedVars[j]; + if(v->kind()==Wildcard_Var && p->GEQs[i].coef[j]!=0) { + assert(wildCard[i] == 0); + handleIt[j] = true; + if (p->GEQs[i].coef[j] > 0) wildCard[i] = j; + else wildCard[i] = -j; + } + } + } + + for(i=0; inGEQs; i++) if (wildCard[i] == 0) { + /* ~(ax + by + c >= 0) = (-ax -by -c-1 >= 0) */ + Conjunct* new_conj = true_part->copy_conj_same_relation(); + Problem *np = new_conj->problem; + new_conj->exact=true; + int n_e = NewInequality(np); + int t_e = NewInequality(tp); + np->GEQs[n_e].coef[0] = -p->GEQs[i].coef[0]-1; + tp->GEQs[t_e].coef[0] = p->GEQs[i].coef[0]; + for(j=1; j<=p->nVars; j++) { + Variable_ID v = conj->mappedVars[j]; + if(v->kind()==Wildcard_Var && p->GEQs[i].coef[j]!=0) { + assert(0 && "negate_conj: wildcard in inequality"); + } + np->GEQs[n_e].coef[j] = -p->GEQs[i].coef[j]; + tp->GEQs[t_e].coef[j] = p->GEQs[i].coef[j]; + + } + assert(j-1 == p->nVars); + assert(j-1 == conj->mappedVars.size()); + new_dnf->add_conjunct(new_conj); + } + + + for(i=0; inEQs; i++) { + int wc_no = 0; + int wc_j = 0; // make complier shut up + for(j=1; j<=p->nVars; j++) { + Variable_ID v = conj->mappedVars[j]; + if(v->kind()==Wildcard_Var && p->EQs[i].coef[j]!=0) { + wc_no++; + wc_j = j; + } + } + + if(wc_no!=0) { +#if ! defined NDEBUG + int i2; + assert(!handleIt[wc_j]); + for(i2=0; i2nEQs; i2++) + if(i != i2 && p->EQs[i2].coef[wc_j] != 0) break; + assert(i2 >= p->nEQs); +#endif + assert(wc_no == 1 && "negate_conj: more than 1 wildcard in equality"); + + // === Negating equality with a wildcard for K>0 === + // ~(exists v st expr + K v + C = 0) = + // (exists v st 1 <= - expr - K v - C <= K-1) + + Conjunct *nc = true_part->copy_conj_same_relation(); + Problem *np = nc->problem; + nc->exact=true; + + // -K alpha = expr <==> K alpha = expr + if(p->EQs[i].coef[wc_j]<0) + p->EQs[i].coef[wc_j] = -p->EQs[i].coef[wc_j]; + + if(p->EQs[i].coef[wc_j]==2) { + // ~(exists v st expr +2v +C = 0) = + // (exists v st -expr -2v -C = 1) + // That is (expr +2v +C+1 = 0) + int e = NewEquation(np); + np->EQs[e].coef[0] = p->EQs[i].coef[0] +1; + for(j=1; j<=p->nVars; j++) { + np->EQs[e].coef[j] = p->EQs[i].coef[j]; + } + } + else { + // -expr -Kv -C-1 >= 0 + int e = NewInequality(np); + np->GEQs[e].coef[0] = -p->EQs[i].coef[0] -1; + for(j=1; j<=p->nVars; j++) { + np->GEQs[e].coef[j] = -p->EQs[i].coef[j]; + } + + // +expr +Kv +C+K-1 >= 0 + e = NewInequality(np); + np->GEQs[e].coef[0] = p->EQs[i].coef[0] +p->EQs[i].coef[wc_j] -1; + for(j=1; j<=p->nVars; j++) { + np->GEQs[e].coef[j] = p->EQs[i].coef[j]; + } + } + + new_dnf->add_conjunct(nc); + + } + else { + /* ~(ax + by + c = 0) = (-ax -by -c-1 >= 0) Or (ax + by + c -1 >= 0) */ + Conjunct *nc1 = true_part->copy_conj_same_relation(); + Conjunct *nc2 = true_part->copy_conj_same_relation(); + Problem* np1 = nc1->problem; + Problem* np2 = nc2->problem; + nc1->invalidate_leading_info(); + nc2->invalidate_leading_info(); + nc1->exact=true; + nc2->exact=true; + int n_e1 = NewInequality(np1); + int n_e2 = NewInequality(np2); + np1->GEQs[n_e1].coef[0] = -p->EQs[i].coef[0]-1; + np2->GEQs[n_e2].coef[0] = p->EQs[i].coef[0]-1; + for(j=1; j<=p->nVars; j++) { + coef_t coef = p->EQs[i].coef[j]; + np1->GEQs[n_e1].coef[j] = -coef; + np2->GEQs[n_e2].coef[j] = coef; + } + new_dnf->add_conjunct(nc1); + new_dnf->add_conjunct(nc2); + } + { + int e = NewEquation(tp); + tp->EQs[e].coef[0] = p->EQs[i].coef[0]; + for(j=1; j<=p->nVars; j++) + tp->EQs[e].coef[j] = p->EQs[i].coef[j]; + } + } + + for(j=1; j<=p->nVars; j++) + if (handleIt[j]) { + for(i=0; inGEQs; i++) + if (wildCard[i] == j) + for(k=0; knGEQs; k++) if (wildCard[k] == -j){ + // E_i <= c_i alpha + // c_k alpha <= E_k + // c_k E_i <= c_i c_k alpha <= c_i E_k + // c_k E_i <= c_i c_k floor (c_i E_k / c_i c_k) + // negating: + // c_k E_i > c_i c_k floor (c_i E_k / c_i c_k) + // c_k E_i > c_i c_k beta > c_i E_k - c_i c_k + // c_k E_i - 1 >= c_i c_k beta >= c_i E_k - c_i c_k + 1 + Conjunct* new_conj = true_part->copy_conj_same_relation(); + Problem *np = new_conj->problem; + coef_t c_k = - p->GEQs[k].coef[j]; + coef_t c_i = p->GEQs[i].coef[j]; + assert(c_k > 0); + assert(c_i > 0); + new_conj->exact=true; + int n_e = NewInequality(np); + // c_k E_i - 1 >= c_i c_k beta + int v; + for(v=0; v<=p->nVars; v++) { + np->GEQs[n_e].coef[v] = - c_k * p->GEQs[i].coef[v]; + } + np->GEQs[n_e].coef[j] = -c_i * c_k; + np->GEQs[n_e].coef[0]--; + + n_e = NewInequality(np); + // c_i c_k beta >= c_i E_k - c_i c_k + 1 + // c_i c_k beta + c_i c_k -1 >= c_i E_k + for(v=0; v<=p->nVars; v++) { + np->GEQs[n_e].coef[v] = - c_i * p->GEQs[k].coef[v]; + } + np->GEQs[n_e].coef[j] = c_i * c_k; + np->GEQs[n_e].coef[0] += c_i * c_k -1; + + new_dnf->add_conjunct(new_conj); + } + } + + if(pres_debug) { + fprintf(DebugFile, "%%%%%% negate_conj OUT %%%%%%\n"); + new_dnf->prefix_print(DebugFile); + } + delete true_part; + delete[] wildCard; + delete[] handleIt; + return(new_dnf); +} + + + + +/////////////////////////////////////////////////////// +// DNFize formula -- this is the real simplification // +// It also destroys the formula it simplifies // +/////////////////////////////////////////////////////// + + + +// +// Try to separate positive and negative clauses below the AND, +// letting us use the techniques described in Pugh & Wonnacott: +// "An Exact Method for Value-Based Dependence Analysis" +// + + +DNF* F_And::DNFize() { + Conjunct *positive_conjunct = NULL; + DNF *neg_conjs = new DNF; + List pos_dnfs; + List_Iterator pos_dnf_i; + DNF *new_dnf = new DNF; + int JustReturnDNF = 0; + + use_ugly_names++; + + if(pres_debug) { + fprintf(DebugFile, "\nF_And:: DNFize [\n"); + prefix_print(DebugFile); + } + + if(children().empty()) { + Conjunct * c=new Conjunct(NULL, relation()); + new_dnf->add_conjunct(c); + } + else { + while(!children().empty()) { + Formula* carg = children().remove_front(); + if(carg->node_type()==Op_Not) { + // DNF1 & ~DNF2 -> DNF + DNF *dnf = carg->children().remove_front()->DNFize(); + delete carg; + neg_conjs->join_DNF(dnf); // negative conjunct + } + else { + // DNF1 & DNF2 -> DNF + DNF *dnf = carg->DNFize(); + int dl = dnf->length(); + if(dl==0) { + // DNF & false -> false + delete this; + JustReturnDNF = 1; + break; + } + else if(dl==1) { + // positive conjunct + Conjunct *conj = dnf->rm_first_conjunct(); + delete dnf; + if(positive_conjunct==NULL) { + positive_conjunct = conj; + } + else { + Conjunct *new_conj = merge_conjs(positive_conjunct, conj, MERGE_REGULAR); + delete conj; + delete positive_conjunct; + positive_conjunct = new_conj; + } + } + else { + // positive DNF + pos_dnfs.append(dnf); + } + } + } + + if (!JustReturnDNF) { + Rel_Body * my_relation = relation(); + delete this; + + // If we have a positive_conjunct, it can serve as the 1st arg to + // conj_and_not_dnf. Otherwise, if pos_dnfs has one DNF, + // use each conjunct there for this purpose. + // Only pass "true" here if there is nothing else to try, + // as long as TRY_TO_AVOID_TRUE_AND_NOT_DNF is set. + // + // Perhaps we should even try to and multiple DNF's? + + if (!positive_conjunct && pos_dnfs.length() == 1) { + if(pres_debug) { + fprintf(DebugFile, "--- F_AND::DNFize() Single pos_dnf:\n"); + pos_dnfs[1]->prefix_print(DebugFile); + fprintf(DebugFile, "--- F_AND::DNFize() vs neg_conjs:\n"); + neg_conjs->prefix_print(DebugFile); + } + + DNF *real_neg_conjs = new DNF; + for (DNF_Iterator nc(neg_conjs); nc; nc++) { + if (simplify_conj((*nc), true, false, EQ_BLACK) != false) + real_neg_conjs->add_conjunct(*nc); + (*nc) = 0; + } + delete neg_conjs; + neg_conjs = real_neg_conjs; + + for(DNF_Iterator pc(pos_dnfs[1]); pc; pc++) { + new_dnf->join_DNF(conj_and_not_dnf((*pc), neg_conjs->copy((*pc)->relation()))); + (*pc) = 0; + } + } + else if(positive_conjunct==NULL && neg_conjs->is_definitely_false()) { + pos_dnf_i = List_Iterator(pos_dnfs); + delete new_dnf; + new_dnf = *pos_dnf_i; + *pos_dnf_i = NULL; + pos_dnf_i++; + for ( ; pos_dnf_i; pos_dnf_i++) { + DNF *pos_dnf = *pos_dnf_i; + new_dnf = DNF_and_DNF(new_dnf, pos_dnf); + *pos_dnf_i = NULL; + } + } + else { + if(positive_conjunct==NULL) { + static int OMEGA_WHINGE = -1; + if (OMEGA_WHINGE < 0) { + OMEGA_WHINGE = getenv("OMEGA_WHINGE") ? atoi(getenv("OMEGA_WHINGE")) : 0; + } + + if (pres_debug || OMEGA_WHINGE) { + fprintf(DebugFile, "Uh-oh: F_AND::DNFize() resorting to TRUE and not DNF\n"); + fprintf(DebugFile, "--- F_AND::DNFize() neg_conjs\n"); + neg_conjs->prefix_print(DebugFile); + fprintf(DebugFile, "--- F_AND::DNFize() pos_dnfs:\n"); + for (pos_dnf_i=List_Iterator(pos_dnfs); pos_dnf_i; pos_dnf_i++) { + (*pos_dnf_i)->prefix_print(DebugFile); + fprintf(DebugFile,"---- --\n"); + } + } + if (OMEGA_WHINGE) { + fprintf(stderr, "Uh-oh: F_AND::DNFize() resorting to TRUE and not DNF\n"); + fprintf(stderr, "--- F_AND::DNFize() neg_conjs\n"); + neg_conjs->prefix_print(stderr); + fprintf(stderr, "--- F_AND::DNFize() pos_dnfs:\n"); + for (pos_dnf_i=List_Iterator(pos_dnfs); pos_dnf_i; pos_dnf_i++) { + (*pos_dnf_i)->prefix_print(stderr); + fprintf(stderr,"---- --\n"); + } + } + positive_conjunct = new Conjunct(NULL, my_relation); + } + + if(!neg_conjs->is_definitely_false()) { + new_dnf->join_DNF(conj_and_not_dnf(positive_conjunct, neg_conjs)); + neg_conjs = NULL; + } + else { + new_dnf->add_conjunct(positive_conjunct); + } + positive_conjunct = NULL; + + // + // AND it with positive DNFs + // + if(pres_debug) { + fprintf(DebugFile, "--- F_AND::DNFize() pos_dnfs:\n"); + for (pos_dnf_i=List_Iterator(pos_dnfs); pos_dnf_i; pos_dnf_i++) + (*pos_dnf_i)->prefix_print(DebugFile); + } + for (pos_dnf_i = List_Iterator(pos_dnfs); pos_dnf_i; pos_dnf_i++) { + DNF *pos_dnf = *pos_dnf_i; + new_dnf = DNF_and_DNF(new_dnf, pos_dnf); + *pos_dnf_i = NULL; + } + } + } + } + + delete positive_conjunct; + delete neg_conjs; + for (pos_dnf_i = List_Iterator(pos_dnfs); pos_dnf_i; pos_dnf_i++) + delete *pos_dnf_i; + + if(pres_debug) { + fprintf(DebugFile, "] F_AND::DNFize() OUT \n"); + new_dnf->prefix_print(DebugFile); + } + + use_ugly_names--; + + return new_dnf; +} + +// +// ~ dnf = true ^ ~ dnf, so just call conj_and_not_dnf +// + +DNF* F_Not::DNFize() { + Conjunct *positive_conjunct = new Conjunct(NULL, relation()); + DNF *neg_conjs = children().remove_front()->DNFize(); + delete this; + DNF *new_dnf = conj_and_not_dnf(positive_conjunct, neg_conjs); + + if(pres_debug) { + fprintf(DebugFile, "=== F_NOT::DNFize() OUT ===\n"); + new_dnf->prefix_print(DebugFile); + } + return new_dnf; +} + + +// +// or is almost in DNF already: +// + +DNF* F_Or::DNFize() { + DNF* new_dnf = new DNF; + bool empty_or=true; + + while(!children().empty()) { + DNF* c_dnf = children().remove_front()->DNFize(); + new_dnf->join_DNF(c_dnf); + empty_or=false; + } + + + delete this; + + if(pres_debug) { + fprintf(DebugFile, "=== F_OR::DNFize() OUT ===\n"); + new_dnf->prefix_print(DebugFile); + } + return(new_dnf); +} + + +// +// exists x : (c1 v c2 v ...) --> (exists x : c1) v (exists x : c2) v ... +// + +DNF* F_Exists::DNFize() { + DNF *dnf = children().remove_front()->DNFize(); + + for (DNF_Iterator pd(dnf); pd.live(); pd.next()) { + Conjunct *conj = pd.curr(); + + // can simply call localize_vars for DNF with a single conjunct + Variable_ID_Tuple locals_copy(myLocals.size()); + copy_var_decls(locals_copy, myLocals); + conj->push_exists(locals_copy); + conj->remap(); + reset_remap_field(myLocals); + + conj->r_constrs = 0; + conj->simplified = false; // who knows + conj->cols_ordered = false; + } + delete this; + + if(pres_debug) { + fprintf(DebugFile, "=== F_EXISTS::DNFize() OUT ===\n"); + dnf->prefix_print(DebugFile); + } + return(dnf); +} + + +// +// Single conjunct is already in DNF. +// + +DNF* Conjunct::DNFize() { + assert(!is_compressed()); + DNF *results = new DNF; + + if (is_true()) { + simplified = true; + verified = true; + results->add_conjunct(this); + } + else { + results->add_conjunct(this); + } + + return results; +} + + +// +// Foralls should have been removed before we get to DNFize +// + +DNF* F_Forall::DNFize() { + assert(0); + return(NULL); +} + +void DNF::count_leading_0s() { + if (conjList.empty()) + return; + + for (DNF_Iterator conj(this); conj; conj++) { + (*conj)->count_leading_0s(); + } +} + + +// return x s.t. forall conjuncts c, c has >= x leading 0s +// if set, always returns -1; arg tells you if it's a set or relation. + +int DNF::query_guaranteed_leading_0s(int what_to_return_for_empty_dnf) { + count_leading_0s(); + int result = what_to_return_for_empty_dnf; // if set, -1; if rel, 0 + bool first = true; + + for (DNF_Iterator conj(this); conj; conj++) { + int tmp = (*conj)->query_guaranteed_leading_0s(); + assert(tmp >= 0 || ((*conj)->relation()->is_set() && tmp == -1)); + if (first || tmp < result) result = tmp; + first = false; + } + + return result; +} + +// return x s.t. forall conjuncts c, c has <= x leading 0s +// if no conjuncts, return the argument + +int DNF::query_possible_leading_0s(int n_input_and_output) { + count_leading_0s(); + int result = n_input_and_output; + bool first = true; + + for (DNF_Iterator conj(this); conj; conj++) { + int tmp = (*conj)->query_possible_leading_0s(); + assert(tmp >= 0 || (tmp == -1 && (*conj)->relation()->is_set())); + if (first || tmp > result) result = tmp; + first = false; + } + + return result; +} + + +// return 0 if we don't know, or +-1 if we do + +int DNF::query_leading_dir() { + count_leading_0s(); + int result = 0; + bool first = true; + + for (DNF_Iterator conj(this); conj; conj++) { + int glz = (*conj)->query_guaranteed_leading_0s(); + int plz = (*conj)->query_possible_leading_0s(); + int rlz = 0; // shut the compiler up + if (glz != plz) + return 0; + + if (first) { + rlz = glz; + result = (*conj)->query_leading_dir(); + first = false; + } + else + if (glz != rlz || result != (*conj)->query_leading_dir()) + return 0; + } + + return result; +} + +void Conjunct::count_leading_0s() { + Rel_Body *body = relation(); + int max_depth = min(body->n_inp(), body->n_out()); + if(body->is_set()) { + assert(guaranteed_leading_0s == -1 && possible_leading_0s == -1); +// guaranteed_leading_0s = possible_leading_0s = -1; + leading_dir = 0; + return; + } + + +#if ! defined NDEBUG + assert_leading_info(); +#endif + if (guaranteed_leading_0s < 0) { + int L; + for (L=1; L <= max_depth; L++) { + Variable_ID in = body->input_var(L), out = body->output_var(L); + coef_t min, max; + bool guaranteed; + + query_difference(out, in, min, max, guaranteed); + if (min < 0 || max > 0) { + if (min > 0 || max < 0) { // we know guaranteed & possible + guaranteed_leading_0s = possible_leading_0s = L-1; + if (min > 0) // We know its 0,..,0,+ + leading_dir = 1; + else // We know its 0,..,0,- + leading_dir = -1; + return; + } + break; + } + } + guaranteed_leading_0s = L-1; + for ( ; L <= max_depth; L++) { + Variable_ID in = body->input_var(L), + out = body->output_var(L); + coef_t min, max; + bool guaranteed; + + query_difference(out, in, min, max, guaranteed); + + if (min > 0 || max < 0) break; + } + possible_leading_0s = L-1; + } +#if ! defined NDEBUG + assert_leading_info(); +#endif +} + +// +// add level-carried DNF form out to level "level" +// + + +void DNF::make_level_carried_to(int level) { + count_leading_0s(); + Rel_Body *body = 0; // make compiler shut up + if (length() > 0 && !(body = conjList.front()->relation())->is_set()) { + // LCDNF makes no sense otherwise + Relation tmp; +#ifndef NDEBUG + tmp = Relation(*body,42); +#endif + + DNF *newstuff = new DNF; + int shared_depth = min(body->n_inp(), body->n_out()); + int split_to = level >= 0 ? min(shared_depth,level) : shared_depth; + + skip_finalization_check++; + EQ_Handle e; + + for (DNF_Iterator conj(this); conj; conj++) { + assert(body = (*conj)->relation()); + int leading_eqs; + + bool is_guaranteed = (*conj)->verified; + + for (leading_eqs=1; leading_eqs <= split_to; leading_eqs++) { + Variable_ID in = body->input_var(leading_eqs), + out = body->output_var(leading_eqs); + coef_t min, max; + bool guaranteed; + + if (leading_eqs > (*conj)->possible_leading_0s && + (*conj)->leading_dir_valid_and_known()) { + leading_eqs--; + break; + } + + if (leading_eqs > (*conj)->guaranteed_leading_0s) { + (*conj)->query_difference(out, in, min, max, guaranteed); + if (min > 0 || max < 0) guaranteed = true; +// fprintf(DebugFile,"Make level carried, %d <= diff%d <= %d (%d):\n", +// min,leading_eqs,max,guaranteed); +// use_ugly_names++; +// (*conj)->prefix_print(DebugFile); +// use_ugly_names--; + if (!guaranteed) is_guaranteed = false; + bool generateLTClause = min < 0; + bool generateGTClause = max > 0; + bool retainEQClause = (leading_eqs <= (*conj)->possible_leading_0s && + min <= 0 && max >= 0); + if (!(generateLTClause || generateGTClause || retainEQClause)) { + // conjunct is infeasible + if (pres_debug) { + fprintf(DebugFile, "Conjunct discovered to be infeasible during make_level_carried_to(%d):\n", level); + (*conj)->prefix_print(DebugFile); + } +#if ! defined NDEBUG + Conjunct *cpy = (*conj)->copy_conj_same_relation(); + assert(!simplify_conj(cpy, true, 32767, 0)); +#endif + } + + if (generateLTClause) { + Conjunct *lt; + if (!generateGTClause && !retainEQClause) + lt = *conj; + else + lt = (*conj)->copy_conj_same_relation(); + if (max >= 0) { + GEQ_Handle l = lt->add_GEQ(); // out in-out-1>=0 + l.update_coef_during_simplify(in, 1); + l.update_coef_during_simplify(out, -1); + l.update_const_during_simplify(-1); + } + lt->guaranteed_leading_0s + = lt->possible_leading_0s = leading_eqs-1; + lt->leading_dir = -1; + if (is_guaranteed) { + /* + fprintf(DebugFile,"Promising solutions to: %d <= diff%d <= %d (%d):\n", + min,leading_eqs,max,guaranteed); + use_ugly_names++; + lt->prefix_print(DebugFile); + use_ugly_names--; + */ + lt->promise_that_ub_solutions_exist(tmp); + } + else if (0) { + fprintf(DebugFile,"Can't guaranteed solutions to:\n"); + use_ugly_names++; + lt->prefix_print(DebugFile); + use_ugly_names--; + } + if (generateGTClause || retainEQClause) + newstuff->add_conjunct(lt); + } + + if (generateGTClause) { + Conjunct *gt; + if (retainEQClause) gt = (*conj)->copy_conj_same_relation(); + else gt = *conj; + if (min <= 0) { + GEQ_Handle g = gt->add_GEQ(); // out>in ==> out-in-1>=0 + g.update_coef_during_simplify(in, -1); + g.update_coef_during_simplify(out, 1); + g.update_const_during_simplify(-1); + } + gt->guaranteed_leading_0s = + gt->possible_leading_0s = leading_eqs-1; + gt->leading_dir = 1; + if (is_guaranteed) { + /* + fprintf(DebugFile,"Promising solutions to: %d <= diff%d <= %d (%d):\n", + min,leading_eqs,max,guaranteed); + use_ugly_names++; + gt->prefix_print(DebugFile); + use_ugly_names--; + */ + gt->promise_that_ub_solutions_exist(tmp); + } + else if (0) { + fprintf(DebugFile,"Can't guaranteed solutions to:\n"); + use_ugly_names++; + gt->prefix_print(DebugFile); + use_ugly_names--; + } + if (retainEQClause) newstuff->add_conjunct(gt); + } + + if (retainEQClause) { + assert(min <= 0 && 0 <= max); + + if (min < 0 || max > 0) { + e = (*conj)->add_EQ(1); + e.update_coef_during_simplify(in, -1); + e.update_coef_during_simplify(out, 1); + } + + assert((*conj)->guaranteed_leading_0s == -1 + || leading_eqs > (*conj)->guaranteed_leading_0s); + assert((*conj)->possible_leading_0s == -1 + || leading_eqs <= (*conj)->possible_leading_0s); + + (*conj)->guaranteed_leading_0s = leading_eqs; + } + else break; + } + + { + Set already_done; + int remapped = 0; + + assert((*conj)->guaranteed_leading_0s == -1 + || leading_eqs <= (*conj)->guaranteed_leading_0s); + + for (Variable_ID_Iterator func(*body->global_decls()); func; func++) { + Global_Var_ID f = (*func)->get_global_var(); + if (!already_done.contains(f) && + body->has_local(f, Input_Tuple) && + body->has_local(f, Output_Tuple) && + f->arity() == leading_eqs) { + already_done.insert(f); + + // add f(in) = f(out), project one away + e = (*conj)->add_EQ(1); + Variable_ID f_in =body->get_local(f,Input_Tuple); + Variable_ID f_out =body->get_local(f,Output_Tuple); + + e.update_coef_during_simplify(f_in, -1); + e.update_coef_during_simplify(f_out, 1); + + f_out->remap = f_in; + remapped = 1; + is_guaranteed = false; + } + } + + if (remapped) { + (*conj)->remap(); + (*conj)->combine_columns(); + reset_remap_field(*body->global_decls()); + remapped = 0; + } + } + } + if (is_guaranteed) + (*conj)->promise_that_ub_solutions_exist(tmp); + else if (0) { + fprintf(DebugFile,"Can't guaranteed solutions to:\n"); + use_ugly_names++; + (*conj)->prefix_print(DebugFile); + use_ugly_names--; + } + } + + skip_finalization_check--; + join_DNF(newstuff); + } + +#if ! defined NDEBUG + for (DNF_Iterator c(this); c; c++) + (*c)->assert_leading_info(); +#endif + + simplify(); +} + +void DNF::remove_inexact_conj() { + bool found_inexact=false; + + do { + bool first=true; + found_inexact=false; + DNF_Iterator c_prev; + for (DNF_Iterator c(this); c; c++) { + if (!(*c)->is_exact()) { // remove it from the list + found_inexact=true; + delete (*c); + if (first) + conjList.del_front(); + else + conjList.del_after(c_prev); + break; + } + else { + first=false; + c_prev=c; + } + } + } + while (found_inexact); +} + + +int s_rdt_constrs; + +// +// Simplify all conjuncts in a DNF +// +void DNF::simplify() { + for (DNF_Iterator pd(this); pd.live(); ) { + Conjunct *conj = pd.curr(); + pd.next(); + if(s_rdt_constrs >= 0 && !simplify_conj(conj, true, s_rdt_constrs, EQ_BLACK)) { + rm_conjunct(conj); + } + } +} + +} // namespace diff --git a/omegalib/omega_lib/src/pres_form.cc b/omegalib/omega_lib/src/pres_form.cc new file mode 100644 index 0000000..82b710b --- /dev/null +++ b/omegalib/omega_lib/src/pres_form.cc @@ -0,0 +1,147 @@ +#include +#include +#include +#include +#include + +namespace omega { + +// +// Children and parents. +// +void Formula::remove_child(Formula *kid) { + assert(&kid->parent() == this); + if (myChildren.front() == kid) + myChildren.del_front(); + else { + List_Iterator j,k; + for(j=List_Iterator(myChildren); *j != kid && j; k=j, j++) + ; + + if (k) + myChildren.del_after(k); + else + assert(0 && "Child to be removed not found in child list"); + } +} + + +void Formula::add_child(Formula *kid) { + assert(can_add_child()); + myChildren.append(kid); + kid->myParent = this; + kid->myRelation = this->relation(); +} + +void Formula::replace_child(Formula *child, Formula* new_child) { + assert(&child->parent() == this); + for(List_Iterator LI(myChildren); LI; LI++) + if(*LI == child) { + *LI = new_child; + new_child->myParent = this; + new_child->myRelation = this->relation(); + break; + } +} + +void Formula::set_parent(Formula *parent, Rel_Body *reln) { + myParent = parent; + myRelation = reln; + for(List_Iterator c(myChildren); c; c++) + (*c)->set_parent(this,reln); +} + +// +// Function that sets myRelation pointers in a tree. +// +void Formula::set_relation(Rel_Body *r) { + myRelation = r; + for(List_Iterator FI(myChildren); FI; FI++) + (*FI)->set_relation(r); +} + + +// +// Function that descends to conjuncts to merge columns +// +void Formula::combine_columns() { + foreach(child,Formula *,myChildren,child->combine_columns()); +} + + +void Formula::finalize() { + for(List_Iterator c(children()); c; c++) + (*c)->finalize(); +} + +bool Formula::can_add_child() { + return true; +} + + + +Conjunct *Formula::really_conjunct() { + assert(0 && "really_conjunct() called on something that wasn't"); + return NULL; +} + +Formula::Formula(Formula *p, Rel_Body *r): myParent(p), myRelation(r) { +} + + +void Formula::verify_tree() { // should be const +#if ! defined NDEBUG + Any_Iterator c = myChildren.any_iterator(); + for (; c; c++) { + assert((*c)->myParent==this); + assert((*c)->myRelation==this->myRelation); + (*c)->verify_tree(); + } +#endif +} + +Formula *Formula::copy(Formula *, Rel_Body *) { + assert(0); + return NULL; +} + +Formula::~Formula() { + for(List_Iterator c(myChildren); c; c++) { + delete *c; + } + myChildren.clear(); +} + +void Formula::assert_not_finalized() { + if (!skip_finalization_check) { + assert(! relation()->is_finalized()); + assert(! relation()->is_shared()); + } +} + +void Formula::reverse_leading_dir_info() { + for(List_Iterator c(myChildren); c; c++) + (*c)->reverse_leading_dir_info(); +} + +void Formula::invalidate_leading_info(int changed) { + for(List_Iterator c(myChildren); c; c++) + (*c)->invalidate_leading_info(changed); +} + +void Formula::enforce_leading_info(int guaranteed, int possible, int dir) { + for(List_Iterator c(myChildren); c; c++) + (*c)->enforce_leading_info(guaranteed, possible, dir); +} + +// +// Push_exists functions. +// Push exists takes responsibility for the Variable_ID's in the Tuple. +// It should: +// * Re-use them, or +// * Delete them. +void Formula::push_exists(Variable_ID_Tuple &) { + assert(0); +} + +} // namespace diff --git a/omegalib/omega_lib/src/pres_gen.cc b/omegalib/omega_lib/src/pres_gen.cc new file mode 100644 index 0000000..0f05d40 --- /dev/null +++ b/omegalib/omega_lib/src/pres_gen.cc @@ -0,0 +1,45 @@ +#include + +namespace omega { + +int skip_finalization_check=0; +// int skip_set_checks=0; + +int pres_debug=0 ; +FILE *DebugFile=stderr; // This is the default; it's best to set it yourself. + +negation_control pres_legal_negations = any_negation; + +// +// I/O utility functions. +// +// void PresErrAssert(const char *t) { +// fprintf(stdout, "\nERROR: %s\n", t); +// if(pres_debug) { +// fprintf(DebugFile, "\nERROR: %s\n", t); +// } +// exit(1); +// } + + + +// +// Needed for gprof +// +#if defined PROFILE_MALLOCS +void* operator new(size_t n) { + void *result = malloc (n < 1 ? 1 : n); + if (result) + return result; + else { + write(2,"Virtual memory exceeded in new\n",32); + return 0; + } +} + +void operator delete (void* f) { + if (f) free(f); +} +#endif + +} // namespace diff --git a/omegalib/omega_lib/src/pres_logic.cc b/omegalib/omega_lib/src/pres_logic.cc new file mode 100644 index 0000000..8ee90f1 --- /dev/null +++ b/omegalib/omega_lib/src/pres_logic.cc @@ -0,0 +1,226 @@ +#include +#include +#include +#include + +namespace omega { + +GEQ_Handle F_And::add_GEQ(int preserves_level) { + assert_not_finalized(); + if (pos_conj == NULL || pos_conj->problem->nGEQs >= maxGEQs) { + pos_conj = NULL; + for(List_Iterator c(children()); c; c++) { + if ((*c)->node_type()==Op_Conjunct && + ((*c)->really_conjunct())->problem->nGEQs < maxGEQs) { + pos_conj = (*c)->really_conjunct(); + break; + } + } + if(!pos_conj) pos_conj = add_conjunct();// FERD -- set level if preserved? + } + return pos_conj->add_GEQ(preserves_level); +} + + +EQ_Handle F_And::add_EQ(int preserves_level) { + assert_not_finalized(); + if (pos_conj == NULL || pos_conj->problem->nEQs >= maxEQs) { + pos_conj = NULL; + for(List_Iterator c(children()); c; c++) { + if ((*c)->node_type()==Op_Conjunct && + ((*c)->really_conjunct())->problem->nEQs < maxEQs) { + pos_conj = (*c)->really_conjunct(); + break; + } + } + if(!pos_conj) pos_conj = add_conjunct();//FERD-set level info if preserved? + } + return pos_conj->add_EQ(preserves_level); +} + +Stride_Handle F_And::add_stride(int step, int preserves_level) { + assert_not_finalized(); + if (pos_conj == NULL || pos_conj->problem->nEQs >= maxEQs) { + pos_conj = NULL; + for(List_Iterator c(children()); c; c++) { + if ((*c)->node_type()==Op_Conjunct && + ((*c)->really_conjunct())->problem->nEQs < maxEQs) { + pos_conj = (*c)->really_conjunct(); + break; + } + } + if(!pos_conj) pos_conj = add_conjunct(); // FERD -set level if preserved? + } + return pos_conj->add_stride(step, preserves_level); +} + +GEQ_Handle F_And::add_GEQ(const Constraint_Handle &constraint, int preserves_level) { + assert_not_finalized(); + if (pos_conj == NULL || pos_conj->problem->nGEQs >= maxGEQs) { + pos_conj = NULL; + for(List_Iterator c(children()); c; c++) { + if ((*c)->node_type()==Op_Conjunct && + ((*c)->really_conjunct())->problem->nGEQs < maxGEQs) { + pos_conj = (*c)->really_conjunct(); + break; + } + } + if(!pos_conj) pos_conj = add_conjunct();// FERD -- set level if preserved? + } + return pos_conj->add_GEQ(constraint, preserves_level); +} + + +EQ_Handle F_And::add_EQ(const Constraint_Handle &constraint, int preserves_level) { + assert_not_finalized(); + if (pos_conj == NULL || pos_conj->problem->nEQs >= maxEQs) { + pos_conj = NULL; + for(List_Iterator c(children()); c; c++) { + if ((*c)->node_type()==Op_Conjunct && + ((*c)->really_conjunct())->problem->nEQs < maxEQs) { + pos_conj = (*c)->really_conjunct(); + break; + } + } + if(!pos_conj) pos_conj = add_conjunct();//FERD-set level info if preserved? + } + return pos_conj->add_EQ(constraint,preserves_level); +} + + +void F_And::add_unknown() { + assert_not_finalized(); + if (pos_conj == NULL) { + for (List_Iterator c(children()); c; c++) { + if ((*c)->node_type()==Op_Conjunct) { + pos_conj = (*c)->really_conjunct(); + break; + } + } + if(!pos_conj) pos_conj = add_conjunct(); // FERD - set level if preseved? + } + pos_conj->make_inexact(); +} + +Conjunct *F_Or::find_available_conjunct() { + return 0; +} + +Conjunct *F_Not::find_available_conjunct() { + return 0; +} + +Conjunct *F_And::find_available_conjunct() { + for(List_Iterator child(children()); child; child++) { + Conjunct *c = (*child)->find_available_conjunct(); + if (c) return c; + } + return 0; +} + + +void F_Not::finalize() { + assert(n_children() == 1); + Formula::finalize(); +} + +bool F_Not::can_add_child() { + return n_children() < 1; +} + +F_And *F_And::and_with() { + assert_not_finalized(); + assert(can_add_child()); + return this; +} + +F_And::F_And(Formula *p, Rel_Body *r): Formula(p,r), pos_conj(NULL) { +} + +F_Or::F_Or(Formula *p, Rel_Body *r): Formula(p,r){ +} + +F_Not::F_Not(Formula *p, Rel_Body *r): Formula(p,r){ +} + +Formula *F_And::copy(Formula *parent, Rel_Body *reln) { + F_And *f = new F_And(parent, reln); + for(List_Iterator c(children()); c; c++) + f->children().append((*c)->copy(f,reln)); + return f; +} + +Formula *F_Or::copy(Formula *parent, Rel_Body *reln) { + F_Or *f = new F_Or(parent, reln); + for(List_Iterator c(children()); c; c++) + f->children().append((*c)->copy(f,reln)); + return f; +} + +Formula *F_Not::copy(Formula *parent, Rel_Body *reln) { + F_Not *f = new F_Not(parent, reln); + for(List_Iterator c(children()); c; c++) + f->children().append((*c)->copy(f,reln)); + return f; +} + +// +// Create F_Exists nodes below this F_Or. +// Copy list S to each of the created nodes. +// Push_exists takes responsibility for reusing or deleting Var_ID's; +// here we delete them. Must also empty out the Tuple when finished. +void F_Or::push_exists(Variable_ID_Tuple &S) { + List mc; + mc.join(children()); + + while(!mc.empty()) { + Formula *f = mc.remove_front(); + F_Exists *e = add_exists(); + + copy_var_decls(e->myLocals, S); + f->remap(); + reset_remap_field(S); + + e->add_child(f); + } + // Since these are not reused, they have to be deleted + for(Tuple_Iterator VI(S); VI; VI++) { + assert((*VI)->kind() == Exists_Var); + delete *VI; + } + S.clear(); +} + +void F_Exists::push_exists(Variable_ID_Tuple &S) { + myLocals.join(S); +} + +F_Not *Formula::add_not() { + assert_not_finalized(); + assert(can_add_child()); + F_Not *f = new F_Not(this, myRelation); + myChildren.append(f); + return f; +} + +F_And *Formula::add_and() { + assert_not_finalized(); + assert(can_add_child()); + F_And *f = new F_And(this, myRelation); + myChildren.append(f); + return f; +} + +F_And *Formula::and_with() { + return add_and(); +} + +F_Or *Formula::add_or() { + assert_not_finalized(); + assert(can_add_child()); + F_Or *f = new F_Or(this, myRelation); + myChildren.append(f); + return f; +} + +} // namespace diff --git a/omegalib/omega_lib/src/pres_print.cc b/omegalib/omega_lib/src/pres_print.cc new file mode 100644 index 0000000..4f2cd0d --- /dev/null +++ b/omegalib/omega_lib/src/pres_print.cc @@ -0,0 +1,908 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +namespace omega { + +//////////////////////////////////////// +// // +// Print functions. // +// // +//////////////////////////////////////// + +void Conjunct::reorder_for_print(bool reverseOrder, int first_pass_input, int first_pass_output, bool sort) { + Conjunct *C2 = copy_conj_same_relation(); + Variable_ID_Tuple newpos(0),wcvars(0),gvars(0); + +// We reorder the original Variable_ID's into the newpos list; later, we +// copy from their original column (using find_column) to the new one. + int n = mappedVars.size(); + int i; + // there may be more inp/outp vars than maxVars; must do dynamically + // skip_set_checks++; + Tuple input_used(myRelation->n_inp()); + Tuple output_used(myRelation->n_out()); + for(i=1; i<=myRelation->n_inp();i++) input_used[i] = false; + for(i=1; i<=myRelation->n_out();i++) output_used[i] = false; + for(i=1; i<=n;i++) { + if (mappedVars[i]->kind() == Input_Var) + input_used[mappedVars[i]->get_position()] = true; + else if (mappedVars[i]->kind() == Output_Var) + output_used[mappedVars[i]->get_position()] = true; + else if(mappedVars[i]->kind() == Global_Var) + gvars.append(mappedVars[i]); + } + + + if(sort) + for(i=1; i<=gvars.size();i++) + for(int j=1; j <= gvars.size(); j++) + if(gvars[j]->get_global_var()->base_name() + < gvars[j+1]->get_global_var()->base_name()) { + Variable_ID t = gvars[j]; gvars[j] = gvars[j+1]; gvars[j+1] = t; + } + + newpos.join(gvars); + + if(!reverseOrder) { + for(i=1; i<=min(myRelation->n_inp(),first_pass_input);i++) + if (input_used[i]) newpos.append(input_vars[i]); + for(i=1; i<=min(myRelation->n_out(),first_pass_output);i++) + if (output_used[i]) newpos.append(output_vars[i]); + for(i=max(1,first_pass_input+1); i<=myRelation->n_inp();i++) + if (input_used[i]) newpos.append(input_vars[i]); + for(i=max(1,first_pass_output+1); i<=myRelation->n_out();i++) + if (output_used[i]) newpos.append(output_vars[i]); + } + else { + for(i=1; i<=min(myRelation->n_out(),first_pass_output);i++) + if (output_used[i]) newpos.append(output_vars[i]); + for(i=1; i<=min(myRelation->n_inp(),first_pass_input);i++) + if (input_used[i]) newpos.append(input_vars[i]); + for(i=max(1,first_pass_output+1); i<=myRelation->n_out();i++) + if (output_used[i]) newpos.append(output_vars[i]); + for(i=max(1,first_pass_input+1); i<=myRelation->n_inp();i++) + if (input_used[i]) newpos.append(input_vars[i]); + } + + + for(i=1; i<=n;i++) + if (mappedVars[i]->kind() == Wildcard_Var) + wcvars.append(mappedVars[i]); + + if(sort) + for(i=1; i<=gvars.size();i++) + for(int j=1; j <= gvars.size(); j++) + if(gvars[j]->name() < gvars[j+1]->name()) { + Variable_ID t = gvars[j]; gvars[j] = gvars[j+1]; gvars[j+1] = t; + } + + newpos.join(wcvars); + + assert(problem->nVars == newpos.size()); // i.e. no other variable types + + // Copy coef columns into new order. Constant column is unchanged. + for(int e=0; enGEQs; e++) problem->GEQs[e].touched = 1; + + for(i=1; i<=problem->nVars; i++) { + int col = find_column(newpos[i]); // Find column in original conj. + assert(col != 0); + copy_column(problem, i, // Copy it from orig. column in the copy. + C2->problem, col, 0, 0); + problem->var[i] = i; + } + for(i=1; i<=problem->nVars; i++) + problem->forwardingAddress[i] = i; + + mappedVars = newpos; + delete C2; + // skip_set_checks--; +} + +void Rel_Body::print_with_subs(FILE *output_file, bool printSym, bool newline) { + std::string s = this->print_with_subs_to_string(printSym, newline); + fprintf(output_file, "%s", s.c_str()); +} + +void Rel_Body::print_with_subs() { + this->print_with_subs(stdout, 0, 1); +} + +static std::string tryToPrintVarToStringWithDiv(Conjunct *C, Variable_ID v) { + std::string s; + bool seen = false; +// This assumes that there is one EQ involving v, that v cannot be +// substituted and hence has a non-unit coefficient. + for(EQ_Iterator e(C); e; e++) { + if ((*e).get_coef(v) != 0) { + assert(!seen); // This asserts just one EQ with v + coef_t v_coef = (*e).get_coef(v); + int v_sign = v_coef > 0 ? 1 : -1; + v_coef *= v_sign; + int sign_adj = -v_sign; + + s += "intDiv("; + bool first=true; + for(Constr_Vars_Iter i(*e,false); i; i++) { + if ((*i).var != v && (*i).coef != 0) { + coef_t this_coef = sign_adj*(*i).coef; + if(!first && this_coef > 0) + s+= "+"; + if (this_coef == 1) + s += (*i).var->name(); + else if (this_coef == -1) { + s += "-"; s += (*i).var->name(); + } + else { + s += to_string(this_coef) + "*" + (*i).var->name(); + } + first = false; + } + } + coef_t the_const = (*e).get_const()* sign_adj; + if (the_const > 0 && !first) + s+= "+"; + if (the_const != 0) + s += to_string(the_const); + s += "," + to_string(v_coef) + ")"; + seen = true; + } + } + return s; +} + + +// This function prints the output tuple of a relation with each one as a +// function of the input variables. +// This will fail or look goofy if the outputs are not affine functions of +// the inputs. +// BIG WARNING: Call this only from the codegen stuff, since it assumes things +// about coefficients +std::string Rel_Body::print_outputs_with_subs_to_string() { + // Rel_Body S(this),Q(this); + Rel_Body *S = this->clone(); + Rel_Body *Q = this->clone(); + S->setup_names(); + Conjunct *C = S->single_conjunct(); + Conjunct *D = Q->single_conjunct(); // ordered_elimination futzes with conj + std::string s; // = "["; + C->reorder_for_print(); + C->ordered_elimination(S->global_decls()->length()); + // Print output names with substitutions in them + for(int i=1; i<=S->n_out(); i++) { + std::string t; + int col = C->find_column(output_vars[i]); + if (col != 0) + t = C->print_sub_to_string(col); + if (col == 0 || t == output_vars[i]->name()) // no sub found + // Assume you can't get a unit coefficient on v, must use div + t = tryToPrintVarToStringWithDiv(D, output_vars[i]); + s += t; + if (i < S->n_out()) s += ","; + } + // s += "] "; + delete S; + delete Q; + return s; +} + +std::string Rel_Body::print_outputs_with_subs_to_string(int i) { + // Rel_Body S(this),Q(this); + Rel_Body *S = this->clone(); + Rel_Body *Q = this->clone(); + S->setup_names(); + Conjunct *C = S->single_conjunct(); + Conjunct *D = Q->single_conjunct(); // ordered_elimination futzes with conj + std::string s; + C->reorder_for_print(); + C->ordered_elimination(S->global_decls()->length()); + // Print output names with substitutions in them + { + std::string t; + int col = C->find_column(output_vars[i]); + if (col != 0) + t = C->print_sub_to_string(col); + if (col == 0 || t == output_vars[i]->name()) // no sub found? + t = tryToPrintVarToStringWithDiv(D, output_vars[i]); + // should check for failure + s += t; + } + delete S; + delete Q; + return s; +} + +std::string Rel_Body::print_with_subs_to_string(bool printSym, bool newline) { + std::string s=""; + + if (pres_debug) { + fprintf(DebugFile,"print_with_subs_to_string:\n"); + prefix_print(DebugFile); + } + + int anythingPrinted = 0; + + if (this->is_null()) { + s = "NULL Rel_Body\n"; + return s; + } + + // Rel_Body R(this); + Rel_Body *R = this->clone(); + bool firstRelation = true; + + for(DNF_Iterator DI(R->query_DNF()); DI.live(); DI.next()) { + Rel_Body S(R, DI.curr()); + Conjunct *C = S.single_conjunct(); + if(!simplify_conj(C, true, 4, EQ_BLACK)) continue; + + S.setup_names(); + + if(! firstRelation) { + s += " union"; + if (newline) s += "\n "; + } + else + firstRelation = false; + + anythingPrinted = 1; + + C->reorder_for_print(false,C->max_ufs_arity_of_in(), + C->max_ufs_arity_of_out()); + C->ordered_elimination(S.Symbolic.length() + +C->max_ufs_arity_of_in() + +C->max_ufs_arity_of_out()); +// assert(C->problem->variablesInitialized); + + if (pres_debug) S.prefix_print(DebugFile); + + /* Do actual printing of Conjunct C as a relation */ + s += "{"; + + if (!Symbolic.empty()) { + if (printSym) s += "Sym=["; + for (Variable_ID_Iterator Sym_I = S.Symbolic; Sym_I;) + { + if (printSym) + s += (*Sym_I)->name(); + Sym_I++; + if (printSym && Sym_I) s+= ","; + } + if (printSym) s += "] "; + } + + int i, col; + + if (S.number_input != 0) { + s += "["; + // Print input names with substitutions in them + for(i=1; i<=S.number_input; i++) { + col = C->find_column(input_vars[i]); + if (col != 0) + s += C->problem->print_sub_to_string(col); + else + s += input_vars[i]->name(); + if (ifind_column(output_vars[i]); + if (col != 0) + s += C->problem->print_sub_to_string(col); + else + s += output_vars[i]->name(); + if (i < S.number_output) s += ","; + } + s += "] "; + } + + if (C->is_unknown()) { + if (S.number_input != 0 || S.number_output != 0) + s += ":"; + s += " UNKNOWN"; + } + else { + // Empty conj means TRUE, so don't print colon + if (C->problem->nEQs != 0 || C->problem->nGEQs != 0) { + C->problem->clearSubs(); + if (S.number_input != 0 || S.number_output != 0) + s += ":"; + s += " "; + s += C->print_to_string(false); + } + else { + if (S.number_input == 0 && S.number_output == 0) + s += " TRUE "; + } + } + + s += "}"; + } + + if (!anythingPrinted) { + R->setup_names(); + s = "{"; + s += R->print_variables_to_string(printSym); + if (R->number_input != 0 || R->number_output != 0) + s += " :"; + s += " FALSE }"; + if (newline) s += "\n"; + + delete R; + return s; + } + + if (newline) s += "\n"; + + delete R; + return s; +} + + +void print_var_addrs(std::string &s, Variable_ID v) { + if(pres_debug>=2) { + char ss[20]; + sprintf(ss, "(%p,%p)", v, v->remap); + s += ss; + } +} + +std::string Rel_Body::print_variables_to_string(bool printSym) { + std::string s=""; + + if (! Symbolic.empty()) { + if (printSym) s += " Sym=["; + for (Variable_ID_Iterator Sym_I(Symbolic); Sym_I; ) { + if (printSym) s += (*Sym_I)->name(); + print_var_addrs(s, *Sym_I); + Sym_I++; + if (printSym && Sym_I) s += ","; + } + if (printSym) s += "] "; + } + int i; + + if (number_input) { + s += "["; + for (i=1;i<=number_input;i++) { + s += input_vars[i]->name(); + print_var_addrs(s, input_vars[i]); + if(i < number_input) s += ","; + } + s += "] "; + } + + if (number_output) { + s += "-> ["; + for (i=1;i<=number_output;i++) { + s += output_vars[i]->name(); + print_var_addrs(s, output_vars[i]); + if(i < number_output) s += ","; + } + s += "] "; + } + + return s; +} + + +int F_Declaration::priority() { + return 3; +} + +int Formula::priority () { + return 0; +} + +int F_Or::priority() { + return 0; +} + +int F_And::priority() { + return 1; +} + +int Conjunct::priority() { + return 1; +} + +int F_Not::priority() { + return 2; +} + + +// +// print() functions +// +void Formula::print(FILE *output_file) { + if(myChildren.empty()) { + if(node_type()==Op_Relation || node_type()==Op_Or) + fprintf(output_file, "FALSE"); + else if(node_type()==Op_And) + fprintf(output_file, "TRUE"); + else { + assert(0); + } + } + + for(List_Iterator c(myChildren); c;) { + if (node_type() == Op_Exists || node_type() == Op_Forall + || (*c)->priority() < priority()) + fprintf(output_file, "( "); + (*c)->print(output_file); + if (node_type() == Op_Exists || node_type() == Op_Forall + || (*c)->priority() < priority()) + fprintf(output_file, " )"); + c++; + if(c.live()) + print_separator(output_file); + } +} + +std::string Rel_Body::print_formula_to_string() { + std::string s; + setup_names(); + for(DNF_Iterator DI(query_DNF()); DI.live();) { + + s += (*DI)->print_to_string(1); + DI.next(); + if (DI.live()) s += " && "; + if (pres_debug) fprintf(DebugFile,"Partial print to string: %s\n", + s.c_str()); + } + return s; +} + +void Rel_Body::print(FILE *output_file, bool printSym) { + if (this->is_null()) { + fprintf(output_file, "NULL Rel_Body\n"); + return; + } + + setup_names(); + + fprintf(output_file, "{"); + + std::string s = print_variables_to_string(printSym); + fprintf(output_file, "%s", s.c_str()); + + fprintf(output_file, ": "); + + if(simplified_DNF==NULL) { + Formula::print(output_file); + } + else { + assert(children().empty()); + simplified_DNF->print(output_file); + } + + fprintf(output_file, " }\n"); +} + +void Rel_Body::print() { + this->print(stdout); +} + +void F_Not::print(FILE *output_file) { + fprintf(output_file, " not "); + Formula::print(output_file); +} + +void F_And::print_separator(FILE *output_file) { + fprintf(output_file, " and "); +} + +void Conjunct::print(FILE *output_file) { + std::string s = print_to_string(true); + fprintf(output_file, "%s", s.c_str()); +} + +std::string Conjunct::print_to_string(int true_printed) { + std::string s=""; + + int num = myLocals.size(); + if(num) { + s += "exists ( "; + int i; + for (i = 1; i <= num; i++) { + Variable_ID v = myLocals[i]; + s += v->char_name(); + if(i < num) s += ","; + } + if (true_printed || !(is_true())) s += " : "; + } + + if(is_true()) { + s += true_printed ? "TRUE" : ""; + } + else { + if (is_unknown()) + s += "UNKNOWN"; + else { + s += problem->prettyPrintProblemToString(); + if (!exact) + s += " && UNKNOWN"; + } + } + + + if (num) s += ")"; + return s; +} + +void F_Or::print_separator(FILE *output_file) { + fprintf(output_file, " or "); +} + +void F_Declaration::print(FILE *output_file) { + std::string s=""; + for(Variable_ID_Iterator VI(myLocals); VI; ) { + s += (*VI)->name(); + VI++; + if(VI) s += ","; + } + fprintf(output_file, "( %s : ", s.c_str()); + Formula::print(output_file); + fprintf(output_file, ")"); +} + +void F_Forall::print(FILE *output_file) { + fprintf(output_file, "forall "); + F_Declaration::print(output_file); +} + +void F_Exists::print(FILE *output_file) { + fprintf(output_file, "exists "); + F_Declaration::print(output_file); +} + +void Formula::print_separator(FILE *) { + assert(0); // should never be called, it's only for derived classes +} + +// +// Setup names in formula. +// + +typedef Set g_set; +void Rel_Body::setup_names() { + int i; + + + if (use_ugly_names) return; + + if (pres_debug>=2) + fprintf(DebugFile,"Setting up names for 0x%p\n", this); + + for(i=1; i<=number_input; i++) { + input_vars[i]->base_name = In_Names[i]; + } + for(i=1; i<=number_output; i++) { + output_vars[i]->base_name = Out_Names[i]; + } + + g_set gbls; + + wildCardInstanceNumber = 0; + + for(i=1; i<= Symbolic.size(); i++) { + gbls.insert(Symbolic[i]->get_global_var()); + } + + foreach(g,Global_Var_ID,gbls, + g->instance = g->base_name()++); + + for(i=1; i<=number_input; i++) { + if (!input_vars[i]->base_name.null()) + input_vars[i]->instance = input_vars[i]->base_name++; + } + for(i=1; i<=number_output; i++) { + if (!output_vars[i]->base_name.null()) + output_vars[i]->instance = output_vars[i]->base_name++; + } + + if (simplified_DNF != NULL) // It is simplified + simplified_DNF->setup_names(); + else // not simplified + Formula::setup_names(); + + for(i=1; i<=number_output; i++) { + if (!output_vars[i]->base_name.null()) + output_vars[i]->base_name--; + } + for(i=1; i<=number_input; i++) { + if (!input_vars[i]->base_name.null()) + input_vars[i]->base_name--; + } + foreach(g,Global_Var_ID,gbls, g->base_name()--); +} + +void Formula::setup_names() { + if (pres_debug>=2) + fprintf(DebugFile,"Setting up names for formula 0x%p\n", this); + + for(List_Iterator c(myChildren); c; c++) + (*c)->setup_names(); +} + +void DNF::setup_names() { + if (pres_debug>=2) + fprintf(DebugFile,"Setting up names for DNF 0x%p\n", this); + + for(DNF_Iterator DI(this); DI.live(); DI.next()) + DI.curr()->setup_names(); +} + + +void F_Declaration::setup_names() { + if (pres_debug>=2) + fprintf(DebugFile,"Setting up names for Declaration 0x%p\n", this); + + // Allow re-use of wc names in other scopes + int savedWildCardInstanceNumber = wildCardInstanceNumber; + + for(Tuple_Iterator VI(myLocals); VI; VI++) { + Variable_ID v = *VI; + if (!v->base_name.null()) v->instance = v->base_name++; + else v->instance = wildCardInstanceNumber++; + } + + for(List_Iterator c(children()); c; c++) + (*c)->setup_names(); + + for(Tuple_Iterator VI2(myLocals); VI2; VI2++) { + Variable_ID v = *VI2; + if (!v->base_name.null()) v->base_name--; + } + wildCardInstanceNumber = savedWildCardInstanceNumber; +} + + +// +// Prefix_print functions. +// Print Formula Tree, used in debugging. +// +static int level = 0; + +void Formula::prefix_print(FILE *output_file, int debug) { + for(List_Iterator c(children()); c; c++) + (*c)->prefix_print(output_file, debug); + level--; +} + + +void Rel_Body::prefix_print() { + this->prefix_print(stdout, 1); +} + +void Rel_Body::prefix_print(FILE *output_file, int debug) { + int old_use_ugly_names = use_ugly_names; + use_ugly_names = 0; + + setup_names(); + + level = 0; + if(pres_debug>=2) fprintf(output_file, "(@%p)", this); + fprintf(output_file, is_set() ? "SET: " : "RELATION: "); + std::string s = print_variables_to_string(true); + fprintf(output_file, "%s\n", s.c_str()); + + if(simplified_DNF==NULL) { + Formula::prefix_print(output_file, debug); + } else { + assert(children().empty()); + simplified_DNF->prefix_print(output_file, debug, true); + } + fprintf(output_file, "\n"); + use_ugly_names = old_use_ugly_names; +} + + +void F_Forall::prefix_print(FILE *output_file, int debug) { + Formula::print_head(output_file); + fprintf(output_file, "forall ["); + F_Declaration::prefix_print(output_file, debug); + for (Variable_ID_Iterator VI(myLocals); VI; VI++) + assert((*VI)->kind() == Forall_Var); + +} + +void F_Exists::prefix_print(FILE *output_file, int debug) { + Formula::print_head(output_file); + if(pres_debug>=2) fprintf(output_file, "(@%p)", this); + fprintf(output_file, "exists ["); + F_Declaration::prefix_print(output_file, debug); + for (Variable_ID_Iterator VI(myLocals); VI; VI++) + assert((*VI)->kind() == Exists_Var); +} + +void F_Declaration::prefix_print(FILE *output_file, int debug) { + std::string s = ""; + for (Variable_ID_Iterator VI(myLocals); VI; ) { + s += (*VI)->name(); + print_var_addrs(s, *VI); + VI++; + if(VI) s += ","; + } + s += "]\n"; + fprintf(output_file, "%s", s.c_str()); + Formula::prefix_print(output_file, debug); +} + +void F_Or::prefix_print(FILE *output_file, int debug) { + Formula::print_head(output_file); + fprintf(output_file, "or\n"); + Formula::prefix_print(output_file, debug); +} + +void F_And::prefix_print(FILE *output_file, int debug) { + Formula::print_head(output_file); + fprintf(output_file, "and\n"); + Formula::prefix_print(output_file, debug); +} + +void F_Not::prefix_print(FILE *output_file, int debug) { + Formula::print_head(output_file); + fprintf(output_file, "not\n"); + Formula::prefix_print(output_file, debug); +} + +void Conjunct::prefix_print(FILE *output_file, int debug) { + static char dir_glyphs[] = { '-', '?', '+' }; + + if (debug) { + Formula::print_head(output_file); + if(pres_debug>=2) fprintf(output_file, "(@%p)", this); + fprintf(output_file, "%s CONJUNCT, ", exact ? "EXACT" : "INEXACT"); + if (simplified) fprintf(output_file, "simplified, "); + if (verified) fprintf(output_file, "verified, "); + if (possible_leading_0s != -1 && guaranteed_leading_0s != -1) + assert (guaranteed_leading_0s <= possible_leading_0s); + if (guaranteed_leading_0s != -1 && guaranteed_leading_0s == possible_leading_0s) + fprintf(output_file,"# leading 0's = %d,", possible_leading_0s); + else if (possible_leading_0s != -1 || guaranteed_leading_0s != -1) { + if (guaranteed_leading_0s != -1) + fprintf(output_file,"%d <= ",guaranteed_leading_0s); + fprintf(output_file,"#O's"); + if (possible_leading_0s != -1) + fprintf(output_file," <= %d",possible_leading_0s); + fprintf(output_file,", "); + } + if (dir_glyphs[leading_dir+1] != '?') + fprintf(output_file," first = %c, ", dir_glyphs[leading_dir+1]); + fprintf(output_file,"myLocals=["); + std::string s=""; + for (Variable_ID_Iterator VI(myLocals); VI; ) { + assert( (*VI)->kind() == Wildcard_Var); + s += (*VI)->name(); + print_var_addrs(s, *VI); + VI++; + if(VI) s += ","; + } + s += "] mappedVars=["; + for(Variable_ID_Iterator MVI(mappedVars); MVI; ) { + s += (*MVI)->name(); + print_var_addrs(s, *MVI); + MVI++; + if(MVI) s += ","; + } + fprintf(output_file, "%s]\n", s.c_str()); + } + else + level++; + + setOutputFile(output_file); + setPrintLevel(level+1); + problem->printProblem(debug); + setPrintLevel(0); + Formula::prefix_print(output_file, debug); +} + +void Formula::print_head(FILE *output_file) { + level++; + int i; + for(i=0; iprint(out_file); + p.next(); + if(p.live()) + fprintf(out_file, " or "); + } +} + +void DNF::prefix_print(FILE *out_file, int debug, bool parent_names_setup) { + wildCardInstanceNumber = 0; + Variable_ID_Tuple all_vars; + if(!use_ugly_names && !parent_names_setup) { + // We need to manually set up all of the input,output, and symbolic + // variables, since during simplification, a dnf's conjuncts may not + // be listed as part of a relation, or perhaps as part of different + // relations (?) (grr). + for(DNF_Iterator p0(this); p0.live(); p0.next()) { + for(Variable_Iterator vi((*p0)->mappedVars); vi; vi++) + if((*vi)->kind() != Wildcard_Var && all_vars.index(*vi) == 0) + all_vars.append(*vi); + (*p0)->setup_names(); + } + foreach(v,Variable_ID,all_vars, + if (!v->base_name.null()) v->instance = v->base_name++; + else v->instance = wildCardInstanceNumber++; + ); + } + + int i = 1; + level = 0; + for(DNF_Iterator p(this); p.live(); p.next(), i++) { + fprintf(out_file, "#%d ", i); + if(*p == NULL) + fprintf(out_file, "(NULL)\n"); + else + (*p)->prefix_print(out_file, debug); + } + + foreach(v,Variable_ID,all_vars,if (!v->base_name.null()) v->base_name--); + + fprintf(out_file, "\n"); +} + +std::string Constraint_Handle::print_to_string() const { + assert(0); + return "FOO"; +} + +std::string EQ_Handle::print_to_string() const { + relation()->setup_names(); + std::string s = c->print_EQ_to_string(e); + return s; +} + +std::string GEQ_Handle::print_to_string() const { + relation()->setup_names(); + std::string s = c->print_GEQ_to_string(e); + return s; +} + +std::string Constraint_Handle::print_term_to_string() const { + assert(0); + return "FOO"; +} + +std::string EQ_Handle::print_term_to_string() const { + relation()->setup_names(); + std::string s = c->print_EQ_term_to_string(e); + return s; +} + +std::string GEQ_Handle::print_term_to_string() const { + relation()->setup_names(); + std::string s = c->print_GEQ_term_to_string(e); + return s; +} + +} diff --git a/omegalib/omega_lib/src/pres_quant.cc b/omegalib/omega_lib/src/pres_quant.cc new file mode 100644 index 0000000..5483bad --- /dev/null +++ b/omegalib/omega_lib/src/pres_quant.cc @@ -0,0 +1,95 @@ +#include +#include + +namespace omega { + +F_Forall::F_Forall(Formula *p, Rel_Body *r): F_Declaration(p,r) { +} + +F_Exists::F_Exists(Formula *p, Rel_Body *r): F_Declaration(p,r) { +} + +F_Exists::F_Exists(Formula *p, Rel_Body *r, Variable_ID_Tuple &S): F_Declaration(p,r,S) { +} + + +Formula *F_Forall::copy(Formula *parent, Rel_Body *reln) { + F_Forall *f = new F_Forall(parent, reln); + copy_var_decls(f->myLocals, myLocals); + for(List_Iterator c(children()); c; c++) + f->children().append((*c)->copy(f,reln)); + reset_remap_field(myLocals); + return f; +} + +Formula *F_Exists::copy(Formula *parent, Rel_Body *reln) { + F_Exists *f = new F_Exists(parent, reln); + copy_var_decls(f->myLocals, myLocals); + for(List_Iterator c(children()); c; c++) + f->children().append((*c)->copy(f,reln)); + reset_remap_field(myLocals); + return f; +} + +Variable_ID F_Forall::declare(Const_String s) { + return do_declare(s, Forall_Var); +} + +Variable_ID F_Forall::declare() { + return do_declare(Const_String(), Forall_Var); +} + +Variable_ID F_Forall::declare(Variable_ID v) { + return do_declare(v->base_name, Forall_Var); +} + + +Variable_ID F_Exists::declare(Const_String s) { + return do_declare(s, Exists_Var); +} + +Variable_ID F_Exists::declare() { + return do_declare(Const_String(), Exists_Var); +} + +Variable_ID F_Exists::declare(Variable_ID v) { + return do_declare(v->base_name, Exists_Var); +} + +Conjunct *F_Forall::find_available_conjunct() { + return 0; +} + +Conjunct *F_Exists::find_available_conjunct() { + assert(children().length() == 1 || children().length() == 0); + if (children().length() == 0) + return 0; + else + return children().front()->find_available_conjunct(); +} + +F_Exists *Formula::add_exists() { + assert_not_finalized(); + assert(can_add_child()); + F_Exists *f = new F_Exists(this, myRelation); + myChildren.append(f); + return f; +} + +F_Exists *Formula::add_exists(Variable_ID_Tuple &S) { + assert_not_finalized(); + assert(can_add_child()); + F_Exists *f = new F_Exists(this, myRelation, S); + myChildren.append(f); + return f; +} + +F_Forall *Formula::add_forall() { + assert_not_finalized(); + assert(can_add_child()); + F_Forall *f = new F_Forall(this, myRelation); + myChildren.append(f); + return f; +} + +} // namespace diff --git a/omegalib/omega_lib/src/pres_rear.cc b/omegalib/omega_lib/src/pres_rear.cc new file mode 100644 index 0000000..508959d --- /dev/null +++ b/omegalib/omega_lib/src/pres_rear.cc @@ -0,0 +1,131 @@ +#include +#include +#include +#include + +namespace omega { + +///////////////////////// +// // +// Rearrange functions // +// // +///////////////////////// + +// +// Rules: +// ~ (f1 | f2 | ... | fn) = ~f1 & ~f2 & ... & fn +// ~ ~ f = f +// Forall v: f = ~ (Exists v: ~ f) +// Exists v: (f1 | ... | fn) = (Exists v: f1) | ... | (Exists v: fn) +// + +void Rel_Body::rearrange() { + assert(children().length()==1); + + skip_finalization_check++; + formula()->rearrange(); + skip_finalization_check--; + + if(pres_debug) { + fprintf(DebugFile, "\n=== Rearranged TREE ===\n"); + prefix_print(DebugFile); + } +} + +void Formula::rearrange() { + // copy list of children, as they may be removed as we work + List kiddies = myChildren; + + for(List_Iterator c(kiddies); c; c++) + (*c)->rearrange(); +} + +// +// Push nots down the tree until quantifier or conjunct, rearrange kids +// +void F_Not::rearrange() { + Formula *child = children().front(); + Formula *new_child, *f; + + switch(child->node_type()) { + case Op_Or: + parent().remove_child(this); + new_child = parent().add_and(); + while(!child->children().empty()) { + f = child->children().remove_front(); + F_Not *new_not = new_child->add_not(); + new_not->add_child(f); + } + delete this; + break; +//case Op_And: +// parent().remove_child(this); +// new_child = parent().add_or(); +// while(!child->myChildren.empty()) { +// f = child->myChildren.remove_front(); +// F_Not *new_not = new_child->add_not(); +// new_not->add_child(f); +// } +// delete this; +// break; + case Op_Not: + parent().remove_child(this); + f = child->children().remove_front(); + parent().add_child(f); + delete this; + f->rearrange(); + return; + default: + new_child = child; + break; + } + + new_child->rearrange(); +} + +// +// Convert a universal quantifier to "not exists not". +// Forall v: f = ~ (Exists v: ~ f) +// +void F_Forall::rearrange() { + Formula &p = parent(); + p.remove_child(this); + + F_Not *topnot = p.add_not(); + F_Exists *exist = topnot->add_exists(); + for (Variable_ID_Iterator VI(myLocals); VI; VI++) + (*VI)->set_kind(Exists_Var); + exist->myLocals.join(myLocals); + + F_Not *botnot = exist->add_not(); + Formula *f = children().remove_front(); + botnot->add_child(f); + + delete this; + + botnot->rearrange(); +} + +// +// Exists v: (f1 | ... | fn) = (Exists v: f1) | ... | (Exists v: fn) +// +void F_Exists::rearrange() { + Formula* child = children().front(); + switch(child->node_type()) { + case Op_Or: + case Op_Conjunct: + case Op_Exists: + child->push_exists(myLocals); + parent().remove_child(this); + parent().add_child(child); + children().remove_front(); + delete this; + break; + default: + break; + } + + child->rearrange(); +} + +} // namespace diff --git a/omegalib/omega_lib/src/pres_subs.cc b/omegalib/omega_lib/src/pres_subs.cc new file mode 100644 index 0000000..9854b09 --- /dev/null +++ b/omegalib/omega_lib/src/pres_subs.cc @@ -0,0 +1,131 @@ +#include + +namespace omega { + +Substitutions::Substitutions(Relation &input_R, Conjunct *input_c) { + int i; + r = new Relation(input_R,input_c); + c = r->single_conjunct(); + c->reorder_for_print(); + c->ordered_elimination(r->global_decls()->length()); + int num_subs = c->problem->nSUBs; + subs = new eqn[num_subs]; + for(i = 0; i < num_subs; i++) + subs[i] = SUBs[i]; + subbed_vars.reallocate(num_subs); + /* Go through and categorize variables as: + 1) substituted, 2) not substituted, 3) wildcard + Safevars number of variables were not able to be substituted. + nVars number of total variables, including wildcards. + nSUBs is the number of substitutions. + nSUBs + nVars == the number of variables that went in. + Then reset var and forwardingAddress arrays in the problem, + so that they will correctly refer to the reconstructed + mappedVars. */ + Variable_ID_Tuple unsubbed_vars(c->problem->safeVars); + for(i = 1; i <= c->mappedVars.size(); i++) + if(c->mappedVars[i]->kind() != Wildcard_Var) { + int addr = c->problem->forwardingAddress[i]; + assert(addr == c->find_column(c->mappedVars[i]) && addr != 0); + if(addr < 0) { + assert(-addr <= subbed_vars.size()); + subbed_vars[-addr] = c->mappedVars[i]; + } + else { + assert(addr <= unsubbed_vars.size()); + unsubbed_vars[addr] = c->mappedVars[i]; + } + } + else { + // Here we don't redeclare wildcards, just re-use them. + unsubbed_vars.append(c->mappedVars[i]); + } + assert(unsubbed_vars.size() + subbed_vars.size() == c->mappedVars.size()); + c->mappedVars = unsubbed_vars; /* These are the variables that remain */ + + for(int col = 1; col <= c->problem->nVars; col++) { + c->problem->var[col] = col; + c->problem->forwardingAddress[col] = col; + } +} + +Substitutions::~Substitutions() { + delete [] subs; + delete r; +} + +bool Substitutions::substituted(Variable_ID v) { + return (subbed_vars.index(v) > 0); +} + +Sub_Handle Substitutions::get_sub(Variable_ID v) { + assert(substituted(v) && "No substitution for variable"); + return Sub_Handle(this,subbed_vars.index(v)-1,v); +} + +bool Substitutions::sub_involves(Variable_ID v, Var_Kind kind) { + assert(substituted(v)); + for(Constr_Vars_Iter i = get_sub(v); i; i++) + if ((*i).var->kind() == kind) + return true; + return false; +} + + +//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + + +int Sub_Iterator::live() const { + return current <= last; +} + +void Sub_Iterator::operator++() { this->operator++(0); } + +void Sub_Iterator::operator++(int) { + current++; +} + +Sub_Handle Sub_Iterator::operator*() { + assert(s && current <= last && "Sub_Iterator::operator*: bad call"); + return Sub_Handle(s,current,s->subbed_vars[current+1]); +} + +Sub_Handle Sub_Iterator::operator*() const { + assert(s && current <= last && "Sub_Iterator::operator*: bad call"); + return Sub_Handle(s,current,s->subbed_vars[current+1]); +} + + +//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + + + +Sub_Handle::Sub_Handle(Substitutions *_s, int _e, Variable_ID _v) : +Constraint_Handle(_s->c,&(_s->subs),_e), v(_v) {} + +std::string Sub_Handle::print_to_string() const { + relation()->setup_names(); + return v->name() + " = " + this->print_term_to_string(); +} + +std::string Sub_Handle::print_term_to_string() const { + /* The horrible truth is that print_term_to_string is a member + function of Conjunct, (and then Problem below it) but uses + nothing from there but the names, so you can pass it a pointer to + an equation that isn't even part of the conjunct. */ + relation()->setup_names(); + return c->print_term_to_string(&((*eqns)[e])); +} + + +/* + String Sub_Handle::print_to_string() const { + return c->problem->print_EQ_to_string(&((*eqns)[e])); + } + + String Sub_Handle::print_term_to_string() const { + return c->print_term_to_string(&(*eqns[e])); + } +*/ + +} // namespace diff --git a/omegalib/omega_lib/src/pres_var.cc b/omegalib/omega_lib/src/pres_var.cc new file mode 100644 index 0000000..0ec406f --- /dev/null +++ b/omegalib/omega_lib/src/pres_var.cc @@ -0,0 +1,459 @@ +#include +#include +#include +#include + +namespace omega { + +int wildCardInstanceNumber; + +const int Global_Input_Output_Tuple::initial_allocation = 10; + +// Declare named Variable +Var_Decl::Var_Decl(Const_String name, Var_Kind vkind, int pos): + base_name(name), + instance(999), + remap(this), + var_kind(vkind), + position(pos), + global_var(NULL), + of((Argument_Tuple) 0) { + assert(((vkind==Input_Var || vkind==Output_Var) && pos>0) || pos==0); +} + +// Declare unnamed variable +Var_Decl::Var_Decl(Var_Kind vkind, int pos): + instance(999), + remap(this), + var_kind(vkind), + position(pos), + global_var(NULL), + of((Argument_Tuple) 0) { + assert(((vkind==Input_Var || vkind==Output_Var) && pos>0) || pos==0); +} + +// Copy variable declaration +Var_Decl::Var_Decl(Variable_ID v): + base_name(v->base_name), + instance(v->instance), + remap(this), + var_kind(v->var_kind), + position(v->position), + global_var(v->global_var), + of(v->of) { +} + +Var_Decl::Var_Decl(Const_String name, Global_Var_ID v): + base_name(name), + instance(999), + remap(this), + var_kind(Global_Var), + position(0), + global_var(v), + of((Argument_Tuple) 0) { + assert(v->arity() == 0); +} + +Var_Decl::Var_Decl(Const_String name, Global_Var_ID v, Argument_Tuple function_of): + base_name(name), + instance(999), + remap(this), + var_kind(Global_Var), + position(0), + global_var(v), + of(function_of) { +} + +int Var_Decl::get_position() { + assert((var_kind == Input_Var || var_kind == Output_Var) && "Var_Decl::get_position: bad var_kind"); + return(position); +} + +Global_Var_ID Var_Decl::get_global_var() { + assert(var_kind == Global_Var && "Var_Decl::get_global_var: bad var_kind"); + return(global_var); +} + +Argument_Tuple Var_Decl::function_of() { + assert(var_kind == Global_Var); + return(of); +} + + +Omega_Var *Global_Var_Decl::really_omega_var() { + assert(0); + return(NULL); +} + +Coef_Var_Decl *Global_Var_Decl::really_coef_var() { + assert(0); + return(NULL); +} + +// +// Variable name. +// + +const int N_greek_letters = 19; + +char greek_letters[19][10] = { + "alpha" , "beta" , "gamma" , "delta" , "tau" , "sigma" , "chi" , + "omega" , "pi" , "ni" , "Alpha" , "Beta" , "Gamma" , "Delta" , + "Tau" , "Sigma" , "Chi" , "Omega" , "Pi" +}; + +const int numBuffers = 50; +const int bufferSize = 90; +char nameBuffers[numBuffers][bufferSize]; +int nextBuffer = 0; + +int use_ugly_names = 0; + +const char *Var_Decl::char_name() { + char *s = nameBuffers[nextBuffer++]; + char *start = s; + if (nextBuffer >= numBuffers) nextBuffer = 0; + int primes; + + if (use_ugly_names) + primes = 0; + else + primes = instance; + + switch(var_kind) { + case Input_Var: + if (!use_ugly_names && !base_name.null()) + sprintf(s,"%s",(const char *)base_name); + else { + primes = 0; + sprintf(s,"In_%d",position); + } + break; + case Output_Var: + if (!use_ugly_names && !base_name.null()) + sprintf(s,"%s",(const char *)base_name); + else { + primes = 0; + sprintf(s,"Out_%d",position); + } + break; + case Global_Var: + assert(!base_name.null()); + if (use_ugly_names) + sprintf(s,"%s@%p",(const char *)base_name, this); + else { + sprintf(s,"%s",(const char *)base_name); + primes = get_global_var()->instance; + } + break; + default: + if (use_ugly_names) { + if (!base_name.null()) + sprintf(s,"%s@%p",(const char *)base_name, this); + else + sprintf(s,"?@%p", this); + } + else if (!base_name.null()) sprintf(s,"%s",(const char *)base_name); + else { + assert(instance < 999); + sprintf(s,"%s", + greek_letters[instance % N_greek_letters]); + primes = instance/N_greek_letters; + } + break; + } + + while (*s) s++; + int i; + assert(primes < 999); + for(i=1; i<= primes; i++) *s++ = '\''; + *s = '\0'; + if (var_kind == Global_Var) { + int a = get_global_var()->arity(); + if (a) { + if (use_ugly_names) { + static const char *arg_names[4] = { "???", "In", "Out", "In == Out" }; + sprintf(s, "(%s[1#%d])", arg_names[function_of()], a); + } + else { + int f_of = function_of(); + assert(f_of == Input_Tuple || f_of == Output_Tuple); + *s++ = '('; + for(i = 1;i<=a;i++) { + if (f_of == Input_Tuple) + sprintf(s,"%s",(const char *)input_vars[i]->char_name()); + else + sprintf(s,"%s",(const char *)output_vars[i]->char_name()); + while (*s) s++; + if (ikind()==Global_Var) { + new_vl[p] = v; + v->remap = v; + } + else { + new_vl[p] = new Var_Decl(vl[p]); + v->remap = new_vl[p]; + } + } +} + +// +// Name a variable. +// +void Var_Decl::name_variable(char *newname) { + base_name = newname; +} + + +static Const_String coef_var_name(int i, int v) { + char s[100]; + sprintf(s, "c_%d_%d", i, v); + return Const_String(s); +} + + +// +// Global variables stuff. +// +Global_Var_Decl::Global_Var_Decl(Const_String baseName): + loc_rep1(baseName, this, Input_Tuple), + loc_rep2(baseName, this, Output_Tuple) { +} + +Global_Kind Global_Var_Decl::kind() const { + assert(0); + return Coef_Var; +} + +Coef_Var_Decl::Coef_Var_Decl(int id, int var): + Global_Var_Decl(coef_var_name(id, var)) { + i = id; + v = var; +} + +Coef_Var_Decl *Coef_Var_Decl::really_coef_var() { + return this; +} + +int Coef_Var_Decl::stmt() const { + return i; +} + +int Coef_Var_Decl::var() const { + return v; +} + +Global_Kind Coef_Var_Decl::kind() const { + return Coef_Var; +} + +Free_Var_Decl::Free_Var_Decl(Const_String name): + Global_Var_Decl(name), _arity(0) { +} + +Free_Var_Decl::Free_Var_Decl(Const_String name, int arity): + Global_Var_Decl(name), _arity(arity) { +} + +int Free_Var_Decl::arity() const { + return _arity; +} + +Global_Kind Free_Var_Decl::kind() const { + return Free_Var; +} + + +// +// Delete variable from variable list. Does not preserve order +// +bool rm_variable(Variable_ID_Tuple &vl, Variable_ID v) { + int n = vl.size(); + int i; + for(i = 1; in) return 0; + vl[i] = vl[n]; + vl.delete_last(); + return 1; +} + + +// +// Destroy variable declarations. +// +void free_var_decls(Variable_ID_Tuple &c) { + for(Variable_ID_Iterator p = c; p; p++) { + Variable_ID v = *p; + if(v->kind()!=Global_Var) { + delete v; + } + } +} + + +Variable_ID input_var(int nth) { + assert(1 <= nth && nth <= input_vars.size()); + return input_vars[nth]; +} + +Variable_ID output_var(int nth) { + assert(1<= nth && nth <= output_vars.size()); + return output_vars[nth]; +} + +Variable_ID set_var(int nth) { + assert(1 <= nth && set_vars.size()); + return input_vars[nth]; +} + + +// +// Remap mappedVars in all conjuncts of formula. +// Uses the remap field of the Var_Decl. +// +void Formula::remap() { + for(List_Iterator c(children()); c; c++) + (*c)->remap(); +} + +void Conjunct::remap() { + for(Variable_Iterator VI(mappedVars); VI; VI++) { + Variable_ID v = *VI; + *VI = v->remap; + } + cols_ordered = false; +} + +// Function to reset the remap field of a Variable_ID +void reset_remap_field(Variable_ID v) { + v->remap = v; +} + +// Function to reset the remap fields of a Variable_ID_Seq +void reset_remap_field(Sequence &T) { + for(Any_Iterator VI(T.any_iterator()); VI; VI++) { + Variable_ID v = *VI; + v->remap = v; + } +} + +// Function to reset the remap fields of a Variable_ID_Tuple, +// more efficiently +void reset_remap_field(Variable_ID_Tuple &T) { + for(Variable_Iterator VI(T); VI; VI++) { + Variable_ID v = *VI; + v->remap = v; + } +} + +void reset_remap_field(Sequence &T, int var_no) { + int i=1; + for(Any_Iterator VI(T.any_iterator()); i <= var_no && VI; VI++) { + Variable_ID v = *VI; + v->remap = v; + i++; + } +} + +void reset_remap_field(Variable_ID_Tuple &T, int var_no) { + int i=1; + for(Variable_Iterator VI(T); i <= var_no && VI; VI++) { + Variable_ID v = *VI; + v->remap = v; + i++; + } +} + + +// Global input and output variable tuples. +// These Tuples must be initialized as more in/out vars are needed. +//Variable_ID_Tuple input_vars(0); +//Variable_ID_Tuple output_vars(0); +//Variable_ID_Tuple& set_vars = input_vars; +Global_Input_Output_Tuple input_vars(Input_Var); +Global_Input_Output_Tuple output_vars(Output_Var); +Global_Input_Output_Tuple &set_vars = input_vars; + +//////////////////////////////////////// +// // +// Variable and Declaration functions // +// // +//////////////////////////////////////// + +// +// Constructors and properties. +// + + +// Allocate ten variables initially. Most applications won't require more. +Global_Input_Output_Tuple::Global_Input_Output_Tuple(Var_Kind in_my_kind, int init): + my_kind(in_my_kind) { + for (int i=1; i<=(init == -1? initial_allocation: max(0,init)); i++) + this->append(new Var_Decl(Const_String(), my_kind, i)); +} + +Global_Input_Output_Tuple::~Global_Input_Output_Tuple() { + for (int i=1; i<=size(); i++) + delete data[i-1]; +} + +Variable_ID & Global_Input_Output_Tuple::operator[](int index) { + assert(index > 0); + while(size() < index) + this->append(new Var_Decl(Const_String(), my_kind, size()+1)); + return data[index-1]; +} + +const Variable_ID & Global_Input_Output_Tuple::operator[](int index) const { + assert(index > 0); + Global_Input_Output_Tuple *unconst_this = (Global_Input_Output_Tuple *) this; + while(size() < index) + unconst_this->append(new Var_Decl(Const_String(), my_kind, size()+1)); + return data[index-1]; +} + +Variable_ID Var_Decl::UF_owner() { + Variable_ID v = this; + while (v->remap != v) v = v->remap; + return v; +} + +void Var_Decl::UF_union(Variable_ID b) { + Variable_ID a = this; + while (a->remap != a) { + Variable_ID tmp = a->remap; + a->remap = tmp->remap; + a = tmp; + } + while (b->remap != a) { + Variable_ID tmp = b->remap; + b->remap = a; + b = tmp; + } +} + +} // namespace diff --git a/omegalib/omega_lib/src/reach.cc b/omegalib/omega_lib/src/reach.cc new file mode 100644 index 0000000..bde785c --- /dev/null +++ b/omegalib/omega_lib/src/reach.cc @@ -0,0 +1,211 @@ +#include +#include +#include +#include + +namespace omega { + +typedef Dynamic_Array1 Rel_Array1; +typedef Dynamic_Array2 Rel_Array2; + +// This is from parallelism.c, modified + +static void closure_rel(Rel_Array2 &trans, int i, int k, int j) { + Relation tik; + + if (trans[k][k].is_upper_bound_satisfiable()) { + Relation tkk = TransitiveClosure(copy(trans[k][k])); + tkk.simplify(2,4); + tik = Composition(tkk, copy(trans[i][k])); + tik.simplify(2,4); + tik = Union(copy(trans[i][k]), tik); + tik.simplify(2,4); + } + else { + tik = trans[i][k]; + } + Relation fresh; + Relation tkj = trans[k][j]; + fresh = Composition(tkj, tik); + fresh.simplify(2,4); + trans[i][j] = Union(trans[i][j], fresh); + trans[i][j].simplify(2,4); + +#if 0 + fprintf(DebugFile, "%d -> %d -> %d\n", i, k, j); + trans[i][j].print_with_subs(DebugFile); +#endif +} + + +static void close_rels(Rel_Array2 &trans,int n_nodes) { + for (int k=1; k<=n_nodes; k++) + for (int i=1; i<=n_nodes; i++) + if (trans[i][k].is_upper_bound_satisfiable()) + for (int j=1; j<=n_nodes; j++) + if (trans[k][j].is_upper_bound_satisfiable()) + closure_rel(trans, i, k, j); +} + + +void dump_rels(Rel_Array2 &a, reachable_information *reachable_info) { + int i,j; + int n_nodes = reachable_info->node_names.size(); + for(i = 1; i <= n_nodes; i++) + for(j = 1; j <= n_nodes; j++) { + fprintf(stderr,"t[%s][%s] = ", + (reachable_info->node_names[i]).c_str(), + (reachable_info->node_names[j]).c_str()); + a[i][j].print_with_subs(stderr); + } +} + + +void dump_sets(Rel_Array1 &a, reachable_information *reachable_info) { + int i; + int n_nodes = reachable_info->node_names.size(); + for(i = 1; i <= n_nodes; i++) { + fprintf(stderr,"r[%s] = ", (reachable_info->node_names[i]).c_str()); + a[i].print_with_subs(stderr); + } +} + + + +Rel_Array1 *Reachable_Nodes(reachable_information *reachable_info) { + Tuple &node_names = reachable_info->node_names; + Tuple &arity = reachable_info->node_arity; + Rel_Array2 &transitions = reachable_info->transitions; + Rel_Array1 &start_nodes = reachable_info->start_nodes; + + int n_nodes = node_names.size(),i,j; + +#define DUMP_INITIAL 1 +#define DUMP_CLOSED 1 + + if(DUMP_INITIAL && relation_debug){ + fprintf(stderr,"Initially:\n"); + dump_rels(transitions, reachable_info); + } + + close_rels(transitions,n_nodes); + + if(DUMP_CLOSED && relation_debug) { + fprintf(stderr,"Closed:\n"); + dump_rels(transitions, reachable_info); + } + + Rel_Array1 *finalp = + new Rel_Array1("node"); + Rel_Array1 &final = *finalp; + final.resize(n_nodes+1); + for (i=1; i<=n_nodes; i++) + final[i] = Relation::False(arity[i]); + + for(i = 1; i <= n_nodes; i++) + for(j = 1; j <= n_nodes; j++) + if(start_nodes[i].is_upper_bound_satisfiable()) + final[j] = Union(final[j], + Composition(copy(transitions[i][j]), + copy(start_nodes[i]))); + return finalp; +} + +static void compute_initially_reachable(Rel_Array1 &r, + Rel_Array1 &start_nodes, + Rel_Array2 &, + Rel_Array2 &closed, + Rel_Array1 &end_nodes, + int n_nodes, Tuple &arity){ + for(int n = 1; n <= n_nodes; n++) + r[n] = Relation::False(arity[n]); + + for(int i = 1; i <= n_nodes; i++) + for(int j = 1; j <= n_nodes; j++) + r[i] = Union(r[i], + Range(Restrict_Domain( + Restrict_Range(copy(closed[j][i]), + copy(end_nodes[i])), + copy(start_nodes[j])))); +} + + +static bool iterate(Rel_Array1 &r, Rel_Array2 &, Rel_Array2 &closed, + Rel_Array1 &, int n_nodes) { + bool changed; + + changed = false; + for(int j = 1; j <= n_nodes; j++) { + for(int i = 1; i <= n_nodes; i++) { + /* look for additional steps from interesting states */ + Relation new_rj = Range(Restrict_Domain(copy(closed[i][j]), + copy(r[i]))); + if(!Must_Be_Subset(copy(new_rj),copy(r[j]))) { + r[j] = Union(r[j],new_rj); + r[j].simplify(2,2); + changed = true; + } + } + } + return changed; +} + + + + +Rel_Array1 *I_Reachable_Nodes(reachable_information *reachable_info) { + bool changed; + + Tuple &node_names = reachable_info->node_names; + int n_nodes = node_names.size(); + Tuple &arity = reachable_info->node_arity; + Rel_Array2 &transitions = reachable_info->transitions; + Rel_Array1 &start_nodes = reachable_info->start_nodes; + Rel_Array2 closed("node number","node number"); + closed.resize(n_nodes+1,n_nodes+1); // abuse of dynamic arrays + Rel_Array1 *rp = new Rel_Array1("node number"); + Rel_Array1 &r = *rp; + r.resize(n_nodes+1); // abuse of dynamic arrays + + int i,j; + + Rel_Array1 end_nodes("Hi!"); + end_nodes.resize(n_nodes+1); // for future use + for(int n = 1; n <= n_nodes; n++) end_nodes[n] = Relation::True(arity[n]); + + for(j = 1; j <= n_nodes; j++) { + closed[j][j] = TransitiveClosure(copy(transitions[j][j])); + for(i = 1; i <= n_nodes; i++) + if (i != j) + closed[i][j] = transitions[i][j]; + } + + compute_initially_reachable(r,start_nodes,transitions,closed,end_nodes, + n_nodes,arity); + +#define DUMP_INITIAL 1 +#define DUMP_CLOSED 1 + + if(DUMP_INITIAL && relation_debug > 1) { + fprintf(stderr,"Closed:\n"); + dump_rels(closed, reachable_info); + } + if(DUMP_INITIAL && relation_debug) { + fprintf(stderr,"start nodes:\n"); + dump_sets(start_nodes, reachable_info); + fprintf(stderr,"Initially reachable:\n"); + dump_sets(r, reachable_info); + } + + changed = true; + int iterations = 0, max_iterations = 1000; + while(changed && iterations < max_iterations) { + changed = iterate(r,transitions,closed,start_nodes,n_nodes); + iterations++; + } + if(relation_debug) + fprintf(stdout,"[Iterations to convergence: %d]\n",iterations); + return rp; +} + +} // namespace diff --git a/omegatools.cc b/omegatools.cc deleted file mode 100644 index d88fd2a..0000000 --- a/omegatools.cc +++ /dev/null @@ -1,2312 +0,0 @@ -/***************************************************************************** - Copyright (C) 2008 University of Southern California - Copyright (C) 2009-2010 University of Utah - All Rights Reserved. - - Purpose: - Useful tools involving Omega manipulation. - - Notes: - - History: - 01/2006 Created by Chun Chen. - 03/2009 Upgrade Omega's interaction with compiler to IR_Code, by Chun Chen. -*****************************************************************************/ - -#include -// #include -#include "omegatools.hh" -#include "ir_code.hh" -#include "chill_error.hh" - -using namespace omega; - -namespace { - struct DependenceLevel { - Relation r; - int level; - int dir; // direction upto current level: - // -1:negative, 0: undetermined, 1: postive - std::vector lbounds; - std::vector ubounds; - DependenceLevel(const Relation &_r, int _dims): - r(_r), level(0), dir(0), lbounds(_dims), ubounds(_dims) {} - }; -} - - - - -std::string tmp_e() { - static int counter = 1; - return std::string("e")+to_string(counter++); -} - - - -//----------------------------------------------------------------------------- -// Convert expression tree to omega relation. "destroy" means shallow -// deallocation of "repr", not freeing the actual code inside. -// ----------------------------------------------------------------------------- -void exp2formula(IR_Code *ir, Relation &r, F_And *f_root, std::vector &freevars, - CG_outputRepr *repr, Variable_ID lhs, char side, IR_CONDITION_TYPE rel, bool destroy) { - -// void exp2formula(IR_Code *ir, Relation &r, F_And *f_root, std::vector &freevars, -// CG_outputRepr *repr, Variable_ID lhs, char side, char rel, bool destroy) { - - switch (ir->QueryExpOperation(repr)) { - case IR_OP_CONSTANT: - { - std::vector v = ir->QueryExpOperand(repr); - IR_ConstantRef *ref = static_cast(ir->Repr2Ref(v[0])); - if (!ref->is_integer()) - throw ir_exp_error("non-integer constant coefficient"); - - coef_t c = ref->integer(); - if (rel == IR_COND_GE || rel == IR_COND_GT) { - GEQ_Handle h = f_root->add_GEQ(); - h.update_coef(lhs, 1); - if (rel == IR_COND_GE) - h.update_const(-c); - else - h.update_const(-c-1); - } - else if (rel == IR_COND_LE || rel == IR_COND_LT) { - GEQ_Handle h = f_root->add_GEQ(); - h.update_coef(lhs, -1); - if (rel == IR_COND_LE) - h.update_const(c); - else - h.update_const(c-1); - } - else if (rel == IR_COND_EQ) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(lhs, 1); - h.update_const(-c); - } - else - throw std::invalid_argument("unsupported condition type"); - - delete v[0]; - delete ref; - if (destroy) - delete repr; - break; - } - case IR_OP_VARIABLE: - { - std::vector v = ir->QueryExpOperand(repr); - IR_ScalarRef *ref = static_cast(ir->Repr2Ref(v[0])); - - std::string s = ref->name(); - Variable_ID e = find_index(r, s, side); - - if (e == NULL) { // must be free variable - Free_Var_Decl *t = NULL; - for (unsigned i = 0; i < freevars.size(); i++) { - std::string ss = freevars[i]->base_name(); - if (s == ss) { - t = freevars[i]; - break; - } - } - - if (t == NULL) { - t = new Free_Var_Decl(s); - freevars.insert(freevars.end(), t); - } - - e = r.get_local(t); - } - - if (rel == IR_COND_GE || rel == IR_COND_GT) { - GEQ_Handle h = f_root->add_GEQ(); - h.update_coef(lhs, 1); - h.update_coef(e, -1); - if (rel == IR_COND_GT) - h.update_const(-1); - } - else if (rel == IR_COND_LE || rel == IR_COND_LT) { - GEQ_Handle h = f_root->add_GEQ(); - h.update_coef(lhs, -1); - h.update_coef(e, 1); - if (rel == IR_COND_LT) - h.update_const(-1); - } - else if (rel == IR_COND_EQ) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(lhs, 1); - h.update_coef(e, -1); - } - else - throw std::invalid_argument("unsupported condition type"); - - // delete v[0]; - delete ref; - if (destroy) - delete repr; - break; - } - case IR_OP_ASSIGNMENT: - { - std::vector v = ir->QueryExpOperand(repr); - exp2formula(ir, r, f_root, freevars, v[0], lhs, side, rel, true); - if (destroy) - delete repr; - break; - } - case IR_OP_PLUS: - { - F_Exists *f_exists = f_root->add_exists(); - Variable_ID e1 = f_exists->declare(tmp_e()); - Variable_ID e2 = f_exists->declare(tmp_e()); - F_And *f_and = f_exists->add_and(); - - if (rel == IR_COND_GE || rel == IR_COND_GT) { - GEQ_Handle h = f_and->add_GEQ(); - h.update_coef(lhs, 1); - h.update_coef(e1, -1); - h.update_coef(e2, -1); - if (rel == IR_COND_GT) - h.update_const(-1); - } - else if (rel == IR_COND_LE || rel == IR_COND_LT) { - GEQ_Handle h = f_and->add_GEQ(); - h.update_coef(lhs, -1); - h.update_coef(e1, 1); - h.update_coef(e2, 1); - if (rel == IR_COND_LT) - h.update_const(-1); - } - else if (rel == IR_COND_EQ) { - EQ_Handle h = f_and->add_EQ(); - h.update_coef(lhs, 1); - h.update_coef(e1, -1); - h.update_coef(e2, -1); - } - else - throw std::invalid_argument("unsupported condition type"); - - std::vector v = ir->QueryExpOperand(repr); - exp2formula(ir, r, f_and, freevars, v[0], e1, side, IR_COND_EQ, true); - exp2formula(ir, r, f_and, freevars, v[1], e2, side, IR_COND_EQ, true); - if (destroy) - delete repr; - break; - } - case IR_OP_MINUS: - { - F_Exists *f_exists = f_root->add_exists(); - Variable_ID e1 = f_exists->declare(tmp_e()); - Variable_ID e2 = f_exists->declare(tmp_e()); - F_And *f_and = f_exists->add_and(); - - if (rel == IR_COND_GE || rel == IR_COND_GT) { - GEQ_Handle h = f_and->add_GEQ(); - h.update_coef(lhs, 1); - h.update_coef(e1, -1); - h.update_coef(e2, 1); - if (rel == IR_COND_GT) - h.update_const(-1); - } - else if (rel == IR_COND_LE || rel == IR_COND_LT) { - GEQ_Handle h = f_and->add_GEQ(); - h.update_coef(lhs, -1); - h.update_coef(e1, 1); - h.update_coef(e2, -1); - if (rel == IR_COND_LT) - h.update_const(-1); - } - else if (rel == IR_COND_EQ) { - EQ_Handle h = f_and->add_EQ(); - h.update_coef(lhs, 1); - h.update_coef(e1, -1); - h.update_coef(e2, 1); - } - else - throw std::invalid_argument("unsupported condition type"); - - std::vector v = ir->QueryExpOperand(repr); - exp2formula(ir, r, f_and, freevars, v[0], e1, side, IR_COND_EQ, true); - exp2formula(ir, r, f_and, freevars, v[1], e2, side, IR_COND_EQ, true); - if (destroy) - delete repr; - break; - } - case IR_OP_MULTIPLY: - { - std::vector v = ir->QueryExpOperand(repr); - - coef_t coef; - CG_outputRepr *term; - if (ir->QueryExpOperation(v[0]) == IR_OP_CONSTANT) { - IR_ConstantRef *ref = static_cast(ir->Repr2Ref(v[0])); - coef = ref->integer(); - delete v[0]; - delete ref; - term = v[1]; - } - else if (ir->QueryExpOperation(v[1]) == IR_OP_CONSTANT) { - IR_ConstantRef *ref = static_cast(ir->Repr2Ref(v[1])); - coef = ref->integer(); - delete v[1]; - delete ref; - term = v[0]; - } - else - throw ir_exp_error("not presburger expression"); - - F_Exists *f_exists = f_root->add_exists(); - Variable_ID e = f_exists->declare(tmp_e()); - F_And *f_and = f_exists->add_and(); - - if (rel == IR_COND_GE || rel == IR_COND_GT) { - GEQ_Handle h = f_and->add_GEQ(); - h.update_coef(lhs, 1); - h.update_coef(e, -coef); - if (rel == IR_COND_GT) - h.update_const(-1); - } - else if (rel == IR_COND_LE || rel == IR_COND_LT) { - GEQ_Handle h = f_and->add_GEQ(); - h.update_coef(lhs, -1); - h.update_coef(e, coef); - if (rel == IR_COND_LT) - h.update_const(-1); - } - else if (rel == IR_COND_EQ) { - EQ_Handle h = f_and->add_EQ(); - h.update_coef(lhs, 1); - h.update_coef(e, -coef); - } - else - throw std::invalid_argument("unsupported condition type"); - - exp2formula(ir, r, f_and, freevars, term, e, side, IR_COND_EQ, true); - if (destroy) - delete repr; - break; - } - case IR_OP_DIVIDE: - { - std::vector v = ir->QueryExpOperand(repr); - - assert(ir->QueryExpOperation(v[1]) == IR_OP_CONSTANT); - IR_ConstantRef *ref = static_cast(ir->Repr2Ref(v[1])); - coef_t coef = ref->integer(); - delete v[1]; - delete ref; - - F_Exists *f_exists = f_root->add_exists(); - Variable_ID e = f_exists->declare(tmp_e()); - F_And *f_and = f_exists->add_and(); - - if (rel == IR_COND_GE || rel == IR_COND_GT) { - GEQ_Handle h = f_and->add_GEQ(); - h.update_coef(lhs, coef); - h.update_coef(e, -1); - if (rel == IR_COND_GT) - h.update_const(-1); - } - else if (rel == IR_COND_LE || rel == IR_COND_LT) { - GEQ_Handle h = f_and->add_GEQ(); - h.update_coef(lhs, -coef); - h.update_coef(e, 1); - if (rel == IR_COND_LT) - h.update_const(-1); - } - else if (rel == IR_COND_EQ) { - EQ_Handle h = f_and->add_EQ(); - h.update_coef(lhs, coef); - h.update_coef(e, -1); - } - else - throw std::invalid_argument("unsupported condition type"); - - exp2formula(ir, r, f_and, freevars, v[0], e, side, IR_COND_EQ, true); - if (destroy) - delete repr; - break; - } - case IR_OP_POSITIVE: - { - std::vector v = ir->QueryExpOperand(repr); - - exp2formula(ir, r, f_root, freevars, v[0], lhs, side, rel, true); - if (destroy) - delete repr; - break; - } - case IR_OP_NEGATIVE: - { - std::vector v = ir->QueryExpOperand(repr); - - F_Exists *f_exists = f_root->add_exists(); - Variable_ID e = f_exists->declare(tmp_e()); - F_And *f_and = f_exists->add_and(); - - if (rel == IR_COND_GE || rel == IR_COND_GT) { - GEQ_Handle h = f_and->add_GEQ(); - h.update_coef(lhs, 1); - h.update_coef(e, 1); - if (rel == IR_COND_GT) - h.update_const(-1); - } - else if (rel == IR_COND_LE || rel == IR_COND_LT) { - GEQ_Handle h = f_and->add_GEQ(); - h.update_coef(lhs, -1); - h.update_coef(e, -1); - if (rel == IR_COND_LT) - h.update_const(-1); - } - else if (rel == IR_COND_EQ) { - EQ_Handle h = f_and->add_EQ(); - h.update_coef(lhs, 1); - h.update_coef(e, 1); - } - else - throw std::invalid_argument("unsupported condition type"); - - exp2formula(ir, r, f_and, freevars, v[0], e, side, IR_COND_EQ, true); - if (destroy) - delete repr; - break; - } - case IR_OP_MIN: - { - std::vector v = ir->QueryExpOperand(repr); - - F_Exists *f_exists = f_root->add_exists(); - - if (rel == IR_COND_GE || rel == IR_COND_GT) { - F_Or *f_or = f_exists->add_and()->add_or(); - for (int i = 0; i < v.size(); i++) { - Variable_ID e = f_exists->declare(tmp_e()); - F_And *f_and = f_or->add_and(); - GEQ_Handle h = f_and->add_GEQ(); - h.update_coef(lhs, 1); - h.update_coef(e, -1); - if (rel == IR_COND_GT) - h.update_const(-1); - - exp2formula(ir, r, f_and, freevars, v[i], e, side, IR_COND_EQ, true); - } - } - else if (rel == IR_COND_LE || rel == IR_COND_LT) { - F_And *f_and = f_exists->add_and(); - for (int i = 0; i < v.size(); i++) { - Variable_ID e = f_exists->declare(tmp_e()); - GEQ_Handle h = f_and->add_GEQ(); - h.update_coef(lhs, -1); - h.update_coef(e, 1); - if (rel == IR_COND_LT) - h.update_const(-1); - - exp2formula(ir, r, f_and, freevars, v[i], e, side, IR_COND_EQ, true); - } - } - else if (rel == IR_COND_EQ) { - F_Or *f_or = f_exists->add_and()->add_or(); - for (int i = 0; i < v.size(); i++) { - Variable_ID e = f_exists->declare(tmp_e()); - F_And *f_and = f_or->add_and(); - - EQ_Handle h = f_and->add_EQ(); - h.update_coef(lhs, 1); - h.update_coef(e, -1); - - exp2formula(ir, r, f_and, freevars, v[i], e, side, IR_COND_EQ, false); - - for (int j = 0; j < v.size(); j++) - if (j != i) { - Variable_ID e2 = f_exists->declare(tmp_e()); - GEQ_Handle h2 = f_and->add_GEQ(); - h2.update_coef(e, -1); - h2.update_coef(e2, 1); - - exp2formula(ir, r, f_and, freevars, v[j], e2, side, IR_COND_EQ, false); - } - } - - for (int i = 0; i < v.size(); i++) - delete v[i]; - } - else - throw std::invalid_argument("unsupported condition type"); - - if (destroy) - delete repr; - } - case IR_OP_MAX: - { - std::vector v = ir->QueryExpOperand(repr); - - F_Exists *f_exists = f_root->add_exists(); - - if (rel == IR_COND_LE || rel == IR_COND_LT) { - F_Or *f_or = f_exists->add_and()->add_or(); - for (int i = 0; i < v.size(); i++) { - Variable_ID e = f_exists->declare(tmp_e()); - F_And *f_and = f_or->add_and(); - GEQ_Handle h = f_and->add_GEQ(); - h.update_coef(lhs, -1); - h.update_coef(e, 1); - if (rel == IR_COND_LT) - h.update_const(-1); - - exp2formula(ir, r, f_and, freevars, v[i], e, side, IR_COND_EQ, true); - } - } - else if (rel == IR_COND_GE || rel == IR_COND_GT) { - F_And *f_and = f_exists->add_and(); - for (int i = 0; i < v.size(); i++) { - Variable_ID e = f_exists->declare(tmp_e()); - GEQ_Handle h = f_and->add_GEQ(); - h.update_coef(lhs, 1); - h.update_coef(e, -1); - if (rel == IR_COND_GT) - h.update_const(-1); - - exp2formula(ir, r, f_and, freevars, v[i], e, side, IR_COND_EQ, true); - } - } - else if (rel == IR_COND_EQ) { - F_Or *f_or = f_exists->add_and()->add_or(); - for (int i = 0; i < v.size(); i++) { - Variable_ID e = f_exists->declare(tmp_e()); - F_And *f_and = f_or->add_and(); - - EQ_Handle h = f_and->add_EQ(); - h.update_coef(lhs, 1); - h.update_coef(e, -1); - - exp2formula(ir, r, f_and, freevars, v[i], e, side, IR_COND_EQ, false); - - for (int j = 0; j < v.size(); j++) - if (j != i) { - Variable_ID e2 = f_exists->declare(tmp_e()); - GEQ_Handle h2 = f_and->add_GEQ(); - h2.update_coef(e, 1); - h2.update_coef(e2, -1); - - exp2formula(ir, r, f_and, freevars, v[j], e2, side, IR_COND_EQ, false); - } - } - - for (int i = 0; i < v.size(); i++) - delete v[i]; - } - else - throw std::invalid_argument("unsupported condition type"); - - if (destroy) - delete repr; - } - case IR_OP_NULL: - break; - default: - throw ir_exp_error("unsupported operand type"); - } -} - - -//----------------------------------------------------------------------------- -// Build dependence relation for two array references. -// ----------------------------------------------------------------------------- -Relation arrays2relation(IR_Code *ir, std::vector &freevars, - const IR_ArrayRef *ref_src, const Relation &IS_w, - const IR_ArrayRef *ref_dst, const Relation &IS_r) { - Relation &IS1 = const_cast(IS_w); - Relation &IS2 = const_cast(IS_r); - - Relation r(IS1.n_set(), IS2.n_set()); - - for (int i = 1; i <= IS1.n_set(); i++) - r.name_input_var(i, IS1.set_var(i)->name()); - - for (int i = 1; i <= IS2.n_set(); i++) - r.name_output_var(i, IS2.set_var(i)->name()+"'"); - - IR_Symbol *sym_src = ref_src->symbol(); - IR_Symbol *sym_dst = ref_dst->symbol(); - if (*sym_src != *sym_dst) { - r.add_or(); // False Relation - delete sym_src; - delete sym_dst; - return r; - } - else { - delete sym_src; - delete sym_dst; - } - - F_And *f_root = r.add_and(); - - for (int i = 0; i < ref_src->n_dim(); i++) { - F_Exists *f_exists = f_root->add_exists(); - Variable_ID e1 = f_exists->declare(tmp_e()); - Variable_ID e2 = f_exists->declare(tmp_e()); - F_And *f_and = f_exists->add_and(); - - CG_outputRepr *repr_src = ref_src->index(i); - CG_outputRepr *repr_dst = ref_dst->index(i); - - bool has_complex_formula = false; - try { - exp2formula(ir, r, f_and, freevars, repr_src, e1, 'w', IR_COND_EQ, false); - exp2formula(ir, r, f_and, freevars, repr_dst, e2, 'r', IR_COND_EQ, false); - } - catch (const ir_exp_error &e) { - has_complex_formula = true; - } - - if (!has_complex_formula) { - EQ_Handle h = f_and->add_EQ(); - h.update_coef(e1, 1); - h.update_coef(e2, -1); - } - - repr_src->clear(); - repr_dst->clear(); - delete repr_src; - delete repr_dst; - } - - // add iteration space restriction - r = Restrict_Domain(r, copy(IS1)); - r = Restrict_Range(r, copy(IS2)); - - // reset the output variable names lost in restriction - for (int i = 1; i <= IS2.n_set(); i++) - r.name_output_var(i, IS2.set_var(i)->name()+"'"); - - return r; -} - - -//----------------------------------------------------------------------------- -// Convert array dependence relation into set of dependence vectors, assuming -// ref_w is lexicographically before ref_r in the source code. -// ----------------------------------------------------------------------------- -std::pair, std::vector > relation2dependences (const IR_ArrayRef *ref_src, const IR_ArrayRef *ref_dst, const Relation &r) { - assert(r.n_inp() == r.n_out()); - - std::vector dependences1, dependences2; - std::stack working; - working.push(DependenceLevel(r, r.n_inp())); - - while (!working.empty()) { - DependenceLevel dep = working.top(); - working.pop(); - - // No dependence exists, move on. - if (!dep.r.is_satisfiable()) - continue; - - if (dep.level == r.n_inp()) { - DependenceVector dv; - - // for loop independent dependence, use lexical order to - // determine the correct source and destination - if (dep.dir == 0) { - if (*ref_src == *ref_dst) - continue; // trivial self zero-dependence - - if (ref_src->is_write()) { - if (ref_dst->is_write()) - dv.type = DEP_W2W; - else - dv.type = DEP_W2R; - } - else { - if (ref_dst->is_write()) - dv.type = DEP_R2W; - else - dv.type = DEP_R2R; - } - - } - else if (dep.dir == 1) { - if (ref_src->is_write()) { - if (ref_dst->is_write()) - dv.type = DEP_W2W; - else - dv.type = DEP_W2R; - } - else { - if (ref_dst->is_write()) - dv.type = DEP_R2W; - else - dv.type = DEP_R2R; - } - } - else { // dep.dir == -1 - if (ref_dst->is_write()) { - if (ref_src->is_write()) - dv.type = DEP_W2W; - else - dv.type = DEP_W2R; - } - else { - if (ref_src->is_write()) - dv.type = DEP_R2W; - else - dv.type = DEP_R2R; - } - } - - dv.lbounds = dep.lbounds; - dv.ubounds = dep.ubounds; - dv.sym = ref_src->symbol(); - - if (dep.dir == 0 || dep.dir == 1) - dependences1.push_back(dv); - else - dependences2.push_back(dv); - } - else { - // now work on the next dimension level - int level = ++dep.level; - - coef_t lbound, ubound; - Relation delta = Deltas(copy(dep.r)); - delta.query_variable_bounds(delta.set_var(level), lbound, ubound); - - if (dep.dir == 0) { - if (lbound > 0) { - dep.dir = 1; - dep.lbounds[level-1] = lbound; - dep.ubounds[level-1] = ubound; - - working.push(dep); - } - else if (ubound < 0) { - dep.dir = -1; - dep.lbounds[level-1] = -ubound; - dep.ubounds[level-1] = -lbound; - - working.push(dep); - } - else { - // split the dependence vector into flow- and anti-dependence - // for the first non-zero distance, also separate zero distance - // at this level. - { - DependenceLevel dep2 = dep; - - dep2.lbounds[level-1] = 0; - dep2.ubounds[level-1] = 0; - - F_And *f_root = dep2.r.and_with_and(); - EQ_Handle h = f_root->add_EQ(); - h.update_coef(dep2.r.input_var(level), 1); - h.update_coef(dep2.r.output_var(level), -1); - - working.push(dep2); - } - - if (lbound < 0 && *ref_src != *ref_dst) { - DependenceLevel dep2 = dep; - - F_And *f_root = dep2.r.and_with_and(); - GEQ_Handle h = f_root->add_GEQ(); - h.update_coef(dep2.r.input_var(level), 1); - h.update_coef(dep2.r.output_var(level), -1); - h.update_const(-1); - - // get tighter bounds under new constraints - coef_t lbound, ubound; - delta = Deltas(copy(dep2.r)); - delta.query_variable_bounds(delta.set_var(level), - lbound, ubound); - - dep2.dir = -1; - dep2.lbounds[level-1] = max(-ubound,static_cast(1)); // use max() to avoid Omega retardness - dep2.ubounds[level-1] = -lbound; - - working.push(dep2); - } - - if (ubound > 0) { - DependenceLevel dep2 = dep; - - F_And *f_root = dep2.r.and_with_and(); - GEQ_Handle h = f_root->add_GEQ(); - h.update_coef(dep2.r.input_var(level), -1); - h.update_coef(dep2.r.output_var(level), 1); - h.update_const(-1); - - // get tighter bonds under new constraints - coef_t lbound, ubound; - delta = Deltas(copy(dep2.r)); - delta.query_variable_bounds(delta.set_var(level), - lbound, ubound); - dep2.dir = 1; - dep2.lbounds[level-1] = max(lbound,static_cast(1)); // use max() to avoid Omega retardness - dep2.ubounds[level-1] = ubound; - - working.push(dep2); - } - } - } - // now deal with dependence vector with known direction - // determined at previous levels - else { - // For messy bounds, further test to see if the dependence distance - // can be reduced to positive/negative. This is an omega hack. - if (lbound == negInfinity && ubound == posInfinity) { - { - Relation t = dep.r; - F_And *f_root = t.and_with_and(); - GEQ_Handle h = f_root->add_GEQ(); - h.update_coef(t.input_var(level), 1); - h.update_coef(t.output_var(level), -1); - h.update_const(-1); - - if (!t.is_satisfiable()) { - lbound = 0; - } - } - { - Relation t = dep.r; - F_And *f_root = t.and_with_and(); - GEQ_Handle h = f_root->add_GEQ(); - h.update_coef(t.input_var(level), -1); - h.update_coef(t.output_var(level), 1); - h.update_const(-1); - - if (!t.is_satisfiable()) { - ubound = 0; - } - } - } - - // Same thing as above, test to see if zero dependence - // distance possible. - if (lbound == 0 || ubound == 0) { - Relation t = dep.r; - F_And *f_root = t.and_with_and(); - EQ_Handle h = f_root->add_EQ(); - h.update_coef(t.input_var(level), 1); - h.update_coef(t.output_var(level), -1); - - if (!t.is_satisfiable()) { - if (lbound == 0) - lbound = 1; - if (ubound == 0) - ubound = -1; - } - } - - if (dep.dir == -1) { - dep.lbounds[level-1] = -ubound; - dep.ubounds[level-1] = -lbound; - } - else { // dep.dir == 1 - dep.lbounds[level-1] = lbound; - dep.ubounds[level-1] = ubound; - } - - working.push(dep); - } - } - } - - return std::make_pair(dependences1, dependences2); -} - - -//----------------------------------------------------------------------------- -// Convert a boolean expression to omega relation. "destroy" means shallow -// deallocation of "repr", not freeing the actual code inside. -//----------------------------------------------------------------------------- -void exp2constraint(IR_Code *ir, Relation &r, F_And *f_root, - std::vector &freevars, - CG_outputRepr *repr, bool destroy) { - IR_CONDITION_TYPE cond = ir->QueryBooleanExpOperation(repr); - switch (cond) { - case IR_COND_LT: - case IR_COND_LE: - case IR_COND_EQ: - case IR_COND_GT: - case IR_COND_GE: { - F_Exists *f_exist = f_root->add_exists(); - Variable_ID e = f_exist->declare(); - F_And *f_and = f_exist->add_and(); - std::vector op = ir->QueryExpOperand(repr); - exp2formula(ir, r, f_and, freevars, op[0], e, 's', IR_COND_EQ, true); - exp2formula(ir, r, f_and, freevars, op[1], e, 's', cond, true); - if (destroy) - delete repr; - break; - } - case IR_COND_NE: { - F_Exists *f_exist = f_root->add_exists(); - Variable_ID e = f_exist->declare(); - F_Or *f_or = f_exist->add_or(); - F_And *f_and = f_or->add_and(); - std::vector op = ir->QueryExpOperand(repr); - exp2formula(ir, r, f_and, freevars, op[0], e, 's', IR_COND_EQ, false); - exp2formula(ir, r, f_and, freevars, op[1], e, 's', IR_COND_GT, false); - - f_and = f_or->add_and(); - exp2formula(ir, r, f_and, freevars, op[0], e, 's', IR_COND_EQ, true); - exp2formula(ir, r, f_and, freevars, op[1], e, 's', IR_COND_LT, true); - - if (destroy) - delete repr; - break; - } - default: - throw ir_exp_error("unrecognized conditional expression"); - } -} - - - - - -// inline void exp2formula(IR_Code *ir, Relation &r, F_And *f_root, -// std::vector &freevars, -// const CG_outputRepr *repr, Variable_ID lhs, char side, char rel) { -// exp2formula(ir, r, f_root, freevars, const_cast(repr), lhs, side, rel, false); -// } - - - - - - - -//----------------------------------------------------------------------------- -// Convert suif expression tree to omega relation. -//----------------------------------------------------------------------------- - -// void suif2formula(Relation &r, F_And *f_root, -// std::vector &freevars, -// operand op, Variable_ID lhs, -// char side, char rel) { -// if (op.is_immed()) { -// immed im = op.immediate(); - -// if (im.is_integer()) { -// int c = im.integer(); - -// if (rel == '>') { -// GEQ_Handle h = f_root->add_GEQ(); -// h.update_coef(lhs, 1); -// h.update_const(-1*c); -// } -// else if (rel == '<') { -// GEQ_Handle h = f_root->add_GEQ(); -// h.update_coef(lhs, -1); -// h.update_const(c); -// } -// else { // '=' -// EQ_Handle h = f_root->add_EQ(); -// h.update_coef(lhs, 1); -// h.update_const(-1*c); -// } -// } -// else { -// return; //add Function in the future -// } -// } -// else if (op.is_symbol()) { -// String s = op.symbol()->name(); -// Variable_ID e = find_index(r, s, side); - -// if (e == NULL) { // must be free variable -// Free_Var_Decl *t = NULL; -// for (unsigned i = 0; i < freevars.size(); i++) { -// String ss = freevars[i]->base_name(); -// if (s == ss) { -// t = freevars[i]; -// break; -// } -// } - -// if (t == NULL) { -// t = new Free_Var_Decl(s); -// freevars.insert(freevars.end(), t); -// } - -// e = r.get_local(t); -// } - -// if (rel == '>') { -// GEQ_Handle h = f_root->add_GEQ(); -// h.update_coef(lhs, 1); -// h.update_coef(e, -1); -// } -// else if (rel == '<') { -// GEQ_Handle h = f_root->add_GEQ(); -// h.update_coef(lhs, -1); -// h.update_coef(e, 1); -// } -// else { // '=' -// EQ_Handle h = f_root->add_EQ(); -// h.update_coef(lhs, 1); -// h.update_coef(e, -1); -// } -// } -// else if (op.is_instr()) -// suif2formula(r, f_root, freevars, op.instr(), lhs, side, rel); -// } - - -// void suif2formula(Relation &r, F_And *f_root, -// std::vector &freevars, -// instruction *ins, Variable_ID lhs, -// char side, char rel) { -// if (ins->opcode() == io_cpy) { -// suif2formula(r, f_root, freevars, ins->src_op(0), lhs, side, rel); -// } -// else if (ins->opcode() == io_add || ins->opcode() == io_sub) { -// F_Exists *f_exists = f_root->add_exists(); -// Variable_ID e1 = f_exists->declare(tmp_e()); -// Variable_ID e2 = f_exists->declare(tmp_e()); -// F_And *f_and = f_exists->add_and(); - -// int add_or_sub = ins->opcode() == io_add ? 1 : -1; -// if (rel == '>') { -// GEQ_Handle h = f_and->add_GEQ(); -// h.update_coef(lhs, 1); -// h.update_coef(e1, -1); -// h.update_coef(e2, -1 * add_or_sub); -// } -// else if (rel == '<') { -// GEQ_Handle h = f_and->add_GEQ(); -// h.update_coef(lhs, -1); -// h.update_coef(e1, 1); -// h.update_coef(e2, 1 * add_or_sub); -// } -// else { // '=' -// EQ_Handle h = f_and->add_EQ(); -// h.update_coef(lhs, 1); -// h.update_coef(e1, -1); -// h.update_coef(e2, -1 * add_or_sub); -// } - -// suif2formula(r, f_and, freevars, ins->src_op(0), e1, side, '='); -// suif2formula(r, f_and, freevars, ins->src_op(1), e2, side, '='); -// } -// else if (ins->opcode() == io_mul) { -// operand op1 = ins->src_op(0); -// operand op2 = ins->src_op(1); - -// if (!op1.is_immed() && !op2.is_immed()) -// return; // add Function in the future -// else { -// operand op; -// immed im; -// if (op1.is_immed()) { -// im = op1.immediate(); -// op = op2; -// } -// else { -// im = op2.immediate(); -// op = op1; -// } - -// if (!im.is_integer()) -// return; //add Function in the future -// else { -// int c = im.integer(); - -// F_Exists *f_exists = f_root->add_exists(); -// Variable_ID e = f_exists->declare(tmp_e()); -// F_And *f_and = f_exists->add_and(); - -// if (rel == '>') { -// GEQ_Handle h = f_and->add_GEQ(); -// h.update_coef(lhs, 1); -// h.update_coef(e, -c); -// } -// else if (rel == '<') { -// GEQ_Handle h = f_and->add_GEQ(); -// h.update_coef(lhs, -1); -// h.update_coef(e, c); -// } -// else { -// EQ_Handle h = f_and->add_EQ(); -// h.update_coef(lhs, 1); -// h.update_coef(e, -c); -// } - -// suif2formula(r, f_and, freevars, op, e, side, '='); -// } -// } -// } -// else if (ins->opcode() == io_div) { -// operand op1 = ins->src_op(0); -// operand op2 = ins->src_op(1); - -// if (!op2.is_immed()) -// return; //add Function in the future -// else { -// immed im = op2.immediate(); - -// if (!im.is_integer()) -// return; //add Function in the future -// else { -// int c = im.integer(); - -// F_Exists *f_exists = f_root->add_exists(); -// Variable_ID e = f_exists->declare(tmp_e()); -// F_And *f_and = f_exists->add_and(); - -// if (rel == '>') { -// GEQ_Handle h = f_and->add_GEQ(); -// h.update_coef(lhs, c); -// h.update_coef(e, -1); -// } -// else if (rel == '<') { -// GEQ_Handle h = f_and->add_GEQ(); -// h.update_coef(lhs, -c); -// h.update_coef(e, 1); -// } -// else { -// EQ_Handle h = f_and->add_EQ(); -// h.update_coef(lhs, c); -// h.update_coef(e, -1); -// } - -// suif2formula(r, f_and, freevars, op1, e, side, '='); -// } -// } -// } -// else if (ins->opcode() == io_neg) { -// F_Exists *f_exists = f_root->add_exists(); -// Variable_ID e = f_exists->declare(tmp_e()); -// F_And *f_and = f_exists->add_and(); - -// if (rel == '>') { -// GEQ_Handle h = f_and->add_GEQ(); -// h.update_coef(lhs, 1); -// h.update_coef(e, 1); -// } -// else if (rel == '<') { -// GEQ_Handle h = f_and->add_GEQ(); -// h.update_coef(lhs, -1); -// h.update_coef(e, -1); -// } -// else { -// EQ_Handle h = f_and->add_EQ(); -// h.update_coef(lhs, 1); -// h.update_coef(e, 1); -// } - -// suif2formula(r, f_and, freevars, ins->src_op(0), e, side, '='); -// } -// else if (ins->opcode() == io_min) { -// operand op1 = ins->src_op(0); -// operand op2 = ins->src_op(1); - -// F_Exists *f_exists = f_root->add_exists(); -// Variable_ID e1 = f_exists->declare(tmp_e()); -// Variable_ID e2 = f_exists->declare(tmp_e()); -// F_And *f_and = f_exists->add_and(); - -// if (rel == '>') { -// F_Or *f_or = f_and->add_or(); -// F_And *f_and1 = f_or->add_and(); -// GEQ_Handle h1 = f_and1->add_GEQ(); -// h1.update_coef(lhs, 1); -// h1.update_coef(e1, -1); -// F_And *f_and2 = f_or->add_and(); -// GEQ_Handle h2 = f_and2->add_GEQ(); -// h2.update_coef(lhs, 1); -// h2.update_coef(e2, -1); -// } -// else if (rel == '<') { -// GEQ_Handle h1 = f_and->add_GEQ(); -// h1.update_coef(lhs, -1); -// h1.update_coef(e1, 1); -// GEQ_Handle h2 = f_and->add_GEQ(); -// h2.update_coef(lhs, -1); -// h2.update_coef(e2, 1); -// } -// else { -// F_Or *f_or = f_and->add_or(); -// F_And *f_and1 = f_or->add_and(); -// EQ_Handle h1 = f_and1->add_EQ(); -// h1.update_coef(lhs, 1); -// h1.update_coef(e1, -1); -// GEQ_Handle h2 = f_and1->add_GEQ(); -// h2.update_coef(e1, -1); -// h2.update_coef(e2, 1); -// F_And *f_and2 = f_or->add_and(); -// EQ_Handle h3 = f_and2->add_EQ(); -// h3.update_coef(lhs, 1); -// h3.update_coef(e2, -1); -// GEQ_Handle h4 = f_and2->add_GEQ(); -// h4.update_coef(e1, 1); -// h4.update_coef(e2, -1); -// } - -// suif2formula(r, f_and, freevars, op1, e1, side, '='); -// suif2formula(r, f_and, freevars, op2, e2, side, '='); -// } -// else if (ins->opcode() == io_max) { -// operand op1 = ins->src_op(0); -// operand op2 = ins->src_op(1); - -// F_Exists *f_exists = f_root->add_exists(); -// Variable_ID e1 = f_exists->declare(tmp_e()); -// Variable_ID e2 = f_exists->declare(tmp_e()); -// F_And *f_and = f_exists->add_and(); - -// if (rel == '>') { -// GEQ_Handle h1 = f_and->add_GEQ(); -// h1.update_coef(lhs, 1); -// h1.update_coef(e1, -1); -// GEQ_Handle h2 = f_and->add_GEQ(); -// h2.update_coef(lhs, 1); -// h2.update_coef(e2, -1); -// } -// else if (rel == '<') { -// F_Or *f_or = f_and->add_or(); -// F_And *f_and1 = f_or->add_and(); -// GEQ_Handle h1 = f_and1->add_GEQ(); -// h1.update_coef(lhs, -1); -// h1.update_coef(e1, 1); -// F_And *f_and2 = f_or->add_and(); -// GEQ_Handle h2 = f_and2->add_GEQ(); -// h2.update_coef(lhs, -1); -// h2.update_coef(e2, 1); -// } -// else { -// F_Or *f_or = f_and->add_or(); -// F_And *f_and1 = f_or->add_and(); -// EQ_Handle h1 = f_and1->add_EQ(); -// h1.update_coef(lhs, 1); -// h1.update_coef(e1, -1); -// GEQ_Handle h2 = f_and1->add_GEQ(); -// h2.update_coef(e1, 1); -// h2.update_coef(e2, -1); -// F_And *f_and2 = f_or->add_and(); -// EQ_Handle h3 = f_and2->add_EQ(); -// h3.update_coef(lhs, 1); -// h3.update_coef(e2, -1); -// GEQ_Handle h4 = f_and2->add_GEQ(); -// h4.update_coef(e1, -1); -// h4.update_coef(e2, 1); -// } - -// suif2formula(r, f_and, freevars, op1, e1, side, '='); -// suif2formula(r, f_and, freevars, op2, e2, side, '='); -// } -// } - -//----------------------------------------------------------------------------- -// Generate iteration space constraints -//----------------------------------------------------------------------------- - -// void add_loop_stride_constraints(Relation &r, F_And *f_root, -// std::vector &freevars, -// tree_for *tnf, char side) { - -// std::string name(tnf->index()->name()); -// int dim = 0; -// for (;dim < r.n_set(); dim++) -// if (r.set_var(dim+1)->name() == name) -// break; - -// Relation bound = get_loop_bound(r, dim); - -// operand op = tnf->step_op(); -// if (!op.is_null()) { -// if (op.is_immed()) { -// immed im = op.immediate(); -// if (im.is_integer()) { -// int c = im.integer(); - -// if (c != 1 && c != -1) -// add_loop_stride(r, bound, dim, c); -// } -// else -// assert(0); // messy stride -// } -// else -// assert(0); // messy stride -// } -// } - -// void add_loop_bound_constraints(IR_Code *ir, Relation &r, F_And *f_root, -// std::vector &freevars, -// tree_for *tnf, -// char upper_or_lower, char side, IR_CONDITION_TYPE rel) { -// Variable_ID v = find_index(r, tnf->index()->name(), side); - -// tree_node_list *tnl; - -// if (upper_or_lower == 'u') -// tnl = tnf->ub_list(); -// else -// tnl = tnf->lb_list(); - -// tree_node_list_iter iter(tnl); -// while (!iter.is_empty()) { -// tree_node *tn = iter.step(); -// if (tn->kind() != TREE_INSTR) -// break; // messy bounds - -// instruction *ins = static_cast(tn)->instr(); - - -// if (upper_or_lower == 'u' && (tnf->test() == FOR_SLT || tnf->test() == FOR_ULT)) { -// operand op1(ins->clone()); -// operand op2(new in_ldc(type_s32, operand(), immed(1))); -// instruction *t = new in_rrr(io_sub, op1.type(), operand(), op1, op2); - -// CG_suifRepr *repr = new CG_suifRepr(operand(t)); -// exp2formula(ir, r, f_root, freevars, repr, v, side, rel, true); -// delete t; -// } -// else if (tnf->test() == FOR_SLT || tnf->test() == FOR_SLTE || tnf->test() == FOR_ULT || tnf->test() == FOR_ULTE) { -// CG_suifRepr *repr = new CG_suifRepr(operand(ins)); -// exp2formula(ir, r, f_root, freevars, repr, v, side, rel, true); -// } -// else -// assert(0); -// } -// } - - -// Relation loop_iteration_space(std::vector &freevars, -// tree_node *tn, std::vector &loops) { -// Relation r(loops.size()); -// for (unsigned i = 0; i < loops.size(); i++) { -// String s = loops[i]->index()->name(); -// r.name_set_var(i+1, s); -// } - -// F_And *f_root = r.add_and(); - -// std::vector outer = find_outer_loops(tn); -// std::vector loops_lex(loops.size(), LEX_UNKNOWN); - -// for (unsigned i = 0; i < outer.size(); i++) { -// unsigned j; - -// for (j = 0; j < loops.size(); j++) { -// if (outer[i] == loops[j]) { -// loops_lex[j] = LEX_MATCH; -// break; -// } else if (outer[i]->index() == loops[j]->index()) { -// loops_lex[j] = lexical_order(outer[i],loops[j]); -// break; -// } -// } - -// if (j != loops.size()) { -// add_loop_bound_constraints(r, f_root, freevars, outer[i], 'l', 's', '>'); -// add_loop_bound_constraints(r, f_root, freevars, outer[i], 'u', 's', '<'); -// add_loop_stride_constraints(r,f_root, freevars, outer[i], 's'); -// } -// } - -// // Add degenerated constraints for non-enclosing loops for this -// // statement. We treat low-dim space as part of whole -// // iteration space. -// LexicalOrderType lex = LEX_MATCH; -// for (unsigned i = 0; i < loops.size(); i++) { -// if (loops_lex[i] != 0) { -// if (lex == LEX_MATCH) -// lex = loops_lex[i]; -// continue; -// } - -// if (lex == LEX_MATCH) { -// for (unsigned j = i+1; j < loops.size(); j++) { -// if (loops_lex[j] == LEX_BEFORE || loops_lex[j] == LEX_AFTER) { -// lex = loops_lex[j]; -// break; -// } -// } -// } - -// if (lex == LEX_MATCH) -// lex = lexical_order(tn, loops[i]); - -// if (lex == LEX_BEFORE) -// add_loop_bound_constraints(r, f_root, freevars, loops[i], 'l', 's', '='); -// else -// add_loop_bound_constraints(r, f_root, freevars, loops[i], 'u', 's', '='); -// } - -// return r; -// } - -// Relation arrays2relation(std::vector &freevars, -// in_array *ia_w, const Relation &IS1_, -// in_array *ia_r, const Relation &IS2_) { -// Relation &IS1 = const_cast(IS1_); -// Relation &IS2 = const_cast(IS2_); - -// Relation r(IS1.n_set(), IS2.n_set()); - -// for (int i = 1; i <= IS1.n_set(); i++) -// r.name_input_var(i, IS1.set_var(i)->name()); - -// for (int i = 1; i <= IS2.n_set(); i++) -// r.name_output_var(i, IS2.set_var(i)->name()+"'"); - -// if (get_sym_of_array(ia_w) != get_sym_of_array(ia_r)) { -// r.add_or(); // False Relation -// return r; -// } - -// F_And *f_root = r.add_and(); - -// for (unsigned i = 0; i < ia_w->dims(); i++) { -// F_Exists *f_exists = f_root->add_exists(); -// Variable_ID e = f_exists->declare(tmp_e()); -// F_And *f_and = f_exists->add_and(); - -// suif2formula(r, f_and, freevars, ia_w->index(i), e, 'w', '='); -// suif2formula(r, f_and, freevars, ia_r->index(i), e, 'r', '='); -// } - -// // add iteration space restriction -// r = Restrict_Domain(r, copy(IS1)); -// r = Restrict_Range(r, copy(IS2)); - -// // reset the output variable names lost in restriction -// for (int i = 1; i <= IS2.n_set(); i++) -// r.name_output_var(i, IS2.set_var(i)->name()+"'"); - -// return r; -// } - - -// std::vector relation2dependences (IR_Code *ir, in_array *ia_w, in_array *ia_r, const Relation &r) { -// assert(r.n_inp() == r.n_out()); - -// std::vector dependences; - -// std::stack working; -// working.push(DependenceLevel(r, r.n_inp())); - -// while (!working.empty()) { -// DependenceLevel dep = working.top(); -// working.pop(); - -// // No dependence exists, move on. -// if (!dep.r.is_satisfiable()) -// continue; - -// if (dep.level == r.n_inp()) { -// DependenceVector dv; - -// // for loop independent dependence, use lexical order to -// // determine the correct source and destination -// if (dep.dir == 0) { -// LexicalOrderType order = lexical_order(ia_w->parent(), ia_r->parent()); - -// if (order == LEX_MATCH) -// continue; //trivial self zero-dependence -// else if (order == LEX_AFTER) { -// dv.src = new IR_suifArrayRef(ir, ia_r); -// dv.dst = new IR_suifArrayRef(ir, ia_w); -// } -// else { -// dv.src = new IR_suifArrayRef(ir, ia_w); -// dv.dst = new IR_suifArrayRef(ir,ia_r); -// } -// } -// else if (dep.dir == 1) { -// dv.src = new IR_suifArrayRef(ir, ia_w); -// dv.dst = new IR_suifArrayRef(ir, ia_r); -// } -// else { // dep.dir == -1 -// dv.src = new IR_suifArrayRef(ir, ia_r); -// dv.dst = new IR_suifArrayRef(ir, ia_w); -// } - -// dv.lbounds = dep.lbounds; -// dv.ubounds = dep.ubounds; - -// // // set the dependence type -// // if (is_lhs(dv.source) && is_lhs(dv.dest)) -// // dv.type = 'o'; -// // else if (!is_lhs(dv.source) && ! is_lhs(dv.dest)) -// // dv.type = 'i'; -// // else if (is_lhs(dv.source)) -// // dv.type = 'f'; -// // else -// // dv.type = 'a'; - -// dependences.push_back(dv); -// } -// else { -// // now work on the next dimension level -// int level = ++dep.level; - -// coef_t lbound, ubound; -// Relation delta = Deltas(copy(dep.r)); -// delta.query_variable_bounds(delta.set_var(level), lbound, ubound); - -// if (dep.dir == 0) { -// if (lbound > 0) { -// dep.dir = 1; -// dep.lbounds[level-1] = lbound; -// dep.ubounds[level-1] = ubound; - -// working.push(dep); -// } -// else if (ubound < 0) { -// dep.dir = -1; -// dep.lbounds[level-1] = -ubound; -// dep.ubounds[level-1] = -lbound; - -// working.push(dep); -// } -// else { -// // split the dependence vector into flow- and anti-dependence -// // for the first non-zero distance, also separate zero distance -// // at this level. -// { -// DependenceLevel dep2 = dep; - -// dep2.lbounds[level-1] = 0; -// dep2.ubounds[level-1] = 0; - -// F_And *f_root = dep2.r.and_with_and(); -// EQ_Handle h = f_root->add_EQ(); -// h.update_coef(dep2.r.input_var(level), 1); -// h.update_coef(dep2.r.output_var(level), -1); - -// working.push(dep2); -// } - -// if (lbound < 0 && ia_w != ia_r) { -// DependenceLevel dep2 = dep; - -// F_And *f_root = dep2.r.and_with_and(); -// GEQ_Handle h = f_root->add_GEQ(); -// h.update_coef(dep2.r.input_var(level), 1); -// h.update_coef(dep2.r.output_var(level), -1); -// h.update_const(-1); - -// // get tighter bounds under new constraints -// coef_t lbound, ubound; -// delta = Deltas(copy(dep2.r)); -// delta.query_variable_bounds(delta.set_var(level), -// lbound, ubound); - -// dep2.dir = -1; -// dep2.lbounds[level-1] = max(-ubound,static_cast(1)); // use max() to avoid Omega retardness -// dep2.ubounds[level-1] = -lbound; - -// working.push(dep2); -// } - -// if (ubound > 0) { -// DependenceLevel dep2 = dep; - -// F_And *f_root = dep2.r.and_with_and(); -// GEQ_Handle h = f_root->add_GEQ(); -// h.update_coef(dep2.r.input_var(level), -1); -// h.update_coef(dep2.r.output_var(level), 1); -// h.update_const(-1); - -// // get tighter bonds under new constraints -// coef_t lbound, ubound; -// delta = Deltas(copy(dep2.r)); -// delta.query_variable_bounds(delta.set_var(level), -// lbound, ubound); -// dep2.dir = 1; -// dep2.lbounds[level-1] = max(lbound,static_cast(1)); // use max() to avoid Omega retardness -// dep2.ubounds[level-1] = ubound; - -// working.push(dep2); -// } -// } -// } -// // now deal with dependence vector with known direction -// // determined at previous levels -// else { -// // For messy bounds, further test to see if the dependence distance -// // can be reduced to positive/negative. This is an omega hack. -// if (lbound == negInfinity && ubound == posInfinity) { -// { -// Relation t = dep.r; -// F_And *f_root = t.and_with_and(); -// GEQ_Handle h = f_root->add_GEQ(); -// h.update_coef(t.input_var(level), 1); -// h.update_coef(t.output_var(level), -1); -// h.update_const(-1); - -// if (!t.is_satisfiable()) { -// lbound = 0; -// } -// } -// { -// Relation t = dep.r; -// F_And *f_root = t.and_with_and(); -// GEQ_Handle h = f_root->add_GEQ(); -// h.update_coef(t.input_var(level), -1); -// h.update_coef(t.output_var(level), 1); -// h.update_const(-1); - -// if (!t.is_satisfiable()) { -// ubound = 0; -// } -// } -// } - -// // Same thing as above, test to see if zero dependence -// // distance possible. -// if (lbound == 0 || ubound == 0) { -// Relation t = dep.r; -// F_And *f_root = t.and_with_and(); -// EQ_Handle h = f_root->add_EQ(); -// h.update_coef(t.input_var(level), 1); -// h.update_coef(t.output_var(level), -1); - -// if (!t.is_satisfiable()) { -// if (lbound == 0) -// lbound = 1; -// if (ubound == 0) -// ubound = -1; -// } -// } - -// if (dep.dir == -1) { -// dep.lbounds[level-1] = -ubound; -// dep.ubounds[level-1] = -lbound; -// } -// else { // dep.dir == 1 -// dep.lbounds[level-1] = lbound; -// dep.ubounds[level-1] = ubound; -// } - -// working.push(dep); -// } -// } -// } - -// return dependences; -// } - -//----------------------------------------------------------------------------- -// Determine whether the loop (starting from 0) in the iteration space -// has only one iteration. -//----------------------------------------------------------------------------- -bool is_single_loop_iteration(const Relation &r, int level, const Relation &known) { - int n = r.n_set(); - Relation r1 = Intersection(copy(r), Extend_Set(copy(known), n-known.n_set())); - - Relation mapping(n, n); - F_And *f_root = mapping.add_and(); - for (int i = 1; i <= level; i++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.input_var(i), 1); - h.update_coef(mapping.output_var(i), -1); - } - r1 = Range(Restrict_Domain(mapping, r1)); - r1.simplify(); - - Variable_ID v = r1.set_var(level); - for (DNF_Iterator di(r1.query_DNF()); di; di++) { - bool is_single = false; - for (EQ_Iterator ei((*di)->EQs()); ei; ei++) - if ((*ei).get_coef(v) != 0 && !(*ei).has_wildcards()) { - is_single = true; - break; - } - - if (!is_single) - return false; - } - - return true; -} - - - - -bool is_single_iteration(const Relation &r, int dim) { - assert(r.is_set()); - const int n = r.n_set(); - - if (dim >= n) - return true; - - Relation bound = get_loop_bound(r, dim); - -// if (!bound.has_single_conjunct()) -// return false; - -// Conjunct *c = bound.query_DNF()->single_conjunct(); - - for (DNF_Iterator di(bound.query_DNF()); di; di++) { - bool is_single = false; - for (EQ_Iterator ei((*di)->EQs()); ei; ei++) - if (!(*ei).has_wildcards()) { - is_single = true; - break; - } - - if (!is_single) - return false; - } - - return true; - - - - -// Relation r = copy(r_); -// const int n = r.n_set(); - -// if (dim >= n) -// return true; - -// Relation bound = get_loop_bound(r, dim); -// bound = Approximate(bound); -// Conjunct *c = bound.query_DNF()->single_conjunct(); - -// return c->n_GEQs() == 0; - - - - - -// Relation r = copy(r_); -// r.simplify(); -// const int n = r.n_set(); - -// if (dim >= n) -// return true; - -// for (DNF_Iterator i(r.query_DNF()); i; i++) { -// std::vector is_single(n); -// for (int j = 0; j < dim; j++) -// is_single[j] = true; -// for (int j = dim; j < n; j++) -// is_single[j] = false; - -// bool found_new_single = true; -// while (found_new_single) { -// found_new_single = false; - -// for (EQ_Iterator j = (*i)->EQs(); j; j++) { -// int saved_pos = -1; -// for (Constr_Vars_Iter k(*j); k; k++) -// if ((*k).var->kind() == Set_Var || (*k).var->kind() == Input_Var) { -// int pos = (*k).var->get_position() - 1; -// if (!is_single[pos]) -// if (saved_pos == -1) -// saved_pos = pos; -// else { -// saved_pos = -1; -// break; -// } -// } - -// if (saved_pos != -1) { -// is_single[saved_pos] = true; -// found_new_single = true; -// } -// } - -// if (is_single[dim]) -// break; -// } - -// if (!is_single[dim]) -// return false; -// } - -// return true; -} - -//----------------------------------------------------------------------------- -// Set/get the value of a variable which is know to be constant. -//----------------------------------------------------------------------------- -void assign_const(Relation &r, int dim, int val) { - const int n = r.n_out(); - - Relation mapping(n, n); - F_And *f_root = mapping.add_and(); - - for (int i = 1; i <= n; i++) { - if (i != dim+1) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.output_var(i), 1); - h.update_coef(mapping.input_var(i), -1); - } - else { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.output_var(i), 1); - h.update_const(-val); - } - } - - r = Composition(mapping, r); -} - - -int get_const(const Relation &r, int dim, Var_Kind type) { -// Relation rr = copy(r); - Relation &rr = const_cast(r); - - Variable_ID v; - switch (type) { - // case Set_Var: - // v = rr.set_var(dim+1); - // break; - case Input_Var: - v = rr.input_var(dim+1); - break; - case Output_Var: - v = rr.output_var(dim+1); - break; - default: - throw std::invalid_argument("unsupported variable type"); - } - - for (DNF_Iterator di(rr.query_DNF()); di; di++) - for (EQ_Iterator ei = (*di)->EQs(); ei; ei++) - if ((*ei).is_const(v)) - return (*ei).get_const(); - - throw std::runtime_error("cannot get variable's constant value"); -} - - - - - - -//--------------------------------------------------------------------------- -// Get the bound for a specific loop. -//--------------------------------------------------------------------------- -Relation get_loop_bound(const Relation &r, int dim) { - assert(r.is_set()); - const int n = r.n_set(); - -// Relation r1 = project_onto_levels(copy(r), dim+1, true); - Relation mapping(n,n); - F_And *f_root = mapping.add_and(); - for (int i = 1; i <= dim+1; i++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.input_var(i), 1); - h.update_coef(mapping.output_var(i), -1); - } - Relation r1 = Range(Restrict_Domain(mapping, copy(r))); - for (int i = 1; i <= n; i++) - r1.name_set_var(i, const_cast(r).set_var(i)->name()); - r1.setup_names(); - Relation r2 = Project(copy(r1), dim+1, Set_Var); - - return Gist(r1, r2, 1); -} - -Relation get_loop_bound(const Relation &r, int level, const Relation &known) { - int n = r.n_set(); - Relation r1 = Intersection(copy(r), Extend_Set(copy(known), n-known.n_set())); - - Relation mapping(n, n); - F_And *f_root = mapping.add_and(); - for (int i = 1; i <= level; i++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.input_var(i), 1); - h.update_coef(mapping.output_var(i), -1); - } - r1 = Range(Restrict_Domain(mapping, r1)); - Relation r2 = Project(copy(r1), level, Set_Var); - r1 = Gist(r1, r2, 1); - - for (int i = 1; i <= n; i++) - r1.name_set_var(i, const_cast(r).set_var(i)->name()); - r1.setup_names(); - - return r1; -} - - - -Relation get_max_loop_bound(const std::vector &r, int dim) { - if (r.size() == 0) - return Relation::Null(); - - const int n = r[0].n_set(); - Relation res(Relation::False(n)); - for (int i = 0; i < r.size(); i++) { - Relation &t = const_cast(r[i]); - if (t.is_satisfiable()) - res = Union(get_loop_bound(t, dim), res); - } - - res.simplify(); - - return res; -} - -Relation get_min_loop_bound(const std::vector &r, int dim) { - if (r.size() == 0) - return Relation::Null(); - - const int n = r[0].n_set(); - Relation res(Relation::True(n)); - for (int i = 0; i < r.size(); i++) { - Relation &t = const_cast(r[i]); - if (t.is_satisfiable()) - res = Intersection(get_loop_bound(t, dim), res); - } - - res.simplify(); - - return res; -} - -//----------------------------------------------------------------------------- -// Add strident to a loop. -// Issues: -// - Don't work with relations with multiple disjuncts. -// - Omega's dealing with max lower bound is awkward. -//----------------------------------------------------------------------------- -void add_loop_stride(Relation &r, const Relation &bound_, int dim, int stride) { - F_And *f_root = r.and_with_and(); - Relation &bound = const_cast(bound_); - for (DNF_Iterator di(bound.query_DNF()); di; di++) { - F_Exists *f_exists = f_root->add_exists(); - Variable_ID e1 = f_exists->declare(tmp_e()); - Variable_ID e2 = f_exists->declare(tmp_e()); - F_And *f_and = f_exists->add_and(); - EQ_Handle stride_eq = f_and->add_EQ(); - stride_eq.update_coef(e1, 1); - stride_eq.update_coef(e2, stride); - if (!r.is_set()) - stride_eq.update_coef(r.output_var(dim+1), -1); - else - stride_eq.update_coef(r.set_var(dim+1), -1); - F_Or *f_or = f_and->add_or(); - - for (GEQ_Iterator gi = (*di)->GEQs(); gi; gi++) { - if ((*gi).get_coef(bound.set_var(dim+1)) > 0) { - // copy the lower bound constraint - EQ_Handle h1 = f_or->add_and()->add_EQ(); - GEQ_Handle h2 = f_and->add_GEQ(); - for (Constr_Vars_Iter ci(*gi); ci; ci++) { - switch ((*ci).var->kind()) { - // case Set_Var: - case Input_Var: { - int pos = (*ci).var->get_position(); - if (pos == dim + 1) { - h1.update_coef(e1, (*ci).coef); - h2.update_coef(e1, (*ci).coef); - } - else { - if (!r.is_set()) { - h1.update_coef(r.output_var(pos), (*ci).coef); - h2.update_coef(r.output_var(pos), (*ci).coef); - } - else { - h1.update_coef(r.set_var(pos), (*ci).coef); - h2.update_coef(r.set_var(pos), (*ci).coef); - } - } - break; - } - case Global_Var: { - Global_Var_ID g = (*ci).var->get_global_var(); - h1.update_coef(r.get_local(g, (*ci).var->function_of()), (*ci).coef); - h2.update_coef(r.get_local(g, (*ci).var->function_of()), (*ci).coef); - break; - } - default: - break; - } - } - h1.update_const((*gi).get_const()); - h2.update_const((*gi).get_const()); - } - } - } -} - - -bool is_inner_loop_depend_on_level(const Relation &r, int level, const Relation &known) { - Relation r1 = Intersection(copy(r), Extend_Set(copy(known), r.n_set()-known.n_set())); - Relation r2 = copy(r1); - for (int i = level+1; i <= r2.n_set(); i++) - r2 = Project(r2, r2.set_var(i)); - r2.simplify(2, 4); - Relation r3 = Gist(r1, r2); - - Variable_ID v = r3.set_var(level); - for (DNF_Iterator di(r3.query_DNF()); di; di++) { - for (EQ_Iterator ei = (*di)->EQs(); ei; ei++) - if ((*ei).get_coef(v) != 0) - return true; - - for (GEQ_Iterator gi = (*di)->GEQs(); gi; gi++) - if ((*gi).get_coef(v) != 0) - return true; - } - - return false; -} - - -//----------------------------------------------------------------------------- -// Suppose loop dim is i. Replace i with i+adjustment in loop bounds. -// e.g. do i = 1, n -// do j = i, n -// after call with dim = 0 and adjustment = 1: -// do i = 1, n -// do j = i+1, n -// ----------------------------------------------------------------------------- -Relation adjust_loop_bound(const Relation &r, int level, int adjustment) { - if (adjustment == 0) - return copy(r); - - const int n = r.n_set(); - Relation r1 = copy(r); - for (int i = level+1; i <= r1.n_set(); i++) - r1 = Project(r1, r1.set_var(i)); - r1.simplify(2, 4); - Relation r2 = Gist(copy(r), copy(r1)); - - Relation mapping(n, n); - F_And *f_root = mapping.add_and(); - for (int i = 1; i <= n; i++) - if (i == level) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.input_var(level), -1); - h.update_coef(mapping.output_var(level), 1); - h.update_const(static_cast(adjustment)); - } - else { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(mapping.input_var(i), -1); - h.update_coef(mapping.output_var(i), 1); - } - - r2 = Range(Restrict_Domain(mapping, r2)); - r1 = Intersection(r1, r2); - r1.simplify(); - - for (int i = 1; i <= n; i++) - r1.name_set_var(i, const_cast(r).set_var(i)->name()); - r1.setup_names(); - return r1; -} - - -// commented out on 07/14/2010 -// void adjust_loop_bound(Relation &r, int dim, int adjustment, std::vector globals) { -// assert(r.is_set()); - -// if (adjustment == 0) -// return; - -// const int n = r.n_set(); -// Tuple name(n); -// for (int i = 1; i <= n; i++) -// name[i] = r.set_var(i)->name(); - -// Relation r1 = project_onto_levels(copy(r), dim+1, true); -// Relation r2 = Gist(copy(r), copy(r1)); - -// // remove old bogus global variable conditions since we are going to -// // update the value. -// if (globals.size() > 0) -// r1 = Gist(r1, project_onto_levels(copy(r), 0, true)); - -// Relation r4 = Relation::True(n); - -// for (DNF_Iterator di(r2.query_DNF()); di; di++) { -// for (EQ_Iterator ei = (*di)->EQs(); ei; ei++) { -// EQ_Handle h = r4.and_with_EQ(*ei); - -// Variable_ID v = r2.set_var(dim+1); -// coef_t c = (*ei).get_coef(v); -// if (c != 0) -// h.update_const(c*adjustment); - -// for (int i = 0; i < globals.size(); i++) { -// Variable_ID v = r2.get_local(globals[i]); -// coef_t c = (*ei).get_coef(v); -// if (c != 0) -// h.update_const(c*adjustment); -// } -// } - -// for (GEQ_Iterator gi = (*di)->GEQs(); gi; gi++) { -// GEQ_Handle h = r4.and_with_GEQ(*gi); - -// Variable_ID v = r2.set_var(dim+1); -// coef_t c = (*gi).get_coef(v); -// if (c != 0) -// h.update_const(c*adjustment); - -// for (int i = 0; i < globals.size(); i++) { -// Variable_ID v = r2.get_local(globals[i]); -// coef_t c = (*gi).get_coef(v); -// if (c != 0) -// h.update_const(c*adjustment); -// } -// } -// } -// r = Intersection(r1, r4); -// // } -// // else -// // r = Intersection(r1, r2); - -// for (int i = 1; i <= n; i++) -// r.name_set_var(i, name[i]); -// r.setup_names(); -// } - - -// void adjust_loop_bound(Relation &r, int dim, int adjustment) { -// assert(r.is_set()); -// const int n = r.n_set(); -// Tuple name(n); -// for (int i = 1; i <= n; i++) -// name[i] = r.set_var(i)->name(); - -// Relation r1 = project_onto_levels(copy(r), dim+1, true); -// Relation r2 = Gist(r, copy(r1)); - -// Relation r3(n, n); -// F_And *f_root = r3.add_and(); -// for (int i = 0; i < n; i++) { -// EQ_Handle h = f_root->add_EQ(); -// h.update_coef(r3.output_var(i+1), 1); -// h.update_coef(r3.input_var(i+1), -1); -// if (i == dim) -// h.update_const(adjustment); -// } - -// r2 = Range(Restrict_Domain(r3, r2)); -// r = Intersection(r1, r2); - -// for (int i = 1; i <= n; i++) -// r.name_set_var(i, name[i]); -// r.setup_names(); -// } - -// void adjust_loop_bound(Relation &r, int dim, Free_Var_Decl *global_var, int adjustment) { -// assert(r.is_set()); -// const int n = r.n_set(); -// Tuple name(n); -// for (int i = 1; i <= n; i++) -// name[i] = r.set_var(i)->name(); - -// Relation r1 = project_onto_levels(copy(r), dim+1, true); -// Relation r2 = Gist(r, copy(r1)); - -// Relation r3(n); -// Variable_ID v = r2.get_local(global_var); - -// for (DNF_Iterator di(r2.query_DNF()); di; di++) { -// for (EQ_Iterator ei = (*di)->EQs(); ei; ei++) { -// coef_t c = (*ei).get_coef(v); -// EQ_Handle h = r3.and_with_EQ(*ei); -// if (c != 0) -// h.update_const(c*adjustment); -// } -// for (GEQ_Iterator gi = (*di)->GEQs(); gi; gi++) { -// coef_t c = (*gi).get_coef(v); -// GEQ_Handle h = r3.and_with_GEQ(*gi); -// if (c != 0) -// h.update_const(c*adjustment); -// } -// } - -// r = Intersection(r1, r3); -// for (int i = 1; i <= n; i++) -// r.name_set_var(i, name[i]); -// r.setup_names(); -// } - - - -//------------------------------------------------------------------------------ -// If the dimension has value posInfinity, the statement should be privatized -// at this dimension. -//------------------------------------------------------------------------------ -// boolean is_private_statement(const Relation &r, int dim) { -// int n; -// if (r.is_set()) -// n = r.n_set(); -// else -// n = r.n_out(); - -// if (dim >= n) -// return false; - -// try { -// coef_t c; -// if (r.is_set()) -// c = get_const(r, dim, Set_Var); -// else -// c = get_const(r, dim, Output_Var); -// if (c == posInfinity) -// return true; -// else -// return false; -// } -// catch (loop_error e){ -// } - -// return false; -// } - - - -// // ---------------------------------------------------------------------------- -// // Calculate v mod dividend based on equations inside relation r. -// // Return posInfinity if it is not a constant. -// // ---------------------------------------------------------------------------- -// static coef_t mod_(const Relation &r_, Variable_ID v, int dividend, std::set &working_on) { -// assert(dividend > 0); -// if (v->kind() == Forall_Var || v->kind() == Exists_Var || v->kind() == Wildcard_Var) -// return posInfinity; - -// working_on.insert(v); - -// Relation &r = const_cast(r_); -// Conjunct *c = r.query_DNF()->single_conjunct(); - -// for (EQ_Iterator ei(c->EQs()); ei; ei++) { -// int coef = mod((*ei).get_coef(v), dividend); -// if (coef != 1 && coef != dividend - 1 ) -// continue; - -// coef_t result = 0; -// for (Constr_Vars_Iter cvi(*ei); cvi; cvi++) -// if ((*cvi).var != v) { -// int p = mod((*cvi).coef, dividend); - -// if (p == 0) -// continue; - -// if (working_on.find((*cvi).var) != working_on.end()) { -// result = posInfinity; -// break; -// } - -// coef_t q = mod_(r, (*cvi).var, dividend, working_on); -// if (q == posInfinity) { -// result = posInfinity; -// break; -// } -// result += p * q; -// } - -// if (result != posInfinity) { -// result += (*ei).get_const(); -// if (coef == 1) -// result = -result; -// working_on.erase(v); - -// return mod(result, dividend); -// } -// } - -// working_on.erase(v); -// return posInfinity; -// } - - -// coef_t mod(const Relation &r, Variable_ID v, int dividend) { -// std::set working_on = std::set(); - -// return mod_(r, v, dividend, working_on); -// } - - - -//----------------------------------------------------------------------------- -// Generate mapping relation for permuation. -//----------------------------------------------------------------------------- -Relation permute_relation(const std::vector &pi) { - const int n = pi.size(); - - Relation r(n, n); - F_And *f_root = r.add_and(); - - for (int i = 0; i < n; i++) { - EQ_Handle h = f_root->add_EQ(); - h.update_coef(r.output_var(i+1), 1); - h.update_coef(r.input_var(pi[i]+1), -1); - } - - return r; -} - - - -//--------------------------------------------------------------------------- -// Find the position index variable in a Relation by name. -//--------------------------------------------------------------------------- -Variable_ID find_index(Relation &r, const std::string &s, char side) { - // Omega quirks: assure the names are propagated inside the relation - r.setup_names(); - - if (r.is_set()) { // side == 's' - for (int i = 1; i <= r.n_set(); i++) { - std::string ss = r.set_var(i)->name(); - if (s == ss) { - return r.set_var(i); - } - } - } - else if (side == 'w') { - for (int i = 1; i <= r.n_inp(); i++) { - std::string ss = r.input_var(i)->name(); - if (s == ss) { - return r.input_var(i); - } - } - } - else { // side == 'r' - for (int i = 1; i <= r.n_out(); i++) { - std::string ss = r.output_var(i)->name(); - if (s+"'" == ss) { - return r.output_var(i); - } - } - } - - return NULL; -} - -// EQ_Handle get_eq(const Relation &r, int dim, Var_Kind type) { -// Variable_ID v; -// switch (type) { -// case Set_Var: -// v = r.set_var(dim+1); -// break; -// case Input_Var: -// v = r.input_var(dim+1); -// break; -// case Output_Var: -// v = r.output_var(dim+1); -// break; -// default: -// return NULL; -// } -// for (DNF_iterator di(r.query_DNF()); di; di++) -// for (EQ_Iterator ei = (*di)->EQs(); ei; ei++) -// if ((*ei).get_coef(v) != 0) -// return (*ei); - -// return NULL; -// } - - -// std::Pair split_loop(const Relation &r, const Relation &cond) { -// Relation r1 = Intersection(copy(r), copy(cond)); -// Relation r2 = Intersection(copy(r), Complement(copy(cond))); - -// return std::Pair(r1, r2); -// } diff --git a/omegatools.hh b/omegatools.hh deleted file mode 100644 index 206079c..0000000 --- a/omegatools.hh +++ /dev/null @@ -1,97 +0,0 @@ -#ifndef OMEGATOOLS_HH -#define OMEGATOOLS_HH - -#include -#include -#include "dep.hh" -#include "ir_code.hh" - -std::string tmp_e(); - -void exp2formula(IR_Code *ir, omega::Relation &r, omega::F_And *f_root, - std::vector &freevars, - omega::CG_outputRepr *repr, omega::Variable_ID lhs, char side, - IR_CONDITION_TYPE rel, bool destroy); -omega::Relation arrays2relation(IR_Code *ir, std::vector &freevars, - const IR_ArrayRef *ref_src, const omega::Relation &IS_w, - const IR_ArrayRef *ref_dst, const omega::Relation &IS_r); -std::pair, std::vector > relation2dependences( - const IR_ArrayRef *ref_src, const IR_ArrayRef *ref_dst, const omega::Relation &r); - -void exp2constraint(IR_Code *ir, omega::Relation &r, omega::F_And *f_root, - std::vector &freevars, - omega::CG_outputRepr *repr, bool destroy); - -// suif legacy code -// void suif2formula(Relation &r, F_And *f_root, -// std::vector &freevars, -// operand op, Variable_ID lhs, -// char side, char rel); -// void suif2formula(Relation &r, F_And *f_root, -// std::vector &freevars, -// instruction *ins, Variable_ID lhs, -// char side, char rel); -// void add_loop_stride_constraints(omega::Relation &r, omega::F_And *f_root, -// std::vector &freevars, -// tree_for *tnf, char side); -// void add_loop_bound_constraints(IR_Code *ir, omega::Relation &r, omega::F_And *f_root, -// std::vector &freevars, -// tree_for *tnf, -// char upper_or_lower, char side, IR_CONDITION_TYPE rel); -// Relation loop_iteration_space(std::vector &freevars, -// tree_node *tn, std::vector &loops); - -// Relation arrays2relation(std::vector &freevars, -// in_array *ia_w, const Relation &IS1, -// in_array *ia_r, const Relation &IS2); -// std::vector relation2dependences(IR_Code *ir, in_array *ia_w, -// in_array *ia_r, const Relation &r); - -// end of suif legacy code - -bool is_single_iteration(const omega::Relation &r, int dim); -void assign_const(omega::Relation &r, int dim, int val); -int get_const(const omega::Relation &r, int dim, omega::Var_Kind type); -omega::Variable_ID find_index(omega::Relation &r, const std::string &s, char side); -omega::Relation permute_relation(const std::vector &pi); -omega::Relation get_loop_bound(const omega::Relation &r, int dim); -bool is_single_loop_iteration(const omega::Relation &r, int level, const omega::Relation &known); -omega::Relation get_loop_bound(const omega::Relation &r, int level, const omega::Relation &known); -omega::Relation get_max_loop_bound(const std::vector &r, int dim); -omega::Relation get_min_loop_bound(const std::vector &r, int dim); -void add_loop_stride(omega::Relation &r, const omega::Relation &bound, int dim, int stride); -bool is_inner_loop_depend_on_level(const omega::Relation &r, int level, const omega::Relation &known); -// void adjust_loop_bound(omega::Relation &r, int dim, int adjustment, std::vector globals = std::vector()); -omega::Relation adjust_loop_bound(const omega::Relation &r, int level, int adjustment); -// void adjust_loop_bound(Relation &r, int dim, int adjustment); -// void adjust_loop_bound(Relation &r, int dim, Free_Var_Decl *global_var, int adjustment); -// boolean is_private_statement(const omega::Relation &r, int dim); - -// coef_t mod(const Relation &r, Variable_ID v, int dividend); - - -enum LexicalOrderType {LEX_MATCH, LEX_BEFORE, LEX_AFTER, LEX_UNKNOWN}; - -// template -// LexicalOrderType lexical_order(const std::vector &a, const std::vector &b) { -// int size = min(a.size(), b.size()); -// for (int i = 0; i < size; i++) { -// if (a[i] < b[i]) -// return LEX_BEFORE; -// else if (b[i] < a[i]) -// return LEX_AFTER; -// } -// if (a.size() < b.size()) -// return LEX_BEFORE; -// else if (b.size() < a.size()) -// return LEX_AFTER; -// else -// return LEX_MATCH; -// } - -// struct LoopException { -// std::string descr; -// LoopException(const std::string &s): descr(s) {}; -// }; - -#endif diff --git a/parse_expr.ll b/parse_expr.ll deleted file mode 100644 index e97a1db..0000000 --- a/parse_expr.ll +++ /dev/null @@ -1,25 +0,0 @@ -%{ -// some C++ code -#include "chill_run_util.hh" -#include "parse_expr.tab.hh" -%} - -%option noyywrap -%option header-file="parse_expr.ll.hh" - -%% -[ \t]+ /*ignore*/ -\n /*ignore*/ -L[0-9]+ { yylval.val = atoi(&yytext[1]); return LEVEL; } -[0-9]+ { yylval.val = atoi(yytext); return NUMBER; } -\<\= return LE; -\>\= return GE; -\=(\=)? return EQ; -[a-zA-Z_][a-zA-Z_0-9]* { - yylval.str_val = new char[yyleng+1]; - strcpy(yylval.str_val, yytext); - return VARIABLE; - } -. return (int)yytext[0]; -%% - diff --git a/parse_expr.yy b/parse_expr.yy deleted file mode 100644 index c2943c2..0000000 --- a/parse_expr.yy +++ /dev/null @@ -1,85 +0,0 @@ -%{ -#include "chill_run_util.hh" -#include "parse_expr.ll.hh" - -extern int yydebug; - -void yyerror(const char*); -int yyparse(simap_vec_t** rel); - -static simap_vec_t* return_rel; // used as the return value for yyparse - -%} - -%union { - int val; - char* str_val; - simap_t* cond_item; - simap_vec_t* cond; -} - -%token NUMBER -%token LEVEL -%token VARIABLE - -%left LE GE EQ '<' '>' -%left '-' '+' '*' '/' - -/*the final output from this language should be an Omega Relation object*/ -%type cond prog -%type expr add_expr mul_expr neg_expr - -%% -prog : cond { return_rel = make_prog($1); } -; - -cond : expr '>' expr { $$ = make_cond_gt($1, $3); } - | expr '<' expr { $$ = make_cond_lt($1, $3); } - | expr GE expr { $$ = make_cond_ge($1, $3); } - | expr LE expr { $$ = make_cond_le($1, $3); } - | expr EQ expr { $$ = make_cond_eq($1, $3); } -; - -expr : add_expr { $$ = $1; } -; - -add_expr : add_expr '+' mul_expr { $$ = make_cond_item_add($1,$3); } - | add_expr '-' mul_expr { $$ = make_cond_item_sub($1,$3); } - | mul_expr { $$ = $1; } -; - -mul_expr : mul_expr '*' neg_expr { $$ = make_cond_item_mul($1,$3); } - | neg_expr { $$ = $1; } -; - -neg_expr : '-' neg_expr { $$ = make_cond_item_neg($2); } - | '(' expr ')' { $$ = $2; } - | NUMBER { $$ = make_cond_item_number($1); } - | LEVEL { $$ = make_cond_item_level($1); } - | VARIABLE { $$ = make_cond_item_variable($1); } -; -%% - -void yyerror(const char* msg) { - fprintf(stderr, "Parse error: %s", msg); -} - -simap_vec_t* parse_relation_vector(const char* expr) { - yydebug=0; - YY_BUFFER_STATE state; - - //if(yylex_init()) { - // TODO: error out or something - //} - - state = yy_scan_string(expr); - - if(yyparse()) { - // TODO: error out or something - } - - yy_delete_buffer(state); - yylex_destroy(); - return return_rel; -} - diff --git a/parser.ll b/parser.ll deleted file mode 100644 index 0545e1b..0000000 --- a/parser.ll +++ /dev/null @@ -1,97 +0,0 @@ -/***************************************************************************** - Copyright (C) 2008 University of Southern California. - All Rights Reserved. - - Purpose: - CHiLL script lexical analysis - - Update history: - created by Chun Chen, Jan 2008 -*****************************************************************************/ - -%{ -#include -#include -#include -#include -#include "parser.tab.hh" - -extern std::map parameter_tab; -extern bool is_interactive; -extern const char *PROMPT_STRING; -%} - -%s LINE COMMENT FILE_NAME PROCEDURE_NAME -%option yylineno -%option noyywrap - -%% -# BEGIN(COMMENT); -.* /* comment */ -source BEGIN(FILE_NAME); return SOURCE; -[^ \t\n:#]+ yylval.name = new char[yyleng+1]; strcpy(yylval.name, yytext); return FILENAME; -procedure BEGIN(LINE); return PROCEDURE; -loop BEGIN(LINE); return LOOP; -format BEGIN(FILE_NAME); return FORMAT; -original BEGIN(LINE); return ORIGINAL; -permute BEGIN(LINE); return PERMUTE; -pragma BEGIN(LINE); return PRAGMA; -prefetch BEGIN(LINE); return PREFETCH; -tile BEGIN(LINE); return TILE; -datacopy BEGIN(LINE); return DATACOPY; -datacopy_privatized BEGIN(LINE); return DATACOPY_PRIVATIZED; -unroll BEGIN(LINE); return UNROLL; -unroll_extra BEGIN(LINE); return UNROLL_EXTRA; -split BEGIN(LINE); return SPLIT; -nonsingular BEGIN(LINE); return NONSINGULAR; -print BEGIN(LINE); return PRINT; -dep BEGIN(LINE); return PRINT_DEP; -code BEGIN(LINE); return PRINT_CODE; -space BEGIN(LINE); return PRINT_IS; -exit BEGIN(LINE); return EXIT; -known BEGIN(LINE); return KNOWN; -strided BEGIN(LINE); return STRIDED; -counted BEGIN(LINE); return COUNTED; -num_statement BEGIN(LINE); return NUM_STATEMENT; -ceil BEGIN(LINE); return CEIL; -floor BEGIN(LINE); return FLOOR; -true BEGIN(LINE); yylval.bool_val = true; return TRUEORFALSE; -false BEGIN(LINE); yylval.bool_val = false; return TRUEORFALSE; -skew BEGIN(LINE); return SKEW; -shift BEGIN(LINE); return SHIFT; -scale BEGIN(LINE); return SCALE; -reverse BEGIN(LINE); return REVERSE; -shift_to BEGIN(LINE); return SHIFT_TO; -fuse BEGIN(LINE); return FUSE; -peel BEGIN(LINE); return PEEL; -distribute BEGIN(LINE); return DISTRIBUTE; -remove_dep BEGIN(LINE); return REMOVE_DEP; -structure BEGIN(LINE); return PRINT_STRUCTURE; -[ \t]+ /* ignore whitespaces */ -\n BEGIN(INITIAL); return (int)yytext[0]; -L[0-9]+ yylval.val = atoi(&yytext[1]); return LEVEL; -[a-zA-Z_][a-zA-Z_0-9]* { - BEGIN(LINE); - yylval.name = new char[yyleng+1]; - strcpy(yylval.name, yytext); - return VARIABLE; - } -\"(\\.|[^\\"])*\" { - BEGIN(LINE); - std::string str = std::string(yytext); - yylval.name = new char[yyleng-1]; - str = str.substr(1,yyleng-2); - strcpy(yylval.name, str.c_str()); - return STRING; - } -[0-9]+ yylval.val = atoi(yytext); return NUMBER; -\>\= return GE; -\<\= return LE; -\!\= return NE; -\=\= return EQ; -. return (int)yytext[0]; -<> BEGIN(INITIAL); unput('\n'); - -%% - - diff --git a/parser.yy b/parser.yy deleted file mode 100644 index 1559ab4..0000000 --- a/parser.yy +++ /dev/null @@ -1,1605 +0,0 @@ -/***************************************************************************** - Copyright (C) 2008 University of Southern California. - Copyright (C) 2009-2010 University of Utah. - All Rights Reserved. - - Purpose: - CHiLL script yacc parser - - Notes: - - History: - 01/2008 created by Chun Chen -*****************************************************************************/ - -%{ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "parser.tab.hh" - -#include -#include "ir_code.hh" -#include "loop.hh" - -#ifdef BUILD_ROSE -#include "ir_rose.hh" -#elif BUILD_SUIF -#include "ir_suif.hh" -#endif - - -using namespace omega; - -extern int yydebug; - -void yyerror(const char *); -int yylex(); -yyFlexLexer lexer; - -namespace { - enum COMPILER_IR_TYPE {CIT_NULL, CIT_SUIF, CIT_ROSE}; - char *source_filename = NULL; - COMPILER_IR_TYPE cit_name = CIT_NULL; - #ifdef BUILD_ROSE - char* procedure_name = NULL; - #elif BUILD_SUIF - int procedure_number = -1; - #endif - - int loop_num_start, loop_num_end; - Loop *myloop = NULL; -} - -#define PRINT_ERR_LINENO {if (is_interactive) fprintf(stderr, "\n"); else fprintf(stderr, " at line %d\n", lexer.lineno()-1);} - -std::map parameter_tab; -bool is_interactive; -const char *PROMPT_STRING = ">>>"; - -IR_Code *ir_code = NULL; -std::vector ir_controls; -std::vector loops; -%} - -%union { - int val; - float fval; - bool bool_val; - char *name; - std::vector *vec; - std::vector > *mat; - std::map *tab; - std::vector > *tab_lst; - std::pair >, std::map > *eq_term_pair; -} - -%token NUMBER LEVEL -%token TRUEORFALSE -%token FILENAME PROCEDURENAME VARIABLE FREEVAR STRING -%token SOURCE PROCEDURE FORMAT LOOP PERMUTE ORIGINAL TILE UNROLL SPLIT UNROLL_EXTRA PRAGMA PREFETCH -%token DATACOPY DATACOPY_PRIVATIZED -%token NONSINGULAR EXIT KNOWN SKEW SHIFT SHIFT_TO FUSE DISTRIBUTE REMOVE_DEP SCALE REVERSE PEEL -%token STRIDED COUNTED NUM_STATEMENT CEIL FLOOR -%token PRINT PRINT_CODE PRINT_DEP PRINT_IS PRINT_STRUCTURE -%token NE LE GE EQ - -%type vector vector_number -/* TODO: %type cond_term cond */ -%type cond_term -%type cond -%type matrix matrix_part -%type expr -%type float_expr - -%destructor {delete []$$; } FILENAME VARIABLE FREEVAR -%destructor {delete $$; } vector vector_number cond_term cond matrix matrix_part - -%left '>' '<' NE LE GE -%left '+' '-' -%left '*' '/' -%left '%' -%left UMINUS - - -%% -script : /* empty */ - | script command -; - - -vector : '[' vector_number ']' {$$ = $2;} -; - -vector_number : {$$ = new std::vector();} - | expr {$$ = new std::vector(); $$->push_back($1);} - | vector_number ',' expr {$$ = $1; $$->push_back($3);} -; - -matrix: '[' matrix_part ']' {$$ = $2;} - -matrix_part : vector {$$ = new std::vector >(); $$->push_back(*$1); delete $1;} - | matrix_part ',' vector {$$ = $1; $$->push_back(*$3); delete $3;} - -expr : NUMBER {$$ = $1;} - | VARIABLE { - std::map::iterator it = parameter_tab.find(std::string($1)); - if (it != parameter_tab.end()) { - $$ = it->second; - delete []$1; - } - else { - if (is_interactive) - fprintf(stderr, "variable \"%s\" undefined\n", $1); - else - fprintf(stderr, "variable \"%s\" undefined at line %d\n", $1, lexer.lineno()); - delete []$1; - if (!is_interactive) - exit(2); - } - } - | NUM_STATEMENT '(' ')' { - if (myloop == NULL) - $$ = 0; - else - $$ = myloop->num_statement(); - } - | CEIL '(' float_expr ')' { - $$ = ceil($3); - } - | FLOOR '(' float_expr ')' { - $$ = floor($3); - } - | '(' expr ')' {$$ = $2;} - | expr '-' expr {$$ = $1-$3;} - | expr '+' expr {$$ = $1+$3;} - | expr '*' expr {$$ = $1*$3;} - | expr '/' expr {$$ = $1/$3;} - | '-' expr %prec UMINUS {$$ = -$2;} -; - -float_expr : NUMBER {$$ = $1;} - | VARIABLE { - std::map::iterator it = parameter_tab.find(std::string($1)); - if (it != parameter_tab.end()) { - $$ = it->second; - delete []$1; - } - else { - if (is_interactive) - fprintf(stderr, "variable \"%s\" undefined\n", $1); - else - fprintf(stderr, "variable \"%s\" undefined at line %d\n", $1, lexer.lineno()); - delete []$1; - if (!is_interactive) - exit(2); - } - } - | NUM_STATEMENT '(' ')' { - if (myloop == NULL) - $$ = 0; - else - $$ = myloop->num_statement(); - } - | CEIL '(' float_expr ')' { - $$ = ceil($3); - } - | FLOOR '(' float_expr ')' { - $$ = floor($3); - } - | '(' float_expr ')' {$$ = $2;} - | float_expr '-' float_expr {$$ = $1-$3;} - | float_expr '+' float_expr {$$ = $1+$3;} - | float_expr '*' float_expr {$$ = $1*$3;} - | float_expr '/' float_expr {$$ = $1/$3;} - | '-' float_expr %prec UMINUS {$$ = -$2;} -; - - -cond : cond_term GE cond_term { - for (std::map::iterator it = $3->begin(); it != $3->end(); it++) - (*$1)[it->first] -= it->second; - $$ = new std::vector >(); - $$->push_back(*$1); - delete $1; - delete $3; - } - | cond_term '>' cond_term { - for (std::map::iterator it = $3->begin(); it != $3->end(); it++) - (*$1)[it->first] -= it->second; - $$ = new std::vector >(); - (*$1)[to_string(0)] -= 1; - $$->push_back(*$1); - delete $1; - delete $3; - } - | cond_term LE cond_term { - for (std::map::iterator it = $1->begin(); it != $1->end(); it++) - (*$3)[it->first] -= it->second; - $$ = new std::vector >(); - $$->push_back(*$3); - delete $1; - delete $3; - } - | cond_term '<' cond_term { - for (std::map::iterator it = $1->begin(); it != $1->end(); it++) - (*$3)[it->first] -= it->second; - $$ = new std::vector >(); - (*$3)[to_string(0)] -= 1; - $$->push_back(*$3); - delete $1; - delete $3; - } - | cond_term EQ cond_term { - for (std::map::iterator it = $3->begin(); it != $3->end(); it++) - (*$1)[it->first] -= it->second; - $$ = new std::vector >(); - $$->push_back(*$1); - for (std::map::iterator it = $1->begin(); it != $1->end(); it++) - it->second = -it->second; - $$->push_back(*$1); - delete $1; - delete $3; - } -; - -cond_term : NUMBER {$$ = new std::map(); (*$$)[to_string(0)] = $1;} - | LEVEL {$$ = new std::map(); (*$$)[to_string($1)] = 1;} - | VARIABLE { - $$ = new std::map(); - - std::map::iterator it = parameter_tab.find(std::string($1)); - if (it != parameter_tab.end()) - (*$$)[to_string(0)] = it->second; - else - (*$$)[std::string($1)] = 1; - - delete []$1; - } - | '(' cond_term ')' {$$ = $2;} - | cond_term '-' cond_term { - for (std::map::iterator it = $3->begin(); it != $3->end(); it++) - (*$1)[it->first] -= it->second; - $$ = $1; - delete $3; - } - | cond_term '+' cond_term { - for (std::map::iterator it = $3->begin(); it != $3->end(); it++) - (*$1)[it->first] += it->second; - $$ = $1; - delete $3; - } - | cond_term '*' cond_term { - (*$1)[to_string(0)] += 0; - (*$3)[to_string(0)] += 0; - if ($1->size() == 1) { - int t = (*$1)[to_string(0)]; - for (std::map::iterator it = $3->begin(); it != $3->end(); it++) - it->second *= t; - $$ = $3; - delete $1; - } - else if ($3->size() == 1) { - int t = (*$3)[to_string(0)]; - for (std::map::iterator it = $1->begin(); it != $1->end(); it++) - it->second *= t; - $$ = $1; - delete $3; - } - else { - if (is_interactive) - fprintf(stderr, "require Presburger formula\n"); - else - fprintf(stderr, "require Presburger formula at line %d\n", lexer.lineno()); - delete $1; - delete $3; - exit(2); - } - } - | '-' cond_term %prec UMINUS { - for (std::map::iterator it = $2->begin(); it != $2->end(); it++) - it->second = -(it->second); - $$ = $2; - } -; - -command : '\n' { if (is_interactive) printf("%s ", PROMPT_STRING); } - | error '\n' { if (!is_interactive) exit(2); else printf("%s ", PROMPT_STRING); } - | SOURCE ':' FILENAME '\n' { - if (source_filename != NULL) { - fprintf(stderr, "only one file can be handle in a script"); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - source_filename = $3; - if (is_interactive) - printf("%s ", PROMPT_STRING); - } - | PROCEDURE ':' VARIABLE '\n' { - - #ifdef BUILD_ROSE - - if (procedure_name != NULL) { - fprintf(stderr, "only one procedure can be handled in a script"); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - procedure_name = $3; - if (is_interactive) - printf("%s ", PROMPT_STRING); - #elif BUILD_SUIF - fprintf(stderr, "Please specify procedure number and not name!!"); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - #else - fprintf(stderr, "Please configure IR type to ROSE or SUIF!!: Procedure number for SUIF and procedure name for ROSE"); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - #endif - } - | PROCEDURE ':' NUMBER '\n' { - - #ifdef BUILD_ROSE - fprintf(stderr, "Please specify procedure's name and not number!!"); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - - #elif BUILD_SUIF - if (procedure_number != -1) { - fprintf(stderr, "only one procedure can be handled in a script"); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - procedure_number = $3; - if (is_interactive) - printf("%s ", PROMPT_STRING); - #else - fprintf(stderr, "Please configure IR type to ROSE or SUIF: Procedure number for suif and procedure name for rose!!"); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - #endif - } - | FORMAT ':' FILENAME '\n' { - if (cit_name != CIT_NULL) { - fprintf(stderr, "compiler intermediate format already specified"); - PRINT_ERR_LINENO; - delete []$3; - if (!is_interactive) - exit(2); - } - else { - - if (std::string($3) == "suif" || std::string($3) == "SUIF") { - cit_name = CIT_SUIF; - delete []$3; - } - else if(std::string($3) == "rose" || std::string($3) == "ROSE") { - cit_name = CIT_ROSE; - delete []$3; - } - else { - fprintf(stderr, "unrecognized IR format"); - PRINT_ERR_LINENO; - delete []$3; - if (!is_interactive) - exit(2); - } - } - if (is_interactive) - printf("%s ", PROMPT_STRING); - } - | LOOP ':' NUMBER '\n' { - if (source_filename == NULL) { - fprintf(stderr, "source file not set when initializing the loop"); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - else { - if (ir_code == NULL) { - #ifdef BUILD_ROSE - if (procedure_name == NULL) - procedure_name = "main"; - #elif BUILD_SUIF - if (procedure_number == -1) - procedure_number = 0; - #endif - - switch (cit_name) { - #ifndef BUILD_ROSE - case CIT_SUIF: - #ifdef BUILD_SUIF - ir_code = new IR_suifCode(source_filename, procedure_number); - #else - fprintf(stderr, "SUIF IR not installed"); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - #endif - break; - #endif - case CIT_ROSE: - #ifdef BUILD_ROSE - ir_code = new IR_roseCode(source_filename, procedure_name); - #else - fprintf(stderr, "ROSE IR not installed"); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - #endif - break; - case CIT_NULL: - fprintf(stderr, "compiler IR format not specified"); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - break; - } - - IR_Block *block = ir_code->GetCode(); - ir_controls = ir_code->FindOneLevelControlStructure(block); - for (int i = 0; i < ir_controls.size(); i++) - if (ir_controls[i]->type() == IR_CONTROL_LOOP) - loops.push_back(i); - delete block; - } - if (myloop != NULL && myloop->isInitialized()) { - if (loop_num_start == loop_num_end) { - ir_code->ReplaceCode(ir_controls[loops[loop_num_start]], myloop->getCode()); - ir_controls[loops[loop_num_start]] = NULL; - } - else { - std::vector parm; - for (int i = loops[loop_num_start]; i <= loops[loop_num_end]; i++) - parm.push_back(ir_controls[i]); - IR_Block *block = ir_code->MergeNeighboringControlStructures(parm); - ir_code->ReplaceCode(block, myloop->getCode()); - for (int i = loops[loop_num_start]; i <= loops[loop_num_end]; i++) { - delete ir_controls[i]; - ir_controls[i] = NULL; - } - } - delete myloop; - } - loop_num_start = loop_num_end = $3; - if (loop_num_start >= loops.size()) { - fprintf(stderr, "loop %d does not exist", loop_num_start); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - if (ir_controls[loops[loop_num_start]] == NULL) { - fprintf(stderr, "loop %d has already be transformed", loop_num_start); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - myloop = new Loop(ir_controls[loops[loop_num_start]]); - } - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | LOOP ':' NUMBER '-' NUMBER '\n' { - if (source_filename == NULL) { - fprintf(stderr, "source file not set when initializing the loop"); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - else { - if (ir_code == NULL) { - #ifdef BUILD_ROSE - if (procedure_name == NULL) - procedure_name = "main"; - #elif BUILD_SUIF - if (procedure_number == -1) - procedure_number = 0; - #endif - - switch (cit_name) { - #ifndef BUILD_ROSE - case CIT_SUIF: - #ifdef BUILD_SUIF - ir_code = new IR_suifCode(source_filename, procedure_number); - #else - fprintf(stderr, "SUIF IR not installed"); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - #endif - break; - #endif - case CIT_ROSE: - #ifdef BUILD_ROSE - ir_code = new IR_roseCode(source_filename, procedure_name); - #else - fprintf(stderr, "ROSE IR not installed"); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - #endif - break; - case CIT_NULL: - fprintf(stderr, "compiler IR format not specified"); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - break; - } - - - - IR_Block *block = ir_code->GetCode(); - ir_controls = ir_code->FindOneLevelControlStructure(block); - for (int i = 0; i < ir_controls.size(); i++) - if (ir_controls[i]->type() == IR_CONTROL_LOOP) - loops.push_back(i); - delete block; - } - if (myloop != NULL && myloop->isInitialized()) { - if (loop_num_start == loop_num_end) { - ir_code->ReplaceCode(ir_controls[loops[loop_num_start]], myloop->getCode()); - ir_controls[loops[loop_num_start]] = NULL; - } - else { - std::vector parm; - for (int i = loops[loop_num_start]; i <= loops[loop_num_end]; i++) - parm.push_back(ir_controls[i]); - IR_Block *block = ir_code->MergeNeighboringControlStructures(parm); - ir_code->ReplaceCode(block, myloop->getCode()); - for (int i = loops[loop_num_start]; i <= loops[loop_num_end]; i++) { - delete ir_controls[i]; - ir_controls[i] = NULL; - } - } - delete myloop; - } - loop_num_start = $3; - loop_num_end = $5; - if ($5 < $3) { - fprintf(stderr, "the last loop must be after the start loop"); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - if (loop_num_end >= loops.size()) { - fprintf(stderr, "loop %d does not exist", loop_num_end); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - std::vector parm; - for (int i = loops[loop_num_start]; i <= loops[loop_num_end]; i++) { - if (ir_controls[i] == NULL) { - fprintf(stderr, "loop has already been processed"); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - parm.push_back(ir_controls[i]); - } - IR_Block *block = ir_code->MergeNeighboringControlStructures(parm); - myloop = new Loop(block); - delete block; - - } - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | PRINT '\n' { - if (myloop == NULL) { - fprintf(stderr, "loop not initialized"); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - else { - myloop->printCode(); - } - if (is_interactive) printf("%s ", PROMPT_STRING); else printf("\n"); - } - | PRINT PRINT_CODE '\n' { - if (myloop == NULL) { - fprintf(stderr, "loop not initialized"); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - else { - if (!is_interactive) { - if (loop_num_start != loop_num_end) - std::cout << "/* procedure :" << procedure_name << " loop #" << loop_num_start << "-" << loop_num_end << " */" << std::endl; - else - std::cout << "/* procedure :" << procedure_name << " loop #" << loop_num_start << " */" << std::endl; - - } - - myloop->printCode(); - } - if (is_interactive) printf("%s ", PROMPT_STRING); else printf("\n"); - } - | PRINT PRINT_DEP '\n' { - if (myloop == NULL) { - fprintf(stderr, "loop not initialized"); - PRINT_ERR_LINENO; - if (!is_interactive) - YYABORT; - } - else { - myloop->printDependenceGraph(); - } - if (is_interactive) printf("%s ", PROMPT_STRING); else printf("\n"); - } - | PRINT PRINT_IS '\n' { - if (myloop == NULL) { - fprintf(stderr, "loop not initialized"); - PRINT_ERR_LINENO; - if (!is_interactive) - YYABORT; - } - else { - myloop->printIterationSpace(); - } - if (is_interactive) printf("%s ", PROMPT_STRING); else printf("\n"); - } - | PRINT PRINT_STRUCTURE '\n' { - if (myloop == NULL) { - fprintf(stderr, "loop not initialized"); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - else { - myloop->print_internal_loop_structure(); - } - if (is_interactive) printf("%s ", PROMPT_STRING); else printf("\n"); - } - | PRINT expr '\n' { -/* if (parameter_tab.find(std::string($2)) == parameter_tab.end()) { - fprintf(stderr, "cannot print undefined variable %s\n", $2); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - std::cout << parameter_tab[std::string($2)] << std::endl; -*/ - std::cout << $2 << std::endl; - if (is_interactive) printf("%s ", PROMPT_STRING); else printf("\n"); - } - | EXIT '\n' { return(0); } - | VARIABLE '=' expr '\n' { - parameter_tab[std::string($1)] = $3; - delete []$1; - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | KNOWN '(' cond ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - int num_dim = myloop->known.n_set(); - Relation rel(num_dim); - F_And *f_root = rel.add_and(); - for (int j = 0; j < $3->size(); j++) { - GEQ_Handle h = f_root->add_GEQ(); - for (std::map::iterator it = (*$3)[j].begin(); it != (*$3)[j].end(); it++) { - try { - int dim = from_string(it->first); - if (dim == 0) - h.update_const(it->second); - else - throw std::invalid_argument("only symbolic variables are allowed in known condition"); - } - catch (std::ios::failure e) { - Free_Var_Decl *g = NULL; - for (unsigned i = 0; i < myloop->freevar.size(); i++) { - std::string name = myloop->freevar[i]->base_name(); - if (name == it->first) { - g = myloop->freevar[i]; - break; - } - } - if (g == NULL) - throw std::invalid_argument("symbolic variable " + it->first + " not found"); - else - h.update_coef(rel.get_local(g), it->second); - } - } - } - myloop->addKnown(rel); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) { - delete $3; - exit(2); - } - } - delete $3; - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | REMOVE_DEP '(' NUMBER ',' NUMBER ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - myloop->removeDependence($3, $5); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) - YYABORT; - } - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | ORIGINAL '(' ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - myloop->original(); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | PERMUTE '(' vector ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - myloop->permute(*$3); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) { - delete $3; - exit(2); - } - } - delete $3; - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | PERMUTE '(' expr ',' NUMBER ',' vector ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - myloop->permute($3, $5, *$7); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) { - delete $7; - exit(2); - } - } - delete $7; - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | PERMUTE '(' vector ',' vector ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - std::set active; - for (int i = 0; i < (*$3).size(); i++) - active.insert((*$3)[i]); - - myloop->permute(active, *$5); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) { - delete $3; - delete $5; - exit(2); - } - } - delete $3; - delete $5; - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | PRAGMA '(' NUMBER ',' NUMBER ',' STRING ')' '\n' { - myloop->pragma($3,$5,$7); - } - | PREFETCH '(' NUMBER ',' NUMBER ',' STRING ',' expr ')' '\n' { - myloop->prefetch($3, $5, $7, $9); - } - | TILE '(' expr ',' NUMBER ',' expr ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - myloop->tile($3,$5,$7); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | TILE '(' expr',' NUMBER ',' expr ',' NUMBER ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - myloop->tile($3,$5,$7,$9); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | TILE '(' expr ',' NUMBER ',' expr ',' NUMBER ',' STRIDED ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - myloop->tile($3,$5,$7,$9,StridedTile); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | TILE '(' expr ',' NUMBER ',' expr ',' NUMBER ',' STRIDED ',' expr ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - myloop->tile($3,$5,$7,$9,StridedTile,$13); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | TILE '(' expr ',' NUMBER ',' expr ',' NUMBER ',' STRIDED ',' expr ',' expr ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - myloop->tile($3,$5,$7,$9,StridedTile,$13,$15); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | TILE '(' expr ',' NUMBER ',' expr ',' NUMBER ',' COUNTED ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - myloop->tile($3,$5,$7,$9,CountedTile); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | TILE '(' expr ',' NUMBER ',' expr ',' NUMBER ',' COUNTED ',' expr ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - myloop->tile($3,$5,$7,$9,CountedTile,$13); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | TILE '(' expr ',' NUMBER ',' expr ',' NUMBER ',' COUNTED ',' expr ',' expr ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - myloop->tile($3,$5,$7,$9,CountedTile,$13,$15); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | DATACOPY '(' matrix ',' NUMBER ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - std::vector > > array_ref_nums((*$3).size()); - for (int i = 0; i < (*$3).size(); i++) { - if ((*$3)[i].size() <= 1) - throw std::invalid_argument("statement missing in the first parameter"); - array_ref_nums[i].first = (*$3)[i][0]; - for (int j = 1; j < (*$3)[i].size(); j++) - array_ref_nums[i].second.push_back((*$3)[i][j]); - } - myloop->datacopy(array_ref_nums,$5); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) { - delete $3; - exit(2); - } - } - delete $3; - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | DATACOPY '(' matrix ',' NUMBER ',' TRUEORFALSE ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - std::vector > > array_ref_nums((*$3).size()); - for (int i = 0; i < (*$3).size(); i++) { - if ((*$3)[i].size() <= 1) - throw std::invalid_argument("statement missing in the first parameter"); - array_ref_nums[i].first = (*$3)[i][0]; - for (int j = 1; j < (*$3)[i].size(); j++) - array_ref_nums[i].second.push_back((*$3)[i][j]); - } - myloop->datacopy(array_ref_nums,$5,$7); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) { - delete $3; - exit(2); - } - } - delete $3; - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | DATACOPY '(' matrix ',' NUMBER ',' TRUEORFALSE ',' expr ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - std::vector > > array_ref_nums((*$3).size()); - for (int i = 0; i < (*$3).size(); i++) { - if ((*$3)[i].size() <= 1) - throw std::invalid_argument("statement missing in the first parameter"); - array_ref_nums[i].first = (*$3)[i][0]; - for (int j = 1; j < (*$3)[i].size(); j++) - array_ref_nums[i].second.push_back((*$3)[i][j]); - } - myloop->datacopy(array_ref_nums,$5,$7,$9); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) { - delete $3; - exit(2); - } - } - delete $3; - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | DATACOPY '(' matrix ',' NUMBER ',' TRUEORFALSE ',' expr ',' expr ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - std::vector > > array_ref_nums((*$3).size()); - for (int i = 0; i < (*$3).size(); i++) { - if ((*$3)[i].size() <= 1) - throw std::invalid_argument("statement missing in the first parameter"); - array_ref_nums[i].first = (*$3)[i][0]; - for (int j = 1; j < (*$3)[i].size(); j++) - array_ref_nums[i].second.push_back((*$3)[i][j]); - } - myloop->datacopy(array_ref_nums,$5,$7,$9,$11); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) { - delete $3; - exit(2); - } - } - delete $3; - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | DATACOPY '(' matrix ',' NUMBER ',' TRUEORFALSE ',' expr ',' expr ',' expr ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - std::vector > > array_ref_nums((*$3).size()); - for (int i = 0; i < (*$3).size(); i++) { - if ((*$3)[i].size() <= 1) - throw std::invalid_argument("statement missing in the first parameter"); - array_ref_nums[i].first = (*$3)[i][0]; - for (int j = 1; j < (*$3)[i].size(); j++) - array_ref_nums[i].second.push_back((*$3)[i][j]); - } - myloop->datacopy(array_ref_nums,$5,$7,$9,$11,$13); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) { - delete $3; - exit(2); - } - } - delete $3; - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | DATACOPY '(' expr ',' NUMBER ',' VARIABLE ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - myloop->datacopy($3,$5,$7); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) { - delete []$7; - exit(2); - } - } - delete []$7; - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | DATACOPY '(' expr ',' NUMBER ',' VARIABLE ',' TRUEORFALSE ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - myloop->datacopy($3,$5,$7,$9); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) { - delete []$7; - exit(2); - } - } - delete []$7; - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | DATACOPY '(' expr ',' NUMBER ',' VARIABLE ',' TRUEORFALSE ',' expr ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - myloop->datacopy($3,$5,$7,$9,$11); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) { - delete []$7; - exit(2); - } - } - delete []$7; - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | DATACOPY '(' expr ',' NUMBER ',' VARIABLE ',' TRUEORFALSE ',' expr ',' expr ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - myloop->datacopy($3,$5,$7,$9,$11,$13); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) { - delete []$7; - exit(2); - } - } - delete []$7; - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | DATACOPY '(' expr ',' NUMBER ',' VARIABLE ',' TRUEORFALSE ',' expr ',' expr ',' expr ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - myloop->datacopy($3,$5,$7,$9,$11,$13,$15); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) { - delete []$7; - exit(2); - } - } - delete []$7; - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | DATACOPY_PRIVATIZED '(' matrix ',' NUMBER ',' vector ',' TRUEORFALSE ',' expr ',' expr ',' expr ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - std::vector > > array_ref_nums((*$3).size()); - for (int i = 0; i < (*$3).size(); i++) { - if ((*$3)[i].size() <= 1) - throw std::invalid_argument("statement missing in the first parameter"); - array_ref_nums[i].first = (*$3)[i][0]; - for (int j = 1; j < (*$3)[i].size(); j++) - array_ref_nums[i].second.push_back((*$3)[i][j]); - } - myloop->datacopy_privatized(array_ref_nums,$5,*$7,$9,$11,$13,$15); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) { - delete $3; - delete $7; - exit(2); - } - } - delete $3; - delete $7; - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | DATACOPY_PRIVATIZED '(' expr ',' NUMBER ',' VARIABLE ',' vector ',' TRUEORFALSE ',' expr ',' expr ',' expr ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - myloop->datacopy_privatized($3,$5,$7,*$9,$11,$13,$15,$17); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) { - delete []$7; - delete $9; - exit(2); - } - } - delete []$7; - delete $9; - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | UNROLL '(' expr ',' NUMBER ',' expr ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - myloop->unroll($3,$5,$7); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | UNROLL '(' expr ',' NUMBER ',' expr ',' expr ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - myloop->unroll($3,$5,$7,std::vector< std::vector >(), $9); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | UNROLL_EXTRA '(' expr ',' NUMBER ',' expr ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - myloop->unroll_extra($3,$5,$7); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | UNROLL_EXTRA '(' expr ',' NUMBER ',' expr ',' expr ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - myloop->unroll_extra($3,$5,$7,$9); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | SPLIT '(' expr ',' NUMBER ',' cond ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - if ($3 < 0 || $3 >= myloop->num_statement()) - throw std::invalid_argument("invalid statement " + to_string($3)); - int num_dim = myloop->stmt[$3].xform.n_out(); - - Relation rel((num_dim-1)/2); - F_And *f_root = rel.add_and(); - for (int j = 0; j < $7->size(); j++) { - GEQ_Handle h = f_root->add_GEQ(); - for (std::map::iterator it = (*$7)[j].begin(); it != (*$7)[j].end(); it++) { - try { - int dim = from_string(it->first); - if (dim == 0) - h.update_const(it->second); - else { - if (dim > (num_dim-1)/2) - throw std::invalid_argument("invalid loop level " + to_string(dim) + " in split condition"); - h.update_coef(rel.set_var(dim), it->second); - } - } - catch (std::ios::failure e) { - Free_Var_Decl *g = NULL; - for (unsigned i = 0; i < myloop->freevar.size(); i++) { - std::string name = myloop->freevar[i]->base_name(); - if (name == it->first) { - g = myloop->freevar[i]; - break; - } - } - if (g == NULL) - throw std::invalid_argument("unrecognized variable " + to_string(it->first.c_str())); - h.update_coef(rel.get_local(g), it->second); - } - } - } - myloop->split($3,$5,rel); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) { - delete $7; - exit(2); - } - } - delete $7; - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | NONSINGULAR '(' matrix ')' '\n' { - try { - myloop->nonsingular(*$3); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) { - delete $3; - exit(2); - } - } - delete $3; - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | SKEW '(' vector ',' NUMBER ',' vector ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - std::set stmt_nums; - for (int i = 0; i < (*$3).size(); i++) - stmt_nums.insert((*$3)[i]); - myloop->skew(stmt_nums, $5, *$7); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) { - delete $3; - delete $7; - exit(2); - } - } - delete $3; - delete $7; - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | SCALE '(' vector ',' NUMBER ',' expr ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - std::set stmt_nums; - for (int i = 0; i < (*$3).size(); i++) - stmt_nums.insert((*$3)[i]); - myloop->scale(stmt_nums, $5, $7); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) { - delete $3; - exit(2); - } - } - delete $3; - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | REVERSE '(' vector ',' NUMBER ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - std::set stmt_nums; - for (int i = 0; i < (*$3).size(); i++) - stmt_nums.insert((*$3)[i]); - myloop->reverse(stmt_nums, $5); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) { - delete $3; - exit(2); - } - } - delete $3; - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | SHIFT '(' vector ',' NUMBER ',' expr ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - std::set stmt_nums; - for (int i = 0; i < (*$3).size(); i++) - stmt_nums.insert((*$3)[i]); - - myloop->shift(stmt_nums, $5, $7); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) { - delete $3; - exit(2); - } - } - delete $3; - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | SHIFT_TO '(' expr ',' NUMBER ',' expr ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - myloop->shift_to($3, $5, $7); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) { - exit(2); - } - } - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | PEEL '(' NUMBER ',' NUMBER ',' expr ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - myloop->peel($3, $5, $7); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) { - exit(2); - } - } - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | PEEL '(' NUMBER ',' NUMBER ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - myloop->peel($3, $5); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) { - exit(2); - } - } - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | FUSE '(' vector ',' NUMBER ')' '\n' { - try { - if (myloop == NULL) - throw std::runtime_error("loop not initialized"); - - std::set stmt_nums; - for (int i = 0; i < (*$3).size(); i++) - stmt_nums.insert((*$3)[i]); - - myloop->fuse(stmt_nums, $5); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) { - delete $3; - exit(2); - } - } - delete $3; - if (is_interactive) printf("%s ", PROMPT_STRING); - } - | DISTRIBUTE '(' vector ',' NUMBER ')' '\n' { - if (myloop == NULL) { - fprintf(stderr, "loop not initialized"); - PRINT_ERR_LINENO; - delete $3; - if (!is_interactive) - exit(2); - } - else { - std::set stmt_nums; - for (int i = 0; i < (*$3).size(); i++) - stmt_nums.insert((*$3)[i]); - delete $3; - try { - myloop->distribute(stmt_nums, $5); - } - catch (const std::exception &e) { - fprintf(stderr, e.what()); - PRINT_ERR_LINENO; - if (!is_interactive) - exit(2); - } - if (is_interactive) printf("%s ", PROMPT_STRING); - } - } -; - -%% - -inline int yylex() { return lexer.yylex();} - -void yyerror(const char *str) { - int err_lineno = lexer.lineno(); - if (lexer.YYText()[0] == '\n') - err_lineno--; - - if (is_interactive) - fprintf(stderr, "%s\n", str); - else - fprintf(stderr, "%s at line %d\n", str, err_lineno); -} - -int main(int argc, char *argv[]) { - yydebug = 0; - - if (argc > 2) { - fprintf(stderr, "Usage: %s [script_file]\n", argv[0]); - exit(-1); - } - - std::ifstream script; - if (argc == 2) { - script.open(argv[1]); - if (!script.is_open()) { - printf("can't open script file \"%s\"\n", argv[1]); - exit(-1); - } - lexer.switch_streams(&script, &std::cout); - } - - if (argc == 1 && isatty((int)fileno(stdin))) { - is_interactive = true; - printf("CHiLL v0.2.0 (built on %s)\n", CHILL_BUILD_DATE); - printf("Copyright (C) 2008 University of Southern California\n"); - printf("Copyright (C) 2009-2012 University of Utah\n"); - printf("%s ", PROMPT_STRING); - } - else - is_interactive = false; - - ir_code = NULL; - initializeOmega(); - - if (yyparse() == 0) { - if (!is_interactive) - fprintf(stderr, "script success!\n"); - else - printf("\n"); - if (ir_code != NULL && myloop != NULL && myloop->isInitialized()) { - if (loop_num_start == loop_num_end) { - ir_code->ReplaceCode(ir_controls[loops[loop_num_start]], myloop->getCode()); - ir_controls[loops[loop_num_start]] = NULL; - } - else { - std::vector parm; - for (int i = loops[loop_num_start]; i <= loops[loop_num_end]; i++) - parm.push_back(ir_controls[i]); - IR_Block *block = ir_code->MergeNeighboringControlStructures(parm); - ir_code->ReplaceCode(block, myloop->getCode()); - for (int i = loops[loop_num_start]; i <= loops[loop_num_end]; i++) { - delete ir_controls[i]; - ir_controls[i] = NULL; - } - } - } - } - - delete myloop; - for (int i = 0; i < ir_controls.size(); i++) - delete ir_controls[i]; - #ifdef BUILD_ROSE - ((IR_roseCode*)(ir_code))->finalizeRose(); - #endif - delete ir_code; - delete []source_filename; -} -- cgit v1.2.3-70-g09d2