LLVM 18.0.0git
Scalarizer.h
Go to the documentation of this file.
1//===- Scalarizer.h --- Scalarize vector operations -----------------------===//
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/// \file
10/// This pass converts vector operations into scalar operations (or, optionally,
11/// operations on smaller vector widths), in order to expose optimization
12/// opportunities on the individual scalar operations.
13/// It is mainly intended for targets that do not have vector units, but it
14/// may also be useful for revectorizing code to different vector widths.
15//
16//===----------------------------------------------------------------------===//
17
18#ifndef LLVM_TRANSFORMS_SCALAR_SCALARIZER_H
19#define LLVM_TRANSFORMS_SCALAR_SCALARIZER_H
20
21#include "llvm/IR/PassManager.h"
22#include <optional>
23
24namespace llvm {
25
26class Function;
27class FunctionPass;
28
30 // These options correspond 1:1 to cl::opt options defined in
31 // Scalarizer.cpp. When the cl::opt are specified, they take precedence.
32 // When the cl::opt are not specified, the present optional values allow to
33 // override the cl::opt's default values.
34 std::optional<bool> ScalarizeVariableInsertExtract;
35 std::optional<bool> ScalarizeLoadStore;
36 std::optional<unsigned> ScalarizeMinBits;
37};
38
39class ScalarizerPass : public PassInfoMixin<ScalarizerPass> {
41
42public:
43 ScalarizerPass() = default;
45
47
49 Options.ScalarizeVariableInsertExtract = Value;
50 }
51 void setScalarizeLoadStore(bool Value) { Options.ScalarizeLoadStore = Value; }
52 void setScalarizeMinBits(unsigned Value) { Options.ScalarizeMinBits = Value; }
53};
54}
55
56#endif /* LLVM_TRANSFORMS_SCALAR_SCALARIZER_H */
#define F(x, y, z)
Definition: MD5.cpp:55
const char LLVMTargetMachineRef LLVMPassBuilderOptionsRef Options
This header defines various interfaces for pass management in LLVM.
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:649
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:172
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
ScalarizerPass(const ScalarizerPassOptions &Options)
Definition: Scalarizer.h:44
ScalarizerPass()=default
void setScalarizeLoadStore(bool Value)
Definition: Scalarizer.h:51
void setScalarizeVariableInsertExtract(bool Value)
Definition: Scalarizer.h:48
void setScalarizeMinBits(unsigned Value)
Definition: Scalarizer.h:52
LLVM Value Representation.
Definition: Value.h:74
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:391
std::optional< unsigned > ScalarizeMinBits
Definition: Scalarizer.h:36
std::optional< bool > ScalarizeVariableInsertExtract
Definition: Scalarizer.h:34
std::optional< bool > ScalarizeLoadStore
Definition: Scalarizer.h:35