LLVM  8.0.1
Namespaces | Macros | Functions | Variables
HexagonLoopIdiomRecognition.cpp File Reference
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/LoopPass.h"
#include "llvm/Analysis/MemoryLocation.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/ScalarEvolutionExpander.h"
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/User.h"
#include "llvm/IR/Value.h"
#include "llvm/Pass.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/KnownBits.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Utils.h"
#include <algorithm>
#include <array>
#include <cassert>
#include <cstdint>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <utility>
#include <vector>

Go to the source code of this file.

Namespaces

 llvm
 This class represents lattice values for constants.
 

Macros

#define DEBUG_TYPE   "hexagon-lir"
 

Functions

void llvm::initializeHexagonLoopIdiomRecognizePass (PassRegistry &)
 
Passllvm::createHexagonLoopIdiomPass ()
 
 INITIALIZE_PASS_BEGIN (HexagonLoopIdiomRecognize, "hexagon-loop-idiom", "Recognize Hexagon-specific loop idioms", false, false) INITIALIZE_PASS_END(HexagonLoopIdiomRecognize
 
static void replaceAllUsesOfWithIn (Value *I, Value *J, BasicBlock *BB)
 
static bool hasZeroSignBit (const Value *V)
 
static bool mayLoopAccessLocation (Value *Ptr, ModRefInfo Access, Loop *L, const SCEV *BECount, unsigned StoreSize, AliasAnalysis &AA, SmallPtrSetImpl< Instruction *> &Ignored)
 mayLoopAccessLocation - Return true if the specified loop might access the specified pointer location, which is a loop-strided access. More...
 

Variables

static cl::opt< boolDisableMemcpyIdiom ("disable-memcpy-idiom", cl::Hidden, cl::init(false), cl::desc("Disable generation of memcpy in loop idiom recognition"))
 
static cl::opt< boolDisableMemmoveIdiom ("disable-memmove-idiom", cl::Hidden, cl::init(false), cl::desc("Disable generation of memmove in loop idiom recognition"))
 
static cl::opt< unsignedRuntimeMemSizeThreshold ("runtime-mem-idiom-threshold", cl::Hidden, cl::init(0), cl::desc("Threshold (in bytes) for the runtime " "check guarding the memmove."))
 
static cl::opt< unsignedCompileTimeMemSizeThreshold ("compile-time-mem-idiom-threshold", cl::Hidden, cl::init(64), cl::desc("Threshold (in bytes) to perform the transformation, if the " "runtime loop count (mem transfer size) is known at compile-time."))
 
static cl::opt< boolOnlyNonNestedMemmove ("only-nonnested-memmove-idiom", cl::Hidden, cl::init(true), cl::desc("Only enable generating memmove in non-nested loops"))
 
cl::opt< boolHexagonVolatileMemcpy ("disable-hexagon-volatile-memcpy", cl::Hidden, cl::init(false), cl::desc("Enable Hexagon-specific memcpy for volatile destination."))
 
static cl::opt< unsignedSimplifyLimit ("hlir-simplify-limit", cl::init(10000), cl::Hidden, cl::desc("Maximum number of simplification steps in HLIR"))
 
static const charHexagonVolatileMemcpyName = "hexagon_memcpy_forward_vp4cp4n2"
 
hexagon loop idiom
 
hexagon loop Recognize Hexagon specific loop idioms
 
hexagon loop Recognize Hexagon specific loop false
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "hexagon-lir"

Definition at line 10 of file HexagonLoopIdiomRecognition.cpp.

Function Documentation

◆ hasZeroSignBit()

static bool hasZeroSignBit ( const Value V)
static

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( HexagonLoopIdiomRecognize  ,
"hexagon-loop-idiom ,
"Recognize Hexagon-specific loop idioms ,
false  ,
false   
)

◆ mayLoopAccessLocation()

static bool mayLoopAccessLocation ( Value Ptr,
ModRefInfo  Access,
Loop L,
const SCEV BECount,
unsigned  StoreSize,
AliasAnalysis AA,
SmallPtrSetImpl< Instruction *> &  Ignored 
)
static

mayLoopAccessLocation - Return true if the specified loop might access the specified pointer location, which is a loop-strided access.

The 'Access' argument specifies what the verboten forms of access are (read or write).

Definition at line 1966 of file HexagonLoopIdiomRecognition.cpp.

References llvm::LoopBase< BlockT, LoopT >::addBasicBlockToLoop(), llvm::all_of(), llvm::Attribute::AlwaysInline, assert(), llvm::SmallVectorTemplateCommon< T >::begin(), llvm::LoopBase< BlockT, LoopT >::blocks(), llvm::SCEVExpander::clear(), llvm::SmallVectorImpl< T >::clear(), CompileTimeMemSizeThreshold, llvm::SmallSet< T, N, C >::count(), llvm::SmallPtrSetImpl< PtrType >::count(), llvm::BasicBlock::Create(), llvm::IRBuilder< T, Inserter >::CreateAnd(), llvm::IRBuilder< T, Inserter >::CreateBitCast(), llvm::IRBuilder< T, Inserter >::CreateBr(), llvm::IRBuilder< T, Inserter >::CreateCall(), llvm::IRBuilder< T, Inserter >::CreateCondBr(), llvm::IRBuilder< T, Inserter >::CreateICmpSLE(), llvm::IRBuilder< T, Inserter >::CreateICmpULT(), llvm::IRBuilderBase::CreateMemCpy(), llvm::IRBuilderBase::CreateMemMove(), llvm::IRBuilder< T, Inserter >::CreateOr(), llvm::IRBuilder< T, Inserter >::CreatePtrToInt(), llvm::IRBuilder< T, Inserter >::CreateSub(), llvm::dbgs(), DisableMemcpyIdiom, DisableMemmoveIdiom, llvm::dyn_cast(), E, llvm::SmallVectorTemplateCommon< T >::end(), llvm::Instruction::eraseFromParent(), llvm::SCEVExpander::expandCodeFor(), llvm::GlobalValue::ExternalLinkage, llvm::SCEV::FlagNUW, llvm::ConstantInt::get(), llvm::LoadInst::getAlignment(), llvm::StoreInst::getAlignment(), llvm::PHINode::getBasicBlockIndex(), llvm::LoopBase< BlockT, LoopT >::getBlocks(), llvm::Value::getContext(), llvm::Module::getDataLayout(), llvm::Instruction::getDebugLoc(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::Type::getInt32PtrTy(), llvm::Type::getInt32Ty(), llvm::IRBuilderBase::getInt8PtrTy(), llvm::IRBuilderBase::getIntPtrTy(), llvm::LoopBase< BlockT, LoopT >::getLoopPreheader(), llvm::AAResults::getModRefInfo(), llvm::BasicBlock::getModule(), llvm::Value::getName(), llvm::Module::getOrInsertFunction(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), llvm::GlobalValue::getParent(), llvm::LoopBase< BlockT, LoopT >::getParentLoop(), llvm::LoadInst::getPointerAddressSpace(), llvm::StoreInst::getPointerAddressSpace(), llvm::LoadInst::getPointerOperand(), llvm::StoreInst::getPointerOperand(), llvm::Module::getTargetTriple(), llvm::BasicBlock::getTerminator(), llvm::SCEV::getType(), llvm::Value::getType(), llvm::LoopBase< BlockT, LoopT >::getUniqueExitBlocks(), llvm::StoreInst::getValueOperand(), llvm::Type::getVoidTy(), llvm::Function::hasFnAttribute(), llvm::Triple::hexagon, HexagonVolatileMemcpy, HexagonVolatileMemcpyName, I, llvm::tgtok::In, llvm::SmallSet< T, N, C >::insert(), llvm::SmallPtrSetImpl< PtrType >::insert(), Int32Ty, llvm::intersectModRef(), llvm::isModOrRefSet(), llvm::StoreInst::isSimple(), llvm::StoreInst::isVolatile(), LLVM_DEBUG, llvm::Mod, llvm::ModRef, Name, OnlyNonNestedMemmove, llvm::User::op_begin(), llvm::User::op_end(), llvm::LocationSize::precise(), llvm::pred_begin(), llvm::pred_end(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::RecursivelyDeleteTriviallyDeadInstructions(), RuntimeMemSizeThreshold, llvm::Instruction::setDebugLoc(), llvm::DomTreeNodeBase< NodeT >::setIDom(), llvm::PHINode::setIncomingBlock(), llvm::IRBuilderBase::SetInsertPoint(), llvm::GlobalValue::setLinkage(), llvm::Value::setName(), llvm::SimplifyInstruction(), llvm::SmallVectorBase::size(), Threshold, llvm::LocationSize::unknown(), and llvm::Value::users().

◆ replaceAllUsesOfWithIn()

static void replaceAllUsesOfWithIn ( Value I,
Value J,
BasicBlock BB 
)
static

Variable Documentation

◆ CompileTimeMemSizeThreshold

cl::opt<unsigned> CompileTimeMemSizeThreshold("compile-time-mem-idiom-threshold", cl::Hidden, cl::init(64), cl::desc("Threshold (in bytes) to perform the transformation, if the " "runtime loop count (mem transfer size) is known at compile-time."))
static

Referenced by mayLoopAccessLocation().

◆ DisableMemcpyIdiom

cl::opt<bool> DisableMemcpyIdiom("disable-memcpy-idiom", cl::Hidden, cl::init(false), cl::desc("Disable generation of memcpy in loop idiom recognition"))
static

Referenced by mayLoopAccessLocation().

◆ DisableMemmoveIdiom

cl::opt<bool> DisableMemmoveIdiom("disable-memmove-idiom", cl::Hidden, cl::init(false), cl::desc("Disable generation of memmove in loop idiom recognition"))
static

Referenced by mayLoopAccessLocation().

◆ false

hexagon loop Recognize Hexagon specific loop false

Definition at line 266 of file HexagonLoopIdiomRecognition.cpp.

◆ HexagonVolatileMemcpy

cl::opt<bool> HexagonVolatileMemcpy("disable-hexagon-volatile-memcpy", cl::Hidden, cl::init(false), cl::desc("Enable Hexagon-specific memcpy for volatile destination."))

◆ HexagonVolatileMemcpyName

const char* HexagonVolatileMemcpyName = "hexagon_memcpy_forward_vp4cp4n2"
static

Definition at line 105 of file HexagonLoopIdiomRecognition.cpp.

Referenced by mayLoopAccessLocation().

◆ idiom

hexagon loop idiom

Definition at line 266 of file HexagonLoopIdiomRecognition.cpp.

◆ idioms

hexagon loop Recognize Hexagon specific loop idioms

Definition at line 266 of file HexagonLoopIdiomRecognition.cpp.

◆ OnlyNonNestedMemmove

cl::opt<bool> OnlyNonNestedMemmove("only-nonnested-memmove-idiom", cl::Hidden, cl::init(true), cl::desc("Only enable generating memmove in non-nested loops"))
static

Referenced by mayLoopAccessLocation().

◆ RuntimeMemSizeThreshold

cl::opt<unsigned> RuntimeMemSizeThreshold("runtime-mem-idiom-threshold", cl::Hidden, cl::init(0), cl::desc("Threshold (in bytes) for the runtime " "check guarding the memmove."))
static

Referenced by mayLoopAccessLocation().

◆ SimplifyLimit

cl::opt<unsigned> SimplifyLimit("hlir-simplify-limit", cl::init(10000), cl::Hidden, cl::desc("Maximum number of simplification steps in HLIR"))
static