LLVM API Documentation
#include "llvm/Transforms/Utils/CodeExtractor.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/RegionInfo.h"
#include "llvm/Analysis/RegionIterator.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Verifier.h"
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include <algorithm>
#include <set>
Go to the source code of this file.
Defines | |
#define | DEBUG_TYPE "code-extractor" |
Functions | |
static bool | isBlockValidForExtraction (const BasicBlock &BB) |
Test whether a block is valid for extraction. | |
template<typename IteratorT > | |
static SetVector< BasicBlock * > | buildExtractionBlockSet (IteratorT BBBegin, IteratorT BBEnd) |
Build a set of blocks to extract if the input blocks are viable. | |
static SetVector< BasicBlock * > | buildExtractionBlockSet (ArrayRef< BasicBlock * > BBs) |
Helper to call buildExtractionBlockSet with an ArrayRef. | |
static SetVector< BasicBlock * > | buildExtractionBlockSet (const RegionNode &RN) |
Helper to call buildExtractionBlockSet with a RegionNode. | |
static bool | definedInRegion (const SetVector< BasicBlock * > &Blocks, Value *V) |
static bool | definedInCaller (const SetVector< BasicBlock * > &Blocks, Value *V) |
static BasicBlock * | FindPhiPredForUseInBlock (Value *Used, BasicBlock *BB) |
Variables | |
static cl::opt< bool > | AggregateArgsOpt ("aggregate-extracted-args", cl::Hidden, cl::desc("Aggregate arguments to code-extracted functions")) |
#define DEBUG_TYPE "code-extractor" |
Definition at line 41 of file CodeExtractor.cpp.
static SetVector<BasicBlock *> buildExtractionBlockSet | ( | IteratorT | BBBegin, |
IteratorT | BBEnd | ||
) | [static] |
Build a set of blocks to extract if the input blocks are viable.
Definition at line 72 of file CodeExtractor.cpp.
References llvm::SetVector< T, Vector, Set >::begin(), llvm::SetVector< T, Vector, Set >::clear(), llvm::SetVector< T, Vector, Set >::count(), llvm::SetVector< T, Vector, Set >::end(), I, llvm::SetVector< T, Vector, Set >::insert(), isBlockValidForExtraction(), llvm_unreachable, llvm::pred_begin(), and llvm::pred_end().
Referenced by buildExtractionBlockSet().
static SetVector<BasicBlock *> buildExtractionBlockSet | ( | ArrayRef< BasicBlock * > | BBs | ) | [static] |
Helper to call buildExtractionBlockSet with an ArrayRef.
Definition at line 106 of file CodeExtractor.cpp.
References llvm::ArrayRef< T >::begin(), buildExtractionBlockSet(), and llvm::ArrayRef< T >::end().
static SetVector<BasicBlock *> buildExtractionBlockSet | ( | const RegionNode & | RN | ) | [static] |
Helper to call buildExtractionBlockSet with a RegionNode.
Definition at line 112 of file CodeExtractor.cpp.
References llvm::RegionBase< Tr >::block_begin(), llvm::RegionBase< Tr >::block_end(), buildExtractionBlockSet(), llvm::RegionNodeBase< Tr >::getNodeAs(), and llvm::RegionNodeBase< Tr >::isSubRegion().
static bool definedInCaller | ( | const SetVector< BasicBlock * > & | Blocks, |
Value * | V | ||
) | [static] |
definedInCaller - Return true if the specified value is defined in the function being code extracted, but not in the region being extracted. These values must be passed in as live-ins to the function.
Definition at line 152 of file CodeExtractor.cpp.
References llvm::SetVector< T, Vector, Set >::count(), and I.
Referenced by llvm::CodeExtractor::findInputsOutputs().
static bool definedInRegion | ( | const SetVector< BasicBlock * > & | Blocks, |
Value * | V | ||
) | [static] |
definedInRegion - Return true if the specified value is defined in the extracted region.
Definition at line 142 of file CodeExtractor.cpp.
References llvm::SetVector< T, Vector, Set >::count(), and I.
Referenced by llvm::CodeExtractor::findInputsOutputs().
static BasicBlock* FindPhiPredForUseInBlock | ( | Value * | Used, |
BasicBlock * | BB | ||
) | [static] |
FindPhiPredForUseInBlock - Given a value and a basic block, find a PHI that uses the value within the basic block, and return the predecessor block associated with that use, or return 0 if none is found.
Definition at line 408 of file CodeExtractor.cpp.
References llvm::dyn_cast(), llvm::PHINode::getIncomingBlock(), llvm::Instruction::getParent(), P, and llvm::Value::uses().
static bool isBlockValidForExtraction | ( | const BasicBlock & | BB | ) | [static] |
Test whether a block is valid for extraction.
Definition at line 52 of file CodeExtractor.cpp.
References llvm::BasicBlock::begin(), llvm::BasicBlock::end(), F(), I, and llvm::BasicBlock::isLandingPad().
Referenced by buildExtractionBlockSet().
cl::opt<bool> AggregateArgsOpt("aggregate-extracted-args", cl::Hidden, cl::desc("Aggregate arguments to code-extracted functions")) [static] |