add target hooks for emitting random gunk before and after the function body.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94732 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2010-01-28 01:58:58 +00:00
parent 5fef8bc1cb
commit edfe776ac2
2 changed files with 14 additions and 0 deletions

View 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

View 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';