LLVM  14.0.0git
Public Member Functions | List of all members
llvm::LegalizerInfo Class Reference

#include "llvm/CodeGen/GlobalISel/LegalizerInfo.h"

Inheritance diagram for llvm::LegalizerInfo:
Inheritance graph
[legend]

Public Member Functions

virtual ~LegalizerInfo ()=default
 
const LegacyLegalizerInfogetLegacyLegalizerInfo () const
 
LegacyLegalizerInfogetLegacyLegalizerInfo ()
 
unsigned getOpcodeIdxForOpcode (unsigned Opcode) const
 
unsigned getActionDefinitionsIdx (unsigned Opcode) const
 
void verify (const MCInstrInfo &MII) const
 Perform simple self-diagnostic and assert if there is anything obviously wrong with the actions set up. More...
 
const LegalizeRuleSetgetActionDefinitions (unsigned Opcode) const
 Get the action definitions for the given opcode. More...
 
LegalizeRuleSetgetActionDefinitionsBuilder (unsigned Opcode)
 Get the action definition builder for the given opcode. More...
 
LegalizeRuleSetgetActionDefinitionsBuilder (std::initializer_list< unsigned > Opcodes)
 Get the action definition builder for the given set of opcodes. More...
 
void aliasActionDefinitions (unsigned OpcodeTo, unsigned OpcodeFrom)
 
LegalizeActionStep getAction (const LegalityQuery &Query) const
 Determine what action should be taken to legalize the described instruction. More...
 
LegalizeActionStep getAction (const MachineInstr &MI, const MachineRegisterInfo &MRI) const
 Determine what action should be taken to legalize the given generic instruction. More...
 
bool isLegal (const LegalityQuery &Query) const
 
bool isLegalOrCustom (const LegalityQuery &Query) const
 
bool isLegal (const MachineInstr &MI, const MachineRegisterInfo &MRI) const
 
bool isLegalOrCustom (const MachineInstr &MI, const MachineRegisterInfo &MRI) const
 
virtual bool legalizeCustom (LegalizerHelper &Helper, MachineInstr &MI) const
 Called for instructions with the Custom LegalizationAction. More...
 
virtual bool legalizeIntrinsic (LegalizerHelper &Helper, MachineInstr &MI) const
 
virtual unsigned getExtOpcodeForWideningConstant (LLT SmallTy) const
 Return the opcode (SEXT/ZEXT/ANYEXT) that should be performed while widening a constant of type SmallTy which targets can override. More...
 

Detailed Description

Definition at line 1108 of file LegalizerInfo.h.

Constructor & Destructor Documentation

◆ ~LegalizerInfo()

virtual llvm::LegalizerInfo::~LegalizerInfo ( )
virtualdefault

Member Function Documentation

◆ aliasActionDefinitions()

void LegalizerInfo::aliasActionDefinitions ( unsigned  OpcodeTo,
unsigned  OpcodeFrom 
)

Definition at line 312 of file LegalizerInfo.cpp.

References assert().

◆ getAction() [1/2]

LegalizeActionStep LegalizerInfo::getAction ( const LegalityQuery Query) const

Determine what action should be taken to legalize the described instruction.

Requires computeTables to have been called.

Returns
a description of the next legalization step to perform.

Definition at line 321 of file LegalizerInfo.cpp.

References llvm::LegalizeActionStep::Action, llvm::LegalityQuery::Opcode, and llvm::LegalizeActions::UseLegacyRules.

Referenced by llvm::CombinerHelper::isLegalOrBeforeLegalizer(), llvm::LegalizerHelper::legalizeInstrStep(), llvm::LegalizerHelper::lowerBitCount(), llvm::LegalizerHelper::lowerFunnelShift(), llvm::CombinerHelper::matchCombineExtendingLoads(), and llvm::LegalizationArtifactCombiner::tryCombineUnmergeValues().

◆ getAction() [2/2]

LegalizeActionStep LegalizerInfo::getAction ( const MachineInstr MI,
const MachineRegisterInfo MRI 
) const

Determine what action should be taken to legalize the given generic instruction.

Returns
a description of the next legalization step to perform.

Definition at line 331 of file LegalizerInfo.cpp.

References llvm::MCOperandInfo::getGenericTypeIndex(), getTypeFromTypeIdx(), i, MI, MRI, and llvm::SmallBitVector::set().

◆ getActionDefinitions()

const LegalizeRuleSet & LegalizerInfo::getActionDefinitions ( unsigned  Opcode) const

Get the action definitions for the given opcode.

Use this to run a LegalityQuery through the definitions.

Definition at line 285 of file LegalizerInfo.cpp.

◆ getActionDefinitionsBuilder() [1/2]

LegalizeRuleSet & LegalizerInfo::getActionDefinitionsBuilder ( std::initializer_list< unsigned >  Opcodes)

Get the action definition builder for the given set of opcodes.

