LLVM 20.0.0git
Namespaces | Macros | Functions | Variables
HexagonLoopIdiomRecognition.cpp File Reference
#include "HexagonLoopIdiomRecognition.h"
#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/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/LoopAnalysisManager.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/LoopPass.h"
#include "llvm/Analysis/MemoryLocation.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
#include "llvm/Analysis/TargetLibraryInfo.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/IntrinsicsHexagon.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/User.h"
#include "llvm/IR/Value.h"
#include "llvm/InitializePasses.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/TargetParser/Triple.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Utils.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Transforms/Utils/ScalarEvolutionExpander.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

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
 

Macros

#define DEBUG_TYPE   "hexagon-lir"
 

Functions

void llvm::initializeHexagonLoopIdiomRecognizeLegacyPassPass (PassRegistry &)
 
Passllvm::createHexagonLoopIdiomPass ()
 
 INITIALIZE_PASS_BEGIN (HexagonLoopIdiomRecognizeLegacyPass, "hexagon-loop-idiom", "Recognize Hexagon-specific loop idioms", false, false) INITIALIZE_PASS_END(HexagonLoopIdiomRecognizeLegacyPass
 
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.
 

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"))
 
static 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 76 of file HexagonLoopIdiomRecognition.cpp.

Function Documentation

◆ hasZeroSignBit()

static bool hasZeroSignBit ( const Value V)
static

Definition at line 1572 of file HexagonLoopIdiomRecognition.cpp.

References hasZeroSignBit(), and I.

Referenced by hasZeroSignBit().

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( HexagonLoopIdiomRecognizeLegacyPass  ,
"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 1976 of file HexagonLoopIdiomRecognition.cpp.

References llvm::LocationSize::afterPointer(), B, llvm::SmallPtrSetImpl< PtrType >::count(), llvm::AAResults::getModRefInfo(), I, llvm::isModOrRefSet(), llvm::LocationSize::precise(), and Ptr.

◆ replaceAllUsesOfWithIn()

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

Definition at line 673 of file HexagonLoopIdiomRecognition.cpp.

References llvm::Use::getUser(), I, and II.

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.")) ( "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

◆ DisableMemcpyIdiom

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

◆ DisableMemmoveIdiom

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

◆ false

hexagon loop Recognize Hexagon specific loop false

Definition at line 284 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.")) ( "disable-hexagon-volatile-memcpy"  ,
cl::Hidden  ,
cl::init(false)  ,
cl::desc("Enable Hexagon-specific memcpy for volatile destination.")   
)
static

◆ HexagonVolatileMemcpyName

const char* HexagonVolatileMemcpyName = "hexagon_memcpy_forward_vp4cp4n2"
static

Definition at line 108 of file HexagonLoopIdiomRecognition.cpp.

◆ idiom

hexagon loop idiom

Definition at line 283 of file HexagonLoopIdiomRecognition.cpp.

◆ idioms

hexagon loop Recognize Hexagon specific loop idioms

Definition at line 284 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")) ( "only-nonnested-memmove-idiom"  ,
cl::Hidden  ,
cl::init(true ,
cl::desc("Only enable generating memmove in non-nested loops")   
)
static

◆ 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.")) ( "runtime-mem-idiom-threshold"  ,
cl::Hidden  ,
cl::init(0)  ,
cl::desc("Threshold (in bytes) for the runtime " "check guarding the memmove.")   
)
static

◆ SimplifyLimit

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