Skip to content

Improve/cleanup RyuJIT's IR handling of operand lists #11058

@mikedn

Description

@mikedn

Some IR nodes require a variable number of operands and the current implementation uses linked lists of GT_LIST (or similar) nodes.

IR nodes knows to use such lists:

  • GT_CALL - has a dedicated this argument operand and a list of operands for all other arguments
  • GT_PHI - this is a GTK_UNOP node and its sole operand is a list
  • GT_HWINTRINSIC - this is a GTK_BINOP node but if needs 3 operands or more the first operand is a list and the second is null
  • GT_FIELD_LIST - a GTK_BINOP that acts both like an actual IR node or like a list node
  • Anything else?

From the above only GT_CALL is reasonable, though it could probably be improved as well. The rest suffer from various issues:

  • GT_PHI - this looks similar to GT_CALL on the surface but it lacks the special handling of calls throughout the JIT. Its list nodes end up in the linear order and they are visited by tree walking facilities like GenTreeVisitor. This is nonsense - these list nodes are an internal implementation detail of the GT_PHI node and they should not appear anywhere. They have no type, no VN, no nothing. They simply do not exists as far as the IR is concerned.
  • GT_HWINTRINSIC suffers from the same problem as GT_PHI. It just makes it worse by sometimes using lists and sometimes not. And unlike GT_PHI, this lacks special handling in gtDispTree and dumps its list nodes.
  • GT_FIELD_LIST IMO it would be better have a GT_PACK node with a list of GT_FIELD_LIST nodes.

category:implementation
theme:ir
skill-level:expert
cost:extra-large

Metadata

Metadata

Assignees

No one assigned

    Labels

    JitUntriagedCLR JIT issues needing additional triagearea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIenhancementProduct code improvement that does NOT require public API changes/additions

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions