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 00037 #ifndef _IPA_LNO_FILE 00038 #define _IPA_LNO_FILE "ipa_lno_file.h" 00039 00040 #ifndef __SYS_ELF_H__ 00041 #include <elf.h> 00042 #endif 00043 00044 #ifndef pu_info_INCLUDED 00045 #include "pu_info.h" 00046 #endif 00047 00048 #ifndef __IR_BWRITE_H__ 00049 #include <sys/types.h> 00050 #include "ir_bwrite.h" 00051 #endif 00052 00053 #ifndef cxx_ipa_lno_summary_INCLUDED 00054 #include "ipa_lno_summary.h" 00055 #endif 00056 00057 #ifndef ipa_section_INCLUDED 00058 #include "ipa_section.h" 00059 #endif 00060 00061 class SUMMARY_VALUE; 00062 class SUMMARY_EXPR; 00063 00064 //----------------------------------------------------------------------- 00065 // Error codes for reading and writing IPALNO file. 00066 //----------------------------------------------------------------------- 00067 00068 const INT IPALNO_SUCCESS = 0; 00069 const INT IPALNO_FORMAT_ERROR = -1; 00070 const INT IPALNO_ABI_MISMATCH = -2; 00071 const INT IPALNO_REVISION_MISMATCH = -3; 00072 const INT IPALNO_READER_ERROR = -4; 00073 const INT IPALNO_CLOSE_ERROR = -5; 00074 00075 //----------------------------------------------------------------------- 00076 // NAME: Input_File 00077 // FUNCTION: Information about IPALNO while being read. 00078 //----------------------------------------------------------------------- 00079 00080 const INT MAX_FILE_REVISION = 80; 00081 00082 typedef struct input_file { 00083 void* mapped_address; // start address of mmapped region 00084 off_t mapped_size; // size of mmapped region 00085 char file_revision[MAX_FILE_REVISION]; // file revision string 00086 } Input_File; 00087 00088 //----------------------------------------------------------------------- 00089 // NAME: IPA_LNO_READ_FILE 00090 // FUNCTION: Information and methods for IPALNO file while being read. 00091 //----------------------------------------------------------------------- 00092 00093 class IPA_LNO_READ_FILE { 00094 private: 00095 INT Check_Elf_Header(); 00096 INT Check_Section_Headers(); 00097 INT Check_Input(); 00098 Elf64_Shdr* Section_Header(Elf64_Word info); 00099 INT Original_Ivar_Count(); 00100 DYN_ARRAY<IVAR> _extra_ivars; 00101 public: 00102 IPA_LNO_READ_FILE(MEM_POOL* pool) 00103 { ifl = NULL; _extra_ivars.Set_Mem_Pool(pool); }; 00104 Input_File* ifl; 00105 INT Open_Read_File(char *file_name); 00106 void* Section_Address(Elf64_Word info); 00107 INT Section_Size(Elf64_Word info); 00108 void Close_Read_File(); 00109 // The following methods are for specific sections. 00110 IPA_LNO_SUMMARY_PROCEDURE* Procedure(INT i); 00111 INT Procedure_Count(); 00112 PROJECTED_REGION* Projected_Region(INT i); 00113 INT Projected_Region_Count(); 00114 PROJECTED_NODE* Projected_Node(INT i); 00115 INT Projected_Node_Count(); 00116 TERM* Term(INT i); 00117 INT Term_Count(); 00118 IVAR* Ivar(INT i); 00119 INT Ivar_Count(); 00120 INT Add_Translated_Ivar(const IVAR& ivar); 00121 INT Add_Translated_Ivar_Unique(const IVAR& ivar); 00122 IPA_LNO_SUMMARY_FORMAL* Formal(INT i); 00123 INT Formal_Count(); 00124 IPA_LNO_SUMMARY_GLOBAL* Global(INT i); 00125 INT Global_Count(); 00126 SUMMARY_VALUE* Value(INT i); 00127 INT Value_Count(); 00128 SUMMARY_EXPR* Expr(INT i); 00129 INT Expr_Count(); 00130 }; 00131 00132 //----------------------------------------------------------------------- 00133 // NAME: IPA_LNO_WRITE_FILE 00134 // FUNCTION: Information and methods for IPALNO file while being written. 00135 //----------------------------------------------------------------------- 00136 00137 class IPA_LNO_WRITE_FILE { 00138 private: 00139 Section* Create_Or_Get_Section(Elf64_Word sh_info, char *name); 00140 void Create_Sections(); 00141 INT Create_Temp_File(); 00142 Elf64_Off Create_String_Table_Section(Elf64_Shdr *strtab_sec); 00143 void Write_Headers(Elf64_Off e_shoff, Elf64_Shdr* strtab_sec); 00144 void Write_Revision(); 00145 void Write_Cleanup(); 00146 public: 00147 Output_File* ofl; 00148 IPA_LNO_WRITE_FILE() {ofl = NULL;}; 00149 void Open_Write_File(char *file_name); 00150 void Write_Section(Elf64_Word sh_info, char* name, void* buf, INT size); 00151 INT Close_Write_File(); 00152 }; 00153 00154 #endif /* IPA_LNO_FILE */ 00155