00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef anl_common_INCLUDED
00037 #define anl_common_INCLUDED
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 #include "defs.h"
00057
00058 #include "config.h"
00059 #include "erglob.h"
00060 #include "glob.h"
00061 #include "wn.h"
00062 #include "wn_util.h"
00063 #include "symtab.h"
00064 #include "irbdata.h"
00065 #include "wintrinsic.h"
00066 #include "wn_pragmas.h"
00067 #include "cxx_memory.h"
00068
00069 #include "lwn_util.h"
00070 #include "flags.h"
00071 #include "file_util.h"
00072 #include "anl_diagnostics.h"
00073 #include "anl_cbuf.h"
00074 #include "anl_srcpos.h"
00075
00076
00077 typedef TYPE_ID MTYPE;
00078 typedef mINT64 STAB_OFFSET;
00079
00080 #define TY_IS_POINTER(ty) (TY_kind(ty) == KIND_POINTER)
00081 #define TY_IS_ARRAY(ty) (TY_kind(ty) == KIND_ARRAY)
00082
00083 #define ST_AT_FILE_SCOPE(st) Is_Global_Symbol(st)
00084
00085 #define ST_IS_VALID_BASE(st) \
00086 (ST_base(st) != NULL && \
00087 ST_base(st) != (st) && \
00088 ST_sym_class(ST_base(st)) != CLASS_BLOCK)
00089
00090 #define ST_IS_COMMON_BLOCK(st) \
00091 (PU_ftn_lang(Get_Current_PU()) && \
00092 (ST_sclass(st) == SCLASS_COMMON || \
00093 ST_sclass(st) == SCLASS_DGLOBAL) && \
00094 TY_kind(ST_type(st)) == KIND_STRUCT && \
00095 !ST_AT_FILE_SCOPE(st))
00096
00097 #define ST_IS_EQUIVALENCE_BLOCK(st) \
00098 (PU_ftn_lang(Get_Current_PU()) && \
00099 TY_kind(ST_type(st)) == KIND_STRUCT && \
00100 ST_sclass(st) != SCLASS_COMMON && \
00101 ! TY_fld(Ty_Table[ST_type(st)]).Is_Null() && \
00102 (FLD_equivalence(TY_fld(Ty_Table[ST_type(st)]))))
00103
00104 #define ST_IS_BASED_AT_COMMON_OR_EQUIVALENCE(st) \
00105 (ST_IS_VALID_BASE(st) && \
00106 (ST_IS_COMMON_BLOCK(ST_base(st)) || \
00107 ST_IS_EQUIVALENCE_BLOCK(ST_base(st))))
00108
00109 #define ST_NO_LINKAGE(st) \
00110 (ST_export(st) == EXPORT_LOCAL || \
00111 ST_export(st) == EXPORT_LOCAL_INTERNAL)
00112
00113 #define ST_EXTERNAL_LINKAGE(st) \
00114 (ST_export(st) == EXPORT_INTERNAL || \
00115 ST_export(st) == EXPORT_HIDDEN || \
00116 ST_export(st) == EXPORT_PROTECTED || \
00117 ST_export(st) == EXPORT_OPTIONAL || \
00118 ST_export(st) == EXPORT_PREEMPTIBLE)
00119
00120
00121 void
00122 Adjust_Srcpos_Range(WN *stmt,
00123 ANL_SRCPOS *min,
00124 ANL_SRCPOS *max);
00125
00126
00127 class COUNTER
00128 {
00129 private:
00130 INT64 _value;
00131 public:
00132 COUNTER(INT64 start): _value(start) {}
00133 void Reset(INT64 start) {_value = start;}
00134 INT64 Value() const {return _value;}
00135 INT64 Post_Incr() {return _value++;}
00136 INT64 Pre_Incr() {return ++_value;}
00137 };
00138
00139 #endif