[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelLowering.h PPCISelLowering.cpp

Chris Lattner clattner at apple.com
Thu Mar 1 09:45:01 PST 2007


> Implemented the frameaddress intrinsic for PPC.

Thanks!


> +SDOperand PPCTargetLowering::LowerFRAMEADDR(SDOperand Op,  
> SelectionDAG &DAG)
> +{

Please put the '{' on the same line as the rest, to conform with the  
style in use in this file.

> +  // Depths > 0 not supported yet!
> +  if (cast<ConstantSDNode>(Op.getOperand(0))->getValue() > 0)
> +    return SDOperand();
> +
> +  MVT::ValueType PtrVT = DAG.getTargetLoweringInfo().getPointerTy();
> +  bool isPPC64 = PtrVT == MVT::i64;
> +
> +  MachineFunction &MF = DAG.getMachineFunction();
> +  MachineFrameInfo *MFI = MF.getFrameInfo();
> +  bool is31 = (NoFramePointerElim || MFI->hasVarSizedObjects())
> +                  && MFI->getStackSize();

Please put a comment above this logic.  Are you sure you shouldn't  
just call hasFP() ?  That would be much cleaner.

-Chris

> +  if (isPPC64)
> +    return DAG.getCopyFromReg(DAG.getEntryNode(), is31 ?  
> PPC::X31 : PPC::X1,
> +      MVT::i32);
> +  else
> +    return DAG.getCopyFromReg(DAG.getEntryNode(), is31 ?  
> PPC::R31 : PPC::R1,
> +      MVT::i32);
> +}
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list