X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FCodeGen%2FSlotIndexes.cpp;h=6110ef5d2f058b084dc9f368ac7799b5300db004;hb=f50e952b0d3df2045b48c8e1ce86639affa6d02c;hp=f85384bc5c77186dc33944e290f77197187d9dbf;hpb=b3661585c0f87b6045f0d65b5cac16921ae27086;p=oota-llvm.git diff --git a/lib/CodeGen/SlotIndexes.cpp b/lib/CodeGen/SlotIndexes.cpp index f85384bc5c7..6110ef5d2f0 100644 --- a/lib/CodeGen/SlotIndexes.cpp +++ b/lib/CodeGen/SlotIndexes.cpp @@ -14,6 +14,7 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Support/ManagedStatic.h" +#include "llvm/Target/TargetInstrInfo.h" using namespace llvm; @@ -92,20 +93,23 @@ bool SlotIndexes::runOnMachineFunction(MachineFunction &fn) { functionSize = 0; unsigned index = 0; - // Iterate over the the function. + push_back(createEntry(0, index)); + + // Iterate over the function. for (MachineFunction::iterator mbbItr = mf->begin(), mbbEnd = mf->end(); mbbItr != mbbEnd; ++mbbItr) { MachineBasicBlock *mbb = &*mbbItr; // Insert an index for the MBB start. - push_back(createEntry(0, index)); SlotIndex blockStartIndex(back(), SlotIndex::LOAD); index += SlotIndex::NUM; for (MachineBasicBlock::iterator miItr = mbb->begin(), miEnd = mbb->end(); miItr != miEnd; ++miItr) { - MachineInstr *mi = &*miItr; + MachineInstr *mi = miItr; + if (mi->isDebugValue()) + continue; if (miItr == mbb->getFirstTerminator()) { push_back(createEntry(0, index)); @@ -137,16 +141,16 @@ bool SlotIndexes::runOnMachineFunction(MachineFunction &fn) { index += SlotIndex::NUM; } - SlotIndex blockEndIndex(back(), SlotIndex::STORE); + // One blank instruction at the end. + push_back(createEntry(0, index)); + + SlotIndex blockEndIndex(back(), SlotIndex::LOAD); mbb2IdxMap.insert( std::make_pair(mbb, std::make_pair(blockStartIndex, blockEndIndex))); idx2MBBMap.push_back(IdxMBBPair(blockStartIndex, mbb)); } - // One blank instruction at the end. - push_back(createEntry(0, index)); - // Sort the Idx2MBBMap std::sort(idx2MBBMap.begin(), idx2MBBMap.end(), Idx2MBBCompare()); @@ -191,18 +195,18 @@ void SlotIndexes::renumberIndexes() { void SlotIndexes::dump() const { for (const IndexListEntry *itr = front(); itr != getTail(); itr = itr->getNext()) { - errs() << itr->getIndex() << " "; + dbgs() << itr->getIndex() << " "; if (itr->getInstr() != 0) { - errs() << *itr->getInstr(); + dbgs() << *itr->getInstr(); } else { - errs() << "\n"; + dbgs() << "\n"; } } for (MBB2IdxMap::const_iterator itr = mbb2IdxMap.begin(); itr != mbb2IdxMap.end(); ++itr) { - errs() << "MBB " << itr->first->getNumber() << " (" << itr->first << ") - [" + dbgs() << "MBB " << itr->first->getNumber() << " (" << itr->first << ") - [" << itr->second.first << ", " << itr->second.second << "]\n"; } } @@ -216,7 +220,7 @@ void SlotIndex::print(raw_ostream &os) const { // Dump a SlotIndex to stderr. void SlotIndex::dump() const { - print(errs()); - errs() << "\n"; + print(dbgs()); + dbgs() << "\n"; }