Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:31

0001 //=- MachineLoopUtils.h - Helper functions for manipulating loops -*- C++ -*-=//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_CODEGEN_MACHINELOOPUTILS_H
0010 #define LLVM_CODEGEN_MACHINELOOPUTILS_H
0011 
0012 namespace llvm {
0013 class MachineBasicBlock;
0014 class MachineRegisterInfo;
0015 class TargetInstrInfo;
0016 
0017 enum LoopPeelDirection {
0018   LPD_Front, ///< Peel the first iteration of the loop.
0019   LPD_Back   ///< Peel the last iteration of the loop.
0020 };
0021 
0022 /// Peels a single block loop. Loop must have two successors, one of which
0023 /// must be itself. Similarly it must have two predecessors, one of which must
0024 /// be itself.
0025 ///
0026 /// The loop block is copied and inserted into the CFG such that two copies of
0027 /// the loop follow on from each other. The copy is inserted either before or
0028 /// after the loop based on Direction.
0029 ///
0030 /// Phis are updated and an unconditional branch inserted at the end of the
0031 /// clone so as to execute a single iteration.
0032 ///
0033 /// The trip count of Loop is not updated.
0034 MachineBasicBlock *PeelSingleBlockLoop(LoopPeelDirection Direction,
0035                                        MachineBasicBlock *Loop,
0036                                        MachineRegisterInfo &MRI,
0037                                        const TargetInstrInfo *TII);
0038 
0039 } // namespace llvm
0040 
0041 #endif // LLVM_CODEGEN_MACHINELOOPUTILS_H