[llvm] r179601 - Cleanup naming: DataLayout s/TD/DL/

Jim Grosbach grosbach at apple.com
Tue Apr 16 14:44:19 PDT 2013


On Apr 16, 2013, at 2:32 PM, Eli Bendersky <eliben at google.com> wrote:

> On Tue, Apr 16, 2013 at 12:05 PM, Jim Grosbach <grosbach at apple.com> wrote:
> DL and dl often are used for debugloc elsewhere. Thoughts on alternatives?
> 
> Good point. I don't think there should be a lot of places where there's a conflict between the two, and wherever it is, the conflict can be resolved by using longer an more meaningful names. I'm not sure it's the only place in LLVM code where there's such a conflict...
> 
> Eli
> 
>  
> 

Sounds reasonable. Just something that caught my eye. Thanks!

-Jim

> 
> 
>  
> On Apr 16, 2013, at 8:41 AM, Eli Bendersky <eliben at google.com> wrote:
> 
> > Author: eliben
> > Date: Tue Apr 16 10:41:18 2013
> > New Revision: 179601
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=179601&view=rev
> > Log:
> > Cleanup naming: DataLayout s/TD/DL/
> >
> >
> > Modified:
> >    llvm/trunk/include/llvm/IR/DataLayout.h
> >    llvm/trunk/lib/IR/DataLayout.cpp
> >
> > Modified: llvm/trunk/include/llvm/IR/DataLayout.h
> > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DataLayout.h?rev=179601&r1=179600&r2=179601&view=diff
> > ==============================================================================
> > --- llvm/trunk/include/llvm/IR/DataLayout.h (original)
> > +++ llvm/trunk/include/llvm/IR/DataLayout.h Tue Apr 16 10:41:18 2013
> > @@ -171,13 +171,13 @@ public:
> >   /// Initialize target data from properties stored in the module.
> >   explicit DataLayout(const Module *M);
> >
> > -  DataLayout(const DataLayout &TD) :
> > +  DataLayout(const DataLayout &DL) :
> >     ImmutablePass(ID),
> > -    LittleEndian(TD.isLittleEndian()),
> > -    StackNaturalAlign(TD.StackNaturalAlign),
> > -    LegalIntWidths(TD.LegalIntWidths),
> > -    Alignments(TD.Alignments),
> > -    Pointers(TD.Pointers),
> > +    LittleEndian(DL.isLittleEndian()),
> > +    StackNaturalAlign(DL.StackNaturalAlign),
> > +    LegalIntWidths(DL.LegalIntWidths),
> > +    Alignments(DL.Alignments),
> > +    Pointers(DL.Pointers),
> >     LayoutMap(0)
> >   { }
> >
> > @@ -426,7 +426,7 @@ public:
> >
> > private:
> >   friend class DataLayout;   // Only DataLayout can create this class
> > -  StructLayout(StructType *ST, const DataLayout &TD);
> > +  StructLayout(StructType *ST, const DataLayout &DL);
> > };
> >
> >
> >
> > Modified: llvm/trunk/lib/IR/DataLayout.cpp
> > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DataLayout.cpp?rev=179601&r1=179600&r2=179601&view=diff
> > ==============================================================================
> > --- llvm/trunk/lib/IR/DataLayout.cpp (original)
> > +++ llvm/trunk/lib/IR/DataLayout.cpp Tue Apr 16 10:41:18 2013
> > @@ -41,7 +41,7 @@ char DataLayout::ID = 0;
> > // Support for StructLayout
> > //===----------------------------------------------------------------------===//
> >
> > -StructLayout::StructLayout(StructType *ST, const DataLayout &TD) {
> > +StructLayout::StructLayout(StructType *ST, const DataLayout &DL) {
> >   assert(!ST->isOpaque() && "Cannot get layout of opaque structs");
> >   StructAlignment = 0;
> >   StructSize = 0;
> > @@ -50,7 +50,7 @@ StructLayout::StructLayout(StructType *S
> >   // Loop over each of the elements, placing them in memory.
> >   for (unsigned i = 0, e = NumElements; i != e; ++i) {
> >     Type *Ty = ST->getElementType(i);
> > -    unsigned TyAlign = ST->isPacked() ? 1 : TD.getABITypeAlignment(Ty);
> > +    unsigned TyAlign = ST->isPacked() ? 1 : DL.getABITypeAlignment(Ty);
> >
> >     // Add padding if necessary to align the data element properly.
> >     if ((StructSize & (TyAlign-1)) != 0)
> > @@ -60,7 +60,7 @@ StructLayout::StructLayout(StructType *S
> >     StructAlignment = std::max(TyAlign, StructAlignment);
> >
> >     MemberOffsets[i] = StructSize;
> > -    StructSize += TD.getTypeAllocSize(Ty); // Consume space for this data item
> > +    StructSize += DL.getTypeAllocSize(Ty); // Consume space for this data item
> >   }
> >
> >   // Empty structures have alignment of 1 byte.
> >
> >
> > _______________________________________________
> > 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/20130416/97c74371/attachment.html>


More information about the llvm-commits mailing list