Baptiste Lepilleur
2009-Dec-09 19:54 UTC
[LLVMdev] Problem with code generated for call using stdcall convention
2009/12/9 Anton Korobeynikov <anton at korobeynikov.info>> Hello > > Is my initial LLVM-IR correct for invoking WIN32 API function? > No. You forgot to put calling convention on the call itself. >Thanks, this work great! 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.> -- > With best regards, Anton Korobeynikov > Faculty of Mathematics and Mechanics, Saint Petersburg State University >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091209/b5d225e3/attachment.html>
Anton Korobeynikov
2009-Dec-09 20:11 UTC
[LLVMdev] Problem with code generated for call using stdcall convention
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. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
Reid Kleckner
2009-Dec-09 20:29 UTC
[LLVMdev] Problem with code generated for call using stdcall convention
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
Hans Wennborg
2009-Dec-10 08:18 UTC
[LLVMdev] Problem with code generated for call using stdcall convention
I too have stumbled over this. Wouldn't it be a good idea to add a check for this to the function verifier pass? Hans Anton Korobeynikov 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. >
Reasonably Related Threads
- [LLVMdev] Problem with code generated for call using stdcall convention
- [LLVMdev] Problem with code generated for call using stdcall convention
- [LLVMdev] Problem with code generated for call using stdcall convention
- [LLVMdev] Problem with code generated for call using stdcall convention
- [LLVMdev] Problem with code generated for call using stdcall convention