Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
config_targ.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 config_targ_INCLUDED
00037 #define config_targ_INCLUDED
00038 #ifdef __cplusplus
00039 extern "C" {
00040 #endif
00041 
00042 /* ====================================================================
00043  * ====================================================================
00044  *
00045  *
00046  * Revision history:
00047  *  15-Jun-91 - Original Version
00048  *  25-Sep-91 - Added subprogram interface pointers.
00049  *  27-Nov-91 - Reconfiguration of target representation for TP.
00050  *  21-Apr-93 - Set TARG_NEEDS_QUAD_OP to 1
00051  *  14-Mar-97 - Removed most -TARG group flags to config_targ2.h.
00052  *
00053  * Description:
00054  *
00055  * This file defines general configuration parameters which are
00056  * specific to the compiler's target machine and system.
00057  * There is an approximate distinction between -TARG option group
00058  * flags and their configuration (in config_targ2.[hc]), and more
00059  * generic target configuration (in this file).  Note that this file
00060  * is included in config.h, and hence indirectly in most source files,
00061  * whereas config_targ2.h is only included directly, so putting new
00062  * -TARG option-related variables in config_targ2.[hc] is to be
00063  * preferred to putting them here.
00064  *
00065  * See com/config.h for a detailed description of configuration
00066  * parameters, where they are declared, and how they are processed.
00067  *
00068  * See also:
00069  *      TARGET/com/targ_const.h -- Manipulation of target constants, as
00070  *              appropriate on the host system.
00071  *
00072  * ====================================================================
00073  * ====================================================================
00074  */
00075 
00076 
00077 #ifdef _KEEP_RCS_ID
00078 #endif /* _KEEP_RCS_ID */
00079 
00080 #include "mtypes.h"
00081 
00082 
00083 /* ====================================================================
00084  *
00085  * Target selection
00086  *
00087  * Note that the current target is also given by a #define name of the
00088  * form TARG_xxx.  However, since a single compiler may support several
00089  * target variants, this symbol (defined in the TDT) will generally be
00090  * less specific than the variable Target below.
00091  *
00092  * ====================================================================
00093  */
00094 
00095 /* ========== */
00096 /* Target ABI */
00097 /* ========== */
00098 
00099 typedef enum {
00100   ABI_UNDEF,    /* Undefined */
00101   ABI_I32,      /* 32-bit */
00102   ABI_I64       /* 64-bit */
00103 } TARGET_ABI;
00104 
00105 extern TARGET_ABI Target_ABI;
00106 
00107 /* ================ */
00108 /* Target processor */
00109 /* ================ */
00110 
00111 /* Define an enum representing all current target processors.
00112  * For variants and modifiers of these, see tp/com/config_targ.h.
00113  */
00114 typedef enum {
00115   TARGET_UNDEF,         /* Undefined */
00116   TARGET_ITANIUM        /* Intel Itanium */
00117 } TARGET_PROCESSOR;
00118 
00119 extern TARGET_PROCESSOR Target;         /* -Tc */
00120 
00121 /* return the target name for <target> */
00122 extern char *Targ_Name (TARGET_PROCESSOR target);
00123 
00124 #define Is_Target_Itanium()     (Target==TARGET_ITANIUM)
00125 
00126 
00127 /* ========== */
00128 /* Target ISA */
00129 /* ========== */
00130 
00131 typedef enum {
00132   TARGET_ISA_UNDEF,     /* Undefined */
00133   TARGET_ISA_I1
00134 } TARGET_ISA;
00135 
00136 extern TARGET_ISA Target_ISA;   /* -Tc.Rc */
00137 
00138 /* return the ISA name corresponding to <target_isa> */
00139 extern char *Isa_Name (TARGET_ISA target_isa);
00140 
00141 #define Is_Target_ISA_I1()      (Target_ISA==TARGET_ISA_I1)
00142 
00143 #define Is_Target_ISA_I1Plus()  (Target_ISA >= TARGET_ISA_I1)
00144 
00145 /* What is the floating point format? */
00146 #define IEEE_FP_FORMAT  TRUE
00147 #define IBM_FP_FORMAT   FALSE
00148 
00149 /* Do we need to implement quad float? */
00150 /* #define TARG_NEEDS_QUAD_OPS */
00151 
00152 /* Target-specific controls: */
00153 
00154 /* We need to know the machine type of the integer and floating point
00155  * registers for purposes of subprogram save/restore:
00156  */
00157 extern CLASS_INDEX Spill_Int_Mtype;
00158 extern CLASS_INDEX Spill_Float_Mtype;
00159 
00160 /* We need to know the maximum machine type corresponding directly to
00161  * the machine registers:
00162  */
00163 extern CLASS_INDEX Max_Int_Mtype, Max_Uint_Mtype;
00164 
00165 /* We need to know the default machine type to be used for internally
00166  * generated integers, e.g. DO loop indices.  These will default to the
00167  * max int types above, but the FEs may override the defaults:
00168  */
00169 extern CLASS_INDEX Def_Int_Mtype, Def_Uint_Mtype;
00170 
00171 /* =================== */
00172 /* Target Pointer Size */
00173 /* =================== */
00174 
00175 /* On MIPS III targets, should we use 32-bit pointers? */
00176 extern BOOL Use_32_Bit_Pointers;        /* -Tc.P32 */
00177 
00178 /* For various targets, what are the characteristics of pointers */
00179 extern INT              Pointer_Size;   /* in bytes */
00180 extern CLASS_INDEX      Pointer_Mtype;
00181 extern CLASS_INDEX      Pointer_Mtype2;
00182 
00183 /* What are pointers and booleans aliased to in WHIRL */
00184 extern TYPE_ID Pointer_type;
00185 extern TYPE_ID Pointer_type2;
00186 extern TYPE_ID Boolean_type;
00187 extern TYPE_ID Boolean_type2;
00188 extern TYPE_ID Integer_type;
00189 
00190 /* On every target, there is an upper bound on the size pf data object
00191  * that can be defined.  The following two definitions define this
00192  * upper bound for 32 and 64 bits mode compilations respectively.
00193  */
00194 #define MAX_64BITS_OBJECT_SIZE 0x000000ffffffffffULL /* 40 bits */
00195 #define MAX_32BITS_OBJECT_SIZE 0x000000007fffffffULL /* 31 bits */
00196 
00197 /* On most targets, it will be necessary to decide whether a text
00198  * address is usable in an instruction literal field.  The following
00199  * specifies the maximum value which we may assume a function or label
00200  * address will take on.
00201  *
00202  * NOTE:  On the MIPS, jumps are relative to the current 256MB segment,
00203  * and we always assume that we can reach anything we want to jump/call
00204  * to, since the linker will insert stubs if necessary.  So we treat
00205  * the limit as 256MB here.  We make it smaller than necessary to allow
00206  * for some arithmetic without overflowing the limits.
00207  */
00208 #define MAX_LABEL_SYMVAL        0x03fffff0
00209 #define MAX_FUNC_SYMVAL         0x03fffff0
00210 
00211 /* maximum gspace (gp-relative) size */
00212 #define DEFAULT_GSPACE          0x3fffff
00213 
00214 /* ================== */
00215 /* Comparison Results */
00216 /* ================== */
00217 
00218 /* For various targets, what is the comparison result type? */
00219 extern INT              Comparison_Result_Size; /* in bytes */
00220 extern CLASS_INDEX      Comparison_Result_Mtype;
00221 
00222 /* ============= */
00223 /* Miscellaneous */
00224 /* ============= */
00225 
00226 /* Miscellaneous exception control */
00227 #define FPX_I   0x01    /* IEEE-754 inexact exception */
00228 #define FPX_U   0x02    /* IEEE-754 underflow exception */
00229 #define FPX_O   0x04    /* IEEE-754 overflow exception */
00230 #define FPX_Z   0x08    /* IEEE-754 zero divide exception */
00231 #define FPX_V   0x10    /* IEEE-754 invalid operation exception */
00232 #define FPX_ALL 0x1f    /* All the IEEE-754 exceptions */
00233 #define EXC_ALL 0x1f    /* All the exceptions */
00234 extern INT16 FP_Exception_Enable_Max;   /* Max FP trap enables */
00235 extern INT16 FP_Exception_Enable_Min;   /* Min FP trap enables */
00236 
00237 /* Is the "char" type signed? */
00238 extern BOOL Char_Type_Is_Signed;
00239 
00240 
00241 /* ====================================================================
00242  *
00243  * Target debugging options
00244  *
00245  * ====================================================================
00246  */
00247 
00248 /* Symbolic Debug mode as specified on command line.  (The mode can
00249  * change from PU to PU because, for example, we encounter a call to
00250  * the routine 'alloca()' -- we must restore the mode to the value as it
00251  * was specified on the command line, so we remember it.)
00252  */
00253 #define SDM_NONE        0x00    /* No information */
00254 #define SDM_LINE        0x01    /* Line numbers */
00255 #define SDM_SYMBOL      0x02    /* Symbol table information */
00256 #define SDM_SEQLINE     0x04    /* Force sequentail line numbers */
00257 #define SDM_GEN_FP      0x08    /* Save/restore of fp for sdb */
00258 #define SDM_USE_FP      0x10    /* Use fp for sdb definitions */
00259 
00260 extern INT16 Symbolic_Debug_Mode;       /* Current */
00261 extern INT16 Max_Symbolic_Debug_Mode;   /* Maximum for any PU */
00262 
00263 #define Want_Line_Debugging     (Symbolic_Debug_Mode & SDM_LINE)
00264 #define Want_Sequential_Line_Debugging  (Symbolic_Debug_Mode & SDM_SEQLINE)
00265 #define Want_Symbol_Debugging   (Symbolic_Debug_Mode & SDM_SYMBOL)
00266 #define Want_Any_Debugging      (Symbolic_Debug_Mode &(SDM_LINE|SDM_SEQLINE|SDM_SYMBOL))
00267 #define Gen_Frame_Ptr           (Symbolic_Debug_Mode & SDM_GEN_FP)
00268 #define Set_Gen_Frame_Ptr       (Max_Symbolic_Debug_Mode |= SDM_GEN_FP, \
00269                                   Symbolic_Debug_Mode |= SDM_GEN_FP)
00270 #define Use_Frame_Ptr_For_Sdb   (Symbolic_Debug_Mode & SDM_USE_FP)
00271 #define Set_Use_Frame_Ptr_For_Sdb (Max_Symbolic_Debug_Mode |= SDM_USE_FP, \
00272                                    Symbolic_Debug_Mode |= SDM_USE_FP)
00273 
00274 /* I believe the frame pointer flags function as follows:
00275  *
00276  * The debugger may require that a frame pointer be generated and
00277  * available (Gen_Frame_Ptr), and/or that it be used in the external
00278  * symbol table definitions of variables' addressing emitted in
00279  * coffsdb.c (Use_Frame_Ptr_For_Sdb).  We currently treat these
00280  * independently, though perhaps Use_Frame_Ptr_For_Sdb should imply
00281  * Gen_Frame_Ptr.
00282  *
00283  * In addition, memmodel.[hc] contains variables Gen_Frame_Pointer
00284  * and Use_Frame_Pointer which actually control whether code is
00285  * generated to produce the FP on PU entry and use it for referencing
00286  * part of the stack frame, respectively.  Gen_Frame_Pointer is
00287  * initialized to Gen_Frame_Ptr, but may also be turned on by the
00288  * Use_Frame_Pointer requirement.  Use_Frame_Pointer is currently
00289  * set only if the stack frame is large enough that we want both
00290  * pointers to improve addressibility; it will also probably be set
00291  * if we need to deal with dynamic local data allocation.  It is
00292  * therefore completely independent of Use_Frame_Ptr_For_Sdb.
00293  */
00294 
00295 /* ====================================================================
00296  *
00297  * Miscellaneous options
00298  *
00299  * ====================================================================
00300  */
00301 
00302 /* Do we need to force NOOPs in empty cycles? */
00303 #define FORCE_NOOPS     FALSE
00304 
00305 /* Can 64-bit values be 4-byte aligned in memory? */
00306 extern BOOL Allow_Word_Aligned_Doubles;
00307 
00308 /* Should we generate position-independent code by default? */
00309 extern BOOL Generate_Position_Independent_Code;
00310 
00311 /* Split 64-bit integer ops into 32-bit ops, and simulate them? */
00312 extern BOOL Split_64_Bit_Int_Ops;
00313 
00314 /* Split quad-precision ops into double-precision, and simulate them? */
00315 extern BOOL Split_Quad_Ops;
00316 
00317 /* Should we simulate 32-bit subprogram interface by default? */
00318 extern BOOL Simulate_32_Bit_Interface;
00319 
00320 /* Workaround for TFP branch cache problem. */
00321 extern BOOL No_Quad_Aligned_Branch;
00322 extern BOOL No_Quad_Aligned_Branch;
00323 
00324 /* Does target provides only unsigned 64-bit instructions? */
00325 extern BOOL Only_Unsigned_64_Bit_Ops;
00326 
00327 extern INT32 Align_Instructions;        /* Align frequent blocks and funcs */
00328 
00329 extern BOOL Eager_Bottom_Load;
00330 extern BOOL Eager_Ptr_Deref;
00331 extern BOOL Eager_Null_Ptr_Deref;
00332 
00333 /* file has non-standard gp groups, i.e. SYMTAB_gp_group(Global_Symtab) */
00334 extern BOOL Has_GP_Groups;
00335 
00336 /* Does target have offsets in load and store instructions?
00337  * Note: CG should instead test:
00338  * ( TOP_Find_Operand_Use( OP_code(op), OU_offset ) >= 0 ) */
00339 extern BOOL Use_Load_Store_Offset;
00340 
00341 
00342 /* ====================================================================
00343  *
00344  * Initialization interface
00345  *
00346  * ====================================================================
00347  */
00348 
00349 /* Configuration prior to flag processing: */
00350 extern void Preconfigure_Target (void);
00351 
00352 /* Configuration after flag processing: */
00353 extern void Configure_Target (void);
00354 extern void IPA_Configure_Target (void);
00355 
00356 /* Reconfiguration for each source file: */
00357 extern void Configure_Source_Target ( char *filename );
00358 
00359 /* return FALSE if abi mismatch */
00360 extern BOOL Set_Target_ABI (BOOL is_64bit, INT isa);
00361 
00362 
00363 /*================================================================*/
00364 /* Architecture specific options. Variables are set in config_targ.cxx,
00365    #defines are set in config_targ.h
00366 */
00367 
00368 extern BOOL ARCH_mask_shift_counts;
00369 extern BOOL ARCH_generate_nor;
00370 #define ARCH_recip_is_exact TRUE
00371 #define ARCH_has_bit_tests TRUE
00372 
00373 /* default value for WHIRL_Keep_Cvt */
00374 #define DEFAULT_KEEP_CVT        TRUE
00375 
00376 #ifdef __cplusplus
00377 }
00378 #endif
00379 #endif /* config_targ_INCLUDED */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines