Mercurial > hg > CbC > CbC_gcc
comparison gcc/dse.c @ 36:855418dad1a3
gcc-4.4-20091020
author | e075725 |
---|---|
date | Tue, 22 Dec 2009 21:19:31 +0900 |
parents | 58ad6c70ea60 |
children | 77e2b8dfacca |
comparison
equal
deleted
inserted
replaced
19:58ad6c70ea60 | 36:855418dad1a3 |
---|---|
1068 HOST_WIDE_INT *offset, | 1068 HOST_WIDE_INT *offset, |
1069 cselib_val **base) | 1069 cselib_val **base) |
1070 { | 1070 { |
1071 rtx mem_address = XEXP (mem, 0); | 1071 rtx mem_address = XEXP (mem, 0); |
1072 rtx expanded_address, address; | 1072 rtx expanded_address, address; |
1073 int expanded; | |
1074 | |
1073 /* Make sure that cselib is has initialized all of the operands of | 1075 /* Make sure that cselib is has initialized all of the operands of |
1074 the address before asking it to do the subst. */ | 1076 the address before asking it to do the subst. */ |
1075 | 1077 |
1076 if (clear_alias_sets) | 1078 if (clear_alias_sets) |
1077 { | 1079 { |
1112 fprintf (dump_file, " mem: "); | 1114 fprintf (dump_file, " mem: "); |
1113 print_inline_rtx (dump_file, mem_address, 0); | 1115 print_inline_rtx (dump_file, mem_address, 0); |
1114 fprintf (dump_file, "\n"); | 1116 fprintf (dump_file, "\n"); |
1115 } | 1117 } |
1116 | 1118 |
1117 /* Use cselib to replace all of the reg references with the full | 1119 /* First see if just canon_rtx (mem_address) is const or frame, |
1118 expression. This will take care of the case where we have | 1120 if not, try cselib_expand_value_rtx and call canon_rtx on that. */ |
1119 | 1121 address = NULL_RTX; |
1120 r_x = base + offset; | 1122 for (expanded = 0; expanded < 2; expanded++) |
1121 val = *r_x; | 1123 { |
1124 if (expanded) | |
1125 { | |
1126 /* Use cselib to replace all of the reg references with the full | |
1127 expression. This will take care of the case where we have | |
1128 | |
1129 r_x = base + offset; | |
1130 val = *r_x; | |
1122 | 1131 |
1123 by making it into | 1132 by making it into |
1124 | 1133 |
1125 val = *(base + offset); | 1134 val = *(base + offset); */ |
1126 */ | 1135 |
1127 | 1136 expanded_address = cselib_expand_value_rtx (mem_address, |
1128 expanded_address = cselib_expand_value_rtx (mem_address, scratch, 5); | 1137 scratch, 5); |
1129 | 1138 |
1130 /* If this fails, just go with the mem_address. */ | 1139 /* If this fails, just go with the address from first |
1131 if (!expanded_address) | 1140 iteration. */ |
1132 expanded_address = mem_address; | 1141 if (!expanded_address) |
1133 | 1142 break; |
1134 /* Split the address into canonical BASE + OFFSET terms. */ | 1143 } |
1135 address = canon_rtx (expanded_address); | 1144 else |
1136 | 1145 expanded_address = mem_address; |
1137 *offset = 0; | 1146 |
1138 | 1147 /* Split the address into canonical BASE + OFFSET terms. */ |
1148 address = canon_rtx (expanded_address); | |
1149 | |
1150 *offset = 0; | |
1151 | |
1152 if (dump_file) | |
1153 { | |
1154 if (expanded) | |
1155 { | |
1156 fprintf (dump_file, "\n after cselib_expand address: "); | |
1157 print_inline_rtx (dump_file, expanded_address, 0); | |
1158 fprintf (dump_file, "\n"); | |
1159 } | |
1160 | |
1161 fprintf (dump_file, "\n after canon_rtx address: "); | |
1162 print_inline_rtx (dump_file, address, 0); | |
1163 fprintf (dump_file, "\n"); | |
1164 } | |
1165 | |
1166 if (GET_CODE (address) == CONST) | |
1167 address = XEXP (address, 0); | |
1168 | |
1169 if (GET_CODE (address) == PLUS | |
1170 && GET_CODE (XEXP (address, 1)) == CONST_INT) | |
1171 { | |
1172 *offset = INTVAL (XEXP (address, 1)); | |
1173 address = XEXP (address, 0); | |
1174 } | |
1175 | |
1176 if (const_or_frame_p (address)) | |
1177 { | |
1178 group_info_t group = get_group_info (address); | |
1179 | |
1180 if (dump_file) | |
1181 fprintf (dump_file, " gid=%d offset=%d \n", | |
1182 group->id, (int)*offset); | |
1183 *base = NULL; | |
1184 *group_id = group->id; | |
1185 return true; | |
1186 } | |
1187 } | |
1188 | |
1189 *base = cselib_lookup (address, Pmode, true); | |
1190 *group_id = -1; | |
1191 | |
1192 if (*base == NULL) | |
1193 { | |
1194 if (dump_file) | |
1195 fprintf (dump_file, " no cselib val - should be a wild read.\n"); | |
1196 return false; | |
1197 } | |
1139 if (dump_file) | 1198 if (dump_file) |
1140 { | 1199 fprintf (dump_file, " varying cselib base=%d offset = %d\n", |
1141 fprintf (dump_file, "\n after cselib_expand address: "); | 1200 (*base)->value, (int)*offset); |
1142 print_inline_rtx (dump_file, expanded_address, 0); | |
1143 fprintf (dump_file, "\n"); | |
1144 | |
1145 fprintf (dump_file, "\n after canon_rtx address: "); | |
1146 print_inline_rtx (dump_file, address, 0); | |
1147 fprintf (dump_file, "\n"); | |
1148 } | |
1149 | |
1150 if (GET_CODE (address) == CONST) | |
1151 address = XEXP (address, 0); | |
1152 | |
1153 if (GET_CODE (address) == PLUS && GET_CODE (XEXP (address, 1)) == CONST_INT) | |
1154 { | |
1155 *offset = INTVAL (XEXP (address, 1)); | |
1156 address = XEXP (address, 0); | |
1157 } | |
1158 | |
1159 if (const_or_frame_p (address)) | |
1160 { | |
1161 group_info_t group = get_group_info (address); | |
1162 | |
1163 if (dump_file) | |
1164 fprintf (dump_file, " gid=%d offset=%d \n", group->id, (int)*offset); | |
1165 *base = NULL; | |
1166 *group_id = group->id; | |
1167 } | |
1168 else | |
1169 { | |
1170 *base = cselib_lookup (address, Pmode, true); | |
1171 *group_id = -1; | |
1172 | |
1173 if (*base == NULL) | |
1174 { | |
1175 if (dump_file) | |
1176 fprintf (dump_file, " no cselib val - should be a wild read.\n"); | |
1177 return false; | |
1178 } | |
1179 if (dump_file) | |
1180 fprintf (dump_file, " varying cselib base=%d offset = %d\n", | |
1181 (*base)->value, (int)*offset); | |
1182 } | |
1183 return true; | 1201 return true; |
1184 } | 1202 } |
1185 | 1203 |
1186 | 1204 |
1187 /* Clear the rhs field from the active_local_stores array. */ | 1205 /* Clear the rhs field from the active_local_stores array. */ |