blob: 66dabf78f87335bb536baf656d291cfed0de5e77 [file] [log] [blame]
Eugene Zelenko900b6332017-08-29 22:32:07 +00001//===- llvm/CodeGen/Spiller.h - Spiller -------------------------*- C++ -*-===//
Lang Hamescf47d012009-05-18 19:03:16 +00002//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Lang Hamescf47d012009-05-18 19:03:16 +00006//
7//===----------------------------------------------------------------------===//
8
Benjamin Kramera7c40ef2014-08-13 16:26:38 +00009#ifndef LLVM_LIB_CODEGEN_SPILLER_H
10#define LLVM_LIB_CODEGEN_SPILLER_H
Lang Hamescf47d012009-05-18 19:03:16 +000011
Lang Hamescf47d012009-05-18 19:03:16 +000012namespace llvm {
Lang Hames6b2c9602009-06-19 02:17:53 +000013
Eugene Zelenko900b6332017-08-29 22:32:07 +000014class LiveRangeEdit;
15class MachineFunction;
16class MachineFunctionPass;
17class VirtRegMap;
Lang Hamescf47d012009-05-18 19:03:16 +000018
19 /// Spiller interface.
20 ///
21 /// Implementations are utility classes which insert spill or remat code on
22 /// demand.
23 class Spiller {
David Blaikiea379b1812011-12-20 02:50:00 +000024 virtual void anchor();
Eugene Zelenko900b6332017-08-29 22:32:07 +000025
Lang Hamescf47d012009-05-18 19:03:16 +000026 public:
27 virtual ~Spiller() = 0;
Lang Hames16cab192009-06-17 21:01:20 +000028
Jakob Stoklund Olesen4d6eafa2011-03-10 01:51:42 +000029 /// spill - Spill the LRE.getParent() live interval.
30 virtual void spill(LiveRangeEdit &LRE) = 0;
Eugene Zelenko900b6332017-08-29 22:32:07 +000031
32 virtual void postOptimization() {}
Lang Hamescf47d012009-05-18 19:03:16 +000033 };
34
Jakob Stoklund Olesenadecb5e2010-12-10 22:54:44 +000035 /// Create and return a spiller that will insert spill code directly instead
36 /// of deferring though VirtRegMap.
37 Spiller *createInlineSpiller(MachineFunctionPass &pass,
38 MachineFunction &mf,
39 VirtRegMap &vrm);
Lang Hamescf47d012009-05-18 19:03:16 +000040
Eugene Zelenko900b6332017-08-29 22:32:07 +000041} // end namespace llvm
42
43#endif // LLVM_LIB_CODEGEN_SPILLER_H