simplify EmitFrameMoves to take BaseLabel in as a symbol

instead of as a stem+idx pair, simplify the "is a new 
location" check to use symbol comparison.

llvm-svn: 98432
This commit is contained in:
Chris Lattner 2010-03-13 08:05:25 +00:00
parent 5bb8207c13
commit 41e275dc8e
4 changed files with 13 additions and 18 deletions

View File

@ -2725,7 +2725,7 @@ void DwarfDebug::emitCommonDebugFrame() {
std::vector<MachineMove> Moves; std::vector<MachineMove> Moves;
RI->getInitialFrameState(Moves); RI->getInitialFrameState(Moves);
EmitFrameMoves(NULL, 0, Moves, false); EmitFrameMoves(0, Moves, false);
Asm->EmitAlignment(2, 0, 0, false); Asm->EmitAlignment(2, 0, 0, false);
Asm->OutStreamer.EmitLabel(getTempLabel("debug_frame_common_end")); Asm->OutStreamer.EmitLabel(getTempLabel("debug_frame_common_end"));
@ -2764,9 +2764,7 @@ emitFunctionDebugFrame(const FunctionDebugFrameInfo &DebugFrameInfo) {
Asm->OutStreamer.AddComment("FDE address range"); Asm->OutStreamer.AddComment("FDE address range");
EmitDifference(getDWLabel("func_end", DebugFrameInfo.Number), FuncBeginSym); EmitDifference(getDWLabel("func_end", DebugFrameInfo.Number), FuncBeginSym);
// FuncBeginSym. EmitFrameMoves(FuncBeginSym, DebugFrameInfo.Moves, false);
EmitFrameMoves("func_begin", DebugFrameInfo.Number, DebugFrameInfo.Moves,
false);
Asm->EmitAlignment(2, 0, 0, false); Asm->EmitAlignment(2, 0, 0, false);
Asm->OutStreamer.EmitLabel(DebugFrameEnd); Asm->OutStreamer.EmitLabel(DebugFrameEnd);

View File

@ -150,7 +150,7 @@ void DwarfException::EmitCIE(const Function *PersonalityFn, unsigned Index) {
// Indicate locations of general callee saved registers in frame. // Indicate locations of general callee saved registers in frame.
std::vector<MachineMove> Moves; std::vector<MachineMove> Moves;
RI->getInitialFrameState(Moves); RI->getInitialFrameState(Moves);
EmitFrameMoves(NULL, 0, Moves, true); EmitFrameMoves(0, Moves, true);
// On Darwin the linker honors the alignment of eh_frame, which means it must // On Darwin the linker honors the alignment of eh_frame, which means it must
// be 8-byte on 64-bit targets to match what gcc does. Otherwise you get // be 8-byte on 64-bit targets to match what gcc does. Otherwise you get
@ -247,9 +247,7 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) {
} }
// Indicate locations of function specific callee saved registers in frame. // Indicate locations of function specific callee saved registers in frame.
// EHFuncBeginSym EmitFrameMoves(EHFuncBeginSym, EHFrameInfo.Moves, true);
EmitFrameMoves("eh_func_begin", EHFrameInfo.Number, EHFrameInfo.Moves,
true);
// On Darwin the linker honors the alignment of eh_frame, which means it // On Darwin the linker honors the alignment of eh_frame, which means it
// must be 8-byte on 64-bit targets to match what gcc does. Otherwise you // must be 8-byte on 64-bit targets to match what gcc does. Otherwise you

View File

@ -237,7 +237,7 @@ void DwarfPrinter::EmitSectionOffset(const MCSymbol *Label,
/// EmitFrameMoves - Emit frame instructions to describe the layout of the /// EmitFrameMoves - Emit frame instructions to describe the layout of the
/// frame. /// frame.
void DwarfPrinter::EmitFrameMoves(const char *BaseLabel, unsigned BaseLabelID, void DwarfPrinter::EmitFrameMoves(MCSymbol *BaseLabel,
const std::vector<MachineMove> &Moves, const std::vector<MachineMove> &Moves,
bool isEH) { bool isEH) {
int stackGrowth = TD->getPointerSize(); int stackGrowth = TD->getPointerSize();
@ -245,7 +245,6 @@ void DwarfPrinter::EmitFrameMoves(const char *BaseLabel, unsigned BaseLabelID,
TargetFrameInfo::StackGrowsUp) TargetFrameInfo::StackGrowsUp)
stackGrowth *= -1; stackGrowth *= -1;
bool IsLocal = false;
for (unsigned i = 0, N = Moves.size(); i < N; ++i) { for (unsigned i = 0, N = Moves.size(); i < N; ++i) {
const MachineMove &Move = Moves[i]; const MachineMove &Move = Moves[i];
unsigned LabelID = Move.getLabelID(); unsigned LabelID = Move.getLabelID();
@ -258,13 +257,13 @@ void DwarfPrinter::EmitFrameMoves(const char *BaseLabel, unsigned BaseLabelID,
const MachineLocation &Src = Move.getSource(); const MachineLocation &Src = Move.getSource();
// Advance row if new location. // Advance row if new location.
if (BaseLabel && LabelID && (BaseLabelID != LabelID || !IsLocal)) { if (BaseLabel && LabelID) {
MCSymbol *ThisSym = getDWLabel("label", LabelID);
if (ThisSym != BaseLabel) {
EmitCFAByte(dwarf::DW_CFA_advance_loc4); EmitCFAByte(dwarf::DW_CFA_advance_loc4);
EmitDifference(getDWLabel("label", LabelID), EmitDifference(ThisSym, BaseLabel, true);
getDWLabel(BaseLabel, BaseLabelID), true); BaseLabel = ThisSym;
BaseLabelID = LabelID; }
BaseLabel = "label";
IsLocal = true;
} }
// If advancing cfa. // If advancing cfa.

View File

@ -122,7 +122,7 @@ public:
/// EmitFrameMoves - Emit frame instructions to describe the layout of the /// EmitFrameMoves - Emit frame instructions to describe the layout of the
/// frame. /// frame.
void EmitFrameMoves(const char *BaseLabel, unsigned BaseLabelID, void EmitFrameMoves(MCSymbol *BaseLabel,
const std::vector<MachineMove> &Moves, bool isEH); const std::vector<MachineMove> &Moves, bool isEH);
}; };