[LLVMdev] Directly generating binary file

Vladimir Prus ghost at cs.msu.su
Mon Feb 27 06:33:12 PST 2006


Hi!

I'm looking for a way to make the the "llc" tool (or any other tool),
directly produce a binary file for some target.

The TargetMachine class has a method 'addPassesToEmitMachineCode', that's
suitable for that, but that method also requires an instance of
MachineCodeEmitter.

The existing MachineCodeEmitter derived classes are either debug-only
(writing to std::cerr), or for JIT, or for ELF (which is not used anywhere,
BTW).

Ideally, I'd like to create my own MachineCodeEmitter derived class, load it
into llc with the -load option, and then have new option for 'llc' that
will use MachineCodeEmitter, not AssemblyWriter, to generate the file.

The reason I'm trying to do this is that the target does not have an
assembler, and does not need it, and so designing an assembler syntax just
for the sake of code generation does not seem right.

Any suggestions how I should proceed?

Thanks,
Volodya





More information about the llvm-dev mailing list