mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
Remove the now defunct getCompactUnwindEncoding method from the frame lowering code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135634 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3737b89098
commit
16da7366d5
@ -186,14 +186,6 @@ public:
|
||||
///
|
||||
virtual void processFunctionBeforeFrameFinalized(MachineFunction &MF) const {
|
||||
}
|
||||
|
||||
/// getCompactUnwindEncoding - Get the compact unwind encoding for the
|
||||
/// function. Return 0 if the compact unwind isn't available.
|
||||
virtual uint32_t getCompactUnwindEncoding(ArrayRef<MCCFIInstruction> Instrs,
|
||||
int DataAlignmentFactor,
|
||||
bool IsEH) const {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
} // End llvm namespace
|
||||
|
@ -1076,118 +1076,3 @@ static uint32_t permuteEncode(unsigned SavedCount, unsigned Registers[6]) {
|
||||
|
||||
return permutationEncoding;
|
||||
}
|
||||
|
||||
uint32_t X86FrameLowering::
|
||||
getCompactUnwindEncoding(ArrayRef<MCCFIInstruction> Instrs,
|
||||
int DataAlignmentFactor, bool IsEH) const {
|
||||
uint32_t Encoding = 0;
|
||||
int CFAOffset = 0;
|
||||
const TargetRegisterInfo *TRI = TM.getRegisterInfo();
|
||||
unsigned SavedRegs[6] = { 0, 0, 0, 0, 0, 0 };
|
||||
unsigned SavedRegIdx = 0;
|
||||
int FramePointerReg = -1;
|
||||
|
||||
for (ArrayRef<MCCFIInstruction>::const_iterator
|
||||
I = Instrs.begin(), E = Instrs.end(); I != E; ++I) {
|
||||
const MCCFIInstruction &Inst = *I;
|
||||
MCSymbol *Label = Inst.getLabel();
|
||||
|
||||
// Ignore invalid labels.
|
||||
if (Label && !Label->isDefined()) continue;
|
||||
|
||||
unsigned Operation = Inst.getOperation();
|
||||
if (Operation != MCCFIInstruction::Move &&
|
||||
Operation != MCCFIInstruction::RelMove)
|
||||
// FIXME: We can't handle this frame just yet.
|
||||
return 0;
|
||||
|
||||
const MachineLocation &Dst = Inst.getDestination();
|
||||
const MachineLocation &Src = Inst.getSource();
|
||||
const bool IsRelative = (Operation == MCCFIInstruction::RelMove);
|
||||
|
||||
if (Dst.isReg() && Dst.getReg() == MachineLocation::VirtualFP) {
|
||||
if (Src.getReg() != MachineLocation::VirtualFP) {
|
||||
// DW_CFA_def_cfa
|
||||
assert(FramePointerReg == -1 &&"Defining more than one frame pointer?");
|
||||
if (TRI->getLLVMRegNum(Src.getReg(), IsEH) != X86::EBP &&
|
||||
TRI->getLLVMRegNum(Src.getReg(), IsEH) != X86::RBP)
|
||||
// The frame pointer isn't EBP/RBP. Cannot make unwind information
|
||||
// compact.
|
||||
return 0;
|
||||
FramePointerReg = TRI->getCompactUnwindRegNum(Src.getReg(), IsEH);
|
||||
} // else DW_CFA_def_cfa_offset
|
||||
|
||||
if (IsRelative)
|
||||
CFAOffset += Src.getOffset();
|
||||
else
|
||||
CFAOffset -= Src.getOffset();
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Src.isReg() && Src.getReg() == MachineLocation::VirtualFP) {
|
||||
// DW_CFA_def_cfa_register
|
||||
assert(FramePointerReg == -1 && "Defining more than one frame pointer?");
|
||||
|
||||
if (TRI->getLLVMRegNum(Dst.getReg(), IsEH) != X86::EBP &&
|
||||
TRI->getLLVMRegNum(Dst.getReg(), IsEH) != X86::RBP)
|
||||
// The frame pointer isn't EBP/RBP. Cannot make unwind information
|
||||
// compact.
|
||||
return 0;
|
||||
|
||||
FramePointerReg = TRI->getCompactUnwindRegNum(Dst.getReg(), IsEH);
|
||||
if (SavedRegIdx != 1 || SavedRegs[0] != unsigned(FramePointerReg))
|
||||
return 0;
|
||||
|
||||
SavedRegs[0] = 0;
|
||||
SavedRegIdx = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
unsigned Reg = Src.getReg();
|
||||
int Offset = Dst.getOffset();
|
||||
if (IsRelative)
|
||||
Offset -= CFAOffset;
|
||||
Offset /= DataAlignmentFactor;
|
||||
|
||||
if (Offset < 0) {
|
||||
// FIXME: Handle?
|
||||
// DW_CFA_offset_extended_sf
|
||||
return 0;
|
||||
} else if (Reg < 64) {
|
||||
// DW_CFA_offset + Reg
|
||||
if (SavedRegIdx >= 6) return 0;
|
||||
int CURegNum = TRI->getCompactUnwindRegNum(Reg, IsEH);
|
||||
if (CURegNum == -1) return 0;
|
||||
SavedRegs[SavedRegIdx++] = CURegNum;
|
||||
} else {
|
||||
// FIXME: Handle?
|
||||
// DW_CFA_offset_extended
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Bail if there are too many registers to encode.
|
||||
if (SavedRegIdx > 6) return 0;
|
||||
|
||||
// Check if the offset is too big.
|
||||
CFAOffset /= 4;
|
||||
if ((CFAOffset & 0xFF) != CFAOffset)
|
||||
return 0;
|
||||
Encoding |= (CFAOffset & 0xFF) << 16; // Size encoding.
|
||||
|
||||
if (FramePointerReg != -1) {
|
||||
Encoding |= 0x01000000; // EBP/RBP Unwind Frame
|
||||
for (unsigned I = 0; I != SavedRegIdx; ++I) {
|
||||
unsigned Reg = SavedRegs[I];
|
||||
if (Reg == unsigned(FramePointerReg)) continue;
|
||||
Encoding |= (Reg & 0x7) << (I * 3); // Register encoding
|
||||
}
|
||||
} else {
|
||||
Encoding |= 0x02000000; // Frameless unwind with small stack
|
||||
Encoding |= (SavedRegIdx & 0x7) << 10;
|
||||
Encoding |= permuteEncode(SavedRegIdx, SavedRegs);
|
||||
}
|
||||
|
||||
return Encoding;
|
||||
}
|
||||
|
@ -58,9 +58,6 @@ public:
|
||||
bool hasReservedCallFrame(const MachineFunction &MF) const;
|
||||
|
||||
int getFrameIndexOffset(const MachineFunction &MF, int FI) const;
|
||||
|
||||
uint32_t getCompactUnwindEncoding(ArrayRef<MCCFIInstruction> Instrs,
|
||||
int DataAlignmentFactor, bool IsEH) const;
|
||||
};
|
||||
|
||||
} // End llvm namespace
|
||||
|
Loading…
Reference in New Issue
Block a user