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

Roman Divacky rdivacky at freebsd.org
Tue Aug 28 12:06:55 PDT 2012


Author: rdivacky
Date: Tue Aug 28 14:06:55 2012
New Revision: 162778

URL: http://llvm.org/viewvc/llvm-project?rev=162778&view=rev
Log:
Emit word of zeroes after the last instruction as a start of the mandatory
traceback table on PowerPC64. This helps gdb handle exceptions. The other
mandatory fields are ignored by gdb and harder to implement so just add
there a FIXME.

Patch by Bill Schmidt. PR13641.

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

Modified: llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp?rev=162778&r1=162777&r2=162778&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp Tue Aug 28 14:06:55 2012
@@ -109,6 +109,8 @@
     bool doFinalization(Module &M);
 
     virtual void EmitFunctionEntryLabel();
+
+    void EmitFunctionBodyEnd();
   };
 
   /// PPCDarwinAsmPrinter - PowerPC assembly printer, customized for Darwin/Mac
@@ -450,6 +452,19 @@
   return AsmPrinter::doFinalization(M);
 }
 
+/// EmitFunctionBodyEnd - Print the traceback table before the .size
+/// directive.
+///
+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())
+    OutStreamer.EmitIntValue(0, 4/*size*/);
+}
+
 void PPCDarwinAsmPrinter::EmitStartOfAsmFile(Module &M) {
   static const char *const CPUDirectives[] = {
     "",

Added: llvm/trunk/test/CodeGen/PowerPC/pr13641.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/pr13641.ll?rev=162778&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/pr13641.ll (added)
+++ llvm/trunk/test/CodeGen/PowerPC/pr13641.ll Tue Aug 28 14:06:55 2012
@@ -0,0 +1,10 @@
+; RUN: llc < %s | FileCheck %s
+target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v128:128:128-n32:64"
+target triple = "powerpc64-unknown-linux-gnu"
+
+define void @foo() nounwind {
+  ret void
+}
+
+; CHECK: blr
+; CHECK-NEXT: .long 0





More information about the llvm-commits mailing list