Several basic questions about Builder

I have been toying around with the LLVM tutorial code and I am trying to deduce what I can from it as a basis for a compiler frontend for a simple language of my own devising (once I understand what I am doing I will probably attempt mapping a more complex language target). I am having some difficulties however understanding how certain things work and I was hoping perhaps someone could help me out-

1) Using the Builder interface how does one create the equivalent of stack frames and access variables in the current stack frame or perhaps in the static enclosing scope (assuming functions can be nested)?

2) Is it possible to deallocate functions from a module and recycle the memory used without restarting the JIT? I am trying to build a server type application where objects/classes maybe be deallocated and thus the associated functions will no longer be used.

3) How does one sequence instructions using Builder similar to a semi-colon in a language like C?

Thanks in advance,

Carter.

1) Using the Builder interface how does one create the equivalent of stack frames and access variables in the current stack frame or perhaps in the static enclosing scope (assuming functions can be nested)?

To create stack variables, you can use the alloca instruction; see
http://llvm.org/docs/tutorial/LangImpl7.html#memory .

LLVM doesn't directly support nested functions; you'll have to lower
them yourself. For example, try something like the following in the
LLVM demo page (http://llvm.org/demo/index.cgi) with optimization off:
int main(int argc, char **argv) {
  void a(int x) { if (x == 10) return; a(x+1); argc += x; }
  a(0);
  return argc;
}

2) Is it possible to deallocate functions from a module and recycle the memory used without restarting the JIT? I am trying to build a server type application where objects/classes maybe be deallocated and thus the associated functions will no longer be used.

That should be possible; I'm not sure of the details, though.

3) How does one sequence instructions using Builder similar to a semi-colon in a language like C?

Instructions are ordered within a basic block, and they are guaranteed
to be executed in that order. If you just build the instructions in
the same order that the statements occur in the code, it should work
without any special tweaking.

-Eli

Thanks I managed to figure out most of basic points here based on these answers.