[llvm-commits] [llvm] r162854 - in /llvm/trunk: lib/Target/PowerPC/PPCAsmPrinter.cpp test/CodeGen/PowerPC/pr13641.ll

Hal Finkel hfinkel at anl.gov
Wed Aug 29 13:22:24 PDT 2012


Author: hfinkel
Date: Wed Aug 29 15:22:24 2012
New Revision: 162854

URL: http://llvm.org/viewvc/llvm-project?rev=162854&view=rev
Log:
Reserve space for the mandatory traceback fields on PPC64.

We need to reserve space for the mandatory traceback fields,
though leaving them as zero is appropriate for now.

Although the ABI calls for these fields to be filled in fully, no
compiler on Linux currently does this, and GDB does not read these
fields.  GDB uses the first word of zeroes during exception handling to
find the end of the function and the size field, allowing it to compute
the beginning of the function.  DWARF information is used for everything
else.  We need the extra 8 bytes of pad so the size field is found in
the right place.

As a comparison, GCC fills in a few of the fields -- language, number
of saved registers -- but ignores the rest.  IBM's proprietary OSes do
make use of the full traceback table facility.

Patch by Bill Schmidt.

Modified:
    llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
    llvm/trunk/test/CodeGen/PowerPC/pr13641.ll

Modified: llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp?rev=162854&r1=162853&r2=162854&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp Wed Aug 29 15:22:24 2012
@@ -458,11 +458,15 @@
 void PPCLinuxAsmPrinter::EmitFunctionBodyEnd() {
   // Only the 64-bit target requires a traceback table.  For now,
   // we only emit the word of zeroes that GDB requires to find
-  // the end of the function.
-  // FIXME: Eventually we should add the eight-byte mandatory fields
-  // described in the PPC64 ELF ABI.
-  if (Subtarget.isPPC64())
+  // the end of the function, and zeroes for the eight-byte
+  // mandatory fields.
+  // FIXME: We should fill in the eight-byte mandatory fields as described in
+  // the PPC64 ELF ABI (this is a low-priority item because GDB does not
+  // currently make use of these fields).
+  if (Subtarget.isPPC64()) {
     OutStreamer.EmitIntValue(0, 4/*size*/);
+    OutStreamer.EmitIntValue(0, 8/*size*/);
+  }
 }
 
 void PPCDarwinAsmPrinter::EmitStartOfAsmFile(Module &M) {

Modified: llvm/trunk/test/CodeGen/PowerPC/pr13641.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/pr13641.ll?rev=162854&r1=162853&r2=162854&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/pr13641.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/pr13641.ll Wed Aug 29 15:22:24 2012
@@ -8,3 +8,4 @@
 
 ; CHECK: blr
 ; CHECK-NEXT: .long 0
+; CHECK-NEXT: .quad 0





More information about the llvm-commits mailing list