llvm-project/llvm/lib/Target/M68k/M68kSelectionDAGInfo.cpp
Sergei Barannikov e413343ca7
[SelectionDAG] Verify SDTCisVT and SDTCVecEltisVT constraints (#150125)
Teach `SDNodeInfoEmitter` TableGen backend to process `SDTypeConstraint`
records and emit tables for them. The tables are used by
`SDNodeInfo::verifyNode()` to validate a node being created.

This PR only adds validation code for `SDTCisVT` and `SDTCVecEltisVT`
constraints to keep it smaller.

Pull Request: https://github.com/llvm/llvm-project/pull/150125
2025-11-16 18:26:03 +03:00

35 lines
1.0 KiB
C++

//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "M68kSelectionDAGInfo.h"
#define GET_SDNODE_DESC
#include "M68kGenSDNodeInfo.inc"
using namespace llvm;
M68kSelectionDAGInfo::M68kSelectionDAGInfo()
: SelectionDAGGenTargetInfo(M68kGenSDNodeInfo) {}
void M68kSelectionDAGInfo::verifyTargetNode(const SelectionDAG &DAG,
const SDNode *N) const {
switch (N->getOpcode()) {
case M68kISD::ADD:
case M68kISD::SUBX:
// result #1 must have type i8, but has type i32
return;
case M68kISD::SETCC:
// operand #1 must have type i8, but has type i32
return;
}
SelectionDAGGenTargetInfo::verifyTargetNode(DAG, N);
}
M68kSelectionDAGInfo::~M68kSelectionDAGInfo() = default;