1 //===- SDNodeProperties.cpp -----------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #include "SDNodeProperties.h"
10 #include "llvm/ADT/StringSwitch.h"
11 #include "llvm/TableGen/Error.h"
12 #include "llvm/TableGen/Record.h"
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
)
33 Properties
|= 1 << Offset
;
35 PrintFatalError(R
->getLoc(), "Unknown SD Node property '" +
36 Property
->getName() + "' on node '" +