strength reduce MMI::MappedLabel to MMI::isLabelDeleted,

and add a FIXME about how we are eventually going to zap this
lookup table once mc world domination is complete.

llvm-svn: 98031
This commit is contained in:
Chris Lattner 2010-03-09 01:51:43 +00:00
parent 5ca47a4bdc
commit c3b70f636f
5 changed files with 34 additions and 33 deletions

View File

@ -222,13 +222,14 @@ public:
LabelIDList[LabelID - 1] = 0;
}
/// MappedLabel - Find out the label's final ID. Zero indicates deletion.
/// ID != Mapped ID indicates that the label was folded into another label.
unsigned MappedLabel(unsigned LabelID) const {
/// isLabelDeleted - Return true if the label was deleted.
/// FIXME: This should eventually be eliminated and use the 'is emitted' bit
/// on MCSymbol.
bool isLabelDeleted(unsigned LabelID) const {
assert(LabelID <= LabelIDList.size() && "Debug label ID out of range.");
return LabelID ? LabelIDList[LabelID - 1] : 0;
return LabelID == 0 || LabelIDList[LabelID - 1] == 0;
}
/// getFrameMoves - Returns a reference to a list of moves done in the current
/// function's prologue. Used to construct frame maps for debug and exception
/// handling comsumers.

View File

@ -1362,9 +1362,14 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(MDNode *SPNode) {
/// constructLexicalScope - Construct new DW_TAG_lexical_block
/// for this scope and attach DW_AT_low_pc/DW_AT_high_pc labels.
DIE *DwarfDebug::constructLexicalScopeDIE(DbgScope *Scope) {
unsigned StartID = MMI->MappedLabel(Scope->getStartLabelID());
unsigned EndID = MMI->MappedLabel(Scope->getEndLabelID());
unsigned StartID = Scope->getStartLabelID();
unsigned EndID = Scope->getEndLabelID();
assert(!MMI->isLabelDeleted(StartID) &&
"Invalid starting label for an inlined scope!");
assert(!MMI->isLabelDeleted(EndID) &&
"Invalid end label for an inlined scope!");
// Ignore empty scopes.
if (StartID == EndID && StartID != 0)
return NULL;
@ -1387,12 +1392,14 @@ DIE *DwarfDebug::constructLexicalScopeDIE(DbgScope *Scope) {
/// a function. Construct DIE to represent this concrete inlined copy
/// of the function.
DIE *DwarfDebug::constructInlinedScopeDIE(DbgScope *Scope) {
unsigned StartID = MMI->MappedLabel(Scope->getStartLabelID());
unsigned EndID = MMI->MappedLabel(Scope->getEndLabelID());
assert (StartID && "Invalid starting label for an inlined scope!");
assert (EndID && "Invalid end label for an inlined scope!");
unsigned StartID = Scope->getStartLabelID();
unsigned EndID = Scope->getEndLabelID();
assert(!MMI->isLabelDeleted(StartID) &&
"Invalid starting label for an inlined scope!");
assert(!MMI->isLabelDeleted(EndID) &&
"Invalid end label for an inlined scope!");
// Ignore empty scopes.
if (StartID == EndID && StartID != 0)
if (StartID == EndID)
return NULL;
if (!Scope->getScopeNode())
return NULL;
@ -2589,8 +2596,8 @@ void DwarfDebug::emitDebugLines() {
// Construct rows of the address, source, line, column matrix.
for (unsigned i = 0, N = LineInfos.size(); i < N; ++i) {
const SrcLineInfo &LineInfo = LineInfos[i];
unsigned LabelID = MMI->MappedLabel(LineInfo.getLabelID());
if (!LabelID) continue;
unsigned LabelID = LineInfo.getLabelID();
if (MMI->isLabelDeleted(LabelID)) continue;
if (LineInfo.getLine() == 0) continue;

View File

@ -277,12 +277,9 @@ void DwarfPrinter::EmitFrameMoves(const char *BaseLabel, unsigned BaseLabelID,
const MachineMove &Move = Moves[i];
unsigned LabelID = Move.getLabelID();
if (LabelID) {
LabelID = MMI->MappedLabel(LabelID);
// Throw out move if the label is invalid.
if (!LabelID) continue;
}
// Throw out move if the label is invalid.
if (LabelID && MMI->isLabelDeleted(LabelID))
continue;
const MachineLocation &Dst = Move.getDestination();
const MachineLocation &Src = Move.getSource();

View File

@ -185,7 +185,8 @@ void MachineModuleInfo::addCleanup(MachineBasicBlock *LandingPad) {
void MachineModuleInfo::TidyLandingPads() {
for (unsigned i = 0; i != LandingPads.size(); ) {
LandingPadInfo &LandingPad = LandingPads[i];
LandingPad.LandingPadLabel = MappedLabel(LandingPad.LandingPadLabel);
if (isLabelDeleted(LandingPad.LandingPadLabel))
LandingPad.LandingPadLabel = 0;
// Special case: we *should* emit LPs with null LP MBB. This indicates
// "nounwind" case.
@ -195,17 +196,14 @@ void MachineModuleInfo::TidyLandingPads() {
}
for (unsigned j=0; j != LandingPads[i].BeginLabels.size(); ) {
unsigned BeginLabel = MappedLabel(LandingPad.BeginLabels[j]);
unsigned EndLabel = MappedLabel(LandingPad.EndLabels[j]);
if (!BeginLabel || !EndLabel) {
unsigned BeginLabel = LandingPad.BeginLabels[j];
unsigned EndLabel = LandingPad.EndLabels[j];
if (isLabelDeleted(BeginLabel) || isLabelDeleted(EndLabel)) {
LandingPad.BeginLabels.erase(LandingPad.BeginLabels.begin() + j);
LandingPad.EndLabels.erase(LandingPad.EndLabels.begin() + j);
continue;
}
LandingPad.BeginLabels[j] = BeginLabel;
LandingPad.EndLabels[j] = EndLabel;
++j;
}

View File

@ -75,10 +75,9 @@ JITDwarfEmitter::EmitFrameMoves(intptr_t BaseLabelPtr,
unsigned LabelID = Move.getLabelID();
if (LabelID) {
LabelID = MMI->MappedLabel(LabelID);
// Throw out move if the label is invalid.
if (!LabelID) continue;
if (MMI->isLabelDeleted(LabelID))
continue;
}
intptr_t LabelPtr = 0;
@ -722,10 +721,9 @@ JITDwarfEmitter::GetFrameMovesSizeInBytes(intptr_t BaseLabelPtr,
unsigned LabelID = Move.getLabelID();
if (LabelID) {
LabelID = MMI->MappedLabel(LabelID);
// Throw out move if the label is invalid.
if (!LabelID) continue;
if (MMI->isLabelDeleted(LabelID))
continue;
}
intptr_t LabelPtr = 0;