24#include "llvm/IR/IntrinsicsHexagon.h"
30#define DEBUG_TYPE "hexagon-lower-hlx-pair-allocas"
41 return "Hexagon Lower HLX Pair Allocas";
55char HexagonLowerHLXPairAllocas::ID = 0;
58 "Hexagon Lower HLX Pair Allocas",
false,
false)
66 unsigned VectorLength) {
68 I.isVolatile() ||
I.isAtomic() ||
69 I.getMetadata(LLVMContext::MD_nontemporal) ||
74 if (!AI || AI->getAllocatedType() !=
PairTy ||
75 AI->getAlign().value() < VectorLength)
80bool HexagonLowerHLXPairAllocas::runOnFunction(
Function &
F) {
81 auto &TM = getAnalysis<TargetPassConfig>().getTM<HexagonTargetMachine>();
82 const HexagonSubtarget *HST = TM.getSubtargetImpl(
F);
83 if (!HST->useHLXOps())
86 unsigned VectorLength = HST->getHLXVectorLength();
100 Call = Builder.CreateCall(
102 Intrinsic::hexagon_LX_SS16b_new),
103 {AI, SI->getValueOperand()});
105 Call = Builder.CreateCall(
107 Intrinsic::hexagon_LX_LL16b_tmp),
120 return new HexagonLowerHLXPairAllocas();
Expand Atomic instructions
static bool runOnFunction(Function &F, bool PostInlining)
Hexagon Lower HLX Pair static false AllocaInst * getPairAlloca(Instruction &I, Type *PairTy, unsigned VectorLength)
std::pair< MCSymbol *, MachineModuleInfoImpl::StubValueTy > PairTy
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
Target-Independent Code Generator Pass Configuration Options pass.
an instruction to allocate memory on the stack
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
LLVM_ABI void setPreservesCFG()
This function should be called by the pass, iff they do not:
static LLVM_ABI FixedVectorType * get(Type *ElementType, unsigned NumElts)
FunctionPass class - This class is used to implement most global optimizations.
LLVM_ABI void setAAMetadata(const AAMDNodes &N)
Sets the AA metadata on this instruction from the AAMDNodes structure.
LLVM_ABI void copyMetadata(const Instruction &SrcInst, ArrayRef< unsigned > WL=ArrayRef< unsigned >())
Copy metadata from SrcInst to this instruction.
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
Represent a constant reference to a string, i.e.
Target-Independent Code Generator Pass Configuration Options.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM_ABI void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
LLVM_ABI Function * getOrInsertDeclaration(Module *M, ID id, ArrayRef< Type * > OverloadTys={})
Look up the Function declaration of the intrinsic id in the Module M.
This is an optimization pass for GlobalISel generic memory operations.
FunctionPass * createHexagonLowerHLXPairAllocas()
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
const Value * getLoadStorePointerOperand(const Value *V)
A helper function that returns the pointer operand of a load or store instruction.
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
Align getLoadStoreAlignment(const Value *I)
A helper function that returns the alignment of load or store instruction.
IRBuilder(LLVMContext &, FolderTy, InserterTy) -> IRBuilder< FolderTy, InserterTy >
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
Type * getLoadStoreType(const Value *I)
A helper function that returns the type of a load or store instruction.