Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
anl_common.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 anl_common_INCLUDED
00037 #define anl_common_INCLUDED
00038 /* ==============================================================
00039  * ==============================================================
00040  *
00041  *
00042  * Description:
00043  *
00044  *   Includes and defines stuff commonly used in prompf_anl.so
00045  *   C++ sources.
00046  *
00047  * ==============================================================
00048  * ==============================================================
00049  */
00050 
00051 #include "defs.h"            // Basic types, such as INT32
00052 
00053 #include "config.h"
00054 #include "erglob.h"          // For errors.h and EC definitions
00055 #include "glob.h"            // Irb_File_Name and Src_File_Name
00056 #include "wn.h"              // WN nodes
00057 #include "wn_util.h"         // WN nodes
00058 #include "symtab.h"           // TY and ST nodes
00059 #include "irbdata.h"         // includes targ_const.h
00060 #include "wintrinsic.h"      // WN intrinsic codes
00061 #include "wn_pragmas.h"      // WN pragma codes
00062 #include "cxx_memory.h"      // CXX_NEW/CXX_DELETE
00063 
00064 #include "lwn_util.h"        // For LWN_Parentize()
00065 #include "flags.h"           // For OPTION_DESC
00066 #include "file_util.h"       // For Same_File, Last_Pathname_Component
00067 #include "anl_diagnostics.h" // Diagnostics utilities
00068 #include "anl_cbuf.h"        // Abstraction for character string buffers
00069 #include "anl_srcpos.h"      // For source position manipulation
00070 
00071 
00072 typedef TYPE_ID MTYPE;
00073 typedef mINT64  STAB_OFFSET;
00074 
00075 #define TY_IS_POINTER(ty) (TY_kind(ty) == KIND_POINTER)
00076 #define TY_IS_ARRAY(ty) (TY_kind(ty) == KIND_ARRAY)
00077 
00078 #define ST_AT_FILE_SCOPE(st) Is_Global_Symbol(st)
00079 
00080 #define ST_IS_VALID_BASE(st) \
00081    (ST_base(st) != NULL && \
00082     ST_base(st) != (st) && \
00083     ST_sym_class(ST_base(st)) != CLASS_BLOCK) /* cg generated */ 
00084 
00085 #define ST_IS_COMMON_BLOCK(st) \
00086     (PU_ftn_lang(Get_Current_PU()) &&       \
00087      (ST_sclass(st) == SCLASS_COMMON ||     \
00088       ST_sclass(st) == SCLASS_DGLOBAL)   && \
00089      TY_kind(ST_type(st)) == KIND_STRUCT && \
00090      !ST_AT_FILE_SCOPE(st))
00091 
00092 #define ST_IS_EQUIVALENCE_BLOCK(st) \
00093     (PU_ftn_lang(Get_Current_PU()) &&       \
00094      TY_kind(ST_type(st)) == KIND_STRUCT && \
00095      ST_sclass(st) != SCLASS_COMMON      && \
00096      ! TY_fld(Ty_Table[ST_type(st)]).Is_Null()  && \
00097      (FLD_equivalence(TY_fld(Ty_Table[ST_type(st)]))))
00098 
00099 #define ST_IS_BASED_AT_COMMON_OR_EQUIVALENCE(st) \
00100    (ST_IS_VALID_BASE(st) &&                      \
00101     (ST_IS_COMMON_BLOCK(ST_base(st)) ||          \
00102      ST_IS_EQUIVALENCE_BLOCK(ST_base(st))))
00103 
00104 #define ST_NO_LINKAGE(st) \
00105     (ST_export(st) == EXPORT_LOCAL ||   \
00106      ST_export(st) == EXPORT_LOCAL_INTERNAL)
00107 
00108 #define ST_EXTERNAL_LINKAGE(st) \
00109     (ST_export(st) == EXPORT_INTERNAL  ||  \
00110      ST_export(st) == EXPORT_HIDDEN    ||  \
00111      ST_export(st) == EXPORT_PROTECTED ||  \
00112      ST_export(st) == EXPORT_OPTIONAL  ||  \
00113      ST_export(st) == EXPORT_PREEMPTIBLE)
00114 
00115       
00116 void 
00117 Adjust_Srcpos_Range(WN         *stmt,
00118                     ANL_SRCPOS *min,
00119                     ANL_SRCPOS *max);  // Defined in anl_func_entry.cxx
00120 
00121 
00122 class COUNTER
00123 {
00124 private:
00125    INT64 _value;
00126 public:
00127    COUNTER(INT64 start): _value(start) {}
00128    void  Reset(INT64 start) {_value = start;}
00129    INT64 Value() const {return _value;}
00130    INT64 Post_Incr() {return _value++;}
00131    INT64 Pre_Incr() {return ++_value;}
00132 }; // COUNTER
00133 
00134 #endif /* anl_common_INCLUDED */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines