summaryrefslogtreecommitdiffstats
path: root/lib/AsmParser/LLParser.h
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2010-01-01 10:31:22 +0000
committerrdivacky <rdivacky@FreeBSD.org>2010-01-01 10:31:22 +0000
commita16c51cee9225a354c999dd1076d5dba2aa79807 (patch)
treedba00119388b84f9f44e6ec5e9129f807fd79ca3 /lib/AsmParser/LLParser.h
parent40a6fcdb85efd93fe0e36c9552cfb0b18b5eacd6 (diff)
downloadFreeBSD-src-a16c51cee9225a354c999dd1076d5dba2aa79807.zip
FreeBSD-src-a16c51cee9225a354c999dd1076d5dba2aa79807.tar.gz
Update LLVM to 92395.
Diffstat (limited to 'lib/AsmParser/LLParser.h')
-rw-r--r--lib/AsmParser/LLParser.h59
1 files changed, 35 insertions, 24 deletions
diff --git a/lib/AsmParser/LLParser.h b/lib/AsmParser/LLParser.h
index d14b1cb..803832f 100644
--- a/lib/AsmParser/LLParser.h
+++ b/lib/AsmParser/LLParser.h
@@ -17,6 +17,7 @@
#include "LLLexer.h"
#include "llvm/Module.h"
#include "llvm/Type.h"
+#include "llvm/Support/ValueHandle.h"
#include <map>
namespace llvm {
@@ -45,7 +46,8 @@ namespace llvm {
t_EmptyArray, // No value: []
t_Constant, // Value in ConstantVal.
t_InlineAsm, // Value in StrVal/StrVal2/UIntVal.
- t_Metadata // Value in MetadataVal.
+ t_MDNode, // Value in MDNodeVal.
+ t_MDString // Value in MDStringVal.
} Kind;
LLLexer::LocTy Loc;
@@ -54,7 +56,8 @@ namespace llvm {
APSInt APSIntVal;
APFloat APFloatVal;
Constant *ConstantVal;
- MetadataBase *MetadataVal;
+ MDNode *MDNodeVal;
+ MDString *MDStringVal;
ValID() : APFloatVal(0.0) {}
bool operator<(const ValID &RHS) const {
@@ -78,10 +81,8 @@ namespace llvm {
std::map<std::string, std::pair<PATypeHolder, LocTy> > ForwardRefTypes;
std::map<unsigned, std::pair<PATypeHolder, LocTy> > ForwardRefTypeIDs;
std::vector<PATypeHolder> NumberedTypes;
- /// MetadataCache - This map keeps track of parsed metadata constants.
- std::map<unsigned, WeakVH> MetadataCache;
- std::map<unsigned, std::pair<WeakVH, LocTy> > ForwardRefMDNodes;
- SmallVector<std::pair<unsigned, MDNode *>, 2> MDsOnInst;
+ std::vector<TrackingVH<MDNode> > NumberedMetadata;
+ std::map<unsigned, std::pair<TrackingVH<MDNode>, LocTy> > ForwardRefMDNodes;
struct UpRefRecord {
/// Loc - This is the location of the upref.
LocTy Loc;
@@ -169,9 +170,17 @@ namespace llvm {
bool ParseOptionalVisibility(unsigned &Visibility);
bool ParseOptionalCallingConv(CallingConv::ID &CC);
bool ParseOptionalAlignment(unsigned &Alignment);
- bool ParseOptionalCustomMetadata();
- bool ParseOptionalInfo(unsigned &Alignment);
- bool ParseIndexList(SmallVectorImpl<unsigned> &Indices);
+ bool ParseInstructionMetadata(SmallVectorImpl<std::pair<unsigned,
+ MDNode *> > &);
+ bool ParseOptionalCommaAlign(unsigned &Alignment, bool &AteExtraComma);
+ bool ParseIndexList(SmallVectorImpl<unsigned> &Indices,bool &AteExtraComma);
+ bool ParseIndexList(SmallVectorImpl<unsigned> &Indices) {
+ bool AteExtraComma;
+ if (ParseIndexList(Indices, AteExtraComma)) return true;
+ if (AteExtraComma)
+ return TokError("expected index");
+ return false;
+ }
// Top-Level Entities
bool ParseTopLevelEntities();
@@ -192,8 +201,8 @@ namespace llvm {
bool ParseAlias(const std::string &Name, LocTy Loc, unsigned Visibility);
bool ParseStandaloneMetadata();
bool ParseNamedMetadata();
- bool ParseMDString(MetadataBase *&S);
- bool ParseMDNode(MetadataBase *&N);
+ bool ParseMDString(MDString *&Result);
+ bool ParseMDNodeID(MDNode *&Result);
// Type Parsing.
bool ParseType(PATypeHolder &Result, bool AllowVoid = false);
@@ -210,6 +219,8 @@ namespace llvm {
// Constants.
bool ParseValID(ValID &ID);
bool ConvertGlobalValIDToValue(const Type *Ty, ValID &ID, Constant *&V);
+ bool ConvertGlobalOrMetadataValIDToValue(const Type *Ty, ValID &ID,
+ Value *&V);
bool ParseGlobalValue(const Type *Ty, Constant *&V);
bool ParseGlobalTypeAndValue(Constant *&V);
bool ParseGlobalValueVector(SmallVectorImpl<Constant*> &Elts);
@@ -280,8 +291,6 @@ namespace llvm {
return ParseTypeAndBasicBlock(BB, Loc, PFS);
}
- bool ParseInlineMetadata(Value *&V, PerFunctionState &PFS);
-
struct ParamInfo {
LocTy Loc;
Value *V;
@@ -307,12 +316,14 @@ namespace llvm {
bool ParseFunctionBody(Function &Fn);
bool ParseBasicBlock(PerFunctionState &PFS);
- // Instruction Parsing.
- bool ParseInstruction(Instruction *&Inst, BasicBlock *BB,
- PerFunctionState &PFS);
+ // Instruction Parsing. Each instruction parsing routine can return with a
+ // normal result, an error result, or return having eaten an extra comma.
+ enum InstResult { InstNormal = 0, InstError = 1, InstExtraComma = 2 };
+ int ParseInstruction(Instruction *&Inst, BasicBlock *BB,
+ PerFunctionState &PFS);
bool ParseCmpPredicate(unsigned &Pred, unsigned Opc);
- bool ParseRet(Instruction *&Inst, BasicBlock *BB, PerFunctionState &PFS);
+ int ParseRet(Instruction *&Inst, BasicBlock *BB, PerFunctionState &PFS);
bool ParseBr(Instruction *&Inst, PerFunctionState &PFS);
bool ParseSwitch(Instruction *&Inst, PerFunctionState &PFS);
bool ParseIndirectBr(Instruction *&Inst, PerFunctionState &PFS);
@@ -328,17 +339,17 @@ namespace llvm {
bool ParseExtractElement(Instruction *&I, PerFunctionState &PFS);
bool ParseInsertElement(Instruction *&I, PerFunctionState &PFS);
bool ParseShuffleVector(Instruction *&I, PerFunctionState &PFS);
- bool ParsePHI(Instruction *&I, PerFunctionState &PFS);
+ int ParsePHI(Instruction *&I, PerFunctionState &PFS);
bool ParseCall(Instruction *&I, PerFunctionState &PFS, bool isTail);
- bool ParseAlloc(Instruction *&I, PerFunctionState &PFS,
+ int ParseAlloc(Instruction *&I, PerFunctionState &PFS,
BasicBlock *BB = 0, bool isAlloca = true);
bool ParseFree(Instruction *&I, PerFunctionState &PFS, BasicBlock *BB);
- bool ParseLoad(Instruction *&I, PerFunctionState &PFS, bool isVolatile);
- bool ParseStore(Instruction *&I, PerFunctionState &PFS, bool isVolatile);
+ int ParseLoad(Instruction *&I, PerFunctionState &PFS, bool isVolatile);
+ int ParseStore(Instruction *&I, PerFunctionState &PFS, bool isVolatile);
bool ParseGetResult(Instruction *&I, PerFunctionState &PFS);
- bool ParseGetElementPtr(Instruction *&I, PerFunctionState &PFS);
- bool ParseExtractValue(Instruction *&I, PerFunctionState &PFS);
- bool ParseInsertValue(Instruction *&I, PerFunctionState &PFS);
+ int ParseGetElementPtr(Instruction *&I, PerFunctionState &PFS);
+ int ParseExtractValue(Instruction *&I, PerFunctionState &PFS);
+ int ParseInsertValue(Instruction *&I, PerFunctionState &PFS);
bool ResolveForwardRefBlockAddresses(Function *TheFn,
std::vector<std::pair<ValID, GlobalValue*> > &Refs,
OpenPOWER on IntegriCloud