8c2397b521882e0cce8adefcd249e266a4dda305
[oota-llvm.git] / lib / Target / ARM / ARMSelectionDAGInfo.h
1 //===-- ARMSelectionDAGInfo.h - ARM SelectionDAG Info -----------*- C++ -*-===//
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 defines the ARM subclass for TargetSelectionDAGInfo.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef ARMSELECTIONDAGINFO_H
15 #define ARMSELECTIONDAGINFO_H
16
17 #include "MCTargetDesc/ARMAddressingModes.h"
18 #include "llvm/Target/TargetSelectionDAGInfo.h"
19
20 namespace llvm {
21
22 namespace ARM_AM {
23   static inline ShiftOpc getShiftOpcForNode(unsigned Opcode) {
24     switch (Opcode) {
25     default:          return ARM_AM::no_shift;
26     case ISD::SHL:    return ARM_AM::lsl;
27     case ISD::SRL:    return ARM_AM::lsr;
28     case ISD::SRA:    return ARM_AM::asr;
29     case ISD::ROTR:   return ARM_AM::ror;
30     //case ISD::ROTL:  // Only if imm -> turn into ROTR.
31     // Can't handle RRX here, because it would require folding a flag into
32     // the addressing mode.  :(  This causes us to miss certain things.
33     //case ARMISD::RRX: return ARM_AM::rrx;
34     }
35   }
36 }  // end namespace ARM_AM
37
38 class ARMSelectionDAGInfo : public TargetSelectionDAGInfo {
39   /// Subtarget - Keep a pointer to the ARMSubtarget around so that we can
40   /// make the right decision when generating code for different targets.
41   const ARMSubtarget *Subtarget;
42
43 public:
44   explicit ARMSelectionDAGInfo(const TargetMachine &TM);
45   ~ARMSelectionDAGInfo();
46
47   SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, SDLoc dl,
48                                   SDValue Chain,
49                                   SDValue Dst, SDValue Src,
50                                   SDValue Size, unsigned Align,
51                                   bool isVolatile, bool AlwaysInline,
52                                   MachinePointerInfo DstPtrInfo,
53                                   MachinePointerInfo SrcPtrInfo) const override;
54
55   // Adjust parameters for memset, see RTABI section 4.3.4
56   SDValue EmitTargetCodeForMemset(SelectionDAG &DAG, SDLoc dl,
57                                   SDValue Chain,
58                                   SDValue Op1, SDValue Op2,
59                                   SDValue Op3, unsigned Align,
60                                   bool isVolatile,
61                                   MachinePointerInfo DstPtrInfo) const override;
62 };
63
64 }
65
66 #endif