Give ParseInstructionMetadata access to the PerFunctionState object.

This is in preparation for generalizing its parsing of function-local
values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111893 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2010-08-24 02:05:17 +00:00
parent 078b05320a
commit 9d072f51eb
2 changed files with 5 additions and 4 deletions

View File

@ -1117,7 +1117,8 @@ bool LLParser::ParseOptionalCallingConv(CallingConv::ID &CC) {
/// ParseInstructionMetadata /// ParseInstructionMetadata
/// ::= !dbg !42 (',' !dbg !57)* /// ::= !dbg !42 (',' !dbg !57)*
bool LLParser::ParseInstructionMetadata(Instruction *Inst) { bool LLParser::ParseInstructionMetadata(Instruction *Inst,
PerFunctionState *PFS) {
do { do {
if (Lex.getKind() != lltok::MetadataVar) if (Lex.getKind() != lltok::MetadataVar)
return TokError("expected metadata after comma"); return TokError("expected metadata after comma");
@ -2981,7 +2982,7 @@ bool LLParser::ParseBasicBlock(PerFunctionState &PFS) {
// With a normal result, we check to see if the instruction is followed by // With a normal result, we check to see if the instruction is followed by
// a comma and metadata. // a comma and metadata.
if (EatIfPresent(lltok::comma)) if (EatIfPresent(lltok::comma))
if (ParseInstructionMetadata(Inst)) if (ParseInstructionMetadata(Inst, &PFS))
return true; return true;
break; break;
case InstExtraComma: case InstExtraComma:
@ -2989,7 +2990,7 @@ bool LLParser::ParseBasicBlock(PerFunctionState &PFS) {
// If the instruction parser ate an extra comma at the end of it, it // If the instruction parser ate an extra comma at the end of it, it
// *must* be followed by metadata. // *must* be followed by metadata.
if (ParseInstructionMetadata(Inst)) if (ParseInstructionMetadata(Inst, &PFS))
return true; return true;
break; break;
} }

View File

@ -180,7 +180,6 @@ namespace llvm {
bool ParseOptionalCallingConv(CallingConv::ID &CC); bool ParseOptionalCallingConv(CallingConv::ID &CC);
bool ParseOptionalAlignment(unsigned &Alignment); bool ParseOptionalAlignment(unsigned &Alignment);
bool ParseOptionalStackAlignment(unsigned &Alignment); bool ParseOptionalStackAlignment(unsigned &Alignment);
bool ParseInstructionMetadata(Instruction *Inst);
bool ParseOptionalCommaAlign(unsigned &Alignment, bool &AteExtraComma); bool ParseOptionalCommaAlign(unsigned &Alignment, bool &AteExtraComma);
bool ParseIndexList(SmallVectorImpl<unsigned> &Indices,bool &AteExtraComma); bool ParseIndexList(SmallVectorImpl<unsigned> &Indices,bool &AteExtraComma);
bool ParseIndexList(SmallVectorImpl<unsigned> &Indices) { bool ParseIndexList(SmallVectorImpl<unsigned> &Indices) {
@ -310,6 +309,7 @@ namespace llvm {
bool ParseGlobalValueVector(SmallVectorImpl<Constant*> &Elts); bool ParseGlobalValueVector(SmallVectorImpl<Constant*> &Elts);
bool ParseMetadataValue(ValID &ID, PerFunctionState *PFS); bool ParseMetadataValue(ValID &ID, PerFunctionState *PFS);
bool ParseMDNodeVector(SmallVectorImpl<Value*> &, PerFunctionState *PFS); bool ParseMDNodeVector(SmallVectorImpl<Value*> &, PerFunctionState *PFS);
bool ParseInstructionMetadata(Instruction *Inst, PerFunctionState *PFS);
// Function Parsing. // Function Parsing.
struct ArgInfo { struct ArgInfo {