#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/UniqueVector.h"
#include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/CodeGen/MachineLocation.h"
#include "llvm/GlobalValue.h"
// searchable format.
SmallPtrSet<const Function *, 32> UsedFunctions;
+ /// UsedDbgLabels - labels are used by debug info entries.
+ SmallSet<unsigned, 8> UsedDbgLabels;
+
bool CallsEHReturn;
bool CallsUnwindInit;
return LabelID ? LabelIDList[LabelID - 1] : 0;
}
+ /// isDbgLabelUsed - Return true if label with LabelID is used by
+ /// DwarfWriter.
+ bool isDbgLabelUsed(unsigned LabelID) {
+ return UsedDbgLabels.count(LabelID);
+ }
+
+ /// RecordUsedDbgLabel - Mark label with LabelID as used. This is used
+ /// by DwarfWriter to inform DebugLabelFolder that certain labels are
+ /// not to be deleted.
+ void RecordUsedDbgLabel(unsigned LabelID) {
+ UsedDbgLabels.insert(LabelID);
+ }
+
/// 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.
// Iterate through instructions.
for (MachineBasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ) {
// Is it a label.
- if (I->isDebugLabel()) {
+ if (I->isDebugLabel() && !MMI->isDbgLabelUsed(I->getOperand(0).getImm())){
// The label ID # is always operand #0, an immediate.
unsigned NextLabel = I->getOperand(0).getImm();