[llvm-commits] [llvm] r72325 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Eli Friedman
eli.friedman at gmail.com
Sun May 24 13:38:25 PDT 2009
On Sun, May 24, 2009 at 1:00 PM, Duncan Sands <baldrick at free.fr> wrote:
> 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...
Possibly; I took the current approach from the DAG legalizer. Taking
a quick look, the type legalizer's logic to deal with nodes being
inserted during legalization seems complicated enough that I wouldn't
want to duplicate it... perhaps some sort of general legalizer base
class would be appropriate?
>> +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?
I added a comment in r72374.
-Eli
More information about the llvm-commits
mailing list