[PATCH] D95227: DRY for copy physical register
luxufan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 22 06:15:12 PST 2021
StephenFan created this revision.
StephenFan added reviewers: asb, luismarques, jrtc27, craig.topper.
Herald added subscribers: frasercrmck, apazos, sameer.abuasal, pzheng, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya.
StephenFan requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.
use the copyPhyReg function to move SP to BP
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D95227
Files:
llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
Index: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
+++ llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
@@ -481,12 +481,9 @@
// FP will be used to restore the frame in the epilogue, so we need
// another base register BP to record SP after re-alignment. SP will
// track the current stack after allocating variable sized objects.
- if (hasBP(MF)) {
+ if (hasBP(MF))
// move BP, SP
- BuildMI(MBB, MBBI, DL, TII->get(RISCV::ADDI), BPReg)
- .addReg(SPReg)
- .addImm(0);
- }
+ TII->copyPhysReg(MBB, MBBI, DL, BPReg, SPReg, false);
}
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95227.318506.patch
Type: text/x-patch
Size: 737 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210122/ed5d8772/attachment.bin>
More information about the llvm-commits
mailing list