mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-03 19:15:30 +00:00
Refactor debugging code, NFC.
Summary: Refactor debugging routines to reduce code duplication. Remove a couple of #include's that were not needed. Don't require MachineDominator as a prereq for this pass (not needed). These changes split off from http://reviews.llvm.org/D18827. Reviewers: wmi, gbiv, qcolombet Subscribers: llvm-commits, davidxl, jevinskie Differential Revision: http://reviews.llvm.org/D18992 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267766 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bd4ea6e77b
commit
ed52756a75
@ -30,8 +30,6 @@
|
||||
#include "llvm/Analysis/ValueTracking.h"
|
||||
#include "llvm/CodeGen/LiveInterval.h"
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
#include "llvm/CodeGen/MachineBranchProbabilityInfo.h"
|
||||
#include "llvm/CodeGen/MachineDominators.h"
|
||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
#include "llvm/CodeGen/MachineLoopInfo.h"
|
||||
@ -44,7 +42,6 @@
|
||||
#include "llvm/CodeGen/StackProtector.h"
|
||||
#include "llvm/CodeGen/WinEHFuncInfo.h"
|
||||
#include "llvm/IR/DebugInfo.h"
|
||||
#include "llvm/IR/Dominators.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
@ -137,6 +134,9 @@ public:
|
||||
private:
|
||||
/// Debug.
|
||||
void dump() const;
|
||||
void dumpIntervals() const;
|
||||
void dumpBB(MachineBasicBlock *MBB) const;
|
||||
void dumpBV(const char *tag, const BitVector &BV) const;
|
||||
|
||||
/// Removes all of the lifetime marker instructions from the function.
|
||||
/// \returns true if any markers were removed.
|
||||
@ -179,49 +179,48 @@ char &llvm::StackColoringID = StackColoring::ID;
|
||||
|
||||
INITIALIZE_PASS_BEGIN(StackColoring,
|
||||
"stack-coloring", "Merge disjoint stack slots", false, false)
|
||||
INITIALIZE_PASS_DEPENDENCY(MachineDominatorTree)
|
||||
INITIALIZE_PASS_DEPENDENCY(SlotIndexes)
|
||||
INITIALIZE_PASS_DEPENDENCY(StackProtector)
|
||||
INITIALIZE_PASS_END(StackColoring,
|
||||
"stack-coloring", "Merge disjoint stack slots", false, false)
|
||||
|
||||
void StackColoring::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.addRequired<MachineDominatorTree>();
|
||||
AU.addPreserved<MachineDominatorTree>();
|
||||
AU.addRequired<SlotIndexes>();
|
||||
AU.addRequired<StackProtector>();
|
||||
MachineFunctionPass::getAnalysisUsage(AU);
|
||||
}
|
||||
|
||||
LLVM_DUMP_METHOD void StackColoring::dumpBV(const char *tag,
|
||||
const BitVector &BV) const {
|
||||
DEBUG(dbgs() << tag << " : { ");
|
||||
for (unsigned I = 0, E = BV.size(); I != E; ++I)
|
||||
DEBUG(dbgs() << BV.test(I) << " ");
|
||||
DEBUG(dbgs() << "}\n");
|
||||
}
|
||||
|
||||
LLVM_DUMP_METHOD void StackColoring::dumpBB(MachineBasicBlock *MBB) const {
|
||||
LivenessMap::const_iterator BI = BlockLiveness.find(MBB);
|
||||
assert(BI != BlockLiveness.end() && "Block not found");
|
||||
const BlockLifetimeInfo &BlockInfo = BI->second;
|
||||
|
||||
dumpBV("BEGIN", BlockInfo.Begin);
|
||||
dumpBV("END", BlockInfo.End);
|
||||
dumpBV("LIVE_IN", BlockInfo.LiveIn);
|
||||
dumpBV("LIVE_OUT", BlockInfo.LiveOut);
|
||||
}
|
||||
|
||||
LLVM_DUMP_METHOD void StackColoring::dump() const {
|
||||
for (MachineBasicBlock *MBB : depth_first(MF)) {
|
||||
DEBUG(dbgs() << "Inspecting block #" << BasicBlocks.lookup(MBB) << " ["
|
||||
DEBUG(dbgs() << "Inspecting block #" << MBB->getNumber() << " ["
|
||||
<< MBB->getName() << "]\n");
|
||||
DEBUG(dumpBB(MBB));
|
||||
}
|
||||
}
|
||||
|
||||
LivenessMap::const_iterator BI = BlockLiveness.find(MBB);
|
||||
assert(BI != BlockLiveness.end() && "Block not found");
|
||||
const BlockLifetimeInfo &BlockInfo = BI->second;
|
||||
|
||||
DEBUG(dbgs()<<"BEGIN : {");
|
||||
for (unsigned i=0; i < BlockInfo.Begin.size(); ++i)
|
||||
DEBUG(dbgs()<<BlockInfo.Begin.test(i)<<" ");
|
||||
DEBUG(dbgs()<<"}\n");
|
||||
|
||||
DEBUG(dbgs()<<"END : {");
|
||||
for (unsigned i=0; i < BlockInfo.End.size(); ++i)
|
||||
DEBUG(dbgs()<<BlockInfo.End.test(i)<<" ");
|
||||
|
||||
DEBUG(dbgs()<<"}\n");
|
||||
|
||||
DEBUG(dbgs()<<"LIVE_IN: {");
|
||||
for (unsigned i=0; i < BlockInfo.LiveIn.size(); ++i)
|
||||
DEBUG(dbgs()<<BlockInfo.LiveIn.test(i)<<" ");
|
||||
|
||||
DEBUG(dbgs()<<"}\n");
|
||||
DEBUG(dbgs()<<"LIVEOUT: {");
|
||||
for (unsigned i=0; i < BlockInfo.LiveOut.size(); ++i)
|
||||
DEBUG(dbgs()<<BlockInfo.LiveOut.test(i)<<" ");
|
||||
DEBUG(dbgs()<<"}\n");
|
||||
LLVM_DUMP_METHOD void StackColoring::dumpIntervals() const {
|
||||
for (unsigned I = 0, E = Intervals.size(); I != E; ++I) {
|
||||
DEBUG(dbgs() << "Interval[" << I << "]:\n");
|
||||
DEBUG(Intervals[I]->dump());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user