class CoalescerPair

Declaration

class CoalescerPair { /* full declaration omitted */ };

Description

A helper class for register coalescers. When deciding if two registers can be coalesced, CoalescerPair can determine if a copy instruction would become an identity copy after coalescing.

Declared at: llvm/lib/CodeGen/RegisterCoalescer.h:28

Member Variables

private const llvm::TargetRegisterInfo& TRI
private llvm::Register DstReg
The register that will be left after coalescing. It can be a virtual or physical register.
private llvm::Register SrcReg
The virtual register that will be coalesced into dstReg.
private unsigned int DstIdx = 0
The sub-register index of the old DstReg in the new coalesced register.
private unsigned int SrcIdx = 0
The sub-register index of the old SrcReg in the new coalesced register.
private bool Partial = false
True when the original copy was a partial subregister copy.
private bool CrossClass = false
True when both regs are virtual and newRC is constrained.
private bool Flipped = false
True when DstReg and SrcReg are reversed from the original copy instruction.
private const llvm::TargetRegisterClass* NewRC = nullptr
The register class of the coalesced register, or NULL if DstReg is a physreg. This register class may be a super-register of both SrcReg and DstReg.

Method Overview

Methods

CoalescerPair(const llvm::TargetRegisterInfo& tri)

Declared at: llvm/lib/CodeGen/RegisterCoalescer.h:60

Parameters

const llvm::TargetRegisterInfo& tri

CoalescerPair(llvm::Register VirtReg,
              llvm::MCRegister PhysReg,
              const llvm::TargetRegisterInfo& tri)

Description

Create a CoalescerPair representing a virtreg-to-physreg copy. No need to call setRegisters().

Declared at: llvm/lib/CodeGen/RegisterCoalescer.h:64

Parameters

llvm::Register VirtReg
llvm::MCRegister PhysReg
const llvm::TargetRegisterInfo& tri

bool flip()

Description

Swap SrcReg and DstReg. Return false if swapping is impossible because DstReg is a physical register, or SubIdx is set.

Declared at: llvm/lib/CodeGen/RegisterCoalescer.h:74

unsigned int getDstIdx() const

Description

Return the subregister index that DstReg will be coalesced into, or 0.

Declared at: llvm/lib/CodeGen/RegisterCoalescer.h:103

llvm::Register getDstReg() const

Description

Return the register (virtual or physical) that will remain after coalescing.

Declared at: llvm/lib/CodeGen/RegisterCoalescer.h:97

const llvm::TargetRegisterClass* getNewRC() const

Description

Return the register class of the coalesced register.

Declared at: llvm/lib/CodeGen/RegisterCoalescer.h:109

unsigned int getSrcIdx() const

Description

Return the subregister index that SrcReg will be coalesced into, or 0.

Declared at: llvm/lib/CodeGen/RegisterCoalescer.h:106

llvm::Register getSrcReg() const

Description

Return the virtual register that will be coalesced away.

Declared at: llvm/lib/CodeGen/RegisterCoalescer.h:100

bool isCoalescable(
    const llvm::MachineInstr*) const

Description

Return true if MI is a copy instruction that will become an identity copy after coalescing.

Declared at: llvm/lib/CodeGen/RegisterCoalescer.h:78

Parameters

const llvm::MachineInstr*

bool isCrossClass() const

Description

Return true if DstReg is virtual and NewRC is a smaller register class than DstReg's.

Declared at: llvm/lib/CodeGen/RegisterCoalescer.h:89

bool isFlipped() const

Description

Return true when getSrcReg is the register being defined by the original copy instruction.

Declared at: llvm/lib/CodeGen/RegisterCoalescer.h:93

bool isPartial() const

Description

Return true if the original copy instruction did not copy the full register, but was a subreg operation.

Declared at: llvm/lib/CodeGen/RegisterCoalescer.h:85

bool isPhys() const

Description

Return true if DstReg is a physical register.

Declared at: llvm/lib/CodeGen/RegisterCoalescer.h:81

bool setRegisters(const llvm::MachineInstr*)

Description

Set registers to match the copy instruction MI. Return false if MI is not a coalescable copy instruction.

Declared at: llvm/lib/CodeGen/RegisterCoalescer.h:70

Parameters

const llvm::MachineInstr*