/// Given a MachineOperand of a stackified vreg, return the instruction at the /// start of the expression tree. static MachineInstr *FindStartOfTree(MachineOperand &MO, MachineRegisterInfo &MRI, WebAssemblyFunctionInfo &MFI) { unsigned Reg = MO.getReg(); assert(MFI.isVRegStackified(Reg)); MachineInstr *Def = MRI.getVRegDef(Reg); // Find the first stackified use and proceed from there. for (MachineOperand &DefMO : Def->explicit_uses()) { if (!DefMO.isReg()) continue; return FindStartOfTree(DefMO, MRI, MFI); } // If there were no stackified uses, we've reached the start. return Def; }