X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTableGen%2FTGLexer.h;h=1f750fcd8d96b6abe43e18c2e82ca1ba2228fd10;hb=049ffbbdf2a43d5529cb56b6bb696d20d28ff217;hp=8a850b5cec8e7c1de006ff7c4aeec5b5031c5179;hpb=cebb4ee93a0064e4a2cb1fd1da7455b01e5655cb;p=oota-llvm.git diff --git a/lib/TableGen/TGLexer.h b/lib/TableGen/TGLexer.h index 8a850b5cec8..1f750fcd8d9 100644 --- a/lib/TableGen/TGLexer.h +++ b/lib/TableGen/TGLexer.h @@ -11,16 +11,17 @@ // //===----------------------------------------------------------------------===// -#ifndef TGLEXER_H -#define TGLEXER_H +#ifndef LLVM_LIB_TABLEGEN_TGLEXER_H +#define LLVM_LIB_TABLEGEN_TGLEXER_H +#include "llvm/ADT/StringRef.h" #include "llvm/Support/DataTypes.h" -#include -#include +#include "llvm/Support/SMLoc.h" #include +#include +#include namespace llvm { -class MemoryBuffer; class SourceMgr; class SMLoc; class Twine; @@ -46,11 +47,15 @@ namespace tgtok { MultiClass, String, // !keywords. - XConcat, XSRA, XSRL, XSHL, XStrConcat, XCast, XSubst, - XForEach, XHead, XTail, XEmpty, XIf, XEq, + XConcat, XADD, XAND, XSRA, XSRL, XSHL, XListConcat, XStrConcat, XCast, + XSubst, XForEach, XHead, XTail, XEmpty, XIf, XEq, // Integer value. IntVal, + + // Binary constant. Note that these are sized according to the number of + // bits given. + BinaryIntVal, // String valued tokens. Id, StrVal, VarName, CodeFragment @@ -62,7 +67,7 @@ class TGLexer { SourceMgr &SrcMgr; const char *CurPtr; - const MemoryBuffer *CurBuf; + StringRef CurBuf; // Information about the current token. const char *TokStart; @@ -72,10 +77,14 @@ class TGLexer { /// CurBuffer - This is the current buffer index we're lexing from as managed /// by the SourceMgr object. - int CurBuffer; + unsigned CurBuffer; + +public: + typedef std::map DependenciesMapTy; +private: /// Dependencies - This is the list of all included files. - std::vector Dependencies; - + DependenciesMapTy Dependencies; + public: TGLexer(SourceMgr &SrcMgr); ~TGLexer() {} @@ -84,7 +93,7 @@ public: return CurCode = LexToken(); } - const std::vector &getDependencies() const { + const DependenciesMapTy &getDependencies() const { return Dependencies; } @@ -100,6 +109,11 @@ public: assert(CurCode == tgtok::IntVal && "This token isn't an integer"); return CurIntVal; } + std::pair getCurBinaryIntVal() const { + assert(CurCode == tgtok::BinaryIntVal && + "This token isn't a binary integer"); + return std::make_pair(CurIntVal, (CurPtr - TokStart)-2); + } SMLoc getLoc() const;