00001 /* 00002 * Copyright 2004, 2005, 2006 PathScale, Inc. All Rights Reserved. 00003 */ 00004 00005 /* 00006 00007 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00008 00009 This program is free software; you can redistribute it and/or modify it 00010 under the terms of version 2 of the GNU General Public License as 00011 published by the Free Software Foundation. 00012 00013 This program is distributed in the hope that it would be useful, but 00014 WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 00017 Further, this software is distributed without any warranty that it is 00018 free of the rightful claim of any third person regarding infringement 00019 or the like. Any license provided herein, whether implied or 00020 otherwise, applies only to this software file. Patent licenses, if 00021 any, provided herein do not apply to combinations of this program with 00022 other software, or any other product whatsoever. 00023 00024 You should have received a copy of the GNU General Public License along 00025 with this program; if not, write the Free Software Foundation, Inc., 59 00026 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00027 00028 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00029 Mountain View, CA 94043, or: 00030 00031 http://www.sgi.com 00032 00033 For further information regarding this notice, see: 00034 00035 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00036 00037 */ 00038 00039 00040 00041 /* ==================================================================== 00042 * ==================================================================== 00043 * 00044 * Module: data_layout.h 00045 * $Revision: 1.9 $ 00046 * $Date: 05/12/05 08:59:12-08:00 $ 00047 * $Author: bos@eng-24.pathscale.com $ 00048 * $Source: /scratch/mee/2.4-65/kpro64-pending/be/com/SCCS/s.data_layout.h $ 00049 * 00050 * Revision history: 00051 * 11-Nov-94 - Original Version 00052 * 00053 * Description: 00054 * 00055 * General support for data layout functionality in the back end. 00056 * 00057 * Also see: stblock.h for base block handling. 00058 * 00059 * ==================================================================== 00060 * ==================================================================== 00061 */ 00062 #ifndef data_layout_INCLUDED 00063 #define data_layout_INCLUDED 00064 00065 #include "stab.h" 00066 #include "wn.h" 00067 #include "targ_sim.h" 00068 00069 #ifdef __cplusplus 00070 extern "C" { 00071 #endif 00072 00073 extern ST *SP_Sym; /* stack pointer */ 00074 extern ST *FP_Sym; /* frame pointer */ 00075 extern ST *Local_Spill_Sym; /* reserved close location for spill */ 00076 00077 /* direction for the stack frame to grow */ 00078 typedef enum { INCREMENT, DECREMENT } STACK_DIR; 00079 00080 /* Choice of stack model to use: */ 00081 typedef enum { 00082 SMODEL_UNDEF = 0, /* Not yet defined */ 00083 SMODEL_SMALL = 1, /* Small frame, no frame pointer */ 00084 SMODEL_LARGE = 2, /* Large frame, use frame pointer */ 00085 SMODEL_DYNAMIC = 3 /* Dynamic allocation, use frame pointer */ 00086 } STACK_MODEL; 00087 00088 extern STACK_MODEL Current_PU_Stack_Model; /* stack model of current pu */ 00089 00090 extern STACK_DIR Stack_Direction(void); 00091 00092 /* 00093 * Initialize_Stack_Frame must be called once per PU, 00094 * before it is split into regions. 00095 * This will determine the stack model, 00096 * set up internal structures, and allocate all formals. 00097 */ 00098 extern void Initialize_Stack_Frame (WN *PU_tree); 00099 00100 // This is called after lowering, when have more accurate view of code. 00101 extern void Calculate_Stack_Frame_Sizes (WN *PU_tree); 00102 00103 /* 00104 * Finalize_Stack_Frame should be called once per PU before cgemit; 00105 * it returns the stack frame size. 00106 */ 00107 extern INT64 Finalize_Stack_Frame(void); 00108 00109 /* 00110 * Verify that stack space needed for actuals doesn't overflow 00111 * what we initially reserved. 00112 */ 00113 extern void Check_Actual_Stack_Size (WN *call_tree); 00114 00115 /* allocate a temporary for the vararg formal */ 00116 extern ST *Allocate_Vararg_Formal (void); 00117 00118 extern BOOL Is_Allocated (ST *st); /* has ST been allocated? */ 00119 00120 /* Allocate the memory location for this object 'st' */ 00121 extern void Allocate_Object ( ST *st ); 00122 00123 /* This function allows the code generator to allocate space for */ 00124 /* register spilled temp variable */ 00125 extern void Allocate_Temp_To_Memory ( ST *st ); 00126 00127 /* Get upformal symbol for altentries that will be copied to temp space */ 00128 extern ST* Get_Altentry_UpFormal_Symbol (ST *formal, PLOC ploc); 00129 00130 /* reset the upformal segment when start an alternate entry */ 00131 extern void Reset_UPFORMAL_Segment(void ); 00132 00133 /* get vararg symbol that corresponds to ploc value */ 00134 extern ST* Get_Vararg_Symbol (PLOC); 00135 00136 /* 00137 * Allocate the memory location for all global/static symbols. 00138 */ 00139 extern void Allocate_File_Statics (void); 00140 #ifdef KEY 00141 extern void Assign_ST_To_Named_Section (ST *, STR_IDX); 00142 #endif 00143 00144 /* 00145 * Pad global, C arrays 00146 */ 00147 extern void Pad_Global_Arrays(); 00148 00149 /* return GUESS of whether ST will use an offset < 16 bits */ 00150 extern BOOL Uses_Small_Offset (ST *st, WN_OFFSET wn_ofst); 00151 00152 extern INT32 Stack_Alignment (void); 00153 00154 /* Return true if the ST is defined on the stack */ 00155 extern BOOL ST_on_stack(ST *); 00156 00157 /* Return true if the ST is defined in the pu */ 00158 extern BOOL ST_pu_defined(ST *); 00159 00160 /* Look for a formal-ref-base corresponding to the sym. */ 00161 extern ST * Get_ST_formal_ref_base (const ST *sym); 00162 extern void Set_ST_formal_ref_base (const ST *sym, ST *base); 00163 00164 /* return 0 if no formal-preg-num */ 00165 extern PREG_NUM Get_ST_formal_preg_num (const ST *base); 00166 extern void Set_ST_formal_preg_num (const ST *base, PREG_NUM p); 00167 00168 inline BOOL ST_has_formal_preg_num (const ST *const st) 00169 { 00170 return (ST_sclass(st) == SCLASS_FORMAL && 00171 Get_ST_formal_preg_num(st) != 0); 00172 } 00173 00174 /* Map arg-area-size to the corresponding PU */ 00175 extern UINT32 Get_PU_arg_area_size(PU_IDX); 00176 extern void Set_PU_arg_area_size(PU_IDX, UINT32 size); 00177 00178 /* size of actual build area for current PU */ 00179 extern INT32 Current_PU_Actual_Size; 00180 00181 /* return ST for __return_address if one exists */ 00182 extern ST * Find_Special_Return_Address_Symbol (void); 00183 00184 /* return stack offset adjustment, which may depend on size of pu frame */ 00185 extern INT Stack_Offset_Adjustment_For_PU (void); 00186 00187 extern void Set_Frame_Has_Calls(BOOL b); 00188 #ifdef TARG_X8664 00189 /* return TRUE if function has calls */ 00190 extern BOOL Stack_Frame_Has_Calls (void); 00191 #endif 00192 00193 #if defined(TARG_SL) 00194 extern void Pre_Allocate_Objects(WN *); 00195 #endif 00196 00197 #ifdef __cplusplus 00198 } 00199 #endif 00200 #endif /* data_layout_INCLUDED */ 00201
1.5.6