blob: b8a86ae7310fafbafcfac6afca75e99fa252a379 [file] [log] [blame]
Dan Gohman9becddd2010-04-16 23:04:22 +00001//===-- ARMSelectionDAGInfo.h - ARM SelectionDAG Info -----------*- C++ -*-===//
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 Gohman9becddd2010-04-16 23:04:22 +00006//
7//===----------------------------------------------------------------------===//
8//
Benjamin Kramerf9172fd42016-01-27 16:32:26 +00009// This file defines the ARM subclass for SelectionDAGTargetInfo.
Dan Gohman9becddd2010-04-16 23:04:22 +000010//
11//===----------------------------------------------------------------------===//
12
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000013#ifndef LLVM_LIB_TARGET_ARM_ARMSELECTIONDAGINFO_H
14#define LLVM_LIB_TARGET_ARM_ARMSELECTIONDAGINFO_H
Dan Gohman9becddd2010-04-16 23:04:22 +000015
Evan Chenga20cde32011-07-20 23:34:39 +000016#include "MCTargetDesc/ARMAddressingModes.h"
Benjamin Kramer391be792016-01-27 19:29:56 +000017#include "llvm/CodeGen/RuntimeLibcalls.h"
Benjamin Kramerf9172fd42016-01-27 16:32:26 +000018#include "llvm/CodeGen/SelectionDAGTargetInfo.h"
Dan Gohman9becddd2010-04-16 23:04:22 +000019
20namespace llvm {
21
Evan Chenga20cde32011-07-20 23:34:39 +000022namespace 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
Benjamin Kramerf9172fd42016-01-27 16:32:26 +000038class ARMSelectionDAGInfo : public SelectionDAGTargetInfo {
Dan Gohman9becddd2010-04-16 23:04:22 +000039public:
Benjamin Kramerbdc49562016-06-12 15:39:02 +000040 SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, const SDLoc &dl,
41 SDValue Chain, SDValue Dst, SDValue Src,
42 SDValue Size, unsigned Align, bool isVolatile,
43 bool AlwaysInline,
Chris Lattner2510de22010-09-21 05:40:29 +000044 MachinePointerInfo DstPtrInfo,
Craig Topper6bc27bf2014-03-10 02:09:33 +000045 MachinePointerInfo SrcPtrInfo) const override;
Renato Golin4cd51872011-05-22 21:41:23 +000046
Benjamin Kramerbdc49562016-06-12 15:39:02 +000047 SDValue
48 EmitTargetCodeForMemmove(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain,
49 SDValue Dst, SDValue Src, SDValue Size,
50 unsigned Align, bool isVolatile,
51 MachinePointerInfo DstPtrInfo,
52 MachinePointerInfo SrcPtrInfo) const override;
John Brawn70605f72015-05-12 13:13:38 +000053
Renato Golin4cd51872011-05-22 21:41:23 +000054 // Adjust parameters for memset, see RTABI section 4.3.4
Benjamin Kramerbdc49562016-06-12 15:39:02 +000055 SDValue EmitTargetCodeForMemset(SelectionDAG &DAG, const SDLoc &dl,
56 SDValue Chain, SDValue Op1, SDValue Op2,
57 SDValue Op3, unsigned Align, bool isVolatile,
Craig Topper6bc27bf2014-03-10 02:09:33 +000058 MachinePointerInfo DstPtrInfo) const override;
John Brawn70605f72015-05-12 13:13:38 +000059
Benjamin Kramerbdc49562016-06-12 15:39:02 +000060 SDValue EmitSpecializedLibcall(SelectionDAG &DAG, const SDLoc &dl,
61 SDValue Chain, SDValue Dst, SDValue Src,
John Brawn70605f72015-05-12 13:13:38 +000062 SDValue Size, unsigned Align,
63 RTLIB::Libcall LC) const;
Dan Gohman9becddd2010-04-16 23:04:22 +000064};
65
Alexander Kornienkof00654e2015-06-23 09:49:53 +000066}
Dan Gohman9becddd2010-04-16 23:04:22 +000067
68#endif