Changes in directory llvm/utils/TableGen:
DAGISelEmitter.cpp updated: 1.109 -> 1.110 --- Log message: Eliminate some GCC warnings from the generated code --- Diffs of the changes: (+17 -9) DAGISelEmitter.cpp | 26 +++++++++++++++++--------- 1 files changed, 17 insertions(+), 9 deletions(-) Index: llvm/utils/TableGen/DAGISelEmitter.cpp diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.109 llvm/utils/TableGen/DAGISelEmitter.cpp:1.110 --- llvm/utils/TableGen/DAGISelEmitter.cpp:1.109 Tue Dec 20 14:08:01 2005 +++ llvm/utils/TableGen/DAGISelEmitter.cpp Tue Dec 20 23:31:05 2005 @@ -1770,18 +1770,24 @@ TreePatternNode *pattern, TreePatternNode *instr, unsigned PatNum, std::ostream &os) : ISE(ise), Predicates(preds), Pattern(pattern), Instruction(instr), - PatternNo(PatNum), OS(os), FoundChain(false), TmpNo(0) {}; + PatternNo(PatNum), OS(os), FoundChain(false), TmpNo(0) {} + /// isPredeclaredSDOperand - Return true if this is one of the predeclared + /// SDOperands. + bool isPredeclaredSDOperand(const std::string &OpName) const { + return OpName == "N0" || OpName == "N1" || OpName == "N2" || + OpName == "N00" || OpName == "N01" || + OpName == "N10" || OpName == "N11" || + OpName == "Tmp0" || OpName == "Tmp1" || + OpName == "Tmp2" || OpName == "Tmp3"; + } + /// DeclareSDOperand - Emit "SDOperand <opname>" or "<opname>". This works /// around an ugly GCC bug where SelectCode is using too much stack space void DeclareSDOperand(const std::string &OpName) const { // If it's one of the common cases declared at the top of SelectCode, just // use the existing declaration. - if (OpName == "N0" || OpName == "N1" || OpName == "N2" || - OpName == "N00" || OpName == "N01" || - OpName == "N10" || OpName == "N11" || - OpName == "Tmp0" || OpName == "Tmp1" || - OpName == "Tmp2" || OpName == "Tmp3") + if (isPredeclaredSDOperand(OpName)) OS << OpName; else OS << "SDOperand " << OpName; @@ -1986,9 +1992,11 @@ std::string Fn = CP->getSelectFunc(); NumRes = CP->getNumOperands(); for (unsigned i = 0; i != NumRes; ++i) { - OS << " "; - DeclareSDOperand("Tmp" + utostr(i+ResNo)); - OS << ";\n"; + if (!isPredeclaredSDOperand("Tmp" + utostr(i+ResNo))) { + OS << " "; + DeclareSDOperand("Tmp" + utostr(i+ResNo)); + OS << ";\n"; + } } OS << " if (!" << Fn << "(" << Val; for (unsigned i = 0; i < NumRes; i++) _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits