| 1 | //===----------------------------------------------------------------------===// |
|---|---|
| 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 | #include "MipsSelectionDAGInfo.h" |
| 10 | |
| 11 | #define GET_SDNODE_DESC |
| 12 | #include "MipsGenSDNodeInfo.inc" |
| 13 | |
| 14 | using namespace llvm; |
| 15 | |
| 16 | MipsSelectionDAGInfo::MipsSelectionDAGInfo() |
| 17 | : SelectionDAGGenTargetInfo(MipsGenSDNodeInfo) {} |
| 18 | |
| 19 | MipsSelectionDAGInfo::~MipsSelectionDAGInfo() = default; |
| 20 | |
| 21 | const char *MipsSelectionDAGInfo::getTargetNodeName(unsigned Opcode) const { |
| 22 | // These nodes don't have corresponding entries in *.td files yet. |
| 23 | switch (static_cast<MipsISD::NodeType>(Opcode)) { |
| 24 | // clang-format off |
| 25 | case MipsISD::FAbs: return "MipsISD::FAbs"; |
| 26 | case MipsISD::DynAlloc: return "MipsISD::DynAlloc"; |
| 27 | case MipsISD::DOUBLE_SELECT_I: return "MipsISD::DOUBLE_SELECT_I"; |
| 28 | case MipsISD::DOUBLE_SELECT_I64: return "MipsISD::DOUBLE_SELECT_I64"; |
| 29 | // clang-format on |
| 30 | } |
| 31 | |
| 32 | return SelectionDAGGenTargetInfo::getTargetNodeName(Opcode); |
| 33 | } |
| 34 | |
| 35 | void MipsSelectionDAGInfo::verifyTargetNode(const SelectionDAG &DAG, |
| 36 | const SDNode *N) const { |
| 37 | switch (N->getOpcode()) { |
| 38 | default: |
| 39 | break; |
| 40 | case MipsISD::ERet: |
| 41 | // invalid number of operands; expected at most 2, got 3 |
| 42 | return; |
| 43 | } |
| 44 | |
| 45 | SelectionDAGGenTargetInfo::verifyTargetNode(DAG, N); |
| 46 | } |
| 47 |