[LLVMdev] I'm new to LLVM

Nick Lewycky nicholas at mxc.ca
Fri May 16 21:54:58 PDT 2008


inhahe wrote:
> hi, i'm new to llvm.  i'm kind of confused as to what llvm is.  i think 
> it said somewhere on the site that it's not a language, it's just used 
> for creating languages.  but the people at c-- point me here.  so i just 
> want to code in assembler with perhaps some higher-level constructs.  
> will llvm let me do this?

LLVM is many things. If by "code in assembler" you mean x86 machine 
code, no, LLVM is not that.

LLVM has its own assembly language which doubles as a compiler's 
intermediate representation. That is, if you wanted to write your own 
compiler for a language of your invention, you would write your parser 
to create LLVM objects in-memory and let LLVM handle the rest.

LLVM provides many optimizations, two file formats (binary and textual), 
and a number of targets which can be used for both static code 
generation or as JITs.

The textual file format, referred to as "llvm assembly" is a serialized 
version of the in-memory format, called the "IR" (intermediate 
representation). There's a perfect 1:1 mapping between the two (and 
similarly with the binary bytecode files, but nobody reads those 
directly). That's why we often describe the in-memory IR in terms of the 
textual assembly.

> also, does llvm support simd up to sse4?

Yes.

> and does it have a framework for making windows dll's?   (python 
> extensions ftw)

Not on its own. Like GCC, it will create .s files, which your system 
assembler and linker can create a .dll out of. (GCC looks like it does 
this, but in practise the 'gcc' command is merely a driver that will run 
the assembler and linker as needed.)

> can it do coroutines or microthreads?

I'm not sure what those are, but I don't think LLVM supports them 
directly. That is to say, you can probably implement them in the same 
sense that you could write a language that does microthreading using 
LLVM, but LLVM doesn't have any microthreading operations built in.

You can read the LLVM IR at http://llvm.org/docs/LangRef.html which 
details what constructs LLVM can represent.

> thx for the help

I hope that helps!

Nick Lewycky




More information about the llvm-dev mailing list