summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-12-21 05:31:05 +0000
committerChris Lattner <sabre@nondot.org>2005-12-21 05:31:05 +0000
commit812a56e888ff51fab96f2f7778928c0570f48e55 (patch)
treeaffef15299635c9e8964929e97d8f4ef04175e2a
parent72575d882b1ef67417ee7b16eeb735df617201e6 (diff)
downloadbcm5719-llvm-812a56e888ff51fab96f2f7778928c0570f48e55.tar.gz
bcm5719-llvm-812a56e888ff51fab96f2f7778928c0570f48e55.zip
Eliminate some GCC warnings from the generated code
llvm-svn: 24897
-rw-r--r--llvm/utils/TableGen/DAGISelEmitter.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/llvm/utils/TableGen/DAGISelEmitter.cpp b/llvm/utils/TableGen/DAGISelEmitter.cpp
index 80f226cd79f..be8fb75b43a 100644
--- a/llvm/utils/TableGen/DAGISelEmitter.cpp
+++ b/llvm/utils/TableGen/DAGISelEmitter.cpp
@@ -1770,18 +1770,24 @@ public:
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 @@ public:
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++)
OpenPOWER on IntegriCloud