31 SystemZCopyPhysRegs() : MachineFunctionPass(ID), TII(nullptr), MRI(nullptr) {}
33 bool runOnMachineFunction(MachineFunction &MF)
override;
34 void getAnalysisUsage(AnalysisUsage &AU)
const override;
38 bool visitMBB(MachineBasicBlock &
MBB);
40 const SystemZInstrInfo *TII;
41 MachineRegisterInfo *MRI;
44char SystemZCopyPhysRegs::ID = 0;
49 "SystemZ Copy Physregs",
false,
false)
52 return new SystemZCopyPhysRegs();
55void SystemZCopyPhysRegs::getAnalysisUsage(
AnalysisUsage &AU)
const {
60bool SystemZCopyPhysRegs::visitMBB(MachineBasicBlock &
MBB) {
68 MachineInstr *
MI = &*
MBBI++;
77 (SrcReg == SystemZ::CC || SystemZ::AR32BitRegClass.contains(SrcReg))) {
78 Register Tmp =
MRI->createVirtualRegister(&SystemZ::GR32BitRegClass);
79 if (SrcReg == SystemZ::CC)
83 MI->getOperand(1).setReg(Tmp);
87 SystemZ::AR32BitRegClass.contains(DstReg)) {
88 Register Tmp =
MRI->createVirtualRegister(&SystemZ::GR32BitRegClass);
89 MI->getOperand(0).setReg(Tmp);
101bool SystemZCopyPhysRegs::runOnMachineFunction(MachineFunction &
F) {
102 TII =
F.getSubtarget<SystemZSubtarget>().getInstrInfo();
103 MRI = &
F.getRegInfo();
unsigned const MachineRegisterInfo * MRI
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
const HexagonInstrInfo * TII
Promote Memory to Register
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Represent the analysis usage information of a pass.
LLVM_ABI void setPreservesCFG()
This function should be called by the pass, iff they do not:
FunctionPass class - This class is used to implement most global optimizations.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
MachineInstrBundleIterator< MachineInstr > iterator
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
void substituteDebugValuesForInst(const MachineInstr &Old, MachineInstr &New, unsigned MaxOperand=UINT_MAX)
Create substitutions for any tracked values in Old, to point at New.
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
constexpr bool isVirtual() const
Return true if the specified register number is in the virtual register namespace.
This is an optimization pass for GlobalISel generic memory operations.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
FunctionPass * createSystemZCopyPhysRegsPass(SystemZTargetMachine &TM)