#include "llvm/CodeGen/GlobalISel/Combiner.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/GlobalISel/CSEInfo.h"
#include "llvm/CodeGen/GlobalISel/CSEMIRBuilder.h"
#include "llvm/CodeGen/GlobalISel/CombinerInfo.h"
#include "llvm/CodeGen/GlobalISel/GISelChangeObserver.h"
#include "llvm/CodeGen/GlobalISel/GISelWorkList.h"
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
#include "llvm/CodeGen/GlobalISel/Utils.h"
#include "llvm/CodeGen/MachineOptimizationRemarkEmitter.h"
#include "llvm/Support/Debug.h"
#define DEBUG_TYPE …
usingnamespacellvm;
STATISTIC(NumOneIteration, "Number of functions with one iteration");
STATISTIC(NumTwoIterations, "Number of functions with two iterations");
STATISTIC(NumThreeOrMoreIterations,
"Number of functions with three or more iterations");
namespace llvm {
cl::OptionCategory GICombinerOptionCategory(
"GlobalISel Combiner",
"Control the rules which are enabled. These options all take a comma "
"separated list of rules to disable and may be specified by number "
"or number range (e.g. 1-10)."
#ifndef NDEBUG
" They may also be specified by name."
#endif
);
}
class Combiner::WorkListMaintainer : public GISelChangeObserver { … };
template <CombinerInfo::ObserverLevel Lvl>
class Combiner::WorkListMaintainerImpl : public Combiner::WorkListMaintainer { … };
std::unique_ptr<Combiner::WorkListMaintainer>
Combiner::WorkListMaintainer::create(Level Lvl, WorkListTy &WorkList,
MachineRegisterInfo &MRI) { … }
Combiner::Combiner(MachineFunction &MF, CombinerInfo &CInfo,
const TargetPassConfig *TPC, GISelKnownBits *KB,
GISelCSEInfo *CSEInfo)
: … { … }
Combiner::~Combiner() = default;
bool Combiner::tryDCE(MachineInstr &MI, MachineRegisterInfo &MRI) { … }
bool Combiner::combineMachineInstrs() { … }