add target hooks for emitting random gunk before and after the function body.
authorChris Lattner <sabre@nondot.org>
Thu, 28 Jan 2010 01:58:58 +0000 (01:58 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 28 Jan 2010 01:58:58 +0000 (01:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94732 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/AsmPrinter.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp

index 487c5422c3b95deb214d14e2ea0c65eaf5be1550..ba7d1385ff966db0a403d7a03f2d8eb6d00b556c 100644 (file)
@@ -233,6 +233,14 @@ namespace llvm {
       assert(0 && "EmitInstruction not implemented");
     }
     
+    /// EmitFunctionBodyStart - Targets can override this to emit stuff before
+    /// the first basic block in the function.
+    virtual void EmitFunctionBodyStart() {}
+
+    /// EmitFunctionBodyEnd - Targets can override this to emit stuff after
+    /// the last basic block in the function.
+    virtual void EmitFunctionBodyEnd() {}
+    
     /// EmitConstantPool - Print to the current output stream assembly
     /// representations of the constants in the constant pool MCP. This is
     /// used to print out constants which have been "spilled to memory" by
index e97e9bd251b7d7081d09296d0d248f3b276f43d2..36aa748426e589fe5a9da3657e80a3e01a140946 100644 (file)
@@ -344,6 +344,9 @@ void AsmPrinter::EmitFunctionEntryLabel() {
 /// EmitFunctionBody - This method emits the body and trailer for a
 /// function.
 void AsmPrinter::EmitFunctionBody() {
+  // Emit target-specific gunk before the function body.
+  EmitFunctionBodyStart();
+  
   // Print out code for the function.
   bool HasAnyRealCode = false;
   for (MachineFunction::const_iterator I = MF->begin(), E = MF->end();
@@ -378,6 +381,9 @@ void AsmPrinter::EmitFunctionBody() {
   if (MAI->hasSubsectionsViaSymbols() && !HasAnyRealCode)
     OutStreamer.EmitIntValue(0, 1, 0/*addrspace*/);
   
+  // Emit target-specific gunk after the function body.
+  EmitFunctionBodyEnd();
+  
   if (MAI->hasDotTypeDotSizeDirective())
     O << "\t.size\t" << *CurrentFnSym << ", .-" << *CurrentFnSym << '\n';