[PATCH] D71560: [SystemZ] Improve handling of "packed-stack" function attribute.
Jonas Paulsson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 16 11:40:04 PST 2019
jonpa created this revision.
jonpa added a reviewer: uweigand.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
Instead of just calling hasFnAttribute(), call getFnAttribute() and check that it is set to "true".
It seems that the "backchain" attribute does not have to be checked this way, since it is simply present or non-present. Would this be preferrable perhaps also for "packed-stack" (instead of this patch)?
https://reviews.llvm.org/D71560
Files:
llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp
llvm/test/CodeGen/SystemZ/frame-22.ll
Index: llvm/test/CodeGen/SystemZ/frame-22.ll
===================================================================
--- llvm/test/CodeGen/SystemZ/frame-22.ll
+++ llvm/test/CodeGen/SystemZ/frame-22.ll
@@ -84,4 +84,25 @@
ret i64 %C
}
+; Test that a packed-stack function attribute of "false" gets the default layout.
+define void @f5() #1 {
+; CHECK-LABEL: f5:
+; CHECK: stmg %r12, %r15, 96(%r15)
+; CHECK-NEXT: .cfi_offset %r12, -64
+; CHECK-NEXT: .cfi_offset %r15, -40
+; CHECK-NEXT: aghi %r15, -8
+; CHECK-NEXT: .cfi_def_cfa_offset 168
+; CHECK-NEXT: std %f8, 0(%r15) # 8-byte Folded Spill
+; CHECK-NEXT: .cfi_offset %f8, -168
+; CHECK-NEXT: #APP
+; CHECK-NEXT: #NO_APP
+; CHECK-NEXT: ld %f8, 0(%r15) # 8-byte Folded Reload
+; CHECK-NEXT: lmg %r12, %r15, 104(%r15)
+; CHECK-NEXT: br %r14
+ call void asm sideeffect "", "~{f8},~{r12}"() nounwind
+ ret void
+}
+
+
attributes #0 = { "packed-stack"="true" }
+attributes #1 = { "packed-stack"="false" }
Index: llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp
===================================================================
--- llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp
+++ llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp
@@ -63,12 +63,13 @@
}
static bool usePackedStack(MachineFunction &MF) {
- bool HasPackedStackAttr = MF.getFunction().hasFnAttribute("packed-stack");
+ bool PackedStack =
+ MF.getFunction().getFnAttribute("packed-stack").getValueAsString() == "true";
bool IsVarArg = MF.getFunction().isVarArg();
bool CallConv = MF.getFunction().getCallingConv() != CallingConv::GHC;
bool BackChain = MF.getFunction().hasFnAttribute("backchain");
bool FramAddressTaken = MF.getFrameInfo().isFrameAddressTaken();
- return HasPackedStackAttr && !IsVarArg && CallConv && !BackChain &&
+ return PackedStack && !IsVarArg && CallConv && !BackChain &&
!FramAddressTaken;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71560.234112.patch
Type: text/x-patch
Size: 1888 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191216/04bce7de/attachment.bin>
More information about the llvm-commits
mailing list