Mercurial > hg > graal-compiler
comparison src/cpu/sparc/vm/sparc.ad @ 2076:7737fa7ec2b5
7006044: materialize cheap non-oop pointers on 64-bit SPARC
Summary: After 6961690 we load non-oop pointers for the constant table which could easily be materialized in a few instructions.
Reviewed-by: never, kvn
author | twisti |
---|---|
date | Tue, 14 Dec 2010 12:44:30 -0800 |
parents | 5fe0781a8560 |
children | c04052fd6ae1 |
comparison
equal
deleted
inserted
replaced
2016:361783318e7e | 2076:7737fa7ec2b5 |
---|---|
1084 } | 1084 } |
1085 | 1085 |
1086 uint MachConstantBaseNode::size(PhaseRegAlloc*) const { | 1086 uint MachConstantBaseNode::size(PhaseRegAlloc*) const { |
1087 if (UseRDPCForConstantTableBase) { | 1087 if (UseRDPCForConstantTableBase) { |
1088 // This is really the worst case but generally it's only 1 instruction. | 1088 // This is really the worst case but generally it's only 1 instruction. |
1089 return 4 /*rdpc*/ + 4 /*sub*/ + MacroAssembler::worst_case_size_of_set(); | 1089 return (1 /*rdpc*/ + 1 /*sub*/ + MacroAssembler::worst_case_insts_for_set()) * BytesPerInstWord; |
1090 } else { | 1090 } else { |
1091 return MacroAssembler::worst_case_size_of_set(); | 1091 return MacroAssembler::worst_case_insts_for_set() * BytesPerInstWord; |
1092 } | 1092 } |
1093 } | 1093 } |
1094 | 1094 |
1095 #ifndef PRODUCT | 1095 #ifndef PRODUCT |
1096 void MachConstantBaseNode::format(PhaseRegAlloc* ra_, outputStream* st) const { | 1096 void MachConstantBaseNode::format(PhaseRegAlloc* ra_, outputStream* st) const { |
1238 return MachNode::pipeline_class(); | 1238 return MachNode::pipeline_class(); |
1239 } | 1239 } |
1240 | 1240 |
1241 int MachEpilogNode::safepoint_offset() const { | 1241 int MachEpilogNode::safepoint_offset() const { |
1242 assert( do_polling(), "no return for this epilog node"); | 1242 assert( do_polling(), "no return for this epilog node"); |
1243 return MacroAssembler::size_of_sethi(os::get_polling_page()); | 1243 return MacroAssembler::insts_for_sethi(os::get_polling_page()) * BytesPerInstWord; |
1244 } | 1244 } |
1245 | 1245 |
1246 //============================================================================= | 1246 //============================================================================= |
1247 | 1247 |
1248 // Figure out which register class each belongs in: rc_int, rc_float, rc_stack | 1248 // Figure out which register class each belongs in: rc_int, rc_float, rc_stack |
3551 // formats are generated automatically for constants and base registers | 3551 // formats are generated automatically for constants and base registers |
3552 format %{ %} | 3552 format %{ %} |
3553 interface(CONST_INTER); | 3553 interface(CONST_INTER); |
3554 %} | 3554 %} |
3555 | 3555 |
3556 // Pointer Immediate: 32 or 64-bit | 3556 #ifdef _LP64 |
3557 // Pointer Immediate: 64-bit | |
3557 operand immP_set() %{ | 3558 operand immP_set() %{ |
3558 predicate(!VM_Version::is_niagara1_plus()); | 3559 predicate(!VM_Version::is_niagara1_plus()); |
3559 match(ConP); | 3560 match(ConP); |
3560 | 3561 |
3561 op_cost(5); | 3562 op_cost(5); |
3562 // formats are generated automatically for constants and base registers | 3563 // formats are generated automatically for constants and base registers |
3563 format %{ %} | 3564 format %{ %} |
3564 interface(CONST_INTER); | 3565 interface(CONST_INTER); |
3565 %} | 3566 %} |
3566 | 3567 |
3567 // Pointer Immediate: 32 or 64-bit | 3568 // Pointer Immediate: 64-bit |
3568 // From Niagara2 processors on a load should be better than materializing. | 3569 // From Niagara2 processors on a load should be better than materializing. |
3569 operand immP_load() %{ | 3570 operand immP_load() %{ |
3570 predicate(VM_Version::is_niagara1_plus()); | 3571 predicate(VM_Version::is_niagara1_plus() && (n->bottom_type()->isa_oop_ptr() || (MacroAssembler::insts_for_set(n->get_ptr()) > 3))); |
3571 match(ConP); | 3572 match(ConP); |
3572 | 3573 |
3573 op_cost(5); | 3574 op_cost(5); |
3574 // formats are generated automatically for constants and base registers | 3575 // formats are generated automatically for constants and base registers |
3575 format %{ %} | 3576 format %{ %} |
3576 interface(CONST_INTER); | 3577 interface(CONST_INTER); |
3577 %} | 3578 %} |
3579 | |
3580 // Pointer Immediate: 64-bit | |
3581 operand immP_no_oop_cheap() %{ | |
3582 predicate(VM_Version::is_niagara1_plus() && !n->bottom_type()->isa_oop_ptr() && (MacroAssembler::insts_for_set(n->get_ptr()) <= 3)); | |
3583 match(ConP); | |
3584 | |
3585 op_cost(5); | |
3586 // formats are generated automatically for constants and base registers | |
3587 format %{ %} | |
3588 interface(CONST_INTER); | |
3589 %} | |
3590 #endif | |
3578 | 3591 |
3579 operand immP13() %{ | 3592 operand immP13() %{ |
3580 predicate((-4096 < n->get_ptr()) && (n->get_ptr() <= 4095)); | 3593 predicate((-4096 < n->get_ptr()) && (n->get_ptr() <= 4095)); |
3581 match(ConP); | 3594 match(ConP); |
3582 op_cost(0); | 3595 op_cost(0); |
3671 interface(CONST_INTER); | 3684 interface(CONST_INTER); |
3672 %} | 3685 %} |
3673 | 3686 |
3674 // Long Immediate: cheap (materialize in <= 3 instructions) | 3687 // Long Immediate: cheap (materialize in <= 3 instructions) |
3675 operand immL_cheap() %{ | 3688 operand immL_cheap() %{ |
3676 predicate(!VM_Version::is_niagara1_plus() || MacroAssembler::size_of_set64(n->get_long()) <= 3); | 3689 predicate(!VM_Version::is_niagara1_plus() || MacroAssembler::insts_for_set64(n->get_long()) <= 3); |
3677 match(ConL); | 3690 match(ConL); |
3678 op_cost(0); | 3691 op_cost(0); |
3679 | 3692 |
3680 format %{ %} | 3693 format %{ %} |
3681 interface(CONST_INTER); | 3694 interface(CONST_INTER); |
3682 %} | 3695 %} |
3683 | 3696 |
3684 // Long Immediate: expensive (materialize in > 3 instructions) | 3697 // Long Immediate: expensive (materialize in > 3 instructions) |
3685 operand immL_expensive() %{ | 3698 operand immL_expensive() %{ |
3686 predicate(VM_Version::is_niagara1_plus() && MacroAssembler::size_of_set64(n->get_long()) > 3); | 3699 predicate(VM_Version::is_niagara1_plus() && MacroAssembler::insts_for_set64(n->get_long()) > 3); |
3687 match(ConL); | 3700 match(ConL); |
3688 op_cost(0); | 3701 op_cost(0); |
3689 | 3702 |
3690 format %{ %} | 3703 format %{ %} |
3691 interface(CONST_INTER); | 3704 interface(CONST_INTER); |
6092 instruct loadConP_load(iRegP dst, immP_load con) %{ | 6105 instruct loadConP_load(iRegP dst, immP_load con) %{ |
6093 match(Set dst con); | 6106 match(Set dst con); |
6094 ins_cost(MEMORY_REF_COST); | 6107 ins_cost(MEMORY_REF_COST); |
6095 format %{ "LD [$constanttablebase + $constantoffset],$dst\t! load from constant table: ptr=$con" %} | 6108 format %{ "LD [$constanttablebase + $constantoffset],$dst\t! load from constant table: ptr=$con" %} |
6096 ins_encode %{ | 6109 ins_encode %{ |
6097 RegisterOrConstant con_offset = __ ensure_simm13_or_reg($constantoffset($con), $dst$$Register); | 6110 RegisterOrConstant con_offset = __ ensure_simm13_or_reg($constantoffset($con), $dst$$Register); |
6098 __ ld_ptr($constanttablebase, con_offset, $dst$$Register); | 6111 __ ld_ptr($constanttablebase, con_offset, $dst$$Register); |
6112 %} | |
6113 ins_pipe(loadConP); | |
6114 %} | |
6115 | |
6116 instruct loadConP_no_oop_cheap(iRegP dst, immP_no_oop_cheap con) %{ | |
6117 match(Set dst con); | |
6118 ins_cost(DEFAULT_COST * 3/2); | |
6119 format %{ "SET $con,$dst\t! non-oop ptr" %} | |
6120 ins_encode %{ | |
6121 __ set($con$$constant, $dst$$Register); | |
6099 %} | 6122 %} |
6100 ins_pipe(loadConP); | 6123 ins_pipe(loadConP); |
6101 %} | 6124 %} |
6102 #endif // _LP64 | 6125 #endif // _LP64 |
6103 | 6126 |