%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function display_chart_codegen_message(chart,targetName,jitFallBackReason)
   if(nargin<3)
       jitFallBackReason = '';
   end
   chartFullName = sf('FullNameOf',chart,'/');
   chartShortName = chartFullName(find(chartFullName=='/', 1, 'last' )+1:end);
       
   switch(targetName)
       case 'sfun'
           if(isempty(jitFallBackReason))
               msgString = getString(message('Stateflow:cdr:CompilingForSimulation', chartShortName,chart));
               sfprivate('sf_display',msgString);
               relevantMachineName = sf('get',get_relevant_machine,'machine.name');
               sfprivate('set_model_status_bar',relevantMachineName,msgString);          
           else
              fallBackMsg = sprintf('\nFalling back to generating code due to %s',jitFallBackReason); 
              sfprivate('set_model_status_bar',sf('get',get_relevant_machine,'machine.name'),fallBackMsg);
           end
       otherwise
           msgString = sprintf('\nCompiling "%s" (#%d) for code generation\n',chartShortName,chart);
           sfprivate('sf_display',msgString);
   end
