Displaying 5 results from an estimated 5 matches for "va_double_sum".
2006 Oct 05
3
[LLVMdev] Extracting all BasicBlocks of a Function into new Function
Hi,
Chris Lattner wrote:
> All the non-vastart calls can be anywhere. va_end in particular codegens
> to a noop on all targets llvm currently supports, fwiw.
>
Things go well, except for the following (pathological?) C program:
int va_double_sum(int count,...){
int i,sum=0;
va_list ap;
va_start(ap,count);
for(i=0;i<count;i++){
sum+=va_arg(ap,int);
}
va_end(ap);
va_start(ap,count);/* same vararg opened twice!!! */
for(i=0;i<count;i++){
sum+=va_arg(ap,int);
}
va_end(ap);
return sum;
}
The problematic i...
2006 Oct 03
0
[LLVMdev] Extracting all BasicBlocks of a Function into new Function
On Tue, 3 Oct 2006, Bram Adams wrote:
>> You'd have to change it to something like:
>> void foo(int X, ...) {
>> P = va_start();
>> bar(X, P);
>> }
>>
>> void bar(int X, valist P) {
>> use(P);
>> }
>
> Can the other va_...-intrinsics be used in bar as were the "P =
> va_start" in bar? The va_start probably is
2006 Oct 03
2
[LLVMdev] Extracting all BasicBlocks of a Function into new Function
Hi,
Op 3-okt-06, om 20:48 heeft Chris Lattner het volgende geschreven:
> You'd have to change it to something like:
>
> void foo(int X, ...) {
> P = va_start();
> bar(X, P);
> }
>
> void bar(int X, valist P) {
> use(P);
> }
Can the other va_...-intrinsics be used in bar as were the "P =
va_start" in bar? The va_start probably is unnecessary
2006 Oct 05
0
[LLVMdev] Extracting all BasicBlocks of a Function into new Function
On Thu, 5 Oct 2006, Bram Adams wrote:
> Apparently, the problem is how to "rewind" the vararg-argument back to
> its first element when the second loop is reached, as it seems that the
> code just continues at position count and beyond, resulting in overflow.
>
> I'm not sure whether this code snippet is valid ANSI C, and if it is,
> one probably shouldn't use
2006 Oct 05
1
[LLVMdev] Extracting all BasicBlocks of a Function into new Function
Hi,
Op 5-okt-06, om 16:05 heeft Ryan Brown het volgende geschreven:
> I don't know if that's valid but what about something like this:
> int va_double_sum(int count,...){
> /*declare va_list for each original va_start*/
> /*llvm.va_start for each va_list*/
> /*call extracted_sum(count,va_list1, va_list2, ...)*/
> }
That should work, I think, ...
Op 5-okt-06, om 20:51 heeft Chris Lattner het volgende geschreven:
> Why not va_copy...