Set the compact unwind encoding to 'requires EH DWARF' if we cannot generate a CU encoding.

llvm-svn: 179808
This commit is contained in:
Bill Wendling 2013-04-18 22:55:29 +00:00
parent b12da6be75
commit 0c3fad7efc
1 changed files with 9 additions and 9 deletions

View File

@ -528,11 +528,11 @@ uint32_t X86FrameLowering::getCompactUnwindEncoding(MachineFunction &MF) const {
if (!MI.getFlag(MachineInstr::FrameSetup)) break; if (!MI.getFlag(MachineInstr::FrameSetup)) break;
// We don't exect any more prolog instructions. // We don't exect any more prolog instructions.
if (ExpectEnd) return 0; if (ExpectEnd) return 0x04000000;
if (Opc == PushInstr) { if (Opc == PushInstr) {
// If there are too many saved registers, we cannot use compact encoding. // If there are too many saved registers, we cannot use compact encoding.
if (SavedRegIdx >= CU_NUM_SAVED_REGS) return 0; if (SavedRegIdx >= CU_NUM_SAVED_REGS) return 0x04000000;
SavedRegs[SavedRegIdx++] = MI.getOperand(0).getReg(); SavedRegs[SavedRegIdx++] = MI.getOperand(0).getReg();
StackAdjust += OffsetSize; StackAdjust += OffsetSize;
@ -542,7 +542,7 @@ uint32_t X86FrameLowering::getCompactUnwindEncoding(MachineFunction &MF) const {
unsigned DstReg = MI.getOperand(0).getReg(); unsigned DstReg = MI.getOperand(0).getReg();
if (DstReg != FramePtr || SrcReg != StackPtr) if (DstReg != FramePtr || SrcReg != StackPtr)
return 0; return 0x04000000;
StackAdjust = 0; StackAdjust = 0;
memset(SavedRegs, 0, sizeof(SavedRegs)); memset(SavedRegs, 0, sizeof(SavedRegs));
@ -552,7 +552,7 @@ uint32_t X86FrameLowering::getCompactUnwindEncoding(MachineFunction &MF) const {
Opc == X86::SUB32ri || Opc == X86::SUB32ri8) { Opc == X86::SUB32ri || Opc == X86::SUB32ri8) {
if (StackSize) if (StackSize)
// We already have a stack size. // We already have a stack size.
return 0; return 0x04000000;
if (!MI.getOperand(0).isReg() || if (!MI.getOperand(0).isReg() ||
MI.getOperand(0).getReg() != MI.getOperand(1).getReg() || MI.getOperand(0).getReg() != MI.getOperand(1).getReg() ||
@ -560,7 +560,7 @@ uint32_t X86FrameLowering::getCompactUnwindEncoding(MachineFunction &MF) const {
// We need this to be a stack adjustment pointer. Something like: // We need this to be a stack adjustment pointer. Something like:
// //
// %RSP<def> = SUB64ri8 %RSP, 48 // %RSP<def> = SUB64ri8 %RSP, 48
return 0; return 0x04000000;
StackSize = MI.getOperand(2).getImm() / StackDivide; StackSize = MI.getOperand(2).getImm() / StackDivide;
SubtractInstrIdx += InstrOffset; SubtractInstrIdx += InstrOffset;
@ -574,11 +574,11 @@ uint32_t X86FrameLowering::getCompactUnwindEncoding(MachineFunction &MF) const {
if (HasFP) { if (HasFP) {
if ((StackAdjust & 0xFF) != StackAdjust) if ((StackAdjust & 0xFF) != StackAdjust)
// Offset was too big for compact encoding. // Offset was too big for compact encoding.
return 0; return 0x04000000;
// Get the encoding of the saved registers when we have a frame pointer. // Get the encoding of the saved registers when we have a frame pointer.
uint32_t RegEnc = encodeCompactUnwindRegistersWithFrame(SavedRegs, Is64Bit); uint32_t RegEnc = encodeCompactUnwindRegistersWithFrame(SavedRegs, Is64Bit);
if (RegEnc == ~0U) return 0; if (RegEnc == ~0U) return 0x04000000;
CompactUnwindEncoding |= 0x01000000; CompactUnwindEncoding |= 0x01000000;
CompactUnwindEncoding |= (StackAdjust & 0xFF) << 16; CompactUnwindEncoding |= (StackAdjust & 0xFF) << 16;
@ -595,7 +595,7 @@ uint32_t X86FrameLowering::getCompactUnwindEncoding(MachineFunction &MF) const {
} else { } else {
if ((StackAdjust & 0x7) != StackAdjust) if ((StackAdjust & 0x7) != StackAdjust)
// The extra stack adjustments are too big for us to handle. // The extra stack adjustments are too big for us to handle.
return 0; return 0x04000000;
// Frameless stack with an offset too large for us to encode compactly. // Frameless stack with an offset too large for us to encode compactly.
CompactUnwindEncoding |= 0x03000000; CompactUnwindEncoding |= 0x03000000;
@ -616,7 +616,7 @@ uint32_t X86FrameLowering::getCompactUnwindEncoding(MachineFunction &MF) const {
uint32_t RegEnc = uint32_t RegEnc =
encodeCompactUnwindRegistersWithoutFrame(SavedRegs, SavedRegIdx, encodeCompactUnwindRegistersWithoutFrame(SavedRegs, SavedRegIdx,
Is64Bit); Is64Bit);
if (RegEnc == ~0U) return 0; if (RegEnc == ~0U) return 0x04000000;
// Encode the register encoding. // Encode the register encoding.
CompactUnwindEncoding |= RegEnc & 0x3FF; CompactUnwindEncoding |= RegEnc & 0x3FF;