[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y

Andrew Lenharth andrewl at lenharth.org
Fri Dec 8 10:42:53 PST 2006


On 12/8/06, Reid Spencer <rspencer at reidspencer.com> wrote:
> Andrew,
>
> It looks like you haven't accounted for global constants of packed
> structure type here.

They are.  structure initializers are structure initializers, whether
they are initializing a packed struct or a normal struct. e.g.:
%E1 = global <{ sbyte, int, int }> {
   sbyte 1,  int 2,  int 3 }             ; <<{ sbyte, int, int }>*> [#uses=0]
%E2 = global { sbyte, int, int } {
   sbyte 4,  int 5,  int 6 }             ; <{ sbyte, int, int }*> [#uses=0]

Since the type is embedded before the constant, I don't think it makes
sense to have two types of initializer.

Or were you taking about something else?

Andrew

> Reid.
>
> On Fri, 2006-12-08 at 12:07 -0600, Andrew Lenharth wrote:
> >
> > Changes in directory llvm/lib/AsmParser:
> >
> > llvmAsmParser.y updated: 1.288 -> 1.289
> > ---
> > Log message:
> >
> > Packed Structures
> >
> > ---
> > Diffs of the changes:  (+14 -0)
> >
> >  llvmAsmParser.y |   14 ++++++++++++++
> >  1 files changed, 14 insertions(+)
> >
> >
> > Index: llvm/lib/AsmParser/llvmAsmParser.y
> > diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.288 llvm/lib/AsmParser/llvmAsmParser.y:1.289
> > --- llvm/lib/AsmParser/llvmAsmParser.y:1.288  Wed Dec  6 19:30:31 2006
> > +++ llvm/lib/AsmParser/llvmAsmParser.y        Fri Dec  8 12:06:15 2006
> > @@ -1209,6 +1209,20 @@
> >      $$ = new PATypeHolder(StructType::get(std::vector<const Type*>()));
> >      CHECK_FOR_ERROR
> >    }
> > +  | '<' '{' TypeListI '}' '>' {
> > +    std::vector<const Type*> Elements;
> > +    for (std::list<llvm::PATypeHolder>::iterator I = $3->begin(),
> > +           E = $3->end(); I != E; ++I)
> > +      Elements.push_back(*I);
> > +
> > +    $$ = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
> > +    delete $3;
> > +    CHECK_FOR_ERROR
> > +  }
> > +  | '<' '{' '}' '>' {                         // Empty structure type?
> > +    $$ = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
> > +    CHECK_FOR_ERROR
> > +  }
> >    | UpRTypes '*' {                             // Pointer type?
> >      if (*$1 == Type::LabelTy)
> >        GEN_ERROR("Cannot form a pointer to a basic block");
> >
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>



More information about the llvm-commits mailing list