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 | |
| 15 | namespace llvm { |
Lang Hames | 10382fb | 2009-06-19 02:17:53 +0000 | [diff] [blame] | 16 | |
Daniel Dunbar | cfb8a1b | 2009-07-19 01:38:38 +0000 | [diff] [blame] | 17 | class LiveInterval; |
Bill Wendling | cd35ed5 | 2009-05-19 17:52:31 +0000 | [diff] [blame] | 18 | class MachineFunction; |
Jakob Stoklund Olesen | f2c6e36 | 2010-07-20 23:50:15 +0000 | [diff] [blame] | 19 | class MachineFunctionPass; |
Lang Hames | 6194569 | 2009-12-09 05:39:12 +0000 | [diff] [blame] | 20 | class SlotIndex; |
Lang Hames | 10382fb | 2009-06-19 02:17:53 +0000 | [diff] [blame] | 21 | class VirtRegMap; |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 22 | |
| 23 | /// Spiller interface. |
| 24 | /// |
| 25 | /// Implementations are utility classes which insert spill or remat code on |
| 26 | /// demand. |
| 27 | class Spiller { |
| 28 | public: |
| 29 | virtual ~Spiller() = 0; |
Lang Hames | 857c4e0 | 2009-06-17 21:01:20 +0000 | [diff] [blame] | 30 | |
Jakob Stoklund Olesen | 67674e2 | 2010-06-24 20:54:29 +0000 | [diff] [blame] | 31 | /// spill - Spill the given live interval. The method used will depend on |
| 32 | /// the Spiller implementation selected. |
| 33 | /// |
| 34 | /// @param li The live interval to be spilled. |
Jakob Stoklund Olesen | 9e55afb | 2010-06-30 23:03:52 +0000 | [diff] [blame] | 35 | /// @param spillIs A list of intervals that are about to be spilled, |
| 36 | /// and so cannot be used for remat etc. |
Jakob Stoklund Olesen | 67674e2 | 2010-06-24 20:54:29 +0000 | [diff] [blame] | 37 | /// @param newIntervals The newly created intervals will be appended here. |
Jakob Stoklund Olesen | 67674e2 | 2010-06-24 20:54:29 +0000 | [diff] [blame] | 38 | virtual void spill(LiveInterval *li, |
Jakob Stoklund Olesen | 0a2b2a1 | 2010-08-13 22:56:53 +0000 | [diff] [blame^] | 39 | SmallVectorImpl<LiveInterval*> &newIntervals, |
| 40 | SmallVectorImpl<LiveInterval*> &spillIs) = 0; |
Lang Hames | 857c4e0 | 2009-06-17 21:01:20 +0000 | [diff] [blame] | 41 | |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 42 | }; |
| 43 | |
| 44 | /// 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] | 45 | Spiller* createSpiller(MachineFunctionPass &pass, |
| 46 | MachineFunction &mf, |
| 47 | VirtRegMap &vrm); |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | #endif |