[llvm-dev] infer correct types from the pattern

Rail Shafigulin via llvm-dev llvm-dev at lists.llvm.org
Tue Apr 5 09:30:02 PDT 2016


On Tue, Apr 5, 2016 at 5:48 AM, Krzysztof Parzyszek <kparzysz at codeaurora.org
> wrote:

> On 4/4/2016 5:58 PM, Rail Shafigulin wrote:
>
>>
>> What about load instruction? I tried the same approach but I got an error.
>>
>> error: In anonymous_570: Type inference contradiction found, merging
>> '{v4i32:v4f32}' into '{i32:f32}'
>>
>>
> Try changing this Pat:
>
> // Cast load of a floating point vector to use the same
>> // operation as a load of an integer vector.
>> def: Pat<(set (v4f32 VR:$rD), (load ADDRri:$src)),
>>           (VLWZ VR:$rD, ADDRri:$src)>;
>>
>
> to
>
> def: Pat<(v4f32 (load ADDRri:$src)),
>          (VLWZ ADDRri:$src)>;
>
> That is, remove the "set" from the input pattern and the output operand
> from the output pattern.
>
> Generally, Pats only contain input operands.
>
>
> If you have an error message like the one above, one easy way to locate
> the problem is to look at the list of all records generated by table-gen:
>
> $ llvm-tblgen -print-records -I /path/to/llvm/lib/Target/<target> -I
> /path/to/llvm/lib/Target -I /path/to/llvm/include
> /path/to/lib/Target/<target>/<target>.td -o output_file
>
> (This is the same invocation of table-gen as for any other purpose, except
> for the "-print-records" option instead of the typical -gen-... options.)
>
>
> The output_file will then contain all the records that came out of the .td
> files, for example:
>
> def anonymous_1405 {    // Pattern Pat T_CMP_pat
>   dag PatternToMatch = (i1 (seteq (i32 IntRegs:$src1), s10ImmPred:$src2));
>   list<dag> ResultInstrs = [(C2_cmpeqi IntRegs:$src1, s10ImmPred:$src2)];
>   list<Predicate> Predicates = [];
>   int AddedComplexity = 0;
>   string NAME = ?;
> }
>
> You can look for "anonymous_570" in your case and see where it came from.
> The comment after "def anonymous..." is a list of classes from which this
> definition was inherited.
>
>
>
> -Krzysztof
>
>
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted
> by The Linux Foundation
>


Has anybody told you, you are a genius!!! Your solution worked, I really
appreciate the help. And I will keep in mind the -print records option for
the llvm-tbglen.

-- 
Rail Shafigulin
Software Engineer
Esencia Technologies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160405/b22c95d3/attachment.html>


More information about the llvm-dev mailing list