mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-17 12:36:09 +00:00

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
30 lines
1.2 KiB
C++
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()) {}
|