Commit 3278d2ce authored by John Zhang's avatar John Zhang

create vm with option; set binary directory as /tmp

parent 6adde28c
......@@ -20,7 +20,7 @@ int main(int argc, char** argv) {
MuID id_8;
MuID id_9;
MuID id_10;
mu = mu_fastimpl_new();
mu = mu_fastimpl_new_with_opts("init_muinit_mu --log-level=none --aot-emit-dir=emit");
ctx = mu->new_context(mu);
bldr = ctx->new_ir_builder(ctx);
id = bldr->gen_sym(bldr, "@i8");
......
......@@ -20,7 +20,7 @@ int main(int argc, char** argv) {
MuID id_78;
MuID id_79;
MuID id_80;
mu_8 = mu_fastimpl_new();
mu_8 = mu_fastimpl_new_with_opts("init_muinit_mu --log-level=none --aot-emit-dir=emit");
ctx_8 = mu_8->new_context(mu_8);
bldr_8 = ctx_8->new_ir_builder(ctx_8);
id_71 = bldr_8->gen_sym(bldr_8, "@i64");
......
......@@ -25,7 +25,7 @@ int main(int argc, char** argv) {
MuID id_244;
MuID id_245;
MuID id_246;
mu_19 = mu_fastimpl_new();
mu_19 = mu_fastimpl_new_with_opts("init_muinit_mu --log-level=none --aot-emit-dir=emit");
ctx_19 = mu_19->new_context(mu_19);
bldr_19 = ctx_19->new_ir_builder(ctx_19);
id_232 = bldr_19->gen_sym(bldr_19, "@i64");
......
......@@ -37,7 +37,7 @@ int main(int argc, char** argv) {
MuID id_271;
MuID id_272;
MuID id_273;
mu_20 = mu_fastimpl_new();
mu_20 = mu_fastimpl_new_with_opts("init_muinit_mu --log-level=none --aot-emit-dir=emit");
ctx_20 = mu_20->new_context(mu_20);
bldr_20 = ctx_20->new_ir_builder(ctx_20);
id_247 = bldr_20->gen_sym(bldr_20, "@i8");
......
......@@ -7,45 +7,45 @@
#include "muapi.h"
#include "mu-fastimpl.h"
int main(int argc, char** argv) {
MuVM* mu;
MuCtx* ctx;
MuIRBuilder* bldr;
MuID id;
MuID id_2;
MuID id_3;
MuID id_4;
MuID id_5;
MuID id_6;
MuID id_7;
MuID id_8;
MuID id_9;
MuID id_10;
MuID id_11;
mu = mu_fastimpl_new();
ctx = mu->new_context(mu);
bldr = ctx->new_ir_builder(ctx);
id = bldr->gen_sym(bldr, "@i64");
bldr->new_type_int(bldr, id, 64);
id_2 = bldr->gen_sym(bldr, "@sig_i64_i64");
bldr->new_funcsig(bldr, id_2, (MuTypeNode [1]){id}, 1, (MuTypeNode [1]){id}, 1);
id_3 = bldr->gen_sym(bldr, "@fnpsig_i64_i64");
bldr->new_type_ufuncptr(bldr, id_3, id_2);
id_4 = bldr->gen_sym(bldr, "@c_fnc");
bldr->new_const_extern(bldr, id_4, id_3, "fnc");
id_5 = bldr->gen_sym(bldr, "@test_ccall");
bldr->new_func(bldr, id_5, id_2);
id_6 = bldr->gen_sym(bldr, "@test_ccall_v1");
id_7 = bldr->gen_sym(bldr, "@test_ccall_v1.blk0");
id_8 = bldr->gen_sym(bldr, "@test_ccall_v1.blk0.k");
id_9 = bldr->gen_sym(bldr, "@test_ccall_v1.blk0.res");
id_10 = bldr->gen_sym(bldr, NULL);
bldr->new_ccall(bldr, id_10, (MuID [1]){id_9}, 1, MU_CC_DEFAULT, id_3, id_2, id_4, (MuVarNode [1]){id_8}, 1, MU_NO_ID, MU_NO_ID);
id_11 = bldr->gen_sym(bldr, NULL);
bldr->new_ret(bldr, id_11, (MuVarNode [1]){id_9}, 1);
bldr->new_bb(bldr, id_7, (MuID [1]){id_8}, (MuTypeNode [1]){id}, 1, MU_NO_ID, (MuInstNode [2]){id_10, id_11}, 2);
bldr->new_func_ver(bldr, id_6, id_5, (MuBBNode [1]){id_7}, 1);
bldr->load(bldr);
mu->compile_to_sharedlib(mu, "test_ccall.dylib", (char*[]){&"../suite/test_ccall_fnc.c"}, 1);
MuVM* mu_21;
MuCtx* ctx_21;
MuIRBuilder* bldr_21;
MuID id_274;
MuID id_275;
MuID id_276;
MuID id_277;
MuID id_278;
MuID id_279;
MuID id_280;
MuID id_281;
MuID id_282;
MuID id_283;
MuID id_284;
mu_21 = mu_fastimpl_new_with_opts("init_muinit_mu --log-level=none --aot-emit-dir=emit");
ctx_21 = mu_21->new_context(mu_21);
bldr_21 = ctx_21->new_ir_builder(ctx_21);
id_274 = bldr_21->gen_sym(bldr_21, "@i64");
bldr_21->new_type_int(bldr_21, id_274, 64);
id_275 = bldr_21->gen_sym(bldr_21, "@sig_i64_i64");
bldr_21->new_funcsig(bldr_21, id_275, (MuTypeNode [1]){id_274}, 1, (MuTypeNode [1]){id_274}, 1);
id_276 = bldr_21->gen_sym(bldr_21, "@fnpsig_i64_i64");
bldr_21->new_type_ufuncptr(bldr_21, id_276, id_275);
id_277 = bldr_21->gen_sym(bldr_21, "@c_fnc");
bldr_21->new_const_extern(bldr_21, id_277, id_276, "fnc");
id_278 = bldr_21->gen_sym(bldr_21, "@test_ccall");
bldr_21->new_func(bldr_21, id_278, id_275);
id_279 = bldr_21->gen_sym(bldr_21, "@test_ccall_v1");
id_280 = bldr_21->gen_sym(bldr_21, "@test_ccall_v1.blk0");
id_281 = bldr_21->gen_sym(bldr_21, "@test_ccall_v1.blk0.k");
id_282 = bldr_21->gen_sym(bldr_21, "@test_ccall_v1.blk0.res");
id_283 = bldr_21->gen_sym(bldr_21, NULL);
bldr_21->new_ccall(bldr_21, id_283, (MuID [1]){id_282}, 1, MU_CC_DEFAULT, id_276, id_275, id_277, (MuVarNode [1]){id_281}, 1, MU_NO_ID, MU_NO_ID);
id_284 = bldr_21->gen_sym(bldr_21, NULL);
bldr_21->new_ret(bldr_21, id_284, (MuVarNode [1]){id_282}, 1);
bldr_21->new_bb(bldr_21, id_280, (MuID [1]){id_281}, (MuTypeNode [1]){id_274}, 1, MU_NO_ID, (MuInstNode [2]){id_283, id_284}, 2);
bldr_21->new_func_ver(bldr_21, id_279, id_278, (MuBBNode [1]){id_280}, 1);
bldr_21->load(bldr_21);
mu_21->compile_to_sharedlib(mu_21, "test_ccall.dylib", (char*[]){&"suite/test_ccall_fnc.c"}, 1);
printf("%s\n", "test_ccall.dylib");
return 0;
}
......@@ -7,37 +7,37 @@
#include "muapi.h"
#include "mu-fastimpl.h"
int main(int argc, char** argv) {
MuVM* mu;
MuCtx* ctx;
MuIRBuilder* bldr;
MuID id;
MuID id_2;
MuID id_3;
MuID id_4;
MuID id_5;
MuID id_6;
MuID id_7;
MuID id_8;
mu = mu_fastimpl_new();
ctx = mu->new_context(mu);
bldr = ctx->new_ir_builder(ctx);
id = bldr->gen_sym(bldr, "@i32");
bldr->new_type_int(bldr, id, 8);
id_2 = bldr->gen_sym(bldr, "@0_i32");
bldr->new_const_int(bldr, id_2, id, 0);
id_3 = bldr->gen_sym(bldr, "@sig__i32");
bldr->new_funcsig(bldr, id_3, NULL, 0, (MuTypeNode [1]){id}, 1);
id_4 = bldr->gen_sym(bldr, "@test_fnc");
bldr->new_func(bldr, id_4, id_3);
id_5 = bldr->gen_sym(bldr, "@test_fnc_v1");
id_6 = bldr->gen_sym(bldr, "@test_fnc_v1.blk0");
id_7 = bldr->gen_sym(bldr, "@test_fnc_v1.blk0.res");
id_8 = bldr->gen_sym(bldr, NULL);
bldr->new_ret(bldr, id_8, (MuVarNode [1]){id_2}, 1);
bldr->new_bb(bldr, id_6, NULL, NULL, 0, MU_NO_ID, (MuInstNode [1]){id_8}, 1);
bldr->new_func_ver(bldr, id_5, id_4, (MuBBNode [1]){id_6}, 1);
bldr->load(bldr);
mu->compile_to_sharedlib(mu, "test_constfunc.dylib", NULL, 0);
MuVM* mu_32;
MuCtx* ctx_32;
MuIRBuilder* bldr_32;
MuID id_457;
MuID id_458;
MuID id_459;
MuID id_460;
MuID id_461;
MuID id_462;
MuID id_463;
MuID id_464;
mu_32 = mu_fastimpl_new_with_opts("init_muinit_mu --log-level=none --aot-emit-dir=emit");
ctx_32 = mu_32->new_context(mu_32);
bldr_32 = ctx_32->new_ir_builder(ctx_32);
id_457 = bldr_32->gen_sym(bldr_32, "@i32");
bldr_32->new_type_int(bldr_32, id_457, 8);
id_458 = bldr_32->gen_sym(bldr_32, "@0_i32");
bldr_32->new_const_int(bldr_32, id_458, id_457, 0);
id_459 = bldr_32->gen_sym(bldr_32, "@sig__i32");
bldr_32->new_funcsig(bldr_32, id_459, NULL, 0, (MuTypeNode [1]){id_457}, 1);
id_460 = bldr_32->gen_sym(bldr_32, "@test_fnc");
bldr_32->new_func(bldr_32, id_460, id_459);
id_461 = bldr_32->gen_sym(bldr_32, "@test_fnc_v1");
id_462 = bldr_32->gen_sym(bldr_32, "@test_fnc_v1.blk0");
id_463 = bldr_32->gen_sym(bldr_32, "@test_fnc_v1.blk0.res");
id_464 = bldr_32->gen_sym(bldr_32, NULL);
bldr_32->new_ret(bldr_32, id_464, (MuVarNode [1]){id_458}, 1);
bldr_32->new_bb(bldr_32, id_462, NULL, NULL, 0, MU_NO_ID, (MuInstNode [1]){id_464}, 1);
bldr_32->new_func_ver(bldr_32, id_461, id_460, (MuBBNode [1]){id_462}, 1);
bldr_32->load(bldr_32);
mu_32->compile_to_sharedlib(mu_32, "test_constfunc.dylib", NULL, 0);
printf("%s\n", "test_constfunc.dylib");
return 0;
}
......@@ -23,7 +23,7 @@ int main(int argc, char** argv) {
MuID id_101;
MuID id_102;
MuID id_103;
mu_10 = mu_fastimpl_new();
mu_10 = mu_fastimpl_new_with_opts("init_muinit_mu --log-level=none --aot-emit-dir=emit");
ctx_10 = mu_10->new_context(mu_10);
bldr_10 = ctx_10->new_ir_builder(ctx_10);
id_91 = bldr_10->gen_sym(bldr_10, "@i1");
......
......@@ -25,7 +25,7 @@ int main(int argc, char** argv) {
MuID id_116;
MuID id_117;
MuID id_118;
mu_11 = mu_fastimpl_new();
mu_11 = mu_fastimpl_new_with_opts("init_muinit_mu --log-level=none --aot-emit-dir=emit");
ctx_11 = mu_11->new_context(mu_11);
bldr_11 = ctx_11->new_ir_builder(ctx_11);
id_104 = bldr_11->gen_sym(bldr_11, "@i1");
......
......@@ -27,7 +27,7 @@ int main(int argc, char** argv) {
MuID id_299;
MuID id_300;
MuID id_301;
mu_22 = mu_fastimpl_new();
mu_22 = mu_fastimpl_new_with_opts("init_muinit_mu --log-level=none --aot-emit-dir=emit");
ctx_22 = mu_22->new_context(mu_22);
bldr_22 = ctx_22->new_ir_builder(ctx_22);
id_285 = bldr_22->gen_sym(bldr_22, "@i32");
......
......@@ -7,99 +7,99 @@
#include "muapi.h"
#include "mu-fastimpl.h"
int main(int argc, char** argv) {
MuVM* mu_28;
MuCtx* ctx_28;
MuIRBuilder* bldr_28;
MuID id_392;
MuID id_393;
MuID id_394;
MuID id_395;
MuID id_396;
MuID id_397;
MuID id_398;
MuID id_399;
MuID id_400;
MuID id_401;
MuID id_402;
MuID id_403;
MuID id_404;
MuID id_405;
MuID id_406;
MuID id_407;
MuID id_408;
MuID id_409;
MuID id_410;
MuID id_411;
MuID id_412;
MuID id_413;
MuID id_414;
MuID id_415;
MuID id_416;
MuID id_417;
MuID id_418;
MuID id_419;
MuID id_420;
MuID id_421;
MuID id_422;
MuID id_423;
mu_28 = mu_fastimpl_new();
ctx_28 = mu_28->new_context(mu_28);
bldr_28 = ctx_28->new_ir_builder(ctx_28);
id_392 = bldr_28->gen_sym(bldr_28, "@i64");
bldr_28->new_type_int(bldr_28, id_392, 64);
id_393 = bldr_28->gen_sym(bldr_28, "@0_i64");
bldr_28->new_const_int(bldr_28, id_393, id_392, 0);
id_394 = bldr_28->gen_sym(bldr_28, "@1_i64");
bldr_28->new_const_int(bldr_28, id_394, id_392, 1);
id_395 = bldr_28->gen_sym(bldr_28, "@sig_i64_i64");
bldr_28->new_funcsig(bldr_28, id_395, (MuTypeNode [1]){id_392}, 1, (MuTypeNode [1]){id_392}, 1);
id_396 = bldr_28->gen_sym(bldr_28, "@fac");
bldr_28->new_func(bldr_28, id_396, id_395);
id_397 = bldr_28->gen_sym(bldr_28, "@fac.v1");
id_398 = bldr_28->gen_sym(bldr_28, "@fac.v1.blk0");
id_399 = bldr_28->gen_sym(bldr_28, "@fac.v1.blk1");
id_400 = bldr_28->gen_sym(bldr_28, "@fac.v1.blk2");
id_401 = bldr_28->gen_sym(bldr_28, "@fac.v1.blk3");
id_402 = bldr_28->gen_sym(bldr_28, "@fac.v1.blk0.k");
id_403 = bldr_28->gen_sym(bldr_28, NULL);
bldr_28->new_dest_clause(bldr_28, id_403, id_399, (MuVarNode [3]){id_394, id_393, id_402}, 3);
id_404 = bldr_28->gen_sym(bldr_28, NULL);
bldr_28->new_branch(bldr_28, id_404, id_403);
bldr_28->new_bb(bldr_28, id_398, (MuID [1]){id_402}, (MuTypeNode [1]){id_392}, 1, MU_NO_ID, (MuInstNode [1]){id_404}, 1);
id_405 = bldr_28->gen_sym(bldr_28, "@fac.v1.blk1.prod");
id_406 = bldr_28->gen_sym(bldr_28, "@fac.v1.blk1.i");
id_407 = bldr_28->gen_sym(bldr_28, "@fac.v1.blk1.end");
id_408 = bldr_28->gen_sym(bldr_28, "@fac.v1.blk1.cmpres");
id_409 = bldr_28->gen_sym(bldr_28, NULL);
bldr_28->new_cmp(bldr_28, id_409, id_408, MU_CMP_EQ, id_392, id_406, id_407);
id_410 = bldr_28->gen_sym(bldr_28, NULL);
id_411 = bldr_28->gen_sym(bldr_28, NULL);
bldr_28->new_dest_clause(bldr_28, id_411, id_401, (MuVarNode [1]){id_405}, 1);
id_412 = bldr_28->gen_sym(bldr_28, NULL);
bldr_28->new_dest_clause(bldr_28, id_412, id_400, (MuVarNode [3]){id_405, id_406, id_407}, 3);
bldr_28->new_branch2(bldr_28, id_410, id_408, id_411, id_412);
bldr_28->new_bb(bldr_28, id_399, (MuID [3]){id_405, id_406, id_407}, (MuTypeNode [3]){id_392, id_392, id_392}, 3, MU_NO_ID, (MuInstNode [2]){id_409, id_410}, 2);
id_413 = bldr_28->gen_sym(bldr_28, "@fac.v1.blk2.prod");
id_414 = bldr_28->gen_sym(bldr_28, "@fac.v1.blk2.i");
id_415 = bldr_28->gen_sym(bldr_28, "@fac.v1.blk2.end");
id_416 = bldr_28->gen_sym(bldr_28, "@fac.v1.blk2.prod_res");
id_417 = bldr_28->gen_sym(bldr_28, "@fac.v1.blk2.i_res");
id_418 = bldr_28->gen_sym(bldr_28, NULL);
bldr_28->new_binop(bldr_28, id_418, id_417, MU_BINOP_ADD, id_392, id_414, id_394, MU_NO_ID);
id_419 = bldr_28->gen_sym(bldr_28, NULL);
bldr_28->new_binop(bldr_28, id_419, id_416, MU_BINOP_MUL, id_392, id_413, id_417, MU_NO_ID);
id_420 = bldr_28->gen_sym(bldr_28, NULL);
bldr_28->new_dest_clause(bldr_28, id_420, id_399, (MuVarNode [3]){id_416, id_417, id_415}, 3);
id_421 = bldr_28->gen_sym(bldr_28, NULL);
bldr_28->new_branch(bldr_28, id_421, id_420);
bldr_28->new_bb(bldr_28, id_400, (MuID [3]){id_413, id_414, id_415}, (MuTypeNode [3]){id_392, id_392, id_392}, 3, MU_NO_ID, (MuInstNode [3]){id_418, id_419, id_421}, 3);
id_422 = bldr_28->gen_sym(bldr_28, "@fac.v1.blk3.rtn");
id_423 = bldr_28->gen_sym(bldr_28, NULL);
bldr_28->new_ret(bldr_28, id_423, (MuVarNode [1]){id_422}, 1);
bldr_28->new_bb(bldr_28, id_401, (MuID [1]){id_422}, (MuTypeNode [1]){id_392}, 1, MU_NO_ID, (MuInstNode [1]){id_423}, 1);
bldr_28->new_func_ver(bldr_28, id_397, id_396, (MuBBNode [4]){id_398, id_399, id_400, id_401}, 4);
bldr_28->load(bldr_28);
mu_28->compile_to_sharedlib(mu_28, "test_fac.dylib", NULL, 0);
MuVM* mu_34;
MuCtx* ctx_34;
MuIRBuilder* bldr_34;
MuID id_494;
MuID id_495;
MuID id_496;
MuID id_497;
MuID id_498;
MuID id_499;
MuID id_500;
MuID id_501;
MuID id_502;
MuID id_503;
MuID id_504;
MuID id_505;
MuID id_506;
MuID id_507;
MuID id_508;
MuID id_509;
MuID id_510;
MuID id_511;
MuID id_512;
MuID id_513;
MuID id_514;
MuID id_515;
MuID id_516;
MuID id_517;
MuID id_518;
MuID id_519;
MuID id_520;
MuID id_521;
MuID id_522;
MuID id_523;
MuID id_524;
MuID id_525;
mu_34 = mu_fastimpl_new_with_opts("init_muinit_mu --log-level=none --aot-emit-dir=emit");
ctx_34 = mu_34->new_context(mu_34);
bldr_34 = ctx_34->new_ir_builder(ctx_34);
id_494 = bldr_34->gen_sym(bldr_34, "@i64");
bldr_34->new_type_int(bldr_34, id_494, 64);
id_495 = bldr_34->gen_sym(bldr_34, "@0_i64");
bldr_34->new_const_int(bldr_34, id_495, id_494, 0);
id_496 = bldr_34->gen_sym(bldr_34, "@1_i64");
bldr_34->new_const_int(bldr_34, id_496, id_494, 1);
id_497 = bldr_34->gen_sym(bldr_34, "@sig_i64_i64");
bldr_34->new_funcsig(bldr_34, id_497, (MuTypeNode [1]){id_494}, 1, (MuTypeNode [1]){id_494}, 1);
id_498 = bldr_34->gen_sym(bldr_34, "@fac");
bldr_34->new_func(bldr_34, id_498, id_497);
id_499 = bldr_34->gen_sym(bldr_34, "@fac.v1");
id_500 = bldr_34->gen_sym(bldr_34, "@fac.v1.blk0");
id_501 = bldr_34->gen_sym(bldr_34, "@fac.v1.blk1");
id_502 = bldr_34->gen_sym(bldr_34, "@fac.v1.blk2");
id_503 = bldr_34->gen_sym(bldr_34, "@fac.v1.blk3");
id_504 = bldr_34->gen_sym(bldr_34, "@fac.v1.blk0.k");
id_505 = bldr_34->gen_sym(bldr_34, NULL);
bldr_34->new_dest_clause(bldr_34, id_505, id_501, (MuVarNode [3]){id_496, id_495, id_504}, 3);
id_506 = bldr_34->gen_sym(bldr_34, NULL);
bldr_34->new_branch(bldr_34, id_506, id_505);
bldr_34->new_bb(bldr_34, id_500, (MuID [1]){id_504}, (MuTypeNode [1]){id_494}, 1, MU_NO_ID, (MuInstNode [1]){id_506}, 1);
id_507 = bldr_34->gen_sym(bldr_34, "@fac.v1.blk1.prod");
id_508 = bldr_34->gen_sym(bldr_34, "@fac.v1.blk1.i");
id_509 = bldr_34->gen_sym(bldr_34, "@fac.v1.blk1.end");
id_510 = bldr_34->gen_sym(bldr_34, "@fac.v1.blk1.cmpres");
id_511 = bldr_34->gen_sym(bldr_34, NULL);
bldr_34->new_cmp(bldr_34, id_511, id_510, MU_CMP_EQ, id_494, id_508, id_509);
id_512 = bldr_34->gen_sym(bldr_34, NULL);
id_513 = bldr_34->gen_sym(bldr_34, NULL);
bldr_34->new_dest_clause(bldr_34, id_513, id_503, (MuVarNode [1]){id_507}, 1);
id_514 = bldr_34->gen_sym(bldr_34, NULL);
bldr_34->new_dest_clause(bldr_34, id_514, id_502, (MuVarNode [3]){id_507, id_508, id_509}, 3);
bldr_34->new_branch2(bldr_34, id_512, id_510, id_513, id_514);
bldr_34->new_bb(bldr_34, id_501, (MuID [3]){id_507, id_508, id_509}, (MuTypeNode [3]){id_494, id_494, id_494}, 3, MU_NO_ID, (MuInstNode [2]){id_511, id_512}, 2);
id_515 = bldr_34->gen_sym(bldr_34, "@fac.v1.blk2.prod");
id_516 = bldr_34->gen_sym(bldr_34, "@fac.v1.blk2.i");
id_517 = bldr_34->gen_sym(bldr_34, "@fac.v1.blk2.end");
id_518 = bldr_34->gen_sym(bldr_34, "@fac.v1.blk2.prod_res");
id_519 = bldr_34->gen_sym(bldr_34, "@fac.v1.blk2.i_res");
id_520 = bldr_34->gen_sym(bldr_34, NULL);
bldr_34->new_binop(bldr_34, id_520, id_519, MU_BINOP_ADD, id_494, id_516, id_496, MU_NO_ID);
id_521 = bldr_34->gen_sym(bldr_34, NULL);
bldr_34->new_binop(bldr_34, id_521, id_518, MU_BINOP_MUL, id_494, id_515, id_519, MU_NO_ID);
id_522 = bldr_34->gen_sym(bldr_34, NULL);
bldr_34->new_dest_clause(bldr_34, id_522, id_501, (MuVarNode [3]){id_518, id_519, id_517}, 3);
id_523 = bldr_34->gen_sym(bldr_34, NULL);
bldr_34->new_branch(bldr_34, id_523, id_522);
bldr_34->new_bb(bldr_34, id_502, (MuID [3]){id_515, id_516, id_517}, (MuTypeNode [3]){id_494, id_494, id_494}, 3, MU_NO_ID, (MuInstNode [3]){id_520, id_521, id_523}, 3);
id_524 = bldr_34->gen_sym(bldr_34, "@fac.v1.blk3.rtn");
id_525 = bldr_34->gen_sym(bldr_34, NULL);
bldr_34->new_ret(bldr_34, id_525, (MuVarNode [1]){id_524}, 1);
bldr_34->new_bb(bldr_34, id_503, (MuID [1]){id_524}, (MuTypeNode [1]){id_494}, 1, MU_NO_ID, (MuInstNode [1]){id_525}, 1);
bldr_34->new_func_ver(bldr_34, id_499, id_498, (MuBBNode [4]){id_500, id_501, id_502, id_503}, 4);
bldr_34->load(bldr_34);
mu_34->compile_to_sharedlib(mu_34, "test_fac.dylib", NULL, 0);
printf("%s\n", "test_fac.dylib");
return 0;
}
......@@ -7,93 +7,93 @@
#include "muapi.h"
#include "mu-fastimpl.h"
int main(int argc, char** argv) {
MuVM* mu;
MuCtx* ctx;
MuIRBuilder* bldr;
MuID id;
MuID id_2;
MuID id_3;
MuID id_4;
MuID id_5;
MuID id_6;
MuID id_7;
MuID id_8;
MuID id_9;
MuID id_10;
MuID id_11;
MuID id_12;
MuID id_13;
MuID id_14;
MuID id_15;
MuID id_16;
MuID id_17;
MuID id_18;
MuID id_19;
MuID id_20;
MuID id_21;
MuID id_22;
MuID id_23;
MuID id_24;
MuID id_25;
MuID id_26;
MuID id_27;
MuID id_28;
MuID id_29;
mu = mu_fastimpl_new();
ctx = mu->new_context(mu);
bldr = ctx->new_ir_builder(ctx);
id = bldr->gen_sym(bldr, "@i64");
bldr->new_type_int(bldr, id, 64);
id_2 = bldr->gen_sym(bldr, "@0_i64");
bldr->new_const_int(bldr, id_2, id, 0);
id_3 = bldr->gen_sym(bldr, "@1_i64");
bldr->new_const_int(bldr, id_3, id, 1);
id_4 = bldr->gen_sym(bldr, "@2_i64");
bldr->new_const_int(bldr, id_4, id, 2);
id_5 = bldr->gen_sym(bldr, "@sig_i64_i64");
bldr->new_funcsig(bldr, id_5, (MuTypeNode [1]){id}, 1, (MuTypeNode [1]){id}, 1);
id_6 = bldr->gen_sym(bldr, "@fib");
bldr->new_func(bldr, id_6, id_5);
id_7 = bldr->gen_sym(bldr, "@fib_v1");
id_8 = bldr->gen_sym(bldr, "@fib_v1.blk0");
id_9 = bldr->gen_sym(bldr, "@fib_v1.blk1");
id_10 = bldr->gen_sym(bldr, "@fib_v1.blk2");
id_11 = bldr->gen_sym(bldr, "@fib_v1.blk0.k");
id_12 = bldr->gen_sym(bldr, NULL);
id_13 = bldr->gen_sym(bldr, NULL);
id_14 = bldr->gen_sym(bldr, NULL);
bldr->new_dest_clause(bldr, id_12, id_10, (MuVarNode [1]){id_11}, 1);
bldr->new_dest_clause(bldr, id_13, id_9, (MuVarNode [1]){id_2}, 1);
bldr->new_dest_clause(bldr, id_14, id_9, (MuVarNode [1]){id_3}, 1);
id_15 = bldr->gen_sym(bldr, NULL);
bldr->new_switch(bldr, id_15, id, id_11, id_12, (MuConstNode [2]){id_2, id_3}, (MuDestClause [2]){id_13, id_14}, 2);
bldr->new_bb(bldr, id_8, (MuID [1]){id_11}, (MuTypeNode [1]){id}, 1, MU_NO_ID, (MuInstNode [1]){id_15}, 1);
id_16 = bldr->gen_sym(bldr, "@fig_v1.blk1.rtn");
id_17 = bldr->gen_sym(bldr, NULL);
bldr->new_ret(bldr, id_17, (MuVarNode [1]){id_16}, 1);
bldr->new_bb(bldr, id_9, (MuID [1]){id_16}, (MuTypeNode [1]){id}, 1, MU_NO_ID, (MuInstNode [1]){id_17}, 1);
id_18 = bldr->gen_sym(bldr, "@fig_v1.blk2.k");
id_19 = bldr->gen_sym(bldr, "@fig_v1.blk2.k_1");
id_20 = bldr->gen_sym(bldr, "@fig_v1.blk2.k_2");
id_21 = bldr->gen_sym(bldr, "@fig_v1.blk2.res");
id_22 = bldr->gen_sym(bldr, "@fig_v1.blk2.res1");
id_23 = bldr->gen_sym(bldr, "@fig_v1.blk2.res2");
id_24 = bldr->gen_sym(bldr, NULL);
bldr->new_binop(bldr, id_24, id_19, MU_BINOP_SUB, id, id_18, id_3, MU_NO_ID);
id_25 = bldr->gen_sym(bldr, NULL);
bldr->new_call(bldr, id_25, (MuID [1]){id_22}, 1, id_5, id_6, (MuVarNode [1]){id_19}, 1, MU_NO_ID, MU_NO_ID);
id_26 = bldr->gen_sym(bldr, NULL);
bldr->new_binop(bldr, id_26, id_20, MU_BINOP_SUB, id, id_18, id_4, MU_NO_ID);
id_27 = bldr->gen_sym(bldr, NULL);
bldr->new_call(bldr, id_27, (MuID [1]){id_23}, 1, id_5, id_6, (MuVarNode [1]){id_20}, 1, MU_NO_ID, MU_NO_ID);
id_28 = bldr->gen_sym(bldr, NULL);
bldr->new_binop(bldr, id_28, id_21, MU_BINOP_ADD, id, id_22, id_23, MU_NO_ID);
id_29 = bldr->gen_sym(bldr, NULL);
bldr->new_ret(bldr, id_29, (MuVarNode [1]){id_21}, 1);
bldr->new_bb(bldr, id_10, (MuID [1]){id_18}, (MuTypeNode [1]){id}, 1, MU_NO_ID, (MuInstNode [6]){id_24, id_25, id_26, id_27, id_28, id_29}, 6);
bldr->new_func_ver(bldr, id_7, id_6, (MuBBNode [3]){id_8, id_9, id_10}, 3);
bldr->load(bldr);
mu->compile_to_sharedlib(mu, "test_fib.dylib", NULL, 0);
MuVM* mu_33;
MuCtx* ctx_33;
MuIRBuilder* bldr_33;
MuID id_465;
MuID id_466;
MuID id_467;
MuID id_468;
MuID id_469;
MuID id_470;
MuID id_471;
MuID id_472;
MuID id_473;
MuID id_474;
MuID id_475;
MuID id_476;
MuID id_477;
MuID id_478;
MuID id_479;
MuID id_480;
MuID id_481;
MuID id_482;
MuID id_483;
MuID id_484;
MuID id_485;
MuID id_486;
MuID id_487;
MuID id_488;
MuID id_489;
MuID id_490;
MuID id_491;
MuID id_492;
MuID id_493;
mu_33 = mu_fastimpl_new_with_opts("init_muinit_mu --log-level=none --aot-emit-dir=emit");
ctx_33 = mu_33->new_context(mu_33);
bldr_33 = ctx_33->new_ir_builder(ctx_33);
id_465 = bldr_33->gen_sym(bldr_33, "@i64");
bldr_33->new_type_int(bldr_33, id_465, 64);
id_466 = bldr_33->gen_sym(bldr_33, "@0_i64");
bldr_33->new_const_int(bldr_33, id_466, id_465, 0);
id_467 = bldr_33->gen_sym(bldr_33, "@1_i64");
bldr_33->new_const_int(bldr_33, id_467, id_465, 1);
id_468 = bldr_33->gen_sym(bldr_33, "@2_i64");
bldr_33->new_const_int(bldr_33, id_468, id_465, 2);
id_469 = bldr_33->gen_sym(bldr_33, "@sig_i64_i64");
bldr_33->new_funcsig(bldr_33, id_469, (MuTypeNode [1]){id_465}, 1, (MuTypeNode [1]){id_465}, 1);
id_470 = bldr_33->gen_sym(bldr_33, "@fib");
bldr_33->new_func(bldr_33, id_470, id_469);
id_471 = bldr_33->gen_sym(bldr_33, "@fib_v1");
id_472 = bldr_33->gen_sym(bldr_33, "@fib_v1.blk0");
id_473 = bldr_33->gen_sym(bldr_33, "@fib_v1.blk1");
id_474 = bldr_33->gen_sym(bldr_33, "@fib_v1.blk2");
id_475 = bldr_33->gen_sym(bldr_33, "@fib_v1.blk0.k");
id_476 = bldr_33->gen_sym(bldr_33, NULL);
id_477 = bldr_33->gen_sym(bldr_33, NULL);
id_478 = bldr_33->gen_sym(bldr_33, NULL);
bldr_33->new_dest_clause(bldr_33, id_476, id_474, (MuVarNode [1]){id_475}, 1);
bldr_33->new_dest_clause(bldr_33, id_477, id_473, (MuVarNode [1]){id_466}, 1);
bldr_33->new_dest_clause(bldr_33, id_478, id_473, (MuVarNode [1]){id_467}, 1);
id_479 = bldr_33->gen_sym(bldr_33, NULL);
bldr_33->new_switch(bldr_33, id_479, id_465, id_475, id_476, (MuConstNode [2]){id_466, id_467}, (MuDestClause [2]){id_477, id_478}, 2);
bldr_33->new_bb(bldr_33, id_472, (MuID [1]){id_475}, (MuTypeNode [1]){id_465}, 1, MU_NO_ID, (MuInstNode [1]){id_479}, 1);
id_480 = bldr_33->gen_sym(bldr_33, "@fig_v1.blk1.rtn");
id_481 = bldr_33->gen_sym(bldr_33, NULL);
bldr_33->new_ret(bldr_33, id_481, (MuVarNode [1]){id_480}, 1);
bldr_33->new_bb(bldr_33, id_473, (MuID [1]){id_480}, (MuTypeNode [1]){id_465}, 1, MU_NO_ID, (MuInstNode [1]){id_481}, 1);
id_482 = bldr_33->gen_sym(bldr_33, "@fig_v1.blk2.k");
id_483 = bldr_33->gen_sym(bldr_33, "@fig_v1.blk2.k_1");
id_484 = bldr_33->gen_sym(bldr_33, "@fig_v1.blk2.k_2");
id_485 = bldr_33->gen_sym(bldr_33, "@fig_v1.blk2.res");
id_486 = bldr_33->gen_sym(bldr_33, "@fig_v1.blk2.res1");