On Tue, Mar 15, 2016 at 2:21 PM, Krzysztof Parzyszek via llvm-dev < llvm-dev at lists.llvm.org> wrote:> On 3/15/2016 4:16 PM, Rail Shafigulin via llvm-dev wrote: > >> Below is the output of llc with a -debug-only=isel. As you could see the >> output type for load, store, and add changes from v4i32 to i32 during >> legalization. How can I preserve the output type to v4i32? >> > > Make sure that there is a register class associated with v4i32. > > See TargetLoweringBase::addRegisterClass. It's generally called in > <target>ISelLowering.cpp. > > -Krzysztof > > -- > Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted > by The Linux Foundation > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >I'd like to ask you another question (if you don't mind). My EsenciaISelLowering.cpp contains the following code in the EsenciaTargetLowering class constructor: setOperationAction(ISD::BR_CC, MVT::i32, Custom); setOperationAction(ISD::BR_CC, MVT::f32, Custom); setOperationAction(ISD::BR_JT, MVT::Other, Expand); setOperationAction(ISD::BRCOND, MVT::Other, Expand); setOperationAction(ISD::SETCC, MVT::i32, Expand); setOperationAction(ISD::SETCC, MVT::f32, Expand); setOperationAction(ISD::SELECT, MVT::i32, Expand); setOperationAction(ISD::SELECT, MVT::f32, Expand); setOperationAction(ISD::SELECT_CC, MVT::i32, Custom); setOperationAction(ISD::SELECT_CC, MVT::f32, Custom); I sort of have an intuition what it is doing, but quite nail it.Do you mind explaining it? Also I didn't add any of the setOperationAction for the MVT::v4i32 and my simple test case worked. How come? -- Rail Shafigulin Software Engineer Esencia Technologies -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160315/ae99c2cc/attachment.html>
Krzysztof Parzyszek via llvm-dev
2016-Mar-16 17:36 UTC
[llvm-dev] how to type-legalize a dag
On 3/15/2016 5:48 PM, Rail Shafigulin wrote:> > > I'd like to ask you another question (if you don't mind). My > EsenciaISelLowering.cpp contains the following code in the > EsenciaTargetLowering class constructor: > > setOperationAction(ISD::BR_CC, MVT::i32, Custom); > setOperationAction(ISD::BR_CC, MVT::f32, Custom); > setOperationAction(ISD::BR_JT, MVT::Other, Expand); > setOperationAction(ISD::BRCOND, MVT::Other, Expand); > setOperationAction(ISD::SETCC, MVT::i32, Expand); > setOperationAction(ISD::SETCC, MVT::f32, Expand); > setOperationAction(ISD::SELECT, MVT::i32, Expand); > setOperationAction(ISD::SELECT, MVT::f32, Expand); > setOperationAction(ISD::SELECT_CC, MVT::i32, Custom); > setOperationAction(ISD::SELECT_CC, MVT::f32, Custom); > > I sort of have an intuition what it is doing, but quite nail it.Do you > mind explaining it? Also I didn't add any of the setOperationAction for > the MVT::v4i32 and my simple test case worked. How come?This tells the legalizer how to treat various operations with given types. What the type is of, somewhat depends on the operation. You can look in lib/CodeGen/SelectionDAG/LegalizeDAG.cpp, in function SelectionDAGLegalize::LegalizeOp, to see where the type comes from. That's where the actions are being looked up. If the action is "Legal", then there is nothing to be done with it, since it's already considered legal. If the action is "Expand", which will convert the operation into some sort of a generic expansion which will either be legal or will be legalized further. A "Custom" action causes the legalizer to call LowerOperation in target's ISel lowering class. That function will then be responsible for generating the target-specific code for this operation. -Krzysztof -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Krzysztof Parzyszek via llvm-dev
2016-Mar-16 17:39 UTC
[llvm-dev] how to type-legalize a dag
On 3/16/2016 12:36 PM, Krzysztof Parzyszek via llvm-dev wrote:> If the action is "Expand", which will convert the operation intoUnfinished edit. Should be If the action is "Expand", the legalizer will replace the operation with... -Krzysztof -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation