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
00042 #define __STDC_LIMIT_MACROS
00043 #include <stdint.h>
00044 #ifdef USE_PCH
00045 #include "lno_pch.h"
00046 #endif // USE_PCH
00047 #pragma hdrstop
00048
00049 #include "opt_alias_interface.h"
00050 #include "opt_alias_mgr.h"
00051 #include "ara_loop.h"
00052 #include "ara_utils.h"
00053
00054 extern void print_indent(FILE *fp, INT indent)
00055 {
00056 for (INT i = 0; i < indent; ++i) {
00057 fprintf(fp," ");
00058 }
00059 }
00060
00061
00062
00063
00064
00065
00066 extern void Merge_Scalar_List(SCALAR_STACK* st_from,
00067 SCALAR_STACK* st_to)
00068 {
00069 for (INT i = 0; i < st_from->Elements(); i++) {
00070 SCALAR_NODE* sn_ref = st_from->Bottom_nth(i);
00071 SYMBOL* sym_ref = &sn_ref->_scalar;
00072 for (INT j = 0; j < sn_ref->Elements(); ++j) {
00073 WN* wn_ref = sn_ref->Bottom_nth(j)->Wn;
00074 if (OPCODE_is_call(WN_opcode(wn_ref))
00075 || WN_operator(wn_ref) == OPR_LDA) {
00076 st_to->Add_Scalar(wn_ref, sym_ref, 0);
00077 } else {
00078 st_to->Add_Scalar(wn_ref, 0);
00079 }
00080 }
00081 }
00082 }
00083
00084
00085
00086
00087
00088
00089
00090
00091 extern void Merge_Scalar_List_Covered(SCALAR_STACK* st_from,
00092 ARA_LOOP_INFO* ali_to,
00093 SCALAR_STACK* st_to_covered,
00094 SCALAR_STACK* st_to_not_covered)
00095 {
00096 for (INT i = 0; i < st_from->Elements(); i++) {
00097 SCALAR_NODE* sn_ref = st_from->Bottom_nth(i);
00098 SYMBOL* sym_ref = &sn_ref->_scalar;
00099 for (INT j = 0; j < sn_ref->Elements(); ++j) {
00100 WN* wn_ref = sn_ref->Bottom_nth(j)->Wn;
00101 if (ali_to->Is_Covered(wn_ref)) {
00102 if (OPCODE_is_call(WN_opcode(wn_ref))
00103 || WN_operator(wn_ref) == OPR_LDA) {
00104 st_to_covered->Add_Scalar(wn_ref, sym_ref, 0);
00105 } else {
00106 st_to_covered->Add_Scalar(wn_ref, 0);
00107 }
00108 } else {
00109 if (OPCODE_is_call(WN_opcode(wn_ref))
00110 || WN_operator(wn_ref) == OPR_LDA) {
00111 st_to_not_covered->Add_Scalar(wn_ref, sym_ref, 0);
00112 } else {
00113 st_to_not_covered->Add_Scalar(wn_ref, 0);
00114 }
00115 }
00116 }
00117 }
00118 }
00119
00120 extern POINTS_TO* Points_To(ARA_REF* ara_ref,
00121 MEM_POOL* mem_pool)
00122 {
00123 ST* st_array = ara_ref->Array().St();
00124 INT size_array = TY_size(ST_type(st_array));
00125 return CXX_NEW(POINTS_TO(st_array, 0, size_array), mem_pool);
00126 }
00127
00128 extern POINTS_TO* Points_To(SCALAR_NODE* sn,
00129 MEM_POOL* mem_pool)
00130 {
00131 ST* st_scalar = sn->_scalar.St();
00132 INT64 st_offset = sn->_scalar.ST_Offset();
00133 INT st_size = MTYPE_RegisterSize(sn->_scalar.Type);
00134 return CXX_NEW(POINTS_TO(st_scalar, st_offset, st_size), mem_pool);
00135 }
00136
00137 extern POINTS_TO* Points_To(WN* wn,
00138 MEM_POOL* mem_pool)
00139 {
00140 SYMBOL symbol(wn);
00141 ST* st_scalar = symbol.St();
00142 INT64 st_offset = symbol.ST_Offset();
00143 INT st_size = MTYPE_RegisterSize(symbol.Type);
00144 return CXX_NEW(POINTS_TO(st_scalar, st_offset, st_size), mem_pool);
00145 }
00146