Clean up.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37237 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2007-05-18 19:32:08 +00:00
parent 36489bbbac
commit 7f8ff8af1a

View File

@ -74,7 +74,7 @@ namespace {
void StructuralAnalysis(MachineBasicBlock *BB); void StructuralAnalysis(MachineBasicBlock *BB);
void FeasibilityAnalysis(BBInfo &BBI); void FeasibilityAnalysis(BBInfo &BBI);
void InitialFunctionAnalysis(MachineFunction &MF, void InitialFunctionAnalysis(MachineFunction &MF,
std::vector<int> &Candidates); std::vector<BBInfo*> &Candidates);
bool IfConvertTriangle(BBInfo &BBI); bool IfConvertTriangle(BBInfo &BBI);
bool IfConvertDiamond(BBInfo &BBI); bool IfConvertDiamond(BBInfo &BBI);
void PredicateBlock(MachineBasicBlock *BB, void PredicateBlock(MachineBasicBlock *BB,
@ -96,14 +96,14 @@ bool IfConverter::runOnMachineFunction(MachineFunction &MF) {
unsigned NumBBs = MF.getNumBlockIDs(); unsigned NumBBs = MF.getNumBlockIDs();
BBAnalysis.resize(NumBBs); BBAnalysis.resize(NumBBs);
std::vector<int> Candidates; std::vector<BBInfo*> Candidates;
// Do an intial analysis for each basic block and finding all the potential // Do an intial analysis for each basic block and finding all the potential
// candidates to perform if-convesion. // candidates to perform if-convesion.
InitialFunctionAnalysis(MF, Candidates); InitialFunctionAnalysis(MF, Candidates);
MadeChange = false; MadeChange = false;
for (unsigned i = 0, e = Candidates.size(); i != e; ++i) { for (unsigned i = 0, e = Candidates.size(); i != e; ++i) {
BBInfo &BBI = BBAnalysis[Candidates[i]]; BBInfo &BBI = *Candidates[i];
switch (BBI.Kind) { switch (BBI.Kind) {
default: assert(false && "Unexpected!"); default: assert(false && "Unexpected!");
break; break;
@ -237,7 +237,7 @@ void IfConverter::FeasibilityAnalysis(BBInfo &BBI) {
/// InitialFunctionAnalysis - Analyze all blocks and find entries for all /// InitialFunctionAnalysis - Analyze all blocks and find entries for all
/// if-conversion candidates. /// if-conversion candidates.
void IfConverter::InitialFunctionAnalysis(MachineFunction &MF, void IfConverter::InitialFunctionAnalysis(MachineFunction &MF,
std::vector<int> &Candidates) { std::vector<BBInfo*> &Candidates) {
std::set<MachineBasicBlock*> Visited; std::set<MachineBasicBlock*> Visited;
MachineBasicBlock *Entry = MF.begin(); MachineBasicBlock *Entry = MF.begin();
for (df_ext_iterator<MachineBasicBlock*> DFI = df_ext_begin(Entry, Visited), for (df_ext_iterator<MachineBasicBlock*> DFI = df_ext_begin(Entry, Visited),
@ -246,7 +246,7 @@ void IfConverter::InitialFunctionAnalysis(MachineFunction &MF,
StructuralAnalysis(BB); StructuralAnalysis(BB);
BBInfo &BBI = BBAnalysis[BB->getNumber()]; BBInfo &BBI = BBAnalysis[BB->getNumber()];
if (BBI.Kind == ICTriangleEntry || BBI.Kind == ICDiamondEntry) if (BBI.Kind == ICTriangleEntry || BBI.Kind == ICDiamondEntry)
Candidates.push_back(BB->getNumber()); Candidates.push_back(&BBI);
} }
} }