mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-19 17:33:29 +00:00
Be over-conservative: scan for all used virtual registers and calculate maximal stack alignment in assumption, that there will be spill of vector register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50167 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
856914fe00
commit
d52bdaff0c
@ -1121,11 +1121,18 @@ namespace {
|
||||
|
||||
virtual bool runOnMachineFunction(MachineFunction &MF) {
|
||||
MachineFrameInfo *FFI = MF.getFrameInfo();
|
||||
MachineRegisterInfo &RI = MF.getRegInfo();
|
||||
|
||||
// Calculate and set max stack object alignment early, so we can decide
|
||||
// whether we will need stack realignment (and thus FP).
|
||||
// Calculate max stack alignment of all already allocated stack objects.
|
||||
unsigned MaxAlign = calculateMaxStackAlignment(FFI);
|
||||
|
||||
// Be over-conservative: scan over all vreg defs and find, whether vector
|
||||
// registers are used. If yes - there is probability, that vector register
|
||||
// will be spilled and thus stack needs to be aligned properly.
|
||||
for (unsigned RegNum = TargetRegisterInfo::FirstVirtualRegister;
|
||||
RegNum < RI.getLastVirtReg(); ++RegNum)
|
||||
MaxAlign = std::max(MaxAlign, RI.getRegClass(RegNum)->getAlignment());
|
||||
|
||||
FFI->setMaxAlignment(MaxAlign);
|
||||
|
||||
return false;
|
||||
|
@ -162,6 +162,8 @@ bool X86TargetMachine::addInstSelector(PassManagerBase &PM, bool Fast) {
|
||||
}
|
||||
|
||||
bool X86TargetMachine::addPreRegAlloc(PassManagerBase &PM, bool Fast) {
|
||||
// Calculate and set max stack object alignment early, so we can decide
|
||||
// whether we will need stack realignment (and thus FP).
|
||||
PM.add(createX86MaxStackAlignmentCalculatorPass());
|
||||
return false; // -print-machineinstr shouldn't print after this.
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user