Legalize

References:

  • llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

    // llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
    
    
    
    /// This is the entry point for the file.
    void SelectionDAG::Legalize() {
    AssignTopologicalOrder();
    
    SmallPtrSet<SDNode *, 16> LegalizedNodes;
    ...
      
    SelectionDAGLegalize Legalizer(*this, LegalizedNodes);
    
    // Visit all the nodes. We start in topological order, so that we see
    // nodes with their original operands intact. Legalization can produce
    // new nodes which may themselves need to be legalized. Iterate until all
    // nodes have been legalized.
    while (true) {
    bool AnyLegalized = false;
    for (auto NI = allnodes_end(); NI != allnodes_begin();) {
      --NI;
        
      ;delete_node_with_no_use;
    
      if (LegalizedNodes.insert(N).second) {
        AnyLegalized = true;
        Legalizer.LegalizeOp(N);
            
        ;delete_node_with_no_use;
    
      }
    }
    if (!AnyLegalized)
      break;
    
    }
    
    // Remove dead nodes now.
    RemoveDeadNodes();
    }
    
Created Jul 25, 2020 // Last Updated Jul 26, 2020

If you could revise
the fundmental principles of
computer system design
to improve security...

... what would you change?