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 ); } }
cg_type CgGetCgType( // GET CODEGEN TYPE TYPE type ) // - type { TYPE basic; // - basic type cg_type cgtype; // - codegen type basic = TypedefModifierRemove( type ); if( basic->id == TYP_CLASS ) { if( OMR_CLASS_VAL == ObjModelArgument( basic ) ) { cgtype = prcCgType( CgTypeOutput( type ) ); } else { cgtype = TY_POINTER; } } else { cgtype = prcCgType( CgTypeOutput( type ) ); } return cgtype; }
cg_type CgTypeSym( // COMPUTE OUTPUT TYPE FOR SYMBOL SYMBOL sym ) // - the symbol { TYPE type = sym->sym_type; if( SymIsArgument( sym ) && NULL != StructType( type ) && OMR_CLASS_REF == ObjModelArgument( type ) ) { type = MakeReferenceTo( type ); } return CgTypeOutput( type ); }
void CgRtCallInit( // SET UP A R/T CALL RT_DEF *def, // - definition for call RTF rt_code ) // - code for run/time call { SYMBOL sym; // - symbol for run/time call sym = RunTimeCallSymbol( rt_code ); def->type = CgTypeOutput( SymFuncReturnType( sym ) ); def->handle = CGInitCall( CgSymbol( sym ) , def->type , (cg_sym_handle)sym ); }
cg_type CgFuncRetnType( // GET CG RETURN TYPE FOR A FUNCTION SYMBOL func ) // - function { TYPE ftype; // - type for function cg_type cgtype; // - codegen type ftype = FunctionDeclarationType( func->sym_type ); if( OMR_CLASS_REF == ObjModelFunctionReturn( ftype ) ) { cgtype = TY_POINTER; } else { cgtype = prcCgType( CgTypeOutput( ftype->of ) ); } return cgtype; }
cg_type CgExprType( // GET EXPRESSION TYPE TYPE type ) // - C++ type { return prcCgType( CgTypeOutput( type ) ); }