MachineLoopUtils.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //=- MachineLoopUtils.h - Helper functions for manipulating loops -*- 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. #ifndef LLVM_CODEGEN_MACHINELOOPUTILS_H
  14. #define LLVM_CODEGEN_MACHINELOOPUTILS_H
  15. namespace llvm {
  16. class MachineBasicBlock;
  17. class MachineRegisterInfo;
  18. class TargetInstrInfo;
  19. enum LoopPeelDirection {
  20. LPD_Front, ///< Peel the first iteration of the loop.
  21. LPD_Back ///< Peel the last iteration of the loop.
  22. };
  23. /// Peels a single block loop. Loop must have two successors, one of which
  24. /// must be itself. Similarly it must have two predecessors, one of which must
  25. /// be itself.
  26. ///
  27. /// The loop block is copied and inserted into the CFG such that two copies of
  28. /// the loop follow on from each other. The copy is inserted either before or
  29. /// after the loop based on Direction.
  30. ///
  31. /// Phis are updated and an unconditional branch inserted at the end of the
  32. /// clone so as to execute a single iteration.
  33. ///
  34. /// The trip count of Loop is not updated.
  35. MachineBasicBlock *PeelSingleBlockLoop(LoopPeelDirection Direction,
  36. MachineBasicBlock *Loop,
  37. MachineRegisterInfo &MRI,
  38. const TargetInstrInfo *TII);
  39. } // namespace llvm
  40. #endif // LLVM_CODEGEN_MACHINELOOPUTILS_H
  41. #ifdef __GNUC__
  42. #pragma GCC diagnostic pop
  43. #endif