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

Jakob Stoklund Olesen stoklund at 2pi.dk
Tue Sep 4 09:14:16 PDT 2012


On Sep 1, 2012, at 10:39 PM, "Jyotsna Verma" <jverma at codeaurora.org> wrote:

>> 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.
> 
> You are right about the tables being large and sparse. However, we convert
> between  instruction formats a lot during packetization and binary search
> may increase compile time significantly. I'm trying to come up with some
> alternate approach that would reduce memory usage yet provide faster access
> to the new format. I'm thinking of something like this:
> 
> Have 2 tables - 1st table will be indexed using the instruction Opcode and
> will provide index into the relationship table (one cumulative table for all
> relations).
> As you mentioned, this table will have entries only for the instructions
> with any relations. Since, each instruction will have only a few of all
> possible relations, I'm planning to keep a bit map with each instruction
> which will list all the valid relations and their position. This way I can
> make relationship table totally dense but still can access new format with
> O(1).

I think you should have TableGen emit a lookup function instead of just a table. That way, TableGen can choose the best representation for the specific table's size and sparsity.

/jakob




More information about the llvm-commits mailing list