|
LLVM
5.0.0
|
#include "llvm/CodeGen/GlobalISel/LegalizerInfo.h"
Public Types | |
| enum | LegalizeAction : std::uint8_t { Legal, NarrowScalar, WidenScalar, FewerElements, MoreElements, Lower, Libcall, Custom, Unsupported, NotFound } |
Public Member Functions | |
| LegalizerInfo () | |
| virtual | ~LegalizerInfo ()=default |
| void | computeTables () |
| Compute any ancillary tables needed to quickly decide how an operation should be handled. More... | |
| void | setAction (const InstrAspect &Aspect, LegalizeAction Action) |
| More friendly way to set an action for common types that have an LLT representation. More... | |
| void | setScalarInVectorAction (unsigned Opcode, LLT ScalarTy, LegalizeAction Action) |
| If an operation on a given vector type (say <M x="" in>="">) isn't explicitly specified, we proceed in 2 stages. More... | |
| std::pair< LegalizeAction, LLT > | getAction (const InstrAspect &Aspect) const |
| Determine what action should be taken to legalize the given generic instruction opcode, type-index and type. More... | |
| std::tuple< LegalizeAction, unsigned, LLT > | getAction (const MachineInstr &MI, const MachineRegisterInfo &MRI) const |
| Determine what action should be taken to legalize the given generic instruction. More... | |
| Optional< LLT > | findLegalizableSize (const InstrAspect &Aspect, function_ref< LLT(LLT)> NextType) const |
| Iterate the given function (typically something like doubling the width) on Ty until we find a legal type for this operation. More... | |
| Optional< LLT > | findLegalType (const InstrAspect &Aspect, LegalizeAction Action) const |
| Find what type it's actually OK to perform the given operation on, given the general approach we've decided to take. More... | |
| std::pair< LegalizeAction, LLT > | findLegalAction (const InstrAspect &Aspect, LegalizeAction Action) const |
| LegalizeAction | findInActions (const InstrAspect &Aspect) const |
Find the specified Aspect in the primary (explicitly set) Actions table. More... | |
| bool | isLegal (const MachineInstr &MI, const MachineRegisterInfo &MRI) const |
| virtual bool | legalizeCustom (MachineInstr &MI, MachineRegisterInfo &MRI, MachineIRBuilder &MIRBuilder) const |
Static Public Member Functions | |
| static bool | needsLegalizingToDifferentSize (const LegalizeAction Action) |
Definition at line 53 of file LegalizerInfo.h.
| enum llvm::LegalizerInfo::LegalizeAction : std::uint8_t |
Definition at line 55 of file LegalizerInfo.h.
| LegalizerInfo::LegalizerInfo | ( | ) |
Definition at line 37 of file LegalizerInfo.cpp.
References Legal, Lower, NarrowScalar, and WidenScalar.
|
virtualdefault |
| void LegalizerInfo::computeTables | ( | ) |
Compute any ancillary tables needed to quickly decide how an operation should be handled.
This must be called after all "set*Action"methods but before any query is made or incorrect results may be returned.
Definition at line 58 of file LegalizerInfo.cpp.
References llvm::LLT::getElementType(), llvm::LLT::getNumElements(), llvm::LLT::isVector(), and llvm::max().
Referenced by llvm::AArch64LegalizerInfo::AArch64LegalizerInfo(), llvm::AMDGPULegalizerInfo::AMDGPULegalizerInfo(), llvm::ARMLegalizerInfo::ARMLegalizerInfo(), and llvm::X86LegalizerInfo::X86LegalizerInfo().
|
inline |
Find the specified Aspect in the primary (explicitly set) Actions table.
Returns either the action the target requested or NotFound if there was no setAction call.
Definition at line 197 of file LegalizerInfo.h.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::InstrAspect::Idx, NotFound, llvm::InstrAspect::Opcode, and llvm::InstrAspect::Type.
Referenced by getAction().
|
inline |
Definition at line 186 of file LegalizerInfo.h.
References findLegalType().
Referenced by getAction().
|
inline |
Iterate the given function (typically something like doubling the width) on Ty until we find a legal type for this operation.
Definition at line 163 of file LegalizerInfo.h.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::InstrAspect::Idx, needsLegalizingToDifferentSize(), llvm::None, llvm::InstrAspect::Opcode, and llvm::InstrAspect::Type.
Referenced by findLegalType().
| Optional< LLT > LegalizerInfo::findLegalType | ( | const InstrAspect & | Aspect, |
| LegalizeAction | Action | ||
| ) | const |
Find what type it's actually OK to perform the given operation on, given the general approach we've decided to take.
Definition at line 173 of file LegalizerInfo.cpp.
References Custom, llvm::LLT::doubleElements(), llvm::LLT::doubleScalarSize(), FewerElements, findLegalizableSize(), llvm::LLT::getSizeInBits(), llvm::LLT::halfElements(), llvm::LLT::halfScalarSize(), Legal, Libcall, llvm_unreachable(), Lower, MoreElements, NarrowScalar, llvm::LLT::scalar(), llvm::InstrAspect::Type, and WidenScalar.
Referenced by findLegalAction().
| std::pair< LegalizerInfo::LegalizeAction, LLT > LegalizerInfo::getAction | ( | const InstrAspect & | Aspect | ) | const |
Determine what action should be taken to legalize the given generic instruction opcode, type-index and type.
Requires computeTables to have been called.
Definition at line 81 of file LegalizerInfo.cpp.
References assert(), Custom, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), FewerElements, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), findInActions(), findLegalAction(), llvm::LLT::getElementType(), llvm::LLT::getNumElements(), llvm::LLT::getSizeInBits(), llvm::isPowerOf2_64(), llvm::LLT::isVector(), Legal, Lower, MoreElements, NarrowScalar, NotFound, llvm::InstrAspect::Opcode, llvm::InstrAspect::Type, and Unsupported.
Referenced by getAction(), isLegal(), and llvm::LegalizerHelper::legalizeInstrStep().
| std::tuple< LegalizerInfo::LegalizeAction, unsigned, LLT > LegalizerInfo::getAction | ( | const MachineInstr & | MI, |
| const MachineRegisterInfo & | MRI | ||
| ) | const |
Determine what action should be taken to legalize the given generic instruction.
Definition at line 144 of file LegalizerInfo.cpp.
References getAction(), llvm::MachineInstr::getDesc(), llvm::MCOperandInfo::getGenericTypeIndex(), llvm::MCInstrDesc::getNumOperands(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::MachineRegisterInfo::getType(), Legal, llvm::MCInstrDesc::OpInfo, and llvm::SmallBitVector::set().
| bool LegalizerInfo::isLegal | ( | const MachineInstr & | MI, |
| const MachineRegisterInfo & | MRI | ||
| ) | const |
Definition at line 168 of file LegalizerInfo.cpp.
References getAction(), and Legal.
|
virtual |
Reimplemented in llvm::ARMLegalizerInfo, and llvm::AArch64LegalizerInfo.
Definition at line 203 of file LegalizerInfo.cpp.
Referenced by llvm::LegalizerHelper::legalizeInstrStep().
|
inlinestatic |
Definition at line 110 of file LegalizerInfo.h.
References FewerElements, MoreElements, NarrowScalar, Unsupported, and WidenScalar.
Referenced by findLegalizableSize().
|
inline |
More friendly way to set an action for common types that have an LLT representation.
Definition at line 125 of file LegalizerInfo.h.
References llvm::InstrAspect::Idx, llvm::InstrAspect::Opcode, and llvm::InstrAspect::Type.
Referenced by llvm::AArch64LegalizerInfo::AArch64LegalizerInfo(), llvm::AMDGPULegalizerInfo::AMDGPULegalizerInfo(), and llvm::ARMLegalizerInfo::ARMLegalizerInfo().
|
inline |
If an operation on a given vector type (say <M x="" in>="">) isn't explicitly specified, we proceed in 2 stages.
First we legalize the underlying scalar (so that there's at least one legal vector with that scalar), then we adjust the number of elements in the vector so that it is legal. The desired action in the first step is controlled by this function.
Definition at line 138 of file LegalizerInfo.h.
References assert(), and llvm::LLT::isVector().
1.8.6