SDNodeProperties.cpp 1.9 KB

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