[LLVMdev] RFC: llvm-convert.cpp Patch

Bill Wendling isanbard at gmail.com
Wed Nov 7 10:48:01 PST 2007


On 11/7/07, Duncan Sands <baldrick at free.fr> wrote:
> Hi,
>
> the fundamental problem is that the DestLoc argument to Emit doesn't
> come with alignment (or volatility for that matter).  When emitting
> an aggregate into DestLoc only the alignment of the source is used,
> not that of DestLoc.  But that's wrong if DestLoc is less aligned
> than the source (either because the source is highly aligned, eg
> because the user marked it as being highly aligned, or because the
> destination is little aligned as in the testcase).

Exactly! :-)

> So why not pass the alignment and volatility in too?

I'm for that.

>  Probably Chris doesn't want
> to add extra arguments to Emit, so instead we could define a
> "DestLoc descriptor" struct:
>         struct DLD {
>                 Value *Ptr;
>                 unsigned Alignment;
>                 bool Volatile;
>         }
> declare one on the stack and pass its address, something like this:
>         DLD D = { Ptr, Align, isVolatile };
>         Emit(exp, &D);
>
Emit already takes a parameter that not all of the method calls in
there use. So it should be possible to add another parameter. I
submitted another patch for review that does that -- at least for the
alignment. :-)

-bw



More information about the llvm-dev mailing list