class CombinerHelper

Declaration

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

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:51

Member Variables

protected llvm::MachineIRBuilder& Builder
protected llvm::MachineRegisterInfo& MRI
protected llvm::GISelChangeObserver& Observer
protected llvm::GISelKnownBits* KB
protected llvm::MachineDominatorTree* MDT

Method Overview

Methods

CombinerHelper(
    llvm::GISelChangeObserver& Observer,
    llvm::MachineIRBuilder& B,
    llvm::GISelKnownBits* KB = nullptr,
    llvm::MachineDominatorTree* MDT = nullptr)

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:60

Parameters

llvm::GISelChangeObserver& Observer
llvm::MachineIRBuilder& B
llvm::GISelKnownBits* KB = nullptr
llvm::MachineDominatorTree* MDT = nullptr

void applyCombineConcatVectors(
    llvm::MachineInstr& MI,
    bool IsUndef,
    const ArrayRef<llvm::Register> Ops)

Description

Replace \p MI with a flattened build_vector with \p Ops or an implicit_def if IsUndef is true.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:126

Parameters

llvm::MachineInstr& MI
bool IsUndef
const ArrayRef<llvm::Register> Ops

void applyCombineCopy(llvm::MachineInstr& MI)

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:76

Parameters

llvm::MachineInstr& MI

void applyCombineExtendingLoads(
    llvm::MachineInstr& MI,
    llvm::PreferredTuple& MatchInfo)

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:94

Parameters

llvm::MachineInstr& MI
llvm::PreferredTuple& MatchInfo

void applyCombineIndexedLoadStore(
    llvm::MachineInstr& MI,
    llvm::IndexedLoadStoreMatchInfo& MatchInfo)

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:100

Parameters

llvm::MachineInstr& MI
llvm::IndexedLoadStoreMatchInfo& MatchInfo

void applyCombineShuffleVector(
    llvm::MachineInstr& MI,
    const ArrayRef<llvm::Register> Ops)

Description

Replace \p MI with a concat_vectors with \p Ops.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:143

Parameters

llvm::MachineInstr& MI
const ArrayRef<llvm::Register> Ops

void applyElideBrByInvertingCond(
    llvm::MachineInstr& MI)

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:103

Parameters

llvm::MachineInstr& MI

bool applyPtrAddImmedChain(
    llvm::MachineInstr& MI,
    llvm::PtrAddChain& MatchInfo)

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:179

Parameters

llvm::MachineInstr& MI
llvm::PtrAddChain& MatchInfo

bool dominates(llvm::MachineInstr& DefMI,
               llvm::MachineInstr& UseMI)

Description

Returns true if \p DefMI dominates \p UseMI. By definition an instruction dominates itself. If we haven't been provided with a MachineDominatorTree during construction, this function returns a conservative result that tracks just a single basic block.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:88

Parameters

llvm::MachineInstr& DefMI
llvm::MachineInstr& UseMI

bool isPredecessor(llvm::MachineInstr& DefMI,
                   llvm::MachineInstr& UseMI)

Description

Returns true if \p DefMI precedes \p UseMI or they are the same instruction. Both must be in the same basic block.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:80

Parameters

llvm::MachineInstr& DefMI
llvm::MachineInstr& UseMI

bool matchCombineConcatVectors(
    llvm::MachineInstr& MI,
    bool& IsUndef,
    SmallVectorImpl<llvm::Register>& Ops)

Description

Check if the G_CONCAT_VECTORS \p MI is undef or if it can be flattened into a build_vector. In the first case \p IsUndef will be true. In the second case \p Ops will contain the operands needed to produce the flattened build_vector.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:122

Parameters

llvm::MachineInstr& MI
bool& IsUndef
SmallVectorImpl<llvm::Register>& Ops

bool matchCombineCopy(llvm::MachineInstr& MI)

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:75

Parameters

llvm::MachineInstr& MI

bool matchCombineExtendingLoads(
    llvm::MachineInstr& MI,
    llvm::PreferredTuple& MatchInfo)

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:93

Parameters

llvm::MachineInstr& MI
llvm::PreferredTuple& MatchInfo

bool matchCombineIndexedLoadStore(
    llvm::MachineInstr& MI,
    llvm::IndexedLoadStoreMatchInfo& MatchInfo)

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:99

