Lines Matching refs:to

16  * 2 along with this work; if not, write to the Free Software Foundation,
76 // Map BasicType to spill size in 32-bit words, matching VMReg's notion of words
118 // ********** functions for converting LIR-Operands to register numbers
255 // oop location. So a stack slot bigger than 2^11 leads to an overflow
299 // assign a new reg_num to the interval and append it to the list of intervals
308 void LinearScan::copy_register_flags(Interval* from, Interval* to) {
310 gen()->set_vreg_flag(to->reg_num(), LIRGenerator::byte_reg);
313 gen()->set_vreg_flag(to->reg_num(), LIRGenerator::callee_saved);
322 // eliminate moves from register to stack if stack slot is known to be correct
347 // nothing to do
364 // at the definition of the interval -> move write to memory out of loop
369 // reason to store the interval at the definition
376 // the interval is spilled more then once, so it is better to store it to
386 // nothing to do
424 TRACE_LINEAR_SCAN(4, tty->print_cr("interval %d (from %d to %d) must be stored at %d", temp->reg_num(), temp->from(), temp->to(), temp->spill_definition_pos()));
444 // remove move from register to stack if the stack slot is guaranteed to be correct.
448 assert(op->as_Op1()->result_opr()->is_virtual(), "LinearScan inserts only moves to virtual registers");
455 TRACE_LINEAR_SCAN(4, tty->print_cr("eliminating move from interval %d to %d", op1->in_opr()->vreg_number(), op1->result_opr()->vreg_number()));
460 // insert move from register to stack just after the beginning of the interval
474 assert(to_opr->is_stack(), "to operand must be a stack slot");
477 TRACE_LINEAR_SCAN(4, tty->print_cr("inserting move after definition of interval %d to stack slot %d at op_id %d", interval->reg_num(), interval->canonical_spill_slot() - LinearScan::nof_regs, op_id));
498 // dummy-timer to measure the cost of the timer itself
499 // (this time is then subtracted from all other timers to get the real value)
504 // Assign IDs to LIR nodes and build a mapping, lir_ops, from ID to LIR_Op node.
604 // visit operation to collect all operands
638 // this is checked by these assertions to be sure about it.
748 // ********** Phase 3: perform a backward dataflow analysis to compute global live sets
760 // Perform a backward dataflow analysis to compute live_out and live_in for each block.
791 // A change occurred. Swap the old and new live out sets to avoid copying.
803 // note: live_in has to be computed only in first iteration or if live_out has changed!
851 // print some additional information to simplify debugging
881 void LinearScan::add_use(Value value, int from, int to, IntervalUseKind use_kind) {
888 add_use(opr, from, to, use_kind);
913 void LinearScan::add_use(LIR_Opr opr, int from, int to, IntervalUseKind use_kind) {
914 TRACE_LINEAR_SCAN(2, tty->print(" use "); opr->print(tty); tty->print_cr(" from %d to %d (%d)", from, to, use_kind));
919 add_use(opr->vreg_number(), from, to, use_kind, opr->type_register());
924 add_use(reg, from, to, use_kind, opr->type_register());
928 add_use(reg, from, to, use_kind, opr->type_register());
994 // TODO: move this directly to position where use-kind is computed
999 void LinearScan::add_use(int reg_num, int from, int to, IntervalUseKind use_kind, BasicType type) {
1010 interval->add_range(from, to);
1011 interval->add_use_pos(to, use_kind);
1032 // it is not reloaded to a register.
1046 // method argument (condition must be equal to handle_method_arguments)
1050 // Move from register to register
1053 // input operand must have a register instead of output operand (leads to better register allocation)
1077 // Move to an interval with must_start_in_memory set.
1078 // To avoid moves from stack to stack (not allowed) force the input operand to a register
1082 // Move from register to register
1085 // input operand must have a register instead of output operand (leads to better register allocation)
1089 // The input operand is not forced to a register (moves from stack to register are allowed),
1104 // this operand is allowed to be on the stack in some cases
1169 // special handling for method arguments (moves from stack to virtual register):
1193 TRACE_LINEAR_SCAN(4, tty->print_cr("found move from stack slot %d to vreg %d", o->is_single_stack() ? o->single_stack_ix() : o->double_stack_ix(), reg_num(move->result_opr())));
1206 // special handling for doubleword move from memory to register:
1239 Interval* to = interval_at(reg_num(move_to));
1240 if (from != NULL && to != NULL) {
1241 to->set_register_hint(from);
1242 TRACE_LINEAR_SCAN(4, tty->print_cr("operation at op_id %d: added hint from interval %d to %d", move->id(), from->reg_num(), to->reg_num()));
1256 Interval* to = interval_at(reg_num(move_to));
1257 if (from != NULL && to != NULL) {
1258 to->set_register_hint(from);
1259 TRACE_LINEAR_SCAN(4, tty->print_cr("operation at op_id %d: added hint from interval %d to %d", cmove->id(), from->reg_num(), to->reg_num()));
1272 // (32 is added to have some space for split children without having to resize the list)
1336 TRACE_LINEAR_SCAN(2, tty->print_cr("live in %d to %d", number, block_to + 2));
1359 // visit operation to collect all operands
1400 // to a call site, the value would be in a register at the call otherwise)
1419 // add the range [0, 1[ to all fixed intervals
1595 // no intervals have been added during allocation, so sorted list is already up to date
1712 // need to insert move instruction
1833 // the interval is split to get a short range that is located on the stack
1841 // range that will be spilled to memory
1844 assert(interval->from() <= from_op_id && interval->to() >= to_op_id,
1858 if (interval->to() != to_op_id) {
1866 assert(spilled_part->from() == from_op_id && spilled_part->to() == to_op_id, "just checking");
1899 // the computation of to_interval is equal to resolve_collect_mappings,
1917 // unpinned constants may have no register, so add mapping from constant to interval
1930 // optimization to reduce number of moves: when to_interval is on stack and
1931 // the stack slot is known to be always correct, then no move is necessary
1995 // visit operation to collect all operands
2016 // ********** Phase 7: assign register numbers back to LIR
2090 "register numbers must be sorted (ensure that e.g. a move from eax,ebx to ebx,eax can not occur)");
2200 if (opr->is_last_use() || op_id == interval->to() || (op_id != -1 && interval->has_hole_between(op_id, op_id + 1))) {
2214 // some methods used to check correctness of debug information
2355 // intervals that have no oops inside need not to be processed
2356 // to ensure a walking until the last instruction id, add a dummy interval
2409 // Spill optimization: when the stack value is guaranteed to be always correct,
2410 // then it must be added to the oop map even if the interval is currently in a register
2631 // to two different addresses once saved.
2683 // lo/hi and swapped relative to first and second, so swap them
2769 // were to grow upwards, the embedded doubles would be word-swapped.)
2817 // Append to ScopeValue array
2839 // process recursively to compute outermost scope first
2843 // initialize these to null.
2937 // visit instruction to get list of operands
3224 if (r->from() >= r->to()) {
3236 if (i1->from() == 1 && i1->to() == 2) continue;
3237 if (i2->from() == 1 && i2->to() == 2) continue;
3261 // to ensure a walking until the last instruction id, add a dummy interval
3289 // exception stub will never return to normal control flow.
3343 if (interval->to() >= op_id + 1) {
3344 assert(interval->to() < op_id + 2 ||
3393 // simplified access to methods of LinearScan
3715 assert(_mapping_to.at(i) != _mapping_to.at(j), "cannot write to same interval twice");
3740 assert(!used_regs.at(it->assigned_reg()), "cannot write to same register twice");
3744 assert(!used_regs.at(it->assigned_regHi()), "cannot write to same register twice");
3758 assert(!used_regs.at(it->assigned_reg()) || it->assigned_reg() == _mapping_from.at(i)->assigned_reg(), "stack slots used in _mapping_from must be disjoint to _mapping_to");
3793 // check if assigned_reg and assigned_regHi of the to-interval are not blocked (or only blocked by from)
3794 bool MoveResolver::save_to_process_move(Interval* from, Interval* to) {
3802 int reg = to->assigned_reg();
3808 reg = to->assigned_regHi();
3835 assert(from_interval->reg_num() != to_interval->reg_num(), "from and to interval equal");
3845 // input interval is used in more than one move, then it is too difficult to determine
3851 TRACE_LINEAR_SCAN(4, tty->print_cr("MoveResolver: inserted move from register %d (%d, %d) to %d (%d, %d)", from_interval->reg_num(), from_interval->assigned_reg(), from_interval->assigned_regHi(), to_interval->reg_num(), to_interval->assigned_reg(), to_interval->assigned_regHi()));
3862 TRACE_LINEAR_SCAN(4, tty->print("MoveResolver: inserted move from constant "); from_opr->print(); tty->print_cr(" to %d (%d, %d)", to_interval->reg_num(), to_interval->assigned_reg(), to_interval->assigned_regHi()));
3871 // When a register is blocked, no move to this register is emitted.
3911 // (e.g. r1 -> r2, r2 -> r1), so one interval must be spilled to memory
3914 // create a new spill interval and assign a stack slot to it
3919 // add a dummy range because real position is difficult to calculate
3924 // use spill slot assigned to from_interval. Otherwise moves from
3925 // one stack slot to another can happen (not allowed by LIR_Assembler
3936 // insert a move from register to stack and update the mapping
3943 // reset to default value
3952 TRACE_LINEAR_SCAN(4, tty->print_cr("MoveResolver: setting insert position to Block B%d, index %d", insert_list->block() != NULL ? insert_list->block()->block_id() : -1, insert_idx));
3961 TRACE_LINEAR_SCAN(4, tty->print_cr("MoveResolver: moving insert position to Block B%d, index %d", insert_list->block() != NULL ? insert_list->block()->block_id() : -1, insert_idx));
3970 // bound to a specific block and create a new insertion_buffer
3980 TRACE_LINEAR_SCAN(4, tty->print_cr("MoveResolver: adding mapping from %d (%d, %d) to %d (%d, %d)", from_interval->reg_num(), from_interval->assigned_reg(), from_interval->assigned_regHi(), to_interval->reg_num(), to_interval->assigned_reg(), to_interval->assigned_regHi()));
3989 TRACE_LINEAR_SCAN(4, tty->print("MoveResolver: adding mapping from "); from_opr->print(); tty->print_cr(" to %d (%d, %d)", to_interval->reg_num(), to_interval->assigned_reg(), to_interval->assigned_regHi()));
4008 Range::Range(int from, int to, Range* next) :
4010 _to(to),
4029 if (r1->to() <= r2->from()) {
4035 if (r2->to() <= r1->from()) {
4041 if (r1->from() == r1->to()) {
4043 } else if (r2->from() == r2->to()) {
4100 return r->to();
4123 assert(i1->to() <= i2->from() && i1->to() < i2->to(), "intervals overlapping");
4126 assert(i2->to() <= i1->from() && i2->to() < i1->to(), "intervals overlapping");
4174 // in outputMode, the end of the interval (op_id == cur->to()) is not valid
4180 if (cur->from() <= op_id && op_id < cur->to() + to_offset) {
4182 // exchange current split child to start of list (faster access for next call)
4196 if (tmp != result && tmp->from() <= op_id && op_id < tmp->to() + to_offset) {
4225 if (cur->to() <= op_id && (result == NULL || result->to() < cur->to())) {
4337 void Interval::add_range(int from, int to) {
4338 assert(from < to, "invalid range");
4339 assert(first() == Range::end() || to < first()->next()->from(), "not inserting at begin of interval");
4340 assert(from <= first()->to(), "not inserting at begin of interval");
4342 if (first()->from() <= to) {
4345 first()->set_to (MAX2(to, first()->to()));
4348 _first = new Range(from, to, first());
4380 // All split children are spilled to the same stack slot (stored in _canonical_spill_slot)
4392 while (cur != Range::end() && cur->to() <= split_pos) {
4399 result->_first = new Range(split_pos, cur->to(), cur->next());
4453 assert(split_pos > from() && split_pos < to(), "can only split inside interval");
4454 assert(split_pos > _first->from() && split_pos <= _first->to(), "can only split inside first range");
4464 if (split_pos == _first->to()) {
4479 while (cur != Range::end() && cur->to() < op_id) {
4483 assert(cur->to() != cur->next()->from(), "ranges not separated");
4486 return cur->from() <= op_id && op_id < cur->to();
4488 return cur->from() <= op_id && op_id <= cur->to();
4498 assert(from() <= hole_from && hole_to <= to(), "index out of interval");
4502 assert(cur->to() < cur->next()->from(), "no space between ranges");
4509 } else if (hole_to <= cur->to()) {
4513 } else if (hole_from <= cur->to()) {
4685 // also handle move from inactive list to active list
4692 // move to handled state (not maintained as a list)
4757 // set _current_position prior to call of walk_to
4778 void IntervalWalker::interval_moved(Interval* interval, IntervalKind kind, IntervalState from, IntervalState to) {
4790 print_state(from); tty->print(" to "); print_state(to);
4838 assert(use_pos != 0, "must use exclude_from_use to set use_pos to 0");
4896 if (cur->to() <= list->current_from()) {
4918 if (kind == fixedKind && cur->to() <= list->from()) {
4944 if (cur->to() > list->current_from()) {
4957 set_use_pos(list, MIN2(list->next_usage(loopEndMarker, _current_position), list->to()), false);
4966 set_use_pos(list, MIN2(list->next_usage(loopEndMarker, _current_position), list->to()), false);
5011 // Try to split at end of max_block. If this would be after
5028 assert(optimal_split_pos > allocator()->max_lir_op_id() || allocator()->is_block_begin(optimal_split_pos), "algorithm must move split pos to block boundary");
5058 // split position cannot be moved to block boundary, so split as late as possible
5059 TRACE_LINEAR_SCAN(4, tty->print_cr(" cannot move split pos to block boundary because min_pos and max_pos are in same block"));
5072 TRACE_LINEAR_SCAN(4, tty->print_cr(" moving split pos to optimal block boundary between block B%d and B%d", min_block->block_id(), max_block->block_id()));
5084 // the max-position to this loop block.
5089 TRACE_LINEAR_SCAN(4, tty->print_cr(" interval is used in loop that ends in block B%d, so trying to move max_block back from B%d to B%d", loop_block->block_id(), max_block->block_id(), loop_block->block_id()));
5118 2) the right part is sorted into to the unhandled-list
5127 assert(max_split_pos <= it->to(), "cannot split after end of interval");
5132 assert(optimal_split_pos <= it->to(), "cannot split after end of interval");
5135 if (optimal_split_pos == it->to() && it->next_usage(mustHaveRegister, min_split_pos) == max_jint) {
5142 // must calculate this before the actual split is performed and before split position is moved to odd op_id
5183 assert(max_split_pos < it->to(), "cannot split at end end of interval");
5184 assert(current_position() < it->to(), "interval must not end before current position");
5187 // the whole interval is never used, so spill it entirely to memory
5194 // Also kick parent intervals out of register to memory when they have no use
5196 // memory -> avoid useless moves from memory to register and back
5218 assert(optimal_split_pos < it->to(), "cannot split at end of interval");
5236 TRACE_LINEAR_SCAN(4, tty->print_cr(" inserting move from interval %d to %d", it->reg_num(), spilled_part->reg_num()));
5253 int max_split_pos = MIN2(it->first_usage(shouldHaveRegister), it->to());
5271 // when the split part is activated, the interval has a new chance to get a register,
5279 // The new created part is added to the unhandled list and will get a register
5282 int max_split_pos = MIN2(it->next_usage(mustHaveRegister, min_split_pos), it->to());
5286 assert(it->next_usage(mustHaveRegister, current_pos) == max_jint, "the remaining part is spilled to stack and therefore has no register");
5355 TRACE_LINEAR_SCAN(2, tty->print("trying to find free register for "); cur->print());
5388 assert(cur->assigned_reg() == any_reg && cur->assigned_regHi() == any_reg, "register already assigned to interval");
5392 int interval_to = cur->to();
5426 // sort register numbers to prevent e.g. a move from eax,ebx to ebx,eax
5513 // Split an Interval and spill it to memory so that cur can be placed in a register
5515 TRACE_LINEAR_SCAN(2, tty->print("need to split and spill to get register for "); cur->print());
5541 int interval_to = cur->to();
5578 // sort register numbers to prevent e.g. a move from eax,ebx to ebx,eax
5589 TRACE_LINEAR_SCAN(4, tty->print_cr("able to spill current interval. first_usage(register): %d, use_pos: %d", cur->first_usage(mustHaveRegister), use_pos));
5593 // assign a reasonable register and do a bailout in product mode to avoid errors
5600 TRACE_LINEAR_SCAN(4, tty->print_cr("decided to use register %d, %d", reg, regHi));
5660 bool LinearScanWalker::is_move(LIR_Op* op, Interval* from, Interval* to) {
5668 return in->is_virtual() && res->is_virtual() && in->vreg_number() == from->reg_num() && res->vreg_number() == to->reg_num();
5672 // assign same spill slot to non-intersecting intervals
5693 int end_pos = cur->to();
5706 if (begin_hint == end_hint || begin_hint->to() != begin_pos || end_hint->from() != end_pos) {
5717 // register_hint is not spilled at begin_pos, so it would not be benefitial to immediately spill cur
5723 // delete use positions to prevent the intervals to get a register at beginning
5730 // allocate a physical register or memory location to an interval
5748 // used for lir_roundfp: rounding is done by store to stack and reload later
5761 // assign same spill slot to non-intersecting intervals
5771 // spilled intervals need not be move to active-list
5777 // load spilled values that become active from stack slot to register
5782 TRACE_LINEAR_SCAN(4, tty->print_cr("Inserting move from interval %d to %d because insert_move_when_activated is set", cur->current_split_child()->reg_num(), cur->reg_num()));
5788 return result; // true = interval is moved to active list
5823 // append a lir-instruction-list and the index of the current operation in to the list
6047 // push the OSR entry block to the end so that we're not jumping over it.
6074 // short loop from header_idx to end_idx found -> reorder blocks such that
6106 // must always end with an unconditional branch to this successor
6130 TRACE_LINEAR_SCAN(3, tty->print_cr("Deleting empty block: substituting from B%d to B%d inside B%d", target_from->block_id(), target_to->block_id(), block->block_id()));
6243 // eliminate a conditional branch to the immediate successor
6272 // if a predecessor ends with an unconditional jump to this block, then the jump
6276 // because the predecessors might have other (conditional) jumps to this block
6277 // -> this may lead to unnecesary return instructions in the final code
6297 // replace the jump to a return with a direct return
6374 case counter_stub_branch: return "branches to stub";
6423 // add the method-local numbers to the total sum
6673 // reset all timers to measure only current method
6713 // is necesary to start and stop itself