LLVM 22.0.0git
Spiller.h
Go to the documentation of this file.
1//===- llvm/CodeGen/Spiller.h - Spiller -------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_CODEGEN_SPILLER_H
10#define LLVM_CODEGEN_SPILLER_H
11
12#include "llvm/ADT/ArrayRef.h"
14
15namespace llvm {
16
17class LiveRangeEdit;
18class MachineFunction;
19class MachineFunctionPass;
20class VirtRegMap;
21class VirtRegAuxInfo;
22class LiveIntervals;
23class LiveRegMatrix;
24class LiveStacks;
25class MachineDominatorTree;
26class MachineBlockFrequencyInfo;
27class AllocationOrder;
28
29/// Spiller interface.
30///
31/// Implementations are utility classes which insert spill or remat code on
32/// demand.
33class Spiller {
34 virtual void anchor();
35
36public:
37 virtual ~Spiller() = 0;
38
39 /// spill - Spill the LRE.getParent() live interval.
40 virtual void spill(LiveRangeEdit &LRE, AllocationOrder *Order = nullptr) = 0;
41
42 /// Return the registers that were spilled.
44
45 /// Return registers that were not spilled, but otherwise replaced
46 /// (e.g. rematerialized).
48
49 virtual void postOptimization() {}
50
56 };
57};
58
59/// Create and return a spiller that will insert spill code directly instead
60/// of deferring though VirtRegMap.
63 VirtRegAuxInfo &VRAI,
64 LiveRegMatrix *Matrix = nullptr);
65
66} // end namespace llvm
67
68#endif // LLVM_CODEGEN_SPILLER_H
Live Register Matrix
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
Spiller interface.
Definition: Spiller.h:33
virtual ~Spiller()=0
virtual ArrayRef< Register > getReplacedRegs()=0
Return registers that were not spilled, but otherwise replaced (e.g.
virtual ArrayRef< Register > getSpilledRegs()=0
Return the registers that were spilled.
virtual void postOptimization()
Definition: Spiller.h:49
virtual void spill(LiveRangeEdit &LRE, AllocationOrder *Order=nullptr)=0
spill - Spill the LRE.getParent() live interval.
Calculate auxiliary information for a virtual register such as its spill weight and allocation hint.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
Spiller * createInlineSpiller(const Spiller::RequiredAnalyses &Analyses, MachineFunction &MF, VirtRegMap &VRM, VirtRegAuxInfo &VRAI, LiveRegMatrix *Matrix=nullptr)
Create and return a spiller that will insert spill code directly instead of deferring though VirtRegM...
const MachineBlockFrequencyInfo & MBFI
Definition: Spiller.h:55
MachineDominatorTree & MDT
Definition: Spiller.h:54