aboutsummaryrefslogtreecommitdiff
path: root/src/ir_print.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-06-09 00:22:43 -0400
committerAndrew Kelley <andrew@ziglang.org>2020-06-09 00:22:43 -0400
commit4302f276ed3083b4f261f9e50a9546c9877d2785 (patch)
treec857775bf067e7838764125d68210376491058c5 /src/ir_print.cpp
parent12051b02f1f455b85d5a519dd1747a67d4bb68d0 (diff)
parent42c95a64d67ec6fc2839fad36ef50bacc7545258 (diff)
downloadzig-4302f276ed3083b4f261f9e50a9546c9877d2785.tar.gz
zig-4302f276ed3083b4f261f9e50a9546c9877d2785.zip
Merge branch 'kubkon-wasm-instrinsics'
closes #5507
Diffstat (limited to 'src/ir_print.cpp')
-rw-r--r--src/ir_print.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/ir_print.cpp b/src/ir_print.cpp
index 3e50b7304f..c826d76e03 100644
--- a/src/ir_print.cpp
+++ b/src/ir_print.cpp
@@ -321,6 +321,10 @@ const char* ir_inst_src_type_str(IrInstSrcId id) {
return "SrcSpillBegin";
case IrInstSrcIdSpillEnd:
return "SrcSpillEnd";
+ case IrInstSrcIdWasmMemorySize:
+ return "SrcWasmMemorySize";
+ case IrInstSrcIdWasmMemoryGrow:
+ return "SrcWasmMemoryGrow";
}
zig_unreachable();
}
@@ -501,6 +505,10 @@ const char* ir_inst_gen_type_str(IrInstGenId id) {
return "GenNegation";
case IrInstGenIdNegationWrapping:
return "GenNegationWrapping";
+ case IrInstGenIdWasmMemorySize:
+ return "GenWasmMemorySize";
+ case IrInstGenIdWasmMemoryGrow:
+ return "GenWasmMemoryGrow";
}
zig_unreachable();
}
@@ -1708,6 +1716,34 @@ static void ir_print_bool_not(IrPrintGen *irp, IrInstGenBoolNot *instruction) {
ir_print_other_inst_gen(irp, instruction->value);
}
+static void ir_print_wasm_memory_size(IrPrintSrc *irp, IrInstSrcWasmMemorySize *instruction) {
+ fprintf(irp->f, "@wasmMemorySize(");
+ ir_print_other_inst_src(irp, instruction->index);
+ fprintf(irp->f, ")");
+}
+
+static void ir_print_wasm_memory_size(IrPrintGen *irp, IrInstGenWasmMemorySize *instruction) {
+ fprintf(irp->f, "@wasmMemorySize(");
+ ir_print_other_inst_gen(irp, instruction->index);
+ fprintf(irp->f, ")");
+}
+
+static void ir_print_wasm_memory_grow(IrPrintSrc *irp, IrInstSrcWasmMemoryGrow *instruction) {
+ fprintf(irp->f, "@wasmMemoryGrow(");
+ ir_print_other_inst_src(irp, instruction->index);
+ fprintf(irp->f, ", ");
+ ir_print_other_inst_src(irp, instruction->delta);
+ fprintf(irp->f, ")");
+}
+
+static void ir_print_wasm_memory_grow(IrPrintGen *irp, IrInstGenWasmMemoryGrow *instruction) {
+ fprintf(irp->f, "@wasmMemoryGrow(");
+ ir_print_other_inst_gen(irp, instruction->index);
+ fprintf(irp->f, ", ");
+ ir_print_other_inst_gen(irp, instruction->delta);
+ fprintf(irp->f, ")");
+}
+
static void ir_print_memset(IrPrintSrc *irp, IrInstSrcMemset *instruction) {
fprintf(irp->f, "@memset(");
ir_print_other_inst_src(irp, instruction->dest_ptr);
@@ -2952,6 +2988,12 @@ static void ir_print_inst_src(IrPrintSrc *irp, IrInstSrc *instruction, bool trai
case IrInstSrcIdClz:
ir_print_clz(irp, (IrInstSrcClz *)instruction);
break;
+ case IrInstSrcIdWasmMemorySize:
+ ir_print_wasm_memory_size(irp, (IrInstSrcWasmMemorySize *)instruction);
+ break;
+ case IrInstSrcIdWasmMemoryGrow:
+ ir_print_wasm_memory_grow(irp, (IrInstSrcWasmMemoryGrow *)instruction);
+ break;
}
fprintf(irp->f, "\n");
}
@@ -3219,6 +3261,12 @@ static void ir_print_inst_gen(IrPrintGen *irp, IrInstGen *instruction, bool trai
case IrInstGenIdNegationWrapping:
ir_print_negation_wrapping(irp, (IrInstGenNegationWrapping *)instruction);
break;
+ case IrInstGenIdWasmMemorySize:
+ ir_print_wasm_memory_size(irp, (IrInstGenWasmMemorySize *)instruction);
+ break;
+ case IrInstGenIdWasmMemoryGrow:
+ ir_print_wasm_memory_grow(irp, (IrInstGenWasmMemoryGrow *)instruction);
+ break;
}
fprintf(irp->f, "\n");
}