On Thu, Oct 2, 2008 at 7:34 AM, Evan Cheng <evan.cheng at apple.com> wrote:> > On Oct 2, 2008, at 2:01 AM, sanjiv gupta wrote: > >> >>> >>> So you have a i16 register class which makes the type legal. You can >>> make loads and stores legal (can you?). But you will have to custom >>> lower all other i16 operations. This will work, but it requires a lot >>> of target specific code. >> >> True. If we add the i16 reg class we will need to write a lot of >> target specific code. >> To avoid that our idea was not to tell the legalizer about the i16 >> regclass and let it expand everything but ignore the pointers. > > You can try just marking all i16 operations, other than load and > store, as "expand". Would that work?Won't work; LLVM expects at least some basic operations, like add, to be legal in legal register types. -Eli
On Oct 2, 2008, at 8:38 AM, Eli Friedman wrote:> On Thu, Oct 2, 2008 at 7:34 AM, Evan Cheng <evan.cheng at apple.com> > wrote: >> >> On Oct 2, 2008, at 2:01 AM, sanjiv gupta wrote: >> >>> >>>> >>>> So you have a i16 register class which makes the type legal. You >>>> can >>>> make loads and stores legal (can you?). But you will have to custom >>>> lower all other i16 operations. This will work, but it requires a >>>> lot >>>> of target specific code. >>> >>> True. If we add the i16 reg class we will need to write a lot of >>> target specific code. >>> To avoid that our idea was not to tell the legalizer about the i16 >>> regclass and let it expand everything but ignore the pointers. >> >> You can try just marking all i16 operations, other than load and >> store, as "expand". Would that work? > > Won't work; LLVM expects at least some basic operations, like add, to > be legal in legal register types.That sounds like a bug, not a feature. -Chris
On Thu, 2008-10-02 at 08:53 -0700, Chris Lattner wrote:> On Oct 2, 2008, at 8:38 AM, Eli Friedman wrote: > > > On Thu, Oct 2, 2008 at 7:34 AM, Evan Cheng <evan.cheng at apple.com> > > wrote: > >> > >> On Oct 2, 2008, at 2:01 AM, sanjiv gupta wrote: > >> > >>> > >>>> > >>>> So you have a i16 register class which makes the type legal. You > >>>> can > >>>> make loads and stores legal (can you?). But you will have to custom > >>>> lower all other i16 operations. This will work, but it requires a > >>>> lot > >>>> of target specific code. > >>> > >>> True. If we add the i16 reg class we will need to write a lot of > >>> target specific code. > >>> To avoid that our idea was not to tell the legalizer about the i16 > >>> regclass and let it expand everything but ignore the pointers. > >> > >> You can try just marking all i16 operations, other than load and > >> store, as "expand". Would that work? > > > > Won't work; LLVM expects at least some basic operations, like add, to > > be legal in legal register types. > > That sounds like a bug, not a feature. > -ChrisThe -enable-legalize-types infrastructure is entirely based upon getVTAction (), so it will be completely ignored once we have i16 regclass, ditto with ExpandOp of LegalizeDAG. And LegalizeDAG::LegalizeOp() allows very few things to be auto expanded. -Sanjiv> _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Alireza.Moshtaghi at microchip.com
2008-Oct-02 17:21 UTC
[LLVMdev] Type Legalizer Question.
> > Won't work; LLVM expects at least some basic operations, like add,to> > be legal in legal register types. > > That sounds like a bug, not a feature. > > -ChrisI think the reason behind this behavior in llvm is the pointer calculations. When it comes to expanding operands, llvm does not have any case defined for load (because its only operand is a pointer) and it asserts if it finds out that the pointer of store needs to be expanded... For all other targets, whatever register is used for pointer, that register can also be part of a legal operation of its own size. However, the problem with our target is that it allows only 8 bit calculations but also provides 16 bit pointers (2 8 bits) A.