From a4529321713313545f53ee759800705bdb3f2a29 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Thu, 8 Jun 2006 20:02:53 +0000 Subject: [PATCH] Update some comments, and expose LCSSAID in preparation for having other passes require LCSSA. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28734 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Transforms/Scalar.h | 1 + lib/Transforms/Utils/LCSSA.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/llvm/Transforms/Scalar.h b/include/llvm/Transforms/Scalar.h index 111ced11d64..d901972c9d0 100644 --- a/include/llvm/Transforms/Scalar.h +++ b/include/llvm/Transforms/Scalar.h @@ -306,6 +306,7 @@ FunctionPass *createBlockPlacementPass(); // This pass inserts phi nodes at loop boundaries to simplify other loop // optimizations. FunctionPass *createLCSSAPass(); +extern const PassInfo *LCSSAID; } // End llvm namespace diff --git a/lib/Transforms/Utils/LCSSA.cpp b/lib/Transforms/Utils/LCSSA.cpp index 061e548e708..e1af50e7454 100644 --- a/lib/Transforms/Utils/LCSSA.cpp +++ b/lib/Transforms/Utils/LCSSA.cpp @@ -86,7 +86,9 @@ namespace { } FunctionPass *llvm::createLCSSAPass() { return new LCSSA(); } +const PassInfo *llvm::LCSSAID = X.getPassInfo(); +/// runOnFunction - Process all loops in the function, inner-most out. bool LCSSA::runOnFunction(Function &F) { bool changed = false; LI = &getAnalysis(); @@ -100,6 +102,8 @@ bool LCSSA::runOnFunction(Function &F) { return changed; } +/// visitSubloop - Recursively process all subloops, and then process the given +/// loop if it has live-out values. bool LCSSA::visitSubloop(Loop* L) { for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I) visitSubloop(*I); @@ -131,7 +135,8 @@ bool LCSSA::visitSubloop(Loop* L) { return true; } -/// processInstruction - +/// processInstruction - Given a live-out instruction, insert LCSSA Phi nodes, +/// eliminate all out-of-loop uses. void LCSSA::processInstruction(Instruction* Instr, const std::vector& exitBlocks) { @@ -252,6 +257,8 @@ SetVector LCSSA::getLoopValuesUsedOutsideLoop(Loop *L) { return AffectedValues; } +/// getValueDominatingBlock - Return the value within the potential dominators +/// map that dominates the given block. Instruction *LCSSA::getValueDominatingBlock(BasicBlock *BB, std::map& PotDoms) { DominatorTree::Node* bbNode = DT->getNode(BB); -- 2.34.1