| 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 | |
| 21 | namespace llvm { |
| 22 | namespace SystemZISD { |
| 23 | |
| 24 | enum 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. |
| 35 | inline bool isPCREL(unsigned Opcode) { |
| 36 | return Opcode == PCREL_WRAPPER || Opcode == PCREL_OFFSET; |
| 37 | } |
| 38 | |
| 39 | } // namespace SystemZISD |
| 40 | |
| 41 | class SystemZSelectionDAGInfo : public SelectionDAGGenTargetInfo { |
| 42 | public: |
| 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 Alignment, |
| 50 | bool IsVolatile, bool AlwaysInline, |
| 51 | MachinePointerInfo DstPtrInfo, |
| 52 | MachinePointerInfo SrcPtrInfo) const override; |
| 53 | |
| 54 | SDValue EmitTargetCodeForMemset(SelectionDAG &DAG, const SDLoc &DL, |
| 55 | SDValue Chain, SDValue Dst, SDValue Byte, |
| 56 | SDValue Size, Align Alignment, |
| 57 | bool IsVolatile, bool AlwaysInline, |
| 58 | MachinePointerInfo DstPtrInfo) const override; |
| 59 | |
| 60 | std::pair<SDValue, SDValue> |
| 61 | EmitTargetCodeForMemcmp(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, |
| 62 | SDValue Src1, SDValue Src2, SDValue Size, |
| 63 | const CallInst *CI) const override; |
| 64 | |
| 65 | std::pair<SDValue, SDValue> |
| 66 | EmitTargetCodeForMemchr(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, |
| 67 | SDValue Src, SDValue Char, SDValue Length, |
| 68 | MachinePointerInfo SrcPtrInfo) const override; |
| 69 | |
| 70 | std::pair<SDValue, SDValue> |
| 71 | EmitTargetCodeForStrcpy(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, |
| 72 | SDValue Dest, SDValue Src, |
| 73 | MachinePointerInfo DestPtrInfo, |
| 74 | MachinePointerInfo SrcPtrInfo, bool isStpcpy, |
| 75 | const CallInst *CI) const override; |
| 76 | |
| 77 | std::pair<SDValue, SDValue> EmitTargetCodeForStrcmp( |
| 78 | SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Src1, |
| 79 | SDValue Src2, MachinePointerInfo Op1PtrInfo, |
| 80 | MachinePointerInfo Op2PtrInfo, const CallInst *CI) const override; |
| 81 | |
| 82 | std::pair<SDValue, SDValue> |
| 83 | EmitTargetCodeForStrlen(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, |
| 84 | SDValue Src, const CallInst *CI) const override; |
| 85 | |
| 86 | std::pair<SDValue, SDValue> |
| 87 | EmitTargetCodeForStrnlen(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, |
| 88 | SDValue Src, SDValue MaxLength, |
| 89 | MachinePointerInfo SrcPtrInfo) const override; |
| 90 | }; |
| 91 | |
| 92 | } // end namespace llvm |
| 93 | |
| 94 | #endif |
| 95 | |