Merge branch 'master' into windows-llvm-11.1.0

This commit is contained in:
gingerBill
2022-08-16 15:11:27 +01:00
3 changed files with 21 additions and 14 deletions

View File

@@ -818,6 +818,10 @@ i64 check_distance_between_types(CheckerContext *c, Operand *operand, Type *type
}
if (is_type_matrix(dst)) {
if (are_types_identical(src, dst)) {
return 5;
}
Type *dst_elem = base_array_type(dst);
i64 distance = check_distance_between_types(c, operand, dst_elem);
if (distance >= 0) {

View File

@@ -458,15 +458,6 @@ void lb_build_range_interval(lbProcedure *p, AstBinaryExpr *node,
val1_type = type_of_expr(rs->vals[1]);
}
if (val0_type != nullptr) {
Entity *e = entity_of_node(rs->vals[0]);
lb_add_local(p, e->type, e, true);
}
if (val1_type != nullptr) {
Entity *e = entity_of_node(rs->vals[1]);
lb_add_local(p, e->type, e, true);
}
TokenKind op = Token_Lt;
switch (node->op.kind) {
case Token_Ellipsis: op = Token_LtEq; break;
@@ -478,10 +469,22 @@ void lb_build_range_interval(lbProcedure *p, AstBinaryExpr *node,
lbValue lower = lb_build_expr(p, node->left);
lbValue upper = {}; // initialized each time in the loop
lbAddr value = lb_add_local_generated(p, val0_type ? val0_type : lower.type, false);
lbAddr value;
if (val0_type != nullptr) {
Entity *e = entity_of_node(rs->vals[0]);
value = lb_add_local(p, val0_type, e, false);
} else {
value = lb_add_local_generated(p, lower.type, false);
}
lb_addr_store(p, value, lower);
lbAddr index = lb_add_local_generated(p, t_int, false);
lbAddr index;
if (val1_type != nullptr) {
Entity *e = entity_of_node(rs->vals[1]);
index = lb_add_local(p, val1_type, e, false);
} else {
index = lb_add_local_generated(p, t_int, false);
}
lb_addr_store(p, index, lb_const_int(m, t_int, 0));
lbBlock *loop = lb_create_block(p, "for.interval.loop");