introduce lazy values

see #2174
This commit is contained in:
Andrew Kelley
2019-08-22 12:07:56 -04:00
parent efdbede7ab
commit 8460d5617c
7 changed files with 326 additions and 142 deletions

View File

@@ -3386,6 +3386,8 @@ static bool value_is_all_undef_array(ConstExprValue *const_val, size_t len) {
static bool value_is_all_undef(ConstExprValue *const_val) {
switch (const_val->special) {
case ConstValSpecialLazy:
zig_unreachable();
case ConstValSpecialRuntime:
return false;
case ConstValSpecialUndef:
@@ -3686,7 +3688,7 @@ static void render_async_spills(CodeGen *g) {
}
if (ir_get_var_is_comptime(var))
continue;
switch (type_requires_comptime(g, var->var_type)) {
switch (type_requires_comptime(g, var->var_type, nullptr)) {
case ReqCompTimeInvalid:
zig_unreachable();
case ReqCompTimeYes:
@@ -6041,6 +6043,7 @@ static LLVMValueRef gen_const_ptr_union_recursive(CodeGen *g, ConstExprValue *un
static LLVMValueRef pack_const_int(CodeGen *g, LLVMTypeRef big_int_type_ref, ConstExprValue *const_val) {
switch (const_val->special) {
case ConstValSpecialLazy:
case ConstValSpecialRuntime:
zig_unreachable();
case ConstValSpecialUndef:
@@ -6300,6 +6303,8 @@ static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val, const c
assert(type_has_bits(type_entry));
switch (const_val->special) {
case ConstValSpecialLazy:
zig_unreachable();
case ConstValSpecialRuntime:
zig_unreachable();
case ConstValSpecialUndef:
@@ -7044,7 +7049,7 @@ static void do_code_gen(CodeGen *g) {
}
if (ir_get_var_is_comptime(var))
continue;
switch (type_requires_comptime(g, var->var_type)) {
switch (type_requires_comptime(g, var->var_type, nullptr)) {
case ReqCompTimeInvalid:
zig_unreachable();
case ReqCompTimeYes: