[llvm-commits] [llvm] r100296 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
Chris Lattner
sabre at nondot.org
Sat Apr 3 15:28:33 PDT 2010
Author: lattner
Date: Sat Apr 3 17:28:33 2010
New Revision: 100296
URL: http://llvm.org/viewvc/llvm-project?rev=100296&view=rev
Log:
asmstreamerize the .size directive for function bodies, force clients
of printOffset to pass in a stream to print to.
Modified:
llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp
llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp
llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=100296&r1=100295&r2=100296&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
+++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Sat Apr 3 17:28:33 2010
@@ -269,11 +269,6 @@
///
void EmitInt32(int Value) const;
- /// EmitInt64 - Emit a long long directive and value.
- ///
- void EmitInt64(uint64_t Value) const;
-
-
/// 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.
@@ -349,7 +344,7 @@
virtual void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV);
/// printOffset - This is just convenient handler for printing offsets.
- void printOffset(int64_t Offset) const;
+ void printOffset(int64_t Offset, raw_ostream &OS) const;
/// isBlockOnlyReachableByFallthough - Return true if the basic block has
/// exactly one predecessor and the control transfer mechanism between
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=100296&r1=100295&r2=100296&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Sat Apr 3 17:28:33 2010
@@ -461,7 +461,16 @@
// 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 @@
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 @@
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
Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=100296&r1=100295&r2=100296&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Sat Apr 3 17:28:33 2010
@@ -319,7 +319,7 @@
O << ":upper16:";
O << *Mang->getSymbol(GV);
- printOffset(MO.getOffset());
+ printOffset(MO.getOffset(), O);
if (isCallOp && Subtarget->isTargetELF() &&
TM.getRelocationModel() == Reloc::PIC_)
Modified: llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp?rev=100296&r1=100295&r2=100296&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp Sat Apr 3 17:28:33 2010
@@ -86,7 +86,7 @@
return;
case MachineOperand::MO_GlobalAddress:
O << *Mang->getSymbol(MO.getGlobal());
- printOffset(MO.getOffset());
+ printOffset(MO.getOffset(), O);
break;
case MachineOperand::MO_ExternalSymbol:
O << *GetExternalSymbolSymbol(MO.getSymbolName());
Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=100296&r1=100295&r2=100296&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Sat Apr 3 17:28:33 2010
@@ -446,7 +446,7 @@
O << *SymToPrint;
- printOffset(MO.getOffset());
+ printOffset(MO.getOffset(), O);
return;
}
Modified: llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp?rev=100296&r1=100295&r2=100296&view=diff
==============================================================================
--- llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp Sat Apr 3 17:28:33 2010
@@ -101,7 +101,7 @@
!GV->hasLocalLinkage())
O << "@PLT";
- printOffset(MO.getOffset());
+ printOffset(MO.getOffset(), O);
return;
}
case MachineOperand::MO_ExternalSymbol: {
@@ -155,7 +155,7 @@
O << MAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << '_'
<< MO.getIndex();
- printOffset(MO.getOffset());
+ printOffset(MO.getOffset(), O);
break;
case MachineOperand::MO_GlobalAddress:
O << *Mang->getSymbol(MO.getGlobal());
@@ -177,7 +177,7 @@
case SystemZII::MO_PLT: O << "@PLT"; break;
}
- printOffset(MO.getOffset());
+ printOffset(MO.getOffset(), O);
}
void SystemZAsmPrinter::printRIAddrOperand(const MachineInstr *MI, int OpNum,
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp?rev=100296&r1=100295&r2=100296&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp Sat Apr 3 17:28:33 2010
@@ -87,7 +87,7 @@
break;
case MachineOperand::MO_ConstantPoolIndex:
O << *GetCPISymbol(MO.getIndex());
- printOffset(MO.getOffset());
+ printOffset(MO.getOffset(), O);
break;
case MachineOperand::MO_GlobalAddress: {
const GlobalValue *GV = MO.getGlobal();
@@ -136,7 +136,7 @@
O << *GVSym;
else
O << '(' << *GVSym << ')';
- printOffset(MO.getOffset());
+ printOffset(MO.getOffset(), O);
break;
}
case MachineOperand::MO_ExternalSymbol: {
More information about the llvm-commits
mailing list