[LLVMdev] A question about LLVM assembly

Seung Jae Lee lee225 at uiuc.edu
Thu Jun 21 14:31:19 PDT 2007


Hello, LLVM guys.
I've tried to emit the following simple function to LLVM assmbly.
---------------------------------------------------------
void test(long s, double* a) {
   char h = ttt(s);
  *a = s;
   mmm();
}
---------------------------------------------------------

It's spat out as follows:
---------------------------------------------------------
void %test(int %s, double* %a) {
entry:
        %tmp = cast int %s to uint              ; <uint> [#uses=1]
        %tmp = tail call sbyte %ttt( uint %tmp )         ; <sbyte> [#uses=0]
        %tmp1 = cast int %s to double           ; <double> [#uses=1]
        store double %tmp1, double* %a
        tail call void (...)* %mmm( )
        ret void
}
---------------------------------------------------------
I have two question as to above.

1) Clearly, the type of input 's' is 'long'. But it's emitted as 'int'. What's the reason for this?

2) As you can see in the code, mmm() does nothing in the function. However it was spat as 'tail call'.
I've read 'tail' is marked when "the callee function accesses any allocas or varargs in the caller" in the LLVM assembly language reference manual. But mmm() doesn't seem to use anything in the caller so this is why I can't figure it out.

Would you mind telling me as to these?
(I'm using LLVM 1.9.)

Thanks,
Seung J. Lee



More information about the llvm-dev mailing list