Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 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 | |
Lang Hames | 835ca07 | 2009-11-19 04:15:33 +0000 | [diff] [blame] | 13 | #include "llvm/ADT/SmallVector.h" |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 14 | #include <vector> |
| 15 | |
| 16 | namespace llvm { |
Lang Hames | 10382fb | 2009-06-19 02:17:53 +0000 | [diff] [blame] | 17 | |
Daniel Dunbar | cfb8a1b | 2009-07-19 01:38:38 +0000 | [diff] [blame] | 18 | class LiveInterval; |
Bill Wendling | cd35ed5 | 2009-05-19 17:52:31 +0000 | [diff] [blame] | 19 | class MachineFunction; |
Jakob Stoklund Olesen | f2c6e36 | 2010-07-20 23:50:15 +0000 | [diff] [blame] | 20 | class MachineFunctionPass; |
Lang Hames | 6194569 | 2009-12-09 05:39:12 +0000 | [diff] [blame] | 21 | class SlotIndex; |
Lang Hames | 10382fb | 2009-06-19 02:17:53 +0000 | [diff] [blame] | 22 | class VirtRegMap; |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 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; |
Lang Hames | 857c4e0 | 2009-06-17 21:01:20 +0000 | [diff] [blame] | 31 | |
Jakob Stoklund Olesen | 67674e2 | 2010-06-24 20:54:29 +0000 | [diff] [blame] | 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. |
Jakob Stoklund Olesen | 9e55afb | 2010-06-30 23:03:52 +0000 | [diff] [blame] | 36 | /// @param spillIs A list of intervals that are about to be spilled, |
| 37 | /// and so cannot be used for remat etc. |
Jakob Stoklund Olesen | 67674e2 | 2010-06-24 20:54:29 +0000 | [diff] [blame] | 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; |
Lang Hames | 857c4e0 | 2009-06-17 21:01:20 +0000 | [diff] [blame] | 45 | |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 46 | }; |
| 47 | |
| 48 | /// Create and return a spiller object, as specified on the command line. |
Jakob Stoklund Olesen | f2c6e36 | 2010-07-20 23:50:15 +0000 | [diff] [blame] | 49 | Spiller* createSpiller(MachineFunctionPass &pass, |
| 50 | MachineFunction &mf, |
| 51 | VirtRegMap &vrm); |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 52 | } |
| 53 | |
| 54 | #endif |