blob: 92f092a0da58760673b0cb2676ef79157f6cdab4 [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 Hamese2b201b2009-05-18 19:03:16 +000013namespace llvm {
Lang Hames10382fb2009-06-19 02:17:53 +000014
Daniel Dunbarcfb8a1b2009-07-19 01:38:38 +000015 class LiveInterval;
Bill Wendlingcd35ed52009-05-19 17:52:31 +000016 class MachineFunction;
Jakob Stoklund Olesenf2c6e362010-07-20 23:50:15 +000017 class MachineFunctionPass;
Lang Hames61945692009-12-09 05:39:12 +000018 class SlotIndex;
Jakob Stoklund Olesend3b48952010-10-25 17:27:30 +000019 template <typename T> class SmallVectorImpl;
Lang Hames10382fb2009-06-19 02:17:53 +000020 class VirtRegMap;
Lang Hamese2b201b2009-05-18 19:03:16 +000021
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;
Lang Hames857c4e02009-06-17 21:01:20 +000029
Jakob Stoklund Olesen67674e22010-06-24 20:54:29 +000030 /// 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.
Jakob Stoklund Olesen9e55afb2010-06-30 23:03:52 +000034 /// @param spillIs A list of intervals that are about to be spilled,
35 /// and so cannot be used for remat etc.
Jakob Stoklund Olesen67674e22010-06-24 20:54:29 +000036 /// @param newIntervals The newly created intervals will be appended here.
Jakob Stoklund Olesen67674e22010-06-24 20:54:29 +000037 virtual void spill(LiveInterval *li,
Jakob Stoklund Olesen0a2b2a12010-08-13 22:56:53 +000038 SmallVectorImpl<LiveInterval*> &newIntervals,
Andrew Trickf4baeaf2010-11-10 19:18:47 +000039 const SmallVectorImpl<LiveInterval*> &spillIs) = 0;
Lang Hames857c4e02009-06-17 21:01:20 +000040
Lang Hamese2b201b2009-05-18 19:03:16 +000041 };
42
43 /// Create and return a spiller object, as specified on the command line.
Jakob Stoklund Olesenf2c6e362010-07-20 23:50:15 +000044 Spiller* createSpiller(MachineFunctionPass &pass,
45 MachineFunction &mf,
46 VirtRegMap &vrm);
Lang Hamese2b201b2009-05-18 19:03:16 +000047}
48
49#endif