[llvm-commits] [llvm] r72325 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Duncan Sands baldrick at free.fr
Sun May 24 13:00:10 PDT 2009


Hi Eli,

> +  // The legalize process is inherently a bottom-up recursive process (users
> +  // legalize their uses before themselves).

can you do this non-recursively?  The type legalizer is not recursive...

> +SDValue VectorLegalizer::PromoteVectorOp(SDValue Op) {
> +  MVT VT = Op.getValueType();
> +  assert(Op.getNode()->getNumValues() == 1 &&
> +         "Can't promote a vector with multiple results!");
> +  MVT NVT = TLI.getTypeToPromoteTo(Op.getOpcode(), VT);
> +  DebugLoc dl = Op.getDebugLoc();
> +  SmallVector<SDValue, 4> Operands(Op.getNumOperands());
> +
> +  for (unsigned j = 0; j != Op.getNumOperands(); ++j) {
> +    if (Op.getOperand(j).getValueType().isVector())
> +      Operands[j] = DAG.getNode(ISD::BIT_CONVERT, dl, NVT, Op.getOperand(j));
> +    else
> +      Operands[j] = Op.getOperand(j);
> +  }
> +
> +  Op = DAG.getNode(Op.getOpcode(), dl, NVT, &Operands[0], Operands.size());
> +
> +  return DAG.getNode(ISD::BIT_CONVERT, dl, VT, Op);
> +}

I don't understand what this routine is doing.  Got an example?

Ciao,

Duncan.



More information about the llvm-commits mailing list