• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- SDNodeProperties.cpp -----------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "SDNodeProperties.h"
11 #include "llvm/TableGen/Error.h"
12 #include "llvm/TableGen/Record.h"
13 
14 using namespace llvm;
15 
parseSDPatternOperatorProperties(Record * R)16 unsigned llvm::parseSDPatternOperatorProperties(Record *R) {
17   unsigned Properties = 0;
18   for (Record *Property : R->getValueAsListOfDefs("Properties")) {
19     if (Property->getName() == "SDNPCommutative") {
20       Properties |= 1 << SDNPCommutative;
21     } else if (Property->getName() == "SDNPAssociative") {
22       Properties |= 1 << SDNPAssociative;
23     } else if (Property->getName() == "SDNPHasChain") {
24       Properties |= 1 << SDNPHasChain;
25     } else if (Property->getName() == "SDNPOutGlue") {
26       Properties |= 1 << SDNPOutGlue;
27     } else if (Property->getName() == "SDNPInGlue") {
28       Properties |= 1 << SDNPInGlue;
29     } else if (Property->getName() == "SDNPOptInGlue") {
30       Properties |= 1 << SDNPOptInGlue;
31     } else if (Property->getName() == "SDNPMayStore") {
32       Properties |= 1 << SDNPMayStore;
33     } else if (Property->getName() == "SDNPMayLoad") {
34       Properties |= 1 << SDNPMayLoad;
35     } else if (Property->getName() == "SDNPSideEffect") {
36       Properties |= 1 << SDNPSideEffect;
37     } else if (Property->getName() == "SDNPMemOperand") {
38       Properties |= 1 << SDNPMemOperand;
39     } else if (Property->getName() == "SDNPVariadic") {
40       Properties |= 1 << SDNPVariadic;
41     } else {
42       PrintFatalError("Unknown SD Node property '" +
43                       Property->getName() + "' on node '" +
44                       R->getName() + "'!");
45     }
46   }
47 
48   return Properties;
49 }
50