Oh... :( Are there any plans to change this? It's needed for a correct implementation of C, after all. On Mon, Mar 1, 2010 at 3:14 PM, Duncan Sands <baldrick at free.fr> wrote:> Hi Russell, > >> Suppose you have something like 'struct foo { char data[10000000]; }', >> and you want to pass such objects as function parameters, and return >> them as function results, by value, does this currently work correctly >> on all supported target platforms? > > as far as I know this only works on x86, and only with LLVM from svn. > > Ciao, > > Duncan. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Hi Russel,> Are there any plans to change this? It's needed for a correct > implementation of C, after all.I guess it will happen when someone needs it enough. My understanding is that it wouldn't be hard to implement for most processors. By the way, you are wrong to say that it is needed for a correct implementation in C. Here's an analogy: consider the x86 instruction set. It does not have an instruction for returning arbitrarily large arrays. In fact it doesn't have any instructions for manipulating arrays or structs at all. Even worse, it doesn't even have a notion of function! So clearly C programs cannot run on x86 processors! Yet still they do, how can this be? The same answer applies to LLVM. Ciao, Duncan.
Well yes, LLVM is Turing complete :-) but I take your point, one could in a pinch hack the same functionality in the front-end. Would that likely be easier or harder than doing it properly in the code generator? Other things equal, of course the latter would be preferable. How do LLVM-GCC and Clang handle it? On Mon, Mar 1, 2010 at 3:36 PM, Duncan Sands <baldrick at free.fr> wrote:> Hi Russel, > >> Are there any plans to change this? It's needed for a correct >> implementation of C, after all. > > I guess it will happen when someone needs it enough. My understanding is > that > it wouldn't be hard to implement for most processors. By the way, you are > wrong > to say that it is needed for a correct implementation in C. Here's an > analogy: > consider the x86 instruction set. It does not have an instruction for > returning > arbitrarily large arrays. In fact it doesn't have any instructions for > manipulating arrays or structs at all. Even worse, it doesn't even have a > notion of function! So clearly C programs cannot run on x86 processors! > Yet > still they do, how can this be? The same answer applies to LLVM. > > Ciao, > > Duncan. >
On Mar 1, 2010, at 7:18 AMPST, Russell Wallace wrote:> Oh... :( > > Are there any plans to change this? It's needed for a correct > implementation of C, after all.No, C only requires support for objects up to 65535 bytes in size. C99 5.2.4.1.> On Mon, Mar 1, 2010 at 3:14 PM, Duncan Sands <baldrick at free.fr> wrote: >> Hi Russell, >> >>> Suppose you have something like 'struct foo { char data[10000000]; }', >>> and you want to pass such objects as function parameters, and return >>> them as function results, by value, does this currently work correctly >>> on all supported target platforms? >> >> as far as I know this only works on x86, and only with LLVM from svn. >> >> Ciao, >> >> Duncan. >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
On Mon, Mar 1, 2010 at 6:00 PM, Dale Johannesen <dalej at apple.com> wrote:> No, C only requires support for objects up to 65535 bytes in size. C99 5.2.4.1.65535 bytes would be reasonably sufficient; what's the largest supported by the LLVM code generator?