Parameters

llvm::MachineInstr& MI
llvm::IndexedLoadStoreMatchInfo& MatchInfo

bool matchCombineShuffleVector(
    llvm::MachineInstr& MI,
    SmallVectorImpl<llvm::Register>& Ops)

Description

Check if the G_SHUFFLE_VECTOR \p MI can be replaced by a concat_vectors.\p Ops will contain the operands needed to produce the flattened concat_vectors.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:140

Parameters

llvm::MachineInstr& MI
SmallVectorImpl<llvm::Register>& Ops

bool matchElideBrByInvertingCond(
    llvm::MachineInstr& MI)

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:102

Parameters

llvm::MachineInstr& MI

bool matchPtrAddImmedChain(
    llvm::MachineInstr& MI,
    llvm::PtrAddChain& MatchInfo)

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:178

Parameters

llvm::MachineInstr& MI
llvm::PtrAddChain& MatchInfo

void replaceRegOpWith(
    llvm::MachineRegisterInfo& MRI,
    llvm::MachineOperand& FromRegOp,
    llvm::Register ToReg) const

Description

Replace a single register operand with a new register and inform the observer of the changes.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:69

Parameters

llvm::MachineRegisterInfo& MRI
llvm::MachineOperand& FromRegOp
llvm::Register ToReg

void replaceRegWith(
    llvm::MachineRegisterInfo& MRI,
    llvm::Register FromReg,
    llvm::Register ToReg) const

Description

MachineRegisterInfo::replaceRegWith() and inform the observer of the changes

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:65

Parameters

llvm::MachineRegisterInfo& MRI
llvm::Register FromReg
llvm::Register ToReg

bool tryCombine(llvm::MachineInstr& MI)

Description

Try to transform \p MI by using all of the above combine functions. Returns true if changed.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:183

Parameters

llvm::MachineInstr& MI

bool tryCombineConcatVectors(
    llvm::MachineInstr& MI)

Description

If \p MI is G_CONCAT_VECTORS, try to combine it. Returns true if MI changed. Right now, we support: - concat_vector(undef, undef) => undef - concat_vector(build_vector(A, B), build_vector(C, D)) => build_vector(A, B, C, D)

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:114

Parameters

llvm::MachineInstr& MI

bool tryCombineCopy(llvm::MachineInstr& MI)

Description

If \p MI is COPY, try to combine it. Returns true if MI changed.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:74

Parameters

llvm::MachineInstr& MI

bool tryCombineExtendingLoads(
    llvm::MachineInstr& MI)

Description

If \p MI is extend that consumes the result of a load, try to combine it. Returns true if MI changed.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:92

Parameters

llvm::MachineInstr& MI

bool tryCombineIndexedLoadStore(
    llvm::MachineInstr& MI)

Description

Combine \p MI into a pre-indexed or post-indexed load/store operation if legal and the surrounding code makes it useful.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:98

Parameters

llvm::MachineInstr& MI

bool tryCombineMemCpyFamily(
    llvm::MachineInstr& MI,
    unsigned int MaxLen = 0)

Description

Optimize memcpy intrinsics et al, e.g. constant len calls. /p MaxLen if non-zero specifies the max length of a mem libcall to inline. For example (pre-indexed): $addr = G_PTR_ADD $base, $offset [...] $val = G_LOAD $addr [...] $whatever = COPY $addr --> $val, $addr = G_INDEXED_LOAD $base, $offset, 1 (IsPre) [...] $whatever = COPY $addr or (post-indexed): G_STORE $val, $base [...] $addr = G_PTR_ADD $base, $offset [...] $whatever = COPY $addr --> $addr = G_INDEXED_STORE $val, $base, $offset [...] $whatever = COPY $addr

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:176

Parameters

llvm::MachineInstr& MI
unsigned int MaxLen = 0

bool tryCombineShuffleVector(
    llvm::MachineInstr& MI)

Description

Try to combine G_SHUFFLE_VECTOR into G_CONCAT_VECTORS. Returns true if MI changed.

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:133

Parameters

llvm::MachineInstr& MI

bool tryElideBrByInvertingCond(
    llvm::MachineInstr& MI)

Declared at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:104

Parameters

llvm::MachineInstr& MI