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 #ifndef __IR_BWRITE_H__ 00037 #define __IR_BWRITE_H__ 00038 00039 #ifdef __cplusplus 00040 extern "C" { 00041 #endif /* __cplusplus */ 00042 00043 00044 /* 00045 * This flag is usually FALSE, but bedriver may set it to TRUE so that 00046 * the backend's internal maps will be written out. 00047 */ 00048 #ifdef BACK_END 00049 extern BOOL Write_BE_Maps; 00050 extern BOOL Write_AC_INTERNAL_Map; 00051 extern BOOL Write_ALIAS_CLASS_Map; 00052 #endif /* BACK_END */ 00053 00054 00055 /* 00056 * Exported interface for writing WHIRL in binary form to a file. 00057 * All functions return -1 upon failure, which should be treated as 00058 * a fatal error and the process should be aborted. Also, "errno" will 00059 * be set and can be used for printing appropriate error messages. 00060 * If the operation is successful, 0 will be returned. 00061 */ 00062 00063 00064 typedef struct section { 00065 char *name; /* section name */ 00066 Elf64_Shdr shdr; /* Elf section */ 00067 } Section; 00068 00069 00070 typedef struct output_file { 00071 const char *file_name; 00072 INT output_fd; /* file id for output file */ 00073 char *map_addr; /* base address of the mapped region */ 00074 off_t mapped_size; /* max. size of the mapped region */ 00075 off_t file_size; 00076 Section *section_list; /* array of Elf sections */ 00077 INT max_num_of_section; 00078 INT num_of_section; 00079 Section *cur_section; /* set by get_section() */ 00080 } Output_File; 00081 00082 00083 extern Output_File *Current_Output; 00084 00085 /* Call these once at the beginning and end, respectively. */ 00086 extern Output_File *WN_open_output (const char *file_name); 00087 extern void WN_close_output (Output_File *fl); 00088 extern void WN_close_file (void *fl); 00089 00090 00091 /* 00092 * Write global tables to their own Elf sections. These should only be 00093 * called after all the PUs have been written out. 00094 */ 00095 00096 extern void WN_write_globals (Output_File *fl); 00097 extern void WN_write_dst (void *dst, Output_File *fl); 00098 extern void WN_write_strtab (const void *strtab, UINT64 size, Output_File *fl); 00099 extern void WN_write_localmap (void *localmap, Output_File *fl); 00100 extern void IPA_write_summary (void (*IPA_irb_write_summary) (Output_File*), 00101 Output_File *fl); 00102 extern void IPA_copy_PU(PU_Info *pu, char *section_base, Output_File *outfile); 00103 00104 extern void WN_write_flags (INT argc, char **argv, Output_File *fl); 00105 extern void WN_write_revision (Output_File *fl); 00106 extern void WN_close_file (void *this_fl); 00107 00108 00109 00110 /* 00111 * Write PU section header. This must be called after writing out all the 00112 * PUs but before writing any of the global tables. 00113 */ 00114 00115 extern void WN_write_PU_Infos (PU_Info *pu_list, Output_File *fl); 00116 00117 00118 /* 00119 * Write PU-specific structions to subsections of the PU section. 00120 * WN_write_tree uses the "off_map" mapping to store the subsection offsets 00121 * of the WHIRL nodes that may be referenced by the dependence graph or 00122 * prefetch pointers. 00123 */ 00124 00125 extern void WN_write_tree (PU_Info *pu, WN_MAP off_map, Output_File *fl); 00126 extern void WN_write_symtab (PU_Info *pu, Output_File *fl); 00127 extern void WN_write_depgraph (PU_Info *pu, WN_MAP off_map, Output_File *fl); 00128 extern void WN_write_prefetch (PU_Info *pu, WN_MAP off_map, Output_File *fl); 00129 extern void WN_write_feedback (PU_Info *pu, Output_File *fl); 00130 extern void WN_write_INT32_map(PU_Info *pu, 00131 WN_MAP off_map, 00132 Output_File *fl, 00133 INT32 subsection_type, 00134 WN_MAP value_map, 00135 const char *subsection_name); 00136 extern void WN_write_voidptr_map(PU_Info *pu, 00137 WN_MAP off_map, 00138 Output_File *fl, 00139 INT32 subsection_type, 00140 WN_MAP value_map, 00141 const char *subsection_name); 00142 #ifndef OWN_ERROR_PACKAGE 00143 00144 /* 00145 * Define common routines for writing all the whirl sections. 00146 * These routines use the standard compiler error reporting mechanism. 00147 */ 00148 00149 extern Output_File *Open_Output_Info (const char *output_file); 00150 extern void Write_PU_Info (PU_Info *pu); 00151 extern void Write_Global_Info (PU_Info *pu_tree); 00152 extern void Close_Output_Info (void); 00153 extern void WN_write_elf_symtab (const void* symtab, UINT64 size, 00154 UINT64 entsize, UINT align, Output_File* fl); 00155 00156 #endif 00157 00158 #ifdef __cplusplus 00159 } 00160 #endif /* __cplusplus */ 00161 00162 #endif /* __IR_BWRITE_H__ */