Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
ir_bread.h
Go to the documentation of this file.
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_BREAD_H__
00037 #define __IR_BREAD_H__
00038 
00039 #include "wn_map.h"
00040 
00041 #define REVISION_MISMATCH 0
00042 #define READER_ERROR -1
00043 #define ABI_MISMATCH -2
00044                                        
00045 
00046 struct OFFSET_AND_SIZE
00047 {
00048     INT64 offset;
00049     UINT64 size;
00050 
00051     OFFSET_AND_SIZE (INT64 o, UINT64 s) : offset (o), size (s) {}
00052 };
00053 
00054 
00055 /*
00056  * Exported interface for reading binary WHIRL from a file.
00057  */
00058 
00059 OFFSET_AND_SIZE
00060 get_section (void *handle, Elf64_Word type, Elf64_Word info);    
00061 
00062 /* Enable/disable verbose info for debugging. */
00063 extern void Set_Verbose_Info (BOOL val);
00064 
00065 /* Check the Elf headers (called from elfdump) */
00066 extern INT WN_massage_input (char *baseaddr, Elf64_Word size, 
00067                              char* file_revision);
00068 
00069 /* Find the beginning of a particular section */
00070 extern void *WN_get_section_base (void *handle, INT sect);
00071 
00072 /* return size of elf section */
00073 extern Elf64_Word Get_Elf_Section_Size (void *handle, Elf64_Word type, 
00074                                         Elf64_Word info);
00075 
00076 
00077 /* Call these once at the beginning and end, respectively. */
00078 extern void *WN_inline_open_file (const char* file_name, off_t *mapped_size,
00079                                   char* file_revision); 
00080 
00081 extern void *
00082 WN_open_input (const char *filename, off_t *mapped_size);
00083 
00084 
00085 /*
00086  * Read the PU subsection headers into a tree of PU_Info structures.
00087  * Returns a pointer to the root of the tree or -1 on error.  The
00088  * number of PUs is returned through the p_num_PUs parameter.
00089  */
00090 
00091 extern PU_Info *WN_get_PU_Infos (void *handle, INT32 *p_num_PUs);
00092 
00093 
00094 /*
00095  * Read the PU subsections.  These return -1 for errors.
00096  */
00097 
00098 extern WN *WN_get_tree (void *handle, PU_Info *pu);
00099 extern INT WN_get_symtab (void *handle, PU_Info *pu);
00100 extern void *WN_get_depgraph (void *handle, PU_Info *pu);
00101 extern INT WN_get_prefetch (void *handle, PU_Info *pu);
00102 
00103 extern INT WN_get_INT32_map(void *handle, PU_Info *pu,
00104                             INT32 subsection_type, WN_MAP value_map);
00105 
00106 extern ST *WN_get_proc_sym (PU_Info *pu);
00107 
00108 
00109 /*
00110  * Read the global tables.  These are usually called right after opening
00111  * the input file.  They return -1 for errors.
00112  */
00113 
00114 
00115 extern INT WN_get_global_symtab (void *handle);
00116 extern INT WN_get_strtab (void *handle);
00117 
00118 
00119 extern INT WN_get_dst (void *handle);
00120 extern INT WN_get_localmap (void *handle);
00121 extern INT WN_get_feedback (void* handle, PU_Info*pu, MEM_POOL* pool);    
00122 
00123 /*
00124  * Read the command line flags used to compile the input file.  The
00125  * return value is argc (or 0 if the flags are missing) and the argv
00126  * array is returned through the argv parameter.
00127  */
00128 
00129 extern INT WN_get_flags (void *handle, char ***argv);
00130 
00131 
00132 #ifndef OWN_ERROR_PACKAGE
00133 /*
00134  * Define common routines for reading all the whirl sections.
00135  * These routines use the standard compiler error reporting mechanism.
00136  */
00137 
00138 /* Open_Input_Info opens a single file for global and local info;
00139  * Open_Global_Input only opens the global file,
00140  * Open_Local_Input only opens the local file.
00141  */
00142 extern void* Open_Input_Info (const char *input_file);
00143 extern void* Open_Global_Input (const char *input_file);
00144 extern void* Open_Local_Input (const char *input_file);
00145 extern PU_Info *Read_Global_Info (INT32 *p_num_PUs);
00146 extern void Read_Local_Info (MEM_POOL *pool, PU_Info *pu);
00147 extern void Free_Local_Info (PU_Info *pu);
00148 extern void Free_Dep_Graph (void);
00149 extern void Free_Local_Input(void);
00150 extern void Free_Input_Info (void);
00151 
00152 #endif
00153 
00154 #endif /* __IR_BREAD_H__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines