Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Side by Side Diff: utils/TableGen/TGLexer.h

Issue 7792066: [llvm] Conditionally include target intrinsics, based on --enable-target Base URL: https://llvm.org/svn/llvm-project/llvm/trunk/
Patch Set: cleanups Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 //===- TGLexer.h - Lexer for TableGen Files ---------------------*- C++ -*-===// 1 //===- TGLexer.h - Lexer for TableGen Files ---------------------*- C++ -*-===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // The LLVM Compiler Infrastructure
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This class represents the Lexer for tablegen files. 10 // This class represents the Lexer for tablegen files.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 const char *TokStart; 67 const char *TokStart;
68 tgtok::TokKind CurCode; 68 tgtok::TokKind CurCode;
69 std::string CurStrVal; // This is valid for ID, STRVAL, VARNAME, CODEFRAGMENT 69 std::string CurStrVal; // This is valid for ID, STRVAL, VARNAME, CODEFRAGMENT
70 int64_t CurIntVal; // This is valid for INTVAL. 70 int64_t CurIntVal; // This is valid for INTVAL.
71 71
72 /// CurBuffer - This is the current buffer index we're lexing from as managed 72 /// CurBuffer - This is the current buffer index we're lexing from as managed
73 /// by the SourceMgr object. 73 /// by the SourceMgr object.
74 int CurBuffer; 74 int CurBuffer;
75 /// Dependencies - This is the list of all included files. 75 /// Dependencies - This is the list of all included files.
76 std::vector<std::string> Dependencies; 76 std::vector<std::string> Dependencies;
77 77
78 /// PreProcDefines - This holds a list of TableGen defines (similar in
79 /// spirit to C pre-processor defines).
80 std::vector<std::string> PreProcDefines;
81
78 public: 82 public:
79 TGLexer(SourceMgr &SrcMgr); 83 TGLexer(SourceMgr &SrcMgr, std::vector<std::string> PreProcDefines);
80 ~TGLexer() {} 84 ~TGLexer() {}
81 85
82 tgtok::TokKind Lex() { 86 tgtok::TokKind Lex() {
83 return CurCode = LexToken(); 87 return CurCode = LexToken();
84 } 88 }
85 89
86 const std::vector<std::string> &getDependencies() const { 90 const std::vector<std::string> &getDependencies() const {
87 return Dependencies; 91 return Dependencies;
88 } 92 }
89 93
90 tgtok::TokKind getCode() const { return CurCode; } 94 tgtok::TokKind getCode() const { return CurCode; }
91 95
92 const std::string &getCurStrVal() const { 96 const std::string &getCurStrVal() const {
93 assert((CurCode == tgtok::Id || CurCode == tgtok::StrVal || 97 assert((CurCode == tgtok::Id || CurCode == tgtok::StrVal ||
94 CurCode == tgtok::VarName || CurCode == tgtok::CodeFragment) && 98 CurCode == tgtok::VarName || CurCode == tgtok::CodeFragment) &&
95 "This token doesn't have a string value"); 99 "This token doesn't have a string value");
96 return CurStrVal; 100 return CurStrVal;
97 } 101 }
98 int64_t getCurIntVal() const { 102 int64_t getCurIntVal() const {
99 assert(CurCode == tgtok::IntVal && "This token isn't an integer"); 103 assert(CurCode == tgtok::IntVal && "This token isn't an integer");
100 return CurIntVal; 104 return CurIntVal;
101 } 105 }
102 106
103 SMLoc getLoc() const; 107 SMLoc getLoc() const;
104 108
109 bool hasPreProcDefine(const std::string &Symbol) const;
110
105 private: 111 private:
106 /// LexToken - Read the next token and return its code. 112 /// LexToken - Read the next token and return its code.
107 tgtok::TokKind LexToken(); 113 tgtok::TokKind LexToken();
108 114
109 tgtok::TokKind ReturnError(const char *Loc, const Twine &Msg); 115 tgtok::TokKind ReturnError(const char *Loc, const Twine &Msg);
110 116
111 int getNextChar(); 117 int getNextChar();
112 void SkipBCPLComment(); 118 void SkipBCPLComment();
113 bool SkipCComment(); 119 bool SkipCComment();
114 tgtok::TokKind LexIdentifier(); 120 tgtok::TokKind LexIdentifier();
115 bool LexInclude(); 121 bool LexInclude();
122 bool LexIncludeIf();
123 bool AddIncludeFile(const std::string &Filename);
116 tgtok::TokKind LexString(); 124 tgtok::TokKind LexString();
117 tgtok::TokKind LexVarName(); 125 tgtok::TokKind LexVarName();
118 tgtok::TokKind LexNumber(); 126 tgtok::TokKind LexNumber();
119 tgtok::TokKind LexBracket(); 127 tgtok::TokKind LexBracket();
120 tgtok::TokKind LexExclaim(); 128 tgtok::TokKind LexExclaim();
121 }; 129 };
122 130
123 } // end namespace llvm 131 } // end namespace llvm
124 132
125 #endif 133 #endif
OLDNEW
« no previous file with comments | « test/Transforms/ScalarRepl/2006-11-07-InvalidArrayPromote.ll ('k') | utils/TableGen/TGLexer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698