X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=lib%2FAsmParser%2FLLParser.h;h=117cdcba2551ff64ecf5c427119c445a43c98c41;hp=6e410d05cd2ef910cb4d48c957f7d84465e26ec4;hb=5ff590799654e01ceea6383932fc25e8e622c46a;hpb=6adbfa381528b1042c7f86b0aa59308485509560 diff --git a/lib/AsmParser/LLParser.h b/lib/AsmParser/LLParser.h index 6e410d05cd2..117cdcba255 100644 --- a/lib/AsmParser/LLParser.h +++ b/lib/AsmParser/LLParser.h @@ -80,38 +80,6 @@ namespace llvm { } }; - /// Structure to represent an optional metadata field. - template struct MDFieldImpl { - typedef MDFieldImpl ImplTy; - FieldTy Val; - bool Seen; - - void assign(FieldTy Val) { - Seen = true; - this->Val = std::move(Val); - } - - explicit MDFieldImpl(FieldTy Default) - : Val(std::move(Default)), Seen(false) {} - }; - template struct MDUnsignedField : public MDFieldImpl { - typedef typename MDUnsignedField::ImplTy ImplTy; - NumTy Max; - - MDUnsignedField(NumTy Default = 0, - NumTy Max = std::numeric_limits::max()) - : ImplTy(Default), Max(Max) {} - }; - struct MDField : public MDFieldImpl { - MDField() : ImplTy(nullptr) {} - }; - struct MDStringField : public MDFieldImpl { - MDStringField() : ImplTy(std::string()) {} - }; - struct MDFieldList : public MDFieldImpl> { - MDFieldList() : ImplTy(SmallVector()) {} - }; - class LLParser { public: typedef LLLexer::LocTy LocTy; @@ -140,9 +108,9 @@ 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 NumberedMetadata; std::map> ForwardRefMDNodes; // Global Value reference information. @@ -255,7 +223,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); @@ -417,7 +385,8 @@ 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); @@ -425,19 +394,18 @@ namespace llvm { bool ParseMDNodeVector(SmallVectorImpl &MDs); bool ParseInstructionMetadata(Instruction *Inst, PerFunctionState *PFS); - bool ParseMDField(LocTy Loc, StringRef Name, - MDUnsignedField &Result); - bool ParseMDField(LocTy Loc, StringRef Name, MDField &Result); - bool ParseMDField(LocTy Loc, StringRef Name, MDStringField &Result); - bool ParseMDField(LocTy Loc, StringRef Name, MDFieldList &Result); + 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); - bool ParseMDLocation(MDNode *&Result, bool IsDistinct); - bool ParseGenericDebugNode(MDNode *&Result, bool IsDistinct); + +#define HANDLE_SPECIALIZED_MDNODE_LEAF(CLASS) \ + bool Parse##CLASS(MDNode *&Result, bool IsDistinct); +#include "llvm/IR/Metadata.def" // Function Parsing. struct ArgInfo {