LLVM 20.0.0git
Macros | Functions | Variables
X86SelectionDAGInfo.cpp File Reference
#include "X86SelectionDAGInfo.h"
#include "X86ISelLowering.h"
#include "X86InstrInfo.h"
#include "X86RegisterInfo.h"
#include "X86Subtarget.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/IR/DerivedTypes.h"

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.
 
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 MVT getOptimalRepmovsType (const X86Subtarget &Subtarget, Align Alignment)
 Returns the best type to use with repmovs depending on alignment.
 
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< boolUseFSRMForMemcpy ("x86-use-fsrm-for-memcpy", cl::Hidden, cl::init(false), cl::desc("Use fast short rep mov in memcpy lowering"))
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "x86-selectiondag-info"

Definition at line 25 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,
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.

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 207 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(), getOptimalRepmovsType(), llvm::MachinePointerInfo::getWithOffset(), llvm::Function::hasMinSize(), llvm::Offset, Results, Size, llvm::ISD::TokenFactor, and llvm::Align::value().

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 178 of file X86SelectionDAGInfo.cpp.

References emitRepmovs(), llvm::SelectionDAG::getIntPtrConstant(), and Size.

Referenced by emitConstantSizeRepmov().

◆ getOptimalRepmovsType()

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

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

Definition at line 186 of file X86SelectionDAGInfo.cpp.

References assert(), llvm::isPowerOf2_64(), and llvm::Align::value().

Referenced by emitConstantSizeRepmov().

Variable Documentation

◆ 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