xref: /llvm-project/llvm/lib/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizer.cpp (revision 7ea9f0d85fc3dc80b45e6ba7087c41c6f2481f07)
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/Analysis/TargetTransformInfo.h"
11 #include "llvm/SandboxIR/SandboxIR.h"
12 
13 using namespace llvm;
14 
15 #define SV_NAME "sandbox-vectorizer"
16 #define DEBUG_TYPE SV_NAME
17 
18 PreservedAnalyses SandboxVectorizerPass::run(Function &F,
19                                              FunctionAnalysisManager &AM) {
20   TTI = &AM.getResult<TargetIRAnalysis>(F);
21 
22   bool Changed = runImpl(F);
23   if (!Changed)
24     return PreservedAnalyses::all();
25 
26   PreservedAnalyses PA;
27   PA.preserveSet<CFGAnalyses>();
28   return PA;
29 }
30 
31 bool SandboxVectorizerPass::runImpl(Function &F) {
32   LLVM_DEBUG(dbgs() << "SBVec: Analyzing " << F.getName() << ".\n");
33   sandboxir::Context Ctx(F.getContext());
34   // Create SandboxIR for `F`.
35   sandboxir::Function &SBF = *Ctx.createFunction(&F);
36   // TODO: Initialize SBVec Pass Manager
37   (void)SBF;
38 
39   return false;
40 }
41