diff --git a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp --- a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp +++ b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp @@ -1315,14 +1315,16 @@ // EntryPoint Marker const MachineFrameInfo &MFFrame = MF->getFrameInfo(); bool IsUsingAlloca = MFFrame.hasVarSizedObjects(); + uint32_t DSASize = MFFrame.getStackSize(); + bool IsLeaf = DSASize == 0 && MFFrame.getCalleeSavedInfo().empty(); // Set Flags uint8_t Flags = 0; + if (IsLeaf) + Flags |= 0x08; if (IsUsingAlloca) Flags |= 0x04; - uint32_t DSASize = MFFrame.getStackSize(); - // Combine into top 27 bits of DSASize and bottom 5 bits of Flags. uint32_t DSAAndFlags = DSASize & 0xFFFFFFE0; // (x/32) << 5 DSAAndFlags |= Flags; @@ -1340,6 +1342,10 @@ if (OutStreamer->isVerboseAsm()) { OutStreamer->AddComment("DSA Size 0x" + Twine::utohexstr(DSASize)); OutStreamer->AddComment("Entry Flags"); + if (Flags & 0x08) + OutStreamer->AddComment(" Bit 1: 1 = Leaf function"); + else + OutStreamer->AddComment(" Bit 1: 0 = Non-leaf function"); if (Flags & 0x04) OutStreamer->AddComment(" Bit 2: 1 = Uses alloca"); else diff --git a/llvm/test/CodeGen/SystemZ/zos-prologue-epilog.ll b/llvm/test/CodeGen/SystemZ/zos-prologue-epilog.ll --- a/llvm/test/CodeGen/SystemZ/zos-prologue-epilog.ll +++ b/llvm/test/CodeGen/SystemZ/zos-prologue-epilog.ll @@ -380,6 +380,10 @@ } ; CHECK-LABEL: leaf_func +; CHECK: .long 8 * DSA Size 0x0 +; CHECK-NEXT: * Entry Flags +; CHECK-NEXT: * Bit 1: 1 = Leaf function +; CHECK-NEXT: * Bit 2: 0 = Does not use alloca ; CHECK-NOT: aghi 4, ; CHECK-NOT: stmg ; CHECK: agr 1, 2 diff --git a/llvm/test/MC/GOFF/ppa1.ll b/llvm/test/MC/GOFF/ppa1.ll --- a/llvm/test/MC/GOFF/ppa1.ll +++ b/llvm/test/MC/GOFF/ppa1.ll @@ -7,8 +7,9 @@ ; CHECK: .short 197 ; CHECK: .byte 0 ; CHECK: .byte 241 * Mark Type C'1' -; CHECK: .long 0 * DSA Size 0x0 +; CHECK: .long 8 * DSA Size 0x0 ; CHECK: * Entry Flags +; CHECK: * Bit 1: 1 = Leaf function ; CHECK: * Bit 2: 0 = Does not use alloca ; CHECK: @@func_end0: ; CHECK: .section ".ppa1"