Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.0.0git
HexagonSelectionDAGInfo.cpp
Go to the documentation of this file.
1//===-- HexagonSelectionDAGInfo.cpp - Hexagon SelectionDAG Info -----------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file implements the HexagonSelectionDAGInfo class.
10//
11//===----------------------------------------------------------------------===//
12
15using namespace llvm;
16
17#define DEBUG_TYPE "hexagon-selectiondag-info"
18
20 SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src,
21 SDValue Size, Align Alignment, bool isVolatile, bool AlwaysInline,
22 MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo) const {
24 if (AlwaysInline || Alignment < Align(4) || !ConstantSize)
25 return SDValue();
26
27 uint64_t SizeVal = ConstantSize->getZExtValue();
28 if (SizeVal < 32 || (SizeVal % 8) != 0)
29 return SDValue();
30
31 // Special case aligned memcpys with size >= 32 bytes and a multiple of 8.
32 //
33 const TargetLowering &TLI = *DAG.getSubtarget().getTargetLowering();
35 Type *ArgTy = DAG.getDataLayout().getIntPtrType(*DAG.getContext());
36 Args.emplace_back(Dst, ArgTy);
37 Args.emplace_back(Src, ArgTy);
38 Args.emplace_back(Size, ArgTy);
39
40 const char *SpecialMemcpyName = TLI.getLibcallName(
41 RTLIB::HEXAGON_MEMCPY_LIKELY_ALIGNED_MIN32BYTES_MULT8BYTES);
42 const MachineFunction &MF = DAG.getMachineFunction();
43 bool LongCalls = MF.getSubtarget<HexagonSubtarget>().useLongCalls();
44 unsigned Flags = LongCalls ? HexagonII::HMOTF_ConstExtended : 0;
45
47 RTLIB::HEXAGON_MEMCPY_LIKELY_ALIGNED_MIN32BYTES_MULT8BYTES);
48
50 CLI.setDebugLoc(dl)
51 .setChain(Chain)
53 CC, Type::getVoidTy(*DAG.getContext()),
55 SpecialMemcpyName, TLI.getPointerTy(DAG.getDataLayout()), Flags),
56 std::move(Args))
58
59 std::pair<SDValue, SDValue> CallResult = TLI.LowerCallTo(CLI);
60 return CallResult.second;
61}
return SDValue()
uint64_t getZExtValue() const
LLVM_ABI IntegerType * getIntPtrType(LLVMContext &C, unsigned AddressSpace=0) const
Returns an integer type with size at least as big as that of a pointer in the given address space.
SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, Align Alignment, bool isVolatile, bool AlwaysInline, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo) const override
Emit target-specific code that performs a memcpy.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
const TargetSubtargetInfo & getSubtarget() const
const DataLayout & getDataLayout() const
MachineFunction & getMachineFunction() const
LLVMContext * getContext() const
LLVM_ABI SDValue getTargetExternalSymbol(const char *Sym, EVT VT, unsigned TargetFlags=0)
CallingConv::ID getLibcallCallingConv(RTLIB::Libcall Call) const
Get the CallingConv that should be used for the specified libcall.
virtual MVT getPointerTy(const DataLayout &DL, uint32_t AS=0) const
Return the pointer type for the given address space, defaults to the pointer type from the data layou...
const char * getLibcallName(RTLIB::Libcall Call) const
Get the libcall routine name for the specified libcall.
std::vector< ArgListEntry > ArgListTy
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
std::pair< SDValue, SDValue > LowerCallTo(CallLoweringInfo &CLI) const
This function lowers an abstract call to a function into an actual call.
virtual const TargetLowering * getTargetLowering() const
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:45
static LLVM_ABI Type * getVoidTy(LLVMContext &C)
Definition Type.cpp:281
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:649
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39
This class contains a discriminated union of information about pointers in memory operands,...
This structure contains all information that is necessary for lowering calls.
CallLoweringInfo & setLibCallee(CallingConv::ID CC, Type *ResultType, SDValue Target, ArgListTy &&ArgsList)
CallLoweringInfo & setDiscardResult(bool Value=true)
CallLoweringInfo & setDebugLoc(const SDLoc &dl)
CallLoweringInfo & setChain(SDValue InChain)