tutorial

Hello

I recently discovered llvm and have been working my way through the
tutorial on implementing a little language. (Using llvm built from svn
on 64 bit x86 architecture).

I had two questions that would help me get kickstarted over the holidays.

Is there any easy way to get the jit to dump the assembly equivalent
of the generated machine code? In the documentation so far I've not
seen it - though I've built it udis86 support turned on.

Is there a small but runnable example of generating vector code that
is then jitted to packed SSE code?

TIA!
/B

I recently discovered llvm and have been working my way through the
tutorial on implementing a little language. (Using llvm built from svn
on 64 bit x86 architecture).

cool!

I had two questions that would help me get kickstarted over the holidays.

Is there any easy way to get the jit to dump the assembly equivalent
of the generated machine code? In the documentation so far I've not
seen it - though I've built it udis86 support turned on.

There isn't a really trivial way. You can enable the debugging dumps by passing "-print-machineinstrs" into the llvm command line argument processing stuff. For example, add this to your code somewhere:

   const char *Args = { "a.out", "-print-machineinstrs", 0 }
   cl::ParseCommandLineOptions(2, Args);

Another useful option is to pass "-debug-only=jit" in, in a similar way.

More info than you probably want on this is here:
http://llvm.org/docs/CommandLine.html

The other option is to dump out the .ll file (e.g. with M.dump()) and pipe that into the "llc" command like this:

$ cat foo.ll | llvm-as | llc

which will print out machine code that is very very similar to what the jit will execute.

Is there a small but runnable example of generating vector code that
is then jitted to packed SSE code?

Nope, but there is nothing to it. Just produce code that uses the "<4 x

" datatype for example. Also, make sure to mark your load/store

instructions with 16-byte alignment for good performance.

-Chris