[llvm-branch-commits] [llvm] [mcp-frameinst: 2/3]: [MCP][NFC] Opinionated refactoring (PR #186239)
Matt Arsenault via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Apr 10 05:53:37 PDT 2026
================
@@ -94,9 +94,26 @@ static cl::opt<cl::boolOrDefault>
namespace {
-static std::optional<DestSourcePair> isCopyInstr(const MachineInstr &MI,
- const TargetInstrInfo &TII,
- bool UseCopyInstr) {
+MCRegister asPhysMCReg(const MachineOperand *Operand) {
+ Register Reg = Operand->getReg();
+ assert(Reg.isPhysical() &&
+ "MachineCopyPropagation should be run after register allocation!");
+ return Reg;
+}
+
+MCRegister getDstMCReg(const DestSourcePair &DSP) {
+ return asPhysMCReg(DSP.Destination);
+}
+MCRegister getSrcMCReg(const DestSourcePair &DSP) {
+ return asPhysMCReg(DSP.Source);
+}
+std::pair<MCRegister, MCRegister> getDstSrcMCRegs(const DestSourcePair &DSP) {
+ return {getDstMCReg(DSP), getSrcMCReg(DSP)};
+}
+
+std::optional<DestSourcePair> isCopyInstr(const MachineInstr &MI,
+ const TargetInstrInfo &TII,
+ bool UseCopyInstr) {
if (UseCopyInstr)
----------------
arsenm wrote:
This API is weird, why isn't this the only path?
https://github.com/llvm/llvm-project/pull/186239
More information about the llvm-branch-commits
mailing list