[LLVMdev] Creating a tablegen backend
David A. Greene
greened at obbligato.org
Mon Aug 23 08:58:52 PDT 2010
Durward McDonell <durward.mcdonell at gmail.com> writes:
>> Why not use LLVM-IR as your 'generic assembly'?
> I should have been more specific about my goals. I want to read
> a (x86) binary, and output code in this other language. I do not have
> access to the source. The target language might be negotiable, but
> for the moment is fixed at what it is. My big hope is that I can leverage
> the semantics that are stored in the X86*.td files, hopefully by implementing
> a small number of primitives, rather than by having to analyze every X86
> instruction myself (not going to happen).
This is a hard problem. By the time you've hit x86 assembly you've lost
a lot of information. That said, if I were going to attempt this, I
would look into the LLVM Disassembler code and work off of that. Then
all of the section identification, instruction decoding, etc. is already
The main issue with this kind of tool is data that also act as code.
You would have to identify such data (hard enough itself) and then
probably duplicate the instructions into your target instruction stream.
More information about the llvm-dev