diff options
author | Dan Gohman <gohman@apple.com> | 2008-09-27 23:53:14 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-09-27 23:53:14 +0000 |
commit | 31bd42bc63ea4fc5f2898905d6da46d165872b05 (patch) | |
tree | 5ac8cec3c87cb32f8c6009b749d42b87787cc71c /utils | |
parent | 7a3ec1e148c4985775588949d03d9d4d108dec6d (diff) | |
download | external_llvm-31bd42bc63ea4fc5f2898905d6da46d165872b05.zip external_llvm-31bd42bc63ea4fc5f2898905d6da46d165872b05.tar.gz external_llvm-31bd42bc63ea4fc5f2898905d6da46d165872b05.tar.bz2 |
Move the code that handles DAGISel error conditions into
helper functions instead of duplicating it inline each time
it is needed. This eliminates a few hundred or so copies
of this code in each target.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56759 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/TableGen/DAGISelEmitter.cpp | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp index 44b6d75..343d39d 100644 --- a/utils/TableGen/DAGISelEmitter.cpp +++ b/utils/TableGen/DAGISelEmitter.cpp @@ -1832,20 +1832,15 @@ void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) { // If the last pattern has predicates (which could fail) emit code to // catch the case where nothing handles a pattern. if (mightNotMatch) { - OS << " cerr << \"Cannot yet select: \";\n"; + OS << "\n"; if (OpName != "ISD::INTRINSIC_W_CHAIN" && OpName != "ISD::INTRINSIC_WO_CHAIN" && - OpName != "ISD::INTRINSIC_VOID") { - OS << " N.getNode()->dump(CurDAG);\n"; - } else { - OS << " unsigned iid = cast<ConstantSDNode>(N.getOperand(" - "N.getOperand(0).getValueType() == MVT::Other))->getZExtValue();\n" - << " cerr << \"intrinsic %\"<< " - "Intrinsic::getName((Intrinsic::ID)iid);\n"; - } - OS << " cerr << '\\n';\n" - << " abort();\n" - << " return NULL;\n"; + OpName != "ISD::INTRINSIC_VOID") + OS << " CannotYetSelect(N);\n"; + else + OS << " CannotYetSelectIntrinsic(N);\n"; + + OS << " return NULL;\n"; } OS << "}\n\n"; } @@ -1896,9 +1891,7 @@ void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) { << " SDValue N1 = N.getOperand(1);\n" << " SDValue N2 = N.getOperand(2);\n" << " if (!isa<FrameIndexSDNode>(N1) || !isa<GlobalAddressSDNode>(N2)) {\n" - << " cerr << \"Cannot yet select llvm.dbg.declare: \";\n" - << " N.getNode()->dump(CurDAG);\n" - << " abort();\n" + << " CannotYetSelect(N);\n" << " }\n" << " int FI = cast<FrameIndexSDNode>(N1)->getIndex();\n" << " GlobalValue *GV = cast<GlobalAddressSDNode>(N2)->getGlobal();\n" @@ -1976,7 +1969,6 @@ void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) { << " case ISD::INSERT_SUBREG: return Select_INSERT_SUBREG(N);\n" << " case ISD::UNDEF: return Select_UNDEF(N);\n"; - // Loop over all of the case statements, emiting a call to each method we // emitted above. for (std::map<std::string, std::vector<const PatternToMatch*> >::iterator @@ -2029,22 +2021,32 @@ void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) { } OS << " } // end of big switch.\n\n" - << " cerr << \"Cannot yet select: \";\n" << " if (N.getOpcode() != ISD::INTRINSIC_W_CHAIN &&\n" << " N.getOpcode() != ISD::INTRINSIC_WO_CHAIN &&\n" << " N.getOpcode() != ISD::INTRINSIC_VOID) {\n" - << " N.getNode()->dump(CurDAG);\n" + << " CannotYetSelect(N);\n" << " } else {\n" - << " unsigned iid = cast<ConstantSDNode>(N.getOperand(" - "N.getOperand(0).getValueType() == " - "MVT::Other))->getZExtValue();\n" - << " cerr << \"intrinsic %\"<< " - "Intrinsic::getName((Intrinsic::ID)iid);\n" + << " CannotYetSelectIntrinsic(N);\n" << " }\n" + << " return NULL;\n" + << "}\n\n"; + + OS << "void CannotYetSelect(SDValue N) DISABLE_INLINE {\n" + << " cerr << \"Cannot yet select: \";\n" + << " N.getNode()->dump(CurDAG);\n" << " cerr << '\\n';\n" << " abort();\n" - << " return NULL;\n" - << "}\n"; + << "}\n\n"; + + OS << "void CannotYetSelectIntrinsic(SDValue N) DISABLE_INLINE {\n" + << " cerr << \"Cannot yet select: \";\n" + << " unsigned iid = cast<ConstantSDNode>(N.getOperand(" + << "N.getOperand(0).getValueType() == MVT::Other))->getZExtValue();\n" + << " cerr << \"intrinsic %\"<< " + << "Intrinsic::getName((Intrinsic::ID)iid);\n" + << " cerr << '\\n';\n" + << " abort();\n" + << "}\n\n"; } void DAGISelEmitter::run(std::ostream &OS) { |