Overall performance upgrade.
This commit is contained in:
parent
4042cc77b6
commit
29b1218b0b
27
ir/ir_gen.c
27
ir/ir_gen.c
@ -255,6 +255,17 @@ static void _rava_ir_gen_expression(RavaIRGenerator_t *gen, RavaASTNode_t *expr)
|
|||||||
strcmp(index_name, gen->loop_context->loop_var_name) == 0) {
|
strcmp(index_name, gen->loop_context->loop_var_name) == 0) {
|
||||||
use_unchecked = true;
|
use_unchecked = true;
|
||||||
}
|
}
|
||||||
|
} else if (index_node->type == RAVA_AST_BINARY_EXPR &&
|
||||||
|
(index_node->data.binary.op == RAVA_BINOP_ADD ||
|
||||||
|
index_node->data.binary.op == RAVA_BINOP_SUB)) {
|
||||||
|
RavaASTNode_t *left = index_node->data.binary.left;
|
||||||
|
RavaASTNode_t *right = index_node->data.binary.right;
|
||||||
|
if (left->type == RAVA_AST_IDENTIFIER_EXPR &&
|
||||||
|
right->type == RAVA_AST_LITERAL_EXPR &&
|
||||||
|
gen->loop_context->loop_var_name &&
|
||||||
|
strcmp(left->data.identifier.name, gen->loop_context->loop_var_name) == 0) {
|
||||||
|
use_unchecked = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,12 +334,24 @@ static void _rava_ir_gen_expression(RavaIRGenerator_t *gen, RavaASTNode_t *expr)
|
|||||||
|
|
||||||
bool use_unchecked = false;
|
bool use_unchecked = false;
|
||||||
if (gen->loop_context && gen->loop_context->has_bounds_check) {
|
if (gen->loop_context && gen->loop_context->has_bounds_check) {
|
||||||
if (expr->data.array_access.index->type == RAVA_AST_IDENTIFIER_EXPR) {
|
RavaASTNode_t *index_node = expr->data.array_access.index;
|
||||||
const char *index_name = expr->data.array_access.index->data.identifier.name;
|
if (index_node->type == RAVA_AST_IDENTIFIER_EXPR) {
|
||||||
|
const char *index_name = index_node->data.identifier.name;
|
||||||
if (gen->loop_context->loop_var_name &&
|
if (gen->loop_context->loop_var_name &&
|
||||||
strcmp(index_name, gen->loop_context->loop_var_name) == 0) {
|
strcmp(index_name, gen->loop_context->loop_var_name) == 0) {
|
||||||
use_unchecked = true;
|
use_unchecked = true;
|
||||||
}
|
}
|
||||||
|
} else if (index_node->type == RAVA_AST_BINARY_EXPR &&
|
||||||
|
(index_node->data.binary.op == RAVA_BINOP_ADD ||
|
||||||
|
index_node->data.binary.op == RAVA_BINOP_SUB)) {
|
||||||
|
RavaASTNode_t *left = index_node->data.binary.left;
|
||||||
|
RavaASTNode_t *right = index_node->data.binary.right;
|
||||||
|
if (left->type == RAVA_AST_IDENTIFIER_EXPR &&
|
||||||
|
right->type == RAVA_AST_LITERAL_EXPR &&
|
||||||
|
gen->loop_context->loop_var_name &&
|
||||||
|
strcmp(left->data.identifier.name, gen->loop_context->loop_var_name) == 0) {
|
||||||
|
use_unchecked = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user