Use this to define the action definitions for multiple opcodes at once. The first opcode given will be considered the representative opcode and will hold the definitions whereas the other opcodes will be configured to refer to the representative opcode. This lowers memory requirements and very slightly improves performance.

It would be very easy to introduce unexpected side-effects as a result of this aliasing if it were permitted to request different but intersecting sets of opcodes but that is difficult to keep track of. It is therefore an error to request the same opcode twice using this API, to request an opcode that already has definitions, or to use the single-opcode API on an opcode that has already been requested by this API.

Definition at line 297 of file LegalizerInfo.cpp.

References assert(), llvm::drop_begin(), and llvm::empty().

◆ getActionDefinitionsBuilder() [2/2]

LegalizeRuleSet & LegalizerInfo::getActionDefinitionsBuilder ( unsigned  Opcode)

Get the action definition builder for the given opcode.

Use this to define the action definitions.

It is an error to request an opcode that has already been requested by the multiple-opcode variant.

Definition at line 290 of file LegalizerInfo.cpp.

References assert().

Referenced by llvm::AArch64LegalizerInfo::AArch64LegalizerInfo(), llvm::AMDGPULegalizerInfo::AMDGPULegalizerInfo(), llvm::M68kLegalizerInfo::M68kLegalizerInfo(), llvm::MipsLegalizerInfo::MipsLegalizerInfo(), and llvm::X86LegalizerInfo::X86LegalizerInfo().

◆ getActionDefinitionsIdx()

unsigned LegalizerInfo::getActionDefinitionsIdx ( unsigned  Opcode) const

Definition at line 272 of file LegalizerInfo.cpp.

References assert(), llvm::dbgs(), and LLVM_DEBUG.

◆ getExtOpcodeForWideningConstant()

unsigned LegalizerInfo::getExtOpcodeForWideningConstant ( LLT  SmallTy) const
virtual

Return the opcode (SEXT/ZEXT/ANYEXT) that should be performed while widening a constant of type SmallTy which targets can override.

For eg, the DAG does (SmallTy.isByteSized() ? G_SEXT : G_ZEXT) which will be the default.

Definition at line 373 of file LegalizerInfo.cpp.

References llvm::LLT::isByteSized().

Referenced by llvm::LegalizerHelper::widenScalar().

◆ getLegacyLegalizerInfo() [1/2]

LegacyLegalizerInfo& llvm::LegalizerInfo::getLegacyLegalizerInfo ( )
inline

Definition at line 1115 of file LegalizerInfo.h.

◆ getLegacyLegalizerInfo() [2/2]

const LegacyLegalizerInfo& llvm::LegalizerInfo::getLegacyLegalizerInfo ( ) const
inline

◆ getOpcodeIdxForOpcode()

unsigned LegalizerInfo::getOpcodeIdxForOpcode ( unsigned  Opcode) const

Definition at line 267 of file LegalizerInfo.cpp.

References assert().

◆ isLegal() [1/2]

bool llvm::LegalizerInfo::isLegal ( const LegalityQuery Query) const
inline

Definition at line 1165 of file LegalizerInfo.h.

References llvm::LegalizeActions::Legal.

◆ isLegal() [2/2]

bool LegalizerInfo::isLegal ( const MachineInstr MI,
const MachineRegisterInfo MRI 
) const

Definition at line 360 of file LegalizerInfo.cpp.

References llvm::LegalizeActions::Legal, MI, and MRI.

◆ isLegalOrCustom() [1/2]

bool llvm::LegalizerInfo::isLegalOrCustom ( const LegalityQuery Query) const
inline

◆ isLegalOrCustom() [2/2]

bool LegalizerInfo::isLegalOrCustom ( const MachineInstr MI,
const MachineRegisterInfo MRI 
) const

◆ legalizeCustom()

virtual bool llvm::LegalizerInfo::legalizeCustom ( LegalizerHelper Helper,
MachineInstr MI 
) const
inlinevirtual

Called for instructions with the Custom LegalizationAction.

Reimplemented in llvm::AMDGPULegalizerInfo, llvm::AArch64LegalizerInfo, llvm::ARMLegalizerInfo, and llvm::MipsLegalizerInfo.

Definition at line 1179 of file LegalizerInfo.h.

References llvm_unreachable.

Referenced by llvm::LegalizerHelper::legalizeInstrStep().

◆ legalizeIntrinsic()

virtual bool llvm::LegalizerInfo::legalizeIntrinsic ( LegalizerHelper Helper,
MachineInstr MI 
) const
inlinevirtual
Returns
true if MI is either legal or has been legalized and false if not legal. Return true if MI is either legal or has been legalized and false if not legal.

Reimplemented in llvm::AMDGPULegalizerInfo, llvm::X86LegalizerInfo, llvm::AArch64LegalizerInfo, and llvm::MipsLegalizerInfo.

Definition at line 1188 of file LegalizerInfo.h.

Referenced by llvm::LegalizerHelper::legalizeInstrStep().

◆ verify()

void LegalizerInfo::verify ( const MCInstrInfo MII) const

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