*/
state->symbols->push_scope();
foreach_iter(exec_list_iterator, iter, signature->parameters) {
- ir_variable *const proto = ((ir_instruction *) iter.get())->as_variable();
+ ir_variable *const var = ((ir_instruction *) iter.get())->as_variable();
- assert(proto != NULL);
-
- ir_variable *const var = proto->clone();
-
- signature->body.push_tail(var);
+ assert(var != NULL);
/* The only way a parameter would "exist" is if two parameters have
* the same name.
for (i = 0; i < n_args; i++) {
ir_variable *var = new ir_variable(type, arg_names[i]);
- var = new ir_variable(type, arg_names[i]);
var->mode = ir_var_in;
sig->parameters.push_tail(var);
- var = new ir_variable(type, arg_names[i]);
- var->mode = ir_var_in;
- sig->body.push_tail(var);
declarations[i] = var;
}
var->mode = ir_var_in;
signature->parameters.push_tail(var);
- var = new ir_variable(parameter_type, names[i]);
-
- var->mode = ir_var_in;
- signature->body.push_tail(var);
-
declarations[i] = var;
}
void ir_print_visitor::visit(ir_label *ir)
{
printf("\n(label %s\n", ir->label);
+
ir->signature->accept(this);
printf(")");
}
void ir_print_visitor::visit(ir_function_signature *ir)
{
+ printf("(paramaters\n");
+ foreach_iter(exec_list_iterator, iter, ir->parameters) {
+ ir_variable *const inst = (ir_variable *) iter.get();
+
+ inst->accept(this);
+ printf("\n");
+ }
+ printf(")\n");
+
foreach_iter(exec_list_iterator, iter, ir->body) {
ir_instruction *const inst = (ir_instruction *) iter.get();