llvm/llvm/include/llvm/CodeGen/MachineInstrBundleIterator.h

//===- llvm/CodeGen/MachineInstrBundleIterator.h ----------------*- 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
//
//===----------------------------------------------------------------------===//
//
// Defines an iterator class that bundles MachineInstr.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CODEGEN_MACHINEINSTRBUNDLEITERATOR_H
#define LLVM_CODEGEN_MACHINEINSTRBUNDLEITERATOR_H

#include "llvm/ADT/ilist.h"
#include "llvm/ADT/simple_ilist.h"
#include <cassert>
#include <iterator>
#include <type_traits>

namespace llvm {

template <class T, bool IsReverse> struct MachineInstrBundleIteratorTraits;
MachineInstrBundleIteratorTraits<T, false>;
MachineInstrBundleIteratorTraits<T, true>;
MachineInstrBundleIteratorTraits<const T, false>;
MachineInstrBundleIteratorTraits<const T, true>;

template <bool IsReverse> struct MachineInstrBundleIteratorHelper;
template <> struct MachineInstrBundleIteratorHelper<false> {};

template <> struct MachineInstrBundleIteratorHelper<true> {};

/// MachineBasicBlock iterator that automatically skips over MIs that are
/// inside bundles (i.e. walk top level MIs only).
template <typename Ty, bool IsReverse = false>
class MachineInstrBundleIterator : MachineInstrBundleIteratorHelper<IsReverse> {};

} // end namespace llvm

#endif // LLVM_CODEGEN_MACHINEINSTRBUNDLEITERATOR_H