added global code motion
This commit is contained in:
parent
09d6cf4b46
commit
032c04ad1d
4 changed files with 1341 additions and 17 deletions
11
sema.c
11
sema.c
|
|
@ -558,11 +558,20 @@ static type *get_expression_type(sema *s, ast_node *node)
|
|||
node->expr_type = t;
|
||||
return t;
|
||||
case NODE_CALL:
|
||||
prot = shget(prototypes, intern_string(s, node->expr.call.name, node->expr.call.name_len));
|
||||
node->expr.call.name = intern_string(s, node->expr.call.name, node->expr.call.name_len);
|
||||
prot = shget(prototypes, node->expr.call.name);
|
||||
if (!prot) {
|
||||
error(node, "unknown function.");
|
||||
return NULL;
|
||||
}
|
||||
// Process call arguments
|
||||
ast_node *arg = node->expr.call.parameters;
|
||||
while (arg && arg->type == NODE_UNIT) {
|
||||
if (arg->expr.unit_node.expr) {
|
||||
get_expression_type(s, arg->expr.unit_node.expr);
|
||||
}
|
||||
arg = arg->expr.unit_node.next;
|
||||
}
|
||||
t = prot->type;
|
||||
node->expr_type = t;
|
||||
return t;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue