blob: 2ddb42c95397664dcf82c7d4d54c9195b6c3ccc6 [file] [log] [blame]
Dan Gohman9becddd2010-04-16 23:04:22 +00001//===-- 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//
Benjamin Kramerf9172fd42016-01-27 16:32:26 +000010// This file defines the ARM subclass for SelectionDAGTargetInfo.
Dan Gohman9becddd2010-04-16 23:04:22 +000011//
12//===----------------------------------------------------------------------===//
13
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000014#ifndef LLVM_LIB_TARGET_ARM_ARMSELECTIONDAGINFO_H
15#define LLVM_LIB_TARGET_ARM_ARMSELECTIONDAGINFO_H
Dan Gohman9becddd2010-04-16 23:04:22 +000016
Evan Chenga20cde32011-07-20 23:34:39 +000017#include "MCTargetDesc/ARMAddressingModes.h"
Benjamin Kramer391be792016-01-27 19:29:56 +000018#include "llvm/CodeGen/RuntimeLibcalls.h"
Benjamin Kramerf9172fd42016-01-27 16:32:26 +000019#include "llvm/CodeGen/SelectionDAGTargetInfo.h"
Dan Gohman9becddd2010-04-16 23:04:22 +000020
21namespace llvm {
22
Evan Chenga20cde32011-07-20 23:34:39 +000023namespace ARM_AM {
24 static inline ShiftOpc getShiftOpcForNode(unsigned Opcode) {
25 switch (Opcode) {
26 default: return ARM_AM::no_shift;
27 case ISD::SHL: return ARM_AM::lsl;
28 case ISD::SRL: return ARM_AM::lsr;
29 case ISD::SRA: return ARM_AM::asr;
30 case ISD::ROTR: return ARM_AM::ror;
31 //case ISD::ROTL: // Only if imm -> turn into ROTR.
32 // Can't handle RRX here, because it would require folding a flag into
33 // the addressing mode. :( This causes us to miss certain things.
34 //case ARMISD::RRX: return ARM_AM::rrx;
35 }
36 }
37} // end namespace ARM_AM
38
Benjamin Kramerf9172fd42016-01-27 16:32:26 +000039class ARMSelectionDAGInfo : public SelectionDAGTargetInfo {
Dan Gohman9becddd2010-04-16 23:04:22 +000040public:
Benjamin Kramerbdc49562016-06-12 15:39:02 +000041 SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, const SDLoc &dl,
42 SDValue Chain, SDValue Dst, SDValue Src,
43 SDValue Size, unsigned Align, bool isVolatile,
44 bool AlwaysInline,
Chris Lattner2510de22010-09-21 05:40:29 +000045 MachinePointerInfo DstPtrInfo,
Craig Topper6bc27bf2014-03-10 02:09:33 +000046 MachinePointerInfo SrcPtrInfo) const override;
Renato Golin4cd51872011-05-22 21:41:23 +000047
Benjamin Kramerbdc49562016-06-12 15:39:02 +000048 SDValue
49 EmitTargetCodeForMemmove(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain,
50 SDValue Dst, SDValue Src, SDValue Size,
51 unsigned Align, bool isVolatile,
52 MachinePointerInfo DstPtrInfo,
53 MachinePointerInfo SrcPtrInfo) const override;
John Brawn70605f72015-05-12 13:13:38 +000054
Renato Golin4cd51872011-05-22 21:41:23 +000055 // Adjust parameters for memset, see RTABI section 4.3.4
Benjamin Kramerbdc49562016-06-12 15:39:02 +000056 SDValue EmitTargetCodeForMemset(SelectionDAG &DAG, const SDLoc &dl,
57 SDValue Chain, SDValue Op1, SDValue Op2,
58 SDValue Op3, unsigned Align, bool isVolatile,
Craig Topper6bc27bf2014-03-10 02:09:33 +000059 MachinePointerInfo DstPtrInfo) const override;
John Brawn70605f72015-05-12 13:13:38 +000060
Benjamin Kramerbdc49562016-06-12 15:39:02 +000061 SDValue EmitSpecializedLibcall(SelectionDAG &DAG, const SDLoc &dl,
62 SDValue Chain, SDValue Dst, SDValue Src,
John Brawn70605f72015-05-12 13:13:38 +000063 SDValue Size, unsigned Align,
64 RTLIB::Libcall LC) const;
Dan Gohman9becddd2010-04-16 23:04:22 +000065};
66
Alexander Kornienkof00654e2015-06-23 09:49:53 +000067}
Dan Gohman9becddd2010-04-16 23:04:22 +000068
69#endif