// default, fixed objects are immutable unless marked otherwise.
bool isImmutable;
- StackObject(uint64_t Sz, unsigned Al, int64_t SP = 0, bool IM = false)
- : SPOffset(SP), Size(Sz), Alignment(Al), isImmutable(IM) {}
+ // isSpillSlot - If true, the stack object is used as spill slot. It
+ // cannot alias any other memory objects.
+ bool isSpillSlot;
+
+ StackObject(uint64_t Sz, unsigned Al, int64_t SP = 0, bool IM = false,
+ bool isSS = false)
+ : SPOffset(SP), Size(Sz), Alignment(Al), isImmutable(IM),
+ isSpillSlot(isSS) {}
};
/// Objects - The list of stack objects allocated...
return Objects[ObjectIdx+NumFixedObjects].isImmutable;
}
+ /// isSpillSlotObjectIndex - Returns true if the specified index corresponds
+ /// to a spill slot..
+ bool isSpillSlotObjectIndex(int ObjectIdx) const {
+ assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
+ "Invalid Object Idx!");
+ return Objects[ObjectIdx+NumFixedObjects].isSpillSlot;;
+ }
+
/// isDeadObjectIndex - Returns true if the specified index corresponds to
/// a dead object.
bool isDeadObjectIndex(int ObjectIdx) const {
/// CreateStackObject - Create a new statically sized stack object, returning
/// a nonnegative identifier to represent it.
///
- int CreateStackObject(uint64_t Size, unsigned Alignment) {
+ int CreateStackObject(uint64_t Size, unsigned Alignment, bool isSS = false) {
assert(Size != 0 && "Cannot allocate zero size stack objects!");
- Objects.push_back(StackObject(Size, Alignment));
+ Objects.push_back(StackObject(Size, Alignment, 0, false, isSS));
return (int)Objects.size()-NumFixedObjects-1;
}
if (I != IntervalSSMap.end()) {
SS = I->second;
} else {
- SS = MFI->CreateStackObject(RC->getSize(), RC->getAlignment());
+ SS = MFI->CreateStackObject(RC->getSize(), RC->getAlignment());
}
MachineInstr* FMI = TII->foldMemoryOperand(*MBB->getParent(),
// the TargetRegisterClass if the stack alignment is smaller. Use the
// min.
Align = std::min(Align, StackAlign);
- FrameIdx = FFI->CreateStackObject(RC->getSize(), Align);
+ FrameIdx = FFI->CreateStackObject(RC->getSize(), Align, true);
if ((unsigned)FrameIdx < MinCSFrameIndex) MinCSFrameIndex = FrameIdx;
if ((unsigned)FrameIdx > MaxCSFrameIndex) MaxCSFrameIndex = FrameIdx;
} else {
// Allocate a new stack object for this spill location...
int FrameIdx = MF->getFrameInfo()->CreateStackObject(RC->getSize(),
- RC->getAlignment());
+ RC->getAlignment(),true);
// Assign the slot...
StackSlotForVirtReg[VirtReg] = FrameIdx;
"attempt to assign stack slot to already spilled register");
const TargetRegisterClass* RC = MF->getRegInfo().getRegClass(virtReg);
int SS = MF->getFrameInfo()->CreateStackObject(RC->getSize(),
- RC->getAlignment());
+ RC->getAlignment(), /*isSS*/true);
if (LowSpillSlot == NO_STACK_SLOT)
LowSpillSlot = SS;
if (HighSpillSlot == NO_STACK_SLOT || SS > HighSpillSlot)
if (I != EmergencySpillSlots.end())
return I->second;
int SS = MF->getFrameInfo()->CreateStackObject(RC->getSize(),
- RC->getAlignment());
+ RC->getAlignment(), /*isSS*/true);
if (LowSpillSlot == NO_STACK_SLOT)
LowSpillSlot = SS;
if (HighSpillSlot == NO_STACK_SLOT || SS > HighSpillSlot)
MachineFunction &MF = *MBB.getParent();
MachineFrameInfo &MFI = *MF.getFrameInfo();
+ const Value *SV = (MFI.isFixedObjectIndex(FI) ||
+ MFI.isSpillSlotObjectIndex(FI))
+ ? PseudoSourceValue::getFixedStack(FI) : PseudoSourceValue::getStack();
MachineMemOperand *MMO =
- MF.getMachineMemOperand(PseudoSourceValue::getFixedStack(FI),
+ MF.getMachineMemOperand(SV,
MachineMemOperand::MOStore, 0,
MFI.getObjectSize(FI),
MFI.getObjectAlignment(FI));
MachineFunction &MF = *MBB.getParent();
MachineFrameInfo &MFI = *MF.getFrameInfo();
+ const Value *SV = (MFI.isFixedObjectIndex(FI) ||
+ MFI.isSpillSlotObjectIndex(FI))
+ ? PseudoSourceValue::getFixedStack(FI) : PseudoSourceValue::getStack();
MachineMemOperand *MMO =
- MF.getMachineMemOperand(PseudoSourceValue::getFixedStack(FI),
+ MF.getMachineMemOperand(SV,
MachineMemOperand::MOLoad, 0,
MFI.getObjectSize(FI),
MFI.getObjectAlignment(FI));
Flags |= MachineMemOperand::MOLoad;
if (TID.mayStore())
Flags |= MachineMemOperand::MOStore;
+ const Value *SV = (MFI.isFixedObjectIndex(FI) ||
+ MFI.isSpillSlotObjectIndex(FI))
+ ? PseudoSourceValue::getFixedStack(FI) : PseudoSourceValue::getStack();
MachineMemOperand *MMO =
- MF.getMachineMemOperand(PseudoSourceValue::getFixedStack(FI),
+ MF.getMachineMemOperand(SV,
Flags, Offset,
MFI.getObjectSize(FI),
MFI.getObjectAlignment(FI));