[InstCombine] Signed saturation tests. NFC
[llvm-complete.git] / utils / TableGen / SDNodeProperties.cpp
blob1843a78aa3cf0b7254540d27b0eb439a8831443b
1 //===- SDNodeProperties.cpp -----------------------------------------------===//
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 //===----------------------------------------------------------------------===//
9 #include "SDNodeProperties.h"
10 #include "llvm/TableGen/Error.h"
11 #include "llvm/TableGen/Record.h"
13 using namespace llvm;
15 unsigned llvm::parseSDPatternOperatorProperties(Record *R) {
16 unsigned Properties = 0;
17 for (Record *Property : R->getValueAsListOfDefs("Properties")) {
18 if (Property->getName() == "SDNPCommutative") {
19 Properties |= 1 << SDNPCommutative;
20 } else if (Property->getName() == "SDNPAssociative") {
21 Properties |= 1 << SDNPAssociative;
22 } else if (Property->getName() == "SDNPHasChain") {
23 Properties |= 1 << SDNPHasChain;
24 } else if (Property->getName() == "SDNPOutGlue") {
25 Properties |= 1 << SDNPOutGlue;
26 } else if (Property->getName() == "SDNPInGlue") {
27 Properties |= 1 << SDNPInGlue;
28 } else if (Property->getName() == "SDNPOptInGlue") {
29 Properties |= 1 << SDNPOptInGlue;
30 } else if (Property->getName() == "SDNPMayStore") {
31 Properties |= 1 << SDNPMayStore;
32 } else if (Property->getName() == "SDNPMayLoad") {
33 Properties |= 1 << SDNPMayLoad;
34 } else if (Property->getName() == "SDNPSideEffect") {
35 Properties |= 1 << SDNPSideEffect;
36 } else if (Property->getName() == "SDNPMemOperand") {
37 Properties |= 1 << SDNPMemOperand;
38 } else if (Property->getName() == "SDNPVariadic") {
39 Properties |= 1 << SDNPVariadic;
40 } else {
41 PrintFatalError(R->getLoc(), "Unknown SD Node property '" +
42 Property->getName() + "' on node '" +
43 R->getName() + "'!");
47 return Properties;