[LLVMdev] Multiclass patterns

Villmow, Micah Micah.Villmow at amd.com
Tue Feb 10 08:27:19 PST 2009


Bill,
 Sorry if I wasn't clear enough. I wasn't referring to multiclass's that
define other classes, but with using patterns inside of a multiclass to
reduce redundant code. 
For example:
multiclass IntSubtract<SDNode node>
{
    def _i8 : Pat<(sub GPRI8:$src0, GPRI8:$src1),
               (ADD_i8 GPRI8:$src0, (NEGATE_i8 GPRI8:$src1))>;
    def _i32 : Pat<(sub GPRI32:$src0, GPRI32:$src1),
               (ADD_i32 GPRI32:$src0, (NEGATE_i32 GPRI32:$src1))>;
}

or something similar.
I just want to write the pattern once and then have it apply to multiple
register types, i.e. a generic pattern rule for many different register
classes.

Thanks,
Micah

-----Original Message-----
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu]
On Behalf Of Bill Wendling
Sent: Monday, February 09, 2009 5:39 PM
To: LLVM Developers Mailing List
Subject: Re: [LLVMdev] Multiclass patterns

On Mon, Feb 9, 2009 at 5:17 PM, Villmow, Micah <Micah.Villmow at amd.com>
wrote:
> Is there a way to define a multi-class pattern in tablegen?
>
Yes. See "multiclass" and "defm" in, say, X86Instr64bit.td, et al.

-bw
_______________________________________________
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