1//===-- SystemZSelectionDAGInfo.h - SystemZ SelectionDAG Info ---*- C++ -*-===//
2//
3// 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
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the SystemZ subclass for SelectionDAGTargetInfo.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZSELECTIONDAGINFO_H
14#define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZSELECTIONDAGINFO_H
15
16#include "llvm/CodeGen/SelectionDAGTargetInfo.h"
17
18#define GET_SDNODE_ENUM
19#include "SystemZGenSDNodeInfo.inc"
20
21namespace llvm {
22namespace SystemZISD {
23
24enum NodeType : unsigned {
25 // Set the condition code from a boolean value in operand 0.
26 // Operand 1 is a mask of all condition-code values that may result of this
27 // operation, operand 2 is a mask of condition-code values that may result
28 // if the boolean is true.
29 // Note that this operation is always optimized away, we will never
30 // generate any code for it.
31 GET_CCMASK = GENERATED_OPCODE_END,
32};
33
34// Return true if OPCODE is some kind of PC-relative address.
35inline bool isPCREL(unsigned Opcode) {
36 return Opcode == PCREL_WRAPPER || Opcode == PCREL_OFFSET;
37}
38
39} // namespace SystemZISD
40
41class SystemZSelectionDAGInfo : public SelectionDAGGenTargetInfo {
42public:
43 SystemZSelectionDAGInfo();
44
45 const char *getTargetNodeName(unsigned Opcode) const override;
46
47 SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, const SDLoc &DL,
48 SDValue Chain, SDValue Dst, SDValue Src,
49 SDValue Size, Align DstAlign, Align SrcAlign,
50 bool IsVolatile, bool AlwaysInline,
51 bool &IsTailCall,
52 MachinePointerInfo DstPtrInfo,
53 MachinePointerInfo SrcPtrInfo) const override;
54
55 SDValue
56 EmitTargetCodeForMemmove(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain,
57 SDValue Dst, SDValue Src, SDValue Size,
58 Align DstAlign, Align SrcAlign, bool IsVolatile,
59 bool &IsTailCall, MachinePointerInfo DstPtrInfo,
60 MachinePointerInfo SrcPtrInfo) const override;
61
62 SDValue EmitTargetCodeForMemset(SelectionDAG &DAG, const SDLoc &DL,
63 SDValue Chain, SDValue Dst, SDValue Byte,
64 SDValue Size, Align Alignment,
65 bool IsVolatile, bool AlwaysInline,
66 bool &IsTailCall,
67 MachinePointerInfo DstPtrInfo) const override;
68
69 std::pair<SDValue, SDValue>
70 EmitTargetCodeForMemcmp(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain,
71 SDValue Src1, SDValue Src2, SDValue Size,
72 const CallInst *CI) const override;
73
74 std::pair<SDValue, SDValue>
75 EmitTargetCodeForMemchr(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain,
76 SDValue Src, SDValue Char, SDValue Length,
77 MachinePointerInfo SrcPtrInfo) const override;
78
79 std::pair<SDValue, SDValue>
80 EmitTargetCodeForStrcpy(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain,
81 SDValue Dest, SDValue Src,
82 MachinePointerInfo DestPtrInfo,
83 MachinePointerInfo SrcPtrInfo, bool isStpcpy,
84 const CallInst *CI) const override;
85
86 std::pair<SDValue, SDValue> EmitTargetCodeForStrcmp(
87 SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Src1,
88 SDValue Src2, MachinePointerInfo Op1PtrInfo,
89 MachinePointerInfo Op2PtrInfo, const CallInst *CI) const override;
90
91 std::pair<SDValue, SDValue>
92 EmitTargetCodeForStrlen(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain,
93 SDValue Src, const CallInst *CI) const override;
94
95 std::pair<SDValue, SDValue>
96 EmitTargetCodeForStrnlen(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain,
97 SDValue Src, SDValue MaxLength,
98 MachinePointerInfo SrcPtrInfo) const override;
99};
100
101} // end namespace llvm
102
103#endif
104