#include "RISCV.h"
#include "RISCVTargetMachine.h"
#include "llvm/Analysis/InstSimplifyFolder.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/Analysis/VectorUtils.h"
#include "llvm/CodeGen/TargetPassConfig.h"
#include "llvm/IR/GetElementPtrTypeIterator.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/IntrinsicsRISCV.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/Transforms/Utils/Local.h"
#include <optional>
usingnamespacellvm;
usingnamespacePatternMatch;
#define DEBUG_TYPE …
namespace {
class RISCVGatherScatterLowering : public FunctionPass { … };
}
char RISCVGatherScatterLowering::ID = …;
INITIALIZE_PASS(…)
FunctionPass *llvm::createRISCVGatherScatterLoweringPass() { … }
static std::pair<Value *, Value *> matchStridedConstant(Constant *StartC) { … }
static std::pair<Value *, Value *> matchStridedStart(Value *Start,
IRBuilderBase &Builder) { … }
bool RISCVGatherScatterLowering::matchStridedRecurrence(Value *Index, Loop *L,
Value *&Stride,
PHINode *&BasePtr,
BinaryOperator *&Inc,
IRBuilderBase &Builder) { … }
std::pair<Value *, Value *>
RISCVGatherScatterLowering::determineBaseAndStride(Instruction *Ptr,
IRBuilderBase &Builder) { … }
bool RISCVGatherScatterLowering::tryCreateStridedLoadStore(IntrinsicInst *II,
Type *DataType,
Value *Ptr,
Value *AlignOp) { … }
bool RISCVGatherScatterLowering::runOnFunction(Function &F) { … }