Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //===- llvm/CodeGen/Spiller.h - Spiller -------------------------*- 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_SPILLER_H
0010 #define LLVM_CODEGEN_SPILLER_H
0011 
0012 #include "llvm/ADT/ArrayRef.h"
0013 #include "llvm/CodeGen/Register.h"
0014 
0015 namespace llvm {
0016 
0017 class LiveRangeEdit;
0018 class MachineFunction;
0019 class MachineFunctionPass;
0020 class VirtRegMap;
0021 class VirtRegAuxInfo;
0022 class LiveIntervals;
0023 class LiveStacks;
0024 class MachineDominatorTree;
0025 class MachineBlockFrequencyInfo;
0026 
0027 /// Spiller interface.
0028 ///
0029 /// Implementations are utility classes which insert spill or remat code on
0030 /// demand.
0031 class Spiller {
0032   virtual void anchor();
0033 
0034 public:
0035   virtual ~Spiller() = 0;
0036 
0037   /// spill - Spill the LRE.getParent() live interval.
0038   virtual void spill(LiveRangeEdit &LRE) = 0;
0039 
0040   /// Return the registers that were spilled.
0041   virtual ArrayRef<Register> getSpilledRegs() = 0;
0042 
0043   /// Return registers that were not spilled, but otherwise replaced
0044   /// (e.g. rematerialized).
0045   virtual ArrayRef<Register> getReplacedRegs() = 0;
0046 
0047   virtual void postOptimization() {}
0048 
0049   struct RequiredAnalyses {
0050     LiveIntervals &LIS;
0051     LiveStacks &LSS;
0052     MachineDominatorTree &MDT;
0053     const MachineBlockFrequencyInfo &MBFI;
0054   };
0055 };
0056 
0057 /// Create and return a spiller that will insert spill code directly instead
0058 /// of deferring though VirtRegMap.
0059 Spiller *createInlineSpiller(const Spiller::RequiredAnalyses &Analyses,
0060                              MachineFunction &MF, VirtRegMap &VRM,
0061                              VirtRegAuxInfo &VRAI);
0062 
0063 } // end namespace llvm
0064 
0065 #endif // LLVM_CODEGEN_SPILLER_H