projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[X86][Haswell][SchedModel] Add architecture specific scheduling models.
[oota-llvm.git]
/
lib
/
TableGen
/
TGLexer.h
diff --git
a/lib/TableGen/TGLexer.h
b/lib/TableGen/TGLexer.h
index 0246ab6b900b2d7aaf9f3be17805b77db6b3da15..1f750fcd8d96b6abe43e18c2e82ca1ba2228fd10 100644
(file)
--- 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 "llvm/Support/DataTypes.h"
-#include <string>
-#include <vector>
+#include "llvm/Support/SMLoc.h"
#include <cassert>
#include <cassert>
+#include <map>
+#include <string>
namespace llvm {
namespace llvm {
-class MemoryBuffer;
class SourceMgr;
class SMLoc;
class Twine;
class SourceMgr;
class SMLoc;
class Twine;
@@
-42,15
+43,19
@@
namespace tgtok {
paste, // #
// Keywords.
paste, // #
// Keywords.
- Bit, Bits, Class, Code, Dag, Def, Defm, Field, In, Int, Let, List,
+ Bit, Bits, Class, Code, Dag, Def,
Foreach,
Defm, Field, In, Int, Let, List,
MultiClass, String,
// !keywords.
MultiClass, String,
// !keywords.
- XConcat, X
SRA, XSRL, XSHL, XStrConcat, XCast, XSub
st,
- XForEach, XHead, XTail, XEmpty, XIf, XEq,
+ XConcat, X
ADD, XAND, XSRA, XSRL, XSHL, XListConcat, XStrConcat, XCa
st,
+ X
Subst, X
ForEach, XHead, XTail, XEmpty, XIf, XEq,
// Integer value.
IntVal,
// 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
// String valued tokens.
Id, StrVal, VarName, CodeFragment
@@
-62,7
+67,7
@@
class TGLexer {
SourceMgr &SrcMgr;
const char *CurPtr;
SourceMgr &SrcMgr;
const char *CurPtr;
-
const MemoryBuffer *
CurBuf;
+
StringRef
CurBuf;
// Information about the current token.
const char *TokStart;
// 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.
/// 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<std::string, SMLoc> DependenciesMapTy;
+private:
/// Dependencies - This is the list of all included files.
/// Dependencies - This is the list of all included files.
-
std::vector<std::string>
Dependencies;
-
+
DependenciesMapTy
Dependencies;
+
public:
TGLexer(SourceMgr &SrcMgr);
~TGLexer() {}
public:
TGLexer(SourceMgr &SrcMgr);
~TGLexer() {}
@@
-84,7
+93,7
@@
public:
return CurCode = LexToken();
}
return CurCode = LexToken();
}
- const
std::vector<std::string>
&getDependencies() const {
+ const
DependenciesMapTy
&getDependencies() const {
return Dependencies;
}
return Dependencies;
}
@@
-100,6
+109,11
@@
public:
assert(CurCode == tgtok::IntVal && "This token isn't an integer");
return CurIntVal;
}
assert(CurCode == tgtok::IntVal && "This token isn't an integer");
return CurIntVal;
}
+ std::pair<int64_t, unsigned> getCurBinaryIntVal() const {
+ assert(CurCode == tgtok::BinaryIntVal &&
+ "This token isn't a binary integer");
+ return std::make_pair(CurIntVal, (CurPtr - TokStart)-2);
+ }
SMLoc getLoc() const;
SMLoc getLoc() const;