LLVM  4.0.0
Public Types | Public Member Functions | List of all members
llvm::LegalizerHelper Class Reference

#include <LegalizerHelper.h>

Public Types

enum  LegalizeResult { AlreadyLegal, Legalized, UnableToLegalize }
 

Public Member Functions

 LegalizerHelper (MachineFunction &MF)
 
LegalizeResult legalizeInstrStep (MachineInstr &MI, const LegalizerInfo &LegalizerInfo)
 Replace MI by a sequence of legal instructions that can implement the same operation. More...
 
LegalizeResult legalizeInstr (MachineInstr &MI, const LegalizerInfo &LegalizerInfo)
 
LegalizeResult libcall (MachineInstr &MI)
 Legalize an instruction by emiting a runtime library call instead. More...
 
LegalizeResult narrowScalar (MachineInstr &MI, unsigned TypeIdx, LLT NarrowTy)
 Legalize an instruction by reducing the width of the underlying scalar type. More...
 
LegalizeResult widenScalar (MachineInstr &MI, unsigned TypeIdx, LLT WideTy)
 Legalize an instruction by performing the operation on a wider scalar type (for example a 16-bit addition can be safely performed at 32-bits precision, ignoring the unused bits). More...
 
LegalizeResult lower (MachineInstr &MI, unsigned TypeIdx, LLT Ty)
 Legalize an instruction by splitting it into simpler parts, hopefully understood by the target. More...
 
LegalizeResult fewerElementsVector (MachineInstr &MI, unsigned TypeIdx, LLT NarrowTy)
 Legalize a vector instruction by splitting into multiple components, each acting on the same scalar type as the original but with fewer elements. More...
 
LegalizeResult moreElementsVector (MachineInstr &MI, unsigned TypeIdx, LLT WideTy)
 Legalize a vector instruction by increasing the number of vector elements involved and ignoring the added elements later. More...
 

Detailed Description

Definition at line 34 of file LegalizerHelper.h.

Member Enumeration Documentation

Enumerator
AlreadyLegal 

Instruction was already legal and no change was made to the MachineFunction.

Legalized 

Instruction has been legalized and the MachineFunction changed.

UnableToLegalize 

Some kind of error has occurred and we could not legalize this instruction.

Definition at line 36 of file LegalizerHelper.h.

Constructor & Destructor Documentation

LegalizerHelper::LegalizerHelper ( MachineFunction MF)

Definition at line 31 of file LegalizerHelper.cpp.

References llvm::MachineIRBuilder::setMF().

Member Function Documentation

LegalizerHelper::LegalizeResult LegalizerHelper::fewerElementsVector ( MachineInstr MI,
unsigned  TypeIdx,
LLT  NarrowTy 
)
LegalizerHelper::LegalizeResult LegalizerHelper::legalizeInstr ( MachineInstr MI,
const LegalizerInfo LegalizerInfo 
)
LegalizerHelper::LegalizeResult LegalizerHelper::legalizeInstrStep ( MachineInstr MI,
const LegalizerInfo LegalizerInfo 
)

Replace MI by a sequence of legal instructions that can implement the same operation.

Note that this means MI may be deleted, so any iterator steps should be performed before calling this function. Helper should be initialized to the MachineFunction containing MI.

Considered as an opaque blob, the legal code will use and define the same registers as MI.

Definition at line 37 of file LegalizerHelper.cpp.

References AlreadyLegal, llvm::LegalizerInfo::FewerElements, fewerElementsVector(), llvm::LegalizerInfo::getAction(), llvm::LegalizerInfo::Legal, libcall(), llvm::LegalizerInfo::Libcall, lower(), llvm::LegalizerInfo::Lower, llvm::LegalizerInfo::NarrowScalar, narrowScalar(), UnableToLegalize, llvm::LegalizerInfo::WidenScalar, and widenScalar().

Referenced by legalizeInstr().

LegalizerHelper::LegalizeResult LegalizerHelper::libcall ( MachineInstr MI)
LegalizerHelper::LegalizeResult LegalizerHelper::lower ( MachineInstr MI,
unsigned  TypeIdx,
LLT  Ty 
)

Legalize an instruction by splitting it into simpler parts, hopefully understood by the target.

Definition at line 296 of file LegalizerHelper.cpp.

References llvm::MachineInstr::eraseFromParent(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), Legalized, MRI, and UnableToLegalize.

Referenced by legalizeInstrStep().

LegalizeResult llvm::LegalizerHelper::moreElementsVector ( MachineInstr MI,
unsigned  TypeIdx,
LLT  WideTy 
)

Legalize a vector instruction by increasing the number of vector elements involved and ignoring the added elements later.

LegalizerHelper::LegalizeResult LegalizerHelper::narrowScalar ( MachineInstr MI,
unsigned  TypeIdx,
LLT  NarrowTy 
)
LegalizerHelper::LegalizeResult LegalizerHelper::widenScalar ( MachineInstr MI,
unsigned  TypeIdx,
LLT  WideTy 
)

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