diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp --- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -2133,8 +2133,9 @@ // Set the 5th byte of mandatory field. uint32_t SecondHalfOfMandatoryField = 0; - // Always store back chain. - SecondHalfOfMandatoryField |= TracebackTable::IsBackChainStoredMask; + SecondHalfOfMandatoryField |= MF->getFrameInfo().getStackSize() + ? TracebackTable::IsBackChainStoredMask + : 0; uint32_t FPRSaved = 0; for (unsigned Reg = PPC::F14; Reg <= PPC::F31; ++Reg) { diff --git a/llvm/test/CodeGen/PowerPC/aix-emit-tracebacktable-clobber-register.ll b/llvm/test/CodeGen/PowerPC/aix-emit-tracebacktable-clobber-register.ll --- a/llvm/test/CodeGen/PowerPC/aix-emit-tracebacktable-clobber-register.ll +++ b/llvm/test/CodeGen/PowerPC/aix-emit-tracebacktable-clobber-register.ll @@ -46,7 +46,7 @@ ; COMMON-NEXT: # -IsFloatingPointOperationLogOrAbortEnabled ; COMMON-NEXT: .byte 0x40 # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed ; COMMON-NEXT: # OnConditionDirective = 0, -IsCRSaved, -IsLRSaved -; COMMON-NEXT: .byte 0x85 # +IsBackChainStored, -IsFixup, NumOfFPRsSaved = 5 +; COMMON-NEXT: .byte 0x05 # -IsBackChainStored, -IsFixup, NumOfFPRsSaved = 5 ; COMMON-NEXT: .byte 0x04 # -HasExtensionTable, -HasVectorInfo, NumOfGPRsSaved = 4 ; COMMON-NEXT: .byte 0x00 # NumberOfFixedParms = 0 ; COMMON-NEXT: .byte 0x01 # NumberOfFPParms = 0, +HasParmsOnStack @@ -67,7 +67,7 @@ ; COMMON-NEXT: # -IsFloatingPointOperationLogOrAbortEnabled ; COMMON-NEXT: .byte 0x40 # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed ; COMMON-NEXT: # OnConditionDirective = 0, -IsCRSaved, -IsLRSaved -; COMMON-NEXT: .byte 0x80 # +IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 +; COMMON-NEXT: .byte 0x00 # -IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 ; COMMON-NEXT: .byte 0xc0 # +HasExtensionTable, +HasVectorInfo, NumOfGPRsSaved = 0 ; COMMON-NEXT: .byte 0x00 # NumberOfFixedParms = 0 ; COMMON-NEXT: .byte 0x01 # NumberOfFPParms = 0, +HasParmsOnStack diff --git a/llvm/test/CodeGen/PowerPC/aix-emit-tracebacktable-redzone-boundary.mir b/llvm/test/CodeGen/PowerPC/aix-emit-tracebacktable-redzone-boundary.mir new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/PowerPC/aix-emit-tracebacktable-redzone-boundary.mir @@ -0,0 +1,60 @@ +## Test the behaviour of IsBackChainStored bit of traceback table when +## the frame size is equal to or large than redzone boundary size(288). +# RUN: llc -mtriple powerpc64-ibm-aix-xcoff -o -\ +# RUN: %s | FileCheck %s + +--- +name: test +tracksRegLiveness: true +stack: + - { id: 0, size: 288, alignment: 16 } +body: | + bb.0: + BLR8 implicit $lr8, implicit $rm + +--- +name: overredzone +tracksRegLiveness: true +stack: + - { id: 0, size: 296, alignment: 16 } +body: | + bb.0: + BLR8 implicit $lr8, implicit $rm + + + ; CHECK: .vbyte 4, 0x00000000 # Traceback table begin + ; CHECK-NEXT: .byte 0x00 # Version = 0 + ; CHECK-NEXT: .byte 0x09 # Language = CPlusPlus + ; CHECK-NEXT: .byte 0x20 # -IsGlobaLinkage, -IsOutOfLineEpilogOrPrologue + ; CHECK-NEXT: # +HasTraceBackTableOffset, -IsInternalProcedure + ; CHECK-NEXT: # -HasControlledStorage, -IsTOCless + ; CHECK-NEXT: # -IsFloatingPointPresent + ; CHECK-NEXT: # -IsFloatingPointOperationLogOrAbortEnabled + ; CHECK-NEXT: .byte 0x40 # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed + ; CHECK-NEXT: # OnConditionDirective = 0, -IsCRSaved, -IsLRSaved + ; CHECK-NEXT: .byte 0x00 # -IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 + ; CHECK-NEXT: .byte 0x00 # -HasExtensionTable, -HasVectorInfo, NumOfGPRsSaved = 0 + ; CHECK-NEXT: .byte 0x00 # NumberOfFixedParms = 0 + ; CHECK-NEXT: .byte 0x01 # NumberOfFPParms = 0, +HasParmsOnStack + ; CHECK-NEXT: .vbyte 4, L..test0-.test # Function size + ; CHECK-NEXT: .vbyte 2, 0x0004 # Function name len = 4 + ; CHECK-NEXT: .byte "test" # Function Name + + ; CHECK: .vbyte 4, 0x00000000 # Traceback table begin + ; CHECK-NEXT: .byte 0x00 # Version = 0 + ; CHECK-NEXT: .byte 0x09 # Language = CPlusPlus + ; CHECK-NEXT: .byte 0x20 # -IsGlobaLinkage, -IsOutOfLineEpilogOrPrologue + ; CHECK-NEXT: # +HasTraceBackTableOffset, -IsInternalProcedure + ; CHECK-NEXT: # -HasControlledStorage, -IsTOCless + ; CHECK-NEXT: # -IsFloatingPointPresent + ; CHECK-NEXT: # -IsFloatingPointOperationLogOrAbortEnabled + ; CHECK-NEXT: .byte 0x40 # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed + ; CHECK-NEXT: # OnConditionDirective = 0, -IsCRSaved, -IsLRSaved + ; CHECK-NEXT: .byte 0x80 # +IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 + ; CHECK-NEXT: .byte 0x00 # -HasExtensionTable, -HasVectorInfo, NumOfGPRsSaved = 0 + ; CHECK-NEXT: .byte 0x00 # NumberOfFixedParms = 0 + ; CHECK-NEXT: .byte 0x01 # NumberOfFPParms = 0, +HasParmsOnStack + ; CHECK-NEXT: .vbyte 4, L..overredzone0-.overredzone # Function size + ; CHECK-NEXT: .vbyte 2, 0x000b # Function name len = 11 + ; CHECK-NEXT: .byte "overredzone" # Function Name +... diff --git a/llvm/test/CodeGen/PowerPC/aix-emit-tracebacktable-vectorinfo.ll b/llvm/test/CodeGen/PowerPC/aix-emit-tracebacktable-vectorinfo.ll --- a/llvm/test/CodeGen/PowerPC/aix-emit-tracebacktable-vectorinfo.ll +++ b/llvm/test/CodeGen/PowerPC/aix-emit-tracebacktable-vectorinfo.ll @@ -89,7 +89,7 @@ ; COMMON-NEXT: # -IsFloatingPointOperationLogOrAbortEnabled ; COMMON-NEXT: .byte 0x40 # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed ; COMMON-NEXT: # OnConditionDirective = 0, -IsCRSaved, -IsLRSaved -; COMMON-NEXT: .byte 0x80 # +IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 +; COMMON-NEXT: .byte 0x00 # -IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 ; COMMON-NEXT: .byte 0x40 # -HasExtensionTable, +HasVectorInfo, NumOfGPRsSaved = 0 ; COMMON-NEXT: .byte 0x02 # NumberOfFixedParms = 2 ; COMMON-NEXT: .byte 0x05 # NumberOfFPParms = 2, +HasParmsOnStack @@ -114,7 +114,7 @@ ; COMMON-NEXT: # -IsFloatingPointOperationLogOrAbortEnabled ; COMMON-NEXT: .byte 0x40 # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed ; COMMON-NEXT: # OnConditionDirective = 0, -IsCRSaved, -IsLRSaved -; COMMON-NEXT: .byte 0x80 # +IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 +; COMMON-NEXT: .byte 0x00 # -IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 ; COMMON-NEXT: .byte 0x40 # -HasExtensionTable, +HasVectorInfo, NumOfGPRsSaved = 0 ; COMMON-NEXT: .byte 0x01 # NumberOfFixedParms = 1 ; COMMON-NEXT: .byte 0x01 # NumberOfFPParms = 0, +HasParmsOnStack diff --git a/llvm/test/CodeGen/PowerPC/aix-emit-tracebacktable-vectorinfo_hasvarg.ll b/llvm/test/CodeGen/PowerPC/aix-emit-tracebacktable-vectorinfo_hasvarg.ll --- a/llvm/test/CodeGen/PowerPC/aix-emit-tracebacktable-vectorinfo_hasvarg.ll +++ b/llvm/test/CodeGen/PowerPC/aix-emit-tracebacktable-vectorinfo_hasvarg.ll @@ -22,7 +22,7 @@ ;CHECK-ASM-NEXT: # -IsFloatingPointOperationLogOrAbortEnabled ;CHECK-ASM-NEXT: .byte 0x40 # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed ;CHECK-ASM-NEXT: # OnConditionDirective = 0, -IsCRSaved, -IsLRSaved -;CHECK-ASM-NEXT: .byte 0x80 # +IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 +;CHECK-ASM-NEXT: .byte 0x00 # -IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 ;CHECK-ASM-NEXT: .byte 0x40 # -HasExtensionTable, +HasVectorInfo, NumOfGPRsSaved = 0 ;CHECK-ASM-NEXT: .byte 0x00 # NumberOfFixedParms = 0 ;CHECK-ASM-NEXT: .byte 0x01 # NumberOfFPParms = 0, +HasParmsOnStack diff --git a/llvm/test/CodeGen/PowerPC/aix-emit-tracebacktable.ll b/llvm/test/CodeGen/PowerPC/aix-emit-tracebacktable.ll --- a/llvm/test/CodeGen/PowerPC/aix-emit-tracebacktable.ll +++ b/llvm/test/CodeGen/PowerPC/aix-emit-tracebacktable.ll @@ -145,7 +145,7 @@ ; COMMON-NEXT: # -IsFloatingPointOperationLogOrAbortEnabled ; COMMON-NEXT: .byte 0x40 # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed ; COMMON-NEXT: # OnConditionDirective = 0, -IsCRSaved, -IsLRSaved -; COMMON-NEXT: .byte 0x80 # +IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 +; COMMON-NEXT: .byte 0x00 # -IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 ; COMMON-NEXT: .byte 0x00 # -HasExtensionTable, -HasVectorInfo, NumOfGPRsSaved = 0 ; COMMON-NEXT: .byte 0x05 # NumberOfFixedParms = 5 ; COMMON-NEXT: .byte 0x05 # NumberOfFPParms = 2, +HasParmsOnStack @@ -197,7 +197,7 @@ ; COMMON-NEXT: # -IsFloatingPointOperationLogOrAbortEnabled ; COMMON-NEXT: .byte 0x40 # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed ; COMMON-NEXT: # OnConditionDirective = 0, -IsCRSaved, -IsLRSaved -; COMMON-NEXT: .byte 0x80 # +IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 +; COMMON-NEXT: .byte 0x00 # -IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 ; COMMON-NEXT: .byte 0x00 # -HasExtensionTable, -HasVectorInfo, NumOfGPRsSaved = 0 ; COMMON-NEXT: .byte 0x05 # NumberOfFixedParms = 5 ; COMMON-NEXT: .byte 0x05 # NumberOfFPParms = 2, +HasParmsOnStack @@ -224,7 +224,7 @@ ; COMMON-NEXT: # -IsFloatingPointOperationLogOrAbortEnabled ; COMMON-NEXT: .byte 0x40 # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed ; COMMON-NEXT: # OnConditionDirective = 0, -IsCRSaved, -IsLRSaved -; COMMON-NEXT: .byte 0x80 # +IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 +; COMMON-NEXT: .byte 0x00 # -IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 ; COMMON-NEXT: .byte 0x00 # -HasExtensionTable, -HasVectorInfo, NumOfGPRsSaved = 0 ; COMMON-NEXT: .byte 0x07 # NumberOfFixedParms = 7 ; COMMON-NEXT: .byte 0x1b # NumberOfFPParms = 13, +HasParmsOnStack diff --git a/llvm/test/DebugInfo/XCOFF/empty.ll b/llvm/test/DebugInfo/XCOFF/empty.ll --- a/llvm/test/DebugInfo/XCOFF/empty.ll +++ b/llvm/test/DebugInfo/XCOFF/empty.ll @@ -67,7 +67,7 @@ ; ASM32-NEXT: # -IsFloatingPointOperationLogOrAbortEnabled ; ASM32-NEXT: .byte 0x40 # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed ; ASM32-NEXT: # OnConditionDirective = 0, -IsCRSaved, -IsLRSaved -; ASM32-NEXT: .byte 0x80 # +IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 +; ASM32-NEXT: .byte 0x00 # -IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 ; ASM32-NEXT: .byte 0x00 # -HasExtensionTable, -HasVectorInfo, NumOfGPRsSaved = 0 ; ASM32-NEXT: .byte 0x00 # NumberOfFixedParms = 0 ; ASM32-NEXT: .byte 0x01 # NumberOfFPParms = 0, +HasParmsOnStack @@ -268,7 +268,7 @@ ; ASM64-NEXT: # -IsFloatingPointOperationLogOrAbortEnabled ; ASM64-NEXT: .byte 0x40 # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed ; ASM64-NEXT: # OnConditionDirective = 0, -IsCRSaved, -IsLRSaved -; ASM64-NEXT: .byte 0x80 # +IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 +; ASM64-NEXT: .byte 0x00 # -IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 ; ASM64-NEXT: .byte 0x00 # -HasExtensionTable, -HasVectorInfo, NumOfGPRsSaved = 0 ; ASM64-NEXT: .byte 0x00 # NumberOfFixedParms = 0 ; ASM64-NEXT: .byte 0x01 # NumberOfFPParms = 0, +HasParmsOnStack diff --git a/llvm/test/DebugInfo/XCOFF/explicit-section.ll b/llvm/test/DebugInfo/XCOFF/explicit-section.ll --- a/llvm/test/DebugInfo/XCOFF/explicit-section.ll +++ b/llvm/test/DebugInfo/XCOFF/explicit-section.ll @@ -71,7 +71,7 @@ ; CHECK-NEXT: # -IsFloatingPointOperationLogOrAbortEnabled ; CHECK-NEXT: .byte 0x40 # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed ; CHECK-NEXT: # OnConditionDirective = 0, -IsCRSaved, -IsLRSaved -; CHECK-NEXT: .byte 0x80 # +IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 +; CHECK-NEXT: .byte 0x00 # -IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 ; CHECK-NEXT: .byte 0x00 # -HasExtensionTable, -HasVectorInfo, NumOfGPRsSaved = 0 ; CHECK-NEXT: .byte 0x00 # NumberOfFixedParms = 0 ; CHECK-NEXT: .byte 0x01 # NumberOfFPParms = 0, +HasParmsOnStack diff --git a/llvm/test/DebugInfo/XCOFF/function-sections.ll b/llvm/test/DebugInfo/XCOFF/function-sections.ll --- a/llvm/test/DebugInfo/XCOFF/function-sections.ll +++ b/llvm/test/DebugInfo/XCOFF/function-sections.ll @@ -66,7 +66,7 @@ ; CHECK-NEXT: # -IsFloatingPointOperationLogOrAbortEnabled ; CHECK-NEXT: .byte 0x40 # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed ; CHECK-NEXT: # OnConditionDirective = 0, -IsCRSaved, -IsLRSaved -; CHECK-NEXT: .byte 0x80 # +IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 +; CHECK-NEXT: .byte 0x00 # -IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 ; CHECK-NEXT: .byte 0x00 # -HasExtensionTable, -HasVectorInfo, NumOfGPRsSaved = 0 ; CHECK-NEXT: .byte 0x00 # NumberOfFixedParms = 0 ; CHECK-NEXT: .byte 0x01 # NumberOfFPParms = 0, +HasParmsOnStack @@ -102,7 +102,7 @@ ; CHECK-NEXT: # -IsFloatingPointOperationLogOrAbortEnabled ; CHECK-NEXT: .byte 0x40 # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed ; CHECK-NEXT: # OnConditionDirective = 0, -IsCRSaved, -IsLRSaved -; CHECK-NEXT: .byte 0x80 # +IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 +; CHECK-NEXT: .byte 0x00 # -IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0 ; CHECK-NEXT: .byte 0x00 # -HasExtensionTable, -HasVectorInfo, NumOfGPRsSaved = 0 ; CHECK-NEXT: .byte 0x00 # NumberOfFixedParms = 0 ; CHECK-NEXT: .byte 0x01 # NumberOfFPParms = 0, +HasParmsOnStack