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

Jakob Stoklund Olesen stoklund at 2pi.dk
Fri Sep 28 14:42:13 PDT 2012


On Sep 28, 2012, at 12:22 PM, Jyotsna Verma <jverma at codeaurora.org> wrote:

> Jakob,
> 
>> In find the code very hard to read without a high-level description of
> what it
>> is supposed to do and how it is supposed to be used. Don't assume whoever
>> reads the code has read any of the mailing list threads.
> 
> I can understand that. I will include some description in the .cpp file.

Thanks.
> 
> 1) Iterate through all the records that derive from "InstrMapping" class
> 2) For each record, we filter out instructions based on the FilterClass
> value.
> 3) Among this set, we look for the instructions that have the same values as
> KeyCol for  all the fields listed in ColFields. These are identified as the
> potential candidates for key instructions. Some of these instructions may be
> dropped if their corresponding column instruction is not found. In case of
> multi-column relation, the instruction is removed if none of the relations
> are found.
> 
> For Example:
> def getPredOpcode : InstrMapping {
>  let FilterClass = "PredRel";
>    let RowFields = ["BaseOpcode"];
>    let ColFields = ["PredSense"];
>    let KeyCol = ["none"];
>    let ValueCols = [["true"], ["false"]];
> }
> 
> Here, only instructions that have "none" as PredSense will be selected as
> key instructions.
> 
> 4) For each key instructions, we form a small group of instructions which
> have the same values as the key instruction for all the fields listed in
> RowFields.

OK, please avoid using a quadratic algorithm to do that.

> I don't know what you mean by the full backend. I'm not adding any new
> TableGen option/flag for this functionality. I have just added the
> functionality in a separate file and emit  output in GenInstrInfo.inc file
> as you suggested. I call it after EmitInstrInfo function from TableGen.cpp
> like this:

I see. I don't really understand the purpose of the MapTableEmitter class, then. There is very little class state, and you're passing a lot of context around as function arguments.

/jakob




More information about the llvm-commits mailing list