Spiller.h revision 218893
1//===-- llvm/CodeGen/Spiller.h - Spiller -*- C++ -*------------------------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef LLVM_CODEGEN_SPILLER_H
11#define LLVM_CODEGEN_SPILLER_H
12
13namespace llvm {
14
15  class LiveInterval;
16  class MachineFunction;
17  class MachineFunctionPass;
18  class SlotIndex;
19  template <typename T> class SmallVectorImpl;
20  class VirtRegMap;
21
22  /// Spiller interface.
23  ///
24  /// Implementations are utility classes which insert spill or remat code on
25  /// demand.
26  class Spiller {
27  public:
28    virtual ~Spiller() = 0;
29
30    /// spill - Spill the given live interval. The method used will depend on
31    /// the Spiller implementation selected.
32    ///
33    /// @param li            The live interval to be spilled.
34    /// @param spillIs       A list of intervals that are about to be spilled,
35    ///                      and so cannot be used for remat etc.
36    /// @param newIntervals  The newly created intervals will be appended here.
37    virtual void spill(LiveInterval *li,
38                       SmallVectorImpl<LiveInterval*> &newIntervals,
39                       const SmallVectorImpl<LiveInterval*> &spillIs) = 0;
40
41  };
42
43  /// Create and return a spiller object, as specified on the command line.
44  Spiller* createSpiller(MachineFunctionPass &pass,
45                         MachineFunction &mf,
46                         VirtRegMap &vrm);
47
48  /// Create and return a spiller that will insert spill code directly instead
49  /// of deferring though VirtRegMap.
50  Spiller *createInlineSpiller(MachineFunctionPass &pass,
51                               MachineFunction &mf,
52                               VirtRegMap &vrm);
53
54}
55
56#endif
57