static boolean isReposSym // TEST IF REPOSITORY SYMBOL ( SYMBOL sym ) // - the symbol { return CompFlags.extra_stats_wanted && ! SymIsTemporary( sym ) && ( SF2_TOKEN_LOCN & sym->flag2 ); }
static PTREE doCopySubstitution( // EFFECT COPY SUBSTITUTION PTREE* a_repl, // - addr[ temporary to be replaced ] PTREE orig, // - addr[ original node ] PTREE tgt, // - target PTREE dtor ) // - NULL or CO_DTOR node on right { PTREE repl; // - temporary to be replaced repl = NodeRemoveCastsCommas( *a_repl ); DbgVerify( repl->op == PT_SYMBOL, "doCopySubstitution -- not symbol" ); DbgVerify( SymIsTemporary( repl->u.symcg.symbol ) , "doCopySubstitution -- not temporary" ); if( dtor != NULL ) { PTREE old = orig; DbgVerify( dtor->u.subtree[0]->u.symcg.symbol == repl->u.symcg.symbol , "doCopySubstitution -- not same temporary" ); orig = dtor->u.subtree[1]; dtor->u.subtree[1] = NULL; NodeFreeDupedExpr( old ); } repl->u.symcg.symbol->flag = 0; *a_repl = NodeReplace( *a_repl, tgt ); orig = NodeConvertFlags( ClassTypeForType( tgt->type ) , orig , PTF_LVALUE | PTF_MEMORY_EXACT | PTF_SIDE_EFF | PTF_MEANINGFUL ); return orig; }
CALL_OPT AnalyseCallOpts // ANALYSE CALL OPTIMIZATIONS ( TYPE type // - class type of target operand , PTREE src // - source operand , PTREE* a_dtor // - addr[ CO_DTOR ] , PTREE* a_right ) // - addr[ base source operand ] { CALL_OPT retn; // - type of return PTREE right; // - bare source operand right = *NodeReturnSrc( &src, a_dtor ); *a_right = right; if( type == ClassTypeForType( right->type ) ) { if( NodeCallsCtor( right ) ) { retn = CALL_OPT_CTOR; } else if( NodeIsBinaryOp( right, CO_CALL_EXEC ) || NodeIsBinaryOp( right, CO_CALL_EXEC_IND ) ) { TYPE ftype; // - function type ftype = TypeFunctionCalled( NodeFuncForCall( right )->type ); DbgVerify( ftype != NULL , "AnalyseCLassCallOpts -- impossible parse tree" ); if( OMR_CLASS_REF == ObjModelFunctionReturn( ftype ) ) { retn = CALL_OPT_FUN_CALL; } else { retn = CALL_OPT_NONE; } } else if( NodeIsBinaryOp( right, CO_COPY_OBJECT ) ) { PTREE tgt = NodeRemoveCastsCommas( right->u.subtree[0] ); if( tgt->op == PT_SYMBOL && SymIsTemporary( tgt->u.symcg.symbol ) ) { retn = CALL_OPT_BIN_COPY; } else { retn = CALL_OPT_NONE; } } else { retn = CALL_OPT_NONE; } } else { retn = CALL_OPT_NONE; } return retn; }
// Scope has dtor_reqd set off initially. // Turn it on if symbol requiring temp is found // void CgDeclSym( // PROCESS SYMBOL IN BLOCK-OPEN SCOPE SYMBOL sym ) // - current symbol { FN_CTL* fctl; // - function information SYMBOL orig; // - original symbol orig = sym; sym = inlineSymbol( sym ); fctl = FnCtlTop(); if( CgRetnOptIsOptVar( fctl, orig ) ) { sym->flag |= SF_RETN_OPT; return; } switch( sym->id ) { case SC_AUTO: case SC_REGISTER: if( SymIsCatchAlias( sym ) ) { if( fctl->debug_info && ( GenSwitches & DBG_LOCALS ) ) { SYMBOL base = SymDeAlias( sym ); switch( base->id ) { case SC_AUTO: case SC_REGISTER: if( ! SymIsAnonymous( sym ) ) { if( !SymIsTemporary( sym ) ) { if( GenSwitches & DBG_DF ){ DwarfSymDebugGenSymbol( sym, true, false ); }else{ SymbolicDebugGenSymbol( sym, true, false ); } } } break; } } } else { if( ! SymIsAnonymous( sym ) ) { if( SymIsTemporary( sym ) ) { if( SymIsReferenced( sym ) || SymIsInitialized( sym ) ) { declareAuto( sym ); } } else { declareAuto( sym ); if( fctl->debug_info && ( GenSwitches & DBG_LOCALS ) ) { if( GenSwitches & DBG_DF ){ DwarfDebugGenSymbol( sym, true ); }else{ SymbolicDebugGenSymbol( sym, true, false ); } } } } } break; case SC_STATIC: if( fctl->debug_info && ( GenSwitches & DBG_LOCALS ) ) { if( ! SymIsAnonymous( sym ) ) { if( SymIsReferenced( sym ) || SymIsInitialized( sym ) ) { if( ! CgDeclSkippableConstObj( sym ) ) { if( GenSwitches & DBG_DF ){ DwarfDebugGenSymbol( sym, true ); }else{ SymbolicDebugGenSymbol( sym, true, false ); } } } } } break; case SC_TYPEDEF: if( fctl->debug_info && ( GenSwitches & DBG_LOCALS ) ) { if( GenSwitches & (DBG_CV | DBG_DF ) ){ DBLocalType( (cg_sym_handle)sym, false ); } } break; } }