Lines Matching refs:phase

46 static Node *step_through_mergemem(PhaseGVN *phase, MergeMemNode *mmem,  const TypePtr *tp, const TypePtr *adr_check, outputStream *st);
106 Node *MemNode::optimize_simple_memory_chain(Node *mchain, const TypePtr *t_adr, PhaseGVN *phase) {
111 Node *start_mem = phase->C->start()->proj_out(TypeFunc::Memory);
125 if (!call->may_modify(t_adr, phase)) {
141 if (!ClearArrayNode::step_through(&result, instance_id, phase)) {
148 result = step_through_mergemem(phase, result->as_MergeMem(), t_adr, NULL, tty);
154 Node *MemNode::optimize_memory_chain(Node *mchain, const TypePtr *t_adr, PhaseGVN *phase) {
157 PhaseIterGVN *igvn = phase->is_IterGVN();
159 result = optimize_simple_memory_chain(result, t_adr, phase);
172 assert(phase->C->get_alias_index(t) == phase->C->get_alias_index(t_adr), "correct memory chain");
178 static Node *step_through_mergemem(PhaseGVN *phase, MergeMemNode *mmem, const TypePtr *tp, const TypePtr *adr_check, outputStream *st) {
179 uint alias_idx = phase->C->get_alias_index(tp);
186 phase->C->must_alias(adr_check, alias_idx );
222 Node* m = phase->transform(mmem);
234 Node *MemNode::Ideal_common(PhaseGVN *phase, bool can_reshape) {
237 if (ctl && remove_dead_region(phase, can_reshape))
243 PhaseIterGVN *igvn = phase->is_IterGVN();
259 phase->is_IterGVN()->_worklist.push(this);
265 if (phase->type( mem ) == Type::TOP) return NodeSentinel; // caller will return NULL
271 phase->is_IterGVN()->_worklist.push(this);
276 const Type *t_adr = phase->type(address);
284 phase->is_IterGVN()->_worklist.push(this);
292 int alias_idx = phase->C->get_alias_index(t_adr->is_ptr());
299 if (base != NULL && phase->type(base)->higher_equal(TypePtr::NULL_PTR) &&
302 Compile* C = phase->C;
315 tty->print("phase->type(address): "); t_adr->dump(); tty->cr();
316 tty->print("phase->type(base): "); phase->type(address)->dump(); tty->cr();
320 !phase->type(base)->higher_equal(TypePtr::NULL_PTR), "NULL+offs not RAW address?");
338 mem = step_through_mergemem(phase, mmem, tp, adr_type(), tty);
346 if (phase->type( mem ) == Type::TOP) return NodeSentinel;
460 PhaseTransform* phase) {
492 Node* MemNode::find_previous_store(PhaseTransform* phase) {
496 Node* base = AddPNode::Ideal_base_and_offset(adr, phase, offset);
497 AllocateNode* alloc = AllocateNode::Ideal_allocation(base, phase);
515 Node* st_base = AddPNode::Ideal_base_and_offset(st_adr, phase, st_offset);
535 AllocateNode::Ideal_allocation(st_base, phase),
536 phase)) {
566 int alias_idx = phase->C->get_alias_index(adr_type());
586 if (!call->may_modify(addr_t, phase)) {
594 if (ClearArrayNode::step_through(&mem, (uint)addr_t->instance_id(), phase)) {
603 int alias_idx = phase->C->get_alias_index(adr_type());
955 Node* MemNode::can_see_stored_value(Node* st, PhaseTransform* phase) const {
958 const TypeInstPtr* tp = phase->type(ld_adr)->isa_instptr();
959 Compile::AliasType* atp = tp != NULL ? phase->C->alias_type(tp) : NULL;
1005 if (!phase->eqv(st_adr, ld_adr)) {
1008 AllocateNode* alloc = AllocateNode::Ideal_allocation(st_adr, phase, st_off);
1011 AllocateNode* allo2 = AllocateNode::Ideal_allocation(ld_adr, phase, ld_off);
1035 st->in(0) == AllocateNode::Ideal_allocation(ld_adr, phase, offset) &&
1041 return phase->zerocon(memory_type());
1049 alloc == AllocateNode::Ideal_allocation(ld_adr, phase, offset)) {
1051 st = init->find_captured_store(offset, memory_size(), phase);
1080 Node *LoadNode::Identity( PhaseTransform *phase ) {
1084 Node* value = can_see_stored_value(mem, phase);
1093 if (!phase->type(value)->higher_equal(phase->type(this)))
1106 int this_index = phase->C->get_alias_index(addr_t);
1184 Node* LoadNode::eliminate_autobox(PhaseGVN* phase) {
1191 allocation = AllocateNode::Ideal_allocation(base->in(i), phase);
1228 in1_addr = phase->transform(in1_addr);
1229 in1 = phase->transform(in1);
1230 in2_addr = phase->transform(in2_addr);
1231 in2 = phase->transform(in2);
1253 Compile::AliasType* atp = phase->C->alias_type(load_base->adr_type());
1259 cache = AddPNode::Ideal_base_and_offset(load_base->in(Address), phase, cache_offset);
1270 result = phase->transform(new (phase->C) AddXNode(result, elements[i]));
1274 result = phase->transform(new (phase->C) AddXNode(result, phase->MakeConX(-offset)));
1275 if (result->Opcode() == Op_LShiftX && result->in(2) == phase->intcon(shift)) {
1278 result = new (phase->C) RShiftXNode(result->in(1), phase->intcon(0));
1280 result = new (phase->C) RShiftXNode(result, phase->intcon(shift));
1283 result = new (phase->C) ConvL2INode(phase->transform(result));
1295 Node *LoadNode::split_through_phi(PhaseGVN *phase) {
1298 const TypePtr *addr_t = phase->type(address)->isa_ptr();
1311 if (rc == NULL || phase->type(rc) == Type::TOP)
1322 Node* m = MemNode::optimize_memory_chain(in, addr_t, phase);
1330 assert(phase->C->have_alias_type(addr_t), "instance should have alias type");
1334 if (!phase->eqv(this, this->Identity(phase)))
1342 int this_index = phase->C->get_alias_index(addr_t);
1345 PhaseIterGVN *igvn = phase->is_IterGVN();
1350 if (region->in(i) == phase->C->top()) {
1351 x = phase->C->top(); // Dead path? Use a dead data op
1381 // Note that some Identity methods call phase->type(this).
1419 Node *LoadNode::Ideal(PhaseGVN *phase, bool can_reshape) {
1420 Node* p = MemNode::Ideal_common(phase, can_reshape);
1429 phase->C->get_alias_index(phase->type(address)->is_ptr()) != Compile::AliasIdxRaw ) {
1435 Node* base = AddPNode::Ideal_base_and_offset(address, phase, ignore);
1437 && phase->C->get_alias_index(phase->type(address)->is_ptr()) != Compile::AliasIdxRaw) {
1440 && phase->type(base)->higher_equal(TypePtr::NOTNULL)
1441 && all_controls_dominate(base, phase->C->start())) {
1447 assert(!phase->type(base)->higher_equal(TypePtr::NULL_PTR), "the autobox pointer should be non-null");
1448 Compile::AliasType* atp = phase->C->alias_type(adr_type());
1450 Node* result = eliminate_autobox(phase);
1457 const TypePtr *addr_t = phase->type(address)->isa_ptr();
1461 Node* opt_mem = MemNode::optimize_memory_chain(mem, addr_t, phase);
1464 if (phase->type( opt_mem ) == Type::TOP) return NULL;
1470 PhaseIterGVN *igvn = phase->is_IterGVN();
1473 phase->is_IterGVN()->_worklist.push(this);
1477 Node* result = split_through_phi(phase);
1494 Node* prev_mem = find_previous_store(phase);
1500 if (can_see_stored_value(prev_mem, phase)) {
1538 const Type *LoadNode::Value( PhaseTransform *phase ) const {
1541 const Type *t1 = phase->type(mem);
1544 const TypePtr* tp = phase->type(adr)->isa_ptr();
1548 Compile* C = phase->C;
1592 !phase->type(base)->higher_equal(TypePtr::NULL_PTR)) {
1617 const TypeOopPtr* t = phase->type(base)->isa_oopptr();
1760 Node* value = can_see_stored_value(mem,phase);
1793 Node *LoadBNode::Ideal(PhaseGVN *phase, bool can_reshape) {
1795 Node* value = can_see_stored_value(mem,phase);
1796 if( value && !phase->type(value)->higher_equal( _type ) ) {
1797 Node *result = phase->transform( new (phase->C) LShiftINode(value, phase->intcon(24)) );
1798 return new (phase->C) RShiftINode(result, phase->intcon(24));
1801 return LoadNode::Ideal(phase, can_reshape);
1804 const Type* LoadBNode::Value(PhaseTransform *phase) const {
1806 Node* value = can_see_stored_value(mem,phase);
1815 return LoadNode::Value(phase);
1825 Node* LoadUBNode::Ideal(PhaseGVN* phase, bool can_reshape) {
1827 Node* value = can_see_stored_value(mem, phase);
1828 if (value && !phase->type(value)->higher_equal(_type))
1829 return new (phase->C) AndINode(value, phase->intcon(0xFF));
1831 return LoadNode::Ideal(phase, can_reshape);
1834 const Type* LoadUBNode::Value(PhaseTransform *phase) const {
1836 Node* value = can_see_stored_value(mem,phase);
1845 return LoadNode::Value(phase);
1855 Node *LoadUSNode::Ideal(PhaseGVN *phase, bool can_reshape) {
1857 Node* value = can_see_stored_value(mem,phase);
1858 if( value && !phase->type(value)->higher_equal( _type ) )
1859 return new (phase->C) AndINode(value,phase->intcon(0xFFFF));
1861 return LoadNode::Ideal(phase, can_reshape);
1864 const Type* LoadUSNode::Value(PhaseTransform *phase) const {
1866 Node* value = can_see_stored_value(mem,phase);
1875 return LoadNode::Value(phase);
1885 Node *LoadSNode::Ideal(PhaseGVN *phase, bool can_reshape) {
1887 Node* value = can_see_stored_value(mem,phase);
1888 if( value && !phase->type(value)->higher_equal( _type ) ) {
1889 Node *result = phase->transform( new (phase->C) LShiftINode(value, phase->intcon(16)) );
1890 return new (phase->C) RShiftINode(result, phase->intcon(16));
1893 return LoadNode::Ideal(phase, can_reshape);
1896 const Type* LoadSNode::Value(PhaseTransform *phase) const {
1898 Node* value = can_see_stored_value(mem,phase);
1907 return LoadNode::Value(phase);
1930 const Type *LoadKlassNode::Value( PhaseTransform *phase ) const {
1931 return klass_value_common(phase);
1934 const Type *LoadNode::klass_value_common( PhaseTransform *phase ) const {
1936 const Type *t1 = phase->type( in(MemNode::Memory) );
1939 const Type *t2 = phase->type( adr );
1950 if (ik == phase->C->env()->Class_klass()
1984 phase->C->dependencies()->assert_leaf_type(ik);
2017 phase->C->dependencies()->assert_leaf_type(ik);
2059 return LoadNode::Value(phase);
2065 Node* LoadKlassNode::Identity( PhaseTransform *phase ) {
2066 return klass_identity_common(phase);
2069 Node* LoadNode::klass_identity_common(PhaseTransform *phase ) {
2070 Node* x = LoadNode::Identity(phase);
2077 Node* base = AddPNode::Ideal_base_and_offset(adr, phase, offset);
2079 const TypeOopPtr* toop = phase->type(adr)->isa_oopptr();
2085 Node* allocated_klass = AllocateNode::Ideal_klass(base, phase);
2101 if (toop->isa_instptr() && toop->klass() == phase->C->env()->Class_klass()
2108 const TypeKlassPtr* tkls = phase->type(adr2)->isa_klassptr();
2130 const Type *LoadNKlassNode::Value( PhaseTransform *phase ) const {
2131 const Type *t = klass_value_common(phase);
2141 Node* LoadNKlassNode::Identity( PhaseTransform *phase ) {
2142 Node *x = klass_identity_common(phase);
2144 const Type *t = phase->type( x );
2148 return phase->transform(new (phase->C) EncodePNode(x, t->make_narrowoop()));
2152 const Type *LoadRangeNode::Value( PhaseTransform *phase ) const {
2154 const Type *t1 = phase->type( in(MemNode::Memory) );
2157 const Type *t2 = phase->type( adr );
2168 Node *LoadRangeNode::Ideal(PhaseGVN *phase, bool can_reshape) {
2169 Node* p = MemNode::Ideal_common(phase, can_reshape);
2176 Node* base = AddPNode::Ideal_base_and_offset(adr, phase, offset);
2178 const TypeAryPtr* tary = phase->type(adr)->isa_aryptr();
2184 AllocateArrayNode* alloc = AllocateArrayNode::Ideal_array_allocation(base, phase);
2187 Node* len = alloc->make_ideal_length(tary, phase);
2200 Node* LoadRangeNode::Identity( PhaseTransform *phase ) {
2201 Node* x = LoadINode::Identity(phase);
2208 Node* base = AddPNode::Ideal_base_and_offset(adr, phase, offset);
2210 const TypeAryPtr* tary = phase->type(adr)->isa_aryptr();
2216 AllocateArrayNode* alloc = AllocateArrayNode::Ideal_array_allocation(base, phase);
2220 Node* len = alloc->make_ideal_length(tary, phase, false);
2291 Node *StoreNode::Ideal(PhaseGVN *phase, bool can_reshape) {
2292 Node* p = MemNode::Ideal_common(phase, can_reshape);
2308 phase->C->get_alias_index(adr_type()) == Compile::AliasIdxRaw,
2321 phase->is_IterGVN());
2336 intptr_t offset = init->can_capture_store(this, phase, can_reshape);
2338 Node* moved = init->capture_store(this, offset, phase, can_reshape);
2343 mem = MergeMemNode::make(phase->C, mem);
2353 const Type *StoreNode::Value( PhaseTransform *phase ) const {
2355 const Type *t1 = phase->type( in(MemNode::Memory) );
2357 const Type *t2 = phase->type( in(MemNode::Address) );
2359 const Type *t3 = phase->type( in(MemNode::ValueIn) );
2368 Node *StoreNode::Identity( PhaseTransform *phase ) {
2392 if (ReduceFieldZeroing && phase->type(val)->is_zero_type()) {
2399 Node* prev_mem = find_previous_store(phase);
2402 Node* prev_val = can_see_stored_value(prev_mem, phase);
2403 if (prev_val != NULL && phase->eqv(prev_val, val)) {
2432 Node *StoreNode::Ideal_masked_input(PhaseGVN *phase, uint mask) {
2435 const TypeInt *t = phase->type( val->in(2) )->isa_int();
2450 Node *StoreNode::Ideal_sign_extended_input(PhaseGVN *phase, int num_bits) {
2453 const TypeInt *t = phase->type( val->in(2) )->isa_int();
2457 const TypeInt *t2 = phase->type( shl->in(2) )->isa_int();
2473 bool StoreNode::value_never_loaded( PhaseTransform *phase) const {
2475 const TypeOopPtr *adr_oop = phase->type(adr)->isa_oopptr();
2495 Node *StoreBNode::Ideal(PhaseGVN *phase, bool can_reshape){
2496 Node *progress = StoreNode::Ideal_masked_input(phase, 0xFF);
2499 progress = StoreNode::Ideal_sign_extended_input(phase, 24);
2503 return StoreNode::Ideal(phase, can_reshape);
2510 Node *StoreCNode::Ideal(PhaseGVN *phase, bool can_reshape){
2511 Node *progress = StoreNode::Ideal_masked_input(phase, 0xFFFF);
2514 progress = StoreNode::Ideal_sign_extended_input(phase, 16);
2518 return StoreNode::Ideal(phase, can_reshape);
2523 Node *StoreCMNode::Identity( PhaseTransform *phase ) {
2527 const Type *t1 = phase->type( my_store->in(MemNode::ValueIn) );
2537 Node *StoreCMNode::Ideal(PhaseGVN *phase, bool can_reshape){
2538 Node* progress = StoreNode::Ideal(phase, can_reshape);
2552 const Type *StoreCMNode::Value( PhaseTransform *phase ) const {
2554 const Type *t = phase->type( in(MemNode::Memory) );
2556 t = phase->type( in(MemNode::Address) );
2558 t = phase->type( in(MemNode::ValueIn) );
2561 t = phase->type( in(MemNode::OopStore) );
2564 return StoreNode::Value( phase );
2570 const Type * SCMemProjNode::Value( PhaseTransform *phase ) const
2626 Node *ClearArrayNode::Identity( PhaseTransform *phase ) {
2627 return phase->type(in(2))->higher_equal(TypeX::ZERO) ? in(1) : this;
2632 Node *ClearArrayNode::Ideal(PhaseGVN *phase, bool can_reshape){
2634 const TypeX* t = phase->type(in(2))->isa_intptr_t();
2648 if( phase->type(mem)==Type::TOP ) return NULL;
2650 const Type* at = phase->type(adr);
2660 Node *zero = phase->makecon(TypeLong::ZERO);
2661 Node *off = phase->MakeConX(BytesPerLong);
2662 mem = new (phase->C) StoreLNode(in(0),mem,adr,atp,zero);
2665 mem = phase->transform(mem);
2666 adr = phase->transform(new (phase->C) AddPNode(base,adr,off));
2667 mem = new (phase->C) StoreLNode(in(0),mem,adr,atp,zero);
2675 bool ClearArrayNode::step_through(Node** np, uint instance_id, PhaseTransform* phase) {
2679 AllocateNode* alloc = AllocateNode::Ideal_allocation(n->in(3), phase, offset);
2702 PhaseGVN* phase) {
2703 Compile* C = phase->C;
2708 Node* adr = new (C) AddPNode(dest, dest, phase->MakeConX(offset));
2709 adr = phase->transform(adr);
2711 mem = StoreNode::make(*phase, ctl, mem, adr, atp, phase->zerocon(T_INT), T_INT);
2712 mem = phase->transform(mem);
2718 return clear_memory(ctl, mem, dest, phase->MakeConX(offset), end_offset, phase);
2724 PhaseGVN* phase) {
2730 Compile* C = phase->C;
2737 Node* shift = phase->intcon(exact_log2(unit));
2738 zbase = phase->transform( new(C) URShiftXNode(zbase, shift) );
2739 zend = phase->transform( new(C) URShiftXNode(zend, shift) );
2743 Node* zsize = phase->transform( new(C) SubXNode(zend, zbase) );
2744 Node* adr = phase->transform( new(C) AddPNode(dest, dest, start_offset) );
2746 return phase->transform(mem);
2752 PhaseGVN* phase) {
2758 Compile* C = phase->C;
2766 start_offset, phase->MakeConX(done_offset), phase);
2769 Node* adr = new (C) AddPNode(dest, dest, phase->MakeConX(done_offset));
2770 adr = phase->transform(adr);
2772 mem = StoreNode::make(*phase, ctl, mem, adr, atp, phase->zerocon(T_INT), T_INT);
2773 mem = phase->transform(mem);
2789 Node *StrIntrinsicNode::Ideal(PhaseGVN *phase, bool can_reshape) {
2790 if (remove_dead_region(phase, can_reshape)) return this;
2795 Node* mem = phase->transform(in(MemNode::Memory));
2797 uint alias_idx = phase->C->get_alias_index(adr_type());
2808 const Type *StrIntrinsicNode::Value( PhaseTransform *phase ) const {
2809 if (in(0) && phase->type(in(0)) == Type::TOP) return Type::TOP;
2851 Node *MemBarNode::Ideal(PhaseGVN *phase, bool can_reshape) {
2852 if (remove_dead_region(phase, can_reshape)) return this;
2869 phase->is_IterGVN()->_worklist.push(my_mem);
2874 phase->is_IterGVN()->_worklist.push(my_mem); // remove dead node later
2885 PhaseIterGVN* igvn = phase->is_IterGVN();
2890 return new (phase->C) ConINode(TypeInt::ZERO);
2898 const Type *MemBarNode::Value( PhaseTransform *phase ) const {
2900 if( phase->type(in(0)) == Type::TOP )
3046 void InitializeNode::set_complete(PhaseGVN* phase) {
3055 PhaseIterGVN* igvn = phase->is_IterGVN();
3061 bool AllocateNode::maybe_set_complete(PhaseGVN* phase) {
3067 init->set_complete(phase);
3088 intptr_t InitializeNode::get_store_offset(Node* st, PhaseTransform* phase) {
3092 phase, offset);
3148 intptr_t InitializeNode::can_capture_store(StoreNode* st, PhaseTransform* phase, bool can_reshape) {
3160 AllocateNode* alloc = AllocateNode::Ideal_allocation(adr, phase, offset);
3180 const TypePtr* t_adr = phase->type(adr)->isa_ptr();
3181 int alias_idx = phase->C->get_alias_index(t_adr);
3216 const TypePtr* other_t_adr = phase->type(other_adr)->isa_ptr();
3218 int other_alias_idx = phase->C->get_alias_index(other_t_adr);
3250 phase->C->record_for_igvn(st);
3267 PhaseTransform* phase) {
3286 intptr_t st_off = get_store_offset(st, phase);
3320 PhaseTransform* phase) {
3321 assert(stores_are_sane(phase), "");
3322 int i = captured_store_insertion_point(start, size_in_bytes, phase);
3329 assert(get_store_offset(st->as_Store(), phase) == start, "sanity");
3336 PhaseTransform* phase) {
3339 Compile* C = phase->C;
3340 addr = phase->transform( new (C) AddPNode(C->top(), addr,
3341 phase->MakeConX(offset)) );
3365 PhaseTransform* phase, bool can_reshape) {
3366 assert(stores_are_sane(phase), "");
3369 assert(can_capture_store(st, phase, can_reshape) == start, "sanity");
3371 Compile* C = phase->C;
3373 int i = captured_store_insertion_point(start, size_in_bytes, phase);
3391 new_st->set_req(MemNode::Address, make_raw_address(start, phase));
3392 new_st = phase->transform(new_st);
3402 DEBUG_ONLY(Node* check_st = find_captured_store(start, size_in_bytes, phase));
3443 PhaseGVN* phase) {
3444 Compile* C = phase->C;
3446 assert(stores_are_sane(phase), "");
3453 intptr_t size_limit = phase->find_intptr_t_con(size_in_bytes, ti_limit);
3481 intptr_t st_off = get_store_offset(st, phase);
3493 const Type* val = phase->type(st->in(MemNode::ValueIn));
3533 assert(get_store_offset(st, phase) == st_off, "must be");
3535 DEBUG_ONLY(const Type* tcon = phase->type(st->in(MemNode::ValueIn)));
3603 Node* adr = make_raw_address(offset, phase);
3613 st[nst++] = StoreNode::make(*phase, ctl, zmem, adr, atp,
3614 phase->longcon(con), T_LONG);
3620 st[nst++] = StoreNode::make(*phase, ctl, zmem, adr, atp,
3621 phase->intcon(con0), T_INT);
3626 adr = make_raw_address(offset, phase);
3628 st[nst++] = StoreNode::make(*phase, ctl, zmem, adr, atp,
3629 phase->intcon(con1), T_INT);
3638 st1 = phase->transform(st1);
3641 int ins_idx = captured_store_insertion_point(offset, /*size:*/0, phase);
3668 intptr_t InitializeNode::find_next_fullword_store(uint start, PhaseGVN* phase) {
3676 intptr_t st_off = get_store_offset(st, phase);
3722 PhaseGVN* phase) {
3724 assert(stores_are_sane(phase), "");
3731 coalesce_subword_stores(header_size, size_in_bytes, phase);
3751 intptr_t st_off = get_store_offset(st, phase);
3778 intptr_t next_full_store = find_next_fullword_store(i, phase);
3806 phase);
3830 (val = phase->type(st->in(MemNode::ValueIn)))->singleton() &&
3851 intptr_t size_limit = phase->find_intptr_t_con(size_in_bytes, max_jint);
3856 ciKlass* k = phase->type(klass_node)->is_klassptr()->klass();
3863 zeroes_done, size_in_bytes, phase);
3867 set_complete(phase);
3873 bool InitializeNode::stores_are_sane(PhaseTransform* phase) {
3880 intptr_t st_off = get_store_offset(st, phase);
4039 Node* MergeMemNode::Identity(PhaseTransform *phase) {
4057 Node *MergeMemNode::Ideal(PhaseGVN *phase, bool can_reshape) {
4198 Node *m = phase->transform(new_mbase); // Rollup any cycles
4208 // Cut inputs during Parse phase only.
4209 // During Optimize phase a dead MergeMem node will be subsumed by Top.
4225 phase->is_IterGVN()->_worklist.push(phi);