Lying about being expanded?

Hi!

I noticed in the LegalizeDAG.cpp (SelectionDAGLegalize::LegalizeOp):

  case ISD::INIT_TRAMPOLINE:
  case ISD::FRAMEADDR:
  case ISD::RETURNADDR:
    // These operations lie about being legal: when they claim to be legal,
    // they should actually be custom-lowered.
    Action = TLI.getOperationAction(Node->getOpcode(),
Node->getValueType(0));
    if (Action == TargetLowering::Legal)
      Action = TargetLowering::Custom;
    break;

What does this mean? Why does a target not request a node to be
custom lowered if such a thing is needed?

Also, I grepped for 'setOperationAction(ISD::TRAMPOLINE' and the
operation is 'Custom' in every instance. Should ISD::TRAMPOLINE be
removed from this case?

Thanks!

Hi Sanjoy,

I noticed in the LegalizeDAG.cpp (SelectionDAGLegalize::LegalizeOp):

   case ISD::INIT_TRAMPOLINE:
   case ISD::FRAMEADDR:
   case ISD::RETURNADDR:
     // These operations lie about being legal: when they claim to be legal,
     // they should actually be custom-lowered.
     Action = TLI.getOperationAction(Node->getOpcode(),
Node->getValueType(0));
     if (Action == TargetLowering::Legal)
       Action = TargetLowering::Custom;
     break;

What does this mean? Why does a target not request a node to be
custom lowered if such a thing is needed?

as far as I know all nodes are considered to be legal by default. Thus I
guess the comment is confused: most likely some target forgot to declare
them as custom, and someone hacked this in rather than fixing the target.

Also, I grepped for 'setOperationAction(ISD::TRAMPOLINE' and the
operation is 'Custom' in every instance. Should ISD::TRAMPOLINE be
removed from this case?

Probably they should all be removed, and possibly some targets fixed to
declare them as Custom.

Ciao, Duncan.