[Frontend] Remove unused includes (NFC) (#116927)
[llvm-project.git] / llvm / utils / TableGen / Basic / SDNodeProperties.cpp
blob46babbbc41944635e4ca1a82eeb61f53111c4329
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/ADT/StringSwitch.h"
11 #include "llvm/TableGen/Error.h"
12 #include "llvm/TableGen/Record.h"
14 using namespace llvm;
16 unsigned llvm::parseSDPatternOperatorProperties(const Record *R) {
17 unsigned Properties = 0;
18 for (const Record *Property : R->getValueAsListOfDefs("Properties")) {
19 auto Offset = StringSwitch<unsigned>(Property->getName())
20 .Case("SDNPCommutative", SDNPCommutative)
21 .Case("SDNPAssociative", SDNPAssociative)
22 .Case("SDNPHasChain", SDNPHasChain)
23 .Case("SDNPOutGlue", SDNPOutGlue)
24 .Case("SDNPInGlue", SDNPInGlue)
25 .Case("SDNPOptInGlue", SDNPOptInGlue)
26 .Case("SDNPMayStore", SDNPMayStore)
27 .Case("SDNPMayLoad", SDNPMayLoad)
28 .Case("SDNPSideEffect", SDNPSideEffect)
29 .Case("SDNPMemOperand", SDNPMemOperand)
30 .Case("SDNPVariadic", SDNPVariadic)
31 .Default(-1u);
32 if (Offset != -1u)
33 Properties |= 1 << Offset;
34 else
35 PrintFatalError(R->getLoc(), "Unknown SD Node property '" +
36 Property->getName() + "' on node '" +
37 R->getName() + "'!");
39 return Properties;