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 DenseSet<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 void collectPotentiallyDeadInstrs(ArrayRef<Value *> Bndl);
39 /// Recursively try to vectorize \p Bndl and its operands.
40 Value *vectorizeRec(ArrayRef<Value *> Bndl, unsigned Depth);
41 /// Entry point for vectorization starting from \p Seeds.
42 bool tryVectorize(ArrayRef<Value *> Seeds);
43
44 /// The PM containing the pipeline of region passes.
46
47public:
48 BottomUpVec(StringRef Pipeline);
49 bool runOnFunction(Function &F, const Analyses &A) final;
50 void printPipeline(raw_ostream &OS) const final {
51 OS << getName() << "\n";
52 RPM.printPipeline(OS);
53 }
54};
55
56} // namespace llvm::sandboxir
57
58#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
Implements a dense probed hash-table based set.
Definition: DenseSet.h:278
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:50
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:75
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:61
A SandboxIR Value has users. This is the base class.
Definition: Value.h:63