26 #include "classfile/systemDictionary.hpp"
27 #include "gc/shared/barrierSet.hpp"
28 #include "gc/shared/c2/barrierSetC2.hpp"
29 #include "memory/allocation.inline.hpp"
30 #include "memory/resourceArea.hpp"
31 #include "oops/objArrayKlass.hpp"
32 #include "opto/addnode.hpp"
33 #include "opto/castnode.hpp"
34 #include "opto/cfgnode.hpp"
35 #include "opto/connode.hpp"
36 #include "opto/convertnode.hpp"
37 #include "opto/loopnode.hpp"
38 #include "opto/machnode.hpp"
39 #include "opto/movenode.hpp"
40 #include "opto/narrowptrnode.hpp"
41 #include "opto/mulnode.hpp"
42 #include "opto/phaseX.hpp"
43 #include "opto/regmask.hpp"
44 #include "opto/runtime.hpp"
45 #include "opto/subnode.hpp"
46 #include "utilities/vmError.hpp"
47
48 // Portions of code courtesy of Clifford Click
49
50 // Optimization - Graph Style
51
52 //=============================================================================
53 //------------------------------Value------------------------------------------
54 // Compute the type of the RegionNode.
55 const Type* RegionNode::Value(PhaseGVN* phase) const {
56 for( uint i=1; i<req(); ++i ) { // For all paths in
57 Node *n = in(i); // Get Control source
58 if( !n ) continue; // Missing inputs are TOP
59 if( phase->type(n) == Type::CONTROL )
60 return Type::CONTROL;
61 }
62 return Type::TOP; // All paths dead? Then so are we
63 }
64
65 //------------------------------Identity---------------------------------------
2359 if (is_decodeN) {
2360 new_ii = new EncodePNode(ii, narrow_t);
2361 } else {
2362 new_ii = new EncodePKlassNode(ii, narrow_t);
2363 }
2364 igvn->register_new_node_with_optimizer(new_ii);
2365 }
2366 }
2367 new_phi->set_req(i, new_ii);
2368 }
2369 igvn->register_new_node_with_optimizer(new_phi, this);
2370 if (is_decodeN) {
2371 progress = new DecodeNNode(new_phi, bottom_type());
2372 } else {
2373 progress = new DecodeNKlassNode(new_phi, bottom_type());
2374 }
2375 }
2376 }
2377 #endif
2378
2379 return progress; // Return any progress
2380 }
2381
2382 //------------------------------is_tripcount-----------------------------------
2383 bool PhiNode::is_tripcount() const {
2384 return (in(0) != NULL && in(0)->is_CountedLoop() &&
2385 in(0)->as_CountedLoop()->phi() == this);
2386 }
2387
2388 //------------------------------out_RegMask------------------------------------
2389 const RegMask &PhiNode::in_RegMask(uint i) const {
2390 return i ? out_RegMask() : RegMask::Empty;
2391 }
2392
2393 const RegMask &PhiNode::out_RegMask() const {
2394 uint ideal_reg = _type->ideal_reg();
2395 assert( ideal_reg != Node::NotAMachineReg, "invalid type at Phi" );
2396 if( ideal_reg == 0 ) return RegMask::Empty;
2397 assert(ideal_reg != Op_RegFlags, "flags register is not spillable");
2398 return *(Compile::current()->matcher()->idealreg2spillmask[ideal_reg]);
|
26 #include "classfile/systemDictionary.hpp"
27 #include "gc/shared/barrierSet.hpp"
28 #include "gc/shared/c2/barrierSetC2.hpp"
29 #include "memory/allocation.inline.hpp"
30 #include "memory/resourceArea.hpp"
31 #include "oops/objArrayKlass.hpp"
32 #include "opto/addnode.hpp"
33 #include "opto/castnode.hpp"
34 #include "opto/cfgnode.hpp"
35 #include "opto/connode.hpp"
36 #include "opto/convertnode.hpp"
37 #include "opto/loopnode.hpp"
38 #include "opto/machnode.hpp"
39 #include "opto/movenode.hpp"
40 #include "opto/narrowptrnode.hpp"
41 #include "opto/mulnode.hpp"
42 #include "opto/phaseX.hpp"
43 #include "opto/regmask.hpp"
44 #include "opto/runtime.hpp"
45 #include "opto/subnode.hpp"
46 #include "opto/vectornode.hpp"
47 #include "utilities/vmError.hpp"
48
49 // Portions of code courtesy of Clifford Click
50
51 // Optimization - Graph Style
52
53 //=============================================================================
54 //------------------------------Value------------------------------------------
55 // Compute the type of the RegionNode.
56 const Type* RegionNode::Value(PhaseGVN* phase) const {
57 for( uint i=1; i<req(); ++i ) { // For all paths in
58 Node *n = in(i); // Get Control source
59 if( !n ) continue; // Missing inputs are TOP
60 if( phase->type(n) == Type::CONTROL )
61 return Type::CONTROL;
62 }
63 return Type::TOP; // All paths dead? Then so are we
64 }
65
66 //------------------------------Identity---------------------------------------
2360 if (is_decodeN) {
2361 new_ii = new EncodePNode(ii, narrow_t);
2362 } else {
2363 new_ii = new EncodePKlassNode(ii, narrow_t);
2364 }
2365 igvn->register_new_node_with_optimizer(new_ii);
2366 }
2367 }
2368 new_phi->set_req(i, new_ii);
2369 }
2370 igvn->register_new_node_with_optimizer(new_phi, this);
2371 if (is_decodeN) {
2372 progress = new DecodeNNode(new_phi, bottom_type());
2373 } else {
2374 progress = new DecodeNKlassNode(new_phi, bottom_type());
2375 }
2376 }
2377 }
2378 #endif
2379
2380 // Phi (VB ... VB) => VB (Phi ...) (Phi ...)
2381 if (EnableVectorReboxing && can_reshape && progress == NULL) {
2382 PhaseIterGVN* igvn = phase->is_IterGVN();
2383
2384 bool all_inputs_are_equiv_vboxes = true;
2385 for (uint i = 1; i < req(); ++i) {
2386 Node* n = in(i);
2387 if (in(i)->Opcode() != Op_VectorBox) {
2388 all_inputs_are_equiv_vboxes = false;
2389 break;
2390 }
2391 // Check that vector type of vboxes is equivalent
2392 if (i != 1) {
2393 if (Type::cmp(in(i-0)->in(VectorBoxNode::Value)->bottom_type(),
2394 in(i-1)->in(VectorBoxNode::Value)->bottom_type()) != 0) {
2395 all_inputs_are_equiv_vboxes = false;
2396 break;
2397 }
2398 if (Type::cmp(in(i-0)->in(VectorBoxNode::Box)->bottom_type(),
2399 in(i-1)->in(VectorBoxNode::Box)->bottom_type()) != 0) {
2400 all_inputs_are_equiv_vboxes = false;
2401 break;
2402 }
2403 }
2404 }
2405
2406 if (all_inputs_are_equiv_vboxes) {
2407 VectorBoxNode* vbox = static_cast<VectorBoxNode*>(in(1));
2408 PhiNode* new_vbox_phi = new PhiNode(r, vbox->box_type());
2409 PhiNode* new_vect_phi = new PhiNode(r, vbox->vec_type());
2410 for (uint i = 1; i < req(); ++i) {
2411 VectorBoxNode* old_vbox = static_cast<VectorBoxNode*>(in(i));
2412 new_vbox_phi->set_req(i, old_vbox->in(VectorBoxNode::Box));
2413 new_vect_phi->set_req(i, old_vbox->in(VectorBoxNode::Value));
2414 }
2415 igvn->register_new_node_with_optimizer(new_vbox_phi, this);
2416 igvn->register_new_node_with_optimizer(new_vect_phi, this);
2417 progress = new VectorBoxNode(igvn->C, new_vbox_phi, new_vect_phi, vbox->box_type(), vbox->vec_type());
2418 }
2419 }
2420
2421 return progress; // Return any progress
2422 }
2423
2424 //------------------------------is_tripcount-----------------------------------
2425 bool PhiNode::is_tripcount() const {
2426 return (in(0) != NULL && in(0)->is_CountedLoop() &&
2427 in(0)->as_CountedLoop()->phi() == this);
2428 }
2429
2430 //------------------------------out_RegMask------------------------------------
2431 const RegMask &PhiNode::in_RegMask(uint i) const {
2432 return i ? out_RegMask() : RegMask::Empty;
2433 }
2434
2435 const RegMask &PhiNode::out_RegMask() const {
2436 uint ideal_reg = _type->ideal_reg();
2437 assert( ideal_reg != Node::NotAMachineReg, "invalid type at Phi" );
2438 if( ideal_reg == 0 ) return RegMask::Empty;
2439 assert(ideal_reg != Op_RegFlags, "flags register is not spillable");
2440 return *(Compile::current()->matcher()->idealreg2spillmask[ideal_reg]);
|