43#define GET_GICOMBINER_DEPS
44#include "X86GenPostLegalizeGICombiner.inc"
45#undef GET_GICOMBINER_DEPS
47#define DEBUG_TYPE "X86-postlegalizer-combiner"
58 F.hasOptSize(),
F.hasMinSize());
67#define GET_GICOMBINER_TYPES
68#include "X86GenPostLegalizeGICombiner.inc"
69#undef GET_GICOMBINER_TYPES
71class X86PostLegalizerCombinerImpl :
public Combiner {
74 const X86PostLegalizerCombinerImplRuleConfig &RuleConfig;
78 X86PostLegalizerCombinerImpl(
81 const X86PostLegalizerCombinerImplRuleConfig &RuleConfig,
84 static const char *
getName() {
return "X86PostLegalizerCombiner"; }
90#define GET_GICOMBINER_CLASS_MEMBERS
91#include "X86GenPostLegalizeGICombiner.inc"
92#undef GET_GICOMBINER_CLASS_MEMBERS
95#define GET_GICOMBINER_IMPL
96#include "X86GenPostLegalizeGICombiner.inc"
97#undef GET_GICOMBINER_IMPL
99X86PostLegalizerCombinerImpl::X86PostLegalizerCombinerImpl(
102 const X86PostLegalizerCombinerImplRuleConfig &RuleConfig,
104 :
Combiner(MF, CInfo, TPC, &VT, CSEInfo),
105 Helper(Observer,
B,
false, &VT, MDT,
107 RuleConfig(RuleConfig), STI(MF.getSubtarget<
X86Subtarget>()),
109#include
"X86GenPostLegalizeGICombiner.inc"
114bool X86PostLegalizerCombinerImpl::tryCombineAll(
MachineInstr &
MI)
const {
115 return tryCombineAllImpl(
MI);
118class X86PostLegalizerCombinerLegacy :
public MachineFunctionPass {
122 X86PostLegalizerCombinerLegacy();
124 StringRef getPassName()
const override {
125 return "X86PostLegalizerCombinerLegacy";
128 bool runOnMachineFunction(MachineFunction &MF)
override;
129 void getAnalysisUsage(AnalysisUsage &AU)
const override;
132 X86PostLegalizerCombinerImplRuleConfig RuleConfig;
136void X86PostLegalizerCombinerLegacy::getAnalysisUsage(AnalysisUsage &AU)
const {
140 AU.
addRequired<GISelValueTrackingAnalysisLegacy>();
151X86PostLegalizerCombinerLegacy::X86PostLegalizerCombinerLegacy()
152 : MachineFunctionPass(
ID) {
153 if (!RuleConfig.parseCommandLineOption())
157bool X86PostLegalizerCombinerLegacy::runOnMachineFunction(
MachineFunction &MF) {
161 auto *TPC = &getAnalysis<TargetPassConfig>();
165 &getAnalysis<GISelValueTrackingAnalysisLegacy>().get(MF);
167 &getAnalysis<MachineDominatorTreeWrapperPass>().getDomTree();
169 getAnalysis<GISelCSEAnalysisWrapperPass>().getCSEWrapper();
170 auto *CSEInfo = &
Wrapper.get(TPC->getCSEConfig());
174 X86PostLegalizerCombinerImpl Impl(MF, CInfo, TPC, *VT, CSEInfo, RuleConfig,
176 return Impl.combineMachineInstrs();
179char X86PostLegalizerCombinerLegacy::ID = 0;
181 "Combine X86 MachineInstrs after legalization",
false,
186 "Combine X86 MachineInstrs after legalization",
false,
205 X86PostLegalizerCombinerImplRuleConfig RuleConfig;
206 if (!RuleConfig.parseCommandLineOption())
209 X86PostLegalizerCombinerImpl Impl(MF, CInfo,
nullptr, VT, CSEInfo.get(),
211 if (!Impl.combineMachineInstrs())
222 return new X86PostLegalizerCombinerLegacy();
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define GET_GICOMBINER_CONSTRUCTOR_INITS
amdgpu aa AMDGPU Address space based Alias Analysis Wrapper
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
Provides analysis for continuously CSEing during GISel passes.
This file implements a version of MachineIRBuilder which CSEs insts within a MachineBasicBlock.
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.
This contains common code to allow clients to notify changes to machine instr.
Provides analysis for querying information about KnownBits during GISel passes.
Declares convenience wrapper classes for interpreting MachineInstr instances as specific generic oper...
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.
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.
FunctionPass class - This class is used to implement most global optimizations.
Simple wrapper that does the following.
To use KnownBitsInfo analysis in a pass, KnownBitsInfo &Info = getAnalysis<GISelValueTrackingInfoAnal...
Analysis pass which computes a MachineDominatorTree.
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
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.
Target-Independent Code Generator Pass Configuration Options.
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
LLVM_ABI void reportFatalInternalError(Error Err)
Report a fatal error that indicates a bug in LLVM.
LLVM_ABI PreservedAnalyses getMachineFunctionPassPreservedAnalyses()
Returns the minimum set of Analyses that all machine function passes must preserve.
FunctionPass * createX86PostLegalizerCombinerLegacy()
LLVM_ABI void getSelectionDAGFallbackAnalysisUsage(AnalysisUsage &AU)
Modify analysis usage so it preserves passes required for the SelectionDAG fallback.
unsigned MaxIterations
The maximum number of times the Combiner will iterate over the MachineFunction.
ObserverLevel ObserverLvl
Select how the Combiner acts on MIR changes.
bool EnableFullDCE
Whether dead code elimination is performed before each Combiner iteration.
@ SinglePass
Enables Observer-based DCE and additional heuristics that retry combining defined and used instructio...