Open64 (mfef90, whirl2f, and IR tools)
TAG: version-openad; SVN changeset: 916
|
00001 /* 00002 00003 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00004 Portions Copyright (C) 2003 Rice University. 00005 00006 This program is free software; you can redistribute it and/or modify it 00007 under the terms of version 2 of the GNU General Public License as 00008 published by the Free Software Foundation. 00009 00010 This program is distributed in the hope that it would be useful, but 00011 WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00013 00014 Further, this software is distributed without any warranty that it is 00015 free of the rightful claim of any third person regarding infringement 00016 or the like. Any license provided herein, whether implied or 00017 otherwise, applies only to this software file. Patent licenses, if 00018 any, provided herein do not apply to combinations of this program with 00019 other software, or any other product whatsoever. 00020 00021 You should have received a copy of the GNU General Public License along 00022 with this program; if not, write the Free Software Foundation, Inc., 59 00023 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00024 00025 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00026 Mountain View, CA 94043, or: 00027 00028 http://www.sgi.com 00029 00030 For further information regarding this notice, see: 00031 00032 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00033 00034 */ 00035 #ifndef ty_ftn_INCLUDED 00036 #define ty_ftn_INCLUDED 00037 /* ==================================================================== 00038 * ==================================================================== 00039 * 00040 * 00041 * Revision history: 00042 * 18-Jun-03 - Original version based on text extracted from stab_attr.h 00043 * 00044 * Description: 00045 * 00046 * Fortran-specific TY information. 00047 */ 00048 00049 inline BOOL TY_Is_Character_Reference(TY_IDX ty) 00050 { 00051 return TY_Is_Pointer(ty) && 00052 (TY_is_character(TY_pointed(ty)) || 00053 TY_mtype(TY_pointed(ty)) == MTYPE_STR); 00054 } /* TY_Is_Character_Reference */ 00055 00056 /* The front-end is not always reliable in where it sets the is_character 00057 * flag, so we look for it both on the array and on the element type. 00058 */ 00059 inline BOOL TY_Is_Character_String(TY_IDX ty) 00060 { 00061 return TY_is_character(ty) || 00062 TY_mtype(ty) == MTYPE_STR || 00063 (TY_Is_Array(ty) && 00064 TY_Is_Integral(TY_AR_etype(ty)) && 00065 TY_size(TY_AR_etype(ty)) == 1 && 00066 TY_is_character(TY_AR_etype(ty))); 00067 } /* TY_Is_Character_String */ 00068 00069 inline BOOL TY_Is_Chararray(TY_IDX ty) 00070 { 00071 return TY_Is_Array(ty) && TY_Is_Character_String(TY_AR_etype(ty)); 00072 } /* TY_Is_Chararray */ 00073 00074 inline BOOL TY_Is_Chararray_Reference(TY_IDX ty) 00075 { 00076 return TY_Is_Pointer(ty) && TY_Is_Chararray(TY_pointed(ty)); 00077 } /* TY_Is_Chararray_Reference */ 00078 00079 /* A macro to test if a parameter is a character string, in which case 00080 * it needs an implicit length parameter. Note that in the test on the 00081 * argument (caller) side we only need to consider reference types, since 00082 * the call-by-reference always should be explicit on that side. This 00083 * macro should only be used on the subprogram definition side! This 00084 * only applies to Fortran code. 00085 */ 00086 inline BOOL STAB_PARAM_HAS_IMPLICIT_LENGTH(const ST *st) 00087 { 00088 return ((ST_sclass(st) == SCLASS_FORMAL_REF && 00089 TY_Is_Character_String(ST_type(st))) || 00090 (ST_sclass(st) == SCLASS_FORMAL && 00091 (TY_Is_Character_Reference(ST_type(st)) || 00092 TY_Is_Chararray_Reference(ST_type(st))))); 00093 } 00094 00095 /* Identify cases when a reference parameter is explicitly represented 00096 * as a pointer (as opposed to an SCLASS_FORMAL_REF). This only applies 00097 * to Fortran code. 00098 */ 00099 inline BOOL STAB_IS_POINTER_REF_PARAM(const ST *st) 00100 { 00101 return (TY_Is_Pointer(ST_type(st)) && 00102 ST_sclass(st)==SCLASS_FORMAL && 00103 !ST_is_value_parm(st)); 00104 } 00105 00106 #endif /* ty_ftn_INCLUDED */