<font color="#000000"><font face="verdana,sans-serif">Hi,<br></font></font><div><font class="Apple-style-span" face="verdana, sans-serif"><br></font></div><div><font class="Apple-style-span" face="verdana, sans-serif">I found that machine dead code elimination, does not respect the calling convention of alpha and eliminates r16, which was set correctly during code generation. I verified it with -print-after-all. </font></div>
<div><font class="Apple-style-span" face="verdana, sans-serif">Does anybody have a patch for this? <br></font></div><div><div class="gmail_quote"><br></div><div class="gmail_quote">On Wed, Jun 29, 2011 at 11:12 AM, Ankit Sethia <span dir="ltr"><<a href="mailto:asethia@eecs.umich.edu">asethia@eecs.umich.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><font color="#000000"><font face="verdana,sans-serif">Hi All,<br clear="all"></font></font><div><font face="verdana, sans-serif"><br>
</font></div><div><font face="verdana, sans-serif">I am using llvm-2.9 to cross compile to alpha. I know that alpha is in experimental stage, but i can not get even the "Hello World" program to run on it.<br>
</font></div><div><br></div><div>Here is what happens, the bitcode file for the hello world program is as follow:</div><div><br></div><div><div>; ModuleID = 'hello.bc'</div><div>target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"</div>
<div>target triple = "x86_64-unknown-linux-gnu"</div><div><br></div><div>@.str = private constant [12 x i8] c"Hello World\00", align 1</div><div><br></div><div>define i32 @main() nounwind {</div><div>
entry:</div>
<div> %retval = alloca i32 </div><div> %0 = alloca i32 </div><div> %"alloca point" = bitcast i32 0 to i32 </div><div> <b><font color="#ff0000">%1 = call i32 @puts(i8* getelementptr inbounds ([12 x i8]*</font><font color="#000099"> @.str,</font><font color="#ff0000"> i64 0, i64 0)) nounwind</font></b></div>
<div> store i32 0, i32* %0, align 4</div><div> %2 = load i32* %0, align 4</div><div> store i32 %2, i32* %retval, align 4</div><div> br label %return</div><div><br></div><div>return: ; preds = %entry</div>
<div> %retval1 = load i32* %retval</div><div> ret i32 %retval1</div><div>}</div><div><br></div><div>declare i32 @puts(i8*)</div></div><div><br></div><div>The .str is present in the argument to the puts function in %1 is present in the bitcode.</div>
<div>But when i use llc to change the bitcode to alpha assembly, i get the following:</div><div><br></div><div><br></div><div><div> ldah $29,0($27) !gpdisp!1</div><div> lda $29,0($29) !gpdisp!1</div><div> $main..ng:</div>
<div> lda $30,-32($30)</div><div> stq $9,24($30)</div><div> stq $11,16($30)</div><div> bis $26,$26,$9</div><div><b><font color="#ff0000"> ldq $27,puts($29) </font></b> !literal</div><div> lda $11,8($30)</div>
<div> jsr $26,($27),0</div></div><div><br></div><div><br></div><div>The puts call is there, but register 16 which i believe is supposed to have the arguments to a function call is not set.</div><div>If i manually add the line to the assembly,</div>
<div><br></div><div> lda $16, $.str($29)</div><div><br></div><div>where $.str is defined in the assembly to be the appropriate string, it works fine, and i get the hello world output. </div><div>It seems that for some reason llc is not setting the argument of the function call.</div>
<div><br></div><div>Are there any tests for alpha assembly that presently work with function call? I would like to confirm that something with alpha is working.</div><div><br></div><div><br></div><br clear="all"><br>-- <br>
<font color="#888888">
Ankit<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Ankit<br>
</div>