[llvm-commits] [llvm] r99009 - in /llvm/trunk/utils/TableGen: CodeGenDAGPatterns.cpp CodeGenTarget.cpp IntrinsicEmitter.cpp
Chris Lattner
sabre at nondot.org
Fri Mar 19 15:40:56 PDT 2010
Author: lattner
Date: Fri Mar 19 17:40:56 2010
New Revision: 99009
URL: http://llvm.org/viewvc/llvm-project?rev=99009&view=rev
Log:
Change intrinsic result type for void to store it as an empty list
instead of as a single element list with VoidTy.
Modified:
llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
llvm/trunk/utils/TableGen/CodeGenTarget.cpp
llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp
Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=99009&r1=99008&r2=99009&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Fri Mar 19 17:40:56 2010
@@ -754,12 +754,8 @@
Operator->getName() == "parallel")
return 0; // All return nothing.
- if (Operator->isSubClassOf("Intrinsic")) {
- unsigned NumRes = CDP.getIntrinsic(Operator).IS.RetVTs.size();
- if (NumRes == 1 && CDP.getIntrinsic(Operator).IS.RetVTs[0] == MVT::isVoid)
- return 0;
- return NumRes;
- }
+ if (Operator->isSubClassOf("Intrinsic"))
+ return CDP.getIntrinsic(Operator).IS.RetVTs.size();
if (Operator->isSubClassOf("SDNode"))
return CDP.getSDNodeInfo(Operator).getNumResults();
@@ -1210,8 +1206,6 @@
// Apply the result type to the node.
unsigned NumRetVTs = Int->IS.RetVTs.size();
unsigned NumParamVTs = Int->IS.ParamVTs.size();
- if (NumRetVTs == 1 && Int->IS.RetVTs[0] == MVT::isVoid)
- NumRetVTs = 0;
for (unsigned i = 0, e = NumRetVTs; i != e; ++i)
MadeChange |= UpdateNodeType(i, Int->IS.RetVTs[i], TP);
@@ -1591,7 +1585,7 @@
// If this intrinsic returns void, it must have side-effects and thus a
// chain.
- if (Int.IS.RetVTs[0] == MVT::isVoid) {
+ if (Int.IS.RetVTs.empty()) {
Operator = getDAGPatterns().get_intrinsic_void_sdnode();
} else if (Int.ModRef != CodeGenIntrinsic::NoMem) {
// Has side-effects, requires chain.
Modified: llvm/trunk/utils/TableGen/CodeGenTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenTarget.cpp?rev=99009&r1=99008&r2=99009&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenTarget.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenTarget.cpp Fri Mar 19 17:40:56 2010
@@ -490,12 +490,15 @@
OverloadedVTs.push_back(VT);
isOverloaded |= true;
}
+
IS.RetVTs.push_back(VT);
IS.RetTypeDefs.push_back(TyEl);
}
-
- if (IS.RetVTs.size() == 0)
- throw "Intrinsic '"+DefName+"' needs at least a type for the ret value!";
+
+ if (IS.RetVTs.size() == 1 && IS.RetVTs[0] == MVT::isVoid) {
+ IS.RetVTs.pop_back();
+ IS.RetTypeDefs.pop_back();
+ }
// Parse the list of parameter types.
TypeList = R->getValueAsListInit("ParamTypes");
Modified: llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp?rev=99009&r1=99008&r2=99009&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp Fri Mar 19 17:40:56 2010
@@ -172,10 +172,11 @@
static void EmitTypeGenerate(raw_ostream &OS,
const std::vector<Record*> &ArgTypes,
unsigned &ArgNo) {
- if (ArgTypes.size() == 1) {
- EmitTypeGenerate(OS, ArgTypes.front(), ArgNo);
- return;
- }
+ if (ArgTypes.empty())
+ return EmitTypeForValueType(OS, MVT::isVoid);
+
+ if (ArgTypes.size() == 1)
+ return EmitTypeGenerate(OS, ArgTypes.front(), ArgNo);
OS << "StructType::get(Context, ";
@@ -251,11 +252,11 @@
unsigned RHSSize = RHSVec->size();
unsigned LHSSize = LHSVec->size();
- do {
+ for (; i != LHSSize; ++i) {
if (i == RHSSize) return false; // RHS is shorter than LHS.
if ((*LHSVec)[i] != (*RHSVec)[i])
return (*LHSVec)[i]->getName() < (*RHSVec)[i]->getName();
- } while (++i != LHSSize);
+ }
if (i != RHSSize) return true;
More information about the llvm-commits
mailing list