[PATCH] D27089: [Sparc] Check register use with isPhysRegUsed() instead of reg_nodbg_empty()
Daniel Cederman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 8 07:35:19 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL297285: [Sparc] Check register use with isPhysRegUsed() instead of reg_nodbg_empty() (authored by dcederman).
Changed prior to commit:
https://reviews.llvm.org/D27089?vs=79189&id=91015#toc
Repository:
rL LLVM
https://reviews.llvm.org/D27089
Files:
llvm/trunk/lib/Target/Sparc/SparcFrameLowering.cpp
llvm/trunk/test/CodeGen/SPARC/reserved-regs.ll
Index: llvm/trunk/test/CodeGen/SPARC/reserved-regs.ll
===================================================================
--- llvm/trunk/test/CodeGen/SPARC/reserved-regs.ll
+++ llvm/trunk/test/CodeGen/SPARC/reserved-regs.ll
@@ -1,11 +1,12 @@
-; RUN: llc -march=sparc < %s | FileCheck %s
+; RUN: llc -march=sparc -verify-machineinstrs < %s | FileCheck %s
@g = common global [32 x i32] zeroinitializer, align 16
@h = common global [16 x i64] zeroinitializer, align 16
;; Ensures that we don't use registers which are supposed to be reserved.
; CHECK-LABEL: use_all_i32_regs:
+; CHECK: save %sp
; CHECK-NOT: %g0
; CHECK-NOT: %g1
; CHECK-NOT: %g5
@@ -86,6 +87,7 @@
; CHECK-LABEL: use_all_i64_regs:
+; CHECK: save %sp
; CHECK-NOT: %g0
; CHECK-NOT: %g1
; CHECK-NOT: %g4
Index: llvm/trunk/lib/Target/Sparc/SparcFrameLowering.cpp
===================================================================
--- llvm/trunk/lib/Target/Sparc/SparcFrameLowering.cpp
+++ llvm/trunk/lib/Target/Sparc/SparcFrameLowering.cpp
@@ -288,11 +288,11 @@
{
for (unsigned reg = SP::I0; reg <= SP::I7; ++reg)
- if (!MRI->reg_nodbg_empty(reg))
+ if (MRI->isPhysRegUsed(reg))
return false;
for (unsigned reg = SP::L0; reg <= SP::L7; ++reg)
- if (!MRI->reg_nodbg_empty(reg))
+ if (MRI->isPhysRegUsed(reg))
return false;
return true;
@@ -305,20 +305,19 @@
MachineFrameInfo &MFI = MF.getFrameInfo();
return !(MFI.hasCalls() // has calls
- || !MRI.reg_nodbg_empty(SP::L0) // Too many registers needed
- || !MRI.reg_nodbg_empty(SP::O6) // %SP is used
+ || MRI.isPhysRegUsed(SP::L0) // Too many registers needed
+ || MRI.isPhysRegUsed(SP::O6) // %SP is used
|| hasFP(MF)); // need %FP
}
void SparcFrameLowering::remapRegsForLeafProc(MachineFunction &MF) const {
MachineRegisterInfo &MRI = MF.getRegInfo();
// Remap %i[0-7] to %o[0-7].
for (unsigned reg = SP::I0; reg <= SP::I7; ++reg) {
- if (MRI.reg_nodbg_empty(reg))
+ if (!MRI.isPhysRegUsed(reg))
continue;
unsigned mapped_reg = reg - SP::I0 + SP::O0;
- assert(MRI.reg_nodbg_empty(mapped_reg));
// Replace I register with O register.
MRI.replaceRegWith(reg, mapped_reg);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27089.91015.patch
Type: text/x-patch
Size: 2296 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170308/1f9e75f3/attachment.bin>
More information about the llvm-commits
mailing list