diff options
Diffstat (limited to 'utils')
-rw-r--r-- | utils/TableGen/AsmWriterEmitter.cpp | 5 | ||||
-rw-r--r-- | utils/TableGen/CodeEmitterGen.cpp | 2 | ||||
-rw-r--r-- | utils/TableGen/CodeGenTarget.cpp | 5 | ||||
-rw-r--r-- | utils/TableGen/DAGISelEmitter.cpp | 89 | ||||
-rw-r--r-- | utils/TableGen/FileLexer.cpp.cvs | 106 | ||||
-rw-r--r-- | utils/TableGen/FileLexer.l | 20 | ||||
-rw-r--r-- | utils/TableGen/FileLexer.l.cvs | 20 | ||||
-rw-r--r-- | utils/TableGen/FileParser.cpp.cvs | 3636 | ||||
-rw-r--r-- | utils/TableGen/FileParser.h.cvs | 133 | ||||
-rw-r--r-- | utils/TableGen/FileParser.y | 3 | ||||
-rw-r--r-- | utils/TableGen/FileParser.y.cvs | 3 | ||||
-rw-r--r-- | utils/TableGen/InstrInfoEmitter.cpp | 4 | ||||
-rw-r--r-- | utils/TableGen/Record.cpp | 13 | ||||
-rw-r--r-- | utils/TableGen/Record.h | 2 | ||||
-rw-r--r-- | utils/TableGen/RegisterInfoEmitter.cpp | 13 | ||||
-rw-r--r-- | utils/TableGen/TableGen.cpp | 15 | ||||
-rw-r--r-- | utils/TableGen/TableGenBackend.cpp | 1 |
17 files changed, 2467 insertions, 1603 deletions
diff --git a/utils/TableGen/AsmWriterEmitter.cpp b/utils/TableGen/AsmWriterEmitter.cpp index c8af097250..24d2eef07a 100644 --- a/utils/TableGen/AsmWriterEmitter.cpp +++ b/utils/TableGen/AsmWriterEmitter.cpp @@ -19,7 +19,6 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/MathExtras.h" #include <algorithm> -#include <ostream> using namespace llvm; static bool isIdentChar(char C) { @@ -551,8 +550,8 @@ void AsmWriterEmitter::run(std::ostream &O) { // If we don't have enough bits for this operand, don't include it. if (NumBits > BitsLeft) { - DEBUG(std::cerr << "Not enough bits to densely encode " << NumBits - << " more bits\n"); + DOUT << "Not enough bits to densely encode " << NumBits + << " more bits\n"; break; } diff --git a/utils/TableGen/CodeEmitterGen.cpp b/utils/TableGen/CodeEmitterGen.cpp index c64b5f454d..861c6b0e34 100644 --- a/utils/TableGen/CodeEmitterGen.cpp +++ b/utils/TableGen/CodeEmitterGen.cpp @@ -214,7 +214,7 @@ void CodeEmitterGen::run(std::ostream &o) { // Default case: unhandled opcode o << " default:\n" - << " std::cerr << \"Not supported instr: \" << MI << \"\\n\";\n" + << " cerr << \"Not supported instr: \" << MI << \"\\n\";\n" << " abort();\n" << " }\n" << " return Value;\n" diff --git a/utils/TableGen/CodeGenTarget.cpp b/utils/TableGen/CodeGenTarget.cpp index a8d3abccaf..e6ac2c3573 100644 --- a/utils/TableGen/CodeGenTarget.cpp +++ b/utils/TableGen/CodeGenTarget.cpp @@ -19,6 +19,7 @@ #include "Record.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Streams.h" #include <set> #include <algorithm> using namespace llvm; @@ -527,8 +528,8 @@ ComplexPattern::ComplexPattern(Record *R) { } else if (PropList[i]->getName() == "SDNPOptInFlag") { Properties |= 1 << SDNPOptInFlag; } else { - std::cerr << "Unsupported SD Node property '" << PropList[i]->getName() - << "' on ComplexPattern '" << R->getName() << "'!\n"; + cerr << "Unsupported SD Node property '" << PropList[i]->getName() + << "' on ComplexPattern '" << R->getName() << "'!\n"; exit(1); } } diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp index 0b176088a0..08ac808833 100644 --- a/utils/TableGen/DAGISelEmitter.cpp +++ b/utils/TableGen/DAGISelEmitter.cpp @@ -16,6 +16,7 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/Support/Debug.h" #include "llvm/Support/MathExtras.h" +#include "llvm/Support/Streams.h" #include <algorithm> #include <set> using namespace llvm; @@ -109,7 +110,7 @@ SDTypeConstraint::SDTypeConstraint(Record *R) { x.SDTCisIntVectorOfSameSize_Info.OtherOperandNum = R->getValueAsInt("OtherOpNum"); } else { - std::cerr << "Unrecognized SDTypeConstraint '" << R->getName() << "'!\n"; + cerr << "Unrecognized SDTypeConstraint '" << R->getName() << "'!\n"; exit(1); } } @@ -123,9 +124,9 @@ TreePatternNode *SDTypeConstraint::getOperandNum(unsigned OpNo, "We only work with nodes with zero or one result so far!"); if (OpNo >= (NumResults + N->getNumChildren())) { - std::cerr << "Invalid operand number " << OpNo << " "; + cerr << "Invalid operand number " << OpNo << " "; N->dump(); - std::cerr << '\n'; + cerr << '\n'; exit(1); } @@ -316,8 +317,8 @@ SDNodeInfo::SDNodeInfo(Record *R) : Def(R) { } else if (PropList[i]->getName() == "SDNPOptInFlag") { Properties |= 1 << SDNPOptInFlag; } else { - std::cerr << "Unknown SD Node property '" << PropList[i]->getName() - << "' on node '" << R->getName() << "'!\n"; + cerr << "Unknown SD Node property '" << PropList[i]->getName() + << "' on node '" << R->getName() << "'!\n"; exit(1); } } @@ -412,7 +413,7 @@ bool TreePatternNode::UpdateNodeType(const std::vector<unsigned char> &ExtVTs, if (isLeaf()) { dump(); - std::cerr << " "; + cerr << " "; TP.error("Type inference contradiction found in node!"); } else { TP.error("Type inference contradiction found in node " + @@ -468,7 +469,7 @@ void TreePatternNode::print(std::ostream &OS) const { } void TreePatternNode::dump() const { - print(std::cerr); + print(*cerr.stream()); } /// isIsomorphicTo - Return true if this node is recursively isomorphic to @@ -1009,9 +1010,9 @@ TreePatternNode *TreePattern::ParseTreePattern(DagInit *Dag) { error("Constant int argument should not have a name!"); Children.push_back(Node); } else { - std::cerr << '"'; + cerr << '"'; Arg->dump(); - std::cerr << "\": "; + cerr << "\": "; error("Unknown leaf value for tree pattern!"); } } @@ -1081,7 +1082,7 @@ void TreePattern::print(std::ostream &OS) const { OS << "]\n"; } -void TreePattern::dump() const { print(std::cerr); } +void TreePattern::dump() const { print(*cerr.stream()); } @@ -1622,7 +1623,7 @@ void DAGISelEmitter::ParseInstructions() { if (I == 0) continue; // No pattern. if (I->getNumTrees() != 1) { - std::cerr << "CANNOT HANDLE: " << I->getRecord()->getName() << " yet!"; + cerr << "CANNOT HANDLE: " << I->getRecord()->getName() << " yet!"; continue; } TreePatternNode *Pattern = I->getTree(0); @@ -1949,7 +1950,7 @@ static void GenerateVariantsOf(TreePatternNode *N, // match multiple ways. Add them to PatternsToMatch as well. void DAGISelEmitter::GenerateVariants() { - DEBUG(std::cerr << "Generating instruction variants.\n"); + DOUT << "Generating instruction variants.\n"; // Loop over all of the patterns we've collected, checking to see if we can // generate variants of the instruction, through the exploitation of @@ -1970,23 +1971,23 @@ void DAGISelEmitter::GenerateVariants() { if (Variants.empty()) // No variants for this pattern. continue; - DEBUG(std::cerr << "FOUND VARIANTS OF: "; - PatternsToMatch[i].getSrcPattern()->dump(); - std::cerr << "\n"); + DOUT << "FOUND VARIANTS OF: "; + DEBUG(PatternsToMatch[i].getSrcPattern()->dump()); + DOUT << "\n"; for (unsigned v = 0, e = Variants.size(); v != e; ++v) { TreePatternNode *Variant = Variants[v]; - DEBUG(std::cerr << " VAR#" << v << ": "; - Variant->dump(); - std::cerr << "\n"); + DOUT << " VAR#" << v << ": "; + DEBUG(Variant->dump()); + DOUT << "\n"; // Scan to see if an instruction or explicit pattern already matches this. bool AlreadyExists = false; for (unsigned p = 0, e = PatternsToMatch.size(); p != e; ++p) { // Check to see if this variant already exists. if (Variant->isIsomorphicTo(PatternsToMatch[p].getSrcPattern())) { - DEBUG(std::cerr << " *** ALREADY EXISTS, ignoring variant.\n"); + DOUT << " *** ALREADY EXISTS, ignoring variant.\n"; AlreadyExists = true; break; } @@ -2001,7 +2002,7 @@ void DAGISelEmitter::GenerateVariants() { PatternsToMatch[i].getAddedComplexity())); } - DEBUG(std::cerr << "\n"); + DOUT << "\n"; } } @@ -2160,7 +2161,7 @@ static void RemoveAllTypes(TreePatternNode *N) { Record *DAGISelEmitter::getSDNodeNamed(const std::string &Name) const { Record *N = Records.getDef(Name); if (!N || !N->isSubClassOf("SDNode")) { - std::cerr << "Error getting SDNode '" << Name << "'!\n"; + cerr << "Error getting SDNode '" << Name << "'!\n"; exit(1); } return N; @@ -2569,7 +2570,7 @@ public: } else { #ifndef NDEBUG Child->dump(); - std::cerr << " "; + cerr << " "; #endif assert(0 && "Unknown leaf type!"); } @@ -3068,7 +3069,7 @@ public: return NodeOps; } else { N->dump(); - std::cerr << "\n"; + cerr << "\n"; throw std::string("Unknown node in result pattern!"); } } @@ -3443,12 +3444,11 @@ void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) { &PatternsToMatch[i]); } } else { - std::cerr << "Unrecognized opcode '"; + cerr << "Unrecognized opcode '"; Node->dump(); - std::cerr << "' on tree pattern '"; - std::cerr << - PatternsToMatch[i].getDstPattern()->getOperator()->getName(); - std::cerr << "'!\n"; + cerr << "' on tree pattern '"; + cerr << PatternsToMatch[i].getDstPattern()->getOperator()->getName(); + cerr << "'!\n"; exit(1); } } @@ -3534,9 +3534,9 @@ void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) { // If this pattern definitely matches, and if it isn't the last one, the // patterns after it CANNOT ever match. Error out. if (mightNotMatch == false && i != CodeForPatterns.size()-1) { - std::cerr << "Pattern '"; - CodeForPatterns[i].first->getSrcPattern()->print(std::cerr); - std::cerr << "' is impossible to select!\n"; + cerr << "Pattern '"; + CodeForPatterns[i].first->getSrcPattern()->print(*cerr.stream()); + cerr << "' is impossible to select!\n"; exit(1); } } @@ -3650,7 +3650,7 @@ 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 << " std::cerr << \"Cannot yet select: \";\n"; + OS << " cerr << \"Cannot yet select: \";\n"; if (OpName != "ISD::INTRINSIC_W_CHAIN" && OpName != "ISD::INTRINSIC_WO_CHAIN" && OpName != "ISD::INTRINSIC_VOID") { @@ -3658,10 +3658,10 @@ void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) { } else { OS << " unsigned iid = cast<ConstantSDNode>(N.getOperand(" "N.getOperand(0).getValueType() == MVT::Other))->getValue();\n" - << " std::cerr << \"intrinsic %\"<< " + << " cerr << \"intrinsic %\"<< " "Intrinsic::getName((Intrinsic::ID)iid);\n"; } - OS << " std::cerr << '\\n';\n" + OS << " cerr << '\\n';\n" << " abort();\n" << " return NULL;\n"; } @@ -3780,7 +3780,7 @@ void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) { } OS << " } // end of big switch.\n\n" - << " std::cerr << \"Cannot yet select: \";\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" @@ -3788,10 +3788,10 @@ void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) { << " } else {\n" << " unsigned iid = cast<ConstantSDNode>(N.getOperand(" "N.getOperand(0).getValueType() == MVT::Other))->getValue();\n" - << " std::cerr << \"intrinsic %\"<< " - "Intrinsic::getName((Intrinsic::ID)iid);\n" + << " cerr << \"intrinsic %\"<< " + "Intrinsic::getName((Intrinsic::ID)iid);\n" << " }\n" - << " std::cerr << '\\n';\n" + << " cerr << '\\n';\n" << " abort();\n" << " return NULL;\n" << "}\n"; @@ -3937,13 +3937,12 @@ OS << " unsigned NumKilled = ISelKilled.size();\n"; // multiple ways. Add them to PatternsToMatch as well. GenerateVariants(); - - DEBUG(std::cerr << "\n\nALL PATTERNS TO MATCH:\n\n"; - for (unsigned i = 0, e = PatternsToMatch.size(); i != e; ++i) { - std::cerr << "PATTERN: "; PatternsToMatch[i].getSrcPattern()->dump(); - std::cerr << "\nRESULT: ";PatternsToMatch[i].getDstPattern()->dump(); - std::cerr << "\n"; - }); + DOUT << "\n\nALL PATTERNS TO MATCH:\n\n"; + for (unsigned i = 0, e = PatternsToMatch.size(); i != e; ++i) { + DOUT << "PATTERN: "; DEBUG(PatternsToMatch[i].getSrcPattern()->dump()); + DOUT << "\nRESULT: "; DEBUG(PatternsToMatch[i].getDstPattern()->dump()); + DOUT << "\n"; + } // At this point, we have full information about the 'Patterns' we need to // parse, both implicitly from instructions as well as from explicit pattern diff --git a/utils/TableGen/FileLexer.cpp.cvs b/utils/TableGen/FileLexer.cpp.cvs index 51c9db61c5..e097507e40 100644 --- a/utils/TableGen/FileLexer.cpp.cvs +++ b/utils/TableGen/FileLexer.cpp.cvs @@ -501,7 +501,7 @@ goto find_rule; \ #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 1 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" #define INITIAL 0 /*===-- FileLexer.l - Scanner for TableGen Files ----------------*- C++ -*-===// // @@ -519,8 +519,9 @@ char *yytext; #define YY_NEVER_INTERACTIVE 1 #define comment 1 -#line 30 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 30 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" #include "llvm/Config/config.h" +#include "llvm/Support/Streams.h" #include "Record.h" typedef std::pair<llvm::Record*, std::vector<llvm::Init*>*> SubClassRefTy; #include "FileParser.h" @@ -556,14 +557,17 @@ struct IncludeRec { static std::vector<IncludeRec> IncludeStack; std::ostream &err() { - if (IncludeStack.empty()) - return std::cerr << "At end of input: "; + if (IncludeStack.empty()) { + cerr << "At end of input: "; + return *cerr.stream(); + } for (unsigned i = 0, e = IncludeStack.size()-1; i != e; ++i) - std::cerr << "Included from " << IncludeStack[i].Filename << ":" - << IncludeStack[i].LineNo << ":\n"; - return std::cerr << "Parsing " << IncludeStack.back().Filename << ":" - << Filelineno << ": "; + cerr << "Included from " << IncludeStack[i].Filename << ":" + << IncludeStack[i].LineNo << ":\n"; + cerr << "Parsing " << IncludeStack.back().Filename << ":" + << Filelineno << ": "; + return *cerr.stream(); } /// ParseFile - this function begins the parsing of the specified tablegen file. @@ -575,7 +579,7 @@ void ParseFile(const std::string &Filename, F = fopen(Filename.c_str(), "r"); if (F == 0) { - std::cerr << "Could not open input file '" + Filename + "'!\n"; + cerr << "Could not open input file '" + Filename + "'!\n"; exit (1); } IncludeStack.push_back(IncludeRec(Filename, F)); @@ -607,7 +611,7 @@ static void HandleInclude(const char *Buffer) { } assert(Length >= 2 && "Double quotes not found?"); std::string Filename(Buffer+1, Buffer+Length-1); - //std::cerr << "Filename = '" << Filename << "'\n"; + //cerr << "Filename = '" << Filename << "'\n"; // Save the line number and lex buffer of the includer... IncludeStack.back().LineNo = Filelineno; @@ -661,7 +665,7 @@ int yywrap(void) { using namespace llvm; -#line 665 "Lexer.cpp" +#line 669 "Lexer.cpp" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -812,10 +816,10 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 181 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 185 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" -#line 819 "Lexer.cpp" +#line 823 "Lexer.cpp" if ( yy_init ) { @@ -908,183 +912,183 @@ do_action: /* This label is used only to access EOF actions. */ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 183 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 187 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { /* Ignore comments */ } YY_BREAK case 2: YY_RULE_SETUP -#line 185 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 189 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { HandleInclude(yytext); } YY_BREAK case 3: YY_RULE_SETUP -#line 186 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 190 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { Filelval.StrVal = new std::string(yytext+2, yytext+yyleng-2); return CODEFRAGMENT; } YY_BREAK case 4: YY_RULE_SETUP -#line 189 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 193 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { return INT; } YY_BREAK case 5: YY_RULE_SETUP -#line 190 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 194 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { return BIT; } YY_BREAK case 6: YY_RULE_SETUP -#line 191 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 195 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { return BITS; } YY_BREAK case 7: YY_RULE_SETUP -#line 192 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 196 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { return STRING; } YY_BREAK case 8: YY_RULE_SETUP -#line 193 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 197 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { return LIST; } YY_BREAK case 9: YY_RULE_SETUP -#line 194 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 198 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { return CODE; } YY_BREAK case 10: YY_RULE_SETUP -#line 195 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 199 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { return DAG; } YY_BREAK case 11: YY_RULE_SETUP -#line 197 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 201 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { return CLASS; } YY_BREAK case 12: YY_RULE_SETUP -#line 198 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 202 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { return DEF; } YY_BREAK case 13: YY_RULE_SETUP -#line 199 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 203 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { return DEFM; } YY_BREAK case 14: YY_RULE_SETUP -#line 200 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 204 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { return MULTICLASS; } YY_BREAK case 15: YY_RULE_SETUP -#line 201 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 205 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { return FIELD; } YY_BREAK case 16: YY_RULE_SETUP -#line 202 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 206 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { return LET; } YY_BREAK case 17: YY_RULE_SETUP -#line 203 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 207 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { return IN; } YY_BREAK case 18: YY_RULE_SETUP -#line 205 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 209 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { return SRATOK; } YY_BREAK case 19: YY_RULE_SETUP -#line 206 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 210 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { return SRLTOK; } YY_BREAK case 20: YY_RULE_SETUP -#line 207 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 211 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { return SHLTOK; } YY_BREAK case 21: YY_RULE_SETUP -#line 208 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 212 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { return STRCONCATTOK; } YY_BREAK case 22: YY_RULE_SETUP -#line 211 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 215 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { Filelval.StrVal = new std::string(yytext, yytext+yyleng); return ID; } YY_BREAK case 23: YY_RULE_SETUP -#line 213 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 217 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { Filelval.StrVal = new std::string(yytext+1, yytext+yyleng); return VARNAME; } YY_BREAK case 24: YY_RULE_SETUP -#line 216 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 220 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { Filelval.StrVal = new std::string(yytext+1, yytext+yyleng-1); return STRVAL; } YY_BREAK case 25: YY_RULE_SETUP -#line 219 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 223 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { Filelval.IntVal = ParseInt(Filetext); return INTVAL; } YY_BREAK case 26: YY_RULE_SETUP -#line 221 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 225 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { /* Ignore whitespace */ } YY_BREAK case 27: YY_RULE_SETUP -#line 224 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 228 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { BEGIN(comment); CommentDepth++; } YY_BREAK case 28: YY_RULE_SETUP -#line 225 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 229 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" {} /* eat anything that's not a '*' or '/' */ YY_BREAK case 29: YY_RULE_SETUP -#line 226 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 230 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" {} /* eat up '*'s not followed by '/'s */ YY_BREAK case 30: YY_RULE_SETUP -#line 227 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 231 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { ++CommentDepth; } YY_BREAK case 31: YY_RULE_SETUP -#line 228 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 232 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" {} /* eat up /'s not followed by *'s */ YY_BREAK case 32: YY_RULE_SETUP -#line 229 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 233 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { if (!--CommentDepth) { BEGIN(INITIAL); } } YY_BREAK case YY_STATE_EOF(comment): -#line 230 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 234 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { err() << "Unterminated comment!\n"; exit(1); } YY_BREAK case 33: YY_RULE_SETUP -#line 232 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 236 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" { return Filetext[0]; } YY_BREAK case 34: YY_RULE_SETUP -#line 234 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 238 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 1088 "Lexer.cpp" +#line 1092 "Lexer.cpp" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1508,7 +1512,7 @@ static int input() case EOB_ACT_END_OF_FILE: { if ( yywrap() ) - return EOF; + return 0; if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; @@ -1968,6 +1972,6 @@ int main() return 0; } #endif -#line 234 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" +#line 238 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileLexer.l" diff --git a/utils/TableGen/FileLexer.l b/utils/TableGen/FileLexer.l index 653e9d10fb..cc6825f5e0 100644 --- a/utils/TableGen/FileLexer.l +++ b/utils/TableGen/FileLexer.l @@ -28,6 +28,7 @@ %{ #include "llvm/Config/config.h" +#include "llvm/Support/Streams.h" #include "Record.h" typedef std::pair<llvm::Record*, std::vector<llvm::Init*>*> SubClassRefTy; #include "FileParser.h" @@ -63,14 +64,17 @@ struct IncludeRec { static std::vector<IncludeRec> IncludeStack; std::ostream &err() { - if (IncludeStack.empty()) - return std::cerr << "At end of input: "; + if (IncludeStack.empty()) { + cerr << "At end of input: "; + return *cerr.stream(); + } for (unsigned i = 0, e = IncludeStack.size()-1; i != e; ++i) - std::cerr << "Included from " << IncludeStack[i].Filename << ":" - << IncludeStack[i].LineNo << ":\n"; - return std::cerr << "Parsing " << IncludeStack.back().Filename << ":" - << Filelineno << ": "; + cerr << "Included from " << IncludeStack[i].Filename << ":" + << IncludeStack[i].LineNo << ":\n"; + cerr << "Parsing " << IncludeStack.back().Filename << ":" + << Filelineno << ": "; + return *cerr.stream(); } /// ParseFile - this function begins the parsing of the specified tablegen file. @@ -82,7 +86,7 @@ void ParseFile(const std::string &Filename, F = fopen(Filename.c_str(), "r"); if (F == 0) { - std::cerr << "Could not open input file '" + Filename + "'!\n"; + cerr << "Could not open input file '" + Filename + "'!\n"; exit (1); } IncludeStack.push_back(IncludeRec(Filename, F)); @@ -114,7 +118,7 @@ static void HandleInclude(const char *Buffer) { } assert(Length >= 2 && "Double quotes not found?"); std::string Filename(Buffer+1, Buffer+Length-1); - //std::cerr << "Filename = '" << Filename << "'\n"; + //cerr << "Filename = '" << Filename << "'\n"; // Save the line number and lex buffer of the includer... IncludeStack.back().LineNo = Filelineno; diff --git a/utils/TableGen/FileLexer.l.cvs b/utils/TableGen/FileLexer.l.cvs index 653e9d10fb..cc6825f5e0 100644 --- a/utils/TableGen/FileLexer.l.cvs +++ b/utils/TableGen/FileLexer.l.cvs @@ -28,6 +28,7 @@ %{ #include "llvm/Config/config.h" +#include "llvm/Support/Streams.h" #include "Record.h" typedef std::pair<llvm::Record*, std::vector<llvm::Init*>*> SubClassRefTy; #include "FileParser.h" @@ -63,14 +64,17 @@ struct IncludeRec { static std::vector<IncludeRec> IncludeStack; std::ostream &err() { - if (IncludeStack.empty()) - return std::cerr << "At end of input: "; + if (IncludeStack.empty()) { + cerr << "At end of input: "; + return *cerr.stream(); + } for (unsigned i = 0, e = IncludeStack.size()-1; i != e; ++i) - std::cerr << "Included from " << IncludeStack[i].Filename << ":" - << IncludeStack[i].LineNo << ":\n"; - return std::cerr << "Parsing " << IncludeStack.back().Filename << ":" - << Filelineno << ": "; + cerr << "Included from " << IncludeStack[i].Filename << ":" + << IncludeStack[i].LineNo << ":\n"; + cerr << "Parsing " << IncludeStack.back().Filename << ":" + << Filelineno << ": "; + return *cerr.stream(); } /// ParseFile - this function begins the parsing of the specified tablegen file. @@ -82,7 +86,7 @@ void ParseFile(const std::string &Filename, F = fopen(Filename.c_str(), "r"); if (F == 0) { - std::cerr << "Could not open input file '" + Filename + "'!\n"; + cerr << "Could not open input file '" + Filename + "'!\n"; exit (1); } IncludeStack.push_back(IncludeRec(Filename, F)); @@ -114,7 +118,7 @@ static void HandleInclude(const char *Buffer) { } assert(Length >= 2 && "Double quotes not found?"); std::string Filename(Buffer+1, Buffer+Length-1); - //std::cerr << "Filename = '" << Filename << "'\n"; + //cerr << "Filename = '" << Filename << "'\n"; // Save the line number and lex buffer of the includer... IncludeStack.back().LineNo = Filelineno; diff --git a/utils/TableGen/FileParser.cpp.cvs b/utils/TableGen/FileParser.cpp.cvs index 1f0ff3f028..6cfc3dde27 100644 --- a/utils/TableGen/FileParser.cpp.cvs +++ b/utils/TableGen/FileParser.cpp.cvs @@ -1,44 +1,138 @@ +/* A Bison parser, made by GNU Bison 2.3. */ -/* A Bison parser, made from /Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y - by GNU Bison version 1.28 */ +/* Skeleton implementation for Bison's Yacc-like parsers in C -#define YYBISON 1 /* Identify Bison output. */ + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.3" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + +/* Substitute the variable and function names. */ #define yyparse Fileparse -#define yylex Filelex +#define yylex Filelex #define yyerror Fileerror -#define yylval Filelval -#define yychar Filechar +#define yylval Filelval +#define yychar |