mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-04 21:30:49 +00:00
whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141058 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b3c4e26dc5
commit
2aeb8027d6
@ -31,8 +31,8 @@ class ReturnInst;
|
|||||||
/// DeleteDeadBlock - Delete the specified block, which must have no
|
/// DeleteDeadBlock - Delete the specified block, which must have no
|
||||||
/// predecessors.
|
/// predecessors.
|
||||||
void DeleteDeadBlock(BasicBlock *BB);
|
void DeleteDeadBlock(BasicBlock *BB);
|
||||||
|
|
||||||
|
|
||||||
/// FoldSingleEntryPHINodes - We know that BB has one predecessor. If there are
|
/// FoldSingleEntryPHINodes - We know that BB has one predecessor. If there are
|
||||||
/// any single-entry PHI nodes in it, fold them away. This handles the case
|
/// any single-entry PHI nodes in it, fold them away. This handles the case
|
||||||
/// when all entries to the PHI nodes in a block are guaranteed equal, such as
|
/// when all entries to the PHI nodes in a block are guaranteed equal, such as
|
||||||
@ -75,7 +75,7 @@ void ReplaceInstWithInst(Instruction *From, Instruction *To);
|
|||||||
/// The output is added to Result, as pairs of <from,to> edge info.
|
/// The output is added to Result, as pairs of <from,to> edge info.
|
||||||
void FindFunctionBackedges(const Function &F,
|
void FindFunctionBackedges(const Function &F,
|
||||||
SmallVectorImpl<std::pair<const BasicBlock*,const BasicBlock*> > &Result);
|
SmallVectorImpl<std::pair<const BasicBlock*,const BasicBlock*> > &Result);
|
||||||
|
|
||||||
|
|
||||||
/// GetSuccessorNumber - Search for the specified successor of basic block BB
|
/// GetSuccessorNumber - Search for the specified successor of basic block BB
|
||||||
/// and return its position in the terminator instruction's list of
|
/// and return its position in the terminator instruction's list of
|
||||||
@ -97,10 +97,10 @@ bool isCriticalEdge(const TerminatorInst *TI, unsigned SuccNum,
|
|||||||
/// was split, null otherwise.
|
/// was split, null otherwise.
|
||||||
///
|
///
|
||||||
/// If MergeIdenticalEdges is true (not the default), *all* edges from TI to the
|
/// If MergeIdenticalEdges is true (not the default), *all* edges from TI to the
|
||||||
/// specified successor will be merged into the same critical edge block.
|
/// specified successor will be merged into the same critical edge block.
|
||||||
/// This is most commonly interesting with switch instructions, which may
|
/// This is most commonly interesting with switch instructions, which may
|
||||||
/// have many edges to any one destination. This ensures that all edges to that
|
/// have many edges to any one destination. This ensures that all edges to that
|
||||||
/// dest go to one block instead of each going to a different block, but isn't
|
/// dest go to one block instead of each going to a different block, but isn't
|
||||||
/// the standard definition of a "critical edge".
|
/// the standard definition of a "critical edge".
|
||||||
///
|
///
|
||||||
/// It is invalid to call this function on a critical edge that starts at an
|
/// It is invalid to call this function on a critical edge that starts at an
|
||||||
@ -147,8 +147,8 @@ inline BasicBlock *SplitCriticalEdge(BasicBlock *Src, BasicBlock *Dst,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// SplitEdge - Split the edge connecting specified block. Pass P must
|
/// SplitEdge - Split the edge connecting specified block. Pass P must
|
||||||
/// not be NULL.
|
/// not be NULL.
|
||||||
BasicBlock *SplitEdge(BasicBlock *From, BasicBlock *To, Pass *P);
|
BasicBlock *SplitEdge(BasicBlock *From, BasicBlock *To, Pass *P);
|
||||||
|
|
||||||
/// SplitBlock - Split the specified block at the specified instruction - every
|
/// SplitBlock - Split the specified block at the specified instruction - every
|
||||||
@ -157,7 +157,7 @@ BasicBlock *SplitEdge(BasicBlock *From, BasicBlock *To, Pass *P);
|
|||||||
/// the loop info is updated.
|
/// the loop info is updated.
|
||||||
///
|
///
|
||||||
BasicBlock *SplitBlock(BasicBlock *Old, Instruction *SplitPt, Pass *P);
|
BasicBlock *SplitBlock(BasicBlock *Old, Instruction *SplitPt, Pass *P);
|
||||||
|
|
||||||
/// SplitBlockPredecessors - This method transforms BB by introducing a new
|
/// SplitBlockPredecessors - This method transforms BB by introducing a new
|
||||||
/// basic block into the function, and moving some of the predecessors of BB to
|
/// basic block into the function, and moving some of the predecessors of BB to
|
||||||
/// be predecessors of the new block. The new predecessors are indicated by the
|
/// be predecessors of the new block. The new predecessors are indicated by the
|
||||||
@ -180,13 +180,13 @@ BasicBlock *SplitBlockPredecessors(BasicBlock *BB, BasicBlock *const *Preds,
|
|||||||
/// block gets the remaining predecessors of OrigBB. The landingpad instruction
|
/// block gets the remaining predecessors of OrigBB. The landingpad instruction
|
||||||
/// OrigBB is clone into both of the new basic blocks. The new blocks are given
|
/// OrigBB is clone into both of the new basic blocks. The new blocks are given
|
||||||
/// the suffixes 'Suffix1' and 'Suffix2', and are returned in the NewBBs vector.
|
/// the suffixes 'Suffix1' and 'Suffix2', and are returned in the NewBBs vector.
|
||||||
///
|
///
|
||||||
/// This currently updates the LLVM IR, AliasAnalysis, DominatorTree,
|
/// This currently updates the LLVM IR, AliasAnalysis, DominatorTree,
|
||||||
/// DominanceFrontier, LoopInfo, and LCCSA but no other analyses. In particular,
|
/// DominanceFrontier, LoopInfo, and LCCSA but no other analyses. In particular,
|
||||||
/// it does not preserve LoopSimplify (because it's complicated to handle the
|
/// it does not preserve LoopSimplify (because it's complicated to handle the
|
||||||
/// case where one of the edges being split is an exit of a loop with other
|
/// case where one of the edges being split is an exit of a loop with other
|
||||||
/// exits).
|
/// exits).
|
||||||
///
|
///
|
||||||
void SplitLandingPadPredecessors(BasicBlock *OrigBB,ArrayRef<BasicBlock*> Preds,
|
void SplitLandingPadPredecessors(BasicBlock *OrigBB,ArrayRef<BasicBlock*> Preds,
|
||||||
const char *Suffix, const char *Suffix2,
|
const char *Suffix, const char *Suffix2,
|
||||||
Pass *P, SmallVectorImpl<BasicBlock*> &NewBBs);
|
Pass *P, SmallVectorImpl<BasicBlock*> &NewBBs);
|
||||||
@ -199,7 +199,7 @@ void SplitLandingPadPredecessors(BasicBlock *OrigBB,ArrayRef<BasicBlock*> Preds,
|
|||||||
ReturnInst *FoldReturnIntoUncondBranch(ReturnInst *RI, BasicBlock *BB,
|
ReturnInst *FoldReturnIntoUncondBranch(ReturnInst *RI, BasicBlock *BB,
|
||||||
BasicBlock *Pred);
|
BasicBlock *Pred);
|
||||||
|
|
||||||
/// GetFirstDebugLocInBasicBlock - Return first valid DebugLoc entry in a
|
/// GetFirstDebugLocInBasicBlock - Return first valid DebugLoc entry in a
|
||||||
/// given basic block.
|
/// given basic block.
|
||||||
DebugLoc GetFirstDebugLocInBasicBlock(const BasicBlock *BB);
|
DebugLoc GetFirstDebugLocInBasicBlock(const BasicBlock *BB);
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ bool llvm::isCriticalEdge(const TerminatorInst *TI, unsigned SuccNum,
|
|||||||
++I; // Skip one edge due to the incoming arc from TI.
|
++I; // Skip one edge due to the incoming arc from TI.
|
||||||
if (!AllowIdenticalEdges)
|
if (!AllowIdenticalEdges)
|
||||||
return I != E;
|
return I != E;
|
||||||
|
|
||||||
// If AllowIdenticalEdges is true, then we allow this edge to be considered
|
// If AllowIdenticalEdges is true, then we allow this edge to be considered
|
||||||
// non-critical iff all preds come from TI's block.
|
// non-critical iff all preds come from TI's block.
|
||||||
while (I != E) {
|
while (I != E) {
|
||||||
@ -155,10 +155,10 @@ static void CreatePHIsForSplitLoopExit(SmallVectorImpl<BasicBlock *> &Preds,
|
|||||||
/// This returns the new block if the edge was split, null otherwise.
|
/// This returns the new block if the edge was split, null otherwise.
|
||||||
///
|
///
|
||||||
/// If MergeIdenticalEdges is true (not the default), *all* edges from TI to the
|
/// If MergeIdenticalEdges is true (not the default), *all* edges from TI to the
|
||||||
/// specified successor will be merged into the same critical edge block.
|
/// specified successor will be merged into the same critical edge block.
|
||||||
/// This is most commonly interesting with switch instructions, which may
|
/// This is most commonly interesting with switch instructions, which may
|
||||||
/// have many edges to any one destination. This ensures that all edges to that
|
/// have many edges to any one destination. This ensures that all edges to that
|
||||||
/// dest go to one block instead of each going to a different block, but isn't
|
/// dest go to one block instead of each going to a different block, but isn't
|
||||||
/// the standard definition of a "critical edge".
|
/// the standard definition of a "critical edge".
|
||||||
///
|
///
|
||||||
/// It is invalid to call this function on a critical edge that starts at an
|
/// It is invalid to call this function on a critical edge that starts at an
|
||||||
@ -169,10 +169,10 @@ static void CreatePHIsForSplitLoopExit(SmallVectorImpl<BasicBlock *> &Preds,
|
|||||||
BasicBlock *llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum,
|
BasicBlock *llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum,
|
||||||
Pass *P, bool MergeIdenticalEdges) {
|
Pass *P, bool MergeIdenticalEdges) {
|
||||||
if (!isCriticalEdge(TI, SuccNum, MergeIdenticalEdges)) return 0;
|
if (!isCriticalEdge(TI, SuccNum, MergeIdenticalEdges)) return 0;
|
||||||
|
|
||||||
assert(!isa<IndirectBrInst>(TI) &&
|
assert(!isa<IndirectBrInst>(TI) &&
|
||||||
"Cannot split critical edge from IndirectBrInst");
|
"Cannot split critical edge from IndirectBrInst");
|
||||||
|
|
||||||
BasicBlock *TIBB = TI->getParent();
|
BasicBlock *TIBB = TI->getParent();
|
||||||
BasicBlock *DestBB = TI->getSuccessor(SuccNum);
|
BasicBlock *DestBB = TI->getSuccessor(SuccNum);
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ BasicBlock *llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum,
|
|||||||
Function &F = *TIBB->getParent();
|
Function &F = *TIBB->getParent();
|
||||||
Function::iterator FBBI = TIBB;
|
Function::iterator FBBI = TIBB;
|
||||||
F.getBasicBlockList().insert(++FBBI, NewBB);
|
F.getBasicBlockList().insert(++FBBI, NewBB);
|
||||||
|
|
||||||
// If there are any PHI nodes in DestBB, we need to update them so that they
|
// If there are any PHI nodes in DestBB, we need to update them so that they
|
||||||
// merge incoming values from NewBB instead of from TIBB.
|
// merge incoming values from NewBB instead of from TIBB.
|
||||||
{
|
{
|
||||||
@ -211,35 +211,35 @@ BasicBlock *llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum,
|
|||||||
// happens because the BB list of PHI nodes are usually in the same
|
// happens because the BB list of PHI nodes are usually in the same
|
||||||
// order.
|
// order.
|
||||||
if (PN->getIncomingBlock(BBIdx) != TIBB)
|
if (PN->getIncomingBlock(BBIdx) != TIBB)
|
||||||
BBIdx = PN->getBasicBlockIndex(TIBB);
|
BBIdx = PN->getBasicBlockIndex(TIBB);
|
||||||
PN->setIncomingBlock(BBIdx, NewBB);
|
PN->setIncomingBlock(BBIdx, NewBB);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there are any other edges from TIBB to DestBB, update those to go
|
// If there are any other edges from TIBB to DestBB, update those to go
|
||||||
// through the split block, making those edges non-critical as well (and
|
// through the split block, making those edges non-critical as well (and
|
||||||
// reducing the number of phi entries in the DestBB if relevant).
|
// reducing the number of phi entries in the DestBB if relevant).
|
||||||
if (MergeIdenticalEdges) {
|
if (MergeIdenticalEdges) {
|
||||||
for (unsigned i = SuccNum+1, e = TI->getNumSuccessors(); i != e; ++i) {
|
for (unsigned i = SuccNum+1, e = TI->getNumSuccessors(); i != e; ++i) {
|
||||||
if (TI->getSuccessor(i) != DestBB) continue;
|
if (TI->getSuccessor(i) != DestBB) continue;
|
||||||
|
|
||||||
// Remove an entry for TIBB from DestBB phi nodes.
|
// Remove an entry for TIBB from DestBB phi nodes.
|
||||||
DestBB->removePredecessor(TIBB);
|
DestBB->removePredecessor(TIBB);
|
||||||
|
|
||||||
// We found another edge to DestBB, go to NewBB instead.
|
// We found another edge to DestBB, go to NewBB instead.
|
||||||
TI->setSuccessor(i, NewBB);
|
TI->setSuccessor(i, NewBB);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// If we don't have a pass object, we can't update anything...
|
// If we don't have a pass object, we can't update anything...
|
||||||
if (P == 0) return NewBB;
|
if (P == 0) return NewBB;
|
||||||
|
|
||||||
DominatorTree *DT = P->getAnalysisIfAvailable<DominatorTree>();
|
DominatorTree *DT = P->getAnalysisIfAvailable<DominatorTree>();
|
||||||
LoopInfo *LI = P->getAnalysisIfAvailable<LoopInfo>();
|
LoopInfo *LI = P->getAnalysisIfAvailable<LoopInfo>();
|
||||||
ProfileInfo *PI = P->getAnalysisIfAvailable<ProfileInfo>();
|
ProfileInfo *PI = P->getAnalysisIfAvailable<ProfileInfo>();
|
||||||
|
|
||||||
// If we have nothing to update, just return.
|
// If we have nothing to update, just return.
|
||||||
if (DT == 0 && LI == 0 && PI == 0)
|
if (DT == 0 && LI == 0 && PI == 0)
|
||||||
return NewBB;
|
return NewBB;
|
||||||
@ -267,7 +267,7 @@ BasicBlock *llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool NewBBDominatesDestBB = true;
|
bool NewBBDominatesDestBB = true;
|
||||||
|
|
||||||
// Should we update DominatorTree information?
|
// Should we update DominatorTree information?
|
||||||
if (DT) {
|
if (DT) {
|
||||||
DomTreeNode *TINode = DT->getNode(TIBB);
|
DomTreeNode *TINode = DT->getNode(TIBB);
|
||||||
@ -278,7 +278,7 @@ BasicBlock *llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum,
|
|||||||
if (TINode) { // Don't break unreachable code!
|
if (TINode) { // Don't break unreachable code!
|
||||||
DomTreeNode *NewBBNode = DT->addNewBlock(NewBB, TIBB);
|
DomTreeNode *NewBBNode = DT->addNewBlock(NewBB, TIBB);
|
||||||
DomTreeNode *DestBBNode = 0;
|
DomTreeNode *DestBBNode = 0;
|
||||||
|
|
||||||
// If NewBBDominatesDestBB hasn't been computed yet, do so with DT.
|
// If NewBBDominatesDestBB hasn't been computed yet, do so with DT.
|
||||||
if (!OtherPreds.empty()) {
|
if (!OtherPreds.empty()) {
|
||||||
DestBBNode = DT->getNode(DestBB);
|
DestBBNode = DT->getNode(DestBB);
|
||||||
@ -289,7 +289,7 @@ BasicBlock *llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum,
|
|||||||
}
|
}
|
||||||
OtherPreds.clear();
|
OtherPreds.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If NewBBDominatesDestBB, then NewBB dominates DestBB, otherwise it
|
// If NewBBDominatesDestBB, then NewBB dominates DestBB, otherwise it
|
||||||
// doesn't dominate anything.
|
// doesn't dominate anything.
|
||||||
if (NewBBDominatesDestBB) {
|
if (NewBBDominatesDestBB) {
|
||||||
|
Loading…
Reference in New Issue
Block a user