[LLVMdev] using the constant pool during select

Andrew Lenharth andrewl at lenharth.org
Wed Sep 20 08:12:31 PDT 2006


If you look at AlphaISelDAGToDAG.cpp:244, it probably does what you
want.  If a constant is too big, it spills it to the constant pool,
else it passes it through to the auto-generated selector.

Andrew

On 9/20/06, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:
> In ARM, constants that are too large to be used as immediate are
> usually placed in a constant pool and loaded.
>
> What I am trying to do is to have a select function that checks the if
> a constant can be an immediate and, if it can't, produces a load:
>
> ---------------------------------------------------------------------------------------
>      const Type *OpNTy =  MVT::getTypeForValueType(MVT::i32);
>       Constant *C = ConstantUInt::get(OpNTy, t);
>       int alignment = 2;
>       SDOperand Addr = CurDAG->getTargetConstantPool(C, MVT::i32, alignment);
>       Arg =  CurDAG->getLoad(MVT::i32, CurDAG->getEntryNode(), Addr,
>                              CurDAG->getSrcValue(NULL));
> ----------------------------------------------------------------------------------------
>
> This fails with the assert "This target-independent node should have
> been selected". It is illegal to create a load during select?
>
> Should I write a lowering function to do this before the select phase?
>
> Thanks,
> Rafael
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>




More information about the llvm-dev mailing list