Spiller.h revision 1c2a730810e1039c1fcce2386a3e924a5efaddad
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
13#include "llvm/ADT/SmallVector.h"
14#include <vector>
15
16namespace llvm {
17
18  class LiveInterval;
19  class MachineFunction;
20  class MachineFunctionPass;
21  class SlotIndex;
22  class VirtRegMap;
23
24  /// Spiller interface.
25  ///
26  /// Implementations are utility classes which insert spill or remat code on
27  /// demand.
28  class Spiller {
29  public:
30    virtual ~Spiller() = 0;
31
32    /// spill - Spill the given live interval. The method used will depend on
33    /// the Spiller implementation selected.
34    ///
35    /// @param li            The live interval to be spilled.
36    /// @param spillIs       A list of intervals that are about to be spilled,
37    ///                      and so cannot be used for remat etc.
38    /// @param newIntervals  The newly created intervals will be appended here.
39    /// @param earliestIndex The earliest point for splitting. (OK, it's another
40    ///                      pointer to the allocator guts).
41    virtual void spill(LiveInterval *li,
42                       std::vector<LiveInterval*> &newIntervals,
43                       SmallVectorImpl<LiveInterval*> &spillIs,
44                       SlotIndex *earliestIndex = 0) = 0;
45
46  };
47
48  /// Create and return a spiller object, as specified on the command line.
49  Spiller* createSpiller(MachineFunctionPass &pass,
50                         MachineFunction &mf,
51                         VirtRegMap &vrm);
52}
53
54#endif
55