blob: b907f21db850845df0c36976e2d30171bab4b5a2 [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 LiveIntervals;
Lang Hamesf41538d2009-06-02 16:53:25 +000020 class LiveStacks;
Bill Wendlingcd35ed52009-05-19 17:52:31 +000021 class MachineFunction;
Lang Hames857c4e02009-06-17 21:01:20 +000022 class MachineInstr;
Lang Hames835ca072009-11-19 04:15:33 +000023 class MachineLoopInfo;
Lang Hames61945692009-12-09 05:39:12 +000024 class SlotIndex;
Lang Hames10382fb2009-06-19 02:17:53 +000025 class VirtRegMap;
26 class VNInfo;
Lang Hamese2b201b2009-05-18 19:03:16 +000027
28 /// Spiller interface.
29 ///
30 /// Implementations are utility classes which insert spill or remat code on
31 /// demand.
32 class Spiller {
33 public:
34 virtual ~Spiller() = 0;
Lang Hames857c4e02009-06-17 21:01:20 +000035
Jakob Stoklund Olesen67674e22010-06-24 20:54:29 +000036 /// spill - Spill the given live interval. The method used will depend on
37 /// the Spiller implementation selected.
38 ///
39 /// @param li The live interval to be spilled.
Jakob Stoklund Olesen9e55afb2010-06-30 23:03:52 +000040 /// @param spillIs A list of intervals that are about to be spilled,
41 /// and so cannot be used for remat etc.
Jakob Stoklund Olesen67674e22010-06-24 20:54:29 +000042 /// @param newIntervals The newly created intervals will be appended here.
43 /// @param earliestIndex The earliest point for splitting. (OK, it's another
44 /// pointer to the allocator guts).
45 virtual void spill(LiveInterval *li,
46 std::vector<LiveInterval*> &newIntervals,
47 SmallVectorImpl<LiveInterval*> &spillIs,
48 SlotIndex *earliestIndex = 0) = 0;
Lang Hames857c4e02009-06-17 21:01:20 +000049
Lang Hamese2b201b2009-05-18 19:03:16 +000050 };
51
52 /// Create and return a spiller object, as specified on the command line.
Bill Wendling0bde89e2009-05-19 17:51:26 +000053 Spiller* createSpiller(MachineFunction *mf, LiveIntervals *li,
Jakob Stoklund Olesen9529a1c2010-07-19 18:41:20 +000054 MachineLoopInfo *loopInfo, VirtRegMap *vrm);
Lang Hamese2b201b2009-05-18 19:03:16 +000055}
56
57#endif