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 00005 This program is free software; you can redistribute it and/or modify it 00006 under the terms of version 2 of the GNU General Public License as 00007 published by the Free Software Foundation. 00008 00009 This program is distributed in the hope that it would be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 00013 Further, this software is distributed without any warranty that it is 00014 free of the rightful claim of any third person regarding infringement 00015 or the like. Any license provided herein, whether implied or 00016 otherwise, applies only to this software file. Patent licenses, if 00017 any, provided herein do not apply to combinations of this program with 00018 other software, or any other product whatsoever. 00019 00020 You should have received a copy of the GNU General Public License along 00021 with this program; if not, write the Free Software Foundation, Inc., 59 00022 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00023 00024 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00025 Mountain View, CA 94043, or: 00026 00027 http://www.sgi.com 00028 00029 For further information regarding this notice, see: 00030 00031 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00032 00033 */ 00034 00035 00036 /* elf_interfaces.h 00037 * 00038 * The following macros provide the consumer interface to the 00039 * .MIPS.interfaces ELF section. Full interface specifications 00040 * including parameter type information are currently emitted only 00041 * when the -DEBUG:full_interface_check flag is provided to the 00042 * compiler on the command-line. Without this flag, interface 00043 * specifications are generated only for varargs and unprototyped 00044 * function calls and definitions and these specifications do not 00045 * include parameter type information. For details, consult secton 00046 * 2.11 of the 64-bit Elf Object File Format Specification. 00047 * 00048 * /usr/include/sys/elf.h should also be included when using these 00049 * macros. 00050 * 00051 */ 00052 00053 #ifndef ELF_INTERFACES_H_INCLUDED 00054 #define ELF_INTERFACES_H_INCLUDED 00055 00056 #if (defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)) 00057 00058 /* Elf_Ifc_Size[] provides the sizes (if known) for each fundamental 00059 type. The current compilers will never generate some of these 00060 types. In other cases, not enough semantic information remains in 00061 the backend symbol tables to determine the true category of a type */ 00062 00063 static Elf64_Byte Elf_Ifc_Size[] = { 00064 0, /* 0x0000 = FT_unknown */ 00065 1, /* 0x0001 = FT_signed_char */ 00066 1, /* 0x0002 = FT_unsigned_char */ 00067 2, /* 0x0003 = FT_signed_short */ 00068 2, /* 0x0004 = FT_unsigned_short */ 00069 4, /* 0x0005 = FT_signed_int32 */ 00070 4, /* 0x0006 = FT_unsigned_int32 */ 00071 8, /* 0x0007 = FT_signed_int64 */ 00072 8, /* 0x0008 = FT_unsigned_int64 */ 00073 4, /* 0x0009 = FT_pointer32 */ 00074 8, /* 0x000a = FT_pointer64 */ 00075 4, /* 0x000b = FT_float32 */ 00076 8, /* 0x000c = FT_float64 */ 00077 16, /* 0x000d = FT_float128 */ 00078 8, /* 0x000e = FT_complex64 */ 00079 16, /* 0x000f = FT_complex128 */ 00080 32, /* 0x0010 = FT_complex256 */ 00081 0, /* 0x0011 = FT_void */ 00082 4, /* 0x0012 = FT_bool32 */ 00083 8, /* 0x0013 = FT_bool64 */ 00084 4, /* 0x0014 = FT_label32 */ 00085 8, /* 0x0015 = FT_label64 */ 00086 0, /* 0x0016 = unused */ 00087 0, /* 0x0017 = unused */ 00088 0, /* 0x0018 = unused */ 00089 0, /* 0x0019 = unused */ 00090 0, /* 0x001a = unused */ 00091 0, /* 0x001b = unused */ 00092 0, /* 0x001c = unused */ 00093 0, /* 0x001d = unused */ 00094 0, /* 0x001e = unused */ 00095 0, /* 0x001f = unused */ 00096 0, /* 0x0020 = FT_struct */ 00097 0, /* 0x0021 = FT_union */ 00098 0, /* 0x0022 = FT_enum */ 00099 0, /* 0x0023 = FT_typedef */ 00100 0, /* 0x0024 = FT_set */ 00101 0, /* 0x0025 = FT_range */ 00102 0, /* 0x0026 = FT_member_ptr */ 00103 0, /* 0x0027 = FT_virtual_ptr */ 00104 0 /* 0x0028 = FT_class */ 00105 }; 00106 00107 /* Consumer Macros */ 00108 00109 /* Interface descriptions are complicated data structures which 00110 * include a variable-length (and variable-composition) section of 00111 * possibly unaligned data. The following macros encapsulate most of 00112 * the details of accessing this information 00113 * 00114 * The following conventions apply in these macros: 00115 * pifd = pointer to beginning of an Elf_Ifd (declared in sys/elf.h) 00116 * ppar = pointer to beginning of a parameter descriptor 00117 * 00118 * The layout of this information is described in the 64-bit Elf 00119 * Object File Specification section 2.11 00120 * 00121 */ 00122 00123 #define ELF_IFD_HAS_VARIABLE_PART(pifd) \ 00124 (((pifd)->attrs & (SA_FREE_REGS|SA_PARAMETERS)) ? 1 : 0) 00125 00126 #define ELF_IFD_HAS_FREE_REG_MASK(pifd) \ 00127 (((pifd)->attrs & SA_FREE_REGS) ? 1 : 0) 00128 00129 #define ELF_IFD_HAS_AUX_PCNT(pifd) \ 00130 ((pifd)->pcnt == 255) 00131 00132 #define ELF_IFD_HAS_RETURN_TYPE(pifd) \ 00133 ((pifd)->attrs & SA_FUNCTION) 00134 00135 #define ELF_IFD_FIXED_SIZE (sizeof(Elf_Ifd)) 00136 00137 #define ELF_IFD_VARIABLE_SIZE(pifd) \ 00138 (ELF_IFD_HAS_VARIABLE_PART(pifd) \ 00139 ? *(Elf64_Half *)((Elf64_Byte *)(pifd) + ELF_IFD_FIXED_SIZE) \ 00140 : 0 ) 00141 00142 #define ELF_IFD_TOTAL_SIZE(pifd) \ 00143 (ELF_IFD_FIXED_SIZE + ELF_IFD_VARIABLE_SIZE(pifd)) 00144 00145 #define ELF_IFD_NEXT_INTERFACE(pifd) \ 00146 ((Elf_Ifd *)((Elf64_Byte *)(pifd) + ELF_IFD_TOTAL_SIZE(pifd))) 00147 00148 #define ELF_IFD_VARIABLE_PART(pifd) \ 00149 (ELF_IFD_HAS_VARIABLE_PART(pifd) ? \ 00150 ((Elf64_Byte *) pifd + ELF_IFD_FIXED_SIZE) : 0) 00151 00152 #define ELF_IFD_FREE_REG_MASK(pifd) \ 00153 (*(Elf64_Half *)((Elf64_Byte *)(pifd) + ELF_IFD_FIXED_SIZE + \ 00154 sizeof(Elf64_Word))) 00155 00156 #define ELF_IFD_PARAMETER_COUNT(pifd) \ 00157 (ELF_IFD_HAS_AUX_PCNT(pifd) \ 00158 ? *(Elf64_Half *)((Elf64_Byte *)(pifd) + ELF_IFD_FIXED_SIZE + \ 00159 sizeof(Elf64_Half)) \ 00160 : (pifd)->pcnt) 00161 00162 #define ELF_IFD_FIRST_PARAMETER(pifd) \ 00163 ((Elf64_Byte *)(pifd) + ELF_IFD_FIXED_SIZE + sizeof(Elf64_Half) + \ 00164 (ELF_IFD_HAS_AUX_PCNT(pifd) * sizeof(Elf64_Half)) + \ 00165 (ELF_IFD_HAS_FREE_REG_MASK(pifd) * sizeof(Elf64_Half))) 00166 00167 #define ELF_IFD_NEXT_PARAMETER(ppar) \ 00168 ((Elf64_Byte *)(ppar) + sizeof(Elf64_Half) + \ 00169 (ELF_IFD_PARAMETER_SPECIFIES_SIZE(ppar) * sizeof(Elf64_Word)) + \ 00170 (ELF_IFD_QUALIFIER_COUNT(ppar) * sizeof(Elf64_Byte))) 00171 00172 #define ELF_IFD_PARAMETER_SPECIFIES_SIZE(ppar) \ 00173 (((*(Elf64_Byte *)(ppar)) & PDMF_SIZE) ? 1 : 0) 00174 00175 #define ELF_IFD_QUALIFIER_COUNT(ppar) \ 00176 ((*(Elf64_Byte *)(ppar)) & PDMF_Qualifiers) 00177 00178 #define ELF_IFD_FIRST_QUALIFIER(ppar) \ 00179 ((Elf64_Byte *)(ppar) + sizeof(Elf64_Half) + \ 00180 ELF_IFD_PARAMETER_SPECIFIES_SIZE(ppar) * sizeof(Elf64_Word)) 00181 00182 #define ELF_IFD_PARAMETER_TYPE(ppar) \ 00183 (*((Elf64_Byte *)(ppar) + sizeof(Elf64_Byte))) 00184 00185 #define ELF_IFD_PARAMETER_SIZE(ppar) \ 00186 (ELF_IFD_PARAMETER_SPECIFIES_SIZE(ppar) \ 00187 ? ((Elf64_Word)((((((((Elf64_Byte *)(ppar))[2]<<8) + \ 00188 ((Elf64_Byte *)(ppar))[3])<<8) + \ 00189 ((Elf64_Byte *)(ppar))[4])<<8) + \ 00190 ((Elf64_Byte *)(ppar))[5])) \ 00191 : Elf_Ifc_Size[ELF_IFD_PARAMETER_TYPE(ppar)]) 00192 00193 #endif /* (defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)) */ 00194 00195 #endif /* ELF_INTERFACES_H_INCLUDED */ 00196 00197 00198