[llvm-commits] [llvm] r156634 - in /llvm/trunk: lib/Target/Hexagon/ lib/Target/Hexagon/InstPrinter/ test/CodeGen/Hexagon/

Jyotsna Verma jverma at codeaurora.org
Wed Aug 1 13:27:24 PDT 2012


Hi,
 
I'm looking for some suggestions on a problem related to the Hexagon
backend.
 
Hexagon architecture allows instructions in various formats. For example, we
have 3 variations of the add instruction as defined below:
 
ADDrr : r1 = add(r2, r3) --> add 2 32-bit registers
ADDrr_p : if(p0) r1 = add(r2, r3) --> predicated version of ADDrr
instruction, executed when p0 is true
ADDrr_np : if(!p0) r1 = add(r2, r3) --> predicated version of ADDrr
instruction, executed when p0 is false
 
Currently, we rely on switch tables to transform between formats. However,
we would like to have a different mechanism to represent these relationships
instead of switch tables. I am thinking of modeling these relations in
HexagonInstrInfo.td file and use TableGen to generate a table with the
information. Idea is to have a new class, say Relations, with some members
of type 'Instruction' each representing a specific relation between itself
and 'ThisInstr'.
 
For example:
class Relations {
                Instruction ThisInstr;
                Instruction BaseForm;
                Instruction TruePred;
                Instruction FalsePred;
}
 
def Rel_ADDrr : Relations<ADDrr, ADDrr, ADDrr_p, ADDrr_np>;
def Rel_ADDrr_p : Relations<ADDrr_p, ADDrr, , >;
def Rel_ADDrr_np : Relations<ADDrr_np, ADDrr, , >;
 
I wonder if TableGen can parse Relations defs and emit the information into
tabular form. I expect to index the resulting table using the instruction
opcode and find opcode of the new instruction of the desired format. Any
suggestions will be much appreciated.
 
Relationship table layout:

HexagonInstrRelations[] = {
.
{HexagonISD::ADDrr, HexagonISD::ADDrr, HexagonISD:: ADDrr_p,
HexagonISD::ADDrr_np},
{HexagonISD::ADDrr_p, HexagonISD::ADDrr, -1, -1},
{HexagonISD::ADDrr_np, HexagonISD::ADDrr, -1, -1},
.
};

Each column represents a specific relationship, -1 means
'invalid/nonexistent relation'.
  
Thanks,
Jyotsna

-----Original Message-----
From: llvm-commits-bounces at cs.uiuc.edu
[mailto:llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Tony Linthicum
Sent: Monday, May 14, 2012 11:10 AM
To: Jakob Stoklund Olesen
Cc: llvm-commits at cs.uiuc.edu
Subject: Re: [llvm-commits] [llvm] r156634 - in /llvm/trunk:
lib/Target/Hexagon/ lib/Target/Hexagon/InstPrinter/ test/CodeGen/Hexagon/

Hi Jakob,

On 5/11/2012 6:47 PM, Jakob Stoklund Olesen wrote:
>
> On May 11, 2012, at 4:32 PM, "Brendon Cahoon"<bcahoon at codeaurora.org>
wrote:
>
>> Yea, a very ugly file to commit.  This is a file that we would 
>> like/are planning to be generated using Tablegen.
>
> You will need to come up with a solution. This is just too gross.
>
> /jakob
>

As Brendon indicated, we intend to have this generated by tablegen but
current internal resource constraints make implementing that now difficult.
We are trying to get our backend up to date, and we viewed this as a
reasonable interim solution.  Our plan is to fix this properly in the late
July time frame.  If, however, it is unacceptable for this to remain until
then we will shift things around and address the proper solution
immediately.

Thanks for your time and your input.

Tony

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum.
_______________________________________________
llvm-commits mailing list
llvm-commits at cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list