#include "HexagonVectorLoopCarriedReuse.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/LoopPass.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/IRBuilder.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/Use.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/raw_ostream.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Utils.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <map>
#include <memory>
#include <set>
usingnamespacellvm;
#define DEBUG_TYPE …
STATISTIC(HexagonNumVectorLoopCarriedReuse,
"Number of values that were reused from a previous iteration.");
static cl::opt<int> HexagonVLCRIterationLim(
"hexagon-vlcr-iteration-lim", cl::Hidden,
cl::desc("Maximum distance of loop carried dependences that are handled"),
cl::init(2));
namespace llvm {
void initializeHexagonVectorLoopCarriedReuseLegacyPassPass(PassRegistry &);
Pass *createHexagonVectorLoopCarriedReuseLegacyPass();
}
namespace {
ChainOfDependences;
class DepChain { … };
LLVM_ATTRIBUTE_UNUSED
raw_ostream &operator<<(raw_ostream &OS, const DepChain &D) { … }
struct ReuseValue { … };
LLVM_ATTRIBUTE_UNUSED
raw_ostream &operator<<(raw_ostream &OS, const ReuseValue &RU) { … }
class HexagonVectorLoopCarriedReuseLegacyPass : public LoopPass { … };
class HexagonVectorLoopCarriedReuse { … };
}
char HexagonVectorLoopCarriedReuseLegacyPass::ID = …;
INITIALIZE_PASS_BEGIN(HexagonVectorLoopCarriedReuseLegacyPass, "hexagon-vlcr",
"Hexagon-specific predictive commoning for HVX vectors",
false, false)
INITIALIZE_PASS_DEPENDENCY(LoopSimplify)
INITIALIZE_PASS_DEPENDENCY(LCSSAWrapperPass)
INITIALIZE_PASS_END(HexagonVectorLoopCarriedReuseLegacyPass, "hexagon-vlcr",
"Hexagon-specific predictive commoning for HVX vectors",
false, false)
PreservedAnalyses
HexagonVectorLoopCarriedReusePass::run(Loop &L, LoopAnalysisManager &LAM,
LoopStandardAnalysisResults &AR,
LPMUpdater &U) { … }
bool HexagonVectorLoopCarriedReuseLegacyPass::runOnLoop(Loop *L,
LPPassManager &LPM) { … }
bool HexagonVectorLoopCarriedReuse::run() { … }
bool HexagonVectorLoopCarriedReuse::isCallInstCommutative(CallInst *C) { … }
bool HexagonVectorLoopCarriedReuse::isEquivalentOperation(Instruction *I1,
Instruction *I2) { … }
bool HexagonVectorLoopCarriedReuse::canReplace(Instruction *I) { … }
void HexagonVectorLoopCarriedReuse::findValueToReuse() { … }
Value *HexagonVectorLoopCarriedReuse::findValueInBlock(Value *Op,
BasicBlock *BB) { … }
void HexagonVectorLoopCarriedReuse::reuseValue() { … }
bool HexagonVectorLoopCarriedReuse::doVLCR() { … }
void HexagonVectorLoopCarriedReuse::findDepChainFromPHI(Instruction *I,
DepChain &D) { … }
DepChain *HexagonVectorLoopCarriedReuse::getDepChainBtwn(Instruction *I1,
Instruction *I2,
int Iters) { … }
void HexagonVectorLoopCarriedReuse::findLoopCarriedDeps() { … }
Pass *llvm::createHexagonVectorLoopCarriedReuseLegacyPass() { … }