Beispiel #1
0
/*
//    This section is for
//        8086
//        386
//
//    pass auxiliary information to back end
*/
CGPOINTER FEAuxInfo( CGPOINTER req_handle, int request )
{
    aux_info             *inf;
    auto SYM_ENTRY       sym;
    static hw_reg_set    save_set;

    switch( request ) {
    case SOURCE_LANGUAGE:
        return( (CGPOINTER)"C" );
    case STACK_SIZE_8087:
        return( (CGPOINTER)(pointer_int)Stack87 );
    case CODE_GROUP:
        return( (CGPOINTER)GenCodeGroup );
    case DATA_GROUP:
        return( (CGPOINTER)DataSegName );
    case OBJECT_FILE_NAME:
        return( (CGPOINTER)ObjFileName() );
    case REVISION_NUMBER:
        return( (CGPOINTER)(pointer_int)II_REVISION );
    case AUX_LOOKUP:
        return( req_handle );
    case PROEPI_DATA_SIZE:
        return( (CGPOINTER)(pointer_int)ProEpiDataSize );
    case DBG_PREDEF_SYM:
        return( (CGPOINTER)SymDFAbbr );
    case P5_CHIP_BUG_SYM:
        return( (CGPOINTER)SymChipBug );
    case CODE_LABEL_ALIGNMENT:
        {
            static  unsigned char   Alignment[] = { 2, 1, 1 };

            if( OptSize == 0 )
                Alignment[1] = TARGET_INT;

            return( (CGPOINTER)Alignment );
        }
    case CLASS_NAME:
        return( (CGPOINTER)SegClassName( (segment_id)(pointer_int)req_handle ) );
    case USED_8087:
        CompFlags.pgm_used_8087 = 1;
        return( NULL );
  #if _CPU == 386
    case P5_PROF_DATA:
        return( (CGPOINTER)FunctionProfileBlock );
    case P5_PROF_SEG:
        return( (CGPOINTER)(pointer_int)FunctionProfileSegment );
  #endif
    case SOURCE_NAME:
        if( SrcFName == ModuleName ) {
            return( (CGPOINTER)FNameFullPath( FNames ) );
        } else {
            return( (CGPOINTER)ModuleName );
        }
    case CALL_CLASS:
        {
            static call_class cclass;

            cclass = GetCallClass( req_handle );
            return( (CGPOINTER)&cclass );
        }
    case FREE_SEGMENT:
        return( NULL );
    case NEXT_LIBRARY:
    case LIBRARY_NAME:
        return( NextLibrary( (int)(pointer_int)req_handle, request ) );
    case NEXT_IMPORT:
    case IMPORT_NAME:
        return( NextImport( (int)(pointer_int)req_handle, request ) );
    case NEXT_IMPORT_S:
    case IMPORT_NAME_S:
        return( NextImportS( (int)(pointer_int)req_handle, request ) );
    case NEXT_ALIAS:
    case ALIAS_NAME:
    case ALIAS_SYMBOL:
    case ALIAS_SUBST_NAME:
    case ALIAS_SUBST_SYMBOL:
        return( NextAlias( (int)(pointer_int)req_handle, request ) );
    case TEMP_LOC_NAME:
        return( (CGPOINTER)(pointer_int)TEMP_LOC_QUIT );
    case TEMP_LOC_TELL:
        return( NULL );
    case NEXT_DEPENDENCY:
        if( CompFlags.emit_dependencies )
            return( (CGPOINTER)NextDependency( (FNAMEPTR)req_handle ) );
        return( NULL );
    case DEPENDENCY_TIMESTAMP:
        return( (CGPOINTER)getFileDepTimeStamp( (FNAMEPTR)req_handle ) );
    case DEPENDENCY_NAME:
        return( (CGPOINTER)FNameFullPath( (FNAMEPTR)req_handle ) );
    case PEGGED_REGISTER:
        return( (CGPOINTER)SegPeggedReg( (segment_id)(pointer_int)req_handle ) );
    default:
        break;
    }

    inf = FindInfo( &sym, req_handle );
    switch( request ) {
    case SAVE_REGS:
        if( req_handle != 0 ) {
            inf = LangInfo( sym.mods, inf );
        } else {
            sym.mods = 0;
        }
        save_set = inf->save;
        if( sym.mods & FLAG_SAVEREGS ) {
            HW_CTurnOn( save_set, HW_SEGS );
        }

  #ifdef __SEH__
        if( (SYM_HANDLE)req_handle == SymTryInit ) {
            HW_CTurnOff( save_set, HW_SP );
        }
  #endif
        return( (CGPOINTER)&save_set );
    case RETURN_REG:
        if( req_handle != 0 ) {
            inf = LangInfo( sym.mods, inf );
        }
        return( (CGPOINTER)&inf->returns );
    case CALL_BYTES:
        return( (CGPOINTER)inf->code );
    case PARM_REGS:
  #ifdef __SEH__
        if(( (SYM_HANDLE)req_handle == SymTryInit )
          || ( (SYM_HANDLE)req_handle == SymTryFini )
          || ( (SYM_HANDLE)req_handle == SymTryUnwind )
          || ( (SYM_HANDLE)req_handle == SymExcept )) {
            return( (CGPOINTER)TryParms );
        }
  #endif
        if( req_handle != 0 ) {
            inf = LangInfo( sym.mods, inf );
            if( inf->code == NULL && VarFunc( &sym ) ) {
                return( (CGPOINTER)DefaultVarParms );
            }
        }
        return( (CGPOINTER)inf->parms );
    case STRETURN_REG:
        if( req_handle != 0 ) {
            inf = LangInfo( sym.mods, inf );
        }
        return( (CGPOINTER)&inf->streturn );
    default:
        break;
    }
    return( NULL );
}
Beispiel #2
0
/*
//    This section is NOT 8086 and 386 , i.e.,
//        _AXP
//        _PPC
//        _MIPS
//
//    pass auxiliary information to back end
*/
CGPOINTER FEAuxInfo( CGPOINTER req_handle, int request )
{
    aux_info                *inf;
    auto SYM_ENTRY          sym;
    static hw_reg_set       save_set;

    switch( request ) {
    case SOURCE_LANGUAGE:
        return( (CGPOINTER)"C" );
    case OBJECT_FILE_NAME:
        return( (CGPOINTER)ObjFileName() );
    case REVISION_NUMBER:
        return( (CGPOINTER)(pointer_int)II_REVISION );
    case AUX_LOOKUP:
        return( req_handle );
    case SOURCE_NAME:
        if( SrcFName == ModuleName ) {
            return( (CGPOINTER)FNameFullPath( FNames ) );
        } else {
            return( (CGPOINTER)ModuleName );
        }
    case CALL_CLASS:
        {
            static call_class cclass;

            cclass = GetCallClass( req_handle );
            return( (CGPOINTER)&cclass );
        }
    case NEXT_LIBRARY:
    case LIBRARY_NAME:
        return( NextLibrary( (int)(pointer_int)req_handle, request ) );
    case NEXT_IMPORT:
    case IMPORT_NAME:
        return( NextImport( (int)(pointer_int)req_handle, request ) );
    case NEXT_IMPORT_S:
    case IMPORT_NAME_S:
        return( NextImportS( (int)(pointer_int)req_handle, request ) );
    case NEXT_ALIAS:
    case ALIAS_NAME:
    case ALIAS_SYMBOL:
    case ALIAS_SUBST_NAME:
    case ALIAS_SUBST_SYMBOL:
        return( NextAlias( (int)(pointer_int)req_handle, request ) );
    case FREE_SEGMENT:
        return( NULL );
    case TEMP_LOC_NAME:
        return( (CGPOINTER)(pointer_int)TEMP_LOC_QUIT );
    case TEMP_LOC_TELL:
        return( NULL );
    case NEXT_DEPENDENCY:
        if( CompFlags.emit_dependencies )
            return( (CGPOINTER)NextDependency( (FNAMEPTR)req_handle ) );
        return( NULL );
    case DEPENDENCY_TIMESTAMP:
        return( (CGPOINTER)getFileDepTimeStamp( (FNAMEPTR)req_handle ) );
    case DEPENDENCY_NAME:
        return( (CGPOINTER)FNameFullPath( (FNAMEPTR)req_handle ) );
    default:
        break;
    }

    inf = FindInfo( &sym, req_handle );
    switch( request ) {
    case SAVE_REGS:
        if( req_handle != 0 ) {
            inf = LangInfo( sym.mods, inf );
        } else {
            sym.mods = 0;
        }
        save_set = inf->save;
        return( (CGPOINTER)&save_set );
    case RETURN_REG:
        if( req_handle != 0 ) {
            inf = LangInfo( sym.mods, inf );
        }
        return( (CGPOINTER)&inf->returns );
    case CALL_BYTES:
        return( (CGPOINTER)inf->code );
    case PARM_REGS:
        if( req_handle != 0 ) {
            inf = LangInfo( sym.mods, inf );
            if( inf->code == NULL && VarFunc( &sym ) ) {
                return( (CGPOINTER)DefaultVarParms );
            }
        }
        return( (CGPOINTER)inf->parms );
    default:
        break;
    }
    return( NULL );
}
Beispiel #3
0
/*
//    pass auxiliary information to back end
*/
VOIDPTR FEAuxInfo( CGSYM_HANDLE cgsym_handle, int request )
{
    SYM_HANDLE              sym_handle = cgsym_handle;
    struct aux_info         *inf;
    auto SYM_ENTRY          sym;
    static hw_reg_set       save_set;

    switch( request ) {
    case SOURCE_LANGUAGE:
        return( "C" );
    case OBJECT_FILE_NAME:
        return( (VOIDPTR)ObjFileName( OBJ_EXT ) );
    case REVISION_NUMBER:
        return( (VOIDPTR)II_REVISION );
    case AUX_LOOKUP:
        return( (VOIDPTR)sym_handle );
    case SOURCE_NAME:
        if( SrcFName == ModuleName ) {
            return( FNameFullPath( FNames ) );
        } else {
            return( ModuleName );
        }
    case CALL_CLASS:
        GetCallClass( sym_handle );
        return( &CallClass );
    case NEXT_LIBRARY:
    case LIBRARY_NAME:
        return( NextLibrary( (int)sym_handle, request ) );
    case NEXT_IMPORT:
    case IMPORT_NAME:
        return( NextImport( (int)sym_handle, request ) );
    case NEXT_IMPORT_S:
    case IMPORT_NAME_S:
        return( NextImportS( (int)sym_handle, request ) );
    case NEXT_ALIAS:
    case ALIAS_NAME:
    case ALIAS_SYMBOL:
    case ALIAS_SUBST_NAME:
    case ALIAS_SUBST_SYMBOL:
        return( NextAlias( (int)sym_handle, request ) );
    case FREE_SEGMENT:
        return( NULL );
    case TEMP_LOC_NAME:
        return( (char *)TEMP_LOC_QUIT );
    case TEMP_LOC_TELL:
        return( NULL );
    case NEXT_DEPENDENCY:                               /* 03-dec-92 */
        if( CompFlags.emit_dependencies )
            return( NextDependency( (FNAMEPTR) cgsym_handle ) );
        return( NULL );
    case DEPENDENCY_TIMESTAMP:
        return( getFileDepTimeStamp( (FNAMEPTR)cgsym_handle ) );
    case DEPENDENCY_NAME:
        return( FNameFullPath( (FNAMEPTR)cgsym_handle ) );
    default:
        break;
    }

    inf = FindInfo( &sym, sym_handle );
    switch( request ) {
    case SAVE_REGS:
        if( sym_handle != 0 ) {
            inf = LangInfo( sym.attrib, inf );
        } else {
            sym.attrib = 0;
        }
        save_set = inf->save;
        return( &save_set );
    case RETURN_REG:
        if( sym_handle != 0 ) {
            inf = LangInfo( sym.attrib, inf );
        }
        return( &inf->returns );
    case CALL_BYTES:
        return( inf->code );
    case PARM_REGS:
        if( sym_handle != 0 ) {
            inf = LangInfo( sym.attrib, inf );
            if( inf->code == NULL && VarFunc( &sym ) ) {
                return( DefaultVarParms );
            }
        }
        return( inf->parms );
    default:
        break;
    }
    return( NULL );
}