blob: 0742cc1d8d8d761cffe3b7ce76e68149d280e935 [file] [log] [blame]
Jim Stichnothd97c7df2014-06-04 11:57:08 -07001//===- subzero/src/IceRegAlloc.h - Linear-scan reg. allocation --*- C++ -*-===//
2//
3// The Subzero Code Generator
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
Jim Stichnoth5ce0abb2014-10-15 10:16:54 -070010// This file declares the LinearScan data structure used during
11// linear-scan register allocation, which holds the various work
12// queues for the linear-scan algorithm.
Jim Stichnothd97c7df2014-06-04 11:57:08 -070013//
14//===----------------------------------------------------------------------===//
15
16#ifndef SUBZERO_SRC_ICEREGALLOC_H
17#define SUBZERO_SRC_ICEREGALLOC_H
18
19#include "IceDefs.h"
20#include "IceTypes.h"
21
22namespace Ice {
23
Jim Stichnothd97c7df2014-06-04 11:57:08 -070024class LinearScan {
Jim Stichnoth5ce0abb2014-10-15 10:16:54 -070025 LinearScan(const LinearScan &) = delete;
26 LinearScan &operator=(const LinearScan &) = delete;
27
Jim Stichnothd97c7df2014-06-04 11:57:08 -070028public:
29 LinearScan(Cfg *Func) : Func(Func) {}
30 void scan(const llvm::SmallBitVector &RegMask);
31 void dump(Cfg *Func) const;
32
33private:
34 Cfg *const Func;
Jim Stichnoth5ce0abb2014-10-15 10:16:54 -070035 typedef std::vector<Variable *> OrderedRanges;
36 typedef std::list<Variable *> UnorderedRanges;
Jim Stichnothd97c7df2014-06-04 11:57:08 -070037 OrderedRanges Unhandled;
Jim Stichnoth541ba662014-10-02 12:58:21 -070038 // UnhandledPrecolored is a subset of Unhandled, specially collected
39 // for faster processing.
40 OrderedRanges UnhandledPrecolored;
Jim Stichnothd97c7df2014-06-04 11:57:08 -070041 UnorderedRanges Active, Inactive, Handled;
Jim Stichnothd97c7df2014-06-04 11:57:08 -070042};
43
44} // end of namespace Ice
45
46#endif // SUBZERO_SRC_ICEREGALLOC_H