[LLVMdev] Compiler driver

Mark Muir mark.i.r.muir at gmail.com
Wed Dec 16 01:54:16 PST 2009

Hi all,

I'm developing a custom back-end for an odd-ball architecture (but one that is still describable by LLVMTargetMachine). The toolchain that it will fit into doesn't have a linker as such, so I want to use assembly as the default output. I've got to the point of emitting working custom assembly for very simple C programs (i.e. ones that don't rely on libraries). At the moment, I'm doing this through clang-cc and llc:

	clang-cc -D=MY_ARCH -emit-llvm-bc -o -  in.c \
	| llc -filetype=asm -march=my_arch

I want to be able to package this compiler as a cross-compiler - a single binary to go from C to assembly for that target. It should define a macro (as shown above) to allow the target to be identified by source code. I was thinking of doing this using llvmc to capture the above command-line. Is that the recommended approach?

Also, I don't want to rely on GLIBC. I want something like newlib (which is what we used successfully with our previous GCC back-end). How do I go about doing that with LLVM?

Any help is appreciated.


- Mark

More information about the llvm-dev mailing list