Optimizer - Fixed input handling

This commit is contained in:
Emmanuel BENOîT 2017-12-23 17:29:52 +01:00
parent d3b1883693
commit 965496b231
3 changed files with 21 additions and 11 deletions

View file

@ -66,10 +66,10 @@ void T_OptData::findInputDecls(
visitor.visit( program.root , [this]( A_Node& node , const bool exit ) {
if ( exit && node.type( ) == A_Node::OP_INPUT ) {
auto& input{ (T_InputInstrNode&) node };
auto* da{ inputDecls->get( input.id( ) ) };
auto* da{ inputDecls.get( input.id( ) ) };
if ( !da ) {
inputDecls->add( input.id( ) , T_Array< T_InputDecl >{ } );
da = inputDecls->get( input.id( ) );
inputDecls.add( input.id( ) , T_Array< T_InputDecl >{ } );
da = inputDecls.get( input.id( ) );
}
da->add( T_InputDecl{ input.location( ) , input.defValue( ) } );
}
@ -1275,8 +1275,7 @@ P_ExpressionNode T_ConstantFolder_::doInputExpr(
return NewOwned< T_ConstantExprNode >( node.parent( ) , *cval );
}
assert( oData.inputDecls );
auto const* const dva{ oData.inputDecls->get( node.id( ) ) };
auto const* const dva{ oData.inputDecls.get( node.id( ) ) };
assert( dva );
if ( dva->size( ) == 1 ) {
// If there's only one default value, that's a constant.

View file

@ -47,7 +47,7 @@ struct T_OptData
ebcl::T_SRDLocation location;
float value;
};
T_Optional< T_KeyValueTable< T_String , T_Array< T_InputDecl > > > inputDecls;
T_KeyValueTable< T_String , T_Array< T_InputDecl > > inputDecls;
void findInputDecls( T_OpsParserOutput& program ) noexcept;

View file

@ -1,4 +1,4 @@
(cfg "Optimized"
(cfg "OptimizedFixed"
(resolutions
(1280 720)
(1920 1080)
@ -6,6 +6,20 @@
(optimizer on
(constant-folding on
(fixed-resolution on)
(inputs on)
)
(constant-propagation on)
(dead-code-elimination on)
(function-inlining on)
)
)
(cfg "OptimizedDynamic"
(resolutions chooser)
(optimizer on
(constant-folding on
(fixed-resolution off)
(inputs on)
)
(constant-propagation on)
(dead-code-elimination on)
@ -14,9 +28,6 @@
)
(cfg "Basic"
(resolutions
(1280 720)
(1920 1080)
)
(resolutions chooser)
(optimizer off)
)