mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-15 22:28:18 +00:00
collect commutativity information
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23499 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -137,6 +137,22 @@ SDNodeInfo::SDNodeInfo(Record *R) : Def(R) {
|
|||||||
NumResults = TypeProfile->getValueAsInt("NumResults");
|
NumResults = TypeProfile->getValueAsInt("NumResults");
|
||||||
NumOperands = TypeProfile->getValueAsInt("NumOperands");
|
NumOperands = TypeProfile->getValueAsInt("NumOperands");
|
||||||
|
|
||||||
|
// Parse the properties.
|
||||||
|
Properties = 0;
|
||||||
|
ListInit *LI = R->getValueAsListInit("Properties");
|
||||||
|
for (unsigned i = 0, e = LI->getSize(); i != e; ++i) {
|
||||||
|
DefInit *DI = dynamic_cast<DefInit*>(LI->getElement(i));
|
||||||
|
assert(DI && "Properties list must be list of defs!");
|
||||||
|
if (DI->getDef()->getName() == "SDNPCommutative") {
|
||||||
|
Properties |= 1 << SDNPCommutative;
|
||||||
|
} else {
|
||||||
|
std::cerr << "Unknown SD Node property '" << DI->getDef()->getName()
|
||||||
|
<< "' on node '" << R->getName() << "'!\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Parse the type constraints.
|
// Parse the type constraints.
|
||||||
ListInit *Constraints = TypeProfile->getValueAsListInit("Constraints");
|
ListInit *Constraints = TypeProfile->getValueAsListInit("Constraints");
|
||||||
for (unsigned i = 0, e = Constraints->getSize(); i != e; ++i) {
|
for (unsigned i = 0, e = Constraints->getSize(); i != e; ++i) {
|
||||||
|
@@ -69,6 +69,7 @@ namespace llvm {
|
|||||||
Record *Def;
|
Record *Def;
|
||||||
std::string EnumName;
|
std::string EnumName;
|
||||||
std::string SDClassName;
|
std::string SDClassName;
|
||||||
|
unsigned Properties;
|
||||||
unsigned NumResults;
|
unsigned NumResults;
|
||||||
int NumOperands;
|
int NumOperands;
|
||||||
std::vector<SDTypeConstraint> TypeConstraints;
|
std::vector<SDTypeConstraint> TypeConstraints;
|
||||||
@@ -85,6 +86,13 @@ namespace llvm {
|
|||||||
return TypeConstraints;
|
return TypeConstraints;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SelectionDAG node properties.
|
||||||
|
enum SDNP { SDNPCommutative };
|
||||||
|
|
||||||
|
/// hasProperty - Return true if this node has the specified property.
|
||||||
|
///
|
||||||
|
bool hasProperty(enum SDNP Prop) const { return Properties & (1 << Prop); }
|
||||||
|
|
||||||
/// ApplyTypeConstraints - Given a node in a pattern, apply the type
|
/// ApplyTypeConstraints - Given a node in a pattern, apply the type
|
||||||
/// constraints for this node to the operands of the node. This returns
|
/// constraints for this node to the operands of the node. This returns
|
||||||
/// true if it makes a change, false otherwise. If a type contradiction is
|
/// true if it makes a change, false otherwise. If a type contradiction is
|
||||||
|
Reference in New Issue
Block a user