class RegBankSelect::MappingCost

Declaration

class RegBankSelect::MappingCost { /* full declaration omitted */ };

Description

Helper class used to represent the cost for mapping an instruction. When mapping an instruction, we may introduce some repairing code. In most cases, the repairing code is local to the instruction, thus, we can omit the basic block frequency from the cost. However, some alternatives may produce non-local cost, e.g., when repairing a phi, and thus we then need to scale the local cost to the non-local cost. This class does this for us.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/RegBankSelect.h:422

Member Variables

private uint64_t LocalCost = 0
Cost of the local instructions. This cost is free of basic block frequency.
private uint64_t NonLocalCost = 0
Cost of the non-local instructions. This cost should include the frequency of the related blocks.
private uint64_t LocalFreq
Frequency of the block where the local instructions live.

Method Overview

Methods

static llvm::RegBankSelect::MappingCost
ImpossibleCost()

Description

Return an instance of MappingCost that represents an impossible mapping.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/RegBankSelect.h:459

MappingCost(uint64_t LocalCost,
            uint64_t NonLocalCost,
            uint64_t LocalFreq)

Declared at: llvm/include/llvm/CodeGen/GlobalISel/RegBankSelect.h:433

Parameters

uint64_t LocalCost
uint64_t NonLocalCost
uint64_t LocalFreq

MappingCost(const llvm::BlockFrequency& LocalFreq)

Description

Create a MappingCost assuming that most of the instructions will occur in a basic block with \p LocalFreq frequency.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/RegBankSelect.h:443

Parameters

const llvm::BlockFrequency& LocalFreq

bool addLocalCost(uint64_t Cost)

Description

Add \p Cost to the local cost.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/RegBankSelect.h:447

Parameters

uint64_t Cost

Returns

true if this cost is saturated, false otherwise.

bool addNonLocalCost(uint64_t Cost)

Description

Add \p Cost to the non-local cost. Non-local cost should reflect the frequency of their placement.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/RegBankSelect.h:452

Parameters

uint64_t Cost

Returns

true if this cost is saturated, false otherwise.

void dump() const

Description

Print this on dbgs() stream.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/RegBankSelect.h:473

bool isSaturated() const

Description

Check if this cost is saturated.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/RegBankSelect.h:438

void print(llvm::raw_ostream& OS) const

Description

Print this on \p OS;

Declared at: llvm/include/llvm/CodeGen/GlobalISel/RegBankSelect.h:476

Parameters

llvm::raw_ostream& OS

void saturate()

Description

Saturate the cost to the maximal representable value.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/RegBankSelect.h:455