aboutsummaryrefslogtreecommitdiff
path: root/src/ir_print.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-04-23 13:22:36 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-04-23 14:34:40 -0400
commit6de33ded81981554ccffc3ecbfcd5b0f628cf502 (patch)
tree520cfac3890b90d5357866a6c4b6e7e9509ee735 /src/ir_print.cpp
parent2ed47070efa5933365da724e79f6ed87d603ee27 (diff)
downloadzig-6de33ded81981554ccffc3ecbfcd5b0f628cf502.tar.gz
zig-6de33ded81981554ccffc3ecbfcd5b0f628cf502.zip
make undefined as a constant value lazy
closes #268
Diffstat (limited to 'src/ir_print.cpp')
-rw-r--r--src/ir_print.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ir_print.cpp b/src/ir_print.cpp
index da00289e17..d81584bddf 100644
--- a/src/ir_print.cpp
+++ b/src/ir_print.cpp
@@ -10,6 +10,7 @@
#include "ir_print.hpp"
struct IrPrint {
+ CodeGen *codegen;
FILE *f;
int indent;
int indent_size;
@@ -34,7 +35,7 @@ static void ir_print_prefix(IrPrint *irp, IrInstruction *instruction) {
static void ir_print_const_value(IrPrint *irp, ConstExprValue *const_val) {
Buf buf = BUF_INIT;
buf_resize(&buf, 0);
- render_const_value(&buf, const_val);
+ render_const_value(irp->codegen, &buf, const_val);
fprintf(irp->f, "%s", buf_ptr(&buf));
}
@@ -1188,9 +1189,10 @@ static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) {
fprintf(irp->f, "\n");
}
-void ir_print(FILE *f, IrExecutable *executable, int indent_size) {
+void ir_print(CodeGen *codegen, FILE *f, IrExecutable *executable, int indent_size) {
IrPrint ir_print = {};
IrPrint *irp = &ir_print;
+ irp->codegen = codegen;
irp->f = f;
irp->indent = indent_size;
irp->indent_size = indent_size;