Compiler - Input default value instruction

This commit is contained in:
Emmanuel BENOîT 2017-11-13 18:31:21 +01:00
parent 673b73c42d
commit e877f3f391
3 changed files with 21 additions and 0 deletions

View file

@ -67,6 +67,7 @@ enum E_OpType
// //
OP_UI_PENTER , OP_UI_PENTER ,
OP_UI_PEXIT , OP_UI_PEXIT ,
OP_UI_INPUT_DFT ,
}; };
M_LSHIFT_OP( T_StringBuilder , E_OpType ); M_LSHIFT_OP( T_StringBuilder , E_OpType );

View file

@ -615,6 +615,25 @@ bool T_CompilerImpl_::compileNode(
} }
break; break;
case A_Node::OP_INPUT:
if ( exit ) {
auto& in( (T_InputInstrNode&) node );
T_OpValue value;
value.f = in.defValue( );
addInstruction( OP_FP_LOAD ,
constants.indexOf( value.u ) + 3 ,
in.defValueLocation( ) );
addInstruction( OP_PUSH , in.defValueLocation( ) );
addInstruction( OP_FP_SSTORE_INT , 0 , in.defValueLocation( ) );
addInstruction( OP_CONST , output->inputs.indexOf( in.id( ) ) , in.idLocation( ) );
addInstruction( OP_PUSH , in.defValueLocation( ) );
addInstruction( OP_UI_INPUT_DFT , node.location( ) );
}
break;
//- EXPRESSIONS - ARGUMENTS ----------------------------------------------------------- //- EXPRESSIONS - ARGUMENTS -----------------------------------------------------------

1
ops.cc
View file

@ -139,6 +139,7 @@ static T_KeyValueTable< E_OpType , T_OpInfo > OpInfoTable_{ ([]() {
// //
infos.add( E_OpType::OP_UI_PENTER , T_OpInfo{ "ui-prof-enter" , 1 } ); infos.add( E_OpType::OP_UI_PENTER , T_OpInfo{ "ui-prof-enter" , 1 } );
infos.add( E_OpType::OP_UI_PEXIT , T_OpInfo{ "ui-prof-exit" } ); infos.add( E_OpType::OP_UI_PEXIT , T_OpInfo{ "ui-prof-exit" } );
infos.add( E_OpType::OP_UI_INPUT_DFT , T_OpInfo{ "ui-input-default" , 0 , OpStackMain{ -2 } } );
return infos; return infos;
})( ) }; })( ) };