1 #ifdef USE_PRAGMA_IDENT_SRC
2 #pragma ident "@(#)machnode.cpp 1.200 07/09/28 10:23:08 JVM"
3 #endif
4 /*
5 * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 *
8 * This code is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 only, as
10 * published by the Free Software Foundation.
11 *
12 * This code is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * version 2 for more details (a copy is included in the LICENSE file that
16 * accompanied this code).
17 *
18 * You should have received a copy of the GNU General Public License version
19 * 2 along with this work; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
24 * have any questions.
25 *
248 // Find the memory inputs using our helper function
249 Node* base;
250 Node* index;
251 const MachOper* oper = memory_inputs(base, index);
252
253 if (oper == NULL) {
254 // Base has been set to NULL
255 offset = 0;
256 } else if (oper == (MachOper*)-1) {
257 // Base has been set to NodeSentinel
258 // There is not a unique memory use here. We will fall to AliasIdxBot.
259 offset = Type::OffsetBot;
260 } else {
261 // Base may be NULL, even if offset turns out to be != 0
262
263 intptr_t disp = oper->constant_disp();
264 int scale = oper->scale();
265 // Now we have collected every part of the ADLC MEMORY_INTER.
266 // See if it adds up to a base + offset.
267 if (index != NULL) {
268 if (!index->is_Con()) {
269 disp = Type::OffsetBot;
270 } else if (disp != Type::OffsetBot) {
271 const TypeX* ti = index->bottom_type()->isa_intptr_t();
272 if (ti == NULL) {
273 disp = Type::OffsetBot; // a random constant??
274 } else {
275 disp += ti->get_con() << scale;
276 }
277 }
278 }
279 offset = disp;
280
281 // In i486.ad, indOffset32X uses base==RegI and disp==RegP,
282 // this will prevent alias analysis without the following support:
283 // Lookup the TypePtr used by indOffset32X, a compile-time constant oop,
284 // Add the offset determined by the "base", or use Type::OffsetBot.
285 if( adr_type == TYPE_PTR_SENTINAL ) {
286 const TypePtr *t_disp = oper->disp_as_type(); // only !NULL for indOffset32X
287 if (t_disp != NULL) {
288 offset = Type::OffsetBot;
289 const Type* t_base = base->bottom_type();
290 if (t_base->isa_intptr_t()) {
291 const TypeX *t_offset = t_base->is_intptr_t();
|
1 #ifdef USE_PRAGMA_IDENT_SRC
2 #pragma ident "@(#)machnode.cpp 1.200 07/09/28 10:23:08 JVM"
3 #endif
4 /*
5 * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 *
8 * This code is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 only, as
10 * published by the Free Software Foundation.
11 *
12 * This code is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * version 2 for more details (a copy is included in the LICENSE file that
16 * accompanied this code).
17 *
18 * You should have received a copy of the GNU General Public License version
19 * 2 along with this work; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
24 * have any questions.
25 *
248 // Find the memory inputs using our helper function
249 Node* base;
250 Node* index;
251 const MachOper* oper = memory_inputs(base, index);
252
253 if (oper == NULL) {
254 // Base has been set to NULL
255 offset = 0;
256 } else if (oper == (MachOper*)-1) {
257 // Base has been set to NodeSentinel
258 // There is not a unique memory use here. We will fall to AliasIdxBot.
259 offset = Type::OffsetBot;
260 } else {
261 // Base may be NULL, even if offset turns out to be != 0
262
263 intptr_t disp = oper->constant_disp();
264 int scale = oper->scale();
265 // Now we have collected every part of the ADLC MEMORY_INTER.
266 // See if it adds up to a base + offset.
267 if (index != NULL) {
268 const Type* t_index = index->bottom_type();
269 if (t_index->isa_narrowoop()) { // EncodeN, LoadN, LoadConN, LoadNKlass.
270 // Memory references through narrow oops have a
271 // funny base so grab the type from the index:
272 // [R12 + narrow_oop_reg<<3 + offset]
273 assert(base == NULL, "Memory references through narrow oops have no base");
274 offset = disp;
275 adr_type = t_index->make_ptr()->add_offset(offset);
276 return NULL;
277 } else if (!index->is_Con()) {
278 disp = Type::OffsetBot;
279 } else if (disp != Type::OffsetBot) {
280 const TypeX* ti = t_index->isa_intptr_t();
281 if (ti == NULL) {
282 disp = Type::OffsetBot; // a random constant??
283 } else {
284 disp += ti->get_con() << scale;
285 }
286 }
287 }
288 offset = disp;
289
290 // In i486.ad, indOffset32X uses base==RegI and disp==RegP,
291 // this will prevent alias analysis without the following support:
292 // Lookup the TypePtr used by indOffset32X, a compile-time constant oop,
293 // Add the offset determined by the "base", or use Type::OffsetBot.
294 if( adr_type == TYPE_PTR_SENTINAL ) {
295 const TypePtr *t_disp = oper->disp_as_type(); // only !NULL for indOffset32X
296 if (t_disp != NULL) {
297 offset = Type::OffsetBot;
298 const Type* t_base = base->bottom_type();
299 if (t_base->isa_intptr_t()) {
300 const TypeX *t_offset = t_base->is_intptr_t();
|