LLVM 24.0.0git
llvm::slpvectorizer::InstructionsState Class Reference

Main data required for vectorization of instructions. More...

#include "Transforms/Vectorize/SLPVectorizer/SLPCompatibilityAnalysis.h"

Public Member Functions

InstructiongetMainOp () const
InstructiongetAltOp () const
unsigned getOpcode () const
 The main/alternate opcodes for the list of instructions.
unsigned getAltOpcode () const
bool isAltShuffle () const
 Some of the instructions in the list have alternate opcodes.
InstructiongetMatchingMainOpOrAltOp (Instruction *I) const
 Checks if the instruction matches either the main or alternate opcode.
bool isShiftOp () const
 Checks if main/alt instructions are shift operations.
bool isBitwiseLogicOp () const
 Checks if main/alt instructions are bitwise logic operations.
bool isMulDivLikeOp () const
 Checks if main/alt instructions are mul/div/rem/fmul/fdiv/frem operations.
bool isAddSubLikeOp () const
 Checks if main/alt instructions are add/sub/fadd/fsub operations.
bool isCmpOp () const
 Checks if main/alt instructions are cmp operations.
bool valid () const
 Checks if the current state is valid, i.e. has non-null MainOp.
 operator bool () const
 InstructionsState ()=delete
 InstructionsState (Instruction *MainOp, Instruction *AltOp, bool HasCopyables=false)
bool isCopyableElement (Value *V) const
 Checks if the value is a copyable element.
bool isExpandedBinOp (Value *V) const
 Checks if the value V is a transformed instruction, compatible either with main or alternate ops.
bool isExpandedOperand (Instruction *I, unsigned Idx) const
 Checks if the operand at index Idx of instruction I is an expanded operand.
bool isNonSchedulable (Value *V) const
 Checks if the value is non-schedulable.
bool areInstructionsWithCopyableElements () const
 Checks if the state represents copyable instructions.
unsigned getCopyableOpIdx () const
 Returns the index of the operand the copyable value is modeled in.
void setCopyableOpIdx (unsigned Idx)
 Sets the index of the operand the copyable value is modeled in.

Static Public Member Functions

