diff options
author | Mikhail Glushenkov <foldr@codedgers.com> | 2010-08-23 19:24:08 +0000 |
---|---|---|
committer | Mikhail Glushenkov <foldr@codedgers.com> | 2010-08-23 19:24:08 +0000 |
commit | bf38e0749d83988140fac15b7c55050a089db159 (patch) | |
tree | cf9197727464241243fcc801f9d52acf85186377 /llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp | |
parent | 0e6cfd74919c8573fa71cf5aabb86c38a7420ebf (diff) | |
download | bcm5719-llvm-bf38e0749d83988140fac15b7c55050a089db159.tar.gz bcm5719-llvm-bf38e0749d83988140fac15b7c55050a089db159.zip |
llvmc: Properly handle (error) in edge properties.
llvm-svn: 111827
Diffstat (limited to 'llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp')
-rw-r--r-- | llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp b/llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp index 3aa94aaadbd..6927b01bd40 100644 --- a/llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp +++ b/llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp @@ -1950,7 +1950,6 @@ struct ActionHandlingCallbackBase /// EmitActionHandlersCallback - Emit code that handles actions. Used by /// EmitGenerateActionMethod() as an argument to EmitCaseConstructHandler(). - class EmitActionHandlersCallback; typedef void (EmitActionHandlersCallback::* EmitActionHandlersCallbackHandler) @@ -2649,21 +2648,18 @@ void EmitPopulateLanguageMap (const RecordKeeper& Records, raw_ostream& O) O << "}\n\n"; } -/// IncDecWeight - Helper function passed to EmitCaseConstructHandler() -/// by EmitEdgeClass(). -void IncDecWeight (const Init* i, unsigned IndentLevel, - raw_ostream& O) { +/// EmitEdgePropertyHandlerCallback - Emits code that handles edge +/// properties. Helper function passed to EmitCaseConstructHandler() by +/// EmitEdgeClass(). +void EmitEdgePropertyHandlerCallback (const Init* i, unsigned IndentLevel, + raw_ostream& O) { const DagInit& d = InitPtrToDag(i); const std::string& OpName = GetOperatorName(d); if (OpName == "inc_weight") { O.indent(IndentLevel) << "ret += "; } - else if (OpName == "dec_weight") { - O.indent(IndentLevel) << "ret -= "; - } else if (OpName == "error") { - // TODO: fix this CheckNumberOfArguments(d, 1); O.indent(IndentLevel) << "PrintError(\"" << InitPtrToString(d.getArg(0)) @@ -2696,11 +2692,12 @@ void EmitEdgeClass (unsigned N, const std::string& Target, // Function Weight(). O.indent(Indent1) - << "unsigned Weight(const InputLanguagesSet& InLangs) const {\n"; + << "int Weight(const InputLanguagesSet& InLangs) const {\n"; O.indent(Indent2) << "unsigned ret = 0;\n"; // Handle the 'case' construct. - EmitCaseConstructHandler(Case, Indent2, IncDecWeight, false, OptDescs, O); + EmitCaseConstructHandler(Case, Indent2, EmitEdgePropertyHandlerCallback, + false, OptDescs, O); O.indent(Indent2) << "return ret;\n"; O.indent(Indent1) << "}\n\n};\n\n"; |