From 6ac81f59a7954bd883bb194552eef1d91d04ad17 Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Mon, 10 Dec 2012 18:59:39 +0000 Subject: [PATCH] This patch adds statistics for other non-DWARF fragments emitted by the assembler. This is useful in order to know how the numbers add up, since in particular the Align fragments account for a non-trivial portion of the emitted fragments (especially on -O0 which sets relax-all). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169747 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MCAssembler.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/MC/MCAssembler.cpp b/lib/MC/MCAssembler.cpp index 989d8be0af5..e8aa924b8f0 100644 --- a/lib/MC/MCAssembler.cpp +++ b/lib/MC/MCAssembler.cpp @@ -34,8 +34,16 @@ using namespace llvm; namespace { namespace stats { STATISTIC(EmittedFragments, "Number of emitted assembler fragments - total"); -STATISTIC(EmittedInstFragments, "Number of emitted assembler fragments - instruction"); -STATISTIC(EmittedDataFragments, "Number of emitted assembler fragments - data"); +STATISTIC(EmittedInstFragments, + "Number of emitted assembler fragments - instruction"); +STATISTIC(EmittedDataFragments, + "Number of emitted assembler fragments - data"); +STATISTIC(EmittedAlignFragments, + "Number of emitted assembler fragments - align"); +STATISTIC(EmittedFillFragments, + "Number of emitted assembler fragments - fill"); +STATISTIC(EmittedOrgFragments, + "Number of emitted assembler fragments - org"); STATISTIC(evaluateFixup, "Number of evaluated fixups"); STATISTIC(FragmentLayouts, "Number of fragment layouts"); STATISTIC(ObjectBytes, "Number of emitted object file bytes"); @@ -407,6 +415,7 @@ static void writeFragment(const MCAssembler &Asm, const MCAsmLayout &Layout, uint64_t FragmentSize = Asm.computeFragmentSize(Layout, F); switch (F.getKind()) { case MCFragment::FT_Align: { + ++stats::EmittedAlignFragments; MCAlignFragment &AF = cast(F); uint64_t Count = FragmentSize / AF.getValueSize(); @@ -456,6 +465,7 @@ static void writeFragment(const MCAssembler &Asm, const MCAsmLayout &Layout, break; case MCFragment::FT_Fill: { + ++stats::EmittedFillFragments; MCFillFragment &FF = cast(F); assert(FF.getValueSize() && "Invalid virtual align in concrete fragment!"); @@ -479,6 +489,7 @@ static void writeFragment(const MCAssembler &Asm, const MCAsmLayout &Layout, } case MCFragment::FT_Org: { + ++stats::EmittedOrgFragments; MCOrgFragment &OF = cast(F); for (uint64_t i = 0, e = FragmentSize; i != e; ++i)