[LLVMdev] MBlaze select_cc lowering question.

JP jpbonn-keyword-llvm.7c175e at corniceresearch.com
Sun Aug 19 05:11:15 PDT 2012


Can someone explain how the condition code is passed from the 
MBlazeTargetLowering::LowerSELECT_CC to 
MBlazeTargetLowering::EmitCustomSelect custom inserter? In 
LowerSELECT_CC the condition code is never accessed (Op.GetOperand(4)) 
and I don't see how it ends up getting correctly passed to the 
MBlazeTargetLowering::EmitCustomSelect.

> SDValue MBlazeTargetLowering::LowerSELECT_CC(SDValue Op,
>                                              SelectionDAG &DAG) const {
>   SDValue LHS = Op.getOperand(0);
>   SDValue RHS = Op.getOperand(1);
>   SDValue TrueVal = Op.getOperand(2);
>   SDValue FalseVal = Op.getOperand(3);
>   DebugLoc dl = Op.getDebugLoc();
>   unsigned Opc;
>
>   SDValue CompareFlag;
>   if (LHS.getValueType() == MVT::i32) {
>     Opc = MBlazeISD::Select_CC;
>     CompareFlag = DAG.getNode(MBlazeISD::ICmp, dl, MVT::i32, LHS, RHS)
>                     .getValue(1);
>   } else {
>     llvm_unreachable("Cannot lower select_cc with unknown type");
>   }
>
>   return DAG.getNode(Opc, dl, TrueVal.getValueType(), TrueVal, FalseVal,
>                      CompareFlag);
> }



More information about the llvm-dev mailing list