Alireza.Moshtaghi at microchip.com
2007-Sep-26 21:30 UTC
[LLVMdev] Lowering operations to 8-bit!
I am trying to lower all llvm operations to 8-bit. So far I was trying to have llvm do all that for me using things like: setOperationAction(ISD::ADD, MVT::ii,Promote); setOperationAction(ISD::ADD, MVT::i8,Legal); setOperationAction(ISD::ADD, MVT::i16,Expand); setOperationAction(ISD::ADD, MVT::i32,Expand); However, I keep getting an assertion failure that operation can not be expanded. Now I am thinking maybe LLVM does not lower all operations and value types. Before going ahead and write new DAGs for all LLVM operations, I would like to make sure that I am doing the right thing. Am I doing it right? Do I have to write new DAGs for all of the LLVM operations? Or some of them already do it for me? Thanks, Alireza Moshtaghi Senior Software Engineer Development Systems, Microchip Technology -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20070926/4266731f/attachment.html>
On Wed, 26 Sep 2007 Alireza.Moshtaghi at microchip.com wrote:> I am trying to lower all llvm operations to 8-bit. So far I was trying > to have llvm do all that for me using things like:ok> setOperationAction(ISD::ADD, MVT::ii,Promote); > setOperationAction(ISD::ADD, MVT::i8,Legal); > setOperationAction(ISD::ADD, MVT::i16,Expand); > setOperationAction(ISD::ADD, MVT::i32,Expand);This should work.> However, I keep getting an assertion failure that operation can not be > expanded.On which operation, of which types?> Now I am thinking maybe LLVM does not lower all operations and value > types.Things are typically added to LegalizeDAG on demand, so you may run into some corner cases that other targets haven't hit yet.> Before going ahead and write new DAGs for all LLVM operations, I would > like to make sure that I am doing the right thing.In theory, you should just have to add code to LegalizeDAG.cpp to expand the operation. With information about which operation is the problem we can give you more guidance. -Chris -- http://nondot.org/sabre/ http://llvm.org/
Alireza.Moshtaghi at microchip.com
2007-Sep-27 23:35 UTC
[LLVMdev] Lowering operations to 8-bit!
I'm working on version 2.0 The assertion at line 2380 of LegalizeDAG.cpp fails when it is trying to lower the add with i16. assertion reads: assert(MVT::isVector(Node->getValueType(0)) && "Cannot expand this binary operation!"); I am trying to compile a very simple program as follows: short var; void foo(void) { Var++; } The input bytecode, (in addition to the debug stuff) contains: %tmp = load i16* @var ;<i16> [#uses=1] %tmp1 = add i16 %tmp, 1 ;<i16> [#uses=1] store i16 %tmp1, i16* @var br label %return return: ;preds = %entry Is the above giving any clue, or you need more info? Thanks A. -----Original Message----- From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Chris Lattner Sent: Thursday, September 27, 2007 11:23 AM To: LLVM Developers Mailing List Subject: Re: [LLVMdev] Lowering operations to 8-bit! On Wed, 26 Sep 2007 Alireza.Moshtaghi at microchip.com wrote:> I am trying to lower all llvm operations to 8-bit. So far I was trying > to have llvm do all that for me using things like:ok> setOperationAction(ISD::ADD, MVT::ii,Promote); > setOperationAction(ISD::ADD, MVT::i8,Legal); > setOperationAction(ISD::ADD, MVT::i16,Expand); > setOperationAction(ISD::ADD, MVT::i32,Expand);This should work.> However, I keep getting an assertion failure that operation can not be > expanded.On which operation, of which types?> Now I am thinking maybe LLVM does not lower all operations and value > types.Things are typically added to LegalizeDAG on demand, so you may run into some corner cases that other targets haven't hit yet.> Before going ahead and write new DAGs for all LLVM operations, I would > like to make sure that I am doing the right thing.In theory, you should just have to add code to LegalizeDAG.cpp to expand the operation. With information about which operation is the problem we can give you more guidance. -Chris -- http://nondot.org/sabre/ http://llvm.org/ _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev