f66ffd284a930f7919aa0a940cd1bf2062b78679
[oota-llvm.git] / lib / Target / Hexagon / HexagonSelectionDAGInfo.cpp
1 //===-- HexagonSelectionDAGInfo.cpp - Hexagon 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 HexagonSelectionDAGInfo class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "HexagonTargetMachine.h"
15 using namespace llvm;
16
17 #define DEBUG_TYPE "hexagon-selectiondag-info"
18
19 bool llvm::flag_aligned_memcpy;
20
21 HexagonSelectionDAGInfo::HexagonSelectionDAGInfo(const HexagonTargetMachine &TM)
22     : TargetSelectionDAGInfo(TM.getDataLayout()) {}
23
24 HexagonSelectionDAGInfo::~HexagonSelectionDAGInfo() {
25 }
26
27 SDValue
28 HexagonSelectionDAGInfo::
29 EmitTargetCodeForMemcpy(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   flag_aligned_memcpy = false;
35   if ((Align & 0x3) == 0) {
36     ConstantSDNode *ConstantSize = dyn_cast<ConstantSDNode>(Size);
37     if (ConstantSize) {
38       uint64_t SizeVal = ConstantSize->getZExtValue();
39       if ((SizeVal > 32) && ((SizeVal % 8) == 0))
40         flag_aligned_memcpy = true;
41     }
42   }
43
44   return SDValue();
45 }