#include "MIRVRegNamerUtils.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
usingnamespacellvm;
#define DEBUG_TYPE …
static cl::opt<unsigned>
CanonicalizeFunctionNumber("canon-nth-function", cl::Hidden, cl::init(~0u),
cl::value_desc("N"),
cl::desc("Function number to canonicalize."));
namespace {
class MIRCanonicalizer : public MachineFunctionPass { … };
}
char MIRCanonicalizer::ID;
char &llvm::MIRCanonicalizerID = …;
INITIALIZE_PASS_BEGIN(MIRCanonicalizer, "mir-canonicalizer",
"Rename Register Operands Canonically", false, false)
INITIALIZE_PASS_END(MIRCanonicalizer, "mir-canonicalizer",
"Rename Register Operands Canonically", false, false)
static std::vector<MachineBasicBlock *> GetRPOList(MachineFunction &MF) { … }
static bool
rescheduleLexographically(std::vector<MachineInstr *> instructions,
MachineBasicBlock *MBB,
std::function<MachineBasicBlock::iterator()> getPos) { … }
static bool rescheduleCanonically(unsigned &PseudoIdempotentInstCount,
MachineBasicBlock *MBB) { … }
static bool propagateLocalCopies(MachineBasicBlock *MBB) { … }
static bool doDefKillClear(MachineBasicBlock *MBB) { … }
static bool runOnBasicBlock(MachineBasicBlock *MBB,
unsigned BasicBlockNum, VRegRenamer &Renamer) { … }
bool MIRCanonicalizer::runOnMachineFunction(MachineFunction &MF) { … }