#include "liverange.hpp" // using std::transform; using namespace LRA; namespace RA { #define MAXR 32 struct ActiveCMP { bool operator()(LiveInterval const &lhs, LiveInterval const &rhs) const { if (lhs.first.j != rhs.first.j) return lhs.first.j < rhs.first.j; else return lhs.first.i < rhs.first.i; } }; class RegAllocator { public: RegAllocator(const uint R_) : R(R_), used{false} {} RegAllocator() = delete; // input set is sorted by increasing start point void LinearScan(set &liveints); void reset(); private: const uint R; bool used[MAXR]; map regmap; // sorted by increasing end point set active; void ExpireOldIntervals(LiveInterval); void SpillAtInterval(LiveInterval); }; } // namespace RA