----- Original Message -----> From: "Ambuj Agrawal" <ambujbwt at gmail.com>
> To: llvmdev at cs.uiuc.edu
> Sent: Friday, February 20, 2015 10:13:56 AM
> Subject: [LLVMdev] LLVM Backend DAGToDAGISel
>
> I am currently working on DAGToDAGISel class and am trying to figure
> out a way for storing an immediate in register if it is greater than
> 31.
>
> I have something like:
>
> unsigned Imm = Node->getConstantOperandVal(2);
> if (Imm > 31)
> {
> //wanted to load into the register and get the register number
>
> Imm = Register number
> }
>
> Instead of storing it as immediate:
> SDValue immediteVAL = CurDAG->getTargetConstant(Imm, MVT::i32);
>
>
> Any clues or references which might help me with this?
>
You can create the machine-instruction nodes used to materialized the integer.
You may also be able to let the generic constant integer selection code handle
it for you, but that will mean that your instruction patterns need to refuse to
match the larger integers as immediates. The PPC backend uses both techniques in
places. Regarding the patterns, see maskimm32 and imm32SExt16, for example, in
lib/Target/PowerPC/PPCInstrInfo.td.
-Hal
>
> Thanks,
>
> Ambuj
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
--
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory