LLVM  10.0.0svn
Macros | Functions
X86SelectionDAGInfo.cpp File Reference
#include "X86SelectionDAGInfo.h"
#include "X86ISelLowering.h"
#include "X86InstrInfo.h"
#include "X86RegisterInfo.h"
#include "X86Subtarget.h"
#include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/IR/DerivedTypes.h"
Include dependency graph for X86SelectionDAGInfo.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "x86-selectiondag-info"
 

Functions

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. More...
 
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. More...
 
static MVT getOptimalRepmovsType (const X86Subtarget &Subtarget, uint64_t Align)
 Returns the best type to use with repmovs depending on alignment. More...
 
static SDValue emitConstantSizeRepmov (SelectionDAG &DAG, const X86Subtarget &Subtarget, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, uint64_t Size, EVT SizeVT, unsigned Align, 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. More...
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "x86-selectiondag-info"

Definition at line 24 of file X86SelectionDAGInfo.cpp.

Function Documentation

◆ emitConstantSizeRepmov()

static SDValue emitConstantSizeRepmov ( SelectionDAG DAG,
const X86Subtarget Subtarget,
const SDLoc dl,
SDValue  Chain,
SDValue  Dst,
SDValue  Src,
uint64_t  Size,
EVT  SizeVT,
unsigned  Align,
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.

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.

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.

Definition at line 236 of file X86SelectionDAGInfo.cpp.

References llvm::ISD::ADD, llvm::AMDGPU::HSAMD::Kernel::Arg::Key::Align, assert(), emitRepmovs(), emitRepmovsB(), llvm::SelectionDAG::getConstant(), llvm::MachineFunction::getFunction(), llvm::SelectionDAG::getIntPtrConstant(), llvm::SelectionDAG::getMachineFunction(), llvm::X86Subtarget::getMaxInlineSizeThreshold(), llvm::SelectionDAG::getMemcpy(), llvm::SelectionDAG::getNode(), getOptimalRepmovsType(), llvm::MVT::getSizeInBits(), llvm::SDValue::getValueType(), llvm::MachinePointerInfo::getWithOffset(), llvm::X86Subtarget::hasERMSB(), llvm::Function::hasMinSize(), isVolatile(), llvm::MVT::Other, llvm::SmallVectorTemplateBase< T >::push_back(), Results, and llvm::ISD::TokenFactor.

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

◆ emitRepmovs()

static SDValue emitRepmovs ( const X86Subtarget Subtarget,
SelectionDAG DAG,
const SDLoc dl,
SDValue  Chain,
SDValue  Dst,
SDValue  Src,
SDValue  Size,
MVT  AVT 
)
static

◆ emitRepmovsB()

static SDValue emitRepmovsB ( const X86Subtarget Subtarget,
SelectionDAG DAG,
const SDLoc dl,
SDValue  Chain,
SDValue  Dst,
SDValue  Src,
uint64_t  Size 
)
static

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

Definition at line 208 of file X86SelectionDAGInfo.cpp.

References emitRepmovs(), llvm::SelectionDAG::getIntPtrConstant(), and llvm::MVT::i8.

Referenced by emitConstantSizeRepmov().

◆ getOptimalRepmovsType()

static MVT getOptimalRepmovsType ( const X86Subtarget Subtarget,
uint64_t  Align 
)
static

Returns the best type to use with repmovs depending on alignment.

Definition at line 216 of file X86SelectionDAGInfo.cpp.

References assert(), llvm::MVT::i16, llvm::MVT::i32, llvm::MVT::i64, llvm::MVT::i8, llvm::X86Subtarget::is64Bit(), and llvm::isPowerOf2_64().

Referenced by emitConstantSizeRepmov().