static bool isSameOperation (const Instruction *I, const Instruction *Op)
 Checks if I is the same operation as Op, distinguishing calls by intrinsic ID (all calls share the Call opcode, so e.g.
static InstructionsState invalid ()

Detailed Description

Main data required for vectorization of instructions.

Definition at line 131 of file SLPCompatibilityAnalysis.h.

Constructor & Destructor Documentation

◆ InstructionsState() [1/2]

llvm::slpvectorizer::InstructionsState::InstructionsState ( )
delete

Referenced by invalid().

◆ InstructionsState() [2/2]

llvm::slpvectorizer::InstructionsState::InstructionsState ( Instruction * MainOp,
Instruction * AltOp,
bool HasCopyables = false )
inline

Definition at line 223 of file SLPCompatibilityAnalysis.h.

Member Function Documentation

◆ areInstructionsWithCopyableElements()

bool llvm::slpvectorizer::InstructionsState::areInstructionsWithCopyableElements ( ) const
inline

Checks if the state represents copyable instructions.

Definition at line 246 of file SLPCompatibilityAnalysis.h.

References assert(), and valid().

Referenced by scanAssociativeOperands(), and tryToFindDuplicates().

◆ getAltOp()

Instruction * llvm::slpvectorizer::InstructionsState::getAltOp ( ) const
inline

◆ getAltOpcode()

unsigned llvm::slpvectorizer::InstructionsState::getAltOpcode ( ) const
inline

◆ getCopyableOpIdx()

unsigned llvm::slpvectorizer::InstructionsState::getCopyableOpIdx ( ) const
inline

Returns the index of the operand the copyable value is modeled in.

Definition at line 252 of file SLPCompatibilityAnalysis.h.

References assert(), and valid().

◆ getMainOp()

◆ getMatchingMainOpOrAltOp()

Instruction * llvm::slpvectorizer::InstructionsState::getMatchingMainOpOrAltOp ( Instruction * I) const

Checks if the instruction matches either the main or alternate opcode.

Returns
  • MainOp if
Parameters
Imatches MainOp's opcode directly or can be converted to it
  • AltOp if
Imatches AltOp's opcode directly or can be converted to it
  • nullptr if
Icannot be matched or converted to either opcode

Definition at line 335 of file SLPCompatibilityAnalysis.cpp.

References llvm::slpvectorizer::BinOpSameOpcodeHelper::add(), assert(), Converter, llvm::slpvectorizer::BinOpSameOpcodeHelper::hasCandidateOpcode(), I, isAltShuffle(), and isSameOperation().

Referenced by canConvertToFMA(), getSameOpcode(), isAlternateInstruction(), isExpandedBinOp(), and isMainInstruction().

◆ getOpcode()

unsigned llvm::slpvectorizer::InstructionsState::getOpcode ( ) const
inline

◆ invalid()

InstructionsState llvm::slpvectorizer::InstructionsState::invalid ( )
inlinestatic

Definition at line 229 of file SLPCompatibilityAnalysis.h.

References InstructionsState().

Referenced by getSameOpcode(), and scanAssociativeOperands().

◆ isAddSubLikeOp()

bool llvm::slpvectorizer::InstructionsState::isAddSubLikeOp ( ) const

Checks if main/alt instructions are add/sub/fadd/fsub operations.

Definition at line 372 of file SLPCompatibilityAnalysis.cpp.

References llvm::slpvectorizer::BinOpSameOpcodeHelper::getAltOpcode(), getOpcode(), and llvm::is_contained().

Referenced by slpvectorizer::BoUpSLP::canBuildSplitNode(), and canConvertToFMA().

◆ isAltShuffle()

bool llvm::slpvectorizer::InstructionsState::isAltShuffle ( ) const
inline

◆ isBitwiseLogicOp()

bool llvm::slpvectorizer::InstructionsState::isBitwiseLogicOp ( ) const
inline

Checks if main/alt instructions are bitwise logic operations.

Definition at line 200 of file SLPCompatibilityAnalysis.h.

References getAltOp(), getMainOp(), and llvm::Instruction::isBitwiseLogicOp().

Referenced by slpvectorizer::BoUpSLP::canBuildSplitNode().

◆ isCmpOp()

bool llvm::slpvectorizer::InstructionsState::isCmpOp ( ) const
inline

Checks if main/alt instructions are cmp operations.

Definition at line 211 of file SLPCompatibilityAnalysis.h.

References getAltOpcode(), and getOpcode().

Referenced by slpvectorizer::BoUpSLP::canBuildSplitNode().

◆ isCopyableElement()

bool llvm::slpvectorizer::InstructionsState::isCopyableElement ( Value * V) const

◆ isExpandedBinOp()

bool llvm::slpvectorizer::InstructionsState::isExpandedBinOp ( Value * V) const

Checks if the value V is a transformed instruction, compatible either with main or alternate ops.

Definition at line 402 of file SLPCompatibilityAnalysis.cpp.

References assert(), llvm::dyn_cast(), getMatchingMainOpOrAltOp(), llvm::Instruction::getOpcode(), isCopyableElement(), llvm::PatternMatch::m_One(), llvm::PatternMatch::m_Shl(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), and valid().

Referenced by isExpandedOperand().

◆ isExpandedOperand()

bool llvm::slpvectorizer::InstructionsState::isExpandedOperand ( Instruction * I,
unsigned Idx ) const

Checks if the operand at index Idx of instruction I is an expanded operand.

Definition at line 434 of file SLPCompatibilityAnalysis.cpp.

References assert(), I, isExpandedBinOp(), llvm_unreachable, llvm::PatternMatch::m_One(), llvm::PatternMatch::m_Shl(), llvm::PatternMatch::m_Value(), and llvm::PatternMatch::match().

◆ isMulDivLikeOp()

bool llvm::slpvectorizer::InstructionsState::isMulDivLikeOp ( ) const

Checks if main/alt instructions are mul/div/rem/fmul/fdiv/frem operations.

Definition at line 363 of file SLPCompatibilityAnalysis.cpp.

References llvm::slpvectorizer::BinOpSameOpcodeHelper::getAltOpcode(), getOpcode(), and llvm::is_contained().

Referenced by slpvectorizer::BoUpSLP::canBuildSplitNode().

◆ isNonSchedulable()

bool llvm::slpvectorizer::InstructionsState::isNonSchedulable ( Value * V) const

◆ isSameOperation()

bool llvm::slpvectorizer::InstructionsState::isSameOperation ( const Instruction * I,
const Instruction * Op )
static

Checks if I is the same operation as Op, distinguishing calls by intrinsic ID (all calls share the Call opcode, so e.g.

umax != smax).

Definition at line 321 of file SLPCompatibilityAnalysis.cpp.

References llvm::dyn_cast(), I, II, llvm::slpvectorizer::isEquivalentIntrinsicID(), and llvm::Intrinsic::not_intrinsic.

Referenced by getMatchingMainOpOrAltOp(), and isCopyableElement().

◆ isShiftOp()

bool llvm::slpvectorizer::InstructionsState::isShiftOp ( ) const
inline

Checks if main/alt instructions are shift operations.

Definition at line 195 of file SLPCompatibilityAnalysis.h.

References getAltOp(), getMainOp(), and llvm::Instruction::isShift().

Referenced by slpvectorizer::BoUpSLP::canBuildSplitNode().

◆ operator bool()

llvm::slpvectorizer::InstructionsState::operator bool ( ) const
inlineexplicit

Definition at line 220 of file SLPCompatibilityAnalysis.h.

References valid().

◆ setCopyableOpIdx()

void llvm::slpvectorizer::InstructionsState::setCopyableOpIdx ( unsigned Idx)
inline

Sets the index of the operand the copyable value is modeled in.

Definition at line 258 of file SLPCompatibilityAnalysis.h.

References assert().

◆ valid()

bool llvm::slpvectorizer::InstructionsState::valid ( ) const
inline

Checks if the current state is valid, i.e. has non-null MainOp.

Definition at line 218 of file SLPCompatibilityAnalysis.h.

Referenced by areInstructionsWithCopyableElements(), canConvertToFMA(), getAltOp(), getCopyableOpIdx(), getMainOp(), isCopyableElement(), isExpandedBinOp(), isNonSchedulable(), and operator bool().


The documentation for this class was generated from the following files: