68 inline void LinearScan::pd_add_temps(LIR_Op* op) { 69 switch (op->code()) { 70 case lir_tan: 71 case lir_sin: 72 case lir_cos: { 73 // The slow path for these functions may need to save and 74 // restore all live registers but we don't want to save and 75 // restore everything all the time, so mark the xmms as being 76 // killed. If the slow path were explicit or we could propagate 77 // live register masks down to the assembly we could do better 78 // but we don't have any easy way to do that right now. We 79 // could also consider not killing all xmm registers if we 80 // assume that slow paths are uncommon but it's not clear that 81 // would be a good idea. 82 if (UseSSE > 0) { 83 #ifndef PRODUCT 84 if (TraceLinearScanLevel >= 2) { 85 tty->print_cr("killing XMMs for trig"); 86 } 87 #endif 88 int op_id = op->id(); 89 for (int xmm = 0; xmm < FrameMap::nof_caller_save_xmm_regs; xmm++) { 90 LIR_Opr opr = FrameMap::caller_save_xmm_reg_at(xmm); 91 add_temp(reg_num(opr), op_id, noUse, T_ILLEGAL); 92 } 93 } 94 break; 95 } 96 } 97 } 98 99 100 // Implementation of LinearScanWalker 101 102 inline bool LinearScanWalker::pd_init_regs_for_alloc(Interval* cur) { 103 if (allocator()->gen()->is_vreg_flag_set(cur->reg_num(), LIRGenerator::byte_reg)) { 104 assert(cur->type() != T_FLOAT && cur->type() != T_DOUBLE, "cpu regs only"); 105 _first_reg = pd_first_byte_reg; 106 _last_reg = FrameMap::last_byte_reg(); 107 return true; 108 } else if ((UseSSE >= 1 && cur->type() == T_FLOAT) || (UseSSE >= 2 && cur->type() == T_DOUBLE)) { 109 _first_reg = pd_first_xmm_reg; 110 _last_reg = pd_last_xmm_reg; 111 return true; 112 } 113 114 return false; 115 } 116 117 118 class FpuStackAllocator VALUE_OBJ_CLASS_SPEC { 119 private: 120 Compilation* _compilation; 121 LinearScan* _allocator; 122 123 LIR_OpVisitState visitor; 124 125 LIR_List* _lir; 126 int _pos; 127 FpuStackSim _sim; 128 FpuStackSim _temp_sim; 129 130 bool _debug_information_computed; | 68 inline void LinearScan::pd_add_temps(LIR_Op* op) { 69 switch (op->code()) { 70 case lir_tan: 71 case lir_sin: 72 case lir_cos: { 73 // The slow path for these functions may need to save and 74 // restore all live registers but we don't want to save and 75 // restore everything all the time, so mark the xmms as being 76 // killed. If the slow path were explicit or we could propagate 77 // live register masks down to the assembly we could do better 78 // but we don't have any easy way to do that right now. We 79 // could also consider not killing all xmm registers if we 80 // assume that slow paths are uncommon but it's not clear that 81 // would be a good idea. 82 if (UseSSE > 0) { 83 #ifndef PRODUCT 84 if (TraceLinearScanLevel >= 2) { 85 tty->print_cr("killing XMMs for trig"); 86 } 87 #endif 88 int num_caller_save_xmm_regs = FrameMap::get_num_caller_save_xmms(); 89 int op_id = op->id(); 90 for (int xmm = 0; xmm < num_caller_save_xmm_regs; xmm++) { 91 LIR_Opr opr = FrameMap::caller_save_xmm_reg_at(xmm); 92 add_temp(reg_num(opr), op_id, noUse, T_ILLEGAL); 93 } 94 } 95 break; 96 } 97 } 98 } 99 100 101 // Implementation of LinearScanWalker 102 103 inline bool LinearScanWalker::pd_init_regs_for_alloc(Interval* cur) { 104 int last_xmm_reg = pd_last_xmm_reg; 105 if (UseAVX < 3) { 106 last_xmm_reg = pd_first_xmm_reg + (pd_nof_xmm_regs_frame_map / 2) - 1; 107 } 108 if (allocator()->gen()->is_vreg_flag_set(cur->reg_num(), LIRGenerator::byte_reg)) { 109 assert(cur->type() != T_FLOAT && cur->type() != T_DOUBLE, "cpu regs only"); 110 _first_reg = pd_first_byte_reg; 111 _last_reg = FrameMap::last_byte_reg(); 112 return true; 113 } else if ((UseSSE >= 1 && cur->type() == T_FLOAT) || (UseSSE >= 2 && cur->type() == T_DOUBLE)) { 114 _first_reg = pd_first_xmm_reg; 115 _last_reg = last_xmm_reg; 116 return true; 117 } 118 119 return false; 120 } 121 122 123 class FpuStackAllocator VALUE_OBJ_CLASS_SPEC { 124 private: 125 Compilation* _compilation; 126 LinearScan* _allocator; 127 128 LIR_OpVisitState visitor; 129 130 LIR_List* _lir; 131 int _pos; 132 FpuStackSim _sim; 133 FpuStackSim _temp_sim; 134 135 bool _debug_information_computed; |