xref: /llvm-project/llvm/lib/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizer.cpp (revision 52dca6ffae08fcd86cff32ab469870016a6aceb5)
1 //===- SandboxVectorizer.cpp - Vectorizer based on Sandbox IR -------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "llvm/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizer.h"
10 #include "llvm/Support/CommandLine.h"
11 
12 using namespace llvm;
13 
14 #define SV_NAME "sandbox-vectorizer"
15 #define DEBUG_TYPE SV_NAME
16 
17 PreservedAnalyses SandboxVectorizerPass::run(Function &F,
18                                              FunctionAnalysisManager &AM) {
19   TTI = &AM.getResult<TargetIRAnalysis>(F);
20 
21   bool Changed = runImpl(F);
22   if (!Changed)
23     return PreservedAnalyses::all();
24 
25   PreservedAnalyses PA;
26   PA.preserveSet<CFGAnalyses>();
27   return PA;
28 }
29 
30 bool SandboxVectorizerPass::runImpl(Function &F) {
31   LLVM_DEBUG(dbgs() << "SBVec: Analyzing " << F.getName() << ".\n");
32   sandboxir::Context Ctx(F.getContext());
33   // Create SandboxIR for `F`.
34   sandboxir::Function &SBF = *Ctx.createFunction(&F);
35   // TODO: Initialize SBVec Pass Manager
36   (void)SBF;
37 
38   return false;
39 }
40