[llvm-commits] CVS: llvm/utils/TableGen/IntrinsicEmitter.cpp
Jim Laskey
jlaskey at apple.com
Tue Feb 6 10:31:14 PST 2007
Changes in directory llvm/utils/TableGen:
IntrinsicEmitter.cpp updated: 1.23 -> 1.24
---
Log message:
Error check and eliminate unnecessary value.
---
Diffs of the changes: (+15 -8)
IntrinsicEmitter.cpp | 23 +++++++++++++++--------
1 files changed, 15 insertions(+), 8 deletions(-)
Index: llvm/utils/TableGen/IntrinsicEmitter.cpp
diff -u llvm/utils/TableGen/IntrinsicEmitter.cpp:1.23 llvm/utils/TableGen/IntrinsicEmitter.cpp:1.24
--- llvm/utils/TableGen/IntrinsicEmitter.cpp:1.23 Tue Feb 6 12:02:54 2007
+++ llvm/utils/TableGen/IntrinsicEmitter.cpp Tue Feb 6 12:30:58 2007
@@ -108,11 +108,8 @@
OS << "#endif\n\n";
}
-static void EmitTypeVerify(std::ostream &OS, Record *ArgType) {
- if (ArgType->getValueAsString("TypeVal") == "...") {
- OS << "-2, ";
- return;
- }
+static bool EmitTypeVerify(std::ostream &OS, Record *ArgType) {
+ if (ArgType->getValueAsString("TypeVal") == "...") return true;
OS << "(int)" << ArgType->getValueAsString("TypeVal") << ", ";
// If this is an integer type, check the width is correct.
@@ -124,6 +121,8 @@
EmitTypeVerify(OS, ArgType->getValueAsDef("ElTy"));
OS << ArgType->getValueAsInt("NumElts") << ", ";
}
+
+ return false;
}
/// RecordListComparator - Provide a determinstic comparator for lists of
@@ -172,9 +171,17 @@
const std::vector<Record*> &ArgTypes = I->first;
OS << " VerifyIntrinsicPrototype(IF, ";
- for (unsigned j = 0; j != ArgTypes.size(); ++j)
- EmitTypeVerify(OS, ArgTypes[j]);
- OS << "-1);\n";
+ bool VarArg = false;
+ for (unsigned j = 0; j != ArgTypes.size(); ++j) {
+ VarArg = EmitTypeVerify(OS, ArgTypes[j]);
+ if (VarArg) {
+ if ((j+1) != ArgTypes.size())
+ throw "Var arg type not last argument";
+ break;
+ }
+ }
+
+ OS << (VarArg ? "-2);\n" : "-1);\n");
OS << " break;\n";
}
OS << " }\n";
More information about the llvm-commits
mailing list