SchedulerRegistry.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- llvm/CodeGen/SchedulerRegistry.h -------------------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // This file contains the implementation for instruction scheduler function
  15. // pass registry (RegisterScheduler).
  16. //
  17. //===----------------------------------------------------------------------===//
  18. #ifndef LLVM_CODEGEN_SCHEDULERREGISTRY_H
  19. #define LLVM_CODEGEN_SCHEDULERREGISTRY_H
  20. #include "llvm/CodeGen/MachinePassRegistry.h"
  21. #include "llvm/Support/CodeGen.h"
  22. namespace llvm {
  23. //===----------------------------------------------------------------------===//
  24. ///
  25. /// RegisterScheduler class - Track the registration of instruction schedulers.
  26. ///
  27. //===----------------------------------------------------------------------===//
  28. class ScheduleDAGSDNodes;
  29. class SelectionDAGISel;
  30. class RegisterScheduler
  31. : public MachinePassRegistryNode<
  32. ScheduleDAGSDNodes *(*)(SelectionDAGISel *, CodeGenOpt::Level)> {
  33. public:
  34. using FunctionPassCtor = ScheduleDAGSDNodes *(*)(SelectionDAGISel*,
  35. CodeGenOpt::Level);
  36. static MachinePassRegistry<FunctionPassCtor> Registry;
  37. RegisterScheduler(const char *N, const char *D, FunctionPassCtor C)
  38. : MachinePassRegistryNode(N, D, C) {
  39. Registry.Add(this);
  40. }
  41. ~RegisterScheduler() { Registry.Remove(this); }
  42. // Accessors.
  43. RegisterScheduler *getNext() const {
  44. return (RegisterScheduler *)MachinePassRegistryNode::getNext();
  45. }
  46. static RegisterScheduler *getList() {
  47. return (RegisterScheduler *)Registry.getList();
  48. }
  49. static void setListener(MachinePassRegistryListener<FunctionPassCtor> *L) {
  50. Registry.setListener(L);
  51. }
  52. };
  53. /// createBURRListDAGScheduler - This creates a bottom up register usage
  54. /// reduction list scheduler.
  55. ScheduleDAGSDNodes *createBURRListDAGScheduler(SelectionDAGISel *IS,
  56. CodeGenOpt::Level OptLevel);
  57. /// createBURRListDAGScheduler - This creates a bottom up list scheduler that
  58. /// schedules nodes in source code order when possible.
  59. ScheduleDAGSDNodes *createSourceListDAGScheduler(SelectionDAGISel *IS,
  60. CodeGenOpt::Level OptLevel);
  61. /// createHybridListDAGScheduler - This creates a bottom up register pressure
  62. /// aware list scheduler that make use of latency information to avoid stalls
  63. /// for long latency instructions in low register pressure mode. In high
  64. /// register pressure mode it schedules to reduce register pressure.
  65. ScheduleDAGSDNodes *createHybridListDAGScheduler(SelectionDAGISel *IS,
  66. CodeGenOpt::Level);
  67. /// createILPListDAGScheduler - This creates a bottom up register pressure
  68. /// aware list scheduler that tries to increase instruction level parallelism
  69. /// in low register pressure mode. In high register pressure mode it schedules
  70. /// to reduce register pressure.
  71. ScheduleDAGSDNodes *createILPListDAGScheduler(SelectionDAGISel *IS,
  72. CodeGenOpt::Level);
  73. /// createFastDAGScheduler - This creates a "fast" scheduler.
  74. ///
  75. ScheduleDAGSDNodes *createFastDAGScheduler(SelectionDAGISel *IS,
  76. CodeGenOpt::Level OptLevel);
  77. /// createVLIWDAGScheduler - Scheduler for VLIW targets. This creates top down
  78. /// DFA driven list scheduler with clustering heuristic to control
  79. /// register pressure.
  80. ScheduleDAGSDNodes *createVLIWDAGScheduler(SelectionDAGISel *IS,
  81. CodeGenOpt::Level OptLevel);
  82. /// createDefaultScheduler - This creates an instruction scheduler appropriate
  83. /// for the target.
  84. ScheduleDAGSDNodes *createDefaultScheduler(SelectionDAGISel *IS,
  85. CodeGenOpt::Level OptLevel);
  86. /// createDAGLinearizer - This creates a "no-scheduling" scheduler which
  87. /// linearize the DAG using topological order.
  88. ScheduleDAGSDNodes *createDAGLinearizer(SelectionDAGISel *IS,
  89. CodeGenOpt::Level OptLevel);
  90. } // end namespace llvm
  91. #endif // LLVM_CODEGEN_SCHEDULERREGISTRY_H
  92. #ifdef __GNUC__
  93. #pragma GCC diagnostic pop
  94. #endif