LLVM  9.0.0svn
Go to the documentation of this file.
1 //===-- AArch64SelectionDAGInfo.cpp - AArch64 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 AArch64SelectionDAGInfo class.
10 //
11 //===----------------------------------------------------------------------===//
13 #include "AArch64TargetMachine.h"
14 using namespace llvm;
16 #define DEBUG_TYPE "aarch64-selectiondag-info"
19  SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src,
20  SDValue Size, unsigned Align, bool isVolatile,
21  MachinePointerInfo DstPtrInfo) const {
22  // Check to see if there is a specialized entry-point for memory zeroing.
25  const AArch64Subtarget &STI =
27  const char *bzeroName = (V && V->isNullValue())
28  ? DAG.getTargetLoweringInfo().getLibcallName(RTLIB::BZERO) : nullptr;
29  // For small size (< 256), it is not beneficial to use bzero
30  // instead of memset.
31  if (bzeroName && (!SizeValue || SizeValue->getZExtValue() > 256)) {
32  const AArch64TargetLowering &TLI = *STI.getTargetLowering();
34  EVT IntPtr = TLI.getPointerTy(DAG.getDataLayout());
35  Type *IntPtrTy = DAG.getDataLayout().getIntPtrType(*DAG.getContext());
38  Entry.Node = Dst;
39  Entry.Ty = IntPtrTy;
40  Args.push_back(Entry);
41  Entry.Node = Size;
42  Args.push_back(Entry);
44  CLI.setDebugLoc(dl)
45  .setChain(Chain)
47  DAG.getExternalSymbol(bzeroName, IntPtr),
48  std::move(Args))
49  .setDiscardResult();
50  std::pair<SDValue, SDValue> CallResult = TLI.LowerCallTo(CLI);
51  return CallResult.second;
52  }
53  return SDValue();
54 }
56  CodeGenOpt::Level OptLevel) const {
57  return OptLevel >= CodeGenOpt::Aggressive;
58 }
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
This class represents lattice values for constants.
Definition: AllocatorList.h:23
CallLoweringInfo & setDebugLoc(const SDLoc &dl)
C - The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
SDValue getExternalSymbol(const char *Sym, EVT VT)
CallLoweringInfo & setChain(SDValue InChain)
const DataLayout & getDataLayout() const
Definition: SelectionDAG.h:403
MachineFunction & getMachineFunction() const
Definition: SelectionDAG.h:400
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...
Definition: DataLayout.cpp:769
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:45
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
bool generateFMAsInMachineCombiner(CodeGenOpt::Level OptLevel) const override
static Type * getVoidTy(LLVMContext &C)
Definition: Type.cpp:160
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...
std::vector< ArgListEntry > ArgListTy
Extended Value Type.
Definition: ValueTypes.h:33
This structure contains all information that is necessary for lowering calls.
This class contains a discriminated union of information about pointers in memory operands...
const TargetLowering & getTargetLoweringInfo() const
Definition: SelectionDAG.h:406
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
Definition: SelectionDAG.h:221
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
SDValue EmitTargetCodeForMemset(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, bool isVolatile, MachinePointerInfo DstPtrInfo) const override
Emit target-specific code that performs a memset.
std::pair< SDValue, SDValue > LowerCallTo(CallLoweringInfo &CLI) const
This function lowers an abstract call to a function into an actual call.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Definition: Casting.h:332
uint32_t Size
Definition: Profile.cpp:46
static bool isVolatile(Instruction *Inst)
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
LLVMContext * getContext() const
Definition: SelectionDAG.h:410
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
CallLoweringInfo & setLibCallee(CallingConv::ID CC, Type *ResultType, SDValue Target, ArgListTy &&ArgsList)
const char * getLibcallName(RTLIB::Libcall Call) const
Get the libcall routine name for the specified libcall.