aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/print_llvm.cpp
diff options
context:
space:
mode:
authorGinger Bill <github@gingerbill.org>2016-08-19 15:35:48 +0100
committerGinger Bill <github@gingerbill.org>2016-08-19 15:35:48 +0100
commit745237459abb3fa91405fdba3895bd9f810bc9d2 (patch)
tree63b2396f1bea12a4cfdf3a334f82a31c9dd28ec0 /src/codegen/print_llvm.cpp
parentddb15e73c0f378b5d65675ba242e505fb1a3b2f2 (diff)
Initial Demo001 code for tour of language
Diffstat (limited to 'src/codegen/print_llvm.cpp')
-rw-r--r--src/codegen/print_llvm.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/codegen/print_llvm.cpp b/src/codegen/print_llvm.cpp
index f584bbe06..0790aa7d8 100644
--- a/src/codegen/print_llvm.cpp
+++ b/src/codegen/print_llvm.cpp
@@ -196,10 +196,13 @@ void ssa_print_type(gbFile *f, BaseTypeSizes s, Type *t) {
}
void ssa_print_exact_value(gbFile *f, ssaModule *m, ExactValue value, Type *type) {
+ type = get_base_type(type);
if (is_type_float(type)) {
value = exact_value_to_float(value);
} else if (is_type_integer(type)) {
value = exact_value_to_integer(value);
+ } else if (is_type_pointer(type)) {
+ value = exact_value_to_integer(value);
}
switch (value.kind) {
@@ -212,7 +215,7 @@ void ssa_print_exact_value(gbFile *f, ssaModule *m, ExactValue value, Type *type
ssa_fprintf(f, "\"");
} break;
case ExactValue_Integer: {
- if (is_type_pointer(get_base_type(type))) {
+ if (is_type_pointer(type)) {
if (value.value_integer == 0) {
ssa_fprintf(f, "null");
} else {
@@ -235,14 +238,14 @@ void ssa_print_exact_value(gbFile *f, ssaModule *m, ExactValue value, Type *type
ssa_fprintf(f, "0x%016llx", u);
} break;
case ExactValue_Pointer:
- if (value.value_float == NULL) {
+ if (value.value_pointer == NULL) {
ssa_fprintf(f, "null");
} else {
GB_PANIC("TODO(bill): ExactValue_Pointer");
}
break;
default:
- GB_PANIC("Invalid ExactValue");
+ GB_PANIC("Invalid ExactValue: %d", value.kind);
break;
}
}