Remove the MachineMove class.

It was just a less powerful and more confusing version of
MCCFIInstruction. A side effect is that, since MCCFIInstruction uses
dwarf register numbers, calls to getDwarfRegNum are pushed out, which
should allow further simplifications.

I left the MachineModuleInfo::addFrameMove interface unchanged since
this patch was already fairly big.

llvm-svn: 181680
This commit is contained in:
Rafael Espindola
2013-05-13 01:16:13 +00:00
parent c6e16af2f4
commit 227144c23c
38 changed files with 169 additions and 177 deletions

View File

@@ -268,6 +268,39 @@ MachineModuleInfo::MachineModuleInfo()
MachineModuleInfo::~MachineModuleInfo() {
}
static MCCFIInstruction convertMoveToCFI(const MCRegisterInfo &MRI,
MCSymbol *Label,
const MachineLocation &Dst,
const MachineLocation &Src) {
// If advancing cfa.
if (Dst.isReg() && Dst.getReg() == MachineLocation::VirtualFP) {
if (Src.getReg() == MachineLocation::VirtualFP)
return MCCFIInstruction::createDefCfaOffset(Label, Src.getOffset());
// Reg + Offset
return MCCFIInstruction::createDefCfa(
Label, MRI.getDwarfRegNum(Src.getReg(), true), -Src.getOffset());
}
if (Src.isReg() && Src.getReg() == MachineLocation::VirtualFP) {
assert(Dst.isReg() && "Machine move not supported yet.");
return MCCFIInstruction::createDefCfaRegister(
Label, MRI.getDwarfRegNum(Dst.getReg(), true));
}
assert(!Dst.isReg() && "Machine move not supported yet.");
return MCCFIInstruction::createOffset(
Label, MRI.getDwarfRegNum(Src.getReg(), true), Dst.getOffset());
}
void MachineModuleInfo::addFrameMove(MCSymbol *Label,
const MachineLocation &Dst,
const MachineLocation &Src) {
MCCFIInstruction I =
convertMoveToCFI(Context.getRegisterInfo(), Label, Dst, Src);
FrameInstructions.push_back(I);
}
bool MachineModuleInfo::doInitialization(Module &M) {
ObjFileMMI = 0;
@@ -303,7 +336,7 @@ bool MachineModuleInfo::doFinalization(Module &M) {
///
void MachineModuleInfo::EndFunction() {
// Clean up frame info.
FrameMoves.clear();
FrameInstructions.clear();
// Clean up exception info.
LandingPads.clear();