GitLab will be upgraded to the 12.10.14-ce.0 on 28 Sept 2020 at 2.00pm (AEDT) to 2.30pm (AEDT). During the update, GitLab and Mattermost services will not be available. If you have any concerns with this, please talk to us at N110 (b) CSIT building.

Commit 51fc34c8 authored by John Zhang's avatar John Zhang

added cmpop tests, multiple function compilation test

parent 3d948653
......@@ -20,7 +20,6 @@ int main(int argc, char** argv) {
MuID id_8;
MuID id_9;
MuID id_10;
MuCString var;
mu = mu_fastimpl_new();
ctx = mu->new_context(mu);
bldr = ctx->new_ir_builder(ctx);
......@@ -44,7 +43,7 @@ int main(int argc, char** argv) {
bldr->new_bb(bldr, id_7, NULL, NULL, 0, MU_NO_ID, (MuInstNode [2]){id_9, id_10}, 2);
bldr->new_func_ver(bldr, id_6, id_5, (MuBBNode [1]){id_7}, 1);
bldr->load(bldr);
var = mu->compile_to_sharedlib(mu, id_5);
printf("%s\n", var);
mu->compile_to_sharedlib(mu, "test_add.dylib");
printf("%s\n", "test_add.dylib");
return 0;
}
......@@ -20,7 +20,6 @@ int main(int argc, char** argv) {
MuID id_78;
MuID id_79;
MuID id_80;
MuCString var_8;
mu_8 = mu_fastimpl_new();
ctx_8 = mu_8->new_context(mu_8);
bldr_8 = ctx_8->new_ir_builder(ctx_8);
......@@ -44,7 +43,7 @@ int main(int argc, char** argv) {
bldr_8->new_bb(bldr_8, id_77, NULL, NULL, 0, MU_NO_ID, (MuInstNode [2]){id_79, id_80}, 2);
bldr_8->new_func_ver(bldr_8, id_76, id_75, (MuBBNode [1]){id_77}, 1);
bldr_8->load(bldr_8);
var_8 = mu_8->compile_to_sharedlib(mu_8, id_75);
printf("%s\n", var_8);
mu_8->compile_to_sharedlib(mu_8, "test_and.dylib");
printf("%s\n", "test_and.dylib");
return 0;
}
......@@ -18,7 +18,6 @@ int main(int argc, char** argv) {
MuID id_6;
MuID id_7;
MuID id_8;
MuCString var;
mu = mu_fastimpl_new();
ctx = mu->new_context(mu);
bldr = ctx->new_ir_builder(ctx);
......@@ -38,7 +37,7 @@ int main(int argc, char** argv) {
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);
var = mu->compile_to_sharedlib(mu, id_4);
printf("%s\n", var);
mu->compile_to_sharedlib(mu, "test_constfunc.dylib");
printf("%s\n", "test_constfunc.dylib");
return 0;
}
// Compile with flag -std=c99
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <dlfcn.h>
#include "muapi.h"
#include "mu-fastimpl.h"
int main(int argc, char** argv) {
MuVM* mu_10;
MuCtx* ctx_10;
MuIRBuilder* bldr_10;
MuID id_91;
MuID id_92;
MuID id_93;
MuID id_94;
MuID id_95;
MuID id_96;
MuID id_97;
MuID id_98;
MuID id_99;
MuID id_100;
MuID id_101;
MuID id_102;
MuID id_103;
mu_10 = mu_fastimpl_new();
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");
bldr_10->new_type_int(bldr_10, id_91, 1);
id_92 = bldr_10->gen_sym(bldr_10, "@i64");
bldr_10->new_type_int(bldr_10, id_92, 64);
id_93 = bldr_10->gen_sym(bldr_10, "@0x8d9f9c1d58324b55_i64");
bldr_10->new_const_int(bldr_10, id_93, id_92, 10205046930492509013);
id_94 = bldr_10->gen_sym(bldr_10, "@0xd5a8f2deb00debb4_i64");
bldr_10->new_const_int(bldr_10, id_94, id_92, 15395822364416404404);
id_95 = bldr_10->gen_sym(bldr_10, "@sig__i64");
bldr_10->new_funcsig(bldr_10, id_95, NULL, 0, (MuTypeNode [1]){id_92}, 1);
id_96 = bldr_10->gen_sym(bldr_10, "@test_fnc");
bldr_10->new_func(bldr_10, id_96, id_95);
id_97 = bldr_10->gen_sym(bldr_10, "@test_fnc_v1");
id_98 = bldr_10->gen_sym(bldr_10, "@test_fnc_v1.blk0");
id_99 = bldr_10->gen_sym(bldr_10, "@test_fnc_v1.blk0.cmp_res");
id_100 = bldr_10->gen_sym(bldr_10, "@test_fnc_v1.blk0.res");
id_101 = bldr_10->gen_sym(bldr_10, NULL);
bldr_10->new_cmp(bldr_10, id_101, id_99, MU_CMP_EQ, id_92, id_93, id_94);
id_102 = bldr_10->gen_sym(bldr_10, NULL);
bldr_10->new_conv(bldr_10, id_102, id_100, MU_CONV_ZEXT, id_91, id_92, id_99);
id_103 = bldr_10->gen_sym(bldr_10, NULL);
bldr_10->new_ret(bldr_10, id_103, (MuVarNode [1]){id_100}, 1);
bldr_10->new_bb(bldr_10, id_98, NULL, NULL, 0, MU_NO_ID, (MuInstNode [3]){id_101, id_102, id_103}, 3);
bldr_10->new_func_ver(bldr_10, id_97, id_96, (MuBBNode [1]){id_98}, 1);
bldr_10->load(bldr_10);
mu_10->compile_to_sharedlib(mu_10, "test_eq_int.dylib");
printf("%s\n", "test_eq_int.dylib");
return 0;
}
// Compile with flag -std=c99
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <dlfcn.h>
#include "muapi.h"
#include "mu-fastimpl.h"
int main(int argc, char** argv) {
MuVM* mu_11;
MuCtx* ctx_11;
MuIRBuilder* bldr_11;
MuID id_104;
MuID id_105;
MuID id_106;
MuID id_107;
MuID id_108;
MuID id_109;
MuID id_110;
MuID id_111;
MuID id_112;
MuID id_113;
MuID id_114;
MuID id_115;
MuID id_116;
MuID id_117;
MuID id_118;
mu_11 = mu_fastimpl_new();
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");
bldr_11->new_type_int(bldr_11, id_104, 1);
id_105 = bldr_11->gen_sym(bldr_11, "@i64");
bldr_11->new_type_int(bldr_11, id_105, 64);
id_106 = bldr_11->gen_sym(bldr_11, "@refi64");
bldr_11->new_type_ref(bldr_11, id_106, id_105);
id_107 = bldr_11->gen_sym(bldr_11, "@NULL_refi64");
bldr_11->new_const_null(bldr_11, id_107, id_106);
id_108 = bldr_11->gen_sym(bldr_11, "@sig__i64");
bldr_11->new_funcsig(bldr_11, id_108, NULL, 0, (MuTypeNode [1]){id_105}, 1);
id_109 = bldr_11->gen_sym(bldr_11, "@test_fnc");
bldr_11->new_func(bldr_11, id_109, id_108);
id_110 = bldr_11->gen_sym(bldr_11, "@test_fnc_v1");
id_111 = bldr_11->gen_sym(bldr_11, "@test_fnc_v1.blk0");
id_112 = bldr_11->gen_sym(bldr_11, "@test_fnc_v1.blk0.r");
id_113 = bldr_11->gen_sym(bldr_11, "@test_fnc_v1.blk0.cmp_res");
id_114 = bldr_11->gen_sym(bldr_11, "@test_fnc_v1.blk0.res");
id_115 = bldr_11->gen_sym(bldr_11, NULL);
bldr_11->new_new(bldr_11, id_115, id_112, id_105, MU_NO_ID);
id_116 = bldr_11->gen_sym(bldr_11, NULL);
bldr_11->new_cmp(bldr_11, id_116, id_113, MU_CMP_EQ, id_106, id_112, id_107);
id_117 = bldr_11->gen_sym(bldr_11, NULL);
bldr_11->new_conv(bldr_11, id_117, id_114, MU_CONV_ZEXT, id_104, id_105, id_113);
id_118 = bldr_11->gen_sym(bldr_11, NULL);
bldr_11->new_ret(bldr_11, id_118, (MuVarNode [1]){id_114}, 1);
bldr_11->new_bb(bldr_11, id_111, NULL, NULL, 0, MU_NO_ID, (MuInstNode [4]){id_115, id_116, id_117, id_118}, 4);
bldr_11->new_func_ver(bldr_11, id_110, id_109, (MuBBNode [1]){id_111}, 1);
bldr_11->load(bldr_11);
mu_11->compile_to_sharedlib(mu_11, "test_eq_ref.dylib");
printf("%s\n", "test_eq_ref.dylib");
return 0;
}
......@@ -39,7 +39,6 @@ int main(int argc, char** argv) {
MuID id_27;
MuID id_28;
MuID id_29;
MuCString var;
mu = mu_fastimpl_new();
ctx = mu->new_context(mu);
bldr = ctx->new_ir_builder(ctx);
......@@ -94,7 +93,7 @@ int main(int argc, char** argv) {
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);
var = mu->compile_to_sharedlib(mu, id_6);
printf("%s\n", var);
mu->compile_to_sharedlib(mu, "test_fib.dylib");
printf("%s\n", "test_fib.dylib");
return 0;
}
......@@ -20,7 +20,6 @@ int main(int argc, char** argv) {
MuID id_68;
MuID id_69;
MuID id_70;
MuCString var_7;
mu_7 = mu_fastimpl_new();
ctx_7 = mu_7->new_context(mu_7);
bldr_7 = ctx_7->new_ir_builder(ctx_7);
......@@ -44,7 +43,7 @@ int main(int argc, char** argv) {
bldr_7->new_bb(bldr_7, id_67, NULL, NULL, 0, MU_NO_ID, (MuInstNode [2]){id_69, id_70}, 2);
bldr_7->new_func_ver(bldr_7, id_66, id_65, (MuBBNode [1]){id_67}, 1);
bldr_7->load(bldr_7);
var_7 = mu_7->compile_to_sharedlib(mu_7, id_65);
printf("%s\n", var_7);
mu_7->compile_to_sharedlib(mu_7, "test_lshr.dylib");
printf("%s\n", "test_lshr.dylib");
return 0;
}
......@@ -20,7 +20,6 @@ int main(int argc, char** argv) {
MuID id_28;
MuID id_29;
MuID id_30;
MuCString var_3;
mu_3 = mu_fastimpl_new();
ctx_3 = mu_3->new_context(mu_3);
bldr_3 = ctx_3->new_ir_builder(ctx_3);
......@@ -44,7 +43,7 @@ int main(int argc, char** argv) {
bldr_3->new_bb(bldr_3, id_27, NULL, NULL, 0, MU_NO_ID, (MuInstNode [2]){id_29, id_30}, 2);
bldr_3->new_func_ver(bldr_3, id_26, id_25, (MuBBNode [1]){id_27}, 1);
bldr_3->load(bldr_3);
var_3 = mu_3->compile_to_sharedlib(mu_3, id_25);
printf("%s\n", var_3);
mu_3->compile_to_sharedlib(mu_3, "test_mul.dylib");
printf("%s\n", "test_mul.dylib");
return 0;
}
// Compile with flag -std=c99
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <dlfcn.h>
#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;
MuID id_30;
MuID id_31;
MuID id_32;
MuID id_33;
MuID id_34;
MuID id_35;
MuID id_36;
MuID id_37;
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, "@20_i64");
bldr->new_const_int(bldr, id_5, id, 20);
id_6 = bldr->gen_sym(bldr, "@sig_i64_i64");
bldr->new_funcsig(bldr, id_6, (MuTypeNode [1]){id}, 1, (MuTypeNode [1]){id}, 1);
id_7 = bldr->gen_sym(bldr, "@sig__i64");
bldr->new_funcsig(bldr, id_7, NULL, 0, (MuTypeNode [1]){id}, 1);
id_8 = bldr->gen_sym(bldr, "@fib");
bldr->new_func(bldr, id_8, id_6);
id_9 = bldr->gen_sym(bldr, "@fib_v1");
id_10 = bldr->gen_sym(bldr, "@fib_v1.blk0");
id_11 = bldr->gen_sym(bldr, "@fib_v1.blk1");
id_12 = bldr->gen_sym(bldr, "@fib_v1.blk2");
id_13 = bldr->gen_sym(bldr, "@fib_v1.blk0.k");
id_14 = bldr->gen_sym(bldr, NULL);
id_15 = bldr->gen_sym(bldr, NULL);
id_16 = bldr->gen_sym(bldr, NULL);
bldr->new_dest_clause(bldr, id_14, id_12, (MuVarNode [1]){id_13}, 1);
bldr->new_dest_clause(bldr, id_15, id_11, (MuVarNode [1]){id_2}, 1);
bldr->new_dest_clause(bldr, id_16, id_11, (MuVarNode [1]){id_3}, 1);
id_17 = bldr->gen_sym(bldr, NULL);
bldr->new_switch(bldr, id_17, id, id_13, id_14, (MuConstNode [2]){id_2, id_3}, (MuDestClause [2]){id_15, id_16}, 2);
bldr->new_bb(bldr, id_10, (MuID [1]){id_13}, (MuTypeNode [1]){id}, 1, MU_NO_ID, (MuInstNode [1]){id_17}, 1);
id_18 = bldr->gen_sym(bldr, "@fig_v1.blk1.rtn");
id_19 = bldr->gen_sym(bldr, NULL);
bldr->new_ret(bldr, id_19, (MuVarNode [1]){id_18}, 1);
bldr->new_bb(bldr, id_11, (MuID [1]){id_18}, (MuTypeNode [1]){id}, 1, MU_NO_ID, (MuInstNode [1]){id_19}, 1);
id_20 = bldr->gen_sym(bldr, "@fig_v1.blk2.k");
id_21 = bldr->gen_sym(bldr, "@fig_v1.blk2.k_1");
id_22 = bldr->gen_sym(bldr, "@fig_v1.blk2.k_2");
id_23 = bldr->gen_sym(bldr, "@fig_v1.blk2.res");
id_24 = bldr->gen_sym(bldr, "@fig_v1.blk2.res1");
id_25 = bldr->gen_sym(bldr, "@fig_v1.blk2.res2");
id_26 = bldr->gen_sym(bldr, NULL);
bldr->new_binop(bldr, id_26, id_21, MU_BINOP_SUB, id, id_20, id_3, MU_NO_ID);
id_27 = bldr->gen_sym(bldr, NULL);
bldr->new_call(bldr, id_27, (MuID [1]){id_24}, 1, id_6, id_8, (MuVarNode [1]){id_21}, 1, MU_NO_ID, MU_NO_ID);
id_28 = bldr->gen_sym(bldr, NULL);
bldr->new_binop(bldr, id_28, id_22, MU_BINOP_SUB, id, id_20, id_4, MU_NO_ID);
id_29 = bldr->gen_sym(bldr, NULL);
bldr->new_call(bldr, id_29, (MuID [1]){id_25}, 1, id_6, id_8, (MuVarNode [1]){id_22}, 1, MU_NO_ID, MU_NO_ID);
id_30 = bldr->gen_sym(bldr, NULL);
bldr->new_binop(bldr, id_30, id_23, MU_BINOP_ADD, id, id_24, id_25, MU_NO_ID);
id_31 = bldr->gen_sym(bldr, NULL);
bldr->new_ret(bldr, id_31, (MuVarNode [1]){id_23}, 1);
bldr->new_bb(bldr, id_12, (MuID [1]){id_20}, (MuTypeNode [1]){id}, 1, MU_NO_ID, (MuInstNode [6]){id_26, id_27, id_28, id_29, id_30, id_31}, 6);
bldr->new_func_ver(bldr, id_9, id_8, (MuBBNode [3]){id_10, id_11, id_12}, 3);
id_32 = bldr->gen_sym(bldr, "@entry");
bldr->new_func(bldr, id_32, id_7);
id_33 = bldr->gen_sym(bldr, "@entry_v1");
id_34 = bldr->gen_sym(bldr, "@entry_v1.blk0");
id_35 = bldr->gen_sym(bldr, "@entry_v1.blk0.res");
id_36 = bldr->gen_sym(bldr, NULL);
bldr->new_call(bldr, id_36, (MuID [1]){id_35}, 1, id_6, id_8, (MuVarNode [1]){id_5}, 1, MU_NO_ID, MU_NO_ID);
id_37 = bldr->gen_sym(bldr, NULL);
bldr->new_ret(bldr, id_37, (MuVarNode [1]){id_35}, 1);
bldr->new_bb(bldr, id_34, NULL, NULL, 0, MU_NO_ID, (MuInstNode [2]){id_36, id_37}, 2);
bldr->new_func_ver(bldr, id_33, id_32, (MuBBNode [1]){id_34}, 1);
bldr->load(bldr);
mu->compile_to_sharedlib(mu, "test_multifunc.dylib");
printf("%s\n", "test_multifunc.dylib");
return 0;
}
// Compile with flag -std=c99
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <dlfcn.h>
#include "muapi.h"
#include "mu-fastimpl.h"
int main(int argc, char** argv) {
MuVM* mu_12;
MuCtx* ctx_12;
MuIRBuilder* bldr_12;
MuID id_119;
MuID id_120;
MuID id_121;
MuID id_122;
MuID id_123;
MuID id_124;
MuID id_125;
MuID id_126;
MuID id_127;
MuID id_128;
MuID id_129;
MuID id_130;
MuID id_131;
mu_12 = mu_fastimpl_new();
ctx_12 = mu_12->new_context(mu_12);
bldr_12 = ctx_12->new_ir_builder(ctx_12);
id_119 = bldr_12->gen_sym(bldr_12, "@i1");
bldr_12->new_type_int(bldr_12, id_119, 1);
id_120 = bldr_12->gen_sym(bldr_12, "@i64");
bldr_12->new_type_int(bldr_12, id_120, 64);
id_121 = bldr_12->gen_sym(bldr_12, "@0x8d9f9c1d58324b55_i64");
bldr_12->new_const_int(bldr_12, id_121, id_120, 10205046930492509013);
id_122 = bldr_12->gen_sym(bldr_12, "@0xd5a8f2deb00debb4_i64");
bldr_12->new_const_int(bldr_12, id_122, id_120, 15395822364416404404);
id_123 = bldr_12->gen_sym(bldr_12, "@sig__i64");
bldr_12->new_funcsig(bldr_12, id_123, NULL, 0, (MuTypeNode [1]){id_120}, 1);
id_124 = bldr_12->gen_sym(bldr_12, "@test_fnc");
bldr_12->new_func(bldr_12, id_124, id_123);
id_125 = bldr_12->gen_sym(bldr_12, "@test_fnc_v1");
id_126 = bldr_12->gen_sym(bldr_12, "@test_fnc_v1.blk0");
id_127 = bldr_12->gen_sym(bldr_12, "@test_fnc_v1.blk0.cmp_res");
id_128 = bldr_12->gen_sym(bldr_12, "@test_fnc_v1.blk0.res");
id_129 = bldr_12->gen_sym(bldr_12, NULL);
bldr_12->new_cmp(bldr_12, id_129, id_127, MU_CMP_NE, id_120, id_121, id_122);
id_130 = bldr_12->gen_sym(bldr_12, NULL);
bldr_12->new_conv(bldr_12, id_130, id_128, MU_CONV_ZEXT, id_119, id_120, id_127);
id_131 = bldr_12->gen_sym(bldr_12, NULL);
bldr_12->new_ret(bldr_12, id_131, (MuVarNode [1]){id_128}, 1);
bldr_12->new_bb(bldr_12, id_126, NULL, NULL, 0, MU_NO_ID, (MuInstNode [3]){id_129, id_130, id_131}, 3);
bldr_12->new_func_ver(bldr_12, id_125, id_124, (MuBBNode [1]){id_126}, 1);
bldr_12->load(bldr_12);
mu_12->compile_to_sharedlib(mu_12, "test_ne_int.dylib");
printf("%s\n", "test_ne_int.dylib");
return 0;
}
// Compile with flag -std=c99
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <dlfcn.h>
#include "muapi.h"
#include "mu-fastimpl.h"
int main(int argc, char** argv) {
MuVM* mu_13;
MuCtx* ctx_13;
MuIRBuilder* bldr_13;
MuID id_132;
MuID id_133;
MuID id_134;
MuID id_135;
MuID id_136;
MuID id_137;
MuID id_138;
MuID id_139;
MuID id_140;
MuID id_141;
MuID id_142;
MuID id_143;
MuID id_144;
MuID id_145;
MuID id_146;
mu_13 = mu_fastimpl_new();
ctx_13 = mu_13->new_context(mu_13);
bldr_13 = ctx_13->new_ir_builder(ctx_13);
id_132 = bldr_13->gen_sym(bldr_13, "@i1");
bldr_13->new_type_int(bldr_13, id_132, 1);
id_133 = bldr_13->gen_sym(bldr_13, "@i64");
bldr_13->new_type_int(bldr_13, id_133, 64);
id_134 = bldr_13->gen_sym(bldr_13, "@refi64");
bldr_13->new_type_ref(bldr_13, id_134, id_133);
id_135 = bldr_13->gen_sym(bldr_13, "@NULL_refi64");
bldr_13->new_const_null(bldr_13, id_135, id_134);
id_136 = bldr_13->gen_sym(bldr_13, "@sig__i64");
bldr_13->new_funcsig(bldr_13, id_136, NULL, 0, (MuTypeNode [1]){id_133}, 1);
id_137 = bldr_13->gen_sym(bldr_13, "@test_fnc");
bldr_13->new_func(bldr_13, id_137, id_136);
id_138 = bldr_13->gen_sym(bldr_13, "@test_fnc_v1");
id_139 = bldr_13->gen_sym(bldr_13, "@test_fnc_v1.blk0");
id_140 = bldr_13->gen_sym(bldr_13, "@test_fnc_v1.blk0.r");
id_141 = bldr_13->gen_sym(bldr_13, "@test_fnc_v1.blk0.cmp_res");
id_142 = bldr_13->gen_sym(bldr_13, "@test_fnc_v1.blk0.res");
id_143 = bldr_13->gen_sym(bldr_13, NULL);
bldr_13->new_new(bldr_13, id_143, id_140, id_133, MU_NO_ID);
id_144 = bldr_13->gen_sym(bldr_13, NULL);
bldr_13->new_cmp(bldr_13, id_144, id_141, MU_CMP_NE, id_134, id_140, id_135);
id_145 = bldr_13->gen_sym(bldr_13, NULL);
bldr_13->new_conv(bldr_13, id_145, id_142, MU_CONV_ZEXT, id_132, id_133, id_141);
id_146 = bldr_13->gen_sym(bldr_13, NULL);
bldr_13->new_ret(bldr_13, id_146, (MuVarNode [1]){id_142}, 1);
bldr_13->new_bb(bldr_13, id_139, NULL, NULL, 0, MU_NO_ID, (MuInstNode [4]){id_143, id_144, id_145, id_146}, 4);
bldr_13->new_func_ver(bldr_13, id_138, id_137, (MuBBNode [1]){id_139}, 1);
bldr_13->load(bldr_13);
mu_13->compile_to_sharedlib(mu_13, "test_ne_ref.dylib");
printf("%s\n", "test_ne_ref.dylib");
return 0;
}
......@@ -20,7 +20,6 @@ int main(int argc, char** argv) {
MuID id_38;
MuID id_39;
MuID id_40;
MuCString var_4;
mu_4 = mu_fastimpl_new();
ctx_4 = mu_4->new_context(mu_4);
bldr_4 = ctx_4->new_ir_builder(ctx_4);
......@@ -44,7 +43,7 @@ int main(int argc, char** argv) {
bldr_4->new_bb(bldr_4, id_37, NULL, NULL, 0, MU_NO_ID, (MuInstNode [2]){id_39, id_40}, 2);
bldr_4->new_func_ver(bldr_4, id_36, id_35, (MuBBNode [1]){id_37}, 1);
bldr_4->load(bldr_4);
var_4 = mu_4->compile_to_sharedlib(mu_4, id_35);
printf("%s\n", var_4);
mu_4->compile_to_sharedlib(mu_4, "test_sdiv.dylib");
printf("%s\n", "test_sdiv.dylib");
return 0;
}
// Compile with flag -std=c99
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <dlfcn.h>
#include "muapi.h"
#include "mu-fastimpl.h"
int main(int argc, char** argv) {
MuVM* mu_14;
MuCtx* ctx_14;
MuIRBuilder* bldr_14;
MuID id_147;
MuID id_148;
MuID id_149;
MuID id_150;
MuID id_151;
MuID id_152;
MuID id_153;
MuID id_154;
MuID id_155;
MuID id_156;
MuID id_157;
MuID id_158;
MuID id_159;
MuID id_160;
MuID id_161;
MuID id_162;
MuID id_163;
mu_14 = mu_fastimpl_new();
ctx_14 = mu_14->new_context(mu_14);
bldr_14 = ctx_14->new_ir_builder(ctx_14);
id_147 = bldr_14->gen_sym(bldr_14, "@i1");
bldr_14->new_type_int(bldr_14, id_147, 1);
id_148 = bldr_14->gen_sym(bldr_14, "@i8");
bldr_14->new_type_int(bldr_14, id_148, 8);
id_149 = bldr_14->gen_sym(bldr_14, "@0xff_i8");
bldr_14->new_const_int(bldr_14, id_149, id_148, 255);
id_150 = bldr_14->gen_sym(bldr_14, "@0x0a_i8");
bldr_14->new_const_int(bldr_14, id_150, id_148, 10);
id_151 = bldr_14->gen_sym(bldr_14, "@sig__i8");
bldr_14->new_funcsig(bldr_14, id_151, NULL, 0, (MuTypeNode [1]){id_148}, 1);
id_152 = bldr_14->gen_sym(bldr_14, "@test_fnc");
bldr_14->new_func(bldr_14, id_152, id_151);
id_153 = bldr_14->gen_sym(bldr_14, "@test_fnc_v1");
id_154 = bldr_14->gen_sym(bldr_14, "@test_fnc_v1.blk0");
id_155 = bldr_14->gen_sym(bldr_14, "@test_fnc_v1.blk0.cmp_res_1");
id_156 = bldr_14->gen_sym(bldr_14, "@test_fnc_v1.blk0.cmp_res_2");
id_157 = bldr_14->gen_sym(bldr_14, "@test_fnc_v1.blk0.bin_res");
id_158 = bldr_14->gen_sym(bldr_14, "@test_fnc_v1.blk0.res");
id_159 = bldr_14->gen_sym(bldr_14, NULL);
bldr_14->new_cmp(bldr_14, id_159, id_155, MU_CMP_SGE, id_148, id_149, id_150);
id_160 = bldr_14->gen_sym(bldr_14, NULL);
bldr_14->new_cmp(bldr_14, id_160, id_156, MU_CMP_SGE, id_148, id_149, id_149);
id_161 = bldr_14->gen_sym(bldr_14, NULL);
bldr_14->new_binop(bldr_14, id_161, id_157, MU_BINOP_XOR, id_147, id_155, id_156, MU_NO_ID);
id_162 = bldr_14->gen_sym(bldr_14, NULL);
bldr_14->new_conv(bldr_14, id_162, id_158, MU_CONV_ZEXT, id_147, id_148, id_157);
id_163 = bldr_14->gen_sym(bldr_14, NULL);
bldr_14->new_ret(bldr_14, id_163, (MuVarNode [1]){id_158}, 1);
bldr_14->new_bb(bldr_14, id_154, NULL, NULL, 0, MU_NO_ID, (MuInstNode [5]){id_159, id_160, id_161, id_162, id_163}, 5);
bldr_14->new_func_ver(bldr_14, id_153, id_152, (MuBBNode [1]){id_154}, 1);
bldr_14->load(bldr_14);
mu_14->compile_to_sharedlib(mu_14, "test_sge.dylib");
printf("%s\n", "test_sge.dylib");
return 0;
}
// Compile with flag -std=c99
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <dlfcn.h>
#include "muapi.h"
#include "mu-fastimpl.h"
int main(int argc, char** argv) {
MuVM* mu_15;
MuCtx* ctx_15;
MuIRBuilder* bldr_15;
MuID id_164;
MuID id_165;
MuID id_166;
MuID id_167;
MuID id_168;
MuID id_169;
MuID id_170;
MuID id_171;
MuID id_172;
MuID id_173;
MuID id_174;
MuID id_175;
MuID id_176;
MuID id_177;
MuID id_178;
MuID id_179;
MuID id_180;
mu_15 = mu_fastimpl_new();
ctx_15 = mu_15->new_context(mu_15);
bldr_15 = ctx_15->new_ir_builder(ctx_15);
id_164 = bldr_15->gen_sym(bldr_15, "@i1");
bldr_15->new_type_int(bldr_15, id_164, 1);
id_165 = bldr_15->gen_sym(bldr_15, "@i8");
bldr_15->new_type_int(bldr_15, id_165, 8);
id_166 = bldr_15->gen_sym(bldr_15, "@0xff_i8");
bldr_15->new_const_int(bldr_15, id_166, id_165, 255);
id_167 = bldr_15->gen_sym(bldr_15, "@0x0a_i8");
bldr_15->new_const_int(bldr_15, id_167, id_165, 10);
id_168 = bldr_15->gen_sym(bldr_15, "@sig__i8");
bldr_15->new_funcsig(bldr_15, id_168, NULL, 0, (MuTypeNode [1]){id_165}, 1);
id_169 = bldr_15->gen_sym(bldr_15, "@test_fnc");
bldr_15->new_func(bldr_15, id_169, id_168);
id_170 = bldr_15->gen_sym(bldr_15, "@test_fnc_v1");
id_171 = bldr_15->gen_sym(bldr_15, "@test_fnc_v1.blk0");
id_172 = bldr_15->gen_sym(bldr_15, "@test_fnc_v1.blk0.cmp_res_1");
id_173 = bldr_15->gen_sym(bldr_15, "@test_fnc_v1.blk0.cmp_res_2");
id_174 = bldr_15->gen_sym(bldr_15, "@test_fnc_v1.blk0.bin_res");
id_175 = bldr_15->gen_sym(bldr_15, "@test_fnc_v1.blk0.res");
id_176 = bldr_15->gen_sym(bldr_15, NULL);
bldr_15->new_cmp(bldr_15, id_176, id_172, MU_CMP_SGT, id_165, id_166, id_167);
id_177 = bldr_15->gen_sym(bldr_15, NULL);
bldr_15->new_cmp(bldr_15, id_177, id_173, MU_CMP_SGT, id_165, id_166, id_166);
id_178 = bldr_15->gen_sym(bldr_15, NULL);
bldr_15->new_binop(bldr_15, id_178, id_174, MU_BINOP_OR, id_164, id_172, id_173, MU_NO_ID);
id_179 = bldr_15->gen_sym(bldr_15, NULL);
bldr_15->new_conv(bldr_15, id_179, id_175, MU_CONV_ZEXT, id_164, id_165, id_174);
id_180 = bldr_15->gen_sym(bldr_15, NULL);
bldr_15->new_ret(bldr_15, id_180, (MuVarNode [1]){id_175}, 1);
bldr_15->new_bb(bldr_15, id_171, NULL, NULL, 0, MU_NO_ID, (MuInstNode [5]){id_176, id_177, id_178, id_179, id_180}, 5);
bldr_15->new_func_ver(bldr_15, id_170, id_169, (MuBBNode [1]){id_171}, 1);
bldr_15->load(bldr_15);
mu_15->compile_to_sharedlib(mu_15, "test_sgt.dylib");
printf("%s\n", "test_sgt.dylib");
return 0;
}
......@@ -20,7 +20,6 @@ int main(int argc, char** argv) {
MuID id_58;
MuID id_59;
MuID id_60;
MuCString var_6;
mu_6 = mu_fastimpl_new();
ctx_6 = mu_6->new_context(mu_6);
bldr_6 = ctx_6->new_ir_builder(ctx_6);
......@@ -44,7 +43,7 @@ int main(int argc, char** argv) {
bldr_6->new_bb(bldr_6, id_57, NULL, NULL, 0, MU_NO_ID, (MuInstNode [2]){id_59, id_60}, 2);
bldr_6->new_func_ver(bldr_6, id_56, id_55, (MuBBNode [1]){id_57}, 1);
bldr_6->load(bldr_6);
var_6 = mu_6->compile_to_sharedlib(mu_6, id_55);
printf("%s\n", var_6);
mu_6->compile_to_sharedlib(mu_6, "test_shl.dylib");
printf("%s\n", "test_shl.dylib");
return 0;
}
// Compile with flag -std=c99
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <dlfcn.h>
#include "muapi.h"
#include "mu-fastimpl.h"
int main(int argc, char** argv) {
MuVM* mu_16;
MuCtx* ctx_16;
MuIRBuilder* bldr_16;
MuID id_181;
MuID id_182;
MuID id_183;
MuID id_184;
MuID id_185;
MuID id_186;
MuID id_187;
MuID id_188;
MuID id_189;
MuID id_190;
MuID id_191;
MuID id_192;
MuID id_193;
MuID id_194;
MuID id_195;
MuID id_196;
MuID id_197;
mu_16 = mu_fastimpl_new();