summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2008-05-06 18:14:24 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2008-05-06 18:14:24 +0000
commitbb8b58dcf3e1994beb458e777b306fa3805ee50f (patch)
treece39b38a87d9e75b283bee66bc1df981082eab94 /utils
parentd83038c9605c84e92b6052500405ac3903f0d6f1 (diff)
downloadllvm-bb8b58dcf3e1994beb458e777b306fa3805ee50f.tar.gz
llvm-bb8b58dcf3e1994beb458e777b306fa3805ee50f.tar.bz2
llvm-bb8b58dcf3e1994beb458e777b306fa3805ee50f.tar.xz
Add weights to graph edges. Choose between edges based on their weight.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50757 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/LLVMCConfigurationEmitter.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/utils/TableGen/LLVMCConfigurationEmitter.cpp b/utils/TableGen/LLVMCConfigurationEmitter.cpp
index ab6f2efc48..3db9176396 100644
--- a/utils/TableGen/LLVMCConfigurationEmitter.cpp
+++ b/utils/TableGen/LLVMCConfigurationEmitter.cpp
@@ -974,9 +974,9 @@ void EmitEdgeClass(unsigned N, const std::string& Target,
<< Indent1 << "Edge" << N << "() : Edge(\"" << Target
<< "\") {}\n\n"
- // Function isEnabled().
- << Indent1 << "bool isEnabled() const {\n"
- << Indent2 << "bool ret = false;\n";
+ // Function Weight().
+ << Indent1 << "unsigned Weight() const {\n"
+ << Indent2 << "unsigned ret = 0;\n";
for (size_t i = 0, PropsSize = Props->size(); i < PropsSize; ++i) {
const DagInit& Prop = dynamic_cast<DagInit&>(*Props->getElement(i));
@@ -985,7 +985,7 @@ void EmitEdgeClass(unsigned N, const std::string& Target,
if (PropName == "default")
IsDefault = true;
- O << Indent2 << "if (ret || (";
+ O << Indent2 << "if ((";
if (PropName == "and") {
O << '(';
for (unsigned j = 0, NumArgs = Prop.getNumArgs(); j < NumArgs; ++j) {
@@ -1002,19 +1002,14 @@ void EmitEdgeClass(unsigned N, const std::string& Target,
else {
EmitEdgePropertyTest(PropName, Prop, OptDescs, O);
}
- O << "))\n" << Indent3 << "ret = true;\n";
+ O << "))\n" << Indent3 << "ret += 2;\n";
}
- O << Indent2 << "return ret;\n"
- << Indent1 << "};\n\n"
-
- // Function isDefault().
- << Indent1 << "bool isDefault() const { return ";
if (IsDefault)
- O << "true";
- else
- O << "false";
- O <<"; }\n};\n\n";
+ O << Indent2 << "ret += 1;\n";
+
+ O << Indent2 << "return ret;\n"
+ << Indent1 << "};\n\n};\n\n";
}
// Emit Edge* classes that represent graph edges.