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
00037
00038
00039
00040
00041 #ifndef cxx_ipo_inline_util_INCLUDED
00042 #define cxx_ipo_inline_util_INCLUDED
00043
00044 #include "defs.h"
00045 #include "wn.h"
00046 #include "cxx_template.h"
00047
00048
00049
00050
00051 class IPO_MP_PRAGMA_CODE {
00052
00053 private:
00054 WN* _pragma;
00055 WN* _do_loop;
00056
00057 public:
00058 IPO_MP_PRAGMA_CODE() : _pragma(NULL), _do_loop(NULL) {}
00059
00060 WN* Get_pragma() const { return _pragma;}
00061 WN* Get_do_loop() const { return _do_loop;}
00062
00063 void Set_pragma_do_loop(WN* pragma, WN* do_loop)
00064 {
00065 _pragma = pragma;
00066 _do_loop = do_loop;
00067 };
00068
00069 };
00070
00071 typedef DYN_ARRAY<IPO_MP_PRAGMA_CODE> IPO_MP_PRAGMA_CODE_ARRAY;
00072
00073 extern void
00074 Record_Parallel_Loop_Pragma(WN* , WN* _loop, IPO_MP_PRAGMA_CODE_ARRAY *);
00075
00076 extern WN*
00077 Get_Parallel_Pragma_Node(WN*, IPO_MP_PRAGMA_CODE_ARRAY *);
00078
00079 extern void
00080 Mark_MP_Loops(WN* , IPO_MP_PRAGMA_CODE_ARRAY *);
00081
00082
00083 extern INT
00084 Do_Loop_Is_MP(WN* ,IPO_MP_PRAGMA_CODE_ARRAY * );
00085
00086 extern WN*
00087 Find_MP_Loop_Or_Region(WN* ,IPO_MP_PRAGMA_CODE_ARRAY *);
00088
00089 extern PREG_NUM
00090 Process_Alloca_Preamble(WN *);
00091
00092 extern void
00093 Process_Alloca_Postamble(PREG_NUM , WN*);
00094
00095 extern mUINT32
00096 Compute_max_region_id(WN *caller_wn);
00097
00098
00099 struct DEDICATED_RETURN_PREGS
00100 {
00101 struct {
00102 PREG_IDX first;
00103 PREG_IDX second;
00104 } pregs[2];
00105 UINT32 num_pregs;
00106 };
00107
00108 struct NEGATIVE_RETURN_PREGS
00109 {
00110 PREG_IDX preg_idx;
00111 ST* st;
00112
00113 BOOL use_tmp_st;
00114 };
00115
00116 class RETURN_PREG
00117 {
00118
00119
00120 private:
00121 union {
00122 DEDICATED_RETURN_PREGS old_style;
00123 NEGATIVE_RETURN_PREGS new_style;
00124 } _u;
00125 BOOL use_return_val;
00126
00127 public:
00128
00129 RETURN_PREG () : use_return_val (TRUE) {
00130 _u.old_style.num_pregs = 0;
00131 }
00132
00133 void insert (PREG_IDX _orig, PREG_IDX _new) {
00134 use_return_val = FALSE;
00135 if (_u.old_style.num_pregs == 0) {
00136 _u.old_style.num_pregs = 1;
00137 _u.old_style.pregs[0].first = _orig;
00138 _u.old_style.pregs[0].second = _new;
00139 } else {
00140 _u.old_style.num_pregs = 2;
00141 _u.old_style.pregs[1].first = _orig;
00142 _u.old_style.pregs[1].second = _new;
00143 }
00144 }
00145
00146 void insert (PREG_IDX _new, ST* preg) {
00147 use_return_val = TRUE;
00148 _u.new_style.use_tmp_st = FALSE;
00149 _u.new_style.preg_idx = _new;
00150 _u.new_style.st = preg;
00151 }
00152
00153 void insert (ST* st) {
00154 use_return_val = TRUE;
00155 _u.new_style.use_tmp_st = TRUE;
00156 _u.new_style.st = st;
00157 }
00158
00159 PREG_IDX find (PREG_IDX old) const {
00160 if (old == (PREG_IDX) -1) {
00161 Is_True (_u.new_style.use_tmp_st == FALSE,
00162 ("expecting the return value to be a struct"));
00163 return _u.new_style.preg_idx;
00164 } else {
00165 if (_u.old_style.pregs[0].first == old)
00166 return _u.old_style.pregs[0].second;
00167 if (_u.old_style.num_pregs == 2 &&
00168 _u.old_style.pregs[1].first == old)
00169 return _u.old_style.pregs[1].second;
00170 Fail_FmtAssertion ("Illegal dedicated return register %d \n", old);
00171 return 0;
00172 }
00173 }
00174
00175 ST* find_st () const {
00176 Is_True (use_return_val, ("expecting PREG -1 for return values"));
00177 return _u.new_style.st;
00178 }
00179
00180 UINT size () const {
00181 return use_return_val ? 1 : _u.old_style.num_pregs;
00182 }
00183 };
00184
00185 extern void
00186 Compute_Return_Preg_Offset(WN *, RETURN_PREG& rp, BOOL use_lowered_return_preg,
00187 SCOPE *, SYMTAB_IDX);
00188
00189
00190 extern void
00191 Fix_Return_Pregs(WN *, const RETURN_PREG& rp);
00192
00193 #ifdef KEY
00194 #include "ipa_cg.h"
00195 extern void
00196 Get_enclosing_region (IPA_NODE *, IPA_EDGE *);
00197 #endif
00198
00199 #endif // cxx_ipo_inline_util_INCLUDED