summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-04-24 21:29:36 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-04-24 21:29:36 +0000
commit27d702cb8b4a47a7d0359db2ab6ab1140fef1073 (patch)
treef11a455d18d8454016577503f4014fa83b33177e
parent82291459611118ae441179945b472ad68e86a7d4 (diff)
downloadbcm5719-llvm-27d702cb8b4a47a7d0359db2ab6ab1140fef1073.tar.gz
bcm5719-llvm-27d702cb8b4a47a7d0359db2ab6ab1140fef1073.zip
LLParser: Simplify ParseInstructionMetadata(), NFC
Remove unused `PFS` variable and take the `Instruction` by reference. (Not really related to PR23340, but might as well clean this up while I'm here.) llvm-svn: 235782
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp11
-rw-r--r--llvm/lib/AsmParser/LLParser.h2
2 files changed, 6 insertions, 7 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 18fa6978065..f2a6056d15c 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -1504,8 +1504,7 @@ bool LLParser::ParseMetadataAttachment(unsigned &Kind, MDNode *&MD) {
/// ParseInstructionMetadata
/// ::= !dbg !42 (',' !dbg !57)*
-bool LLParser::ParseInstructionMetadata(Instruction *Inst,
- PerFunctionState *PFS) {
+bool LLParser::ParseInstructionMetadata(Instruction &Inst) {
do {
if (Lex.getKind() != lltok::MetadataVar)
return TokError("expected metadata after comma");
@@ -1515,9 +1514,9 @@ bool LLParser::ParseInstructionMetadata(Instruction *Inst,
if (ParseMetadataAttachment(MDK, N))
return true;
- Inst->setMetadata(MDK, N);
+ Inst.setMetadata(MDK, N);
if (MDK == LLVMContext::MD_tbaa)
- InstsWithTBAATag.push_back(Inst);
+ InstsWithTBAATag.push_back(&Inst);
// If this is the end of the list, we're done.
} while (EatIfPresent(lltok::comma));
@@ -4396,7 +4395,7 @@ bool LLParser::ParseBasicBlock(PerFunctionState &PFS) {
// With a normal result, we check to see if the instruction is followed by
// a comma and metadata.
if (EatIfPresent(lltok::comma))
- if (ParseInstructionMetadata(Inst, &PFS))
+ if (ParseInstructionMetadata(*Inst))
return true;
break;
case InstExtraComma:
@@ -4404,7 +4403,7 @@ bool LLParser::ParseBasicBlock(PerFunctionState &PFS) {
// If the instruction parser ate an extra comma at the end of it, it
// *must* be followed by metadata.
- if (ParseInstructionMetadata(Inst, &PFS))
+ if (ParseInstructionMetadata(*Inst))
return true;
break;
}
diff --git a/llvm/lib/AsmParser/LLParser.h b/llvm/lib/AsmParser/LLParser.h
index 9db50a7b173..ea18b58d32f 100644
--- a/llvm/lib/AsmParser/LLParser.h
+++ b/llvm/lib/AsmParser/LLParser.h
@@ -393,7 +393,7 @@ namespace llvm {
bool ParseMDNodeTail(MDNode *&MD);
bool ParseMDNodeVector(SmallVectorImpl<Metadata *> &MDs);
bool ParseMetadataAttachment(unsigned &Kind, MDNode *&MD);
- bool ParseInstructionMetadata(Instruction *Inst, PerFunctionState *PFS);
+ bool ParseInstructionMetadata(Instruction &Inst);
template <class FieldTy>
bool ParseMDField(LocTy Loc, StringRef Name, FieldTy &Result);
OpenPOWER on IntegriCloud