blob: 3d5172a9d06c3f97e7eb51bfc497e70b9389256b [file] [log] [blame]
Lang Hamese2b201b2009-05-18 19:03:16 +00001//===-- 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
Lang Hames835ca072009-11-19 04:15:33 +000013#include "llvm/ADT/SmallVector.h"
Lang Hamese2b201b2009-05-18 19:03:16 +000014#include <vector>
15
16namespace llvm {
Lang Hames10382fb2009-06-19 02:17:53 +000017
Daniel Dunbarcfb8a1b2009-07-19 01:38:38 +000018 class LiveInterval;
Bill Wendlingcd35ed52009-05-19 17:52:31 +000019 class MachineFunction;
Jakob Stoklund Olesenf2c6e362010-07-20 23:50:15 +000020 class MachineFunctionPass;
Lang Hames61945692009-12-09 05:39:12 +000021 class SlotIndex;
Lang Hames10382fb2009-06-19 02:17:53 +000022 class VirtRegMap;
Lang Hamese2b201b2009-05-18 19:03:16 +000023
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;
Lang Hames857c4e02009-06-17 21:01:20 +000031
Jakob Stoklund Olesen67674e22010-06-24 20:54:29 +000032 /// 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.
Jakob Stoklund Olesen9e55afb2010-06-30 23:03:52 +000036 /// @param spillIs A list of intervals that are about to be spilled,
37 /// and so cannot be used for remat etc.
Jakob Stoklund Olesen67674e22010-06-24 20:54:29 +000038 /// @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;
Lang Hames857c4e02009-06-17 21:01:20 +000045
Lang Hamese2b201b2009-05-18 19:03:16 +000046 };
47
48 /// Create and return a spiller object, as specified on the command line.
Jakob Stoklund Olesenf2c6e362010-07-20 23:50:15 +000049 Spiller* createSpiller(MachineFunctionPass &pass,
50 MachineFunction &mf,
51 VirtRegMap &vrm);
Lang Hamese2b201b2009-05-18 19:03:16 +000052}
53
54#endif