433
434 Register as_register() const;
435 Register as_register_lo() const;
436 Register as_register_hi() const;
437
438 Register as_pointer_register() {
439 #ifdef _LP64
440 if (is_double_cpu()) {
441 assert(as_register_lo() == as_register_hi(), "should be a single register");
442 return as_register_lo();
443 }
444 #endif
445 return as_register();
446 }
447
448 #ifdef X86
449 XMMRegister as_xmm_float_reg() const;
450 XMMRegister as_xmm_double_reg() const;
451 // for compatibility with RInfo
452 int fpu () const { return lo_reg_half(); }
453 #endif // X86
454 #if defined(SPARC) || defined(ARM) || defined(PPC)
455 FloatRegister as_float_reg () const;
456 FloatRegister as_double_reg () const;
457 #endif
458
459 jint as_jint() const { return as_constant_ptr()->as_jint(); }
460 jlong as_jlong() const { return as_constant_ptr()->as_jlong(); }
461 jfloat as_jfloat() const { return as_constant_ptr()->as_jfloat(); }
462 jdouble as_jdouble() const { return as_constant_ptr()->as_jdouble(); }
463 jobject as_jobject() const { return as_constant_ptr()->as_jobject(); }
464
465 void print() const PRODUCT_RETURN;
466 void print(outputStream* out) const PRODUCT_RETURN;
467 };
468
469
470 inline LIR_OprDesc::OprType as_OprType(BasicType type) {
471 switch (type) {
472 case T_INT: return LIR_OprDesc::int_type;
473 case T_LONG: return LIR_OprDesc::long_type;
474 case T_FLOAT: return LIR_OprDesc::float_type;
524 _base(base)
525 , _index(index)
526 , _scale(times_1)
527 , _type(type)
528 , _disp(0) { verify(); }
529
530 LIR_Address(LIR_Opr base, intx disp, BasicType type):
531 _base(base)
532 , _index(LIR_OprDesc::illegalOpr())
533 , _scale(times_1)
534 , _type(type)
535 , _disp(disp) { verify(); }
536
537 LIR_Address(LIR_Opr base, BasicType type):
538 _base(base)
539 , _index(LIR_OprDesc::illegalOpr())
540 , _scale(times_1)
541 , _type(type)
542 , _disp(0) { verify(); }
543
544 #if defined(X86) || defined(ARM)
545 LIR_Address(LIR_Opr base, LIR_Opr index, Scale scale, intx disp, BasicType type):
546 _base(base)
547 , _index(index)
548 , _scale(scale)
549 , _type(type)
550 , _disp(disp) { verify(); }
551 #endif // X86 || ARM
552
553 LIR_Opr base() const { return _base; }
554 LIR_Opr index() const { return _index; }
555 Scale scale() const { return _scale; }
556 intx disp() const { return _disp; }
557
558 bool equals(LIR_Address* other) const { return base() == other->base() && index() == other->index() && disp() == other->disp() && scale() == other->scale(); }
559
560 virtual LIR_Address* as_address() { return this; }
561 virtual BasicType type() const { return _type; }
562 virtual void print_value_on(outputStream* out) const PRODUCT_RETURN;
563
564 void verify() const PRODUCT_RETURN;
605 LIR_OprDesc::cpu_register |
606 LIR_OprDesc::double_size);
607 }
608
609 static LIR_Opr single_fpu(int reg) { return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) |
610 LIR_OprDesc::float_type |
611 LIR_OprDesc::fpu_register |
612 LIR_OprDesc::single_size); }
613 #if defined(ARM)
614 static LIR_Opr double_fpu(int reg1, int reg2) { return (LIR_Opr)((reg1 << LIR_OprDesc::reg1_shift) | (reg2 << LIR_OprDesc::reg2_shift) | LIR_OprDesc::double_type | LIR_OprDesc::fpu_register | LIR_OprDesc::double_size); }
615 static LIR_Opr single_softfp(int reg) { return (LIR_Opr)((reg << LIR_OprDesc::reg1_shift) | LIR_OprDesc::float_type | LIR_OprDesc::cpu_register | LIR_OprDesc::single_size); }
616 static LIR_Opr double_softfp(int reg1, int reg2) { return (LIR_Opr)((reg1 << LIR_OprDesc::reg1_shift) | (reg2 << LIR_OprDesc::reg2_shift) | LIR_OprDesc::double_type | LIR_OprDesc::cpu_register | LIR_OprDesc::double_size); }
617 #endif
618 #ifdef SPARC
619 static LIR_Opr double_fpu(int reg1, int reg2) { return (LIR_Opr)(intptr_t)((reg1 << LIR_OprDesc::reg1_shift) |
620 (reg2 << LIR_OprDesc::reg2_shift) |
621 LIR_OprDesc::double_type |
622 LIR_OprDesc::fpu_register |
623 LIR_OprDesc::double_size); }
624 #endif
625 #ifdef X86
626 static LIR_Opr double_fpu(int reg) { return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) |
627 (reg << LIR_OprDesc::reg2_shift) |
628 LIR_OprDesc::double_type |
629 LIR_OprDesc::fpu_register |
630 LIR_OprDesc::double_size); }
631
632 static LIR_Opr single_xmm(int reg) { return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) |
633 LIR_OprDesc::float_type |
634 LIR_OprDesc::fpu_register |
635 LIR_OprDesc::single_size |
636 LIR_OprDesc::is_xmm_mask); }
637 static LIR_Opr double_xmm(int reg) { return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) |
638 (reg << LIR_OprDesc::reg2_shift) |
639 LIR_OprDesc::double_type |
640 LIR_OprDesc::fpu_register |
641 LIR_OprDesc::double_size |
642 LIR_OprDesc::is_xmm_mask); }
643 #endif // X86
644 #ifdef PPC
645 static LIR_Opr double_fpu(int reg) { return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) |
|
433
434 Register as_register() const;
435 Register as_register_lo() const;
436 Register as_register_hi() const;
437
438 Register as_pointer_register() {
439 #ifdef _LP64
440 if (is_double_cpu()) {
441 assert(as_register_lo() == as_register_hi(), "should be a single register");
442 return as_register_lo();
443 }
444 #endif
445 return as_register();
446 }
447
448 #ifdef X86
449 XMMRegister as_xmm_float_reg() const;
450 XMMRegister as_xmm_double_reg() const;
451 // for compatibility with RInfo
452 int fpu () const { return lo_reg_half(); }
453 #endif
454 #if defined(SPARC) || defined(ARM) || defined(PPC) || defined(AARCH64)
455 FloatRegister as_float_reg () const;
456 FloatRegister as_double_reg () const;
457 #endif
458
459 jint as_jint() const { return as_constant_ptr()->as_jint(); }
460 jlong as_jlong() const { return as_constant_ptr()->as_jlong(); }
461 jfloat as_jfloat() const { return as_constant_ptr()->as_jfloat(); }
462 jdouble as_jdouble() const { return as_constant_ptr()->as_jdouble(); }
463 jobject as_jobject() const { return as_constant_ptr()->as_jobject(); }
464
465 void print() const PRODUCT_RETURN;
466 void print(outputStream* out) const PRODUCT_RETURN;
467 };
468
469
470 inline LIR_OprDesc::OprType as_OprType(BasicType type) {
471 switch (type) {
472 case T_INT: return LIR_OprDesc::int_type;
473 case T_LONG: return LIR_OprDesc::long_type;
474 case T_FLOAT: return LIR_OprDesc::float_type;
524 _base(base)
525 , _index(index)
526 , _scale(times_1)
527 , _type(type)
528 , _disp(0) { verify(); }
529
530 LIR_Address(LIR_Opr base, intx disp, BasicType type):
531 _base(base)
532 , _index(LIR_OprDesc::illegalOpr())
533 , _scale(times_1)
534 , _type(type)
535 , _disp(disp) { verify(); }
536
537 LIR_Address(LIR_Opr base, BasicType type):
538 _base(base)
539 , _index(LIR_OprDesc::illegalOpr())
540 , _scale(times_1)
541 , _type(type)
542 , _disp(0) { verify(); }
543
544 #if defined(X86) || defined(ARM) || defined(AARCH64)
545 LIR_Address(LIR_Opr base, LIR_Opr index, Scale scale, intx disp, BasicType type):
546 _base(base)
547 , _index(index)
548 , _scale(scale)
549 , _type(type)
550 , _disp(disp) { verify(); }
551 #endif // X86 || ARM
552
553 LIR_Opr base() const { return _base; }
554 LIR_Opr index() const { return _index; }
555 Scale scale() const { return _scale; }
556 intx disp() const { return _disp; }
557
558 bool equals(LIR_Address* other) const { return base() == other->base() && index() == other->index() && disp() == other->disp() && scale() == other->scale(); }
559
560 virtual LIR_Address* as_address() { return this; }
561 virtual BasicType type() const { return _type; }
562 virtual void print_value_on(outputStream* out) const PRODUCT_RETURN;
563
564 void verify() const PRODUCT_RETURN;
605 LIR_OprDesc::cpu_register |
606 LIR_OprDesc::double_size);
607 }
608
609 static LIR_Opr single_fpu(int reg) { return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) |
610 LIR_OprDesc::float_type |
611 LIR_OprDesc::fpu_register |
612 LIR_OprDesc::single_size); }
613 #if defined(ARM)
614 static LIR_Opr double_fpu(int reg1, int reg2) { return (LIR_Opr)((reg1 << LIR_OprDesc::reg1_shift) | (reg2 << LIR_OprDesc::reg2_shift) | LIR_OprDesc::double_type | LIR_OprDesc::fpu_register | LIR_OprDesc::double_size); }
615 static LIR_Opr single_softfp(int reg) { return (LIR_Opr)((reg << LIR_OprDesc::reg1_shift) | LIR_OprDesc::float_type | LIR_OprDesc::cpu_register | LIR_OprDesc::single_size); }
616 static LIR_Opr double_softfp(int reg1, int reg2) { return (LIR_Opr)((reg1 << LIR_OprDesc::reg1_shift) | (reg2 << LIR_OprDesc::reg2_shift) | LIR_OprDesc::double_type | LIR_OprDesc::cpu_register | LIR_OprDesc::double_size); }
617 #endif
618 #ifdef SPARC
619 static LIR_Opr double_fpu(int reg1, int reg2) { return (LIR_Opr)(intptr_t)((reg1 << LIR_OprDesc::reg1_shift) |
620 (reg2 << LIR_OprDesc::reg2_shift) |
621 LIR_OprDesc::double_type |
622 LIR_OprDesc::fpu_register |
623 LIR_OprDesc::double_size); }
624 #endif
625 #if defined(X86) || defined(AARCH64)
626 static LIR_Opr double_fpu(int reg) { return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) |
627 (reg << LIR_OprDesc::reg2_shift) |
628 LIR_OprDesc::double_type |
629 LIR_OprDesc::fpu_register |
630 LIR_OprDesc::double_size); }
631
632 static LIR_Opr single_xmm(int reg) { return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) |
633 LIR_OprDesc::float_type |
634 LIR_OprDesc::fpu_register |
635 LIR_OprDesc::single_size |
636 LIR_OprDesc::is_xmm_mask); }
637 static LIR_Opr double_xmm(int reg) { return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) |
638 (reg << LIR_OprDesc::reg2_shift) |
639 LIR_OprDesc::double_type |
640 LIR_OprDesc::fpu_register |
641 LIR_OprDesc::double_size |
642 LIR_OprDesc::is_xmm_mask); }
643 #endif // X86
644 #ifdef PPC
645 static LIR_Opr double_fpu(int reg) { return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) |
|