void printRegister(Location r) { if (is_StackLocation(r)) { lprintf("T%ld", long(index_for_StackLocation(r))); } else if (r >= ArgStackLocations) { lprintf("A%ld", long(r - ArgStackLocations)); } else if (r >= IArgStackLocations) { lprintf("I%ld", long(r - IArgStackLocations)); } else { lprintf("%s", RegisterNames[r]); } }
void RegisterState::allocatePermanent(Location r) { if (isRegister(r)) { ::allocateRegister(permanent, r); } else if (is_StackLocation(r)) { setNth(stackPerms[whichMask(r)], whichBit(r)); } else { // extra incoming arg etc -- ignore } allocate(r); }
void RegisterState::allocate(Location r) { if (isRegister(r)) { ::allocateRegister(allocated, r); } else if (is_StackLocation(r)) { assert(!isSet(stackAllocs[whichMask(r)], whichBit(r)), "already allocated"); setNth(stackAllocs[whichMask(r)], whichBit(r)); fint tempNo = index_for_StackLocation(r) + 1; if (tempNo >= stackDepth) stackDepth = tempNo; curDepth++; assert(curDepth <= stackDepth, "curDepth too big"); } }
void reg_disp_type_of_loc(Location* basep, int32* offsetp, OperandType* tp, Location loc) { Location b = IllegalLocation; int32 d = 0; OperandType t = NumberOperand; if (isRegister(loc)) b = loc, d = 0, t = RegisterOperand; else if (loc == IReceiverReg || is_IArgLocation(loc)) b = ebp, d = index_for_IArgLocation(loc) + 1 + ircvr_offset; else if (loc == LReceiverReg || is_LArgLocation(loc)) b = esp, d = index_for_LArgLocation(loc) + 1 + leaf_rcvr_offset; else if (loc == ReceiverReg || is_ArgLocation(loc)) b = esp, d = index_for_ArgLocation(loc) + 1 + rcvr_offset; else if ( is_StackLocation(loc)) b = ebp, d = -index_for_StackLocation(loc) + first_local_offset; else fatal1("don't know how to do %s\n", locationName(loc)); if (basep) *basep = b; if (offsetp) *offsetp = d * oopSize; if (tp) *tp = t; }
void RegisterState::deallocate(Location r) { if (isRegister(r)) { ::deallocateRegister(allocated, r); allocated = ::allocate(allocated, permanent); // ensure we do not deallocate a permanent reg } else if (is_StackLocation(r)) { if (isSet(stackPerms[whichMask(r)], whichBit(r))) { // permanent -- don't deallocate } else { assert(isSet(stackAllocs[whichMask(r)], whichBit(r)), "not allocated"); clearNth(stackAllocs[whichMask(r)], whichBit(r)); --curDepth; assert(curDepth >= 0, "negative depth"); } } }
void RegisterState::allocate(Location r) { if (isRegister(r)) { ::allocateRegister(allocated, r); // allocate nonvols down from R31, must save/restore them, so track depth _number_of_saved_nonvolatile_registers = max(_number_of_saved_nonvolatile_registers, 32 - r); } else if (is_StackLocation(r)) { assert(!isSet(stackAllocs[whichMask(r)], whichBit(r)), "already allocated"); setNth(stackAllocs[whichMask(r)], whichBit(r)); fint tempNo = index_for_StackLocation(r) + 1; if (tempNo >= stackDepth) stackDepth = tempNo; curDepth++; assert(curDepth <= stackDepth, "curDepth too big"); } }