LLVM 20.0.0git
BottomUpVec.h
Go to the documentation of this file.
1//===- BottomUpVec.h --------------------------------------------*- C++ -*-===//
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// A Bottom-Up Vectorizer pass.
10//
11
12#ifndef LLVM_TRANSFORMS_VECTORIZE_SANDBOXVECTORIZER_PASSES_BOTTOMUPVEC_H
13#define LLVM_TRANSFORMS_VECTORIZE_SANDBOXVECTORIZER_PASSES_BOTTOMUPVEC_H
14
15#include "llvm/ADT/ArrayRef.h"
16#include "llvm/ADT/StringRef.h"
18#include "llvm/SandboxIR/Pass.h"
22
23namespace llvm::sandboxir {
24
25class BottomUpVec final : public FunctionPass {
26 bool Change = false;
27 std::unique_ptr<LegalityAnalysis> Legality;
28 SmallVector<Instruction *> DeadInstrCandidates;
29
30 /// Creates and returns a vector instruction that replaces the instructions in
31 /// \p Bndl. \p Operands are the already vectorized operands.
32 Value *createVectorInstr(ArrayRef<Value *> Bndl, ArrayRef<Value *> Operands);
33 /// Erases all dead instructions from the dead instruction candidates
34 /// collected during vectorization.
35 void tryEraseDeadInstrs();
36 /// Packs all elements of \p ToPack into a vector and returns that vector.
37 Value *createPack(ArrayRef<Value *> ToPack);
38 /// Recursively try to vectorize \p Bndl and its operands.
39 Value *vectorizeRec(ArrayRef<Value *> Bndl, unsigned Depth);
40 /// Entry point for vectorization starting from \p Seeds.
41 bool tryVectorize(ArrayRef<Value *> Seeds);
42
43 /// The PM containing the pipeline of region passes.
45
46public:
47 BottomUpVec(StringRef Pipeline);
48 bool runOnFunction(Function &F, const Analyses &A) final;
49 void printPipeline(raw_ostream &OS) const final {
50 OS << getName() << "\n";
51 RPM.printPipeline(OS);
52 }
53};
54
55} // namespace llvm::sandboxir
56
57#endif // LLVM_TRANSFORMS_VECTORIZE_SANDBOXVECTORIZER_PASSES_BOTTOMUPVEC_H
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
#define F(x, y, z)
Definition: MD5.cpp:55
mir Rename Register Operands
raw_pwrite_stream & OS
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1196
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
void printPipeline(raw_ostream &OS) const final
Similar to print() but adds a newline. Used for testing.
Definition: BottomUpVec.h:49
bool runOnFunction(Function &F, const Analyses &A) final
\Returns true if it modifies F.
A pass that runs on a sandbox::Function.
Definition: Pass.h:71
void printPipeline(raw_ostream &OS) const override
Similar to print() but prints one pass per line. Used for testing.
Definition: PassManager.h:197
StringRef getName() const
\Returns the name of the pass.
Definition: Pass.h:57
A SandboxIR Value has users. This is the base class.
Definition: Value.h:63