When I compile this program<br><br><b>$ cat vararg1-main.c<br><br>typedef struct {<br>
double d;<br>
} S0;<br><br>
S0 g1;<br><br>
void foo0(int a, ...);<br><br>
int main(int argc, char **argv) {<br>
S0 s0 = { 2.0 };<br><br>
foo0(1, s0);<br><br>
printf("%f\n", g1.d);<br><br></b>
<b>
return 0;<br>
}</b><br>
<br>
with this command,<br><br><b>$ clang -target arm-none-linux-gnueabi-gcc -ccc-clang-archs armv7 -emit-llvm vararg1-main.c -S -o vararg1-main.ll -O3</b><br><br>I get this bitcode.<br><br><b>$ cat vararg1-main.ll<br><br>
define arm_aapcscc i32 @main(i32 %argc, i8** nocapture %argv) nounwind {<br>entry:<br> %0 = load [2 x i32]* bitcast (%struct.S0* @main.s0 to [2 x i32]*), align 8<br> tail call arm_aapcscc void (i32, ...)* @foo0(i32 1, [2 x i32] %0) nounwind<br>
%1 = load double* getelementptr inbounds (%struct.S0* @g1, i32 0, i32 0), align 8, !tbaa !0<br> %call = tail call arm_aapcscc i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), double %1) nounwind<br>
ret i32 0<br>}</b><br><br>My understanding is that ARM eabi requires that structure S0 be 8-byte aligned when it is passed to function foo0, i.e. it should be passed in register r2 and r3.<br>
<br>Is there anything in the call to foo0 that informs the backend that %0 should be 8-byte aligned?<br><br><b> tail call arm_aapcscc void (i32, ...)* @foo0(i32 1, [2 x i32] %0)
nounwind<br></b>
<br>