LLVM
8.0.1
|
#include "llvm/Transforms/Scalar/Sink.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Scalar.h"
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "sink" |
Functions | |
STATISTIC (NumSunk, "Number of instructions sunk") | |
STATISTIC (NumSinkIter, "Number of sinking iterations") | |
static bool | AllUsesDominatedByBlock (Instruction *Inst, BasicBlock *BB, DominatorTree &DT) |
AllUsesDominatedByBlock - Return true if all uses of the specified value occur in blocks dominated by the specified block. More... | |
static bool | isSafeToMove (Instruction *Inst, AliasAnalysis &AA, SmallPtrSetImpl< Instruction *> &Stores) |
static bool | IsAcceptableTarget (Instruction *Inst, BasicBlock *SuccToSinkTo, DominatorTree &DT, LoopInfo &LI) |
IsAcceptableTarget - Return true if it is possible to sink the instruction in the specified basic block. More... | |
static bool | SinkInstruction (Instruction *Inst, SmallPtrSetImpl< Instruction *> &Stores, DominatorTree &DT, LoopInfo &LI, AAResults &AA) |
SinkInstruction - Determine whether it is safe to sink the specified machine instruction out of its current block into a successor. More... | |
static bool | ProcessBlock (BasicBlock &BB, DominatorTree &DT, LoopInfo &LI, AAResults &AA) |
static bool | iterativelySinkInstructions (Function &F, DominatorTree &DT, LoopInfo &LI, AAResults &AA) |
|
static |
AllUsesDominatedByBlock - Return true if all uses of the specified value occur in blocks dominated by the specified block.
Definition at line 37 of file Sink.cpp.
References llvm::DominatorTree::dominates(), llvm::PHINode::getIncomingValueNumForOperand(), llvm::Instruction::getParent(), and llvm::Value::uses().
Referenced by IsAcceptableTarget().
|
static |
IsAcceptableTarget - Return true if it is possible to sink the instruction in the specified basic block.
Definition at line 95 of file Sink.cpp.
References AllUsesDominatedByBlock(), assert(), llvm::DominatorTree::dominates(), llvm::LoopInfoBase< BlockT, LoopT >::getLoopFor(), llvm::Instruction::getParent(), llvm::BasicBlock::getTerminator(), llvm::BasicBlock::getUniquePredecessor(), llvm::Instruction::isExceptionalTerminator(), and llvm::Instruction::mayReadFromMemory().
Referenced by SinkInstruction().
|
static |
Definition at line 60 of file Sink.cpp.
References llvm::Attribute::Convergent, llvm::MemoryLocation::get(), llvm::AAResults::getModRefInfo(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::Instruction::isEHPad(), llvm::isModSet(), llvm::Instruction::isTerminator(), llvm::Instruction::mayThrow(), and llvm::Instruction::mayWriteToMemory().
Referenced by SinkInstruction().
|
static |
Definition at line 239 of file Sink.cpp.
References llvm::dbgs(), I, LLVM_DEBUG, and ProcessBlock().
Referenced by llvm::SinkingPass::run().
|
static |
Definition at line 199 of file Sink.cpp.
References llvm::BasicBlock::begin(), llvm::BasicBlock::end(), llvm::Instruction::getNumSuccessors(), llvm::BasicBlock::getTerminator(), I, llvm::DominatorTree::isReachableFromEntry(), and SinkInstruction().
Referenced by isCallerPreservedOrConstPhysReg(), iterativelySinkInstructions(), llvm::JumpThreadingPass::releaseMemory(), llvm::JumpThreadingPass::runImpl(), and llvm::MemorySSAUpdater::updateForClonedLoop().
|
static |
SinkInstruction - Determine whether it is safe to sink the specified machine instruction out of its current block into a successor.
Definition at line 139 of file Sink.cpp.
References llvm::DomTreeNodeBase< NodeT >::begin(), llvm::dbgs(), E, llvm::DomTreeNodeBase< NodeT >::end(), llvm::DominatorTreeBase< NodeT, IsPostDom >::getNode(), llvm::Instruction::getParent(), I, IsAcceptableTarget(), isSafeToMove(), LLVM_DEBUG, llvm::Instruction::moveBefore(), llvm::Value::printAsOperand(), llvm::succ_begin(), and llvm::succ_end().
Referenced by performSink(), and ProcessBlock().
STATISTIC | ( | NumSunk | , |
"Number of instructions sunk" | |||
) |
STATISTIC | ( | NumSinkIter | , |
"Number of sinking iterations" | |||
) |