summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-28 01:58:58 +0000
committerChris Lattner <sabre@nondot.org>2010-01-28 01:58:58 +0000
commitc968f4475ecd459bccfb810bc40dc62491b4bd7e (patch)
tree31e23f9e543e6d389a509796e3413360725f0538
parent346af883962b36f495d4e72d623171640fe8447d (diff)
downloadbcm5719-llvm-c968f4475ecd459bccfb810bc40dc62491b4bd7e.tar.gz
bcm5719-llvm-c968f4475ecd459bccfb810bc40dc62491b4bd7e.zip
add target hooks for emitting random gunk before and after the function body.
llvm-svn: 94732
-rw-r--r--llvm/include/llvm/CodeGen/AsmPrinter.h8
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp6
2 files changed, 14 insertions, 0 deletions
diff --git a/llvm/include/llvm/CodeGen/AsmPrinter.h b/llvm/include/llvm/CodeGen/AsmPrinter.h
index 487c5422c3b..ba7d1385ff9 100644
--- a/llvm/include/llvm/CodeGen/AsmPrinter.h
+++ b/llvm/include/llvm/CodeGen/AsmPrinter.h
@@ -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
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index e97e9bd251b..36aa748426e 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -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';
OpenPOWER on IntegriCloud