extern unsigned_32 BETypeLength( cg_type t ) { //========================================= Action( "BETypeLength" ); Action( "( %s ) -> %l%n", Tipe(t), TypeAddress( t )->length ); return( TypeAddress( t )->length ); }
static type_def *UnSignedIntTipe( type_def *tipe ) /********************************************************/ { switch( tipe->length ) { case 1: return( TypeAddress( TY_UINT_1 ) ); case 2: return( TypeAddress( TY_UINT_2 ) ); case 4: return( TypeAddress( TY_UINT_4 ) ); } _Zoiks( ZOIKS_102 ); /* if we get here bug */ return( NULL ); }
static void DoReloc( dw_sym_handle sym, dw_addr_offset disp ){ /**********************************/ type_def *ptr_type; ptr_type = TypeAddress( TY_NEAR_POINTER ); FEPtr( (cg_sym_handle)sym, ptr_type, disp ); }
type_def *SelNodeType( an node, bool is_signed ) /*************************************************/ { cg_type unsigned_t; cg_type signed_t; switch( node->tipe->length ) { case 1: unsigned_t = TY_UINT_1; signed_t = TY_INT_1; break; case 2: /* no support in switch */ unsigned_t = TY_UINT_2; signed_t = TY_INT_2; break; case 4: unsigned_t = TY_UINT_4; signed_t = TY_INT_4; break; default: /* an error */ unsigned_t = 0; signed_t = 0; break; } return( TypeAddress( is_signed ? signed_t : unsigned_t ) ); }
static void DoLblReloc( back_handle bck, int disp ){ /**********************************/ type_def *ptr_type; segment_id id; id = AskSegID( bck, CG_BACK ); ptr_type = TypeAddress( TY_NEAR_POINTER ); BackPtr( bck, id, disp, ptr_type ); }
extern dbg_type DFScalar( char *name, cg_type tipe ) { /************************************************************/ type_def *tipe_addr; int class; dbg_type ret; tipe_addr = TypeAddress( tipe ); if( tipe_addr->attr & TYPE_FLOAT ){ class = DW_FT_FLOAT; }else if( strcmp( "char", name ) == 0 ){
static void LabelReloc( segment_id segid, back_handle bck, offset disp ) /**********************************************************************/ { type_def *ptr_type; segment_id bck_segid; segment_id old_segid; old_segid = SetOP( segid ); bck_segid = AskSegID( bck, CG_BACK ); ptr_type = TypeAddress( TY_LONG_POINTER ); BackPtr( bck, bck_segid, disp, ptr_type ); SetOP( old_segid ); }
static byte GetScalar( cg_type tipe ) { /*****************************************/ byte scalar; type_def *tipe_addr; tipe_addr = TypeAddress( tipe ); if( tipe_addr->refno == TY_DEFAULT ) { return( SCALAR_VOID ); } scalar = tipe_addr->length - 1; if( tipe_addr->attr & TYPE_FLOAT ) { scalar |= SCALAR_FLOAT; } else if( tipe_addr->attr & TYPE_SIGNED ) { scalar |= SCALAR_INT; } else { scalar |= SCALAR_UNSIGNED; } return( scalar ); }
type_def *ClassType( type_class_def tipe ) /***********************************************/ { return( TypeAddress( Types[tipe] ) ); }
extern void DFObjLineInitDbgInfo( void ) { /*****************************************************/ /* called by objinit to init segments and dwarf writing library */ static const dw_funcs cli_funcs = { CLIReloc, CLIWrite, CLISeek, CLITell, CLIAlloc, CLIFree }; dw_init_info info; dw_cu_info cu; type_def *tipe_addr; info.language = DWLANG_C; info.compiler_options = DW_CM_DEBUGGER; info.abbrev_sym = 0; info.producer_name = SetDwarfProducer(); info.language = SetLang(); if( setjmp( info.exception_handler ) == 0 ) { info.funcs = cli_funcs; InitLineSegBck(); // start each seg with a ref label Client = DWInit( &info ); if( Client == NULL ) { Zoiks( ZOIKS_107 ); /* Bad */ } cu.source_filename = FEAuxInfo( NULL, SOURCE_NAME ); cu.directory = ""; cu.dbg_pch = NULL; cu.inc_list = NULL; cu.inc_list_len = 0; #if _TARGET & ( _TARG_IAPX86 | _TARG_80386 ) if( _IsTargetModel( FLAT_MODEL ) ) { cu.flags = true; cu.segment_size = 0; }else{ cu.flags = false; cu.segment_size = 2; } #else cu.flags = true; cu.segment_size = 0; #endif tipe_addr = TypeAddress( TY_NEAR_POINTER ); cu.offset_size = tipe_addr->length; switch( GetMemModel() ){ case 'h': cu.model = DW_MODEL_HUGE; break; case 'l': cu.model = DW_MODEL_LARGE; break; case 'f': cu.model = DW_MODEL_FLAT; break; case 's': cu.model = DW_MODEL_SMALL; break; default: cu.model = DW_MODEL_NONE; break; } DWInitDebugLine( Client, &cu ); } else { Zoiks( ZOIKS_107 ); /* Big Error */ } }
extern void DFBegCCU( segment_id code, dw_sym_handle dbg_pch ) /****************************************************************/ // Call when codeseg hase been defined { dw_cu_info cu; back_handle bck; segment_id old; type_def *tipe_addr; if( _IsntModel( DBG_LOCALS | DBG_TYPES ) ) { return; } if( CcuDef ) { cu.source_filename = FEAuxInfo( NULL, SOURCE_NAME ); cu.directory = ""; cu.dbg_pch = dbg_pch; cu.inc_list = NULL; cu.inc_list_len = 0; old = SetOP( code ); #if _TARGET & ( _TARG_IAPX86 | _TARG_80386 ) if( _IsTargetModel( FLAT_MODEL ) ) { bck = MakeLabel(); OutLabel( bck->lbl ); Pc_Low = bck; Pc_High = MakeLabel(); // Emitting DW_AT_low_pc and DW_AT_high_pc is valid *only* if the // compilation unit's code is in a single contiguous block (see // DWARF 2, section 3.1). // I don't know how to find out at the time of this call if there's // only one code segment or not, hence these attributes are always // disabled. The low/high pc attribs should probably be handled by // the linker. cu.flags = false; cu.segment_size = 0; } else { bck = NULL; cu.flags = false; Pc_Low = NULL; Pc_High = NULL; cu.segment_size = 2; } #else bck = MakeLabel(); OutLabel( bck->lbl ); Pc_Low = bck; Pc_High = MakeLabel(); cu.flags = true; cu.segment_size = 0; #endif SetOP( old ); Comp_High = Pc_High; tipe_addr = TypeAddress( TY_NEAR_POINTER ); cu.offset_size = tipe_addr->length; switch( GetMemModel() ) { case 'h': cu.model = DW_MODEL_HUGE; break; case 'l': cu.model = DW_MODEL_LARGE; break; case 'f': cu.model = DW_MODEL_FLAT; break; case 's': cu.model = DW_MODEL_SMALL; break; default: cu.model = DW_MODEL_NONE; break; } DWBeginCompileUnit( Client, &cu ); if( cu.flags ) { BEFreeBack( bck ); } } else { CcuDef = true; } }
type_def *ClassType( type_class_def type_class ) /*****************************************************/ { return( TypeAddress( Types[type_class] ) ); }