I have an operating system with strange memory semantics (GEOS, if
you're interested). Blocks of memory may move at any time unless
locked down. You're not supposed to leave blocks locked. You refer to
blocks by their handles.

So, to read from memory, you lock the handle, which gives you a
pointer; dereference the pointer; and then unlock the handle again.

This all works very nicely except that standard ANSI C programs won't
run, because they expect fixed blocks of memory.

What I want to do is write a C compiler that changes the pointer
semantics of the program, emitting another program that I can feed
into GEOS' odd C compiler.

I'm currently playing with lcc, and have a fair amount of success; I
have a back end that generates more-or-less correct C code, and
pointer dereferences are correctly wrapped, but the output code is
still going to be dire. I can't get lcc to let me handle switch
statements, for example, and since I can't use jump tables it's going
to produce a sequence of if...goto pairs.

Are there any compilers (lcc, gcc) around that have C back ends? Are
there any type analysis tools around that can be modified to write out
the code once they've read it in (because I don't need a fully fledged
code generator)? Am I going at this in completely the wrong way?