// Initial resolving pass
BlockHierarchyResolver().apply(stage);
- TypeResolver().apply(stage);
- FunctionResolver().apply(stage);
- VariableResolver().apply(stage);
+ resolve(stage);
/* All variables local to a stage have been resolved. Resolve non-local
variables through interfaces. */
InterfaceGenerator().apply(stage);
- TypeResolver().apply(stage);
- VariableResolver().apply(stage);
- ExpressionResolver().apply(stage);
+ resolve(stage);
FunctionResolver().apply(stage);
ConstantSpecializer().apply(stage, (mode==PROGRAM && specialized ? &spec_values : 0));
LegacyConverter().apply(stage, features);
}
+void Compiler::resolve(Stage &stage)
+{
+ TypeResolver().apply(stage);
+ // Use the bitwise or to always evaluate both operands
+ while(VariableResolver().apply(stage) |
+ ExpressionResolver().apply(stage)) ;
+ FunctionResolver().apply(stage);
+}
+
bool Compiler::validate(Stage &stage)
{
TypeValidator().apply(stage);
bool any_inlined = FunctionInliner().apply(stage);
any_inlined |= ExpressionInliner().apply(stage);
if(any_inlined)
- {
- TypeResolver().apply(stage);
- VariableResolver().apply(stage);
- FunctionResolver().apply(stage);
- ExpressionResolver().apply(stage);
- }
+ resolve(stage);
/* Removing variables or functions may cause things from the previous stage
to become unused. */