@@ -5066,10 +5066,10 @@ void AArch64InstrInfo::copyPhysReg(MachineBasicBlock &MBB,
50665066 Register SrcReg, bool KillSrc,
50675067 bool RenamableDest,
50685068 bool RenamableSrc) const {
5069+ const TargetRegisterInfo *TRI = &getRegisterInfo ();
5070+
50695071 if (AArch64::GPR32spRegClass.contains (DestReg) &&
50705072 (AArch64::GPR32spRegClass.contains (SrcReg) || SrcReg == AArch64::WZR)) {
5071- const TargetRegisterInfo *TRI = &getRegisterInfo ();
5072-
50735073 if (DestReg == AArch64::WSP || SrcReg == AArch64::WSP) {
50745074 // If either operand is WSP, expand to ADD #0.
50755075 if (Subtarget.hasZeroCycleRegMoveGPR64 () &&
@@ -5338,7 +5338,6 @@ void AArch64InstrInfo::copyPhysReg(MachineBasicBlock &MBB,
53385338 if (Subtarget.hasZeroCycleRegMoveFPR128 () &&
53395339 !Subtarget.hasZeroCycleRegMoveFPR64 () &&
53405340 !Subtarget.hasZeroCycleRegMoveFPR32 () && Subtarget.isNeonAvailable ()) {
5341- const TargetRegisterInfo *TRI = &getRegisterInfo ();
53425341 MCRegister DestRegQ = TRI->getMatchingSuperReg (DestReg, AArch64::dsub,
53435342 &AArch64::FPR128RegClass);
53445343 MCRegister SrcRegQ = TRI->getMatchingSuperReg (SrcReg, AArch64::dsub,
@@ -5363,7 +5362,6 @@ void AArch64InstrInfo::copyPhysReg(MachineBasicBlock &MBB,
53635362 if (Subtarget.hasZeroCycleRegMoveFPR128 () &&
53645363 !Subtarget.hasZeroCycleRegMoveFPR64 () &&
53655364 !Subtarget.hasZeroCycleRegMoveFPR32 () && Subtarget.isNeonAvailable ()) {
5366- const TargetRegisterInfo *TRI = &getRegisterInfo ();
53675365 MCRegister DestRegQ = TRI->getMatchingSuperReg (DestReg, AArch64::ssub,
53685366 &AArch64::FPR128RegClass);
53695367 MCRegister SrcRegQ = TRI->getMatchingSuperReg (SrcReg, AArch64::ssub,
@@ -5378,7 +5376,6 @@ void AArch64InstrInfo::copyPhysReg(MachineBasicBlock &MBB,
53785376 .addReg (SrcReg, RegState::Implicit | getKillRegState (KillSrc));
53795377 } else if (Subtarget.hasZeroCycleRegMoveFPR64 () &&
53805378 !Subtarget.hasZeroCycleRegMoveFPR32 ()) {
5381- const TargetRegisterInfo *TRI = &getRegisterInfo ();
53825379 MCRegister DestRegD = TRI->getMatchingSuperReg (DestReg, AArch64::ssub,
53835380 &AArch64::FPR64RegClass);
53845381 MCRegister SrcRegD = TRI->getMatchingSuperReg (SrcReg, AArch64::ssub,
@@ -5402,7 +5399,6 @@ void AArch64InstrInfo::copyPhysReg(MachineBasicBlock &MBB,
54025399 if (Subtarget.hasZeroCycleRegMoveFPR128 () &&
54035400 !Subtarget.hasZeroCycleRegMoveFPR64 () &&
54045401 !Subtarget.hasZeroCycleRegMoveFPR32 () && Subtarget.isNeonAvailable ()) {
5405- const TargetRegisterInfo *TRI = &getRegisterInfo ();
54065402 MCRegister DestRegQ = TRI->getMatchingSuperReg (DestReg, AArch64::hsub,
54075403 &AArch64::FPR128RegClass);
54085404 MCRegister SrcRegQ = TRI->getMatchingSuperReg (SrcReg, AArch64::hsub,
@@ -5417,7 +5413,6 @@ void AArch64InstrInfo::copyPhysReg(MachineBasicBlock &MBB,
54175413 .addReg (SrcReg, RegState::Implicit | getKillRegState (KillSrc));
54185414 } else if (Subtarget.hasZeroCycleRegMoveFPR64 () &&
54195415 !Subtarget.hasZeroCycleRegMoveFPR32 ()) {
5420- const TargetRegisterInfo *TRI = &getRegisterInfo ();
54215416 MCRegister DestRegD = TRI->getMatchingSuperReg (DestReg, AArch64::hsub,
54225417 &AArch64::FPR64RegClass);
54235418 MCRegister SrcRegD = TRI->getMatchingSuperReg (SrcReg, AArch64::hsub,
@@ -5430,10 +5425,10 @@ void AArch64InstrInfo::copyPhysReg(MachineBasicBlock &MBB,
54305425 .addReg (SrcRegD, RegState::Undef)
54315426 .addReg (SrcReg, RegState::Implicit | getKillRegState (KillSrc));
54325427 } else {
5433- DestReg = RI. getMatchingSuperReg (DestReg, AArch64::hsub,
5434- &AArch64::FPR32RegClass);
5435- SrcReg = RI. getMatchingSuperReg (SrcReg, AArch64::hsub,
5436- &AArch64::FPR32RegClass);
5428+ DestReg = TRI-> getMatchingSuperReg (DestReg, AArch64::hsub,
5429+ &AArch64::FPR32RegClass);
5430+ SrcReg = TRI-> getMatchingSuperReg (SrcReg, AArch64::hsub,
5431+ &AArch64::FPR32RegClass);
54375432 BuildMI (MBB, I, DL, get (AArch64::FMOVSr), DestReg)
54385433 .addReg (SrcReg, getKillRegState (KillSrc));
54395434 }
@@ -5445,7 +5440,6 @@ void AArch64InstrInfo::copyPhysReg(MachineBasicBlock &MBB,
54455440 if (Subtarget.hasZeroCycleRegMoveFPR128 () &&
54465441 !Subtarget.hasZeroCycleRegMoveFPR64 () &&
54475442 !Subtarget.hasZeroCycleRegMoveFPR64 () && Subtarget.isNeonAvailable ()) {
5448- const TargetRegisterInfo *TRI = &getRegisterInfo ();
54495443 MCRegister DestRegQ = TRI->getMatchingSuperReg (DestReg, AArch64::bsub,
54505444 &AArch64::FPR128RegClass);
54515445 MCRegister SrcRegQ = TRI->getMatchingSuperReg (SrcReg, AArch64::bsub,
@@ -5460,7 +5454,6 @@ void AArch64InstrInfo::copyPhysReg(MachineBasicBlock &MBB,
54605454 .addReg (SrcReg, RegState::Implicit | getKillRegState (KillSrc));
54615455 } else if (Subtarget.hasZeroCycleRegMoveFPR64 () &&
54625456 !Subtarget.hasZeroCycleRegMoveFPR32 ()) {
5463- const TargetRegisterInfo *TRI = &getRegisterInfo ();
54645457 MCRegister DestRegD = TRI->getMatchingSuperReg (DestReg, AArch64::bsub,
54655458 &AArch64::FPR64RegClass);
54665459 MCRegister SrcRegD = TRI->getMatchingSuperReg (SrcReg, AArch64::bsub,
@@ -5473,10 +5466,10 @@ void AArch64InstrInfo::copyPhysReg(MachineBasicBlock &MBB,
54735466 .addReg (SrcRegD, RegState::Undef)
54745467 .addReg (SrcReg, RegState::Implicit | getKillRegState (KillSrc));
54755468 } else {
5476- DestReg = RI. getMatchingSuperReg (DestReg, AArch64::bsub,
5477- &AArch64::FPR32RegClass);
5478- SrcReg = RI. getMatchingSuperReg (SrcReg, AArch64::bsub,
5479- &AArch64::FPR32RegClass);
5469+ DestReg = TRI-> getMatchingSuperReg (DestReg, AArch64::bsub,
5470+ &AArch64::FPR32RegClass);
5471+ SrcReg = TRI-> getMatchingSuperReg (SrcReg, AArch64::bsub,
5472+ &AArch64::FPR32RegClass);
54805473 BuildMI (MBB, I, DL, get (AArch64::FMOVSr), DestReg)
54815474 .addReg (SrcReg, getKillRegState (KillSrc));
54825475 }
@@ -5536,9 +5529,8 @@ void AArch64InstrInfo::copyPhysReg(MachineBasicBlock &MBB,
55365529 }
55375530
55385531#ifndef NDEBUG
5539- const TargetRegisterInfo &TRI = getRegisterInfo ();
5540- errs () << TRI.getRegAsmName (DestReg) << " = COPY "
5541- << TRI.getRegAsmName (SrcReg) << " \n " ;
5532+ errs () << TRI->getRegAsmName (DestReg) << " = COPY "
5533+ << TRI->getRegAsmName (SrcReg) << " \n " ;
55425534#endif
55435535 llvm_unreachable (" unimplemented reg-to-reg copy" );
55445536}
0 commit comments