[llvm-commits] [llvm] r84326 - in /llvm/trunk: include/llvm/CodeGen/MachineFrameInfo.h lib/CodeGen/PreAllocSplitting.cpp lib/CodeGen/PrologEpilogInserter.cpp lib/CodeGen/RegAllocLocal.cpp lib/CodeGen/VirtRegMap.cpp lib/Target/ARM/ARMBaseInstrInfo.cpp lib/Target/X86/X86InstrBuilder.h
Evan Cheng
evan.cheng at apple.com
Sat Oct 17 02:20:41 PDT 2009
Author: evancheng
Date: Sat Oct 17 04:20:14 2009
New Revision: 84326
URL: http://llvm.org/viewvc/llvm-project?rev=84326&view=rev
Log:
Distinquish stack slots from other stack objects. They (and fixed objects) get FixedStack PseudoSourceValues.
Modified:
llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h
llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp
llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp
llvm/trunk/lib/CodeGen/RegAllocLocal.cpp
llvm/trunk/lib/CodeGen/VirtRegMap.cpp
llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
llvm/trunk/lib/Target/X86/X86InstrBuilder.h
Modified: llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h?rev=84326&r1=84325&r2=84326&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h Sat Oct 17 04:20:14 2009
@@ -102,8 +102,14 @@
// 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...
@@ -352,6 +358,14 @@
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 {
@@ -363,9 +377,9 @@
/// 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;
}
Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp?rev=84326&r1=84325&r2=84326&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp (original)
+++ llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Sat Oct 17 04:20:14 2009
@@ -952,7 +952,7 @@
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(),
Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp?rev=84326&r1=84325&r2=84326&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp (original)
+++ llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Sat Oct 17 04:20:14 2009
@@ -259,7 +259,7 @@
// 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 {
Modified: llvm/trunk/lib/CodeGen/RegAllocLocal.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLocal.cpp?rev=84326&r1=84325&r2=84326&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocLocal.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocLocal.cpp Sat Oct 17 04:20:14 2009
@@ -263,7 +263,7 @@
// 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;
Modified: llvm/trunk/lib/CodeGen/VirtRegMap.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.cpp?rev=84326&r1=84325&r2=84326&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/VirtRegMap.cpp (original)
+++ llvm/trunk/lib/CodeGen/VirtRegMap.cpp Sat Oct 17 04:20:14 2009
@@ -118,7 +118,7 @@
"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)
@@ -162,7 +162,7 @@
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)
Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp?rev=84326&r1=84325&r2=84326&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp Sat Oct 17 04:20:14 2009
@@ -670,8 +670,11 @@
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));
@@ -708,8 +711,11 @@
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));
Modified: llvm/trunk/lib/Target/X86/X86InstrBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrBuilder.h?rev=84326&r1=84325&r2=84326&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrBuilder.h (original)
+++ llvm/trunk/lib/Target/X86/X86InstrBuilder.h Sat Oct 17 04:20:14 2009
@@ -143,8 +143,11 @@
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));
More information about the llvm-commits
mailing list