]> git.tdb.fi Git - libs/gl.git/blob - source/glsl/generate.cpp
07181d3583e69fbc1067292bbaddc7855c58a5ac
[libs/gl.git] / source / glsl / generate.cpp
1 #include <msp/core/hash.h>
2 #include <msp/core/raii.h>
3 #include <msp/strings/lexicalcast.h>
4 #include "builtin.h"
5 #include "generate.h"
6
7 using namespace std;
8
9 namespace Msp {
10 namespace GL {
11 namespace SL {
12
13 void DeclarationCombiner::apply(Stage &stage)
14 {
15         stage.content.visit(*this);
16         NodeRemover().apply(stage, nodes_to_remove);
17 }
18
19 void DeclarationCombiner::visit(Block &block)
20 {
21         if(current_block)
22                 return;
23
24         TraversingVisitor::visit(block);
25 }
26
27 void DeclarationCombiner::visit(VariableDeclaration &var)
28 {
29         VariableDeclaration *&ptr = variables[var.name];
30         if(ptr)
31         {
32                 ptr->type = var.type;
33                 if(var.init_expression)
34                         ptr->init_expression = var.init_expression;
35                 if(var.layout)
36                 {
37                         if(ptr->layout)
38                         {
39                                 for(vector<Layout::Qualifier>::iterator i=var.layout->qualifiers.begin(); i!=var.layout->qualifiers.end(); ++i)
40                                 {
41                                         bool found = false;
42                                         for(vector<Layout::Qualifier>::iterator j=ptr->layout->qualifiers.begin(); (!found && j!=ptr->layout->qualifiers.end()); ++j)
43                                                 if(j->name==i->name)
44                                                 {
45                                                         j->has_value = i->value;
46                                                         j->value = i->value;
47                                                         found = true;
48                                                 }
49
50                                         if(!found)
51                                                 ptr->layout->qualifiers.push_back(*i);
52                                 }
53                         }
54                         else
55                                 ptr->layout = var.layout;
56                 }
57                 nodes_to_remove.insert(&var);
58         }
59         else
60                 ptr = &var;
61 }
62
63
64 ConstantSpecializer::ConstantSpecializer():
65         values(0)
66 { }
67
68 void ConstantSpecializer::apply(Stage &stage, const map<string, int> *v)
69 {
70         values = v;
71         stage.content.visit(*this);
72 }
73
74 void ConstantSpecializer::visit(VariableDeclaration &var)
75 {
76         bool specializable = false;
77         if(var.layout)
78         {
79                 vector<Layout::Qualifier> &qualifiers = var.layout->qualifiers;
80                 for(vector<Layout::Qualifier>::iterator i=qualifiers.begin(); i!=qualifiers.end(); ++i)
81                         if(i->name=="constant_id")
82                         {
83                                 specializable = true;
84                                 if(values)
85                                         qualifiers.erase(i);
86                                 else if(i->value==-1)
87                                         i->value = hash32(var.name)&0x7FFFFFFF;
88                                 break;
89                         }
90
91                 if(qualifiers.empty())
92                         var.layout = 0;
93         }
94
95         if(specializable && values)
96         {
97                 map<string, int>::const_iterator i = values->find(var.name);
98                 if(i!=values->end())
99                 {
100                         RefPtr<Literal> literal = new Literal;
101                         if(var.type=="bool")
102                         {
103                                 literal->token = (i->second ? "true" : "false");
104                                 literal->value = static_cast<bool>(i->second);
105                         }
106                         else if(var.type=="int")
107                         {
108                                 literal->token = lexical_cast<string>(i->second);
109                                 literal->value = i->second;
110                         }
111                         var.init_expression = literal;
112                 }
113         }
114 }
115
116
117 void BlockHierarchyResolver::enter(Block &block)
118 {
119         block.parent = current_block;
120 }
121
122
123 TypeResolver::TypeResolver():
124         stage(0)
125 { }
126
127 void TypeResolver::apply(Stage &s)
128 {
129         stage = &s;
130         s.types.clear();
131         s.content.visit(*this);
132 }
133
134 TypeDeclaration *TypeResolver::resolve_type(const string &name)
135 {
136         map<string, TypeDeclaration *>::iterator i = stage->types.find(name);
137         if(i!=stage->types.end())
138         {
139                 map<TypeDeclaration *, TypeDeclaration *>::iterator j = alias_map.find(i->second);
140                 return (j!=alias_map.end() ? j->second : i->second);
141         }
142         else
143                 return 0;
144 }
145
146 void TypeResolver::visit(BasicTypeDeclaration &type)
147 {
148         type.base_type = resolve_type(type.base);
149
150         if(type.kind==BasicTypeDeclaration::VECTOR && type.base_type)
151                 if(BasicTypeDeclaration *basic_base = dynamic_cast<BasicTypeDeclaration *>(type.base_type))
152                         if(basic_base->kind==BasicTypeDeclaration::VECTOR)
153                         {
154                                 type.kind = BasicTypeDeclaration::MATRIX;
155                                 type.size |= basic_base->size<<16;
156                         }
157
158         if(type.kind==BasicTypeDeclaration::ALIAS && type.base_type)
159                 alias_map[&type] = type.base_type;
160
161         stage->types.insert(make_pair(type.name, &type));
162 }
163
164 void TypeResolver::visit(ImageTypeDeclaration &type)
165 {
166         type.base_type = resolve_type(type.base);
167         stage->types.insert(make_pair(type.name, &type));
168 }
169
170 void TypeResolver::visit(StructDeclaration &strct)
171 {
172         stage->types.insert(make_pair(strct.name, &strct));
173         TraversingVisitor::visit(strct);
174 }
175
176 void TypeResolver::visit(VariableDeclaration &var)
177 {
178         var.type_declaration = resolve_type(var.type);
179 }
180
181 void TypeResolver::visit(FunctionDeclaration &func)
182 {
183         func.return_type_declaration = resolve_type(func.return_type);
184         TraversingVisitor::visit(func);
185 }
186
187
188 VariableResolver::VariableResolver():
189         stage(0),
190         r_members(0),
191         record_target(false),
192         r_self_referencing(false),
193         r_assignment_target(0)
194 { }
195
196 void VariableResolver::apply(Stage &s)
197 {
198         stage = &s;
199         s.interface_blocks.clear();
200         s.content.visit(*this);
201 }
202
203 void VariableResolver::enter(Block &block)
204 {
205         block.variables.clear();
206 }
207
208 void VariableResolver::visit(VariableReference &var)
209 {
210         var.declaration = 0;
211         r_members = 0;
212         /* Look for variable declarations in the block hierarchy first.  Interface
213         blocks are always defined in the top level so we can't accidentally skip
214         one. */
215         for(Block *block=current_block; (!var.declaration && block); block=block->parent)
216         {
217                 map<string, VariableDeclaration *>::iterator i = block->variables.find(var.name);
218                 if(i!=block->variables.end())
219                         var.declaration = i->second;
220         }
221
222         if(!var.declaration)
223         {
224                 const map<string, InterfaceBlock *> &blocks = stage->interface_blocks;
225                 map<string, InterfaceBlock *>::const_iterator i = blocks.find("_"+var.name);
226                 if(i!=blocks.end())
227                 {
228                         /* The name refers to an interface block with an instance name rather
229                         than a variable.  Prepare a new syntax tree node accordingly. */
230                         r_iface_ref = new InterfaceBlockReference;
231                         r_iface_ref->source = var.source;
232                         r_iface_ref->line = var.line;
233                         r_iface_ref->name = var.name;
234                         r_iface_ref->declaration = i->second;
235                         r_members = &i->second->members.variables;
236                 }
237                 else
238                 {
239                         // Look for the variable in anonymous interface blocks.
240                         for(i=blocks.begin(); (!var.declaration && i!=blocks.end()); ++i)
241                                 if(i->second->instance_name.empty())
242                                 {
243                                         map<string, VariableDeclaration *>::iterator j = i->second->members.variables.find(var.name);
244                                         if(j!=i->second->members.variables.end())
245                                                 var.declaration = j->second;
246                                 }
247                 }
248         }
249
250         if(var.declaration)
251                 if(StructDeclaration *strct = dynamic_cast<StructDeclaration *>(var.declaration->type_declaration))
252                         r_members = &strct->members.variables;
253
254         if(record_target)
255         {
256                 if(r_assignment_target)
257                 {
258                         /* More than one variable reference found in assignment target.
259                         Unable to determine what the primary target is. */
260                         record_target = false;
261                         r_assignment_target = 0;
262                 }
263                 else
264                         r_assignment_target = var.declaration;
265         }
266         else if(var.declaration && var.declaration==r_assignment_target)
267                 r_self_referencing = true;
268 }
269
270 void VariableResolver::visit(InterfaceBlockReference &iface)
271 {
272         iface.declaration = 0;
273         for(Block *block=current_block; block; block=block->parent)
274         {
275                 map<string, InterfaceBlock *>::iterator i = stage->interface_blocks.find("_"+iface.name);
276                 if(i!=stage->interface_blocks.end())
277                 {
278                         iface.declaration = i->second;
279                         r_members = &i->second->members.variables;
280                         break;
281                 }
282         }
283 }
284
285 void VariableResolver::visit(MemberAccess &memacc)
286 {
287         r_members = 0;
288         r_iface_ref = 0;
289         memacc.left->visit(*this);
290
291         if(r_iface_ref)
292                 memacc.left = r_iface_ref;
293         r_iface_ref = 0;
294
295         memacc.declaration = 0;
296         if(r_members)
297         {
298                 map<string, VariableDeclaration *>::iterator i = r_members->find(memacc.member);
299                 if(i!=r_members->end())
300                 {
301                         memacc.declaration = i->second;
302                         if(StructDeclaration *strct = dynamic_cast<StructDeclaration *>(i->second->type_declaration))
303                                 r_members = &strct->members.variables;
304                 }
305                 else
306                         r_members = 0;
307         }
308 }
309
310 void VariableResolver::visit(UnaryExpression &unary)
311 {
312         TraversingVisitor::visit(unary);
313         r_members = 0;
314         r_iface_ref = 0;
315 }
316
317 void VariableResolver::visit(BinaryExpression &binary)
318 {
319         if(binary.oper->token[0]=='[')
320         {
321                 {
322                         /* The subscript expression is not a part of the primary assignment
323                         target. */
324                         SetFlag set(record_target, false);
325                         binary.right->visit(*this);
326                 }
327                 r_members = 0;
328                 r_iface_ref = 0;
329                 binary.left->visit(*this);
330                 if(r_iface_ref)
331                         binary.left = r_iface_ref;
332         }
333         else
334         {
335                 TraversingVisitor::visit(binary);
336                 r_members = 0;
337         }
338
339         r_iface_ref = 0;
340 }
341
342 void VariableResolver::visit(Assignment &assign)
343 {
344         {
345                 SetFlag set(record_target);
346                 r_assignment_target = 0;
347                 assign.left->visit(*this);
348                 assign.target_declaration = r_assignment_target;
349         }
350
351         r_self_referencing = false;
352         assign.right->visit(*this);
353         assign.self_referencing = (r_self_referencing || assign.oper->token[0]!='=');
354
355         r_members = 0;
356         r_iface_ref = 0;
357 }
358
359 void VariableResolver::visit(FunctionCall &call)
360 {
361         TraversingVisitor::visit(call);
362         r_members = 0;
363         r_iface_ref = 0;
364 }
365
366 void VariableResolver::visit(VariableDeclaration &var)
367 {
368         if(!block_interface.empty() && var.interface.empty())
369                 var.interface = block_interface;
370
371         TraversingVisitor::visit(var);
372         current_block->variables.insert(make_pair(var.name, &var));
373 }
374
375 void VariableResolver::visit(InterfaceBlock &iface)
376 {
377         /* Block names can be reused in different interfaces.  Prefix the name with
378         the first character of the interface to avoid conflicts. */
379         stage->interface_blocks.insert(make_pair(iface.interface+iface.name, &iface));
380         if(!iface.instance_name.empty())
381                 stage->interface_blocks.insert(make_pair("_"+iface.instance_name, &iface));
382
383         SetForScope<string> set_iface(block_interface, iface.interface);
384         TraversingVisitor::visit(iface);
385 }
386
387
388 void FunctionResolver::apply(Stage &s)
389 {
390         stage = &s;
391         s.functions.clear();
392         s.content.visit(*this);
393 }
394
395 void FunctionResolver::visit(FunctionCall &call)
396 {
397         map<string, FunctionDeclaration *>::iterator i = stage->functions.find(call.name);
398         if(i!=stage->functions.end())
399                 call.declaration = i->second;
400
401         TraversingVisitor::visit(call);
402 }
403
404 void FunctionResolver::visit(FunctionDeclaration &func)
405 {
406         FunctionDeclaration *&stage_decl = stage->functions[func.name];
407         vector<FunctionDeclaration *> &decls = declarations[func.name];
408         if(func.definition==&func)
409         {
410                 stage_decl = &func;
411
412                 // Set all previous declarations to use this definition.
413                 for(vector<FunctionDeclaration *>::iterator i=decls.begin(); i!=decls.end(); ++i)
414                 {
415                         (*i)->definition = func.definition;
416                         (*i)->body.body.clear();
417                 }
418         }
419         else
420         {
421                 func.definition = 0;
422                 if(!stage_decl)
423                         stage_decl = &func;
424                 else
425                         func.definition = stage_decl->definition;
426         }
427         decls.push_back(&func);
428
429         TraversingVisitor::visit(func);
430 }
431
432
433 InterfaceGenerator::InterfaceGenerator():
434         stage(0),
435         function_scope(false),
436         iface_block(0),
437         copy_block(false),
438         iface_target_block(0)
439 { }
440
441 string InterfaceGenerator::get_out_prefix(Stage::Type type)
442 {
443         if(type==Stage::VERTEX)
444                 return "_vs_out_";
445         else if(type==Stage::GEOMETRY)
446                 return "_gs_out_";
447         else
448                 return string();
449 }
450
451 void InterfaceGenerator::apply(Stage &s)
452 {
453         stage = &s;
454         iface_target_block = &stage->content;
455         if(stage->previous)
456                 in_prefix = get_out_prefix(stage->previous->type);
457         out_prefix = get_out_prefix(stage->type);
458         s.content.visit(*this);
459         NodeRemover().apply(s, nodes_to_remove);
460 }
461
462 void InterfaceGenerator::visit(Block &block)
463 {
464         SetForScope<Block *> set_block(current_block, &block);
465         for(NodeList<Statement>::iterator i=block.body.begin(); i!=block.body.end(); ++i)
466         {
467                 assignment_insert_point = i;
468                 if(&block==&stage->content)
469                         iface_insert_point = i;
470
471                 (*i)->visit(*this);
472         }
473 }
474
475 string InterfaceGenerator::change_prefix(const string &name, const string &prefix) const
476 {
477         unsigned offset = (name.compare(0, in_prefix.size(), in_prefix) ? 0 : in_prefix.size());
478         return prefix+name.substr(offset);
479 }
480
481 VariableDeclaration *InterfaceGenerator::generate_interface(VariableDeclaration &var, const string &iface, const string &name)
482 {
483         if(stage->content.variables.count(name))
484                 return 0;
485
486         VariableDeclaration* iface_var = new VariableDeclaration;
487         iface_var->sampling = var.sampling;
488         iface_var->interface = iface;
489         iface_var->type = var.type;
490         iface_var->name = name;
491         /* Geometry shader inputs are always arrays.  But if we're bringing in an
492         entire block, the array is on the block and not individual variables. */
493         if(stage->type==Stage::GEOMETRY && !copy_block)
494                 iface_var->array = ((var.array && var.interface!="in") || iface=="in");
495         else
496                 iface_var->array = var.array;
497         if(iface_var->array)
498                 iface_var->array_size = var.array_size;
499         if(iface=="in")
500         {
501                 iface_var->layout = var.layout;
502                 iface_var->linked_declaration = &var;
503                 var.linked_declaration = iface_var;
504         }
505
506         iface_target_block->body.insert(iface_insert_point, iface_var);
507         iface_target_block->variables.insert(make_pair(name, iface_var));
508
509         return iface_var;
510 }
511
512 InterfaceBlock *InterfaceGenerator::generate_interface(InterfaceBlock &out_block)
513 {
514         if(stage->interface_blocks.count("in"+out_block.name))
515                 return 0;
516
517         InterfaceBlock *in_block = new InterfaceBlock;
518         in_block->interface = "in";
519         in_block->name = out_block.name;
520         in_block->instance_name = out_block.instance_name;
521         if(stage->type==Stage::GEOMETRY)
522                 in_block->array = true;
523         else
524                 in_block->array = out_block.array;
525         in_block->linked_block = &out_block;
526         out_block.linked_block = in_block;
527
528         {
529                 SetFlag set_copy(copy_block, true);
530                 SetForScope<Block *> set_target(iface_target_block, &in_block->members);
531                 SetForScope<NodeList<Statement>::iterator> set_ins_pt(iface_insert_point, in_block->members.body.end());
532                 out_block.members.visit(*this);
533         }
534
535         iface_target_block->body.insert(iface_insert_point, in_block);
536         stage->interface_blocks.insert(make_pair("in"+in_block->name, in_block));
537         if(!in_block->instance_name.empty())
538                 stage->interface_blocks.insert(make_pair("_"+in_block->instance_name, in_block));
539
540         SetFlag set_scope(function_scope, false);
541         SetForScope<Block *> set_block(current_block, &stage->content);
542         in_block->visit(*this);
543
544         return in_block;
545 }
546
547 ExpressionStatement &InterfaceGenerator::insert_assignment(const string &left, Expression *right)
548 {
549         Assignment *assign = new Assignment;
550         VariableReference *ref = new VariableReference;
551         ref->name = left;
552         assign->left = ref;
553         assign->oper = &Operator::get_operator("=", Operator::BINARY);
554         assign->right = right;
555
556         ExpressionStatement *stmt = new ExpressionStatement;
557         stmt->expression = assign;
558         current_block->body.insert(assignment_insert_point, stmt);
559         stmt->visit(*this);
560
561         return *stmt;
562 }
563
564 void InterfaceGenerator::visit(VariableReference &var)
565 {
566         if(var.declaration || !stage->previous)
567                 return;
568         /* Don't pull a variable from previous stage if we just generated an output
569         interface in this stage */
570         if(stage->content.variables.count(var.name))
571                 return;
572
573         const map<string, VariableDeclaration *> &prev_vars = stage->previous->content.variables;
574         map<string, VariableDeclaration *>::const_iterator i = prev_vars.find(var.name);
575         if(i==prev_vars.end() || i->second->interface!="out")
576                 i = prev_vars.find(in_prefix+var.name);
577         if(i!=prev_vars.end() && i->second->interface=="out")
578         {
579                 generate_interface(*i->second, "in", i->second->name);
580                 var.name = i->second->name;
581                 return;
582         }
583
584         const map<string, InterfaceBlock *> &prev_blocks = stage->previous->interface_blocks;
585         map<string, InterfaceBlock *>::const_iterator j = prev_blocks.find("_"+var.name);
586         if(j!=prev_blocks.end() && j->second->interface=="out")
587         {
588                 generate_interface(*j->second);
589                 /* Let VariableResolver convert the variable reference into an interface
590                 block reference. */
591                 return;
592         }
593
594         for(j=prev_blocks.begin(); j!=prev_blocks.end(); ++j)
595                 if(j->second->instance_name.empty())
596                 {
597                         i = j->second->members.variables.find(var.name);
598                         if(i!=j->second->members.variables.end())
599                         {
600                                 generate_interface(*j->second);
601                                 return;
602                         }
603                 }
604 }
605
606 void InterfaceGenerator::visit(VariableDeclaration &var)
607 {
608         if(copy_block)
609         {
610                 generate_interface(var, "in", var.name);
611                 return;
612         }
613
614         if(iface_block)
615         {
616                 if(iface_block->linked_block)
617                 {
618                         // Link all variables to their counterparts in the linked block.
619                         const map<string, VariableDeclaration *> &linked_vars = iface_block->linked_block->members.variables;
620                         map<string, VariableDeclaration *>::const_iterator i = linked_vars.find(var.name);
621                         if(i!=linked_vars.end())
622                         {
623                                 var.linked_declaration = i->second;
624                                 var.linked_declaration->linked_declaration = &var;
625                         }
626                 }
627                 return;
628         }
629
630         if(var.interface=="out")
631         {
632                 /* For output variables in function scope, generate a global interface
633                 and replace the local declaration with an assignment. */
634                 VariableDeclaration *out_var = 0;
635                 if(function_scope && (out_var=generate_interface(var, "out", var.name)))
636                 {
637                         out_var->source = var.source;
638                         out_var->line = var.line;
639                         nodes_to_remove.insert(&var);
640                         if(var.init_expression)
641                         {
642                                 ExpressionStatement &stmt = insert_assignment(var.name, var.init_expression->clone());
643                                 stmt.source = var.source;
644                                 stmt.line = var.line;
645                                 return;
646                         }
647                 }
648         }
649         else if(var.interface=="in")
650         {
651                 /* Try to link input variables in global scope with output variables from
652                 previous stage. */
653                 if(current_block==&stage->content && !var.linked_declaration && stage->previous)
654                 {
655                         const map<string, VariableDeclaration *> &prev_vars = stage->previous->content.variables;
656                         map<string, VariableDeclaration *>::const_iterator i = prev_vars.find(var.name);
657                         if(i!=prev_vars.end() && i->second->interface=="out")
658                         {
659                                 var.linked_declaration = i->second;
660                                 i->second->linked_declaration = &var;
661                         }
662                 }
663         }
664
665         TraversingVisitor::visit(var);
666 }
667
668 void InterfaceGenerator::visit(InterfaceBlock &iface)
669 {
670         if(iface.interface=="in")
671         {
672                 /* Try to link input blocks with output blocks sharing the same block
673                 name from previous stage. */
674                 if(!iface.linked_block && stage->previous)
675                 {
676                         const map<string, InterfaceBlock *> &prev_blocks = stage->previous->interface_blocks;
677                         map<string, InterfaceBlock *>::const_iterator i = prev_blocks.find("out"+iface.name);
678                         if(i!=prev_blocks.end())
679                         {
680                                 iface.linked_block = i->second;
681                                 i->second->linked_block = &iface;
682                         }
683                 }
684         }
685
686         SetForScope<InterfaceBlock *> set_iface(iface_block, &iface);
687         TraversingVisitor::visit(iface);
688 }
689
690 void InterfaceGenerator::visit(FunctionDeclaration &func)
691 {
692         SetFlag set_scope(function_scope, true);
693         // Skip parameters because they're not useful here
694         func.body.visit(*this);
695 }
696
697 void InterfaceGenerator::visit(Passthrough &pass)
698 {
699         vector<VariableDeclaration *> pass_vars;
700
701         // Pass through all input variables of this stage.
702         for(map<string, VariableDeclaration *>::const_iterator i=stage->content.variables.begin(); i!=stage->content.variables.end(); ++i)
703                 if(i->second->interface=="in")
704                         pass_vars.push_back(i->second);
705
706         if(stage->previous)
707         {
708                 const map<string, VariableDeclaration *> &prev_vars = stage->previous->content.variables;
709                 for(map<string, VariableDeclaration *>::const_iterator i=prev_vars.begin(); i!=prev_vars.end(); ++i)
710                 {
711                         if(i->second->interface!="out")
712                                 continue;
713
714                         /* Pass through output variables from the previous stage, but only
715                         those which are not already linked to an input here. */
716                         if(!i->second->linked_declaration && generate_interface(*i->second, "in", i->second->name))
717                                 pass_vars.push_back(i->second);
718                 }
719         }
720
721         if(stage->type==Stage::GEOMETRY)
722         {
723                 /* Special case for geometry shader: copy gl_Position from input to
724                 output. */
725                 InterfaceBlockReference *ref = new InterfaceBlockReference;
726                 ref->name = "gl_in";
727
728                 BinaryExpression *subscript = new BinaryExpression;
729                 subscript->left = ref;
730                 subscript->oper = &Operator::get_operator("[", Operator::BINARY);
731                 subscript->right = pass.subscript;
732
733                 MemberAccess *memacc = new MemberAccess;
734                 memacc->left = subscript;
735                 memacc->member = "gl_Position";
736
737                 insert_assignment("gl_Position", memacc);
738         }
739
740         for(vector<VariableDeclaration *>::const_iterator i=pass_vars.begin(); i!=pass_vars.end(); ++i)
741         {
742                 string out_name = change_prefix((*i)->name, out_prefix);
743                 generate_interface(**i, "out", out_name);
744
745                 VariableReference *ref = new VariableReference;
746                 ref->name = (*i)->name;
747                 if(pass.subscript)
748                 {
749                         BinaryExpression *subscript = new BinaryExpression;
750                         subscript->left = ref;
751                         subscript->oper = &Operator::get_operator("[", Operator::BINARY);
752                         subscript->right = pass.subscript;
753                         insert_assignment(out_name, subscript);
754                 }
755                 else
756                         insert_assignment(out_name, ref);
757         }
758
759         nodes_to_remove.insert(&pass);
760 }
761
762 } // namespace SL
763 } // namespace GL
764 } // namespace Msp