mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-26 23:29:22 +00:00
Add ParseInlineMetadata() which can parses metadata that refers to an instruction. Extend ParseParameterList() to use this new function so that calls to llvm.dbg.declare can pass inline metadata
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90497 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4dc4a61c0c
commit
1971556cc2
@ -581,6 +581,37 @@ bool LLParser::ParseStandaloneMetadata() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// ParseInlineMetadata:
|
||||||
|
/// !{type %instr}
|
||||||
|
/// !{...} MDNode
|
||||||
|
/// !"foo" MDString
|
||||||
|
bool LLParser::ParseInlineMetadata(Value *&V, PerFunctionState &PFS) {
|
||||||
|
assert(Lex.getKind() == lltok::Metadata && "Only for Metadata");
|
||||||
|
V = 0;
|
||||||
|
|
||||||
|
Lex.Lex();
|
||||||
|
if (Lex.getKind() == lltok::lbrace) {
|
||||||
|
Lex.Lex();
|
||||||
|
if (ParseTypeAndValue(V, PFS) ||
|
||||||
|
ParseToken(lltok::rbrace, "expected end of metadata node"))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
Value *Vals[] = { V };
|
||||||
|
V = MDNode::get(Context, Vals, 1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Standalone metadata reference
|
||||||
|
// !{ ..., !42, ... }
|
||||||
|
if (!ParseMDNode((MetadataBase *&)V))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// MDString:
|
||||||
|
// '!' STRINGCONSTANT
|
||||||
|
if (ParseMDString((MetadataBase *&)V)) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// ParseAlias:
|
/// ParseAlias:
|
||||||
/// ::= GlobalVar '=' OptionalVisibility 'alias' OptionalLinkage Aliasee
|
/// ::= GlobalVar '=' OptionalVisibility 'alias' OptionalLinkage Aliasee
|
||||||
/// Aliasee
|
/// Aliasee
|
||||||
@ -1377,15 +1408,23 @@ bool LLParser::ParseParameterList(SmallVectorImpl<ParamInfo> &ArgList,
|
|||||||
// Parse the argument.
|
// Parse the argument.
|
||||||
LocTy ArgLoc;
|
LocTy ArgLoc;
|
||||||
PATypeHolder ArgTy(Type::getVoidTy(Context));
|
PATypeHolder ArgTy(Type::getVoidTy(Context));
|
||||||
unsigned ArgAttrs1, ArgAttrs2;
|
unsigned ArgAttrs1 = Attribute::None;
|
||||||
|
unsigned ArgAttrs2 = Attribute::None;
|
||||||
Value *V;
|
Value *V;
|
||||||
if (ParseType(ArgTy, ArgLoc) ||
|
if (ParseType(ArgTy, ArgLoc))
|
||||||
ParseOptionalAttrs(ArgAttrs1, 0) ||
|
|
||||||
ParseValue(ArgTy, V, PFS) ||
|
|
||||||
// FIXME: Should not allow attributes after the argument, remove this in
|
|
||||||
// LLVM 3.0.
|
|
||||||
ParseOptionalAttrs(ArgAttrs2, 3))
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (Lex.getKind() == lltok::Metadata) {
|
||||||
|
if (ParseInlineMetadata(V, PFS))
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
if (ParseOptionalAttrs(ArgAttrs1, 0) ||
|
||||||
|
ParseValue(ArgTy, V, PFS) ||
|
||||||
|
// FIXME: Should not allow attributes after the argument, remove this
|
||||||
|
// in LLVM 3.0.
|
||||||
|
ParseOptionalAttrs(ArgAttrs2, 3))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
ArgList.push_back(ParamInfo(ArgLoc, V, ArgAttrs1|ArgAttrs2));
|
ArgList.push_back(ParamInfo(ArgLoc, V, ArgAttrs1|ArgAttrs2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,7 +279,9 @@ namespace llvm {
|
|||||||
LocTy Loc;
|
LocTy Loc;
|
||||||
return ParseTypeAndBasicBlock(BB, Loc, PFS);
|
return ParseTypeAndBasicBlock(BB, Loc, PFS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ParseInlineMetadata(Value *&V, PerFunctionState &PFS);
|
||||||
|
|
||||||
struct ParamInfo {
|
struct ParamInfo {
|
||||||
LocTy Loc;
|
LocTy Loc;
|
||||||
Value *V;
|
Value *V;
|
||||||
|
Loading…
Reference in New Issue
Block a user