X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FAsmParser%2FLLParser.h;h=7efcac7a19ae9e3fc3fcdcdcf8e9d84a75f8c263;hb=5769e19790efe1cca7f534c1d1431ee7c3c2171d;hp=8607b70f312399650aad5df8ccb1d136fa98a2c0;hpb=e390a8e7ab3911abad1bf2a0290578d8b429b756;p=oota-llvm.git diff --git a/lib/AsmParser/LLParser.h b/lib/AsmParser/LLParser.h index 8607b70f312..7efcac7a19a 100644 --- a/lib/AsmParser/LLParser.h +++ b/lib/AsmParser/LLParser.h @@ -37,6 +37,7 @@ namespace llvm { class Comdat; class MDString; class MDNode; + struct SlotMapping; class StructType; /// ValID - Represents a reference of a definition of some sort with no type. @@ -87,6 +88,7 @@ namespace llvm { LLVMContext &Context; LLLexer Lex; Module *M; + SlotMapping *Slots; // Instruction metadata resolution. Each instruction can have a list of // MDRef info associated with them. @@ -108,10 +110,10 @@ namespace llvm { // Type resolution handling data structures. The location is set when we // have processed a use of the type but not a definition yet. StringMap > NamedTypes; - std::vector > NumberedTypes; + std::map > NumberedTypes; - std::vector NumberedMetadata; - std::map> ForwardRefMDNodes; + std::map NumberedMetadata; + std::map> ForwardRefMDNodes; // Global Value reference information. std::map > ForwardRefVals; @@ -135,11 +137,14 @@ namespace llvm { std::map NumberedAttrBuilders; public: - LLParser(StringRef F, SourceMgr &SM, SMDiagnostic &Err, Module *m) - : Context(m->getContext()), Lex(F, SM, Err, m->getContext()), M(m), - BlockAddressPFS(nullptr) {} + LLParser(StringRef F, SourceMgr &SM, SMDiagnostic &Err, Module *M, + SlotMapping *Slots = nullptr) + : Context(M->getContext()), Lex(F, SM, Err, M->getContext()), M(M), + Slots(Slots), BlockAddressPFS(nullptr) {} bool Run(); + bool parseStandaloneConstantValue(Constant *&C); + LLVMContext &getContext() { return Context; } private: @@ -223,7 +228,7 @@ namespace llvm { bool ParseOptionalDLLStorageClass(unsigned &DLLStorageClass); bool ParseOptionalCallingConv(unsigned &CC); bool ParseOptionalAlignment(unsigned &Alignment); - bool ParseOptionalDereferenceableBytes(uint64_t &Bytes); + bool ParseOptionalDerefAttrBytes(lltok::Kind AttrKind, uint64_t &Bytes); bool ParseScopeAndOrdering(bool isAtomic, SynchronizationScope &Scope, AtomicOrdering &Ordering); bool ParseOrdering(AtomicOrdering &Ordering); @@ -340,6 +345,7 @@ namespace llvm { bool ConvertValIDToValue(Type *Ty, ValID &ID, Value *&V, PerFunctionState *PFS); + bool parseConstantValue(Type *Ty, Constant *&C); bool ParseValue(Type *Ty, Value *&V, PerFunctionState *PFS); bool ParseValue(Type *Ty, Value *&V, PerFunctionState &PFS) { return ParseValue(Ty, V, &PFS); @@ -385,13 +391,29 @@ namespace llvm { bool ParseGlobalValueVector(SmallVectorImpl &Elts); bool parseOptionalComdat(StringRef GlobalName, Comdat *&C); bool ParseMetadataAsValue(Value *&V, PerFunctionState &PFS); - bool ParseValueAsMetadata(Metadata *&MD, PerFunctionState *PFS); + bool ParseValueAsMetadata(Metadata *&MD, const Twine &TypeMsg, + PerFunctionState *PFS); bool ParseMetadata(Metadata *&MD, PerFunctionState *PFS); bool ParseMDTuple(MDNode *&MD, bool IsDistinct = false); bool ParseMDNode(MDNode *&MD); bool ParseMDNodeTail(MDNode *&MD); bool ParseMDNodeVector(SmallVectorImpl &MDs); - bool ParseInstructionMetadata(Instruction *Inst, PerFunctionState *PFS); + bool ParseMetadataAttachment(unsigned &Kind, MDNode *&MD); + bool ParseInstructionMetadata(Instruction &Inst); + bool ParseOptionalFunctionMetadata(Function &F); + + template + bool ParseMDField(LocTy Loc, StringRef Name, FieldTy &Result); + template bool ParseMDField(StringRef Name, FieldTy &Result); + template + bool ParseMDFieldsImplBody(ParserTy parseField); + template + bool ParseMDFieldsImpl(ParserTy parseField, LocTy &ClosingLoc); + bool ParseSpecializedMDNode(MDNode *&N, bool IsDistinct = false); + +#define HANDLE_SPECIALIZED_MDNODE_LEAF(CLASS) \ + bool Parse##CLASS(MDNode *&Result, bool IsDistinct); +#include "llvm/IR/Metadata.def" // Function Parsing. struct ArgInfo {