mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-14 09:38:40 +00:00
Fix spelling of `propagate'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4423 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
81619b121c
commit
a3bbcb5b66
@ -621,7 +621,7 @@ that returns a value that does not match the return type of the function.<p>
|
|||||||
|
|
||||||
When the '<tt>ret</tt>' instruction is executed, control flow returns back to
|
When the '<tt>ret</tt>' instruction is executed, control flow returns back to
|
||||||
the calling function's context. If the instruction returns a value, that value
|
the calling function's context. If the instruction returns a value, that value
|
||||||
shall be propogated into the calling function's data space.<p>
|
shall be propagated into the calling function's data space.<p>
|
||||||
|
|
||||||
<h5>Example:</h5>
|
<h5>Example:</h5>
|
||||||
<pre>
|
<pre>
|
||||||
@ -1700,7 +1700,7 @@ more...
|
|||||||
<address><a href="mailto:sabre@nondot.org">Chris Lattner</a></address>
|
<address><a href="mailto:sabre@nondot.org">Chris Lattner</a></address>
|
||||||
<!-- Created: Tue Jan 23 15:19:28 CST 2001 -->
|
<!-- Created: Tue Jan 23 15:19:28 CST 2001 -->
|
||||||
<!-- hhmts start -->
|
<!-- hhmts start -->
|
||||||
Last modified: Tue Sep 17 21:34:30 CDT 2002
|
Last modified: Tue Oct 29 01:57:05 CST 2002
|
||||||
<!-- hhmts end -->
|
<!-- hhmts end -->
|
||||||
</font>
|
</font>
|
||||||
</body></html>
|
</body></html>
|
||||||
|
@ -44,7 +44,7 @@ void IntervalPartition::addIntervalToPartition(Interval *I) {
|
|||||||
|
|
||||||
// updatePredecessors - Interval generation only sets the successor fields of
|
// updatePredecessors - Interval generation only sets the successor fields of
|
||||||
// the interval data structures. After interval generation is complete,
|
// the interval data structures. After interval generation is complete,
|
||||||
// run through all of the intervals and propogate successor info as
|
// run through all of the intervals and propagate successor info as
|
||||||
// predecessor info.
|
// predecessor info.
|
||||||
//
|
//
|
||||||
void IntervalPartition::updatePredecessors(Interval *Int) {
|
void IntervalPartition::updatePredecessors(Interval *Int) {
|
||||||
@ -70,7 +70,7 @@ bool IntervalPartition::runOnFunction(Function &F) {
|
|||||||
for_each(I, intervals_end(&F),
|
for_each(I, intervals_end(&F),
|
||||||
bind_obj(this, &IntervalPartition::addIntervalToPartition));
|
bind_obj(this, &IntervalPartition::addIntervalToPartition));
|
||||||
|
|
||||||
// Now that we know all of the successor information, propogate this to the
|
// Now that we know all of the successor information, propagate this to the
|
||||||
// predecessors for each block...
|
// predecessors for each block...
|
||||||
for_each(Intervals.begin(), Intervals.end(),
|
for_each(Intervals.begin(), Intervals.end(),
|
||||||
bind_obj(this, &IntervalPartition::updatePredecessors));
|
bind_obj(this, &IntervalPartition::updatePredecessors));
|
||||||
@ -98,7 +98,7 @@ IntervalPartition::IntervalPartition(IntervalPartition &IP, bool) {
|
|||||||
for_each(I, intervals_end(IP),
|
for_each(I, intervals_end(IP),
|
||||||
bind_obj(this, &IntervalPartition::addIntervalToPartition));
|
bind_obj(this, &IntervalPartition::addIntervalToPartition));
|
||||||
|
|
||||||
// Now that we know all of the successor information, propogate this to the
|
// Now that we know all of the successor information, propagate this to the
|
||||||
// predecessors for each block...
|
// predecessors for each block...
|
||||||
for_each(Intervals.begin(), Intervals.end(),
|
for_each(Intervals.begin(), Intervals.end(),
|
||||||
bind_obj(this, &IntervalPartition::updatePredecessors));
|
bind_obj(this, &IntervalPartition::updatePredecessors));
|
||||||
|
@ -197,7 +197,7 @@ bool BBLiveVar::setPropagate(ValueSet *OutSet, const ValueSet *InSet,
|
|||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// propogates in set to OutSets of PREDECESSORs
|
// propagates in set to OutSets of PREDECESSORs
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool BBLiveVar::applyFlowFunc() {
|
bool BBLiveVar::applyFlowFunc() {
|
||||||
|
@ -38,7 +38,7 @@ class BBLiveVar : public Annotation {
|
|||||||
// treated differently from ordinary uses.
|
// treated differently from ordinary uses.
|
||||||
std::map<const BasicBlock *, ValueSet> PredToEdgeInSetMap;
|
std::map<const BasicBlock *, ValueSet> PredToEdgeInSetMap;
|
||||||
|
|
||||||
// method to propogate an InSet to OutSet of a predecessor
|
// method to propagate an InSet to OutSet of a predecessor
|
||||||
bool setPropagate(ValueSet *OutSetOfPred,
|
bool setPropagate(ValueSet *OutSetOfPred,
|
||||||
const ValueSet *InSetOfThisBB,
|
const ValueSet *InSetOfThisBB,
|
||||||
const BasicBlock *PredBB);
|
const BasicBlock *PredBB);
|
||||||
|
@ -197,7 +197,7 @@ bool BBLiveVar::setPropagate(ValueSet *OutSet, const ValueSet *InSet,
|
|||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// propogates in set to OutSets of PREDECESSORs
|
// propagates in set to OutSets of PREDECESSORs
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool BBLiveVar::applyFlowFunc() {
|
bool BBLiveVar::applyFlowFunc() {
|
||||||
|
@ -38,7 +38,7 @@ class BBLiveVar : public Annotation {
|
|||||||
// treated differently from ordinary uses.
|
// treated differently from ordinary uses.
|
||||||
std::map<const BasicBlock *, ValueSet> PredToEdgeInSetMap;
|
std::map<const BasicBlock *, ValueSet> PredToEdgeInSetMap;
|
||||||
|
|
||||||
// method to propogate an InSet to OutSet of a predecessor
|
// method to propagate an InSet to OutSet of a predecessor
|
||||||
bool setPropagate(ValueSet *OutSetOfPred,
|
bool setPropagate(ValueSet *OutSetOfPred,
|
||||||
const ValueSet *InSetOfThisBB,
|
const ValueSet *InSetOfThisBB,
|
||||||
const BasicBlock *PredBB);
|
const BasicBlock *PredBB);
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
//===- CorrelatedExprs.cpp - Pass to detect and eliminated c.e.'s ---------===//
|
//===- CorrelatedExprs.cpp - Pass to detect and eliminated c.e.'s ---------===//
|
||||||
//
|
//
|
||||||
// Correlated Expression Elimination propogates information from conditional
|
// Correlated Expression Elimination propagates information from conditional
|
||||||
// branches to blocks dominated by destinations of the branch. It propogates
|
// branches to blocks dominated by destinations of the branch. It propagates
|
||||||
// information from the condition check itself into the body of the branch,
|
// information from the condition check itself into the body of the branch,
|
||||||
// allowing transformations like these for example:
|
// allowing transformations like these for example:
|
||||||
//
|
//
|
||||||
// if (i == 7)
|
// if (i == 7)
|
||||||
// ... 4*i; // constant propogation
|
// ... 4*i; // constant propagation
|
||||||
//
|
//
|
||||||
// M = i+1; N = j+1;
|
// M = i+1; N = j+1;
|
||||||
// if (i == j)
|
// if (i == j)
|
||||||
@ -91,7 +91,7 @@ namespace {
|
|||||||
// kept sorted by the Val field.
|
// kept sorted by the Val field.
|
||||||
std::vector<Relation> Relationships;
|
std::vector<Relation> Relationships;
|
||||||
|
|
||||||
// If information about this value is known or propogated from constant
|
// If information about this value is known or propagated from constant
|
||||||
// expressions, this range contains the possible values this value may hold.
|
// expressions, this range contains the possible values this value may hold.
|
||||||
ConstantRange Bounds;
|
ConstantRange Bounds;
|
||||||
|
|
||||||
@ -254,9 +254,9 @@ namespace {
|
|||||||
void InsertRegionExitMerges(PHINode *NewPHI, Instruction *OldVal,
|
void InsertRegionExitMerges(PHINode *NewPHI, Instruction *OldVal,
|
||||||
const std::vector<BasicBlock*> &RegionExitBlocks);
|
const std::vector<BasicBlock*> &RegionExitBlocks);
|
||||||
|
|
||||||
void PropogateBranchInfo(BranchInst *BI);
|
void PropagateBranchInfo(BranchInst *BI);
|
||||||
void PropogateEquality(Value *Op0, Value *Op1, RegionInfo &RI);
|
void PropagateEquality(Value *Op0, Value *Op1, RegionInfo &RI);
|
||||||
void PropogateRelation(Instruction::BinaryOps Opcode, Value *Op0,
|
void PropagateRelation(Instruction::BinaryOps Opcode, Value *Op0,
|
||||||
Value *Op1, RegionInfo &RI);
|
Value *Op1, RegionInfo &RI);
|
||||||
void UpdateUsersOfValue(Value *V, RegionInfo &RI);
|
void UpdateUsersOfValue(Value *V, RegionInfo &RI);
|
||||||
void IncorporateInstruction(Instruction *Inst, RegionInfo &RI);
|
void IncorporateInstruction(Instruction *Inst, RegionInfo &RI);
|
||||||
@ -331,11 +331,11 @@ bool CEE::TransformRegion(BasicBlock *BB, std::set<BasicBlock*> &VisitedBlocks){
|
|||||||
|
|
||||||
// Loop over all of the blocks that this block is the immediate dominator for.
|
// Loop over all of the blocks that this block is the immediate dominator for.
|
||||||
// Because all information known in this region is also known in all of the
|
// Because all information known in this region is also known in all of the
|
||||||
// blocks that are dominated by this one, we can safely propogate the
|
// blocks that are dominated by this one, we can safely propagate the
|
||||||
// information down now.
|
// information down now.
|
||||||
//
|
//
|
||||||
DominatorTree::Node *BBN = (*DT)[BB];
|
DominatorTree::Node *BBN = (*DT)[BB];
|
||||||
if (!RI.empty()) // Time opt: only propogate if we can change something
|
if (!RI.empty()) // Time opt: only propagate if we can change something
|
||||||
for (unsigned i = 0, e = BBN->getChildren().size(); i != e; ++i) {
|
for (unsigned i = 0, e = BBN->getChildren().size(); i != e; ++i) {
|
||||||
BasicBlock *Dominated = BBN->getChildren()[i]->getNode();
|
BasicBlock *Dominated = BBN->getChildren()[i]->getNode();
|
||||||
assert(RegionInfoMap.find(Dominated) == RegionInfoMap.end() &&
|
assert(RegionInfoMap.find(Dominated) == RegionInfoMap.end() &&
|
||||||
@ -344,11 +344,11 @@ bool CEE::TransformRegion(BasicBlock *BB, std::set<BasicBlock*> &VisitedBlocks){
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now that all of our successors have information if they deserve it,
|
// Now that all of our successors have information if they deserve it,
|
||||||
// propogate any information our terminator instruction finds to our
|
// propagate any information our terminator instruction finds to our
|
||||||
// successors.
|
// successors.
|
||||||
if (BranchInst *BI = dyn_cast<BranchInst>(TI))
|
if (BranchInst *BI = dyn_cast<BranchInst>(TI))
|
||||||
if (BI->isConditional())
|
if (BI->isConditional())
|
||||||
PropogateBranchInfo(BI);
|
PropagateBranchInfo(BI);
|
||||||
|
|
||||||
// If this is a branch to a block outside our region that simply performs
|
// If this is a branch to a block outside our region that simply performs
|
||||||
// another conditional branch, one whose outcome is known inside of this
|
// another conditional branch, one whose outcome is known inside of this
|
||||||
@ -453,11 +453,11 @@ bool CEE::ForwardCorrelatedEdgeDestination(TerminatorInst *TI, unsigned SuccNo,
|
|||||||
if (PHINode *PN = dyn_cast<PHINode>(&*I)) {
|
if (PHINode *PN = dyn_cast<PHINode>(&*I)) {
|
||||||
int OpNum = PN->getBasicBlockIndex(BB);
|
int OpNum = PN->getBasicBlockIndex(BB);
|
||||||
assert(OpNum != -1 && "PHI doesn't have incoming edge for predecessor!?");
|
assert(OpNum != -1 && "PHI doesn't have incoming edge for predecessor!?");
|
||||||
PropogateEquality(PN, PN->getIncomingValue(OpNum), NewRI);
|
PropagateEquality(PN, PN->getIncomingValue(OpNum), NewRI);
|
||||||
} else if (SetCondInst *SCI = dyn_cast<SetCondInst>(&*I)) {
|
} else if (SetCondInst *SCI = dyn_cast<SetCondInst>(&*I)) {
|
||||||
Relation::KnownResult Res = getSetCCResult(SCI, NewRI);
|
Relation::KnownResult Res = getSetCCResult(SCI, NewRI);
|
||||||
if (Res == Relation::Unknown) return false;
|
if (Res == Relation::Unknown) return false;
|
||||||
PropogateEquality(SCI, ConstantBool::get(Res), NewRI);
|
PropagateEquality(SCI, ConstantBool::get(Res), NewRI);
|
||||||
} else {
|
} else {
|
||||||
assert(isa<BranchInst>(*I) && "Unexpected instruction type!");
|
assert(isa<BranchInst>(*I) && "Unexpected instruction type!");
|
||||||
}
|
}
|
||||||
@ -760,30 +760,30 @@ void CEE::BuildRankMap(Function &F) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// PropogateBranchInfo - When this method is invoked, we need to propogate
|
// PropagateBranchInfo - When this method is invoked, we need to propagate
|
||||||
// information derived from the branch condition into the true and false
|
// information derived from the branch condition into the true and false
|
||||||
// branches of BI. Since we know that there aren't any critical edges in the
|
// branches of BI. Since we know that there aren't any critical edges in the
|
||||||
// flow graph, this can proceed unconditionally.
|
// flow graph, this can proceed unconditionally.
|
||||||
//
|
//
|
||||||
void CEE::PropogateBranchInfo(BranchInst *BI) {
|
void CEE::PropagateBranchInfo(BranchInst *BI) {
|
||||||
assert(BI->isConditional() && "Must be a conditional branch!");
|
assert(BI->isConditional() && "Must be a conditional branch!");
|
||||||
|
|
||||||
// Propogate information into the true block...
|
// Propagate information into the true block...
|
||||||
//
|
//
|
||||||
PropogateEquality(BI->getCondition(), ConstantBool::True,
|
PropagateEquality(BI->getCondition(), ConstantBool::True,
|
||||||
getRegionInfo(BI->getSuccessor(0)));
|
getRegionInfo(BI->getSuccessor(0)));
|
||||||
|
|
||||||
// Propogate information into the false block...
|
// Propagate information into the false block...
|
||||||
//
|
//
|
||||||
PropogateEquality(BI->getCondition(), ConstantBool::False,
|
PropagateEquality(BI->getCondition(), ConstantBool::False,
|
||||||
getRegionInfo(BI->getSuccessor(1)));
|
getRegionInfo(BI->getSuccessor(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// PropogateEquality - If we discover that two values are equal to each other in
|
// PropagateEquality - If we discover that two values are equal to each other in
|
||||||
// a specified region, propogate this knowledge recursively.
|
// a specified region, propagate this knowledge recursively.
|
||||||
//
|
//
|
||||||
void CEE::PropogateEquality(Value *Op0, Value *Op1, RegionInfo &RI) {
|
void CEE::PropagateEquality(Value *Op0, Value *Op1, RegionInfo &RI) {
|
||||||
if (Op0 == Op1) return; // Gee whiz. Are these really equal each other?
|
if (Op0 == Op1) return; // Gee whiz. Are these really equal each other?
|
||||||
|
|
||||||
if (isa<Constant>(Op0)) // Make sure the constant is always Op1
|
if (isa<Constant>(Op0)) // Make sure the constant is always Op1
|
||||||
@ -811,8 +811,8 @@ void CEE::PropogateEquality(Value *Op0, Value *Op1, RegionInfo &RI) {
|
|||||||
// as well.
|
// as well.
|
||||||
//
|
//
|
||||||
if (CB->getValue() && Inst->getOpcode() == Instruction::And) {
|
if (CB->getValue() && Inst->getOpcode() == Instruction::And) {
|
||||||
PropogateEquality(Inst->getOperand(0), CB, RI);
|
PropagateEquality(Inst->getOperand(0), CB, RI);
|
||||||
PropogateEquality(Inst->getOperand(1), CB, RI);
|
PropagateEquality(Inst->getOperand(1), CB, RI);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we know that this instruction is an OR instruction, and the result
|
// If we know that this instruction is an OR instruction, and the result
|
||||||
@ -820,8 +820,8 @@ void CEE::PropogateEquality(Value *Op0, Value *Op1, RegionInfo &RI) {
|
|||||||
// as well.
|
// as well.
|
||||||
//
|
//
|
||||||
if (!CB->getValue() && Inst->getOpcode() == Instruction::Or) {
|
if (!CB->getValue() && Inst->getOpcode() == Instruction::Or) {
|
||||||
PropogateEquality(Inst->getOperand(0), CB, RI);
|
PropagateEquality(Inst->getOperand(0), CB, RI);
|
||||||
PropogateEquality(Inst->getOperand(1), CB, RI);
|
PropagateEquality(Inst->getOperand(1), CB, RI);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we know that this instruction is a NOT instruction, we know that the
|
// If we know that this instruction is a NOT instruction, we know that the
|
||||||
@ -829,48 +829,48 @@ void CEE::PropogateEquality(Value *Op0, Value *Op1, RegionInfo &RI) {
|
|||||||
//
|
//
|
||||||
if (BinaryOperator *BOp = dyn_cast<BinaryOperator>(Inst))
|
if (BinaryOperator *BOp = dyn_cast<BinaryOperator>(Inst))
|
||||||
if (BinaryOperator::isNot(BOp))
|
if (BinaryOperator::isNot(BOp))
|
||||||
PropogateEquality(BinaryOperator::getNotArgument(BOp),
|
PropagateEquality(BinaryOperator::getNotArgument(BOp),
|
||||||
ConstantBool::get(!CB->getValue()), RI);
|
ConstantBool::get(!CB->getValue()), RI);
|
||||||
|
|
||||||
// If we know the value of a SetCC instruction, propogate the information
|
// If we know the value of a SetCC instruction, propagate the information
|
||||||
// about the relation into this region as well.
|
// about the relation into this region as well.
|
||||||
//
|
//
|
||||||
if (SetCondInst *SCI = dyn_cast<SetCondInst>(Inst)) {
|
if (SetCondInst *SCI = dyn_cast<SetCondInst>(Inst)) {
|
||||||
if (CB->getValue()) { // If we know the condition is true...
|
if (CB->getValue()) { // If we know the condition is true...
|
||||||
// Propogate info about the LHS to the RHS & RHS to LHS
|
// Propagate info about the LHS to the RHS & RHS to LHS
|
||||||
PropogateRelation(SCI->getOpcode(), SCI->getOperand(0),
|
PropagateRelation(SCI->getOpcode(), SCI->getOperand(0),
|
||||||
SCI->getOperand(1), RI);
|
SCI->getOperand(1), RI);
|
||||||
PropogateRelation(SCI->getSwappedCondition(),
|
PropagateRelation(SCI->getSwappedCondition(),
|
||||||
SCI->getOperand(1), SCI->getOperand(0), RI);
|
SCI->getOperand(1), SCI->getOperand(0), RI);
|
||||||
|
|
||||||
} else { // If we know the condition is false...
|
} else { // If we know the condition is false...
|
||||||
// We know the opposite of the condition is true...
|
// We know the opposite of the condition is true...
|
||||||
Instruction::BinaryOps C = SCI->getInverseCondition();
|
Instruction::BinaryOps C = SCI->getInverseCondition();
|
||||||
|
|
||||||
PropogateRelation(C, SCI->getOperand(0), SCI->getOperand(1), RI);
|
PropagateRelation(C, SCI->getOperand(0), SCI->getOperand(1), RI);
|
||||||
PropogateRelation(SetCondInst::getSwappedCondition(C),
|
PropagateRelation(SetCondInst::getSwappedCondition(C),
|
||||||
SCI->getOperand(1), SCI->getOperand(0), RI);
|
SCI->getOperand(1), SCI->getOperand(0), RI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Propogate information about Op0 to Op1 & visa versa
|
// Propagate information about Op0 to Op1 & visa versa
|
||||||
PropogateRelation(Instruction::SetEQ, Op0, Op1, RI);
|
PropagateRelation(Instruction::SetEQ, Op0, Op1, RI);
|
||||||
PropogateRelation(Instruction::SetEQ, Op1, Op0, RI);
|
PropagateRelation(Instruction::SetEQ, Op1, Op0, RI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// PropogateRelation - We know that the specified relation is true in all of the
|
// PropagateRelation - We know that the specified relation is true in all of the
|
||||||
// blocks in the specified region. Propogate the information about Op0 and
|
// blocks in the specified region. Propagate the information about Op0 and
|
||||||
// anything derived from it into this region.
|
// anything derived from it into this region.
|
||||||
//
|
//
|
||||||
void CEE::PropogateRelation(Instruction::BinaryOps Opcode, Value *Op0,
|
void CEE::PropagateRelation(Instruction::BinaryOps Opcode, Value *Op0,
|
||||||
Value *Op1, RegionInfo &RI) {
|
Value *Op1, RegionInfo &RI) {
|
||||||
assert(Op0->getType() == Op1->getType() && "Equal types expected!");
|
assert(Op0->getType() == Op1->getType() && "Equal types expected!");
|
||||||
|
|
||||||
// Constants are already pretty well understood. We will apply information
|
// Constants are already pretty well understood. We will apply information
|
||||||
// about the constant to Op1 in another call to PropogateRelation.
|
// about the constant to Op1 in another call to PropagateRelation.
|
||||||
//
|
//
|
||||||
if (isa<Constant>(Op0)) return;
|
if (isa<Constant>(Op0)) return;
|
||||||
|
|
||||||
@ -896,7 +896,7 @@ void CEE::PropogateRelation(Instruction::BinaryOps Opcode, Value *Op0,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the information propogted is new, then we want process the uses of this
|
// If the information propogted is new, then we want process the uses of this
|
||||||
// instruction to propogate the information down to them.
|
// instruction to propagate the information down to them.
|
||||||
//
|
//
|
||||||
if (Op1R.incorporate(Opcode, VI))
|
if (Op1R.incorporate(Opcode, VI))
|
||||||
UpdateUsersOfValue(Op0, RI);
|
UpdateUsersOfValue(Op0, RI);
|
||||||
@ -904,16 +904,16 @@ void CEE::PropogateRelation(Instruction::BinaryOps Opcode, Value *Op0,
|
|||||||
|
|
||||||
|
|
||||||
// UpdateUsersOfValue - The information about V in this region has been updated.
|
// UpdateUsersOfValue - The information about V in this region has been updated.
|
||||||
// Propogate this to all consumers of the value.
|
// Propagate this to all consumers of the value.
|
||||||
//
|
//
|
||||||
void CEE::UpdateUsersOfValue(Value *V, RegionInfo &RI) {
|
void CEE::UpdateUsersOfValue(Value *V, RegionInfo &RI) {
|
||||||
for (Value::use_iterator I = V->use_begin(), E = V->use_end();
|
for (Value::use_iterator I = V->use_begin(), E = V->use_end();
|
||||||
I != E; ++I)
|
I != E; ++I)
|
||||||
if (Instruction *Inst = dyn_cast<Instruction>(*I)) {
|
if (Instruction *Inst = dyn_cast<Instruction>(*I)) {
|
||||||
// If this is an instruction using a value that we know something about,
|
// If this is an instruction using a value that we know something about,
|
||||||
// try to propogate information to the value produced by the
|
// try to propagate information to the value produced by the
|
||||||
// instruction. We can only do this if it is an instruction we can
|
// instruction. We can only do this if it is an instruction we can
|
||||||
// propogate information for (a setcc for example), and we only WANT to
|
// propagate information for (a setcc for example), and we only WANT to
|
||||||
// do this if the instruction dominates this region.
|
// do this if the instruction dominates this region.
|
||||||
//
|
//
|
||||||
// If the instruction doesn't dominate this region, then it cannot be
|
// If the instruction doesn't dominate this region, then it cannot be
|
||||||
@ -937,7 +937,7 @@ void CEE::IncorporateInstruction(Instruction *Inst, RegionInfo &RI) {
|
|||||||
// See if we can figure out a result for this instruction...
|
// See if we can figure out a result for this instruction...
|
||||||
Relation::KnownResult Result = getSetCCResult(SCI, RI);
|
Relation::KnownResult Result = getSetCCResult(SCI, RI);
|
||||||
if (Result != Relation::Unknown) {
|
if (Result != Relation::Unknown) {
|
||||||
PropogateEquality(SCI, Result ? ConstantBool::True : ConstantBool::False,
|
PropagateEquality(SCI, Result ? ConstantBool::True : ConstantBool::False,
|
||||||
RI);
|
RI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -726,7 +726,7 @@ bool InstCombiner::runOnFunction(Function &F) {
|
|||||||
Instruction *I = WorkList.back(); // Get an instruction from the worklist
|
Instruction *I = WorkList.back(); // Get an instruction from the worklist
|
||||||
WorkList.pop_back();
|
WorkList.pop_back();
|
||||||
|
|
||||||
// Check to see if we can DCE or ConstantPropogate the instruction...
|
// Check to see if we can DCE or ConstantPropagate the instruction...
|
||||||
// Check to see if we can DIE the instruction...
|
// Check to see if we can DIE the instruction...
|
||||||
if (isInstructionTriviallyDead(I)) {
|
if (isInstructionTriviallyDead(I)) {
|
||||||
// Add operands to the worklist...
|
// Add operands to the worklist...
|
||||||
@ -742,7 +742,7 @@ bool InstCombiner::runOnFunction(Function &F) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Instruction isn't dead, see if we can constant propogate it...
|
// Instruction isn't dead, see if we can constant propagate it...
|
||||||
if (Constant *C = ConstantFoldInstruction(I)) {
|
if (Constant *C = ConstantFoldInstruction(I)) {
|
||||||
// Add operands to the worklist...
|
// Add operands to the worklist...
|
||||||
for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
|
for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
|
||||||
|
@ -482,7 +482,7 @@ void SCCP::visitCastInst(CastInst &I) {
|
|||||||
InstVal &VState = getValueState(V);
|
InstVal &VState = getValueState(V);
|
||||||
if (VState.isOverdefined()) { // Inherit overdefinedness of operand
|
if (VState.isOverdefined()) { // Inherit overdefinedness of operand
|
||||||
markOverdefined(&I);
|
markOverdefined(&I);
|
||||||
} else if (VState.isConstant()) { // Propogate constant value
|
} else if (VState.isConstant()) { // Propagate constant value
|
||||||
Constant *Result =
|
Constant *Result =
|
||||||
ConstantFoldCastInstruction(VState.getConstant(), I.getType());
|
ConstantFoldCastInstruction(VState.getConstant(), I.getType());
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ void ReplaceInstWithValue(BasicBlock::InstListType &BIL,
|
|||||||
// Delete the unneccesary instruction now...
|
// Delete the unneccesary instruction now...
|
||||||
BI = BIL.erase(BI);
|
BI = BIL.erase(BI);
|
||||||
|
|
||||||
// Make sure to propogate a name if there is one already...
|
// Make sure to propagate a name if there is one already...
|
||||||
if (OldName.size() && !V->hasName())
|
if (OldName.size() && !V->hasName())
|
||||||
V->setName(OldName, BIL.getParent()->getSymbolTable());
|
V->setName(OldName, BIL.getParent()->getSymbolTable());
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
// PropogatePredecessors - This gets "Succ" ready to have the predecessors from
|
// PropagatePredecessors - This gets "Succ" ready to have the predecessors from
|
||||||
// "BB". This is a little tricky because "Succ" has PHI nodes, which need to
|
// "BB". This is a little tricky because "Succ" has PHI nodes, which need to
|
||||||
// have extra slots added to them to hold the merge edges from BB's
|
// have extra slots added to them to hold the merge edges from BB's
|
||||||
// predecessors. This function returns true (failure) if the Succ BB already
|
// predecessors. This function returns true (failure) if the Succ BB already
|
||||||
@ -19,7 +19,7 @@
|
|||||||
//
|
//
|
||||||
// Assumption: Succ is the single successor for BB.
|
// Assumption: Succ is the single successor for BB.
|
||||||
//
|
//
|
||||||
static bool PropogatePredecessorsForPHIs(BasicBlock *BB, BasicBlock *Succ) {
|
static bool PropagatePredecessorsForPHIs(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!");
|
||||||
|
|
||||||
if (!isa<PHINode>(Succ->front()))
|
if (!isa<PHINode>(Succ->front()))
|
||||||
@ -112,7 +112,7 @@ bool SimplifyCFG(BasicBlock *BB) {
|
|||||||
// Be careful though, if this transformation fails (returns true) then
|
// Be careful though, if this transformation fails (returns true) then
|
||||||
// we cannot do this transformation!
|
// we cannot do this transformation!
|
||||||
//
|
//
|
||||||
if (!PropogatePredecessorsForPHIs(BB, Succ)) {
|
if (!PropagatePredecessorsForPHIs(BB, Succ)) {
|
||||||
//cerr << "Killing Trivial BB: \n" << BB;
|
//cerr << "Killing Trivial BB: \n" << BB;
|
||||||
BB->replaceAllUsesWith(Succ);
|
BB->replaceAllUsesWith(Succ);
|
||||||
std::string OldName = BB->getName();
|
std::string OldName = BB->getName();
|
||||||
|
@ -358,7 +358,7 @@ public:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// {start/end}Pass - Called when a pass is started, it just propogates
|
// {start/end}Pass - Called when a pass is started, it just propagates
|
||||||
// information up to the top level PassManagerT object to tell it that a pass
|
// information up to the top level PassManagerT object to tell it that a pass
|
||||||
// has started or ended. This is used to gather timing information about
|
// has started or ended. This is used to gather timing information about
|
||||||
// passes.
|
// passes.
|
||||||
@ -384,7 +384,7 @@ public:
|
|||||||
LastUseOf[I->second] = User; // Local pass, extend the lifetime
|
LastUseOf[I->second] = User; // Local pass, extend the lifetime
|
||||||
} else {
|
} else {
|
||||||
// Pass not in current available set, must be a higher level pass
|
// Pass not in current available set, must be a higher level pass
|
||||||
// available to us, propogate to parent pass manager... We tell the
|
// available to us, propagate to parent pass manager... We tell the
|
||||||
// parent that we (the passmanager) are using the analysis so that it
|
// parent that we (the passmanager) are using the analysis so that it
|
||||||
// frees the analysis AFTER this pass manager runs.
|
// frees the analysis AFTER this pass manager runs.
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user