Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:45

0001 //===- SandboxVectorizer.h --------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 #ifndef LLVM_TRANSFORMS_VECTORIZE_SANDBOXVECTORIZER_SANDBOXVECTORIZER_H
0009 #define LLVM_TRANSFORMS_VECTORIZE_SANDBOXVECTORIZER_SANDBOXVECTORIZER_H
0010 
0011 #include <memory>
0012 
0013 #include "llvm/Analysis/AliasAnalysis.h"
0014 #include "llvm/Analysis/ScalarEvolution.h"
0015 #include "llvm/IR/PassManager.h"
0016 #include "llvm/SandboxIR/Context.h"
0017 #include "llvm/SandboxIR/PassManager.h"
0018 
0019 namespace llvm {
0020 
0021 class TargetTransformInfo;
0022 
0023 class SandboxVectorizerPass : public PassInfoMixin<SandboxVectorizerPass> {
0024   TargetTransformInfo *TTI = nullptr;
0025   AAResults *AA = nullptr;
0026   ScalarEvolution *SE = nullptr;
0027   // NOTE: We define the Context as a pass-scope object instead of local object
0028   // in runOnFunction() because the passes defined in the pass-manager need
0029   // access to it for registering/deregistering callbacks during construction
0030   // and destruction.
0031   std::unique_ptr<sandboxir::Context> Ctx;
0032 
0033   // A pipeline of SandboxIR function passes run by the vectorizer.
0034   // NOTE: We define this as a pass-scope object to avoid recreating the
0035   // pass-pipeline every time in runOnFunction(). The downside is that the
0036   // Context also needs to be defined as a pass-scope object because the passes
0037   // within FPM may register/unregister callbacks, so they need access to
0038   // Context.
0039   sandboxir::FunctionPassManager FPM;
0040 
0041   bool runImpl(Function &F);
0042 
0043 public:
0044   // Make sure the constructors/destructors are out-of-line. This works around a
0045   // problem with -DBUILD_SHARED_LIBS=on where components that depend on the
0046   // Vectorizer component can't find the vtable for classes like
0047   // sandboxir::Pass. This way we don't have to make LLVMPasses add a direct
0048   // dependency on SandboxIR.
0049   SandboxVectorizerPass();
0050   SandboxVectorizerPass(SandboxVectorizerPass &&);
0051   ~SandboxVectorizerPass();
0052 
0053   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
0054 };
0055 
0056 } // namespace llvm
0057 
0058 #endif // LLVM_TRANSFORMS_VECTORIZE_SANDBOXVECTORIZER_SANDBOXVECTORIZER_H