34#define GET_GICOMBINER_DEPS
35#include "AArch64GenO0PreLegalizeGICombiner.inc"
36#undef GET_GICOMBINER_DEPS
38#define DEBUG_TYPE "aarch64-O0-prelegalizer-combiner"
43#define GET_GICOMBINER_TYPES
44#include "AArch64GenO0PreLegalizeGICombiner.inc"
45#undef GET_GICOMBINER_TYPES
49class AArch64O0PreLegalizerCombinerImpl :
public Combiner {
52 const AArch64O0PreLegalizerCombinerImplRuleConfig &RuleConfig;
57 AArch64O0PreLegalizerCombinerImpl(
60 const AArch64O0PreLegalizerCombinerImplRuleConfig &RuleConfig,
63 static const char *
getName() {
return "AArch64O0PreLegalizerCombiner"; }
70#define GET_GICOMBINER_CLASS_MEMBERS
71#include "AArch64GenO0PreLegalizeGICombiner.inc"
72#undef GET_GICOMBINER_CLASS_MEMBERS
75#define GET_GICOMBINER_IMPL
76#include "AArch64GenO0PreLegalizeGICombiner.inc"
77#undef GET_GICOMBINER_IMPL
79AArch64O0PreLegalizerCombinerImpl::AArch64O0PreLegalizerCombinerImpl(
82 const AArch64O0PreLegalizerCombinerImplRuleConfig &RuleConfig,
85 Helper(Observer,
B,
true, &VT), RuleConfig(RuleConfig),
86 STI(STI), Libcalls(Libcalls),
88#include
"AArch64GenO0PreLegalizeGICombiner.inc"
93bool AArch64O0PreLegalizerCombinerImpl::tryCombineAll(
MachineInstr &
MI)
const {
94 if (tryCombineAllImpl(
MI))
97 unsigned Opc =
MI.getOpcode();
99 case TargetOpcode::G_SHUFFLE_VECTOR:
101 case TargetOpcode::G_MEMCPY_INLINE:
103 case TargetOpcode::G_MEMCPY:
104 case TargetOpcode::G_MEMMOVE:
105 case TargetOpcode::G_MEMSET: {
107 unsigned MaxLen = 32;
111 if (
Opc == TargetOpcode::G_MEMSET)
113 CInfo.EnableMinSize);
122 MachineFunction &MF, GISelValueTracking *VT,
123 const LibcallLoweringInfo &Libcalls,
124 const AArch64O0PreLegalizerCombinerImplRuleConfig &RuleConfig) {
128 CombinerInfo CInfo(
true,
false,
130 F.hasOptSize(),
F.hasMinSize());
133 CInfo.MaxIterations = 1;
135 AArch64O0PreLegalizerCombinerImpl Impl(MF, CInfo, *VT,
136 nullptr, RuleConfig, ST,
138 return Impl.combineMachineInstrs();
144class AArch64O0PreLegalizerCombinerLegacy :
public MachineFunctionPass {
148 AArch64O0PreLegalizerCombinerLegacy();
150 StringRef getPassName()
const override {
151 return "AArch64O0PreLegalizerCombiner";
154 bool runOnMachineFunction(MachineFunction &MF)
override;
156 void getAnalysisUsage(AnalysisUsage &AU)
const override;
159 AArch64O0PreLegalizerCombinerImplRuleConfig RuleConfig;
163void AArch64O0PreLegalizerCombinerLegacy::getAnalysisUsage(
164 AnalysisUsage &AU)
const {
167 AU.
addRequired<GISelValueTrackingAnalysisLegacy>();
173AArch64O0PreLegalizerCombinerLegacy::AArch64O0PreLegalizerCombinerLegacy()
174 : MachineFunctionPass(
ID) {
175 if (!RuleConfig.parseCommandLineOption())
179bool AArch64O0PreLegalizerCombinerLegacy::runOnMachineFunction(
185 GISelValueTracking *VT =
186 &getAnalysis<GISelValueTrackingAnalysisLegacy>().get(MF);
189 const LibcallLoweringInfo &Libcalls =
190 getAnalysis<LibcallLoweringInfoWrapper>().getLibcallLowering(
193 return runCombiner(MF, VT, Libcalls, RuleConfig);
196char AArch64O0PreLegalizerCombinerLegacy::ID = 0;
198 "Combine AArch64 machine instrs before legalization",
204 "Combine AArch64 machine instrs before legalization",
false,
209 std::make_unique<AArch64O0PreLegalizerCombinerImplRuleConfig>()) {
210 if (!RuleConfig->parseCommandLineOption())
239 if (!runCombiner(MF, &VT, Libcalls, *RuleConfig))
250 return new AArch64O0PreLegalizerCombinerLegacy();
#define GET_GICOMBINER_CONSTRUCTOR_INITS
static const Function * getParent(const Value *V)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
This contains common combine transformations that may be used in a combine pass,or by the target else...
Option class for Targets to specify which operations are combined how and when.
This contains the base class for all Combiners generated by TableGen.
Provides analysis for querying information about KnownBits during GISel passes.
Contains matchers for matching SSA Machine Instructions.
This file declares the MachineIRBuilder class.
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
static StringRef getName(Value *V)
Target-Independent Code Generator Pass Configuration Options pass.
AArch64O0PreLegalizerCombinerPass()
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
~AArch64O0PreLegalizerCombinerPass()
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
AnalysisUsage & addRequired()
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
LLVM_ABI void setPreservesCFG()
This function should be called by the pass, iff they do not:
Represents analyses that only rely on functions' control flow.
bool tryEmitMemcpyInline(MachineInstr &MI) const
Emit loads and stores that perform the given memcpy.
bool tryCombineShuffleVector(MachineInstr &MI) const
Try to combine G_SHUFFLE_VECTOR into G_CONCAT_VECTORS.
bool tryCombineMemCpyFamily(MachineInstr &MI, unsigned MaxLen=0) const
Optimize memcpy intrinsics et al, e.g.
FunctionPass class - This class is used to implement most global optimizations.
The actual analysis pass wrapper.
To use KnownBitsInfo analysis in a pass, KnownBitsInfo &Info = getAnalysis<GISelValueTrackingInfoAnal...
Tracks which library functions to use for a particular subtarget.
Record a mapping from subtarget to LibcallLoweringInfo.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Function & getFunction()
Return the LLVM function that this machine code represents.
const MachineFunctionProperties & getProperties() const
Get the function properties.
Representation of each machine instruction.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
PreservedAnalyses & preserveSet()
Mark an analysis set as preserved.
PreservedAnalyses & preserve()
Mark an analysis as preserved.
bool tryEmitBZero(MachineInstr &MI, MachineIRBuilder &MIRBuilder, const LibcallLoweringInfo &Libcalls, bool MinSize)
Replace a G_MEMSET with a value of 0 with a G_BZERO instruction if it is supported and beneficial to ...
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
OuterAnalysisManagerProxy< ModuleAnalysisManager, MachineFunction > ModuleAnalysisManagerMachineFunctionProxy
Provide the ModuleAnalysisManager to Function proxy.
FunctionPass * createAArch64O0PreLegalizerCombiner()
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
LLVM_ABI PreservedAnalyses getMachineFunctionPassPreservedAnalyses()
Returns the minimum set of Analyses that all machine function passes must preserve.
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
LLVM_ABI void getSelectionDAGFallbackAnalysisUsage(AnalysisUsage &AU)
Modify analysis usage so it preserves passes required for the SelectionDAG fallback.
LLVM_ABI void reportFatalUsageError(Error Err)
Report a fatal error that does not indicate a bug in LLVM.
Implement std::hash so that hash_code can be used in STL containers.