llvm.org GIT mirror llvm / 33a4004
restore some 'magic' code that I removed: it is needed. Add comments explaining why. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31743 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 14 years ago
1 changed file(s) with 22 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
36013601
36023602 // Print function.
36033603 std::string OpVTStr;
3604 if (OpVT == MVT::iPTR)
3605 OpVTStr = "iPTR";
3606 else
3607 OpVTStr = getEnumName(OpVT).substr(5); // Skip 'MVT::'
3604 if (OpVT == MVT::iPTR) {
3605 OpVTStr = "_iPTR";
3606 } else if (OpVT == MVT::isVoid) {
3607 // Nodes with a void result actually have a first result type of either
3608 // Other (a chain) or Flag. Since there is no one-to-one mapping from
3609 // void to this case, we handle it specially here.
3610 } else {
3611 OpVTStr = "_" + getEnumName(OpVT).substr(5); // Skip 'MVT::'
3612 }
36083613 std::map >::iterator OpVTI =
36093614 OpcodeVTMap.find(OpName);
36103615 if (OpVTI == OpcodeVTMap.end()) {
36153620 OpVTI->second.push_back(OpVTStr);
36163621
36173622 OS << "SDNode *Select_" << getLegalCName(OpName)
3618 << "_" << OpVTStr << "(const SDOperand &N) {\n";
3623 << OpVTStr << "(const SDOperand &N) {\n";
36193624
36203625 // Loop through and reverse all of the CodeList vectors, as we will be
36213626 // accessing them from their logical front, but accessing the end of a
37223727 if (OpVTs.size() == 1) {
37233728 std::string &VTStr = OpVTs[0];
37243729 OS << " return Select_" << getLegalCName(OpName)
3725 << (VTStr != "" ? "_" : "") << VTStr << "(N);\n";
3730 << VTStr << "(N);\n";
37263731 } else {
37273732 // Keep track of whether we see a pattern that has an iPtr result.
37283733 bool HasPtrPattern = false;
3734 bool HasDefaultPattern = false;
37293735
37303736 OS << " switch (NVT) {\n";
37313737 for (unsigned i = 0, e = OpVTs.size(); i < e; ++i) {
37323738 std::string &VTStr = OpVTs[i];
3733 assert(!VTStr.empty() && "Unset vtstr?");
3739 if (VTStr.empty()) {
3740 HasDefaultPattern = true;
3741 continue;
3742 }
37343743
37353744 // If this is a match on iPTR: don't emit it directly, we need special
37363745 // code.
3737 if (VTStr == "iPTR") {
3746 if (VTStr == "_iPTR") {
37383747 HasPtrPattern = true;
37393748 continue;
37403749 }
3741 OS << " case MVT::" << VTStr << ":\n"
3750 OS << " case MVT::" << VTStr.substr(1) << ":\n"
37423751 << " return Select_" << getLegalCName(OpName)
3743 << "_" << VTStr << "(N);\n";
3752 << VTStr << "(N);\n";
37443753 }
37453754 OS << " default:\n";
37463755
37483757 if (HasPtrPattern) {
37493758 OS << " if (NVT == TLI.getPointerTy())\n";
37503759 OS << " return Select_" << getLegalCName(OpName) <<"_iPTR(N);\n";
3760 }
3761 if (HasDefaultPattern) {
3762 OS << " return Select_" << getLegalCName(OpName) << "(N);\n";
37513763 }
37523764 OS << " break;\n";
37533765 OS << " }\n";