SystemZSelectionDAGInfo.cpp revision dff0009d0ced62b92cb5900bc2203ec40142ba15
1//===-- SystemZSelectionDAGInfo.cpp - SystemZ SelectionDAG Info -----------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the SystemZSelectionDAGInfo class.
11//
12//===----------------------------------------------------------------------===//
13
14#define DEBUG_TYPE "systemz-selectiondag-info"
15#include "SystemZTargetMachine.h"
16#include "llvm/CodeGen/SelectionDAG.h"
17
18using namespace llvm;
19
20SystemZSelectionDAGInfo::
21SystemZSelectionDAGInfo(const SystemZTargetMachine &TM)
22  : TargetSelectionDAGInfo(TM) {
23}
24
25SystemZSelectionDAGInfo::~SystemZSelectionDAGInfo() {
26}
27
28SDValue SystemZSelectionDAGInfo::
29EmitTargetCodeForMemcpy(SelectionDAG &DAG, SDLoc DL, SDValue Chain,
30                        SDValue Dst, SDValue Src, SDValue Size, unsigned Align,
31                        bool IsVolatile, bool AlwaysInline,
32                        MachinePointerInfo DstPtrInfo,
33                        MachinePointerInfo SrcPtrInfo) const {
34  if (IsVolatile)
35    return SDValue();
36
37  if (ConstantSDNode *CSize = dyn_cast<ConstantSDNode>(Size)) {
38    uint64_t Bytes = CSize->getZExtValue();
39    if (Bytes >= 1 && Bytes <= 0x100) {
40      // A single MVC.
41      return DAG.getNode(SystemZISD::MVC, DL, MVT::Other,
42                         Chain, Dst, Src, Size);
43    }
44  }
45  return SDValue();
46}
47