1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

Doxygen-ify comments.

llvm-svn: 62546
This commit is contained in:
Bill Wendling 2009-01-19 23:43:56 +00:00
parent 7c2157602d
commit 5281f4fb64

View File

@ -74,11 +74,11 @@ static void AddPredecessorToBlock(BasicBlock *Succ, BasicBlock *NewPred,
PN->addIncoming(PN->getIncomingValueForBlock(ExistPred), NewPred); PN->addIncoming(PN->getIncomingValueForBlock(ExistPred), NewPred);
} }
// CanPropagatePredecessorsForPHIs - Return true if we can fold BB, an /// CanPropagatePredecessorsForPHIs - Return true if we can fold BB, an
// almost-empty BB ending in an unconditional branch to Succ, into succ. /// almost-empty BB ending in an unconditional branch to Succ, into succ.
// ///
// Assumption: Succ is the single successor for BB. /// Assumption: Succ is the single successor for BB.
// ///
static bool CanPropagatePredecessorsForPHIs(BasicBlock *BB, BasicBlock *Succ) { static bool CanPropagatePredecessorsForPHIs(BasicBlock *BB, BasicBlock *Succ) {
assert(*succ_begin(BB) == Succ && "Succ is not successor of BB!"); assert(*succ_begin(BB) == Succ && "Succ is not successor of BB!");
@ -347,15 +347,15 @@ static Value *GetIfCondition(BasicBlock *BB,
} }
// If we have a merge point of an "if condition" as accepted above, return true /// DominatesMergePoint - If we have a merge point of an "if condition" as
// if the specified value dominates the block. We don't handle the true /// accepted above, return true if the specified value dominates the block. We
// generality of domination here, just a special case which works well enough /// don't handle the true generality of domination here, just a special case
// for us. /// which works well enough for us.
// ///
// If AggressiveInsts is non-null, and if V does not dominate BB, we check to /// If AggressiveInsts is non-null, and if V does not dominate BB, we check to
// see if V (which must be an instruction) is cheap to compute and is /// see if V (which must be an instruction) is cheap to compute and is
// non-trapping. If both are true, the instruction is inserted into the set and /// non-trapping. If both are true, the instruction is inserted into the set
// true is returned. /// and true is returned.
static bool DominatesMergePoint(Value *V, BasicBlock *BB, static bool DominatesMergePoint(Value *V, BasicBlock *BB,
std::set<Instruction*> *AggressiveInsts) { std::set<Instruction*> *AggressiveInsts) {
Instruction *I = dyn_cast<Instruction>(V); Instruction *I = dyn_cast<Instruction>(V);
@ -426,9 +426,9 @@ static bool DominatesMergePoint(Value *V, BasicBlock *BB,
return true; return true;
} }
// GatherConstantSetEQs - Given a potentially 'or'd together collection of /// GatherConstantSetEQs - Given a potentially 'or'd together collection of
// icmp_eq instructions that compare a value against a constant, return the /// icmp_eq instructions that compare a value against a constant, return the
// value being compared, and stick the constant into the Values vector. /// value being compared, and stick the constant into the Values vector.
static Value *GatherConstantSetEQs(Value *V, std::vector<ConstantInt*> &Values){ static Value *GatherConstantSetEQs(Value *V, std::vector<ConstantInt*> &Values){
if (Instruction *Inst = dyn_cast<Instruction>(V)) { if (Instruction *Inst = dyn_cast<Instruction>(V)) {
if (Inst->getOpcode() == Instruction::ICmp && if (Inst->getOpcode() == Instruction::ICmp &&
@ -450,9 +450,9 @@ static Value *GatherConstantSetEQs(Value *V, std::vector<ConstantInt*> &Values){
return 0; return 0;
} }
// GatherConstantSetNEs - Given a potentially 'and'd together collection of /// GatherConstantSetNEs - Given a potentially 'and'd together collection of
// setne instructions that compare a value against a constant, return the value /// setne instructions that compare a value against a constant, return the value
// being compared, and stick the constant into the Values vector. /// being compared, and stick the constant into the Values vector.
static Value *GatherConstantSetNEs(Value *V, std::vector<ConstantInt*> &Values){ static Value *GatherConstantSetNEs(Value *V, std::vector<ConstantInt*> &Values){
if (Instruction *Inst = dyn_cast<Instruction>(V)) { if (Instruction *Inst = dyn_cast<Instruction>(V)) {
if (Inst->getOpcode() == Instruction::ICmp && if (Inst->getOpcode() == Instruction::ICmp &&
@ -474,8 +474,6 @@ static Value *GatherConstantSetNEs(Value *V, std::vector<ConstantInt*> &Values){
return 0; return 0;
} }
/// GatherValueComparisons - If the specified Cond is an 'and' or 'or' of a /// GatherValueComparisons - If the specified Cond is an 'and' or 'or' of a
/// bunch of comparisons of one value against constants, return the value and /// bunch of comparisons of one value against constants, return the value and
/// the constants being compared. /// the constants being compared.
@ -532,8 +530,8 @@ static Value *isValueEqualityComparison(TerminatorInst *TI) {
return 0; return 0;
} }
/// Given a value comparison instruction, decode all of the 'cases' that it /// GetValueEqualityComparisonCases - Given a value comparison instruction,
/// represents and return the 'default' block. /// decode all of the 'cases' that it represents and return the 'default' block.
static BasicBlock * static BasicBlock *
GetValueEqualityComparisonCases(TerminatorInst *TI, GetValueEqualityComparisonCases(TerminatorInst *TI,
std::vector<std::pair<ConstantInt*, std::vector<std::pair<ConstantInt*,
@ -554,8 +552,8 @@ GetValueEqualityComparisonCases(TerminatorInst *TI,
} }
// EliminateBlockCases - Given a vector of bb/value pairs, remove any entries /// EliminateBlockCases - Given a vector of bb/value pairs, remove any entries
// in the list that match the specified block. /// in the list that match the specified block.
static void EliminateBlockCases(BasicBlock *BB, static void EliminateBlockCases(BasicBlock *BB,
std::vector<std::pair<ConstantInt*, BasicBlock*> > &Cases) { std::vector<std::pair<ConstantInt*, BasicBlock*> > &Cases) {
for (unsigned i = 0, e = Cases.size(); i != e; ++i) for (unsigned i = 0, e = Cases.size(); i != e; ++i)
@ -565,8 +563,8 @@ static void EliminateBlockCases(BasicBlock *BB,
} }
} }
// ValuesOverlap - Return true if there are any keys in C1 that exist in C2 as /// ValuesOverlap - Return true if there are any keys in C1 that exist in C2 as
// well. /// well.
static bool static bool
ValuesOverlap(std::vector<std::pair<ConstantInt*, BasicBlock*> > &C1, ValuesOverlap(std::vector<std::pair<ConstantInt*, BasicBlock*> > &C1,
std::vector<std::pair<ConstantInt*, BasicBlock*> > &C2) { std::vector<std::pair<ConstantInt*, BasicBlock*> > &C2) {
@ -600,12 +598,12 @@ ValuesOverlap(std::vector<std::pair<ConstantInt*, BasicBlock*> > &C1,
return false; return false;
} }
// SimplifyEqualityComparisonWithOnlyPredecessor - If TI is known to be a /// SimplifyEqualityComparisonWithOnlyPredecessor - If TI is known to be a
// terminator instruction and its block is known to only have a single /// terminator instruction and its block is known to only have a single
// predecessor block, check to see if that predecessor is also a value /// predecessor block, check to see if that predecessor is also a value
// comparison with the same value, and if that comparison determines the outcome /// comparison with the same value, and if that comparison determines the
// of this comparison. If so, simplify TI. This does a very limited form of /// outcome of this comparison. If so, simplify TI. This does a very limited
// jump threading. /// form of jump threading.
static bool SimplifyEqualityComparisonWithOnlyPredecessor(TerminatorInst *TI, static bool SimplifyEqualityComparisonWithOnlyPredecessor(TerminatorInst *TI,
BasicBlock *Pred) { BasicBlock *Pred) {
Value *PredVal = isValueEqualityComparison(Pred->getTerminator()); Value *PredVal = isValueEqualityComparison(Pred->getTerminator());
@ -716,10 +714,10 @@ static bool SimplifyEqualityComparisonWithOnlyPredecessor(TerminatorInst *TI,
return false; return false;
} }
// FoldValueComparisonIntoPredecessors - The specified terminator is a value /// FoldValueComparisonIntoPredecessors - The specified terminator is a value
// equality comparison instruction (either a switch or a branch on "X == c"). /// equality comparison instruction (either a switch or a branch on "X == c").
// See if any of the predecessors of the terminator block are value comparisons /// See if any of the predecessors of the terminator block are value comparisons
// on the same value. If so, and if safe to do so, fold them together. /// on the same value. If so, and if safe to do so, fold them together.
static bool FoldValueComparisonIntoPredecessors(TerminatorInst *TI) { static bool FoldValueComparisonIntoPredecessors(TerminatorInst *TI) {
BasicBlock *BB = TI->getParent(); BasicBlock *BB = TI->getParent();
Value *CV = isValueEqualityComparison(TI); // CondVal Value *CV = isValueEqualityComparison(TI); // CondVal
@ -1684,13 +1682,13 @@ namespace {
}; };
} }
// SimplifyCFG - This function is used to do simplification of a CFG. For /// SimplifyCFG - This function is used to do simplification of a CFG. For
// example, it adjusts branches to branches to eliminate the extra hop, it /// example, it adjusts branches to branches to eliminate the extra hop, it
// eliminates unreachable basic blocks, and does other "peephole" optimization /// eliminates unreachable basic blocks, and does other "peephole" optimization
// of the CFG. It returns true if a modification was made. /// of the CFG. It returns true if a modification was made.
// ///
// WARNING: The entry node of a function may not be simplified. /// WARNING: The entry node of a function may not be simplified.
// ///
bool llvm::SimplifyCFG(BasicBlock *BB) { bool llvm::SimplifyCFG(BasicBlock *BB) {
bool Changed = false; bool Changed = false;
Function *M = BB->getParent(); Function *M = BB->getParent();