mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 16:24:23 +00:00
IR: Add 'distinct' MDNodes to bitcode and assembly
Propagate whether `MDNode`s are 'distinct' through the other types of IR (assembly and bitcode). This adds the `distinct` keyword to assembly. Currently, no one actually calls `MDNode::getDistinct()`, so these nodes only get created for: - self-references, which are never uniqued, and - nodes whose operands are replaced that hit a uniquing collision. The concept of distinct nodes is still not quite first-class, since distinct-ness doesn't yet survive across `MapMetadata()`. Part of PR22111. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225474 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -618,8 +618,9 @@ bool LLParser::ParseStandaloneMetadata() {
|
||||
if (Lex.getKind() == lltok::Type)
|
||||
return TokError("unexpected type in metadata definition");
|
||||
|
||||
bool IsDistinct = EatIfPresent(lltok::kw_distinct);
|
||||
if (ParseToken(lltok::exclaim, "Expected '!' here") ||
|
||||
ParseMDNode(Init))
|
||||
ParseMDNode(Init, IsDistinct))
|
||||
return true;
|
||||
|
||||
// See if this was forward referenced, if so, handle it.
|
||||
@ -2945,12 +2946,15 @@ bool LLParser::ParseGlobalValueVector(SmallVectorImpl<Constant *> &Elts) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LLParser::ParseMDNode(MDNode *&MD) {
|
||||
bool LLParser::ParseMDNode(MDNode *&MD, bool IsDistinct) {
|
||||
SmallVector<Metadata *, 16> Elts;
|
||||
if (ParseMDNodeVector(Elts))
|
||||
return true;
|
||||
|
||||
MD = MDNode::get(Context, Elts);
|
||||
if (IsDistinct)
|
||||
MD = MDNode::getDistinct(Context, Elts);
|
||||
else
|
||||
MD = MDNode::get(Context, Elts);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user