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 /* ==================================================================== 00038 * ==================================================================== 00039 * 00040 * 00041 * Revision history: 00042 * 11-Nov-94 - Original Version 00043 * 00044 * Description: 00045 * 00046 * General support for data layout functionality in the back end. 00047 * 00048 * Also see: stblock.h for base block handling. 00049 * 00050 * ==================================================================== 00051 * ==================================================================== 00052 */ 00053 #ifndef data_layout_INCLUDED 00054 #define data_layout_INCLUDED 00055 00056 #include "stab.h" 00057 #include "wn.h" 00058 #include "targ_sim.h" 00059 00060 #ifdef __cplusplus 00061 extern "C" { 00062 #endif 00063 00064 extern ST *SP_Sym; /* stack pointer */ 00065 extern ST *FP_Sym; /* frame pointer */ 00066 extern ST *Local_Spill_Sym; /* reserved close location for spill */ 00067 00068 /* direction for the stack frame to grow */ 00069 typedef enum { INCREMENT, DECREMENT } STACK_DIR; 00070 00071 /* Choice of stack model to use: */ 00072 typedef enum { 00073 SMODEL_UNDEF = 0, /* Not yet defined */ 00074 SMODEL_SMALL = 1, /* Small frame, no frame pointer */ 00075 SMODEL_LARGE = 2, /* Large frame, use frame pointer */ 00076 SMODEL_DYNAMIC = 3 /* Dynamic allocation, use frame pointer */ 00077 } STACK_MODEL; 00078 00079 extern STACK_MODEL Current_PU_Stack_Model; /* stack model of current pu */ 00080 00081 extern STACK_DIR Stack_Direction(void); 00082 00083 /* 00084 * Initialize_Stack_Frame must be called once per PU, 00085 * before it is split into regions. 00086 * This will determine the stack model, 00087 * set up internal structures, and allocate all formals. 00088 */ 00089 extern void Initialize_Stack_Frame (WN *PU_tree); 00090 00091 // This is called after lowering, when have more accurate view of code. 00092 extern void Calculate_Stack_Frame_Sizes (WN *PU_tree); 00093 00094 /* 00095 * Finalize_Stack_Frame should be called once per PU before cgemit; 00096 * it returns the stack frame size. 00097 */ 00098 extern INT64 Finalize_Stack_Frame(void); 00099 00100 /* 00101 * Verify that stack space needed for actuals doesn't overflow 00102 * what we initially reserved. 00103 */ 00104 extern void Check_Actual_Stack_Size (WN *call_tree); 00105 00106 /* allocate a temporary for the vararg formal */ 00107 extern ST *Allocate_Vararg_Formal (void); 00108 00109 extern BOOL Is_Allocated (ST *st); /* has ST been allocated? */ 00110 00111 /* Allocate the memory location for this object 'st' */ 00112 extern void Allocate_Object ( ST *st ); 00113 00114 /* This function allows the code generator to allocate space for */ 00115 /* register spilled temp variable */ 00116 extern void Allocate_Temp_To_Memory ( ST *st ); 00117 00118 /* Get upformal symbol for altentries that will be copied to temp space */ 00119 extern ST* Get_Altentry_UpFormal_Symbol (ST *formal, PLOC ploc); 00120 00121 /* reset the upformal segment when start an alternate entry */ 00122 extern void Reset_UPFORMAL_Segment(void ); 00123 00124 /* get vararg symbol that corresponds to ploc value */ 00125 extern ST* Get_Vararg_Symbol (PLOC); 00126 00127 /* 00128 * Allocate the memory location for all global/static symbols. 00129 */ 00130 extern void Allocate_File_Statics (void); 00131 00132 /* 00133 * Pad global, C arrays 00134 */ 00135 extern void Pad_Global_Arrays(); 00136 00137 /* return GUESS of whether ST will use an offset < 16 bits */ 00138 extern BOOL Uses_Small_Offset (ST *st, WN_OFFSET wn_ofst); 00139 00140 extern INT32 Stack_Alignment (void); 00141 00142 /* Return true if the ST is defined on the stack */ 00143 extern BOOL ST_on_stack(ST *); 00144 00145 /* Return true if the ST is defined in the pu */ 00146 extern BOOL ST_pu_defined(ST *); 00147 00148 /* Look for a formal-ref-base corresponding to the sym. */ 00149 extern ST * Get_ST_formal_ref_base (const ST *sym); 00150 extern void Set_ST_formal_ref_base (const ST *sym, ST *base); 00151 00152 /* return 0 if no formal-preg-num */ 00153 extern PREG_NUM Get_ST_formal_preg_num (const ST *base); 00154 extern void Set_ST_formal_preg_num (const ST *base, PREG_NUM p); 00155 00156 inline BOOL ST_has_formal_preg_num (const ST *const st) 00157 { 00158 return (ST_sclass(st) == SCLASS_FORMAL && 00159 Get_ST_formal_preg_num(st) != 0); 00160 } 00161 00162 /* Map arg-area-size to the corresponding PU */ 00163 extern UINT32 Get_PU_arg_area_size(PU_IDX); 00164 extern void Set_PU_arg_area_size(PU_IDX, UINT32 size); 00165 00166 /* size of actual build area for current PU */ 00167 extern INT32 Current_PU_Actual_Size; 00168 00169 /* return ST for __return_address if one exists */ 00170 extern ST * Find_Special_Return_Address_Symbol (void); 00171 00172 /* return stack offset adjustment, which may depend on size of pu frame */ 00173 extern INT Stack_Offset_Adjustment_For_PU (void); 00174 00175 #ifdef __cplusplus 00176 } 00177 #endif 00178 #endif /* data_layout_INCLUDED */ 00179