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 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"); } }
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); }