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 | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 13 | namespace llvm { |
Lang Hames | 10382fb | 2009-06-19 02:17:53 +0000 | [diff] [blame] | 14 | |
Daniel Dunbar | cfb8a1b | 2009-07-19 01:38:38 +0000 | [diff] [blame] | 15 | class LiveInterval; |
Bill Wendling | cd35ed5 | 2009-05-19 17:52:31 +0000 | [diff] [blame] | 16 | class MachineFunction; |
Jakob Stoklund Olesen | f2c6e36 | 2010-07-20 23:50:15 +0000 | [diff] [blame] | 17 | class MachineFunctionPass; |
Lang Hames | 6194569 | 2009-12-09 05:39:12 +0000 | [diff] [blame] | 18 | class SlotIndex; |
Jakob Stoklund Olesen | d3b4895 | 2010-10-25 17:27:30 +0000 | [diff] [blame] | 19 | template <typename T> class SmallVectorImpl; |
Lang Hames | 10382fb | 2009-06-19 02:17:53 +0000 | [diff] [blame] | 20 | class VirtRegMap; |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 21 | |
| 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 Hames | 857c4e0 | 2009-06-17 21:01:20 +0000 | [diff] [blame] | 29 | |
Jakob Stoklund Olesen | 67674e2 | 2010-06-24 20:54:29 +0000 | [diff] [blame] | 30 | /// 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 Olesen | 9e55afb | 2010-06-30 23:03:52 +0000 | [diff] [blame] | 34 | /// @param spillIs A list of intervals that are about to be spilled, |
| 35 | /// and so cannot be used for remat etc. |
Jakob Stoklund Olesen | 67674e2 | 2010-06-24 20:54:29 +0000 | [diff] [blame] | 36 | /// @param newIntervals The newly created intervals will be appended here. |
Jakob Stoklund Olesen | 67674e2 | 2010-06-24 20:54:29 +0000 | [diff] [blame] | 37 | virtual void spill(LiveInterval *li, |
Jakob Stoklund Olesen | 0a2b2a1 | 2010-08-13 22:56:53 +0000 | [diff] [blame] | 38 | SmallVectorImpl<LiveInterval*> &newIntervals, |
Andrew Trick | f4baeaf | 2010-11-10 19:18:47 +0000 | [diff] [blame] | 39 | const SmallVectorImpl<LiveInterval*> &spillIs) = 0; |
Lang Hames | 857c4e0 | 2009-06-17 21:01:20 +0000 | [diff] [blame] | 40 | |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 41 | }; |
| 42 | |
| 43 | /// 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] | 44 | Spiller* createSpiller(MachineFunctionPass &pass, |
| 45 | MachineFunction &mf, |
| 46 | VirtRegMap &vrm); |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | #endif |