llvm-project/llvm/lib/CodeGen/RegAllocPriorityAdvisor.cpp
Eric Wang ad8eb85545 [NFC][MLGO] ML Regalloc Priority Advisor
This patch introduces the priority analysis and the priority advisor,
the default implementation, and the scaffolding for introducing the
other implementations of the advisor.

Reviewed By: mtrofin

Differential Revision: https://reviews.llvm.org/D131220
2022-08-18 15:33:48 -07:00

30 lines
1.2 KiB
C++

//===- RegAllocPriorityAdvisor.cpp - live ranges priority advisor ---------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// Implementation of the default priority advisor and of the Analysis pass.
//
//===----------------------------------------------------------------------===//
#include "RegAllocPriorityAdvisor.h"
#include "RegAllocGreedy.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/VirtRegMap.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
using namespace llvm;
RegAllocPriorityAdvisor::RegAllocPriorityAdvisor(const MachineFunction &MF,
const RAGreedy &RA)
: RA(RA), LIS(RA.getLiveIntervals()), VRM(RA.getVirtRegMap()),
MRI(&VRM->getRegInfo()), TRI(MF.getSubtarget().getRegisterInfo()),
RegClassInfo(RA.getRegClassInfo()), Indexes(RA.getIndexes()),
RegClassPriorityTrumpsGlobalness(
RA.getRegClassPriorityTrumpsGlobalness()),
ReverseLocalAssignment(RA.getReverseLocalAssignment()) {}