diff options
author | Chris Lattner <sabre@nondot.org> | 2010-04-03 22:28:33 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-04-03 22:28:33 +0000 |
commit | 6d718817f982b804ff516e43a47f38aa78d2a4a9 (patch) | |
tree | 1e27df0eddebd915eb0b8f96e38bedf3c03879ee /lib/CodeGen/AsmPrinter/AsmPrinter.cpp | |
parent | 002afa95b6aa586b01580b73ad65a1f3c6f6dca4 (diff) | |
download | external_llvm-6d718817f982b804ff516e43a47f38aa78d2a4a9.zip external_llvm-6d718817f982b804ff516e43a47f38aa78d2a4a9.tar.gz external_llvm-6d718817f982b804ff516e43a47f38aa78d2a4a9.tar.bz2 |
asmstreamerize the .size directive for function bodies, force clients
of printOffset to pass in a stream to print to.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100296 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/AsmPrinter.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 4f45f65..8412816 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -461,7 +461,16 @@ void AsmPrinter::EmitFunctionBody() { // If the target wants a .size directive for the size of the function, emit // it. if (MAI->hasDotTypeDotSizeDirective()) { - O << "\t.size\t" << *CurrentFnSym << ", .-" << *CurrentFnSym << '\n'; + // Create a symbol for the end of function, so we can get the size as + // difference between the function label and the temp label. + MCSymbol *FnEndLabel = OutContext.CreateTempSymbol(); + OutStreamer.EmitLabel(FnEndLabel); + + const MCExpr *SizeExp = + MCBinaryExpr::CreateSub(MCSymbolRefExpr::Create(FnEndLabel, OutContext), + MCSymbolRefExpr::Create(CurrentFnSym, OutContext), + OutContext); + OutStreamer.EmitELFSize(CurrentFnSym, SizeExp); } // Emit post-function debug information. @@ -922,12 +931,6 @@ void AsmPrinter::EmitInt32(int Value) const { OutStreamer.EmitIntValue(Value, 4, 0/*addrspace*/); } -/// EmitInt64 - Emit a long long directive and value. -/// -void AsmPrinter::EmitInt64(uint64_t Value) const { - OutStreamer.EmitIntValue(Value, 8, 0/*addrspace*/); -} - /// EmitLabelDifference - Emit something like ".long Hi-Lo" where the size /// in bytes of the directive is specified by Size and Hi/Lo specify the /// labels. This implicitly uses .set if it is available. @@ -1822,11 +1825,11 @@ void AsmPrinter::EmitVisibility(MCSymbol *Sym, unsigned Visibility) const { OutStreamer.EmitSymbolAttribute(Sym, Attr); } -void AsmPrinter::printOffset(int64_t Offset) const { +void AsmPrinter::printOffset(int64_t Offset, raw_ostream &OS) const { if (Offset > 0) - O << '+' << Offset; + OS << '+' << Offset; else if (Offset < 0) - O << Offset; + OS << Offset; } /// isBlockOnlyReachableByFallthough - Return true if the basic block has |