mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-28 14:36:34 +00:00
Update local stack block allocation to let PEI do the allocs if no additional
base registers were required. This will allow for slightly better packing of the locals when alignment padding is necessary after callee saved registers. llvm-svn: 111508
This commit is contained in:
parent
bb27588b3f
commit
d6e0ffd95b
@ -216,6 +216,11 @@ class MachineFrameInfo {
|
|||||||
/// alignment of any object in it.
|
/// alignment of any object in it.
|
||||||
unsigned LocalFrameMaxAlign;
|
unsigned LocalFrameMaxAlign;
|
||||||
|
|
||||||
|
/// Whether the local object blob needs to be allocated together. If not,
|
||||||
|
/// PEI should ignore the isPreAllocated flags on the stack objects and
|
||||||
|
/// just allocate them normally.
|
||||||
|
bool UseLocalStackAllocationBlock;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MachineFrameInfo(const TargetFrameInfo &tfi) : TFI(tfi) {
|
explicit MachineFrameInfo(const TargetFrameInfo &tfi) : TFI(tfi) {
|
||||||
StackSize = NumFixedObjects = OffsetAdjustment = MaxAlignment = 0;
|
StackSize = NumFixedObjects = OffsetAdjustment = MaxAlignment = 0;
|
||||||
@ -315,6 +320,17 @@ public:
|
|||||||
/// object blob.
|
/// object blob.
|
||||||
unsigned getLocalFrameMaxAlign() { return LocalFrameMaxAlign; }
|
unsigned getLocalFrameMaxAlign() { return LocalFrameMaxAlign; }
|
||||||
|
|
||||||
|
/// getUseLocalStackAllocationBlock - Get whether the local allocation blob
|
||||||
|
/// should be allocated together or let PEI allocate the locals in it
|
||||||
|
/// directly.
|
||||||
|
bool getUseLocalStackAllocationBlock() {return UseLocalStackAllocationBlock;}
|
||||||
|
|
||||||
|
/// setUseLocalStackAllocationBlock - Set whether the local allocation blob
|
||||||
|
/// should be allocated together or let PEI allocate the locals in it
|
||||||
|
/// directly.
|
||||||
|
void setUseLocalStackAllocationBlock(bool v) {
|
||||||
|
UseLocalStackAllocationBlock = v;
|
||||||
|
}
|
||||||
|
|
||||||
/// isObjectPreAllocated - Return true if the object was pre-allocated into
|
/// isObjectPreAllocated - Return true if the object was pre-allocated into
|
||||||
/// the local block.
|
/// the local block.
|
||||||
|
@ -89,6 +89,13 @@ bool LocalStackSlotPass::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
// Insert virtual base registers to resolve frame index references.
|
// Insert virtual base registers to resolve frame index references.
|
||||||
insertFrameReferenceRegisters(MF);
|
insertFrameReferenceRegisters(MF);
|
||||||
|
|
||||||
|
// Tell MFI whether any base registers were allocated. PEI will only
|
||||||
|
// want to use the local block allocations from this pass if there were any.
|
||||||
|
// Otherwise, PEI can do a bit better job of getting the alignment right
|
||||||
|
// without a hole at the start since it knows the alignment of the stack
|
||||||
|
// at the start of local allocation, and this pass doesn't.
|
||||||
|
MFI->setUseLocalStackAllocationBlock(NumBaseRegisters > 0);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -560,7 +560,7 @@ void PEI::calculateFrameObjectOffsets(MachineFunction &Fn) {
|
|||||||
// check for whether the frame is large enough to want to use virtual
|
// check for whether the frame is large enough to want to use virtual
|
||||||
// frame index registers. Functions which don't want/need this optimization
|
// frame index registers. Functions which don't want/need this optimization
|
||||||
// will continue to use the existing code path.
|
// will continue to use the existing code path.
|
||||||
if (EnableLocalStackAlloc && MFI->getLocalFrameSize()) {
|
if (EnableLocalStackAlloc && MFI->getUseLocalStackAllocationBlock()) {
|
||||||
unsigned Align = MFI->getLocalFrameMaxAlign();
|
unsigned Align = MFI->getLocalFrameMaxAlign();
|
||||||
|
|
||||||
// Adjust to alignment boundary.
|
// Adjust to alignment boundary.
|
||||||
@ -593,7 +593,8 @@ void PEI::calculateFrameObjectOffsets(MachineFunction &Fn) {
|
|||||||
|
|
||||||
// Assign large stack objects first.
|
// Assign large stack objects first.
|
||||||
for (unsigned i = 0, e = MFI->getObjectIndexEnd(); i != e; ++i) {
|
for (unsigned i = 0, e = MFI->getObjectIndexEnd(); i != e; ++i) {
|
||||||
if (MFI->isObjectPreAllocated(i))
|
if (MFI->isObjectPreAllocated(i) &&
|
||||||
|
MFI->getUseLocalStackAllocationBlock())
|
||||||
continue;
|
continue;
|
||||||
if (i >= MinCSFrameIndex && i <= MaxCSFrameIndex)
|
if (i >= MinCSFrameIndex && i <= MaxCSFrameIndex)
|
||||||
continue;
|
continue;
|
||||||
@ -614,7 +615,8 @@ void PEI::calculateFrameObjectOffsets(MachineFunction &Fn) {
|
|||||||
// Then assign frame offsets to stack objects that are not used to spill
|
// Then assign frame offsets to stack objects that are not used to spill
|
||||||
// callee saved registers.
|
// callee saved registers.
|
||||||
for (unsigned i = 0, e = MFI->getObjectIndexEnd(); i != e; ++i) {
|
for (unsigned i = 0, e = MFI->getObjectIndexEnd(); i != e; ++i) {
|
||||||
if (MFI->isObjectPreAllocated(i))
|
if (MFI->isObjectPreAllocated(i) &&
|
||||||
|
MFI->getUseLocalStackAllocationBlock())
|
||||||
continue;
|
continue;
|
||||||
if (i >= MinCSFrameIndex && i <= MaxCSFrameIndex)
|
if (i >= MinCSFrameIndex && i <= MaxCSFrameIndex)
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user