Sorry, glad I'm in the right place. Before I start, I want to state that I'm a beginer and I'm trying to develop a backend by adapting an existent target to my platform. My first doubt is about the SelectionDAG and the TargetLowering class. When I use, for example: setOperationAction(ISD::ADD, MVT::i1, Promote); Is it correct to say that I'm promoting any operand used by the ISD::ADD node to a larger type? If so, what would that value type be? If I use the same function with the expand as the third argument like below: setOperationAction(ISD::FSIN, MVT::f32, Expand); What will the expansion look like, since I don´t provide any custom implementation of the node? Also, what is the meaning of the MVT::f32 in this case? Thanks, Patosga 2016-06-05 19:16 GMT+01:00 Pierre Gagelin <Pierre.Gagelin at myport.ac.uk>:> Hi Patosga, > > You are on the right place to ask your questions and get help! > > Try to be more specific with your problem. We need some details to help > you =) > > Pierre > > On 5 June 2016 at 18:12, via llvm-dev <llvm-dev at lists.llvm.org> wrote: > >> Hello sir, >> >> I'm having some problems understading how llvm works. I'm following a >> concrete example and visualizing the DAG and the .s output and some stuff >> doesn´t seem to match. >> >> I sorry to bother you but I don´t know where I can expose my doubts and I >> wonder if you could redirect me to some discussion place where someone >> might help me. >> >> Thanks, >> Patosga >> >> _____________________________________ >> Sent from http://llvm.1065342.n5.nabble.com >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160605/a0d148a2/attachment.html>
Hi Patosga, you can control what type the operands are promoted to as follows: AddPromotedToType (ISD::ADD, MVT::i1, MVT::i64); For the "Expand" case, I believe you'll find what you're looking for in the file: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp and function SelectionDAGLegalize::ExpandNode(), but if I'm wrong here perhaps others can correct me. Finally, MVT::f32 just states that the operand is a 32-bit single precision floating point type. Nemanja On Sun, Jun 5, 2016 at 11:05 PM, Pedro Lopes via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Sorry, glad I'm in the right place. > Before I start, I want to state that I'm a beginer and I'm trying to > develop a backend by adapting an existent target to my platform. > > My first doubt is about the SelectionDAG and the TargetLowering class. > When I use, for example: > setOperationAction(ISD::ADD, MVT::i1, Promote); > > Is it correct to say that I'm promoting any operand used by the ISD::ADD > node to a larger type? If so, what would that value type be? > > If I use the same function with the expand as the third argument like > below: > setOperationAction(ISD::FSIN, MVT::f32, Expand); > What will the expansion look like, since I don´t provide any custom > implementation of the node? Also, what is the meaning of the MVT::f32 in > this case? > > Thanks, > Patosga > > 2016-06-05 19:16 GMT+01:00 Pierre Gagelin <Pierre.Gagelin at myport.ac.uk>: > >> Hi Patosga, >> >> You are on the right place to ask your questions and get help! >> >> Try to be more specific with your problem. We need some details to help >> you =) >> >> Pierre >> >> On 5 June 2016 at 18:12, via llvm-dev <llvm-dev at lists.llvm.org> wrote: >> >>> Hello sir, >>> >>> I'm having some problems understading how llvm works. I'm following a >>> concrete example and visualizing the DAG and the .s output and some stuff >>> doesn´t seem to match. >>> >>> I sorry to bother you but I don´t know where I can expose my doubts and >>> I wonder if you could redirect me to some discussion place where someone >>> might help me. >>> >>> Thanks, >>> Patosga >>> >>> _____________________________________ >>> Sent from http://llvm.1065342.n5.nabble.com >>> >>> _______________________________________________ >>> LLVM Developers mailing list >>> llvm-dev at lists.llvm.org >>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >>> >> >> > > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160606/ffb57ee6/attachment.html>
Thanks, indeed it was on the LegalizeDAG.cpp and the information proved very useful. I also realized that the customization, promotion or expansion will occur whenever any operand, with the same type as the type specified on the second argument (MVT) of setOperationAction function, appears. (Correct me if I'm wrong). The second doubt I have regards instruction matching. When I define a pattern such as: [(set i32:$dst, (add (mul i32:$src1, i32:$src2), i32:$src3))]> What is the meaning of the word "set" or "store" which appear quite often?>From what I can understand this pattern is only interest in an add nodewith a mul node as one operator and an immediate as the other. Does the "set" (keyword?) translates to an output of the add node, or just another node? Thanks, Patosga 2016-06-06 6:22 GMT+01:00 Nemanja Ivanovic <nemanja.i.ibm at gmail.com>:> > Hi Patosga, > you can control what type the operands are promoted to as follows: > AddPromotedToType (ISD::ADD, MVT::i1, MVT::i64); > > For the "Expand" case, I believe you'll find what you're looking for in > the file: > lib/CodeGen/SelectionDAG/LegalizeDAG.cpp > and function SelectionDAGLegalize::ExpandNode(), but if I'm wrong here > perhaps others can correct me. > > Finally, MVT::f32 just states that the operand is a 32-bit single > precision floating point type. > > Nemanja > > On Sun, Jun 5, 2016 at 11:05 PM, Pedro Lopes via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> Sorry, glad I'm in the right place. >> Before I start, I want to state that I'm a beginer and I'm trying to >> develop a backend by adapting an existent target to my platform. >> >> My first doubt is about the SelectionDAG and the TargetLowering class. >> When I use, for example: >> setOperationAction(ISD::ADD, MVT::i1, Promote); >> >> Is it correct to say that I'm promoting any operand used by the ISD::ADD >> node to a larger type? If so, what would that value type be? >> >> If I use the same function with the expand as the third argument like >> below: >> setOperationAction(ISD::FSIN, MVT::f32, Expand); >> What will the expansion look like, since I don´t provide any custom >> implementation of the node? Also, what is the meaning of the MVT::f32 in >> this case? >> >> Thanks, >> Patosga >> >> 2016-06-05 19:16 GMT+01:00 Pierre Gagelin <Pierre.Gagelin at myport.ac.uk>: >> >>> Hi Patosga, >>> >>> You are on the right place to ask your questions and get help! >>> >>> Try to be more specific with your problem. We need some details to help >>> you =) >>> >>> Pierre >>> >>> On 5 June 2016 at 18:12, via llvm-dev <llvm-dev at lists.llvm.org> wrote: >>> >>>> Hello sir, >>>> >>>> I'm having some problems understading how llvm works. I'm following a >>>> concrete example and visualizing the DAG and the .s output and some stuff >>>> doesn´t seem to match. >>>> >>>> I sorry to bother you but I don´t know where I can expose my doubts and >>>> I wonder if you could redirect me to some discussion place where someone >>>> might help me. >>>> >>>> Thanks, >>>> Patosga >>>> >>>> _____________________________________ >>>> Sent from http://llvm.1065342.n5.nabble.com >>>> >>>> _______________________________________________ >>>> LLVM Developers mailing list >>>> llvm-dev at lists.llvm.org >>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >>>> >>> >>> >> >> >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> >> >-- Cumprimentos, José Pedro Lopes ------------------------------------ Best Regards, José Pedro Lopes -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160606/0542465e/attachment-0001.html>