< prev index next >

src/share/vm/opto/convertnode.cpp

Print this page

        

*** 30,50 **** #include "opto/subnode.hpp" #include "runtime/sharedRuntime.hpp" //============================================================================= //------------------------------Identity--------------------------------------- ! Node *Conv2BNode::Identity( PhaseTransform *phase ) { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return in(1); if( t == TypeInt::ZERO ) return in(1); if( t == TypeInt::ONE ) return in(1); if( t == TypeInt::BOOL ) return in(1); return this; } //------------------------------Value------------------------------------------ ! const Type *Conv2BNode::Value( PhaseTransform *phase ) const { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return Type::TOP; if( t == TypeInt::ZERO ) return TypeInt::ZERO; if( t == TypePtr::NULL_PTR ) return TypeInt::ZERO; const TypePtr *tp = t->isa_ptr(); --- 30,50 ---- #include "opto/subnode.hpp" #include "runtime/sharedRuntime.hpp" //============================================================================= //------------------------------Identity--------------------------------------- ! Node* Conv2BNode::Identity(PhaseGVN* phase) { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return in(1); if( t == TypeInt::ZERO ) return in(1); if( t == TypeInt::ONE ) return in(1); if( t == TypeInt::BOOL ) return in(1); return this; } //------------------------------Value------------------------------------------ ! const Type* Conv2BNode::Value(PhaseGVN* phase) const { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return Type::TOP; if( t == TypeInt::ZERO ) return TypeInt::ZERO; if( t == TypePtr::NULL_PTR ) return TypeInt::ZERO; const TypePtr *tp = t->isa_ptr();
*** 62,89 **** // The conversions operations are all Alpha sorted. Please keep it that way! //============================================================================= //------------------------------Value------------------------------------------ ! const Type *ConvD2FNode::Value( PhaseTransform *phase ) const { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return Type::TOP; if( t == Type::DOUBLE ) return Type::FLOAT; const TypeD *td = t->is_double_constant(); return TypeF::make( (float)td->getd() ); } //------------------------------Identity--------------------------------------- // Float's can be converted to doubles with no loss of bits. Hence // converting a float to a double and back to a float is a NOP. ! Node *ConvD2FNode::Identity(PhaseTransform *phase) { return (in(1)->Opcode() == Op_ConvF2D) ? in(1)->in(1) : this; } //============================================================================= //------------------------------Value------------------------------------------ ! const Type *ConvD2INode::Value( PhaseTransform *phase ) const { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return Type::TOP; if( t == Type::DOUBLE ) return TypeInt::INT; const TypeD *td = t->is_double_constant(); return TypeInt::make( SharedRuntime::d2i( td->getd() ) ); --- 62,89 ---- // The conversions operations are all Alpha sorted. Please keep it that way! //============================================================================= //------------------------------Value------------------------------------------ ! const Type* ConvD2FNode::Value(PhaseGVN* phase) const { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return Type::TOP; if( t == Type::DOUBLE ) return Type::FLOAT; const TypeD *td = t->is_double_constant(); return TypeF::make( (float)td->getd() ); } //------------------------------Identity--------------------------------------- // Float's can be converted to doubles with no loss of bits. Hence // converting a float to a double and back to a float is a NOP. ! Node* ConvD2FNode::Identity(PhaseGVN* phase) { return (in(1)->Opcode() == Op_ConvF2D) ? in(1)->in(1) : this; } //============================================================================= //------------------------------Value------------------------------------------ ! const Type* ConvD2INode::Value(PhaseGVN* phase) const { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return Type::TOP; if( t == Type::DOUBLE ) return TypeInt::INT; const TypeD *td = t->is_double_constant(); return TypeInt::make( SharedRuntime::d2i( td->getd() ) );
*** 98,123 **** } //------------------------------Identity--------------------------------------- // Int's can be converted to doubles with no loss of bits. Hence // converting an integer to a double and back to an integer is a NOP. ! Node *ConvD2INode::Identity(PhaseTransform *phase) { return (in(1)->Opcode() == Op_ConvI2D) ? in(1)->in(1) : this; } //============================================================================= //------------------------------Value------------------------------------------ ! const Type *ConvD2LNode::Value( PhaseTransform *phase ) const { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return Type::TOP; if( t == Type::DOUBLE ) return TypeLong::LONG; const TypeD *td = t->is_double_constant(); return TypeLong::make( SharedRuntime::d2l( td->getd() ) ); } //------------------------------Identity--------------------------------------- ! Node *ConvD2LNode::Identity(PhaseTransform *phase) { // Remove ConvD2L->ConvL2D->ConvD2L sequences. if( in(1) ->Opcode() == Op_ConvL2D && in(1)->in(1)->Opcode() == Op_ConvD2L ) return in(1)->in(1); return this; --- 98,123 ---- } //------------------------------Identity--------------------------------------- // Int's can be converted to doubles with no loss of bits. Hence // converting an integer to a double and back to an integer is a NOP. ! Node* ConvD2INode::Identity(PhaseGVN* phase) { return (in(1)->Opcode() == Op_ConvI2D) ? in(1)->in(1) : this; } //============================================================================= //------------------------------Value------------------------------------------ ! const Type* ConvD2LNode::Value(PhaseGVN* phase) const { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return Type::TOP; if( t == Type::DOUBLE ) return TypeLong::LONG; const TypeD *td = t->is_double_constant(); return TypeLong::make( SharedRuntime::d2l( td->getd() ) ); } //------------------------------Identity--------------------------------------- ! Node* ConvD2LNode::Identity(PhaseGVN* phase) { // Remove ConvD2L->ConvL2D->ConvD2L sequences. if( in(1) ->Opcode() == Op_ConvL2D && in(1)->in(1)->Opcode() == Op_ConvD2L ) return in(1)->in(1); return this;
*** 131,160 **** return NULL; } //============================================================================= //------------------------------Value------------------------------------------ ! const Type *ConvF2DNode::Value( PhaseTransform *phase ) const { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return Type::TOP; if( t == Type::FLOAT ) return Type::DOUBLE; const TypeF *tf = t->is_float_constant(); return TypeD::make( (double)tf->getf() ); } //============================================================================= //------------------------------Value------------------------------------------ ! const Type *ConvF2INode::Value( PhaseTransform *phase ) const { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return Type::TOP; if( t == Type::FLOAT ) return TypeInt::INT; const TypeF *tf = t->is_float_constant(); return TypeInt::make( SharedRuntime::f2i( tf->getf() ) ); } //------------------------------Identity--------------------------------------- ! Node *ConvF2INode::Identity(PhaseTransform *phase) { // Remove ConvF2I->ConvI2F->ConvF2I sequences. if( in(1) ->Opcode() == Op_ConvI2F && in(1)->in(1)->Opcode() == Op_ConvF2I ) return in(1)->in(1); return this; --- 131,160 ---- return NULL; } //============================================================================= //------------------------------Value------------------------------------------ ! const Type* ConvF2DNode::Value(PhaseGVN* phase) const { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return Type::TOP; if( t == Type::FLOAT ) return Type::DOUBLE; const TypeF *tf = t->is_float_constant(); return TypeD::make( (double)tf->getf() ); } //============================================================================= //------------------------------Value------------------------------------------ ! const Type* ConvF2INode::Value(PhaseGVN* phase) const { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return Type::TOP; if( t == Type::FLOAT ) return TypeInt::INT; const TypeF *tf = t->is_float_constant(); return TypeInt::make( SharedRuntime::f2i( tf->getf() ) ); } //------------------------------Identity--------------------------------------- ! Node* ConvF2INode::Identity(PhaseGVN* phase) { // Remove ConvF2I->ConvI2F->ConvF2I sequences. if( in(1) ->Opcode() == Op_ConvI2F && in(1)->in(1)->Opcode() == Op_ConvF2I ) return in(1)->in(1); return this;
*** 168,187 **** return NULL; } //============================================================================= //------------------------------Value------------------------------------------ ! const Type *ConvF2LNode::Value( PhaseTransform *phase ) const { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return Type::TOP; if( t == Type::FLOAT ) return TypeLong::LONG; const TypeF *tf = t->is_float_constant(); return TypeLong::make( SharedRuntime::f2l( tf->getf() ) ); } //------------------------------Identity--------------------------------------- ! Node *ConvF2LNode::Identity(PhaseTransform *phase) { // Remove ConvF2L->ConvL2F->ConvF2L sequences. if( in(1) ->Opcode() == Op_ConvL2F && in(1)->in(1)->Opcode() == Op_ConvF2L ) return in(1)->in(1); return this; --- 168,187 ---- return NULL; } //============================================================================= //------------------------------Value------------------------------------------ ! const Type* ConvF2LNode::Value(PhaseGVN* phase) const { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return Type::TOP; if( t == Type::FLOAT ) return TypeLong::LONG; const TypeF *tf = t->is_float_constant(); return TypeLong::make( SharedRuntime::f2l( tf->getf() ) ); } //------------------------------Identity--------------------------------------- ! Node* ConvF2LNode::Identity(PhaseGVN* phase) { // Remove ConvF2L->ConvL2F->ConvF2L sequences. if( in(1) ->Opcode() == Op_ConvL2F && in(1)->in(1)->Opcode() == Op_ConvF2L ) return in(1)->in(1); return this;
*** 195,234 **** return NULL; } //============================================================================= //------------------------------Value------------------------------------------ ! const Type *ConvI2DNode::Value( PhaseTransform *phase ) const { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return Type::TOP; const TypeInt *ti = t->is_int(); if( ti->is_con() ) return TypeD::make( (double)ti->get_con() ); return bottom_type(); } //============================================================================= //------------------------------Value------------------------------------------ ! const Type *ConvI2FNode::Value( PhaseTransform *phase ) const { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return Type::TOP; const TypeInt *ti = t->is_int(); if( ti->is_con() ) return TypeF::make( (float)ti->get_con() ); return bottom_type(); } //------------------------------Identity--------------------------------------- ! Node *ConvI2FNode::Identity(PhaseTransform *phase) { // Remove ConvI2F->ConvF2I->ConvI2F sequences. if( in(1) ->Opcode() == Op_ConvF2I && in(1)->in(1)->Opcode() == Op_ConvI2F ) return in(1)->in(1); return this; } //============================================================================= //------------------------------Value------------------------------------------ ! const Type *ConvI2LNode::Value( PhaseTransform *phase ) const { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return Type::TOP; const TypeInt *ti = t->is_int(); const Type* tl = TypeLong::make(ti->_lo, ti->_hi, ti->_widen); // Join my declared type against my incoming type. --- 195,234 ---- return NULL; } //============================================================================= //------------------------------Value------------------------------------------ ! const Type* ConvI2DNode::Value(PhaseGVN* phase) const { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return Type::TOP; const TypeInt *ti = t->is_int(); if( ti->is_con() ) return TypeD::make( (double)ti->get_con() ); return bottom_type(); } //============================================================================= //------------------------------Value------------------------------------------ ! const Type* ConvI2FNode::Value(PhaseGVN* phase) const { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return Type::TOP; const TypeInt *ti = t->is_int(); if( ti->is_con() ) return TypeF::make( (float)ti->get_con() ); return bottom_type(); } //------------------------------Identity--------------------------------------- ! Node* ConvI2FNode::Identity(PhaseGVN* phase) { // Remove ConvI2F->ConvF2I->ConvI2F sequences. if( in(1) ->Opcode() == Op_ConvF2I && in(1)->in(1)->Opcode() == Op_ConvI2F ) return in(1)->in(1); return this; } //============================================================================= //------------------------------Value------------------------------------------ ! const Type* ConvI2LNode::Value(PhaseGVN* phase) const { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return Type::TOP; const TypeInt *ti = t->is_int(); const Type* tl = TypeLong::make(ti->_lo, ti->_hi, ti->_widen); // Join my declared type against my incoming type.
*** 388,425 **** return this_changed; } //============================================================================= //------------------------------Value------------------------------------------ ! const Type *ConvL2DNode::Value( PhaseTransform *phase ) const { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return Type::TOP; const TypeLong *tl = t->is_long(); if( tl->is_con() ) return TypeD::make( (double)tl->get_con() ); return bottom_type(); } //============================================================================= //------------------------------Value------------------------------------------ ! const Type *ConvL2FNode::Value( PhaseTransform *phase ) const { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return Type::TOP; const TypeLong *tl = t->is_long(); if( tl->is_con() ) return TypeF::make( (float)tl->get_con() ); return bottom_type(); } //============================================================================= //----------------------------Identity----------------------------------------- ! Node *ConvL2INode::Identity( PhaseTransform *phase ) { // Convert L2I(I2L(x)) => x if (in(1)->Opcode() == Op_ConvI2L) return in(1)->in(1); return this; } //------------------------------Value------------------------------------------ ! const Type *ConvL2INode::Value( PhaseTransform *phase ) const { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return Type::TOP; const TypeLong *tl = t->is_long(); if (tl->is_con()) // Easy case. --- 388,425 ---- return this_changed; } //============================================================================= //------------------------------Value------------------------------------------ ! const Type* ConvL2DNode::Value(PhaseGVN* phase) const { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return Type::TOP; const TypeLong *tl = t->is_long(); if( tl->is_con() ) return TypeD::make( (double)tl->get_con() ); return bottom_type(); } //============================================================================= //------------------------------Value------------------------------------------ ! const Type* ConvL2FNode::Value(PhaseGVN* phase) const { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return Type::TOP; const TypeLong *tl = t->is_long(); if( tl->is_con() ) return TypeF::make( (float)tl->get_con() ); return bottom_type(); } //============================================================================= //----------------------------Identity----------------------------------------- ! Node* ConvL2INode::Identity(PhaseGVN* phase) { // Convert L2I(I2L(x)) => x if (in(1)->Opcode() == Op_ConvI2L) return in(1)->in(1); return this; } //------------------------------Value------------------------------------------ ! const Type* ConvL2INode::Value(PhaseGVN* phase) const { const Type *t = phase->type( in(1) ); if( t == Type::TOP ) return Type::TOP; const TypeLong *tl = t->is_long(); if (tl->is_con()) // Easy case.
*** 467,477 **** //============================================================================= //------------------------------Identity--------------------------------------- // Remove redundant roundings ! Node *RoundFloatNode::Identity( PhaseTransform *phase ) { assert(Matcher::strict_fp_requires_explicit_rounding, "should only generate for Intel"); // Do not round constants if (phase->type(in(1))->base() == Type::FloatCon) return in(1); int op = in(1)->Opcode(); // Redundant rounding --- 467,477 ---- //============================================================================= //------------------------------Identity--------------------------------------- // Remove redundant roundings ! Node* RoundFloatNode::Identity(PhaseGVN* phase) { assert(Matcher::strict_fp_requires_explicit_rounding, "should only generate for Intel"); // Do not round constants if (phase->type(in(1))->base() == Type::FloatCon) return in(1); int op = in(1)->Opcode(); // Redundant rounding
*** 481,498 **** if( op == Op_LoadF ) return in(1); return this; } //------------------------------Value------------------------------------------ ! const Type *RoundFloatNode::Value( PhaseTransform *phase ) const { return phase->type( in(1) ); } //============================================================================= //------------------------------Identity--------------------------------------- // Remove redundant roundings. Incoming arguments are already rounded. ! Node *RoundDoubleNode::Identity( PhaseTransform *phase ) { assert(Matcher::strict_fp_requires_explicit_rounding, "should only generate for Intel"); // Do not round constants if (phase->type(in(1))->base() == Type::DoubleCon) return in(1); int op = in(1)->Opcode(); // Redundant rounding --- 481,498 ---- if( op == Op_LoadF ) return in(1); return this; } //------------------------------Value------------------------------------------ ! const Type* RoundFloatNode::Value(PhaseGVN* phase) const { return phase->type( in(1) ); } //============================================================================= //------------------------------Identity--------------------------------------- // Remove redundant roundings. Incoming arguments are already rounded. ! Node* RoundDoubleNode::Identity(PhaseGVN* phase) { assert(Matcher::strict_fp_requires_explicit_rounding, "should only generate for Intel"); // Do not round constants if (phase->type(in(1))->base() == Type::DoubleCon) return in(1); int op = in(1)->Opcode(); // Redundant rounding
*** 504,513 **** if( op == Op_ConvI2D ) return in(1); return this; } //------------------------------Value------------------------------------------ ! const Type *RoundDoubleNode::Value( PhaseTransform *phase ) const { return phase->type( in(1) ); } --- 504,513 ---- if( op == Op_ConvI2D ) return in(1); return this; } //------------------------------Value------------------------------------------ ! const Type* RoundDoubleNode::Value(PhaseGVN* phase) const { return phase->type( in(1) ); }
< prev index next >