[lld] r292042 - Simplify string output. NFC.
Sean Silva via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 16 13:14:11 PST 2017
One note is that generally printf-like formatting ends up being much slower
than custom formatting that doesn't have to go through a varargs call etc.
Not sure if it is slower/faster in this case though.
The reason I mention this is that there are users at PlayStation that have
this feature on *for all links* and it actually consumes a pretty
significant amount of time IIRC (something like 25% of the link maybe?).
Not sure if this is worth worrying about, but just an FYI for a surprising
fact!
-- Sean Silva
On Sat, Jan 14, 2017 at 5:11 PM, Rui Ueyama via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: ruiu
> Date: Sat Jan 14 19:11:47 2017
> New Revision: 292042
>
> URL: http://llvm.org/viewvc/llvm-project?rev=292042&view=rev
> Log:
> Simplify string output. NFC.
>
> Modified:
> lld/trunk/COFF/MapFile.cpp
> lld/trunk/ELF/MapFile.cpp
>
> Modified: lld/trunk/COFF/MapFile.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/
> MapFile.cpp?rev=292042&r1=292041&r2=292042&view=diff
> ============================================================
> ==================
> --- lld/trunk/COFF/MapFile.cpp (original)
> +++ lld/trunk/COFF/MapFile.cpp Sat Jan 14 19:11:47 2017
> @@ -36,9 +36,7 @@ using namespace lld::coff;
>
> static void writeOutSecLine(raw_fd_ostream &OS, uint64_t Address,
> uint64_t Size,
> uint64_t Align, StringRef Name) {
> - OS << format_hex_no_prefix(Address, 8) << ' '
> - << format_hex_no_prefix(Size, 8) << ' ' << format("%5x ", Align)
> - << left_justify(Name, 7);
> + OS << format("%08x %08x %5x ", Address, Size, Align) <<
> left_justify(Name, 7);
> }
>
> static void writeInSecLine(raw_fd_ostream &OS, uint64_t Address, uint64_t
> Size,
> @@ -89,9 +87,7 @@ static void writeSectionChunk(raw_fd_ost
>
> static void writeMapFile2(raw_fd_ostream &OS,
> ArrayRef<OutputSection *> OutputSections) {
> - OS << left_justify("Address", 8) << ' ' << left_justify("Size", 8)
> - << ' ' << left_justify("Align", 5) << ' ' << left_justify("Out", 7)
> << ' '
> - << left_justify("In", 7) << ' ' << left_justify("File", 7) << "
> Symbol\n";
> + OS << "Address Size Align Out In File Symbol\n";
>
> for (OutputSection *Sec : OutputSections) {
> uint32_t VA = Sec->getRVA();
>
> Modified: lld/trunk/ELF/MapFile.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/MapFile.
> cpp?rev=292042&r1=292041&r2=292042&view=diff
> ============================================================
> ==================
> --- lld/trunk/ELF/MapFile.cpp (original)
> +++ lld/trunk/ELF/MapFile.cpp Sat Jan 14 19:11:47 2017
> @@ -35,8 +35,7 @@ using namespace lld::elf;
>
> static void writeOutSecLine(raw_fd_ostream &OS, int Width, uint64_t
> Address,
> uint64_t Size, uint64_t Align, StringRef
> Name) {
> - OS << format_hex_no_prefix(Address, Width) << ' '
> - << format_hex_no_prefix(Size, Width) << ' ' << format("%5x ", Align)
> + OS << format("%0*x %0*x %5x ", Width, Address, Width, Size, Align)
> << left_justify(Name, 7);
> }
>
> @@ -100,8 +99,7 @@ static void writeMapFile2(raw_fd_ostream
> int Width = ELFT::Is64Bits ? 16 : 8;
>
> OS << left_justify("Address", Width) << ' ' << left_justify("Size",
> Width)
> - << ' ' << left_justify("Align", 5) << ' ' << left_justify("Out", 7)
> << ' '
> - << left_justify("In", 7) << ' ' << left_justify("File", 7) << "
> Symbol\n";
> + << " Align Out In File Symbol\n";
>
> for (OutputSectionBase *Sec : OutputSections) {
> writeOutSecLine(OS, Width, Sec->Addr, Sec->Size, Sec->Addralign,
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170116/35a6ac01/attachment.html>
More information about the llvm-commits
mailing list