static SYMBOL inlineSymbol( // CREATE TRANSLATION SYMBOL IF REQ'D SYMBOL sym ) // - original symbol { SYMBOL old; // - same as "sym" FN_CTL* fctl; // - current file control fctl = FnCtlTop(); if( sym == fctl->this_sym ) { return( sym ); } if( sym == fctl->cdtor_sym ) { return( sym ); } if( CgBackInlinedDepth() > 0 && ! SymIsFunction( sym ) && ! SymIsStaticData( sym ) ) { old = sym; sym = push_inline_sym( old ); SymTransPush( old, sym ); // code used to only have SymIsCatchAlias so we // make sure SymIsAlias includes SymIsCatchAlias DbgAssert( ! SymIsCatchAlias( sym ) || ( SymIsCatchAlias( sym ) && SymIsAlias( sym ) ) ); if( SymIsAlias( sym ) || SymIsAnonymousMember( sym ) ) { if( SymIsAutomatic( sym ) ) { sym->u.alias = SymTrans( sym->u.alias ); } } } return( sym ); }
static void declareParameter( // DEFINE A FUNCTION PARAMETER SYMBOL sym ) // - the parameter { cg_type cgtype; // - type for code generator FN_CTL* fctl; // - function information TYPE ftype; // - function type if( sym != NULL ) { fctl = FnCtlTop(); ftype = FunctionDeclarationType( fctl->func->sym_type ); sym = inlineSymbol( sym ); if( ( TF1_PLUSPLUS & ftype->flag ) && OMR_CLASS_REF == ObjModelArgument( sym->sym_type ) ) { cgtype = TY_POINTER; } else { cgtype = CgTypeOutput( sym->sym_type ); } CGParmDecl( (cg_sym_handle)sym, cgtype ); if( fctl->debug_info && ( GenSwitches & DBG_LOCALS ) ) { if( GenSwitches & DBG_DF ){ DwarfSymDebugGenSymbol( sym, true, cgtype == TY_POINTER ); }else{ SymbolicDebugGenSymbol( sym, true, cgtype == TY_POINTER ); } } IbpDefineSym( fctl->handle, sym ); } }
back_handle CgProfData( void ) /****************************/ { FN_CTL *top; top = FnCtlTop(); return( top->prof_data ); }
static void setSeCtorTest( // CALL BACK: SET SE AND CTOR-TEST void* data ) // - state entry { SE* se = (SE*)data; se = BlkPosnUpdate( se ); se = BlkPosnTempEndSet( se ); FstabAdd( se ); FstabCtorTest( FnCtlTop() ); }
static void callBackCtorFlag( // CALL-BACK FOR CTOR-FLAG AFTER CTORING void* data ) // - patch entry { CTOR_FLAG_SET* cfs = data; // - patch entry if( ctorTestReqd( FstabActualPosn(), cfs->se ) ) { FN_CTL* fctl = FnCtlTop(); unsigned mask = 1 << ( FnCtlCondFlagCtor( fctl ) & 7 ); BEPatchInteger( cfs->ph_clr, 255 - mask ); } else { BEPatchInteger( cfs->ph_clr, -1 ); } BEFiniPatch( cfs->ph_clr ); CarveFree( carve_ctor_flag, cfs ); }
void* SymTrans( // TRANSLATE SYMBOL/SCOPE void *src ) // - source value { SYM_TRANS *tr; // - translation element (current) unsigned bound; // - bounding id bound = FnCtlTop()->sym_trans_id; for( tr = VstkTop( &stack_sym_trans ) ; tr != NULL && bound <= tr->id ; tr = VstkNext( &stack_sym_trans, tr ) ) { if( src == tr->src ) { src = tr->tgt; dump( "used", tr ); break; } } return( src ); }
static cg_name genCtorFlagClr( // CLEAR CTOR FLAGGING cg_name expr, // - current expression cg_type type, // - expression type SE* se ) // - state entry for ctor'ed object { FN_CTL* fctl = FnCtlTop(); // - function information CTOR_FLAG_SET* cfs; // - call-back data if( DtmTabular( fctl ) ) { cfs = CarveAlloc( carve_ctor_flag ); cfs->se = se; expr = CgComma( ctorFlagSet( fctl, O_AND, &cfs->ph_clr ) , expr , type ); expr = CgCallBackRight( expr, &callBackCtorFlag, cfs, type ); } return expr; }
cg_name CgCallBackInitRefBeg( // START CALL-BACK FOR INIT-REF SE* se ) // - state entry for init-ref variable { FstabCtorTest( FnCtlTop() ); return genCtorFlagClr( NULL, TY_POINTER, se ); }
static cg_name emitPatch( // EMIT A PATCH EXPRESSION patch_handle* a_handle ) // - addr[ patch handle ] { return FstabEmitStateVarPatch( a_handle, FnCtlTop() ); }
// 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; } }