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 LiveIntervals; |
Lang Hames | f41538d | 2009-06-02 16:53:25 +0000 | [diff] [blame] | 20 | class LiveStacks; |
Bill Wendling | cd35ed5 | 2009-05-19 17:52:31 +0000 | [diff] [blame] | 21 | class MachineFunction; |
Lang Hames | 857c4e0 | 2009-06-17 21:01:20 +0000 | [diff] [blame] | 22 | class MachineInstr; |
Lang Hames | 835ca07 | 2009-11-19 04:15:33 +0000 | [diff] [blame] | 23 | class MachineLoopInfo; |
Lang Hames | 6194569 | 2009-12-09 05:39:12 +0000 | [diff] [blame] | 24 | class SlotIndex; |
Lang Hames | 10382fb | 2009-06-19 02:17:53 +0000 | [diff] [blame] | 25 | class VirtRegMap; |
| 26 | class VNInfo; |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 27 | |
| 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 Hames | 857c4e0 | 2009-06-17 21:01:20 +0000 | [diff] [blame] | 35 | |
| 36 | /// Spill the given live range. The method used will depend on the Spiller |
| 37 | /// implementation selected. |
Lang Hames | 835ca07 | 2009-11-19 04:15:33 +0000 | [diff] [blame] | 38 | virtual std::vector<LiveInterval*> spill(LiveInterval *li, |
Lang Hames | 6194569 | 2009-12-09 05:39:12 +0000 | [diff] [blame] | 39 | SmallVectorImpl<LiveInterval*> &spillIs, |
| 40 | SlotIndex *earliestIndex = 0) = 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. |
Bill Wendling | 0bde89e | 2009-05-19 17:51:26 +0000 | [diff] [blame] | 45 | Spiller* createSpiller(MachineFunction *mf, LiveIntervals *li, |
Lang Hames | 8783e40 | 2009-11-20 00:53:30 +0000 | [diff] [blame] | 46 | const MachineLoopInfo *loopInfo, VirtRegMap *vrm); |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | #endif |