[LLVMdev] [global-isel] Simplifying the simplifier

Nuno Lopes nunoplopes at sapo.pt
Sun Aug 11 14:35:10 PDT 2013


>>> This sounds promising. But we have some requirements that textbook 
>>> rewriting systems can't handle:
>>>
>>> - Expressions are DAGs, not trees.
>>> - Targets can add custom rewriting rules and override standard rules.
>>> - Rules will have predicates. Some predicates are static and only depend 
>>> on the subtarget, some predicates will depend on the pattern being 
>>> matched.
>>> - The system won't be convergent if you ignore all the predicates.
>>>
>>> So the question is, given those requirements, can we still prove 
>>> termination?
>>
>> Uhm, I'm not sure about the custom target rules, since most likely a 
>> bunch of them will need to be specified in C++, and then they will be a 
>> black box to the tool..
>
> I think that SelectionDAG forces you to drop to C++ too soon, but we'll 
> always need that possibility.
>
>> Regarding the predicates, how complicated are these?  Aren't these 
>> expressions mostly in linear integer arithmetic?  Or can you have 
>> arbitrary calls to complex C++ code?
>
> There are too many static predicates, so it isn't feasible to enumerate 
> all possible combinations, but we can expose their relationships to the 
> tool as boolean expressions. For example, X86 currently has:
>
> def HasCMov      : Predicate<"Subtarget->hasCMov()">;
> def NoCMov       : Predicate<"!Subtarget->hasCMov()">;
>
> It would be simple to define:
>
> def NoCMov       : Predicate<(not HasCMov)>;
>
> And the tool would be able to infer that the predicates are disjoint. 
> Similarly:
>
> def : Always<(or HasSSE1, (not HasSSE2))>;
>
> can be used to infer an implication.
>
> Many pattern predicates could be expressed in a DSL, but we should still 
> make it possible to use C++ code.

Ok, thanks a lot for the examples!  After vacations I'll discuss this topic 
with a few colleagues here.

Nuno 




More information about the llvm-dev mailing list