X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FAsmParser%2FLLParser.h;h=97bf2f309f6d53a5317e8cab805bb0976ef9593b;hb=0475c9170e9621292a48c688c3976031be5650bb;hp=7106689081d32c3c741d404013b92fdc0b2edaa1;hpb=cb33799b9f4e152e3460faa83e59b53ff604c87d;p=oota-llvm.git diff --git a/lib/AsmParser/LLParser.h b/lib/AsmParser/LLParser.h index 7106689081d..97bf2f309f6 100644 --- a/lib/AsmParser/LLParser.h +++ b/lib/AsmParser/LLParser.h @@ -15,6 +15,7 @@ #define LLVM_ASMPARSER_LLPARSER_H #include "LLLexer.h" +#include "llvm/Module.h" #include "llvm/Type.h" #include @@ -27,6 +28,7 @@ namespace llvm { class Instruction; class Constant; class GlobalValue; + class MetadataBase; class MDString; class MDNode; struct ValID; @@ -35,7 +37,7 @@ namespace llvm { public: typedef LLLexer::LocTy LocTy; private: - + LLVMContext& Context; LLLexer Lex; Module *M; @@ -43,7 +45,10 @@ namespace llvm { std::map > ForwardRefTypes; std::map > ForwardRefTypeIDs; std::vector NumberedTypes; - + /// MetadataCache - This map keeps track of parsed metadata constants. + std::map MetadataCache; + std::map > ForwardRefMDNodes; + SmallVector, 2> MDsOnInst; struct UpRefRecord { /// Loc - This is the location of the upref. LocTy Loc; @@ -71,9 +76,12 @@ namespace llvm { std::map > ForwardRefValIDs; std::vector NumberedVals; public: - LLParser(MemoryBuffer *F, ParseError &Err, Module *m) : Lex(F, Err), M(m) {} + LLParser(MemoryBuffer *F, SourceMgr &SM, SMDiagnostic &Err, Module *m) : + Context(m->getContext()), Lex(F, SM, Err, m->getContext()), M(m) {} bool Run(); + LLVMContext& getContext() { return Context; } + private: bool Error(LocTy L, const std::string &Msg) const { @@ -118,9 +126,10 @@ namespace llvm { bool HasLinkage; return ParseOptionalLinkage(Linkage, HasLinkage); } bool ParseOptionalVisibility(unsigned &Visibility); - bool ParseOptionalCallingConv(unsigned &CC); + bool ParseOptionalCallingConv(CallingConv::ID &CC); bool ParseOptionalAlignment(unsigned &Alignment); - bool ParseOptionalCommaAlignment(unsigned &Alignment); + bool ParseOptionalCustomMetadata(); + bool ParseOptionalInfo(unsigned &Alignment); bool ParseIndexList(SmallVectorImpl &Indices); // Top-Level Entities @@ -135,10 +144,15 @@ namespace llvm { bool ParseDefine(); bool ParseGlobalType(bool &IsConstant); + bool ParseUnnamedGlobal(); bool ParseNamedGlobal(); bool ParseGlobal(const std::string &Name, LocTy Loc, unsigned Linkage, bool HasLinkage, unsigned Visibility); bool ParseAlias(const std::string &Name, LocTy Loc, unsigned Visibility); + bool ParseStandaloneMetadata(); + bool ParseNamedMetadata(); + bool ParseMDString(MetadataBase *&S); + bool ParseMDNode(MetadataBase *&N); // Type Parsing. bool ParseType(PATypeHolder &Result, bool AllowVoid = false);