00001 /* 00002 * Copyright (C) 2007, 2008. Pathscale, LLC. All Rights Reserved. 00003 */ 00004 00005 /* 00006 * Copyright (C) 2006. QLogic Corporation. All Rights Reserved. 00007 */ 00008 00009 /* 00010 * Copyright 2003, 2004, 2005, 2006 PathScale, Inc. All Rights Reserved. 00011 */ 00012 00013 /* 00014 00015 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00016 00017 This program is free software; you can redistribute it and/or modify it 00018 under the terms of version 2 of the GNU General Public License as 00019 published by the Free Software Foundation. 00020 00021 This program is distributed in the hope that it would be useful, but 00022 WITHOUT ANY WARRANTY; without even the implied warranty of 00023 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00024 00025 Further, this software is distributed without any warranty that it is 00026 free of the rightful claim of any third person regarding infringement 00027 or the like. Any license provided herein, whether implied or 00028 otherwise, applies only to this software file. Patent licenses, if 00029 any, provided herein do not apply to combinations of this program with 00030 other software, or any other product whatsoever. 00031 00032 You should have received a copy of the GNU General Public License along 00033 with this program; if not, write the Free Software Foundation, Inc., 59 00034 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00035 00036 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00037 Mountain View, CA 94043, or: 00038 00039 http://www.sgi.com 00040 00041 For further information regarding this notice, see: 00042 00043 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00044 00045 */ 00046 00047 00048 #ifndef config_targ_INCLUDED 00049 #define config_targ_INCLUDED 00050 #ifdef __cplusplus 00051 extern "C" { 00052 #endif 00053 00054 /* ==================================================================== 00055 * ==================================================================== 00056 * 00057 * Module: config_targ.h 00058 * $Revision: 1.24 $ 00059 * $Date: 04/12/21 14:57:25-08:00 $ 00060 * $Author: bos@eng-25.internal.keyresearch.com $ 00061 * $Source: /home/bos/bk/kpro64-pending/common/com/x8664/SCCS/s.config_targ.h $ 00062 * 00063 * Revision history: 00064 * 15-Jun-91 - Original Version 00065 * 25-Sep-91 - Added subprogram interface pointers. 00066 * 27-Nov-91 - Reconfiguration of target representation for TP. 00067 * 21-Apr-93 - Set TARG_NEEDS_QUAD_OP to 1 00068 * 14-Mar-97 - Removed most -TARG group flags to config_targ_opt.h. 00069 * 00070 * Description: 00071 * 00072 * This file defines general configuration parameters which are 00073 * specific to the compiler's target machine and system. 00074 * There is an approximate distinction between -TARG option group 00075 * flags and their configuration (in config_targ_opt.[hc]), and more 00076 * generic target configuration (in this file). Note that this file 00077 * is included in config.h, and hence indirectly in most source files, 00078 * whereas config_targ_opt.h is only included directly, so putting new 00079 * -TARG option-related variables in config_targ_opt.[hc] is to be 00080 * preferred to putting them here. 00081 * 00082 * See com/config.h for a detailed description of configuration 00083 * parameters, where they are declared, and how they are processed. 00084 * 00085 * See also: 00086 * TARGET/com/targ_const.h -- Manipulation of target constants, as 00087 * appropriate on the host system. 00088 * 00089 * ==================================================================== 00090 * ==================================================================== 00091 */ 00092 00093 00094 #ifdef _KEEP_RCS_ID 00095 static char *config_targ_rcs_id = "$Source: /home/bos/bk/kpro64-pending/common/com/x8664/SCCS/s.config_targ.h $ $Revision: 1.24 $"; 00096 #endif /* _KEEP_RCS_ID */ 00097 00098 #include "mtypes.h" 00099 00100 00101 /* ==================================================================== 00102 * 00103 * Target selection 00104 * 00105 * Note that the current target is also given by a #define name of the 00106 * form TARG_xxx. However, since a single compiler may support several 00107 * target variants, this symbol (defined in the TDT) will generally be 00108 * less specific than the variable Target below. 00109 * 00110 * ==================================================================== 00111 */ 00112 00113 /* ========== */ 00114 /* Target ABI */ 00115 /* ========== */ 00116 00117 typedef enum { 00118 ABI_UNDEF, /* Undefined */ 00119 ABI_n32, /* 32-bit */ 00120 ABI_n64 /* 64-bit */ 00121 } TARGET_ABI; 00122 00123 extern TARGET_ABI Target_ABI; 00124 extern BOOL Target_MMX; 00125 extern BOOL Target_SSE; 00126 extern BOOL Target_SSE2; 00127 extern BOOL Target_SSE3; 00128 extern BOOL Target_3DNow; 00129 extern BOOL Target_SSE4a; 00130 extern int Target_x86_Precision; 00131 00132 /* ================ */ 00133 /* Target processor */ 00134 /* ================ */ 00135 00136 /* Define an enum representing all current target processors. 00137 * For variants and modifiers of these, see tp/com/config_targ.h. 00138 */ 00139 typedef enum { 00140 TARGET_UNDEF, /* Undefined */ 00141 TARGET_opteron, /* AMD Opteron and Athlon64 FX */ 00142 TARGET_barcelona, /* AMD Barcelona (opteron) */ 00143 TARGET_athlon64, /* AMD Athlon64 */ 00144 TARGET_athlon, /* AMD Athlon */ 00145 TARGET_em64t, /* Intel EM64T */ 00146 TARGET_core, /* Intel Core */ 00147 TARGET_wolfdale, /* Intel Wolfdale */ 00148 TARGET_anyx86, /* Generic x86 processor */ 00149 TARGET_pentium4, /* Intel Pentium 4 */ 00150 TARGET_xeon, /* Intel Pentium 4 Xeon */ 00151 } TARGET_PROCESSOR; 00152 00153 extern TARGET_PROCESSOR Target; /* -Tc */ 00154 00155 /* return the target name for <target> */ 00156 extern const char *Targ_Name (TARGET_PROCESSOR target); 00157 00158 // NOTE: for this definition, all processors are treated x86-64! 00159 #define Is_Target_x86_64() (Target >= TARGET_opteron && Target <= TARGET_xeon) 00160 #define Is_Target_64bit() (Target_ABI == ABI_n64) 00161 #define Is_Target_32bit() (Target_ABI == ABI_n32) 00162 #define Is_Target_MMX() (Target_MMX == TRUE) 00163 #define Is_Target_SSE() (Target_SSE == TRUE) 00164 #define Is_Target_SSE2() (Target_SSE2 == TRUE) 00165 #define Is_Target_SSE3() (Target_SSE3 == TRUE) 00166 #define Is_Target_3DNow() (Target_3DNow == TRUE) 00167 #define Is_Target_SSE4a() (Target_SSE4a == TRUE) 00168 #define Is_Target_Pentium4() (Target == TARGET_pentium4) 00169 #define Is_Target_EM64T() (Target == TARGET_em64t) 00170 #define Is_Target_Core() (Target == TARGET_core) 00171 #define Is_Target_Wolfdale() (Target == TARGET_wolfdale) 00172 #define Is_Target_Anyx86() (Target == TARGET_anyx86) 00173 #define Target_x87_precision() (Target_x87_Precision+0) 00174 #define Is_Target_Barcelona() (Target == TARGET_barcelona) 00175 00176 00177 /* ========== */ 00178 /* Target ISA */ 00179 /* ========== */ 00180 00181 typedef enum { 00182 TARGET_ISA_UNDEF, /* Undefined */ 00183 TARGET_ISA_x86_64, 00184 } TARGET_ISA; 00185 00186 extern TARGET_ISA Target_ISA; /* -Tc.Rc */ 00187 00188 /* return the ISA name corresponding to <target_isa> */ 00189 extern char *Isa_Name (TARGET_ISA target_isa); 00190 00191 /* What is the floating point format? */ 00192 #define IEEE_FP_FORMAT TRUE 00193 #define IBM_FP_FORMAT FALSE 00194 00195 /* Do we need to implement quad float? */ 00196 #define TARG_NEEDS_QUAD_OPS 00197 00198 /* Target-specific controls: */ 00199 00200 /* We need to know the machine type of the integer and floating point 00201 * registers for purposes of subprogram save/restore: 00202 */ 00203 extern CLASS_INDEX Spill_Int_Mtype; 00204 extern CLASS_INDEX Spill_Float_Mtype; 00205 extern CLASS_INDEX Spill_Int32_Mtype; 00206 extern CLASS_INDEX Spill_Float32_Mtype; 00207 00208 /* We need to know the maximum machine type corresponding directly to 00209 * the machine registers: 00210 */ 00211 extern CLASS_INDEX Max_Int_Mtype, Max_Uint_Mtype; 00212 00213 /* We need to know the default machine type to be used for internally 00214 * generated integers, e.g. DO loop indices. These will default to the 00215 * max int types above, but the FEs may override the defaults: 00216 */ 00217 extern CLASS_INDEX Def_Int_Mtype, Def_Uint_Mtype; 00218 00219 /* =================== */ 00220 /* Target Pointer Size */ 00221 /* =================== */ 00222 00223 /* On MIPS III targets, should we use 32-bit pointers? */ 00224 extern BOOL Use_32_Bit_Pointers; /* -Tc.P32 */ 00225 00226 /* For various targets, what are the characteristics of pointers */ 00227 extern INT Pointer_Size; /* in bytes */ 00228 extern CLASS_INDEX Pointer_Mtype; 00229 extern CLASS_INDEX Pointer_Mtype2; 00230 00231 /* What are pointers and booleans aliased to in WHIRL */ 00232 extern TYPE_ID Pointer_type; 00233 extern TYPE_ID Pointer_type2; 00234 extern TYPE_ID Boolean_type; 00235 extern TYPE_ID Boolean_type2; 00236 extern TYPE_ID Integer_type; 00237 00238 /* On every target, there is an upper bound on the size pf data object 00239 * that can be defined. The following two definitions define this 00240 * upper bound for 32 and 64 bits mode compilations respectively. 00241 */ 00242 #define MAX_64BITS_OBJECT_SIZE 0x000000ffffffffffULL /* 40 bits */ 00243 #define MAX_32BITS_OBJECT_SIZE 0x000000007fffffffULL /* 31 bits */ 00244 00245 /* On most targets, it will be necessary to decide whether a text 00246 * address is usable in an instruction literal field. The following 00247 * specifies the maximum value which we may assume a function or label 00248 * address will take on. 00249 * 00250 * NOTE: On the MIPS, jumps are relative to the current 256MB segment, 00251 * and we always assume that we can reach anything we want to jump/call 00252 * to, since the linker will insert stubs if necessary. So we treat 00253 * the limit as 256MB here. We make it smaller than necessary to allow 00254 * for some arithmetic without overflowing the limits. 00255 */ 00256 #define MAX_LABEL_SYMVAL 0x03fffff0 00257 #define MAX_FUNC_SYMVAL 0x03fffff0 00258 00259 /* maximum gspace (gp-relative) size */ 00260 #define DEFAULT_GSPACE 0x3fffff 00261 00262 /* ================== */ 00263 /* Comparison Results */ 00264 /* ================== */ 00265 00266 /* For various targets, what is the comparison result type? */ 00267 extern INT Comparison_Result_Size; /* in bytes */ 00268 extern CLASS_INDEX Comparison_Result_Mtype; 00269 00270 /* ============= */ 00271 /* Miscellaneous */ 00272 /* ============= */ 00273 00274 /* Miscellaneous exception control */ 00275 #define FPX_I 0x01 /* IEEE-754 inexact exception */ 00276 #define FPX_U 0x02 /* IEEE-754 underflow exception */ 00277 #define FPX_O 0x04 /* IEEE-754 overflow exception */ 00278 #define FPX_Z 0x08 /* IEEE-754 zero divide exception */ 00279 #define FPX_V 0x10 /* IEEE-754 invalid operation exception */ 00280 #define FPX_ALL 0x1f /* All the IEEE-754 exceptions */ 00281 #define EXC_ALL 0x1f /* All the exceptions */ 00282 extern INT16 FP_Exception_Enable_Max; /* Max FP trap enables */ 00283 extern INT16 FP_Exception_Enable_Min; /* Min FP trap enables */ 00284 00285 /* Is the "char" type signed? */ 00286 extern BOOL Char_Type_Is_Signed; 00287 00288 00289 /* ==================================================================== 00290 * 00291 * Target debugging options 00292 * 00293 * ==================================================================== 00294 */ 00295 00296 /* Symbolic Debug mode as specified on command line. (The mode can 00297 * change from PU to PU because, for example, we encounter a call to 00298 * the routine 'alloca()' -- we must restore the mode to the value as it 00299 * was specified on the command line, so we remember it.) 00300 */ 00301 #define SDM_NONE 0x00 /* No information */ 00302 #define SDM_LINE 0x01 /* Line numbers */ 00303 #define SDM_SYMBOL 0x02 /* Symbol table information */ 00304 #define SDM_SEQLINE 0x04 /* Force sequentail line numbers */ 00305 #define SDM_GEN_FP 0x08 /* Save/restore of fp for sdb */ 00306 #define SDM_USE_FP 0x10 /* Use fp for sdb definitions */ 00307 00308 extern INT16 Symbolic_Debug_Mode; /* Current */ 00309 extern INT16 Max_Symbolic_Debug_Mode; /* Maximum for any PU */ 00310 00311 #define Want_Line_Debugging (Symbolic_Debug_Mode & SDM_LINE) 00312 #define Want_Sequential_Line_Debugging (Symbolic_Debug_Mode & SDM_SEQLINE) 00313 #define Want_Symbol_Debugging (Symbolic_Debug_Mode & SDM_SYMBOL) 00314 #define Want_Any_Debugging (Symbolic_Debug_Mode &(SDM_LINE|SDM_SEQLINE|SDM_SYMBOL)) 00315 #define Gen_Frame_Ptr (Symbolic_Debug_Mode & SDM_GEN_FP) 00316 #define Set_Gen_Frame_Ptr (Max_Symbolic_Debug_Mode |= SDM_GEN_FP, \ 00317 Symbolic_Debug_Mode |= SDM_GEN_FP) 00318 #define Use_Frame_Ptr_For_Sdb (Symbolic_Debug_Mode & SDM_USE_FP) 00319 #define Set_Use_Frame_Ptr_For_Sdb (Max_Symbolic_Debug_Mode |= SDM_USE_FP, \ 00320 Symbolic_Debug_Mode |= SDM_USE_FP) 00321 00322 /* I believe the frame pointer flags function as follows: 00323 * 00324 * The debugger may require that a frame pointer be generated and 00325 * available (Gen_Frame_Ptr), and/or that it be used in the external 00326 * symbol table definitions of variables' addressing emitted in 00327 * coffsdb.c (Use_Frame_Ptr_For_Sdb). We currently treat these 00328 * independently, though perhaps Use_Frame_Ptr_For_Sdb should imply 00329 * Gen_Frame_Ptr. 00330 * 00331 * In addition, memmodel.[hc] contains variables Gen_Frame_Pointer 00332 * and Use_Frame_Pointer which actually control whether code is 00333 * generated to produce the FP on PU entry and use it for referencing 00334 * part of the stack frame, respectively. Gen_Frame_Pointer is 00335 * initialized to Gen_Frame_Ptr, but may also be turned on by the 00336 * Use_Frame_Pointer requirement. Use_Frame_Pointer is currently 00337 * set only if the stack frame is large enough that we want both 00338 * pointers to improve addressibility; it will also probably be set 00339 * if we need to deal with dynamic local data allocation. It is 00340 * therefore completely independent of Use_Frame_Ptr_For_Sdb. 00341 */ 00342 00343 /* ==================================================================== 00344 * 00345 * Miscellaneous options 00346 * 00347 * ==================================================================== 00348 */ 00349 00350 /* Do we need to force NOOPs in empty cycles? */ 00351 #define FORCE_NOOPS FALSE 00352 00353 /* Can 64-bit values be 4-byte aligned in memory? */ 00354 extern BOOL Allow_Word_Aligned_Doubles; 00355 00356 /* Should we generate position-independent code by default? */ 00357 extern BOOL Generate_Position_Independent_Code; 00358 00359 /* Split 64-bit integer ops into 32-bit ops, and simulate them? */ 00360 extern BOOL Split_64_Bit_Int_Ops; 00361 00362 /* Split quad-precision ops into double-precision, and simulate them? */ 00363 extern BOOL Split_Quad_Ops; 00364 00365 /* Should we simulate 32-bit subprogram interface by default? */ 00366 extern BOOL Simulate_32_Bit_Interface; 00367 00368 /* Workaround for TFP branch cache problem. */ 00369 extern BOOL No_Quad_Aligned_Branch; 00370 extern BOOL No_Quad_Aligned_Branch; 00371 00372 /* Does target provides only unsigned 64-bit instructions? */ 00373 extern BOOL Only_Unsigned_64_Bit_Ops; 00374 00375 extern INT32 Align_Instructions; /* Align frequent blocks and funcs */ 00376 00377 extern BOOL Eager_Bottom_Load; 00378 extern BOOL Eager_Ptr_Deref; 00379 extern BOOL Eager_Null_Ptr_Deref; 00380 00381 /* file has non-standard gp groups, i.e. SYMTAB_gp_group(Global_Symtab) */ 00382 extern BOOL Has_GP_Groups; 00383 00384 /* Does target have offsets in load and store instructions? 00385 * Note: CG should instead test: 00386 * ( TOP_Find_Operand_Use( OP_code(op), OU_offset ) >= 0 ) */ 00387 extern BOOL Use_Load_Store_Offset; 00388 00389 00390 /* ==================================================================== 00391 * 00392 * Initialization interface 00393 * 00394 * ==================================================================== 00395 */ 00396 00397 /* Configuration prior to flag processing: */ 00398 extern void Preconfigure_Target (void); 00399 00400 /* Configuration after flag processing: */ 00401 extern void Configure_Target (void); 00402 extern void IPA_Configure_Target (void); 00403 00404 /* Reconfiguration for each source file: */ 00405 extern void Configure_Source_Target ( char *filename ); 00406 00407 /* return FALSE if abi mismatch */ 00408 extern BOOL Set_Target_ABI (BOOL is_64bit, INT isa); 00409 00410 00411 /*================================================================*/ 00412 /* Architecture specific options. Variables are set in config_targ.cxx, 00413 #defines are set in config_targ.h 00414 */ 00415 00416 extern BOOL ARCH_mask_shift_counts; 00417 extern BOOL ARCH_generate_nor; 00418 #define ARCH_recip_is_exact FALSE 00419 #define ARCH_has_bit_tests TRUE 00420 00421 /* default value for WHIRL_Keep_Cvt */ 00422 #define DEFAULT_KEEP_CVT TRUE 00423 00424 #ifdef __cplusplus 00425 } 00426 #endif 00427 #endif /* config_targ_INCLUDED */
1.5.6