Krzysztof Parzyszek via llvm-dev
2016-Mar-16 18:02 UTC
[llvm-dev] how to type-legalize a dag
On 3/16/2016 12:53 PM, Rail Shafigulin wrote:> > On Wed, Mar 16, 2016 at 10:39 AM, Krzysztof Parzyszek via llvm-dev > <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: > > On 3/16/2016 12:36 PM, Krzysztof Parzyszek via llvm-dev wrote: > > If the action is "Expand", which will convert the operation into > > > Unfinished edit. Should be > > If the action is "Expand", the legalizer will replace the operation > with... > > > I think this is still unfinished :)Only this part of the sentence needed more work, but ok, here's the whole thing: If the action is "Expand", the legalizer will replace the operation with some sort of a generic expansion which will either be legal or will be legalized further. There. :) -Krzysztof -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
On Wed, Mar 16, 2016 at 11:02 AM, Krzysztof Parzyszek < kparzysz at codeaurora.org> wrote:> On 3/16/2016 12:53 PM, Rail Shafigulin wrote: > >> >> On Wed, Mar 16, 2016 at 10:39 AM, Krzysztof Parzyszek via llvm-dev >> <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: >> >> On 3/16/2016 12:36 PM, Krzysztof Parzyszek via llvm-dev wrote: >> >> If the action is "Expand", which will convert the operation into >> >> >> Unfinished edit. Should be >> >> If the action is "Expand", the legalizer will replace the operation >> with... >> >> >> I think this is still unfinished :) >> > > Only this part of the sentence needed more work, but ok, here's the whole > thing: > > If the action is "Expand", the legalizer will replace the operation with > some sort of a generic expansion which will either be legal or will be > legalized further. >Given that the action is "Expand" how does legalizer know which replacement to use for a given operation?> There. :) > > > -Krzysztof > > -- > Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted > by The Linux Foundation >-- Rail Shafigulin Software Engineer Esencia Technologies -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160318/57d2ca18/attachment.html>
On 18 March 2016 at 12:20, Rail Shafigulin via llvm-dev <llvm-dev at lists.llvm.org> wrote:> Given that the action is "Expand" how does legalizer know which replacement > to use for a given operation?It's pretty random, and the only way to be sure is to read LegalizeDAG.cpp. The two basic variants are: + Check whether the intended opcode is Legal, use that if possible, otherwise keep trying until you run out of ideas. + Expand it to something, legal or not. Then that node will be expanded in turn. Obviously neither is guaranteed to terminate in a legal node (for example you could set absolutely everything to Expand in which case there's no solution). These heuristics tend to cover the common cases, but most targets need to mark at least a few nodes as Custom and handle them manually. Cheers. Tim.
Krzysztof Parzyszek via llvm-dev
2016-Mar-18 19:34 UTC
[llvm-dev] how to type-legalize a dag
On 3/18/2016 2:20 PM, Rail Shafigulin wrote:> > Given that the action is "Expand" how does legalizer know which > replacement to use for a given operation?It's pretty much all hardcoded. A more complex operation is rewritten in terms of simpler operations, which are more likely to be legal. Look in SelectionDAGLegalize::ExpandNode to see what happens in each case. -Krzysztof -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation