2017-12-20 20:36:28 +01:00
|
|
|
//===- SDNodeProperties.cpp -----------------------------------------------===//
|
|
|
|
//
|
2019-01-19 09:50:56 +01:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2017-12-20 20:36:28 +01:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "SDNodeProperties.h"
|
|
|
|
#include "llvm/TableGen/Error.h"
|
|
|
|
#include "llvm/TableGen/Record.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
unsigned llvm::parseSDPatternOperatorProperties(Record *R) {
|
|
|
|
unsigned Properties = 0;
|
|
|
|
for (Record *Property : R->getValueAsListOfDefs("Properties")) {
|
|
|
|
if (Property->getName() == "SDNPCommutative") {
|
|
|
|
Properties |= 1 << SDNPCommutative;
|
|
|
|
} else if (Property->getName() == "SDNPAssociative") {
|
|
|
|
Properties |= 1 << SDNPAssociative;
|
|
|
|
} else if (Property->getName() == "SDNPHasChain") {
|
|
|
|
Properties |= 1 << SDNPHasChain;
|
|
|
|
} else if (Property->getName() == "SDNPOutGlue") {
|
|
|
|
Properties |= 1 << SDNPOutGlue;
|
|
|
|
} else if (Property->getName() == "SDNPInGlue") {
|
|
|
|
Properties |= 1 << SDNPInGlue;
|
|
|
|
} else if (Property->getName() == "SDNPOptInGlue") {
|
|
|
|
Properties |= 1 << SDNPOptInGlue;
|
|
|
|
} else if (Property->getName() == "SDNPMayStore") {
|
|
|
|
Properties |= 1 << SDNPMayStore;
|
|
|
|
} else if (Property->getName() == "SDNPMayLoad") {
|
|
|
|
Properties |= 1 << SDNPMayLoad;
|
|
|
|
} else if (Property->getName() == "SDNPSideEffect") {
|
|
|
|
Properties |= 1 << SDNPSideEffect;
|
|
|
|
} else if (Property->getName() == "SDNPMemOperand") {
|
|
|
|
Properties |= 1 << SDNPMemOperand;
|
|
|
|
} else if (Property->getName() == "SDNPVariadic") {
|
|
|
|
Properties |= 1 << SDNPVariadic;
|
|
|
|
} else {
|
[tablegen] Add locations to many PrintFatalError() calls
Summary:
While working on the GISel Combiner, I noticed I was producing location-less
error messages fairly often and set about fixing this. In the process, I
noticed quite a few places elsewhere in TableGen that also neglected to include
a relevant location.
This patch adds locations to errors that relate to a specific record (or a
field within it) and also have easy access to the relevant location. This is
particularly useful when multiclasses are involved as many of these errors
refer to the full name of a record and it's difficult to guess which substring
is grep-able.
Unfortunately, tablegen currently only supports Record granularity so it's not
currently possible to point at a specific Init so these sometimes point at the
record that caused the error rather than the precise origin of the error.
Reviewers: bogner, aditya_nandakumar, volkan, aemerson, paquette, nhaehnle
Reviewed By: nhaehnle
Subscribers: jdoerfert, nhaehnle, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58077
llvm-svn: 353862
2019-02-12 18:36:57 +01:00
|
|
|
PrintFatalError(R->getLoc(), "Unknown SD Node property '" +
|
|
|
|
Property->getName() + "' on node '" +
|
|
|
|
R->getName() + "'!");
|
2017-12-20 20:36:28 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return Properties;
|
|
|
|
}
|