LLVM: lib/Target/X86/X86SelectionDAGInfo.cpp File Reference (original) (raw)

Go to the source code of this file.

Macros
#define DEBUG_TYPE "x86-selectiondag-info"
Functions
static MVT getOptimalRepType (const X86Subtarget &Subtarget, Align Alignment)
Returns the best type to use with repmovs/repstos depending on alignment.
static SDValue emitRepstos (const X86Subtarget &Subtarget, SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Val, SDValue Size, MVT AVT)
Emit a single REP STOSB instruction for a particular constant size.
static SDValue emitRepstosB (const X86Subtarget &Subtarget, SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Val, uint64_t Size)
Emit a single REP STOSB instruction for a particular constant size.
static SDValue emitConstantSizeRepstos (SelectionDAG &DAG, const X86Subtarget &Subtarget, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Val, uint64_t Size, EVT SizeVT, Align Alignment, bool isVolatile, bool AlwaysInline, MachinePointerInfo DstPtrInfo)
Returns a REP STOS instruction, possibly with a few load/stores to implement a constant size memory set.
static SDValue emitRepmovs (const X86Subtarget &Subtarget, SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, MVT AVT)
Emit a single REP MOVS{B,W,D,Q} instruction.
static SDValue emitRepmovsB (const X86Subtarget &Subtarget, SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, uint64_t Size)
Emit a single REP MOVSB instruction for a particular constant size.
static SDValue emitConstantSizeRepmov (SelectionDAG &DAG, const X86Subtarget &Subtarget, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, uint64_t Size, EVT SizeVT, Align Alignment, bool isVolatile, bool AlwaysInline, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo)
Returns a REP MOVS instruction, possibly with a few load/stores to implement a constant size memory copy.
Variables
static cl::opt< bool > UseFSRMForMemcpy ("x86-use-fsrm-for-memcpy", cl::Hidden, cl::init(false), cl::desc("Use fast short rep mov in memcpy lowering"))

DEBUG_TYPE

#define DEBUG_TYPE "x86-selectiondag-info"

emitConstantSizeRepmov()

SDValue emitConstantSizeRepmov ( SelectionDAG & DAG, const X86Subtarget & Subtarget, const SDLoc & dl, SDValue Chain, SDValue Dst, SDValue Src, uint64_t Size, EVT SizeVT, Align Alignment, bool isVolatile, bool AlwaysInline, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo ) static

Returns a REP MOVS instruction, possibly with a few load/stores to implement a constant size memory copy.

In some cases where we know REP MOVS is inefficient we return an empty SDValue so the calling code can either generate a load/store sequence or call the runtime memcpy function.

In case we optimize for size, we use repmovsb even if it's less efficient so we can save the loads/stores of the leftover.

TODO: Revisit next line: big copy with ERMSB on march >= haswell are very efficient.

If we have enhanced repmovs we use it.

We assume runtime memcpy will do a better job for unaligned copies when ERMS is not present.

RepMov can process the whole length.

Definition at line 267 of file X86SelectionDAGInfo.cpp.

References llvm::ISD::ADD, assert(), emitRepmovs(), emitRepmovsB(), llvm::SelectionDAG::getConstant(), llvm::MachineFunction::getFunction(), llvm::SelectionDAG::getIntPtrConstant(), llvm::SelectionDAG::getMachineFunction(), llvm::X86Subtarget::getMaxInlineSizeThreshold(), llvm::SelectionDAG::getMemcpy(), llvm::SelectionDAG::getNode(), getOptimalRepType(), llvm::MachinePointerInfo::getWithOffset(), llvm::Function::hasMinSize(), llvm::Offset, Results, SDValue(), Size, and llvm::ISD::TokenFactor.

Referenced by llvm::X86SelectionDAGInfo::EmitTargetCodeForMemcpy().

emitConstantSizeRepstos()

SDValue emitConstantSizeRepstos ( SelectionDAG & DAG, const X86Subtarget & Subtarget, const SDLoc & dl, SDValue Chain, SDValue Dst, SDValue Val, uint64_t Size, EVT SizeVT, Align Alignment, bool isVolatile, bool AlwaysInline, MachinePointerInfo DstPtrInfo ) static

Returns a REP STOS instruction, possibly with a few load/stores to implement a constant size memory set.

In some cases where we know REP MOVS is inefficient we return an empty SDValue so the calling code can either generate a store sequence or call the runtime memset function.

In case we optimize for size, we use repstosb even if it's less efficient so we can save the loads/stores of the leftover.

RepStos can process the whole length.

Definition at line 122 of file X86SelectionDAGInfo.cpp.

References llvm::ISD::ADD, llvm::dyn_cast(), emitRepstos(), emitRepstosB(), llvm::SelectionDAG::getConstant(), llvm::MachineFunction::getFunction(), llvm::SelectionDAG::getIntPtrConstant(), llvm::SelectionDAG::getMachineFunction(), llvm::X86Subtarget::getMaxInlineSizeThreshold(), llvm::SelectionDAG::getMemset(), llvm::SelectionDAG::getNode(), getOptimalRepType(), llvm::MachinePointerInfo::getWithOffset(), llvm::Function::hasMinSize(), llvm::Offset, Results, SDValue(), Size, and llvm::ISD::TokenFactor.

Referenced by llvm::X86SelectionDAGInfo::EmitTargetCodeForMemset().

emitRepmovs()

Emit a single REP MOVS{B,W,D,Q} instruction.

Definition at line 234 of file X86SelectionDAGInfo.cpp.

References AbstractManglingParser< Derived, Alloc >::Ops, llvm::SelectionDAG::getCopyToReg(), llvm::SelectionDAG::getNode(), llvm::SDValue::getValue(), llvm::SelectionDAG::getValueType(), llvm::SelectionDAG::getVTList(), llvm::X86Subtarget::isTarget64BitLP64(), llvm::X86ISD::REP_MOVS, and Size.

Referenced by emitConstantSizeRepmov(), emitRepmovsB(), and llvm::X86SelectionDAGInfo::EmitTargetCodeForMemcpy().

emitRepmovsB()

emitRepstos()

Emit a single REP STOSB instruction for a particular constant size.

Definition at line 74 of file X86SelectionDAGInfo.cpp.

References AbstractManglingParser< Derived, Alloc >::Ops, llvm::SelectionDAG::getCopyToReg(), llvm::SelectionDAG::getNode(), llvm::MVT::getSizeInBits(), llvm::SDValue::getValue(), llvm::SelectionDAG::getValueType(), llvm::SelectionDAG::getVTList(), llvm::X86Subtarget::isTarget64BitLP64(), llvm::X86ISD::REP_STOS, and Size.

Referenced by emitConstantSizeRepstos(), and emitRepstosB().

emitRepstosB()

getOptimalRepType()

UseFSRMForMemcpy

cl::opt< bool > UseFSRMForMemcpy("x86-use-fsrm-for-memcpy", cl::Hidden, cl::init(false), cl::desc("Use fast short rep mov in memcpy lowering")) ( "x86-use-fsrm-for-memcpy" , cl::Hidden , cl::init(false) , cl::desc("Use fast short rep mov in memcpy lowering") ) static