[LLVMdev] RFC: X86InstrFormats.td Refactoring

Dan Gohman gohman at apple.com
Tue Mar 31 11:53:33 PDT 2009


On Mar 30, 2009, at 2:53 PM, David Greene wrote:

> On Monday 30 March 2009 16:12, David Greene wrote:
>> There is some redundancy at the instruction format level in the  
>> x86 .td
>> files. For example, in X86InstrFormats.td:
>>
>> // SSE1 Instruction Templates:
>> //
>> //   SSI   - SSE1 instructions with XS prefix.
>>
>> class SSI<bits<8> o, Format F, dag outs, dag ins, string asm,  
>> list<dag>
>> pattern>
>>
>>      : I<o, F, outs, ins, asm, pattern>, XS, Requires<[HasSSE1]>;
>>
>> // SSE3 Instruction Templates:
>> //   S3SI   - SSE3 instructions with XSrefix.
>>
>> class S3SI<bits<8> o, Format F, dag outs, dag ins, string asm,  
>> list<dag>
>> pattern>
>>
>>      : I<o, F, outs, ins, asm, pattern>, XS, Requires<[HasSSE3]>;
>>
>> The only difference here is the parameter to Requires.  There are  
>> many more
>> examples and this gets worse with AVX.

[...]

> Actually, I meant to keep the existing class names intact to avoid  
> global
> changes.  So what I'm proposing is actually:
>
> class SSIb<bits<8> o, Format F, dag outs, dag ins, string asm,
>   list<dag>  pattern>  : I<o, F, outs, ins, asm, pattern>, XS;
>
> class SSI<bits<8> o, Format F, dag outs, dag ins, string asm,
>  list<dag> pattern>
>       : SSIb<o, F, outs, ins, asm, pattern>, Requires<HasSSE1>;


Is this just factoring out the ", XS" part? As presented, it looks like
this change would introduce more redundancy that it would eliminate.

Dan




More information about the llvm-dev mailing list