brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · 710d063 Raw
69 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9#include "NVPTXSelectionDAGInfo.h"10 11#define GET_SDNODE_DESC12#include "NVPTXGenSDNodeInfo.inc"13 14using namespace llvm;15 16NVPTXSelectionDAGInfo::NVPTXSelectionDAGInfo()17    : SelectionDAGGenTargetInfo(NVPTXGenSDNodeInfo) {}18 19NVPTXSelectionDAGInfo::~NVPTXSelectionDAGInfo() = default;20 21const char *NVPTXSelectionDAGInfo::getTargetNodeName(unsigned Opcode) const {22#define MAKE_CASE(V)                                                           \23  case V:                                                                      \24    return #V;25 26  // These nodes don't have corresponding entries in *.td files yet.27  switch (static_cast<NVPTXISD::NodeType>(Opcode)) {28    MAKE_CASE(NVPTXISD::ATOMIC_CMP_SWAP_B128)29    MAKE_CASE(NVPTXISD::ATOMIC_SWAP_B128)30    MAKE_CASE(NVPTXISD::LoadV2)31    MAKE_CASE(NVPTXISD::LoadV4)32    MAKE_CASE(NVPTXISD::LoadV8)33    MAKE_CASE(NVPTXISD::MLoad)34    MAKE_CASE(NVPTXISD::LDUV2)35    MAKE_CASE(NVPTXISD::LDUV4)36    MAKE_CASE(NVPTXISD::StoreV2)37    MAKE_CASE(NVPTXISD::StoreV4)38    MAKE_CASE(NVPTXISD::StoreV8)39    MAKE_CASE(NVPTXISD::SETP_F16X2)40    MAKE_CASE(NVPTXISD::SETP_BF16X2)41    MAKE_CASE(NVPTXISD::UNPACK_VECTOR)42  }43#undef MAKE_CASE44 45  return SelectionDAGGenTargetInfo::getTargetNodeName(Opcode);46}47 48bool NVPTXSelectionDAGInfo::isTargetMemoryOpcode(unsigned Opcode) const {49  // These nodes don't have corresponding entries in *.td files.50  if (Opcode >= NVPTXISD::FIRST_MEMORY_OPCODE &&51      Opcode <= NVPTXISD::LAST_MEMORY_OPCODE)52    return true;53 54  return SelectionDAGGenTargetInfo::isTargetMemoryOpcode(Opcode);55}56 57void NVPTXSelectionDAGInfo::verifyTargetNode(const SelectionDAG &DAG,58                                             const SDNode *N) const {59  switch (N->getOpcode()) {60  default:61    break;62  case NVPTXISD::ProxyReg:63    // invalid number of results; expected 2, got 164    return;65  }66 67  return SelectionDAGGenTargetInfo::verifyTargetNode(DAG, N);68}69