Skip to content

Commit

Permalink
cleanup aux_info handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalak committed May 31, 2021
1 parent 6f15176 commit d1155c2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 27 deletions.
15 changes: 1 addition & 14 deletions bld/f77/wfc/c/gsubprog.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,7 @@ void GBegCall( itnode *itptr ) {

sp = itptr->sym_ptr;
#if _CPU == 386
{
aux_info *aux;
aux = AuxLookup( sp->u.ns.name, sp->u.ns.u2.name_len );
if( aux != NULL ) {
if( aux->cclass & FAR16_CALL ) {
if( (SubProgId->u.ns.flags & SY_SUBPROG_TYPE) == SY_PROGRAM ) {
ProgramInfo.cclass |= THUNK_PROLOG;
} else {
aux = AuxLookupAdd( SubProgId->u.ns.name, SubProgId->u.ns.u2.name_len );
aux->cclass |= THUNK_PROLOG;
}
}
}
}
CheckFar16Call( sp );
#endif
EmitOp( FC_CALL );
OutPtr( itptr->sym_ptr );
Expand Down
4 changes: 2 additions & 2 deletions bld/f77/wfc/c/inline.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ typedef struct inline_rtn {
const char *pragma;
cg_type typ;
sym_id sym_ptr;
aux_info *aux;
aux_info *info;
} inline_rtn;

static inline_rtn OptTimeInlineTab[] = {
Expand Down Expand Up @@ -451,7 +451,7 @@ call_handle InitInlineCall( rtn_ids rtn_id )
sym->u.ns.xt.size = TypeSize( sym->u.ns.u1.s.typ );
sym->u.ns.u3.address = NULL;
in_entry->sym_ptr = sym;
in_entry->aux = AuxLookup( in_entry->name, name_len );
in_entry->info = InfoLookup( sym );
}
return( CGInitCall( CGFEName( sym, in_entry->typ ), in_entry->typ, in_entry->sym_ptr ) );
#else
Expand Down
31 changes: 21 additions & 10 deletions bld/f77/wfc/c/wf77aux.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ typedef struct aux_info_flg {
typedef struct rt_rtn {
const char *name;
sym_id sym_ptr;
aux_info *aux;
aux_info *info;
byte typ;
} rt_rtn;

Expand Down Expand Up @@ -1370,18 +1370,29 @@ aux_info *AuxLookup( const char *name, size_t name_len )
}


aux_info *AuxLookupAdd( const char *name, size_t name_len )
//=========================================================
#if _CPU == 386
void CheckFar16Call( sym_id sp )
//==============================
{
aux_info *aux;
aux_info *info;

aux = AuxLookup( name, name_len );
if( aux == NULL ) {
aux = NewAuxEntry( name, name_len );
CopyAuxInfo( aux, &FortranInfo );
info = AuxLookup( sp->u.ns.name, sp->u.ns.u2.name_len );
if( info != NULL ) {
if( info->cclass & FAR16_CALL ) {
if( (SubProgId->u.ns.flags & SY_SUBPROG_TYPE) == SY_PROGRAM ) {
ProgramInfo.cclass |= THUNK_PROLOG;
} else {
info = AuxLookup( SubProgId->u.ns.name, SubProgId->u.ns.u2.name_len );
if( info == NULL ) {
info = NewAuxEntry( SubProgId->u.ns.name, SubProgId->u.ns.u2.name_len );
CopyAuxInfo( info, &FortranInfo );
}
info->cclass |= THUNK_PROLOG;
}
}
}
return( aux );
}
#endif


static aux_info *RTAuxInfo( sym_id rtn )
Expand All @@ -1392,7 +1403,7 @@ static aux_info *RTAuxInfo( sym_id rtn )

for( i = 0; i < RT_INDEX_SIZE; i++ ) {
if( RtnTab[i].sym_ptr == rtn ) {
return( RtnTab[i].aux );
return( RtnTab[i].info );
}
}
return( NULL );
Expand Down
4 changes: 3 additions & 1 deletion bld/f77/wfc/h/wf77aux.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ extern void PragmaAux( void );
extern void PragmaLinkage( void );

extern aux_info *AuxLookup( const char *name, size_t name_len );
extern aux_info *AuxLookupAdd( const char *name, size_t name_len );
#if _CPU == 386
extern void CheckFar16Call( sym_id sp );
#endif
extern aux_info *InfoLookup( sym_id sym );
extern call_handle InitCall( RTCODE rtn_id );
extern void InitRtRtns( void );
Expand Down

0 comments on commit d1155c2

Please sign in to comment.