[LLVMdev] Test compiler help

Renato Golin rengolin at systemcall.org
Sun Aug 16 12:39:18 PDT 2009


Hi all,

I'm writing a test compiler to understand the overall structure of
LLVM and I managed to produce IR for expressions, functions and
function calls.

I'm following the Kaleidoscope example and had a hard time de-tangling
the language specifics from LLVM syntax. Anyhow, I got here and I'd
like some more specific help to finish my example.

My very simple language has global variables and static functions
only, so I can focus on the code generation. My problems are below.

1. Kaleidoscope uses function calls, which I believe prepare the
stack, saves the link register and so on, which I'm not interested at
all, as everything is static. What's the correct way to create a
simple jump instead of a call?

2. Each static function is called a "state". At the end, it MUST jump
to the next state, even if it's itself. If it doesn't, the program
must end. I also want create an end of the program whenever the token
"end" is parsed. How can I do it?

3. When the program is running, I'd like to print some values. As
Kaleidoscope "returns" the value to the JIT, it's easy to give the
answer, but in my case it won't happen. Do I need to create a simple
IR routine to print doubles or is there something easy to use for that
purpose?

Thanks!
--renato

PS: Where's the best place to find such information?



More information about the llvm-dev mailing list