This avoids
ARMBaseRegisterInfo::canRealignStack()/ARMFrameLowering::hasReservedCallFrame()
giving different answers in early/late phases of codegen.
The attached testcase shows a particular nasty example where we would call TargetRegisterInfo::needsStackRealignment()->canRealignStack()->hasReservedCallFrame() and would end up not aligning the stack because hasReservedCallFrame() would report false in late passes only.
This exposes a method in MachineFrameInfo that calculates
MaxCallFrameSize and calls it after instruction selection to get the value computed early.
To make this work in GlobalISel this also:
- Move the TargetLoweringInfo::finalizeLowering code from IRTranslator to the end of InstructionSelect
- Changing the MachineVerifier to work when the reserved registers are not frozen yet (by using TargetRegisterInfo::getReservedRegs() instead of MachineRegisterInfo stuff).
Is it right that if we don't have accurate call frame information we assume FP is not used here? Shouldn't we default to the conservative "true"?