Example #1
0
void Value::set_registers(Assembler::Register low, Assembler::Register high) {
  destroy();
  GUARANTEE(use_two_registers(), "tag_check");
  set_where(T_REGISTER);
  _low  = (int) low;
  _high = (int) high;
}
Example #2
0
void Value::destroy() {
  if (in_register()) {
    RegisterAllocator::dereference(lo_register());
    if (use_two_registers()) {
      RegisterAllocator::dereference(hi_register());
    }
  }
  set_where(T_NOWHERE);
}
Example #3
0
void Value::copy(Value& result) {
  GUARANTEE(in_register(), "value must be in register");
  if (use_two_registers()) {
    result.set_registers(lo_register(), hi_register());
    RegisterAllocator::reference(lo_register());
    RegisterAllocator::reference(hi_register());
    //cse
    RegisterAllocator::wipe_notation_of(lo_register());
    RegisterAllocator::wipe_notation_of(hi_register());
  } else {
    result.set_register(lo_register());
    RegisterAllocator::reference(lo_register());
    //cse
    RegisterAllocator::wipe_notation_of(lo_register());
  }
}
Example #4
0
void Value::writable_copy(Value& result) {
  GUARANTEE(in_register(), "value must be in register");
  VirtualStackFrame* frame = Compiler::current()->frame();

  if (use_two_registers()) {
    if ((RegisterAllocator::references(lo_register()) == 1) &&
        (RegisterAllocator::references(hi_register()) == 1)) {
      // use this value as the writable copy.
      RegisterAllocator::spill(hi_register());
      RegisterAllocator::spill(lo_register());
      frame->dirtify(hi_register());
      frame->dirtify(lo_register());
      result.set_registers(lo_register(), hi_register());
      // make sure we increment the reference counters
      RegisterAllocator::reference(lo_register());
      RegisterAllocator::reference(hi_register());
    } else {
      // allocate two new registers and copy the value of these registers into it.
      result.set_registers(RegisterAllocator::allocate(), RegisterAllocator::allocate());
      Compiler::code_generator()->move(result, *this);
    }
  } else {
   if (RegisterAllocator::references(lo_register()) == 1) {
      // use this value as the writable copy.
      RegisterAllocator::spill(lo_register());
      frame->dirtify(lo_register());
      result.set_register(lo_register());
      // make sure we increment the reference counter
      RegisterAllocator::reference(lo_register());
    } else {
      // allocate a new register and copy the value of this register into it.
      result.assign_register();
      Compiler::code_generator()->move(result, *this);
    }
  }
}
Example #5
0
 Assembler::Register hi_register( void ) const {
   GUARANTEE(use_two_registers(), "must be a two-register value");
   return (Assembler::Register)_high;
 }