[llvm-commits] [LLVMdev] TableGen backend support to express relations between instruction

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Aug 29 15:23:01 PDT 2012


On Aug 28, 2012, at 11:01 AM, Jyotsna Verma <jverma at codeaurora.org> wrote:

> Here is the first draft of the patch to add TableGen backend support for the
> instruction mapping tables. Please take a look and let me know your
> suggestions. As of now, I create one mapping table per relation which
> results into a long .inc file. So, I'm planning to combine everything into a
> single table and will include APIs (one per relation) to query from this
> table. 

Hi Jyotsna,

Please send patches to llvm-commits instead of llvm-dev.

Some general comments:

These instruction mappings are going to be used in *InstrInfo.cpp, so there is no need to create a new TableGen backend. The tables can be emitted at the end of *GenInstrInfo.inc under a new #ifdef flag. Keep the separate .cpp file.

Use a class to represent InstrMapping Record. Then you won't have to pass around a lot on context pointers in your function calls.

The tables you are emitting are very large and very sparse. You should only emit the rows that have a key instruction, and use a binary search instead of using the opcode as an index directly. That will save a lot of memory, particular for small tables like the ones Hal needs.

Instruction opcodes are 16 bits, no need for a full unsigned.

When you are comparing column fields, there is no need to convert the Inits to strings. Init pointers are uniqued, so you can just compare Init pointers.

You need more documentation.

/jakob




More information about the llvm-commits mailing list