Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //===- MachineCycleAnalysis.h - Cycle Info for Machine IR -------*- 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 // This file defines the MachineCycleInfo class, which is a thin wrapper over
0010 // the Machine IR instance of GenericCycleInfo.
0011 //
0012 //===----------------------------------------------------------------------===//
0013 
0014 #ifndef LLVM_CODEGEN_MACHINECYCLEANALYSIS_H
0015 #define LLVM_CODEGEN_MACHINECYCLEANALYSIS_H
0016 
0017 #include "llvm/ADT/GenericCycleInfo.h"
0018 #include "llvm/CodeGen/MachineFunctionPass.h"
0019 #include "llvm/CodeGen/MachineSSAContext.h"
0020 
0021 namespace llvm {
0022 
0023 using MachineCycleInfo = GenericCycleInfo<MachineSSAContext>;
0024 using MachineCycle = MachineCycleInfo::CycleT;
0025 
0026 /// Legacy analysis pass which computes a \ref MachineCycleInfo.
0027 class MachineCycleInfoWrapperPass : public MachineFunctionPass {
0028   MachineFunction *F = nullptr;
0029   MachineCycleInfo CI;
0030 
0031 public:
0032   static char ID;
0033 
0034   MachineCycleInfoWrapperPass();
0035 
0036   MachineCycleInfo &getCycleInfo() { return CI; }
0037   const MachineCycleInfo &getCycleInfo() const { return CI; }
0038 
0039   bool runOnMachineFunction(MachineFunction &F) override;
0040   void getAnalysisUsage(AnalysisUsage &AU) const override;
0041   void releaseMemory() override;
0042   void print(raw_ostream &OS, const Module *M = nullptr) const override;
0043 };
0044 
0045 // TODO: add this function to GenericCycle template after implementing IR
0046 //       version.
0047 bool isCycleInvariant(const MachineCycle *Cycle, MachineInstr &I);
0048 
0049 } // end namespace llvm
0050 
0051 #endif // LLVM_CODEGEN_MACHINECYCLEANALYSIS_H