//===- llvm/CodeGen/ScheduleDAG.h - Common Base Class -----------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // /// \file Implements the ScheduleDAG class, which is used as the common base /// class for instruction schedulers. This encapsulates the scheduling DAG, /// which is shared between SelectionDAG and MachineInstr scheduling. // //===----------------------------------------------------------------------===// #ifndef LLVM_CODEGEN_SCHEDULEDAG_H #define LLVM_CODEGEN_SCHEDULEDAG_H #include "llvm/ADT/BitVector.h" #include "llvm/ADT/PointerIntPair.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/iterator.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/TargetLowering.h" #include "llvm/Support/ErrorHandling.h" #include <cassert> #include <cstddef> #include <iterator> #include <string> #include <vector> namespace llvm { template <class GraphType> struct GraphTraits; template<class Graph> class GraphWriter; class LLVMTargetMachine; class MachineFunction; class MachineRegisterInfo; class MCInstrDesc; struct MCSchedClassDesc; class SDNode; class SUnit; class ScheduleDAG; class TargetInstrInfo; class TargetRegisterClass; class TargetRegisterInfo; /// Scheduling dependency. This represents one direction of an edge in the /// scheduling DAG. class SDep { … }; /// Scheduling unit. This is a node in the scheduling DAG. class SUnit { … }; /// Returns true if the specified SDep is equivalent except for latency. inline bool SDep::overlaps(const SDep &Other) const { … } //// Returns the SUnit to which this edge points. inline SUnit *SDep::getSUnit() const { … } //// Assigns the SUnit to which this edge points. inline void SDep::setSUnit(SUnit *SU) { … } /// Returns an enum value representing the kind of the dependence. inline SDep::Kind SDep::getKind() const { … } //===--------------------------------------------------------------------===// /// This interface is used to plug different priorities computation /// algorithms into the list scheduler. It implements the interface of a /// standard priority queue, where nodes are inserted in arbitrary order and /// returned in priority order. The computation of the priority and the /// representation of the queue are totally up to the implementation to /// decide. class SchedulingPriorityQueue { … }; class ScheduleDAG { … }; class SUnitIterator { … }; template <> struct GraphTraits<SUnit*> { … }; template <> struct GraphTraits<ScheduleDAG*> : public GraphTraits<SUnit*> { … }; /// This class can compute a topological ordering for SUnits and provides /// methods for dynamically updating the ordering as new edges are added. /// /// This allows a very fast implementation of IsReachable, for example. class ScheduleDAGTopologicalSort { … }; } // end namespace llvm #endif // LLVM_CODEGEN_SCHEDULEDAG_H