<div dir="ltr">ok i have managed to compile using lli (jit) as follows: but i dont get assembly file?<div><br></div><div>my sum-main.c file is:</div><div><br></div><div><div>#include <stdio.h></div><div>#include<stdlib.h></div><div>int sum(int a, int b) {</div><div>return a + b;</div><div>}</div><div>int main(int argc, char** argv) {</div><div>printf("sum: %d\n", sum(atoi(argv[1]), atoi(argv[2])) + sum(atoi(argv[1]), atoi(argv[2])));</div><div>return 0;</div><div>}</div></div><div><br></div><div>and i used the following steps to compile.</div><div>clang -S -emit-llvm sum-main.c -o sum-main.ll<br></div><div><div>lli sum-main.ll  5 2</div></div><div><br></div><div>it gives 7. i believe that it is compiling at run time.</div><div><br></div><div>now how to obtain assembly file generated at run time. and do a detailed debugging of this code.</div><div><br></div><div>please help.</div><div><br><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 16, 2017 at 10:49 PM, hameeza ahmed <span dir="ltr"><<a href="mailto:hahmed2305@gmail.com" target="_blank">hahmed2305@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello,<div><br></div><div>Can someone point me to some good tutorials for JIT in LLVM.</div><div><br></div><div>My understanding of JIT is it is like llc; it takes optimized bit code (generated via opt) and compiles it at run time instead of static compilation. for example i have a loop which adds 2 user  input numbers. so my cpp file becomes:</div><div><br></div><div>int main()</div><div>{</div><div>num1[1000], num2[1000];</div><div>//take input in these arrays at run time using scanf.</div><div><br></div><div><div>scanf("%d",num1);</div><div>scanf("%d",num2);</div></div><div><br></div><div>for (int i=0;i<1000;i++);</div><div>{</div><div>num1+num2;</div><div>}</div><div><br></div><div>so if i pass this through opt for auto vectorization. i keep vector width=32, i get optimized IR. </div><div>then instead of passing the IR through llc i pass it through jit (lli). now i get run  time compilation. at run time my vectorized IR code <32xi32>emits vector assembly something like avx/ simd instructions.</div><div><br></div><div>Am i right? please guide me.</div><div><br></div><div>Thank You</div><div><br></div><div><br></div></div>
</blockquote></div><br></div></div></div>