mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
rename NamedOrCustomMD -> MetadataVar to follow conventions of all the rest of the code.
llvm-svn: 92295
This commit is contained in:
parent
2e5b6d96ac
commit
63289c0f1e
@ -423,10 +423,10 @@ static bool JustWhitespaceNewLine(const char *&Ptr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// LexExclaim:
|
/// LexExclaim:
|
||||||
/// !{...}
|
|
||||||
/// !42
|
|
||||||
/// !foo
|
/// !foo
|
||||||
|
/// !
|
||||||
lltok::Kind LLLexer::LexExclaim() {
|
lltok::Kind LLLexer::LexExclaim() {
|
||||||
|
// Lex a metadata name as a MetadataVar.
|
||||||
if (isalpha(CurPtr[0])) {
|
if (isalpha(CurPtr[0])) {
|
||||||
++CurPtr;
|
++CurPtr;
|
||||||
while (isalnum(CurPtr[0]) || CurPtr[0] == '-' || CurPtr[0] == '$' ||
|
while (isalnum(CurPtr[0]) || CurPtr[0] == '-' || CurPtr[0] == '$' ||
|
||||||
@ -434,7 +434,7 @@ lltok::Kind LLLexer::LexExclaim() {
|
|||||||
++CurPtr;
|
++CurPtr;
|
||||||
|
|
||||||
StrVal.assign(TokStart+1, CurPtr); // Skip !
|
StrVal.assign(TokStart+1, CurPtr); // Skip !
|
||||||
return lltok::NamedOrCustomMD;
|
return lltok::MetadataVar;
|
||||||
}
|
}
|
||||||
return lltok::exclaim;
|
return lltok::exclaim;
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ bool LLParser::ParseTopLevelEntities() {
|
|||||||
case lltok::GlobalID: if (ParseUnnamedGlobal()) return true; break;
|
case lltok::GlobalID: if (ParseUnnamedGlobal()) return true; break;
|
||||||
case lltok::GlobalVar: if (ParseNamedGlobal()) return true; break;
|
case lltok::GlobalVar: if (ParseNamedGlobal()) return true; break;
|
||||||
case lltok::exclaim: if (ParseStandaloneMetadata()) return true; break;
|
case lltok::exclaim: if (ParseStandaloneMetadata()) return true; break;
|
||||||
case lltok::NamedOrCustomMD: if (ParseNamedMetadata()) return true; break;
|
case lltok::MetadataVar: if (ParseNamedMetadata()) return true; break;
|
||||||
|
|
||||||
// The Global variable production with no name can have many different
|
// The Global variable production with no name can have many different
|
||||||
// optional leading prefixes, the production is:
|
// optional leading prefixes, the production is:
|
||||||
@ -501,9 +501,9 @@ bool LLParser::ParseMDNodeID(MDNode *&Result) {
|
|||||||
/// ParseNamedMetadata:
|
/// ParseNamedMetadata:
|
||||||
/// !foo = !{ !1, !2 }
|
/// !foo = !{ !1, !2 }
|
||||||
bool LLParser::ParseNamedMetadata() {
|
bool LLParser::ParseNamedMetadata() {
|
||||||
assert(Lex.getKind() == lltok::NamedOrCustomMD);
|
assert(Lex.getKind() == lltok::MetadataVar);
|
||||||
Lex.Lex();
|
|
||||||
std::string Name = Lex.getStrVal();
|
std::string Name = Lex.getStrVal();
|
||||||
|
Lex.Lex();
|
||||||
|
|
||||||
if (ParseToken(lltok::equal, "expected '=' here") ||
|
if (ParseToken(lltok::equal, "expected '=' here") ||
|
||||||
ParseToken(lltok::exclaim, "Expected '!' here") ||
|
ParseToken(lltok::exclaim, "Expected '!' here") ||
|
||||||
@ -1067,7 +1067,7 @@ bool LLParser::ParseOptionalCallingConv(CallingConv::ID &CC) {
|
|||||||
/// ::= /* empty */
|
/// ::= /* empty */
|
||||||
/// ::= !dbg !42 (',' !dbg !57)*
|
/// ::= !dbg !42 (',' !dbg !57)*
|
||||||
bool LLParser::ParseOptionalCustomMetadata() {
|
bool LLParser::ParseOptionalCustomMetadata() {
|
||||||
if (Lex.getKind() != lltok::NamedOrCustomMD)
|
if (Lex.getKind() != lltok::MetadataVar)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -1087,7 +1087,7 @@ bool LLParser::ParseOptionalCustomMetadata() {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// The next value must be a custom metadata id.
|
// The next value must be a custom metadata id.
|
||||||
if (Lex.getKind() != lltok::NamedOrCustomMD)
|
if (Lex.getKind() != lltok::MetadataVar)
|
||||||
return TokError("expected more custom metadata ids");
|
return TokError("expected more custom metadata ids");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1112,7 +1112,7 @@ bool LLParser::ParseOptionalInfo(unsigned &Alignment) {
|
|||||||
|
|
||||||
// FIXME: Handle customized metadata info attached with an instruction.
|
// FIXME: Handle customized metadata info attached with an instruction.
|
||||||
do {
|
do {
|
||||||
if (Lex.getKind() == lltok::NamedOrCustomMD) {
|
if (Lex.getKind() == lltok::MetadataVar) {
|
||||||
if (ParseOptionalCustomMetadata()) return true;
|
if (ParseOptionalCustomMetadata()) return true;
|
||||||
} else if (Lex.getKind() == lltok::kw_align) {
|
} else if (Lex.getKind() == lltok::kw_align) {
|
||||||
if (ParseOptionalAlignment(Alignment)) return true;
|
if (ParseOptionalAlignment(Alignment)) return true;
|
||||||
@ -1131,7 +1131,8 @@ bool LLParser::ParseIndexList(SmallVectorImpl<unsigned> &Indices) {
|
|||||||
return TokError("expected ',' as start of index list");
|
return TokError("expected ',' as start of index list");
|
||||||
|
|
||||||
while (EatIfPresent(lltok::comma)) {
|
while (EatIfPresent(lltok::comma)) {
|
||||||
if (Lex.getKind() == lltok::NamedOrCustomMD)
|
// FIXME: TERRIBLE HACK. Loses comma state.
|
||||||
|
if (Lex.getKind() == lltok::MetadataVar)
|
||||||
break;
|
break;
|
||||||
unsigned Idx;
|
unsigned Idx;
|
||||||
if (ParseUInt32(Idx)) return true;
|
if (ParseUInt32(Idx)) return true;
|
||||||
@ -2115,7 +2116,8 @@ bool LLParser::ParseValID(ValID &ID) {
|
|||||||
ParseIndexList(Indices) ||
|
ParseIndexList(Indices) ||
|
||||||
ParseToken(lltok::rparen, "expected ')' in extractvalue constantexpr"))
|
ParseToken(lltok::rparen, "expected ')' in extractvalue constantexpr"))
|
||||||
return true;
|
return true;
|
||||||
if (Lex.getKind() == lltok::NamedOrCustomMD)
|
// FIXME: THIS ISN'T RIGHT? WHERE IS THE COMMA?
|
||||||
|
if (Lex.getKind() == lltok::MetadataVar)
|
||||||
if (ParseOptionalCustomMetadata()) return true;
|
if (ParseOptionalCustomMetadata()) return true;
|
||||||
|
|
||||||
if (!isa<StructType>(Val->getType()) && !isa<ArrayType>(Val->getType()))
|
if (!isa<StructType>(Val->getType()) && !isa<ArrayType>(Val->getType()))
|
||||||
@ -2139,7 +2141,7 @@ bool LLParser::ParseValID(ValID &ID) {
|
|||||||
ParseIndexList(Indices) ||
|
ParseIndexList(Indices) ||
|
||||||
ParseToken(lltok::rparen, "expected ')' in insertvalue constantexpr"))
|
ParseToken(lltok::rparen, "expected ')' in insertvalue constantexpr"))
|
||||||
return true;
|
return true;
|
||||||
if (Lex.getKind() == lltok::NamedOrCustomMD)
|
if (Lex.getKind() == lltok::MetadataVar)
|
||||||
if (ParseOptionalCustomMetadata()) return true;
|
if (ParseOptionalCustomMetadata()) return true;
|
||||||
if (!isa<StructType>(Val0->getType()) && !isa<ArrayType>(Val0->getType()))
|
if (!isa<StructType>(Val0->getType()) && !isa<ArrayType>(Val0->getType()))
|
||||||
return Error(ID.Loc, "extractvalue operand must be array or struct");
|
return Error(ID.Loc, "extractvalue operand must be array or struct");
|
||||||
@ -3014,7 +3016,7 @@ bool LLParser::ParseRet(Instruction *&Inst, BasicBlock *BB,
|
|||||||
|
|
||||||
if (EatIfPresent(lltok::comma)) {
|
if (EatIfPresent(lltok::comma)) {
|
||||||
// Parse optional custom metadata, e.g. !dbg
|
// Parse optional custom metadata, e.g. !dbg
|
||||||
if (Lex.getKind() == lltok::NamedOrCustomMD) {
|
if (Lex.getKind() == lltok::MetadataVar) {
|
||||||
if (ParseOptionalCustomMetadata()) return true;
|
if (ParseOptionalCustomMetadata()) return true;
|
||||||
} else {
|
} else {
|
||||||
// The normal case is one return value.
|
// The normal case is one return value.
|
||||||
@ -3026,7 +3028,7 @@ bool LLParser::ParseRet(Instruction *&Inst, BasicBlock *BB,
|
|||||||
do {
|
do {
|
||||||
// If optional custom metadata, e.g. !dbg is seen then this is the
|
// If optional custom metadata, e.g. !dbg is seen then this is the
|
||||||
// end of MRV.
|
// end of MRV.
|
||||||
if (Lex.getKind() == lltok::NamedOrCustomMD)
|
if (Lex.getKind() == lltok::MetadataVar)
|
||||||
break;
|
break;
|
||||||
if (ParseTypeAndValue(RV, PFS)) return true;
|
if (ParseTypeAndValue(RV, PFS)) return true;
|
||||||
RVs.push_back(RV);
|
RVs.push_back(RV);
|
||||||
@ -3485,7 +3487,7 @@ bool LLParser::ParsePHI(Instruction *&Inst, PerFunctionState &PFS) {
|
|||||||
if (!EatIfPresent(lltok::comma))
|
if (!EatIfPresent(lltok::comma))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (Lex.getKind() == lltok::NamedOrCustomMD)
|
if (Lex.getKind() == lltok::MetadataVar)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (ParseToken(lltok::lsquare, "expected '[' in phi value list") ||
|
if (ParseToken(lltok::lsquare, "expected '[' in phi value list") ||
|
||||||
@ -3496,7 +3498,7 @@ bool LLParser::ParsePHI(Instruction *&Inst, PerFunctionState &PFS) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Lex.getKind() == lltok::NamedOrCustomMD)
|
if (Lex.getKind() == lltok::MetadataVar)
|
||||||
if (ParseOptionalCustomMetadata()) return true;
|
if (ParseOptionalCustomMetadata()) return true;
|
||||||
|
|
||||||
if (!Ty->isFirstClassType())
|
if (!Ty->isFirstClassType())
|
||||||
@ -3624,7 +3626,7 @@ bool LLParser::ParseAlloc(Instruction *&Inst, PerFunctionState &PFS,
|
|||||||
|
|
||||||
if (EatIfPresent(lltok::comma)) {
|
if (EatIfPresent(lltok::comma)) {
|
||||||
if (Lex.getKind() == lltok::kw_align
|
if (Lex.getKind() == lltok::kw_align
|
||||||
|| Lex.getKind() == lltok::NamedOrCustomMD) {
|
|| Lex.getKind() == lltok::MetadataVar) {
|
||||||
if (ParseOptionalInfo(Alignment)) return true;
|
if (ParseOptionalInfo(Alignment)) return true;
|
||||||
} else {
|
} else {
|
||||||
if (ParseTypeAndValue(Size, SizeLoc, PFS)) return true;
|
if (ParseTypeAndValue(Size, SizeLoc, PFS)) return true;
|
||||||
@ -3744,14 +3746,14 @@ bool LLParser::ParseGetElementPtr(Instruction *&Inst, PerFunctionState &PFS) {
|
|||||||
|
|
||||||
SmallVector<Value*, 16> Indices;
|
SmallVector<Value*, 16> Indices;
|
||||||
while (EatIfPresent(lltok::comma)) {
|
while (EatIfPresent(lltok::comma)) {
|
||||||
if (Lex.getKind() == lltok::NamedOrCustomMD)
|
if (Lex.getKind() == lltok::MetadataVar)
|
||||||
break;
|
break;
|
||||||
if (ParseTypeAndValue(Val, EltLoc, PFS)) return true;
|
if (ParseTypeAndValue(Val, EltLoc, PFS)) return true;
|
||||||
if (!isa<IntegerType>(Val->getType()))
|
if (!isa<IntegerType>(Val->getType()))
|
||||||
return Error(EltLoc, "getelementptr index must be an integer");
|
return Error(EltLoc, "getelementptr index must be an integer");
|
||||||
Indices.push_back(Val);
|
Indices.push_back(Val);
|
||||||
}
|
}
|
||||||
if (Lex.getKind() == lltok::NamedOrCustomMD)
|
if (Lex.getKind() == lltok::MetadataVar)
|
||||||
if (ParseOptionalCustomMetadata()) return true;
|
if (ParseOptionalCustomMetadata()) return true;
|
||||||
|
|
||||||
if (!GetElementPtrInst::getIndexedType(Ptr->getType(),
|
if (!GetElementPtrInst::getIndexedType(Ptr->getType(),
|
||||||
@ -3771,7 +3773,7 @@ bool LLParser::ParseExtractValue(Instruction *&Inst, PerFunctionState &PFS) {
|
|||||||
if (ParseTypeAndValue(Val, Loc, PFS) ||
|
if (ParseTypeAndValue(Val, Loc, PFS) ||
|
||||||
ParseIndexList(Indices))
|
ParseIndexList(Indices))
|
||||||
return true;
|
return true;
|
||||||
if (Lex.getKind() == lltok::NamedOrCustomMD)
|
if (Lex.getKind() == lltok::MetadataVar)
|
||||||
if (ParseOptionalCustomMetadata()) return true;
|
if (ParseOptionalCustomMetadata()) return true;
|
||||||
|
|
||||||
if (!isa<StructType>(Val->getType()) && !isa<ArrayType>(Val->getType()))
|
if (!isa<StructType>(Val->getType()) && !isa<ArrayType>(Val->getType()))
|
||||||
@ -3794,7 +3796,7 @@ bool LLParser::ParseInsertValue(Instruction *&Inst, PerFunctionState &PFS) {
|
|||||||
ParseTypeAndValue(Val1, Loc1, PFS) ||
|
ParseTypeAndValue(Val1, Loc1, PFS) ||
|
||||||
ParseIndexList(Indices))
|
ParseIndexList(Indices))
|
||||||
return true;
|
return true;
|
||||||
if (Lex.getKind() == lltok::NamedOrCustomMD)
|
if (Lex.getKind() == lltok::MetadataVar)
|
||||||
if (ParseOptionalCustomMetadata()) return true;
|
if (ParseOptionalCustomMetadata()) return true;
|
||||||
|
|
||||||
if (!isa<StructType>(Val0->getType()) && !isa<ArrayType>(Val0->getType()))
|
if (!isa<StructType>(Val0->getType()) && !isa<ArrayType>(Val0->getType()))
|
||||||
|
@ -129,8 +129,8 @@ namespace lltok {
|
|||||||
LabelStr, // foo:
|
LabelStr, // foo:
|
||||||
GlobalVar, // @foo @"foo"
|
GlobalVar, // @foo @"foo"
|
||||||
LocalVar, // %foo %"foo"
|
LocalVar, // %foo %"foo"
|
||||||
|
MetadataVar, // !foo
|
||||||
StringConstant, // "foo"
|
StringConstant, // "foo"
|
||||||
NamedOrCustomMD, // !foo
|
|
||||||
|
|
||||||
// Type valued tokens (TyVal).
|
// Type valued tokens (TyVal).
|
||||||
Type,
|
Type,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user