Files
FEX-Emu--FEX/FEXCore/Source/Interface/IR/Passes/RegisterAllocationPass.h
T
Alyssa Rosenzweig af21b8f3c7 Move External/FEXCore/ to FEXCore/
It is not an external component, and it makes paths needlessly long.
Ryan seemed amenable to this when we discussed on IRC earlier.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
2023-08-17 16:32:16 -04:00

64 lines
2.0 KiB
C++

/*
$info$
tags: ir|opts
$end_info$
*/
#pragma once
#include "Interface/IR/PassManager.h"
#include <memory>
#include <stdint.h>
namespace FEXCore::IR {
class RegisterAllocationData;
struct RegisterAllocationDataDeleter;
struct RegisterClassType;
class RegisterAllocationPass : public FEXCore::IR::Pass {
public:
bool HasFullRA() const { return HadFullRA; }
virtual void AllocateRegisterSet(uint32_t ClassCount) = 0;
virtual void AddRegisters(FEXCore::IR::RegisterClassType Class, uint32_t RegisterCount) = 0;
/**
* @brief Adds a conflict between the two registers (and their respective classes) so if one is allocated then the other can not be allocated in
* the same live range.
*
* Conflict is added both directions, so only necessary to add a conflict one way
*
* ex:
* AddRegisters(GPRClass, 2); -> {x0, x1} added to register class GPR
* AddRegisters(PairClass, 1); -> {{x0, x1}} pair added to class GPR
* AddRegisterConflict(GPRClass, 0, PairClass, 0); -> Make sure the pair interferes with x0
* AddRegisterConflict(GPRClass, 1, PairClass, 1); -> Make sure the pair interferes with x1
*/
virtual void AddRegisterConflict(FEXCore::IR::RegisterClassType ClassConflict, uint32_t RegConflict, FEXCore::IR::RegisterClassType Class, uint32_t Reg) = 0;
/**
* @name Inference graph handling
* @{ */
/**
* @brief Returns the register and class map array
*/
virtual RegisterAllocationData *GetAllocationData() = 0;
/**
* @brief Returns and transfers ownership of the register and class map array
*/
virtual std::unique_ptr<RegisterAllocationData, RegisterAllocationDataDeleter> PullAllocationData() = 0;
/** @} */
protected:
bool HasSpills {};
// Debug option to disable split slot reuse
// Can be useful for testing if there is a bug with spill slots
constexpr static bool ReuseSpillSlots {true};
uint32_t SpillSlotCount {};
bool HadFullRA {};
};
}