blob: 04be3d7d21ee6a5cc4d9c318c28e8f0aeedb2828 [file] [log] [blame]
Dan Gohman10e730a2015-06-29 23:51:55 +00001//===-- WebAssemblySelectionDAGInfo.cpp - WebAssembly SelectionDAG Info ---===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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
Dan Gohman10e730a2015-06-29 23:51:55 +00006//
7//===----------------------------------------------------------------------===//
8///
9/// \file
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000010/// This file implements the WebAssemblySelectionDAGInfo class.
Dan Gohman10e730a2015-06-29 23:51:55 +000011///
12//===----------------------------------------------------------------------===//
13
14#include "WebAssemblyTargetMachine.h"
15using namespace llvm;
16
17#define DEBUG_TYPE "wasm-selectiondag-info"
18
Heejin Ahn18c56a02019-02-04 19:13:39 +000019WebAssemblySelectionDAGInfo::~WebAssemblySelectionDAGInfo() = default; // anchor
Thomas Livelyd99af232019-02-05 00:49:55 +000020
21SDValue WebAssemblySelectionDAGInfo::EmitTargetCodeForMemcpy(
22 SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Op1, SDValue Op2,
Thomas Lively31505662019-02-05 20:57:40 +000023 SDValue Op3, unsigned Align, bool IsVolatile, bool AlwaysInline,
Thomas Livelyd99af232019-02-05 00:49:55 +000024 MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo) const {
25 if (!DAG.getMachineFunction()
26 .getSubtarget<WebAssemblySubtarget>()
27 .hasBulkMemory())
28 return SDValue();
29
30 return DAG.getNode(WebAssemblyISD::MEMORY_COPY, DL, MVT::Other, Chain, Op1,
31 Op2, Op3);
32}
Thomas Lively31505662019-02-05 20:57:40 +000033
34SDValue WebAssemblySelectionDAGInfo::EmitTargetCodeForMemmove(
35 SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Op1, SDValue Op2,
36 SDValue Op3, unsigned Align, bool IsVolatile,
37 MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo) const {
38 return EmitTargetCodeForMemcpy(DAG, DL, Chain, Op1, Op2, Op3, Align,
39 IsVolatile, false, DstPtrInfo,
40 SrcPtrInfo);
41}