[LLVMdev] Pattern class

Kotler, Reed rkotler at mips.com
Sun Sep 16 13:51:54 PDT 2012


If I can't solve this more elegantly, I will be putting back the current code to the Mips16 port tomorrow.

I have quite a few of these multi instruction pseudos for condtional branch, select and setcc matching

________________________________________
From: Kotler, Reed
Sent: Sunday, September 16, 2012 1:42 PM
To: Sean Silva
Cc: Hal Finkel; Anton Korobeynikov; LLVM-Dev ‎[llvmdev at cs.uiuc.edu]‎
Subject: RE: [LLVMdev] Pattern class

Here is a simple place I wanted to use it.

...


On multiply, the result implicit is placed in a 64 bit hi/lo register.

//
// Format: MFLO rx MIPS16e
// Purpose: Move From LO Register
// To copy the special purpose LO register to a GPR.
//
def Mflo16: FRR16_M_ins<0b10010, "mflo", IIAlu> {
  let Uses = [LO];
  let neverHasSideEffects = 1;
}

//
// Pseudo Instruction for mult
//
def MultRxRy16:  FMULT16_ins<"mult",  IIAlu> {
  let isCommutable = 1;
  let neverHasSideEffects = 1;
  let Defs = [HI, LO];
}

def: Mips16Pattern<(mul CPU16Regs:$l, CPU16Regs:$r),
              [(MultRxRyRz16 CPU16Regs:$l, CPU16Regs:$r), (Mflo16) ]>;

Without the list of instructions feature in the Pattern class, I am forced to make a pseudo that has both the mul and mflo instruction in it.

This is a very simple example and some, like for example the conditional move have 3 instructions with sequences like:

cmp x,y
bnez .+4
move a, b

I am able to do all of this just fine with pseudo's but it's not as clean a solution.

________________________________________
From: Sean Silva [silvas at purdue.edu]
Sent: Sunday, September 16, 2012 1:09 PM
To: Kotler, Reed
Cc: Hal Finkel; Anton Korobeynikov; LLVM-Dev ‎[llvmdev at cs.uiuc.edu]‎
Subject: Re: [LLVMdev] Pattern class

What have you tried?

On Sun, Sep 16, 2012 at 3:34 PM, Kotler, Reed <rkotler at mips.com> wrote:
> This Pattern class says it's possible but seems just to not work or maybe I'm using it incorrectly.
>
> Probably I will go and fix it when I'm done with mips16.
>
>
> ________________________________________
> From: Hal Finkel [hfinkel at anl.gov]
> Sent: Sunday, September 16, 2012 10:59 AM
> To: Anton Korobeynikov
> Cc: Kotler, Reed; LLVM-Dev ‎[llvmdev at cs.uiuc.edu]‎
> Subject: Re: [LLVMdev] Pattern class
>
> On Sun, 16 Sep 2012 21:33:26 +0400
> Anton Korobeynikov <anton at korobeynikov.info> wrote:
>
>> > This has several problems for direct object emitting
>> Why? Just expand these pseudos before asm printing and you're done.
>> This is the approach used by other targets. Check e.g. ARM backend for
>> handling movw + movt pair of instructions.
>
> I think that *if* it were possible to do this with patterns, then that
> would be the preferred mechanism.
>
>  -Hal
>
>>
>
>
>
> --
> Hal Finkel
> Postdoctoral Appointee
> Leadership Computing Facility
> Argonne National Laboratory
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list