Check the correct value for small stack sizes. Also modify some comments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145954 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2011-12-06 19:16:17 +00:00
parent 75e14e0ebd
commit 5b2c4978ce

View File

@ -554,17 +554,17 @@ uint32_t X86FrameLowering::getCompactUnwindEncoding(MachineFunction &MF) const {
// Get the encoding of the saved registers when we have a frame pointer.
uint32_t RegEnc = encodeCompactUnwindRegistersWithFrame(SavedRegs, Is64Bit);
if (RegEnc == ~0U)
return 0;
if (RegEnc == ~0U) return 0;
CompactUnwindEncoding |= 0x01000000;
CompactUnwindEncoding |= (CFAOffset & 0xFF) << 16;
CompactUnwindEncoding |= RegEnc & 0x7FFF;
} else {
unsigned FullOffset = CFAOffset + StackAdjust;
if ((FullOffset & 0xFF) == FullOffset) {
// Frameless stack.
if ((CFAOffset & 0xFF) == CFAOffset) {
// Frameless stack with a small stack size.
CompactUnwindEncoding |= 0x02000000;
// Encode the stack size.
CompactUnwindEncoding |= (CFAOffset & 0xFF) << 16;
} else {
if ((CFAOffset & 0x7) != CFAOffset)
@ -582,6 +582,7 @@ uint32_t X86FrameLowering::getCompactUnwindEncoding(MachineFunction &MF) const {
CompactUnwindEncoding |= (CFAOffset & 0x7) << 13;
}
// Encode the number of registers saved.
CompactUnwindEncoding |= ((6 - SavedRegIdx) & 0x7) << 10;
// Get the encoding of the saved registers when we don't have a frame
@ -590,6 +591,8 @@ uint32_t X86FrameLowering::getCompactUnwindEncoding(MachineFunction &MF) const {
6 - SavedRegIdx,
Is64Bit);
if (RegEnc == ~0U) return 0;
// Encode the register encoding.
CompactUnwindEncoding |= RegEnc & 0x3FF;
}