22 cl::desc(
"Prints the pass pipeline and returns."));
29 cl::desc(
"Comma-separated list of vectorizer passes. If not set "
30 "we run the predefined pipeline."));
44 cl::desc(
"Run the vectorizer only on file paths that match any in the "
45 "list of comma-separated regex's."));
55 "seed-collection<tr-save,bottom-up-vec,tr-accept-or-revert>",
85bool SandboxVectorizerPass::allowFile(
const std::string &SrcFilePath) {
89 size_t LastPos = DelimPos != 0 ? DelimPos + 1 : DelimPos;
91 auto FileNameToMatch =
AllowFiles.substr(LastPos, DelimPos - LastPos);
92 if (FileNameToMatch.empty())
95 Regex FileNameRegex(
".*" + FileNameToMatch +
"$");
96 assert(FileNameRegex.isValid() &&
"Bad regex!");
97 if (FileNameRegex.match(SrcFilePath))
99 }
while (DelimPos != std::string::npos);
103bool SandboxVectorizerPass::runImpl(
Function &LLVMF) {
105 Ctx = std::make_unique<sandboxir::Context>(LLVMF.
getContext());
108 FPM.printPipeline(
outs());
115 if (!allowFile(SrcFilePath))
120 if (!TTI->getNumberOfRegisters(TTI->getRegisterClassForType(
true))) {
122 <<
"Target has no vector registers, return.\n");
130 <<
"NoImplicitFloat attribute, return.\n");
135 sandboxir::Function &
F = *Ctx->createFunction(&LLVMF);
136 sandboxir::Analyses
A(*AA, *SE, *TTI);
137 bool Change = FPM.runOnFunction(
F,
A);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
#define LLVM_UNLIKELY(EXPR)
Module.h This file contains the declarations for the Module class.
static cl::opt< std::string > UserDefinedPassPipeline("sbvec-passes", cl::init(DefaultPipelineMagicStr), cl::Hidden, cl::desc("Comma-separated list of vectorizer passes. If not set " "we run the predefined pipeline."))
static constexpr const char AllowFilesDelim
static const char * DefaultPipelineMagicStr
A magic string for the default pass pipeline.
cl::opt< std::string > AllowFiles("sbvec-allow-files", cl::init(".*"), cl::Hidden, cl::desc("Run the vectorizer only on file paths that match any in the " "list of comma-separated regex's."))
static cl::opt< bool > PrintPassPipeline("sbvec-print-pass-pipeline", cl::init(false), cl::Hidden, cl::desc("Prints the pass pipeline and returns."))
A manager for alias analyses.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represents analyses that only rely on functions' control flow.
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
Module * getParent()
Get the module that this global value is contained inside of...
const std::string & getSourceFileName() const
Get the module's original source file name.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
PreservedAnalyses & preserveSet()
Mark an analysis set as preserved.
LLVM_ABI ~SandboxVectorizerPass()
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
LLVM_ABI SandboxVectorizerPass()
Analysis pass that exposes the ScalarEvolution for a function.
Analysis pass providing the TargetTransformInfo.
LLVM_ABI StringRef getName() const
Return a constant reference to the value's name.
static std::unique_ptr< FunctionPass > createFunctionPass(StringRef Name, StringRef Args)
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI raw_fd_ostream & outs()
This returns a reference to a raw_fd_ostream for standard output.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.