[llvm] r178366 - Use 12 as the magic number for our abbreviation data and our

Chandler Carruth chandlerc at google.com
Fri Mar 29 14:14:47 PDT 2013


On Fri, Mar 29, 2013 at 1:23 PM, Eric Christopher <echristo at gmail.com>wrote:

> Author: echristo
> Date: Fri Mar 29 15:23:06 2013
> New Revision: 178366
>
> URL: http://llvm.org/viewvc/llvm-project?rev=178366&view=rev
> Log:
> Use 12 as the magic number


of inline elements in the small vectors


> for our abbreviation data and our
> die values. A lot of DIEs have 10 attributes in C++ code (example
> clang), none had more than 12. Seems like a good default.


There, fixed that commit log for ya. ;] Seriously, i thought you were
writing "12" into the debug output at first.

Also, should this maybe be a constant with a name somewhere for the day
when we need it to be 16?


>
> Modified:
>     llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp
>     llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h
>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp?rev=178366&r1=178365&r2=178366&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp Fri Mar 29 15:23:06 2013
> @@ -144,7 +144,7 @@ void DIE::print(raw_ostream &O, unsigned
>      O << "Size: " << Size << "\n";
>    }
>
> -  const SmallVector<DIEAbbrevData, 8> &Data = Abbrev.getData();
> +  const SmallVector<DIEAbbrevData, 12> &Data = Abbrev.getData();
>
>    IndentCount += 2;
>    for (unsigned i = 0, N = Data.size(); i < N; ++i) {
> @@ -324,7 +324,7 @@ void DIEEntry::print(raw_ostream &O) {
>  ///
>  unsigned DIEBlock::ComputeSize(AsmPrinter *AP) {
>    if (!Size) {
> -    const SmallVector<DIEAbbrevData, 8> &AbbrevData = Abbrev.getData();
> +    const SmallVector<DIEAbbrevData, 12> &AbbrevData = Abbrev.getData();
>      for (unsigned i = 0, N = Values.size(); i < N; ++i)
>        Size += Values[i]->SizeOf(AP, AbbrevData[i].getForm());
>    }
> @@ -343,7 +343,7 @@ void DIEBlock::EmitValue(AsmPrinter *Asm
>    case dwarf::DW_FORM_block:  Asm->EmitULEB128(Size); break;
>    }
>
> -  const SmallVector<DIEAbbrevData, 8> &AbbrevData = Abbrev.getData();
> +  const SmallVector<DIEAbbrevData, 12> &AbbrevData = Abbrev.getData();
>    for (unsigned i = 0, N = Values.size(); i < N; ++i)
>      Values[i]->EmitValue(Asm, AbbrevData[i].getForm());
>  }
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h?rev=178366&r1=178365&r2=178366&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h Fri Mar 29 15:23:06 2013
> @@ -66,7 +66,7 @@ namespace llvm {
>
>      /// Data - Raw data bytes for abbreviation.
>      ///
> -    SmallVector<DIEAbbrevData, 8> Data;
> +    SmallVector<DIEAbbrevData, 12> Data;
>
>    public:
>      DIEAbbrev(uint16_t T, uint16_t C) : Tag(T), ChildrenFlag(C), Data() {}
> @@ -75,7 +75,7 @@ namespace llvm {
>      uint16_t getTag() const { return Tag; }
>      unsigned getNumber() const { return Number; }
>      uint16_t getChildrenFlag() const { return ChildrenFlag; }
> -    const SmallVector<DIEAbbrevData, 8> &getData() const { return Data; }
> +    const SmallVector<DIEAbbrevData, 12> &getData() const { return Data; }
>      void setTag(uint16_t T) { Tag = T; }
>      void setChildrenFlag(uint16_t CF) { ChildrenFlag = CF; }
>      void setNumber(unsigned N) { Number = N; }
> @@ -133,7 +133,7 @@ namespace llvm {
>
>      /// Attribute values.
>      ///
> -    SmallVector<DIEValue*, 32> Values;
> +    SmallVector<DIEValue*, 12> Values;
>
>      // Private data for print()
>      mutable unsigned IndentCount;
> @@ -150,7 +150,7 @@ namespace llvm {
>      unsigned getOffset() const { return Offset; }
>      unsigned getSize() const { return Size; }
>      const std::vector<DIE *> &getChildren() const { return Children; }
> -    const SmallVector<DIEValue*, 32> &getValues() const { return Values; }
> +    const SmallVector<DIEValue*, 12> &getValues() const { return Values; }
>      DIE *getParent() const { return Parent; }
>      /// Climb up the parent chain to get the compile unit DIE this DIE
> belongs
>      /// to.
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=178366&r1=178365&r2=178366&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Mar 29 15:23:06
> 2013
> @@ -1672,8 +1672,8 @@ DwarfUnits::computeSizeAndOffset(DIE *Di
>    // Start the size with the size of abbreviation code.
>    Offset += MCAsmInfo::getULEB128Size(AbbrevNumber);
>
> -  const SmallVector<DIEValue*, 32> &Values = Die->getValues();
> -  const SmallVector<DIEAbbrevData, 8> &AbbrevData = Abbrev->getData();
> +  const SmallVector<DIEValue*, 12> &Values = Die->getValues();
> +  const SmallVector<DIEAbbrevData, 12> &AbbrevData = Abbrev->getData();
>
>    // Size the DIE attribute values.
>    for (unsigned i = 0, N = Values.size(); i < N; ++i)
> @@ -1767,8 +1767,8 @@ void DwarfDebug::emitDIE(DIE *Die, std::
>                                  dwarf::TagString(Abbrev->getTag()));
>    Asm->EmitULEB128(AbbrevNumber);
>
> -  const SmallVector<DIEValue*, 32> &Values = Die->getValues();
> -  const SmallVector<DIEAbbrevData, 8> &AbbrevData = Abbrev->getData();
> +  const SmallVector<DIEValue*, 12> &Values = Die->getValues();
> +  const SmallVector<DIEAbbrevData, 12> &AbbrevData = Abbrev->getData();
>
>    // Emit the DIE attribute values.
>    for (unsigned i = 0, N = Values.size(); i < N; ++i) {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130329/0c22ffce/attachment.html>


More information about the llvm-commits mailing list