[LLVMdev] Problem with code generated for call using stdcall convention

Reid Kleckner rnk at mit.edu
Wed Dec 9 12:29:48 PST 2009


On Wed, Dec 9, 2009 at 3:11 PM, Anton Korobeynikov
<anton at korobeynikov.info> wrote:
> Hello
>
>> I naively though it would pick up the call convention from the declaration
>> as there was no error like we have when the wrong number of parameters is
>> used.
> This is not an error, you're just invoking undefined behaviour.

When we first encountered problems with our calling conventions, my
first thought was that clearly the calling convention should be part
of the function type.  The response from jyasskin was that types are
immutable, and LLVM wants to be able to modify calling conventions at
will.  I wondered why not then allocate a new type from the context.
Is this possible?  It seems like it would be a better design, although
it doesn't really impact us that much, and I'm not pushing for this
change.

Everyone seems to stumble on forgetting to set the calling convention
on both the call site and the function object.  Moving the convention
into the type would fix this, since most people already just pick the
type off of the appropriate declaration.

Reid



More information about the llvm-dev mailing list